From: Andrea Bianco Date: Mon, 21 Sep 2020 21:40:51 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.3 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=08a8ef419ded52dfa85fb29e43f2d9531b61c9a5;p=motion2.git Built motion from commit (unavailable).|2.5.3 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c952ac1..0767ba4 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2020-09-21T21:03:59.794Z", + "time": "2020-09-21T21:28:01.707Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9eb8afa..e5c7521 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2020-09-21T21:03:59.794Z", + "time": "2020-09-21T21:28:01.707Z", "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 f949ca0..34de4c9 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 _0x7820=['jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT','sequelize','action','STRING','contactManager'];(function(_0x2ae73d,_0x159389){var _0x4bc7c8=function(_0x2f136f){while(--_0x2f136f){_0x2ae73d['push'](_0x2ae73d['shift']());}};_0x4bc7c8(++_0x159389);}(_0x7820,0x1eb));var _0x0782=function(_0x4493a2,_0x35de02){_0x4493a2=_0x4493a2-0x0;var _0x29d21b=_0x7820[_0x4493a2];return _0x29d21b;};'use strict';var Sequelize=require(_0x0782('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x29b758){return this['getDataValue'](_0x0782('0x1'));}},'action':{'type':Sequelize[_0x0782('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0782('0x3'),'integration','motionbar',_0x0782('0x4'),_0x0782('0x5'),_0x0782('0x6'),'bot',_0x0782('0x7')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x0782('0x8')},'data1':{'type':Sequelize[_0x0782('0x2')](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[_0x0782('0x2')](0x1000),'comment':_0x0782('0x9')},'data3':{'type':Sequelize[_0x0782('0x2')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x0782('0x2')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x0782('0xa')]}}; \ No newline at end of file +var _0x1137=['STRING','contactManager','motionbar','jscripty','browser','bot','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)]','TEXT','sequelize','getDataValue','action'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x1137,0x17d));var _0x7113=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0x1137[_0x5df61d];return _0x24cc4c;};'use strict';var Sequelize=require(_0x7113('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5575c8){return this[_0x7113('0x1')](_0x7113('0x2'));}},'action':{'type':Sequelize[_0x7113('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7113('0x4'),'integration',_0x7113('0x5'),_0x7113('0x6'),'urlForward',_0x7113('0x7'),_0x7113('0x8'),'script']],'msg':_0x7113('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x7113('0x3')](0x1000),'comment':_0x7113('0xa')},'data2':{'type':Sequelize[_0x7113('0x3')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x7113('0x3')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x7113('0x3')](0x1000)},'data6':{'type':Sequelize[_0x7113('0x3')]},'data7':{'type':Sequelize[_0x7113('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index bb60781..a1f642d 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 _0x956b=['stack','name','send','body','Action','params','catch','find','html-pdf','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','Content-Range','apply','reject','update','then','destroy','sendStatus','error'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x956b,0xda));var _0xb956=function(_0x2fc8a9,_0x500be1){_0x2fc8a9=_0x2fc8a9-0x0;var _0x1ca3f5=_0x956b[_0x2fc8a9];return _0x1ca3f5;};'use strict';var pdf=require(_0xb956('0x0'));var emlformat=require(_0xb956('0x1'));var rimraf=require(_0xb956('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb956('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb956('0x4'));var util=require('util');var path=require(_0xb956('0x5'));var sox=require(_0xb956('0x6'));var csv=require(_0xb956('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb956('0x8'));var squel=require(_0xb956('0x9'));var crypto=require(_0xb956('0xa'));var jsforce=require(_0xb956('0xb'));var deskjs=require(_0xb956('0xc'));var toCsv=require(_0xb956('0x7'));var querystring=require(_0xb956('0xd'));var Papa=require('papaparse');var Redis=require(_0xb956('0xe'));var authService=require(_0xb956('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb956('0x10'));var hardwareService=require(_0xb956('0x11'));var logger=require(_0xb956('0x12'))('api');var utils=require(_0xb956('0x13'));var config=require(_0xb956('0x14'));var db=require(_0xb956('0x15'))['db'];function respondWithStatusCode(_0x460a28,_0x17e919){_0x17e919=_0x17e919||0xcc;return function(_0x336e7e){if(_0x336e7e){return _0x460a28['sendStatus'](_0x17e919);}return _0x460a28['status'](_0x17e919)[_0xb956('0x16')]();};}function respondWithResult(_0x1d901d,_0x58dfaa){_0x58dfaa=_0x58dfaa||0xc8;return function(_0x43ddaa){if(_0x43ddaa){return _0x1d901d['status'](_0x58dfaa)[_0xb956('0x17')](_0x43ddaa);}};}function respondWithFilteredResult(_0x334f27,_0x202272){return function(_0x5f38e5){if(_0x5f38e5){var _0x3a67e2=_0x5f38e5[_0xb956('0x18')],_0x5cce2a=_0x202272[_0xb956('0x19')],_0x28feef=_0x202272['offset']+_0x202272['limit'],_0x3a599f;if(_0x28feef>=_0x3a67e2){_0x28feef=_0x3a67e2;_0x3a599f=0xc8;}else{_0x3a599f=0xce;}_0x334f27['status'](_0x3a599f);return _0x334f27['set'](_0xb956('0x1a'),_0x5cce2a+'-'+_0x28feef+'/'+_0x3a67e2)[_0xb956('0x17')](_0x5f38e5);}return null;};}function patchUpdates(_0x5c0b0a){return function(_0x19bb97){try{jsonpatch[_0xb956('0x1b')](_0x19bb97,_0x5c0b0a,!![]);}catch(_0x10b4e7){return BPromise[_0xb956('0x1c')](_0x10b4e7);}return _0x19bb97['save']();};}function saveUpdates(_0x4812c4,_0x1ac12a){return function(_0x1f0ad7){if(_0x1f0ad7){return _0x1f0ad7[_0xb956('0x1d')](_0x4812c4)[_0xb956('0x1e')](function(_0xe63c14){return _0xe63c14;});}return null;};}function removeEntity(_0x2b76b0,_0x39924b){return function(_0x7b8771){if(_0x7b8771){return _0x7b8771[_0xb956('0x1f')]()[_0xb956('0x1e')](function(){_0x2b76b0['status'](0xcc)[_0xb956('0x16')]();});}};}function handleEntityNotFound(_0x4130f3,_0xfb4e2){return function(_0x1474a5){if(!_0x1474a5){_0x4130f3[_0xb956('0x20')](0x194);}return _0x1474a5;};}function handleError(_0x1cb9b9,_0x4d1799){_0x4d1799=_0x4d1799||0x1f4;return function(_0x188102){logger[_0xb956('0x21')](_0x188102[_0xb956('0x22')]);if(_0x188102[_0xb956('0x23')]){delete _0x188102[_0xb956('0x23')];}_0x1cb9b9['status'](_0x4d1799)[_0xb956('0x24')](_0x188102);};}exports[_0xb956('0x1d')]=function(_0x4a9464,_0x354876){if(_0x4a9464[_0xb956('0x25')]['id']){delete _0x4a9464[_0xb956('0x25')]['id'];}return db[_0xb956('0x26')]['find']({'where':{'id':_0x4a9464[_0xb956('0x27')]['id']}})[_0xb956('0x1e')](handleEntityNotFound(_0x354876,null))['then'](saveUpdates(_0x4a9464[_0xb956('0x25')],null))[_0xb956('0x1e')](respondWithResult(_0x354876,null))[_0xb956('0x28')](handleError(_0x354876,null));};exports[_0xb956('0x1f')]=function(_0xa9e8aa,_0x44328a){return db[_0xb956('0x26')][_0xb956('0x29')]({'where':{'id':_0xa9e8aa['params']['id']}})[_0xb956('0x1e')](handleEntityNotFound(_0x44328a,null))['then'](removeEntity(_0x44328a,null))[_0xb956('0x28')](handleError(_0x44328a,null));}; \ No newline at end of file +var _0x3641=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','Content-Range','reject','then','end','sendStatus','stack','name','body','Action','find','params','destroy','catch','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x330714,_0x5bdfd2){var _0x11e688=function(_0x4f34fc){while(--_0x4f34fc){_0x330714['push'](_0x330714['shift']());}};_0x11e688(++_0x5bdfd2);}(_0x3641,0x1d9));var _0x1364=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3641[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1364('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1364('0x1'));var zipdir=require(_0x1364('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1364('0x3'));var moment=require(_0x1364('0x4'));var BPromise=require(_0x1364('0x5'));var Mustache=require(_0x1364('0x6'));var util=require(_0x1364('0x7'));var path=require('path');var sox=require(_0x1364('0x8'));var csv=require(_0x1364('0x9'));var ejs=require(_0x1364('0xa'));var fs=require('fs');var _=require(_0x1364('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1364('0xc'));var deskjs=require(_0x1364('0xd'));var toCsv=require(_0x1364('0x9'));var querystring=require(_0x1364('0xe'));var Papa=require(_0x1364('0xf'));var Redis=require('ioredis');var authService=require(_0x1364('0x10'));var qs=require(_0x1364('0x11'));var as=require(_0x1364('0x12'));var hardwareService=require(_0x1364('0x13'));var logger=require(_0x1364('0x14'))(_0x1364('0x15'));var utils=require(_0x1364('0x16'));var config=require('../../config/environment');var db=require(_0x1364('0x17'))['db'];function respondWithStatusCode(_0x3b3881,_0xb33bc){_0xb33bc=_0xb33bc||0xcc;return function(_0x203ac3){if(_0x203ac3){return _0x3b3881['sendStatus'](_0xb33bc);}return _0x3b3881['status'](_0xb33bc)['end']();};}function respondWithResult(_0x37fc3f,_0x16ac19){_0x16ac19=_0x16ac19||0xc8;return function(_0xe88cd4){if(_0xe88cd4){return _0x37fc3f[_0x1364('0x18')](_0x16ac19)[_0x1364('0x19')](_0xe88cd4);}};}function respondWithFilteredResult(_0x54ca3d,_0x25e6a0){return function(_0x3780bf){if(_0x3780bf){var _0x54f17a=_0x3780bf['count'],_0x574c7e=_0x25e6a0[_0x1364('0x1a')],_0x2dd506=_0x25e6a0[_0x1364('0x1a')]+_0x25e6a0[_0x1364('0x1b')],_0xde8384;if(_0x2dd506>=_0x54f17a){_0x2dd506=_0x54f17a;_0xde8384=0xc8;}else{_0xde8384=0xce;}_0x54ca3d['status'](_0xde8384);return _0x54ca3d['set'](_0x1364('0x1c'),_0x574c7e+'-'+_0x2dd506+'/'+_0x54f17a)['json'](_0x3780bf);}return null;};}function patchUpdates(_0x14823e){return function(_0x25f5b7){try{jsonpatch['apply'](_0x25f5b7,_0x14823e,!![]);}catch(_0x5babf7){return BPromise[_0x1364('0x1d')](_0x5babf7);}return _0x25f5b7['save']();};}function saveUpdates(_0x282f29,_0x510be8){return function(_0x22d214){if(_0x22d214){return _0x22d214['update'](_0x282f29)[_0x1364('0x1e')](function(_0x58849b){return _0x58849b;});}return null;};}function removeEntity(_0x4f193b,_0x51567b){return function(_0x398309){if(_0x398309){return _0x398309['destroy']()[_0x1364('0x1e')](function(){_0x4f193b[_0x1364('0x18')](0xcc)[_0x1364('0x1f')]();});}};}function handleEntityNotFound(_0x5deb8c,_0x553f8d){return function(_0xf1139b){if(!_0xf1139b){_0x5deb8c[_0x1364('0x20')](0x194);}return _0xf1139b;};}function handleError(_0x1b262d,_0x31113e){_0x31113e=_0x31113e||0x1f4;return function(_0x2abd92){logger['error'](_0x2abd92[_0x1364('0x21')]);if(_0x2abd92['name']){delete _0x2abd92[_0x1364('0x22')];}_0x1b262d[_0x1364('0x18')](_0x31113e)['send'](_0x2abd92);};}exports['update']=function(_0x930c2c,_0x17d6fb){if(_0x930c2c[_0x1364('0x23')]['id']){delete _0x930c2c['body']['id'];}return db[_0x1364('0x24')][_0x1364('0x25')]({'where':{'id':_0x930c2c[_0x1364('0x26')]['id']}})[_0x1364('0x1e')](handleEntityNotFound(_0x17d6fb,null))[_0x1364('0x1e')](saveUpdates(_0x930c2c['body'],null))[_0x1364('0x1e')](respondWithResult(_0x17d6fb,null))['catch'](handleError(_0x17d6fb,null));};exports[_0x1364('0x27')]=function(_0x489699,_0x25b4c5){return db[_0x1364('0x24')][_0x1364('0x25')]({'where':{'id':_0x489699[_0x1364('0x26')]['id']}})['then'](handleEntityNotFound(_0x25b4c5,null))['then'](removeEntity(_0x25b4c5,null))[_0x1364('0x28')](handleError(_0x25b4c5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 6e58ce4..1ee4b45 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 _0xfc0a=['request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1bb067,_0x46110f){var _0x417d65=function(_0x2b73fe){while(--_0x2b73fe){_0x1bb067['push'](_0x1bb067['shift']());}};_0x417d65(++_0x46110f);}(_0xfc0a,0xae));var _0xafc0=function(_0x536851,_0x2302b2){_0x536851=_0x536851-0x0;var _0x30e3bf=_0xfc0a[_0x536851];return _0x30e3bf;};'use strict';var _=require(_0xafc0('0x0'));var util=require(_0xafc0('0x1'));var logger=require(_0xafc0('0x2'))(_0xafc0('0x3'));var moment=require(_0xafc0('0x4'));var BPromise=require(_0xafc0('0x5'));var rp=require(_0xafc0('0x6'));var fs=require('fs');var path=require(_0xafc0('0x7'));var rimraf=require(_0xafc0('0x8'));var config=require(_0xafc0('0x9'));var attributes=require(_0xafc0('0xa'));module[_0xafc0('0xb')]=function(_0x488f51,_0x5ece3d){return _0x488f51[_0xafc0('0xc')](_0xafc0('0xd'),attributes,{'tableName':_0xafc0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb6=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./action.attributes','exports','tools_actions','lodash'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xafb6,0x1b7));var _0x6afb=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0xafb6[_0x2adfb1];return _0xa52d45;};'use strict';var _=require(_0x6afb('0x0'));var util=require(_0x6afb('0x1'));var logger=require(_0x6afb('0x2'))(_0x6afb('0x3'));var moment=require(_0x6afb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6afb('0x5'));var rimraf=require(_0x6afb('0x6'));var config=require(_0x6afb('0x7'));var attributes=require(_0x6afb('0x8'));module[_0x6afb('0x9')]=function(_0x3dd50d,_0x36f84f){return _0x3dd50d['define']('Action',attributes,{'tableName':_0x6afb('0xa'),'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 253946a..6e9c4a3 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 _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(_0x5f328f,_0x518372){var _0x5957de=function(_0x42ce03){while(--_0x42ce03){_0x5f328f['push'](_0x5f328f['shift']());}};_0x5957de(++_0x518372);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 305f229..1a8c797 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 _0xeb2d=['../../config/environment','put','delete','/:id','isAuthenticated','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x10c3d5,_0x552693){var _0x1dca46=function(_0x59c2f9){while(--_0x59c2f9){_0x10c3d5['push'](_0x10c3d5['shift']());}};_0x1dca46(++_0x552693);}(_0xeb2d,0x192));var _0xdeb2=function(_0x38f653,_0x56dd38){_0x38f653=_0x38f653-0x0;var _0x5a5b6e=_0xeb2d[_0x38f653];return _0x5a5b6e;};'use strict';var multer=require(_0xdeb2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdeb2('0x1'));var express=require(_0xdeb2('0x2'));var router=express[_0xdeb2('0x3')]();var auth=require(_0xdeb2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdeb2('0x5'));var controller=require('./action.controller');router[_0xdeb2('0x6')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdeb2('0x7')](_0xdeb2('0x8'),auth[_0xdeb2('0x9')](),controller['destroy']);module[_0xdeb2('0xa')]=router; \ No newline at end of file +var _0xea30=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','delete','isAuthenticated'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xea30,0xe5));var _0x0ea3=function(_0x483d79,_0x1b1c6a){_0x483d79=_0x483d79-0x0;var _0x1ab7ea=_0xea30[_0x483d79];return _0x1ab7ea;};'use strict';var multer=require(_0x0ea3('0x0'));var util=require(_0x0ea3('0x1'));var path=require('path');var timeout=require(_0x0ea3('0x2'));var express=require('express');var router=express[_0x0ea3('0x3')]();var auth=require(_0x0ea3('0x4'));var interaction=require(_0x0ea3('0x5'));var config=require(_0x0ea3('0x6'));var controller=require('./action.controller');router[_0x0ea3('0x7')](_0x0ea3('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x0ea3('0x9')](_0x0ea3('0x8'),auth[_0x0ea3('0xa')](),controller['destroy']);module[_0x0ea3('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d24c25a..b53609c 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 _0x5d4d=['STRING','TEXT','sequelize','exports'];(function(_0xd6e6c1,_0x5ca4e4){var _0x46cf76=function(_0x32c8da){while(--_0x32c8da){_0xd6e6c1['push'](_0xd6e6c1['shift']());}};_0x46cf76(++_0x5ca4e4);}(_0x5d4d,0x14e));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd5d4('0x0'));module[_0xd5d4('0x1')]={'name':{'type':Sequelize[_0xd5d4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd5d4('0x2')]},'parent':{'type':Sequelize[_0xd5d4('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xd5d4('0x3')]},'joins':{'type':Sequelize[_0xd5d4('0x3')]}}; \ No newline at end of file +var _0x6de4=['STRING','TEXT','sequelize','exports'];(function(_0x563af4,_0x27029b){var _0x220d60=function(_0x59dbc4){while(--_0x59dbc4){_0x563af4['push'](_0x563af4['shift']());}};_0x220d60(++_0x27029b);}(_0x6de4,0x15e));var _0x46de=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6de4[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x46de('0x0'));module[_0x46de('0x1')]={'name':{'type':Sequelize[_0x46de('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x46de('0x2')]},'parent':{'type':Sequelize[_0x46de('0x2')]},'table':{'type':Sequelize[_0x46de('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x46de('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 93e803c..4cbb71e 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 _0x9f94=['Run\x20Query:','toString','fork','../../components/export/','../../files/reports','savename','select','countTable','run','runReport','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','get','CustomReports','UserProfileResource','then','end','error','name','send','index','AnalyticCustomReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MIN(%s)','HOUR(%s)','parse','parentKey','clone','No\x20available\x20data','output','web','randomstring','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info'];(function(_0x2ba34b,_0x16b94e){var _0x28e6f1=function(_0x1f513b){while(--_0x1f513b){_0x2ba34b['push'](_0x2ba34b['shift']());}};_0x28e6f1(++_0x16b94e);}(_0x9f94,0x1e7));var _0x49f9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9f94[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x49f9('0x0'));var emlformat=require(_0x49f9('0x1'));var rimraf=require(_0x49f9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x49f9('0x3'));var moment=require(_0x49f9('0x4'));var BPromise=require(_0x49f9('0x5'));var Mustache=require(_0x49f9('0x6'));var util=require(_0x49f9('0x7'));var path=require('path');var sox=require(_0x49f9('0x8'));var csv=require(_0x49f9('0x9'));var ejs=require(_0x49f9('0xa'));var fs=require('fs');var _=require(_0x49f9('0xb'));var squel=require(_0x49f9('0xc'));var crypto=require(_0x49f9('0xd'));var jsforce=require(_0x49f9('0xe'));var deskjs=require(_0x49f9('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49f9('0x10'));var Redis=require('ioredis');var authService=require(_0x49f9('0x11'));var qs=require(_0x49f9('0x12'));var as=require(_0x49f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49f9('0x14'))('api');var utils=require(_0x49f9('0x15'));var config=require(_0x49f9('0x16'));var db=require(_0x49f9('0x17'))['db'];var dbH=require(_0x49f9('0x17'))['dbH'];function respondWithStatusCode(_0x52c3fe,_0x446fb1){_0x446fb1=_0x446fb1||0xcc;return function(_0x9ed1f5){if(_0x9ed1f5){return _0x52c3fe[_0x49f9('0x18')](_0x446fb1);}return _0x52c3fe[_0x49f9('0x19')](_0x446fb1)['end']();};}function respondWithResult(_0x4e7790,_0x5f1577){_0x5f1577=_0x5f1577||0xc8;return function(_0x2a23dc){if(_0x2a23dc){return _0x4e7790['status'](_0x5f1577)[_0x49f9('0x1a')](_0x2a23dc);}};}function respondWithFilteredResult(_0x4b8228,_0x398a05){return function(_0x760ac){if(_0x760ac){var _0x482aa5=_0x760ac[_0x49f9('0x1b')],_0x45a376=_0x398a05[_0x49f9('0x1c')],_0x1a2026=_0x398a05[_0x49f9('0x1c')]+_0x398a05[_0x49f9('0x1d')],_0x24250f;if(_0x1a2026>=_0x482aa5){_0x1a2026=_0x482aa5;_0x24250f=0xc8;}else{_0x24250f=0xce;}_0x4b8228[_0x49f9('0x19')](_0x24250f);return _0x4b8228[_0x49f9('0x1e')](_0x49f9('0x1f'),_0x45a376+'-'+_0x1a2026+'/'+_0x482aa5)[_0x49f9('0x1a')](_0x760ac);}return null;};}function patchUpdates(_0x1971e3){return function(_0xa9b24c){try{jsonpatch[_0x49f9('0x20')](_0xa9b24c,_0x1971e3,!![]);}catch(_0x136836){return BPromise['reject'](_0x136836);}return _0xa9b24c['save']();};}function saveUpdates(_0x916ef5,_0x4884ef){return function(_0x3e8a62){if(_0x3e8a62){return _0x3e8a62['update'](_0x916ef5)['then'](function(_0x42c0aa){return _0x42c0aa;});}return null;};}function removeEntity(_0xde1383,_0x4e92e5){return function(_0x372347){if(_0x372347){return _0x372347['destroy']()['then'](function(){var _0xf2afb7=_0x372347[_0x49f9('0x21')]({'plain':!![]});var _0x5757d3=_0x49f9('0x22');return db[_0x49f9('0x23')]['destroy']({'where':{'type':_0x5757d3,'resourceId':_0xf2afb7['id']}})[_0x49f9('0x24')](function(){return _0x372347;});})[_0x49f9('0x24')](function(){_0xde1383[_0x49f9('0x19')](0xcc)[_0x49f9('0x25')]();});}};}function handleEntityNotFound(_0x4e6a90,_0xa559a2){return function(_0x3aff06){if(!_0x3aff06){_0x4e6a90[_0x49f9('0x18')](0x194);}return _0x3aff06;};}function handleError(_0x10da65,_0x28e56f){_0x28e56f=_0x28e56f||0x1f4;return function(_0x45e077){logger[_0x49f9('0x26')](_0x45e077['stack']);if(_0x45e077['name']){delete _0x45e077[_0x49f9('0x27')];}_0x10da65[_0x49f9('0x19')](_0x28e56f)[_0x49f9('0x28')](_0x45e077);};}exports[_0x49f9('0x29')]=function(_0x51adc3,_0x2d1e7d){var _0x76e1c6={},_0x1deb22={},_0x5c8fc5={'count':0x0,'rows':[]};var _0xc0a9aa=_['map'](db[_0x49f9('0x2a')][_0x49f9('0x2b')],function(_0x39f66a){return{'name':_0x39f66a['fieldName'],'type':_0x39f66a[_0x49f9('0x2c')][_0x49f9('0x2d')]};});_0x1deb22[_0x49f9('0x2e')]=_[_0x49f9('0x2f')](_0xc0a9aa,_0x49f9('0x27'));_0x1deb22[_0x49f9('0x30')]=_[_0x49f9('0x31')](_0x51adc3[_0x49f9('0x30')]);_0x1deb22[_0x49f9('0x32')]=_[_0x49f9('0x33')](_0x1deb22[_0x49f9('0x2e')],_0x1deb22[_0x49f9('0x30')]);_0x76e1c6[_0x49f9('0x34')]=_[_0x49f9('0x33')](_0x1deb22[_0x49f9('0x2e')],qs[_0x49f9('0x35')](_0x51adc3[_0x49f9('0x30')]['fields']));_0x76e1c6[_0x49f9('0x34')]=_0x76e1c6[_0x49f9('0x34')][_0x49f9('0x36')]?_0x76e1c6[_0x49f9('0x34')]:_0x1deb22['model'];if(!_0x51adc3['query'][_0x49f9('0x37')]('nolimit')){_0x76e1c6[_0x49f9('0x1d')]=qs[_0x49f9('0x1d')](_0x51adc3[_0x49f9('0x30')][_0x49f9('0x1d')]);_0x76e1c6[_0x49f9('0x1c')]=qs[_0x49f9('0x1c')](_0x51adc3[_0x49f9('0x30')]['offset']);}_0x76e1c6[_0x49f9('0x38')]=qs[_0x49f9('0x39')](_0x51adc3['query']['sort']);_0x76e1c6['where']=qs[_0x49f9('0x32')](_['pick'](_0x51adc3['query'],_0x1deb22[_0x49f9('0x32')]),_0xc0a9aa);if(_0x51adc3[_0x49f9('0x30')][_0x49f9('0x3a')]){_0x76e1c6[_0x49f9('0x3b')]=_['merge'](_0x76e1c6[_0x49f9('0x3b')],{'$or':_['map'](_0xc0a9aa,function(_0x2e1277){if(_0x2e1277[_0x49f9('0x2c')]!==_0x49f9('0x3c')){var _0x33bac9={};_0x33bac9[_0x2e1277[_0x49f9('0x27')]]={'$like':'%'+_0x51adc3[_0x49f9('0x30')]['filter']+'%'};return _0x33bac9;}})});}_0x76e1c6=_['merge']({},_0x76e1c6,_0x51adc3[_0x49f9('0x3d')]);var _0x2fecb6={'where':_0x76e1c6[_0x49f9('0x3b')]};return db['AnalyticCustomReport'][_0x49f9('0x1b')](_0x2fecb6)[_0x49f9('0x24')](function(_0x4c656c){_0x5c8fc5['count']=_0x4c656c;if(_0x51adc3[_0x49f9('0x30')][_0x49f9('0x3e')]){_0x76e1c6[_0x49f9('0x3f')]=[{'all':!![]}];}return db[_0x49f9('0x2a')]['findAll'](_0x76e1c6);})[_0x49f9('0x24')](function(_0x4b760e){_0x5c8fc5[_0x49f9('0x40')]=_0x4b760e;return _0x5c8fc5;})[_0x49f9('0x24')](respondWithFilteredResult(_0x2d1e7d,_0x76e1c6))[_0x49f9('0x41')](handleError(_0x2d1e7d,null));};exports[_0x49f9('0x42')]=function(_0x2693be,_0x1bc0c9){var _0x11398a={'raw':![],'where':{'id':_0x2693be['params']['id']}},_0x338974={};_0x338974[_0x49f9('0x2e')]=_[_0x49f9('0x31')](db[_0x49f9('0x2a')][_0x49f9('0x2b')]);_0x338974[_0x49f9('0x30')]=_[_0x49f9('0x31')](_0x2693be[_0x49f9('0x30')]);_0x338974['filters']=_[_0x49f9('0x33')](_0x338974['model'],_0x338974[_0x49f9('0x30')]);_0x11398a[_0x49f9('0x34')]=_['intersection'](_0x338974[_0x49f9('0x2e')],qs[_0x49f9('0x35')](_0x2693be['query'][_0x49f9('0x35')]));_0x11398a[_0x49f9('0x34')]=_0x11398a['attributes'][_0x49f9('0x36')]?_0x11398a[_0x49f9('0x34')]:_0x338974[_0x49f9('0x2e')];if(_0x2693be[_0x49f9('0x30')][_0x49f9('0x3e')]){_0x11398a[_0x49f9('0x3f')]=[{'all':!![]}];}_0x11398a=_['merge']({},_0x11398a,_0x2693be[_0x49f9('0x3d')]);return db['AnalyticCustomReport'][_0x49f9('0x43')](_0x11398a)[_0x49f9('0x24')](handleEntityNotFound(_0x1bc0c9,null))['then'](respondWithResult(_0x1bc0c9,null))[_0x49f9('0x41')](handleError(_0x1bc0c9,null));};exports[_0x49f9('0x44')]=function(_0x9649c5,_0x10b535){return db[_0x49f9('0x2a')][_0x49f9('0x44')](_0x9649c5[_0x49f9('0x45')],{})[_0x49f9('0x24')](function(_0x6936a3){var _0x2e62dd=_0x9649c5[_0x49f9('0x46')]['get']({'plain':!![]});if(!_0x2e62dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e62dd[_0x49f9('0x47')]===_0x49f9('0x46')){var _0x1a0bfe=_0x6936a3[_0x49f9('0x21')]({'plain':!![]});var _0xacd19a=_0x49f9('0x48');return db[_0x49f9('0x49')]['find']({'where':{'name':_0xacd19a,'userProfileId':_0x2e62dd[_0x49f9('0x4a')]},'raw':!![]})[_0x49f9('0x24')](function(_0x58060){if(_0x58060&&_0x58060[_0x49f9('0x4b')]===0x0){return db[_0x49f9('0x23')]['create']({'name':_0x1a0bfe['name'],'resourceId':_0x1a0bfe['id'],'type':'CustomReports','sectionId':_0x58060['id']},{})[_0x49f9('0x24')](function(){return _0x6936a3;});}else{return _0x6936a3;}})[_0x49f9('0x41')](function(_0x186db7){logger[_0x49f9('0x26')](_0x49f9('0x4c'),_0x186db7);throw _0x186db7;});}return _0x6936a3;})[_0x49f9('0x24')](respondWithResult(_0x10b535,0xc9))['catch'](handleError(_0x10b535,null));};exports[_0x49f9('0x4d')]=function(_0x57acbb,_0x2fa14c){if(_0x57acbb['body']['id']){delete _0x57acbb['body']['id'];}return db[_0x49f9('0x2a')]['find']({'where':{'id':_0x57acbb[_0x49f9('0x4e')]['id']}})[_0x49f9('0x24')](handleEntityNotFound(_0x2fa14c,null))[_0x49f9('0x24')](saveUpdates(_0x57acbb[_0x49f9('0x45')],null))[_0x49f9('0x24')](respondWithResult(_0x2fa14c,null))[_0x49f9('0x41')](handleError(_0x2fa14c,null));};exports['destroy']=function(_0x5f649b,_0x2463ea){return db[_0x49f9('0x2a')][_0x49f9('0x43')]({'where':{'id':_0x5f649b[_0x49f9('0x4e')]['id']}})[_0x49f9('0x24')](handleEntityNotFound(_0x2463ea,null))[_0x49f9('0x24')](removeEntity(_0x2463ea,null))[_0x49f9('0x41')](handleError(_0x2463ea,null));};exports['preview']=function(_0x33d7d9,_0x594664){var _0x2ed3d2=0xa;var _0x249cfa=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0xbd2b8f={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x49f9('0x54'),'MIN':'MIN(%s)','AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':_0x49f9('0x58')};var _0x556287={'SEC_TO_TIME':_0x49f9('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x49f9('0x5a'),'UNIX_TIMESTAMP':_0x49f9('0x5b')};var _0x55b708=function(_0x104174){return!_[_0x49f9('0x5c')]([_0x49f9('0x5d'),_0x49f9('0x5e'),_0x49f9('0x5f'),_0x49f9('0x60')],_0x104174);};var _0x568a90=function(_0x55579b){if(!_0x55579b||!_0x55579b[_0x49f9('0x61')][_0x49f9('0x36')]){return'';}for(var _0x579800='(',_0x457c2f=0x0;_0x457c2f<_0x55579b[_0x49f9('0x61')][_0x49f9('0x36')];_0x457c2f+=0x1){_0x457c2f>0x0&&(_0x579800+='\x20'+_0x55579b[_0x49f9('0x62')]+'\x20');_0x579800+=_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x63')]?_0x568a90(_0x55579b['rules'][_0x457c2f][_0x49f9('0x63')]):_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x64')]+'\x20'+_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x65')]+(_0x55b708(_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x65')])?'\x20'+_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x66')]:'');}return _0x579800+')';};var _0x34098e={'where':{'id':_0x33d7d9[_0x49f9('0x4e')]['id']}},_0x253edf,_0x2bd3ec,_0x3f3f26,_0x149159,_0x18e165;_0x34098e=_[_0x49f9('0x67')]({},_0x34098e,_0x33d7d9['options']);return db[_0x49f9('0x2a')]['find'](_0x34098e)['then'](function(_0x187494){if(_0x187494){_0x253edf=_0x187494;return _0x187494[_0x49f9('0x68')]();}return null;})[_0x49f9('0x24')](function(_0x564eca){if(_0x564eca){if(!_0x564eca['length']){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x2bd3ec=_0x564eca;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x2316e2){if(_0x2316e2){_0x3f3f26=_[_0x49f9('0x6d')](_0x2316e2,'id');var _0x5bdcef;var _0x3ae840=squel['select']();_0x3ae840[_0x49f9('0x6e')](_0x253edf[_0x49f9('0x6f')]);for(var _0x412060=0x0;_0x412060<_0x2bd3ec[_0x49f9('0x36')];_0x412060+=0x1){_0x5bdcef=_0x2bd3ec[_0x412060][_0x49f9('0x70')]?_0x3f3f26[_0x2bd3ec[_0x412060]['MetricId']][_0x49f9('0x71')]:_0x2bd3ec[_0x412060][_0x49f9('0x64')];_0x5bdcef=_0x2bd3ec[_0x412060]['function']?_[_0x49f9('0x72')](_0xbd2b8f[_0x2bd3ec[_0x412060][_0x49f9('0x73')]],'%s',_0x5bdcef):_0x5bdcef;_0x5bdcef=_0x2bd3ec[_0x412060][_0x49f9('0x74')]?_[_0x49f9('0x72')](_0x556287[_0x2bd3ec[_0x412060]['format']],'%s',_0x5bdcef):_0x5bdcef;if(_0x2bd3ec[_0x412060][_0x49f9('0x75')]){_0x3ae840['group'](_0x5bdcef);}_0x2bd3ec[_0x412060][_0x49f9('0x76')]&&_0x3ae840[_0x49f9('0x38')](_0x5bdcef,_0x2bd3ec[_0x412060][_0x49f9('0x76')]===_0x49f9('0x77')?![]:!![]);_0x3ae840[_0x49f9('0x64')](_0x5bdcef,_0x2bd3ec[_0x412060][_0x49f9('0x78')]||_0x5bdcef);}if(_0x253edf[_0x49f9('0x79')]){_0x253edf[_0x49f9('0x79')]=JSON['parse'](_0x253edf[_0x49f9('0x79')]);for(var _0x33642f=0x0;_0x33642f<_0x253edf['joins'][_0x49f9('0x36')];_0x33642f+=0x1){if(_0x253edf['joins'][_0x33642f][_0x49f9('0x2c')]&&_[_0x49f9('0x5c')](_0x249cfa,_0x253edf['joins'][_0x33642f]['type'])&&_0x253edf['joins'][_0x33642f]['parentKey']&&_0x253edf[_0x49f9('0x79')][_0x33642f][_0x49f9('0x7a')]&&_0x253edf['joins'][_0x33642f][_0x49f9('0x7b')]){_0x3ae840[_0x253edf['joins'][_0x33642f]['type']](_0x253edf[_0x49f9('0x79')][_0x33642f]['foreignTable'],null,util[_0x49f9('0x74')](_0x49f9('0x7c'),_0x253edf['table'],_0x253edf['joins'][_0x33642f]['parentKey'],_0x253edf['joins'][_0x33642f]['foreignTable'],_0x253edf[_0x49f9('0x79')][_0x33642f][_0x49f9('0x7b')]));}}}if(_0x253edf['conditions']){_0x253edf[_0x49f9('0x7d')]=JSON['parse'](_0x253edf[_0x49f9('0x7d')]);_0x3ae840[_0x49f9('0x3b')](_0x568a90(_0x253edf[_0x49f9('0x7d')]['group']));}_0x18e165=_0x3ae840['clone']();_0x3ae840[_0x49f9('0x1d')](_0x2ed3d2);_0x3ae840['offset'](0x0);logger[_0x49f9('0x7e')](_0x49f9('0x7f'),_0x3ae840['toString']());return db['sequelize'][_0x49f9('0x30')](_0x3ae840['toString'](),{'type':db[_0x49f9('0x80')][_0x49f9('0x81')][_0x49f9('0x82')]});}})[_0x49f9('0x24')](respondWithResult(_0x594664,null))['catch'](handleError(_0x594664,null));};function runReport(_0x182bdc,_0x31c4a6,_0x6fc9c){var _0x2b7938=_0x31c4a6['name'];var _0x3f86cb=0xa;var _0x7410f1=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0x5143e1={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':_0x49f9('0x83'),'MAX':_0x49f9('0x54'),'MIN':_0x49f9('0x84'),'AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':_0x49f9('0x58')};var _0x590cf3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x49f9('0x85'),'ROUND':_0x49f9('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x205f43=function(_0x4e7a7e){return!_['includes']([_0x49f9('0x5d'),_0x49f9('0x5e'),_0x49f9('0x5f'),_0x49f9('0x60')],_0x4e7a7e);};var _0x3ae2b3=function(_0x323f41){if(!_0x323f41||!_0x323f41[_0x49f9('0x61')][_0x49f9('0x36')]){return'';}for(var _0x27a4c9='(',_0x17aa19=0x0;_0x17aa19<_0x323f41[_0x49f9('0x61')][_0x49f9('0x36')];_0x17aa19+=0x1){_0x17aa19>0x0&&(_0x27a4c9+='\x20'+_0x323f41[_0x49f9('0x62')]+'\x20');_0x27a4c9+=_0x323f41['rules'][_0x17aa19][_0x49f9('0x63')]?_0x3ae2b3(_0x323f41[_0x49f9('0x61')][_0x17aa19][_0x49f9('0x63')]):_0x323f41[_0x49f9('0x61')][_0x17aa19][_0x49f9('0x64')]+'\x20'+_0x323f41['rules'][_0x17aa19][_0x49f9('0x65')]+(_0x205f43(_0x323f41[_0x49f9('0x61')][_0x17aa19]['condition'])?'\x20'+_0x323f41['rules'][_0x17aa19]['value']:'');}return _0x27a4c9+')';};var _0xf037f0={'where':{'id':_0x182bdc['id']}},_0x7988b7,_0x471bd5,_0x396ee1,_0x486fac,_0xfc4a3e;_0xf037f0=_[_0x49f9('0x67')]({},_0xf037f0,_0x6fc9c);return db[_0x49f9('0x2a')]['find'](_0xf037f0)[_0x49f9('0x24')](function(_0x57b879){if(_0x57b879){_0x7988b7=_0x57b879;return _0x57b879[_0x49f9('0x68')]();}return null;})['then'](function(_0x4e5d45){if(_0x4e5d45){if(!_0x4e5d45[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x471bd5=_0x4e5d45;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x4db188){if(_0x4db188){_0x396ee1=_['keyBy'](_0x4db188,'id');var _0x4a66f8;var _0x4e732c=squel['select']();_0x4e732c[_0x49f9('0x6e')](_0x7988b7[_0x49f9('0x6f')]);for(var _0x3d045b=0x0;_0x3d045b<_0x471bd5[_0x49f9('0x36')];_0x3d045b+=0x1){_0x4a66f8=_0x471bd5[_0x3d045b][_0x49f9('0x70')]?_0x396ee1[_0x471bd5[_0x3d045b]['MetricId']][_0x49f9('0x71')]:_0x471bd5[_0x3d045b][_0x49f9('0x64')];_0x4a66f8=_0x471bd5[_0x3d045b][_0x49f9('0x73')]?_[_0x49f9('0x72')](_0x5143e1[_0x471bd5[_0x3d045b][_0x49f9('0x73')]],'%s',_0x4a66f8):_0x4a66f8;_0x4a66f8=_0x471bd5[_0x3d045b]['format']?_['replace'](_0x590cf3[_0x471bd5[_0x3d045b][_0x49f9('0x74')]],'%s',_0x4a66f8):_0x4a66f8;if(_0x471bd5[_0x3d045b]['groupBy']){_0x4e732c['group'](_0x4a66f8);}_0x471bd5[_0x3d045b][_0x49f9('0x76')]&&_0x4e732c[_0x49f9('0x38')](_0x4a66f8,_0x471bd5[_0x3d045b]['orderBy']==='DESC'?![]:!![]);_0x4e732c[_0x49f9('0x64')](_0x4a66f8,_0x471bd5[_0x3d045b][_0x49f9('0x78')]||_0x4a66f8);}if(_0x7988b7[_0x49f9('0x79')]){_0x7988b7[_0x49f9('0x79')]=JSON[_0x49f9('0x86')](_0x7988b7[_0x49f9('0x79')]);for(var _0x499280=0x0;_0x499280<_0x7988b7[_0x49f9('0x79')][_0x49f9('0x36')];_0x499280+=0x1){if(_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x2c')]&&_['includes'](_0x7410f1,_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x2c')])&&_0x7988b7['joins'][_0x499280][_0x49f9('0x87')]&&_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x7a')]&&_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x7b')]){_0x4e732c[_0x7988b7['joins'][_0x499280][_0x49f9('0x2c')]](_0x7988b7[_0x49f9('0x79')][_0x499280]['foreignTable'],null,util[_0x49f9('0x74')]('%s.%s\x20=\x20%s.%s',_0x7988b7['table'],_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x87')],_0x7988b7['joins'][_0x499280][_0x49f9('0x7a')],_0x7988b7['joins'][_0x499280][_0x49f9('0x7b')]));}}}if(_0x7988b7[_0x49f9('0x7d')]){_0x7988b7['conditions']=JSON[_0x49f9('0x86')](_0x7988b7[_0x49f9('0x7d')]);_0x4e732c[_0x49f9('0x3b')](_0x3ae2b3(_0x7988b7['conditions'][_0x49f9('0x63')]));}_0xfc4a3e=_0x4e732c[_0x49f9('0x88')]();_0x4e732c['limit'](_0x3f86cb);_0x4e732c['offset'](0x0);logger['debug'](_0x49f9('0x7f'),_0x4e732c['toString']());return db['sequelize'][_0x49f9('0x30')](_0x4e732c['toString'](),{'type':db[_0x49f9('0x80')]['QueryTypes']['SELECT']});}})[_0x49f9('0x24')](function(_0x2111d4){if(!_0x2111d4[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))]['ValidationErrorItem'](_0x49f9('0x89'),0xcc);}if(_0x31c4a6[_0x49f9('0x8a')]===_0x49f9('0x8b')){return null;}var _0xf7b0aa=_[_0x49f9('0x67')](_0x31c4a6,{'name':_0x31c4a6['fullPath']||_0x31c4a6[_0x49f9('0x27')]||_0x7988b7['name'],'basename':_0x2b7938,'savename':util[_0x49f9('0x74')]('%s-%s.%s',_0x31c4a6[_0x49f9('0x27')]||_0x7988b7['name'],require(_0x49f9('0x8c'))[_0x49f9('0x8d')](0x4),_0x31c4a6[_0x49f9('0x8a')]||'csv'),'reportId':_0x7988b7['id'],'reportType':_0x49f9('0x8e')});return db[_0x49f9('0x8f')][_0x49f9('0x44')](_0xf7b0aa,{'raw':!![]});})[_0x49f9('0x24')](function(_0x4a4ae4){if(_0x7988b7[_0x49f9('0x6f')]==='cdr'){_0xfc4a3e[_0x49f9('0x3b')](_0x7988b7['table']+_0x49f9('0x90'),_0x31c4a6[_0x49f9('0x91')],_0x31c4a6[_0x49f9('0x92')]);}else{_0xfc4a3e['where'](_0x7988b7[_0x49f9('0x6f')]+_0x49f9('0x93'),_0x31c4a6[_0x49f9('0x91')],_0x31c4a6[_0x49f9('0x92')]);}if(_0x4a4ae4){logger[_0x49f9('0x94')](_0x49f9('0x95'),_0xfc4a3e[_0x49f9('0x96')]());require('child_process')[_0x49f9('0x97')](path[_0x49f9('0x4f')](__dirname,_0x49f9('0x98'),_0x4a4ae4[_0x49f9('0x8a')]),[_0x4a4ae4['id'],_0xfc4a3e[_0x49f9('0x96')](),path['join'](__dirname,_0x49f9('0x99'),_0x4a4ae4[_0x49f9('0x9a')]),_0x2b7938]);return _0x4a4ae4;}else{var _0x1fe414=squel[_0x49f9('0x9b')]();_0x1fe414[_0x49f9('0x6e')]('('+_0xfc4a3e[_0x49f9('0x96')]()+')',_0x49f9('0x9c'));_0x1fe414[_0x49f9('0x64')]('COUNT(*)',_0x49f9('0x1b'));_0xfc4a3e['limit'](_0x31c4a6[_0x49f9('0x1d')]||_0x3f86cb);_0xfc4a3e[_0x49f9('0x1c')](_0x31c4a6[_0x49f9('0x1c')]||0x0);return dbH[_0x49f9('0x80')][_0x49f9('0x30')](_0x1fe414['toString'](),{'type':dbH[_0x49f9('0x80')]['QueryTypes']['SELECT']})[_0x49f9('0x24')](function(_0x17e21c){if(!_0x17e21c['length']){_0x486fac=0x0;}else{_0x486fac=_0x17e21c[0x0]['count']||0x0;}return dbH[_0x49f9('0x80')][_0x49f9('0x30')](_0xfc4a3e[_0x49f9('0x96')](),{'type':dbH['sequelize'][_0x49f9('0x81')][_0x49f9('0x82')]});})[_0x49f9('0x24')](function(_0x210969){return{'rows':_0x210969||[],'count':_0x486fac};});}});}exports[_0x49f9('0x9d')]=function(_0x4d23da,_0x5a712d){return runReport(_0x4d23da[_0x49f9('0x4e')],_0x4d23da[_0x49f9('0x30')],_0x4d23da['options'])[_0x49f9('0x24')](respondWithResult(_0x5a712d,null))[_0x49f9('0x41')](handleError(_0x5a712d,null));};exports[_0x49f9('0x9e')]=runReport;exports[_0x49f9('0x30')]=function(_0x497805,_0xc1b686){var _0x2923df=0xa;var _0x259a20=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0x286b90={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':_0x49f9('0x83'),'MAX':'MAX(%s)','MIN':_0x49f9('0x84'),'AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x58bf69={'SEC_TO_TIME':_0x49f9('0x59'),'DATE':'DATE(%s)','HOUR':_0x49f9('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x49f9('0x5b')};var _0x4031f4=function(_0xf198e5){return!_[_0x49f9('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x49f9('0x5f'),'IS\x20NOT\x20EMPTY'],_0xf198e5);};var _0x56a244=function(_0x32264f){if(!_0x32264f||!_0x32264f['rules'][_0x49f9('0x36')]){return'';}for(var _0x21ca71='(',_0x14de03=0x0;_0x14de03<_0x32264f[_0x49f9('0x61')][_0x49f9('0x36')];_0x14de03+=0x1){_0x14de03>0x0&&(_0x21ca71+='\x20'+_0x32264f[_0x49f9('0x62')]+'\x20');_0x21ca71+=_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x63')]?_0x56a244(_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x63')]):_0x32264f[_0x49f9('0x61')][_0x14de03]['field']+'\x20'+_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x65')]+(_0x4031f4(_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x65')])?'\x20'+_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x66')]:'');}return _0x21ca71+')';};var _0x5b7030={'where':{'id':_0x497805[_0x49f9('0x4e')]['id']}},_0x1da9a7,_0x1a0c41,_0x3f3419,_0x2cefe1,_0x3b051c;_0x5b7030=_['merge']({},_0x5b7030,_0x497805[_0x49f9('0x3d')]);return db[_0x49f9('0x2a')][_0x49f9('0x43')](_0x5b7030)[_0x49f9('0x24')](function(_0x575947){if(_0x575947){_0x1da9a7=_0x575947;return _0x575947[_0x49f9('0x68')]();}return null;})['then'](function(_0x37efa9){if(_0x37efa9){if(!_0x37efa9[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x1a0c41=_0x37efa9;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x32e9c6){if(_0x32e9c6){_0x3f3419=_[_0x49f9('0x6d')](_0x32e9c6,'id');var _0x1a92bc;var _0x51494a=squel[_0x49f9('0x9b')]();_0x51494a[_0x49f9('0x6e')](_0x1da9a7[_0x49f9('0x6f')]);for(var _0x18b947=0x0;_0x18b947<_0x1a0c41['length'];_0x18b947+=0x1){_0x1a92bc=_0x1a0c41[_0x18b947]['MetricId']?_0x3f3419[_0x1a0c41[_0x18b947][_0x49f9('0x70')]][_0x49f9('0x71')]:_0x1a0c41[_0x18b947][_0x49f9('0x64')];_0x1a92bc=_0x1a0c41[_0x18b947][_0x49f9('0x73')]?_['replace'](_0x286b90[_0x1a0c41[_0x18b947][_0x49f9('0x73')]],'%s',_0x1a92bc):_0x1a92bc;_0x1a92bc=_0x1a0c41[_0x18b947]['format']?_[_0x49f9('0x72')](_0x58bf69[_0x1a0c41[_0x18b947][_0x49f9('0x74')]],'%s',_0x1a92bc):_0x1a92bc;if(_0x1a0c41[_0x18b947][_0x49f9('0x75')]){_0x51494a[_0x49f9('0x63')](_0x1a92bc);}_0x1a0c41[_0x18b947][_0x49f9('0x76')]&&_0x51494a['order'](_0x1a92bc,_0x1a0c41[_0x18b947][_0x49f9('0x76')]===_0x49f9('0x77')?![]:!![]);_0x51494a[_0x49f9('0x64')](_0x1a92bc,_0x1a0c41[_0x18b947][_0x49f9('0x78')]||_0x1a92bc);}if(_0x1da9a7['joins']){_0x1da9a7[_0x49f9('0x79')]=JSON['parse'](_0x1da9a7['joins']);for(var _0x2af1f5=0x0;_0x2af1f5<_0x1da9a7[_0x49f9('0x79')][_0x49f9('0x36')];_0x2af1f5+=0x1){if(_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x2c')]&&_['includes'](_0x259a20,_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x2c')])&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x87')]&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')]&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7b')]){_0x51494a[_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x2c')]](_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')],null,util[_0x49f9('0x74')](_0x49f9('0x7c'),_0x1da9a7['table'],_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x87')],_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')],_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x7b')]));}}}if(_0x1da9a7[_0x49f9('0x7d')]){_0x1da9a7[_0x49f9('0x7d')]=JSON['parse'](_0x1da9a7[_0x49f9('0x7d')]);_0x51494a['where'](_0x56a244(_0x1da9a7[_0x49f9('0x7d')]['group']));}_0x3b051c=_0x51494a[_0x49f9('0x88')]();_0x51494a[_0x49f9('0x1d')](_0x2923df);_0x51494a[_0x49f9('0x1c')](0x0);logger[_0x49f9('0x7e')](_0x49f9('0x7f'),_0x51494a[_0x49f9('0x96')]());return db[_0x49f9('0x80')]['query'](_0x51494a[_0x49f9('0x96')](),{'type':db['sequelize'][_0x49f9('0x81')][_0x49f9('0x82')]});}})['then'](function(){return{'sql':_0x3b051c[_0x49f9('0x96')]()};})['then'](respondWithResult(_0xc1b686,null))['catch'](handleError(_0xc1b686,null));}; \ No newline at end of file +var _0x4849=['offset','limit','set','Content-Range','reject','update','then','CustomReports','UserProfileResource','destroy','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','create','body','get','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','metric','replace','function','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','MetricId','groupBy','%s.%s\x20=\x20%s.%s','QueryTypes','web','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','output','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','../../mysqldb','dbH','sendStatus','status','end','json','count'];(function(_0x3a2289,_0x589163){var _0x4d6e92=function(_0x1f89fe){while(--_0x1f89fe){_0x3a2289['push'](_0x3a2289['shift']());}};_0x4d6e92(++_0x589163);}(_0x4849,0x86));var _0x9484=function(_0x4116c4,_0x4f488b){_0x4116c4=_0x4116c4-0x0;var _0x2c864c=_0x4849[_0x4116c4];return _0x2c864c;};'use strict';var pdf=require(_0x9484('0x0'));var emlformat=require(_0x9484('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9484('0x2'));var jsonpatch=require(_0x9484('0x3'));var rp=require(_0x9484('0x4'));var moment=require(_0x9484('0x5'));var BPromise=require(_0x9484('0x6'));var Mustache=require(_0x9484('0x7'));var util=require(_0x9484('0x8'));var path=require('path');var sox=require(_0x9484('0x9'));var csv=require(_0x9484('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9484('0xb'));var squel=require(_0x9484('0xc'));var crypto=require(_0x9484('0xd'));var jsforce=require(_0x9484('0xe'));var deskjs=require(_0x9484('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9484('0x10'));var Papa=require(_0x9484('0x11'));var Redis=require(_0x9484('0x12'));var authService=require(_0x9484('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9484('0x14'));var hardwareService=require(_0x9484('0x15'));var logger=require(_0x9484('0x16'))(_0x9484('0x17'));var utils=require(_0x9484('0x18'));var config=require(_0x9484('0x19'));var db=require(_0x9484('0x1a'))['db'];var dbH=require('../../mysqldb')[_0x9484('0x1b')];function respondWithStatusCode(_0x3deb1e,_0x5e3f76){_0x5e3f76=_0x5e3f76||0xcc;return function(_0x5ed6a9){if(_0x5ed6a9){return _0x3deb1e[_0x9484('0x1c')](_0x5e3f76);}return _0x3deb1e[_0x9484('0x1d')](_0x5e3f76)[_0x9484('0x1e')]();};}function respondWithResult(_0x4200c1,_0x81eb94){_0x81eb94=_0x81eb94||0xc8;return function(_0x39699c){if(_0x39699c){return _0x4200c1[_0x9484('0x1d')](_0x81eb94)[_0x9484('0x1f')](_0x39699c);}};}function respondWithFilteredResult(_0x207007,_0x37cf72){return function(_0x4bb57e){if(_0x4bb57e){var _0x96d182=_0x4bb57e[_0x9484('0x20')],_0x44b13e=_0x37cf72[_0x9484('0x21')],_0x58dab8=_0x37cf72[_0x9484('0x21')]+_0x37cf72[_0x9484('0x22')],_0x44ee26;if(_0x58dab8>=_0x96d182){_0x58dab8=_0x96d182;_0x44ee26=0xc8;}else{_0x44ee26=0xce;}_0x207007['status'](_0x44ee26);return _0x207007[_0x9484('0x23')](_0x9484('0x24'),_0x44b13e+'-'+_0x58dab8+'/'+_0x96d182)[_0x9484('0x1f')](_0x4bb57e);}return null;};}function patchUpdates(_0x45f183){return function(_0x431751){try{jsonpatch['apply'](_0x431751,_0x45f183,!![]);}catch(_0x230097){return BPromise[_0x9484('0x25')](_0x230097);}return _0x431751['save']();};}function saveUpdates(_0x42fe66,_0x5f0937){return function(_0x1558e4){if(_0x1558e4){return _0x1558e4[_0x9484('0x26')](_0x42fe66)[_0x9484('0x27')](function(_0xa04f20){return _0xa04f20;});}return null;};}function removeEntity(_0x890846,_0x39240b){return function(_0x43939e){if(_0x43939e){return _0x43939e['destroy']()['then'](function(){var _0x4bfc05=_0x43939e['get']({'plain':!![]});var _0x45c2c4=_0x9484('0x28');return db[_0x9484('0x29')][_0x9484('0x2a')]({'where':{'type':_0x45c2c4,'resourceId':_0x4bfc05['id']}})[_0x9484('0x27')](function(){return _0x43939e;});})[_0x9484('0x27')](function(){_0x890846['status'](0xcc)[_0x9484('0x1e')]();});}};}function handleEntityNotFound(_0x53ffc3,_0x58dc7b){return function(_0x4b7eb9){if(!_0x4b7eb9){_0x53ffc3[_0x9484('0x1c')](0x194);}return _0x4b7eb9;};}function handleError(_0x37552c,_0x425760){_0x425760=_0x425760||0x1f4;return function(_0x11a90c){logger['error'](_0x11a90c[_0x9484('0x2b')]);if(_0x11a90c[_0x9484('0x2c')]){delete _0x11a90c[_0x9484('0x2c')];}_0x37552c['status'](_0x425760)['send'](_0x11a90c);};}exports['index']=function(_0x1cd898,_0x11e9b0){var _0x10a8d7={},_0x4da693={},_0x1650e5={'count':0x0,'rows':[]};var _0x30cfd5=_[_0x9484('0x2d')](db[_0x9484('0x2e')][_0x9484('0x2f')],function(_0xb10926){return{'name':_0xb10926[_0x9484('0x30')],'type':_0xb10926[_0x9484('0x31')][_0x9484('0x32')]};});_0x4da693[_0x9484('0x33')]=_['map'](_0x30cfd5,_0x9484('0x2c'));_0x4da693[_0x9484('0x34')]=_[_0x9484('0x35')](_0x1cd898[_0x9484('0x34')]);_0x4da693[_0x9484('0x36')]=_[_0x9484('0x37')](_0x4da693[_0x9484('0x33')],_0x4da693[_0x9484('0x34')]);_0x10a8d7[_0x9484('0x38')]=_[_0x9484('0x37')](_0x4da693[_0x9484('0x33')],qs[_0x9484('0x39')](_0x1cd898[_0x9484('0x34')]['fields']));_0x10a8d7[_0x9484('0x38')]=_0x10a8d7[_0x9484('0x38')][_0x9484('0x3a')]?_0x10a8d7[_0x9484('0x38')]:_0x4da693[_0x9484('0x33')];if(!_0x1cd898[_0x9484('0x34')][_0x9484('0x3b')](_0x9484('0x3c'))){_0x10a8d7['limit']=qs[_0x9484('0x22')](_0x1cd898[_0x9484('0x34')][_0x9484('0x22')]);_0x10a8d7[_0x9484('0x21')]=qs[_0x9484('0x21')](_0x1cd898['query'][_0x9484('0x21')]);}_0x10a8d7[_0x9484('0x3d')]=qs[_0x9484('0x3e')](_0x1cd898[_0x9484('0x34')][_0x9484('0x3e')]);_0x10a8d7[_0x9484('0x3f')]=qs[_0x9484('0x36')](_['pick'](_0x1cd898['query'],_0x4da693[_0x9484('0x36')]),_0x30cfd5);if(_0x1cd898[_0x9484('0x34')][_0x9484('0x40')]){_0x10a8d7[_0x9484('0x3f')]=_[_0x9484('0x41')](_0x10a8d7['where'],{'$or':_['map'](_0x30cfd5,function(_0xcee4c){if(_0xcee4c['type']!==_0x9484('0x42')){var _0x4806fc={};_0x4806fc[_0xcee4c[_0x9484('0x2c')]]={'$like':'%'+_0x1cd898[_0x9484('0x34')]['filter']+'%'};return _0x4806fc;}})});}_0x10a8d7=_['merge']({},_0x10a8d7,_0x1cd898[_0x9484('0x43')]);var _0x905ce0={'where':_0x10a8d7[_0x9484('0x3f')]};return db[_0x9484('0x2e')][_0x9484('0x20')](_0x905ce0)['then'](function(_0x25d30e){_0x1650e5[_0x9484('0x20')]=_0x25d30e;if(_0x1cd898[_0x9484('0x34')][_0x9484('0x44')]){_0x10a8d7[_0x9484('0x45')]=[{'all':!![]}];}return db[_0x9484('0x2e')]['findAll'](_0x10a8d7);})[_0x9484('0x27')](function(_0x224441){_0x1650e5['rows']=_0x224441;return _0x1650e5;})[_0x9484('0x27')](respondWithFilteredResult(_0x11e9b0,_0x10a8d7))['catch'](handleError(_0x11e9b0,null));};exports['show']=function(_0xa22a,_0x4fd8eb){var _0x254d7e={'raw':![],'where':{'id':_0xa22a[_0x9484('0x46')]['id']}},_0x3baa5c={};_0x3baa5c['model']=_['keys'](db[_0x9484('0x2e')][_0x9484('0x2f')]);_0x3baa5c[_0x9484('0x34')]=_[_0x9484('0x35')](_0xa22a[_0x9484('0x34')]);_0x3baa5c[_0x9484('0x36')]=_[_0x9484('0x37')](_0x3baa5c['model'],_0x3baa5c[_0x9484('0x34')]);_0x254d7e['attributes']=_[_0x9484('0x37')](_0x3baa5c[_0x9484('0x33')],qs[_0x9484('0x39')](_0xa22a[_0x9484('0x34')][_0x9484('0x39')]));_0x254d7e[_0x9484('0x38')]=_0x254d7e[_0x9484('0x38')]['length']?_0x254d7e[_0x9484('0x38')]:_0x3baa5c['model'];if(_0xa22a['query'][_0x9484('0x44')]){_0x254d7e[_0x9484('0x45')]=[{'all':!![]}];}_0x254d7e=_['merge']({},_0x254d7e,_0xa22a[_0x9484('0x43')]);return db[_0x9484('0x2e')][_0x9484('0x47')](_0x254d7e)[_0x9484('0x27')](handleEntityNotFound(_0x4fd8eb,null))['then'](respondWithResult(_0x4fd8eb,null))[_0x9484('0x48')](handleError(_0x4fd8eb,null));};exports[_0x9484('0x49')]=function(_0x391903,_0x6c72d9){return db['AnalyticCustomReport'][_0x9484('0x49')](_0x391903[_0x9484('0x4a')],{})[_0x9484('0x27')](function(_0x390faf){var _0x255c6e=_0x391903['user'][_0x9484('0x4b')]({'plain':!![]});if(!_0x255c6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x255c6e[_0x9484('0x4c')]===_0x9484('0x4d')){var _0x599b0e=_0x390faf[_0x9484('0x4b')]({'plain':!![]});var _0x3b22ff=_0x9484('0x4e');return db[_0x9484('0x4f')]['find']({'where':{'name':_0x3b22ff,'userProfileId':_0x255c6e[_0x9484('0x50')]},'raw':!![]})[_0x9484('0x27')](function(_0x50c607){if(_0x50c607&&_0x50c607[_0x9484('0x51')]===0x0){return db['UserProfileResource'][_0x9484('0x49')]({'name':_0x599b0e[_0x9484('0x2c')],'resourceId':_0x599b0e['id'],'type':_0x9484('0x28'),'sectionId':_0x50c607['id']},{})[_0x9484('0x27')](function(){return _0x390faf;});}else{return _0x390faf;}})[_0x9484('0x48')](function(_0x433249){logger['error'](_0x9484('0x52'),_0x433249);throw _0x433249;});}return _0x390faf;})[_0x9484('0x27')](respondWithResult(_0x6c72d9,0xc9))['catch'](handleError(_0x6c72d9,null));};exports[_0x9484('0x26')]=function(_0x114ea6,_0x3124f8){if(_0x114ea6[_0x9484('0x4a')]['id']){delete _0x114ea6[_0x9484('0x4a')]['id'];}return db['AnalyticCustomReport'][_0x9484('0x47')]({'where':{'id':_0x114ea6['params']['id']}})[_0x9484('0x27')](handleEntityNotFound(_0x3124f8,null))[_0x9484('0x27')](saveUpdates(_0x114ea6['body'],null))[_0x9484('0x27')](respondWithResult(_0x3124f8,null))[_0x9484('0x48')](handleError(_0x3124f8,null));};exports[_0x9484('0x2a')]=function(_0x395aaa,_0xaa62e4){return db[_0x9484('0x2e')][_0x9484('0x47')]({'where':{'id':_0x395aaa[_0x9484('0x46')]['id']}})['then'](handleEntityNotFound(_0xaa62e4,null))[_0x9484('0x27')](removeEntity(_0xaa62e4,null))['catch'](handleError(_0xaa62e4,null));};exports[_0x9484('0x53')]=function(_0x4162f1,_0x880736){var _0x153637=0xa;var _0x1046a5=[_0x9484('0x54'),_0x9484('0x55'),_0x9484('0x56'),_0x9484('0x57')];var _0x43a401={'SUM':_0x9484('0x58'),'COUNT':_0x9484('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9484('0x5a'),'MIN':_0x9484('0x5b'),'AVG':_0x9484('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9484('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x28525f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9484('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9484('0x5f')};var _0x54e78d=function(_0x124db1){return!_[_0x9484('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x9484('0x61')],_0x124db1);};var _0x181779=function(_0x3aae2c){if(!_0x3aae2c||!_0x3aae2c[_0x9484('0x62')][_0x9484('0x3a')]){return'';}for(var _0x10facc='(',_0x5b7dc3=0x0;_0x5b7dc3<_0x3aae2c[_0x9484('0x62')]['length'];_0x5b7dc3+=0x1){_0x5b7dc3>0x0&&(_0x10facc+='\x20'+_0x3aae2c[_0x9484('0x63')]+'\x20');_0x10facc+=_0x3aae2c['rules'][_0x5b7dc3]['group']?_0x181779(_0x3aae2c['rules'][_0x5b7dc3][_0x9484('0x64')]):_0x3aae2c[_0x9484('0x62')][_0x5b7dc3][_0x9484('0x65')]+'\x20'+_0x3aae2c[_0x9484('0x62')][_0x5b7dc3]['condition']+(_0x54e78d(_0x3aae2c[_0x9484('0x62')][_0x5b7dc3][_0x9484('0x66')])?'\x20'+_0x3aae2c[_0x9484('0x62')][_0x5b7dc3][_0x9484('0x67')]:'');}return _0x10facc+')';};var _0x474a90={'where':{'id':_0x4162f1[_0x9484('0x46')]['id']}},_0x5edcfb,_0x1e990d,_0x3fe362,_0x57590e,_0x406522;_0x474a90=_[_0x9484('0x41')]({},_0x474a90,_0x4162f1['options']);return db[_0x9484('0x2e')][_0x9484('0x47')](_0x474a90)['then'](function(_0x48f752){if(_0x48f752){_0x5edcfb=_0x48f752;return _0x48f752[_0x9484('0x68')]();}return null;})[_0x9484('0x27')](function(_0x19a20a){if(_0x19a20a){if(!_0x19a20a['length']){throw new db[(_0x9484('0x69'))][(_0x9484('0x6a'))](_0x9484('0x6b'),0x193);}_0x1e990d=_0x19a20a;return db[_0x9484('0x6c')][_0x9484('0x6d')]({'raw':!![]});}return null;})['then'](function(_0x573ecb){if(_0x573ecb){_0x3fe362=_[_0x9484('0x6e')](_0x573ecb,'id');var _0x16dfc4;var _0x177322=squel[_0x9484('0x6f')]();_0x177322[_0x9484('0x70')](_0x5edcfb[_0x9484('0x71')]);for(var _0x30a364=0x0;_0x30a364<_0x1e990d[_0x9484('0x3a')];_0x30a364+=0x1){_0x16dfc4=_0x1e990d[_0x30a364]['MetricId']?_0x3fe362[_0x1e990d[_0x30a364]['MetricId']][_0x9484('0x72')]:_0x1e990d[_0x30a364]['field'];_0x16dfc4=_0x1e990d[_0x30a364]['function']?_[_0x9484('0x73')](_0x43a401[_0x1e990d[_0x30a364][_0x9484('0x74')]],'%s',_0x16dfc4):_0x16dfc4;_0x16dfc4=_0x1e990d[_0x30a364][_0x9484('0x75')]?_['replace'](_0x28525f[_0x1e990d[_0x30a364]['format']],'%s',_0x16dfc4):_0x16dfc4;if(_0x1e990d[_0x30a364]['groupBy']){_0x177322[_0x9484('0x64')](_0x16dfc4);}_0x1e990d[_0x30a364][_0x9484('0x76')]&&_0x177322[_0x9484('0x3d')](_0x16dfc4,_0x1e990d[_0x30a364][_0x9484('0x76')]===_0x9484('0x77')?![]:!![]);_0x177322['field'](_0x16dfc4,_0x1e990d[_0x30a364][_0x9484('0x78')]||_0x16dfc4);}if(_0x5edcfb[_0x9484('0x79')]){_0x5edcfb['joins']=JSON['parse'](_0x5edcfb['joins']);for(var _0x34d62a=0x0;_0x34d62a<_0x5edcfb[_0x9484('0x79')]['length'];_0x34d62a+=0x1){if(_0x5edcfb['joins'][_0x34d62a][_0x9484('0x31')]&&_[_0x9484('0x60')](_0x1046a5,_0x5edcfb[_0x9484('0x79')][_0x34d62a]['type'])&&_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x7a')]&&_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x7b')]&&_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x7c')]){_0x177322[_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x31')]](_0x5edcfb['joins'][_0x34d62a][_0x9484('0x7b')],null,util[_0x9484('0x75')]('%s.%s\x20=\x20%s.%s',_0x5edcfb['table'],_0x5edcfb['joins'][_0x34d62a]['parentKey'],_0x5edcfb['joins'][_0x34d62a]['foreignTable'],_0x5edcfb[_0x9484('0x79')][_0x34d62a][_0x9484('0x7c')]));}}}if(_0x5edcfb[_0x9484('0x7d')]){_0x5edcfb[_0x9484('0x7d')]=JSON[_0x9484('0x7e')](_0x5edcfb[_0x9484('0x7d')]);_0x177322[_0x9484('0x3f')](_0x181779(_0x5edcfb['conditions'][_0x9484('0x64')]));}_0x406522=_0x177322[_0x9484('0x7f')]();_0x177322[_0x9484('0x22')](_0x153637);_0x177322[_0x9484('0x21')](0x0);logger[_0x9484('0x80')](_0x9484('0x81'),_0x177322[_0x9484('0x82')]());return db[_0x9484('0x83')][_0x9484('0x34')](_0x177322[_0x9484('0x82')](),{'type':db[_0x9484('0x83')]['QueryTypes'][_0x9484('0x84')]});}})[_0x9484('0x27')](respondWithResult(_0x880736,null))[_0x9484('0x48')](handleError(_0x880736,null));};function runReport(_0x2d983e,_0x327ee2,_0x172320){var _0x525fe4=_0x327ee2[_0x9484('0x2c')];var _0x555874=0xa;var _0x25f9b2=[_0x9484('0x54'),_0x9484('0x55'),_0x9484('0x56'),_0x9484('0x57')];var _0xac9cf2={'SUM':_0x9484('0x58'),'COUNT':_0x9484('0x59'),'COUNT DISTINCT':_0x9484('0x85'),'MAX':_0x9484('0x5a'),'MIN':'MIN(%s)','AVG':_0x9484('0x5c'),'GROUP_CONCAT':_0x9484('0x86'),'GROUP_CONCAT ASC':_0x9484('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1a7e09={'SEC_TO_TIME':_0x9484('0x87'),'DATE':'DATE(%s)','HOUR':_0x9484('0x88'),'ROUND':_0x9484('0x89'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x348a49=function(_0x3184ad){return!_[_0x9484('0x60')]([_0x9484('0x8a'),_0x9484('0x8b'),'IS\x20EMPTY',_0x9484('0x61')],_0x3184ad);};var _0x58a232=function(_0x38ddcc){if(!_0x38ddcc||!_0x38ddcc[_0x9484('0x62')][_0x9484('0x3a')]){return'';}for(var _0x17fb60='(',_0x4d6382=0x0;_0x4d6382<_0x38ddcc[_0x9484('0x62')][_0x9484('0x3a')];_0x4d6382+=0x1){_0x4d6382>0x0&&(_0x17fb60+='\x20'+_0x38ddcc['operator']+'\x20');_0x17fb60+=_0x38ddcc['rules'][_0x4d6382][_0x9484('0x64')]?_0x58a232(_0x38ddcc['rules'][_0x4d6382][_0x9484('0x64')]):_0x38ddcc[_0x9484('0x62')][_0x4d6382][_0x9484('0x65')]+'\x20'+_0x38ddcc[_0x9484('0x62')][_0x4d6382][_0x9484('0x66')]+(_0x348a49(_0x38ddcc[_0x9484('0x62')][_0x4d6382][_0x9484('0x66')])?'\x20'+_0x38ddcc[_0x9484('0x62')][_0x4d6382][_0x9484('0x67')]:'');}return _0x17fb60+')';};var _0x5bd6c3={'where':{'id':_0x2d983e['id']}},_0x3bf3a9,_0x57d0c7,_0x3ba6d3,_0x19e74f,_0x13451c;_0x5bd6c3=_[_0x9484('0x41')]({},_0x5bd6c3,_0x172320);return db[_0x9484('0x2e')]['find'](_0x5bd6c3)['then'](function(_0x16b440){if(_0x16b440){_0x3bf3a9=_0x16b440;return _0x16b440[_0x9484('0x68')]();}return null;})[_0x9484('0x27')](function(_0xf4baaa){if(_0xf4baaa){if(!_0xf4baaa[_0x9484('0x3a')]){throw new db[(_0x9484('0x69'))][(_0x9484('0x6a'))](_0x9484('0x6b'),0x193);}_0x57d0c7=_0xf4baaa;return db[_0x9484('0x6c')][_0x9484('0x6d')]({'raw':!![]});}return null;})['then'](function(_0x9642be){if(_0x9642be){_0x3ba6d3=_['keyBy'](_0x9642be,'id');var _0x18bbdf;var _0x4a3d96=squel[_0x9484('0x6f')]();_0x4a3d96[_0x9484('0x70')](_0x3bf3a9[_0x9484('0x71')]);for(var _0x2a9273=0x0;_0x2a9273<_0x57d0c7[_0x9484('0x3a')];_0x2a9273+=0x1){_0x18bbdf=_0x57d0c7[_0x2a9273][_0x9484('0x8c')]?_0x3ba6d3[_0x57d0c7[_0x2a9273]['MetricId']][_0x9484('0x72')]:_0x57d0c7[_0x2a9273][_0x9484('0x65')];_0x18bbdf=_0x57d0c7[_0x2a9273][_0x9484('0x74')]?_['replace'](_0xac9cf2[_0x57d0c7[_0x2a9273][_0x9484('0x74')]],'%s',_0x18bbdf):_0x18bbdf;_0x18bbdf=_0x57d0c7[_0x2a9273]['format']?_[_0x9484('0x73')](_0x1a7e09[_0x57d0c7[_0x2a9273][_0x9484('0x75')]],'%s',_0x18bbdf):_0x18bbdf;if(_0x57d0c7[_0x2a9273][_0x9484('0x8d')]){_0x4a3d96[_0x9484('0x64')](_0x18bbdf);}_0x57d0c7[_0x2a9273][_0x9484('0x76')]&&_0x4a3d96['order'](_0x18bbdf,_0x57d0c7[_0x2a9273][_0x9484('0x76')]==='DESC'?![]:!![]);_0x4a3d96['field'](_0x18bbdf,_0x57d0c7[_0x2a9273][_0x9484('0x78')]||_0x18bbdf);}if(_0x3bf3a9['joins']){_0x3bf3a9['joins']=JSON[_0x9484('0x7e')](_0x3bf3a9['joins']);for(var _0x157f2a=0x0;_0x157f2a<_0x3bf3a9[_0x9484('0x79')][_0x9484('0x3a')];_0x157f2a+=0x1){if(_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x31')]&&_[_0x9484('0x60')](_0x25f9b2,_0x3bf3a9[_0x9484('0x79')][_0x157f2a]['type'])&&_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x7a')]&&_0x3bf3a9['joins'][_0x157f2a][_0x9484('0x7b')]&&_0x3bf3a9[_0x9484('0x79')][_0x157f2a]['foreignKey']){_0x4a3d96[_0x3bf3a9['joins'][_0x157f2a][_0x9484('0x31')]](_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x7b')],null,util[_0x9484('0x75')](_0x9484('0x8e'),_0x3bf3a9[_0x9484('0x71')],_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x7a')],_0x3bf3a9[_0x9484('0x79')][_0x157f2a][_0x9484('0x7b')],_0x3bf3a9[_0x9484('0x79')][_0x157f2a]['foreignKey']));}}}if(_0x3bf3a9[_0x9484('0x7d')]){_0x3bf3a9[_0x9484('0x7d')]=JSON[_0x9484('0x7e')](_0x3bf3a9[_0x9484('0x7d')]);_0x4a3d96[_0x9484('0x3f')](_0x58a232(_0x3bf3a9[_0x9484('0x7d')][_0x9484('0x64')]));}_0x13451c=_0x4a3d96[_0x9484('0x7f')]();_0x4a3d96[_0x9484('0x22')](_0x555874);_0x4a3d96[_0x9484('0x21')](0x0);logger[_0x9484('0x80')](_0x9484('0x81'),_0x4a3d96['toString']());return db['sequelize'][_0x9484('0x34')](_0x4a3d96[_0x9484('0x82')](),{'type':db['sequelize'][_0x9484('0x8f')][_0x9484('0x84')]});}})[_0x9484('0x27')](function(_0x4db460){if(!_0x4db460[_0x9484('0x3a')]){throw new db[(_0x9484('0x69'))][(_0x9484('0x6a'))]('No\x20available\x20data',0xcc);}if(_0x327ee2['output']===_0x9484('0x90')){return null;}var _0x218030=_['merge'](_0x327ee2,{'name':_0x327ee2['fullPath']||_0x327ee2[_0x9484('0x2c')]||_0x3bf3a9['name'],'basename':_0x525fe4,'savename':util[_0x9484('0x75')](_0x9484('0x91'),_0x327ee2[_0x9484('0x2c')]||_0x3bf3a9[_0x9484('0x2c')],require('randomstring')[_0x9484('0x92')](0x4),_0x327ee2['output']||_0x9484('0x93')),'reportId':_0x3bf3a9['id'],'reportType':_0x9484('0x94')});return db[_0x9484('0x95')]['create'](_0x218030,{'raw':!![]});})[_0x9484('0x27')](function(_0x2171e7){if(_0x3bf3a9['table']===_0x9484('0x96')){_0x13451c[_0x9484('0x3f')](_0x3bf3a9[_0x9484('0x71')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x327ee2['startDate'],_0x327ee2['endDate']);}else{_0x13451c[_0x9484('0x3f')](_0x3bf3a9['table']+_0x9484('0x97'),_0x327ee2[_0x9484('0x98')],_0x327ee2[_0x9484('0x99')]);}if(_0x2171e7){logger[_0x9484('0x9a')]('Run\x20Query:',_0x13451c[_0x9484('0x82')]());require(_0x9484('0x9b'))[_0x9484('0x9c')](path['join'](__dirname,_0x9484('0x9d'),_0x2171e7[_0x9484('0x9e')]),[_0x2171e7['id'],_0x13451c[_0x9484('0x82')](),path[_0x9484('0x54')](__dirname,_0x9484('0x9f'),_0x2171e7[_0x9484('0xa0')]),_0x525fe4]);return _0x2171e7;}else{var _0x4a352c=squel['select']();_0x4a352c[_0x9484('0x70')]('('+_0x13451c[_0x9484('0x82')]()+')',_0x9484('0xa1'));_0x4a352c[_0x9484('0x65')](_0x9484('0xa2'),_0x9484('0x20'));_0x13451c[_0x9484('0x22')](_0x327ee2[_0x9484('0x22')]||_0x555874);_0x13451c[_0x9484('0x21')](_0x327ee2[_0x9484('0x21')]||0x0);return dbH[_0x9484('0x83')][_0x9484('0x34')](_0x4a352c[_0x9484('0x82')](),{'type':dbH[_0x9484('0x83')][_0x9484('0x8f')][_0x9484('0x84')]})[_0x9484('0x27')](function(_0x1113d0){if(!_0x1113d0[_0x9484('0x3a')]){_0x19e74f=0x0;}else{_0x19e74f=_0x1113d0[0x0][_0x9484('0x20')]||0x0;}return dbH[_0x9484('0x83')][_0x9484('0x34')](_0x13451c[_0x9484('0x82')](),{'type':dbH['sequelize'][_0x9484('0x8f')]['SELECT']});})['then'](function(_0x5c1cce){return{'rows':_0x5c1cce||[],'count':_0x19e74f};});}});}exports[_0x9484('0xa3')]=function(_0x34bcd3,_0x474da8){return runReport(_0x34bcd3[_0x9484('0x46')],_0x34bcd3[_0x9484('0x34')],_0x34bcd3[_0x9484('0x43')])[_0x9484('0x27')](respondWithResult(_0x474da8,null))[_0x9484('0x48')](handleError(_0x474da8,null));};exports[_0x9484('0xa4')]=runReport;exports[_0x9484('0x34')]=function(_0x162cce,_0x4b3ca6){var _0x26dff9=0xa;var _0xb51894=['join',_0x9484('0x55'),_0x9484('0x56'),_0x9484('0x57')];var _0x5756f4={'SUM':_0x9484('0x58'),'COUNT':_0x9484('0x59'),'COUNT DISTINCT':_0x9484('0x85'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x9484('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9484('0xa5')};var _0x424812={'SEC_TO_TIME':_0x9484('0x87'),'DATE':_0x9484('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x9484('0x89'),'UNIX_TIMESTAMP':_0x9484('0x5f')};var _0x533cd3=function(_0x306c1d){return!_['includes']([_0x9484('0x8a'),'IS\x20NOT\x20NULL',_0x9484('0xa6'),_0x9484('0x61')],_0x306c1d);};var _0x3e4228=function(_0x38d798){if(!_0x38d798||!_0x38d798['rules'][_0x9484('0x3a')]){return'';}for(var _0x38a9c9='(',_0x168db9=0x0;_0x168db9<_0x38d798[_0x9484('0x62')][_0x9484('0x3a')];_0x168db9+=0x1){_0x168db9>0x0&&(_0x38a9c9+='\x20'+_0x38d798[_0x9484('0x63')]+'\x20');_0x38a9c9+=_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x64')]?_0x3e4228(_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x64')]):_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x65')]+'\x20'+_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x66')]+(_0x533cd3(_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x66')])?'\x20'+_0x38d798[_0x9484('0x62')][_0x168db9][_0x9484('0x67')]:'');}return _0x38a9c9+')';};var _0x3e573b={'where':{'id':_0x162cce[_0x9484('0x46')]['id']}},_0x464c4a,_0x4fd6c6,_0x3580d3,_0x3a45f2,_0xe9488b;_0x3e573b=_[_0x9484('0x41')]({},_0x3e573b,_0x162cce['options']);return db[_0x9484('0x2e')]['find'](_0x3e573b)[_0x9484('0x27')](function(_0x1be136){if(_0x1be136){_0x464c4a=_0x1be136;return _0x1be136[_0x9484('0x68')]();}return null;})['then'](function(_0x971ed3){if(_0x971ed3){if(!_0x971ed3[_0x9484('0x3a')]){throw new db[(_0x9484('0x69'))][(_0x9484('0x6a'))](_0x9484('0x6b'),0x193);}_0x4fd6c6=_0x971ed3;return db[_0x9484('0x6c')][_0x9484('0x6d')]({'raw':!![]});}return null;})[_0x9484('0x27')](function(_0x33f83f){if(_0x33f83f){_0x3580d3=_[_0x9484('0x6e')](_0x33f83f,'id');var _0x360d1d;var _0x53adbf=squel[_0x9484('0x6f')]();_0x53adbf[_0x9484('0x70')](_0x464c4a[_0x9484('0x71')]);for(var _0x54d850=0x0;_0x54d850<_0x4fd6c6['length'];_0x54d850+=0x1){_0x360d1d=_0x4fd6c6[_0x54d850]['MetricId']?_0x3580d3[_0x4fd6c6[_0x54d850][_0x9484('0x8c')]][_0x9484('0x72')]:_0x4fd6c6[_0x54d850][_0x9484('0x65')];_0x360d1d=_0x4fd6c6[_0x54d850][_0x9484('0x74')]?_[_0x9484('0x73')](_0x5756f4[_0x4fd6c6[_0x54d850][_0x9484('0x74')]],'%s',_0x360d1d):_0x360d1d;_0x360d1d=_0x4fd6c6[_0x54d850]['format']?_[_0x9484('0x73')](_0x424812[_0x4fd6c6[_0x54d850][_0x9484('0x75')]],'%s',_0x360d1d):_0x360d1d;if(_0x4fd6c6[_0x54d850][_0x9484('0x8d')]){_0x53adbf[_0x9484('0x64')](_0x360d1d);}_0x4fd6c6[_0x54d850][_0x9484('0x76')]&&_0x53adbf['order'](_0x360d1d,_0x4fd6c6[_0x54d850][_0x9484('0x76')]===_0x9484('0x77')?![]:!![]);_0x53adbf['field'](_0x360d1d,_0x4fd6c6[_0x54d850][_0x9484('0x78')]||_0x360d1d);}if(_0x464c4a[_0x9484('0x79')]){_0x464c4a[_0x9484('0x79')]=JSON['parse'](_0x464c4a[_0x9484('0x79')]);for(var _0xfe9d8b=0x0;_0xfe9d8b<_0x464c4a[_0x9484('0x79')][_0x9484('0x3a')];_0xfe9d8b+=0x1){if(_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x31')]&&_[_0x9484('0x60')](_0xb51894,_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x31')])&&_0x464c4a['joins'][_0xfe9d8b]['parentKey']&&_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x7b')]&&_0x464c4a[_0x9484('0x79')][_0xfe9d8b]['foreignKey']){_0x53adbf[_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x31')]](_0x464c4a['joins'][_0xfe9d8b]['foreignTable'],null,util[_0x9484('0x75')]('%s.%s\x20=\x20%s.%s',_0x464c4a[_0x9484('0x71')],_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x7a')],_0x464c4a[_0x9484('0x79')][_0xfe9d8b][_0x9484('0x7b')],_0x464c4a[_0x9484('0x79')][_0xfe9d8b]['foreignKey']));}}}if(_0x464c4a['conditions']){_0x464c4a['conditions']=JSON[_0x9484('0x7e')](_0x464c4a[_0x9484('0x7d')]);_0x53adbf[_0x9484('0x3f')](_0x3e4228(_0x464c4a['conditions']['group']));}_0xe9488b=_0x53adbf[_0x9484('0x7f')]();_0x53adbf[_0x9484('0x22')](_0x26dff9);_0x53adbf[_0x9484('0x21')](0x0);logger[_0x9484('0x80')](_0x9484('0x81'),_0x53adbf['toString']());return db[_0x9484('0x83')][_0x9484('0x34')](_0x53adbf[_0x9484('0x82')](),{'type':db[_0x9484('0x83')][_0x9484('0x8f')][_0x9484('0x84')]});}})[_0x9484('0x27')](function(){return{'sql':_0xe9488b['toString']()};})[_0x9484('0x27')](respondWithResult(_0x4b3ca6,null))['catch'](handleError(_0x4b3ca6,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 28821ba..4313404 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 _0x3ef7=['../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var logger=require(_0x73ef('0x1'))(_0x73ef('0x2'));var moment=require(_0x73ef('0x3'));var BPromise=require(_0x73ef('0x4'));var rp=require(_0x73ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73ef('0x6'));var config=require(_0x73ef('0x7'));var attributes=require(_0x73ef('0x8'));module[_0x73ef('0x9')]=function(_0x4aaf96,_0x18cd10){return _0x4aaf96[_0x73ef('0xa')](_0x73ef('0xb'),attributes,{'tableName':_0x73ef('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa981=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2f5357,_0xc8d836){var _0x282981=function(_0x1f329c){while(--_0x1f329c){_0x2f5357['push'](_0x2f5357['shift']());}};_0x282981(++_0xc8d836);}(_0xa981,0xa9));var _0x1a98=function(_0x30dfa4,_0x1a6275){_0x30dfa4=_0x30dfa4-0x0;var _0x185b37=_0xa981[_0x30dfa4];return _0x185b37;};'use strict';var _=require('lodash');var util=require(_0x1a98('0x0'));var logger=require('../../config/logger')(_0x1a98('0x1'));var moment=require(_0x1a98('0x2'));var BPromise=require(_0x1a98('0x3'));var rp=require(_0x1a98('0x4'));var fs=require('fs');var path=require(_0x1a98('0x5'));var rimraf=require('rimraf');var config=require(_0x1a98('0x6'));var attributes=require(_0x1a98('0x7'));module['exports']=function(_0x2209df,_0x74e0b){return _0x2209df[_0x1a98('0x8')](_0x1a98('0x9'),attributes,{'tableName':_0x1a98('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 c42e729..7edb706 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 _0xbdf1=['code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xdd9d71,_0x38f8d3){var _0x2d245d=function(_0x4af9c7){while(--_0x4af9c7){_0xdd9d71['push'](_0xdd9d71['shift']());}};_0x2d245d(++_0x38f8d3);}(_0xbdf1,0x14d));var _0x1bdf=function(_0x2eb7ed,_0x579678){_0x2eb7ed=_0x2eb7ed-0x0;var _0x238aa5=_0xbdf1[_0x2eb7ed];return _0x238aa5;};'use strict';var _=require('lodash');var util=require(_0x1bdf('0x0'));var moment=require(_0x1bdf('0x1'));var BPromise=require('bluebird');var rs=require(_0x1bdf('0x2'));var fs=require('fs');var Redis=require(_0x1bdf('0x3'));var db=require(_0x1bdf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1bdf('0x5'))(_0x1bdf('0x6'));var config=require(_0x1bdf('0x7'));var jayson=require(_0x1bdf('0x8'));var client=jayson[_0x1bdf('0x9')][_0x1bdf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfbf123,_0xe8250e,_0x113f04){return new BPromise(function(_0xa87715,_0x8782dd){return client['request'](_0xfbf123,_0x113f04)[_0x1bdf('0xb')](function(_0x18d2d9){logger[_0x1bdf('0xc')](_0x1bdf('0xd'),_0xe8250e,_0x1bdf('0xe'));logger[_0x1bdf('0xf')](_0x1bdf('0x10'),_0xe8250e,_0x1bdf('0xe'),JSON[_0x1bdf('0x11')](_0x18d2d9));if(_0x18d2d9[_0x1bdf('0x12')]){if(_0x18d2d9[_0x1bdf('0x12')][_0x1bdf('0x13')]===0x1f4){logger[_0x1bdf('0x12')](_0x1bdf('0xd'),_0xe8250e,_0x18d2d9[_0x1bdf('0x12')][_0x1bdf('0x14')]);return _0x8782dd(_0x18d2d9[_0x1bdf('0x12')][_0x1bdf('0x14')]);}logger[_0x1bdf('0x12')](_0x1bdf('0xd'),_0xe8250e,_0x18d2d9[_0x1bdf('0x12')][_0x1bdf('0x14')]);return _0xa87715(_0x18d2d9[_0x1bdf('0x12')][_0x1bdf('0x14')]);}else{logger[_0x1bdf('0xc')](_0x1bdf('0xd'),_0xe8250e,_0x1bdf('0xe'));_0xa87715(_0x18d2d9['result'][_0x1bdf('0x14')]);}})[_0x1bdf('0x15')](function(_0x11db88){logger[_0x1bdf('0x12')](_0x1bdf('0xd'),_0xe8250e,_0x11db88);_0x8782dd(_0x11db88);});});} \ No newline at end of file +var _0xe3cd=['error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3ded2c,_0x3630fd){var _0xe1193b=function(_0x9d2ac7){while(--_0x9d2ac7){_0x3ded2c['push'](_0x3ded2c['shift']());}};_0xe1193b(++_0x3630fd);}(_0xe3cd,0x1ea));var _0xde3c=function(_0x242c28,_0x200539){_0x242c28=_0x242c28-0x0;var _0x1e5a91=_0xe3cd[_0x242c28];return _0x1e5a91;};'use strict';var _=require(_0xde3c('0x0'));var util=require(_0xde3c('0x1'));var moment=require(_0xde3c('0x2'));var BPromise=require(_0xde3c('0x3'));var rs=require(_0xde3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde3c('0x5'))['db'];var utils=require(_0xde3c('0x6'));var logger=require(_0xde3c('0x7'))(_0xde3c('0x8'));var config=require(_0xde3c('0x9'));var jayson=require(_0xde3c('0xa'));var client=jayson['client'][_0xde3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5904fd,_0x58ad95,_0x41f5b0){return new BPromise(function(_0x27418e,_0x4a6911){return client['request'](_0x5904fd,_0x41f5b0)[_0xde3c('0xc')](function(_0x44d380){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x58ad95,'request\x20sent');logger[_0xde3c('0xd')](_0xde3c('0xe'),_0x58ad95,_0xde3c('0xf'),JSON['stringify'](_0x44d380));if(_0x44d380['error']){if(_0x44d380[_0xde3c('0x10')][_0xde3c('0x11')]===0x1f4){logger[_0xde3c('0x10')](_0xde3c('0x12'),_0x58ad95,_0x44d380[_0xde3c('0x10')]['message']);return _0x4a6911(_0x44d380[_0xde3c('0x10')]['message']);}logger[_0xde3c('0x10')](_0xde3c('0x12'),_0x58ad95,_0x44d380[_0xde3c('0x10')][_0xde3c('0x13')]);return _0x27418e(_0x44d380[_0xde3c('0x10')][_0xde3c('0x13')]);}else{logger[_0xde3c('0x14')](_0xde3c('0x12'),_0x58ad95,_0xde3c('0xf'));_0x27418e(_0x44d380[_0xde3c('0x15')][_0xde3c('0x13')]);}})['catch'](function(_0x1e6453){logger[_0xde3c('0x10')](_0xde3c('0x12'),_0x58ad95,_0x1e6453);_0x4a6911(_0x1e6453);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 543878c..d9c8432 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 _0x1961=['./analyticCustomReport.controller','get','index','/:id','show','/:id/preview','preview','/:id/run','isAuthenticated','/:id/query','query','post','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x547140,_0x1cc75a){var _0x316db0=function(_0x5e63d0){while(--_0x5e63d0){_0x547140['push'](_0x547140['shift']());}};_0x316db0(++_0x1cc75a);}(_0x1961,0x1dc));var _0x1196=function(_0x43346c,_0x46fe5d){_0x43346c=_0x43346c-0x0;var _0x321616=_0x1961[_0x43346c];return _0x321616;};'use strict';var multer=require(_0x1196('0x0'));var util=require(_0x1196('0x1'));var path=require(_0x1196('0x2'));var timeout=require('connect-timeout');var express=require(_0x1196('0x3'));var router=express[_0x1196('0x4')]();var auth=require(_0x1196('0x5'));var interaction=require(_0x1196('0x6'));var config=require('../../config/environment');var controller=require(_0x1196('0x7'));router[_0x1196('0x8')]('/',auth['isAuthenticated'](),controller[_0x1196('0x9')]);router[_0x1196('0x8')](_0x1196('0xa'),auth['isAuthenticated'](),controller[_0x1196('0xb')]);router['get'](_0x1196('0xc'),auth['isAuthenticated'](),controller[_0x1196('0xd')]);router['get'](_0x1196('0xe'),auth[_0x1196('0xf')](),controller['run']);router['get'](_0x1196('0x10'),auth[_0x1196('0xf')](),controller[_0x1196('0x11')]);router[_0x1196('0x12')]('/',auth[_0x1196('0xf')](),controller['create']);router[_0x1196('0x13')](_0x1196('0xa'),auth[_0x1196('0xf')](),controller[_0x1196('0x14')]);router[_0x1196('0x15')](_0x1196('0xa'),auth['isAuthenticated'](),controller[_0x1196('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5e78=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','index','get','isAuthenticated','preview','/:id/run','run','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x4d43c6,_0x26f580){var _0x42076d=function(_0x16e744){while(--_0x16e744){_0x4d43c6['push'](_0x4d43c6['shift']());}};_0x42076d(++_0x26f580);}(_0x5e78,0x1a3));var _0x85e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e78[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x85e7('0x0'));var path=require('path');var timeout=require(_0x85e7('0x1'));var express=require(_0x85e7('0x2'));var router=express[_0x85e7('0x3')]();var auth=require(_0x85e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x85e7('0x5'));var controller=require(_0x85e7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x85e7('0x7')]);router[_0x85e7('0x8')]('/:id',auth[_0x85e7('0x9')](),controller['show']);router[_0x85e7('0x8')]('/:id/preview',auth[_0x85e7('0x9')](),controller[_0x85e7('0xa')]);router[_0x85e7('0x8')](_0x85e7('0xb'),auth[_0x85e7('0x9')](),controller[_0x85e7('0xc')]);router[_0x85e7('0x8')]('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0x85e7('0xd')]);router[_0x85e7('0xe')](_0x85e7('0xf'),auth[_0x85e7('0x9')](),controller[_0x85e7('0x10')]);router[_0x85e7('0x11')](_0x85e7('0xf'),auth['isAuthenticated'](),controller[_0x85e7('0x12')]);module[_0x85e7('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 525807e..cabfafa 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 _0x9e11=['exports','STRING','TEXT'];(function(_0xeb4690,_0x9c757f){var _0x5b08f=function(_0x3dd1e1){while(--_0x3dd1e1){_0xeb4690['push'](_0xeb4690['shift']());}};_0x5b08f(++_0x9c757f);}(_0x9e11,0x165));var _0x19e1=function(_0x36c1e0,_0x6b06b3){_0x36c1e0=_0x36c1e0-0x0;var _0xa27e8d=_0x9e11[_0x36c1e0];return _0xa27e8d;};'use strict';var Sequelize=require('sequelize');module[_0x19e1('0x0')]={'name':{'type':Sequelize[_0x19e1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x19e1('0x1')]},'parent':{'type':Sequelize[_0x19e1('0x1')]},'table':{'type':Sequelize[_0x19e1('0x1')]},'conditions':{'type':Sequelize[_0x19e1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe7fc=['TEXT','sequelize','exports','STRING'];(function(_0x57df57,_0x5d48b5){var _0x2705f1=function(_0x41afcb){while(--_0x41afcb){_0x57df57['push'](_0x57df57['shift']());}};_0x2705f1(++_0x5d48b5);}(_0xe7fc,0x159));var _0xce7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe7fc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce7f('0x0'));module[_0xce7f('0x1')]={'name':{'type':Sequelize[_0xce7f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xce7f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xce7f('0x2')]},'conditions':{'type':Sequelize[_0xce7f('0x3')]},'joins':{'type':Sequelize[_0xce7f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index dd55e7f..9a57cd0 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 _0x199f=['rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','params','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','right_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','value','clone','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','QueryTypes','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','DefaultReports','error','stack','name','send','index','map','AnalyticDefaultReport'];(function(_0x36f7c5,_0xbf95e7){var _0x486c84=function(_0x4d718f){while(--_0x4d718f){_0x36f7c5['push'](_0x36f7c5['shift']());}};_0x486c84(++_0xbf95e7);}(_0x199f,0x7b));var _0xf199=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0x199f[_0x5d61b4];return _0x183fc5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf199('0x0'));var rimraf=require(_0xf199('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf199('0x2'));var BPromise=require(_0xf199('0x3'));var Mustache=require(_0xf199('0x4'));var util=require(_0xf199('0x5'));var path=require(_0xf199('0x6'));var sox=require('sox');var csv=require(_0xf199('0x7'));var ejs=require(_0xf199('0x8'));var fs=require('fs');var _=require(_0xf199('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf199('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf199('0x7'));var querystring=require(_0xf199('0xb'));var Papa=require(_0xf199('0xc'));var Redis=require('ioredis');var authService=require(_0xf199('0xd'));var qs=require(_0xf199('0xe'));var as=require(_0xf199('0xf'));var hardwareService=require(_0xf199('0x10'));var logger=require(_0xf199('0x11'))(_0xf199('0x12'));var utils=require('../../config/utils');var config=require(_0xf199('0x13'));var db=require(_0xf199('0x14'))['db'];var dbH=require(_0xf199('0x14'))['dbH'];function respondWithStatusCode(_0x3d554b,_0x17cd86){_0x17cd86=_0x17cd86||0xcc;return function(_0x4e2090){if(_0x4e2090){return _0x3d554b['sendStatus'](_0x17cd86);}return _0x3d554b[_0xf199('0x15')](_0x17cd86)[_0xf199('0x16')]();};}function respondWithResult(_0x508924,_0xe60d5b){_0xe60d5b=_0xe60d5b||0xc8;return function(_0xe6ad1a){if(_0xe6ad1a){return _0x508924[_0xf199('0x15')](_0xe60d5b)[_0xf199('0x17')](_0xe6ad1a);}};}function respondWithFilteredResult(_0x463f59,_0x31594b){return function(_0x502366){if(_0x502366){var _0x2750d6=_0x502366[_0xf199('0x18')],_0x3114d9=_0x31594b[_0xf199('0x19')],_0x27e502=_0x31594b[_0xf199('0x19')]+_0x31594b[_0xf199('0x1a')],_0x4801aa;if(_0x27e502>=_0x2750d6){_0x27e502=_0x2750d6;_0x4801aa=0xc8;}else{_0x4801aa=0xce;}_0x463f59[_0xf199('0x15')](_0x4801aa);return _0x463f59[_0xf199('0x1b')](_0xf199('0x1c'),_0x3114d9+'-'+_0x27e502+'/'+_0x2750d6)['json'](_0x502366);}return null;};}function patchUpdates(_0x47d556){return function(_0x167437){try{jsonpatch[_0xf199('0x1d')](_0x167437,_0x47d556,!![]);}catch(_0x4a43a1){return BPromise['reject'](_0x4a43a1);}return _0x167437[_0xf199('0x1e')]();};}function saveUpdates(_0xd10b90,_0x53a2e4){return function(_0x30db68){if(_0x30db68){return _0x30db68[_0xf199('0x1f')](_0xd10b90)['then'](function(_0x4e5225){return _0x4e5225;});}return null;};}function removeEntity(_0x207f2a,_0x3dbea4){return function(_0x32f32f){if(_0x32f32f){return _0x32f32f['destroy']()[_0xf199('0x20')](function(){var _0x4db770=_0x32f32f[_0xf199('0x21')]({'plain':!![]});var _0x58f67c=_0xf199('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x58f67c,'resourceId':_0x4db770['id']}})[_0xf199('0x20')](function(){return _0x32f32f;});})[_0xf199('0x20')](function(){_0x207f2a[_0xf199('0x15')](0xcc)[_0xf199('0x16')]();});}};}function handleEntityNotFound(_0xeb9590,_0x43d90b){return function(_0x7e65b4){if(!_0x7e65b4){_0xeb9590['sendStatus'](0x194);}return _0x7e65b4;};}function handleError(_0x880315,_0x5e0f12){_0x5e0f12=_0x5e0f12||0x1f4;return function(_0x205a71){logger[_0xf199('0x23')](_0x205a71[_0xf199('0x24')]);if(_0x205a71['name']){delete _0x205a71[_0xf199('0x25')];}_0x880315[_0xf199('0x15')](_0x5e0f12)[_0xf199('0x26')](_0x205a71);};}exports[_0xf199('0x27')]=function(_0x134659,_0x434156){var _0x51b065={},_0x45eced={},_0x160fef={'count':0x0,'rows':[]};var _0x5a6692=_[_0xf199('0x28')](db[_0xf199('0x29')][_0xf199('0x2a')],function(_0x5d6b12){return{'name':_0x5d6b12[_0xf199('0x2b')],'type':_0x5d6b12[_0xf199('0x2c')]['key']};});_0x45eced[_0xf199('0x2d')]=_[_0xf199('0x28')](_0x5a6692,'name');_0x45eced['query']=_['keys'](_0x134659[_0xf199('0x2e')]);_0x45eced['filters']=_[_0xf199('0x2f')](_0x45eced[_0xf199('0x2d')],_0x45eced[_0xf199('0x2e')]);_0x51b065[_0xf199('0x30')]=_[_0xf199('0x2f')](_0x45eced[_0xf199('0x2d')],qs[_0xf199('0x31')](_0x134659[_0xf199('0x2e')][_0xf199('0x31')]));_0x51b065[_0xf199('0x30')]=_0x51b065['attributes'][_0xf199('0x32')]?_0x51b065[_0xf199('0x30')]:_0x45eced['model'];if(!_0x134659['query'][_0xf199('0x33')]('nolimit')){_0x51b065[_0xf199('0x1a')]=qs[_0xf199('0x1a')](_0x134659[_0xf199('0x2e')]['limit']);_0x51b065[_0xf199('0x19')]=qs[_0xf199('0x19')](_0x134659[_0xf199('0x2e')]['offset']);}_0x51b065[_0xf199('0x34')]=qs[_0xf199('0x35')](_0x134659[_0xf199('0x2e')][_0xf199('0x35')]);_0x51b065[_0xf199('0x36')]=qs['filters'](_[_0xf199('0x37')](_0x134659[_0xf199('0x2e')],_0x45eced[_0xf199('0x38')]),_0x5a6692);if(_0x134659[_0xf199('0x2e')][_0xf199('0x39')]){_0x51b065[_0xf199('0x36')]=_[_0xf199('0x3a')](_0x51b065[_0xf199('0x36')],{'$or':_['map'](_0x5a6692,function(_0x2bb871){if(_0x2bb871[_0xf199('0x2c')]!==_0xf199('0x3b')){var _0x1a2583={};_0x1a2583[_0x2bb871[_0xf199('0x25')]]={'$like':'%'+_0x134659[_0xf199('0x2e')][_0xf199('0x39')]+'%'};return _0x1a2583;}})});}_0x51b065=_[_0xf199('0x3a')]({},_0x51b065,_0x134659['options']);var _0x2b4ec1={'where':_0x51b065[_0xf199('0x36')]};return db[_0xf199('0x29')][_0xf199('0x18')](_0x2b4ec1)[_0xf199('0x20')](function(_0x9d60f6){_0x160fef['count']=_0x9d60f6;if(_0x134659[_0xf199('0x2e')][_0xf199('0x3c')]){_0x51b065[_0xf199('0x3d')]=[{'all':!![]}];}return db[_0xf199('0x29')][_0xf199('0x3e')](_0x51b065);})['then'](function(_0x408dc1){_0x160fef[_0xf199('0x3f')]=_0x408dc1;return _0x160fef;})[_0xf199('0x20')](respondWithFilteredResult(_0x434156,_0x51b065))[_0xf199('0x40')](handleError(_0x434156,null));};exports[_0xf199('0x41')]=function(_0x57580d,_0x233e73){var _0x3e013b={'raw':!![],'where':{'id':_0x57580d['params']['id']}},_0x209cf9={};_0x209cf9[_0xf199('0x2d')]=_[_0xf199('0x42')](db[_0xf199('0x29')][_0xf199('0x2a')]);_0x209cf9[_0xf199('0x2e')]=_[_0xf199('0x42')](_0x57580d[_0xf199('0x2e')]);_0x209cf9[_0xf199('0x38')]=_[_0xf199('0x2f')](_0x209cf9[_0xf199('0x2d')],_0x209cf9['query']);_0x3e013b[_0xf199('0x30')]=_[_0xf199('0x2f')](_0x209cf9['model'],qs[_0xf199('0x31')](_0x57580d[_0xf199('0x2e')][_0xf199('0x31')]));_0x3e013b['attributes']=_0x3e013b[_0xf199('0x30')][_0xf199('0x32')]?_0x3e013b[_0xf199('0x30')]:_0x209cf9[_0xf199('0x2d')];if(_0x57580d[_0xf199('0x2e')]['includeAll']){_0x3e013b[_0xf199('0x3d')]=[{'all':!![]}];}_0x3e013b=_[_0xf199('0x3a')]({},_0x3e013b,_0x57580d[_0xf199('0x43')]);return db[_0xf199('0x29')][_0xf199('0x44')](_0x3e013b)[_0xf199('0x20')](handleEntityNotFound(_0x233e73,null))['then'](respondWithResult(_0x233e73,null))['catch'](handleError(_0x233e73,null));};exports[_0xf199('0x45')]=function(_0x4d95ec,_0x2ad34c){return db[_0xf199('0x29')][_0xf199('0x45')](_0x4d95ec['body'],{})[_0xf199('0x20')](function(_0x532804){var _0xf093cb=_0x4d95ec[_0xf199('0x46')]['get']({'plain':!![]});if(!_0xf093cb)throw new Error(_0xf199('0x47'));if(_0xf093cb[_0xf199('0x48')]===_0xf199('0x46')){var _0x2b66b2=_0x532804[_0xf199('0x21')]({'plain':!![]});var _0x3688a5=_0xf199('0x49');return db[_0xf199('0x4a')][_0xf199('0x44')]({'where':{'name':_0x3688a5,'userProfileId':_0xf093cb[_0xf199('0x4b')]},'raw':!![]})[_0xf199('0x20')](function(_0x541687){if(_0x541687&&_0x541687['autoAssociation']===0x0){return db[_0xf199('0x4c')][_0xf199('0x45')]({'name':_0x2b66b2['name'],'resourceId':_0x2b66b2['id'],'type':_0xf199('0x22'),'sectionId':_0x541687['id']},{})[_0xf199('0x20')](function(){return _0x532804;});}else{return _0x532804;}})[_0xf199('0x40')](function(_0x3c43a0){logger[_0xf199('0x23')](_0xf199('0x4d'),_0x3c43a0);throw _0x3c43a0;});}return _0x532804;})[_0xf199('0x20')](respondWithResult(_0x2ad34c,0xc9))['catch'](handleError(_0x2ad34c,null));};exports[_0xf199('0x1f')]=function(_0xa63b40,_0x2f22d7){if(_0xa63b40[_0xf199('0x4e')]['id']){delete _0xa63b40[_0xf199('0x4e')]['id'];}return db[_0xf199('0x29')][_0xf199('0x44')]({'where':{'id':_0xa63b40['params']['id']}})[_0xf199('0x20')](handleEntityNotFound(_0x2f22d7,null))[_0xf199('0x20')](saveUpdates(_0xa63b40['body'],null))['then'](respondWithResult(_0x2f22d7,null))[_0xf199('0x40')](handleError(_0x2f22d7,null));};exports[_0xf199('0x4f')]=function(_0x4e4008,_0x470166){return db[_0xf199('0x29')][_0xf199('0x44')]({'where':{'id':_0x4e4008[_0xf199('0x50')]['id']}})['then'](handleEntityNotFound(_0x470166,null))[_0xf199('0x20')](removeEntity(_0x470166,null))[_0xf199('0x40')](handleError(_0x470166,null));};exports[_0xf199('0x51')]=function(_0x410878,_0xfe8512){var _0x2e8ebd=0xa;var _0x11b401=[_0xf199('0x52'),_0xf199('0x53'),'right_join',_0xf199('0x54')];var _0xe3a210={'SUM':_0xf199('0x55'),'COUNT':_0xf199('0x56'),'COUNT DISTINCT':_0xf199('0x57'),'MAX':_0xf199('0x58'),'MIN':_0xf199('0x59'),'AVG':_0xf199('0x5a'),'GROUP_CONCAT':_0xf199('0x5b'),'GROUP_CONCAT ASC':_0xf199('0x5c'),'GROUP_CONCAT DESC':_0xf199('0x5d')};var _0x2a22e4={'SEC_TO_TIME':_0xf199('0x5e'),'DATE':_0xf199('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xf199('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31e29e=function(_0x6e63ff){return!_[_0xf199('0x61')]([_0xf199('0x62'),_0xf199('0x63'),_0xf199('0x64'),'IS\x20NOT\x20EMPTY'],_0x6e63ff);};var _0x34fce7=function(_0xec0aef){if(!_0xec0aef||!_0xec0aef[_0xf199('0x65')]['length']){return'';}for(var _0x3539ec='(',_0x3f35e3=0x0;_0x3f35e3<_0xec0aef[_0xf199('0x65')][_0xf199('0x32')];_0x3f35e3+=0x1){_0x3f35e3>0x0&&(_0x3539ec+='\x20'+_0xec0aef['operator']+'\x20');_0x3539ec+=_0xec0aef[_0xf199('0x65')][_0x3f35e3][_0xf199('0x66')]?_0x34fce7(_0xec0aef[_0xf199('0x65')][_0x3f35e3]['group']):_0xec0aef[_0xf199('0x65')][_0x3f35e3][_0xf199('0x67')]+'\x20'+_0xec0aef['rules'][_0x3f35e3][_0xf199('0x68')]+(_0x31e29e(_0xec0aef[_0xf199('0x65')][_0x3f35e3][_0xf199('0x68')])?'\x20'+_0xec0aef[_0xf199('0x65')][_0x3f35e3]['value']:'');}return _0x3539ec+')';};var _0x52a50f={'where':{'id':_0x410878[_0xf199('0x50')]['id']}},_0x3cdedd,_0x3b3bf9,_0x3c782f,_0x493a1a,_0x501972;_0x52a50f=_[_0xf199('0x3a')]({},_0x52a50f,_0x410878[_0xf199('0x43')]);return db[_0xf199('0x29')][_0xf199('0x44')](_0x52a50f)[_0xf199('0x20')](function(_0x11a904){if(_0x11a904){_0x3cdedd=_0x11a904;return _0x11a904[_0xf199('0x69')]();}return null;})[_0xf199('0x20')](function(_0x313055){if(_0x313055){if(!_0x313055['length']){throw new db[(_0xf199('0x6a'))][(_0xf199('0x6b'))](_0xf199('0x6c'),0x193);}_0x3b3bf9=_0x313055;return db[_0xf199('0x6d')][_0xf199('0x3e')]({'raw':!![]});}return null;})[_0xf199('0x20')](function(_0x549f45){if(_0x549f45){_0x3c782f=_[_0xf199('0x6e')](_0x549f45,'id');var _0x19e764;var _0x406d27=squel['select']();_0x406d27[_0xf199('0x6f')](_0x3cdedd[_0xf199('0x70')]);for(var _0x355af5=0x0;_0x355af5<_0x3b3bf9[_0xf199('0x32')];_0x355af5+=0x1){_0x19e764=_0x3b3bf9[_0x355af5][_0xf199('0x71')]?_0x3c782f[_0x3b3bf9[_0x355af5][_0xf199('0x71')]][_0xf199('0x72')]:_0x3b3bf9[_0x355af5][_0xf199('0x67')];_0x19e764=_0x3b3bf9[_0x355af5][_0xf199('0x73')]?_[_0xf199('0x74')](_0xe3a210[_0x3b3bf9[_0x355af5]['function']],'%s',_0x19e764):_0x19e764;_0x19e764=_0x3b3bf9[_0x355af5][_0xf199('0x75')]?_['replace'](_0x2a22e4[_0x3b3bf9[_0x355af5]['format']],'%s',_0x19e764):_0x19e764;if(_0x3b3bf9[_0x355af5][_0xf199('0x76')]){_0x406d27['group'](_0x19e764);}_0x3b3bf9[_0x355af5][_0xf199('0x77')]&&_0x406d27['order'](_0x19e764,_0x3b3bf9[_0x355af5][_0xf199('0x77')]===_0xf199('0x78')?![]:!![]);_0x406d27[_0xf199('0x67')](_0x19e764,_0x3b3bf9[_0x355af5][_0xf199('0x79')]||_0x19e764);}if(_0x3cdedd[_0xf199('0x7a')]){_0x3cdedd['joins']=JSON[_0xf199('0x7b')](_0x3cdedd[_0xf199('0x7a')]);for(var _0x31c714=0x0;_0x31c714<_0x3cdedd[_0xf199('0x7a')][_0xf199('0x32')];_0x31c714+=0x1){if(_0x3cdedd[_0xf199('0x7a')][_0x31c714][_0xf199('0x2c')]&&_[_0xf199('0x61')](_0x11b401,_0x3cdedd[_0xf199('0x7a')][_0x31c714][_0xf199('0x2c')])&&_0x3cdedd[_0xf199('0x7a')][_0x31c714][_0xf199('0x7c')]&&_0x3cdedd[_0xf199('0x7a')][_0x31c714][_0xf199('0x7d')]&&_0x3cdedd[_0xf199('0x7a')][_0x31c714]['foreignKey']){_0x406d27[_0x3cdedd[_0xf199('0x7a')][_0x31c714][_0xf199('0x2c')]](_0x3cdedd[_0xf199('0x7a')][_0x31c714]['foreignTable'],null,util[_0xf199('0x75')](_0xf199('0x7e'),_0x3cdedd[_0xf199('0x70')],_0x3cdedd['joins'][_0x31c714][_0xf199('0x7c')],_0x3cdedd[_0xf199('0x7a')][_0x31c714][_0xf199('0x7d')],_0x3cdedd[_0xf199('0x7a')][_0x31c714][_0xf199('0x7f')]));}}}if(_0x3cdedd[_0xf199('0x80')]){_0x3cdedd[_0xf199('0x80')]=JSON[_0xf199('0x7b')](_0x3cdedd[_0xf199('0x80')]);_0x406d27[_0xf199('0x36')](_0x34fce7(_0x3cdedd['conditions']['group']));}_0x501972=_0x406d27['clone']();_0x406d27[_0xf199('0x1a')](_0x2e8ebd);_0x406d27['offset'](0x0);logger[_0xf199('0x81')](_0xf199('0x82'),_0x406d27[_0xf199('0x83')]());return db[_0xf199('0x84')][_0xf199('0x2e')](_0x406d27['toString'](),{'type':db[_0xf199('0x84')]['QueryTypes'][_0xf199('0x85')]});}})[_0xf199('0x20')](respondWithResult(_0xfe8512,null))[_0xf199('0x40')](handleError(_0xfe8512,null));};function runReport(_0x14b89a,_0x28d7c0,_0x355f4b){var _0x4cb440=_0x28d7c0[_0xf199('0x25')];var _0x41d425=0xa;var _0x4a98d6=['join',_0xf199('0x53'),_0xf199('0x86'),_0xf199('0x54')];var _0x56d195={'SUM':_0xf199('0x55'),'COUNT':_0xf199('0x56'),'COUNT DISTINCT':_0xf199('0x57'),'MAX':_0xf199('0x58'),'MIN':_0xf199('0x59'),'AVG':_0xf199('0x5a'),'GROUP_CONCAT':_0xf199('0x5b'),'GROUP_CONCAT ASC':_0xf199('0x5c'),'GROUP_CONCAT DESC':_0xf199('0x5d')};var _0x4a961a={'SEC_TO_TIME':_0xf199('0x5e'),'DATE':'DATE(%s)','HOUR':_0xf199('0x87'),'ROUND':_0xf199('0x60'),'UNIX_TIMESTAMP':_0xf199('0x88')};var _0xb14ca8=function(_0x2dbb87){return!_[_0xf199('0x61')]([_0xf199('0x62'),_0xf199('0x63'),_0xf199('0x64'),_0xf199('0x89')],_0x2dbb87);};var _0x824c4e=function(_0x43aae2){if(!_0x43aae2||!_0x43aae2[_0xf199('0x65')][_0xf199('0x32')]){return'';}for(var _0x3c9faa='(',_0x1b272e=0x0;_0x1b272e<_0x43aae2[_0xf199('0x65')]['length'];_0x1b272e+=0x1){_0x1b272e>0x0&&(_0x3c9faa+='\x20'+_0x43aae2[_0xf199('0x8a')]+'\x20');_0x3c9faa+=_0x43aae2['rules'][_0x1b272e]['group']?_0x824c4e(_0x43aae2[_0xf199('0x65')][_0x1b272e][_0xf199('0x66')]):_0x43aae2[_0xf199('0x65')][_0x1b272e][_0xf199('0x67')]+'\x20'+_0x43aae2[_0xf199('0x65')][_0x1b272e][_0xf199('0x68')]+(_0xb14ca8(_0x43aae2[_0xf199('0x65')][_0x1b272e]['condition'])?'\x20'+_0x43aae2['rules'][_0x1b272e][_0xf199('0x8b')]:'');}return _0x3c9faa+')';};var _0x25f501={'where':{'id':_0x14b89a['id']}},_0x3908ed,_0x10bcce,_0x51340c,_0x1dc561,_0xe09347;_0x25f501=_[_0xf199('0x3a')]({},_0x25f501,_0x355f4b);return db[_0xf199('0x29')][_0xf199('0x44')](_0x25f501)['then'](function(_0x187acd){if(_0x187acd){_0x3908ed=_0x187acd;return _0x187acd['getFields']();}return null;})['then'](function(_0x482080){if(_0x482080){if(!_0x482080[_0xf199('0x32')]){throw new db[(_0xf199('0x6a'))][(_0xf199('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10bcce=_0x482080;return db[_0xf199('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5f2659){if(_0x5f2659){_0x51340c=_['keyBy'](_0x5f2659,'id');var _0x5f97e6;var _0x4ec1dd=squel['select']();_0x4ec1dd[_0xf199('0x6f')](_0x3908ed['table']);for(var _0x4ed439=0x0;_0x4ed439<_0x10bcce[_0xf199('0x32')];_0x4ed439+=0x1){_0x5f97e6=_0x10bcce[_0x4ed439][_0xf199('0x71')]?_0x51340c[_0x10bcce[_0x4ed439][_0xf199('0x71')]]['metric']:_0x10bcce[_0x4ed439][_0xf199('0x67')];_0x5f97e6=_0x10bcce[_0x4ed439]['function']?_[_0xf199('0x74')](_0x56d195[_0x10bcce[_0x4ed439][_0xf199('0x73')]],'%s',_0x5f97e6):_0x5f97e6;_0x5f97e6=_0x10bcce[_0x4ed439][_0xf199('0x75')]?_[_0xf199('0x74')](_0x4a961a[_0x10bcce[_0x4ed439][_0xf199('0x75')]],'%s',_0x5f97e6):_0x5f97e6;if(_0x10bcce[_0x4ed439][_0xf199('0x76')]){_0x4ec1dd['group'](_0x5f97e6);}_0x10bcce[_0x4ed439][_0xf199('0x77')]&&_0x4ec1dd[_0xf199('0x34')](_0x5f97e6,_0x10bcce[_0x4ed439][_0xf199('0x77')]===_0xf199('0x78')?![]:!![]);_0x4ec1dd['field'](_0x5f97e6,_0x10bcce[_0x4ed439][_0xf199('0x79')]||_0x5f97e6);}if(_0x3908ed[_0xf199('0x7a')]){_0x3908ed[_0xf199('0x7a')]=JSON['parse'](_0x3908ed[_0xf199('0x7a')]);for(var _0x46aee4=0x0;_0x46aee4<_0x3908ed[_0xf199('0x7a')]['length'];_0x46aee4+=0x1){if(_0x3908ed[_0xf199('0x7a')][_0x46aee4][_0xf199('0x2c')]&&_[_0xf199('0x61')](_0x4a98d6,_0x3908ed[_0xf199('0x7a')][_0x46aee4]['type'])&&_0x3908ed[_0xf199('0x7a')][_0x46aee4]['parentKey']&&_0x3908ed[_0xf199('0x7a')][_0x46aee4]['foreignTable']&&_0x3908ed[_0xf199('0x7a')][_0x46aee4][_0xf199('0x7f')]){_0x4ec1dd[_0x3908ed[_0xf199('0x7a')][_0x46aee4][_0xf199('0x2c')]](_0x3908ed[_0xf199('0x7a')][_0x46aee4][_0xf199('0x7d')],null,util[_0xf199('0x75')]('%s.%s\x20=\x20%s.%s',_0x3908ed[_0xf199('0x70')],_0x3908ed[_0xf199('0x7a')][_0x46aee4][_0xf199('0x7c')],_0x3908ed[_0xf199('0x7a')][_0x46aee4][_0xf199('0x7d')],_0x3908ed[_0xf199('0x7a')][_0x46aee4]['foreignKey']));}}}if(_0x3908ed['conditions']){_0x3908ed[_0xf199('0x80')]=JSON[_0xf199('0x7b')](_0x3908ed[_0xf199('0x80')]);_0x4ec1dd[_0xf199('0x36')](_0x824c4e(_0x3908ed[_0xf199('0x80')][_0xf199('0x66')]));}_0xe09347=_0x4ec1dd[_0xf199('0x8c')]();_0x4ec1dd[_0xf199('0x1a')](_0x41d425);_0x4ec1dd['offset'](0x0);logger['debug'](_0xf199('0x82'),_0x4ec1dd[_0xf199('0x83')]());return db[_0xf199('0x84')]['query'](_0x4ec1dd[_0xf199('0x83')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})[_0xf199('0x20')](function(_0x2f4157){if(!_0x2f4157[_0xf199('0x32')]){throw new db[(_0xf199('0x6a'))][(_0xf199('0x6b'))](_0xf199('0x8d'),0xcc);}if(_0x28d7c0[_0xf199('0x8e')]===_0xf199('0x8f')){return null;}var _0x1619e5=_['merge'](_0x28d7c0,{'name':_0x28d7c0[_0xf199('0x90')]||_0x28d7c0[_0xf199('0x25')]||_0x3908ed[_0xf199('0x25')],'basename':_0x4cb440,'savename':util['format'](_0xf199('0x91'),_0x28d7c0['name']||_0x3908ed[_0xf199('0x25')],require(_0xf199('0x92'))['generate'](0x4),_0x28d7c0['output']||_0xf199('0x93')),'reportId':_0x3908ed['id'],'reportType':_0xf199('0x94')});return db[_0xf199('0x95')]['create'](_0x1619e5,{'raw':!![]});})['then'](function(_0x115f7c){if(_0x3908ed[_0xf199('0x70')]===_0xf199('0x96')){_0xe09347[_0xf199('0x36')](_0x3908ed[_0xf199('0x70')]+_0xf199('0x97'),_0x28d7c0[_0xf199('0x98')],_0x28d7c0[_0xf199('0x99')]);}else{_0xe09347[_0xf199('0x36')](_0x3908ed['table']+_0xf199('0x9a'),_0x28d7c0[_0xf199('0x98')],_0x28d7c0[_0xf199('0x99')]);}if(_0x115f7c){logger[_0xf199('0x9b')]('Run\x20Query:',_0xe09347['toString']());require(_0xf199('0x9c'))[_0xf199('0x9d')](path[_0xf199('0x52')](__dirname,_0xf199('0x9e'),_0x115f7c['output']),[_0x115f7c['id'],_0xe09347[_0xf199('0x83')](),path['join'](__dirname,_0xf199('0x9f'),_0x115f7c[_0xf199('0xa0')]),_0x4cb440]);return _0x115f7c;}else{var _0x2945de=squel[_0xf199('0xa1')]();_0x2945de[_0xf199('0x6f')]('('+_0xe09347['toString']()+')',_0xf199('0xa2'));_0x2945de[_0xf199('0x67')](_0xf199('0xa3'),_0xf199('0x18'));_0xe09347[_0xf199('0x1a')](_0x28d7c0[_0xf199('0x1a')]||_0x41d425);_0xe09347[_0xf199('0x19')](_0x28d7c0['offset']||0x0);return dbH[_0xf199('0x84')][_0xf199('0x2e')](_0x2945de[_0xf199('0x83')](),{'type':dbH[_0xf199('0x84')][_0xf199('0xa4')][_0xf199('0x85')]})['then'](function(_0x55f192){if(!_0x55f192[_0xf199('0x32')]){_0x1dc561=0x0;}else{_0x1dc561=_0x55f192[0x0][_0xf199('0x18')]||0x0;}return dbH[_0xf199('0x84')]['query'](_0xe09347[_0xf199('0x83')](),{'type':dbH[_0xf199('0x84')][_0xf199('0xa4')][_0xf199('0x85')]});})[_0xf199('0x20')](function(_0x39ca3b){return{'rows':_0x39ca3b||[],'count':_0x1dc561};});}});}exports['run']=function(_0x2c59f7,_0x2bce69){return runReport(_0x2c59f7[_0xf199('0x50')],_0x2c59f7['query'],_0x2c59f7[_0xf199('0x43')])[_0xf199('0x20')](respondWithResult(_0x2bce69,null))[_0xf199('0x40')](handleError(_0x2bce69,null));};exports['runReport']=runReport;exports[_0xf199('0x2e')]=function(_0x405b37,_0x4f93fc){var _0x5c2be1=0xa;var _0x5f535c=[_0xf199('0x52'),_0xf199('0x53'),'right_join',_0xf199('0x54')];var _0x3543bd={'SUM':_0xf199('0x55'),'COUNT':_0xf199('0x56'),'COUNT DISTINCT':_0xf199('0x57'),'MAX':_0xf199('0x58'),'MIN':_0xf199('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf199('0x5b'),'GROUP_CONCAT ASC':_0xf199('0x5c'),'GROUP_CONCAT DESC':_0xf199('0x5d')};var _0x1da110={'SEC_TO_TIME':_0xf199('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf199('0x88')};var _0x3745f4=function(_0x2cb808){return!_['includes']([_0xf199('0x62'),_0xf199('0x63'),_0xf199('0x64'),_0xf199('0x89')],_0x2cb808);};var _0x42dab5=function(_0x1d2327){if(!_0x1d2327||!_0x1d2327['rules']['length']){return'';}for(var _0x13b3c7='(',_0x5cad07=0x0;_0x5cad07<_0x1d2327[_0xf199('0x65')][_0xf199('0x32')];_0x5cad07+=0x1){_0x5cad07>0x0&&(_0x13b3c7+='\x20'+_0x1d2327[_0xf199('0x8a')]+'\x20');_0x13b3c7+=_0x1d2327[_0xf199('0x65')][_0x5cad07][_0xf199('0x66')]?_0x42dab5(_0x1d2327[_0xf199('0x65')][_0x5cad07][_0xf199('0x66')]):_0x1d2327[_0xf199('0x65')][_0x5cad07]['field']+'\x20'+_0x1d2327[_0xf199('0x65')][_0x5cad07][_0xf199('0x68')]+(_0x3745f4(_0x1d2327[_0xf199('0x65')][_0x5cad07][_0xf199('0x68')])?'\x20'+_0x1d2327[_0xf199('0x65')][_0x5cad07][_0xf199('0x8b')]:'');}return _0x13b3c7+')';};var _0x355b7b={'where':{'id':_0x405b37['params']['id']}},_0x1adf60,_0x216b0f,_0x13067b,_0x44e7ab,_0x351749;_0x355b7b=_[_0xf199('0x3a')]({},_0x355b7b,_0x405b37[_0xf199('0x43')]);return db[_0xf199('0x29')][_0xf199('0x44')](_0x355b7b)[_0xf199('0x20')](function(_0x368e11){if(_0x368e11){_0x1adf60=_0x368e11;return _0x368e11[_0xf199('0x69')]();}return null;})['then'](function(_0x41e6f5){if(_0x41e6f5){if(!_0x41e6f5[_0xf199('0x32')]){throw new db['Sequelize'][(_0xf199('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x216b0f=_0x41e6f5;return db['AnalyticMetric'][_0xf199('0x3e')]({'raw':!![]});}return null;})[_0xf199('0x20')](function(_0x3564c8){if(_0x3564c8){_0x13067b=_[_0xf199('0x6e')](_0x3564c8,'id');var _0x225c1e;var _0x506faa=squel[_0xf199('0xa1')]();_0x506faa[_0xf199('0x6f')](_0x1adf60[_0xf199('0x70')]);for(var _0x4bc671=0x0;_0x4bc671<_0x216b0f[_0xf199('0x32')];_0x4bc671+=0x1){_0x225c1e=_0x216b0f[_0x4bc671][_0xf199('0x71')]?_0x13067b[_0x216b0f[_0x4bc671][_0xf199('0x71')]][_0xf199('0x72')]:_0x216b0f[_0x4bc671][_0xf199('0x67')];_0x225c1e=_0x216b0f[_0x4bc671]['function']?_[_0xf199('0x74')](_0x3543bd[_0x216b0f[_0x4bc671][_0xf199('0x73')]],'%s',_0x225c1e):_0x225c1e;_0x225c1e=_0x216b0f[_0x4bc671]['format']?_['replace'](_0x1da110[_0x216b0f[_0x4bc671][_0xf199('0x75')]],'%s',_0x225c1e):_0x225c1e;if(_0x216b0f[_0x4bc671]['groupBy']){_0x506faa[_0xf199('0x66')](_0x225c1e);}_0x216b0f[_0x4bc671][_0xf199('0x77')]&&_0x506faa[_0xf199('0x34')](_0x225c1e,_0x216b0f[_0x4bc671][_0xf199('0x77')]==='DESC'?![]:!![]);_0x506faa[_0xf199('0x67')](_0x225c1e,_0x216b0f[_0x4bc671]['alias']||_0x225c1e);}if(_0x1adf60[_0xf199('0x7a')]){_0x1adf60[_0xf199('0x7a')]=JSON[_0xf199('0x7b')](_0x1adf60[_0xf199('0x7a')]);for(var _0x45a285=0x0;_0x45a285<_0x1adf60[_0xf199('0x7a')][_0xf199('0x32')];_0x45a285+=0x1){if(_0x1adf60[_0xf199('0x7a')][_0x45a285][_0xf199('0x2c')]&&_['includes'](_0x5f535c,_0x1adf60['joins'][_0x45a285][_0xf199('0x2c')])&&_0x1adf60[_0xf199('0x7a')][_0x45a285][_0xf199('0x7c')]&&_0x1adf60[_0xf199('0x7a')][_0x45a285][_0xf199('0x7d')]&&_0x1adf60['joins'][_0x45a285][_0xf199('0x7f')]){_0x506faa[_0x1adf60[_0xf199('0x7a')][_0x45a285][_0xf199('0x2c')]](_0x1adf60[_0xf199('0x7a')][_0x45a285][_0xf199('0x7d')],null,util[_0xf199('0x75')]('%s.%s\x20=\x20%s.%s',_0x1adf60['table'],_0x1adf60['joins'][_0x45a285][_0xf199('0x7c')],_0x1adf60[_0xf199('0x7a')][_0x45a285][_0xf199('0x7d')],_0x1adf60[_0xf199('0x7a')][_0x45a285][_0xf199('0x7f')]));}}}if(_0x1adf60[_0xf199('0x80')]){_0x1adf60[_0xf199('0x80')]=JSON[_0xf199('0x7b')](_0x1adf60[_0xf199('0x80')]);_0x506faa[_0xf199('0x36')](_0x42dab5(_0x1adf60[_0xf199('0x80')]['group']));}_0x351749=_0x506faa['clone']();_0x506faa[_0xf199('0x1a')](_0x5c2be1);_0x506faa[_0xf199('0x19')](0x0);logger['debug']('Limited\x20Query:',_0x506faa[_0xf199('0x83')]());return db[_0xf199('0x84')]['query'](_0x506faa[_0xf199('0x83')](),{'type':db['sequelize'][_0xf199('0xa4')]['SELECT']});}})['then'](function(){return{'sql':_0x351749[_0xf199('0x83')]()};})['then'](respondWithResult(_0x4f93fc,null))[_0xf199('0x40')](handleError(_0x4f93fc,null));}; \ No newline at end of file +var _0x0494=['AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','value','ValidationErrorItem','foreignKey','%s.%s\x20=\x20%s.%s','No\x20available\x20data','web','fullPath','%s-%s.%s','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../files/reports','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','select','html-pdf','eml-format','rimraf','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','role','Reports','UserProfileSection','userProfileId','autoAssociation','destroy','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)'];(function(_0x1aa922,_0x20bd9f){var _0x1acafd=function(_0x22c347){while(--_0x22c347){_0x1aa922['push'](_0x1aa922['shift']());}};_0x1acafd(++_0x20bd9f);}(_0x0494,0xe9));var _0x4049=function(_0x23f67f,_0x1f677c){_0x23f67f=_0x23f67f-0x0;var _0x46aeba=_0x0494[_0x23f67f];return _0x46aeba;};'use strict';var pdf=require(_0x4049('0x0'));var emlformat=require(_0x4049('0x1'));var rimraf=require(_0x4049('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4049('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4049('0x4'));var util=require(_0x4049('0x5'));var path=require(_0x4049('0x6'));var sox=require(_0x4049('0x7'));var csv=require('to-csv');var ejs=require(_0x4049('0x8'));var fs=require('fs');var _=require(_0x4049('0x9'));var squel=require('squel');var crypto=require(_0x4049('0xa'));var jsforce=require(_0x4049('0xb'));var deskjs=require(_0x4049('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4049('0xd'));var Papa=require('papaparse');var Redis=require(_0x4049('0xe'));var authService=require(_0x4049('0xf'));var qs=require(_0x4049('0x10'));var as=require(_0x4049('0x11'));var hardwareService=require(_0x4049('0x12'));var logger=require(_0x4049('0x13'))('api');var utils=require(_0x4049('0x14'));var config=require(_0x4049('0x15'));var db=require(_0x4049('0x16'))['db'];var dbH=require('../../mysqldb')[_0x4049('0x17')];function respondWithStatusCode(_0x2f7874,_0x45b84d){_0x45b84d=_0x45b84d||0xcc;return function(_0x3a2ea6){if(_0x3a2ea6){return _0x2f7874[_0x4049('0x18')](_0x45b84d);}return _0x2f7874['status'](_0x45b84d)[_0x4049('0x19')]();};}function respondWithResult(_0xf67503,_0x4e9127){_0x4e9127=_0x4e9127||0xc8;return function(_0x3b15ae){if(_0x3b15ae){return _0xf67503[_0x4049('0x1a')](_0x4e9127)[_0x4049('0x1b')](_0x3b15ae);}};}function respondWithFilteredResult(_0x21141a,_0x3eb27e){return function(_0x373db9){if(_0x373db9){var _0x43ed29=_0x373db9[_0x4049('0x1c')],_0x199d51=_0x3eb27e[_0x4049('0x1d')],_0x593672=_0x3eb27e[_0x4049('0x1d')]+_0x3eb27e[_0x4049('0x1e')],_0x4237e3;if(_0x593672>=_0x43ed29){_0x593672=_0x43ed29;_0x4237e3=0xc8;}else{_0x4237e3=0xce;}_0x21141a[_0x4049('0x1a')](_0x4237e3);return _0x21141a['set'](_0x4049('0x1f'),_0x199d51+'-'+_0x593672+'/'+_0x43ed29)[_0x4049('0x1b')](_0x373db9);}return null;};}function patchUpdates(_0xdea0b4){return function(_0x1f7bb7){try{jsonpatch[_0x4049('0x20')](_0x1f7bb7,_0xdea0b4,!![]);}catch(_0x1e06dd){return BPromise[_0x4049('0x21')](_0x1e06dd);}return _0x1f7bb7[_0x4049('0x22')]();};}function saveUpdates(_0x283ceb,_0x400ddf){return function(_0x522dcd){if(_0x522dcd){return _0x522dcd[_0x4049('0x23')](_0x283ceb)[_0x4049('0x24')](function(_0x4b82c9){return _0x4b82c9;});}return null;};}function removeEntity(_0x30fe42,_0x46b319){return function(_0x4451c9){if(_0x4451c9){return _0x4451c9['destroy']()[_0x4049('0x24')](function(){var _0x4f35b5=_0x4451c9[_0x4049('0x25')]({'plain':!![]});var _0x1248ca=_0x4049('0x26');return db[_0x4049('0x27')]['destroy']({'where':{'type':_0x1248ca,'resourceId':_0x4f35b5['id']}})['then'](function(){return _0x4451c9;});})[_0x4049('0x24')](function(){_0x30fe42[_0x4049('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x442a36,_0x4bbb24){return function(_0x367e22){if(!_0x367e22){_0x442a36[_0x4049('0x18')](0x194);}return _0x367e22;};}function handleError(_0x10a7e6,_0x1a52a6){_0x1a52a6=_0x1a52a6||0x1f4;return function(_0xb508eb){logger[_0x4049('0x28')](_0xb508eb[_0x4049('0x29')]);if(_0xb508eb[_0x4049('0x2a')]){delete _0xb508eb['name'];}_0x10a7e6[_0x4049('0x1a')](_0x1a52a6)[_0x4049('0x2b')](_0xb508eb);};}exports['index']=function(_0x220835,_0x27ee7f){var _0x46f49f={},_0x509a61={},_0x3213bb={'count':0x0,'rows':[]};var _0x226990=_[_0x4049('0x2c')](db[_0x4049('0x2d')][_0x4049('0x2e')],function(_0x9995de){return{'name':_0x9995de[_0x4049('0x2f')],'type':_0x9995de['type'][_0x4049('0x30')]};});_0x509a61['model']=_[_0x4049('0x2c')](_0x226990,_0x4049('0x2a'));_0x509a61[_0x4049('0x31')]=_['keys'](_0x220835[_0x4049('0x31')]);_0x509a61[_0x4049('0x32')]=_[_0x4049('0x33')](_0x509a61[_0x4049('0x34')],_0x509a61['query']);_0x46f49f[_0x4049('0x35')]=_[_0x4049('0x33')](_0x509a61['model'],qs[_0x4049('0x36')](_0x220835['query'][_0x4049('0x36')]));_0x46f49f[_0x4049('0x35')]=_0x46f49f[_0x4049('0x35')][_0x4049('0x37')]?_0x46f49f[_0x4049('0x35')]:_0x509a61[_0x4049('0x34')];if(!_0x220835[_0x4049('0x31')][_0x4049('0x38')]('nolimit')){_0x46f49f[_0x4049('0x1e')]=qs[_0x4049('0x1e')](_0x220835['query']['limit']);_0x46f49f[_0x4049('0x1d')]=qs[_0x4049('0x1d')](_0x220835[_0x4049('0x31')][_0x4049('0x1d')]);}_0x46f49f[_0x4049('0x39')]=qs[_0x4049('0x3a')](_0x220835[_0x4049('0x31')][_0x4049('0x3a')]);_0x46f49f[_0x4049('0x3b')]=qs['filters'](_['pick'](_0x220835['query'],_0x509a61[_0x4049('0x32')]),_0x226990);if(_0x220835[_0x4049('0x31')][_0x4049('0x3c')]){_0x46f49f[_0x4049('0x3b')]=_['merge'](_0x46f49f[_0x4049('0x3b')],{'$or':_['map'](_0x226990,function(_0x39e529){if(_0x39e529[_0x4049('0x3d')]!==_0x4049('0x3e')){var _0x4d36e1={};_0x4d36e1[_0x39e529['name']]={'$like':'%'+_0x220835['query'][_0x4049('0x3c')]+'%'};return _0x4d36e1;}})});}_0x46f49f=_[_0x4049('0x3f')]({},_0x46f49f,_0x220835[_0x4049('0x40')]);var _0x46d2b3={'where':_0x46f49f[_0x4049('0x3b')]};return db[_0x4049('0x2d')][_0x4049('0x1c')](_0x46d2b3)[_0x4049('0x24')](function(_0x5d9cdf){_0x3213bb[_0x4049('0x1c')]=_0x5d9cdf;if(_0x220835[_0x4049('0x31')][_0x4049('0x41')]){_0x46f49f[_0x4049('0x42')]=[{'all':!![]}];}return db[_0x4049('0x2d')][_0x4049('0x43')](_0x46f49f);})[_0x4049('0x24')](function(_0x240451){_0x3213bb[_0x4049('0x44')]=_0x240451;return _0x3213bb;})[_0x4049('0x24')](respondWithFilteredResult(_0x27ee7f,_0x46f49f))[_0x4049('0x45')](handleError(_0x27ee7f,null));};exports[_0x4049('0x46')]=function(_0x5b8ccf,_0x4ca6f1){var _0x282f3a={'raw':!![],'where':{'id':_0x5b8ccf[_0x4049('0x47')]['id']}},_0x448dc3={};_0x448dc3['model']=_[_0x4049('0x48')](db[_0x4049('0x2d')][_0x4049('0x2e')]);_0x448dc3[_0x4049('0x31')]=_['keys'](_0x5b8ccf['query']);_0x448dc3[_0x4049('0x32')]=_[_0x4049('0x33')](_0x448dc3[_0x4049('0x34')],_0x448dc3[_0x4049('0x31')]);_0x282f3a[_0x4049('0x35')]=_['intersection'](_0x448dc3['model'],qs[_0x4049('0x36')](_0x5b8ccf['query'][_0x4049('0x36')]));_0x282f3a['attributes']=_0x282f3a[_0x4049('0x35')][_0x4049('0x37')]?_0x282f3a[_0x4049('0x35')]:_0x448dc3[_0x4049('0x34')];if(_0x5b8ccf[_0x4049('0x31')]['includeAll']){_0x282f3a['include']=[{'all':!![]}];}_0x282f3a=_['merge']({},_0x282f3a,_0x5b8ccf['options']);return db['AnalyticDefaultReport'][_0x4049('0x49')](_0x282f3a)[_0x4049('0x24')](handleEntityNotFound(_0x4ca6f1,null))[_0x4049('0x24')](respondWithResult(_0x4ca6f1,null))[_0x4049('0x45')](handleError(_0x4ca6f1,null));};exports[_0x4049('0x4a')]=function(_0x5aacb0,_0x4affdd){return db[_0x4049('0x2d')][_0x4049('0x4a')](_0x5aacb0[_0x4049('0x4b')],{})['then'](function(_0x376693){var _0x38b94d=_0x5aacb0['user'][_0x4049('0x25')]({'plain':!![]});if(!_0x38b94d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38b94d[_0x4049('0x4c')]==='user'){var _0x25442a=_0x376693[_0x4049('0x25')]({'plain':!![]});var _0x59df1f=_0x4049('0x4d');return db[_0x4049('0x4e')][_0x4049('0x49')]({'where':{'name':_0x59df1f,'userProfileId':_0x38b94d[_0x4049('0x4f')]},'raw':!![]})[_0x4049('0x24')](function(_0x3693c4){if(_0x3693c4&&_0x3693c4[_0x4049('0x50')]===0x0){return db[_0x4049('0x27')][_0x4049('0x4a')]({'name':_0x25442a[_0x4049('0x2a')],'resourceId':_0x25442a['id'],'type':'DefaultReports','sectionId':_0x3693c4['id']},{})[_0x4049('0x24')](function(){return _0x376693;});}else{return _0x376693;}})['catch'](function(_0x4b1e5d){logger[_0x4049('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1e5d);throw _0x4b1e5d;});}return _0x376693;})[_0x4049('0x24')](respondWithResult(_0x4affdd,0xc9))[_0x4049('0x45')](handleError(_0x4affdd,null));};exports[_0x4049('0x23')]=function(_0x1d1131,_0x5cb63){if(_0x1d1131[_0x4049('0x4b')]['id']){delete _0x1d1131[_0x4049('0x4b')]['id'];}return db[_0x4049('0x2d')]['find']({'where':{'id':_0x1d1131[_0x4049('0x47')]['id']}})[_0x4049('0x24')](handleEntityNotFound(_0x5cb63,null))['then'](saveUpdates(_0x1d1131['body'],null))[_0x4049('0x24')](respondWithResult(_0x5cb63,null))[_0x4049('0x45')](handleError(_0x5cb63,null));};exports[_0x4049('0x51')]=function(_0x5a458e,_0xf4ecca){return db[_0x4049('0x2d')][_0x4049('0x49')]({'where':{'id':_0x5a458e[_0x4049('0x47')]['id']}})['then'](handleEntityNotFound(_0xf4ecca,null))[_0x4049('0x24')](removeEntity(_0xf4ecca,null))[_0x4049('0x45')](handleError(_0xf4ecca,null));};exports[_0x4049('0x52')]=function(_0x5ca435,_0x11c5a2){var _0x5c4435=0xa;var _0x2f0246=[_0x4049('0x53'),_0x4049('0x54'),_0x4049('0x55'),_0x4049('0x56')];var _0x302e2e={'SUM':_0x4049('0x57'),'COUNT':_0x4049('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4049('0x59'),'MIN':_0x4049('0x5a'),'AVG':_0x4049('0x5b'),'GROUP_CONCAT':_0x4049('0x5c'),'GROUP_CONCAT ASC':_0x4049('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x55c209={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4049('0x5e'),'HOUR':_0x4049('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2f8256=function(_0x2a72f5){return!_['includes'](['IS\x20NULL',_0x4049('0x60'),_0x4049('0x61'),_0x4049('0x62')],_0x2a72f5);};var _0x7c4586=function(_0x5bf48a){if(!_0x5bf48a||!_0x5bf48a['rules'][_0x4049('0x37')]){return'';}for(var _0x345bf5='(',_0x5f2480=0x0;_0x5f2480<_0x5bf48a[_0x4049('0x63')][_0x4049('0x37')];_0x5f2480+=0x1){_0x5f2480>0x0&&(_0x345bf5+='\x20'+_0x5bf48a['operator']+'\x20');_0x345bf5+=_0x5bf48a[_0x4049('0x63')][_0x5f2480][_0x4049('0x64')]?_0x7c4586(_0x5bf48a[_0x4049('0x63')][_0x5f2480][_0x4049('0x64')]):_0x5bf48a[_0x4049('0x63')][_0x5f2480][_0x4049('0x65')]+'\x20'+_0x5bf48a[_0x4049('0x63')][_0x5f2480]['condition']+(_0x2f8256(_0x5bf48a[_0x4049('0x63')][_0x5f2480][_0x4049('0x66')])?'\x20'+_0x5bf48a[_0x4049('0x63')][_0x5f2480]['value']:'');}return _0x345bf5+')';};var _0x20bdfa={'where':{'id':_0x5ca435[_0x4049('0x47')]['id']}},_0x599e88,_0x559bbb,_0x187026,_0x200fe3,_0x43bd13;_0x20bdfa=_[_0x4049('0x3f')]({},_0x20bdfa,_0x5ca435[_0x4049('0x40')]);return db[_0x4049('0x2d')]['find'](_0x20bdfa)[_0x4049('0x24')](function(_0x1a0a9e){if(_0x1a0a9e){_0x599e88=_0x1a0a9e;return _0x1a0a9e[_0x4049('0x67')]();}return null;})[_0x4049('0x24')](function(_0x21772d){if(_0x21772d){if(!_0x21772d['length']){throw new db[(_0x4049('0x68'))]['ValidationErrorItem'](_0x4049('0x69'),0x193);}_0x559bbb=_0x21772d;return db[_0x4049('0x6a')][_0x4049('0x43')]({'raw':!![]});}return null;})['then'](function(_0x5171ef){if(_0x5171ef){_0x187026=_[_0x4049('0x6b')](_0x5171ef,'id');var _0x3c7319;var _0x13555d=squel['select']();_0x13555d[_0x4049('0x6c')](_0x599e88[_0x4049('0x6d')]);for(var _0x324766=0x0;_0x324766<_0x559bbb[_0x4049('0x37')];_0x324766+=0x1){_0x3c7319=_0x559bbb[_0x324766][_0x4049('0x6e')]?_0x187026[_0x559bbb[_0x324766]['MetricId']][_0x4049('0x6f')]:_0x559bbb[_0x324766][_0x4049('0x65')];_0x3c7319=_0x559bbb[_0x324766]['function']?_[_0x4049('0x70')](_0x302e2e[_0x559bbb[_0x324766][_0x4049('0x71')]],'%s',_0x3c7319):_0x3c7319;_0x3c7319=_0x559bbb[_0x324766][_0x4049('0x72')]?_[_0x4049('0x70')](_0x55c209[_0x559bbb[_0x324766][_0x4049('0x72')]],'%s',_0x3c7319):_0x3c7319;if(_0x559bbb[_0x324766][_0x4049('0x73')]){_0x13555d[_0x4049('0x64')](_0x3c7319);}_0x559bbb[_0x324766][_0x4049('0x74')]&&_0x13555d[_0x4049('0x39')](_0x3c7319,_0x559bbb[_0x324766][_0x4049('0x74')]===_0x4049('0x75')?![]:!![]);_0x13555d[_0x4049('0x65')](_0x3c7319,_0x559bbb[_0x324766][_0x4049('0x76')]||_0x3c7319);}if(_0x599e88[_0x4049('0x77')]){_0x599e88[_0x4049('0x77')]=JSON[_0x4049('0x78')](_0x599e88[_0x4049('0x77')]);for(var _0x4430e2=0x0;_0x4430e2<_0x599e88[_0x4049('0x77')][_0x4049('0x37')];_0x4430e2+=0x1){if(_0x599e88[_0x4049('0x77')][_0x4430e2][_0x4049('0x3d')]&&_[_0x4049('0x79')](_0x2f0246,_0x599e88['joins'][_0x4430e2][_0x4049('0x3d')])&&_0x599e88[_0x4049('0x77')][_0x4430e2][_0x4049('0x7a')]&&_0x599e88[_0x4049('0x77')][_0x4430e2][_0x4049('0x7b')]&&_0x599e88[_0x4049('0x77')][_0x4430e2]['foreignKey']){_0x13555d[_0x599e88[_0x4049('0x77')][_0x4430e2][_0x4049('0x3d')]](_0x599e88[_0x4049('0x77')][_0x4430e2]['foreignTable'],null,util[_0x4049('0x72')]('%s.%s\x20=\x20%s.%s',_0x599e88['table'],_0x599e88[_0x4049('0x77')][_0x4430e2][_0x4049('0x7a')],_0x599e88[_0x4049('0x77')][_0x4430e2][_0x4049('0x7b')],_0x599e88[_0x4049('0x77')][_0x4430e2]['foreignKey']));}}}if(_0x599e88[_0x4049('0x7c')]){_0x599e88['conditions']=JSON[_0x4049('0x78')](_0x599e88[_0x4049('0x7c')]);_0x13555d[_0x4049('0x3b')](_0x7c4586(_0x599e88[_0x4049('0x7c')][_0x4049('0x64')]));}_0x43bd13=_0x13555d[_0x4049('0x7d')]();_0x13555d['limit'](_0x5c4435);_0x13555d[_0x4049('0x1d')](0x0);logger[_0x4049('0x7e')](_0x4049('0x7f'),_0x13555d[_0x4049('0x80')]());return db['sequelize'][_0x4049('0x31')](_0x13555d[_0x4049('0x80')](),{'type':db[_0x4049('0x81')][_0x4049('0x82')][_0x4049('0x83')]});}})[_0x4049('0x24')](respondWithResult(_0x11c5a2,null))[_0x4049('0x45')](handleError(_0x11c5a2,null));};function runReport(_0x25f64f,_0x3f9a9c,_0x1742c2){var _0x41c745=_0x3f9a9c[_0x4049('0x2a')];var _0x11d21a=0xa;var _0x1b843d=[_0x4049('0x53'),'left_join',_0x4049('0x55'),_0x4049('0x56')];var _0x26111f={'SUM':_0x4049('0x57'),'COUNT':_0x4049('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4049('0x59'),'MIN':_0x4049('0x5a'),'AVG':_0x4049('0x5b'),'GROUP_CONCAT':_0x4049('0x5c'),'GROUP_CONCAT ASC':_0x4049('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x20d106={'SEC_TO_TIME':_0x4049('0x84'),'DATE':_0x4049('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x4049('0x85'),'UNIX_TIMESTAMP':_0x4049('0x86')};var _0x39181c=function(_0x23484b){return!_[_0x4049('0x79')]([_0x4049('0x87'),'IS\x20NOT\x20NULL',_0x4049('0x61'),_0x4049('0x62')],_0x23484b);};var _0x3f47cb=function(_0x353200){if(!_0x353200||!_0x353200[_0x4049('0x63')][_0x4049('0x37')]){return'';}for(var _0x1794b0='(',_0x4a7dbc=0x0;_0x4a7dbc<_0x353200['rules'][_0x4049('0x37')];_0x4a7dbc+=0x1){_0x4a7dbc>0x0&&(_0x1794b0+='\x20'+_0x353200['operator']+'\x20');_0x1794b0+=_0x353200[_0x4049('0x63')][_0x4a7dbc][_0x4049('0x64')]?_0x3f47cb(_0x353200[_0x4049('0x63')][_0x4a7dbc]['group']):_0x353200[_0x4049('0x63')][_0x4a7dbc][_0x4049('0x65')]+'\x20'+_0x353200[_0x4049('0x63')][_0x4a7dbc][_0x4049('0x66')]+(_0x39181c(_0x353200[_0x4049('0x63')][_0x4a7dbc][_0x4049('0x66')])?'\x20'+_0x353200['rules'][_0x4a7dbc][_0x4049('0x88')]:'');}return _0x1794b0+')';};var _0x57c329={'where':{'id':_0x25f64f['id']}},_0x377dc5,_0x21ad8d,_0x4a71f0,_0xa17e63,_0x5140bb;_0x57c329=_[_0x4049('0x3f')]({},_0x57c329,_0x1742c2);return db[_0x4049('0x2d')]['find'](_0x57c329)['then'](function(_0xd44321){if(_0xd44321){_0x377dc5=_0xd44321;return _0xd44321[_0x4049('0x67')]();}return null;})[_0x4049('0x24')](function(_0x330a82){if(_0x330a82){if(!_0x330a82['length']){throw new db['Sequelize'][(_0x4049('0x89'))](_0x4049('0x69'),0x193);}_0x21ad8d=_0x330a82;return db[_0x4049('0x6a')][_0x4049('0x43')]({'raw':!![]});}return null;})['then'](function(_0x45368c){if(_0x45368c){_0x4a71f0=_[_0x4049('0x6b')](_0x45368c,'id');var _0x5a768b;var _0x1619f1=squel['select']();_0x1619f1[_0x4049('0x6c')](_0x377dc5['table']);for(var _0x31628f=0x0;_0x31628f<_0x21ad8d[_0x4049('0x37')];_0x31628f+=0x1){_0x5a768b=_0x21ad8d[_0x31628f][_0x4049('0x6e')]?_0x4a71f0[_0x21ad8d[_0x31628f][_0x4049('0x6e')]]['metric']:_0x21ad8d[_0x31628f][_0x4049('0x65')];_0x5a768b=_0x21ad8d[_0x31628f][_0x4049('0x71')]?_['replace'](_0x26111f[_0x21ad8d[_0x31628f][_0x4049('0x71')]],'%s',_0x5a768b):_0x5a768b;_0x5a768b=_0x21ad8d[_0x31628f][_0x4049('0x72')]?_[_0x4049('0x70')](_0x20d106[_0x21ad8d[_0x31628f]['format']],'%s',_0x5a768b):_0x5a768b;if(_0x21ad8d[_0x31628f][_0x4049('0x73')]){_0x1619f1[_0x4049('0x64')](_0x5a768b);}_0x21ad8d[_0x31628f][_0x4049('0x74')]&&_0x1619f1[_0x4049('0x39')](_0x5a768b,_0x21ad8d[_0x31628f][_0x4049('0x74')]==='DESC'?![]:!![]);_0x1619f1[_0x4049('0x65')](_0x5a768b,_0x21ad8d[_0x31628f][_0x4049('0x76')]||_0x5a768b);}if(_0x377dc5[_0x4049('0x77')]){_0x377dc5['joins']=JSON['parse'](_0x377dc5[_0x4049('0x77')]);for(var _0x3f8562=0x0;_0x3f8562<_0x377dc5['joins'][_0x4049('0x37')];_0x3f8562+=0x1){if(_0x377dc5['joins'][_0x3f8562][_0x4049('0x3d')]&&_['includes'](_0x1b843d,_0x377dc5[_0x4049('0x77')][_0x3f8562]['type'])&&_0x377dc5['joins'][_0x3f8562][_0x4049('0x7a')]&&_0x377dc5[_0x4049('0x77')][_0x3f8562]['foreignTable']&&_0x377dc5[_0x4049('0x77')][_0x3f8562][_0x4049('0x8a')]){_0x1619f1[_0x377dc5[_0x4049('0x77')][_0x3f8562][_0x4049('0x3d')]](_0x377dc5[_0x4049('0x77')][_0x3f8562]['foreignTable'],null,util[_0x4049('0x72')](_0x4049('0x8b'),_0x377dc5[_0x4049('0x6d')],_0x377dc5['joins'][_0x3f8562][_0x4049('0x7a')],_0x377dc5[_0x4049('0x77')][_0x3f8562][_0x4049('0x7b')],_0x377dc5[_0x4049('0x77')][_0x3f8562]['foreignKey']));}}}if(_0x377dc5[_0x4049('0x7c')]){_0x377dc5['conditions']=JSON['parse'](_0x377dc5[_0x4049('0x7c')]);_0x1619f1[_0x4049('0x3b')](_0x3f47cb(_0x377dc5[_0x4049('0x7c')]['group']));}_0x5140bb=_0x1619f1['clone']();_0x1619f1[_0x4049('0x1e')](_0x11d21a);_0x1619f1[_0x4049('0x1d')](0x0);logger[_0x4049('0x7e')](_0x4049('0x7f'),_0x1619f1[_0x4049('0x80')]());return db['sequelize']['query'](_0x1619f1[_0x4049('0x80')](),{'type':db[_0x4049('0x81')][_0x4049('0x82')]['SELECT']});}})[_0x4049('0x24')](function(_0x2206f5){if(!_0x2206f5[_0x4049('0x37')]){throw new db[(_0x4049('0x68'))][(_0x4049('0x89'))](_0x4049('0x8c'),0xcc);}if(_0x3f9a9c['output']===_0x4049('0x8d')){return null;}var _0x2af36a=_['merge'](_0x3f9a9c,{'name':_0x3f9a9c[_0x4049('0x8e')]||_0x3f9a9c[_0x4049('0x2a')]||_0x377dc5[_0x4049('0x2a')],'basename':_0x41c745,'savename':util[_0x4049('0x72')](_0x4049('0x8f'),_0x3f9a9c[_0x4049('0x2a')]||_0x377dc5[_0x4049('0x2a')],require('randomstring')[_0x4049('0x90')](0x4),_0x3f9a9c[_0x4049('0x91')]||'csv'),'reportId':_0x377dc5['id'],'reportType':_0x4049('0x92')});return db[_0x4049('0x93')][_0x4049('0x4a')](_0x2af36a,{'raw':!![]});})['then'](function(_0x3d0e21){if(_0x377dc5['table']===_0x4049('0x94')){_0x5140bb[_0x4049('0x3b')](_0x377dc5[_0x4049('0x6d')]+_0x4049('0x95'),_0x3f9a9c[_0x4049('0x96')],_0x3f9a9c[_0x4049('0x97')]);}else{_0x5140bb[_0x4049('0x3b')](_0x377dc5[_0x4049('0x6d')]+_0x4049('0x98'),_0x3f9a9c[_0x4049('0x96')],_0x3f9a9c['endDate']);}if(_0x3d0e21){logger[_0x4049('0x99')](_0x4049('0x9a'),_0x5140bb[_0x4049('0x80')]());require(_0x4049('0x9b'))['fork'](path[_0x4049('0x53')](__dirname,'../../components/export/',_0x3d0e21[_0x4049('0x91')]),[_0x3d0e21['id'],_0x5140bb[_0x4049('0x80')](),path[_0x4049('0x53')](__dirname,_0x4049('0x9c'),_0x3d0e21['savename']),_0x41c745]);return _0x3d0e21;}else{var _0x11d40f=squel['select']();_0x11d40f[_0x4049('0x6c')]('('+_0x5140bb[_0x4049('0x80')]()+')','countTable');_0x11d40f['field'](_0x4049('0x9d'),_0x4049('0x1c'));_0x5140bb[_0x4049('0x1e')](_0x3f9a9c['limit']||_0x11d21a);_0x5140bb[_0x4049('0x1d')](_0x3f9a9c[_0x4049('0x1d')]||0x0);return dbH[_0x4049('0x81')]['query'](_0x11d40f[_0x4049('0x80')](),{'type':dbH[_0x4049('0x81')][_0x4049('0x82')]['SELECT']})[_0x4049('0x24')](function(_0x257b50){if(!_0x257b50[_0x4049('0x37')]){_0xa17e63=0x0;}else{_0xa17e63=_0x257b50[0x0][_0x4049('0x1c')]||0x0;}return dbH[_0x4049('0x81')][_0x4049('0x31')](_0x5140bb[_0x4049('0x80')](),{'type':dbH[_0x4049('0x81')][_0x4049('0x82')][_0x4049('0x83')]});})[_0x4049('0x24')](function(_0x1df1b3){return{'rows':_0x1df1b3||[],'count':_0xa17e63};});}});}exports[_0x4049('0x9e')]=function(_0x4bda03,_0x1999f4){return runReport(_0x4bda03[_0x4049('0x47')],_0x4bda03[_0x4049('0x31')],_0x4bda03[_0x4049('0x40')])['then'](respondWithResult(_0x1999f4,null))[_0x4049('0x45')](handleError(_0x1999f4,null));};exports[_0x4049('0x9f')]=runReport;exports['query']=function(_0xc5658,_0x4c4b40){var _0x479829=0xa;var _0x5d9b8f=[_0x4049('0x53'),'left_join',_0x4049('0x55'),_0x4049('0x56')];var _0x5c26be={'SUM':_0x4049('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4049('0x59'),'MIN':_0x4049('0x5a'),'AVG':_0x4049('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x4049('0x5d'),'GROUP_CONCAT DESC':_0x4049('0xa0')};var _0x3abd98={'SEC_TO_TIME':_0x4049('0x84'),'DATE':_0x4049('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x4049('0x85'),'UNIX_TIMESTAMP':_0x4049('0x86')};var _0x408422=function(_0x509bab){return!_[_0x4049('0x79')]([_0x4049('0x87'),'IS\x20NOT\x20NULL',_0x4049('0x61'),_0x4049('0x62')],_0x509bab);};var _0x55741d=function(_0x5d3e7f){if(!_0x5d3e7f||!_0x5d3e7f[_0x4049('0x63')][_0x4049('0x37')]){return'';}for(var _0x3f306f='(',_0x2eb311=0x0;_0x2eb311<_0x5d3e7f['rules']['length'];_0x2eb311+=0x1){_0x2eb311>0x0&&(_0x3f306f+='\x20'+_0x5d3e7f['operator']+'\x20');_0x3f306f+=_0x5d3e7f[_0x4049('0x63')][_0x2eb311][_0x4049('0x64')]?_0x55741d(_0x5d3e7f[_0x4049('0x63')][_0x2eb311]['group']):_0x5d3e7f[_0x4049('0x63')][_0x2eb311][_0x4049('0x65')]+'\x20'+_0x5d3e7f[_0x4049('0x63')][_0x2eb311][_0x4049('0x66')]+(_0x408422(_0x5d3e7f[_0x4049('0x63')][_0x2eb311][_0x4049('0x66')])?'\x20'+_0x5d3e7f[_0x4049('0x63')][_0x2eb311][_0x4049('0x88')]:'');}return _0x3f306f+')';};var _0x1548c3={'where':{'id':_0xc5658['params']['id']}},_0x5631c6,_0x34341b,_0x943300,_0xbb275c,_0x5cffa7;_0x1548c3=_[_0x4049('0x3f')]({},_0x1548c3,_0xc5658[_0x4049('0x40')]);return db[_0x4049('0x2d')][_0x4049('0x49')](_0x1548c3)['then'](function(_0x50bcbf){if(_0x50bcbf){_0x5631c6=_0x50bcbf;return _0x50bcbf[_0x4049('0x67')]();}return null;})[_0x4049('0x24')](function(_0x4a83a4){if(_0x4a83a4){if(!_0x4a83a4[_0x4049('0x37')]){throw new db[(_0x4049('0x68'))][(_0x4049('0x89'))](_0x4049('0x69'),0x193);}_0x34341b=_0x4a83a4;return db[_0x4049('0x6a')][_0x4049('0x43')]({'raw':!![]});}return null;})['then'](function(_0x49e4c1){if(_0x49e4c1){_0x943300=_[_0x4049('0x6b')](_0x49e4c1,'id');var _0x2ca199;var _0x1def0d=squel[_0x4049('0xa1')]();_0x1def0d[_0x4049('0x6c')](_0x5631c6[_0x4049('0x6d')]);for(var _0x1d5def=0x0;_0x1d5def<_0x34341b[_0x4049('0x37')];_0x1d5def+=0x1){_0x2ca199=_0x34341b[_0x1d5def][_0x4049('0x6e')]?_0x943300[_0x34341b[_0x1d5def][_0x4049('0x6e')]]['metric']:_0x34341b[_0x1d5def][_0x4049('0x65')];_0x2ca199=_0x34341b[_0x1d5def][_0x4049('0x71')]?_[_0x4049('0x70')](_0x5c26be[_0x34341b[_0x1d5def][_0x4049('0x71')]],'%s',_0x2ca199):_0x2ca199;_0x2ca199=_0x34341b[_0x1d5def]['format']?_[_0x4049('0x70')](_0x3abd98[_0x34341b[_0x1d5def][_0x4049('0x72')]],'%s',_0x2ca199):_0x2ca199;if(_0x34341b[_0x1d5def][_0x4049('0x73')]){_0x1def0d[_0x4049('0x64')](_0x2ca199);}_0x34341b[_0x1d5def]['orderBy']&&_0x1def0d[_0x4049('0x39')](_0x2ca199,_0x34341b[_0x1d5def][_0x4049('0x74')]===_0x4049('0x75')?![]:!![]);_0x1def0d[_0x4049('0x65')](_0x2ca199,_0x34341b[_0x1d5def][_0x4049('0x76')]||_0x2ca199);}if(_0x5631c6['joins']){_0x5631c6[_0x4049('0x77')]=JSON[_0x4049('0x78')](_0x5631c6[_0x4049('0x77')]);for(var _0x5f50a7=0x0;_0x5f50a7<_0x5631c6[_0x4049('0x77')]['length'];_0x5f50a7+=0x1){if(_0x5631c6[_0x4049('0x77')][_0x5f50a7][_0x4049('0x3d')]&&_[_0x4049('0x79')](_0x5d9b8f,_0x5631c6['joins'][_0x5f50a7][_0x4049('0x3d')])&&_0x5631c6[_0x4049('0x77')][_0x5f50a7][_0x4049('0x7a')]&&_0x5631c6[_0x4049('0x77')][_0x5f50a7][_0x4049('0x7b')]&&_0x5631c6[_0x4049('0x77')][_0x5f50a7][_0x4049('0x8a')]){_0x1def0d[_0x5631c6[_0x4049('0x77')][_0x5f50a7][_0x4049('0x3d')]](_0x5631c6['joins'][_0x5f50a7]['foreignTable'],null,util[_0x4049('0x72')](_0x4049('0x8b'),_0x5631c6['table'],_0x5631c6[_0x4049('0x77')][_0x5f50a7]['parentKey'],_0x5631c6['joins'][_0x5f50a7][_0x4049('0x7b')],_0x5631c6[_0x4049('0x77')][_0x5f50a7]['foreignKey']));}}}if(_0x5631c6[_0x4049('0x7c')]){_0x5631c6[_0x4049('0x7c')]=JSON[_0x4049('0x78')](_0x5631c6[_0x4049('0x7c')]);_0x1def0d[_0x4049('0x3b')](_0x55741d(_0x5631c6[_0x4049('0x7c')][_0x4049('0x64')]));}_0x5cffa7=_0x1def0d[_0x4049('0x7d')]();_0x1def0d[_0x4049('0x1e')](_0x479829);_0x1def0d['offset'](0x0);logger[_0x4049('0x7e')](_0x4049('0x7f'),_0x1def0d[_0x4049('0x80')]());return db['sequelize'][_0x4049('0x31')](_0x1def0d[_0x4049('0x80')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x5cffa7['toString']()};})['then'](respondWithResult(_0x4c4b40,null))[_0x4049('0x45')](handleError(_0x4c4b40,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 07bdc46..0b7dd32 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 _0xc9df=['AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','exports','define'];(function(_0x3a70e4,_0x5fafbd){var _0xc2f996=function(_0x3d9417){while(--_0x3d9417){_0x3a70e4['push'](_0x3a70e4['shift']());}};_0xc2f996(++_0x5fafbd);}(_0xc9df,0x121));var _0xfc9d=function(_0x2e1631,_0x46d512){_0x2e1631=_0x2e1631-0x0;var _0x1d19b0=_0xc9df[_0x2e1631];return _0x1d19b0;};'use strict';var _=require('lodash');var util=require(_0xfc9d('0x0'));var logger=require(_0xfc9d('0x1'))(_0xfc9d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xfc9d('0x3')]=function(_0x190cc1,_0x2e7243){return _0x190cc1[_0xfc9d('0x4')](_0xfc9d('0x5'),attributes,{'tableName':_0xfc9d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07c2=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_default_reports','lodash'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0x07c2,0xf1));var _0x207c=function(_0x2de41e,_0x12a7dc){_0x2de41e=_0x2de41e-0x0;var _0x2e70d1=_0x07c2[_0x2de41e];return _0x2e70d1;};'use strict';var _=require(_0x207c('0x0'));var util=require('util');var logger=require(_0x207c('0x1'))('api');var moment=require(_0x207c('0x2'));var BPromise=require(_0x207c('0x3'));var rp=require(_0x207c('0x4'));var fs=require('fs');var path=require(_0x207c('0x5'));var rimraf=require(_0x207c('0x6'));var config=require(_0x207c('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x207c('0x8')]=function(_0x4309ce,_0x40db91){return _0x4309ce[_0x207c('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x207c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 8d12ef5..1b82179 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 _0xceb0=['../../config/logger','jayson/promise','client','http','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','randomstring','../../mysqldb','../../config/utils'];(function(_0x51e4fd,_0x5d516d){var _0x31e443=function(_0x37a5c2){while(--_0x37a5c2){_0x51e4fd['push'](_0x51e4fd['shift']());}};_0x31e443(++_0x5d516d);}(_0xceb0,0x173));var _0x0ceb=function(_0x5e6e88,_0x3dbe7e){_0x5e6e88=_0x5e6e88-0x0;var _0x2eb510=_0xceb0[_0x5e6e88];return _0x2eb510;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0ceb('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ceb('0x1'))['db'];var utils=require(_0x0ceb('0x2'));var logger=require(_0x0ceb('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0ceb('0x4'));var client=jayson[_0x0ceb('0x5')][_0x0ceb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52e6bb,_0x448bf8,_0x19e438){return new BPromise(function(_0x4ec03a,_0x9e53b7){return client['request'](_0x52e6bb,_0x19e438)[_0x0ceb('0x7')](function(_0x3e71f4){logger[_0x0ceb('0x8')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x448bf8,'request\x20sent');logger[_0x0ceb('0x9')](_0x0ceb('0xa'),_0x448bf8,_0x0ceb('0xb'),JSON[_0x0ceb('0xc')](_0x3e71f4));if(_0x3e71f4[_0x0ceb('0xd')]){if(_0x3e71f4[_0x0ceb('0xd')]['code']===0x1f4){logger[_0x0ceb('0xd')](_0x0ceb('0xe'),_0x448bf8,_0x3e71f4[_0x0ceb('0xd')][_0x0ceb('0xf')]);return _0x9e53b7(_0x3e71f4[_0x0ceb('0xd')][_0x0ceb('0xf')]);}logger[_0x0ceb('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x448bf8,_0x3e71f4[_0x0ceb('0xd')]['message']);return _0x4ec03a(_0x3e71f4['error'][_0x0ceb('0xf')]);}else{logger[_0x0ceb('0x8')](_0x0ceb('0xe'),_0x448bf8,'request\x20sent');_0x4ec03a(_0x3e71f4[_0x0ceb('0x10')][_0x0ceb('0xf')]);}})['catch'](function(_0x1dc6f5){logger[_0x0ceb('0xd')](_0x0ceb('0xe'),_0x448bf8,_0x1dc6f5);_0x9e53b7(_0x1dc6f5);});});} \ No newline at end of file +var _0x1094=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x1094,0x143));var _0x4109=function(_0x368c85,_0x586b0a){_0x368c85=_0x368c85-0x0;var _0x3477c2=_0x1094[_0x368c85];return _0x3477c2;};'use strict';var _=require(_0x4109('0x0'));var util=require(_0x4109('0x1'));var moment=require('moment');var BPromise=require(_0x4109('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4109('0x3'));var db=require(_0x4109('0x4'))['db'];var utils=require(_0x4109('0x5'));var logger=require(_0x4109('0x6'))(_0x4109('0x7'));var config=require('../../config/environment');var jayson=require(_0x4109('0x8'));var client=jayson[_0x4109('0x9')][_0x4109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c3e9,_0xd2df16,_0x2c34f){return new BPromise(function(_0x5512e8,_0x5b4ecf){return client[_0x4109('0xb')](_0x36c3e9,_0x2c34f)[_0x4109('0xc')](function(_0x2fa1d8){logger[_0x4109('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xd2df16,'request\x20sent');logger[_0x4109('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xd2df16,_0x4109('0xf'),JSON[_0x4109('0x10')](_0x2fa1d8));if(_0x2fa1d8[_0x4109('0x11')]){if(_0x2fa1d8['error'][_0x4109('0x12')]===0x1f4){logger[_0x4109('0x11')](_0x4109('0x13'),_0xd2df16,_0x2fa1d8[_0x4109('0x11')][_0x4109('0x14')]);return _0x5b4ecf(_0x2fa1d8['error'][_0x4109('0x14')]);}logger[_0x4109('0x11')](_0x4109('0x13'),_0xd2df16,_0x2fa1d8[_0x4109('0x11')]['message']);return _0x5512e8(_0x2fa1d8['error'][_0x4109('0x14')]);}else{logger[_0x4109('0xd')](_0x4109('0x13'),_0xd2df16,_0x4109('0xf'));_0x5512e8(_0x2fa1d8[_0x4109('0x15')][_0x4109('0x14')]);}})[_0x4109('0x16')](function(_0x3c6542){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xd2df16,_0x3c6542);_0x5b4ecf(_0x3c6542);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ddfd561..9b491b4 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 _0x7edf=['Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x263600,_0x25c5a0){var _0x2aced2=function(_0x4ca1d1){while(--_0x4ca1d1){_0x263600['push'](_0x263600['shift']());}};_0x2aced2(++_0x25c5a0);}(_0x7edf,0x92));var _0xf7ed=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x7edf[_0x3a0863];return _0x85c557;};'use strict';var multer=require('multer');var util=require(_0xf7ed('0x0'));var path=require(_0xf7ed('0x1'));var timeout=require(_0xf7ed('0x2'));var express=require(_0xf7ed('0x3'));var router=express[_0xf7ed('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf7ed('0x5'));var config=require(_0xf7ed('0x6'));var controller=require(_0xf7ed('0x7'));router[_0xf7ed('0x8')]('/',auth[_0xf7ed('0x9')](),controller[_0xf7ed('0xa')]);router[_0xf7ed('0x8')]('/:id',auth[_0xf7ed('0x9')](),controller[_0xf7ed('0xb')]);router['get'](_0xf7ed('0xc'),auth['isAuthenticated'](),controller[_0xf7ed('0xd')]);router[_0xf7ed('0x8')](_0xf7ed('0xe'),auth['isAuthenticated'](),controller[_0xf7ed('0xf')]);router['get'](_0xf7ed('0x10'),auth['isAuthenticated'](),controller['query']);router[_0xf7ed('0x11')]('/',auth[_0xf7ed('0x9')](),controller[_0xf7ed('0x12')]);router[_0xf7ed('0x13')](_0xf7ed('0x14'),auth['isAuthenticated'](),controller[_0xf7ed('0x15')]);router[_0xf7ed('0x16')](_0xf7ed('0x14'),auth[_0xf7ed('0x9')](),controller[_0xf7ed('0x17')]);module[_0xf7ed('0x18')]=router; \ No newline at end of file +var _0xbdf2=['post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','preview','/:id/run','/:id/query'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xbdf2,0xf8));var _0x2bdf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbdf2[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x2bdf('0x0'));var util=require(_0x2bdf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2bdf('0x2'));var router=express[_0x2bdf('0x3')]();var auth=require(_0x2bdf('0x4'));var interaction=require(_0x2bdf('0x5'));var config=require(_0x2bdf('0x6'));var controller=require(_0x2bdf('0x7'));router[_0x2bdf('0x8')]('/',auth['isAuthenticated'](),controller[_0x2bdf('0x9')]);router[_0x2bdf('0x8')](_0x2bdf('0xa'),auth[_0x2bdf('0xb')](),controller[_0x2bdf('0xc')]);router[_0x2bdf('0x8')]('/:id/preview',auth[_0x2bdf('0xb')](),controller[_0x2bdf('0xd')]);router[_0x2bdf('0x8')](_0x2bdf('0xe'),auth['isAuthenticated'](),controller['run']);router[_0x2bdf('0x8')](_0x2bdf('0xf'),auth[_0x2bdf('0xb')](),controller['query']);router[_0x2bdf('0x10')]('/',auth[_0x2bdf('0xb')](),controller[_0x2bdf('0x11')]);router['put']('/:id',auth[_0x2bdf('0xb')](),controller[_0x2bdf('0x12')]);router[_0x2bdf('0x13')](_0x2bdf('0xa'),auth[_0x2bdf('0xb')](),controller[_0x2bdf('0x14')]);module[_0x2bdf('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 159f6fc..5e59811 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 _0x6336=['xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING','ENUM'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x6336,0xd8));var _0x6633=function(_0x1c880b,_0x5dd5bf){_0x1c880b=_0x1c880b-0x0;var _0x49595d=_0x6336[_0x1c880b];return _0x49595d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6633('0x0'));module[_0x6633('0x1')]={'name':{'type':Sequelize[_0x6633('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x6633('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x6633('0x3')]('csv','pdf',_0x6633('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x6633('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6633('0x5')]},'endDate':{'type':Sequelize[_0x6633('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x6633('0x3')](_0x6633('0x6'),_0x6633('0x7')),'allowNull':![],'defaultValue':_0x6633('0x6')},'reportId':{'type':Sequelize[_0x6633('0x8')](0xb)[_0x6633('0x9')]},'reportType':{'type':Sequelize[_0x6633('0x2')]}}; \ No newline at end of file +var _0xd5b7=['csv','pdf','DATE','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xd5b7,0x1b3));var _0x7d5b=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xd5b7[_0x5a26db];return _0x4619dd;};'use strict';var Sequelize=require(_0x7d5b('0x0'));var moment=require(_0x7d5b('0x1'));module[_0x7d5b('0x2')]={'name':{'type':Sequelize[_0x7d5b('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x7d5b('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x7d5b('0x4')](_0x7d5b('0x5'),_0x7d5b('0x6'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x7d5b('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x7d5b('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x7d5b('0x8'),_0x7d5b('0x9')),'allowNull':![],'defaultValue':_0x7d5b('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x7d5b('0xa')]},'reportType':{'type':Sequelize[_0x7d5b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d483576..e7b8fd5 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 _0x514a=['../../mysqldb','sendStatus','status','end','offset','limit','set','apply','reject','update','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','download','basename','savename','output','existsSync','join','root','ValidationError','exists','server/files/reports','format','%s.%s','toLowerCase','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5491e5,_0x37a869){var _0x214eb5=function(_0x13a469){while(--_0x13a469){_0x5491e5['push'](_0x5491e5['shift']());}};_0x214eb5(++_0x37a869);}(_0x514a,0xa7));var _0xa514=function(_0x14f54a,_0xa3b21e){_0x14f54a=_0x14f54a-0x0;var _0x1a5840=_0x514a[_0x14f54a];return _0x1a5840;};'use strict';var pdf=require(_0xa514('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa514('0x1'));var rp=require(_0xa514('0x2'));var moment=require('moment');var BPromise=require(_0xa514('0x3'));var Mustache=require(_0xa514('0x4'));var util=require(_0xa514('0x5'));var path=require(_0xa514('0x6'));var sox=require(_0xa514('0x7'));var csv=require('to-csv');var ejs=require(_0xa514('0x8'));var fs=require('fs');var _=require(_0xa514('0x9'));var squel=require(_0xa514('0xa'));var crypto=require(_0xa514('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa514('0xc'));var querystring=require('querystring');var Papa=require(_0xa514('0xd'));var Redis=require(_0xa514('0xe'));var authService=require(_0xa514('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa514('0x10'));var hardwareService=require(_0xa514('0x11'));var logger=require(_0xa514('0x12'))(_0xa514('0x13'));var utils=require(_0xa514('0x14'));var config=require('../../config/environment');var db=require(_0xa514('0x15'))['db'];function respondWithStatusCode(_0x51de09,_0x2e5bc0){_0x2e5bc0=_0x2e5bc0||0xcc;return function(_0x7aeb88){if(_0x7aeb88){return _0x51de09[_0xa514('0x16')](_0x2e5bc0);}return _0x51de09[_0xa514('0x17')](_0x2e5bc0)[_0xa514('0x18')]();};}function respondWithResult(_0x5baee2,_0x19641b){_0x19641b=_0x19641b||0xc8;return function(_0x938001){if(_0x938001){return _0x5baee2['status'](_0x19641b)['json'](_0x938001);}};}function respondWithFilteredResult(_0xb81db2,_0x224ed1){return function(_0x1b1b74){if(_0x1b1b74){var _0x5a1912=_0x1b1b74['count'],_0x47c96e=_0x224ed1[_0xa514('0x19')],_0x41e755=_0x224ed1[_0xa514('0x19')]+_0x224ed1[_0xa514('0x1a')],_0x4998c2;if(_0x41e755>=_0x5a1912){_0x41e755=_0x5a1912;_0x4998c2=0xc8;}else{_0x4998c2=0xce;}_0xb81db2[_0xa514('0x17')](_0x4998c2);return _0xb81db2[_0xa514('0x1b')]('Content-Range',_0x47c96e+'-'+_0x41e755+'/'+_0x5a1912)['json'](_0x1b1b74);}return null;};}function patchUpdates(_0x4c34b8){return function(_0x1436b4){try{jsonpatch[_0xa514('0x1c')](_0x1436b4,_0x4c34b8,!![]);}catch(_0x442649){return BPromise[_0xa514('0x1d')](_0x442649);}return _0x1436b4['save']();};}function saveUpdates(_0x558415,_0x3f2106){return function(_0x3d6b68){if(_0x3d6b68){return _0x3d6b68[_0xa514('0x1e')](_0x558415)[_0xa514('0x1f')](function(_0x37b790){return _0x37b790;});}return null;};}function removeEntity(_0x391a00,_0x36d05a){return function(_0x42a0fe){if(_0x42a0fe){return _0x42a0fe['destroy']()['then'](function(){var _0x8917ed=_0x42a0fe[_0xa514('0x20')]({'plain':!![]});var _0x4e14bd=_0xa514('0x21');return db[_0xa514('0x22')][_0xa514('0x23')]({'where':{'type':_0x4e14bd,'resourceId':_0x8917ed['id']}})[_0xa514('0x1f')](function(){return _0x42a0fe;});})['then'](function(){_0x391a00[_0xa514('0x17')](0xcc)[_0xa514('0x18')]();});}};}function handleEntityNotFound(_0x5a1efb,_0x4375e3){return function(_0x2b6097){if(!_0x2b6097){_0x5a1efb[_0xa514('0x16')](0x194);}return _0x2b6097;};}function handleError(_0x1bf871,_0x489473){_0x489473=_0x489473||0x1f4;return function(_0x5a7de6){logger[_0xa514('0x24')](_0x5a7de6[_0xa514('0x25')]);if(_0x5a7de6[_0xa514('0x26')]){delete _0x5a7de6[_0xa514('0x26')];}_0x1bf871[_0xa514('0x17')](_0x489473)[_0xa514('0x27')](_0x5a7de6);};}exports[_0xa514('0x28')]=function(_0x12a5e6,_0x532538){var _0x858247={},_0x2bd78c={},_0x2c25f7={'count':0x0,'rows':[]};var _0x453aed=_[_0xa514('0x29')](db[_0xa514('0x2a')][_0xa514('0x2b')],function(_0x4e0c89){return{'name':_0x4e0c89[_0xa514('0x2c')],'type':_0x4e0c89[_0xa514('0x2d')][_0xa514('0x2e')]};});_0x2bd78c['model']=_[_0xa514('0x29')](_0x453aed,_0xa514('0x26'));_0x2bd78c[_0xa514('0x2f')]=_[_0xa514('0x30')](_0x12a5e6[_0xa514('0x2f')]);_0x2bd78c[_0xa514('0x31')]=_[_0xa514('0x32')](_0x2bd78c[_0xa514('0x33')],_0x2bd78c['query']);_0x858247[_0xa514('0x34')]=_[_0xa514('0x32')](_0x2bd78c['model'],qs[_0xa514('0x35')](_0x12a5e6['query'][_0xa514('0x35')]));_0x858247[_0xa514('0x34')]=_0x858247[_0xa514('0x34')][_0xa514('0x36')]?_0x858247[_0xa514('0x34')]:_0x2bd78c[_0xa514('0x33')];if(!_0x12a5e6[_0xa514('0x2f')][_0xa514('0x37')](_0xa514('0x38'))){_0x858247[_0xa514('0x1a')]=qs[_0xa514('0x1a')](_0x12a5e6[_0xa514('0x2f')]['limit']);_0x858247[_0xa514('0x19')]=qs[_0xa514('0x19')](_0x12a5e6[_0xa514('0x2f')][_0xa514('0x19')]);}_0x858247[_0xa514('0x39')]=qs[_0xa514('0x3a')](_0x12a5e6[_0xa514('0x2f')][_0xa514('0x3a')]);_0x858247[_0xa514('0x3b')]=qs['filters'](_[_0xa514('0x3c')](_0x12a5e6[_0xa514('0x2f')],_0x2bd78c[_0xa514('0x31')]),_0x453aed);if(_0x12a5e6[_0xa514('0x2f')][_0xa514('0x3d')]){_0x858247[_0xa514('0x3b')]=_[_0xa514('0x3e')](_0x858247['where'],{'$or':_[_0xa514('0x29')](_0x453aed,function(_0x41a5cc){if(_0x41a5cc[_0xa514('0x2d')]!==_0xa514('0x3f')){var _0x269a52={};_0x269a52[_0x41a5cc[_0xa514('0x26')]]={'$like':'%'+_0x12a5e6[_0xa514('0x2f')][_0xa514('0x3d')]+'%'};return _0x269a52;}})});}_0x858247=_[_0xa514('0x3e')]({},_0x858247,_0x12a5e6[_0xa514('0x40')]);var _0x33d320={'where':_0x858247['where']};return db['AnalyticExtractedReport'][_0xa514('0x41')](_0x33d320)[_0xa514('0x1f')](function(_0x2e05b5){_0x2c25f7['count']=_0x2e05b5;if(_0x12a5e6[_0xa514('0x2f')][_0xa514('0x42')]){_0x858247[_0xa514('0x43')]=[{'all':!![]}];}return db[_0xa514('0x2a')][_0xa514('0x44')](_0x858247);})[_0xa514('0x1f')](function(_0x3a756e){_0x2c25f7[_0xa514('0x45')]=_0x3a756e;return _0x2c25f7;})['then'](respondWithFilteredResult(_0x532538,_0x858247))[_0xa514('0x46')](handleError(_0x532538,null));};exports[_0xa514('0x47')]=function(_0x577aa2,_0x24814d){var _0x159204={'raw':!![],'where':{'id':_0x577aa2[_0xa514('0x48')]['id']}},_0x43c2a0={};_0x43c2a0[_0xa514('0x33')]=_[_0xa514('0x30')](db[_0xa514('0x2a')]['rawAttributes']);_0x43c2a0['query']=_[_0xa514('0x30')](_0x577aa2['query']);_0x43c2a0['filters']=_[_0xa514('0x32')](_0x43c2a0['model'],_0x43c2a0[_0xa514('0x2f')]);_0x159204['attributes']=_[_0xa514('0x32')](_0x43c2a0[_0xa514('0x33')],qs[_0xa514('0x35')](_0x577aa2[_0xa514('0x2f')][_0xa514('0x35')]));_0x159204[_0xa514('0x34')]=_0x159204[_0xa514('0x34')][_0xa514('0x36')]?_0x159204['attributes']:_0x43c2a0['model'];if(_0x577aa2[_0xa514('0x2f')][_0xa514('0x42')]){_0x159204['include']=[{'all':!![]}];}_0x159204=_[_0xa514('0x3e')]({},_0x159204,_0x577aa2['options']);return db[_0xa514('0x2a')][_0xa514('0x49')](_0x159204)[_0xa514('0x1f')](handleEntityNotFound(_0x24814d,null))['then'](respondWithResult(_0x24814d,null))[_0xa514('0x46')](handleError(_0x24814d,null));};exports[_0xa514('0x4a')]=function(_0x25da98,_0x163b7a){return db[_0xa514('0x2a')][_0xa514('0x4a')](_0x25da98[_0xa514('0x4b')],{})['then'](function(_0xc7cffb){var _0x1b3842=_0x25da98[_0xa514('0x4c')][_0xa514('0x20')]({'plain':!![]});if(!_0x1b3842)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b3842[_0xa514('0x4d')]==='user'){var _0xe48fa9=_0xc7cffb['get']({'plain':!![]});var _0x1ee5bc=_0xa514('0x21');return db[_0xa514('0x4e')]['find']({'where':{'name':_0x1ee5bc,'userProfileId':_0x1b3842[_0xa514('0x4f')]},'raw':!![]})[_0xa514('0x1f')](function(_0x12ac4f){if(_0x12ac4f&&_0x12ac4f[_0xa514('0x50')]===0x0){return db[_0xa514('0x22')][_0xa514('0x4a')]({'name':_0xe48fa9[_0xa514('0x26')],'resourceId':_0xe48fa9['id'],'type':_0x12ac4f[_0xa514('0x26')],'sectionId':_0x12ac4f['id']},{})[_0xa514('0x1f')](function(){return _0xc7cffb;});}else{return _0xc7cffb;}})[_0xa514('0x46')](function(_0x4333d0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4333d0);throw _0x4333d0;});}return _0xc7cffb;})[_0xa514('0x1f')](respondWithResult(_0x163b7a,0xc9))[_0xa514('0x46')](handleError(_0x163b7a,null));};exports[_0xa514('0x1e')]=function(_0x44aab6,_0x32f2c5){if(_0x44aab6[_0xa514('0x4b')]['id']){delete _0x44aab6['body']['id'];}return db[_0xa514('0x2a')][_0xa514('0x49')]({'where':{'id':_0x44aab6[_0xa514('0x48')]['id']}})[_0xa514('0x1f')](handleEntityNotFound(_0x32f2c5,null))[_0xa514('0x1f')](saveUpdates(_0x44aab6[_0xa514('0x4b')],null))[_0xa514('0x1f')](respondWithResult(_0x32f2c5,null))[_0xa514('0x46')](handleError(_0x32f2c5,null));};exports[_0xa514('0x23')]=function(_0xa412ef,_0x4cd014){return db[_0xa514('0x2a')][_0xa514('0x49')]({'where':{'id':_0xa412ef[_0xa514('0x48')]['id']}})[_0xa514('0x1f')](handleEntityNotFound(_0x4cd014,null))[_0xa514('0x1f')](removeEntity(_0x4cd014,null))['catch'](handleError(_0x4cd014,null));};exports[_0xa514('0x51')]=function(_0x2b6e78,_0x428685,_0x65d10c){return db[_0xa514('0x2a')][_0xa514('0x49')]({'where':{'id':_0x2b6e78['params']['id']},'attributes':[_0xa514('0x26'),_0xa514('0x52'),_0xa514('0x53'),_0xa514('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x428685,null))[_0xa514('0x1f')](function(_0x514959){if(_0x514959){if(!fs[_0xa514('0x55')](path[_0xa514('0x56')](config[_0xa514('0x57')],'server/files/reports',_0x514959[_0xa514('0x53')]))){throw new db['Sequelize'][(_0xa514('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x2b6e78['query'][_0xa514('0x59')]){return _0x428685[_0xa514('0x16')](0xc8);}return _0x428685[_0xa514('0x51')](path[_0xa514('0x56')](config['root'],_0xa514('0x5a'),_0x514959[_0xa514('0x53')]),util[_0xa514('0x5b')](_0xa514('0x5c'),_0x514959['basename']||_0x514959['name'],_0x514959[_0xa514('0x54')][_0xa514('0x5d')]()));}})[_0xa514('0x46')](handleError(_0x428685,null));}; \ No newline at end of file +var _0x75c1=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','existsSync','join','server/files/reports','Sequelize','ValidationError','exists','root','savename','format','output','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','pick','where','merge','filter','options','AnalyticExtractedReport','count','includeAll','include','findAll','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x5c59f0,_0x222e3d){var _0x1c87e8=function(_0x5ecba3){while(--_0x5ecba3){_0x5c59f0['push'](_0x5c59f0['shift']());}};_0x1c87e8(++_0x222e3d);}(_0x75c1,0x1e6));var _0x175c=function(_0x101fb9,_0x26dab3){_0x101fb9=_0x101fb9-0x0;var _0x4f7195=_0x75c1[_0x101fb9];return _0x4f7195;};'use strict';var pdf=require(_0x175c('0x0'));var emlformat=require(_0x175c('0x1'));var rimraf=require(_0x175c('0x2'));var zipdir=require(_0x175c('0x3'));var jsonpatch=require(_0x175c('0x4'));var rp=require('request-promise');var moment=require(_0x175c('0x5'));var BPromise=require(_0x175c('0x6'));var Mustache=require(_0x175c('0x7'));var util=require(_0x175c('0x8'));var path=require(_0x175c('0x9'));var sox=require(_0x175c('0xa'));var csv=require(_0x175c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x175c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x175c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x175c('0xe'));var Redis=require(_0x175c('0xf'));var authService=require(_0x175c('0x10'));var qs=require(_0x175c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x175c('0x12'));var logger=require('../../config/logger')(_0x175c('0x13'));var utils=require(_0x175c('0x14'));var config=require('../../config/environment');var db=require(_0x175c('0x15'))['db'];function respondWithStatusCode(_0x355775,_0x97857f){_0x97857f=_0x97857f||0xcc;return function(_0x44ba45){if(_0x44ba45){return _0x355775[_0x175c('0x16')](_0x97857f);}return _0x355775[_0x175c('0x17')](_0x97857f)[_0x175c('0x18')]();};}function respondWithResult(_0x1f2a1c,_0x1cfc55){_0x1cfc55=_0x1cfc55||0xc8;return function(_0x5684ed){if(_0x5684ed){return _0x1f2a1c[_0x175c('0x17')](_0x1cfc55)[_0x175c('0x19')](_0x5684ed);}};}function respondWithFilteredResult(_0x1a48aa,_0x574038){return function(_0x34272d){if(_0x34272d){var _0x254438=_0x34272d['count'],_0x26b550=_0x574038['offset'],_0xdeec57=_0x574038[_0x175c('0x1a')]+_0x574038['limit'],_0x1db307;if(_0xdeec57>=_0x254438){_0xdeec57=_0x254438;_0x1db307=0xc8;}else{_0x1db307=0xce;}_0x1a48aa[_0x175c('0x17')](_0x1db307);return _0x1a48aa[_0x175c('0x1b')](_0x175c('0x1c'),_0x26b550+'-'+_0xdeec57+'/'+_0x254438)[_0x175c('0x19')](_0x34272d);}return null;};}function patchUpdates(_0xaaf237){return function(_0x2d1420){try{jsonpatch[_0x175c('0x1d')](_0x2d1420,_0xaaf237,!![]);}catch(_0x5ea515){return BPromise[_0x175c('0x1e')](_0x5ea515);}return _0x2d1420[_0x175c('0x1f')]();};}function saveUpdates(_0xac6331,_0x45f33e){return function(_0x48a98d){if(_0x48a98d){return _0x48a98d[_0x175c('0x20')](_0xac6331)[_0x175c('0x21')](function(_0x60e594){return _0x60e594;});}return null;};}function removeEntity(_0x5de89f,_0xf6575b){return function(_0xab05c9){if(_0xab05c9){return _0xab05c9[_0x175c('0x22')]()[_0x175c('0x21')](function(){var _0x50f90e=_0xab05c9[_0x175c('0x23')]({'plain':!![]});var _0x467c96=_0x175c('0x24');return db['UserProfileResource'][_0x175c('0x22')]({'where':{'type':_0x467c96,'resourceId':_0x50f90e['id']}})[_0x175c('0x21')](function(){return _0xab05c9;});})[_0x175c('0x21')](function(){_0x5de89f[_0x175c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252dfe,_0xdefbcb){return function(_0x5b8b0e){if(!_0x5b8b0e){_0x252dfe[_0x175c('0x16')](0x194);}return _0x5b8b0e;};}function handleError(_0x127d6a,_0x391338){_0x391338=_0x391338||0x1f4;return function(_0x14e6ee){logger['error'](_0x14e6ee[_0x175c('0x25')]);if(_0x14e6ee[_0x175c('0x26')]){delete _0x14e6ee[_0x175c('0x26')];}_0x127d6a[_0x175c('0x17')](_0x391338)[_0x175c('0x27')](_0x14e6ee);};}exports[_0x175c('0x28')]=function(_0x554319,_0x703af2){var _0x2869ca={},_0x162729={},_0x2c0f06={'count':0x0,'rows':[]};var _0x43cbad=_[_0x175c('0x29')](db['AnalyticExtractedReport'][_0x175c('0x2a')],function(_0x38ca31){return{'name':_0x38ca31[_0x175c('0x2b')],'type':_0x38ca31[_0x175c('0x2c')][_0x175c('0x2d')]};});_0x162729[_0x175c('0x2e')]=_[_0x175c('0x29')](_0x43cbad,_0x175c('0x26'));_0x162729[_0x175c('0x2f')]=_['keys'](_0x554319[_0x175c('0x2f')]);_0x162729[_0x175c('0x30')]=_[_0x175c('0x31')](_0x162729[_0x175c('0x2e')],_0x162729[_0x175c('0x2f')]);_0x2869ca[_0x175c('0x32')]=_[_0x175c('0x31')](_0x162729[_0x175c('0x2e')],qs[_0x175c('0x33')](_0x554319[_0x175c('0x2f')][_0x175c('0x33')]));_0x2869ca[_0x175c('0x32')]=_0x2869ca[_0x175c('0x32')][_0x175c('0x34')]?_0x2869ca['attributes']:_0x162729[_0x175c('0x2e')];if(!_0x554319[_0x175c('0x2f')][_0x175c('0x35')](_0x175c('0x36'))){_0x2869ca[_0x175c('0x37')]=qs[_0x175c('0x37')](_0x554319[_0x175c('0x2f')][_0x175c('0x37')]);_0x2869ca[_0x175c('0x1a')]=qs[_0x175c('0x1a')](_0x554319[_0x175c('0x2f')][_0x175c('0x1a')]);}_0x2869ca['order']=qs['sort'](_0x554319[_0x175c('0x2f')]['sort']);_0x2869ca['where']=qs['filters'](_[_0x175c('0x38')](_0x554319[_0x175c('0x2f')],_0x162729[_0x175c('0x30')]),_0x43cbad);if(_0x554319['query']['filter']){_0x2869ca[_0x175c('0x39')]=_[_0x175c('0x3a')](_0x2869ca[_0x175c('0x39')],{'$or':_[_0x175c('0x29')](_0x43cbad,function(_0xc7f362){if(_0xc7f362[_0x175c('0x2c')]!=='VIRTUAL'){var _0x283ac4={};_0x283ac4[_0xc7f362[_0x175c('0x26')]]={'$like':'%'+_0x554319[_0x175c('0x2f')][_0x175c('0x3b')]+'%'};return _0x283ac4;}})});}_0x2869ca=_[_0x175c('0x3a')]({},_0x2869ca,_0x554319[_0x175c('0x3c')]);var _0x2c491a={'where':_0x2869ca[_0x175c('0x39')]};return db[_0x175c('0x3d')][_0x175c('0x3e')](_0x2c491a)[_0x175c('0x21')](function(_0xd93d3f){_0x2c0f06['count']=_0xd93d3f;if(_0x554319[_0x175c('0x2f')][_0x175c('0x3f')]){_0x2869ca[_0x175c('0x40')]=[{'all':!![]}];}return db[_0x175c('0x3d')][_0x175c('0x41')](_0x2869ca);})[_0x175c('0x21')](function(_0x3c0bba){_0x2c0f06['rows']=_0x3c0bba;return _0x2c0f06;})[_0x175c('0x21')](respondWithFilteredResult(_0x703af2,_0x2869ca))[_0x175c('0x42')](handleError(_0x703af2,null));};exports[_0x175c('0x43')]=function(_0x3418cd,_0x335d40){var _0x334749={'raw':!![],'where':{'id':_0x3418cd['params']['id']}},_0x14325b={};_0x14325b[_0x175c('0x2e')]=_[_0x175c('0x44')](db[_0x175c('0x3d')][_0x175c('0x2a')]);_0x14325b[_0x175c('0x2f')]=_[_0x175c('0x44')](_0x3418cd[_0x175c('0x2f')]);_0x14325b['filters']=_[_0x175c('0x31')](_0x14325b[_0x175c('0x2e')],_0x14325b['query']);_0x334749[_0x175c('0x32')]=_[_0x175c('0x31')](_0x14325b[_0x175c('0x2e')],qs[_0x175c('0x33')](_0x3418cd[_0x175c('0x2f')]['fields']));_0x334749[_0x175c('0x32')]=_0x334749[_0x175c('0x32')][_0x175c('0x34')]?_0x334749[_0x175c('0x32')]:_0x14325b['model'];if(_0x3418cd['query'][_0x175c('0x3f')]){_0x334749[_0x175c('0x40')]=[{'all':!![]}];}_0x334749=_[_0x175c('0x3a')]({},_0x334749,_0x3418cd['options']);return db['AnalyticExtractedReport'][_0x175c('0x45')](_0x334749)['then'](handleEntityNotFound(_0x335d40,null))['then'](respondWithResult(_0x335d40,null))[_0x175c('0x42')](handleError(_0x335d40,null));};exports[_0x175c('0x46')]=function(_0x15895a,_0x2b22eb){return db['AnalyticExtractedReport']['create'](_0x15895a[_0x175c('0x47')],{})[_0x175c('0x21')](function(_0x34086c){var _0x4283d5=_0x15895a[_0x175c('0x48')][_0x175c('0x23')]({'plain':!![]});if(!_0x4283d5)throw new Error(_0x175c('0x49'));if(_0x4283d5[_0x175c('0x4a')]===_0x175c('0x48')){var _0x50938e=_0x34086c[_0x175c('0x23')]({'plain':!![]});var _0x5632d3=_0x175c('0x24');return db[_0x175c('0x4b')][_0x175c('0x45')]({'where':{'name':_0x5632d3,'userProfileId':_0x4283d5[_0x175c('0x4c')]},'raw':!![]})[_0x175c('0x21')](function(_0x39ca10){if(_0x39ca10&&_0x39ca10[_0x175c('0x4d')]===0x0){return db[_0x175c('0x4e')][_0x175c('0x46')]({'name':_0x50938e[_0x175c('0x26')],'resourceId':_0x50938e['id'],'type':_0x39ca10[_0x175c('0x26')],'sectionId':_0x39ca10['id']},{})[_0x175c('0x21')](function(){return _0x34086c;});}else{return _0x34086c;}})[_0x175c('0x42')](function(_0x433da2){logger['error'](_0x175c('0x4f'),_0x433da2);throw _0x433da2;});}return _0x34086c;})[_0x175c('0x21')](respondWithResult(_0x2b22eb,0xc9))[_0x175c('0x42')](handleError(_0x2b22eb,null));};exports[_0x175c('0x20')]=function(_0x16c183,_0x1de73b){if(_0x16c183[_0x175c('0x47')]['id']){delete _0x16c183[_0x175c('0x47')]['id'];}return db[_0x175c('0x3d')][_0x175c('0x45')]({'where':{'id':_0x16c183[_0x175c('0x50')]['id']}})[_0x175c('0x21')](handleEntityNotFound(_0x1de73b,null))[_0x175c('0x21')](saveUpdates(_0x16c183['body'],null))[_0x175c('0x21')](respondWithResult(_0x1de73b,null))[_0x175c('0x42')](handleError(_0x1de73b,null));};exports[_0x175c('0x22')]=function(_0x40e8be,_0x4513d1){return db[_0x175c('0x3d')][_0x175c('0x45')]({'where':{'id':_0x40e8be[_0x175c('0x50')]['id']}})['then'](handleEntityNotFound(_0x4513d1,null))[_0x175c('0x21')](removeEntity(_0x4513d1,null))[_0x175c('0x42')](handleError(_0x4513d1,null));};exports[_0x175c('0x51')]=function(_0x6f9b4f,_0x5a7d1c,_0x25d917){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x6f9b4f[_0x175c('0x50')]['id']},'attributes':[_0x175c('0x26'),_0x175c('0x52'),'savename','output'],'raw':!![]})['then'](handleEntityNotFound(_0x5a7d1c,null))[_0x175c('0x21')](function(_0x49c894){if(_0x49c894){if(!fs[_0x175c('0x53')](path[_0x175c('0x54')](config['root'],_0x175c('0x55'),_0x49c894['savename']))){throw new db[(_0x175c('0x56'))][(_0x175c('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x6f9b4f[_0x175c('0x2f')][_0x175c('0x58')]){return _0x5a7d1c[_0x175c('0x16')](0xc8);}return _0x5a7d1c[_0x175c('0x51')](path[_0x175c('0x54')](config[_0x175c('0x59')],_0x175c('0x55'),_0x49c894[_0x175c('0x5a')]),util[_0x175c('0x5b')]('%s.%s',_0x49c894['basename']||_0x49c894['name'],_0x49c894[_0x175c('0x5c')][_0x175c('0x5d')]()));}})[_0x175c('0x42')](handleError(_0x5a7d1c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 6d9e047..d912664 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 _0x6e4b=['request-promise','rimraf','exports','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e4b,0x1f4));var _0xb6e4=function(_0x37cc18,_0xf33560){_0x37cc18=_0x37cc18-0x0;var _0x5cbfe3=_0x6e4b[_0x37cc18];return _0x5cbfe3;};'use strict';var _=require('lodash');var util=require(_0xb6e4('0x0'));var logger=require(_0xb6e4('0x1'))(_0xb6e4('0x2'));var moment=require('moment');var BPromise=require(_0xb6e4('0x3'));var rp=require(_0xb6e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6e4('0x5'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0xb6e4('0x6')]=function(_0x2828f7,_0x50ac83){return _0x2828f7['define'](_0xb6e4('0x7'),attributes,{'tableName':_0xb6e4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b9c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','../../config/logger','api'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x9b9c,0x13d));var _0xc9b9=function(_0x12b6c3,_0x48e645){_0x12b6c3=_0x12b6c3-0x0;var _0x1a2d61=_0x9b9c[_0x12b6c3];return _0x1a2d61;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9b9('0x0'))(_0xc9b9('0x1'));var moment=require(_0xc9b9('0x2'));var BPromise=require(_0xc9b9('0x3'));var rp=require(_0xc9b9('0x4'));var fs=require('fs');var path=require(_0xc9b9('0x5'));var rimraf=require(_0xc9b9('0x6'));var config=require(_0xc9b9('0x7'));var attributes=require(_0xc9b9('0x8'));module[_0xc9b9('0x9')]=function(_0x28a9e5,_0x3c3ea5){return _0x28a9e5[_0xc9b9('0xa')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','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 f5172dd..1a8f082 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 _0xf614=['error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x401072,_0x377172){var _0x47285a=function(_0x5d3246){while(--_0x5d3246){_0x401072['push'](_0x401072['shift']());}};_0x47285a(++_0x377172);}(_0xf614,0x8e));var _0x4f61=function(_0x4cc03b,_0x299f1c){_0x4cc03b=_0x4cc03b-0x0;var _0xf0358c=_0xf614[_0x4cc03b];return _0xf0358c;};'use strict';var _=require(_0x4f61('0x0'));var util=require(_0x4f61('0x1'));var moment=require(_0x4f61('0x2'));var BPromise=require(_0x4f61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f61('0x4'))['db'];var utils=require(_0x4f61('0x5'));var logger=require(_0x4f61('0x6'))(_0x4f61('0x7'));var config=require(_0x4f61('0x8'));var jayson=require(_0x4f61('0x9'));var client=jayson[_0x4f61('0xa')][_0x4f61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a3bc2,_0x48022b,_0x255eb8){return new BPromise(function(_0xd06e95,_0x3e6572){return client[_0x4f61('0xc')](_0x3a3bc2,_0x255eb8)[_0x4f61('0xd')](function(_0x2ec94b){logger[_0x4f61('0xe')](_0x4f61('0xf'),_0x48022b,_0x4f61('0x10'));logger[_0x4f61('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x48022b,_0x4f61('0x10'),JSON[_0x4f61('0x12')](_0x2ec94b));if(_0x2ec94b[_0x4f61('0x13')]){if(_0x2ec94b[_0x4f61('0x13')][_0x4f61('0x14')]===0x1f4){logger[_0x4f61('0x13')](_0x4f61('0xf'),_0x48022b,_0x2ec94b[_0x4f61('0x13')]['message']);return _0x3e6572(_0x2ec94b[_0x4f61('0x13')]['message']);}logger[_0x4f61('0x13')](_0x4f61('0xf'),_0x48022b,_0x2ec94b['error'][_0x4f61('0x15')]);return _0xd06e95(_0x2ec94b[_0x4f61('0x13')][_0x4f61('0x15')]);}else{logger[_0x4f61('0xe')](_0x4f61('0xf'),_0x48022b,_0x4f61('0x10'));_0xd06e95(_0x2ec94b['result'][_0x4f61('0x15')]);}})[_0x4f61('0x16')](function(_0x42e521){logger[_0x4f61('0x13')](_0x4f61('0xf'),_0x48022b,_0x42e521);_0x3e6572(_0x42e521);});});} \ No newline at end of file +var _0xc996=['jayson/promise','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5e472c,_0x425b2e){var _0x1d055e=function(_0x361d13){while(--_0x361d13){_0x5e472c['push'](_0x5e472c['shift']());}};_0x1d055e(++_0x425b2e);}(_0xc996,0x1f0));var _0x6c99=function(_0x11c3dd,_0x2b1236){_0x11c3dd=_0x11c3dd-0x0;var _0xcd1bcc=_0xc996[_0x11c3dd];return _0xcd1bcc;};'use strict';var _=require('lodash');var util=require(_0x6c99('0x0'));var moment=require('moment');var BPromise=require(_0x6c99('0x1'));var rs=require(_0x6c99('0x2'));var fs=require('fs');var Redis=require(_0x6c99('0x3'));var db=require(_0x6c99('0x4'))['db'];var utils=require(_0x6c99('0x5'));var logger=require('../../config/logger')(_0x6c99('0x6'));var config=require(_0x6c99('0x7'));var jayson=require(_0x6c99('0x8'));var client=jayson['client'][_0x6c99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aa9fb,_0x384412,_0x29638e){return new BPromise(function(_0x1f9d5c,_0x474c30){return client[_0x6c99('0xa')](_0x2aa9fb,_0x29638e)[_0x6c99('0xb')](function(_0x3b1430){logger['info'](_0x6c99('0xc'),_0x384412,_0x6c99('0xd'));logger[_0x6c99('0xe')](_0x6c99('0xf'),_0x384412,_0x6c99('0xd'),JSON[_0x6c99('0x10')](_0x3b1430));if(_0x3b1430[_0x6c99('0x11')]){if(_0x3b1430[_0x6c99('0x11')][_0x6c99('0x12')]===0x1f4){logger['error'](_0x6c99('0xc'),_0x384412,_0x3b1430[_0x6c99('0x11')]['message']);return _0x474c30(_0x3b1430[_0x6c99('0x11')][_0x6c99('0x13')]);}logger[_0x6c99('0x11')](_0x6c99('0xc'),_0x384412,_0x3b1430[_0x6c99('0x11')][_0x6c99('0x13')]);return _0x1f9d5c(_0x3b1430[_0x6c99('0x11')][_0x6c99('0x13')]);}else{logger['info'](_0x6c99('0xc'),_0x384412,_0x6c99('0xd'));_0x1f9d5c(_0x3b1430[_0x6c99('0x14')][_0x6c99('0x13')]);}})['catch'](function(_0x505ece){logger[_0x6c99('0x11')](_0x6c99('0xc'),_0x384412,_0x505ece);_0x474c30(_0x505ece);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 82fd1e8..2215fbe 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 _0x5693=['../../components/interaction/service','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','download','create','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x5693,0x174));var _0x3569=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0x5693[_0x24f862];return _0x198aa4;};'use strict';var multer=require(_0x3569('0x0'));var util=require(_0x3569('0x1'));var path=require(_0x3569('0x2'));var timeout=require(_0x3569('0x3'));var express=require(_0x3569('0x4'));var router=express['Router']();var auth=require(_0x3569('0x5'));var interaction=require(_0x3569('0x6'));var config=require('../../config/environment');var controller=require(_0x3569('0x7'));router[_0x3569('0x8')]('/',auth['isAuthenticated'](),controller[_0x3569('0x9')]);router[_0x3569('0x8')](_0x3569('0xa'),auth[_0x3569('0xb')](),controller[_0x3569('0xc')]);router['get']('/:id/download',auth[_0x3569('0xb')](),controller[_0x3569('0xd')]);router['post']('/',auth[_0x3569('0xb')](),controller[_0x3569('0xe')]);router[_0x3569('0xf')](_0x3569('0xa'),auth['isAuthenticated'](),controller[_0x3569('0x10')]);router['delete'](_0x3569('0xa'),auth[_0x3569('0xb')](),controller[_0x3569('0x11')]);module['exports']=router; \ No newline at end of file +var _0x38e7=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x38e7,0x1b3));var _0x738e=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x38e7[_0x19115e];return _0x45bbd4;};'use strict';var multer=require('multer');var util=require(_0x738e('0x0'));var path=require(_0x738e('0x1'));var timeout=require(_0x738e('0x2'));var express=require(_0x738e('0x3'));var router=express[_0x738e('0x4')]();var auth=require(_0x738e('0x5'));var interaction=require(_0x738e('0x6'));var config=require(_0x738e('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x738e('0x8')]('/',auth[_0x738e('0x9')](),controller[_0x738e('0xa')]);router[_0x738e('0x8')](_0x738e('0xb'),auth[_0x738e('0x9')](),controller[_0x738e('0xc')]);router[_0x738e('0x8')](_0x738e('0xd'),auth['isAuthenticated'](),controller[_0x738e('0xe')]);router[_0x738e('0xf')]('/',auth[_0x738e('0x9')](),controller['create']);router[_0x738e('0x10')](_0x738e('0xb'),auth['isAuthenticated'](),controller[_0x738e('0x11')]);router[_0x738e('0x12')](_0x738e('0xb'),auth[_0x738e('0x9')](),controller[_0x738e('0x13')]);module[_0x738e('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1de1288..552f208 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 _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x112571,_0x59086f){var _0x19bb43=function(_0x5d32d5){while(--_0x5d32d5){_0x112571['push'](_0x112571['shift']());}};_0x19bb43(++_0x59086f);}(_0x7217,0x19e));var _0x7721=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x7217[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x1928f8,_0xdd54dd){var _0x1a5f8e=function(_0x274444){while(--_0x274444){_0x1928f8['push'](_0x1928f8['shift']());}};_0x1a5f8e(++_0xdd54dd);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a6a20ea..bda2732 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 _0x0665=['merge','VIRTUAL','catch','show','intersection','includeAll','include','options','find','create','body','bulkCreate','params','ids','AnalyticCustomReport','findOne','transaction','CustomReportId','findAll','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','json','apply','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','type','key','map','keys','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filter'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0x0665,0x1e7));var _0x5066=function(_0x4e80a7,_0x11d1d3){_0x4e80a7=_0x4e80a7-0x0;var _0x1edb13=_0x0665[_0x4e80a7];return _0x1edb13;};'use strict';var pdf=require(_0x5066('0x0'));var emlformat=require(_0x5066('0x1'));var rimraf=require(_0x5066('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5066('0x3'));var rp=require('request-promise');var moment=require(_0x5066('0x4'));var BPromise=require(_0x5066('0x5'));var Mustache=require(_0x5066('0x6'));var util=require('util');var path=require(_0x5066('0x7'));var sox=require('sox');var csv=require(_0x5066('0x8'));var ejs=require(_0x5066('0x9'));var fs=require('fs');var _=require(_0x5066('0xa'));var squel=require(_0x5066('0xb'));var crypto=require(_0x5066('0xc'));var jsforce=require(_0x5066('0xd'));var deskjs=require(_0x5066('0xe'));var toCsv=require(_0x5066('0x8'));var querystring=require('querystring');var Papa=require(_0x5066('0xf'));var Redis=require(_0x5066('0x10'));var authService=require(_0x5066('0x11'));var qs=require(_0x5066('0x12'));var as=require(_0x5066('0x13'));var hardwareService=require(_0x5066('0x14'));var logger=require(_0x5066('0x15'))('api');var utils=require(_0x5066('0x16'));var config=require('../../config/environment');var db=require(_0x5066('0x17'))['db'];function respondWithStatusCode(_0x28b30b,_0x35d78e){_0x35d78e=_0x35d78e||0xcc;return function(_0x4c0377){if(_0x4c0377){return _0x28b30b['sendStatus'](_0x35d78e);}return _0x28b30b[_0x5066('0x18')](_0x35d78e)[_0x5066('0x19')]();};}function respondWithResult(_0x4ce515,_0x559e22){_0x559e22=_0x559e22||0xc8;return function(_0x383499){if(_0x383499){return _0x4ce515['status'](_0x559e22)['json'](_0x383499);}};}function respondWithFilteredResult(_0x9e4e24,_0x3e9d81){return function(_0x57ca9f){if(_0x57ca9f){var _0x62bebc=_0x57ca9f[_0x5066('0x1a')],_0x5524bb=_0x3e9d81[_0x5066('0x1b')],_0x1d8ce5=_0x3e9d81[_0x5066('0x1b')]+_0x3e9d81[_0x5066('0x1c')],_0x38a079;if(_0x1d8ce5>=_0x62bebc){_0x1d8ce5=_0x62bebc;_0x38a079=0xc8;}else{_0x38a079=0xce;}_0x9e4e24['status'](_0x38a079);return _0x9e4e24[_0x5066('0x1d')]('Content-Range',_0x5524bb+'-'+_0x1d8ce5+'/'+_0x62bebc)[_0x5066('0x1e')](_0x57ca9f);}return null;};}function patchUpdates(_0xb47496){return function(_0x16b41e){try{jsonpatch[_0x5066('0x1f')](_0x16b41e,_0xb47496,!![]);}catch(_0x37c883){return BPromise['reject'](_0x37c883);}return _0x16b41e[_0x5066('0x20')]();};}function saveUpdates(_0x1c0b35,_0x466c39){return function(_0x36c0d2){if(_0x36c0d2){return _0x36c0d2[_0x5066('0x21')](_0x1c0b35)[_0x5066('0x22')](function(_0x52cbdf){return _0x52cbdf;});}return null;};}function removeEntity(_0x16b96d,_0x5cff9b){return function(_0x285c59){if(_0x285c59){return _0x285c59[_0x5066('0x23')]()['then'](function(){_0x16b96d['status'](0xcc)[_0x5066('0x19')]();});}};}function handleEntityNotFound(_0x3d9301,_0x1500c2){return function(_0x3db2cc){if(!_0x3db2cc){_0x3d9301['sendStatus'](0x194);}return _0x3db2cc;};}function handleError(_0x565d16,_0xab5ba2){_0xab5ba2=_0xab5ba2||0x1f4;return function(_0x1f1969){logger[_0x5066('0x24')](_0x1f1969[_0x5066('0x25')]);if(_0x1f1969[_0x5066('0x26')]){delete _0x1f1969['name'];}_0x565d16[_0x5066('0x18')](_0xab5ba2)[_0x5066('0x27')](_0x1f1969);};}exports[_0x5066('0x28')]=function(_0x1d552a,_0x4dda10){var _0x370288={},_0x1e713e={},_0x5b96b7={'count':0x0,'rows':[]};var _0x3e412d=_['map'](db[_0x5066('0x29')][_0x5066('0x2a')],function(_0x45f49f){return{'name':_0x45f49f['fieldName'],'type':_0x45f49f[_0x5066('0x2b')][_0x5066('0x2c')]};});_0x1e713e['model']=_[_0x5066('0x2d')](_0x3e412d,_0x5066('0x26'));_0x1e713e['query']=_[_0x5066('0x2e')](_0x1d552a[_0x5066('0x2f')]);_0x1e713e[_0x5066('0x30')]=_['intersection'](_0x1e713e['model'],_0x1e713e[_0x5066('0x2f')]);_0x370288[_0x5066('0x31')]=_['intersection'](_0x1e713e[_0x5066('0x32')],qs[_0x5066('0x33')](_0x1d552a[_0x5066('0x2f')][_0x5066('0x33')]));_0x370288['attributes']=_0x370288[_0x5066('0x31')][_0x5066('0x34')]?_0x370288[_0x5066('0x31')]:_0x1e713e[_0x5066('0x32')];if(!_0x1d552a['query'][_0x5066('0x35')](_0x5066('0x36'))){_0x370288['limit']=qs[_0x5066('0x1c')](_0x1d552a[_0x5066('0x2f')][_0x5066('0x1c')]);_0x370288['offset']=qs[_0x5066('0x1b')](_0x1d552a['query'][_0x5066('0x1b')]);}_0x370288[_0x5066('0x37')]=qs['sort'](_0x1d552a[_0x5066('0x2f')]['sort']);_0x370288[_0x5066('0x38')]=qs[_0x5066('0x30')](_[_0x5066('0x39')](_0x1d552a[_0x5066('0x2f')],_0x1e713e[_0x5066('0x30')]),_0x3e412d);if(_0x1d552a['query'][_0x5066('0x3a')]){_0x370288[_0x5066('0x38')]=_[_0x5066('0x3b')](_0x370288[_0x5066('0x38')],{'$or':_[_0x5066('0x2d')](_0x3e412d,function(_0x4c49aa){if(_0x4c49aa['type']!==_0x5066('0x3c')){var _0x177509={};_0x177509[_0x4c49aa[_0x5066('0x26')]]={'$like':'%'+_0x1d552a[_0x5066('0x2f')]['filter']+'%'};return _0x177509;}})});}_0x370288=_['merge']({},_0x370288,_0x1d552a['options']);var _0x365060={'where':_0x370288[_0x5066('0x38')]};return db['AnalyticFieldReport'][_0x5066('0x1a')](_0x365060)[_0x5066('0x22')](function(_0x5d24cb){_0x5b96b7['count']=_0x5d24cb;if(_0x1d552a[_0x5066('0x2f')]['includeAll']){_0x370288['include']=[{'all':!![]}];}return db[_0x5066('0x29')]['findAll'](_0x370288);})[_0x5066('0x22')](function(_0x5d483b){_0x5b96b7['rows']=_0x5d483b;return _0x5b96b7;})['then'](respondWithFilteredResult(_0x4dda10,_0x370288))[_0x5066('0x3d')](handleError(_0x4dda10,null));};exports[_0x5066('0x3e')]=function(_0x4dc8cb,_0x58652e){var _0xf7c783={'raw':![],'where':{'id':_0x4dc8cb['params']['id']}},_0x388b4a={};_0x388b4a[_0x5066('0x32')]=_[_0x5066('0x2e')](db[_0x5066('0x29')][_0x5066('0x2a')]);_0x388b4a[_0x5066('0x2f')]=_[_0x5066('0x2e')](_0x4dc8cb[_0x5066('0x2f')]);_0x388b4a[_0x5066('0x30')]=_[_0x5066('0x3f')](_0x388b4a[_0x5066('0x32')],_0x388b4a[_0x5066('0x2f')]);_0xf7c783[_0x5066('0x31')]=_[_0x5066('0x3f')](_0x388b4a[_0x5066('0x32')],qs[_0x5066('0x33')](_0x4dc8cb[_0x5066('0x2f')][_0x5066('0x33')]));_0xf7c783[_0x5066('0x31')]=_0xf7c783[_0x5066('0x31')][_0x5066('0x34')]?_0xf7c783[_0x5066('0x31')]:_0x388b4a['model'];if(_0x4dc8cb[_0x5066('0x2f')][_0x5066('0x40')]){_0xf7c783[_0x5066('0x41')]=[{'all':!![]}];}_0xf7c783=_[_0x5066('0x3b')]({},_0xf7c783,_0x4dc8cb[_0x5066('0x42')]);return db['AnalyticFieldReport'][_0x5066('0x43')](_0xf7c783)[_0x5066('0x22')](handleEntityNotFound(_0x58652e,null))['then'](respondWithResult(_0x58652e,null))[_0x5066('0x3d')](handleError(_0x58652e,null));};exports[_0x5066('0x44')]=function(_0x5c9670,_0x2a439f){return db[_0x5066('0x29')][_0x5066('0x44')](_0x5c9670[_0x5066('0x45')],{})[_0x5066('0x22')](respondWithResult(_0x2a439f,0xc9))[_0x5066('0x3d')](handleError(_0x2a439f,null));};exports[_0x5066('0x46')]=function(_0xd34f9,_0xf499ac){return db[_0x5066('0x29')][_0x5066('0x46')](_0xd34f9[_0x5066('0x45')],{'raw':![],'individualHooks':!![]})[_0x5066('0x22')](respondWithResult(_0xf499ac,0xc9))[_0x5066('0x3d')](handleError(_0xf499ac,null));};exports[_0x5066('0x21')]=function(_0x4c23e9,_0x459120){if(_0x4c23e9[_0x5066('0x45')]['id']){delete _0x4c23e9['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x4c23e9[_0x5066('0x47')]['id']}})[_0x5066('0x22')](handleEntityNotFound(_0x459120,null))[_0x5066('0x22')](saveUpdates(_0x4c23e9['body'],null))[_0x5066('0x22')](respondWithResult(_0x459120,null))['catch'](handleError(_0x459120,null));};exports[_0x5066('0x23')]=function(_0x4a05ad,_0x5909f7){return db[_0x5066('0x29')][_0x5066('0x43')]({'where':{'id':_0x4a05ad['params']['id']}})['then'](handleEntityNotFound(_0x5909f7,null))[_0x5066('0x22')](removeEntity(_0x5909f7,null))[_0x5066('0x3d')](handleError(_0x5909f7,null));};exports['bulkDestroy']=function(_0x2a95a0,_0x370df3){return db[_0x5066('0x29')][_0x5066('0x23')]({'where':{'id':_0x2a95a0[_0x5066('0x2f')][_0x5066('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x5066('0x22')](respondWithResult(_0x370df3,0xcc))[_0x5066('0x3d')](handleError(_0x370df3,null));};exports['addFields']=function(_0x46f7f5,_0x2cae2f,_0x531882){return db[_0x5066('0x49')][_0x5066('0x4a')]({'where':{'id':_0x46f7f5[_0x5066('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cae2f,null))['then'](function(_0x35cd68){if(_0x35cd68){return db['sequelize'][_0x5066('0x4b')](function(_0x118d7f){return db[_0x5066('0x29')][_0x5066('0x23')]({'where':{'CustomReportId':_0x46f7f5[_0x5066('0x47')]['id']},'transaction':_0x118d7f})[_0x5066('0x22')](function(_0x35865d){var _0x34156d=_['map'](_0x46f7f5[_0x5066('0x45')],function(_0x15ca48){delete _0x15ca48['id'];_0x15ca48[_0x5066('0x4c')]=_0x46f7f5[_0x5066('0x47')]['id'];return _0x15ca48;});return db[_0x5066('0x29')][_0x5066('0x46')](_0x34156d,{'transaction':_0x118d7f});});})[_0x5066('0x22')](function(){return db[_0x5066('0x29')][_0x5066('0x4d')]({'where':{'CustomReportId':_0x46f7f5[_0x5066('0x47')]['id']}});});}})[_0x5066('0x22')](respondWithResult(_0x2cae2f,null))['catch'](handleError(_0x2cae2f,null));}; \ No newline at end of file +var _0x1ead=['destroy','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','error','name','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','bulkCreate'];(function(_0x16697e,_0x112bf8){var _0x218ede=function(_0x1104dd){while(--_0x1104dd){_0x16697e['push'](_0x16697e['shift']());}};_0x218ede(++_0x112bf8);}(_0x1ead,0xa4));var _0xd1ea=function(_0x1175d7,_0x1df439){_0x1175d7=_0x1175d7-0x0;var _0x4ec31c=_0x1ead[_0x1175d7];return _0x4ec31c;};'use strict';var pdf=require(_0xd1ea('0x0'));var emlformat=require(_0xd1ea('0x1'));var rimraf=require(_0xd1ea('0x2'));var zipdir=require(_0xd1ea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1ea('0x4'));var moment=require(_0xd1ea('0x5'));var BPromise=require(_0xd1ea('0x6'));var Mustache=require(_0xd1ea('0x7'));var util=require(_0xd1ea('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd1ea('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd1ea('0xa'));var crypto=require(_0xd1ea('0xb'));var jsforce=require(_0xd1ea('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd1ea('0x9'));var querystring=require(_0xd1ea('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd1ea('0xe'));var qs=require(_0xd1ea('0xf'));var as=require(_0xd1ea('0x10'));var hardwareService=require(_0xd1ea('0x11'));var logger=require('../../config/logger')(_0xd1ea('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd1ea('0x13'))['db'];function respondWithStatusCode(_0x217fb1,_0x39a872){_0x39a872=_0x39a872||0xcc;return function(_0x3e6ebf){if(_0x3e6ebf){return _0x217fb1[_0xd1ea('0x14')](_0x39a872);}return _0x217fb1['status'](_0x39a872)['end']();};}function respondWithResult(_0x260592,_0x42d8cb){_0x42d8cb=_0x42d8cb||0xc8;return function(_0x59d9c8){if(_0x59d9c8){return _0x260592['status'](_0x42d8cb)[_0xd1ea('0x15')](_0x59d9c8);}};}function respondWithFilteredResult(_0x504db7,_0x526289){return function(_0x5d95d7){if(_0x5d95d7){var _0x2592c0=_0x5d95d7[_0xd1ea('0x16')],_0x3466c3=_0x526289[_0xd1ea('0x17')],_0x1b7d2a=_0x526289[_0xd1ea('0x17')]+_0x526289[_0xd1ea('0x18')],_0x4834ea;if(_0x1b7d2a>=_0x2592c0){_0x1b7d2a=_0x2592c0;_0x4834ea=0xc8;}else{_0x4834ea=0xce;}_0x504db7[_0xd1ea('0x19')](_0x4834ea);return _0x504db7['set'](_0xd1ea('0x1a'),_0x3466c3+'-'+_0x1b7d2a+'/'+_0x2592c0)[_0xd1ea('0x15')](_0x5d95d7);}return null;};}function patchUpdates(_0x4b48af){return function(_0x28165a){try{jsonpatch[_0xd1ea('0x1b')](_0x28165a,_0x4b48af,!![]);}catch(_0x4584e7){return BPromise[_0xd1ea('0x1c')](_0x4584e7);}return _0x28165a[_0xd1ea('0x1d')]();};}function saveUpdates(_0x4c3d23,_0x5d7fb0){return function(_0x469f17){if(_0x469f17){return _0x469f17[_0xd1ea('0x1e')](_0x4c3d23)[_0xd1ea('0x1f')](function(_0x3555ff){return _0x3555ff;});}return null;};}function removeEntity(_0x2c3950,_0x2e5756){return function(_0xab1a4c){if(_0xab1a4c){return _0xab1a4c['destroy']()[_0xd1ea('0x1f')](function(){_0x2c3950[_0xd1ea('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xacd88d,_0x5708cf){return function(_0x5d1deb){if(!_0x5d1deb){_0xacd88d[_0xd1ea('0x14')](0x194);}return _0x5d1deb;};}function handleError(_0x2d4bd5,_0x20d1f3){_0x20d1f3=_0x20d1f3||0x1f4;return function(_0x127b75){logger[_0xd1ea('0x20')](_0x127b75['stack']);if(_0x127b75[_0xd1ea('0x21')]){delete _0x127b75[_0xd1ea('0x21')];}_0x2d4bd5[_0xd1ea('0x19')](_0x20d1f3)['send'](_0x127b75);};}exports[_0xd1ea('0x22')]=function(_0x2b9e8a,_0x409100){var _0x3b99da={},_0x1fe47c={},_0x1a7030={'count':0x0,'rows':[]};var _0x327240=_[_0xd1ea('0x23')](db[_0xd1ea('0x24')]['rawAttributes'],function(_0xad5197){return{'name':_0xad5197[_0xd1ea('0x25')],'type':_0xad5197[_0xd1ea('0x26')][_0xd1ea('0x27')]};});_0x1fe47c[_0xd1ea('0x28')]=_['map'](_0x327240,'name');_0x1fe47c[_0xd1ea('0x29')]=_[_0xd1ea('0x2a')](_0x2b9e8a[_0xd1ea('0x29')]);_0x1fe47c[_0xd1ea('0x2b')]=_['intersection'](_0x1fe47c[_0xd1ea('0x28')],_0x1fe47c[_0xd1ea('0x29')]);_0x3b99da[_0xd1ea('0x2c')]=_[_0xd1ea('0x2d')](_0x1fe47c['model'],qs[_0xd1ea('0x2e')](_0x2b9e8a['query'][_0xd1ea('0x2e')]));_0x3b99da[_0xd1ea('0x2c')]=_0x3b99da[_0xd1ea('0x2c')][_0xd1ea('0x2f')]?_0x3b99da[_0xd1ea('0x2c')]:_0x1fe47c[_0xd1ea('0x28')];if(!_0x2b9e8a[_0xd1ea('0x29')][_0xd1ea('0x30')](_0xd1ea('0x31'))){_0x3b99da[_0xd1ea('0x18')]=qs[_0xd1ea('0x18')](_0x2b9e8a[_0xd1ea('0x29')]['limit']);_0x3b99da[_0xd1ea('0x17')]=qs[_0xd1ea('0x17')](_0x2b9e8a[_0xd1ea('0x29')]['offset']);}_0x3b99da[_0xd1ea('0x32')]=qs[_0xd1ea('0x33')](_0x2b9e8a[_0xd1ea('0x29')][_0xd1ea('0x33')]);_0x3b99da['where']=qs[_0xd1ea('0x2b')](_[_0xd1ea('0x34')](_0x2b9e8a[_0xd1ea('0x29')],_0x1fe47c[_0xd1ea('0x2b')]),_0x327240);if(_0x2b9e8a[_0xd1ea('0x29')][_0xd1ea('0x35')]){_0x3b99da[_0xd1ea('0x36')]=_[_0xd1ea('0x37')](_0x3b99da[_0xd1ea('0x36')],{'$or':_[_0xd1ea('0x23')](_0x327240,function(_0x50dd41){if(_0x50dd41[_0xd1ea('0x26')]!==_0xd1ea('0x38')){var _0x187f74={};_0x187f74[_0x50dd41[_0xd1ea('0x21')]]={'$like':'%'+_0x2b9e8a[_0xd1ea('0x29')][_0xd1ea('0x35')]+'%'};return _0x187f74;}})});}_0x3b99da=_[_0xd1ea('0x37')]({},_0x3b99da,_0x2b9e8a['options']);var _0x85b588={'where':_0x3b99da[_0xd1ea('0x36')]};return db['AnalyticFieldReport'][_0xd1ea('0x16')](_0x85b588)['then'](function(_0x2db32c){_0x1a7030['count']=_0x2db32c;if(_0x2b9e8a['query'][_0xd1ea('0x39')]){_0x3b99da[_0xd1ea('0x3a')]=[{'all':!![]}];}return db[_0xd1ea('0x24')][_0xd1ea('0x3b')](_0x3b99da);})[_0xd1ea('0x1f')](function(_0x5d5cf0){_0x1a7030[_0xd1ea('0x3c')]=_0x5d5cf0;return _0x1a7030;})[_0xd1ea('0x1f')](respondWithFilteredResult(_0x409100,_0x3b99da))[_0xd1ea('0x3d')](handleError(_0x409100,null));};exports[_0xd1ea('0x3e')]=function(_0x27e572,_0x166ef8){var _0x82e946={'raw':![],'where':{'id':_0x27e572[_0xd1ea('0x3f')]['id']}},_0x4e517a={};_0x4e517a[_0xd1ea('0x28')]=_[_0xd1ea('0x2a')](db[_0xd1ea('0x24')][_0xd1ea('0x40')]);_0x4e517a[_0xd1ea('0x29')]=_[_0xd1ea('0x2a')](_0x27e572[_0xd1ea('0x29')]);_0x4e517a[_0xd1ea('0x2b')]=_[_0xd1ea('0x2d')](_0x4e517a[_0xd1ea('0x28')],_0x4e517a[_0xd1ea('0x29')]);_0x82e946[_0xd1ea('0x2c')]=_[_0xd1ea('0x2d')](_0x4e517a[_0xd1ea('0x28')],qs['fields'](_0x27e572[_0xd1ea('0x29')]['fields']));_0x82e946['attributes']=_0x82e946['attributes'][_0xd1ea('0x2f')]?_0x82e946[_0xd1ea('0x2c')]:_0x4e517a['model'];if(_0x27e572[_0xd1ea('0x29')]['includeAll']){_0x82e946['include']=[{'all':!![]}];}_0x82e946=_[_0xd1ea('0x37')]({},_0x82e946,_0x27e572[_0xd1ea('0x41')]);return db[_0xd1ea('0x24')][_0xd1ea('0x42')](_0x82e946)[_0xd1ea('0x1f')](handleEntityNotFound(_0x166ef8,null))['then'](respondWithResult(_0x166ef8,null))[_0xd1ea('0x3d')](handleError(_0x166ef8,null));};exports[_0xd1ea('0x43')]=function(_0x24af99,_0x5d8b4b){return db['AnalyticFieldReport'][_0xd1ea('0x43')](_0x24af99[_0xd1ea('0x44')],{})['then'](respondWithResult(_0x5d8b4b,0xc9))[_0xd1ea('0x3d')](handleError(_0x5d8b4b,null));};exports[_0xd1ea('0x45')]=function(_0x5112e5,_0x293f8){return db[_0xd1ea('0x24')]['bulkCreate'](_0x5112e5['body'],{'raw':![],'individualHooks':!![]})[_0xd1ea('0x1f')](respondWithResult(_0x293f8,0xc9))[_0xd1ea('0x3d')](handleError(_0x293f8,null));};exports['update']=function(_0x33a1a3,_0x2ad6eb){if(_0x33a1a3[_0xd1ea('0x44')]['id']){delete _0x33a1a3[_0xd1ea('0x44')]['id'];}return db[_0xd1ea('0x24')][_0xd1ea('0x42')]({'where':{'id':_0x33a1a3['params']['id']}})['then'](handleEntityNotFound(_0x2ad6eb,null))['then'](saveUpdates(_0x33a1a3[_0xd1ea('0x44')],null))[_0xd1ea('0x1f')](respondWithResult(_0x2ad6eb,null))[_0xd1ea('0x3d')](handleError(_0x2ad6eb,null));};exports[_0xd1ea('0x46')]=function(_0x51cfdc,_0x379fa1){return db[_0xd1ea('0x24')][_0xd1ea('0x42')]({'where':{'id':_0x51cfdc[_0xd1ea('0x3f')]['id']}})[_0xd1ea('0x1f')](handleEntityNotFound(_0x379fa1,null))['then'](removeEntity(_0x379fa1,null))[_0xd1ea('0x3d')](handleError(_0x379fa1,null));};exports[_0xd1ea('0x47')]=function(_0x51f089,_0x27a497){return db[_0xd1ea('0x24')][_0xd1ea('0x46')]({'where':{'id':_0x51f089[_0xd1ea('0x29')][_0xd1ea('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xd1ea('0x1f')](respondWithResult(_0x27a497,0xcc))['catch'](handleError(_0x27a497,null));};exports['addFields']=function(_0x2c880e,_0x41e9d0,_0x36b61d){return db[_0xd1ea('0x49')][_0xd1ea('0x4a')]({'where':{'id':_0x2c880e['params']['id']}})[_0xd1ea('0x1f')](handleEntityNotFound(_0x41e9d0,null))[_0xd1ea('0x1f')](function(_0x441c7c){if(_0x441c7c){return db[_0xd1ea('0x4b')][_0xd1ea('0x4c')](function(_0x3c3693){return db[_0xd1ea('0x24')][_0xd1ea('0x46')]({'where':{'CustomReportId':_0x2c880e[_0xd1ea('0x3f')]['id']},'transaction':_0x3c3693})['then'](function(_0x475fb7){var _0x128184=_[_0xd1ea('0x23')](_0x2c880e[_0xd1ea('0x44')],function(_0x4b6624){delete _0x4b6624['id'];_0x4b6624[_0xd1ea('0x4d')]=_0x2c880e[_0xd1ea('0x3f')]['id'];return _0x4b6624;});return db[_0xd1ea('0x24')][_0xd1ea('0x45')](_0x128184,{'transaction':_0x3c3693});});})[_0xd1ea('0x1f')](function(){return db['AnalyticFieldReport'][_0xd1ea('0x3b')]({'where':{'CustomReportId':_0x2c880e['params']['id']}});});}})[_0xd1ea('0x1f')](respondWithResult(_0x41e9d0,null))['catch'](handleError(_0x41e9d0,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index fb3cb46..af32952 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 _0x327d=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','bluebird'];(function(_0x25ba2d,_0x58bea8){var _0x349a17=function(_0x1d0939){while(--_0x1d0939){_0x25ba2d['push'](_0x25ba2d['shift']());}};_0x349a17(++_0x58bea8);}(_0x327d,0xb8));var _0xd327=function(_0x299983,_0x552e4c){_0x299983=_0x299983-0x0;var _0x261b69=_0x327d[_0x299983];return _0x261b69;};'use strict';var _=require('lodash');var util=require(_0xd327('0x0'));var logger=require(_0xd327('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd327('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd327('0x3'));var rimraf=require(_0xd327('0x4'));var config=require(_0xd327('0x5'));var attributes=require(_0xd327('0x6'));module[_0xd327('0x7')]=function(_0x5c59d8,_0x3b95c8){return _0x5c59d8[_0xd327('0x8')](_0xd327('0x9'),attributes,{'tableName':_0xd327('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c74=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x3c6122,_0x4108ad){var _0x449c1c=function(_0x3afa2d){while(--_0x3afa2d){_0x3c6122['push'](_0x3c6122['shift']());}};_0x449c1c(++_0x4108ad);}(_0x5c74,0x10c));var _0x45c7=function(_0x17ce88,_0x85aee3){_0x17ce88=_0x17ce88-0x0;var _0x1b6c9a=_0x5c74[_0x17ce88];return _0x1b6c9a;};'use strict';var _=require('lodash');var util=require(_0x45c7('0x0'));var logger=require(_0x45c7('0x1'))(_0x45c7('0x2'));var moment=require(_0x45c7('0x3'));var BPromise=require('bluebird');var rp=require(_0x45c7('0x4'));var fs=require('fs');var path=require(_0x45c7('0x5'));var rimraf=require(_0x45c7('0x6'));var config=require(_0x45c7('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x45c7('0x8')]=function(_0x2deda8,_0x3a533b){return _0x2deda8[_0x45c7('0x9')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','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 8194a8d..691b824 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 _0x80b4=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4ca922,_0x11f8d6){var _0x3feb75=function(_0x4e8db2){while(--_0x4e8db2){_0x4ca922['push'](_0x4ca922['shift']());}};_0x3feb75(++_0x11f8d6);}(_0x80b4,0xc0));var _0x480b=function(_0x116573,_0x372cb5){_0x116573=_0x116573-0x0;var _0x10068d=_0x80b4[_0x116573];return _0x10068d;};'use strict';var _=require(_0x480b('0x0'));var util=require(_0x480b('0x1'));var moment=require(_0x480b('0x2'));var BPromise=require(_0x480b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x480b('0x4'));var db=require(_0x480b('0x5'))['db'];var utils=require(_0x480b('0x6'));var logger=require(_0x480b('0x7'))(_0x480b('0x8'));var config=require(_0x480b('0x9'));var jayson=require(_0x480b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23cbb9,_0x1d9ea5,_0x157656){return new BPromise(function(_0x5a1f22,_0x4eccd7){return client[_0x480b('0xb')](_0x23cbb9,_0x157656)[_0x480b('0xc')](function(_0x3fb60c){logger[_0x480b('0xd')](_0x480b('0xe'),_0x1d9ea5,_0x480b('0xf'));logger['debug'](_0x480b('0x10'),_0x1d9ea5,_0x480b('0xf'),JSON['stringify'](_0x3fb60c));if(_0x3fb60c[_0x480b('0x11')]){if(_0x3fb60c[_0x480b('0x11')]['code']===0x1f4){logger[_0x480b('0x11')](_0x480b('0xe'),_0x1d9ea5,_0x3fb60c[_0x480b('0x11')][_0x480b('0x12')]);return _0x4eccd7(_0x3fb60c[_0x480b('0x11')][_0x480b('0x12')]);}logger[_0x480b('0x11')](_0x480b('0xe'),_0x1d9ea5,_0x3fb60c[_0x480b('0x11')]['message']);return _0x5a1f22(_0x3fb60c['error'][_0x480b('0x12')]);}else{logger[_0x480b('0xd')](_0x480b('0xe'),_0x1d9ea5,'request\x20sent');_0x5a1f22(_0x3fb60c[_0x480b('0x13')][_0x480b('0x12')]);}})[_0x480b('0x14')](function(_0x381fe9){logger[_0x480b('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1d9ea5,_0x381fe9);_0x4eccd7(_0x381fe9);});});} \ No newline at end of file +var _0xecb7=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2f023d,_0x29dfe5){var _0x4ef240=function(_0x49f1ec){while(--_0x49f1ec){_0x2f023d['push'](_0x2f023d['shift']());}};_0x4ef240(++_0x29dfe5);}(_0xecb7,0x1ad));var _0x7ecb=function(_0x5d61f8,_0x45c759){_0x5d61f8=_0x5d61f8-0x0;var _0x21a83a=_0xecb7[_0x5d61f8];return _0x21a83a;};'use strict';var _=require(_0x7ecb('0x0'));var util=require(_0x7ecb('0x1'));var moment=require(_0x7ecb('0x2'));var BPromise=require(_0x7ecb('0x3'));var rs=require(_0x7ecb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7ecb('0x5'));var logger=require(_0x7ecb('0x6'))(_0x7ecb('0x7'));var config=require(_0x7ecb('0x8'));var jayson=require(_0x7ecb('0x9'));var client=jayson[_0x7ecb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf889,_0x56ad4e,_0x490aac){return new BPromise(function(_0x1fc666,_0xdd2934){return client[_0x7ecb('0xb')](_0x5cf889,_0x490aac)[_0x7ecb('0xc')](function(_0x410f3e){logger[_0x7ecb('0xd')](_0x7ecb('0xe'),_0x56ad4e,_0x7ecb('0xf'));logger[_0x7ecb('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x56ad4e,_0x7ecb('0xf'),JSON[_0x7ecb('0x11')](_0x410f3e));if(_0x410f3e[_0x7ecb('0x12')]){if(_0x410f3e[_0x7ecb('0x12')][_0x7ecb('0x13')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x56ad4e,_0x410f3e['error'][_0x7ecb('0x14')]);return _0xdd2934(_0x410f3e[_0x7ecb('0x12')][_0x7ecb('0x14')]);}logger[_0x7ecb('0x12')](_0x7ecb('0xe'),_0x56ad4e,_0x410f3e[_0x7ecb('0x12')][_0x7ecb('0x14')]);return _0x1fc666(_0x410f3e[_0x7ecb('0x12')][_0x7ecb('0x14')]);}else{logger[_0x7ecb('0xd')](_0x7ecb('0xe'),_0x56ad4e,'request\x20sent');_0x1fc666(_0x410f3e[_0x7ecb('0x15')][_0x7ecb('0x14')]);}})['catch'](function(_0x12f9aa){logger['error'](_0x7ecb('0xe'),_0x56ad4e,_0x12f9aa);_0xdd2934(_0x12f9aa);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9a87b18..3bd1950 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 _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0xbbcb36,_0x586383){var _0x4278ff=function(_0x35c9da){while(--_0x35c9da){_0xbbcb36['push'](_0xbbcb36['shift']());}};_0x4278ff(++_0x586383);}(_0x5fc3,0xa8));var _0x35fc=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x5fc3[_0x29a29f];return _0x443ea3;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file +var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x84a189,_0x323ae4){var _0x476af8=function(_0x52e014){while(--_0x52e014){_0x84a189['push'](_0x84a189['shift']());}};_0x476af8(++_0x323ae4);}(_0x7217,0x19e));var _0x7721=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7217[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 6a555c7..685f5ad 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 _0x0ad6=['STRING','TEXT','sequelize','exports'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x0ad6,0x7e));var _0x60ad=function(_0x544ded,_0x2cd874){_0x544ded=_0x544ded-0x0;var _0x598372=_0x0ad6[_0x544ded];return _0x598372;};'use strict';var Sequelize=require(_0x60ad('0x0'));module[_0x60ad('0x1')]={'name':{'type':Sequelize[_0x60ad('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x60ad('0x2')]},'metric':{'type':Sequelize[_0x60ad('0x3')]},'description':{'type':Sequelize[_0x60ad('0x2')]}}; \ No newline at end of file +var _0x01f0=['sequelize','STRING','TEXT'];(function(_0x55fb18,_0x22ca43){var _0x4c7217=function(_0x3bac21){while(--_0x3bac21){_0x55fb18['push'](_0x55fb18['shift']());}};_0x4c7217(++_0x22ca43);}(_0x01f0,0x93));var _0x001f=function(_0x26e421,_0x5130cf){_0x26e421=_0x26e421-0x0;var _0x2f9fc5=_0x01f0[_0x26e421];return _0x2f9fc5;};'use strict';var Sequelize=require(_0x001f('0x0'));module['exports']={'name':{'type':Sequelize[_0x001f('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x001f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 4125b3b..7c368ec 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 _0x8580=['Content-Range','apply','reject','save','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','rows','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','update','body','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x8580,0x1c7));var _0x0858=function(_0x46f4dd,_0x226e22){_0x46f4dd=_0x46f4dd-0x0;var _0x4d4776=_0x8580[_0x46f4dd];return _0x4d4776;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0858('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0858('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0858('0x2'));var BPromise=require(_0x0858('0x3'));var Mustache=require('mustache');var util=require(_0x0858('0x4'));var path=require(_0x0858('0x5'));var sox=require('sox');var csv=require(_0x0858('0x6'));var ejs=require(_0x0858('0x7'));var fs=require('fs');var _=require(_0x0858('0x8'));var squel=require(_0x0858('0x9'));var crypto=require('crypto');var jsforce=require(_0x0858('0xa'));var deskjs=require(_0x0858('0xb'));var toCsv=require(_0x0858('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0858('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x0858('0xd'));var as=require(_0x0858('0xe'));var hardwareService=require(_0x0858('0xf'));var logger=require(_0x0858('0x10'))(_0x0858('0x11'));var utils=require(_0x0858('0x12'));var config=require(_0x0858('0x13'));var db=require(_0x0858('0x14'))['db'];function respondWithStatusCode(_0x537811,_0x49eb34){_0x49eb34=_0x49eb34||0xcc;return function(_0x448d29){if(_0x448d29){return _0x537811['sendStatus'](_0x49eb34);}return _0x537811['status'](_0x49eb34)['end']();};}function respondWithResult(_0x2a9869,_0x138b56){_0x138b56=_0x138b56||0xc8;return function(_0x4a869f){if(_0x4a869f){return _0x2a9869[_0x0858('0x15')](_0x138b56)[_0x0858('0x16')](_0x4a869f);}};}function respondWithFilteredResult(_0x44e0e9,_0x44e3ac){return function(_0x319e8d){if(_0x319e8d){var _0x306170=_0x319e8d[_0x0858('0x17')],_0xca6a95=_0x44e3ac[_0x0858('0x18')],_0x2ed26b=_0x44e3ac[_0x0858('0x18')]+_0x44e3ac['limit'],_0xff802e;if(_0x2ed26b>=_0x306170){_0x2ed26b=_0x306170;_0xff802e=0xc8;}else{_0xff802e=0xce;}_0x44e0e9[_0x0858('0x15')](_0xff802e);return _0x44e0e9['set'](_0x0858('0x19'),_0xca6a95+'-'+_0x2ed26b+'/'+_0x306170)[_0x0858('0x16')](_0x319e8d);}return null;};}function patchUpdates(_0x3a2d96){return function(_0x725295){try{jsonpatch[_0x0858('0x1a')](_0x725295,_0x3a2d96,!![]);}catch(_0x5ba5d4){return BPromise[_0x0858('0x1b')](_0x5ba5d4);}return _0x725295[_0x0858('0x1c')]();};}function saveUpdates(_0x4fe5ab,_0x1ea1a7){return function(_0x4896c0){if(_0x4896c0){return _0x4896c0['update'](_0x4fe5ab)[_0x0858('0x1d')](function(_0x318fc8){return _0x318fc8;});}return null;};}function removeEntity(_0xa9d81d,_0x157a39){return function(_0x29ac2b){if(_0x29ac2b){return _0x29ac2b['destroy']()[_0x0858('0x1d')](function(){var _0x481fde=_0x29ac2b[_0x0858('0x1e')]({'plain':!![]});var _0x5f5b52=_0x0858('0x1f');return db[_0x0858('0x20')][_0x0858('0x21')]({'where':{'type':_0x5f5b52,'resourceId':_0x481fde['id']}})[_0x0858('0x1d')](function(){return _0x29ac2b;});})['then'](function(){_0xa9d81d[_0x0858('0x15')](0xcc)[_0x0858('0x22')]();});}};}function handleEntityNotFound(_0x38046e,_0x25f9ee){return function(_0x14f05c){if(!_0x14f05c){_0x38046e[_0x0858('0x23')](0x194);}return _0x14f05c;};}function handleError(_0x21a5bf,_0x83f104){_0x83f104=_0x83f104||0x1f4;return function(_0x31a8de){logger[_0x0858('0x24')](_0x31a8de[_0x0858('0x25')]);if(_0x31a8de[_0x0858('0x26')]){delete _0x31a8de[_0x0858('0x26')];}_0x21a5bf[_0x0858('0x15')](_0x83f104)[_0x0858('0x27')](_0x31a8de);};}exports[_0x0858('0x28')]=function(_0x2607c1,_0x3cd6c5){var _0x5630be={},_0x102cfc={},_0x363188={'count':0x0,'rows':[]};var _0xb5d5df=_[_0x0858('0x29')](db[_0x0858('0x2a')][_0x0858('0x2b')],function(_0x15e94b){return{'name':_0x15e94b[_0x0858('0x2c')],'type':_0x15e94b['type'][_0x0858('0x2d')]};});_0x102cfc[_0x0858('0x2e')]=_[_0x0858('0x29')](_0xb5d5df,_0x0858('0x26'));_0x102cfc['query']=_[_0x0858('0x2f')](_0x2607c1[_0x0858('0x30')]);_0x102cfc['filters']=_[_0x0858('0x31')](_0x102cfc[_0x0858('0x2e')],_0x102cfc['query']);_0x5630be[_0x0858('0x32')]=_[_0x0858('0x31')](_0x102cfc[_0x0858('0x2e')],qs[_0x0858('0x33')](_0x2607c1[_0x0858('0x30')][_0x0858('0x33')]));_0x5630be[_0x0858('0x32')]=_0x5630be[_0x0858('0x32')][_0x0858('0x34')]?_0x5630be['attributes']:_0x102cfc['model'];if(!_0x2607c1[_0x0858('0x30')][_0x0858('0x35')](_0x0858('0x36'))){_0x5630be[_0x0858('0x37')]=qs[_0x0858('0x37')](_0x2607c1[_0x0858('0x30')][_0x0858('0x37')]);_0x5630be[_0x0858('0x18')]=qs[_0x0858('0x18')](_0x2607c1[_0x0858('0x30')][_0x0858('0x18')]);}_0x5630be[_0x0858('0x38')]=qs[_0x0858('0x39')](_0x2607c1[_0x0858('0x30')][_0x0858('0x39')]);_0x5630be[_0x0858('0x3a')]=qs[_0x0858('0x3b')](_[_0x0858('0x3c')](_0x2607c1['query'],_0x102cfc['filters']),_0xb5d5df);if(_0x2607c1['query']['filter']){_0x5630be[_0x0858('0x3a')]=_[_0x0858('0x3d')](_0x5630be[_0x0858('0x3a')],{'$or':_[_0x0858('0x29')](_0xb5d5df,function(_0xf1c998){if(_0xf1c998[_0x0858('0x3e')]!==_0x0858('0x3f')){var _0x2e43d2={};_0x2e43d2[_0xf1c998['name']]={'$like':'%'+_0x2607c1['query']['filter']+'%'};return _0x2e43d2;}})});}_0x5630be=_[_0x0858('0x3d')]({},_0x5630be,_0x2607c1[_0x0858('0x40')]);var _0x569289={'where':_0x5630be['where']};return db[_0x0858('0x2a')][_0x0858('0x17')](_0x569289)[_0x0858('0x1d')](function(_0x479a2e){_0x363188[_0x0858('0x17')]=_0x479a2e;if(_0x2607c1[_0x0858('0x30')][_0x0858('0x41')]){_0x5630be['include']=[{'all':!![]}];}return db[_0x0858('0x2a')]['findAll'](_0x5630be);})[_0x0858('0x1d')](function(_0x2816cb){_0x363188[_0x0858('0x42')]=_0x2816cb;return _0x363188;})[_0x0858('0x1d')](respondWithFilteredResult(_0x3cd6c5,_0x5630be))[_0x0858('0x43')](handleError(_0x3cd6c5,null));};exports['show']=function(_0x446222,_0x5204e9){var _0x214223={'raw':!![],'where':{'id':_0x446222[_0x0858('0x44')]['id']}},_0x48968a={};_0x48968a[_0x0858('0x2e')]=_[_0x0858('0x2f')](db[_0x0858('0x2a')]['rawAttributes']);_0x48968a[_0x0858('0x30')]=_[_0x0858('0x2f')](_0x446222['query']);_0x48968a[_0x0858('0x3b')]=_[_0x0858('0x31')](_0x48968a[_0x0858('0x2e')],_0x48968a['query']);_0x214223['attributes']=_[_0x0858('0x31')](_0x48968a[_0x0858('0x2e')],qs['fields'](_0x446222[_0x0858('0x30')][_0x0858('0x33')]));_0x214223[_0x0858('0x32')]=_0x214223[_0x0858('0x32')][_0x0858('0x34')]?_0x214223['attributes']:_0x48968a['model'];if(_0x446222[_0x0858('0x30')][_0x0858('0x41')]){_0x214223[_0x0858('0x45')]=[{'all':!![]}];}_0x214223=_[_0x0858('0x3d')]({},_0x214223,_0x446222[_0x0858('0x40')]);return db[_0x0858('0x2a')][_0x0858('0x46')](_0x214223)[_0x0858('0x1d')](handleEntityNotFound(_0x5204e9,null))[_0x0858('0x1d')](respondWithResult(_0x5204e9,null))[_0x0858('0x43')](handleError(_0x5204e9,null));};exports[_0x0858('0x47')]=function(_0x3572e2,_0x1d2ecd){return db['AnalyticMetric'][_0x0858('0x47')](_0x3572e2['body'],{})[_0x0858('0x1d')](function(_0x402253){var _0x2b8395=_0x3572e2['user']['get']({'plain':!![]});if(!_0x2b8395)throw new Error(_0x0858('0x48'));if(_0x2b8395['role']===_0x0858('0x49')){var _0x5aed4d=_0x402253[_0x0858('0x1e')]({'plain':!![]});var _0x1cbbf2=_0x0858('0x1f');return db[_0x0858('0x4a')]['find']({'where':{'name':_0x1cbbf2,'userProfileId':_0x2b8395[_0x0858('0x4b')]},'raw':!![]})[_0x0858('0x1d')](function(_0x2da36f){if(_0x2da36f&&_0x2da36f[_0x0858('0x4c')]===0x0){return db[_0x0858('0x20')][_0x0858('0x47')]({'name':_0x5aed4d[_0x0858('0x26')],'resourceId':_0x5aed4d['id'],'type':_0x2da36f[_0x0858('0x26')],'sectionId':_0x2da36f['id']},{})[_0x0858('0x1d')](function(){return _0x402253;});}else{return _0x402253;}})[_0x0858('0x43')](function(_0x396831){logger[_0x0858('0x24')](_0x0858('0x4d'),_0x396831);throw _0x396831;});}return _0x402253;})[_0x0858('0x1d')](respondWithResult(_0x1d2ecd,0xc9))['catch'](handleError(_0x1d2ecd,null));};exports[_0x0858('0x4e')]=function(_0x1fda6f,_0xd983ce){if(_0x1fda6f[_0x0858('0x4f')]['id']){delete _0x1fda6f[_0x0858('0x4f')]['id'];}return db[_0x0858('0x2a')]['find']({'where':{'id':_0x1fda6f[_0x0858('0x44')]['id']}})[_0x0858('0x1d')](handleEntityNotFound(_0xd983ce,null))['then'](saveUpdates(_0x1fda6f[_0x0858('0x4f')],null))[_0x0858('0x1d')](respondWithResult(_0xd983ce,null))[_0x0858('0x43')](handleError(_0xd983ce,null));};exports[_0x0858('0x21')]=function(_0x12763b,_0x53a553){return db[_0x0858('0x2a')]['find']({'where':{'id':_0x12763b[_0x0858('0x44')]['id']}})[_0x0858('0x1d')](handleEntityNotFound(_0x53a553,null))[_0x0858('0x1d')](removeEntity(_0x53a553,null))[_0x0858('0x43')](handleError(_0x53a553,null));}; \ No newline at end of file +var _0x8a5c=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','include','findAll','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x8a5c,0x136));var _0xc8a5=function(_0x47bc6e,_0x17b286){_0x47bc6e=_0x47bc6e-0x0;var _0xa8e462=_0x8a5c[_0x47bc6e];return _0xa8e462;};'use strict';var pdf=require(_0xc8a5('0x0'));var emlformat=require(_0xc8a5('0x1'));var rimraf=require(_0xc8a5('0x2'));var zipdir=require(_0xc8a5('0x3'));var jsonpatch=require(_0xc8a5('0x4'));var rp=require(_0xc8a5('0x5'));var moment=require(_0xc8a5('0x6'));var BPromise=require(_0xc8a5('0x7'));var Mustache=require(_0xc8a5('0x8'));var util=require('util');var path=require(_0xc8a5('0x9'));var sox=require(_0xc8a5('0xa'));var csv=require('to-csv');var ejs=require(_0xc8a5('0xb'));var fs=require('fs');var _=require(_0xc8a5('0xc'));var squel=require(_0xc8a5('0xd'));var crypto=require(_0xc8a5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc8a5('0xf'));var toCsv=require(_0xc8a5('0x10'));var querystring=require(_0xc8a5('0x11'));var Papa=require(_0xc8a5('0x12'));var Redis=require(_0xc8a5('0x13'));var authService=require(_0xc8a5('0x14'));var qs=require(_0xc8a5('0x15'));var as=require(_0xc8a5('0x16'));var hardwareService=require(_0xc8a5('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xc8a5('0x18'));var config=require('../../config/environment');var db=require(_0xc8a5('0x19'))['db'];function respondWithStatusCode(_0x38a605,_0x1295a9){_0x1295a9=_0x1295a9||0xcc;return function(_0x2c6402){if(_0x2c6402){return _0x38a605[_0xc8a5('0x1a')](_0x1295a9);}return _0x38a605['status'](_0x1295a9)[_0xc8a5('0x1b')]();};}function respondWithResult(_0xec4642,_0x5c9595){_0x5c9595=_0x5c9595||0xc8;return function(_0x29aada){if(_0x29aada){return _0xec4642[_0xc8a5('0x1c')](_0x5c9595)[_0xc8a5('0x1d')](_0x29aada);}};}function respondWithFilteredResult(_0x2090d0,_0xb1a230){return function(_0x391cb9){if(_0x391cb9){var _0x5bb20e=_0x391cb9[_0xc8a5('0x1e')],_0xbc4806=_0xb1a230[_0xc8a5('0x1f')],_0x44d436=_0xb1a230['offset']+_0xb1a230[_0xc8a5('0x20')],_0x5cb7ff;if(_0x44d436>=_0x5bb20e){_0x44d436=_0x5bb20e;_0x5cb7ff=0xc8;}else{_0x5cb7ff=0xce;}_0x2090d0[_0xc8a5('0x1c')](_0x5cb7ff);return _0x2090d0[_0xc8a5('0x21')](_0xc8a5('0x22'),_0xbc4806+'-'+_0x44d436+'/'+_0x5bb20e)[_0xc8a5('0x1d')](_0x391cb9);}return null;};}function patchUpdates(_0x4b0aa0){return function(_0x35b2e0){try{jsonpatch['apply'](_0x35b2e0,_0x4b0aa0,!![]);}catch(_0xb4e8ae){return BPromise[_0xc8a5('0x23')](_0xb4e8ae);}return _0x35b2e0['save']();};}function saveUpdates(_0x4c7c8a,_0x866737){return function(_0x388c4e){if(_0x388c4e){return _0x388c4e[_0xc8a5('0x24')](_0x4c7c8a)[_0xc8a5('0x25')](function(_0x160986){return _0x160986;});}return null;};}function removeEntity(_0x5411a7,_0x4fec79){return function(_0x3e2058){if(_0x3e2058){return _0x3e2058[_0xc8a5('0x26')]()[_0xc8a5('0x25')](function(){var _0xed5da4=_0x3e2058[_0xc8a5('0x27')]({'plain':!![]});var _0x23edb3='Metrics';return db[_0xc8a5('0x28')][_0xc8a5('0x26')]({'where':{'type':_0x23edb3,'resourceId':_0xed5da4['id']}})[_0xc8a5('0x25')](function(){return _0x3e2058;});})[_0xc8a5('0x25')](function(){_0x5411a7[_0xc8a5('0x1c')](0xcc)[_0xc8a5('0x1b')]();});}};}function handleEntityNotFound(_0x3b325d,_0x3bbbdc){return function(_0x1ac715){if(!_0x1ac715){_0x3b325d['sendStatus'](0x194);}return _0x1ac715;};}function handleError(_0x11e162,_0x58576e){_0x58576e=_0x58576e||0x1f4;return function(_0x184bd2){logger[_0xc8a5('0x29')](_0x184bd2[_0xc8a5('0x2a')]);if(_0x184bd2[_0xc8a5('0x2b')]){delete _0x184bd2[_0xc8a5('0x2b')];}_0x11e162['status'](_0x58576e)['send'](_0x184bd2);};}exports[_0xc8a5('0x2c')]=function(_0x4e0a4b,_0x4ef3d7){var _0x1d1513={},_0x10972d={},_0x14422f={'count':0x0,'rows':[]};var _0x1715f5=_[_0xc8a5('0x2d')](db[_0xc8a5('0x2e')]['rawAttributes'],function(_0x240e07){return{'name':_0x240e07[_0xc8a5('0x2f')],'type':_0x240e07[_0xc8a5('0x30')][_0xc8a5('0x31')]};});_0x10972d[_0xc8a5('0x32')]=_[_0xc8a5('0x2d')](_0x1715f5,'name');_0x10972d[_0xc8a5('0x33')]=_[_0xc8a5('0x34')](_0x4e0a4b[_0xc8a5('0x33')]);_0x10972d[_0xc8a5('0x35')]=_['intersection'](_0x10972d['model'],_0x10972d[_0xc8a5('0x33')]);_0x1d1513[_0xc8a5('0x36')]=_[_0xc8a5('0x37')](_0x10972d[_0xc8a5('0x32')],qs[_0xc8a5('0x38')](_0x4e0a4b['query'][_0xc8a5('0x38')]));_0x1d1513['attributes']=_0x1d1513[_0xc8a5('0x36')][_0xc8a5('0x39')]?_0x1d1513[_0xc8a5('0x36')]:_0x10972d['model'];if(!_0x4e0a4b[_0xc8a5('0x33')][_0xc8a5('0x3a')](_0xc8a5('0x3b'))){_0x1d1513['limit']=qs[_0xc8a5('0x20')](_0x4e0a4b[_0xc8a5('0x33')]['limit']);_0x1d1513[_0xc8a5('0x1f')]=qs['offset'](_0x4e0a4b['query']['offset']);}_0x1d1513['order']=qs['sort'](_0x4e0a4b[_0xc8a5('0x33')]['sort']);_0x1d1513[_0xc8a5('0x3c')]=qs[_0xc8a5('0x35')](_[_0xc8a5('0x3d')](_0x4e0a4b[_0xc8a5('0x33')],_0x10972d[_0xc8a5('0x35')]),_0x1715f5);if(_0x4e0a4b[_0xc8a5('0x33')][_0xc8a5('0x3e')]){_0x1d1513['where']=_[_0xc8a5('0x3f')](_0x1d1513[_0xc8a5('0x3c')],{'$or':_['map'](_0x1715f5,function(_0x369097){if(_0x369097['type']!=='VIRTUAL'){var _0x4020ec={};_0x4020ec[_0x369097[_0xc8a5('0x2b')]]={'$like':'%'+_0x4e0a4b[_0xc8a5('0x33')]['filter']+'%'};return _0x4020ec;}})});}_0x1d1513=_['merge']({},_0x1d1513,_0x4e0a4b[_0xc8a5('0x40')]);var _0x28b535={'where':_0x1d1513[_0xc8a5('0x3c')]};return db[_0xc8a5('0x2e')]['count'](_0x28b535)[_0xc8a5('0x25')](function(_0xbaa3fc){_0x14422f[_0xc8a5('0x1e')]=_0xbaa3fc;if(_0x4e0a4b['query']['includeAll']){_0x1d1513[_0xc8a5('0x41')]=[{'all':!![]}];}return db[_0xc8a5('0x2e')][_0xc8a5('0x42')](_0x1d1513);})[_0xc8a5('0x25')](function(_0x1fc1ad){_0x14422f['rows']=_0x1fc1ad;return _0x14422f;})[_0xc8a5('0x25')](respondWithFilteredResult(_0x4ef3d7,_0x1d1513))['catch'](handleError(_0x4ef3d7,null));};exports['show']=function(_0x4e5fb2,_0xda7b11){var _0x3a5f8f={'raw':!![],'where':{'id':_0x4e5fb2[_0xc8a5('0x43')]['id']}},_0x21aa6a={};_0x21aa6a[_0xc8a5('0x32')]=_[_0xc8a5('0x34')](db[_0xc8a5('0x2e')][_0xc8a5('0x44')]);_0x21aa6a[_0xc8a5('0x33')]=_[_0xc8a5('0x34')](_0x4e5fb2[_0xc8a5('0x33')]);_0x21aa6a[_0xc8a5('0x35')]=_[_0xc8a5('0x37')](_0x21aa6a[_0xc8a5('0x32')],_0x21aa6a['query']);_0x3a5f8f[_0xc8a5('0x36')]=_[_0xc8a5('0x37')](_0x21aa6a[_0xc8a5('0x32')],qs[_0xc8a5('0x38')](_0x4e5fb2[_0xc8a5('0x33')][_0xc8a5('0x38')]));_0x3a5f8f[_0xc8a5('0x36')]=_0x3a5f8f[_0xc8a5('0x36')]['length']?_0x3a5f8f['attributes']:_0x21aa6a[_0xc8a5('0x32')];if(_0x4e5fb2[_0xc8a5('0x33')][_0xc8a5('0x45')]){_0x3a5f8f['include']=[{'all':!![]}];}_0x3a5f8f=_[_0xc8a5('0x3f')]({},_0x3a5f8f,_0x4e5fb2[_0xc8a5('0x40')]);return db['AnalyticMetric'][_0xc8a5('0x46')](_0x3a5f8f)[_0xc8a5('0x25')](handleEntityNotFound(_0xda7b11,null))[_0xc8a5('0x25')](respondWithResult(_0xda7b11,null))[_0xc8a5('0x47')](handleError(_0xda7b11,null));};exports['create']=function(_0x41b2a9,_0x1bfc73){return db[_0xc8a5('0x2e')][_0xc8a5('0x48')](_0x41b2a9[_0xc8a5('0x49')],{})[_0xc8a5('0x25')](function(_0x5d2435){var _0x1b44df=_0x41b2a9[_0xc8a5('0x4a')][_0xc8a5('0x27')]({'plain':!![]});if(!_0x1b44df)throw new Error(_0xc8a5('0x4b'));if(_0x1b44df[_0xc8a5('0x4c')]===_0xc8a5('0x4a')){var _0x3ebcbc=_0x5d2435[_0xc8a5('0x27')]({'plain':!![]});var _0x43cb68=_0xc8a5('0x4d');return db[_0xc8a5('0x4e')][_0xc8a5('0x46')]({'where':{'name':_0x43cb68,'userProfileId':_0x1b44df[_0xc8a5('0x4f')]},'raw':!![]})['then'](function(_0x1bb6f1){if(_0x1bb6f1&&_0x1bb6f1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ebcbc[_0xc8a5('0x2b')],'resourceId':_0x3ebcbc['id'],'type':_0x1bb6f1['name'],'sectionId':_0x1bb6f1['id']},{})[_0xc8a5('0x25')](function(){return _0x5d2435;});}else{return _0x5d2435;}})[_0xc8a5('0x47')](function(_0x31c92f){logger[_0xc8a5('0x29')](_0xc8a5('0x50'),_0x31c92f);throw _0x31c92f;});}return _0x5d2435;})[_0xc8a5('0x25')](respondWithResult(_0x1bfc73,0xc9))[_0xc8a5('0x47')](handleError(_0x1bfc73,null));};exports[_0xc8a5('0x24')]=function(_0x99b56a,_0x4f9b24){if(_0x99b56a[_0xc8a5('0x49')]['id']){delete _0x99b56a[_0xc8a5('0x49')]['id'];}return db[_0xc8a5('0x2e')][_0xc8a5('0x46')]({'where':{'id':_0x99b56a[_0xc8a5('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f9b24,null))[_0xc8a5('0x25')](saveUpdates(_0x99b56a[_0xc8a5('0x49')],null))[_0xc8a5('0x25')](respondWithResult(_0x4f9b24,null))[_0xc8a5('0x47')](handleError(_0x4f9b24,null));};exports[_0xc8a5('0x26')]=function(_0x512c29,_0x422ef7){return db['AnalyticMetric'][_0xc8a5('0x46')]({'where':{'id':_0x512c29[_0xc8a5('0x43')]['id']}})['then'](handleEntityNotFound(_0x422ef7,null))[_0xc8a5('0x25')](removeEntity(_0x422ef7,null))['catch'](handleError(_0x422ef7,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index e2aa084..ee763fb 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 _0xc404=['analytics_metrics','util','api','moment','bluebird','request-promise','path','define','AnalyticMetric'];(function(_0x111c58,_0x5b1e16){var _0x36f0be=function(_0xcb5e2f){while(--_0xcb5e2f){_0x111c58['push'](_0x111c58['shift']());}};_0x36f0be(++_0x5b1e16);}(_0xc404,0xbe));var _0x4c40=function(_0x4e45b7,_0x1572e4){_0x4e45b7=_0x4e45b7-0x0;var _0x3678dd=_0xc404[_0x4e45b7];return _0x3678dd;};'use strict';var _=require('lodash');var util=require(_0x4c40('0x0'));var logger=require('../../config/logger')(_0x4c40('0x1'));var moment=require(_0x4c40('0x2'));var BPromise=require(_0x4c40('0x3'));var rp=require(_0x4c40('0x4'));var fs=require('fs');var path=require(_0x4c40('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x40bf92,_0x2ee250){return _0x40bf92[_0x4c40('0x6')](_0x4c40('0x7'),attributes,{'tableName':_0x4c40('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9faf=['./analyticMetric.attributes','define','AnalyticMetric','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3bf4dd,_0x3a2167){var _0x2f0070=function(_0x1347a0){while(--_0x1347a0){_0x3bf4dd['push'](_0x3bf4dd['shift']());}};_0x2f0070(++_0x3a2167);}(_0x9faf,0xc3));var _0xf9fa=function(_0x515877,_0xcc3ce7){_0x515877=_0x515877-0x0;var _0x24bfd8=_0x9faf[_0x515877];return _0x24bfd8;};'use strict';var _=require(_0xf9fa('0x0'));var util=require('util');var logger=require(_0xf9fa('0x1'))(_0xf9fa('0x2'));var moment=require(_0xf9fa('0x3'));var BPromise=require(_0xf9fa('0x4'));var rp=require(_0xf9fa('0x5'));var fs=require('fs');var path=require(_0xf9fa('0x6'));var rimraf=require(_0xf9fa('0x7'));var config=require(_0xf9fa('0x8'));var attributes=require(_0xf9fa('0x9'));module['exports']=function(_0x7e47a7,_0x510c33){return _0x7e47a7[_0xf9fa('0xa')](_0xf9fa('0xb'),attributes,{'tableName':'analytics_metrics','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 ce4bb40..8ab4960 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 _0x2e0e=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils'];(function(_0x10d175,_0x5607e9){var _0x17e404=function(_0x1e828a){while(--_0x1e828a){_0x10d175['push'](_0x10d175['shift']());}};_0x17e404(++_0x5607e9);}(_0x2e0e,0x161));var _0xe2e0=function(_0xb5fe46,_0x339612){_0xb5fe46=_0xb5fe46-0x0;var _0x414faf=_0x2e0e[_0xb5fe46];return _0x414faf;};'use strict';var _=require(_0xe2e0('0x0'));var util=require('util');var moment=require(_0xe2e0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2e0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe2e0('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xe2e0('0x4'));var jayson=require(_0xe2e0('0x5'));var client=jayson[_0xe2e0('0x6')][_0xe2e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c0193,_0x5aa51f,_0x222f54){return new BPromise(function(_0x5ebeaa,_0x2704a5){return client[_0xe2e0('0x8')](_0x4c0193,_0x222f54)[_0xe2e0('0x9')](function(_0x5949f7){logger[_0xe2e0('0xa')](_0xe2e0('0xb'),_0x5aa51f,_0xe2e0('0xc'));logger[_0xe2e0('0xd')](_0xe2e0('0xe'),_0x5aa51f,'request\x20sent',JSON[_0xe2e0('0xf')](_0x5949f7));if(_0x5949f7[_0xe2e0('0x10')]){if(_0x5949f7['error'][_0xe2e0('0x11')]===0x1f4){logger[_0xe2e0('0x10')](_0xe2e0('0xb'),_0x5aa51f,_0x5949f7['error'][_0xe2e0('0x12')]);return _0x2704a5(_0x5949f7[_0xe2e0('0x10')][_0xe2e0('0x12')]);}logger[_0xe2e0('0x10')](_0xe2e0('0xb'),_0x5aa51f,_0x5949f7[_0xe2e0('0x10')][_0xe2e0('0x12')]);return _0x5ebeaa(_0x5949f7['error'][_0xe2e0('0x12')]);}else{logger[_0xe2e0('0xa')](_0xe2e0('0xb'),_0x5aa51f,'request\x20sent');_0x5ebeaa(_0x5949f7[_0xe2e0('0x13')]['message']);}})[_0xe2e0('0x14')](function(_0x3df3fb){logger[_0xe2e0('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x5aa51f,_0x3df3fb);_0x2704a5(_0x3df3fb);});});} \ No newline at end of file +var _0x9886=['code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4f341c,_0x428c27){var _0x4a328a=function(_0x5a6af9){while(--_0x5a6af9){_0x4f341c['push'](_0x4f341c['shift']());}};_0x4a328a(++_0x428c27);}(_0x9886,0x18c));var _0x6988=function(_0x499cb3,_0xb23bb2){_0x499cb3=_0x499cb3-0x0;var _0x5a098f=_0x9886[_0x499cb3];return _0x5a098f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6988('0x0'));var BPromise=require(_0x6988('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6988('0x2'));var db=require(_0x6988('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6988('0x4'))(_0x6988('0x5'));var config=require(_0x6988('0x6'));var jayson=require(_0x6988('0x7'));var client=jayson[_0x6988('0x8')][_0x6988('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc7f9,_0x1a4f41,_0x28152a){return new BPromise(function(_0x1a5150,_0x3d84ae){return client[_0x6988('0xa')](_0x2fc7f9,_0x28152a)[_0x6988('0xb')](function(_0xc79394){logger['info'](_0x6988('0xc'),_0x1a4f41,_0x6988('0xd'));logger[_0x6988('0xe')](_0x6988('0xf'),_0x1a4f41,_0x6988('0xd'),JSON[_0x6988('0x10')](_0xc79394));if(_0xc79394['error']){if(_0xc79394[_0x6988('0x11')][_0x6988('0x12')]===0x1f4){logger['error'](_0x6988('0xc'),_0x1a4f41,_0xc79394['error'][_0x6988('0x13')]);return _0x3d84ae(_0xc79394[_0x6988('0x11')][_0x6988('0x13')]);}logger[_0x6988('0x11')](_0x6988('0xc'),_0x1a4f41,_0xc79394[_0x6988('0x11')][_0x6988('0x13')]);return _0x1a5150(_0xc79394[_0x6988('0x11')][_0x6988('0x13')]);}else{logger[_0x6988('0x14')](_0x6988('0xc'),_0x1a4f41,'request\x20sent');_0x1a5150(_0xc79394[_0x6988('0x15')][_0x6988('0x13')]);}})[_0x6988('0x16')](function(_0x53a636){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x1a4f41,_0x53a636);_0x3d84ae(_0x53a636);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b4ec8e2..1cbc7c2 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 _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x56b794,_0x50003f){var _0x80c80=function(_0x54dc03){while(--_0x54dc03){_0x56b794['push'](_0x56b794['shift']());}};_0x80c80(++_0x50003f);}(_0x2542,0x169));var _0x2254=function(_0x1bc54c,_0x513fe3){_0x1bc54c=_0x1bc54c-0x0;var _0x5d2a04=_0x2542[_0x1bc54c];return _0x5d2a04;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file +var _0x4137=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5b5f4c,_0xf1e942){var _0x29ccbf=function(_0x3d6e16){while(--_0x3d6e16){_0x5b5f4c['push'](_0x5b5f4c['shift']());}};_0x29ccbf(++_0xf1e942);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var auth=require(_0x7413('0x6'));var interaction=require(_0x7413('0x7'));var config=require(_0x7413('0x8'));var controller=require(_0x7413('0x9'));router[_0x7413('0xa')]('/',auth[_0x7413('0xb')](),controller['index']);router[_0x7413('0xa')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0xd')]);router['post']('/',auth[_0x7413('0xb')](),controller[_0x7413('0xe')]);router['put'](_0x7413('0xc'),auth[_0x7413('0xb')](),controller['update']);router[_0x7413('0xf')](_0x7413('0xc'),auth[_0x7413('0xb')](),controller[_0x7413('0x10')]);module[_0x7413('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f9509ce..c826d81 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 _0x7a8a=['TEXT','exports'];(function(_0x952577,_0x33bc11){var _0x19aa55=function(_0x30ae5f){while(--_0x30ae5f){_0x952577['push'](_0x952577['shift']());}};_0x19aa55(++_0x33bc11);}(_0x7a8a,0xa5));var _0xa7a8=function(_0x3a0e16,_0xb32c74){_0x3a0e16=_0x3a0e16-0x0;var _0x215b5e=_0x7a8a[_0x3a0e16];return _0x215b5e;};'use strict';var Sequelize=require('sequelize');module[_0xa7a8('0x0')]={'tree':{'type':Sequelize[_0xa7a8('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd060=['sequelize','exports','TEXT'];(function(_0x2392d6,_0x160084){var _0x1bc649=function(_0x95e143){while(--_0x95e143){_0x2392d6['push'](_0x2392d6['shift']());}};_0x1bc649(++_0x160084);}(_0xd060,0x72));var _0x0d06=function(_0x13445c,_0x30f9f7){_0x13445c=_0x13445c-0x0;var _0x336a6f=_0xd060[_0x13445c];return _0x336a6f;};'use strict';var Sequelize=require(_0x0d06('0x0'));module[_0x0d06('0x1')]={'tree':{'type':Sequelize[_0x0d06('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index acc2a82..6650b6b 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 _0x5b28=['catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy','error','name','map','AnalyticTreeReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows'];(function(_0x4936df,_0x369a04){var _0x1354e7=function(_0x4dbd29){while(--_0x4dbd29){_0x4936df['push'](_0x4936df['shift']());}};_0x1354e7(++_0x369a04);}(_0x5b28,0x126));var _0x85b2=function(_0x1dc993,_0xb4d44f){_0x1dc993=_0x1dc993-0x0;var _0x22e374=_0x5b28[_0x1dc993];return _0x22e374;};'use strict';var pdf=require(_0x85b2('0x0'));var emlformat=require(_0x85b2('0x1'));var rimraf=require(_0x85b2('0x2'));var zipdir=require(_0x85b2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85b2('0x4'));var moment=require(_0x85b2('0x5'));var BPromise=require(_0x85b2('0x6'));var Mustache=require(_0x85b2('0x7'));var util=require('util');var path=require(_0x85b2('0x8'));var sox=require(_0x85b2('0x9'));var csv=require(_0x85b2('0xa'));var ejs=require(_0x85b2('0xb'));var fs=require('fs');var _=require(_0x85b2('0xc'));var squel=require(_0x85b2('0xd'));var crypto=require(_0x85b2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x85b2('0xf'));var toCsv=require(_0x85b2('0xa'));var querystring=require(_0x85b2('0x10'));var Papa=require(_0x85b2('0x11'));var Redis=require(_0x85b2('0x12'));var authService=require(_0x85b2('0x13'));var qs=require(_0x85b2('0x14'));var as=require(_0x85b2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85b2('0x16'))(_0x85b2('0x17'));var utils=require(_0x85b2('0x18'));var config=require(_0x85b2('0x19'));var db=require(_0x85b2('0x1a'))['db'];function respondWithStatusCode(_0x740054,_0x32ba7e){_0x32ba7e=_0x32ba7e||0xcc;return function(_0x1d3d25){if(_0x1d3d25){return _0x740054[_0x85b2('0x1b')](_0x32ba7e);}return _0x740054[_0x85b2('0x1c')](_0x32ba7e)[_0x85b2('0x1d')]();};}function respondWithResult(_0x5ab878,_0x3c9cae){_0x3c9cae=_0x3c9cae||0xc8;return function(_0x565a42){if(_0x565a42){return _0x5ab878[_0x85b2('0x1c')](_0x3c9cae)[_0x85b2('0x1e')](_0x565a42);}};}function respondWithFilteredResult(_0x2528ef,_0x3728b1){return function(_0xa5f576){if(_0xa5f576){var _0x5991f7=_0xa5f576[_0x85b2('0x1f')],_0x7d263c=_0x3728b1[_0x85b2('0x20')],_0x5f0f17=_0x3728b1[_0x85b2('0x20')]+_0x3728b1[_0x85b2('0x21')],_0x419b24;if(_0x5f0f17>=_0x5991f7){_0x5f0f17=_0x5991f7;_0x419b24=0xc8;}else{_0x419b24=0xce;}_0x2528ef[_0x85b2('0x1c')](_0x419b24);return _0x2528ef['set']('Content-Range',_0x7d263c+'-'+_0x5f0f17+'/'+_0x5991f7)[_0x85b2('0x1e')](_0xa5f576);}return null;};}function patchUpdates(_0x5ea37a){return function(_0x599c2d){try{jsonpatch[_0x85b2('0x22')](_0x599c2d,_0x5ea37a,!![]);}catch(_0xc437cd){return BPromise[_0x85b2('0x23')](_0xc437cd);}return _0x599c2d['save']();};}function saveUpdates(_0x52ff9d,_0x2c0890){return function(_0x409d66){if(_0x409d66){return _0x409d66[_0x85b2('0x24')](_0x52ff9d)[_0x85b2('0x25')](function(_0x2a1920){return _0x2a1920;});}return null;};}function removeEntity(_0x4089d2,_0x797ad4){return function(_0x180287){if(_0x180287){return _0x180287[_0x85b2('0x26')]()[_0x85b2('0x25')](function(){_0x4089d2[_0x85b2('0x1c')](0xcc)[_0x85b2('0x1d')]();});}};}function handleEntityNotFound(_0x3cebe4,_0x2a6ecf){return function(_0x453e7d){if(!_0x453e7d){_0x3cebe4['sendStatus'](0x194);}return _0x453e7d;};}function handleError(_0x184f8a,_0x20811f){_0x20811f=_0x20811f||0x1f4;return function(_0x38a531){logger[_0x85b2('0x27')](_0x38a531['stack']);if(_0x38a531[_0x85b2('0x28')]){delete _0x38a531[_0x85b2('0x28')];}_0x184f8a[_0x85b2('0x1c')](_0x20811f)['send'](_0x38a531);};}exports['index']=function(_0x59f03a,_0x1714d5){var _0x2d4142={},_0x3cae56={},_0x4b4197={'count':0x0,'rows':[]};var _0x16bbd1=_[_0x85b2('0x29')](db[_0x85b2('0x2a')][_0x85b2('0x2b')],function(_0x303bd3){return{'name':_0x303bd3[_0x85b2('0x2c')],'type':_0x303bd3['type']['key']};});_0x3cae56['model']=_[_0x85b2('0x29')](_0x16bbd1,_0x85b2('0x28'));_0x3cae56[_0x85b2('0x2d')]=_[_0x85b2('0x2e')](_0x59f03a[_0x85b2('0x2d')]);_0x3cae56[_0x85b2('0x2f')]=_[_0x85b2('0x30')](_0x3cae56[_0x85b2('0x31')],_0x3cae56['query']);_0x2d4142[_0x85b2('0x32')]=_[_0x85b2('0x30')](_0x3cae56[_0x85b2('0x31')],qs[_0x85b2('0x33')](_0x59f03a['query'][_0x85b2('0x33')]));_0x2d4142['attributes']=_0x2d4142[_0x85b2('0x32')][_0x85b2('0x34')]?_0x2d4142[_0x85b2('0x32')]:_0x3cae56[_0x85b2('0x31')];if(!_0x59f03a['query'][_0x85b2('0x35')](_0x85b2('0x36'))){_0x2d4142[_0x85b2('0x21')]=qs['limit'](_0x59f03a[_0x85b2('0x2d')][_0x85b2('0x21')]);_0x2d4142['offset']=qs['offset'](_0x59f03a['query']['offset']);}_0x2d4142[_0x85b2('0x37')]=qs[_0x85b2('0x38')](_0x59f03a[_0x85b2('0x2d')][_0x85b2('0x38')]);_0x2d4142['where']=qs['filters'](_['pick'](_0x59f03a[_0x85b2('0x2d')],_0x3cae56[_0x85b2('0x2f')]),_0x16bbd1);if(_0x59f03a['query'][_0x85b2('0x39')]){_0x2d4142['where']=_[_0x85b2('0x3a')](_0x2d4142[_0x85b2('0x3b')],{'$or':_[_0x85b2('0x29')](_0x16bbd1,function(_0x1f673f){if(_0x1f673f[_0x85b2('0x3c')]!==_0x85b2('0x3d')){var _0x5e846c={};_0x5e846c[_0x1f673f[_0x85b2('0x28')]]={'$like':'%'+_0x59f03a[_0x85b2('0x2d')]['filter']+'%'};return _0x5e846c;}})});}_0x2d4142=_[_0x85b2('0x3a')]({},_0x2d4142,_0x59f03a[_0x85b2('0x3e')]);var _0x1ed1ff={'where':_0x2d4142['where']};return db[_0x85b2('0x2a')][_0x85b2('0x1f')](_0x1ed1ff)[_0x85b2('0x25')](function(_0x3c5d11){_0x4b4197['count']=_0x3c5d11;if(_0x59f03a[_0x85b2('0x2d')][_0x85b2('0x3f')]){_0x2d4142[_0x85b2('0x40')]=[{'all':!![]}];}return db[_0x85b2('0x2a')]['findAll'](_0x2d4142);})[_0x85b2('0x25')](function(_0x1e5570){_0x4b4197[_0x85b2('0x41')]=_0x1e5570;return _0x4b4197;})[_0x85b2('0x25')](respondWithFilteredResult(_0x1714d5,_0x2d4142))[_0x85b2('0x42')](handleError(_0x1714d5,null));};exports[_0x85b2('0x43')]=function(_0x591049,_0x292b09){var _0x5bedf1={'raw':!![],'where':{'id':_0x591049['params']['id']}},_0x19abf7={};_0x19abf7[_0x85b2('0x31')]=_[_0x85b2('0x2e')](db[_0x85b2('0x2a')][_0x85b2('0x2b')]);_0x19abf7[_0x85b2('0x2d')]=_['keys'](_0x591049[_0x85b2('0x2d')]);_0x19abf7['filters']=_[_0x85b2('0x30')](_0x19abf7['model'],_0x19abf7[_0x85b2('0x2d')]);_0x5bedf1[_0x85b2('0x32')]=_[_0x85b2('0x30')](_0x19abf7[_0x85b2('0x31')],qs[_0x85b2('0x33')](_0x591049[_0x85b2('0x2d')]['fields']));_0x5bedf1[_0x85b2('0x32')]=_0x5bedf1['attributes'][_0x85b2('0x34')]?_0x5bedf1[_0x85b2('0x32')]:_0x19abf7[_0x85b2('0x31')];if(_0x591049['query']['includeAll']){_0x5bedf1[_0x85b2('0x40')]=[{'all':!![]}];}_0x5bedf1=_[_0x85b2('0x3a')]({},_0x5bedf1,_0x591049[_0x85b2('0x3e')]);return db['AnalyticTreeReport'][_0x85b2('0x44')](_0x5bedf1)[_0x85b2('0x25')](handleEntityNotFound(_0x292b09,null))[_0x85b2('0x25')](respondWithResult(_0x292b09,null))[_0x85b2('0x42')](handleError(_0x292b09,null));};exports[_0x85b2('0x45')]=function(_0x123a82,_0x2cf3a0){return db[_0x85b2('0x2a')][_0x85b2('0x45')](_0x123a82['body'],{})['then'](respondWithResult(_0x2cf3a0,0xc9))['catch'](handleError(_0x2cf3a0,null));};exports[_0x85b2('0x24')]=function(_0x3fbe5a,_0x216ce9){if(_0x3fbe5a[_0x85b2('0x46')]['id']){delete _0x3fbe5a[_0x85b2('0x46')]['id'];}return db['AnalyticTreeReport'][_0x85b2('0x44')]({'where':{'id':_0x3fbe5a[_0x85b2('0x47')]['id']}})[_0x85b2('0x25')](handleEntityNotFound(_0x216ce9,null))[_0x85b2('0x25')](saveUpdates(_0x3fbe5a[_0x85b2('0x46')],null))[_0x85b2('0x25')](respondWithResult(_0x216ce9,null))[_0x85b2('0x42')](handleError(_0x216ce9,null));};exports[_0x85b2('0x26')]=function(_0x1ecc0e,_0x2a1130){return db[_0x85b2('0x2a')][_0x85b2('0x44')]({'where':{'id':_0x1ecc0e[_0x85b2('0x47')]['id']}})[_0x85b2('0x25')](handleEntityNotFound(_0x2a1130,null))[_0x85b2('0x25')](removeEntity(_0x2a1130,null))[_0x85b2('0x42')](handleError(_0x2a1130,null));}; \ No newline at end of file +var _0x9247=['map','AnalyticTreeReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','stack','name','send','index'];(function(_0x2c9ef8,_0x409e56){var _0x382d28=function(_0x415071){while(--_0x415071){_0x2c9ef8['push'](_0x2c9ef8['shift']());}};_0x382d28(++_0x409e56);}(_0x9247,0x14d));var _0x7924=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0x9247[_0x471448];return _0x38190b;};'use strict';var pdf=require(_0x7924('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7924('0x1'));var zipdir=require(_0x7924('0x2'));var jsonpatch=require(_0x7924('0x3'));var rp=require(_0x7924('0x4'));var moment=require('moment');var BPromise=require(_0x7924('0x5'));var Mustache=require(_0x7924('0x6'));var util=require(_0x7924('0x7'));var path=require(_0x7924('0x8'));var sox=require(_0x7924('0x9'));var csv=require('to-csv');var ejs=require(_0x7924('0xa'));var fs=require('fs');var _=require(_0x7924('0xb'));var squel=require(_0x7924('0xc'));var crypto=require(_0x7924('0xd'));var jsforce=require(_0x7924('0xe'));var deskjs=require(_0x7924('0xf'));var toCsv=require(_0x7924('0x10'));var querystring=require('querystring');var Papa=require(_0x7924('0x11'));var Redis=require('ioredis');var authService=require(_0x7924('0x12'));var qs=require(_0x7924('0x13'));var as=require(_0x7924('0x14'));var hardwareService=require(_0x7924('0x15'));var logger=require(_0x7924('0x16'))(_0x7924('0x17'));var utils=require(_0x7924('0x18'));var config=require('../../config/environment');var db=require(_0x7924('0x19'))['db'];function respondWithStatusCode(_0x30ab7e,_0x196c39){_0x196c39=_0x196c39||0xcc;return function(_0x360aab){if(_0x360aab){return _0x30ab7e['sendStatus'](_0x196c39);}return _0x30ab7e[_0x7924('0x1a')](_0x196c39)[_0x7924('0x1b')]();};}function respondWithResult(_0xbaeec3,_0x565b31){_0x565b31=_0x565b31||0xc8;return function(_0x222b0d){if(_0x222b0d){return _0xbaeec3[_0x7924('0x1a')](_0x565b31)['json'](_0x222b0d);}};}function respondWithFilteredResult(_0x4f179c,_0x21f1c4){return function(_0x1e2330){if(_0x1e2330){var _0x37efb6=_0x1e2330[_0x7924('0x1c')],_0x4ad5f6=_0x21f1c4['offset'],_0x3ce9e0=_0x21f1c4[_0x7924('0x1d')]+_0x21f1c4[_0x7924('0x1e')],_0x4bbce7;if(_0x3ce9e0>=_0x37efb6){_0x3ce9e0=_0x37efb6;_0x4bbce7=0xc8;}else{_0x4bbce7=0xce;}_0x4f179c[_0x7924('0x1a')](_0x4bbce7);return _0x4f179c[_0x7924('0x1f')](_0x7924('0x20'),_0x4ad5f6+'-'+_0x3ce9e0+'/'+_0x37efb6)[_0x7924('0x21')](_0x1e2330);}return null;};}function patchUpdates(_0x1facc3){return function(_0x2f0373){try{jsonpatch[_0x7924('0x22')](_0x2f0373,_0x1facc3,!![]);}catch(_0x18de16){return BPromise[_0x7924('0x23')](_0x18de16);}return _0x2f0373[_0x7924('0x24')]();};}function saveUpdates(_0x29a8d1,_0x5381ee){return function(_0x140138){if(_0x140138){return _0x140138['update'](_0x29a8d1)[_0x7924('0x25')](function(_0x5ba463){return _0x5ba463;});}return null;};}function removeEntity(_0x1235af,_0x2cf3dd){return function(_0x42622f){if(_0x42622f){return _0x42622f['destroy']()[_0x7924('0x25')](function(){_0x1235af['status'](0xcc)[_0x7924('0x1b')]();});}};}function handleEntityNotFound(_0x5d9472,_0xef366d){return function(_0x4725b5){if(!_0x4725b5){_0x5d9472['sendStatus'](0x194);}return _0x4725b5;};}function handleError(_0x1a6c5b,_0x1e8a1a){_0x1e8a1a=_0x1e8a1a||0x1f4;return function(_0x11da13){logger['error'](_0x11da13[_0x7924('0x26')]);if(_0x11da13[_0x7924('0x27')]){delete _0x11da13[_0x7924('0x27')];}_0x1a6c5b[_0x7924('0x1a')](_0x1e8a1a)[_0x7924('0x28')](_0x11da13);};}exports[_0x7924('0x29')]=function(_0x3c2e35,_0x3b02fb){var _0x480462={},_0x188eb6={},_0x2f9a3f={'count':0x0,'rows':[]};var _0x4241c7=_[_0x7924('0x2a')](db[_0x7924('0x2b')]['rawAttributes'],function(_0x1e909a){return{'name':_0x1e909a[_0x7924('0x2c')],'type':_0x1e909a[_0x7924('0x2d')]['key']};});_0x188eb6[_0x7924('0x2e')]=_[_0x7924('0x2a')](_0x4241c7,'name');_0x188eb6[_0x7924('0x2f')]=_[_0x7924('0x30')](_0x3c2e35[_0x7924('0x2f')]);_0x188eb6[_0x7924('0x31')]=_[_0x7924('0x32')](_0x188eb6[_0x7924('0x2e')],_0x188eb6['query']);_0x480462[_0x7924('0x33')]=_[_0x7924('0x32')](_0x188eb6[_0x7924('0x2e')],qs[_0x7924('0x34')](_0x3c2e35[_0x7924('0x2f')][_0x7924('0x34')]));_0x480462[_0x7924('0x33')]=_0x480462['attributes'][_0x7924('0x35')]?_0x480462[_0x7924('0x33')]:_0x188eb6[_0x7924('0x2e')];if(!_0x3c2e35['query'][_0x7924('0x36')](_0x7924('0x37'))){_0x480462[_0x7924('0x1e')]=qs['limit'](_0x3c2e35[_0x7924('0x2f')][_0x7924('0x1e')]);_0x480462[_0x7924('0x1d')]=qs['offset'](_0x3c2e35['query'][_0x7924('0x1d')]);}_0x480462[_0x7924('0x38')]=qs[_0x7924('0x39')](_0x3c2e35['query'][_0x7924('0x39')]);_0x480462['where']=qs[_0x7924('0x31')](_['pick'](_0x3c2e35[_0x7924('0x2f')],_0x188eb6[_0x7924('0x31')]),_0x4241c7);if(_0x3c2e35[_0x7924('0x2f')][_0x7924('0x3a')]){_0x480462[_0x7924('0x3b')]=_['merge'](_0x480462[_0x7924('0x3b')],{'$or':_[_0x7924('0x2a')](_0x4241c7,function(_0x5ed76f){if(_0x5ed76f['type']!=='VIRTUAL'){var _0xe797ff={};_0xe797ff[_0x5ed76f[_0x7924('0x27')]]={'$like':'%'+_0x3c2e35[_0x7924('0x2f')][_0x7924('0x3a')]+'%'};return _0xe797ff;}})});}_0x480462=_[_0x7924('0x3c')]({},_0x480462,_0x3c2e35[_0x7924('0x3d')]);var _0x2dc2e6={'where':_0x480462['where']};return db[_0x7924('0x2b')][_0x7924('0x1c')](_0x2dc2e6)[_0x7924('0x25')](function(_0x26bf95){_0x2f9a3f[_0x7924('0x1c')]=_0x26bf95;if(_0x3c2e35[_0x7924('0x2f')][_0x7924('0x3e')]){_0x480462[_0x7924('0x3f')]=[{'all':!![]}];}return db[_0x7924('0x2b')][_0x7924('0x40')](_0x480462);})[_0x7924('0x25')](function(_0x4148d3){_0x2f9a3f[_0x7924('0x41')]=_0x4148d3;return _0x2f9a3f;})[_0x7924('0x25')](respondWithFilteredResult(_0x3b02fb,_0x480462))[_0x7924('0x42')](handleError(_0x3b02fb,null));};exports[_0x7924('0x43')]=function(_0x4214b4,_0xa40240){var _0x98c101={'raw':!![],'where':{'id':_0x4214b4[_0x7924('0x44')]['id']}},_0x1051b9={};_0x1051b9[_0x7924('0x2e')]=_[_0x7924('0x30')](db[_0x7924('0x2b')][_0x7924('0x45')]);_0x1051b9[_0x7924('0x2f')]=_[_0x7924('0x30')](_0x4214b4[_0x7924('0x2f')]);_0x1051b9[_0x7924('0x31')]=_['intersection'](_0x1051b9[_0x7924('0x2e')],_0x1051b9[_0x7924('0x2f')]);_0x98c101[_0x7924('0x33')]=_[_0x7924('0x32')](_0x1051b9[_0x7924('0x2e')],qs[_0x7924('0x34')](_0x4214b4[_0x7924('0x2f')][_0x7924('0x34')]));_0x98c101[_0x7924('0x33')]=_0x98c101[_0x7924('0x33')][_0x7924('0x35')]?_0x98c101['attributes']:_0x1051b9[_0x7924('0x2e')];if(_0x4214b4[_0x7924('0x2f')]['includeAll']){_0x98c101[_0x7924('0x3f')]=[{'all':!![]}];}_0x98c101=_[_0x7924('0x3c')]({},_0x98c101,_0x4214b4[_0x7924('0x3d')]);return db['AnalyticTreeReport'][_0x7924('0x46')](_0x98c101)[_0x7924('0x25')](handleEntityNotFound(_0xa40240,null))[_0x7924('0x25')](respondWithResult(_0xa40240,null))[_0x7924('0x42')](handleError(_0xa40240,null));};exports[_0x7924('0x47')]=function(_0x5edacb,_0x4db454){return db[_0x7924('0x2b')][_0x7924('0x47')](_0x5edacb[_0x7924('0x48')],{})[_0x7924('0x25')](respondWithResult(_0x4db454,0xc9))[_0x7924('0x42')](handleError(_0x4db454,null));};exports[_0x7924('0x49')]=function(_0x5a5952,_0x5d6c86){if(_0x5a5952[_0x7924('0x48')]['id']){delete _0x5a5952['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x5a5952[_0x7924('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d6c86,null))[_0x7924('0x25')](saveUpdates(_0x5a5952[_0x7924('0x48')],null))['then'](respondWithResult(_0x5d6c86,null))['catch'](handleError(_0x5d6c86,null));};exports[_0x7924('0x4a')]=function(_0x2f39cd,_0x2187c2){return db['AnalyticTreeReport'][_0x7924('0x46')]({'where':{'id':_0x2f39cd[_0x7924('0x44')]['id']}})[_0x7924('0x25')](handleEntityNotFound(_0x2187c2,null))['then'](removeEntity(_0x2187c2,null))[_0x7924('0x42')](handleError(_0x2187c2,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3aff8f8..779b8eb 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 _0xa7db=['./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa7db,0xbf));var _0xba7d=function(_0x1cfd93,_0x2e5014){_0x1cfd93=_0x1cfd93-0x0;var _0x361d75=_0xa7db[_0x1cfd93];return _0x361d75;};'use strict';var _=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var logger=require(_0xba7d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba7d('0x3'));var fs=require('fs');var path=require(_0xba7d('0x4'));var rimraf=require(_0xba7d('0x5'));var config=require(_0xba7d('0x6'));var attributes=require(_0xba7d('0x7'));module['exports']=function(_0x2f6d8d,_0x257384){return _0x2f6d8d[_0xba7d('0x8')](_0xba7d('0x9'),attributes,{'tableName':_0xba7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0954=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x0954,0x135));var _0x4095=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x0954[_0x4ed32d];return _0xf624df;};'use strict';var _=require(_0x4095('0x0'));var util=require('util');var logger=require(_0x4095('0x1'))(_0x4095('0x2'));var moment=require('moment');var BPromise=require(_0x4095('0x3'));var rp=require(_0x4095('0x4'));var fs=require('fs');var path=require(_0x4095('0x5'));var rimraf=require(_0x4095('0x6'));var config=require(_0x4095('0x7'));var attributes=require(_0x4095('0x8'));module['exports']=function(_0x543154,_0x57ad9c){return _0x543154[_0x4095('0x9')](_0x4095('0xa'),attributes,{'tableName':_0x4095('0xb'),'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 e3589c2..0567e9d 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 _0xc4d8=['error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2558e9,_0xd93b7d){var _0x4cc718=function(_0x30f525){while(--_0x30f525){_0x2558e9['push'](_0x2558e9['shift']());}};_0x4cc718(++_0xd93b7d);}(_0xc4d8,0x100));var _0x8c4d=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xc4d8[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0x8c4d('0x0'));var moment=require(_0x8c4d('0x1'));var BPromise=require(_0x8c4d('0x2'));var rs=require(_0x8c4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c4d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c4d('0x5'))(_0x8c4d('0x6'));var config=require(_0x8c4d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8c4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e35f2,_0x3399b8,_0x26052a){return new BPromise(function(_0x56acfe,_0xc88eec){return client[_0x8c4d('0x9')](_0x2e35f2,_0x26052a)[_0x8c4d('0xa')](function(_0x179c81){logger[_0x8c4d('0xb')](_0x8c4d('0xc'),_0x3399b8,_0x8c4d('0xd'));logger[_0x8c4d('0xe')](_0x8c4d('0xf'),_0x3399b8,_0x8c4d('0xd'),JSON[_0x8c4d('0x10')](_0x179c81));if(_0x179c81[_0x8c4d('0x11')]){if(_0x179c81[_0x8c4d('0x11')][_0x8c4d('0x12')]===0x1f4){logger[_0x8c4d('0x11')](_0x8c4d('0xc'),_0x3399b8,_0x179c81['error'][_0x8c4d('0x13')]);return _0xc88eec(_0x179c81[_0x8c4d('0x11')][_0x8c4d('0x13')]);}logger[_0x8c4d('0x11')](_0x8c4d('0xc'),_0x3399b8,_0x179c81[_0x8c4d('0x11')][_0x8c4d('0x13')]);return _0x56acfe(_0x179c81[_0x8c4d('0x11')][_0x8c4d('0x13')]);}else{logger[_0x8c4d('0xb')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3399b8,_0x8c4d('0xd'));_0x56acfe(_0x179c81['result'][_0x8c4d('0x13')]);}})[_0x8c4d('0x14')](function(_0x18a26e){logger[_0x8c4d('0x11')](_0x8c4d('0xc'),_0x3399b8,_0x18a26e);_0xc88eec(_0x18a26e);});});} \ No newline at end of file +var _0x7d24=['http','then','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','message','AnalyticTreeReport,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a3d20,_0x244316){var _0x33bc94=function(_0x215ba9){while(--_0x215ba9){_0x3a3d20['push'](_0x3a3d20['shift']());}};_0x33bc94(++_0x244316);}(_0x7d24,0x79));var _0x47d2=function(_0x584e5c,_0x21ab54){_0x584e5c=_0x584e5c-0x0;var _0x3e2b1b=_0x7d24[_0x584e5c];return _0x3e2b1b;};'use strict';var _=require('lodash');var util=require(_0x47d2('0x0'));var moment=require(_0x47d2('0x1'));var BPromise=require(_0x47d2('0x2'));var rs=require(_0x47d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47d2('0x4'))['db'];var utils=require(_0x47d2('0x5'));var logger=require(_0x47d2('0x6'))(_0x47d2('0x7'));var config=require(_0x47d2('0x8'));var jayson=require(_0x47d2('0x9'));var client=jayson[_0x47d2('0xa')][_0x47d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45aef8,_0x143128,_0x590829){return new BPromise(function(_0x45a942,_0xbc0cfd){return client['request'](_0x45aef8,_0x590829)[_0x47d2('0xc')](function(_0x4b0fb6){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x143128,_0x47d2('0xd'));logger[_0x47d2('0xe')](_0x47d2('0xf'),_0x143128,_0x47d2('0xd'),JSON['stringify'](_0x4b0fb6));if(_0x4b0fb6[_0x47d2('0x10')]){if(_0x4b0fb6['error']['code']===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x143128,_0x4b0fb6['error'][_0x47d2('0x11')]);return _0xbc0cfd(_0x4b0fb6[_0x47d2('0x10')]['message']);}logger[_0x47d2('0x10')](_0x47d2('0x12'),_0x143128,_0x4b0fb6[_0x47d2('0x10')][_0x47d2('0x11')]);return _0x45a942(_0x4b0fb6[_0x47d2('0x10')]['message']);}else{logger[_0x47d2('0x13')](_0x47d2('0x12'),_0x143128,'request\x20sent');_0x45a942(_0x4b0fb6[_0x47d2('0x14')][_0x47d2('0x11')]);}})[_0x47d2('0x15')](function(_0x1b2d0b){logger[_0x47d2('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x143128,_0x1b2d0b);_0xbc0cfd(_0x1b2d0b);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 0ebd6bc..cce7d26 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 _0x9e3d=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e3d,0x1e7));var _0xd9e3=function(_0x2589c6,_0x3bf2d2){_0x2589c6=_0x2589c6-0x0;var _0x41c2a9=_0x9e3d[_0x2589c6];return _0x41c2a9;};'use strict';var multer=require(_0xd9e3('0x0'));var util=require(_0xd9e3('0x1'));var path=require(_0xd9e3('0x2'));var timeout=require(_0xd9e3('0x3'));var express=require(_0xd9e3('0x4'));var router=express[_0xd9e3('0x5')]();var auth=require(_0xd9e3('0x6'));var interaction=require(_0xd9e3('0x7'));var config=require(_0xd9e3('0x8'));var controller=require(_0xd9e3('0x9'));router[_0xd9e3('0xa')]('/',auth[_0xd9e3('0xb')](),controller['index']);router['get']('/:id',auth[_0xd9e3('0xb')](),controller['show']);router[_0xd9e3('0xc')]('/',auth['isAuthenticated'](),controller[_0xd9e3('0xd')]);router[_0xd9e3('0xe')](_0xd9e3('0xf'),auth[_0xd9e3('0xb')](),controller[_0xd9e3('0x10')]);router[_0xd9e3('0x11')](_0xd9e3('0xf'),auth[_0xd9e3('0xb')](),controller[_0xd9e3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5484=['delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','update'];(function(_0x41ce34,_0x22932a){var _0x580c63=function(_0x46a806){while(--_0x46a806){_0x41ce34['push'](_0x41ce34['shift']());}};_0x580c63(++_0x22932a);}(_0x5484,0x102));var _0x4548=function(_0x1ba127,_0x382ee4){_0x1ba127=_0x1ba127-0x0;var _0x5ee9a7=_0x5484[_0x1ba127];return _0x5ee9a7;};'use strict';var multer=require('multer');var util=require(_0x4548('0x0'));var path=require(_0x4548('0x1'));var timeout=require(_0x4548('0x2'));var express=require(_0x4548('0x3'));var router=express[_0x4548('0x4')]();var auth=require(_0x4548('0x5'));var interaction=require(_0x4548('0x6'));var config=require(_0x4548('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x4548('0x8')]('/',auth[_0x4548('0x9')](),controller['index']);router[_0x4548('0x8')](_0x4548('0xa'),auth[_0x4548('0x9')](),controller[_0x4548('0xb')]);router['post']('/',auth[_0x4548('0x9')](),controller[_0x4548('0xc')]);router['put'](_0x4548('0xa'),auth[_0x4548('0x9')](),controller[_0x4548('0xd')]);router[_0x4548('0xe')](_0x4548('0xa'),auth[_0x4548('0x9')](),controller[_0x4548('0xf')]);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 6ecd467..e1e41bd 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 _0x3ebd=['STRING','exports'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x3ebd,0x14f));var _0xd3eb=function(_0x4d3402,_0x47b889){_0x4d3402=_0x4d3402-0x0;var _0x318ffc=_0x3ebd[_0x4d3402];return _0x318ffc;};'use strict';var Sequelize=require('sequelize');module[_0xd3eb('0x0')]={'name':{'type':Sequelize[_0xd3eb('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd3eb('0x1')]}}; \ No newline at end of file +var _0xfd94=['sequelize','STRING'];(function(_0x27f4d2,_0x3d1f47){var _0x521ad6=function(_0xc99cfb){while(--_0xc99cfb){_0x27f4d2['push'](_0x27f4d2['shift']());}};_0x521ad6(++_0x3d1f47);}(_0xfd94,0x112));var _0x4fd9=function(_0x3d0177,_0x5c98b1){_0x3d0177=_0x3d0177-0x0;var _0x47e974=_0xfd94[_0x3d0177];return _0x47e974;};'use strict';var Sequelize=require(_0x4fd9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x4fd9('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3908cfb..0748e07 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 _0x0d2e=['bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','find','omit','updatedAt','body','createdAt','includeAll','file','originalname','basename','filename','mimetype','create','download','findOne','rimraf','zip-dir','moment'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x0d2e,0x197));var _0xe0d2=function(_0x39a7b3,_0x9c5210){_0x39a7b3=_0x39a7b3-0x0;var _0x1e25e2=_0x0d2e[_0x39a7b3];return _0x1e25e2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe0d2('0x0'));var zipdir=require(_0xe0d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe0d2('0x2'));var BPromise=require(_0xe0d2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe0d2('0x4'));var sox=require(_0xe0d2('0x5'));var csv=require(_0xe0d2('0x6'));var ejs=require(_0xe0d2('0x7'));var fs=require('fs');var _=require(_0xe0d2('0x8'));var squel=require(_0xe0d2('0x9'));var crypto=require(_0xe0d2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe0d2('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe0d2('0xc'));var Papa=require(_0xe0d2('0xd'));var Redis=require(_0xe0d2('0xe'));var authService=require(_0xe0d2('0xf'));var qs=require(_0xe0d2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0d2('0x11'));var logger=require('../../config/logger')(_0xe0d2('0x12'));var utils=require(_0xe0d2('0x13'));var config=require(_0xe0d2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5409f3,_0x3ba5e9){_0x3ba5e9=_0x3ba5e9||0xcc;return function(_0x270b73){if(_0x270b73){return _0x5409f3[_0xe0d2('0x15')](_0x3ba5e9);}return _0x5409f3[_0xe0d2('0x16')](_0x3ba5e9)[_0xe0d2('0x17')]();};}function respondWithResult(_0x1440ad,_0x30be34){_0x30be34=_0x30be34||0xc8;return function(_0x33bd69){if(_0x33bd69){return _0x1440ad[_0xe0d2('0x16')](_0x30be34)[_0xe0d2('0x18')](_0x33bd69);}};}function respondWithFilteredResult(_0x5cfa90,_0x9046c2){return function(_0xd4e70f){if(_0xd4e70f){var _0x32180b=_0xd4e70f[_0xe0d2('0x19')],_0x335491=_0x9046c2[_0xe0d2('0x1a')],_0x1a4bdc=_0x9046c2[_0xe0d2('0x1a')]+_0x9046c2[_0xe0d2('0x1b')],_0x29fef9;if(_0x1a4bdc>=_0x32180b){_0x1a4bdc=_0x32180b;_0x29fef9=0xc8;}else{_0x29fef9=0xce;}_0x5cfa90[_0xe0d2('0x16')](_0x29fef9);return _0x5cfa90[_0xe0d2('0x1c')](_0xe0d2('0x1d'),_0x335491+'-'+_0x1a4bdc+'/'+_0x32180b)[_0xe0d2('0x18')](_0xd4e70f);}return null;};}function patchUpdates(_0x3e18be){return function(_0x29acd7){try{jsonpatch['apply'](_0x29acd7,_0x3e18be,!![]);}catch(_0x75efe6){return BPromise[_0xe0d2('0x1e')](_0x75efe6);}return _0x29acd7[_0xe0d2('0x1f')]();};}function saveUpdates(_0x514bfc,_0x73dde4){return function(_0x40eba1){if(_0x40eba1){return _0x40eba1[_0xe0d2('0x20')](_0x514bfc)[_0xe0d2('0x21')](function(_0x5c830b){return _0x5c830b;});}return null;};}function removeEntity(_0x95bacc,_0x1cf779){return function(_0x3531da){if(_0x3531da){return _0x3531da[_0xe0d2('0x22')]()['then'](function(){_0x95bacc[_0xe0d2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ca973,_0x26069a){return function(_0x2a4f0d){if(!_0x2a4f0d){_0x4ca973[_0xe0d2('0x15')](0x194);}return _0x2a4f0d;};}function handleError(_0x33fd9e,_0x24895d){_0x24895d=_0x24895d||0x1f4;return function(_0x2e4a40){logger['error'](_0x2e4a40[_0xe0d2('0x23')]);if(_0x2e4a40[_0xe0d2('0x24')]){delete _0x2e4a40[_0xe0d2('0x24')];}_0x33fd9e['status'](_0x24895d)['send'](_0x2e4a40);};}exports[_0xe0d2('0x25')]=function(_0x5b8cd9,_0x26c67e){var _0x2244d7={},_0x270516={},_0x4ecf77={'count':0x0,'rows':[]};var _0x49e320=_[_0xe0d2('0x26')](db[_0xe0d2('0x27')][_0xe0d2('0x28')],function(_0x819fdb){return{'name':_0x819fdb[_0xe0d2('0x29')],'type':_0x819fdb[_0xe0d2('0x2a')][_0xe0d2('0x2b')]};});_0x270516[_0xe0d2('0x2c')]=_[_0xe0d2('0x26')](_0x49e320,_0xe0d2('0x24'));_0x270516[_0xe0d2('0x2d')]=_[_0xe0d2('0x2e')](_0x5b8cd9[_0xe0d2('0x2d')]);_0x270516['filters']=_[_0xe0d2('0x2f')](_0x270516[_0xe0d2('0x2c')],_0x270516[_0xe0d2('0x2d')]);_0x2244d7[_0xe0d2('0x30')]=_[_0xe0d2('0x2f')](_0x270516['model'],qs[_0xe0d2('0x31')](_0x5b8cd9[_0xe0d2('0x2d')]['fields']));_0x2244d7[_0xe0d2('0x30')]=_0x2244d7[_0xe0d2('0x30')][_0xe0d2('0x32')]?_0x2244d7['attributes']:_0x270516['model'];if(!_0x5b8cd9[_0xe0d2('0x2d')][_0xe0d2('0x33')](_0xe0d2('0x34'))){_0x2244d7[_0xe0d2('0x1b')]=qs[_0xe0d2('0x1b')](_0x5b8cd9[_0xe0d2('0x2d')]['limit']);_0x2244d7[_0xe0d2('0x1a')]=qs['offset'](_0x5b8cd9[_0xe0d2('0x2d')][_0xe0d2('0x1a')]);}_0x2244d7[_0xe0d2('0x35')]=qs[_0xe0d2('0x36')](_0x5b8cd9[_0xe0d2('0x2d')][_0xe0d2('0x36')]);_0x2244d7[_0xe0d2('0x37')]=qs[_0xe0d2('0x38')](_[_0xe0d2('0x39')](_0x5b8cd9[_0xe0d2('0x2d')],_0x270516['filters']),_0x49e320);if(_0x5b8cd9[_0xe0d2('0x2d')][_0xe0d2('0x3a')]){_0x2244d7[_0xe0d2('0x37')]=_['merge'](_0x2244d7[_0xe0d2('0x37')],{'$or':_[_0xe0d2('0x26')](_0x49e320,function(_0x591049){if(_0x591049[_0xe0d2('0x2a')]!==_0xe0d2('0x3b')){var _0x356d98={};_0x356d98[_0x591049[_0xe0d2('0x24')]]={'$like':'%'+_0x5b8cd9[_0xe0d2('0x2d')][_0xe0d2('0x3a')]+'%'};return _0x356d98;}})});}_0x2244d7=_[_0xe0d2('0x3c')]({},_0x2244d7,_0x5b8cd9[_0xe0d2('0x3d')]);var _0x11bbcb={'where':_0x2244d7[_0xe0d2('0x37')]};return db[_0xe0d2('0x27')][_0xe0d2('0x19')](_0x11bbcb)[_0xe0d2('0x21')](function(_0x225e4a){_0x4ecf77[_0xe0d2('0x19')]=_0x225e4a;if(_0x5b8cd9[_0xe0d2('0x2d')]['includeAll']){_0x2244d7[_0xe0d2('0x3e')]=[{'all':!![]}];}return db[_0xe0d2('0x27')][_0xe0d2('0x3f')](_0x2244d7);})[_0xe0d2('0x21')](function(_0x3f92b7){_0x4ecf77[_0xe0d2('0x40')]=_0x3f92b7;return _0x4ecf77;})[_0xe0d2('0x21')](respondWithFilteredResult(_0x26c67e,_0x2244d7))[_0xe0d2('0x41')](handleError(_0x26c67e,null));};exports[_0xe0d2('0x42')]=function(_0x3d40bd,_0x424074){var _0x5a5a00={'raw':!![],'where':{'id':_0x3d40bd[_0xe0d2('0x43')]['id']}},_0x5969c2={};_0x5969c2[_0xe0d2('0x2c')]=_[_0xe0d2('0x2e')](db['Attachment']['rawAttributes']);_0x5969c2['query']=_['keys'](_0x3d40bd[_0xe0d2('0x2d')]);_0x5969c2[_0xe0d2('0x38')]=_[_0xe0d2('0x2f')](_0x5969c2[_0xe0d2('0x2c')],_0x5969c2[_0xe0d2('0x2d')]);_0x5a5a00[_0xe0d2('0x30')]=_['intersection'](_0x5969c2[_0xe0d2('0x2c')],qs[_0xe0d2('0x31')](_0x3d40bd[_0xe0d2('0x2d')]['fields']));_0x5a5a00[_0xe0d2('0x30')]=_0x5a5a00[_0xe0d2('0x30')][_0xe0d2('0x32')]?_0x5a5a00[_0xe0d2('0x30')]:_0x5969c2[_0xe0d2('0x2c')];if(_0x3d40bd['query']['includeAll']){_0x5a5a00[_0xe0d2('0x3e')]=[{'all':!![]}];}_0x5a5a00=_[_0xe0d2('0x3c')]({},_0x5a5a00,_0x3d40bd[_0xe0d2('0x3d')]);return db[_0xe0d2('0x27')][_0xe0d2('0x44')](_0x5a5a00)[_0xe0d2('0x21')](handleEntityNotFound(_0x424074,null))[_0xe0d2('0x21')](respondWithResult(_0x424074,null))[_0xe0d2('0x41')](handleError(_0x424074,null));};exports['clone']=function(_0x372a46,_0x1fad87){var _0x4ae5f3={'where':{'id':_0x372a46[_0xe0d2('0x43')]['id']}},_0x20a38e={};_0x20a38e['model']=_[_0xe0d2('0x2e')](db[_0xe0d2('0x27')]['rawAttributes']);_0x4ae5f3[_0xe0d2('0x30')]=_[_0xe0d2('0x2f')](_0x20a38e[_0xe0d2('0x2c')],qs[_0xe0d2('0x31')](_0x372a46['query'][_0xe0d2('0x31')]));_0x4ae5f3[_0xe0d2('0x30')]=_0x4ae5f3[_0xe0d2('0x30')]['length']?_0x4ae5f3[_0xe0d2('0x30')]:_0x20a38e[_0xe0d2('0x2c')];if(_0x372a46[_0xe0d2('0x2d')]['includeAll']){_0x4ae5f3[_0xe0d2('0x3e')]=[{'all':!![]}];}_0x4ae5f3=_['merge']({},_0x4ae5f3,_0x372a46[_0xe0d2('0x3d')]);return db['Attachment'][_0xe0d2('0x44')](_0x4ae5f3)[_0xe0d2('0x21')](handleEntityNotFound(_0x1fad87,null))[_0xe0d2('0x21')](function(_0x1e04c2){if(_0x1e04c2){var _0x519c10=_0x1e04c2['get']({'plain':!![]});_0x519c10=qs[_0xe0d2('0x45')](_0x519c10,['id','createdAt',_0xe0d2('0x46')]);_0x372a46['body']=_['omit'](_0x372a46[_0xe0d2('0x47')],['id',_0xe0d2('0x48'),'updatedAt']);return db[_0xe0d2('0x27')]['create'](_['merge'](_0x519c10,_0x372a46[_0xe0d2('0x47')]),{'include':_0x372a46[_0xe0d2('0x2d')][_0xe0d2('0x49')]?[{'all':!![]}]:undefined});}})[_0xe0d2('0x21')](respondWithResult(_0x1fad87,0xc9))[_0xe0d2('0x41')](handleError(_0x1fad87,null));};exports[_0xe0d2('0x20')]=function(_0x3cb05a,_0x3d0530){if(_0x3cb05a[_0xe0d2('0x47')]['id']){delete _0x3cb05a[_0xe0d2('0x47')]['id'];}return db['Attachment'][_0xe0d2('0x44')]({'where':{'id':_0x3cb05a['params']['id']}})['then'](handleEntityNotFound(_0x3d0530,null))[_0xe0d2('0x21')](saveUpdates(_0x3cb05a[_0xe0d2('0x47')],null))[_0xe0d2('0x21')](respondWithResult(_0x3d0530,null))[_0xe0d2('0x41')](handleError(_0x3d0530,null));};exports[_0xe0d2('0x22')]=function(_0x14884a,_0x4b59cf){return db[_0xe0d2('0x27')][_0xe0d2('0x44')]({'where':{'id':_0x14884a['params']['id']}})[_0xe0d2('0x21')](handleEntityNotFound(_0x4b59cf,null))['then'](removeEntity(_0x4b59cf,null))[_0xe0d2('0x41')](handleError(_0x4b59cf,null));};exports['create']=function(_0x5f4d40,_0x1587ac,_0x479412){_0x5f4d40[_0xe0d2('0x47')][_0xe0d2('0x24')]=_0x5f4d40[_0xe0d2('0x4a')][_0xe0d2('0x4b')];_0x5f4d40['body'][_0xe0d2('0x4c')]=_0x5f4d40[_0xe0d2('0x4a')][_0xe0d2('0x4d')];_0x5f4d40[_0xe0d2('0x47')][_0xe0d2('0x2a')]=_0x5f4d40['file'][_0xe0d2('0x4e')];return db[_0xe0d2('0x27')][_0xe0d2('0x4f')](_0x5f4d40['body'])[_0xe0d2('0x21')](respondWithResult(_0x1587ac,0xc9))[_0xe0d2('0x41')](handleError(_0x1587ac,null));};exports[_0xe0d2('0x50')]=function(_0x6306c9,_0x41dd1b,_0x4fac15){return db['Attachment'][_0xe0d2('0x51')]({'where':{'id':_0x6306c9[_0xe0d2('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x41dd1b,null))[_0xe0d2('0x21')](function(_0x866960){if(_0x866960){return _0x41dd1b[_0xe0d2('0x50')](path['join'](config['root'],'server/files/attachments/',_0x866960[_0xe0d2('0x4c')]));}})[_0xe0d2('0x41')](handleError(_0x41dd1b,null));}; \ No newline at end of file +var _0x0eb7=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','intersection','include','find','catch','clone','params','updatedAt','body','createdAt','create','file','originalname','filename','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Attachment','rawAttributes','fieldName','type','keys','query','filters','model','attributes','fields'];(function(_0x5a066a,_0x199801){var _0x4137ee=function(_0x6a5be){while(--_0x6a5be){_0x5a066a['push'](_0x5a066a['shift']());}};_0x4137ee(++_0x199801);}(_0x0eb7,0x12e));var _0x70eb=function(_0x4fb41f,_0x2cfcce){_0x4fb41f=_0x4fb41f-0x0;var _0x17393d=_0x0eb7[_0x4fb41f];return _0x17393d;};'use strict';var pdf=require(_0x70eb('0x0'));var emlformat=require(_0x70eb('0x1'));var rimraf=require(_0x70eb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70eb('0x3'));var rp=require(_0x70eb('0x4'));var moment=require(_0x70eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x70eb('0x6'));var util=require(_0x70eb('0x7'));var path=require(_0x70eb('0x8'));var sox=require(_0x70eb('0x9'));var csv=require(_0x70eb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x70eb('0xb'));var squel=require(_0x70eb('0xc'));var crypto=require(_0x70eb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x70eb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x70eb('0xf'));var Papa=require(_0x70eb('0x10'));var Redis=require(_0x70eb('0x11'));var authService=require(_0x70eb('0x12'));var qs=require(_0x70eb('0x13'));var as=require(_0x70eb('0x14'));var hardwareService=require(_0x70eb('0x15'));var logger=require(_0x70eb('0x16'))(_0x70eb('0x17'));var utils=require(_0x70eb('0x18'));var config=require(_0x70eb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29f91e,_0x3a7d9f){_0x3a7d9f=_0x3a7d9f||0xcc;return function(_0x18870e){if(_0x18870e){return _0x29f91e[_0x70eb('0x1a')](_0x3a7d9f);}return _0x29f91e[_0x70eb('0x1b')](_0x3a7d9f)[_0x70eb('0x1c')]();};}function respondWithResult(_0x4adb5a,_0x3005ff){_0x3005ff=_0x3005ff||0xc8;return function(_0x124adb){if(_0x124adb){return _0x4adb5a[_0x70eb('0x1b')](_0x3005ff)[_0x70eb('0x1d')](_0x124adb);}};}function respondWithFilteredResult(_0x55d1b9,_0xe43b61){return function(_0xe0678b){if(_0xe0678b){var _0x5ab9ae=_0xe0678b['count'],_0x41730=_0xe43b61[_0x70eb('0x1e')],_0x3dd499=_0xe43b61['offset']+_0xe43b61['limit'],_0xc59452;if(_0x3dd499>=_0x5ab9ae){_0x3dd499=_0x5ab9ae;_0xc59452=0xc8;}else{_0xc59452=0xce;}_0x55d1b9[_0x70eb('0x1b')](_0xc59452);return _0x55d1b9[_0x70eb('0x1f')](_0x70eb('0x20'),_0x41730+'-'+_0x3dd499+'/'+_0x5ab9ae)[_0x70eb('0x1d')](_0xe0678b);}return null;};}function patchUpdates(_0x231ea5){return function(_0x534fc8){try{jsonpatch[_0x70eb('0x21')](_0x534fc8,_0x231ea5,!![]);}catch(_0x1bc092){return BPromise[_0x70eb('0x22')](_0x1bc092);}return _0x534fc8[_0x70eb('0x23')]();};}function saveUpdates(_0x1795b9,_0x3098ea){return function(_0x55bf66){if(_0x55bf66){return _0x55bf66[_0x70eb('0x24')](_0x1795b9)[_0x70eb('0x25')](function(_0xf27a28){return _0xf27a28;});}return null;};}function removeEntity(_0x2bf85d,_0x40e77c){return function(_0x3845bc){if(_0x3845bc){return _0x3845bc[_0x70eb('0x26')]()['then'](function(){_0x2bf85d[_0x70eb('0x1b')](0xcc)[_0x70eb('0x1c')]();});}};}function handleEntityNotFound(_0x134b85,_0x56d51d){return function(_0x7c1004){if(!_0x7c1004){_0x134b85[_0x70eb('0x1a')](0x194);}return _0x7c1004;};}function handleError(_0x4de904,_0x1acba6){_0x1acba6=_0x1acba6||0x1f4;return function(_0x67111b){logger[_0x70eb('0x27')](_0x67111b[_0x70eb('0x28')]);if(_0x67111b[_0x70eb('0x29')]){delete _0x67111b[_0x70eb('0x29')];}_0x4de904[_0x70eb('0x1b')](_0x1acba6)[_0x70eb('0x2a')](_0x67111b);};}exports['index']=function(_0x1c16da,_0x1bd726){var _0x4fce84={},_0x1baaad={},_0x586520={'count':0x0,'rows':[]};var _0x18e9a1=_[_0x70eb('0x2b')](db[_0x70eb('0x2c')][_0x70eb('0x2d')],function(_0x476c44){return{'name':_0x476c44[_0x70eb('0x2e')],'type':_0x476c44[_0x70eb('0x2f')]['key']};});_0x1baaad['model']=_['map'](_0x18e9a1,_0x70eb('0x29'));_0x1baaad['query']=_[_0x70eb('0x30')](_0x1c16da[_0x70eb('0x31')]);_0x1baaad[_0x70eb('0x32')]=_['intersection'](_0x1baaad[_0x70eb('0x33')],_0x1baaad['query']);_0x4fce84[_0x70eb('0x34')]=_['intersection'](_0x1baaad[_0x70eb('0x33')],qs['fields'](_0x1c16da[_0x70eb('0x31')][_0x70eb('0x35')]));_0x4fce84[_0x70eb('0x34')]=_0x4fce84[_0x70eb('0x34')][_0x70eb('0x36')]?_0x4fce84[_0x70eb('0x34')]:_0x1baaad['model'];if(!_0x1c16da[_0x70eb('0x31')][_0x70eb('0x37')](_0x70eb('0x38'))){_0x4fce84[_0x70eb('0x39')]=qs[_0x70eb('0x39')](_0x1c16da[_0x70eb('0x31')]['limit']);_0x4fce84[_0x70eb('0x1e')]=qs[_0x70eb('0x1e')](_0x1c16da[_0x70eb('0x31')][_0x70eb('0x1e')]);}_0x4fce84[_0x70eb('0x3a')]=qs[_0x70eb('0x3b')](_0x1c16da[_0x70eb('0x31')][_0x70eb('0x3b')]);_0x4fce84[_0x70eb('0x3c')]=qs['filters'](_[_0x70eb('0x3d')](_0x1c16da['query'],_0x1baaad[_0x70eb('0x32')]),_0x18e9a1);if(_0x1c16da[_0x70eb('0x31')][_0x70eb('0x3e')]){_0x4fce84[_0x70eb('0x3c')]=_[_0x70eb('0x3f')](_0x4fce84[_0x70eb('0x3c')],{'$or':_[_0x70eb('0x2b')](_0x18e9a1,function(_0x2e738d){if(_0x2e738d[_0x70eb('0x2f')]!==_0x70eb('0x40')){var _0x7e7d89={};_0x7e7d89[_0x2e738d['name']]={'$like':'%'+_0x1c16da[_0x70eb('0x31')]['filter']+'%'};return _0x7e7d89;}})});}_0x4fce84=_[_0x70eb('0x3f')]({},_0x4fce84,_0x1c16da[_0x70eb('0x41')]);var _0x524037={'where':_0x4fce84['where']};return db[_0x70eb('0x2c')][_0x70eb('0x42')](_0x524037)[_0x70eb('0x25')](function(_0x4337f0){_0x586520[_0x70eb('0x42')]=_0x4337f0;if(_0x1c16da[_0x70eb('0x31')][_0x70eb('0x43')]){_0x4fce84['include']=[{'all':!![]}];}return db['Attachment'][_0x70eb('0x44')](_0x4fce84);})[_0x70eb('0x25')](function(_0x6770f6){_0x586520[_0x70eb('0x45')]=_0x6770f6;return _0x586520;})[_0x70eb('0x25')](respondWithFilteredResult(_0x1bd726,_0x4fce84))['catch'](handleError(_0x1bd726,null));};exports[_0x70eb('0x46')]=function(_0x26492e,_0x5e8f35){var _0x4a54b4={'raw':!![],'where':{'id':_0x26492e['params']['id']}},_0x2ac471={};_0x2ac471[_0x70eb('0x33')]=_['keys'](db['Attachment']['rawAttributes']);_0x2ac471['query']=_['keys'](_0x26492e[_0x70eb('0x31')]);_0x2ac471[_0x70eb('0x32')]=_[_0x70eb('0x47')](_0x2ac471['model'],_0x2ac471['query']);_0x4a54b4[_0x70eb('0x34')]=_['intersection'](_0x2ac471[_0x70eb('0x33')],qs[_0x70eb('0x35')](_0x26492e[_0x70eb('0x31')][_0x70eb('0x35')]));_0x4a54b4[_0x70eb('0x34')]=_0x4a54b4['attributes'][_0x70eb('0x36')]?_0x4a54b4[_0x70eb('0x34')]:_0x2ac471['model'];if(_0x26492e[_0x70eb('0x31')][_0x70eb('0x43')]){_0x4a54b4[_0x70eb('0x48')]=[{'all':!![]}];}_0x4a54b4=_[_0x70eb('0x3f')]({},_0x4a54b4,_0x26492e[_0x70eb('0x41')]);return db[_0x70eb('0x2c')][_0x70eb('0x49')](_0x4a54b4)[_0x70eb('0x25')](handleEntityNotFound(_0x5e8f35,null))['then'](respondWithResult(_0x5e8f35,null))[_0x70eb('0x4a')](handleError(_0x5e8f35,null));};exports[_0x70eb('0x4b')]=function(_0xf7d075,_0x4da85d){var _0x5bfe31={'where':{'id':_0xf7d075[_0x70eb('0x4c')]['id']}},_0x117dbd={};_0x117dbd[_0x70eb('0x33')]=_[_0x70eb('0x30')](db['Attachment']['rawAttributes']);_0x5bfe31[_0x70eb('0x34')]=_['intersection'](_0x117dbd[_0x70eb('0x33')],qs[_0x70eb('0x35')](_0xf7d075[_0x70eb('0x31')]['fields']));_0x5bfe31[_0x70eb('0x34')]=_0x5bfe31['attributes'][_0x70eb('0x36')]?_0x5bfe31[_0x70eb('0x34')]:_0x117dbd[_0x70eb('0x33')];if(_0xf7d075[_0x70eb('0x31')][_0x70eb('0x43')]){_0x5bfe31['include']=[{'all':!![]}];}_0x5bfe31=_['merge']({},_0x5bfe31,_0xf7d075['options']);return db[_0x70eb('0x2c')][_0x70eb('0x49')](_0x5bfe31)[_0x70eb('0x25')](handleEntityNotFound(_0x4da85d,null))['then'](function(_0x59f423){if(_0x59f423){var _0x46df4d=_0x59f423['get']({'plain':!![]});_0x46df4d=qs['omit'](_0x46df4d,['id','createdAt',_0x70eb('0x4d')]);_0xf7d075['body']=_['omit'](_0xf7d075[_0x70eb('0x4e')],['id',_0x70eb('0x4f'),_0x70eb('0x4d')]);return db[_0x70eb('0x2c')][_0x70eb('0x50')](_['merge'](_0x46df4d,_0xf7d075['body']),{'include':_0xf7d075[_0x70eb('0x31')][_0x70eb('0x43')]?[{'all':!![]}]:undefined});}})[_0x70eb('0x25')](respondWithResult(_0x4da85d,0xc9))[_0x70eb('0x4a')](handleError(_0x4da85d,null));};exports['update']=function(_0xfa14a4,_0x1fa5fc){if(_0xfa14a4['body']['id']){delete _0xfa14a4['body']['id'];}return db['Attachment'][_0x70eb('0x49')]({'where':{'id':_0xfa14a4[_0x70eb('0x4c')]['id']}})[_0x70eb('0x25')](handleEntityNotFound(_0x1fa5fc,null))[_0x70eb('0x25')](saveUpdates(_0xfa14a4[_0x70eb('0x4e')],null))[_0x70eb('0x25')](respondWithResult(_0x1fa5fc,null))[_0x70eb('0x4a')](handleError(_0x1fa5fc,null));};exports[_0x70eb('0x26')]=function(_0x56ae6e,_0x36f4b6){return db[_0x70eb('0x2c')][_0x70eb('0x49')]({'where':{'id':_0x56ae6e['params']['id']}})[_0x70eb('0x25')](handleEntityNotFound(_0x36f4b6,null))['then'](removeEntity(_0x36f4b6,null))['catch'](handleError(_0x36f4b6,null));};exports[_0x70eb('0x50')]=function(_0x445a17,_0x18821d,_0x95e2dd){_0x445a17['body'][_0x70eb('0x29')]=_0x445a17[_0x70eb('0x51')][_0x70eb('0x52')];_0x445a17[_0x70eb('0x4e')]['basename']=_0x445a17[_0x70eb('0x51')][_0x70eb('0x53')];_0x445a17[_0x70eb('0x4e')][_0x70eb('0x2f')]=_0x445a17['file']['mimetype'];return db[_0x70eb('0x2c')][_0x70eb('0x50')](_0x445a17[_0x70eb('0x4e')])[_0x70eb('0x25')](respondWithResult(_0x18821d,0xc9))[_0x70eb('0x4a')](handleError(_0x18821d,null));};exports[_0x70eb('0x54')]=function(_0x3b927c,_0x214f9f,_0xe7ec22){return db['Attachment'][_0x70eb('0x55')]({'where':{'id':_0x3b927c[_0x70eb('0x4c')]['id']},'raw':!![]})[_0x70eb('0x25')](handleEntityNotFound(_0x214f9f,null))[_0x70eb('0x25')](function(_0x579de3){if(_0x579de3){return _0x214f9f[_0x70eb('0x54')](path[_0x70eb('0x56')](config[_0x70eb('0x57')],_0x70eb('0x58'),_0x579de3['basename']));}})[_0x70eb('0x4a')](handleError(_0x214f9f,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index e32ef1a..bd58c71 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 _0xe1e8=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','attachments'];(function(_0x4aed58,_0x3cb6c3){var _0x589275=function(_0x3a0239){while(--_0x3a0239){_0x4aed58['push'](_0x4aed58['shift']());}};_0x589275(++_0x3cb6c3);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x3b27db,_0x4fbe9c){_0x3b27db=_0x3b27db-0x0;var _0x5dceb5=_0xe1e8[_0x3b27db];return _0x5dceb5;};'use strict';var _=require(_0x8e1e('0x0'));var util=require('util');var logger=require(_0x8e1e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8e1e('0x2'));var rp=require(_0x8e1e('0x3'));var fs=require('fs');var path=require(_0x8e1e('0x4'));var rimraf=require(_0x8e1e('0x5'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x8e1e('0x6')]=function(_0xf371b5,_0x13c945){return _0xf371b5[_0x8e1e('0x7')]('Attachment',attributes,{'tableName':_0x8e1e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f75=['exports','define','Attachment','attachments','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1f75,0x13c));var _0x51f7=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x1f75[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require(_0x51f7('0x0'));var logger=require(_0x51f7('0x1'))(_0x51f7('0x2'));var moment=require(_0x51f7('0x3'));var BPromise=require(_0x51f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51f7('0x5'));var rimraf=require(_0x51f7('0x6'));var config=require(_0x51f7('0x7'));var attributes=require(_0x51f7('0x8'));module[_0x51f7('0x9')]=function(_0x1fe16a,_0x244646){return _0x1fe16a[_0x51f7('0xa')](_0x51f7('0xb'),attributes,{'tableName':_0x51f7('0xc'),'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 e3a1af1..388fe08 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 _0xad62=['error','message','result','catch','CreateAttachment','create','body','options','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xad62,0x11c));var _0x2ad6=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0xad62[_0x1ee5be];return _0x177140;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ad6('0x0'));var BPromise=require(_0x2ad6('0x1'));var rs=require(_0x2ad6('0x2'));var fs=require('fs');var Redis=require(_0x2ad6('0x3'));var db=require(_0x2ad6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ad6('0x5'))(_0x2ad6('0x6'));var config=require(_0x2ad6('0x7'));var jayson=require(_0x2ad6('0x8'));var client=jayson[_0x2ad6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x457ef3,_0x3b0029,_0x4d4ab6){return new BPromise(function(_0x131301,_0x329b02){return client['request'](_0x457ef3,_0x4d4ab6)[_0x2ad6('0xa')](function(_0x3c2eaf){logger[_0x2ad6('0xb')](_0x2ad6('0xc'),_0x3b0029,_0x2ad6('0xd'));logger['debug'](_0x2ad6('0xe'),_0x3b0029,_0x2ad6('0xd'),JSON[_0x2ad6('0xf')](_0x3c2eaf));if(_0x3c2eaf[_0x2ad6('0x10')]){if(_0x3c2eaf[_0x2ad6('0x10')]['code']===0x1f4){logger[_0x2ad6('0x10')]('Attachment,\x20%s,\x20%s',_0x3b0029,_0x3c2eaf['error'][_0x2ad6('0x11')]);return _0x329b02(_0x3c2eaf[_0x2ad6('0x10')][_0x2ad6('0x11')]);}logger[_0x2ad6('0x10')](_0x2ad6('0xc'),_0x3b0029,_0x3c2eaf[_0x2ad6('0x10')][_0x2ad6('0x11')]);return _0x131301(_0x3c2eaf[_0x2ad6('0x10')][_0x2ad6('0x11')]);}else{logger[_0x2ad6('0xb')](_0x2ad6('0xc'),_0x3b0029,_0x2ad6('0xd'));_0x131301(_0x3c2eaf[_0x2ad6('0x12')][_0x2ad6('0x11')]);}})[_0x2ad6('0x13')](function(_0x455b9e){logger[_0x2ad6('0x10')](_0x2ad6('0xc'),_0x3b0029,_0x455b9e);_0x329b02(_0x455b9e);});});}exports[_0x2ad6('0x14')]=function(_0x33981d){var _0x4e2dfa=this;return new Promise(function(_0xddc46f,_0x256955){return db['Attachment'][_0x2ad6('0x15')](_0x33981d[_0x2ad6('0x16')],{'raw':_0x33981d[_0x2ad6('0x17')]?_0x33981d[_0x2ad6('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2ad6('0xa')](function(_0x58fad3){logger[_0x2ad6('0xb')]('CreateAttachment',_0x33981d);logger[_0x2ad6('0x18')]('CreateAttachment',_0x33981d,JSON[_0x2ad6('0xf')](_0x58fad3));_0xddc46f(_0x58fad3);})[_0x2ad6('0x13')](function(_0xae25d3){logger['error']('CreateAttachment',_0xae25d3[_0x2ad6('0x11')],_0x33981d);_0x256955(_0x4e2dfa[_0x2ad6('0x10')](0x1f4,_0xae25d3[_0x2ad6('0x11')]));});});}; \ No newline at end of file +var _0x1cb7=['catch','create','body','options','raw','info','CreateAttachment','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x25c131,_0x519f04){var _0x1a2b2c=function(_0x2578be){while(--_0x2578be){_0x25c131['push'](_0x25c131['shift']());}};_0x1a2b2c(++_0x519f04);}(_0x1cb7,0xb0));var _0x71cb=function(_0x1a831b,_0x5f311f){_0x1a831b=_0x1a831b-0x0;var _0x2be1ab=_0x1cb7[_0x1a831b];return _0x2be1ab;};'use strict';var _=require(_0x71cb('0x0'));var util=require(_0x71cb('0x1'));var moment=require(_0x71cb('0x2'));var BPromise=require(_0x71cb('0x3'));var rs=require(_0x71cb('0x4'));var fs=require('fs');var Redis=require(_0x71cb('0x5'));var db=require(_0x71cb('0x6'))['db'];var utils=require(_0x71cb('0x7'));var logger=require('../../config/logger')(_0x71cb('0x8'));var config=require(_0x71cb('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a0299,_0x285f36,_0x21b734){return new BPromise(function(_0x5eae79,_0x3fbb01){return client[_0x71cb('0xa')](_0x1a0299,_0x21b734)[_0x71cb('0xb')](function(_0x38414b){logger['info'](_0x71cb('0xc'),_0x285f36,_0x71cb('0xd'));logger[_0x71cb('0xe')](_0x71cb('0xf'),_0x285f36,_0x71cb('0xd'),JSON['stringify'](_0x38414b));if(_0x38414b[_0x71cb('0x10')]){if(_0x38414b[_0x71cb('0x10')][_0x71cb('0x11')]===0x1f4){logger['error'](_0x71cb('0xc'),_0x285f36,_0x38414b[_0x71cb('0x10')]['message']);return _0x3fbb01(_0x38414b[_0x71cb('0x10')][_0x71cb('0x12')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x285f36,_0x38414b[_0x71cb('0x10')][_0x71cb('0x12')]);return _0x5eae79(_0x38414b[_0x71cb('0x10')][_0x71cb('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x285f36,_0x71cb('0xd'));_0x5eae79(_0x38414b[_0x71cb('0x13')][_0x71cb('0x12')]);}})[_0x71cb('0x14')](function(_0x4bafc8){logger['error']('Attachment,\x20%s,\x20%s',_0x285f36,_0x4bafc8);_0x3fbb01(_0x4bafc8);});});}exports['CreateAttachment']=function(_0x13fc36){var _0x6f9310=this;return new Promise(function(_0x1c1139,_0x29576c){return db['Attachment'][_0x71cb('0x15')](_0x13fc36[_0x71cb('0x16')],{'raw':_0x13fc36[_0x71cb('0x17')]?_0x13fc36[_0x71cb('0x17')][_0x71cb('0x18')]===undefined?!![]:![]:!![]})[_0x71cb('0xb')](function(_0x292730){logger[_0x71cb('0x19')](_0x71cb('0x1a'),_0x13fc36);logger[_0x71cb('0xe')](_0x71cb('0x1a'),_0x13fc36,JSON[_0x71cb('0x1b')](_0x292730));_0x1c1139(_0x292730);})[_0x71cb('0x14')](function(_0x516a67){logger[_0x71cb('0x10')](_0x71cb('0x1a'),_0x516a67[_0x71cb('0x12')],_0x13fc36);_0x29576c(_0x6f9310[_0x71cb('0x10')](0x1f4,_0x516a67[_0x71cb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8174e3f..988bd03 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 _0x5b0f=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','index','get','/:id','isAuthenticated','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','single','file'];(function(_0x5e4fb9,_0x45caf4){var _0x4189b4=function(_0x486bfa){while(--_0x486bfa){_0x5e4fb9['push'](_0x5e4fb9['shift']());}};_0x4189b4(++_0x45caf4);}(_0x5b0f,0xde));var _0xf5b0=function(_0x42aff1,_0x279acb){_0x42aff1=_0x42aff1-0x0;var _0x102349=_0x5b0f[_0x42aff1];return _0x102349;};'use strict';var multer=require('multer');var util=require(_0xf5b0('0x0'));var path=require('path');var timeout=require(_0xf5b0('0x1'));var express=require(_0xf5b0('0x2'));var router=express[_0xf5b0('0x3')]();var auth=require(_0xf5b0('0x4'));var interaction=require(_0xf5b0('0x5'));var config=require(_0xf5b0('0x6'));var controller=require(_0xf5b0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf5b0('0x8')]);router[_0xf5b0('0x9')](_0xf5b0('0xa'),auth[_0xf5b0('0xb')](),controller['show']);router[_0xf5b0('0x9')](_0xf5b0('0xc'),auth['isAuthenticated'](),controller[_0xf5b0('0xd')]);router[_0xf5b0('0xe')](_0xf5b0('0xf'),auth['isAuthenticated'](),controller[_0xf5b0('0x10')]);var upload=multer({'storage':multer[_0xf5b0('0x11')]({'destination':function(_0x1fbe22,_0x1844d5,_0x545a1f){_0x545a1f(null,path[_0xf5b0('0x12')](config[_0xf5b0('0x13')],_0xf5b0('0x14')));},'filename':function(_0x665cca,_0x3449fc,_0x4cde48){_0x4cde48(null,util[_0xf5b0('0x15')](_0xf5b0('0x16'),Date[_0xf5b0('0x17')](),_0x3449fc['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5b0('0xe')]('/',upload[_0xf5b0('0x18')](_0xf5b0('0x19')),controller['create']);router[_0xf5b0('0x1a')](_0xf5b0('0xa'),auth[_0xf5b0('0xb')](),controller[_0xf5b0('0x1b')]);router[_0xf5b0('0x1c')](_0xf5b0('0xa'),auth[_0xf5b0('0xb')](),controller[_0xf5b0('0x1d')]);module[_0xf5b0('0x1e')]=router; \ No newline at end of file +var _0xcd30=['../../config/environment','./attachment.controller','get','index','/:id','show','/:id/download','isAuthenticated','post','/:id/clone','clone','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5d8502,_0x3a7146){var _0x58804c=function(_0x4cbd38){while(--_0x4cbd38){_0x5d8502['push'](_0x5d8502['shift']());}};_0x58804c(++_0x3a7146);}(_0xcd30,0x1e8));var _0x0cd3=function(_0x133425,_0x2d60f2){_0x133425=_0x133425-0x0;var _0x45c4a4=_0xcd30[_0x133425];return _0x45c4a4;};'use strict';var multer=require(_0x0cd3('0x0'));var util=require(_0x0cd3('0x1'));var path=require(_0x0cd3('0x2'));var timeout=require(_0x0cd3('0x3'));var express=require(_0x0cd3('0x4'));var router=express[_0x0cd3('0x5')]();var auth=require(_0x0cd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0cd3('0x7'));var controller=require(_0x0cd3('0x8'));router[_0x0cd3('0x9')]('/',auth['isAuthenticated'](),controller[_0x0cd3('0xa')]);router['get'](_0x0cd3('0xb'),auth['isAuthenticated'](),controller[_0x0cd3('0xc')]);router[_0x0cd3('0x9')](_0x0cd3('0xd'),auth[_0x0cd3('0xe')](),controller['download']);router[_0x0cd3('0xf')](_0x0cd3('0x10'),auth['isAuthenticated'](),controller[_0x0cd3('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x168903,_0x1df992,_0x351d09){_0x351d09(null,path[_0x0cd3('0x12')](config[_0x0cd3('0x13')],_0x0cd3('0x14')));},'filename':function(_0x366a0f,_0x3a4cdb,_0x422d3a){_0x422d3a(null,util[_0x0cd3('0x15')](_0x0cd3('0x16'),Date[_0x0cd3('0x17')](),_0x3a4cdb[_0x0cd3('0x18')][_0x0cd3('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0cd3('0xf')]('/',upload[_0x0cd3('0x1a')]('file'),controller[_0x0cd3('0x1b')]);router[_0x0cd3('0x1c')]('/:id',auth[_0x0cd3('0xe')](),controller[_0x0cd3('0x1d')]);router[_0x0cd3('0x1e')](_0x0cd3('0xb'),auth[_0x0cd3('0xe')](),controller[_0x0cd3('0x1f')]);module[_0x0cd3('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 3b2c517..b50ff0a 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 _0x64c5=['callbackURL','allowedLoginAttempts','then','User','find','map','value','agent','disabled','blockDuration','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','callback','use','clientSecret','secret'];(function(_0x238894,_0x7399dc){var _0x448a2d=function(_0x3255bd){while(--_0x3255bd){_0x238894['push'](_0x238894['shift']());}};_0x448a2d(++_0x7399dc);}(_0x64c5,0x184));var _0x564c=function(_0x3e163b,_0x384d25){_0x3e163b=_0x3e163b-0x0;var _0x255200=_0x64c5[_0x3e163b];return _0x255200;};'use strict';var _=require(_0x564c('0x0'));var passport=require(_0x564c('0x1'));var GoogleStrategy=require(_0x564c('0x2'))[_0x564c('0x3')];var moment=require(_0x564c('0x4'));var db=require(_0x564c('0x5'))['db'];var config=require(_0x564c('0x6'));var signToken=require(_0x564c('0x7'))[_0x564c('0x8')];var utils=require(_0x564c('0x9'));exports[_0x564c('0xa')]=passport[_0x564c('0xb')](_0x564c('0xc'),{'failureRedirect':_0x564c('0xd'),'scope':['profile',_0x564c('0xe')],'session':![]});exports[_0x564c('0xf')]=passport[_0x564c('0xb')](_0x564c('0xc'),{'failureRedirect':_0x564c('0xd'),'session':![]});passport[_0x564c('0x10')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x564c('0xc')]?config[_0x564c('0xc')][_0x564c('0x11')]:_0x564c('0x12'),'callbackURL':config[_0x564c('0xc')]?config[_0x564c('0xc')][_0x564c('0x13')]:''},function(_0x331848,_0x4ca9a1,_0x5e664e,_0x357c4a){var _0x5d70a9,_0x3f9970;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x564c('0x14'),'blockDuration'],'raw':!![]})[_0x564c('0x15')](function(_0x35a55b){_0x5d70a9=_0x35a55b;return db[_0x564c('0x16')][_0x564c('0x17')]({'where':{'email':_[_0x564c('0x18')](_0x5e664e['emails'],_0x564c('0x19')),'role':{'$or':['admin','user',_0x564c('0x1a')]}}});})[_0x564c('0x15')](function(_0x607c5c){_0x3f9970=_0x607c5c;if(_0x3f9970){if(_0x3f9970[_0x564c('0x1b')]){return _0x357c4a('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x5d70a9[_0x564c('0x1c')]>0x0){if(_0x3f9970[_0x564c('0x1d')]){if(moment(_0x3f9970[_0x564c('0x1e')])[_0x564c('0x1f')](_0x5d70a9[_0x564c('0x1c')],_0x564c('0x20'))>moment()){return _0x357c4a(_0x564c('0x21'));}else{return utils[_0x564c('0x22')](_0x3f9970,0x0,![],null)[_0x564c('0x15')](function(){return utils[_0x564c('0x23')](_0x3f9970);})['then'](function(){return _0x357c4a(null,_0x3f9970);});}}else{return utils[_0x564c('0x23')](_0x3f9970)[_0x564c('0x15')](function(){return _0x357c4a(null,_0x3f9970);});}}else{return utils[_0x564c('0x23')](_0x3f9970)['then'](function(){return _0x357c4a(null,_0x3f9970);});}}return _0x357c4a(_0x564c('0x21'));})[_0x564c('0x24')](function(_0x2137a7){_0x357c4a(_0x2137a7);});})); \ No newline at end of file +var _0xe978=['moment','../../mysqldb','../../config/environment','../../config/utils','login','authenticate','google','profile','callback','use','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy'];(function(_0xb7ce77,_0x33ec55){var _0x320ebf=function(_0x21ccd2){while(--_0x21ccd2){_0xb7ce77['push'](_0xb7ce77['shift']());}};_0x320ebf(++_0x33ec55);}(_0xe978,0x1d0));var _0x8e97=function(_0x18ee24,_0x506706){_0x18ee24=_0x18ee24-0x0;var _0x17fc48=_0xe978[_0x18ee24];return _0x17fc48;};'use strict';var _=require(_0x8e97('0x0'));var passport=require(_0x8e97('0x1'));var GoogleStrategy=require(_0x8e97('0x2'))[_0x8e97('0x3')];var moment=require(_0x8e97('0x4'));var db=require(_0x8e97('0x5'))['db'];var config=require(_0x8e97('0x6'));var signToken=require('../../components/auth/service')['signToken'];var utils=require(_0x8e97('0x7'));exports[_0x8e97('0x8')]=passport[_0x8e97('0x9')](_0x8e97('0xa'),{'failureRedirect':'/login','scope':[_0x8e97('0xb'),'email'],'session':![]});exports[_0x8e97('0xc')]=passport[_0x8e97('0x9')](_0x8e97('0xa'),{'failureRedirect':'/login','session':![]});passport[_0x8e97('0xd')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x8e97('0xa')]?config[_0x8e97('0xa')][_0x8e97('0xe')]:_0x8e97('0xf'),'callbackURL':config[_0x8e97('0xa')]?config[_0x8e97('0xa')][_0x8e97('0x10')]:''},function(_0xb8fd9,_0x1974a8,_0x5e11fd,_0xc01180){var _0x5a6235,_0xe1a1dd;return db[_0x8e97('0x11')][_0x8e97('0x12')]({'where':{'id':0x1},'attributes':[_0x8e97('0x13'),_0x8e97('0x14')],'raw':!![]})[_0x8e97('0x15')](function(_0x5241ee){_0x5a6235=_0x5241ee;return db[_0x8e97('0x16')][_0x8e97('0x17')]({'where':{'email':_[_0x8e97('0x18')](_0x5e11fd['emails'],'value'),'role':{'$or':['admin',_0x8e97('0x19'),_0x8e97('0x1a')]}}});})[_0x8e97('0x15')](function(_0x152edd){_0xe1a1dd=_0x152edd;if(_0xe1a1dd){if(_0xe1a1dd[_0x8e97('0x1b')]){return _0xc01180(_0x8e97('0x1c'));}else if(_0x5a6235[_0x8e97('0x14')]>0x0){if(_0xe1a1dd[_0x8e97('0x1d')]){if(moment(_0xe1a1dd[_0x8e97('0x1e')])[_0x8e97('0x1f')](_0x5a6235[_0x8e97('0x14')],_0x8e97('0x20'))>moment()){return _0xc01180('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x8e97('0x21')](_0xe1a1dd,0x0,![],null)[_0x8e97('0x15')](function(){return utils[_0x8e97('0x22')](_0xe1a1dd);})[_0x8e97('0x15')](function(){return _0xc01180(null,_0xe1a1dd);});}}else{return utils['getLicense'](_0xe1a1dd)[_0x8e97('0x15')](function(){return _0xc01180(null,_0xe1a1dd);});}}else{return utils[_0x8e97('0x22')](_0xe1a1dd)[_0x8e97('0x15')](function(){return _0xc01180(null,_0xe1a1dd);});}}return _0xc01180('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x8e97('0x23')](function(_0x502bb5){_0xc01180(_0x502bb5);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 29a215d..f803bee 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 _0x0328=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','login'];(function(_0x59a311,_0xeede3a){var _0x1e78cc=function(_0x4098c7){while(--_0x4098c7){_0x59a311['push'](_0x59a311['shift']());}};_0x1e78cc(++_0xeede3a);}(_0x0328,0x172));var _0x8032=function(_0x50aca6,_0x182f0c){_0x50aca6=_0x50aca6-0x0;var _0x46ded6=_0x0328[_0x50aca6];return _0x46ded6;};'use strict';var express=require(_0x8032('0x0'));var passport=require(_0x8032('0x1'));var router=express[_0x8032('0x2')]();var controller=require(_0x8032('0x3'));var userController=require(_0x8032('0x4'));var authService=require(_0x8032('0x5'));router[_0x8032('0x6')]('/',controller['login']);router[_0x8032('0x6')](_0x8032('0x7'),controller[_0x8032('0x8')],authService['isMiddleware'],userController[_0x8032('0x9')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x2029=['../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller'];(function(_0x5aa881,_0x36f116){var _0x4d92ed=function(_0x57fbfd){while(--_0x57fbfd){_0x5aa881['push'](_0x5aa881['shift']());}};_0x4d92ed(++_0x36f116);}(_0x2029,0x171));var _0x9202=function(_0x5163fb,_0x3f205d){_0x5163fb=_0x5163fb-0x0;var _0x578c06=_0x2029[_0x5163fb];return _0x578c06;};'use strict';var express=require(_0x9202('0x0'));var passport=require(_0x9202('0x1'));var router=express['Router']();var controller=require(_0x9202('0x2'));var userController=require(_0x9202('0x3'));var authService=require(_0x9202('0x4'));router[_0x9202('0x5')]('/',controller[_0x9202('0x6')]);router[_0x9202('0x5')](_0x9202('0x7'),controller[_0x9202('0x8')],authService[_0x9202('0x9')],userController[_0x9202('0x6')],authService[_0x9202('0xa')]);module[_0x9202('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 1230448..2c338d7 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 _0x02cf=['authenticate','loginAttempts','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','error','status','send','message','test','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','email','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','blocked','blockedAt','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x33b3eb,_0x28599c){var _0x5e8333=function(_0x8dbae5){while(--_0x8dbae5){_0x33b3eb['push'](_0x33b3eb['shift']());}};_0x5e8333(++_0x28599c);}(_0x02cf,0x1ea));var _0xf02c=function(_0x52a1a7,_0x64af9d){_0x52a1a7=_0x52a1a7-0x0;var _0x3c0843=_0x02cf[_0x52a1a7];return _0x3c0843;};'use strict';var util=require(_0xf02c('0x0'));var passport=require(_0xf02c('0x1'));var LocalStrategy=require(_0xf02c('0x2'))[_0xf02c('0x3')];var jayson=require(_0xf02c('0x4'));var _=require(_0xf02c('0x5'));var rs=require(_0xf02c('0x6'));var moment=require(_0xf02c('0x7'));var db=require(_0xf02c('0x8'))['db'];var authService=require(_0xf02c('0x9'));var utils=require(_0xf02c('0xa'));var client=jayson['client'][_0xf02c('0xb')]({'port':0x232b});function localAuthenticate(_0x353192,_0x3e58a5,_0xffc31c,_0x3a1a69){var _0x1ef8a4,_0x5b3525;return db[_0xf02c('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0xf02c('0xd'),_0xf02c('0xe')],'raw':!![]})[_0xf02c('0xf')](function(_0xb6496c){_0x1ef8a4=_0xb6496c;return _0x353192[_0xf02c('0x10')]({'attributes':['id',_0xf02c('0x11'),_0xf02c('0x12'),_0xf02c('0x13'),_0xf02c('0x14'),'disabled',_0xf02c('0x15'),_0xf02c('0x16'),'loginAttempts'],'where':{'name':_0x3e58a5,'role':{'$or':['admin',_0xf02c('0x17'),_0xf02c('0x18')]}}});})[_0xf02c('0xf')](function(_0x1f1fe2){if(!_0x1f1fe2||_0x1f1fe2&&_0x1f1fe2[_0xf02c('0x11')]!==_0x3e58a5){throw new Error(_0xf02c('0x19'));}else{_0x5b3525=_0x1f1fe2;return _0x5b3525;}})[_0xf02c('0xf')](function(){_0x5b3525[_0xf02c('0x1a')](_0xffc31c,function(_0x1fdcd1,_0x15eda1){var _0x4cc7d2=_0x5b3525[_0xf02c('0x1b')]+0x1;if(_0x1fdcd1){return _0x3a1a69(_0x1fdcd1);}else if(!_0x15eda1){if(_0x5b3525['disabled']){return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});}else if(_0x1ef8a4[_0xf02c('0xd')]>0x0){if(_0x5b3525['blocked']){if(_0x1ef8a4[_0xf02c('0xe')]>0x0){if(moment(_0x5b3525[_0xf02c('0x16')])[_0xf02c('0x1c')](_0x1ef8a4[_0xf02c('0xe')],_0xf02c('0x1d'))>moment()){return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});}else{return utils[_0xf02c('0x1e')](_0x5b3525,_0x4cc7d2,![],null)['then'](function(){return _0x3a1a69(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});}}else{if(_0x4cc7d2>=_0x1ef8a4[_0xf02c('0xd')]){return utils[_0xf02c('0x1e')](_0x5b3525,0x0,!![],moment())['then'](function(){return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});});}else{return utils['clearBlockUser'](_0x5b3525,_0x4cc7d2,![],null)[_0xf02c('0xf')](function(){return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});});}}}else{return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});}}else{if(_0x5b3525[_0xf02c('0x1f')]){return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});}else if(_0x1ef8a4[_0xf02c('0xd')]>0x0){if(_0x5b3525[_0xf02c('0x15')]){if(_0x1ef8a4[_0xf02c('0xe')]>0x0){if(moment(_0x5b3525[_0xf02c('0x16')])[_0xf02c('0x1c')](_0x1ef8a4[_0xf02c('0xe')],_0xf02c('0x1d'))>moment()){return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});}else{return utils['clearBlockUser'](_0x5b3525,0x0,![],null)['then'](function(){return utils['getLicense'](_0x5b3525);})[_0xf02c('0xf')](function(){return _0x3a1a69(null,_0x5b3525);});}}else{return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});}}else{return utils[_0xf02c('0x1e')](_0x5b3525,0x0,![],null)['then'](function(){return utils[_0xf02c('0x20')](_0x5b3525);})[_0xf02c('0xf')](function(){return _0x3a1a69(null,_0x5b3525);})[_0xf02c('0x21')](function(_0x1651a5){return _0x3a1a69(null,![],_0x1651a5);});}}else{if(_0x5b3525[_0xf02c('0x15')]){return _0x3a1a69(null,![],{'message':_0xf02c('0x19')});}else{return utils[_0xf02c('0x20')](_0x5b3525)[_0xf02c('0xf')](function(){return _0x3a1a69(null,_0x5b3525);});}}}});})[_0xf02c('0x21')](function(_0x177b14){return _0x3a1a69(null,![],_0x177b14);});}function sendServiceMail(_0x10d359){return db[_0xf02c('0x22')][_0xf02c('0x23')]({'where':{'service':!![]},'attributes':['id',_0xf02c('0x11'),'email'],'include':[{'model':db[_0xf02c('0x24')],'as':_0xf02c('0x25')}]})[_0xf02c('0xf')](function(_0xe11fb3){if(!_0xe11fb3){throw new Error(_0xf02c('0x26'));}var _0x4a014c={'tls':{'rejectUnauthorized':![]}};if(_0xe11fb3[_0xf02c('0x25')][_0xf02c('0x27')]){_0x4a014c[_0xf02c('0x27')]=_0xe11fb3[_0xf02c('0x25')][_0xf02c('0x27')];}else{_0x4a014c[_0xf02c('0x28')]=_0xe11fb3[_0xf02c('0x25')][_0xf02c('0x28')];_0x4a014c['port']=_0xe11fb3[_0xf02c('0x25')]['port'];_0x4a014c[_0xf02c('0x29')]=_0xe11fb3[_0xf02c('0x25')]['secure'];}if(_0xe11fb3['Smtp'][_0xf02c('0x2a')]){_0x4a014c[_0xf02c('0x2b')]={'user':_0xe11fb3[_0xf02c('0x25')][_0xf02c('0x17')],'pass':_0xe11fb3[_0xf02c('0x25')][_0xf02c('0x2c')]};}var _0x3b9f71={'account':_0x4a014c,'message':_['merge']({'from':util[_0xf02c('0x2d')](_0xf02c('0x2e'),_0xe11fb3['name'],_0xe11fb3['email']||_0xe11fb3[_0xf02c('0x25')][_0xf02c('0x17')])},_0x10d359)};return client['request'](_0xf02c('0x2f'),_0x3b9f71);})[_0xf02c('0xf')](function(_0x40554e){if(_0x40554e['error']){throw new Error(util[_0xf02c('0x2d')](_0xf02c('0x30'),_0x40554e['error']['message']||JSON[_0xf02c('0x31')](_0x40554e[_0xf02c('0x32')])));}return!![];});}function handleError(_0x2f3b40,_0x1a8728,_0x12e02a){return _0x2f3b40[_0xf02c('0x33')](_0x1a8728||0x1f4)[_0xf02c('0x34')]({'message':_0x12e02a?_0x12e02a[_0xf02c('0x35')]||_0x12e02a:''});}function checkPasswordPattern(_0x2b68b1,_0x257879,_0x4244db){if(_0x4244db){var _0x3bdeae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3bdeae[_0xf02c('0x36')](_0x257879)){return _0x2b68b1;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2b68b1;}}exports[_0xf02c('0x37')]=function(_0x51588f,_0x35f075,_0x5934e1){passport[_0xf02c('0x1a')](_0xf02c('0x38'),function(_0x49b2b2,_0x267f93,_0x538bca){var _0xa02576=_0x49b2b2||_0x538bca;if(_0xa02576){return handleError(_0x35f075,0x191,_0xa02576);}if(!_0x267f93){return handleError(_0x35f075,0x194,{'message':_0xf02c('0x39')});}else{var _0x2e84b5={'payload':{'id':_0x267f93['id'],'role':_0x267f93[_0xf02c('0x14')]},'options':{'expiresIn':0x15180}};return authService[_0xf02c('0x3a')](_0x2e84b5)[_0xf02c('0xf')](function(_0x584c6d){_0x35f075['json']({'id':_0x267f93['id'],'token':_0x584c6d,'statusCall':'','isAlreadyLogged':_0x267f93[_0xf02c('0x3b')]});});}})(_0x51588f,_0x35f075,_0x5934e1);};exports[_0xf02c('0x3c')]=function(_0x2922c3,_0x2508f2,_0x4c31a5){if(!_0x2922c3[_0xf02c('0x3d')][_0xf02c('0x3e')]){return handleError(_0x2508f2,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5b1dc5=rs[_0xf02c('0x3f')]();_0x2922c3[_0xf02c('0x3d')][_0xf02c('0x3e')]=_0x2922c3[_0xf02c('0x3d')]['email'][_0xf02c('0x40')]()[_0xf02c('0x41')]();var _0x29a124;return db[_0xf02c('0xc')][_0xf02c('0x10')]({'where':{'id':0x1},'attributes':[_0xf02c('0xd'),'blockDuration'],'raw':!![]})[_0xf02c('0xf')](function(_0x3befb9){_0x29a124=_0x3befb9;return db[_0xf02c('0x42')][_0xf02c('0x23')]({'where':{'email':_0x2922c3[_0xf02c('0x3d')][_0xf02c('0x3e')]}});})[_0xf02c('0xf')](function(_0x395c2e){if(!_0x395c2e){throw new Error(_0xf02c('0x43'));}if(_0x395c2e[_0xf02c('0x1f')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x395c2e['blocked']){if(moment(_0x395c2e[_0xf02c('0x16')])[_0xf02c('0x1c')](_0x29a124[_0xf02c('0xe')],_0xf02c('0x1d'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x395c2e[_0xf02c('0x15')]=![];_0x395c2e[_0xf02c('0x16')]=null;}}_0x395c2e[_0xf02c('0x44')]=_0x5b1dc5;_0x395c2e[_0xf02c('0x45')]=Date[_0xf02c('0x46')]()+0x36ee80;return _0x395c2e[_0xf02c('0x47')]();})[_0xf02c('0xf')](function(){return sendServiceMail({'to':_0x2922c3['body'][_0xf02c('0x3e')],'subject':_0xf02c('0x48'),'text':_0xf02c('0x49')+_0xf02c('0x4a')+_0xf02c('0x4b')+_0x2922c3[_0xf02c('0x4c')][_0xf02c('0x28')]+_0xf02c('0x4d')+_0x5b1dc5+'\x0a\x0a'+_0xf02c('0x4e')});})[_0xf02c('0xf')](function(){_0x2508f2[_0xf02c('0x33')](0xc8)[_0xf02c('0x34')]({'message':_0xf02c('0x4f')});})[_0xf02c('0x21')](function(_0x33234e){return handleError(_0x2508f2,0x1f4,_0x33234e);});};exports[_0xf02c('0x50')]=function(_0x1b2fab,_0xd517a2,_0x1c1e56){var _0x2e5b13;return db[_0xf02c('0x42')][_0xf02c('0x23')]({'where':{'resetPasswordToken':_0x1b2fab[_0xf02c('0x51')][_0xf02c('0x52')],'resetPasswordExpires':{'$gt':Date[_0xf02c('0x46')]()}}})['then'](function(_0x1d0609){_0x2e5b13=_0x1d0609;if(!_0x2e5b13){throw new Error(_0xf02c('0x53'));}return db[_0xf02c('0xc')]['findOne']({'attributes':['id',_0xf02c('0x54')]});})[_0xf02c('0xf')](function(_0x132dab){return checkPasswordPattern(_0x132dab,_0x1b2fab[_0xf02c('0x3d')][_0xf02c('0x12')],_0x132dab['securePassword']);})[_0xf02c('0xf')](function(){_0x2e5b13[_0xf02c('0x12')]=_0x1b2fab['body'][_0xf02c('0x12')];_0x2e5b13[_0xf02c('0x44')]=null;_0x2e5b13[_0xf02c('0x45')]=null;return _0x2e5b13[_0xf02c('0x47')]();})['then'](function(){_0xd517a2[_0xf02c('0x33')](0xc8)[_0xf02c('0x34')]({'message':_0xf02c('0x55')});})[_0xf02c('0x21')](function(_0x19be7f){return handleError(_0xd517a2,0x1f4,_0x19be7f);});};passport['use'](new LocalStrategy({'usernameField':_0xf02c('0x11'),'passwordField':'password'},function(_0x4723c4,_0x2c5581,_0x448f38){return localAuthenticate(db['User'],_0x4723c4,_0x2c5581,_0x448f38);})); \ No newline at end of file +var _0xe3c4=['moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','name','password','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','blockDuration','add','clearBlockUser','getLicense','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','stringify','status','message','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','signToken','json','online','body','Email\x20parameter\x20is\x20missing','findOne','User','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','reset','params','token','securePassword','resetPasswordToken','save','send','Password\x20reset!','util','passport','passport-local','Strategy','randomstring'];(function(_0x1f5862,_0x39542e){var _0x2dca29=function(_0x2e5503){while(--_0x2e5503){_0x1f5862['push'](_0x1f5862['shift']());}};_0x2dca29(++_0x39542e);}(_0xe3c4,0x16d));var _0x4e3c=function(_0x363983,_0x5a4bf9){_0x363983=_0x363983-0x0;var _0x3e1c53=_0xe3c4[_0x363983];return _0x3e1c53;};'use strict';var util=require(_0x4e3c('0x0'));var passport=require(_0x4e3c('0x1'));var LocalStrategy=require(_0x4e3c('0x2'))[_0x4e3c('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x4e3c('0x4'));var moment=require(_0x4e3c('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x4e3c('0x6'));var utils=require(_0x4e3c('0x7'));var client=jayson[_0x4e3c('0x8')][_0x4e3c('0x9')]({'port':0x232b});function localAuthenticate(_0x2ed61d,_0x3f9429,_0x467a23,_0x540716){var _0x441b1e,_0x4994fc;return db[_0x4e3c('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x4e3c('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x2d8456){_0x441b1e=_0x2d8456;return _0x2ed61d['findOne']({'attributes':['id',_0x4e3c('0xc'),_0x4e3c('0xd'),'salt','role','disabled',_0x4e3c('0xe'),_0x4e3c('0xf'),_0x4e3c('0x10')],'where':{'name':_0x3f9429,'role':{'$or':[_0x4e3c('0x11'),_0x4e3c('0x12'),_0x4e3c('0x13')]}}});})[_0x4e3c('0x14')](function(_0x5f0dbf){if(!_0x5f0dbf||_0x5f0dbf&&_0x5f0dbf['name']!==_0x3f9429){throw new Error(_0x4e3c('0x15'));}else{_0x4994fc=_0x5f0dbf;return _0x4994fc;}})[_0x4e3c('0x14')](function(){_0x4994fc['authenticate'](_0x467a23,function(_0x104985,_0x4441ad){var _0x475818=_0x4994fc[_0x4e3c('0x10')]+0x1;if(_0x104985){return _0x540716(_0x104985);}else if(!_0x4441ad){if(_0x4994fc[_0x4e3c('0x16')]){return _0x540716(null,![],{'message':_0x4e3c('0x15')});}else if(_0x441b1e[_0x4e3c('0xb')]>0x0){if(_0x4994fc[_0x4e3c('0xe')]){if(_0x441b1e[_0x4e3c('0x17')]>0x0){if(moment(_0x4994fc[_0x4e3c('0xf')])[_0x4e3c('0x18')](_0x441b1e[_0x4e3c('0x17')],'minutes')>moment()){return _0x540716(null,![],{'message':_0x4e3c('0x15')});}else{return utils[_0x4e3c('0x19')](_0x4994fc,_0x475818,![],null)[_0x4e3c('0x14')](function(){return _0x540716(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x540716(null,![],{'message':_0x4e3c('0x15')});}}else{if(_0x475818>=_0x441b1e[_0x4e3c('0xb')]){return utils[_0x4e3c('0x19')](_0x4994fc,0x0,!![],moment())[_0x4e3c('0x14')](function(){return _0x540716(null,![],{'message':_0x4e3c('0x15')});});}else{return utils[_0x4e3c('0x19')](_0x4994fc,_0x475818,![],null)[_0x4e3c('0x14')](function(){return _0x540716(null,![],{'message':_0x4e3c('0x15')});});}}}else{return _0x540716(null,![],{'message':_0x4e3c('0x15')});}}else{if(_0x4994fc[_0x4e3c('0x16')]){return _0x540716(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x441b1e[_0x4e3c('0xb')]>0x0){if(_0x4994fc[_0x4e3c('0xe')]){if(_0x441b1e[_0x4e3c('0x17')]>0x0){if(moment(_0x4994fc[_0x4e3c('0xf')])[_0x4e3c('0x18')](_0x441b1e[_0x4e3c('0x17')],'minutes')>moment()){return _0x540716(null,![],{'message':_0x4e3c('0x15')});}else{return utils[_0x4e3c('0x19')](_0x4994fc,0x0,![],null)[_0x4e3c('0x14')](function(){return utils[_0x4e3c('0x1a')](_0x4994fc);})[_0x4e3c('0x14')](function(){return _0x540716(null,_0x4994fc);});}}else{return _0x540716(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x4e3c('0x19')](_0x4994fc,0x0,![],null)[_0x4e3c('0x14')](function(){return utils[_0x4e3c('0x1a')](_0x4994fc);})['then'](function(){return _0x540716(null,_0x4994fc);})['catch'](function(_0x8ff101){return _0x540716(null,![],_0x8ff101);});}}else{if(_0x4994fc[_0x4e3c('0xe')]){return _0x540716(null,![],{'message':_0x4e3c('0x15')});}else{return utils[_0x4e3c('0x1a')](_0x4994fc)[_0x4e3c('0x14')](function(){return _0x540716(null,_0x4994fc);});}}}});})['catch'](function(_0x38e0a8){return _0x540716(null,![],_0x38e0a8);});}function sendServiceMail(_0x5330b4){return db[_0x4e3c('0x1b')][_0x4e3c('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x4e3c('0xc'),_0x4e3c('0x1d')],'include':[{'model':db[_0x4e3c('0x1e')],'as':_0x4e3c('0x1f')}]})[_0x4e3c('0x14')](function(_0x458ef1){if(!_0x458ef1){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3ab909={'tls':{'rejectUnauthorized':![]}};if(_0x458ef1[_0x4e3c('0x1f')][_0x4e3c('0x20')]){_0x3ab909[_0x4e3c('0x20')]=_0x458ef1[_0x4e3c('0x1f')]['service'];}else{_0x3ab909[_0x4e3c('0x21')]=_0x458ef1[_0x4e3c('0x1f')]['host'];_0x3ab909[_0x4e3c('0x22')]=_0x458ef1[_0x4e3c('0x1f')]['port'];_0x3ab909[_0x4e3c('0x23')]=_0x458ef1[_0x4e3c('0x1f')][_0x4e3c('0x23')];}if(_0x458ef1['Smtp'][_0x4e3c('0x24')]){_0x3ab909[_0x4e3c('0x25')]={'user':_0x458ef1['Smtp'][_0x4e3c('0x12')],'pass':_0x458ef1[_0x4e3c('0x1f')]['pass']};}var _0x1e73a3={'account':_0x3ab909,'message':_[_0x4e3c('0x26')]({'from':util[_0x4e3c('0x27')](_0x4e3c('0x28'),_0x458ef1[_0x4e3c('0xc')],_0x458ef1[_0x4e3c('0x1d')]||_0x458ef1[_0x4e3c('0x1f')][_0x4e3c('0x12')])},_0x5330b4)};return client[_0x4e3c('0x29')](_0x4e3c('0x2a'),_0x1e73a3);})[_0x4e3c('0x14')](function(_0x5e0887){if(_0x5e0887[_0x4e3c('0x2b')]){throw new Error(util[_0x4e3c('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x5e0887[_0x4e3c('0x2b')]['message']||JSON[_0x4e3c('0x2c')](_0x5e0887[_0x4e3c('0x2b')])));}return!![];});}function handleError(_0x10e381,_0x24fc58,_0x1b8cd2){return _0x10e381[_0x4e3c('0x2d')](_0x24fc58||0x1f4)['send']({'message':_0x1b8cd2?_0x1b8cd2[_0x4e3c('0x2e')]||_0x1b8cd2:''});}function checkPasswordPattern(_0x539546,_0x2fff64,_0x213def){if(_0x213def){var _0xb30ea7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xb30ea7[_0x4e3c('0x2f')](_0x2fff64)){return _0x539546;}else{throw new Error(_0x4e3c('0x30'));}}else{return _0x539546;}}exports[_0x4e3c('0x31')]=function(_0x5a86fa,_0x58a6ed,_0x731dfe){passport['authenticate'](_0x4e3c('0x32'),function(_0x2ad92f,_0x285f1e,_0x1cf367){var _0x48d639=_0x2ad92f||_0x1cf367;if(_0x48d639){return handleError(_0x58a6ed,0x191,_0x48d639);}if(!_0x285f1e){return handleError(_0x58a6ed,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x11e030={'payload':{'id':_0x285f1e['id'],'role':_0x285f1e['role']},'options':{'expiresIn':0x15180}};return authService[_0x4e3c('0x33')](_0x11e030)[_0x4e3c('0x14')](function(_0x1b4d0a){_0x58a6ed[_0x4e3c('0x34')]({'id':_0x285f1e['id'],'token':_0x1b4d0a,'statusCall':'','isAlreadyLogged':_0x285f1e[_0x4e3c('0x35')]});});}})(_0x5a86fa,_0x58a6ed,_0x731dfe);};exports['forgot']=function(_0x412335,_0x17d4f5,_0x3622e4){if(!_0x412335[_0x4e3c('0x36')][_0x4e3c('0x1d')]){return handleError(_0x17d4f5,0x1f4,{'message':_0x4e3c('0x37')});}var _0x179d6e=rs['generate']();_0x412335[_0x4e3c('0x36')][_0x4e3c('0x1d')]=_0x412335[_0x4e3c('0x36')]['email']['trim']()['toLowerCase']();var _0x1fa824;return db[_0x4e3c('0xa')][_0x4e3c('0x38')]({'where':{'id':0x1},'attributes':[_0x4e3c('0xb'),_0x4e3c('0x17')],'raw':!![]})[_0x4e3c('0x14')](function(_0x1d762d){_0x1fa824=_0x1d762d;return db[_0x4e3c('0x39')][_0x4e3c('0x1c')]({'where':{'email':_0x412335[_0x4e3c('0x36')][_0x4e3c('0x1d')]}});})[_0x4e3c('0x14')](function(_0x46c472){if(!_0x46c472){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x46c472[_0x4e3c('0x16')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x46c472[_0x4e3c('0xe')]){if(moment(_0x46c472[_0x4e3c('0xf')])[_0x4e3c('0x18')](_0x1fa824[_0x4e3c('0x17')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x46c472[_0x4e3c('0xe')]=![];_0x46c472['blockedAt']=null;}}_0x46c472['resetPasswordToken']=_0x179d6e;_0x46c472[_0x4e3c('0x3a')]=Date[_0x4e3c('0x3b')]()+0x36ee80;return _0x46c472['save']();})[_0x4e3c('0x14')](function(){return sendServiceMail({'to':_0x412335['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x4e3c('0x3c')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x4e3c('0x3d')+_0x412335[_0x4e3c('0x3e')][_0x4e3c('0x21')]+'/reset/'+_0x179d6e+'\x0a\x0a'+_0x4e3c('0x3f')});})[_0x4e3c('0x14')](function(){_0x17d4f5[_0x4e3c('0x2d')](0xc8)['send']({'message':_0x4e3c('0x40')});})[_0x4e3c('0x41')](function(_0x2ad07f){return handleError(_0x17d4f5,0x1f4,_0x2ad07f);});};exports[_0x4e3c('0x42')]=function(_0x59d4d7,_0x4bab12,_0x5a0e1e){var _0x2fa8ab;return db[_0x4e3c('0x39')]['find']({'where':{'resetPasswordToken':_0x59d4d7[_0x4e3c('0x43')][_0x4e3c('0x44')],'resetPasswordExpires':{'$gt':Date[_0x4e3c('0x3b')]()}}})[_0x4e3c('0x14')](function(_0x46c5d2){_0x2fa8ab=_0x46c5d2;if(!_0x2fa8ab){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x4e3c('0xa')][_0x4e3c('0x38')]({'attributes':['id',_0x4e3c('0x45')]});})[_0x4e3c('0x14')](function(_0x34cd5b){return checkPasswordPattern(_0x34cd5b,_0x59d4d7[_0x4e3c('0x36')][_0x4e3c('0xd')],_0x34cd5b[_0x4e3c('0x45')]);})[_0x4e3c('0x14')](function(){_0x2fa8ab[_0x4e3c('0xd')]=_0x59d4d7[_0x4e3c('0x36')][_0x4e3c('0xd')];_0x2fa8ab[_0x4e3c('0x46')]=null;_0x2fa8ab['resetPasswordExpires']=null;return _0x2fa8ab[_0x4e3c('0x47')]();})[_0x4e3c('0x14')](function(){_0x4bab12[_0x4e3c('0x2d')](0xc8)[_0x4e3c('0x48')]({'message':_0x4e3c('0x49')});})['catch'](function(_0x2d4f99){return handleError(_0x4bab12,0x1f4,_0x2d4f99);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':_0x4e3c('0xd')},function(_0x107ee0,_0xe2bf4a,_0x78c574){return localAuthenticate(db['User'],_0x107ee0,_0xe2bf4a,_0x78c574);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ba0355c..e3ee230 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 _0xc2e3=['/reset/:token','exports','express','post','forgot'];(function(_0x5b0456,_0x39bd8d){var _0x591a22=function(_0xb9bdab){while(--_0xb9bdab){_0x5b0456['push'](_0x5b0456['shift']());}};_0x591a22(++_0x39bd8d);}(_0xc2e3,0xf7));var _0x3c2e=function(_0x2824b3,_0x580495){_0x2824b3=_0x2824b3-0x0;var _0x5a750b=_0xc2e3[_0x2824b3];return _0x5a750b;};'use strict';var express=require(_0x3c2e('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x3c2e('0x1')]('/',controller['login']);router[_0x3c2e('0x1')]('/forgot',controller[_0x3c2e('0x2')]);router[_0x3c2e('0x1')](_0x3c2e('0x3'),controller['reset']);module[_0x3c2e('0x4')]=router; \ No newline at end of file +var _0x5f33=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','exports'];(function(_0x654299,_0x2d543d){var _0x13638a=function(_0x2cabaa){while(--_0x2cabaa){_0x654299['push'](_0x654299['shift']());}};_0x13638a(++_0x2d543d);}(_0x5f33,0x170));var _0x35f3=function(_0x440842,_0x14ae10){_0x440842=_0x440842-0x0;var _0x20ce42=_0x5f33[_0x440842];return _0x20ce42;};'use strict';var express=require('express');var router=express[_0x35f3('0x0')]();var controller=require(_0x35f3('0x1'));router[_0x35f3('0x2')]('/',controller[_0x35f3('0x3')]);router[_0x35f3('0x2')](_0x35f3('0x4'),controller[_0x35f3('0x5')]);router[_0x35f3('0x2')](_0x35f3('0x6'),controller['reset']);module[_0x35f3('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index d9b94df..4060433 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 _0x0115=['INTEGER','STRING','BOOLEAN'];(function(_0x5a18e7,_0x569fd0){var _0x3bfebb=function(_0x29122b){while(--_0x29122b){_0x5a18e7['push'](_0x5a18e7['shift']());}};_0x3bfebb(++_0x569fd0);}(_0x0115,0x1d8));var _0x5011=function(_0x2aac5a,_0x20f9f6){_0x2aac5a=_0x2aac5a-0x0;var _0x4e38e1=_0x0115[_0x2aac5a];return _0x4e38e1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5011('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x5011('0x0')]},'description':{'type':Sequelize[_0x5011('0x0')]},'status':{'type':Sequelize[_0x5011('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5011('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x3fd2=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x3fd2,0x178));var _0x23fd=function(_0x38c773,_0x199a45){_0x38c773=_0x38c773-0x0;var _0x196e46=_0x3fd2[_0x38c773];return _0x196e46;};'use strict';var Sequelize=require(_0x23fd('0x0'));module[_0x23fd('0x1')]={'name':{'type':Sequelize[_0x23fd('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x23fd('0x2')]},'description':{'type':Sequelize[_0x23fd('0x2')]},'status':{'type':Sequelize[_0x23fd('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x23fd('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 171230a..1f06473 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 _0xb6c3=['VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','addConditions','Condition','omit','getConditions','findOne','pick','addActions','ids','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','Automation','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','merge'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0xb6c3,0x69));var _0x3b6c=function(_0x33dabe,_0x1b0aed){_0x33dabe=_0x33dabe-0x0;var _0x471e65=_0xb6c3[_0x33dabe];return _0x471e65;};'use strict';var pdf=require(_0x3b6c('0x0'));var emlformat=require(_0x3b6c('0x1'));var rimraf=require(_0x3b6c('0x2'));var zipdir=require(_0x3b6c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b6c('0x4'));var moment=require(_0x3b6c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3b6c('0x6'));var util=require(_0x3b6c('0x7'));var path=require(_0x3b6c('0x8'));var sox=require(_0x3b6c('0x9'));var csv=require('to-csv');var ejs=require(_0x3b6c('0xa'));var fs=require('fs');var _=require(_0x3b6c('0xb'));var squel=require(_0x3b6c('0xc'));var crypto=require('crypto');var jsforce=require(_0x3b6c('0xd'));var deskjs=require(_0x3b6c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3b6c('0xf'));var Papa=require(_0x3b6c('0x10'));var Redis=require(_0x3b6c('0x11'));var authService=require(_0x3b6c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3b6c('0x13'));var hardwareService=require(_0x3b6c('0x14'));var logger=require(_0x3b6c('0x15'))(_0x3b6c('0x16'));var utils=require(_0x3b6c('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45be00,_0x3c5b05){_0x3c5b05=_0x3c5b05||0xcc;return function(_0x1d8332){if(_0x1d8332){return _0x45be00[_0x3b6c('0x18')](_0x3c5b05);}return _0x45be00[_0x3b6c('0x19')](_0x3c5b05)[_0x3b6c('0x1a')]();};}function respondWithResult(_0x447807,_0x24ec82){_0x24ec82=_0x24ec82||0xc8;return function(_0x3ebb61){if(_0x3ebb61){return _0x447807[_0x3b6c('0x19')](_0x24ec82)['json'](_0x3ebb61);}};}function respondWithFilteredResult(_0xcc09fc,_0x333b4a){return function(_0x21d1d9){if(_0x21d1d9){var _0x1182f3=_0x21d1d9[_0x3b6c('0x1b')],_0x3936fc=_0x333b4a['offset'],_0x3f0572=_0x333b4a[_0x3b6c('0x1c')]+_0x333b4a['limit'],_0xcd376a;if(_0x3f0572>=_0x1182f3){_0x3f0572=_0x1182f3;_0xcd376a=0xc8;}else{_0xcd376a=0xce;}_0xcc09fc[_0x3b6c('0x19')](_0xcd376a);return _0xcc09fc[_0x3b6c('0x1d')](_0x3b6c('0x1e'),_0x3936fc+'-'+_0x3f0572+'/'+_0x1182f3)[_0x3b6c('0x1f')](_0x21d1d9);}return null;};}function patchUpdates(_0x2159b6){return function(_0x324801){try{jsonpatch[_0x3b6c('0x20')](_0x324801,_0x2159b6,!![]);}catch(_0x2b0ecc){return BPromise['reject'](_0x2b0ecc);}return _0x324801[_0x3b6c('0x21')]();};}function saveUpdates(_0x23d1e2,_0x5d685a){return function(_0x36cad2){if(_0x36cad2){return _0x36cad2[_0x3b6c('0x22')](_0x23d1e2)[_0x3b6c('0x23')](function(_0x56eab7){return _0x56eab7;});}return null;};}function removeEntity(_0x43d256,_0x5d0f0f){return function(_0xd2e6d4){if(_0xd2e6d4){return _0xd2e6d4[_0x3b6c('0x24')]()['then'](function(){_0x43d256[_0x3b6c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373e8d,_0x20b36a){return function(_0x38f729){if(!_0x38f729){_0x373e8d[_0x3b6c('0x18')](0x194);}return _0x38f729;};}function handleError(_0x27a317,_0x4fdd45){_0x4fdd45=_0x4fdd45||0x1f4;return function(_0xf63286){logger[_0x3b6c('0x25')](_0xf63286[_0x3b6c('0x26')]);if(_0xf63286['name']){delete _0xf63286[_0x3b6c('0x27')];}_0x27a317[_0x3b6c('0x19')](_0x4fdd45)[_0x3b6c('0x28')](_0xf63286);};}exports['index']=function(_0x9362fd,_0x4bcb04){var _0x374452={},_0x6191b6={},_0x4e22d6={'count':0x0,'rows':[]};var _0x49cdac=_[_0x3b6c('0x29')](db[_0x3b6c('0x2a')][_0x3b6c('0x2b')],function(_0x16878e){return{'name':_0x16878e[_0x3b6c('0x2c')],'type':_0x16878e[_0x3b6c('0x2d')]['key']};});_0x6191b6[_0x3b6c('0x2e')]=_[_0x3b6c('0x29')](_0x49cdac,_0x3b6c('0x27'));_0x6191b6[_0x3b6c('0x2f')]=_[_0x3b6c('0x30')](_0x9362fd[_0x3b6c('0x2f')]);_0x6191b6['filters']=_[_0x3b6c('0x31')](_0x6191b6[_0x3b6c('0x2e')],_0x6191b6[_0x3b6c('0x2f')]);_0x374452[_0x3b6c('0x32')]=_[_0x3b6c('0x31')](_0x6191b6[_0x3b6c('0x2e')],qs['fields'](_0x9362fd['query'][_0x3b6c('0x33')]));_0x374452[_0x3b6c('0x32')]=_0x374452[_0x3b6c('0x32')][_0x3b6c('0x34')]?_0x374452[_0x3b6c('0x32')]:_0x6191b6[_0x3b6c('0x2e')];if(!_0x9362fd['query']['hasOwnProperty'](_0x3b6c('0x35'))){_0x374452[_0x3b6c('0x36')]=qs['limit'](_0x9362fd['query'][_0x3b6c('0x36')]);_0x374452['offset']=qs[_0x3b6c('0x1c')](_0x9362fd['query'][_0x3b6c('0x1c')]);}_0x374452[_0x3b6c('0x37')]=qs['sort'](_0x9362fd[_0x3b6c('0x2f')][_0x3b6c('0x38')]);_0x374452[_0x3b6c('0x39')]=qs[_0x3b6c('0x3a')](_['pick'](_0x9362fd['query'],_0x6191b6['filters']),_0x49cdac);if(_0x9362fd[_0x3b6c('0x2f')][_0x3b6c('0x3b')]){_0x374452[_0x3b6c('0x39')]=_[_0x3b6c('0x3c')](_0x374452['where'],{'$or':_['map'](_0x49cdac,function(_0x378b1d){if(_0x378b1d['type']!==_0x3b6c('0x3d')){var _0x2685e9={};_0x2685e9[_0x378b1d[_0x3b6c('0x27')]]={'$like':'%'+_0x9362fd[_0x3b6c('0x2f')][_0x3b6c('0x3b')]+'%'};return _0x2685e9;}})});}_0x374452=_['merge']({},_0x374452,_0x9362fd[_0x3b6c('0x3e')]);var _0x3d19d5={'where':_0x374452[_0x3b6c('0x39')]};return db[_0x3b6c('0x2a')]['count'](_0x3d19d5)[_0x3b6c('0x23')](function(_0x156ea2){_0x4e22d6[_0x3b6c('0x1b')]=_0x156ea2;if(_0x9362fd['query']['includeAll']){_0x374452[_0x3b6c('0x3f')]=[{'all':!![]}];}return db[_0x3b6c('0x2a')][_0x3b6c('0x40')](_0x374452);})[_0x3b6c('0x23')](function(_0x5be4e5){_0x4e22d6[_0x3b6c('0x41')]=_0x5be4e5;return _0x4e22d6;})['then'](respondWithFilteredResult(_0x4bcb04,_0x374452))[_0x3b6c('0x42')](handleError(_0x4bcb04,null));};exports[_0x3b6c('0x43')]=function(_0x41591e,_0x3c0e34){var _0x906d90={'raw':![],'where':{'id':_0x41591e[_0x3b6c('0x44')]['id']}},_0x118e98={};_0x118e98[_0x3b6c('0x2e')]=_[_0x3b6c('0x30')](db[_0x3b6c('0x2a')][_0x3b6c('0x2b')]);_0x118e98[_0x3b6c('0x2f')]=_[_0x3b6c('0x30')](_0x41591e[_0x3b6c('0x2f')]);_0x118e98[_0x3b6c('0x3a')]=_[_0x3b6c('0x31')](_0x118e98['model'],_0x118e98['query']);_0x906d90['attributes']=_['intersection'](_0x118e98[_0x3b6c('0x2e')],qs['fields'](_0x41591e[_0x3b6c('0x2f')][_0x3b6c('0x33')]));_0x906d90[_0x3b6c('0x32')]=_0x906d90[_0x3b6c('0x32')][_0x3b6c('0x34')]?_0x906d90['attributes']:_0x118e98['model'];if(_0x41591e['query'][_0x3b6c('0x45')]){_0x906d90['include']=[{'all':!![]}];}_0x906d90=_['merge']({},_0x906d90,_0x41591e['options']);return db['Automation'][_0x3b6c('0x46')](_0x906d90)['then'](handleEntityNotFound(_0x3c0e34,null))['then'](respondWithResult(_0x3c0e34,null))[_0x3b6c('0x42')](handleError(_0x3c0e34,null));};exports[_0x3b6c('0x47')]=function(_0x54bed4,_0x1ae6c4){return db[_0x3b6c('0x2a')][_0x3b6c('0x47')](_0x54bed4['body'],{})[_0x3b6c('0x23')](respondWithResult(_0x1ae6c4,0xc9))[_0x3b6c('0x42')](handleError(_0x1ae6c4,null));};exports['update']=function(_0x5cbd95,_0x552a15){if(_0x5cbd95['body']['id']){delete _0x5cbd95['body']['id'];}return db['Automation'][_0x3b6c('0x46')]({'where':{'id':_0x5cbd95[_0x3b6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x552a15,null))[_0x3b6c('0x23')](saveUpdates(_0x5cbd95[_0x3b6c('0x48')],null))[_0x3b6c('0x23')](respondWithResult(_0x552a15,null))[_0x3b6c('0x42')](handleError(_0x552a15,null));};exports[_0x3b6c('0x24')]=function(_0x2e9675,_0x5ecbb3){return db['Automation'][_0x3b6c('0x46')]({'where':{'id':_0x2e9675['params']['id']}})[_0x3b6c('0x23')](handleEntityNotFound(_0x5ecbb3,null))[_0x3b6c('0x23')](removeEntity(_0x5ecbb3,null))[_0x3b6c('0x42')](handleError(_0x5ecbb3,null));};exports[_0x3b6c('0x49')]=function(_0x1e8485,_0x185842,_0x555bb1){return db[_0x3b6c('0x4a')]['find']({'where':{'id':_0x1e8485[_0x3b6c('0x44')]['id']}})[_0x3b6c('0x23')](handleEntityNotFound(_0x185842,null))[_0x3b6c('0x23')](function(_0xfa134){if(_0xfa134){return _0xfa134['addConditions'](_0x1e8485[_0x3b6c('0x48')]['ids'],_[_0x3b6c('0x4b')](_0x1e8485['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x185842,null))[_0x3b6c('0x42')](handleError(_0x185842,null));};exports[_0x3b6c('0x4c')]=function(_0x401501,_0x256d6d,_0x208303){var _0x1533a0={};var _0x58ae86={};var _0x44e53d;var _0x3cc3e7;return db['Automation'][_0x3b6c('0x4d')]({'where':{'id':_0x401501['params']['id']}})[_0x3b6c('0x23')](handleEntityNotFound(_0x256d6d,null))[_0x3b6c('0x23')](function(_0x32b98a){if(_0x32b98a){_0x44e53d=_0x32b98a;_0x58ae86['model']=_[_0x3b6c('0x30')](db[_0x3b6c('0x4a')][_0x3b6c('0x2b')]);_0x58ae86[_0x3b6c('0x2f')]=_[_0x3b6c('0x30')](_0x401501[_0x3b6c('0x2f')]);_0x58ae86[_0x3b6c('0x3a')]=_[_0x3b6c('0x31')](_0x58ae86[_0x3b6c('0x2e')],_0x58ae86[_0x3b6c('0x2f')]);_0x1533a0[_0x3b6c('0x32')]=_[_0x3b6c('0x31')](_0x58ae86[_0x3b6c('0x2e')],qs['fields'](_0x401501[_0x3b6c('0x2f')]['fields']));_0x1533a0[_0x3b6c('0x32')]=_0x1533a0[_0x3b6c('0x32')]['length']?_0x1533a0[_0x3b6c('0x32')]:_0x58ae86['model'];_0x1533a0[_0x3b6c('0x37')]=qs[_0x3b6c('0x38')](_0x401501[_0x3b6c('0x2f')]['sort']);_0x1533a0[_0x3b6c('0x39')]=qs[_0x3b6c('0x3a')](_[_0x3b6c('0x4e')](_0x401501['query'],_0x58ae86[_0x3b6c('0x3a')]));if(_0x401501[_0x3b6c('0x2f')]['filter']){_0x1533a0['where']=_[_0x3b6c('0x3c')](_0x1533a0['where'],{'$or':_[_0x3b6c('0x29')](_0x1533a0[_0x3b6c('0x32')],function(_0xb5dbbf){var _0x488021={};_0x488021[_0xb5dbbf]={'$like':'%'+_0x401501[_0x3b6c('0x2f')][_0x3b6c('0x3b')]+'%'};return _0x488021;})});}_0x1533a0=_[_0x3b6c('0x3c')]({},_0x1533a0,_0x401501[_0x3b6c('0x3e')]);return _0x44e53d[_0x3b6c('0x4c')](_0x1533a0);}})[_0x3b6c('0x23')](function(_0xf9baaf){if(_0xf9baaf){_0x3cc3e7=_0xf9baaf['length'];if(!_0x401501['query']['hasOwnProperty']('nolimit')){_0x1533a0[_0x3b6c('0x36')]=qs[_0x3b6c('0x36')](_0x401501['query'][_0x3b6c('0x36')]);_0x1533a0[_0x3b6c('0x1c')]=qs[_0x3b6c('0x1c')](_0x401501['query']['offset']);}return _0x44e53d[_0x3b6c('0x4c')](_0x1533a0);}})['then'](function(_0x3e49f2){if(_0x3e49f2){return _0x3e49f2?{'count':_0x3cc3e7,'rows':_0x3e49f2}:null;}})[_0x3b6c('0x23')](respondWithResult(_0x256d6d,null))[_0x3b6c('0x42')](handleError(_0x256d6d,null));};exports['addActions']=function(_0x16225e,_0x383ea7,_0x2f52a4){return db['Action'][_0x3b6c('0x46')]({'where':{'id':_0x16225e['params']['id']}})['then'](handleEntityNotFound(_0x383ea7,null))[_0x3b6c('0x23')](function(_0x5a5c5e){if(_0x5a5c5e){return _0x5a5c5e[_0x3b6c('0x4f')](_0x16225e[_0x3b6c('0x48')]['ids'],_[_0x3b6c('0x4b')](_0x16225e[_0x3b6c('0x48')],[_0x3b6c('0x50'),'id'])||{});}})['then'](respondWithResult(_0x383ea7,null))[_0x3b6c('0x42')](handleError(_0x383ea7,null));};exports[_0x3b6c('0x51')]=function(_0x69fb10,_0x423092,_0x202fb2){var _0x1932eb={};var _0x28d318={};var _0x4c323d;var _0x50622a;return db[_0x3b6c('0x2a')][_0x3b6c('0x4d')]({'where':{'id':_0x69fb10[_0x3b6c('0x44')]['id']}})[_0x3b6c('0x23')](handleEntityNotFound(_0x423092,null))[_0x3b6c('0x23')](function(_0x5232e3){if(_0x5232e3){_0x4c323d=_0x5232e3;_0x28d318['model']=_[_0x3b6c('0x30')](db['Action'][_0x3b6c('0x2b')]);_0x28d318['query']=_[_0x3b6c('0x30')](_0x69fb10[_0x3b6c('0x2f')]);_0x28d318['filters']=_[_0x3b6c('0x31')](_0x28d318[_0x3b6c('0x2e')],_0x28d318[_0x3b6c('0x2f')]);_0x1932eb[_0x3b6c('0x32')]=_['intersection'](_0x28d318[_0x3b6c('0x2e')],qs[_0x3b6c('0x33')](_0x69fb10[_0x3b6c('0x2f')]['fields']));_0x1932eb[_0x3b6c('0x32')]=_0x1932eb[_0x3b6c('0x32')][_0x3b6c('0x34')]?_0x1932eb[_0x3b6c('0x32')]:_0x28d318[_0x3b6c('0x2e')];_0x1932eb['order']=qs[_0x3b6c('0x38')](_0x69fb10[_0x3b6c('0x2f')][_0x3b6c('0x38')]);_0x1932eb[_0x3b6c('0x39')]=qs[_0x3b6c('0x3a')](_[_0x3b6c('0x4e')](_0x69fb10['query'],_0x28d318[_0x3b6c('0x3a')]));if(_0x69fb10[_0x3b6c('0x2f')][_0x3b6c('0x3b')]){_0x1932eb[_0x3b6c('0x39')]=_['merge'](_0x1932eb[_0x3b6c('0x39')],{'$or':_[_0x3b6c('0x29')](_0x1932eb[_0x3b6c('0x32')],function(_0x4b4457){var _0x47ac6a={};_0x47ac6a[_0x4b4457]={'$like':'%'+_0x69fb10[_0x3b6c('0x2f')][_0x3b6c('0x3b')]+'%'};return _0x47ac6a;})});}_0x1932eb=_[_0x3b6c('0x3c')]({},_0x1932eb,_0x69fb10['options']);return _0x4c323d[_0x3b6c('0x51')](_0x1932eb);}})[_0x3b6c('0x23')](function(_0x4e1a31){if(_0x4e1a31){_0x50622a=_0x4e1a31['length'];if(!_0x69fb10[_0x3b6c('0x2f')][_0x3b6c('0x52')]('nolimit')){_0x1932eb[_0x3b6c('0x36')]=qs[_0x3b6c('0x36')](_0x69fb10['query'][_0x3b6c('0x36')]);_0x1932eb[_0x3b6c('0x1c')]=qs[_0x3b6c('0x1c')](_0x69fb10[_0x3b6c('0x2f')][_0x3b6c('0x1c')]);}return _0x4c323d[_0x3b6c('0x51')](_0x1932eb);}})['then'](function(_0x55239c){if(_0x55239c){return _0x55239c?{'count':_0x50622a,'rows':_0x55239c}:null;}})[_0x3b6c('0x23')](respondWithResult(_0x423092,null))[_0x3b6c('0x42')](handleError(_0x423092,null));}; \ No newline at end of file +var _0x60ff=['order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action','getActions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x108ec7,_0x46a6c5){var _0x2429ce=function(_0x4dbe47){while(--_0x4dbe47){_0x108ec7['push'](_0x108ec7['shift']());}};_0x2429ce(++_0x46a6c5);}(_0x60ff,0x72));var _0xf60f=function(_0x5bacef,_0x11171f){_0x5bacef=_0x5bacef-0x0;var _0x164fef=_0x60ff[_0x5bacef];return _0x164fef;};'use strict';var pdf=require(_0xf60f('0x0'));var emlformat=require(_0xf60f('0x1'));var rimraf=require(_0xf60f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf60f('0x3'));var moment=require('moment');var BPromise=require(_0xf60f('0x4'));var Mustache=require(_0xf60f('0x5'));var util=require(_0xf60f('0x6'));var path=require(_0xf60f('0x7'));var sox=require(_0xf60f('0x8'));var csv=require(_0xf60f('0x9'));var ejs=require(_0xf60f('0xa'));var fs=require('fs');var _=require(_0xf60f('0xb'));var squel=require(_0xf60f('0xc'));var crypto=require(_0xf60f('0xd'));var jsforce=require(_0xf60f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf60f('0xf'));var authService=require(_0xf60f('0x10'));var qs=require(_0xf60f('0x11'));var as=require(_0xf60f('0x12'));var hardwareService=require(_0xf60f('0x13'));var logger=require(_0xf60f('0x14'))(_0xf60f('0x15'));var utils=require(_0xf60f('0x16'));var config=require(_0xf60f('0x17'));var db=require(_0xf60f('0x18'))['db'];function respondWithStatusCode(_0x169a78,_0x29f766){_0x29f766=_0x29f766||0xcc;return function(_0x364d7e){if(_0x364d7e){return _0x169a78[_0xf60f('0x19')](_0x29f766);}return _0x169a78[_0xf60f('0x1a')](_0x29f766)[_0xf60f('0x1b')]();};}function respondWithResult(_0x5d9d74,_0x57dddf){_0x57dddf=_0x57dddf||0xc8;return function(_0x145bbc){if(_0x145bbc){return _0x5d9d74[_0xf60f('0x1a')](_0x57dddf)[_0xf60f('0x1c')](_0x145bbc);}};}function respondWithFilteredResult(_0x5b5eaf,_0x23cab9){return function(_0x3d0a0b){if(_0x3d0a0b){var _0x18b40f=_0x3d0a0b[_0xf60f('0x1d')],_0x493771=_0x23cab9[_0xf60f('0x1e')],_0x33a499=_0x23cab9[_0xf60f('0x1e')]+_0x23cab9[_0xf60f('0x1f')],_0x4c6a97;if(_0x33a499>=_0x18b40f){_0x33a499=_0x18b40f;_0x4c6a97=0xc8;}else{_0x4c6a97=0xce;}_0x5b5eaf['status'](_0x4c6a97);return _0x5b5eaf[_0xf60f('0x20')](_0xf60f('0x21'),_0x493771+'-'+_0x33a499+'/'+_0x18b40f)[_0xf60f('0x1c')](_0x3d0a0b);}return null;};}function patchUpdates(_0x2438bc){return function(_0x1fc302){try{jsonpatch[_0xf60f('0x22')](_0x1fc302,_0x2438bc,!![]);}catch(_0x2709e7){return BPromise[_0xf60f('0x23')](_0x2709e7);}return _0x1fc302[_0xf60f('0x24')]();};}function saveUpdates(_0x2a517d,_0x2b4d94){return function(_0x42ccbe){if(_0x42ccbe){return _0x42ccbe[_0xf60f('0x25')](_0x2a517d)[_0xf60f('0x26')](function(_0x33883b){return _0x33883b;});}return null;};}function removeEntity(_0x3dfdbf,_0x1cf923){return function(_0x407f4a){if(_0x407f4a){return _0x407f4a[_0xf60f('0x27')]()[_0xf60f('0x26')](function(){_0x3dfdbf['status'](0xcc)[_0xf60f('0x1b')]();});}};}function handleEntityNotFound(_0x3ac4a3,_0x417a3a){return function(_0x1250fb){if(!_0x1250fb){_0x3ac4a3[_0xf60f('0x19')](0x194);}return _0x1250fb;};}function handleError(_0x18bfad,_0xf3e54){_0xf3e54=_0xf3e54||0x1f4;return function(_0x1f3c13){logger[_0xf60f('0x28')](_0x1f3c13[_0xf60f('0x29')]);if(_0x1f3c13[_0xf60f('0x2a')]){delete _0x1f3c13[_0xf60f('0x2a')];}_0x18bfad[_0xf60f('0x1a')](_0xf3e54)[_0xf60f('0x2b')](_0x1f3c13);};}exports[_0xf60f('0x2c')]=function(_0x34d4fe,_0xe0101e){var _0x2ac37d={},_0x41fab9={},_0x5d5e35={'count':0x0,'rows':[]};var _0x2a7f01=_['map'](db[_0xf60f('0x2d')][_0xf60f('0x2e')],function(_0xedc0c){return{'name':_0xedc0c[_0xf60f('0x2f')],'type':_0xedc0c['type'][_0xf60f('0x30')]};});_0x41fab9[_0xf60f('0x31')]=_['map'](_0x2a7f01,_0xf60f('0x2a'));_0x41fab9[_0xf60f('0x32')]=_['keys'](_0x34d4fe[_0xf60f('0x32')]);_0x41fab9[_0xf60f('0x33')]=_[_0xf60f('0x34')](_0x41fab9[_0xf60f('0x31')],_0x41fab9[_0xf60f('0x32')]);_0x2ac37d[_0xf60f('0x35')]=_['intersection'](_0x41fab9['model'],qs[_0xf60f('0x36')](_0x34d4fe[_0xf60f('0x32')][_0xf60f('0x36')]));_0x2ac37d[_0xf60f('0x35')]=_0x2ac37d[_0xf60f('0x35')][_0xf60f('0x37')]?_0x2ac37d['attributes']:_0x41fab9['model'];if(!_0x34d4fe[_0xf60f('0x32')][_0xf60f('0x38')](_0xf60f('0x39'))){_0x2ac37d[_0xf60f('0x1f')]=qs[_0xf60f('0x1f')](_0x34d4fe[_0xf60f('0x32')][_0xf60f('0x1f')]);_0x2ac37d[_0xf60f('0x1e')]=qs[_0xf60f('0x1e')](_0x34d4fe[_0xf60f('0x32')][_0xf60f('0x1e')]);}_0x2ac37d[_0xf60f('0x3a')]=qs[_0xf60f('0x3b')](_0x34d4fe[_0xf60f('0x32')][_0xf60f('0x3b')]);_0x2ac37d[_0xf60f('0x3c')]=qs['filters'](_[_0xf60f('0x3d')](_0x34d4fe[_0xf60f('0x32')],_0x41fab9[_0xf60f('0x33')]),_0x2a7f01);if(_0x34d4fe['query'][_0xf60f('0x3e')]){_0x2ac37d[_0xf60f('0x3c')]=_[_0xf60f('0x3f')](_0x2ac37d[_0xf60f('0x3c')],{'$or':_[_0xf60f('0x40')](_0x2a7f01,function(_0x2f5a18){if(_0x2f5a18['type']!==_0xf60f('0x41')){var _0x4b8133={};_0x4b8133[_0x2f5a18[_0xf60f('0x2a')]]={'$like':'%'+_0x34d4fe[_0xf60f('0x32')]['filter']+'%'};return _0x4b8133;}})});}_0x2ac37d=_[_0xf60f('0x3f')]({},_0x2ac37d,_0x34d4fe['options']);var _0x4c2a5e={'where':_0x2ac37d[_0xf60f('0x3c')]};return db[_0xf60f('0x2d')][_0xf60f('0x1d')](_0x4c2a5e)[_0xf60f('0x26')](function(_0x408f6c){_0x5d5e35[_0xf60f('0x1d')]=_0x408f6c;if(_0x34d4fe[_0xf60f('0x32')][_0xf60f('0x42')]){_0x2ac37d['include']=[{'all':!![]}];}return db[_0xf60f('0x2d')][_0xf60f('0x43')](_0x2ac37d);})[_0xf60f('0x26')](function(_0xd660de){_0x5d5e35[_0xf60f('0x44')]=_0xd660de;return _0x5d5e35;})[_0xf60f('0x26')](respondWithFilteredResult(_0xe0101e,_0x2ac37d))[_0xf60f('0x45')](handleError(_0xe0101e,null));};exports['show']=function(_0x9dfe3c,_0x419cd1){var _0x50c98b={'raw':![],'where':{'id':_0x9dfe3c[_0xf60f('0x46')]['id']}},_0x50b324={};_0x50b324[_0xf60f('0x31')]=_[_0xf60f('0x47')](db[_0xf60f('0x2d')][_0xf60f('0x2e')]);_0x50b324[_0xf60f('0x32')]=_['keys'](_0x9dfe3c[_0xf60f('0x32')]);_0x50b324[_0xf60f('0x33')]=_[_0xf60f('0x34')](_0x50b324[_0xf60f('0x31')],_0x50b324[_0xf60f('0x32')]);_0x50c98b['attributes']=_[_0xf60f('0x34')](_0x50b324[_0xf60f('0x31')],qs[_0xf60f('0x36')](_0x9dfe3c[_0xf60f('0x32')][_0xf60f('0x36')]));_0x50c98b['attributes']=_0x50c98b[_0xf60f('0x35')][_0xf60f('0x37')]?_0x50c98b[_0xf60f('0x35')]:_0x50b324[_0xf60f('0x31')];if(_0x9dfe3c[_0xf60f('0x32')][_0xf60f('0x42')]){_0x50c98b[_0xf60f('0x48')]=[{'all':!![]}];}_0x50c98b=_[_0xf60f('0x3f')]({},_0x50c98b,_0x9dfe3c[_0xf60f('0x49')]);return db[_0xf60f('0x2d')][_0xf60f('0x4a')](_0x50c98b)[_0xf60f('0x26')](handleEntityNotFound(_0x419cd1,null))[_0xf60f('0x26')](respondWithResult(_0x419cd1,null))['catch'](handleError(_0x419cd1,null));};exports[_0xf60f('0x4b')]=function(_0x2ad3c5,_0x3cdd33){return db[_0xf60f('0x2d')][_0xf60f('0x4b')](_0x2ad3c5[_0xf60f('0x4c')],{})[_0xf60f('0x26')](respondWithResult(_0x3cdd33,0xc9))[_0xf60f('0x45')](handleError(_0x3cdd33,null));};exports['update']=function(_0x4a8d89,_0x3be40d){if(_0x4a8d89[_0xf60f('0x4c')]['id']){delete _0x4a8d89['body']['id'];}return db[_0xf60f('0x2d')][_0xf60f('0x4a')]({'where':{'id':_0x4a8d89[_0xf60f('0x46')]['id']}})[_0xf60f('0x26')](handleEntityNotFound(_0x3be40d,null))[_0xf60f('0x26')](saveUpdates(_0x4a8d89['body'],null))['then'](respondWithResult(_0x3be40d,null))[_0xf60f('0x45')](handleError(_0x3be40d,null));};exports[_0xf60f('0x27')]=function(_0x1ec89b,_0x186b1e){return db[_0xf60f('0x2d')][_0xf60f('0x4a')]({'where':{'id':_0x1ec89b[_0xf60f('0x46')]['id']}})['then'](handleEntityNotFound(_0x186b1e,null))[_0xf60f('0x26')](removeEntity(_0x186b1e,null))[_0xf60f('0x45')](handleError(_0x186b1e,null));};exports[_0xf60f('0x4d')]=function(_0x10fb29,_0x53d5b0,_0x27bdf9){return db['Condition']['find']({'where':{'id':_0x10fb29[_0xf60f('0x46')]['id']}})[_0xf60f('0x26')](handleEntityNotFound(_0x53d5b0,null))[_0xf60f('0x26')](function(_0x5c96ac){if(_0x5c96ac){return _0x5c96ac[_0xf60f('0x4d')](_0x10fb29[_0xf60f('0x4c')][_0xf60f('0x4e')],_[_0xf60f('0x4f')](_0x10fb29[_0xf60f('0x4c')],['ids','id'])||{});}})[_0xf60f('0x26')](respondWithResult(_0x53d5b0,null))[_0xf60f('0x45')](handleError(_0x53d5b0,null));};exports[_0xf60f('0x50')]=function(_0x1c11bd,_0x1ee6f1,_0xfc5a9d){var _0x3277e7={};var _0x262811={};var _0xd79dee;var _0x763633;return db[_0xf60f('0x2d')][_0xf60f('0x51')]({'where':{'id':_0x1c11bd['params']['id']}})['then'](handleEntityNotFound(_0x1ee6f1,null))[_0xf60f('0x26')](function(_0x968468){if(_0x968468){_0xd79dee=_0x968468;_0x262811[_0xf60f('0x31')]=_[_0xf60f('0x47')](db[_0xf60f('0x52')][_0xf60f('0x2e')]);_0x262811[_0xf60f('0x32')]=_[_0xf60f('0x47')](_0x1c11bd[_0xf60f('0x32')]);_0x262811[_0xf60f('0x33')]=_[_0xf60f('0x34')](_0x262811['model'],_0x262811['query']);_0x3277e7['attributes']=_[_0xf60f('0x34')](_0x262811['model'],qs['fields'](_0x1c11bd[_0xf60f('0x32')][_0xf60f('0x36')]));_0x3277e7[_0xf60f('0x35')]=_0x3277e7[_0xf60f('0x35')][_0xf60f('0x37')]?_0x3277e7[_0xf60f('0x35')]:_0x262811['model'];_0x3277e7['order']=qs[_0xf60f('0x3b')](_0x1c11bd[_0xf60f('0x32')]['sort']);_0x3277e7[_0xf60f('0x3c')]=qs[_0xf60f('0x33')](_['pick'](_0x1c11bd[_0xf60f('0x32')],_0x262811['filters']));if(_0x1c11bd[_0xf60f('0x32')][_0xf60f('0x3e')]){_0x3277e7[_0xf60f('0x3c')]=_['merge'](_0x3277e7['where'],{'$or':_[_0xf60f('0x40')](_0x3277e7['attributes'],function(_0x4b1a42){var _0x435f86={};_0x435f86[_0x4b1a42]={'$like':'%'+_0x1c11bd[_0xf60f('0x32')][_0xf60f('0x3e')]+'%'};return _0x435f86;})});}_0x3277e7=_[_0xf60f('0x3f')]({},_0x3277e7,_0x1c11bd[_0xf60f('0x49')]);return _0xd79dee[_0xf60f('0x50')](_0x3277e7);}})[_0xf60f('0x26')](function(_0x3a1d91){if(_0x3a1d91){_0x763633=_0x3a1d91[_0xf60f('0x37')];if(!_0x1c11bd[_0xf60f('0x32')][_0xf60f('0x38')](_0xf60f('0x39'))){_0x3277e7[_0xf60f('0x1f')]=qs[_0xf60f('0x1f')](_0x1c11bd[_0xf60f('0x32')]['limit']);_0x3277e7[_0xf60f('0x1e')]=qs['offset'](_0x1c11bd[_0xf60f('0x32')][_0xf60f('0x1e')]);}return _0xd79dee[_0xf60f('0x50')](_0x3277e7);}})[_0xf60f('0x26')](function(_0x3a7087){if(_0x3a7087){return _0x3a7087?{'count':_0x763633,'rows':_0x3a7087}:null;}})[_0xf60f('0x26')](respondWithResult(_0x1ee6f1,null))[_0xf60f('0x45')](handleError(_0x1ee6f1,null));};exports[_0xf60f('0x53')]=function(_0x50ae10,_0x367504,_0x1cca97){return db[_0xf60f('0x54')]['find']({'where':{'id':_0x50ae10[_0xf60f('0x46')]['id']}})['then'](handleEntityNotFound(_0x367504,null))['then'](function(_0x5905ad){if(_0x5905ad){return _0x5905ad['addActions'](_0x50ae10[_0xf60f('0x4c')][_0xf60f('0x4e')],_[_0xf60f('0x4f')](_0x50ae10[_0xf60f('0x4c')],[_0xf60f('0x4e'),'id'])||{});}})[_0xf60f('0x26')](respondWithResult(_0x367504,null))[_0xf60f('0x45')](handleError(_0x367504,null));};exports[_0xf60f('0x55')]=function(_0x432148,_0x791f2d,_0x1326db){var _0x2b665e={};var _0xf0ed9={};var _0x3a1a6a;var _0x3fa9e2;return db[_0xf60f('0x2d')][_0xf60f('0x51')]({'where':{'id':_0x432148['params']['id']}})[_0xf60f('0x26')](handleEntityNotFound(_0x791f2d,null))[_0xf60f('0x26')](function(_0xad902){if(_0xad902){_0x3a1a6a=_0xad902;_0xf0ed9['model']=_[_0xf60f('0x47')](db['Action'][_0xf60f('0x2e')]);_0xf0ed9[_0xf60f('0x32')]=_['keys'](_0x432148[_0xf60f('0x32')]);_0xf0ed9[_0xf60f('0x33')]=_[_0xf60f('0x34')](_0xf0ed9[_0xf60f('0x31')],_0xf0ed9[_0xf60f('0x32')]);_0x2b665e['attributes']=_[_0xf60f('0x34')](_0xf0ed9[_0xf60f('0x31')],qs[_0xf60f('0x36')](_0x432148[_0xf60f('0x32')][_0xf60f('0x36')]));_0x2b665e[_0xf60f('0x35')]=_0x2b665e[_0xf60f('0x35')]['length']?_0x2b665e[_0xf60f('0x35')]:_0xf0ed9[_0xf60f('0x31')];_0x2b665e[_0xf60f('0x3a')]=qs[_0xf60f('0x3b')](_0x432148[_0xf60f('0x32')][_0xf60f('0x3b')]);_0x2b665e[_0xf60f('0x3c')]=qs[_0xf60f('0x33')](_[_0xf60f('0x3d')](_0x432148[_0xf60f('0x32')],_0xf0ed9[_0xf60f('0x33')]));if(_0x432148['query'][_0xf60f('0x3e')]){_0x2b665e[_0xf60f('0x3c')]=_[_0xf60f('0x3f')](_0x2b665e[_0xf60f('0x3c')],{'$or':_[_0xf60f('0x40')](_0x2b665e[_0xf60f('0x35')],function(_0x443f4b){var _0x3da116={};_0x3da116[_0x443f4b]={'$like':'%'+_0x432148[_0xf60f('0x32')][_0xf60f('0x3e')]+'%'};return _0x3da116;})});}_0x2b665e=_[_0xf60f('0x3f')]({},_0x2b665e,_0x432148['options']);return _0x3a1a6a[_0xf60f('0x55')](_0x2b665e);}})['then'](function(_0x1ad75b){if(_0x1ad75b){_0x3fa9e2=_0x1ad75b[_0xf60f('0x37')];if(!_0x432148[_0xf60f('0x32')][_0xf60f('0x38')]('nolimit')){_0x2b665e[_0xf60f('0x1f')]=qs[_0xf60f('0x1f')](_0x432148['query']['limit']);_0x2b665e[_0xf60f('0x1e')]=qs[_0xf60f('0x1e')](_0x432148['query']['offset']);}return _0x3a1a6a[_0xf60f('0x55')](_0x2b665e);}})[_0xf60f('0x26')](function(_0x509721){if(_0x509721){return _0x509721?{'count':_0x3fa9e2,'rows':_0x509721}:null;}})[_0xf60f('0x26')](respondWithResult(_0x791f2d,null))['catch'](handleError(_0x791f2d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 5e08ce1..fe6c6a9 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 _0xc9cb=['./automation.attributes','define','tools_automations','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x430ccc,_0x1523e8){var _0x497529=function(_0x5f60ba){while(--_0x5f60ba){_0x430ccc['push'](_0x430ccc['shift']());}};_0x497529(++_0x1523e8);}(_0xc9cb,0x14d));var _0xbc9c=function(_0x34bda4,_0x25daa5){_0x34bda4=_0x34bda4-0x0;var _0xbefec8=_0xc9cb[_0x34bda4];return _0xbefec8;};'use strict';var _=require(_0xbc9c('0x0'));var util=require('util');var logger=require(_0xbc9c('0x1'))(_0xbc9c('0x2'));var moment=require(_0xbc9c('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc9c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc9c('0x5'));var config=require(_0xbc9c('0x6'));var attributes=require(_0xbc9c('0x7'));module['exports']=function(_0x65dfdf,_0x14525c){return _0x65dfdf[_0xbc9c('0x8')]('Automation',attributes,{'tableName':_0xbc9c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc61=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash'];(function(_0x4effeb,_0x3f311c){var _0x3855d7=function(_0x4a064f){while(--_0x4a064f){_0x4effeb['push'](_0x4effeb['shift']());}};_0x3855d7(++_0x3f311c);}(_0xbc61,0xdc));var _0x1bc6=function(_0x1bde57,_0x5aca0f){_0x1bde57=_0x1bde57-0x0;var _0x22904d=_0xbc61[_0x1bde57];return _0x22904d;};'use strict';var _=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var logger=require(_0x1bc6('0x2'))(_0x1bc6('0x3'));var moment=require(_0x1bc6('0x4'));var BPromise=require(_0x1bc6('0x5'));var rp=require(_0x1bc6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1bc6('0x7'));var config=require(_0x1bc6('0x8'));var attributes=require(_0x1bc6('0x9'));module[_0x1bc6('0xa')]=function(_0x83731e,_0x3486d6){return _0x83731e[_0x1bc6('0xb')]('Automation',attributes,{'tableName':_0x1bc6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index df75777..0506229 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 _0x0409=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x0409,0x1dc));var _0x9040=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x0409[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x9040('0x0'));var util=require(_0x9040('0x1'));var moment=require(_0x9040('0x2'));var BPromise=require(_0x9040('0x3'));var rs=require(_0x9040('0x4'));var fs=require('fs');var Redis=require(_0x9040('0x5'));var db=require(_0x9040('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9040('0x7'))(_0x9040('0x8'));var config=require(_0x9040('0x9'));var jayson=require(_0x9040('0xa'));var client=jayson[_0x9040('0xb')][_0x9040('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54e922,_0x2bdaf3,_0x1ef627){return new BPromise(function(_0x4c5c0a,_0x47af88){return client[_0x9040('0xd')](_0x54e922,_0x1ef627)[_0x9040('0xe')](function(_0x143e91){logger[_0x9040('0xf')](_0x9040('0x10'),_0x2bdaf3,_0x9040('0x11'));logger['debug'](_0x9040('0x12'),_0x2bdaf3,_0x9040('0x11'),JSON[_0x9040('0x13')](_0x143e91));if(_0x143e91['error']){if(_0x143e91['error'][_0x9040('0x14')]===0x1f4){logger[_0x9040('0x15')](_0x9040('0x10'),_0x2bdaf3,_0x143e91[_0x9040('0x15')][_0x9040('0x16')]);return _0x47af88(_0x143e91['error'][_0x9040('0x16')]);}logger[_0x9040('0x15')](_0x9040('0x10'),_0x2bdaf3,_0x143e91[_0x9040('0x15')][_0x9040('0x16')]);return _0x4c5c0a(_0x143e91[_0x9040('0x15')][_0x9040('0x16')]);}else{logger[_0x9040('0xf')]('Automation,\x20%s,\x20%s',_0x2bdaf3,_0x9040('0x11'));_0x4c5c0a(_0x143e91['result'][_0x9040('0x16')]);}})[_0x9040('0x17')](function(_0x2a12ae){logger[_0x9040('0x15')]('Automation,\x20%s,\x20%s',_0x2bdaf3,_0x2a12ae);_0x47af88(_0x2a12ae);});});} \ No newline at end of file +var _0xe0c8=['info','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x3ad565,_0x1f5da4){var _0xc54e47=function(_0x49cf70){while(--_0x49cf70){_0x3ad565['push'](_0x3ad565['shift']());}};_0xc54e47(++_0x1f5da4);}(_0xe0c8,0xd9));var _0x8e0c=function(_0x293fa7,_0x1bdf5c){_0x293fa7=_0x293fa7-0x0;var _0x3f54dc=_0xe0c8[_0x293fa7];return _0x3f54dc;};'use strict';var _=require(_0x8e0c('0x0'));var util=require(_0x8e0c('0x1'));var moment=require(_0x8e0c('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e0c('0x3'));var fs=require('fs');var Redis=require(_0x8e0c('0x4'));var db=require(_0x8e0c('0x5'))['db'];var utils=require(_0x8e0c('0x6'));var logger=require(_0x8e0c('0x7'))(_0x8e0c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e0c('0x9')][_0x8e0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x249e9a,_0x4dd905,_0x20927d){return new BPromise(function(_0x5c5aed,_0x5ecf07){return client[_0x8e0c('0xb')](_0x249e9a,_0x20927d)[_0x8e0c('0xc')](function(_0x3350c2){logger[_0x8e0c('0xd')](_0x8e0c('0xe'),_0x4dd905,'request\x20sent');logger[_0x8e0c('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x4dd905,_0x8e0c('0x10'),JSON[_0x8e0c('0x11')](_0x3350c2));if(_0x3350c2[_0x8e0c('0x12')]){if(_0x3350c2['error'][_0x8e0c('0x13')]===0x1f4){logger[_0x8e0c('0x12')](_0x8e0c('0xe'),_0x4dd905,_0x3350c2['error'][_0x8e0c('0x14')]);return _0x5ecf07(_0x3350c2[_0x8e0c('0x12')][_0x8e0c('0x14')]);}logger[_0x8e0c('0x12')]('Automation,\x20%s,\x20%s',_0x4dd905,_0x3350c2['error']['message']);return _0x5c5aed(_0x3350c2[_0x8e0c('0x12')][_0x8e0c('0x14')]);}else{logger[_0x8e0c('0xd')](_0x8e0c('0xe'),_0x4dd905,_0x8e0c('0x10'));_0x5c5aed(_0x3350c2[_0x8e0c('0x15')][_0x8e0c('0x14')]);}})[_0x8e0c('0x16')](function(_0x3bd4b1){logger['error'](_0x8e0c('0xe'),_0x4dd905,_0x3bd4b1);_0x5ecf07(_0x3bd4b1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 8a7b58b..03e9304 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 _0xdb35=['util','express','Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','/:id/actions','create','post','addConditions','addActions','put','update','delete','destroy','exports','multer'];(function(_0x40079f,_0x437c96){var _0x518d98=function(_0x3a6012){while(--_0x3a6012){_0x40079f['push'](_0x40079f['shift']());}};_0x518d98(++_0x437c96);}(_0xdb35,0x8f));var _0x5db3=function(_0x1b87fb,_0x3e6870){_0x1b87fb=_0x1b87fb-0x0;var _0xc7de31=_0xdb35[_0x1b87fb];return _0xc7de31;};'use strict';var multer=require(_0x5db3('0x0'));var util=require(_0x5db3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5db3('0x2'));var router=express[_0x5db3('0x3')]();var auth=require(_0x5db3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5db3('0x5'));var controller=require(_0x5db3('0x6'));router['get']('/',auth[_0x5db3('0x7')](),controller[_0x5db3('0x8')]);router[_0x5db3('0x9')](_0x5db3('0xa'),auth[_0x5db3('0x7')](),controller[_0x5db3('0xb')]);router[_0x5db3('0x9')](_0x5db3('0xc'),auth[_0x5db3('0x7')](),controller[_0x5db3('0xd')]);router[_0x5db3('0x9')](_0x5db3('0xe'),auth[_0x5db3('0x7')](),controller['getActions']);router['post']('/',auth[_0x5db3('0x7')](),controller[_0x5db3('0xf')]);router[_0x5db3('0x10')](_0x5db3('0xc'),auth[_0x5db3('0x7')](),controller[_0x5db3('0x11')]);router['post'](_0x5db3('0xe'),auth[_0x5db3('0x7')](),controller[_0x5db3('0x12')]);router[_0x5db3('0x13')]('/:id',auth[_0x5db3('0x7')](),controller[_0x5db3('0x14')]);router[_0x5db3('0x15')](_0x5db3('0xa'),auth['isAuthenticated'](),controller[_0x5db3('0x16')]);module[_0x5db3('0x17')]=router; \ No newline at end of file +var _0x445f=['post','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id/conditions','getConditions','/:id/actions','getActions','create'];(function(_0x3c10ba,_0xd087a4){var _0x5de993=function(_0x4340cf){while(--_0x4340cf){_0x3c10ba['push'](_0x3c10ba['shift']());}};_0x5de993(++_0xd087a4);}(_0x445f,0x12c));var _0xf445=function(_0x1ac035,_0x4d8dff){_0x1ac035=_0x1ac035-0x0;var _0x4a7387=_0x445f[_0x1ac035];return _0x4a7387;};'use strict';var multer=require('multer');var util=require(_0xf445('0x0'));var path=require(_0xf445('0x1'));var timeout=require(_0xf445('0x2'));var express=require(_0xf445('0x3'));var router=express[_0xf445('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf445('0x5'));var config=require(_0xf445('0x6'));var controller=require(_0xf445('0x7'));router[_0xf445('0x8')]('/',auth[_0xf445('0x9')](),controller['index']);router[_0xf445('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf445('0x8')](_0xf445('0xa'),auth[_0xf445('0x9')](),controller[_0xf445('0xb')]);router[_0xf445('0x8')](_0xf445('0xc'),auth['isAuthenticated'](),controller[_0xf445('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf445('0xe')]);router[_0xf445('0xf')](_0xf445('0xa'),auth['isAuthenticated'](),controller['addConditions']);router['post']('/:id/actions',auth[_0xf445('0x9')](),controller['addActions']);router[_0xf445('0x10')](_0xf445('0x11'),auth['isAuthenticated'](),controller[_0xf445('0x12')]);router[_0xf445('0x13')](_0xf445('0x11'),auth[_0xf445('0x9')](),controller['destroy']);module[_0xf445('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 56cf716..6c5b5c7 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 _0x1562=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x557898,_0x5eae27){var _0x1adade=function(_0x394442){while(--_0x394442){_0x557898['push'](_0x557898['shift']());}};_0x1adade(++_0x5eae27);}(_0x1562,0xac));var _0x2156=function(_0x193266,_0x37c379){_0x193266=_0x193266-0x0;var _0x2a9bde=_0x1562[_0x193266];return _0x2a9bde;};'use strict';var Sequelize=require(_0x2156('0x0'));module[_0x2156('0x1')]={'name':{'type':Sequelize[_0x2156('0x2')],'unique':_0x2156('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2156('0x4')](_0x2156('0x5')),'allowNull':![],'defaultValue':_0x2156('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2156('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x2156('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2156('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2156('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2156('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x2156('0x9')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2156('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2156('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2156('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2156('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2156('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2156('0x9')](0x5)[_0x2156('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2156('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2156('0x9')](0x3)[_0x2156('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2156('0x9')](0x5)[_0x2156('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2156('0x9')](0x3)[_0x2156('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2156('0xd')},'dialTimezone':{'type':Sequelize[_0x2156('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2156('0x2')],'defaultValue':_0x2156('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x2156('0x4')](_0x2156('0xf'),_0x2156('0x10'),_0x2156('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x2156('0x12')],'defaultValue':0x0,'comment':_0x2156('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2156('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2156('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2156('0x9')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2156('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2156('0x9')](0x9)[_0x2156('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2156('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x2156('0x9')](0x9)[_0x2156('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2156('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2156('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2156('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2156('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2156('0x9')](0x5)[_0x2156('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2156('0x9')](0x9)[_0x2156('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2156('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2156('0x4')]('DESC','ASC'),'defaultValue':_0x2156('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2156('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x2156('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2156('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2156('0x9')](0x3)[_0x2156('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2156('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2156('0x9')](0x5)[_0x2156('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2156('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x2156('0x9')](0x3)[_0x2156('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x2156('0x9')](0x5)[_0x2156('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2156('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2156('0x9')](0x3)[_0x2156('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2156('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2156('0x9')](0x5)[_0x2156('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2156('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x2156('0x9')](0x3)[_0x2156('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2156('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2156('0x9')](0x5)[_0x2156('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2156('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2156('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2156('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2156('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2156('0x24')}}; \ No newline at end of file +var _0x1576=['#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)','sequelize','exports','name','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ENUM','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x163215,_0x2ecd21){var _0x491f76=function(_0x59c5c7){while(--_0x59c5c7){_0x163215['push'](_0x163215['shift']());}};_0x491f76(++_0x2ecd21);}(_0x1576,0x180));var _0x6157=function(_0x5e1855,_0x17161e){_0x5e1855=_0x5e1855-0x0;var _0x4faf68=_0x1576[_0x5e1855];return _0x4faf68;};'use strict';var Sequelize=require(_0x6157('0x0'));module[_0x6157('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6157('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6157('0x3')),'allowNull':![],'defaultValue':_0x6157('0x3')},'description':{'type':Sequelize[_0x6157('0x4')]},'active':{'type':Sequelize[_0x6157('0x5')],'defaultValue':0x0,'comment':_0x6157('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x6157('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x6157('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6157('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x6157('0x8')](0x3)[_0x6157('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6157('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6157('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6157('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6157('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6157('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6157('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6157('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6157('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6157('0x8')](0x3)[_0x6157('0x7')],'defaultValue':0x3,'comment':_0x6157('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6157('0x8')](0x5)[_0x6157('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6157('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6157('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6157('0x10')},'dialTimezone':{'type':Sequelize[_0x6157('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6157('0x4')],'defaultValue':_0x6157('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x6157('0x12'),_0x6157('0x13'),_0x6157('0x14')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6157('0x5')],'defaultValue':0x0,'comment':_0x6157('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x6157('0x8')](0x9)[_0x6157('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6157('0x16')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x6157('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6157('0x8')](0x9)[_0x6157('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6157('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x6157('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6157('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x6157('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6157('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6157('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6157('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6157('0x8')](0x9)[_0x6157('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x6157('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6157('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6157('0x8')](0x9)[_0x6157('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x6157('0x1c')]('DESC',_0x6157('0x1d')),'defaultValue':_0x6157('0x1e')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6157('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6157('0x1f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6157('0x8')](0x3)[_0x6157('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6157('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6157('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6157('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x6157('0x8')](0x5)[_0x6157('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6157('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6157('0x8')](0x3)[_0x6157('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6157('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6157('0x8')](0x5)[_0x6157('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x6157('0x8')](0x3)[_0x6157('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6157('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6157('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6157('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6157('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6157('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6157('0x8')](0x5)[_0x6157('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 72489b1..945c4b9 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 _0x172c=['getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','ListId','select','field','NOW()','scheduledAt','ContactId','CmListId','toString','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','cm_hopper','fromQuery','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','push','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','CmHopper','hasOwnProperty','order','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack'];(function(_0x57fca6,_0x497213){var _0x1f2800=function(_0x3333b8){while(--_0x3333b8){_0x57fca6['push'](_0x57fca6['shift']());}};_0x1f2800(++_0x497213);}(_0x172c,0x13e));var _0xc172=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x172c[_0x3fb030];return _0xd6899b;};'use strict';var pdf=require(_0xc172('0x0'));var emlformat=require(_0xc172('0x1'));var rimraf=require(_0xc172('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc172('0x3'));var rp=require(_0xc172('0x4'));var moment=require(_0xc172('0x5'));var BPromise=require(_0xc172('0x6'));var Mustache=require(_0xc172('0x7'));var util=require(_0xc172('0x8'));var path=require('path');var sox=require(_0xc172('0x9'));var csv=require('to-csv');var ejs=require(_0xc172('0xa'));var fs=require('fs');var _=require(_0xc172('0xb'));var squel=require(_0xc172('0xc'));var crypto=require(_0xc172('0xd'));var jsforce=require(_0xc172('0xe'));var deskjs=require(_0xc172('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc172('0x10'));var Papa=require(_0xc172('0x11'));var Redis=require(_0xc172('0x12'));var authService=require(_0xc172('0x13'));var qs=require(_0xc172('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc172('0x15'));var logger=require(_0xc172('0x16'))(_0xc172('0x17'));var utils=require(_0xc172('0x18'));var config=require(_0xc172('0x19'));var db=require(_0xc172('0x1a'))['db'];function respondWithStatusCode(_0x4001dd,_0x551744){_0x551744=_0x551744||0xcc;return function(_0x2b0e3c){if(_0x2b0e3c){return _0x4001dd[_0xc172('0x1b')](_0x551744);}return _0x4001dd['status'](_0x551744)[_0xc172('0x1c')]();};}function respondWithResult(_0x4cbf1f,_0x3d8e90){_0x3d8e90=_0x3d8e90||0xc8;return function(_0x4da52f){if(_0x4da52f){return _0x4cbf1f[_0xc172('0x1d')](_0x3d8e90)[_0xc172('0x1e')](_0x4da52f);}};}function respondWithFilteredResult(_0x4d429e,_0x345240){return function(_0x40a9d6){if(_0x40a9d6){var _0x325c0c=_0x40a9d6[_0xc172('0x1f')],_0x1f911a=_0x345240['offset'],_0x4e8504=_0x345240[_0xc172('0x20')]+_0x345240[_0xc172('0x21')],_0x175fc8;if(_0x4e8504>=_0x325c0c){_0x4e8504=_0x325c0c;_0x175fc8=0xc8;}else{_0x175fc8=0xce;}_0x4d429e[_0xc172('0x1d')](_0x175fc8);return _0x4d429e[_0xc172('0x22')](_0xc172('0x23'),_0x1f911a+'-'+_0x4e8504+'/'+_0x325c0c)[_0xc172('0x1e')](_0x40a9d6);}return null;};}function patchUpdates(_0x530437){return function(_0x5e8144){try{jsonpatch[_0xc172('0x24')](_0x5e8144,_0x530437,!![]);}catch(_0x41c2ad){return BPromise['reject'](_0x41c2ad);}return _0x5e8144[_0xc172('0x25')]();};}function saveUpdates(_0x913e30,_0x26d4f2){return function(_0x66326b){if(_0x66326b){return _0x66326b[_0xc172('0x26')](_0x913e30)['then'](function(_0x3b5ab0){return _0x3b5ab0;});}return null;};}function removeEntity(_0x339bbb,_0x470368){return function(_0xfe47f){if(_0xfe47f){return _0xfe47f[_0xc172('0x27')]()[_0xc172('0x28')](function(){var _0x1fc96f=_0xfe47f[_0xc172('0x29')]({'plain':!![]});var _0x23f68e=_0xc172('0x2a');return db[_0xc172('0x2b')]['destroy']({'where':{'type':_0x23f68e,'resourceId':_0x1fc96f['id']}})[_0xc172('0x28')](function(){return _0xfe47f;});})[_0xc172('0x28')](function(){_0x339bbb[_0xc172('0x1d')](0xcc)[_0xc172('0x1c')]();});}};}function handleEntityNotFound(_0x52e563,_0x30a41c){return function(_0x4b5073){if(!_0x4b5073){_0x52e563[_0xc172('0x1b')](0x194);}return _0x4b5073;};}function handleError(_0x56cfa5,_0x41d29b){_0x41d29b=_0x41d29b||0x1f4;return function(_0x28e0f3){logger[_0xc172('0x2c')](_0x28e0f3[_0xc172('0x2d')]);if(_0x28e0f3['name']){delete _0x28e0f3[_0xc172('0x2e')];}_0x56cfa5[_0xc172('0x1d')](_0x41d29b)[_0xc172('0x2f')](_0x28e0f3);};}exports[_0xc172('0x30')]=function(_0x44289c,_0x6d7641){var _0x4b7cab={},_0x1e937f={},_0x2e0f18={'count':0x0,'rows':[]};var _0x45a2a3=_[_0xc172('0x31')](db['Campaign'][_0xc172('0x32')],function(_0x4c6721){return{'name':_0x4c6721[_0xc172('0x33')],'type':_0x4c6721[_0xc172('0x34')][_0xc172('0x35')]};});_0x1e937f['model']=_[_0xc172('0x31')](_0x45a2a3,'name');_0x1e937f['query']=_['keys'](_0x44289c[_0xc172('0x36')]);_0x1e937f[_0xc172('0x37')]=_['intersection'](_0x1e937f['model'],_0x1e937f[_0xc172('0x36')]);_0x4b7cab[_0xc172('0x38')]=_['intersection'](_0x1e937f[_0xc172('0x39')],qs[_0xc172('0x3a')](_0x44289c['query'][_0xc172('0x3a')]));_0x4b7cab['attributes']=_0x4b7cab[_0xc172('0x38')][_0xc172('0x3b')]?_0x4b7cab[_0xc172('0x38')]:_0x1e937f[_0xc172('0x39')];if(!_0x44289c[_0xc172('0x36')]['hasOwnProperty'](_0xc172('0x3c'))){_0x4b7cab[_0xc172('0x21')]=qs[_0xc172('0x21')](_0x44289c[_0xc172('0x36')][_0xc172('0x21')]);_0x4b7cab[_0xc172('0x20')]=qs[_0xc172('0x20')](_0x44289c[_0xc172('0x36')][_0xc172('0x20')]);}_0x4b7cab['order']=qs[_0xc172('0x3d')](_0x44289c[_0xc172('0x36')][_0xc172('0x3d')]);_0x4b7cab[_0xc172('0x3e')]=qs[_0xc172('0x37')](_[_0xc172('0x3f')](_0x44289c[_0xc172('0x36')],_0x1e937f[_0xc172('0x37')]),_0x45a2a3);if(_0x44289c['query'][_0xc172('0x40')]){_0x4b7cab[_0xc172('0x3e')]=_[_0xc172('0x41')](_0x4b7cab['where'],{'$or':_[_0xc172('0x31')](_0x45a2a3,function(_0x2b423f){if(_0x2b423f['type']!==_0xc172('0x42')){var _0x4c4719={};_0x4c4719[_0x2b423f[_0xc172('0x2e')]]={'$like':'%'+_0x44289c['query'][_0xc172('0x40')]+'%'};return _0x4c4719;}})});}_0x4b7cab=_[_0xc172('0x41')]({},_0x4b7cab,_0x44289c[_0xc172('0x43')]);var _0x4a8705={'where':_0x4b7cab[_0xc172('0x3e')]};return db[_0xc172('0x44')]['count'](_0x4a8705)[_0xc172('0x28')](function(_0x5d4769){_0x2e0f18[_0xc172('0x1f')]=_0x5d4769;if(_0x44289c[_0xc172('0x36')][_0xc172('0x45')]){_0x4b7cab[_0xc172('0x46')]=[{'all':!![]}];}return db[_0xc172('0x44')][_0xc172('0x47')](_0x4b7cab);})[_0xc172('0x28')](function(_0x3fe3ea){_0x2e0f18[_0xc172('0x48')]=_0x3fe3ea;return _0x2e0f18;})['then'](respondWithFilteredResult(_0x6d7641,_0x4b7cab))[_0xc172('0x49')](handleError(_0x6d7641,null));};exports[_0xc172('0x4a')]=function(_0x155665,_0x1ee6de){var _0x41e902={'raw':![],'where':{'id':_0x155665[_0xc172('0x4b')]['id']}},_0xc68a15={};_0xc68a15['model']=_[_0xc172('0x4c')](db['Campaign'][_0xc172('0x32')]);_0xc68a15[_0xc172('0x36')]=_['keys'](_0x155665[_0xc172('0x36')]);_0xc68a15[_0xc172('0x37')]=_[_0xc172('0x4d')](_0xc68a15[_0xc172('0x39')],_0xc68a15[_0xc172('0x36')]);_0x41e902[_0xc172('0x38')]=_[_0xc172('0x4d')](_0xc68a15[_0xc172('0x39')],qs[_0xc172('0x3a')](_0x155665[_0xc172('0x36')][_0xc172('0x3a')]));_0x41e902[_0xc172('0x38')]=_0x41e902['attributes']['length']?_0x41e902[_0xc172('0x38')]:_0xc68a15[_0xc172('0x39')];if(_0x155665['query']['includeAll']){_0x41e902['include']=[{'all':!![]}];}_0x41e902=_[_0xc172('0x41')]({},_0x41e902,_0x155665[_0xc172('0x43')]);return db['Campaign'][_0xc172('0x4e')](_0x41e902)[_0xc172('0x28')](handleEntityNotFound(_0x1ee6de,null))['then'](respondWithResult(_0x1ee6de,null))['catch'](handleError(_0x1ee6de,null));};exports[_0xc172('0x4f')]=function(_0xa6bb42,_0x143b9a){return db[_0xc172('0x44')][_0xc172('0x4f')](_0xa6bb42[_0xc172('0x50')],{})['then'](function(_0x340bfd){var _0x5c1971=_0xa6bb42[_0xc172('0x51')][_0xc172('0x29')]({'plain':!![]});if(!_0x5c1971)throw new Error(_0xc172('0x52'));if(_0x5c1971[_0xc172('0x53')]===_0xc172('0x51')){var _0x32e003=_0x340bfd[_0xc172('0x29')]({'plain':!![]});var _0x2c4f62=_0xc172('0x2a');return db[_0xc172('0x54')][_0xc172('0x4e')]({'where':{'name':_0x2c4f62,'userProfileId':_0x5c1971['userProfileId']},'raw':!![]})[_0xc172('0x28')](function(_0x38588a){if(_0x38588a&&_0x38588a[_0xc172('0x55')]===0x0){return db['UserProfileResource'][_0xc172('0x4f')]({'name':_0x32e003['name'],'resourceId':_0x32e003['id'],'type':_0x38588a['name'],'sectionId':_0x38588a['id']},{})['then'](function(){return _0x340bfd;});}else{return _0x340bfd;}})['catch'](function(_0x5ec979){logger['error'](_0xc172('0x56'),_0x5ec979);throw _0x5ec979;});}return _0x340bfd;})[_0xc172('0x28')](respondWithResult(_0x143b9a,0xc9))[_0xc172('0x49')](handleError(_0x143b9a,null));};exports[_0xc172('0x57')]=function(_0x21d9bf,_0x17ed64){var _0x4a8e36={'where':{'id':_0x21d9bf[_0xc172('0x4b')]['id']}},_0x2bef0c={};_0x2bef0c[_0xc172('0x39')]=_[_0xc172('0x4c')](db[_0xc172('0x44')][_0xc172('0x32')]);_0x4a8e36[_0xc172('0x38')]=_[_0xc172('0x4d')](_0x2bef0c[_0xc172('0x39')],qs[_0xc172('0x3a')](_0x21d9bf['query'][_0xc172('0x3a')]));_0x4a8e36[_0xc172('0x38')]=_0x4a8e36[_0xc172('0x38')][_0xc172('0x3b')]?_0x4a8e36[_0xc172('0x38')]:_0x2bef0c[_0xc172('0x39')];if(_0x21d9bf[_0xc172('0x36')][_0xc172('0x45')]){_0x4a8e36['include']=[{'all':!![]}];}_0x4a8e36=_[_0xc172('0x41')]({},_0x4a8e36,_0x21d9bf[_0xc172('0x43')]);return db[_0xc172('0x44')][_0xc172('0x4e')](_0x4a8e36)[_0xc172('0x28')](handleEntityNotFound(_0x17ed64,null))[_0xc172('0x28')](function(_0x59e494){if(_0x59e494){var _0x464a8d=_0x59e494['get']({'plain':!![]});_0x464a8d=qs[_0xc172('0x58')](_0x464a8d,['id',_0xc172('0x59'),_0xc172('0x5a')]);_0x21d9bf[_0xc172('0x50')]=_[_0xc172('0x58')](_0x21d9bf[_0xc172('0x50')],['id',_0xc172('0x59'),_0xc172('0x5a')]);return db[_0xc172('0x44')]['create'](_[_0xc172('0x41')](_0x464a8d,_0x21d9bf[_0xc172('0x50')]),{'include':_0x21d9bf[_0xc172('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x55590b){var _0x1b79bb=_0x21d9bf[_0xc172('0x51')][_0xc172('0x29')]({'plain':!![]});if(!_0x1b79bb)throw new Error(_0xc172('0x52'));if(_0x1b79bb['role']===_0xc172('0x51')){var _0x83f282=_0x55590b[_0xc172('0x29')]({'plain':!![]});var _0x1f193c=_0xc172('0x2a');return db[_0xc172('0x54')]['find']({'where':{'name':_0x1f193c,'userProfileId':_0x1b79bb[_0xc172('0x5b')]},'raw':!![]})[_0xc172('0x28')](function(_0x3b90df){if(_0x3b90df&&_0x3b90df['autoAssociation']===0x0){return db[_0xc172('0x2b')][_0xc172('0x4f')]({'name':_0x83f282[_0xc172('0x2e')],'resourceId':_0x83f282['id'],'type':_0x3b90df[_0xc172('0x2e')],'sectionId':_0x3b90df['id']},{})[_0xc172('0x28')](function(){return _0x55590b;});}else{return _0x55590b;}})['catch'](function(_0x34a117){logger[_0xc172('0x2c')](_0xc172('0x56'),_0x34a117);throw _0x34a117;});}return _0x55590b;});}})[_0xc172('0x28')](respondWithResult(_0x17ed64,0xc9))['catch'](handleError(_0x17ed64,null));};exports['update']=function(_0x1aedda,_0x5d2acd){if(_0x1aedda[_0xc172('0x50')]['id']){delete _0x1aedda[_0xc172('0x50')]['id'];}return db[_0xc172('0x44')][_0xc172('0x4e')]({'where':{'id':_0x1aedda[_0xc172('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5d2acd,null))[_0xc172('0x28')](saveUpdates(_0x1aedda[_0xc172('0x50')],null))[_0xc172('0x28')](respondWithResult(_0x5d2acd,null))[_0xc172('0x49')](handleError(_0x5d2acd,null));};exports[_0xc172('0x27')]=function(_0x41f5f7,_0xe46f51){return db[_0xc172('0x44')][_0xc172('0x4e')]({'where':{'id':_0x41f5f7[_0xc172('0x4b')]['id']}})[_0xc172('0x28')](handleEntityNotFound(_0xe46f51,null))['then'](removeEntity(_0xe46f51,null))[_0xc172('0x49')](handleError(_0xe46f51,null));};exports['getHoppers']=function(_0x34c20c,_0x244f8c,_0x29502b){var _0x47b624={'raw':!![],'where':{}};var _0x28a21b={};var _0x55b602={'count':0x0,'rows':[]};return db[_0xc172('0x44')][_0xc172('0x5c')]({'where':{'id':_0x34c20c[_0xc172('0x4b')]['id']}})[_0xc172('0x28')](handleEntityNotFound(_0x244f8c,null))[_0xc172('0x28')](function(_0x87f32c){if(_0x87f32c){_0x28a21b[_0xc172('0x39')]=_[_0xc172('0x4c')](db[_0xc172('0x5d')][_0xc172('0x32')]);_0x28a21b[_0xc172('0x36')]=_[_0xc172('0x4c')](_0x34c20c[_0xc172('0x36')]);_0x28a21b[_0xc172('0x37')]=_[_0xc172('0x4d')](_0x28a21b['model'],_0x28a21b[_0xc172('0x36')]);_0x47b624[_0xc172('0x38')]=_[_0xc172('0x4d')](_0x28a21b[_0xc172('0x39')],qs[_0xc172('0x3a')](_0x34c20c[_0xc172('0x36')][_0xc172('0x3a')]));_0x47b624[_0xc172('0x38')]=_0x47b624[_0xc172('0x38')]['length']?_0x47b624[_0xc172('0x38')]:_0x28a21b['model'];if(!_0x34c20c[_0xc172('0x36')][_0xc172('0x5e')](_0xc172('0x3c'))){_0x47b624[_0xc172('0x21')]=qs[_0xc172('0x21')](_0x34c20c[_0xc172('0x36')]['limit']);_0x47b624[_0xc172('0x20')]=qs[_0xc172('0x20')](_0x34c20c[_0xc172('0x36')][_0xc172('0x20')]);}_0x47b624[_0xc172('0x5f')]=qs['sort'](_0x34c20c['query']['sort']);_0x47b624[_0xc172('0x3e')]=qs[_0xc172('0x37')](_[_0xc172('0x3f')](_0x34c20c[_0xc172('0x36')],_0x28a21b[_0xc172('0x37')]));_0x47b624[_0xc172('0x3e')][_0xc172('0x60')]=_0x87f32c['id'];if(_0x34c20c['query'][_0xc172('0x40')]){_0x47b624['where']=_[_0xc172('0x41')](_0x47b624[_0xc172('0x3e')],{'$or':_[_0xc172('0x31')](_0x47b624[_0xc172('0x38')],function(_0x3284df){var _0x120633={};_0x120633[_0x3284df]={'$like':'%'+_0x34c20c[_0xc172('0x36')][_0xc172('0x40')]+'%'};return _0x120633;})});}_0x47b624=_[_0xc172('0x41')]({},_0x47b624,_0x34c20c[_0xc172('0x43')]);return db[_0xc172('0x5d')][_0xc172('0x1f')]({'where':_0x47b624[_0xc172('0x3e')]})['then'](function(_0x50c4e7){_0x55b602['count']=_0x50c4e7;if(_0x34c20c[_0xc172('0x36')][_0xc172('0x45')]){_0x47b624[_0xc172('0x46')]=[{'all':!![]}];}return db[_0xc172('0x5d')][_0xc172('0x47')](_0x47b624);})[_0xc172('0x28')](function(_0x103759){_0x55b602[_0xc172('0x48')]=_0x103759;return _0x55b602;});}})['then'](respondWithFilteredResult(_0x244f8c,_0x47b624))[_0xc172('0x49')](handleError(_0x244f8c,null));};exports[_0xc172('0x61')]=function(_0x20fd1a,_0x1eeb30,_0x154085){var _0x140233={'raw':!![],'where':{}};var _0x1ddfb2={};var _0x40f846={'count':0x0,'rows':[]};return db['Campaign'][_0xc172('0x5c')]({'where':{'id':_0x20fd1a[_0xc172('0x4b')]['id']}})[_0xc172('0x28')](handleEntityNotFound(_0x1eeb30,null))[_0xc172('0x28')](function(_0x2d4c4b){if(_0x2d4c4b){_0x1ddfb2['model']=_[_0xc172('0x4c')](db['CmHopperHistory'][_0xc172('0x32')]);_0x1ddfb2[_0xc172('0x36')]=_[_0xc172('0x4c')](_0x20fd1a[_0xc172('0x36')]);_0x1ddfb2[_0xc172('0x37')]=_[_0xc172('0x4d')](_0x1ddfb2[_0xc172('0x39')],_0x1ddfb2[_0xc172('0x36')]);_0x140233[_0xc172('0x38')]=_[_0xc172('0x4d')](_0x1ddfb2[_0xc172('0x39')],qs[_0xc172('0x3a')](_0x20fd1a[_0xc172('0x36')][_0xc172('0x3a')]));_0x140233[_0xc172('0x38')]=_0x140233['attributes']['length']?_0x140233['attributes']:_0x1ddfb2['model'];if(!_0x20fd1a['query'][_0xc172('0x5e')](_0xc172('0x3c'))){_0x140233[_0xc172('0x21')]=qs['limit'](_0x20fd1a[_0xc172('0x36')]['limit']);_0x140233[_0xc172('0x20')]=qs[_0xc172('0x20')](_0x20fd1a['query']['offset']);}_0x140233[_0xc172('0x5f')]=qs[_0xc172('0x3d')](_0x20fd1a[_0xc172('0x36')][_0xc172('0x3d')]);_0x140233[_0xc172('0x3e')]=qs['filters'](_['pick'](_0x20fd1a[_0xc172('0x36')],_0x1ddfb2[_0xc172('0x37')]));_0x140233[_0xc172('0x3e')][_0xc172('0x60')]=_0x2d4c4b['id'];if(_0x20fd1a[_0xc172('0x36')][_0xc172('0x40')]){_0x140233[_0xc172('0x3e')]=_['merge'](_0x140233[_0xc172('0x3e')],{'$or':_[_0xc172('0x31')](_0x140233[_0xc172('0x38')],function(_0x17d2a6){var _0x4c28c4={};_0x4c28c4[_0x17d2a6]={'$like':'%'+_0x20fd1a['query'][_0xc172('0x40')]+'%'};return _0x4c28c4;})});}_0x140233=_[_0xc172('0x41')]({},_0x140233,_0x20fd1a[_0xc172('0x43')]);return db[_0xc172('0x62')][_0xc172('0x1f')]({'where':_0x140233[_0xc172('0x3e')]})['then'](function(_0x5f1924){_0x40f846[_0xc172('0x1f')]=_0x5f1924;if(_0x20fd1a['query'][_0xc172('0x45')]){_0x140233['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xc172('0x47')](_0x140233);})['then'](function(_0x2e14d2){_0x40f846[_0xc172('0x48')]=_0x2e14d2;return _0x40f846;});}})[_0xc172('0x28')](respondWithFilteredResult(_0x1eeb30,_0x140233))[_0xc172('0x49')](handleError(_0x1eeb30,null));};exports['getHopperFinals']=function(_0x573686,_0x3e11f8,_0x1f213d){var _0x42b33f={'raw':!![],'where':{}};var _0x4e7874={};var _0x5e0d07={'count':0x0,'rows':[]};return db[_0xc172('0x44')][_0xc172('0x5c')]({'where':{'id':_0x573686[_0xc172('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e11f8,null))[_0xc172('0x28')](function(_0x4b4164){if(_0x4b4164){_0x4e7874[_0xc172('0x39')]=_[_0xc172('0x4c')](db['CmHopperFinal'][_0xc172('0x32')]);_0x4e7874[_0xc172('0x36')]=_[_0xc172('0x4c')](_0x573686['query']);_0x4e7874[_0xc172('0x37')]=_[_0xc172('0x4d')](_0x4e7874['model'],_0x4e7874[_0xc172('0x36')]);_0x42b33f['attributes']=_[_0xc172('0x4d')](_0x4e7874[_0xc172('0x39')],qs[_0xc172('0x3a')](_0x573686['query'][_0xc172('0x3a')]));_0x42b33f[_0xc172('0x38')]=_0x42b33f['attributes'][_0xc172('0x3b')]?_0x42b33f[_0xc172('0x38')]:_0x4e7874[_0xc172('0x39')];if(!_0x573686[_0xc172('0x36')][_0xc172('0x5e')](_0xc172('0x3c'))){_0x42b33f[_0xc172('0x21')]=qs[_0xc172('0x21')](_0x573686[_0xc172('0x36')][_0xc172('0x21')]);_0x42b33f['offset']=qs['offset'](_0x573686['query'][_0xc172('0x20')]);}_0x42b33f[_0xc172('0x5f')]=qs[_0xc172('0x3d')](_0x573686[_0xc172('0x36')]['sort']);_0x42b33f[_0xc172('0x3e')]=qs[_0xc172('0x37')](_['pick'](_0x573686['query'],_0x4e7874['filters']));_0x42b33f[_0xc172('0x3e')][_0xc172('0x60')]=_0x4b4164['id'];if(_0x573686[_0xc172('0x36')][_0xc172('0x40')]){_0x42b33f[_0xc172('0x3e')]=_[_0xc172('0x41')](_0x42b33f['where'],{'$or':_['map'](_0x42b33f[_0xc172('0x38')],function(_0x3791f9){var _0x27c6d4={};_0x27c6d4[_0x3791f9]={'$like':'%'+_0x573686[_0xc172('0x36')][_0xc172('0x40')]+'%'};return _0x27c6d4;})});}_0x42b33f=_[_0xc172('0x41')]({},_0x42b33f,_0x573686[_0xc172('0x43')]);return db[_0xc172('0x63')][_0xc172('0x1f')]({'where':_0x42b33f[_0xc172('0x3e')]})[_0xc172('0x28')](function(_0x4e1303){_0x5e0d07[_0xc172('0x1f')]=_0x4e1303;if(_0x573686['query'][_0xc172('0x45')]){_0x42b33f['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xc172('0x47')](_0x42b33f);})['then'](function(_0x1bb698){_0x5e0d07[_0xc172('0x48')]=_0x1bb698;return _0x5e0d07;});}})[_0xc172('0x28')](respondWithFilteredResult(_0x3e11f8,_0x42b33f))[_0xc172('0x49')](handleError(_0x3e11f8,null));};exports[_0xc172('0x64')]=function(_0x15031b,_0x40a29a,_0x4338bd){var _0xcbc451={'raw':!![],'where':{}};var _0x2f8a1a={};var _0x41d686={'count':0x0,'rows':[]};return db[_0xc172('0x44')]['findOne']({'where':{'id':_0x15031b[_0xc172('0x4b')]['id']}})[_0xc172('0x28')](handleEntityNotFound(_0x40a29a,null))['then'](function(_0x4a86e3){if(_0x4a86e3){_0x2f8a1a['model']=_[_0xc172('0x4c')](db[_0xc172('0x65')][_0xc172('0x32')]);_0x2f8a1a[_0xc172('0x36')]=_[_0xc172('0x4c')](_0x15031b[_0xc172('0x36')]);_0x2f8a1a[_0xc172('0x37')]=_[_0xc172('0x4d')](_0x2f8a1a[_0xc172('0x39')],_0x2f8a1a[_0xc172('0x36')]);_0xcbc451[_0xc172('0x38')]=_[_0xc172('0x4d')](_0x2f8a1a[_0xc172('0x39')],qs[_0xc172('0x3a')](_0x15031b['query'][_0xc172('0x3a')]));_0xcbc451[_0xc172('0x38')]=_0xcbc451['attributes'][_0xc172('0x3b')]?_0xcbc451[_0xc172('0x38')]:_0x2f8a1a[_0xc172('0x39')];if(!_0x15031b[_0xc172('0x36')][_0xc172('0x5e')](_0xc172('0x3c'))){_0xcbc451['limit']=qs[_0xc172('0x21')](_0x15031b['query']['limit']);_0xcbc451[_0xc172('0x20')]=qs['offset'](_0x15031b[_0xc172('0x36')]['offset']);}_0xcbc451[_0xc172('0x5f')]=qs['sort'](_0x15031b[_0xc172('0x36')][_0xc172('0x3d')]);_0xcbc451[_0xc172('0x3e')]=qs['filters'](_['pick'](_0x15031b[_0xc172('0x36')],_0x2f8a1a[_0xc172('0x37')]));_0xcbc451[_0xc172('0x3e')][_0xc172('0x60')]=_0x4a86e3['id'];if(_0x15031b[_0xc172('0x36')]['filter']){_0xcbc451[_0xc172('0x3e')]=_[_0xc172('0x41')](_0xcbc451['where'],{'$or':_[_0xc172('0x31')](_0xcbc451[_0xc172('0x38')],function(_0x4d4c08){var _0x2e8a1e={};_0x2e8a1e[_0x4d4c08]={'$like':'%'+_0x15031b[_0xc172('0x36')][_0xc172('0x40')]+'%'};return _0x2e8a1e;})});}_0xcbc451=_[_0xc172('0x41')]({},_0xcbc451,_0x15031b[_0xc172('0x43')]);return db['CmHopperBlack'][_0xc172('0x1f')]({'where':_0xcbc451[_0xc172('0x3e')]})[_0xc172('0x28')](function(_0x3e345a){_0x41d686[_0xc172('0x1f')]=_0x3e345a;if(_0x15031b[_0xc172('0x36')][_0xc172('0x45')]){_0xcbc451[_0xc172('0x46')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0xcbc451);})[_0xc172('0x28')](function(_0x2b2d5b){_0x41d686['rows']=_0x2b2d5b;return _0x41d686;});}})[_0xc172('0x28')](respondWithFilteredResult(_0x40a29a,_0xcbc451))[_0xc172('0x49')](handleError(_0x40a29a,null));};exports[_0xc172('0x66')]=function(_0x1d3246,_0x2c8f5c,_0x1ebaf9){var _0x9df811={};var _0x3b5d20={};var _0x31930c;var _0x3310e8;return db['Campaign'][_0xc172('0x5c')]({'where':{'id':_0x1d3246[_0xc172('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c8f5c,null))[_0xc172('0x28')](function(_0x1c782b){if(_0x1c782b){_0x31930c=_0x1c782b;_0x3b5d20[_0xc172('0x39')]=_[_0xc172('0x4c')](db['CmList']['rawAttributes']);_0x3b5d20[_0xc172('0x36')]=_[_0xc172('0x4c')](_0x1d3246['query']);_0x3b5d20['filters']=_[_0xc172('0x4d')](_0x3b5d20[_0xc172('0x39')],_0x3b5d20[_0xc172('0x36')]);_0x9df811[_0xc172('0x38')]=_[_0xc172('0x4d')](_0x3b5d20[_0xc172('0x39')],qs[_0xc172('0x3a')](_0x1d3246[_0xc172('0x36')][_0xc172('0x3a')]));_0x9df811[_0xc172('0x38')]=_0x9df811[_0xc172('0x38')][_0xc172('0x3b')]?_0x9df811[_0xc172('0x38')]:_0x3b5d20[_0xc172('0x39')];_0x9df811['order']=qs['sort'](_0x1d3246[_0xc172('0x36')][_0xc172('0x3d')]);_0x9df811[_0xc172('0x3e')]=qs[_0xc172('0x37')](_[_0xc172('0x3f')](_0x1d3246['query'],_0x3b5d20[_0xc172('0x37')]));if(_0x1d3246[_0xc172('0x36')][_0xc172('0x40')]){_0x9df811[_0xc172('0x3e')]=_[_0xc172('0x41')](_0x9df811['where'],{'$or':_[_0xc172('0x31')](_0x9df811[_0xc172('0x38')],function(_0x329142){var _0xf45293={};_0xf45293[_0x329142]={'$like':'%'+_0x1d3246[_0xc172('0x36')]['filter']+'%'};return _0xf45293;})});}_0x9df811=_[_0xc172('0x41')]({},_0x9df811,_0x1d3246[_0xc172('0x43')]);return _0x31930c[_0xc172('0x66')](_0x9df811);}})[_0xc172('0x28')](function(_0x4b3e2e){if(_0x4b3e2e){_0x3310e8=_0x4b3e2e[_0xc172('0x3b')];if(!_0x1d3246['query'][_0xc172('0x5e')]('nolimit')){_0x9df811['limit']=qs[_0xc172('0x21')](_0x1d3246[_0xc172('0x36')]['limit']);_0x9df811['offset']=qs[_0xc172('0x20')](_0x1d3246[_0xc172('0x36')][_0xc172('0x20')]);}return _0x31930c[_0xc172('0x66')](_0x9df811);}})[_0xc172('0x28')](function(_0x5f5629){if(_0x5f5629){return _0x5f5629?{'count':_0x3310e8,'rows':_0x5f5629}:null;}})[_0xc172('0x28')](respondWithResult(_0x2c8f5c,null))[_0xc172('0x49')](handleError(_0x2c8f5c,null));};exports[_0xc172('0x67')]=function(_0x531aa7,_0x1984eb,_0x19546f){var _0x4cd74f,_0x30090f;return db[_0xc172('0x44')][_0xc172('0x4e')]({'where':{'id':_0x531aa7[_0xc172('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1984eb,null))['then'](function(_0x23c638){if(_0x23c638){_0x30090f=_0x23c638;return _0x23c638[_0xc172('0x67')](_0x531aa7[_0xc172('0x50')][_0xc172('0x68')],_[_0xc172('0x58')](_0x531aa7[_0xc172('0x50')],[_0xc172('0x68'),'id'])||{});}return null;})[_0xc172('0x69')](function(_0xbd8706){var _0x434cd9;_0x4cd74f=_0xbd8706||[];var _0x171a1f=[];if(_0xbd8706){for(var _0x5ea4a0=0x0;_0x5ea4a0<_0xbd8706[_0xc172('0x3b')];_0x5ea4a0+=0x1){var _0x22e5dc=_0xbd8706[_0x5ea4a0][_0xc172('0x29')]({'plain':!![]});_0x30090f[_0xc172('0x6a')]=_0x531aa7[_0xc172('0x50')]['dialCheckDuplicateType']?_0x531aa7[_0xc172('0x50')][_0xc172('0x6a')]:_0x30090f[_0xc172('0x6a')];switch(_0x30090f[_0xc172('0x6a')]){case _0xc172('0x6b'):_0x434cd9=squel[_0xc172('0x6c')]()[_0xc172('0x6d')]('cm_hopper')['fromQuery']([_0xc172('0x6e'),'scheduledAt','ContactId',_0xc172('0x6f'),_0xc172('0x60'),_0xc172('0x59'),'updatedAt'],squel[_0xc172('0x70')]()[_0xc172('0x71')](_0xc172('0x6e'),'phone')[_0xc172('0x71')](_0xc172('0x72'),_0xc172('0x73'))['field']('id',_0xc172('0x74'))[_0xc172('0x71')](_0x22e5dc[_0xc172('0x75')]['toString'](),_0xc172('0x6f'))['field'](_0x531aa7[_0xc172('0x4b')]['id'][_0xc172('0x76')](),_0xc172('0x60'))[_0xc172('0x71')](_0xc172('0x72'),_0xc172('0x59'))['field']('NOW()',_0xc172('0x5a'))['from'](_0xc172('0x77'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x22e5dc[_0xc172('0x75')][_0xc172('0x76')]())[_0xc172('0x3e')](_0xc172('0x78'))[_0xc172('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc172('0x70')]()[_0xc172('0x71')](_0xc172('0x79'))[_0xc172('0x7a')](_0xc172('0x7b'))[_0xc172('0x3e')](_0xc172('0x7c'),_0x531aa7[_0xc172('0x4b')]['id'][_0xc172('0x76')]()))[_0xc172('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc172('0x70')]()[_0xc172('0x71')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xc172('0x3e')](_0xc172('0x7c'),_0x531aa7[_0xc172('0x4b')]['id'][_0xc172('0x76')]())))[_0xc172('0x76')]();break;case _0xc172('0x7d'):_0x434cd9=squel[_0xc172('0x6c')]()[_0xc172('0x6d')](_0xc172('0x7e'))[_0xc172('0x7f')](['phone',_0xc172('0x73'),'ContactId',_0xc172('0x6f'),_0xc172('0x60'),_0xc172('0x59'),_0xc172('0x5a')],squel[_0xc172('0x70')]()[_0xc172('0x71')](_0xc172('0x6e'),_0xc172('0x6e'))[_0xc172('0x71')]('NOW()',_0xc172('0x73'))[_0xc172('0x71')]('id',_0xc172('0x74'))[_0xc172('0x71')](_0x22e5dc['CmListId'][_0xc172('0x76')](),'ListId')[_0xc172('0x71')](_0x531aa7['params']['id'][_0xc172('0x76')](),_0xc172('0x60'))['field'](_0xc172('0x72'),'createdAt')[_0xc172('0x71')](_0xc172('0x72'),_0xc172('0x5a'))[_0xc172('0x7a')](_0xc172('0x77'))[_0xc172('0x3e')](_0xc172('0x80'))['where']('ListId\x20=\x20?',_0x22e5dc['CmListId'][_0xc172('0x76')]())[_0xc172('0x3e')](_0xc172('0x78'))[_0xc172('0x3e')](_0xc172('0x81'),squel[_0xc172('0x70')]()[_0xc172('0x71')](_0xc172('0x82'))[_0xc172('0x7a')](_0xc172('0x7e'))[_0xc172('0x3e')](_0xc172('0x7c'),_0x531aa7[_0xc172('0x4b')]['id']['toString']())))[_0xc172('0x76')]();break;default:_0x434cd9=squel['insert']()[_0xc172('0x6d')](_0xc172('0x7e'))['fromQuery'](['phone','scheduledAt',_0xc172('0x74'),_0xc172('0x6f'),'CampaignId','createdAt',_0xc172('0x5a')],squel[_0xc172('0x70')]()[_0xc172('0x71')](_0xc172('0x6e'),_0xc172('0x6e'))[_0xc172('0x71')]('NOW()',_0xc172('0x73'))['field']('id',_0xc172('0x74'))['field'](_0x22e5dc[_0xc172('0x75')][_0xc172('0x76')](),_0xc172('0x6f'))[_0xc172('0x71')](_0x531aa7[_0xc172('0x4b')]['id']['toString'](),_0xc172('0x60'))[_0xc172('0x71')](_0xc172('0x72'),_0xc172('0x59'))[_0xc172('0x71')](_0xc172('0x72'),_0xc172('0x5a'))['from'](_0xc172('0x77'))[_0xc172('0x3e')]('deletedAt\x20IS\x20NULL')[_0xc172('0x3e')](_0xc172('0x83'),_0x22e5dc[_0xc172('0x75')][_0xc172('0x76')]())['where'](_0xc172('0x78')))[_0xc172('0x76')]();}_0x171a1f[_0xc172('0x84')](db['sequelize'][_0xc172('0x36')](_0x434cd9));}return BPromise[_0xc172('0x85')](_0x171a1f);}})[_0xc172('0x28')](function(){return _0x4cd74f;})['then'](respondWithResult(_0x1984eb,null))[_0xc172('0x49')](handleError(_0x1984eb,null));};exports[_0xc172('0x86')]=function(_0x2da9e3,_0x1a3f7e,_0x1f687c){return db[_0xc172('0x44')][_0xc172('0x4e')]({'where':{'id':_0x2da9e3['params']['id']}})[_0xc172('0x28')](handleEntityNotFound(_0x1a3f7e,null))[_0xc172('0x28')](function(_0x2ad24b){if(_0x2ad24b){return _0x2ad24b[_0xc172('0x86')](_0x2da9e3['query'][_0xc172('0x68')]);}})[_0xc172('0x28')](function(_0xf087a){if(_0xf087a){return db[_0xc172('0x5d')]['destroy']({'where':{'ListId':_0x2da9e3[_0xc172('0x36')][_0xc172('0x68')],'CampaignId':_0x2da9e3['params']['id']}})[_0xc172('0x28')](function(){return _0xf087a;});}})[_0xc172('0x28')](respondWithStatusCode(_0x1a3f7e,null))['catch'](handleError(_0x1a3f7e,null));};exports[_0xc172('0x87')]=function(_0xe89d8a,_0x32840b,_0xda422d){var _0x4489cf={'raw':!![],'where':{}};var _0x3c80d5={};var _0x20daf6={'count':0x0,'rows':[]};return db[_0xc172('0x44')][_0xc172('0x5c')]({'where':{'id':_0xe89d8a[_0xc172('0x4b')]['id']}})[_0xc172('0x28')](handleEntityNotFound(_0x32840b,null))[_0xc172('0x28')](function(_0x3859e0){if(_0x3859e0){_0x3c80d5[_0xc172('0x39')]=_[_0xc172('0x4c')](db[_0xc172('0x88')][_0xc172('0x32')]);_0x3c80d5['query']=_[_0xc172('0x4c')](_0xe89d8a[_0xc172('0x36')]);_0x3c80d5[_0xc172('0x37')]=_['intersection'](_0x3c80d5['model'],_0x3c80d5[_0xc172('0x36')]);_0x4489cf[_0xc172('0x38')]=_['intersection'](_0x3c80d5['model'],qs[_0xc172('0x3a')](_0xe89d8a[_0xc172('0x36')][_0xc172('0x3a')]));_0x4489cf[_0xc172('0x38')]=_0x4489cf['attributes'][_0xc172('0x3b')]?_0x4489cf[_0xc172('0x38')]:_0x3c80d5[_0xc172('0x39')];if(!_0xe89d8a[_0xc172('0x36')][_0xc172('0x5e')](_0xc172('0x3c'))){_0x4489cf[_0xc172('0x21')]=qs[_0xc172('0x21')](_0xe89d8a[_0xc172('0x36')][_0xc172('0x21')]);_0x4489cf[_0xc172('0x20')]=qs[_0xc172('0x20')](_0xe89d8a[_0xc172('0x36')][_0xc172('0x20')]);}_0x4489cf[_0xc172('0x5f')]=qs[_0xc172('0x3d')](_0xe89d8a['query']['sort']);_0x4489cf[_0xc172('0x3e')]=qs[_0xc172('0x37')](_['pick'](_0xe89d8a[_0xc172('0x36')],_0x3c80d5[_0xc172('0x37')]));_0x4489cf[_0xc172('0x3e')][_0xc172('0x60')]=_0x3859e0['id'];if(_0xe89d8a[_0xc172('0x36')][_0xc172('0x40')]){_0x4489cf[_0xc172('0x3e')]=_[_0xc172('0x41')](_0x4489cf[_0xc172('0x3e')],{'$or':_[_0xc172('0x31')](_0x4489cf[_0xc172('0x38')],function(_0x142668){var _0x33118b={};_0x33118b[_0x142668]={'$like':'%'+_0xe89d8a[_0xc172('0x36')][_0xc172('0x40')]+'%'};return _0x33118b;})});}_0x4489cf=_[_0xc172('0x41')]({},_0x4489cf,_0xe89d8a[_0xc172('0x43')]);return db['CmList'][_0xc172('0x1f')]({'where':_0x4489cf[_0xc172('0x3e')]})['then'](function(_0x1cdd39){_0x20daf6['count']=_0x1cdd39;if(_0xe89d8a['query']['includeAll']){_0x4489cf[_0xc172('0x46')]=[{'all':!![]}];}return db[_0xc172('0x88')][_0xc172('0x47')](_0x4489cf);})[_0xc172('0x28')](function(_0x59eabb){_0x20daf6[_0xc172('0x48')]=_0x59eabb;return _0x20daf6;});}})[_0xc172('0x28')](respondWithFilteredResult(_0x32840b,_0x4489cf))['catch'](handleError(_0x32840b,null));};exports[_0xc172('0x89')]=function(_0x35a05f,_0x47078d,_0x3c54db){var _0x98581b,_0x396ba8;return db[_0xc172('0x44')][_0xc172('0x4e')]({'where':{'id':_0x35a05f[_0xc172('0x4b')]['id']}})[_0xc172('0x28')](handleEntityNotFound(_0x47078d,null))['then'](function(_0x84b59f){if(_0x84b59f){_0x396ba8=_0x84b59f;return _0x84b59f[_0xc172('0x89')](_0x35a05f[_0xc172('0x50')][_0xc172('0x68')],_[_0xc172('0x58')](_0x35a05f[_0xc172('0x50')],['ids','id'])||{});}return null;})[_0xc172('0x69')](function(_0x3d77e9){var _0x210b77;_0x98581b=_0x3d77e9||[];var _0x323c4f=[];if(_0x3d77e9){for(var _0x9851e5=0x0;_0x9851e5<_0x3d77e9['length'];_0x9851e5+=0x1){var _0x1df770=_0x3d77e9[_0x9851e5]['get']({'plain':!![]});_0x210b77=squel[_0xc172('0x6c')]()[_0xc172('0x6d')](_0xc172('0x8a'))['fromQuery'](['phone','ContactId',_0xc172('0x6f'),_0xc172('0x60'),_0xc172('0x59'),_0xc172('0x5a')],squel[_0xc172('0x70')]()['field']('phone','phone')[_0xc172('0x71')]('id',_0xc172('0x74'))[_0xc172('0x71')](_0x1df770[_0xc172('0x75')]['toString'](),_0xc172('0x6f'))[_0xc172('0x71')](_0x35a05f['params']['id'][_0xc172('0x76')](),'CampaignId')[_0xc172('0x71')](_0xc172('0x72'),'createdAt')['field'](_0xc172('0x72'),_0xc172('0x5a'))[_0xc172('0x7a')](_0xc172('0x77'))[_0xc172('0x3e')](_0xc172('0x80'))[_0xc172('0x3e')](_0xc172('0x83'),_0x1df770['CmListId']['toString']())['where'](_0xc172('0x78')))[_0xc172('0x76')]();_0x323c4f[_0xc172('0x84')](db['sequelize'][_0xc172('0x36')](_0x210b77));}return BPromise[_0xc172('0x85')](_0x323c4f);}})[_0xc172('0x28')](function(){return _0x98581b;})[_0xc172('0x28')](respondWithResult(_0x47078d,null))[_0xc172('0x49')](handleError(_0x47078d,null));};exports['removeBlackLists']=function(_0x2accbe,_0x6b34eb,_0x207929){return db[_0xc172('0x44')][_0xc172('0x4e')]({'where':{'id':_0x2accbe[_0xc172('0x4b')]['id']}})[_0xc172('0x28')](handleEntityNotFound(_0x6b34eb,null))['then'](function(_0x52888e){if(_0x52888e){return _0x52888e[_0xc172('0x8b')](_0x2accbe[_0xc172('0x36')][_0xc172('0x68')]);}})[_0xc172('0x28')](function(_0xbcd74f){if(_0xbcd74f){return db[_0xc172('0x65')][_0xc172('0x27')]({'where':{'ListId':_0x2accbe['query']['ids'],'CampaignId':_0x2accbe[_0xc172('0x4b')]['id']}})['then'](function(){return _0xbcd74f;});}})[_0xc172('0x28')](respondWithStatusCode(_0x6b34eb,null))[_0xc172('0x49')](handleError(_0x6b34eb,null));}; \ No newline at end of file +var _0x6cba=['cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','into','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','omit','findOne','CmHopper','hasOwnProperty','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x6cba,0x119));var _0xa6cb=function(_0xe1f293,_0x1f734d){_0xe1f293=_0xe1f293-0x0;var _0x15f92e=_0x6cba[_0xe1f293];return _0x15f92e;};'use strict';var pdf=require(_0xa6cb('0x0'));var emlformat=require(_0xa6cb('0x1'));var rimraf=require(_0xa6cb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6cb('0x3'));var rp=require(_0xa6cb('0x4'));var moment=require(_0xa6cb('0x5'));var BPromise=require(_0xa6cb('0x6'));var Mustache=require(_0xa6cb('0x7'));var util=require('util');var path=require(_0xa6cb('0x8'));var sox=require(_0xa6cb('0x9'));var csv=require(_0xa6cb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa6cb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa6cb('0xc'));var deskjs=require(_0xa6cb('0xd'));var toCsv=require(_0xa6cb('0xa'));var querystring=require(_0xa6cb('0xe'));var Papa=require('papaparse');var Redis=require(_0xa6cb('0xf'));var authService=require(_0xa6cb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa6cb('0x11'));var hardwareService=require(_0xa6cb('0x12'));var logger=require(_0xa6cb('0x13'))(_0xa6cb('0x14'));var utils=require(_0xa6cb('0x15'));var config=require('../../config/environment');var db=require(_0xa6cb('0x16'))['db'];function respondWithStatusCode(_0x546d4b,_0x8e059f){_0x8e059f=_0x8e059f||0xcc;return function(_0x542158){if(_0x542158){return _0x546d4b[_0xa6cb('0x17')](_0x8e059f);}return _0x546d4b[_0xa6cb('0x18')](_0x8e059f)[_0xa6cb('0x19')]();};}function respondWithResult(_0x5a4690,_0x4c49f2){_0x4c49f2=_0x4c49f2||0xc8;return function(_0x1285b2){if(_0x1285b2){return _0x5a4690[_0xa6cb('0x18')](_0x4c49f2)[_0xa6cb('0x1a')](_0x1285b2);}};}function respondWithFilteredResult(_0x544895,_0x1e64f3){return function(_0x264d5b){if(_0x264d5b){var _0x4bdbb0=_0x264d5b[_0xa6cb('0x1b')],_0x2598c0=_0x1e64f3[_0xa6cb('0x1c')],_0x2a7e08=_0x1e64f3[_0xa6cb('0x1c')]+_0x1e64f3[_0xa6cb('0x1d')],_0x567495;if(_0x2a7e08>=_0x4bdbb0){_0x2a7e08=_0x4bdbb0;_0x567495=0xc8;}else{_0x567495=0xce;}_0x544895[_0xa6cb('0x18')](_0x567495);return _0x544895[_0xa6cb('0x1e')](_0xa6cb('0x1f'),_0x2598c0+'-'+_0x2a7e08+'/'+_0x4bdbb0)[_0xa6cb('0x1a')](_0x264d5b);}return null;};}function patchUpdates(_0x4a8337){return function(_0x4da8d9){try{jsonpatch[_0xa6cb('0x20')](_0x4da8d9,_0x4a8337,!![]);}catch(_0x3fb09b){return BPromise[_0xa6cb('0x21')](_0x3fb09b);}return _0x4da8d9[_0xa6cb('0x22')]();};}function saveUpdates(_0x3be506,_0x174a4d){return function(_0x168ec9){if(_0x168ec9){return _0x168ec9[_0xa6cb('0x23')](_0x3be506)['then'](function(_0x3a52c3){return _0x3a52c3;});}return null;};}function removeEntity(_0x2850fd,_0x530c26){return function(_0x4b5b55){if(_0x4b5b55){return _0x4b5b55[_0xa6cb('0x24')]()[_0xa6cb('0x25')](function(){var _0x17235a=_0x4b5b55[_0xa6cb('0x26')]({'plain':!![]});var _0x21f2e8=_0xa6cb('0x27');return db[_0xa6cb('0x28')]['destroy']({'where':{'type':_0x21f2e8,'resourceId':_0x17235a['id']}})['then'](function(){return _0x4b5b55;});})['then'](function(){_0x2850fd[_0xa6cb('0x18')](0xcc)[_0xa6cb('0x19')]();});}};}function handleEntityNotFound(_0x21e0a1,_0x5e7758){return function(_0x21264b){if(!_0x21264b){_0x21e0a1['sendStatus'](0x194);}return _0x21264b;};}function handleError(_0x14bacd,_0x3fb1bd){_0x3fb1bd=_0x3fb1bd||0x1f4;return function(_0x3bcad3){logger[_0xa6cb('0x29')](_0x3bcad3[_0xa6cb('0x2a')]);if(_0x3bcad3[_0xa6cb('0x2b')]){delete _0x3bcad3[_0xa6cb('0x2b')];}_0x14bacd['status'](_0x3fb1bd)[_0xa6cb('0x2c')](_0x3bcad3);};}exports[_0xa6cb('0x2d')]=function(_0x1e8540,_0x286c51){var _0x10dd4e={},_0x44fbfe={},_0x1d1bcc={'count':0x0,'rows':[]};var _0x3738f9=_[_0xa6cb('0x2e')](db[_0xa6cb('0x2f')][_0xa6cb('0x30')],function(_0x55af24){return{'name':_0x55af24['fieldName'],'type':_0x55af24['type']['key']};});_0x44fbfe[_0xa6cb('0x31')]=_['map'](_0x3738f9,_0xa6cb('0x2b'));_0x44fbfe[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0x1e8540[_0xa6cb('0x32')]);_0x44fbfe[_0xa6cb('0x34')]=_[_0xa6cb('0x35')](_0x44fbfe[_0xa6cb('0x31')],_0x44fbfe[_0xa6cb('0x32')]);_0x10dd4e['attributes']=_[_0xa6cb('0x35')](_0x44fbfe[_0xa6cb('0x31')],qs[_0xa6cb('0x36')](_0x1e8540[_0xa6cb('0x32')]['fields']));_0x10dd4e[_0xa6cb('0x37')]=_0x10dd4e['attributes'][_0xa6cb('0x38')]?_0x10dd4e[_0xa6cb('0x37')]:_0x44fbfe['model'];if(!_0x1e8540[_0xa6cb('0x32')]['hasOwnProperty'](_0xa6cb('0x39'))){_0x10dd4e['limit']=qs[_0xa6cb('0x1d')](_0x1e8540[_0xa6cb('0x32')][_0xa6cb('0x1d')]);_0x10dd4e[_0xa6cb('0x1c')]=qs[_0xa6cb('0x1c')](_0x1e8540[_0xa6cb('0x32')][_0xa6cb('0x1c')]);}_0x10dd4e[_0xa6cb('0x3a')]=qs[_0xa6cb('0x3b')](_0x1e8540[_0xa6cb('0x32')][_0xa6cb('0x3b')]);_0x10dd4e[_0xa6cb('0x3c')]=qs[_0xa6cb('0x34')](_[_0xa6cb('0x3d')](_0x1e8540[_0xa6cb('0x32')],_0x44fbfe[_0xa6cb('0x34')]),_0x3738f9);if(_0x1e8540['query'][_0xa6cb('0x3e')]){_0x10dd4e[_0xa6cb('0x3c')]=_['merge'](_0x10dd4e['where'],{'$or':_[_0xa6cb('0x2e')](_0x3738f9,function(_0x8118e2){if(_0x8118e2['type']!=='VIRTUAL'){var _0x5dd98f={};_0x5dd98f[_0x8118e2['name']]={'$like':'%'+_0x1e8540['query']['filter']+'%'};return _0x5dd98f;}})});}_0x10dd4e=_[_0xa6cb('0x3f')]({},_0x10dd4e,_0x1e8540[_0xa6cb('0x40')]);var _0x2dca26={'where':_0x10dd4e[_0xa6cb('0x3c')]};return db['Campaign'][_0xa6cb('0x1b')](_0x2dca26)[_0xa6cb('0x25')](function(_0x1cd87e){_0x1d1bcc[_0xa6cb('0x1b')]=_0x1cd87e;if(_0x1e8540[_0xa6cb('0x32')][_0xa6cb('0x41')]){_0x10dd4e[_0xa6cb('0x42')]=[{'all':!![]}];}return db[_0xa6cb('0x2f')][_0xa6cb('0x43')](_0x10dd4e);})[_0xa6cb('0x25')](function(_0x3fc812){_0x1d1bcc[_0xa6cb('0x44')]=_0x3fc812;return _0x1d1bcc;})[_0xa6cb('0x25')](respondWithFilteredResult(_0x286c51,_0x10dd4e))['catch'](handleError(_0x286c51,null));};exports['show']=function(_0x3fd154,_0x5b11fd){var _0x30503b={'raw':![],'where':{'id':_0x3fd154[_0xa6cb('0x45')]['id']}},_0x21b5c2={};_0x21b5c2[_0xa6cb('0x31')]=_[_0xa6cb('0x33')](db[_0xa6cb('0x2f')]['rawAttributes']);_0x21b5c2[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0x3fd154['query']);_0x21b5c2[_0xa6cb('0x34')]=_[_0xa6cb('0x35')](_0x21b5c2[_0xa6cb('0x31')],_0x21b5c2[_0xa6cb('0x32')]);_0x30503b[_0xa6cb('0x37')]=_[_0xa6cb('0x35')](_0x21b5c2[_0xa6cb('0x31')],qs[_0xa6cb('0x36')](_0x3fd154['query'][_0xa6cb('0x36')]));_0x30503b['attributes']=_0x30503b[_0xa6cb('0x37')][_0xa6cb('0x38')]?_0x30503b['attributes']:_0x21b5c2[_0xa6cb('0x31')];if(_0x3fd154[_0xa6cb('0x32')]['includeAll']){_0x30503b[_0xa6cb('0x42')]=[{'all':!![]}];}_0x30503b=_[_0xa6cb('0x3f')]({},_0x30503b,_0x3fd154['options']);return db[_0xa6cb('0x2f')][_0xa6cb('0x46')](_0x30503b)[_0xa6cb('0x25')](handleEntityNotFound(_0x5b11fd,null))[_0xa6cb('0x25')](respondWithResult(_0x5b11fd,null))[_0xa6cb('0x47')](handleError(_0x5b11fd,null));};exports[_0xa6cb('0x48')]=function(_0x22c255,_0x8b34ba){return db[_0xa6cb('0x2f')][_0xa6cb('0x48')](_0x22c255['body'],{})[_0xa6cb('0x25')](function(_0x4dfa3d){var _0x264b83=_0x22c255['user'][_0xa6cb('0x26')]({'plain':!![]});if(!_0x264b83)throw new Error(_0xa6cb('0x49'));if(_0x264b83[_0xa6cb('0x4a')]===_0xa6cb('0x4b')){var _0x2956a2=_0x4dfa3d[_0xa6cb('0x26')]({'plain':!![]});var _0xe6795e='IvrCampaigns';return db[_0xa6cb('0x4c')][_0xa6cb('0x46')]({'where':{'name':_0xe6795e,'userProfileId':_0x264b83[_0xa6cb('0x4d')]},'raw':!![]})[_0xa6cb('0x25')](function(_0x54a874){if(_0x54a874&&_0x54a874[_0xa6cb('0x4e')]===0x0){return db[_0xa6cb('0x28')][_0xa6cb('0x48')]({'name':_0x2956a2['name'],'resourceId':_0x2956a2['id'],'type':_0x54a874[_0xa6cb('0x2b')],'sectionId':_0x54a874['id']},{})[_0xa6cb('0x25')](function(){return _0x4dfa3d;});}else{return _0x4dfa3d;}})[_0xa6cb('0x47')](function(_0x36806c){logger['error'](_0xa6cb('0x4f'),_0x36806c);throw _0x36806c;});}return _0x4dfa3d;})[_0xa6cb('0x25')](respondWithResult(_0x8b34ba,0xc9))[_0xa6cb('0x47')](handleError(_0x8b34ba,null));};exports['clone']=function(_0x48e423,_0x17dafa){var _0x4bacbd={'where':{'id':_0x48e423['params']['id']}},_0x141252={};_0x141252[_0xa6cb('0x31')]=_[_0xa6cb('0x33')](db[_0xa6cb('0x2f')][_0xa6cb('0x30')]);_0x4bacbd[_0xa6cb('0x37')]=_[_0xa6cb('0x35')](_0x141252[_0xa6cb('0x31')],qs['fields'](_0x48e423['query'][_0xa6cb('0x36')]));_0x4bacbd[_0xa6cb('0x37')]=_0x4bacbd[_0xa6cb('0x37')][_0xa6cb('0x38')]?_0x4bacbd[_0xa6cb('0x37')]:_0x141252['model'];if(_0x48e423[_0xa6cb('0x32')][_0xa6cb('0x41')]){_0x4bacbd['include']=[{'all':!![]}];}_0x4bacbd=_['merge']({},_0x4bacbd,_0x48e423['options']);return db['Campaign'][_0xa6cb('0x46')](_0x4bacbd)[_0xa6cb('0x25')](handleEntityNotFound(_0x17dafa,null))[_0xa6cb('0x25')](function(_0x2af5b3){if(_0x2af5b3){var _0x587766=_0x2af5b3[_0xa6cb('0x26')]({'plain':!![]});_0x587766=qs['omit'](_0x587766,['id',_0xa6cb('0x50'),_0xa6cb('0x51')]);_0x48e423[_0xa6cb('0x52')]=_[_0xa6cb('0x53')](_0x48e423[_0xa6cb('0x52')],['id',_0xa6cb('0x50'),_0xa6cb('0x51')]);return db[_0xa6cb('0x2f')][_0xa6cb('0x48')](_[_0xa6cb('0x3f')](_0x587766,_0x48e423[_0xa6cb('0x52')]),{'include':_0x48e423[_0xa6cb('0x32')][_0xa6cb('0x41')]?[{'all':!![]}]:undefined})[_0xa6cb('0x25')](function(_0x3a67fa){var _0x35d832=_0x48e423[_0xa6cb('0x4b')][_0xa6cb('0x26')]({'plain':!![]});if(!_0x35d832)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35d832[_0xa6cb('0x4a')]===_0xa6cb('0x4b')){var _0x2ec304=_0x3a67fa[_0xa6cb('0x26')]({'plain':!![]});var _0xf7ee02=_0xa6cb('0x27');return db[_0xa6cb('0x4c')][_0xa6cb('0x46')]({'where':{'name':_0xf7ee02,'userProfileId':_0x35d832[_0xa6cb('0x4d')]},'raw':!![]})[_0xa6cb('0x25')](function(_0x2a4f05){if(_0x2a4f05&&_0x2a4f05[_0xa6cb('0x4e')]===0x0){return db[_0xa6cb('0x28')][_0xa6cb('0x48')]({'name':_0x2ec304[_0xa6cb('0x2b')],'resourceId':_0x2ec304['id'],'type':_0x2a4f05[_0xa6cb('0x2b')],'sectionId':_0x2a4f05['id']},{})[_0xa6cb('0x25')](function(){return _0x3a67fa;});}else{return _0x3a67fa;}})['catch'](function(_0x5752af){logger[_0xa6cb('0x29')](_0xa6cb('0x4f'),_0x5752af);throw _0x5752af;});}return _0x3a67fa;});}})[_0xa6cb('0x25')](respondWithResult(_0x17dafa,0xc9))[_0xa6cb('0x47')](handleError(_0x17dafa,null));};exports[_0xa6cb('0x23')]=function(_0x511fbc,_0x5df34f){if(_0x511fbc['body']['id']){delete _0x511fbc[_0xa6cb('0x52')]['id'];}return db['Campaign'][_0xa6cb('0x46')]({'where':{'id':_0x511fbc[_0xa6cb('0x45')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x5df34f,null))[_0xa6cb('0x25')](saveUpdates(_0x511fbc[_0xa6cb('0x52')],null))[_0xa6cb('0x25')](respondWithResult(_0x5df34f,null))[_0xa6cb('0x47')](handleError(_0x5df34f,null));};exports['destroy']=function(_0x2bc951,_0x148c9e){return db[_0xa6cb('0x2f')][_0xa6cb('0x46')]({'where':{'id':_0x2bc951[_0xa6cb('0x45')]['id']}})['then'](handleEntityNotFound(_0x148c9e,null))[_0xa6cb('0x25')](removeEntity(_0x148c9e,null))[_0xa6cb('0x47')](handleError(_0x148c9e,null));};exports['getHoppers']=function(_0x3e128d,_0xa5feb3,_0x4c686d){var _0xb2c95c={'raw':!![],'where':{}};var _0x41af17={};var _0x2aa50f={'count':0x0,'rows':[]};return db['Campaign'][_0xa6cb('0x54')]({'where':{'id':_0x3e128d[_0xa6cb('0x45')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0xa5feb3,null))[_0xa6cb('0x25')](function(_0x38801b){if(_0x38801b){_0x41af17[_0xa6cb('0x31')]=_['keys'](db[_0xa6cb('0x55')]['rawAttributes']);_0x41af17[_0xa6cb('0x32')]=_['keys'](_0x3e128d[_0xa6cb('0x32')]);_0x41af17[_0xa6cb('0x34')]=_[_0xa6cb('0x35')](_0x41af17[_0xa6cb('0x31')],_0x41af17['query']);_0xb2c95c['attributes']=_[_0xa6cb('0x35')](_0x41af17[_0xa6cb('0x31')],qs['fields'](_0x3e128d['query'][_0xa6cb('0x36')]));_0xb2c95c[_0xa6cb('0x37')]=_0xb2c95c[_0xa6cb('0x37')][_0xa6cb('0x38')]?_0xb2c95c[_0xa6cb('0x37')]:_0x41af17['model'];if(!_0x3e128d[_0xa6cb('0x32')][_0xa6cb('0x56')](_0xa6cb('0x39'))){_0xb2c95c[_0xa6cb('0x1d')]=qs[_0xa6cb('0x1d')](_0x3e128d[_0xa6cb('0x32')][_0xa6cb('0x1d')]);_0xb2c95c[_0xa6cb('0x1c')]=qs['offset'](_0x3e128d['query'][_0xa6cb('0x1c')]);}_0xb2c95c[_0xa6cb('0x3a')]=qs[_0xa6cb('0x3b')](_0x3e128d[_0xa6cb('0x32')][_0xa6cb('0x3b')]);_0xb2c95c[_0xa6cb('0x3c')]=qs['filters'](_['pick'](_0x3e128d[_0xa6cb('0x32')],_0x41af17[_0xa6cb('0x34')]));_0xb2c95c[_0xa6cb('0x3c')][_0xa6cb('0x57')]=_0x38801b['id'];if(_0x3e128d[_0xa6cb('0x32')][_0xa6cb('0x3e')]){_0xb2c95c[_0xa6cb('0x3c')]=_['merge'](_0xb2c95c[_0xa6cb('0x3c')],{'$or':_[_0xa6cb('0x2e')](_0xb2c95c[_0xa6cb('0x37')],function(_0x6a3805){var _0x325a02={};_0x325a02[_0x6a3805]={'$like':'%'+_0x3e128d[_0xa6cb('0x32')][_0xa6cb('0x3e')]+'%'};return _0x325a02;})});}_0xb2c95c=_[_0xa6cb('0x3f')]({},_0xb2c95c,_0x3e128d[_0xa6cb('0x40')]);return db[_0xa6cb('0x55')][_0xa6cb('0x1b')]({'where':_0xb2c95c['where']})['then'](function(_0x455fdf){_0x2aa50f[_0xa6cb('0x1b')]=_0x455fdf;if(_0x3e128d[_0xa6cb('0x32')][_0xa6cb('0x41')]){_0xb2c95c[_0xa6cb('0x42')]=[{'all':!![]}];}return db[_0xa6cb('0x55')][_0xa6cb('0x43')](_0xb2c95c);})['then'](function(_0x2a3244){_0x2aa50f[_0xa6cb('0x44')]=_0x2a3244;return _0x2aa50f;});}})[_0xa6cb('0x25')](respondWithFilteredResult(_0xa5feb3,_0xb2c95c))[_0xa6cb('0x47')](handleError(_0xa5feb3,null));};exports['getHopperHistories']=function(_0xfebea2,_0x296cbd,_0x3e1949){var _0x3ab712={'raw':!![],'where':{}};var _0x436d5a={};var _0x5bf0a2={'count':0x0,'rows':[]};return db[_0xa6cb('0x2f')]['findOne']({'where':{'id':_0xfebea2['params']['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x296cbd,null))['then'](function(_0x41ba5){if(_0x41ba5){_0x436d5a['model']=_[_0xa6cb('0x33')](db[_0xa6cb('0x58')][_0xa6cb('0x30')]);_0x436d5a[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0xfebea2[_0xa6cb('0x32')]);_0x436d5a[_0xa6cb('0x34')]=_[_0xa6cb('0x35')](_0x436d5a['model'],_0x436d5a[_0xa6cb('0x32')]);_0x3ab712[_0xa6cb('0x37')]=_[_0xa6cb('0x35')](_0x436d5a['model'],qs[_0xa6cb('0x36')](_0xfebea2[_0xa6cb('0x32')][_0xa6cb('0x36')]));_0x3ab712['attributes']=_0x3ab712[_0xa6cb('0x37')][_0xa6cb('0x38')]?_0x3ab712[_0xa6cb('0x37')]:_0x436d5a[_0xa6cb('0x31')];if(!_0xfebea2[_0xa6cb('0x32')][_0xa6cb('0x56')](_0xa6cb('0x39'))){_0x3ab712['limit']=qs['limit'](_0xfebea2[_0xa6cb('0x32')][_0xa6cb('0x1d')]);_0x3ab712[_0xa6cb('0x1c')]=qs['offset'](_0xfebea2[_0xa6cb('0x32')][_0xa6cb('0x1c')]);}_0x3ab712[_0xa6cb('0x3a')]=qs['sort'](_0xfebea2[_0xa6cb('0x32')][_0xa6cb('0x3b')]);_0x3ab712['where']=qs[_0xa6cb('0x34')](_[_0xa6cb('0x3d')](_0xfebea2[_0xa6cb('0x32')],_0x436d5a[_0xa6cb('0x34')]));_0x3ab712[_0xa6cb('0x3c')][_0xa6cb('0x57')]=_0x41ba5['id'];if(_0xfebea2[_0xa6cb('0x32')][_0xa6cb('0x3e')]){_0x3ab712[_0xa6cb('0x3c')]=_[_0xa6cb('0x3f')](_0x3ab712[_0xa6cb('0x3c')],{'$or':_[_0xa6cb('0x2e')](_0x3ab712[_0xa6cb('0x37')],function(_0x31b299){var _0x5e405a={};_0x5e405a[_0x31b299]={'$like':'%'+_0xfebea2['query']['filter']+'%'};return _0x5e405a;})});}_0x3ab712=_[_0xa6cb('0x3f')]({},_0x3ab712,_0xfebea2[_0xa6cb('0x40')]);return db[_0xa6cb('0x58')][_0xa6cb('0x1b')]({'where':_0x3ab712[_0xa6cb('0x3c')]})[_0xa6cb('0x25')](function(_0x2f556f){_0x5bf0a2[_0xa6cb('0x1b')]=_0x2f556f;if(_0xfebea2['query']['includeAll']){_0x3ab712[_0xa6cb('0x42')]=[{'all':!![]}];}return db[_0xa6cb('0x58')][_0xa6cb('0x43')](_0x3ab712);})['then'](function(_0x1f61cc){_0x5bf0a2['rows']=_0x1f61cc;return _0x5bf0a2;});}})[_0xa6cb('0x25')](respondWithFilteredResult(_0x296cbd,_0x3ab712))[_0xa6cb('0x47')](handleError(_0x296cbd,null));};exports[_0xa6cb('0x59')]=function(_0x2b50b5,_0x1ae814,_0x54cdce){var _0x22de3d={'raw':!![],'where':{}};var _0x4bd4a9={};var _0x20b464={'count':0x0,'rows':[]};return db[_0xa6cb('0x2f')][_0xa6cb('0x54')]({'where':{'id':_0x2b50b5[_0xa6cb('0x45')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x1ae814,null))[_0xa6cb('0x25')](function(_0x11cfa8){if(_0x11cfa8){_0x4bd4a9[_0xa6cb('0x31')]=_[_0xa6cb('0x33')](db[_0xa6cb('0x5a')][_0xa6cb('0x30')]);_0x4bd4a9[_0xa6cb('0x32')]=_['keys'](_0x2b50b5[_0xa6cb('0x32')]);_0x4bd4a9[_0xa6cb('0x34')]=_[_0xa6cb('0x35')](_0x4bd4a9[_0xa6cb('0x31')],_0x4bd4a9[_0xa6cb('0x32')]);_0x22de3d[_0xa6cb('0x37')]=_[_0xa6cb('0x35')](_0x4bd4a9['model'],qs[_0xa6cb('0x36')](_0x2b50b5[_0xa6cb('0x32')][_0xa6cb('0x36')]));_0x22de3d[_0xa6cb('0x37')]=_0x22de3d[_0xa6cb('0x37')][_0xa6cb('0x38')]?_0x22de3d[_0xa6cb('0x37')]:_0x4bd4a9[_0xa6cb('0x31')];if(!_0x2b50b5[_0xa6cb('0x32')][_0xa6cb('0x56')](_0xa6cb('0x39'))){_0x22de3d[_0xa6cb('0x1d')]=qs[_0xa6cb('0x1d')](_0x2b50b5[_0xa6cb('0x32')][_0xa6cb('0x1d')]);_0x22de3d[_0xa6cb('0x1c')]=qs[_0xa6cb('0x1c')](_0x2b50b5[_0xa6cb('0x32')]['offset']);}_0x22de3d[_0xa6cb('0x3a')]=qs[_0xa6cb('0x3b')](_0x2b50b5['query'][_0xa6cb('0x3b')]);_0x22de3d[_0xa6cb('0x3c')]=qs[_0xa6cb('0x34')](_['pick'](_0x2b50b5[_0xa6cb('0x32')],_0x4bd4a9[_0xa6cb('0x34')]));_0x22de3d['where'][_0xa6cb('0x57')]=_0x11cfa8['id'];if(_0x2b50b5[_0xa6cb('0x32')][_0xa6cb('0x3e')]){_0x22de3d[_0xa6cb('0x3c')]=_[_0xa6cb('0x3f')](_0x22de3d[_0xa6cb('0x3c')],{'$or':_['map'](_0x22de3d[_0xa6cb('0x37')],function(_0x1d42c4){var _0x36c756={};_0x36c756[_0x1d42c4]={'$like':'%'+_0x2b50b5['query'][_0xa6cb('0x3e')]+'%'};return _0x36c756;})});}_0x22de3d=_['merge']({},_0x22de3d,_0x2b50b5[_0xa6cb('0x40')]);return db[_0xa6cb('0x5a')]['count']({'where':_0x22de3d['where']})['then'](function(_0x2cca49){_0x20b464['count']=_0x2cca49;if(_0x2b50b5['query'][_0xa6cb('0x41')]){_0x22de3d['include']=[{'all':!![]}];}return db[_0xa6cb('0x5a')][_0xa6cb('0x43')](_0x22de3d);})[_0xa6cb('0x25')](function(_0x273c64){_0x20b464[_0xa6cb('0x44')]=_0x273c64;return _0x20b464;});}})[_0xa6cb('0x25')](respondWithFilteredResult(_0x1ae814,_0x22de3d))[_0xa6cb('0x47')](handleError(_0x1ae814,null));};exports[_0xa6cb('0x5b')]=function(_0x217167,_0x3ab0f5,_0x50253c){var _0x1afde9={'raw':!![],'where':{}};var _0x3a9a3e={};var _0x424922={'count':0x0,'rows':[]};return db[_0xa6cb('0x2f')][_0xa6cb('0x54')]({'where':{'id':_0x217167[_0xa6cb('0x45')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x3ab0f5,null))[_0xa6cb('0x25')](function(_0x2cfda9){if(_0x2cfda9){_0x3a9a3e['model']=_['keys'](db[_0xa6cb('0x5c')]['rawAttributes']);_0x3a9a3e['query']=_[_0xa6cb('0x33')](_0x217167[_0xa6cb('0x32')]);_0x3a9a3e[_0xa6cb('0x34')]=_[_0xa6cb('0x35')](_0x3a9a3e[_0xa6cb('0x31')],_0x3a9a3e[_0xa6cb('0x32')]);_0x1afde9[_0xa6cb('0x37')]=_[_0xa6cb('0x35')](_0x3a9a3e[_0xa6cb('0x31')],qs[_0xa6cb('0x36')](_0x217167[_0xa6cb('0x32')][_0xa6cb('0x36')]));_0x1afde9[_0xa6cb('0x37')]=_0x1afde9[_0xa6cb('0x37')]['length']?_0x1afde9['attributes']:_0x3a9a3e[_0xa6cb('0x31')];if(!_0x217167['query'][_0xa6cb('0x56')](_0xa6cb('0x39'))){_0x1afde9[_0xa6cb('0x1d')]=qs[_0xa6cb('0x1d')](_0x217167['query'][_0xa6cb('0x1d')]);_0x1afde9[_0xa6cb('0x1c')]=qs[_0xa6cb('0x1c')](_0x217167[_0xa6cb('0x32')][_0xa6cb('0x1c')]);}_0x1afde9['order']=qs['sort'](_0x217167[_0xa6cb('0x32')][_0xa6cb('0x3b')]);_0x1afde9[_0xa6cb('0x3c')]=qs[_0xa6cb('0x34')](_[_0xa6cb('0x3d')](_0x217167[_0xa6cb('0x32')],_0x3a9a3e[_0xa6cb('0x34')]));_0x1afde9['where'][_0xa6cb('0x57')]=_0x2cfda9['id'];if(_0x217167[_0xa6cb('0x32')][_0xa6cb('0x3e')]){_0x1afde9[_0xa6cb('0x3c')]=_[_0xa6cb('0x3f')](_0x1afde9[_0xa6cb('0x3c')],{'$or':_[_0xa6cb('0x2e')](_0x1afde9['attributes'],function(_0x4a5421){var _0x30aa8e={};_0x30aa8e[_0x4a5421]={'$like':'%'+_0x217167['query']['filter']+'%'};return _0x30aa8e;})});}_0x1afde9=_[_0xa6cb('0x3f')]({},_0x1afde9,_0x217167[_0xa6cb('0x40')]);return db['CmHopperBlack'][_0xa6cb('0x1b')]({'where':_0x1afde9[_0xa6cb('0x3c')]})[_0xa6cb('0x25')](function(_0x51e49c){_0x424922[_0xa6cb('0x1b')]=_0x51e49c;if(_0x217167['query'][_0xa6cb('0x41')]){_0x1afde9[_0xa6cb('0x42')]=[{'all':!![]}];}return db[_0xa6cb('0x5c')]['findAll'](_0x1afde9);})[_0xa6cb('0x25')](function(_0x324aef){_0x424922['rows']=_0x324aef;return _0x424922;});}})['then'](respondWithFilteredResult(_0x3ab0f5,_0x1afde9))[_0xa6cb('0x47')](handleError(_0x3ab0f5,null));};exports[_0xa6cb('0x5d')]=function(_0x5e9c2d,_0x185620,_0x56328c){var _0x5a89ab={};var _0x4633e0={};var _0x2daf4a;var _0x28a65f;return db[_0xa6cb('0x2f')][_0xa6cb('0x54')]({'where':{'id':_0x5e9c2d['params']['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x185620,null))['then'](function(_0xaad975){if(_0xaad975){_0x2daf4a=_0xaad975;_0x4633e0[_0xa6cb('0x31')]=_[_0xa6cb('0x33')](db[_0xa6cb('0x5e')]['rawAttributes']);_0x4633e0[_0xa6cb('0x32')]=_['keys'](_0x5e9c2d[_0xa6cb('0x32')]);_0x4633e0[_0xa6cb('0x34')]=_['intersection'](_0x4633e0[_0xa6cb('0x31')],_0x4633e0['query']);_0x5a89ab[_0xa6cb('0x37')]=_[_0xa6cb('0x35')](_0x4633e0[_0xa6cb('0x31')],qs[_0xa6cb('0x36')](_0x5e9c2d[_0xa6cb('0x32')][_0xa6cb('0x36')]));_0x5a89ab[_0xa6cb('0x37')]=_0x5a89ab['attributes']['length']?_0x5a89ab[_0xa6cb('0x37')]:_0x4633e0[_0xa6cb('0x31')];_0x5a89ab['order']=qs[_0xa6cb('0x3b')](_0x5e9c2d[_0xa6cb('0x32')]['sort']);_0x5a89ab[_0xa6cb('0x3c')]=qs[_0xa6cb('0x34')](_[_0xa6cb('0x3d')](_0x5e9c2d[_0xa6cb('0x32')],_0x4633e0[_0xa6cb('0x34')]));if(_0x5e9c2d[_0xa6cb('0x32')][_0xa6cb('0x3e')]){_0x5a89ab[_0xa6cb('0x3c')]=_[_0xa6cb('0x3f')](_0x5a89ab['where'],{'$or':_[_0xa6cb('0x2e')](_0x5a89ab[_0xa6cb('0x37')],function(_0x5afa38){var _0x2d00ba={};_0x2d00ba[_0x5afa38]={'$like':'%'+_0x5e9c2d['query'][_0xa6cb('0x3e')]+'%'};return _0x2d00ba;})});}_0x5a89ab=_[_0xa6cb('0x3f')]({},_0x5a89ab,_0x5e9c2d['options']);return _0x2daf4a[_0xa6cb('0x5d')](_0x5a89ab);}})[_0xa6cb('0x25')](function(_0x4aba73){if(_0x4aba73){_0x28a65f=_0x4aba73[_0xa6cb('0x38')];if(!_0x5e9c2d['query']['hasOwnProperty'](_0xa6cb('0x39'))){_0x5a89ab['limit']=qs[_0xa6cb('0x1d')](_0x5e9c2d[_0xa6cb('0x32')][_0xa6cb('0x1d')]);_0x5a89ab['offset']=qs[_0xa6cb('0x1c')](_0x5e9c2d['query']['offset']);}return _0x2daf4a[_0xa6cb('0x5d')](_0x5a89ab);}})[_0xa6cb('0x25')](function(_0x464a00){if(_0x464a00){return _0x464a00?{'count':_0x28a65f,'rows':_0x464a00}:null;}})[_0xa6cb('0x25')](respondWithResult(_0x185620,null))[_0xa6cb('0x47')](handleError(_0x185620,null));};exports[_0xa6cb('0x5f')]=function(_0x3f6ba2,_0x17d4d7,_0x555b0f){var _0x4f9814,_0x5dccaf;return db[_0xa6cb('0x2f')]['find']({'where':{'id':_0x3f6ba2[_0xa6cb('0x45')]['id']}})['then'](handleEntityNotFound(_0x17d4d7,null))[_0xa6cb('0x25')](function(_0x290959){if(_0x290959){_0x5dccaf=_0x290959;return _0x290959[_0xa6cb('0x5f')](_0x3f6ba2[_0xa6cb('0x52')][_0xa6cb('0x60')],_['omit'](_0x3f6ba2['body'],[_0xa6cb('0x60'),'id'])||{});}return null;})[_0xa6cb('0x61')](function(_0xa83f31){var _0x1e6609;_0x4f9814=_0xa83f31||[];var _0x18a54d=[];if(_0xa83f31){for(var _0x1e49e9=0x0;_0x1e49e9<_0xa83f31[_0xa6cb('0x38')];_0x1e49e9+=0x1){var _0x19cf20=_0xa83f31[_0x1e49e9]['get']({'plain':!![]});_0x5dccaf[_0xa6cb('0x62')]=_0x3f6ba2['body']['dialCheckDuplicateType']?_0x3f6ba2['body'][_0xa6cb('0x62')]:_0x5dccaf[_0xa6cb('0x62')];switch(_0x5dccaf[_0xa6cb('0x62')]){case _0xa6cb('0x63'):_0x1e6609=squel[_0xa6cb('0x64')]()['into'](_0xa6cb('0x65'))[_0xa6cb('0x66')]([_0xa6cb('0x67'),_0xa6cb('0x68'),_0xa6cb('0x69'),_0xa6cb('0x6a'),_0xa6cb('0x57'),_0xa6cb('0x50'),_0xa6cb('0x51')],squel['select']()[_0xa6cb('0x6b')](_0xa6cb('0x67'),_0xa6cb('0x67'))[_0xa6cb('0x6b')](_0xa6cb('0x6c'),_0xa6cb('0x68'))[_0xa6cb('0x6b')]('id',_0xa6cb('0x69'))[_0xa6cb('0x6b')](_0x19cf20[_0xa6cb('0x6d')][_0xa6cb('0x6e')](),'ListId')[_0xa6cb('0x6b')](_0x3f6ba2['params']['id'][_0xa6cb('0x6e')](),_0xa6cb('0x57'))[_0xa6cb('0x6b')](_0xa6cb('0x6c'),_0xa6cb('0x50'))[_0xa6cb('0x6b')]('NOW()',_0xa6cb('0x51'))[_0xa6cb('0x6f')](_0xa6cb('0x70'))[_0xa6cb('0x3c')](_0xa6cb('0x71'))[_0xa6cb('0x3c')](_0xa6cb('0x72'),_0x19cf20[_0xa6cb('0x6d')][_0xa6cb('0x6e')]())[_0xa6cb('0x3c')](_0xa6cb('0x73'))[_0xa6cb('0x3c')](_0xa6cb('0x74'),squel[_0xa6cb('0x75')]()[_0xa6cb('0x6b')](_0xa6cb('0x76'))[_0xa6cb('0x6f')](_0xa6cb('0x77'))[_0xa6cb('0x3c')]('CampaignId\x20=\x20?',_0x3f6ba2['params']['id'][_0xa6cb('0x6e')]()))['where'](_0xa6cb('0x74'),squel[_0xa6cb('0x75')]()[_0xa6cb('0x6b')]('COALESCE(phone,\x27\x27)')[_0xa6cb('0x6f')]('cm_hopper')[_0xa6cb('0x3c')](_0xa6cb('0x78'),_0x3f6ba2[_0xa6cb('0x45')]['id']['toString']())))[_0xa6cb('0x6e')]();break;case _0xa6cb('0x79'):_0x1e6609=squel[_0xa6cb('0x64')]()[_0xa6cb('0x7a')](_0xa6cb('0x65'))[_0xa6cb('0x66')]([_0xa6cb('0x67'),'scheduledAt',_0xa6cb('0x69'),_0xa6cb('0x6a'),'CampaignId',_0xa6cb('0x50'),_0xa6cb('0x51')],squel[_0xa6cb('0x75')]()[_0xa6cb('0x6b')]('phone',_0xa6cb('0x67'))[_0xa6cb('0x6b')](_0xa6cb('0x6c'),_0xa6cb('0x68'))['field']('id',_0xa6cb('0x69'))[_0xa6cb('0x6b')](_0x19cf20[_0xa6cb('0x6d')][_0xa6cb('0x6e')](),_0xa6cb('0x6a'))[_0xa6cb('0x6b')](_0x3f6ba2[_0xa6cb('0x45')]['id'][_0xa6cb('0x6e')](),_0xa6cb('0x57'))[_0xa6cb('0x6b')](_0xa6cb('0x6c'),_0xa6cb('0x50'))['field'](_0xa6cb('0x6c'),_0xa6cb('0x51'))[_0xa6cb('0x6f')]('cm_contacts')[_0xa6cb('0x3c')](_0xa6cb('0x71'))[_0xa6cb('0x3c')](_0xa6cb('0x72'),_0x19cf20['CmListId'][_0xa6cb('0x6e')]())[_0xa6cb('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xa6cb('0x3c')](_0xa6cb('0x74'),squel['select']()[_0xa6cb('0x6b')](_0xa6cb('0x7b'))['from'](_0xa6cb('0x65'))['where'](_0xa6cb('0x78'),_0x3f6ba2['params']['id'][_0xa6cb('0x6e')]())))[_0xa6cb('0x6e')]();break;default:_0x1e6609=squel[_0xa6cb('0x64')]()[_0xa6cb('0x7a')](_0xa6cb('0x65'))['fromQuery']([_0xa6cb('0x67'),'scheduledAt',_0xa6cb('0x69'),_0xa6cb('0x6a'),_0xa6cb('0x57'),_0xa6cb('0x50'),_0xa6cb('0x51')],squel[_0xa6cb('0x75')]()[_0xa6cb('0x6b')](_0xa6cb('0x67'),'phone')[_0xa6cb('0x6b')](_0xa6cb('0x6c'),_0xa6cb('0x68'))[_0xa6cb('0x6b')]('id',_0xa6cb('0x69'))[_0xa6cb('0x6b')](_0x19cf20[_0xa6cb('0x6d')][_0xa6cb('0x6e')](),'ListId')[_0xa6cb('0x6b')](_0x3f6ba2[_0xa6cb('0x45')]['id'][_0xa6cb('0x6e')](),_0xa6cb('0x57'))[_0xa6cb('0x6b')]('NOW()','createdAt')[_0xa6cb('0x6b')](_0xa6cb('0x6c'),_0xa6cb('0x51'))[_0xa6cb('0x6f')](_0xa6cb('0x70'))[_0xa6cb('0x3c')](_0xa6cb('0x71'))[_0xa6cb('0x3c')](_0xa6cb('0x72'),_0x19cf20['CmListId'][_0xa6cb('0x6e')]())[_0xa6cb('0x3c')](_0xa6cb('0x73')))[_0xa6cb('0x6e')]();}_0x18a54d[_0xa6cb('0x7c')](db[_0xa6cb('0x7d')][_0xa6cb('0x32')](_0x1e6609));}return BPromise[_0xa6cb('0x7e')](_0x18a54d);}})[_0xa6cb('0x25')](function(){return _0x4f9814;})[_0xa6cb('0x25')](respondWithResult(_0x17d4d7,null))[_0xa6cb('0x47')](handleError(_0x17d4d7,null));};exports[_0xa6cb('0x7f')]=function(_0x50385,_0x372172,_0x5d6729){return db[_0xa6cb('0x2f')][_0xa6cb('0x46')]({'where':{'id':_0x50385[_0xa6cb('0x45')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x372172,null))['then'](function(_0xeab1de){if(_0xeab1de){return _0xeab1de[_0xa6cb('0x7f')](_0x50385[_0xa6cb('0x32')]['ids']);}})[_0xa6cb('0x25')](function(_0x327863){if(_0x327863){return db['CmHopper'][_0xa6cb('0x24')]({'where':{'ListId':_0x50385[_0xa6cb('0x32')][_0xa6cb('0x60')],'CampaignId':_0x50385[_0xa6cb('0x45')]['id']}})[_0xa6cb('0x25')](function(){return _0x327863;});}})['then'](respondWithStatusCode(_0x372172,null))[_0xa6cb('0x47')](handleError(_0x372172,null));};exports[_0xa6cb('0x80')]=function(_0x3d536f,_0x3b6f33,_0x3d4443){var _0x40f13a={'raw':!![],'where':{}};var _0x745e1e={};var _0x56ccd9={'count':0x0,'rows':[]};return db[_0xa6cb('0x2f')][_0xa6cb('0x54')]({'where':{'id':_0x3d536f[_0xa6cb('0x45')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x3b6f33,null))['then'](function(_0x3764e8){if(_0x3764e8){_0x745e1e[_0xa6cb('0x31')]=_['keys'](db[_0xa6cb('0x5e')][_0xa6cb('0x30')]);_0x745e1e[_0xa6cb('0x32')]=_[_0xa6cb('0x33')](_0x3d536f[_0xa6cb('0x32')]);_0x745e1e[_0xa6cb('0x34')]=_[_0xa6cb('0x35')](_0x745e1e[_0xa6cb('0x31')],_0x745e1e[_0xa6cb('0x32')]);_0x40f13a[_0xa6cb('0x37')]=_[_0xa6cb('0x35')](_0x745e1e[_0xa6cb('0x31')],qs[_0xa6cb('0x36')](_0x3d536f[_0xa6cb('0x32')]['fields']));_0x40f13a[_0xa6cb('0x37')]=_0x40f13a[_0xa6cb('0x37')][_0xa6cb('0x38')]?_0x40f13a['attributes']:_0x745e1e['model'];if(!_0x3d536f[_0xa6cb('0x32')]['hasOwnProperty']('nolimit')){_0x40f13a['limit']=qs[_0xa6cb('0x1d')](_0x3d536f[_0xa6cb('0x32')][_0xa6cb('0x1d')]);_0x40f13a[_0xa6cb('0x1c')]=qs['offset'](_0x3d536f['query'][_0xa6cb('0x1c')]);}_0x40f13a['order']=qs[_0xa6cb('0x3b')](_0x3d536f['query'][_0xa6cb('0x3b')]);_0x40f13a[_0xa6cb('0x3c')]=qs[_0xa6cb('0x34')](_[_0xa6cb('0x3d')](_0x3d536f[_0xa6cb('0x32')],_0x745e1e['filters']));_0x40f13a[_0xa6cb('0x3c')][_0xa6cb('0x57')]=_0x3764e8['id'];if(_0x3d536f[_0xa6cb('0x32')][_0xa6cb('0x3e')]){_0x40f13a[_0xa6cb('0x3c')]=_[_0xa6cb('0x3f')](_0x40f13a[_0xa6cb('0x3c')],{'$or':_['map'](_0x40f13a[_0xa6cb('0x37')],function(_0x176392){var _0x452695={};_0x452695[_0x176392]={'$like':'%'+_0x3d536f[_0xa6cb('0x32')]['filter']+'%'};return _0x452695;})});}_0x40f13a=_[_0xa6cb('0x3f')]({},_0x40f13a,_0x3d536f[_0xa6cb('0x40')]);return db[_0xa6cb('0x5e')][_0xa6cb('0x1b')]({'where':_0x40f13a[_0xa6cb('0x3c')]})[_0xa6cb('0x25')](function(_0x3a5aa6){_0x56ccd9[_0xa6cb('0x1b')]=_0x3a5aa6;if(_0x3d536f[_0xa6cb('0x32')][_0xa6cb('0x41')]){_0x40f13a[_0xa6cb('0x42')]=[{'all':!![]}];}return db[_0xa6cb('0x5e')]['findAll'](_0x40f13a);})['then'](function(_0x4029ab){_0x56ccd9[_0xa6cb('0x44')]=_0x4029ab;return _0x56ccd9;});}})[_0xa6cb('0x25')](respondWithFilteredResult(_0x3b6f33,_0x40f13a))[_0xa6cb('0x47')](handleError(_0x3b6f33,null));};exports['addBlackLists']=function(_0x46de30,_0x3c49b5,_0x443502){var _0x28b3d4,_0x5a0f13;return db[_0xa6cb('0x2f')][_0xa6cb('0x46')]({'where':{'id':_0x46de30['params']['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x3c49b5,null))['then'](function(_0x2abb0e){if(_0x2abb0e){_0x5a0f13=_0x2abb0e;return _0x2abb0e[_0xa6cb('0x81')](_0x46de30[_0xa6cb('0x52')][_0xa6cb('0x60')],_['omit'](_0x46de30[_0xa6cb('0x52')],[_0xa6cb('0x60'),'id'])||{});}return null;})[_0xa6cb('0x61')](function(_0x47fc52){var _0x4ebd89;_0x28b3d4=_0x47fc52||[];var _0x3bcd9a=[];if(_0x47fc52){for(var _0x5363b1=0x0;_0x5363b1<_0x47fc52[_0xa6cb('0x38')];_0x5363b1+=0x1){var _0x2aee55=_0x47fc52[_0x5363b1][_0xa6cb('0x26')]({'plain':!![]});_0x4ebd89=squel[_0xa6cb('0x64')]()[_0xa6cb('0x7a')]('cm_hopper_black')[_0xa6cb('0x66')]([_0xa6cb('0x67'),_0xa6cb('0x69'),_0xa6cb('0x6a'),_0xa6cb('0x57'),'createdAt',_0xa6cb('0x51')],squel[_0xa6cb('0x75')]()[_0xa6cb('0x6b')](_0xa6cb('0x67'),'phone')[_0xa6cb('0x6b')]('id',_0xa6cb('0x69'))[_0xa6cb('0x6b')](_0x2aee55[_0xa6cb('0x6d')][_0xa6cb('0x6e')](),'ListId')[_0xa6cb('0x6b')](_0x46de30['params']['id'][_0xa6cb('0x6e')](),'CampaignId')['field']('NOW()',_0xa6cb('0x50'))[_0xa6cb('0x6b')](_0xa6cb('0x6c'),_0xa6cb('0x51'))['from'](_0xa6cb('0x70'))[_0xa6cb('0x3c')](_0xa6cb('0x71'))[_0xa6cb('0x3c')](_0xa6cb('0x72'),_0x2aee55['CmListId'][_0xa6cb('0x6e')]())[_0xa6cb('0x3c')](_0xa6cb('0x73')))[_0xa6cb('0x6e')]();_0x3bcd9a[_0xa6cb('0x7c')](db[_0xa6cb('0x7d')][_0xa6cb('0x32')](_0x4ebd89));}return BPromise['all'](_0x3bcd9a);}})[_0xa6cb('0x25')](function(){return _0x28b3d4;})[_0xa6cb('0x25')](respondWithResult(_0x3c49b5,null))[_0xa6cb('0x47')](handleError(_0x3c49b5,null));};exports[_0xa6cb('0x82')]=function(_0x56a9ee,_0x99d8f2,_0x4e09ba){return db[_0xa6cb('0x2f')][_0xa6cb('0x46')]({'where':{'id':_0x56a9ee[_0xa6cb('0x45')]['id']}})[_0xa6cb('0x25')](handleEntityNotFound(_0x99d8f2,null))['then'](function(_0x65afd5){if(_0x65afd5){return _0x65afd5['removeBlackLists'](_0x56a9ee[_0xa6cb('0x32')][_0xa6cb('0x60')]);}})['then'](function(_0xd4a323){if(_0xd4a323){return db[_0xa6cb('0x5c')][_0xa6cb('0x24')]({'where':{'ListId':_0x56a9ee[_0xa6cb('0x32')][_0xa6cb('0x60')],'CampaignId':_0x56a9ee[_0xa6cb('0x45')]['id']}})['then'](function(){return _0xd4a323;});}})[_0xa6cb('0x25')](respondWithStatusCode(_0x99d8f2,null))['catch'](handleError(_0x99d8f2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f63a72f..440233c 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 _0x92aa=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns'];(function(_0x4d9c6f,_0x4c511c){var _0x1d0128=function(_0x9c7509){while(--_0x9c7509){_0x4d9c6f['push'](_0x4d9c6f['shift']());}};_0x1d0128(++_0x4c511c);}(_0x92aa,0x168));var _0xa92a=function(_0x2fad36,_0x1e8a56){_0x2fad36=_0x2fad36-0x0;var _0x407580=_0x92aa[_0x2fad36];return _0x407580;};'use strict';var _=require(_0xa92a('0x0'));var util=require(_0xa92a('0x1'));var logger=require(_0xa92a('0x2'))(_0xa92a('0x3'));var moment=require(_0xa92a('0x4'));var BPromise=require(_0xa92a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa92a('0x6'));var config=require(_0xa92a('0x7'));var attributes=require(_0xa92a('0x8'));module[_0xa92a('0x9')]=function(_0x1431dc,_0x30f3a2){return _0x1431dc['define'](_0xa92a('0xa'),attributes,{'tableName':_0xa92a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f57=['rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','util','api','moment','bluebird','request-promise','path'];(function(_0x56bc67,_0x463fc1){var _0x5c442f=function(_0x776d1c){while(--_0x776d1c){_0x56bc67['push'](_0x56bc67['shift']());}};_0x5c442f(++_0x463fc1);}(_0x2f57,0x16e));var _0x72f5=function(_0x216866,_0x406479){_0x216866=_0x216866-0x0;var _0x5e973f=_0x2f57[_0x216866];return _0x5e973f;};'use strict';var _=require('lodash');var util=require(_0x72f5('0x0'));var logger=require('../../config/logger')(_0x72f5('0x1'));var moment=require(_0x72f5('0x2'));var BPromise=require(_0x72f5('0x3'));var rp=require(_0x72f5('0x4'));var fs=require('fs');var path=require(_0x72f5('0x5'));var rimraf=require(_0x72f5('0x6'));var config=require(_0x72f5('0x7'));var attributes=require(_0x72f5('0x8'));module[_0x72f5('0x9')]=function(_0x2158d7,_0x51722a){return _0x2158d7[_0x72f5('0xa')]('Campaign',attributes,{'tableName':_0x72f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 05872b4..ff2d1f7 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(_0x327a16,_0x3d308c){var _0x3f25ed=function(_0x8903d4){while(--_0x8903d4){_0x327a16['push'](_0x327a16['shift']());}};_0x3f25ed(++_0x3d308c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 _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(_0x56bc67,_0x463fc1){var _0x5c442f=function(_0x776d1c){while(--_0x776d1c){_0x56bc67['push'](_0x56bc67['shift']());}};_0x5c442f(++_0x463fc1);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 51cffb1..fe773cf 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 _0xb7ed=['addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','index','/:id','show','isAuthenticated','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addLists'];(function(_0x4b8da0,_0x24a5c7){var _0xd8024=function(_0x4734dc){while(--_0x4734dc){_0x4b8da0['push'](_0x4b8da0['shift']());}};_0xd8024(++_0x24a5c7);}(_0xb7ed,0x1e7));var _0xdb7e=function(_0x2e3ebb,_0x5afc59){_0x2e3ebb=_0x2e3ebb-0x0;var _0x8f027f=_0xb7ed[_0x2e3ebb];return _0x8f027f;};'use strict';var multer=require(_0xdb7e('0x0'));var util=require('util');var path=require(_0xdb7e('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb7e('0x2'));var router=express[_0xdb7e('0x3')]();var auth=require(_0xdb7e('0x4'));var interaction=require(_0xdb7e('0x5'));var config=require('../../config/environment');var controller=require(_0xdb7e('0x6'));router[_0xdb7e('0x7')]('/',auth['isAuthenticated'](),controller[_0xdb7e('0x8')]);router[_0xdb7e('0x7')](_0xdb7e('0x9'),auth['isAuthenticated'](),controller[_0xdb7e('0xa')]);router[_0xdb7e('0x7')]('/:id/hoppers',auth[_0xdb7e('0xb')](),controller[_0xdb7e('0xc')]);router[_0xdb7e('0x7')]('/:id/hopper_histories',auth[_0xdb7e('0xb')](),controller[_0xdb7e('0xd')]);router[_0xdb7e('0x7')](_0xdb7e('0xe'),auth['isAuthenticated'](),controller[_0xdb7e('0xf')]);router[_0xdb7e('0x7')](_0xdb7e('0x10'),auth[_0xdb7e('0xb')](),controller[_0xdb7e('0x11')]);router[_0xdb7e('0x7')](_0xdb7e('0x12'),auth[_0xdb7e('0xb')](),controller[_0xdb7e('0x13')]);router['get'](_0xdb7e('0x14'),auth[_0xdb7e('0xb')](),controller['getBlackLists']);router[_0xdb7e('0x15')]('/',auth[_0xdb7e('0xb')](),controller[_0xdb7e('0x16')]);router[_0xdb7e('0x15')](_0xdb7e('0x17'),auth[_0xdb7e('0xb')](),controller['clone']);router[_0xdb7e('0x15')](_0xdb7e('0x12'),auth['isAuthenticated'](),controller[_0xdb7e('0x18')]);router[_0xdb7e('0x15')](_0xdb7e('0x14'),auth[_0xdb7e('0xb')](),controller[_0xdb7e('0x19')]);router[_0xdb7e('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xdb7e('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdb7e('0x1c')]);router[_0xdb7e('0x1d')](_0xdb7e('0x12'),auth[_0xdb7e('0xb')](),controller[_0xdb7e('0x1e')]);router[_0xdb7e('0x1d')](_0xdb7e('0x14'),auth[_0xdb7e('0xb')](),controller[_0xdb7e('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x2005=['index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x2005,0x12d));var _0x5200=function(_0x2fd61e,_0x408859){_0x2fd61e=_0x2fd61e-0x0;var _0x55ee6b=_0x2005[_0x2fd61e];return _0x55ee6b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5200('0x0'));var express=require(_0x5200('0x1'));var router=express['Router']();var auth=require(_0x5200('0x2'));var interaction=require(_0x5200('0x3'));var config=require(_0x5200('0x4'));var controller=require('./campaign.controller');router[_0x5200('0x5')]('/',auth[_0x5200('0x6')](),controller[_0x5200('0x7')]);router[_0x5200('0x5')](_0x5200('0x8'),auth[_0x5200('0x6')](),controller['show']);router[_0x5200('0x5')](_0x5200('0x9'),auth['isAuthenticated'](),controller[_0x5200('0xa')]);router[_0x5200('0x5')](_0x5200('0xb'),auth['isAuthenticated'](),controller[_0x5200('0xc')]);router['get'](_0x5200('0xd'),auth[_0x5200('0x6')](),controller[_0x5200('0xe')]);router['get']('/:id/hopper_black',auth[_0x5200('0x6')](),controller[_0x5200('0xf')]);router['get'](_0x5200('0x10'),auth['isAuthenticated'](),controller[_0x5200('0x11')]);router[_0x5200('0x5')](_0x5200('0x12'),auth[_0x5200('0x6')](),controller['getBlackLists']);router[_0x5200('0x13')]('/',auth[_0x5200('0x6')](),controller['create']);router[_0x5200('0x13')](_0x5200('0x14'),auth[_0x5200('0x6')](),controller['clone']);router[_0x5200('0x13')](_0x5200('0x10'),auth[_0x5200('0x6')](),controller[_0x5200('0x15')]);router['post'](_0x5200('0x12'),auth[_0x5200('0x6')](),controller[_0x5200('0x16')]);router[_0x5200('0x17')](_0x5200('0x8'),auth['isAuthenticated'](),controller[_0x5200('0x18')]);router[_0x5200('0x19')](_0x5200('0x8'),auth[_0x5200('0x6')](),controller[_0x5200('0x1a')]);router[_0x5200('0x19')]('/:id/lists',auth[_0x5200('0x6')](),controller[_0x5200('0x1b')]);router[_0x5200('0x19')](_0x5200('0x12'),auth[_0x5200('0x6')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a57a7e0..83d0b4b 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 _0x204d=['sequelize','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x1261a9,_0x555823){var _0x21d3d2=function(_0x4406b9){while(--_0x4406b9){_0x1261a9['push'](_0x1261a9['shift']());}};_0x21d3d2(++_0x555823);}(_0x204d,0xf6));var _0xd204=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x204d[_0x8c1005];return _0x175354;};'use strict';var Sequelize=require(_0xd204('0x0'));module['exports']={'key':{'type':Sequelize[_0xd204('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xd204('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd204('0x1')]},'name':{'type':Sequelize[_0xd204('0x3')],'get':function(){return this[_0xd204('0x4')](_0xd204('0x5'));}}}; \ No newline at end of file +var _0xd049=['key','sequelize','exports','STRING','TEXT','getDataValue'];(function(_0x3b208d,_0x320b73){var _0x26c3c1=function(_0x2aff8a){while(--_0x2aff8a){_0x3b208d['push'](_0x3b208d['shift']());}};_0x26c3c1(++_0x320b73);}(_0xd049,0x6d));var _0x9d04=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd049[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x9d04('0x0'));module[_0x9d04('0x1')]={'key':{'type':Sequelize[_0x9d04('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x9d04('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9d04('0x4')](_0x9d04('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 984e7d8..6114b56 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 _0xc217=['map','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','CannedAnswer','includeAll','findAll','rows','show','params','keys','include','find','catch','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','name','send','index'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0xc217,0x83));var _0x7c21=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xc217[_0x387777];return _0x3f84c0;};'use strict';var pdf=require(_0x7c21('0x0'));var emlformat=require(_0x7c21('0x1'));var rimraf=require(_0x7c21('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c21('0x3'));var rp=require(_0x7c21('0x4'));var moment=require(_0x7c21('0x5'));var BPromise=require(_0x7c21('0x6'));var Mustache=require(_0x7c21('0x7'));var util=require(_0x7c21('0x8'));var path=require(_0x7c21('0x9'));var sox=require(_0x7c21('0xa'));var csv=require(_0x7c21('0xb'));var ejs=require(_0x7c21('0xc'));var fs=require('fs');var _=require(_0x7c21('0xd'));var squel=require('squel');var crypto=require(_0x7c21('0xe'));var jsforce=require(_0x7c21('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c21('0x10'));var Papa=require(_0x7c21('0x11'));var Redis=require(_0x7c21('0x12'));var authService=require(_0x7c21('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7c21('0x14'));var hardwareService=require(_0x7c21('0x15'));var logger=require(_0x7c21('0x16'))(_0x7c21('0x17'));var utils=require('../../config/utils');var config=require(_0x7c21('0x18'));var db=require(_0x7c21('0x19'))['db'];function respondWithStatusCode(_0x270fca,_0x34ff2e){_0x34ff2e=_0x34ff2e||0xcc;return function(_0xdfef37){if(_0xdfef37){return _0x270fca['sendStatus'](_0x34ff2e);}return _0x270fca[_0x7c21('0x1a')](_0x34ff2e)[_0x7c21('0x1b')]();};}function respondWithResult(_0x3f1c66,_0x22afae){_0x22afae=_0x22afae||0xc8;return function(_0x3a3795){if(_0x3a3795){return _0x3f1c66['status'](_0x22afae)['json'](_0x3a3795);}};}function respondWithFilteredResult(_0x145788,_0x5a552c){return function(_0x440efb){if(_0x440efb){var _0x583071=_0x440efb[_0x7c21('0x1c')],_0x4dfd69=_0x5a552c[_0x7c21('0x1d')],_0x1ec8e2=_0x5a552c[_0x7c21('0x1d')]+_0x5a552c[_0x7c21('0x1e')],_0x2a63aa;if(_0x1ec8e2>=_0x583071){_0x1ec8e2=_0x583071;_0x2a63aa=0xc8;}else{_0x2a63aa=0xce;}_0x145788[_0x7c21('0x1a')](_0x2a63aa);return _0x145788[_0x7c21('0x1f')](_0x7c21('0x20'),_0x4dfd69+'-'+_0x1ec8e2+'/'+_0x583071)[_0x7c21('0x21')](_0x440efb);}return null;};}function patchUpdates(_0x42eee7){return function(_0xf75e12){try{jsonpatch[_0x7c21('0x22')](_0xf75e12,_0x42eee7,!![]);}catch(_0xe434e3){return BPromise[_0x7c21('0x23')](_0xe434e3);}return _0xf75e12['save']();};}function saveUpdates(_0x2ca56d,_0x4995ad){return function(_0x1b4ef6){if(_0x1b4ef6){return _0x1b4ef6[_0x7c21('0x24')](_0x2ca56d)[_0x7c21('0x25')](function(_0x2cccdc){return _0x2cccdc;});}return null;};}function removeEntity(_0x2dd8a3,_0x1666e3){return function(_0x4fcdd0){if(_0x4fcdd0){return _0x4fcdd0[_0x7c21('0x26')]()[_0x7c21('0x25')](function(){var _0x228018=_0x4fcdd0[_0x7c21('0x27')]({'plain':!![]});var _0x2d32f6=_0x7c21('0x28');return db[_0x7c21('0x29')][_0x7c21('0x26')]({'where':{'type':_0x2d32f6,'resourceId':_0x228018['id']}})['then'](function(){return _0x4fcdd0;});})['then'](function(){_0x2dd8a3[_0x7c21('0x1a')](0xcc)[_0x7c21('0x1b')]();});}};}function handleEntityNotFound(_0x4b7871,_0x90dc51){return function(_0x567609){if(!_0x567609){_0x4b7871[_0x7c21('0x2a')](0x194);}return _0x567609;};}function handleError(_0x4cd003,_0x305b1f){_0x305b1f=_0x305b1f||0x1f4;return function(_0x6c72f2){logger[_0x7c21('0x2b')](_0x6c72f2['stack']);if(_0x6c72f2[_0x7c21('0x2c')]){delete _0x6c72f2[_0x7c21('0x2c')];}_0x4cd003[_0x7c21('0x1a')](_0x305b1f)[_0x7c21('0x2d')](_0x6c72f2);};}exports[_0x7c21('0x2e')]=function(_0x42969f,_0x1de0cf){var _0x54d0c0={},_0x404ab1={},_0xdc671f={'count':0x0,'rows':[]};var _0x124bc9=_[_0x7c21('0x2f')](db['CannedAnswer'][_0x7c21('0x30')],function(_0x974e1c){return{'name':_0x974e1c[_0x7c21('0x31')],'type':_0x974e1c['type']['key']};});_0x404ab1[_0x7c21('0x32')]=_[_0x7c21('0x2f')](_0x124bc9,_0x7c21('0x2c'));_0x404ab1['query']=_['keys'](_0x42969f[_0x7c21('0x33')]);_0x404ab1['filters']=_[_0x7c21('0x34')](_0x404ab1[_0x7c21('0x32')],_0x404ab1[_0x7c21('0x33')]);_0x54d0c0['attributes']=_['intersection'](_0x404ab1[_0x7c21('0x32')],qs[_0x7c21('0x35')](_0x42969f[_0x7c21('0x33')][_0x7c21('0x35')]));_0x54d0c0['attributes']=_0x54d0c0[_0x7c21('0x36')][_0x7c21('0x37')]?_0x54d0c0[_0x7c21('0x36')]:_0x404ab1['model'];if(!_0x42969f[_0x7c21('0x33')][_0x7c21('0x38')]('nolimit')){_0x54d0c0[_0x7c21('0x1e')]=qs[_0x7c21('0x1e')](_0x42969f['query'][_0x7c21('0x1e')]);_0x54d0c0[_0x7c21('0x1d')]=qs[_0x7c21('0x1d')](_0x42969f[_0x7c21('0x33')][_0x7c21('0x1d')]);}_0x54d0c0[_0x7c21('0x39')]=qs[_0x7c21('0x3a')](_0x42969f[_0x7c21('0x33')][_0x7c21('0x3a')]);_0x54d0c0['where']=qs[_0x7c21('0x3b')](_[_0x7c21('0x3c')](_0x42969f[_0x7c21('0x33')],_0x404ab1[_0x7c21('0x3b')]),_0x124bc9);if(_0x42969f[_0x7c21('0x33')][_0x7c21('0x3d')]){_0x54d0c0[_0x7c21('0x3e')]=_['merge'](_0x54d0c0[_0x7c21('0x3e')],{'$or':_['map'](_0x124bc9,function(_0x1a177d){if(_0x1a177d['type']!==_0x7c21('0x3f')){var _0xfc6bc5={};_0xfc6bc5[_0x1a177d['name']]={'$like':'%'+_0x42969f[_0x7c21('0x33')][_0x7c21('0x3d')]+'%'};return _0xfc6bc5;}})});}_0x54d0c0=_[_0x7c21('0x40')]({},_0x54d0c0,_0x42969f[_0x7c21('0x41')]);var _0x3c31e4={'where':_0x54d0c0['where']};return db[_0x7c21('0x42')]['count'](_0x3c31e4)[_0x7c21('0x25')](function(_0xac1e4){_0xdc671f['count']=_0xac1e4;if(_0x42969f['query'][_0x7c21('0x43')]){_0x54d0c0['include']=[{'all':!![]}];}return db[_0x7c21('0x42')][_0x7c21('0x44')](_0x54d0c0);})[_0x7c21('0x25')](function(_0x40d996){_0xdc671f[_0x7c21('0x45')]=_0x40d996;return _0xdc671f;})['then'](respondWithFilteredResult(_0x1de0cf,_0x54d0c0))['catch'](handleError(_0x1de0cf,null));};exports[_0x7c21('0x46')]=function(_0x1b09dd,_0xd4c45a){var _0x4af110={'raw':!![],'where':{'id':_0x1b09dd[_0x7c21('0x47')]['id']}},_0x329e7b={};_0x329e7b['model']=_[_0x7c21('0x48')](db[_0x7c21('0x42')]['rawAttributes']);_0x329e7b[_0x7c21('0x33')]=_[_0x7c21('0x48')](_0x1b09dd['query']);_0x329e7b[_0x7c21('0x3b')]=_[_0x7c21('0x34')](_0x329e7b[_0x7c21('0x32')],_0x329e7b[_0x7c21('0x33')]);_0x4af110[_0x7c21('0x36')]=_[_0x7c21('0x34')](_0x329e7b[_0x7c21('0x32')],qs[_0x7c21('0x35')](_0x1b09dd[_0x7c21('0x33')][_0x7c21('0x35')]));_0x4af110['attributes']=_0x4af110[_0x7c21('0x36')][_0x7c21('0x37')]?_0x4af110[_0x7c21('0x36')]:_0x329e7b[_0x7c21('0x32')];if(_0x1b09dd[_0x7c21('0x33')]['includeAll']){_0x4af110[_0x7c21('0x49')]=[{'all':!![]}];}_0x4af110=_[_0x7c21('0x40')]({},_0x4af110,_0x1b09dd[_0x7c21('0x41')]);return db[_0x7c21('0x42')][_0x7c21('0x4a')](_0x4af110)[_0x7c21('0x25')](handleEntityNotFound(_0xd4c45a,null))[_0x7c21('0x25')](respondWithResult(_0xd4c45a,null))[_0x7c21('0x4b')](handleError(_0xd4c45a,null));};exports['update']=function(_0x1ef0c3,_0x47270b){if(_0x1ef0c3[_0x7c21('0x4c')]['id']){delete _0x1ef0c3[_0x7c21('0x4c')]['id'];}return db['CannedAnswer'][_0x7c21('0x4a')]({'where':{'id':_0x1ef0c3['params']['id']}})[_0x7c21('0x25')](handleEntityNotFound(_0x47270b,null))[_0x7c21('0x25')](saveUpdates(_0x1ef0c3[_0x7c21('0x4c')],null))[_0x7c21('0x25')](respondWithResult(_0x47270b,null))[_0x7c21('0x4b')](handleError(_0x47270b,null));};exports[_0x7c21('0x26')]=function(_0xe3b8d4,_0x2d0262){return db[_0x7c21('0x42')][_0x7c21('0x4a')]({'where':{'id':_0xe3b8d4['params']['id']}})[_0x7c21('0x25')](handleEntityNotFound(_0x2d0262,null))[_0x7c21('0x25')](removeEntity(_0x2d0262,null))[_0x7c21('0x4b')](handleError(_0x2d0262,null));};exports[_0x7c21('0x4d')]=function(_0x369ee9,_0x436528){var _0x3794d8={'key':_0x369ee9[_0x7c21('0x4c')][_0x7c21('0x4e')]};if(_0x369ee9['body'][_0x7c21('0x4f')]){_0x3794d8[_0x7c21('0x4f')]=_0x369ee9[_0x7c21('0x4c')][_0x7c21('0x4f')];}else if(_0x369ee9[_0x7c21('0x4c')][_0x7c21('0x50')]){_0x3794d8[_0x7c21('0x50')]=_0x369ee9['body'][_0x7c21('0x50')];}else if(_0x369ee9[_0x7c21('0x4c')][_0x7c21('0x51')]){_0x3794d8[_0x7c21('0x51')]=_0x369ee9[_0x7c21('0x4c')]['OpenchannelAccountId'];}else if(_0x369ee9[_0x7c21('0x4c')][_0x7c21('0x52')]){_0x3794d8[_0x7c21('0x52')]=_0x369ee9[_0x7c21('0x4c')][_0x7c21('0x52')];}return db[_0x7c21('0x42')]['find']({'where':_0x3794d8})[_0x7c21('0x25')](function(_0x638fae){if(_0x638fae){throw new db[(_0x7c21('0x53'))][(_0x7c21('0x54'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x7c21('0x42')]['create'](_0x369ee9[_0x7c21('0x4c')]);})['then'](function(_0xd28431){var _0x4cda7b=_0x369ee9[_0x7c21('0x55')][_0x7c21('0x27')]({'plain':!![]});if(!_0x4cda7b)throw new Error(_0x7c21('0x56'));if(_0x4cda7b[_0x7c21('0x57')]===_0x7c21('0x55')){var _0x5cfe6d=_0xd28431[_0x7c21('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x7c21('0x4a')]({'where':{'name':'CannedAnswers','userProfileId':_0x4cda7b['userProfileId']},'raw':!![]})[_0x7c21('0x25')](function(_0x520fb9){if(_0x520fb9&&_0x520fb9[_0x7c21('0x58')]===0x0){return db[_0x7c21('0x29')]['create']({'name':_0x5cfe6d[_0x7c21('0x2c')],'resourceId':_0x5cfe6d['id'],'type':_0x520fb9[_0x7c21('0x2c')],'sectionId':_0x520fb9['id']},{})[_0x7c21('0x25')](function(){return _0xd28431;});}else{return _0xd28431;}})[_0x7c21('0x4b')](function(_0x115adb){logger[_0x7c21('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x115adb);throw _0x115adb;});}return _0xd28431;})['then'](respondWithResult(_0x436528,0xc9))[_0x7c21('0x4b')](handleError(_0x436528,null));}; \ No newline at end of file +var _0x09ac=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','CannedAnswers','sendStatus','error','stack','name','send','index','map','CannedAnswer','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','fields','length','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto'];(function(_0x43547b,_0x5bbfc8){var _0x16548c=function(_0x48a3c9){while(--_0x48a3c9){_0x43547b['push'](_0x43547b['shift']());}};_0x16548c(++_0x5bbfc8);}(_0x09ac,0xa7));var _0xc09a=function(_0x5c0de9,_0x3345ab){_0x5c0de9=_0x5c0de9-0x0;var _0x4c3b7e=_0x09ac[_0x5c0de9];return _0x4c3b7e;};'use strict';var pdf=require(_0xc09a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc09a('0x1'));var zipdir=require(_0xc09a('0x2'));var jsonpatch=require(_0xc09a('0x3'));var rp=require(_0xc09a('0x4'));var moment=require(_0xc09a('0x5'));var BPromise=require(_0xc09a('0x6'));var Mustache=require('mustache');var util=require(_0xc09a('0x7'));var path=require(_0xc09a('0x8'));var sox=require(_0xc09a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc09a('0xa'));var squel=require(_0xc09a('0xb'));var crypto=require(_0xc09a('0xc'));var jsforce=require(_0xc09a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc09a('0xe'));var querystring=require(_0xc09a('0xf'));var Papa=require(_0xc09a('0x10'));var Redis=require(_0xc09a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc09a('0x12'));var as=require(_0xc09a('0x13'));var hardwareService=require(_0xc09a('0x14'));var logger=require(_0xc09a('0x15'))('api');var utils=require(_0xc09a('0x16'));var config=require(_0xc09a('0x17'));var db=require(_0xc09a('0x18'))['db'];function respondWithStatusCode(_0x440ecc,_0x1f1d24){_0x1f1d24=_0x1f1d24||0xcc;return function(_0x430a9a){if(_0x430a9a){return _0x440ecc['sendStatus'](_0x1f1d24);}return _0x440ecc[_0xc09a('0x19')](_0x1f1d24)[_0xc09a('0x1a')]();};}function respondWithResult(_0x5f0b51,_0x407ff8){_0x407ff8=_0x407ff8||0xc8;return function(_0x1fd1b7){if(_0x1fd1b7){return _0x5f0b51[_0xc09a('0x19')](_0x407ff8)[_0xc09a('0x1b')](_0x1fd1b7);}};}function respondWithFilteredResult(_0x5c87f0,_0x4ab962){return function(_0x2d6bf9){if(_0x2d6bf9){var _0x3e31f6=_0x2d6bf9[_0xc09a('0x1c')],_0x34bfab=_0x4ab962[_0xc09a('0x1d')],_0x297695=_0x4ab962[_0xc09a('0x1d')]+_0x4ab962[_0xc09a('0x1e')],_0xdcc125;if(_0x297695>=_0x3e31f6){_0x297695=_0x3e31f6;_0xdcc125=0xc8;}else{_0xdcc125=0xce;}_0x5c87f0['status'](_0xdcc125);return _0x5c87f0[_0xc09a('0x1f')]('Content-Range',_0x34bfab+'-'+_0x297695+'/'+_0x3e31f6)['json'](_0x2d6bf9);}return null;};}function patchUpdates(_0x9b495d){return function(_0x426e47){try{jsonpatch[_0xc09a('0x20')](_0x426e47,_0x9b495d,!![]);}catch(_0x183ede){return BPromise[_0xc09a('0x21')](_0x183ede);}return _0x426e47[_0xc09a('0x22')]();};}function saveUpdates(_0x590b96,_0x40a7d1){return function(_0x8691b6){if(_0x8691b6){return _0x8691b6[_0xc09a('0x23')](_0x590b96)[_0xc09a('0x24')](function(_0xf9b03f){return _0xf9b03f;});}return null;};}function removeEntity(_0x4284fe,_0x3ac862){return function(_0xb2eddd){if(_0xb2eddd){return _0xb2eddd[_0xc09a('0x25')]()[_0xc09a('0x24')](function(){var _0x53f41e=_0xb2eddd[_0xc09a('0x26')]({'plain':!![]});var _0x2bf323=_0xc09a('0x27');return db['UserProfileResource'][_0xc09a('0x25')]({'where':{'type':_0x2bf323,'resourceId':_0x53f41e['id']}})[_0xc09a('0x24')](function(){return _0xb2eddd;});})['then'](function(){_0x4284fe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x96482b,_0x5d8dff){return function(_0x5a9c40){if(!_0x5a9c40){_0x96482b[_0xc09a('0x28')](0x194);}return _0x5a9c40;};}function handleError(_0x4e8e5d,_0x4741a5){_0x4741a5=_0x4741a5||0x1f4;return function(_0x5cc573){logger[_0xc09a('0x29')](_0x5cc573[_0xc09a('0x2a')]);if(_0x5cc573[_0xc09a('0x2b')]){delete _0x5cc573[_0xc09a('0x2b')];}_0x4e8e5d[_0xc09a('0x19')](_0x4741a5)[_0xc09a('0x2c')](_0x5cc573);};}exports[_0xc09a('0x2d')]=function(_0x4f8271,_0x4935f0){var _0x17c798={},_0x1d705a={},_0x41e1b1={'count':0x0,'rows':[]};var _0x468378=_[_0xc09a('0x2e')](db[_0xc09a('0x2f')]['rawAttributes'],function(_0x5642cd){return{'name':_0x5642cd['fieldName'],'type':_0x5642cd['type'][_0xc09a('0x30')]};});_0x1d705a[_0xc09a('0x31')]=_['map'](_0x468378,_0xc09a('0x2b'));_0x1d705a[_0xc09a('0x32')]=_[_0xc09a('0x33')](_0x4f8271[_0xc09a('0x32')]);_0x1d705a[_0xc09a('0x34')]=_['intersection'](_0x1d705a['model'],_0x1d705a['query']);_0x17c798[_0xc09a('0x35')]=_[_0xc09a('0x36')](_0x1d705a[_0xc09a('0x31')],qs['fields'](_0x4f8271[_0xc09a('0x32')]['fields']));_0x17c798['attributes']=_0x17c798[_0xc09a('0x35')]['length']?_0x17c798[_0xc09a('0x35')]:_0x1d705a[_0xc09a('0x31')];if(!_0x4f8271[_0xc09a('0x32')][_0xc09a('0x37')](_0xc09a('0x38'))){_0x17c798[_0xc09a('0x1e')]=qs[_0xc09a('0x1e')](_0x4f8271[_0xc09a('0x32')][_0xc09a('0x1e')]);_0x17c798[_0xc09a('0x1d')]=qs[_0xc09a('0x1d')](_0x4f8271[_0xc09a('0x32')][_0xc09a('0x1d')]);}_0x17c798[_0xc09a('0x39')]=qs['sort'](_0x4f8271[_0xc09a('0x32')]['sort']);_0x17c798[_0xc09a('0x3a')]=qs['filters'](_[_0xc09a('0x3b')](_0x4f8271[_0xc09a('0x32')],_0x1d705a[_0xc09a('0x34')]),_0x468378);if(_0x4f8271[_0xc09a('0x32')][_0xc09a('0x3c')]){_0x17c798[_0xc09a('0x3a')]=_[_0xc09a('0x3d')](_0x17c798['where'],{'$or':_[_0xc09a('0x2e')](_0x468378,function(_0x51f608){if(_0x51f608[_0xc09a('0x3e')]!==_0xc09a('0x3f')){var _0xcc4079={};_0xcc4079[_0x51f608[_0xc09a('0x2b')]]={'$like':'%'+_0x4f8271[_0xc09a('0x32')]['filter']+'%'};return _0xcc4079;}})});}_0x17c798=_[_0xc09a('0x3d')]({},_0x17c798,_0x4f8271['options']);var _0x30b27a={'where':_0x17c798[_0xc09a('0x3a')]};return db[_0xc09a('0x2f')][_0xc09a('0x1c')](_0x30b27a)[_0xc09a('0x24')](function(_0x3321fb){_0x41e1b1[_0xc09a('0x1c')]=_0x3321fb;if(_0x4f8271[_0xc09a('0x32')][_0xc09a('0x40')]){_0x17c798[_0xc09a('0x41')]=[{'all':!![]}];}return db[_0xc09a('0x2f')]['findAll'](_0x17c798);})[_0xc09a('0x24')](function(_0x32a71b){_0x41e1b1[_0xc09a('0x42')]=_0x32a71b;return _0x41e1b1;})['then'](respondWithFilteredResult(_0x4935f0,_0x17c798))[_0xc09a('0x43')](handleError(_0x4935f0,null));};exports[_0xc09a('0x44')]=function(_0x357815,_0x17df5f){var _0x9b56d1={'raw':!![],'where':{'id':_0x357815[_0xc09a('0x45')]['id']}},_0x5aa89b={};_0x5aa89b[_0xc09a('0x31')]=_[_0xc09a('0x33')](db[_0xc09a('0x2f')][_0xc09a('0x46')]);_0x5aa89b[_0xc09a('0x32')]=_[_0xc09a('0x33')](_0x357815[_0xc09a('0x32')]);_0x5aa89b[_0xc09a('0x34')]=_['intersection'](_0x5aa89b['model'],_0x5aa89b[_0xc09a('0x32')]);_0x9b56d1[_0xc09a('0x35')]=_[_0xc09a('0x36')](_0x5aa89b[_0xc09a('0x31')],qs[_0xc09a('0x47')](_0x357815['query'][_0xc09a('0x47')]));_0x9b56d1[_0xc09a('0x35')]=_0x9b56d1['attributes'][_0xc09a('0x48')]?_0x9b56d1[_0xc09a('0x35')]:_0x5aa89b[_0xc09a('0x31')];if(_0x357815[_0xc09a('0x32')][_0xc09a('0x40')]){_0x9b56d1['include']=[{'all':!![]}];}_0x9b56d1=_[_0xc09a('0x3d')]({},_0x9b56d1,_0x357815[_0xc09a('0x49')]);return db[_0xc09a('0x2f')][_0xc09a('0x4a')](_0x9b56d1)['then'](handleEntityNotFound(_0x17df5f,null))['then'](respondWithResult(_0x17df5f,null))[_0xc09a('0x43')](handleError(_0x17df5f,null));};exports[_0xc09a('0x23')]=function(_0x5ec823,_0x2faae6){if(_0x5ec823['body']['id']){delete _0x5ec823[_0xc09a('0x4b')]['id'];}return db[_0xc09a('0x2f')][_0xc09a('0x4a')]({'where':{'id':_0x5ec823[_0xc09a('0x45')]['id']}})[_0xc09a('0x24')](handleEntityNotFound(_0x2faae6,null))[_0xc09a('0x24')](saveUpdates(_0x5ec823[_0xc09a('0x4b')],null))[_0xc09a('0x24')](respondWithResult(_0x2faae6,null))[_0xc09a('0x43')](handleError(_0x2faae6,null));};exports[_0xc09a('0x25')]=function(_0x114ac8,_0x33352f){return db[_0xc09a('0x2f')]['find']({'where':{'id':_0x114ac8[_0xc09a('0x45')]['id']}})['then'](handleEntityNotFound(_0x33352f,null))[_0xc09a('0x24')](removeEntity(_0x33352f,null))['catch'](handleError(_0x33352f,null));};exports['create']=function(_0x4cfb97,_0xc2420f){var _0x1b2838={'key':_0x4cfb97[_0xc09a('0x4b')][_0xc09a('0x30')]};if(_0x4cfb97['body']['MailAccountId']){_0x1b2838[_0xc09a('0x4c')]=_0x4cfb97[_0xc09a('0x4b')]['MailAccountId'];}else if(_0x4cfb97[_0xc09a('0x4b')]['SmsAccountId']){_0x1b2838[_0xc09a('0x4d')]=_0x4cfb97[_0xc09a('0x4b')][_0xc09a('0x4d')];}else if(_0x4cfb97[_0xc09a('0x4b')][_0xc09a('0x4e')]){_0x1b2838['OpenchannelAccountId']=_0x4cfb97[_0xc09a('0x4b')][_0xc09a('0x4e')];}else if(_0x4cfb97['body']['ChatWebsiteId']){_0x1b2838[_0xc09a('0x4f')]=_0x4cfb97[_0xc09a('0x4b')]['ChatWebsiteId'];}return db[_0xc09a('0x2f')][_0xc09a('0x4a')]({'where':_0x1b2838})[_0xc09a('0x24')](function(_0xca74e7){if(_0xca74e7){throw new db[(_0xc09a('0x50'))][(_0xc09a('0x51'))](_0xc09a('0x52'));}return db[_0xc09a('0x2f')][_0xc09a('0x53')](_0x4cfb97[_0xc09a('0x4b')]);})[_0xc09a('0x24')](function(_0x3c38d8){var _0x29bee3=_0x4cfb97[_0xc09a('0x54')][_0xc09a('0x26')]({'plain':!![]});if(!_0x29bee3)throw new Error(_0xc09a('0x55'));if(_0x29bee3[_0xc09a('0x56')]==='user'){var _0x3ec638=_0x3c38d8[_0xc09a('0x26')]({'plain':!![]});return db[_0xc09a('0x57')][_0xc09a('0x4a')]({'where':{'name':_0xc09a('0x27'),'userProfileId':_0x29bee3['userProfileId']},'raw':!![]})[_0xc09a('0x24')](function(_0xbbc7cb){if(_0xbbc7cb&&_0xbbc7cb[_0xc09a('0x58')]===0x0){return db[_0xc09a('0x59')]['create']({'name':_0x3ec638['name'],'resourceId':_0x3ec638['id'],'type':_0xbbc7cb['name'],'sectionId':_0xbbc7cb['id']},{})['then'](function(){return _0x3c38d8;});}else{return _0x3c38d8;}})['catch'](function(_0x1be892){logger[_0xc09a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1be892);throw _0x1be892;});}return _0x3c38d8;})[_0xc09a('0x24')](respondWithResult(_0xc2420f,0xc9))['catch'](handleError(_0xc2420f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d87b614..457fe77 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 _0x2036=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x176ae1,_0x22de6f){var _0x114a01=function(_0x1dc93e){while(--_0x1dc93e){_0x176ae1['push'](_0x176ae1['shift']());}};_0x114a01(++_0x22de6f);}(_0x2036,0x19a));var _0x6203=function(_0x3bf0b2,_0x271310){_0x3bf0b2=_0x3bf0b2-0x0;var _0x63ad3d=_0x2036[_0x3bf0b2];return _0x63ad3d;};'use strict';var _=require(_0x6203('0x0'));var util=require(_0x6203('0x1'));var logger=require(_0x6203('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6203('0x3'));var fs=require('fs');var path=require(_0x6203('0x4'));var rimraf=require(_0x6203('0x5'));var config=require(_0x6203('0x6'));var attributes=require(_0x6203('0x7'));module[_0x6203('0x8')]=function(_0x444d4e,_0x4c50ac){return _0x444d4e[_0x6203('0x9')](_0x6203('0xa'),attributes,{'tableName':_0x6203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6203('0xc'),'collate':_0x6203('0xd')});}; \ No newline at end of file +var _0x8583=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x407a3e,_0x15acb0){var _0x129fe3=function(_0x124c2f){while(--_0x124c2f){_0x407a3e['push'](_0x407a3e['shift']());}};_0x129fe3(++_0x15acb0);}(_0x8583,0x183));var _0x3858=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8583[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3858('0x0'));var util=require(_0x3858('0x1'));var logger=require(_0x3858('0x2'))('api');var moment=require(_0x3858('0x3'));var BPromise=require(_0x3858('0x4'));var rp=require(_0x3858('0x5'));var fs=require('fs');var path=require(_0x3858('0x6'));var rimraf=require(_0x3858('0x7'));var config=require(_0x3858('0x8'));var attributes=require(_0x3858('0x9'));module[_0x3858('0xa')]=function(_0x2dd673,_0x1796ef){return _0x2dd673[_0x3858('0xb')](_0x3858('0xc'),attributes,{'tableName':_0x3858('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3858('0xe'),'collate':_0x3858('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f0fe35f..13be95c 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 _0xa185=['debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','CannedAnswer,\x20%s,\x20%s','request\x20sent'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xa185,0xcb));var _0x5a18=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa185[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5a18('0x0'));var util=require(_0x5a18('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5a18('0x2'));var fs=require('fs');var Redis=require(_0x5a18('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a18('0x4'));var logger=require(_0x5a18('0x5'))('rpc');var config=require(_0x5a18('0x6'));var jayson=require(_0x5a18('0x7'));var client=jayson[_0x5a18('0x8')][_0x5a18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15c4bb,_0x67a537,_0x496b30){return new BPromise(function(_0x682001,_0x4f5c5c){return client[_0x5a18('0xa')](_0x15c4bb,_0x496b30)['then'](function(_0x2c3806){logger['info'](_0x5a18('0xb'),_0x67a537,_0x5a18('0xc'));logger[_0x5a18('0xd')](_0x5a18('0xe'),_0x67a537,_0x5a18('0xc'),JSON['stringify'](_0x2c3806));if(_0x2c3806['error']){if(_0x2c3806[_0x5a18('0xf')]['code']===0x1f4){logger[_0x5a18('0xf')](_0x5a18('0xb'),_0x67a537,_0x2c3806[_0x5a18('0xf')][_0x5a18('0x10')]);return _0x4f5c5c(_0x2c3806[_0x5a18('0xf')][_0x5a18('0x10')]);}logger[_0x5a18('0xf')](_0x5a18('0xb'),_0x67a537,_0x2c3806['error'][_0x5a18('0x10')]);return _0x682001(_0x2c3806[_0x5a18('0xf')][_0x5a18('0x10')]);}else{logger['info'](_0x5a18('0xb'),_0x67a537,_0x5a18('0xc'));_0x682001(_0x2c3806[_0x5a18('0x11')][_0x5a18('0x10')]);}})['catch'](function(_0x3a2ba3){logger[_0x5a18('0xf')](_0x5a18('0xb'),_0x67a537,_0x3a2ba3);_0x4f5c5c(_0x3a2ba3);});});} \ No newline at end of file +var _0x2824=['client','request','then','info','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2bd943,_0x1277c5){var _0x3e1675=function(_0x5197a6){while(--_0x5197a6){_0x2bd943['push'](_0x2bd943['shift']());}};_0x3e1675(++_0x1277c5);}(_0x2824,0x162));var _0x4282=function(_0x58b810,_0x2b346d){_0x58b810=_0x58b810-0x0;var _0x3b0ff5=_0x2824[_0x58b810];return _0x3b0ff5;};'use strict';var _=require(_0x4282('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4282('0x1'));var db=require(_0x4282('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4282('0x3'))(_0x4282('0x4'));var config=require(_0x4282('0x5'));var jayson=require(_0x4282('0x6'));var client=jayson[_0x4282('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x285d43,_0x4bb105,_0x50abe7){return new BPromise(function(_0x5119a5,_0x5617aa){return client[_0x4282('0x8')](_0x285d43,_0x50abe7)[_0x4282('0x9')](function(_0x29be8e){logger[_0x4282('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x4bb105,_0x4282('0xb'));logger['debug'](_0x4282('0xc'),_0x4bb105,'request\x20sent',JSON[_0x4282('0xd')](_0x29be8e));if(_0x29be8e[_0x4282('0xe')]){if(_0x29be8e[_0x4282('0xe')]['code']===0x1f4){logger[_0x4282('0xe')](_0x4282('0xf'),_0x4bb105,_0x29be8e[_0x4282('0xe')]['message']);return _0x5617aa(_0x29be8e['error']['message']);}logger[_0x4282('0xe')](_0x4282('0xf'),_0x4bb105,_0x29be8e['error'][_0x4282('0x10')]);return _0x5119a5(_0x29be8e['error']['message']);}else{logger['info'](_0x4282('0xf'),_0x4bb105,_0x4282('0xb'));_0x5119a5(_0x29be8e[_0x4282('0x11')][_0x4282('0x10')]);}})[_0x4282('0x12')](function(_0x5bed03){logger[_0x4282('0xe')](_0x4282('0xf'),_0x4bb105,_0x5bed03);_0x5617aa(_0x5bed03);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index cf07f04..9e349aa 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 _0x3bf5=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','/:id'];(function(_0x2dcd34,_0x532156){var _0x40a22f=function(_0x2c7023){while(--_0x2c7023){_0x2dcd34['push'](_0x2dcd34['shift']());}};_0x40a22f(++_0x532156);}(_0x3bf5,0x17e));var _0x53bf=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x3bf5[_0x387dc1];return _0x17567c;};'use strict';var multer=require(_0x53bf('0x0'));var util=require(_0x53bf('0x1'));var path=require('path');var timeout=require(_0x53bf('0x2'));var express=require(_0x53bf('0x3'));var router=express['Router']();var auth=require(_0x53bf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x53bf('0x5'));router[_0x53bf('0x6')]('/',auth[_0x53bf('0x7')](),controller['index']);router['get'](_0x53bf('0x8'),auth[_0x53bf('0x7')](),controller[_0x53bf('0x9')]);router[_0x53bf('0xa')]('/',auth['isAuthenticated'](),controller[_0x53bf('0xb')]);router[_0x53bf('0xc')](_0x53bf('0x8'),auth['isAuthenticated'](),controller[_0x53bf('0xd')]);router[_0x53bf('0xe')]('/:id',auth[_0x53bf('0x7')](),controller[_0x53bf('0xf')]);module[_0x53bf('0x10')]=router; \ No newline at end of file +var _0xf2f6=['create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','show','post'];(function(_0x20727a,_0x28e070){var _0xc3c99c=function(_0x127ef3){while(--_0x127ef3){_0x20727a['push'](_0x20727a['shift']());}};_0xc3c99c(++_0x28e070);}(_0xf2f6,0x1f4));var _0x6f2f=function(_0x4c2efb,_0x7ec9db){_0x4c2efb=_0x4c2efb-0x0;var _0xc41318=_0xf2f6[_0x4c2efb];return _0xc41318;};'use strict';var multer=require(_0x6f2f('0x0'));var util=require('util');var path=require(_0x6f2f('0x1'));var timeout=require(_0x6f2f('0x2'));var express=require(_0x6f2f('0x3'));var router=express[_0x6f2f('0x4')]();var auth=require(_0x6f2f('0x5'));var interaction=require(_0x6f2f('0x6'));var config=require('../../config/environment');var controller=require(_0x6f2f('0x7'));router[_0x6f2f('0x8')]('/',auth[_0x6f2f('0x9')](),controller[_0x6f2f('0xa')]);router['get']('/:id',auth[_0x6f2f('0x9')](),controller[_0x6f2f('0xb')]);router[_0x6f2f('0xc')]('/',auth[_0x6f2f('0x9')](),controller[_0x6f2f('0xd')]);router[_0x6f2f('0xe')](_0x6f2f('0xf'),auth[_0x6f2f('0x9')](),controller[_0x6f2f('0x10')]);router['delete'](_0x6f2f('0xf'),auth['isAuthenticated'](),controller[_0x6f2f('0x11')]);module[_0x6f2f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c5621c0..91be06c 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 _0xbbee=['INTEGER','sequelize','exports','STRING'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xbbee,0x121));var _0xebbe=function(_0x3129ae,_0x8606e0){_0x3129ae=_0x3129ae-0x0;var _0x3c3006=_0xbbee[_0x3129ae];return _0x3c3006;};'use strict';var Sequelize=require(_0xebbe('0x0'));module[_0xebbe('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xebbe('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xebbe('0x2')]},'dcontext':{'type':Sequelize[_0xebbe('0x2')]},'channel':{'type':Sequelize[_0xebbe('0x2')]},'dstchannel':{'type':Sequelize[_0xebbe('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xebbe('0x2')]},'duration':{'type':Sequelize[_0xebbe('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xebbe('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xebbe('0x2')]},'amaflags':{'type':Sequelize[_0xebbe('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xebbe('0x2')]},'userfield':{'type':Sequelize[_0xebbe('0x2')]},'uniqueid':{'type':Sequelize[_0xebbe('0x2')]},'linkedid':{'type':Sequelize[_0xebbe('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xebbe('0x2')]},'type':{'type':Sequelize[_0xebbe('0x2')]},'tag':{'type':Sequelize[_0xebbe('0x2')]}}; \ No newline at end of file +var _0xa31e=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0xa31e,0x16c));var _0xea31=function(_0x35f15b,_0x387db3){_0x35f15b=_0x35f15b-0x0;var _0x262619=_0xa31e[_0x35f15b];return _0x262619;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xea31('0x0')],'allowNull':![],'defaultValue':_0xea31('0x1')},'clid':{'type':Sequelize[_0xea31('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xea31('0x2')]},'channel':{'type':Sequelize[_0xea31('0x2')]},'dstchannel':{'type':Sequelize[_0xea31('0x2')]},'lastapp':{'type':Sequelize[_0xea31('0x2')]},'lastdata':{'type':Sequelize[_0xea31('0x2')]},'duration':{'type':Sequelize[_0xea31('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xea31('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xea31('0x2')]},'amaflags':{'type':Sequelize[_0xea31('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xea31('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xea31('0x2')]},'linkedid':{'type':Sequelize[_0xea31('0x2')]},'sequence':{'type':Sequelize[_0xea31('0x2')]},'peeraccount':{'type':Sequelize[_0xea31('0x2')]},'type':{'type':Sequelize[_0xea31('0x2')]},'tag':{'type':Sequelize[_0xea31('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index c9d407c..735901e 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 _0x071b=['VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','update','destroy','then','name','index','map','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x071b,0x17c));var _0xb071=function(_0x56130d,_0x19c01d){_0x56130d=_0x56130d-0x0;var _0x5ca509=_0x071b[_0x56130d];return _0x5ca509;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb071('0x0'));var rimraf=require(_0xb071('0x1'));var zipdir=require(_0xb071('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb071('0x3'));var moment=require(_0xb071('0x4'));var BPromise=require(_0xb071('0x5'));var Mustache=require(_0xb071('0x6'));var util=require(_0xb071('0x7'));var path=require('path');var sox=require(_0xb071('0x8'));var csv=require(_0xb071('0x9'));var ejs=require(_0xb071('0xa'));var fs=require('fs');var _=require(_0xb071('0xb'));var squel=require(_0xb071('0xc'));var crypto=require('crypto');var jsforce=require(_0xb071('0xd'));var deskjs=require(_0xb071('0xe'));var toCsv=require(_0xb071('0x9'));var querystring=require(_0xb071('0xf'));var Papa=require(_0xb071('0x10'));var Redis=require(_0xb071('0x11'));var authService=require(_0xb071('0x12'));var qs=require(_0xb071('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb071('0x14'))(_0xb071('0x15'));var utils=require(_0xb071('0x16'));var config=require(_0xb071('0x17'));var db=require(_0xb071('0x18'))['db'];function respondWithStatusCode(_0x420408,_0x2fe5f1){_0x2fe5f1=_0x2fe5f1||0xcc;return function(_0x47138f){if(_0x47138f){return _0x420408[_0xb071('0x19')](_0x2fe5f1);}return _0x420408[_0xb071('0x1a')](_0x2fe5f1)[_0xb071('0x1b')]();};}function respondWithResult(_0x264cd2,_0x37a3bd){_0x37a3bd=_0x37a3bd||0xc8;return function(_0x3d4df6){if(_0x3d4df6){return _0x264cd2['status'](_0x37a3bd)[_0xb071('0x1c')](_0x3d4df6);}};}function respondWithFilteredResult(_0x108288,_0xe5c149){return function(_0x41f11e){if(_0x41f11e){var _0x5b684f=_0x41f11e[_0xb071('0x1d')],_0x1d105c=_0xe5c149[_0xb071('0x1e')],_0x36bc86=_0xe5c149['offset']+_0xe5c149['limit'],_0x281aef;if(_0x36bc86>=_0x5b684f){_0x36bc86=_0x5b684f;_0x281aef=0xc8;}else{_0x281aef=0xce;}_0x108288[_0xb071('0x1a')](_0x281aef);return _0x108288['set'](_0xb071('0x1f'),_0x1d105c+'-'+_0x36bc86+'/'+_0x5b684f)[_0xb071('0x1c')](_0x41f11e);}return null;};}function patchUpdates(_0x1aa8b0){return function(_0x22280a){try{jsonpatch['apply'](_0x22280a,_0x1aa8b0,!![]);}catch(_0x4fe488){return BPromise[_0xb071('0x20')](_0x4fe488);}return _0x22280a['save']();};}function saveUpdates(_0xcab999,_0x15a65c){return function(_0x58cd25){if(_0x58cd25){return _0x58cd25[_0xb071('0x21')](_0xcab999)['then'](function(_0x18dc39){return _0x18dc39;});}return null;};}function removeEntity(_0x1534cb,_0x70dc2f){return function(_0x3d6dc){if(_0x3d6dc){return _0x3d6dc[_0xb071('0x22')]()[_0xb071('0x23')](function(){_0x1534cb[_0xb071('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e869f,_0x120f8e){return function(_0x2fca30){if(!_0x2fca30){_0x1e869f[_0xb071('0x19')](0x194);}return _0x2fca30;};}function handleError(_0x59210b,_0x4d0275){_0x4d0275=_0x4d0275||0x1f4;return function(_0x1c9274){logger['error'](_0x1c9274['stack']);if(_0x1c9274[_0xb071('0x24')]){delete _0x1c9274[_0xb071('0x24')];}_0x59210b['status'](_0x4d0275)['send'](_0x1c9274);};}exports[_0xb071('0x25')]=function(_0x26bfc5,_0x5b9746){var _0x2de0ad={},_0x39a8f3={},_0x3fd330={'count':0x0,'rows':[]};var _0x50d5c8=_[_0xb071('0x26')](db['Cdr']['rawAttributes'],function(_0x358a9d){return{'name':_0x358a9d[_0xb071('0x27')],'type':_0x358a9d['type'][_0xb071('0x28')]};});_0x39a8f3['model']=_[_0xb071('0x26')](_0x50d5c8,_0xb071('0x24'));_0x39a8f3[_0xb071('0x29')]=_['keys'](_0x26bfc5[_0xb071('0x29')]);_0x39a8f3[_0xb071('0x2a')]=_[_0xb071('0x2b')](_0x39a8f3['model'],_0x39a8f3['query']);_0x2de0ad[_0xb071('0x2c')]=_[_0xb071('0x2b')](_0x39a8f3[_0xb071('0x2d')],qs[_0xb071('0x2e')](_0x26bfc5[_0xb071('0x29')][_0xb071('0x2e')]));_0x2de0ad[_0xb071('0x2c')]=_0x2de0ad[_0xb071('0x2c')][_0xb071('0x2f')]?_0x2de0ad['attributes']:_0x39a8f3['model'];if(!_0x26bfc5[_0xb071('0x29')][_0xb071('0x30')](_0xb071('0x31'))){_0x2de0ad[_0xb071('0x32')]=qs['limit'](_0x26bfc5[_0xb071('0x29')][_0xb071('0x32')]);_0x2de0ad['offset']=qs[_0xb071('0x1e')](_0x26bfc5[_0xb071('0x29')][_0xb071('0x1e')]);}_0x2de0ad[_0xb071('0x33')]=qs[_0xb071('0x34')](_0x26bfc5[_0xb071('0x29')][_0xb071('0x34')]);_0x2de0ad['where']=qs[_0xb071('0x2a')](_[_0xb071('0x35')](_0x26bfc5[_0xb071('0x29')],_0x39a8f3[_0xb071('0x2a')]),_0x50d5c8);if(_0x26bfc5[_0xb071('0x29')][_0xb071('0x36')]){_0x2de0ad[_0xb071('0x37')]=_[_0xb071('0x38')](_0x2de0ad[_0xb071('0x37')],{'$or':_['map'](_0x50d5c8,function(_0x185a99){if(_0x185a99[_0xb071('0x39')]!==_0xb071('0x3a')){var _0x49d79b={};_0x49d79b[_0x185a99['name']]={'$like':'%'+_0x26bfc5['query'][_0xb071('0x36')]+'%'};return _0x49d79b;}})});}_0x2de0ad=_[_0xb071('0x38')]({},_0x2de0ad,_0x26bfc5[_0xb071('0x3b')]);var _0x1cd6b9={'where':_0x2de0ad[_0xb071('0x37')]};return db[_0xb071('0x3c')][_0xb071('0x1d')](_0x1cd6b9)[_0xb071('0x23')](function(_0x5313e7){_0x3fd330[_0xb071('0x1d')]=_0x5313e7;if(_0x26bfc5[_0xb071('0x29')][_0xb071('0x3d')]){_0x2de0ad[_0xb071('0x3e')]=[{'all':!![]}];}return db[_0xb071('0x3c')][_0xb071('0x3f')](_0x2de0ad);})[_0xb071('0x23')](function(_0x4c385c){_0x3fd330[_0xb071('0x40')]=_0x4c385c;return _0x3fd330;})[_0xb071('0x23')](respondWithFilteredResult(_0x5b9746,_0x2de0ad))[_0xb071('0x41')](handleError(_0x5b9746,null));};exports[_0xb071('0x42')]=function(_0x3b1a70,_0x96f26){var _0x3cb2ed={'raw':!![],'where':{'id':_0x3b1a70[_0xb071('0x43')]['id']}},_0x2feb8e={};_0x2feb8e[_0xb071('0x2d')]=_[_0xb071('0x44')](db[_0xb071('0x3c')]['rawAttributes']);_0x2feb8e[_0xb071('0x29')]=_[_0xb071('0x44')](_0x3b1a70[_0xb071('0x29')]);_0x2feb8e[_0xb071('0x2a')]=_[_0xb071('0x2b')](_0x2feb8e[_0xb071('0x2d')],_0x2feb8e[_0xb071('0x29')]);_0x3cb2ed[_0xb071('0x2c')]=_['intersection'](_0x2feb8e['model'],qs['fields'](_0x3b1a70['query'][_0xb071('0x2e')]));_0x3cb2ed[_0xb071('0x2c')]=_0x3cb2ed[_0xb071('0x2c')][_0xb071('0x2f')]?_0x3cb2ed[_0xb071('0x2c')]:_0x2feb8e['model'];if(_0x3b1a70['query'][_0xb071('0x3d')]){_0x3cb2ed[_0xb071('0x3e')]=[{'all':!![]}];}_0x3cb2ed=_[_0xb071('0x38')]({},_0x3cb2ed,_0x3b1a70[_0xb071('0x3b')]);return db['Cdr'][_0xb071('0x45')](_0x3cb2ed)['then'](handleEntityNotFound(_0x96f26,null))['then'](respondWithResult(_0x96f26,null))['catch'](handleError(_0x96f26,null));};exports[_0xb071('0x46')]=function(_0x194aa9,_0x6a0c18){return db[_0xb071('0x3c')][_0xb071('0x46')](_0x194aa9['body'],{})[_0xb071('0x23')](respondWithResult(_0x6a0c18,0xc9))[_0xb071('0x41')](handleError(_0x6a0c18,null));};exports['update']=function(_0x1b8eaa,_0x4da049){if(_0x1b8eaa[_0xb071('0x47')]['id']){delete _0x1b8eaa[_0xb071('0x47')]['id'];}return db[_0xb071('0x3c')][_0xb071('0x45')]({'where':{'id':_0x1b8eaa[_0xb071('0x43')]['id']}})[_0xb071('0x23')](handleEntityNotFound(_0x4da049,null))[_0xb071('0x23')](saveUpdates(_0x1b8eaa[_0xb071('0x47')],null))[_0xb071('0x23')](respondWithResult(_0x4da049,null))[_0xb071('0x41')](handleError(_0x4da049,null));};exports['destroy']=function(_0x582831,_0x1a5d3e){return db['Cdr'][_0xb071('0x45')]({'where':{'id':_0x582831[_0xb071('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a5d3e,null))['then'](removeEntity(_0x1a5d3e,null))['catch'](handleError(_0x1a5d3e,null));};exports[_0xb071('0x48')]=function(_0x22e6ad,_0x1011b3){return db['Cdr'][_0xb071('0x48')]()['then'](respondWithResult(_0x1011b3,null))['catch'](handleError(_0x1011b3,null));}; \ No newline at end of file +var _0x5390=['api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','Cdr','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3d8aab,_0xb7ca60){var _0x285a14=function(_0x2f2a5b){while(--_0x2f2a5b){_0x3d8aab['push'](_0x3d8aab['shift']());}};_0x285a14(++_0xb7ca60);}(_0x5390,0x81));var _0x0539=function(_0x4abef4,_0x3ff59d){_0x4abef4=_0x4abef4-0x0;var _0x21932d=_0x5390[_0x4abef4];return _0x21932d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0539('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0539('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0539('0x2'));var moment=require('moment');var BPromise=require(_0x0539('0x3'));var Mustache=require(_0x0539('0x4'));var util=require(_0x0539('0x5'));var path=require(_0x0539('0x6'));var sox=require('sox');var csv=require(_0x0539('0x7'));var ejs=require(_0x0539('0x8'));var fs=require('fs');var _=require(_0x0539('0x9'));var squel=require(_0x0539('0xa'));var crypto=require(_0x0539('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0539('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0539('0xd'));var Papa=require(_0x0539('0xe'));var Redis=require(_0x0539('0xf'));var authService=require(_0x0539('0x10'));var qs=require(_0x0539('0x11'));var as=require(_0x0539('0x12'));var hardwareService=require(_0x0539('0x13'));var logger=require(_0x0539('0x14'))(_0x0539('0x15'));var utils=require(_0x0539('0x16'));var config=require('../../config/environment');var db=require(_0x0539('0x17'))['db'];function respondWithStatusCode(_0xb067f9,_0x13f1cd){_0x13f1cd=_0x13f1cd||0xcc;return function(_0x7591c0){if(_0x7591c0){return _0xb067f9[_0x0539('0x18')](_0x13f1cd);}return _0xb067f9[_0x0539('0x19')](_0x13f1cd)[_0x0539('0x1a')]();};}function respondWithResult(_0x427f51,_0x4a9fa3){_0x4a9fa3=_0x4a9fa3||0xc8;return function(_0x466f85){if(_0x466f85){return _0x427f51['status'](_0x4a9fa3)['json'](_0x466f85);}};}function respondWithFilteredResult(_0x4c1f54,_0x3f089f){return function(_0x31ef88){if(_0x31ef88){var _0x57dd8a=_0x31ef88[_0x0539('0x1b')],_0xec7fb7=_0x3f089f[_0x0539('0x1c')],_0x565776=_0x3f089f[_0x0539('0x1c')]+_0x3f089f[_0x0539('0x1d')],_0x2f2797;if(_0x565776>=_0x57dd8a){_0x565776=_0x57dd8a;_0x2f2797=0xc8;}else{_0x2f2797=0xce;}_0x4c1f54[_0x0539('0x19')](_0x2f2797);return _0x4c1f54[_0x0539('0x1e')](_0x0539('0x1f'),_0xec7fb7+'-'+_0x565776+'/'+_0x57dd8a)[_0x0539('0x20')](_0x31ef88);}return null;};}function patchUpdates(_0x12e1d7){return function(_0x1c263f){try{jsonpatch[_0x0539('0x21')](_0x1c263f,_0x12e1d7,!![]);}catch(_0x271429){return BPromise[_0x0539('0x22')](_0x271429);}return _0x1c263f[_0x0539('0x23')]();};}function saveUpdates(_0x445b2c,_0x3b05f8){return function(_0x226505){if(_0x226505){return _0x226505[_0x0539('0x24')](_0x445b2c)[_0x0539('0x25')](function(_0x4232b3){return _0x4232b3;});}return null;};}function removeEntity(_0x2d25,_0x1b0b33){return function(_0x59ad19){if(_0x59ad19){return _0x59ad19['destroy']()['then'](function(){_0x2d25[_0x0539('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d49b3,_0xc3e611){return function(_0x378bac){if(!_0x378bac){_0x4d49b3[_0x0539('0x18')](0x194);}return _0x378bac;};}function handleError(_0x4c5afe,_0x446e39){_0x446e39=_0x446e39||0x1f4;return function(_0x258e16){logger[_0x0539('0x26')](_0x258e16[_0x0539('0x27')]);if(_0x258e16[_0x0539('0x28')]){delete _0x258e16[_0x0539('0x28')];}_0x4c5afe[_0x0539('0x19')](_0x446e39)['send'](_0x258e16);};}exports[_0x0539('0x29')]=function(_0x35a9d3,_0x464755){var _0x46eae9={},_0x2b53a8={},_0x38d260={'count':0x0,'rows':[]};var _0x238959=_[_0x0539('0x2a')](db[_0x0539('0x2b')][_0x0539('0x2c')],function(_0x31e5b3){return{'name':_0x31e5b3[_0x0539('0x2d')],'type':_0x31e5b3['type'][_0x0539('0x2e')]};});_0x2b53a8['model']=_['map'](_0x238959,_0x0539('0x28'));_0x2b53a8[_0x0539('0x2f')]=_[_0x0539('0x30')](_0x35a9d3[_0x0539('0x2f')]);_0x2b53a8[_0x0539('0x31')]=_[_0x0539('0x32')](_0x2b53a8[_0x0539('0x33')],_0x2b53a8[_0x0539('0x2f')]);_0x46eae9['attributes']=_[_0x0539('0x32')](_0x2b53a8[_0x0539('0x33')],qs[_0x0539('0x34')](_0x35a9d3[_0x0539('0x2f')][_0x0539('0x34')]));_0x46eae9[_0x0539('0x35')]=_0x46eae9[_0x0539('0x35')][_0x0539('0x36')]?_0x46eae9[_0x0539('0x35')]:_0x2b53a8[_0x0539('0x33')];if(!_0x35a9d3[_0x0539('0x2f')][_0x0539('0x37')]('nolimit')){_0x46eae9[_0x0539('0x1d')]=qs[_0x0539('0x1d')](_0x35a9d3[_0x0539('0x2f')][_0x0539('0x1d')]);_0x46eae9['offset']=qs[_0x0539('0x1c')](_0x35a9d3['query'][_0x0539('0x1c')]);}_0x46eae9[_0x0539('0x38')]=qs[_0x0539('0x39')](_0x35a9d3[_0x0539('0x2f')][_0x0539('0x39')]);_0x46eae9[_0x0539('0x3a')]=qs['filters'](_[_0x0539('0x3b')](_0x35a9d3[_0x0539('0x2f')],_0x2b53a8[_0x0539('0x31')]),_0x238959);if(_0x35a9d3[_0x0539('0x2f')]['filter']){_0x46eae9[_0x0539('0x3a')]=_[_0x0539('0x3c')](_0x46eae9['where'],{'$or':_[_0x0539('0x2a')](_0x238959,function(_0x39d7b7){if(_0x39d7b7[_0x0539('0x3d')]!==_0x0539('0x3e')){var _0x18a543={};_0x18a543[_0x39d7b7[_0x0539('0x28')]]={'$like':'%'+_0x35a9d3[_0x0539('0x2f')][_0x0539('0x3f')]+'%'};return _0x18a543;}})});}_0x46eae9=_[_0x0539('0x3c')]({},_0x46eae9,_0x35a9d3[_0x0539('0x40')]);var _0x2f90be={'where':_0x46eae9[_0x0539('0x3a')]};return db[_0x0539('0x2b')][_0x0539('0x1b')](_0x2f90be)['then'](function(_0x25ce20){_0x38d260[_0x0539('0x1b')]=_0x25ce20;if(_0x35a9d3[_0x0539('0x2f')][_0x0539('0x41')]){_0x46eae9[_0x0539('0x42')]=[{'all':!![]}];}return db[_0x0539('0x2b')][_0x0539('0x43')](_0x46eae9);})[_0x0539('0x25')](function(_0x5a702d){_0x38d260['rows']=_0x5a702d;return _0x38d260;})[_0x0539('0x25')](respondWithFilteredResult(_0x464755,_0x46eae9))[_0x0539('0x44')](handleError(_0x464755,null));};exports[_0x0539('0x45')]=function(_0x58d379,_0x38e3e9){var _0x264d8a={'raw':!![],'where':{'id':_0x58d379[_0x0539('0x46')]['id']}},_0x38e172={};_0x38e172[_0x0539('0x33')]=_[_0x0539('0x30')](db[_0x0539('0x2b')]['rawAttributes']);_0x38e172[_0x0539('0x2f')]=_[_0x0539('0x30')](_0x58d379[_0x0539('0x2f')]);_0x38e172[_0x0539('0x31')]=_[_0x0539('0x32')](_0x38e172[_0x0539('0x33')],_0x38e172['query']);_0x264d8a[_0x0539('0x35')]=_[_0x0539('0x32')](_0x38e172['model'],qs[_0x0539('0x34')](_0x58d379[_0x0539('0x2f')][_0x0539('0x34')]));_0x264d8a['attributes']=_0x264d8a[_0x0539('0x35')][_0x0539('0x36')]?_0x264d8a[_0x0539('0x35')]:_0x38e172[_0x0539('0x33')];if(_0x58d379['query']['includeAll']){_0x264d8a[_0x0539('0x42')]=[{'all':!![]}];}_0x264d8a=_[_0x0539('0x3c')]({},_0x264d8a,_0x58d379[_0x0539('0x40')]);return db[_0x0539('0x2b')][_0x0539('0x47')](_0x264d8a)[_0x0539('0x25')](handleEntityNotFound(_0x38e3e9,null))[_0x0539('0x25')](respondWithResult(_0x38e3e9,null))[_0x0539('0x44')](handleError(_0x38e3e9,null));};exports[_0x0539('0x48')]=function(_0x77052b,_0x3067e1){return db[_0x0539('0x2b')][_0x0539('0x48')](_0x77052b['body'],{})[_0x0539('0x25')](respondWithResult(_0x3067e1,0xc9))[_0x0539('0x44')](handleError(_0x3067e1,null));};exports[_0x0539('0x24')]=function(_0x5ecad9,_0x58d087){if(_0x5ecad9[_0x0539('0x49')]['id']){delete _0x5ecad9['body']['id'];}return db[_0x0539('0x2b')][_0x0539('0x47')]({'where':{'id':_0x5ecad9[_0x0539('0x46')]['id']}})[_0x0539('0x25')](handleEntityNotFound(_0x58d087,null))[_0x0539('0x25')](saveUpdates(_0x5ecad9[_0x0539('0x49')],null))[_0x0539('0x25')](respondWithResult(_0x58d087,null))[_0x0539('0x44')](handleError(_0x58d087,null));};exports[_0x0539('0x4a')]=function(_0x2869ca,_0x328dda){return db[_0x0539('0x2b')]['find']({'where':{'id':_0x2869ca[_0x0539('0x46')]['id']}})['then'](handleEntityNotFound(_0x328dda,null))[_0x0539('0x25')](removeEntity(_0x328dda,null))[_0x0539('0x44')](handleError(_0x328dda,null));};exports['describe']=function(_0x29c05e,_0x583729){return db['Cdr']['describe']()[_0x0539('0x25')](respondWithResult(_0x583729,null))[_0x0539('0x44')](handleError(_0x583729,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 70d689d..ef6b5dd 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 _0x90b1=['path','rimraf','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x279412,_0x11902b){var _0x5eb5ec=function(_0x547e4f){while(--_0x547e4f){_0x279412['push'](_0x279412['shift']());}};_0x5eb5ec(++_0x11902b);}(_0x90b1,0x1bb));var _0x190b=function(_0x28bc89,_0x1edcd4){_0x28bc89=_0x28bc89-0x0;var _0x31aaa2=_0x90b1[_0x28bc89];return _0x31aaa2;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['calldate']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]},{'name':_0x190b('0xd'),'fields':[_0x190b('0xd')]},{'name':_0x190b('0xe'),'fields':[_0x190b('0xe')]},{'name':_0x190b('0xf'),'fields':[_0x190b('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2ef3=['moment','bluebird','path','rimraf','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api'];(function(_0x578748,_0x7c54cd){var _0x3ae9bf=function(_0x2173aa){while(--_0x2173aa){_0x578748['push'](_0x578748['shift']());}};_0x3ae9bf(++_0x7c54cd);}(_0x2ef3,0xba));var _0x32ef=function(_0x26ec9a,_0x50ad49){_0x26ec9a=_0x26ec9a-0x0;var _0x40eaf6=_0x2ef3[_0x26ec9a];return _0x40eaf6;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]},{'name':_0x32ef('0xe'),'fields':[_0x32ef('0xe')]},{'name':_0x32ef('0xf'),'fields':[_0x32ef('0xf')]},{'name':_0x32ef('0x10'),'fields':['dst']},{'name':'src','fields':[_0x32ef('0x11')]},{'name':_0x32ef('0x12'),'fields':[_0x32ef('0x12')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ff2c0bd..20059cd 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 _0x17f6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','error','code','Cdr,\x20%s,\x20%s','message','info','result','catch','util','randomstring'];(function(_0x2e5388,_0x2227c1){var _0x40cf2f=function(_0x220a27){while(--_0x220a27){_0x2e5388['push'](_0x2e5388['shift']());}};_0x40cf2f(++_0x2227c1);}(_0x17f6,0x8a));var _0x617f=function(_0x525fa2,_0x3b974d){_0x525fa2=_0x525fa2-0x0;var _0x4f68c9=_0x17f6[_0x525fa2];return _0x4f68c9;};'use strict';var _=require('lodash');var util=require(_0x617f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x617f('0x1'));var fs=require('fs');var Redis=require(_0x617f('0x2'));var db=require(_0x617f('0x3'))['db'];var utils=require(_0x617f('0x4'));var logger=require(_0x617f('0x5'))(_0x617f('0x6'));var config=require('../../config/environment');var jayson=require(_0x617f('0x7'));var client=jayson[_0x617f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27013d,_0x365220,_0x318f6c){return new BPromise(function(_0x2f19df,_0x5f44fb){return client[_0x617f('0x9')](_0x27013d,_0x318f6c)[_0x617f('0xa')](function(_0x2f8a13){logger['info']('Cdr,\x20%s,\x20%s',_0x365220,_0x617f('0xb'));logger[_0x617f('0xc')]('Cdr,\x20%s,\x20%s,\x20%s',_0x365220,_0x617f('0xb'),JSON['stringify'](_0x2f8a13));if(_0x2f8a13[_0x617f('0xd')]){if(_0x2f8a13[_0x617f('0xd')][_0x617f('0xe')]===0x1f4){logger[_0x617f('0xd')](_0x617f('0xf'),_0x365220,_0x2f8a13[_0x617f('0xd')][_0x617f('0x10')]);return _0x5f44fb(_0x2f8a13['error'][_0x617f('0x10')]);}logger[_0x617f('0xd')](_0x617f('0xf'),_0x365220,_0x2f8a13['error']['message']);return _0x2f19df(_0x2f8a13['error'][_0x617f('0x10')]);}else{logger[_0x617f('0x11')](_0x617f('0xf'),_0x365220,_0x617f('0xb'));_0x2f19df(_0x2f8a13[_0x617f('0x12')][_0x617f('0x10')]);}})[_0x617f('0x13')](function(_0x4d5296){logger[_0x617f('0xd')](_0x617f('0xf'),_0x365220,_0x4d5296);_0x5f44fb(_0x4d5296);});});} \ No newline at end of file +var _0x88c8=['then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x42e175,_0x1f88f7){var _0x2c5590=function(_0x40315a){while(--_0x40315a){_0x42e175['push'](_0x42e175['shift']());}};_0x2c5590(++_0x1f88f7);}(_0x88c8,0x16a));var _0x888c=function(_0x333c99,_0x2d4de6){_0x333c99=_0x333c99-0x0;var _0x351549=_0x88c8[_0x333c99];return _0x351549;};'use strict';var _=require(_0x888c('0x0'));var util=require(_0x888c('0x1'));var moment=require(_0x888c('0x2'));var BPromise=require('bluebird');var rs=require(_0x888c('0x3'));var fs=require('fs');var Redis=require(_0x888c('0x4'));var db=require(_0x888c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x888c('0x6'))(_0x888c('0x7'));var config=require(_0x888c('0x8'));var jayson=require(_0x888c('0x9'));var client=jayson[_0x888c('0xa')][_0x888c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e34d0,_0x4652c8,_0x4320dd){return new BPromise(function(_0x2cd7d0,_0x3e2b43){return client[_0x888c('0xc')](_0x5e34d0,_0x4320dd)[_0x888c('0xd')](function(_0x12584e){logger[_0x888c('0xe')](_0x888c('0xf'),_0x4652c8,'request\x20sent');logger[_0x888c('0x10')](_0x888c('0x11'),_0x4652c8,'request\x20sent',JSON[_0x888c('0x12')](_0x12584e));if(_0x12584e[_0x888c('0x13')]){if(_0x12584e[_0x888c('0x13')][_0x888c('0x14')]===0x1f4){logger[_0x888c('0x13')](_0x888c('0xf'),_0x4652c8,_0x12584e[_0x888c('0x13')][_0x888c('0x15')]);return _0x3e2b43(_0x12584e[_0x888c('0x13')][_0x888c('0x15')]);}logger[_0x888c('0x13')](_0x888c('0xf'),_0x4652c8,_0x12584e[_0x888c('0x13')]['message']);return _0x2cd7d0(_0x12584e['error'][_0x888c('0x15')]);}else{logger['info'](_0x888c('0xf'),_0x4652c8,_0x888c('0x16'));_0x2cd7d0(_0x12584e[_0x888c('0x17')]['message']);}})[_0x888c('0x18')](function(_0x27611f){logger[_0x888c('0x13')](_0x888c('0xf'),_0x4652c8,_0x27611f);_0x3e2b43(_0x27611f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7b019eb..f1c9c5f 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 _0x5e5b=['put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x5e5b,0x11c));var _0xb5e5=function(_0x2554b8,_0x128eaf){_0x2554b8=_0x2554b8-0x0;var _0x38bea2=_0x5e5b[_0x2554b8];return _0x38bea2;};'use strict';var multer=require(_0xb5e5('0x0'));var util=require(_0xb5e5('0x1'));var path=require(_0xb5e5('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5e5('0x3'));var router=express[_0xb5e5('0x4')]();var auth=require(_0xb5e5('0x5'));var interaction=require(_0xb5e5('0x6'));var config=require('../../config/environment');var controller=require(_0xb5e5('0x7'));router[_0xb5e5('0x8')]('/',auth[_0xb5e5('0x9')](),controller[_0xb5e5('0xa')]);router['get']('/describe',auth[_0xb5e5('0x9')](),controller[_0xb5e5('0xb')]);router[_0xb5e5('0x8')](_0xb5e5('0xc'),auth[_0xb5e5('0x9')](),controller[_0xb5e5('0xd')]);router[_0xb5e5('0xe')]('/',auth[_0xb5e5('0x9')](),controller[_0xb5e5('0xf')]);router[_0xb5e5('0x10')](_0xb5e5('0xc'),auth[_0xb5e5('0x9')](),controller[_0xb5e5('0x11')]);router['delete']('/:id',auth[_0xb5e5('0x9')](),controller[_0xb5e5('0x12')]);module[_0xb5e5('0x13')]=router; \ No newline at end of file +var _0xbb68=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','path','connect-timeout'];(function(_0x57e39a,_0x2d0008){var _0x587069=function(_0x56a94e){while(--_0x56a94e){_0x57e39a['push'](_0x57e39a['shift']());}};_0x587069(++_0x2d0008);}(_0xbb68,0x167));var _0x8bb6=function(_0x80d107,_0x395df5){_0x80d107=_0x80d107-0x0;var _0x1639c9=_0xbb68[_0x80d107];return _0x1639c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8bb6('0x0'));var timeout=require(_0x8bb6('0x1'));var express=require(_0x8bb6('0x2'));var router=express['Router']();var auth=require(_0x8bb6('0x3'));var interaction=require(_0x8bb6('0x4'));var config=require(_0x8bb6('0x5'));var controller=require(_0x8bb6('0x6'));router[_0x8bb6('0x7')]('/',auth[_0x8bb6('0x8')](),controller[_0x8bb6('0x9')]);router[_0x8bb6('0x7')](_0x8bb6('0xa'),auth[_0x8bb6('0x8')](),controller[_0x8bb6('0xb')]);router[_0x8bb6('0x7')](_0x8bb6('0xc'),auth[_0x8bb6('0x8')](),controller['show']);router[_0x8bb6('0xd')]('/',auth['isAuthenticated'](),controller[_0x8bb6('0xe')]);router['put']('/:id',auth[_0x8bb6('0x8')](),controller[_0x8bb6('0xf')]);router[_0x8bb6('0x10')](_0x8bb6('0xc'),auth[_0x8bb6('0x8')](),controller[_0x8bb6('0x11')]);module[_0x8bb6('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a8e5f32..8ddaaa7 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 _0xc0cb=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x1af120,_0x3dccaf){var _0xe9aeda=function(_0x21cfc2){while(--_0x21cfc2){_0x1af120['push'](_0x1af120['shift']());}};_0xe9aeda(++_0x3dccaf);}(_0xc0cb,0x97));var _0xbc0c=function(_0x4c640d,_0x33131a){_0x4c640d=_0x4c640d-0x0;var _0xa97952=_0xc0cb[_0x4c640d];return _0xa97952;};'use strict';var Sequelize=require(_0xbc0c('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbc0c('0x1')],'allowNull':![],'defaultValue':_0xbc0c('0x2')},'appdata':{'type':Sequelize[_0xbc0c('0x3')]()},'description':{'type':Sequelize[_0xbc0c('0x1')]},'interval':{'type':Sequelize[_0xbc0c('0x1')],'defaultValue':_0xbc0c('0x4')}}; \ No newline at end of file +var _0x56da=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x2addb4,_0x1394db){var _0x3f5e86=function(_0x262c1d){while(--_0x262c1d){_0x2addb4['push'](_0x2addb4['shift']());}};_0x3f5e86(++_0x1394db);}(_0x56da,0x146));var _0xa56d=function(_0x1c3429,_0x11d159){_0x1c3429=_0x1c3429-0x0;var _0x1609bd=_0x56da[_0x1c3429];return _0x1609bd;};'use strict';var Sequelize=require(_0xa56d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa56d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa56d('0x2')],'allowNull':![],'defaultValue':_0xa56d('0x3')},'appdata':{'type':Sequelize[_0xa56d('0x4')]()},'description':{'type':Sequelize[_0xa56d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa56d('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 65732dd..d9812b4 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 _0x7577=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','end','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','ChatApplication','find','catch','update','body','fast-json-patch','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x261675,_0x36c5e2){var _0x194b5f=function(_0x4765c2){while(--_0x4765c2){_0x261675['push'](_0x261675['shift']());}};_0x194b5f(++_0x36c5e2);}(_0x7577,0x89));var _0x7757=function(_0x1b7338,_0x4f803d){_0x1b7338=_0x1b7338-0x0;var _0x10509e=_0x7577[_0x1b7338];return _0x10509e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7757('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7757('0x1'));var Mustache=require('mustache');var util=require(_0x7757('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0x7757('0x3'));var ejs=require(_0x7757('0x4'));var fs=require('fs');var _=require(_0x7757('0x5'));var squel=require(_0x7757('0x6'));var crypto=require(_0x7757('0x7'));var jsforce=require(_0x7757('0x8'));var deskjs=require(_0x7757('0x9'));var toCsv=require(_0x7757('0x3'));var querystring=require(_0x7757('0xa'));var Papa=require('papaparse');var Redis=require(_0x7757('0xb'));var authService=require(_0x7757('0xc'));var qs=require(_0x7757('0xd'));var as=require(_0x7757('0xe'));var hardwareService=require(_0x7757('0xf'));var logger=require(_0x7757('0x10'))(_0x7757('0x11'));var utils=require(_0x7757('0x12'));var config=require(_0x7757('0x13'));var db=require(_0x7757('0x14'))['db'];function respondWithStatusCode(_0x4f18a5,_0xdfac30){_0xdfac30=_0xdfac30||0xcc;return function(_0x520592){if(_0x520592){return _0x4f18a5[_0x7757('0x15')](_0xdfac30);}return _0x4f18a5[_0x7757('0x16')](_0xdfac30)['end']();};}function respondWithResult(_0x2d1f6e,_0x3862db){_0x3862db=_0x3862db||0xc8;return function(_0x2e6426){if(_0x2e6426){return _0x2d1f6e['status'](_0x3862db)[_0x7757('0x17')](_0x2e6426);}};}function respondWithFilteredResult(_0x431243,_0x5a73cd){return function(_0x4edd6f){if(_0x4edd6f){var _0x2c4f00=_0x4edd6f[_0x7757('0x18')],_0x5b4858=_0x5a73cd['offset'],_0x1ee989=_0x5a73cd[_0x7757('0x19')]+_0x5a73cd[_0x7757('0x1a')],_0x1ce3f5;if(_0x1ee989>=_0x2c4f00){_0x1ee989=_0x2c4f00;_0x1ce3f5=0xc8;}else{_0x1ce3f5=0xce;}_0x431243[_0x7757('0x16')](_0x1ce3f5);return _0x431243['set'](_0x7757('0x1b'),_0x5b4858+'-'+_0x1ee989+'/'+_0x2c4f00)[_0x7757('0x17')](_0x4edd6f);}return null;};}function patchUpdates(_0x343eb5){return function(_0x2d4fbd){try{jsonpatch[_0x7757('0x1c')](_0x2d4fbd,_0x343eb5,!![]);}catch(_0x5562ab){return BPromise['reject'](_0x5562ab);}return _0x2d4fbd[_0x7757('0x1d')]();};}function saveUpdates(_0x2ec84a,_0x5d2ec7){return function(_0x3cf1c8){if(_0x3cf1c8){return _0x3cf1c8['update'](_0x2ec84a)[_0x7757('0x1e')](function(_0x3ce7fa){return _0x3ce7fa;});}return null;};}function removeEntity(_0x3f55c3,_0x4842ce){return function(_0x3627b9){if(_0x3627b9){return _0x3627b9[_0x7757('0x1f')]()[_0x7757('0x1e')](function(){_0x3f55c3['status'](0xcc)[_0x7757('0x20')]();});}};}function handleEntityNotFound(_0xcb627f,_0x546f2e){return function(_0x4b7620){if(!_0x4b7620){_0xcb627f[_0x7757('0x15')](0x194);}return _0x4b7620;};}function handleError(_0x3b3bf9,_0x36cc38){_0x36cc38=_0x36cc38||0x1f4;return function(_0x3b001a){logger['error'](_0x3b001a[_0x7757('0x21')]);if(_0x3b001a[_0x7757('0x22')]){delete _0x3b001a[_0x7757('0x22')];}_0x3b3bf9[_0x7757('0x16')](_0x36cc38)[_0x7757('0x23')](_0x3b001a);};}exports['show']=function(_0x459701,_0x5b7d20){var _0x461064={'raw':!![],'where':{'id':_0x459701[_0x7757('0x24')]['id']}},_0x3ab117={};_0x3ab117[_0x7757('0x25')]=_[_0x7757('0x26')](db['ChatApplication'][_0x7757('0x27')]);_0x3ab117[_0x7757('0x28')]=_['keys'](_0x459701['query']);_0x3ab117[_0x7757('0x29')]=_[_0x7757('0x2a')](_0x3ab117[_0x7757('0x25')],_0x3ab117[_0x7757('0x28')]);_0x461064[_0x7757('0x2b')]=_['intersection'](_0x3ab117[_0x7757('0x25')],qs['fields'](_0x459701['query'][_0x7757('0x2c')]));_0x461064[_0x7757('0x2b')]=_0x461064['attributes'][_0x7757('0x2d')]?_0x461064['attributes']:_0x3ab117[_0x7757('0x25')];if(_0x459701[_0x7757('0x28')]['includeAll']){_0x461064[_0x7757('0x2e')]=[{'all':!![]}];}_0x461064=_['merge']({},_0x461064,_0x459701['options']);return db[_0x7757('0x2f')][_0x7757('0x30')](_0x461064)[_0x7757('0x1e')](handleEntityNotFound(_0x5b7d20,null))['then'](respondWithResult(_0x5b7d20,null))[_0x7757('0x31')](handleError(_0x5b7d20,null));};exports[_0x7757('0x32')]=function(_0x3559ec,_0x57350d){if(_0x3559ec['body']['id']){delete _0x3559ec[_0x7757('0x33')]['id'];}return db[_0x7757('0x2f')][_0x7757('0x30')]({'where':{'id':_0x3559ec[_0x7757('0x24')]['id']}})[_0x7757('0x1e')](handleEntityNotFound(_0x57350d,null))[_0x7757('0x1e')](saveUpdates(_0x3559ec[_0x7757('0x33')],null))[_0x7757('0x1e')](respondWithResult(_0x57350d,null))[_0x7757('0x31')](handleError(_0x57350d,null));};exports[_0x7757('0x1f')]=function(_0x321f1b,_0x3a4ade){return db['ChatApplication'][_0x7757('0x30')]({'where':{'id':_0x321f1b[_0x7757('0x24')]['id']}})[_0x7757('0x1e')](handleEntityNotFound(_0x3a4ade,null))[_0x7757('0x1e')](removeEntity(_0x3a4ade,null))[_0x7757('0x31')](handleError(_0x3a4ade,null));}; \ No newline at end of file +var _0x6a15=['api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','show','model','rawAttributes','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','then','catch','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xb43852,_0x305934){var _0x81f9a6=function(_0x1267c0){while(--_0x1267c0){_0xb43852['push'](_0xb43852['shift']());}};_0x81f9a6(++_0x305934);}(_0x6a15,0x18f));var _0x56a1=function(_0x3e4ee8,_0x4194f6){_0x3e4ee8=_0x3e4ee8-0x0;var _0x10b191=_0x6a15[_0x3e4ee8];return _0x10b191;};'use strict';var pdf=require(_0x56a1('0x0'));var emlformat=require(_0x56a1('0x1'));var rimraf=require(_0x56a1('0x2'));var zipdir=require(_0x56a1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56a1('0x4'));var moment=require(_0x56a1('0x5'));var BPromise=require(_0x56a1('0x6'));var Mustache=require(_0x56a1('0x7'));var util=require(_0x56a1('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x56a1('0x9'));var fs=require('fs');var _=require(_0x56a1('0xa'));var squel=require(_0x56a1('0xb'));var crypto=require(_0x56a1('0xc'));var jsforce=require(_0x56a1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x56a1('0xe'));var querystring=require(_0x56a1('0xf'));var Papa=require(_0x56a1('0x10'));var Redis=require(_0x56a1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x56a1('0x12'));var as=require(_0x56a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56a1('0x14'))(_0x56a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x56a1('0x16'))['db'];function respondWithStatusCode(_0x3207ce,_0x11a86d){_0x11a86d=_0x11a86d||0xcc;return function(_0x583b63){if(_0x583b63){return _0x3207ce[_0x56a1('0x17')](_0x11a86d);}return _0x3207ce['status'](_0x11a86d)[_0x56a1('0x18')]();};}function respondWithResult(_0x1d26d6,_0x3f7512){_0x3f7512=_0x3f7512||0xc8;return function(_0x59233b){if(_0x59233b){return _0x1d26d6[_0x56a1('0x19')](_0x3f7512)[_0x56a1('0x1a')](_0x59233b);}};}function respondWithFilteredResult(_0x19e6ac,_0x158214){return function(_0x1effeb){if(_0x1effeb){var _0x119888=_0x1effeb[_0x56a1('0x1b')],_0x1be3cd=_0x158214[_0x56a1('0x1c')],_0x4349dc=_0x158214['offset']+_0x158214[_0x56a1('0x1d')],_0x40b634;if(_0x4349dc>=_0x119888){_0x4349dc=_0x119888;_0x40b634=0xc8;}else{_0x40b634=0xce;}_0x19e6ac[_0x56a1('0x19')](_0x40b634);return _0x19e6ac[_0x56a1('0x1e')](_0x56a1('0x1f'),_0x1be3cd+'-'+_0x4349dc+'/'+_0x119888)['json'](_0x1effeb);}return null;};}function patchUpdates(_0x1af395){return function(_0x1044a2){try{jsonpatch[_0x56a1('0x20')](_0x1044a2,_0x1af395,!![]);}catch(_0x5bab07){return BPromise[_0x56a1('0x21')](_0x5bab07);}return _0x1044a2[_0x56a1('0x22')]();};}function saveUpdates(_0x42a8a0,_0x4cb715){return function(_0x50991d){if(_0x50991d){return _0x50991d[_0x56a1('0x23')](_0x42a8a0)['then'](function(_0x4cfd34){return _0x4cfd34;});}return null;};}function removeEntity(_0x400696,_0x55fd70){return function(_0xdf389e){if(_0xdf389e){return _0xdf389e[_0x56a1('0x24')]()['then'](function(){_0x400696[_0x56a1('0x19')](0xcc)[_0x56a1('0x18')]();});}};}function handleEntityNotFound(_0x63ec5,_0x3afe43){return function(_0x22209e){if(!_0x22209e){_0x63ec5[_0x56a1('0x17')](0x194);}return _0x22209e;};}function handleError(_0x5a6eab,_0x4f4984){_0x4f4984=_0x4f4984||0x1f4;return function(_0x3069cf){logger[_0x56a1('0x25')](_0x3069cf[_0x56a1('0x26')]);if(_0x3069cf[_0x56a1('0x27')]){delete _0x3069cf[_0x56a1('0x27')];}_0x5a6eab[_0x56a1('0x19')](_0x4f4984)[_0x56a1('0x28')](_0x3069cf);};}exports[_0x56a1('0x29')]=function(_0x93865d,_0x2582ae){var _0x39b81e={'raw':!![],'where':{'id':_0x93865d['params']['id']}},_0x2ec7fa={};_0x2ec7fa[_0x56a1('0x2a')]=_['keys'](db['ChatApplication'][_0x56a1('0x2b')]);_0x2ec7fa['query']=_[_0x56a1('0x2c')](_0x93865d[_0x56a1('0x2d')]);_0x2ec7fa[_0x56a1('0x2e')]=_[_0x56a1('0x2f')](_0x2ec7fa[_0x56a1('0x2a')],_0x2ec7fa['query']);_0x39b81e[_0x56a1('0x30')]=_['intersection'](_0x2ec7fa[_0x56a1('0x2a')],qs['fields'](_0x93865d[_0x56a1('0x2d')][_0x56a1('0x31')]));_0x39b81e[_0x56a1('0x30')]=_0x39b81e['attributes'][_0x56a1('0x32')]?_0x39b81e[_0x56a1('0x30')]:_0x2ec7fa[_0x56a1('0x2a')];if(_0x93865d[_0x56a1('0x2d')][_0x56a1('0x33')]){_0x39b81e[_0x56a1('0x34')]=[{'all':!![]}];}_0x39b81e=_[_0x56a1('0x35')]({},_0x39b81e,_0x93865d[_0x56a1('0x36')]);return db['ChatApplication'][_0x56a1('0x37')](_0x39b81e)[_0x56a1('0x38')](handleEntityNotFound(_0x2582ae,null))['then'](respondWithResult(_0x2582ae,null))[_0x56a1('0x39')](handleError(_0x2582ae,null));};exports[_0x56a1('0x23')]=function(_0x2733e3,_0x183b28){if(_0x2733e3['body']['id']){delete _0x2733e3[_0x56a1('0x3a')]['id'];}return db['ChatApplication'][_0x56a1('0x37')]({'where':{'id':_0x2733e3[_0x56a1('0x3b')]['id']}})[_0x56a1('0x38')](handleEntityNotFound(_0x183b28,null))[_0x56a1('0x38')](saveUpdates(_0x2733e3[_0x56a1('0x3a')],null))[_0x56a1('0x38')](respondWithResult(_0x183b28,null))[_0x56a1('0x39')](handleError(_0x183b28,null));};exports[_0x56a1('0x24')]=function(_0x5773c6,_0x2fb0c9){return db['ChatApplication'][_0x56a1('0x37')]({'where':{'id':_0x5773c6[_0x56a1('0x3b')]['id']}})[_0x56a1('0x38')](handleEntityNotFound(_0x2fb0c9,null))['then'](removeEntity(_0x2fb0c9,null))['catch'](handleError(_0x2fb0c9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 85f572c..128f9c0 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 b486210..a4d3160 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 _0x8ca9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x105ccb,_0x550900){var _0x1b79c5=function(_0x122aea){while(--_0x122aea){_0x105ccb['push'](_0x105ccb['shift']());}};_0x1b79c5(++_0x550900);}(_0x8ca9,0x16c));var _0x98ca=function(_0x35a46d,_0x56d0dc){_0x35a46d=_0x35a46d-0x0;var _0x1dd5b6=_0x8ca9[_0x35a46d];return _0x1dd5b6;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var moment=require(_0x98ca('0x2'));var BPromise=require(_0x98ca('0x3'));var rs=require(_0x98ca('0x4'));var fs=require('fs');var Redis=require(_0x98ca('0x5'));var db=require(_0x98ca('0x6'))['db'];var utils=require(_0x98ca('0x7'));var logger=require(_0x98ca('0x8'))(_0x98ca('0x9'));var config=require('../../config/environment');var jayson=require(_0x98ca('0xa'));var client=jayson[_0x98ca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a34b9,_0x16fccd,_0x4d8f15){return new BPromise(function(_0x2e208b,_0x3a82cf){return client[_0x98ca('0xc')](_0x3a34b9,_0x4d8f15)[_0x98ca('0xd')](function(_0x202b6f){logger[_0x98ca('0xe')]('ChatApplication,\x20%s,\x20%s',_0x16fccd,_0x98ca('0xf'));logger[_0x98ca('0x10')](_0x98ca('0x11'),_0x16fccd,_0x98ca('0xf'),JSON['stringify'](_0x202b6f));if(_0x202b6f[_0x98ca('0x12')]){if(_0x202b6f[_0x98ca('0x12')][_0x98ca('0x13')]===0x1f4){logger['error'](_0x98ca('0x14'),_0x16fccd,_0x202b6f[_0x98ca('0x12')][_0x98ca('0x15')]);return _0x3a82cf(_0x202b6f[_0x98ca('0x12')][_0x98ca('0x15')]);}logger[_0x98ca('0x12')](_0x98ca('0x14'),_0x16fccd,_0x202b6f[_0x98ca('0x12')][_0x98ca('0x15')]);return _0x2e208b(_0x202b6f[_0x98ca('0x12')]['message']);}else{logger[_0x98ca('0xe')](_0x98ca('0x14'),_0x16fccd,_0x98ca('0xf'));_0x2e208b(_0x202b6f['result'][_0x98ca('0x15')]);}})[_0x98ca('0x16')](function(_0x109f22){logger[_0x98ca('0x12')]('ChatApplication,\x20%s,\x20%s',_0x16fccd,_0x109f22);_0x3a82cf(_0x109f22);});});} \ No newline at end of file +var _0xf2ef=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x362ff6,_0x4db9db){var _0x3da4b0=function(_0x37a9a3){while(--_0x37a9a3){_0x362ff6['push'](_0x362ff6['shift']());}};_0x3da4b0(++_0x4db9db);}(_0xf2ef,0x192));var _0xff2e=function(_0xff92f4,_0x109cf2){_0xff92f4=_0xff92f4-0x0;var _0x4260ef=_0xf2ef[_0xff92f4];return _0x4260ef;};'use strict';var _=require(_0xff2e('0x0'));var util=require('util');var moment=require(_0xff2e('0x1'));var BPromise=require('bluebird');var rs=require(_0xff2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff2e('0x3'))['db'];var utils=require(_0xff2e('0x4'));var logger=require(_0xff2e('0x5'))(_0xff2e('0x6'));var config=require(_0xff2e('0x7'));var jayson=require(_0xff2e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf56a1d,_0x4ec32a,_0x497d6d){return new BPromise(function(_0x35dd9e,_0x18b38d){return client['request'](_0xf56a1d,_0x497d6d)[_0xff2e('0x9')](function(_0x3c1944){logger[_0xff2e('0xa')](_0xff2e('0xb'),_0x4ec32a,_0xff2e('0xc'));logger['debug'](_0xff2e('0xd'),_0x4ec32a,'request\x20sent',JSON[_0xff2e('0xe')](_0x3c1944));if(_0x3c1944[_0xff2e('0xf')]){if(_0x3c1944[_0xff2e('0xf')][_0xff2e('0x10')]===0x1f4){logger[_0xff2e('0xf')](_0xff2e('0xb'),_0x4ec32a,_0x3c1944['error']['message']);return _0x18b38d(_0x3c1944[_0xff2e('0xf')][_0xff2e('0x11')]);}logger[_0xff2e('0xf')](_0xff2e('0xb'),_0x4ec32a,_0x3c1944['error']['message']);return _0x35dd9e(_0x3c1944[_0xff2e('0xf')][_0xff2e('0x11')]);}else{logger[_0xff2e('0xa')](_0xff2e('0xb'),_0x4ec32a,_0xff2e('0xc'));_0x35dd9e(_0x3c1944[_0xff2e('0x12')][_0xff2e('0x11')]);}})[_0xff2e('0x13')](function(_0x4c659e){logger[_0xff2e('0xf')](_0xff2e('0xb'),_0x4ec32a,_0x4c659e);_0x18b38d(_0x4c659e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 2a5659c..67c3bc4 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 _0xb35f=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatApplication.controller','get','isAuthenticated'];(function(_0x3d3c68,_0x551ec7){var _0x417465=function(_0x258a58){while(--_0x258a58){_0x3d3c68['push'](_0x3d3c68['shift']());}};_0x417465(++_0x551ec7);}(_0xb35f,0xe7));var _0xfb35=function(_0x2a9e48,_0x33faeb){_0x2a9e48=_0x2a9e48-0x0;var _0x5942ec=_0xb35f[_0x2a9e48];return _0x5942ec;};'use strict';var multer=require(_0xfb35('0x0'));var util=require('util');var path=require(_0xfb35('0x1'));var timeout=require(_0xfb35('0x2'));var express=require(_0xfb35('0x3'));var router=express['Router']();var auth=require(_0xfb35('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfb35('0x5'));var controller=require(_0xfb35('0x6'));router[_0xfb35('0x7')]('/:id',auth[_0xfb35('0x8')](),controller['show']);router[_0xfb35('0x9')](_0xfb35('0xa'),auth[_0xfb35('0x8')](),controller[_0xfb35('0xb')]);router[_0xfb35('0xc')](_0xfb35('0xa'),auth[_0xfb35('0x8')](),controller[_0xfb35('0xd')]);module[_0xfb35('0xe')]=router; \ No newline at end of file +var _0xcc7e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','exports'];(function(_0x3dfed5,_0x2d800a){var _0x1266f0=function(_0x18228c){while(--_0x18228c){_0x3dfed5['push'](_0x3dfed5['shift']());}};_0x1266f0(++_0x2d800a);}(_0xcc7e,0x104));var _0xecc7=function(_0x4fab09,_0x36613d){_0x4fab09=_0x4fab09-0x0;var _0x1951d9=_0xcc7e[_0x4fab09];return _0x1951d9;};'use strict';var multer=require(_0xecc7('0x0'));var util=require('util');var path=require(_0xecc7('0x1'));var timeout=require('connect-timeout');var express=require(_0xecc7('0x2'));var router=express[_0xecc7('0x3')]();var auth=require(_0xecc7('0x4'));var interaction=require(_0xecc7('0x5'));var config=require(_0xecc7('0x6'));var controller=require(_0xecc7('0x7'));router[_0xecc7('0x8')](_0xecc7('0x9'),auth[_0xecc7('0xa')](),controller[_0xecc7('0xb')]);router['put'](_0xecc7('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xecc7('0xa')](),controller['destroy']);module[_0xecc7('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d496548..b7e13d8 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 _0x63c1=['sequelize','STRING','BOOLEAN'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0x63c1,0x105));var _0x163c=function(_0x51ba14,_0x582bf2){_0x51ba14=_0x51ba14-0x0;var _0x56de39=_0x63c1[_0x51ba14];return _0x56de39;};'use strict';var Sequelize=require(_0x163c('0x0'));module['exports']={'name':{'type':Sequelize[_0x163c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x163c('0x1')]},'write':{'type':Sequelize[_0x163c('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x519f=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4c9a8f,_0x42c3f1){var _0xe8e4e=function(_0x1862ae){while(--_0x1862ae){_0x4c9a8f['push'](_0x4c9a8f['shift']());}};_0xe8e4e(++_0x42c3f1);}(_0x519f,0xcf));var _0xf519=function(_0xc420ba,_0x270490){_0xc420ba=_0xc420ba-0x0;var _0x3a1565=_0x519f[_0xc420ba];return _0x3a1565;};'use strict';var Sequelize=require(_0xf519('0x0'));module[_0xf519('0x1')]={'name':{'type':Sequelize[_0xf519('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf519('0x2')]},'write':{'type':Sequelize[_0xf519('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 bc60828..b2935f9 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 _0xd7fe=['removeMembers','addMessage','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','hasOwnProperty','eml-format','fast-json-patch','moment','mustache','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','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','client','http','test','ValidationError','request','then','info','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','find','create','body','update','destroy','describe','ChatInternalMessage','toInteger','addMembers','ids','omit','User','getMembers'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0xd7fe,0x13e));var _0xed7f=function(_0x7ce734,_0x4ba30e){_0x7ce734=_0x7ce734-0x0;var _0x4cc0ba=_0xd7fe[_0x7ce734];return _0x4cc0ba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xed7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed7f('0x1'));var rp=require('request-promise');var moment=require(_0xed7f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xed7f('0x3'));var util=require('util');var path=require('path');var sox=require(_0xed7f('0x4'));var csv=require(_0xed7f('0x5'));var ejs=require(_0xed7f('0x6'));var fs=require('fs');var _=require(_0xed7f('0x7'));var squel=require(_0xed7f('0x8'));var crypto=require(_0xed7f('0x9'));var jsforce=require(_0xed7f('0xa'));var deskjs=require(_0xed7f('0xb'));var toCsv=require('to-csv');var querystring=require(_0xed7f('0xc'));var Papa=require(_0xed7f('0xd'));var Redis=require(_0xed7f('0xe'));var authService=require(_0xed7f('0xf'));var qs=require(_0xed7f('0x10'));var as=require(_0xed7f('0x11'));var hardwareService=require(_0xed7f('0x12'));var logger=require('../../config/logger')(_0xed7f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xed7f('0x14'))['db'];config['redis']=_[_0xed7f('0x15')](config[_0xed7f('0x16')],{'host':_0xed7f('0x17'),'port':0x18eb});var socket=require(_0xed7f('0x18'))(new Redis(config[_0xed7f('0x16')]));require('./chatGroup.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xed7f('0x19')][_0xed7f('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2f56e9,_0x5a1219,_0x22db69){if(_0x22db69){var _0x32eba1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32eba1[_0xed7f('0x1b')](_0x5a1219)){return _0x2f56e9;}else{throw new db['Sequelize'][(_0xed7f('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2f56e9;}}function respondWithRpcPromise(_0x474f51,_0x234442,_0x52dc66,_0x5bce90){return new BPromise(function(_0x252add,_0x1dc27f){var _0x592ef1=_0x5bce90||client;return _0x592ef1[_0xed7f('0x1d')](_0x474f51,_0x52dc66)[_0xed7f('0x1e')](function(_0x503277){logger[_0xed7f('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x234442,_0xed7f('0x20'));logger[_0xed7f('0x21')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x234442,_0xed7f('0x20'),JSON['stringify'](_0x503277));if(_0x503277[_0xed7f('0x22')]){if(_0x503277[_0xed7f('0x22')][_0xed7f('0x23')]===0x1f4){logger[_0xed7f('0x22')](_0xed7f('0x24'),_0x234442,_0x503277[_0xed7f('0x22')][_0xed7f('0x25')]);return _0x1dc27f(_0x503277['error'][_0xed7f('0x25')]);}logger['error'](_0xed7f('0x24'),_0x234442,_0x503277[_0xed7f('0x22')]['message']);return _0x252add(_0x503277['error'][_0xed7f('0x25')]);}else{logger[_0xed7f('0x1f')](_0xed7f('0x24'),_0x234442,_0xed7f('0x20'));_0x252add(_0x503277[_0xed7f('0x26')][_0xed7f('0x25')]);}})[_0xed7f('0x27')](function(_0x34b4eb){logger[_0xed7f('0x22')](_0xed7f('0x24'),_0x234442,_0x34b4eb);_0x1dc27f(_0x34b4eb);});});}function respondWithStatusCode(_0x183171,_0x3bc2c2){_0x3bc2c2=_0x3bc2c2||0xcc;return function(_0x46b2f5){if(_0x46b2f5){return _0x183171['sendStatus'](_0x3bc2c2);}return _0x183171['status'](_0x3bc2c2)[_0xed7f('0x28')]();};}function respondWithResult(_0x1b9fb1,_0x55c66c){_0x55c66c=_0x55c66c||0xc8;return function(_0x21c187){if(_0x21c187){return _0x1b9fb1[_0xed7f('0x29')](_0x55c66c)[_0xed7f('0x2a')](_0x21c187);}};}function respondWithFilteredResult(_0x45d49e,_0x31a93f){return function(_0x171b57){if(_0x171b57){var _0x482c16=_0x171b57[_0xed7f('0x2b')],_0x184fc6=_0x31a93f[_0xed7f('0x2c')],_0x5b27c8=_0x31a93f[_0xed7f('0x2c')]+_0x31a93f[_0xed7f('0x2d')],_0x27aaf0;if(_0x5b27c8>=_0x482c16){_0x5b27c8=_0x482c16;_0x27aaf0=0xc8;}else{_0x27aaf0=0xce;}_0x45d49e['status'](_0x27aaf0);return _0x45d49e[_0xed7f('0x2e')](_0xed7f('0x2f'),_0x184fc6+'-'+_0x5b27c8+'/'+_0x482c16)['json'](_0x171b57);}return null;};}function patchUpdates(_0x1d465c){return function(_0x15499d){try{jsonpatch[_0xed7f('0x30')](_0x15499d,_0x1d465c,!![]);}catch(_0xece26d){return BPromise[_0xed7f('0x31')](_0xece26d);}return _0x15499d[_0xed7f('0x32')]();};}function saveUpdates(_0x53614e,_0x4b12a5){return function(_0x20518e){if(_0x20518e){return _0x20518e['update'](_0x53614e)['then'](function(_0x486881){return _0x486881;});}return null;};}function removeEntity(_0x292283,_0x5597b1){return function(_0x46f703){if(_0x46f703){return _0x46f703['destroy']()[_0xed7f('0x1e')](function(){_0x292283[_0xed7f('0x29')](0xcc)[_0xed7f('0x28')]();});}};}function handleEntityNotFound(_0x5acafd,_0x124f23){return function(_0x690678){if(!_0x690678){_0x5acafd['sendStatus'](0x194);}return _0x690678;};}function handleError(_0x4dfe64,_0x511ff3){_0x511ff3=_0x511ff3||0x1f4;return function(_0x50a17d){logger[_0xed7f('0x22')](_0x50a17d[_0xed7f('0x33')]);if(_0x50a17d[_0xed7f('0x34')]){delete _0x50a17d['name'];}_0x4dfe64['status'](_0x511ff3)['send'](_0x50a17d);};}exports[_0xed7f('0x35')]=function(_0x117717,_0x113f35){var _0x3d0716={},_0xa4febb={},_0x5a8b01={'count':0x0,'rows':[]};var _0x57e044=_[_0xed7f('0x36')](db[_0xed7f('0x37')][_0xed7f('0x38')],function(_0x28bebb){return{'name':_0x28bebb[_0xed7f('0x39')],'type':_0x28bebb['type'][_0xed7f('0x3a')]};});_0xa4febb[_0xed7f('0x3b')]=_[_0xed7f('0x36')](_0x57e044,'name');_0xa4febb[_0xed7f('0x3c')]=_[_0xed7f('0x3d')](_0x117717['query']);_0xa4febb[_0xed7f('0x3e')]=_[_0xed7f('0x3f')](_0xa4febb[_0xed7f('0x3b')],_0xa4febb['query']);_0x3d0716[_0xed7f('0x40')]=_[_0xed7f('0x3f')](_0xa4febb[_0xed7f('0x3b')],qs[_0xed7f('0x41')](_0x117717[_0xed7f('0x3c')][_0xed7f('0x41')]));_0x3d0716['attributes']=_0x3d0716[_0xed7f('0x40')][_0xed7f('0x42')]?_0x3d0716[_0xed7f('0x40')]:_0xa4febb['model'];if(!_0x117717[_0xed7f('0x3c')]['hasOwnProperty'](_0xed7f('0x43'))){_0x3d0716['limit']=qs[_0xed7f('0x2d')](_0x117717[_0xed7f('0x3c')][_0xed7f('0x2d')]);_0x3d0716['offset']=qs[_0xed7f('0x2c')](_0x117717[_0xed7f('0x3c')]['offset']);}_0x3d0716[_0xed7f('0x44')]=qs[_0xed7f('0x45')](_0x117717[_0xed7f('0x3c')][_0xed7f('0x45')]);_0x3d0716[_0xed7f('0x46')]=qs[_0xed7f('0x3e')](_[_0xed7f('0x47')](_0x117717[_0xed7f('0x3c')],_0xa4febb['filters']),_0x57e044);if(_0x117717['query'][_0xed7f('0x48')]){_0x3d0716[_0xed7f('0x46')]=_[_0xed7f('0x49')](_0x3d0716[_0xed7f('0x46')],{'$or':_['map'](_0x57e044,function(_0x40d369){if(_0x40d369[_0xed7f('0x4a')]!=='VIRTUAL'){var _0x2b6fdc={};_0x2b6fdc[_0x40d369[_0xed7f('0x34')]]={'$like':'%'+_0x117717[_0xed7f('0x3c')]['filter']+'%'};return _0x2b6fdc;}})});}_0x3d0716=_[_0xed7f('0x49')]({},_0x3d0716,_0x117717[_0xed7f('0x4b')]);var _0x1daf03={'where':_0x3d0716[_0xed7f('0x46')]};return db[_0xed7f('0x37')]['count'](_0x1daf03)['then'](function(_0x1fa856){_0x5a8b01[_0xed7f('0x2b')]=_0x1fa856;if(_0x117717[_0xed7f('0x3c')][_0xed7f('0x4c')]){_0x3d0716[_0xed7f('0x4d')]=[{'all':!![]}];}return db[_0xed7f('0x37')][_0xed7f('0x4e')](_0x3d0716);})[_0xed7f('0x1e')](function(_0x331d8e){_0x5a8b01[_0xed7f('0x4f')]=_0x331d8e;return _0x5a8b01;})['then'](respondWithFilteredResult(_0x113f35,_0x3d0716))['catch'](handleError(_0x113f35,null));};exports['show']=function(_0x20a947,_0x15fd02){var _0xb6641a={'raw':!![],'where':{'id':_0x20a947[_0xed7f('0x50')]['id']}},_0x13e439={};_0x13e439[_0xed7f('0x3b')]=_[_0xed7f('0x3d')](db[_0xed7f('0x37')]['rawAttributes']);_0x13e439[_0xed7f('0x3c')]=_['keys'](_0x20a947[_0xed7f('0x3c')]);_0x13e439['filters']=_[_0xed7f('0x3f')](_0x13e439[_0xed7f('0x3b')],_0x13e439['query']);_0xb6641a['attributes']=_[_0xed7f('0x3f')](_0x13e439[_0xed7f('0x3b')],qs[_0xed7f('0x41')](_0x20a947[_0xed7f('0x3c')][_0xed7f('0x41')]));_0xb6641a[_0xed7f('0x40')]=_0xb6641a[_0xed7f('0x40')][_0xed7f('0x42')]?_0xb6641a[_0xed7f('0x40')]:_0x13e439[_0xed7f('0x3b')];if(_0x20a947[_0xed7f('0x3c')]['includeAll']){_0xb6641a[_0xed7f('0x4d')]=[{'all':!![]}];}_0xb6641a=_[_0xed7f('0x49')]({},_0xb6641a,_0x20a947[_0xed7f('0x4b')]);return db[_0xed7f('0x37')][_0xed7f('0x51')](_0xb6641a)[_0xed7f('0x1e')](handleEntityNotFound(_0x15fd02,null))[_0xed7f('0x1e')](respondWithResult(_0x15fd02,null))[_0xed7f('0x27')](handleError(_0x15fd02,null));};exports[_0xed7f('0x52')]=function(_0xa42f64,_0x38e2d1){return db['ChatGroup'][_0xed7f('0x52')](_0xa42f64[_0xed7f('0x53')],{})[_0xed7f('0x1e')](respondWithResult(_0x38e2d1,0xc9))[_0xed7f('0x27')](handleError(_0x38e2d1,null));};exports[_0xed7f('0x54')]=function(_0x25a813,_0x54b066){if(_0x25a813['body']['id']){delete _0x25a813['body']['id'];}return db[_0xed7f('0x37')][_0xed7f('0x51')]({'where':{'id':_0x25a813[_0xed7f('0x50')]['id']}})[_0xed7f('0x1e')](handleEntityNotFound(_0x54b066,null))[_0xed7f('0x1e')](saveUpdates(_0x25a813[_0xed7f('0x53')],null))[_0xed7f('0x1e')](respondWithResult(_0x54b066,null))['catch'](handleError(_0x54b066,null));};exports[_0xed7f('0x55')]=function(_0x3fb174,_0x4aa120){return db['ChatGroup']['find']({'where':{'id':_0x3fb174[_0xed7f('0x50')]['id']}})[_0xed7f('0x1e')](handleEntityNotFound(_0x4aa120,null))[_0xed7f('0x1e')](removeEntity(_0x4aa120,null))[_0xed7f('0x27')](handleError(_0x4aa120,null));};exports['describe']=function(_0x57d160,_0x34261d){return db[_0xed7f('0x37')][_0xed7f('0x56')]()[_0xed7f('0x1e')](respondWithResult(_0x34261d,null))[_0xed7f('0x27')](handleError(_0x34261d,null));};exports['getUnread']=function(_0x534c6d,_0x25a6ed,_0x3b156d){return db[_0xed7f('0x57')][_0xed7f('0x2b')]({'where':{'ChatGroupId':_0x534c6d['params']['id'],'ToId':_0x534c6d['user']['id'],'read':![]}})['then'](function(_0x32fa9d){return{'id':_[_0xed7f('0x58')](_0x534c6d[_0xed7f('0x50')]['id']),'count':_0x32fa9d};})['then'](respondWithResult(_0x25a6ed,null))[_0xed7f('0x27')](handleError(_0x25a6ed,null));};exports[_0xed7f('0x59')]=function(_0x2961aa,_0x27b68a,_0x10eaf2){return db['ChatGroup']['find']({'where':{'id':_0x2961aa[_0xed7f('0x50')]['id']}})[_0xed7f('0x1e')](handleEntityNotFound(_0x27b68a,null))[_0xed7f('0x1e')](function(_0x257818){if(_0x257818){return _0x257818[_0xed7f('0x59')](_0x2961aa[_0xed7f('0x53')][_0xed7f('0x5a')],_[_0xed7f('0x5b')](_0x2961aa[_0xed7f('0x53')],['ids','id'])||{});}})['then'](respondWithResult(_0x27b68a,null))[_0xed7f('0x27')](handleError(_0x27b68a,null));};exports['getMembers']=function(_0x3d52a8,_0xe15c7a,_0x3c69da){var _0x489912={};var _0x59bf7f={};var _0x41be68;var _0x554203;return db[_0xed7f('0x37')]['findOne']({'where':{'id':_0x3d52a8[_0xed7f('0x50')]['id']}})[_0xed7f('0x1e')](handleEntityNotFound(_0xe15c7a,null))[_0xed7f('0x1e')](function(_0x1e0aab){if(_0x1e0aab){_0x41be68=_0x1e0aab;_0x59bf7f[_0xed7f('0x3b')]=_[_0xed7f('0x3d')](db[_0xed7f('0x5c')]['rawAttributes']);_0x59bf7f['query']=_[_0xed7f('0x3d')](_0x3d52a8[_0xed7f('0x3c')]);_0x59bf7f[_0xed7f('0x3e')]=_[_0xed7f('0x3f')](_0x59bf7f['model'],_0x59bf7f['query']);_0x489912[_0xed7f('0x40')]=_[_0xed7f('0x3f')](_0x59bf7f[_0xed7f('0x3b')],qs[_0xed7f('0x41')](_0x3d52a8['query'][_0xed7f('0x41')]));_0x489912['attributes']=_0x489912[_0xed7f('0x40')][_0xed7f('0x42')]?_0x489912['attributes']:_0x59bf7f['model'];_0x489912[_0xed7f('0x44')]=qs['sort'](_0x3d52a8['query'][_0xed7f('0x45')]);_0x489912['where']=qs[_0xed7f('0x3e')](_['pick'](_0x3d52a8[_0xed7f('0x3c')],_0x59bf7f['filters']));if(_0x3d52a8[_0xed7f('0x3c')]['filter']){_0x489912[_0xed7f('0x46')]=_[_0xed7f('0x49')](_0x489912[_0xed7f('0x46')],{'$or':_[_0xed7f('0x36')](_0x489912['attributes'],function(_0x44a141){var _0x46c75c={};_0x46c75c[_0x44a141]={'$like':'%'+_0x3d52a8[_0xed7f('0x3c')]['filter']+'%'};return _0x46c75c;})});}_0x489912=_[_0xed7f('0x49')]({},_0x489912,_0x3d52a8['options']);return _0x41be68['getMembers'](_0x489912);}})[_0xed7f('0x1e')](function(_0x2da7f8){if(_0x2da7f8){_0x554203=_0x2da7f8[_0xed7f('0x42')];if(!_0x3d52a8[_0xed7f('0x3c')]['hasOwnProperty']('nolimit')){_0x489912[_0xed7f('0x2d')]=qs['limit'](_0x3d52a8[_0xed7f('0x3c')][_0xed7f('0x2d')]);_0x489912['offset']=qs[_0xed7f('0x2c')](_0x3d52a8[_0xed7f('0x3c')][_0xed7f('0x2c')]);}return _0x41be68[_0xed7f('0x5d')](_0x489912);}})[_0xed7f('0x1e')](function(_0x4e11c0){if(_0x4e11c0){return _0x4e11c0?{'count':_0x554203,'rows':_0x4e11c0}:null;}})[_0xed7f('0x1e')](respondWithResult(_0xe15c7a,null))[_0xed7f('0x27')](handleError(_0xe15c7a,null));};exports[_0xed7f('0x5e')]=function(_0x6ad2fa,_0x302a4,_0x548e35){return db[_0xed7f('0x37')][_0xed7f('0x51')]({'where':{'id':_0x6ad2fa['params']['id']}})[_0xed7f('0x1e')](handleEntityNotFound(_0x302a4,null))[_0xed7f('0x1e')](function(_0x44ff1b){if(_0x44ff1b){return _0x44ff1b[_0xed7f('0x5e')](_0x6ad2fa[_0xed7f('0x3c')][_0xed7f('0x5a')]);}})[_0xed7f('0x1e')](respondWithStatusCode(_0x302a4,null))[_0xed7f('0x27')](handleError(_0x302a4,null));};exports[_0xed7f('0x5f')]=function(_0x19dbb0,_0x52964c,_0x17c29b){if(_0x19dbb0[_0xed7f('0x53')]['id']){delete _0x19dbb0[_0xed7f('0x53')]['id'];}return db[_0xed7f('0x37')][_0xed7f('0x51')]({'where':{'id':_0x19dbb0[_0xed7f('0x50')]['id']}})[_0xed7f('0x1e')](handleEntityNotFound(_0x52964c,null))[_0xed7f('0x1e')](function(_0x4b255f){if(_0x4b255f){_0x19dbb0[_0xed7f('0x53')]['ChatGroupId']=_0x4b255f['id'];return db[_0xed7f('0x57')][_0xed7f('0x52')](_0x19dbb0[_0xed7f('0x53')]);}})[_0xed7f('0x1e')](respondWithResult(_0x52964c,null))[_0xed7f('0x27')](handleError(_0x52964c,null));};exports['getMessages']=function(_0x274cb1,_0x26baa3,_0x226251){var _0x3dd5f1={};var _0x132e94={};var _0x524ba0;var _0x16a1ba;return db[_0xed7f('0x37')][_0xed7f('0x60')]({'where':{'id':_0x274cb1['params']['id']}})[_0xed7f('0x1e')](handleEntityNotFound(_0x26baa3,null))[_0xed7f('0x1e')](function(_0x457bb5){if(_0x457bb5){_0x524ba0=_0x457bb5;_0x132e94['model']=_['keys'](db[_0xed7f('0x57')]['rawAttributes']);_0x132e94[_0xed7f('0x3c')]=_['keys'](_0x274cb1[_0xed7f('0x3c')]);_0x132e94[_0xed7f('0x3e')]=_[_0xed7f('0x3f')](_0x132e94[_0xed7f('0x3b')],_0x132e94['query']);_0x3dd5f1[_0xed7f('0x40')]=_[_0xed7f('0x3f')](_0x132e94[_0xed7f('0x3b')],qs[_0xed7f('0x41')](_0x274cb1[_0xed7f('0x3c')][_0xed7f('0x41')]));_0x3dd5f1['attributes']=_0x3dd5f1[_0xed7f('0x40')][_0xed7f('0x42')]?_0x3dd5f1[_0xed7f('0x40')]:_0x132e94[_0xed7f('0x3b')];_0x3dd5f1['order']=qs[_0xed7f('0x45')](_0x274cb1['query'][_0xed7f('0x45')]);_0x3dd5f1[_0xed7f('0x46')]=qs[_0xed7f('0x3e')](_[_0xed7f('0x47')](_0x274cb1['query'],_0x132e94[_0xed7f('0x3e')]));if(_0x274cb1[_0xed7f('0x3c')][_0xed7f('0x48')]){_0x3dd5f1['where']=_[_0xed7f('0x49')](_0x3dd5f1['where'],{'$or':_[_0xed7f('0x36')](_0x3dd5f1[_0xed7f('0x40')],function(_0x10f45c){var _0x527f68={};_0x527f68[_0x10f45c]={'$like':'%'+_0x274cb1[_0xed7f('0x3c')]['filter']+'%'};return _0x527f68;})});}if(_0x274cb1['query']['$gte']){var _0x2226b2=_0x274cb1['query'][_0xed7f('0x61')][_0xed7f('0x62')](',');var _0xdc7706={};_0xdc7706[_0x2226b2[0x0]]={'$gte':moment(_0x2226b2[0x1])[_0xed7f('0x63')](_0xed7f('0x64'))};_0x3dd5f1['where']=_[_0xed7f('0x49')](_0x3dd5f1['where'],_0xdc7706);}_0x3dd5f1=_[_0xed7f('0x49')]({},_0x3dd5f1,_0x274cb1[_0xed7f('0x4b')]);return _0x524ba0[_0xed7f('0x65')](_0x3dd5f1);}})[_0xed7f('0x1e')](function(_0x3a290b){if(_0x3a290b){_0x16a1ba=_0x3a290b['length'];if(!_0x274cb1[_0xed7f('0x3c')][_0xed7f('0x66')]('nolimit')){_0x3dd5f1[_0xed7f('0x2d')]=qs['limit'](_0x274cb1[_0xed7f('0x3c')][_0xed7f('0x2d')]);_0x3dd5f1['offset']=qs['offset'](_0x274cb1[_0xed7f('0x3c')][_0xed7f('0x2c')]);}return _0x524ba0[_0xed7f('0x65')](_0x3dd5f1);}})[_0xed7f('0x1e')](function(_0x5a77c4){if(_0x5a77c4){return _0x5a77c4?{'count':_0x16a1ba,'rows':_0x5a77c4}:null;}})[_0xed7f('0x1e')](respondWithResult(_0x26baa3,null))['catch'](handleError(_0x26baa3,null));}; \ No newline at end of file +var _0x885f=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','ChatInternalMessage','toInteger','addMembers','omit','ids','getMembers','order','removeMembers','ChatGroupId','getMessages','findOne','$gte','split','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','ChatGroup'];(function(_0x3f4d55,_0x21aca6){var _0x3e9d17=function(_0x4ec309){while(--_0x4ec309){_0x3f4d55['push'](_0x3f4d55['shift']());}};_0x3e9d17(++_0x21aca6);}(_0x885f,0x178));var _0xf885=function(_0x40de6f,_0x3d5f9c){_0x40de6f=_0x40de6f-0x0;var _0x44a887=_0x885f[_0x40de6f];return _0x44a887;};'use strict';var pdf=require(_0xf885('0x0'));var emlformat=require(_0xf885('0x1'));var rimraf=require(_0xf885('0x2'));var zipdir=require(_0xf885('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf885('0x4'));var moment=require('moment');var BPromise=require(_0xf885('0x5'));var Mustache=require(_0xf885('0x6'));var util=require('util');var path=require(_0xf885('0x7'));var sox=require(_0xf885('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf885('0x9'));var squel=require(_0xf885('0xa'));var crypto=require(_0xf885('0xb'));var jsforce=require(_0xf885('0xc'));var deskjs=require(_0xf885('0xd'));var toCsv=require(_0xf885('0xe'));var querystring=require(_0xf885('0xf'));var Papa=require('papaparse');var Redis=require(_0xf885('0x10'));var authService=require(_0xf885('0x11'));var qs=require(_0xf885('0x12'));var as=require(_0xf885('0x13'));var hardwareService=require(_0xf885('0x14'));var logger=require(_0xf885('0x15'))(_0xf885('0x16'));var utils=require(_0xf885('0x17'));var config=require(_0xf885('0x18'));var db=require('../../mysqldb')['db'];config[_0xf885('0x19')]=_[_0xf885('0x1a')](config[_0xf885('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf885('0x1b'))(new Redis(config['redis']));require(_0xf885('0x1c'))[_0xf885('0x1d')](socket);var jayson=require(_0xf885('0x1e'));var client=jayson[_0xf885('0x1f')][_0xf885('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1b9cd3,_0x319e5d,_0x1c514f){if(_0x1c514f){var _0x11cf19=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11cf19[_0xf885('0x21')](_0x319e5d)){return _0x1b9cd3;}else{throw new db[(_0xf885('0x22'))]['ValidationError'](_0xf885('0x23'));}}else{return _0x1b9cd3;}}function respondWithRpcPromise(_0x5b6985,_0x39864c,_0x54e25d,_0x5c9982){return new BPromise(function(_0x3dd1b9,_0x4b4151){var _0x2a99cd=_0x5c9982||client;return _0x2a99cd['request'](_0x5b6985,_0x54e25d)[_0xf885('0x24')](function(_0x2b21f1){logger[_0xf885('0x25')](_0xf885('0x26'),_0x39864c,_0xf885('0x27'));logger[_0xf885('0x28')](_0xf885('0x29'),_0x39864c,_0xf885('0x27'),JSON[_0xf885('0x2a')](_0x2b21f1));if(_0x2b21f1[_0xf885('0x2b')]){if(_0x2b21f1[_0xf885('0x2b')][_0xf885('0x2c')]===0x1f4){logger[_0xf885('0x2b')](_0xf885('0x26'),_0x39864c,_0x2b21f1[_0xf885('0x2b')][_0xf885('0x2d')]);return _0x4b4151(_0x2b21f1[_0xf885('0x2b')][_0xf885('0x2d')]);}logger[_0xf885('0x2b')]('ChatGroup,\x20%s,\x20%s',_0x39864c,_0x2b21f1[_0xf885('0x2b')]['message']);return _0x3dd1b9(_0x2b21f1[_0xf885('0x2b')][_0xf885('0x2d')]);}else{logger['info'](_0xf885('0x26'),_0x39864c,'request\x20sent');_0x3dd1b9(_0x2b21f1[_0xf885('0x2e')][_0xf885('0x2d')]);}})['catch'](function(_0x363a51){logger[_0xf885('0x2b')](_0xf885('0x26'),_0x39864c,_0x363a51);_0x4b4151(_0x363a51);});});}function respondWithStatusCode(_0x1169b1,_0x3bddf8){_0x3bddf8=_0x3bddf8||0xcc;return function(_0x75b237){if(_0x75b237){return _0x1169b1['sendStatus'](_0x3bddf8);}return _0x1169b1['status'](_0x3bddf8)[_0xf885('0x2f')]();};}function respondWithResult(_0x1f5968,_0x1624d5){_0x1624d5=_0x1624d5||0xc8;return function(_0x2e575c){if(_0x2e575c){return _0x1f5968[_0xf885('0x30')](_0x1624d5)[_0xf885('0x31')](_0x2e575c);}};}function respondWithFilteredResult(_0x2289dc,_0x49452d){return function(_0x46376e){if(_0x46376e){var _0x6aa8b4=_0x46376e['count'],_0x30d884=_0x49452d[_0xf885('0x32')],_0x3dd81c=_0x49452d[_0xf885('0x32')]+_0x49452d[_0xf885('0x33')],_0x51bd59;if(_0x3dd81c>=_0x6aa8b4){_0x3dd81c=_0x6aa8b4;_0x51bd59=0xc8;}else{_0x51bd59=0xce;}_0x2289dc['status'](_0x51bd59);return _0x2289dc['set'](_0xf885('0x34'),_0x30d884+'-'+_0x3dd81c+'/'+_0x6aa8b4)[_0xf885('0x31')](_0x46376e);}return null;};}function patchUpdates(_0x3a0ac2){return function(_0x5f12fa){try{jsonpatch[_0xf885('0x35')](_0x5f12fa,_0x3a0ac2,!![]);}catch(_0x46ca22){return BPromise[_0xf885('0x36')](_0x46ca22);}return _0x5f12fa[_0xf885('0x37')]();};}function saveUpdates(_0x5a3a03,_0x52d3eb){return function(_0x1a9d4d){if(_0x1a9d4d){return _0x1a9d4d[_0xf885('0x38')](_0x5a3a03)[_0xf885('0x24')](function(_0x463d17){return _0x463d17;});}return null;};}function removeEntity(_0x4813c8,_0x462b22){return function(_0x14747d){if(_0x14747d){return _0x14747d[_0xf885('0x39')]()[_0xf885('0x24')](function(){_0x4813c8[_0xf885('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb1e562,_0x5ab526){return function(_0x540ff9){if(!_0x540ff9){_0xb1e562[_0xf885('0x3a')](0x194);}return _0x540ff9;};}function handleError(_0x28380a,_0x5ab6cd){_0x5ab6cd=_0x5ab6cd||0x1f4;return function(_0x264f32){logger['error'](_0x264f32['stack']);if(_0x264f32['name']){delete _0x264f32[_0xf885('0x3b')];}_0x28380a[_0xf885('0x30')](_0x5ab6cd)[_0xf885('0x3c')](_0x264f32);};}exports[_0xf885('0x3d')]=function(_0x436845,_0x15f630){var _0x21c0b7={},_0xe73bd2={},_0x25e761={'count':0x0,'rows':[]};var _0x1bbb9b=_[_0xf885('0x3e')](db[_0xf885('0x3f')][_0xf885('0x40')],function(_0x159b8f){return{'name':_0x159b8f[_0xf885('0x41')],'type':_0x159b8f['type'][_0xf885('0x42')]};});_0xe73bd2[_0xf885('0x43')]=_[_0xf885('0x3e')](_0x1bbb9b,'name');_0xe73bd2[_0xf885('0x44')]=_[_0xf885('0x45')](_0x436845[_0xf885('0x44')]);_0xe73bd2[_0xf885('0x46')]=_[_0xf885('0x47')](_0xe73bd2[_0xf885('0x43')],_0xe73bd2[_0xf885('0x44')]);_0x21c0b7[_0xf885('0x48')]=_[_0xf885('0x47')](_0xe73bd2[_0xf885('0x43')],qs[_0xf885('0x49')](_0x436845[_0xf885('0x44')][_0xf885('0x49')]));_0x21c0b7[_0xf885('0x48')]=_0x21c0b7[_0xf885('0x48')]['length']?_0x21c0b7[_0xf885('0x48')]:_0xe73bd2[_0xf885('0x43')];if(!_0x436845[_0xf885('0x44')][_0xf885('0x4a')](_0xf885('0x4b'))){_0x21c0b7['limit']=qs[_0xf885('0x33')](_0x436845['query'][_0xf885('0x33')]);_0x21c0b7[_0xf885('0x32')]=qs[_0xf885('0x32')](_0x436845[_0xf885('0x44')][_0xf885('0x32')]);}_0x21c0b7['order']=qs[_0xf885('0x4c')](_0x436845[_0xf885('0x44')][_0xf885('0x4c')]);_0x21c0b7[_0xf885('0x4d')]=qs['filters'](_[_0xf885('0x4e')](_0x436845[_0xf885('0x44')],_0xe73bd2[_0xf885('0x46')]),_0x1bbb9b);if(_0x436845[_0xf885('0x44')][_0xf885('0x4f')]){_0x21c0b7['where']=_[_0xf885('0x50')](_0x21c0b7[_0xf885('0x4d')],{'$or':_[_0xf885('0x3e')](_0x1bbb9b,function(_0x58f4a0){if(_0x58f4a0[_0xf885('0x51')]!==_0xf885('0x52')){var _0x3495e5={};_0x3495e5[_0x58f4a0[_0xf885('0x3b')]]={'$like':'%'+_0x436845[_0xf885('0x44')][_0xf885('0x4f')]+'%'};return _0x3495e5;}})});}_0x21c0b7=_[_0xf885('0x50')]({},_0x21c0b7,_0x436845[_0xf885('0x53')]);var _0x269b69={'where':_0x21c0b7[_0xf885('0x4d')]};return db[_0xf885('0x3f')][_0xf885('0x54')](_0x269b69)[_0xf885('0x24')](function(_0x555c27){_0x25e761[_0xf885('0x54')]=_0x555c27;if(_0x436845[_0xf885('0x44')][_0xf885('0x55')]){_0x21c0b7[_0xf885('0x56')]=[{'all':!![]}];}return db[_0xf885('0x3f')][_0xf885('0x57')](_0x21c0b7);})['then'](function(_0x45b8d8){_0x25e761[_0xf885('0x58')]=_0x45b8d8;return _0x25e761;})[_0xf885('0x24')](respondWithFilteredResult(_0x15f630,_0x21c0b7))[_0xf885('0x59')](handleError(_0x15f630,null));};exports[_0xf885('0x5a')]=function(_0x32bb10,_0x1a2bc3){var _0x3bc8ed={'raw':!![],'where':{'id':_0x32bb10[_0xf885('0x5b')]['id']}},_0xb0bd5a={};_0xb0bd5a[_0xf885('0x43')]=_[_0xf885('0x45')](db[_0xf885('0x3f')]['rawAttributes']);_0xb0bd5a['query']=_['keys'](_0x32bb10['query']);_0xb0bd5a[_0xf885('0x46')]=_[_0xf885('0x47')](_0xb0bd5a['model'],_0xb0bd5a[_0xf885('0x44')]);_0x3bc8ed[_0xf885('0x48')]=_['intersection'](_0xb0bd5a[_0xf885('0x43')],qs[_0xf885('0x49')](_0x32bb10[_0xf885('0x44')][_0xf885('0x49')]));_0x3bc8ed[_0xf885('0x48')]=_0x3bc8ed[_0xf885('0x48')][_0xf885('0x5c')]?_0x3bc8ed[_0xf885('0x48')]:_0xb0bd5a[_0xf885('0x43')];if(_0x32bb10['query'][_0xf885('0x55')]){_0x3bc8ed['include']=[{'all':!![]}];}_0x3bc8ed=_['merge']({},_0x3bc8ed,_0x32bb10[_0xf885('0x53')]);return db[_0xf885('0x3f')]['find'](_0x3bc8ed)[_0xf885('0x24')](handleEntityNotFound(_0x1a2bc3,null))[_0xf885('0x24')](respondWithResult(_0x1a2bc3,null))['catch'](handleError(_0x1a2bc3,null));};exports[_0xf885('0x5d')]=function(_0x183c95,_0x15a6d8){return db['ChatGroup'][_0xf885('0x5d')](_0x183c95['body'],{})[_0xf885('0x24')](respondWithResult(_0x15a6d8,0xc9))[_0xf885('0x59')](handleError(_0x15a6d8,null));};exports[_0xf885('0x38')]=function(_0x13e3bb,_0x198e1a){if(_0x13e3bb[_0xf885('0x5e')]['id']){delete _0x13e3bb[_0xf885('0x5e')]['id'];}return db[_0xf885('0x3f')][_0xf885('0x5f')]({'where':{'id':_0x13e3bb[_0xf885('0x5b')]['id']}})[_0xf885('0x24')](handleEntityNotFound(_0x198e1a,null))[_0xf885('0x24')](saveUpdates(_0x13e3bb[_0xf885('0x5e')],null))[_0xf885('0x24')](respondWithResult(_0x198e1a,null))[_0xf885('0x59')](handleError(_0x198e1a,null));};exports[_0xf885('0x39')]=function(_0x1c8325,_0x33f695){return db[_0xf885('0x3f')]['find']({'where':{'id':_0x1c8325[_0xf885('0x5b')]['id']}})[_0xf885('0x24')](handleEntityNotFound(_0x33f695,null))[_0xf885('0x24')](removeEntity(_0x33f695,null))['catch'](handleError(_0x33f695,null));};exports['describe']=function(_0x201499,_0x49e887){return db[_0xf885('0x3f')][_0xf885('0x60')]()[_0xf885('0x24')](respondWithResult(_0x49e887,null))[_0xf885('0x59')](handleError(_0x49e887,null));};exports['getUnread']=function(_0x4a8533,_0x2fd9c9,_0x5108b2){return db[_0xf885('0x61')][_0xf885('0x54')]({'where':{'ChatGroupId':_0x4a8533[_0xf885('0x5b')]['id'],'ToId':_0x4a8533['user']['id'],'read':![]}})[_0xf885('0x24')](function(_0x3d3317){return{'id':_[_0xf885('0x62')](_0x4a8533[_0xf885('0x5b')]['id']),'count':_0x3d3317};})[_0xf885('0x24')](respondWithResult(_0x2fd9c9,null))[_0xf885('0x59')](handleError(_0x2fd9c9,null));};exports[_0xf885('0x63')]=function(_0x5881d6,_0x3cd679,_0x54682a){return db[_0xf885('0x3f')][_0xf885('0x5f')]({'where':{'id':_0x5881d6['params']['id']}})['then'](handleEntityNotFound(_0x3cd679,null))[_0xf885('0x24')](function(_0x29eede){if(_0x29eede){return _0x29eede[_0xf885('0x63')](_0x5881d6['body']['ids'],_[_0xf885('0x64')](_0x5881d6[_0xf885('0x5e')],[_0xf885('0x65'),'id'])||{});}})[_0xf885('0x24')](respondWithResult(_0x3cd679,null))[_0xf885('0x59')](handleError(_0x3cd679,null));};exports[_0xf885('0x66')]=function(_0x14ceb0,_0x55d42f,_0x204a74){var _0x2c0ca9={};var _0x7f3f08={};var _0x33b9d7;var _0x4571b1;return db[_0xf885('0x3f')]['findOne']({'where':{'id':_0x14ceb0['params']['id']}})[_0xf885('0x24')](handleEntityNotFound(_0x55d42f,null))[_0xf885('0x24')](function(_0x1b6edd){if(_0x1b6edd){_0x33b9d7=_0x1b6edd;_0x7f3f08[_0xf885('0x43')]=_[_0xf885('0x45')](db['User'][_0xf885('0x40')]);_0x7f3f08['query']=_['keys'](_0x14ceb0['query']);_0x7f3f08[_0xf885('0x46')]=_[_0xf885('0x47')](_0x7f3f08[_0xf885('0x43')],_0x7f3f08[_0xf885('0x44')]);_0x2c0ca9[_0xf885('0x48')]=_[_0xf885('0x47')](_0x7f3f08[_0xf885('0x43')],qs[_0xf885('0x49')](_0x14ceb0[_0xf885('0x44')]['fields']));_0x2c0ca9[_0xf885('0x48')]=_0x2c0ca9['attributes'][_0xf885('0x5c')]?_0x2c0ca9[_0xf885('0x48')]:_0x7f3f08['model'];_0x2c0ca9[_0xf885('0x67')]=qs[_0xf885('0x4c')](_0x14ceb0['query']['sort']);_0x2c0ca9[_0xf885('0x4d')]=qs['filters'](_[_0xf885('0x4e')](_0x14ceb0[_0xf885('0x44')],_0x7f3f08[_0xf885('0x46')]));if(_0x14ceb0[_0xf885('0x44')][_0xf885('0x4f')]){_0x2c0ca9[_0xf885('0x4d')]=_[_0xf885('0x50')](_0x2c0ca9['where'],{'$or':_[_0xf885('0x3e')](_0x2c0ca9['attributes'],function(_0x493144){var _0xa4cb4d={};_0xa4cb4d[_0x493144]={'$like':'%'+_0x14ceb0['query'][_0xf885('0x4f')]+'%'};return _0xa4cb4d;})});}_0x2c0ca9=_[_0xf885('0x50')]({},_0x2c0ca9,_0x14ceb0[_0xf885('0x53')]);return _0x33b9d7[_0xf885('0x66')](_0x2c0ca9);}})['then'](function(_0x5ac7de){if(_0x5ac7de){_0x4571b1=_0x5ac7de[_0xf885('0x5c')];if(!_0x14ceb0[_0xf885('0x44')][_0xf885('0x4a')]('nolimit')){_0x2c0ca9[_0xf885('0x33')]=qs[_0xf885('0x33')](_0x14ceb0[_0xf885('0x44')][_0xf885('0x33')]);_0x2c0ca9[_0xf885('0x32')]=qs[_0xf885('0x32')](_0x14ceb0[_0xf885('0x44')][_0xf885('0x32')]);}return _0x33b9d7['getMembers'](_0x2c0ca9);}})[_0xf885('0x24')](function(_0x21ef2b){if(_0x21ef2b){return _0x21ef2b?{'count':_0x4571b1,'rows':_0x21ef2b}:null;}})[_0xf885('0x24')](respondWithResult(_0x55d42f,null))[_0xf885('0x59')](handleError(_0x55d42f,null));};exports[_0xf885('0x68')]=function(_0x26df51,_0x2cfee7,_0x36de8e){return db['ChatGroup'][_0xf885('0x5f')]({'where':{'id':_0x26df51[_0xf885('0x5b')]['id']}})[_0xf885('0x24')](handleEntityNotFound(_0x2cfee7,null))[_0xf885('0x24')](function(_0x5c3755){if(_0x5c3755){return _0x5c3755[_0xf885('0x68')](_0x26df51[_0xf885('0x44')][_0xf885('0x65')]);}})[_0xf885('0x24')](respondWithStatusCode(_0x2cfee7,null))[_0xf885('0x59')](handleError(_0x2cfee7,null));};exports['addMessage']=function(_0x4d6c65,_0x370820,_0x5c278e){if(_0x4d6c65[_0xf885('0x5e')]['id']){delete _0x4d6c65['body']['id'];}return db[_0xf885('0x3f')][_0xf885('0x5f')]({'where':{'id':_0x4d6c65[_0xf885('0x5b')]['id']}})[_0xf885('0x24')](handleEntityNotFound(_0x370820,null))[_0xf885('0x24')](function(_0x5b9398){if(_0x5b9398){_0x4d6c65[_0xf885('0x5e')][_0xf885('0x69')]=_0x5b9398['id'];return db['ChatInternalMessage'][_0xf885('0x5d')](_0x4d6c65['body']);}})[_0xf885('0x24')](respondWithResult(_0x370820,null))[_0xf885('0x59')](handleError(_0x370820,null));};exports[_0xf885('0x6a')]=function(_0x14e324,_0x23d783,_0xa2329b){var _0x58ab18={};var _0x4e88a3={};var _0x3498b2;var _0x4d3ad7;return db[_0xf885('0x3f')][_0xf885('0x6b')]({'where':{'id':_0x14e324[_0xf885('0x5b')]['id']}})[_0xf885('0x24')](handleEntityNotFound(_0x23d783,null))[_0xf885('0x24')](function(_0x587877){if(_0x587877){_0x3498b2=_0x587877;_0x4e88a3['model']=_[_0xf885('0x45')](db[_0xf885('0x61')][_0xf885('0x40')]);_0x4e88a3[_0xf885('0x44')]=_[_0xf885('0x45')](_0x14e324[_0xf885('0x44')]);_0x4e88a3[_0xf885('0x46')]=_[_0xf885('0x47')](_0x4e88a3[_0xf885('0x43')],_0x4e88a3[_0xf885('0x44')]);_0x58ab18['attributes']=_[_0xf885('0x47')](_0x4e88a3[_0xf885('0x43')],qs[_0xf885('0x49')](_0x14e324['query'][_0xf885('0x49')]));_0x58ab18[_0xf885('0x48')]=_0x58ab18[_0xf885('0x48')][_0xf885('0x5c')]?_0x58ab18[_0xf885('0x48')]:_0x4e88a3[_0xf885('0x43')];_0x58ab18[_0xf885('0x67')]=qs[_0xf885('0x4c')](_0x14e324['query']['sort']);_0x58ab18['where']=qs['filters'](_[_0xf885('0x4e')](_0x14e324[_0xf885('0x44')],_0x4e88a3[_0xf885('0x46')]));if(_0x14e324['query'][_0xf885('0x4f')]){_0x58ab18[_0xf885('0x4d')]=_[_0xf885('0x50')](_0x58ab18[_0xf885('0x4d')],{'$or':_['map'](_0x58ab18[_0xf885('0x48')],function(_0x137186){var _0x2bfb54={};_0x2bfb54[_0x137186]={'$like':'%'+_0x14e324[_0xf885('0x44')]['filter']+'%'};return _0x2bfb54;})});}if(_0x14e324['query']['$gte']){var _0x2a2f1e=_0x14e324[_0xf885('0x44')][_0xf885('0x6c')][_0xf885('0x6d')](',');var _0x17306b={};_0x17306b[_0x2a2f1e[0x0]]={'$gte':moment(_0x2a2f1e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x58ab18[_0xf885('0x4d')]=_['merge'](_0x58ab18[_0xf885('0x4d')],_0x17306b);}_0x58ab18=_['merge']({},_0x58ab18,_0x14e324[_0xf885('0x53')]);return _0x3498b2['getMessages'](_0x58ab18);}})[_0xf885('0x24')](function(_0x4d4348){if(_0x4d4348){_0x4d3ad7=_0x4d4348[_0xf885('0x5c')];if(!_0x14e324[_0xf885('0x44')][_0xf885('0x4a')](_0xf885('0x4b'))){_0x58ab18[_0xf885('0x33')]=qs[_0xf885('0x33')](_0x14e324[_0xf885('0x44')]['limit']);_0x58ab18[_0xf885('0x32')]=qs['offset'](_0x14e324[_0xf885('0x44')][_0xf885('0x32')]);}return _0x3498b2['getMessages'](_0x58ab18);}})['then'](function(_0x25865f){if(_0x25865f){return _0x25865f?{'count':_0x4d3ad7,'rows':_0x25865f}:null;}})['then'](respondWithResult(_0x23d783,null))[_0xf885('0x59')](handleError(_0x23d783,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 649a085..d359ce1 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 _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x1d0b80,_0x41fc24){var _0x35d642=function(_0x4c2cb5){while(--_0x4c2cb5){_0x1d0b80['push'](_0x1d0b80['shift']());}};_0x35d642(++_0x41fc24);}(_0x2ef3,0xba));var _0x32ef=function(_0x330508,_0x58c4ee){_0x330508=_0x330508-0x0;var _0x173d6d=_0x2ef3[_0x330508];return _0x173d6d;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0xadb5,0xad));var _0x5adb=function(_0x58539f,_0x17ede3){_0x58539f=_0x58539f-0x0;var _0x89b01c=_0xadb5[_0x58539f];return _0x89b01c;};'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 92c9fdd..68b2165 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 _0xac4f=['lodash','../../config/logger','moment','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x2d518,_0x61c0e9){var _0xdc2ee7=function(_0x473acd){while(--_0x473acd){_0x2d518['push'](_0x2d518['shift']());}};_0xdc2ee7(++_0x61c0e9);}(_0xac4f,0x122));var _0xfac4=function(_0x3767ef,_0x29c168){_0x3767ef=_0x3767ef-0x0;var _0x14c673=_0xac4f[_0x3767ef];return _0x14c673;};'use strict';var _=require(_0xfac4('0x0'));var util=require('util');var logger=require(_0xfac4('0x1'))('api');var moment=require(_0xfac4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfac4('0x3'));var rimraf=require(_0xfac4('0x4'));var config=require('../../config/environment');var attributes=require(_0xfac4('0x5'));module[_0xfac4('0x6')]=function(_0x1aae1c,_0x48f014){return _0x1aae1c[_0xfac4('0x7')](_0xfac4('0x8'),attributes,{'tableName':_0xfac4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7b6=['lodash','util','moment','bluebird','path','rimraf','exports','define','ChatGroup'];(function(_0x1d42fc,_0x2c79c1){var _0x1fda8d=function(_0x3c31ee){while(--_0x3c31ee){_0x1d42fc['push'](_0x1d42fc['shift']());}};_0x1fda8d(++_0x2c79c1);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x4d1430,_0x23096b){_0x4d1430=_0x4d1430-0x0;var _0x9d1f61=_0xb7b6[_0x4d1430];return _0x9d1f61;};'use strict';var _=require(_0x6b7b('0x0'));var util=require(_0x6b7b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b7b('0x2'));var BPromise=require(_0x6b7b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b7b('0x4'));var rimraf=require(_0x6b7b('0x5'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x6b7b('0x6')]=function(_0x43e9ed,_0x3cce80){return _0x43e9ed[_0x6b7b('0x7')](_0x6b7b('0x8'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index f0a903b..581bff9 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 _0x01f1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','register','then','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x01f1,0x165));var _0x101f=function(_0x4ef826,_0x2e0ac8){_0x4ef826=_0x4ef826-0x0;var _0x154b8=_0x01f1[_0x4ef826];return _0x154b8;};'use strict';var _=require(_0x101f('0x0'));var util=require(_0x101f('0x1'));var moment=require(_0x101f('0x2'));var BPromise=require(_0x101f('0x3'));var rs=require(_0x101f('0x4'));var fs=require('fs');var Redis=require(_0x101f('0x5'));var db=require(_0x101f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x101f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x101f('0x8'));var client=jayson[_0x101f('0x9')][_0x101f('0xa')]({'port':0x232a});config[_0x101f('0xb')]=_[_0x101f('0xc')](config[_0x101f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x101f('0xb')]));require('./chatGroup.socket')[_0x101f('0xd')](socket);function respondWithRpcPromise(_0x284f13,_0x48d851,_0x44afb1){return new BPromise(function(_0x5cc9e9,_0x2ca15c){return client['request'](_0x284f13,_0x44afb1)[_0x101f('0xe')](function(_0x58cc01){logger[_0x101f('0xf')]('ChatGroup,\x20%s,\x20%s',_0x48d851,_0x101f('0x10'));logger[_0x101f('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x48d851,_0x101f('0x10'),JSON[_0x101f('0x12')](_0x58cc01));if(_0x58cc01[_0x101f('0x13')]){if(_0x58cc01[_0x101f('0x13')][_0x101f('0x14')]===0x1f4){logger[_0x101f('0x13')](_0x101f('0x15'),_0x48d851,_0x58cc01['error'][_0x101f('0x16')]);return _0x2ca15c(_0x58cc01[_0x101f('0x13')]['message']);}logger[_0x101f('0x13')]('ChatGroup,\x20%s,\x20%s',_0x48d851,_0x58cc01[_0x101f('0x13')][_0x101f('0x16')]);return _0x5cc9e9(_0x58cc01[_0x101f('0x13')][_0x101f('0x16')]);}else{logger[_0x101f('0xf')]('ChatGroup,\x20%s,\x20%s',_0x48d851,_0x101f('0x10'));_0x5cc9e9(_0x58cc01['result'][_0x101f('0x16')]);}})[_0x101f('0x17')](function(_0x384d2d){logger[_0x101f('0x13')](_0x101f('0x15'),_0x48d851,_0x384d2d);_0x2ca15c(_0x384d2d);});});} \ No newline at end of file +var _0x7467=['redis','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','defaults'];(function(_0x55905b,_0x486a67){var _0x388bb9=function(_0x5e6438){while(--_0x5e6438){_0x55905b['push'](_0x55905b['shift']());}};_0x388bb9(++_0x486a67);}(_0x7467,0x88));var _0x7746=function(_0x3921a8,_0x30680f){_0x3921a8=_0x3921a8-0x0;var _0x5514fb=_0x7467[_0x3921a8];return _0x5514fb;};'use strict';var _=require(_0x7746('0x0'));var util=require(_0x7746('0x1'));var moment=require('moment');var BPromise=require(_0x7746('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7746('0x3'))['db'];var utils=require(_0x7746('0x4'));var logger=require(_0x7746('0x5'))('rpc');var config=require(_0x7746('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7746('0x7')](config[_0x7746('0x8')],{'host':_0x7746('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7746('0x8')]));require('./chatGroup.socket')[_0x7746('0xa')](socket);function respondWithRpcPromise(_0x5a0bb2,_0x4d2138,_0x2b2271){return new BPromise(function(_0x2359e9,_0x2a8465){return client[_0x7746('0xb')](_0x5a0bb2,_0x2b2271)[_0x7746('0xc')](function(_0x4d614f){logger[_0x7746('0xd')](_0x7746('0xe'),_0x4d2138,'request\x20sent');logger[_0x7746('0xf')](_0x7746('0x10'),_0x4d2138,_0x7746('0x11'),JSON[_0x7746('0x12')](_0x4d614f));if(_0x4d614f['error']){if(_0x4d614f[_0x7746('0x13')][_0x7746('0x14')]===0x1f4){logger[_0x7746('0x13')](_0x7746('0xe'),_0x4d2138,_0x4d614f[_0x7746('0x13')][_0x7746('0x15')]);return _0x2a8465(_0x4d614f[_0x7746('0x13')]['message']);}logger[_0x7746('0x13')](_0x7746('0xe'),_0x4d2138,_0x4d614f[_0x7746('0x13')][_0x7746('0x15')]);return _0x2359e9(_0x4d614f[_0x7746('0x13')]['message']);}else{logger['info'](_0x7746('0xe'),_0x4d2138,_0x7746('0x11'));_0x2359e9(_0x4d614f[_0x7746('0x16')][_0x7746('0x15')]);}})[_0x7746('0x17')](function(_0x7e90f1){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4d2138,_0x7e90f1);_0x2a8465(_0x7e90f1);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ba6ad45..a76bb99 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 _0x6080=['./chatGroup.events','save','remove','emit','register','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6080,0x13e));var _0x0608=function(_0x32e5dc,_0x2bbb52){_0x32e5dc=_0x32e5dc-0x0;var _0x3785b9=_0x6080[_0x32e5dc];return _0x3785b9;};'use strict';var ChatGroupEvents=require(_0x0608('0x0'));var events=[_0x0608('0x1'),_0x0608('0x2'),'update'];function createListener(_0x2d33be,_0x3bb447){return function(_0x171528){_0x3bb447[_0x0608('0x3')](_0x2d33be,_0x171528);};}function removeListener(_0x4afaee,_0x281c50){return function(){ChatGroupEvents['removeListener'](_0x4afaee,_0x281c50);};}exports[_0x0608('0x4')]=function(_0x46bc32){for(var _0x533729=0x0,_0x17724b=events[_0x0608('0x5')];_0x533729<_0x17724b;_0x533729++){var _0x4bb34e=events[_0x533729];var _0x273317=createListener('chatGroup:'+_0x4bb34e,_0x46bc32);ChatGroupEvents['on'](_0x4bb34e,_0x273317);}}; \ No newline at end of file +var _0x40a1=['removeListener','register','length','chatGroup:','./chatGroup.events','save','emit'];(function(_0x42a71a,_0x13d02f){var _0x351f8a=function(_0x476267){while(--_0x476267){_0x42a71a['push'](_0x42a71a['shift']());}};_0x351f8a(++_0x13d02f);}(_0x40a1,0x1af));var _0x140a=function(_0x58fce9,_0x2a3c32){_0x58fce9=_0x58fce9-0x0;var _0x16321f=_0x40a1[_0x58fce9];return _0x16321f;};'use strict';var ChatGroupEvents=require(_0x140a('0x0'));var events=[_0x140a('0x1'),'remove','update'];function createListener(_0x4ab700,_0x3be284){return function(_0x4d6ff){_0x3be284[_0x140a('0x2')](_0x4ab700,_0x4d6ff);};}function removeListener(_0x37daf7,_0x9504f){return function(){ChatGroupEvents[_0x140a('0x3')](_0x37daf7,_0x9504f);};}exports[_0x140a('0x4')]=function(_0x4da9b4){for(var _0x486b85=0x0,_0x42c31d=events[_0x140a('0x5')];_0x486b85<_0x42c31d;_0x486b85++){var _0x5bb97c=events[_0x486b85];var _0x43b070=createListener(_0x140a('0x6')+_0x5bb97c,_0x4da9b4);ChatGroupEvents['on'](_0x5bb97c,_0x43b070);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4b7fa4b..088ec0a 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 _0x29fa=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path'];(function(_0x14df77,_0x4d47a7){var _0x594c6e=function(_0x4ca29a){while(--_0x4ca29a){_0x14df77['push'](_0x14df77['shift']());}};_0x594c6e(++_0x4d47a7);}(_0x29fa,0x102));var _0xa29f=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0x29fa[_0xae1a83];return _0xdb9da8;};'use strict';var multer=require(_0xa29f('0x0'));var util=require(_0xa29f('0x1'));var path=require(_0xa29f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa29f('0x3')]();var auth=require(_0xa29f('0x4'));var interaction=require(_0xa29f('0x5'));var config=require(_0xa29f('0x6'));var controller=require(_0xa29f('0x7'));router[_0xa29f('0x8')]('/',auth[_0xa29f('0x9')](),controller[_0xa29f('0xa')]);router[_0xa29f('0x8')](_0xa29f('0xb'),auth[_0xa29f('0x9')](),controller[_0xa29f('0xc')]);router[_0xa29f('0x8')](_0xa29f('0xd'),auth[_0xa29f('0x9')](),controller[_0xa29f('0xe')]);router[_0xa29f('0x8')]('/:id/unread',auth['isAuthenticated'](),controller[_0xa29f('0xf')]);router[_0xa29f('0x8')](_0xa29f('0x10'),auth[_0xa29f('0x9')](),controller[_0xa29f('0x11')]);router[_0xa29f('0x8')](_0xa29f('0x12'),auth[_0xa29f('0x9')](),controller[_0xa29f('0x13')]);router[_0xa29f('0x14')]('/',auth['isAuthenticated'](),controller[_0xa29f('0x15')]);router['post'](_0xa29f('0x10'),auth[_0xa29f('0x9')](),controller['addMembers']);router[_0xa29f('0x14')](_0xa29f('0x12'),auth['isAuthenticated'](),controller[_0xa29f('0x16')]);router[_0xa29f('0x17')]('/:id',auth[_0xa29f('0x9')](),controller[_0xa29f('0x18')]);router[_0xa29f('0x19')](_0xa29f('0xd'),auth['isAuthenticated'](),controller[_0xa29f('0x1a')]);router[_0xa29f('0x19')](_0xa29f('0x10'),auth[_0xa29f('0x9')](),controller[_0xa29f('0x1b')]);module[_0xa29f('0x1c')]=router; \ No newline at end of file +var _0xf30a=['/:id/unread','getUnread','/:id/members','getMembers','getMessages','create','post','delete','destroy','removeMembers','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0xa1f3d9,_0x2a0fa4){var _0x5dcb0a=function(_0x52c7dd){while(--_0x52c7dd){_0xa1f3d9['push'](_0xa1f3d9['shift']());}};_0x5dcb0a(++_0x2a0fa4);}(_0xf30a,0xf1));var _0xaf30=function(_0x41e96f,_0x2ea27c){_0x41e96f=_0x41e96f-0x0;var _0x12348c=_0xf30a[_0x41e96f];return _0x12348c;};'use strict';var multer=require('multer');var util=require(_0xaf30('0x0'));var path=require('path');var timeout=require(_0xaf30('0x1'));var express=require(_0xaf30('0x2'));var router=express['Router']();var auth=require(_0xaf30('0x3'));var interaction=require(_0xaf30('0x4'));var config=require('../../config/environment');var controller=require(_0xaf30('0x5'));router[_0xaf30('0x6')]('/',auth[_0xaf30('0x7')](),controller[_0xaf30('0x8')]);router['get'](_0xaf30('0x9'),auth[_0xaf30('0x7')](),controller['describe']);router[_0xaf30('0x6')](_0xaf30('0xa'),auth['isAuthenticated'](),controller[_0xaf30('0xb')]);router[_0xaf30('0x6')](_0xaf30('0xc'),auth[_0xaf30('0x7')](),controller[_0xaf30('0xd')]);router[_0xaf30('0x6')](_0xaf30('0xe'),auth[_0xaf30('0x7')](),controller[_0xaf30('0xf')]);router[_0xaf30('0x6')]('/:id/messages',auth[_0xaf30('0x7')](),controller[_0xaf30('0x10')]);router['post']('/',auth[_0xaf30('0x7')](),controller[_0xaf30('0x11')]);router[_0xaf30('0x12')](_0xaf30('0xe'),auth[_0xaf30('0x7')](),controller['addMembers']);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['put'](_0xaf30('0xa'),auth[_0xaf30('0x7')](),controller['update']);router[_0xaf30('0x13')](_0xaf30('0xa'),auth[_0xaf30('0x7')](),controller[_0xaf30('0x14')]);router[_0xaf30('0x13')](_0xaf30('0xe'),auth[_0xaf30('0x7')](),controller[_0xaf30('0x15')]);module[_0xaf30('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index fbf4f84..0093e6a 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 _0xf960=['DATE','out','sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING'];(function(_0xdb5f0b,_0x354a7e){var _0x4a3c61=function(_0x3dd4db){while(--_0x3dd4db){_0xdb5f0b['push'](_0xdb5f0b['shift']());}};_0x4a3c61(++_0x354a7e);}(_0xf960,0x19c));var _0x0f96=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0xf960[_0x4996d5];return _0x4793f9;};'use strict';var Sequelize=require(_0x0f96('0x0'));module['exports']={'closed':{'type':Sequelize[_0x0f96('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0f96('0x2')]},'ratingType':{'type':Sequelize[_0x0f96('0x3')](_0x0f96('0x4'),_0x0f96('0x5')),'defaultValue':_0x0f96('0x4')},'ratingMessage':{'type':Sequelize[_0x0f96('0x6')]},'pathTranscript':{'type':Sequelize[_0x0f96('0x6')]},'mailTranscript':{'type':Sequelize[_0x0f96('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0f96('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x0f96('0x7')]},'browserVersion':{'type':Sequelize[_0x0f96('0x7')]},'osName':{'type':Sequelize[_0x0f96('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x0f96('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x0f96('0x7')]},'referer':{'type':Sequelize[_0x0f96('0x6')]},'customerIp':{'type':Sequelize[_0x0f96('0x7')]},'formData':{'type':Sequelize[_0x0f96('0x6')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x0f96('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x0f96('0x3')]('in',_0x0f96('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0f96('0x7')]},'customerPort':{'type':Sequelize[_0x0f96('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1ebb=['star','TEXT','STRING','DATE','long','out','exports','INTEGER','ENUM'];(function(_0x1cc911,_0xfd59a1){var _0x52ae87=function(_0x142b53){while(--_0x142b53){_0x1cc911['push'](_0x1cc911['shift']());}};_0x52ae87(++_0xfd59a1);}(_0x1ebb,0xe7));var _0xb1eb=function(_0x29d334,_0x53359c){_0x29d334=_0x29d334-0x0;var _0xd7d900=_0x1ebb[_0x29d334];return _0xd7d900;};'use strict';var Sequelize=require('sequelize');module[_0xb1eb('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb1eb('0x1')]},'ratingType':{'type':Sequelize[_0xb1eb('0x2')](_0xb1eb('0x3'),'thumb'),'defaultValue':_0xb1eb('0x3')},'ratingMessage':{'type':Sequelize[_0xb1eb('0x4')]},'pathTranscript':{'type':Sequelize[_0xb1eb('0x4')]},'mailTranscript':{'type':Sequelize[_0xb1eb('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb1eb('0x6')]},'disposition':{'type':Sequelize[_0xb1eb('0x5')]},'note':{'type':Sequelize[_0xb1eb('0x5')]},'browserName':{'type':Sequelize[_0xb1eb('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xb1eb('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xb1eb('0x5')]},'deviceType':{'type':Sequelize[_0xb1eb('0x5')]},'referer':{'type':Sequelize[_0xb1eb('0x4')]},'customerIp':{'type':Sequelize[_0xb1eb('0x5')]},'formData':{'type':Sequelize[_0xb1eb('0x4')](_0xb1eb('0x7'))},'read1stAt':{'type':Sequelize[_0xb1eb('0x6')]},'lastMsgAt':{'type':Sequelize[_0xb1eb('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb1eb('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xb1eb('0x5')]},'customerPort':{'type':Sequelize[_0xb1eb('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xb1eb('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c1196d7..ca217b2 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 _0x0a6b=['closed','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','attachId','download','server/files/attachments/','close','mailTranscript','join','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','CmContact','%s%d','agentAlias','customer','Visitor','website_alias','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','ids','omit','getMessages','ChatInteractionId','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','getMyMessages','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','Account','Owner','get','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','%s\x20#%d','YYYY-MM-DD','N.A.','closedAt','browserName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','views','toFile','transcript-','.pdf','log','err','html-pdf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','send','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','name','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','isEmpty','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','merge','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','params','intersection','include','options','create','update','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','abandon','Interaction\x20already\x20assigned'];(function(_0x2dcca3,_0x96a555){var _0x399c86=function(_0x4ecc84){while(--_0x4ecc84){_0x2dcca3['push'](_0x2dcca3['shift']());}};_0x399c86(++_0x96a555);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x13a8d6,_0x4e8ec9){_0x13a8d6=_0x13a8d6-0x0;var _0x23fed9=_0x0a6b[_0x13a8d6];return _0x23fed9;};'use strict';var pdf=require(_0xb0a6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb0a6('0x1'));var rp=require('request-promise');var moment=require(_0xb0a6('0x2'));var BPromise=require(_0xb0a6('0x3'));var Mustache=require(_0xb0a6('0x4'));var util=require('util');var path=require(_0xb0a6('0x5'));var sox=require('sox');var csv=require(_0xb0a6('0x6'));var ejs=require(_0xb0a6('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb0a6('0x8'));var crypto=require(_0xb0a6('0x9'));var jsforce=require(_0xb0a6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0a6('0xb'));var Redis=require(_0xb0a6('0xc'));var authService=require(_0xb0a6('0xd'));var qs=require(_0xb0a6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0a6('0xf'));var logger=require(_0xb0a6('0x10'))('api');var utils=require(_0xb0a6('0x11'));var config=require(_0xb0a6('0x12'));var db=require(_0xb0a6('0x13'))['db'];config[_0xb0a6('0x14')]=_[_0xb0a6('0x15')](config[_0xb0a6('0x14')],{'host':_0xb0a6('0x16'),'port':0x18eb});var socket=require(_0xb0a6('0x17'))(new Redis(config[_0xb0a6('0x14')]));require(_0xb0a6('0x18'))['register'](socket);var jayson=require(_0xb0a6('0x19'));var client=jayson['client'][_0xb0a6('0x1a')]({'port':0x232b});var client9004=jayson['client'][_0xb0a6('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x59730e,_0x1d837f,_0x382c2f){if(_0x382c2f){var _0x93243e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x93243e['test'](_0x1d837f)){return _0x59730e;}else{throw new db['Sequelize'][(_0xb0a6('0x1b'))](_0xb0a6('0x1c'));}}else{return _0x59730e;}}function respondWithRpcPromise(_0x59bc9c,_0x18f994,_0x10f504,_0x13a1c8){return new BPromise(function(_0x567dd5,_0x567811){var _0x883503=_0x13a1c8||client;return _0x883503[_0xb0a6('0x1d')](_0x59bc9c,_0x10f504)[_0xb0a6('0x1e')](function(_0x4406d0){logger[_0xb0a6('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x18f994,_0xb0a6('0x20'));logger[_0xb0a6('0x21')](_0xb0a6('0x22'),_0x18f994,_0xb0a6('0x20'),JSON[_0xb0a6('0x23')](_0x4406d0));if(_0x4406d0[_0xb0a6('0x24')]){if(_0x4406d0[_0xb0a6('0x24')][_0xb0a6('0x25')]===0x1f4){logger['error'](_0xb0a6('0x26'),_0x18f994,_0x4406d0['error'][_0xb0a6('0x27')]);return _0x567811(_0x4406d0[_0xb0a6('0x24')]['message']);}logger['error'](_0xb0a6('0x26'),_0x18f994,_0x4406d0[_0xb0a6('0x24')]['message']);return _0x567dd5(_0x4406d0[_0xb0a6('0x24')][_0xb0a6('0x27')]);}else{logger[_0xb0a6('0x1f')](_0xb0a6('0x26'),_0x18f994,'request\x20sent');_0x567dd5(_0x4406d0['result'][_0xb0a6('0x27')]);}})[_0xb0a6('0x28')](function(_0x22561f){logger['error'](_0xb0a6('0x26'),_0x18f994,_0x22561f);_0x567811(_0x22561f);});});}function respondWithStatusCode(_0x3347ac,_0x3edd9a){_0x3edd9a=_0x3edd9a||0xcc;return function(_0xc1c647){if(_0xc1c647){return _0x3347ac[_0xb0a6('0x29')](_0x3edd9a);}return _0x3347ac[_0xb0a6('0x2a')](_0x3edd9a)[_0xb0a6('0x2b')]();};}function respondWithResult(_0x305661,_0x4255b9){_0x4255b9=_0x4255b9||0xc8;return function(_0x4ced9f){if(_0x4ced9f){return _0x305661[_0xb0a6('0x2a')](_0x4255b9)[_0xb0a6('0x2c')](_0x4ced9f);}};}function respondWithFilteredResult(_0x3993bf,_0x5b4c65){return function(_0x31c332){if(_0x31c332){var _0x582fc2=_0x31c332[_0xb0a6('0x2d')],_0x131e46=_0x5b4c65[_0xb0a6('0x2e')],_0x309a91=_0x5b4c65[_0xb0a6('0x2e')]+_0x5b4c65[_0xb0a6('0x2f')],_0x114f91;if(_0x309a91>=_0x582fc2){_0x309a91=_0x582fc2;_0x114f91=0xc8;}else{_0x114f91=0xce;}_0x3993bf[_0xb0a6('0x2a')](_0x114f91);return _0x3993bf[_0xb0a6('0x30')](_0xb0a6('0x31'),_0x131e46+'-'+_0x309a91+'/'+_0x582fc2)['json'](_0x31c332);}return null;};}function patchUpdates(_0x57f408){return function(_0x4093f8){try{jsonpatch[_0xb0a6('0x32')](_0x4093f8,_0x57f408,!![]);}catch(_0x2b2818){return BPromise[_0xb0a6('0x33')](_0x2b2818);}return _0x4093f8[_0xb0a6('0x34')]();};}function saveUpdates(_0x3bc0a4,_0x1d0a08){return function(_0x41704d){if(_0x41704d){return _0x41704d['update'](_0x3bc0a4)[_0xb0a6('0x1e')](function(_0x16471f){return _0x16471f;});}return null;};}function removeEntity(_0x572cf7,_0x8502f8){return function(_0x88f3b1){if(_0x88f3b1){return _0x88f3b1['destroy']()['then'](function(){_0x572cf7[_0xb0a6('0x2a')](0xcc)[_0xb0a6('0x2b')]();});}};}function handleEntityNotFound(_0x472799,_0x13ebd8){return function(_0x4310ae){if(!_0x4310ae){_0x472799[_0xb0a6('0x29')](0x194);}return _0x4310ae;};}function handleError(_0x52b26e,_0xfb03c9){_0xfb03c9=_0xfb03c9||0x1f4;return function(_0x5c280e){logger[_0xb0a6('0x24')](_0x5c280e[_0xb0a6('0x35')]);if(_0x5c280e['name']){delete _0x5c280e['name'];}_0x52b26e['status'](_0xfb03c9)[_0xb0a6('0x36')](_0x5c280e);};}function getInteractionUsers(_0xd484f,_0xa9e807){return new BPromise(function(_0x236cc4,_0x1d09f7){try{if(_0xa9e807[_0xd484f['id']]){_0xd484f['Users']=_[_0xb0a6('0x37')](_0xa9e807[_0xd484f['id']],function(_0x3696d9){return{'id':_0x3696d9['id'],'fullname':_0x3696d9[_0xb0a6('0x38')]};});}}catch(_0x362752){_0x1d09f7(_0x362752);}_0x236cc4(_0xd484f);});}function getInteractionTags(_0x4ab405,_0x26ac9d){return new BPromise(function(_0x3ac17e,_0x410e50){try{if(_0x4ab405[_0xb0a6('0x39')]){_0x4ab405[_0xb0a6('0x3a')]=[];_0x4ab405['TagIds']['split'](',')[_0xb0a6('0x3b')](function(_0x1ae542){_0x4ab405[_0xb0a6('0x3a')][_0xb0a6('0x3c')](_0x26ac9d[_0x1ae542]);});}delete _0x4ab405[_0xb0a6('0x39')];}catch(_0x5f4cef){_0x410e50(_0x5f4cef);}_0x3ac17e(_0x4ab405);});}function updateChatInteraction(_0x22ad2a,_0x430738,_0x4f7022){return new BPromise(function(_0x1fe910,_0x2c3785){return getInteractionUsers(_0x22ad2a,_0x4f7022)[_0xb0a6('0x1e')](function(_0x3014df){return getInteractionTags(_0x3014df,_0x430738);})[_0xb0a6('0x1e')](function(_0x5f1687){_0x1fe910(_0x5f1687);})[_0xb0a6('0x28')](function(_0x50e5b1){_0x2c3785(_0x50e5b1);});});}exports[_0xb0a6('0x3d')]=function(_0x53a6d5,_0x144683){var _0x51ed50={},_0x2f94d8={},_0xf1045a={'count':0x0,'rows':[]};var _0x2de0d7=_[_0xb0a6('0x37')](db[_0xb0a6('0x3e')][_0xb0a6('0x3f')],function(_0x47a9a6){return{'name':_0x47a9a6[_0xb0a6('0x40')],'type':_0x47a9a6[_0xb0a6('0x41')][_0xb0a6('0x42')]};});_0x2f94d8[_0xb0a6('0x43')]=_[_0xb0a6('0x37')](_0x2de0d7,'name');_0x2f94d8[_0xb0a6('0x44')]=_[_0xb0a6('0x45')](_0x53a6d5['query']);_0x2f94d8[_0xb0a6('0x46')]=_['intersection'](_0x2f94d8[_0xb0a6('0x43')],_0x2f94d8[_0xb0a6('0x44')]);_0x51ed50[_0xb0a6('0x47')]=_['intersection'](_0x2f94d8[_0xb0a6('0x43')],qs[_0xb0a6('0x48')](_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x48')]));_0x51ed50[_0xb0a6('0x47')]=_0x51ed50[_0xb0a6('0x47')][_0xb0a6('0x49')]?_0x51ed50[_0xb0a6('0x47')]:_0x2f94d8['model'];if(!_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x4a')](_0xb0a6('0x4b'))){_0x51ed50[_0xb0a6('0x2f')]=qs['limit'](_0x53a6d5['query']['limit']);_0x51ed50['offset']=qs['offset'](_0x53a6d5['query']['offset']);}_0x51ed50[_0xb0a6('0x4c')]=qs[_0xb0a6('0x4d')](_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x4d')]);_0x51ed50[_0xb0a6('0x4e')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x4f')](_0x53a6d5[_0xb0a6('0x44')],_0x2f94d8[_0xb0a6('0x46')]),_0x2de0d7);var _0x204543=[];var _0x4761f6=squel[_0xb0a6('0x50')]()[_0xb0a6('0x51')]('id')[_0xb0a6('0x51')](_0xb0a6('0x52'))[_0xb0a6('0x51')]('color')[_0xb0a6('0x53')](_0xb0a6('0x54'));var _0x1a628a=squel[_0xb0a6('0x50')]()[_0xb0a6('0x51')](_0xb0a6('0x55'))[_0xb0a6('0x51')](_0xb0a6('0x56'))[_0xb0a6('0x51')]('ui.ChatInteractionId')['from'](_0xb0a6('0x57'),'ui')[_0xb0a6('0x58')](_0xb0a6('0x59'),'u','u.id\x20=\x20ui.UserId');var _0x3504e8=squel['select']()[_0xb0a6('0x53')](_0xb0a6('0x5a'),'i')['left_join'](_0xb0a6('0x5b'),'c',_0xb0a6('0x5c'))['left_join'](_0xb0a6('0x59'),'o','o.id\x20=\x20i.UserId')[_0xb0a6('0x58')]('chat_websites','a',_0xb0a6('0x5d'))[_0xb0a6('0x58')]('chat_messages','me',_0xb0a6('0x5e'))[_0xb0a6('0x58')](_0xb0a6('0x5f'),'it',_0xb0a6('0x60'))[_0xb0a6('0x58')]('tools_tags','t',_0xb0a6('0x61'));var _0x568169=squel[_0xb0a6('0x62')]();var _0x569ce3=[];var _0x488c27=squel[_0xb0a6('0x62')]();var _0x340aa3;if(_0x53a6d5['query'][_0xb0a6('0x63')]){_0x340aa3=as['parseSearch'](_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x63')]);var _0xd9eec6=_0x340aa3[_0xb0a6('0x64')];for(var _0x59fb5a=0x0;_0x59fb5a<_0x340aa3[_0xb0a6('0x65')][_0xb0a6('0x49')];_0x59fb5a++){var _0x362a0f=_0x340aa3[_0xb0a6('0x65')][_0x59fb5a];var _0x21da0d='i';var _0x4123e8=_['find'](_0x2de0d7,['name',_0x362a0f[_0xb0a6('0x51')]]);if(!_0x4123e8){switch(_0x362a0f['field']){case _0xb0a6('0x66'):if(_0x362a0f[_0xb0a6('0x67')]==0x1){_0x3504e8[_0xb0a6('0x68')]('`'+_0x362a0f['field']+_0xb0a6('0x69'));}else{_0x3504e8[_0xb0a6('0x68')]('`'+_0x362a0f['field']+_0xb0a6('0x6a'));}break;case _0xb0a6('0x6b'):if(_0x362a0f[_0xb0a6('0x6c')]===_0xb0a6('0x6d')){if(_0x362a0f[_0xb0a6('0x67')]['split']('\x20')[_0xb0a6('0x49')]>0x1){_0x568169[_0xd9eec6](_0xb0a6('0x6e'),qs['getFullTextValue'](_0x362a0f[_0xb0a6('0x67')]),null);}else{var _0x3f197a='%'+_0x362a0f[_0xb0a6('0x67')]+'%';_0x568169[_0xd9eec6](_0xb0a6('0x6f'),_0x3f197a,_0x3f197a,_0x3f197a);}}else{_0x4123e8=_[_0xb0a6('0x70')](_0x2de0d7,[_0xb0a6('0x52'),_0xb0a6('0x71')]);_0x362a0f[_0xb0a6('0x51')]=_0xb0a6('0x71');_0x2f2b44=as[_0xb0a6('0x72')](_0x21da0d,_0x4123e8[_0xb0a6('0x41')],_0x362a0f);_0x568169[_0xd9eec6](_0x2f2b44[_0xb0a6('0x73')],_0x2f2b44['value'][_0xb0a6('0x74')],_0x2f2b44['value'][_0xb0a6('0x2b')]);}break;case _0xb0a6('0x75'):var _0x156c47=_0x362a0f[_0xb0a6('0x67')]['split'](',')[_0xb0a6('0x37')](function(_0x1363e9){return Number(_0x1363e9);});_0x156c47[_0xb0a6('0x3b')](function(_0x3060c6){_0x488c27['or'](_0xb0a6('0x76'),'%,'+_0x3060c6+',%');});_0x569ce3=_[_0xb0a6('0x77')](_0x569ce3,_0x156c47);break;case _0xb0a6('0x78'):if(_0x362a0f[_0xb0a6('0x6c')]===_0xb0a6('0x6d')){_0x568169[_0xd9eec6](_0xb0a6('0x79'),'%'+_0x362a0f[_0xb0a6('0x67')]+'%',null);}else{_0x4123e8=_[_0xb0a6('0x70')](_0x2de0d7,[_0xb0a6('0x52'),_0xb0a6('0x7a')]);_0x362a0f[_0xb0a6('0x51')]=_0xb0a6('0x7a');_0x2f2b44=as[_0xb0a6('0x72')](_0x21da0d,_0x4123e8[_0xb0a6('0x41')],_0x362a0f);_0x568169[_0xd9eec6](_0x2f2b44['text'],_0x2f2b44[_0xb0a6('0x67')][_0xb0a6('0x74')],_0x2f2b44[_0xb0a6('0x67')][_0xb0a6('0x2b')]);}break;case _0xb0a6('0x7b'):_0x2f2b44=as[_0xb0a6('0x72')]('me',null,_0x362a0f);_0x568169[_0xd9eec6](_0x2f2b44['text'],_0x2f2b44['value'][_0xb0a6('0x74')],_0x2f2b44[_0xb0a6('0x67')][_0xb0a6('0x2b')]);break;}}else{var _0x2f2b44=as['buildExpression'](_0x21da0d,_0x4123e8[_0xb0a6('0x41')],_0x362a0f);_0x568169[_0xd9eec6](_0x2f2b44[_0xb0a6('0x73')],_0x2f2b44[_0xb0a6('0x67')][_0xb0a6('0x74')],_0x2f2b44[_0xb0a6('0x67')][_0xb0a6('0x2b')]);}}}else{var _0x238ca4=_(_0x53a6d5['query'])[_0xb0a6('0x45')]()[_0xb0a6('0x37')](function(_0x5c8b57){return _['some'](_0x2de0d7,[_0xb0a6('0x52'),_0x5c8b57])?_0x5c8b57:undefined;})['compact']()[_0xb0a6('0x67')]();if(!_[_0xb0a6('0x7c')](_0x238ca4)){_0x238ca4[_0xb0a6('0x3b')](function(_0x438a8b){if(_0x438a8b==='ChatWebsiteId'){_0x3504e8[_0xb0a6('0x4e')]('i.ChatWebsiteId\x20IN\x20?',[][_0xb0a6('0x7d')](_0x53a6d5[_0xb0a6('0x44')][_0x438a8b]));}else if(_0x438a8b==='createdAt'){var _0x51eee7=JSON[_0xb0a6('0x7e')](_0x53a6d5[_0xb0a6('0x44')][_0x438a8b])[_0xb0a6('0x7f')];var _0x59827b=JSON['parse'](_0x53a6d5['query'][_0x438a8b])[_0xb0a6('0x80')];_0x3504e8['where'](_0xb0a6('0x81'),_0x51eee7,_0x59827b);}else{if(_0x53a6d5[_0xb0a6('0x44')][_0x438a8b]===_0xb0a6('0x82')){_0x3504e8['where']('i.'+_0x438a8b+_0xb0a6('0x83'));}else{_0x3504e8[_0xb0a6('0x4e')]('i.'+_0x438a8b+_0xb0a6('0x84'),_0x53a6d5[_0xb0a6('0x44')][_0x438a8b]);}}});}if(_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x85')]){if(_0x53a6d5[_0xb0a6('0x44')]['read']==0x1){_0x3504e8['having'](_0xb0a6('0x86'));}else{_0x3504e8[_0xb0a6('0x68')](_0xb0a6('0x87'));}}if(_0x53a6d5[_0xb0a6('0x44')]['tag']){_0x569ce3=_['isArray'](_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x88')])?_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x88')]:new Array(_0x53a6d5[_0xb0a6('0x44')]['tag']);_0x569ce3[_0xb0a6('0x3b')](function(_0x33f3ad){_0x488c27['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x33f3ad+',%');});}if(_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x89')]){var _0x1dc58c=_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x89')][_0xb0a6('0x8a')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xb0a6('0x8b'));if(qs[_0xb0a6('0x8c')](_0x1dc58c)){_0x568169['or'](_0xb0a6('0x8d'),_0x1dc58c+'%');}else{_0x568169['or'](_0xb0a6('0x8e'),qs[_0xb0a6('0x8f')](_0x1dc58c))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1dc58c+'%');}}}_0x3504e8['where'](_0x568169);_0x3504e8[_0xb0a6('0x90')]('i.id');var _0x2d4124={'type':db['Sequelize'][_0xb0a6('0x91')]['SELECT'],'raw':!![]};var _0x17a9de=_0x3504e8[_0xb0a6('0x92')]();_0x17a9de[_0xb0a6('0x51')](_0xb0a6('0x93'));_0x17a9de[_0xb0a6('0x51')](_0xb0a6('0x94'),_0xb0a6('0x66'));if(_0x51ed50[_0xb0a6('0x4c')]){_0x51ed50[_0xb0a6('0x4c')][_0xb0a6('0x3b')](function(_0x5aa27d){_0x3504e8['order']('i.'+_0x5aa27d[0x0],_0x5aa27d[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb0a6('0x7c')](_0x569ce3)){_0x3504e8[_0xb0a6('0x68')](_0x488c27);_0x17a9de[_0xb0a6('0x4e')](_0xb0a6('0x95'),_0x569ce3);}BPromise['resolve']()[_0xb0a6('0x1e')](function(){if(!_0x340aa3){if(_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x96')]||_0x53a6d5[_0xb0a6('0x44')][_0xb0a6('0x97')])return;_0x17a9de['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3504e8[_0xb0a6('0x4e')](_0xb0a6('0x98'));return;}return _0x53a6d5[_0xb0a6('0x99')][_0xb0a6('0x9a')]({'attributes':['id'],'raw':!![]})[_0xb0a6('0x1e')](function(_0x174383){if(_['isEmpty'](_0x174383)){_0x17a9de['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x3504e8[_0xb0a6('0x4e')](_0xb0a6('0x9b'));}else{_0x17a9de[_0xb0a6('0x4e')](_0xb0a6('0x9c'),_[_0xb0a6('0x37')](_0x174383,'id'));_0x3504e8[_0xb0a6('0x4e')](_0xb0a6('0x9c'),_['map'](_0x174383,'id'));}});})[_0xb0a6('0x1e')](function(){db[_0xb0a6('0x9d')][_0xb0a6('0x44')](_0x17a9de[_0xb0a6('0x9e')](),_0x2d4124)[_0xb0a6('0x1e')](function(_0x449b28){_0xf1045a['count']=_0x449b28[_0xb0a6('0x49')];if(_0xf1045a[_0xb0a6('0x2d')]===0x0)return[];return db[_0xb0a6('0x9d')][_0xb0a6('0x44')](_0x4761f6[_0xb0a6('0x9e')](),_0x2d4124)[_0xb0a6('0x1e')](function(_0x1afa65){_0x204543=_['keyBy'](_0x1afa65,'id');_0x2d4124=_[_0xb0a6('0x9f')](_0x2d4124,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53a6d5[_0xb0a6('0x44')]['fields']){_0x51ed50[_0xb0a6('0x47')][_0xb0a6('0x3b')](function(_0x24f82a){_0x3504e8[_0xb0a6('0x51')]('i.'+_0x24f82a);});}else{_0x3504e8[_0xb0a6('0x51')](_0xb0a6('0x94'),_0xb0a6('0x66'));_0x3504e8[_0xb0a6('0x51')]('a.key',_0xb0a6('0xa0'));_0x3504e8[_0xb0a6('0x51')]('a.mandatoryDisposition',_0xb0a6('0xa1'));_0x3504e8[_0xb0a6('0x51')]('i.*');_0x3504e8['field'](_0xb0a6('0xa2'),'Contact.firstName');_0x3504e8[_0xb0a6('0x51')](_0xb0a6('0xa3'),_0xb0a6('0xa4'));_0x3504e8[_0xb0a6('0x51')](_0xb0a6('0xa5'),_0xb0a6('0xa6'));_0x3504e8['field'](_0xb0a6('0xa7'),_0xb0a6('0xa8'));_0x3504e8['field']('c.mobile',_0xb0a6('0xa9'));_0x3504e8[_0xb0a6('0x51')](_0xb0a6('0xaa'),_0xb0a6('0xab'));_0x3504e8[_0xb0a6('0x51')](_0xb0a6('0xac'),'Owner.fullname');_0x3504e8[_0xb0a6('0x51')]('o.internal',_0xb0a6('0xad'));_0x3504e8[_0xb0a6('0x51')](_0xb0a6('0xae'),'TagIds');}if(_0x51ed50['limit'])_0x3504e8['limit'](_0x51ed50[_0xb0a6('0x2f')]);if(_0x51ed50[_0xb0a6('0x2e')])_0x3504e8[_0xb0a6('0x2e')](_0x51ed50[_0xb0a6('0x2e')]);return db[_0xb0a6('0x9d')][_0xb0a6('0x44')](_0x3504e8[_0xb0a6('0x9e')](),_0x2d4124);})[_0xb0a6('0x1e')](function(_0xcc583b){_0x1a628a[_0xb0a6('0x4e')](_0xb0a6('0xaf'),_[_0xb0a6('0x37')](_0xcc583b,'id'));return db[_0xb0a6('0x9d')][_0xb0a6('0x44')](_0x1a628a['toString'](),_0x2d4124)[_0xb0a6('0x1e')](function(_0x49e431){var _0x29bebb=_[_0xb0a6('0xb0')](_0x49e431,'ChatInteractionId');var _0x27badc=[];_0xcc583b[_0xb0a6('0x3b')](function(_0x3ce528){_0x27badc[_0xb0a6('0x3c')](updateChatInteraction(_0x3ce528,_0x204543,_0x29bebb));});return BPromise[_0xb0a6('0xb1')](_0x27badc);});});})[_0xb0a6('0x1e')](function(_0x1e6ec8){_0xf1045a['rows']=_0x1e6ec8;return _0xf1045a;})['then'](respondWithFilteredResult(_0x144683,_0x51ed50));})[_0xb0a6('0x28')](handleError(_0x144683,null));};exports['show']=function(_0x38b9ba,_0x2705d3){var _0x348090={'raw':![],'where':{'id':_0x38b9ba[_0xb0a6('0xb2')]['id']}},_0x24b81c={};_0x24b81c[_0xb0a6('0x43')]=_[_0xb0a6('0x45')](db[_0xb0a6('0x3e')][_0xb0a6('0x3f')]);_0x24b81c[_0xb0a6('0x44')]=_[_0xb0a6('0x45')](_0x38b9ba[_0xb0a6('0x44')]);_0x24b81c[_0xb0a6('0x46')]=_[_0xb0a6('0xb3')](_0x24b81c[_0xb0a6('0x43')],_0x24b81c[_0xb0a6('0x44')]);_0x348090[_0xb0a6('0x47')]=_[_0xb0a6('0xb3')](_0x24b81c[_0xb0a6('0x43')],qs[_0xb0a6('0x48')](_0x38b9ba[_0xb0a6('0x44')][_0xb0a6('0x48')]));_0x348090[_0xb0a6('0x47')]=_0x348090[_0xb0a6('0x47')][_0xb0a6('0x49')]?_0x348090[_0xb0a6('0x47')]:_0x24b81c[_0xb0a6('0x43')];if(_0x38b9ba[_0xb0a6('0x44')]['includeAll']){_0x348090[_0xb0a6('0xb4')]=[{'all':!![]}];}_0x348090=_['merge']({},_0x348090,_0x38b9ba[_0xb0a6('0xb5')]);return db[_0xb0a6('0x3e')][_0xb0a6('0x70')](_0x348090)['then'](handleEntityNotFound(_0x2705d3,null))['then'](respondWithResult(_0x2705d3,null))['catch'](handleError(_0x2705d3,null));};exports[_0xb0a6('0xb6')]=function(_0x30fc1e,_0x107d93){return db[_0xb0a6('0x3e')][_0xb0a6('0xb6')](_0x30fc1e[_0xb0a6('0x7b')],{})['then'](respondWithResult(_0x107d93,0xc9))[_0xb0a6('0x28')](handleError(_0x107d93,null));};exports[_0xb0a6('0xb7')]=function(_0x34834a,_0x42b177){if(_0x34834a['body']['id']){delete _0x34834a['body']['id'];}return db[_0xb0a6('0x3e')][_0xb0a6('0x70')]({'where':{'id':_0x34834a[_0xb0a6('0xb2')]['id']}})['then'](handleEntityNotFound(_0x42b177,null))['then'](saveUpdates(_0x34834a[_0xb0a6('0x7b')],null))[_0xb0a6('0x1e')](respondWithResult(_0x42b177,null))['catch'](handleError(_0x42b177,null));};exports['destroy']=function(_0x333c9e,_0x5628b5){return db[_0xb0a6('0x3e')][_0xb0a6('0x70')]({'where':{'id':_0x333c9e[_0xb0a6('0xb2')]['id']}})['then'](handleEntityNotFound(_0x5628b5,null))[_0xb0a6('0x1e')](removeEntity(_0x5628b5,null))[_0xb0a6('0x28')](handleError(_0x5628b5,null));};exports[_0xb0a6('0xb8')]=function(_0x1eb8ac,_0x4be9ff){return db[_0xb0a6('0x3e')][_0xb0a6('0xb8')]()[_0xb0a6('0x1e')](respondWithResult(_0x4be9ff,null))['catch'](handleError(_0x4be9ff,null));};exports[_0xb0a6('0xb9')]=function(_0x38fd92,_0x1ccea3){var _0x5c161c=_0x38fd92[_0xb0a6('0xb2')]['id'];var _0xdf322f;var _0x4bd896;var _0x2b71e1;return db['ChatInteraction']['findOne']({'where':{'id':_0x5c161c}})[_0xb0a6('0x1e')](function(_0x50d739){_0xdf322f=_0x50d739;return db[_0xb0a6('0xba')][_0xb0a6('0xbb')]({'where':{'id':_0x50d739[_0xb0a6('0x96')]},'attributes':['id',_0xb0a6('0xbc'),'vidaooEscalation'],'raw':!![]});})[_0xb0a6('0x1e')](function(_0x3b0183){if(_0x3b0183&&_0x3b0183[_0xb0a6('0xbc')]&&_0x3b0183[_0xb0a6('0xbd')]){_0x4bd896=_0x3b0183;var _0x110e3e={'rejectUnauthorized':![],'method':'POST','uri':_0xb0a6('0xbe'),'headers':{'X-APIKEY':_0x3b0183[_0xb0a6('0xbc')]},'body':{'name':'MotionCWB:'+_0x5c161c},'redirect':'follow','json':!![]};return rp(_0x110e3e);}else{throw new db[(_0xb0a6('0xbf'))][(_0xb0a6('0x1b'))](_0xb0a6('0xc0'));}})[_0xb0a6('0x1e')](function(_0x589bc5){_0x2b71e1=_0x589bc5;if(_0x2b71e1['id']){var _0x24e533={'body':_0x2b71e1[_0xb0a6('0xc1')],'ChatWebsiteId':_0x4bd896['id'],'ChatInteractionId':_0xdf322f['id'],'direction':_0xb0a6('0xc2'),'UserId':_0x38fd92[_0xb0a6('0x99')]['id']};return db[_0xb0a6('0xc3')]['create'](_0x24e533,{});}else{throw new db[(_0xb0a6('0xbf'))][(_0xb0a6('0x1b'))](_0xb0a6('0xc4'));}})['then'](function(){return _0xdf322f['updateAttributes']({'vidaooSessionId':_0x2b71e1['id']});})[_0xb0a6('0x1e')](respondWithResult(_0x1ccea3,null))[_0xb0a6('0x28')](handleError(_0x1ccea3,null));};exports[_0xb0a6('0xc5')]=function(_0xf756a0,_0xd02f48){if(_0xf756a0['body']['id']){delete _0xf756a0[_0xb0a6('0x7b')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0xf756a0[_0xb0a6('0xb2')]['id']}})[_0xb0a6('0x1e')](handleEntityNotFound(_0xd02f48,null))[_0xb0a6('0x1e')](saveUpdates(_0xf756a0['body'],null))[_0xb0a6('0x1e')](respondWithResult(_0xd02f48,null))[_0xb0a6('0x28')](handleError(_0xd02f48,null));};exports[_0xb0a6('0xc6')]=function(_0x242074,_0x176ce0,_0x21249d){if(_0x242074[_0xb0a6('0x7b')]['id']){delete _0x242074[_0xb0a6('0x7b')]['id'];}return db[_0xb0a6('0x3e')]['find']({'where':{'id':_0x242074[_0xb0a6('0xb2')]['id']}})[_0xb0a6('0x1e')](function(_0x45ceaf){if(!_0x45ceaf){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xb0a6('0xc6'),0x194,'entity\x20not\x20found');_0x176ce0[_0xb0a6('0x29')](0x194);}else{if(_0x45ceaf[_0xb0a6('0x7a')]){throw new db[(_0xb0a6('0xbf'))][(_0xb0a6('0x1b'))](_0xb0a6('0xc7'));}}return _0x45ceaf;})[_0xb0a6('0x1e')](function(_0x42f6c1){if(_0x42f6c1){return _0x42f6c1[_0xb0a6('0xb7')]({'closed':_0x242074[_0xb0a6('0x7b')][_0xb0a6('0xc8')],'disposition':_0x242074['body'][_0xb0a6('0xc9')]})[_0xb0a6('0x1e')](function(_0x5262e5){return _0x5262e5;});}})[_0xb0a6('0x1e')](function(_0x3a35fb){return respondWithRpcPromise(_0xb0a6('0xca'),'abandon',_0x242074[_0xb0a6('0x7b')],client9004);})['then'](respondWithResult(_0x176ce0,null))[_0xb0a6('0x28')](handleError(_0x176ce0,null));};exports['attachmentUpload']=function(_0x29e1ba,_0x311a11,_0xbbfea5){_0x29e1ba[_0xb0a6('0x7b')][_0xb0a6('0x52')]=_0x29e1ba[_0xb0a6('0xcb')][_0xb0a6('0xcc')];_0x29e1ba['body'][_0xb0a6('0xcd')]=_0x29e1ba[_0xb0a6('0xcb')][_0xb0a6('0xce')];_0x29e1ba[_0xb0a6('0x7b')][_0xb0a6('0x41')]=_0x29e1ba['file'][_0xb0a6('0xcf')];return db['Attachment'][_0xb0a6('0xb6')](_0x29e1ba[_0xb0a6('0x7b')])[_0xb0a6('0x1e')](respondWithResult(_0x311a11,0xc9))[_0xb0a6('0x28')](handleError(_0x311a11,null));};exports[_0xb0a6('0xd0')]=function(_0x447084,_0x15e737,_0x118a6e){return db[_0xb0a6('0x3e')][_0xb0a6('0xbb')]({'where':{'id':_0x447084[_0xb0a6('0xb2')]['id']},'raw':!![]})[_0xb0a6('0x1e')](handleEntityNotFound(_0x15e737,null))[_0xb0a6('0x1e')](function(_0x3fbffb){if(_0x3fbffb){if(_0x3fbffb[_0xb0a6('0xc8')]){return _0x15e737['status'](0x193)['json']({'status':0x193,'message':_0xb0a6('0xd1')});}return db['Attachment']['findOne']({'where':{'id':_0x447084['query'][_0xb0a6('0xd2')]},'raw':!![]})['then'](handleEntityNotFound(_0x15e737,null));}})[_0xb0a6('0x1e')](function(_0x177838){if(_0x177838){return _0x15e737[_0xb0a6('0xd3')](path['join'](config['root'],_0xb0a6('0xd4'),_0x177838['basename']));}})[_0xb0a6('0x28')](handleError(_0x15e737,null));};exports[_0xb0a6('0xd5')]=function(_0x153c51,_0x1fb737){var _0x19e0a0=null;var _0xdcf578=null;var _0x13bf41=null;var _0x316e31=null;if(_0x153c51[_0xb0a6('0x7b')]['id']){delete _0x153c51[_0xb0a6('0x7b')]['id'];}if(_0x153c51[_0xb0a6('0x7b')][_0xb0a6('0xd6')]){_0x316e31=path[_0xb0a6('0xd7')](config[_0xb0a6('0xd8')],_0xb0a6('0xd9'),util[_0xb0a6('0xda')](_0xb0a6('0xdb'),Date[_0xb0a6('0xdc')]()));_0x153c51['body'][_0xb0a6('0xdd')]=_0x316e31;}return db['ChatInteraction'][_0xb0a6('0x70')]({'where':{'id':_0x153c51[_0xb0a6('0xb2')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xb0a6('0x78')],'as':_0xb0a6('0x78')}]}]})['then'](handleEntityNotFound(_0x1fb737,null))[_0xb0a6('0x1e')](saveUpdates(_0x153c51[_0xb0a6('0x7b')],null))['then'](function(_0x352d3a){if(_0x352d3a){_0x19e0a0=_0x352d3a;return db[_0xb0a6('0xba')][_0xb0a6('0x70')]({'where':{'id':_0x19e0a0[_0xb0a6('0x96')]}});}})[_0xb0a6('0x1e')](function(_0x3add6b){if(_0x3add6b){_0x13bf41=_0x3add6b;return db[_0xb0a6('0xde')]['find']({'where':{'id':_0x19e0a0['ContactId']}});}})[_0xb0a6('0x1e')](function(_0x3c5e8e){if(_0x3c5e8e){_0xdcf578=_0x3c5e8e;if(_0x316e31){var _0x4e4652=null;for(var _0x358165=0x1;_0x358165<_0x19e0a0['Messages'][_0xb0a6('0x49')];++_0x358165){_0x4e4652=_0x19e0a0['Messages'][_0x358165];var _0xea12ea=_0x4e4652[_0xb0a6('0x7a')]?util['format'](_0xb0a6('0xdf'),_0x13bf41[_0xb0a6('0xe0')],_0x4e4652[_0xb0a6('0x7a')]):'System';var _0x415d40=_0x153c51[_0xb0a6('0x7b')][_0xb0a6('0xe1')]||util[_0xb0a6('0xda')](_0xb0a6('0xdf'),_0xb0a6('0xe2'),_0x4e4652[_0xb0a6('0x71')]);switch(_0x13bf41['agentIdentifier']){case _0xb0a6('0xe3'):_0xea12ea=_0x4e4652['UserId']?util[_0xb0a6('0xda')](_0xb0a6('0xdf'),_0x13bf41[_0xb0a6('0xe0')],_0x4e4652[_0xb0a6('0x7a')]):_0xb0a6('0xe4');break;case'agent_alias':_0xea12ea=_0x4e4652['UserId']?_0x4e4652[_0xb0a6('0x78')][_0xb0a6('0xe5')]||_0x4e4652[_0xb0a6('0x78')]['fullname']:_0xb0a6('0xe4');break;case _0xb0a6('0xe6'):_0xea12ea=_0x4e4652[_0xb0a6('0x7a')]?_0x4e4652[_0xb0a6('0x78')][_0xb0a6('0x38')]:_0xb0a6('0xe4');break;default:_0xea12ea=_0x4e4652['UserId']?util[_0xb0a6('0xda')](_0xb0a6('0xdf'),_0x13bf41[_0xb0a6('0xe0')],_0x4e4652[_0xb0a6('0x7a')]):'System';}var _0x34fad3=util[_0xb0a6('0xda')](_0xb0a6('0xe7'),moment(_0x4e4652[_0xb0a6('0xe8')])[_0xb0a6('0xda')](_0xb0a6('0xe9')),_0x4e4652[_0xb0a6('0xea')]==='in'?_0x415d40:_0xea12ea,_0x4e4652[_0xb0a6('0x7b')]);if(!_0x4e4652[_0xb0a6('0xeb')]){fs['appendFileSync'](_0x316e31,_0x34fad3);}}return db[_0xb0a6('0xec')][_0xb0a6('0xbb')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb0a6('0xed'),'raw':!![]}]});}}})[_0xb0a6('0x1e')](function(_0x155034){if(_0x155034&&_0x155034[_0xb0a6('0xed')]&&_0x153c51[_0xb0a6('0x7b')]){var _0x2b2abd={'tls':{'rejectUnauthorized':![]}};if(_0x155034['Smtp']['service']){_0x2b2abd[_0xb0a6('0xee')]=_0x155034[_0xb0a6('0xed')][_0xb0a6('0xee')];}else{_0x2b2abd[_0xb0a6('0xef')]=_0x155034[_0xb0a6('0xed')][_0xb0a6('0xef')];_0x2b2abd[_0xb0a6('0xf0')]=_0x155034[_0xb0a6('0xed')]['port'];_0x2b2abd[_0xb0a6('0xf1')]=_0x155034['Smtp'][_0xb0a6('0xf1')];}if(_0x155034[_0xb0a6('0xed')][_0xb0a6('0xf2')]){_0x2b2abd[_0xb0a6('0xf3')]={'user':_0x155034['Smtp'][_0xb0a6('0x99')],'pass':_0x155034['Smtp'][_0xb0a6('0xf4')]};}return respondWithRpcPromise(_0xb0a6('0xf5'),_0xb0a6('0xf6'),{'account':_0x2b2abd,'message':{'from':util[_0xb0a6('0xda')](_0xb0a6('0xf7'),_0x155034['name'],_0x155034[_0xb0a6('0xf8')]||_0x155034['Smtp'][_0xb0a6('0x99')]),'to':_0x153c51[_0xb0a6('0x7b')][_0xb0a6('0xd6')],'subject':_0xb0a6('0xf9'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x153c51[_0xb0a6('0x7b')][_0xb0a6('0xd6')]),'attachments':[{'path':_0x316e31}]}})[_0xb0a6('0x1e')](function(){return _0x19e0a0;})['catch'](function(_0x1de64c){console['error'](_0x1de64c);});}else{return _0x19e0a0;}})[_0xb0a6('0x1e')](respondWithStatusCode(_0x1fb737,0xc8))[_0xb0a6('0x28')](handleError(_0x1fb737,null));};exports[_0xb0a6('0xfa')]=function(_0x12f372,_0x5372f3,_0x1594c6){return db[_0xb0a6('0xc3')][_0xb0a6('0x70')]({'where':{'id':_0x12f372[_0xb0a6('0xb2')]['id']}})[_0xb0a6('0x1e')](handleEntityNotFound(_0x5372f3,null))[_0xb0a6('0x1e')](function(_0x5be5d1){if(_0x5be5d1){return _0x5be5d1[_0xb0a6('0xfa')](_0x12f372['body'][_0xb0a6('0xfb')],_[_0xb0a6('0xfc')](_0x12f372[_0xb0a6('0x7b')],['ids','id'])||{});}})[_0xb0a6('0x1e')](respondWithResult(_0x5372f3,null))[_0xb0a6('0x28')](handleError(_0x5372f3,null));};exports[_0xb0a6('0xfd')]=function(_0x25ec7d,_0x238823,_0x3d90ed){var _0x441ed5={'raw':![],'where':{}};var _0x31e451={};var _0x122f50={'count':0x0,'rows':[]};return db[_0xb0a6('0x3e')][_0xb0a6('0xbb')]({'where':{'id':_0x25ec7d[_0xb0a6('0xb2')]['id']}})[_0xb0a6('0x1e')](handleEntityNotFound(_0x238823,null))[_0xb0a6('0x1e')](function(_0x331523){if(_0x331523){_0x31e451[_0xb0a6('0x43')]=_[_0xb0a6('0x45')](db[_0xb0a6('0xc3')][_0xb0a6('0x3f')]);_0x31e451[_0xb0a6('0x44')]=_[_0xb0a6('0x45')](_0x25ec7d[_0xb0a6('0x44')]);_0x31e451['filters']=_['intersection'](_0x31e451[_0xb0a6('0x43')],_0x31e451['query']);_0x441ed5['attributes']=_['intersection'](_0x31e451[_0xb0a6('0x43')],qs['fields'](_0x25ec7d[_0xb0a6('0x44')][_0xb0a6('0x48')]));_0x441ed5[_0xb0a6('0x47')]=_0x441ed5['attributes'][_0xb0a6('0x49')]?_0x441ed5[_0xb0a6('0x47')]:_0x31e451['model'];if(!_0x25ec7d[_0xb0a6('0x44')]['hasOwnProperty'](_0xb0a6('0x4b'))){_0x441ed5[_0xb0a6('0x2f')]=qs['limit'](_0x25ec7d['query'][_0xb0a6('0x2f')]);_0x441ed5[_0xb0a6('0x2e')]=qs[_0xb0a6('0x2e')](_0x25ec7d[_0xb0a6('0x44')][_0xb0a6('0x2e')]);}_0x441ed5[_0xb0a6('0x4c')]=qs['sort'](_0x25ec7d[_0xb0a6('0x44')][_0xb0a6('0x4d')]);_0x441ed5['where']=qs[_0xb0a6('0x46')](_[_0xb0a6('0x4f')](_0x25ec7d['query'],_0x31e451['filters']));_0x441ed5[_0xb0a6('0x4e')][_0xb0a6('0xfe')]=_0x331523['id'];if(_0x25ec7d[_0xb0a6('0x44')]['filter']){_0x441ed5['where']=_[_0xb0a6('0x9f')](_0x441ed5['where'],{'$or':_['map'](_0x441ed5[_0xb0a6('0x47')],function(_0x532f55){var _0x655e15={};_0x655e15[_0x532f55]={'$like':'%'+_0x25ec7d[_0xb0a6('0x44')][_0xb0a6('0x89')]+'%'};return _0x655e15;})});}if(_0x25ec7d['query'][_0xb0a6('0x7f')]){var _0x191908=_0x25ec7d[_0xb0a6('0x44')]['$gte'][_0xb0a6('0xff')](',');var _0x1af48e={};_0x1af48e[_0x191908[0x0]]={'$gte':moment(_0x191908[0x1])[_0xb0a6('0xda')](_0xb0a6('0x100'))};_0x441ed5['where']=_[_0xb0a6('0x9f')](_0x441ed5[_0xb0a6('0x4e')],_0x1af48e);}_0x441ed5=_['merge']({},_0x441ed5,_0x25ec7d[_0xb0a6('0xb5')]);return db['ChatMessage'][_0xb0a6('0x2d')]({'where':_0x441ed5[_0xb0a6('0x4e')]})[_0xb0a6('0x1e')](function(_0x15edd5){_0x122f50[_0xb0a6('0x2d')]=_0x15edd5;if(_0x25ec7d[_0xb0a6('0x44')][_0xb0a6('0x101')]){_0x441ed5['include']=[{'all':!![]}];}return db[_0xb0a6('0xc3')][_0xb0a6('0x102')](_0x441ed5);})[_0xb0a6('0x1e')](function(_0x584d0a){_0x122f50[_0xb0a6('0x103')]=_0x584d0a;return _0x122f50;});}})['then'](respondWithFilteredResult(_0x238823,_0x441ed5))[_0xb0a6('0x28')](handleError(_0x238823,null));};exports[_0xb0a6('0x104')]=function(_0x11b713,_0x5b9788,_0x143f2b){var _0x11b7d7={'where':{}},_0x153ddc={},_0x4530a5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb0a6('0xbb')]({'where':{'id':_0x11b713[_0xb0a6('0xb2')]['id']}})['then'](handleEntityNotFound(_0x5b9788,null))[_0xb0a6('0x1e')](function(_0x470848){if(_0x470848){_0x153ddc[_0xb0a6('0x43')]=_['keys'](db[_0xb0a6('0xc3')]['rawAttributes']);_0x153ddc[_0xb0a6('0x44')]=_['keys'](_0x11b713[_0xb0a6('0x44')]);_0x153ddc[_0xb0a6('0x46')]=_['intersection'](_0x153ddc[_0xb0a6('0x43')],_0x153ddc[_0xb0a6('0x44')]);_0x11b7d7[_0xb0a6('0x47')]=_[_0xb0a6('0xb3')](_0x153ddc[_0xb0a6('0x43')],qs[_0xb0a6('0x48')](_0x11b713['query'][_0xb0a6('0x48')]));_0x11b7d7['attributes']=_0x11b7d7[_0xb0a6('0x47')][_0xb0a6('0x49')]?_0x11b7d7[_0xb0a6('0x47')]:_0x153ddc[_0xb0a6('0x43')];if(!_0x11b713[_0xb0a6('0x44')][_0xb0a6('0x4a')](_0xb0a6('0x4b'))){_0x11b7d7[_0xb0a6('0x2f')]=qs['limit'](_0x11b713[_0xb0a6('0x44')]['limit']);_0x11b7d7[_0xb0a6('0x2e')]=qs[_0xb0a6('0x2e')](_0x11b713['query'][_0xb0a6('0x2e')]);}_0x11b7d7[_0xb0a6('0x4c')]=qs[_0xb0a6('0x4d')](_0x11b713[_0xb0a6('0x44')][_0xb0a6('0x4d')]);_0x11b7d7[_0xb0a6('0x4e')]=qs[_0xb0a6('0x46')](_[_0xb0a6('0x4f')](_0x11b713[_0xb0a6('0x44')],_0x153ddc['filters']));_0x11b7d7[_0xb0a6('0x4e')][_0xb0a6('0xfe')]=_0x470848['id'];if(_0x11b713[_0xb0a6('0x44')][_0xb0a6('0x89')]){_0x11b7d7[_0xb0a6('0x4e')]=_[_0xb0a6('0x9f')](_0x11b7d7[_0xb0a6('0x4e')],{'$or':_[_0xb0a6('0x37')](_0x11b7d7[_0xb0a6('0x47')],function(_0x1a2521){var _0x1fc021={};_0x1fc021[_0x1a2521]={'$like':'%'+_0x11b713['query'][_0xb0a6('0x89')]+'%'};return _0x1fc021;})});}_0x11b7d7['where'][_0xb0a6('0xeb')]=![];if(_0x11b713[_0xb0a6('0x44')]['id']){_0x11b7d7[_0xb0a6('0x4e')]['id']={'$gt':_0x11b713[_0xb0a6('0x44')]['id']};}_0x11b7d7=_['merge']({},_0x11b7d7,_0x11b713['options']);return db[_0xb0a6('0xc3')][_0xb0a6('0x2d')]({'where':_0x11b7d7[_0xb0a6('0x4e')]})[_0xb0a6('0x1e')](function(_0x1e5359){_0x4530a5[_0xb0a6('0x2d')]=_0x1e5359;_0x11b7d7[_0xb0a6('0xb4')]=[];if(_0x11b713[_0xb0a6('0x44')]['includeAgent']){_0x11b7d7[_0xb0a6('0xb4')]['push']({'model':db[_0xb0a6('0x78')],'as':'User','attributes':['id',_0xb0a6('0x38'),_0xb0a6('0xe5')]});}if(_0x11b713[_0xb0a6('0x44')]['includeAll']){_0x11b7d7[_0xb0a6('0xb4')]=[{'all':!![]}];}return db[_0xb0a6('0xc3')][_0xb0a6('0x102')](_0x11b7d7);})[_0xb0a6('0x1e')](function(_0x196627){_0x4530a5[_0xb0a6('0x103')]=_0x196627;return _0x4530a5;});}})[_0xb0a6('0x1e')](respondWithFilteredResult(_0x5b9788,_0x11b7d7))['catch'](handleError(_0x5b9788,null));};exports[_0xb0a6('0x105')]=function(_0x4b11da,_0x440e8d,_0x596957){return db[_0xb0a6('0x3e')]['find']({'where':{'id':_0x4b11da['params']['id']}})[_0xb0a6('0x1e')](handleEntityNotFound(_0x440e8d,null))['then'](function(_0x4daa95){if(_0x4daa95){return _0x4daa95[_0xb0a6('0x106')](_0x4b11da['body'][_0xb0a6('0xfb')],_[_0xb0a6('0xfc')](_0x4b11da[_0xb0a6('0x7b')],[_0xb0a6('0xfb'),'id'])||{})[_0xb0a6('0x107')](function(){return db['Tag'][_0xb0a6('0x102')]({'attributes':['id',_0xb0a6('0x52'),_0xb0a6('0x108')],'where':{'id':_0x4b11da[_0xb0a6('0x7b')][_0xb0a6('0xfb')]}});})['then'](function(_0x518eba){socket[_0xb0a6('0x109')](_0xb0a6('0x10a'),{'id':Number(_0x4b11da[_0xb0a6('0xb2')]['id']),'tags':_0x518eba||[]});return{'id':Number(_0x4b11da[_0xb0a6('0xb2')]['id']),'tags':_0x518eba||[]};});}})[_0xb0a6('0x1e')](respondWithResult(_0x440e8d,null))['catch'](handleError(_0x440e8d,null));};exports[_0xb0a6('0x10b')]=function(_0xcb24a2,_0x46784b,_0x5b57e1){return db[_0xb0a6('0x3e')][_0xb0a6('0x70')]({'where':{'id':_0xcb24a2[_0xb0a6('0xb2')]['id']}})[_0xb0a6('0x1e')](handleEntityNotFound(_0x46784b,null))[_0xb0a6('0x1e')](function(_0x5e3c82){if(_0x5e3c82){return _0x5e3c82['removeTags'](_0xcb24a2[_0xb0a6('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x46784b,null))['catch'](handleError(_0x46784b,null));};exports[_0xb0a6('0xd3')]=function(_0x58b561,_0x58bea9){var _0xac3ca8=moment()['unix']()[_0xb0a6('0x9e')]();var _0x62706a=path[_0xb0a6('0xd7')](config[_0xb0a6('0xd8')],_0xb0a6('0x10c'),_0xb0a6('0x10d'),_0xb0a6('0x10e'));var _0x55f185=path[_0xb0a6('0xd7')](config['root'],'server',_0xb0a6('0x10d'),'attachments');var _0x3855c9=path[_0xb0a6('0xd7')](_0x62706a,_0xac3ca8);var _0x587b5b=util[_0xb0a6('0xda')](_0xb0a6('0x10f'),_0x58b561[_0xb0a6('0xb2')]['id'],_0xac3ca8);var _0x4bb519=path[_0xb0a6('0xd7')](_0x62706a,_0x587b5b);var _0x472a3d=[];_0x472a3d[_0xb0a6('0x3c')]({'model':db['User'],'as':_0xb0a6('0x78'),'attributes':['id',_0xb0a6('0x38')],'raw':!![]});_0x472a3d['push']({'model':db[_0xb0a6('0xde')],'as':_0xb0a6('0x6b'),'attributes':['id',_0xb0a6('0x110'),_0xb0a6('0x111')],'raw':!![]});if(_0x58b561[_0xb0a6('0x44')]['attachments']){_0x472a3d[_0xb0a6('0x3c')]({'model':db[_0xb0a6('0x112')],'as':'Attachment','raw':!![]});}var _0x1f841f=[{'model':db[_0xb0a6('0xc3')],'as':_0xb0a6('0x113'),'attributes':['id',_0xb0a6('0x7b'),_0xb0a6('0xe8'),_0xb0a6('0xea'),'secret','read'],'include':_0x472a3d}];_0x1f841f[_0xb0a6('0x3c')]({'model':db['ChatWebsite'],'as':_0xb0a6('0x114'),'attributes':['id',_0xb0a6('0x52')]});_0x1f841f['push']({'model':db[_0xb0a6('0x78')],'as':_0xb0a6('0x115'),'attributes':['id',_0xb0a6('0x38')]});return db[_0xb0a6('0x3e')]['find']({'where':{'id':_0x58b561[_0xb0a6('0xb2')]['id']},'include':_0x1f841f})[_0xb0a6('0x1e')](handleEntityNotFound(_0x58bea9,null))[_0xb0a6('0x1e')](function(_0x1db0be){if(_0x1db0be){var _0x4377dd=_0x1db0be[_0xb0a6('0x116')]({'plain':!![]});fs[_0xb0a6('0x117')](_0x3855c9);var _0x116ca3={'format':'A4','border':_0xb0a6('0x118'),'header':{'height':'40px','contents':{'first':_0xb0a6('0x119')}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xb0a6('0xda')](_0xb0a6('0x11a'),'Chat',_0x4377dd['id']),moment()['format'](_0xb0a6('0x11b'))[_0xb0a6('0x9e')]())}}};var _0x36a139={'channel':'Chat','account':_0x4377dd[_0xb0a6('0x114')]['name'],'agent':_0x4377dd[_0xb0a6('0x115')]?_0x4377dd[_0xb0a6('0x115')][_0xb0a6('0x38')]:_0xb0a6('0x11c'),'createdAt':moment(_0x4377dd[_0xb0a6('0xe8')])[_0xb0a6('0xda')](_0xb0a6('0x100'))[_0xb0a6('0x9e')](),'closedAt':_0x4377dd[_0xb0a6('0xc8')]?moment(_0x4377dd[_0xb0a6('0x11d')])[_0xb0a6('0xda')](_0xb0a6('0x100'))[_0xb0a6('0x9e')]():'','disposition':_0x4377dd[_0xb0a6('0xc9')],'chatInfo':{'browser':_0x4377dd[_0xb0a6('0x11e')],'os':_0x4377dd['osName'],'referer':_0x4377dd[_0xb0a6('0x11f')],'customerIp':_0x4377dd[_0xb0a6('0x120')],'customerPort':_0x4377dd[_0xb0a6('0x121')]?_0x4377dd[_0xb0a6('0x121')]:_0xb0a6('0x11c')},'messages':_(_0x4377dd[_0xb0a6('0x113')])['tail']()[_0xb0a6('0x89')]({'secret':![]})['map'](function(_0x5d007a){if(_0x5d007a['Attachment']){var _0x4e6832=path[_0xb0a6('0xd7')](_0x55f185,_0x5d007a[_0xb0a6('0x112')][_0xb0a6('0xcd')]);if(fs[_0xb0a6('0x122')](_0x4e6832)){fs[_0xb0a6('0x123')](_0x4e6832)[_0xb0a6('0x124')](fs['createWriteStream'](path[_0xb0a6('0xd7')](_0x3855c9,_0x5d007a[_0xb0a6('0x112')][_0xb0a6('0xcd')])));}}return{'date':moment(_0x5d007a[_0xb0a6('0xe8')])[_0xb0a6('0xda')](_0xb0a6('0x100'))['toString'](),'sender':_0x5d007a[_0xb0a6('0xea')]===_0xb0a6('0xc2')?_0x5d007a[_0xb0a6('0x78')]?_0x5d007a[_0xb0a6('0x78')][_0xb0a6('0x38')]:'System':_0x5d007a[_0xb0a6('0x6b')]['firstName']+(_0x5d007a[_0xb0a6('0x6b')][_0xb0a6('0x111')]?'\x20'+_0x5d007a[_0xb0a6('0x6b')][_0xb0a6('0x111')]:''),'body':_0x5d007a['Attachment']?_0x5d007a[_0xb0a6('0x112')][_0xb0a6('0xcd')]:_0x5d007a[_0xb0a6('0x7b')],'direction':_0x5d007a[_0xb0a6('0xea')]==='out'?'A':'C','secret':_0x5d007a[_0xb0a6('0xeb')],'read':_0x5d007a[_0xb0a6('0x85')],'attachment':_0x5d007a[_0xb0a6('0x112')]};})[_0xb0a6('0x67')]()};return ejs['renderFile'](path[_0xb0a6('0xd7')](config[_0xb0a6('0xd8')],_0xb0a6('0x10c'),_0xb0a6('0x125'),'downloadInteraction.html'),{'interaction':_0x36a139})[_0xb0a6('0x1e')](function(_0x53b344){return new BPromise(function(_0x2e08d1,_0x2825cf){pdf[_0xb0a6('0xb6')](_0x53b344,_0x116ca3)[_0xb0a6('0x126')](path['join'](_0x3855c9,_0xb0a6('0x127')+_0x4377dd['id']+'-'+_0xac3ca8+_0xb0a6('0x128')),function(_0x30eb53,_0x56e7c1){if(_0x30eb53)return _0x2825cf(_0x30eb53);_0x2e08d1(_0x56e7c1);});});})[_0xb0a6('0x1e')](function(){return new BPromise(function(_0x50c3d8,_0x3f0a38){zipdir(_0x3855c9,{'saveTo':_0x4bb519},function(_0x32be74,_0x2986a5){if(_0x32be74)return _0x3f0a38(_0x32be74);return _0x50c3d8(_0x2986a5);});})[_0xb0a6('0x1e')](function(){return new BPromise(function(_0x78cb3a,_0x50ed75){rimraf(_0x3855c9,function(_0x58ae56){if(_0x58ae56)_0x50ed75(_0x58ae56);return _0x78cb3a();});});})[_0xb0a6('0x1e')](function(){return _0x58bea9[_0xb0a6('0xd3')](_0x4bb519,_0x587b5b,function(_0x4f319d){if(_0x4f319d){console[_0xb0a6('0x129')](_0xb0a6('0x12a'),_0x4f319d);}else{fs['unlinkSync'](_0x4bb519);}});});});}else{return _0x58bea9[_0xb0a6('0x29')](0xc8);}})['catch'](handleError(_0x58bea9,null));}; \ No newline at end of file +var _0x2a07=['POST','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','close','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','format','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','service','Smtp','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','getMyMessages','includeAgent','addTags','setTags','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','CmContact','attachments','Account','Owner','get','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','%s\x20#%d','YYYY-MM-DD','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','pipe','createWriteStream','lastName','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','unlinkSync','html-pdf','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','Users','map','fullname','Tags','split','forEach','index','ChatInteraction','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','length','having','`\x20=\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','toString','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','all','show','params','rawAttributes','include','merge','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooApiKey'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a07,0x74));var _0x72a0=function(_0x53f1bc,_0x38e4a3){_0x53f1bc=_0x53f1bc-0x0;var _0x5507cf=_0x2a07[_0x53f1bc];return _0x5507cf;};'use strict';var pdf=require(_0x72a0('0x0'));var emlformat=require(_0x72a0('0x1'));var rimraf=require(_0x72a0('0x2'));var zipdir=require(_0x72a0('0x3'));var jsonpatch=require(_0x72a0('0x4'));var rp=require('request-promise');var moment=require(_0x72a0('0x5'));var BPromise=require(_0x72a0('0x6'));var Mustache=require(_0x72a0('0x7'));var util=require(_0x72a0('0x8'));var path=require(_0x72a0('0x9'));var sox=require(_0x72a0('0xa'));var csv=require(_0x72a0('0xb'));var ejs=require(_0x72a0('0xc'));var fs=require('fs');var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xb'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var db=require('../../mysqldb')['db'];config[_0x72a0('0x1b')]=_[_0x72a0('0x1c')](config[_0x72a0('0x1b')],{'host':_0x72a0('0x1d'),'port':0x18eb});var socket=require(_0x72a0('0x1e'))(new Redis(config[_0x72a0('0x1b')]));require(_0x72a0('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x72a0('0x20')][_0x72a0('0x21')]({'port':0x232b});var client9004=jayson[_0x72a0('0x20')][_0x72a0('0x21')]({'port':0x232c});function checkPasswordPattern(_0x23b001,_0x3f3d62,_0x4ab55e){if(_0x4ab55e){var _0x30248e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30248e[_0x72a0('0x22')](_0x3f3d62)){return _0x23b001;}else{throw new db[(_0x72a0('0x23'))][(_0x72a0('0x24'))](_0x72a0('0x25'));}}else{return _0x23b001;}}function respondWithRpcPromise(_0x54495e,_0x100d8f,_0x42e9ec,_0x131b73){return new BPromise(function(_0x5b63c8,_0x144bfc){var _0x46e9e3=_0x131b73||client;return _0x46e9e3[_0x72a0('0x26')](_0x54495e,_0x42e9ec)[_0x72a0('0x27')](function(_0x5437df){logger[_0x72a0('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x100d8f,_0x72a0('0x29'));logger[_0x72a0('0x2a')](_0x72a0('0x2b'),_0x100d8f,'request\x20sent',JSON[_0x72a0('0x2c')](_0x5437df));if(_0x5437df[_0x72a0('0x2d')]){if(_0x5437df[_0x72a0('0x2d')][_0x72a0('0x2e')]===0x1f4){logger['error'](_0x72a0('0x2f'),_0x100d8f,_0x5437df[_0x72a0('0x2d')][_0x72a0('0x30')]);return _0x144bfc(_0x5437df[_0x72a0('0x2d')][_0x72a0('0x30')]);}logger[_0x72a0('0x2d')]('ChatInteraction,\x20%s,\x20%s',_0x100d8f,_0x5437df['error'][_0x72a0('0x30')]);return _0x5b63c8(_0x5437df[_0x72a0('0x2d')][_0x72a0('0x30')]);}else{logger[_0x72a0('0x28')](_0x72a0('0x2f'),_0x100d8f,_0x72a0('0x29'));_0x5b63c8(_0x5437df[_0x72a0('0x31')][_0x72a0('0x30')]);}})[_0x72a0('0x32')](function(_0x12dcc9){logger['error'](_0x72a0('0x2f'),_0x100d8f,_0x12dcc9);_0x144bfc(_0x12dcc9);});});}function respondWithStatusCode(_0x553641,_0xc22d18){_0xc22d18=_0xc22d18||0xcc;return function(_0x2928f6){if(_0x2928f6){return _0x553641[_0x72a0('0x33')](_0xc22d18);}return _0x553641[_0x72a0('0x34')](_0xc22d18)[_0x72a0('0x35')]();};}function respondWithResult(_0x12eda2,_0x23c96a){_0x23c96a=_0x23c96a||0xc8;return function(_0x916733){if(_0x916733){return _0x12eda2['status'](_0x23c96a)[_0x72a0('0x36')](_0x916733);}};}function respondWithFilteredResult(_0x17e955,_0x39136d){return function(_0xfbe9b3){if(_0xfbe9b3){var _0x13c04=_0xfbe9b3[_0x72a0('0x37')],_0x19e783=_0x39136d[_0x72a0('0x38')],_0x3a5e54=_0x39136d[_0x72a0('0x38')]+_0x39136d[_0x72a0('0x39')],_0x592401;if(_0x3a5e54>=_0x13c04){_0x3a5e54=_0x13c04;_0x592401=0xc8;}else{_0x592401=0xce;}_0x17e955[_0x72a0('0x34')](_0x592401);return _0x17e955[_0x72a0('0x3a')](_0x72a0('0x3b'),_0x19e783+'-'+_0x3a5e54+'/'+_0x13c04)[_0x72a0('0x36')](_0xfbe9b3);}return null;};}function patchUpdates(_0x5e93f8){return function(_0x8e1d40){try{jsonpatch[_0x72a0('0x3c')](_0x8e1d40,_0x5e93f8,!![]);}catch(_0x2959af){return BPromise['reject'](_0x2959af);}return _0x8e1d40[_0x72a0('0x3d')]();};}function saveUpdates(_0x4ada83,_0x4b2b44){return function(_0x277d8f){if(_0x277d8f){return _0x277d8f[_0x72a0('0x3e')](_0x4ada83)[_0x72a0('0x27')](function(_0x44a008){return _0x44a008;});}return null;};}function removeEntity(_0xbcb2a4,_0x20f023){return function(_0x148e71){if(_0x148e71){return _0x148e71[_0x72a0('0x3f')]()[_0x72a0('0x27')](function(){_0xbcb2a4[_0x72a0('0x34')](0xcc)[_0x72a0('0x35')]();});}};}function handleEntityNotFound(_0x5b6326,_0x265d96){return function(_0x5eb8f1){if(!_0x5eb8f1){_0x5b6326[_0x72a0('0x33')](0x194);}return _0x5eb8f1;};}function handleError(_0x13c251,_0x446222){_0x446222=_0x446222||0x1f4;return function(_0x1a9597){logger[_0x72a0('0x2d')](_0x1a9597[_0x72a0('0x40')]);if(_0x1a9597[_0x72a0('0x41')]){delete _0x1a9597[_0x72a0('0x41')];}_0x13c251[_0x72a0('0x34')](_0x446222)['send'](_0x1a9597);};}function getInteractionUsers(_0x4a973a,_0x41cfc3){return new BPromise(function(_0x1d9403,_0x332051){try{if(_0x41cfc3[_0x4a973a['id']]){_0x4a973a[_0x72a0('0x42')]=_[_0x72a0('0x43')](_0x41cfc3[_0x4a973a['id']],function(_0x512a06){return{'id':_0x512a06['id'],'fullname':_0x512a06[_0x72a0('0x44')]};});}}catch(_0x3f1fa9){_0x332051(_0x3f1fa9);}_0x1d9403(_0x4a973a);});}function getInteractionTags(_0x582c90,_0x21ad08){return new BPromise(function(_0x5cc69b,_0x582c84){try{if(_0x582c90['TagIds']){_0x582c90[_0x72a0('0x45')]=[];_0x582c90['TagIds'][_0x72a0('0x46')](',')[_0x72a0('0x47')](function(_0x1250ac){_0x582c90[_0x72a0('0x45')]['push'](_0x21ad08[_0x1250ac]);});}delete _0x582c90['TagIds'];}catch(_0x4bb006){_0x582c84(_0x4bb006);}_0x5cc69b(_0x582c90);});}function updateChatInteraction(_0x4a32bd,_0x106828,_0x5784ec){return new BPromise(function(_0x4a7032,_0x11b4f8){return getInteractionUsers(_0x4a32bd,_0x5784ec)[_0x72a0('0x27')](function(_0x49414d){return getInteractionTags(_0x49414d,_0x106828);})[_0x72a0('0x27')](function(_0x1f2897){_0x4a7032(_0x1f2897);})[_0x72a0('0x32')](function(_0xe4abe1){_0x11b4f8(_0xe4abe1);});});}exports[_0x72a0('0x48')]=function(_0x341451,_0x50eb7f){var _0x27d06f={},_0x5babc1={},_0x3683b6={'count':0x0,'rows':[]};var _0x4ac6dd=_[_0x72a0('0x43')](db[_0x72a0('0x49')]['rawAttributes'],function(_0x430178){return{'name':_0x430178['fieldName'],'type':_0x430178[_0x72a0('0x4a')][_0x72a0('0x4b')]};});_0x5babc1[_0x72a0('0x4c')]=_['map'](_0x4ac6dd,_0x72a0('0x41'));_0x5babc1[_0x72a0('0x4d')]=_[_0x72a0('0x4e')](_0x341451['query']);_0x5babc1['filters']=_[_0x72a0('0x4f')](_0x5babc1['model'],_0x5babc1[_0x72a0('0x4d')]);_0x27d06f[_0x72a0('0x50')]=_[_0x72a0('0x4f')](_0x5babc1[_0x72a0('0x4c')],qs[_0x72a0('0x51')](_0x341451[_0x72a0('0x4d')][_0x72a0('0x51')]));_0x27d06f[_0x72a0('0x50')]=_0x27d06f[_0x72a0('0x50')]['length']?_0x27d06f[_0x72a0('0x50')]:_0x5babc1[_0x72a0('0x4c')];if(!_0x341451[_0x72a0('0x4d')][_0x72a0('0x52')](_0x72a0('0x53'))){_0x27d06f[_0x72a0('0x39')]=qs[_0x72a0('0x39')](_0x341451['query']['limit']);_0x27d06f[_0x72a0('0x38')]=qs[_0x72a0('0x38')](_0x341451[_0x72a0('0x4d')][_0x72a0('0x38')]);}_0x27d06f[_0x72a0('0x54')]=qs[_0x72a0('0x55')](_0x341451[_0x72a0('0x4d')][_0x72a0('0x55')]);_0x27d06f[_0x72a0('0x56')]=qs[_0x72a0('0x57')](_['pick'](_0x341451[_0x72a0('0x4d')],_0x5babc1[_0x72a0('0x57')]),_0x4ac6dd);var _0x480d49=[];var _0x241dcc=squel[_0x72a0('0x58')]()['field']('id')[_0x72a0('0x59')]('name')['field'](_0x72a0('0x5a'))[_0x72a0('0x5b')](_0x72a0('0x5c'));var _0x35ed6f=squel[_0x72a0('0x58')]()['field'](_0x72a0('0x5d'))[_0x72a0('0x59')]('u.fullname')['field'](_0x72a0('0x5e'))[_0x72a0('0x5b')](_0x72a0('0x5f'),'ui')[_0x72a0('0x60')](_0x72a0('0x61'),'u',_0x72a0('0x62'));var _0x37a6d6=squel[_0x72a0('0x58')]()['from'](_0x72a0('0x63'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x72a0('0x60')](_0x72a0('0x61'),'o','o.id\x20=\x20i.UserId')[_0x72a0('0x60')]('chat_websites','a',_0x72a0('0x64'))['left_join']('chat_messages','me',_0x72a0('0x65'))[_0x72a0('0x60')]('chat_interaction_has_tags','it',_0x72a0('0x66'))['left_join'](_0x72a0('0x5c'),'t','t.id\x20=\x20it.TagId');var _0x48df1d=squel[_0x72a0('0x67')]();var _0x2dbbb4=[];var _0x137eb5=squel['expr']();var _0x54ab0f;if(_0x341451[_0x72a0('0x4d')]['search']){_0x54ab0f=as[_0x72a0('0x68')](_0x341451[_0x72a0('0x4d')][_0x72a0('0x69')]);var _0x4b03ab=_0x54ab0f[_0x72a0('0x6a')];for(var _0x2628dd=0x0;_0x2628dd<_0x54ab0f[_0x72a0('0x6b')][_0x72a0('0x6c')];_0x2628dd++){var _0x106343=_0x54ab0f[_0x72a0('0x6b')][_0x2628dd];var _0x32a0bb='i';var _0x43ec4b=_['find'](_0x4ac6dd,[_0x72a0('0x41'),_0x106343['field']]);if(!_0x43ec4b){switch(_0x106343['field']){case'unreadMessages':if(_0x106343['value']==0x1){_0x37a6d6[_0x72a0('0x6d')]('`'+_0x106343[_0x72a0('0x59')]+_0x72a0('0x6e'));}else{_0x37a6d6['having']('`'+_0x106343[_0x72a0('0x59')]+'`\x20>\x200');}break;case _0x72a0('0x6f'):if(_0x106343[_0x72a0('0x70')]==='$substring'){if(_0x106343[_0x72a0('0x71')][_0x72a0('0x46')]('\x20')[_0x72a0('0x6c')]>0x1){_0x48df1d[_0x4b03ab](_0x72a0('0x72'),qs['getFullTextValue'](_0x106343[_0x72a0('0x71')]),null);}else{var _0x4d9b42='%'+_0x106343[_0x72a0('0x71')]+'%';_0x48df1d[_0x4b03ab](_0x72a0('0x73'),_0x4d9b42,_0x4d9b42,_0x4d9b42);}}else{_0x43ec4b=_[_0x72a0('0x74')](_0x4ac6dd,['name',_0x72a0('0x75')]);_0x106343[_0x72a0('0x59')]=_0x72a0('0x75');_0xf0301e=as[_0x72a0('0x76')](_0x32a0bb,_0x43ec4b[_0x72a0('0x4a')],_0x106343);_0x48df1d[_0x4b03ab](_0xf0301e['text'],_0xf0301e['value'][_0x72a0('0x77')],_0xf0301e['value'][_0x72a0('0x35')]);}break;case'Tag':var _0x3c7fa6=_0x106343[_0x72a0('0x71')]['split'](',')[_0x72a0('0x43')](function(_0x1b960e){return Number(_0x1b960e);});_0x3c7fa6[_0x72a0('0x47')](function(_0x55b301){_0x137eb5['or'](_0x72a0('0x78'),'%,'+_0x55b301+',%');});_0x2dbbb4=_['union'](_0x2dbbb4,_0x3c7fa6);break;case _0x72a0('0x79'):if(_0x106343[_0x72a0('0x70')]==='$substring'){_0x48df1d[_0x4b03ab](_0x72a0('0x7a'),'%'+_0x106343['value']+'%',null);}else{_0x43ec4b=_['find'](_0x4ac6dd,['name',_0x72a0('0x7b')]);_0x106343['field']=_0x72a0('0x7b');_0xf0301e=as['buildExpression'](_0x32a0bb,_0x43ec4b[_0x72a0('0x4a')],_0x106343);_0x48df1d[_0x4b03ab](_0xf0301e[_0x72a0('0x7c')],_0xf0301e[_0x72a0('0x71')]['start'],_0xf0301e[_0x72a0('0x71')][_0x72a0('0x35')]);}break;case _0x72a0('0x7d'):_0xf0301e=as[_0x72a0('0x76')]('me',null,_0x106343);_0x48df1d[_0x4b03ab](_0xf0301e[_0x72a0('0x7c')],_0xf0301e['value'][_0x72a0('0x77')],_0xf0301e[_0x72a0('0x71')][_0x72a0('0x35')]);break;}}else{var _0xf0301e=as['buildExpression'](_0x32a0bb,_0x43ec4b[_0x72a0('0x4a')],_0x106343);_0x48df1d[_0x4b03ab](_0xf0301e[_0x72a0('0x7c')],_0xf0301e['value'][_0x72a0('0x77')],_0xf0301e['value'][_0x72a0('0x35')]);}}}else{var _0x52f855=_(_0x341451[_0x72a0('0x4d')])[_0x72a0('0x4e')]()[_0x72a0('0x43')](function(_0x1e23e9){return _[_0x72a0('0x7e')](_0x4ac6dd,['name',_0x1e23e9])?_0x1e23e9:undefined;})['compact']()['value']();if(!_[_0x72a0('0x7f')](_0x52f855)){_0x52f855[_0x72a0('0x47')](function(_0x126596){if(_0x126596===_0x72a0('0x80')){_0x37a6d6[_0x72a0('0x56')](_0x72a0('0x81'),[]['concat'](_0x341451[_0x72a0('0x4d')][_0x126596]));}else if(_0x126596===_0x72a0('0x82')){var _0xe05bda=JSON[_0x72a0('0x83')](_0x341451[_0x72a0('0x4d')][_0x126596])[_0x72a0('0x84')];var _0x1040ad=JSON['parse'](_0x341451[_0x72a0('0x4d')][_0x126596])[_0x72a0('0x85')];_0x37a6d6[_0x72a0('0x56')](_0x72a0('0x86'),_0xe05bda,_0x1040ad);}else{if(_0x341451[_0x72a0('0x4d')][_0x126596]===_0x72a0('0x87')){_0x37a6d6['where']('i.'+_0x126596+_0x72a0('0x88'));}else{_0x37a6d6['where']('i.'+_0x126596+_0x72a0('0x89'),_0x341451[_0x72a0('0x4d')][_0x126596]);}}});}if(_0x341451[_0x72a0('0x4d')][_0x72a0('0x8a')]){if(_0x341451[_0x72a0('0x4d')]['read']==0x1){_0x37a6d6[_0x72a0('0x6d')](_0x72a0('0x8b'));}else{_0x37a6d6['having'](_0x72a0('0x8c'));}}if(_0x341451[_0x72a0('0x4d')][_0x72a0('0x8d')]){_0x2dbbb4=_[_0x72a0('0x8e')](_0x341451['query'][_0x72a0('0x8d')])?_0x341451[_0x72a0('0x4d')][_0x72a0('0x8d')]:new Array(_0x341451[_0x72a0('0x4d')][_0x72a0('0x8d')]);_0x2dbbb4[_0x72a0('0x47')](function(_0x3c27fb){_0x137eb5['or'](_0x72a0('0x78'),'%,'+_0x3c27fb+',%');});}if(_0x341451[_0x72a0('0x4d')][_0x72a0('0x8f')]){var _0x2fd7e2=_0x341451[_0x72a0('0x4d')]['filter'][_0x72a0('0x90')]('\x5c','\x5c\x5c')[_0x72a0('0x90')]('\x27\x27',_0x72a0('0x91'));if(qs[_0x72a0('0x92')](_0x2fd7e2)){_0x48df1d['or'](_0x72a0('0x93'),_0x2fd7e2+'%');}else{_0x48df1d['or'](_0x72a0('0x94'),qs[_0x72a0('0x95')](_0x2fd7e2))['or'](_0x72a0('0x96'),_0x2fd7e2+'%');}}}_0x37a6d6['where'](_0x48df1d);_0x37a6d6[_0x72a0('0x97')]('i.id');var _0x557d4c={'type':db[_0x72a0('0x23')]['QueryTypes']['SELECT'],'raw':!![]};var _0x25f9e5=_0x37a6d6['clone']();_0x25f9e5[_0x72a0('0x59')](_0x72a0('0x98'));_0x25f9e5[_0x72a0('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x72a0('0x99'));if(_0x27d06f[_0x72a0('0x54')]){_0x27d06f[_0x72a0('0x54')][_0x72a0('0x47')](function(_0x3d3d1f){_0x37a6d6['order']('i.'+_0x3d3d1f[0x0],_0x3d3d1f[0x1]===_0x72a0('0x9a')?![]:!![]);});}if(!_[_0x72a0('0x7f')](_0x2dbbb4)){_0x37a6d6[_0x72a0('0x6d')](_0x137eb5);_0x25f9e5['where'](_0x72a0('0x9b'),_0x2dbbb4);}BPromise[_0x72a0('0x9c')]()[_0x72a0('0x27')](function(){if(!_0x54ab0f){if(_0x341451['query'][_0x72a0('0x80')]||_0x341451[_0x72a0('0x4d')][_0x72a0('0x9d')])return;_0x25f9e5[_0x72a0('0x56')](_0x72a0('0x9e'));_0x37a6d6[_0x72a0('0x56')](_0x72a0('0x9e'));return;}return _0x341451[_0x72a0('0x9f')][_0x72a0('0xa0')]({'attributes':['id'],'raw':!![]})['then'](function(_0x874ada){if(_[_0x72a0('0x7f')](_0x874ada)){_0x25f9e5[_0x72a0('0x56')](_0x72a0('0xa1'));_0x37a6d6[_0x72a0('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x25f9e5[_0x72a0('0x56')](_0x72a0('0x81'),_[_0x72a0('0x43')](_0x874ada,'id'));_0x37a6d6[_0x72a0('0x56')]('i.ChatWebsiteId\x20IN\x20?',_[_0x72a0('0x43')](_0x874ada,'id'));}});})[_0x72a0('0x27')](function(){db[_0x72a0('0xa2')]['query'](_0x25f9e5['toString'](),_0x557d4c)[_0x72a0('0x27')](function(_0x76b0bf){_0x3683b6[_0x72a0('0x37')]=_0x76b0bf[_0x72a0('0x6c')];if(_0x3683b6[_0x72a0('0x37')]===0x0)return[];return db['sequelize']['query'](_0x241dcc['toString'](),_0x557d4c)[_0x72a0('0x27')](function(_0x5c1412){_0x480d49=_[_0x72a0('0xa3')](_0x5c1412,'id');_0x557d4c=_['merge'](_0x557d4c,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x341451['query']['fields']){_0x27d06f[_0x72a0('0x50')][_0x72a0('0x47')](function(_0x153802){_0x37a6d6[_0x72a0('0x59')]('i.'+_0x153802);});}else{_0x37a6d6['field'](_0x72a0('0xa4'),_0x72a0('0x99'));_0x37a6d6['field'](_0x72a0('0xa5'),_0x72a0('0xa6'));_0x37a6d6['field'](_0x72a0('0xa7'),_0x72a0('0xa8'));_0x37a6d6[_0x72a0('0x59')](_0x72a0('0xa9'));_0x37a6d6['field']('c.firstName',_0x72a0('0xaa'));_0x37a6d6[_0x72a0('0x59')](_0x72a0('0xab'),_0x72a0('0xac'));_0x37a6d6[_0x72a0('0x59')](_0x72a0('0xad'),'Contact.email');_0x37a6d6['field'](_0x72a0('0xae'),_0x72a0('0xaf'));_0x37a6d6['field'](_0x72a0('0xb0'),_0x72a0('0xb1'));_0x37a6d6[_0x72a0('0x59')](_0x72a0('0xb2'),_0x72a0('0xb3'));_0x37a6d6[_0x72a0('0x59')](_0x72a0('0xb4'),'Owner.fullname');_0x37a6d6[_0x72a0('0x59')](_0x72a0('0xb5'),_0x72a0('0xb6'));_0x37a6d6['field'](_0x72a0('0xb7'),_0x72a0('0xb8'));}if(_0x27d06f[_0x72a0('0x39')])_0x37a6d6[_0x72a0('0x39')](_0x27d06f[_0x72a0('0x39')]);if(_0x27d06f['offset'])_0x37a6d6[_0x72a0('0x38')](_0x27d06f[_0x72a0('0x38')]);return db[_0x72a0('0xa2')][_0x72a0('0x4d')](_0x37a6d6[_0x72a0('0xb9')](),_0x557d4c);})[_0x72a0('0x27')](function(_0x53cccc){_0x35ed6f[_0x72a0('0x56')](_0x72a0('0xba'),_[_0x72a0('0x43')](_0x53cccc,'id'));return db[_0x72a0('0xa2')][_0x72a0('0x4d')](_0x35ed6f[_0x72a0('0xb9')](),_0x557d4c)[_0x72a0('0x27')](function(_0x350732){var _0x2c99f9=_['groupBy'](_0x350732,_0x72a0('0xbb'));var _0x5cdb8e=[];_0x53cccc[_0x72a0('0x47')](function(_0xc30837){_0x5cdb8e[_0x72a0('0xbc')](updateChatInteraction(_0xc30837,_0x480d49,_0x2c99f9));});return BPromise[_0x72a0('0xbd')](_0x5cdb8e);});});})[_0x72a0('0x27')](function(_0x2c23fb){_0x3683b6['rows']=_0x2c23fb;return _0x3683b6;})['then'](respondWithFilteredResult(_0x50eb7f,_0x27d06f));})[_0x72a0('0x32')](handleError(_0x50eb7f,null));};exports[_0x72a0('0xbe')]=function(_0x2cb9d8,_0x3f723c){var _0x453201={'raw':![],'where':{'id':_0x2cb9d8[_0x72a0('0xbf')]['id']}},_0x3657e2={};_0x3657e2[_0x72a0('0x4c')]=_[_0x72a0('0x4e')](db[_0x72a0('0x49')][_0x72a0('0xc0')]);_0x3657e2[_0x72a0('0x4d')]=_[_0x72a0('0x4e')](_0x2cb9d8[_0x72a0('0x4d')]);_0x3657e2[_0x72a0('0x57')]=_['intersection'](_0x3657e2[_0x72a0('0x4c')],_0x3657e2['query']);_0x453201[_0x72a0('0x50')]=_['intersection'](_0x3657e2[_0x72a0('0x4c')],qs['fields'](_0x2cb9d8[_0x72a0('0x4d')][_0x72a0('0x51')]));_0x453201[_0x72a0('0x50')]=_0x453201[_0x72a0('0x50')][_0x72a0('0x6c')]?_0x453201[_0x72a0('0x50')]:_0x3657e2['model'];if(_0x2cb9d8[_0x72a0('0x4d')]['includeAll']){_0x453201[_0x72a0('0xc1')]=[{'all':!![]}];}_0x453201=_[_0x72a0('0xc2')]({},_0x453201,_0x2cb9d8[_0x72a0('0xc3')]);return db[_0x72a0('0x49')][_0x72a0('0x74')](_0x453201)[_0x72a0('0x27')](handleEntityNotFound(_0x3f723c,null))['then'](respondWithResult(_0x3f723c,null))[_0x72a0('0x32')](handleError(_0x3f723c,null));};exports[_0x72a0('0xc4')]=function(_0x431223,_0x2130db){return db[_0x72a0('0x49')][_0x72a0('0xc4')](_0x431223[_0x72a0('0x7d')],{})[_0x72a0('0x27')](respondWithResult(_0x2130db,0xc9))[_0x72a0('0x32')](handleError(_0x2130db,null));};exports['update']=function(_0x1fdc27,_0x3971e8){if(_0x1fdc27[_0x72a0('0x7d')]['id']){delete _0x1fdc27[_0x72a0('0x7d')]['id'];}return db[_0x72a0('0x49')][_0x72a0('0x74')]({'where':{'id':_0x1fdc27[_0x72a0('0xbf')]['id']}})[_0x72a0('0x27')](handleEntityNotFound(_0x3971e8,null))['then'](saveUpdates(_0x1fdc27['body'],null))['then'](respondWithResult(_0x3971e8,null))['catch'](handleError(_0x3971e8,null));};exports['destroy']=function(_0x512219,_0x3ec9f6){return db['ChatInteraction'][_0x72a0('0x74')]({'where':{'id':_0x512219['params']['id']}})[_0x72a0('0x27')](handleEntityNotFound(_0x3ec9f6,null))['then'](removeEntity(_0x3ec9f6,null))[_0x72a0('0x32')](handleError(_0x3ec9f6,null));};exports[_0x72a0('0xc5')]=function(_0x501e72,_0x19c6c3){return db['ChatInteraction'][_0x72a0('0xc5')]()[_0x72a0('0x27')](respondWithResult(_0x19c6c3,null))['catch'](handleError(_0x19c6c3,null));};exports[_0x72a0('0xc6')]=function(_0x50527d,_0x1870a2){var _0x453c5a=_0x50527d[_0x72a0('0xbf')]['id'];var _0x3b0c66;var _0x512b82;var _0x1ec8d4;return db['ChatInteraction'][_0x72a0('0xc7')]({'where':{'id':_0x453c5a}})[_0x72a0('0x27')](function(_0x3ec3dd){_0x3b0c66=_0x3ec3dd;return db[_0x72a0('0xc8')][_0x72a0('0xc7')]({'where':{'id':_0x3ec3dd[_0x72a0('0x80')]},'attributes':['id','vidaooApiKey',_0x72a0('0xc9')],'raw':!![]});})[_0x72a0('0x27')](function(_0x541b74){if(_0x541b74&&_0x541b74[_0x72a0('0xca')]&&_0x541b74[_0x72a0('0xc9')]){_0x512b82=_0x541b74;var _0x211c42={'rejectUnauthorized':![],'method':_0x72a0('0xcb'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x541b74[_0x72a0('0xca')]},'body':{'name':_0x72a0('0xcc')+_0x453c5a},'redirect':_0x72a0('0xcd'),'json':!![]};return rp(_0x211c42);}else{throw new db[(_0x72a0('0x23'))][(_0x72a0('0x24'))](_0x72a0('0xce'));}})['then'](function(_0x404c03){_0x1ec8d4=_0x404c03;if(_0x1ec8d4['id']){var _0x18f99d={'body':_0x1ec8d4[_0x72a0('0xcf')],'ChatWebsiteId':_0x512b82['id'],'ChatInteractionId':_0x3b0c66['id'],'direction':_0x72a0('0xd0'),'UserId':_0x50527d[_0x72a0('0x9f')]['id']};return db['ChatMessage'][_0x72a0('0xc4')](_0x18f99d,{});}else{throw new db[(_0x72a0('0x23'))]['ValidationError'](_0x72a0('0xd1'));}})[_0x72a0('0x27')](function(){return _0x3b0c66[_0x72a0('0xd2')]({'vidaooSessionId':_0x1ec8d4['id']});})['then'](respondWithResult(_0x1870a2,null))['catch'](handleError(_0x1870a2,null));};exports[_0x72a0('0xd3')]=function(_0x4592d1,_0x2c6a75){if(_0x4592d1['body']['id']){delete _0x4592d1['body']['id'];}return db[_0x72a0('0x49')]['find']({'where':{'id':_0x4592d1[_0x72a0('0xbf')]['id']}})[_0x72a0('0x27')](handleEntityNotFound(_0x2c6a75,null))[_0x72a0('0x27')](saveUpdates(_0x4592d1[_0x72a0('0x7d')],null))[_0x72a0('0x27')](respondWithResult(_0x2c6a75,null))[_0x72a0('0x32')](handleError(_0x2c6a75,null));};exports['abandon']=function(_0x239b77,_0x122e0c,_0x85e537){if(_0x239b77[_0x72a0('0x7d')]['id']){delete _0x239b77[_0x72a0('0x7d')]['id'];}return db[_0x72a0('0x49')][_0x72a0('0x74')]({'where':{'id':_0x239b77[_0x72a0('0xbf')]['id']}})[_0x72a0('0x27')](function(_0x52227f){if(!_0x52227f){logger[_0x72a0('0x2d')](_0x72a0('0xd4'),_0x72a0('0xd5'),0x194,_0x72a0('0xd6'));_0x122e0c[_0x72a0('0x33')](0x194);}else{if(_0x52227f[_0x72a0('0x7b')]){throw new db[(_0x72a0('0x23'))]['ValidationError'](_0x72a0('0xd7'));}}return _0x52227f;})[_0x72a0('0x27')](function(_0x5eb3f4){if(_0x5eb3f4){return _0x5eb3f4[_0x72a0('0x3e')]({'closed':_0x239b77[_0x72a0('0x7d')][_0x72a0('0xd8')],'disposition':_0x239b77[_0x72a0('0x7d')][_0x72a0('0xd9')]})[_0x72a0('0x27')](function(_0x450cf9){return _0x450cf9;});}})[_0x72a0('0x27')](function(_0x41ec4c){return respondWithRpcPromise(_0x72a0('0xda'),_0x72a0('0xd5'),_0x239b77[_0x72a0('0x7d')],client9004);})['then'](respondWithResult(_0x122e0c,null))[_0x72a0('0x32')](handleError(_0x122e0c,null));};exports[_0x72a0('0xdb')]=function(_0x56c184,_0x23dcc8,_0x673f38){_0x56c184[_0x72a0('0x7d')]['name']=_0x56c184[_0x72a0('0xdc')][_0x72a0('0xdd')];_0x56c184[_0x72a0('0x7d')][_0x72a0('0xde')]=_0x56c184[_0x72a0('0xdc')][_0x72a0('0xdf')];_0x56c184['body'][_0x72a0('0x4a')]=_0x56c184[_0x72a0('0xdc')]['mimetype'];return db[_0x72a0('0xe0')]['create'](_0x56c184['body'])['then'](respondWithResult(_0x23dcc8,0xc9))['catch'](handleError(_0x23dcc8,null));};exports[_0x72a0('0xe1')]=function(_0x114654,_0x1e99d2,_0x5ab163){return db[_0x72a0('0x49')]['findOne']({'where':{'id':_0x114654[_0x72a0('0xbf')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1e99d2,null))[_0x72a0('0x27')](function(_0x41faeb){if(_0x41faeb){if(_0x41faeb['closed']){return _0x1e99d2['status'](0x193)['json']({'status':0x193,'message':_0x72a0('0xe2')});}return db['Attachment'][_0x72a0('0xc7')]({'where':{'id':_0x114654[_0x72a0('0x4d')][_0x72a0('0xe3')]},'raw':!![]})[_0x72a0('0x27')](handleEntityNotFound(_0x1e99d2,null));}})[_0x72a0('0x27')](function(_0x180932){if(_0x180932){return _0x1e99d2[_0x72a0('0xe4')](path[_0x72a0('0xe5')](config[_0x72a0('0xe6')],'server/files/attachments/',_0x180932[_0x72a0('0xde')]));}})[_0x72a0('0x32')](handleError(_0x1e99d2,null));};exports[_0x72a0('0xe7')]=function(_0x1f25eb,_0x32200b){var _0x19dd3f=null;var _0x302723=null;var _0x1b4923=null;var _0x597674=null;if(_0x1f25eb[_0x72a0('0x7d')]['id']){delete _0x1f25eb[_0x72a0('0x7d')]['id'];}if(_0x1f25eb[_0x72a0('0x7d')]['mailTranscript']){_0x597674=path[_0x72a0('0xe5')](config[_0x72a0('0xe6')],_0x72a0('0xe8'),util['format'](_0x72a0('0xe9'),Date[_0x72a0('0xea')]()));_0x1f25eb[_0x72a0('0x7d')][_0x72a0('0xeb')]=_0x597674;}return db[_0x72a0('0x49')][_0x72a0('0x74')]({'where':{'id':_0x1f25eb[_0x72a0('0xbf')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x72a0('0xec'),'include':[{'model':db['User'],'as':_0x72a0('0x79')}]}]})[_0x72a0('0x27')](handleEntityNotFound(_0x32200b,null))[_0x72a0('0x27')](saveUpdates(_0x1f25eb['body'],null))[_0x72a0('0x27')](function(_0x55338f){if(_0x55338f){_0x19dd3f=_0x55338f;return db[_0x72a0('0xc8')][_0x72a0('0x74')]({'where':{'id':_0x19dd3f[_0x72a0('0x80')]}});}})[_0x72a0('0x27')](function(_0xd0cd42){if(_0xd0cd42){_0x1b4923=_0xd0cd42;return db['CmContact'][_0x72a0('0x74')]({'where':{'id':_0x19dd3f[_0x72a0('0x75')]}});}})['then'](function(_0x348c09){if(_0x348c09){_0x302723=_0x348c09;if(_0x597674){var _0x4315c7=null;for(var _0x1e04c7=0x1;_0x1e04c7<_0x19dd3f[_0x72a0('0xec')][_0x72a0('0x6c')];++_0x1e04c7){_0x4315c7=_0x19dd3f[_0x72a0('0xec')][_0x1e04c7];var _0x55243a=_0x4315c7[_0x72a0('0x7b')]?util[_0x72a0('0xed')](_0x72a0('0xee'),_0x1b4923[_0x72a0('0xef')],_0x4315c7[_0x72a0('0x7b')]):_0x72a0('0xf0');var _0x1292a8=_0x1f25eb[_0x72a0('0x7d')]['customer']||util[_0x72a0('0xed')]('%s%d',_0x72a0('0xf1'),_0x4315c7[_0x72a0('0x75')]);switch(_0x1b4923[_0x72a0('0xf2')]){case _0x72a0('0xf3'):_0x55243a=_0x4315c7['UserId']?util[_0x72a0('0xed')](_0x72a0('0xee'),_0x1b4923['agentAlias'],_0x4315c7['UserId']):_0x72a0('0xf0');break;case'agent_alias':_0x55243a=_0x4315c7[_0x72a0('0x7b')]?_0x4315c7[_0x72a0('0x79')][_0x72a0('0xf4')]||_0x4315c7[_0x72a0('0x79')][_0x72a0('0x44')]:_0x72a0('0xf0');break;case _0x72a0('0xf5'):_0x55243a=_0x4315c7[_0x72a0('0x7b')]?_0x4315c7['User'][_0x72a0('0x44')]:_0x72a0('0xf0');break;default:_0x55243a=_0x4315c7[_0x72a0('0x7b')]?util[_0x72a0('0xed')](_0x72a0('0xee'),_0x1b4923['agentAlias'],_0x4315c7[_0x72a0('0x7b')]):_0x72a0('0xf0');}var _0xb5dbf0=util[_0x72a0('0xed')](_0x72a0('0xf6'),moment(_0x4315c7[_0x72a0('0x82')])[_0x72a0('0xed')](_0x72a0('0xf7')),_0x4315c7[_0x72a0('0xf8')]==='in'?_0x1292a8:_0x55243a,_0x4315c7[_0x72a0('0x7d')]);if(!_0x4315c7[_0x72a0('0xf9')]){fs[_0x72a0('0xfa')](_0x597674,_0xb5dbf0);}}return db[_0x72a0('0xfb')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x72a0('0xfc')],'as':'Smtp','raw':!![]}]});}}})[_0x72a0('0x27')](function(_0x23e91f){if(_0x23e91f&&_0x23e91f['Smtp']&&_0x1f25eb[_0x72a0('0x7d')]){var _0x1f68e3={'tls':{'rejectUnauthorized':![]}};if(_0x23e91f['Smtp'][_0x72a0('0xfd')]){_0x1f68e3[_0x72a0('0xfd')]=_0x23e91f[_0x72a0('0xfe')][_0x72a0('0xfd')];}else{_0x1f68e3[_0x72a0('0xff')]=_0x23e91f[_0x72a0('0xfe')]['host'];_0x1f68e3[_0x72a0('0x100')]=_0x23e91f[_0x72a0('0xfe')][_0x72a0('0x100')];_0x1f68e3[_0x72a0('0x101')]=_0x23e91f['Smtp'][_0x72a0('0x101')];}if(_0x23e91f[_0x72a0('0xfe')][_0x72a0('0x102')]){_0x1f68e3[_0x72a0('0x103')]={'user':_0x23e91f[_0x72a0('0xfe')][_0x72a0('0x9f')],'pass':_0x23e91f[_0x72a0('0xfe')]['pass']};}return respondWithRpcPromise(_0x72a0('0x104'),_0x72a0('0x105'),{'account':_0x1f68e3,'message':{'from':util[_0x72a0('0xed')](_0x72a0('0x106'),_0x23e91f[_0x72a0('0x41')],_0x23e91f[_0x72a0('0x107')]||_0x23e91f[_0x72a0('0xfe')][_0x72a0('0x9f')]),'to':_0x1f25eb[_0x72a0('0x7d')][_0x72a0('0x108')],'subject':_0x72a0('0x109'),'text':util['format'](_0x72a0('0x10a'),_0x1f25eb[_0x72a0('0x7d')]['mailTranscript']),'attachments':[{'path':_0x597674}]}})[_0x72a0('0x27')](function(){return _0x19dd3f;})[_0x72a0('0x32')](function(_0x11fa99){console[_0x72a0('0x2d')](_0x11fa99);});}else{return _0x19dd3f;}})[_0x72a0('0x27')](respondWithStatusCode(_0x32200b,0xc8))[_0x72a0('0x32')](handleError(_0x32200b,null));};exports[_0x72a0('0x10b')]=function(_0x2cd2de,_0xe61bd7,_0x3ef719){return db[_0x72a0('0x10c')][_0x72a0('0x74')]({'where':{'id':_0x2cd2de[_0x72a0('0xbf')]['id']}})[_0x72a0('0x27')](handleEntityNotFound(_0xe61bd7,null))[_0x72a0('0x27')](function(_0x40a6de){if(_0x40a6de){return _0x40a6de[_0x72a0('0x10b')](_0x2cd2de[_0x72a0('0x7d')]['ids'],_['omit'](_0x2cd2de['body'],[_0x72a0('0x10d'),'id'])||{});}})[_0x72a0('0x27')](respondWithResult(_0xe61bd7,null))[_0x72a0('0x32')](handleError(_0xe61bd7,null));};exports[_0x72a0('0x10e')]=function(_0x4d7cc7,_0x44d7a2,_0x344c1a){var _0x44e55a={'raw':![],'where':{}};var _0xbc4acd={};var _0x46ca04={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x72a0('0xc7')]({'where':{'id':_0x4d7cc7[_0x72a0('0xbf')]['id']}})['then'](handleEntityNotFound(_0x44d7a2,null))[_0x72a0('0x27')](function(_0x2d3433){if(_0x2d3433){_0xbc4acd[_0x72a0('0x4c')]=_[_0x72a0('0x4e')](db['ChatMessage'][_0x72a0('0xc0')]);_0xbc4acd[_0x72a0('0x4d')]=_['keys'](_0x4d7cc7[_0x72a0('0x4d')]);_0xbc4acd[_0x72a0('0x57')]=_[_0x72a0('0x4f')](_0xbc4acd[_0x72a0('0x4c')],_0xbc4acd[_0x72a0('0x4d')]);_0x44e55a[_0x72a0('0x50')]=_[_0x72a0('0x4f')](_0xbc4acd['model'],qs[_0x72a0('0x51')](_0x4d7cc7[_0x72a0('0x4d')][_0x72a0('0x51')]));_0x44e55a[_0x72a0('0x50')]=_0x44e55a[_0x72a0('0x50')]['length']?_0x44e55a[_0x72a0('0x50')]:_0xbc4acd['model'];if(!_0x4d7cc7[_0x72a0('0x4d')]['hasOwnProperty'](_0x72a0('0x53'))){_0x44e55a[_0x72a0('0x39')]=qs['limit'](_0x4d7cc7[_0x72a0('0x4d')][_0x72a0('0x39')]);_0x44e55a[_0x72a0('0x38')]=qs['offset'](_0x4d7cc7[_0x72a0('0x4d')][_0x72a0('0x38')]);}_0x44e55a[_0x72a0('0x54')]=qs[_0x72a0('0x55')](_0x4d7cc7['query'][_0x72a0('0x55')]);_0x44e55a[_0x72a0('0x56')]=qs[_0x72a0('0x57')](_[_0x72a0('0x10f')](_0x4d7cc7['query'],_0xbc4acd[_0x72a0('0x57')]));_0x44e55a[_0x72a0('0x56')]['ChatInteractionId']=_0x2d3433['id'];if(_0x4d7cc7[_0x72a0('0x4d')][_0x72a0('0x8f')]){_0x44e55a[_0x72a0('0x56')]=_[_0x72a0('0xc2')](_0x44e55a[_0x72a0('0x56')],{'$or':_[_0x72a0('0x43')](_0x44e55a['attributes'],function(_0x352251){var _0x354c68={};_0x354c68[_0x352251]={'$like':'%'+_0x4d7cc7[_0x72a0('0x4d')][_0x72a0('0x8f')]+'%'};return _0x354c68;})});}if(_0x4d7cc7[_0x72a0('0x4d')]['$gte']){var _0x2e9a08=_0x4d7cc7['query'][_0x72a0('0x84')][_0x72a0('0x46')](',');var _0x6c32da={};_0x6c32da[_0x2e9a08[0x0]]={'$gte':moment(_0x2e9a08[0x1])[_0x72a0('0xed')](_0x72a0('0x110'))};_0x44e55a[_0x72a0('0x56')]=_[_0x72a0('0xc2')](_0x44e55a[_0x72a0('0x56')],_0x6c32da);}_0x44e55a=_[_0x72a0('0xc2')]({},_0x44e55a,_0x4d7cc7['options']);return db[_0x72a0('0x10c')][_0x72a0('0x37')]({'where':_0x44e55a['where']})[_0x72a0('0x27')](function(_0x1c3094){_0x46ca04[_0x72a0('0x37')]=_0x1c3094;if(_0x4d7cc7[_0x72a0('0x4d')][_0x72a0('0x111')]){_0x44e55a[_0x72a0('0xc1')]=[{'all':!![]}];}return db[_0x72a0('0x10c')][_0x72a0('0x112')](_0x44e55a);})[_0x72a0('0x27')](function(_0x54a432){_0x46ca04[_0x72a0('0x113')]=_0x54a432;return _0x46ca04;});}})[_0x72a0('0x27')](respondWithFilteredResult(_0x44d7a2,_0x44e55a))[_0x72a0('0x32')](handleError(_0x44d7a2,null));};exports[_0x72a0('0x114')]=function(_0x40fcdd,_0x87fa8b,_0x51bb86){var _0x458b7a={'where':{}},_0x5000c2={},_0x20a24b={'count':0x0,'rows':[]};return db[_0x72a0('0x49')][_0x72a0('0xc7')]({'where':{'id':_0x40fcdd['params']['id']}})[_0x72a0('0x27')](handleEntityNotFound(_0x87fa8b,null))[_0x72a0('0x27')](function(_0xaa783f){if(_0xaa783f){_0x5000c2[_0x72a0('0x4c')]=_[_0x72a0('0x4e')](db[_0x72a0('0x10c')][_0x72a0('0xc0')]);_0x5000c2['query']=_[_0x72a0('0x4e')](_0x40fcdd[_0x72a0('0x4d')]);_0x5000c2[_0x72a0('0x57')]=_[_0x72a0('0x4f')](_0x5000c2[_0x72a0('0x4c')],_0x5000c2['query']);_0x458b7a[_0x72a0('0x50')]=_[_0x72a0('0x4f')](_0x5000c2[_0x72a0('0x4c')],qs['fields'](_0x40fcdd[_0x72a0('0x4d')]['fields']));_0x458b7a[_0x72a0('0x50')]=_0x458b7a[_0x72a0('0x50')][_0x72a0('0x6c')]?_0x458b7a[_0x72a0('0x50')]:_0x5000c2[_0x72a0('0x4c')];if(!_0x40fcdd[_0x72a0('0x4d')][_0x72a0('0x52')](_0x72a0('0x53'))){_0x458b7a['limit']=qs[_0x72a0('0x39')](_0x40fcdd['query'][_0x72a0('0x39')]);_0x458b7a[_0x72a0('0x38')]=qs['offset'](_0x40fcdd[_0x72a0('0x4d')][_0x72a0('0x38')]);}_0x458b7a[_0x72a0('0x54')]=qs['sort'](_0x40fcdd[_0x72a0('0x4d')][_0x72a0('0x55')]);_0x458b7a[_0x72a0('0x56')]=qs[_0x72a0('0x57')](_[_0x72a0('0x10f')](_0x40fcdd[_0x72a0('0x4d')],_0x5000c2[_0x72a0('0x57')]));_0x458b7a[_0x72a0('0x56')][_0x72a0('0xbb')]=_0xaa783f['id'];if(_0x40fcdd[_0x72a0('0x4d')]['filter']){_0x458b7a[_0x72a0('0x56')]=_[_0x72a0('0xc2')](_0x458b7a[_0x72a0('0x56')],{'$or':_[_0x72a0('0x43')](_0x458b7a['attributes'],function(_0x2c6497){var _0x31656d={};_0x31656d[_0x2c6497]={'$like':'%'+_0x40fcdd[_0x72a0('0x4d')][_0x72a0('0x8f')]+'%'};return _0x31656d;})});}_0x458b7a[_0x72a0('0x56')][_0x72a0('0xf9')]=![];if(_0x40fcdd['query']['id']){_0x458b7a[_0x72a0('0x56')]['id']={'$gt':_0x40fcdd[_0x72a0('0x4d')]['id']};}_0x458b7a=_['merge']({},_0x458b7a,_0x40fcdd[_0x72a0('0xc3')]);return db[_0x72a0('0x10c')][_0x72a0('0x37')]({'where':_0x458b7a[_0x72a0('0x56')]})['then'](function(_0x10933b){_0x20a24b[_0x72a0('0x37')]=_0x10933b;_0x458b7a[_0x72a0('0xc1')]=[];if(_0x40fcdd['query'][_0x72a0('0x115')]){_0x458b7a[_0x72a0('0xc1')]['push']({'model':db[_0x72a0('0x79')],'as':_0x72a0('0x79'),'attributes':['id','fullname','alias']});}if(_0x40fcdd[_0x72a0('0x4d')][_0x72a0('0x111')]){_0x458b7a[_0x72a0('0xc1')]=[{'all':!![]}];}return db[_0x72a0('0x10c')][_0x72a0('0x112')](_0x458b7a);})[_0x72a0('0x27')](function(_0x1eff8c){_0x20a24b[_0x72a0('0x113')]=_0x1eff8c;return _0x20a24b;});}})[_0x72a0('0x27')](respondWithFilteredResult(_0x87fa8b,_0x458b7a))['catch'](handleError(_0x87fa8b,null));};exports[_0x72a0('0x116')]=function(_0x7ec175,_0x3b0739,_0x4a3e9c){return db['ChatInteraction'][_0x72a0('0x74')]({'where':{'id':_0x7ec175['params']['id']}})['then'](handleEntityNotFound(_0x3b0739,null))[_0x72a0('0x27')](function(_0x80efc4){if(_0x80efc4){return _0x80efc4[_0x72a0('0x117')](_0x7ec175['body']['ids'],_[_0x72a0('0x118')](_0x7ec175[_0x72a0('0x7d')],[_0x72a0('0x10d'),'id'])||{})[_0x72a0('0x119')](function(){return db[_0x72a0('0x11a')]['findAll']({'attributes':['id','name',_0x72a0('0x5a')],'where':{'id':_0x7ec175[_0x72a0('0x7d')]['ids']}});})[_0x72a0('0x27')](function(_0x302f23){socket[_0x72a0('0x11b')](_0x72a0('0x11c'),{'id':Number(_0x7ec175[_0x72a0('0xbf')]['id']),'tags':_0x302f23||[]});return{'id':Number(_0x7ec175[_0x72a0('0xbf')]['id']),'tags':_0x302f23||[]};});}})[_0x72a0('0x27')](respondWithResult(_0x3b0739,null))[_0x72a0('0x32')](handleError(_0x3b0739,null));};exports[_0x72a0('0x11d')]=function(_0xddcd30,_0x151527,_0x5a556b){return db[_0x72a0('0x49')][_0x72a0('0x74')]({'where':{'id':_0xddcd30[_0x72a0('0xbf')]['id']}})[_0x72a0('0x27')](handleEntityNotFound(_0x151527,null))['then'](function(_0x1035a9){if(_0x1035a9){return _0x1035a9['removeTags'](_0xddcd30[_0x72a0('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x151527,null))[_0x72a0('0x32')](handleError(_0x151527,null));};exports[_0x72a0('0xe4')]=function(_0x15ab01,_0x7a7386){var _0x4b7f9a=moment()[_0x72a0('0x11e')]()[_0x72a0('0xb9')]();var _0x256228=path[_0x72a0('0xe5')](config['root'],_0x72a0('0x11f'),_0x72a0('0x120'),_0x72a0('0x121'));var _0x254c38=path[_0x72a0('0xe5')](config[_0x72a0('0xe6')],_0x72a0('0x11f'),_0x72a0('0x120'),'attachments');var _0x551c11=path[_0x72a0('0xe5')](_0x256228,_0x4b7f9a);var _0x2bbdc7=util[_0x72a0('0xed')]('transcript-%d-%s.zip',_0x15ab01[_0x72a0('0xbf')]['id'],_0x4b7f9a);var _0x227ddd=path[_0x72a0('0xe5')](_0x256228,_0x2bbdc7);var _0x9581c1=[];_0x9581c1[_0x72a0('0xbc')]({'model':db[_0x72a0('0x79')],'as':_0x72a0('0x79'),'attributes':['id',_0x72a0('0x44')],'raw':!![]});_0x9581c1[_0x72a0('0xbc')]({'model':db[_0x72a0('0x122')],'as':_0x72a0('0x6f'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x15ab01[_0x72a0('0x4d')][_0x72a0('0x123')]){_0x9581c1['push']({'model':db[_0x72a0('0xe0')],'as':_0x72a0('0xe0'),'raw':!![]});}var _0x1ee5c0=[{'model':db[_0x72a0('0x10c')],'as':_0x72a0('0xec'),'attributes':['id','body','createdAt',_0x72a0('0xf8'),_0x72a0('0xf9'),_0x72a0('0x8a')],'include':_0x9581c1}];_0x1ee5c0['push']({'model':db['ChatWebsite'],'as':_0x72a0('0x124'),'attributes':['id',_0x72a0('0x41')]});_0x1ee5c0[_0x72a0('0xbc')]({'model':db[_0x72a0('0x79')],'as':_0x72a0('0x125'),'attributes':['id',_0x72a0('0x44')]});return db[_0x72a0('0x49')]['find']({'where':{'id':_0x15ab01[_0x72a0('0xbf')]['id']},'include':_0x1ee5c0})[_0x72a0('0x27')](handleEntityNotFound(_0x7a7386,null))[_0x72a0('0x27')](function(_0x4204ec){if(_0x4204ec){var _0x927fb0=_0x4204ec[_0x72a0('0x126')]({'plain':!![]});fs[_0x72a0('0x127')](_0x551c11);var _0x485a18={'format':'A4','border':'10px','header':{'height':_0x72a0('0x128'),'contents':{'first':_0x72a0('0x129')}},'footer':{'height':_0x72a0('0x12a'),'contents':{'default':util[_0x72a0('0xed')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x72a0('0xed')](_0x72a0('0x12b'),'Chat',_0x927fb0['id']),moment()[_0x72a0('0xed')](_0x72a0('0x12c'))[_0x72a0('0xb9')]())}}};var _0x1cb05e={'channel':_0x72a0('0x12d'),'account':_0x927fb0[_0x72a0('0x124')][_0x72a0('0x41')],'agent':_0x927fb0[_0x72a0('0x125')]?_0x927fb0['Owner'][_0x72a0('0x44')]:_0x72a0('0x12e'),'createdAt':moment(_0x927fb0[_0x72a0('0x82')])['format'](_0x72a0('0x110'))[_0x72a0('0xb9')](),'closedAt':_0x927fb0[_0x72a0('0xd8')]?moment(_0x927fb0[_0x72a0('0x12f')])['format'](_0x72a0('0x110'))[_0x72a0('0xb9')]():'','disposition':_0x927fb0[_0x72a0('0xd9')],'chatInfo':{'browser':_0x927fb0[_0x72a0('0x130')],'os':_0x927fb0[_0x72a0('0x131')],'referer':_0x927fb0[_0x72a0('0x132')],'customerIp':_0x927fb0[_0x72a0('0x133')],'customerPort':_0x927fb0['customerPort']?_0x927fb0[_0x72a0('0x134')]:_0x72a0('0x12e')},'messages':_(_0x927fb0[_0x72a0('0xec')])['tail']()[_0x72a0('0x8f')]({'secret':![]})[_0x72a0('0x43')](function(_0x5f0297){if(_0x5f0297[_0x72a0('0xe0')]){var _0x5ae09a=path[_0x72a0('0xe5')](_0x254c38,_0x5f0297[_0x72a0('0xe0')]['basename']);if(fs[_0x72a0('0x135')](_0x5ae09a)){fs['createReadStream'](_0x5ae09a)[_0x72a0('0x136')](fs[_0x72a0('0x137')](path[_0x72a0('0xe5')](_0x551c11,_0x5f0297['Attachment'][_0x72a0('0xde')])));}}return{'date':moment(_0x5f0297[_0x72a0('0x82')])['format'](_0x72a0('0x110'))[_0x72a0('0xb9')](),'sender':_0x5f0297['direction']===_0x72a0('0xd0')?_0x5f0297[_0x72a0('0x79')]?_0x5f0297[_0x72a0('0x79')][_0x72a0('0x44')]:_0x72a0('0xf0'):_0x5f0297[_0x72a0('0x6f')]['firstName']+(_0x5f0297[_0x72a0('0x6f')][_0x72a0('0x138')]?'\x20'+_0x5f0297[_0x72a0('0x6f')][_0x72a0('0x138')]:''),'body':_0x5f0297[_0x72a0('0xe0')]?_0x5f0297[_0x72a0('0xe0')][_0x72a0('0xde')]:_0x5f0297[_0x72a0('0x7d')],'direction':_0x5f0297[_0x72a0('0xf8')]===_0x72a0('0xd0')?'A':'C','secret':_0x5f0297[_0x72a0('0xf9')],'read':_0x5f0297[_0x72a0('0x8a')],'attachment':_0x5f0297['Attachment']};})[_0x72a0('0x71')]()};return ejs[_0x72a0('0x139')](path[_0x72a0('0xe5')](config[_0x72a0('0xe6')],'server','views',_0x72a0('0x13a')),{'interaction':_0x1cb05e})[_0x72a0('0x27')](function(_0x166086){return new BPromise(function(_0x4df53a,_0xb34fcc){pdf[_0x72a0('0xc4')](_0x166086,_0x485a18)[_0x72a0('0x13b')](path[_0x72a0('0xe5')](_0x551c11,_0x72a0('0x13c')+_0x927fb0['id']+'-'+_0x4b7f9a+_0x72a0('0x13d')),function(_0x1014cb,_0x13f1cd){if(_0x1014cb)return _0xb34fcc(_0x1014cb);_0x4df53a(_0x13f1cd);});});})[_0x72a0('0x27')](function(){return new BPromise(function(_0x1aa337,_0x18e1fc){zipdir(_0x551c11,{'saveTo':_0x227ddd},function(_0x49c4af,_0x57611f){if(_0x49c4af)return _0x18e1fc(_0x49c4af);return _0x1aa337(_0x57611f);});})[_0x72a0('0x27')](function(){return new BPromise(function(_0x466bc2,_0x3b5490){rimraf(_0x551c11,function(_0x3adeb6){if(_0x3adeb6)_0x3b5490(_0x3adeb6);return _0x466bc2();});});})[_0x72a0('0x27')](function(){return _0x7a7386[_0x72a0('0xe4')](_0x227ddd,_0x2bbdc7,function(_0x32497b){if(_0x32497b){console['log']('err',_0x32497b);}else{fs[_0x72a0('0x13e')](_0x227ddd);}});});});}else{return _0x7a7386[_0x72a0('0x33')](0xc8);}})[_0x72a0('0x32')](handleError(_0x7a7386,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 09bf702..0a3bdb5 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 _0x5790=['save','update','getUsers','then','setDataValue','map','findAll','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x23ecce,_0x44afe3){var _0xe6f07e=function(_0x147f8d){while(--_0x147f8d){_0x23ecce['push'](_0x23ecce['shift']());}};_0xe6f07e(++_0x44afe3);}(_0x5790,0xa5));var _0x0579=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5790[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x0579('0x0'))['db'][_0x0579('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x0579('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0579('0x3'),'afterUpdate':_0x0579('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5affd9){return function(_0x320dff,_0x25d54a,_0x3cf377){_0x320dff[_0x0579('0x5')]({'attributes':['id'],'raw':!![]})[_0x0579('0x6')](function(_0x1c0267){_0x320dff[_0x0579('0x7')]('Users',_0x1c0267[_0x0579('0x8')](function(_0x6b1375){return{'id':_0x6b1375['id']};}));return ChatMessage[_0x0579('0x9')]({'where':{'ChatInteractionId':_0x320dff['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0579('0x6')](function(_0x276214){_0x320dff[_0x0579('0x7')]('unreadMessages',_0x276214['length']);ChatInteractionEvents['emit'](_0x5affd9+':'+_0x320dff['id'],_0x320dff);ChatInteractionEvents[_0x0579('0xa')](_0x5affd9,_0x320dff);_0x3cf377(null);})['catch'](_0x3cf377(null));};}for(var e in events){if(events[_0x0579('0xb')](e)){var event=events[e];ChatInteraction[_0x0579('0xc')](e,emitEvent(event));}}module[_0x0579('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0xdc2d=['update','remove','getUsers','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x3b7ac6,_0x501f60){var _0x45a3f0=function(_0x1dbeff){while(--_0x1dbeff){_0x3b7ac6['push'](_0x3b7ac6['shift']());}};_0x45a3f0(++_0x501f60);}(_0xdc2d,0x74));var _0xddc2=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xdc2d[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xddc2('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xddc2('0x0'))['db'][_0xddc2('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xddc2('0x2')](0x0);var events={'afterCreate':_0xddc2('0x3'),'afterUpdate':_0xddc2('0x4'),'afterDestroy':_0xddc2('0x5')};function emitEvent(_0x2c4228){return function(_0x4a8e29,_0x5be7a6,_0x2c6497){_0x4a8e29[_0xddc2('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x489848){_0x4a8e29['setDataValue'](_0xddc2('0x7'),_0x489848[_0xddc2('0x8')](function(_0xf9efbf){return{'id':_0xf9efbf['id']};}));return ChatMessage[_0xddc2('0x9')]({'where':{'ChatInteractionId':_0x4a8e29['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a9e4e){_0x4a8e29['setDataValue'](_0xddc2('0xa'),_0x3a9e4e[_0xddc2('0xb')]);ChatInteractionEvents[_0xddc2('0xc')](_0x2c4228+':'+_0x4a8e29['id'],_0x4a8e29);ChatInteractionEvents[_0xddc2('0xc')](_0x2c4228,_0x4a8e29);_0x2c6497(null);})['catch'](_0x2c6497(null));};}for(var e in events){if(events[_0xddc2('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xddc2('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 3029523..e5b80bf 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 _0xa26a=['../../config/logger','api','moment','bluebird','request-promise','path','./chatInteraction.attributes','exports','define','changed','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x3bc3b4,_0x5acff4){var _0x4c546b=function(_0x158717){while(--_0x158717){_0x3bc3b4['push'](_0x3bc3b4['shift']());}};_0x4c546b(++_0x5acff4);}(_0xa26a,0x9e));var _0xaa26=function(_0x133df4,_0x1a4d36){_0x133df4=_0x133df4-0x0;var _0x28f765=_0xa26a[_0x133df4];return _0x28f765;};'use strict';var _=require(_0xaa26('0x0'));var util=require(_0xaa26('0x1'));var logger=require(_0xaa26('0x2'))(_0xaa26('0x3'));var moment=require(_0xaa26('0x4'));var BPromise=require(_0xaa26('0x5'));var rp=require(_0xaa26('0x6'));var fs=require('fs');var path=require(_0xaa26('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa26('0x8'));module[_0xaa26('0x9')]=function(_0x4f4e3d,_0x214517){return _0x4f4e3d[_0xaa26('0xa')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ba202,_0x16b994,_0xdeaa1){if(_0x4ba202[_0xaa26('0xb')](_0xaa26('0xc'))){_0x4ba202['closedAt']=moment()['format'](_0xaa26('0xd'));}_0xdeaa1(null,_0x4ba202);}},'charset':_0xaa26('0xe'),'collate':_0xaa26('0xf')});}; \ No newline at end of file +var _0x7fea=['request-promise','path','rimraf','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x7fea,0x14c));var _0xa7fe=function(_0x5dfdc4,_0x2f1fe1){_0x5dfdc4=_0x5dfdc4-0x0;var _0x41228d=_0x7fea[_0x5dfdc4];return _0x41228d;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var logger=require(_0xa7fe('0x1'))('api');var moment=require(_0xa7fe('0x2'));var BPromise=require(_0xa7fe('0x3'));var rp=require(_0xa7fe('0x4'));var fs=require('fs');var path=require(_0xa7fe('0x5'));var rimraf=require(_0xa7fe('0x6'));var config=require('../../config/environment');var attributes=require(_0xa7fe('0x7'));module['exports']=function(_0x2d10ec,_0x41f156){return _0x2d10ec['define'](_0xa7fe('0x8'),attributes,{'tableName':_0xa7fe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34807c,_0x9e07ba,_0x26d447){if(_0x34807c[_0xa7fe('0xa')](_0xa7fe('0xb'))){_0x34807c[_0xa7fe('0xc')]=moment()[_0xa7fe('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x26d447(null,_0x34807c);}},'charset':_0xa7fe('0xe'),'collate':_0xa7fe('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 30a95bb..405ba5c 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 _0x5ced=['ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','options','where','attributes','limit','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf081c9,_0x90f843){var _0x1e3b8f=function(_0x165a0d){while(--_0x165a0d){_0xf081c9['push'](_0xf081c9['shift']());}};_0x1e3b8f(++_0x90f843);}(_0x5ced,0x1cd));var _0xd5ce=function(_0x591d95,_0x3df684){_0x591d95=_0x591d95-0x0;var _0x472982=_0x5ced[_0x591d95];return _0x472982;};'use strict';var _=require(_0xd5ce('0x0'));var util=require(_0xd5ce('0x1'));var moment=require(_0xd5ce('0x2'));var BPromise=require(_0xd5ce('0x3'));var rs=require(_0xd5ce('0x4'));var fs=require('fs');var Redis=require(_0xd5ce('0x5'));var db=require(_0xd5ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5ce('0x7'))(_0xd5ce('0x8'));var config=require(_0xd5ce('0x9'));var jayson=require(_0xd5ce('0xa'));var client=jayson['client'][_0xd5ce('0xb')]({'port':0x232a});config[_0xd5ce('0xc')]=_[_0xd5ce('0xd')](config[_0xd5ce('0xc')],{'host':_0xd5ce('0xe'),'port':0x18eb});var socket=require(_0xd5ce('0xf'))(new Redis(config[_0xd5ce('0xc')]));require(_0xd5ce('0x10'))[_0xd5ce('0x11')](socket);function respondWithRpcPromise(_0x39a9f5,_0xb40f45,_0x39c44d){return new BPromise(function(_0x34ee6f,_0x1cbfe3){return client[_0xd5ce('0x12')](_0x39a9f5,_0x39c44d)[_0xd5ce('0x13')](function(_0x421149){logger['info'](_0xd5ce('0x14'),_0xb40f45,_0xd5ce('0x15'));logger[_0xd5ce('0x16')](_0xd5ce('0x17'),_0xb40f45,_0xd5ce('0x15'),JSON[_0xd5ce('0x18')](_0x421149));if(_0x421149['error']){if(_0x421149[_0xd5ce('0x19')][_0xd5ce('0x1a')]===0x1f4){logger[_0xd5ce('0x19')](_0xd5ce('0x14'),_0xb40f45,_0x421149[_0xd5ce('0x19')][_0xd5ce('0x1b')]);return _0x1cbfe3(_0x421149[_0xd5ce('0x19')][_0xd5ce('0x1b')]);}logger[_0xd5ce('0x19')](_0xd5ce('0x14'),_0xb40f45,_0x421149['error']['message']);return _0x34ee6f(_0x421149[_0xd5ce('0x19')][_0xd5ce('0x1b')]);}else{logger[_0xd5ce('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0xb40f45,_0xd5ce('0x15'));_0x34ee6f(_0x421149[_0xd5ce('0x1d')][_0xd5ce('0x1b')]);}})[_0xd5ce('0x1e')](function(_0x498020){logger[_0xd5ce('0x19')](_0xd5ce('0x14'),_0xb40f45,_0x498020);_0x1cbfe3(_0x498020);});});}exports[_0xd5ce('0x1f')]=function(_0x3c3ed5){var _0x47a3e0=this;return new Promise(function(_0x294760,_0x34266a){return db[_0xd5ce('0x20')][_0xd5ce('0x21')](_0x3c3ed5['body'],{'raw':_0x3c3ed5[_0xd5ce('0x22')]?_0x3c3ed5[_0xd5ce('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c3ed5[_0xd5ce('0x22')]?_0x3c3ed5[_0xd5ce('0x22')][_0xd5ce('0x23')]||null:null,'attributes':_0x3c3ed5[_0xd5ce('0x22')]?_0x3c3ed5[_0xd5ce('0x22')][_0xd5ce('0x24')]||null:null,'limit':_0x3c3ed5[_0xd5ce('0x22')]?_0x3c3ed5[_0xd5ce('0x22')][_0xd5ce('0x25')]||null:null})['then'](function(_0x5b2913){logger[_0xd5ce('0x1c')](_0xd5ce('0x1f'),_0x3c3ed5);logger[_0xd5ce('0x16')](_0xd5ce('0x1f'),_0x3c3ed5,JSON[_0xd5ce('0x18')](_0x5b2913));_0x294760(_0x5b2913);})[_0xd5ce('0x1e')](function(_0x570405){logger[_0xd5ce('0x19')](_0xd5ce('0x1f'),_0x570405['message'],_0x3c3ed5);_0x34266a(_0x47a3e0[_0xd5ce('0x19')](0x1f4,_0x570405[_0xd5ce('0x1b')]));});});};exports['AddTagsToChatInteraction']=function(_0x57c3dd){return new Promise(function(_0x297cc2,_0x1e696b){return db[_0xd5ce('0x20')]['find']({'where':_0x57c3dd[_0xd5ce('0x22')]?_0x57c3dd[_0xd5ce('0x22')][_0xd5ce('0x23')]||null:null})[_0xd5ce('0x13')](function(_0x2d9bce){if(_0x2d9bce){return _0x2d9bce[_0xd5ce('0x26')](_0x57c3dd[_0xd5ce('0x27')][_0xd5ce('0x28')],_[_0xd5ce('0x29')](_0x57c3dd[_0xd5ce('0x27')],[_0xd5ce('0x28'),'id'])||{});}})[_0xd5ce('0x2a')](function(_0x74a102){logger[_0xd5ce('0x1c')]('AddTags',_0x57c3dd);logger[_0xd5ce('0x16')]('AddTags',_0x57c3dd,JSON[_0xd5ce('0x18')](_0x74a102));_0x297cc2(_0x74a102);})['catch'](function(_0x24c886){logger[_0xd5ce('0x19')](_0xd5ce('0x2b'),_0x24c886[_0xd5ce('0x1b')],_0x57c3dd);_0x1e696b(_this['error'](0x1f4,_0x24c886[_0xd5ce('0x1b')]));});});}; \ No newline at end of file +var _0x8214=['addTags','ids','AddTags','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ChatInteraction','update','body','options','where','attributes','limit','UpdateChatInteraction','debug','find'];(function(_0x3ce6d2,_0x90364d){var _0x4c1dd4=function(_0x3b2e50){while(--_0x3b2e50){_0x3ce6d2['push'](_0x3ce6d2['shift']());}};_0x4c1dd4(++_0x90364d);}(_0x8214,0x1e5));var _0x4821=function(_0x3ba949,_0x5de373){_0x3ba949=_0x3ba949-0x0;var _0x175826=_0x8214[_0x3ba949];return _0x175826;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4821('0x0'));var BPromise=require(_0x4821('0x1'));var rs=require(_0x4821('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4821('0x3'))['db'];var utils=require(_0x4821('0x4'));var logger=require(_0x4821('0x5'))(_0x4821('0x6'));var config=require(_0x4821('0x7'));var jayson=require(_0x4821('0x8'));var client=jayson['client'][_0x4821('0x9')]({'port':0x232a});config['redis']=_[_0x4821('0xa')](config[_0x4821('0xb')],{'host':_0x4821('0xc'),'port':0x18eb});var socket=require(_0x4821('0xd'))(new Redis(config['redis']));require(_0x4821('0xe'))['register'](socket);function respondWithRpcPromise(_0x517694,_0x36ffee,_0x43517f){return new BPromise(function(_0x2193a5,_0x1e8e55){return client['request'](_0x517694,_0x43517f)[_0x4821('0xf')](function(_0x5a5fb4){logger[_0x4821('0x10')](_0x4821('0x11'),_0x36ffee,_0x4821('0x12'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x36ffee,_0x4821('0x12'),JSON['stringify'](_0x5a5fb4));if(_0x5a5fb4[_0x4821('0x13')]){if(_0x5a5fb4['error']['code']===0x1f4){logger[_0x4821('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x36ffee,_0x5a5fb4[_0x4821('0x13')]['message']);return _0x1e8e55(_0x5a5fb4['error']['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x36ffee,_0x5a5fb4[_0x4821('0x13')]['message']);return _0x2193a5(_0x5a5fb4[_0x4821('0x13')][_0x4821('0x14')]);}else{logger[_0x4821('0x10')](_0x4821('0x11'),_0x36ffee,_0x4821('0x12'));_0x2193a5(_0x5a5fb4[_0x4821('0x15')][_0x4821('0x14')]);}})[_0x4821('0x16')](function(_0x4cbe59){logger[_0x4821('0x13')](_0x4821('0x11'),_0x36ffee,_0x4cbe59);_0x1e8e55(_0x4cbe59);});});}exports['UpdateChatInteraction']=function(_0x52ae9a){var _0x1f7cb4=this;return new Promise(function(_0x392d1e,_0x38d445){return db[_0x4821('0x17')][_0x4821('0x18')](_0x52ae9a[_0x4821('0x19')],{'raw':_0x52ae9a['options']?_0x52ae9a[_0x4821('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52ae9a['options']?_0x52ae9a[_0x4821('0x1a')][_0x4821('0x1b')]||null:null,'attributes':_0x52ae9a[_0x4821('0x1a')]?_0x52ae9a['options'][_0x4821('0x1c')]||null:null,'limit':_0x52ae9a[_0x4821('0x1a')]?_0x52ae9a['options'][_0x4821('0x1d')]||null:null})[_0x4821('0xf')](function(_0x5a5845){logger['info'](_0x4821('0x1e'),_0x52ae9a);logger[_0x4821('0x1f')]('UpdateChatInteraction',_0x52ae9a,JSON['stringify'](_0x5a5845));_0x392d1e(_0x5a5845);})['catch'](function(_0x264740){logger[_0x4821('0x13')]('UpdateChatInteraction',_0x264740[_0x4821('0x14')],_0x52ae9a);_0x38d445(_0x1f7cb4[_0x4821('0x13')](0x1f4,_0x264740[_0x4821('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x34781b){return new Promise(function(_0x296d2c,_0x4b3bc9){return db[_0x4821('0x17')][_0x4821('0x20')]({'where':_0x34781b[_0x4821('0x1a')]?_0x34781b[_0x4821('0x1a')][_0x4821('0x1b')]||null:null})[_0x4821('0xf')](function(_0x32fbbc){if(_0x32fbbc){return _0x32fbbc[_0x4821('0x21')](_0x34781b[_0x4821('0x19')][_0x4821('0x22')],_['omit'](_0x34781b['body'],['ids','id'])||{});}})['spread'](function(_0x125c4f){logger[_0x4821('0x10')](_0x4821('0x23'),_0x34781b);logger['debug']('AddTags',_0x34781b,JSON[_0x4821('0x24')](_0x125c4f));_0x296d2c(_0x125c4f);})['catch'](function(_0x3e35b4){logger['error']('AddTags',_0x3e35b4[_0x4821('0x14')],_0x34781b);_0x4b3bc9(_this[_0x4821('0x13')](0x1f4,_0x3e35b4[_0x4821('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f2c2d38..427ef5e 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 _0xbafa=['chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x35f442,_0x5c5705){var _0x2eac94=function(_0x21edef){while(--_0x21edef){_0x35f442['push'](_0x35f442['shift']());}};_0x2eac94(++_0x5c5705);}(_0xbafa,0x131));var _0xabaf=function(_0x4f2724,_0x1133fc){_0x4f2724=_0x4f2724-0x0;var _0x1cb817=_0xbafa[_0x4f2724];return _0x1cb817;};'use strict';var ChatInteractionEvents=require(_0xabaf('0x0'));var events=['save',_0xabaf('0x1'),_0xabaf('0x2')];function createListener(_0x404696,_0x5e23c1){return function(_0x3a12a2){_0x5e23c1[_0xabaf('0x3')](_0x404696,_0x3a12a2);};}function removeListener(_0x5a906f,_0x4558b8){return function(){ChatInteractionEvents[_0xabaf('0x4')](_0x5a906f,_0x4558b8);};}exports[_0xabaf('0x5')]=function(_0x39a43d){for(var _0xa07303=0x0,_0x448bbf=events[_0xabaf('0x6')];_0xa07303<_0x448bbf;_0xa07303++){var _0x3cfd17=events[_0xa07303];var _0x153a58=createListener(_0xabaf('0x7')+_0x3cfd17,_0x39a43d);ChatInteractionEvents['on'](_0x3cfd17,_0x153a58);}}; \ No newline at end of file +var _0xb2b8=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x3807bb,_0x5d03dc){var _0x1ebd29=function(_0x540d7c){while(--_0x540d7c){_0x3807bb['push'](_0x3807bb['shift']());}};_0x1ebd29(++_0x5d03dc);}(_0xb2b8,0xed));var _0x8b2b=function(_0x2bdc7d,_0xcac657){_0x2bdc7d=_0x2bdc7d-0x0;var _0x111ecd=_0xb2b8[_0x2bdc7d];return _0x111ecd;};'use strict';var ChatInteractionEvents=require(_0x8b2b('0x0'));var events=[_0x8b2b('0x1'),_0x8b2b('0x2'),'update'];function createListener(_0x23af3f,_0x1b0dfc){return function(_0xee99c2){_0x1b0dfc[_0x8b2b('0x3')](_0x23af3f,_0xee99c2);};}function removeListener(_0x34fe02,_0x23f3f3){return function(){ChatInteractionEvents[_0x8b2b('0x4')](_0x34fe02,_0x23f3f3);};}exports[_0x8b2b('0x5')]=function(_0x5239dd){for(var _0xfbd242=0x0,_0x4c3720=events[_0x8b2b('0x6')];_0xfbd242<_0x4c3720;_0xfbd242++){var _0x40dc64=events[_0xfbd242];var _0x4a5757=createListener(_0x8b2b('0x7')+_0x40dc64,_0x5239dd);ChatInteractionEvents['on'](_0x40dc64,_0x4a5757);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a0ea497..ed7db32 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 _0xd506=['close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','../../config/environment','index','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','isAuthenticated','getMyMessages','/:id/download','download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','post','/:id/attachment_upload','file','tracked','chat','chatinteraction:update','update','put','customUpdate','abandon'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd506,0x197));var _0x6d50=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xd506[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x6d50('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d50('0x1'));var controller=require('./chatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6d50('0x2')]);router[_0x6d50('0x3')](_0x6d50('0x4'),auth['isAuthenticated'](),controller[_0x6d50('0x5')]);router[_0x6d50('0x3')](_0x6d50('0x6'),auth['isChatInteractionAuthorized'](),controller[_0x6d50('0x7')]);router['get'](_0x6d50('0x8'),auth[_0x6d50('0x9')](),controller[_0x6d50('0xa')]);router[_0x6d50('0x3')](_0x6d50('0xb'),auth[_0x6d50('0xc')](),controller['getMessages']);router['get']('/:id/my_messages',auth[_0x6d50('0x9')](),controller[_0x6d50('0xd')]);router[_0x6d50('0x3')](_0x6d50('0xe'),auth['isAuthenticated'](),controller[_0x6d50('0xf')]);router['post']('/',auth[_0x6d50('0xc')](),controller['create']);router['post']('/:id/vidaoo',auth[_0x6d50('0xc')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x6d50('0x10')]({'destination':function(_0x3807a3,_0x59090d,_0x599f10){_0x599f10(null,path[_0x6d50('0x11')](config[_0x6d50('0x12')],_0x6d50('0x13')));},'filename':function(_0x4d0126,_0x2ee037,_0x1ac038){_0x1ac038(null,util[_0x6d50('0x14')](_0x6d50('0x15'),Date[_0x6d50('0x16')](),_0x2ee037['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6d50('0x17')](_0x6d50('0x18'),upload['single'](_0x6d50('0x19')),controller['attachmentUpload']);router[_0x6d50('0x17')](_0x6d50('0xb'),auth[_0x6d50('0x9')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x6d50('0xc')](),interaction[_0x6d50('0x1a')]('chat','chatinteraction:addtags'),controller['addTags']);router['put'](_0x6d50('0x6'),auth[_0x6d50('0xc')](),interaction[_0x6d50('0x1a')](_0x6d50('0x1b'),_0x6d50('0x1c')),controller[_0x6d50('0x1d')]);router[_0x6d50('0x1e')]('/:id/custom_update',controller[_0x6d50('0x1f')]);router[_0x6d50('0x1e')]('/:id/abandon',auth[_0x6d50('0x9')](),controller[_0x6d50('0x20')]);router['put']('/:id/close',controller[_0x6d50('0x21')]);router[_0x6d50('0x22')](_0x6d50('0x6'),auth['isAuthenticated'](),interaction['tracked'](_0x6d50('0x1b'),_0x6d50('0x23')),controller[_0x6d50('0x24')]);router[_0x6d50('0x22')](_0x6d50('0x25'),auth[_0x6d50('0xc')](),controller[_0x6d50('0x26')]);module[_0x6d50('0x27')]=router; \ No newline at end of file +var _0xa03c=['isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3fc396,_0x4ff17a){var _0x404303=function(_0x5ddff6){while(--_0x5ddff6){_0x3fc396['push'](_0x3fc396['shift']());}};_0x404303(++_0x4ff17a);}(_0xa03c,0x94));var _0xca03=function(_0x5cde43,_0x5b96e2){_0x5cde43=_0x5cde43-0x0;var _0x73a1d0=_0xa03c[_0x5cde43];return _0x73a1d0;};'use strict';var multer=require(_0xca03('0x0'));var util=require('util');var path=require(_0xca03('0x1'));var timeout=require(_0xca03('0x2'));var express=require(_0xca03('0x3'));var router=express['Router']();var auth=require(_0xca03('0x4'));var interaction=require(_0xca03('0x5'));var config=require(_0xca03('0x6'));var controller=require('./chatInteraction.controller');router[_0xca03('0x7')]('/',auth[_0xca03('0x8')](),controller[_0xca03('0x9')]);router[_0xca03('0x7')](_0xca03('0xa'),auth[_0xca03('0x8')](),controller['describe']);router[_0xca03('0x7')](_0xca03('0xb'),auth[_0xca03('0xc')](),controller[_0xca03('0xd')]);router[_0xca03('0x7')](_0xca03('0xe'),auth[_0xca03('0xc')](),controller[_0xca03('0xf')]);router[_0xca03('0x7')](_0xca03('0x10'),auth['isAuthenticated'](),controller[_0xca03('0x11')]);router[_0xca03('0x7')](_0xca03('0x12'),auth[_0xca03('0xc')](),controller[_0xca03('0x13')]);router[_0xca03('0x7')](_0xca03('0x14'),auth[_0xca03('0x8')](),controller[_0xca03('0x15')]);router[_0xca03('0x16')]('/',auth[_0xca03('0x8')](),controller[_0xca03('0x17')]);router[_0xca03('0x16')](_0xca03('0x18'),auth[_0xca03('0x8')](),controller[_0xca03('0x19')]);var upload=multer({'storage':multer[_0xca03('0x1a')]({'destination':function(_0x1782af,_0x177571,_0x5b9801){_0x5b9801(null,path[_0xca03('0x1b')](config[_0xca03('0x1c')],_0xca03('0x1d')));},'filename':function(_0x3adf5f,_0x204708,_0x354064){_0x354064(null,util[_0xca03('0x1e')](_0xca03('0x1f'),Date['now'](),_0x204708[_0xca03('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xca03('0x21')](_0xca03('0x22')),controller[_0xca03('0x23')]);router[_0xca03('0x16')]('/:id/messages',auth[_0xca03('0xc')](),controller['addMessage']);router[_0xca03('0x16')](_0xca03('0x24'),auth[_0xca03('0x8')](),interaction[_0xca03('0x25')](_0xca03('0x26'),_0xca03('0x27')),controller[_0xca03('0x28')]);router[_0xca03('0x29')](_0xca03('0xb'),auth[_0xca03('0x8')](),interaction['tracked'](_0xca03('0x26'),_0xca03('0x2a')),controller[_0xca03('0x2b')]);router[_0xca03('0x29')]('/:id/custom_update',controller[_0xca03('0x2c')]);router[_0xca03('0x29')](_0xca03('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0xca03('0x2e')]);router['put'](_0xca03('0x2f'),controller['close']);router[_0xca03('0x30')]('/:id',auth[_0xca03('0x8')](),interaction[_0xca03('0x25')](_0xca03('0x26'),_0xca03('0x31')),controller[_0xca03('0x32')]);router[_0xca03('0x30')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xca03('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 265dde1..3a92e5f 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 _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x205d64,_0x4a4264){var _0x284ebe=function(_0x109676){while(--_0x109676){_0x205d64['push'](_0x205d64['shift']());}};_0x284ebe(++_0x4a4264);}(_0x5f2f,0x73));var _0xf5f2=function(_0x526191,_0x41acc2){_0x526191=_0x526191-0x0;var _0x20c7fc=_0x5f2f[_0x526191];return _0x20c7fc;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x2ef3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x5bc662,_0x1a1493){var _0x2302ff=function(_0xe2d2d5){while(--_0xe2d2d5){_0x5bc662['push'](_0x5bc662['shift']());}};_0x2302ff(++_0x1a1493);}(_0x2ef3,0xba));var _0x32ef=function(_0x3ad4df,_0x173091){_0x3ad4df=_0x3ad4df-0x0;var _0x28baa7=_0x2ef3[_0x3ad4df];return _0x28baa7;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'body':{'type':Sequelize[_0x32ef('0x2')](_0x32ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x32ef('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5956951..4030ef2 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 _0x0603=['eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','get','messages','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','user','fullname','role','userpic','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','ToId','read','-createdAt','all','html-pdf'];(function(_0x3ceceb,_0x755bea){var _0x5a7821=function(_0x572f1b){while(--_0x572f1b){_0x3ceceb['push'](_0x3ceceb['shift']());}};_0x5a7821(++_0x755bea);}(_0x0603,0xcf));var _0x3060=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0603[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x3060('0x0'));var emlformat=require(_0x3060('0x1'));var rimraf=require(_0x3060('0x2'));var zipdir=require(_0x3060('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3060('0x4'));var BPromise=require(_0x3060('0x5'));var Mustache=require(_0x3060('0x6'));var util=require(_0x3060('0x7'));var path=require(_0x3060('0x8'));var sox=require('sox');var csv=require(_0x3060('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3060('0xa'));var crypto=require(_0x3060('0xb'));var jsforce=require(_0x3060('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3060('0x9'));var querystring=require('querystring');var Papa=require(_0x3060('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3060('0xe'));var as=require(_0x3060('0xf'));var hardwareService=require(_0x3060('0x10'));var logger=require(_0x3060('0x11'))(_0x3060('0x12'));var utils=require(_0x3060('0x13'));var config=require('../../config/environment');var db=require(_0x3060('0x14'))['db'];config[_0x3060('0x15')]=_['defaults'](config[_0x3060('0x15')],{'host':_0x3060('0x16'),'port':0x18eb});var socket=require(_0x3060('0x17'))(new Redis(config[_0x3060('0x15')]));require(_0x3060('0x18'))[_0x3060('0x19')](socket);function respondWithStatusCode(_0x1f66d6,_0x489fa2){_0x489fa2=_0x489fa2||0xcc;return function(_0x5e1ff9){if(_0x5e1ff9){return _0x1f66d6[_0x3060('0x1a')](_0x489fa2);}return _0x1f66d6['status'](_0x489fa2)[_0x3060('0x1b')]();};}function respondWithResult(_0x32fa48,_0x5c9353){_0x5c9353=_0x5c9353||0xc8;return function(_0x157673){if(_0x157673){return _0x32fa48[_0x3060('0x1c')](_0x5c9353)[_0x3060('0x1d')](_0x157673);}};}function respondWithFilteredResult(_0x13132b,_0x23a829){return function(_0x291312){if(_0x291312){var _0x3a754c=_0x291312[_0x3060('0x1e')],_0x824356=_0x23a829['offset'],_0x3cab0d=_0x23a829[_0x3060('0x1f')]+_0x23a829[_0x3060('0x20')],_0x33661a;if(_0x3cab0d>=_0x3a754c){_0x3cab0d=_0x3a754c;_0x33661a=0xc8;}else{_0x33661a=0xce;}_0x13132b[_0x3060('0x1c')](_0x33661a);return _0x13132b['set'](_0x3060('0x21'),_0x824356+'-'+_0x3cab0d+'/'+_0x3a754c)['json'](_0x291312);}return null;};}function patchUpdates(_0xca71a3){return function(_0x39587f){try{jsonpatch[_0x3060('0x22')](_0x39587f,_0xca71a3,!![]);}catch(_0x5727a5){return BPromise[_0x3060('0x23')](_0x5727a5);}return _0x39587f['save']();};}function saveUpdates(_0x19b7be,_0x42571e){return function(_0x2011ff){if(_0x2011ff){return _0x2011ff[_0x3060('0x24')](_0x19b7be)[_0x3060('0x25')](function(_0xb112ff){return _0xb112ff;});}return null;};}function removeEntity(_0x2129b7,_0x5d470){return function(_0x337c35){if(_0x337c35){return _0x337c35['destroy']()['then'](function(){_0x2129b7['status'](0xcc)[_0x3060('0x1b')]();});}};}function handleEntityNotFound(_0x3b80cd,_0x206ee1){return function(_0x3a140b){if(!_0x3a140b){_0x3b80cd[_0x3060('0x1a')](0x194);}return _0x3a140b;};}function handleError(_0x5ea6c6,_0x33fd8a){_0x33fd8a=_0x33fd8a||0x1f4;return function(_0x4a00aa){logger[_0x3060('0x26')](_0x4a00aa[_0x3060('0x27')]);if(_0x4a00aa['name']){delete _0x4a00aa[_0x3060('0x28')];}_0x5ea6c6['status'](_0x33fd8a)[_0x3060('0x29')](_0x4a00aa);};}exports[_0x3060('0x2a')]=function(_0x29116e,_0x59bd16){var _0x53c05b={},_0x311d3c={},_0x22fa8d={'count':0x0,'rows':[]};var _0x4939a2=_['map'](db[_0x3060('0x2b')][_0x3060('0x2c')],function(_0x3daa68){return{'name':_0x3daa68[_0x3060('0x2d')],'type':_0x3daa68[_0x3060('0x2e')][_0x3060('0x2f')]};});_0x311d3c[_0x3060('0x30')]=_[_0x3060('0x31')](_0x4939a2,_0x3060('0x28'));_0x311d3c[_0x3060('0x32')]=_[_0x3060('0x33')](_0x29116e[_0x3060('0x32')]);_0x311d3c[_0x3060('0x34')]=_['intersection'](_0x311d3c[_0x3060('0x30')],_0x311d3c[_0x3060('0x32')]);_0x53c05b[_0x3060('0x35')]=_[_0x3060('0x36')](_0x311d3c[_0x3060('0x30')],qs[_0x3060('0x37')](_0x29116e[_0x3060('0x32')]['fields']));_0x53c05b[_0x3060('0x35')]=_0x53c05b[_0x3060('0x35')][_0x3060('0x38')]?_0x53c05b[_0x3060('0x35')]:_0x311d3c['model'];if(!_0x29116e[_0x3060('0x32')]['hasOwnProperty'](_0x3060('0x39'))){_0x53c05b['limit']=qs['limit'](_0x29116e[_0x3060('0x32')][_0x3060('0x20')]);_0x53c05b[_0x3060('0x1f')]=qs[_0x3060('0x1f')](_0x29116e[_0x3060('0x32')][_0x3060('0x1f')]);}_0x53c05b[_0x3060('0x3a')]=qs[_0x3060('0x3b')](_0x29116e['query']['sort']);_0x53c05b[_0x3060('0x3c')]=qs[_0x3060('0x34')](_[_0x3060('0x3d')](_0x29116e['query'],_0x311d3c[_0x3060('0x34')]),_0x4939a2);if(_0x29116e[_0x3060('0x32')][_0x3060('0x3e')]){_0x53c05b[_0x3060('0x3c')]=_[_0x3060('0x3f')](_0x53c05b[_0x3060('0x3c')],{'$or':_[_0x3060('0x31')](_0x4939a2,function(_0x14de0c){if(_0x14de0c[_0x3060('0x2e')]!=='VIRTUAL'){var _0x2982ea={};_0x2982ea[_0x14de0c[_0x3060('0x28')]]={'$like':'%'+_0x29116e[_0x3060('0x32')]['filter']+'%'};return _0x2982ea;}})});}_0x53c05b=_[_0x3060('0x3f')]({},_0x53c05b,_0x29116e[_0x3060('0x40')]);var _0x2e4850={'where':_0x53c05b[_0x3060('0x3c')]};return db['ChatInternalMessage'][_0x3060('0x1e')](_0x2e4850)[_0x3060('0x25')](function(_0x18d596){_0x22fa8d[_0x3060('0x1e')]=_0x18d596;if(_0x29116e[_0x3060('0x32')][_0x3060('0x41')]){_0x53c05b[_0x3060('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x3060('0x43')](_0x53c05b);})[_0x3060('0x25')](function(_0x3fee42){_0x22fa8d['rows']=_0x3fee42;return _0x22fa8d;})['then'](respondWithFilteredResult(_0x59bd16,_0x53c05b))[_0x3060('0x44')](handleError(_0x59bd16,null));};exports[_0x3060('0x45')]=function(_0x25dd2f,_0x57d371){var _0x431931={'raw':!![],'where':{'id':_0x25dd2f[_0x3060('0x46')]['id']}},_0x367c16={};_0x367c16['model']=_[_0x3060('0x33')](db[_0x3060('0x2b')]['rawAttributes']);_0x367c16['query']=_[_0x3060('0x33')](_0x25dd2f[_0x3060('0x32')]);_0x367c16[_0x3060('0x34')]=_[_0x3060('0x36')](_0x367c16[_0x3060('0x30')],_0x367c16['query']);_0x431931[_0x3060('0x35')]=_[_0x3060('0x36')](_0x367c16[_0x3060('0x30')],qs[_0x3060('0x37')](_0x25dd2f[_0x3060('0x32')]['fields']));_0x431931[_0x3060('0x35')]=_0x431931['attributes'][_0x3060('0x38')]?_0x431931[_0x3060('0x35')]:_0x367c16[_0x3060('0x30')];if(_0x25dd2f['query'][_0x3060('0x41')]){_0x431931['include']=[{'all':!![]}];}_0x431931=_['merge']({},_0x431931,_0x25dd2f[_0x3060('0x40')]);return db[_0x3060('0x2b')]['find'](_0x431931)[_0x3060('0x25')](handleEntityNotFound(_0x57d371,null))[_0x3060('0x25')](respondWithResult(_0x57d371,null))[_0x3060('0x44')](handleError(_0x57d371,null));};exports[_0x3060('0x47')]=function(_0x2d96e3,_0x155493){return db['ChatInternalMessage'][_0x3060('0x47')](_0x2d96e3[_0x3060('0x48')],{})[_0x3060('0x25')](respondWithResult(_0x155493,0xc9))['catch'](handleError(_0x155493,null));};exports[_0x3060('0x24')]=function(_0x41adda,_0x5e88af){if(_0x41adda[_0x3060('0x48')]['id']){delete _0x41adda[_0x3060('0x48')]['id'];}return db[_0x3060('0x2b')][_0x3060('0x49')]({'where':{'id':_0x41adda[_0x3060('0x46')]['id']}})[_0x3060('0x25')](handleEntityNotFound(_0x5e88af,null))[_0x3060('0x25')](saveUpdates(_0x41adda[_0x3060('0x48')],null))['then'](respondWithResult(_0x5e88af,null))['catch'](handleError(_0x5e88af,null));};exports['destroy']=function(_0x41e57b,_0x4cc678){return db[_0x3060('0x2b')][_0x3060('0x49')]({'where':{'id':_0x41e57b[_0x3060('0x46')]['id']}})[_0x3060('0x25')](handleEntityNotFound(_0x4cc678,null))[_0x3060('0x25')](removeEntity(_0x4cc678,null))[_0x3060('0x44')](handleError(_0x4cc678,null));};exports[_0x3060('0x4a')]=function(_0x2e9104,_0x5b8732){return db[_0x3060('0x2b')][_0x3060('0x4a')]()[_0x3060('0x25')](respondWithResult(_0x5b8732,null))[_0x3060('0x44')](handleError(_0x5b8732,null));};function wrapUser(_0x44dbac){return function(_0x483c1c){var _0x1427d8=_0x44dbac[_0x3060('0x4b')]({'plain':!![]});_0x1427d8[_0x3060('0x4c')]=[];if(_0x483c1c){_0x1427d8['lastMessageAt']=_0x483c1c['createdAt'];_0x1427d8[_0x3060('0x4d')]=_0x483c1c;}else{_0x1427d8[_0x3060('0x4e')]=moment(0x0)[_0x3060('0x4f')](_0x3060('0x50'));_0x1427d8['lastMessage']={};}return _0x1427d8;};}exports['getUsers']=function(_0xec9a34,_0x48a644,_0x369bd4){var _0x5e066b=[];return db[_0x3060('0x51')][_0x3060('0x43')]({'where':{'role':[_0x3060('0x52'),'admin',_0x3060('0x53')]},'attributes':['id',_0x3060('0x54'),_0x3060('0x28'),_0x3060('0x55'),_0x3060('0x56'),'internal',_0x3060('0x57'),'lastLoginAt',_0x3060('0x58'),_0x3060('0x59')],'order':qs[_0x3060('0x3b')](_0x3060('0x5a')),'include':[{'model':db[_0x3060('0x5b')],'as':_0x3060('0x5c'),'attributes':['id','name',_0x3060('0x2e')],'through':{'attributes':[]}}]})['then'](function(_0x49ad56){if(_0x49ad56){var _0x5e23e7=_0xec9a34[_0x3060('0x53')][_0x3060('0x4b')]({'plain':!![]});if(!_0x5e23e7)throw new Error(_0x3060('0x5d'));if(_0x5e23e7[_0x3060('0x55')]==='user'){return db['UserProfileSection'][_0x3060('0x49')]({'where':{'name':_0x3060('0x5e'),'userProfileId':_0x5e23e7[_0x3060('0x5f')]},'raw':!![]})[_0x3060('0x25')](function(_0x99af87){if(_0x99af87){if(_0x99af87[_0x3060('0x60')]===0x0){return db[_0x3060('0x61')][_0x3060('0x43')]({'where':{'sectionId':_0x99af87['id']},'raw':!![]})[_0x3060('0x25')](function(_0x11d284){var _0x227d91=[];if(_[_0x3060('0x62')](_0x11d284)){_0x227d91=_[_0x3060('0x3e')](_0x49ad56,function(_0x29c1a3){if(_0x29c1a3['role']!==_0x3060('0x52')){return _0x29c1a3;}});return _0x227d91;}else{for(var _0x2d2469=0x0;_0x2d2469<_0x49ad56[_0x3060('0x38')];_0x2d2469++){var _0x36f414=_0x49ad56[_0x2d2469];if(_0x36f414[_0x3060('0x55')]===_0x3060('0x52')){var _0x286795=_[_0x3060('0x49')](_0x11d284,function(_0xf92c3e){return _0xf92c3e['resourceId']===_0x36f414['id'];});if(_0x286795)_0x227d91[_0x3060('0x63')](_0x36f414);}else{_0x227d91[_0x3060('0x63')](_0x36f414);}}return _0x227d91;}});}else{return _0x49ad56;}}else{var _0x5a249b=_[_0x3060('0x3e')](_0x49ad56,function(_0x46179d){if(_0x46179d[_0x3060('0x55')]!==_0x3060('0x52')){return _0x46179d;}});return _0x5a249b;}});}else{return _0x49ad56;}}})[_0x3060('0x25')](function(_0x3e74b7){var _0x2091c8=[];if(_0x3e74b7){_0x5e066b=_0x3e74b7;for(var _0x23e95c=0x0;_0x23e95c<_0x3e74b7[_0x3060('0x38')];_0x23e95c+=0x1){_0x5e066b[_0x23e95c][_0x3060('0x4c')]=[];_0x2091c8[_0x3060('0x63')](db['ChatInternalMessage'][_0x3060('0x49')]({'where':{'FromId':[_0xec9a34[_0x3060('0x53')]['id'],_0x3e74b7[_0x23e95c]['id']],'ToId':[_0xec9a34['user']['id'],_0x3e74b7[_0x23e95c]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x3060('0x64'),_0x3060('0x65'),_0x3060('0x48')],'order':qs[_0x3060('0x3b')](_0x3060('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3060('0x25')](wrapUser(_0x3e74b7[_0x23e95c])));}return BPromise[_0x3060('0x67')](_0x2091c8);}return[];})[_0x3060('0x25')](function(_0x4b8eee){return{'rows':_0x4b8eee,'count':_0x4b8eee['length']};})[_0x3060('0x25')](respondWithResult(_0x48a644,null))[_0x3060('0x44')](handleError(_0x48a644,null));}; \ No newline at end of file +var _0xb1db=['lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','agent','resourceId','push','messages','FromId','ToId','read','all','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','catch','create','body','update','find','describe','get','lastMessageAt','createdAt'];(function(_0x424e0c,_0x2759fb){var _0xd77466=function(_0x5e8602){while(--_0x5e8602){_0x424e0c['push'](_0x424e0c['shift']());}};_0xd77466(++_0x2759fb);}(_0xb1db,0x174));var _0xbb1d=function(_0x1cce40,_0x2773c1){_0x1cce40=_0x1cce40-0x0;var _0x444893=_0xb1db[_0x1cce40];return _0x444893;};'use strict';var pdf=require(_0xbb1d('0x0'));var emlformat=require(_0xbb1d('0x1'));var rimraf=require(_0xbb1d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb1d('0x3'));var moment=require(_0xbb1d('0x4'));var BPromise=require(_0xbb1d('0x5'));var Mustache=require(_0xbb1d('0x6'));var util=require('util');var path=require(_0xbb1d('0x7'));var sox=require(_0xbb1d('0x8'));var csv=require(_0xbb1d('0x9'));var ejs=require(_0xbb1d('0xa'));var fs=require('fs');var _=require(_0xbb1d('0xb'));var squel=require(_0xbb1d('0xc'));var crypto=require(_0xbb1d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbb1d('0xe'));var toCsv=require(_0xbb1d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbb1d('0xf'));var authService=require(_0xbb1d('0x10'));var qs=require(_0xbb1d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb1d('0x12'));var logger=require(_0xbb1d('0x13'))(_0xbb1d('0x14'));var utils=require(_0xbb1d('0x15'));var config=require(_0xbb1d('0x16'));var db=require(_0xbb1d('0x17'))['db'];config['redis']=_[_0xbb1d('0x18')](config[_0xbb1d('0x19')],{'host':_0xbb1d('0x1a'),'port':0x18eb});var socket=require(_0xbb1d('0x1b'))(new Redis(config['redis']));require(_0xbb1d('0x1c'))[_0xbb1d('0x1d')](socket);function respondWithStatusCode(_0xc60f7c,_0x43919a){_0x43919a=_0x43919a||0xcc;return function(_0x42f7e3){if(_0x42f7e3){return _0xc60f7c[_0xbb1d('0x1e')](_0x43919a);}return _0xc60f7c[_0xbb1d('0x1f')](_0x43919a)['end']();};}function respondWithResult(_0x2b22b6,_0x4200c2){_0x4200c2=_0x4200c2||0xc8;return function(_0x37f9ff){if(_0x37f9ff){return _0x2b22b6[_0xbb1d('0x1f')](_0x4200c2)[_0xbb1d('0x20')](_0x37f9ff);}};}function respondWithFilteredResult(_0x4e0880,_0x3a3f9c){return function(_0x2563df){if(_0x2563df){var _0x93132b=_0x2563df[_0xbb1d('0x21')],_0x4cb1ae=_0x3a3f9c[_0xbb1d('0x22')],_0x1f283d=_0x3a3f9c['offset']+_0x3a3f9c[_0xbb1d('0x23')],_0xd66d91;if(_0x1f283d>=_0x93132b){_0x1f283d=_0x93132b;_0xd66d91=0xc8;}else{_0xd66d91=0xce;}_0x4e0880['status'](_0xd66d91);return _0x4e0880[_0xbb1d('0x24')](_0xbb1d('0x25'),_0x4cb1ae+'-'+_0x1f283d+'/'+_0x93132b)['json'](_0x2563df);}return null;};}function patchUpdates(_0x8664dc){return function(_0x22050d){try{jsonpatch[_0xbb1d('0x26')](_0x22050d,_0x8664dc,!![]);}catch(_0x4c58d3){return BPromise[_0xbb1d('0x27')](_0x4c58d3);}return _0x22050d[_0xbb1d('0x28')]();};}function saveUpdates(_0x804fda,_0x18687b){return function(_0x5799ee){if(_0x5799ee){return _0x5799ee['update'](_0x804fda)[_0xbb1d('0x29')](function(_0x11d738){return _0x11d738;});}return null;};}function removeEntity(_0x226597,_0x2a5086){return function(_0x53c9be){if(_0x53c9be){return _0x53c9be[_0xbb1d('0x2a')]()[_0xbb1d('0x29')](function(){_0x226597[_0xbb1d('0x1f')](0xcc)[_0xbb1d('0x2b')]();});}};}function handleEntityNotFound(_0x53b7bf,_0x2aa62c){return function(_0x27fce1){if(!_0x27fce1){_0x53b7bf[_0xbb1d('0x1e')](0x194);}return _0x27fce1;};}function handleError(_0x16ded2,_0x23f5b6){_0x23f5b6=_0x23f5b6||0x1f4;return function(_0x54de21){logger[_0xbb1d('0x2c')](_0x54de21[_0xbb1d('0x2d')]);if(_0x54de21[_0xbb1d('0x2e')]){delete _0x54de21[_0xbb1d('0x2e')];}_0x16ded2['status'](_0x23f5b6)[_0xbb1d('0x2f')](_0x54de21);};}exports['index']=function(_0x24c0f,_0x220113){var _0x3bd6f0={},_0x33c207={},_0x2230c4={'count':0x0,'rows':[]};var _0x3cbf5c=_[_0xbb1d('0x30')](db[_0xbb1d('0x31')][_0xbb1d('0x32')],function(_0x2fd94c){return{'name':_0x2fd94c[_0xbb1d('0x33')],'type':_0x2fd94c[_0xbb1d('0x34')]['key']};});_0x33c207['model']=_[_0xbb1d('0x30')](_0x3cbf5c,_0xbb1d('0x2e'));_0x33c207[_0xbb1d('0x35')]=_['keys'](_0x24c0f[_0xbb1d('0x35')]);_0x33c207['filters']=_[_0xbb1d('0x36')](_0x33c207[_0xbb1d('0x37')],_0x33c207[_0xbb1d('0x35')]);_0x3bd6f0['attributes']=_['intersection'](_0x33c207['model'],qs[_0xbb1d('0x38')](_0x24c0f[_0xbb1d('0x35')][_0xbb1d('0x38')]));_0x3bd6f0[_0xbb1d('0x39')]=_0x3bd6f0['attributes'][_0xbb1d('0x3a')]?_0x3bd6f0[_0xbb1d('0x39')]:_0x33c207[_0xbb1d('0x37')];if(!_0x24c0f[_0xbb1d('0x35')][_0xbb1d('0x3b')](_0xbb1d('0x3c'))){_0x3bd6f0[_0xbb1d('0x23')]=qs[_0xbb1d('0x23')](_0x24c0f[_0xbb1d('0x35')][_0xbb1d('0x23')]);_0x3bd6f0['offset']=qs[_0xbb1d('0x22')](_0x24c0f['query'][_0xbb1d('0x22')]);}_0x3bd6f0['order']=qs[_0xbb1d('0x3d')](_0x24c0f[_0xbb1d('0x35')][_0xbb1d('0x3d')]);_0x3bd6f0[_0xbb1d('0x3e')]=qs[_0xbb1d('0x3f')](_[_0xbb1d('0x40')](_0x24c0f['query'],_0x33c207[_0xbb1d('0x3f')]),_0x3cbf5c);if(_0x24c0f['query'][_0xbb1d('0x41')]){_0x3bd6f0['where']=_['merge'](_0x3bd6f0['where'],{'$or':_[_0xbb1d('0x30')](_0x3cbf5c,function(_0x25c61c){if(_0x25c61c[_0xbb1d('0x34')]!==_0xbb1d('0x42')){var _0x58f941={};_0x58f941[_0x25c61c[_0xbb1d('0x2e')]]={'$like':'%'+_0x24c0f[_0xbb1d('0x35')][_0xbb1d('0x41')]+'%'};return _0x58f941;}})});}_0x3bd6f0=_[_0xbb1d('0x43')]({},_0x3bd6f0,_0x24c0f[_0xbb1d('0x44')]);var _0x16e17b={'where':_0x3bd6f0[_0xbb1d('0x3e')]};return db[_0xbb1d('0x31')][_0xbb1d('0x21')](_0x16e17b)['then'](function(_0x5cac0f){_0x2230c4[_0xbb1d('0x21')]=_0x5cac0f;if(_0x24c0f[_0xbb1d('0x35')][_0xbb1d('0x45')]){_0x3bd6f0[_0xbb1d('0x46')]=[{'all':!![]}];}return db[_0xbb1d('0x31')][_0xbb1d('0x47')](_0x3bd6f0);})[_0xbb1d('0x29')](function(_0x47f8cd){_0x2230c4[_0xbb1d('0x48')]=_0x47f8cd;return _0x2230c4;})[_0xbb1d('0x29')](respondWithFilteredResult(_0x220113,_0x3bd6f0))['catch'](handleError(_0x220113,null));};exports['show']=function(_0x439e41,_0xd2c28e){var _0xf470ae={'raw':!![],'where':{'id':_0x439e41[_0xbb1d('0x49')]['id']}},_0x446f93={};_0x446f93['model']=_['keys'](db[_0xbb1d('0x31')][_0xbb1d('0x32')]);_0x446f93[_0xbb1d('0x35')]=_[_0xbb1d('0x4a')](_0x439e41[_0xbb1d('0x35')]);_0x446f93['filters']=_[_0xbb1d('0x36')](_0x446f93[_0xbb1d('0x37')],_0x446f93[_0xbb1d('0x35')]);_0xf470ae['attributes']=_['intersection'](_0x446f93[_0xbb1d('0x37')],qs['fields'](_0x439e41[_0xbb1d('0x35')][_0xbb1d('0x38')]));_0xf470ae[_0xbb1d('0x39')]=_0xf470ae[_0xbb1d('0x39')][_0xbb1d('0x3a')]?_0xf470ae[_0xbb1d('0x39')]:_0x446f93[_0xbb1d('0x37')];if(_0x439e41[_0xbb1d('0x35')][_0xbb1d('0x45')]){_0xf470ae[_0xbb1d('0x46')]=[{'all':!![]}];}_0xf470ae=_[_0xbb1d('0x43')]({},_0xf470ae,_0x439e41[_0xbb1d('0x44')]);return db[_0xbb1d('0x31')]['find'](_0xf470ae)[_0xbb1d('0x29')](handleEntityNotFound(_0xd2c28e,null))[_0xbb1d('0x29')](respondWithResult(_0xd2c28e,null))[_0xbb1d('0x4b')](handleError(_0xd2c28e,null));};exports['create']=function(_0x3738cb,_0x3b0dd0){return db[_0xbb1d('0x31')][_0xbb1d('0x4c')](_0x3738cb[_0xbb1d('0x4d')],{})[_0xbb1d('0x29')](respondWithResult(_0x3b0dd0,0xc9))[_0xbb1d('0x4b')](handleError(_0x3b0dd0,null));};exports[_0xbb1d('0x4e')]=function(_0x2b0cd3,_0x4119b6){if(_0x2b0cd3[_0xbb1d('0x4d')]['id']){delete _0x2b0cd3[_0xbb1d('0x4d')]['id'];}return db['ChatInternalMessage'][_0xbb1d('0x4f')]({'where':{'id':_0x2b0cd3[_0xbb1d('0x49')]['id']}})[_0xbb1d('0x29')](handleEntityNotFound(_0x4119b6,null))[_0xbb1d('0x29')](saveUpdates(_0x2b0cd3[_0xbb1d('0x4d')],null))[_0xbb1d('0x29')](respondWithResult(_0x4119b6,null))['catch'](handleError(_0x4119b6,null));};exports[_0xbb1d('0x2a')]=function(_0x8455c8,_0x4bca56){return db[_0xbb1d('0x31')][_0xbb1d('0x4f')]({'where':{'id':_0x8455c8[_0xbb1d('0x49')]['id']}})[_0xbb1d('0x29')](handleEntityNotFound(_0x4bca56,null))[_0xbb1d('0x29')](removeEntity(_0x4bca56,null))[_0xbb1d('0x4b')](handleError(_0x4bca56,null));};exports[_0xbb1d('0x50')]=function(_0x5a4cdc,_0x59c072){return db[_0xbb1d('0x31')][_0xbb1d('0x50')]()['then'](respondWithResult(_0x59c072,null))[_0xbb1d('0x4b')](handleError(_0x59c072,null));};function wrapUser(_0x37d487){return function(_0x5cbddb){var _0x316da2=_0x37d487[_0xbb1d('0x51')]({'plain':!![]});_0x316da2['messages']=[];if(_0x5cbddb){_0x316da2[_0xbb1d('0x52')]=_0x5cbddb[_0xbb1d('0x53')];_0x316da2[_0xbb1d('0x54')]=_0x5cbddb;}else{_0x316da2['lastMessageAt']=moment(0x0)[_0xbb1d('0x55')](_0xbb1d('0x56'));_0x316da2[_0xbb1d('0x54')]={};}return _0x316da2;};}exports[_0xbb1d('0x57')]=function(_0x365f4f,_0x512d6c,_0x33f12a){var _0x270ec3=[];return db[_0xbb1d('0x58')][_0xbb1d('0x47')]({'where':{'role':['agent',_0xbb1d('0x59'),_0xbb1d('0x5a')]},'attributes':['id',_0xbb1d('0x5b'),_0xbb1d('0x2e'),'role',_0xbb1d('0x5c'),'internal',_0xbb1d('0x5d'),_0xbb1d('0x5e'),_0xbb1d('0x5f'),_0xbb1d('0x60')],'order':qs[_0xbb1d('0x3d')](_0xbb1d('0x61')),'include':[{'model':db[_0xbb1d('0x62')],'as':_0xbb1d('0x63'),'attributes':['id','name',_0xbb1d('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x54ac3c){if(_0x54ac3c){var _0x36b179=_0x365f4f[_0xbb1d('0x5a')][_0xbb1d('0x51')]({'plain':!![]});if(!_0x36b179)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36b179[_0xbb1d('0x64')]===_0xbb1d('0x5a')){return db[_0xbb1d('0x65')][_0xbb1d('0x4f')]({'where':{'name':_0xbb1d('0x66'),'userProfileId':_0x36b179[_0xbb1d('0x67')]},'raw':!![]})['then'](function(_0x36853d){if(_0x36853d){if(_0x36853d[_0xbb1d('0x68')]===0x0){return db['UserProfileResource'][_0xbb1d('0x47')]({'where':{'sectionId':_0x36853d['id']},'raw':!![]})[_0xbb1d('0x29')](function(_0x4adceb){var _0x4545cf=[];if(_[_0xbb1d('0x69')](_0x4adceb)){_0x4545cf=_[_0xbb1d('0x41')](_0x54ac3c,function(_0x17b5b6){if(_0x17b5b6['role']!=='agent'){return _0x17b5b6;}});return _0x4545cf;}else{for(var _0x5adab9=0x0;_0x5adab9<_0x54ac3c[_0xbb1d('0x3a')];_0x5adab9++){var _0x122c7a=_0x54ac3c[_0x5adab9];if(_0x122c7a[_0xbb1d('0x64')]===_0xbb1d('0x6a')){var _0x29011e=_[_0xbb1d('0x4f')](_0x4adceb,function(_0x4833bc){return _0x4833bc[_0xbb1d('0x6b')]===_0x122c7a['id'];});if(_0x29011e)_0x4545cf[_0xbb1d('0x6c')](_0x122c7a);}else{_0x4545cf['push'](_0x122c7a);}}return _0x4545cf;}});}else{return _0x54ac3c;}}else{var _0x10a61c=_[_0xbb1d('0x41')](_0x54ac3c,function(_0x55a58f){if(_0x55a58f['role']!==_0xbb1d('0x6a')){return _0x55a58f;}});return _0x10a61c;}});}else{return _0x54ac3c;}}})[_0xbb1d('0x29')](function(_0x3f1dde){var _0x4051d9=[];if(_0x3f1dde){_0x270ec3=_0x3f1dde;for(var _0x34a906=0x0;_0x34a906<_0x3f1dde[_0xbb1d('0x3a')];_0x34a906+=0x1){_0x270ec3[_0x34a906][_0xbb1d('0x6d')]=[];_0x4051d9[_0xbb1d('0x6c')](db[_0xbb1d('0x31')][_0xbb1d('0x4f')]({'where':{'FromId':[_0x365f4f['user']['id'],_0x3f1dde[_0x34a906]['id']],'ToId':[_0x365f4f[_0xbb1d('0x5a')]['id'],_0x3f1dde[_0x34a906]['id']],'ChatGroupId':null},'attributes':['id',_0xbb1d('0x53'),_0xbb1d('0x6e'),_0xbb1d('0x6f'),_0xbb1d('0x70'),_0xbb1d('0x4d')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3f1dde[_0x34a906])));}return BPromise[_0xbb1d('0x71')](_0x4051d9);}return[];})[_0xbb1d('0x29')](function(_0x1cfd7f){return{'rows':_0x1cfd7f,'count':_0x1cfd7f[_0xbb1d('0x3a')]};})[_0xbb1d('0x29')](respondWithResult(_0x512d6c,null))['catch'](handleError(_0x512d6c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0bab8ab..b60ab43 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 _0xe984=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x59dd8e,_0x36cf78){var _0x2a603b=function(_0x27024c){while(--_0x27024c){_0x59dd8e['push'](_0x59dd8e['shift']());}};_0x2a603b(++_0x36cf78);}(_0xe984,0xe2));var _0x4e98=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xe984[_0x5235a6];return _0x1cf37e;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x4e98('0x0'))['db'][_0x4e98('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4e98('0x2')](0x0);var events={'afterCreate':_0x4e98('0x3'),'afterUpdate':_0x4e98('0x4'),'afterDestroy':_0x4e98('0x5')};function emitEvent(_0x2fff79){return function(_0x22252c,_0xfa4cd4,_0x465e9c){ChatInternalMessageEvents['emit'](_0x2fff79+':'+_0x22252c['id'],_0x22252c);ChatInternalMessageEvents[_0x4e98('0x6')](_0x2fff79,_0x22252c);_0x465e9c(null);};}for(var e in events){if(events[_0x4e98('0x7')](e)){var event=events[e];ChatInternalMessage[_0x4e98('0x8')](e,emitEvent(event));}}module[_0x4e98('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xfd0f=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x428497,_0x5acd1d){_0x428497=_0x428497-0x0;var _0x4f3ac6=_0xfd0f[_0x428497];return _0x4f3ac6;};'use strict';var EventEmitter=require(_0xffd0('0x0'));var ChatInternalMessage=require(_0xffd0('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xffd0('0x2')](0x0);var events={'afterCreate':_0xffd0('0x3'),'afterUpdate':_0xffd0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x33e4d8){return function(_0x5e9c0a,_0x303f38,_0x45ecf8){ChatInternalMessageEvents[_0xffd0('0x5')](_0x33e4d8+':'+_0x5e9c0a['id'],_0x5e9c0a);ChatInternalMessageEvents[_0xffd0('0x5')](_0x33e4d8,_0x5e9c0a);_0x45ecf8(null);};}for(var e in events){if(events[_0xffd0('0x6')](e)){var event=events[e];ChatInternalMessage[_0xffd0('0x7')](e,emitEvent(event));}}module[_0xffd0('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index dec8d1c..f7ae140 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 _0xaa88=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage'];(function(_0x45651d,_0x1ff157){var _0x1fcc54=function(_0x452e19){while(--_0x452e19){_0x45651d['push'](_0x45651d['shift']());}};_0x1fcc54(++_0x1ff157);}(_0xaa88,0x137));var _0x8aa8=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0xaa88[_0x4a5f6c];return _0x281ffd;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aa8('0xc'),'collate':_0x8aa8('0xd')});}; \ 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(_0xad1f86,_0x569e51){var _0x2c770b=function(_0x5a6ce0){while(--_0x5a6ce0){_0xad1f86['push'](_0xad1f86['shift']());}};_0x2c770b(++_0x569e51);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xb7e7[_0x42bc91];return _0x3f5507;};'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 8038c76..f9ea262 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 _0x42b0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x4dcd79,_0x45a942){var _0x17bd0e=function(_0x3bb489){while(--_0x3bb489){_0x4dcd79['push'](_0x4dcd79['shift']());}};_0x17bd0e(++_0x45a942);}(_0x42b0,0x70));var _0x042b=function(_0x221637,_0x42a5e0){_0x221637=_0x221637-0x0;var _0x11bf9e=_0x42b0[_0x221637];return _0x11bf9e;};'use strict';var _=require(_0x042b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x042b('0x1'));var fs=require('fs');var Redis=require(_0x042b('0x2'));var db=require(_0x042b('0x3'))['db'];var utils=require(_0x042b('0x4'));var logger=require(_0x042b('0x5'))(_0x042b('0x6'));var config=require(_0x042b('0x7'));var jayson=require(_0x042b('0x8'));var client=jayson[_0x042b('0x9')][_0x042b('0xa')]({'port':0x232a});config['redis']=_[_0x042b('0xb')](config[_0x042b('0xc')],{'host':_0x042b('0xd'),'port':0x18eb});var socket=require(_0x042b('0xe'))(new Redis(config[_0x042b('0xc')]));require(_0x042b('0xf'))['register'](socket);function respondWithRpcPromise(_0x365ee2,_0x597e5c,_0x15b870){return new BPromise(function(_0x26c66e,_0x4eb51b){return client[_0x042b('0x10')](_0x365ee2,_0x15b870)[_0x042b('0x11')](function(_0x54d6a3){logger[_0x042b('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x597e5c,'request\x20sent');logger[_0x042b('0x13')](_0x042b('0x14'),_0x597e5c,_0x042b('0x15'),JSON[_0x042b('0x16')](_0x54d6a3));if(_0x54d6a3[_0x042b('0x17')]){if(_0x54d6a3[_0x042b('0x17')][_0x042b('0x18')]===0x1f4){logger[_0x042b('0x17')](_0x042b('0x19'),_0x597e5c,_0x54d6a3[_0x042b('0x17')][_0x042b('0x1a')]);return _0x4eb51b(_0x54d6a3[_0x042b('0x17')][_0x042b('0x1a')]);}logger[_0x042b('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x597e5c,_0x54d6a3['error'][_0x042b('0x1a')]);return _0x26c66e(_0x54d6a3[_0x042b('0x17')][_0x042b('0x1a')]);}else{logger['info'](_0x042b('0x19'),_0x597e5c,_0x042b('0x15'));_0x26c66e(_0x54d6a3[_0x042b('0x1b')][_0x042b('0x1a')]);}})[_0x042b('0x1c')](function(_0x35234e){logger['error'](_0x042b('0x19'),_0x597e5c,_0x35234e);_0x4eb51b(_0x35234e);});});} \ No newline at end of file +var _0xcaf9=['request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','ChatInternalMessage,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','./chatInternalMessage.socket'];(function(_0x2948ba,_0x119762){var _0x39859e=function(_0x5cb1cc){while(--_0x5cb1cc){_0x2948ba['push'](_0x2948ba['shift']());}};_0x39859e(++_0x119762);}(_0xcaf9,0x142));var _0x9caf=function(_0x2f4199,_0x10c46d){_0x2f4199=_0x2f4199-0x0;var _0x4f66de=_0xcaf9[_0x2f4199];return _0x4f66de;};'use strict';var _=require(_0x9caf('0x0'));var util=require(_0x9caf('0x1'));var moment=require('moment');var BPromise=require(_0x9caf('0x2'));var rs=require(_0x9caf('0x3'));var fs=require('fs');var Redis=require(_0x9caf('0x4'));var db=require(_0x9caf('0x5'))['db'];var utils=require(_0x9caf('0x6'));var logger=require(_0x9caf('0x7'))(_0x9caf('0x8'));var config=require('../../config/environment');var jayson=require(_0x9caf('0x9'));var client=jayson[_0x9caf('0xa')]['http']({'port':0x232a});config[_0x9caf('0xb')]=_[_0x9caf('0xc')](config[_0x9caf('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9caf('0xb')]));require(_0x9caf('0xd'))['register'](socket);function respondWithRpcPromise(_0x2be43f,_0x508512,_0x4b066f){return new BPromise(function(_0x40423d,_0x27c8e1){return client[_0x9caf('0xe')](_0x2be43f,_0x4b066f)[_0x9caf('0xf')](function(_0x167f41){logger[_0x9caf('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x508512,_0x9caf('0x11'));logger[_0x9caf('0x12')](_0x9caf('0x13'),_0x508512,'request\x20sent',JSON['stringify'](_0x167f41));if(_0x167f41[_0x9caf('0x14')]){if(_0x167f41['error']['code']===0x1f4){logger[_0x9caf('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x508512,_0x167f41[_0x9caf('0x14')][_0x9caf('0x15')]);return _0x27c8e1(_0x167f41[_0x9caf('0x14')][_0x9caf('0x15')]);}logger[_0x9caf('0x14')](_0x9caf('0x16'),_0x508512,_0x167f41[_0x9caf('0x14')][_0x9caf('0x15')]);return _0x40423d(_0x167f41[_0x9caf('0x14')][_0x9caf('0x15')]);}else{logger[_0x9caf('0x10')](_0x9caf('0x16'),_0x508512,'request\x20sent');_0x40423d(_0x167f41[_0x9caf('0x17')][_0x9caf('0x15')]);}})['catch'](function(_0x1136cb){logger[_0x9caf('0x14')](_0x9caf('0x16'),_0x508512,_0x1136cb);_0x27c8e1(_0x1136cb);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 688a378..10112a3 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 _0xa739=['length','save','update','emit','removeListener','register'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa739,0x1e1));var _0x9a73=function(_0x19abc8,_0x2fb922){_0x19abc8=_0x19abc8-0x0;var _0x1e5cad=_0xa739[_0x19abc8];return _0x1e5cad;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x9a73('0x0'),'remove',_0x9a73('0x1')];function createListener(_0x33c203,_0x524293){return function(_0x149e72){_0x524293[_0x9a73('0x2')](_0x33c203,_0x149e72);};}function removeListener(_0x40fb76,_0x4ffb1a){return function(){ChatInternalMessageEvents[_0x9a73('0x3')](_0x40fb76,_0x4ffb1a);};}exports[_0x9a73('0x4')]=function(_0xcb4e9e){for(var _0x65115e=0x0,_0x3e4c86=events[_0x9a73('0x5')];_0x65115e<_0x3e4c86;_0x65115e++){var _0x3a6506=events[_0x65115e];var _0x125177=createListener('chatInternalMessage:'+_0x3a6506,_0xcb4e9e);ChatInternalMessageEvents['on'](_0x3a6506,_0x125177);}}; \ No newline at end of file +var _0x9181=['length','./chatInternalMessage.events','save','remove','update','removeListener','register'];(function(_0xd065f8,_0xb0c0fc){var _0x53dbcf=function(_0x556de6){while(--_0x556de6){_0xd065f8['push'](_0xd065f8['shift']());}};_0x53dbcf(++_0xb0c0fc);}(_0x9181,0x182));var _0x1918=function(_0x5336c2,_0x4952be){_0x5336c2=_0x5336c2-0x0;var _0x1787ae=_0x9181[_0x5336c2];return _0x1787ae;};'use strict';var ChatInternalMessageEvents=require(_0x1918('0x0'));var events=[_0x1918('0x1'),_0x1918('0x2'),_0x1918('0x3')];function createListener(_0x14f2f5,_0x5e59d9){return function(_0x2c0e9b){_0x5e59d9['emit'](_0x14f2f5,_0x2c0e9b);};}function removeListener(_0x32e178,_0x5d37ed){return function(){ChatInternalMessageEvents[_0x1918('0x4')](_0x32e178,_0x5d37ed);};}exports[_0x1918('0x5')]=function(_0x424951){for(var _0x4106d7=0x0,_0x4cf696=events[_0x1918('0x6')];_0x4106d7<_0x4cf696;_0x4106d7++){var _0x54a715=events[_0x4106d7];var _0x434acb=createListener('chatInternalMessage:'+_0x54a715,_0x424951);ChatInternalMessageEvents['on'](_0x54a715,_0x434acb);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index acbd3d0..e931157 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 _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x2c924d,_0x2d9af7){var _0x58246f=function(_0xfc43af){while(--_0xfc43af){_0x2c924d['push'](_0x2c924d['shift']());}};_0x58246f(++_0x2d9af7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb7e7[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x24b1a9,_0x32caeb){var _0x3265c=function(_0x5028b7){while(--_0x5028b7){_0x24b1a9['push'](_0x24b1a9['shift']());}};_0x3265c(++_0x32caeb);}(_0xe706,0xa3));var _0x6e70=function(_0xe4ee1e,_0xea8b9b){_0xe4ee1e=_0xe4ee1e-0x0;var _0x22f903=_0xe706[_0xe4ee1e];return _0x22f903;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['put']('/:id',controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);module[_0x6e70('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 3451161..afbbe09 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 _0xb911=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb911,0x1a0));var _0x1b91=function(_0x35f7d1,_0x39d318){_0x35f7d1=_0x35f7d1-0x0;var _0x53ac5f=_0xb911[_0x35f7d1];return _0x53ac5f;};'use strict';var Sequelize=require(_0x1b91('0x0'));module[_0x1b91('0x1')]={'body':{'type':Sequelize[_0x1b91('0x2')](_0x1b91('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1b91('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1b91('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1b91('0x5')]('in',_0x1b91('0x6')),'defaultValue':_0x1b91('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1b91('0x7')]}}; \ No newline at end of file +var _0x31e7=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x1addfa,_0x344413){var _0x188806=function(_0x3774ef){while(--_0x3774ef){_0x1addfa['push'](_0x1addfa['shift']());}};_0x188806(++_0x344413);}(_0x31e7,0xa0));var _0x731e=function(_0x4cd0bf,_0x54f608){_0x4cd0bf=_0x4cd0bf-0x0;var _0x24af58=_0x31e7[_0x4cd0bf];return _0x24af58;};'use strict';var Sequelize=require(_0x731e('0x0'));module[_0x731e('0x1')]={'body':{'type':Sequelize[_0x731e('0x2')](_0x731e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x731e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x731e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x731e('0x5')]('in',_0x731e('0x6')),'defaultValue':_0x731e('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x731e('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6045c19..f391ff1 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 _0x94be=['end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','ChatMessage','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','params','rawAttributes','includeAll','create','body','find','describe','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','parse','formData','chat-interactions','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status'];(function(_0x213e34,_0x22d230){var _0x2eae36=function(_0x33dc19){while(--_0x33dc19){_0x213e34['push'](_0x213e34['shift']());}};_0x2eae36(++_0x22d230);}(_0x94be,0x1c4));var _0xe94b=function(_0x149e4c,_0xfc6146){_0x149e4c=_0x149e4c-0x0;var _0x3bfa4b=_0x94be[_0x149e4c];return _0x3bfa4b;};'use strict';var pdf=require(_0xe94b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe94b('0x1'));var zipdir=require(_0xe94b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe94b('0x3'));var moment=require(_0xe94b('0x4'));var BPromise=require(_0xe94b('0x5'));var Mustache=require(_0xe94b('0x6'));var util=require('util');var path=require(_0xe94b('0x7'));var sox=require(_0xe94b('0x8'));var csv=require('to-csv');var ejs=require(_0xe94b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe94b('0xa'));var crypto=require('crypto');var jsforce=require(_0xe94b('0xb'));var deskjs=require(_0xe94b('0xc'));var toCsv=require(_0xe94b('0xd'));var querystring=require(_0xe94b('0xe'));var Papa=require('papaparse');var Redis=require(_0xe94b('0xf'));var authService=require(_0xe94b('0x10'));var qs=require(_0xe94b('0x11'));var as=require(_0xe94b('0x12'));var hardwareService=require(_0xe94b('0x13'));var logger=require(_0xe94b('0x14'))(_0xe94b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe94b('0x16'))['db'];config[_0xe94b('0x17')]=_[_0xe94b('0x18')](config[_0xe94b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xe94b('0x19'))(new Redis(config[_0xe94b('0x17')]));require('./chatMessage.socket')[_0xe94b('0x1a')](socket);var jayson=require(_0xe94b('0x1b'));var client=jayson[_0xe94b('0x1c')][_0xe94b('0x1d')]({'port':0x232c});var client9002=jayson[_0xe94b('0x1c')][_0xe94b('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4112c5,_0x2e51aa,_0x4c7413){if(_0x4c7413){var _0x5c9208=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c9208[_0xe94b('0x1e')](_0x2e51aa)){return _0x4112c5;}else{throw new db[(_0xe94b('0x1f'))]['ValidationError'](_0xe94b('0x20'));}}else{return _0x4112c5;}}function respondWithRpcPromise(_0x40b1a2,_0x261927,_0x2094c6,_0x4958c9){return new BPromise(function(_0x52976f,_0x830b93){var _0x3991ef=_0x4958c9||client;return _0x3991ef[_0xe94b('0x21')](_0x40b1a2,_0x2094c6)['then'](function(_0x50805f){logger[_0xe94b('0x22')]('ChatMessage,\x20%s,\x20%s',_0x261927,_0xe94b('0x23'));logger['debug'](_0xe94b('0x24'),_0x261927,_0xe94b('0x23'),JSON['stringify'](_0x50805f));if(_0x50805f['error']){if(_0x50805f[_0xe94b('0x25')][_0xe94b('0x26')]===0x1f4){logger['error'](_0xe94b('0x27'),_0x261927,_0x50805f[_0xe94b('0x25')]['message']);return _0x830b93(_0x50805f[_0xe94b('0x25')][_0xe94b('0x28')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x261927,_0x50805f[_0xe94b('0x25')][_0xe94b('0x28')]);return _0x52976f(_0x50805f[_0xe94b('0x25')][_0xe94b('0x28')]);}else{logger['info'](_0xe94b('0x27'),_0x261927,_0xe94b('0x23'));_0x52976f(_0x50805f[_0xe94b('0x29')][_0xe94b('0x28')]);}})[_0xe94b('0x2a')](function(_0x1202bf){logger[_0xe94b('0x25')](_0xe94b('0x27'),_0x261927,_0x1202bf);_0x830b93(_0x1202bf);});});}function respondWithStatusCode(_0x37957e,_0x5c3167){_0x5c3167=_0x5c3167||0xcc;return function(_0x3cc041){if(_0x3cc041){return _0x37957e['sendStatus'](_0x5c3167);}return _0x37957e[_0xe94b('0x2b')](_0x5c3167)[_0xe94b('0x2c')]();};}function respondWithResult(_0x3a4a1b,_0x65fe6f){_0x65fe6f=_0x65fe6f||0xc8;return function(_0x366e62){if(_0x366e62){return _0x3a4a1b[_0xe94b('0x2b')](_0x65fe6f)['json'](_0x366e62);}};}function respondWithFilteredResult(_0x51383f,_0x1c5479){return function(_0x1bc87f){if(_0x1bc87f){var _0xc2b6f7=_0x1bc87f[_0xe94b('0x2d')],_0x2223f6=_0x1c5479[_0xe94b('0x2e')],_0x35792d=_0x1c5479['offset']+_0x1c5479['limit'],_0x5ad878;if(_0x35792d>=_0xc2b6f7){_0x35792d=_0xc2b6f7;_0x5ad878=0xc8;}else{_0x5ad878=0xce;}_0x51383f[_0xe94b('0x2b')](_0x5ad878);return _0x51383f[_0xe94b('0x2f')](_0xe94b('0x30'),_0x2223f6+'-'+_0x35792d+'/'+_0xc2b6f7)[_0xe94b('0x31')](_0x1bc87f);}return null;};}function patchUpdates(_0x36bf8b){return function(_0x2ff050){try{jsonpatch[_0xe94b('0x32')](_0x2ff050,_0x36bf8b,!![]);}catch(_0x5dbc65){return BPromise[_0xe94b('0x33')](_0x5dbc65);}return _0x2ff050[_0xe94b('0x34')]();};}function saveUpdates(_0x59b63b,_0x33cef2){return function(_0x29b4a7){if(_0x29b4a7){return _0x29b4a7[_0xe94b('0x35')](_0x59b63b)['then'](function(_0xf94fd6){return _0xf94fd6;});}return null;};}function removeEntity(_0x17a9b7,_0x77c118){return function(_0x2b09b1){if(_0x2b09b1){return _0x2b09b1[_0xe94b('0x36')]()['then'](function(){_0x17a9b7[_0xe94b('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x109343,_0x503181){return function(_0xb4a5e4){if(!_0xb4a5e4){_0x109343[_0xe94b('0x37')](0x194);}return _0xb4a5e4;};}function handleError(_0x2c9278,_0x34a846){_0x34a846=_0x34a846||0x1f4;return function(_0xe80422){logger[_0xe94b('0x25')](_0xe80422[_0xe94b('0x38')]);if(_0xe80422[_0xe94b('0x39')]){delete _0xe80422[_0xe94b('0x39')];}_0x2c9278[_0xe94b('0x2b')](_0x34a846)[_0xe94b('0x3a')](_0xe80422);};}exports['index']=function(_0x53a74b,_0x2c07dc){var _0x2de6eb={},_0x569bf4={},_0x10e168={'count':0x0,'rows':[]};var _0x2b7bce=_[_0xe94b('0x3b')](db[_0xe94b('0x3c')]['rawAttributes'],function(_0x59d8c2){return{'name':_0x59d8c2[_0xe94b('0x3d')],'type':_0x59d8c2[_0xe94b('0x3e')][_0xe94b('0x3f')]};});_0x569bf4['model']=_['map'](_0x2b7bce,_0xe94b('0x39'));_0x569bf4['query']=_[_0xe94b('0x40')](_0x53a74b[_0xe94b('0x41')]);_0x569bf4[_0xe94b('0x42')]=_['intersection'](_0x569bf4[_0xe94b('0x43')],_0x569bf4[_0xe94b('0x41')]);_0x2de6eb[_0xe94b('0x44')]=_[_0xe94b('0x45')](_0x569bf4[_0xe94b('0x43')],qs['fields'](_0x53a74b[_0xe94b('0x41')][_0xe94b('0x46')]));_0x2de6eb[_0xe94b('0x44')]=_0x2de6eb[_0xe94b('0x44')][_0xe94b('0x47')]?_0x2de6eb[_0xe94b('0x44')]:_0x569bf4['model'];if(!_0x53a74b[_0xe94b('0x41')][_0xe94b('0x48')](_0xe94b('0x49'))){_0x2de6eb[_0xe94b('0x4a')]=qs[_0xe94b('0x4a')](_0x53a74b[_0xe94b('0x41')][_0xe94b('0x4a')]);_0x2de6eb[_0xe94b('0x2e')]=qs[_0xe94b('0x2e')](_0x53a74b[_0xe94b('0x41')]['offset']);}_0x2de6eb[_0xe94b('0x4b')]=qs[_0xe94b('0x4c')](_0x53a74b[_0xe94b('0x41')][_0xe94b('0x4c')]);_0x2de6eb[_0xe94b('0x4d')]=qs['filters'](_[_0xe94b('0x4e')](_0x53a74b[_0xe94b('0x41')],_0x569bf4['filters']),_0x2b7bce);if(_0x53a74b[_0xe94b('0x41')][_0xe94b('0x4f')]){_0x2de6eb[_0xe94b('0x4d')]=_[_0xe94b('0x50')](_0x2de6eb[_0xe94b('0x4d')],{'$or':_['map'](_0x2b7bce,function(_0x263453){if(_0x263453[_0xe94b('0x3e')]!==_0xe94b('0x51')){var _0x216a23={};_0x216a23[_0x263453['name']]={'$like':'%'+_0x53a74b[_0xe94b('0x41')]['filter']+'%'};return _0x216a23;}})});}_0x2de6eb=_[_0xe94b('0x50')]({},_0x2de6eb,_0x53a74b[_0xe94b('0x52')]);var _0x1bac53={'where':_0x2de6eb[_0xe94b('0x4d')]};return db[_0xe94b('0x3c')][_0xe94b('0x2d')](_0x1bac53)[_0xe94b('0x53')](function(_0x27186c){_0x10e168[_0xe94b('0x2d')]=_0x27186c;if(_0x53a74b[_0xe94b('0x41')]['includeAll']){_0x2de6eb[_0xe94b('0x54')]=[{'all':!![]}];}return db[_0xe94b('0x3c')][_0xe94b('0x55')](_0x2de6eb);})[_0xe94b('0x53')](function(_0x4f3f6b){_0x10e168[_0xe94b('0x56')]=_0x4f3f6b;return _0x10e168;})[_0xe94b('0x53')](respondWithFilteredResult(_0x2c07dc,_0x2de6eb))[_0xe94b('0x2a')](handleError(_0x2c07dc,null));};exports['show']=function(_0x703f0d,_0xf411b6){var _0x55fad1={'raw':!![],'where':{'id':_0x703f0d[_0xe94b('0x57')]['id']}},_0x480eb2={};_0x480eb2[_0xe94b('0x43')]=_[_0xe94b('0x40')](db['ChatMessage'][_0xe94b('0x58')]);_0x480eb2[_0xe94b('0x41')]=_[_0xe94b('0x40')](_0x703f0d[_0xe94b('0x41')]);_0x480eb2[_0xe94b('0x42')]=_[_0xe94b('0x45')](_0x480eb2[_0xe94b('0x43')],_0x480eb2['query']);_0x55fad1[_0xe94b('0x44')]=_[_0xe94b('0x45')](_0x480eb2[_0xe94b('0x43')],qs[_0xe94b('0x46')](_0x703f0d[_0xe94b('0x41')][_0xe94b('0x46')]));_0x55fad1[_0xe94b('0x44')]=_0x55fad1[_0xe94b('0x44')][_0xe94b('0x47')]?_0x55fad1['attributes']:_0x480eb2[_0xe94b('0x43')];if(_0x703f0d[_0xe94b('0x41')][_0xe94b('0x59')]){_0x55fad1[_0xe94b('0x54')]=[{'all':!![]}];}_0x55fad1=_['merge']({},_0x55fad1,_0x703f0d['options']);return db['ChatMessage']['find'](_0x55fad1)[_0xe94b('0x53')](handleEntityNotFound(_0xf411b6,null))[_0xe94b('0x53')](respondWithResult(_0xf411b6,null))[_0xe94b('0x2a')](handleError(_0xf411b6,null));};exports[_0xe94b('0x5a')]=function(_0x32d387,_0x5e8ec6){return db[_0xe94b('0x3c')][_0xe94b('0x5a')](_0x32d387[_0xe94b('0x5b')],{})[_0xe94b('0x53')](respondWithResult(_0x5e8ec6,0xc9))[_0xe94b('0x2a')](handleError(_0x5e8ec6,null));};exports['update']=function(_0xc9159a,_0x5a5475){if(_0xc9159a[_0xe94b('0x5b')]['id']){delete _0xc9159a['body']['id'];}return db[_0xe94b('0x3c')][_0xe94b('0x5c')]({'where':{'id':_0xc9159a[_0xe94b('0x57')]['id']}})[_0xe94b('0x53')](handleEntityNotFound(_0x5a5475,null))[_0xe94b('0x53')](saveUpdates(_0xc9159a[_0xe94b('0x5b')],null))[_0xe94b('0x53')](respondWithResult(_0x5a5475,null))[_0xe94b('0x2a')](handleError(_0x5a5475,null));};exports[_0xe94b('0x36')]=function(_0x268ff3,_0x2ccdd2){return db['ChatMessage']['find']({'where':{'id':_0x268ff3[_0xe94b('0x57')]['id']}})[_0xe94b('0x53')](handleEntityNotFound(_0x2ccdd2,null))[_0xe94b('0x53')](removeEntity(_0x2ccdd2,null))['catch'](handleError(_0x2ccdd2,null));};exports[_0xe94b('0x5d')]=function(_0x361c80,_0x25ea95){return db[_0xe94b('0x3c')][_0xe94b('0x5d')]()['then'](respondWithResult(_0x25ea95,null))[_0xe94b('0x2a')](handleError(_0x25ea95,null));};var interaction_log=require(_0xe94b('0x14'))('chat-interactions');exports[_0xe94b('0x5e')]=function(_0x52aca9,_0x5d7512,_0x3e5240){var _0x4a2f78={'channel':_0xe94b('0x5f')};if(_0x52aca9[_0xe94b('0x5b')]['id']){delete _0x52aca9['body']['id'];}_0x52aca9[_0xe94b('0x5b')][_0xe94b('0x60')]=!![];_0x52aca9[_0xe94b('0x5b')][_0xe94b('0x61')]=moment()['format'](_0xe94b('0x62'));_0x52aca9[_0xe94b('0x5b')]['UserId']=_0x52aca9[_0xe94b('0x5b')][_0xe94b('0x63')]||_0x52aca9[_0xe94b('0x64')]['id'];return db[_0xe94b('0x3c')]['find']({'where':{'id':_0x52aca9['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xe94b('0x53')](handleEntityNotFound(_0x5d7512,null))[_0xe94b('0x53')](saveUpdates(_0x52aca9['body'],null))['then'](function(_0x509585){if(_0x509585){_0x4a2f78[_0xe94b('0x28')]=_0x509585[_0xe94b('0x65')]({'plain':!![]});return db[_0xe94b('0x66')][_0xe94b('0x5c')]({'where':{'id':_0x509585[_0xe94b('0x67')]}});}return null;})[_0xe94b('0x53')](handleEntityNotFound(_0x5d7512,null))[_0xe94b('0x53')](function(_0x35615d){if(_0x35615d){return _0x35615d[_0xe94b('0x35')]({'UserId':_0x52aca9[_0xe94b('0x5b')][_0xe94b('0x63')],'read1stAt':_[_0xe94b('0x68')](_0x35615d['read1stAt'])?moment()[_0xe94b('0x69')](_0xe94b('0x62')):undefined});}return null;})[_0xe94b('0x53')](function(_0x1741f7){if(_0x1741f7){_0x4a2f78[_0xe94b('0x6a')]=_0x1741f7[_0xe94b('0x65')]({'plain':!![]});interaction_log[_0xe94b('0x22')](_0xe94b('0x6b'),_0x52aca9['user']['id'],_0x52aca9[_0xe94b('0x64')][_0xe94b('0x39')],_0x52aca9['user']['role'],_0x4a2f78[_0xe94b('0x6a')]['id'],_0x52aca9[_0xe94b('0x5b')]?JSON['stringify'](_0x52aca9['body']):_0xe94b('0x6c'));return respondWithRpcPromise(_0xe94b('0x6d'),'acceptMessage',_0x4a2f78);}return null;})[_0xe94b('0x53')](function(_0x48be97){if(_0x48be97){if(_0x52aca9[_0xe94b('0x5b')][_0xe94b('0x6e')]){_0x4a2f78[_0xe94b('0x28')][_0xe94b('0x6f')]=util['format'](_0xe94b('0x70'),_0x52aca9[_0xe94b('0x64')][_0xe94b('0x39')]);_0x4a2f78[_0xe94b('0x28')]['channel']=_0x4a2f78['channel'];_0x4a2f78[_0xe94b('0x28')][_0xe94b('0x71')]=_0xe94b('0x5e');return respondWithRpcPromise(_0xe94b('0x72'),_0xe94b('0x72'),{'event':_0xe94b('0x73'),'message':_['merge'](_0x4a2f78[_0xe94b('0x28')],JSON[_0xe94b('0x74')](_0x4a2f78[_0xe94b('0x6a')][_0xe94b('0x75')]))},client9002)['then'](function(){return _0x4a2f78;});}return _0x4a2f78;}return null;})[_0xe94b('0x53')](respondWithResult(_0x5d7512,null))['catch'](handleError(_0x5d7512,null));};var interaction_log=require(_0xe94b('0x14'))(_0xe94b('0x76'));exports[_0xe94b('0x33')]=function(_0x3033f5,_0x4543f9,_0xd3262b){var _0x3bccea={'agent':{},'channel':'chat'};if(_0x3033f5[_0xe94b('0x5b')]['id']){delete _0x3033f5['body']['id'];}_0x3033f5[_0xe94b('0x5b')][_0xe94b('0x63')]=_0x3033f5[_0xe94b('0x5b')][_0xe94b('0x63')]||_0x3033f5[_0xe94b('0x64')]['id'];_0x3bccea[_0xe94b('0x77')]['id']=_0x3033f5[_0xe94b('0x5b')][_0xe94b('0x63')];return db['ChatMessage'][_0xe94b('0x5c')]({'where':{'id':_0x3033f5[_0xe94b('0x57')]['id'],'UserId':null}})[_0xe94b('0x53')](handleEntityNotFound(_0x4543f9,null))[_0xe94b('0x53')](function(_0x2ecf85){if(_0x2ecf85){_0x3bccea[_0xe94b('0x28')]=_0x2ecf85[_0xe94b('0x65')]({'plain':!![]});return db[_0xe94b('0x66')][_0xe94b('0x5c')]({'where':{'id':_0x2ecf85[_0xe94b('0x67')]}});}return null;})[_0xe94b('0x53')](handleEntityNotFound(_0x4543f9,null))[_0xe94b('0x53')](function(_0x37e336){if(_0x37e336){_0x3bccea[_0xe94b('0x6a')]=_0x37e336[_0xe94b('0x65')]({'plain':!![]});interaction_log[_0xe94b('0x22')](_0xe94b('0x78'),_0x3033f5['user']['id'],_0x3033f5[_0xe94b('0x64')][_0xe94b('0x39')],_0x3033f5[_0xe94b('0x64')]['role'],_0x3bccea[_0xe94b('0x6a')]['id'],_0x3033f5[_0xe94b('0x5b')]?JSON['stringify'](_0x3033f5[_0xe94b('0x5b')]):_0xe94b('0x6c'));return respondWithRpcPromise(_0xe94b('0x79'),_0xe94b('0x7a'),_0x3bccea);}return null;})['then'](function(_0x562ac8){if(_0x562ac8){_0x562ac8['message'][_0xe94b('0x6f')]=util['format'](_0xe94b('0x70'),_0x3033f5[_0xe94b('0x64')][_0xe94b('0x39')]);_0x562ac8['message'][_0xe94b('0x7b')]=_0x3bccea['channel'];_0x562ac8[_0xe94b('0x28')]['event']=_0xe94b('0x33');respondWithRpcPromise(_0xe94b('0x72'),_0xe94b('0x72'),{'event':'rejectmessage','message':_0x562ac8[_0xe94b('0x28')]},client9002);return _0x3bccea;}return null;})[_0xe94b('0x53')](respondWithResult(_0x4543f9,null))[_0xe94b('0x2a')](handleError(_0x4543f9,null));}; \ No newline at end of file +var _0x175d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','ChatMessage','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','show','fields','options','find','create','body','params','destroy','chat-interactions','chat','readAt','UserId','user','CmContact','Contact','get','ChatInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','formData','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x1ca502,_0x5953b0){var _0xb484dc=function(_0x4bf430){while(--_0x4bf430){_0x1ca502['push'](_0x1ca502['shift']());}};_0xb484dc(++_0x5953b0);}(_0x175d,0x1d6));var _0xd175=function(_0x13dcfc,_0x1f49ee){_0x13dcfc=_0x13dcfc-0x0;var _0x2a3a38=_0x175d[_0x13dcfc];return _0x2a3a38;};'use strict';var pdf=require(_0xd175('0x0'));var emlformat=require(_0xd175('0x1'));var rimraf=require(_0xd175('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd175('0x3'));var rp=require(_0xd175('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd175('0x5'));var sox=require(_0xd175('0x6'));var csv=require(_0xd175('0x7'));var ejs=require(_0xd175('0x8'));var fs=require('fs');var _=require(_0xd175('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd175('0xa'));var toCsv=require(_0xd175('0x7'));var querystring=require('querystring');var Papa=require(_0xd175('0xb'));var Redis=require(_0xd175('0xc'));var authService=require(_0xd175('0xd'));var qs=require(_0xd175('0xe'));var as=require(_0xd175('0xf'));var hardwareService=require(_0xd175('0x10'));var logger=require(_0xd175('0x11'))(_0xd175('0x12'));var utils=require(_0xd175('0x13'));var config=require(_0xd175('0x14'));var db=require(_0xd175('0x15'))['db'];config[_0xd175('0x16')]=_[_0xd175('0x17')](config[_0xd175('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xd175('0x18'))(new Redis(config[_0xd175('0x16')]));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd175('0x19')][_0xd175('0x1a')]({'port':0x232c});var client9002=jayson[_0xd175('0x19')][_0xd175('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x7a0ad0,_0x17e044,_0x4c57c6){if(_0x4c57c6){var _0x27ab9a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27ab9a[_0xd175('0x1b')](_0x17e044)){return _0x7a0ad0;}else{throw new db['Sequelize'][(_0xd175('0x1c'))](_0xd175('0x1d'));}}else{return _0x7a0ad0;}}function respondWithRpcPromise(_0x591423,_0x4c1a71,_0x75694c,_0x49dda6){return new BPromise(function(_0x2326c0,_0x395f78){var _0x3dbe3b=_0x49dda6||client;return _0x3dbe3b[_0xd175('0x1e')](_0x591423,_0x75694c)[_0xd175('0x1f')](function(_0x436133){logger[_0xd175('0x20')]('ChatMessage,\x20%s,\x20%s',_0x4c1a71,_0xd175('0x21'));logger['debug'](_0xd175('0x22'),_0x4c1a71,'request\x20sent',JSON[_0xd175('0x23')](_0x436133));if(_0x436133['error']){if(_0x436133[_0xd175('0x24')][_0xd175('0x25')]===0x1f4){logger[_0xd175('0x24')](_0xd175('0x26'),_0x4c1a71,_0x436133[_0xd175('0x24')][_0xd175('0x27')]);return _0x395f78(_0x436133[_0xd175('0x24')]['message']);}logger['error'](_0xd175('0x26'),_0x4c1a71,_0x436133['error'][_0xd175('0x27')]);return _0x2326c0(_0x436133['error'][_0xd175('0x27')]);}else{logger[_0xd175('0x20')](_0xd175('0x26'),_0x4c1a71,_0xd175('0x21'));_0x2326c0(_0x436133[_0xd175('0x28')][_0xd175('0x27')]);}})[_0xd175('0x29')](function(_0x2553c1){logger[_0xd175('0x24')](_0xd175('0x26'),_0x4c1a71,_0x2553c1);_0x395f78(_0x2553c1);});});}function respondWithStatusCode(_0x4a57ff,_0x1a3fd3){_0x1a3fd3=_0x1a3fd3||0xcc;return function(_0x530f68){if(_0x530f68){return _0x4a57ff[_0xd175('0x2a')](_0x1a3fd3);}return _0x4a57ff[_0xd175('0x2b')](_0x1a3fd3)[_0xd175('0x2c')]();};}function respondWithResult(_0xb03cb0,_0x27afc1){_0x27afc1=_0x27afc1||0xc8;return function(_0x55078f){if(_0x55078f){return _0xb03cb0[_0xd175('0x2b')](_0x27afc1)[_0xd175('0x2d')](_0x55078f);}};}function respondWithFilteredResult(_0x224881,_0x4d74b7){return function(_0x2c4cba){if(_0x2c4cba){var _0x5e8646=_0x2c4cba[_0xd175('0x2e')],_0x59b126=_0x4d74b7[_0xd175('0x2f')],_0x2761a8=_0x4d74b7[_0xd175('0x2f')]+_0x4d74b7[_0xd175('0x30')],_0x44c84d;if(_0x2761a8>=_0x5e8646){_0x2761a8=_0x5e8646;_0x44c84d=0xc8;}else{_0x44c84d=0xce;}_0x224881['status'](_0x44c84d);return _0x224881['set'](_0xd175('0x31'),_0x59b126+'-'+_0x2761a8+'/'+_0x5e8646)[_0xd175('0x2d')](_0x2c4cba);}return null;};}function patchUpdates(_0x5bc61d){return function(_0x29ee40){try{jsonpatch[_0xd175('0x32')](_0x29ee40,_0x5bc61d,!![]);}catch(_0x23dd18){return BPromise[_0xd175('0x33')](_0x23dd18);}return _0x29ee40[_0xd175('0x34')]();};}function saveUpdates(_0x386071,_0x50c414){return function(_0xe359aa){if(_0xe359aa){return _0xe359aa[_0xd175('0x35')](_0x386071)[_0xd175('0x1f')](function(_0xc74cf0){return _0xc74cf0;});}return null;};}function removeEntity(_0x4a6782,_0xc2bbc7){return function(_0x43c8a0){if(_0x43c8a0){return _0x43c8a0['destroy']()[_0xd175('0x1f')](function(){_0x4a6782[_0xd175('0x2b')](0xcc)[_0xd175('0x2c')]();});}};}function handleEntityNotFound(_0x2213e5,_0x5c440c){return function(_0x306b8e){if(!_0x306b8e){_0x2213e5[_0xd175('0x2a')](0x194);}return _0x306b8e;};}function handleError(_0x362e7b,_0x3a2214){_0x3a2214=_0x3a2214||0x1f4;return function(_0x57824d){logger[_0xd175('0x24')](_0x57824d[_0xd175('0x36')]);if(_0x57824d[_0xd175('0x37')]){delete _0x57824d[_0xd175('0x37')];}_0x362e7b[_0xd175('0x2b')](_0x3a2214)[_0xd175('0x38')](_0x57824d);};}exports['index']=function(_0x5974d0,_0x4e3cb5){var _0x5c8c6b={},_0x5383d5={},_0x211019={'count':0x0,'rows':[]};var _0x2fe9dc=_['map'](db[_0xd175('0x39')][_0xd175('0x3a')],function(_0x172f76){return{'name':_0x172f76[_0xd175('0x3b')],'type':_0x172f76[_0xd175('0x3c')][_0xd175('0x3d')]};});_0x5383d5[_0xd175('0x3e')]=_[_0xd175('0x3f')](_0x2fe9dc,'name');_0x5383d5['query']=_[_0xd175('0x40')](_0x5974d0[_0xd175('0x41')]);_0x5383d5['filters']=_[_0xd175('0x42')](_0x5383d5[_0xd175('0x3e')],_0x5383d5[_0xd175('0x41')]);_0x5c8c6b[_0xd175('0x43')]=_[_0xd175('0x42')](_0x5383d5['model'],qs['fields'](_0x5974d0[_0xd175('0x41')]['fields']));_0x5c8c6b[_0xd175('0x43')]=_0x5c8c6b[_0xd175('0x43')][_0xd175('0x44')]?_0x5c8c6b[_0xd175('0x43')]:_0x5383d5[_0xd175('0x3e')];if(!_0x5974d0[_0xd175('0x41')][_0xd175('0x45')](_0xd175('0x46'))){_0x5c8c6b[_0xd175('0x30')]=qs[_0xd175('0x30')](_0x5974d0['query'][_0xd175('0x30')]);_0x5c8c6b[_0xd175('0x2f')]=qs['offset'](_0x5974d0[_0xd175('0x41')][_0xd175('0x2f')]);}_0x5c8c6b['order']=qs[_0xd175('0x47')](_0x5974d0[_0xd175('0x41')][_0xd175('0x47')]);_0x5c8c6b[_0xd175('0x48')]=qs['filters'](_[_0xd175('0x49')](_0x5974d0[_0xd175('0x41')],_0x5383d5[_0xd175('0x4a')]),_0x2fe9dc);if(_0x5974d0[_0xd175('0x41')][_0xd175('0x4b')]){_0x5c8c6b[_0xd175('0x48')]=_[_0xd175('0x4c')](_0x5c8c6b[_0xd175('0x48')],{'$or':_[_0xd175('0x3f')](_0x2fe9dc,function(_0x5d9dfb){if(_0x5d9dfb[_0xd175('0x3c')]!==_0xd175('0x4d')){var _0x116281={};_0x116281[_0x5d9dfb[_0xd175('0x37')]]={'$like':'%'+_0x5974d0[_0xd175('0x41')][_0xd175('0x4b')]+'%'};return _0x116281;}})});}_0x5c8c6b=_[_0xd175('0x4c')]({},_0x5c8c6b,_0x5974d0['options']);var _0x3c3862={'where':_0x5c8c6b['where']};return db[_0xd175('0x39')]['count'](_0x3c3862)['then'](function(_0x5efb3f){_0x211019[_0xd175('0x2e')]=_0x5efb3f;if(_0x5974d0[_0xd175('0x41')][_0xd175('0x4e')]){_0x5c8c6b[_0xd175('0x4f')]=[{'all':!![]}];}return db[_0xd175('0x39')]['findAll'](_0x5c8c6b);})[_0xd175('0x1f')](function(_0x154d37){_0x211019['rows']=_0x154d37;return _0x211019;})[_0xd175('0x1f')](respondWithFilteredResult(_0x4e3cb5,_0x5c8c6b))[_0xd175('0x29')](handleError(_0x4e3cb5,null));};exports[_0xd175('0x50')]=function(_0xe8ba4a,_0x3b439b){var _0x120211={'raw':!![],'where':{'id':_0xe8ba4a['params']['id']}},_0x222c01={};_0x222c01[_0xd175('0x3e')]=_[_0xd175('0x40')](db['ChatMessage'][_0xd175('0x3a')]);_0x222c01['query']=_[_0xd175('0x40')](_0xe8ba4a['query']);_0x222c01[_0xd175('0x4a')]=_[_0xd175('0x42')](_0x222c01[_0xd175('0x3e')],_0x222c01[_0xd175('0x41')]);_0x120211[_0xd175('0x43')]=_[_0xd175('0x42')](_0x222c01[_0xd175('0x3e')],qs[_0xd175('0x51')](_0xe8ba4a[_0xd175('0x41')]['fields']));_0x120211[_0xd175('0x43')]=_0x120211[_0xd175('0x43')][_0xd175('0x44')]?_0x120211[_0xd175('0x43')]:_0x222c01[_0xd175('0x3e')];if(_0xe8ba4a[_0xd175('0x41')]['includeAll']){_0x120211['include']=[{'all':!![]}];}_0x120211=_['merge']({},_0x120211,_0xe8ba4a[_0xd175('0x52')]);return db[_0xd175('0x39')][_0xd175('0x53')](_0x120211)[_0xd175('0x1f')](handleEntityNotFound(_0x3b439b,null))[_0xd175('0x1f')](respondWithResult(_0x3b439b,null))['catch'](handleError(_0x3b439b,null));};exports[_0xd175('0x54')]=function(_0x4bd6b7,_0x3c347e){return db['ChatMessage'][_0xd175('0x54')](_0x4bd6b7[_0xd175('0x55')],{})[_0xd175('0x1f')](respondWithResult(_0x3c347e,0xc9))[_0xd175('0x29')](handleError(_0x3c347e,null));};exports['update']=function(_0x42a3fb,_0x462975){if(_0x42a3fb[_0xd175('0x55')]['id']){delete _0x42a3fb[_0xd175('0x55')]['id'];}return db[_0xd175('0x39')][_0xd175('0x53')]({'where':{'id':_0x42a3fb[_0xd175('0x56')]['id']}})[_0xd175('0x1f')](handleEntityNotFound(_0x462975,null))[_0xd175('0x1f')](saveUpdates(_0x42a3fb[_0xd175('0x55')],null))[_0xd175('0x1f')](respondWithResult(_0x462975,null))['catch'](handleError(_0x462975,null));};exports[_0xd175('0x57')]=function(_0x56c516,_0x1f1f76){return db[_0xd175('0x39')][_0xd175('0x53')]({'where':{'id':_0x56c516[_0xd175('0x56')]['id']}})[_0xd175('0x1f')](handleEntityNotFound(_0x1f1f76,null))[_0xd175('0x1f')](removeEntity(_0x1f1f76,null))['catch'](handleError(_0x1f1f76,null));};exports['describe']=function(_0x22a9cb,_0x25aa51){return db['ChatMessage']['describe']()[_0xd175('0x1f')](respondWithResult(_0x25aa51,null))[_0xd175('0x29')](handleError(_0x25aa51,null));};var interaction_log=require('../../config/logger')(_0xd175('0x58'));exports['accept']=function(_0x33489d,_0x4909e0,_0x347fee){var _0x128b55={'channel':_0xd175('0x59')};if(_0x33489d[_0xd175('0x55')]['id']){delete _0x33489d[_0xd175('0x55')]['id'];}_0x33489d['body']['read']=!![];_0x33489d[_0xd175('0x55')][_0xd175('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x33489d[_0xd175('0x55')]['UserId']=_0x33489d['body'][_0xd175('0x5b')]||_0x33489d[_0xd175('0x5c')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x33489d[_0xd175('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xd175('0x5d')],'as':_0xd175('0x5e')}]})['then'](handleEntityNotFound(_0x4909e0,null))['then'](saveUpdates(_0x33489d[_0xd175('0x55')],null))['then'](function(_0x302168){if(_0x302168){_0x128b55['message']=_0x302168[_0xd175('0x5f')]({'plain':!![]});return db['ChatInteraction'][_0xd175('0x53')]({'where':{'id':_0x302168[_0xd175('0x60')]}});}return null;})[_0xd175('0x1f')](handleEntityNotFound(_0x4909e0,null))[_0xd175('0x1f')](function(_0x22dbb8){if(_0x22dbb8){return _0x22dbb8[_0xd175('0x35')]({'UserId':_0x33489d[_0xd175('0x55')][_0xd175('0x5b')],'read1stAt':_[_0xd175('0x61')](_0x22dbb8['read1stAt'])?moment()[_0xd175('0x62')](_0xd175('0x63')):undefined});}return null;})[_0xd175('0x1f')](function(_0x3b4ee9){if(_0x3b4ee9){_0x128b55[_0xd175('0x64')]=_0x3b4ee9['get']({'plain':!![]});interaction_log[_0xd175('0x20')](_0xd175('0x65'),_0x33489d[_0xd175('0x5c')]['id'],_0x33489d[_0xd175('0x5c')][_0xd175('0x37')],_0x33489d['user'][_0xd175('0x66')],_0x128b55[_0xd175('0x64')]['id'],_0x33489d['body']?JSON['stringify'](_0x33489d[_0xd175('0x55')]):_0xd175('0x67'));return respondWithRpcPromise(_0xd175('0x68'),_0xd175('0x69'),_0x128b55);}return null;})[_0xd175('0x1f')](function(_0x58dcc5){if(_0x58dcc5){if(_0x33489d[_0xd175('0x55')][_0xd175('0x6a')]){_0x128b55[_0xd175('0x27')]['interface']=util[_0xd175('0x62')](_0xd175('0x6b'),_0x33489d[_0xd175('0x5c')][_0xd175('0x37')]);_0x128b55[_0xd175('0x27')][_0xd175('0x6c')]=_0x128b55[_0xd175('0x6c')];_0x128b55[_0xd175('0x27')][_0xd175('0x6d')]=_0xd175('0x6e');return respondWithRpcPromise(_0xd175('0x6f'),'EventManager',{'event':_0xd175('0x70'),'message':_[_0xd175('0x4c')](_0x128b55[_0xd175('0x27')],JSON[_0xd175('0x71')](_0x128b55[_0xd175('0x64')][_0xd175('0x72')]))},client9002)[_0xd175('0x1f')](function(){return _0x128b55;});}return _0x128b55;}return null;})[_0xd175('0x1f')](respondWithResult(_0x4909e0,null))['catch'](handleError(_0x4909e0,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xd175('0x33')]=function(_0x1a7d11,_0x33f754,_0x5f3630){var _0x3aef01={'agent':{},'channel':'chat'};if(_0x1a7d11[_0xd175('0x55')]['id']){delete _0x1a7d11[_0xd175('0x55')]['id'];}_0x1a7d11[_0xd175('0x55')][_0xd175('0x5b')]=_0x1a7d11[_0xd175('0x55')]['UserId']||_0x1a7d11['user']['id'];_0x3aef01[_0xd175('0x73')]['id']=_0x1a7d11[_0xd175('0x55')][_0xd175('0x5b')];return db[_0xd175('0x39')][_0xd175('0x53')]({'where':{'id':_0x1a7d11['params']['id'],'UserId':null}})[_0xd175('0x1f')](handleEntityNotFound(_0x33f754,null))[_0xd175('0x1f')](function(_0xcca3d){if(_0xcca3d){_0x3aef01[_0xd175('0x27')]=_0xcca3d[_0xd175('0x5f')]({'plain':!![]});return db[_0xd175('0x74')]['find']({'where':{'id':_0xcca3d[_0xd175('0x60')]}});}return null;})[_0xd175('0x1f')](handleEntityNotFound(_0x33f754,null))[_0xd175('0x1f')](function(_0x305071){if(_0x305071){_0x3aef01[_0xd175('0x64')]=_0x305071['get']({'plain':!![]});interaction_log[_0xd175('0x20')](_0xd175('0x75'),_0x1a7d11['user']['id'],_0x1a7d11[_0xd175('0x5c')][_0xd175('0x37')],_0x1a7d11['user']['role'],_0x3aef01[_0xd175('0x64')]['id'],_0x1a7d11[_0xd175('0x55')]?JSON['stringify'](_0x1a7d11['body']):_0xd175('0x67'));return respondWithRpcPromise('RejectMessage',_0xd175('0x76'),_0x3aef01);}return null;})[_0xd175('0x1f')](function(_0x29a66e){if(_0x29a66e){_0x29a66e['message'][_0xd175('0x77')]=util[_0xd175('0x62')](_0xd175('0x6b'),_0x1a7d11[_0xd175('0x5c')]['name']);_0x29a66e[_0xd175('0x27')][_0xd175('0x6c')]=_0x3aef01[_0xd175('0x6c')];_0x29a66e['message'][_0xd175('0x6d')]=_0xd175('0x33');respondWithRpcPromise(_0xd175('0x6f'),'EventManager',{'event':_0xd175('0x78'),'message':_0x29a66e[_0xd175('0x27')]},client9002);return _0x3aef01;}return null;})[_0xd175('0x1f')](respondWithResult(_0x33f754,null))[_0xd175('0x29')](handleError(_0x33f754,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8c132cb..2efda14 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 _0xe00c=['update','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x33af3a,_0x325aeb){var _0x117577=function(_0x3d0058){while(--_0x3d0058){_0x33af3a['push'](_0x33af3a['shift']());}};_0x117577(++_0x325aeb);}(_0xe00c,0x67));var _0xce00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe00c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xce00('0x0'));var ChatMessage=require(_0xce00('0x1'))['db'][_0xce00('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xce00('0x3')](0x0);var events={'afterCreate':_0xce00('0x4'),'afterUpdate':_0xce00('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5192b9){return function(_0x6e3d1a,_0x5d661d,_0xfa1dbd){ChatMessageEvents[_0xce00('0x6')](_0x5192b9+':'+_0x6e3d1a['id'],_0x6e3d1a);ChatMessageEvents[_0xce00('0x6')](_0x5192b9,_0x6e3d1a);_0xfa1dbd(null);};}for(var e in events){if(events[_0xce00('0x7')](e)){var event=events[e];ChatMessage[_0xce00('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xfd01=['events','../../mysqldb','ChatMessage','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd01,0xe8));var _0x1fd0=function(_0x4ddb64,_0x28048b){_0x4ddb64=_0x4ddb64-0x0;var _0x31532b=_0xfd01[_0x4ddb64];return _0x31532b;};'use strict';var EventEmitter=require(_0x1fd0('0x0'));var ChatMessage=require(_0x1fd0('0x1'))['db'][_0x1fd0('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1fd0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fd0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41539c){return function(_0x2fc67b,_0x28b03b,_0x23781b){ChatMessageEvents[_0x1fd0('0x5')](_0x41539c+':'+_0x2fc67b['id'],_0x2fc67b);ChatMessageEvents[_0x1fd0('0x5')](_0x41539c,_0x2fc67b);_0x23781b(null);};}for(var e in events){if(events[_0x1fd0('0x6')](e)){var event=events[e];ChatMessage[_0x1fd0('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 7aa98a7..5e6c139 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 _0xc4b6=['findOne','then','update','createdAt','catch','error','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction'];(function(_0x37c3e6,_0x4700cb){var _0x52ff77=function(_0x247e68){while(--_0x247e68){_0x37c3e6['push'](_0x37c3e6['shift']());}};_0x52ff77(++_0x4700cb);}(_0xc4b6,0x13a));var _0x6c4b=function(_0x813f9e,_0x1a7588){_0x813f9e=_0x813f9e-0x0;var _0x7c37e7=_0xc4b6[_0x813f9e];return _0x7c37e7;};'use strict';var _=require(_0x6c4b('0x0'));var util=require('util');var logger=require(_0x6c4b('0x1'))('api');var moment=require(_0x6c4b('0x2'));var BPromise=require(_0x6c4b('0x3'));var rp=require(_0x6c4b('0x4'));var fs=require('fs');var path=require(_0x6c4b('0x5'));var rimraf=require(_0x6c4b('0x6'));var config=require('../../config/environment');var attributes=require(_0x6c4b('0x7'));module[_0x6c4b('0x8')]=function(_0x296f57,_0x563f8e){return _0x296f57[_0x6c4b('0x9')](_0x6c4b('0xa'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x6c4b('0xb'),'fields':[_0x6c4b('0xc')],'type':_0x6c4b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd39f85,_0x1afd25,_0x415085){var _0x40b9a9=_0x296f57[_0x6c4b('0xe')];var _0x64693d=_0xd39f85[_0x6c4b('0xf')]({'plain':!![]});if(_0x64693d[_0x6c4b('0x10')][_0x6c4b('0x11')]()==='in'||_0x64693d[_0x6c4b('0x10')][_0x6c4b('0x11')]()===_0x6c4b('0x12')&&!_0x64693d[_0x6c4b('0x13')]&&!_['isNil'](_0x64693d[_0x6c4b('0x14')])){_0x40b9a9[_0x6c4b('0x15')][_0x6c4b('0x16')]({'where':{'id':_0x64693d['ChatInteractionId']}})[_0x6c4b('0x17')](function(_0x2e9fb5){if(_0x2e9fb5){_0x2e9fb5[_0x6c4b('0x18')]({'lastMsgAt':_0x64693d[_0x6c4b('0x19')],'lastMsgDirection':_0x64693d[_0x6c4b('0x10')][_0x6c4b('0x11')]()});}})[_0x6c4b('0x1a')](function(_0x400ebb){console[_0x6c4b('0x1b')](_0x400ebb);});}_0x415085();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0dc5=['createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update'];(function(_0x511664,_0x2a7df1){var _0x12c43d=function(_0xf7e0ac){while(--_0xf7e0ac){_0x511664['push'](_0x511664['shift']());}};_0x12c43d(++_0x2a7df1);}(_0x0dc5,0x88));var _0x50dc=function(_0x1b70a8,_0x12528c){_0x1b70a8=_0x1b70a8-0x0;var _0x2f4a1a=_0x0dc5[_0x1b70a8];return _0x2f4a1a;};'use strict';var _=require(_0x50dc('0x0'));var util=require(_0x50dc('0x1'));var logger=require(_0x50dc('0x2'))(_0x50dc('0x3'));var moment=require(_0x50dc('0x4'));var BPromise=require(_0x50dc('0x5'));var rp=require(_0x50dc('0x6'));var fs=require('fs');var path=require(_0x50dc('0x7'));var rimraf=require(_0x50dc('0x8'));var config=require(_0x50dc('0x9'));var attributes=require(_0x50dc('0xa'));module[_0x50dc('0xb')]=function(_0x59fbeb,_0x57eadc){return _0x59fbeb[_0x50dc('0xc')](_0x50dc('0xd'),attributes,{'tableName':_0x50dc('0xe'),'paranoid':![],'indexes':[{'name':_0x50dc('0xf'),'fields':[_0x50dc('0x10')],'type':_0x50dc('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26b413,_0x497f0b,_0x446f81){var _0x45b069=_0x59fbeb[_0x50dc('0x12')];var _0x377660=_0x26b413['get']({'plain':!![]});if(_0x377660[_0x50dc('0x13')][_0x50dc('0x14')]()==='in'||_0x377660[_0x50dc('0x13')][_0x50dc('0x14')]()===_0x50dc('0x15')&&!_0x377660[_0x50dc('0x16')]&&!_['isNil'](_0x377660[_0x50dc('0x17')])){_0x45b069[_0x50dc('0x18')][_0x50dc('0x19')]({'where':{'id':_0x377660[_0x50dc('0x1a')]}})[_0x50dc('0x1b')](function(_0x1bd4cd){if(_0x1bd4cd){_0x1bd4cd[_0x50dc('0x1c')]({'lastMsgAt':_0x377660[_0x50dc('0x1d')],'lastMsgDirection':_0x377660[_0x50dc('0x13')][_0x50dc('0x14')]()});}})[_0x50dc('0x1e')](function(_0x154136){console[_0x50dc('0x1f')](_0x154136);});}_0x446f81();}},'charset':_0x50dc('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 31c3377..57c8466 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 _0xa65f=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x58952f,_0xeed25f){var _0x3217ca=function(_0x3fda09){while(--_0x3fda09){_0x58952f['push'](_0x58952f['shift']());}};_0x3217ca(++_0xeed25f);}(_0xa65f,0x10f));var _0xfa65=function(_0x44c98b,_0x3a0882){_0x44c98b=_0x44c98b-0x0;var _0x146b92=_0xa65f[_0x44c98b];return _0x146b92;};'use strict';var _=require('lodash');var util=require(_0xfa65('0x0'));var moment=require(_0xfa65('0x1'));var BPromise=require(_0xfa65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa65('0x3'));var db=require(_0xfa65('0x4'))['db'];var utils=require(_0xfa65('0x5'));var logger=require(_0xfa65('0x6'))(_0xfa65('0x7'));var config=require(_0xfa65('0x8'));var jayson=require(_0xfa65('0x9'));var client=jayson[_0xfa65('0xa')][_0xfa65('0xb')]({'port':0x232a});config[_0xfa65('0xc')]=_[_0xfa65('0xd')](config['redis'],{'host':_0xfa65('0xe'),'port':0x18eb});var socket=require(_0xfa65('0xf'))(new Redis(config[_0xfa65('0xc')]));require('./chatMessage.socket')[_0xfa65('0x10')](socket);function respondWithRpcPromise(_0x415429,_0xaba353,_0x17fdad){return new BPromise(function(_0x2e7e17,_0x228296){return client[_0xfa65('0x11')](_0x415429,_0x17fdad)[_0xfa65('0x12')](function(_0x57f010){logger[_0xfa65('0x13')]('ChatMessage,\x20%s,\x20%s',_0xaba353,_0xfa65('0x14'));logger[_0xfa65('0x15')](_0xfa65('0x16'),_0xaba353,_0xfa65('0x14'),JSON[_0xfa65('0x17')](_0x57f010));if(_0x57f010['error']){if(_0x57f010[_0xfa65('0x18')][_0xfa65('0x19')]===0x1f4){logger[_0xfa65('0x18')](_0xfa65('0x1a'),_0xaba353,_0x57f010[_0xfa65('0x18')][_0xfa65('0x1b')]);return _0x228296(_0x57f010[_0xfa65('0x18')][_0xfa65('0x1b')]);}logger[_0xfa65('0x18')](_0xfa65('0x1a'),_0xaba353,_0x57f010['error']['message']);return _0x2e7e17(_0x57f010[_0xfa65('0x18')]['message']);}else{logger['info'](_0xfa65('0x1a'),_0xaba353,_0xfa65('0x14'));_0x2e7e17(_0x57f010[_0xfa65('0x1c')][_0xfa65('0x1b')]);}})['catch'](function(_0x101335){logger[_0xfa65('0x18')](_0xfa65('0x1a'),_0xaba353,_0x101335);_0x228296(_0x101335);});});}exports[_0xfa65('0x1d')]=function(_0x4c63d1){var _0xb2c737=this;return new Promise(function(_0x2f1fe6,_0x1d53e8){return db[_0xfa65('0x1e')][_0xfa65('0x1f')](_0x4c63d1[_0xfa65('0x20')],{'raw':_0x4c63d1[_0xfa65('0x21')]?_0x4c63d1['options'][_0xfa65('0x22')]===undefined?!![]:![]:!![]})[_0xfa65('0x12')](function(_0x3446a3){logger[_0xfa65('0x13')]('CreateChatMessage',_0x4c63d1);logger[_0xfa65('0x15')]('CreateChatMessage',_0x4c63d1,JSON[_0xfa65('0x17')](_0x3446a3));_0x2f1fe6(_0x3446a3);})['catch'](function(_0x229ef1){logger['error'](_0xfa65('0x1d'),_0x229ef1[_0xfa65('0x1b')],_0x4c63d1);_0x1d53e8(_0xb2c737['error'](0x1f4,_0x229ef1[_0xfa65('0x1b')]));});});}; \ No newline at end of file +var _0x2499=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','ChatMessage','create','body','options','CreateChatMessage','stringify','util','randomstring','../../mysqldb','../../config/logger'];(function(_0x405289,_0x459edf){var _0xfa1516=function(_0x485d74){while(--_0x485d74){_0x405289['push'](_0x405289['shift']());}};_0xfa1516(++_0x459edf);}(_0x2499,0xa4));var _0x9249=function(_0x173733,_0x53c52f){_0x173733=_0x173733-0x0;var _0x56b39e=_0x2499[_0x173733];return _0x56b39e;};'use strict';var _=require('lodash');var util=require(_0x9249('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9249('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9249('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9249('0x3'))(_0x9249('0x4'));var config=require('../../config/environment');var jayson=require(_0x9249('0x5'));var client=jayson[_0x9249('0x6')][_0x9249('0x7')]({'port':0x232a});config[_0x9249('0x8')]=_[_0x9249('0x9')](config[_0x9249('0x8')],{'host':_0x9249('0xa'),'port':0x18eb});var socket=require(_0x9249('0xb'))(new Redis(config[_0x9249('0x8')]));require(_0x9249('0xc'))['register'](socket);function respondWithRpcPromise(_0x2d8bce,_0x250810,_0x38c41c){return new BPromise(function(_0x2c0d75,_0x3cd78a){return client[_0x9249('0xd')](_0x2d8bce,_0x38c41c)['then'](function(_0x11cd32){logger['info'](_0x9249('0xe'),_0x250810,_0x9249('0xf'));logger[_0x9249('0x10')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x250810,_0x9249('0xf'),JSON['stringify'](_0x11cd32));if(_0x11cd32['error']){if(_0x11cd32[_0x9249('0x11')][_0x9249('0x12')]===0x1f4){logger[_0x9249('0x11')]('ChatMessage,\x20%s,\x20%s',_0x250810,_0x11cd32['error'][_0x9249('0x13')]);return _0x3cd78a(_0x11cd32[_0x9249('0x11')][_0x9249('0x13')]);}logger['error'](_0x9249('0xe'),_0x250810,_0x11cd32[_0x9249('0x11')]['message']);return _0x2c0d75(_0x11cd32[_0x9249('0x11')]['message']);}else{logger[_0x9249('0x14')](_0x9249('0xe'),_0x250810,_0x9249('0xf'));_0x2c0d75(_0x11cd32['result'][_0x9249('0x13')]);}})[_0x9249('0x15')](function(_0x165fd0){logger['error'](_0x9249('0xe'),_0x250810,_0x165fd0);_0x3cd78a(_0x165fd0);});});}exports['CreateChatMessage']=function(_0x10fd4e){var _0x2d5ffa=this;return new Promise(function(_0x25e117,_0x36daca){return db[_0x9249('0x16')][_0x9249('0x17')](_0x10fd4e[_0x9249('0x18')],{'raw':_0x10fd4e[_0x9249('0x19')]?_0x10fd4e[_0x9249('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a4279){logger[_0x9249('0x14')](_0x9249('0x1a'),_0x10fd4e);logger['debug'](_0x9249('0x1a'),_0x10fd4e,JSON[_0x9249('0x1b')](_0x1a4279));_0x25e117(_0x1a4279);})[_0x9249('0x15')](function(_0x4a1277){logger[_0x9249('0x11')](_0x9249('0x1a'),_0x4a1277['message'],_0x10fd4e);_0x36daca(_0x2d5ffa['error'](0x1f4,_0x4a1277[_0x9249('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8d67dfe..da3d91e 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 _0x5fab=['emit','removeListener','register','length','./chatMessage.events','save','update'];(function(_0x41ea38,_0x4e0b60){var _0x179c8d=function(_0x4e0b88){while(--_0x4e0b88){_0x41ea38['push'](_0x41ea38['shift']());}};_0x179c8d(++_0x4e0b60);}(_0x5fab,0x177));var _0xb5fa=function(_0xa69733,_0x2aa122){_0xa69733=_0xa69733-0x0;var _0xca5645=_0x5fab[_0xa69733];return _0xca5645;};'use strict';var ChatMessageEvents=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(){ChatMessageEvents[_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('chatMessage:'+_0x1aec3e,_0x44df89);ChatMessageEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x781d=['chatMessage:','./chatMessage.events','save','emit','removeListener','register','length'];(function(_0x2661bd,_0x545522){var _0x45d33c=function(_0x368a33){while(--_0x368a33){_0x2661bd['push'](_0x2661bd['shift']());}};_0x45d33c(++_0x545522);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var ChatMessageEvents=require(_0xd781('0x0'));var events=[_0xd781('0x1'),'remove','update'];function createListener(_0xb125bf,_0x44a72d){return function(_0x3cd308){_0x44a72d[_0xd781('0x2')](_0xb125bf,_0x3cd308);};}function removeListener(_0xfd915d,_0x42258e){return function(){ChatMessageEvents[_0xd781('0x3')](_0xfd915d,_0x42258e);};}exports[_0xd781('0x4')]=function(_0x830b){for(var _0x2f98ee=0x0,_0x5a07f0=events[_0xd781('0x5')];_0x2f98ee<_0x5a07f0;_0x2f98ee++){var _0x1a242d=events[_0x2f98ee];var _0x50610d=createListener(_0xd781('0x6')+_0x1a242d,_0x830b);ChatMessageEvents['on'](_0x1a242d,_0x50610d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 8a305b4..721e113 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 _0x9579=['index','get','/describe','describe','show','post','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x2d1f87,_0x31f1d0){var _0x310263=function(_0x53a008){while(--_0x53a008){_0x2d1f87['push'](_0x2d1f87['shift']());}};_0x310263(++_0x31f1d0);}(_0x9579,0xa7));var _0x9957=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0x9579[_0x39fd11];return _0x302799;};'use strict';var multer=require(_0x9957('0x0'));var util=require(_0x9957('0x1'));var path=require(_0x9957('0x2'));var timeout=require('connect-timeout');var express=require(_0x9957('0x3'));var router=express[_0x9957('0x4')]();var auth=require(_0x9957('0x5'));var interaction=require(_0x9957('0x6'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth[_0x9957('0x7')](),controller[_0x9957('0x8')]);router[_0x9957('0x9')](_0x9957('0xa'),auth[_0x9957('0x7')](),controller[_0x9957('0xb')]);router[_0x9957('0x9')]('/:id',auth[_0x9957('0x7')](),controller[_0x9957('0xc')]);router[_0x9957('0xd')]('/',auth[_0x9957('0x7')](),interaction['tracked']('chat','chatmessage:create'),controller[_0x9957('0xe')]);router[_0x9957('0xf')]('/:id',controller[_0x9957('0x10')]);router[_0x9957('0xf')](_0x9957('0x11'),auth[_0x9957('0x7')](),controller[_0x9957('0x12')]);router[_0x9957('0xf')](_0x9957('0x13'),auth[_0x9957('0x7')](),controller[_0x9957('0x14')]);router[_0x9957('0x15')](_0x9957('0x16'),auth[_0x9957('0x7')](),controller[_0x9957('0x17')]);module[_0x9957('0x18')]=router; \ No newline at end of file +var _0x292c=['update','/:id/accept','accept','reject','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','chatmessage:create','create','put'];(function(_0x86d32e,_0x3a0bf1){var _0x50a35e=function(_0x414a12){while(--_0x414a12){_0x86d32e['push'](_0x86d32e['shift']());}};_0x50a35e(++_0x3a0bf1);}(_0x292c,0xf0));var _0xc292=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x292c[_0x1e6e4e];return _0x3d746b;};'use strict';var multer=require(_0xc292('0x0'));var util=require(_0xc292('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc292('0x2'));var router=express[_0xc292('0x3')]();var auth=require(_0xc292('0x4'));var interaction=require(_0xc292('0x5'));var config=require(_0xc292('0x6'));var controller=require(_0xc292('0x7'));router[_0xc292('0x8')]('/',auth[_0xc292('0x9')](),controller[_0xc292('0xa')]);router[_0xc292('0x8')](_0xc292('0xb'),auth['isAuthenticated'](),controller[_0xc292('0xc')]);router['get'](_0xc292('0xd'),auth[_0xc292('0x9')](),controller[_0xc292('0xe')]);router['post']('/',auth[_0xc292('0x9')](),interaction[_0xc292('0xf')](_0xc292('0x10'),_0xc292('0x11')),controller[_0xc292('0x12')]);router[_0xc292('0x13')](_0xc292('0xd'),controller[_0xc292('0x14')]);router['put'](_0xc292('0x15'),auth[_0xc292('0x9')](),controller[_0xc292('0x16')]);router[_0xc292('0x13')]('/:id/reject',auth[_0xc292('0x9')](),controller[_0xc292('0x17')]);router[_0xc292('0x18')]('/:id',auth[_0xc292('0x9')](),controller[_0xc292('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 621b0a7..9c1ade8 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 _0xf75c=['sequelize','exports','TEXT','medium'];(function(_0x9d9782,_0xcf71e){var _0x150cd0=function(_0x2d1b62){while(--_0x2d1b62){_0x9d9782['push'](_0x9d9782['shift']());}};_0x150cd0(++_0xcf71e);}(_0xf75c,0x124));var _0xcf75=function(_0x220f8e,_0x153f9b){_0x220f8e=_0x220f8e-0x0;var _0x2fbe93=_0xf75c[_0x220f8e];return _0x2fbe93;};'use strict';var Sequelize=require(_0xcf75('0x0'));module[_0xcf75('0x1')]={'body':{'type':Sequelize[_0xcf75('0x2')](_0xcf75('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xfcd7=['exports','TEXT','sequelize'];(function(_0x194d54,_0x54a2eb){var _0x3ce9d2=function(_0x5a42c0){while(--_0x5a42c0){_0x194d54['push'](_0x194d54['shift']());}};_0x3ce9d2(++_0x54a2eb);}(_0xfcd7,0x1ca));var _0x7fcd=function(_0x2c949d,_0x10261b){_0x2c949d=_0x2c949d-0x0;var _0x16d8c4=_0xfcd7[_0x2c949d];return _0x16d8c4;};'use strict';var Sequelize=require(_0x7fcd('0x0'));module[_0x7fcd('0x1')]={'body':{'type':Sequelize[_0x7fcd('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4983c49..fc31789 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 _0xeff8=['merge','VIRTUAL','options','ChatOfflineMessage','includeAll','include','findAll','rows','show','params','find','catch','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xeff8,0x186));var _0x8eff=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xeff8[_0x1a7550];return _0x426e22;};'use strict';var pdf=require(_0x8eff('0x0'));var emlformat=require(_0x8eff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8eff('0x2'));var jsonpatch=require(_0x8eff('0x3'));var rp=require(_0x8eff('0x4'));var moment=require('moment');var BPromise=require(_0x8eff('0x5'));var Mustache=require(_0x8eff('0x6'));var util=require(_0x8eff('0x7'));var path=require(_0x8eff('0x8'));var sox=require('sox');var csv=require(_0x8eff('0x9'));var ejs=require(_0x8eff('0xa'));var fs=require('fs');var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0x9'));var querystring=require(_0x8eff('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x10'));var qs=require(_0x8eff('0x11'));var as=require(_0x8eff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x13'))(_0x8eff('0x14'));var utils=require('../../config/utils');var config=require(_0x8eff('0x15'));var db=require(_0x8eff('0x16'))['db'];function respondWithStatusCode(_0x559143,_0x4a399e){_0x4a399e=_0x4a399e||0xcc;return function(_0x45f280){if(_0x45f280){return _0x559143[_0x8eff('0x17')](_0x4a399e);}return _0x559143[_0x8eff('0x18')](_0x4a399e)[_0x8eff('0x19')]();};}function respondWithResult(_0x1349cb,_0x56efdf){_0x56efdf=_0x56efdf||0xc8;return function(_0x3e7c01){if(_0x3e7c01){return _0x1349cb[_0x8eff('0x18')](_0x56efdf)[_0x8eff('0x1a')](_0x3e7c01);}};}function respondWithFilteredResult(_0x1af3d6,_0x228eb1){return function(_0x4cfc91){if(_0x4cfc91){var _0x16202e=_0x4cfc91[_0x8eff('0x1b')],_0xdbb753=_0x228eb1['offset'],_0x16a4eb=_0x228eb1[_0x8eff('0x1c')]+_0x228eb1[_0x8eff('0x1d')],_0x427902;if(_0x16a4eb>=_0x16202e){_0x16a4eb=_0x16202e;_0x427902=0xc8;}else{_0x427902=0xce;}_0x1af3d6[_0x8eff('0x18')](_0x427902);return _0x1af3d6[_0x8eff('0x1e')](_0x8eff('0x1f'),_0xdbb753+'-'+_0x16a4eb+'/'+_0x16202e)[_0x8eff('0x1a')](_0x4cfc91);}return null;};}function patchUpdates(_0x38f5ee){return function(_0x399d96){try{jsonpatch[_0x8eff('0x20')](_0x399d96,_0x38f5ee,!![]);}catch(_0x198ee9){return BPromise[_0x8eff('0x21')](_0x198ee9);}return _0x399d96[_0x8eff('0x22')]();};}function saveUpdates(_0x1e9ad0,_0x2a7337){return function(_0xdbb7b5){if(_0xdbb7b5){return _0xdbb7b5[_0x8eff('0x23')](_0x1e9ad0)['then'](function(_0x1ca2e6){return _0x1ca2e6;});}return null;};}function removeEntity(_0x4d3e84,_0x5a2492){return function(_0x1c4ad3){if(_0x1c4ad3){return _0x1c4ad3['destroy']()[_0x8eff('0x24')](function(){_0x4d3e84[_0x8eff('0x18')](0xcc)[_0x8eff('0x19')]();});}};}function handleEntityNotFound(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(!_0x4e891c){_0x59cc32[_0x8eff('0x17')](0x194);}return _0x4e891c;};}function handleError(_0x350927,_0x50784c){_0x50784c=_0x50784c||0x1f4;return function(_0x15b66f){logger[_0x8eff('0x25')](_0x15b66f[_0x8eff('0x26')]);if(_0x15b66f[_0x8eff('0x27')]){delete _0x15b66f[_0x8eff('0x27')];}_0x350927[_0x8eff('0x18')](_0x50784c)[_0x8eff('0x28')](_0x15b66f);};}exports[_0x8eff('0x29')]=function(_0x516173,_0x3e1607){var _0x323ffa={},_0x15083c={},_0xb88ce9={'count':0x0,'rows':[]};var _0x45803c=_[_0x8eff('0x2a')](db['ChatOfflineMessage']['rawAttributes'],function(_0x44dcdb){return{'name':_0x44dcdb[_0x8eff('0x2b')],'type':_0x44dcdb[_0x8eff('0x2c')]['key']};});_0x15083c[_0x8eff('0x2d')]=_[_0x8eff('0x2a')](_0x45803c,_0x8eff('0x27'));_0x15083c[_0x8eff('0x2e')]=_[_0x8eff('0x2f')](_0x516173[_0x8eff('0x2e')]);_0x15083c[_0x8eff('0x30')]=_[_0x8eff('0x31')](_0x15083c[_0x8eff('0x2d')],_0x15083c[_0x8eff('0x2e')]);_0x323ffa[_0x8eff('0x32')]=_[_0x8eff('0x31')](_0x15083c['model'],qs[_0x8eff('0x33')](_0x516173[_0x8eff('0x2e')][_0x8eff('0x33')]));_0x323ffa[_0x8eff('0x32')]=_0x323ffa['attributes'][_0x8eff('0x34')]?_0x323ffa[_0x8eff('0x32')]:_0x15083c['model'];if(!_0x516173['query'][_0x8eff('0x35')](_0x8eff('0x36'))){_0x323ffa['limit']=qs['limit'](_0x516173['query'][_0x8eff('0x1d')]);_0x323ffa['offset']=qs[_0x8eff('0x1c')](_0x516173['query'][_0x8eff('0x1c')]);}_0x323ffa[_0x8eff('0x37')]=qs[_0x8eff('0x38')](_0x516173[_0x8eff('0x2e')][_0x8eff('0x38')]);_0x323ffa[_0x8eff('0x39')]=qs['filters'](_[_0x8eff('0x3a')](_0x516173['query'],_0x15083c[_0x8eff('0x30')]),_0x45803c);if(_0x516173['query'][_0x8eff('0x3b')]){_0x323ffa[_0x8eff('0x39')]=_[_0x8eff('0x3c')](_0x323ffa[_0x8eff('0x39')],{'$or':_['map'](_0x45803c,function(_0x2eb4bb){if(_0x2eb4bb[_0x8eff('0x2c')]!==_0x8eff('0x3d')){var _0x5360b7={};_0x5360b7[_0x2eb4bb[_0x8eff('0x27')]]={'$like':'%'+_0x516173[_0x8eff('0x2e')][_0x8eff('0x3b')]+'%'};return _0x5360b7;}})});}_0x323ffa=_[_0x8eff('0x3c')]({},_0x323ffa,_0x516173[_0x8eff('0x3e')]);var _0xd2a915={'where':_0x323ffa[_0x8eff('0x39')]};return db[_0x8eff('0x3f')][_0x8eff('0x1b')](_0xd2a915)['then'](function(_0x54a2d9){_0xb88ce9[_0x8eff('0x1b')]=_0x54a2d9;if(_0x516173[_0x8eff('0x2e')][_0x8eff('0x40')]){_0x323ffa[_0x8eff('0x41')]=[{'all':!![]}];}return db[_0x8eff('0x3f')][_0x8eff('0x42')](_0x323ffa);})[_0x8eff('0x24')](function(_0x5acc86){_0xb88ce9[_0x8eff('0x43')]=_0x5acc86;return _0xb88ce9;})[_0x8eff('0x24')](respondWithFilteredResult(_0x3e1607,_0x323ffa))['catch'](handleError(_0x3e1607,null));};exports[_0x8eff('0x44')]=function(_0x1ad6b3,_0x241b33){var _0x18309b={'raw':!![],'where':{'id':_0x1ad6b3[_0x8eff('0x45')]['id']}},_0xdc5e2f={};_0xdc5e2f[_0x8eff('0x2d')]=_[_0x8eff('0x2f')](db[_0x8eff('0x3f')]['rawAttributes']);_0xdc5e2f[_0x8eff('0x2e')]=_[_0x8eff('0x2f')](_0x1ad6b3[_0x8eff('0x2e')]);_0xdc5e2f[_0x8eff('0x30')]=_[_0x8eff('0x31')](_0xdc5e2f['model'],_0xdc5e2f[_0x8eff('0x2e')]);_0x18309b['attributes']=_[_0x8eff('0x31')](_0xdc5e2f[_0x8eff('0x2d')],qs[_0x8eff('0x33')](_0x1ad6b3[_0x8eff('0x2e')]['fields']));_0x18309b[_0x8eff('0x32')]=_0x18309b[_0x8eff('0x32')][_0x8eff('0x34')]?_0x18309b['attributes']:_0xdc5e2f['model'];if(_0x1ad6b3[_0x8eff('0x2e')][_0x8eff('0x40')]){_0x18309b[_0x8eff('0x41')]=[{'all':!![]}];}_0x18309b=_[_0x8eff('0x3c')]({},_0x18309b,_0x1ad6b3[_0x8eff('0x3e')]);return db['ChatOfflineMessage'][_0x8eff('0x46')](_0x18309b)['then'](handleEntityNotFound(_0x241b33,null))[_0x8eff('0x24')](respondWithResult(_0x241b33,null))[_0x8eff('0x47')](handleError(_0x241b33,null));};exports['create']=function(_0x581a6a,_0x47ecff){return db['ChatOfflineMessage']['create'](_0x581a6a['body'],{})[_0x8eff('0x24')](respondWithResult(_0x47ecff,0xc9))[_0x8eff('0x47')](handleError(_0x47ecff,null));};exports[_0x8eff('0x23')]=function(_0x1b5fda,_0x1aa204){if(_0x1b5fda[_0x8eff('0x48')]['id']){delete _0x1b5fda[_0x8eff('0x48')]['id'];}return db[_0x8eff('0x3f')][_0x8eff('0x46')]({'where':{'id':_0x1b5fda[_0x8eff('0x45')]['id']}})['then'](handleEntityNotFound(_0x1aa204,null))[_0x8eff('0x24')](saveUpdates(_0x1b5fda['body'],null))[_0x8eff('0x24')](respondWithResult(_0x1aa204,null))[_0x8eff('0x47')](handleError(_0x1aa204,null));};exports[_0x8eff('0x49')]=function(_0x26d252,_0x5c491b){return db[_0x8eff('0x3f')][_0x8eff('0x46')]({'where':{'id':_0x26d252[_0x8eff('0x45')]['id']}})[_0x8eff('0x24')](handleEntityNotFound(_0x5c491b,null))[_0x8eff('0x24')](removeEntity(_0x5c491b,null))[_0x8eff('0x47')](handleError(_0x5c491b,null));};exports[_0x8eff('0x4a')]=function(_0x47b28d,_0x13ae7c){return db[_0x8eff('0x3f')][_0x8eff('0x4a')]()[_0x8eff('0x24')](respondWithResult(_0x13ae7c,null))[_0x8eff('0x47')](handleError(_0x13ae7c,null));}; \ No newline at end of file +var _0x90b1=['count','includeAll','include','findAll','params','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','index','map','ChatOfflineMessage','fieldName','key','model','name','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','sort','pick','merge','where','type','VIRTUAL','options'];(function(_0x28a24e,_0x47704e){var _0xbe917=function(_0x4a81e3){while(--_0x4a81e3){_0x28a24e['push'](_0x28a24e['shift']());}};_0xbe917(++_0x47704e);}(_0x90b1,0x1bb));var _0x190b=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0x90b1[_0x3a7db0];return _0x17cbba;};'use strict';var pdf=require(_0x190b('0x0'));var emlformat=require(_0x190b('0x1'));var rimraf=require(_0x190b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x190b('0x3'));var moment=require(_0x190b('0x4'));var BPromise=require(_0x190b('0x5'));var Mustache=require(_0x190b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x190b('0x7'));var fs=require('fs');var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var db=require(_0x190b('0x17'))['db'];function respondWithStatusCode(_0x5701ad,_0x4d63ac){_0x4d63ac=_0x4d63ac||0xcc;return function(_0x596c48){if(_0x596c48){return _0x5701ad[_0x190b('0x18')](_0x4d63ac);}return _0x5701ad[_0x190b('0x19')](_0x4d63ac)[_0x190b('0x1a')]();};}function respondWithResult(_0x1e1fd5,_0x2e12d4){_0x2e12d4=_0x2e12d4||0xc8;return function(_0x13544c){if(_0x13544c){return _0x1e1fd5[_0x190b('0x19')](_0x2e12d4)[_0x190b('0x1b')](_0x13544c);}};}function respondWithFilteredResult(_0x186941,_0x1a046f){return function(_0xab346){if(_0xab346){var _0x3e8781=_0xab346['count'],_0x3fbfc3=_0x1a046f[_0x190b('0x1c')],_0x121867=_0x1a046f['offset']+_0x1a046f[_0x190b('0x1d')],_0x1b4f4c;if(_0x121867>=_0x3e8781){_0x121867=_0x3e8781;_0x1b4f4c=0xc8;}else{_0x1b4f4c=0xce;}_0x186941[_0x190b('0x19')](_0x1b4f4c);return _0x186941[_0x190b('0x1e')](_0x190b('0x1f'),_0x3fbfc3+'-'+_0x121867+'/'+_0x3e8781)['json'](_0xab346);}return null;};}function patchUpdates(_0x298343){return function(_0x22d946){try{jsonpatch[_0x190b('0x20')](_0x22d946,_0x298343,!![]);}catch(_0x3c64d9){return BPromise[_0x190b('0x21')](_0x3c64d9);}return _0x22d946[_0x190b('0x22')]();};}function saveUpdates(_0x47d704,_0x3ed24c){return function(_0x14f0a5){if(_0x14f0a5){return _0x14f0a5['update'](_0x47d704)[_0x190b('0x23')](function(_0x5740af){return _0x5740af;});}return null;};}function removeEntity(_0x55de01,_0xcd15e5){return function(_0x42e7f2){if(_0x42e7f2){return _0x42e7f2[_0x190b('0x24')]()['then'](function(){_0x55de01[_0x190b('0x19')](0xcc)[_0x190b('0x1a')]();});}};}function handleEntityNotFound(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(!_0x3b8c74){_0x16e989[_0x190b('0x18')](0x194);}return _0x3b8c74;};}function handleError(_0x1bce97,_0x519a76){_0x519a76=_0x519a76||0x1f4;return function(_0x55b1f5){logger[_0x190b('0x25')](_0x55b1f5[_0x190b('0x26')]);if(_0x55b1f5['name']){delete _0x55b1f5['name'];}_0x1bce97[_0x190b('0x19')](_0x519a76)['send'](_0x55b1f5);};}exports[_0x190b('0x27')]=function(_0x3b6aaf,_0x51f8b4){var _0x3e7a10={},_0x1deea6={},_0x5c89ab={'count':0x0,'rows':[]};var _0xa9d6f7=_[_0x190b('0x28')](db[_0x190b('0x29')]['rawAttributes'],function(_0x536d7b){return{'name':_0x536d7b[_0x190b('0x2a')],'type':_0x536d7b['type'][_0x190b('0x2b')]};});_0x1deea6[_0x190b('0x2c')]=_['map'](_0xa9d6f7,_0x190b('0x2d'));_0x1deea6['query']=_[_0x190b('0x2e')](_0x3b6aaf['query']);_0x1deea6[_0x190b('0x2f')]=_['intersection'](_0x1deea6[_0x190b('0x2c')],_0x1deea6[_0x190b('0x30')]);_0x3e7a10['attributes']=_[_0x190b('0x31')](_0x1deea6[_0x190b('0x2c')],qs[_0x190b('0x32')](_0x3b6aaf[_0x190b('0x30')][_0x190b('0x32')]));_0x3e7a10[_0x190b('0x33')]=_0x3e7a10[_0x190b('0x33')][_0x190b('0x34')]?_0x3e7a10['attributes']:_0x1deea6['model'];if(!_0x3b6aaf[_0x190b('0x30')][_0x190b('0x35')]('nolimit')){_0x3e7a10[_0x190b('0x1d')]=qs[_0x190b('0x1d')](_0x3b6aaf[_0x190b('0x30')][_0x190b('0x1d')]);_0x3e7a10[_0x190b('0x1c')]=qs[_0x190b('0x1c')](_0x3b6aaf[_0x190b('0x30')]['offset']);}_0x3e7a10['order']=qs[_0x190b('0x36')](_0x3b6aaf[_0x190b('0x30')][_0x190b('0x36')]);_0x3e7a10['where']=qs[_0x190b('0x2f')](_[_0x190b('0x37')](_0x3b6aaf[_0x190b('0x30')],_0x1deea6['filters']),_0xa9d6f7);if(_0x3b6aaf[_0x190b('0x30')]['filter']){_0x3e7a10['where']=_[_0x190b('0x38')](_0x3e7a10[_0x190b('0x39')],{'$or':_['map'](_0xa9d6f7,function(_0x2ec698){if(_0x2ec698[_0x190b('0x3a')]!==_0x190b('0x3b')){var _0x5a9cba={};_0x5a9cba[_0x2ec698[_0x190b('0x2d')]]={'$like':'%'+_0x3b6aaf[_0x190b('0x30')]['filter']+'%'};return _0x5a9cba;}})});}_0x3e7a10=_['merge']({},_0x3e7a10,_0x3b6aaf[_0x190b('0x3c')]);var _0x4ab72d={'where':_0x3e7a10[_0x190b('0x39')]};return db[_0x190b('0x29')][_0x190b('0x3d')](_0x4ab72d)[_0x190b('0x23')](function(_0x5a399b){_0x5c89ab[_0x190b('0x3d')]=_0x5a399b;if(_0x3b6aaf['query'][_0x190b('0x3e')]){_0x3e7a10[_0x190b('0x3f')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x190b('0x40')](_0x3e7a10);})[_0x190b('0x23')](function(_0x45b296){_0x5c89ab['rows']=_0x45b296;return _0x5c89ab;})[_0x190b('0x23')](respondWithFilteredResult(_0x51f8b4,_0x3e7a10))['catch'](handleError(_0x51f8b4,null));};exports['show']=function(_0x554486,_0x2cfff0){var _0x3aef1d={'raw':!![],'where':{'id':_0x554486[_0x190b('0x41')]['id']}},_0x411cb5={};_0x411cb5['model']=_['keys'](db[_0x190b('0x29')]['rawAttributes']);_0x411cb5[_0x190b('0x30')]=_[_0x190b('0x2e')](_0x554486['query']);_0x411cb5[_0x190b('0x2f')]=_[_0x190b('0x31')](_0x411cb5[_0x190b('0x2c')],_0x411cb5['query']);_0x3aef1d[_0x190b('0x33')]=_[_0x190b('0x31')](_0x411cb5['model'],qs[_0x190b('0x32')](_0x554486['query'][_0x190b('0x32')]));_0x3aef1d[_0x190b('0x33')]=_0x3aef1d[_0x190b('0x33')]['length']?_0x3aef1d[_0x190b('0x33')]:_0x411cb5['model'];if(_0x554486[_0x190b('0x30')][_0x190b('0x3e')]){_0x3aef1d[_0x190b('0x3f')]=[{'all':!![]}];}_0x3aef1d=_[_0x190b('0x38')]({},_0x3aef1d,_0x554486[_0x190b('0x3c')]);return db[_0x190b('0x29')][_0x190b('0x42')](_0x3aef1d)['then'](handleEntityNotFound(_0x2cfff0,null))[_0x190b('0x23')](respondWithResult(_0x2cfff0,null))[_0x190b('0x43')](handleError(_0x2cfff0,null));};exports[_0x190b('0x44')]=function(_0x4b7f35,_0x1b71d5){return db[_0x190b('0x29')][_0x190b('0x44')](_0x4b7f35[_0x190b('0x45')],{})[_0x190b('0x23')](respondWithResult(_0x1b71d5,0xc9))['catch'](handleError(_0x1b71d5,null));};exports[_0x190b('0x46')]=function(_0xadc789,_0x1e8dc8){if(_0xadc789['body']['id']){delete _0xadc789[_0x190b('0x45')]['id'];}return db[_0x190b('0x29')][_0x190b('0x42')]({'where':{'id':_0xadc789['params']['id']}})['then'](handleEntityNotFound(_0x1e8dc8,null))[_0x190b('0x23')](saveUpdates(_0xadc789[_0x190b('0x45')],null))[_0x190b('0x23')](respondWithResult(_0x1e8dc8,null))[_0x190b('0x43')](handleError(_0x1e8dc8,null));};exports[_0x190b('0x24')]=function(_0x10aaeb,_0x49654b){return db[_0x190b('0x29')][_0x190b('0x42')]({'where':{'id':_0x10aaeb[_0x190b('0x41')]['id']}})['then'](handleEntityNotFound(_0x49654b,null))[_0x190b('0x23')](removeEntity(_0x49654b,null))[_0x190b('0x43')](handleError(_0x49654b,null));};exports[_0x190b('0x47')]=function(_0x503700,_0xbc6757){return db[_0x190b('0x29')][_0x190b('0x47')]()[_0x190b('0x23')](respondWithResult(_0xbc6757,null))[_0x190b('0x43')](handleError(_0xbc6757,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 911820a..45bb0c4 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 _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x3ebff4,_0x5efe9a){var _0x6331b7=function(_0x4860d6){while(--_0x4860d6){_0x3ebff4['push'](_0x3ebff4['shift']());}};_0x6331b7(++_0x5efe9a);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x2ba2be,_0x2021d5){_0x2ba2be=_0x2ba2be-0x0;var _0x3087a6=_0x4fdb[_0x2ba2be];return _0x3087a6;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb4fd('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc874=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','lodash','../../config/logger','api','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports'];(function(_0x10c8f1,_0x1d3395){var _0x45a908=function(_0xe4d89e){while(--_0xe4d89e){_0x10c8f1['push'](_0x10c8f1['shift']());}};_0x45a908(++_0x1d3395);}(_0xc874,0x154));var _0x4c87=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0xc874[_0x333714];return _0x4c211e;};'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':!![],'charset':_0x4c87('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index de39ab5..6fdf229 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 _0xf8db=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x27c0f8,_0xd1bd2f){var _0x426b4e=function(_0x1d3f4b){while(--_0x1d3f4b){_0x27c0f8['push'](_0x27c0f8['shift']());}};_0x426b4e(++_0xd1bd2f);}(_0xf8db,0x171));var _0xbf8d=function(_0x40c076,_0x33efc1){_0x40c076=_0x40c076-0x0;var _0x19f6e1=_0xf8db[_0x40c076];return _0x19f6e1;};'use strict';var _=require(_0xbf8d('0x0'));var util=require(_0xbf8d('0x1'));var moment=require(_0xbf8d('0x2'));var BPromise=require(_0xbf8d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf8d('0x4'));var db=require(_0xbf8d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf8d('0x6'))(_0xbf8d('0x7'));var config=require(_0xbf8d('0x8'));var jayson=require(_0xbf8d('0x9'));var client=jayson[_0xbf8d('0xa')][_0xbf8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42c561,_0x1d0c10,_0x4f2df2){return new BPromise(function(_0x441fd4,_0x1e0307){return client[_0xbf8d('0xc')](_0x42c561,_0x4f2df2)[_0xbf8d('0xd')](function(_0x1e9243){logger[_0xbf8d('0xe')](_0xbf8d('0xf'),_0x1d0c10,'request\x20sent');logger[_0xbf8d('0x10')](_0xbf8d('0x11'),_0x1d0c10,'request\x20sent',JSON['stringify'](_0x1e9243));if(_0x1e9243[_0xbf8d('0x12')]){if(_0x1e9243[_0xbf8d('0x12')][_0xbf8d('0x13')]===0x1f4){logger[_0xbf8d('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1d0c10,_0x1e9243[_0xbf8d('0x12')][_0xbf8d('0x14')]);return _0x1e0307(_0x1e9243['error'][_0xbf8d('0x14')]);}logger[_0xbf8d('0x12')](_0xbf8d('0xf'),_0x1d0c10,_0x1e9243['error'][_0xbf8d('0x14')]);return _0x441fd4(_0x1e9243['error'][_0xbf8d('0x14')]);}else{logger[_0xbf8d('0xe')](_0xbf8d('0xf'),_0x1d0c10,'request\x20sent');_0x441fd4(_0x1e9243[_0xbf8d('0x15')][_0xbf8d('0x14')]);}})[_0xbf8d('0x16')](function(_0x4d974c){logger[_0xbf8d('0x12')](_0xbf8d('0xf'),_0x1d0c10,_0x4d974c);_0x1e0307(_0x4d974c);});});} \ No newline at end of file +var _0x2f3a=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x46f448,_0x36d0b8){var _0x413c11=function(_0x4f8e40){while(--_0x4f8e40){_0x46f448['push'](_0x46f448['shift']());}};_0x413c11(++_0x36d0b8);}(_0x2f3a,0xee));var _0xa2f3=function(_0x31355d,_0x131035){_0x31355d=_0x31355d-0x0;var _0x456781=_0x2f3a[_0x31355d];return _0x456781;};'use strict';var _=require(_0xa2f3('0x0'));var util=require(_0xa2f3('0x1'));var moment=require(_0xa2f3('0x2'));var BPromise=require(_0xa2f3('0x3'));var rs=require(_0xa2f3('0x4'));var fs=require('fs');var Redis=require(_0xa2f3('0x5'));var db=require(_0xa2f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2f3('0x7'))(_0xa2f3('0x8'));var config=require(_0xa2f3('0x9'));var jayson=require(_0xa2f3('0xa'));var client=jayson[_0xa2f3('0xb')][_0xa2f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x486b71,_0x2e4070,_0x5882b2){return new BPromise(function(_0x2cf7ca,_0x5a760b){return client[_0xa2f3('0xd')](_0x486b71,_0x5882b2)[_0xa2f3('0xe')](function(_0xcaa012){logger[_0xa2f3('0xf')](_0xa2f3('0x10'),_0x2e4070,_0xa2f3('0x11'));logger[_0xa2f3('0x12')](_0xa2f3('0x13'),_0x2e4070,_0xa2f3('0x11'),JSON['stringify'](_0xcaa012));if(_0xcaa012[_0xa2f3('0x14')]){if(_0xcaa012['error'][_0xa2f3('0x15')]===0x1f4){logger[_0xa2f3('0x14')](_0xa2f3('0x10'),_0x2e4070,_0xcaa012[_0xa2f3('0x14')][_0xa2f3('0x16')]);return _0x5a760b(_0xcaa012[_0xa2f3('0x14')][_0xa2f3('0x16')]);}logger['error'](_0xa2f3('0x10'),_0x2e4070,_0xcaa012[_0xa2f3('0x14')][_0xa2f3('0x16')]);return _0x2cf7ca(_0xcaa012['error'][_0xa2f3('0x16')]);}else{logger[_0xa2f3('0xf')](_0xa2f3('0x10'),_0x2e4070,_0xa2f3('0x11'));_0x2cf7ca(_0xcaa012[_0xa2f3('0x17')]['message']);}})[_0xa2f3('0x18')](function(_0x23b38d){logger[_0xa2f3('0x14')](_0xa2f3('0x10'),_0x2e4070,_0x23b38d);_0x5a760b(_0x23b38d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 67fcad9..d93062d 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 _0xfa59=['multer','path','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','show','create','put','/:id','update','delete','exports'];(function(_0x16a8fe,_0x1a5430){var _0x3ab72a=function(_0xd4444e){while(--_0xd4444e){_0x16a8fe['push'](_0x16a8fe['shift']());}};_0x3ab72a(++_0x1a5430);}(_0xfa59,0x130));var _0x9fa5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfa59[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x9fa5('0x0'));var util=require('util');var path=require(_0x9fa5('0x1'));var timeout=require('connect-timeout');var express=require(_0x9fa5('0x2'));var router=express[_0x9fa5('0x3')]();var auth=require(_0x9fa5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9fa5('0x5'));var controller=require(_0x9fa5('0x6'));router[_0x9fa5('0x7')]('/',auth['isAuthenticated'](),controller[_0x9fa5('0x8')]);router[_0x9fa5('0x7')](_0x9fa5('0x9'),auth[_0x9fa5('0xa')](),controller[_0x9fa5('0xb')]);router[_0x9fa5('0x7')]('/:id',auth[_0x9fa5('0xa')](),controller[_0x9fa5('0xc')]);router['post']('/',auth[_0x9fa5('0xa')](),controller[_0x9fa5('0xd')]);router[_0x9fa5('0xe')](_0x9fa5('0xf'),auth[_0x9fa5('0xa')](),controller[_0x9fa5('0x10')]);router[_0x9fa5('0x11')]('/:id',auth[_0x9fa5('0xa')](),controller['destroy']);module[_0x9fa5('0x12')]=router; \ No newline at end of file +var _0xeb39=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xeb39,0x10d));var _0x9eb3=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xeb39[_0x28d18d];return _0x470640;};'use strict';var multer=require(_0x9eb3('0x0'));var util=require(_0x9eb3('0x1'));var path=require(_0x9eb3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9eb3('0x3'));var router=express[_0x9eb3('0x4')]();var auth=require(_0x9eb3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9eb3('0x6'));var controller=require(_0x9eb3('0x7'));router[_0x9eb3('0x8')]('/',auth[_0x9eb3('0x9')](),controller[_0x9eb3('0xa')]);router['get']('/describe',auth[_0x9eb3('0x9')](),controller[_0x9eb3('0xb')]);router[_0x9eb3('0x8')](_0x9eb3('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9eb3('0xd')]('/',auth[_0x9eb3('0x9')](),controller[_0x9eb3('0xe')]);router[_0x9eb3('0xf')](_0x9eb3('0xc'),auth['isAuthenticated'](),controller[_0x9eb3('0x10')]);router[_0x9eb3('0x11')](_0x9eb3('0xc'),auth['isAuthenticated'](),controller[_0x9eb3('0x12')]);module[_0x9eb3('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index aed8fd1..266f974 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 _0x8014=['mouseOver','timeout','sequelize','exports','STRING','ENUM'];(function(_0x12d4ec,_0x59f86a){var _0x3512cb=function(_0x5bf3ec){while(--_0x5bf3ec){_0x12d4ec['push'](_0x12d4ec['shift']());}};_0x3512cb(++_0x59f86a);}(_0x8014,0x10a));var _0x4801=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x8014[_0x2e913b];return _0x173899;};'use strict';var Sequelize=require(_0x4801('0x0'));module[_0x4801('0x1')]={'name':{'type':Sequelize[_0x4801('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4801('0x3')](_0x4801('0x4'),_0x4801('0x5')),'defaultValue':_0x4801('0x4')},'selector':{'type':Sequelize[_0x4801('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x119b=['timeout','mouseOver','INTEGER','sequelize','STRING','ENUM'];(function(_0x1501d7,_0x2c6b1e){var _0x1e06c5=function(_0x160951){while(--_0x160951){_0x1501d7['push'](_0x1501d7['shift']());}};_0x1e06c5(++_0x2c6b1e);}(_0x119b,0xcf));var _0xb119=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x119b[_0x5fa520];return _0x1bf6c4;};'use strict';var Sequelize=require(_0xb119('0x0'));module['exports']={'name':{'type':Sequelize[_0xb119('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb119('0x2')]('mouseOver',_0xb119('0x3')),'defaultValue':_0xb119('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb119('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f73d55b..8fe1256 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 _0xa9e0=['keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','create','body','catch','params','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','show','model'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={'raw':!![],'where':{'id':_0x526cf3['params']['id']}},_0x45a1e7={};_0x45a1e7[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x45a1e7[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x526cf3[_0x0a9e('0x2a')]);_0x45a1e7[_0x0a9e('0x2b')]=_['intersection'](_0x45a1e7[_0x0a9e('0x26')],_0x45a1e7[_0x0a9e('0x2a')]);_0x479bc4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x45a1e7['model'],qs[_0x0a9e('0x2e')](_0x526cf3[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x479bc4[_0x0a9e('0x2c')]=_0x479bc4[_0x0a9e('0x2c')][_0x0a9e('0x2f')]?_0x479bc4[_0x0a9e('0x2c')]:_0x45a1e7[_0x0a9e('0x26')];if(_0x526cf3[_0x0a9e('0x2a')]['includeAll']){_0x479bc4[_0x0a9e('0x30')]=[{'all':!![]}];}_0x479bc4=_['merge']({},_0x479bc4,_0x526cf3[_0x0a9e('0x31')]);return db[_0x0a9e('0x28')][_0x0a9e('0x32')](_0x479bc4)[_0x0a9e('0x1f')](handleEntityNotFound(_0x384319,null))[_0x0a9e('0x1f')](respondWithResult(_0x384319,null))['catch'](handleError(_0x384319,null));};exports[_0x0a9e('0x33')]=function(_0x46f0a5,_0x40cb85){return db[_0x0a9e('0x28')][_0x0a9e('0x33')](_0x46f0a5[_0x0a9e('0x34')],{})[_0x0a9e('0x1f')](respondWithResult(_0x40cb85,0xc9))[_0x0a9e('0x35')](handleError(_0x40cb85,null));};exports['update']=function(_0x44295a,_0x5e7238){if(_0x44295a[_0x0a9e('0x34')]['id']){delete _0x44295a[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x44295a['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5e7238,null))[_0x0a9e('0x1f')](saveUpdates(_0x44295a[_0x0a9e('0x34')],null))[_0x0a9e('0x1f')](respondWithResult(_0x5e7238,null))['catch'](handleError(_0x5e7238,null));};exports['destroy']=function(_0x1e8694,_0x5640eb){return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x1e8694[_0x0a9e('0x36')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5640eb,null))['then'](removeEntity(_0x5640eb,null))[_0x0a9e('0x35')](handleError(_0x5640eb,null));}; \ No newline at end of file +var _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x27637c,_0x364ea8){var _0x540f73=function(_0x580f3d){while(--_0x580f3d){_0x27637c['push'](_0x27637c['shift']());}};_0x540f73(++_0x364ea8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');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('0x9'));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 db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index a6e2c41..daa8d8e 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 _0x2454=['moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','define','ChatProactiveAction','util','../../config/logger','api'];(function(_0x584c00,_0x41fd4d){var _0x6a3c98=function(_0x5c4f5f){while(--_0x5c4f5f){_0x584c00['push'](_0x584c00['shift']());}};_0x6a3c98(++_0x41fd4d);}(_0x2454,0x1aa));var _0x4245=function(_0x133352,_0x1bb767){_0x133352=_0x133352-0x0;var _0x5630a3=_0x2454[_0x133352];return _0x5630a3;};'use strict';var _=require('lodash');var util=require(_0x4245('0x0'));var logger=require(_0x4245('0x1'))(_0x4245('0x2'));var moment=require(_0x4245('0x3'));var BPromise=require(_0x4245('0x4'));var rp=require(_0x4245('0x5'));var fs=require('fs');var path=require(_0x4245('0x6'));var rimraf=require(_0x4245('0x7'));var config=require('../../config/environment');var attributes=require(_0x4245('0x8'));module['exports']=function(_0x281803,_0x45cc75){return _0x281803[_0x4245('0x9')](_0x4245('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x075b=['chat_proactive_actions','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction'];(function(_0x57ea92,_0xbff408){var _0x372aae=function(_0x2b040c){while(--_0x2b040c){_0x57ea92['push'](_0x57ea92['shift']());}};_0x372aae(++_0xbff408);}(_0x075b,0xeb));var _0xb075=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x075b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb075('0x0'));var BPromise=require('bluebird');var rp=require(_0xb075('0x1'));var fs=require('fs');var path=require(_0xb075('0x2'));var rimraf=require(_0xb075('0x3'));var config=require(_0xb075('0x4'));var attributes=require('./chatProactiveAction.attributes');module[_0xb075('0x5')]=function(_0x5c67b7,_0x2aae9d){return _0x5c67b7[_0xb075('0x6')](_0xb075('0x7'),attributes,{'tableName':_0xb075('0x8'),'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 4bbc61d..0270184 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 _0x5229=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x46e182,_0x1046a8){var _0x42ade0=function(_0xb5288f){while(--_0xb5288f){_0x46e182['push'](_0x46e182['shift']());}};_0x42ade0(++_0x1046a8);}(_0x5229,0xd7));var _0x9522=function(_0x4dbba8,_0x2aa66d){_0x4dbba8=_0x4dbba8-0x0;var _0x433688=_0x5229[_0x4dbba8];return _0x433688;};'use strict';var _=require(_0x9522('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9522('0x1'));var rs=require(_0x9522('0x2'));var fs=require('fs');var Redis=require(_0x9522('0x3'));var db=require(_0x9522('0x4'))['db'];var utils=require(_0x9522('0x5'));var logger=require(_0x9522('0x6'))(_0x9522('0x7'));var config=require(_0x9522('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9522('0x9')][_0x9522('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39d54f,_0x17eb4,_0x130c6c){return new BPromise(function(_0x195c71,_0x284e6b){return client[_0x9522('0xb')](_0x39d54f,_0x130c6c)[_0x9522('0xc')](function(_0x3bc834){logger[_0x9522('0xd')](_0x9522('0xe'),_0x17eb4,_0x9522('0xf'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x17eb4,'request\x20sent',JSON[_0x9522('0x10')](_0x3bc834));if(_0x3bc834[_0x9522('0x11')]){if(_0x3bc834[_0x9522('0x11')]['code']===0x1f4){logger[_0x9522('0x11')](_0x9522('0xe'),_0x17eb4,_0x3bc834[_0x9522('0x11')][_0x9522('0x12')]);return _0x284e6b(_0x3bc834[_0x9522('0x11')]['message']);}logger[_0x9522('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x17eb4,_0x3bc834[_0x9522('0x11')][_0x9522('0x12')]);return _0x195c71(_0x3bc834[_0x9522('0x11')][_0x9522('0x12')]);}else{logger[_0x9522('0xd')](_0x9522('0xe'),_0x17eb4,_0x9522('0xf'));_0x195c71(_0x3bc834['result'][_0x9522('0x12')]);}})[_0x9522('0x13')](function(_0x440d5a){logger['error'](_0x9522('0xe'),_0x17eb4,_0x440d5a);_0x284e6b(_0x440d5a);});});} \ No newline at end of file +var _0x7db4=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x423d15,_0x329761){var _0x53b674=function(_0x30c548){while(--_0x30c548){_0x423d15['push'](_0x423d15['shift']());}};_0x53b674(++_0x329761);}(_0x7db4,0xc4));var _0x47db=function(_0x33ab41,_0xa2d039){_0x33ab41=_0x33ab41-0x0;var _0x12403d=_0x7db4[_0x33ab41];return _0x12403d;};'use strict';var _=require(_0x47db('0x0'));var util=require(_0x47db('0x1'));var moment=require(_0x47db('0x2'));var BPromise=require(_0x47db('0x3'));var rs=require(_0x47db('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47db('0x5'))['db'];var utils=require(_0x47db('0x6'));var logger=require(_0x47db('0x7'))(_0x47db('0x8'));var config=require(_0x47db('0x9'));var jayson=require(_0x47db('0xa'));var client=jayson[_0x47db('0xb')][_0x47db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d6d23,_0x167b7f,_0x3e117b){return new BPromise(function(_0x5b1b91,_0x63f1d3){return client[_0x47db('0xd')](_0x1d6d23,_0x3e117b)[_0x47db('0xe')](function(_0x45a5ba){logger[_0x47db('0xf')](_0x47db('0x10'),_0x167b7f,_0x47db('0x11'));logger[_0x47db('0x12')](_0x47db('0x13'),_0x167b7f,_0x47db('0x11'),JSON[_0x47db('0x14')](_0x45a5ba));if(_0x45a5ba[_0x47db('0x15')]){if(_0x45a5ba['error'][_0x47db('0x16')]===0x1f4){logger['error'](_0x47db('0x10'),_0x167b7f,_0x45a5ba['error']['message']);return _0x63f1d3(_0x45a5ba[_0x47db('0x15')][_0x47db('0x17')]);}logger[_0x47db('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x167b7f,_0x45a5ba[_0x47db('0x15')][_0x47db('0x17')]);return _0x5b1b91(_0x45a5ba[_0x47db('0x15')][_0x47db('0x17')]);}else{logger[_0x47db('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x167b7f,'request\x20sent');_0x5b1b91(_0x45a5ba[_0x47db('0x18')][_0x47db('0x17')]);}})[_0x47db('0x19')](function(_0x389001){logger[_0x47db('0x15')](_0x47db('0x10'),_0x167b7f,_0x389001);_0x63f1d3(_0x389001);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index e49b07c..6371c6b 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 _0x89db=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','update','delete','exports','util'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x89db,0xdf));var _0xb89d=function(_0x4c8b44,_0x321a4b){_0x4c8b44=_0x4c8b44-0x0;var _0x571b19=_0x89db[_0x4c8b44];return _0x571b19;};'use strict';var multer=require('multer');var util=require(_0xb89d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb89d('0x1'));var router=express['Router']();var auth=require(_0xb89d('0x2'));var interaction=require(_0xb89d('0x3'));var config=require(_0xb89d('0x4'));var controller=require('./chatProactiveAction.controller');router[_0xb89d('0x5')]('/:id',auth[_0xb89d('0x6')](),controller[_0xb89d('0x7')]);router['post']('/',auth[_0xb89d('0x6')](),controller[_0xb89d('0x8')]);router[_0xb89d('0x9')](_0xb89d('0xa'),auth['isAuthenticated'](),controller[_0xb89d('0xb')]);router[_0xb89d('0xc')](_0xb89d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xb89d('0xd')]=router; \ No newline at end of file +var _0xaf92=['post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated','show'];(function(_0x2f0dc3,_0x541e4d){var _0x15cad9=function(_0x4cd0a8){while(--_0x4cd0a8){_0x2f0dc3['push'](_0x2f0dc3['shift']());}};_0x15cad9(++_0x541e4d);}(_0xaf92,0x185));var _0x2af9=function(_0x214129,_0x1bcd7d){_0x214129=_0x214129-0x0;var _0xf7ae2b=_0xaf92[_0x214129];return _0xf7ae2b;};'use strict';var multer=require(_0x2af9('0x0'));var util=require(_0x2af9('0x1'));var path=require(_0x2af9('0x2'));var timeout=require(_0x2af9('0x3'));var express=require(_0x2af9('0x4'));var router=express[_0x2af9('0x5')]();var auth=require(_0x2af9('0x6'));var interaction=require(_0x2af9('0x7'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router['get'](_0x2af9('0x8'),auth[_0x2af9('0x9')](),controller[_0x2af9('0xa')]);router[_0x2af9('0xb')]('/',auth[_0x2af9('0x9')](),controller[_0x2af9('0xc')]);router[_0x2af9('0xd')](_0x2af9('0x8'),auth[_0x2af9('0x9')](),controller[_0x2af9('0xe')]);router[_0x2af9('0xf')](_0x2af9('0x8'),auth[_0x2af9('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f177709..02fc9b5 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 _0x3207=['exports','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x4a705c,_0x5196c3){var _0x3e1195=function(_0x519726){while(--_0x519726){_0x4a705c['push'](_0x4a705c['shift']());}};_0x3e1195(++_0x5196c3);}(_0x3207,0x1c2));var _0x7320=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x3207[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require('sequelize');module[_0x7320('0x0')]={'name':{'type':Sequelize[_0x7320('0x1')],'unique':_0x7320('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7320('0x1')]},'timeout':{'type':Sequelize[_0x7320('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7320('0x4')]('rrmemory','beepall',_0x7320('0x5'))}}; \ No newline at end of file +var _0x093e=['INTEGER','ENUM','rrmemory','beepall','exports','name'];(function(_0x28df74,_0x622b6){var _0x2975bf=function(_0x47a00d){while(--_0x47a00d){_0x28df74['push'](_0x28df74['shift']());}};_0x2975bf(++_0x622b6);}(_0x093e,0x94));var _0xe093=function(_0x91a997,_0x411892){_0x91a997=_0x91a997-0x0;var _0x2ee914=_0x093e[_0x91a997];return _0x2ee914;};'use strict';var Sequelize=require('sequelize');module[_0xe093('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe093('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe093('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe093('0x3')](_0xe093('0x4'),_0xe093('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d953e4d..9c590d5 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 _0xdb8d=['omit','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','register','jayson/promise','http','test','ValidationError','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','ChatQueues','end','name','send','map','ChatQueue','rawAttributes','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','include','findAll','show','intersection','includeAll','merge','options','find','create','body','user','get','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','nolimit','sort','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','from','team_has_chat_queues','join','user_has_teams','ut.UserId\x20=\x20?','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents'];(function(_0x149156,_0x268227){var _0x1a7c40=function(_0x300ae0){while(--_0x300ae0){_0x149156['push'](_0x149156['shift']());}};_0x1a7c40(++_0x268227);}(_0xdb8d,0x127));var _0xddb8=function(_0x39e5a8,_0x367273){_0x39e5a8=_0x39e5a8-0x0;var _0x5c9feb=_0xdb8d[_0x39e5a8];return _0x5c9feb;};'use strict';var pdf=require(_0xddb8('0x0'));var emlformat=require(_0xddb8('0x1'));var rimraf=require(_0xddb8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddb8('0x3'));var rp=require(_0xddb8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xddb8('0x5'));var util=require(_0xddb8('0x6'));var path=require(_0xddb8('0x7'));var sox=require(_0xddb8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xddb8('0x9'));var jsforce=require(_0xddb8('0xa'));var deskjs=require(_0xddb8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xddb8('0xc'));var Redis=require(_0xddb8('0xd'));var authService=require(_0xddb8('0xe'));var qs=require(_0xddb8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddb8('0x10'));var logger=require('../../config/logger')(_0xddb8('0x11'));var utils=require(_0xddb8('0x12'));var config=require(_0xddb8('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xddb8('0x14')](config['redis'],{'host':_0xddb8('0x15'),'port':0x18eb});var socket=require(_0xddb8('0x16'))(new Redis(config[_0xddb8('0x17')]));require(_0xddb8('0x18'))[_0xddb8('0x19')](socket);var jayson=require(_0xddb8('0x1a'));var client=jayson['client'][_0xddb8('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5552df,_0x52947c,_0x17b6e5){if(_0x17b6e5){var _0x5e3c17=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e3c17[_0xddb8('0x1c')](_0x52947c)){return _0x5552df;}else{throw new db['Sequelize'][(_0xddb8('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5552df;}}function respondWithRpcPromise(_0x47a270,_0xe6b847,_0x3c9cae,_0x57baf4){return new BPromise(function(_0xf0f492,_0x1390c8){var _0x59d083=_0x57baf4||client;return _0x59d083[_0xddb8('0x1e')](_0x47a270,_0x3c9cae)[_0xddb8('0x1f')](function(_0xb46019){logger['info'](_0xddb8('0x20'),_0xe6b847,_0xddb8('0x21'));logger[_0xddb8('0x22')](_0xddb8('0x23'),_0xe6b847,'request\x20sent',JSON[_0xddb8('0x24')](_0xb46019));if(_0xb46019[_0xddb8('0x25')]){if(_0xb46019[_0xddb8('0x25')][_0xddb8('0x26')]===0x1f4){logger[_0xddb8('0x25')](_0xddb8('0x20'),_0xe6b847,_0xb46019[_0xddb8('0x25')][_0xddb8('0x27')]);return _0x1390c8(_0xb46019[_0xddb8('0x25')][_0xddb8('0x27')]);}logger['error'](_0xddb8('0x20'),_0xe6b847,_0xb46019[_0xddb8('0x25')][_0xddb8('0x27')]);return _0xf0f492(_0xb46019[_0xddb8('0x25')][_0xddb8('0x27')]);}else{logger[_0xddb8('0x28')]('ChatQueue,\x20%s,\x20%s',_0xe6b847,_0xddb8('0x21'));_0xf0f492(_0xb46019[_0xddb8('0x29')]['message']);}})[_0xddb8('0x2a')](function(_0x4a8d98){logger[_0xddb8('0x25')](_0xddb8('0x20'),_0xe6b847,_0x4a8d98);_0x1390c8(_0x4a8d98);});});}function respondWithStatusCode(_0x36a787,_0x42e5a3){_0x42e5a3=_0x42e5a3||0xcc;return function(_0x324b31){if(_0x324b31){return _0x36a787[_0xddb8('0x2b')](_0x42e5a3);}return _0x36a787['status'](_0x42e5a3)['end']();};}function respondWithResult(_0x1b114e,_0x858562){_0x858562=_0x858562||0xc8;return function(_0x177adc){if(_0x177adc){return _0x1b114e[_0xddb8('0x2c')](_0x858562)[_0xddb8('0x2d')](_0x177adc);}};}function respondWithFilteredResult(_0x3f71f8,_0x4d8e63){return function(_0x53c552){if(_0x53c552){var _0x56e857=_0x53c552[_0xddb8('0x2e')],_0x3f21d7=_0x4d8e63[_0xddb8('0x2f')],_0xcdc4aa=_0x4d8e63[_0xddb8('0x2f')]+_0x4d8e63[_0xddb8('0x30')],_0xf511c3;if(_0xcdc4aa>=_0x56e857){_0xcdc4aa=_0x56e857;_0xf511c3=0xc8;}else{_0xf511c3=0xce;}_0x3f71f8[_0xddb8('0x2c')](_0xf511c3);return _0x3f71f8[_0xddb8('0x31')](_0xddb8('0x32'),_0x3f21d7+'-'+_0xcdc4aa+'/'+_0x56e857)[_0xddb8('0x2d')](_0x53c552);}return null;};}function patchUpdates(_0x1c7878){return function(_0x3af695){try{jsonpatch[_0xddb8('0x33')](_0x3af695,_0x1c7878,!![]);}catch(_0x78aa45){return BPromise[_0xddb8('0x34')](_0x78aa45);}return _0x3af695['save']();};}function saveUpdates(_0x20d686,_0x5ee0a1){return function(_0x39217e){if(_0x39217e){return _0x39217e[_0xddb8('0x35')](_0x20d686)['then'](function(_0x2695d5){return _0x2695d5;});}return null;};}function removeEntity(_0x4ee168,_0xb5947c){return function(_0x103967){if(_0x103967){return _0x103967[_0xddb8('0x36')]()['then'](function(){var _0x159ff8=_0x103967['get']({'plain':!![]});var _0x1aec89=_0xddb8('0x37');return db['UserProfileResource'][_0xddb8('0x36')]({'where':{'type':_0x1aec89,'resourceId':_0x159ff8['id']}})['then'](function(){return _0x103967;});})['then'](function(){_0x4ee168[_0xddb8('0x2c')](0xcc)[_0xddb8('0x38')]();});}};}function handleEntityNotFound(_0x245f09,_0x542c10){return function(_0x33eafa){if(!_0x33eafa){_0x245f09[_0xddb8('0x2b')](0x194);}return _0x33eafa;};}function handleError(_0x3ef078,_0x1e8b1f){_0x1e8b1f=_0x1e8b1f||0x1f4;return function(_0x53dc25){logger[_0xddb8('0x25')](_0x53dc25['stack']);if(_0x53dc25[_0xddb8('0x39')]){delete _0x53dc25[_0xddb8('0x39')];}_0x3ef078['status'](_0x1e8b1f)[_0xddb8('0x3a')](_0x53dc25);};}exports['index']=function(_0xb1287e,_0x34aac1){var _0x5bb708={},_0x2ab2a5={},_0xc8995c={'count':0x0,'rows':[]};var _0x8ac0bb=_[_0xddb8('0x3b')](db[_0xddb8('0x3c')][_0xddb8('0x3d')],function(_0x26b532){return{'name':_0x26b532['fieldName'],'type':_0x26b532[_0xddb8('0x3e')]['key']};});_0x2ab2a5[_0xddb8('0x3f')]=_[_0xddb8('0x3b')](_0x8ac0bb,_0xddb8('0x39'));_0x2ab2a5[_0xddb8('0x40')]=_[_0xddb8('0x41')](_0xb1287e['query']);_0x2ab2a5[_0xddb8('0x42')]=_['intersection'](_0x2ab2a5['model'],_0x2ab2a5[_0xddb8('0x40')]);_0x5bb708['attributes']=_['intersection'](_0x2ab2a5['model'],qs[_0xddb8('0x43')](_0xb1287e[_0xddb8('0x40')][_0xddb8('0x43')]));_0x5bb708[_0xddb8('0x44')]=_0x5bb708[_0xddb8('0x44')][_0xddb8('0x45')]?_0x5bb708[_0xddb8('0x44')]:_0x2ab2a5[_0xddb8('0x3f')];if(!_0xb1287e['query'][_0xddb8('0x46')]('nolimit')){_0x5bb708[_0xddb8('0x30')]=qs[_0xddb8('0x30')](_0xb1287e[_0xddb8('0x40')]['limit']);_0x5bb708[_0xddb8('0x2f')]=qs['offset'](_0xb1287e['query'][_0xddb8('0x2f')]);}_0x5bb708[_0xddb8('0x47')]=qs['sort'](_0xb1287e[_0xddb8('0x40')]['sort']);_0x5bb708[_0xddb8('0x48')]=qs[_0xddb8('0x42')](_[_0xddb8('0x49')](_0xb1287e[_0xddb8('0x40')],_0x2ab2a5[_0xddb8('0x42')]),_0x8ac0bb);if(_0xb1287e['query'][_0xddb8('0x4a')]){_0x5bb708[_0xddb8('0x48')]=_['merge'](_0x5bb708[_0xddb8('0x48')],{'$or':_[_0xddb8('0x3b')](_0x8ac0bb,function(_0x58bff1){if(_0x58bff1[_0xddb8('0x3e')]!==_0xddb8('0x4b')){var _0x1096b1={};_0x1096b1[_0x58bff1[_0xddb8('0x39')]]={'$like':'%'+_0xb1287e['query'][_0xddb8('0x4a')]+'%'};return _0x1096b1;}})});}_0x5bb708=_['merge']({},_0x5bb708,_0xb1287e['options']);var _0x2af22d={'where':_0x5bb708[_0xddb8('0x48')]};return db[_0xddb8('0x3c')][_0xddb8('0x2e')](_0x2af22d)[_0xddb8('0x1f')](function(_0x4a2999){_0xc8995c[_0xddb8('0x2e')]=_0x4a2999;if(_0xb1287e['query']['includeAll']){_0x5bb708[_0xddb8('0x4c')]=[{'all':!![]}];}return db[_0xddb8('0x3c')][_0xddb8('0x4d')](_0x5bb708);})[_0xddb8('0x1f')](function(_0x1a4f20){_0xc8995c['rows']=_0x1a4f20;return _0xc8995c;})[_0xddb8('0x1f')](respondWithFilteredResult(_0x34aac1,_0x5bb708))[_0xddb8('0x2a')](handleError(_0x34aac1,null));};exports[_0xddb8('0x4e')]=function(_0x50063c,_0x2125ec){var _0x394478={'raw':!![],'where':{'id':_0x50063c['params']['id']}},_0x21657e={};_0x21657e[_0xddb8('0x3f')]=_[_0xddb8('0x41')](db['ChatQueue'][_0xddb8('0x3d')]);_0x21657e[_0xddb8('0x40')]=_[_0xddb8('0x41')](_0x50063c[_0xddb8('0x40')]);_0x21657e['filters']=_[_0xddb8('0x4f')](_0x21657e['model'],_0x21657e[_0xddb8('0x40')]);_0x394478[_0xddb8('0x44')]=_['intersection'](_0x21657e[_0xddb8('0x3f')],qs[_0xddb8('0x43')](_0x50063c[_0xddb8('0x40')][_0xddb8('0x43')]));_0x394478[_0xddb8('0x44')]=_0x394478[_0xddb8('0x44')]['length']?_0x394478['attributes']:_0x21657e[_0xddb8('0x3f')];if(_0x50063c[_0xddb8('0x40')][_0xddb8('0x50')]){_0x394478[_0xddb8('0x4c')]=[{'all':!![]}];}_0x394478=_[_0xddb8('0x51')]({},_0x394478,_0x50063c[_0xddb8('0x52')]);return db[_0xddb8('0x3c')][_0xddb8('0x53')](_0x394478)[_0xddb8('0x1f')](handleEntityNotFound(_0x2125ec,null))['then'](respondWithResult(_0x2125ec,null))['catch'](handleError(_0x2125ec,null));};exports[_0xddb8('0x54')]=function(_0x4ccaf9,_0x164efd){return db[_0xddb8('0x3c')][_0xddb8('0x54')](_0x4ccaf9[_0xddb8('0x55')],{})[_0xddb8('0x1f')](function(_0x18c085){var _0xcd5165=_0x4ccaf9[_0xddb8('0x56')][_0xddb8('0x57')]({'plain':!![]});if(!_0xcd5165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcd5165[_0xddb8('0x58')]===_0xddb8('0x56')){var _0x3c4543=_0x18c085[_0xddb8('0x57')]({'plain':!![]});var _0x78e192=_0xddb8('0x37');return db[_0xddb8('0x59')][_0xddb8('0x53')]({'where':{'name':_0x78e192,'userProfileId':_0xcd5165[_0xddb8('0x5a')]},'raw':!![]})[_0xddb8('0x1f')](function(_0x5a1aba){if(_0x5a1aba&&_0x5a1aba['autoAssociation']===0x0){return db[_0xddb8('0x5b')][_0xddb8('0x54')]({'name':_0x3c4543[_0xddb8('0x39')],'resourceId':_0x3c4543['id'],'type':_0x5a1aba['name'],'sectionId':_0x5a1aba['id']},{})[_0xddb8('0x1f')](function(){return _0x18c085;});}else{return _0x18c085;}})[_0xddb8('0x2a')](function(_0xb25a6a){logger[_0xddb8('0x25')](_0xddb8('0x5c'),_0xb25a6a);throw _0xb25a6a;});}return _0x18c085;})[_0xddb8('0x1f')](respondWithResult(_0x164efd,0xc9))[_0xddb8('0x2a')](handleError(_0x164efd,null));};exports[_0xddb8('0x35')]=function(_0x376040,_0x598980){if(_0x376040['body']['id']){delete _0x376040[_0xddb8('0x55')]['id'];}return db[_0xddb8('0x3c')]['find']({'where':{'id':_0x376040[_0xddb8('0x5d')]['id']}})[_0xddb8('0x1f')](handleEntityNotFound(_0x598980,null))[_0xddb8('0x1f')](saveUpdates(_0x376040[_0xddb8('0x55')],null))[_0xddb8('0x1f')](respondWithResult(_0x598980,null))['catch'](handleError(_0x598980,null));};exports[_0xddb8('0x36')]=function(_0x2ec6a9,_0x239a89){return db['ChatQueue'][_0xddb8('0x53')]({'where':{'id':_0x2ec6a9[_0xddb8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x239a89,null))[_0xddb8('0x1f')](removeEntity(_0x239a89,null))[_0xddb8('0x2a')](handleError(_0x239a89,null));};exports[_0xddb8('0x5e')]=function(_0x5ae6bf,_0x4d035f){return db['ChatQueue'][_0xddb8('0x5e')]()[_0xddb8('0x1f')](respondWithResult(_0x4d035f,null))[_0xddb8('0x2a')](handleError(_0x4d035f,null));};exports[_0xddb8('0x5f')]=function(_0x1f53c3,_0x378ff4,_0x18b576){var _0x1fa5ab={'raw':!![],'where':{}},_0x199f64={},_0x429acf;return db['ChatQueue'][_0xddb8('0x60')]({'where':{'id':_0x1f53c3[_0xddb8('0x5d')]['id']}})[_0xddb8('0x1f')](handleEntityNotFound(_0x378ff4,null))[_0xddb8('0x1f')](function(_0x311242){if(_0x311242){_0x429acf=_0x311242['get']({'plain':!![]});_0x199f64['model']=_['keys'](db[_0xddb8('0x61')]['rawAttributes']);_0x199f64[_0xddb8('0x40')]=_[_0xddb8('0x41')](_0x1f53c3[_0xddb8('0x40')]);_0x199f64[_0xddb8('0x42')]=_[_0xddb8('0x4f')](_0x199f64[_0xddb8('0x3f')],_0x199f64[_0xddb8('0x40')]);_0x1fa5ab[_0xddb8('0x44')]=_['intersection'](_0x199f64[_0xddb8('0x3f')],qs['fields'](_0x1f53c3[_0xddb8('0x40')]['fields']));_0x1fa5ab['attributes']=_0x1fa5ab[_0xddb8('0x44')][_0xddb8('0x45')]?_0x1fa5ab['attributes']:_0x199f64[_0xddb8('0x3f')];if(!_0x1f53c3[_0xddb8('0x40')][_0xddb8('0x46')](_0xddb8('0x62'))){_0x1fa5ab[_0xddb8('0x30')]=qs[_0xddb8('0x30')](_0x1f53c3['query'][_0xddb8('0x30')]);_0x1fa5ab[_0xddb8('0x2f')]=qs[_0xddb8('0x2f')](_0x1f53c3['query'][_0xddb8('0x2f')]);}_0x1fa5ab[_0xddb8('0x47')]=qs['sort'](_0x1f53c3['query'][_0xddb8('0x63')]);_0x1fa5ab[_0xddb8('0x48')]=qs[_0xddb8('0x42')](_[_0xddb8('0x49')](_0x1f53c3['query'],_0x199f64[_0xddb8('0x42')]));_0x1fa5ab[_0xddb8('0x48')]['ChatQueueId']=_0x311242['id'];if(_0x1f53c3[_0xddb8('0x40')][_0xddb8('0x4a')]){_0x1fa5ab[_0xddb8('0x48')]=_[_0xddb8('0x51')](_0x1fa5ab['where'],{'$or':_[_0xddb8('0x3b')](_0x1fa5ab[_0xddb8('0x44')],function(_0xb5fc7f){var _0x8ca4fa={};_0x8ca4fa[_0xb5fc7f]={'$like':'%'+_0x1f53c3[_0xddb8('0x40')][_0xddb8('0x4a')]+'%'};return _0x8ca4fa;})});}_0x1fa5ab=_[_0xddb8('0x51')]({},_0x1fa5ab,_0x1f53c3[_0xddb8('0x52')]);return db['UserChatQueue'][_0xddb8('0x4d')](_0x1fa5ab);}})['then'](function(_0x3d1086){if(_0x3d1086){return db['User']['findAndCountAll']({'where':{'id':_[_0xddb8('0x3b')](_0x3d1086,_0xddb8('0x64')),'role':_0xddb8('0x65')},'attributes':['id',_0xddb8('0x39'),_0xddb8('0x66'),_0xddb8('0x67'),_0xddb8('0x68')]});}})[_0xddb8('0x1f')](function(_0x4cda08){if(_0x4cda08){return{'count':_0x4cda08['count'],'rows':_[_0xddb8('0x3b')](_0x4cda08[_0xddb8('0x69')],function(_0x590abf){return{'membername':_0x590abf[_0xddb8('0x39')],'UserId':_0x590abf['id'],'queue_name':_0x429acf[_0xddb8('0x39')],'ChatQueueId':_0x429acf['id'],'interface':util[_0xddb8('0x6a')](_0xddb8('0x6b'),_0xddb8('0x6c'),_0x590abf[_0xddb8('0x39')]),'penalty':0x0,'paused':_0x590abf['chatPause'],'createdAt':_0x590abf[_0xddb8('0x68')],'updatedAt':_0x590abf[_0xddb8('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x378ff4,_0x1fa5ab))[_0xddb8('0x2a')](handleError(_0x378ff4,null));};exports[_0xddb8('0x6d')]=function(_0x36d858,_0x15ea78,_0x4c9417){var _0x8089c8={};var _0x3e62c2={};var _0x3d37d6;var _0x457808;return db[_0xddb8('0x3c')][_0xddb8('0x60')]({'where':{'id':_0x36d858[_0xddb8('0x5d')]['id']}})[_0xddb8('0x1f')](handleEntityNotFound(_0x15ea78,null))['then'](function(_0x1d1a29){if(_0x1d1a29){_0x3d37d6=_0x1d1a29;_0x3e62c2[_0xddb8('0x3f')]=_[_0xddb8('0x41')](db[_0xddb8('0x6e')][_0xddb8('0x3d')]);_0x3e62c2[_0xddb8('0x40')]=_[_0xddb8('0x41')](_0x36d858[_0xddb8('0x40')]);_0x3e62c2[_0xddb8('0x42')]=_['intersection'](_0x3e62c2['model'],_0x3e62c2['query']);_0x8089c8['attributes']=_['intersection'](_0x3e62c2[_0xddb8('0x3f')],qs[_0xddb8('0x43')](_0x36d858[_0xddb8('0x40')]['fields']));_0x8089c8[_0xddb8('0x44')]=_0x8089c8[_0xddb8('0x44')]['length']?_0x8089c8['attributes']:_0x3e62c2[_0xddb8('0x3f')];_0x8089c8[_0xddb8('0x47')]=qs['sort'](_0x36d858['query']['sort']);_0x8089c8[_0xddb8('0x48')]=qs[_0xddb8('0x42')](_[_0xddb8('0x49')](_0x36d858[_0xddb8('0x40')],_0x3e62c2[_0xddb8('0x42')]));if(_0x36d858[_0xddb8('0x40')][_0xddb8('0x4a')]){_0x8089c8['where']=_[_0xddb8('0x51')](_0x8089c8[_0xddb8('0x48')],{'$or':_[_0xddb8('0x3b')](_0x8089c8[_0xddb8('0x44')],function(_0x5b77cc){var _0x306671={};_0x306671[_0x5b77cc]={'$like':'%'+_0x36d858['query'][_0xddb8('0x4a')]+'%'};return _0x306671;})});}_0x8089c8=_[_0xddb8('0x51')]({},_0x8089c8,_0x36d858['options']);return _0x3d37d6[_0xddb8('0x6d')](_0x8089c8);}})[_0xddb8('0x1f')](function(_0x48ff1c){if(_0x48ff1c){_0x457808=_0x48ff1c[_0xddb8('0x45')];if(!_0x36d858['query'][_0xddb8('0x46')](_0xddb8('0x62'))){_0x8089c8[_0xddb8('0x30')]=qs['limit'](_0x36d858[_0xddb8('0x40')][_0xddb8('0x30')]);_0x8089c8[_0xddb8('0x2f')]=qs['offset'](_0x36d858[_0xddb8('0x40')][_0xddb8('0x2f')]);}return _0x3d37d6['getTeams'](_0x8089c8);}})[_0xddb8('0x1f')](function(_0x3a9a09){if(_0x3a9a09){return _0x3a9a09?{'count':_0x457808,'rows':_0x3a9a09}:null;}})['then'](respondWithResult(_0x15ea78,null))['catch'](handleError(_0x15ea78,null));};exports[_0xddb8('0x6f')]=function(_0x32d121,_0x290ebf,_0x1d7d1c){var _0x1917a7=_0x32d121[_0xddb8('0x55')][_0xddb8('0x70')];return db['Team'][_0xddb8('0x4d')]({'where':{'id':_0x1917a7},'attributes':['id'],'include':[{'model':db[_0xddb8('0x71')],'as':'Agents','attributes':['id',_0xddb8('0x39'),_0xddb8('0x72'),_0xddb8('0x73'),_0xddb8('0x74')],'raw':!![]}]})['then'](function(_0x1ba114){if(_0x1ba114){var _0xcc15b2=_[_0xddb8('0x75')](_0x1ba114,function(_0x41abbf){var _0x12a337=_0x41abbf['get']({'plain':!![]});return _0x12a337[_0xddb8('0x76')];});return db[_0xddb8('0x3c')][_0xddb8('0x53')]({'where':{'id':_0x32d121[_0xddb8('0x5d')]['id']}})[_0xddb8('0x1f')](function(_0x41f5cc){return db[_0xddb8('0x77')][_0xddb8('0x78')](function(_0x367fcf){return _0x41f5cc[_0xddb8('0x6f')](_0x1917a7,{'transaction':_0x367fcf})[_0xddb8('0x1f')](function(){return BPromise[_0xddb8('0x79')](_0xcc15b2,function(_0x48a8fe){return db[_0xddb8('0x61')][_0xddb8('0x7a')]({'where':{'UserId':_0x48a8fe['id'],'ChatQueueId':_0x32d121[_0xddb8('0x5d')]['id']},'transaction':_0x367fcf});});})[_0xddb8('0x1f')](function(){_0xcc15b2[_0xddb8('0x7b')](function(_0xf0ff4b){socket[_0xddb8('0x7c')](_0xddb8('0x7d'),{'UserId':_0xf0ff4b['id'],'ChatQueueId':_0x41f5cc['id']});});});});});}})[_0xddb8('0x1f')](respondWithStatusCode(_0x290ebf,null))[_0xddb8('0x2a')](handleError(_0x290ebf,null));};exports[_0xddb8('0x7e')]=function(_0x29d696,_0x172d2a,_0x4b3071){return db[_0xddb8('0x6e')]['findAll']({'where':{'id':_0x29d696[_0xddb8('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0xddb8('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xddb8('0x1f')](handleEntityNotFound(_0x172d2a,null))['then'](function(_0x1ed1e1){var _0x3c601f=_['map'](_0x1ed1e1,'id');var _0xbad537=[];var _0x4bce65=[];var _0xc0f499=squel['select']();_0xc0f499[_0xddb8('0x7f')]('tq.TeamId')[_0xddb8('0x80')](_0xddb8('0x81'),'tq')[_0xddb8('0x82')](_0xddb8('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xddb8('0x48')]('ChatQueueId\x20=\x20?',_0x29d696[_0xddb8('0x5d')]['id']);for(var _0x397588=0x0;_0x397588<_0x1ed1e1['length'];_0x397588+=0x1){let _0x39c0fa=_0x1ed1e1[_0x397588];for(var _0x59dba4=0x0;_0x59dba4<_0x39c0fa[_0xddb8('0x76')][_0xddb8('0x45')];_0x59dba4+=0x1){let _0xb217c4=_0x39c0fa[_0xddb8('0x76')][_0x59dba4];var _0x33a3dc=_0xc0f499['clone']();_0x33a3dc[_0xddb8('0x48')](_0xddb8('0x84'),_0xb217c4['id']);_0x4bce65['push'](db[_0xddb8('0x77')][_0xddb8('0x40')](_0x33a3dc['toString'](),{'type':db[_0xddb8('0x77')]['QueryTypes'][_0xddb8('0x85')]})[_0xddb8('0x1f')](function(_0x36e234){if(_0x36e234[_0xddb8('0x45')]===0x1){return _0xb217c4['id'];}else{var _0x2ea21a=_['every'](_[_0xddb8('0x3b')](_0x36e234,_0xddb8('0x86')),function(_0x44450c){return _[_0xddb8('0x87')](_0x3c601f,_0x44450c);});if(_0x2ea21a){return _0xb217c4['id'];}}}));}}return BPromise[_0xddb8('0x88')](_0x4bce65)[_0xddb8('0x1f')](function(_0x4acf81){_0xbad537=_(_0xbad537)['union'](_0x4acf81)[_0xddb8('0x89')]()[_0xddb8('0x8a')]();return db[_0xddb8('0x3c')][_0xddb8('0x53')]({'where':{'id':_0x29d696[_0xddb8('0x5d')]['id']}})[_0xddb8('0x1f')](function(_0x57ef10){return db['sequelize'][_0xddb8('0x78')](function(_0x408e54){return _0x57ef10['removeTeams'](_0x29d696[_0xddb8('0x40')]['ids'],{'transaction':_0x408e54})[_0xddb8('0x1f')](function(){if(!_[_0xddb8('0x8b')](_0xbad537)){return _0x57ef10[_0xddb8('0x8c')](_0xbad537,{'transaction':_0x408e54});}})['then'](function(){_0xbad537[_0xddb8('0x7b')](function(_0x50b573){socket['emit'](_0xddb8('0x8d'),{'UserId':_0x50b573,'ChatQueueId':_0x57ef10['id']});});});});});});})[_0xddb8('0x1f')](respondWithStatusCode(_0x172d2a,null))['catch'](handleError(_0x172d2a,null));};exports['addAgents']=function(_0x352926,_0x6c2436,_0x50ade9){return db[_0xddb8('0x3c')][_0xddb8('0x53')]({'where':{'id':_0x352926[_0xddb8('0x5d')]['id']}})[_0xddb8('0x1f')](handleEntityNotFound(_0x6c2436,null))[_0xddb8('0x1f')](function(_0x5c0ec5){if(_0x5c0ec5){return _0x5c0ec5[_0xddb8('0x8e')](_0x352926[_0xddb8('0x55')]['ids'],_[_0xddb8('0x8f')](_0x352926['body'],[_0xddb8('0x70'),'id'])||{})['spread'](function(_0x402f8d){for(var _0x95ad98=0x0;_0x95ad98<_0x352926[_0xddb8('0x55')][_0xddb8('0x70')][_0xddb8('0x45')];_0x95ad98+=0x1){socket['emit'](_0xddb8('0x7d'),{'UserId':_0x352926[_0xddb8('0x55')]['ids'][_0x95ad98],'ChatQueueId':_0x352926['params']['id']});}return _0x402f8d;});}})[_0xddb8('0x1f')](respondWithResult(_0x6c2436,null))['catch'](handleError(_0x6c2436,null));};exports[_0xddb8('0x8c')]=function(_0x62162e,_0x289f75,_0x4befd5){return db[_0xddb8('0x3c')][_0xddb8('0x53')]({'where':{'id':_0x62162e[_0xddb8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x289f75,null))[_0xddb8('0x1f')](function(_0x12d1cf){if(_0x12d1cf){return _0x12d1cf['removeAgents'](_0x62162e[_0xddb8('0x40')][_0xddb8('0x70')])[_0xddb8('0x1f')](function(){if(_[_0xddb8('0x90')](_0x62162e[_0xddb8('0x40')][_0xddb8('0x70')])){for(var _0x2590f3=0x0;_0x2590f3<_0x62162e[_0xddb8('0x40')][_0xddb8('0x70')][_0xddb8('0x45')];_0x2590f3+=0x1){socket[_0xddb8('0x7c')](_0xddb8('0x8d'),{'UserId':Number(_0x62162e[_0xddb8('0x40')][_0xddb8('0x70')][_0x2590f3]),'ChatQueueId':Number(_0x62162e['params']['id'])});}}else{socket[_0xddb8('0x7c')](_0xddb8('0x8d'),{'UserId':Number(_0x62162e[_0xddb8('0x40')][_0xddb8('0x70')]),'ChatQueueId':Number(_0x62162e[_0xddb8('0x5d')]['id'])});}});}})[_0xddb8('0x1f')](respondWithStatusCode(_0x289f75,null))[_0xddb8('0x2a')](handleError(_0x289f75,null));};exports[_0xddb8('0x91')]=function(_0xec3cee,_0x4f2134,_0x1e3e1e){var _0x55877f={};var _0x4efec3={};var _0x667020;var _0x56d0c1;return db[_0xddb8('0x3c')][_0xddb8('0x60')]({'where':{'id':_0xec3cee['params']['id']}})[_0xddb8('0x1f')](handleEntityNotFound(_0x4f2134,null))[_0xddb8('0x1f')](function(_0x2a58d2){if(_0x2a58d2){_0x667020=_0x2a58d2;_0x4efec3[_0xddb8('0x3f')]=_[_0xddb8('0x41')](db[_0xddb8('0x71')]['rawAttributes']);_0x4efec3[_0xddb8('0x40')]=_['keys'](_0xec3cee[_0xddb8('0x40')]);_0x4efec3[_0xddb8('0x42')]=_[_0xddb8('0x4f')](_0x4efec3[_0xddb8('0x3f')],_0x4efec3[_0xddb8('0x40')]);_0x55877f[_0xddb8('0x44')]=_[_0xddb8('0x4f')](_0x4efec3[_0xddb8('0x3f')],qs[_0xddb8('0x43')](_0xec3cee[_0xddb8('0x40')][_0xddb8('0x43')]));_0x55877f[_0xddb8('0x44')]=_0x55877f['attributes'][_0xddb8('0x45')]?_0x55877f[_0xddb8('0x44')]:_0x4efec3[_0xddb8('0x3f')];_0x55877f[_0xddb8('0x47')]=qs['sort'](_0xec3cee[_0xddb8('0x40')][_0xddb8('0x63')]);_0x55877f['where']=qs[_0xddb8('0x42')](_[_0xddb8('0x49')](_0xec3cee[_0xddb8('0x40')],_0x4efec3['filters']));if(_0xec3cee['query'][_0xddb8('0x4a')]){_0x55877f[_0xddb8('0x48')]=_[_0xddb8('0x51')](_0x55877f[_0xddb8('0x48')],{'$or':_['map'](_0x55877f['attributes'],function(_0x22ad1b){var _0x1fdd73={};_0x1fdd73[_0x22ad1b]={'$like':'%'+_0xec3cee[_0xddb8('0x40')][_0xddb8('0x4a')]+'%'};return _0x1fdd73;})});}_0x55877f=_[_0xddb8('0x51')]({},_0x55877f,_0xec3cee[_0xddb8('0x52')]);return _0x667020['getAgents'](_0x55877f);}})['then'](function(_0x35819e){if(_0x35819e){_0x56d0c1=_0x35819e[_0xddb8('0x45')];if(!_0xec3cee['query'][_0xddb8('0x46')](_0xddb8('0x62'))){_0x55877f['limit']=qs[_0xddb8('0x30')](_0xec3cee[_0xddb8('0x40')][_0xddb8('0x30')]);_0x55877f['offset']=qs[_0xddb8('0x2f')](_0xec3cee[_0xddb8('0x40')]['offset']);}return _0x667020['getAgents'](_0x55877f);}})[_0xddb8('0x1f')](function(_0x4e3b09){if(_0x4e3b09){return _0x4e3b09?{'count':_0x56d0c1,'rows':_0x4e3b09}:null;}})[_0xddb8('0x1f')](respondWithResult(_0x4f2134,null))[_0xddb8('0x2a')](handleError(_0x4f2134,null));}; \ No newline at end of file +var _0x9c1e=['reject','save','update','destroy','get','ChatQueues','name','send','index','map','rawAttributes','fieldName','key','model','intersection','attributes','fields','query','nolimit','limit','offset','order','sort','where','filters','pick','filter','type','merge','ChatQueue','includeAll','include','findAll','rows','show','params','keys','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','describe','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','apply'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x9c1e,0x107));var _0xe9c1=function(_0x2bdf9a,_0x4e8689){_0x2bdf9a=_0x2bdf9a-0x0;var _0x360603=_0x9c1e[_0x2bdf9a];return _0x360603;};'use strict';var pdf=require(_0xe9c1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe9c1('0x1'));var zipdir=require(_0xe9c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9c1('0x3'));var moment=require(_0xe9c1('0x4'));var BPromise=require(_0xe9c1('0x5'));var Mustache=require(_0xe9c1('0x6'));var util=require(_0xe9c1('0x7'));var path=require(_0xe9c1('0x8'));var sox=require(_0xe9c1('0x9'));var csv=require(_0xe9c1('0xa'));var ejs=require(_0xe9c1('0xb'));var fs=require('fs');var _=require(_0xe9c1('0xc'));var squel=require(_0xe9c1('0xd'));var crypto=require(_0xe9c1('0xe'));var jsforce=require(_0xe9c1('0xf'));var deskjs=require(_0xe9c1('0x10'));var toCsv=require(_0xe9c1('0xa'));var querystring=require(_0xe9c1('0x11'));var Papa=require(_0xe9c1('0x12'));var Redis=require(_0xe9c1('0x13'));var authService=require(_0xe9c1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe9c1('0x15'));var hardwareService=require(_0xe9c1('0x16'));var logger=require(_0xe9c1('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe9c1('0x18'));var db=require(_0xe9c1('0x19'))['db'];config['redis']=_[_0xe9c1('0x1a')](config[_0xe9c1('0x1b')],{'host':_0xe9c1('0x1c'),'port':0x18eb});var socket=require(_0xe9c1('0x1d'))(new Redis(config['redis']));require(_0xe9c1('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe9c1('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x2c1c26,_0x3eb6cb,_0x33cdf4){if(_0x33cdf4){var _0x3f5c95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f5c95[_0xe9c1('0x20')](_0x3eb6cb)){return _0x2c1c26;}else{throw new db['Sequelize'][(_0xe9c1('0x21'))](_0xe9c1('0x22'));}}else{return _0x2c1c26;}}function respondWithRpcPromise(_0x460015,_0x1c35e4,_0x18d374,_0x4bc98a){return new BPromise(function(_0x567a09,_0x52614a){var _0xeac615=_0x4bc98a||client;return _0xeac615[_0xe9c1('0x23')](_0x460015,_0x18d374)[_0xe9c1('0x24')](function(_0x2de118){logger[_0xe9c1('0x25')](_0xe9c1('0x26'),_0x1c35e4,_0xe9c1('0x27'));logger[_0xe9c1('0x28')](_0xe9c1('0x29'),_0x1c35e4,_0xe9c1('0x27'),JSON[_0xe9c1('0x2a')](_0x2de118));if(_0x2de118['error']){if(_0x2de118[_0xe9c1('0x2b')][_0xe9c1('0x2c')]===0x1f4){logger[_0xe9c1('0x2b')](_0xe9c1('0x26'),_0x1c35e4,_0x2de118['error']['message']);return _0x52614a(_0x2de118[_0xe9c1('0x2b')][_0xe9c1('0x2d')]);}logger[_0xe9c1('0x2b')]('ChatQueue,\x20%s,\x20%s',_0x1c35e4,_0x2de118['error'][_0xe9c1('0x2d')]);return _0x567a09(_0x2de118['error'][_0xe9c1('0x2d')]);}else{logger[_0xe9c1('0x25')](_0xe9c1('0x26'),_0x1c35e4,'request\x20sent');_0x567a09(_0x2de118['result'][_0xe9c1('0x2d')]);}})[_0xe9c1('0x2e')](function(_0x48b22d){logger[_0xe9c1('0x2b')](_0xe9c1('0x26'),_0x1c35e4,_0x48b22d);_0x52614a(_0x48b22d);});});}function respondWithStatusCode(_0x3d0ef2,_0xa7b6ca){_0xa7b6ca=_0xa7b6ca||0xcc;return function(_0x598103){if(_0x598103){return _0x3d0ef2[_0xe9c1('0x2f')](_0xa7b6ca);}return _0x3d0ef2[_0xe9c1('0x30')](_0xa7b6ca)[_0xe9c1('0x31')]();};}function respondWithResult(_0x5d4b3e,_0x1cb1e7){_0x1cb1e7=_0x1cb1e7||0xc8;return function(_0x2062c4){if(_0x2062c4){return _0x5d4b3e[_0xe9c1('0x30')](_0x1cb1e7)[_0xe9c1('0x32')](_0x2062c4);}};}function respondWithFilteredResult(_0x49c835,_0xb631d4){return function(_0x1ea3db){if(_0x1ea3db){var _0x9ab45b=_0x1ea3db[_0xe9c1('0x33')],_0x68b1f9=_0xb631d4['offset'],_0x523276=_0xb631d4['offset']+_0xb631d4['limit'],_0x3394d9;if(_0x523276>=_0x9ab45b){_0x523276=_0x9ab45b;_0x3394d9=0xc8;}else{_0x3394d9=0xce;}_0x49c835['status'](_0x3394d9);return _0x49c835['set']('Content-Range',_0x68b1f9+'-'+_0x523276+'/'+_0x9ab45b)[_0xe9c1('0x32')](_0x1ea3db);}return null;};}function patchUpdates(_0x93e09f){return function(_0x498e29){try{jsonpatch[_0xe9c1('0x34')](_0x498e29,_0x93e09f,!![]);}catch(_0x409e58){return BPromise[_0xe9c1('0x35')](_0x409e58);}return _0x498e29[_0xe9c1('0x36')]();};}function saveUpdates(_0x5c1db9,_0x253724){return function(_0x1876bf){if(_0x1876bf){return _0x1876bf[_0xe9c1('0x37')](_0x5c1db9)['then'](function(_0x172d27){return _0x172d27;});}return null;};}function removeEntity(_0xad8ec9,_0x26b60e){return function(_0x384feb){if(_0x384feb){return _0x384feb[_0xe9c1('0x38')]()[_0xe9c1('0x24')](function(){var _0x235526=_0x384feb[_0xe9c1('0x39')]({'plain':!![]});var _0x359d3a=_0xe9c1('0x3a');return db['UserProfileResource'][_0xe9c1('0x38')]({'where':{'type':_0x359d3a,'resourceId':_0x235526['id']}})[_0xe9c1('0x24')](function(){return _0x384feb;});})[_0xe9c1('0x24')](function(){_0xad8ec9[_0xe9c1('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120a14,_0x4295fb){return function(_0x599569){if(!_0x599569){_0x120a14['sendStatus'](0x194);}return _0x599569;};}function handleError(_0xaeca62,_0x5698bb){_0x5698bb=_0x5698bb||0x1f4;return function(_0x598c4e){logger[_0xe9c1('0x2b')](_0x598c4e['stack']);if(_0x598c4e[_0xe9c1('0x3b')]){delete _0x598c4e[_0xe9c1('0x3b')];}_0xaeca62[_0xe9c1('0x30')](_0x5698bb)[_0xe9c1('0x3c')](_0x598c4e);};}exports[_0xe9c1('0x3d')]=function(_0x25672e,_0x10b498){var _0x30a979={},_0x3682b5={},_0x2e3174={'count':0x0,'rows':[]};var _0x2dd8a9=_[_0xe9c1('0x3e')](db['ChatQueue'][_0xe9c1('0x3f')],function(_0x1c5f44){return{'name':_0x1c5f44[_0xe9c1('0x40')],'type':_0x1c5f44['type'][_0xe9c1('0x41')]};});_0x3682b5[_0xe9c1('0x42')]=_[_0xe9c1('0x3e')](_0x2dd8a9,'name');_0x3682b5['query']=_['keys'](_0x25672e['query']);_0x3682b5['filters']=_[_0xe9c1('0x43')](_0x3682b5[_0xe9c1('0x42')],_0x3682b5['query']);_0x30a979[_0xe9c1('0x44')]=_[_0xe9c1('0x43')](_0x3682b5[_0xe9c1('0x42')],qs[_0xe9c1('0x45')](_0x25672e['query'][_0xe9c1('0x45')]));_0x30a979[_0xe9c1('0x44')]=_0x30a979[_0xe9c1('0x44')]['length']?_0x30a979[_0xe9c1('0x44')]:_0x3682b5[_0xe9c1('0x42')];if(!_0x25672e[_0xe9c1('0x46')]['hasOwnProperty'](_0xe9c1('0x47'))){_0x30a979[_0xe9c1('0x48')]=qs[_0xe9c1('0x48')](_0x25672e['query'][_0xe9c1('0x48')]);_0x30a979[_0xe9c1('0x49')]=qs[_0xe9c1('0x49')](_0x25672e[_0xe9c1('0x46')]['offset']);}_0x30a979[_0xe9c1('0x4a')]=qs[_0xe9c1('0x4b')](_0x25672e[_0xe9c1('0x46')]['sort']);_0x30a979[_0xe9c1('0x4c')]=qs[_0xe9c1('0x4d')](_[_0xe9c1('0x4e')](_0x25672e[_0xe9c1('0x46')],_0x3682b5[_0xe9c1('0x4d')]),_0x2dd8a9);if(_0x25672e[_0xe9c1('0x46')][_0xe9c1('0x4f')]){_0x30a979[_0xe9c1('0x4c')]=_['merge'](_0x30a979[_0xe9c1('0x4c')],{'$or':_[_0xe9c1('0x3e')](_0x2dd8a9,function(_0xfbe921){if(_0xfbe921[_0xe9c1('0x50')]!=='VIRTUAL'){var _0x4e809b={};_0x4e809b[_0xfbe921[_0xe9c1('0x3b')]]={'$like':'%'+_0x25672e['query']['filter']+'%'};return _0x4e809b;}})});}_0x30a979=_[_0xe9c1('0x51')]({},_0x30a979,_0x25672e['options']);var _0x2bc3b2={'where':_0x30a979[_0xe9c1('0x4c')]};return db[_0xe9c1('0x52')][_0xe9c1('0x33')](_0x2bc3b2)[_0xe9c1('0x24')](function(_0x4fa08f){_0x2e3174[_0xe9c1('0x33')]=_0x4fa08f;if(_0x25672e[_0xe9c1('0x46')][_0xe9c1('0x53')]){_0x30a979[_0xe9c1('0x54')]=[{'all':!![]}];}return db[_0xe9c1('0x52')][_0xe9c1('0x55')](_0x30a979);})[_0xe9c1('0x24')](function(_0x2b13ac){_0x2e3174[_0xe9c1('0x56')]=_0x2b13ac;return _0x2e3174;})[_0xe9c1('0x24')](respondWithFilteredResult(_0x10b498,_0x30a979))[_0xe9c1('0x2e')](handleError(_0x10b498,null));};exports[_0xe9c1('0x57')]=function(_0x5292d3,_0x5b6fde){var _0x49076c={'raw':!![],'where':{'id':_0x5292d3[_0xe9c1('0x58')]['id']}},_0x19edf5={};_0x19edf5['model']=_[_0xe9c1('0x59')](db[_0xe9c1('0x52')][_0xe9c1('0x3f')]);_0x19edf5[_0xe9c1('0x46')]=_['keys'](_0x5292d3['query']);_0x19edf5[_0xe9c1('0x4d')]=_['intersection'](_0x19edf5[_0xe9c1('0x42')],_0x19edf5[_0xe9c1('0x46')]);_0x49076c['attributes']=_[_0xe9c1('0x43')](_0x19edf5[_0xe9c1('0x42')],qs[_0xe9c1('0x45')](_0x5292d3['query'][_0xe9c1('0x45')]));_0x49076c['attributes']=_0x49076c[_0xe9c1('0x44')][_0xe9c1('0x5a')]?_0x49076c[_0xe9c1('0x44')]:_0x19edf5[_0xe9c1('0x42')];if(_0x5292d3['query'][_0xe9c1('0x53')]){_0x49076c[_0xe9c1('0x54')]=[{'all':!![]}];}_0x49076c=_['merge']({},_0x49076c,_0x5292d3[_0xe9c1('0x5b')]);return db['ChatQueue']['find'](_0x49076c)[_0xe9c1('0x24')](handleEntityNotFound(_0x5b6fde,null))['then'](respondWithResult(_0x5b6fde,null))['catch'](handleError(_0x5b6fde,null));};exports[_0xe9c1('0x5c')]=function(_0xc93244,_0x1d4195){return db['ChatQueue'][_0xe9c1('0x5c')](_0xc93244[_0xe9c1('0x5d')],{})['then'](function(_0xc7b7e0){var _0x371577=_0xc93244[_0xe9c1('0x5e')]['get']({'plain':!![]});if(!_0x371577)throw new Error(_0xe9c1('0x5f'));if(_0x371577[_0xe9c1('0x60')]===_0xe9c1('0x5e')){var _0x1a871d=_0xc7b7e0[_0xe9c1('0x39')]({'plain':!![]});var _0x479bc9='ChatQueues';return db['UserProfileSection'][_0xe9c1('0x61')]({'where':{'name':_0x479bc9,'userProfileId':_0x371577[_0xe9c1('0x62')]},'raw':!![]})[_0xe9c1('0x24')](function(_0x4cf5a6){if(_0x4cf5a6&&_0x4cf5a6[_0xe9c1('0x63')]===0x0){return db[_0xe9c1('0x64')][_0xe9c1('0x5c')]({'name':_0x1a871d['name'],'resourceId':_0x1a871d['id'],'type':_0x4cf5a6[_0xe9c1('0x3b')],'sectionId':_0x4cf5a6['id']},{})[_0xe9c1('0x24')](function(){return _0xc7b7e0;});}else{return _0xc7b7e0;}})['catch'](function(_0x5a10bd){logger[_0xe9c1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a10bd);throw _0x5a10bd;});}return _0xc7b7e0;})[_0xe9c1('0x24')](respondWithResult(_0x1d4195,0xc9))[_0xe9c1('0x2e')](handleError(_0x1d4195,null));};exports[_0xe9c1('0x37')]=function(_0x4f7d30,_0x3b86aa){if(_0x4f7d30['body']['id']){delete _0x4f7d30['body']['id'];}return db[_0xe9c1('0x52')][_0xe9c1('0x61')]({'where':{'id':_0x4f7d30[_0xe9c1('0x58')]['id']}})['then'](handleEntityNotFound(_0x3b86aa,null))[_0xe9c1('0x24')](saveUpdates(_0x4f7d30[_0xe9c1('0x5d')],null))['then'](respondWithResult(_0x3b86aa,null))['catch'](handleError(_0x3b86aa,null));};exports[_0xe9c1('0x38')]=function(_0x4f1c91,_0x1ddbb4){return db[_0xe9c1('0x52')]['find']({'where':{'id':_0x4f1c91['params']['id']}})[_0xe9c1('0x24')](handleEntityNotFound(_0x1ddbb4,null))['then'](removeEntity(_0x1ddbb4,null))[_0xe9c1('0x2e')](handleError(_0x1ddbb4,null));};exports[_0xe9c1('0x65')]=function(_0x304b32,_0x4d6d09){return db['ChatQueue'][_0xe9c1('0x65')]()['then'](respondWithResult(_0x4d6d09,null))[_0xe9c1('0x2e')](handleError(_0x4d6d09,null));};exports['getMembers']=function(_0x59d4fb,_0x36e0b1,_0x18dd3b){var _0x50dabe={'raw':!![],'where':{}},_0x130c72={},_0x129284;return db[_0xe9c1('0x52')][_0xe9c1('0x66')]({'where':{'id':_0x59d4fb['params']['id']}})[_0xe9c1('0x24')](handleEntityNotFound(_0x36e0b1,null))[_0xe9c1('0x24')](function(_0x1547e3){if(_0x1547e3){_0x129284=_0x1547e3[_0xe9c1('0x39')]({'plain':!![]});_0x130c72[_0xe9c1('0x42')]=_[_0xe9c1('0x59')](db[_0xe9c1('0x67')][_0xe9c1('0x3f')]);_0x130c72[_0xe9c1('0x46')]=_['keys'](_0x59d4fb['query']);_0x130c72['filters']=_[_0xe9c1('0x43')](_0x130c72[_0xe9c1('0x42')],_0x130c72['query']);_0x50dabe[_0xe9c1('0x44')]=_[_0xe9c1('0x43')](_0x130c72[_0xe9c1('0x42')],qs[_0xe9c1('0x45')](_0x59d4fb[_0xe9c1('0x46')][_0xe9c1('0x45')]));_0x50dabe[_0xe9c1('0x44')]=_0x50dabe[_0xe9c1('0x44')]['length']?_0x50dabe[_0xe9c1('0x44')]:_0x130c72['model'];if(!_0x59d4fb[_0xe9c1('0x46')][_0xe9c1('0x68')]('nolimit')){_0x50dabe['limit']=qs[_0xe9c1('0x48')](_0x59d4fb[_0xe9c1('0x46')][_0xe9c1('0x48')]);_0x50dabe[_0xe9c1('0x49')]=qs['offset'](_0x59d4fb['query'][_0xe9c1('0x49')]);}_0x50dabe[_0xe9c1('0x4a')]=qs[_0xe9c1('0x4b')](_0x59d4fb[_0xe9c1('0x46')]['sort']);_0x50dabe[_0xe9c1('0x4c')]=qs['filters'](_['pick'](_0x59d4fb[_0xe9c1('0x46')],_0x130c72['filters']));_0x50dabe[_0xe9c1('0x4c')][_0xe9c1('0x69')]=_0x1547e3['id'];if(_0x59d4fb[_0xe9c1('0x46')]['filter']){_0x50dabe[_0xe9c1('0x4c')]=_[_0xe9c1('0x51')](_0x50dabe['where'],{'$or':_['map'](_0x50dabe[_0xe9c1('0x44')],function(_0x2555e3){var _0x411977={};_0x411977[_0x2555e3]={'$like':'%'+_0x59d4fb[_0xe9c1('0x46')]['filter']+'%'};return _0x411977;})});}_0x50dabe=_[_0xe9c1('0x51')]({},_0x50dabe,_0x59d4fb[_0xe9c1('0x5b')]);return db['UserChatQueue'][_0xe9c1('0x55')](_0x50dabe);}})['then'](function(_0x3cbd81){if(_0x3cbd81){return db[_0xe9c1('0x6a')][_0xe9c1('0x6b')]({'where':{'id':_[_0xe9c1('0x3e')](_0x3cbd81,_0xe9c1('0x6c')),'role':_0xe9c1('0x6d')},'attributes':['id',_0xe9c1('0x3b'),_0xe9c1('0x6e'),_0xe9c1('0x6f'),_0xe9c1('0x70')]});}})['then'](function(_0x4b4b1f){if(_0x4b4b1f){return{'count':_0x4b4b1f[_0xe9c1('0x33')],'rows':_[_0xe9c1('0x3e')](_0x4b4b1f[_0xe9c1('0x56')],function(_0xaeaa7d){return{'membername':_0xaeaa7d['name'],'UserId':_0xaeaa7d['id'],'queue_name':_0x129284[_0xe9c1('0x3b')],'ChatQueueId':_0x129284['id'],'interface':util[_0xe9c1('0x71')](_0xe9c1('0x72'),_0xe9c1('0x73'),_0xaeaa7d[_0xe9c1('0x3b')]),'penalty':0x0,'paused':_0xaeaa7d[_0xe9c1('0x6e')],'createdAt':_0xaeaa7d['createdAt'],'updatedAt':_0xaeaa7d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe9c1('0x24')](respondWithFilteredResult(_0x36e0b1,_0x50dabe))[_0xe9c1('0x2e')](handleError(_0x36e0b1,null));};exports[_0xe9c1('0x74')]=function(_0x497bc0,_0x41f551,_0x5898d8){var _0x5e70da={};var _0x3fd8a2={};var _0x515171;var _0x18c11e;return db[_0xe9c1('0x52')][_0xe9c1('0x66')]({'where':{'id':_0x497bc0['params']['id']}})[_0xe9c1('0x24')](handleEntityNotFound(_0x41f551,null))[_0xe9c1('0x24')](function(_0x549a6d){if(_0x549a6d){_0x515171=_0x549a6d;_0x3fd8a2[_0xe9c1('0x42')]=_[_0xe9c1('0x59')](db[_0xe9c1('0x75')]['rawAttributes']);_0x3fd8a2[_0xe9c1('0x46')]=_[_0xe9c1('0x59')](_0x497bc0[_0xe9c1('0x46')]);_0x3fd8a2[_0xe9c1('0x4d')]=_[_0xe9c1('0x43')](_0x3fd8a2[_0xe9c1('0x42')],_0x3fd8a2[_0xe9c1('0x46')]);_0x5e70da[_0xe9c1('0x44')]=_[_0xe9c1('0x43')](_0x3fd8a2[_0xe9c1('0x42')],qs['fields'](_0x497bc0['query']['fields']));_0x5e70da[_0xe9c1('0x44')]=_0x5e70da[_0xe9c1('0x44')][_0xe9c1('0x5a')]?_0x5e70da['attributes']:_0x3fd8a2[_0xe9c1('0x42')];_0x5e70da['order']=qs['sort'](_0x497bc0[_0xe9c1('0x46')][_0xe9c1('0x4b')]);_0x5e70da[_0xe9c1('0x4c')]=qs[_0xe9c1('0x4d')](_[_0xe9c1('0x4e')](_0x497bc0[_0xe9c1('0x46')],_0x3fd8a2['filters']));if(_0x497bc0[_0xe9c1('0x46')][_0xe9c1('0x4f')]){_0x5e70da['where']=_[_0xe9c1('0x51')](_0x5e70da[_0xe9c1('0x4c')],{'$or':_[_0xe9c1('0x3e')](_0x5e70da[_0xe9c1('0x44')],function(_0x1f124e){var _0x7b58c4={};_0x7b58c4[_0x1f124e]={'$like':'%'+_0x497bc0[_0xe9c1('0x46')][_0xe9c1('0x4f')]+'%'};return _0x7b58c4;})});}_0x5e70da=_[_0xe9c1('0x51')]({},_0x5e70da,_0x497bc0[_0xe9c1('0x5b')]);return _0x515171[_0xe9c1('0x74')](_0x5e70da);}})[_0xe9c1('0x24')](function(_0x4aa166){if(_0x4aa166){_0x18c11e=_0x4aa166['length'];if(!_0x497bc0[_0xe9c1('0x46')]['hasOwnProperty'](_0xe9c1('0x47'))){_0x5e70da[_0xe9c1('0x48')]=qs[_0xe9c1('0x48')](_0x497bc0[_0xe9c1('0x46')]['limit']);_0x5e70da['offset']=qs[_0xe9c1('0x49')](_0x497bc0['query']['offset']);}return _0x515171[_0xe9c1('0x74')](_0x5e70da);}})[_0xe9c1('0x24')](function(_0x5bff0d){if(_0x5bff0d){return _0x5bff0d?{'count':_0x18c11e,'rows':_0x5bff0d}:null;}})[_0xe9c1('0x24')](respondWithResult(_0x41f551,null))[_0xe9c1('0x2e')](handleError(_0x41f551,null));};exports[_0xe9c1('0x76')]=function(_0x1c8550,_0x247af9,_0x1e9cc3){var _0x4f79de=_0x1c8550[_0xe9c1('0x5d')][_0xe9c1('0x77')];return db[_0xe9c1('0x75')][_0xe9c1('0x55')]({'where':{'id':_0x4f79de},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe9c1('0x78'),'attributes':['id',_0xe9c1('0x3b'),_0xe9c1('0x79'),_0xe9c1('0x7a'),_0xe9c1('0x7b')],'raw':!![]}]})[_0xe9c1('0x24')](function(_0xf176db){if(_0xf176db){var _0x2f8cc2=_[_0xe9c1('0x7c')](_0xf176db,function(_0x14d66c){var _0x1c5134=_0x14d66c[_0xe9c1('0x39')]({'plain':!![]});return _0x1c5134[_0xe9c1('0x78')];});return db[_0xe9c1('0x52')][_0xe9c1('0x61')]({'where':{'id':_0x1c8550[_0xe9c1('0x58')]['id']}})[_0xe9c1('0x24')](function(_0x2b624f){return db[_0xe9c1('0x7d')]['transaction'](function(_0x5070bf){return _0x2b624f[_0xe9c1('0x76')](_0x4f79de,{'transaction':_0x5070bf})[_0xe9c1('0x24')](function(){return BPromise[_0xe9c1('0x7e')](_0x2f8cc2,function(_0xc0292d){return db['UserChatQueue'][_0xe9c1('0x7f')]({'where':{'UserId':_0xc0292d['id'],'ChatQueueId':_0x1c8550[_0xe9c1('0x58')]['id']},'transaction':_0x5070bf});});})[_0xe9c1('0x24')](function(){_0x2f8cc2[_0xe9c1('0x80')](function(_0x38d6fc){socket[_0xe9c1('0x81')](_0xe9c1('0x82'),{'UserId':_0x38d6fc['id'],'ChatQueueId':_0x2b624f['id']});});});});});}})['then'](respondWithStatusCode(_0x247af9,null))[_0xe9c1('0x2e')](handleError(_0x247af9,null));};exports[_0xe9c1('0x83')]=function(_0x416090,_0x3a2e47,_0x36cd24){return db[_0xe9c1('0x75')][_0xe9c1('0x55')]({'where':{'id':_0x416090[_0xe9c1('0x46')][_0xe9c1('0x77')]},'attributes':['id'],'include':[{'model':db[_0xe9c1('0x6a')],'as':_0xe9c1('0x78'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3a2e47,null))[_0xe9c1('0x24')](function(_0x1e656a){var _0x1931d5=_[_0xe9c1('0x3e')](_0x1e656a,'id');var _0x415d0d=[];var _0x448456=[];var _0x27212d=squel['select']();_0x27212d[_0xe9c1('0x84')](_0xe9c1('0x85'))[_0xe9c1('0x86')](_0xe9c1('0x87'),'tq')[_0xe9c1('0x88')](_0xe9c1('0x89'),'ut',_0xe9c1('0x8a'))[_0xe9c1('0x4c')](_0xe9c1('0x8b'),_0x416090[_0xe9c1('0x58')]['id']);for(var _0x5f55f4=0x0;_0x5f55f4<_0x1e656a[_0xe9c1('0x5a')];_0x5f55f4+=0x1){let _0x595edb=_0x1e656a[_0x5f55f4];for(var _0x3ddc98=0x0;_0x3ddc98<_0x595edb['Agents']['length'];_0x3ddc98+=0x1){let _0x465ce9=_0x595edb[_0xe9c1('0x78')][_0x3ddc98];var _0x47ea30=_0x27212d[_0xe9c1('0x8c')]();_0x47ea30['where'](_0xe9c1('0x8d'),_0x465ce9['id']);_0x448456[_0xe9c1('0x8e')](db[_0xe9c1('0x7d')]['query'](_0x47ea30[_0xe9c1('0x8f')](),{'type':db[_0xe9c1('0x7d')][_0xe9c1('0x90')]['SELECT']})['then'](function(_0x56aa49){if(_0x56aa49['length']===0x1){return _0x465ce9['id'];}else{var _0x1c2871=_['every'](_[_0xe9c1('0x3e')](_0x56aa49,'TeamId'),function(_0xdaaf68){return _[_0xe9c1('0x91')](_0x1931d5,_0xdaaf68);});if(_0x1c2871){return _0x465ce9['id'];}}}));}}return BPromise[_0xe9c1('0x92')](_0x448456)[_0xe9c1('0x24')](function(_0x2d28dc){_0x415d0d=_(_0x415d0d)[_0xe9c1('0x93')](_0x2d28dc)[_0xe9c1('0x94')]()[_0xe9c1('0x95')]();return db[_0xe9c1('0x52')][_0xe9c1('0x61')]({'where':{'id':_0x416090[_0xe9c1('0x58')]['id']}})[_0xe9c1('0x24')](function(_0x4268fc){return db[_0xe9c1('0x7d')][_0xe9c1('0x96')](function(_0x500513){return _0x4268fc['removeTeams'](_0x416090[_0xe9c1('0x46')][_0xe9c1('0x77')],{'transaction':_0x500513})['then'](function(){if(!_[_0xe9c1('0x97')](_0x415d0d)){return _0x4268fc[_0xe9c1('0x98')](_0x415d0d,{'transaction':_0x500513});}})[_0xe9c1('0x24')](function(){_0x415d0d['forEach'](function(_0x2cdc19){socket[_0xe9c1('0x81')](_0xe9c1('0x99'),{'UserId':_0x2cdc19,'ChatQueueId':_0x4268fc['id']});});});});});});})['then'](respondWithStatusCode(_0x3a2e47,null))['catch'](handleError(_0x3a2e47,null));};exports[_0xe9c1('0x9a')]=function(_0x677e51,_0x1e664d,_0x4c6de0){return db[_0xe9c1('0x52')]['find']({'where':{'id':_0x677e51['params']['id']}})[_0xe9c1('0x24')](handleEntityNotFound(_0x1e664d,null))[_0xe9c1('0x24')](function(_0x273a99){if(_0x273a99){return _0x273a99[_0xe9c1('0x9a')](_0x677e51['body'][_0xe9c1('0x77')],_[_0xe9c1('0x9b')](_0x677e51[_0xe9c1('0x5d')],[_0xe9c1('0x77'),'id'])||{})[_0xe9c1('0x9c')](function(_0x14e87d){for(var _0x4cbf25=0x0;_0x4cbf25<_0x677e51[_0xe9c1('0x5d')][_0xe9c1('0x77')][_0xe9c1('0x5a')];_0x4cbf25+=0x1){socket['emit'](_0xe9c1('0x82'),{'UserId':_0x677e51[_0xe9c1('0x5d')][_0xe9c1('0x77')][_0x4cbf25],'ChatQueueId':_0x677e51['params']['id']});}return _0x14e87d;});}})[_0xe9c1('0x24')](respondWithResult(_0x1e664d,null))[_0xe9c1('0x2e')](handleError(_0x1e664d,null));};exports['removeAgents']=function(_0x151d6e,_0x13fd16,_0x38c256){return db[_0xe9c1('0x52')][_0xe9c1('0x61')]({'where':{'id':_0x151d6e[_0xe9c1('0x58')]['id']}})['then'](handleEntityNotFound(_0x13fd16,null))[_0xe9c1('0x24')](function(_0xe9c684){if(_0xe9c684){return _0xe9c684[_0xe9c1('0x98')](_0x151d6e[_0xe9c1('0x46')][_0xe9c1('0x77')])[_0xe9c1('0x24')](function(){if(_['isArray'](_0x151d6e['query'][_0xe9c1('0x77')])){for(var _0x28fb4a=0x0;_0x28fb4a<_0x151d6e['query']['ids']['length'];_0x28fb4a+=0x1){socket['emit'](_0xe9c1('0x99'),{'UserId':Number(_0x151d6e['query'][_0xe9c1('0x77')][_0x28fb4a]),'ChatQueueId':Number(_0x151d6e[_0xe9c1('0x58')]['id'])});}}else{socket[_0xe9c1('0x81')](_0xe9c1('0x99'),{'UserId':Number(_0x151d6e[_0xe9c1('0x46')]['ids']),'ChatQueueId':Number(_0x151d6e[_0xe9c1('0x58')]['id'])});}});}})[_0xe9c1('0x24')](respondWithStatusCode(_0x13fd16,null))['catch'](handleError(_0x13fd16,null));};exports[_0xe9c1('0x9d')]=function(_0x477d15,_0x4d6ac3,_0x54533a){var _0xde8806={};var _0x1a1513={};var _0x4558f5;var _0x288c03;return db[_0xe9c1('0x52')]['findOne']({'where':{'id':_0x477d15[_0xe9c1('0x58')]['id']}})[_0xe9c1('0x24')](handleEntityNotFound(_0x4d6ac3,null))['then'](function(_0x4d56ef){if(_0x4d56ef){_0x4558f5=_0x4d56ef;_0x1a1513[_0xe9c1('0x42')]=_['keys'](db[_0xe9c1('0x6a')][_0xe9c1('0x3f')]);_0x1a1513[_0xe9c1('0x46')]=_['keys'](_0x477d15[_0xe9c1('0x46')]);_0x1a1513[_0xe9c1('0x4d')]=_['intersection'](_0x1a1513[_0xe9c1('0x42')],_0x1a1513[_0xe9c1('0x46')]);_0xde8806[_0xe9c1('0x44')]=_[_0xe9c1('0x43')](_0x1a1513[_0xe9c1('0x42')],qs[_0xe9c1('0x45')](_0x477d15[_0xe9c1('0x46')][_0xe9c1('0x45')]));_0xde8806[_0xe9c1('0x44')]=_0xde8806[_0xe9c1('0x44')][_0xe9c1('0x5a')]?_0xde8806[_0xe9c1('0x44')]:_0x1a1513[_0xe9c1('0x42')];_0xde8806[_0xe9c1('0x4a')]=qs['sort'](_0x477d15[_0xe9c1('0x46')]['sort']);_0xde8806['where']=qs[_0xe9c1('0x4d')](_[_0xe9c1('0x4e')](_0x477d15[_0xe9c1('0x46')],_0x1a1513['filters']));if(_0x477d15[_0xe9c1('0x46')][_0xe9c1('0x4f')]){_0xde8806[_0xe9c1('0x4c')]=_['merge'](_0xde8806[_0xe9c1('0x4c')],{'$or':_['map'](_0xde8806[_0xe9c1('0x44')],function(_0x4702db){var _0x55b576={};_0x55b576[_0x4702db]={'$like':'%'+_0x477d15[_0xe9c1('0x46')][_0xe9c1('0x4f')]+'%'};return _0x55b576;})});}_0xde8806=_[_0xe9c1('0x51')]({},_0xde8806,_0x477d15[_0xe9c1('0x5b')]);return _0x4558f5[_0xe9c1('0x9d')](_0xde8806);}})[_0xe9c1('0x24')](function(_0x177344){if(_0x177344){_0x288c03=_0x177344[_0xe9c1('0x5a')];if(!_0x477d15[_0xe9c1('0x46')][_0xe9c1('0x68')](_0xe9c1('0x47'))){_0xde8806[_0xe9c1('0x48')]=qs['limit'](_0x477d15[_0xe9c1('0x46')][_0xe9c1('0x48')]);_0xde8806['offset']=qs[_0xe9c1('0x49')](_0x477d15[_0xe9c1('0x46')][_0xe9c1('0x49')]);}return _0x4558f5[_0xe9c1('0x9d')](_0xde8806);}})[_0xe9c1('0x24')](function(_0x325914){if(_0x325914){return _0x325914?{'count':_0x288c03,'rows':_0x325914}:null;}})[_0xe9c1('0x24')](respondWithResult(_0x4d6ac3,null))[_0xe9c1('0x2e')](handleError(_0x4d6ac3,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c55549d..753ef3c 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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x20ec3d,_0x2c3c3b){var _0x5a275f=function(_0x72fb86){while(--_0x72fb86){_0x20ec3d['push'](_0x20ec3d['shift']());}};_0x5a275f(++_0x2c3c3b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2f7023,_0x1aa399){_0x2f7023=_0x2f7023-0x0;var _0x2f5e4e=_0x0b0e[_0x2f7023];return _0x2f5e4e;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('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(_0x22e3aa,_0x33b640){var _0x1ea668=function(_0x384351){while(--_0x384351){_0x22e3aa['push'](_0x22e3aa['shift']());}};_0x1ea668(++_0x33b640);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9bef6d,_0x16775b){_0x9bef6d=_0x9bef6d-0x0;var _0x300f83=_0x5f2f[_0x9bef6d];return _0x300f83;};'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 b41a309..cdb17d7 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 _0xd62d=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd62d,0x1af));var _0xdd62=function(_0x22c8c2,_0x18cc2e){_0x22c8c2=_0x22c8c2-0x0;var _0x3b7f6e=_0xd62d[_0x22c8c2];return _0x3b7f6e;};'use strict';var _=require(_0xdd62('0x0'));var util=require(_0xdd62('0x1'));var logger=require('../../config/logger')(_0xdd62('0x2'));var moment=require(_0xdd62('0x3'));var BPromise=require(_0xdd62('0x4'));var rp=require(_0xdd62('0x5'));var fs=require('fs');var path=require(_0xdd62('0x6'));var rimraf=require(_0xdd62('0x7'));var config=require(_0xdd62('0x8'));var attributes=require(_0xdd62('0x9'));module['exports']=function(_0x24e6d6,_0x5a3de1){return _0x24e6d6[_0xdd62('0xa')](_0xdd62('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f13=['api','moment','request-promise','path','rimraf','./chatQueue.attributes','ChatQueue','lodash','util','../../config/logger'];(function(_0x43910b,_0x7cca32){var _0x3d7e89=function(_0xa93b88){while(--_0xa93b88){_0x43910b['push'](_0x43910b['shift']());}};_0x3d7e89(++_0x7cca32);}(_0x8f13,0x165));var _0x38f1=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x8f13[_0x564821];return _0x2b604d;};'use strict';var _=require(_0x38f1('0x0'));var util=require(_0x38f1('0x1'));var logger=require(_0x38f1('0x2'))(_0x38f1('0x3'));var moment=require(_0x38f1('0x4'));var BPromise=require('bluebird');var rp=require(_0x38f1('0x5'));var fs=require('fs');var path=require(_0x38f1('0x6'));var rimraf=require(_0x38f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x38f1('0x8'));module['exports']=function(_0x2af5e7,_0x18351e){return _0x2af5e7['define'](_0x38f1('0x9'),attributes,{'tableName':'chat_queues','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 04e73f3..9e8e841 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 _0x5867=['jayson/promise','client','http','defaults','redis','localhost','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2bb448,_0x22b8b8){var _0x3adc95=function(_0xae78c8){while(--_0xae78c8){_0x2bb448['push'](_0x2bb448['shift']());}};_0x3adc95(++_0x22b8b8);}(_0x5867,0x1e2));var _0x7586=function(_0x42ea0a,_0x211485){_0x42ea0a=_0x42ea0a-0x0;var _0x358c8e=_0x5867[_0x42ea0a];return _0x358c8e;};'use strict';var _=require(_0x7586('0x0'));var util=require(_0x7586('0x1'));var moment=require(_0x7586('0x2'));var BPromise=require(_0x7586('0x3'));var rs=require(_0x7586('0x4'));var fs=require('fs');var Redis=require(_0x7586('0x5'));var db=require(_0x7586('0x6'))['db'];var utils=require(_0x7586('0x7'));var logger=require(_0x7586('0x8'))('rpc');var config=require(_0x7586('0x9'));var jayson=require(_0x7586('0xa'));var client=jayson[_0x7586('0xb')][_0x7586('0xc')]({'port':0x232a});config['redis']=_[_0x7586('0xd')](config[_0x7586('0xe')],{'host':_0x7586('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7586('0xe')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x490973,_0x186fee,_0x12ecad){return new BPromise(function(_0x8387b3,_0x41ff1c){return client[_0x7586('0x10')](_0x490973,_0x12ecad)['then'](function(_0x435fa4){logger['info'](_0x7586('0x11'),_0x186fee,_0x7586('0x12'));logger[_0x7586('0x13')](_0x7586('0x14'),_0x186fee,_0x7586('0x12'),JSON[_0x7586('0x15')](_0x435fa4));if(_0x435fa4[_0x7586('0x16')]){if(_0x435fa4[_0x7586('0x16')][_0x7586('0x17')]===0x1f4){logger[_0x7586('0x16')](_0x7586('0x11'),_0x186fee,_0x435fa4['error'][_0x7586('0x18')]);return _0x41ff1c(_0x435fa4[_0x7586('0x16')][_0x7586('0x18')]);}logger[_0x7586('0x16')](_0x7586('0x11'),_0x186fee,_0x435fa4[_0x7586('0x16')][_0x7586('0x18')]);return _0x8387b3(_0x435fa4['error'][_0x7586('0x18')]);}else{logger[_0x7586('0x19')]('ChatQueue,\x20%s,\x20%s',_0x186fee,_0x7586('0x12'));_0x8387b3(_0x435fa4['result'][_0x7586('0x18')]);}})[_0x7586('0x1a')](function(_0x3137b1){logger[_0x7586('0x16')](_0x7586('0x11'),_0x186fee,_0x3137b1);_0x41ff1c(_0x3137b1);});});}exports[_0x7586('0x1b')]=function(_0x1cea96){var _0x30fa77=this;return new Promise(function(_0x26b7be,_0x169589){return db[_0x7586('0x1c')][_0x7586('0x1d')]({'raw':_0x1cea96[_0x7586('0x1e')]?_0x1cea96['options'][_0x7586('0x1f')]===undefined?!![]:![]:!![],'where':_0x1cea96[_0x7586('0x1e')]?_0x1cea96[_0x7586('0x1e')][_0x7586('0x20')]||null:null,'attributes':_0x1cea96['options']?_0x1cea96[_0x7586('0x1e')][_0x7586('0x21')]||null:null,'limit':_0x1cea96['options']?_0x1cea96[_0x7586('0x1e')][_0x7586('0x22')]||null:null,'include':_0x1cea96[_0x7586('0x1e')]?_0x1cea96['options'][_0x7586('0x23')]?_[_0x7586('0x24')](_0x1cea96[_0x7586('0x1e')][_0x7586('0x23')],function(_0x428178){return{'model':db[_0x428178[_0x7586('0x25')]],'as':_0x428178['as'],'attributes':_0x428178['attributes'],'include':_0x428178['include']?_[_0x7586('0x24')](_0x428178['include'],function(_0x42e982){return{'model':db[_0x42e982[_0x7586('0x25')]],'as':_0x42e982['as'],'attributes':_0x42e982[_0x7586('0x21')],'include':_0x42e982[_0x7586('0x23')]?_[_0x7586('0x24')](_0x42e982[_0x7586('0x23')],function(_0x3b3a59){return{'model':db[_0x3b3a59['model']],'as':_0x3b3a59['as'],'attributes':_0x3b3a59['attributes']};}):[]};}):[]};}):[]:[]})[_0x7586('0x26')](function(_0x2605a1){logger[_0x7586('0x19')](_0x7586('0x1b'),_0x1cea96);logger[_0x7586('0x13')](_0x7586('0x1b'),_0x1cea96,JSON[_0x7586('0x15')](_0x2605a1));_0x26b7be(_0x2605a1);})['catch'](function(_0x236bbf){logger[_0x7586('0x16')]('GetChatQueue',_0x236bbf[_0x7586('0x18')],_0x1cea96);_0x169589(_0x30fa77[_0x7586('0x16')](0x1f4,_0x236bbf['message']));});});};exports[_0x7586('0x27')]=function(_0x23663d){var _0x3990fe=this;return new Promise(function(_0x321267,_0x4494a4){return db[_0x7586('0x1c')][_0x7586('0x28')]({'raw':_0x23663d[_0x7586('0x1e')]?_0x23663d[_0x7586('0x1e')][_0x7586('0x1f')]===undefined?!![]:![]:!![],'where':_0x23663d['options']?_0x23663d[_0x7586('0x1e')]['where']||null:null,'attributes':_0x23663d[_0x7586('0x1e')]?_0x23663d[_0x7586('0x1e')][_0x7586('0x21')]||null:null,'include':_0x23663d[_0x7586('0x1e')]?_0x23663d[_0x7586('0x1e')][_0x7586('0x23')]?_['map'](_0x23663d[_0x7586('0x1e')][_0x7586('0x23')],function(_0x51e67d){return{'model':db[_0x51e67d[_0x7586('0x25')]],'as':_0x51e67d['as'],'attributes':_0x51e67d['attributes'],'include':_0x51e67d[_0x7586('0x23')]?_[_0x7586('0x24')](_0x51e67d['include'],function(_0x4fea6e){return{'model':db[_0x4fea6e[_0x7586('0x25')]],'as':_0x4fea6e['as'],'attributes':_0x4fea6e[_0x7586('0x21')],'include':_0x4fea6e['include']?_[_0x7586('0x24')](_0x4fea6e[_0x7586('0x23')],function(_0x1320e0){return{'model':db[_0x1320e0[_0x7586('0x25')]],'as':_0x1320e0['as'],'attributes':_0x1320e0[_0x7586('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7586('0x26')](function(_0x1053e4){logger[_0x7586('0x19')]('ShowChatQueue',_0x23663d);logger['debug'](_0x7586('0x27'),_0x23663d,JSON[_0x7586('0x15')](_0x1053e4));_0x321267(_0x1053e4);})[_0x7586('0x1a')](function(_0x4a7c2f){logger[_0x7586('0x16')](_0x7586('0x27'),_0x4a7c2f[_0x7586('0x18')],_0x23663d);_0x4494a4(_0x3990fe[_0x7586('0x16')](0x1f4,_0x4a7c2f[_0x7586('0x18')]));});});}; \ No newline at end of file +var _0xac8e=['bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','include','map','model','ShowChatQueue','find','raw','lodash','util','moment'];(function(_0x8de076,_0x360640){var _0x47a5c7=function(_0x2f3f8c){while(--_0x2f3f8c){_0x8de076['push'](_0x8de076['shift']());}};_0x47a5c7(++_0x360640);}(_0xac8e,0x19f));var _0xeac8=function(_0x259474,_0x3d1b62){_0x259474=_0x259474-0x0;var _0xc4c86b=_0xac8e[_0x259474];return _0xc4c86b;};'use strict';var _=require(_0xeac8('0x0'));var util=require(_0xeac8('0x1'));var moment=require(_0xeac8('0x2'));var BPromise=require(_0xeac8('0x3'));var rs=require(_0xeac8('0x4'));var fs=require('fs');var Redis=require(_0xeac8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeac8('0x6'));var logger=require('../../config/logger')(_0xeac8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeac8('0x8')][_0xeac8('0x9')]({'port':0x232a});config[_0xeac8('0xa')]=_['defaults'](config[_0xeac8('0xa')],{'host':_0xeac8('0xb'),'port':0x18eb});var socket=require(_0xeac8('0xc'))(new Redis(config[_0xeac8('0xa')]));require(_0xeac8('0xd'))['register'](socket);function respondWithRpcPromise(_0x277171,_0x3a0111,_0x4e9c3e){return new BPromise(function(_0x208e8b,_0x1ede71){return client[_0xeac8('0xe')](_0x277171,_0x4e9c3e)[_0xeac8('0xf')](function(_0x46db23){logger[_0xeac8('0x10')](_0xeac8('0x11'),_0x3a0111,_0xeac8('0x12'));logger[_0xeac8('0x13')](_0xeac8('0x14'),_0x3a0111,'request\x20sent',JSON[_0xeac8('0x15')](_0x46db23));if(_0x46db23[_0xeac8('0x16')]){if(_0x46db23[_0xeac8('0x16')][_0xeac8('0x17')]===0x1f4){logger[_0xeac8('0x16')](_0xeac8('0x11'),_0x3a0111,_0x46db23[_0xeac8('0x16')][_0xeac8('0x18')]);return _0x1ede71(_0x46db23['error'][_0xeac8('0x18')]);}logger['error'](_0xeac8('0x11'),_0x3a0111,_0x46db23[_0xeac8('0x16')][_0xeac8('0x18')]);return _0x208e8b(_0x46db23['error'][_0xeac8('0x18')]);}else{logger[_0xeac8('0x10')]('ChatQueue,\x20%s,\x20%s',_0x3a0111,'request\x20sent');_0x208e8b(_0x46db23['result'][_0xeac8('0x18')]);}})[_0xeac8('0x19')](function(_0x5c9eba){logger[_0xeac8('0x16')]('ChatQueue,\x20%s,\x20%s',_0x3a0111,_0x5c9eba);_0x1ede71(_0x5c9eba);});});}exports[_0xeac8('0x1a')]=function(_0x2c73a6){var _0x4acf0a=this;return new Promise(function(_0x4a40e3,_0x505d9f){return db[_0xeac8('0x1b')]['findAll']({'raw':_0x2c73a6[_0xeac8('0x1c')]?_0x2c73a6['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c73a6[_0xeac8('0x1c')]?_0x2c73a6[_0xeac8('0x1c')][_0xeac8('0x1d')]||null:null,'attributes':_0x2c73a6['options']?_0x2c73a6['options'][_0xeac8('0x1e')]||null:null,'limit':_0x2c73a6[_0xeac8('0x1c')]?_0x2c73a6[_0xeac8('0x1c')][_0xeac8('0x1f')]||null:null,'include':_0x2c73a6['options']?_0x2c73a6[_0xeac8('0x1c')][_0xeac8('0x20')]?_[_0xeac8('0x21')](_0x2c73a6[_0xeac8('0x1c')][_0xeac8('0x20')],function(_0x32077a){return{'model':db[_0x32077a[_0xeac8('0x22')]],'as':_0x32077a['as'],'attributes':_0x32077a[_0xeac8('0x1e')],'include':_0x32077a['include']?_[_0xeac8('0x21')](_0x32077a[_0xeac8('0x20')],function(_0x1edc7c){return{'model':db[_0x1edc7c[_0xeac8('0x22')]],'as':_0x1edc7c['as'],'attributes':_0x1edc7c[_0xeac8('0x1e')],'include':_0x1edc7c[_0xeac8('0x20')]?_[_0xeac8('0x21')](_0x1edc7c[_0xeac8('0x20')],function(_0x2e664c){return{'model':db[_0x2e664c[_0xeac8('0x22')]],'as':_0x2e664c['as'],'attributes':_0x2e664c[_0xeac8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xeac8('0xf')](function(_0x4de939){logger[_0xeac8('0x10')]('GetChatQueue',_0x2c73a6);logger[_0xeac8('0x13')]('GetChatQueue',_0x2c73a6,JSON[_0xeac8('0x15')](_0x4de939));_0x4a40e3(_0x4de939);})[_0xeac8('0x19')](function(_0x335c4d){logger['error'](_0xeac8('0x1a'),_0x335c4d[_0xeac8('0x18')],_0x2c73a6);_0x505d9f(_0x4acf0a[_0xeac8('0x16')](0x1f4,_0x335c4d[_0xeac8('0x18')]));});});};exports[_0xeac8('0x23')]=function(_0x758261){var _0x270135=this;return new Promise(function(_0x436938,_0x1a68c5){return db[_0xeac8('0x1b')][_0xeac8('0x24')]({'raw':_0x758261[_0xeac8('0x1c')]?_0x758261[_0xeac8('0x1c')][_0xeac8('0x25')]===undefined?!![]:![]:!![],'where':_0x758261['options']?_0x758261['options']['where']||null:null,'attributes':_0x758261[_0xeac8('0x1c')]?_0x758261[_0xeac8('0x1c')][_0xeac8('0x1e')]||null:null,'include':_0x758261[_0xeac8('0x1c')]?_0x758261[_0xeac8('0x1c')]['include']?_['map'](_0x758261['options'][_0xeac8('0x20')],function(_0x45beef){return{'model':db[_0x45beef[_0xeac8('0x22')]],'as':_0x45beef['as'],'attributes':_0x45beef[_0xeac8('0x1e')],'include':_0x45beef[_0xeac8('0x20')]?_[_0xeac8('0x21')](_0x45beef[_0xeac8('0x20')],function(_0xc0c68a){return{'model':db[_0xc0c68a['model']],'as':_0xc0c68a['as'],'attributes':_0xc0c68a[_0xeac8('0x1e')],'include':_0xc0c68a['include']?_['map'](_0xc0c68a[_0xeac8('0x20')],function(_0x5e8d5a){return{'model':db[_0x5e8d5a['model']],'as':_0x5e8d5a['as'],'attributes':_0x5e8d5a['attributes']};}):[]};}):[]};}):[]:[]})[_0xeac8('0xf')](function(_0x13f0e6){logger[_0xeac8('0x10')]('ShowChatQueue',_0x758261);logger[_0xeac8('0x13')](_0xeac8('0x23'),_0x758261,JSON[_0xeac8('0x15')](_0x13f0e6));_0x436938(_0x13f0e6);})['catch'](function(_0x26c83d){logger['error']('ShowChatQueue',_0x26c83d[_0xeac8('0x18')],_0x758261);_0x1a68c5(_0x270135[_0xeac8('0x16')](0x1f4,_0x26c83d[_0xeac8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 897abd6..82ffb0b 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 _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x2e0763,_0x37e6e4){var _0x189643=function(_0x20802b){while(--_0x20802b){_0x2e0763['push'](_0x2e0763['shift']());}};_0x189643(++_0x37e6e4);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d309c,_0x242f4c){_0x3d309c=_0x3d309c-0x0;var _0x241187=_0xb10b[_0x3d309c];return _0x241187;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xadb5=['update','emit','register','length','chatQueue:','save'];(function(_0xb2f630,_0x5830f5){var _0x4a60e9=function(_0x1945b6){while(--_0x1945b6){_0xb2f630['push'](_0xb2f630['shift']());}};_0x4a60e9(++_0x5830f5);}(_0xadb5,0xad));var _0x5adb=function(_0x177cda,_0x497c66){_0x177cda=_0x177cda-0x0;var _0x1ba60d=_0xadb5[_0x177cda];return _0x1ba60d;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatQueueEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatQueueEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 22ac09b..f7b267e 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 _0x8254=['/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x1418dd,_0x5ca105){var _0xe6580e=function(_0x1e15df){while(--_0x1e15df){_0x1418dd['push'](_0x1418dd['shift']());}};_0xe6580e(++_0x5ca105);}(_0x8254,0x1e6));var _0x4825=function(_0x5980ca,_0x51f56b){_0x5980ca=_0x5980ca-0x0;var _0x30afa0=_0x8254[_0x5980ca];return _0x30afa0;};'use strict';var multer=require(_0x4825('0x0'));var util=require(_0x4825('0x1'));var path=require(_0x4825('0x2'));var timeout=require('connect-timeout');var express=require(_0x4825('0x3'));var router=express[_0x4825('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4825('0x5'));var config=require(_0x4825('0x6'));var controller=require('./chatQueue.controller');router[_0x4825('0x7')]('/',auth[_0x4825('0x8')](),controller[_0x4825('0x9')]);router['get'](_0x4825('0xa'),auth[_0x4825('0x8')](),controller[_0x4825('0xb')]);router[_0x4825('0x7')](_0x4825('0xc'),auth[_0x4825('0x8')](),controller[_0x4825('0xd')]);router[_0x4825('0x7')](_0x4825('0xe'),auth[_0x4825('0x8')](),controller[_0x4825('0xf')]);router[_0x4825('0x7')](_0x4825('0x10'),auth[_0x4825('0x8')](),controller[_0x4825('0x11')]);router[_0x4825('0x7')](_0x4825('0x12'),auth[_0x4825('0x8')](),controller[_0x4825('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4825('0x14')](_0x4825('0x10'),auth['isAuthenticated'](),controller[_0x4825('0x15')]);router[_0x4825('0x14')](_0x4825('0x12'),auth[_0x4825('0x8')](),controller[_0x4825('0x16')]);router[_0x4825('0x17')](_0x4825('0xc'),auth[_0x4825('0x8')](),controller[_0x4825('0x18')]);router[_0x4825('0x19')](_0x4825('0xc'),auth['isAuthenticated'](),controller[_0x4825('0x1a')]);router[_0x4825('0x19')](_0x4825('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4825('0x19')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x4825('0x1b')]=router; \ No newline at end of file +var _0xb238=['path','express','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeAgents','util'];(function(_0x544e72,_0x2c64e8){var _0x3278a3=function(_0x429cf3){while(--_0x429cf3){_0x544e72['push'](_0x544e72['shift']());}};_0x3278a3(++_0x2c64e8);}(_0xb238,0x141));var _0x8b23=function(_0x327d6e,_0x5923bd){_0x327d6e=_0x327d6e-0x0;var _0x4dc5d3=_0xb238[_0x327d6e];return _0x4dc5d3;};'use strict';var multer=require('multer');var util=require(_0x8b23('0x0'));var path=require(_0x8b23('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b23('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0x8b23('0x3')]('/',auth[_0x8b23('0x4')](),controller['index']);router[_0x8b23('0x3')](_0x8b23('0x5'),auth[_0x8b23('0x4')](),controller[_0x8b23('0x6')]);router[_0x8b23('0x3')](_0x8b23('0x7'),auth[_0x8b23('0x4')](),controller[_0x8b23('0x8')]);router[_0x8b23('0x3')](_0x8b23('0x9'),auth['isAuthenticated'](),controller[_0x8b23('0xa')]);router['get'](_0x8b23('0xb'),auth[_0x8b23('0x4')](),controller[_0x8b23('0xc')]);router['get'](_0x8b23('0xd'),auth[_0x8b23('0x4')](),controller[_0x8b23('0xe')]);router['post']('/',auth[_0x8b23('0x4')](),controller[_0x8b23('0xf')]);router[_0x8b23('0x10')]('/:id/teams',auth[_0x8b23('0x4')](),controller['addTeams']);router[_0x8b23('0x10')]('/:id/users',auth[_0x8b23('0x4')](),controller[_0x8b23('0x11')]);router[_0x8b23('0x12')](_0x8b23('0x7'),auth['isAuthenticated'](),controller[_0x8b23('0x13')]);router[_0x8b23('0x14')](_0x8b23('0x7'),auth[_0x8b23('0x4')](),controller[_0x8b23('0x15')]);router[_0x8b23('0x14')](_0x8b23('0xb'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x8b23('0xd'),auth[_0x8b23('0x4')](),controller[_0x8b23('0x16')]);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 8088a7e..a6cf10c 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 _0x5b4c=['DATE','moment','sequelize','exports','STRING'];(function(_0x3ea9ad,_0x3d4d6c){var _0x520cf9=function(_0x564e12){while(--_0x564e12){_0x3ea9ad['push'](_0x3ea9ad['shift']());}};_0x520cf9(++_0x3d4d6c);}(_0x5b4c,0x13c));var _0xc5b4=function(_0x20cc54,_0x234400){_0x20cc54=_0x20cc54-0x0;var _0x43949f=_0x5b4c[_0x20cc54];return _0x43949f;};'use strict';var moment=require(_0xc5b4('0x0'));var Sequelize=require(_0xc5b4('0x1'));module[_0xc5b4('0x2')]={'uniqueid':{'type':Sequelize[_0xc5b4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc5b4('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc5b4('0x4')]},'exitAt':{'type':Sequelize[_0xc5b4('0x4')]},'reason':{'type':Sequelize[_0xc5b4('0x3')]}}; \ No newline at end of file +var _0xa406=['DATE','moment','exports','STRING'];(function(_0x1f15af,_0x4c8588){var _0x5672e9=function(_0x26d822){while(--_0x26d822){_0x1f15af['push'](_0x1f15af['shift']());}};_0x5672e9(++_0x4c8588);}(_0xa406,0xe5));var _0x6a40=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa406[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0x6a40('0x0'));var Sequelize=require('sequelize');module[_0x6a40('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6a40('0x2')]},'joinAt':{'type':Sequelize[_0x6a40('0x3')]},'leaveAt':{'type':Sequelize[_0x6a40('0x3')]},'acceptAt':{'type':Sequelize[_0x6a40('0x3')]},'exitAt':{'type':Sequelize[_0x6a40('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 387ce91..b8f8501 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 _0x757a=['count','findAll','rows','catch','params','keys','includeAll','include','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','VIRTUAL','options','ChatQueueReport'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x757a,0xde));var _0xa757=function(_0x13c8a6,_0x4d3d01){_0x13c8a6=_0x13c8a6-0x0;var _0x694e9b=_0x757a[_0x13c8a6];return _0x694e9b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');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('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56acfb,_0x4db68e){_0x4db68e=_0x4db68e||0xcc;return function(_0x421040){if(_0x421040){return _0x56acfb['sendStatus'](_0x4db68e);}return _0x56acfb['status'](_0x4db68e)[_0xa757('0x16')]();};}function respondWithResult(_0x513b1f,_0x481508){_0x481508=_0x481508||0xc8;return function(_0x32112b){if(_0x32112b){return _0x513b1f[_0xa757('0x17')](_0x481508)[_0xa757('0x18')](_0x32112b);}};}function respondWithFilteredResult(_0x4a0c38,_0x86abd){return function(_0x31cfd2){if(_0x31cfd2){var _0xf12b68=_0x31cfd2['count'],_0x2f7947=_0x86abd[_0xa757('0x19')],_0x185011=_0x86abd[_0xa757('0x19')]+_0x86abd[_0xa757('0x1a')],_0x3df1f9;if(_0x185011>=_0xf12b68){_0x185011=_0xf12b68;_0x3df1f9=0xc8;}else{_0x3df1f9=0xce;}_0x4a0c38['status'](_0x3df1f9);return _0x4a0c38['set'](_0xa757('0x1b'),_0x2f7947+'-'+_0x185011+'/'+_0xf12b68)[_0xa757('0x18')](_0x31cfd2);}return null;};}function patchUpdates(_0x1bd14c){return function(_0x340599){try{jsonpatch[_0xa757('0x1c')](_0x340599,_0x1bd14c,!![]);}catch(_0xe2d567){return BPromise['reject'](_0xe2d567);}return _0x340599[_0xa757('0x1d')]();};}function saveUpdates(_0x4fec52,_0x32c2a1){return function(_0x167640){if(_0x167640){return _0x167640[_0xa757('0x1e')](_0x4fec52)[_0xa757('0x1f')](function(_0x4d598c){return _0x4d598c;});}return null;};}function removeEntity(_0x5638c7,_0x40ec48){return function(_0x2159cf){if(_0x2159cf){return _0x2159cf[_0xa757('0x20')]()[_0xa757('0x1f')](function(){_0x5638c7[_0xa757('0x17')](0xcc)[_0xa757('0x16')]();});}};}function handleEntityNotFound(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(!_0x2bf276){_0x2ca10d['sendStatus'](0x194);}return _0x2bf276;};}function handleError(_0x3707c1,_0x59e9d4){_0x59e9d4=_0x59e9d4||0x1f4;return function(_0x422e9e){logger['error'](_0x422e9e[_0xa757('0x21')]);if(_0x422e9e[_0xa757('0x22')]){delete _0x422e9e[_0xa757('0x22')];}_0x3707c1['status'](_0x59e9d4)[_0xa757('0x23')](_0x422e9e);};}exports[_0xa757('0x24')]=function(_0x471e84,_0x3bf7f3){var _0x5b4779={},_0x449a7d={},_0x54263b={'count':0x0,'rows':[]};var _0x5a5664=_['map'](db['ChatQueueReport'][_0xa757('0x25')],function(_0x596ae2){return{'name':_0x596ae2[_0xa757('0x26')],'type':_0x596ae2[_0xa757('0x27')]['key']};});_0x449a7d[_0xa757('0x28')]=_['map'](_0x5a5664,_0xa757('0x22'));_0x449a7d[_0xa757('0x29')]=_['keys'](_0x471e84[_0xa757('0x29')]);_0x449a7d['filters']=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],_0x449a7d[_0xa757('0x29')]);_0x5b4779[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x471e84[_0xa757('0x29')][_0xa757('0x2c')]));_0x5b4779[_0xa757('0x2b')]=_0x5b4779[_0xa757('0x2b')][_0xa757('0x2d')]?_0x5b4779[_0xa757('0x2b')]:_0x449a7d[_0xa757('0x28')];if(!_0x471e84[_0xa757('0x29')][_0xa757('0x2e')](_0xa757('0x2f'))){_0x5b4779[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x471e84[_0xa757('0x29')][_0xa757('0x1a')]);_0x5b4779[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x471e84[_0xa757('0x29')]['offset']);}_0x5b4779[_0xa757('0x30')]=qs[_0xa757('0x31')](_0x471e84[_0xa757('0x29')][_0xa757('0x31')]);_0x5b4779[_0xa757('0x32')]=qs['filters'](_[_0xa757('0x33')](_0x471e84[_0xa757('0x29')],_0x449a7d[_0xa757('0x34')]),_0x5a5664);if(_0x471e84[_0xa757('0x29')][_0xa757('0x35')]){_0x5b4779[_0xa757('0x32')]=_['merge'](_0x5b4779[_0xa757('0x32')],{'$or':_[_0xa757('0x36')](_0x5a5664,function(_0x2cade7){if(_0x2cade7[_0xa757('0x27')]!==_0xa757('0x37')){var _0x111cfe={};_0x111cfe[_0x2cade7[_0xa757('0x22')]]={'$like':'%'+_0x471e84[_0xa757('0x29')][_0xa757('0x35')]+'%'};return _0x111cfe;}})});}_0x5b4779=_['merge']({},_0x5b4779,_0x471e84[_0xa757('0x38')]);var _0x34fba8={'where':_0x5b4779[_0xa757('0x32')]};return db[_0xa757('0x39')][_0xa757('0x3a')](_0x34fba8)[_0xa757('0x1f')](function(_0x501e26){_0x54263b[_0xa757('0x3a')]=_0x501e26;if(_0x471e84[_0xa757('0x29')]['includeAll']){_0x5b4779['include']=[{'all':!![]}];}return db[_0xa757('0x39')][_0xa757('0x3b')](_0x5b4779);})['then'](function(_0x51c3d1){_0x54263b[_0xa757('0x3c')]=_0x51c3d1;return _0x54263b;})[_0xa757('0x1f')](respondWithFilteredResult(_0x3bf7f3,_0x5b4779))[_0xa757('0x3d')](handleError(_0x3bf7f3,null));};exports['show']=function(_0x830dc4,_0x13a8f4){var _0x26802c={'raw':!![],'where':{'id':_0x830dc4[_0xa757('0x3e')]['id']}},_0x1ba399={};_0x1ba399['model']=_[_0xa757('0x3f')](db['ChatQueueReport']['rawAttributes']);_0x1ba399[_0xa757('0x29')]=_[_0xa757('0x3f')](_0x830dc4[_0xa757('0x29')]);_0x1ba399[_0xa757('0x34')]=_[_0xa757('0x2a')](_0x1ba399['model'],_0x1ba399['query']);_0x26802c[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x1ba399[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x830dc4[_0xa757('0x29')][_0xa757('0x2c')]));_0x26802c['attributes']=_0x26802c[_0xa757('0x2b')][_0xa757('0x2d')]?_0x26802c['attributes']:_0x1ba399[_0xa757('0x28')];if(_0x830dc4['query'][_0xa757('0x40')]){_0x26802c[_0xa757('0x41')]=[{'all':!![]}];}_0x26802c=_['merge']({},_0x26802c,_0x830dc4[_0xa757('0x38')]);return db[_0xa757('0x39')]['find'](_0x26802c)[_0xa757('0x1f')](handleEntityNotFound(_0x13a8f4,null))[_0xa757('0x1f')](respondWithResult(_0x13a8f4,null))[_0xa757('0x3d')](handleError(_0x13a8f4,null));};exports[_0xa757('0x42')]=function(_0x543b5b,_0x199dc9){return db[_0xa757('0x39')][_0xa757('0x42')](_0x543b5b[_0xa757('0x43')],{})['then'](respondWithResult(_0x199dc9,0xc9))[_0xa757('0x3d')](handleError(_0x199dc9,null));};exports['update']=function(_0x50c131,_0x2acf88){if(_0x50c131[_0xa757('0x43')]['id']){delete _0x50c131[_0xa757('0x43')]['id'];}return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x50c131['params']['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x2acf88,null))[_0xa757('0x1f')](saveUpdates(_0x50c131[_0xa757('0x43')],null))[_0xa757('0x1f')](respondWithResult(_0x2acf88,null))[_0xa757('0x3d')](handleError(_0x2acf88,null));};exports[_0xa757('0x20')]=function(_0x57bf73,_0x505cd){return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x57bf73[_0xa757('0x3e')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x505cd,null))[_0xa757('0x1f')](removeEntity(_0x505cd,null))[_0xa757('0x3d')](handleError(_0x505cd,null));};exports[_0xa757('0x45')]=function(_0x15bad7,_0x2c5b3c){return db[_0xa757('0x39')][_0xa757('0x45')]()[_0xa757('0x1f')](respondWithResult(_0x2c5b3c,null))[_0xa757('0x3d')](handleError(_0x2c5b3c,null));}; \ No newline at end of file +var _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','ChatQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0xe77019,_0x3d2f49){var _0x57ac4c=function(_0x2a8588){while(--_0x2a8588){_0xe77019['push'](_0xe77019['shift']());}};_0x57ac4c(++_0x3d2f49);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcb91[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['ChatQueueReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['ChatQueueReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['ChatQueueReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d883ff3..d9e97ab 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 _0x881c=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','define','report_chat_queue','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x881c,0xff));var _0xc881=function(_0x3d44ff,_0x5c4b9d){_0x3d44ff=_0x3d44ff-0x0;var _0x2435c8=_0x881c[_0x3d44ff];return _0x2435c8;};'use strict';var _=require(_0xc881('0x0'));var util=require(_0xc881('0x1'));var logger=require(_0xc881('0x2'))(_0xc881('0x3'));var moment=require(_0xc881('0x4'));var BPromise=require(_0xc881('0x5'));var rp=require(_0xc881('0x6'));var fs=require('fs');var path=require(_0xc881('0x7'));var rimraf=require(_0xc881('0x8'));var config=require(_0xc881('0x9'));var attributes=require(_0xc881('0xa'));module['exports']=function(_0x4aa0c9,_0x294d2e){return _0x4aa0c9[_0xc881('0xb')]('ChatQueueReport',attributes,{'tableName':_0xc881('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2606=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatQueueReport.attributes','exports','ChatQueueReport','report_chat_queue'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x2606,0x187));var _0x6260=function(_0x3dbae4,_0x2a0a5a){_0x3dbae4=_0x3dbae4-0x0;var _0x2cffe6=_0x2606[_0x3dbae4];return _0x2cffe6;};'use strict';var _=require(_0x6260('0x0'));var util=require(_0x6260('0x1'));var logger=require(_0x6260('0x2'))('api');var moment=require(_0x6260('0x3'));var BPromise=require(_0x6260('0x4'));var rp=require(_0x6260('0x5'));var fs=require('fs');var path=require(_0x6260('0x6'));var rimraf=require('rimraf');var config=require(_0x6260('0x7'));var attributes=require(_0x6260('0x8'));module[_0x6260('0x9')]=function(_0x4ca14,_0x12a5d0){return _0x4ca14['define'](_0x6260('0xa'),attributes,{'tableName':_0x6260('0xb'),'paranoid':![],'indexes':[{'name':_0x6260('0xc'),'fields':[_0x6260('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 9bf0290..f73d396 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 _0x7a73=['../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','info','debug','UpdateChatQueueReport','update','body','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x5ca969,_0x481949){var _0x2016e6=function(_0x203a39){while(--_0x203a39){_0x5ca969['push'](_0x5ca969['shift']());}};_0x2016e6(++_0x481949);}(_0x7a73,0xbf));var _0x37a7=function(_0x5c4d76,_0x2bfd16){_0x5c4d76=_0x5c4d76-0x0;var _0x145e4b=_0x7a73[_0x5c4d76];return _0x145e4b;};'use strict';var _=require(_0x37a7('0x0'));var util=require(_0x37a7('0x1'));var moment=require(_0x37a7('0x2'));var BPromise=require(_0x37a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37a7('0x4'));var db=require(_0x37a7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x37a7('0x6'))('rpc');var config=require(_0x37a7('0x7'));var jayson=require(_0x37a7('0x8'));var client=jayson[_0x37a7('0x9')][_0x37a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3997e3,_0x19dc1a,_0x4895aa){return new BPromise(function(_0x5f1302,_0x217f25){return client[_0x37a7('0xb')](_0x3997e3,_0x4895aa)[_0x37a7('0xc')](function(_0x4a421d){logger['info'](_0x37a7('0xd'),_0x19dc1a,'request\x20sent');logger['debug'](_0x37a7('0xe'),_0x19dc1a,_0x37a7('0xf'),JSON[_0x37a7('0x10')](_0x4a421d));if(_0x4a421d[_0x37a7('0x11')]){if(_0x4a421d[_0x37a7('0x11')]['code']===0x1f4){logger[_0x37a7('0x11')](_0x37a7('0xd'),_0x19dc1a,_0x4a421d[_0x37a7('0x11')]['message']);return _0x217f25(_0x4a421d[_0x37a7('0x11')][_0x37a7('0x12')]);}logger[_0x37a7('0x11')](_0x37a7('0xd'),_0x19dc1a,_0x4a421d[_0x37a7('0x11')][_0x37a7('0x12')]);return _0x5f1302(_0x4a421d['error']['message']);}else{logger['info'](_0x37a7('0xd'),_0x19dc1a,_0x37a7('0xf'));_0x5f1302(_0x4a421d[_0x37a7('0x13')]['message']);}})[_0x37a7('0x14')](function(_0x316bd6){logger[_0x37a7('0x11')](_0x37a7('0xd'),_0x19dc1a,_0x316bd6);_0x217f25(_0x316bd6);});});}exports[_0x37a7('0x15')]=function(_0x4c7904){var _0x1e8130=this;return new Promise(function(_0x46979c,_0x26a815){return db[_0x37a7('0x16')][_0x37a7('0x17')](_0x4c7904['body'],{'raw':_0x4c7904[_0x37a7('0x18')]?_0x4c7904['options'][_0x37a7('0x19')]===undefined?!![]:![]:!![]})[_0x37a7('0xc')](function(_0x425078){logger[_0x37a7('0x1a')]('CreateChatQueueReport',_0x4c7904);logger[_0x37a7('0x1b')](_0x37a7('0x15'),_0x4c7904,JSON[_0x37a7('0x10')](_0x425078));_0x46979c(_0x425078);})[_0x37a7('0x14')](function(_0x91ecab){logger[_0x37a7('0x11')]('CreateChatQueueReport',_0x91ecab[_0x37a7('0x12')],_0x4c7904);_0x26a815(_0x1e8130['error'](0x1f4,_0x91ecab[_0x37a7('0x12')]));});});};exports[_0x37a7('0x1c')]=function(_0x32d1ac){var _0x490a44=this;return new Promise(function(_0x4ab06c,_0x33076b){return db[_0x37a7('0x16')][_0x37a7('0x1d')](_0x32d1ac[_0x37a7('0x1e')],{'raw':_0x32d1ac[_0x37a7('0x18')]?_0x32d1ac[_0x37a7('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32d1ac[_0x37a7('0x18')]?_0x32d1ac[_0x37a7('0x18')][_0x37a7('0x1f')]||null:null,'attributes':_0x32d1ac[_0x37a7('0x18')]?_0x32d1ac['options']['attributes']||null:null,'limit':_0x32d1ac['options']?_0x32d1ac[_0x37a7('0x18')][_0x37a7('0x20')]||null:null})[_0x37a7('0xc')](function(_0x3ec0e5){logger['info'](_0x37a7('0x1c'),_0x32d1ac);logger[_0x37a7('0x1b')](_0x37a7('0x1c'),_0x32d1ac,JSON['stringify'](_0x3ec0e5));_0x4ab06c(_0x3ec0e5);})[_0x37a7('0x14')](function(_0x1d377c){logger[_0x37a7('0x11')](_0x37a7('0x1c'),_0x1d377c[_0x37a7('0x12')],_0x32d1ac);_0x33076b(_0x490a44[_0x37a7('0x11')](0x1f4,_0x1d377c[_0x37a7('0x12')]));});});}; \ No newline at end of file +var _0x10d7=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x575f22,_0x5685e6){var _0x12cfa6=function(_0x4a0cb3){while(--_0x4a0cb3){_0x575f22['push'](_0x575f22['shift']());}};_0x12cfa6(++_0x5685e6);}(_0x10d7,0xd1));var _0x710d=function(_0x1cf07e,_0x56e3c1){_0x1cf07e=_0x1cf07e-0x0;var _0x5a19b6=_0x10d7[_0x1cf07e];return _0x5a19b6;};'use strict';var _=require(_0x710d('0x0'));var util=require('util');var moment=require(_0x710d('0x1'));var BPromise=require(_0x710d('0x2'));var rs=require(_0x710d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x710d('0x4'))['db'];var utils=require(_0x710d('0x5'));var logger=require('../../config/logger')(_0x710d('0x6'));var config=require(_0x710d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x710d('0x8')][_0x710d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d242b,_0x61928a,_0x62cb40){return new BPromise(function(_0x80819a,_0x37b43b){return client['request'](_0x4d242b,_0x62cb40)[_0x710d('0xa')](function(_0x48108c){logger[_0x710d('0xb')](_0x710d('0xc'),_0x61928a,_0x710d('0xd'));logger[_0x710d('0xe')](_0x710d('0xf'),_0x61928a,'request\x20sent',JSON[_0x710d('0x10')](_0x48108c));if(_0x48108c['error']){if(_0x48108c[_0x710d('0x11')][_0x710d('0x12')]===0x1f4){logger[_0x710d('0x11')](_0x710d('0xc'),_0x61928a,_0x48108c[_0x710d('0x11')][_0x710d('0x13')]);return _0x37b43b(_0x48108c[_0x710d('0x11')][_0x710d('0x13')]);}logger[_0x710d('0x11')](_0x710d('0xc'),_0x61928a,_0x48108c[_0x710d('0x11')][_0x710d('0x13')]);return _0x80819a(_0x48108c[_0x710d('0x11')][_0x710d('0x13')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x61928a,'request\x20sent');_0x80819a(_0x48108c[_0x710d('0x14')]['message']);}})[_0x710d('0x15')](function(_0x6558bc){logger[_0x710d('0x11')](_0x710d('0xc'),_0x61928a,_0x6558bc);_0x37b43b(_0x6558bc);});});}exports[_0x710d('0x16')]=function(_0x436659){var _0x2f3dbc=this;return new Promise(function(_0x491c1d,_0x10d30a){return db[_0x710d('0x17')]['create'](_0x436659[_0x710d('0x18')],{'raw':_0x436659[_0x710d('0x19')]?_0x436659[_0x710d('0x19')][_0x710d('0x1a')]===undefined?!![]:![]:!![]})[_0x710d('0xa')](function(_0x3b779a){logger[_0x710d('0xb')](_0x710d('0x16'),_0x436659);logger[_0x710d('0xe')](_0x710d('0x16'),_0x436659,JSON[_0x710d('0x10')](_0x3b779a));_0x491c1d(_0x3b779a);})['catch'](function(_0x4eaaf5){logger[_0x710d('0x11')](_0x710d('0x16'),_0x4eaaf5[_0x710d('0x13')],_0x436659);_0x10d30a(_0x2f3dbc[_0x710d('0x11')](0x1f4,_0x4eaaf5['message']));});});};exports[_0x710d('0x1b')]=function(_0x3ad16a){var _0x5dea5e=this;return new Promise(function(_0x4751c4,_0x9e3cc5){return db[_0x710d('0x17')][_0x710d('0x1c')](_0x3ad16a[_0x710d('0x18')],{'raw':_0x3ad16a[_0x710d('0x19')]?_0x3ad16a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad16a[_0x710d('0x19')]?_0x3ad16a[_0x710d('0x19')][_0x710d('0x1d')]||null:null,'attributes':_0x3ad16a[_0x710d('0x19')]?_0x3ad16a[_0x710d('0x19')][_0x710d('0x1e')]||null:null,'limit':_0x3ad16a[_0x710d('0x19')]?_0x3ad16a[_0x710d('0x19')][_0x710d('0x1f')]||null:null})['then'](function(_0x4acce1){logger['info'](_0x710d('0x1b'),_0x3ad16a);logger[_0x710d('0xe')](_0x710d('0x1b'),_0x3ad16a,JSON[_0x710d('0x10')](_0x4acce1));_0x4751c4(_0x4acce1);})[_0x710d('0x15')](function(_0x18febb){logger[_0x710d('0x11')](_0x710d('0x1b'),_0x18febb[_0x710d('0x13')],_0x3ad16a);_0x9e3cc5(_0x5dea5e[_0x710d('0x11')](0x1f4,_0x18febb[_0x710d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6237e25..ea1c5fa 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 _0xd13f=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','destroy','exports','multer'];(function(_0x44f838,_0x4e5ce1){var _0x67626=function(_0x20c8cd){while(--_0x20c8cd){_0x44f838['push'](_0x44f838['shift']());}};_0x67626(++_0x4e5ce1);}(_0xd13f,0x1a8));var _0xfd13=function(_0x11f7ba,_0x327dde){_0x11f7ba=_0x11f7ba-0x0;var _0x3a1fc0=_0xd13f[_0x11f7ba];return _0x3a1fc0;};'use strict';var multer=require(_0xfd13('0x0'));var util=require(_0xfd13('0x1'));var path=require(_0xfd13('0x2'));var timeout=require(_0xfd13('0x3'));var express=require(_0xfd13('0x4'));var router=express['Router']();var auth=require(_0xfd13('0x5'));var interaction=require(_0xfd13('0x6'));var config=require(_0xfd13('0x7'));var controller=require(_0xfd13('0x8'));router[_0xfd13('0x9')]('/',auth[_0xfd13('0xa')](),controller['index']);router[_0xfd13('0x9')]('/describe',auth[_0xfd13('0xa')](),controller[_0xfd13('0xb')]);router[_0xfd13('0x9')](_0xfd13('0xc'),auth[_0xfd13('0xa')](),controller[_0xfd13('0xd')]);router[_0xfd13('0xe')]('/',auth[_0xfd13('0xa')](),controller['create']);router['put']('/:id',auth[_0xfd13('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfd13('0xf')]);module[_0xfd13('0x10')]=router; \ No newline at end of file +var _0x50c7=['describe','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x50c7,0xcf));var _0x750c=function(_0x1f8184,_0x3ca1ad){_0x1f8184=_0x1f8184-0x0;var _0x221e96=_0x50c7[_0x1f8184];return _0x221e96;};'use strict';var multer=require('multer');var util=require(_0x750c('0x0'));var path=require('path');var timeout=require(_0x750c('0x1'));var express=require(_0x750c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x750c('0x3'));var config=require(_0x750c('0x4'));var controller=require(_0x750c('0x5'));router[_0x750c('0x6')]('/',auth[_0x750c('0x7')](),controller[_0x750c('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x750c('0x9')]);router[_0x750c('0x6')](_0x750c('0xa'),auth[_0x750c('0x7')](),controller[_0x750c('0xb')]);router[_0x750c('0xc')]('/',auth[_0x750c('0x7')](),controller[_0x750c('0xd')]);router[_0x750c('0xe')](_0x750c('0xa'),auth[_0x750c('0x7')](),controller[_0x750c('0xf')]);router[_0x750c('0x10')]('/:id',auth[_0x750c('0x7')](),controller[_0x750c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 3eebfa2..6b6700b 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 _0x17b9=['agent','queue','DATE','NOW','moment','sequelize','STRING','ENUM','account'];(function(_0x42cb3c,_0x3fea07){var _0x701d59=function(_0x183f1d){while(--_0x183f1d){_0x42cb3c['push'](_0x42cb3c['shift']());}};_0x701d59(++_0x3fea07);}(_0x17b9,0x187));var _0x917b=function(_0x258296,_0x55a47f){_0x258296=_0x258296-0x0;var _0x337392=_0x17b9[_0x258296];return _0x337392;};'use strict';var moment=require(_0x917b('0x0'));var Sequelize=require(_0x917b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x917b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x917b('0x3')](_0x917b('0x4'),_0x917b('0x5'),_0x917b('0x6')),'allowNull':![],'defaultValue':_0x917b('0x6')},'transferredAt':{'type':Sequelize[_0x917b('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x917b('0x8')]}}; \ No newline at end of file +var _0xb949=['DATE','NOW','moment','sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x3ca76a,_0x37afc8){var _0x495767=function(_0xc45fc6){while(--_0xc45fc6){_0x3ca76a['push'](_0x3ca76a['shift']());}};_0x495767(++_0x37afc8);}(_0xb949,0x134));var _0x9b94=function(_0x342533,_0xe39194){_0x342533=_0x342533-0x0;var _0x2a743c=_0xb949[_0x342533];return _0x2a743c;};'use strict';var moment=require(_0x9b94('0x0'));var Sequelize=require(_0x9b94('0x1'));module[_0x9b94('0x2')]={'uniqueid':{'type':Sequelize[_0x9b94('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9b94('0x4')]('account',_0x9b94('0x5'),_0x9b94('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x9b94('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x9b94('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index f4ad647..1dd6e00 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 _0x173c=['create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../mysqldb','status','end','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','offset','order','sort','where','filter','merge','VIRTUAL','options','ChatTransferReport','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x49034c,_0x34bbd2){var _0x2b9cb1=function(_0x2044d3){while(--_0x2044d3){_0x49034c['push'](_0x49034c['shift']());}};_0x2b9cb1(++_0x34bbd2);}(_0x173c,0x18f));var _0xc173=function(_0x2239ca,_0x269d51){_0x2239ca=_0x2239ca-0x0;var _0x2162a6=_0x173c[_0x2239ca];return _0x2162a6;};'use strict';var pdf=require(_0xc173('0x0'));var emlformat=require(_0xc173('0x1'));var rimraf=require(_0xc173('0x2'));var zipdir=require(_0xc173('0x3'));var jsonpatch=require(_0xc173('0x4'));var rp=require(_0xc173('0x5'));var moment=require(_0xc173('0x6'));var BPromise=require(_0xc173('0x7'));var Mustache=require(_0xc173('0x8'));var util=require(_0xc173('0x9'));var path=require(_0xc173('0xa'));var sox=require(_0xc173('0xb'));var csv=require(_0xc173('0xc'));var ejs=require(_0xc173('0xd'));var fs=require('fs');var _=require(_0xc173('0xe'));var squel=require(_0xc173('0xf'));var crypto=require('crypto');var jsforce=require(_0xc173('0x10'));var deskjs=require(_0xc173('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc173('0x12'));var Papa=require(_0xc173('0x13'));var Redis=require(_0xc173('0x14'));var authService=require(_0xc173('0x15'));var qs=require(_0xc173('0x16'));var as=require(_0xc173('0x17'));var hardwareService=require(_0xc173('0x18'));var logger=require(_0xc173('0x19'))(_0xc173('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc173('0x1b'))['db'];function respondWithStatusCode(_0x52f864,_0x3cdaa5){_0x3cdaa5=_0x3cdaa5||0xcc;return function(_0x30ceb1){if(_0x30ceb1){return _0x52f864['sendStatus'](_0x3cdaa5);}return _0x52f864[_0xc173('0x1c')](_0x3cdaa5)[_0xc173('0x1d')]();};}function respondWithResult(_0x228d3c,_0x525eb0){_0x525eb0=_0x525eb0||0xc8;return function(_0x3c3254){if(_0x3c3254){return _0x228d3c[_0xc173('0x1c')](_0x525eb0)['json'](_0x3c3254);}};}function respondWithFilteredResult(_0x225312,_0xa4557d){return function(_0x324562){if(_0x324562){var _0x1d8bc9=_0x324562['count'],_0xaf441b=_0xa4557d['offset'],_0x58defe=_0xa4557d['offset']+_0xa4557d[_0xc173('0x1e')],_0x4128d2;if(_0x58defe>=_0x1d8bc9){_0x58defe=_0x1d8bc9;_0x4128d2=0xc8;}else{_0x4128d2=0xce;}_0x225312[_0xc173('0x1c')](_0x4128d2);return _0x225312[_0xc173('0x1f')](_0xc173('0x20'),_0xaf441b+'-'+_0x58defe+'/'+_0x1d8bc9)[_0xc173('0x21')](_0x324562);}return null;};}function patchUpdates(_0x270950){return function(_0x7e2f){try{jsonpatch[_0xc173('0x22')](_0x7e2f,_0x270950,!![]);}catch(_0x538e3f){return BPromise[_0xc173('0x23')](_0x538e3f);}return _0x7e2f[_0xc173('0x24')]();};}function saveUpdates(_0x30ee74,_0x569210){return function(_0x5345a6){if(_0x5345a6){return _0x5345a6[_0xc173('0x25')](_0x30ee74)[_0xc173('0x26')](function(_0x4e656b){return _0x4e656b;});}return null;};}function removeEntity(_0x5adb94,_0x27b59e){return function(_0xff768e){if(_0xff768e){return _0xff768e['destroy']()[_0xc173('0x26')](function(){_0x5adb94['status'](0xcc)[_0xc173('0x1d')]();});}};}function handleEntityNotFound(_0x24ba72,_0x3877db){return function(_0x590a49){if(!_0x590a49){_0x24ba72['sendStatus'](0x194);}return _0x590a49;};}function handleError(_0x55ad9d,_0x25fb25){_0x25fb25=_0x25fb25||0x1f4;return function(_0xc851b1){logger[_0xc173('0x27')](_0xc851b1[_0xc173('0x28')]);if(_0xc851b1[_0xc173('0x29')]){delete _0xc851b1[_0xc173('0x29')];}_0x55ad9d['status'](_0x25fb25)[_0xc173('0x2a')](_0xc851b1);};}exports[_0xc173('0x2b')]=function(_0x2b70ce,_0x54af0c){var _0x4992b9={},_0x2477a6={},_0x4cb8e8={'count':0x0,'rows':[]};var _0x3ac725=_[_0xc173('0x2c')](db['ChatTransferReport']['rawAttributes'],function(_0x52bb15){return{'name':_0x52bb15[_0xc173('0x2d')],'type':_0x52bb15[_0xc173('0x2e')][_0xc173('0x2f')]};});_0x2477a6[_0xc173('0x30')]=_[_0xc173('0x2c')](_0x3ac725,_0xc173('0x29'));_0x2477a6[_0xc173('0x31')]=_[_0xc173('0x32')](_0x2b70ce[_0xc173('0x31')]);_0x2477a6[_0xc173('0x33')]=_[_0xc173('0x34')](_0x2477a6['model'],_0x2477a6[_0xc173('0x31')]);_0x4992b9[_0xc173('0x35')]=_['intersection'](_0x2477a6[_0xc173('0x30')],qs[_0xc173('0x36')](_0x2b70ce[_0xc173('0x31')][_0xc173('0x36')]));_0x4992b9['attributes']=_0x4992b9['attributes'][_0xc173('0x37')]?_0x4992b9[_0xc173('0x35')]:_0x2477a6[_0xc173('0x30')];if(!_0x2b70ce[_0xc173('0x31')]['hasOwnProperty']('nolimit')){_0x4992b9['limit']=qs['limit'](_0x2b70ce[_0xc173('0x31')]['limit']);_0x4992b9[_0xc173('0x38')]=qs[_0xc173('0x38')](_0x2b70ce[_0xc173('0x31')][_0xc173('0x38')]);}_0x4992b9[_0xc173('0x39')]=qs[_0xc173('0x3a')](_0x2b70ce['query']['sort']);_0x4992b9[_0xc173('0x3b')]=qs[_0xc173('0x33')](_['pick'](_0x2b70ce[_0xc173('0x31')],_0x2477a6[_0xc173('0x33')]),_0x3ac725);if(_0x2b70ce[_0xc173('0x31')][_0xc173('0x3c')]){_0x4992b9['where']=_[_0xc173('0x3d')](_0x4992b9[_0xc173('0x3b')],{'$or':_[_0xc173('0x2c')](_0x3ac725,function(_0xebee64){if(_0xebee64['type']!==_0xc173('0x3e')){var _0x2d1292={};_0x2d1292[_0xebee64[_0xc173('0x29')]]={'$like':'%'+_0x2b70ce['query'][_0xc173('0x3c')]+'%'};return _0x2d1292;}})});}_0x4992b9=_['merge']({},_0x4992b9,_0x2b70ce[_0xc173('0x3f')]);var _0x6e0677={'where':_0x4992b9['where']};return db[_0xc173('0x40')]['count'](_0x6e0677)[_0xc173('0x26')](function(_0x15a6a7){_0x4cb8e8[_0xc173('0x41')]=_0x15a6a7;if(_0x2b70ce['query'][_0xc173('0x42')]){_0x4992b9[_0xc173('0x43')]=[{'all':!![]}];}return db[_0xc173('0x40')][_0xc173('0x44')](_0x4992b9);})[_0xc173('0x26')](function(_0x44d7ff){_0x4cb8e8[_0xc173('0x45')]=_0x44d7ff;return _0x4cb8e8;})[_0xc173('0x26')](respondWithFilteredResult(_0x54af0c,_0x4992b9))[_0xc173('0x46')](handleError(_0x54af0c,null));};exports[_0xc173('0x47')]=function(_0x73339a,_0x302001){var _0xdfdedd={'raw':!![],'where':{'id':_0x73339a[_0xc173('0x48')]['id']}},_0x2c3437={};_0x2c3437[_0xc173('0x30')]=_['keys'](db[_0xc173('0x40')][_0xc173('0x49')]);_0x2c3437[_0xc173('0x31')]=_[_0xc173('0x32')](_0x73339a['query']);_0x2c3437[_0xc173('0x33')]=_[_0xc173('0x34')](_0x2c3437[_0xc173('0x30')],_0x2c3437[_0xc173('0x31')]);_0xdfdedd[_0xc173('0x35')]=_['intersection'](_0x2c3437['model'],qs['fields'](_0x73339a['query'][_0xc173('0x36')]));_0xdfdedd[_0xc173('0x35')]=_0xdfdedd[_0xc173('0x35')][_0xc173('0x37')]?_0xdfdedd[_0xc173('0x35')]:_0x2c3437[_0xc173('0x30')];if(_0x73339a['query']['includeAll']){_0xdfdedd['include']=[{'all':!![]}];}_0xdfdedd=_[_0xc173('0x3d')]({},_0xdfdedd,_0x73339a[_0xc173('0x3f')]);return db[_0xc173('0x40')][_0xc173('0x4a')](_0xdfdedd)[_0xc173('0x26')](handleEntityNotFound(_0x302001,null))[_0xc173('0x26')](respondWithResult(_0x302001,null))[_0xc173('0x46')](handleError(_0x302001,null));};exports[_0xc173('0x4b')]=function(_0x1de0ac,_0x3e0e9f){return db[_0xc173('0x40')]['create'](_0x1de0ac[_0xc173('0x4c')],{})[_0xc173('0x26')](respondWithResult(_0x3e0e9f,0xc9))[_0xc173('0x46')](handleError(_0x3e0e9f,null));};exports[_0xc173('0x25')]=function(_0x2e9414,_0x11c6d9){if(_0x2e9414[_0xc173('0x4c')]['id']){delete _0x2e9414['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x2e9414['params']['id']}})[_0xc173('0x26')](handleEntityNotFound(_0x11c6d9,null))['then'](saveUpdates(_0x2e9414['body'],null))[_0xc173('0x26')](respondWithResult(_0x11c6d9,null))[_0xc173('0x46')](handleError(_0x11c6d9,null));};exports[_0xc173('0x4d')]=function(_0x3da669,_0x57f4bc){return db[_0xc173('0x40')][_0xc173('0x4a')]({'where':{'id':_0x3da669[_0xc173('0x48')]['id']}})[_0xc173('0x26')](handleEntityNotFound(_0x57f4bc,null))[_0xc173('0x26')](removeEntity(_0x57f4bc,null))['catch'](handleError(_0x57f4bc,null));};exports[_0xc173('0x4e')]=function(_0x551c43,_0x367cec){return db['ChatTransferReport']['describe']()[_0xc173('0x26')](respondWithResult(_0x367cec,null))[_0xc173('0x46')](handleError(_0x367cec,null));}; \ No newline at end of file +var _0x611a=['save','update','then','destroy','stack','name','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','intersection','catch','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply'];(function(_0x34c834,_0x24c07d){var _0x10c25b=function(_0x32d032){while(--_0x32d032){_0x34c834['push'](_0x34c834['shift']());}};_0x10c25b(++_0x24c07d);}(_0x611a,0x176));var _0xa611=function(_0x21fb9c,_0x3a8fcb){_0x21fb9c=_0x21fb9c-0x0;var _0xc8341d=_0x611a[_0x21fb9c];return _0xc8341d;};'use strict';var pdf=require(_0xa611('0x0'));var emlformat=require(_0xa611('0x1'));var rimraf=require(_0xa611('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa611('0x3'));var moment=require(_0xa611('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa611('0x5'));var util=require('util');var path=require(_0xa611('0x6'));var sox=require(_0xa611('0x7'));var csv=require('to-csv');var ejs=require(_0xa611('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa611('0x9'));var crypto=require(_0xa611('0xa'));var jsforce=require(_0xa611('0xb'));var deskjs=require(_0xa611('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa611('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa611('0xe'));var qs=require(_0xa611('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa611('0x10'))(_0xa611('0x11'));var utils=require(_0xa611('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35d0ca,_0x2240f5){_0x2240f5=_0x2240f5||0xcc;return function(_0x328c08){if(_0x328c08){return _0x35d0ca[_0xa611('0x13')](_0x2240f5);}return _0x35d0ca[_0xa611('0x14')](_0x2240f5)[_0xa611('0x15')]();};}function respondWithResult(_0x51702f,_0x8838fe){_0x8838fe=_0x8838fe||0xc8;return function(_0x257a2c){if(_0x257a2c){return _0x51702f[_0xa611('0x14')](_0x8838fe)[_0xa611('0x16')](_0x257a2c);}};}function respondWithFilteredResult(_0x51e06e,_0x15ad1d){return function(_0x4e4e88){if(_0x4e4e88){var _0x1e5012=_0x4e4e88[_0xa611('0x17')],_0x3d1b49=_0x15ad1d[_0xa611('0x18')],_0x5e435c=_0x15ad1d[_0xa611('0x18')]+_0x15ad1d[_0xa611('0x19')],_0x391d8b;if(_0x5e435c>=_0x1e5012){_0x5e435c=_0x1e5012;_0x391d8b=0xc8;}else{_0x391d8b=0xce;}_0x51e06e['status'](_0x391d8b);return _0x51e06e['set'](_0xa611('0x1a'),_0x3d1b49+'-'+_0x5e435c+'/'+_0x1e5012)[_0xa611('0x16')](_0x4e4e88);}return null;};}function patchUpdates(_0x32f0c1){return function(_0x28450a){try{jsonpatch[_0xa611('0x1b')](_0x28450a,_0x32f0c1,!![]);}catch(_0x4bcaa4){return BPromise['reject'](_0x4bcaa4);}return _0x28450a[_0xa611('0x1c')]();};}function saveUpdates(_0x45fa8f,_0x42ad71){return function(_0x47ef3b){if(_0x47ef3b){return _0x47ef3b[_0xa611('0x1d')](_0x45fa8f)[_0xa611('0x1e')](function(_0x2f010d){return _0x2f010d;});}return null;};}function removeEntity(_0x1ce92a,_0x162441){return function(_0x1d7c59){if(_0x1d7c59){return _0x1d7c59[_0xa611('0x1f')]()[_0xa611('0x1e')](function(){_0x1ce92a[_0xa611('0x14')](0xcc)[_0xa611('0x15')]();});}};}function handleEntityNotFound(_0x55b9d4,_0x26da3a){return function(_0x526d60){if(!_0x526d60){_0x55b9d4[_0xa611('0x13')](0x194);}return _0x526d60;};}function handleError(_0x333309,_0x2e8ff4){_0x2e8ff4=_0x2e8ff4||0x1f4;return function(_0x39d5bd){logger['error'](_0x39d5bd[_0xa611('0x20')]);if(_0x39d5bd[_0xa611('0x21')]){delete _0x39d5bd['name'];}_0x333309[_0xa611('0x14')](_0x2e8ff4)['send'](_0x39d5bd);};}exports['index']=function(_0x222d57,_0x1e25d1){var _0x4ac7d4={},_0x120753={},_0x302ad3={'count':0x0,'rows':[]};var _0xecd725=_[_0xa611('0x22')](db[_0xa611('0x23')][_0xa611('0x24')],function(_0x22a85a){return{'name':_0x22a85a[_0xa611('0x25')],'type':_0x22a85a[_0xa611('0x26')][_0xa611('0x27')]};});_0x120753[_0xa611('0x28')]=_['map'](_0xecd725,_0xa611('0x21'));_0x120753['query']=_['keys'](_0x222d57[_0xa611('0x29')]);_0x120753[_0xa611('0x2a')]=_['intersection'](_0x120753[_0xa611('0x28')],_0x120753['query']);_0x4ac7d4[_0xa611('0x2b')]=_['intersection'](_0x120753['model'],qs[_0xa611('0x2c')](_0x222d57[_0xa611('0x29')][_0xa611('0x2c')]));_0x4ac7d4[_0xa611('0x2b')]=_0x4ac7d4[_0xa611('0x2b')][_0xa611('0x2d')]?_0x4ac7d4[_0xa611('0x2b')]:_0x120753[_0xa611('0x28')];if(!_0x222d57[_0xa611('0x29')][_0xa611('0x2e')]('nolimit')){_0x4ac7d4[_0xa611('0x19')]=qs[_0xa611('0x19')](_0x222d57[_0xa611('0x29')]['limit']);_0x4ac7d4[_0xa611('0x18')]=qs[_0xa611('0x18')](_0x222d57[_0xa611('0x29')][_0xa611('0x18')]);}_0x4ac7d4[_0xa611('0x2f')]=qs[_0xa611('0x30')](_0x222d57[_0xa611('0x29')][_0xa611('0x30')]);_0x4ac7d4[_0xa611('0x31')]=qs[_0xa611('0x2a')](_[_0xa611('0x32')](_0x222d57[_0xa611('0x29')],_0x120753[_0xa611('0x2a')]),_0xecd725);if(_0x222d57['query'][_0xa611('0x33')]){_0x4ac7d4[_0xa611('0x31')]=_[_0xa611('0x34')](_0x4ac7d4[_0xa611('0x31')],{'$or':_[_0xa611('0x22')](_0xecd725,function(_0x282f81){if(_0x282f81[_0xa611('0x26')]!==_0xa611('0x35')){var _0xe0adfb={};_0xe0adfb[_0x282f81['name']]={'$like':'%'+_0x222d57[_0xa611('0x29')]['filter']+'%'};return _0xe0adfb;}})});}_0x4ac7d4=_[_0xa611('0x34')]({},_0x4ac7d4,_0x222d57[_0xa611('0x36')]);var _0x4ef5eb={'where':_0x4ac7d4[_0xa611('0x31')]};return db['ChatTransferReport'][_0xa611('0x17')](_0x4ef5eb)[_0xa611('0x1e')](function(_0x4c3256){_0x302ad3[_0xa611('0x17')]=_0x4c3256;if(_0x222d57['query'][_0xa611('0x37')]){_0x4ac7d4[_0xa611('0x38')]=[{'all':!![]}];}return db[_0xa611('0x23')]['findAll'](_0x4ac7d4);})[_0xa611('0x1e')](function(_0x31fb4c){_0x302ad3[_0xa611('0x39')]=_0x31fb4c;return _0x302ad3;})[_0xa611('0x1e')](respondWithFilteredResult(_0x1e25d1,_0x4ac7d4))['catch'](handleError(_0x1e25d1,null));};exports[_0xa611('0x3a')]=function(_0x2bd688,_0x19c654){var _0x4051e1={'raw':!![],'where':{'id':_0x2bd688[_0xa611('0x3b')]['id']}},_0x1f53e8={};_0x1f53e8['model']=_['keys'](db[_0xa611('0x23')][_0xa611('0x24')]);_0x1f53e8[_0xa611('0x29')]=_[_0xa611('0x3c')](_0x2bd688['query']);_0x1f53e8[_0xa611('0x2a')]=_[_0xa611('0x3d')](_0x1f53e8[_0xa611('0x28')],_0x1f53e8['query']);_0x4051e1[_0xa611('0x2b')]=_[_0xa611('0x3d')](_0x1f53e8['model'],qs[_0xa611('0x2c')](_0x2bd688[_0xa611('0x29')][_0xa611('0x2c')]));_0x4051e1['attributes']=_0x4051e1[_0xa611('0x2b')][_0xa611('0x2d')]?_0x4051e1[_0xa611('0x2b')]:_0x1f53e8['model'];if(_0x2bd688[_0xa611('0x29')]['includeAll']){_0x4051e1[_0xa611('0x38')]=[{'all':!![]}];}_0x4051e1=_['merge']({},_0x4051e1,_0x2bd688[_0xa611('0x36')]);return db[_0xa611('0x23')]['find'](_0x4051e1)[_0xa611('0x1e')](handleEntityNotFound(_0x19c654,null))['then'](respondWithResult(_0x19c654,null))[_0xa611('0x3e')](handleError(_0x19c654,null));};exports['create']=function(_0xe43847,_0x2111ae){return db[_0xa611('0x23')][_0xa611('0x3f')](_0xe43847['body'],{})[_0xa611('0x1e')](respondWithResult(_0x2111ae,0xc9))['catch'](handleError(_0x2111ae,null));};exports[_0xa611('0x1d')]=function(_0x2e67de,_0x230b19){if(_0x2e67de[_0xa611('0x40')]['id']){delete _0x2e67de['body']['id'];}return db[_0xa611('0x23')][_0xa611('0x41')]({'where':{'id':_0x2e67de['params']['id']}})[_0xa611('0x1e')](handleEntityNotFound(_0x230b19,null))['then'](saveUpdates(_0x2e67de['body'],null))['then'](respondWithResult(_0x230b19,null))[_0xa611('0x3e')](handleError(_0x230b19,null));};exports[_0xa611('0x1f')]=function(_0x5ef220,_0x6025d){return db[_0xa611('0x23')][_0xa611('0x41')]({'where':{'id':_0x5ef220['params']['id']}})[_0xa611('0x1e')](handleEntityNotFound(_0x6025d,null))[_0xa611('0x1e')](removeEntity(_0x6025d,null))[_0xa611('0x3e')](handleError(_0x6025d,null));};exports[_0xa611('0x42')]=function(_0x323030,_0x115cef){return db[_0xa611('0x23')][_0xa611('0x42')]()['then'](respondWithResult(_0x115cef,null))[_0xa611('0x3e')](handleError(_0x115cef,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 39bf2d0..f8cdbac 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 _0x07bd=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x07bd,0xea));var _0xd07b=function(_0x2104b4,_0x14e9c7){_0x2104b4=_0x2104b4-0x0;var _0x270cd5=_0x07bd[_0x2104b4];return _0x270cd5;};'use strict';var _=require(_0xd07b('0x0'));var util=require(_0xd07b('0x1'));var logger=require(_0xd07b('0x2'))(_0xd07b('0x3'));var moment=require(_0xd07b('0x4'));var BPromise=require('bluebird');var rp=require(_0xd07b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd07b('0x6'));var config=require('../../config/environment');var attributes=require(_0xd07b('0x7'));module[_0xd07b('0x8')]=function(_0x242abf,_0x188caa){return _0x242abf[_0xd07b('0x9')](_0xd07b('0xa'),attributes,{'tableName':_0xd07b('0xb'),'paranoid':![],'indexes':[{'name':_0xd07b('0xc'),'fields':[_0xd07b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad9a=['ChatTransferReport','report_chat_transfer','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x506a75,_0x5ec193){var _0x24fdd2=function(_0x387fdf){while(--_0x387fdf){_0x506a75['push'](_0x506a75['shift']());}};_0x24fdd2(++_0x5ec193);}(_0xad9a,0x92));var _0xaad9=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xad9a[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xaad9('0x0'));var util=require(_0xaad9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaad9('0x2'));var BPromise=require(_0xaad9('0x3'));var rp=require(_0xaad9('0x4'));var fs=require('fs');var path=require(_0xaad9('0x5'));var rimraf=require(_0xaad9('0x6'));var config=require(_0xaad9('0x7'));var attributes=require(_0xaad9('0x8'));module[_0xaad9('0x9')]=function(_0x5518cf,_0x807854){return _0x5518cf['define'](_0xaad9('0xa'),attributes,{'tableName':_0xaad9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9bbb921..bdf589e 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 _0x21a1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x2ab626,_0x4b0be4){var _0x55b333=function(_0x3f14d5){while(--_0x3f14d5){_0x2ab626['push'](_0x2ab626['shift']());}};_0x55b333(++_0x4b0be4);}(_0x21a1,0x1a7));var _0x121a=function(_0x56f526,_0x228db2){_0x56f526=_0x56f526-0x0;var _0x2b89de=_0x21a1[_0x56f526];return _0x2b89de;};'use strict';var _=require(_0x121a('0x0'));var util=require(_0x121a('0x1'));var moment=require(_0x121a('0x2'));var BPromise=require(_0x121a('0x3'));var rs=require(_0x121a('0x4'));var fs=require('fs');var Redis=require(_0x121a('0x5'));var db=require(_0x121a('0x6'))['db'];var utils=require(_0x121a('0x7'));var logger=require(_0x121a('0x8'))(_0x121a('0x9'));var config=require('../../config/environment');var jayson=require(_0x121a('0xa'));var client=jayson[_0x121a('0xb')][_0x121a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b9254,_0x27eec9,_0x1c9c84){return new BPromise(function(_0x2bb59b,_0x56fa04){return client[_0x121a('0xd')](_0x4b9254,_0x1c9c84)[_0x121a('0xe')](function(_0x1ead20){logger[_0x121a('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x27eec9,_0x121a('0x10'));logger['debug'](_0x121a('0x11'),_0x27eec9,_0x121a('0x10'),JSON[_0x121a('0x12')](_0x1ead20));if(_0x1ead20[_0x121a('0x13')]){if(_0x1ead20[_0x121a('0x13')][_0x121a('0x14')]===0x1f4){logger['error'](_0x121a('0x15'),_0x27eec9,_0x1ead20[_0x121a('0x13')][_0x121a('0x16')]);return _0x56fa04(_0x1ead20[_0x121a('0x13')]['message']);}logger[_0x121a('0x13')](_0x121a('0x15'),_0x27eec9,_0x1ead20[_0x121a('0x13')][_0x121a('0x16')]);return _0x2bb59b(_0x1ead20['error']['message']);}else{logger[_0x121a('0xf')](_0x121a('0x15'),_0x27eec9,_0x121a('0x10'));_0x2bb59b(_0x1ead20[_0x121a('0x17')]['message']);}})[_0x121a('0x18')](function(_0x1bf929){logger[_0x121a('0x13')](_0x121a('0x15'),_0x27eec9,_0x1bf929);_0x56fa04(_0x1bf929);});});} \ No newline at end of file +var _0x8ac0=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8ac0,0x9e));var _0x08ac=function(_0x1f5a3d,_0x30cf81){_0x1f5a3d=_0x1f5a3d-0x0;var _0x1bd786=_0x8ac0[_0x1f5a3d];return _0x1bd786;};'use strict';var _=require(_0x08ac('0x0'));var util=require(_0x08ac('0x1'));var moment=require(_0x08ac('0x2'));var BPromise=require(_0x08ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x08ac('0x5'))(_0x08ac('0x6'));var config=require(_0x08ac('0x7'));var jayson=require(_0x08ac('0x8'));var client=jayson[_0x08ac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5a4b,_0x50cca8,_0x12a264){return new BPromise(function(_0x18a477,_0x646245){return client['request'](_0x5c5a4b,_0x12a264)[_0x08ac('0xa')](function(_0x476cc4){logger[_0x08ac('0xb')](_0x08ac('0xc'),_0x50cca8,_0x08ac('0xd'));logger[_0x08ac('0xe')](_0x08ac('0xf'),_0x50cca8,_0x08ac('0xd'),JSON[_0x08ac('0x10')](_0x476cc4));if(_0x476cc4[_0x08ac('0x11')]){if(_0x476cc4[_0x08ac('0x11')][_0x08ac('0x12')]===0x1f4){logger[_0x08ac('0x11')](_0x08ac('0xc'),_0x50cca8,_0x476cc4[_0x08ac('0x11')][_0x08ac('0x13')]);return _0x646245(_0x476cc4[_0x08ac('0x11')][_0x08ac('0x13')]);}logger['error'](_0x08ac('0xc'),_0x50cca8,_0x476cc4[_0x08ac('0x11')]['message']);return _0x18a477(_0x476cc4[_0x08ac('0x11')]['message']);}else{logger[_0x08ac('0xb')](_0x08ac('0xc'),_0x50cca8,_0x08ac('0xd'));_0x18a477(_0x476cc4['result'][_0x08ac('0x13')]);}})[_0x08ac('0x14')](function(_0xb950d4){logger[_0x08ac('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x50cca8,_0xb950d4);_0x646245(_0xb950d4);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ddc961e..19905c2 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 _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','delete','exports'];(function(_0x5c75f2,_0x5a7176){var _0x103333=function(_0x3238ad){while(--_0x3238ad){_0x5c75f2['push'](_0x5c75f2['shift']());}};_0x103333(++_0x5a7176);}(_0x0b0e,0x187));var _0xe0b0=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x0b0e[_0x9c2427];return _0x51984f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['update']);router[_0xe0b0('0xf')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x1df999,_0x49c69d){var _0x13b087=function(_0xf20d93){while(--_0xf20d93){_0x1df999['push'](_0x1df999['shift']());}};_0x13b087(++_0x49c69d);}(_0xb7e7,0x121));var _0x7b7e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb7e7[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index f7169c0..af101c9 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 _0x0960=['website_alias','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3bee55,_0x4e25c8){var _0x5649d2=function(_0x13d730){while(--_0x13d730){_0x3bee55['push'](_0x3bee55['shift']());}};_0x5649d2(++_0x4e25c8);}(_0x0960,0xc2));var _0x0096=function(_0x5a05e6,_0x852218){_0x5a05e6=_0x5a05e6-0x0;var _0xeff780=_0x0960[_0x5a05e6];return _0xeff780;};'use strict';var Sequelize=require(_0x0096('0x0'));var rs=require(_0x0096('0x1'));module['exports']={'name':{'type':Sequelize[_0x0096('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x0096('0x2')],'allowNull':![],'unique':_0x0096('0x3')},'description':{'type':Sequelize[_0x0096('0x2')]},'mapKey':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x4')},'mapKeyOffline':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x4')},'key':{'type':Sequelize[_0x0096('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0096('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x0096('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0096('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0096('0x2')],'allowNull':![],'defaultValue':_0x0096('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0096('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0096('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0096('0x2')]},'animation':{'type':Sequelize[_0x0096('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x0096('0x9'),_0x0096('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x0096('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x0096('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x0096('0xc')},'download_transcript':{'type':Sequelize[_0x0096('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x0096('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x0096('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0096('0xe')]},'closingQuestion':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0xf')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x0096('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0096('0x10')},'placeholderMessage':{'type':Sequelize[_0x0096('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x11')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x0096('0xb')},'skipMessageButton':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x12')},'conditionAgreement':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x13')},'ratingType':{'type':Sequelize['ENUM'](_0x0096('0x14'),_0x0096('0x15')),'defaultValue':_0x0096('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0096('0xe')],'defaultValue':function(){return JSON[_0x0096('0x16')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0096('0x17'),'type':_0x0096('0x18'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x0096('0x19'),'props':{'title':_0x0096('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0096('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0096('0x1a')](_0x0096('0x1b'))?JSON[_0x0096('0x1c')](this['getDataValue']('onlineForm')):{};},'set':function(_0x569a7e){return this[_0x0096('0x1d')](_0x0096('0x1b'),JSON['stringify'](_0x569a7e));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0096('0x16')]({'items':[{'type':_0x0096('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0096('0x4')},'variable':null},{'type':_0x0096('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':_0x0096('0x1f'),'helpText':_0x0096('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x0096('0x1a')](_0x0096('0x21'))?JSON[_0x0096('0x1c')](this['getDataValue']('offlineForm')):{};},'set':function(_0x3b842b){return this[_0x0096('0x1d')](_0x0096('0x21'),JSON['stringify'](_0x3b842b));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0096('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0096('0x2')]},'forwardOffline':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0096('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0096('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x25')},'offlineMessageBody':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x0096('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x27')},'skipUnmanaged':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x12')},'sendUnmanaged':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0xb')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0096('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0096('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0096('0xe')],'defaultValue':function(){return _0x0096('0x28');}},'notificationSound':{'type':Sequelize[_0x0096('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0096('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x2a')},'verticalAlignment':{'type':Sequelize[_0x0096('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x2b')},'defaultTitle':{'type':Sequelize[_0x0096('0x2')]},'customerAvatar':{'type':Sequelize[_0x0096('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0096('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0096('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0096('0x2')],'defaultValue':_0x0096('0x2c')},'systemAvatar':{'type':Sequelize[_0x0096('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0096('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![],'comment':_0x0096('0x2d'),'set':function(_0x572e45){if(!_0x572e45)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x0096('0x1d')](_0x0096('0x2e'),_0x572e45);}},'vidaooEscalation':{'type':Sequelize[_0x0096('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0096('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd4d1=['Comments','Leave\x20your\x20comments','parse','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','Note','Skip','star','thumb','input','name','text','getDataValue','onlineForm','setDataValue','stringify','TEXT','textarea'];(function(_0x164c6e,_0x25abdb){var _0xe3731a=function(_0x53a71e){while(--_0x53a71e){_0x164c6e['push'](_0x164c6e['shift']());}};_0xe3731a(++_0x25abdb);}(_0xd4d1,0x123));var _0x1d4d=function(_0x41b2dd,_0x5e5e85){_0x41b2dd=_0x41b2dd-0x0;var _0x394715=_0xd4d1[_0x41b2dd];return _0x394715;};'use strict';var Sequelize=require(_0x1d4d('0x0'));var rs=require(_0x1d4d('0x1'));module[_0x1d4d('0x2')]={'name':{'type':Sequelize[_0x1d4d('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x1d4d('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x1d4d('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x1d4d('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x1d4d('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x5')},'customerAlias':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1d4d('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1d4d('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1d4d('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1d4d('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1d4d('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1d4d('0x9')](_0x1d4d('0xa'),_0x1d4d('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0xc')},'start_chat_button':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0xd')},'offline_chat_button':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0xe')},'header_offline':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0xf')},'download_transcript':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1d4d('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x1d4d('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x1d4d('0x12')},'placeholderMessage':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0xe')},'skipMessageButton':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x13')},'conditionAgreement':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1d4d('0x9')](_0x1d4d('0x14'),_0x1d4d('0x15')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x1d4d('0x16'),'variable':null,'config':{'placeholder':_0x1d4d('0x17'),'type':_0x1d4d('0x18'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x1d4d('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1d4d('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1d4d('0x19')](_0x1d4d('0x1a'))?JSON['parse'](this[_0x1d4d('0x19')](_0x1d4d('0x1a'))):{};},'set':function(_0x28f827){return this[_0x1d4d('0x1b')]('onlineForm',JSON[_0x1d4d('0x1c')](_0x28f827));}},'offlineForm':{'type':Sequelize[_0x1d4d('0x1d')],'defaultValue':function(){return JSON[_0x1d4d('0x1c')]({'items':[{'type':'input','props':{'title':_0x1d4d('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x1d4d('0x1e'),'config':{'placeholder':_0x1d4d('0x1f')},'props':{'title':_0x1d4d('0x1f'),'helpText':_0x1d4d('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x1d4d('0x19')]('offlineForm')?JSON[_0x1d4d('0x21')](this[_0x1d4d('0x19')]('offlineForm')):{};},'set':function(_0xc48d83){return this[_0x1d4d('0x1b')]('offlineForm',JSON[_0x1d4d('0x1c')](_0xc48d83));}},'token':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':function(){return rs[_0x1d4d('0x22')]();}},'autoclose':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1d4d('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1d4d('0x3')]},'waitingTitle':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x23')},'offlineMessageBody':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x25')},'skipUnmanaged':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x13')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1d4d('0x1d')]},'showAgentAvatar':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1d4d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1d4d('0x1d')],'defaultValue':function(){return _0x1d4d('0x26');}},'notificationSound':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1d4d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x1d4d('0x3')]},'customerAvatar':{'type':Sequelize[_0x1d4d('0x1d')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x1d4d('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1d4d('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1d4d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1d4d('0x3')],'defaultValue':_0x1d4d('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d4d('0x8')],'comment':_0x1d4d('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![],'comment':_0x1d4d('0x2c'),'set':function(_0x4d8e05){if(!_0x4d8e05)this[_0x1d4d('0x1b')]('mandatoryDispositionPauseId',null);this[_0x1d4d('0x1b')](_0x1d4d('0x2d'),_0x4d8e05);}},'vidaooEscalation':{'type':Sequelize[_0x1d4d('0x10')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 108ef11..4b7a1af 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 _0xa630=['includeAll','include','findAll','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','getDispositions','findOne','Disposition','hasOwnProperty','ChatWebsiteId','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','sitepic','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','createdAt','updatedAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Applications','applications','priority','asc','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','format','unknown','version','device','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','update','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','mapKeyOffline','findOrCreate','readFileSync','render','offlineMessageBody','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','ids','Owner','fullname','internal','Tag','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','custom','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','utf8','remote','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','color','textColor','addApplications','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','Content-Range','json','apply','save','destroy','get','ChatWebsites','UserProfileResource','then','sendStatus','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count'];(function(_0x12fec1,_0x20be9c){var _0x26c3af=function(_0xedc7c6){while(--_0xedc7c6){_0x12fec1['push'](_0x12fec1['shift']());}};_0x26c3af(++_0x20be9c);}(_0xa630,0x1e9));var _0x0a63=function(_0x3d208c,_0x489cc3){_0x3d208c=_0x3d208c-0x0;var _0x4789c0=_0xa630[_0x3d208c];return _0x4789c0;};'use strict';var pdf=require(_0x0a63('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a63('0x2'));var rp=require('request-promise');var moment=require(_0x0a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a63('0x4'));var util=require(_0x0a63('0x5'));var path=require('path');var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require(_0x0a63('0xe'));var Papa=require('papaparse');var Redis=require(_0x0a63('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0a63('0x10'));var as=require(_0x0a63('0x11'));var hardwareService=require(_0x0a63('0x12'));var logger=require(_0x0a63('0x13'))(_0x0a63('0x14'));var utils=require(_0x0a63('0x15'));var config=require('../../config/environment');var db=require(_0x0a63('0x16'))['db'];config[_0x0a63('0x17')]=_[_0x0a63('0x18')](config[_0x0a63('0x17')],{'host':_0x0a63('0x19'),'port':0x18eb});var socket=require(_0x0a63('0x1a'))(new Redis(config[_0x0a63('0x17')]));require(_0x0a63('0x1b'))[_0x0a63('0x1c')](socket);var jayson=require(_0x0a63('0x1d'));var client=jayson['client'][_0x0a63('0x1e')]({'port':0x232c});var client9002=jayson[_0x0a63('0x1f')][_0x0a63('0x1e')]({'port':0x232a});var client9003=jayson['client'][_0x0a63('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x26421b,_0x588909,_0x4c1e53){if(_0x4c1e53){var _0x13b0cf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x13b0cf[_0x0a63('0x20')](_0x588909)){return _0x26421b;}else{throw new db[(_0x0a63('0x21'))][(_0x0a63('0x22'))](_0x0a63('0x23'));}}else{return _0x26421b;}}function respondWithRpcPromise(_0x252dea,_0x139370,_0x4c9307,_0x2e499d){return new BPromise(function(_0x23ba2f,_0x56b83d){var _0x43a790=_0x2e499d||client;return _0x43a790[_0x0a63('0x24')](_0x252dea,_0x4c9307)['then'](function(_0x13e672){logger[_0x0a63('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x139370,_0x0a63('0x26'));logger[_0x0a63('0x27')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x139370,_0x0a63('0x26'),JSON[_0x0a63('0x28')](_0x13e672));if(_0x13e672[_0x0a63('0x29')]){if(_0x13e672['error'][_0x0a63('0x2a')]===0x1f4){logger[_0x0a63('0x29')](_0x0a63('0x2b'),_0x139370,_0x13e672[_0x0a63('0x29')][_0x0a63('0x2c')]);return _0x56b83d(_0x13e672['error'][_0x0a63('0x2c')]);}logger['error'](_0x0a63('0x2b'),_0x139370,_0x13e672[_0x0a63('0x29')]['message']);return _0x23ba2f(_0x13e672['error']['message']);}else{logger[_0x0a63('0x25')](_0x0a63('0x2b'),_0x139370,_0x0a63('0x26'));_0x23ba2f(_0x13e672[_0x0a63('0x2d')][_0x0a63('0x2c')]);}})[_0x0a63('0x2e')](function(_0x41c501){logger[_0x0a63('0x29')](_0x0a63('0x2b'),_0x139370,_0x41c501);_0x56b83d(_0x41c501);});});}function respondWithStatusCode(_0x4091dc,_0xd4fdb2){_0xd4fdb2=_0xd4fdb2||0xcc;return function(_0x3921a4){if(_0x3921a4){return _0x4091dc['sendStatus'](_0xd4fdb2);}return _0x4091dc[_0x0a63('0x2f')](_0xd4fdb2)[_0x0a63('0x30')]();};}function respondWithResult(_0x173b39,_0xcfccd9){_0xcfccd9=_0xcfccd9||0xc8;return function(_0x3a7dc8){if(_0x3a7dc8){return _0x173b39[_0x0a63('0x2f')](_0xcfccd9)['json'](_0x3a7dc8);}};}function respondWithFilteredResult(_0x5dff0c,_0x14a931){return function(_0x309cb7){if(_0x309cb7){var _0x482208=_0x309cb7['count'],_0x2d0bda=_0x14a931[_0x0a63('0x31')],_0x20a7f7=_0x14a931[_0x0a63('0x31')]+_0x14a931[_0x0a63('0x32')],_0x343500;if(_0x20a7f7>=_0x482208){_0x20a7f7=_0x482208;_0x343500=0xc8;}else{_0x343500=0xce;}_0x5dff0c[_0x0a63('0x2f')](_0x343500);return _0x5dff0c['set'](_0x0a63('0x33'),_0x2d0bda+'-'+_0x20a7f7+'/'+_0x482208)[_0x0a63('0x34')](_0x309cb7);}return null;};}function patchUpdates(_0x6f2d8e){return function(_0x3a8c92){try{jsonpatch[_0x0a63('0x35')](_0x3a8c92,_0x6f2d8e,!![]);}catch(_0x2645c4){return BPromise['reject'](_0x2645c4);}return _0x3a8c92[_0x0a63('0x36')]();};}function saveUpdates(_0x305212,_0x20b2ba){return function(_0x9d4441){if(_0x9d4441){return _0x9d4441['update'](_0x305212)['then'](function(_0x302f8b){return _0x302f8b;});}return null;};}function removeEntity(_0x2da31e,_0x4278a4){return function(_0x1adb4c){if(_0x1adb4c){return _0x1adb4c[_0x0a63('0x37')]()['then'](function(){var _0x2adbe=_0x1adb4c[_0x0a63('0x38')]({'plain':!![]});var _0x413fc6=_0x0a63('0x39');return db[_0x0a63('0x3a')]['destroy']({'where':{'type':_0x413fc6,'resourceId':_0x2adbe['id']}})[_0x0a63('0x3b')](function(){return _0x1adb4c;});})[_0x0a63('0x3b')](function(){_0x2da31e[_0x0a63('0x2f')](0xcc)[_0x0a63('0x30')]();});}};}function handleEntityNotFound(_0x3bd141,_0x18e6c9){return function(_0x549102){if(!_0x549102){_0x3bd141[_0x0a63('0x3c')](0x194);}return _0x549102;};}function handleError(_0x28d6c1,_0x553f9d){_0x553f9d=_0x553f9d||0x1f4;return function(_0x362764){logger[_0x0a63('0x29')](_0x362764['stack']);if(_0x362764[_0x0a63('0x3d')]){delete _0x362764[_0x0a63('0x3d')];}_0x28d6c1[_0x0a63('0x2f')](_0x553f9d)[_0x0a63('0x3e')](_0x362764);};}exports[_0x0a63('0x3f')]=function(_0x3f256d,_0x2ee698){var _0x5a9913={'include':[{'model':db['Pause'],'as':_0x0a63('0x40')}]},_0x2dfcf5={},_0x2aafb5={'count':0x0,'rows':[]};var _0x3cc553=_[_0x0a63('0x41')](db[_0x0a63('0x42')][_0x0a63('0x43')],function(_0x4a1c6){return{'name':_0x4a1c6[_0x0a63('0x44')],'type':_0x4a1c6['type'][_0x0a63('0x45')]};});_0x2dfcf5['model']=_[_0x0a63('0x41')](_0x3cc553,_0x0a63('0x3d'));_0x2dfcf5[_0x0a63('0x46')]=_[_0x0a63('0x47')](_0x3f256d[_0x0a63('0x46')]);_0x2dfcf5[_0x0a63('0x48')]=_[_0x0a63('0x49')](_0x2dfcf5[_0x0a63('0x4a')],_0x2dfcf5['query']);_0x5a9913[_0x0a63('0x4b')]=_[_0x0a63('0x49')](_0x2dfcf5[_0x0a63('0x4a')],qs[_0x0a63('0x4c')](_0x3f256d[_0x0a63('0x46')][_0x0a63('0x4c')]));_0x5a9913['attributes']=_0x5a9913[_0x0a63('0x4b')][_0x0a63('0x4d')]?_0x5a9913['attributes']:_0x2dfcf5[_0x0a63('0x4a')];if(!_0x3f256d[_0x0a63('0x46')]['hasOwnProperty'](_0x0a63('0x4e'))){_0x5a9913['limit']=qs[_0x0a63('0x32')](_0x3f256d['query']['limit']);_0x5a9913[_0x0a63('0x31')]=qs[_0x0a63('0x31')](_0x3f256d[_0x0a63('0x46')][_0x0a63('0x31')]);}_0x5a9913[_0x0a63('0x4f')]=qs[_0x0a63('0x50')](_0x3f256d[_0x0a63('0x46')][_0x0a63('0x50')]);_0x5a9913[_0x0a63('0x51')]=qs[_0x0a63('0x48')](_[_0x0a63('0x52')](_0x3f256d['query'],_0x2dfcf5[_0x0a63('0x48')]),_0x3cc553);if(_0x3f256d[_0x0a63('0x46')][_0x0a63('0x53')]){_0x5a9913[_0x0a63('0x51')]=_[_0x0a63('0x54')](_0x5a9913[_0x0a63('0x51')],{'$or':_[_0x0a63('0x41')](_0x3cc553,function(_0x7b16e){if(_0x7b16e[_0x0a63('0x55')]!==_0x0a63('0x56')){var _0x6cc0b={};_0x6cc0b[_0x7b16e['name']]={'$like':'%'+_0x3f256d[_0x0a63('0x46')][_0x0a63('0x53')]+'%'};return _0x6cc0b;}})});}_0x5a9913=_['merge']({},_0x5a9913,_0x3f256d[_0x0a63('0x57')]);var _0x21b539={'where':_0x5a9913[_0x0a63('0x51')]};return db['ChatWebsite'][_0x0a63('0x58')](_0x21b539)[_0x0a63('0x3b')](function(_0x553542){_0x2aafb5[_0x0a63('0x58')]=_0x553542;if(_0x3f256d[_0x0a63('0x46')][_0x0a63('0x59')]){_0x5a9913[_0x0a63('0x5a')]=[{'all':!![]}];}return db[_0x0a63('0x42')][_0x0a63('0x5b')](_0x5a9913);})[_0x0a63('0x3b')](function(_0x4c25a2){_0x2aafb5['rows']=_0x4c25a2;return _0x2aafb5;})[_0x0a63('0x3b')](respondWithFilteredResult(_0x2ee698,_0x5a9913))[_0x0a63('0x2e')](handleError(_0x2ee698,null));};exports[_0x0a63('0x5c')]=function(_0x120fec,_0x4b855a){var _0x28d069={'raw':![],'where':{'id':_0x120fec[_0x0a63('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x0a63('0x40')}]},_0x5a5bf5={};_0x5a5bf5['model']=_[_0x0a63('0x47')](db[_0x0a63('0x42')][_0x0a63('0x43')]);_0x5a5bf5[_0x0a63('0x46')]=_[_0x0a63('0x47')](_0x120fec[_0x0a63('0x46')]);_0x5a5bf5['filters']=_['intersection'](_0x5a5bf5[_0x0a63('0x4a')],_0x5a5bf5['query']);_0x28d069[_0x0a63('0x4b')]=_['intersection'](_0x5a5bf5[_0x0a63('0x4a')],qs[_0x0a63('0x4c')](_0x120fec[_0x0a63('0x46')][_0x0a63('0x4c')]));_0x28d069[_0x0a63('0x4b')]=_0x28d069[_0x0a63('0x4b')][_0x0a63('0x4d')]?_0x28d069[_0x0a63('0x4b')]:_0x5a5bf5[_0x0a63('0x4a')];if(_0x120fec[_0x0a63('0x46')][_0x0a63('0x59')]){_0x28d069['include']=[{'all':!![]}];}_0x28d069=_['merge']({},_0x28d069,_0x120fec[_0x0a63('0x57')]);return db['ChatWebsite'][_0x0a63('0x5e')](_0x28d069)[_0x0a63('0x3b')](handleEntityNotFound(_0x4b855a,null))[_0x0a63('0x3b')](respondWithResult(_0x4b855a,null))[_0x0a63('0x2e')](handleError(_0x4b855a,null));};exports[_0x0a63('0x5f')]=function(_0x31bd80,_0x17139f){return db[_0x0a63('0x42')][_0x0a63('0x5f')](_0x31bd80[_0x0a63('0x60')],{})[_0x0a63('0x3b')](function(_0x340066){var _0x4ede25=_0x31bd80['user']['get']({'plain':!![]});if(!_0x4ede25)throw new Error(_0x0a63('0x61'));if(_0x4ede25[_0x0a63('0x62')]===_0x0a63('0x63')){var _0x394efc=_0x340066[_0x0a63('0x38')]({'plain':!![]});var _0x33c78a='ChatWebsites';return db[_0x0a63('0x64')][_0x0a63('0x5e')]({'where':{'name':_0x33c78a,'userProfileId':_0x4ede25['userProfileId']},'raw':!![]})[_0x0a63('0x3b')](function(_0x7c118a){if(_0x7c118a&&_0x7c118a[_0x0a63('0x65')]===0x0){return db[_0x0a63('0x3a')][_0x0a63('0x5f')]({'name':_0x394efc[_0x0a63('0x3d')],'resourceId':_0x394efc['id'],'type':_0x7c118a[_0x0a63('0x3d')],'sectionId':_0x7c118a['id']},{})[_0x0a63('0x3b')](function(){return _0x340066;});}else{return _0x340066;}})[_0x0a63('0x2e')](function(_0x3dc4af){logger[_0x0a63('0x29')](_0x0a63('0x66'),_0x3dc4af);throw _0x3dc4af;});}return _0x340066;})[_0x0a63('0x3b')](respondWithResult(_0x17139f,0xc9))['catch'](handleError(_0x17139f,null));};exports['update']=function(_0x3aa832,_0x387e02){if(_0x3aa832[_0x0a63('0x60')]['id']){delete _0x3aa832[_0x0a63('0x60')]['id'];}return db[_0x0a63('0x42')][_0x0a63('0x5e')]({'where':{'id':_0x3aa832['params']['id']},'include':[{'model':db[_0x0a63('0x67')],'as':_0x0a63('0x40')}]})[_0x0a63('0x3b')](handleEntityNotFound(_0x387e02,null))[_0x0a63('0x3b')](saveUpdates(_0x3aa832['body'],null))[_0x0a63('0x3b')](respondWithResult(_0x387e02,null))[_0x0a63('0x2e')](handleError(_0x387e02,null));};exports[_0x0a63('0x37')]=function(_0x47ab77,_0x1713ec){return db['ChatWebsite'][_0x0a63('0x5e')]({'where':{'id':_0x47ab77[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x1713ec,null))[_0x0a63('0x3b')](removeEntity(_0x1713ec,null))[_0x0a63('0x2e')](handleError(_0x1713ec,null));};exports['describe']=function(_0x2e910f,_0x4d646c){return db['ChatWebsite'][_0x0a63('0x68')]()[_0x0a63('0x3b')](respondWithResult(_0x4d646c,null))['catch'](handleError(_0x4d646c,null));};exports[_0x0a63('0x69')]=function(_0x42fb51,_0xf91990,_0x4592d7){if(_0x42fb51['body']['id']){delete _0x42fb51['body']['id'];}return db[_0x0a63('0x42')][_0x0a63('0x5e')]({'where':{'id':_0x42fb51[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0xf91990,null))[_0x0a63('0x3b')](function(_0x428708){if(_0x428708){_0x42fb51[_0x0a63('0x60')]['ChatWebsiteId']=_0x428708['id'];return db['Disposition'][_0x0a63('0x5f')](_0x42fb51[_0x0a63('0x60')]);}})[_0x0a63('0x3b')](respondWithResult(_0xf91990,null))[_0x0a63('0x2e')](handleError(_0xf91990,null));};exports[_0x0a63('0x6a')]=function(_0x52d0f0,_0x1fb5e9,_0x16bdd9){var _0x59561c={'raw':![],'where':{}};var _0x37a4ce={};var _0x5e724f={'count':0x0,'rows':[]};return db[_0x0a63('0x42')][_0x0a63('0x6b')]({'where':{'id':_0x52d0f0[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x1fb5e9,null))[_0x0a63('0x3b')](function(_0x3f6e4b){if(_0x3f6e4b){_0x37a4ce[_0x0a63('0x4a')]=_['keys'](db[_0x0a63('0x6c')][_0x0a63('0x43')]);_0x37a4ce[_0x0a63('0x46')]=_[_0x0a63('0x47')](_0x52d0f0[_0x0a63('0x46')]);_0x37a4ce[_0x0a63('0x48')]=_['intersection'](_0x37a4ce[_0x0a63('0x4a')],_0x37a4ce[_0x0a63('0x46')]);_0x59561c[_0x0a63('0x4b')]=_[_0x0a63('0x49')](_0x37a4ce[_0x0a63('0x4a')],qs[_0x0a63('0x4c')](_0x52d0f0['query'][_0x0a63('0x4c')]));_0x59561c[_0x0a63('0x4b')]=_0x59561c['attributes'][_0x0a63('0x4d')]?_0x59561c[_0x0a63('0x4b')]:_0x37a4ce[_0x0a63('0x4a')];if(!_0x52d0f0[_0x0a63('0x46')][_0x0a63('0x6d')](_0x0a63('0x4e'))){_0x59561c[_0x0a63('0x32')]=qs['limit'](_0x52d0f0[_0x0a63('0x46')][_0x0a63('0x32')]);_0x59561c[_0x0a63('0x31')]=qs[_0x0a63('0x31')](_0x52d0f0['query'][_0x0a63('0x31')]);}_0x59561c[_0x0a63('0x4f')]=qs[_0x0a63('0x50')](_0x52d0f0[_0x0a63('0x46')]['sort']);_0x59561c[_0x0a63('0x51')]=qs['filters'](_[_0x0a63('0x52')](_0x52d0f0[_0x0a63('0x46')],_0x37a4ce[_0x0a63('0x48')]));_0x59561c[_0x0a63('0x51')][_0x0a63('0x6e')]=_0x3f6e4b['id'];if(_0x52d0f0[_0x0a63('0x46')][_0x0a63('0x53')]){_0x59561c[_0x0a63('0x51')]=_['merge'](_0x59561c[_0x0a63('0x51')],{'$or':_[_0x0a63('0x41')](_0x59561c[_0x0a63('0x4b')],function(_0x45935a){var _0x872c04={};_0x872c04[_0x45935a]={'$like':'%'+_0x52d0f0[_0x0a63('0x46')][_0x0a63('0x53')]+'%'};return _0x872c04;})});}_0x59561c=_[_0x0a63('0x54')]({},_0x59561c,_0x52d0f0[_0x0a63('0x57')]);return db[_0x0a63('0x6c')][_0x0a63('0x58')]({'where':_0x59561c['where']})[_0x0a63('0x3b')](function(_0x24e013){_0x5e724f[_0x0a63('0x58')]=_0x24e013;if(_0x52d0f0[_0x0a63('0x46')][_0x0a63('0x59')]){_0x59561c[_0x0a63('0x5a')]=[{'all':!![]}];}return db[_0x0a63('0x6c')][_0x0a63('0x5b')](_0x59561c);})[_0x0a63('0x3b')](function(_0x5f1da7){_0x5e724f[_0x0a63('0x6f')]=_0x5f1da7;return _0x5e724f;});}})[_0x0a63('0x3b')](respondWithFilteredResult(_0x1fb5e9,_0x59561c))[_0x0a63('0x2e')](handleError(_0x1fb5e9,null));};exports[_0x0a63('0x70')]=function(_0x46efb3,_0xebe066,_0xdd367f){return db['ChatWebsite'][_0x0a63('0x5e')]({'where':{'id':_0x46efb3[_0x0a63('0x5d')]['id']}})['then'](handleEntityNotFound(_0xebe066,null))['then'](function(_0x12639e){if(_0x12639e){return _0x12639e[_0x0a63('0x70')](_0x46efb3[_0x0a63('0x46')]['ids']);}})['then'](respondWithStatusCode(_0xebe066,null))[_0x0a63('0x2e')](handleError(_0xebe066,null));};exports[_0x0a63('0x71')]=function(_0x5b6dc6,_0x3762f7,_0x2c71ae){if(_0x5b6dc6[_0x0a63('0x60')]['id']){delete _0x5b6dc6[_0x0a63('0x60')]['id'];}return db[_0x0a63('0x42')][_0x0a63('0x5e')]({'where':{'id':_0x5b6dc6[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x3762f7,null))['then'](function(_0x2695fe){if(_0x2695fe){_0x5b6dc6[_0x0a63('0x60')][_0x0a63('0x6e')]=_0x2695fe['id'];return db['CannedAnswer'][_0x0a63('0x5f')](_0x5b6dc6[_0x0a63('0x60')]);}})['then'](respondWithResult(_0x3762f7,null))[_0x0a63('0x2e')](handleError(_0x3762f7,null));};exports[_0x0a63('0x72')]=function(_0x3ea2c7,_0x166c43,_0x26fbe2){var _0x2a0dc7={'raw':![],'where':{}};var _0x3d0086={};var _0xd6ff75={'count':0x0,'rows':[]};return db[_0x0a63('0x42')][_0x0a63('0x6b')]({'where':{'id':_0x3ea2c7['params']['id']}})['then'](handleEntityNotFound(_0x166c43,null))[_0x0a63('0x3b')](function(_0x3d6843){if(_0x3d6843){_0x3d0086[_0x0a63('0x4a')]=_[_0x0a63('0x47')](db[_0x0a63('0x73')][_0x0a63('0x43')]);_0x3d0086[_0x0a63('0x46')]=_['keys'](_0x3ea2c7[_0x0a63('0x46')]);_0x3d0086[_0x0a63('0x48')]=_['intersection'](_0x3d0086[_0x0a63('0x4a')],_0x3d0086['query']);_0x2a0dc7[_0x0a63('0x4b')]=_[_0x0a63('0x49')](_0x3d0086['model'],qs['fields'](_0x3ea2c7[_0x0a63('0x46')][_0x0a63('0x4c')]));_0x2a0dc7[_0x0a63('0x4b')]=_0x2a0dc7['attributes'][_0x0a63('0x4d')]?_0x2a0dc7[_0x0a63('0x4b')]:_0x3d0086['model'];if(!_0x3ea2c7[_0x0a63('0x46')][_0x0a63('0x6d')](_0x0a63('0x4e'))){_0x2a0dc7[_0x0a63('0x32')]=qs[_0x0a63('0x32')](_0x3ea2c7[_0x0a63('0x46')]['limit']);_0x2a0dc7['offset']=qs[_0x0a63('0x31')](_0x3ea2c7[_0x0a63('0x46')]['offset']);}_0x2a0dc7['order']=qs['sort'](_0x3ea2c7[_0x0a63('0x46')][_0x0a63('0x50')]);_0x2a0dc7[_0x0a63('0x51')]=qs[_0x0a63('0x48')](_[_0x0a63('0x52')](_0x3ea2c7['query'],_0x3d0086[_0x0a63('0x48')]));_0x2a0dc7[_0x0a63('0x51')][_0x0a63('0x6e')]=_0x3d6843['id'];if(_0x3ea2c7[_0x0a63('0x46')]['filter']){_0x2a0dc7['where']=_[_0x0a63('0x54')](_0x2a0dc7[_0x0a63('0x51')],{'$or':_[_0x0a63('0x41')](_0x2a0dc7[_0x0a63('0x4b')],function(_0x3f7ed3){var _0x1224f6={};_0x1224f6[_0x3f7ed3]={'$like':'%'+_0x3ea2c7[_0x0a63('0x46')][_0x0a63('0x53')]+'%'};return _0x1224f6;})});}_0x2a0dc7=_[_0x0a63('0x54')]({},_0x2a0dc7,_0x3ea2c7[_0x0a63('0x57')]);return db[_0x0a63('0x73')][_0x0a63('0x58')]({'where':_0x2a0dc7[_0x0a63('0x51')]})[_0x0a63('0x3b')](function(_0x23538c){_0xd6ff75['count']=_0x23538c;if(_0x3ea2c7[_0x0a63('0x46')][_0x0a63('0x59')]){_0x2a0dc7[_0x0a63('0x5a')]=[{'all':!![]}];}return db[_0x0a63('0x73')][_0x0a63('0x5b')](_0x2a0dc7);})[_0x0a63('0x3b')](function(_0x44cd28){_0xd6ff75['rows']=_0x44cd28;return _0xd6ff75;});}})[_0x0a63('0x3b')](respondWithFilteredResult(_0x166c43,_0x2a0dc7))['catch'](handleError(_0x166c43,null));};exports[_0x0a63('0x74')]=function(_0x15d107,_0x574ca2,_0x510ee3){return db[_0x0a63('0x42')][_0x0a63('0x5e')]({'where':{'id':_0x15d107['params']['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x574ca2,null))[_0x0a63('0x3b')](function(_0x1e3946){if(_0x1e3946){return _0x1e3946[_0x0a63('0x74')](_0x15d107[_0x0a63('0x46')]['ids']);}})[_0x0a63('0x3b')](respondWithStatusCode(_0x574ca2,null))[_0x0a63('0x2e')](handleError(_0x574ca2,null));};exports[_0x0a63('0x75')]=function(_0x5c553f,_0x52c29f,_0x1a4ee2){_0x5c553f[_0x0a63('0x60')]['sitepic']=_0x5c553f[_0x0a63('0x76')][_0x0a63('0x77')];return db[_0x0a63('0x42')]['find']({'where':{'id':_0x5c553f[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x52c29f,null))[_0x0a63('0x3b')](saveUpdates(_0x5c553f[_0x0a63('0x60')],null))[_0x0a63('0x3b')](respondWithResult(_0x52c29f,null))[_0x0a63('0x2e')](handleError(_0x52c29f,null));};exports[_0x0a63('0x78')]=function(_0x7ef311,_0x493ddf,_0x313302){_0x7ef311[_0x0a63('0x60')][_0x0a63('0x79')]=_0x7ef311[_0x0a63('0x76')][_0x0a63('0x77')];return db['ChatWebsite'][_0x0a63('0x5e')]({'where':{'id':_0x7ef311[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x493ddf,null))[_0x0a63('0x3b')](saveUpdates(_0x7ef311['body'],null))[_0x0a63('0x3b')](respondWithResult(_0x493ddf,null))[_0x0a63('0x2e')](handleError(_0x493ddf,null));};exports[_0x0a63('0x7a')]=function(_0x19e37f,_0x43faed,_0x36908f){_0x19e37f[_0x0a63('0x60')]['customerAvatar']=_0x19e37f['file'][_0x0a63('0x77')];return db[_0x0a63('0x42')][_0x0a63('0x5e')]({'where':{'id':_0x19e37f[_0x0a63('0x5d')]['id']}})['then'](handleEntityNotFound(_0x43faed,null))[_0x0a63('0x3b')](saveUpdates(_0x19e37f[_0x0a63('0x60')],null))['then'](respondWithResult(_0x43faed,null))[_0x0a63('0x2e')](handleError(_0x43faed,null));};exports['addSystemAvatar']=function(_0x4718b5,_0xd6435b,_0x116844){_0x4718b5[_0x0a63('0x60')][_0x0a63('0x7b')]=_0x4718b5[_0x0a63('0x76')][_0x0a63('0x77')];return db['ChatWebsite'][_0x0a63('0x5e')]({'where':{'id':_0x4718b5['params']['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0xd6435b,null))[_0x0a63('0x3b')](saveUpdates(_0x4718b5[_0x0a63('0x60')],null))['then'](respondWithResult(_0xd6435b,null))[_0x0a63('0x2e')](handleError(_0xd6435b,null));};exports[_0x0a63('0x7c')]=function(_0x3f179b,_0x1bd9ba,_0x23cfdc){var _0x3db63c=path[_0x0a63('0x7d')](config[_0x0a63('0x7e')],_0x0a63('0x7f'));var _0x36e3b8={'where':{'id':_0x3f179b[_0x0a63('0x5d')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3ddd5a=![];return require(_0x0a63('0x80'))[_0x0a63('0x81')]()[_0x0a63('0x3b')](function(_0xa64f04){if(_0xa64f04){_0x3ddd5a=_0xa64f04['custom'];}})['then'](function(){return db[_0x0a63('0x42')][_0x0a63('0x5e')](_0x36e3b8);})['then'](handleEntityNotFound(_0x1bd9ba,null))[_0x0a63('0x3b')](function(_0x27e507){if(_0x27e507){if(!_[_0x0a63('0x82')](_0x27e507[_0x0a63('0x83')])){if(fs['existsSync'](path['join'](config[_0x0a63('0x7e')],'server/files/images/logos/',_0x27e507[_0x0a63('0x83')]))&&_0x3ddd5a){_0x3db63c=path[_0x0a63('0x7d')](config[_0x0a63('0x7e')],_0x0a63('0x84'),_0x27e507[_0x0a63('0x83')]);}}return _0x1bd9ba[_0x0a63('0x85')](_0x3db63c);}})[_0x0a63('0x2e')](handleError(_0x1bd9ba,null));};exports[_0x0a63('0x86')]=function(_0xb0fd9a,_0x5210e2,_0xb6f3f6){var _0x4a2e5d=path[_0x0a63('0x7d')](config[_0x0a63('0x7e')],_0x0a63('0x87'));var _0x30dea3={'where':{'id':_0xb0fd9a[_0x0a63('0x5d')]['id']},'attributes':['id',_0x0a63('0x79')],'raw':!![]};return db[_0x0a63('0x42')][_0x0a63('0x5e')](_0x30dea3)[_0x0a63('0x3b')](handleEntityNotFound(_0x5210e2,null))[_0x0a63('0x3b')](function(_0x19a1ef){if(_0x19a1ef){if(!_['isNil'](_0x19a1ef[_0x0a63('0x79')])){if(fs[_0x0a63('0x88')](path['join'](config[_0x0a63('0x7e')],_0x0a63('0x89'),_0x19a1ef[_0x0a63('0x79')]))){_0x4a2e5d=path[_0x0a63('0x7d')](config[_0x0a63('0x7e')],_0x0a63('0x89'),_0x19a1ef[_0x0a63('0x79')]);}}return _0x5210e2[_0x0a63('0x85')](_0x4a2e5d);}})[_0x0a63('0x2e')](handleError(_0x5210e2,null));};exports[_0x0a63('0x8a')]=function(_0x5589cb,_0x4ce427,_0x1e4d7a){var _0x45ad14=path[_0x0a63('0x7d')](config[_0x0a63('0x7e')],_0x0a63('0x8b'));var _0x14651f={'where':{'id':_0x5589cb[_0x0a63('0x5d')]['id']},'attributes':['id',_0x0a63('0x8c'),_0x0a63('0x8d')],'raw':!![]};return db[_0x0a63('0x42')][_0x0a63('0x5e')](_0x14651f)[_0x0a63('0x3b')](handleEntityNotFound(_0x4ce427,null))[_0x0a63('0x3b')](function(_0x2a8d76){if(_0x2a8d76){if(!_[_0x0a63('0x82')](_0x2a8d76[_0x0a63('0x8c')])){if(fs[_0x0a63('0x88')](path['join'](config[_0x0a63('0x7e')],'server/files/images/avatars/',_0x2a8d76[_0x0a63('0x8c')]))&&_0x2a8d76[_0x0a63('0x8d')]){_0x45ad14=path[_0x0a63('0x7d')](config[_0x0a63('0x7e')],_0x0a63('0x89'),_0x2a8d76[_0x0a63('0x8c')]);}}return _0x4ce427[_0x0a63('0x85')](_0x45ad14);}})[_0x0a63('0x2e')](handleError(_0x4ce427,null));};exports[_0x0a63('0x8e')]=function(_0x3997b9,_0x364c0c,_0x48ecc4){var _0x3da651=path['join'](config[_0x0a63('0x7e')],_0x0a63('0x8f'));var _0x36f90b={'where':{'id':_0x3997b9[_0x0a63('0x5d')]['id']},'attributes':['id',_0x0a63('0x7b')],'raw':!![]};return db['ChatWebsite'][_0x0a63('0x5e')](_0x36f90b)[_0x0a63('0x3b')](handleEntityNotFound(_0x364c0c,null))[_0x0a63('0x3b')](function(_0x4881d4){if(_0x4881d4){if(!_['isNil'](_0x4881d4[_0x0a63('0x7b')])){if(fs[_0x0a63('0x88')](path['join'](config[_0x0a63('0x7e')],_0x0a63('0x89'),_0x4881d4[_0x0a63('0x7b')]))){_0x3da651=path['join'](config['root'],'server/files/images/avatars/',_0x4881d4['systemAvatar']);}}return _0x364c0c[_0x0a63('0x85')](_0x3da651);}})[_0x0a63('0x2e')](handleError(_0x364c0c,null));};exports[_0x0a63('0x90')]=function(_0x2d1461,_0xa9a7a7,_0x254c32){var _0x24dc8e=require(_0x0a63('0x91'));var _0x47f708=new _0x24dc8e();var _0x5a7b1d=_0x47f708[_0x0a63('0x92')](_0x2d1461[_0x0a63('0x93')][_0x0a63('0x94')])[_0x0a63('0x95')]();var _0x2c5f2e={'body':_0x2d1461[_0x0a63('0x60')],'channel':_0x0a63('0x96')};var _0xedbc57=[];var _0x17bb75=[];var _0x34ce3a={};var _0x14fade=![];return db['CmContact'][_0x0a63('0x68')]()[_0x0a63('0x3b')](function(_0x590794){if(!_0x590794){throw new db['Sequelize'][(_0x0a63('0x22'))]('no\x20available\x20attributes');}_0xedbc57=_['difference'](_[_0x0a63('0x47')](_0x590794),[_0x0a63('0x97'),_0x0a63('0x98')]);_0x17bb75=_[_0x0a63('0x99')](_[_0x0a63('0x47')](_0x590794),[_0x0a63('0x97'),_0x0a63('0x98'),_0x0a63('0x9a'),_0x0a63('0x9b')]);if(_0x2d1461[_0x0a63('0x60')]['id']){delete _0x2d1461[_0x0a63('0x60')]['id'];}if(_[_0x0a63('0x82')](_0x2d1461['body'][_0x0a63('0x9c')])){throw new db['Sequelize']['ValidationError'](_0x0a63('0x9d'));}if(_[_0x0a63('0x82')](_0x2d1461[_0x0a63('0x60')]['body'])||_0x2d1461[_0x0a63('0x60')][_0x0a63('0x60')]===''){throw new db['Sequelize'][(_0x0a63('0x22'))](_0x0a63('0x9e'));}if(_['isNil'](_0x2d1461[_0x0a63('0x60')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x0a63('0x9f')+_0x17bb75);}if(!_[_0x0a63('0xa0')](_0x17bb75,_0x2d1461[_0x0a63('0x60')][_0x0a63('0xa1')])){throw new db['Sequelize']['ValidationError'](_0x0a63('0xa2')+_0x17bb75);}_0x34ce3a[_0x2d1461[_0x0a63('0x60')][_0x0a63('0xa1')]]=_0x2d1461[_0x0a63('0x60')][_0x0a63('0x9c')];})[_0x0a63('0x3b')](function(){return db[_0x0a63('0x42')][_0x0a63('0x5e')]({'where':{'id':_0x2d1461[_0x0a63('0x5d')]['id']},'include':[{'model':db[_0x0a63('0xa3')],'as':_0x0a63('0xa4'),'include':[{'model':db[_0x0a63('0xa5')],'as':'Contacts','where':_0x34ce3a,'limit':0x1,'order':[[_0x0a63('0x98'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x0a63('0xa6')}]});})[_0x0a63('0x3b')](handleEntityNotFound(_0xa9a7a7,null))[_0x0a63('0x3b')](function(_0x2652b7){if(_0x2652b7&&_0x2652b7[_0x0a63('0xa4')]){_0x2c5f2e['account']=_0x2652b7;_0x2c5f2e['applications']=_0x2652b7[_0x0a63('0xa6')];_0x2c5f2e['list']=_0x2652b7['List'];_0x2c5f2e['applications']=_['orderBy'](_0x2c5f2e[_0x0a63('0xa7')],[_0x0a63('0xa8')],[_0x0a63('0xa9')]);if(_0x2c5f2e[_0x0a63('0xaa')]['Applications']){delete _0x2c5f2e[_0x0a63('0xaa')]['Applications'];}if(_0x2c5f2e['account']['List']&&_0x2c5f2e[_0x0a63('0xaa')]['List']['Contacts'][_0x0a63('0x4d')]){return _0x2c5f2e[_0x0a63('0xaa')][_0x0a63('0xa4')][_0x0a63('0xab')][0x0];}var _0x3b20c3=_['defaults'](_0x2d1461[_0x0a63('0x60')],{'firstName':_0x2d1461[_0x0a63('0x60')]['from'],'ListId':_0x2652b7['ListId']});_0x3b20c3[_0x2d1461[_0x0a63('0x60')]['mapKey']]=_0x2d1461[_0x0a63('0x60')][_0x0a63('0x9c')];return db['CmContact'][_0x0a63('0x5f')](_0x3b20c3,{'fields':_0xedbc57,'raw':!![]});}})[_0x0a63('0x3b')](handleEntityNotFound(_0xa9a7a7,null))['then'](function(_0x3c6e08){_0x2c5f2e[_0x0a63('0xac')]=_0x3c6e08;var _0x4c0132=_0x2d1461[_0x0a63('0x60')][_0x0a63('0xad')];if(_0x2d1461[_0x0a63('0x93')][_0x0a63('0xae')]){_0x4c0132=_0x2d1461[_0x0a63('0x93')][_0x0a63('0xae')];}else if(_0x2d1461[_0x0a63('0x93')][_0x0a63('0xaf')]){_0x4c0132=_[_0x0a63('0xb0')](_0x2d1461[_0x0a63('0x93')]['x-forwarded-for']['split'](','));}if(_0x3c6e08){var _0x366ffa={'ContactId':_0x3c6e08['id'],'ChatWebsiteId':_0x2d1461[_0x0a63('0x5d')]['id'],'from':(_0x3c6e08[_0x0a63('0xb1')]||'')+'\x20'+(_0x3c6e08[_0x0a63('0xb2')]||''),'customerIp':_0x4c0132,'customerPort':_0x2d1461['headers'][_0x0a63('0xb3')]?_0x2d1461[_0x0a63('0x93')][_0x0a63('0xb3')]:null,'referer':_0x2d1461['body'][_0x0a63('0xb4')],'browserName':_0x5a7b1d['browser'][_0x0a63('0x3d')]&&_0x5a7b1d[_0x0a63('0xb5')]['version']?util[_0x0a63('0xb6')]('%s\x20%s',_0x5a7b1d[_0x0a63('0xb5')]['name'],_0x5a7b1d['browser']['version']):_0x0a63('0xb7'),'browserVersion':_0x5a7b1d[_0x0a63('0xb5')][_0x0a63('0xb8')]||_0x0a63('0xb7'),'osName':util[_0x0a63('0xb6')]('%s\x20%s',_0x5a7b1d['os'][_0x0a63('0x3d')],_0x5a7b1d['os']['version']),'osVersion':_0x5a7b1d['os'][_0x0a63('0xb8')],'deviceModel':_0x5a7b1d[_0x0a63('0xb9')][_0x0a63('0x4a')]&&_0x5a7b1d[_0x0a63('0xb9')]['vendor']?util[_0x0a63('0xb6')](_0x0a63('0xba'),_0x5a7b1d[_0x0a63('0xb9')][_0x0a63('0x4a')],_0x5a7b1d[_0x0a63('0xb9')]['vendor'],_0x5a7b1d['device'][_0x0a63('0x55')]):null,'deviceVendor':_0x5a7b1d['device']['vendor'],'deviceType':_0x5a7b1d[_0x0a63('0xb9')]['type'],'formData':JSON[_0x0a63('0x28')](_0x2d1461[_0x0a63('0x60')])};var _0x50606e={'ChatWebsiteId':_0x2d1461[_0x0a63('0x5d')]['id'],'closed':![]};if(_0x2d1461['body'][_0x0a63('0xbb')]){_0x50606e[_0x0a63('0xbb')]=_0x2d1461[_0x0a63('0x60')]['threadId'];return db[_0x0a63('0xbc')][_0x0a63('0x5e')]({'where':_0x50606e})['then'](function(_0xe8e104){if(_0xe8e104){return[_0xe8e104,![]];}_0x366ffa[_0x0a63('0xbb')]=_0x2d1461[_0x0a63('0x60')][_0x0a63('0xbb')];_0x366ffa[_0x0a63('0xbd')]=_0x2d1461['body'][_0x0a63('0xbd')];return db['ChatInteraction'][_0x0a63('0x5f')](_0x366ffa)[_0x0a63('0x3b')](function(_0x339d6f){return[_0x339d6f,!![]];});});}_0x50606e['ContactId']=_0x3c6e08['id'];if(_0x2d1461['body']['interaction']&&_0x2d1461[_0x0a63('0x60')][_0x0a63('0xbe')]['id']){_0x50606e['id']=_0x2d1461['body'][_0x0a63('0xbe')]['id'];return db[_0x0a63('0xbc')][_0x0a63('0x5e')]({'where':_0x50606e})[_0x0a63('0x3b')](function(_0x2f2d8c){if(_0x2f2d8c){return[_0x2f2d8c,![]];}return db['ChatInteraction'][_0x0a63('0x5f')](_0x366ffa)['then'](function(_0x216ce9){return[_0x216ce9,!![]];});});}return db[_0x0a63('0xbc')][_0x0a63('0x5f')](_0x366ffa)[_0x0a63('0x3b')](function(_0x47f374){return[_0x47f374,!![]];});}})[_0x0a63('0xbf')](function(_0x2cf590,_0x143fa0){if(_0x2cf590){_0x14fade=_0x143fa0;if(!_0x143fa0){var _0x20e6ae={'from':(_0x2c5f2e[_0x0a63('0xac')][_0x0a63('0xb1')]||'')+'\x20'+(_0x2c5f2e[_0x0a63('0xac')]['lastName']||'')};if(_0x2d1461[_0x0a63('0x60')][_0x0a63('0xbb')]&&_0x2d1461[_0x0a63('0x60')][_0x0a63('0xc0')]&&_0x2d1461[_0x0a63('0x60')][_0x0a63('0xbb')]!=_0x2d1461[_0x0a63('0x60')][_0x0a63('0xc0')]){_0x20e6ae[_0x0a63('0xbb')]=_0x2d1461[_0x0a63('0x60')][_0x0a63('0xc0')];}return _0x2cf590[_0x0a63('0xc1')](_0x20e6ae);}else{return _0x2cf590;}}})[_0x0a63('0x3b')](function(_0x3572f6){_0x2c5f2e[_0x0a63('0xbe')]=_0x3572f6[_0x0a63('0x38')]({'plain':!![]});_0x2c5f2e[_0x0a63('0xbe')][_0x0a63('0xc2')]=_0x14fade;if(_0x2c5f2e[_0x0a63('0xbe')][_0x0a63('0xc2')]){if(_0x2c5f2e[_0x0a63('0xaa')][_0x0a63('0xc3')]){_0x2c5f2e[_0x0a63('0xa7')][_0x0a63('0xc4')]({'id':0x0,'priority':_0x2c5f2e[_0x0a63('0xa7')]['length']+0x1,'app':_0x0a63('0xc5'),'appdata':_0x0a63('0xc6'),'interval':'*,*,*,*'});}}return db[_0x0a63('0xc7')][_0x0a63('0x5f')]({'body':_0x2d1461[_0x0a63('0x60')]['body'],'ChatWebsiteId':_0x2d1461['params']['id'],'ChatInteractionId':_0x3572f6['id'],'direction':'in','ContactId':_0x2c5f2e[_0x0a63('0xac')]['id'],'AttachmentId':_0x2d1461[_0x0a63('0x60')][_0x0a63('0xc8')]});})[_0x0a63('0x3b')](function(_0x36f023){_0x2c5f2e['message']=_0x36f023;if(_0x2c5f2e['interaction'][_0x0a63('0xc9')]){return db[_0x0a63('0xca')][_0x0a63('0x5e')]({'attributes':['id',_0x0a63('0x3d')],'where':{'id':_0x2c5f2e[_0x0a63('0xbe')][_0x0a63('0xc9')]}})[_0x0a63('0x3b')](function(_0xa8a1c3){if(_0xa8a1c3){_0x2c5f2e[_0x0a63('0xa7')][_0x0a63('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xa8a1c3[_0x0a63('0x3d')]+','+(_0x2c5f2e[_0x0a63('0xaa')]['waitForTheAssignedAgent']||0xa),'interval':_0x0a63('0xcc')});_0x2c5f2e[_0x0a63('0xcd')]=!![];}return respondWithRpcPromise(_0x0a63('0xce'),'startRouting',_0x2c5f2e);});}return respondWithRpcPromise(_0x0a63('0xce'),_0x0a63('0xcf'),_0x2c5f2e);})[_0x0a63('0x3b')](function(_0x47f131){respondWithRpcPromise(_0x0a63('0xd0'),_0x0a63('0xd0'),{'event':_0x0a63('0x90'),'message':_0x47f131},client9002);return _0x47f131;})[_0x0a63('0x3b')](respondWithResult(_0xa9a7a7,null))[_0x0a63('0x2e')](handleError(_0xa9a7a7,null));};exports[_0x0a63('0xd1')]=function(_0x2e987d,_0x35d5d9,_0x375fbc){var _0x10ab30,_0x53c221,_0x38f67f;var _0xe3d8ee=[];var _0x3fc592=[];var _0xb8c44a={};return db['CmContact']['describe']()[_0x0a63('0x3b')](function(_0x2e0c5b){if(!_0x2e0c5b){throw new db[(_0x0a63('0x21'))]['ValidationError'](_0x0a63('0xd2'));}_0x3fc592=_[_0x0a63('0x99')](_[_0x0a63('0x47')](_0x2e0c5b),['createdAt',_0x0a63('0x98')]);_0xe3d8ee=_[_0x0a63('0x99')](_[_0x0a63('0x47')](_0x2e0c5b),['createdAt',_0x0a63('0x98'),'CompanyId','ListId']);if(_0x2e987d[_0x0a63('0x60')]['id']){delete _0x2e987d[_0x0a63('0x60')]['id'];}if(_[_0x0a63('0x82')](_0x2e987d[_0x0a63('0x60')][_0x0a63('0x9c')])){throw _0x35d5d9[_0x0a63('0x2f')](0x1f4)['send'](new db[(_0x0a63('0x21'))]['ValidationError'](_0x0a63('0x9d')));}if(_[_0x0a63('0x82')](_0x2e987d['body'][_0x0a63('0x60')])||_0x2e987d[_0x0a63('0x60')][_0x0a63('0x60')]===''){throw _0x35d5d9[_0x0a63('0x2f')](0x1f4)[_0x0a63('0x3e')](new db[(_0x0a63('0x21'))][(_0x0a63('0x22'))](_0x0a63('0x9e')));}if(_[_0x0a63('0x82')](_0x2e987d['body'][_0x0a63('0xd3')])){throw _0x35d5d9['status'](0x1f4)[_0x0a63('0x3e')](new db['Sequelize'][(_0x0a63('0x22'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe3d8ee));}if(!_[_0x0a63('0xa0')](_0xe3d8ee,_0x2e987d[_0x0a63('0x60')][_0x0a63('0xd3')])){throw _0x35d5d9[_0x0a63('0x2f')](0x1f4)[_0x0a63('0x3e')](new db[(_0x0a63('0x21'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe3d8ee));}_0xb8c44a[_0x2e987d['body'][_0x0a63('0xd3')]]=_0x2e987d[_0x0a63('0x60')]['from'];})[_0x0a63('0x3b')](function(){return db[_0x0a63('0x42')]['find']({'where':{'id':_0x2e987d[_0x0a63('0x5d')]['id']},'include':[{'model':db[_0x0a63('0xa3')],'as':_0x0a63('0xa4')}]});})[_0x0a63('0x3b')](handleEntityNotFound(_0x35d5d9,null))['then'](function(_0x5a44a1){if(_0x5a44a1&&_0x5a44a1[_0x0a63('0xa4')]){_0x53c221=_0x5a44a1;var _0x10d29e=_[_0x0a63('0x18')](_0x2e987d[_0x0a63('0x60')],{'firstName':_0x2e987d[_0x0a63('0x60')]['from'],'phone':_0x2e987d[_0x0a63('0x60')]['from'],'ListId':_0x5a44a1[_0x0a63('0x9b')]});_0x10d29e[_0x2e987d[_0x0a63('0x60')][_0x0a63('0xd3')]]=_0x2e987d[_0x0a63('0x60')][_0x0a63('0x9c')];return db[_0x0a63('0xa5')][_0x0a63('0xd4')]({'where':_0xb8c44a,'defaults':_0x10d29e});}})[_0x0a63('0xbf')](function(_0x775fac){if(_0x775fac){_0x38f67f=_0x775fac;var _0x4745f7=fs[_0x0a63('0xd5')](path['join'](config[_0x0a63('0x7e')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x4e1d86=ejs[_0x0a63('0xd6')](_0x4745f7,{'body':_['toPairs'](_0x2e987d[_0x0a63('0x60')][_0x0a63('0x60')]),'bodyTitle':_0x53c221[_0x0a63('0xd7')]});return db['ChatOfflineMessage'][_0x0a63('0x5f')]({'body':_0x4e1d86,'ContactId':_0x775fac['id'],'ChatWebsiteId':_0x53c221['id']});}})[_0x0a63('0x3b')](function(_0x98d76){if(_0x98d76){_0x10ab30=_0x98d76;return db['MailAccount'][_0x0a63('0x6b')]({'where':{'service':!![]},'include':[{'model':db[_0x0a63('0xd8')],'as':_0x0a63('0xd9'),'raw':!![]}]});}})[_0x0a63('0x3b')](function(_0x2d533f){if(_0x2d533f&&_0x2d533f[_0x0a63('0xd9')]&&_0x53c221[_0x0a63('0xda')]){var _0x95c5ba={'tls':{'rejectUnauthorized':![]}};if(_0x2d533f[_0x0a63('0xd9')]['service']){_0x95c5ba[_0x0a63('0xdb')]=_0x2d533f[_0x0a63('0xd9')][_0x0a63('0xdb')];}else{_0x95c5ba['host']=_0x2d533f[_0x0a63('0xd9')][_0x0a63('0xdc')];_0x95c5ba[_0x0a63('0xdd')]=_0x2d533f[_0x0a63('0xd9')]['port'];_0x95c5ba[_0x0a63('0xde')]=_0x2d533f[_0x0a63('0xd9')]['secure'];}if(_0x2d533f[_0x0a63('0xd9')]['authentication']){_0x95c5ba[_0x0a63('0xdf')]={'user':_0x2d533f[_0x0a63('0xd9')][_0x0a63('0x63')],'pass':_0x2d533f[_0x0a63('0xd9')][_0x0a63('0xe0')]};}return respondWithRpcPromise('SendMail',_0x0a63('0xe1'),{'account':_0x95c5ba,'message':{'from':util['format'](_0x0a63('0xe2'),_0x2d533f[_0x0a63('0x3d')],_0x2d533f[_0x0a63('0xe3')]||_0x2d533f[_0x0a63('0xd9')][_0x0a63('0x63')]),'to':_0x53c221[_0x0a63('0xda')],'subject':_0x53c221['offlineMessageSubject'],'text':_0x10ab30[_0x0a63('0x60')]}},client9003)['then'](function(){return _0x10ab30;})['catch'](function(_0x3eb74d){console['error'](_0x3eb74d);});}})[_0x0a63('0x3b')](function(){if(_0x10ab30){return _0x10ab30;}})['then'](respondWithResult(_0x35d5d9,null))[_0x0a63('0x2e')](handleError(_0x35d5d9,null));};exports[_0x0a63('0xe4')]=function(_0x41ee1c,_0x2175e3,_0x526213){return db[_0x0a63('0xbc')]['find']({'where':{'id':_0x41ee1c[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x2175e3,null))['then'](function(_0x31d646){if(_0x31d646){return _0x31d646[_0x0a63('0xe4')](_0x41ee1c[_0x0a63('0x60')][_0x0a63('0xe5')],_['omit'](_0x41ee1c[_0x0a63('0x60')],[_0x0a63('0xe5'),'id'])||{});}})[_0x0a63('0x3b')](respondWithResult(_0x2175e3,null))[_0x0a63('0x2e')](handleError(_0x2175e3,null));};exports['getInteractions']=function(_0x377419,_0x50b925,_0x14b792){var _0x3e47c0={'raw':![],'where':{}};var _0x1e310f={};var _0x179b54={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a63('0x6b')]({'where':{'id':_0x377419[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x50b925,null))[_0x0a63('0x3b')](function(_0x452c8c){if(_0x452c8c){_0x1e310f[_0x0a63('0x4a')]=_[_0x0a63('0x47')](db[_0x0a63('0xbc')][_0x0a63('0x43')]);_0x1e310f[_0x0a63('0x46')]=_[_0x0a63('0x47')](_0x377419[_0x0a63('0x46')]);_0x1e310f[_0x0a63('0x48')]=_['intersection'](_0x1e310f[_0x0a63('0x4a')],_0x1e310f[_0x0a63('0x46')]);_0x3e47c0['attributes']=_[_0x0a63('0x49')](_0x1e310f['model'],qs['fields'](_0x377419[_0x0a63('0x46')]['fields']));_0x3e47c0['attributes']=_0x3e47c0[_0x0a63('0x4b')][_0x0a63('0x4d')]?_0x3e47c0[_0x0a63('0x4b')]:_0x1e310f[_0x0a63('0x4a')];if(!_0x377419[_0x0a63('0x46')]['hasOwnProperty']('nolimit')){_0x3e47c0[_0x0a63('0x32')]=qs['limit'](_0x377419[_0x0a63('0x46')][_0x0a63('0x32')]);_0x3e47c0[_0x0a63('0x31')]=qs[_0x0a63('0x31')](_0x377419[_0x0a63('0x46')][_0x0a63('0x31')]);}_0x3e47c0[_0x0a63('0x4f')]=qs[_0x0a63('0x50')](_0x377419[_0x0a63('0x46')]['sort']);_0x3e47c0['where']=qs['filters'](_[_0x0a63('0x52')](_0x377419[_0x0a63('0x46')],_0x1e310f[_0x0a63('0x48')]));_0x3e47c0['where'][_0x0a63('0x6e')]=_0x452c8c['id'];if(_0x377419[_0x0a63('0x46')][_0x0a63('0x53')]){_0x3e47c0[_0x0a63('0x51')]=_[_0x0a63('0x54')](_0x3e47c0[_0x0a63('0x51')],{'$or':_[_0x0a63('0x41')](_0x3e47c0['attributes'],function(_0x32cc24){var _0x3d9cb0={};_0x3d9cb0[_0x32cc24]={'$like':'%'+_0x377419[_0x0a63('0x46')][_0x0a63('0x53')]+'%'};return _0x3d9cb0;})});}_0x3e47c0=_[_0x0a63('0x54')]({},_0x3e47c0,_0x377419[_0x0a63('0x57')]);return db[_0x0a63('0xbc')][_0x0a63('0x58')]({'where':_0x3e47c0[_0x0a63('0x51')]})[_0x0a63('0x3b')](function(_0x1e146e){_0x179b54[_0x0a63('0x58')]=_0x1e146e;if(_0x377419[_0x0a63('0x46')]['includeAll']){_0x3e47c0[_0x0a63('0x5a')]=[{'model':db[_0x0a63('0xa5')],'as':'Contact','required':![]},{'model':db[_0x0a63('0xca')],'as':_0x0a63('0xe6'),'attributes':[_0x0a63('0x3d'),_0x0a63('0xe7'),_0x0a63('0xe8')],'required':![]},{'model':db[_0x0a63('0xe9')],'as':_0x0a63('0xea'),'attributes':['id',_0x0a63('0x3d'),'color'],'where':_0x377419[_0x0a63('0x46')][_0x0a63('0xeb')]?{'id':_0x377419[_0x0a63('0x46')]['tag']}:undefined,'required':_0x377419[_0x0a63('0x46')][_0x0a63('0xeb')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x3e47c0);})[_0x0a63('0x3b')](function(_0x21ec52){_0x179b54['rows']=_0x21ec52;return _0x179b54;});}})[_0x0a63('0x3b')](respondWithFilteredResult(_0x50b925,_0x3e47c0))[_0x0a63('0x2e')](handleError(_0x50b925,null));};function iftimePromise(_0x39d9c0,_0x2a46f7){return respondWithRpcPromise('Command',_0x0a63('0xec'),{'command':_0x2a46f7[_0x0a63('0xed')]?util[_0x0a63('0xb6')](_0x0a63('0xee'),_0x39d9c0['interval'],_0x2a46f7['timezone']):util[_0x0a63('0xb6')](_0x0a63('0xef'),_0x39d9c0['interval'])},client9002)[_0x0a63('0x3b')](function(_0x474dad){var _0x41f52f=_0x474dad&&_0x474dad[_0x0a63('0xf0')]('true')>=0x0?!![]:![];logger[_0x0a63('0x25')](_0x0a63('0xf1'),_0x2a46f7['id'],_0x39d9c0['id'],_0x39d9c0[_0x0a63('0xf2')],_0x41f52f?_0x0a63('0xf3'):_0x0a63('0xf4'),_0x2a46f7[_0x0a63('0xed')]?_0x2a46f7[_0x0a63('0xed')]:_0x0a63('0xf5'));return _0x41f52f;})['catch'](function(_0x37c557){logger[_0x0a63('0x29')](_0x0a63('0xf1'),_0x2a46f7['id'],_0x39d9c0['id'],_0x39d9c0['interval'],util['inspect'](_0x37c557,{'showHidden':![],'depth':null}),_0x2a46f7[_0x0a63('0xed')]?_0x2a46f7[_0x0a63('0xed')]:_0x0a63('0xf5'));return![];});}exports[_0x0a63('0xec')]=function(_0x5c65ed,_0xc2d592,_0x2f0332){var _0x486230=0x0;var _0x5043eb=0x0;var _0xfab3d3=![];var _0x49cd9a;var _0x3b965a;return db['ChatWebsite'][_0x0a63('0x5e')]({'where':{'id':_0x5c65ed[_0x0a63('0x5d')]['id']},'include':[{'model':db[_0x0a63('0xf6')],'as':_0x0a63('0xf6'),'include':[{'model':db['Interval'],'as':_0x0a63('0xf7'),'attributes':['id',_0x0a63('0xf2')],'raw':!![]}]}]})[_0x0a63('0x3b')](handleEntityNotFound(_0xc2d592,null))['then'](function(_0x3037f3){if(_0x3037f3){_0x49cd9a=_0x3037f3;return _0x3037f3[_0x0a63('0xf8')]({'raw':!![]});}})[_0x0a63('0x3b')](function(_0x2c915e){if(_0x49cd9a){if(_0x2c915e){_0x3b965a=_0x2c915e;}}return require(_0x0a63('0x80'))[_0x0a63('0x81')]();})[_0x0a63('0x3b')](function(_0x3ee769){if(_0x3ee769){_0x5043eb=_0x3ee769['virtual'];_0xfab3d3=_0x3ee769[_0x0a63('0xf9')];}})[_0x0a63('0x3b')](function(){return db[_0x0a63('0xbc')]['count']({'where':{'closed':![]}});})[_0x0a63('0x3b')](function(_0x5efe1e){_0x486230=_0x5efe1e;if(_0x5043eb&&_0x5efe1e>_0x5043eb){return db['License'][_0x0a63('0x6b')]({'where':{'id':0x1}})[_0x0a63('0x3b')](function(_0x2a9648){if(_0x2a9648){_0x2a9648[_0x0a63('0xfa')](_0x0a63('0xfb'));}});}})['then'](function(){if(_0x49cd9a[_0x0a63('0xf6')]&&_0x49cd9a[_0x0a63('0xf6')][_0x0a63('0xf7')]){var _0x2d2595=[];for(var _0x4fbd04=0x0;_0x4fbd04<_0x49cd9a[_0x0a63('0xf6')][_0x0a63('0xf7')][_0x0a63('0x4d')];_0x4fbd04++){var _0x12bd6f=_0x49cd9a[_0x0a63('0xf6')][_0x0a63('0xf7')][_0x4fbd04]['get']({'plain':!![]});_0x2d2595[_0x0a63('0xc4')](iftimePromise(_0x12bd6f,_0x49cd9a));}return BPromise[_0x0a63('0xfc')](_0x2d2595)[_0x0a63('0x3b')](function(_0x377b12){return _[_0x0a63('0xfd')](_0x377b12);});}else{return!![];}})[_0x0a63('0x3b')](function(_0xa60a1a){var _0x25c4dc=fs[_0x0a63('0xd5')](path[_0x0a63('0x7d')](config[_0x0a63('0x7e')],_0x0a63('0xfe')),_0x0a63('0xff'));var _0x27f8c4={'remote':_0x49cd9a[_0x0a63('0x100')],'query':querystring['stringify'](_[_0x0a63('0x54')](_0x49cd9a['get']({'plain':!![]}),{'customerIp':_0x5c65ed[_0x0a63('0x93')][_0x0a63('0xaf')]||_0x5c65ed['headers']['x-real-ip']||_0x5c65ed[_0x0a63('0x101')][_0x0a63('0x102')]||_0x5c65ed['ip'],'referer':_0x5c65ed[_0x0a63('0x93')][_0x0a63('0xb4')],'openedInteractions':_0x486230,'maxInteractions':_0x5043eb,'virtual':_0xfab3d3[_0x0a63('0x103')],'online':_0xa60a1a,'custom':_0xfab3d3}))[_0x0a63('0x104')](/'/g,'\x5c\x27')};_0xc2d592[_0x0a63('0x3e')](ejs[_0x0a63('0xd6')](Mustache[_0x0a63('0xd6')](_0x25c4dc,_0x27f8c4),{'proactiveActions':_0x3b965a,'alignment':_0x49cd9a[_0x0a63('0x105')],'verticalAlignment':_0x49cd9a[_0x0a63('0x106')],'div_color':_0x49cd9a[_0x0a63('0x107')],'text_color':_0x49cd9a[_0x0a63('0x108')]}));})[_0x0a63('0x2e')](handleError(_0xc2d592,null));};exports[_0x0a63('0x109')]=function(_0x1c179e,_0x17141d,_0x4737dd){return db[_0x0a63('0x42')][_0x0a63('0x6b')]({'where':{'id':_0x1c179e['params']['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x17141d,null))['then'](function(_0x3371f1){if(_0x3371f1){return db['sequelize'][_0x0a63('0x10a')](function(_0xbd0439){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x1c179e[_0x0a63('0x5d')]['id']},'transaction':_0xbd0439})[_0x0a63('0x3b')](function(_0x509293){var _0x3bdb03=_['map'](_0x1c179e['body'],function(_0x471d96){_0x471d96[_0x0a63('0x6e')]=_0x1c179e[_0x0a63('0x5d')]['id'];return _0x471d96;});return db[_0x0a63('0x10b')][_0x0a63('0x10c')](_0x3bdb03,{'transaction':_0xbd0439});});})[_0x0a63('0x3b')](function(){return db[_0x0a63('0x10b')][_0x0a63('0x10d')]({'where':{'ChatWebsiteId':_0x1c179e[_0x0a63('0x5d')]['id']},'order':_0x0a63('0xa8')});});}})['then'](respondWithResult(_0x17141d,null))['catch'](handleError(_0x17141d,null));};exports[_0x0a63('0x10e')]=function(_0x6458ae,_0x5ef77a,_0x3f93dc){var _0x41ef4a={};var _0x5a232b={};var _0x16af45;var _0x5a68c6;return db[_0x0a63('0x42')]['findOne']({'where':{'id':_0x6458ae[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x5ef77a,null))[_0x0a63('0x3b')](function(_0x56de50){if(_0x56de50){_0x16af45=_0x56de50;_0x5a232b['model']=_['keys'](db[_0x0a63('0x10b')][_0x0a63('0x43')]);_0x5a232b[_0x0a63('0x46')]=_[_0x0a63('0x47')](_0x6458ae['query']);_0x5a232b[_0x0a63('0x48')]=_['intersection'](_0x5a232b[_0x0a63('0x4a')],_0x5a232b[_0x0a63('0x46')]);_0x41ef4a[_0x0a63('0x4b')]=_[_0x0a63('0x49')](_0x5a232b[_0x0a63('0x4a')],qs[_0x0a63('0x4c')](_0x6458ae['query'][_0x0a63('0x4c')]));_0x41ef4a['attributes']=_0x41ef4a[_0x0a63('0x4b')][_0x0a63('0x4d')]?_0x41ef4a['attributes']:_0x5a232b[_0x0a63('0x4a')];_0x41ef4a[_0x0a63('0x4f')]=qs[_0x0a63('0x50')](_0x6458ae[_0x0a63('0x46')]['sort']);_0x41ef4a[_0x0a63('0x51')]=qs[_0x0a63('0x48')](_[_0x0a63('0x52')](_0x6458ae[_0x0a63('0x46')],_0x5a232b[_0x0a63('0x48')]));if(_0x6458ae[_0x0a63('0x46')][_0x0a63('0x53')]){_0x41ef4a[_0x0a63('0x51')]=_[_0x0a63('0x54')](_0x41ef4a[_0x0a63('0x51')],{'$or':_['map'](_0x41ef4a[_0x0a63('0x4b')],function(_0x2006ca){var _0x334e7f={};_0x334e7f[_0x2006ca]={'$like':'%'+_0x6458ae[_0x0a63('0x46')][_0x0a63('0x53')]+'%'};return _0x334e7f;})});}_0x41ef4a=_[_0x0a63('0x54')]({},_0x41ef4a,_0x6458ae[_0x0a63('0x57')]);return _0x16af45[_0x0a63('0x10e')](_0x41ef4a);}})['then'](function(_0x580ac8){if(_0x580ac8){_0x5a68c6=_0x580ac8[_0x0a63('0x4d')];if(!_0x6458ae['query'][_0x0a63('0x6d')](_0x0a63('0x4e'))){_0x41ef4a[_0x0a63('0x32')]=qs[_0x0a63('0x32')](_0x6458ae[_0x0a63('0x46')][_0x0a63('0x32')]);_0x41ef4a[_0x0a63('0x31')]=qs[_0x0a63('0x31')](_0x6458ae['query'][_0x0a63('0x31')]);}return _0x16af45[_0x0a63('0x10e')](_0x41ef4a);}})[_0x0a63('0x3b')](function(_0xfb9693){if(_0xfb9693){return _0xfb9693?{'count':_0x5a68c6,'rows':_0xfb9693}:null;}})[_0x0a63('0x3b')](respondWithResult(_0x5ef77a,null))[_0x0a63('0x2e')](handleError(_0x5ef77a,null));};exports[_0x0a63('0x10f')]=function(_0x4bd5a9,_0x3d1022,_0x167be4){return db[_0x0a63('0x110')][_0x0a63('0x5e')]({'where':{'id':_0x4bd5a9['params']['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x3d1022,null))[_0x0a63('0x3b')](function(_0x5ad201){if(_0x5ad201){return _0x5ad201['addProactiveActions'](_0x4bd5a9['body'][_0x0a63('0xe5')],_[_0x0a63('0x111')](_0x4bd5a9[_0x0a63('0x60')],[_0x0a63('0xe5'),'id'])||{});}})[_0x0a63('0x3b')](respondWithResult(_0x3d1022,null))[_0x0a63('0x2e')](handleError(_0x3d1022,null));};exports['getProactiveActions']=function(_0x25ae41,_0x676011,_0x4e7b87){var _0x34697a={};var _0x5daf79={};var _0x201b7c;var _0x1677de;return db['ChatWebsite'][_0x0a63('0x6b')]({'where':{'id':_0x25ae41[_0x0a63('0x5d')]['id']}})['then'](handleEntityNotFound(_0x676011,null))[_0x0a63('0x3b')](function(_0x4e73aa){if(_0x4e73aa){_0x201b7c=_0x4e73aa;_0x5daf79['model']=_[_0x0a63('0x47')](db[_0x0a63('0x112')][_0x0a63('0x43')]);_0x5daf79[_0x0a63('0x46')]=_['keys'](_0x25ae41[_0x0a63('0x46')]);_0x5daf79[_0x0a63('0x48')]=_[_0x0a63('0x49')](_0x5daf79['model'],_0x5daf79[_0x0a63('0x46')]);_0x34697a[_0x0a63('0x4b')]=_[_0x0a63('0x49')](_0x5daf79['model'],qs['fields'](_0x25ae41[_0x0a63('0x46')][_0x0a63('0x4c')]));_0x34697a['attributes']=_0x34697a[_0x0a63('0x4b')][_0x0a63('0x4d')]?_0x34697a[_0x0a63('0x4b')]:_0x5daf79[_0x0a63('0x4a')];_0x34697a[_0x0a63('0x4f')]=qs[_0x0a63('0x50')](_0x25ae41[_0x0a63('0x46')]['sort']);_0x34697a['where']=qs[_0x0a63('0x48')](_['pick'](_0x25ae41['query'],_0x5daf79[_0x0a63('0x48')]));if(_0x25ae41['query'][_0x0a63('0x53')]){_0x34697a[_0x0a63('0x51')]=_[_0x0a63('0x54')](_0x34697a[_0x0a63('0x51')],{'$or':_[_0x0a63('0x41')](_0x34697a[_0x0a63('0x4b')],function(_0x142974){var _0x3d24ef={};_0x3d24ef[_0x142974]={'$like':'%'+_0x25ae41['query'][_0x0a63('0x53')]+'%'};return _0x3d24ef;})});}_0x34697a=_[_0x0a63('0x54')]({},_0x34697a,_0x25ae41[_0x0a63('0x57')]);return _0x201b7c[_0x0a63('0xf8')](_0x34697a);}})[_0x0a63('0x3b')](function(_0x555de8){if(_0x555de8){_0x1677de=_0x555de8[_0x0a63('0x4d')];if(!_0x25ae41['query'][_0x0a63('0x6d')](_0x0a63('0x4e'))){_0x34697a['limit']=qs[_0x0a63('0x32')](_0x25ae41[_0x0a63('0x46')]['limit']);_0x34697a[_0x0a63('0x31')]=qs[_0x0a63('0x31')](_0x25ae41[_0x0a63('0x46')][_0x0a63('0x31')]);}return _0x201b7c['getProactiveActions'](_0x34697a);}})[_0x0a63('0x3b')](function(_0x3fb326){if(_0x3fb326){return _0x3fb326?{'count':_0x1677de,'rows':_0x3fb326}:null;}})[_0x0a63('0x3b')](respondWithResult(_0x676011,null))['catch'](handleError(_0x676011,null));};exports[_0x0a63('0x113')]=function(_0xa0d66,_0x2f151d,_0x356888){var _0x2750ea=_0xa0d66[_0x0a63('0x46')][_0x0a63('0x114')]===_0x0a63('0x115')?'offlineForm':_0x0a63('0x116');return db[_0x0a63('0x42')][_0x0a63('0x5e')]({'attributes':['id',_0x2750ea],'where':{'id':_0xa0d66[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x2f151d,null))[_0x0a63('0x3b')](function(_0x572195){if(_0x572195){var _0x758b95=_0x572195[_0x2750ea];var _0x4005e1=_0x758b95&&_0x758b95['items']?_0x758b95[_0x0a63('0x117')]:[];_0x2f151d[_0x0a63('0x3e')]({'fromKey':_['isNil'](_0x758b95[_0x0a63('0x118')])?undefined:_0x758b95[_0x0a63('0x118')],'count':_0x4005e1[_0x0a63('0x4d')],'rows':_0x4005e1});}})[_0x0a63('0x2e')](handleError(_0x2f151d,null));};exports[_0x0a63('0x119')]=function(_0x251a3d,_0x5e448e,_0x1731e7){var _0x4b6d28={'raw':![],'where':{}};var _0x52f164={};var _0x10a9ef={'count':0x0,'rows':[]};return db[_0x0a63('0x42')][_0x0a63('0x6b')]({'where':{'id':_0x251a3d[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x5e448e,null))[_0x0a63('0x3b')](function(_0x35aa65){if(_0x35aa65){_0x52f164[_0x0a63('0x4a')]=_[_0x0a63('0x47')](db[_0x0a63('0x11a')]['rawAttributes']);_0x52f164[_0x0a63('0x46')]=_[_0x0a63('0x47')](_0x251a3d[_0x0a63('0x46')]);_0x52f164['filters']=_[_0x0a63('0x49')](_0x52f164[_0x0a63('0x4a')],_0x52f164[_0x0a63('0x46')]);_0x4b6d28[_0x0a63('0x4b')]=_[_0x0a63('0x49')](_0x52f164['model'],qs['fields'](_0x251a3d[_0x0a63('0x46')][_0x0a63('0x4c')]));_0x4b6d28[_0x0a63('0x4b')]=_0x4b6d28[_0x0a63('0x4b')][_0x0a63('0x4d')]?_0x4b6d28['attributes']:_0x52f164['model'];if(!_0x251a3d[_0x0a63('0x46')][_0x0a63('0x6d')]('nolimit')){_0x4b6d28[_0x0a63('0x32')]=qs[_0x0a63('0x32')](_0x251a3d[_0x0a63('0x46')][_0x0a63('0x32')]);_0x4b6d28['offset']=qs[_0x0a63('0x31')](_0x251a3d['query'][_0x0a63('0x31')]);}_0x4b6d28[_0x0a63('0x4f')]=qs[_0x0a63('0x50')](_0x251a3d[_0x0a63('0x46')]['sort']);_0x4b6d28[_0x0a63('0x51')]=qs[_0x0a63('0x48')](_[_0x0a63('0x52')](_0x251a3d[_0x0a63('0x46')],_0x52f164[_0x0a63('0x48')]));_0x4b6d28[_0x0a63('0x51')][_0x0a63('0x6e')]=_0x35aa65['id'];if(_0x251a3d[_0x0a63('0x46')][_0x0a63('0x53')]){_0x4b6d28[_0x0a63('0x51')]=_[_0x0a63('0x54')](_0x4b6d28[_0x0a63('0x51')],{'$or':_[_0x0a63('0x41')](_0x4b6d28[_0x0a63('0x4b')],function(_0x3bb430){var _0x5dbe71={};_0x5dbe71[_0x3bb430]={'$like':'%'+_0x251a3d[_0x0a63('0x46')][_0x0a63('0x53')]+'%'};return _0x5dbe71;})});}_0x4b6d28=_['merge']({},_0x4b6d28,_0x251a3d[_0x0a63('0x57')]);return db[_0x0a63('0x11a')][_0x0a63('0x58')]({'where':_0x4b6d28[_0x0a63('0x51')]})[_0x0a63('0x3b')](function(_0x387738){_0x10a9ef[_0x0a63('0x58')]=_0x387738;if(_0x251a3d['query'][_0x0a63('0x59')]){_0x4b6d28['include']=[{'all':!![]}];}else{_0x4b6d28['include']=[{'model':db[_0x0a63('0xa5')],'as':_0x0a63('0x11b'),'required':![]}];}return db[_0x0a63('0x11a')][_0x0a63('0x5b')](_0x4b6d28);})['then'](function(_0x261994){_0x10a9ef[_0x0a63('0x6f')]=_0x261994;return _0x10a9ef;});}})[_0x0a63('0x3b')](respondWithFilteredResult(_0x5e448e,_0x4b6d28))['catch'](handleError(_0x5e448e,null));};exports['addAgents']=function(_0x5313c7,_0x368d42,_0x9462c8){return db[_0x0a63('0x42')][_0x0a63('0x5e')]({'where':{'id':_0x5313c7[_0x0a63('0x5d')]['id']}})['then'](handleEntityNotFound(_0x368d42,null))[_0x0a63('0x3b')](function(_0x5ecc7d){if(_0x5ecc7d){return _0x5ecc7d['addAgents'](_0x5313c7['body']['ids'],_[_0x0a63('0x111')](_0x5313c7[_0x0a63('0x60')],['ids','id'])||{})[_0x0a63('0xbf')](function(_0x5821a5){for(var _0x11b6ce=0x0;_0x11b6ce<_0x5313c7[_0x0a63('0x60')][_0x0a63('0xe5')][_0x0a63('0x4d')];_0x11b6ce+=0x1){socket['emit'](_0x0a63('0x11c'),{'UserId':_0x5313c7[_0x0a63('0x60')][_0x0a63('0xe5')][_0x11b6ce],'ChatWebsiteId':_0x5313c7[_0x0a63('0x5d')]['id']});}return _0x5821a5;});}})[_0x0a63('0x3b')](respondWithResult(_0x368d42,null))['catch'](handleError(_0x368d42,null));};exports[_0x0a63('0x11d')]=function(_0x49554e,_0x40ef95,_0xa658af){return db['ChatWebsite'][_0x0a63('0x5e')]({'where':{'id':_0x49554e[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x40ef95,null))['then'](function(_0x204a73){if(_0x204a73){return _0x204a73[_0x0a63('0x11d')](_0x49554e['query'][_0x0a63('0xe5')])[_0x0a63('0x3b')](function(){if(_[_0x0a63('0x11e')](_0x49554e['query']['ids'])){for(var _0x11bd8a=0x0;_0x11bd8a<_0x49554e[_0x0a63('0x46')][_0x0a63('0xe5')][_0x0a63('0x4d')];_0x11bd8a+=0x1){socket['emit'](_0x0a63('0x11f'),{'UserId':Number(_0x49554e['query']['ids'][_0x11bd8a]),'ChatWebsiteId':Number(_0x49554e['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x49554e[_0x0a63('0x46')][_0x0a63('0xe5')]),'ChatWebsiteId':Number(_0x49554e[_0x0a63('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x40ef95,null))['catch'](handleError(_0x40ef95,null));};exports[_0x0a63('0x120')]=function(_0x192b6d,_0x18f52f,_0x2b78dd){var _0x420cf5={};var _0x303c0a={};var _0x33188a;var _0x2ef2d8;return db[_0x0a63('0x42')][_0x0a63('0x6b')]({'where':{'id':_0x192b6d[_0x0a63('0x5d')]['id']}})[_0x0a63('0x3b')](handleEntityNotFound(_0x18f52f,null))[_0x0a63('0x3b')](function(_0x3bc8fb){if(_0x3bc8fb){_0x33188a=_0x3bc8fb;_0x303c0a['model']=_[_0x0a63('0x47')](db[_0x0a63('0xca')]['rawAttributes']);_0x303c0a[_0x0a63('0x46')]=_[_0x0a63('0x47')](_0x192b6d[_0x0a63('0x46')]);_0x303c0a[_0x0a63('0x48')]=_[_0x0a63('0x49')](_0x303c0a[_0x0a63('0x4a')],_0x303c0a[_0x0a63('0x46')]);_0x420cf5[_0x0a63('0x4b')]=_[_0x0a63('0x49')](_0x303c0a[_0x0a63('0x4a')],qs['fields'](_0x192b6d[_0x0a63('0x46')][_0x0a63('0x4c')]));_0x420cf5[_0x0a63('0x4b')]=_0x420cf5[_0x0a63('0x4b')]['length']?_0x420cf5[_0x0a63('0x4b')]:_0x303c0a[_0x0a63('0x4a')];_0x420cf5[_0x0a63('0x4f')]=qs['sort'](_0x192b6d[_0x0a63('0x46')][_0x0a63('0x50')]);_0x420cf5['where']=qs[_0x0a63('0x48')](_[_0x0a63('0x52')](_0x192b6d[_0x0a63('0x46')],_0x303c0a[_0x0a63('0x48')]));if(_0x192b6d['query'][_0x0a63('0x53')]){_0x420cf5['where']=_[_0x0a63('0x54')](_0x420cf5['where'],{'$or':_[_0x0a63('0x41')](_0x420cf5['attributes'],function(_0x3656e5){var _0x300a19={};_0x300a19[_0x3656e5]={'$like':'%'+_0x192b6d['query']['filter']+'%'};return _0x300a19;})});}_0x420cf5=_[_0x0a63('0x54')]({},_0x420cf5,_0x192b6d[_0x0a63('0x57')]);return _0x33188a[_0x0a63('0x120')](_0x420cf5);}})[_0x0a63('0x3b')](function(_0x56af97){if(_0x56af97){_0x2ef2d8=_0x56af97[_0x0a63('0x4d')];if(!_0x192b6d['query']['hasOwnProperty'](_0x0a63('0x4e'))){_0x420cf5[_0x0a63('0x32')]=qs['limit'](_0x192b6d[_0x0a63('0x46')][_0x0a63('0x32')]);_0x420cf5[_0x0a63('0x31')]=qs[_0x0a63('0x31')](_0x192b6d['query'][_0x0a63('0x31')]);}return _0x33188a[_0x0a63('0x120')](_0x420cf5);}})[_0x0a63('0x3b')](function(_0x121488){if(_0x121488){return _0x121488?{'count':_0x2ef2d8,'rows':_0x121488}:null;}})[_0x0a63('0x3b')](respondWithResult(_0x18f52f,null))[_0x0a63('0x2e')](handleError(_0x18f52f,null));}; \ No newline at end of file +var _0x973d=['Content-Range','apply','save','update','get','ChatWebsites','UserProfileResource','destroy','name','send','index','mandatoryDispositionPause','map','ChatWebsite','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','Pause','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','ChatWebsiteId','getDispositions','findOne','order','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','existsSync','server/files/images/logos/','getAvatar','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','download','getSystemAvatar','notify','headers','user-agent','getResult','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','DESC','ChatApplication','Applications','applications','list','orderBy','asc','account','contact','cf-connecting-ip','x-forwarded-for','first','x-real-port','referer','browser','version','unknown','format','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','interval','timezone','iftime\x20%s','info','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getLicense','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','textColor','addApplications','sequelize','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','limit','set'];(function(_0x2dc098,_0x48eb28){var _0x391d8d=function(_0x54bdb7){while(--_0x54bdb7){_0x2dc098['push'](_0x2dc098['shift']());}};_0x391d8d(++_0x48eb28);}(_0x973d,0xe4));var _0xd973=function(_0x5183aa,_0x54277c){_0x5183aa=_0x5183aa-0x0;var _0x73ac67=_0x973d[_0x5183aa];return _0x73ac67;};'use strict';var pdf=require(_0xd973('0x0'));var emlformat=require(_0xd973('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd973('0x2'));var jsonpatch=require(_0xd973('0x3'));var rp=require(_0xd973('0x4'));var moment=require(_0xd973('0x5'));var BPromise=require(_0xd973('0x6'));var Mustache=require(_0xd973('0x7'));var util=require(_0xd973('0x8'));var path=require(_0xd973('0x9'));var sox=require(_0xd973('0xa'));var csv=require(_0xd973('0xb'));var ejs=require(_0xd973('0xc'));var fs=require('fs');var _=require(_0xd973('0xd'));var squel=require(_0xd973('0xe'));var crypto=require('crypto');var jsforce=require(_0xd973('0xf'));var deskjs=require(_0xd973('0x10'));var toCsv=require(_0xd973('0xb'));var querystring=require(_0xd973('0x11'));var Papa=require(_0xd973('0x12'));var Redis=require('ioredis');var authService=require(_0xd973('0x13'));var qs=require(_0xd973('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd973('0x15'));var logger=require(_0xd973('0x16'))(_0xd973('0x17'));var utils=require(_0xd973('0x18'));var config=require(_0xd973('0x19'));var db=require('../../mysqldb')['db'];config[_0xd973('0x1a')]=_[_0xd973('0x1b')](config[_0xd973('0x1a')],{'host':_0xd973('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd973('0x1d'))['register'](socket);var jayson=require(_0xd973('0x1e'));var client=jayson[_0xd973('0x1f')][_0xd973('0x20')]({'port':0x232c});var client9002=jayson[_0xd973('0x1f')]['http']({'port':0x232a});var client9003=jayson[_0xd973('0x1f')]['http']({'port':0x232b});function checkPasswordPattern(_0x3d90cf,_0xde59e9,_0x2e83f5){if(_0x2e83f5){var _0x2566b3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2566b3['test'](_0xde59e9)){return _0x3d90cf;}else{throw new db['Sequelize'][(_0xd973('0x21'))](_0xd973('0x22'));}}else{return _0x3d90cf;}}function respondWithRpcPromise(_0x30db37,_0x4bf040,_0x3a564e,_0x128e1b){return new BPromise(function(_0x2ce34e,_0x2b9d0a){var _0x38a061=_0x128e1b||client;return _0x38a061['request'](_0x30db37,_0x3a564e)[_0xd973('0x23')](function(_0xaaf485){logger['info'](_0xd973('0x24'),_0x4bf040,_0xd973('0x25'));logger['debug'](_0xd973('0x26'),_0x4bf040,'request\x20sent',JSON[_0xd973('0x27')](_0xaaf485));if(_0xaaf485[_0xd973('0x28')]){if(_0xaaf485[_0xd973('0x28')][_0xd973('0x29')]===0x1f4){logger[_0xd973('0x28')](_0xd973('0x24'),_0x4bf040,_0xaaf485[_0xd973('0x28')][_0xd973('0x2a')]);return _0x2b9d0a(_0xaaf485['error'][_0xd973('0x2a')]);}logger[_0xd973('0x28')]('ChatWebsite,\x20%s,\x20%s',_0x4bf040,_0xaaf485[_0xd973('0x28')]['message']);return _0x2ce34e(_0xaaf485[_0xd973('0x28')]['message']);}else{logger['info'](_0xd973('0x24'),_0x4bf040,_0xd973('0x25'));_0x2ce34e(_0xaaf485['result'][_0xd973('0x2a')]);}})['catch'](function(_0xc34e88){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4bf040,_0xc34e88);_0x2b9d0a(_0xc34e88);});});}function respondWithStatusCode(_0x3ad670,_0x3939bd){_0x3939bd=_0x3939bd||0xcc;return function(_0x1ef6ef){if(_0x1ef6ef){return _0x3ad670[_0xd973('0x2b')](_0x3939bd);}return _0x3ad670[_0xd973('0x2c')](_0x3939bd)[_0xd973('0x2d')]();};}function respondWithResult(_0x39cd79,_0x34386a){_0x34386a=_0x34386a||0xc8;return function(_0x29d28f){if(_0x29d28f){return _0x39cd79['status'](_0x34386a)[_0xd973('0x2e')](_0x29d28f);}};}function respondWithFilteredResult(_0x2d777a,_0x168d0e){return function(_0x14d36a){if(_0x14d36a){var _0x470761=_0x14d36a['count'],_0x448919=_0x168d0e[_0xd973('0x2f')],_0xb245a3=_0x168d0e[_0xd973('0x2f')]+_0x168d0e[_0xd973('0x30')],_0x15a72c;if(_0xb245a3>=_0x470761){_0xb245a3=_0x470761;_0x15a72c=0xc8;}else{_0x15a72c=0xce;}_0x2d777a['status'](_0x15a72c);return _0x2d777a[_0xd973('0x31')](_0xd973('0x32'),_0x448919+'-'+_0xb245a3+'/'+_0x470761)['json'](_0x14d36a);}return null;};}function patchUpdates(_0x413ce0){return function(_0x3f69b8){try{jsonpatch[_0xd973('0x33')](_0x3f69b8,_0x413ce0,!![]);}catch(_0x5d4992){return BPromise['reject'](_0x5d4992);}return _0x3f69b8[_0xd973('0x34')]();};}function saveUpdates(_0x172742,_0x261177){return function(_0x23f81d){if(_0x23f81d){return _0x23f81d[_0xd973('0x35')](_0x172742)[_0xd973('0x23')](function(_0x2fb3cb){return _0x2fb3cb;});}return null;};}function removeEntity(_0x23f5fb,_0x57296a){return function(_0x26174c){if(_0x26174c){return _0x26174c['destroy']()[_0xd973('0x23')](function(){var _0x1a9217=_0x26174c[_0xd973('0x36')]({'plain':!![]});var _0x24b04d=_0xd973('0x37');return db[_0xd973('0x38')][_0xd973('0x39')]({'where':{'type':_0x24b04d,'resourceId':_0x1a9217['id']}})[_0xd973('0x23')](function(){return _0x26174c;});})[_0xd973('0x23')](function(){_0x23f5fb[_0xd973('0x2c')](0xcc)[_0xd973('0x2d')]();});}};}function handleEntityNotFound(_0x59e0cc,_0x4627ca){return function(_0x48d8e7){if(!_0x48d8e7){_0x59e0cc[_0xd973('0x2b')](0x194);}return _0x48d8e7;};}function handleError(_0x3fd5e6,_0x42a249){_0x42a249=_0x42a249||0x1f4;return function(_0x2acee4){logger[_0xd973('0x28')](_0x2acee4['stack']);if(_0x2acee4[_0xd973('0x3a')]){delete _0x2acee4[_0xd973('0x3a')];}_0x3fd5e6['status'](_0x42a249)[_0xd973('0x3b')](_0x2acee4);};}exports[_0xd973('0x3c')]=function(_0x26d3a4,_0x590a03){var _0x44c898={'include':[{'model':db['Pause'],'as':_0xd973('0x3d')}]},_0x51b350={},_0xef957d={'count':0x0,'rows':[]};var _0x5c77bf=_[_0xd973('0x3e')](db[_0xd973('0x3f')]['rawAttributes'],function(_0x3bcbea){return{'name':_0x3bcbea['fieldName'],'type':_0x3bcbea[_0xd973('0x40')][_0xd973('0x41')]};});_0x51b350[_0xd973('0x42')]=_[_0xd973('0x3e')](_0x5c77bf,_0xd973('0x3a'));_0x51b350[_0xd973('0x43')]=_['keys'](_0x26d3a4[_0xd973('0x43')]);_0x51b350[_0xd973('0x44')]=_[_0xd973('0x45')](_0x51b350[_0xd973('0x42')],_0x51b350[_0xd973('0x43')]);_0x44c898[_0xd973('0x46')]=_[_0xd973('0x45')](_0x51b350[_0xd973('0x42')],qs[_0xd973('0x47')](_0x26d3a4[_0xd973('0x43')][_0xd973('0x47')]));_0x44c898['attributes']=_0x44c898[_0xd973('0x46')][_0xd973('0x48')]?_0x44c898[_0xd973('0x46')]:_0x51b350[_0xd973('0x42')];if(!_0x26d3a4[_0xd973('0x43')][_0xd973('0x49')](_0xd973('0x4a'))){_0x44c898[_0xd973('0x30')]=qs[_0xd973('0x30')](_0x26d3a4[_0xd973('0x43')][_0xd973('0x30')]);_0x44c898[_0xd973('0x2f')]=qs[_0xd973('0x2f')](_0x26d3a4[_0xd973('0x43')][_0xd973('0x2f')]);}_0x44c898['order']=qs[_0xd973('0x4b')](_0x26d3a4[_0xd973('0x43')][_0xd973('0x4b')]);_0x44c898['where']=qs[_0xd973('0x44')](_[_0xd973('0x4c')](_0x26d3a4[_0xd973('0x43')],_0x51b350[_0xd973('0x44')]),_0x5c77bf);if(_0x26d3a4[_0xd973('0x43')][_0xd973('0x4d')]){_0x44c898[_0xd973('0x4e')]=_[_0xd973('0x4f')](_0x44c898['where'],{'$or':_[_0xd973('0x3e')](_0x5c77bf,function(_0x2dcd1f){if(_0x2dcd1f['type']!==_0xd973('0x50')){var _0x848576={};_0x848576[_0x2dcd1f['name']]={'$like':'%'+_0x26d3a4[_0xd973('0x43')]['filter']+'%'};return _0x848576;}})});}_0x44c898=_[_0xd973('0x4f')]({},_0x44c898,_0x26d3a4[_0xd973('0x51')]);var _0x1942ec={'where':_0x44c898[_0xd973('0x4e')]};return db[_0xd973('0x3f')][_0xd973('0x52')](_0x1942ec)[_0xd973('0x23')](function(_0x59c3a3){_0xef957d[_0xd973('0x52')]=_0x59c3a3;if(_0x26d3a4[_0xd973('0x43')][_0xd973('0x53')]){_0x44c898[_0xd973('0x54')]=[{'all':!![]}];}return db[_0xd973('0x3f')][_0xd973('0x55')](_0x44c898);})['then'](function(_0x22c907){_0xef957d[_0xd973('0x56')]=_0x22c907;return _0xef957d;})['then'](respondWithFilteredResult(_0x590a03,_0x44c898))[_0xd973('0x57')](handleError(_0x590a03,null));};exports[_0xd973('0x58')]=function(_0x174f6b,_0x317ed1){var _0x15c1e9={'raw':![],'where':{'id':_0x174f6b['params']['id']},'include':[{'model':db[_0xd973('0x59')],'as':_0xd973('0x3d')}]},_0x3a19a1={};_0x3a19a1[_0xd973('0x42')]=_[_0xd973('0x5a')](db['ChatWebsite'][_0xd973('0x5b')]);_0x3a19a1[_0xd973('0x43')]=_[_0xd973('0x5a')](_0x174f6b[_0xd973('0x43')]);_0x3a19a1[_0xd973('0x44')]=_[_0xd973('0x45')](_0x3a19a1[_0xd973('0x42')],_0x3a19a1[_0xd973('0x43')]);_0x15c1e9['attributes']=_[_0xd973('0x45')](_0x3a19a1['model'],qs[_0xd973('0x47')](_0x174f6b[_0xd973('0x43')][_0xd973('0x47')]));_0x15c1e9[_0xd973('0x46')]=_0x15c1e9[_0xd973('0x46')]['length']?_0x15c1e9[_0xd973('0x46')]:_0x3a19a1[_0xd973('0x42')];if(_0x174f6b['query'][_0xd973('0x53')]){_0x15c1e9[_0xd973('0x54')]=[{'all':!![]}];}_0x15c1e9=_[_0xd973('0x4f')]({},_0x15c1e9,_0x174f6b[_0xd973('0x51')]);return db['ChatWebsite'][_0xd973('0x5c')](_0x15c1e9)[_0xd973('0x23')](handleEntityNotFound(_0x317ed1,null))[_0xd973('0x23')](respondWithResult(_0x317ed1,null))[_0xd973('0x57')](handleError(_0x317ed1,null));};exports[_0xd973('0x5d')]=function(_0x1edf40,_0x50a26d){return db[_0xd973('0x3f')][_0xd973('0x5d')](_0x1edf40[_0xd973('0x5e')],{})['then'](function(_0x4c40c0){var _0x1c2f8e=_0x1edf40[_0xd973('0x5f')][_0xd973('0x36')]({'plain':!![]});if(!_0x1c2f8e)throw new Error(_0xd973('0x60'));if(_0x1c2f8e[_0xd973('0x61')]===_0xd973('0x5f')){var _0x565322=_0x4c40c0[_0xd973('0x36')]({'plain':!![]});var _0x3e77b3=_0xd973('0x37');return db[_0xd973('0x62')]['find']({'where':{'name':_0x3e77b3,'userProfileId':_0x1c2f8e[_0xd973('0x63')]},'raw':!![]})[_0xd973('0x23')](function(_0x2b33cd){if(_0x2b33cd&&_0x2b33cd[_0xd973('0x64')]===0x0){return db[_0xd973('0x38')][_0xd973('0x5d')]({'name':_0x565322['name'],'resourceId':_0x565322['id'],'type':_0x2b33cd['name'],'sectionId':_0x2b33cd['id']},{})[_0xd973('0x23')](function(){return _0x4c40c0;});}else{return _0x4c40c0;}})[_0xd973('0x57')](function(_0x1ee76f){logger[_0xd973('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ee76f);throw _0x1ee76f;});}return _0x4c40c0;})['then'](respondWithResult(_0x50a26d,0xc9))[_0xd973('0x57')](handleError(_0x50a26d,null));};exports['update']=function(_0x271f36,_0x320cf9){if(_0x271f36[_0xd973('0x5e')]['id']){delete _0x271f36[_0xd973('0x5e')]['id'];}return db['ChatWebsite'][_0xd973('0x5c')]({'where':{'id':_0x271f36[_0xd973('0x65')]['id']},'include':[{'model':db[_0xd973('0x59')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x320cf9,null))[_0xd973('0x23')](saveUpdates(_0x271f36[_0xd973('0x5e')],null))[_0xd973('0x23')](respondWithResult(_0x320cf9,null))[_0xd973('0x57')](handleError(_0x320cf9,null));};exports[_0xd973('0x39')]=function(_0xebf17a,_0x32a3e0){return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0xebf17a['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x32a3e0,null))['then'](removeEntity(_0x32a3e0,null))['catch'](handleError(_0x32a3e0,null));};exports[_0xd973('0x66')]=function(_0x2eedaa,_0x270135){return db['ChatWebsite']['describe']()['then'](respondWithResult(_0x270135,null))[_0xd973('0x57')](handleError(_0x270135,null));};exports['addDisposition']=function(_0x30e803,_0x4a6420,_0x31bb98){if(_0x30e803[_0xd973('0x5e')]['id']){delete _0x30e803[_0xd973('0x5e')]['id'];}return db[_0xd973('0x3f')]['find']({'where':{'id':_0x30e803[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x4a6420,null))[_0xd973('0x23')](function(_0x5b7d03){if(_0x5b7d03){_0x30e803[_0xd973('0x5e')][_0xd973('0x67')]=_0x5b7d03['id'];return db['Disposition']['create'](_0x30e803[_0xd973('0x5e')]);}})[_0xd973('0x23')](respondWithResult(_0x4a6420,null))[_0xd973('0x57')](handleError(_0x4a6420,null));};exports[_0xd973('0x68')]=function(_0x4ac8ef,_0x24d101,_0x107ab6){var _0x1bdc12={'raw':![],'where':{}};var _0x287378={};var _0x239bfa={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd973('0x69')]({'where':{'id':_0x4ac8ef[_0xd973('0x65')]['id']}})['then'](handleEntityNotFound(_0x24d101,null))[_0xd973('0x23')](function(_0x32550a){if(_0x32550a){_0x287378['model']=_['keys'](db['Disposition']['rawAttributes']);_0x287378[_0xd973('0x43')]=_['keys'](_0x4ac8ef[_0xd973('0x43')]);_0x287378[_0xd973('0x44')]=_[_0xd973('0x45')](_0x287378['model'],_0x287378[_0xd973('0x43')]);_0x1bdc12[_0xd973('0x46')]=_[_0xd973('0x45')](_0x287378[_0xd973('0x42')],qs['fields'](_0x4ac8ef['query'][_0xd973('0x47')]));_0x1bdc12[_0xd973('0x46')]=_0x1bdc12[_0xd973('0x46')]['length']?_0x1bdc12[_0xd973('0x46')]:_0x287378[_0xd973('0x42')];if(!_0x4ac8ef[_0xd973('0x43')]['hasOwnProperty'](_0xd973('0x4a'))){_0x1bdc12[_0xd973('0x30')]=qs[_0xd973('0x30')](_0x4ac8ef[_0xd973('0x43')][_0xd973('0x30')]);_0x1bdc12['offset']=qs[_0xd973('0x2f')](_0x4ac8ef[_0xd973('0x43')][_0xd973('0x2f')]);}_0x1bdc12[_0xd973('0x6a')]=qs[_0xd973('0x4b')](_0x4ac8ef[_0xd973('0x43')][_0xd973('0x4b')]);_0x1bdc12['where']=qs['filters'](_['pick'](_0x4ac8ef[_0xd973('0x43')],_0x287378[_0xd973('0x44')]));_0x1bdc12[_0xd973('0x4e')][_0xd973('0x67')]=_0x32550a['id'];if(_0x4ac8ef['query']['filter']){_0x1bdc12[_0xd973('0x4e')]=_[_0xd973('0x4f')](_0x1bdc12[_0xd973('0x4e')],{'$or':_['map'](_0x1bdc12[_0xd973('0x46')],function(_0x56533b){var _0x21a16e={};_0x21a16e[_0x56533b]={'$like':'%'+_0x4ac8ef['query'][_0xd973('0x4d')]+'%'};return _0x21a16e;})});}_0x1bdc12=_[_0xd973('0x4f')]({},_0x1bdc12,_0x4ac8ef[_0xd973('0x51')]);return db[_0xd973('0x6b')]['count']({'where':_0x1bdc12[_0xd973('0x4e')]})[_0xd973('0x23')](function(_0x3b3f20){_0x239bfa[_0xd973('0x52')]=_0x3b3f20;if(_0x4ac8ef['query']['includeAll']){_0x1bdc12[_0xd973('0x54')]=[{'all':!![]}];}return db[_0xd973('0x6b')]['findAll'](_0x1bdc12);})[_0xd973('0x23')](function(_0x4c25aa){_0x239bfa['rows']=_0x4c25aa;return _0x239bfa;});}})['then'](respondWithFilteredResult(_0x24d101,_0x1bdc12))[_0xd973('0x57')](handleError(_0x24d101,null));};exports[_0xd973('0x6c')]=function(_0x487417,_0x9269f5,_0x355ed9){return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0x487417[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x9269f5,null))[_0xd973('0x23')](function(_0xcc28fd){if(_0xcc28fd){return _0xcc28fd['removeDispositions'](_0x487417[_0xd973('0x43')][_0xd973('0x6d')]);}})[_0xd973('0x23')](respondWithStatusCode(_0x9269f5,null))[_0xd973('0x57')](handleError(_0x9269f5,null));};exports[_0xd973('0x6e')]=function(_0xf577,_0x4c26d0,_0x369e2a){if(_0xf577[_0xd973('0x5e')]['id']){delete _0xf577[_0xd973('0x5e')]['id'];}return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0xf577[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x4c26d0,null))['then'](function(_0x4d9417){if(_0x4d9417){_0xf577[_0xd973('0x5e')][_0xd973('0x67')]=_0x4d9417['id'];return db[_0xd973('0x6f')][_0xd973('0x5d')](_0xf577[_0xd973('0x5e')]);}})[_0xd973('0x23')](respondWithResult(_0x4c26d0,null))['catch'](handleError(_0x4c26d0,null));};exports['getAnswers']=function(_0x67bcba,_0x9456c0,_0x15aaa9){var _0x54479b={'raw':![],'where':{}};var _0x37b4d9={};var _0x5df6c4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd973('0x69')]({'where':{'id':_0x67bcba['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x9456c0,null))[_0xd973('0x23')](function(_0x2882d4){if(_0x2882d4){_0x37b4d9['model']=_[_0xd973('0x5a')](db[_0xd973('0x6f')][_0xd973('0x5b')]);_0x37b4d9[_0xd973('0x43')]=_[_0xd973('0x5a')](_0x67bcba[_0xd973('0x43')]);_0x37b4d9[_0xd973('0x44')]=_[_0xd973('0x45')](_0x37b4d9[_0xd973('0x42')],_0x37b4d9[_0xd973('0x43')]);_0x54479b[_0xd973('0x46')]=_['intersection'](_0x37b4d9[_0xd973('0x42')],qs[_0xd973('0x47')](_0x67bcba['query']['fields']));_0x54479b[_0xd973('0x46')]=_0x54479b[_0xd973('0x46')][_0xd973('0x48')]?_0x54479b['attributes']:_0x37b4d9['model'];if(!_0x67bcba[_0xd973('0x43')]['hasOwnProperty'](_0xd973('0x4a'))){_0x54479b['limit']=qs[_0xd973('0x30')](_0x67bcba[_0xd973('0x43')][_0xd973('0x30')]);_0x54479b[_0xd973('0x2f')]=qs[_0xd973('0x2f')](_0x67bcba[_0xd973('0x43')][_0xd973('0x2f')]);}_0x54479b[_0xd973('0x6a')]=qs[_0xd973('0x4b')](_0x67bcba['query'][_0xd973('0x4b')]);_0x54479b[_0xd973('0x4e')]=qs[_0xd973('0x44')](_[_0xd973('0x4c')](_0x67bcba[_0xd973('0x43')],_0x37b4d9[_0xd973('0x44')]));_0x54479b[_0xd973('0x4e')][_0xd973('0x67')]=_0x2882d4['id'];if(_0x67bcba[_0xd973('0x43')][_0xd973('0x4d')]){_0x54479b['where']=_[_0xd973('0x4f')](_0x54479b['where'],{'$or':_[_0xd973('0x3e')](_0x54479b[_0xd973('0x46')],function(_0x31670d){var _0x94bc06={};_0x94bc06[_0x31670d]={'$like':'%'+_0x67bcba[_0xd973('0x43')][_0xd973('0x4d')]+'%'};return _0x94bc06;})});}_0x54479b=_[_0xd973('0x4f')]({},_0x54479b,_0x67bcba['options']);return db[_0xd973('0x6f')][_0xd973('0x52')]({'where':_0x54479b[_0xd973('0x4e')]})[_0xd973('0x23')](function(_0x4d9c32){_0x5df6c4[_0xd973('0x52')]=_0x4d9c32;if(_0x67bcba[_0xd973('0x43')][_0xd973('0x53')]){_0x54479b[_0xd973('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd973('0x55')](_0x54479b);})[_0xd973('0x23')](function(_0x418911){_0x5df6c4['rows']=_0x418911;return _0x5df6c4;});}})[_0xd973('0x23')](respondWithFilteredResult(_0x9456c0,_0x54479b))['catch'](handleError(_0x9456c0,null));};exports[_0xd973('0x70')]=function(_0x5d5254,_0x2c351e,_0x3d68fa){return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0x5d5254[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x2c351e,null))['then'](function(_0x124ac6){if(_0x124ac6){return _0x124ac6[_0xd973('0x70')](_0x5d5254[_0xd973('0x43')][_0xd973('0x6d')]);}})[_0xd973('0x23')](respondWithStatusCode(_0x2c351e,null))[_0xd973('0x57')](handleError(_0x2c351e,null));};exports[_0xd973('0x71')]=function(_0x2e9df6,_0x196ee6,_0x52e381){_0x2e9df6[_0xd973('0x5e')]['sitepic']=_0x2e9df6[_0xd973('0x72')][_0xd973('0x73')];return db[_0xd973('0x3f')]['find']({'where':{'id':_0x2e9df6[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x196ee6,null))[_0xd973('0x23')](saveUpdates(_0x2e9df6['body'],null))['then'](respondWithResult(_0x196ee6,null))['catch'](handleError(_0x196ee6,null));};exports[_0xd973('0x74')]=function(_0x2aeca2,_0x48ebdb,_0x1c4153){_0x2aeca2[_0xd973('0x5e')][_0xd973('0x75')]=_0x2aeca2['file'][_0xd973('0x73')];return db[_0xd973('0x3f')]['find']({'where':{'id':_0x2aeca2[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x48ebdb,null))[_0xd973('0x23')](saveUpdates(_0x2aeca2[_0xd973('0x5e')],null))[_0xd973('0x23')](respondWithResult(_0x48ebdb,null))[_0xd973('0x57')](handleError(_0x48ebdb,null));};exports['addCustomerAvatar']=function(_0x17ef7f,_0x20bf09,_0x9938cd){_0x17ef7f['body']['customerAvatar']=_0x17ef7f[_0xd973('0x72')][_0xd973('0x73')];return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0x17ef7f[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x20bf09,null))['then'](saveUpdates(_0x17ef7f[_0xd973('0x5e')],null))[_0xd973('0x23')](respondWithResult(_0x20bf09,null))[_0xd973('0x57')](handleError(_0x20bf09,null));};exports[_0xd973('0x76')]=function(_0x544c5b,_0x1aa32a,_0xdd2eb1){_0x544c5b[_0xd973('0x5e')][_0xd973('0x77')]=_0x544c5b[_0xd973('0x72')][_0xd973('0x73')];return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0x544c5b['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x1aa32a,null))[_0xd973('0x23')](saveUpdates(_0x544c5b[_0xd973('0x5e')],null))[_0xd973('0x23')](respondWithResult(_0x1aa32a,null))['catch'](handleError(_0x1aa32a,null));};exports[_0xd973('0x78')]=function(_0x1140fb,_0x535516,_0x22a4f6){var _0x2c2855=path[_0xd973('0x79')](config[_0xd973('0x7a')],_0xd973('0x7b'));var _0x27385b={'where':{'id':_0x1140fb[_0xd973('0x65')]['id']},'attributes':['id',_0xd973('0x7c')],'raw':!![]};var _0x111e6f=![];return require(_0xd973('0x7d'))['getLicense']()[_0xd973('0x23')](function(_0x3a3963){if(_0x3a3963){_0x111e6f=_0x3a3963[_0xd973('0x7e')];}})[_0xd973('0x23')](function(){return db[_0xd973('0x3f')][_0xd973('0x5c')](_0x27385b);})[_0xd973('0x23')](handleEntityNotFound(_0x535516,null))[_0xd973('0x23')](function(_0x4da8aa){if(_0x4da8aa){if(!_['isNil'](_0x4da8aa[_0xd973('0x7c')])){if(fs[_0xd973('0x7f')](path[_0xd973('0x79')](config[_0xd973('0x7a')],_0xd973('0x80'),_0x4da8aa[_0xd973('0x7c')]))&&_0x111e6f){_0x2c2855=path['join'](config[_0xd973('0x7a')],'server/files/images/logos/',_0x4da8aa[_0xd973('0x7c')]);}}return _0x535516['download'](_0x2c2855);}})['catch'](handleError(_0x535516,null));};exports[_0xd973('0x81')]=function(_0x229acb,_0x4d5b92,_0x429c80){var _0x2b067e=path[_0xd973('0x79')](config[_0xd973('0x7a')],'server/files/images/avatars/default_avatar.png');var _0x44a2c8={'where':{'id':_0x229acb[_0xd973('0x65')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x44a2c8)['then'](handleEntityNotFound(_0x4d5b92,null))[_0xd973('0x23')](function(_0x15139f){if(_0x15139f){if(!_[_0xd973('0x82')](_0x15139f[_0xd973('0x75')])){if(fs[_0xd973('0x7f')](path[_0xd973('0x79')](config[_0xd973('0x7a')],_0xd973('0x83'),_0x15139f[_0xd973('0x75')]))){_0x2b067e=path[_0xd973('0x79')](config['root'],'server/files/images/avatars/',_0x15139f[_0xd973('0x75')]);}}return _0x4d5b92['download'](_0x2b067e);}})[_0xd973('0x57')](handleError(_0x4d5b92,null));};exports['getCustomerAvatar']=function(_0x3201dc,_0x426136,_0x21ce74){var _0x304e0b=path[_0xd973('0x79')](config[_0xd973('0x7a')],_0xd973('0x84'));var _0xe6e203={'where':{'id':_0x3201dc[_0xd973('0x65')]['id']},'attributes':['id','customerAvatar',_0xd973('0x85')],'raw':!![]};return db['ChatWebsite'][_0xd973('0x5c')](_0xe6e203)[_0xd973('0x23')](handleEntityNotFound(_0x426136,null))[_0xd973('0x23')](function(_0x1ef605){if(_0x1ef605){if(!_[_0xd973('0x82')](_0x1ef605[_0xd973('0x86')])){if(fs[_0xd973('0x7f')](path[_0xd973('0x79')](config['root'],_0xd973('0x83'),_0x1ef605[_0xd973('0x86')]))&&_0x1ef605[_0xd973('0x85')]){_0x304e0b=path[_0xd973('0x79')](config[_0xd973('0x7a')],_0xd973('0x83'),_0x1ef605[_0xd973('0x86')]);}}return _0x426136[_0xd973('0x87')](_0x304e0b);}})[_0xd973('0x57')](handleError(_0x426136,null));};exports[_0xd973('0x88')]=function(_0x4f1ba1,_0x36090f,_0x576e18){var _0x336024=path[_0xd973('0x79')](config[_0xd973('0x7a')],'server/files/images/avatars/system_avatar.png');var _0x50f95b={'where':{'id':_0x4f1ba1['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xd973('0x3f')][_0xd973('0x5c')](_0x50f95b)[_0xd973('0x23')](handleEntityNotFound(_0x36090f,null))[_0xd973('0x23')](function(_0x1f48c6){if(_0x1f48c6){if(!_['isNil'](_0x1f48c6[_0xd973('0x77')])){if(fs['existsSync'](path[_0xd973('0x79')](config[_0xd973('0x7a')],_0xd973('0x83'),_0x1f48c6['systemAvatar']))){_0x336024=path[_0xd973('0x79')](config[_0xd973('0x7a')],_0xd973('0x83'),_0x1f48c6[_0xd973('0x77')]);}}return _0x36090f[_0xd973('0x87')](_0x336024);}})[_0xd973('0x57')](handleError(_0x36090f,null));};exports[_0xd973('0x89')]=function(_0xe8cb93,_0x3505fb,_0x46f60b){var _0x532db3=require('user-agent-parser');var _0xd7d157=new _0x532db3();var _0x4a6e1c=_0xd7d157['setUA'](_0xe8cb93[_0xd973('0x8a')][_0xd973('0x8b')])[_0xd973('0x8c')]();var _0x57c53f={'body':_0xe8cb93[_0xd973('0x5e')],'channel':'chat'};var _0x329680=[];var _0xa5e37e=[];var _0x2817f8={};var _0x2ed9b0=![];return db[_0xd973('0x8d')]['describe']()['then'](function(_0x1aa9fc){if(!_0x1aa9fc){throw new db[(_0xd973('0x8e'))][(_0xd973('0x21'))](_0xd973('0x8f'));}_0x329680=_[_0xd973('0x90')](_['keys'](_0x1aa9fc),[_0xd973('0x91'),_0xd973('0x92')]);_0xa5e37e=_['difference'](_['keys'](_0x1aa9fc),[_0xd973('0x91'),'updatedAt',_0xd973('0x93'),_0xd973('0x94')]);if(_0xe8cb93[_0xd973('0x5e')]['id']){delete _0xe8cb93[_0xd973('0x5e')]['id'];}if(_[_0xd973('0x82')](_0xe8cb93[_0xd973('0x5e')][_0xd973('0x95')])){throw new db[(_0xd973('0x8e'))]['ValidationError'](_0xd973('0x96'));}if(_[_0xd973('0x82')](_0xe8cb93[_0xd973('0x5e')]['body'])||_0xe8cb93[_0xd973('0x5e')]['body']===''){throw new db[(_0xd973('0x8e'))][(_0xd973('0x21'))](_0xd973('0x97'));}if(_['isNil'](_0xe8cb93[_0xd973('0x5e')][_0xd973('0x98')])){throw new db[(_0xd973('0x8e'))]['ValidationError'](_0xd973('0x99')+_0xa5e37e);}if(!_[_0xd973('0x9a')](_0xa5e37e,_0xe8cb93[_0xd973('0x5e')][_0xd973('0x98')])){throw new db[(_0xd973('0x8e'))][(_0xd973('0x21'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa5e37e);}_0x2817f8[_0xe8cb93[_0xd973('0x5e')][_0xd973('0x98')]]=_0xe8cb93[_0xd973('0x5e')][_0xd973('0x95')];})[_0xd973('0x23')](function(){return db['ChatWebsite']['find']({'where':{'id':_0xe8cb93[_0xd973('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0xd973('0x9b'),'include':[{'model':db['CmContact'],'as':_0xd973('0x9c'),'where':_0x2817f8,'limit':0x1,'order':[[_0xd973('0x92'),_0xd973('0x9d')]]}]},{'model':db[_0xd973('0x9e')],'as':_0xd973('0x9f')}]});})[_0xd973('0x23')](handleEntityNotFound(_0x3505fb,null))[_0xd973('0x23')](function(_0x40fc88){if(_0x40fc88&&_0x40fc88[_0xd973('0x9b')]){_0x57c53f['account']=_0x40fc88;_0x57c53f[_0xd973('0xa0')]=_0x40fc88[_0xd973('0x9f')];_0x57c53f[_0xd973('0xa1')]=_0x40fc88[_0xd973('0x9b')];_0x57c53f['applications']=_[_0xd973('0xa2')](_0x57c53f[_0xd973('0xa0')],['priority'],[_0xd973('0xa3')]);if(_0x57c53f[_0xd973('0xa4')]['Applications']){delete _0x57c53f[_0xd973('0xa4')][_0xd973('0x9f')];}if(_0x57c53f[_0xd973('0xa4')]['List']&&_0x57c53f['account'][_0xd973('0x9b')][_0xd973('0x9c')]['length']){return _0x57c53f['account'][_0xd973('0x9b')][_0xd973('0x9c')][0x0];}var _0x113a16=_[_0xd973('0x1b')](_0xe8cb93['body'],{'firstName':_0xe8cb93[_0xd973('0x5e')][_0xd973('0x95')],'ListId':_0x40fc88[_0xd973('0x94')]});_0x113a16[_0xe8cb93[_0xd973('0x5e')][_0xd973('0x98')]]=_0xe8cb93['body'][_0xd973('0x95')];return db[_0xd973('0x8d')][_0xd973('0x5d')](_0x113a16,{'fields':_0x329680,'raw':!![]});}})['then'](handleEntityNotFound(_0x3505fb,null))[_0xd973('0x23')](function(_0x54d46b){_0x57c53f[_0xd973('0xa5')]=_0x54d46b;var _0x15b7ac=_0xe8cb93[_0xd973('0x5e')]['customerIp'];if(_0xe8cb93[_0xd973('0x8a')][_0xd973('0xa6')]){_0x15b7ac=_0xe8cb93[_0xd973('0x8a')]['cf-connecting-ip'];}else if(_0xe8cb93['headers'][_0xd973('0xa7')]){_0x15b7ac=_[_0xd973('0xa8')](_0xe8cb93[_0xd973('0x8a')][_0xd973('0xa7')]['split'](','));}if(_0x54d46b){var _0x3ecd30={'ContactId':_0x54d46b['id'],'ChatWebsiteId':_0xe8cb93['params']['id'],'from':(_0x54d46b['firstName']||'')+'\x20'+(_0x54d46b['lastName']||''),'customerIp':_0x15b7ac,'customerPort':_0xe8cb93[_0xd973('0x8a')]['x-real-port']?_0xe8cb93['headers'][_0xd973('0xa9')]:null,'referer':_0xe8cb93['body'][_0xd973('0xaa')],'browserName':_0x4a6e1c[_0xd973('0xab')]['name']&&_0x4a6e1c[_0xd973('0xab')][_0xd973('0xac')]?util['format']('%s\x20%s',_0x4a6e1c['browser'][_0xd973('0x3a')],_0x4a6e1c[_0xd973('0xab')]['version']):_0xd973('0xad'),'browserVersion':_0x4a6e1c[_0xd973('0xab')][_0xd973('0xac')]||_0xd973('0xad'),'osName':util[_0xd973('0xae')](_0xd973('0xaf'),_0x4a6e1c['os'][_0xd973('0x3a')],_0x4a6e1c['os'][_0xd973('0xac')]),'osVersion':_0x4a6e1c['os']['version'],'deviceModel':_0x4a6e1c[_0xd973('0xb0')][_0xd973('0x42')]&&_0x4a6e1c[_0xd973('0xb0')][_0xd973('0xb1')]?util[_0xd973('0xae')]('%s\x20%s\x20%s',_0x4a6e1c['device'][_0xd973('0x42')],_0x4a6e1c[_0xd973('0xb0')]['vendor'],_0x4a6e1c['device'][_0xd973('0x40')]):null,'deviceVendor':_0x4a6e1c[_0xd973('0xb0')][_0xd973('0xb1')],'deviceType':_0x4a6e1c['device'][_0xd973('0x40')],'formData':JSON['stringify'](_0xe8cb93[_0xd973('0x5e')])};var _0x17c465={'ChatWebsiteId':_0xe8cb93['params']['id'],'closed':![]};if(_0xe8cb93[_0xd973('0x5e')][_0xd973('0xb2')]){_0x17c465[_0xd973('0xb2')]=_0xe8cb93['body'][_0xd973('0xb2')];return db[_0xd973('0xb3')][_0xd973('0x5c')]({'where':_0x17c465})[_0xd973('0x23')](function(_0x4f0a20){if(_0x4f0a20){return[_0x4f0a20,![]];}_0x3ecd30[_0xd973('0xb2')]=_0xe8cb93[_0xd973('0x5e')][_0xd973('0xb2')];_0x3ecd30[_0xd973('0xb4')]=_0xe8cb93[_0xd973('0x5e')][_0xd973('0xb4')];return db[_0xd973('0xb3')]['create'](_0x3ecd30)[_0xd973('0x23')](function(_0x4059a0){return[_0x4059a0,!![]];});});}_0x17c465[_0xd973('0xb5')]=_0x54d46b['id'];if(_0xe8cb93['body'][_0xd973('0xb6')]&&_0xe8cb93['body'][_0xd973('0xb6')]['id']){_0x17c465['id']=_0xe8cb93[_0xd973('0x5e')]['interaction']['id'];return db['ChatInteraction'][_0xd973('0x5c')]({'where':_0x17c465})[_0xd973('0x23')](function(_0x3c3b18){if(_0x3c3b18){return[_0x3c3b18,![]];}return db[_0xd973('0xb3')]['create'](_0x3ecd30)[_0xd973('0x23')](function(_0x362ad0){return[_0x362ad0,!![]];});});}return db[_0xd973('0xb3')][_0xd973('0x5d')](_0x3ecd30)[_0xd973('0x23')](function(_0x386a57){return[_0x386a57,!![]];});}})['spread'](function(_0x4accd1,_0x33260b){if(_0x4accd1){_0x2ed9b0=_0x33260b;if(!_0x33260b){var _0x2d97b1={'from':(_0x57c53f[_0xd973('0xa5')][_0xd973('0xb7')]||'')+'\x20'+(_0x57c53f[_0xd973('0xa5')]['lastName']||'')};if(_0xe8cb93[_0xd973('0x5e')]['threadId']&&_0xe8cb93[_0xd973('0x5e')]['messageId']&&_0xe8cb93['body'][_0xd973('0xb2')]!=_0xe8cb93[_0xd973('0x5e')][_0xd973('0xb8')]){_0x2d97b1[_0xd973('0xb2')]=_0xe8cb93[_0xd973('0x5e')]['messageId'];}return _0x4accd1[_0xd973('0x35')](_0x2d97b1);}else{return _0x4accd1;}}})[_0xd973('0x23')](function(_0x4a10d9){_0x57c53f['interaction']=_0x4a10d9[_0xd973('0x36')]({'plain':!![]});_0x57c53f[_0xd973('0xb6')][_0xd973('0xb9')]=_0x2ed9b0;if(_0x57c53f[_0xd973('0xb6')][_0xd973('0xb9')]){if(_0x57c53f[_0xd973('0xa4')]['autoclose']){_0x57c53f['applications']['push']({'id':0x0,'priority':_0x57c53f[_0xd973('0xa0')][_0xd973('0x48')]+0x1,'app':_0xd973('0xba'),'appdata':_0xd973('0xbb'),'interval':_0xd973('0xbc')});}}return db[_0xd973('0xbd')][_0xd973('0x5d')]({'body':_0xe8cb93[_0xd973('0x5e')][_0xd973('0x5e')],'ChatWebsiteId':_0xe8cb93[_0xd973('0x65')]['id'],'ChatInteractionId':_0x4a10d9['id'],'direction':'in','ContactId':_0x57c53f['contact']['id'],'AttachmentId':_0xe8cb93['body']['AttachmentId']});})[_0xd973('0x23')](function(_0x4095c3){_0x57c53f[_0xd973('0x2a')]=_0x4095c3;if(_0x57c53f['interaction'][_0xd973('0xbe')]){return db[_0xd973('0xbf')]['find']({'attributes':['id',_0xd973('0x3a')],'where':{'id':_0x57c53f[_0xd973('0xb6')]['UserId']}})[_0xd973('0x23')](function(_0x11a0f9){if(_0x11a0f9){_0x57c53f[_0xd973('0xa0')][_0xd973('0xc0')]({'id':0x0,'priority':0x0,'app':_0xd973('0xc1'),'appdata':_0x11a0f9[_0xd973('0x3a')]+','+(_0x57c53f['account'][_0xd973('0xc2')]||0xa),'interval':'*,*,*,*'});_0x57c53f['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xd973('0xc3'),_0x57c53f);});}return respondWithRpcPromise(_0xd973('0xc4'),_0xd973('0xc3'),_0x57c53f);})['then'](function(_0x551d4a){respondWithRpcPromise(_0xd973('0xc5'),_0xd973('0xc5'),{'event':_0xd973('0x89'),'message':_0x551d4a},client9002);return _0x551d4a;})[_0xd973('0x23')](respondWithResult(_0x3505fb,null))[_0xd973('0x57')](handleError(_0x3505fb,null));};exports['offline']=function(_0x376464,_0x2beb8e,_0x4fa65c){var _0x1222f3,_0x5559af,_0xfdcbe0;var _0x29b7a4=[];var _0x302853=[];var _0x41a10b={};return db[_0xd973('0x8d')][_0xd973('0x66')]()[_0xd973('0x23')](function(_0x52eb0a){if(!_0x52eb0a){throw new db['Sequelize'][(_0xd973('0x21'))](_0xd973('0x8f'));}_0x302853=_[_0xd973('0x90')](_[_0xd973('0x5a')](_0x52eb0a),[_0xd973('0x91'),_0xd973('0x92')]);_0x29b7a4=_[_0xd973('0x90')](_[_0xd973('0x5a')](_0x52eb0a),['createdAt',_0xd973('0x92'),'CompanyId',_0xd973('0x94')]);if(_0x376464[_0xd973('0x5e')]['id']){delete _0x376464[_0xd973('0x5e')]['id'];}if(_[_0xd973('0x82')](_0x376464[_0xd973('0x5e')][_0xd973('0x95')])){throw _0x2beb8e[_0xd973('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0xd973('0x21'))]('from\x20is\x20mandatory'));}if(_[_0xd973('0x82')](_0x376464[_0xd973('0x5e')][_0xd973('0x5e')])||_0x376464[_0xd973('0x5e')]['body']===''){throw _0x2beb8e[_0xd973('0x2c')](0x1f4)[_0xd973('0x3b')](new db[(_0xd973('0x8e'))][(_0xd973('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xd973('0x82')](_0x376464['body'][_0xd973('0xc6')])){throw _0x2beb8e[_0xd973('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0xd973('0x21'))](_0xd973('0xc7')+_0x29b7a4));}if(!_[_0xd973('0x9a')](_0x29b7a4,_0x376464[_0xd973('0x5e')][_0xd973('0xc6')])){throw _0x2beb8e[_0xd973('0x2c')](0x1f4)[_0xd973('0x3b')](new db['Sequelize'][(_0xd973('0x21'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x29b7a4));}_0x41a10b[_0x376464['body'][_0xd973('0xc6')]]=_0x376464[_0xd973('0x5e')][_0xd973('0x95')];})['then'](function(){return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0x376464[_0xd973('0x65')]['id']},'include':[{'model':db[_0xd973('0xc8')],'as':'List'}]});})[_0xd973('0x23')](handleEntityNotFound(_0x2beb8e,null))[_0xd973('0x23')](function(_0x31a01b){if(_0x31a01b&&_0x31a01b[_0xd973('0x9b')]){_0x5559af=_0x31a01b;var _0x5760e4=_[_0xd973('0x1b')](_0x376464['body'],{'firstName':_0x376464['body']['from'],'phone':_0x376464[_0xd973('0x5e')]['from'],'ListId':_0x31a01b[_0xd973('0x94')]});_0x5760e4[_0x376464['body'][_0xd973('0xc6')]]=_0x376464[_0xd973('0x5e')][_0xd973('0x95')];return db[_0xd973('0x8d')]['findOrCreate']({'where':_0x41a10b,'defaults':_0x5760e4});}})[_0xd973('0xc9')](function(_0x260702){if(_0x260702){_0xfdcbe0=_0x260702;var _0x1188ac=fs[_0xd973('0xca')](path['join'](config[_0xd973('0x7a')],_0xd973('0xcb')),_0xd973('0xcc'));var _0x45943e=ejs[_0xd973('0xcd')](_0x1188ac,{'body':_[_0xd973('0xce')](_0x376464[_0xd973('0x5e')][_0xd973('0x5e')]),'bodyTitle':_0x5559af[_0xd973('0xcf')]});return db[_0xd973('0xd0')][_0xd973('0x5d')]({'body':_0x45943e,'ContactId':_0x260702['id'],'ChatWebsiteId':_0x5559af['id']});}})[_0xd973('0x23')](function(_0x5c04c5){if(_0x5c04c5){_0x1222f3=_0x5c04c5;return db['MailAccount'][_0xd973('0x69')]({'where':{'service':!![]},'include':[{'model':db[_0xd973('0xd1')],'as':_0xd973('0xd2'),'raw':!![]}]});}})[_0xd973('0x23')](function(_0x1892c7){if(_0x1892c7&&_0x1892c7['Smtp']&&_0x5559af[_0xd973('0xd3')]){var _0x531029={'tls':{'rejectUnauthorized':![]}};if(_0x1892c7[_0xd973('0xd2')]['service']){_0x531029['service']=_0x1892c7[_0xd973('0xd2')][_0xd973('0xd4')];}else{_0x531029[_0xd973('0xd5')]=_0x1892c7[_0xd973('0xd2')]['host'];_0x531029[_0xd973('0xd6')]=_0x1892c7[_0xd973('0xd2')][_0xd973('0xd6')];_0x531029['secure']=_0x1892c7[_0xd973('0xd2')][_0xd973('0xd7')];}if(_0x1892c7[_0xd973('0xd2')]['authentication']){_0x531029[_0xd973('0xd8')]={'user':_0x1892c7[_0xd973('0xd2')][_0xd973('0x5f')],'pass':_0x1892c7[_0xd973('0xd2')]['pass']};}return respondWithRpcPromise(_0xd973('0xd9'),'sendMail',{'account':_0x531029,'message':{'from':util['format'](_0xd973('0xda'),_0x1892c7[_0xd973('0x3a')],_0x1892c7['email']||_0x1892c7['Smtp'][_0xd973('0x5f')]),'to':_0x5559af[_0xd973('0xd3')],'subject':_0x5559af[_0xd973('0xdb')],'text':_0x1222f3[_0xd973('0x5e')]}},client9003)[_0xd973('0x23')](function(){return _0x1222f3;})[_0xd973('0x57')](function(_0xa16ce4){console[_0xd973('0x28')](_0xa16ce4);});}})[_0xd973('0x23')](function(){if(_0x1222f3){return _0x1222f3;}})[_0xd973('0x23')](respondWithResult(_0x2beb8e,null))[_0xd973('0x57')](handleError(_0x2beb8e,null));};exports[_0xd973('0xdc')]=function(_0x38112b,_0x494e50,_0x5a2de6){return db[_0xd973('0xb3')][_0xd973('0x5c')]({'where':{'id':_0x38112b['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x494e50,null))[_0xd973('0x23')](function(_0x3892e6){if(_0x3892e6){return _0x3892e6[_0xd973('0xdc')](_0x38112b[_0xd973('0x5e')][_0xd973('0x6d')],_[_0xd973('0xdd')](_0x38112b[_0xd973('0x5e')],[_0xd973('0x6d'),'id'])||{});}})[_0xd973('0x23')](respondWithResult(_0x494e50,null))[_0xd973('0x57')](handleError(_0x494e50,null));};exports[_0xd973('0xde')]=function(_0x578381,_0x49802a,_0xa77ae2){var _0x2b1e40={'raw':![],'where':{}};var _0x3aad45={};var _0xf13dc4={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x578381[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x49802a,null))['then'](function(_0x454495){if(_0x454495){_0x3aad45[_0xd973('0x42')]=_['keys'](db[_0xd973('0xb3')][_0xd973('0x5b')]);_0x3aad45[_0xd973('0x43')]=_['keys'](_0x578381['query']);_0x3aad45[_0xd973('0x44')]=_['intersection'](_0x3aad45[_0xd973('0x42')],_0x3aad45[_0xd973('0x43')]);_0x2b1e40[_0xd973('0x46')]=_[_0xd973('0x45')](_0x3aad45[_0xd973('0x42')],qs[_0xd973('0x47')](_0x578381[_0xd973('0x43')][_0xd973('0x47')]));_0x2b1e40[_0xd973('0x46')]=_0x2b1e40['attributes']['length']?_0x2b1e40['attributes']:_0x3aad45[_0xd973('0x42')];if(!_0x578381[_0xd973('0x43')][_0xd973('0x49')]('nolimit')){_0x2b1e40[_0xd973('0x30')]=qs[_0xd973('0x30')](_0x578381[_0xd973('0x43')][_0xd973('0x30')]);_0x2b1e40[_0xd973('0x2f')]=qs['offset'](_0x578381[_0xd973('0x43')][_0xd973('0x2f')]);}_0x2b1e40[_0xd973('0x6a')]=qs['sort'](_0x578381['query'][_0xd973('0x4b')]);_0x2b1e40[_0xd973('0x4e')]=qs[_0xd973('0x44')](_[_0xd973('0x4c')](_0x578381[_0xd973('0x43')],_0x3aad45['filters']));_0x2b1e40[_0xd973('0x4e')][_0xd973('0x67')]=_0x454495['id'];if(_0x578381[_0xd973('0x43')][_0xd973('0x4d')]){_0x2b1e40[_0xd973('0x4e')]=_['merge'](_0x2b1e40['where'],{'$or':_[_0xd973('0x3e')](_0x2b1e40[_0xd973('0x46')],function(_0x55ca19){var _0xec5506={};_0xec5506[_0x55ca19]={'$like':'%'+_0x578381[_0xd973('0x43')][_0xd973('0x4d')]+'%'};return _0xec5506;})});}_0x2b1e40=_[_0xd973('0x4f')]({},_0x2b1e40,_0x578381[_0xd973('0x51')]);return db[_0xd973('0xb3')]['count']({'where':_0x2b1e40['where']})[_0xd973('0x23')](function(_0x560e8d){_0xf13dc4['count']=_0x560e8d;if(_0x578381[_0xd973('0x43')][_0xd973('0x53')]){_0x2b1e40[_0xd973('0x54')]=[{'model':db[_0xd973('0x8d')],'as':_0xd973('0xdf'),'required':![]},{'model':db[_0xd973('0xbf')],'as':_0xd973('0xe0'),'attributes':['name',_0xd973('0xe1'),_0xd973('0xe2')],'required':![]},{'model':db['Tag'],'as':_0xd973('0xe3'),'attributes':['id',_0xd973('0x3a'),_0xd973('0xe4')],'where':_0x578381[_0xd973('0x43')]['tag']?{'id':_0x578381[_0xd973('0x43')]['tag']}:undefined,'required':_0x578381[_0xd973('0x43')][_0xd973('0xe5')]?!![]:![]}];}return db['ChatInteraction'][_0xd973('0x55')](_0x2b1e40);})[_0xd973('0x23')](function(_0x4b83db){_0xf13dc4['rows']=_0x4b83db;return _0xf13dc4;});}})[_0xd973('0x23')](respondWithFilteredResult(_0x49802a,_0x2b1e40))[_0xd973('0x57')](handleError(_0x49802a,null));};function iftimePromise(_0x62498,_0x1f8652){return respondWithRpcPromise(_0xd973('0xe6'),_0xd973('0xe7'),{'command':_0x1f8652['timezone']?util[_0xd973('0xae')]('iftime\x20%s,%s',_0x62498[_0xd973('0xe8')],_0x1f8652[_0xd973('0xe9')]):util[_0xd973('0xae')](_0xd973('0xea'),_0x62498[_0xd973('0xe8')])},client9002)[_0xd973('0x23')](function(_0x11eaad){var _0x5d5fae=_0x11eaad&&_0x11eaad['indexOf']('true')>=0x0?!![]:![];logger[_0xd973('0xeb')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1f8652['id'],_0x62498['id'],_0x62498[_0xd973('0xe8')],_0x5d5fae?_0xd973('0xec'):_0xd973('0xed'),_0x1f8652[_0xd973('0xe9')]?_0x1f8652[_0xd973('0xe9')]:_0xd973('0xee'));return _0x5d5fae;})['catch'](function(_0x746e24){logger[_0xd973('0x28')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1f8652['id'],_0x62498['id'],_0x62498[_0xd973('0xe8')],util[_0xd973('0xef')](_0x746e24,{'showHidden':![],'depth':null}),_0x1f8652[_0xd973('0xe9')]?_0x1f8652['timezone']:_0xd973('0xee'));return![];});}exports[_0xd973('0xe7')]=function(_0x2299d0,_0x4a04d9,_0x50cfff){var _0x298d5b=0x0;var _0x1cf1b8=0x0;var _0x45c369=![];var _0x343439;var _0x33a453;return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0x2299d0[_0xd973('0x65')]['id']},'include':[{'model':db[_0xd973('0xf0')],'as':'Interval','include':[{'model':db[_0xd973('0xf0')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xd973('0x23')](handleEntityNotFound(_0x4a04d9,null))[_0xd973('0x23')](function(_0x134d80){if(_0x134d80){_0x343439=_0x134d80;return _0x134d80['getProactiveActions']({'raw':!![]});}})[_0xd973('0x23')](function(_0x2ee3d9){if(_0x343439){if(_0x2ee3d9){_0x33a453=_0x2ee3d9;}}return require(_0xd973('0x7d'))[_0xd973('0xf1')]();})[_0xd973('0x23')](function(_0x1a244f){if(_0x1a244f){_0x1cf1b8=_0x1a244f[_0xd973('0xf2')];_0x45c369=_0x1a244f[_0xd973('0x7e')];}})['then'](function(){return db[_0xd973('0xb3')][_0xd973('0x52')]({'where':{'closed':![]}});})[_0xd973('0x23')](function(_0x513b38){_0x298d5b=_0x513b38;if(_0x1cf1b8&&_0x513b38>_0x1cf1b8){return db[_0xd973('0xf3')][_0xd973('0x69')]({'where':{'id':0x1}})[_0xd973('0x23')](function(_0x39d19b){if(_0x39d19b){_0x39d19b[_0xd973('0xf4')](_0xd973('0xf5'));}});}})['then'](function(){if(_0x343439['Interval']&&_0x343439[_0xd973('0xf0')][_0xd973('0xf6')]){var _0x5ad173=[];for(var _0x47586e=0x0;_0x47586e<_0x343439[_0xd973('0xf0')][_0xd973('0xf6')][_0xd973('0x48')];_0x47586e++){var _0xf95b14=_0x343439[_0xd973('0xf0')][_0xd973('0xf6')][_0x47586e][_0xd973('0x36')]({'plain':!![]});_0x5ad173['push'](iftimePromise(_0xf95b14,_0x343439));}return BPromise[_0xd973('0xf7')](_0x5ad173)[_0xd973('0x23')](function(_0x556edd){return _[_0xd973('0xf8')](_0x556edd);});}else{return!![];}})[_0xd973('0x23')](function(_0x121828){var _0x552b2b=fs['readFileSync'](path['join'](config[_0xd973('0x7a')],_0xd973('0xf9')),_0xd973('0xcc'));var _0x43595a={'remote':_0x343439[_0xd973('0xfa')],'query':querystring[_0xd973('0x27')](_['merge'](_0x343439[_0xd973('0x36')]({'plain':!![]}),{'customerIp':_0x2299d0[_0xd973('0x8a')][_0xd973('0xa7')]||_0x2299d0[_0xd973('0x8a')][_0xd973('0xfb')]||_0x2299d0[_0xd973('0xfc')][_0xd973('0xfd')]||_0x2299d0['ip'],'referer':_0x2299d0['headers'][_0xd973('0xaa')],'openedInteractions':_0x298d5b,'maxInteractions':_0x1cf1b8,'virtual':_0x45c369[_0xd973('0xf2')],'online':_0x121828,'custom':_0x45c369}))['replace'](/'/g,'\x5c\x27')};_0x4a04d9[_0xd973('0x3b')](ejs[_0xd973('0xcd')](Mustache['render'](_0x552b2b,_0x43595a),{'proactiveActions':_0x33a453,'alignment':_0x343439[_0xd973('0xfe')],'verticalAlignment':_0x343439[_0xd973('0xff')],'div_color':_0x343439[_0xd973('0xe4')],'text_color':_0x343439[_0xd973('0x100')]}));})['catch'](handleError(_0x4a04d9,null));};exports[_0xd973('0x101')]=function(_0x36fe5b,_0x46b0c5,_0x24421c){return db['ChatWebsite'][_0xd973('0x69')]({'where':{'id':_0x36fe5b['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x46b0c5,null))[_0xd973('0x23')](function(_0x29bd9c){if(_0x29bd9c){return db[_0xd973('0x102')]['transaction'](function(_0x30106a){return db[_0xd973('0x9e')][_0xd973('0x39')]({'where':{'ChatWebsiteId':_0x36fe5b['params']['id']},'transaction':_0x30106a})['then'](function(_0x4aa939){var _0x2506ab=_['map'](_0x36fe5b['body'],function(_0x3409c7){_0x3409c7[_0xd973('0x67')]=_0x36fe5b[_0xd973('0x65')]['id'];return _0x3409c7;});return db['ChatApplication']['bulkCreate'](_0x2506ab,{'transaction':_0x30106a});});})[_0xd973('0x23')](function(){return db[_0xd973('0x9e')][_0xd973('0x103')]({'where':{'ChatWebsiteId':_0x36fe5b[_0xd973('0x65')]['id']},'order':'priority'});});}})[_0xd973('0x23')](respondWithResult(_0x46b0c5,null))[_0xd973('0x57')](handleError(_0x46b0c5,null));};exports[_0xd973('0x104')]=function(_0x721bf0,_0x3c3ed9,_0x27e057){var _0x117484={};var _0x74f4b9={};var _0x73f524;var _0xb476b3;return db[_0xd973('0x3f')][_0xd973('0x69')]({'where':{'id':_0x721bf0[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x3c3ed9,null))[_0xd973('0x23')](function(_0x511ce8){if(_0x511ce8){_0x73f524=_0x511ce8;_0x74f4b9[_0xd973('0x42')]=_[_0xd973('0x5a')](db['ChatApplication'][_0xd973('0x5b')]);_0x74f4b9[_0xd973('0x43')]=_[_0xd973('0x5a')](_0x721bf0[_0xd973('0x43')]);_0x74f4b9[_0xd973('0x44')]=_['intersection'](_0x74f4b9['model'],_0x74f4b9[_0xd973('0x43')]);_0x117484[_0xd973('0x46')]=_[_0xd973('0x45')](_0x74f4b9[_0xd973('0x42')],qs['fields'](_0x721bf0[_0xd973('0x43')][_0xd973('0x47')]));_0x117484[_0xd973('0x46')]=_0x117484['attributes'][_0xd973('0x48')]?_0x117484[_0xd973('0x46')]:_0x74f4b9['model'];_0x117484['order']=qs[_0xd973('0x4b')](_0x721bf0[_0xd973('0x43')][_0xd973('0x4b')]);_0x117484[_0xd973('0x4e')]=qs[_0xd973('0x44')](_[_0xd973('0x4c')](_0x721bf0['query'],_0x74f4b9[_0xd973('0x44')]));if(_0x721bf0['query'][_0xd973('0x4d')]){_0x117484[_0xd973('0x4e')]=_[_0xd973('0x4f')](_0x117484['where'],{'$or':_[_0xd973('0x3e')](_0x117484[_0xd973('0x46')],function(_0x4e6df7){var _0x331c1c={};_0x331c1c[_0x4e6df7]={'$like':'%'+_0x721bf0[_0xd973('0x43')][_0xd973('0x4d')]+'%'};return _0x331c1c;})});}_0x117484=_[_0xd973('0x4f')]({},_0x117484,_0x721bf0[_0xd973('0x51')]);return _0x73f524['getApplications'](_0x117484);}})[_0xd973('0x23')](function(_0x223c6e){if(_0x223c6e){_0xb476b3=_0x223c6e[_0xd973('0x48')];if(!_0x721bf0[_0xd973('0x43')][_0xd973('0x49')](_0xd973('0x4a'))){_0x117484['limit']=qs[_0xd973('0x30')](_0x721bf0[_0xd973('0x43')]['limit']);_0x117484['offset']=qs[_0xd973('0x2f')](_0x721bf0[_0xd973('0x43')][_0xd973('0x2f')]);}return _0x73f524[_0xd973('0x104')](_0x117484);}})[_0xd973('0x23')](function(_0x46fb30){if(_0x46fb30){return _0x46fb30?{'count':_0xb476b3,'rows':_0x46fb30}:null;}})['then'](respondWithResult(_0x3c3ed9,null))[_0xd973('0x57')](handleError(_0x3c3ed9,null));};exports[_0xd973('0x105')]=function(_0x139fe1,_0x2fb1a5,_0x3bfc67){return db['chatProactiveAction'][_0xd973('0x5c')]({'where':{'id':_0x139fe1[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x2fb1a5,null))[_0xd973('0x23')](function(_0x782347){if(_0x782347){return _0x782347['addProactiveActions'](_0x139fe1[_0xd973('0x5e')][_0xd973('0x6d')],_[_0xd973('0xdd')](_0x139fe1[_0xd973('0x5e')],[_0xd973('0x6d'),'id'])||{});}})[_0xd973('0x23')](respondWithResult(_0x2fb1a5,null))[_0xd973('0x57')](handleError(_0x2fb1a5,null));};exports['getProactiveActions']=function(_0x4fe596,_0x512dbb,_0x24f342){var _0x18ce77={};var _0x358a1a={};var _0x50a9ab;var _0x1e323b;return db[_0xd973('0x3f')][_0xd973('0x69')]({'where':{'id':_0x4fe596['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x512dbb,null))[_0xd973('0x23')](function(_0x5b99b4){if(_0x5b99b4){_0x50a9ab=_0x5b99b4;_0x358a1a[_0xd973('0x42')]=_[_0xd973('0x5a')](db[_0xd973('0x106')][_0xd973('0x5b')]);_0x358a1a[_0xd973('0x43')]=_[_0xd973('0x5a')](_0x4fe596[_0xd973('0x43')]);_0x358a1a[_0xd973('0x44')]=_['intersection'](_0x358a1a[_0xd973('0x42')],_0x358a1a[_0xd973('0x43')]);_0x18ce77[_0xd973('0x46')]=_[_0xd973('0x45')](_0x358a1a['model'],qs['fields'](_0x4fe596[_0xd973('0x43')][_0xd973('0x47')]));_0x18ce77[_0xd973('0x46')]=_0x18ce77[_0xd973('0x46')][_0xd973('0x48')]?_0x18ce77['attributes']:_0x358a1a[_0xd973('0x42')];_0x18ce77[_0xd973('0x6a')]=qs['sort'](_0x4fe596[_0xd973('0x43')][_0xd973('0x4b')]);_0x18ce77[_0xd973('0x4e')]=qs[_0xd973('0x44')](_[_0xd973('0x4c')](_0x4fe596[_0xd973('0x43')],_0x358a1a[_0xd973('0x44')]));if(_0x4fe596[_0xd973('0x43')][_0xd973('0x4d')]){_0x18ce77[_0xd973('0x4e')]=_[_0xd973('0x4f')](_0x18ce77[_0xd973('0x4e')],{'$or':_['map'](_0x18ce77[_0xd973('0x46')],function(_0x5581c6){var _0x432d6f={};_0x432d6f[_0x5581c6]={'$like':'%'+_0x4fe596[_0xd973('0x43')][_0xd973('0x4d')]+'%'};return _0x432d6f;})});}_0x18ce77=_[_0xd973('0x4f')]({},_0x18ce77,_0x4fe596[_0xd973('0x51')]);return _0x50a9ab['getProactiveActions'](_0x18ce77);}})[_0xd973('0x23')](function(_0x4aa40f){if(_0x4aa40f){_0x1e323b=_0x4aa40f[_0xd973('0x48')];if(!_0x4fe596[_0xd973('0x43')][_0xd973('0x49')](_0xd973('0x4a'))){_0x18ce77[_0xd973('0x30')]=qs[_0xd973('0x30')](_0x4fe596[_0xd973('0x43')][_0xd973('0x30')]);_0x18ce77[_0xd973('0x2f')]=qs['offset'](_0x4fe596[_0xd973('0x43')][_0xd973('0x2f')]);}return _0x50a9ab[_0xd973('0x107')](_0x18ce77);}})[_0xd973('0x23')](function(_0x167a8b){if(_0x167a8b){return _0x167a8b?{'count':_0x1e323b,'rows':_0x167a8b}:null;}})[_0xd973('0x23')](respondWithResult(_0x512dbb,null))['catch'](handleError(_0x512dbb,null));};exports[_0xd973('0x108')]=function(_0x25e8e3,_0x33c02d,_0x8ac52d){var _0x1239e8=_0x25e8e3[_0xd973('0x43')][_0xd973('0x109')]===_0xd973('0x10a')?_0xd973('0x10b'):_0xd973('0x10c');return db[_0xd973('0x3f')][_0xd973('0x5c')]({'attributes':['id',_0x1239e8],'where':{'id':_0x25e8e3[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x33c02d,null))[_0xd973('0x23')](function(_0x4965c8){if(_0x4965c8){var _0x4f74a4=_0x4965c8[_0x1239e8];var _0x2f9357=_0x4f74a4&&_0x4f74a4['items']?_0x4f74a4['items']:[];_0x33c02d[_0xd973('0x3b')]({'fromKey':_['isNil'](_0x4f74a4[_0xd973('0x10d')])?undefined:_0x4f74a4[_0xd973('0x10d')],'count':_0x2f9357[_0xd973('0x48')],'rows':_0x2f9357});}})[_0xd973('0x57')](handleError(_0x33c02d,null));};exports[_0xd973('0x10e')]=function(_0x378e08,_0x4a8563,_0x121cdd){var _0x4c3c07={'raw':![],'where':{}};var _0xcaf541={};var _0x43bf42={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd973('0x69')]({'where':{'id':_0x378e08['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x4a8563,null))[_0xd973('0x23')](function(_0x58dfef){if(_0x58dfef){_0xcaf541['model']=_['keys'](db[_0xd973('0xd0')][_0xd973('0x5b')]);_0xcaf541[_0xd973('0x43')]=_[_0xd973('0x5a')](_0x378e08[_0xd973('0x43')]);_0xcaf541[_0xd973('0x44')]=_[_0xd973('0x45')](_0xcaf541[_0xd973('0x42')],_0xcaf541[_0xd973('0x43')]);_0x4c3c07[_0xd973('0x46')]=_[_0xd973('0x45')](_0xcaf541[_0xd973('0x42')],qs[_0xd973('0x47')](_0x378e08[_0xd973('0x43')][_0xd973('0x47')]));_0x4c3c07[_0xd973('0x46')]=_0x4c3c07[_0xd973('0x46')][_0xd973('0x48')]?_0x4c3c07[_0xd973('0x46')]:_0xcaf541[_0xd973('0x42')];if(!_0x378e08[_0xd973('0x43')]['hasOwnProperty'](_0xd973('0x4a'))){_0x4c3c07[_0xd973('0x30')]=qs[_0xd973('0x30')](_0x378e08[_0xd973('0x43')][_0xd973('0x30')]);_0x4c3c07['offset']=qs[_0xd973('0x2f')](_0x378e08[_0xd973('0x43')][_0xd973('0x2f')]);}_0x4c3c07['order']=qs[_0xd973('0x4b')](_0x378e08[_0xd973('0x43')]['sort']);_0x4c3c07[_0xd973('0x4e')]=qs['filters'](_[_0xd973('0x4c')](_0x378e08[_0xd973('0x43')],_0xcaf541[_0xd973('0x44')]));_0x4c3c07[_0xd973('0x4e')][_0xd973('0x67')]=_0x58dfef['id'];if(_0x378e08['query'][_0xd973('0x4d')]){_0x4c3c07['where']=_[_0xd973('0x4f')](_0x4c3c07['where'],{'$or':_[_0xd973('0x3e')](_0x4c3c07[_0xd973('0x46')],function(_0x59ada8){var _0x47211b={};_0x47211b[_0x59ada8]={'$like':'%'+_0x378e08[_0xd973('0x43')][_0xd973('0x4d')]+'%'};return _0x47211b;})});}_0x4c3c07=_[_0xd973('0x4f')]({},_0x4c3c07,_0x378e08[_0xd973('0x51')]);return db['ChatOfflineMessage']['count']({'where':_0x4c3c07[_0xd973('0x4e')]})['then'](function(_0x5bf502){_0x43bf42[_0xd973('0x52')]=_0x5bf502;if(_0x378e08[_0xd973('0x43')]['includeAll']){_0x4c3c07[_0xd973('0x54')]=[{'all':!![]}];}else{_0x4c3c07['include']=[{'model':db[_0xd973('0x8d')],'as':_0xd973('0xdf'),'required':![]}];}return db[_0xd973('0xd0')]['findAll'](_0x4c3c07);})[_0xd973('0x23')](function(_0x5c0c8d){_0x43bf42[_0xd973('0x56')]=_0x5c0c8d;return _0x43bf42;});}})['then'](respondWithFilteredResult(_0x4a8563,_0x4c3c07))[_0xd973('0x57')](handleError(_0x4a8563,null));};exports[_0xd973('0x10f')]=function(_0x1d5b19,_0x2b12a3,_0x2f6489){return db['ChatWebsite']['find']({'where':{'id':_0x1d5b19['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x2b12a3,null))[_0xd973('0x23')](function(_0x1d34ee){if(_0x1d34ee){return _0x1d34ee[_0xd973('0x10f')](_0x1d5b19[_0xd973('0x5e')][_0xd973('0x6d')],_[_0xd973('0xdd')](_0x1d5b19[_0xd973('0x5e')],[_0xd973('0x6d'),'id'])||{})['spread'](function(_0x38bb0f){for(var _0xbcdfce=0x0;_0xbcdfce<_0x1d5b19['body'][_0xd973('0x6d')][_0xd973('0x48')];_0xbcdfce+=0x1){socket[_0xd973('0x110')](_0xd973('0x111'),{'UserId':_0x1d5b19[_0xd973('0x5e')][_0xd973('0x6d')][_0xbcdfce],'ChatWebsiteId':_0x1d5b19[_0xd973('0x65')]['id']});}return _0x38bb0f;});}})[_0xd973('0x23')](respondWithResult(_0x2b12a3,null))[_0xd973('0x57')](handleError(_0x2b12a3,null));};exports['removeAgents']=function(_0x576a5e,_0x13665a,_0x1f32b4){return db[_0xd973('0x3f')][_0xd973('0x5c')]({'where':{'id':_0x576a5e[_0xd973('0x65')]['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x13665a,null))[_0xd973('0x23')](function(_0x110c31){if(_0x110c31){return _0x110c31[_0xd973('0x112')](_0x576a5e['query']['ids'])[_0xd973('0x23')](function(){if(_[_0xd973('0x113')](_0x576a5e['query'][_0xd973('0x6d')])){for(var _0x44c78d=0x0;_0x44c78d<_0x576a5e[_0xd973('0x43')][_0xd973('0x6d')]['length'];_0x44c78d+=0x1){socket[_0xd973('0x110')](_0xd973('0x114'),{'UserId':Number(_0x576a5e[_0xd973('0x43')][_0xd973('0x6d')][_0x44c78d]),'ChatWebsiteId':Number(_0x576a5e[_0xd973('0x65')]['id'])});}}else{socket[_0xd973('0x110')](_0xd973('0x114'),{'UserId':Number(_0x576a5e['query'][_0xd973('0x6d')]),'ChatWebsiteId':Number(_0x576a5e[_0xd973('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x13665a,null))['catch'](handleError(_0x13665a,null));};exports[_0xd973('0x115')]=function(_0x4ee31d,_0x1f0764,_0x564b8a){var _0x527060={};var _0x492015={};var _0x55942f;var _0x7d5afc;return db['ChatWebsite'][_0xd973('0x69')]({'where':{'id':_0x4ee31d['params']['id']}})[_0xd973('0x23')](handleEntityNotFound(_0x1f0764,null))[_0xd973('0x23')](function(_0x44a5d7){if(_0x44a5d7){_0x55942f=_0x44a5d7;_0x492015['model']=_[_0xd973('0x5a')](db[_0xd973('0xbf')][_0xd973('0x5b')]);_0x492015['query']=_[_0xd973('0x5a')](_0x4ee31d['query']);_0x492015[_0xd973('0x44')]=_[_0xd973('0x45')](_0x492015[_0xd973('0x42')],_0x492015[_0xd973('0x43')]);_0x527060[_0xd973('0x46')]=_[_0xd973('0x45')](_0x492015[_0xd973('0x42')],qs[_0xd973('0x47')](_0x4ee31d[_0xd973('0x43')][_0xd973('0x47')]));_0x527060[_0xd973('0x46')]=_0x527060[_0xd973('0x46')][_0xd973('0x48')]?_0x527060[_0xd973('0x46')]:_0x492015[_0xd973('0x42')];_0x527060['order']=qs[_0xd973('0x4b')](_0x4ee31d['query'][_0xd973('0x4b')]);_0x527060[_0xd973('0x4e')]=qs[_0xd973('0x44')](_['pick'](_0x4ee31d[_0xd973('0x43')],_0x492015[_0xd973('0x44')]));if(_0x4ee31d['query'][_0xd973('0x4d')]){_0x527060[_0xd973('0x4e')]=_['merge'](_0x527060[_0xd973('0x4e')],{'$or':_[_0xd973('0x3e')](_0x527060[_0xd973('0x46')],function(_0x1c4934){var _0xce8ca6={};_0xce8ca6[_0x1c4934]={'$like':'%'+_0x4ee31d[_0xd973('0x43')]['filter']+'%'};return _0xce8ca6;})});}_0x527060=_[_0xd973('0x4f')]({},_0x527060,_0x4ee31d[_0xd973('0x51')]);return _0x55942f[_0xd973('0x115')](_0x527060);}})[_0xd973('0x23')](function(_0x5f257c){if(_0x5f257c){_0x7d5afc=_0x5f257c[_0xd973('0x48')];if(!_0x4ee31d['query'][_0xd973('0x49')](_0xd973('0x4a'))){_0x527060[_0xd973('0x30')]=qs[_0xd973('0x30')](_0x4ee31d[_0xd973('0x43')]['limit']);_0x527060[_0xd973('0x2f')]=qs[_0xd973('0x2f')](_0x4ee31d[_0xd973('0x43')][_0xd973('0x2f')]);}return _0x55942f['getAgents'](_0x527060);}})[_0xd973('0x23')](function(_0x661999){if(_0x661999){return _0x661999?{'count':_0x7d5afc,'rows':_0x661999}:null;}})[_0xd973('0x23')](respondWithResult(_0x1f0764,null))[_0xd973('0x57')](handleError(_0x1f0764,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e2db53f..e9c0d3f 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 _0x16dc=['ChatWebsite','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3a15c8,_0x42a707){var _0x78e837=function(_0x2ad016){while(--_0x2ad016){_0x3a15c8['push'](_0x3a15c8['shift']());}};_0x78e837(++_0x42a707);}(_0x16dc,0x1ef));var _0xc16d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16dc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xc16d('0x0'))['db'][_0xc16d('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc16d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc16d('0x3')};function emitEvent(_0x2f87b6){return function(_0x44f57f,_0x47fb3b,_0x3e38fe){ChatWebsiteEvents[_0xc16d('0x4')](_0x2f87b6+':'+_0x44f57f['id'],_0x44f57f);ChatWebsiteEvents[_0xc16d('0x4')](_0x2f87b6,_0x44f57f);_0x3e38fe(null);};}for(var e in events){if(events[_0xc16d('0x5')](e)){var event=events[e];ChatWebsite[_0xc16d('0x6')](e,emitEvent(event));}}module[_0xc16d('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xfd7b=['hasOwnProperty','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xfd7b[_0x36eaaa];return _0x461349;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xbfd7('0x0'))['db'][_0xbfd7('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbfd7('0x2')](0x0);var events={'afterCreate':_0xbfd7('0x3'),'afterUpdate':_0xbfd7('0x4'),'afterDestroy':_0xbfd7('0x5')};function emitEvent(_0xb348ee){return function(_0x221ad1,_0x249e59,_0x141b5a){ChatWebsiteEvents[_0xbfd7('0x6')](_0xb348ee+':'+_0x221ad1['id'],_0x221ad1);ChatWebsiteEvents[_0xbfd7('0x6')](_0xb348ee,_0x221ad1);_0x141b5a(null);};}for(var e in events){if(events[_0xbfd7('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xbfd7('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index f95171c..3937380 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 _0x7341=['bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','../../config/logger','moment'];(function(_0x22586d,_0x4b147c){var _0x1f6aa2=function(_0x455bbf){while(--_0x455bbf){_0x22586d['push'](_0x22586d['shift']());}};_0x1f6aa2(++_0x4b147c);}(_0x7341,0xe4));var _0x1734=function(_0x18dfbd,_0x50e74c){_0x18dfbd=_0x18dfbd-0x0;var _0x35505f=_0x7341[_0x18dfbd];return _0x35505f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1734('0x0'))('api');var moment=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1734('0x3'));var rimraf=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var attributes=require(_0x1734('0x6'));module[_0x1734('0x7')]=function(_0x21efd9,_0x749d97){return _0x21efd9['define'](_0x1734('0x8'),attributes,{'tableName':_0x1734('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1152=['moment','bluebird','request-promise','path','../../config/environment','exports','lodash','util','../../config/logger','api'];(function(_0x4dda06,_0x558514){var _0xbd45e3=function(_0x206dbb){while(--_0x206dbb){_0x4dda06['push'](_0x4dda06['shift']());}};_0xbd45e3(++_0x558514);}(_0x1152,0x182));var _0x2115=function(_0x3025e0,_0xf2c52d){_0x3025e0=_0x3025e0-0x0;var _0x4ee7c5=_0x1152[_0x3025e0];return _0x4ee7c5;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));var moment=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var rp=require(_0x2115('0x6'));var fs=require('fs');var path=require(_0x2115('0x7'));var rimraf=require('rimraf');var config=require(_0x2115('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x2115('0x9')]=function(_0x241dcb,_0x51a3cf){return _0x241dcb['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 4f41a2c..00e146b 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 _0x6d38=['catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x5f4701,_0x2067f9){var _0x49a68b=function(_0x1a072c){while(--_0x1a072c){_0x5f4701['push'](_0x5f4701['shift']());}};_0x49a68b(++_0x2067f9);}(_0x6d38,0x1ef));var _0x86d3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x6d38[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});config[_0x86d3('0x9')]=_[_0x86d3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x86d3('0xb'))(new Redis(config[_0x86d3('0x9')]));require(_0x86d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a277e,_0x3ed317,_0x555e6d){return new BPromise(function(_0x49b436,_0x5606eb){return client[_0x86d3('0xd')](_0x4a277e,_0x555e6d)[_0x86d3('0xe')](function(_0x4f216c){logger[_0x86d3('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x3ed317,_0x86d3('0x10'));logger[_0x86d3('0x11')](_0x86d3('0x12'),_0x3ed317,_0x86d3('0x10'),JSON[_0x86d3('0x13')](_0x4f216c));if(_0x4f216c[_0x86d3('0x14')]){if(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x15')]===0x1f4){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);return _0x5606eb(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}logger[_0x86d3('0x14')](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')]['message']);return _0x49b436(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}else{logger[_0x86d3('0xf')](_0x86d3('0x16'),_0x3ed317,_0x86d3('0x10'));_0x49b436(_0x4f216c[_0x86d3('0x18')][_0x86d3('0x17')]);}})[_0x86d3('0x19')](function(_0x9b76f2){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x9b76f2);_0x5606eb(_0x9b76f2);});});} \ No newline at end of file +var _0xc1c6=['./chatWebsite.socket','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x5745ca,_0x46a1f0){var _0x1ca5da=function(_0x4613a5){while(--_0x4613a5){_0x5745ca['push'](_0x5745ca['shift']());}};_0x1ca5da(++_0x46a1f0);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x552229,_0x2e2101){_0x552229=_0x552229-0x0;var _0x484ec5=_0xc1c6[_0x552229];return _0x484ec5;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});config['redis']=_[_0x6c1c('0x9')](config[_0x6c1c('0xa')],{'host':_0x6c1c('0xb'),'port':0x18eb});var socket=require(_0x6c1c('0xc'))(new Redis(config['redis']));require(_0x6c1c('0xd'))[_0x6c1c('0xe')](socket);function respondWithRpcPromise(_0x524d21,_0x147c7b,_0x36275f){return new BPromise(function(_0xb3bd12,_0x1137e8){return client['request'](_0x524d21,_0x36275f)[_0x6c1c('0xf')](function(_0x2a4fd4){logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));logger[_0x6c1c('0x12')](_0x6c1c('0x13'),_0x147c7b,'request\x20sent',JSON[_0x6c1c('0x14')](_0x2a4fd4));if(_0x2a4fd4['error']){if(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x16')]===0x1f4){logger[_0x6c1c('0x15')](_0x6c1c('0x17'),_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0x1137e8(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);}logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0xb3bd12(_0x2a4fd4['error'][_0x6c1c('0x18')]);}else{logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));_0xb3bd12(_0x2a4fd4['result'][_0x6c1c('0x18')]);}})[_0x6c1c('0x19')](function(_0x5a3bb7){logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x5a3bb7);_0x1137e8(_0x5a3bb7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ff59883..4f353c8 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(_0x498e3c,_0x2455c4){var _0x1e5f5f=function(_0x1d981b){while(--_0x1d981b){_0x498e3c['push'](_0x498e3c['shift']());}};_0x1e5f5f(++_0x2455c4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x59e470,_0x1dcd6c){_0x59e470=_0x59e470-0x0;var _0x26edf6=_0x5f2f[_0x59e470];return _0x26edf6;};'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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x61b74d,_0x386217){var _0x14d2a2=function(_0x56140a){while(--_0x56140a){_0x61b74d['push'](_0x61b74d['shift']());}};_0x14d2a2(++_0x386217);}(_0x7a54,0x106));var _0x47a5=function(_0x11b5ca,_0x4046fb){_0x11b5ca=_0x11b5ca-0x0;var _0x53554a=_0x7a54[_0x11b5ca];return _0x53554a;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 88de0d4..375b92b 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 _0x9744=['getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','addLogo','server/files/images/avatars/','single','addAvatar','originalname','file','addSystemAvatar','/:id/offline','addInteraction','/:id/proactive_actions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../config/environment','./chatWebsite.controller','index','/describe','isAuthenticated','get','/:id','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x13c4bc,_0x4db3d7){var _0x3bb4b2=function(_0x56785f){while(--_0x56785f){_0x13c4bc['push'](_0x13c4bc['shift']());}};_0x3bb4b2(++_0x4db3d7);}(_0x9744,0xb4));var _0x4974=function(_0x3b5e99,_0x1fe255){_0x3b5e99=_0x3b5e99-0x0;var _0xe2f65b=_0x9744[_0x3b5e99];return _0xe2f65b;};'use strict';var multer=require(_0x4974('0x0'));var util=require(_0x4974('0x1'));var path=require(_0x4974('0x2'));var timeout=require('connect-timeout');var express=require(_0x4974('0x3'));var router=express[_0x4974('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4974('0x5'));var controller=require(_0x4974('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4974('0x7')]);router['get'](_0x4974('0x8'),auth[_0x4974('0x9')](),controller['describe']);router[_0x4974('0xa')](_0x4974('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4974('0xa')](_0x4974('0xc'),auth[_0x4974('0x9')](),controller[_0x4974('0xd')]);router['get'](_0x4974('0xe'),auth['isAuthenticated'](),controller[_0x4974('0xf')]);router[_0x4974('0xa')](_0x4974('0x10'),controller[_0x4974('0x11')]);router[_0x4974('0xa')](_0x4974('0x12'),controller[_0x4974('0x13')]);router['get'](_0x4974('0x14'),controller[_0x4974('0x15')]);router[_0x4974('0xa')](_0x4974('0x16'),controller[_0x4974('0x17')]);router[_0x4974('0xa')](_0x4974('0x18'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x4974('0xa')](_0x4974('0x19'),controller[_0x4974('0x1a')]);router[_0x4974('0xa')](_0x4974('0x1b'),auth[_0x4974('0x9')](),controller[_0x4974('0x1c')]);router[_0x4974('0xa')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x4974('0x1d')]);router['get'](_0x4974('0x1e'),controller[_0x4974('0x1f')]);router[_0x4974('0xa')](_0x4974('0x20'),auth[_0x4974('0x9')](),controller[_0x4974('0x21')]);router[_0x4974('0xa')](_0x4974('0x22'),auth[_0x4974('0x9')](),controller[_0x4974('0x23')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4974('0x24')](_0x4974('0xc'),auth['isAuthenticated'](),controller[_0x4974('0x25')]);router[_0x4974('0x24')](_0x4974('0xe'),auth[_0x4974('0x9')](),controller[_0x4974('0x26')]);var upload=multer({'storage':multer[_0x4974('0x27')]({'destination':function(_0x16a419,_0xc9614,_0x7963ab){_0x7963ab(null,path[_0x4974('0x28')](config[_0x4974('0x29')],_0x4974('0x2a')));},'filename':function(_0x4e7807,_0x336cde,_0x3e6f52){_0x3e6f52(null,util[_0x4974('0x2b')](_0x4974('0x2c'),Date[_0x4974('0x2d')](),_0x336cde['originalname']));}})});router[_0x4974('0x24')](_0x4974('0x10'),upload['single']('file'),controller[_0x4974('0x2e')]);var upload=multer({'storage':multer[_0x4974('0x27')]({'destination':function(_0x32483a,_0x4ab30e,_0x566b87){_0x566b87(null,path[_0x4974('0x28')](config[_0x4974('0x29')],_0x4974('0x2f')));},'filename':function(_0x4e49a4,_0x18e759,_0x9b43e){_0x9b43e(null,util[_0x4974('0x2b')](_0x4974('0x2c'),Date[_0x4974('0x2d')](),_0x18e759['originalname']));}})});router[_0x4974('0x24')]('/:id/avatar',upload[_0x4974('0x30')]('file'),controller[_0x4974('0x31')]);var upload=multer({'storage':multer[_0x4974('0x27')]({'destination':function(_0x1cb4ff,_0x1e7494,_0x579782){_0x579782(null,path[_0x4974('0x28')](config[_0x4974('0x29')],_0x4974('0x2f')));},'filename':function(_0x4b46fa,_0x203cc0,_0x1e9116){_0x1e9116(null,util[_0x4974('0x2b')]('%s-%s',Date[_0x4974('0x2d')](),_0x203cc0[_0x4974('0x32')]));}})});router[_0x4974('0x24')](_0x4974('0x14'),upload[_0x4974('0x30')](_0x4974('0x33')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x4974('0x27')]({'destination':function(_0x38a8bd,_0x3762fd,_0x74a983){_0x74a983(null,path[_0x4974('0x28')](config[_0x4974('0x29')],_0x4974('0x2f')));},'filename':function(_0x15a9a6,_0x18d856,_0x58ad27){_0x58ad27(null,util[_0x4974('0x2b')](_0x4974('0x2c'),Date[_0x4974('0x2d')](),_0x18d856[_0x4974('0x32')]));}})});router[_0x4974('0x24')](_0x4974('0x16'),upload[_0x4974('0x30')](_0x4974('0x33')),controller[_0x4974('0x34')]);router[_0x4974('0x24')]('/:id/notify',controller['notify']);router[_0x4974('0x24')](_0x4974('0x35'),controller['offline']);router[_0x4974('0x24')]('/:id/interactions',auth[_0x4974('0x9')](),controller[_0x4974('0x36')]);router['post'](_0x4974('0x1b'),auth[_0x4974('0x9')](),controller['addApplications']);router[_0x4974('0x24')](_0x4974('0x37'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x4974('0x24')](_0x4974('0x22'),auth[_0x4974('0x9')](),controller[_0x4974('0x38')]);router[_0x4974('0x39')](_0x4974('0xb'),auth[_0x4974('0x9')](),controller[_0x4974('0x3a')]);router[_0x4974('0x3b')](_0x4974('0xb'),auth[_0x4974('0x9')](),controller[_0x4974('0x3c')]);router[_0x4974('0x3b')](_0x4974('0xc'),auth[_0x4974('0x9')](),controller[_0x4974('0x3d')]);router[_0x4974('0x3b')](_0x4974('0xe'),auth['isAuthenticated'](),controller[_0x4974('0x3e')]);router[_0x4974('0x3b')](_0x4974('0x22'),auth[_0x4974('0x9')](),controller[_0x4974('0x3f')]);module[_0x4974('0x40')]=router; \ No newline at end of file +var _0x8b55=['removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addAnswer','join','root','server/files/images/logos/','%s-%s','now','/:id/logo','single','file','addLogo','diskStorage','format','originalname','addAvatar','addCustomerAvatar','server/files/images/avatars/','/:id/system_avatar','addSystemAvatar','/:id/notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','destroy','/:id/dispositions','removeDispositions','delete'];(function(_0xe55d1d,_0x1f2aa5){var _0x51a864=function(_0x82ae35){while(--_0x82ae35){_0xe55d1d['push'](_0xe55d1d['shift']());}};_0x51a864(++_0x1f2aa5);}(_0x8b55,0x1ca));var _0x58b5=function(_0x5347b4,_0x5ac803){_0x5347b4=_0x5347b4-0x0;var _0x536c47=_0x8b55[_0x5347b4];return _0x536c47;};'use strict';var multer=require(_0x58b5('0x0'));var util=require(_0x58b5('0x1'));var path=require(_0x58b5('0x2'));var timeout=require(_0x58b5('0x3'));var express=require(_0x58b5('0x4'));var router=express['Router']();var auth=require(_0x58b5('0x5'));var interaction=require(_0x58b5('0x6'));var config=require('../../config/environment');var controller=require(_0x58b5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x58b5('0x8')]);router[_0x58b5('0x9')](_0x58b5('0xa'),auth[_0x58b5('0xb')](),controller['describe']);router['get'](_0x58b5('0xc'),auth[_0x58b5('0xb')](),controller[_0x58b5('0xd')]);router[_0x58b5('0x9')]('/:id/dispositions',auth[_0x58b5('0xb')](),controller['getDispositions']);router[_0x58b5('0x9')](_0x58b5('0xe'),auth[_0x58b5('0xb')](),controller[_0x58b5('0xf')]);router[_0x58b5('0x9')]('/:id/logo',controller[_0x58b5('0x10')]);router['get'](_0x58b5('0x11'),controller[_0x58b5('0x12')]);router[_0x58b5('0x9')](_0x58b5('0x13'),controller['getCustomerAvatar']);router[_0x58b5('0x9')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x58b5('0x9')](_0x58b5('0x14'),auth[_0x58b5('0xb')](),controller['getInteractions']);router['get'](_0x58b5('0x15'),controller['getSnippet']);router[_0x58b5('0x9')](_0x58b5('0x16'),auth[_0x58b5('0xb')](),controller[_0x58b5('0x17')]);router[_0x58b5('0x9')](_0x58b5('0x18'),auth[_0x58b5('0xb')](),controller[_0x58b5('0x19')]);router[_0x58b5('0x9')](_0x58b5('0x1a'),controller[_0x58b5('0x1b')]);router[_0x58b5('0x9')](_0x58b5('0x1c'),auth['isAuthenticated'](),controller[_0x58b5('0x1d')]);router[_0x58b5('0x9')](_0x58b5('0x1e'),auth[_0x58b5('0xb')](),controller[_0x58b5('0x1f')]);router['post']('/',auth[_0x58b5('0xb')](),controller[_0x58b5('0x20')]);router[_0x58b5('0x21')]('/:id/dispositions',auth[_0x58b5('0xb')](),controller['addDisposition']);router[_0x58b5('0x21')](_0x58b5('0xe'),auth[_0x58b5('0xb')](),controller[_0x58b5('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb38aa6,_0x111548,_0x1416d8){_0x1416d8(null,path[_0x58b5('0x23')](config[_0x58b5('0x24')],_0x58b5('0x25')));},'filename':function(_0x185c81,_0x4f7170,_0x1f2961){_0x1f2961(null,util['format'](_0x58b5('0x26'),Date[_0x58b5('0x27')](),_0x4f7170['originalname']));}})});router['post'](_0x58b5('0x28'),upload[_0x58b5('0x29')](_0x58b5('0x2a')),controller[_0x58b5('0x2b')]);var upload=multer({'storage':multer[_0x58b5('0x2c')]({'destination':function(_0x43d2e1,_0x44c3e5,_0xa878a7){_0xa878a7(null,path[_0x58b5('0x23')](config[_0x58b5('0x24')],'server/files/images/avatars/'));},'filename':function(_0x5afe5b,_0x5cc6e7,_0x411ced){_0x411ced(null,util[_0x58b5('0x2d')]('%s-%s',Date[_0x58b5('0x27')](),_0x5cc6e7[_0x58b5('0x2e')]));}})});router['post']('/:id/avatar',upload[_0x58b5('0x29')](_0x58b5('0x2a')),controller[_0x58b5('0x2f')]);var upload=multer({'storage':multer[_0x58b5('0x2c')]({'destination':function(_0x58ef94,_0x3738c4,_0x1b674f){_0x1b674f(null,path['join'](config[_0x58b5('0x24')],'server/files/images/avatars/'));},'filename':function(_0x36e8e2,_0x3bdf9f,_0x418985){_0x418985(null,util['format'](_0x58b5('0x26'),Date['now'](),_0x3bdf9f[_0x58b5('0x2e')]));}})});router[_0x58b5('0x21')]('/:id/customer_avatar',upload[_0x58b5('0x29')](_0x58b5('0x2a')),controller[_0x58b5('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cbf26,_0x39a226,_0x3cce48){_0x3cce48(null,path[_0x58b5('0x23')](config[_0x58b5('0x24')],_0x58b5('0x31')));},'filename':function(_0x946437,_0x903a07,_0x281778){_0x281778(null,util[_0x58b5('0x2d')](_0x58b5('0x26'),Date[_0x58b5('0x27')](),_0x903a07[_0x58b5('0x2e')]));}})});router[_0x58b5('0x21')](_0x58b5('0x32'),upload[_0x58b5('0x29')](_0x58b5('0x2a')),controller[_0x58b5('0x33')]);router[_0x58b5('0x21')](_0x58b5('0x34'),controller['notify']);router[_0x58b5('0x21')](_0x58b5('0x35'),controller[_0x58b5('0x36')]);router[_0x58b5('0x21')](_0x58b5('0x14'),auth['isAuthenticated'](),controller[_0x58b5('0x37')]);router['post']('/:id/applications',auth[_0x58b5('0xb')](),controller[_0x58b5('0x38')]);router[_0x58b5('0x21')](_0x58b5('0x18'),auth[_0x58b5('0xb')](),controller[_0x58b5('0x39')]);router[_0x58b5('0x21')]('/:id/users',auth[_0x58b5('0xb')](),controller['addAgents']);router['put']('/:id',auth[_0x58b5('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x58b5('0x3a')]);router['delete'](_0x58b5('0x3b'),auth[_0x58b5('0xb')](),controller[_0x58b5('0x3c')]);router[_0x58b5('0x3d')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x58b5('0x3e')]);router[_0x58b5('0x3d')](_0x58b5('0x1e'),auth[_0x58b5('0xb')](),controller[_0x58b5('0x3f')]);module[_0x58b5('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index ce4fed2..699e240 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 _0xe55d=['sequelize','exports','ENUM','AmazonAWS','Google','STRING'];(function(_0x391696,_0x449bb5){var _0xc0e6bf=function(_0x5e3937){while(--_0x5e3937){_0x391696['push'](_0x391696['shift']());}};_0xc0e6bf(++_0x449bb5);}(_0xe55d,0x126));var _0xde55=function(_0x33f649,_0x42ecd3){_0x33f649=_0x33f649-0x0;var _0x37dd52=_0xe55d[_0x33f649];return _0x37dd52;};'use strict';var Sequelize=require(_0xde55('0x0'));module[_0xde55('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xde55('0x2')](_0xde55('0x3'),_0xde55('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xde55('0x5')]},'data2':{'type':Sequelize[_0xde55('0x5')]}}; \ No newline at end of file +var _0xbcc7=['ENUM','STRING','sequelize','exports'];(function(_0x1dff56,_0x1765dc){var _0x265ebd=function(_0x51bb5d){while(--_0x51bb5d){_0x1dff56['push'](_0x1dff56['shift']());}};_0x265ebd(++_0x1765dc);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x50ecd3,_0x486da7){_0x50ecd3=_0x50ecd3-0x0;var _0x380a35=_0xbcc7[_0x50ecd3];return _0x380a35;};'use strict';var Sequelize=require(_0x7bcc('0x0'));module[_0x7bcc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7bcc('0x2')]('AmazonAWS','Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x7bcc('0x3')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e3f391c..8ae100c 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 _0x91b7=['filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy','error','stack','name','index','map','CloudProvider','type','key','model','query','keys'];(function(_0x1830ce,_0x305798){var _0x2bce9f=function(_0x9ea7dc){while(--_0x9ea7dc){_0x1830ce['push'](_0x1830ce['shift']());}};_0x2bce9f(++_0x305798);}(_0x91b7,0x16f));var _0x791b=function(_0x134058,_0x423995){_0x134058=_0x134058-0x0;var _0x14a1a9=_0x91b7[_0x134058];return _0x14a1a9;};'use strict';var pdf=require(_0x791b('0x0'));var emlformat=require(_0x791b('0x1'));var rimraf=require(_0x791b('0x2'));var zipdir=require(_0x791b('0x3'));var jsonpatch=require(_0x791b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x791b('0x5'));var util=require(_0x791b('0x6'));var path=require(_0x791b('0x7'));var sox=require(_0x791b('0x8'));var csv=require('to-csv');var ejs=require(_0x791b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791b('0xa'));var crypto=require('crypto');var jsforce=require(_0x791b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x791b('0xc'));var querystring=require(_0x791b('0xd'));var Papa=require(_0x791b('0xe'));var Redis=require(_0x791b('0xf'));var authService=require(_0x791b('0x10'));var qs=require(_0x791b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x791b('0x12'));var logger=require(_0x791b('0x13'))(_0x791b('0x14'));var utils=require(_0x791b('0x15'));var config=require(_0x791b('0x16'));var db=require(_0x791b('0x17'))['db'];function respondWithStatusCode(_0x2d9f60,_0x4efa31){_0x4efa31=_0x4efa31||0xcc;return function(_0x5f4b35){if(_0x5f4b35){return _0x2d9f60[_0x791b('0x18')](_0x4efa31);}return _0x2d9f60[_0x791b('0x19')](_0x4efa31)[_0x791b('0x1a')]();};}function respondWithResult(_0x3c3015,_0x3c6834){_0x3c6834=_0x3c6834||0xc8;return function(_0x256fb5){if(_0x256fb5){return _0x3c3015[_0x791b('0x19')](_0x3c6834)[_0x791b('0x1b')](_0x256fb5);}};}function respondWithFilteredResult(_0xa24c11,_0x16b1f8){return function(_0xa9fe6b){if(_0xa9fe6b){var _0x2acefc=_0xa9fe6b[_0x791b('0x1c')],_0x39cc51=_0x16b1f8[_0x791b('0x1d')],_0x15b4c2=_0x16b1f8['offset']+_0x16b1f8[_0x791b('0x1e')],_0xe92c91;if(_0x15b4c2>=_0x2acefc){_0x15b4c2=_0x2acefc;_0xe92c91=0xc8;}else{_0xe92c91=0xce;}_0xa24c11[_0x791b('0x19')](_0xe92c91);return _0xa24c11[_0x791b('0x1f')](_0x791b('0x20'),_0x39cc51+'-'+_0x15b4c2+'/'+_0x2acefc)[_0x791b('0x1b')](_0xa9fe6b);}return null;};}function patchUpdates(_0x3c9545){return function(_0x3874da){try{jsonpatch[_0x791b('0x21')](_0x3874da,_0x3c9545,!![]);}catch(_0x213e4b){return BPromise['reject'](_0x213e4b);}return _0x3874da['save']();};}function saveUpdates(_0x863c3f,_0x533205){return function(_0x42a2b6){if(_0x42a2b6){return _0x42a2b6['update'](_0x863c3f)[_0x791b('0x22')](function(_0x1ce686){return _0x1ce686;});}return null;};}function removeEntity(_0x3bad5a,_0x2e28e4){return function(_0x26e0e4){if(_0x26e0e4){return _0x26e0e4[_0x791b('0x23')]()[_0x791b('0x22')](function(){_0x3bad5a[_0x791b('0x19')](0xcc)[_0x791b('0x1a')]();});}};}function handleEntityNotFound(_0x5b28e6,_0x43e2af){return function(_0x1d880c){if(!_0x1d880c){_0x5b28e6[_0x791b('0x18')](0x194);}return _0x1d880c;};}function handleError(_0x4bd02a,_0x350eab){_0x350eab=_0x350eab||0x1f4;return function(_0xe20e2e){logger[_0x791b('0x24')](_0xe20e2e[_0x791b('0x25')]);if(_0xe20e2e[_0x791b('0x26')]){delete _0xe20e2e[_0x791b('0x26')];}_0x4bd02a[_0x791b('0x19')](_0x350eab)['send'](_0xe20e2e);};}exports[_0x791b('0x27')]=function(_0x1558c5,_0x479087){var _0x2eaff9={},_0x581c78={},_0x1feac8={'count':0x0,'rows':[]};var _0x3608d3=_[_0x791b('0x28')](db[_0x791b('0x29')]['rawAttributes'],function(_0x40de54){return{'name':_0x40de54['fieldName'],'type':_0x40de54[_0x791b('0x2a')][_0x791b('0x2b')]};});_0x581c78[_0x791b('0x2c')]=_[_0x791b('0x28')](_0x3608d3,'name');_0x581c78[_0x791b('0x2d')]=_[_0x791b('0x2e')](_0x1558c5[_0x791b('0x2d')]);_0x581c78[_0x791b('0x2f')]=_[_0x791b('0x30')](_0x581c78['model'],_0x581c78[_0x791b('0x2d')]);_0x2eaff9['attributes']=_[_0x791b('0x30')](_0x581c78[_0x791b('0x2c')],qs[_0x791b('0x31')](_0x1558c5[_0x791b('0x2d')][_0x791b('0x31')]));_0x2eaff9[_0x791b('0x32')]=_0x2eaff9[_0x791b('0x32')][_0x791b('0x33')]?_0x2eaff9[_0x791b('0x32')]:_0x581c78['model'];if(!_0x1558c5[_0x791b('0x2d')]['hasOwnProperty']('nolimit')){_0x2eaff9[_0x791b('0x1e')]=qs[_0x791b('0x1e')](_0x1558c5['query']['limit']);_0x2eaff9[_0x791b('0x1d')]=qs[_0x791b('0x1d')](_0x1558c5[_0x791b('0x2d')]['offset']);}_0x2eaff9[_0x791b('0x34')]=qs[_0x791b('0x35')](_0x1558c5[_0x791b('0x2d')]['sort']);_0x2eaff9['where']=qs[_0x791b('0x2f')](_['pick'](_0x1558c5[_0x791b('0x2d')],_0x581c78[_0x791b('0x2f')]),_0x3608d3);if(_0x1558c5[_0x791b('0x2d')]['filter']){_0x2eaff9[_0x791b('0x36')]=_[_0x791b('0x37')](_0x2eaff9['where'],{'$or':_[_0x791b('0x28')](_0x3608d3,function(_0x74a6bf){if(_0x74a6bf[_0x791b('0x2a')]!==_0x791b('0x38')){var _0x1725e2={};_0x1725e2[_0x74a6bf[_0x791b('0x26')]]={'$like':'%'+_0x1558c5['query']['filter']+'%'};return _0x1725e2;}})});}_0x2eaff9=_['merge']({},_0x2eaff9,_0x1558c5[_0x791b('0x39')]);var _0x4c12b2={'where':_0x2eaff9[_0x791b('0x36')]};return db['CloudProvider'][_0x791b('0x1c')](_0x4c12b2)['then'](function(_0x388bc8){_0x1feac8[_0x791b('0x1c')]=_0x388bc8;if(_0x1558c5[_0x791b('0x2d')][_0x791b('0x3a')]){_0x2eaff9[_0x791b('0x3b')]=[{'all':!![]}];}return db[_0x791b('0x29')][_0x791b('0x3c')](_0x2eaff9);})['then'](function(_0x2ce141){_0x1feac8['rows']=_0x2ce141;return _0x1feac8;})[_0x791b('0x22')](respondWithFilteredResult(_0x479087,_0x2eaff9))[_0x791b('0x3d')](handleError(_0x479087,null));};exports[_0x791b('0x3e')]=function(_0x35b7a0,_0x5c1343){var _0xbe9aa1={'raw':!![],'where':{'id':_0x35b7a0[_0x791b('0x3f')]['id']}},_0x423804={};_0x423804[_0x791b('0x2c')]=_[_0x791b('0x2e')](db[_0x791b('0x29')][_0x791b('0x40')]);_0x423804[_0x791b('0x2d')]=_['keys'](_0x35b7a0[_0x791b('0x2d')]);_0x423804[_0x791b('0x2f')]=_[_0x791b('0x30')](_0x423804[_0x791b('0x2c')],_0x423804[_0x791b('0x2d')]);_0xbe9aa1['attributes']=_[_0x791b('0x30')](_0x423804['model'],qs['fields'](_0x35b7a0[_0x791b('0x2d')][_0x791b('0x31')]));_0xbe9aa1[_0x791b('0x32')]=_0xbe9aa1[_0x791b('0x32')]['length']?_0xbe9aa1[_0x791b('0x32')]:_0x423804['model'];if(_0x35b7a0[_0x791b('0x2d')][_0x791b('0x3a')]){_0xbe9aa1[_0x791b('0x3b')]=[{'all':!![]}];}_0xbe9aa1=_[_0x791b('0x37')]({},_0xbe9aa1,_0x35b7a0[_0x791b('0x39')]);return db[_0x791b('0x29')][_0x791b('0x41')](_0xbe9aa1)['then'](handleEntityNotFound(_0x5c1343,null))[_0x791b('0x22')](respondWithResult(_0x5c1343,null))['catch'](handleError(_0x5c1343,null));};exports[_0x791b('0x42')]=function(_0x544755,_0x341a32){return db[_0x791b('0x29')][_0x791b('0x42')](_0x544755[_0x791b('0x43')],{})[_0x791b('0x22')](respondWithResult(_0x341a32,0xc9))[_0x791b('0x3d')](handleError(_0x341a32,null));};exports[_0x791b('0x44')]=function(_0x6bfa2b,_0x1508b7){if(_0x6bfa2b['body']['id']){delete _0x6bfa2b[_0x791b('0x43')]['id'];}return db['CloudProvider'][_0x791b('0x41')]({'where':{'id':_0x6bfa2b['params']['id']}})['then'](handleEntityNotFound(_0x1508b7,null))['then'](saveUpdates(_0x6bfa2b['body'],null))[_0x791b('0x22')](respondWithResult(_0x1508b7,null))['catch'](handleError(_0x1508b7,null));};exports[_0x791b('0x23')]=function(_0xa782a2,_0xc2aa7){return db['CloudProvider']['find']({'where':{'id':_0xa782a2[_0x791b('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc2aa7,null))[_0x791b('0x22')](removeEntity(_0xc2aa7,null))[_0x791b('0x3d')](handleError(_0xc2aa7,null));}; \ No newline at end of file +var _0xe227=['catch','params','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','reject','save','destroy','end','error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','count','includeAll','include','findAll','then'];(function(_0xc86f3f,_0x1ca047){var _0x3075eb=function(_0x2df091){while(--_0x2df091){_0xc86f3f['push'](_0xc86f3f['shift']());}};_0x3075eb(++_0x1ca047);}(_0xe227,0x94));var _0x7e22=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0xe227[_0x212fcc];return _0x4d8190;};'use strict';var pdf=require(_0x7e22('0x0'));var emlformat=require(_0x7e22('0x1'));var rimraf=require(_0x7e22('0x2'));var zipdir=require(_0x7e22('0x3'));var jsonpatch=require(_0x7e22('0x4'));var rp=require(_0x7e22('0x5'));var moment=require(_0x7e22('0x6'));var BPromise=require(_0x7e22('0x7'));var Mustache=require(_0x7e22('0x8'));var util=require(_0x7e22('0x9'));var path=require(_0x7e22('0xa'));var sox=require(_0x7e22('0xb'));var csv=require(_0x7e22('0xc'));var ejs=require(_0x7e22('0xd'));var fs=require('fs');var _=require(_0x7e22('0xe'));var squel=require(_0x7e22('0xf'));var crypto=require('crypto');var jsforce=require(_0x7e22('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7e22('0xc'));var querystring=require(_0x7e22('0x11'));var Papa=require(_0x7e22('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7e22('0x13'));var as=require(_0x7e22('0x14'));var hardwareService=require(_0x7e22('0x15'));var logger=require('../../config/logger')(_0x7e22('0x16'));var utils=require(_0x7e22('0x17'));var config=require(_0x7e22('0x18'));var db=require(_0x7e22('0x19'))['db'];function respondWithStatusCode(_0x352c15,_0x176b4f){_0x176b4f=_0x176b4f||0xcc;return function(_0x3a28b8){if(_0x3a28b8){return _0x352c15[_0x7e22('0x1a')](_0x176b4f);}return _0x352c15[_0x7e22('0x1b')](_0x176b4f)['end']();};}function respondWithResult(_0x3463ce,_0x551820){_0x551820=_0x551820||0xc8;return function(_0x3ec105){if(_0x3ec105){return _0x3463ce[_0x7e22('0x1b')](_0x551820)[_0x7e22('0x1c')](_0x3ec105);}};}function respondWithFilteredResult(_0x31da70,_0xcd8160){return function(_0x31a40e){if(_0x31a40e){var _0x3f2153=_0x31a40e['count'],_0xfc1ad6=_0xcd8160[_0x7e22('0x1d')],_0x2e108c=_0xcd8160[_0x7e22('0x1d')]+_0xcd8160[_0x7e22('0x1e')],_0x54b6b8;if(_0x2e108c>=_0x3f2153){_0x2e108c=_0x3f2153;_0x54b6b8=0xc8;}else{_0x54b6b8=0xce;}_0x31da70[_0x7e22('0x1b')](_0x54b6b8);return _0x31da70['set'](_0x7e22('0x1f'),_0xfc1ad6+'-'+_0x2e108c+'/'+_0x3f2153)[_0x7e22('0x1c')](_0x31a40e);}return null;};}function patchUpdates(_0x19ba20){return function(_0x540a83){try{jsonpatch['apply'](_0x540a83,_0x19ba20,!![]);}catch(_0x53a0b3){return BPromise[_0x7e22('0x20')](_0x53a0b3);}return _0x540a83[_0x7e22('0x21')]();};}function saveUpdates(_0xba4c97,_0x4be1c6){return function(_0xce8726){if(_0xce8726){return _0xce8726['update'](_0xba4c97)['then'](function(_0x547098){return _0x547098;});}return null;};}function removeEntity(_0x2c5d0b,_0x277e5e){return function(_0x2c5afc){if(_0x2c5afc){return _0x2c5afc[_0x7e22('0x22')]()['then'](function(){_0x2c5d0b[_0x7e22('0x1b')](0xcc)[_0x7e22('0x23')]();});}};}function handleEntityNotFound(_0x8d6720,_0x1ee09d){return function(_0x20ea0e){if(!_0x20ea0e){_0x8d6720[_0x7e22('0x1a')](0x194);}return _0x20ea0e;};}function handleError(_0x173e1a,_0x2ba912){_0x2ba912=_0x2ba912||0x1f4;return function(_0x339f57){logger[_0x7e22('0x24')](_0x339f57[_0x7e22('0x25')]);if(_0x339f57[_0x7e22('0x26')]){delete _0x339f57['name'];}_0x173e1a[_0x7e22('0x1b')](_0x2ba912)[_0x7e22('0x27')](_0x339f57);};}exports['index']=function(_0x2e105c,_0xc6ba6e){var _0x5bb61b={},_0x16132d={},_0x3e1107={'count':0x0,'rows':[]};var _0xf0bbe7=_[_0x7e22('0x28')](db[_0x7e22('0x29')][_0x7e22('0x2a')],function(_0x57e4f8){return{'name':_0x57e4f8[_0x7e22('0x2b')],'type':_0x57e4f8[_0x7e22('0x2c')]['key']};});_0x16132d[_0x7e22('0x2d')]=_[_0x7e22('0x28')](_0xf0bbe7,_0x7e22('0x26'));_0x16132d[_0x7e22('0x2e')]=_[_0x7e22('0x2f')](_0x2e105c[_0x7e22('0x2e')]);_0x16132d['filters']=_[_0x7e22('0x30')](_0x16132d[_0x7e22('0x2d')],_0x16132d[_0x7e22('0x2e')]);_0x5bb61b[_0x7e22('0x31')]=_['intersection'](_0x16132d[_0x7e22('0x2d')],qs['fields'](_0x2e105c[_0x7e22('0x2e')][_0x7e22('0x32')]));_0x5bb61b[_0x7e22('0x31')]=_0x5bb61b[_0x7e22('0x31')][_0x7e22('0x33')]?_0x5bb61b[_0x7e22('0x31')]:_0x16132d[_0x7e22('0x2d')];if(!_0x2e105c[_0x7e22('0x2e')][_0x7e22('0x34')]('nolimit')){_0x5bb61b[_0x7e22('0x1e')]=qs['limit'](_0x2e105c[_0x7e22('0x2e')][_0x7e22('0x1e')]);_0x5bb61b[_0x7e22('0x1d')]=qs[_0x7e22('0x1d')](_0x2e105c[_0x7e22('0x2e')][_0x7e22('0x1d')]);}_0x5bb61b['order']=qs['sort'](_0x2e105c[_0x7e22('0x2e')][_0x7e22('0x35')]);_0x5bb61b[_0x7e22('0x36')]=qs[_0x7e22('0x37')](_[_0x7e22('0x38')](_0x2e105c[_0x7e22('0x2e')],_0x16132d[_0x7e22('0x37')]),_0xf0bbe7);if(_0x2e105c[_0x7e22('0x2e')]['filter']){_0x5bb61b['where']=_[_0x7e22('0x39')](_0x5bb61b[_0x7e22('0x36')],{'$or':_[_0x7e22('0x28')](_0xf0bbe7,function(_0x2529cd){if(_0x2529cd['type']!=='VIRTUAL'){var _0x751b1c={};_0x751b1c[_0x2529cd['name']]={'$like':'%'+_0x2e105c[_0x7e22('0x2e')][_0x7e22('0x3a')]+'%'};return _0x751b1c;}})});}_0x5bb61b=_[_0x7e22('0x39')]({},_0x5bb61b,_0x2e105c[_0x7e22('0x3b')]);var _0x58de66={'where':_0x5bb61b[_0x7e22('0x36')]};return db['CloudProvider'][_0x7e22('0x3c')](_0x58de66)['then'](function(_0x40d7cb){_0x3e1107[_0x7e22('0x3c')]=_0x40d7cb;if(_0x2e105c['query'][_0x7e22('0x3d')]){_0x5bb61b[_0x7e22('0x3e')]=[{'all':!![]}];}return db['CloudProvider'][_0x7e22('0x3f')](_0x5bb61b);})[_0x7e22('0x40')](function(_0x4a3bca){_0x3e1107['rows']=_0x4a3bca;return _0x3e1107;})[_0x7e22('0x40')](respondWithFilteredResult(_0xc6ba6e,_0x5bb61b))[_0x7e22('0x41')](handleError(_0xc6ba6e,null));};exports['show']=function(_0x2dc1ec,_0x5232e3){var _0x549595={'raw':!![],'where':{'id':_0x2dc1ec[_0x7e22('0x42')]['id']}},_0xa1e19e={};_0xa1e19e[_0x7e22('0x2d')]=_[_0x7e22('0x2f')](db[_0x7e22('0x29')][_0x7e22('0x2a')]);_0xa1e19e['query']=_[_0x7e22('0x2f')](_0x2dc1ec[_0x7e22('0x2e')]);_0xa1e19e['filters']=_[_0x7e22('0x30')](_0xa1e19e['model'],_0xa1e19e[_0x7e22('0x2e')]);_0x549595[_0x7e22('0x31')]=_[_0x7e22('0x30')](_0xa1e19e[_0x7e22('0x2d')],qs[_0x7e22('0x32')](_0x2dc1ec['query'][_0x7e22('0x32')]));_0x549595[_0x7e22('0x31')]=_0x549595[_0x7e22('0x31')][_0x7e22('0x33')]?_0x549595[_0x7e22('0x31')]:_0xa1e19e[_0x7e22('0x2d')];if(_0x2dc1ec[_0x7e22('0x2e')][_0x7e22('0x3d')]){_0x549595[_0x7e22('0x3e')]=[{'all':!![]}];}_0x549595=_[_0x7e22('0x39')]({},_0x549595,_0x2dc1ec[_0x7e22('0x3b')]);return db['CloudProvider'][_0x7e22('0x43')](_0x549595)['then'](handleEntityNotFound(_0x5232e3,null))['then'](respondWithResult(_0x5232e3,null))[_0x7e22('0x41')](handleError(_0x5232e3,null));};exports[_0x7e22('0x44')]=function(_0x2af5a2,_0x3311a7){return db[_0x7e22('0x29')][_0x7e22('0x44')](_0x2af5a2[_0x7e22('0x45')],{})[_0x7e22('0x40')](respondWithResult(_0x3311a7,0xc9))[_0x7e22('0x41')](handleError(_0x3311a7,null));};exports[_0x7e22('0x46')]=function(_0x5142f9,_0x53b15e){if(_0x5142f9['body']['id']){delete _0x5142f9[_0x7e22('0x45')]['id'];}return db[_0x7e22('0x29')][_0x7e22('0x43')]({'where':{'id':_0x5142f9[_0x7e22('0x42')]['id']}})['then'](handleEntityNotFound(_0x53b15e,null))[_0x7e22('0x40')](saveUpdates(_0x5142f9[_0x7e22('0x45')],null))[_0x7e22('0x40')](respondWithResult(_0x53b15e,null))[_0x7e22('0x41')](handleError(_0x53b15e,null));};exports[_0x7e22('0x22')]=function(_0x496b4d,_0x5de25d){return db['CloudProvider'][_0x7e22('0x43')]({'where':{'id':_0x496b4d['params']['id']}})[_0x7e22('0x40')](handleEntityNotFound(_0x5de25d,null))[_0x7e22('0x40')](removeEntity(_0x5de25d,null))[_0x7e22('0x41')](handleError(_0x5de25d,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e7a4349..837b84a 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 _0xf312=['moment','bluebird','path','rimraf','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api'];(function(_0x5ad4be,_0x357097){var _0x156465=function(_0x4935ce){while(--_0x4935ce){_0x5ad4be['push'](_0x5ad4be['shift']());}};_0x156465(++_0x357097);}(_0xf312,0x74));var _0x2f31=function(_0x210f72,_0x1d66b8){_0x210f72=_0x210f72-0x0;var _0x3e7a8e=_0xf312[_0x210f72];return _0x3e7a8e;};'use strict';var _=require(_0x2f31('0x0'));var util=require(_0x2f31('0x1'));var logger=require(_0x2f31('0x2'))(_0x2f31('0x3'));var moment=require(_0x2f31('0x4'));var BPromise=require(_0x2f31('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f31('0x6'));var rimraf=require(_0x2f31('0x7'));var config=require('../../config/environment');var attributes=require(_0x2f31('0x8'));module['exports']=function(_0x3eec56,_0x1c8e5d){return _0x3eec56[_0x2f31('0x9')](_0x2f31('0xa'),attributes,{'tableName':_0x2f31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb41d=['cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider'];(function(_0x125dc5,_0x31f6bc){var _0x4619bb=function(_0x44e593){while(--_0x44e593){_0x125dc5['push'](_0x125dc5['shift']());}};_0x4619bb(++_0x31f6bc);}(_0xb41d,0x17a));var _0xdb41=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb41d[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require(_0xdb41('0x0'));var logger=require(_0xdb41('0x1'))(_0xdb41('0x2'));var moment=require(_0xdb41('0x3'));var BPromise=require(_0xdb41('0x4'));var rp=require(_0xdb41('0x5'));var fs=require('fs');var path=require(_0xdb41('0x6'));var rimraf=require(_0xdb41('0x7'));var config=require(_0xdb41('0x8'));var attributes=require(_0xdb41('0x9'));module['exports']=function(_0x521b96,_0x284756){return _0x521b96[_0xdb41('0xa')](_0xdb41('0xb'),attributes,{'tableName':_0xdb41('0xc'),'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 2052120..5205489 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 _0x746b=['jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x321421,_0x555332){var _0x5374a4=function(_0x31158f){while(--_0x31158f){_0x321421['push'](_0x321421['shift']());}};_0x5374a4(++_0x555332);}(_0x746b,0x11e));var _0xb746=function(_0x5dca18,_0x5d480c){_0x5dca18=_0x5dca18-0x0;var _0x4dc040=_0x746b[_0x5dca18];return _0x4dc040;};'use strict';var _=require(_0xb746('0x0'));var util=require(_0xb746('0x1'));var moment=require(_0xb746('0x2'));var BPromise=require(_0xb746('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb746('0x4'));var db=require(_0xb746('0x5'))['db'];var utils=require(_0xb746('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb746('0x7'));var jayson=require(_0xb746('0x8'));var client=jayson[_0xb746('0x9')][_0xb746('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4785db,_0x5ca791,_0x1fefa4){return new BPromise(function(_0x4f4683,_0x4eb687){return client[_0xb746('0xb')](_0x4785db,_0x1fefa4)[_0xb746('0xc')](function(_0x3b7335){logger[_0xb746('0xd')](_0xb746('0xe'),_0x5ca791,_0xb746('0xf'));logger['debug'](_0xb746('0x10'),_0x5ca791,'request\x20sent',JSON[_0xb746('0x11')](_0x3b7335));if(_0x3b7335[_0xb746('0x12')]){if(_0x3b7335[_0xb746('0x12')]['code']===0x1f4){logger[_0xb746('0x12')](_0xb746('0xe'),_0x5ca791,_0x3b7335[_0xb746('0x12')][_0xb746('0x13')]);return _0x4eb687(_0x3b7335[_0xb746('0x12')][_0xb746('0x13')]);}logger[_0xb746('0x12')]('CloudProvider,\x20%s,\x20%s',_0x5ca791,_0x3b7335[_0xb746('0x12')]['message']);return _0x4f4683(_0x3b7335['error'][_0xb746('0x13')]);}else{logger[_0xb746('0xd')](_0xb746('0xe'),_0x5ca791,'request\x20sent');_0x4f4683(_0x3b7335[_0xb746('0x14')][_0xb746('0x13')]);}})['catch'](function(_0x2cd7dc){logger['error'](_0xb746('0xe'),_0x5ca791,_0x2cd7dc);_0x4eb687(_0x2cd7dc);});});} \ No newline at end of file +var _0x9b0e=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9b0e,0x159));var _0xe9b0=function(_0x22916d,_0x2c4af3){_0x22916d=_0x22916d-0x0;var _0xc42f9c=_0x9b0e[_0x22916d];return _0xc42f9c;};'use strict';var _=require(_0xe9b0('0x0'));var util=require(_0xe9b0('0x1'));var moment=require(_0xe9b0('0x2'));var BPromise=require(_0xe9b0('0x3'));var rs=require(_0xe9b0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9b0('0x6'))(_0xe9b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe9b0('0x8'));var client=jayson[_0xe9b0('0x9')][_0xe9b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1349e6,_0x2d2488,_0x5ed25a){return new BPromise(function(_0x56f77a,_0x716ae2){return client[_0xe9b0('0xb')](_0x1349e6,_0x5ed25a)[_0xe9b0('0xc')](function(_0x438bf3){logger[_0xe9b0('0xd')](_0xe9b0('0xe'),_0x2d2488,_0xe9b0('0xf'));logger[_0xe9b0('0x10')](_0xe9b0('0x11'),_0x2d2488,_0xe9b0('0xf'),JSON['stringify'](_0x438bf3));if(_0x438bf3[_0xe9b0('0x12')]){if(_0x438bf3[_0xe9b0('0x12')][_0xe9b0('0x13')]===0x1f4){logger['error'](_0xe9b0('0xe'),_0x2d2488,_0x438bf3['error'][_0xe9b0('0x14')]);return _0x716ae2(_0x438bf3['error'][_0xe9b0('0x14')]);}logger['error'](_0xe9b0('0xe'),_0x2d2488,_0x438bf3[_0xe9b0('0x12')][_0xe9b0('0x14')]);return _0x56f77a(_0x438bf3[_0xe9b0('0x12')][_0xe9b0('0x14')]);}else{logger[_0xe9b0('0xd')](_0xe9b0('0xe'),_0x2d2488,_0xe9b0('0xf'));_0x56f77a(_0x438bf3[_0xe9b0('0x15')][_0xe9b0('0x14')]);}})[_0xe9b0('0x16')](function(_0x2c2ca2){logger['error']('CloudProvider,\x20%s,\x20%s',_0x2d2488,_0x2c2ca2);_0x716ae2(_0x2c2ca2);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index eb7b6d9..fe718d0 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 _0x9be8=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','create'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9be8,0xe9));var _0x89be=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0x9be8[_0x53b93b];return _0x485761;};'use strict';var multer=require(_0x89be('0x0'));var util=require(_0x89be('0x1'));var path=require(_0x89be('0x2'));var timeout=require(_0x89be('0x3'));var express=require(_0x89be('0x4'));var router=express[_0x89be('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x89be('0x6'));var config=require(_0x89be('0x7'));var controller=require(_0x89be('0x8'));router[_0x89be('0x9')]('/',auth[_0x89be('0xa')](),controller[_0x89be('0xb')]);router[_0x89be('0x9')](_0x89be('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x89be('0xa')](),controller[_0x89be('0xd')]);router[_0x89be('0xe')](_0x89be('0xc'),auth[_0x89be('0xa')](),controller[_0x89be('0xf')]);router[_0x89be('0x10')](_0x89be('0xc'),auth[_0x89be('0xa')](),controller[_0x89be('0x11')]);module[_0x89be('0x12')]=router; \ No newline at end of file +var _0x9c3a=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy'];(function(_0x4bdfc6,_0x4c2991){var _0x5091d0=function(_0x16cdc1){while(--_0x16cdc1){_0x4bdfc6['push'](_0x4bdfc6['shift']());}};_0x5091d0(++_0x4c2991);}(_0x9c3a,0x161));var _0xa9c3=function(_0x133d99,_0xad4d6d){_0x133d99=_0x133d99-0x0;var _0x110e04=_0x9c3a[_0x133d99];return _0x110e04;};'use strict';var multer=require(_0xa9c3('0x0'));var util=require('util');var path=require(_0xa9c3('0x1'));var timeout=require(_0xa9c3('0x2'));var express=require(_0xa9c3('0x3'));var router=express['Router']();var auth=require(_0xa9c3('0x4'));var interaction=require(_0xa9c3('0x5'));var config=require('../../config/environment');var controller=require(_0xa9c3('0x6'));router[_0xa9c3('0x7')]('/',auth[_0xa9c3('0x8')](),controller['index']);router[_0xa9c3('0x7')](_0xa9c3('0x9'),auth[_0xa9c3('0x8')](),controller[_0xa9c3('0xa')]);router['post']('/',auth[_0xa9c3('0x8')](),controller['create']);router[_0xa9c3('0xb')](_0xa9c3('0x9'),auth['isAuthenticated'](),controller[_0xa9c3('0xc')]);router[_0xa9c3('0xd')](_0xa9c3('0x9'),auth[_0xa9c3('0x8')](),controller[_0xa9c3('0xe')]);module[_0xa9c3('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 f6ba603..bbceb77 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 _0x5724=['sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5724,0x12e));var _0x4572=function(_0x4abe22,_0x209554){_0x4abe22=_0x4abe22-0x0;var _0x2f9eaa=_0x5724[_0x4abe22];return _0x2f9eaa;};'use strict';var Sequelize=require(_0x4572('0x0'));module['exports']={'name':{'type':Sequelize[_0x4572('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4572('0x1')]},'companyId':{'type':Sequelize[_0x4572('0x1')]},'website':{'type':Sequelize[_0x4572('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x4572('0x1')]},'type':{'type':Sequelize[_0x4572('0x1')]},'street':{'type':Sequelize[_0x4572('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x4572('0x1')]},'country':{'type':Sequelize[_0x4572('0x1')]},'email':{'type':Sequelize[_0x4572('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4572('0x1')]},'sCountry':{'type':Sequelize[_0x4572('0x1')]},'description':{'type':Sequelize[_0x4572('0x1')]}}; \ No newline at end of file +var _0x2af1=['exports','STRING','name'];(function(_0xae5ad4,_0x58b46e){var _0x54d414=function(_0x4dfda7){while(--_0x4dfda7){_0xae5ad4['push'](_0xae5ad4['shift']());}};_0x54d414(++_0x58b46e);}(_0x2af1,0x153));var _0x12af=function(_0x2db7b8,_0x2e1a53){_0x2db7b8=_0x2db7b8-0x0;var _0x5559e1=_0x2af1[_0x2db7b8];return _0x5559e1;};'use strict';var Sequelize=require('sequelize');module[_0x12af('0x0')]={'name':{'type':Sequelize[_0x12af('0x1')],'unique':_0x12af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x12af('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x12af('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x12af('0x1')]},'street':{'type':Sequelize[_0x12af('0x1')]},'postalCode':{'type':Sequelize[_0x12af('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x12af('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x12af('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x12af('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x12af('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 23376f6..4f4a17e 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 _0xc9ef=['includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','CmContact','addContacts','omit','ids','getContacts','length','map','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x1fb8a2,_0x392e42){var _0xedeaa4=function(_0x511d8d){while(--_0x511d8d){_0x1fb8a2['push'](_0x1fb8a2['shift']());}};_0xedeaa4(++_0x392e42);}(_0xc9ef,0x19f));var _0xfc9e=function(_0x167307,_0x5a60ae){_0x167307=_0x167307-0x0;var _0x550140=_0xc9ef[_0x167307];return _0x550140;};'use strict';var pdf=require(_0xfc9e('0x0'));var emlformat=require(_0xfc9e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfc9e('0x2'));var jsonpatch=require(_0xfc9e('0x3'));var rp=require('request-promise');var moment=require(_0xfc9e('0x4'));var BPromise=require(_0xfc9e('0x5'));var Mustache=require(_0xfc9e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfc9e('0x7'));var csv=require(_0xfc9e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfc9e('0x9'));var crypto=require(_0xfc9e('0xa'));var jsforce=require(_0xfc9e('0xb'));var deskjs=require(_0xfc9e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfc9e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc9e('0xe'));var logger=require(_0xfc9e('0xf'))(_0xfc9e('0x10'));var utils=require(_0xfc9e('0x11'));var config=require('../../config/environment');var db=require(_0xfc9e('0x12'))['db'];function respondWithStatusCode(_0x263b0e,_0x3bacf9){_0x3bacf9=_0x3bacf9||0xcc;return function(_0x9ff285){if(_0x9ff285){return _0x263b0e[_0xfc9e('0x13')](_0x3bacf9);}return _0x263b0e[_0xfc9e('0x14')](_0x3bacf9)[_0xfc9e('0x15')]();};}function respondWithResult(_0x3b171a,_0x42d35f){_0x42d35f=_0x42d35f||0xc8;return function(_0x5cd30f){if(_0x5cd30f){return _0x3b171a[_0xfc9e('0x14')](_0x42d35f)[_0xfc9e('0x16')](_0x5cd30f);}};}function respondWithFilteredResult(_0x516f6f,_0x367346){return function(_0x48d2f8){if(_0x48d2f8){var _0x27902f=_0x48d2f8[_0xfc9e('0x17')],_0x4ef10e=_0x367346[_0xfc9e('0x18')],_0x1fad22=_0x367346[_0xfc9e('0x18')]+_0x367346[_0xfc9e('0x19')],_0x261242;if(_0x1fad22>=_0x27902f){_0x1fad22=_0x27902f;_0x261242=0xc8;}else{_0x261242=0xce;}_0x516f6f[_0xfc9e('0x14')](_0x261242);return _0x516f6f[_0xfc9e('0x1a')](_0xfc9e('0x1b'),_0x4ef10e+'-'+_0x1fad22+'/'+_0x27902f)[_0xfc9e('0x16')](_0x48d2f8);}return null;};}function patchUpdates(_0x405562){return function(_0x4af9d6){try{jsonpatch['apply'](_0x4af9d6,_0x405562,!![]);}catch(_0x535cf5){return BPromise[_0xfc9e('0x1c')](_0x535cf5);}return _0x4af9d6['save']();};}function saveUpdates(_0x15ad94,_0x583b0e){return function(_0x537464){if(_0x537464){return _0x537464[_0xfc9e('0x1d')](_0x15ad94)[_0xfc9e('0x1e')](function(_0x1213a6){return _0x1213a6;});}return null;};}function removeEntity(_0x31c69f,_0x424897){return function(_0x57b351){if(_0x57b351){return _0x57b351[_0xfc9e('0x1f')]()[_0xfc9e('0x1e')](function(){var _0x48277b=_0x57b351[_0xfc9e('0x20')]({'plain':!![]});var _0x22eee3='Companies';return db['UserProfileResource'][_0xfc9e('0x1f')]({'where':{'type':_0x22eee3,'resourceId':_0x48277b['id']}})[_0xfc9e('0x1e')](function(){return _0x57b351;});})[_0xfc9e('0x1e')](function(){_0x31c69f['status'](0xcc)[_0xfc9e('0x15')]();});}};}function handleEntityNotFound(_0xa6dd23,_0x4a8704){return function(_0x9aa6b4){if(!_0x9aa6b4){_0xa6dd23[_0xfc9e('0x13')](0x194);}return _0x9aa6b4;};}function handleError(_0x376efa,_0x51e7e7){_0x51e7e7=_0x51e7e7||0x1f4;return function(_0x4ff5f7){logger['error'](_0x4ff5f7[_0xfc9e('0x21')]);if(_0x4ff5f7[_0xfc9e('0x22')]){delete _0x4ff5f7['name'];}_0x376efa[_0xfc9e('0x14')](_0x51e7e7)['send'](_0x4ff5f7);};}exports[_0xfc9e('0x23')]=function(_0x5862ba,_0x4aff40){var _0x281ba0={},_0x4dda42={},_0xacb737={'count':0x0,'rows':[]};return db[_0xfc9e('0x24')][_0xfc9e('0x25')]()[_0xfc9e('0x1e')](function(_0xe15fa8){_0x4dda42[_0xfc9e('0x26')]=_[_0xfc9e('0x27')](_0xe15fa8);_0x4dda42[_0xfc9e('0x28')]=_[_0xfc9e('0x27')](_0x5862ba[_0xfc9e('0x28')]);_0x4dda42[_0xfc9e('0x29')]=_[_0xfc9e('0x2a')](_0x4dda42['model'],_0x4dda42['query']);_0x281ba0[_0xfc9e('0x2b')]=_[_0xfc9e('0x2a')](_0x4dda42[_0xfc9e('0x26')],qs[_0xfc9e('0x2c')](_0x5862ba['query'][_0xfc9e('0x2c')]));_0x281ba0[_0xfc9e('0x2b')]=_0x281ba0[_0xfc9e('0x2b')]['length']?_0x281ba0[_0xfc9e('0x2b')]:_0x4dda42[_0xfc9e('0x26')];if(!_0x5862ba[_0xfc9e('0x28')][_0xfc9e('0x2d')](_0xfc9e('0x2e'))){_0x281ba0[_0xfc9e('0x19')]=qs['limit'](_0x5862ba['query'][_0xfc9e('0x19')]);_0x281ba0[_0xfc9e('0x18')]=qs[_0xfc9e('0x18')](_0x5862ba[_0xfc9e('0x28')][_0xfc9e('0x18')]);}_0x281ba0[_0xfc9e('0x2f')]=qs[_0xfc9e('0x30')](_0x5862ba[_0xfc9e('0x28')][_0xfc9e('0x30')]);_0x281ba0['where']=qs['filters'](_[_0xfc9e('0x31')](_0x5862ba['query'],_0x4dda42['filters']),_0xe15fa8);if(_0x5862ba[_0xfc9e('0x28')][_0xfc9e('0x32')]){_0x281ba0[_0xfc9e('0x33')]=_['merge'](_0x281ba0[_0xfc9e('0x33')],{'$or':_['map'](_0x281ba0['attributes'],function(_0xec445d){var _0x55e446={};_0x55e446[_0xec445d]={'$like':'%'+_0x5862ba[_0xfc9e('0x28')][_0xfc9e('0x32')]+'%'};return _0x55e446;})});}_0x281ba0=_[_0xfc9e('0x34')]({},_0x281ba0,_0x5862ba['options']);var _0x55d968={'where':_0x281ba0['where']};return db[_0xfc9e('0x24')][_0xfc9e('0x17')](_0x55d968)[_0xfc9e('0x1e')](function(_0x480e81){_0xacb737[_0xfc9e('0x17')]=_0x480e81;if(_0x5862ba['query'][_0xfc9e('0x35')]){_0x281ba0[_0xfc9e('0x36')]=[{'all':!![]}];}return db[_0xfc9e('0x24')][_0xfc9e('0x37')](_0x281ba0);})['then'](function(_0x41d0ee){_0xacb737[_0xfc9e('0x38')]=_0x41d0ee;return _0xacb737;})['then'](respondWithFilteredResult(_0x4aff40,_0x281ba0))[_0xfc9e('0x39')](handleError(_0x4aff40,null));})['catch'](handleError(_0x4aff40,null));};exports['show']=function(_0x1e4464,_0x2e1223){var _0x49ca4e={'raw':![],'where':{'id':_0x1e4464[_0xfc9e('0x3a')]['id']}},_0x44e7fc={};_0x44e7fc[_0xfc9e('0x26')]=_[_0xfc9e('0x27')](db[_0xfc9e('0x24')][_0xfc9e('0x3b')]);_0x44e7fc[_0xfc9e('0x28')]=_[_0xfc9e('0x27')](_0x1e4464[_0xfc9e('0x28')]);_0x44e7fc[_0xfc9e('0x29')]=_['intersection'](_0x44e7fc[_0xfc9e('0x26')],_0x44e7fc['query']);_0x49ca4e[_0xfc9e('0x2b')]=_['intersection'](_0x44e7fc['model'],qs[_0xfc9e('0x2c')](_0x1e4464[_0xfc9e('0x28')][_0xfc9e('0x2c')]));_0x49ca4e['attributes']=_0x49ca4e[_0xfc9e('0x2b')]['length']?_0x49ca4e['attributes']:_0x44e7fc[_0xfc9e('0x26')];if(_0x1e4464[_0xfc9e('0x28')][_0xfc9e('0x35')]){_0x49ca4e[_0xfc9e('0x36')]=[{'all':!![]}];}_0x49ca4e=_[_0xfc9e('0x34')]({},_0x49ca4e,_0x1e4464[_0xfc9e('0x3c')]);return db[_0xfc9e('0x24')][_0xfc9e('0x3d')](_0x49ca4e)['then'](handleEntityNotFound(_0x2e1223,null))['then'](respondWithResult(_0x2e1223,null))['catch'](handleError(_0x2e1223,null));};exports[_0xfc9e('0x3e')]=function(_0x12ee85,_0x3b85f5){return db[_0xfc9e('0x24')][_0xfc9e('0x3e')](_0x12ee85[_0xfc9e('0x3f')],{})[_0xfc9e('0x1e')](function(_0x51fd8b){var _0x20e072=_0x12ee85[_0xfc9e('0x40')][_0xfc9e('0x20')]({'plain':!![]});if(!_0x20e072)throw new Error(_0xfc9e('0x41'));if(_0x20e072[_0xfc9e('0x42')]===_0xfc9e('0x40')){var _0x5d16c1=_0x51fd8b[_0xfc9e('0x20')]({'plain':!![]});var _0x40ec0b='Companies';return db[_0xfc9e('0x43')][_0xfc9e('0x3d')]({'where':{'name':_0x40ec0b,'userProfileId':_0x20e072[_0xfc9e('0x44')]},'raw':!![]})[_0xfc9e('0x1e')](function(_0x531188){if(_0x531188&&_0x531188['autoAssociation']===0x0){return db[_0xfc9e('0x45')][_0xfc9e('0x3e')]({'name':_0x5d16c1[_0xfc9e('0x22')],'resourceId':_0x5d16c1['id'],'type':_0x531188[_0xfc9e('0x22')],'sectionId':_0x531188['id']},{})[_0xfc9e('0x1e')](function(){return _0x51fd8b;});}else{return _0x51fd8b;}})[_0xfc9e('0x39')](function(_0x3c3d86){logger[_0xfc9e('0x46')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3d86);throw _0x3c3d86;});}return _0x51fd8b;})[_0xfc9e('0x1e')](respondWithResult(_0x3b85f5,0xc9))[_0xfc9e('0x39')](handleError(_0x3b85f5,null));};exports[_0xfc9e('0x1d')]=function(_0x299e17,_0x5ed952){if(_0x299e17[_0xfc9e('0x3f')]['id']){delete _0x299e17[_0xfc9e('0x3f')]['id'];}return db['CmCompany'][_0xfc9e('0x3d')]({'where':{'id':_0x299e17['params']['id']}})['then'](handleEntityNotFound(_0x5ed952,null))['then'](saveUpdates(_0x299e17[_0xfc9e('0x3f')],null))[_0xfc9e('0x1e')](respondWithResult(_0x5ed952,null))['catch'](handleError(_0x5ed952,null));};exports[_0xfc9e('0x1f')]=function(_0x3a3b17,_0x3129be){return db[_0xfc9e('0x24')][_0xfc9e('0x3d')]({'where':{'id':_0x3a3b17[_0xfc9e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3129be,null))['then'](removeEntity(_0x3129be,null))['catch'](handleError(_0x3129be,null));};exports[_0xfc9e('0x25')]=function(_0x4ebb80,_0x3ae3fe){return db[_0xfc9e('0x24')][_0xfc9e('0x25')]()['then'](respondWithResult(_0x3ae3fe,null))[_0xfc9e('0x39')](handleError(_0x3ae3fe,null));};exports['addContacts']=function(_0x48c7f2,_0x45316e,_0x20e3c4){return db[_0xfc9e('0x47')][_0xfc9e('0x3d')]({'where':{'id':_0x48c7f2[_0xfc9e('0x3a')]['id']}})[_0xfc9e('0x1e')](handleEntityNotFound(_0x45316e,null))['then'](function(_0x46d49c){if(_0x46d49c){return _0x46d49c[_0xfc9e('0x48')](_0x48c7f2['body']['ids'],_[_0xfc9e('0x49')](_0x48c7f2[_0xfc9e('0x3f')],[_0xfc9e('0x4a'),'id'])||{});}})[_0xfc9e('0x1e')](respondWithResult(_0x45316e,null))['catch'](handleError(_0x45316e,null));};exports[_0xfc9e('0x4b')]=function(_0x4c4011,_0x5117c2,_0x18a331){var _0x2963ed={};var _0x55f454={};var _0xd948c9;var _0x233f17;return db[_0xfc9e('0x24')]['findOne']({'where':{'id':_0x4c4011[_0xfc9e('0x3a')]['id']}})[_0xfc9e('0x1e')](handleEntityNotFound(_0x5117c2,null))[_0xfc9e('0x1e')](function(_0x98e6e8){if(_0x98e6e8){_0xd948c9=_0x98e6e8;_0x55f454[_0xfc9e('0x26')]=_[_0xfc9e('0x27')](db[_0xfc9e('0x47')][_0xfc9e('0x3b')]);_0x55f454[_0xfc9e('0x28')]=_[_0xfc9e('0x27')](_0x4c4011[_0xfc9e('0x28')]);_0x55f454[_0xfc9e('0x29')]=_[_0xfc9e('0x2a')](_0x55f454[_0xfc9e('0x26')],_0x55f454['query']);_0x2963ed[_0xfc9e('0x2b')]=_['intersection'](_0x55f454[_0xfc9e('0x26')],qs[_0xfc9e('0x2c')](_0x4c4011[_0xfc9e('0x28')][_0xfc9e('0x2c')]));_0x2963ed[_0xfc9e('0x2b')]=_0x2963ed[_0xfc9e('0x2b')][_0xfc9e('0x4c')]?_0x2963ed[_0xfc9e('0x2b')]:_0x55f454[_0xfc9e('0x26')];_0x2963ed[_0xfc9e('0x2f')]=qs['sort'](_0x4c4011[_0xfc9e('0x28')][_0xfc9e('0x30')]);_0x2963ed[_0xfc9e('0x33')]=qs[_0xfc9e('0x29')](_[_0xfc9e('0x31')](_0x4c4011[_0xfc9e('0x28')],_0x55f454[_0xfc9e('0x29')]));if(_0x4c4011[_0xfc9e('0x28')][_0xfc9e('0x32')]){_0x2963ed[_0xfc9e('0x33')]=_[_0xfc9e('0x34')](_0x2963ed['where'],{'$or':_[_0xfc9e('0x4d')](_0x2963ed['attributes'],function(_0x13181a){var _0x306abf={};_0x306abf[_0x13181a]={'$like':'%'+_0x4c4011[_0xfc9e('0x28')][_0xfc9e('0x32')]+'%'};return _0x306abf;})});}_0x2963ed=_[_0xfc9e('0x34')]({},_0x2963ed,_0x4c4011['options']);return _0xd948c9[_0xfc9e('0x4b')](_0x2963ed);}})[_0xfc9e('0x1e')](function(_0x17f1ac){if(_0x17f1ac){_0x233f17=_0x17f1ac[_0xfc9e('0x4c')];if(!_0x4c4011[_0xfc9e('0x28')][_0xfc9e('0x2d')](_0xfc9e('0x2e'))){_0x2963ed['limit']=qs[_0xfc9e('0x19')](_0x4c4011['query'][_0xfc9e('0x19')]);_0x2963ed[_0xfc9e('0x18')]=qs['offset'](_0x4c4011[_0xfc9e('0x28')][_0xfc9e('0x18')]);}return _0xd948c9[_0xfc9e('0x4b')](_0x2963ed);}})[_0xfc9e('0x1e')](function(_0x50aa3c){if(_0x50aa3c){return _0x50aa3c?{'count':_0x233f17,'rows':_0x50aa3c}:null;}})[_0xfc9e('0x1e')](respondWithResult(_0x5117c2,null))[_0xfc9e('0x39')](handleError(_0x5117c2,null));}; \ No newline at end of file +var _0xb611=['create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','findOne','rawAttributes','order','getContacts','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','Companies','UserProfileResource','name','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','find'];(function(_0x537ea9,_0x33bb0b){var _0x260b28=function(_0x1fe788){while(--_0x1fe788){_0x537ea9['push'](_0x537ea9['shift']());}};_0x260b28(++_0x33bb0b);}(_0xb611,0x68));var _0x1b61=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xb611[_0x45f951];return _0x24756c;};'use strict';var pdf=require(_0x1b61('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1b61('0x1'));var zipdir=require(_0x1b61('0x2'));var jsonpatch=require(_0x1b61('0x3'));var rp=require(_0x1b61('0x4'));var moment=require(_0x1b61('0x5'));var BPromise=require(_0x1b61('0x6'));var Mustache=require(_0x1b61('0x7'));var util=require('util');var path=require(_0x1b61('0x8'));var sox=require(_0x1b61('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b61('0xa'));var squel=require(_0x1b61('0xb'));var crypto=require(_0x1b61('0xc'));var jsforce=require(_0x1b61('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1b61('0xe'));var Papa=require(_0x1b61('0xf'));var Redis=require(_0x1b61('0x10'));var authService=require(_0x1b61('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b61('0x12'));var logger=require(_0x1b61('0x13'))(_0x1b61('0x14'));var utils=require(_0x1b61('0x15'));var config=require(_0x1b61('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4be50a,_0x5319a2){_0x5319a2=_0x5319a2||0xcc;return function(_0x4624b2){if(_0x4624b2){return _0x4be50a[_0x1b61('0x17')](_0x5319a2);}return _0x4be50a['status'](_0x5319a2)[_0x1b61('0x18')]();};}function respondWithResult(_0x98fc0f,_0x5069db){_0x5069db=_0x5069db||0xc8;return function(_0x5c7333){if(_0x5c7333){return _0x98fc0f[_0x1b61('0x19')](_0x5069db)['json'](_0x5c7333);}};}function respondWithFilteredResult(_0x365c11,_0x30b63b){return function(_0x5bea3c){if(_0x5bea3c){var _0x9e714f=_0x5bea3c[_0x1b61('0x1a')],_0x1d038c=_0x30b63b['offset'],_0x4ec23f=_0x30b63b['offset']+_0x30b63b[_0x1b61('0x1b')],_0x3f671e;if(_0x4ec23f>=_0x9e714f){_0x4ec23f=_0x9e714f;_0x3f671e=0xc8;}else{_0x3f671e=0xce;}_0x365c11[_0x1b61('0x19')](_0x3f671e);return _0x365c11[_0x1b61('0x1c')](_0x1b61('0x1d'),_0x1d038c+'-'+_0x4ec23f+'/'+_0x9e714f)[_0x1b61('0x1e')](_0x5bea3c);}return null;};}function patchUpdates(_0x20fc5a){return function(_0x43569c){try{jsonpatch[_0x1b61('0x1f')](_0x43569c,_0x20fc5a,!![]);}catch(_0x1e0c98){return BPromise[_0x1b61('0x20')](_0x1e0c98);}return _0x43569c[_0x1b61('0x21')]();};}function saveUpdates(_0x107a38,_0x111a0e){return function(_0xcd8be6){if(_0xcd8be6){return _0xcd8be6[_0x1b61('0x22')](_0x107a38)[_0x1b61('0x23')](function(_0x413b22){return _0x413b22;});}return null;};}function removeEntity(_0x587465,_0x4c5b58){return function(_0x37b6f0){if(_0x37b6f0){return _0x37b6f0[_0x1b61('0x24')]()[_0x1b61('0x23')](function(){var _0x555124=_0x37b6f0['get']({'plain':!![]});var _0x1bf765=_0x1b61('0x25');return db[_0x1b61('0x26')][_0x1b61('0x24')]({'where':{'type':_0x1bf765,'resourceId':_0x555124['id']}})['then'](function(){return _0x37b6f0;});})[_0x1b61('0x23')](function(){_0x587465[_0x1b61('0x19')](0xcc)[_0x1b61('0x18')]();});}};}function handleEntityNotFound(_0x108ef0,_0x2238ae){return function(_0x58c1c0){if(!_0x58c1c0){_0x108ef0[_0x1b61('0x17')](0x194);}return _0x58c1c0;};}function handleError(_0x384e1f,_0x5b572b){_0x5b572b=_0x5b572b||0x1f4;return function(_0x1ae5a4){logger['error'](_0x1ae5a4['stack']);if(_0x1ae5a4[_0x1b61('0x27')]){delete _0x1ae5a4[_0x1b61('0x27')];}_0x384e1f[_0x1b61('0x19')](_0x5b572b)['send'](_0x1ae5a4);};}exports[_0x1b61('0x28')]=function(_0x3d72f2,_0x36c4e6){var _0x5ceb86={},_0x174301={},_0x2b41c7={'count':0x0,'rows':[]};return db[_0x1b61('0x29')]['describe']()[_0x1b61('0x23')](function(_0x3fc165){_0x174301[_0x1b61('0x2a')]=_[_0x1b61('0x2b')](_0x3fc165);_0x174301[_0x1b61('0x2c')]=_[_0x1b61('0x2b')](_0x3d72f2['query']);_0x174301[_0x1b61('0x2d')]=_[_0x1b61('0x2e')](_0x174301[_0x1b61('0x2a')],_0x174301[_0x1b61('0x2c')]);_0x5ceb86[_0x1b61('0x2f')]=_[_0x1b61('0x2e')](_0x174301[_0x1b61('0x2a')],qs[_0x1b61('0x30')](_0x3d72f2[_0x1b61('0x2c')][_0x1b61('0x30')]));_0x5ceb86[_0x1b61('0x2f')]=_0x5ceb86[_0x1b61('0x2f')][_0x1b61('0x31')]?_0x5ceb86[_0x1b61('0x2f')]:_0x174301['model'];if(!_0x3d72f2[_0x1b61('0x2c')]['hasOwnProperty'](_0x1b61('0x32'))){_0x5ceb86[_0x1b61('0x1b')]=qs[_0x1b61('0x1b')](_0x3d72f2['query'][_0x1b61('0x1b')]);_0x5ceb86[_0x1b61('0x33')]=qs[_0x1b61('0x33')](_0x3d72f2[_0x1b61('0x2c')]['offset']);}_0x5ceb86['order']=qs[_0x1b61('0x34')](_0x3d72f2[_0x1b61('0x2c')][_0x1b61('0x34')]);_0x5ceb86[_0x1b61('0x35')]=qs['filters'](_[_0x1b61('0x36')](_0x3d72f2[_0x1b61('0x2c')],_0x174301[_0x1b61('0x2d')]),_0x3fc165);if(_0x3d72f2['query'][_0x1b61('0x37')]){_0x5ceb86[_0x1b61('0x35')]=_[_0x1b61('0x38')](_0x5ceb86[_0x1b61('0x35')],{'$or':_['map'](_0x5ceb86[_0x1b61('0x2f')],function(_0x161529){var _0x444b5e={};_0x444b5e[_0x161529]={'$like':'%'+_0x3d72f2[_0x1b61('0x2c')][_0x1b61('0x37')]+'%'};return _0x444b5e;})});}_0x5ceb86=_['merge']({},_0x5ceb86,_0x3d72f2[_0x1b61('0x39')]);var _0x4ae2ca={'where':_0x5ceb86[_0x1b61('0x35')]};return db['CmCompany']['count'](_0x4ae2ca)[_0x1b61('0x23')](function(_0x1fb69f){_0x2b41c7[_0x1b61('0x1a')]=_0x1fb69f;if(_0x3d72f2[_0x1b61('0x2c')]['includeAll']){_0x5ceb86[_0x1b61('0x3a')]=[{'all':!![]}];}return db[_0x1b61('0x29')][_0x1b61('0x3b')](_0x5ceb86);})[_0x1b61('0x23')](function(_0x487558){_0x2b41c7[_0x1b61('0x3c')]=_0x487558;return _0x2b41c7;})[_0x1b61('0x23')](respondWithFilteredResult(_0x36c4e6,_0x5ceb86))['catch'](handleError(_0x36c4e6,null));})['catch'](handleError(_0x36c4e6,null));};exports[_0x1b61('0x3d')]=function(_0x223727,_0x20c748){var _0x1794cb={'raw':![],'where':{'id':_0x223727[_0x1b61('0x3e')]['id']}},_0x192281={};_0x192281[_0x1b61('0x2a')]=_[_0x1b61('0x2b')](db[_0x1b61('0x29')]['rawAttributes']);_0x192281[_0x1b61('0x2c')]=_['keys'](_0x223727[_0x1b61('0x2c')]);_0x192281[_0x1b61('0x2d')]=_[_0x1b61('0x2e')](_0x192281[_0x1b61('0x2a')],_0x192281['query']);_0x1794cb[_0x1b61('0x2f')]=_[_0x1b61('0x2e')](_0x192281[_0x1b61('0x2a')],qs[_0x1b61('0x30')](_0x223727[_0x1b61('0x2c')]['fields']));_0x1794cb[_0x1b61('0x2f')]=_0x1794cb['attributes'][_0x1b61('0x31')]?_0x1794cb[_0x1b61('0x2f')]:_0x192281[_0x1b61('0x2a')];if(_0x223727[_0x1b61('0x2c')]['includeAll']){_0x1794cb[_0x1b61('0x3a')]=[{'all':!![]}];}_0x1794cb=_[_0x1b61('0x38')]({},_0x1794cb,_0x223727[_0x1b61('0x39')]);return db['CmCompany'][_0x1b61('0x3f')](_0x1794cb)[_0x1b61('0x23')](handleEntityNotFound(_0x20c748,null))[_0x1b61('0x23')](respondWithResult(_0x20c748,null))['catch'](handleError(_0x20c748,null));};exports[_0x1b61('0x40')]=function(_0x42c35b,_0x1abebd){return db[_0x1b61('0x29')][_0x1b61('0x40')](_0x42c35b[_0x1b61('0x41')],{})[_0x1b61('0x23')](function(_0x389e10){var _0x20fc2a=_0x42c35b[_0x1b61('0x42')][_0x1b61('0x43')]({'plain':!![]});if(!_0x20fc2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20fc2a[_0x1b61('0x44')]==='user'){var _0xcba672=_0x389e10['get']({'plain':!![]});var _0x1d2831=_0x1b61('0x25');return db[_0x1b61('0x45')][_0x1b61('0x3f')]({'where':{'name':_0x1d2831,'userProfileId':_0x20fc2a[_0x1b61('0x46')]},'raw':!![]})[_0x1b61('0x23')](function(_0x2cb8e6){if(_0x2cb8e6&&_0x2cb8e6[_0x1b61('0x47')]===0x0){return db['UserProfileResource'][_0x1b61('0x40')]({'name':_0xcba672[_0x1b61('0x27')],'resourceId':_0xcba672['id'],'type':_0x2cb8e6[_0x1b61('0x27')],'sectionId':_0x2cb8e6['id']},{})[_0x1b61('0x23')](function(){return _0x389e10;});}else{return _0x389e10;}})[_0x1b61('0x48')](function(_0x54caed){logger[_0x1b61('0x49')](_0x1b61('0x4a'),_0x54caed);throw _0x54caed;});}return _0x389e10;})[_0x1b61('0x23')](respondWithResult(_0x1abebd,0xc9))['catch'](handleError(_0x1abebd,null));};exports[_0x1b61('0x22')]=function(_0x295230,_0x482bbe){if(_0x295230[_0x1b61('0x41')]['id']){delete _0x295230[_0x1b61('0x41')]['id'];}return db['CmCompany'][_0x1b61('0x3f')]({'where':{'id':_0x295230[_0x1b61('0x3e')]['id']}})['then'](handleEntityNotFound(_0x482bbe,null))['then'](saveUpdates(_0x295230[_0x1b61('0x41')],null))[_0x1b61('0x23')](respondWithResult(_0x482bbe,null))[_0x1b61('0x48')](handleError(_0x482bbe,null));};exports['destroy']=function(_0x1524df,_0x4da55b){return db['CmCompany'][_0x1b61('0x3f')]({'where':{'id':_0x1524df[_0x1b61('0x3e')]['id']}})[_0x1b61('0x23')](handleEntityNotFound(_0x4da55b,null))[_0x1b61('0x23')](removeEntity(_0x4da55b,null))[_0x1b61('0x48')](handleError(_0x4da55b,null));};exports[_0x1b61('0x4b')]=function(_0x359516,_0x5822eb){return db[_0x1b61('0x29')][_0x1b61('0x4b')]()['then'](respondWithResult(_0x5822eb,null))[_0x1b61('0x48')](handleError(_0x5822eb,null));};exports[_0x1b61('0x4c')]=function(_0x357071,_0x49d254,_0x432f31){return db[_0x1b61('0x4d')][_0x1b61('0x3f')]({'where':{'id':_0x357071['params']['id']}})[_0x1b61('0x23')](handleEntityNotFound(_0x49d254,null))['then'](function(_0x5c7cfd){if(_0x5c7cfd){return _0x5c7cfd['addContacts'](_0x357071['body'][_0x1b61('0x4e')],_['omit'](_0x357071['body'],[_0x1b61('0x4e'),'id'])||{});}})[_0x1b61('0x23')](respondWithResult(_0x49d254,null))['catch'](handleError(_0x49d254,null));};exports['getContacts']=function(_0x3066f4,_0x5e4422,_0x1b4c3b){var _0x519d78={};var _0x571100={};var _0x1110bf;var _0x4e9b69;return db[_0x1b61('0x29')][_0x1b61('0x4f')]({'where':{'id':_0x3066f4[_0x1b61('0x3e')]['id']}})[_0x1b61('0x23')](handleEntityNotFound(_0x5e4422,null))['then'](function(_0x2a0bec){if(_0x2a0bec){_0x1110bf=_0x2a0bec;_0x571100[_0x1b61('0x2a')]=_[_0x1b61('0x2b')](db[_0x1b61('0x4d')][_0x1b61('0x50')]);_0x571100[_0x1b61('0x2c')]=_[_0x1b61('0x2b')](_0x3066f4[_0x1b61('0x2c')]);_0x571100['filters']=_[_0x1b61('0x2e')](_0x571100[_0x1b61('0x2a')],_0x571100[_0x1b61('0x2c')]);_0x519d78[_0x1b61('0x2f')]=_['intersection'](_0x571100[_0x1b61('0x2a')],qs[_0x1b61('0x30')](_0x3066f4['query']['fields']));_0x519d78[_0x1b61('0x2f')]=_0x519d78[_0x1b61('0x2f')][_0x1b61('0x31')]?_0x519d78[_0x1b61('0x2f')]:_0x571100['model'];_0x519d78[_0x1b61('0x51')]=qs[_0x1b61('0x34')](_0x3066f4['query']['sort']);_0x519d78[_0x1b61('0x35')]=qs[_0x1b61('0x2d')](_[_0x1b61('0x36')](_0x3066f4['query'],_0x571100['filters']));if(_0x3066f4[_0x1b61('0x2c')][_0x1b61('0x37')]){_0x519d78[_0x1b61('0x35')]=_[_0x1b61('0x38')](_0x519d78[_0x1b61('0x35')],{'$or':_['map'](_0x519d78[_0x1b61('0x2f')],function(_0x264d9d){var _0x8aa830={};_0x8aa830[_0x264d9d]={'$like':'%'+_0x3066f4[_0x1b61('0x2c')][_0x1b61('0x37')]+'%'};return _0x8aa830;})});}_0x519d78=_[_0x1b61('0x38')]({},_0x519d78,_0x3066f4[_0x1b61('0x39')]);return _0x1110bf[_0x1b61('0x52')](_0x519d78);}})['then'](function(_0x9a8c4a){if(_0x9a8c4a){_0x4e9b69=_0x9a8c4a[_0x1b61('0x31')];if(!_0x3066f4[_0x1b61('0x2c')][_0x1b61('0x53')](_0x1b61('0x32'))){_0x519d78[_0x1b61('0x1b')]=qs['limit'](_0x3066f4['query'][_0x1b61('0x1b')]);_0x519d78[_0x1b61('0x33')]=qs[_0x1b61('0x33')](_0x3066f4[_0x1b61('0x2c')][_0x1b61('0x33')]);}return _0x1110bf[_0x1b61('0x52')](_0x519d78);}})[_0x1b61('0x23')](function(_0x3b378f){if(_0x3b378f){return _0x3b378f?{'count':_0x4e9b69,'rows':_0x3b378f}:null;}})[_0x1b61('0x23')](respondWithResult(_0x5e4422,null))[_0x1b61('0x48')](handleError(_0x5e4422,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 0c49b13..485dc7f 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 _0xe107=['define','CmCompany','cm_companies','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./cmCompany.attributes','exports'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0xe107,0xb3));var _0x7e10=function(_0x233e6c,_0x4721fe){_0x233e6c=_0x233e6c-0x0;var _0x13f706=_0xe107[_0x233e6c];return _0x13f706;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3148=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x3148,0x1d3));var _0x8314=function(_0x5a4257,_0x3ae34d){_0x5a4257=_0x5a4257-0x0;var _0x3746a7=_0x3148[_0x5a4257];return _0x3746a7;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var logger=require('../../config/logger')(_0x8314('0x2'));var moment=require(_0x8314('0x3'));var BPromise=require(_0x8314('0x4'));var rp=require(_0x8314('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8314('0x6'));var config=require(_0x8314('0x7'));var attributes=require(_0x8314('0x8'));module[_0x8314('0x9')]=function(_0x18a30b,_0x9cb271){return _0x18a30b[_0x8314('0xa')]('CmCompany',attributes,{'tableName':_0x8314('0xb'),'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 50f1cdd..5e31bb6 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 _0x0491=['info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x2d308,_0x5547fc){var _0x2dfadb=function(_0x98c0c4){while(--_0x98c0c4){_0x2d308['push'](_0x2d308['shift']());}};_0x2dfadb(++_0x5547fc);}(_0x0491,0x95));var _0x1049=function(_0x3d760c,_0x3600e1){_0x3d760c=_0x3d760c-0x0;var _0x399178=_0x0491[_0x3d760c];return _0x399178;};'use strict';var _=require(_0x1049('0x0'));var util=require(_0x1049('0x1'));var moment=require(_0x1049('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1049('0x3'));var db=require(_0x1049('0x4'))['db'];var utils=require(_0x1049('0x5'));var logger=require(_0x1049('0x6'))(_0x1049('0x7'));var config=require('../../config/environment');var jayson=require(_0x1049('0x8'));var client=jayson[_0x1049('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x309170,_0x55108e,_0x1c9589){return new BPromise(function(_0x5dbdba,_0x3b28b4){return client[_0x1049('0xa')](_0x309170,_0x1c9589)[_0x1049('0xb')](function(_0x4029e0){logger[_0x1049('0xc')](_0x1049('0xd'),_0x55108e,'request\x20sent');logger[_0x1049('0xe')](_0x1049('0xf'),_0x55108e,_0x1049('0x10'),JSON[_0x1049('0x11')](_0x4029e0));if(_0x4029e0[_0x1049('0x12')]){if(_0x4029e0['error'][_0x1049('0x13')]===0x1f4){logger[_0x1049('0x12')](_0x1049('0xd'),_0x55108e,_0x4029e0[_0x1049('0x12')][_0x1049('0x14')]);return _0x3b28b4(_0x4029e0[_0x1049('0x12')][_0x1049('0x14')]);}logger[_0x1049('0x12')](_0x1049('0xd'),_0x55108e,_0x4029e0['error']['message']);return _0x5dbdba(_0x4029e0[_0x1049('0x12')][_0x1049('0x14')]);}else{logger[_0x1049('0xc')]('CmCompany,\x20%s,\x20%s',_0x55108e,_0x1049('0x10'));_0x5dbdba(_0x4029e0[_0x1049('0x15')][_0x1049('0x14')]);}})[_0x1049('0x16')](function(_0x447879){logger[_0x1049('0x12')](_0x1049('0xd'),_0x55108e,_0x447879);_0x3b28b4(_0x447879);});});} \ No newline at end of file +var _0x3632=['then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x3632,0x1ef));var _0x2363=function(_0x196ec9,_0x1774f0){_0x196ec9=_0x196ec9-0x0;var _0x592eb2=_0x3632[_0x196ec9];return _0x592eb2;};'use strict';var _=require(_0x2363('0x0'));var util=require(_0x2363('0x1'));var moment=require(_0x2363('0x2'));var BPromise=require('bluebird');var rs=require(_0x2363('0x3'));var fs=require('fs');var Redis=require(_0x2363('0x4'));var db=require(_0x2363('0x5'))['db'];var utils=require(_0x2363('0x6'));var logger=require('../../config/logger')(_0x2363('0x7'));var config=require(_0x2363('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2363('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11aab7,_0x280e83,_0x194312){return new BPromise(function(_0x217289,_0x5a9adb){return client[_0x2363('0xa')](_0x11aab7,_0x194312)[_0x2363('0xb')](function(_0x3435fb){logger['info']('CmCompany,\x20%s,\x20%s',_0x280e83,_0x2363('0xc'));logger[_0x2363('0xd')](_0x2363('0xe'),_0x280e83,_0x2363('0xc'),JSON['stringify'](_0x3435fb));if(_0x3435fb[_0x2363('0xf')]){if(_0x3435fb[_0x2363('0xf')][_0x2363('0x10')]===0x1f4){logger[_0x2363('0xf')](_0x2363('0x11'),_0x280e83,_0x3435fb[_0x2363('0xf')][_0x2363('0x12')]);return _0x5a9adb(_0x3435fb['error']['message']);}logger[_0x2363('0xf')](_0x2363('0x11'),_0x280e83,_0x3435fb['error'][_0x2363('0x12')]);return _0x217289(_0x3435fb[_0x2363('0xf')]['message']);}else{logger[_0x2363('0x13')](_0x2363('0x11'),_0x280e83,'request\x20sent');_0x217289(_0x3435fb[_0x2363('0x14')][_0x2363('0x12')]);}})[_0x2363('0x15')](function(_0x5bbfa1){logger[_0x2363('0xf')](_0x2363('0x11'),_0x280e83,_0x5bbfa1);_0x5a9adb(_0x5bbfa1);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 03a54c1..705e01f 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 _0x93e9=['connect-timeout','express','Router','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x93e9,0xcc));var _0x993e=function(_0x56e4a3,_0x471885){_0x56e4a3=_0x56e4a3-0x0;var _0x318330=_0x93e9[_0x56e4a3];return _0x318330;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var auth=require(_0x993e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x993e('0x7'));router[_0x993e('0x8')]('/',auth[_0x993e('0x9')](),controller[_0x993e('0xa')]);router[_0x993e('0x8')](_0x993e('0xb'),auth[_0x993e('0x9')](),controller[_0x993e('0xc')]);router['get'](_0x993e('0xd'),auth[_0x993e('0x9')](),controller[_0x993e('0xe')]);router[_0x993e('0x8')](_0x993e('0xf'),auth[_0x993e('0x9')](),controller[_0x993e('0x10')]);router['post']('/',auth[_0x993e('0x9')](),controller[_0x993e('0x11')]);router['post']('/:id/contacts',auth[_0x993e('0x9')](),controller['addContacts']);router[_0x993e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x993e('0x13')]);router[_0x993e('0x14')](_0x993e('0xd'),auth[_0x993e('0x9')](),controller[_0x993e('0x15')]);module[_0x993e('0x16')]=router; \ No newline at end of file +var _0xe3da=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','/:id/contacts','getContacts','post','addContacts'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var auth=require(_0xae3d('0x6'));var interaction=require(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var controller=require(_0xae3d('0x9'));router[_0xae3d('0xa')]('/',auth[_0xae3d('0xb')](),controller[_0xae3d('0xc')]);router[_0xae3d('0xa')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller['describe']);router[_0xae3d('0xa')](_0xae3d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xae3d('0xa')](_0xae3d('0xf'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xb')](),controller['create']);router[_0xae3d('0x11')]('/:id/contacts',auth[_0xae3d('0xb')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router[_0xae3d('0x15')](_0xae3d('0xe'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x16')]);module[_0xae3d('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2de2e46..405e26c 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 _0x8e48=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0xe27fbb,_0x2eb48e){var _0x3712b9=function(_0x5598e9){while(--_0x5598e9){_0xe27fbb['push'](_0xe27fbb['shift']());}};_0x3712b9(++_0x2eb48e);}(_0x8e48,0xc2));var _0x88e4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8e48[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x88e4('0x0'));var Sequelize=require(_0x88e4('0x1'));module[_0x88e4('0x2')]={'firstName':{'type':Sequelize[_0x88e4('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x88e4('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x88e4('0x3')]},'city':{'type':Sequelize[_0x88e4('0x3')]},'country':{'type':Sequelize[_0x88e4('0x3')]},'dateOfBirth':{'type':Sequelize[_0x88e4('0x3')]},'description':{'type':Sequelize[_0x88e4('0x4')]},'phone':{'type':Sequelize[_0x88e4('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x88e4('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x88e4('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x88e4('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x88e4('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x88e4('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x88e4('0x5')](0x2)[_0x88e4('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x88e4('0x7')]}}; \ No newline at end of file +var _0x313a=['TEXT','INTEGER','DATE','NOW','lodash','sequelize','exports','STRING'];(function(_0x2dc81b,_0x2063ae){var _0x3a2946=function(_0x398317){while(--_0x398317){_0x2dc81b['push'](_0x2dc81b['shift']());}};_0x3a2946(++_0x2063ae);}(_0x313a,0x194));var _0xa313=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x313a[_0x1ba43c];return _0x2f60eb;};'use strict';var _=require(_0xa313('0x0'));var Sequelize=require(_0xa313('0x1'));module[_0xa313('0x2')]={'firstName':{'type':Sequelize[_0xa313('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa313('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa313('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa313('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa313('0x4')]},'phone':{'type':Sequelize[_0xa313('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa313('0x3')]},'email':{'type':Sequelize[_0xa313('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa313('0x3')]},'fb_data':{'type':Sequelize[_0xa313('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa313('0x3')]},'wechat':{'type':Sequelize[_0xa313('0x3')]},'telegram':{'type':Sequelize[_0xa313('0x3')]},'UserId':{'type':Sequelize[_0xa313('0x5')]},'priority':{'type':Sequelize[_0xa313('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa313('0x6')],'defaultValue':Sequelize[_0xa313('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b4ce86a..cb0eaae 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 _0x950d=['limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','field','name','color','tools_tags','select','from','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','uc.UserId\x20=\x20?','value','datetime','castTo','DATE','buildExpression','start','map','isNil','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','filter','replace','\x27\x27\x27\x27','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','c.id','c.firstName','c.lastName','c.mobile','c.fax','c.email','TagIds','Tags','rows','find','tags','columnName','displayName','alias','custom','values','merge','body','findAll','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','catch','each','duplicates','$or','ListId','spread','show','params','$and','omit','cf_%d','format','table','setFields','toParam','text','phone','getTags','pick','setTags','ids','getHoppers','rawAttributes','options','includeAll','include','getHopperHistories','ContactId','getHopperFinals','getJscriptySessions','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','import','agent','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','status','json','count','offset'];(function(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0x950d,0xd1));var _0xd950=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x950d[_0x311c35];return _0x5cc50c;};'use strict';var pdf=require(_0xd950('0x0'));var emlformat=require(_0xd950('0x1'));var rimraf=require(_0xd950('0x2'));var zipdir=require(_0xd950('0x3'));var jsonpatch=require(_0xd950('0x4'));var rp=require('request-promise');var moment=require(_0xd950('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd950('0x6'));var sox=require('sox');var csv=require(_0xd950('0x7'));var ejs=require(_0xd950('0x8'));var fs=require('fs');var _=require(_0xd950('0x9'));var squel=require(_0xd950('0xa'));var crypto=require('crypto');var jsforce=require(_0xd950('0xb'));var deskjs=require(_0xd950('0xc'));var toCsv=require(_0xd950('0x7'));var querystring=require(_0xd950('0xd'));var Papa=require(_0xd950('0xe'));var Redis=require(_0xd950('0xf'));var authService=require(_0xd950('0x10'));var qs=require(_0xd950('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd950('0x12'));var logger=require(_0xd950('0x13'))(_0xd950('0x14'));var utils=require(_0xd950('0x15'));var config=require('../../config/environment');var db=require(_0xd950('0x16'))['db'];config[_0xd950('0x17')]=_[_0xd950('0x18')](config[_0xd950('0x17')],{'host':_0xd950('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd950('0x17')]));require(_0xd950('0x1a'))[_0xd950('0x1b')](socket);function respondWithStatusCode(_0x36bae3,_0x1f1b27){_0x1f1b27=_0x1f1b27||0xcc;return function(_0x3d6c0d){if(_0x3d6c0d){return _0x36bae3['sendStatus'](_0x1f1b27);}return _0x36bae3[_0xd950('0x1c')](_0x1f1b27)['end']();};}function respondWithResult(_0x394fd9,_0x1192f0){_0x1192f0=_0x1192f0||0xc8;return function(_0x853b78){if(_0x853b78){return _0x394fd9[_0xd950('0x1c')](_0x1192f0)[_0xd950('0x1d')](_0x853b78);}};}function respondWithFilteredResult(_0x25d31d,_0x2cf11a){return function(_0x2ad2f4){if(_0x2ad2f4){var _0x2566c0=_0x2ad2f4[_0xd950('0x1e')],_0x48c55a=_0x2cf11a[_0xd950('0x1f')],_0x2afb84=_0x2cf11a[_0xd950('0x1f')]+_0x2cf11a[_0xd950('0x20')],_0x504ea3;if(_0x2afb84>=_0x2566c0){_0x2afb84=_0x2566c0;_0x504ea3=0xc8;}else{_0x504ea3=0xce;}_0x25d31d[_0xd950('0x1c')](_0x504ea3);return _0x25d31d[_0xd950('0x21')](_0xd950('0x22'),_0x48c55a+'-'+_0x2afb84+'/'+_0x2566c0)[_0xd950('0x1d')](_0x2ad2f4);}return null;};}function patchUpdates(_0x1edca7){return function(_0x290969){try{jsonpatch[_0xd950('0x23')](_0x290969,_0x1edca7,!![]);}catch(_0x51200c){return BPromise[_0xd950('0x24')](_0x51200c);}return _0x290969[_0xd950('0x25')]();};}function saveUpdates(_0x58a78a,_0x436da6){return function(_0x5d9f2f){if(_0x5d9f2f){return _0x5d9f2f[_0xd950('0x26')](_0x58a78a)[_0xd950('0x27')](function(_0x1511fc){return _0x1511fc;});}return null;};}function removeEntity(_0x3a689e,_0xa754c1){return function(_0x1146ee){if(_0x1146ee){return _0x1146ee[_0xd950('0x28')]()['then'](function(){_0x3a689e[_0xd950('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bfc86,_0x425007){return function(_0x57ab22){if(!_0x57ab22){_0x5bfc86[_0xd950('0x29')](0x194);}return _0x57ab22;};}function handleError(_0x5728cc,_0x283938){_0x283938=_0x283938||0x1f4;return function(_0x12f652){logger[_0xd950('0x2a')](_0x12f652[_0xd950('0x2b')]);if(_0x12f652['name']){delete _0x12f652['name'];}_0x5728cc[_0xd950('0x1c')](_0x283938)[_0xd950('0x2c')](_0x12f652);};}exports[_0xd950('0x2d')]=function(_0x477ad8,_0x356923){var _0x2af934={},_0x2cf2c1={},_0x397cb9={'count':0x0,'rows':[]};return db[_0xd950('0x2e')][_0xd950('0x2f')]()[_0xd950('0x27')](function(_0x55be07){var _0x4051aa=[];for(var _0x2fe4b5=0x0;_0x2fe4b50x1){_0x125975['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd950('0x6c')](_0x55a132),null);}else{if(qs[_0xd950('0x6d')](_0x55a132)){_0x125975['or'](_0xd950('0x6e'),_0x55a132+'%');_0x125975['or'](_0xd950('0x6f'),_0x55a132+'%');_0x125975['or'](_0xd950('0x70'),_0x55a132+'%');_0x125975['or'](_0xd950('0x71'),_0x55a132+'%');}else if(qs['isEmail'](_0x55a132)){_0x125975['or'](_0xd950('0x72'),_0x55a132+'%');}else{_0x125975['or'](_0xd950('0x73'),'%'+_0x55a132+'%');_0x125975['or'](_0xd950('0x74'),'%'+_0x55a132+'%');_0x125975['or'](_0xd950('0x72'),'%'+_0x55a132+'%');}}}}_0x1baff6[_0xd950('0x4f')](_0x125975);_0x1baff6[_0xd950('0x75')]('c.id');var _0x475874={'type':db[_0xd950('0x76')][_0xd950('0x77')]['SELECT'],'raw':!![]};var _0x19874e=_0x1baff6[_0xd950('0x78')]()[_0xd950('0x44')]('c.id');if(_0x2af934[_0xd950('0x79')]){_0x2af934[_0xd950('0x79')][_0xd950('0x58')](function(_0x2495f2){_0x1baff6[_0xd950('0x79')]('c.'+_0x2495f2[0x0],_0x2495f2[0x1]===_0xd950('0x7a')?![]:!![]);});}if(!_[_0xd950('0x7b')](_0x3191ed)){_0x1baff6['having'](_0x2e3d83);_0x19874e[_0xd950('0x4f')](_0xd950('0x7c'),_0x3191ed);}BPromise[_0xd950('0x7d')]()[_0xd950('0x27')](function(){if(_0x4f0679&&!_['some'](_0x4f0679[_0xd950('0x55')],[_0xd950('0x44'),_0xd950('0x5a')])){return _0x477ad8[_0xd950('0x7e')][_0xd950('0x7f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5878ae){if(_['isEmpty'](_0x5878ae)){_0x19874e[_0xd950('0x4f')]('c.ListId\x20IS\x20NULL');_0x1baff6[_0xd950('0x4f')](_0xd950('0x80'));}else{_0x19874e[_0xd950('0x4f')](_0xd950('0x64'),_[_0xd950('0x62')](_0x5878ae,'id'));_0x1baff6[_0xd950('0x4f')](_0xd950('0x64'),_[_0xd950('0x62')](_0x5878ae,'id'));}});}else{return;}})[_0xd950('0x27')](function(){db[_0xd950('0x81')][_0xd950('0x3c')](_0x19874e[_0xd950('0x82')](),_0x475874)['then'](function(_0x4fb596){_0x397cb9['count']=_0x4fb596[_0xd950('0x31')];if(_0x397cb9['count']===0x0)return[];return db[_0xd950('0x81')][_0xd950('0x3c')](_0xfd1591[_0xd950('0x82')](),_0x475874);})[_0xd950('0x27')](function(_0x133cc0){_0x553a25=_[_0xd950('0x83')](_0x133cc0,'id');_0x475874=_['merge'](_0x475874,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x477ad8[_0xd950('0x3c')][_0xd950('0x40')]){_0x2af934['attributes']['forEach'](function(_0x58601b){_0x1baff6[_0xd950('0x44')]('c.'+_0x58601b);});}else{_0x1baff6[_0xd950('0x44')](_0xd950('0x84'));_0x1baff6[_0xd950('0x44')](_0xd950('0x85'));_0x1baff6['field'](_0xd950('0x86'));_0x1baff6[_0xd950('0x44')]('c.phone');_0x1baff6[_0xd950('0x44')](_0xd950('0x87'));_0x1baff6[_0xd950('0x44')](_0xd950('0x88'));_0x1baff6[_0xd950('0x44')](_0xd950('0x89'));_0x1baff6[_0xd950('0x44')]('c.ListId');_0x1baff6[_0xd950('0x44')]('c.deletedAt');_0x1baff6[_0xd950('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd950('0x8a'));}if(_0x2af934[_0xd950('0x20')])_0x1baff6[_0xd950('0x20')](_0x2af934[_0xd950('0x20')]);if(_0x2af934[_0xd950('0x1f')])_0x1baff6[_0xd950('0x1f')](_0x2af934[_0xd950('0x1f')]);return db[_0xd950('0x81')][_0xd950('0x3c')](_0x1baff6[_0xd950('0x82')](),_0x475874);})[_0xd950('0x27')](function(_0xb9f44e){_0xb9f44e[_0xd950('0x58')](function(_0x2822ae){if(_0x2822ae[_0xd950('0x8a')]){_0x2822ae[_0xd950('0x8b')]=[];_0x2822ae['TagIds'][_0xd950('0x57')](',')[_0xd950('0x58')](function(_0x316ac4){_0x2822ae['Tags'][_0xd950('0x34')](_0x553a25[_0x316ac4]);});}delete _0x2822ae[_0xd950('0x8a')];});_0x397cb9[_0xd950('0x8c')]=_0xb9f44e;return _0x397cb9;})[_0xd950('0x27')](respondWithFilteredResult(_0x356923,_0x2af934));});})['catch'](handleError(_0x356923,null));};exports[_0xd950('0x28')]=function(_0x4cf3b8,_0x267a50){return db['CmContact'][_0xd950('0x8d')]({'where':{'id':_0x4cf3b8['params']['id']}})['then'](handleEntityNotFound(_0x267a50,null))[_0xd950('0x27')](removeEntity(_0x267a50,null))['catch'](handleError(_0x267a50,null));};exports[_0xd950('0x2f')]=function(_0x39c8d9,_0x157d10){return db[_0xd950('0x2e')]['describe']()['then'](function(_0x1bea28){delete _0x1bea28[_0xd950('0x8e')];for(var _0x3bec65=0x0;_0x3bec65=_0x26861b){_0x3891c7=_0x26861b;_0x5e355c=0xc8;}else{_0x5e355c=0xce;}_0xbb33ab[_0x6755('0x1b')](_0x5e355c);return _0xbb33ab[_0x6755('0x20')](_0x6755('0x21'),_0x1ec281+'-'+_0x3891c7+'/'+_0x26861b)[_0x6755('0x1d')](_0x3447e1);}return null;};}function patchUpdates(_0x20960b){return function(_0x2e2a48){try{jsonpatch[_0x6755('0x22')](_0x2e2a48,_0x20960b,!![]);}catch(_0x1dbb7e){return BPromise['reject'](_0x1dbb7e);}return _0x2e2a48[_0x6755('0x23')]();};}function saveUpdates(_0x3e924e,_0x5d0ccd){return function(_0x1ebd2e){if(_0x1ebd2e){return _0x1ebd2e[_0x6755('0x24')](_0x3e924e)['then'](function(_0x40bdee){return _0x40bdee;});}return null;};}function removeEntity(_0x1dd7f1,_0x7335a){return function(_0x170e06){if(_0x170e06){return _0x170e06[_0x6755('0x25')]()[_0x6755('0x26')](function(){_0x1dd7f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x498ec6,_0x5765c4){return function(_0x55e0c7){if(!_0x55e0c7){_0x498ec6[_0x6755('0x27')](0x194);}return _0x55e0c7;};}function handleError(_0xf9eaab,_0x1efdb6){_0x1efdb6=_0x1efdb6||0x1f4;return function(_0x46876c){logger[_0x6755('0x28')](_0x46876c[_0x6755('0x29')]);if(_0x46876c[_0x6755('0x2a')]){delete _0x46876c[_0x6755('0x2a')];}_0xf9eaab[_0x6755('0x1b')](_0x1efdb6)[_0x6755('0x2b')](_0x46876c);};}exports[_0x6755('0x2c')]=function(_0x1ca58d,_0x334939){var _0x350023={},_0x25ad7f={},_0x4c7aa6={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0x6755('0x26')](function(_0x52f217){var _0x4057e6=[];for(var _0x432e84=0x0;_0x432e840x1){_0x25c89c['or'](_0x6755('0x64'),qs[_0x6755('0x65')](_0x1bcd64),null);}else{if(qs['isNumeric'](_0x1bcd64)){_0x25c89c['or'](_0x6755('0x66'),_0x1bcd64+'%');_0x25c89c['or'](_0x6755('0x67'),_0x1bcd64+'%');_0x25c89c['or']('c.mobile\x20LIKE\x20?',_0x1bcd64+'%');_0x25c89c['or']('c.fax\x20LIKE\x20?',_0x1bcd64+'%');}else if(qs[_0x6755('0x68')](_0x1bcd64)){_0x25c89c['or'](_0x6755('0x69'),_0x1bcd64+'%');}else{_0x25c89c['or'](_0x6755('0x6a'),'%'+_0x1bcd64+'%');_0x25c89c['or'](_0x6755('0x6b'),'%'+_0x1bcd64+'%');_0x25c89c['or']('c.email\x20LIKE\x20?','%'+_0x1bcd64+'%');}}}}_0x76509f[_0x6755('0x40')](_0x25c89c);_0x76509f[_0x6755('0x6c')](_0x6755('0x6d'));var _0x453bdd={'type':db[_0x6755('0x6e')][_0x6755('0x6f')][_0x6755('0x70')],'raw':!![]};var _0x96d75=_0x76509f[_0x6755('0x71')]()['field'](_0x6755('0x6d'));if(_0x350023[_0x6755('0x72')]){_0x350023[_0x6755('0x72')]['forEach'](function(_0x36855f){_0x76509f[_0x6755('0x72')]('c.'+_0x36855f[0x0],_0x36855f[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6755('0x73')](_0x52dbff)){_0x76509f[_0x6755('0x74')](_0x3d4055);_0x96d75[_0x6755('0x40')](_0x6755('0x75'),_0x52dbff);}BPromise[_0x6755('0x76')]()[_0x6755('0x26')](function(){if(_0x986429&&!_[_0x6755('0x77')](_0x986429['conditions'],[_0x6755('0x42'),_0x6755('0x78')])){return _0x1ca58d[_0x6755('0x79')]['getLists']({'attributes':['id'],'raw':!![]})[_0x6755('0x26')](function(_0x335bb1){if(_[_0x6755('0x73')](_0x335bb1)){_0x96d75['where']('c.ListId\x20IS\x20NULL');_0x76509f[_0x6755('0x40')]('c.ListId\x20IS\x20NULL');}else{_0x96d75[_0x6755('0x40')](_0x6755('0x7a'),_[_0x6755('0x7b')](_0x335bb1,'id'));_0x76509f['where'](_0x6755('0x7a'),_[_0x6755('0x7b')](_0x335bb1,'id'));}});}else{return;}})[_0x6755('0x26')](function(){db[_0x6755('0x7c')]['query'](_0x96d75[_0x6755('0x7d')](),_0x453bdd)['then'](function(_0x4748c7){_0x4c7aa6[_0x6755('0x7e')]=_0x4748c7[_0x6755('0x34')];if(_0x4c7aa6[_0x6755('0x7e')]===0x0)return[];return db[_0x6755('0x7c')][_0x6755('0x38')](_0x7a31d2[_0x6755('0x7d')](),_0x453bdd);})['then'](function(_0x2815cd){_0x5e06ab=_[_0x6755('0x7f')](_0x2815cd,'id');_0x453bdd=_[_0x6755('0x80')](_0x453bdd,{'model':db[_0x6755('0x81')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ca58d[_0x6755('0x38')]['fields']){_0x350023[_0x6755('0x3c')][_0x6755('0x55')](function(_0x8ca56a){_0x76509f[_0x6755('0x42')]('c.'+_0x8ca56a);});}else{_0x76509f[_0x6755('0x42')]('c.id');_0x76509f[_0x6755('0x42')](_0x6755('0x82'));_0x76509f['field'](_0x6755('0x83'));_0x76509f[_0x6755('0x42')](_0x6755('0x84'));_0x76509f['field']('c.mobile');_0x76509f[_0x6755('0x42')](_0x6755('0x85'));_0x76509f['field'](_0x6755('0x86'));_0x76509f[_0x6755('0x42')](_0x6755('0x87'));_0x76509f[_0x6755('0x42')](_0x6755('0x88'));_0x76509f['field'](_0x6755('0x89'),'TagIds');}if(_0x350023[_0x6755('0x1f')])_0x76509f[_0x6755('0x1f')](_0x350023[_0x6755('0x1f')]);if(_0x350023[_0x6755('0x1e')])_0x76509f[_0x6755('0x1e')](_0x350023[_0x6755('0x1e')]);return db[_0x6755('0x7c')]['query'](_0x76509f['toString'](),_0x453bdd);})[_0x6755('0x26')](function(_0x281bfc){_0x281bfc['forEach'](function(_0x350f5c){if(_0x350f5c[_0x6755('0x8a')]){_0x350f5c[_0x6755('0x8b')]=[];_0x350f5c[_0x6755('0x8a')]['split'](',')[_0x6755('0x55')](function(_0x3b37bc){_0x350f5c[_0x6755('0x8b')][_0x6755('0x30')](_0x5e06ab[_0x3b37bc]);});}delete _0x350f5c[_0x6755('0x8a')];});_0x4c7aa6[_0x6755('0x8c')]=_0x281bfc;return _0x4c7aa6;})['then'](respondWithFilteredResult(_0x334939,_0x350023));});})[_0x6755('0x8d')](handleError(_0x334939,null));};exports[_0x6755('0x25')]=function(_0x3a536b,_0x29f9c3){return db[_0x6755('0x81')][_0x6755('0x51')]({'where':{'id':_0x3a536b['params']['id']}})['then'](handleEntityNotFound(_0x29f9c3,null))[_0x6755('0x26')](removeEntity(_0x29f9c3,null))['catch'](handleError(_0x29f9c3,null));};exports[_0x6755('0x8e')]=function(_0xe3cd65,_0x465259){return db[_0x6755('0x81')][_0x6755('0x8e')]()[_0x6755('0x26')](function(_0x33e40b){delete _0x33e40b[_0x6755('0x8f')];for(var _0x460544=0x0;_0x460544{}\s\\|]/g,'-');_0x2ab57c(null,util['format'](_0x5dbf('0x1c'),path[_0x5dbf('0x1d')](_0x358d46[_0x5dbf('0x1a')],path[_0x5dbf('0x1e')](_0x358d46[_0x5dbf('0x1a')])),Date[_0x5dbf('0x1f')](),path['extname'](_0x358d46[_0x5dbf('0x1a')])));}})});router[_0x5dbf('0x13')](_0x5dbf('0x20'),upload[_0x5dbf('0x21')](_0x5dbf('0x22')),controller[_0x5dbf('0x23')]);var upload=multer({'storage':multer[_0x5dbf('0x18')]({'destination':function(_0x20ab1b,_0x42f13b,_0x15a790){_0x15a790(null,path[_0x5dbf('0x24')](config[_0x5dbf('0x25')],_0x5dbf('0x19')));},'filename':function(_0x407741,_0x729d8f,_0x17f135){_0x729d8f[_0x5dbf('0x1a')]=_0x729d8f[_0x5dbf('0x1a')][_0x5dbf('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17f135(null,util[_0x5dbf('0x26')](_0x5dbf('0x1c'),path[_0x5dbf('0x1d')](_0x729d8f[_0x5dbf('0x1a')],path['extname'](_0x729d8f[_0x5dbf('0x1a')])),Date[_0x5dbf('0x1f')](),path[_0x5dbf('0x1e')](_0x729d8f[_0x5dbf('0x1a')])));}})});router[_0x5dbf('0x13')](_0x5dbf('0x27'),upload[_0x5dbf('0x21')](_0x5dbf('0x22')),controller[_0x5dbf('0x28')]);router[_0x5dbf('0x13')](_0x5dbf('0x29'),auth['isAuthenticated'](),controller['import']);router[_0x5dbf('0x2a')](_0x5dbf('0xc'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x2b')]);router[_0x5dbf('0x2c')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0x2d')]);module[_0x5dbf('0x2e')]=router; \ No newline at end of file +var _0x55ca=['originalname','replace','format','basename','extname','now','file','server/files/tmp','%s-%s%s','single','upload','/upload/:id','put','/:id','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','diskStorage','join','root'];(function(_0x180cd0,_0x386c6e){var _0x49fc32=function(_0x551c2c){while(--_0x551c2c){_0x180cd0['push'](_0x180cd0['shift']());}};_0x49fc32(++_0x386c6e);}(_0x55ca,0x126));var _0xa55c=function(_0x51df00,_0x4ac573){_0x51df00=_0x51df00-0x0;var _0x198328=_0x55ca[_0x51df00];return _0x198328;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/tags',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0x6')](_0xa55c('0xd'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0x6')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router['get']('/:id/hopper_finals',auth[_0xa55c('0x7')](),controller['getHopperFinals']);router['get']('/:id/jscripty_sessions',auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x14')]);router['post']('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x12')](_0xa55c('0x16'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x17')]);router[_0xa55c('0x12')](_0xa55c('0x18'),auth[_0xa55c('0x7')](),controller['setTags']);var upload=multer({'storage':multer[_0xa55c('0x19')]({'destination':function(_0x104a99,_0x461284,_0x358b61){_0x358b61(null,path[_0xa55c('0x1a')](config[_0xa55c('0x1b')],'server/files/tmp'));},'filename':function(_0x5f5158,_0xd643cc,_0x3776ac){_0xd643cc[_0xa55c('0x1c')]=_0xd643cc['originalname'][_0xa55c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3776ac(null,util[_0xa55c('0x1e')]('%s-%s%s',path[_0xa55c('0x1f')](_0xd643cc[_0xa55c('0x1c')],path[_0xa55c('0x20')](_0xd643cc[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path['extname'](_0xd643cc[_0xa55c('0x1c')])));}})});router['post']('/csv',upload['single'](_0xa55c('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xa55c('0x19')]({'destination':function(_0x190757,_0x3f64de,_0xf0e574){_0xf0e574(null,path[_0xa55c('0x1a')](config[_0xa55c('0x1b')],_0xa55c('0x23')));},'filename':function(_0x11e7f7,_0x192df2,_0x3cd152){_0x192df2[_0xa55c('0x1c')]=_0x192df2['originalname'][_0xa55c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cd152(null,util[_0xa55c('0x1e')](_0xa55c('0x24'),path[_0xa55c('0x1f')](_0x192df2['originalname'],path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])));}})});router[_0xa55c('0x12')]('/upload',upload[_0xa55c('0x25')]('file'),controller[_0xa55c('0x26')]);router[_0xa55c('0x12')](_0xa55c('0x27'),auth[_0xa55c('0x7')](),controller['import']);router[_0xa55c('0x28')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2a')]);router[_0xa55c('0x2b')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2c')]);module[_0xa55c('0x2d')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 197e836..6d7d32f 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 _0xa7bb=['type','values','stringify','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','long'];(function(_0x597d22,_0x278ad4){var _0x3277cc=function(_0x553bb4){while(--_0x553bb4){_0x597d22['push'](_0x597d22['shift']());}};_0x3277cc(++_0x278ad4);}(_0xa7bb,0x1e0));var _0xba7b=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa7bb[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0xba7b('0x0'));var _=require('lodash');module[_0xba7b('0x1')]={'name':{'type':Sequelize[_0xba7b('0x2')],'get':function(_0x361ee8){return this[_0xba7b('0x3')]('alias');}},'alias':{'type':Sequelize[_0xba7b('0x4')],'allowNull':![],'set':function(_0x1e8751){this[_0xba7b('0x5')](_0xba7b('0x6'),_0x1e8751?_0x1e8751:this[_0xba7b('0x3')](_0xba7b('0x7')));}},'type':{'type':Sequelize[_0xba7b('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xba7b('0x8')](_0xba7b('0x9')),'get':function(){if(this[_0xba7b('0x3')](_0xba7b('0xa'))==='select'){return JSON['parse'](this[_0xba7b('0x3')]('values'));}else{return this[_0xba7b('0x3')](_0xba7b('0xb'));}},'set':function(_0x21fd5d){if(Array['isArray'](_0x21fd5d)){this['setDataValue'](_0xba7b('0xb'),JSON[_0xba7b('0xc')](_0x21fd5d));}else{this[_0xba7b('0x5')]('values',_0x21fd5d);}}},'required':{'type':Sequelize[_0xba7b('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xc311=['STRING','TEXT','getDataValue','type','select','parse','values','stringify','BOOLEAN','lodash','exports','VIRTUAL','setDataValue'];(function(_0x2a6982,_0x24f27c){var _0x81af8a=function(_0x3f88b0){while(--_0x3f88b0){_0x2a6982['push'](_0x2a6982['shift']());}};_0x81af8a(++_0x24f27c);}(_0xc311,0x175));var _0x1c31=function(_0xdc4a97,_0x2b2ff5){_0xdc4a97=_0xdc4a97-0x0;var _0xaafd2f=_0xc311[_0xdc4a97];return _0xaafd2f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1c31('0x0'));module[_0x1c31('0x1')]={'name':{'type':Sequelize[_0x1c31('0x2')],'get':function(_0x3961a0){return this['getDataValue']('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5345eb){this[_0x1c31('0x3')]('alias',_0x5345eb?_0x5345eb:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x1c31('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x1c31('0x5')]('long'),'get':function(){if(this[_0x1c31('0x6')](_0x1c31('0x7'))===_0x1c31('0x8')){return JSON[_0x1c31('0x9')](this[_0x1c31('0x6')]('values'));}else{return this[_0x1c31('0x6')](_0x1c31('0xa'));}},'set':function(_0x49cae7){if(Array['isArray'](_0x49cae7)){this[_0x1c31('0x3')]('values',JSON[_0x1c31('0xb')](_0x49cae7));}else{this[_0x1c31('0x3')](_0x1c31('0xa'),_0x49cae7);}}},'required':{'type':Sequelize[_0x1c31('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6da683b..38f67b9 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 _0xc5f1=['addColumn','format','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','CmCustomField','includeAll','include','findAll','catch','show','params','options','find','body','create','sequelize','transaction','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface'];(function(_0x363e3b,_0x5c7a6e){var _0x3962a5=function(_0x5719cb){while(--_0x5719cb){_0x363e3b['push'](_0x363e3b['shift']());}};_0x3962a5(++_0x5c7a6e);}(_0xc5f1,0xb1));var _0x1c5f=function(_0x470553,_0x1e90e9){_0x470553=_0x470553-0x0;var _0x4683b7=_0xc5f1[_0x470553];return _0x4683b7;};'use strict';var pdf=require(_0x1c5f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1c5f('0x1'));var zipdir=require(_0x1c5f('0x2'));var jsonpatch=require(_0x1c5f('0x3'));var rp=require(_0x1c5f('0x4'));var moment=require(_0x1c5f('0x5'));var BPromise=require(_0x1c5f('0x6'));var Mustache=require(_0x1c5f('0x7'));var util=require(_0x1c5f('0x8'));var path=require(_0x1c5f('0x9'));var sox=require(_0x1c5f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c5f('0xb'));var squel=require('squel');var crypto=require(_0x1c5f('0xc'));var jsforce=require(_0x1c5f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1c5f('0xe'));var querystring=require(_0x1c5f('0xf'));var Papa=require(_0x1c5f('0x10'));var Redis=require(_0x1c5f('0x11'));var authService=require(_0x1c5f('0x12'));var qs=require(_0x1c5f('0x13'));var as=require(_0x1c5f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c5f('0x15'))(_0x1c5f('0x16'));var utils=require(_0x1c5f('0x17'));var config=require(_0x1c5f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53b184,_0x51e4fc){_0x51e4fc=_0x51e4fc||0xcc;return function(_0x2a07b8){if(_0x2a07b8){return _0x53b184[_0x1c5f('0x19')](_0x51e4fc);}return _0x53b184['status'](_0x51e4fc)[_0x1c5f('0x1a')]();};}function respondWithResult(_0x532acc,_0x40ab80){_0x40ab80=_0x40ab80||0xc8;return function(_0x2b2d06){if(_0x2b2d06){return _0x532acc['status'](_0x40ab80)[_0x1c5f('0x1b')](_0x2b2d06);}};}function respondWithFilteredResult(_0x28f183,_0x463bc2){return function(_0x21ee4a){if(_0x21ee4a){var _0x23ad6a=_0x21ee4a[_0x1c5f('0x1c')],_0x4d2a35=_0x463bc2[_0x1c5f('0x1d')],_0xcb6b71=_0x463bc2[_0x1c5f('0x1d')]+_0x463bc2['limit'],_0x280de5;if(_0xcb6b71>=_0x23ad6a){_0xcb6b71=_0x23ad6a;_0x280de5=0xc8;}else{_0x280de5=0xce;}_0x28f183[_0x1c5f('0x1e')](_0x280de5);return _0x28f183['set'](_0x1c5f('0x1f'),_0x4d2a35+'-'+_0xcb6b71+'/'+_0x23ad6a)[_0x1c5f('0x1b')](_0x21ee4a);}return null;};}function patchUpdates(_0x37e19e){return function(_0x2cb369){try{jsonpatch[_0x1c5f('0x20')](_0x2cb369,_0x37e19e,!![]);}catch(_0x542cdc){return BPromise[_0x1c5f('0x21')](_0x542cdc);}return _0x2cb369[_0x1c5f('0x22')]();};}function saveUpdates(_0x1d02a0,_0xce451f){return function(_0x109b0c){if(_0x109b0c){return _0x109b0c[_0x1c5f('0x23')](_0x1d02a0)[_0x1c5f('0x24')](function(_0x2a6dea){return _0x2a6dea;});}return null;};}function removeEntity(_0x2c2ae9,_0x5a2aba){return function(_0x27f4e8){if(_0x27f4e8){return _0x27f4e8[_0x1c5f('0x25')]()[_0x1c5f('0x24')](function(){_0x2c2ae9[_0x1c5f('0x1e')](0xcc)[_0x1c5f('0x1a')]();});}};}function handleEntityNotFound(_0x236cdc,_0x31fa5f){return function(_0x18d619){if(!_0x18d619){_0x236cdc[_0x1c5f('0x19')](0x194);}return _0x18d619;};}function handleError(_0x2d74d4,_0x254d0e){_0x254d0e=_0x254d0e||0x1f4;return function(_0x3bd7b7){logger['error'](_0x3bd7b7[_0x1c5f('0x26')]);if(_0x3bd7b7[_0x1c5f('0x27')]){delete _0x3bd7b7['name'];}_0x2d74d4[_0x1c5f('0x1e')](_0x254d0e)[_0x1c5f('0x28')](_0x3bd7b7);};}exports[_0x1c5f('0x29')]=function(_0x416d7c,_0x54b318){var _0x10abb1={},_0x491542={},_0x384594={'count':0x0,'rows':[]};var _0x4db7d3=_[_0x1c5f('0x2a')](db['CmCustomField'][_0x1c5f('0x2b')],function(_0x18ee12){return{'name':_0x18ee12[_0x1c5f('0x2c')],'type':_0x18ee12[_0x1c5f('0x2d')][_0x1c5f('0x2e')]};});_0x491542[_0x1c5f('0x2f')]=_['differenceBy'](_[_0x1c5f('0x2a')](_0x4db7d3,_0x1c5f('0x27')),[_0x1c5f('0x27')]);_0x491542[_0x1c5f('0x30')]=_[_0x1c5f('0x31')](_0x416d7c['query']);_0x491542[_0x1c5f('0x32')]=_['intersection'](_0x491542[_0x1c5f('0x2f')],_0x491542[_0x1c5f('0x30')]);_0x10abb1[_0x1c5f('0x33')]=_[_0x1c5f('0x34')](_0x491542[_0x1c5f('0x2f')],qs[_0x1c5f('0x35')](_0x416d7c[_0x1c5f('0x30')][_0x1c5f('0x35')]));_0x10abb1['attributes']=_0x10abb1[_0x1c5f('0x33')][_0x1c5f('0x36')]?_0x10abb1[_0x1c5f('0x33')]:_0x491542['model'];if(!_0x416d7c[_0x1c5f('0x30')][_0x1c5f('0x37')](_0x1c5f('0x38'))){_0x10abb1[_0x1c5f('0x39')]=qs[_0x1c5f('0x39')](_0x416d7c[_0x1c5f('0x30')][_0x1c5f('0x39')]);_0x10abb1[_0x1c5f('0x1d')]=qs[_0x1c5f('0x1d')](_0x416d7c['query'][_0x1c5f('0x1d')]);}_0x10abb1[_0x1c5f('0x3a')]=qs[_0x1c5f('0x3b')](_0x416d7c[_0x1c5f('0x30')][_0x1c5f('0x3b')]);_0x10abb1[_0x1c5f('0x3c')]=qs[_0x1c5f('0x32')](_[_0x1c5f('0x3d')](_0x416d7c[_0x1c5f('0x30')],_0x491542[_0x1c5f('0x32')]),_0x4db7d3);if(_0x416d7c[_0x1c5f('0x30')][_0x1c5f('0x3e')]){_0x10abb1[_0x1c5f('0x3c')]=_[_0x1c5f('0x3f')](_0x10abb1[_0x1c5f('0x3c')],{'$or':_['map'](_0x4db7d3,function(_0x1fde1c){if(_0x1fde1c['type']!=='VIRTUAL'){var _0x1ce4a3={};_0x1ce4a3[_0x1fde1c[_0x1c5f('0x27')]]={'$like':'%'+_0x416d7c['query']['filter']+'%'};return _0x1ce4a3;}})});}_0x10abb1=_['merge']({},_0x10abb1,_0x416d7c['options']);var _0x37b2e9={'where':_0x10abb1[_0x1c5f('0x3c')]};return db[_0x1c5f('0x40')]['count'](_0x37b2e9)[_0x1c5f('0x24')](function(_0x22b8d8){_0x384594[_0x1c5f('0x1c')]=_0x22b8d8;if(_0x416d7c[_0x1c5f('0x30')][_0x1c5f('0x41')]){_0x10abb1[_0x1c5f('0x42')]=[{'all':!![]}];}return db[_0x1c5f('0x40')][_0x1c5f('0x43')](_0x10abb1);})['then'](function(_0xb72079){_0x384594['rows']=_0xb72079;return _0x384594;})['then'](respondWithFilteredResult(_0x54b318,_0x10abb1))[_0x1c5f('0x44')](handleError(_0x54b318,null));};exports[_0x1c5f('0x45')]=function(_0xe617c7,_0x14f725){var _0x4788a9={'raw':!![],'where':{'id':_0xe617c7[_0x1c5f('0x46')]['id']}},_0x3897f3={};_0x3897f3[_0x1c5f('0x2f')]=_[_0x1c5f('0x31')](db[_0x1c5f('0x40')][_0x1c5f('0x2b')]);_0x3897f3[_0x1c5f('0x30')]=_[_0x1c5f('0x31')](_0xe617c7['query']);_0x3897f3[_0x1c5f('0x32')]=_['intersection'](_0x3897f3[_0x1c5f('0x2f')],_0x3897f3[_0x1c5f('0x30')]);_0x4788a9[_0x1c5f('0x33')]=_[_0x1c5f('0x34')](_0x3897f3[_0x1c5f('0x2f')],qs[_0x1c5f('0x35')](_0xe617c7['query'][_0x1c5f('0x35')]));_0x4788a9[_0x1c5f('0x33')]=_0x4788a9[_0x1c5f('0x33')][_0x1c5f('0x36')]?_0x4788a9[_0x1c5f('0x33')]:_0x3897f3[_0x1c5f('0x2f')];if(_0xe617c7[_0x1c5f('0x30')][_0x1c5f('0x41')]){_0x4788a9[_0x1c5f('0x42')]=[{'all':!![]}];}_0x4788a9=_['merge']({},_0x4788a9,_0xe617c7[_0x1c5f('0x47')]);return db[_0x1c5f('0x40')][_0x1c5f('0x48')](_0x4788a9)['then'](handleEntityNotFound(_0x14f725,null))[_0x1c5f('0x24')](respondWithResult(_0x14f725,null))[_0x1c5f('0x44')](handleError(_0x14f725,null));};exports[_0x1c5f('0x23')]=function(_0x1ea91d,_0x476ae2){if(_0x1ea91d[_0x1c5f('0x49')]['id']){delete _0x1ea91d[_0x1c5f('0x49')]['id'];}return db[_0x1c5f('0x40')]['find']({'where':{'id':_0x1ea91d[_0x1c5f('0x46')]['id']}})[_0x1c5f('0x24')](handleEntityNotFound(_0x476ae2,null))[_0x1c5f('0x24')](saveUpdates(_0x1ea91d[_0x1c5f('0x49')],null))['then'](respondWithResult(_0x476ae2,null))[_0x1c5f('0x44')](handleError(_0x476ae2,null));};exports[_0x1c5f('0x25')]=function(_0x4538f4,_0x3e18e8){return db['CmCustomField'][_0x1c5f('0x48')]({'where':{'id':_0x4538f4[_0x1c5f('0x46')]['id']}})[_0x1c5f('0x24')](handleEntityNotFound(_0x3e18e8,null))[_0x1c5f('0x24')](removeEntity(_0x3e18e8,null))[_0x1c5f('0x44')](handleError(_0x3e18e8,null));};exports[_0x1c5f('0x4a')]=function(_0x55d497,_0x9ab333){var _0x1b6983;return db[_0x1c5f('0x4b')][_0x1c5f('0x4c')](function(_0x257b25){return db[_0x1c5f('0x40')][_0x1c5f('0x4a')](_0x55d497[_0x1c5f('0x49')],{'transaction':_0x257b25})[_0x1c5f('0x24')](function(_0x5e8d6f){_0x1b6983=_0x5e8d6f;var _0x119d73={'type':db['Sequelize']['TEXT'],'transaction':_0x257b25};switch(_0x55d497[_0x1c5f('0x49')][_0x1c5f('0x2d')]){case'text':_0x119d73[_0x1c5f('0x2d')]=db[_0x1c5f('0x4d')][_0x1c5f('0x4e')];break;case'number':_0x119d73[_0x1c5f('0x2d')]=db[_0x1c5f('0x4d')][_0x1c5f('0x4f')];break;case _0x1c5f('0x50'):_0x119d73[_0x1c5f('0x2d')]=db[_0x1c5f('0x4d')][_0x1c5f('0x51')];_0x119d73[_0x1c5f('0x52')]=![];break;default:}return db[_0x1c5f('0x4b')][_0x1c5f('0x53')][_0x1c5f('0x54')]('cm_contacts',util[_0x1c5f('0x55')](_0x1c5f('0x56'),_0x1b6983['id']),_0x119d73);})[_0x1c5f('0x24')](function(){return _0x1b6983;});})[_0x1c5f('0x24')](respondWithResult(_0x9ab333,0xc9))[_0x1c5f('0x44')](handleError(_0x9ab333,null));}; \ No newline at end of file +var _0x1ea6=['defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','apply','reject','then','destroy','end','error','stack','name','send','index','map','rawAttributes','differenceBy','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','CmCustomField','includeAll','catch','show','params','include','find','update','body','create','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN'];(function(_0x2e7522,_0x5b1548){var _0x200019=function(_0x4aebdd){while(--_0x4aebdd){_0x2e7522['push'](_0x2e7522['shift']());}};_0x200019(++_0x5b1548);}(_0x1ea6,0xaa));var _0x61ea=function(_0x31a60b,_0x85ed80){_0x31a60b=_0x31a60b-0x0;var _0x5bae05=_0x1ea6[_0x31a60b];return _0x5bae05;};'use strict';var pdf=require(_0x61ea('0x0'));var emlformat=require(_0x61ea('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x61ea('0x2'));var jsonpatch=require(_0x61ea('0x3'));var rp=require(_0x61ea('0x4'));var moment=require(_0x61ea('0x5'));var BPromise=require(_0x61ea('0x6'));var Mustache=require(_0x61ea('0x7'));var util=require('util');var path=require('path');var sox=require(_0x61ea('0x8'));var csv=require(_0x61ea('0x9'));var ejs=require(_0x61ea('0xa'));var fs=require('fs');var _=require(_0x61ea('0xb'));var squel=require(_0x61ea('0xc'));var crypto=require(_0x61ea('0xd'));var jsforce=require(_0x61ea('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x61ea('0xf'));var qs=require(_0x61ea('0x10'));var as=require(_0x61ea('0x11'));var hardwareService=require(_0x61ea('0x12'));var logger=require(_0x61ea('0x13'))(_0x61ea('0x14'));var utils=require(_0x61ea('0x15'));var config=require(_0x61ea('0x16'));var db=require(_0x61ea('0x17'))['db'];function respondWithStatusCode(_0x1ea67c,_0x460c47){_0x460c47=_0x460c47||0xcc;return function(_0x4512e9){if(_0x4512e9){return _0x1ea67c[_0x61ea('0x18')](_0x460c47);}return _0x1ea67c[_0x61ea('0x19')](_0x460c47)['end']();};}function respondWithResult(_0x3d17bd,_0x588572){_0x588572=_0x588572||0xc8;return function(_0x305cb6){if(_0x305cb6){return _0x3d17bd[_0x61ea('0x19')](_0x588572)['json'](_0x305cb6);}};}function respondWithFilteredResult(_0x5508e5,_0x3c17ac){return function(_0x1c85e2){if(_0x1c85e2){var _0x55666f=_0x1c85e2[_0x61ea('0x1a')],_0x3076b3=_0x3c17ac[_0x61ea('0x1b')],_0x32f2eb=_0x3c17ac[_0x61ea('0x1b')]+_0x3c17ac[_0x61ea('0x1c')],_0x41ce04;if(_0x32f2eb>=_0x55666f){_0x32f2eb=_0x55666f;_0x41ce04=0xc8;}else{_0x41ce04=0xce;}_0x5508e5[_0x61ea('0x19')](_0x41ce04);return _0x5508e5['set']('Content-Range',_0x3076b3+'-'+_0x32f2eb+'/'+_0x55666f)['json'](_0x1c85e2);}return null;};}function patchUpdates(_0x1aeafd){return function(_0x282a4a){try{jsonpatch[_0x61ea('0x1d')](_0x282a4a,_0x1aeafd,!![]);}catch(_0x2ed2d8){return BPromise[_0x61ea('0x1e')](_0x2ed2d8);}return _0x282a4a['save']();};}function saveUpdates(_0x4bba66,_0x5773c4){return function(_0x5b8f97){if(_0x5b8f97){return _0x5b8f97['update'](_0x4bba66)[_0x61ea('0x1f')](function(_0x548768){return _0x548768;});}return null;};}function removeEntity(_0x1a3c61,_0x13ef25){return function(_0x3f2287){if(_0x3f2287){return _0x3f2287[_0x61ea('0x20')]()[_0x61ea('0x1f')](function(){_0x1a3c61[_0x61ea('0x19')](0xcc)[_0x61ea('0x21')]();});}};}function handleEntityNotFound(_0x352874,_0x28d618){return function(_0x57d80c){if(!_0x57d80c){_0x352874[_0x61ea('0x18')](0x194);}return _0x57d80c;};}function handleError(_0x587a60,_0x437ae4){_0x437ae4=_0x437ae4||0x1f4;return function(_0x55eece){logger[_0x61ea('0x22')](_0x55eece[_0x61ea('0x23')]);if(_0x55eece['name']){delete _0x55eece[_0x61ea('0x24')];}_0x587a60[_0x61ea('0x19')](_0x437ae4)[_0x61ea('0x25')](_0x55eece);};}exports[_0x61ea('0x26')]=function(_0x486f9b,_0x4bd419){var _0x13ada6={},_0x289407={},_0x1b33b0={'count':0x0,'rows':[]};var _0x2ade4e=_[_0x61ea('0x27')](db['CmCustomField'][_0x61ea('0x28')],function(_0x4b65a9){return{'name':_0x4b65a9['fieldName'],'type':_0x4b65a9['type']['key']};});_0x289407['model']=_[_0x61ea('0x29')](_['map'](_0x2ade4e,'name'),[_0x61ea('0x24')]);_0x289407[_0x61ea('0x2a')]=_[_0x61ea('0x2b')](_0x486f9b[_0x61ea('0x2a')]);_0x289407[_0x61ea('0x2c')]=_[_0x61ea('0x2d')](_0x289407['model'],_0x289407['query']);_0x13ada6[_0x61ea('0x2e')]=_[_0x61ea('0x2d')](_0x289407[_0x61ea('0x2f')],qs[_0x61ea('0x30')](_0x486f9b['query'][_0x61ea('0x30')]));_0x13ada6[_0x61ea('0x2e')]=_0x13ada6[_0x61ea('0x2e')][_0x61ea('0x31')]?_0x13ada6[_0x61ea('0x2e')]:_0x289407[_0x61ea('0x2f')];if(!_0x486f9b[_0x61ea('0x2a')]['hasOwnProperty'](_0x61ea('0x32'))){_0x13ada6['limit']=qs[_0x61ea('0x1c')](_0x486f9b['query'][_0x61ea('0x1c')]);_0x13ada6['offset']=qs[_0x61ea('0x1b')](_0x486f9b[_0x61ea('0x2a')][_0x61ea('0x1b')]);}_0x13ada6['order']=qs[_0x61ea('0x33')](_0x486f9b[_0x61ea('0x2a')][_0x61ea('0x33')]);_0x13ada6['where']=qs[_0x61ea('0x2c')](_[_0x61ea('0x34')](_0x486f9b['query'],_0x289407['filters']),_0x2ade4e);if(_0x486f9b['query'][_0x61ea('0x35')]){_0x13ada6[_0x61ea('0x36')]=_[_0x61ea('0x37')](_0x13ada6[_0x61ea('0x36')],{'$or':_['map'](_0x2ade4e,function(_0x37f165){if(_0x37f165[_0x61ea('0x38')]!==_0x61ea('0x39')){var _0x24650c={};_0x24650c[_0x37f165[_0x61ea('0x24')]]={'$like':'%'+_0x486f9b[_0x61ea('0x2a')][_0x61ea('0x35')]+'%'};return _0x24650c;}})});}_0x13ada6=_['merge']({},_0x13ada6,_0x486f9b[_0x61ea('0x3a')]);var _0x4edb2c={'where':_0x13ada6[_0x61ea('0x36')]};return db[_0x61ea('0x3b')]['count'](_0x4edb2c)[_0x61ea('0x1f')](function(_0x19425e){_0x1b33b0['count']=_0x19425e;if(_0x486f9b[_0x61ea('0x2a')][_0x61ea('0x3c')]){_0x13ada6['include']=[{'all':!![]}];}return db[_0x61ea('0x3b')]['findAll'](_0x13ada6);})[_0x61ea('0x1f')](function(_0x15e88e){_0x1b33b0['rows']=_0x15e88e;return _0x1b33b0;})[_0x61ea('0x1f')](respondWithFilteredResult(_0x4bd419,_0x13ada6))[_0x61ea('0x3d')](handleError(_0x4bd419,null));};exports[_0x61ea('0x3e')]=function(_0x403c81,_0x3f616b){var _0x4dff80={'raw':!![],'where':{'id':_0x403c81[_0x61ea('0x3f')]['id']}},_0x4513f6={};_0x4513f6[_0x61ea('0x2f')]=_['keys'](db[_0x61ea('0x3b')][_0x61ea('0x28')]);_0x4513f6['query']=_[_0x61ea('0x2b')](_0x403c81[_0x61ea('0x2a')]);_0x4513f6[_0x61ea('0x2c')]=_[_0x61ea('0x2d')](_0x4513f6[_0x61ea('0x2f')],_0x4513f6[_0x61ea('0x2a')]);_0x4dff80['attributes']=_['intersection'](_0x4513f6[_0x61ea('0x2f')],qs[_0x61ea('0x30')](_0x403c81[_0x61ea('0x2a')]['fields']));_0x4dff80[_0x61ea('0x2e')]=_0x4dff80[_0x61ea('0x2e')][_0x61ea('0x31')]?_0x4dff80[_0x61ea('0x2e')]:_0x4513f6[_0x61ea('0x2f')];if(_0x403c81['query'][_0x61ea('0x3c')]){_0x4dff80[_0x61ea('0x40')]=[{'all':!![]}];}_0x4dff80=_[_0x61ea('0x37')]({},_0x4dff80,_0x403c81[_0x61ea('0x3a')]);return db['CmCustomField'][_0x61ea('0x41')](_0x4dff80)[_0x61ea('0x1f')](handleEntityNotFound(_0x3f616b,null))['then'](respondWithResult(_0x3f616b,null))['catch'](handleError(_0x3f616b,null));};exports[_0x61ea('0x42')]=function(_0x49d5f9,_0x120545){if(_0x49d5f9['body']['id']){delete _0x49d5f9[_0x61ea('0x43')]['id'];}return db['CmCustomField'][_0x61ea('0x41')]({'where':{'id':_0x49d5f9[_0x61ea('0x3f')]['id']}})['then'](handleEntityNotFound(_0x120545,null))[_0x61ea('0x1f')](saveUpdates(_0x49d5f9[_0x61ea('0x43')],null))[_0x61ea('0x1f')](respondWithResult(_0x120545,null))[_0x61ea('0x3d')](handleError(_0x120545,null));};exports[_0x61ea('0x20')]=function(_0x3620b7,_0xc982d7){return db[_0x61ea('0x3b')][_0x61ea('0x41')]({'where':{'id':_0x3620b7[_0x61ea('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc982d7,null))[_0x61ea('0x1f')](removeEntity(_0xc982d7,null))[_0x61ea('0x3d')](handleError(_0xc982d7,null));};exports[_0x61ea('0x44')]=function(_0x8fafdc,_0x3b5472){var _0x9612a4;return db['sequelize'][_0x61ea('0x45')](function(_0x54f51d){return db[_0x61ea('0x3b')]['create'](_0x8fafdc[_0x61ea('0x43')],{'transaction':_0x54f51d})[_0x61ea('0x1f')](function(_0x40b7bb){_0x9612a4=_0x40b7bb;var _0x123360={'type':db[_0x61ea('0x46')][_0x61ea('0x47')],'transaction':_0x54f51d};switch(_0x8fafdc[_0x61ea('0x43')]['type']){case _0x61ea('0x48'):_0x123360[_0x61ea('0x38')]=db[_0x61ea('0x46')][_0x61ea('0x47')];break;case _0x61ea('0x49'):_0x123360[_0x61ea('0x38')]=db[_0x61ea('0x46')]['INTEGER'];break;case _0x61ea('0x4a'):_0x123360['type']=db[_0x61ea('0x46')][_0x61ea('0x4b')];_0x123360[_0x61ea('0x4c')]=![];break;default:}return db[_0x61ea('0x4d')][_0x61ea('0x4e')][_0x61ea('0x4f')]('cm_contacts',util[_0x61ea('0x50')](_0x61ea('0x51'),_0x9612a4['id']),_0x123360);})['then'](function(){return _0x9612a4;});})[_0x61ea('0x1f')](respondWithResult(_0x3b5472,0xc9))[_0x61ea('0x3d')](handleError(_0x3b5472,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d01b0a0..41f0549 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 _0xee53=['util','../../config/logger','moment','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x38c91b,_0x11f35a){var _0x5ac913=function(_0x5cb0e4){while(--_0x5cb0e4){_0x38c91b['push'](_0x38c91b['shift']());}};_0x5ac913(++_0x11f35a);}(_0xee53,0x1ea));var _0x3ee5=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0xee53[_0xd2f4ac];return _0x9757b2;};'use strict';var _=require('lodash');var util=require(_0x3ee5('0x0'));var logger=require(_0x3ee5('0x1'))('api');var moment=require(_0x3ee5('0x2'));var BPromise=require('bluebird');var rp=require(_0x3ee5('0x3'));var fs=require('fs');var path=require(_0x3ee5('0x4'));var rimraf=require('rimraf');var config=require(_0x3ee5('0x5'));var attributes=require(_0x3ee5('0x6'));module[_0x3ee5('0x7')]=function(_0x1f4b5d,_0x4ca023){return _0x1f4b5d[_0x3ee5('0x8')](_0x3ee5('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fa6=['api','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','define','CmCustomField','lodash','util','../../config/logger'];(function(_0x315ffa,_0xa45396){var _0x2b617b=function(_0x4de045){while(--_0x4de045){_0x315ffa['push'](_0x315ffa['shift']());}};_0x2b617b(++_0xa45396);}(_0x7fa6,0xed));var _0x67fa=function(_0x2a8d96,_0x4770ff){_0x2a8d96=_0x2a8d96-0x0;var _0x5a9cc5=_0x7fa6[_0x2a8d96];return _0x5a9cc5;};'use strict';var _=require(_0x67fa('0x0'));var util=require(_0x67fa('0x1'));var logger=require(_0x67fa('0x2'))(_0x67fa('0x3'));var moment=require(_0x67fa('0x4'));var BPromise=require(_0x67fa('0x5'));var rp=require(_0x67fa('0x6'));var fs=require('fs');var path=require(_0x67fa('0x7'));var rimraf=require(_0x67fa('0x8'));var config=require('../../config/environment');var attributes=require(_0x67fa('0x9'));module['exports']=function(_0x105143,_0x415a19){return _0x105143[_0x67fa('0xa')](_0x67fa('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 7e237bb..e6be17a 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 _0xa37e=['CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x3300f0,_0x40b9cc){var _0x11cd8b=function(_0x5f446d){while(--_0x5f446d){_0x3300f0['push'](_0x3300f0['shift']());}};_0x11cd8b(++_0x40b9cc);}(_0xa37e,0x97));var _0xea37=function(_0x4b3fd5,_0x23ce89){_0x4b3fd5=_0x4b3fd5-0x0;var _0x58ab97=_0xa37e[_0x4b3fd5];return _0x58ab97;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea37('0x0'));var BPromise=require(_0xea37('0x1'));var rs=require(_0xea37('0x2'));var fs=require('fs');var Redis=require(_0xea37('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xea37('0x4'));var logger=require('../../config/logger')(_0xea37('0x5'));var config=require(_0xea37('0x6'));var jayson=require(_0xea37('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36c489,_0x4a9e08,_0x4ae081){return new BPromise(function(_0x2c2890,_0x1401e1){return client[_0xea37('0x8')](_0x36c489,_0x4ae081)[_0xea37('0x9')](function(_0x5e4ebe){logger[_0xea37('0xa')](_0xea37('0xb'),_0x4a9e08,_0xea37('0xc'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4a9e08,_0xea37('0xc'),JSON[_0xea37('0xd')](_0x5e4ebe));if(_0x5e4ebe[_0xea37('0xe')]){if(_0x5e4ebe['error'][_0xea37('0xf')]===0x1f4){logger[_0xea37('0xe')](_0xea37('0xb'),_0x4a9e08,_0x5e4ebe['error'][_0xea37('0x10')]);return _0x1401e1(_0x5e4ebe[_0xea37('0xe')]['message']);}logger[_0xea37('0xe')]('CmCustomField,\x20%s,\x20%s',_0x4a9e08,_0x5e4ebe[_0xea37('0xe')]['message']);return _0x2c2890(_0x5e4ebe[_0xea37('0xe')][_0xea37('0x10')]);}else{logger[_0xea37('0xa')](_0xea37('0xb'),_0x4a9e08,'request\x20sent');_0x2c2890(_0x5e4ebe[_0xea37('0x11')]['message']);}})['catch'](function(_0x3ae3cc){logger['error'](_0xea37('0xb'),_0x4a9e08,_0x3ae3cc);_0x1401e1(_0x3ae3cc);});});} \ No newline at end of file +var _0x6f0d=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0xab3b2b,_0x19c5ee){var _0x1b960b=function(_0x1bf265){while(--_0x1bf265){_0xab3b2b['push'](_0xab3b2b['shift']());}};_0x1b960b(++_0x19c5ee);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x23e832,_0x10adf2){_0x23e832=_0x23e832-0x0;var _0x329504=_0x6f0d[_0x23e832];return _0x329504;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('CmCustomField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 9518a9a..62c16bb 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 _0x556a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x565faf,_0x5f3718){var _0x42292f=function(_0x514b49){while(--_0x514b49){_0x565faf['push'](_0x565faf['shift']());}};_0x42292f(++_0x5f3718);}(_0x556a,0x1dd));var _0xa556=function(_0x1293da,_0x10a34c){_0x1293da=_0x1293da-0x0;var _0x17e307=_0x556a[_0x1293da];return _0x17e307;};'use strict';var multer=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var path=require(_0xa556('0x2'));var timeout=require(_0xa556('0x3'));var express=require(_0xa556('0x4'));var router=express[_0xa556('0x5')]();var auth=require(_0xa556('0x6'));var interaction=require(_0xa556('0x7'));var config=require(_0xa556('0x8'));var controller=require('./cmCustomField.controller');router[_0xa556('0x9')]('/',auth[_0xa556('0xa')](),controller[_0xa556('0xb')]);router[_0xa556('0x9')](_0xa556('0xc'),auth['isAuthenticated'](),controller[_0xa556('0xd')]);router[_0xa556('0xe')]('/',auth[_0xa556('0xa')](),controller[_0xa556('0xf')]);router['put'](_0xa556('0xc'),auth[_0xa556('0xa')](),controller[_0xa556('0x10')]);router[_0xa556('0x11')](_0xa556('0xc'),auth[_0xa556('0xa')](),controller[_0xa556('0x12')]);module[_0xa556('0x13')]=router; \ No newline at end of file +var _0x7889=['express','Router','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3ce0d5,_0x203024){var _0x2e5731=function(_0x4be620){while(--_0x4be620){_0x3ce0d5['push'](_0x3ce0d5['shift']());}};_0x2e5731(++_0x203024);}(_0x7889,0x1cc));var _0x9788=function(_0x2539dc,_0x3e52b9){_0x2539dc=_0x2539dc-0x0;var _0x325955=_0x7889[_0x2539dc];return _0x325955;};'use strict';var multer=require(_0x9788('0x0'));var util=require(_0x9788('0x1'));var path=require(_0x9788('0x2'));var timeout=require(_0x9788('0x3'));var express=require(_0x9788('0x4'));var router=express[_0x9788('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9788('0x6'));var config=require('../../config/environment');var controller=require(_0x9788('0x7'));router[_0x9788('0x8')]('/',auth[_0x9788('0x9')](),controller['index']);router[_0x9788('0x8')](_0x9788('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9788('0xb')]('/',auth[_0x9788('0x9')](),controller[_0x9788('0xc')]);router[_0x9788('0xd')](_0x9788('0xa'),auth[_0x9788('0x9')](),controller['update']);router['delete'](_0x9788('0xa'),auth[_0x9788('0x9')](),controller[_0x9788('0xe')]);module[_0x9788('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6859537..6978938 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 _0xbd50=['sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment'];(function(_0x24e939,_0x1d5c34){var _0x137081=function(_0x577edf){while(--_0x577edf){_0x24e939['push'](_0x24e939['shift']());}};_0x137081(++_0x1d5c34);}(_0xbd50,0x196));var _0x0bd5=function(_0x20ce75,_0x19fb07){_0x20ce75=_0x20ce75-0x0;var _0x480e1b=_0xbd50[_0x20ce75];return _0x480e1b;};'use strict';var moment=require(_0x0bd5('0x0'));var Sequelize=require(_0x0bd5('0x1'));module[_0x0bd5('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0bd5('0x4')],'defaultValue':moment()[_0x0bd5('0x5')](_0x0bd5('0x6'))},'countbusyretry':{'type':Sequelize[_0x0bd5('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0bd5('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0bd5('0x4')]},'priority':{'type':Sequelize[_0x0bd5('0x7')](0x2)[_0x0bd5('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0bd5('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x0bd5('0x7')],'unique':_0x0bd5('0xa')},'UserId':{'type':Sequelize[_0x0bd5('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x0bd5('0xa')},'CampaignId':{'type':Sequelize[_0x0bd5('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0bd5('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0bd5('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0bd5('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x950a=['INTEGER','BOOLEAN','contactListQueue','moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x950a,0x111));var _0xa950=function(_0x55f96c,_0x111f6c){_0x55f96c=_0x55f96c-0x0;var _0x4c0c7f=_0x950a[_0x55f96c];return _0x4c0c7f;};'use strict';var moment=require(_0xa950('0x0'));var Sequelize=require(_0xa950('0x1'));module[_0xa950('0x2')]={'phone':{'type':Sequelize[_0xa950('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa950('0x4')],'defaultValue':moment()[_0xa950('0x5')](_0xa950('0x6'))},'countbusyretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa950('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa950('0x4')]},'priority':{'type':Sequelize[_0xa950('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa950('0x7')],'unique':_0xa950('0x9')},'ListId':{'type':Sequelize[_0xa950('0x7')],'unique':_0xa950('0x9')},'UserId':{'type':Sequelize[_0xa950('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xa950('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa950('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa950('0x7')],'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 c3e72ad..a921c53 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 _0x9120=['calleridname','finally','CmHopperFinal','outbound','preview','dialOrderByScheduledAt','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','sequelize','DESC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','apply','reject','then','error','name','send','index','map','CmHopper','type','model','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','create','body','update','describe','destroy','find','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','updatedAt','state','statedesc','campaign','user','deleted','format','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil'];(function(_0x212154,_0x2ff2b1){var _0xcd5737=function(_0x180d5f){while(--_0x180d5f){_0x212154['push'](_0x212154['shift']());}};_0xcd5737(++_0x2ff2b1);}(_0x9120,0x1bd));var _0x0912=function(_0x374a0f,_0x14a725){_0x374a0f=_0x374a0f-0x0;var _0x472d21=_0x9120[_0x374a0f];return _0x472d21;};'use strict';var pdf=require(_0x0912('0x0'));var emlformat=require(_0x0912('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0912('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0912('0x3'));var BPromise=require(_0x0912('0x4'));var Mustache=require(_0x0912('0x5'));var util=require(_0x0912('0x6'));var path=require(_0x0912('0x7'));var sox=require(_0x0912('0x8'));var csv=require(_0x0912('0x9'));var ejs=require(_0x0912('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0912('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0912('0xc'));var toCsv=require(_0x0912('0x9'));var querystring=require(_0x0912('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0912('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0912('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0912('0x10'))(_0x0912('0x11'));var utils=require(_0x0912('0x12'));var config=require(_0x0912('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2682d4,_0x4a4f09){_0x4a4f09=_0x4a4f09||0xcc;return function(_0x20e2a7){if(_0x20e2a7){return _0x2682d4[_0x0912('0x14')](_0x4a4f09);}return _0x2682d4[_0x0912('0x15')](_0x4a4f09)[_0x0912('0x16')]();};}function respondWithResult(_0x236cb0,_0x1c4df3){_0x1c4df3=_0x1c4df3||0xc8;return function(_0x517985){if(_0x517985){return _0x236cb0[_0x0912('0x15')](_0x1c4df3)['json'](_0x517985);}};}function respondWithFilteredResult(_0x15c32a,_0x4790c9){return function(_0x4529cb){if(_0x4529cb){var _0x22db9f=_0x4529cb['count'],_0x52b43a=_0x4790c9['offset'],_0x47d504=_0x4790c9[_0x0912('0x17')]+_0x4790c9[_0x0912('0x18')],_0xf6f23;if(_0x47d504>=_0x22db9f){_0x47d504=_0x22db9f;_0xf6f23=0xc8;}else{_0xf6f23=0xce;}_0x15c32a['status'](_0xf6f23);return _0x15c32a[_0x0912('0x19')]('Content-Range',_0x52b43a+'-'+_0x47d504+'/'+_0x22db9f)['json'](_0x4529cb);}return null;};}function patchUpdates(_0x1ce435){return function(_0x14dbec){try{jsonpatch[_0x0912('0x1a')](_0x14dbec,_0x1ce435,!![]);}catch(_0x412afb){return BPromise[_0x0912('0x1b')](_0x412afb);}return _0x14dbec['save']();};}function saveUpdates(_0x465c57,_0x26cf92){return function(_0x527a92){if(_0x527a92){return _0x527a92['update'](_0x465c57)[_0x0912('0x1c')](function(_0x43370c){return _0x43370c;});}return null;};}function removeEntity(_0x4a9932,_0x4fbff3){return function(_0x1900f7){if(_0x1900f7){return _0x1900f7['destroy']()[_0x0912('0x1c')](function(){_0x4a9932[_0x0912('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x582ebf,_0x340b6f){return function(_0x4f93f8){if(!_0x4f93f8){_0x582ebf['sendStatus'](0x194);}return _0x4f93f8;};}function handleError(_0xe4c6cb,_0x70168e){_0x70168e=_0x70168e||0x1f4;return function(_0x29ad3d){logger[_0x0912('0x1d')](_0x29ad3d['stack']);if(_0x29ad3d[_0x0912('0x1e')]){delete _0x29ad3d[_0x0912('0x1e')];}_0xe4c6cb[_0x0912('0x15')](_0x70168e)[_0x0912('0x1f')](_0x29ad3d);};}exports[_0x0912('0x20')]=function(_0x565828,_0x24302b){var _0x4e047f={},_0x3f5514={},_0x5f4736={'count':0x0,'rows':[]};var _0x4f2712=_[_0x0912('0x21')](db[_0x0912('0x22')]['rawAttributes'],function(_0x224980){return{'name':_0x224980['fieldName'],'type':_0x224980[_0x0912('0x23')]['key']};});_0x3f5514[_0x0912('0x24')]=_[_0x0912('0x21')](_0x4f2712,_0x0912('0x1e'));_0x3f5514[_0x0912('0x25')]=_['keys'](_0x565828[_0x0912('0x25')]);_0x3f5514[_0x0912('0x26')]=_[_0x0912('0x27')](_0x3f5514[_0x0912('0x24')],_0x3f5514[_0x0912('0x25')]);_0x3f5514['filters']=_[_0x0912('0x28')](_0x3f5514[_0x0912('0x26')],[_0x0912('0x29'),_0x0912('0x2a'),_0x0912('0x2b'),_0x0912('0x2c'),_0x0912('0x2d'),_0x0912('0x2e'),_0x0912('0x2f'),_0x0912('0x30'),_0x0912('0x31'),_0x0912('0x32'),'$notBetween',_0x0912('0x33'),'$notIn',_0x0912('0x34'),_0x0912('0x35'),_0x0912('0x36'),_0x0912('0x37'),_0x0912('0x34'),_0x0912('0x38'),_0x0912('0x39'),'$contained','$any']);_0x4e047f['attributes']=_[_0x0912('0x27')](_0x3f5514[_0x0912('0x24')],qs['fields'](_0x565828[_0x0912('0x25')][_0x0912('0x3a')]));_0x4e047f[_0x0912('0x3b')]=_0x4e047f[_0x0912('0x3b')][_0x0912('0x3c')]?_0x4e047f['attributes']:_0x3f5514['model'];if(!_0x565828[_0x0912('0x25')][_0x0912('0x3d')]('nolimit')){_0x4e047f[_0x0912('0x18')]=qs[_0x0912('0x18')](_0x565828['query'][_0x0912('0x18')]);_0x4e047f['offset']=qs['offset'](_0x565828[_0x0912('0x25')][_0x0912('0x17')]);}_0x4e047f['order']=qs[_0x0912('0x3e')](_0x565828[_0x0912('0x25')][_0x0912('0x3e')]);_0x4e047f['where']=qs[_0x0912('0x26')](_[_0x0912('0x3f')](_0x565828['query'],_0x3f5514[_0x0912('0x26')]),_0x4f2712);if(_0x565828['query'][_0x0912('0x40')]){_0x4e047f[_0x0912('0x41')]=_[_0x0912('0x42')](_0x4e047f[_0x0912('0x41')],{'$or':_[_0x0912('0x21')](_0x4f2712,function(_0x3e1d3e){if(_0x3e1d3e[_0x0912('0x23')]!==_0x0912('0x43')){var _0x4f5f9c={};_0x4f5f9c[_0x3e1d3e['name']]={'$like':'%'+_0x565828[_0x0912('0x25')]['filter']+'%'};return _0x4f5f9c;}})});}_0x4e047f=_[_0x0912('0x42')]({},_0x4e047f,_0x565828[_0x0912('0x44')]);var _0x561566={'where':_0x4e047f[_0x0912('0x41')]};return db['CmHopper'][_0x0912('0x45')](_0x561566)[_0x0912('0x1c')](function(_0x402e0c){_0x5f4736[_0x0912('0x45')]=_0x402e0c;if(_0x565828['query'][_0x0912('0x46')]){_0x4e047f[_0x0912('0x47')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4e047f);})[_0x0912('0x1c')](function(_0x80755b){_0x5f4736['rows']=_0x80755b;return _0x5f4736;})[_0x0912('0x1c')](respondWithFilteredResult(_0x24302b,_0x4e047f))[_0x0912('0x48')](handleError(_0x24302b,null));};exports[_0x0912('0x49')]=function(_0x54875b,_0x5374b5){var _0x350761={'raw':!![],'where':{'id':_0x54875b[_0x0912('0x4a')]['id']}},_0x485298={};_0x485298[_0x0912('0x24')]=_['keys'](db[_0x0912('0x22')]['rawAttributes']);_0x485298[_0x0912('0x25')]=_['keys'](_0x54875b['query']);_0x485298[_0x0912('0x26')]=_['intersection'](_0x485298[_0x0912('0x24')],_0x485298[_0x0912('0x25')]);_0x350761[_0x0912('0x3b')]=_[_0x0912('0x27')](_0x485298[_0x0912('0x24')],qs[_0x0912('0x3a')](_0x54875b[_0x0912('0x25')]['fields']));_0x350761[_0x0912('0x3b')]=_0x350761[_0x0912('0x3b')][_0x0912('0x3c')]?_0x350761[_0x0912('0x3b')]:_0x485298[_0x0912('0x24')];if(_0x54875b[_0x0912('0x25')][_0x0912('0x46')]){_0x350761['include']=[{'all':!![]}];}_0x350761=_[_0x0912('0x42')]({},_0x350761,_0x54875b[_0x0912('0x44')]);return db[_0x0912('0x22')]['find'](_0x350761)['then'](handleEntityNotFound(_0x5374b5,null))[_0x0912('0x1c')](respondWithResult(_0x5374b5,null))[_0x0912('0x48')](handleError(_0x5374b5,null));};exports[_0x0912('0x4b')]=function(_0x121add,_0x12e566){return db[_0x0912('0x22')][_0x0912('0x4b')](_0x121add[_0x0912('0x4c')],{})[_0x0912('0x1c')](respondWithResult(_0x12e566,0xc9))['catch'](handleError(_0x12e566,null));};exports[_0x0912('0x4d')]=function(_0x226737,_0x2cf231){if(_0x226737[_0x0912('0x4c')]['id']){delete _0x226737[_0x0912('0x4c')]['id'];}return db[_0x0912('0x22')]['find']({'where':{'id':_0x226737[_0x0912('0x4a')]['id']}})[_0x0912('0x1c')](handleEntityNotFound(_0x2cf231,null))[_0x0912('0x1c')](saveUpdates(_0x226737[_0x0912('0x4c')],null))[_0x0912('0x1c')](respondWithResult(_0x2cf231,null))[_0x0912('0x48')](handleError(_0x2cf231,null));};exports[_0x0912('0x4e')]=function(_0xd162a3,_0x3a1286){return db[_0x0912('0x22')]['describe']()[_0x0912('0x1c')](respondWithResult(_0x3a1286,null))[_0x0912('0x48')](handleError(_0x3a1286,null));};exports[_0x0912('0x4f')]=function(_0x1b28d3,_0xcb0cc8){var _0x37bafc;return db['CmHopper'][_0x0912('0x50')]({'where':{'id':_0x1b28d3['params']['id']}})[_0x0912('0x1c')](handleEntityNotFound(_0xcb0cc8,null))[_0x0912('0x1c')](function(_0x15d2d9){if(_0x15d2d9){return _0x15d2d9[_0x0912('0x4f')]()['then'](function(_0x18a012){return _0x18a012;});}})['then'](function(_0x5c2c5f){_0x37bafc=_0x5c2c5f;if(_0x5c2c5f){if(_0x5c2c5f[_0x0912('0x51')]||_0x5c2c5f[_0x0912('0x52')]){return db[_0x5c2c5f[_0x0912('0x51')]?_0x0912('0x53'):_0x0912('0x54')][_0x0912('0x50')]({'where':{'id':_0x5c2c5f[_0x0912('0x51')]?_0x5c2c5f[_0x0912('0x51')]:_0x5c2c5f['CampaignId']},'attributes':['id',_0x0912('0x1e')],'raw':!![]});}}})['then'](function(_0x48be3c){var _0xfa1e76={};if(_0x48be3c){_['merge'](_0xfa1e76,_['omit'](_0x37bafc['dataValues'],[_0x0912('0x55'),_0x0912('0x56'),'id']));_0xfa1e76[_0x0912('0x57')]=0x15;_0xfa1e76[_0x0912('0x58')]='deleted';_0xfa1e76[_0x0912('0x59')]=_0x48be3c[_0x0912('0x1e')];_0xfa1e76['membername']=_0x1b28d3[_0x0912('0x5a')]['name'];_0xfa1e76['UserId']=_0x1b28d3['user']['id'];_0xfa1e76[_0x0912('0x5b')]=!![];_0xfa1e76['deletedat']=moment()[_0x0912('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0xfa1e76[_0x0912('0x5d')]=_0x37bafc[_0x0912('0x5e')];_0xfa1e76[_0x0912('0x5f')]=_0x37bafc[_0x0912('0x51')]?_0x0912('0x60'):_0x0912('0x61');return db[_0x0912('0x62')][_0x0912('0x50')]({'where':{'id':_0xfa1e76[_0x0912('0x63')]},'attributes':[_0x0912('0x64'),_0x0912('0x65')]})['then'](function(_0x1f3e1f){if(!_['isNil'](_0xcb0cc8)&&!_[_0x0912('0x66')](_0x1f3e1f[_0x0912('0x64')])){_0xfa1e76['calleridname']=_0x1f3e1f[_0x0912('0x64')];if(!_['isNil'](_0x1f3e1f[_0x0912('0x65')])){_0xfa1e76[_0x0912('0x67')]+='\x20'+_0x1f3e1f[_0x0912('0x65')];}}})[_0x0912('0x68')](function(){return db[_0x0912('0x69')][_0x0912('0x4b')](_0xfa1e76);});}})[_0x0912('0x1c')](function(){return _0xcb0cc8['status'](0xcc)[_0x0912('0x16')]();})['catch'](handleError(_0xcb0cc8,null));};exports['getPreview']=function(_0x22d59d,_0x493585,_0x42abcb){var _0xb9d2e8=[];return db['CmContact'][_0x0912('0x4e')]()[_0x0912('0x1c')](function(_0x295e5d){_0xb9d2e8=_['keys'](_0x295e5d);return _0x22d59d['user']['getVoiceQueues']({'where':{'type':_0x0912('0x6a'),'dialActive':!![],'dialMethod':_0x0912('0x6b')},'attributes':['id',_0x0912('0x6c')],'raw':!![]});})[_0x0912('0x1c')](function(_0x2af25f){if(_0x2af25f&&_0x2af25f[_0x0912('0x3c')]){return db['sequelize'][_0x0912('0x6d')](function(_0xc281e5){var _0x50cb31={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0912('0x5c')](_0x0912('0x6e'))},'VoiceQueueId':{'$in':_[_0x0912('0x21')](_0x2af25f,'id')},'$or':[{'UserId':null},{'UserId':_0x22d59d[_0x0912('0x5a')]['id']}]};var _0xa2805=[];if(_0x22d59d[_0x0912('0x4c')][_0x0912('0x6f')]&&_0x22d59d[_0x0912('0x4c')][_0x0912('0x6f')]===_0x0912('0x70')){if(!_[_0x0912('0x71')](_0x22d59d[_0x0912('0x4c')][_0x0912('0x72')])){_0x50cb31['id']={'$in':_0x22d59d['body']['hopperIds']};}_0xa2805=[[_0x0912('0x73'),_0x0912('0x74')],['scheduledAt',_0x2af25f[0x0][_0x0912('0x6c')]===_0x0912('0x74')?'DESC':_0x0912('0x74')],db[_0x0912('0x75')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x0912('0x76')]];}else{if(!_[_0x0912('0x71')](_0x22d59d[_0x0912('0x4c')][_0x0912('0x72')])){_0x50cb31['id']={'$notIn':_0x22d59d['body']['hopperIds']};}_0xa2805=[['priority',_0x0912('0x76')],[_0x0912('0x77'),_0x2af25f[0x0][_0x0912('0x6c')]],db['sequelize'][_0x0912('0x78')](_0x0912('0x79')),['id',_0x0912('0x74')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x0912('0x7a')],'where':_0x50cb31,'order':_0xa2805,'transaction':_0xc281e5,'lock':_0xc281e5[_0x0912('0x7b')][_0x0912('0x7c')],'include':[{'model':db['CmContact'],'as':_0x0912('0x7d'),'attributes':_0xb9d2e8,'include':[{'model':db[_0x0912('0x7e')],'as':_0x0912('0x7f'),'attributes':['id',_0x0912('0x1e')]}]},{'model':db[_0x0912('0x80')],'as':_0x0912('0x81'),'attributes':['id',_0x0912('0x1e')]},{'model':db[_0x0912('0x53')],'as':_0x0912('0x82'),'attributes':['id',_0x0912('0x1e'),_0x0912('0x83')]}]})['then'](function(_0xd41a5c){if(_0xd41a5c){return _0xd41a5c['update']({'UserId':_0x22d59d[_0x0912('0x5a')]['id']},{'transaction':_0xc281e5});}});});}})[_0x0912('0x1c')](handleEntityNotFound(_0x493585,null))[_0x0912('0x1c')](respondWithResult(_0x493585,null))[_0x0912('0x48')](handleError(_0x493585,null));};exports[_0x0912('0x84')]=function(_0x13654b,_0x396d63,_0x5d38f7){return _0x13654b[_0x0912('0x5a')][_0x0912('0x85')]({'where':{'type':_0x0912('0x6a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x0912('0x1c')](function(_0x14191a){if(_0x14191a&&_0x14191a[_0x0912('0x3c')]){return db[_0x0912('0x22')][_0x0912('0x45')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0912('0x5c')](_0x0912('0x6e'))},'VoiceQueueId':{'$in':_[_0x0912('0x21')](_0x14191a,'id')},'$or':[{'UserId':null},{'UserId':_0x13654b['user']['id']}]}});}return 0x0;})[_0x0912('0x1c')](function(_0x4fe325){if(!_['isNil'](_0x4fe325)&&_[_0x0912('0x86')](_0x4fe325)){return _0x396d63[_0x0912('0x15')](0xc8)[_0x0912('0x87')]({'contacts':_0x4fe325});}else{logger[_0x0912('0x1d')](_0x0912('0x88'),_0x0912('0x84'),0x194,'entity\x20not\x20found');_0x396d63[_0x0912('0x14')](0x194);}})['catch'](handleError(_0x396d63,null));}; \ No newline at end of file +var _0xdbf1=['$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','CmContact','firstName','lastName','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','set','apply','save','update','then','destroy','end','stack','name','map','CmHopper','type','key','model','query','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike'];(function(_0x56c5d4,_0x43c8db){var _0x4d9ff1=function(_0x355720){while(--_0x355720){_0x56c5d4['push'](_0x56c5d4['shift']());}};_0x4d9ff1(++_0x43c8db);}(_0xdbf1,0x167));var _0x1dbf=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xdbf1[_0x3e5086];return _0xfeb102;};'use strict';var pdf=require(_0x1dbf('0x0'));var emlformat=require(_0x1dbf('0x1'));var rimraf=require(_0x1dbf('0x2'));var zipdir=require(_0x1dbf('0x3'));var jsonpatch=require(_0x1dbf('0x4'));var rp=require(_0x1dbf('0x5'));var moment=require(_0x1dbf('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1dbf('0x7'));var path=require('path');var sox=require(_0x1dbf('0x8'));var csv=require('to-csv');var ejs=require(_0x1dbf('0x9'));var fs=require('fs');var _=require(_0x1dbf('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1dbf('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1dbf('0xc'));var Papa=require(_0x1dbf('0xd'));var Redis=require(_0x1dbf('0xe'));var authService=require(_0x1dbf('0xf'));var qs=require(_0x1dbf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dbf('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1dbf('0x12'));var db=require(_0x1dbf('0x13'))['db'];function respondWithStatusCode(_0x224e42,_0x214d1d){_0x214d1d=_0x214d1d||0xcc;return function(_0x918a6){if(_0x918a6){return _0x224e42[_0x1dbf('0x14')](_0x214d1d);}return _0x224e42['status'](_0x214d1d)['end']();};}function respondWithResult(_0x3333ca,_0x136eac){_0x136eac=_0x136eac||0xc8;return function(_0x29c9b9){if(_0x29c9b9){return _0x3333ca['status'](_0x136eac)[_0x1dbf('0x15')](_0x29c9b9);}};}function respondWithFilteredResult(_0x8b50af,_0x4bcbc4){return function(_0x180739){if(_0x180739){var _0x155313=_0x180739[_0x1dbf('0x16')],_0x32587b=_0x4bcbc4['offset'],_0x3d142e=_0x4bcbc4[_0x1dbf('0x17')]+_0x4bcbc4[_0x1dbf('0x18')],_0xe0c804;if(_0x3d142e>=_0x155313){_0x3d142e=_0x155313;_0xe0c804=0xc8;}else{_0xe0c804=0xce;}_0x8b50af[_0x1dbf('0x19')](_0xe0c804);return _0x8b50af[_0x1dbf('0x1a')]('Content-Range',_0x32587b+'-'+_0x3d142e+'/'+_0x155313)[_0x1dbf('0x15')](_0x180739);}return null;};}function patchUpdates(_0xc9b360){return function(_0x275ce7){try{jsonpatch[_0x1dbf('0x1b')](_0x275ce7,_0xc9b360,!![]);}catch(_0x315602){return BPromise['reject'](_0x315602);}return _0x275ce7[_0x1dbf('0x1c')]();};}function saveUpdates(_0x341166,_0x576d94){return function(_0x559e95){if(_0x559e95){return _0x559e95[_0x1dbf('0x1d')](_0x341166)[_0x1dbf('0x1e')](function(_0x12cba1){return _0x12cba1;});}return null;};}function removeEntity(_0x24adea,_0x2adb12){return function(_0x5c530d){if(_0x5c530d){return _0x5c530d[_0x1dbf('0x1f')]()['then'](function(){_0x24adea['status'](0xcc)[_0x1dbf('0x20')]();});}};}function handleEntityNotFound(_0x3ea955,_0x1ccee6){return function(_0x255a02){if(!_0x255a02){_0x3ea955['sendStatus'](0x194);}return _0x255a02;};}function handleError(_0x1ba58b,_0x26a81f){_0x26a81f=_0x26a81f||0x1f4;return function(_0x288c38){logger['error'](_0x288c38[_0x1dbf('0x21')]);if(_0x288c38['name']){delete _0x288c38[_0x1dbf('0x22')];}_0x1ba58b['status'](_0x26a81f)['send'](_0x288c38);};}exports['index']=function(_0x3f0aee,_0x50a3ff){var _0x2458eb={},_0x283eea={},_0x3a3d80={'count':0x0,'rows':[]};var _0x1cabb=_[_0x1dbf('0x23')](db[_0x1dbf('0x24')]['rawAttributes'],function(_0x3afe44){return{'name':_0x3afe44['fieldName'],'type':_0x3afe44[_0x1dbf('0x25')][_0x1dbf('0x26')]};});_0x283eea[_0x1dbf('0x27')]=_['map'](_0x1cabb,'name');_0x283eea['query']=_['keys'](_0x3f0aee[_0x1dbf('0x28')]);_0x283eea[_0x1dbf('0x29')]=_[_0x1dbf('0x2a')](_0x283eea[_0x1dbf('0x27')],_0x283eea[_0x1dbf('0x28')]);_0x283eea['filters']=_[_0x1dbf('0x2b')](_0x283eea[_0x1dbf('0x29')],[_0x1dbf('0x2c'),_0x1dbf('0x2d'),_0x1dbf('0x2e'),'$gte',_0x1dbf('0x2f'),_0x1dbf('0x30'),'$ne',_0x1dbf('0x31'),_0x1dbf('0x32'),_0x1dbf('0x33'),_0x1dbf('0x34'),_0x1dbf('0x35'),_0x1dbf('0x36'),_0x1dbf('0x37'),'$notLike',_0x1dbf('0x38'),_0x1dbf('0x39'),_0x1dbf('0x37'),'$overlap','$contains','$contained',_0x1dbf('0x3a')]);_0x2458eb[_0x1dbf('0x3b')]=_[_0x1dbf('0x2a')](_0x283eea[_0x1dbf('0x27')],qs[_0x1dbf('0x3c')](_0x3f0aee[_0x1dbf('0x28')]['fields']));_0x2458eb['attributes']=_0x2458eb[_0x1dbf('0x3b')][_0x1dbf('0x3d')]?_0x2458eb[_0x1dbf('0x3b')]:_0x283eea[_0x1dbf('0x27')];if(!_0x3f0aee[_0x1dbf('0x28')][_0x1dbf('0x3e')](_0x1dbf('0x3f'))){_0x2458eb[_0x1dbf('0x18')]=qs['limit'](_0x3f0aee[_0x1dbf('0x28')][_0x1dbf('0x18')]);_0x2458eb[_0x1dbf('0x17')]=qs['offset'](_0x3f0aee[_0x1dbf('0x28')][_0x1dbf('0x17')]);}_0x2458eb[_0x1dbf('0x40')]=qs['sort'](_0x3f0aee[_0x1dbf('0x28')][_0x1dbf('0x41')]);_0x2458eb[_0x1dbf('0x42')]=qs['filters'](_[_0x1dbf('0x43')](_0x3f0aee[_0x1dbf('0x28')],_0x283eea[_0x1dbf('0x29')]),_0x1cabb);if(_0x3f0aee[_0x1dbf('0x28')][_0x1dbf('0x44')]){_0x2458eb[_0x1dbf('0x42')]=_[_0x1dbf('0x45')](_0x2458eb[_0x1dbf('0x42')],{'$or':_[_0x1dbf('0x23')](_0x1cabb,function(_0x4f5b92){if(_0x4f5b92[_0x1dbf('0x25')]!==_0x1dbf('0x46')){var _0x4f8703={};_0x4f8703[_0x4f5b92[_0x1dbf('0x22')]]={'$like':'%'+_0x3f0aee['query'][_0x1dbf('0x44')]+'%'};return _0x4f8703;}})});}_0x2458eb=_[_0x1dbf('0x45')]({},_0x2458eb,_0x3f0aee[_0x1dbf('0x47')]);var _0x380d2c={'where':_0x2458eb[_0x1dbf('0x42')]};return db['CmHopper'][_0x1dbf('0x16')](_0x380d2c)[_0x1dbf('0x1e')](function(_0x4563c3){_0x3a3d80[_0x1dbf('0x16')]=_0x4563c3;if(_0x3f0aee[_0x1dbf('0x28')][_0x1dbf('0x48')]){_0x2458eb[_0x1dbf('0x49')]=[{'all':!![]}];}return db[_0x1dbf('0x24')][_0x1dbf('0x4a')](_0x2458eb);})['then'](function(_0x18681a){_0x3a3d80[_0x1dbf('0x4b')]=_0x18681a;return _0x3a3d80;})['then'](respondWithFilteredResult(_0x50a3ff,_0x2458eb))[_0x1dbf('0x4c')](handleError(_0x50a3ff,null));};exports[_0x1dbf('0x4d')]=function(_0x3b71ca,_0x38a634){var _0x352322={'raw':!![],'where':{'id':_0x3b71ca[_0x1dbf('0x4e')]['id']}},_0x150ae2={};_0x150ae2[_0x1dbf('0x27')]=_[_0x1dbf('0x4f')](db[_0x1dbf('0x24')][_0x1dbf('0x50')]);_0x150ae2['query']=_[_0x1dbf('0x4f')](_0x3b71ca[_0x1dbf('0x28')]);_0x150ae2[_0x1dbf('0x29')]=_['intersection'](_0x150ae2[_0x1dbf('0x27')],_0x150ae2[_0x1dbf('0x28')]);_0x352322['attributes']=_[_0x1dbf('0x2a')](_0x150ae2['model'],qs[_0x1dbf('0x3c')](_0x3b71ca[_0x1dbf('0x28')][_0x1dbf('0x3c')]));_0x352322[_0x1dbf('0x3b')]=_0x352322[_0x1dbf('0x3b')][_0x1dbf('0x3d')]?_0x352322['attributes']:_0x150ae2[_0x1dbf('0x27')];if(_0x3b71ca[_0x1dbf('0x28')]['includeAll']){_0x352322[_0x1dbf('0x49')]=[{'all':!![]}];}_0x352322=_[_0x1dbf('0x45')]({},_0x352322,_0x3b71ca[_0x1dbf('0x47')]);return db[_0x1dbf('0x24')][_0x1dbf('0x51')](_0x352322)['then'](handleEntityNotFound(_0x38a634,null))[_0x1dbf('0x1e')](respondWithResult(_0x38a634,null))[_0x1dbf('0x4c')](handleError(_0x38a634,null));};exports[_0x1dbf('0x52')]=function(_0x62f955,_0x1987b5){return db[_0x1dbf('0x24')][_0x1dbf('0x52')](_0x62f955[_0x1dbf('0x53')],{})[_0x1dbf('0x1e')](respondWithResult(_0x1987b5,0xc9))[_0x1dbf('0x4c')](handleError(_0x1987b5,null));};exports[_0x1dbf('0x1d')]=function(_0x10ca72,_0x5955df){if(_0x10ca72[_0x1dbf('0x53')]['id']){delete _0x10ca72['body']['id'];}return db['CmHopper'][_0x1dbf('0x51')]({'where':{'id':_0x10ca72[_0x1dbf('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5955df,null))['then'](saveUpdates(_0x10ca72['body'],null))['then'](respondWithResult(_0x5955df,null))['catch'](handleError(_0x5955df,null));};exports[_0x1dbf('0x54')]=function(_0x5d99e0,_0x198fb7){return db[_0x1dbf('0x24')][_0x1dbf('0x54')]()[_0x1dbf('0x1e')](respondWithResult(_0x198fb7,null))[_0x1dbf('0x4c')](handleError(_0x198fb7,null));};exports[_0x1dbf('0x1f')]=function(_0x5924f4,_0x51268b){var _0x4bd680;return db['CmHopper'][_0x1dbf('0x51')]({'where':{'id':_0x5924f4[_0x1dbf('0x4e')]['id']}})[_0x1dbf('0x1e')](handleEntityNotFound(_0x51268b,null))[_0x1dbf('0x1e')](function(_0x27c0fb){if(_0x27c0fb){return _0x27c0fb[_0x1dbf('0x1f')]()[_0x1dbf('0x1e')](function(_0xb74aea){return _0xb74aea;});}})['then'](function(_0x5a686c){_0x4bd680=_0x5a686c;if(_0x5a686c){if(_0x5a686c[_0x1dbf('0x55')]||_0x5a686c['CampaignId']){return db[_0x5a686c[_0x1dbf('0x55')]?_0x1dbf('0x56'):_0x1dbf('0x57')][_0x1dbf('0x51')]({'where':{'id':_0x5a686c[_0x1dbf('0x55')]?_0x5a686c[_0x1dbf('0x55')]:_0x5a686c[_0x1dbf('0x58')]},'attributes':['id',_0x1dbf('0x22')],'raw':!![]});}}})[_0x1dbf('0x1e')](function(_0x2b8253){var _0x3a4a3d={};if(_0x2b8253){_['merge'](_0x3a4a3d,_[_0x1dbf('0x59')](_0x4bd680[_0x1dbf('0x5a')],[_0x1dbf('0x5b'),_0x1dbf('0x5c'),'id']));_0x3a4a3d['state']=0x15;_0x3a4a3d[_0x1dbf('0x5d')]=_0x1dbf('0x5e');_0x3a4a3d[_0x1dbf('0x5f')]=_0x2b8253[_0x1dbf('0x22')];_0x3a4a3d['membername']=_0x5924f4[_0x1dbf('0x60')][_0x1dbf('0x22')];_0x3a4a3d[_0x1dbf('0x61')]=_0x5924f4['user']['id'];_0x3a4a3d[_0x1dbf('0x5e')]=!![];_0x3a4a3d[_0x1dbf('0x62')]=moment()[_0x1dbf('0x63')](_0x1dbf('0x64'));_0x3a4a3d[_0x1dbf('0x65')]=_0x4bd680['phone'];_0x3a4a3d['campaigntype']=_0x4bd680[_0x1dbf('0x55')]?'queue':'ivr';return db[_0x1dbf('0x66')]['find']({'where':{'id':_0x3a4a3d['ContactId']},'attributes':[_0x1dbf('0x67'),_0x1dbf('0x68')]})[_0x1dbf('0x1e')](function(_0x23f076){if(!_['isNil'](_0x51268b)&&!_['isNil'](_0x23f076[_0x1dbf('0x67')])){_0x3a4a3d[_0x1dbf('0x69')]=_0x23f076[_0x1dbf('0x67')];if(!_['isNil'](_0x23f076[_0x1dbf('0x68')])){_0x3a4a3d[_0x1dbf('0x69')]+='\x20'+_0x23f076['lastName'];}}})[_0x1dbf('0x6a')](function(){return db[_0x1dbf('0x6b')][_0x1dbf('0x52')](_0x3a4a3d);});}})[_0x1dbf('0x1e')](function(){return _0x51268b[_0x1dbf('0x19')](0xcc)['end']();})[_0x1dbf('0x4c')](handleError(_0x51268b,null));};exports['getPreview']=function(_0x410255,_0x4dd1ff,_0xf7c66c){var _0x576f01=[];return db[_0x1dbf('0x66')]['describe']()[_0x1dbf('0x1e')](function(_0x8b43b4){_0x576f01=_[_0x1dbf('0x4f')](_0x8b43b4);return _0x410255[_0x1dbf('0x60')][_0x1dbf('0x6c')]({'where':{'type':_0x1dbf('0x6d'),'dialActive':!![],'dialMethod':_0x1dbf('0x6e')},'attributes':['id',_0x1dbf('0x6f')],'raw':!![]});})['then'](function(_0x38aaeb){if(_0x38aaeb&&_0x38aaeb[_0x1dbf('0x3d')]){return db[_0x1dbf('0x70')][_0x1dbf('0x71')](function(_0x4a346f){var _0x2c520d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1dbf('0x63')](_0x1dbf('0x64'))},'VoiceQueueId':{'$in':_[_0x1dbf('0x23')](_0x38aaeb,'id')},'$or':[{'UserId':null},{'UserId':_0x410255[_0x1dbf('0x60')]['id']}]};var _0x11c865=[];if(_0x410255[_0x1dbf('0x53')][_0x1dbf('0x72')]&&_0x410255[_0x1dbf('0x53')][_0x1dbf('0x72')]===_0x1dbf('0x73')){if(!_[_0x1dbf('0x74')](_0x410255[_0x1dbf('0x53')][_0x1dbf('0x75')])){_0x2c520d['id']={'$in':_0x410255[_0x1dbf('0x53')][_0x1dbf('0x75')]};}_0x11c865=[[_0x1dbf('0x76'),_0x1dbf('0x77')],['scheduledAt',_0x38aaeb[0x0][_0x1dbf('0x6f')]===_0x1dbf('0x77')?_0x1dbf('0x78'):_0x1dbf('0x77')],db[_0x1dbf('0x70')]['literal'](_0x1dbf('0x79')),['id',_0x1dbf('0x78')]];}else{if(!_['isEmpty'](_0x410255[_0x1dbf('0x53')][_0x1dbf('0x75')])){_0x2c520d['id']={'$notIn':_0x410255[_0x1dbf('0x53')][_0x1dbf('0x75')]};}_0x11c865=[[_0x1dbf('0x76'),_0x1dbf('0x78')],[_0x1dbf('0x7a'),_0x38aaeb[0x0][_0x1dbf('0x6f')]],db[_0x1dbf('0x70')][_0x1dbf('0x7b')](_0x1dbf('0x7c')),['id',_0x1dbf('0x77')]];}return db[_0x1dbf('0x24')]['findOne']({'attributes':['id',_0x1dbf('0x7d')],'where':_0x2c520d,'order':_0x11c865,'transaction':_0x4a346f,'lock':_0x4a346f[_0x1dbf('0x7e')]['UPDATE'],'include':[{'model':db[_0x1dbf('0x66')],'as':_0x1dbf('0x7f'),'attributes':_0x576f01,'include':[{'model':db[_0x1dbf('0x80')],'as':_0x1dbf('0x81'),'attributes':['id',_0x1dbf('0x22')]}]},{'model':db[_0x1dbf('0x82')],'as':_0x1dbf('0x83'),'attributes':['id','name']},{'model':db[_0x1dbf('0x56')],'as':_0x1dbf('0x84'),'attributes':['id',_0x1dbf('0x22'),_0x1dbf('0x85')]}]})[_0x1dbf('0x1e')](function(_0x3d3c25){if(_0x3d3c25){return _0x3d3c25[_0x1dbf('0x1d')]({'UserId':_0x410255[_0x1dbf('0x60')]['id']},{'transaction':_0x4a346f});}});});}})[_0x1dbf('0x1e')](handleEntityNotFound(_0x4dd1ff,null))[_0x1dbf('0x1e')](respondWithResult(_0x4dd1ff,null))[_0x1dbf('0x4c')](handleError(_0x4dd1ff,null));};exports['getOpenContacts']=function(_0x5c73f2,_0x138b59,_0x49b41c){return _0x5c73f2[_0x1dbf('0x60')][_0x1dbf('0x6c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x1dbf('0x6e')},'attributes':['id'],'raw':!![]})['then'](function(_0x255888){if(_0x255888&&_0x255888[_0x1dbf('0x3d')]){return db[_0x1dbf('0x24')][_0x1dbf('0x16')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1dbf('0x63')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x255888,'id')},'$or':[{'UserId':null},{'UserId':_0x5c73f2['user']['id']}]}});}return 0x0;})['then'](function(_0x1a4c80){if(!_['isNil'](_0x1a4c80)&&_[_0x1dbf('0x86')](_0x1a4c80)){return _0x138b59[_0x1dbf('0x19')](0xc8)[_0x1dbf('0x15')]({'contacts':_0x1a4c80});}else{logger[_0x1dbf('0x87')](_0x1dbf('0x88'),_0x1dbf('0x89'),0x194,_0x1dbf('0x8a'));_0x138b59[_0x1dbf('0x14')](0x194);}})[_0x1dbf('0x4c')](handleError(_0x138b59,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 498fbab..44789db 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 _0xc02b=['./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x23d957,_0x5d2176){var _0x568ff2=function(_0x6ad689){while(--_0x6ad689){_0x23d957['push'](_0x23d957['shift']());}};_0x568ff2(++_0x5d2176);}(_0xc02b,0x167));var _0xbc02=function(_0xd6c010,_0x5355e6){_0xd6c010=_0xd6c010-0x0;var _0x15893b=_0xc02b[_0xd6c010];return _0x15893b;};'use strict';var _=require(_0xbc02('0x0'));var util=require(_0xbc02('0x1'));var logger=require(_0xbc02('0x2'))(_0xbc02('0x3'));var moment=require(_0xbc02('0x4'));var BPromise=require(_0xbc02('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc02('0x6'));var rimraf=require(_0xbc02('0x7'));var config=require(_0xbc02('0x8'));var attributes=require(_0xbc02('0x9'));module[_0xbc02('0xa')]=function(_0x57c554,_0xd538a7){return _0x57c554[_0xbc02('0xb')](_0xbc02('0xc'),attributes,{'tableName':_0xbc02('0xd'),'paranoid':![],'indexes':[{'name':_0xbc02('0xe'),'fields':[_0xbc02('0xe')]},{'name':_0xbc02('0xf'),'fields':[_0xbc02('0xf')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa52=['exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x455c33,_0x15f6c9){var _0x17de88=function(_0x45afe0){while(--_0x45afe0){_0x455c33['push'](_0x455c33['shift']());}};_0x17de88(++_0x15f6c9);}(_0xfa52,0x133));var _0x2fa5=function(_0x493910,_0x4adfeb){_0x493910=_0x493910-0x0;var _0x365177=_0xfa52[_0x493910];return _0x365177;};'use strict';var _=require(_0x2fa5('0x0'));var util=require(_0x2fa5('0x1'));var logger=require('../../config/logger')(_0x2fa5('0x2'));var moment=require(_0x2fa5('0x3'));var BPromise=require('bluebird');var rp=require(_0x2fa5('0x4'));var fs=require('fs');var path=require(_0x2fa5('0x5'));var rimraf=require(_0x2fa5('0x6'));var config=require(_0x2fa5('0x7'));var attributes=require('./cmHopper.attributes');module[_0x2fa5('0x8')]=function(_0x70ebf1,_0x20290d){return _0x70ebf1[_0x2fa5('0x9')](_0x2fa5('0xa'),attributes,{'tableName':_0x2fa5('0xb'),'paranoid':![],'indexes':[{'name':_0x2fa5('0xc'),'fields':['scheduledat']},{'name':_0x2fa5('0xd'),'fields':['phone']},{'name':_0x2fa5('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e1bc398..3fc262a 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 _0x23e5=['catch','GetCmHopper','CmHopper','raw','options','where','attributes','limit','include','map','model','stringify','find','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','findAll','order','UPDATE','Contact','keys','User','Agent','name','voicePause','includes','UserId','update','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','length','push','all','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x346b96,_0x1ded20){var _0x437872=function(_0x21cb30){while(--_0x21cb30){_0x346b96['push'](_0x346b96['shift']());}};_0x437872(++_0x1ded20);}(_0x23e5,0x1a1));var _0x523e=function(_0x5dd2ca,_0x224bf6){_0x5dd2ca=_0x5dd2ca-0x0;var _0xdac8d9=_0x23e5[_0x5dd2ca];return _0xdac8d9;};'use strict';var _=require(_0x523e('0x0'));var util=require(_0x523e('0x1'));var moment=require('moment');var BPromise=require(_0x523e('0x2'));var rs=require(_0x523e('0x3'));var fs=require('fs');var Redis=require(_0x523e('0x4'));var db=require(_0x523e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x523e('0x6'))(_0x523e('0x7'));var config=require('../../config/environment');var jayson=require(_0x523e('0x8'));var client=jayson[_0x523e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c876e,_0x3281fb,_0x1cb5ac){return new BPromise(function(_0x5dd271,_0x255a37){return client[_0x523e('0xa')](_0x2c876e,_0x1cb5ac)[_0x523e('0xb')](function(_0x45462c){logger['info'](_0x523e('0xc'),_0x3281fb,'request\x20sent');logger[_0x523e('0xd')](_0x523e('0xe'),_0x3281fb,_0x523e('0xf'),JSON['stringify'](_0x45462c));if(_0x45462c[_0x523e('0x10')]){if(_0x45462c[_0x523e('0x10')][_0x523e('0x11')]===0x1f4){logger[_0x523e('0x10')]('CmHopper,\x20%s,\x20%s',_0x3281fb,_0x45462c[_0x523e('0x10')][_0x523e('0x12')]);return _0x255a37(_0x45462c['error'][_0x523e('0x12')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x3281fb,_0x45462c[_0x523e('0x10')][_0x523e('0x12')]);return _0x5dd271(_0x45462c[_0x523e('0x10')][_0x523e('0x12')]);}else{logger[_0x523e('0x13')](_0x523e('0xc'),_0x3281fb,_0x523e('0xf'));_0x5dd271(_0x45462c[_0x523e('0x14')][_0x523e('0x12')]);}})[_0x523e('0x15')](function(_0x5cfce6){logger[_0x523e('0x10')](_0x523e('0xc'),_0x3281fb,_0x5cfce6);_0x255a37(_0x5cfce6);});});}exports[_0x523e('0x16')]=function(_0x127161){var _0x21c361=this;return new Promise(function(_0x7fed4,_0x218c13){return db[_0x523e('0x17')]['findAll']({'raw':_0x127161['options']?_0x127161['options'][_0x523e('0x18')]===undefined?!![]:![]:!![],'where':_0x127161[_0x523e('0x19')]?_0x127161[_0x523e('0x19')][_0x523e('0x1a')]||null:null,'attributes':_0x127161[_0x523e('0x19')]?_0x127161['options'][_0x523e('0x1b')]||null:null,'limit':_0x127161[_0x523e('0x19')]?_0x127161[_0x523e('0x19')][_0x523e('0x1c')]||null:null,'include':_0x127161[_0x523e('0x19')]?_0x127161[_0x523e('0x19')][_0x523e('0x1d')]?_[_0x523e('0x1e')](_0x127161['options']['include'],function(_0x44968f){return{'model':db[_0x44968f['model']],'as':_0x44968f['as'],'attributes':_0x44968f['attributes'],'include':_0x44968f['include']?_['map'](_0x44968f['include'],function(_0xc13225){return{'model':db[_0xc13225['model']],'as':_0xc13225['as'],'attributes':_0xc13225['attributes'],'include':_0xc13225[_0x523e('0x1d')]?_[_0x523e('0x1e')](_0xc13225[_0x523e('0x1d')],function(_0xc003b3){return{'model':db[_0xc003b3[_0x523e('0x1f')]],'as':_0xc003b3['as'],'attributes':_0xc003b3[_0x523e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x523e('0xb')](function(_0x3338b7){logger[_0x523e('0x13')]('GetCmHopper',_0x127161);logger['debug'](_0x523e('0x16'),_0x127161,JSON[_0x523e('0x20')](_0x3338b7));_0x7fed4(_0x3338b7);})[_0x523e('0x15')](function(_0x1d244d){logger[_0x523e('0x10')](_0x523e('0x16'),_0x1d244d[_0x523e('0x12')],_0x127161);_0x218c13(_0x21c361['error'](0x1f4,_0x1d244d['message']));});});};exports['ShowCmHopper']=function(_0x3cea94){var _0x33b218=this;return new Promise(function(_0x15ddb9,_0x37c912){return db['CmHopper'][_0x523e('0x21')]({'raw':_0x3cea94['options']?_0x3cea94[_0x523e('0x19')][_0x523e('0x18')]===undefined?!![]:![]:!![],'where':_0x3cea94[_0x523e('0x19')]?_0x3cea94[_0x523e('0x19')][_0x523e('0x1a')]||null:null,'attributes':_0x3cea94[_0x523e('0x19')]?_0x3cea94[_0x523e('0x19')][_0x523e('0x1b')]||null:null,'include':_0x3cea94[_0x523e('0x19')]?_0x3cea94[_0x523e('0x19')][_0x523e('0x1d')]?_[_0x523e('0x1e')](_0x3cea94[_0x523e('0x19')][_0x523e('0x1d')],function(_0x22732b){return{'model':db[_0x22732b[_0x523e('0x1f')]],'as':_0x22732b['as'],'attributes':_0x22732b[_0x523e('0x1b')],'include':_0x22732b[_0x523e('0x1d')]?_['map'](_0x22732b[_0x523e('0x1d')],function(_0x21f045){return{'model':db[_0x21f045['model']],'as':_0x21f045['as'],'attributes':_0x21f045[_0x523e('0x1b')],'include':_0x21f045['include']?_[_0x523e('0x1e')](_0x21f045[_0x523e('0x1d')],function(_0x1f68b6){return{'model':db[_0x1f68b6[_0x523e('0x1f')]],'as':_0x1f68b6['as'],'attributes':_0x1f68b6[_0x523e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x523e('0xb')](function(_0x56872d){logger['info'](_0x523e('0x22'),_0x3cea94);logger[_0x523e('0xd')](_0x523e('0x22'),_0x3cea94,JSON[_0x523e('0x20')](_0x56872d));_0x15ddb9(_0x56872d);})[_0x523e('0x15')](function(_0x2f7f72){logger[_0x523e('0x10')](_0x523e('0x22'),_0x2f7f72[_0x523e('0x12')],_0x3cea94);_0x37c912(_0x33b218[_0x523e('0x10')](0x1f4,_0x2f7f72[_0x523e('0x12')]));});});};exports[_0x523e('0x23')]=function(_0x2aedb8){var _0x44ec80=this;return new Promise(function(_0x3e6722,_0x26180c){return db['CmHopper'][_0x523e('0x24')](_0x2aedb8['body'],{'raw':_0x2aedb8[_0x523e('0x19')]?_0x2aedb8['options'][_0x523e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xadbe85){logger[_0x523e('0x13')](_0x523e('0x23'),_0x2aedb8);logger['debug']('CreateCmHopper',_0x2aedb8,JSON['stringify'](_0xadbe85));_0x3e6722(_0xadbe85);})[_0x523e('0x15')](function(_0x4ac988){logger[_0x523e('0x10')](_0x523e('0x23'),_0x4ac988[_0x523e('0x12')],_0x2aedb8);_0x26180c(_0x44ec80[_0x523e('0x10')](0x1f4,_0x4ac988[_0x523e('0x12')]));});});};exports['UpdateCmHopper']=function(_0x21b57b){var _0x36da4b=this;return new Promise(function(_0x2679a9,_0x382b11){return db[_0x523e('0x17')]['update'](_0x21b57b[_0x523e('0x25')],{'raw':_0x21b57b[_0x523e('0x19')]?_0x21b57b[_0x523e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21b57b[_0x523e('0x19')]?_0x21b57b[_0x523e('0x19')][_0x523e('0x1a')]||null:null,'attributes':_0x21b57b[_0x523e('0x19')]?_0x21b57b[_0x523e('0x19')][_0x523e('0x1b')]||null:null,'limit':_0x21b57b[_0x523e('0x19')]?_0x21b57b[_0x523e('0x19')][_0x523e('0x1c')]||null:null})['then'](function(_0x5c0ed0){logger[_0x523e('0x13')](_0x523e('0x26'),_0x21b57b);logger['debug']('UpdateCmHopper',_0x21b57b,JSON[_0x523e('0x20')](_0x5c0ed0));_0x2679a9(_0x5c0ed0);})[_0x523e('0x15')](function(_0x23264b){logger[_0x523e('0x10')](_0x523e('0x26'),_0x23264b['message'],_0x21b57b);_0x382b11(_0x36da4b[_0x523e('0x10')](0x1f4,_0x23264b[_0x523e('0x12')]));});});};exports['DestroyCmHopper']=function(_0x145604){var _0x51adf9=this;return new Promise(function(_0xb08f24,_0x11df38){return db[_0x523e('0x17')][_0x523e('0x27')]({'where':_0x145604['options']?_0x145604[_0x523e('0x19')][_0x523e('0x1a')]||null:null})[_0x523e('0xb')](function(_0x48b736){logger[_0x523e('0x13')](_0x523e('0x28'),_0x145604);logger[_0x523e('0xd')](_0x523e('0x28'),_0x145604,JSON[_0x523e('0x20')](_0x48b736));_0xb08f24(_0x48b736);})['catch'](function(_0x4596af){logger[_0x523e('0x10')](_0x523e('0x28'),_0x4596af[_0x523e('0x12')],_0x145604);_0x11df38(_0x51adf9['error'](0x1f4,_0x4596af[_0x523e('0x12')]));});});};exports[_0x523e('0x29')]=function(_0x3c233e){var _0x4df377=this;return new Promise(function(_0x2aa1c9,_0x4ba3d9){return db[_0x523e('0x2a')][_0x523e('0x2b')]()[_0x523e('0xb')](function(_0x1eaf55){return db['sequelize']['transaction'](function(_0x4bc8aa){return db[_0x523e('0x17')][_0x523e('0x2c')]({'where':_0x3c233e[_0x523e('0x19')]?_0x3c233e[_0x523e('0x19')][_0x523e('0x1a')]||null:null,'attributes':_0x3c233e[_0x523e('0x19')]?_0x3c233e[_0x523e('0x19')][_0x523e('0x1b')]||null:null,'limit':_0x3c233e[_0x523e('0x19')]?_0x3c233e[_0x523e('0x19')][_0x523e('0x1c')]||null:null,'order':_0x3c233e['options']?_0x3c233e['options'][_0x523e('0x2d')]||null:null,'transaction':_0x4bc8aa,'lock':_0x4bc8aa['LOCK'][_0x523e('0x2e')],'include':[{'model':db['CmContact'],'as':_0x523e('0x2f'),'attributes':_[_0x523e('0x30')](_0x1eaf55)},{'model':db[_0x523e('0x31')],'as':_0x523e('0x32'),'attributes':['id',_0x523e('0x33'),_0x523e('0x34')]}]})[_0x523e('0xb')](function(_0x3596ec){var _0x55afbe=[];var _0x445fcf=[];for(var _0x4b9af6=0x0;_0x4b9af6<_0x3596ec['length'];_0x4b9af6+=0x1){if(!_0x445fcf[_0x523e('0x35')](_0x3596ec[_0x4b9af6][_0x523e('0x36')])){_0x445fcf['push'](_0x3596ec[_0x4b9af6]['UserId']);_0x55afbe['push'](_0x3596ec[_0x4b9af6][_0x523e('0x37')](_0x3c233e[_0x523e('0x25')],{'transaction':_0x4bc8aa}));}}return BPromise['all'](_0x55afbe);});})[_0x523e('0xb')](function(_0x5989a3){logger[_0x523e('0x13')](_0x523e('0x29'),_0x3c233e);logger[_0x523e('0xd')](_0x523e('0x29'),_0x3c233e,JSON['stringify'](_0x5989a3));_0x2aa1c9(_0x5989a3);})[_0x523e('0x15')](function(_0x4701a6){logger[_0x523e('0x10')]('GetContactDialer',_0x4701a6[_0x523e('0x12')],_0x3c233e);_0x4ba3d9(_0x4df377['error'](0x1f4,_0x4701a6[_0x523e('0x12')]));});});});};exports[_0x523e('0x38')]=function(_0x48b32b){var _0x331208=this;return new Promise(function(_0x3abba8,_0x5d0e63){return db['sequelize'][_0x523e('0x39')](function(_0x517604){return db[_0x523e('0x3a')][_0x523e('0x24')](_0x48b32b[_0x523e('0x25')],{'raw':_0x48b32b[_0x523e('0x19')]?_0x48b32b[_0x523e('0x19')][_0x523e('0x18')]===undefined?!![]:![]:!![],'transaction':_0x517604})['then'](function(){return db[_0x523e('0x17')]['destroy']({'where':_0x48b32b['options']?_0x48b32b[_0x523e('0x19')]['where']||null:null,'transaction':_0x517604});});})['then'](function(_0x1b92b4){logger['info']('MoveContactManagedDialer',_0x48b32b);logger[_0x523e('0xd')](_0x523e('0x38'),_0x48b32b,JSON['stringify'](_0x1b92b4));_0x3abba8(_0x1b92b4);})[_0x523e('0x15')](function(_0x147238){logger[_0x523e('0x10')](_0x523e('0x38'),_0x147238['message'],_0x48b32b);_0x5d0e63(_0x331208[_0x523e('0x10')](0x1f4,_0x147238[_0x523e('0x12')]));});});};exports[_0x523e('0x3b')]=function(_0x7cf262){var _0xbc9241=this;return new Promise(function(_0x254c0b,_0x33fd7c){return db[_0x523e('0x17')][_0x523e('0x2c')]({'raw':_0x7cf262[_0x523e('0x19')]?_0x7cf262[_0x523e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x7cf262[_0x523e('0x19')]?_0x7cf262['options'][_0x523e('0x1a')]||null:null,'attributes':[[db[_0x523e('0x3c')]['fn']('COUNT',db[_0x523e('0x3c')]['fn']('IF',db['sequelize'][_0x523e('0x3d')](_0x523e('0x3e')+util[_0x523e('0x3f')](_0x523e('0x40'),moment()['format'](_0x523e('0x41')))+_0x523e('0x42')))),_0x523e('0x43')]]})[_0x523e('0xb')](function(_0x3359b4){logger[_0x523e('0x13')](_0x523e('0x3b'),_0x7cf262);logger[_0x523e('0xd')](_0x523e('0x3b'),_0x7cf262,JSON['stringify'](_0x3359b4));_0x254c0b(_0x3359b4);})[_0x523e('0x15')](function(_0x4b1d82){logger[_0x523e('0x10')](_0x523e('0x3b'),_0x4b1d82['message'],_0x7cf262);_0x33fd7c(_0xbc9241[_0x523e('0x10')](0x1f4,_0x4b1d82[_0x523e('0x12')]));});});};exports[_0x523e('0x44')]=function(_0xa00fd9){var _0x226670=this;return new Promise(function(_0x4f0ec7,_0x5c0b53){return db['CmContact'][_0x523e('0x2b')]()[_0x523e('0xb')](function(_0x5a7d27){return db['sequelize']['transaction'](function(_0x40281f){return db['CmHopper'][_0x523e('0x2c')]({'where':_0xa00fd9[_0x523e('0x19')]?_0xa00fd9[_0x523e('0x19')]['where']||null:null,'attributes':_0xa00fd9[_0x523e('0x19')]?_0xa00fd9[_0x523e('0x19')][_0x523e('0x1b')]||null:null,'limit':0x1,'order':_0xa00fd9[_0x523e('0x19')]?_0xa00fd9[_0x523e('0x19')]['order']||null:null,'group':db[_0x523e('0x17')][_0x523e('0x36')],'transaction':_0x40281f,'lock':_0x40281f['LOCK']['UPDATE'],'include':_0xa00fd9[_0x523e('0x19')]?_0xa00fd9[_0x523e('0x19')][_0x523e('0x1d')]?_[_0x523e('0x1e')](_0xa00fd9[_0x523e('0x19')][_0x523e('0x1d')],function(_0x4c6a66){return{'model':db[_0x4c6a66[_0x523e('0x1f')]],'as':_0x4c6a66['as'],'attributes':_0x4c6a66['attributes'],'include':_0x4c6a66[_0x523e('0x1d')]?_[_0x523e('0x1e')](_0x4c6a66[_0x523e('0x1d')],function(_0x341be5){return{'model':db[_0x341be5[_0x523e('0x1f')]],'as':_0x341be5['as'],'attributes':_0x341be5[_0x523e('0x1b')],'include':_0x341be5[_0x523e('0x1d')]?_[_0x523e('0x1e')](_0x341be5[_0x523e('0x1d')],function(_0x36f75a){return{'model':db[_0x36f75a[_0x523e('0x1f')]],'as':_0x36f75a['as'],'attributes':_0x36f75a[_0x523e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22e498){var _0x900b7e=[];for(var _0x6656a9=0x0;_0x6656a9<_0x22e498[_0x523e('0x45')];_0x6656a9+=0x1){_0x900b7e[_0x523e('0x46')](_0x22e498[_0x6656a9][_0x523e('0x37')](_0xa00fd9[_0x523e('0x25')],{'transaction':_0x40281f}));}return BPromise[_0x523e('0x47')](_0x900b7e);});})[_0x523e('0xb')](function(_0x511c9b){logger[_0x523e('0x13')]('GetContactRecallMe',_0xa00fd9);logger[_0x523e('0xd')](_0x523e('0x44'),_0xa00fd9,JSON['stringify'](_0x511c9b));_0x4f0ec7(_0x511c9b);})[_0x523e('0x15')](function(_0x25d139){logger[_0x523e('0x10')](_0x523e('0x44'),_0x25d139[_0x523e('0x12')],_0xa00fd9);_0x5c0b53(_0x226670[_0x523e('0x10')](0x1f4,_0x25d139[_0x523e('0x12')]));});});});};exports[_0x523e('0x48')]=function(_0xbb0d8c){var _0x414c52=this;return new Promise(function(_0x5b4b66,_0x48b93b){db[_0x523e('0x2a')][_0x523e('0x2b')]()[_0x523e('0xb')](function(_0x8fa08e){return db[_0x523e('0x17')]['findAll']({'raw':_0xbb0d8c[_0x523e('0x19')]?_0xbb0d8c[_0x523e('0x19')][_0x523e('0x18')]===undefined?!![]:![]:!![],'where':_0xbb0d8c[_0x523e('0x19')]?_0xbb0d8c[_0x523e('0x19')][_0x523e('0x1a')]||null:null,'attributes':_0xbb0d8c['options']?_0xbb0d8c['options'][_0x523e('0x1b')]||null:null,'limit':_0xbb0d8c[_0x523e('0x19')]?_0xbb0d8c['options'][_0x523e('0x1c')]||null:null,'include':_0xbb0d8c['options']?_0xbb0d8c[_0x523e('0x19')][_0x523e('0x1d')]?_[_0x523e('0x1e')](_0xbb0d8c['options'][_0x523e('0x1d')],function(_0x20ecef){return{'model':db[_0x20ecef[_0x523e('0x1f')]],'as':_0x20ecef['as'],'attributes':_0x20ecef['as']==='Contact'?_[_0x523e('0x30')](_0x8fa08e):_0x20ecef[_0x523e('0x1b')],'include':_0x20ecef[_0x523e('0x1d')]?_['map'](_0x20ecef[_0x523e('0x1d')],function(_0x4d4b2b){return{'model':db[_0x4d4b2b['model']],'as':_0x4d4b2b['as'],'attributes':_0x4d4b2b['attributes'],'include':_0x4d4b2b[_0x523e('0x1d')]?_[_0x523e('0x1e')](_0x4d4b2b[_0x523e('0x1d')],function(_0x16d26f){return{'model':db[_0x16d26f[_0x523e('0x1f')]],'as':_0x16d26f['as'],'attributes':_0x16d26f[_0x523e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x523e('0xb')](function(_0x2659f9){logger[_0x523e('0x13')](_0x523e('0x16'),_0xbb0d8c);logger['debug'](_0x523e('0x16'),_0xbb0d8c,JSON[_0x523e('0x20')](_0x2659f9));_0x5b4b66(_0x2659f9);})[_0x523e('0x15')](function(_0xb300c6){logger[_0x523e('0x10')]('GetCmHopper',_0xb300c6[_0x523e('0x12')],_0xbb0d8c);_0x48b93b(_0x414c52[_0x523e('0x10')](0x1f4,_0xb300c6[_0x523e('0x12')]));});});});}; \ No newline at end of file +var _0x3612=['attributes','limit','include','map','model','ShowCmHopper','find','catch','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','sequelize','LOCK','UPDATE','Contact','User','Agent','name','length','UserId','push','GetContactDialer','MoveContactManagedDialer','transaction','CmHopperFinal','COUNT','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','all','GetCmHopperPreview','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetCmHopper','CmHopper','findAll','options','raw','where'];(function(_0x49b1b2,_0x489a99){var _0x485956=function(_0xaaa560){while(--_0xaaa560){_0x49b1b2['push'](_0x49b1b2['shift']());}};_0x485956(++_0x489a99);}(_0x3612,0xeb));var _0x2361=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0x3612[_0x169a8a];return _0x2e8502;};'use strict';var _=require(_0x2361('0x0'));var util=require('util');var moment=require(_0x2361('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2361('0x2'));var db=require(_0x2361('0x3'))['db'];var utils=require(_0x2361('0x4'));var logger=require(_0x2361('0x5'))(_0x2361('0x6'));var config=require(_0x2361('0x7'));var jayson=require(_0x2361('0x8'));var client=jayson['client'][_0x2361('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1182e1,_0x5c476c,_0x5877c5){return new BPromise(function(_0x3383f0,_0x270da){return client[_0x2361('0xa')](_0x1182e1,_0x5877c5)[_0x2361('0xb')](function(_0x132a11){logger[_0x2361('0xc')](_0x2361('0xd'),_0x5c476c,_0x2361('0xe'));logger[_0x2361('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x5c476c,_0x2361('0xe'),JSON[_0x2361('0x10')](_0x132a11));if(_0x132a11[_0x2361('0x11')]){if(_0x132a11['error']['code']===0x1f4){logger['error'](_0x2361('0xd'),_0x5c476c,_0x132a11[_0x2361('0x11')][_0x2361('0x12')]);return _0x270da(_0x132a11['error']['message']);}logger[_0x2361('0x11')](_0x2361('0xd'),_0x5c476c,_0x132a11[_0x2361('0x11')][_0x2361('0x12')]);return _0x3383f0(_0x132a11[_0x2361('0x11')][_0x2361('0x12')]);}else{logger[_0x2361('0xc')](_0x2361('0xd'),_0x5c476c,_0x2361('0xe'));_0x3383f0(_0x132a11['result']['message']);}})['catch'](function(_0x260af8){logger[_0x2361('0x11')](_0x2361('0xd'),_0x5c476c,_0x260af8);_0x270da(_0x260af8);});});}exports[_0x2361('0x13')]=function(_0x41d26c){var _0x2a716e=this;return new Promise(function(_0x38062d,_0x3e9cfa){return db[_0x2361('0x14')][_0x2361('0x15')]({'raw':_0x41d26c['options']?_0x41d26c[_0x2361('0x16')][_0x2361('0x17')]===undefined?!![]:![]:!![],'where':_0x41d26c[_0x2361('0x16')]?_0x41d26c[_0x2361('0x16')][_0x2361('0x18')]||null:null,'attributes':_0x41d26c[_0x2361('0x16')]?_0x41d26c['options'][_0x2361('0x19')]||null:null,'limit':_0x41d26c[_0x2361('0x16')]?_0x41d26c[_0x2361('0x16')][_0x2361('0x1a')]||null:null,'include':_0x41d26c[_0x2361('0x16')]?_0x41d26c['options'][_0x2361('0x1b')]?_[_0x2361('0x1c')](_0x41d26c[_0x2361('0x16')][_0x2361('0x1b')],function(_0x72eac9){return{'model':db[_0x72eac9[_0x2361('0x1d')]],'as':_0x72eac9['as'],'attributes':_0x72eac9['attributes'],'include':_0x72eac9['include']?_['map'](_0x72eac9[_0x2361('0x1b')],function(_0x2fce77){return{'model':db[_0x2fce77[_0x2361('0x1d')]],'as':_0x2fce77['as'],'attributes':_0x2fce77[_0x2361('0x19')],'include':_0x2fce77[_0x2361('0x1b')]?_[_0x2361('0x1c')](_0x2fce77[_0x2361('0x1b')],function(_0x4b99b9){return{'model':db[_0x4b99b9[_0x2361('0x1d')]],'as':_0x4b99b9['as'],'attributes':_0x4b99b9[_0x2361('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2361('0xb')](function(_0x946a07){logger[_0x2361('0xc')]('GetCmHopper',_0x41d26c);logger[_0x2361('0xf')](_0x2361('0x13'),_0x41d26c,JSON[_0x2361('0x10')](_0x946a07));_0x38062d(_0x946a07);})['catch'](function(_0xaa7f71){logger[_0x2361('0x11')](_0x2361('0x13'),_0xaa7f71[_0x2361('0x12')],_0x41d26c);_0x3e9cfa(_0x2a716e[_0x2361('0x11')](0x1f4,_0xaa7f71[_0x2361('0x12')]));});});};exports[_0x2361('0x1e')]=function(_0xeb2b3){var _0x4d34d9=this;return new Promise(function(_0x3cdce8,_0x403b39){return db[_0x2361('0x14')][_0x2361('0x1f')]({'raw':_0xeb2b3[_0x2361('0x16')]?_0xeb2b3[_0x2361('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xeb2b3[_0x2361('0x16')]?_0xeb2b3[_0x2361('0x16')][_0x2361('0x18')]||null:null,'attributes':_0xeb2b3['options']?_0xeb2b3[_0x2361('0x16')][_0x2361('0x19')]||null:null,'include':_0xeb2b3[_0x2361('0x16')]?_0xeb2b3[_0x2361('0x16')][_0x2361('0x1b')]?_[_0x2361('0x1c')](_0xeb2b3[_0x2361('0x16')][_0x2361('0x1b')],function(_0x35252d){return{'model':db[_0x35252d[_0x2361('0x1d')]],'as':_0x35252d['as'],'attributes':_0x35252d['attributes'],'include':_0x35252d[_0x2361('0x1b')]?_[_0x2361('0x1c')](_0x35252d[_0x2361('0x1b')],function(_0x56f1dd){return{'model':db[_0x56f1dd[_0x2361('0x1d')]],'as':_0x56f1dd['as'],'attributes':_0x56f1dd['attributes'],'include':_0x56f1dd['include']?_[_0x2361('0x1c')](_0x56f1dd[_0x2361('0x1b')],function(_0x236a3b){return{'model':db[_0x236a3b['model']],'as':_0x236a3b['as'],'attributes':_0x236a3b[_0x2361('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2361('0xb')](function(_0x45a56d){logger[_0x2361('0xc')](_0x2361('0x1e'),_0xeb2b3);logger[_0x2361('0xf')](_0x2361('0x1e'),_0xeb2b3,JSON[_0x2361('0x10')](_0x45a56d));_0x3cdce8(_0x45a56d);})[_0x2361('0x20')](function(_0x3593fa){logger[_0x2361('0x11')]('ShowCmHopper',_0x3593fa['message'],_0xeb2b3);_0x403b39(_0x4d34d9[_0x2361('0x11')](0x1f4,_0x3593fa['message']));});});};exports[_0x2361('0x21')]=function(_0xc024a0){var _0x47ddd2=this;return new Promise(function(_0x12b6da,_0x188719){return db[_0x2361('0x14')][_0x2361('0x22')](_0xc024a0[_0x2361('0x23')],{'raw':_0xc024a0['options']?_0xc024a0[_0x2361('0x16')][_0x2361('0x17')]===undefined?!![]:![]:!![]})[_0x2361('0xb')](function(_0x479cd8){logger[_0x2361('0xc')]('CreateCmHopper',_0xc024a0);logger[_0x2361('0xf')]('CreateCmHopper',_0xc024a0,JSON[_0x2361('0x10')](_0x479cd8));_0x12b6da(_0x479cd8);})[_0x2361('0x20')](function(_0x29b769){logger[_0x2361('0x11')](_0x2361('0x21'),_0x29b769['message'],_0xc024a0);_0x188719(_0x47ddd2[_0x2361('0x11')](0x1f4,_0x29b769[_0x2361('0x12')]));});});};exports[_0x2361('0x24')]=function(_0x212b2b){var _0x49d551=this;return new Promise(function(_0x3c70ba,_0x2790a6){return db['CmHopper'][_0x2361('0x25')](_0x212b2b[_0x2361('0x23')],{'raw':_0x212b2b[_0x2361('0x16')]?_0x212b2b['options'][_0x2361('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x212b2b[_0x2361('0x16')]?_0x212b2b[_0x2361('0x16')]['where']||null:null,'attributes':_0x212b2b[_0x2361('0x16')]?_0x212b2b[_0x2361('0x16')][_0x2361('0x19')]||null:null,'limit':_0x212b2b[_0x2361('0x16')]?_0x212b2b[_0x2361('0x16')][_0x2361('0x1a')]||null:null})['then'](function(_0x50fc0a){logger['info'](_0x2361('0x24'),_0x212b2b);logger['debug'](_0x2361('0x24'),_0x212b2b,JSON['stringify'](_0x50fc0a));_0x3c70ba(_0x50fc0a);})[_0x2361('0x20')](function(_0x2f28d8){logger[_0x2361('0x11')](_0x2361('0x24'),_0x2f28d8[_0x2361('0x12')],_0x212b2b);_0x2790a6(_0x49d551[_0x2361('0x11')](0x1f4,_0x2f28d8[_0x2361('0x12')]));});});};exports[_0x2361('0x26')]=function(_0x3c1ca){var _0x17a2f1=this;return new Promise(function(_0x2656e1,_0x181371){return db[_0x2361('0x14')][_0x2361('0x27')]({'where':_0x3c1ca[_0x2361('0x16')]?_0x3c1ca['options'][_0x2361('0x18')]||null:null})[_0x2361('0xb')](function(_0x7fe7){logger['info'](_0x2361('0x26'),_0x3c1ca);logger[_0x2361('0xf')](_0x2361('0x26'),_0x3c1ca,JSON[_0x2361('0x10')](_0x7fe7));_0x2656e1(_0x7fe7);})['catch'](function(_0x201656){logger['error'](_0x2361('0x26'),_0x201656[_0x2361('0x12')],_0x3c1ca);_0x181371(_0x17a2f1[_0x2361('0x11')](0x1f4,_0x201656['message']));});});};exports['GetContactDialer']=function(_0xcf781){var _0x2b0699=this;return new Promise(function(_0x152c7e,_0x28ca90){return db[_0x2361('0x28')][_0x2361('0x29')]()[_0x2361('0xb')](function(_0x29ab04){return db[_0x2361('0x2a')]['transaction'](function(_0x1c114a){return db[_0x2361('0x14')]['findAll']({'where':_0xcf781[_0x2361('0x16')]?_0xcf781[_0x2361('0x16')][_0x2361('0x18')]||null:null,'attributes':_0xcf781[_0x2361('0x16')]?_0xcf781['options'][_0x2361('0x19')]||null:null,'limit':_0xcf781['options']?_0xcf781[_0x2361('0x16')]['limit']||null:null,'order':_0xcf781['options']?_0xcf781['options']['order']||null:null,'transaction':_0x1c114a,'lock':_0x1c114a[_0x2361('0x2b')][_0x2361('0x2c')],'include':[{'model':db[_0x2361('0x28')],'as':_0x2361('0x2d'),'attributes':_['keys'](_0x29ab04)},{'model':db[_0x2361('0x2e')],'as':_0x2361('0x2f'),'attributes':['id',_0x2361('0x30'),'voicePause']}]})[_0x2361('0xb')](function(_0x10c59b){var _0x14a127=[];var _0x1663ec=[];for(var _0x2e69cc=0x0;_0x2e69cc<_0x10c59b[_0x2361('0x31')];_0x2e69cc+=0x1){if(!_0x1663ec['includes'](_0x10c59b[_0x2e69cc][_0x2361('0x32')])){_0x1663ec['push'](_0x10c59b[_0x2e69cc]['UserId']);_0x14a127[_0x2361('0x33')](_0x10c59b[_0x2e69cc][_0x2361('0x25')](_0xcf781[_0x2361('0x23')],{'transaction':_0x1c114a}));}}return BPromise['all'](_0x14a127);});})[_0x2361('0xb')](function(_0x3fa9e0){logger[_0x2361('0xc')]('GetContactDialer',_0xcf781);logger[_0x2361('0xf')](_0x2361('0x34'),_0xcf781,JSON[_0x2361('0x10')](_0x3fa9e0));_0x152c7e(_0x3fa9e0);})[_0x2361('0x20')](function(_0x494365){logger['error'](_0x2361('0x34'),_0x494365[_0x2361('0x12')],_0xcf781);_0x28ca90(_0x2b0699['error'](0x1f4,_0x494365[_0x2361('0x12')]));});});});};exports[_0x2361('0x35')]=function(_0x2465fd){var _0x189ab0=this;return new Promise(function(_0x3a6c3f,_0x5e11e2){return db[_0x2361('0x2a')][_0x2361('0x36')](function(_0x8aa55f){return db[_0x2361('0x37')]['create'](_0x2465fd[_0x2361('0x23')],{'raw':_0x2465fd[_0x2361('0x16')]?_0x2465fd[_0x2361('0x16')][_0x2361('0x17')]===undefined?!![]:![]:!![],'transaction':_0x8aa55f})[_0x2361('0xb')](function(){return db['CmHopper'][_0x2361('0x27')]({'where':_0x2465fd[_0x2361('0x16')]?_0x2465fd[_0x2361('0x16')]['where']||null:null,'transaction':_0x8aa55f});});})[_0x2361('0xb')](function(_0x1108e9){logger[_0x2361('0xc')](_0x2361('0x35'),_0x2465fd);logger[_0x2361('0xf')](_0x2361('0x35'),_0x2465fd,JSON[_0x2361('0x10')](_0x1108e9));_0x3a6c3f(_0x1108e9);})[_0x2361('0x20')](function(_0xd5274d){logger['error'](_0x2361('0x35'),_0xd5274d[_0x2361('0x12')],_0x2465fd);_0x5e11e2(_0x189ab0[_0x2361('0x11')](0x1f4,_0xd5274d[_0x2361('0x12')]));});});};exports['CountReScheduled']=function(_0x7fafdb){var _0x1c3645=this;return new Promise(function(_0x46ec1c,_0x2c558f){return db[_0x2361('0x14')][_0x2361('0x15')]({'raw':_0x7fafdb[_0x2361('0x16')]?_0x7fafdb[_0x2361('0x16')][_0x2361('0x17')]===undefined?!![]:![]:!![],'where':_0x7fafdb['options']?_0x7fafdb['options']['where']||null:null,'attributes':[[db[_0x2361('0x2a')]['fn'](_0x2361('0x38'),db[_0x2361('0x2a')]['fn']('IF',db[_0x2361('0x2a')]['literal'](_0x2361('0x39')+util[_0x2361('0x3a')]('\x22%s\x22',moment()[_0x2361('0x3a')](_0x2361('0x3b')))+_0x2361('0x3c')))),'contactsRescheduled']]})['then'](function(_0x2a65de){logger[_0x2361('0xc')](_0x2361('0x3d'),_0x7fafdb);logger[_0x2361('0xf')](_0x2361('0x3d'),_0x7fafdb,JSON['stringify'](_0x2a65de));_0x46ec1c(_0x2a65de);})[_0x2361('0x20')](function(_0x8259b8){logger[_0x2361('0x11')]('CountReScheduled',_0x8259b8[_0x2361('0x12')],_0x7fafdb);_0x2c558f(_0x1c3645[_0x2361('0x11')](0x1f4,_0x8259b8[_0x2361('0x12')]));});});};exports[_0x2361('0x3e')]=function(_0x58498e){var _0x3e658c=this;return new Promise(function(_0xf1e5c2,_0x38c2ea){return db[_0x2361('0x28')][_0x2361('0x29')]()[_0x2361('0xb')](function(_0x5bb0a5){return db[_0x2361('0x2a')]['transaction'](function(_0x2892a9){return db[_0x2361('0x14')][_0x2361('0x15')]({'where':_0x58498e[_0x2361('0x16')]?_0x58498e[_0x2361('0x16')][_0x2361('0x18')]||null:null,'attributes':_0x58498e[_0x2361('0x16')]?_0x58498e[_0x2361('0x16')][_0x2361('0x19')]||null:null,'limit':0x1,'order':_0x58498e[_0x2361('0x16')]?_0x58498e[_0x2361('0x16')]['order']||null:null,'group':db[_0x2361('0x14')][_0x2361('0x32')],'transaction':_0x2892a9,'lock':_0x2892a9[_0x2361('0x2b')]['UPDATE'],'include':_0x58498e['options']?_0x58498e[_0x2361('0x16')][_0x2361('0x1b')]?_[_0x2361('0x1c')](_0x58498e[_0x2361('0x16')][_0x2361('0x1b')],function(_0x348715){return{'model':db[_0x348715[_0x2361('0x1d')]],'as':_0x348715['as'],'attributes':_0x348715[_0x2361('0x19')],'include':_0x348715[_0x2361('0x1b')]?_['map'](_0x348715[_0x2361('0x1b')],function(_0x17b2f6){return{'model':db[_0x17b2f6[_0x2361('0x1d')]],'as':_0x17b2f6['as'],'attributes':_0x17b2f6[_0x2361('0x19')],'include':_0x17b2f6['include']?_['map'](_0x17b2f6['include'],function(_0x208b65){return{'model':db[_0x208b65[_0x2361('0x1d')]],'as':_0x208b65['as'],'attributes':_0x208b65[_0x2361('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27fc58){var _0x4e5437=[];for(var _0x27cf0b=0x0;_0x27cf0b<_0x27fc58['length'];_0x27cf0b+=0x1){_0x4e5437[_0x2361('0x33')](_0x27fc58[_0x27cf0b]['update'](_0x58498e['body'],{'transaction':_0x2892a9}));}return BPromise[_0x2361('0x3f')](_0x4e5437);});})['then'](function(_0x4128ce){logger['info'](_0x2361('0x3e'),_0x58498e);logger[_0x2361('0xf')](_0x2361('0x3e'),_0x58498e,JSON[_0x2361('0x10')](_0x4128ce));_0xf1e5c2(_0x4128ce);})[_0x2361('0x20')](function(_0x2e3d2b){logger[_0x2361('0x11')](_0x2361('0x3e'),_0x2e3d2b[_0x2361('0x12')],_0x58498e);_0x38c2ea(_0x3e658c[_0x2361('0x11')](0x1f4,_0x2e3d2b['message']));});});});};exports[_0x2361('0x40')]=function(_0x4bc6c3){var _0x14cf2=this;return new Promise(function(_0x529415,_0x32a2a0){db['CmContact'][_0x2361('0x29')]()[_0x2361('0xb')](function(_0x30e769){return db[_0x2361('0x14')][_0x2361('0x15')]({'raw':_0x4bc6c3[_0x2361('0x16')]?_0x4bc6c3[_0x2361('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4bc6c3[_0x2361('0x16')]?_0x4bc6c3[_0x2361('0x16')]['where']||null:null,'attributes':_0x4bc6c3[_0x2361('0x16')]?_0x4bc6c3[_0x2361('0x16')][_0x2361('0x19')]||null:null,'limit':_0x4bc6c3[_0x2361('0x16')]?_0x4bc6c3[_0x2361('0x16')][_0x2361('0x1a')]||null:null,'include':_0x4bc6c3[_0x2361('0x16')]?_0x4bc6c3[_0x2361('0x16')]['include']?_[_0x2361('0x1c')](_0x4bc6c3[_0x2361('0x16')][_0x2361('0x1b')],function(_0x28e0aa){return{'model':db[_0x28e0aa[_0x2361('0x1d')]],'as':_0x28e0aa['as'],'attributes':_0x28e0aa['as']==='Contact'?_['keys'](_0x30e769):_0x28e0aa[_0x2361('0x19')],'include':_0x28e0aa['include']?_[_0x2361('0x1c')](_0x28e0aa[_0x2361('0x1b')],function(_0x3f06ca){return{'model':db[_0x3f06ca['model']],'as':_0x3f06ca['as'],'attributes':_0x3f06ca[_0x2361('0x19')],'include':_0x3f06ca['include']?_[_0x2361('0x1c')](_0x3f06ca[_0x2361('0x1b')],function(_0x8489fd){return{'model':db[_0x8489fd['model']],'as':_0x8489fd['as'],'attributes':_0x8489fd[_0x2361('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2361('0xb')](function(_0x5b30c7){logger['info']('GetCmHopper',_0x4bc6c3);logger[_0x2361('0xf')]('GetCmHopper',_0x4bc6c3,JSON['stringify'](_0x5b30c7));_0x529415(_0x5b30c7);})[_0x2361('0x20')](function(_0x41e3c9){logger[_0x2361('0x11')](_0x2361('0x13'),_0x41e3c9[_0x2361('0x12')],_0x4bc6c3);_0x32a2a0(_0x14cf2[_0x2361('0x11')](0x1f4,_0x41e3c9['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 3475a41..888aee9 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 _0xbff2=['getPreview','update','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/opencontacts','post','create'];(function(_0x1e2eac,_0x26dddf){var _0x7a4e81=function(_0x341ed5){while(--_0x341ed5){_0x1e2eac['push'](_0x1e2eac['shift']());}};_0x7a4e81(++_0x26dddf);}(_0xbff2,0x10e));var _0x2bff=function(_0xf56eb9,_0x51d1eb){_0xf56eb9=_0xf56eb9-0x0;var _0x6fcbef=_0xbff2[_0xf56eb9];return _0x6fcbef;};'use strict';var multer=require(_0x2bff('0x0'));var util=require(_0x2bff('0x1'));var path=require(_0x2bff('0x2'));var timeout=require(_0x2bff('0x3'));var express=require(_0x2bff('0x4'));var router=express[_0x2bff('0x5')]();var auth=require(_0x2bff('0x6'));var interaction=require(_0x2bff('0x7'));var config=require(_0x2bff('0x8'));var controller=require('./cmHopper.controller');router[_0x2bff('0x9')]('/',auth[_0x2bff('0xa')](),controller['index']);router['get']('/describe',auth[_0x2bff('0xa')](),controller[_0x2bff('0xb')]);router['get'](_0x2bff('0xc'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x2bff('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2bff('0xd')]('/',auth['isAuthenticated'](),controller[_0x2bff('0xe')]);router[_0x2bff('0xd')]('/preview',auth[_0x2bff('0xa')](),controller[_0x2bff('0xf')]);router['put']('/:id',auth[_0x2bff('0xa')](),controller[_0x2bff('0x10')]);router['delete'](_0x2bff('0x11'),auth[_0x2bff('0xa')](),controller['destroy']);module[_0x2bff('0x12')]=router; \ No newline at end of file +var _0xde1a=['/describe','/opencontacts','getOpenContacts','/:id','show','create','/preview','getPreview','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xbfcc4c,_0x757758){var _0x20b1c8=function(_0x2dd340){while(--_0x2dd340){_0xbfcc4c['push'](_0xbfcc4c['shift']());}};_0x20b1c8(++_0x757758);}(_0xde1a,0xfd));var _0xade1=function(_0x3b3797,_0x5ec5c1){_0x3b3797=_0x3b3797-0x0;var _0x4a699a=_0xde1a[_0x3b3797];return _0x4a699a;};'use strict';var multer=require('multer');var util=require(_0xade1('0x0'));var path=require(_0xade1('0x1'));var timeout=require(_0xade1('0x2'));var express=require(_0xade1('0x3'));var router=express[_0xade1('0x4')]();var auth=require(_0xade1('0x5'));var interaction=require(_0xade1('0x6'));var config=require(_0xade1('0x7'));var controller=require('./cmHopper.controller');router[_0xade1('0x8')]('/',auth[_0xade1('0x9')](),controller[_0xade1('0xa')]);router[_0xade1('0x8')](_0xade1('0xb'),auth[_0xade1('0x9')](),controller['describe']);router[_0xade1('0x8')](_0xade1('0xc'),auth[_0xade1('0x9')](),controller[_0xade1('0xd')]);router[_0xade1('0x8')](_0xade1('0xe'),auth[_0xade1('0x9')](),controller[_0xade1('0xf')]);router['post']('/',auth[_0xade1('0x9')](),controller[_0xade1('0x10')]);router['post'](_0xade1('0x11'),auth[_0xade1('0x9')](),controller[_0xade1('0x12')]);router['put'](_0xade1('0xe'),auth[_0xade1('0x9')](),controller[_0xade1('0x13')]);router[_0xade1('0x14')](_0xade1('0xe'),auth[_0xade1('0x9')](),controller['destroy']);module[_0xade1('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3934c7c..e3cf4d5 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 _0xaec8=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xaec8,0xe8));var _0x8aec=function(_0x32c8ef,_0x1e182c){_0x32c8ef=_0x32c8ef-0x0;var _0x6fcfcd=_0xaec8[_0x32c8ef];return _0x6fcfcd;};'use strict';var moment=require(_0x8aec('0x0'));var Sequelize=require(_0x8aec('0x1'));module[_0x8aec('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8aec('0x3')],'unique':_0x8aec('0x4')},'ListId':{'type':Sequelize[_0x8aec('0x3')],'unique':_0x8aec('0x4')},'VoiceQueueId':{'type':Sequelize[_0x8aec('0x3')],'unique':_0x8aec('0x4')}}; \ No newline at end of file +var _0xf390=['contactListQueue','INTEGER','moment','sequelize','exports','STRING'];(function(_0x503848,_0x31bcc4){var _0xe0ef09=function(_0x461582){while(--_0x461582){_0x503848['push'](_0x503848['shift']());}};_0xe0ef09(++_0x31bcc4);}(_0xf390,0x7a));var _0x0f39=function(_0x36352f,_0x3563dc){_0x36352f=_0x36352f-0x0;var _0x4adf91=_0xf390[_0x36352f];return _0x4adf91;};'use strict';var moment=require(_0x0f39('0x0'));var Sequelize=require(_0x0f39('0x1'));module[_0x0f39('0x2')]={'phone':{'type':Sequelize[_0x0f39('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x0f39('0x4')},'ListId':{'type':Sequelize[_0x0f39('0x5')],'unique':_0x0f39('0x4')},'VoiceQueueId':{'type':Sequelize[_0x0f39('0x5')],'unique':_0x0f39('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 66d347c..54e157f 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x172e18,_0xf13d53){var _0x4f02f1=function(_0x23e321){while(--_0x23e321){_0x172e18['push'](_0x172e18['shift']());}};_0x4f02f1(++_0xf13d53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x2a2922,_0x3a0435){var _0x3202db=function(_0x9fe14f){while(--_0x9fe14f){_0x2a2922['push'](_0x2a2922['shift']());}};_0x3202db(++_0x3a0435);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 851c9d9..df2843a 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 _0xf9a0=['exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x57c95a,_0x48165a){var _0xa03e38=function(_0x4e6892){while(--_0x4e6892){_0x57c95a['push'](_0x57c95a['shift']());}};_0xa03e38(++_0x48165a);}(_0xf9a0,0xe0));var _0x0f9a=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0xf9a0[_0x553150];return _0x18193d;};'use strict';var _=require('lodash');var util=require(_0x0f9a('0x0'));var logger=require(_0x0f9a('0x1'))(_0x0f9a('0x2'));var moment=require('moment');var BPromise=require(_0x0f9a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f9a('0x4'));var config=require(_0x0f9a('0x5'));var attributes=require(_0x0f9a('0x6'));module[_0x0f9a('0x7')]=function(_0x3284f5,_0x32be13){return _0x3284f5[_0x0f9a('0x8')](_0x0f9a('0x9'),attributes,{'tableName':_0x0f9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bb7=['define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports'];(function(_0x4bdfbe,_0x37b536){var _0xa8413=function(_0xb8b55c){while(--_0xb8b55c){_0x4bdfbe['push'](_0x4bdfbe['shift']());}};_0xa8413(++_0x37b536);}(_0x9bb7,0x6f));var _0x79bb=function(_0xf66a25,_0x527689){_0xf66a25=_0xf66a25-0x0;var _0x231422=_0x9bb7[_0xf66a25];return _0x231422;};'use strict';var _=require(_0x79bb('0x0'));var util=require(_0x79bb('0x1'));var logger=require(_0x79bb('0x2'))(_0x79bb('0x3'));var moment=require('moment');var BPromise=require(_0x79bb('0x4'));var rp=require(_0x79bb('0x5'));var fs=require('fs');var path=require(_0x79bb('0x6'));var rimraf=require(_0x79bb('0x7'));var config=require('../../config/environment');var attributes=require(_0x79bb('0x8'));module[_0x79bb('0x9')]=function(_0x131fe1,_0x5d6194){return _0x131fe1[_0x79bb('0xa')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 01c26d4..855d8de 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 _0xd446=['info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','update','DestroyCmHopperBlack','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xe43cac,_0x448245){var _0x307f16=function(_0x12475a){while(--_0x12475a){_0xe43cac['push'](_0xe43cac['shift']());}};_0x307f16(++_0x448245);}(_0xd446,0x122));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6d44('0x0'));var util=require(_0x6d44('0x1'));var moment=require(_0x6d44('0x2'));var BPromise=require(_0x6d44('0x3'));var rs=require(_0x6d44('0x4'));var fs=require('fs');var Redis=require(_0x6d44('0x5'));var db=require(_0x6d44('0x6'))['db'];var utils=require(_0x6d44('0x7'));var logger=require(_0x6d44('0x8'))(_0x6d44('0x9'));var config=require(_0x6d44('0xa'));var jayson=require(_0x6d44('0xb'));var client=jayson['client'][_0x6d44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x301881,_0xff0568,_0x4acaff){return new BPromise(function(_0x5ea50a,_0x45bc7d){return client[_0x6d44('0xd')](_0x301881,_0x4acaff)[_0x6d44('0xe')](function(_0x1b7015){logger['info'](_0x6d44('0xf'),_0xff0568,_0x6d44('0x10'));logger[_0x6d44('0x11')](_0x6d44('0x12'),_0xff0568,_0x6d44('0x10'),JSON[_0x6d44('0x13')](_0x1b7015));if(_0x1b7015[_0x6d44('0x14')]){if(_0x1b7015['error']['code']===0x1f4){logger[_0x6d44('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0xff0568,_0x1b7015[_0x6d44('0x14')][_0x6d44('0x15')]);return _0x45bc7d(_0x1b7015[_0x6d44('0x14')][_0x6d44('0x15')]);}logger[_0x6d44('0x14')](_0x6d44('0xf'),_0xff0568,_0x1b7015[_0x6d44('0x14')]['message']);return _0x5ea50a(_0x1b7015['error'][_0x6d44('0x15')]);}else{logger[_0x6d44('0x16')]('CmHopperBlack,\x20%s,\x20%s',_0xff0568,_0x6d44('0x10'));_0x5ea50a(_0x1b7015[_0x6d44('0x17')][_0x6d44('0x15')]);}})[_0x6d44('0x18')](function(_0x3534f3){logger['error'](_0x6d44('0xf'),_0xff0568,_0x3534f3);_0x45bc7d(_0x3534f3);});});}exports[_0x6d44('0x19')]=function(_0x200924){var _0x23e489=this;return new Promise(function(_0x3d5761,_0x3b075c){return db[_0x6d44('0x1a')][_0x6d44('0x1b')]({'raw':_0x200924[_0x6d44('0x1c')]?_0x200924[_0x6d44('0x1c')][_0x6d44('0x1d')]===undefined?!![]:![]:!![],'where':_0x200924[_0x6d44('0x1c')]?_0x200924[_0x6d44('0x1c')]['where']||null:null,'attributes':_0x200924['options']?_0x200924[_0x6d44('0x1c')][_0x6d44('0x1e')]||null:null,'limit':_0x200924[_0x6d44('0x1c')]?_0x200924[_0x6d44('0x1c')][_0x6d44('0x1f')]||null:null,'include':_0x200924[_0x6d44('0x1c')]?_0x200924[_0x6d44('0x1c')][_0x6d44('0x20')]?_[_0x6d44('0x21')](_0x200924[_0x6d44('0x1c')][_0x6d44('0x20')],function(_0x55deda){return{'model':db[_0x55deda[_0x6d44('0x22')]],'as':_0x55deda['as'],'attributes':_0x55deda[_0x6d44('0x1e')],'include':_0x55deda['include']?_['map'](_0x55deda['include'],function(_0x1ca4d6){return{'model':db[_0x1ca4d6[_0x6d44('0x22')]],'as':_0x1ca4d6['as'],'attributes':_0x1ca4d6[_0x6d44('0x1e')],'include':_0x1ca4d6['include']?_['map'](_0x1ca4d6[_0x6d44('0x20')],function(_0x45c07c){return{'model':db[_0x45c07c[_0x6d44('0x22')]],'as':_0x45c07c['as'],'attributes':_0x45c07c[_0x6d44('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x313875){logger[_0x6d44('0x16')]('GetCmHopperBlack',_0x200924);logger[_0x6d44('0x11')](_0x6d44('0x19'),_0x200924,JSON[_0x6d44('0x13')](_0x313875));_0x3d5761(_0x313875);})['catch'](function(_0x34ed7b){logger[_0x6d44('0x14')]('GetCmHopperBlack',_0x34ed7b[_0x6d44('0x15')],_0x200924);_0x3b075c(_0x23e489['error'](0x1f4,_0x34ed7b['message']));});});};exports[_0x6d44('0x23')]=function(_0x3d0e99){var _0x37060c=this;return new Promise(function(_0x2f818f,_0x45d39d){return db[_0x6d44('0x1a')][_0x6d44('0x24')](_0x3d0e99['body'],{'raw':_0x3d0e99[_0x6d44('0x1c')]?_0x3d0e99[_0x6d44('0x1c')][_0x6d44('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d0e99[_0x6d44('0x1c')]?_0x3d0e99[_0x6d44('0x1c')]['where']||null:null,'attributes':_0x3d0e99['options']?_0x3d0e99[_0x6d44('0x1c')]['attributes']||null:null,'limit':_0x3d0e99[_0x6d44('0x1c')]?_0x3d0e99['options'][_0x6d44('0x1f')]||null:null})[_0x6d44('0xe')](function(_0x148526){logger['info'](_0x6d44('0x23'),_0x3d0e99);logger[_0x6d44('0x11')](_0x6d44('0x23'),_0x3d0e99,JSON[_0x6d44('0x13')](_0x148526));_0x2f818f(_0x148526);})[_0x6d44('0x18')](function(_0x5b2272){logger[_0x6d44('0x14')](_0x6d44('0x23'),_0x5b2272[_0x6d44('0x15')],_0x3d0e99);_0x45d39d(_0x37060c['error'](0x1f4,_0x5b2272[_0x6d44('0x15')]));});});};exports[_0x6d44('0x25')]=function(_0x339790){var _0x5c65ae=this;return new Promise(function(_0x2580ae,_0x1e7943){return db[_0x6d44('0x1a')]['destroy']({'where':_0x339790['options']?_0x339790[_0x6d44('0x1c')][_0x6d44('0x26')]||null:null})[_0x6d44('0xe')](function(_0x48ce4a){logger[_0x6d44('0x16')](_0x6d44('0x25'),_0x339790);logger[_0x6d44('0x11')](_0x6d44('0x25'),_0x339790,JSON[_0x6d44('0x13')](_0x48ce4a));_0x2580ae(_0x48ce4a);})[_0x6d44('0x18')](function(_0x8ae227){logger[_0x6d44('0x14')]('DestroyCmHopperBlack',_0x8ae227[_0x6d44('0x15')],_0x339790);_0x1e7943(_0x5c65ae['error'](0x1f4,_0x8ae227['message']));});});}; \ No newline at end of file +var _0x4dc6=['attributes','GetCmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','findAll','options','raw','where','limit','include','map'];(function(_0xcb1411,_0x2281bf){var _0x5c29b4=function(_0x4137b0){while(--_0x4137b0){_0xcb1411['push'](_0xcb1411['shift']());}};_0x5c29b4(++_0x2281bf);}(_0x4dc6,0x1db));var _0x64dc=function(_0x470ef0,_0x58eb66){_0x470ef0=_0x470ef0-0x0;var _0x23c112=_0x4dc6[_0x470ef0];return _0x23c112;};'use strict';var _=require(_0x64dc('0x0'));var util=require(_0x64dc('0x1'));var moment=require(_0x64dc('0x2'));var BPromise=require(_0x64dc('0x3'));var rs=require(_0x64dc('0x4'));var fs=require('fs');var Redis=require(_0x64dc('0x5'));var db=require(_0x64dc('0x6'))['db'];var utils=require(_0x64dc('0x7'));var logger=require(_0x64dc('0x8'))(_0x64dc('0x9'));var config=require(_0x64dc('0xa'));var jayson=require(_0x64dc('0xb'));var client=jayson['client'][_0x64dc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48d781,_0x5977f0,_0x34dc04){return new BPromise(function(_0x4fac9e,_0x470431){return client['request'](_0x48d781,_0x34dc04)[_0x64dc('0xd')](function(_0x1a4915){logger[_0x64dc('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x5977f0,'request\x20sent');logger[_0x64dc('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5977f0,_0x64dc('0x10'),JSON[_0x64dc('0x11')](_0x1a4915));if(_0x1a4915[_0x64dc('0x12')]){if(_0x1a4915[_0x64dc('0x12')][_0x64dc('0x13')]===0x1f4){logger[_0x64dc('0x12')](_0x64dc('0x14'),_0x5977f0,_0x1a4915['error'][_0x64dc('0x15')]);return _0x470431(_0x1a4915[_0x64dc('0x12')][_0x64dc('0x15')]);}logger['error'](_0x64dc('0x14'),_0x5977f0,_0x1a4915[_0x64dc('0x12')][_0x64dc('0x15')]);return _0x4fac9e(_0x1a4915[_0x64dc('0x12')]['message']);}else{logger[_0x64dc('0xe')](_0x64dc('0x14'),_0x5977f0,_0x64dc('0x10'));_0x4fac9e(_0x1a4915[_0x64dc('0x16')][_0x64dc('0x15')]);}})[_0x64dc('0x17')](function(_0x52df3d){logger[_0x64dc('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x5977f0,_0x52df3d);_0x470431(_0x52df3d);});});}exports['GetCmHopperBlack']=function(_0x38141b){var _0x51caab=this;return new Promise(function(_0x18a323,_0x4bb836){return db[_0x64dc('0x18')][_0x64dc('0x19')]({'raw':_0x38141b['options']?_0x38141b[_0x64dc('0x1a')][_0x64dc('0x1b')]===undefined?!![]:![]:!![],'where':_0x38141b['options']?_0x38141b[_0x64dc('0x1a')][_0x64dc('0x1c')]||null:null,'attributes':_0x38141b['options']?_0x38141b[_0x64dc('0x1a')]['attributes']||null:null,'limit':_0x38141b[_0x64dc('0x1a')]?_0x38141b['options'][_0x64dc('0x1d')]||null:null,'include':_0x38141b[_0x64dc('0x1a')]?_0x38141b[_0x64dc('0x1a')][_0x64dc('0x1e')]?_[_0x64dc('0x1f')](_0x38141b[_0x64dc('0x1a')][_0x64dc('0x1e')],function(_0x220066){return{'model':db[_0x220066['model']],'as':_0x220066['as'],'attributes':_0x220066['attributes'],'include':_0x220066[_0x64dc('0x1e')]?_[_0x64dc('0x1f')](_0x220066[_0x64dc('0x1e')],function(_0x49d3f1){return{'model':db[_0x49d3f1['model']],'as':_0x49d3f1['as'],'attributes':_0x49d3f1[_0x64dc('0x20')],'include':_0x49d3f1[_0x64dc('0x1e')]?_[_0x64dc('0x1f')](_0x49d3f1['include'],function(_0x5c8804){return{'model':db[_0x5c8804['model']],'as':_0x5c8804['as'],'attributes':_0x5c8804['attributes']};}):[]};}):[]};}):[]:[]})[_0x64dc('0xd')](function(_0x29da05){logger[_0x64dc('0xe')](_0x64dc('0x21'),_0x38141b);logger['debug']('GetCmHopperBlack',_0x38141b,JSON[_0x64dc('0x11')](_0x29da05));_0x18a323(_0x29da05);})[_0x64dc('0x17')](function(_0x401ada){logger[_0x64dc('0x12')]('GetCmHopperBlack',_0x401ada[_0x64dc('0x15')],_0x38141b);_0x4bb836(_0x51caab[_0x64dc('0x12')](0x1f4,_0x401ada[_0x64dc('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x25c437){var _0x4dfb6c=this;return new Promise(function(_0x2e71a5,_0x4c39b1){return db['CmHopperBlack'][_0x64dc('0x22')](_0x25c437[_0x64dc('0x23')],{'raw':_0x25c437[_0x64dc('0x1a')]?_0x25c437[_0x64dc('0x1a')][_0x64dc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25c437['options']?_0x25c437[_0x64dc('0x1a')][_0x64dc('0x1c')]||null:null,'attributes':_0x25c437[_0x64dc('0x1a')]?_0x25c437[_0x64dc('0x1a')][_0x64dc('0x20')]||null:null,'limit':_0x25c437[_0x64dc('0x1a')]?_0x25c437[_0x64dc('0x1a')]['limit']||null:null})[_0x64dc('0xd')](function(_0x58fce3){logger[_0x64dc('0xe')](_0x64dc('0x24'),_0x25c437);logger[_0x64dc('0xf')](_0x64dc('0x24'),_0x25c437,JSON[_0x64dc('0x11')](_0x58fce3));_0x2e71a5(_0x58fce3);})['catch'](function(_0x5ddcbf){logger[_0x64dc('0x12')](_0x64dc('0x24'),_0x5ddcbf[_0x64dc('0x15')],_0x25c437);_0x4c39b1(_0x4dfb6c['error'](0x1f4,_0x5ddcbf[_0x64dc('0x15')]));});});};exports[_0x64dc('0x25')]=function(_0x1dc7f8){var _0x3936de=this;return new Promise(function(_0x2d19e3,_0x29a1d4){return db[_0x64dc('0x18')][_0x64dc('0x26')]({'where':_0x1dc7f8['options']?_0x1dc7f8['options'][_0x64dc('0x1c')]||null:null})[_0x64dc('0xd')](function(_0x3c0425){logger[_0x64dc('0xe')](_0x64dc('0x25'),_0x1dc7f8);logger[_0x64dc('0xf')](_0x64dc('0x25'),_0x1dc7f8,JSON[_0x64dc('0x11')](_0x3c0425));_0x2d19e3(_0x3c0425);})['catch'](function(_0x31c344){logger['error'](_0x64dc('0x25'),_0x31c344[_0x64dc('0x15')],_0x1dc7f8);_0x29a1d4(_0x3936de[_0x64dc('0x12')](0x1f4,_0x31c344['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index aa4e703..9d420d6 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 _0xb458=['show','put','/:id','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe'];(function(_0x4b28fb,_0x4d9167){var _0x41822d=function(_0x3d05dd){while(--_0x3d05dd){_0x4b28fb['push'](_0x4b28fb['shift']());}};_0x41822d(++_0x4d9167);}(_0xb458,0x103));var _0x8b45=function(_0x19afb9,_0x3df9e7){_0x19afb9=_0x19afb9-0x0;var _0x6fc88b=_0xb458[_0x19afb9];return _0x6fc88b;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var auth=require(_0x8b45('0x4'));var interaction=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x8b45('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8b45('0x7')](_0x8b45('0x8'),auth[_0x8b45('0x9')](),controller[_0x8b45('0xa')]);router[_0x8b45('0x7')]('/:id',auth[_0x8b45('0x9')](),controller[_0x8b45('0xb')]);router[_0x8b45('0xc')](_0x8b45('0xd'),auth[_0x8b45('0x9')](),controller['update']);router[_0x8b45('0xe')](_0x8b45('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9f62=['/describe','describe','/:id','exports','util','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x4ce4a6,_0x3226f1){var _0x3e54e0=function(_0x752a0d){while(--_0x752a0d){_0x4ce4a6['push'](_0x4ce4a6['shift']());}};_0x3e54e0(++_0x3226f1);}(_0x9f62,0x154));var _0x29f6=function(_0x161054,_0x1bf93c){_0x161054=_0x161054-0x0;var _0x5d56c8=_0x9f62[_0x161054];return _0x5d56c8;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['put'](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller['update']);router['delete'](_0x29f6('0xa'),auth[_0x29f6('0x7')](),controller['destroy']);module[_0x29f6('0xb')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a1b4455..60ad58d 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 _0x4d05=['getDataValue','endtime','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d05,0x13f));var _0x54d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4d05[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x54d0('0x0'));var moment=require(_0x54d0('0x1'));module[_0x54d0('0x2')]={'state':{'type':Sequelize[_0x54d0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x54d0('0x4')]},'scheduledat':{'type':Sequelize[_0x54d0('0x5')]},'countbusyretry':{'type':Sequelize[_0x54d0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x54d0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x54d0('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x54d0('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x54d0('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x54d0('0x4')]},'originatecalleridname':{'type':Sequelize[_0x54d0('0x4')]},'calleridnum':{'type':Sequelize[_0x54d0('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x54d0('0x5')]},'responsetime':{'type':Sequelize[_0x54d0('0x5')]},'answertime':{'type':Sequelize[_0x54d0('0x5')]},'droptime':{'type':Sequelize[_0x54d0('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x54d0('0x4')]},'campaign':{'type':Sequelize[_0x54d0('0x4')]},'campaigntype':{'type':Sequelize[_0x54d0('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x54d0('0x4')]},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x54d0('0x5')],'set':function(_0x129ccc){var _0x216d1f=this[_0x54d0('0x6')](_0x54d0('0x7'));if(_0x216d1f&&_0x129ccc){this[_0x54d0('0x8')]('followuptime',moment(_0x129ccc)[_0x54d0('0x9')](moment(_0x216d1f),_0x54d0('0xa')));}return this[_0x54d0('0x8')](_0x54d0('0xb'),_0x129ccc);}},'amd':{'type':Sequelize[_0x54d0('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x54d0('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x54d0('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x54d0('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x54d0('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x54d0('0x5')]},'deleted':{'type':Sequelize[_0x54d0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x54d0('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x54d0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x54d0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x54d0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x38d1=['setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','endtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38d1,0x71));var _0x138d=function(_0x40bd00,_0x45c301){_0x40bd00=_0x40bd00-0x0;var _0x3d278f=_0x38d1[_0x40bd00];return _0x3d278f;};'use strict';var Sequelize=require(_0x138d('0x0'));var moment=require(_0x138d('0x1'));module[_0x138d('0x2')]={'state':{'type':Sequelize[_0x138d('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x138d('0x4')]},'scheduledat':{'type':Sequelize[_0x138d('0x5')]},'countbusyretry':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x138d('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x138d('0x4')]},'originatecalleridname':{'type':Sequelize[_0x138d('0x4')]},'calleridnum':{'type':Sequelize[_0x138d('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x138d('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x138d('0x5')]},'droptime':{'type':Sequelize[_0x138d('0x5')]},'endtime':{'type':Sequelize[_0x138d('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x138d('0x4')]},'campaign':{'type':Sequelize[_0x138d('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x138d('0x4')]},'disposition':{'type':Sequelize[_0x138d('0x4')]},'dispositionat':{'type':Sequelize[_0x138d('0x5')],'set':function(_0x390268){var _0x339fa4=this['getDataValue'](_0x138d('0x6'));if(_0x339fa4&&_0x390268){this[_0x138d('0x7')](_0x138d('0x8'),moment(_0x390268)[_0x138d('0x9')](moment(_0x339fa4),_0x138d('0xa')));}return this[_0x138d('0x7')]('dispositionat',_0x390268);}},'amd':{'type':Sequelize[_0x138d('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x138d('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x138d('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x138d('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x138d('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x138d('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x138d('0x5')]},'deleted':{'type':Sequelize[_0x138d('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x138d('0x5')]},'recallme':{'type':Sequelize[_0x138d('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x138d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 97ed8e9..574a2f7 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 _0x49c1=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','update','then','destroy','stack','name','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperFinal','includeAll','findAll','rows','catch','include','find','describe','uniqueid','params','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','state','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv'];(function(_0x43684b,_0x1aa660){var _0x982e5b=function(_0x34f0a4){while(--_0x34f0a4){_0x43684b['push'](_0x43684b['shift']());}};_0x982e5b(++_0x1aa660);}(_0x49c1,0xef));var _0x149c=function(_0x5b3017,_0x19fd9d){_0x5b3017=_0x5b3017-0x0;var _0x3e5599=_0x49c1[_0x5b3017];return _0x3e5599;};'use strict';var pdf=require(_0x149c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x149c('0x1'));var zipdir=require(_0x149c('0x2'));var jsonpatch=require(_0x149c('0x3'));var rp=require('request-promise');var moment=require(_0x149c('0x4'));var BPromise=require(_0x149c('0x5'));var Mustache=require('mustache');var util=require(_0x149c('0x6'));var path=require(_0x149c('0x7'));var sox=require('sox');var csv=require(_0x149c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x149c('0x9'));var squel=require(_0x149c('0xa'));var crypto=require('crypto');var jsforce=require(_0x149c('0xb'));var deskjs=require(_0x149c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x149c('0xd'));var Papa=require(_0x149c('0xe'));var Redis=require('ioredis');var authService=require(_0x149c('0xf'));var qs=require(_0x149c('0x10'));var as=require(_0x149c('0x11'));var hardwareService=require(_0x149c('0x12'));var logger=require('../../config/logger')(_0x149c('0x13'));var utils=require(_0x149c('0x14'));var config=require(_0x149c('0x15'));var db=require(_0x149c('0x16'))['db'];function respondWithStatusCode(_0x32a56c,_0x19e0b1){_0x19e0b1=_0x19e0b1||0xcc;return function(_0x1a0c32){if(_0x1a0c32){return _0x32a56c[_0x149c('0x17')](_0x19e0b1);}return _0x32a56c['status'](_0x19e0b1)[_0x149c('0x18')]();};}function respondWithResult(_0x2125a2,_0x4aee29){_0x4aee29=_0x4aee29||0xc8;return function(_0x3b247e){if(_0x3b247e){return _0x2125a2['status'](_0x4aee29)[_0x149c('0x19')](_0x3b247e);}};}function respondWithFilteredResult(_0x1d2a83,_0x177800){return function(_0x471e93){if(_0x471e93){var _0x3d851a=_0x471e93[_0x149c('0x1a')],_0x30f8c1=_0x177800['offset'],_0x3659eb=_0x177800[_0x149c('0x1b')]+_0x177800[_0x149c('0x1c')],_0x3e966f;if(_0x3659eb>=_0x3d851a){_0x3659eb=_0x3d851a;_0x3e966f=0xc8;}else{_0x3e966f=0xce;}_0x1d2a83[_0x149c('0x1d')](_0x3e966f);return _0x1d2a83[_0x149c('0x1e')](_0x149c('0x1f'),_0x30f8c1+'-'+_0x3659eb+'/'+_0x3d851a)[_0x149c('0x19')](_0x471e93);}return null;};}function patchUpdates(_0x653d6){return function(_0x3290e4){try{jsonpatch['apply'](_0x3290e4,_0x653d6,!![]);}catch(_0x1f4f40){return BPromise['reject'](_0x1f4f40);}return _0x3290e4['save']();};}function saveUpdates(_0x528337,_0x4c9b41){return function(_0x14194d){if(_0x14194d){return _0x14194d[_0x149c('0x20')](_0x528337)[_0x149c('0x21')](function(_0x37bf11){return _0x37bf11;});}return null;};}function removeEntity(_0x4e4053,_0x184924){return function(_0x4e663e){if(_0x4e663e){return _0x4e663e[_0x149c('0x22')]()[_0x149c('0x21')](function(){_0x4e4053[_0x149c('0x1d')](0xcc)[_0x149c('0x18')]();});}};}function handleEntityNotFound(_0x2cdd54,_0xb60e06){return function(_0x238363){if(!_0x238363){_0x2cdd54[_0x149c('0x17')](0x194);}return _0x238363;};}function handleError(_0x48e34c,_0x39bfee){_0x39bfee=_0x39bfee||0x1f4;return function(_0x364059){logger['error'](_0x364059[_0x149c('0x23')]);if(_0x364059[_0x149c('0x24')]){delete _0x364059[_0x149c('0x24')];}_0x48e34c[_0x149c('0x1d')](_0x39bfee)['send'](_0x364059);};}exports[_0x149c('0x25')]=function(_0x106061,_0x3a9090){var _0x1ba032={},_0x149705={},_0x44f3c6={'count':0x0,'rows':[]};var _0x16f5d6=_['map'](db['CmHopperFinal'][_0x149c('0x26')],function(_0x1203f2){return{'name':_0x1203f2[_0x149c('0x27')],'type':_0x1203f2['type'][_0x149c('0x28')]};});_0x149705[_0x149c('0x29')]=_[_0x149c('0x2a')](_0x16f5d6,_0x149c('0x24'));_0x149705['query']=_[_0x149c('0x2b')](_0x106061[_0x149c('0x2c')]);_0x149705[_0x149c('0x2d')]=_[_0x149c('0x2e')](_0x149705[_0x149c('0x29')],_0x149705['query']);_0x1ba032[_0x149c('0x2f')]=_['intersection'](_0x149705[_0x149c('0x29')],qs[_0x149c('0x30')](_0x106061[_0x149c('0x2c')][_0x149c('0x30')]));_0x1ba032[_0x149c('0x2f')]=_0x1ba032[_0x149c('0x2f')][_0x149c('0x31')]?_0x1ba032['attributes']:_0x149705[_0x149c('0x29')];if(!_0x106061['query'][_0x149c('0x32')]('nolimit')){_0x1ba032[_0x149c('0x1c')]=qs['limit'](_0x106061[_0x149c('0x2c')][_0x149c('0x1c')]);_0x1ba032['offset']=qs['offset'](_0x106061[_0x149c('0x2c')][_0x149c('0x1b')]);}_0x1ba032['order']=qs['sort'](_0x106061[_0x149c('0x2c')][_0x149c('0x33')]);_0x1ba032[_0x149c('0x34')]=qs[_0x149c('0x2d')](_[_0x149c('0x35')](_0x106061[_0x149c('0x2c')],_0x149705['filters']),_0x16f5d6);if(_0x106061[_0x149c('0x2c')][_0x149c('0x36')]){_0x1ba032[_0x149c('0x34')]=_[_0x149c('0x37')](_0x1ba032['where'],{'$or':_[_0x149c('0x2a')](_0x16f5d6,function(_0x176bcf){if(_0x176bcf[_0x149c('0x38')]!==_0x149c('0x39')){var _0x5d3f68={};_0x5d3f68[_0x176bcf['name']]={'$like':'%'+_0x106061[_0x149c('0x2c')][_0x149c('0x36')]+'%'};return _0x5d3f68;}})});}_0x1ba032=_['merge']({},_0x1ba032,_0x106061[_0x149c('0x3a')]);var _0x4e6a3f={'where':_0x1ba032[_0x149c('0x34')]};return db[_0x149c('0x3b')][_0x149c('0x1a')](_0x4e6a3f)[_0x149c('0x21')](function(_0x11387d){_0x44f3c6['count']=_0x11387d;if(_0x106061[_0x149c('0x2c')][_0x149c('0x3c')]){_0x1ba032['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x149c('0x3d')](_0x1ba032);})[_0x149c('0x21')](function(_0x5a3f90){_0x44f3c6[_0x149c('0x3e')]=_0x5a3f90;return _0x44f3c6;})[_0x149c('0x21')](respondWithFilteredResult(_0x3a9090,_0x1ba032))[_0x149c('0x3f')](handleError(_0x3a9090,null));};exports['show']=function(_0x55d804,_0x248c9e){var _0x14f790={'raw':!![],'where':{'id':_0x55d804['params']['id']}},_0x1ab916={};_0x1ab916[_0x149c('0x29')]=_['keys'](db['CmHopperFinal'][_0x149c('0x26')]);_0x1ab916[_0x149c('0x2c')]=_[_0x149c('0x2b')](_0x55d804[_0x149c('0x2c')]);_0x1ab916[_0x149c('0x2d')]=_[_0x149c('0x2e')](_0x1ab916['model'],_0x1ab916[_0x149c('0x2c')]);_0x14f790[_0x149c('0x2f')]=_[_0x149c('0x2e')](_0x1ab916[_0x149c('0x29')],qs[_0x149c('0x30')](_0x55d804[_0x149c('0x2c')][_0x149c('0x30')]));_0x14f790[_0x149c('0x2f')]=_0x14f790[_0x149c('0x2f')][_0x149c('0x31')]?_0x14f790['attributes']:_0x1ab916[_0x149c('0x29')];if(_0x55d804[_0x149c('0x2c')][_0x149c('0x3c')]){_0x14f790[_0x149c('0x40')]=[{'all':!![]}];}_0x14f790=_[_0x149c('0x37')]({},_0x14f790,_0x55d804['options']);return db['CmHopperFinal'][_0x149c('0x41')](_0x14f790)['then'](handleEntityNotFound(_0x248c9e,null))[_0x149c('0x21')](respondWithResult(_0x248c9e,null))[_0x149c('0x3f')](handleError(_0x248c9e,null));};exports['describe']=function(_0x4ffa7f,_0x470f64){return db[_0x149c('0x3b')][_0x149c('0x42')]()[_0x149c('0x21')](respondWithResult(_0x470f64,null))['catch'](handleError(_0x470f64,null));};exports['update']=function(_0x24983b,_0x25584b){if(_0x24983b['body']['uniqueid']){delete _0x24983b['body'][_0x149c('0x43')];}return db[_0x149c('0x3b')][_0x149c('0x41')]({'where':{'uniqueid':_0x24983b[_0x149c('0x44')]['id']}})['then'](handleEntityNotFound(_0x25584b,null))[_0x149c('0x21')](saveUpdates(_0x24983b[_0x149c('0x45')],null))[_0x149c('0x21')](respondWithResult(_0x25584b,null))['catch'](handleError(_0x25584b,null));};exports[_0x149c('0x46')]=function(_0x16de3f,_0x49c6c8,_0x5b8b59){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x16de3f[_0x149c('0x44')]['id']},'attributes':[[db[_0x149c('0x47')]['fn'](_0x149c('0x48'),db['sequelize']['fn']('IF',db[_0x149c('0x47')]['literal'](_0x149c('0x49')))),'noSuchContacts'],[db[_0x149c('0x47')]['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db[_0x149c('0x47')][_0x149c('0x4a')](_0x149c('0x4b')))),'noAnswerContacts'],[db[_0x149c('0x47')]['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db['sequelize'][_0x149c('0x4a')](_0x149c('0x4c')))),_0x149c('0x4d')],[db[_0x149c('0x47')]['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db[_0x149c('0x47')][_0x149c('0x4a')](_0x149c('0x4e')))),'congestionContacts'],[db[_0x149c('0x47')]['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db['sequelize']['literal'](_0x149c('0x4f')))),_0x149c('0x50')],[db['sequelize']['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db[_0x149c('0x47')][_0x149c('0x4a')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x149c('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x149c('0x47')]['literal'](_0x149c('0x51')))),_0x149c('0x52')],[db['sequelize']['fn']('COUNT',db[_0x149c('0x47')]['fn']('IF',db['sequelize'][_0x149c('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),_0x149c('0x53')]]})[_0x149c('0x21')](handleEntityNotFound(_0x49c6c8,null))['then'](respondWithResult(_0x49c6c8,null))[_0x149c('0x3f')](handleError(_0x49c6c8,null));};exports[_0x149c('0x54')]=function(_0x3032c0,_0x562c2c,_0x3fe6c5){return db[_0x149c('0x3b')]['findAll']({'raw':![],'where':{'CampaignId':_0x3032c0[_0x149c('0x44')]['id']},'attributes':[[db[_0x149c('0x47')]['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db[_0x149c('0x47')][_0x149c('0x4a')](_0x149c('0x49')))),'noSuchContacts'],[db[_0x149c('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x149c('0x4b')))),_0x149c('0x55')],[db['sequelize']['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db['sequelize']['literal'](_0x149c('0x4c')))),_0x149c('0x4d')],[db[_0x149c('0x47')]['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db['sequelize'][_0x149c('0x4a')](_0x149c('0x4e')))),'congestionContacts'],[db['sequelize']['fn'](_0x149c('0x48'),db[_0x149c('0x47')]['fn']('IF',db[_0x149c('0x47')][_0x149c('0x4a')](_0x149c('0x4f')))),'dropContacts'],[db[_0x149c('0x47')]['fn']('COUNT',db[_0x149c('0x47')]['fn']('IF',db[_0x149c('0x47')][_0x149c('0x4a')](_0x149c('0x56')))),'abandonedContacts'],[db[_0x149c('0x47')]['fn'](_0x149c('0x48'),db['sequelize']['fn']('IF',db[_0x149c('0x47')][_0x149c('0x4a')](_0x149c('0x51')))),_0x149c('0x52')],[db['sequelize']['fn'](_0x149c('0x48'),db['sequelize']['fn']('IF',db[_0x149c('0x47')][_0x149c('0x4a')](_0x149c('0x57')))),_0x149c('0x53')]]})[_0x149c('0x21')](handleEntityNotFound(_0x562c2c,null))['then'](respondWithResult(_0x562c2c,null))['catch'](handleError(_0x562c2c,null));};exports[_0x149c('0x58')]=function(_0x45c752,_0x249467,_0x4844b6){return db['VoiceQueue'][_0x149c('0x41')]({'where':{'id':_0x45c752[_0x149c('0x44')]['id']}})['then'](handleEntityNotFound(_0x249467,null))[_0x149c('0x21')](function(_0x5847dc){var _0x4c7322;if(_0x5847dc){_0x4c7322=squel[_0x149c('0x59')]()[_0x149c('0x5a')]('cm_hopper')[_0x149c('0x5b')]([_0x149c('0x5c'),_0x149c('0x5d'),_0x149c('0x5e'),_0x149c('0x5f'),_0x149c('0x60'),'createdAt',_0x149c('0x61')],squel['select']()[_0x149c('0x62')](_0x149c('0x63'),_0x149c('0x5c'))['field'](_0x149c('0x64'),_0x149c('0x5d'))[_0x149c('0x62')](_0x149c('0x65'),'ContactId')['field'](_0x149c('0x66'),_0x149c('0x5f'))['field'](_0x149c('0x67'),_0x149c('0x60'))[_0x149c('0x62')]('NOW()',_0x149c('0x68'))[_0x149c('0x62')](_0x149c('0x64'),_0x149c('0x61'))[_0x149c('0x69')]('cm_hopper_final')['where'](_0x149c('0x6a'),_0x45c752['params']['id'][_0x149c('0x6b')]())[_0x149c('0x34')]('state\x20=\x20?',_0x45c752[_0x149c('0x45')]['state'][_0x149c('0x6b')]())[_0x149c('0x34')](_0x149c('0x6c'))[_0x149c('0x34')](_0x149c('0x6d'),squel[_0x149c('0x6e')]()[_0x149c('0x62')](_0x149c('0x5c'))[_0x149c('0x69')](_0x149c('0x6f'))['where']('VoiceQueueId\x20=\x20?',_0x45c752[_0x149c('0x44')]['id'][_0x149c('0x6b')]()))[_0x149c('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x149c('0x6e')]()[_0x149c('0x62')](_0x149c('0x70'))['from'](_0x149c('0x71'))[_0x149c('0x34')](_0x149c('0x6a'),_0x45c752[_0x149c('0x44')]['id'][_0x149c('0x6b')]())[_0x149c('0x34')](_0x149c('0x72')))[_0x149c('0x73')](_0x149c('0x5e')))[_0x149c('0x6b')]();return db[_0x149c('0x47')][_0x149c('0x2c')](_0x4c7322);}return[];})['then'](respondWithResult(_0x249467,null))[_0x149c('0x3f')](handleError(_0x249467,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1a3a24,_0x2db03b,_0x420458){return db['Campaign'][_0x149c('0x41')]({'where':{'id':_0x1a3a24[_0x149c('0x44')]['id']}})[_0x149c('0x21')](handleEntityNotFound(_0x2db03b,null))['then'](function(_0x2e7032){var _0x2efc81;if(_0x2e7032){_0x2efc81=squel[_0x149c('0x59')]()[_0x149c('0x5a')](_0x149c('0x6f'))[_0x149c('0x5b')]([_0x149c('0x5c'),_0x149c('0x5d'),_0x149c('0x5e'),_0x149c('0x5f'),_0x149c('0x74'),_0x149c('0x68'),'updatedAt'],squel[_0x149c('0x6e')]()['field'](_0x149c('0x63'),_0x149c('0x5c'))[_0x149c('0x62')](_0x149c('0x64'),_0x149c('0x5d'))[_0x149c('0x62')](_0x149c('0x65'),'ContactId')[_0x149c('0x62')](_0x149c('0x66'),_0x149c('0x5f'))['field'](_0x149c('0x75'),'CampaignId')[_0x149c('0x62')](_0x149c('0x64'),_0x149c('0x68'))['field'](_0x149c('0x64'),_0x149c('0x61'))[_0x149c('0x69')](_0x149c('0x71'))[_0x149c('0x34')](_0x149c('0x76'),_0x1a3a24['params']['id'][_0x149c('0x6b')]())[_0x149c('0x34')](_0x149c('0x77'),_0x1a3a24['body'][_0x149c('0x78')][_0x149c('0x6b')]())['where'](_0x149c('0x6c'))[_0x149c('0x34')](_0x149c('0x6d'),squel[_0x149c('0x6e')]()[_0x149c('0x62')](_0x149c('0x5c'))['from']('cm_hopper')[_0x149c('0x34')](_0x149c('0x76'),_0x1a3a24[_0x149c('0x44')]['id'][_0x149c('0x6b')]()))[_0x149c('0x34')](_0x149c('0x6d'),squel[_0x149c('0x6e')]()[_0x149c('0x62')](_0x149c('0x70'))[_0x149c('0x69')](_0x149c('0x71'))[_0x149c('0x34')](_0x149c('0x76'),_0x1a3a24['params']['id'][_0x149c('0x6b')]())[_0x149c('0x34')](_0x149c('0x72')))[_0x149c('0x73')](_0x149c('0x5e')))[_0x149c('0x6b')]();return db[_0x149c('0x47')]['query'](_0x2efc81);}return[];})[_0x149c('0x21')](respondWithResult(_0x2db03b,null))['catch'](handleError(_0x2db03b,null));};exports[_0x149c('0x79')]=function(_0x12ba80,_0x209377,_0x1e0663){return db[_0x149c('0x7a')][_0x149c('0x7b')]({'where':{'VoiceQueueId':_0x12ba80[_0x149c('0x45')][_0x149c('0x60')],'CampaignId':_0x12ba80[_0x149c('0x45')][_0x149c('0x74')],'ContactId':_0x12ba80[_0x149c('0x45')][_0x149c('0x5e')]}})[_0x149c('0x21')](handleEntityNotFound(_0x209377,null))['then'](function(_0x1386d5){if(_0x1386d5){return _0x1386d5;}return null;})[_0x149c('0x21')](respondWithResult(_0x209377,null))[_0x149c('0x3f')](handleError(_0x209377,null));}; \ No newline at end of file +var _0xb8cb=['name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','find','describe','update','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','reCallContacts','answeringMachine','busyContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','cm_hopper','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','CmHopper','findOne','VoiceQueueId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','then','destroy'];(function(_0x278c7f,_0x46bdda){var _0x5bd01b=function(_0x432443){while(--_0x432443){_0x278c7f['push'](_0x278c7f['shift']());}};_0x5bd01b(++_0x46bdda);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x1b27e0,_0x3efbe4){_0x1b27e0=_0x1b27e0-0x0;var _0x22b433=_0xb8cb[_0x1b27e0];return _0x22b433;};'use strict';var pdf=require(_0xbb8c('0x0'));var emlformat=require(_0xbb8c('0x1'));var rimraf=require(_0xbb8c('0x2'));var zipdir=require(_0xbb8c('0x3'));var jsonpatch=require(_0xbb8c('0x4'));var rp=require(_0xbb8c('0x5'));var moment=require(_0xbb8c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbb8c('0x7'));var util=require(_0xbb8c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbb8c('0x9'));var ejs=require(_0xbb8c('0xa'));var fs=require('fs');var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0x9'));var querystring=require(_0xbb8c('0xf'));var Papa=require(_0xbb8c('0x10'));var Redis=require(_0xbb8c('0x11'));var authService=require(_0xbb8c('0x12'));var qs=require(_0xbb8c('0x13'));var as=require(_0xbb8c('0x14'));var hardwareService=require(_0xbb8c('0x15'));var logger=require(_0xbb8c('0x16'))('api');var utils=require(_0xbb8c('0x17'));var config=require(_0xbb8c('0x18'));var db=require(_0xbb8c('0x19'))['db'];function respondWithStatusCode(_0x316daa,_0x3ac367){_0x3ac367=_0x3ac367||0xcc;return function(_0x57e624){if(_0x57e624){return _0x316daa[_0xbb8c('0x1a')](_0x3ac367);}return _0x316daa[_0xbb8c('0x1b')](_0x3ac367)[_0xbb8c('0x1c')]();};}function respondWithResult(_0x40e58b,_0x3a0fe2){_0x3a0fe2=_0x3a0fe2||0xc8;return function(_0x151bf2){if(_0x151bf2){return _0x40e58b[_0xbb8c('0x1b')](_0x3a0fe2)['json'](_0x151bf2);}};}function respondWithFilteredResult(_0x9d06b6,_0x1e6dc9){return function(_0x425891){if(_0x425891){var _0x403710=_0x425891[_0xbb8c('0x1d')],_0x2cc079=_0x1e6dc9[_0xbb8c('0x1e')],_0x3a695d=_0x1e6dc9[_0xbb8c('0x1e')]+_0x1e6dc9['limit'],_0x2c04d1;if(_0x3a695d>=_0x403710){_0x3a695d=_0x403710;_0x2c04d1=0xc8;}else{_0x2c04d1=0xce;}_0x9d06b6[_0xbb8c('0x1b')](_0x2c04d1);return _0x9d06b6[_0xbb8c('0x1f')](_0xbb8c('0x20'),_0x2cc079+'-'+_0x3a695d+'/'+_0x403710)[_0xbb8c('0x21')](_0x425891);}return null;};}function patchUpdates(_0x3bdaca){return function(_0x25e2c4){try{jsonpatch['apply'](_0x25e2c4,_0x3bdaca,!![]);}catch(_0x472156){return BPromise[_0xbb8c('0x22')](_0x472156);}return _0x25e2c4['save']();};}function saveUpdates(_0x1a1e92,_0x5e2803){return function(_0x44a56e){if(_0x44a56e){return _0x44a56e['update'](_0x1a1e92)[_0xbb8c('0x23')](function(_0x1d00db){return _0x1d00db;});}return null;};}function removeEntity(_0x1e2539,_0x546215){return function(_0x4b4100){if(_0x4b4100){return _0x4b4100[_0xbb8c('0x24')]()['then'](function(){_0x1e2539[_0xbb8c('0x1b')](0xcc)[_0xbb8c('0x1c')]();});}};}function handleEntityNotFound(_0x36163c,_0xec7fb5){return function(_0x362a2f){if(!_0x362a2f){_0x36163c[_0xbb8c('0x1a')](0x194);}return _0x362a2f;};}function handleError(_0xf5a529,_0x51f25a){_0x51f25a=_0x51f25a||0x1f4;return function(_0x29d4af){logger['error'](_0x29d4af['stack']);if(_0x29d4af[_0xbb8c('0x25')]){delete _0x29d4af['name'];}_0xf5a529['status'](_0x51f25a)[_0xbb8c('0x26')](_0x29d4af);};}exports[_0xbb8c('0x27')]=function(_0x36d351,_0x4928e4){var _0x5b8cd1={},_0x17576b={},_0x2aed0b={'count':0x0,'rows':[]};var _0x4cb223=_[_0xbb8c('0x28')](db[_0xbb8c('0x29')][_0xbb8c('0x2a')],function(_0x4f0f13){return{'name':_0x4f0f13[_0xbb8c('0x2b')],'type':_0x4f0f13[_0xbb8c('0x2c')][_0xbb8c('0x2d')]};});_0x17576b[_0xbb8c('0x2e')]=_[_0xbb8c('0x28')](_0x4cb223,_0xbb8c('0x25'));_0x17576b[_0xbb8c('0x2f')]=_[_0xbb8c('0x30')](_0x36d351[_0xbb8c('0x2f')]);_0x17576b[_0xbb8c('0x31')]=_['intersection'](_0x17576b['model'],_0x17576b[_0xbb8c('0x2f')]);_0x5b8cd1[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x17576b[_0xbb8c('0x2e')],qs[_0xbb8c('0x34')](_0x36d351['query'][_0xbb8c('0x34')]));_0x5b8cd1[_0xbb8c('0x32')]=_0x5b8cd1[_0xbb8c('0x32')][_0xbb8c('0x35')]?_0x5b8cd1[_0xbb8c('0x32')]:_0x17576b[_0xbb8c('0x2e')];if(!_0x36d351[_0xbb8c('0x2f')][_0xbb8c('0x36')](_0xbb8c('0x37'))){_0x5b8cd1['limit']=qs[_0xbb8c('0x38')](_0x36d351[_0xbb8c('0x2f')][_0xbb8c('0x38')]);_0x5b8cd1['offset']=qs['offset'](_0x36d351[_0xbb8c('0x2f')][_0xbb8c('0x1e')]);}_0x5b8cd1[_0xbb8c('0x39')]=qs[_0xbb8c('0x3a')](_0x36d351['query'][_0xbb8c('0x3a')]);_0x5b8cd1[_0xbb8c('0x3b')]=qs[_0xbb8c('0x31')](_[_0xbb8c('0x3c')](_0x36d351[_0xbb8c('0x2f')],_0x17576b['filters']),_0x4cb223);if(_0x36d351[_0xbb8c('0x2f')][_0xbb8c('0x3d')]){_0x5b8cd1[_0xbb8c('0x3b')]=_[_0xbb8c('0x3e')](_0x5b8cd1['where'],{'$or':_[_0xbb8c('0x28')](_0x4cb223,function(_0x448986){if(_0x448986[_0xbb8c('0x2c')]!==_0xbb8c('0x3f')){var _0x34ad16={};_0x34ad16[_0x448986[_0xbb8c('0x25')]]={'$like':'%'+_0x36d351[_0xbb8c('0x2f')][_0xbb8c('0x3d')]+'%'};return _0x34ad16;}})});}_0x5b8cd1=_[_0xbb8c('0x3e')]({},_0x5b8cd1,_0x36d351[_0xbb8c('0x40')]);var _0x41e709={'where':_0x5b8cd1[_0xbb8c('0x3b')]};return db['CmHopperFinal'][_0xbb8c('0x1d')](_0x41e709)[_0xbb8c('0x23')](function(_0xd16ece){_0x2aed0b[_0xbb8c('0x1d')]=_0xd16ece;if(_0x36d351['query'][_0xbb8c('0x41')]){_0x5b8cd1['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xbb8c('0x42')](_0x5b8cd1);})[_0xbb8c('0x23')](function(_0x27c4bf){_0x2aed0b['rows']=_0x27c4bf;return _0x2aed0b;})[_0xbb8c('0x23')](respondWithFilteredResult(_0x4928e4,_0x5b8cd1))[_0xbb8c('0x43')](handleError(_0x4928e4,null));};exports['show']=function(_0x176134,_0x8ac716){var _0x3b8311={'raw':!![],'where':{'id':_0x176134['params']['id']}},_0x15830c={};_0x15830c[_0xbb8c('0x2e')]=_[_0xbb8c('0x30')](db[_0xbb8c('0x29')]['rawAttributes']);_0x15830c[_0xbb8c('0x2f')]=_[_0xbb8c('0x30')](_0x176134['query']);_0x15830c['filters']=_[_0xbb8c('0x33')](_0x15830c[_0xbb8c('0x2e')],_0x15830c['query']);_0x3b8311['attributes']=_[_0xbb8c('0x33')](_0x15830c['model'],qs[_0xbb8c('0x34')](_0x176134['query'][_0xbb8c('0x34')]));_0x3b8311['attributes']=_0x3b8311[_0xbb8c('0x32')][_0xbb8c('0x35')]?_0x3b8311[_0xbb8c('0x32')]:_0x15830c[_0xbb8c('0x2e')];if(_0x176134[_0xbb8c('0x2f')][_0xbb8c('0x41')]){_0x3b8311['include']=[{'all':!![]}];}_0x3b8311=_[_0xbb8c('0x3e')]({},_0x3b8311,_0x176134['options']);return db[_0xbb8c('0x29')][_0xbb8c('0x44')](_0x3b8311)[_0xbb8c('0x23')](handleEntityNotFound(_0x8ac716,null))[_0xbb8c('0x23')](respondWithResult(_0x8ac716,null))[_0xbb8c('0x43')](handleError(_0x8ac716,null));};exports[_0xbb8c('0x45')]=function(_0x5abb59,_0x4e8f0a){return db[_0xbb8c('0x29')][_0xbb8c('0x45')]()['then'](respondWithResult(_0x4e8f0a,null))[_0xbb8c('0x43')](handleError(_0x4e8f0a,null));};exports[_0xbb8c('0x46')]=function(_0x3f0a8b,_0x599e51){if(_0x3f0a8b[_0xbb8c('0x47')]['uniqueid']){delete _0x3f0a8b[_0xbb8c('0x47')][_0xbb8c('0x48')];}return db[_0xbb8c('0x29')]['find']({'where':{'uniqueid':_0x3f0a8b[_0xbb8c('0x49')]['id']}})[_0xbb8c('0x23')](handleEntityNotFound(_0x599e51,null))[_0xbb8c('0x23')](saveUpdates(_0x3f0a8b[_0xbb8c('0x47')],null))[_0xbb8c('0x23')](respondWithResult(_0x599e51,null))[_0xbb8c('0x43')](handleError(_0x599e51,null));};exports[_0xbb8c('0x4a')]=function(_0x211aac,_0x83b509,_0x415374){return db['CmHopperFinal'][_0xbb8c('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x211aac[_0xbb8c('0x49')]['id']},'attributes':[[db[_0xbb8c('0x4b')]['fn']('COUNT',db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')](_0xbb8c('0x4d')))),_0xbb8c('0x4e')],[db[_0xbb8c('0x4b')]['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0xbb8c('0x50')],[db['sequelize']['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')](_0xbb8c('0x51')))),'busyContacts'],[db[_0xbb8c('0x4b')]['fn']('COUNT',db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0xbb8c('0x52')],[db[_0xbb8c('0x4b')]['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')](_0xbb8c('0x53')))),_0xbb8c('0x54')],[db[_0xbb8c('0x4b')]['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xbb8c('0x4b')]['fn'](_0xbb8c('0x4f'),db['sequelize']['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0xbb8c('0x55')],[db['sequelize']['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0xbb8c('0x56')]]})['then'](handleEntityNotFound(_0x83b509,null))[_0xbb8c('0x23')](respondWithResult(_0x83b509,null))['catch'](handleError(_0x83b509,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x1413ee,_0x5241ae,_0x13a433){return db[_0xbb8c('0x29')][_0xbb8c('0x42')]({'raw':![],'where':{'CampaignId':_0x1413ee[_0xbb8c('0x49')]['id']},'attributes':[[db[_0xbb8c('0x4b')]['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')](_0xbb8c('0x4d')))),_0xbb8c('0x4e')],[db[_0xbb8c('0x4b')]['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0xbb8c('0x50')],[db['sequelize']['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')]['literal'](_0xbb8c('0x51')))),_0xbb8c('0x57')],[db['sequelize']['fn'](_0xbb8c('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xbb8c('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0xbb8c('0x52')],[db['sequelize']['fn'](_0xbb8c('0x4f'),db['sequelize']['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xbb8c('0x54')],[db[_0xbb8c('0x4b')]['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')]['literal'](_0xbb8c('0x58')))),_0xbb8c('0x59')],[db['sequelize']['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db['sequelize'][_0xbb8c('0x4c')](_0xbb8c('0x5a')))),_0xbb8c('0x55')],[db['sequelize']['fn'](_0xbb8c('0x4f'),db[_0xbb8c('0x4b')]['fn']('IF',db[_0xbb8c('0x4b')][_0xbb8c('0x4c')](_0xbb8c('0x5b')))),_0xbb8c('0x56')]]})[_0xbb8c('0x23')](handleEntityNotFound(_0x5241ae,null))[_0xbb8c('0x23')](respondWithResult(_0x5241ae,null))[_0xbb8c('0x43')](handleError(_0x5241ae,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x3178e6,_0xb9c1cf,_0x5d64e3){return db[_0xbb8c('0x5c')][_0xbb8c('0x44')]({'where':{'id':_0x3178e6[_0xbb8c('0x49')]['id']}})[_0xbb8c('0x23')](handleEntityNotFound(_0xb9c1cf,null))[_0xbb8c('0x23')](function(_0x56f234){var _0x172b76;if(_0x56f234){_0x172b76=squel[_0xbb8c('0x5d')]()[_0xbb8c('0x5e')]('cm_hopper')[_0xbb8c('0x5f')]([_0xbb8c('0x60'),_0xbb8c('0x61'),_0xbb8c('0x62'),_0xbb8c('0x63'),'VoiceQueueId','createdAt',_0xbb8c('0x64')],squel[_0xbb8c('0x65')]()[_0xbb8c('0x66')](_0xbb8c('0x67'),_0xbb8c('0x60'))[_0xbb8c('0x66')](_0xbb8c('0x68'),_0xbb8c('0x61'))['field'](_0xbb8c('0x69'),'ContactId')[_0xbb8c('0x66')](_0xbb8c('0x6a'),'ListId')['field'](_0xbb8c('0x6b'),'VoiceQueueId')['field'](_0xbb8c('0x68'),_0xbb8c('0x6c'))[_0xbb8c('0x66')](_0xbb8c('0x68'),_0xbb8c('0x64'))[_0xbb8c('0x6d')](_0xbb8c('0x6e'))[_0xbb8c('0x3b')](_0xbb8c('0x6f'),_0x3178e6[_0xbb8c('0x49')]['id'][_0xbb8c('0x70')]())['where'](_0xbb8c('0x71'),_0x3178e6[_0xbb8c('0x47')][_0xbb8c('0x72')][_0xbb8c('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0xbb8c('0x3b')](_0xbb8c('0x73'),squel[_0xbb8c('0x65')]()['field'](_0xbb8c('0x60'))[_0xbb8c('0x6d')]('cm_hopper')[_0xbb8c('0x3b')](_0xbb8c('0x6f'),_0x3178e6['params']['id'][_0xbb8c('0x70')]()))[_0xbb8c('0x3b')](_0xbb8c('0x73'),squel[_0xbb8c('0x65')]()[_0xbb8c('0x66')]('calleridnum')['from'](_0xbb8c('0x6e'))[_0xbb8c('0x3b')](_0xbb8c('0x6f'),_0x3178e6[_0xbb8c('0x49')]['id'][_0xbb8c('0x70')]())[_0xbb8c('0x3b')](_0xbb8c('0x74')))[_0xbb8c('0x75')]('ContactId'))[_0xbb8c('0x70')]();return db[_0xbb8c('0x4b')][_0xbb8c('0x2f')](_0x172b76);}return[];})[_0xbb8c('0x23')](respondWithResult(_0xb9c1cf,null))[_0xbb8c('0x43')](handleError(_0xb9c1cf,null));};exports[_0xbb8c('0x76')]=function(_0x23f823,_0x6cce0a,_0x2d377d){return db['Campaign'][_0xbb8c('0x44')]({'where':{'id':_0x23f823[_0xbb8c('0x49')]['id']}})[_0xbb8c('0x23')](handleEntityNotFound(_0x6cce0a,null))['then'](function(_0x9d7234){var _0x3cc59d;if(_0x9d7234){_0x3cc59d=squel[_0xbb8c('0x5d')]()[_0xbb8c('0x5e')](_0xbb8c('0x77'))[_0xbb8c('0x5f')]([_0xbb8c('0x60'),_0xbb8c('0x61'),_0xbb8c('0x62'),_0xbb8c('0x63'),_0xbb8c('0x78'),_0xbb8c('0x6c'),_0xbb8c('0x64')],squel[_0xbb8c('0x65')]()[_0xbb8c('0x66')](_0xbb8c('0x67'),_0xbb8c('0x60'))['field'](_0xbb8c('0x68'),_0xbb8c('0x61'))[_0xbb8c('0x66')](_0xbb8c('0x69'),_0xbb8c('0x62'))['field']('ANY_VALUE(ListId)',_0xbb8c('0x63'))[_0xbb8c('0x66')]('ANY_VALUE(CampaignId)',_0xbb8c('0x78'))[_0xbb8c('0x66')](_0xbb8c('0x68'),_0xbb8c('0x6c'))['field'](_0xbb8c('0x68'),_0xbb8c('0x64'))[_0xbb8c('0x6d')](_0xbb8c('0x6e'))[_0xbb8c('0x3b')](_0xbb8c('0x79'),_0x23f823['params']['id'][_0xbb8c('0x70')]())['where']('state\x20=\x20?',_0x23f823['body']['state'][_0xbb8c('0x70')]())[_0xbb8c('0x3b')](_0xbb8c('0x7a'))[_0xbb8c('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xbb8c('0x65')]()['field'](_0xbb8c('0x60'))[_0xbb8c('0x6d')](_0xbb8c('0x77'))[_0xbb8c('0x3b')](_0xbb8c('0x79'),_0x23f823[_0xbb8c('0x49')]['id'][_0xbb8c('0x70')]()))[_0xbb8c('0x3b')](_0xbb8c('0x73'),squel[_0xbb8c('0x65')]()['field'](_0xbb8c('0x7b'))[_0xbb8c('0x6d')](_0xbb8c('0x6e'))[_0xbb8c('0x3b')](_0xbb8c('0x79'),_0x23f823[_0xbb8c('0x49')]['id'][_0xbb8c('0x70')]())[_0xbb8c('0x3b')](_0xbb8c('0x74')))[_0xbb8c('0x75')](_0xbb8c('0x62')))[_0xbb8c('0x70')]();return db[_0xbb8c('0x4b')][_0xbb8c('0x2f')](_0x3cc59d);}return[];})[_0xbb8c('0x23')](respondWithResult(_0x6cce0a,null))[_0xbb8c('0x43')](handleError(_0x6cce0a,null));};exports['checkContactHopper']=function(_0x25a9d9,_0x2e6f27,_0x46934c){return db[_0xbb8c('0x7c')][_0xbb8c('0x7d')]({'where':{'VoiceQueueId':_0x25a9d9[_0xbb8c('0x47')][_0xbb8c('0x7e')],'CampaignId':_0x25a9d9['body'][_0xbb8c('0x78')],'ContactId':_0x25a9d9[_0xbb8c('0x47')][_0xbb8c('0x62')]}})['then'](handleEntityNotFound(_0x2e6f27,null))[_0xbb8c('0x23')](function(_0x2eae73){if(_0x2eae73){return _0x2eae73;}return null;})[_0xbb8c('0x23')](respondWithResult(_0x2e6f27,null))['catch'](handleError(_0x2e6f27,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 56ac556..855862e 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 _0x789a=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x789a,0x144));var _0xa789=function(_0xe70093,_0x194ce3){_0xe70093=_0xe70093-0x0;var _0x2cbe43=_0x789a[_0xe70093];return _0x2cbe43;};'use strict';var _=require('lodash');var util=require(_0xa789('0x0'));var logger=require(_0xa789('0x1'))('api');var moment=require(_0xa789('0x2'));var BPromise=require(_0xa789('0x3'));var rp=require(_0xa789('0x4'));var fs=require('fs');var path=require(_0xa789('0x5'));var rimraf=require(_0xa789('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xa789('0x7')]=function(_0x27985f,_0x28ad05){return _0x27985f[_0xa789('0x8')](_0xa789('0x9'),attributes,{'tableName':_0xa789('0xa'),'paranoid':![],'indexes':[{'name':_0xa789('0xb'),'fields':[_0xa789('0xb')]},{'name':_0xa789('0xc'),'fields':[_0xa789('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17cb=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x17cb,0x6b));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb17c('0x0'));var util=require(_0xb17c('0x1'));var logger=require(_0xb17c('0x2'))(_0xb17c('0x3'));var moment=require(_0xb17c('0x4'));var BPromise=require(_0xb17c('0x5'));var rp=require(_0xb17c('0x6'));var fs=require('fs');var path=require(_0xb17c('0x7'));var rimraf=require(_0xb17c('0x8'));var config=require(_0xb17c('0x9'));var attributes=require(_0xb17c('0xa'));module[_0xb17c('0xb')]=function(_0x18e1c3,_0x5efd1c){return _0x18e1c3[_0xb17c('0xc')](_0xb17c('0xd'),attributes,{'tableName':_0xb17c('0xe'),'paranoid':![],'indexes':[{'name':_0xb17c('0xf'),'fields':[_0xb17c('0xf')]},{'name':_0xb17c('0x10'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 17276d8..2f8b06f 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 _0x9b34=['CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','options','raw','then','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf13ca6,_0x5735ea){var _0x4a4387=function(_0x103f67){while(--_0x103f67){_0xf13ca6['push'](_0xf13ca6['shift']());}};_0x4a4387(++_0x5735ea);}(_0x9b34,0xd4));var _0x49b3=function(_0x4184b0,_0x44896d){_0x4184b0=_0x4184b0-0x0;var _0xd9327f=_0x9b34[_0x4184b0];return _0xd9327f;};'use strict';var _=require('lodash');var util=require(_0x49b3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x49b3('0x1'));var fs=require('fs');var Redis=require(_0x49b3('0x2'));var db=require(_0x49b3('0x3'))['db'];var utils=require(_0x49b3('0x4'));var logger=require(_0x49b3('0x5'))('rpc');var config=require(_0x49b3('0x6'));var jayson=require(_0x49b3('0x7'));var client=jayson[_0x49b3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea3ed,_0x173aa7,_0x309cf4){return new BPromise(function(_0x3533a0,_0x1feb35){return client['request'](_0x3ea3ed,_0x309cf4)['then'](function(_0x1d029a){logger[_0x49b3('0x9')](_0x49b3('0xa'),_0x173aa7,_0x49b3('0xb'));logger[_0x49b3('0xc')](_0x49b3('0xd'),_0x173aa7,'request\x20sent',JSON[_0x49b3('0xe')](_0x1d029a));if(_0x1d029a[_0x49b3('0xf')]){if(_0x1d029a[_0x49b3('0xf')]['code']===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x173aa7,_0x1d029a[_0x49b3('0xf')][_0x49b3('0x10')]);return _0x1feb35(_0x1d029a[_0x49b3('0xf')][_0x49b3('0x10')]);}logger[_0x49b3('0xf')](_0x49b3('0xa'),_0x173aa7,_0x1d029a[_0x49b3('0xf')][_0x49b3('0x10')]);return _0x3533a0(_0x1d029a[_0x49b3('0xf')]['message']);}else{logger[_0x49b3('0x9')](_0x49b3('0xa'),_0x173aa7,_0x49b3('0xb'));_0x3533a0(_0x1d029a[_0x49b3('0x11')]['message']);}})[_0x49b3('0x12')](function(_0x369300){logger[_0x49b3('0xf')](_0x49b3('0xa'),_0x173aa7,_0x369300);_0x1feb35(_0x369300);});});}exports[_0x49b3('0x13')]=function(_0x293c31){var _0x179a0a=this;return new Promise(function(_0x4a5a50,_0x22e543){return db[_0x49b3('0x14')][_0x49b3('0x15')](_0x293c31['body'],{'raw':_0x293c31['options']?_0x293c31[_0x49b3('0x16')][_0x49b3('0x17')]===undefined?!![]:![]:!![]})[_0x49b3('0x18')](function(_0x308781){logger[_0x49b3('0x9')]('CreateCmHopperFinal',_0x293c31);logger[_0x49b3('0xc')]('CreateCmHopperFinal',_0x293c31,JSON[_0x49b3('0xe')](_0x308781));_0x4a5a50(_0x308781);})[_0x49b3('0x12')](function(_0x14d8bf){logger['error'](_0x49b3('0x13'),_0x14d8bf[_0x49b3('0x10')],_0x293c31);_0x22e543(_0x179a0a[_0x49b3('0xf')](0x1f4,_0x14d8bf[_0x49b3('0x10')]));});});}; \ No newline at end of file +var _0x7bb8=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','util','moment'];(function(_0x210526,_0x31d180){var _0x7da38e=function(_0x3470a4){while(--_0x3470a4){_0x210526['push'](_0x210526['shift']());}};_0x7da38e(++_0x31d180);}(_0x7bb8,0xe8));var _0x87bb=function(_0x4e0814,_0x3cf45a){_0x4e0814=_0x4e0814-0x0;var _0x1bdeb0=_0x7bb8[_0x4e0814];return _0x1bdeb0;};'use strict';var _=require('lodash');var util=require(_0x87bb('0x0'));var moment=require(_0x87bb('0x1'));var BPromise=require(_0x87bb('0x2'));var rs=require(_0x87bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87bb('0x4'))['db'];var utils=require(_0x87bb('0x5'));var logger=require('../../config/logger')(_0x87bb('0x6'));var config=require(_0x87bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x87bb('0x8')][_0x87bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e6e14,_0x5b4edf,_0x317bba){return new BPromise(function(_0x11d858,_0x1eca7d){return client['request'](_0x5e6e14,_0x317bba)[_0x87bb('0xa')](function(_0x44464e){logger[_0x87bb('0xb')](_0x87bb('0xc'),_0x5b4edf,_0x87bb('0xd'));logger[_0x87bb('0xe')](_0x87bb('0xf'),_0x5b4edf,_0x87bb('0xd'),JSON[_0x87bb('0x10')](_0x44464e));if(_0x44464e[_0x87bb('0x11')]){if(_0x44464e[_0x87bb('0x11')][_0x87bb('0x12')]===0x1f4){logger['error'](_0x87bb('0xc'),_0x5b4edf,_0x44464e[_0x87bb('0x11')][_0x87bb('0x13')]);return _0x1eca7d(_0x44464e[_0x87bb('0x11')][_0x87bb('0x13')]);}logger[_0x87bb('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x5b4edf,_0x44464e[_0x87bb('0x11')][_0x87bb('0x13')]);return _0x11d858(_0x44464e[_0x87bb('0x11')][_0x87bb('0x13')]);}else{logger['info'](_0x87bb('0xc'),_0x5b4edf,'request\x20sent');_0x11d858(_0x44464e['result']['message']);}})['catch'](function(_0x429266){logger[_0x87bb('0x11')](_0x87bb('0xc'),_0x5b4edf,_0x429266);_0x1eca7d(_0x429266);});});}exports['CreateCmHopperFinal']=function(_0x3505fa){var _0x1442c7=this;return new Promise(function(_0x29dd42,_0x456c5d){return db[_0x87bb('0x14')][_0x87bb('0x15')](_0x3505fa[_0x87bb('0x16')],{'raw':_0x3505fa[_0x87bb('0x17')]?_0x3505fa[_0x87bb('0x17')][_0x87bb('0x18')]===undefined?!![]:![]:!![]})[_0x87bb('0xa')](function(_0x913750){logger[_0x87bb('0xb')](_0x87bb('0x19'),_0x3505fa);logger[_0x87bb('0xe')](_0x87bb('0x19'),_0x3505fa,JSON[_0x87bb('0x10')](_0x913750));_0x29dd42(_0x913750);})['catch'](function(_0xa33caa){logger[_0x87bb('0x11')]('CreateCmHopperFinal',_0xa33caa[_0x87bb('0x13')],_0x3505fa);_0x456c5d(_0x1442c7[_0x87bb('0x11')](0x1f4,_0xa33caa[_0x87bb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 773a3d9..1cae379 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 _0x42cd=['index','isAuthenticated','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','./cmHopperFinal.controller','get'];(function(_0x13874b,_0x969d79){var _0x57a2fd=function(_0x4d6651){while(--_0x4d6651){_0x13874b['push'](_0x13874b['shift']());}};_0x57a2fd(++_0x969d79);}(_0x42cd,0x169));var _0xd42c=function(_0x5aad6b,_0x2cd875){_0x5aad6b=_0x5aad6b-0x0;var _0x11654b=_0x42cd[_0x5aad6b];return _0x11654b;};'use strict';var multer=require(_0xd42c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd42c('0x1'));var express=require(_0xd42c('0x2'));var router=express[_0xd42c('0x3')]();var auth=require(_0xd42c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd42c('0x5'));router[_0xd42c('0x6')]('/',auth['isAuthenticated'](),controller[_0xd42c('0x7')]);router[_0xd42c('0x6')]('/describe',auth[_0xd42c('0x8')](),controller[_0xd42c('0x9')]);router['get'](_0xd42c('0xa'),auth['isAuthenticated'](),controller[_0xd42c('0xb')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xd42c('0x8')](),controller[_0xd42c('0xc')]);router[_0xd42c('0x6')](_0xd42c('0xd'),auth[_0xd42c('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xd42c('0xe')](_0xd42c('0xf'),auth[_0xd42c('0x8')](),controller[_0xd42c('0x10')]);router[_0xd42c('0xe')](_0xd42c('0x11'),auth[_0xd42c('0x8')](),controller[_0xd42c('0x12')]);router[_0xd42c('0xe')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0xd42c('0x13')]);router[_0xd42c('0x14')](_0xd42c('0xa'),auth[_0xd42c('0x8')](),controller[_0xd42c('0x15')]);module[_0xd42c('0x16')]=router; \ No newline at end of file +var _0xe85c=['../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x532399,_0x3d32a3){var _0x113bcb=function(_0x39ca57){while(--_0x39ca57){_0x532399['push'](_0x532399['shift']());}};_0x113bcb(++_0x3d32a3);}(_0xe85c,0x19d));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require('util');var path=require(_0xce85('0x1'));var timeout=require(_0xce85('0x2'));var express=require(_0xce85('0x3'));var router=express[_0xce85('0x4')]();var auth=require(_0xce85('0x5'));var interaction=require(_0xce85('0x6'));var config=require(_0xce85('0x7'));var controller=require(_0xce85('0x8'));router[_0xce85('0x9')]('/',auth[_0xce85('0xa')](),controller[_0xce85('0xb')]);router[_0xce85('0x9')](_0xce85('0xc'),auth[_0xce85('0xa')](),controller[_0xce85('0xd')]);router[_0xce85('0x9')](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0xf')]);router[_0xce85('0x9')](_0xce85('0x10'),auth[_0xce85('0xa')](),controller[_0xce85('0x11')]);router['get'](_0xce85('0x12'),auth[_0xce85('0xa')](),controller[_0xce85('0x13')]);router[_0xce85('0x14')](_0xce85('0x15'),auth[_0xce85('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xce85('0x14')](_0xce85('0x16'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xce85('0x14')](_0xce85('0x17'),auth[_0xce85('0xa')](),controller[_0xce85('0x18')]);router[_0xce85('0x19')](_0xce85('0xe'),auth['isAuthenticated'](),controller[_0xce85('0x1a')]);module[_0xce85('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a2271ce..9571273 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 _0x2e59=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2e59,0x1d9));var _0x92e5=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x2e59[_0x4164f2];return _0x2575c7;};'use strict';var Sequelize=require(_0x92e5('0x0'));module[_0x92e5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x92e5('0x2')]},'scheduledat':{'type':Sequelize[_0x92e5('0x3')]},'countbusyretry':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x92e5('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x92e5('0x2')]},'originatecalleridname':{'type':Sequelize[_0x92e5('0x2')]},'calleridnum':{'type':Sequelize[_0x92e5('0x2')]},'calleridname':{'type':Sequelize[_0x92e5('0x2')]},'starttime':{'type':Sequelize[_0x92e5('0x3')]},'responsetime':{'type':Sequelize[_0x92e5('0x3')]},'answertime':{'type':Sequelize[_0x92e5('0x3')]},'droptime':{'type':Sequelize[_0x92e5('0x3')]},'endtime':{'type':Sequelize[_0x92e5('0x3')]},'ringtime':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x92e5('0x2')]},'campaign':{'type':Sequelize[_0x92e5('0x2')]},'campaigntype':{'type':Sequelize[_0x92e5('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x92e5('0x2')]},'amd':{'type':Sequelize[_0x92e5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x92e5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x92e5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x92e5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x92e5('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x92e5('0x3')]},'edited':{'type':Sequelize[_0x92e5('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x92e5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb8fb=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x486be3,_0x447bf4){var _0x16cac8=function(_0x465c80){while(--_0x465c80){_0x486be3['push'](_0x486be3['shift']());}};_0x16cac8(++_0x447bf4);}(_0xb8fb,0x14c));var _0xbb8f=function(_0xbd9ddc,_0x48305a){_0xbd9ddc=_0xbd9ddc-0x0;var _0x295d8e=_0xb8fb[_0xbd9ddc];return _0x295d8e;};'use strict';var Sequelize=require(_0xbb8f('0x0'));module[_0xbb8f('0x1')]={'state':{'type':Sequelize[_0xbb8f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbb8f('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbb8f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbb8f('0x3')]},'originatecalleridname':{'type':Sequelize[_0xbb8f('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbb8f('0x3')]},'starttime':{'type':Sequelize[_0xbb8f('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xbb8f('0x4')]},'endtime':{'type':Sequelize[_0xbb8f('0x4')]},'ringtime':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbb8f('0x3')]},'campaign':{'type':Sequelize[_0xbb8f('0x3')]},'campaigntype':{'type':Sequelize[_0xbb8f('0x3')]},'membername':{'type':Sequelize[_0xbb8f('0x3')]},'reason':{'type':Sequelize[_0xbb8f('0x3')]},'amd':{'type':Sequelize[_0xbb8f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbb8f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xbb8f('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbb8f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xbb8f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbb8f('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbb8f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbb8f('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 4f9fdfe..4c514af 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 _0x2618=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','error','stack','name','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','includeAll','findAll','rows','catch','options','then','body','describe','uniqueid','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2618,0x156));var _0x8261=function(_0xb29616,_0x1614aa){_0xb29616=_0xb29616-0x0;var _0x377a9d=_0x2618[_0xb29616];return _0x377a9d;};'use strict';var pdf=require(_0x8261('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8261('0x1'));var zipdir=require(_0x8261('0x2'));var jsonpatch=require(_0x8261('0x3'));var rp=require(_0x8261('0x4'));var moment=require('moment');var BPromise=require(_0x8261('0x5'));var Mustache=require(_0x8261('0x6'));var util=require('util');var path=require(_0x8261('0x7'));var sox=require(_0x8261('0x8'));var csv=require(_0x8261('0x9'));var ejs=require(_0x8261('0xa'));var fs=require('fs');var _=require(_0x8261('0xb'));var squel=require(_0x8261('0xc'));var crypto=require(_0x8261('0xd'));var jsforce=require(_0x8261('0xe'));var deskjs=require(_0x8261('0xf'));var toCsv=require(_0x8261('0x9'));var querystring=require(_0x8261('0x10'));var Papa=require(_0x8261('0x11'));var Redis=require(_0x8261('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8261('0x13'));var as=require(_0x8261('0x14'));var hardwareService=require(_0x8261('0x15'));var logger=require(_0x8261('0x16'))('api');var utils=require(_0x8261('0x17'));var config=require(_0x8261('0x18'));var db=require(_0x8261('0x19'))['db'];function respondWithStatusCode(_0x58f40c,_0x4efdce){_0x4efdce=_0x4efdce||0xcc;return function(_0x3d113c){if(_0x3d113c){return _0x58f40c[_0x8261('0x1a')](_0x4efdce);}return _0x58f40c[_0x8261('0x1b')](_0x4efdce)[_0x8261('0x1c')]();};}function respondWithResult(_0x21da37,_0x7e6800){_0x7e6800=_0x7e6800||0xc8;return function(_0x177da7){if(_0x177da7){return _0x21da37[_0x8261('0x1b')](_0x7e6800)[_0x8261('0x1d')](_0x177da7);}};}function respondWithFilteredResult(_0x35b9ea,_0x2d5e5d){return function(_0x4747a4){if(_0x4747a4){var _0x48cc18=_0x4747a4['count'],_0x58a545=_0x2d5e5d[_0x8261('0x1e')],_0x3bb076=_0x2d5e5d[_0x8261('0x1e')]+_0x2d5e5d[_0x8261('0x1f')],_0x52bec2;if(_0x3bb076>=_0x48cc18){_0x3bb076=_0x48cc18;_0x52bec2=0xc8;}else{_0x52bec2=0xce;}_0x35b9ea['status'](_0x52bec2);return _0x35b9ea['set']('Content-Range',_0x58a545+'-'+_0x3bb076+'/'+_0x48cc18)[_0x8261('0x1d')](_0x4747a4);}return null;};}function patchUpdates(_0x3d1d31){return function(_0x2a3694){try{jsonpatch[_0x8261('0x20')](_0x2a3694,_0x3d1d31,!![]);}catch(_0x4780d2){return BPromise[_0x8261('0x21')](_0x4780d2);}return _0x2a3694[_0x8261('0x22')]();};}function saveUpdates(_0x2ef2eb,_0x124d39){return function(_0x1864a0){if(_0x1864a0){return _0x1864a0[_0x8261('0x23')](_0x2ef2eb)['then'](function(_0x44c930){return _0x44c930;});}return null;};}function removeEntity(_0x4c6bf6,_0xf98f52){return function(_0x2bc29f){if(_0x2bc29f){return _0x2bc29f['destroy']()['then'](function(){_0x4c6bf6[_0x8261('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a33c9,_0x1d49d1){return function(_0x5dd5f1){if(!_0x5dd5f1){_0x2a33c9[_0x8261('0x1a')](0x194);}return _0x5dd5f1;};}function handleError(_0x2e72f1,_0x5d2120){_0x5d2120=_0x5d2120||0x1f4;return function(_0x9c9679){logger[_0x8261('0x24')](_0x9c9679[_0x8261('0x25')]);if(_0x9c9679[_0x8261('0x26')]){delete _0x9c9679[_0x8261('0x26')];}_0x2e72f1[_0x8261('0x1b')](_0x5d2120)['send'](_0x9c9679);};}exports[_0x8261('0x27')]=function(_0x2bef4a,_0x6369c){var _0x59e883={},_0x599732={},_0x26cc6a={'count':0x0,'rows':[]};var _0x3fe78e=_['map'](db[_0x8261('0x28')][_0x8261('0x29')],function(_0x1ebf7f){return{'name':_0x1ebf7f[_0x8261('0x2a')],'type':_0x1ebf7f[_0x8261('0x2b')][_0x8261('0x2c')]};});_0x599732[_0x8261('0x2d')]=_[_0x8261('0x2e')](_0x3fe78e,_0x8261('0x26'));_0x599732[_0x8261('0x2f')]=_[_0x8261('0x30')](_0x2bef4a[_0x8261('0x2f')]);_0x599732['filters']=_[_0x8261('0x31')](_0x599732[_0x8261('0x2d')],_0x599732['query']);_0x59e883[_0x8261('0x32')]=_[_0x8261('0x31')](_0x599732['model'],qs[_0x8261('0x33')](_0x2bef4a[_0x8261('0x2f')][_0x8261('0x33')]));_0x59e883['attributes']=_0x59e883[_0x8261('0x32')][_0x8261('0x34')]?_0x59e883[_0x8261('0x32')]:_0x599732['model'];if(!_0x2bef4a['query'][_0x8261('0x35')]('nolimit')){_0x59e883[_0x8261('0x1f')]=qs[_0x8261('0x1f')](_0x2bef4a[_0x8261('0x2f')][_0x8261('0x1f')]);_0x59e883[_0x8261('0x1e')]=qs[_0x8261('0x1e')](_0x2bef4a[_0x8261('0x2f')][_0x8261('0x1e')]);}_0x59e883[_0x8261('0x36')]=qs['sort'](_0x2bef4a[_0x8261('0x2f')][_0x8261('0x37')]);_0x59e883['where']=qs[_0x8261('0x38')](_[_0x8261('0x39')](_0x2bef4a[_0x8261('0x2f')],_0x599732[_0x8261('0x38')]),_0x3fe78e);if(_0x2bef4a[_0x8261('0x2f')]['filter']){_0x59e883[_0x8261('0x3a')]=_[_0x8261('0x3b')](_0x59e883[_0x8261('0x3a')],{'$or':_['map'](_0x3fe78e,function(_0x19821a){if(_0x19821a[_0x8261('0x2b')]!==_0x8261('0x3c')){var _0x3d6575={};_0x3d6575[_0x19821a[_0x8261('0x26')]]={'$like':'%'+_0x2bef4a['query']['filter']+'%'};return _0x3d6575;}})});}_0x59e883=_['merge']({},_0x59e883,_0x2bef4a['options']);var _0xe7c44e={'where':_0x59e883[_0x8261('0x3a')]};return db[_0x8261('0x28')]['count'](_0xe7c44e)['then'](function(_0x31aaea){_0x26cc6a['count']=_0x31aaea;if(_0x2bef4a['query'][_0x8261('0x3d')]){_0x59e883['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x8261('0x3e')](_0x59e883);})['then'](function(_0xaec864){_0x26cc6a[_0x8261('0x3f')]=_0xaec864;return _0x26cc6a;})['then'](respondWithFilteredResult(_0x6369c,_0x59e883))[_0x8261('0x40')](handleError(_0x6369c,null));};exports['show']=function(_0x4186cd,_0x1deac8){var _0x3577aa={'raw':!![],'where':{'id':_0x4186cd['params']['id']}},_0x4b9db2={};_0x4b9db2[_0x8261('0x2d')]=_['keys'](db[_0x8261('0x28')]['rawAttributes']);_0x4b9db2[_0x8261('0x2f')]=_[_0x8261('0x30')](_0x4186cd['query']);_0x4b9db2['filters']=_[_0x8261('0x31')](_0x4b9db2['model'],_0x4b9db2['query']);_0x3577aa[_0x8261('0x32')]=_[_0x8261('0x31')](_0x4b9db2[_0x8261('0x2d')],qs[_0x8261('0x33')](_0x4186cd[_0x8261('0x2f')][_0x8261('0x33')]));_0x3577aa['attributes']=_0x3577aa[_0x8261('0x32')][_0x8261('0x34')]?_0x3577aa[_0x8261('0x32')]:_0x4b9db2['model'];if(_0x4186cd[_0x8261('0x2f')][_0x8261('0x3d')]){_0x3577aa['include']=[{'all':!![]}];}_0x3577aa=_['merge']({},_0x3577aa,_0x4186cd[_0x8261('0x41')]);return db[_0x8261('0x28')]['find'](_0x3577aa)[_0x8261('0x42')](handleEntityNotFound(_0x1deac8,null))['then'](respondWithResult(_0x1deac8,null))[_0x8261('0x40')](handleError(_0x1deac8,null));};exports['create']=function(_0x308aed,_0x343431){return db['CmHopperHistory']['create'](_0x308aed[_0x8261('0x43')],{})[_0x8261('0x42')](respondWithResult(_0x343431,0xc9))[_0x8261('0x40')](handleError(_0x343431,null));};exports[_0x8261('0x44')]=function(_0x52dcbe,_0x1540f7){return db['CmHopperHistory']['describe']()[_0x8261('0x42')](respondWithResult(_0x1540f7,null))[_0x8261('0x40')](handleError(_0x1540f7,null));};exports[_0x8261('0x23')]=function(_0x558539,_0x4a4f51){if(_0x558539['body'][_0x8261('0x45')]){delete _0x558539[_0x8261('0x43')][_0x8261('0x45')];}return db[_0x8261('0x28')][_0x8261('0x46')]({'where':{'uniqueid':_0x558539[_0x8261('0x47')]['id']}})[_0x8261('0x42')](handleEntityNotFound(_0x4a4f51,null))['then'](saveUpdates(_0x558539['body'],null))[_0x8261('0x42')](respondWithResult(_0x4a4f51,null))[_0x8261('0x40')](handleError(_0x4a4f51,null));}; \ No newline at end of file +var _0xde27=['attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x51be98,_0x2c1e31){var _0x5a9bee=function(_0x1b3e03){while(--_0x1b3e03){_0x51be98['push'](_0x51be98['shift']());}};_0x5a9bee(++_0x2c1e31);}(_0xde27,0x19d));var _0x7de2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xde27[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0x7de2('0x0'));var emlformat=require(_0x7de2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7de2('0x2'));var jsonpatch=require(_0x7de2('0x3'));var rp=require(_0x7de2('0x4'));var moment=require(_0x7de2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7de2('0x6'));var path=require(_0x7de2('0x7'));var sox=require('sox');var csv=require(_0x7de2('0x8'));var ejs=require(_0x7de2('0x9'));var fs=require('fs');var _=require(_0x7de2('0xa'));var squel=require(_0x7de2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7de2('0xc'));var toCsv=require(_0x7de2('0x8'));var querystring=require(_0x7de2('0xd'));var Papa=require(_0x7de2('0xe'));var Redis=require(_0x7de2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7de2('0x10'));var as=require(_0x7de2('0x11'));var hardwareService=require(_0x7de2('0x12'));var logger=require(_0x7de2('0x13'))('api');var utils=require(_0x7de2('0x14'));var config=require(_0x7de2('0x15'));var db=require(_0x7de2('0x16'))['db'];function respondWithStatusCode(_0x1dfd38,_0x2ae5d8){_0x2ae5d8=_0x2ae5d8||0xcc;return function(_0x4ad69c){if(_0x4ad69c){return _0x1dfd38[_0x7de2('0x17')](_0x2ae5d8);}return _0x1dfd38[_0x7de2('0x18')](_0x2ae5d8)['end']();};}function respondWithResult(_0x408210,_0x46db8f){_0x46db8f=_0x46db8f||0xc8;return function(_0x5afc41){if(_0x5afc41){return _0x408210['status'](_0x46db8f)[_0x7de2('0x19')](_0x5afc41);}};}function respondWithFilteredResult(_0x3b47a8,_0x5063b3){return function(_0x5d86ee){if(_0x5d86ee){var _0x59f848=_0x5d86ee['count'],_0xfe5318=_0x5063b3[_0x7de2('0x1a')],_0x12f733=_0x5063b3[_0x7de2('0x1a')]+_0x5063b3['limit'],_0x6a51ea;if(_0x12f733>=_0x59f848){_0x12f733=_0x59f848;_0x6a51ea=0xc8;}else{_0x6a51ea=0xce;}_0x3b47a8[_0x7de2('0x18')](_0x6a51ea);return _0x3b47a8[_0x7de2('0x1b')]('Content-Range',_0xfe5318+'-'+_0x12f733+'/'+_0x59f848)[_0x7de2('0x19')](_0x5d86ee);}return null;};}function patchUpdates(_0x5eb082){return function(_0x43f444){try{jsonpatch[_0x7de2('0x1c')](_0x43f444,_0x5eb082,!![]);}catch(_0x3ab38c){return BPromise[_0x7de2('0x1d')](_0x3ab38c);}return _0x43f444[_0x7de2('0x1e')]();};}function saveUpdates(_0x4fd208,_0x156cb4){return function(_0x22bde7){if(_0x22bde7){return _0x22bde7[_0x7de2('0x1f')](_0x4fd208)[_0x7de2('0x20')](function(_0x40226e){return _0x40226e;});}return null;};}function removeEntity(_0x40ae36,_0x12f85d){return function(_0x2c3208){if(_0x2c3208){return _0x2c3208[_0x7de2('0x21')]()['then'](function(){_0x40ae36[_0x7de2('0x18')](0xcc)[_0x7de2('0x22')]();});}};}function handleEntityNotFound(_0x4c5d09,_0x2de31a){return function(_0x40202e){if(!_0x40202e){_0x4c5d09['sendStatus'](0x194);}return _0x40202e;};}function handleError(_0x3fd635,_0x548c57){_0x548c57=_0x548c57||0x1f4;return function(_0x5f1b79){logger[_0x7de2('0x23')](_0x5f1b79[_0x7de2('0x24')]);if(_0x5f1b79[_0x7de2('0x25')]){delete _0x5f1b79[_0x7de2('0x25')];}_0x3fd635[_0x7de2('0x18')](_0x548c57)[_0x7de2('0x26')](_0x5f1b79);};}exports[_0x7de2('0x27')]=function(_0x1baf47,_0x5f033b){var _0x2daee1={},_0x1c6da5={},_0x149024={'count':0x0,'rows':[]};var _0x40f364=_[_0x7de2('0x28')](db[_0x7de2('0x29')][_0x7de2('0x2a')],function(_0x2ecbb2){return{'name':_0x2ecbb2[_0x7de2('0x2b')],'type':_0x2ecbb2['type'][_0x7de2('0x2c')]};});_0x1c6da5[_0x7de2('0x2d')]=_['map'](_0x40f364,'name');_0x1c6da5[_0x7de2('0x2e')]=_[_0x7de2('0x2f')](_0x1baf47['query']);_0x1c6da5[_0x7de2('0x30')]=_['intersection'](_0x1c6da5[_0x7de2('0x2d')],_0x1c6da5[_0x7de2('0x2e')]);_0x2daee1[_0x7de2('0x31')]=_[_0x7de2('0x32')](_0x1c6da5[_0x7de2('0x2d')],qs['fields'](_0x1baf47[_0x7de2('0x2e')][_0x7de2('0x33')]));_0x2daee1[_0x7de2('0x31')]=_0x2daee1['attributes'][_0x7de2('0x34')]?_0x2daee1[_0x7de2('0x31')]:_0x1c6da5[_0x7de2('0x2d')];if(!_0x1baf47[_0x7de2('0x2e')][_0x7de2('0x35')](_0x7de2('0x36'))){_0x2daee1[_0x7de2('0x37')]=qs['limit'](_0x1baf47[_0x7de2('0x2e')][_0x7de2('0x37')]);_0x2daee1[_0x7de2('0x1a')]=qs['offset'](_0x1baf47[_0x7de2('0x2e')][_0x7de2('0x1a')]);}_0x2daee1[_0x7de2('0x38')]=qs[_0x7de2('0x39')](_0x1baf47[_0x7de2('0x2e')]['sort']);_0x2daee1[_0x7de2('0x3a')]=qs[_0x7de2('0x30')](_[_0x7de2('0x3b')](_0x1baf47[_0x7de2('0x2e')],_0x1c6da5[_0x7de2('0x30')]),_0x40f364);if(_0x1baf47[_0x7de2('0x2e')][_0x7de2('0x3c')]){_0x2daee1[_0x7de2('0x3a')]=_['merge'](_0x2daee1[_0x7de2('0x3a')],{'$or':_[_0x7de2('0x28')](_0x40f364,function(_0x199dab){if(_0x199dab[_0x7de2('0x3d')]!==_0x7de2('0x3e')){var _0x267504={};_0x267504[_0x199dab[_0x7de2('0x25')]]={'$like':'%'+_0x1baf47[_0x7de2('0x2e')][_0x7de2('0x3c')]+'%'};return _0x267504;}})});}_0x2daee1=_[_0x7de2('0x3f')]({},_0x2daee1,_0x1baf47[_0x7de2('0x40')]);var _0x257ab8={'where':_0x2daee1[_0x7de2('0x3a')]};return db[_0x7de2('0x29')][_0x7de2('0x41')](_0x257ab8)[_0x7de2('0x20')](function(_0x11b342){_0x149024['count']=_0x11b342;if(_0x1baf47['query']['includeAll']){_0x2daee1[_0x7de2('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7de2('0x43')](_0x2daee1);})[_0x7de2('0x20')](function(_0x57c775){_0x149024[_0x7de2('0x44')]=_0x57c775;return _0x149024;})['then'](respondWithFilteredResult(_0x5f033b,_0x2daee1))[_0x7de2('0x45')](handleError(_0x5f033b,null));};exports[_0x7de2('0x46')]=function(_0x47413d,_0x219825){var _0x13b504={'raw':!![],'where':{'id':_0x47413d[_0x7de2('0x47')]['id']}},_0x4fef34={};_0x4fef34[_0x7de2('0x2d')]=_[_0x7de2('0x2f')](db[_0x7de2('0x29')][_0x7de2('0x2a')]);_0x4fef34[_0x7de2('0x2e')]=_[_0x7de2('0x2f')](_0x47413d[_0x7de2('0x2e')]);_0x4fef34[_0x7de2('0x30')]=_[_0x7de2('0x32')](_0x4fef34[_0x7de2('0x2d')],_0x4fef34['query']);_0x13b504[_0x7de2('0x31')]=_[_0x7de2('0x32')](_0x4fef34[_0x7de2('0x2d')],qs[_0x7de2('0x33')](_0x47413d['query']['fields']));_0x13b504[_0x7de2('0x31')]=_0x13b504[_0x7de2('0x31')]['length']?_0x13b504['attributes']:_0x4fef34[_0x7de2('0x2d')];if(_0x47413d[_0x7de2('0x2e')]['includeAll']){_0x13b504[_0x7de2('0x42')]=[{'all':!![]}];}_0x13b504=_[_0x7de2('0x3f')]({},_0x13b504,_0x47413d[_0x7de2('0x40')]);return db['CmHopperHistory'][_0x7de2('0x48')](_0x13b504)['then'](handleEntityNotFound(_0x219825,null))[_0x7de2('0x20')](respondWithResult(_0x219825,null))[_0x7de2('0x45')](handleError(_0x219825,null));};exports[_0x7de2('0x49')]=function(_0x586501,_0x2ae1fd){return db[_0x7de2('0x29')][_0x7de2('0x49')](_0x586501[_0x7de2('0x4a')],{})[_0x7de2('0x20')](respondWithResult(_0x2ae1fd,0xc9))[_0x7de2('0x45')](handleError(_0x2ae1fd,null));};exports[_0x7de2('0x4b')]=function(_0x40b3ba,_0xde235c){return db[_0x7de2('0x29')][_0x7de2('0x4b')]()[_0x7de2('0x20')](respondWithResult(_0xde235c,null))[_0x7de2('0x45')](handleError(_0xde235c,null));};exports['update']=function(_0x29bc6c,_0x33061c){if(_0x29bc6c[_0x7de2('0x4a')][_0x7de2('0x4c')]){delete _0x29bc6c[_0x7de2('0x4a')][_0x7de2('0x4c')];}return db[_0x7de2('0x29')][_0x7de2('0x48')]({'where':{'uniqueid':_0x29bc6c['params']['id']}})[_0x7de2('0x20')](handleEntityNotFound(_0x33061c,null))[_0x7de2('0x20')](saveUpdates(_0x29bc6c[_0x7de2('0x4a')],null))[_0x7de2('0x20')](respondWithResult(_0x33061c,null))['catch'](handleError(_0x33061c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 8e3e5e5..6322723 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 _0x6500=['../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','api','bluebird','request-promise','path','rimraf'];(function(_0x2a51ba,_0x43d65a){var _0x4e1eb1=function(_0x2994df){while(--_0x2994df){_0x2a51ba['push'](_0x2a51ba['shift']());}};_0x4e1eb1(++_0x43d65a);}(_0x6500,0xdf));var _0x0650=function(_0x156ed6,_0x40be55){_0x156ed6=_0x156ed6-0x0;var _0x54203b=_0x6500[_0x156ed6];return _0x54203b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0650('0x0'));var moment=require('moment');var BPromise=require(_0x0650('0x1'));var rp=require(_0x0650('0x2'));var fs=require('fs');var path=require(_0x0650('0x3'));var rimraf=require(_0x0650('0x4'));var config=require(_0x0650('0x5'));var attributes=require(_0x0650('0x6'));module[_0x0650('0x7')]=function(_0x29d0af,_0x59fcdd){return _0x29d0af[_0x0650('0x8')](_0x0650('0x9'),attributes,{'tableName':_0x0650('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x0650('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0931=['../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x312ad6,_0x5dcca8){var _0x1069dc=function(_0x42446d){while(--_0x42446d){_0x312ad6['push'](_0x312ad6['shift']());}};_0x1069dc(++_0x5dcca8);}(_0x0931,0x107));var _0x1093=function(_0x331b05,_0x52c041){_0x331b05=_0x331b05-0x0;var _0x14ba3e=_0x0931[_0x331b05];return _0x14ba3e;};'use strict';var _=require(_0x1093('0x0'));var util=require(_0x1093('0x1'));var logger=require(_0x1093('0x2'))(_0x1093('0x3'));var moment=require('moment');var BPromise=require(_0x1093('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1093('0x5'));var rimraf=require(_0x1093('0x6'));var config=require(_0x1093('0x7'));var attributes=require(_0x1093('0x8'));module[_0x1093('0x9')]=function(_0x4abbea,_0x27bbfd){return _0x4abbea[_0x1093('0xa')](_0x1093('0xb'),attributes,{'tableName':_0x1093('0xc'),'paranoid':![],'indexes':[{'name':_0x1093('0xd'),'fields':[_0x1093('0xd')]},{'name':_0x1093('0xe'),'fields':[_0x1093('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 18bfd54..b78d964 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 _0x6324=['client','http','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','info','result','catch','CreateCmHopperHistory','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6324,0x142));var _0x4632=function(_0x1dd8f6,_0x3ea487){_0x1dd8f6=_0x1dd8f6-0x0;var _0xf083b7=_0x6324[_0x1dd8f6];return _0xf083b7;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e9a,_0x4a15b2,_0x17e860){return new BPromise(function(_0x44dd6d,_0x390a46){return client['request'](_0x126e9a,_0x17e860)[_0x4632('0xa')](function(_0x47824c){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x4a15b2,_0x4632('0xb'));logger[_0x4632('0xc')](_0x4632('0xd'),_0x4a15b2,_0x4632('0xb'),JSON[_0x4632('0xe')](_0x47824c));if(_0x47824c[_0x4632('0xf')]){if(_0x47824c[_0x4632('0xf')][_0x4632('0x10')]===0x1f4){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x47824c['error'][_0x4632('0x12')]);return _0x390a46(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}logger[_0x4632('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x4a15b2,'request\x20sent');_0x44dd6d(_0x47824c[_0x4632('0x14')][_0x4632('0x12')]);}})[_0x4632('0x15')](function(_0x125eb9){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x125eb9);_0x390a46(_0x125eb9);});});}exports[_0x4632('0x16')]=function(_0x1a94c0){var _0x5b28b7=this;return new Promise(function(_0x3cddfa,_0x1894bb){return db['CmHopperHistory']['create'](_0x1a94c0[_0x4632('0x17')],{'raw':_0x1a94c0[_0x4632('0x18')]?_0x1a94c0[_0x4632('0x18')][_0x4632('0x19')]===undefined?!![]:![]:!![]})[_0x4632('0xa')](function(_0x3d2d23){logger[_0x4632('0x13')](_0x4632('0x16'),_0x1a94c0);logger[_0x4632('0xc')](_0x4632('0x16'),_0x1a94c0,JSON[_0x4632('0xe')](_0x3d2d23));_0x3cddfa(_0x3d2d23);})[_0x4632('0x15')](function(_0x2ca6a5){logger[_0x4632('0xf')](_0x4632('0x16'),_0x2ca6a5[_0x4632('0x12')],_0x1a94c0);_0x1894bb(_0x5b28b7[_0x4632('0xf')](0x1f4,_0x2ca6a5[_0x4632('0x12')]));});});};exports[_0x4632('0x1a')]=function(_0x1e1b86){var _0x38cbbc=this;return new Promise(function(_0x4455ef,_0x3b0823){return db[_0x4632('0x1b')][_0x4632('0x1c')]({'raw':_0x1e1b86[_0x4632('0x18')]?_0x1e1b86[_0x4632('0x18')][_0x4632('0x19')]===undefined?!![]:![]:!![],'where':_0x1e1b86[_0x4632('0x18')]?_0x1e1b86[_0x4632('0x18')][_0x4632('0x1d')]||null:null,'attributes':[[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['col']('id')),_0x4632('0x20')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['fn']('IF',db[_0x4632('0x1e')]['literal'](_0x4632('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x4632('0x24')],[db[_0x4632('0x1e')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x4632('0x25')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x26'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')]['literal'](_0x4632('0x27')))),_0x4632('0x28')]]})['then'](function(_0x5f4f24){logger[_0x4632('0x13')]('AvgHandleTime',_0x1e1b86);logger['debug'](_0x4632('0x1a'),_0x1e1b86,JSON['stringify'](_0x5f4f24));_0x4455ef(_0x5f4f24);})[_0x4632('0x15')](function(_0x468735){logger[_0x4632('0xf')]('AvgHandleTime',_0x468735[_0x4632('0x12')],_0x1e1b86);_0x3b0823(_0x38cbbc[_0x4632('0xf')](0x1f4,_0x468735[_0x4632('0x12')]));});});};exports[_0x4632('0x29')]=function(_0x37c4d0){var _0x5d20f9=this;return new Promise(function(_0x486f6c,_0x3114c4){return db[_0x4632('0x1b')][_0x4632('0x1c')]({'raw':_0x37c4d0['options']?_0x37c4d0['options']['raw']===undefined?!![]:![]:!![],'where':_0x37c4d0[_0x4632('0x18')]?_0x37c4d0[_0x4632('0x18')]['where']||null:null,'attributes':[[_0x4632('0x2a'),_0x4632('0x2b')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x2c')))),_0x4632('0x2d')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db['sequelize'][_0x4632('0x21')](_0x4632('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['fn']('IF',db[_0x4632('0x1e')]['literal'](_0x4632('0x22')))),_0x4632('0x2f')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x30')))),_0x4632('0x31')],[db['sequelize']['fn']('COUNT',db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x208,\x201,\x20null'))),_0x4632('0x32')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')]['literal'](_0x4632('0x34')))),_0x4632('0x35')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db['sequelize'][_0x4632('0x21')](_0x4632('0x36')))),_0x4632('0x37')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x38')))),_0x4632('0x39')],[db[_0x4632('0x1e')]['fn']('COUNT',db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0x4632('0x3a')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x3b')))),_0x4632('0x3c')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db['sequelize']['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x4632('0x3a')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x3d')))),_0x4632('0x3e')]],'group':[_0x4632('0x2a')]})[_0x4632('0xa')](function(_0x3e66d8){logger[_0x4632('0x13')](_0x4632('0x29'),_0x37c4d0);logger[_0x4632('0xc')](_0x4632('0x29'),_0x37c4d0,JSON[_0x4632('0xe')](_0x3e66d8));_0x486f6c(_0x3e66d8);})[_0x4632('0x15')](function(_0x6c2864){logger[_0x4632('0xf')](_0x4632('0x29'),_0x6c2864['message'],_0x37c4d0);_0x3114c4(_0x5d20f9[_0x4632('0xf')](0x1f4,_0x6c2864[_0x4632('0x12')]));});});};exports[_0x4632('0x3f')]=function(_0x150bfa){var _0x2e2353=this;return new Promise(function(_0x33ad25,_0x5d2cbb){return db[_0x4632('0x1b')][_0x4632('0x1c')]({'raw':_0x150bfa[_0x4632('0x18')]?_0x150bfa['options'][_0x4632('0x19')]===undefined?!![]:![]:!![],'where':_0x150bfa[_0x4632('0x18')]?_0x150bfa['options'][_0x4632('0x1d')]||null:null,'attributes':[[_0x4632('0x2a'),_0x4632('0x2b')],[db['sequelize']['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')][_0x4632('0x40')]('id')),_0x4632('0x41')],[db[_0x4632('0x1e')]['fn'](_0x4632('0x1f'),db[_0x4632('0x1e')]['fn']('IF',db[_0x4632('0x1e')][_0x4632('0x21')](_0x4632('0x22')))),'ivrAnswerCallsDay']],'group':[_0x4632('0x2a')]})[_0x4632('0xa')](function(_0x556bec){logger[_0x4632('0x13')]('GetCampaignHopperHistory',_0x150bfa);logger['debug'](_0x4632('0x3f'),_0x150bfa,JSON[_0x4632('0xe')](_0x556bec));_0x33ad25(_0x556bec);})[_0x4632('0x15')](function(_0xd89124){logger[_0x4632('0xf')](_0x4632('0x3f'),_0xd89124[_0x4632('0x12')],_0x150bfa);_0x5d2cbb(_0x2e2353[_0x4632('0xf')](0x1f4,_0xd89124[_0x4632('0x12')]));});});}; \ No newline at end of file +var _0xb62e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis'];(function(_0x12a62c,_0xc9c41a){var _0x268a58=function(_0x100ca9){while(--_0x100ca9){_0x12a62c['push'](_0x12a62c['shift']());}};_0x268a58(++_0xc9c41a);}(_0xb62e,0x1de));var _0xeb62=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb62e[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateCmHopperHistory',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateCmHopperHistory',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});};exports[_0xeb62('0x1e')]=function(_0x395b70){var _0x55a169=this;return new Promise(function(_0x4e92f5,_0x3ef988){return db['CmHopperHistory'][_0xeb62('0x1f')]({'raw':_0x395b70['options']?_0x395b70[_0xeb62('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x395b70[_0xeb62('0x1b')]?_0x395b70[_0xeb62('0x1b')][_0xeb62('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')][_0xeb62('0x23')]('id')),_0xeb62('0x24')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0xeb62('0x26')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xeb62('0x27')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xeb62('0x22')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xeb62('0x29')],[db['sequelize']['fn'](_0xeb62('0x2a'),db[_0xeb62('0x22')]['fn']('IF',db['sequelize'][_0xeb62('0x25')](_0xeb62('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0xeb62('0x1d')](function(_0x2a8087){logger[_0xeb62('0xd')](_0xeb62('0x1e'),_0x395b70);logger['debug'](_0xeb62('0x1e'),_0x395b70,JSON[_0xeb62('0x12')](_0x2a8087));_0x4e92f5(_0x2a8087);})['catch'](function(_0x4acc96){logger[_0xeb62('0x13')](_0xeb62('0x1e'),_0x4acc96['message'],_0x395b70);_0x3ef988(_0x55a169[_0xeb62('0x13')](0x1f4,_0x4acc96[_0xeb62('0x15')]));});});};exports[_0xeb62('0x2c')]=function(_0x1f839a){var _0x21f604=this;return new Promise(function(_0x15387a,_0x40106b){return db['CmHopperHistory']['findAll']({'raw':_0x1f839a[_0xeb62('0x1b')]?_0x1f839a[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f839a[_0xeb62('0x1b')]?_0x1f839a['options'][_0xeb62('0x20')]||null:null,'attributes':[['campaign',_0xeb62('0x2d')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x2e')))),_0xeb62('0x2f')],[db['sequelize']['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0xeb62('0x30')],[db['sequelize']['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')]['literal'](_0xeb62('0x31')))),_0xeb62('0x32')],[db[_0xeb62('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x33')))),_0xeb62('0x34')],[db[_0xeb62('0x22')]['fn']('COUNT',db[_0xeb62('0x22')]['fn']('IF',db['sequelize'][_0xeb62('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xeb62('0x35')],[db['sequelize']['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x36')))),_0xeb62('0x37')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db['sequelize']['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')]['literal'](_0xeb62('0x38')))),_0xeb62('0x39')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db['sequelize'][_0xeb62('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0xeb62('0x3a')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x3b')))),_0xeb62('0x3c')],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')]['literal'](_0xeb62('0x3d')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db['sequelize'][_0xeb62('0x25')](_0xeb62('0x3e')))),'outboundRejectCallsDay'],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x3f')))),_0xeb62('0x40')]],'group':[_0xeb62('0x41')]})['then'](function(_0x3e2be9){logger['info'](_0xeb62('0x2c'),_0x1f839a);logger[_0xeb62('0x10')](_0xeb62('0x2c'),_0x1f839a,JSON[_0xeb62('0x12')](_0x3e2be9));_0x15387a(_0x3e2be9);})[_0xeb62('0x17')](function(_0x13ea55){logger[_0xeb62('0x13')](_0xeb62('0x2c'),_0x13ea55['message'],_0x1f839a);_0x40106b(_0x21f604['error'](0x1f4,_0x13ea55['message']));});});};exports['GetCampaignHopperHistory']=function(_0x2ddc02){var _0x59320b=this;return new Promise(function(_0x3876ca,_0x5c0e7f){return db[_0xeb62('0x19')][_0xeb62('0x1f')]({'raw':_0x2ddc02[_0xeb62('0x1b')]?_0x2ddc02['options'][_0xeb62('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ddc02[_0xeb62('0x1b')]?_0x2ddc02['options'][_0xeb62('0x20')]||null:null,'attributes':[[_0xeb62('0x41'),_0xeb62('0x2d')],[db[_0xeb62('0x22')]['fn']('COUNT',db[_0xeb62('0x22')][_0xeb62('0x23')]('id')),'ivrTotalCallsDays'],[db[_0xeb62('0x22')]['fn'](_0xeb62('0x21'),db[_0xeb62('0x22')]['fn']('IF',db[_0xeb62('0x22')][_0xeb62('0x25')](_0xeb62('0x42')))),_0xeb62('0x43')]],'group':[_0xeb62('0x41')]})[_0xeb62('0x1d')](function(_0x1db841){logger[_0xeb62('0xd')](_0xeb62('0x44'),_0x2ddc02);logger[_0xeb62('0x10')](_0xeb62('0x44'),_0x2ddc02,JSON[_0xeb62('0x12')](_0x1db841));_0x3876ca(_0x1db841);})[_0xeb62('0x17')](function(_0x5873c1){logger['error']('GetCampaignHopperHistory',_0x5873c1['message'],_0x2ddc02);_0x5c0e7f(_0x59320b[_0xeb62('0x13')](0x1f4,_0x5873c1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 145e40d..c208a7c 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 _0x2db5=['get','index','/describe','isAuthenticated','describe','/:id','show','create','update','exports','util','express','../../components/auth/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2db5,0x168));var _0x52db=function(_0x3d8240,_0x2663d4){_0x3d8240=_0x3d8240-0x0;var _0x3d0372=_0x2db5[_0x3d8240];return _0x3d0372;};'use strict';var multer=require('multer');var util=require(_0x52db('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x52db('0x1'));var router=express['Router']();var auth=require(_0x52db('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x52db('0x3'));var controller=require('./cmHopperHistory.controller');router[_0x52db('0x4')]('/',auth['isAuthenticated'](),controller[_0x52db('0x5')]);router[_0x52db('0x4')](_0x52db('0x6'),auth[_0x52db('0x7')](),controller[_0x52db('0x8')]);router[_0x52db('0x4')](_0x52db('0x9'),auth[_0x52db('0x7')](),controller[_0x52db('0xa')]);router['post']('/',auth[_0x52db('0x7')](),controller[_0x52db('0xb')]);router['put']('/:id',auth[_0x52db('0x7')](),controller[_0x52db('0xc')]);module[_0x52db('0xd')]=router; \ No newline at end of file +var _0x5ce1=['show','create','put','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','/:id'];(function(_0x5969d9,_0x3b299e){var _0x2a3288=function(_0x3cfd3c){while(--_0x3cfd3c){_0x5969d9['push'](_0x5969d9['shift']());}};_0x2a3288(++_0x3b299e);}(_0x5ce1,0xd4));var _0x15ce=function(_0x110617,_0x6f4b2f){_0x110617=_0x110617-0x0;var _0x37c170=_0x5ce1[_0x110617];return _0x37c170;};'use strict';var multer=require('multer');var util=require(_0x15ce('0x0'));var path=require(_0x15ce('0x1'));var timeout=require(_0x15ce('0x2'));var express=require('express');var router=express[_0x15ce('0x3')]();var auth=require(_0x15ce('0x4'));var interaction=require(_0x15ce('0x5'));var config=require(_0x15ce('0x6'));var controller=require(_0x15ce('0x7'));router[_0x15ce('0x8')]('/',auth[_0x15ce('0x9')](),controller['index']);router[_0x15ce('0x8')](_0x15ce('0xa'),auth[_0x15ce('0x9')](),controller['describe']);router['get'](_0x15ce('0xb'),auth[_0x15ce('0x9')](),controller[_0x15ce('0xc')]);router['post']('/',auth[_0x15ce('0x9')](),controller[_0x15ce('0xd')]);router[_0x15ce('0xe')]('/:id',auth[_0x15ce('0x9')](),controller['update']);module[_0x15ce('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index cec2315..486ad8e 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 _0x8978=['name','sequelize','exports','STRING'];(function(_0x1f63f9,_0x31b893){var _0x16e272=function(_0x5e01ca){while(--_0x5e01ca){_0x1f63f9['push'](_0x1f63f9['shift']());}};_0x16e272(++_0x31b893);}(_0x8978,0x131));var _0x8897=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8978[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x8897('0x0'));module[_0x8897('0x1')]={'name':{'type':Sequelize[_0x8897('0x2')],'unique':_0x8897('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8897('0x2')]},'dialPrefix':{'type':Sequelize[_0x8897('0x2')]}}; \ No newline at end of file +var _0x5513=['sequelize','STRING','name'];(function(_0x5d129d,_0x4c78b7){var _0x2b8755=function(_0x23d31b){while(--_0x23d31b){_0x5d129d['push'](_0x5d129d['shift']());}};_0x2b8755(++_0x4c78b7);}(_0x5513,0x78));var _0x3551=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x5513[_0x1385dc];return _0x2f6469;};'use strict';var Sequelize=require(_0x3551('0x0'));module['exports']={'name':{'type':Sequelize[_0x3551('0x1')],'unique':_0x3551('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3551('0x1')]},'dialPrefix':{'type':Sequelize[_0x3551('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 1261fd3..e6a6ce0 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 _0x9b22=['userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','Lists','UserProfileResource','sendStatus','error','name','index','map','CmList','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','options','findAll','catch','keys','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','ListId','Disposition','order','filter','include','rows','removeDispositions','addContacts','tags','isArray','join','push','each','CmContact','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','concat','CustomFields','format','cf_%d','raw','CmCustomField','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','addAgents','ids','spread','emit'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x9b22,0x1ac));var _0x29b2=function(_0x58e7ca,_0x4da099){_0x58e7ca=_0x58e7ca-0x0;var _0x2a311c=_0x9b22[_0x58e7ca];return _0x2a311c;};'use strict';var pdf=require(_0x29b2('0x0'));var emlformat=require(_0x29b2('0x1'));var rimraf=require(_0x29b2('0x2'));var zipdir=require(_0x29b2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29b2('0x4'));var moment=require('moment');var BPromise=require(_0x29b2('0x5'));var Mustache=require(_0x29b2('0x6'));var util=require(_0x29b2('0x7'));var path=require(_0x29b2('0x8'));var sox=require('sox');var csv=require(_0x29b2('0x9'));var ejs=require(_0x29b2('0xa'));var fs=require('fs');var _=require(_0x29b2('0xb'));var squel=require(_0x29b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x29b2('0xd'));var deskjs=require(_0x29b2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29b2('0xf'));var Redis=require(_0x29b2('0x10'));var authService=require(_0x29b2('0x11'));var qs=require(_0x29b2('0x12'));var as=require(_0x29b2('0x13'));var hardwareService=require(_0x29b2('0x14'));var logger=require(_0x29b2('0x15'))(_0x29b2('0x16'));var utils=require(_0x29b2('0x17'));var config=require('../../config/environment');var db=require(_0x29b2('0x18'))['db'];config[_0x29b2('0x19')]=_[_0x29b2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x29b2('0x1b'))(new Redis(config[_0x29b2('0x19')]));require(_0x29b2('0x1c'))[_0x29b2('0x1d')](socket);function respondWithStatusCode(_0x26e770,_0x27933b){_0x27933b=_0x27933b||0xcc;return function(_0x1f0139){if(_0x1f0139){return _0x26e770['sendStatus'](_0x27933b);}return _0x26e770[_0x29b2('0x1e')](_0x27933b)[_0x29b2('0x1f')]();};}function respondWithResult(_0xbbb667,_0x5cd730){_0x5cd730=_0x5cd730||0xc8;return function(_0x3876a8){if(_0x3876a8){return _0xbbb667['status'](_0x5cd730)[_0x29b2('0x20')](_0x3876a8);}};}function respondWithFilteredResult(_0x2df50d,_0x30ea6c){return function(_0x158e0d){if(_0x158e0d){var _0x3bbe94=_0x158e0d[_0x29b2('0x21')],_0x16ecea=_0x30ea6c[_0x29b2('0x22')],_0x22a6db=_0x30ea6c[_0x29b2('0x22')]+_0x30ea6c[_0x29b2('0x23')],_0x2c404f;if(_0x22a6db>=_0x3bbe94){_0x22a6db=_0x3bbe94;_0x2c404f=0xc8;}else{_0x2c404f=0xce;}_0x2df50d[_0x29b2('0x1e')](_0x2c404f);return _0x2df50d[_0x29b2('0x24')]('Content-Range',_0x16ecea+'-'+_0x22a6db+'/'+_0x3bbe94)[_0x29b2('0x20')](_0x158e0d);}return null;};}function patchUpdates(_0x415270){return function(_0x5dc637){try{jsonpatch[_0x29b2('0x25')](_0x5dc637,_0x415270,!![]);}catch(_0x549422){return BPromise[_0x29b2('0x26')](_0x549422);}return _0x5dc637[_0x29b2('0x27')]();};}function saveUpdates(_0x54cb7c,_0x48a0b0){return function(_0x5ab14c){if(_0x5ab14c){return _0x5ab14c[_0x29b2('0x28')](_0x54cb7c)[_0x29b2('0x29')](function(_0x4809a0){return _0x4809a0;});}return null;};}function removeEntity(_0x5127f8,_0x1984d0){return function(_0x1cf193){if(_0x1cf193){return _0x1cf193['destroy']()[_0x29b2('0x29')](function(){var _0x2278bb=_0x1cf193[_0x29b2('0x2a')]({'plain':!![]});var _0x32fb9=_0x29b2('0x2b');return db[_0x29b2('0x2c')]['destroy']({'where':{'type':_0x32fb9,'resourceId':_0x2278bb['id']}})[_0x29b2('0x29')](function(){return _0x1cf193;});})[_0x29b2('0x29')](function(){_0x5127f8[_0x29b2('0x1e')](0xcc)[_0x29b2('0x1f')]();});}};}function handleEntityNotFound(_0x115b09,_0x33c420){return function(_0x20cfac){if(!_0x20cfac){_0x115b09[_0x29b2('0x2d')](0x194);}return _0x20cfac;};}function handleError(_0x3861ef,_0x9874ff){_0x9874ff=_0x9874ff||0x1f4;return function(_0x1943bb){logger[_0x29b2('0x2e')](_0x1943bb['stack']);if(_0x1943bb[_0x29b2('0x2f')]){delete _0x1943bb[_0x29b2('0x2f')];}_0x3861ef['status'](_0x9874ff)['send'](_0x1943bb);};}exports[_0x29b2('0x30')]=function(_0x153055,_0x5f0f3a){var _0x3e3a9b={},_0x2d12bb={},_0x30fa22={'count':0x0,'rows':[]};var _0x1f807f=_[_0x29b2('0x31')](db[_0x29b2('0x32')][_0x29b2('0x33')],function(_0x4dd304){return{'name':_0x4dd304['fieldName'],'type':_0x4dd304[_0x29b2('0x34')][_0x29b2('0x35')]};});_0x2d12bb[_0x29b2('0x36')]=_[_0x29b2('0x31')](_0x1f807f,_0x29b2('0x2f'));_0x2d12bb['query']=_['keys'](_0x153055[_0x29b2('0x37')]);_0x2d12bb[_0x29b2('0x38')]=_[_0x29b2('0x39')](_0x2d12bb[_0x29b2('0x36')],_0x2d12bb[_0x29b2('0x37')]);_0x3e3a9b[_0x29b2('0x3a')]=_['intersection'](_0x2d12bb[_0x29b2('0x36')],qs['fields'](_0x153055[_0x29b2('0x37')][_0x29b2('0x3b')]));_0x3e3a9b[_0x29b2('0x3a')]=_0x3e3a9b[_0x29b2('0x3a')]['length']?_0x3e3a9b[_0x29b2('0x3a')]:_0x2d12bb[_0x29b2('0x36')];if(!_0x153055[_0x29b2('0x37')][_0x29b2('0x3c')](_0x29b2('0x3d'))){_0x3e3a9b[_0x29b2('0x23')]=qs['limit'](_0x153055[_0x29b2('0x37')]['limit']);_0x3e3a9b['offset']=qs['offset'](_0x153055['query'][_0x29b2('0x22')]);}_0x3e3a9b['order']=qs[_0x29b2('0x3e')](_0x153055[_0x29b2('0x37')][_0x29b2('0x3e')]);_0x3e3a9b[_0x29b2('0x3f')]=qs[_0x29b2('0x38')](_[_0x29b2('0x40')](_0x153055[_0x29b2('0x37')],_0x2d12bb['filters']),_0x1f807f);if(_0x153055[_0x29b2('0x37')]['filter']){_0x3e3a9b[_0x29b2('0x3f')]=_[_0x29b2('0x41')](_0x3e3a9b[_0x29b2('0x3f')],{'$or':_['map'](_0x1f807f,function(_0xcff1d1){if(_0xcff1d1['type']!=='VIRTUAL'){var _0xd2f513={};_0xd2f513[_0xcff1d1[_0x29b2('0x2f')]]={'$like':'%'+_0x153055[_0x29b2('0x37')]['filter']+'%'};return _0xd2f513;}})});}_0x3e3a9b=_[_0x29b2('0x41')]({},_0x3e3a9b,_0x153055[_0x29b2('0x42')]);var _0x550b6d={'where':_0x3e3a9b[_0x29b2('0x3f')]};return db[_0x29b2('0x32')][_0x29b2('0x21')](_0x550b6d)[_0x29b2('0x29')](function(_0x401123){_0x30fa22['count']=_0x401123;if(_0x153055['query']['includeAll']){_0x3e3a9b['include']=[{'all':!![]}];}return db[_0x29b2('0x32')][_0x29b2('0x43')](_0x3e3a9b);})[_0x29b2('0x29')](function(_0x1c7a50){_0x30fa22['rows']=_0x1c7a50;return _0x30fa22;})[_0x29b2('0x29')](respondWithFilteredResult(_0x5f0f3a,_0x3e3a9b))[_0x29b2('0x44')](handleError(_0x5f0f3a,null));};exports['show']=function(_0x36ba39,_0x24aeb7){var _0x456435={'raw':![],'where':{'id':_0x36ba39['params']['id']}},_0xd91498={};_0xd91498['model']=_[_0x29b2('0x45')](db['CmList'][_0x29b2('0x33')]);_0xd91498[_0x29b2('0x37')]=_[_0x29b2('0x45')](_0x36ba39[_0x29b2('0x37')]);_0xd91498[_0x29b2('0x38')]=_[_0x29b2('0x39')](_0xd91498[_0x29b2('0x36')],_0xd91498[_0x29b2('0x37')]);_0x456435[_0x29b2('0x3a')]=_[_0x29b2('0x39')](_0xd91498['model'],qs[_0x29b2('0x3b')](_0x36ba39[_0x29b2('0x37')][_0x29b2('0x3b')]));_0x456435[_0x29b2('0x3a')]=_0x456435[_0x29b2('0x3a')][_0x29b2('0x46')]?_0x456435[_0x29b2('0x3a')]:_0xd91498[_0x29b2('0x36')];if(_0x36ba39[_0x29b2('0x37')][_0x29b2('0x47')]){_0x456435['include']=[{'all':!![]}];}_0x456435=_[_0x29b2('0x41')]({},_0x456435,_0x36ba39[_0x29b2('0x42')]);return db[_0x29b2('0x32')][_0x29b2('0x48')](_0x456435)[_0x29b2('0x29')](handleEntityNotFound(_0x24aeb7,null))['then'](respondWithResult(_0x24aeb7,null))[_0x29b2('0x44')](handleError(_0x24aeb7,null));};exports[_0x29b2('0x49')]=function(_0xf8eb4,_0x56b9f7){return db[_0x29b2('0x32')][_0x29b2('0x49')](_0xf8eb4[_0x29b2('0x4a')],{})[_0x29b2('0x29')](function(_0x2978c9){var _0x5c5043=_0xf8eb4['user']['get']({'plain':!![]});if(!_0x5c5043)throw new Error(_0x29b2('0x4b'));if(_0x5c5043[_0x29b2('0x4c')]===_0x29b2('0x4d')){var _0x433875=_0x2978c9[_0x29b2('0x2a')]({'plain':!![]});var _0x55b911=_0x29b2('0x2b');return db[_0x29b2('0x4e')][_0x29b2('0x48')]({'where':{'name':_0x55b911,'userProfileId':_0x5c5043[_0x29b2('0x4f')]},'raw':!![]})[_0x29b2('0x29')](function(_0x44468b){if(_0x44468b&&_0x44468b['autoAssociation']===0x0){return db[_0x29b2('0x2c')][_0x29b2('0x49')]({'name':_0x433875[_0x29b2('0x2f')],'resourceId':_0x433875['id'],'type':_0x44468b[_0x29b2('0x2f')],'sectionId':_0x44468b['id']},{})[_0x29b2('0x29')](function(){return _0x2978c9;});}else{return _0x2978c9;}})[_0x29b2('0x44')](function(_0x510da4){logger['error'](_0x29b2('0x50'),_0x510da4);throw _0x510da4;});}return _0x2978c9;})[_0x29b2('0x29')](respondWithResult(_0x56b9f7,0xc9))['catch'](handleError(_0x56b9f7,null));};exports[_0x29b2('0x28')]=function(_0x3924f2,_0x3b3de5){if(_0x3924f2['body']['id']){delete _0x3924f2[_0x29b2('0x4a')]['id'];}return db[_0x29b2('0x32')][_0x29b2('0x48')]({'where':{'id':_0x3924f2[_0x29b2('0x51')]['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x3b3de5,null))[_0x29b2('0x29')](saveUpdates(_0x3924f2[_0x29b2('0x4a')],null))[_0x29b2('0x29')](respondWithResult(_0x3b3de5,null))['catch'](handleError(_0x3b3de5,null));};exports[_0x29b2('0x52')]=function(_0x1ced09,_0x1f175e){return db[_0x29b2('0x32')][_0x29b2('0x48')]({'where':{'id':_0x1ced09[_0x29b2('0x51')]['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x1f175e,null))['then'](removeEntity(_0x1f175e,null))['catch'](handleError(_0x1f175e,null));};exports[_0x29b2('0x53')]=function(_0x5eb6d5,_0x56be43){return db[_0x29b2('0x32')][_0x29b2('0x53')]()[_0x29b2('0x29')](respondWithResult(_0x56be43,null))[_0x29b2('0x44')](handleError(_0x56be43,null));};exports['addDisposition']=function(_0x5c6a2f,_0x3d82f4,_0x28569a){if(_0x5c6a2f[_0x29b2('0x4a')]['id']){delete _0x5c6a2f['body']['id'];}return db['CmList'][_0x29b2('0x48')]({'where':{'id':_0x5c6a2f[_0x29b2('0x51')]['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x3d82f4,null))[_0x29b2('0x29')](function(_0x2a6c76){if(_0x2a6c76){_0x5c6a2f[_0x29b2('0x4a')][_0x29b2('0x54')]=_0x2a6c76['id'];return db[_0x29b2('0x55')]['create'](_0x5c6a2f['body']);}})[_0x29b2('0x29')](respondWithResult(_0x3d82f4,null))[_0x29b2('0x44')](handleError(_0x3d82f4,null));};exports['getDispositions']=function(_0x2048f4,_0x4e5396,_0x587963){var _0xee39c8={'raw':![],'where':{}};var _0x1c10b6={};var _0x1d43cf={'count':0x0,'rows':[]};return db[_0x29b2('0x32')]['findOne']({'where':{'id':_0x2048f4[_0x29b2('0x51')]['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x4e5396,null))[_0x29b2('0x29')](function(_0x5d526d){if(_0x5d526d){_0x1c10b6['model']=_[_0x29b2('0x45')](db[_0x29b2('0x55')][_0x29b2('0x33')]);_0x1c10b6['query']=_[_0x29b2('0x45')](_0x2048f4[_0x29b2('0x37')]);_0x1c10b6[_0x29b2('0x38')]=_[_0x29b2('0x39')](_0x1c10b6[_0x29b2('0x36')],_0x1c10b6[_0x29b2('0x37')]);_0xee39c8['attributes']=_[_0x29b2('0x39')](_0x1c10b6[_0x29b2('0x36')],qs[_0x29b2('0x3b')](_0x2048f4[_0x29b2('0x37')]['fields']));_0xee39c8[_0x29b2('0x3a')]=_0xee39c8[_0x29b2('0x3a')][_0x29b2('0x46')]?_0xee39c8[_0x29b2('0x3a')]:_0x1c10b6[_0x29b2('0x36')];if(!_0x2048f4['query']['hasOwnProperty']('nolimit')){_0xee39c8['limit']=qs['limit'](_0x2048f4['query'][_0x29b2('0x23')]);_0xee39c8[_0x29b2('0x22')]=qs[_0x29b2('0x22')](_0x2048f4[_0x29b2('0x37')]['offset']);}_0xee39c8[_0x29b2('0x56')]=qs[_0x29b2('0x3e')](_0x2048f4['query'][_0x29b2('0x3e')]);_0xee39c8['where']=qs[_0x29b2('0x38')](_['pick'](_0x2048f4['query'],_0x1c10b6['filters']));_0xee39c8[_0x29b2('0x3f')]['ListId']=_0x5d526d['id'];if(_0x2048f4[_0x29b2('0x37')][_0x29b2('0x57')]){_0xee39c8[_0x29b2('0x3f')]=_[_0x29b2('0x41')](_0xee39c8['where'],{'$or':_[_0x29b2('0x31')](_0xee39c8[_0x29b2('0x3a')],function(_0x3c330e){var _0x53be11={};_0x53be11[_0x3c330e]={'$like':'%'+_0x2048f4[_0x29b2('0x37')]['filter']+'%'};return _0x53be11;})});}_0xee39c8=_[_0x29b2('0x41')]({},_0xee39c8,_0x2048f4[_0x29b2('0x42')]);return db[_0x29b2('0x55')][_0x29b2('0x21')]({'where':_0xee39c8[_0x29b2('0x3f')]})[_0x29b2('0x29')](function(_0x21546a){_0x1d43cf['count']=_0x21546a;if(_0x2048f4[_0x29b2('0x37')][_0x29b2('0x47')]){_0xee39c8[_0x29b2('0x58')]=[{'all':!![]}];}return db[_0x29b2('0x55')][_0x29b2('0x43')](_0xee39c8);})[_0x29b2('0x29')](function(_0x26577d){_0x1d43cf[_0x29b2('0x59')]=_0x26577d;return _0x1d43cf;});}})[_0x29b2('0x29')](respondWithFilteredResult(_0x4e5396,_0xee39c8))[_0x29b2('0x44')](handleError(_0x4e5396,null));};exports[_0x29b2('0x5a')]=function(_0x1e5446,_0x5a10ee,_0xcb4141){return db[_0x29b2('0x32')][_0x29b2('0x48')]({'where':{'id':_0x1e5446[_0x29b2('0x51')]['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x5a10ee,null))[_0x29b2('0x29')](function(_0x5689e3){if(_0x5689e3){return _0x5689e3[_0x29b2('0x5a')](_0x1e5446[_0x29b2('0x37')]['ids']);}})['then'](respondWithStatusCode(_0x5a10ee,null))[_0x29b2('0x44')](handleError(_0x5a10ee,null));};exports[_0x29b2('0x5b')]=function(_0x10e8e7,_0x44bd82,_0x549408){return db[_0x29b2('0x32')][_0x29b2('0x48')]({'where':{'id':_0x10e8e7[_0x29b2('0x51')]['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x44bd82,null))[_0x29b2('0x29')](function(_0x480b03){if(_0x480b03){var _0x53d711=[];var _0x1e347a={'success':[],'errors':[]};return db['CmContact'][_0x29b2('0x53')]()[_0x29b2('0x29')](function(_0xde80cf){if(_0x10e8e7[_0x29b2('0x4a')][_0x29b2('0x5c')]&&_[_0x29b2('0x5d')](_0x10e8e7[_0x29b2('0x4a')][_0x29b2('0x5c')])){if(_0x10e8e7[_0x29b2('0x4a')]['tags'][_0x29b2('0x46')]){_0x10e8e7[_0x29b2('0x4a')][_0x29b2('0x5c')]=_0x10e8e7[_0x29b2('0x4a')]['tags'][_0x29b2('0x5e')](';')+';';}else{_0x10e8e7['body'][_0x29b2('0x5c')]=null;}}else{_0x10e8e7['body'][_0x29b2('0x5c')]=null;}if(_0x10e8e7['body']&&_[_0x29b2('0x5d')](_0x10e8e7[_0x29b2('0x4a')])){for(var _0x597e9f=0x0;_0x597e9f<_0x10e8e7['body'][_0x29b2('0x46')];_0x597e9f+=0x1){_0x10e8e7[_0x29b2('0x4a')][_0x597e9f][_0x29b2('0x54')]=_0x10e8e7[_0x29b2('0x51')]['id'];_0x53d711[_0x29b2('0x5f')](_0x10e8e7[_0x29b2('0x4a')][_0x597e9f]);}return BPromise[_0x29b2('0x60')](_0x53d711,function(_0x39453a){return db[_0x29b2('0x61')]['create'](_['omit'](_0x39453a,['ids','id'])||{},{'fields':_[_0x29b2('0x45')](_0xde80cf),'raw':!![]})[_0x29b2('0x29')](function(_0x500e0d){_0x1e347a[_0x29b2('0x62')][_0x29b2('0x5f')](_0x500e0d[_0x29b2('0x63')]);})[_0x29b2('0x44')](function(_0x1cea8e){_0x1e347a[_0x29b2('0x64')][_0x29b2('0x5f')]({'data':_0x39453a,'error':_0x1cea8e['message']});});})[_0x29b2('0x29')](function(_0x56db44){return _0x1e347a;})[_0x29b2('0x44')](function(_0x30baf1){return _0x30baf1;});}else{_0x44bd82[_0x29b2('0x1e')](0x190)['json']({'message':_0x29b2('0x65')});}});}})[_0x29b2('0x29')](respondWithResult(_0x44bd82,null))['catch'](handleError(_0x44bd82,null));};exports[_0x29b2('0x66')]=function(_0x5de43c,_0x4cee61,_0x2fc607){var _0x1b1a17;return db[_0x29b2('0x32')][_0x29b2('0x48')]({'where':{'id':_0x5de43c[_0x29b2('0x51')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x4cee61,null))[_0x29b2('0x29')](function(_0x52b83e){if(_0x52b83e){_0x1b1a17=_0x52b83e;return db[_0x29b2('0x61')][_0x29b2('0x33')];}})[_0x29b2('0x29')](function(_0x50d9b7){if(_0x50d9b7){var _0x367615={};var _0x5923be={};_0x5923be[_0x29b2('0x36')]=_[_0x29b2('0x67')](_[_0x29b2('0x45')](_0x50d9b7),_[_0x29b2('0x31')](_0x1b1a17[_0x29b2('0x68')],function(_0x1f1d93){return util[_0x29b2('0x69')](_0x29b2('0x6a'),_0x1f1d93['id']);}));_0x5923be[_0x29b2('0x37')]=_['keys'](_0x5de43c['query']);_0x5923be[_0x29b2('0x38')]=_['intersection'](_0x5923be[_0x29b2('0x36')],_0x5923be[_0x29b2('0x37')]);_0x367615[_0x29b2('0x3a')]=_['intersection'](_0x5923be[_0x29b2('0x36')],qs[_0x29b2('0x3b')](_0x5de43c['query'][_0x29b2('0x3b')]));_0x367615[_0x29b2('0x3a')]=_0x367615[_0x29b2('0x3a')][_0x29b2('0x46')]?_0x367615[_0x29b2('0x3a')]:_0x5923be['model'];if(!_0x5de43c[_0x29b2('0x37')][_0x29b2('0x3c')]('nolimit')){_0x367615[_0x29b2('0x23')]=qs[_0x29b2('0x23')](_0x5de43c[_0x29b2('0x37')][_0x29b2('0x23')]);_0x367615['offset']=qs[_0x29b2('0x22')](_0x5de43c['query'][_0x29b2('0x22')]);}_0x367615[_0x29b2('0x56')]=qs[_0x29b2('0x3e')](_0x5de43c[_0x29b2('0x37')][_0x29b2('0x3e')]);_0x367615['where']=qs[_0x29b2('0x38')](_[_0x29b2('0x40')](_0x5de43c[_0x29b2('0x37')],_0x5923be[_0x29b2('0x38')]));_0x367615[_0x29b2('0x6b')]=!![];if(_0x5de43c['query'][_0x29b2('0x57')]){_0x367615[_0x29b2('0x3f')]=_[_0x29b2('0x41')](_0x367615[_0x29b2('0x3f')],{'$or':_[_0x29b2('0x31')](_0x367615['attributes'],function(_0x40bf70){var _0x578480={};_0x578480[_0x40bf70]={'$like':'%'+_0x5de43c[_0x29b2('0x37')][_0x29b2('0x57')]+'%'};return _0x578480;})});}_0x367615=_[_0x29b2('0x41')]({},_0x367615,_0x5de43c['options']);return _0x1b1a17[_0x29b2('0x66')](_0x367615);}})[_0x29b2('0x29')](respondWithResult(_0x4cee61,null))[_0x29b2('0x44')](handleError(_0x4cee61,null));};exports['getContactsCsv']=function(_0x501d,_0x30d8ba,_0x501d07){var _0x2047ec;return db[_0x29b2('0x32')][_0x29b2('0x48')]({'where':{'id':_0x501d[_0x29b2('0x51')]['id']},'include':[{'model':db[_0x29b2('0x6c')],'as':_0x29b2('0x68')}]})['then'](handleEntityNotFound(_0x30d8ba,null))['then'](function(_0x11ec6f){if(_0x11ec6f){_0x2047ec=_0x11ec6f;return db[_0x29b2('0x61')][_0x29b2('0x33')];}})[_0x29b2('0x29')](function(_0x43c833){if(_0x43c833){var _0x2328e7={};var _0x524f1b={};_0x524f1b[_0x29b2('0x36')]=_[_0x29b2('0x67')](_[_0x29b2('0x45')](_0x43c833),_[_0x29b2('0x31')](_0x2047ec['CustomFields'],function(_0x772abb){return util[_0x29b2('0x69')](_0x29b2('0x6a'),_0x772abb['id']);}));_0x524f1b[_0x29b2('0x37')]=_[_0x29b2('0x45')](_0x501d['query']);_0x524f1b[_0x29b2('0x38')]=_[_0x29b2('0x39')](_0x524f1b[_0x29b2('0x36')],_0x524f1b[_0x29b2('0x37')]);_0x2328e7[_0x29b2('0x3a')]=_['intersection'](_0x524f1b[_0x29b2('0x36')],qs[_0x29b2('0x3b')](_0x501d[_0x29b2('0x37')]['fields']));_0x2328e7['attributes']=_0x2328e7[_0x29b2('0x3a')][_0x29b2('0x46')]?_0x2328e7[_0x29b2('0x3a')]:_0x524f1b[_0x29b2('0x36')];if(!_0x501d[_0x29b2('0x37')][_0x29b2('0x3c')](_0x29b2('0x3d'))){_0x2328e7[_0x29b2('0x23')]=qs['limit'](_0x501d[_0x29b2('0x37')][_0x29b2('0x23')]);_0x2328e7[_0x29b2('0x22')]=qs[_0x29b2('0x22')](_0x501d[_0x29b2('0x37')][_0x29b2('0x22')]);}_0x2328e7[_0x29b2('0x56')]=qs[_0x29b2('0x3e')](_0x501d[_0x29b2('0x37')]['sort']);_0x2328e7[_0x29b2('0x3f')]=qs[_0x29b2('0x38')](_[_0x29b2('0x40')](_0x501d[_0x29b2('0x37')],_0x524f1b[_0x29b2('0x38')]));_0x2328e7[_0x29b2('0x6b')]=!![];if(_0x501d[_0x29b2('0x37')][_0x29b2('0x57')]){_0x2328e7[_0x29b2('0x3f')]=_[_0x29b2('0x41')](_0x2328e7[_0x29b2('0x3f')],{'$or':_['map'](_0x2328e7[_0x29b2('0x3a')],function(_0x56f8f7){var _0x4d7eb9={};_0x4d7eb9[_0x56f8f7]={'$like':'%'+_0x501d[_0x29b2('0x37')][_0x29b2('0x57')]+'%'};return _0x4d7eb9;})});}_0x2328e7=_['merge']({},_0x2328e7,_0x501d[_0x29b2('0x42')]);return _0x2047ec[_0x29b2('0x66')](_0x2328e7);}})[_0x29b2('0x29')](function(_0x1a621f){if(!_[_0x29b2('0x6d')](_0x1a621f)){var _0x32525c=toCsv(_0x1a621f);var _0x193726=Date[_0x29b2('0x6e')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x2047ec['id'],_0x193726),_0x32525c);_0x30d8ba[_0x29b2('0x6f')](_0x29b2('0x70'),_0x29b2('0x71')+util[_0x29b2('0x69')]('list_%d_%s.csv',_0x2047ec['id'],_0x193726));_0x30d8ba[_0x29b2('0x6f')](_0x29b2('0x72'),'text/csv');return _0x30d8ba[_0x29b2('0x73')](util[_0x29b2('0x69')](_0x29b2('0x74'),_0x2047ec['id'],_0x193726));}else{return _0x30d8ba['sendStatus'](0xcc);}})['catch'](handleError(_0x30d8ba,null));};exports[_0x29b2('0x75')]=function(_0x622dc2,_0x233cba,_0x8a4a5){var _0x38321b;delete _0x622dc2['body']['id'];return db[_0x29b2('0x32')][_0x29b2('0x76')]({'where':{'id':_0x622dc2[_0x29b2('0x51')]['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x233cba,null))[_0x29b2('0x29')](function(_0xea56c2){if(_0xea56c2){return db[_0x29b2('0x77')][_0x29b2('0x78')](function(_0x158d0b){return db[_0x29b2('0x6c')][_0x29b2('0x49')](_0x622dc2[_0x29b2('0x4a')],{'transaction':_0x158d0b})[_0x29b2('0x29')](function(_0x5d7eb2){_0x38321b=_0x5d7eb2;return _0xea56c2[_0x29b2('0x79')](_0x5d7eb2,{'transaction':_0x158d0b});})[_0x29b2('0x29')](function(){var _0x1c257e={'type':db[_0x29b2('0x7a')]['TEXT'],'transaction':_0x158d0b};switch(_0x622dc2[_0x29b2('0x4a')][_0x29b2('0x34')]){case _0x29b2('0x7b'):_0x1c257e[_0x29b2('0x34')]=db[_0x29b2('0x7a')][_0x29b2('0x7c')];break;case'number':_0x1c257e[_0x29b2('0x34')]=db['Sequelize'][_0x29b2('0x7d')];break;case _0x29b2('0x7e'):_0x1c257e['type']=db['Sequelize'][_0x29b2('0x7f')];_0x1c257e[_0x29b2('0x80')]=![];break;default:}return db['sequelize'][_0x29b2('0x81')][_0x29b2('0x82')]('cm_contacts',util[_0x29b2('0x69')](_0x29b2('0x83'),_0x38321b['id']),_0x1c257e);})[_0x29b2('0x29')](function(){return _0x38321b;});});}})[_0x29b2('0x29')](respondWithResult(_0x233cba,null))[_0x29b2('0x44')](handleError(_0x233cba,null));};exports['getCustomFields']=function(_0x4d6456,_0x2a7b20,_0x3fcb77){var _0x418a2c={};var _0x4287f0={};var _0x4c7f60;var _0x7788fc;return db[_0x29b2('0x32')][_0x29b2('0x76')]({'where':{'id':_0x4d6456[_0x29b2('0x51')]['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x2a7b20,null))[_0x29b2('0x29')](function(_0x5351b5){if(_0x5351b5){_0x4c7f60=_0x5351b5;_0x4287f0[_0x29b2('0x36')]=_[_0x29b2('0x45')](db[_0x29b2('0x6c')][_0x29b2('0x33')]);_0x4287f0['query']=_[_0x29b2('0x45')](_0x4d6456[_0x29b2('0x37')]);_0x4287f0[_0x29b2('0x38')]=_[_0x29b2('0x39')](_0x4287f0[_0x29b2('0x36')],_0x4287f0[_0x29b2('0x37')]);_0x418a2c['attributes']=_['intersection'](_0x4287f0[_0x29b2('0x36')],qs[_0x29b2('0x3b')](_0x4d6456['query'][_0x29b2('0x3b')]));_0x418a2c['attributes']=_0x418a2c[_0x29b2('0x3a')][_0x29b2('0x46')]?_0x418a2c[_0x29b2('0x3a')]:_0x4287f0[_0x29b2('0x36')];_0x418a2c[_0x29b2('0x56')]=qs[_0x29b2('0x3e')](_0x4d6456['query'][_0x29b2('0x3e')]);_0x418a2c[_0x29b2('0x3f')]=qs[_0x29b2('0x38')](_[_0x29b2('0x40')](_0x4d6456['query'],_0x4287f0['filters']));_0x418a2c[_0x29b2('0x3f')]=_[_0x29b2('0x41')](_0x418a2c[_0x29b2('0x3f')],{'$or':[{'ListId':_0x5351b5['id']},{'ListId':null}]});if(_0x4d6456[_0x29b2('0x37')][_0x29b2('0x57')]){_0x418a2c['where']=_[_0x29b2('0x41')](_0x418a2c[_0x29b2('0x3f')],{'$or':_['map'](_0x418a2c[_0x29b2('0x3a')],function(_0x1000ed){var _0x1606ef={};_0x1606ef[_0x1000ed]={'$like':'%'+_0x4d6456[_0x29b2('0x37')][_0x29b2('0x57')]+'%'};return _0x1606ef;})});}_0x418a2c=_['merge']({},_0x418a2c,_0x4d6456[_0x29b2('0x42')]);return db[_0x29b2('0x6c')]['findAndCountAll'](_0x418a2c);}})[_0x29b2('0x29')](respondWithResult(_0x2a7b20,null))[_0x29b2('0x44')](handleError(_0x2a7b20,null));};exports[_0x29b2('0x84')]=function(_0x473520,_0x2e8bfe,_0x9f5e){return db[_0x29b2('0x32')][_0x29b2('0x48')]({'where':{'id':_0x473520['params']['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x2e8bfe,null))[_0x29b2('0x29')](function(_0x3d8f96){if(_0x3d8f96){return _0x3d8f96['addAgents'](_0x473520['body'][_0x29b2('0x85')],_['omit'](_0x473520['body'],[_0x29b2('0x85'),'id'])||{})[_0x29b2('0x86')](function(_0x1a3c5b){for(var _0x4867cf=0x0;_0x4867cf<_0x473520[_0x29b2('0x4a')]['ids'][_0x29b2('0x46')];_0x4867cf+=0x1){socket[_0x29b2('0x87')](_0x29b2('0x88'),{'UserId':_0x473520[_0x29b2('0x4a')][_0x29b2('0x85')][_0x4867cf],'CmListId':_0x473520[_0x29b2('0x51')]['id']});}return _0x1a3c5b;});}})[_0x29b2('0x29')](respondWithResult(_0x2e8bfe,null))[_0x29b2('0x44')](handleError(_0x2e8bfe,null));};exports['removeAgents']=function(_0x5137c2,_0x6dbd25,_0x23b704){return db[_0x29b2('0x32')]['find']({'where':{'id':_0x5137c2['params']['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x6dbd25,null))['then'](function(_0x1fe14f){if(_0x1fe14f){return _0x1fe14f[_0x29b2('0x89')](_0x5137c2[_0x29b2('0x37')][_0x29b2('0x85')])['then'](function(){if(_['isArray'](_0x5137c2[_0x29b2('0x37')][_0x29b2('0x85')])){for(var _0x5e6b7f=0x0;_0x5e6b7f<_0x5137c2[_0x29b2('0x37')]['ids'][_0x29b2('0x46')];_0x5e6b7f+=0x1){socket['emit'](_0x29b2('0x8a'),{'UserId':Number(_0x5137c2[_0x29b2('0x37')][_0x29b2('0x85')][_0x5e6b7f]),'CmListId':Number(_0x5137c2['params']['id'])});}}else{socket[_0x29b2('0x87')](_0x29b2('0x8a'),{'UserId':Number(_0x5137c2[_0x29b2('0x37')][_0x29b2('0x85')]),'CmListId':Number(_0x5137c2[_0x29b2('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x6dbd25,null))[_0x29b2('0x44')](handleError(_0x6dbd25,null));};exports[_0x29b2('0x8b')]=function(_0x36008a,_0x2897a0,_0x3bb040){var _0x323fa0={};var _0x1ca875={};var _0x21caa0;var _0x4c703c;return db['CmList']['findOne']({'where':{'id':_0x36008a['params']['id']}})[_0x29b2('0x29')](handleEntityNotFound(_0x2897a0,null))['then'](function(_0x34d1aa){if(_0x34d1aa){_0x21caa0=_0x34d1aa;_0x1ca875[_0x29b2('0x36')]=_['keys'](db[_0x29b2('0x8c')][_0x29b2('0x33')]);_0x1ca875['query']=_[_0x29b2('0x45')](_0x36008a[_0x29b2('0x37')]);_0x1ca875[_0x29b2('0x38')]=_[_0x29b2('0x39')](_0x1ca875[_0x29b2('0x36')],_0x1ca875[_0x29b2('0x37')]);_0x323fa0['attributes']=_['intersection'](_0x1ca875[_0x29b2('0x36')],qs[_0x29b2('0x3b')](_0x36008a[_0x29b2('0x37')][_0x29b2('0x3b')]));_0x323fa0[_0x29b2('0x3a')]=_0x323fa0[_0x29b2('0x3a')][_0x29b2('0x46')]?_0x323fa0[_0x29b2('0x3a')]:_0x1ca875['model'];_0x323fa0['order']=qs[_0x29b2('0x3e')](_0x36008a[_0x29b2('0x37')][_0x29b2('0x3e')]);_0x323fa0[_0x29b2('0x3f')]=qs['filters'](_[_0x29b2('0x40')](_0x36008a[_0x29b2('0x37')],_0x1ca875[_0x29b2('0x38')]));if(_0x36008a['query'][_0x29b2('0x57')]){_0x323fa0[_0x29b2('0x3f')]=_[_0x29b2('0x41')](_0x323fa0['where'],{'$or':_[_0x29b2('0x31')](_0x323fa0[_0x29b2('0x3a')],function(_0x332faf){var _0x1e276a={};_0x1e276a[_0x332faf]={'$like':'%'+_0x36008a[_0x29b2('0x37')][_0x29b2('0x57')]+'%'};return _0x1e276a;})});}_0x323fa0=_[_0x29b2('0x41')]({},_0x323fa0,_0x36008a[_0x29b2('0x42')]);return _0x21caa0[_0x29b2('0x8b')](_0x323fa0);}})[_0x29b2('0x29')](function(_0x11c139){if(_0x11c139){_0x4c703c=_0x11c139[_0x29b2('0x46')];if(!_0x36008a[_0x29b2('0x37')]['hasOwnProperty'](_0x29b2('0x3d'))){_0x323fa0[_0x29b2('0x23')]=qs['limit'](_0x36008a['query']['limit']);_0x323fa0['offset']=qs['offset'](_0x36008a[_0x29b2('0x37')]['offset']);}return _0x21caa0[_0x29b2('0x8b')](_0x323fa0);}})[_0x29b2('0x29')](function(_0x43741c){if(_0x43741c){return _0x43741c?{'count':_0x4c703c,'rows':_0x43741c}:null;}})[_0x29b2('0x29')](respondWithResult(_0x2897a0,null))[_0x29b2('0x44')](handleError(_0x2897a0,null));}; \ No newline at end of file +var _0x965f=['Disposition','getDispositions','findOne','length','order','removeDispositions','ids','tags','isArray','join','push','omit','success','dataValues','errors','message','CmContact','format','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','CustomFields','concat','writeFileSync','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','destroy','get','Lists','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','CmList','includeAll','include','findAll','rows','show','options','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x965f,0x1ef));var _0xf965=function(_0x1191b7,_0x90f3f5){_0x1191b7=_0x1191b7-0x0;var _0xb6e8d=_0x965f[_0x1191b7];return _0xb6e8d;};'use strict';var pdf=require(_0xf965('0x0'));var emlformat=require(_0xf965('0x1'));var rimraf=require(_0xf965('0x2'));var zipdir=require(_0xf965('0x3'));var jsonpatch=require(_0xf965('0x4'));var rp=require(_0xf965('0x5'));var moment=require(_0xf965('0x6'));var BPromise=require(_0xf965('0x7'));var Mustache=require('mustache');var util=require(_0xf965('0x8'));var path=require(_0xf965('0x9'));var sox=require(_0xf965('0xa'));var csv=require('to-csv');var ejs=require(_0xf965('0xb'));var fs=require('fs');var _=require(_0xf965('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf965('0xd'));var deskjs=require(_0xf965('0xe'));var toCsv=require(_0xf965('0xf'));var querystring=require(_0xf965('0x10'));var Papa=require(_0xf965('0x11'));var Redis=require(_0xf965('0x12'));var authService=require(_0xf965('0x13'));var qs=require(_0xf965('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf965('0x15'));var logger=require(_0xf965('0x16'))(_0xf965('0x17'));var utils=require(_0xf965('0x18'));var config=require(_0xf965('0x19'));var db=require(_0xf965('0x1a'))['db'];config[_0xf965('0x1b')]=_[_0xf965('0x1c')](config[_0xf965('0x1b')],{'host':_0xf965('0x1d'),'port':0x18eb});var socket=require(_0xf965('0x1e'))(new Redis(config[_0xf965('0x1b')]));require(_0xf965('0x1f'))[_0xf965('0x20')](socket);function respondWithStatusCode(_0x5cdb04,_0x33e7e3){_0x33e7e3=_0x33e7e3||0xcc;return function(_0x55dac0){if(_0x55dac0){return _0x5cdb04[_0xf965('0x21')](_0x33e7e3);}return _0x5cdb04[_0xf965('0x22')](_0x33e7e3)[_0xf965('0x23')]();};}function respondWithResult(_0x4d891a,_0x5b38c7){_0x5b38c7=_0x5b38c7||0xc8;return function(_0x26d7f3){if(_0x26d7f3){return _0x4d891a[_0xf965('0x22')](_0x5b38c7)[_0xf965('0x24')](_0x26d7f3);}};}function respondWithFilteredResult(_0x43d59d,_0x2a4deb){return function(_0x34a342){if(_0x34a342){var _0x4d056e=_0x34a342[_0xf965('0x25')],_0x3d15e3=_0x2a4deb[_0xf965('0x26')],_0x5a974b=_0x2a4deb[_0xf965('0x26')]+_0x2a4deb['limit'],_0x5f4adb;if(_0x5a974b>=_0x4d056e){_0x5a974b=_0x4d056e;_0x5f4adb=0xc8;}else{_0x5f4adb=0xce;}_0x43d59d[_0xf965('0x22')](_0x5f4adb);return _0x43d59d[_0xf965('0x27')](_0xf965('0x28'),_0x3d15e3+'-'+_0x5a974b+'/'+_0x4d056e)[_0xf965('0x24')](_0x34a342);}return null;};}function patchUpdates(_0x3f5397){return function(_0x1409ce){try{jsonpatch['apply'](_0x1409ce,_0x3f5397,!![]);}catch(_0xee57b2){return BPromise['reject'](_0xee57b2);}return _0x1409ce[_0xf965('0x29')]();};}function saveUpdates(_0xdf66b5,_0x18acd6){return function(_0x53e681){if(_0x53e681){return _0x53e681[_0xf965('0x2a')](_0xdf66b5)[_0xf965('0x2b')](function(_0x5c4640){return _0x5c4640;});}return null;};}function removeEntity(_0x3c4de4,_0x40261a){return function(_0x43ba30){if(_0x43ba30){return _0x43ba30[_0xf965('0x2c')]()[_0xf965('0x2b')](function(){var _0x25586a=_0x43ba30[_0xf965('0x2d')]({'plain':!![]});var _0x5d3997=_0xf965('0x2e');return db[_0xf965('0x2f')][_0xf965('0x2c')]({'where':{'type':_0x5d3997,'resourceId':_0x25586a['id']}})[_0xf965('0x2b')](function(){return _0x43ba30;});})[_0xf965('0x2b')](function(){_0x3c4de4[_0xf965('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x236058,_0x24a993){return function(_0x3a1cd1){if(!_0x3a1cd1){_0x236058[_0xf965('0x21')](0x194);}return _0x3a1cd1;};}function handleError(_0x2b033f,_0x547e53){_0x547e53=_0x547e53||0x1f4;return function(_0x22a2cc){logger['error'](_0x22a2cc[_0xf965('0x30')]);if(_0x22a2cc[_0xf965('0x31')]){delete _0x22a2cc[_0xf965('0x31')];}_0x2b033f[_0xf965('0x22')](_0x547e53)[_0xf965('0x32')](_0x22a2cc);};}exports['index']=function(_0x2f21cf,_0xedc05a){var _0x5e8093={},_0x298c7c={},_0x19ba6c={'count':0x0,'rows':[]};var _0x3e5ab5=_[_0xf965('0x33')](db['CmList'][_0xf965('0x34')],function(_0x2873fc){return{'name':_0x2873fc[_0xf965('0x35')],'type':_0x2873fc[_0xf965('0x36')][_0xf965('0x37')]};});_0x298c7c[_0xf965('0x38')]=_[_0xf965('0x33')](_0x3e5ab5,_0xf965('0x31'));_0x298c7c[_0xf965('0x39')]=_[_0xf965('0x3a')](_0x2f21cf['query']);_0x298c7c[_0xf965('0x3b')]=_['intersection'](_0x298c7c[_0xf965('0x38')],_0x298c7c[_0xf965('0x39')]);_0x5e8093[_0xf965('0x3c')]=_[_0xf965('0x3d')](_0x298c7c[_0xf965('0x38')],qs['fields'](_0x2f21cf['query'][_0xf965('0x3e')]));_0x5e8093[_0xf965('0x3c')]=_0x5e8093[_0xf965('0x3c')]['length']?_0x5e8093[_0xf965('0x3c')]:_0x298c7c[_0xf965('0x38')];if(!_0x2f21cf[_0xf965('0x39')][_0xf965('0x3f')](_0xf965('0x40'))){_0x5e8093['limit']=qs[_0xf965('0x41')](_0x2f21cf[_0xf965('0x39')]['limit']);_0x5e8093[_0xf965('0x26')]=qs[_0xf965('0x26')](_0x2f21cf[_0xf965('0x39')][_0xf965('0x26')]);}_0x5e8093['order']=qs[_0xf965('0x42')](_0x2f21cf[_0xf965('0x39')][_0xf965('0x42')]);_0x5e8093[_0xf965('0x43')]=qs[_0xf965('0x3b')](_[_0xf965('0x44')](_0x2f21cf[_0xf965('0x39')],_0x298c7c[_0xf965('0x3b')]),_0x3e5ab5);if(_0x2f21cf[_0xf965('0x39')][_0xf965('0x45')]){_0x5e8093['where']=_[_0xf965('0x46')](_0x5e8093[_0xf965('0x43')],{'$or':_[_0xf965('0x33')](_0x3e5ab5,function(_0x46682a){if(_0x46682a[_0xf965('0x36')]!==_0xf965('0x47')){var _0x3c77ef={};_0x3c77ef[_0x46682a[_0xf965('0x31')]]={'$like':'%'+_0x2f21cf['query'][_0xf965('0x45')]+'%'};return _0x3c77ef;}})});}_0x5e8093=_[_0xf965('0x46')]({},_0x5e8093,_0x2f21cf['options']);var _0x2407cf={'where':_0x5e8093[_0xf965('0x43')]};return db[_0xf965('0x48')][_0xf965('0x25')](_0x2407cf)[_0xf965('0x2b')](function(_0x31a2b4){_0x19ba6c[_0xf965('0x25')]=_0x31a2b4;if(_0x2f21cf[_0xf965('0x39')][_0xf965('0x49')]){_0x5e8093[_0xf965('0x4a')]=[{'all':!![]}];}return db[_0xf965('0x48')][_0xf965('0x4b')](_0x5e8093);})[_0xf965('0x2b')](function(_0x961e64){_0x19ba6c[_0xf965('0x4c')]=_0x961e64;return _0x19ba6c;})['then'](respondWithFilteredResult(_0xedc05a,_0x5e8093))['catch'](handleError(_0xedc05a,null));};exports[_0xf965('0x4d')]=function(_0x292f31,_0x4e7e2f){var _0x2dc026={'raw':![],'where':{'id':_0x292f31['params']['id']}},_0x4ee77d={};_0x4ee77d['model']=_[_0xf965('0x3a')](db[_0xf965('0x48')][_0xf965('0x34')]);_0x4ee77d['query']=_[_0xf965('0x3a')](_0x292f31['query']);_0x4ee77d[_0xf965('0x3b')]=_[_0xf965('0x3d')](_0x4ee77d[_0xf965('0x38')],_0x4ee77d[_0xf965('0x39')]);_0x2dc026[_0xf965('0x3c')]=_[_0xf965('0x3d')](_0x4ee77d[_0xf965('0x38')],qs['fields'](_0x292f31[_0xf965('0x39')][_0xf965('0x3e')]));_0x2dc026[_0xf965('0x3c')]=_0x2dc026[_0xf965('0x3c')]['length']?_0x2dc026['attributes']:_0x4ee77d[_0xf965('0x38')];if(_0x292f31['query'][_0xf965('0x49')]){_0x2dc026[_0xf965('0x4a')]=[{'all':!![]}];}_0x2dc026=_['merge']({},_0x2dc026,_0x292f31[_0xf965('0x4e')]);return db[_0xf965('0x48')][_0xf965('0x4f')](_0x2dc026)[_0xf965('0x2b')](handleEntityNotFound(_0x4e7e2f,null))[_0xf965('0x2b')](respondWithResult(_0x4e7e2f,null))[_0xf965('0x50')](handleError(_0x4e7e2f,null));};exports[_0xf965('0x51')]=function(_0x575511,_0x5d56dc){return db[_0xf965('0x48')][_0xf965('0x51')](_0x575511[_0xf965('0x52')],{})[_0xf965('0x2b')](function(_0x34b737){var _0x1615e7=_0x575511['user'][_0xf965('0x2d')]({'plain':!![]});if(!_0x1615e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1615e7[_0xf965('0x53')]==='user'){var _0x1618ce=_0x34b737[_0xf965('0x2d')]({'plain':!![]});var _0x2a824d='Lists';return db[_0xf965('0x54')][_0xf965('0x4f')]({'where':{'name':_0x2a824d,'userProfileId':_0x1615e7[_0xf965('0x55')]},'raw':!![]})[_0xf965('0x2b')](function(_0x17dd6d){if(_0x17dd6d&&_0x17dd6d[_0xf965('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x1618ce['name'],'resourceId':_0x1618ce['id'],'type':_0x17dd6d[_0xf965('0x31')],'sectionId':_0x17dd6d['id']},{})[_0xf965('0x2b')](function(){return _0x34b737;});}else{return _0x34b737;}})[_0xf965('0x50')](function(_0x1cbdf8){logger[_0xf965('0x57')](_0xf965('0x58'),_0x1cbdf8);throw _0x1cbdf8;});}return _0x34b737;})[_0xf965('0x2b')](respondWithResult(_0x5d56dc,0xc9))[_0xf965('0x50')](handleError(_0x5d56dc,null));};exports[_0xf965('0x2a')]=function(_0x413fad,_0x5ed6cb){if(_0x413fad[_0xf965('0x52')]['id']){delete _0x413fad[_0xf965('0x52')]['id'];}return db[_0xf965('0x48')][_0xf965('0x4f')]({'where':{'id':_0x413fad[_0xf965('0x59')]['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0x5ed6cb,null))[_0xf965('0x2b')](saveUpdates(_0x413fad[_0xf965('0x52')],null))[_0xf965('0x2b')](respondWithResult(_0x5ed6cb,null))[_0xf965('0x50')](handleError(_0x5ed6cb,null));};exports[_0xf965('0x2c')]=function(_0x3800fe,_0x452ddc){return db['CmList'][_0xf965('0x4f')]({'where':{'id':_0x3800fe[_0xf965('0x59')]['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0x452ddc,null))[_0xf965('0x2b')](removeEntity(_0x452ddc,null))[_0xf965('0x50')](handleError(_0x452ddc,null));};exports['describe']=function(_0x4abed9,_0x2f7bd3){return db[_0xf965('0x48')][_0xf965('0x5a')]()[_0xf965('0x2b')](respondWithResult(_0x2f7bd3,null))[_0xf965('0x50')](handleError(_0x2f7bd3,null));};exports[_0xf965('0x5b')]=function(_0x46248b,_0x3c36a6,_0x3d1d41){if(_0x46248b[_0xf965('0x52')]['id']){delete _0x46248b[_0xf965('0x52')]['id'];}return db[_0xf965('0x48')]['find']({'where':{'id':_0x46248b[_0xf965('0x59')]['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0x3c36a6,null))['then'](function(_0x190a5f){if(_0x190a5f){_0x46248b[_0xf965('0x52')][_0xf965('0x5c')]=_0x190a5f['id'];return db[_0xf965('0x5d')]['create'](_0x46248b[_0xf965('0x52')]);}})[_0xf965('0x2b')](respondWithResult(_0x3c36a6,null))[_0xf965('0x50')](handleError(_0x3c36a6,null));};exports[_0xf965('0x5e')]=function(_0x4e5bea,_0x158de3,_0x522d0f){var _0x478021={'raw':![],'where':{}};var _0x50293c={};var _0x589c78={'count':0x0,'rows':[]};return db['CmList'][_0xf965('0x5f')]({'where':{'id':_0x4e5bea[_0xf965('0x59')]['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0x158de3,null))[_0xf965('0x2b')](function(_0x57bdb6){if(_0x57bdb6){_0x50293c['model']=_[_0xf965('0x3a')](db[_0xf965('0x5d')][_0xf965('0x34')]);_0x50293c[_0xf965('0x39')]=_[_0xf965('0x3a')](_0x4e5bea[_0xf965('0x39')]);_0x50293c[_0xf965('0x3b')]=_[_0xf965('0x3d')](_0x50293c[_0xf965('0x38')],_0x50293c[_0xf965('0x39')]);_0x478021[_0xf965('0x3c')]=_['intersection'](_0x50293c['model'],qs[_0xf965('0x3e')](_0x4e5bea[_0xf965('0x39')]['fields']));_0x478021[_0xf965('0x3c')]=_0x478021[_0xf965('0x3c')][_0xf965('0x60')]?_0x478021['attributes']:_0x50293c[_0xf965('0x38')];if(!_0x4e5bea['query']['hasOwnProperty'](_0xf965('0x40'))){_0x478021['limit']=qs[_0xf965('0x41')](_0x4e5bea['query']['limit']);_0x478021['offset']=qs['offset'](_0x4e5bea[_0xf965('0x39')]['offset']);}_0x478021[_0xf965('0x61')]=qs['sort'](_0x4e5bea['query'][_0xf965('0x42')]);_0x478021[_0xf965('0x43')]=qs[_0xf965('0x3b')](_[_0xf965('0x44')](_0x4e5bea[_0xf965('0x39')],_0x50293c[_0xf965('0x3b')]));_0x478021[_0xf965('0x43')][_0xf965('0x5c')]=_0x57bdb6['id'];if(_0x4e5bea[_0xf965('0x39')][_0xf965('0x45')]){_0x478021[_0xf965('0x43')]=_[_0xf965('0x46')](_0x478021[_0xf965('0x43')],{'$or':_['map'](_0x478021[_0xf965('0x3c')],function(_0x3aa60e){var _0x3e009d={};_0x3e009d[_0x3aa60e]={'$like':'%'+_0x4e5bea[_0xf965('0x39')][_0xf965('0x45')]+'%'};return _0x3e009d;})});}_0x478021=_[_0xf965('0x46')]({},_0x478021,_0x4e5bea[_0xf965('0x4e')]);return db[_0xf965('0x5d')][_0xf965('0x25')]({'where':_0x478021[_0xf965('0x43')]})[_0xf965('0x2b')](function(_0x55b0ed){_0x589c78['count']=_0x55b0ed;if(_0x4e5bea[_0xf965('0x39')][_0xf965('0x49')]){_0x478021[_0xf965('0x4a')]=[{'all':!![]}];}return db[_0xf965('0x5d')][_0xf965('0x4b')](_0x478021);})['then'](function(_0x831ba2){_0x589c78[_0xf965('0x4c')]=_0x831ba2;return _0x589c78;});}})[_0xf965('0x2b')](respondWithFilteredResult(_0x158de3,_0x478021))[_0xf965('0x50')](handleError(_0x158de3,null));};exports['removeDispositions']=function(_0x312304,_0x5cf515,_0x3bf99c){return db[_0xf965('0x48')]['find']({'where':{'id':_0x312304[_0xf965('0x59')]['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0x5cf515,null))[_0xf965('0x2b')](function(_0x17aded){if(_0x17aded){return _0x17aded[_0xf965('0x62')](_0x312304['query'][_0xf965('0x63')]);}})[_0xf965('0x2b')](respondWithStatusCode(_0x5cf515,null))[_0xf965('0x50')](handleError(_0x5cf515,null));};exports['addContacts']=function(_0x3bf827,_0x640a22,_0x5b71c8){return db['CmList']['find']({'where':{'id':_0x3bf827['params']['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0x640a22,null))[_0xf965('0x2b')](function(_0x3a2b10){if(_0x3a2b10){var _0x103dca=[];var _0x5bfd02={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xf965('0x2b')](function(_0x26a9d3){if(_0x3bf827['body'][_0xf965('0x64')]&&_[_0xf965('0x65')](_0x3bf827['body']['tags'])){if(_0x3bf827['body'][_0xf965('0x64')]['length']){_0x3bf827[_0xf965('0x52')][_0xf965('0x64')]=_0x3bf827[_0xf965('0x52')][_0xf965('0x64')][_0xf965('0x66')](';')+';';}else{_0x3bf827[_0xf965('0x52')][_0xf965('0x64')]=null;}}else{_0x3bf827['body'][_0xf965('0x64')]=null;}if(_0x3bf827['body']&&_[_0xf965('0x65')](_0x3bf827[_0xf965('0x52')])){for(var _0x134162=0x0;_0x134162<_0x3bf827[_0xf965('0x52')]['length'];_0x134162+=0x1){_0x3bf827[_0xf965('0x52')][_0x134162][_0xf965('0x5c')]=_0x3bf827[_0xf965('0x59')]['id'];_0x103dca[_0xf965('0x67')](_0x3bf827[_0xf965('0x52')][_0x134162]);}return BPromise['each'](_0x103dca,function(_0x1deb43){return db['CmContact'][_0xf965('0x51')](_[_0xf965('0x68')](_0x1deb43,[_0xf965('0x63'),'id'])||{},{'fields':_[_0xf965('0x3a')](_0x26a9d3),'raw':!![]})['then'](function(_0x1106c8){_0x5bfd02[_0xf965('0x69')][_0xf965('0x67')](_0x1106c8[_0xf965('0x6a')]);})[_0xf965('0x50')](function(_0xc98279){_0x5bfd02[_0xf965('0x6b')]['push']({'data':_0x1deb43,'error':_0xc98279[_0xf965('0x6c')]});});})[_0xf965('0x2b')](function(_0x345d40){return _0x5bfd02;})[_0xf965('0x50')](function(_0x4511e6){return _0x4511e6;});}else{_0x640a22[_0xf965('0x22')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xf965('0x2b')](respondWithResult(_0x640a22,null))['catch'](handleError(_0x640a22,null));};exports['getContacts']=function(_0x4e4da1,_0x17515c,_0x578056){var _0x4b8be5;return db['CmList'][_0xf965('0x4f')]({'where':{'id':_0x4e4da1[_0xf965('0x59')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xf965('0x2b')](handleEntityNotFound(_0x17515c,null))['then'](function(_0x20e007){if(_0x20e007){_0x4b8be5=_0x20e007;return db[_0xf965('0x6d')]['rawAttributes'];}})[_0xf965('0x2b')](function(_0x3bf34b){if(_0x3bf34b){var _0x236de6={};var _0x4511d9={};_0x4511d9[_0xf965('0x38')]=_['concat'](_[_0xf965('0x3a')](_0x3bf34b),_['map'](_0x4b8be5['CustomFields'],function(_0x9e7bb7){return util[_0xf965('0x6e')](_0xf965('0x6f'),_0x9e7bb7['id']);}));_0x4511d9[_0xf965('0x39')]=_[_0xf965('0x3a')](_0x4e4da1[_0xf965('0x39')]);_0x4511d9[_0xf965('0x3b')]=_[_0xf965('0x3d')](_0x4511d9['model'],_0x4511d9[_0xf965('0x39')]);_0x236de6['attributes']=_[_0xf965('0x3d')](_0x4511d9[_0xf965('0x38')],qs[_0xf965('0x3e')](_0x4e4da1['query'][_0xf965('0x3e')]));_0x236de6[_0xf965('0x3c')]=_0x236de6[_0xf965('0x3c')][_0xf965('0x60')]?_0x236de6[_0xf965('0x3c')]:_0x4511d9[_0xf965('0x38')];if(!_0x4e4da1[_0xf965('0x39')][_0xf965('0x3f')](_0xf965('0x40'))){_0x236de6[_0xf965('0x41')]=qs[_0xf965('0x41')](_0x4e4da1[_0xf965('0x39')][_0xf965('0x41')]);_0x236de6[_0xf965('0x26')]=qs[_0xf965('0x26')](_0x4e4da1[_0xf965('0x39')][_0xf965('0x26')]);}_0x236de6['order']=qs[_0xf965('0x42')](_0x4e4da1['query'][_0xf965('0x42')]);_0x236de6[_0xf965('0x43')]=qs['filters'](_['pick'](_0x4e4da1[_0xf965('0x39')],_0x4511d9[_0xf965('0x3b')]));_0x236de6[_0xf965('0x70')]=!![];if(_0x4e4da1[_0xf965('0x39')][_0xf965('0x45')]){_0x236de6[_0xf965('0x43')]=_[_0xf965('0x46')](_0x236de6[_0xf965('0x43')],{'$or':_['map'](_0x236de6[_0xf965('0x3c')],function(_0x29fc9d){var _0x426a11={};_0x426a11[_0x29fc9d]={'$like':'%'+_0x4e4da1['query']['filter']+'%'};return _0x426a11;})});}_0x236de6=_[_0xf965('0x46')]({},_0x236de6,_0x4e4da1[_0xf965('0x4e')]);return _0x4b8be5[_0xf965('0x71')](_0x236de6);}})[_0xf965('0x2b')](respondWithResult(_0x17515c,null))[_0xf965('0x50')](handleError(_0x17515c,null));};exports[_0xf965('0x72')]=function(_0x479d48,_0x564c70,_0xd1be77){var _0x2dbe30;return db['CmList'][_0xf965('0x4f')]({'where':{'id':_0x479d48[_0xf965('0x59')]['id']},'include':[{'model':db[_0xf965('0x73')],'as':_0xf965('0x74')}]})[_0xf965('0x2b')](handleEntityNotFound(_0x564c70,null))[_0xf965('0x2b')](function(_0x2bb9fb){if(_0x2bb9fb){_0x2dbe30=_0x2bb9fb;return db[_0xf965('0x6d')][_0xf965('0x34')];}})['then'](function(_0xb4e762){if(_0xb4e762){var _0x2e498d={};var _0x1f99c2={};_0x1f99c2['model']=_[_0xf965('0x75')](_[_0xf965('0x3a')](_0xb4e762),_[_0xf965('0x33')](_0x2dbe30[_0xf965('0x74')],function(_0x565178){return util['format'](_0xf965('0x6f'),_0x565178['id']);}));_0x1f99c2[_0xf965('0x39')]=_[_0xf965('0x3a')](_0x479d48[_0xf965('0x39')]);_0x1f99c2['filters']=_['intersection'](_0x1f99c2[_0xf965('0x38')],_0x1f99c2[_0xf965('0x39')]);_0x2e498d['attributes']=_['intersection'](_0x1f99c2[_0xf965('0x38')],qs['fields'](_0x479d48[_0xf965('0x39')][_0xf965('0x3e')]));_0x2e498d[_0xf965('0x3c')]=_0x2e498d[_0xf965('0x3c')]['length']?_0x2e498d[_0xf965('0x3c')]:_0x1f99c2[_0xf965('0x38')];if(!_0x479d48[_0xf965('0x39')][_0xf965('0x3f')](_0xf965('0x40'))){_0x2e498d[_0xf965('0x41')]=qs[_0xf965('0x41')](_0x479d48['query'][_0xf965('0x41')]);_0x2e498d[_0xf965('0x26')]=qs[_0xf965('0x26')](_0x479d48[_0xf965('0x39')][_0xf965('0x26')]);}_0x2e498d['order']=qs[_0xf965('0x42')](_0x479d48[_0xf965('0x39')]['sort']);_0x2e498d[_0xf965('0x43')]=qs[_0xf965('0x3b')](_[_0xf965('0x44')](_0x479d48[_0xf965('0x39')],_0x1f99c2[_0xf965('0x3b')]));_0x2e498d[_0xf965('0x70')]=!![];if(_0x479d48['query'][_0xf965('0x45')]){_0x2e498d[_0xf965('0x43')]=_['merge'](_0x2e498d[_0xf965('0x43')],{'$or':_['map'](_0x2e498d['attributes'],function(_0x492d80){var _0x44b788={};_0x44b788[_0x492d80]={'$like':'%'+_0x479d48[_0xf965('0x39')]['filter']+'%'};return _0x44b788;})});}_0x2e498d=_[_0xf965('0x46')]({},_0x2e498d,_0x479d48['options']);return _0x2dbe30[_0xf965('0x71')](_0x2e498d);}})[_0xf965('0x2b')](function(_0x53a7fa){if(!_['isEmpty'](_0x53a7fa)){var _0x1a88a2=toCsv(_0x53a7fa);var _0x2e82f1=Date['now']();fs[_0xf965('0x76')](util[_0xf965('0x6e')]('/tmp/list_%d_%s.csv',_0x2dbe30['id'],_0x2e82f1),_0x1a88a2);_0x564c70['setHeader']('Content-disposition',_0xf965('0x77')+util[_0xf965('0x6e')](_0xf965('0x78'),_0x2dbe30['id'],_0x2e82f1));_0x564c70[_0xf965('0x79')](_0xf965('0x7a'),_0xf965('0x7b'));return _0x564c70[_0xf965('0x7c')](util['format'](_0xf965('0x7d'),_0x2dbe30['id'],_0x2e82f1));}else{return _0x564c70[_0xf965('0x21')](0xcc);}})['catch'](handleError(_0x564c70,null));};exports[_0xf965('0x7e')]=function(_0x58fec3,_0x409d0e,_0x30852d){var _0x3b86e7;delete _0x58fec3[_0xf965('0x52')]['id'];return db[_0xf965('0x48')][_0xf965('0x5f')]({'where':{'id':_0x58fec3[_0xf965('0x59')]['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0x409d0e,null))[_0xf965('0x2b')](function(_0x361aeb){if(_0x361aeb){return db[_0xf965('0x7f')][_0xf965('0x80')](function(_0x1bf06f){return db[_0xf965('0x73')]['create'](_0x58fec3[_0xf965('0x52')],{'transaction':_0x1bf06f})[_0xf965('0x2b')](function(_0x56e7af){_0x3b86e7=_0x56e7af;return _0x361aeb[_0xf965('0x81')](_0x56e7af,{'transaction':_0x1bf06f});})[_0xf965('0x2b')](function(){var _0x2ae25d={'type':db[_0xf965('0x82')][_0xf965('0x83')],'transaction':_0x1bf06f};switch(_0x58fec3[_0xf965('0x52')][_0xf965('0x36')]){case _0xf965('0x84'):_0x2ae25d['type']=db['Sequelize']['TEXT'];break;case _0xf965('0x85'):_0x2ae25d[_0xf965('0x36')]=db[_0xf965('0x82')][_0xf965('0x86')];break;case'switch':_0x2ae25d[_0xf965('0x36')]=db[_0xf965('0x82')]['BOOLEAN'];_0x2ae25d[_0xf965('0x87')]=![];break;default:}return db[_0xf965('0x7f')][_0xf965('0x88')][_0xf965('0x89')](_0xf965('0x8a'),util[_0xf965('0x6e')](_0xf965('0x8b'),_0x3b86e7['id']),_0x2ae25d);})['then'](function(){return _0x3b86e7;});});}})[_0xf965('0x2b')](respondWithResult(_0x409d0e,null))[_0xf965('0x50')](handleError(_0x409d0e,null));};exports[_0xf965('0x8c')]=function(_0x165a2c,_0xc89753,_0x2eb0ca){var _0x2c1337={};var _0x45f36c={};var _0x2df1a6;var _0x280a1b;return db[_0xf965('0x48')][_0xf965('0x5f')]({'where':{'id':_0x165a2c[_0xf965('0x59')]['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0xc89753,null))[_0xf965('0x2b')](function(_0x3fc367){if(_0x3fc367){_0x2df1a6=_0x3fc367;_0x45f36c[_0xf965('0x38')]=_[_0xf965('0x3a')](db[_0xf965('0x73')][_0xf965('0x34')]);_0x45f36c[_0xf965('0x39')]=_[_0xf965('0x3a')](_0x165a2c[_0xf965('0x39')]);_0x45f36c[_0xf965('0x3b')]=_[_0xf965('0x3d')](_0x45f36c[_0xf965('0x38')],_0x45f36c[_0xf965('0x39')]);_0x2c1337['attributes']=_[_0xf965('0x3d')](_0x45f36c[_0xf965('0x38')],qs[_0xf965('0x3e')](_0x165a2c[_0xf965('0x39')][_0xf965('0x3e')]));_0x2c1337[_0xf965('0x3c')]=_0x2c1337[_0xf965('0x3c')][_0xf965('0x60')]?_0x2c1337[_0xf965('0x3c')]:_0x45f36c[_0xf965('0x38')];_0x2c1337[_0xf965('0x61')]=qs['sort'](_0x165a2c['query']['sort']);_0x2c1337[_0xf965('0x43')]=qs[_0xf965('0x3b')](_[_0xf965('0x44')](_0x165a2c['query'],_0x45f36c[_0xf965('0x3b')]));_0x2c1337[_0xf965('0x43')]=_[_0xf965('0x46')](_0x2c1337[_0xf965('0x43')],{'$or':[{'ListId':_0x3fc367['id']},{'ListId':null}]});if(_0x165a2c[_0xf965('0x39')][_0xf965('0x45')]){_0x2c1337[_0xf965('0x43')]=_['merge'](_0x2c1337['where'],{'$or':_[_0xf965('0x33')](_0x2c1337['attributes'],function(_0x5c3ca9){var _0x54deac={};_0x54deac[_0x5c3ca9]={'$like':'%'+_0x165a2c[_0xf965('0x39')][_0xf965('0x45')]+'%'};return _0x54deac;})});}_0x2c1337=_[_0xf965('0x46')]({},_0x2c1337,_0x165a2c[_0xf965('0x4e')]);return db[_0xf965('0x73')]['findAndCountAll'](_0x2c1337);}})[_0xf965('0x2b')](respondWithResult(_0xc89753,null))[_0xf965('0x50')](handleError(_0xc89753,null));};exports['addAgents']=function(_0x1880d2,_0x2dbad2,_0x555cea){return db['CmList'][_0xf965('0x4f')]({'where':{'id':_0x1880d2[_0xf965('0x59')]['id']}})['then'](handleEntityNotFound(_0x2dbad2,null))[_0xf965('0x2b')](function(_0x33ef96){if(_0x33ef96){return _0x33ef96[_0xf965('0x8d')](_0x1880d2['body']['ids'],_['omit'](_0x1880d2['body'],[_0xf965('0x63'),'id'])||{})[_0xf965('0x8e')](function(_0x16f04d){for(var _0x5edc95=0x0;_0x5edc95<_0x1880d2[_0xf965('0x52')][_0xf965('0x63')]['length'];_0x5edc95+=0x1){socket[_0xf965('0x8f')]('userCmList:save',{'UserId':_0x1880d2[_0xf965('0x52')][_0xf965('0x63')][_0x5edc95],'CmListId':_0x1880d2['params']['id']});}return _0x16f04d;});}})['then'](respondWithResult(_0x2dbad2,null))[_0xf965('0x50')](handleError(_0x2dbad2,null));};exports[_0xf965('0x90')]=function(_0x5a1927,_0xbe299c,_0x14e88e){return db[_0xf965('0x48')][_0xf965('0x4f')]({'where':{'id':_0x5a1927['params']['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0xbe299c,null))['then'](function(_0x26348c){if(_0x26348c){return _0x26348c[_0xf965('0x90')](_0x5a1927['query'][_0xf965('0x63')])[_0xf965('0x2b')](function(){if(_[_0xf965('0x65')](_0x5a1927[_0xf965('0x39')][_0xf965('0x63')])){for(var _0x205298=0x0;_0x205298<_0x5a1927['query'][_0xf965('0x63')]['length'];_0x205298+=0x1){socket[_0xf965('0x8f')](_0xf965('0x91'),{'UserId':Number(_0x5a1927[_0xf965('0x39')][_0xf965('0x63')][_0x205298]),'CmListId':Number(_0x5a1927[_0xf965('0x59')]['id'])});}}else{socket[_0xf965('0x8f')](_0xf965('0x91'),{'UserId':Number(_0x5a1927[_0xf965('0x39')][_0xf965('0x63')]),'CmListId':Number(_0x5a1927[_0xf965('0x59')]['id'])});}});}})[_0xf965('0x2b')](respondWithStatusCode(_0xbe299c,null))[_0xf965('0x50')](handleError(_0xbe299c,null));};exports['getAgents']=function(_0x443a39,_0x19b119,_0x3808ec){var _0xf627b3={};var _0x258581={};var _0x166435;var _0x1bde91;return db[_0xf965('0x48')][_0xf965('0x5f')]({'where':{'id':_0x443a39[_0xf965('0x59')]['id']}})[_0xf965('0x2b')](handleEntityNotFound(_0x19b119,null))[_0xf965('0x2b')](function(_0x40f110){if(_0x40f110){_0x166435=_0x40f110;_0x258581[_0xf965('0x38')]=_['keys'](db[_0xf965('0x92')]['rawAttributes']);_0x258581[_0xf965('0x39')]=_['keys'](_0x443a39[_0xf965('0x39')]);_0x258581[_0xf965('0x3b')]=_[_0xf965('0x3d')](_0x258581['model'],_0x258581[_0xf965('0x39')]);_0xf627b3[_0xf965('0x3c')]=_['intersection'](_0x258581['model'],qs[_0xf965('0x3e')](_0x443a39[_0xf965('0x39')][_0xf965('0x3e')]));_0xf627b3[_0xf965('0x3c')]=_0xf627b3[_0xf965('0x3c')][_0xf965('0x60')]?_0xf627b3['attributes']:_0x258581[_0xf965('0x38')];_0xf627b3['order']=qs[_0xf965('0x42')](_0x443a39['query'][_0xf965('0x42')]);_0xf627b3[_0xf965('0x43')]=qs[_0xf965('0x3b')](_[_0xf965('0x44')](_0x443a39[_0xf965('0x39')],_0x258581['filters']));if(_0x443a39[_0xf965('0x39')][_0xf965('0x45')]){_0xf627b3[_0xf965('0x43')]=_[_0xf965('0x46')](_0xf627b3[_0xf965('0x43')],{'$or':_[_0xf965('0x33')](_0xf627b3[_0xf965('0x3c')],function(_0x3173f1){var _0x494014={};_0x494014[_0x3173f1]={'$like':'%'+_0x443a39[_0xf965('0x39')][_0xf965('0x45')]+'%'};return _0x494014;})});}_0xf627b3=_[_0xf965('0x46')]({},_0xf627b3,_0x443a39[_0xf965('0x4e')]);return _0x166435['getAgents'](_0xf627b3);}})[_0xf965('0x2b')](function(_0xd9c459){if(_0xd9c459){_0x1bde91=_0xd9c459[_0xf965('0x60')];if(!_0x443a39[_0xf965('0x39')][_0xf965('0x3f')](_0xf965('0x40'))){_0xf627b3['limit']=qs['limit'](_0x443a39['query'][_0xf965('0x41')]);_0xf627b3[_0xf965('0x26')]=qs[_0xf965('0x26')](_0x443a39[_0xf965('0x39')][_0xf965('0x26')]);}return _0x166435['getAgents'](_0xf627b3);}})[_0xf965('0x2b')](function(_0x5781bf){if(_0x5781bf){return _0x5781bf?{'count':_0x1bde91,'rows':_0x5781bf}:null;}})[_0xf965('0x2b')](respondWithResult(_0x19b119,null))['catch'](handleError(_0x19b119,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 114e47a..94f72ed 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 _0x81d6=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','CmList'];(function(_0x38a3d6,_0x52e305){var _0x3768d7=function(_0x1af8a9){while(--_0x1af8a9){_0x38a3d6['push'](_0x38a3d6['shift']());}};_0x3768d7(++_0x52e305);}(_0x81d6,0xa0));var _0x681d=function(_0x234be1,_0x12c079){_0x234be1=_0x234be1-0x0;var _0xd70229=_0x81d6[_0x234be1];return _0xd70229;};'use strict';var EventEmitter=require('events');var CmList=require(_0x681d('0x0'))['db'][_0x681d('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x681d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x681d('0x3'),'afterDestroy':_0x681d('0x4')};function emitEvent(_0x3cb757){return function(_0x22c53b,_0x215f61,_0x51c3c0){CmListEvents[_0x681d('0x5')](_0x3cb757+':'+_0x22c53b['id'],_0x22c53b);CmListEvents[_0x681d('0x5')](_0x3cb757,_0x22c53b);_0x51c3c0(null);};}for(var e in events){if(events[_0x681d('0x6')](e)){var event=events[e];CmList[_0x681d('0x7')](e,emitEvent(event));}}module[_0x681d('0x8')]=CmListEvents; \ No newline at end of file +var _0xce18=['emit','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0xda4fad,_0x37db34){var _0x56ae95=function(_0x43804a){while(--_0x43804a){_0xda4fad['push'](_0xda4fad['shift']());}};_0x56ae95(++_0x37db34);}(_0xce18,0xbb));var _0x8ce1=function(_0x5f2081,_0x1ca802){_0x5f2081=_0x5f2081-0x0;var _0x144cf2=_0xce18[_0x5f2081];return _0x144cf2;};'use strict';var EventEmitter=require(_0x8ce1('0x0'));var CmList=require(_0x8ce1('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x8ce1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ce1('0x3'),'afterDestroy':_0x8ce1('0x4')};function emitEvent(_0x149890){return function(_0x31e50b,_0x36e1a7,_0x110bbf){CmListEvents[_0x8ce1('0x5')](_0x149890+':'+_0x31e50b['id'],_0x31e50b);CmListEvents['emit'](_0x149890,_0x31e50b);_0x110bbf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x8ce1('0x6')](e,emitEvent(event));}}module[_0x8ce1('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cb7b62d..4e26886 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 _0x74dd=['bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','CmList','cm_lists','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74dd,0x71));var _0xd74d=function(_0x1ec9d1,_0x35ecaf){_0x1ec9d1=_0x1ec9d1-0x0;var _0x4b6bc2=_0x74dd[_0x1ec9d1];return _0x4b6bc2;};'use strict';var _=require(_0xd74d('0x0'));var util=require(_0xd74d('0x1'));var logger=require(_0xd74d('0x2'))(_0xd74d('0x3'));var moment=require('moment');var BPromise=require(_0xd74d('0x4'));var rp=require(_0xd74d('0x5'));var fs=require('fs');var path=require(_0xd74d('0x6'));var rimraf=require(_0xd74d('0x7'));var config=require(_0xd74d('0x8'));var attributes=require(_0xd74d('0x9'));module[_0xd74d('0xa')]=function(_0x4283fb,_0x4a8ccc){return _0x4283fb['define'](_0xd74d('0xb'),attributes,{'tableName':_0xd74d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmList','lodash','util','../../config/logger','api'];(function(_0x324e8c,_0xee1511){var _0x3ad3e8=function(_0x3e5bcc){while(--_0x3e5bcc){_0x324e8c['push'](_0x324e8c['shift']());}};_0x3ad3e8(++_0xee1511);}(_0x9fd8,0x168));var _0x89fd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9fd8[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x89fd('0x0'));var util=require(_0x89fd('0x1'));var logger=require(_0x89fd('0x2'))(_0x89fd('0x3'));var moment=require(_0x89fd('0x4'));var BPromise=require(_0x89fd('0x5'));var rp=require(_0x89fd('0x6'));var fs=require('fs');var path=require(_0x89fd('0x7'));var rimraf=require(_0x89fd('0x8'));var config=require(_0x89fd('0x9'));var attributes=require('./cmList.attributes');module[_0x89fd('0xa')]=function(_0x51081c,_0x1a66b2){return _0x51081c[_0x89fd('0xb')](_0x89fd('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 97bac60..2c99c00 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 _0x693e=['socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x693e,0xe6));var _0xe693=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x693e[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe693('0x0'));var util=require(_0xe693('0x1'));var moment=require(_0xe693('0x2'));var BPromise=require(_0xe693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe693('0x4'))['db'];var utils=require(_0xe693('0x5'));var logger=require(_0xe693('0x6'))(_0xe693('0x7'));var config=require(_0xe693('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe693('0x9')]['http']({'port':0x232a});config[_0xe693('0xa')]=_[_0xe693('0xb')](config[_0xe693('0xa')],{'host':_0xe693('0xc'),'port':0x18eb});var socket=require(_0xe693('0xd'))(new Redis(config[_0xe693('0xa')]));require(_0xe693('0xe'))[_0xe693('0xf')](socket);function respondWithRpcPromise(_0x56b3f7,_0x49300d,_0x20aaed){return new BPromise(function(_0x5ab0af,_0x5235cd){return client['request'](_0x56b3f7,_0x20aaed)[_0xe693('0x10')](function(_0x3cd94f){logger[_0xe693('0x11')](_0xe693('0x12'),_0x49300d,'request\x20sent');logger[_0xe693('0x13')](_0xe693('0x14'),_0x49300d,_0xe693('0x15'),JSON[_0xe693('0x16')](_0x3cd94f));if(_0x3cd94f[_0xe693('0x17')]){if(_0x3cd94f[_0xe693('0x17')][_0xe693('0x18')]===0x1f4){logger[_0xe693('0x17')]('CmList,\x20%s,\x20%s',_0x49300d,_0x3cd94f['error'][_0xe693('0x19')]);return _0x5235cd(_0x3cd94f[_0xe693('0x17')][_0xe693('0x19')]);}logger[_0xe693('0x17')](_0xe693('0x12'),_0x49300d,_0x3cd94f[_0xe693('0x17')][_0xe693('0x19')]);return _0x5ab0af(_0x3cd94f['error'][_0xe693('0x19')]);}else{logger['info'](_0xe693('0x12'),_0x49300d,'request\x20sent');_0x5ab0af(_0x3cd94f['result'][_0xe693('0x19')]);}})[_0xe693('0x1a')](function(_0x4deb93){logger['error'](_0xe693('0x12'),_0x49300d,_0x4deb93);_0x5235cd(_0x4deb93);});});} \ No newline at end of file +var _0xd6e4=['defaults','localhost','socket.io-emitter','./cmList.socket','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','code','error','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis'];(function(_0x23e389,_0x5ea9f6){var _0x235fd5=function(_0x281293){while(--_0x281293){_0x23e389['push'](_0x23e389['shift']());}};_0x235fd5(++_0x5ea9f6);}(_0xd6e4,0x194));var _0x4d6e=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xd6e4[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require(_0x4d6e('0x0'));var moment=require(_0x4d6e('0x1'));var BPromise=require(_0x4d6e('0x2'));var rs=require(_0x4d6e('0x3'));var fs=require('fs');var Redis=require(_0x4d6e('0x4'));var db=require(_0x4d6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d6e('0x6'));var config=require(_0x4d6e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d6e('0x8')]({'port':0x232a});config[_0x4d6e('0x9')]=_[_0x4d6e('0xa')](config[_0x4d6e('0x9')],{'host':_0x4d6e('0xb'),'port':0x18eb});var socket=require(_0x4d6e('0xc'))(new Redis(config['redis']));require(_0x4d6e('0xd'))['register'](socket);function respondWithRpcPromise(_0x3842b0,_0xc0a5ea,_0x2fe6e8){return new BPromise(function(_0x43e0fa,_0xb7a7d9){return client['request'](_0x3842b0,_0x2fe6e8)['then'](function(_0x1251a7){logger['info'](_0x4d6e('0xe'),_0xc0a5ea,_0x4d6e('0xf'));logger[_0x4d6e('0x10')](_0x4d6e('0x11'),_0xc0a5ea,_0x4d6e('0xf'),JSON['stringify'](_0x1251a7));if(_0x1251a7['error']){if(_0x1251a7['error'][_0x4d6e('0x12')]===0x1f4){logger[_0x4d6e('0x13')]('CmList,\x20%s,\x20%s',_0xc0a5ea,_0x1251a7[_0x4d6e('0x13')]['message']);return _0xb7a7d9(_0x1251a7[_0x4d6e('0x13')][_0x4d6e('0x14')]);}logger['error'](_0x4d6e('0xe'),_0xc0a5ea,_0x1251a7[_0x4d6e('0x13')][_0x4d6e('0x14')]);return _0x43e0fa(_0x1251a7[_0x4d6e('0x13')][_0x4d6e('0x14')]);}else{logger[_0x4d6e('0x15')](_0x4d6e('0xe'),_0xc0a5ea,_0x4d6e('0xf'));_0x43e0fa(_0x1251a7['result'][_0x4d6e('0x14')]);}})[_0x4d6e('0x16')](function(_0x4f503a){logger[_0x4d6e('0x13')](_0x4d6e('0xe'),_0xc0a5ea,_0x4f503a);_0xb7a7d9(_0x4f503a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f0d297d..63c6992 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 _0xd9ce=['update','emit','removeListener','register','./cmList.events','save','remove'];(function(_0x185f00,_0x1f9754){var _0x2ef08e=function(_0x1c3c93){while(--_0x1c3c93){_0x185f00['push'](_0x185f00['shift']());}};_0x2ef08e(++_0x1f9754);}(_0xd9ce,0xeb));var _0xed9c=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xd9ce[_0x479160];return _0x47ac6d;};'use strict';var CmListEvents=require(_0xed9c('0x0'));var events=[_0xed9c('0x1'),_0xed9c('0x2'),_0xed9c('0x3')];function createListener(_0x3892c2,_0x2008a1){return function(_0x1aa913){_0x2008a1[_0xed9c('0x4')](_0x3892c2,_0x1aa913);};}function removeListener(_0x5903b6,_0x3c9c4a){return function(){CmListEvents[_0xed9c('0x5')](_0x5903b6,_0x3c9c4a);};}exports[_0xed9c('0x6')]=function(_0x154e9d){for(var _0x3043a6=0x0,_0x434898=events['length'];_0x3043a6<_0x434898;_0x3043a6++){var _0x2ad757=events[_0x3043a6];var _0xde32e4=createListener('cmList:'+_0x2ad757,_0x154e9d);CmListEvents['on'](_0x2ad757,_0xde32e4);}}; \ No newline at end of file +var _0xb1aa=['register','cmList:','./cmList.events','save','update','emit','removeListener'];(function(_0xc3718,_0xfb1706){var _0x5b1b24=function(_0x147f5b){while(--_0x147f5b){_0xc3718['push'](_0xc3718['shift']());}};_0x5b1b24(++_0xfb1706);}(_0xb1aa,0x159));var _0xab1a=function(_0x2404d8,_0x2065d1){_0x2404d8=_0x2404d8-0x0;var _0x355b92=_0xb1aa[_0x2404d8];return _0x355b92;};'use strict';var CmListEvents=require(_0xab1a('0x0'));var events=[_0xab1a('0x1'),'remove',_0xab1a('0x2')];function createListener(_0x533883,_0x356a88){return function(_0x3e02fd){_0x356a88[_0xab1a('0x3')](_0x533883,_0x3e02fd);};}function removeListener(_0x3c224b,_0x2371d3){return function(){CmListEvents[_0xab1a('0x4')](_0x3c224b,_0x2371d3);};}exports[_0xab1a('0x5')]=function(_0x6fcb8){for(var _0x38b3c8=0x0,_0x1e7ff9=events['length'];_0x38b3c8<_0x1e7ff9;_0x38b3c8++){var _0x400319=events[_0x38b3c8];var _0x55a6d=createListener(_0xab1a('0x6')+_0x400319,_0x6fcb8);CmListEvents['on'](_0x400319,_0x55a6d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 58c8eef..ae86942 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 _0xab9e=['/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','post','addDisposition','addContacts','/:id/fields','/:id/users','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0xab9e,0x133));var _0xeab9=function(_0x59d261,_0x15e54e){_0x59d261=_0x59d261-0x0;var _0x4154df=_0xab9e[_0x59d261];return _0x4154df;};'use strict';var multer=require('multer');var util=require(_0xeab9('0x0'));var path=require(_0xeab9('0x1'));var timeout=require(_0xeab9('0x2'));var express=require(_0xeab9('0x3'));var router=express['Router']();var auth=require(_0xeab9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeab9('0x5'));var controller=require('./cmList.controller');router[_0xeab9('0x6')]('/',auth[_0xeab9('0x7')](),controller[_0xeab9('0x8')]);router[_0xeab9('0x6')](_0xeab9('0x9'),auth[_0xeab9('0x7')](),controller['describe']);router[_0xeab9('0x6')](_0xeab9('0xa'),auth[_0xeab9('0x7')](),controller[_0xeab9('0xb')]);router[_0xeab9('0x6')](_0xeab9('0xc'),auth[_0xeab9('0x7')](),controller[_0xeab9('0xd')]);router['get'](_0xeab9('0xe'),auth[_0xeab9('0x7')](),controller['getContacts']);router[_0xeab9('0x6')](_0xeab9('0xf'),auth['isAuthenticated'](),controller[_0xeab9('0x10')]);router['get']('/:id/fields',auth[_0xeab9('0x7')](),controller[_0xeab9('0x11')]);router[_0xeab9('0x6')]('/:id/users',auth[_0xeab9('0x7')](),controller['getAgents']);router[_0xeab9('0x12')]('/',auth[_0xeab9('0x7')](),controller['create']);router[_0xeab9('0x12')](_0xeab9('0xc'),auth[_0xeab9('0x7')](),controller[_0xeab9('0x13')]);router[_0xeab9('0x12')](_0xeab9('0xe'),auth[_0xeab9('0x7')](),controller[_0xeab9('0x14')]);router[_0xeab9('0x12')](_0xeab9('0x15'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xeab9('0x12')](_0xeab9('0x16'),auth[_0xeab9('0x7')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xeab9('0x17')]);router[_0xeab9('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xeab9('0x19')]);router[_0xeab9('0x18')](_0xeab9('0xc'),auth[_0xeab9('0x7')](),controller[_0xeab9('0x1a')]);router[_0xeab9('0x18')](_0xeab9('0x16'),auth[_0xeab9('0x7')](),controller[_0xeab9('0x1b')]);module[_0xeab9('0x1c')]=router; \ No newline at end of file +var _0x3bad=['removeAgents','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions'];(function(_0x9a87df,_0x216aa4){var _0x4f64b4=function(_0x7685d6){while(--_0x7685d6){_0x9a87df['push'](_0x9a87df['shift']());}};_0x4f64b4(++_0x216aa4);}(_0x3bad,0xac));var _0xd3ba=function(_0x355759,_0x16b7ec){_0x355759=_0x355759-0x0;var _0x1f9133=_0x3bad[_0x355759];return _0x1f9133;};'use strict';var multer=require(_0xd3ba('0x0'));var util=require('util');var path=require(_0xd3ba('0x1'));var timeout=require('connect-timeout');var express=require(_0xd3ba('0x2'));var router=express[_0xd3ba('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd3ba('0x4'));var config=require(_0xd3ba('0x5'));var controller=require(_0xd3ba('0x6'));router[_0xd3ba('0x7')]('/',auth[_0xd3ba('0x8')](),controller['index']);router['get'](_0xd3ba('0x9'),auth['isAuthenticated'](),controller[_0xd3ba('0xa')]);router[_0xd3ba('0x7')](_0xd3ba('0xb'),auth[_0xd3ba('0x8')](),controller[_0xd3ba('0xc')]);router[_0xd3ba('0x7')](_0xd3ba('0xd'),auth[_0xd3ba('0x8')](),controller[_0xd3ba('0xe')]);router[_0xd3ba('0x7')](_0xd3ba('0xf'),auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x10')]);router[_0xd3ba('0x7')](_0xd3ba('0x11'),auth['isAuthenticated'](),controller[_0xd3ba('0x12')]);router[_0xd3ba('0x7')](_0xd3ba('0x13'),auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x14')]);router['get'](_0xd3ba('0x15'),auth[_0xd3ba('0x8')](),controller['getAgents']);router[_0xd3ba('0x16')]('/',auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x17')]);router[_0xd3ba('0x16')]('/:id/dispositions',auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x18')]);router['post'](_0xd3ba('0xf'),auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x19')]);router['post'](_0xd3ba('0x13'),auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x1a')]);router[_0xd3ba('0x16')]('/:id/users',auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x1b')]);router['put']('/:id',auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x1c')]);router[_0xd3ba('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xd3ba('0x1e')]);router[_0xd3ba('0x1d')]('/:id/dispositions',auth[_0xd3ba('0x8')](),controller[_0xd3ba('0x1f')]);router[_0xd3ba('0x1d')](_0xd3ba('0x15'),auth['isAuthenticated'](),controller[_0xd3ba('0x20')]);module[_0xd3ba('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f0859a0..8bfa45a 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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x57d669,_0x21fb7e){var _0x127a13=function(_0x5222d0){while(--_0x5222d0){_0x57d669['push'](_0x57d669['shift']());}};_0x127a13(++_0x21fb7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x3b7735,_0x564644){var _0x5886a9=function(_0x5b95d9){while(--_0x5b95d9){_0x3b7735['push'](_0x3b7735['shift']());}};_0x5886a9(++_0x564644);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index d4abd46..eb1f658 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 _0x6e1c=['to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','Condition','params','catch','find','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xc6e1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc6e1('0x1'));var jsonpatch=require(_0xc6e1('0x2'));var rp=require(_0xc6e1('0x3'));var moment=require(_0xc6e1('0x4'));var BPromise=require(_0xc6e1('0x5'));var Mustache=require(_0xc6e1('0x6'));var util=require(_0xc6e1('0x7'));var path=require(_0xc6e1('0x8'));var sox=require(_0xc6e1('0x9'));var csv=require(_0xc6e1('0xa'));var ejs=require(_0xc6e1('0xb'));var fs=require('fs');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('0xa'));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 db=require(_0xc6e1('0x17'))['db'];function respondWithStatusCode(_0x1c8aa7,_0x22b511){_0x22b511=_0x22b511||0xcc;return function(_0x3526e7){if(_0x3526e7){return _0x1c8aa7['sendStatus'](_0x22b511);}return _0x1c8aa7[_0xc6e1('0x18')](_0x22b511)[_0xc6e1('0x19')]();};}function respondWithResult(_0x355409,_0x2d554f){_0x2d554f=_0x2d554f||0xc8;return function(_0x3573dd){if(_0x3573dd){return _0x355409['status'](_0x2d554f)['json'](_0x3573dd);}};}function respondWithFilteredResult(_0x42e7a1,_0x30428e){return function(_0x5da248){if(_0x5da248){var _0x6a58af=_0x5da248[_0xc6e1('0x1a')],_0x580fae=_0x30428e[_0xc6e1('0x1b')],_0x353469=_0x30428e[_0xc6e1('0x1b')]+_0x30428e[_0xc6e1('0x1c')],_0x5645d3;if(_0x353469>=_0x6a58af){_0x353469=_0x6a58af;_0x5645d3=0xc8;}else{_0x5645d3=0xce;}_0x42e7a1['status'](_0x5645d3);return _0x42e7a1[_0xc6e1('0x1d')](_0xc6e1('0x1e'),_0x580fae+'-'+_0x353469+'/'+_0x6a58af)[_0xc6e1('0x1f')](_0x5da248);}return null;};}function patchUpdates(_0x11f476){return function(_0x302e56){try{jsonpatch[_0xc6e1('0x20')](_0x302e56,_0x11f476,!![]);}catch(_0x1e5d0c){return BPromise[_0xc6e1('0x21')](_0x1e5d0c);}return _0x302e56[_0xc6e1('0x22')]();};}function saveUpdates(_0x1046b9,_0x23369a){return function(_0x816a){if(_0x816a){return _0x816a[_0xc6e1('0x23')](_0x1046b9)[_0xc6e1('0x24')](function(_0x4cb1f9){return _0x4cb1f9;});}return null;};}function removeEntity(_0x7afa3a,_0x255ae1){return function(_0x1ed09e){if(_0x1ed09e){return _0x1ed09e[_0xc6e1('0x25')]()[_0xc6e1('0x24')](function(){_0x7afa3a[_0xc6e1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484d0c,_0x40b059){return function(_0x5597d3){if(!_0x5597d3){_0x484d0c[_0xc6e1('0x26')](0x194);}return _0x5597d3;};}function handleError(_0xcc509,_0x5421d1){_0x5421d1=_0x5421d1||0x1f4;return function(_0x4b044c){logger[_0xc6e1('0x27')](_0x4b044c[_0xc6e1('0x28')]);if(_0x4b044c['name']){delete _0x4b044c[_0xc6e1('0x29')];}_0xcc509[_0xc6e1('0x18')](_0x5421d1)[_0xc6e1('0x2a')](_0x4b044c);};}exports[_0xc6e1('0x23')]=function(_0x3b6f10,_0x240801){if(_0x3b6f10[_0xc6e1('0x2b')]['id']){delete _0x3b6f10[_0xc6e1('0x2b')]['id'];}return db[_0xc6e1('0x2c')]['find']({'where':{'id':_0x3b6f10[_0xc6e1('0x2d')]['id']}})[_0xc6e1('0x24')](handleEntityNotFound(_0x240801,null))[_0xc6e1('0x24')](saveUpdates(_0x3b6f10['body'],null))[_0xc6e1('0x24')](respondWithResult(_0x240801,null))[_0xc6e1('0x2e')](handleError(_0x240801,null));};exports[_0xc6e1('0x25')]=function(_0x412f92,_0x4e73b9){return db['Condition'][_0xc6e1('0x2f')]({'where':{'id':_0x412f92[_0xc6e1('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4e73b9,null))[_0xc6e1('0x24')](removeEntity(_0x4e73b9,null))[_0xc6e1('0x2e')](handleError(_0x4e73b9,null));}; \ No newline at end of file +var _0xf4c9=['body','Condition','find','params','catch','destroy','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','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','end','count','offset','limit','status','set','Content-Range','apply','then','sendStatus','error','name','send','update'];(function(_0x7e1d51,_0x1b5525){var _0xaf3a66=function(_0x1c8b9a){while(--_0x1c8b9a){_0x7e1d51['push'](_0x7e1d51['shift']());}};_0xaf3a66(++_0x1b5525);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xf4c9[_0x4a53d];return _0x27410e;};'use strict';var pdf=require(_0x9f4c('0x0'));var emlformat=require(_0x9f4c('0x1'));var rimraf=require(_0x9f4c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f4c('0x3'));var rp=require('request-promise');var moment=require(_0x9f4c('0x4'));var BPromise=require(_0x9f4c('0x5'));var Mustache=require(_0x9f4c('0x6'));var util=require('util');var path=require(_0x9f4c('0x7'));var sox=require('sox');var csv=require(_0x9f4c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f4c('0x9'));var jsforce=require(_0x9f4c('0xa'));var deskjs=require(_0x9f4c('0xb'));var toCsv=require(_0x9f4c('0x8'));var querystring=require(_0x9f4c('0xc'));var Papa=require(_0x9f4c('0xd'));var Redis=require('ioredis');var authService=require(_0x9f4c('0xe'));var qs=require(_0x9f4c('0xf'));var as=require(_0x9f4c('0x10'));var hardwareService=require(_0x9f4c('0x11'));var logger=require(_0x9f4c('0x12'))(_0x9f4c('0x13'));var utils=require(_0x9f4c('0x14'));var config=require(_0x9f4c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4953e8,_0x4d71a9){_0x4d71a9=_0x4d71a9||0xcc;return function(_0x124492){if(_0x124492){return _0x4953e8['sendStatus'](_0x4d71a9);}return _0x4953e8['status'](_0x4d71a9)[_0x9f4c('0x16')]();};}function respondWithResult(_0x4df46b,_0x5a9cb0){_0x5a9cb0=_0x5a9cb0||0xc8;return function(_0xf217d4){if(_0xf217d4){return _0x4df46b['status'](_0x5a9cb0)['json'](_0xf217d4);}};}function respondWithFilteredResult(_0x1bcf14,_0x516787){return function(_0x25f8ed){if(_0x25f8ed){var _0x336fc2=_0x25f8ed[_0x9f4c('0x17')],_0x46abfe=_0x516787['offset'],_0x1059e1=_0x516787[_0x9f4c('0x18')]+_0x516787[_0x9f4c('0x19')],_0x182295;if(_0x1059e1>=_0x336fc2){_0x1059e1=_0x336fc2;_0x182295=0xc8;}else{_0x182295=0xce;}_0x1bcf14[_0x9f4c('0x1a')](_0x182295);return _0x1bcf14[_0x9f4c('0x1b')](_0x9f4c('0x1c'),_0x46abfe+'-'+_0x1059e1+'/'+_0x336fc2)['json'](_0x25f8ed);}return null;};}function patchUpdates(_0x272778){return function(_0x158493){try{jsonpatch[_0x9f4c('0x1d')](_0x158493,_0x272778,!![]);}catch(_0x5d9587){return BPromise['reject'](_0x5d9587);}return _0x158493['save']();};}function saveUpdates(_0x53d301,_0x2040a5){return function(_0x47accd){if(_0x47accd){return _0x47accd['update'](_0x53d301)[_0x9f4c('0x1e')](function(_0x2e7f7f){return _0x2e7f7f;});}return null;};}function removeEntity(_0x5d869b,_0x341693){return function(_0x1d0df9){if(_0x1d0df9){return _0x1d0df9['destroy']()[_0x9f4c('0x1e')](function(){_0x5d869b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36e15f,_0x49d6d6){return function(_0xa4a8e9){if(!_0xa4a8e9){_0x36e15f[_0x9f4c('0x1f')](0x194);}return _0xa4a8e9;};}function handleError(_0x2a8729,_0x4698b3){_0x4698b3=_0x4698b3||0x1f4;return function(_0x43164c){logger[_0x9f4c('0x20')](_0x43164c['stack']);if(_0x43164c[_0x9f4c('0x21')]){delete _0x43164c[_0x9f4c('0x21')];}_0x2a8729[_0x9f4c('0x1a')](_0x4698b3)[_0x9f4c('0x22')](_0x43164c);};}exports[_0x9f4c('0x23')]=function(_0x3b9134,_0x945f00){if(_0x3b9134[_0x9f4c('0x24')]['id']){delete _0x3b9134[_0x9f4c('0x24')]['id'];}return db[_0x9f4c('0x25')][_0x9f4c('0x26')]({'where':{'id':_0x3b9134[_0x9f4c('0x27')]['id']}})[_0x9f4c('0x1e')](handleEntityNotFound(_0x945f00,null))[_0x9f4c('0x1e')](saveUpdates(_0x3b9134[_0x9f4c('0x24')],null))[_0x9f4c('0x1e')](respondWithResult(_0x945f00,null))[_0x9f4c('0x28')](handleError(_0x945f00,null));};exports[_0x9f4c('0x29')]=function(_0xf37118,_0x2400d9){return db[_0x9f4c('0x25')][_0x9f4c('0x26')]({'where':{'id':_0xf37118['params']['id']}})['then'](handleEntityNotFound(_0x2400d9,null))['then'](removeEntity(_0x2400d9,null))[_0x9f4c('0x28')](handleError(_0x2400d9,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 960463e..b5943a3 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 _0x785d=['rimraf','./condition.attributes','Condition','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a2a15,_0x14dbd7){var _0x1b3dcd=function(_0x5c63bd){while(--_0x5c63bd){_0x5a2a15['push'](_0x5a2a15['shift']());}};_0x1b3dcd(++_0x14dbd7);}(_0x785d,0x14d));var _0xd785=function(_0x3580a9,_0x5b777b){_0x3580a9=_0x3580a9-0x0;var _0x5d8a64=_0x785d[_0x3580a9];return _0x5d8a64;};'use strict';var _=require('lodash');var util=require(_0xd785('0x0'));var logger=require(_0xd785('0x1'))(_0xd785('0x2'));var moment=require(_0xd785('0x3'));var BPromise=require(_0xd785('0x4'));var rp=require(_0xd785('0x5'));var fs=require('fs');var path=require(_0xd785('0x6'));var rimraf=require(_0xd785('0x7'));var config=require('../../config/environment');var attributes=require(_0xd785('0x8'));module['exports']=function(_0x59e4ff,_0x5ec962){return _0x59e4ff['define'](_0xd785('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8774=['lodash','util','../../config/logger','api','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions'];(function(_0x4aa21f,_0x441927){var _0x4055b8=function(_0x1b0f5c){while(--_0x1b0f5c){_0x4aa21f['push'](_0x4aa21f['shift']());}};_0x4055b8(++_0x441927);}(_0x8774,0x1ce));var _0x4877=function(_0x2fda6b,_0x1280e5){_0x2fda6b=_0x2fda6b-0x0;var _0x54c5df=_0x8774[_0x2fda6b];return _0x54c5df;};'use strict';var _=require(_0x4877('0x0'));var util=require(_0x4877('0x1'));var logger=require(_0x4877('0x2'))(_0x4877('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4877('0x4'));var config=require(_0x4877('0x5'));var attributes=require(_0x4877('0x6'));module[_0x4877('0x7')]=function(_0x2d66bd,_0x3a6f9e){return _0x2d66bd[_0x4877('0x8')](_0x4877('0x9'),attributes,{'tableName':_0x4877('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 3d5858c..f3a69c8 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 _0x27e5=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x27e5,0x1c1));var _0x527e=function(_0x40d85f,_0x1b9043){_0x40d85f=_0x40d85f-0x0;var _0x56105d=_0x27e5[_0x40d85f];return _0x56105d;};'use strict';var _=require(_0x527e('0x0'));var util=require(_0x527e('0x1'));var moment=require(_0x527e('0x2'));var BPromise=require(_0x527e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x527e('0x4'));var db=require(_0x527e('0x5'))['db'];var utils=require(_0x527e('0x6'));var logger=require(_0x527e('0x7'))(_0x527e('0x8'));var config=require(_0x527e('0x9'));var jayson=require(_0x527e('0xa'));var client=jayson[_0x527e('0xb')][_0x527e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3774f9,_0x128ee0,_0x49e5ea){return new BPromise(function(_0x49ec89,_0x5f8da2){return client[_0x527e('0xd')](_0x3774f9,_0x49e5ea)[_0x527e('0xe')](function(_0x599da4){logger['info'](_0x527e('0xf'),_0x128ee0,_0x527e('0x10'));logger[_0x527e('0x11')](_0x527e('0x12'),_0x128ee0,_0x527e('0x10'),JSON[_0x527e('0x13')](_0x599da4));if(_0x599da4[_0x527e('0x14')]){if(_0x599da4['error'][_0x527e('0x15')]===0x1f4){logger[_0x527e('0x14')](_0x527e('0xf'),_0x128ee0,_0x599da4[_0x527e('0x14')][_0x527e('0x16')]);return _0x5f8da2(_0x599da4[_0x527e('0x14')][_0x527e('0x16')]);}logger['error'](_0x527e('0xf'),_0x128ee0,_0x599da4[_0x527e('0x14')][_0x527e('0x16')]);return _0x49ec89(_0x599da4['error'][_0x527e('0x16')]);}else{logger[_0x527e('0x17')](_0x527e('0xf'),_0x128ee0,_0x527e('0x10'));_0x49ec89(_0x599da4[_0x527e('0x18')][_0x527e('0x16')]);}})[_0x527e('0x19')](function(_0x4f4c77){logger[_0x527e('0x14')](_0x527e('0xf'),_0x128ee0,_0x4f4c77);_0x5f8da2(_0x4f4c77);});});} \ No newline at end of file +var _0x2e61=['info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x2e61,0xa9));var _0x12e6=function(_0x531ead,_0x4fa9f2){_0x531ead=_0x531ead-0x0;var _0x16c638=_0x2e61[_0x531ead];return _0x16c638;};'use strict';var _=require(_0x12e6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x12e6('0x1'));var rs=require(_0x12e6('0x2'));var fs=require('fs');var Redis=require(_0x12e6('0x3'));var db=require(_0x12e6('0x4'))['db'];var utils=require(_0x12e6('0x5'));var logger=require(_0x12e6('0x6'))('rpc');var config=require(_0x12e6('0x7'));var jayson=require(_0x12e6('0x8'));var client=jayson[_0x12e6('0x9')][_0x12e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x330b33,_0xdbf3a5,_0x4301d2){return new BPromise(function(_0x2cf6ab,_0x164761){return client['request'](_0x330b33,_0x4301d2)['then'](function(_0x2c390c){logger[_0x12e6('0xb')](_0x12e6('0xc'),_0xdbf3a5,_0x12e6('0xd'));logger['debug'](_0x12e6('0xe'),_0xdbf3a5,_0x12e6('0xd'),JSON[_0x12e6('0xf')](_0x2c390c));if(_0x2c390c[_0x12e6('0x10')]){if(_0x2c390c[_0x12e6('0x10')][_0x12e6('0x11')]===0x1f4){logger[_0x12e6('0x10')](_0x12e6('0xc'),_0xdbf3a5,_0x2c390c[_0x12e6('0x10')]['message']);return _0x164761(_0x2c390c['error']['message']);}logger[_0x12e6('0x10')](_0x12e6('0xc'),_0xdbf3a5,_0x2c390c[_0x12e6('0x10')][_0x12e6('0x12')]);return _0x2cf6ab(_0x2c390c[_0x12e6('0x10')]['message']);}else{logger[_0x12e6('0xb')](_0x12e6('0xc'),_0xdbf3a5,'request\x20sent');_0x2cf6ab(_0x2c390c['result']['message']);}})[_0x12e6('0x13')](function(_0x4b2d21){logger[_0x12e6('0x10')](_0x12e6('0xc'),_0xdbf3a5,_0x4b2d21);_0x164761(_0x4b2d21);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index cf9d445..8ddc9b3 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 _0x9ed6=['connect-timeout','isAuthenticated','update','delete','/:id','destroy','util','path'];(function(_0x3d0e45,_0x72a858){var _0x3eb5ca=function(_0x3bba3a){while(--_0x3bba3a){_0x3d0e45['push'](_0x3d0e45['shift']());}};_0x3eb5ca(++_0x72a858);}(_0x9ed6,0xf6));var _0x69ed=function(_0x2fff33,_0x3b6cfb){_0x2fff33=_0x2fff33-0x0;var _0xf16a4=_0x9ed6[_0x2fff33];return _0xf16a4;};'use strict';var multer=require('multer');var util=require(_0x69ed('0x0'));var path=require(_0x69ed('0x1'));var timeout=require(_0x69ed('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./condition.controller');router['put']('/:id',auth[_0x69ed('0x3')](),controller[_0x69ed('0x4')]);router[_0x69ed('0x5')](_0x69ed('0x6'),auth['isAuthenticated'](),controller[_0x69ed('0x7')]);module['exports']=router; \ No newline at end of file +var _0x48b4=['../../components/interaction/service','../../config/environment','put','isAuthenticated','destroy','multer','path','express','../../components/auth/service'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x48b4,0x101));var _0x448b=function(_0x16ad19,_0x397681){_0x16ad19=_0x16ad19-0x0;var _0x69dbae=_0x48b4[_0x16ad19];return _0x69dbae;};'use strict';var multer=require(_0x448b('0x0'));var util=require('util');var path=require(_0x448b('0x1'));var timeout=require('connect-timeout');var express=require(_0x448b('0x2'));var router=express['Router']();var auth=require(_0x448b('0x3'));var interaction=require(_0x448b('0x4'));var config=require(_0x448b('0x5'));var controller=require('./condition.controller');router[_0x448b('0x6')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x448b('0x7')](),controller[_0x448b('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 64f4801..ccc930b 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 _0x680a=['sequelize','STRING','name'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0x680a,0xde));var _0xa680=function(_0x1d3e9d,_0x8a0aca){_0x1d3e9d=_0x1d3e9d-0x0;var _0x5ed51b=_0x680a[_0x1d3e9d];return _0x5ed51b;};'use strict';var Sequelize=require(_0xa680('0x0'));module['exports']={'name':{'type':Sequelize[_0xa680('0x1')],'allowNull':![],'unique':_0xa680('0x2')},'description':{'type':Sequelize[_0xa680('0x1')]}}; \ No newline at end of file +var _0xf1c6=['name','STRING'];(function(_0x812136,_0x5df217){var _0x3b5c29=function(_0x207404){while(--_0x207404){_0x812136['push'](_0x812136['shift']());}};_0x3b5c29(++_0x5df217);}(_0xf1c6,0x145));var _0x6f1c=function(_0x5599e6,_0x1359bf){_0x5599e6=_0x5599e6-0x0;var _0x547499=_0xf1c6[_0x5599e6];return _0x547499;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6f1c('0x0')],'allowNull':![],'unique':_0x6f1c('0x1')},'description':{'type':Sequelize[_0x6f1c('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 2d75b8f..8f13594 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 _0x03db=['HH:mm:ss','attrTimezone','0.00','attrFontSize','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','clone','omit','createdAt','updatedAt','body','attrUrl','attrs','value','https://','attrPath','attrHourFormat'];(function(_0x562ec2,_0x33932b){var _0xd3a205=function(_0x21aac4){while(--_0x21aac4){_0x562ec2['push'](_0x562ec2['shift']());}};_0xd3a205(++_0x33932b);}(_0x03db,0x106));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb03d('0x0'));var emlformat=require(_0xb03d('0x1'));var rimraf=require(_0xb03d('0x2'));var zipdir=require(_0xb03d('0x3'));var jsonpatch=require(_0xb03d('0x4'));var rp=require(_0xb03d('0x5'));var moment=require(_0xb03d('0x6'));var BPromise=require(_0xb03d('0x7'));var Mustache=require(_0xb03d('0x8'));var util=require('util');var path=require('path');var sox=require(_0xb03d('0x9'));var csv=require('to-csv');var ejs=require(_0xb03d('0xa'));var fs=require('fs');var _=require(_0xb03d('0xb'));var squel=require(_0xb03d('0xc'));var crypto=require(_0xb03d('0xd'));var jsforce=require(_0xb03d('0xe'));var deskjs=require(_0xb03d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb03d('0x10'));var Papa=require(_0xb03d('0x11'));var Redis=require('ioredis');var authService=require(_0xb03d('0x12'));var qs=require(_0xb03d('0x13'));var as=require(_0xb03d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb03d('0x15'))(_0xb03d('0x16'));var utils=require(_0xb03d('0x17'));var config=require('../../config/environment');var db=require(_0xb03d('0x18'))['db'];config[_0xb03d('0x19')]=_['defaults'](config[_0xb03d('0x19')],{'host':_0xb03d('0x1a'),'port':0x18eb});var socket=require(_0xb03d('0x1b'))(new Redis(config[_0xb03d('0x19')]));require(_0xb03d('0x1c'))['register'](socket);function respondWithStatusCode(_0x385c93,_0x1ed581){_0x1ed581=_0x1ed581||0xcc;return function(_0x448ac1){if(_0x448ac1){return _0x385c93[_0xb03d('0x1d')](_0x1ed581);}return _0x385c93[_0xb03d('0x1e')](_0x1ed581)[_0xb03d('0x1f')]();};}function respondWithResult(_0x5da245,_0x2e46d7){_0x2e46d7=_0x2e46d7||0xc8;return function(_0x56ebe7){if(_0x56ebe7){return _0x5da245['status'](_0x2e46d7)[_0xb03d('0x20')](_0x56ebe7);}};}function respondWithFilteredResult(_0x2747d3,_0x16783e){return function(_0x5343a0){if(_0x5343a0){var _0x203639=_0x5343a0[_0xb03d('0x21')],_0x18af14=_0x16783e[_0xb03d('0x22')],_0x12d705=_0x16783e[_0xb03d('0x22')]+_0x16783e[_0xb03d('0x23')],_0x4bd091;if(_0x12d705>=_0x203639){_0x12d705=_0x203639;_0x4bd091=0xc8;}else{_0x4bd091=0xce;}_0x2747d3['status'](_0x4bd091);return _0x2747d3['set']('Content-Range',_0x18af14+'-'+_0x12d705+'/'+_0x203639)['json'](_0x5343a0);}return null;};}function patchUpdates(_0xe85ee3){return function(_0x3e9c04){try{jsonpatch[_0xb03d('0x24')](_0x3e9c04,_0xe85ee3,!![]);}catch(_0x312472){return BPromise[_0xb03d('0x25')](_0x312472);}return _0x3e9c04[_0xb03d('0x26')]();};}function saveUpdates(_0xf9549e,_0x4a4e88){return function(_0x3d1f29){if(_0x3d1f29){return _0x3d1f29[_0xb03d('0x27')](_0xf9549e)[_0xb03d('0x28')](function(_0x4c6a54){return _0x4c6a54;});}return null;};}function removeEntity(_0x1ca778,_0x1d7bd5){return function(_0x2c5649){if(_0x2c5649){return _0x2c5649[_0xb03d('0x29')]()['then'](function(){var _0x90748f=_0x2c5649[_0xb03d('0x2a')]({'plain':!![]});var _0xcd568d=_0xb03d('0x2b');return db[_0xb03d('0x2c')]['destroy']({'where':{'type':_0xcd568d,'resourceId':_0x90748f['id']}})[_0xb03d('0x28')](function(){return _0x2c5649;});})[_0xb03d('0x28')](function(){_0x1ca778[_0xb03d('0x1e')](0xcc)[_0xb03d('0x1f')]();});}};}function handleEntityNotFound(_0x3b0a9e,_0x162704){return function(_0x1c712c){if(!_0x1c712c){_0x3b0a9e[_0xb03d('0x1d')](0x194);}return _0x1c712c;};}function handleError(_0x3df936,_0x38a650){_0x38a650=_0x38a650||0x1f4;return function(_0x1a0f99){logger['error'](_0x1a0f99[_0xb03d('0x2d')]);if(_0x1a0f99[_0xb03d('0x2e')]){delete _0x1a0f99['name'];}_0x3df936['status'](_0x38a650)[_0xb03d('0x2f')](_0x1a0f99);};}exports[_0xb03d('0x30')]=function(_0x3d2f58,_0x17a669){var _0x52db98={},_0x337e12={},_0x1c421f={'count':0x0,'rows':[]};var _0x45f230=_[_0xb03d('0x31')](db[_0xb03d('0x32')]['rawAttributes'],function(_0x9faf83){return{'name':_0x9faf83[_0xb03d('0x33')],'type':_0x9faf83[_0xb03d('0x34')][_0xb03d('0x35')]};});_0x337e12[_0xb03d('0x36')]=_[_0xb03d('0x31')](_0x45f230,_0xb03d('0x2e'));_0x337e12[_0xb03d('0x37')]=_[_0xb03d('0x38')](_0x3d2f58[_0xb03d('0x37')]);_0x337e12['filters']=_[_0xb03d('0x39')](_0x337e12[_0xb03d('0x36')],_0x337e12['query']);_0x52db98[_0xb03d('0x3a')]=_['intersection'](_0x337e12[_0xb03d('0x36')],qs[_0xb03d('0x3b')](_0x3d2f58[_0xb03d('0x37')][_0xb03d('0x3b')]));_0x52db98[_0xb03d('0x3a')]=_0x52db98[_0xb03d('0x3a')][_0xb03d('0x3c')]?_0x52db98[_0xb03d('0x3a')]:_0x337e12[_0xb03d('0x36')];if(!_0x3d2f58['query'][_0xb03d('0x3d')](_0xb03d('0x3e'))){_0x52db98[_0xb03d('0x23')]=qs[_0xb03d('0x23')](_0x3d2f58['query'][_0xb03d('0x23')]);_0x52db98[_0xb03d('0x22')]=qs['offset'](_0x3d2f58[_0xb03d('0x37')][_0xb03d('0x22')]);}_0x52db98['order']=qs[_0xb03d('0x3f')](_0x3d2f58[_0xb03d('0x37')]['sort']);_0x52db98[_0xb03d('0x40')]=qs['filters'](_[_0xb03d('0x41')](_0x3d2f58[_0xb03d('0x37')],_0x337e12[_0xb03d('0x42')]),_0x45f230);if(_0x3d2f58['query']['filter']){_0x52db98[_0xb03d('0x40')]=_['merge'](_0x52db98[_0xb03d('0x40')],{'$or':_[_0xb03d('0x31')](_0x45f230,function(_0x24a52a){if(_0x24a52a[_0xb03d('0x34')]!==_0xb03d('0x43')){var _0xe63d69={};_0xe63d69[_0x24a52a[_0xb03d('0x2e')]]={'$like':'%'+_0x3d2f58[_0xb03d('0x37')][_0xb03d('0x44')]+'%'};return _0xe63d69;}})});}_0x52db98=_[_0xb03d('0x45')]({},_0x52db98,_0x3d2f58[_0xb03d('0x46')]);var _0x4a6a5d={'where':_0x52db98['where']};return db[_0xb03d('0x32')][_0xb03d('0x21')](_0x4a6a5d)[_0xb03d('0x28')](function(_0x3b4d9d){_0x1c421f['count']=_0x3b4d9d;if(_0x3d2f58['query'][_0xb03d('0x47')]){_0x52db98[_0xb03d('0x48')]=[{'all':!![]}];}return db[_0xb03d('0x32')][_0xb03d('0x49')](_0x52db98);})['then'](function(_0x49716e){_0x1c421f[_0xb03d('0x4a')]=_0x49716e;return _0x1c421f;})[_0xb03d('0x28')](respondWithFilteredResult(_0x17a669,_0x52db98))['catch'](handleError(_0x17a669,null));};exports[_0xb03d('0x4b')]=function(_0x2f2663,_0x122629){var _0x4e952c={'raw':![],'where':{'id':_0x2f2663[_0xb03d('0x4c')]['id']}},_0x4a8b39={};_0x4a8b39[_0xb03d('0x36')]=_['keys'](db[_0xb03d('0x32')][_0xb03d('0x4d')]);_0x4a8b39[_0xb03d('0x37')]=_[_0xb03d('0x38')](_0x2f2663[_0xb03d('0x37')]);_0x4a8b39[_0xb03d('0x42')]=_[_0xb03d('0x39')](_0x4a8b39[_0xb03d('0x36')],_0x4a8b39[_0xb03d('0x37')]);_0x4e952c[_0xb03d('0x3a')]=_['intersection'](_0x4a8b39['model'],qs[_0xb03d('0x3b')](_0x2f2663['query'][_0xb03d('0x3b')]));_0x4e952c['attributes']=_0x4e952c[_0xb03d('0x3a')][_0xb03d('0x3c')]?_0x4e952c[_0xb03d('0x3a')]:_0x4a8b39[_0xb03d('0x36')];if(_0x2f2663[_0xb03d('0x37')][_0xb03d('0x47')]){_0x4e952c[_0xb03d('0x48')]=[{'all':!![]}];}_0x4e952c=_[_0xb03d('0x45')]({},_0x4e952c,_0x2f2663[_0xb03d('0x46')]);return db['Dashboard'][_0xb03d('0x4e')](_0x4e952c)[_0xb03d('0x28')](handleEntityNotFound(_0x122629,null))[_0xb03d('0x28')](respondWithResult(_0x122629,null))[_0xb03d('0x4f')](handleError(_0x122629,null));};exports[_0xb03d('0x50')]=function(_0x347a29,_0x7cbb38){return db[_0xb03d('0x32')][_0xb03d('0x50')](_0x347a29['body'],{})[_0xb03d('0x28')](function(_0x432d1e){var _0x5748ef=_0x347a29[_0xb03d('0x51')][_0xb03d('0x2a')]({'plain':!![]});if(!_0x5748ef)throw new Error(_0xb03d('0x52'));if(_0x5748ef[_0xb03d('0x53')]===_0xb03d('0x51')){var _0x25e990=_0x432d1e[_0xb03d('0x2a')]({'plain':!![]});var _0x483992='CustomDashboards';return db[_0xb03d('0x54')][_0xb03d('0x4e')]({'where':{'name':_0x483992,'userProfileId':_0x5748ef[_0xb03d('0x55')]},'raw':!![]})[_0xb03d('0x28')](function(_0x5609bd){if(_0x5609bd&&_0x5609bd['autoAssociation']===0x0){return db[_0xb03d('0x2c')][_0xb03d('0x50')]({'name':_0x25e990[_0xb03d('0x2e')],'resourceId':_0x25e990['id'],'type':_0x5609bd[_0xb03d('0x2e')],'sectionId':_0x5609bd['id']},{})[_0xb03d('0x28')](function(){return _0x432d1e;});}else{return _0x432d1e;}})[_0xb03d('0x4f')](function(_0x11cd74){logger[_0xb03d('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11cd74);throw _0x11cd74;});}return _0x432d1e;})[_0xb03d('0x28')](respondWithResult(_0x7cbb38,0xc9))[_0xb03d('0x4f')](handleError(_0x7cbb38,null));};exports[_0xb03d('0x57')]=function(_0x1b8387,_0x2f058a){var _0x1fe56e={'where':{'id':_0x1b8387[_0xb03d('0x4c')]['id']}},_0x4b97af={};_0x4b97af['model']=_[_0xb03d('0x38')](db[_0xb03d('0x32')]['rawAttributes']);_0x1fe56e[_0xb03d('0x3a')]=_[_0xb03d('0x39')](_0x4b97af['model'],qs[_0xb03d('0x3b')](_0x1b8387[_0xb03d('0x37')][_0xb03d('0x3b')]));_0x1fe56e[_0xb03d('0x3a')]=_0x1fe56e[_0xb03d('0x3a')][_0xb03d('0x3c')]?_0x1fe56e[_0xb03d('0x3a')]:_0x4b97af[_0xb03d('0x36')];if(_0x1b8387['query'][_0xb03d('0x47')]){_0x1fe56e['include']=[{'all':!![]}];}_0x1fe56e=_[_0xb03d('0x45')]({},_0x1fe56e,_0x1b8387[_0xb03d('0x46')]);return db[_0xb03d('0x32')][_0xb03d('0x4e')](_0x1fe56e)[_0xb03d('0x28')](handleEntityNotFound(_0x2f058a,null))['then'](function(_0x562177){if(_0x562177){var _0x3ed2c7=_0x562177[_0xb03d('0x2a')]({'plain':!![]});_0x3ed2c7=qs[_0xb03d('0x58')](_0x3ed2c7,['id',_0xb03d('0x59'),_0xb03d('0x5a')]);_0x1b8387['body']=_['omit'](_0x1b8387[_0xb03d('0x5b')],['id','createdAt',_0xb03d('0x5a')]);return db['Dashboard']['create'](_[_0xb03d('0x45')](_0x3ed2c7,_0x1b8387[_0xb03d('0x5b')]),{'include':_0x1b8387['query']['includeAll']?[{'all':!![]}]:undefined})[_0xb03d('0x28')](function(_0x1cfa6b){var _0x5b8796=_0x1b8387['user']['get']({'plain':!![]});if(!_0x5b8796)throw new Error(_0xb03d('0x52'));if(_0x5b8796[_0xb03d('0x53')]===_0xb03d('0x51')){var _0x4e646a=_0x1cfa6b['get']({'plain':!![]});var _0x6c35f2=_0xb03d('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x6c35f2,'userProfileId':_0x5b8796[_0xb03d('0x55')]},'raw':!![]})[_0xb03d('0x28')](function(_0x136693){if(_0x136693&&_0x136693['autoAssociation']===0x0){return db[_0xb03d('0x2c')][_0xb03d('0x50')]({'name':_0x4e646a[_0xb03d('0x2e')],'resourceId':_0x4e646a['id'],'type':_0x136693[_0xb03d('0x2e')],'sectionId':_0x136693['id']},{})[_0xb03d('0x28')](function(){return _0x1cfa6b;});}else{return _0x1cfa6b;}})['catch'](function(_0x3d3656){logger[_0xb03d('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3656);throw _0x3d3656;});}return _0x1cfa6b;});}})[_0xb03d('0x28')](respondWithResult(_0x2f058a,0xc9))['catch'](handleError(_0x2f058a,null));};exports[_0xb03d('0x27')]=function(_0x5c20e0,_0x54c29){if(_0x5c20e0['body']['id']){delete _0x5c20e0['body']['id'];}return db['Dashboard'][_0xb03d('0x4e')]({'where':{'id':_0x5c20e0[_0xb03d('0x4c')]['id']}})[_0xb03d('0x28')](handleEntityNotFound(_0x54c29,null))[_0xb03d('0x28')](saveUpdates(_0x5c20e0[_0xb03d('0x5b')],null))['then'](respondWithResult(_0x54c29,null))[_0xb03d('0x4f')](handleError(_0x54c29,null));};exports[_0xb03d('0x29')]=function(_0x3d83a3,_0xf72ea0){return db[_0xb03d('0x32')][_0xb03d('0x4e')]({'where':{'id':_0x3d83a3[_0xb03d('0x4c')]['id']}})[_0xb03d('0x28')](handleEntityNotFound(_0xf72ea0,null))['then'](removeEntity(_0xf72ea0,null))['catch'](handleError(_0xf72ea0,null));};function widgetAttributes(_0x423cbc){try{switch(_0x423cbc[_0xb03d('0x34')]){case'iframe':return[{'name':_0xb03d('0x5c'),'value':_0x423cbc[_0xb03d('0x5c')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x0]?_0x423cbc['attrs'][0x0][_0xb03d('0x5e')]:undefined)||_0xb03d('0x5f')}];case'custom':return[{'name':_0xb03d('0x60'),'value':_0x423cbc[_0xb03d('0x60')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x0]?_0x423cbc[_0xb03d('0x5d')][0x0][_0xb03d('0x5e')]:undefined)||''}];case'clock':return[{'name':_0xb03d('0x61'),'value':_0x423cbc[_0xb03d('0x61')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x0]?_0x423cbc[_0xb03d('0x5d')][0x0][_0xb03d('0x5e')]:undefined)||_0xb03d('0x62')},{'name':_0xb03d('0x63'),'value':_0x423cbc[_0xb03d('0x63')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x1]?_0x423cbc[_0xb03d('0x5d')][0x1][_0xb03d('0x5e')]:undefined)||_0xb03d('0x64')},{'name':_0xb03d('0x65'),'value':_0x423cbc[_0xb03d('0x65')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc['attrs'][0x2]?_0x423cbc[_0xb03d('0x5d')][0x2][_0xb03d('0x5e')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x423cbc['attrMetric']||(_0x423cbc['attrs']&&_0x423cbc[_0xb03d('0x5d')][0x0]?_0x423cbc['attrs'][0x0][_0xb03d('0x5e')]:undefined)||_0xb03d('0x66')},{'name':_0xb03d('0x67'),'value':_0x423cbc[_0xb03d('0x67')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x1]?_0x423cbc[_0xb03d('0x5d')][0x1][_0xb03d('0x5e')]:undefined)||[]},{'name':_0xb03d('0x65'),'value':_0x423cbc[_0xb03d('0x65')]||(_0x423cbc['attrs']&&_0x423cbc[_0xb03d('0x5d')][0x2]?_0x423cbc[_0xb03d('0x5d')][0x2]['value']:undefined)||0x14}];case _0xb03d('0x68'):case _0xb03d('0x69'):return[{'name':'attrSerie1','value':_0x423cbc[_0xb03d('0x6a')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x0]?_0x423cbc[_0xb03d('0x5d')][0x0][_0xb03d('0x5e')]:undefined)||'total'},{'name':'attrSerie2','value':_0x423cbc[_0xb03d('0x6b')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x1]?_0x423cbc[_0xb03d('0x5d')][0x1][_0xb03d('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x423cbc[_0xb03d('0x6c')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc['attrs'][0x2]?_0x423cbc[_0xb03d('0x5d')][0x2][_0xb03d('0x5e')]:undefined)||null},{'name':_0xb03d('0x67'),'value':_0x423cbc[_0xb03d('0x67')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc['attrs'][0x3]?_0x423cbc[_0xb03d('0x5d')][0x3][_0xb03d('0x5e')]:undefined)||[]}];case _0xb03d('0x6d'):return[{'name':_0xb03d('0x6e'),'type':_0x423cbc[_0xb03d('0x6f')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x0]?_0x423cbc[_0xb03d('0x5d')][0x0][_0xb03d('0x34')]:undefined)||null,'value':_0x423cbc[_0xb03d('0x6e')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x0]?_0x423cbc[_0xb03d('0x5d')][0x0][_0xb03d('0x5e')]:undefined)||null},{'name':_0xb03d('0x70'),'value':_0x423cbc[_0xb03d('0x70')]||(_0x423cbc[_0xb03d('0x5d')]&&_0x423cbc[_0xb03d('0x5d')][0x1]?_0x423cbc[_0xb03d('0x5d')][0x1][_0xb03d('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x394feb){logger[_0xb03d('0x56')](_0xb03d('0x71'),JSON[_0xb03d('0x72')](_0x394feb));return[];}}exports[_0xb03d('0x73')]=function(_0x56aac1,_0x4c0a30,_0x540d7b){if(_0x56aac1[_0xb03d('0x5b')]['id']){delete _0x56aac1[_0xb03d('0x5b')]['id'];}return db['Dashboard'][_0xb03d('0x4e')]({'where':{'id':_0x56aac1[_0xb03d('0x4c')]['id']}})[_0xb03d('0x28')](handleEntityNotFound(_0x4c0a30,null))[_0xb03d('0x28')](function(_0x1af470){if(_0x1af470){_0x56aac1[_0xb03d('0x5b')][_0xb03d('0x74')]=_0x1af470['id'];_0x56aac1[_0xb03d('0x5b')][_0xb03d('0x5d')]=widgetAttributes(_0x56aac1[_0xb03d('0x5b')]);return db[_0xb03d('0x75')][_0xb03d('0x50')](_0x56aac1[_0xb03d('0x5b')]);}})[_0xb03d('0x28')](respondWithResult(_0x4c0a30,null))[_0xb03d('0x4f')](handleError(_0x4c0a30,null));};exports[_0xb03d('0x76')]=function(_0xdc9aac,_0x1c6d1e,_0x33fa74){var _0x40f1d6={};var _0x4e5f8b={};var _0x37b114;var _0x3387b2;return db[_0xb03d('0x32')]['findOne']({'where':{'id':_0xdc9aac[_0xb03d('0x4c')]['id']}})[_0xb03d('0x28')](handleEntityNotFound(_0x1c6d1e,null))['then'](function(_0x409116){if(_0x409116){_0x37b114=_0x409116;_0x4e5f8b['model']=_[_0xb03d('0x38')](db[_0xb03d('0x75')]['rawAttributes']);_0x4e5f8b[_0xb03d('0x37')]=_[_0xb03d('0x38')](_0xdc9aac['query']);_0x4e5f8b[_0xb03d('0x42')]=_[_0xb03d('0x39')](_0x4e5f8b[_0xb03d('0x36')],_0x4e5f8b['query']);_0x40f1d6[_0xb03d('0x3a')]=_[_0xb03d('0x39')](_0x4e5f8b[_0xb03d('0x36')],qs[_0xb03d('0x3b')](_0xdc9aac[_0xb03d('0x37')][_0xb03d('0x3b')]));_0x40f1d6[_0xb03d('0x3a')]=_0x40f1d6[_0xb03d('0x3a')]['length']?_0x40f1d6[_0xb03d('0x3a')]:_0x4e5f8b['model'];_0x40f1d6[_0xb03d('0x77')]=qs[_0xb03d('0x3f')](_0xdc9aac['query'][_0xb03d('0x3f')]);_0x40f1d6['where']=qs[_0xb03d('0x42')](_['pick'](_0xdc9aac[_0xb03d('0x37')],_0x4e5f8b[_0xb03d('0x42')]));if(_0xdc9aac[_0xb03d('0x37')][_0xb03d('0x44')]){_0x40f1d6[_0xb03d('0x40')]=_[_0xb03d('0x45')](_0x40f1d6[_0xb03d('0x40')],{'$or':_[_0xb03d('0x31')](_0x40f1d6[_0xb03d('0x3a')],function(_0x47ee88){var _0x4c2689={};_0x4c2689[_0x47ee88]={'$like':'%'+_0xdc9aac[_0xb03d('0x37')][_0xb03d('0x44')]+'%'};return _0x4c2689;})});}_0x40f1d6=_[_0xb03d('0x45')]({},_0x40f1d6,_0xdc9aac[_0xb03d('0x46')]);return _0x37b114[_0xb03d('0x76')](_0x40f1d6);}})[_0xb03d('0x28')](function(_0x192a39){if(_0x192a39){_0x3387b2=_0x192a39['length'];if(!_0xdc9aac[_0xb03d('0x37')][_0xb03d('0x3d')](_0xb03d('0x3e'))){_0x40f1d6[_0xb03d('0x23')]=qs[_0xb03d('0x23')](_0xdc9aac['query'][_0xb03d('0x23')]);_0x40f1d6[_0xb03d('0x22')]=qs[_0xb03d('0x22')](_0xdc9aac[_0xb03d('0x37')][_0xb03d('0x22')]);}return _0x37b114[_0xb03d('0x76')](_0x40f1d6);}})[_0xb03d('0x28')](function(_0xa793b6){if(_0xa793b6){return _0xa793b6?{'count':_0x3387b2,'rows':_0xa793b6}:null;}})['then'](respondWithResult(_0x1c6d1e,null))[_0xb03d('0x4f')](handleError(_0x1c6d1e,null));}; \ No newline at end of file +var _0xe420=['end','name','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','UserProfileSection','autoAssociation','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./dashboard.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource'];(function(_0x3ffc2f,_0x339375){var _0x8b3ce4=function(_0x9e4738){while(--_0x9e4738){_0x3ffc2f['push'](_0x3ffc2f['shift']());}};_0x8b3ce4(++_0x339375);}(_0xe420,0x1bf));var _0x0e42=function(_0x29cb4a,_0x28035c){_0x29cb4a=_0x29cb4a-0x0;var _0x3f28f6=_0xe420[_0x29cb4a];return _0x3f28f6;};'use strict';var pdf=require(_0x0e42('0x0'));var emlformat=require(_0x0e42('0x1'));var rimraf=require(_0x0e42('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e42('0x3'));var rp=require(_0x0e42('0x4'));var moment=require(_0x0e42('0x5'));var BPromise=require(_0x0e42('0x6'));var Mustache=require(_0x0e42('0x7'));var util=require(_0x0e42('0x8'));var path=require('path');var sox=require(_0x0e42('0x9'));var csv=require(_0x0e42('0xa'));var ejs=require(_0x0e42('0xb'));var fs=require('fs');var _=require(_0x0e42('0xc'));var squel=require(_0x0e42('0xd'));var crypto=require(_0x0e42('0xe'));var jsforce=require(_0x0e42('0xf'));var deskjs=require(_0x0e42('0x10'));var toCsv=require(_0x0e42('0xa'));var querystring=require(_0x0e42('0x11'));var Papa=require(_0x0e42('0x12'));var Redis=require('ioredis');var authService=require(_0x0e42('0x13'));var qs=require(_0x0e42('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e42('0x15'))(_0x0e42('0x16'));var utils=require(_0x0e42('0x17'));var config=require(_0x0e42('0x18'));var db=require(_0x0e42('0x19'))['db'];config[_0x0e42('0x1a')]=_[_0x0e42('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e42('0x1a')]));require(_0x0e42('0x1c'))[_0x0e42('0x1d')](socket);function respondWithStatusCode(_0x4f974f,_0x36d28b){_0x36d28b=_0x36d28b||0xcc;return function(_0x36dc5f){if(_0x36dc5f){return _0x4f974f[_0x0e42('0x1e')](_0x36d28b);}return _0x4f974f[_0x0e42('0x1f')](_0x36d28b)['end']();};}function respondWithResult(_0x48d408,_0xd701a4){_0xd701a4=_0xd701a4||0xc8;return function(_0x260299){if(_0x260299){return _0x48d408['status'](_0xd701a4)[_0x0e42('0x20')](_0x260299);}};}function respondWithFilteredResult(_0x169450,_0x393529){return function(_0x52ce0c){if(_0x52ce0c){var _0x3738c1=_0x52ce0c[_0x0e42('0x21')],_0x4deb32=_0x393529[_0x0e42('0x22')],_0x3989a9=_0x393529[_0x0e42('0x22')]+_0x393529['limit'],_0x3e9fd5;if(_0x3989a9>=_0x3738c1){_0x3989a9=_0x3738c1;_0x3e9fd5=0xc8;}else{_0x3e9fd5=0xce;}_0x169450['status'](_0x3e9fd5);return _0x169450[_0x0e42('0x23')](_0x0e42('0x24'),_0x4deb32+'-'+_0x3989a9+'/'+_0x3738c1)[_0x0e42('0x20')](_0x52ce0c);}return null;};}function patchUpdates(_0x54ddba){return function(_0x331df7){try{jsonpatch[_0x0e42('0x25')](_0x331df7,_0x54ddba,!![]);}catch(_0x3c15c5){return BPromise[_0x0e42('0x26')](_0x3c15c5);}return _0x331df7[_0x0e42('0x27')]();};}function saveUpdates(_0x5cfd8b,_0x1d62a9){return function(_0xe81803){if(_0xe81803){return _0xe81803['update'](_0x5cfd8b)[_0x0e42('0x28')](function(_0x5e6fc8){return _0x5e6fc8;});}return null;};}function removeEntity(_0x4e0532,_0x191a4f){return function(_0xf0c7fb){if(_0xf0c7fb){return _0xf0c7fb[_0x0e42('0x29')]()[_0x0e42('0x28')](function(){var _0x1a1165=_0xf0c7fb[_0x0e42('0x2a')]({'plain':!![]});var _0x488621=_0x0e42('0x2b');return db[_0x0e42('0x2c')][_0x0e42('0x29')]({'where':{'type':_0x488621,'resourceId':_0x1a1165['id']}})[_0x0e42('0x28')](function(){return _0xf0c7fb;});})[_0x0e42('0x28')](function(){_0x4e0532['status'](0xcc)[_0x0e42('0x2d')]();});}};}function handleEntityNotFound(_0x251f35,_0x5f5283){return function(_0x588b34){if(!_0x588b34){_0x251f35[_0x0e42('0x1e')](0x194);}return _0x588b34;};}function handleError(_0x502d75,_0x31267f){_0x31267f=_0x31267f||0x1f4;return function(_0x3d92a5){logger['error'](_0x3d92a5['stack']);if(_0x3d92a5[_0x0e42('0x2e')]){delete _0x3d92a5[_0x0e42('0x2e')];}_0x502d75['status'](_0x31267f)['send'](_0x3d92a5);};}exports[_0x0e42('0x2f')]=function(_0x381bad,_0x420e89){var _0x59e58d={},_0x4db2b5={},_0x5c1503={'count':0x0,'rows':[]};var _0x23d751=_['map'](db[_0x0e42('0x30')][_0x0e42('0x31')],function(_0x2fdd43){return{'name':_0x2fdd43[_0x0e42('0x32')],'type':_0x2fdd43[_0x0e42('0x33')][_0x0e42('0x34')]};});_0x4db2b5[_0x0e42('0x35')]=_[_0x0e42('0x36')](_0x23d751,'name');_0x4db2b5[_0x0e42('0x37')]=_[_0x0e42('0x38')](_0x381bad[_0x0e42('0x37')]);_0x4db2b5[_0x0e42('0x39')]=_[_0x0e42('0x3a')](_0x4db2b5[_0x0e42('0x35')],_0x4db2b5[_0x0e42('0x37')]);_0x59e58d[_0x0e42('0x3b')]=_[_0x0e42('0x3a')](_0x4db2b5[_0x0e42('0x35')],qs[_0x0e42('0x3c')](_0x381bad[_0x0e42('0x37')][_0x0e42('0x3c')]));_0x59e58d[_0x0e42('0x3b')]=_0x59e58d['attributes'][_0x0e42('0x3d')]?_0x59e58d['attributes']:_0x4db2b5['model'];if(!_0x381bad[_0x0e42('0x37')][_0x0e42('0x3e')]('nolimit')){_0x59e58d['limit']=qs['limit'](_0x381bad['query'][_0x0e42('0x3f')]);_0x59e58d[_0x0e42('0x22')]=qs[_0x0e42('0x22')](_0x381bad[_0x0e42('0x37')][_0x0e42('0x22')]);}_0x59e58d['order']=qs[_0x0e42('0x40')](_0x381bad['query'][_0x0e42('0x40')]);_0x59e58d['where']=qs['filters'](_[_0x0e42('0x41')](_0x381bad[_0x0e42('0x37')],_0x4db2b5['filters']),_0x23d751);if(_0x381bad[_0x0e42('0x37')][_0x0e42('0x42')]){_0x59e58d[_0x0e42('0x43')]=_['merge'](_0x59e58d[_0x0e42('0x43')],{'$or':_[_0x0e42('0x36')](_0x23d751,function(_0x3b212e){if(_0x3b212e['type']!==_0x0e42('0x44')){var _0x13e62f={};_0x13e62f[_0x3b212e['name']]={'$like':'%'+_0x381bad['query'][_0x0e42('0x42')]+'%'};return _0x13e62f;}})});}_0x59e58d=_[_0x0e42('0x45')]({},_0x59e58d,_0x381bad[_0x0e42('0x46')]);var _0x1c6bbb={'where':_0x59e58d[_0x0e42('0x43')]};return db[_0x0e42('0x30')]['count'](_0x1c6bbb)[_0x0e42('0x28')](function(_0x2c8910){_0x5c1503['count']=_0x2c8910;if(_0x381bad['query']['includeAll']){_0x59e58d[_0x0e42('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0x0e42('0x48')](_0x59e58d);})['then'](function(_0x3fd133){_0x5c1503[_0x0e42('0x49')]=_0x3fd133;return _0x5c1503;})['then'](respondWithFilteredResult(_0x420e89,_0x59e58d))[_0x0e42('0x4a')](handleError(_0x420e89,null));};exports['show']=function(_0x332bcd,_0x5a7070){var _0x48e3d2={'raw':![],'where':{'id':_0x332bcd[_0x0e42('0x4b')]['id']}},_0x357b15={};_0x357b15[_0x0e42('0x35')]=_['keys'](db[_0x0e42('0x30')]['rawAttributes']);_0x357b15[_0x0e42('0x37')]=_[_0x0e42('0x38')](_0x332bcd[_0x0e42('0x37')]);_0x357b15[_0x0e42('0x39')]=_['intersection'](_0x357b15[_0x0e42('0x35')],_0x357b15[_0x0e42('0x37')]);_0x48e3d2['attributes']=_[_0x0e42('0x3a')](_0x357b15[_0x0e42('0x35')],qs[_0x0e42('0x3c')](_0x332bcd[_0x0e42('0x37')][_0x0e42('0x3c')]));_0x48e3d2[_0x0e42('0x3b')]=_0x48e3d2[_0x0e42('0x3b')][_0x0e42('0x3d')]?_0x48e3d2[_0x0e42('0x3b')]:_0x357b15[_0x0e42('0x35')];if(_0x332bcd['query'][_0x0e42('0x4c')]){_0x48e3d2['include']=[{'all':!![]}];}_0x48e3d2=_[_0x0e42('0x45')]({},_0x48e3d2,_0x332bcd[_0x0e42('0x46')]);return db[_0x0e42('0x30')][_0x0e42('0x4d')](_0x48e3d2)['then'](handleEntityNotFound(_0x5a7070,null))[_0x0e42('0x28')](respondWithResult(_0x5a7070,null))[_0x0e42('0x4a')](handleError(_0x5a7070,null));};exports[_0x0e42('0x4e')]=function(_0x178313,_0x141d14){return db[_0x0e42('0x30')][_0x0e42('0x4e')](_0x178313[_0x0e42('0x4f')],{})[_0x0e42('0x28')](function(_0x472f65){var _0x1a9016=_0x178313['user'][_0x0e42('0x2a')]({'plain':!![]});if(!_0x1a9016)throw new Error(_0x0e42('0x50'));if(_0x1a9016[_0x0e42('0x51')]===_0x0e42('0x52')){var _0xf430c5=_0x472f65[_0x0e42('0x2a')]({'plain':!![]});var _0x15293e=_0x0e42('0x2b');return db['UserProfileSection'][_0x0e42('0x4d')]({'where':{'name':_0x15293e,'userProfileId':_0x1a9016[_0x0e42('0x53')]},'raw':!![]})['then'](function(_0x556825){if(_0x556825&&_0x556825['autoAssociation']===0x0){return db[_0x0e42('0x2c')][_0x0e42('0x4e')]({'name':_0xf430c5[_0x0e42('0x2e')],'resourceId':_0xf430c5['id'],'type':_0x556825[_0x0e42('0x2e')],'sectionId':_0x556825['id']},{})[_0x0e42('0x28')](function(){return _0x472f65;});}else{return _0x472f65;}})[_0x0e42('0x4a')](function(_0x1b8a80){logger[_0x0e42('0x54')](_0x0e42('0x55'),_0x1b8a80);throw _0x1b8a80;});}return _0x472f65;})[_0x0e42('0x28')](respondWithResult(_0x141d14,0xc9))['catch'](handleError(_0x141d14,null));};exports[_0x0e42('0x56')]=function(_0x2c4184,_0x168fad){var _0x225244={'where':{'id':_0x2c4184[_0x0e42('0x4b')]['id']}},_0x446e9b={};_0x446e9b[_0x0e42('0x35')]=_[_0x0e42('0x38')](db[_0x0e42('0x30')][_0x0e42('0x31')]);_0x225244['attributes']=_['intersection'](_0x446e9b['model'],qs[_0x0e42('0x3c')](_0x2c4184[_0x0e42('0x37')][_0x0e42('0x3c')]));_0x225244[_0x0e42('0x3b')]=_0x225244['attributes'][_0x0e42('0x3d')]?_0x225244[_0x0e42('0x3b')]:_0x446e9b[_0x0e42('0x35')];if(_0x2c4184[_0x0e42('0x37')][_0x0e42('0x4c')]){_0x225244[_0x0e42('0x47')]=[{'all':!![]}];}_0x225244=_['merge']({},_0x225244,_0x2c4184[_0x0e42('0x46')]);return db[_0x0e42('0x30')]['find'](_0x225244)[_0x0e42('0x28')](handleEntityNotFound(_0x168fad,null))[_0x0e42('0x28')](function(_0x469322){if(_0x469322){var _0x2f7029=_0x469322[_0x0e42('0x2a')]({'plain':!![]});_0x2f7029=qs['omit'](_0x2f7029,['id',_0x0e42('0x57'),_0x0e42('0x58')]);_0x2c4184[_0x0e42('0x4f')]=_[_0x0e42('0x59')](_0x2c4184[_0x0e42('0x4f')],['id',_0x0e42('0x57'),'updatedAt']);return db[_0x0e42('0x30')]['create'](_['merge'](_0x2f7029,_0x2c4184[_0x0e42('0x4f')]),{'include':_0x2c4184[_0x0e42('0x37')][_0x0e42('0x4c')]?[{'all':!![]}]:undefined})[_0x0e42('0x28')](function(_0x281b31){var _0x1329e2=_0x2c4184[_0x0e42('0x52')][_0x0e42('0x2a')]({'plain':!![]});if(!_0x1329e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1329e2[_0x0e42('0x51')]===_0x0e42('0x52')){var _0x4079ef=_0x281b31[_0x0e42('0x2a')]({'plain':!![]});var _0x55007f=_0x0e42('0x2b');return db[_0x0e42('0x5a')][_0x0e42('0x4d')]({'where':{'name':_0x55007f,'userProfileId':_0x1329e2[_0x0e42('0x53')]},'raw':!![]})['then'](function(_0x2b7706){if(_0x2b7706&&_0x2b7706[_0x0e42('0x5b')]===0x0){return db[_0x0e42('0x2c')]['create']({'name':_0x4079ef['name'],'resourceId':_0x4079ef['id'],'type':_0x2b7706[_0x0e42('0x2e')],'sectionId':_0x2b7706['id']},{})['then'](function(){return _0x281b31;});}else{return _0x281b31;}})[_0x0e42('0x4a')](function(_0x5339e2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5339e2);throw _0x5339e2;});}return _0x281b31;});}})['then'](respondWithResult(_0x168fad,0xc9))['catch'](handleError(_0x168fad,null));};exports['update']=function(_0x1035e8,_0x31de3d){if(_0x1035e8['body']['id']){delete _0x1035e8[_0x0e42('0x4f')]['id'];}return db[_0x0e42('0x30')][_0x0e42('0x4d')]({'where':{'id':_0x1035e8[_0x0e42('0x4b')]['id']}})[_0x0e42('0x28')](handleEntityNotFound(_0x31de3d,null))['then'](saveUpdates(_0x1035e8[_0x0e42('0x4f')],null))['then'](respondWithResult(_0x31de3d,null))[_0x0e42('0x4a')](handleError(_0x31de3d,null));};exports['destroy']=function(_0x5d179d,_0x32e9cf){return db[_0x0e42('0x30')]['find']({'where':{'id':_0x5d179d[_0x0e42('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32e9cf,null))[_0x0e42('0x28')](removeEntity(_0x32e9cf,null))[_0x0e42('0x4a')](handleError(_0x32e9cf,null));};function widgetAttributes(_0x4497a3){try{switch(_0x4497a3[_0x0e42('0x33')]){case'iframe':return[{'name':_0x0e42('0x5c'),'value':_0x4497a3[_0x0e42('0x5c')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3['attrs'][0x0]?_0x4497a3[_0x0e42('0x5d')][0x0][_0x0e42('0x5e')]:undefined)||_0x0e42('0x5f')}];case _0x0e42('0x60'):return[{'name':'attrPath','value':_0x4497a3[_0x0e42('0x61')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3[_0x0e42('0x5d')][0x0]?_0x4497a3['attrs'][0x0][_0x0e42('0x5e')]:undefined)||''}];case _0x0e42('0x62'):return[{'name':_0x0e42('0x63'),'value':_0x4497a3[_0x0e42('0x63')]||(_0x4497a3['attrs']&&_0x4497a3[_0x0e42('0x5d')][0x0]?_0x4497a3[_0x0e42('0x5d')][0x0]['value']:undefined)||_0x0e42('0x64')},{'name':_0x0e42('0x65'),'value':_0x4497a3['attrTimezone']||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3['attrs'][0x1]?_0x4497a3[_0x0e42('0x5d')][0x1][_0x0e42('0x5e')]:undefined)||_0x0e42('0x66')},{'name':_0x0e42('0x67'),'value':_0x4497a3[_0x0e42('0x67')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3[_0x0e42('0x5d')][0x2]?_0x4497a3['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x0e42('0x68'),'value':_0x4497a3[_0x0e42('0x68')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3[_0x0e42('0x5d')][0x0]?_0x4497a3[_0x0e42('0x5d')][0x0][_0x0e42('0x5e')]:undefined)||_0x0e42('0x69')},{'name':'attrVoiceQueues','value':_0x4497a3[_0x0e42('0x6a')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3[_0x0e42('0x5d')][0x1]?_0x4497a3[_0x0e42('0x5d')][0x1][_0x0e42('0x5e')]:undefined)||[]},{'name':_0x0e42('0x67'),'value':_0x4497a3[_0x0e42('0x67')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3[_0x0e42('0x5d')][0x2]?_0x4497a3[_0x0e42('0x5d')][0x2]['value']:undefined)||0x14}];case _0x0e42('0x6b'):case _0x0e42('0x6c'):return[{'name':_0x0e42('0x6d'),'value':_0x4497a3[_0x0e42('0x6d')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3['attrs'][0x0]?_0x4497a3['attrs'][0x0][_0x0e42('0x5e')]:undefined)||_0x0e42('0x69')},{'name':_0x0e42('0x6e'),'value':_0x4497a3['attrSerie2']||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3[_0x0e42('0x5d')][0x1]?_0x4497a3['attrs'][0x1][_0x0e42('0x5e')]:undefined)||null},{'name':_0x0e42('0x6f'),'value':_0x4497a3[_0x0e42('0x6f')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3['attrs'][0x2]?_0x4497a3[_0x0e42('0x5d')][0x2][_0x0e42('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4497a3[_0x0e42('0x6a')]||(_0x4497a3['attrs']&&_0x4497a3[_0x0e42('0x5d')][0x3]?_0x4497a3[_0x0e42('0x5d')][0x3][_0x0e42('0x5e')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x4497a3[_0x0e42('0x70')]||(_0x4497a3[_0x0e42('0x5d')]&&_0x4497a3[_0x0e42('0x5d')][0x0]?_0x4497a3['attrs'][0x0]['type']:undefined)||null,'value':_0x4497a3[_0x0e42('0x71')]||(_0x4497a3['attrs']&&_0x4497a3[_0x0e42('0x5d')][0x0]?_0x4497a3[_0x0e42('0x5d')][0x0][_0x0e42('0x5e')]:undefined)||null},{'name':_0x0e42('0x72'),'value':_0x4497a3['attrRefresh']||(_0x4497a3['attrs']&&_0x4497a3['attrs'][0x1]?_0x4497a3[_0x0e42('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4c12c1){logger[_0x0e42('0x54')](_0x0e42('0x73'),JSON[_0x0e42('0x74')](_0x4c12c1));return[];}}exports[_0x0e42('0x75')]=function(_0x2767ae,_0x345699,_0x145c67){if(_0x2767ae[_0x0e42('0x4f')]['id']){delete _0x2767ae[_0x0e42('0x4f')]['id'];}return db[_0x0e42('0x30')][_0x0e42('0x4d')]({'where':{'id':_0x2767ae[_0x0e42('0x4b')]['id']}})[_0x0e42('0x28')](handleEntityNotFound(_0x345699,null))[_0x0e42('0x28')](function(_0x28421e){if(_0x28421e){_0x2767ae[_0x0e42('0x4f')][_0x0e42('0x76')]=_0x28421e['id'];_0x2767ae[_0x0e42('0x4f')][_0x0e42('0x5d')]=widgetAttributes(_0x2767ae[_0x0e42('0x4f')]);return db[_0x0e42('0x77')][_0x0e42('0x4e')](_0x2767ae[_0x0e42('0x4f')]);}})['then'](respondWithResult(_0x345699,null))[_0x0e42('0x4a')](handleError(_0x345699,null));};exports[_0x0e42('0x78')]=function(_0x50ea40,_0x2f54e6,_0x109bee){var _0x12a8bd={};var _0x458e73={};var _0x82e8f0;var _0x372e0b;return db[_0x0e42('0x30')][_0x0e42('0x79')]({'where':{'id':_0x50ea40['params']['id']}})['then'](handleEntityNotFound(_0x2f54e6,null))[_0x0e42('0x28')](function(_0x4323bd){if(_0x4323bd){_0x82e8f0=_0x4323bd;_0x458e73[_0x0e42('0x35')]=_[_0x0e42('0x38')](db['DashboardItem']['rawAttributes']);_0x458e73[_0x0e42('0x37')]=_[_0x0e42('0x38')](_0x50ea40[_0x0e42('0x37')]);_0x458e73[_0x0e42('0x39')]=_[_0x0e42('0x3a')](_0x458e73[_0x0e42('0x35')],_0x458e73[_0x0e42('0x37')]);_0x12a8bd['attributes']=_['intersection'](_0x458e73[_0x0e42('0x35')],qs[_0x0e42('0x3c')](_0x50ea40['query'][_0x0e42('0x3c')]));_0x12a8bd[_0x0e42('0x3b')]=_0x12a8bd[_0x0e42('0x3b')][_0x0e42('0x3d')]?_0x12a8bd['attributes']:_0x458e73['model'];_0x12a8bd['order']=qs[_0x0e42('0x40')](_0x50ea40[_0x0e42('0x37')][_0x0e42('0x40')]);_0x12a8bd[_0x0e42('0x43')]=qs[_0x0e42('0x39')](_[_0x0e42('0x41')](_0x50ea40['query'],_0x458e73[_0x0e42('0x39')]));if(_0x50ea40[_0x0e42('0x37')][_0x0e42('0x42')]){_0x12a8bd['where']=_['merge'](_0x12a8bd[_0x0e42('0x43')],{'$or':_[_0x0e42('0x36')](_0x12a8bd['attributes'],function(_0xe1956e){var _0x530316={};_0x530316[_0xe1956e]={'$like':'%'+_0x50ea40[_0x0e42('0x37')]['filter']+'%'};return _0x530316;})});}_0x12a8bd=_[_0x0e42('0x45')]({},_0x12a8bd,_0x50ea40[_0x0e42('0x46')]);return _0x82e8f0['getItems'](_0x12a8bd);}})[_0x0e42('0x28')](function(_0x395b70){if(_0x395b70){_0x372e0b=_0x395b70[_0x0e42('0x3d')];if(!_0x50ea40[_0x0e42('0x37')][_0x0e42('0x3e')](_0x0e42('0x7a'))){_0x12a8bd['limit']=qs[_0x0e42('0x3f')](_0x50ea40[_0x0e42('0x37')]['limit']);_0x12a8bd[_0x0e42('0x22')]=qs['offset'](_0x50ea40[_0x0e42('0x37')]['offset']);}return _0x82e8f0['getItems'](_0x12a8bd);}})[_0x0e42('0x28')](function(_0xc6cffe){if(_0xc6cffe){return _0xc6cffe?{'count':_0x372e0b,'rows':_0xc6cffe}:null;}})[_0x0e42('0x28')](respondWithResult(_0x2f54e6,null))['catch'](handleError(_0x2f54e6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 958c445..fd20971 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 _0x23f4=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update'];(function(_0x393ca9,_0x78c759){var _0x464c42=function(_0x35ba11){while(--_0x35ba11){_0x393ca9['push'](_0x393ca9['shift']());}};_0x464c42(++_0x78c759);}(_0x23f4,0x7e));var _0x423f=function(_0x1a9c71,_0x37735f){_0x1a9c71=_0x1a9c71-0x0;var _0x13567b=_0x23f4[_0x1a9c71];return _0x13567b;};'use strict';var EventEmitter=require(_0x423f('0x0'));var Dashboard=require(_0x423f('0x1'))['db'][_0x423f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x423f('0x3')](0x0);var events={'afterCreate':_0x423f('0x4'),'afterUpdate':_0x423f('0x5'),'afterDestroy':_0x423f('0x6')};function emitEvent(_0x26ed6d){return function(_0x7f89e2,_0x2c8419,_0x65af23){DashboardEvents[_0x423f('0x7')](_0x26ed6d+':'+_0x7f89e2['id'],_0x7f89e2);DashboardEvents[_0x423f('0x7')](_0x26ed6d,_0x7f89e2);_0x65af23(null);};}for(var e in events){if(events[_0x423f('0x8')](e)){var event=events[e];Dashboard[_0x423f('0x9')](e,emitEvent(event));}}module[_0x423f('0xa')]=DashboardEvents; \ No newline at end of file +var _0x9a77=['Dashboard','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2876e3,_0x98159e){var _0x523bd9=function(_0x2a4d62){while(--_0x2a4d62){_0x2876e3['push'](_0x2876e3['shift']());}};_0x523bd9(++_0x98159e);}(_0x9a77,0x17e));var _0x79a7=function(_0x4c1778,_0xa12234){_0x4c1778=_0x4c1778-0x0;var _0x216013=_0x9a77[_0x4c1778];return _0x216013;};'use strict';var EventEmitter=require(_0x79a7('0x0'));var Dashboard=require(_0x79a7('0x1'))['db'][_0x79a7('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x79a7('0x3')};function emitEvent(_0x2ad6aa){return function(_0x235f1c,_0x5542c1,_0x4772fe){DashboardEvents[_0x79a7('0x4')](_0x2ad6aa+':'+_0x235f1c['id'],_0x235f1c);DashboardEvents[_0x79a7('0x4')](_0x2ad6aa,_0x235f1c);_0x4772fe(null);};}for(var e in events){if(events[_0x79a7('0x5')](e)){var event=events[e];Dashboard[_0x79a7('0x6')](e,emitEvent(event));}}module[_0x79a7('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8885613..3a4badd 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 _0x4021=['../../config/environment','./dashboard.attributes','define','Dashboard','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3e1b1d,_0x280807){var _0x336cbf=function(_0x9526f4){while(--_0x9526f4){_0x3e1b1d['push'](_0x3e1b1d['shift']());}};_0x336cbf(++_0x280807);}(_0x4021,0x10c));var _0x1402=function(_0x36d5d5,_0x1c1590){_0x36d5d5=_0x36d5d5-0x0;var _0x4eaa56=_0x4021[_0x36d5d5];return _0x4eaa56;};'use strict';var _=require(_0x1402('0x0'));var util=require(_0x1402('0x1'));var logger=require(_0x1402('0x2'))(_0x1402('0x3'));var moment=require('moment');var BPromise=require(_0x1402('0x4'));var rp=require(_0x1402('0x5'));var fs=require('fs');var path=require(_0x1402('0x6'));var rimraf=require(_0x1402('0x7'));var config=require(_0x1402('0x8'));var attributes=require(_0x1402('0x9'));module['exports']=function(_0x4467bc,_0x145050){return _0x4467bc[_0x1402('0xa')](_0x1402('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4acb=['path','rimraf','./dashboard.attributes','exports','define','Dashboard','util','../../config/logger','moment','request-promise'];(function(_0x57915d,_0x38e6df){var _0x1f91ec=function(_0x39aaa6){while(--_0x39aaa6){_0x57915d['push'](_0x57915d['shift']());}};_0x1f91ec(++_0x38e6df);}(_0x4acb,0x1aa));var _0xb4ac=function(_0x469139,_0x4aea50){_0x469139=_0x469139-0x0;var _0x525399=_0x4acb[_0x469139];return _0x525399;};'use strict';var _=require('lodash');var util=require(_0xb4ac('0x0'));var logger=require(_0xb4ac('0x1'))('api');var moment=require(_0xb4ac('0x2'));var BPromise=require('bluebird');var rp=require(_0xb4ac('0x3'));var fs=require('fs');var path=require(_0xb4ac('0x4'));var rimraf=require(_0xb4ac('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4ac('0x6'));module[_0xb4ac('0x7')]=function(_0x566433,_0x3eb0ce){return _0x566433[_0xb4ac('0x8')](_0xb4ac('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 8166e7e..ef39b41 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 _0xb5ae=['bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb5ae,0xcc));var _0xeb5a=function(_0x3ad63b,_0x1ca162){_0x3ad63b=_0x3ad63b-0x0;var _0x19970a=_0xb5ae[_0x3ad63b];return _0x19970a;};'use strict';var _=require(_0xeb5a('0x0'));var util=require(_0xeb5a('0x1'));var moment=require(_0xeb5a('0x2'));var BPromise=require(_0xeb5a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb5a('0x5'))('rpc');var config=require(_0xeb5a('0x6'));var jayson=require(_0xeb5a('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xeb5a('0x8')]=_[_0xeb5a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeb5a('0xa'))(new Redis(config['redis']));require(_0xeb5a('0xb'))[_0xeb5a('0xc')](socket);function respondWithRpcPromise(_0x323b64,_0x374698,_0x364823){return new BPromise(function(_0xbc9fe4,_0x40a6b1){return client[_0xeb5a('0xd')](_0x323b64,_0x364823)['then'](function(_0x5768c3){logger['info']('Dashboard,\x20%s,\x20%s',_0x374698,'request\x20sent');logger['debug'](_0xeb5a('0xe'),_0x374698,'request\x20sent',JSON['stringify'](_0x5768c3));if(_0x5768c3['error']){if(_0x5768c3[_0xeb5a('0xf')][_0xeb5a('0x10')]===0x1f4){logger[_0xeb5a('0xf')]('Dashboard,\x20%s,\x20%s',_0x374698,_0x5768c3[_0xeb5a('0xf')]['message']);return _0x40a6b1(_0x5768c3['error'][_0xeb5a('0x11')]);}logger[_0xeb5a('0xf')](_0xeb5a('0x12'),_0x374698,_0x5768c3[_0xeb5a('0xf')][_0xeb5a('0x11')]);return _0xbc9fe4(_0x5768c3[_0xeb5a('0xf')][_0xeb5a('0x11')]);}else{logger[_0xeb5a('0x13')](_0xeb5a('0x12'),_0x374698,_0xeb5a('0x14'));_0xbc9fe4(_0x5768c3[_0xeb5a('0x15')][_0xeb5a('0x11')]);}})[_0xeb5a('0x16')](function(_0x4de4de){logger[_0xeb5a('0xf')](_0xeb5a('0x12'),_0x374698,_0x4de4de);_0x40a6b1(_0x4de4de);});});} \ No newline at end of file +var _0x6038=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5c3cfd,_0x491545){var _0x3488f1=function(_0x3a3784){while(--_0x3a3784){_0x5c3cfd['push'](_0x5c3cfd['shift']());}};_0x3488f1(++_0x491545);}(_0x6038,0x12c));var _0x8603=function(_0x30c87c,_0x23a326){_0x30c87c=_0x30c87c-0x0;var _0x14c414=_0x6038[_0x30c87c];return _0x14c414;};'use strict';var _=require(_0x8603('0x0'));var util=require(_0x8603('0x1'));var moment=require(_0x8603('0x2'));var BPromise=require('bluebird');var rs=require(_0x8603('0x3'));var fs=require('fs');var Redis=require(_0x8603('0x4'));var db=require(_0x8603('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8603('0x6'))('rpc');var config=require(_0x8603('0x7'));var jayson=require(_0x8603('0x8'));var client=jayson[_0x8603('0x9')][_0x8603('0xa')]({'port':0x232a});config[_0x8603('0xb')]=_[_0x8603('0xc')](config[_0x8603('0xb')],{'host':_0x8603('0xd'),'port':0x18eb});var socket=require(_0x8603('0xe'))(new Redis(config[_0x8603('0xb')]));require(_0x8603('0xf'))[_0x8603('0x10')](socket);function respondWithRpcPromise(_0x14803b,_0x32343f,_0xa63d53){return new BPromise(function(_0x12ac3a,_0x10e594){return client['request'](_0x14803b,_0xa63d53)[_0x8603('0x11')](function(_0x50fdc4){logger[_0x8603('0x12')](_0x8603('0x13'),_0x32343f,_0x8603('0x14'));logger['debug'](_0x8603('0x15'),_0x32343f,_0x8603('0x14'),JSON['stringify'](_0x50fdc4));if(_0x50fdc4[_0x8603('0x16')]){if(_0x50fdc4['error'][_0x8603('0x17')]===0x1f4){logger[_0x8603('0x16')](_0x8603('0x13'),_0x32343f,_0x50fdc4[_0x8603('0x16')][_0x8603('0x18')]);return _0x10e594(_0x50fdc4[_0x8603('0x16')][_0x8603('0x18')]);}logger[_0x8603('0x16')](_0x8603('0x13'),_0x32343f,_0x50fdc4[_0x8603('0x16')][_0x8603('0x18')]);return _0x12ac3a(_0x50fdc4[_0x8603('0x16')]['message']);}else{logger[_0x8603('0x12')](_0x8603('0x13'),_0x32343f,_0x8603('0x14'));_0x12ac3a(_0x50fdc4[_0x8603('0x19')][_0x8603('0x18')]);}})[_0x8603('0x1a')](function(_0x4449d8){logger['error']('Dashboard,\x20%s,\x20%s',_0x32343f,_0x4449d8);_0x10e594(_0x4449d8);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index f69d9f5..db894df 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 _0x32b4=['emit','removeListener','register','remove','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x32b4,0xc1));var _0x432b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x32b4[_0xbca1b1];return _0x4e1686;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x432b('0x0'),_0x432b('0x1')];function createListener(_0x26a47a,_0x1176fc){return function(_0x348935){_0x1176fc[_0x432b('0x2')](_0x26a47a,_0x348935);};}function removeListener(_0x573757,_0x11d92b){return function(){DashboardEvents[_0x432b('0x3')](_0x573757,_0x11d92b);};}exports[_0x432b('0x4')]=function(_0x58b1ca){for(var _0x332089=0x0,_0x5197f1=events['length'];_0x332089<_0x5197f1;_0x332089++){var _0x1d1eea=events[_0x332089];var _0x1ce991=createListener('dashboard:'+_0x1d1eea,_0x58b1ca);DashboardEvents['on'](_0x1d1eea,_0x1ce991);}}; \ No newline at end of file +var _0x9b31=['length','dashboard:','remove','update','emit','removeListener','register'];(function(_0x47a8c0,_0x4d5931){var _0x551fa1=function(_0x45ac5a){while(--_0x45ac5a){_0x47a8c0['push'](_0x47a8c0['shift']());}};_0x551fa1(++_0x4d5931);}(_0x9b31,0x113));var _0x19b3=function(_0x24c6bb,_0x2fd215){_0x24c6bb=_0x24c6bb-0x0;var _0x8efc3a=_0x9b31[_0x24c6bb];return _0x8efc3a;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x19b3('0x0'),_0x19b3('0x1')];function createListener(_0x5acdfe,_0xcfe5fb){return function(_0x28c9b4){_0xcfe5fb[_0x19b3('0x2')](_0x5acdfe,_0x28c9b4);};}function removeListener(_0x121630,_0x3c2555){return function(){DashboardEvents[_0x19b3('0x3')](_0x121630,_0x3c2555);};}exports[_0x19b3('0x4')]=function(_0x37576b){for(var _0x5d3a61=0x0,_0x2e6cdf=events[_0x19b3('0x5')];_0x5d3a61<_0x2e6cdf;_0x5d3a61++){var _0x4ccd59=events[_0x5d3a61];var _0x2430b0=createListener(_0x19b3('0x6')+_0x4ccd59,_0x37576b);DashboardEvents['on'](_0x4ccd59,_0x2430b0);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2ba3ce1..91c80a2 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 _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0xcb91[_0x55e1d1];return _0x1165db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x22674c,_0x4f572a){var _0x1528ff=function(_0x4edd90){while(--_0x4edd90){_0x22674c['push'](_0x22674c['shift']());}};_0x1528ff(++_0x4f572a);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0d32a04..be72460 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 _0x8e03=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','parse'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8e03,0x6e));var _0x38e0=function(_0x429604,_0x35422b){_0x429604=_0x429604-0x0;var _0x2882e6=_0x8e03[_0x429604];return _0x2882e6;};'use strict';var Sequelize=require(_0x38e0('0x0'));var squel=require(_0x38e0('0x1'));var _=require(_0x38e0('0x2'));module[_0x38e0('0x3')]={'title':{'type':Sequelize[_0x38e0('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x38e0('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x38e0('0x5')]('long'),'get':function(){try{return JSON[_0x38e0('0x6')](this['getDataValue'](_0x38e0('0x7')));}catch(_0x48cbb3){return[];}},'set':function(_0x1ea73c){try{this[_0x38e0('0x8')](_0x38e0('0x7'),JSON['stringify'](_0x1ea73c));}catch(_0x2b858c){this[_0x38e0('0x8')](_0x38e0('0x7'),JSON[_0x38e0('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x38e0('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x38e0('0xa')]},'col':{'type':Sequelize[_0x38e0('0xa')]},'background':{'type':Sequelize[_0x38e0('0x4')],'allowNull':![],'defaultValue':_0x38e0('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x38e0('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8a5d=['#ffffff','STRING','#2196f3','squel','lodash','exports','TEXT','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x130dac,_0x4799d4){var _0x4d2555=function(_0x370c2f){while(--_0x370c2f){_0x130dac['push'](_0x130dac['shift']());}};_0x4d2555(++_0x4799d4);}(_0x8a5d,0x18f));var _0xd8a5=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x8a5d[_0x396466];return _0x5e9ab4;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xd8a5('0x0'));var _=require(_0xd8a5('0x1'));module[_0xd8a5('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xd8a5('0x3')]('long'),'get':function(){try{return JSON['parse'](this[_0xd8a5('0x4')](_0xd8a5('0x5')));}catch(_0x34dde6){return[];}},'set':function(_0xccff84){try{this[_0xd8a5('0x6')](_0xd8a5('0x5'),JSON[_0xd8a5('0x7')](_0xccff84));}catch(_0x53c1e8){this[_0xd8a5('0x6')](_0xd8a5('0x5'),JSON[_0xd8a5('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0xd8a5('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xd8a5('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd8a5('0x8')]},'col':{'type':Sequelize[_0xd8a5('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd8a5('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd8a5('0xa')],'allowNull':![],'defaultValue':_0xd8a5('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd8a5('0xa')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index d30369f..533810e 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 _0x9828=['widgetAttributes:\x20%s','stringify','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','multibar-chart','pie-chart','attrSerie1','total','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh'];(function(_0x14a54b,_0x3eec32){var _0x5b5e4b=function(_0x1b3f00){while(--_0x1b3f00){_0x14a54b['push'](_0x14a54b['shift']());}};_0x5b5e4b(++_0x3eec32);}(_0x9828,0x100));var _0x8982=function(_0x1712c3,_0x18357a){_0x1712c3=_0x1712c3-0x0;var _0x520a46=_0x9828[_0x1712c3];return _0x520a46;};'use strict';var pdf=require(_0x8982('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8982('0x1'));var zipdir=require(_0x8982('0x2'));var jsonpatch=require(_0x8982('0x3'));var rp=require(_0x8982('0x4'));var moment=require('moment');var BPromise=require(_0x8982('0x5'));var Mustache=require(_0x8982('0x6'));var util=require('util');var path=require(_0x8982('0x7'));var sox=require('sox');var csv=require(_0x8982('0x8'));var ejs=require(_0x8982('0x9'));var fs=require('fs');var _=require(_0x8982('0xa'));var squel=require(_0x8982('0xb'));var crypto=require('crypto');var jsforce=require(_0x8982('0xc'));var deskjs=require(_0x8982('0xd'));var toCsv=require(_0x8982('0x8'));var querystring=require(_0x8982('0xe'));var Papa=require(_0x8982('0xf'));var Redis=require(_0x8982('0x10'));var authService=require(_0x8982('0x11'));var qs=require(_0x8982('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8982('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8982('0x14'));var db=require('../../mysqldb')['db'];config[_0x8982('0x15')]=_[_0x8982('0x16')](config[_0x8982('0x15')],{'host':_0x8982('0x17'),'port':0x18eb});var socket=require(_0x8982('0x18'))(new Redis(config[_0x8982('0x15')]));require('./dashboardItem.socket')[_0x8982('0x19')](socket);function respondWithStatusCode(_0x215b0f,_0xf2e853){_0xf2e853=_0xf2e853||0xcc;return function(_0x1302b1){if(_0x1302b1){return _0x215b0f[_0x8982('0x1a')](_0xf2e853);}return _0x215b0f[_0x8982('0x1b')](_0xf2e853)[_0x8982('0x1c')]();};}function respondWithResult(_0x59c01a,_0xadd4b9){_0xadd4b9=_0xadd4b9||0xc8;return function(_0x282316){if(_0x282316){return _0x59c01a[_0x8982('0x1b')](_0xadd4b9)['json'](_0x282316);}};}function respondWithFilteredResult(_0x71378f,_0x181ff8){return function(_0x48fbcf){if(_0x48fbcf){var _0x558928=_0x48fbcf['count'],_0x5de13d=_0x181ff8[_0x8982('0x1d')],_0xefc9aa=_0x181ff8[_0x8982('0x1d')]+_0x181ff8['limit'],_0x356ca2;if(_0xefc9aa>=_0x558928){_0xefc9aa=_0x558928;_0x356ca2=0xc8;}else{_0x356ca2=0xce;}_0x71378f[_0x8982('0x1b')](_0x356ca2);return _0x71378f[_0x8982('0x1e')](_0x8982('0x1f'),_0x5de13d+'-'+_0xefc9aa+'/'+_0x558928)[_0x8982('0x20')](_0x48fbcf);}return null;};}function patchUpdates(_0x34f932){return function(_0xd824){try{jsonpatch['apply'](_0xd824,_0x34f932,!![]);}catch(_0x2b0e27){return BPromise[_0x8982('0x21')](_0x2b0e27);}return _0xd824[_0x8982('0x22')]();};}function saveUpdates(_0x1b2fed,_0x300463){return function(_0x14ddd3){if(_0x14ddd3){return _0x14ddd3[_0x8982('0x23')](_0x1b2fed)[_0x8982('0x24')](function(_0x7ff42d){return _0x7ff42d;});}return null;};}function removeEntity(_0x4bde39,_0x54c39a){return function(_0x23e496){if(_0x23e496){return _0x23e496[_0x8982('0x25')]()[_0x8982('0x24')](function(){_0x4bde39[_0x8982('0x1b')](0xcc)[_0x8982('0x1c')]();});}};}function handleEntityNotFound(_0x33b512,_0x350577){return function(_0x397ab5){if(!_0x397ab5){_0x33b512[_0x8982('0x1a')](0x194);}return _0x397ab5;};}function handleError(_0x272cd5,_0x27dc3f){_0x27dc3f=_0x27dc3f||0x1f4;return function(_0xf897e4){logger[_0x8982('0x26')](_0xf897e4[_0x8982('0x27')]);if(_0xf897e4[_0x8982('0x28')]){delete _0xf897e4['name'];}_0x272cd5[_0x8982('0x1b')](_0x27dc3f)[_0x8982('0x29')](_0xf897e4);};}exports['show']=function(_0x56791d,_0x87c2a7){var _0x5ea000={'raw':![],'where':{'id':_0x56791d[_0x8982('0x2a')]['id']}},_0x28fe6c={};_0x28fe6c[_0x8982('0x2b')]=_[_0x8982('0x2c')](db['DashboardItem'][_0x8982('0x2d')]);_0x28fe6c[_0x8982('0x2e')]=_[_0x8982('0x2c')](_0x56791d[_0x8982('0x2e')]);_0x28fe6c['filters']=_[_0x8982('0x2f')](_0x28fe6c[_0x8982('0x2b')],_0x28fe6c[_0x8982('0x2e')]);_0x5ea000[_0x8982('0x30')]=_[_0x8982('0x2f')](_0x28fe6c[_0x8982('0x2b')],qs['fields'](_0x56791d[_0x8982('0x2e')][_0x8982('0x31')]));_0x5ea000[_0x8982('0x30')]=_0x5ea000[_0x8982('0x30')][_0x8982('0x32')]?_0x5ea000[_0x8982('0x30')]:_0x28fe6c[_0x8982('0x2b')];if(_0x56791d[_0x8982('0x2e')]['includeAll']){_0x5ea000[_0x8982('0x33')]=[{'all':!![]}];}_0x5ea000=_[_0x8982('0x34')]({},_0x5ea000,_0x56791d[_0x8982('0x35')]);return db[_0x8982('0x36')][_0x8982('0x37')](_0x5ea000)[_0x8982('0x24')](handleEntityNotFound(_0x87c2a7,null))[_0x8982('0x24')](respondWithResult(_0x87c2a7,null))[_0x8982('0x38')](handleError(_0x87c2a7,null));};exports[_0x8982('0x25')]=function(_0x2884f1,_0x2be587){return db[_0x8982('0x36')][_0x8982('0x37')]({'where':{'id':_0x2884f1[_0x8982('0x2a')]['id']}})[_0x8982('0x24')](handleEntityNotFound(_0x2be587,null))['then'](removeEntity(_0x2be587,null))['catch'](handleError(_0x2be587,null));};function widgetAttributes(_0x217161){try{switch(_0x217161[_0x8982('0x39')]){case _0x8982('0x3a'):return[{'name':_0x8982('0x3b'),'value':_0x217161[_0x8982('0x3b')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x0]?_0x217161[_0x8982('0x3c')][0x0][_0x8982('0x3d')]:undefined)||'https://'}];case'custom':return[{'name':_0x8982('0x3e'),'value':_0x217161[_0x8982('0x3e')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x0]?_0x217161[_0x8982('0x3c')][0x0][_0x8982('0x3d')]:undefined)||''}];case _0x8982('0x3f'):return[{'name':'attrHourFormat','value':_0x217161[_0x8982('0x40')]||(_0x217161['attrs']&&_0x217161[_0x8982('0x3c')][0x0]?_0x217161['attrs'][0x0]['value']:undefined)||_0x8982('0x41')},{'name':_0x8982('0x42'),'value':_0x217161['attrTimezone']||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x1]?_0x217161[_0x8982('0x3c')][0x1][_0x8982('0x3d')]:undefined)||_0x8982('0x43')},{'name':_0x8982('0x44'),'value':_0x217161[_0x8982('0x44')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x2]?_0x217161['attrs'][0x2][_0x8982('0x3d')]:undefined)||0xc}];case _0x8982('0x45'):return[{'name':_0x8982('0x46'),'value':_0x217161['attrMetric']||(_0x217161[_0x8982('0x3c')]&&_0x217161['attrs'][0x0]?_0x217161[_0x8982('0x3c')][0x0][_0x8982('0x3d')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x217161['attrVoiceQueues']||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x1]?_0x217161[_0x8982('0x3c')][0x1][_0x8982('0x3d')]:undefined)||[]},{'name':_0x8982('0x44'),'value':_0x217161[_0x8982('0x44')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x2]?_0x217161[_0x8982('0x3c')][0x2][_0x8982('0x3d')]:undefined)||0x14}];case _0x8982('0x47'):case _0x8982('0x48'):return[{'name':_0x8982('0x49'),'value':_0x217161[_0x8982('0x49')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x0]?_0x217161[_0x8982('0x3c')][0x0][_0x8982('0x3d')]:undefined)||_0x8982('0x4a')},{'name':'attrSerie2','value':_0x217161['attrSerie2']||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x1]?_0x217161[_0x8982('0x3c')][0x1][_0x8982('0x3d')]:undefined)||null},{'name':'attrSerie3','value':_0x217161['attrSerie3']||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x2]?_0x217161[_0x8982('0x3c')][0x2][_0x8982('0x3d')]:undefined)||null},{'name':_0x8982('0x4b'),'value':_0x217161[_0x8982('0x4b')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x3]?_0x217161['attrs'][0x3][_0x8982('0x3d')]:undefined)||[]}];case _0x8982('0x4c'):return[{'name':_0x8982('0x4d'),'type':_0x217161[_0x8982('0x4e')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x0]?_0x217161[_0x8982('0x3c')][0x0][_0x8982('0x39')]:undefined)||null,'value':_0x217161[_0x8982('0x4d')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x0]?_0x217161['attrs'][0x0][_0x8982('0x3d')]:undefined)||null},{'name':_0x8982('0x4f'),'value':_0x217161[_0x8982('0x4f')]||(_0x217161[_0x8982('0x3c')]&&_0x217161[_0x8982('0x3c')][0x1]?_0x217161[_0x8982('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x44083f){logger[_0x8982('0x26')](_0x8982('0x50'),JSON[_0x8982('0x51')](_0x44083f));return[];}}exports[_0x8982('0x52')]=function(_0x5244be,_0x56d3f9){if(_0x5244be[_0x8982('0x53')]){_0x5244be['body']['attrs']=widgetAttributes(_0x5244be[_0x8982('0x53')]);}return db[_0x8982('0x36')][_0x8982('0x52')](_0x5244be[_0x8982('0x53')],{})[_0x8982('0x24')](respondWithResult(_0x56d3f9,0xc9))['catch'](handleError(_0x56d3f9,null));};exports['update']=function(_0x5e66f2,_0x12c709){if(_0x5e66f2[_0x8982('0x53')]['id']){delete _0x5e66f2[_0x8982('0x53')]['id'];}_0x5e66f2[_0x8982('0x53')]['attrs']=widgetAttributes(_0x5e66f2[_0x8982('0x53')]);return db[_0x8982('0x36')][_0x8982('0x37')]({'where':{'id':_0x5e66f2[_0x8982('0x2a')]['id']}})[_0x8982('0x24')](handleEntityNotFound(_0x12c709,null))[_0x8982('0x24')](saveUpdates(_0x5e66f2['body'],null))[_0x8982('0x24')](respondWithResult(_0x12c709,null))[_0x8982('0x38')](handleError(_0x12c709,null));}; \ No newline at end of file +var _0x8fd7=['rawAttributes','query','filters','intersection','model','attributes','length','includeAll','options','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./dashboardItem.socket','sendStatus','status','end','offset','limit','set','json','apply','save','update','then','error','stack','name','send','show','params','keys','DashboardItem'];(function(_0x33c37c,_0x49fa73){var _0x5229e8=function(_0x3eaf0d){while(--_0x3eaf0d){_0x33c37c['push'](_0x33c37c['shift']());}};_0x5229e8(++_0x49fa73);}(_0x8fd7,0x7c));var _0x78fd=function(_0x100025,_0x487c1f){_0x100025=_0x100025-0x0;var _0x1d36a3=_0x8fd7[_0x100025];return _0x1d36a3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x78fd('0x0'));var zipdir=require(_0x78fd('0x1'));var jsonpatch=require(_0x78fd('0x2'));var rp=require(_0x78fd('0x3'));var moment=require(_0x78fd('0x4'));var BPromise=require(_0x78fd('0x5'));var Mustache=require('mustache');var util=require(_0x78fd('0x6'));var path=require(_0x78fd('0x7'));var sox=require(_0x78fd('0x8'));var csv=require(_0x78fd('0x9'));var ejs=require(_0x78fd('0xa'));var fs=require('fs');var _=require(_0x78fd('0xb'));var squel=require(_0x78fd('0xc'));var crypto=require(_0x78fd('0xd'));var jsforce=require(_0x78fd('0xe'));var deskjs=require(_0x78fd('0xf'));var toCsv=require(_0x78fd('0x9'));var querystring=require(_0x78fd('0x10'));var Papa=require(_0x78fd('0x11'));var Redis=require(_0x78fd('0x12'));var authService=require(_0x78fd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x78fd('0x14'));var hardwareService=require(_0x78fd('0x15'));var logger=require(_0x78fd('0x16'))(_0x78fd('0x17'));var utils=require('../../config/utils');var config=require(_0x78fd('0x18'));var db=require(_0x78fd('0x19'))['db'];config[_0x78fd('0x1a')]=_['defaults'](config[_0x78fd('0x1a')],{'host':_0x78fd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78fd('0x1a')]));require(_0x78fd('0x1c'))['register'](socket);function respondWithStatusCode(_0x2840bf,_0x2e5ae){_0x2e5ae=_0x2e5ae||0xcc;return function(_0x5ac816){if(_0x5ac816){return _0x2840bf[_0x78fd('0x1d')](_0x2e5ae);}return _0x2840bf[_0x78fd('0x1e')](_0x2e5ae)[_0x78fd('0x1f')]();};}function respondWithResult(_0x6ae4f,_0x56b967){_0x56b967=_0x56b967||0xc8;return function(_0x22f065){if(_0x22f065){return _0x6ae4f['status'](_0x56b967)['json'](_0x22f065);}};}function respondWithFilteredResult(_0x3950dc,_0x3df37b){return function(_0x2200ce){if(_0x2200ce){var _0x10543c=_0x2200ce['count'],_0x5d6cd7=_0x3df37b[_0x78fd('0x20')],_0x2963c8=_0x3df37b[_0x78fd('0x20')]+_0x3df37b[_0x78fd('0x21')],_0x1ac741;if(_0x2963c8>=_0x10543c){_0x2963c8=_0x10543c;_0x1ac741=0xc8;}else{_0x1ac741=0xce;}_0x3950dc['status'](_0x1ac741);return _0x3950dc[_0x78fd('0x22')]('Content-Range',_0x5d6cd7+'-'+_0x2963c8+'/'+_0x10543c)[_0x78fd('0x23')](_0x2200ce);}return null;};}function patchUpdates(_0x1a40c1){return function(_0x54b11d){try{jsonpatch[_0x78fd('0x24')](_0x54b11d,_0x1a40c1,!![]);}catch(_0x32d39a){return BPromise['reject'](_0x32d39a);}return _0x54b11d[_0x78fd('0x25')]();};}function saveUpdates(_0x40d761,_0x401cca){return function(_0x4928b2){if(_0x4928b2){return _0x4928b2[_0x78fd('0x26')](_0x40d761)[_0x78fd('0x27')](function(_0x28952f){return _0x28952f;});}return null;};}function removeEntity(_0x28a201,_0x505dab){return function(_0x241b69){if(_0x241b69){return _0x241b69['destroy']()[_0x78fd('0x27')](function(){_0x28a201[_0x78fd('0x1e')](0xcc)[_0x78fd('0x1f')]();});}};}function handleEntityNotFound(_0x3068e3,_0x19bd7b){return function(_0x16ddac){if(!_0x16ddac){_0x3068e3[_0x78fd('0x1d')](0x194);}return _0x16ddac;};}function handleError(_0xd8fde8,_0x3f4ba3){_0x3f4ba3=_0x3f4ba3||0x1f4;return function(_0x50c5a8){logger[_0x78fd('0x28')](_0x50c5a8[_0x78fd('0x29')]);if(_0x50c5a8[_0x78fd('0x2a')]){delete _0x50c5a8[_0x78fd('0x2a')];}_0xd8fde8[_0x78fd('0x1e')](_0x3f4ba3)[_0x78fd('0x2b')](_0x50c5a8);};}exports[_0x78fd('0x2c')]=function(_0x40640e,_0x85ad66){var _0x158d71={'raw':![],'where':{'id':_0x40640e[_0x78fd('0x2d')]['id']}},_0x1e80d5={};_0x1e80d5['model']=_[_0x78fd('0x2e')](db[_0x78fd('0x2f')][_0x78fd('0x30')]);_0x1e80d5[_0x78fd('0x31')]=_[_0x78fd('0x2e')](_0x40640e[_0x78fd('0x31')]);_0x1e80d5[_0x78fd('0x32')]=_[_0x78fd('0x33')](_0x1e80d5[_0x78fd('0x34')],_0x1e80d5['query']);_0x158d71[_0x78fd('0x35')]=_[_0x78fd('0x33')](_0x1e80d5[_0x78fd('0x34')],qs['fields'](_0x40640e[_0x78fd('0x31')]['fields']));_0x158d71[_0x78fd('0x35')]=_0x158d71[_0x78fd('0x35')][_0x78fd('0x36')]?_0x158d71['attributes']:_0x1e80d5[_0x78fd('0x34')];if(_0x40640e[_0x78fd('0x31')][_0x78fd('0x37')]){_0x158d71['include']=[{'all':!![]}];}_0x158d71=_['merge']({},_0x158d71,_0x40640e[_0x78fd('0x38')]);return db[_0x78fd('0x2f')][_0x78fd('0x39')](_0x158d71)['then'](handleEntityNotFound(_0x85ad66,null))['then'](respondWithResult(_0x85ad66,null))[_0x78fd('0x3a')](handleError(_0x85ad66,null));};exports[_0x78fd('0x3b')]=function(_0x102e7b,_0x347727){return db[_0x78fd('0x2f')][_0x78fd('0x39')]({'where':{'id':_0x102e7b[_0x78fd('0x2d')]['id']}})[_0x78fd('0x27')](handleEntityNotFound(_0x347727,null))[_0x78fd('0x27')](removeEntity(_0x347727,null))[_0x78fd('0x3a')](handleError(_0x347727,null));};function widgetAttributes(_0x52fa2c){try{switch(_0x52fa2c[_0x78fd('0x3c')]){case _0x78fd('0x3d'):return[{'name':_0x78fd('0x3e'),'value':_0x52fa2c[_0x78fd('0x3e')]||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c['attrs'][0x0]?_0x52fa2c['attrs'][0x0][_0x78fd('0x40')]:undefined)||_0x78fd('0x41')}];case _0x78fd('0x42'):return[{'name':_0x78fd('0x43'),'value':_0x52fa2c['attrPath']||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c['attrs'][0x0]?_0x52fa2c[_0x78fd('0x3f')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x78fd('0x44'),'value':_0x52fa2c['attrHourFormat']||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c[_0x78fd('0x3f')][0x0]?_0x52fa2c['attrs'][0x0][_0x78fd('0x40')]:undefined)||_0x78fd('0x45')},{'name':'attrTimezone','value':_0x52fa2c[_0x78fd('0x46')]||(_0x52fa2c['attrs']&&_0x52fa2c['attrs'][0x1]?_0x52fa2c[_0x78fd('0x3f')][0x1][_0x78fd('0x40')]:undefined)||'0.00'},{'name':_0x78fd('0x47'),'value':_0x52fa2c[_0x78fd('0x47')]||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c[_0x78fd('0x3f')][0x2]?_0x52fa2c[_0x78fd('0x3f')][0x2][_0x78fd('0x40')]:undefined)||0xc}];case _0x78fd('0x48'):return[{'name':'attrMetric','value':_0x52fa2c[_0x78fd('0x49')]||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c['attrs'][0x0]?_0x52fa2c[_0x78fd('0x3f')][0x0][_0x78fd('0x40')]:undefined)||_0x78fd('0x4a')},{'name':_0x78fd('0x4b'),'value':_0x52fa2c[_0x78fd('0x4b')]||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c[_0x78fd('0x3f')][0x1]?_0x52fa2c[_0x78fd('0x3f')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x52fa2c[_0x78fd('0x47')]||(_0x52fa2c['attrs']&&_0x52fa2c['attrs'][0x2]?_0x52fa2c[_0x78fd('0x3f')][0x2][_0x78fd('0x40')]:undefined)||0x14}];case _0x78fd('0x4c'):case _0x78fd('0x4d'):return[{'name':_0x78fd('0x4e'),'value':_0x52fa2c[_0x78fd('0x4e')]||(_0x52fa2c['attrs']&&_0x52fa2c[_0x78fd('0x3f')][0x0]?_0x52fa2c[_0x78fd('0x3f')][0x0][_0x78fd('0x40')]:undefined)||_0x78fd('0x4a')},{'name':_0x78fd('0x4f'),'value':_0x52fa2c['attrSerie2']||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c[_0x78fd('0x3f')][0x1]?_0x52fa2c[_0x78fd('0x3f')][0x1]['value']:undefined)||null},{'name':_0x78fd('0x50'),'value':_0x52fa2c[_0x78fd('0x50')]||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c[_0x78fd('0x3f')][0x2]?_0x52fa2c[_0x78fd('0x3f')][0x2][_0x78fd('0x40')]:undefined)||null},{'name':_0x78fd('0x4b'),'value':_0x52fa2c['attrVoiceQueues']||(_0x52fa2c['attrs']&&_0x52fa2c['attrs'][0x3]?_0x52fa2c[_0x78fd('0x3f')][0x3][_0x78fd('0x40')]:undefined)||[]}];case _0x78fd('0x51'):return[{'name':'attrReport','type':_0x52fa2c[_0x78fd('0x52')]||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c['attrs'][0x0]?_0x52fa2c[_0x78fd('0x3f')][0x0][_0x78fd('0x3c')]:undefined)||null,'value':_0x52fa2c[_0x78fd('0x53')]||(_0x52fa2c[_0x78fd('0x3f')]&&_0x52fa2c[_0x78fd('0x3f')][0x0]?_0x52fa2c[_0x78fd('0x3f')][0x0][_0x78fd('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x52fa2c['attrRefresh']||(_0x52fa2c['attrs']&&_0x52fa2c[_0x78fd('0x3f')][0x1]?_0x52fa2c[_0x78fd('0x3f')][0x1][_0x78fd('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x21ab3a){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x21ab3a));return[];}}exports[_0x78fd('0x54')]=function(_0x1756d4,_0x52ddea){if(_0x1756d4['body']){_0x1756d4[_0x78fd('0x55')][_0x78fd('0x3f')]=widgetAttributes(_0x1756d4[_0x78fd('0x55')]);}return db[_0x78fd('0x2f')][_0x78fd('0x54')](_0x1756d4['body'],{})['then'](respondWithResult(_0x52ddea,0xc9))[_0x78fd('0x3a')](handleError(_0x52ddea,null));};exports['update']=function(_0x5cfd0b,_0x758f40){if(_0x5cfd0b['body']['id']){delete _0x5cfd0b[_0x78fd('0x55')]['id'];}_0x5cfd0b[_0x78fd('0x55')][_0x78fd('0x3f')]=widgetAttributes(_0x5cfd0b[_0x78fd('0x55')]);return db[_0x78fd('0x2f')][_0x78fd('0x39')]({'where':{'id':_0x5cfd0b[_0x78fd('0x2d')]['id']}})[_0x78fd('0x27')](handleEntityNotFound(_0x758f40,null))[_0x78fd('0x27')](saveUpdates(_0x5cfd0b[_0x78fd('0x55')],null))[_0x78fd('0x27')](respondWithResult(_0x758f40,null))[_0x78fd('0x3a')](handleError(_0x758f40,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f0005bf..6025209 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 _0xac2b=['DashboardItem','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2c2f7d,_0x5613c2){var _0xb22d96=function(_0x29e094){while(--_0x29e094){_0x2c2f7d['push'](_0x2c2f7d['shift']());}};_0xb22d96(++_0x5613c2);}(_0xac2b,0x1e7));var _0xbac2=function(_0x33654f,_0x1313a8){_0x33654f=_0x33654f-0x0;var _0x1e01b4=_0xac2b[_0x33654f];return _0x1e01b4;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xbac2('0x0'))['db'][_0xbac2('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbac2('0x2'),'afterDestroy':_0xbac2('0x3')};function emitEvent(_0x52df5b){return function(_0x59177c,_0x3ed85b,_0x5b5f1c){DashboardItemEvents['emit'](_0x52df5b+':'+_0x59177c['id'],_0x59177c);DashboardItemEvents[_0xbac2('0x4')](_0x52df5b,_0x59177c);_0x5b5f1c(null);};}for(var e in events){if(events[_0xbac2('0x5')](e)){var event=events[e];DashboardItem[_0xbac2('0x6')](e,emitEvent(event));}}module[_0xbac2('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xe9c8=['DashboardItem','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x3c803e,_0x1650ad){var _0x499472=function(_0x2234b2){while(--_0x2234b2){_0x3c803e['push'](_0x3c803e['shift']());}};_0x499472(++_0x1650ad);}(_0xe9c8,0xde));var _0x8e9c=function(_0x2e4e48,_0x322a92){_0x2e4e48=_0x2e4e48-0x0;var _0x2642a0=_0xe9c8[_0x2e4e48];return _0x2642a0;};'use strict';var EventEmitter=require(_0x8e9c('0x0'));var DashboardItem=require(_0x8e9c('0x1'))['db'][_0x8e9c('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8e9c('0x3')](0x0);var events={'afterCreate':_0x8e9c('0x4'),'afterUpdate':'update','afterDestroy':_0x8e9c('0x5')};function emitEvent(_0x36fb1c){return function(_0x3a74b3,_0x127009,_0x341fb4){DashboardItemEvents[_0x8e9c('0x6')](_0x36fb1c+':'+_0x3a74b3['id'],_0x3a74b3);DashboardItemEvents['emit'](_0x36fb1c,_0x3a74b3);_0x341fb4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x8e9c('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index cd6c1f8..4bc827d 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 _0x9b83=['rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x18f249,_0x4239f0){var _0x5c35c0=function(_0x3cfe82){while(--_0x3cfe82){_0x18f249['push'](_0x18f249['shift']());}};_0x5c35c0(++_0x4239f0);}(_0x9b83,0xf7));var _0x39b8=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x9b83[_0x383356];return _0x32ee5a;};'use strict';var _=require(_0x39b8('0x0'));var util=require(_0x39b8('0x1'));var logger=require(_0x39b8('0x2'))(_0x39b8('0x3'));var moment=require('moment');var BPromise=require(_0x39b8('0x4'));var rp=require(_0x39b8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39b8('0x6'));var config=require(_0x39b8('0x7'));var attributes=require(_0x39b8('0x8'));module[_0x39b8('0x9')]=function(_0x16e025,_0x4090db){return _0x16e025['define'](_0x39b8('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x741d=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items','lodash'];(function(_0x2a40cc,_0x7def0d){var _0x58f964=function(_0x57711c){while(--_0x57711c){_0x2a40cc['push'](_0x2a40cc['shift']());}};_0x58f964(++_0x7def0d);}(_0x741d,0x1ee));var _0xd741=function(_0x5ed7bc,_0x270b64){_0x5ed7bc=_0x5ed7bc-0x0;var _0xd37edc=_0x741d[_0x5ed7bc];return _0xd37edc;};'use strict';var _=require(_0xd741('0x0'));var util=require(_0xd741('0x1'));var logger=require(_0xd741('0x2'))('api');var moment=require(_0xd741('0x3'));var BPromise=require('bluebird');var rp=require(_0xd741('0x4'));var fs=require('fs');var path=require(_0xd741('0x5'));var rimraf=require(_0xd741('0x6'));var config=require(_0xd741('0x7'));var attributes=require(_0xd741('0x8'));module['exports']=function(_0x51ed05,_0x3a42fb){return _0x51ed05[_0xd741('0x9')]('DashboardItem',attributes,{'tableName':_0xd741('0xa'),'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 95c60b1..7ceea5e 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 _0x6cef=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55187f,_0x5ad25f){var _0x4cdc22=function(_0x5054b1){while(--_0x5054b1){_0x55187f['push'](_0x55187f['shift']());}};_0x4cdc22(++_0x5ad25f);}(_0x6cef,0x121));var _0xf6ce=function(_0x32f75b,_0x16cde7){_0x32f75b=_0x32f75b-0x0;var _0x26f5c7=_0x6cef[_0x32f75b];return _0x26f5c7;};'use strict';var _=require(_0xf6ce('0x0'));var util=require(_0xf6ce('0x1'));var moment=require(_0xf6ce('0x2'));var BPromise=require(_0xf6ce('0x3'));var rs=require(_0xf6ce('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf6ce('0x5'));var logger=require(_0xf6ce('0x6'))(_0xf6ce('0x7'));var config=require(_0xf6ce('0x8'));var jayson=require(_0xf6ce('0x9'));var client=jayson['client'][_0xf6ce('0xa')]({'port':0x232a});config[_0xf6ce('0xb')]=_[_0xf6ce('0xc')](config[_0xf6ce('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6ce('0xb')]));require('./dashboardItem.socket')[_0xf6ce('0xd')](socket);function respondWithRpcPromise(_0x126244,_0x1de1a8,_0x5347d0){return new BPromise(function(_0x29bb9d,_0x9a4bc4){return client[_0xf6ce('0xe')](_0x126244,_0x5347d0)[_0xf6ce('0xf')](function(_0x513450){logger[_0xf6ce('0x10')](_0xf6ce('0x11'),_0x1de1a8,_0xf6ce('0x12'));logger[_0xf6ce('0x13')](_0xf6ce('0x14'),_0x1de1a8,_0xf6ce('0x12'),JSON[_0xf6ce('0x15')](_0x513450));if(_0x513450['error']){if(_0x513450[_0xf6ce('0x16')][_0xf6ce('0x17')]===0x1f4){logger[_0xf6ce('0x16')]('DashboardItem,\x20%s,\x20%s',_0x1de1a8,_0x513450[_0xf6ce('0x16')][_0xf6ce('0x18')]);return _0x9a4bc4(_0x513450[_0xf6ce('0x16')][_0xf6ce('0x18')]);}logger[_0xf6ce('0x16')](_0xf6ce('0x11'),_0x1de1a8,_0x513450[_0xf6ce('0x16')][_0xf6ce('0x18')]);return _0x29bb9d(_0x513450[_0xf6ce('0x16')][_0xf6ce('0x18')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x1de1a8,'request\x20sent');_0x29bb9d(_0x513450['result'][_0xf6ce('0x18')]);}})[_0xf6ce('0x19')](function(_0x5efd5b){logger[_0xf6ce('0x16')](_0xf6ce('0x11'),_0x1de1a8,_0x5efd5b);_0x9a4bc4(_0x5efd5b);});});} \ No newline at end of file +var _0x29ad=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0x368084,_0x401d23){var _0x2e4477=function(_0xa1ac78){while(--_0xa1ac78){_0x368084['push'](_0x368084['shift']());}};_0x2e4477(++_0x401d23);}(_0x29ad,0x7e));var _0xd29a=function(_0xea7377,_0x337419){_0xea7377=_0xea7377-0x0;var _0xce709b=_0x29ad[_0xea7377];return _0xce709b;};'use strict';var _=require(_0xd29a('0x0'));var util=require(_0xd29a('0x1'));var moment=require('moment');var BPromise=require(_0xd29a('0x2'));var rs=require(_0xd29a('0x3'));var fs=require('fs');var Redis=require(_0xd29a('0x4'));var db=require(_0xd29a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd29a('0x6'))(_0xd29a('0x7'));var config=require(_0xd29a('0x8'));var jayson=require(_0xd29a('0x9'));var client=jayson[_0xd29a('0xa')][_0xd29a('0xb')]({'port':0x232a});config[_0xd29a('0xc')]=_['defaults'](config[_0xd29a('0xc')],{'host':_0xd29a('0xd'),'port':0x18eb});var socket=require(_0xd29a('0xe'))(new Redis(config[_0xd29a('0xc')]));require(_0xd29a('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d8416,_0x38788b,_0x27d8be){return new BPromise(function(_0x27fe60,_0x55f607){return client['request'](_0x5d8416,_0x27d8be)[_0xd29a('0x10')](function(_0x208665){logger[_0xd29a('0x11')](_0xd29a('0x12'),_0x38788b,_0xd29a('0x13'));logger[_0xd29a('0x14')](_0xd29a('0x15'),_0x38788b,_0xd29a('0x13'),JSON['stringify'](_0x208665));if(_0x208665[_0xd29a('0x16')]){if(_0x208665[_0xd29a('0x16')][_0xd29a('0x17')]===0x1f4){logger[_0xd29a('0x16')](_0xd29a('0x12'),_0x38788b,_0x208665[_0xd29a('0x16')]['message']);return _0x55f607(_0x208665['error'][_0xd29a('0x18')]);}logger[_0xd29a('0x16')]('DashboardItem,\x20%s,\x20%s',_0x38788b,_0x208665['error'][_0xd29a('0x18')]);return _0x27fe60(_0x208665['error'][_0xd29a('0x18')]);}else{logger['info'](_0xd29a('0x12'),_0x38788b,_0xd29a('0x13'));_0x27fe60(_0x208665[_0xd29a('0x19')][_0xd29a('0x18')]);}})['catch'](function(_0x5263e6){logger[_0xd29a('0x16')](_0xd29a('0x12'),_0x38788b,_0x5263e6);_0x55f607(_0x5263e6);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 25f77f2..a04bb4a 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 _0x3c14=['./dashboardItem.events','save','remove','update','register','length','dashboardItem:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3c14,0x1b9));var _0x43c1=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x3c14[_0x4defd6];return _0x4c9276;};'use strict';var DashboardItemEvents=require(_0x43c1('0x0'));var events=[_0x43c1('0x1'),_0x43c1('0x2'),_0x43c1('0x3')];function createListener(_0x288bed,_0x2c4ee4){return function(_0xb0eb8e){_0x2c4ee4['emit'](_0x288bed,_0xb0eb8e);};}function removeListener(_0x3f5de9,_0x1b6030){return function(){DashboardItemEvents['removeListener'](_0x3f5de9,_0x1b6030);};}exports[_0x43c1('0x4')]=function(_0x1488f0){for(var _0x40c870=0x0,_0x150d7a=events[_0x43c1('0x5')];_0x40c870<_0x150d7a;_0x40c870++){var _0x40a84f=events[_0x40c870];var _0x19f14c=createListener(_0x43c1('0x6')+_0x40a84f,_0x1488f0);DashboardItemEvents['on'](_0x40a84f,_0x19f14c);}}; \ No newline at end of file +var _0xdb55=['dashboardItem:','./dashboardItem.events','save','remove','update','removeListener','register','length'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xdb55,0xc9));var _0x5db5=function(_0x5d51e8,_0x98a197){_0x5d51e8=_0x5d51e8-0x0;var _0x3eb001=_0xdb55[_0x5d51e8];return _0x3eb001;};'use strict';var DashboardItemEvents=require(_0x5db5('0x0'));var events=[_0x5db5('0x1'),_0x5db5('0x2'),_0x5db5('0x3')];function createListener(_0x21816a,_0x5dee64){return function(_0x2f318d){_0x5dee64['emit'](_0x21816a,_0x2f318d);};}function removeListener(_0x49b88c,_0x48710c){return function(){DashboardItemEvents[_0x5db5('0x4')](_0x49b88c,_0x48710c);};}exports[_0x5db5('0x5')]=function(_0x117f8a){for(var _0x2d2093=0x0,_0x4bdfd9=events[_0x5db5('0x6')];_0x2d2093<_0x4bdfd9;_0x2d2093++){var _0x34c956=events[_0x2d2093];var _0x3f5921=createListener(_0x5db5('0x7')+_0x34c956,_0x117f8a);DashboardItemEvents['on'](_0x34c956,_0x3f5921);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 7fc64da..d34cc0b 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','create','put','/:id'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0xabce,0x103));var _0xeabc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabce[_0x2dafbe];return _0x58a45a;};'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 auth=require('../../components/auth/service');var interaction=require(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var controller=require(_0xeabc('0x7'));router['get']('/:id',auth[_0xeabc('0x8')](),controller['show']);router[_0xeabc('0x9')]('/',auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0xdc97=['../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x1c73d4,_0x908a5f){var _0x40d2ab=function(_0x554d6e){while(--_0x554d6e){_0x1c73d4['push'](_0x1c73d4['shift']());}};_0x40d2ab(++_0x908a5f);}(_0xdc97,0x13b));var _0x7dc9=function(_0x7f0a13,_0xf50568){_0x7f0a13=_0x7f0a13-0x0;var _0x173d09=_0xdc97[_0x7f0a13];return _0x173d09;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var auth=require(_0x7dc9('0x4'));var interaction=require(_0x7dc9('0x5'));var config=require('../../config/environment');var controller=require(_0x7dc9('0x6'));router[_0x7dc9('0x7')](_0x7dc9('0x8'),auth[_0x7dc9('0x9')](),controller['show']);router[_0x7dc9('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7dc9('0xb')](_0x7dc9('0x8'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router[_0x7dc9('0xd')]('/:id',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xe')]);module[_0x7dc9('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 f95f36e..d21df6e 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 _0xf8d4=['sequelize','exports','STRING'];(function(_0x203187,_0x36c6c1){var _0x286cf9=function(_0x5de967){while(--_0x5de967){_0x203187['push'](_0x203187['shift']());}};_0x286cf9(++_0x36c6c1);}(_0xf8d4,0xf3));var _0x4f8d=function(_0x527eaf,_0x4fe632){_0x527eaf=_0x527eaf-0x0;var _0x159b88=_0xf8d4[_0x527eaf];return _0x159b88;};'use strict';var Sequelize=require(_0x4f8d('0x0'));module[_0x4f8d('0x1')]={'name':{'type':Sequelize[_0x4f8d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0103=['STRING','sequelize'];(function(_0x27250c,_0x3e6637){var _0x7e3095=function(_0x1bbce7){while(--_0x1bbce7){_0x27250c['push'](_0x27250c['shift']());}};_0x7e3095(++_0x3e6637);}(_0x0103,0x1d9));var _0x3010=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x0103[_0x1265ed];return _0x5ac459;};'use strict';var Sequelize=require(_0x3010('0x0'));module['exports']={'name':{'type':Sequelize[_0x3010('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6d612d7..c40f300 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 _0xdd27=['type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','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','status','end','count','limit','Content-Range','apply','reject','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName'];(function(_0x20c501,_0x5d2a1f){var _0x14794d=function(_0x181b76){while(--_0x181b76){_0x20c501['push'](_0x20c501['shift']());}};_0x14794d(++_0x5d2a1f);}(_0xdd27,0x1b6));var _0x7dd2=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0xdd27[_0x3a3758];return _0x1a9234;};'use strict';var pdf=require(_0x7dd2('0x0'));var emlformat=require(_0x7dd2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7dd2('0x2'));var jsonpatch=require(_0x7dd2('0x3'));var rp=require(_0x7dd2('0x4'));var moment=require('moment');var BPromise=require(_0x7dd2('0x5'));var Mustache=require('mustache');var util=require(_0x7dd2('0x6'));var path=require(_0x7dd2('0x7'));var sox=require(_0x7dd2('0x8'));var csv=require(_0x7dd2('0x9'));var ejs=require(_0x7dd2('0xa'));var fs=require('fs');var _=require(_0x7dd2('0xb'));var squel=require(_0x7dd2('0xc'));var crypto=require(_0x7dd2('0xd'));var jsforce=require(_0x7dd2('0xe'));var deskjs=require(_0x7dd2('0xf'));var toCsv=require(_0x7dd2('0x9'));var querystring=require(_0x7dd2('0x10'));var Papa=require(_0x7dd2('0x11'));var Redis=require('ioredis');var authService=require(_0x7dd2('0x12'));var qs=require(_0x7dd2('0x13'));var as=require(_0x7dd2('0x14'));var hardwareService=require(_0x7dd2('0x15'));var logger=require('../../config/logger')(_0x7dd2('0x16'));var utils=require(_0x7dd2('0x17'));var config=require(_0x7dd2('0x18'));var db=require(_0x7dd2('0x19'))['db'];function respondWithStatusCode(_0x597c6d,_0x37774b){_0x37774b=_0x37774b||0xcc;return function(_0x41c655){if(_0x41c655){return _0x597c6d['sendStatus'](_0x37774b);}return _0x597c6d[_0x7dd2('0x1a')](_0x37774b)[_0x7dd2('0x1b')]();};}function respondWithResult(_0x30255a,_0x58da09){_0x58da09=_0x58da09||0xc8;return function(_0x20f585){if(_0x20f585){return _0x30255a[_0x7dd2('0x1a')](_0x58da09)['json'](_0x20f585);}};}function respondWithFilteredResult(_0x37da11,_0x2f8d62){return function(_0x519c18){if(_0x519c18){var _0x486e40=_0x519c18[_0x7dd2('0x1c')],_0x3967c3=_0x2f8d62['offset'],_0x12704c=_0x2f8d62['offset']+_0x2f8d62[_0x7dd2('0x1d')],_0x1b6d01;if(_0x12704c>=_0x486e40){_0x12704c=_0x486e40;_0x1b6d01=0xc8;}else{_0x1b6d01=0xce;}_0x37da11[_0x7dd2('0x1a')](_0x1b6d01);return _0x37da11['set'](_0x7dd2('0x1e'),_0x3967c3+'-'+_0x12704c+'/'+_0x486e40)['json'](_0x519c18);}return null;};}function patchUpdates(_0x3932d0){return function(_0x4439c3){try{jsonpatch[_0x7dd2('0x1f')](_0x4439c3,_0x3932d0,!![]);}catch(_0xe327ea){return BPromise[_0x7dd2('0x20')](_0xe327ea);}return _0x4439c3['save']();};}function saveUpdates(_0x42ca36,_0x3e6c8c){return function(_0x592443){if(_0x592443){return _0x592443['update'](_0x42ca36)[_0x7dd2('0x21')](function(_0x1ad47c){return _0x1ad47c;});}return null;};}function removeEntity(_0x2fb444,_0x51b6d7){return function(_0x33834d){if(_0x33834d){return _0x33834d[_0x7dd2('0x22')]()[_0x7dd2('0x21')](function(){var _0xbb7a59=_0x33834d[_0x7dd2('0x23')]({'plain':!![]});var _0x2f1ad6=_0x7dd2('0x24');return db[_0x7dd2('0x25')][_0x7dd2('0x22')]({'where':{'type':_0x2f1ad6,'resourceId':_0xbb7a59['id']}})[_0x7dd2('0x21')](function(){return _0x33834d;});})['then'](function(){_0x2fb444[_0x7dd2('0x1a')](0xcc)[_0x7dd2('0x1b')]();});}};}function handleEntityNotFound(_0x26e80f,_0x1abfa3){return function(_0xacffb3){if(!_0xacffb3){_0x26e80f[_0x7dd2('0x26')](0x194);}return _0xacffb3;};}function handleError(_0x404807,_0x72f5a3){_0x72f5a3=_0x72f5a3||0x1f4;return function(_0x598dd4){logger[_0x7dd2('0x27')](_0x598dd4[_0x7dd2('0x28')]);if(_0x598dd4[_0x7dd2('0x29')]){delete _0x598dd4[_0x7dd2('0x29')];}_0x404807[_0x7dd2('0x1a')](_0x72f5a3)[_0x7dd2('0x2a')](_0x598dd4);};}exports[_0x7dd2('0x2b')]=function(_0x5b067a,_0x152eae){var _0x49e559={},_0xc27689={},_0x22afe6={'count':0x0,'rows':[]};var _0x2822b6=_[_0x7dd2('0x2c')](db[_0x7dd2('0x2d')][_0x7dd2('0x2e')],function(_0xf4a14){return{'name':_0xf4a14[_0x7dd2('0x2f')],'type':_0xf4a14[_0x7dd2('0x30')]['key']};});_0xc27689[_0x7dd2('0x31')]=_[_0x7dd2('0x2c')](_0x2822b6,_0x7dd2('0x29'));_0xc27689[_0x7dd2('0x32')]=_[_0x7dd2('0x33')](_0x5b067a[_0x7dd2('0x32')]);_0xc27689[_0x7dd2('0x34')]=_[_0x7dd2('0x35')](_0xc27689[_0x7dd2('0x31')],_0xc27689[_0x7dd2('0x32')]);_0x49e559[_0x7dd2('0x36')]=_[_0x7dd2('0x35')](_0xc27689[_0x7dd2('0x31')],qs[_0x7dd2('0x37')](_0x5b067a[_0x7dd2('0x32')]['fields']));_0x49e559[_0x7dd2('0x36')]=_0x49e559[_0x7dd2('0x36')][_0x7dd2('0x38')]?_0x49e559[_0x7dd2('0x36')]:_0xc27689[_0x7dd2('0x31')];if(!_0x5b067a['query']['hasOwnProperty'](_0x7dd2('0x39'))){_0x49e559['limit']=qs['limit'](_0x5b067a[_0x7dd2('0x32')]['limit']);_0x49e559[_0x7dd2('0x3a')]=qs[_0x7dd2('0x3a')](_0x5b067a['query'][_0x7dd2('0x3a')]);}_0x49e559[_0x7dd2('0x3b')]=qs['sort'](_0x5b067a['query'][_0x7dd2('0x3c')]);_0x49e559['where']=qs[_0x7dd2('0x34')](_[_0x7dd2('0x3d')](_0x5b067a[_0x7dd2('0x32')],_0xc27689[_0x7dd2('0x34')]),_0x2822b6);if(_0x5b067a[_0x7dd2('0x32')][_0x7dd2('0x3e')]){_0x49e559[_0x7dd2('0x3f')]=_[_0x7dd2('0x40')](_0x49e559['where'],{'$or':_[_0x7dd2('0x2c')](_0x2822b6,function(_0x23ae31){if(_0x23ae31[_0x7dd2('0x30')]!==_0x7dd2('0x41')){var _0x4323ba={};_0x4323ba[_0x23ae31['name']]={'$like':'%'+_0x5b067a[_0x7dd2('0x32')]['filter']+'%'};return _0x4323ba;}})});}_0x49e559=_['merge']({},_0x49e559,_0x5b067a[_0x7dd2('0x42')]);var _0x865b03={'where':_0x49e559[_0x7dd2('0x3f')]};return db[_0x7dd2('0x2d')][_0x7dd2('0x1c')](_0x865b03)['then'](function(_0xc820b){_0x22afe6[_0x7dd2('0x1c')]=_0xc820b;if(_0x5b067a[_0x7dd2('0x32')][_0x7dd2('0x43')]){_0x49e559[_0x7dd2('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x7dd2('0x45')](_0x49e559);})['then'](function(_0x382c55){_0x22afe6['rows']=_0x382c55;return _0x22afe6;})[_0x7dd2('0x21')](respondWithFilteredResult(_0x152eae,_0x49e559))['catch'](handleError(_0x152eae,null));};exports[_0x7dd2('0x46')]=function(_0x264c2c,_0x3a54c5){var _0x55e052={'raw':!![],'where':{'id':_0x264c2c[_0x7dd2('0x47')]['id']}},_0x47a0a3={};_0x47a0a3['model']=_[_0x7dd2('0x33')](db[_0x7dd2('0x2d')][_0x7dd2('0x2e')]);_0x47a0a3[_0x7dd2('0x32')]=_['keys'](_0x264c2c[_0x7dd2('0x32')]);_0x47a0a3['filters']=_[_0x7dd2('0x35')](_0x47a0a3[_0x7dd2('0x31')],_0x47a0a3['query']);_0x55e052['attributes']=_[_0x7dd2('0x35')](_0x47a0a3[_0x7dd2('0x31')],qs[_0x7dd2('0x37')](_0x264c2c[_0x7dd2('0x32')][_0x7dd2('0x37')]));_0x55e052[_0x7dd2('0x36')]=_0x55e052[_0x7dd2('0x36')][_0x7dd2('0x38')]?_0x55e052[_0x7dd2('0x36')]:_0x47a0a3['model'];if(_0x264c2c['query'][_0x7dd2('0x43')]){_0x55e052[_0x7dd2('0x44')]=[{'all':!![]}];}_0x55e052=_[_0x7dd2('0x40')]({},_0x55e052,_0x264c2c[_0x7dd2('0x42')]);return db[_0x7dd2('0x2d')][_0x7dd2('0x48')](_0x55e052)[_0x7dd2('0x21')](handleEntityNotFound(_0x3a54c5,null))[_0x7dd2('0x21')](respondWithResult(_0x3a54c5,null))[_0x7dd2('0x49')](handleError(_0x3a54c5,null));};exports['create']=function(_0x8e428f,_0x126555){return db[_0x7dd2('0x2d')]['create'](_0x8e428f[_0x7dd2('0x4a')],{})[_0x7dd2('0x21')](function(_0x5a39f4){var _0xd10e28=_0x8e428f[_0x7dd2('0x4b')]['get']({'plain':!![]});if(!_0xd10e28)throw new Error(_0x7dd2('0x4c'));if(_0xd10e28['role']===_0x7dd2('0x4b')){var _0x43bf0c=_0x5a39f4['get']({'plain':!![]});var _0x1d4178=_0x7dd2('0x24');return db[_0x7dd2('0x4d')][_0x7dd2('0x48')]({'where':{'name':_0x1d4178,'userProfileId':_0xd10e28['userProfileId']},'raw':!![]})[_0x7dd2('0x21')](function(_0x4d3e1f){if(_0x4d3e1f&&_0x4d3e1f[_0x7dd2('0x4e')]===0x0){return db[_0x7dd2('0x25')][_0x7dd2('0x4f')]({'name':_0x43bf0c[_0x7dd2('0x29')],'resourceId':_0x43bf0c['id'],'type':_0x4d3e1f[_0x7dd2('0x29')],'sectionId':_0x4d3e1f['id']},{})[_0x7dd2('0x21')](function(){return _0x5a39f4;});}else{return _0x5a39f4;}})[_0x7dd2('0x49')](function(_0x410ef6){logger[_0x7dd2('0x27')](_0x7dd2('0x50'),_0x410ef6);throw _0x410ef6;});}return _0x5a39f4;})[_0x7dd2('0x21')](respondWithResult(_0x126555,0xc9))[_0x7dd2('0x49')](handleError(_0x126555,null));};exports['update']=function(_0x291cb0,_0x55408a){if(_0x291cb0['body']['id']){delete _0x291cb0[_0x7dd2('0x4a')]['id'];}return db[_0x7dd2('0x2d')]['find']({'where':{'id':_0x291cb0[_0x7dd2('0x47')]['id']}})[_0x7dd2('0x21')](handleEntityNotFound(_0x55408a,null))['then'](saveUpdates(_0x291cb0[_0x7dd2('0x4a')],null))[_0x7dd2('0x21')](respondWithResult(_0x55408a,null))[_0x7dd2('0x49')](handleError(_0x55408a,null));};exports['destroy']=function(_0x24953b,_0x151d01){return db[_0x7dd2('0x2d')][_0x7dd2('0x48')]({'where':{'id':_0x24953b[_0x7dd2('0x47')]['id']}})[_0x7dd2('0x21')](handleEntityNotFound(_0x151d01,null))['then'](removeEntity(_0x151d01,null))[_0x7dd2('0x49')](handleError(_0x151d01,null));}; \ No newline at end of file +var _0xc2be=['order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','show','params','keys','length','catch','create','body','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','reject','save','update','destroy','get','Dispositions','UserProfileResource','sendStatus','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit'];(function(_0x245dd8,_0x4a73d8){var _0x28c7cd=function(_0x3f156a){while(--_0x3f156a){_0x245dd8['push'](_0x245dd8['shift']());}};_0x28c7cd(++_0x4a73d8);}(_0xc2be,0x14f));var _0xec2b=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xc2be[_0x421263];return _0x34e4b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xec2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec2b('0x1'));var jsonpatch=require(_0xec2b('0x2'));var rp=require('request-promise');var moment=require(_0xec2b('0x3'));var BPromise=require(_0xec2b('0x4'));var Mustache=require(_0xec2b('0x5'));var util=require(_0xec2b('0x6'));var path=require(_0xec2b('0x7'));var sox=require(_0xec2b('0x8'));var csv=require(_0xec2b('0x9'));var ejs=require(_0xec2b('0xa'));var fs=require('fs');var _=require(_0xec2b('0xb'));var squel=require(_0xec2b('0xc'));var crypto=require(_0xec2b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xec2b('0xe'));var toCsv=require(_0xec2b('0x9'));var querystring=require('querystring');var Papa=require(_0xec2b('0xf'));var Redis=require(_0xec2b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xec2b('0x11'));var as=require(_0xec2b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec2b('0x13'))(_0xec2b('0x14'));var utils=require(_0xec2b('0x15'));var config=require(_0xec2b('0x16'));var db=require(_0xec2b('0x17'))['db'];function respondWithStatusCode(_0x4a6ec5,_0x1bc5c1){_0x1bc5c1=_0x1bc5c1||0xcc;return function(_0xb1fa73){if(_0xb1fa73){return _0x4a6ec5['sendStatus'](_0x1bc5c1);}return _0x4a6ec5[_0xec2b('0x18')](_0x1bc5c1)[_0xec2b('0x19')]();};}function respondWithResult(_0x5e00a2,_0x2b5a06){_0x2b5a06=_0x2b5a06||0xc8;return function(_0x5c623f){if(_0x5c623f){return _0x5e00a2[_0xec2b('0x18')](_0x2b5a06)['json'](_0x5c623f);}};}function respondWithFilteredResult(_0x199959,_0x4724c5){return function(_0x1d221d){if(_0x1d221d){var _0x4217e1=_0x1d221d[_0xec2b('0x1a')],_0xd30aca=_0x4724c5[_0xec2b('0x1b')],_0x49aa38=_0x4724c5[_0xec2b('0x1b')]+_0x4724c5[_0xec2b('0x1c')],_0x3fa18d;if(_0x49aa38>=_0x4217e1){_0x49aa38=_0x4217e1;_0x3fa18d=0xc8;}else{_0x3fa18d=0xce;}_0x199959[_0xec2b('0x18')](_0x3fa18d);return _0x199959['set'](_0xec2b('0x1d'),_0xd30aca+'-'+_0x49aa38+'/'+_0x4217e1)['json'](_0x1d221d);}return null;};}function patchUpdates(_0x3e616c){return function(_0x33ea8e){try{jsonpatch['apply'](_0x33ea8e,_0x3e616c,!![]);}catch(_0x1d1a14){return BPromise[_0xec2b('0x1e')](_0x1d1a14);}return _0x33ea8e[_0xec2b('0x1f')]();};}function saveUpdates(_0x736fd4,_0x1d42b6){return function(_0x51e856){if(_0x51e856){return _0x51e856[_0xec2b('0x20')](_0x736fd4)['then'](function(_0x1d8c82){return _0x1d8c82;});}return null;};}function removeEntity(_0x474d62,_0x3f24d3){return function(_0x36eb6e){if(_0x36eb6e){return _0x36eb6e[_0xec2b('0x21')]()['then'](function(){var _0x2faaca=_0x36eb6e[_0xec2b('0x22')]({'plain':!![]});var _0x458dc5=_0xec2b('0x23');return db[_0xec2b('0x24')][_0xec2b('0x21')]({'where':{'type':_0x458dc5,'resourceId':_0x2faaca['id']}})['then'](function(){return _0x36eb6e;});})['then'](function(){_0x474d62[_0xec2b('0x18')](0xcc)[_0xec2b('0x19')]();});}};}function handleEntityNotFound(_0x2a0893,_0x18f97f){return function(_0x2ed085){if(!_0x2ed085){_0x2a0893[_0xec2b('0x25')](0x194);}return _0x2ed085;};}function handleError(_0x59548c,_0x37fa9a){_0x37fa9a=_0x37fa9a||0x1f4;return function(_0x18fb1b){logger[_0xec2b('0x26')](_0x18fb1b['stack']);if(_0x18fb1b[_0xec2b('0x27')]){delete _0x18fb1b[_0xec2b('0x27')];}_0x59548c['status'](_0x37fa9a)[_0xec2b('0x28')](_0x18fb1b);};}exports[_0xec2b('0x29')]=function(_0x36e1bc,_0x457606){var _0x52bf3c={},_0x1e4b98={},_0x4bd38a={'count':0x0,'rows':[]};var _0x180b7f=_[_0xec2b('0x2a')](db[_0xec2b('0x2b')][_0xec2b('0x2c')],function(_0x34ff8b){return{'name':_0x34ff8b[_0xec2b('0x2d')],'type':_0x34ff8b[_0xec2b('0x2e')][_0xec2b('0x2f')]};});_0x1e4b98[_0xec2b('0x30')]=_[_0xec2b('0x2a')](_0x180b7f,_0xec2b('0x27'));_0x1e4b98[_0xec2b('0x31')]=_['keys'](_0x36e1bc[_0xec2b('0x31')]);_0x1e4b98[_0xec2b('0x32')]=_[_0xec2b('0x33')](_0x1e4b98[_0xec2b('0x30')],_0x1e4b98['query']);_0x52bf3c['attributes']=_['intersection'](_0x1e4b98[_0xec2b('0x30')],qs[_0xec2b('0x34')](_0x36e1bc['query'][_0xec2b('0x34')]));_0x52bf3c[_0xec2b('0x35')]=_0x52bf3c[_0xec2b('0x35')]['length']?_0x52bf3c[_0xec2b('0x35')]:_0x1e4b98[_0xec2b('0x30')];if(!_0x36e1bc[_0xec2b('0x31')]['hasOwnProperty'](_0xec2b('0x36'))){_0x52bf3c[_0xec2b('0x1c')]=qs['limit'](_0x36e1bc[_0xec2b('0x31')][_0xec2b('0x1c')]);_0x52bf3c[_0xec2b('0x1b')]=qs[_0xec2b('0x1b')](_0x36e1bc[_0xec2b('0x31')]['offset']);}_0x52bf3c[_0xec2b('0x37')]=qs['sort'](_0x36e1bc[_0xec2b('0x31')][_0xec2b('0x38')]);_0x52bf3c[_0xec2b('0x39')]=qs[_0xec2b('0x32')](_[_0xec2b('0x3a')](_0x36e1bc[_0xec2b('0x31')],_0x1e4b98['filters']),_0x180b7f);if(_0x36e1bc[_0xec2b('0x31')]['filter']){_0x52bf3c['where']=_[_0xec2b('0x3b')](_0x52bf3c[_0xec2b('0x39')],{'$or':_[_0xec2b('0x2a')](_0x180b7f,function(_0x47a688){if(_0x47a688[_0xec2b('0x2e')]!==_0xec2b('0x3c')){var _0x2e4583={};_0x2e4583[_0x47a688[_0xec2b('0x27')]]={'$like':'%'+_0x36e1bc['query'][_0xec2b('0x3d')]+'%'};return _0x2e4583;}})});}_0x52bf3c=_['merge']({},_0x52bf3c,_0x36e1bc[_0xec2b('0x3e')]);var _0x162735={'where':_0x52bf3c[_0xec2b('0x39')]};return db['Disposition'][_0xec2b('0x1a')](_0x162735)[_0xec2b('0x3f')](function(_0x20422a){_0x4bd38a[_0xec2b('0x1a')]=_0x20422a;if(_0x36e1bc['query'][_0xec2b('0x40')]){_0x52bf3c[_0xec2b('0x41')]=[{'all':!![]}];}return db[_0xec2b('0x2b')][_0xec2b('0x42')](_0x52bf3c);})[_0xec2b('0x3f')](function(_0x31e14a){_0x4bd38a['rows']=_0x31e14a;return _0x4bd38a;})[_0xec2b('0x3f')](respondWithFilteredResult(_0x457606,_0x52bf3c))['catch'](handleError(_0x457606,null));};exports[_0xec2b('0x43')]=function(_0x13c52f,_0x3c4495){var _0x5c0aa3={'raw':!![],'where':{'id':_0x13c52f[_0xec2b('0x44')]['id']}},_0x1852a1={};_0x1852a1[_0xec2b('0x30')]=_['keys'](db[_0xec2b('0x2b')][_0xec2b('0x2c')]);_0x1852a1[_0xec2b('0x31')]=_[_0xec2b('0x45')](_0x13c52f[_0xec2b('0x31')]);_0x1852a1[_0xec2b('0x32')]=_[_0xec2b('0x33')](_0x1852a1[_0xec2b('0x30')],_0x1852a1[_0xec2b('0x31')]);_0x5c0aa3[_0xec2b('0x35')]=_[_0xec2b('0x33')](_0x1852a1[_0xec2b('0x30')],qs[_0xec2b('0x34')](_0x13c52f[_0xec2b('0x31')]['fields']));_0x5c0aa3[_0xec2b('0x35')]=_0x5c0aa3[_0xec2b('0x35')][_0xec2b('0x46')]?_0x5c0aa3[_0xec2b('0x35')]:_0x1852a1[_0xec2b('0x30')];if(_0x13c52f[_0xec2b('0x31')][_0xec2b('0x40')]){_0x5c0aa3[_0xec2b('0x41')]=[{'all':!![]}];}_0x5c0aa3=_['merge']({},_0x5c0aa3,_0x13c52f[_0xec2b('0x3e')]);return db[_0xec2b('0x2b')]['find'](_0x5c0aa3)[_0xec2b('0x3f')](handleEntityNotFound(_0x3c4495,null))[_0xec2b('0x3f')](respondWithResult(_0x3c4495,null))[_0xec2b('0x47')](handleError(_0x3c4495,null));};exports[_0xec2b('0x48')]=function(_0x50f982,_0x435f6a){return db[_0xec2b('0x2b')][_0xec2b('0x48')](_0x50f982[_0xec2b('0x49')],{})[_0xec2b('0x3f')](function(_0x2426ef){var _0x374a0a=_0x50f982['user'][_0xec2b('0x22')]({'plain':!![]});if(!_0x374a0a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x374a0a[_0xec2b('0x4a')]==='user'){var _0x6ec46b=_0x2426ef[_0xec2b('0x22')]({'plain':!![]});var _0x2b2361=_0xec2b('0x23');return db[_0xec2b('0x4b')]['find']({'where':{'name':_0x2b2361,'userProfileId':_0x374a0a['userProfileId']},'raw':!![]})[_0xec2b('0x3f')](function(_0x4218d9){if(_0x4218d9&&_0x4218d9['autoAssociation']===0x0){return db[_0xec2b('0x24')][_0xec2b('0x48')]({'name':_0x6ec46b[_0xec2b('0x27')],'resourceId':_0x6ec46b['id'],'type':_0x4218d9[_0xec2b('0x27')],'sectionId':_0x4218d9['id']},{})['then'](function(){return _0x2426ef;});}else{return _0x2426ef;}})[_0xec2b('0x47')](function(_0x2cc459){logger['error'](_0xec2b('0x4c'),_0x2cc459);throw _0x2cc459;});}return _0x2426ef;})[_0xec2b('0x3f')](respondWithResult(_0x435f6a,0xc9))['catch'](handleError(_0x435f6a,null));};exports[_0xec2b('0x20')]=function(_0x451d9b,_0x1ab9e3){if(_0x451d9b[_0xec2b('0x49')]['id']){delete _0x451d9b[_0xec2b('0x49')]['id'];}return db['Disposition'][_0xec2b('0x4d')]({'where':{'id':_0x451d9b[_0xec2b('0x44')]['id']}})[_0xec2b('0x3f')](handleEntityNotFound(_0x1ab9e3,null))[_0xec2b('0x3f')](saveUpdates(_0x451d9b[_0xec2b('0x49')],null))[_0xec2b('0x3f')](respondWithResult(_0x1ab9e3,null))[_0xec2b('0x47')](handleError(_0x1ab9e3,null));};exports[_0xec2b('0x21')]=function(_0x2de2fe,_0x263386){return db['Disposition']['find']({'where':{'id':_0x2de2fe[_0xec2b('0x44')]['id']}})[_0xec2b('0x3f')](handleEntityNotFound(_0x263386,null))[_0xec2b('0x3f')](removeEntity(_0x263386,null))[_0xec2b('0x47')](handleError(_0x263386,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4d2a628..636f819 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 _0xb491=['moment','bluebird','path','rimraf','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api'];(function(_0x47c2f4,_0x412693){var _0xbe1cbe=function(_0x41a2b4){while(--_0x41a2b4){_0x47c2f4['push'](_0x47c2f4['shift']());}};_0xbe1cbe(++_0x412693);}(_0xb491,0x18c));var _0x1b49=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0xb491[_0x32729c];return _0x482cfd;};'use strict';var _=require(_0x1b49('0x0'));var util=require(_0x1b49('0x1'));var logger=require(_0x1b49('0x2'))(_0x1b49('0x3'));var moment=require(_0x1b49('0x4'));var BPromise=require(_0x1b49('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b49('0x6'));var rimraf=require(_0x1b49('0x7'));var config=require('../../config/environment');var attributes=require(_0x1b49('0x8'));module[_0x1b49('0x9')]=function(_0x22b7c1,_0x5d9945){return _0x22b7c1[_0x1b49('0xa')]('Disposition',attributes,{'tableName':_0x1b49('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1b49('0xc'),'fields':[_0x1b49('0xd'),_0x1b49('0xe')]},{'unique':!![],'name':_0x1b49('0xf'),'fields':[_0x1b49('0xd'),_0x1b49('0x10')]},{'unique':!![],'name':_0x1b49('0x11'),'fields':[_0x1b49('0xd'),_0x1b49('0x12')]},{'unique':!![],'name':_0x1b49('0x13'),'fields':[_0x1b49('0xd'),_0x1b49('0x14')]},{'unique':!![],'name':_0x1b49('0x15'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x1b49('0x16'),'fields':[_0x1b49('0xd'),_0x1b49('0x17')]},{'unique':!![],'name':_0x1b49('0x18'),'fields':[_0x1b49('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff3=['name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','path','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0x1ccaf2,_0x530e62){var _0x4aacb6=function(_0x34ea2e){while(--_0x34ea2e){_0x1ccaf2['push'](_0x1ccaf2['shift']());}};_0x4aacb6(++_0x530e62);}(_0x8ff3,0x72));var _0x38ff=function(_0x1baa84,_0x3c938e){_0x1baa84=_0x1baa84-0x0;var _0x18523b=_0x8ff3[_0x1baa84];return _0x18523b;};'use strict';var _=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var logger=require('../../config/logger')(_0x38ff('0x2'));var moment=require(_0x38ff('0x3'));var BPromise=require(_0x38ff('0x4'));var rp=require(_0x38ff('0x5'));var fs=require('fs');var path=require(_0x38ff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x38ff('0x7'));module['exports']=function(_0x32a606,_0x5428e3){return _0x32a606[_0x38ff('0x8')](_0x38ff('0x9'),attributes,{'tableName':_0x38ff('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x38ff('0xb'),'fields':[_0x38ff('0xc'),_0x38ff('0xd')]},{'unique':!![],'name':_0x38ff('0xe'),'fields':[_0x38ff('0xc'),_0x38ff('0xf')]},{'unique':!![],'name':_0x38ff('0x10'),'fields':[_0x38ff('0xc'),_0x38ff('0x11')]},{'unique':!![],'name':_0x38ff('0x12'),'fields':['name',_0x38ff('0x13')]},{'unique':!![],'name':_0x38ff('0x14'),'fields':[_0x38ff('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x38ff('0x15'),'fields':[_0x38ff('0xc'),_0x38ff('0x16')]},{'unique':!![],'name':_0x38ff('0x17'),'fields':['name',_0x38ff('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2b45a5c..805cb91 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 _0xd932=['then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3b6d96,_0x5d3241){var _0x1e6b1c=function(_0x200631){while(--_0x200631){_0x3b6d96['push'](_0x3b6d96['shift']());}};_0x1e6b1c(++_0x5d3241);}(_0xd932,0x1c6));var _0x2d93=function(_0x4aedac,_0x3d1550){_0x4aedac=_0x4aedac-0x0;var _0x321255=_0xd932[_0x4aedac];return _0x321255;};'use strict';var _=require(_0x2d93('0x0'));var util=require(_0x2d93('0x1'));var moment=require(_0x2d93('0x2'));var BPromise=require(_0x2d93('0x3'));var rs=require(_0x2d93('0x4'));var fs=require('fs');var Redis=require(_0x2d93('0x5'));var db=require(_0x2d93('0x6'))['db'];var utils=require(_0x2d93('0x7'));var logger=require(_0x2d93('0x8'))(_0x2d93('0x9'));var config=require(_0x2d93('0xa'));var jayson=require(_0x2d93('0xb'));var client=jayson[_0x2d93('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27a870,_0x28b95a,_0x5e4e19){return new BPromise(function(_0xe2bc9,_0x39c42a){return client[_0x2d93('0xd')](_0x27a870,_0x5e4e19)[_0x2d93('0xe')](function(_0x439a21){logger[_0x2d93('0xf')](_0x2d93('0x10'),_0x28b95a,'request\x20sent');logger[_0x2d93('0x11')](_0x2d93('0x12'),_0x28b95a,_0x2d93('0x13'),JSON[_0x2d93('0x14')](_0x439a21));if(_0x439a21[_0x2d93('0x15')]){if(_0x439a21[_0x2d93('0x15')][_0x2d93('0x16')]===0x1f4){logger[_0x2d93('0x15')]('Disposition,\x20%s,\x20%s',_0x28b95a,_0x439a21[_0x2d93('0x15')][_0x2d93('0x17')]);return _0x39c42a(_0x439a21[_0x2d93('0x15')][_0x2d93('0x17')]);}logger[_0x2d93('0x15')](_0x2d93('0x10'),_0x28b95a,_0x439a21[_0x2d93('0x15')][_0x2d93('0x17')]);return _0xe2bc9(_0x439a21['error'][_0x2d93('0x17')]);}else{logger[_0x2d93('0xf')](_0x2d93('0x10'),_0x28b95a,_0x2d93('0x13'));_0xe2bc9(_0x439a21[_0x2d93('0x18')]['message']);}})[_0x2d93('0x19')](function(_0x4715c4){logger[_0x2d93('0x15')](_0x2d93('0x10'),_0x28b95a,_0x4715c4);_0x39c42a(_0x4715c4);});});} \ No newline at end of file +var _0x91b5=['result','catch','lodash','util','../../mysqldb','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x5a52f2,_0x39f61a){var _0x1720a2=function(_0x4ccad3){while(--_0x4ccad3){_0x5a52f2['push'](_0x5a52f2['shift']());}};_0x1720a2(++_0x39f61a);}(_0x91b5,0xce));var _0x591b=function(_0x2f6a88,_0x2daabf){_0x2f6a88=_0x2f6a88-0x0;var _0x5a5876=_0x91b5[_0x2f6a88];return _0x5a5876;};'use strict';var _=require(_0x591b('0x0'));var util=require(_0x591b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x591b('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x591b('0x3'));var client=jayson[_0x591b('0x4')][_0x591b('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x253f7c,_0x1f0523,_0x15dc8e){return new BPromise(function(_0x21ff7d,_0x48eb43){return client[_0x591b('0x6')](_0x253f7c,_0x15dc8e)[_0x591b('0x7')](function(_0x322f8b){logger[_0x591b('0x8')](_0x591b('0x9'),_0x1f0523,_0x591b('0xa'));logger[_0x591b('0xb')]('Disposition,\x20%s,\x20%s,\x20%s',_0x1f0523,_0x591b('0xa'),JSON[_0x591b('0xc')](_0x322f8b));if(_0x322f8b[_0x591b('0xd')]){if(_0x322f8b[_0x591b('0xd')]['code']===0x1f4){logger[_0x591b('0xd')](_0x591b('0x9'),_0x1f0523,_0x322f8b['error']['message']);return _0x48eb43(_0x322f8b[_0x591b('0xd')]['message']);}logger[_0x591b('0xd')]('Disposition,\x20%s,\x20%s',_0x1f0523,_0x322f8b[_0x591b('0xd')][_0x591b('0xe')]);return _0x21ff7d(_0x322f8b[_0x591b('0xd')][_0x591b('0xe')]);}else{logger[_0x591b('0x8')](_0x591b('0x9'),_0x1f0523,_0x591b('0xa'));_0x21ff7d(_0x322f8b[_0x591b('0xf')][_0x591b('0xe')]);}})[_0x591b('0x10')](function(_0x1c2cbc){logger['error']('Disposition,\x20%s,\x20%s',_0x1f0523,_0x1c2cbc);_0x48eb43(_0x1c2cbc);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 3173316..09c1382 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 _0x8861=['index','/:id','show','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8861,0x6d));var _0x1886=function(_0x3a9083,_0x3c9f8d){_0x3a9083=_0x3a9083-0x0;var _0x160306=_0x8861[_0x3a9083];return _0x160306;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1886('0x0'));var timeout=require(_0x1886('0x1'));var express=require(_0x1886('0x2'));var router=express[_0x1886('0x3')]();var auth=require(_0x1886('0x4'));var interaction=require(_0x1886('0x5'));var config=require(_0x1886('0x6'));var controller=require(_0x1886('0x7'));router[_0x1886('0x8')]('/',auth[_0x1886('0x9')](),controller[_0x1886('0xa')]);router[_0x1886('0x8')](_0x1886('0xb'),auth[_0x1886('0x9')](),controller[_0x1886('0xc')]);router['post']('/',auth[_0x1886('0x9')](),controller['create']);router[_0x1886('0xd')]('/:id',auth[_0x1886('0x9')](),controller['update']);router[_0x1886('0xe')](_0x1886('0xb'),auth[_0x1886('0x9')](),controller[_0x1886('0xf')]);module[_0x1886('0x10')]=router; \ No newline at end of file +var _0xa3e8=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x3acce4,_0x455365){var _0x48356d=function(_0x52091c){while(--_0x52091c){_0x3acce4['push'](_0x3acce4['shift']());}};_0x48356d(++_0x455365);}(_0xa3e8,0x127));var _0x8a3e=function(_0x2c267b,_0x420819){_0x2c267b=_0x2c267b-0x0;var _0xcaccee=_0xa3e8[_0x2c267b];return _0xcaccee;};'use strict';var multer=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var path=require(_0x8a3e('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a3e('0x3'));var router=express[_0x8a3e('0x4')]();var auth=require(_0x8a3e('0x5'));var interaction=require(_0x8a3e('0x6'));var config=require(_0x8a3e('0x7'));var controller=require('./disposition.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8a3e('0x8')]);router[_0x8a3e('0x9')](_0x8a3e('0xa'),auth['isAuthenticated'](),controller[_0x8a3e('0xb')]);router[_0x8a3e('0xc')]('/',auth[_0x8a3e('0xd')](),controller[_0x8a3e('0xe')]);router[_0x8a3e('0xf')](_0x8a3e('0xa'),auth[_0x8a3e('0xd')](),controller[_0x8a3e('0x10')]);router[_0x8a3e('0x11')]('/:id',auth[_0x8a3e('0xd')](),controller[_0x8a3e('0x12')]);module[_0x8a3e('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 15325e7..c514667 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 _0x6c02=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','7200','12000','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x6c02,0xe1));var _0x26c0=function(_0x31e125,_0x18ec26){_0x31e125=_0x31e125-0x0;var _0x1d0b12=_0x6c02[_0x31e125];return _0x1d0b12;};'use strict';var Sequelize=require(_0x26c0('0x0'));module[_0x26c0('0x1')]={'name':{'type':Sequelize[_0x26c0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x26c0('0x2')]},'ecm':{'type':Sequelize[_0x26c0('0x3')]('yes','no'),'defaultValue':_0x26c0('0x4')},'headerinfo':{'type':Sequelize[_0x26c0('0x2')],'defaultValue':_0x26c0('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x26c0('0x6')},'minrate':{'type':Sequelize[_0x26c0('0x3')](_0x26c0('0x7'),_0x26c0('0x8'),'7200',_0x26c0('0x9'),'12000',_0x26c0('0xa')),'defaultValue':_0x26c0('0x8')},'maxrate':{'type':Sequelize[_0x26c0('0x3')](_0x26c0('0x7'),_0x26c0('0x8'),_0x26c0('0xb'),_0x26c0('0x9'),_0x26c0('0xc'),_0x26c0('0xa')),'defaultValue':_0x26c0('0xa')},'modem':{'type':Sequelize[_0x26c0('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x26c0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x26c0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x26c0('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x26c0('0x3')](_0x26c0('0xe'),_0x26c0('0xf'),_0x26c0('0x10'),_0x26c0('0x11')),'defaultValue':_0x26c0('0xe')},'key':{'type':Sequelize[_0x26c0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x26c0('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x26c0('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x26c0('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x26c0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x26c0('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x26c0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26c0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x26c0('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x26c0('0x13')],'defaultValue':![],'comment':_0x26c0('0x15'),'set':function(_0x7e404){if(!_0x7e404)this[_0x26c0('0x16')](_0x26c0('0x17'),null);this[_0x26c0('0x16')](_0x26c0('0x18'),_0x7e404);}}}; \ No newline at end of file +var _0xda0b=['localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','STRING','INTEGER','SIP','IAX','DADHI','KHOMP','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','yes','xCALLY\x20Motion\x20Fax'];(function(_0x1b3a8d,_0x1a9fb6){var _0x2b4daf=function(_0x1859e1){while(--_0x1859e1){_0x1b3a8d['push'](_0x1b3a8d['shift']());}};_0x2b4daf(++_0x1a9fb6);}(_0xda0b,0xee));var _0xbda0=function(_0x234d6a,_0x58d561){_0x234d6a=_0x234d6a-0x0;var _0x40b343=_0xda0b[_0x234d6a];return _0x40b343;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0xbda0('0x0'),'no'),'defaultValue':_0xbda0('0x0')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xbda0('0x1')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xbda0('0x2')},'minrate':{'type':Sequelize[_0xbda0('0x3')](_0xbda0('0x4'),_0xbda0('0x5'),_0xbda0('0x6'),_0xbda0('0x7'),_0xbda0('0x8'),_0xbda0('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xbda0('0x3')](_0xbda0('0x4'),_0xbda0('0x5'),'7200',_0xbda0('0x7'),_0xbda0('0x8'),'14400'),'defaultValue':_0xbda0('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xbda0('0xa')},'gateway':{'type':Sequelize[_0xbda0('0xb')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbda0('0xb')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbda0('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbda0('0x3')](_0xbda0('0xd'),_0xbda0('0xe'),_0xbda0('0xf'),_0xbda0('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbda0('0x11');}},'notificationSound':{'type':Sequelize[_0xbda0('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbda0('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbda0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbda0('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbda0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbda0('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbda0('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbda0('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xbda0('0x12')],'defaultValue':![],'comment':_0xbda0('0x14'),'set':function(_0x312052){if(!_0x312052)this[_0xbda0('0x15')](_0xbda0('0x16'),null);this[_0xbda0('0x15')](_0xbda0('0x17'),_0x312052);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 23ef761..f80f1cf 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 _0x30a8=['exten','localstationid','app','system','description','Fax\x20Extension','priority','push','CDR(type)=inbound-fax','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','transaction','get','VoiceExtension','bulkCreate','updateAccountApplications','createdAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','CmContact','Contacts','updatedAt','DESC','attachments','join','root','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','count','offset','status','set','apply','reject','save','destroy','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','pick','merge','where','VIRTUAL','filter','options','FaxAccount','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','FaxApplication','findAndCountAll','getApplications','context'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x30a8,0x104));var _0x830a=function(_0x3c4be2,_0x1e6876){_0x3c4be2=_0x3c4be2-0x0;var _0x3e5222=_0x30a8[_0x3c4be2];return _0x3e5222;};'use strict';var pdf=require(_0x830a('0x0'));var emlformat=require(_0x830a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x830a('0x2'));var jsonpatch=require(_0x830a('0x3'));var rp=require(_0x830a('0x4'));var moment=require(_0x830a('0x5'));var BPromise=require(_0x830a('0x6'));var Mustache=require('mustache');var util=require(_0x830a('0x7'));var path=require(_0x830a('0x8'));var sox=require(_0x830a('0x9'));var csv=require(_0x830a('0xa'));var ejs=require(_0x830a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x830a('0xc'));var crypto=require(_0x830a('0xd'));var jsforce=require(_0x830a('0xe'));var deskjs=require(_0x830a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x830a('0x10'));var Redis=require(_0x830a('0x11'));var authService=require(_0x830a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x830a('0x13'));var hardwareService=require(_0x830a('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x830a('0x15'));var db=require(_0x830a('0x16'))['db'];config[_0x830a('0x17')]=_[_0x830a('0x18')](config[_0x830a('0x17')],{'host':_0x830a('0x19'),'port':0x18eb});var socket=require(_0x830a('0x1a'))(new Redis(config[_0x830a('0x17')]));require(_0x830a('0x1b'))['register'](socket);var jayson=require(_0x830a('0x1c'));var client=jayson[_0x830a('0x1d')][_0x830a('0x1e')]({'port':0x232c});var client9002=jayson[_0x830a('0x1d')][_0x830a('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1ebfe8,_0x4c41d0,_0x474387){if(_0x474387){var _0x51c74a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51c74a[_0x830a('0x1f')](_0x4c41d0)){return _0x1ebfe8;}else{throw new db[(_0x830a('0x20'))]['ValidationError'](_0x830a('0x21'));}}else{return _0x1ebfe8;}}function respondWithRpcPromise(_0x39dc7c,_0x1c9933,_0x5642b0,_0x2dafa3){return new BPromise(function(_0x2ee224,_0x524fbf){var _0xb8bcb3=_0x2dafa3||client;return _0xb8bcb3[_0x830a('0x22')](_0x39dc7c,_0x5642b0)[_0x830a('0x23')](function(_0x269ed9){logger[_0x830a('0x24')]('FaxAccount,\x20%s,\x20%s',_0x1c9933,_0x830a('0x25'));logger[_0x830a('0x26')](_0x830a('0x27'),_0x1c9933,'request\x20sent',JSON[_0x830a('0x28')](_0x269ed9));if(_0x269ed9[_0x830a('0x29')]){if(_0x269ed9[_0x830a('0x29')][_0x830a('0x2a')]===0x1f4){logger[_0x830a('0x29')](_0x830a('0x2b'),_0x1c9933,_0x269ed9['error'][_0x830a('0x2c')]);return _0x524fbf(_0x269ed9['error'][_0x830a('0x2c')]);}logger['error'](_0x830a('0x2b'),_0x1c9933,_0x269ed9[_0x830a('0x29')]['message']);return _0x2ee224(_0x269ed9[_0x830a('0x29')][_0x830a('0x2c')]);}else{logger['info'](_0x830a('0x2b'),_0x1c9933,_0x830a('0x25'));_0x2ee224(_0x269ed9[_0x830a('0x2d')]['message']);}})[_0x830a('0x2e')](function(_0x5ce252){logger[_0x830a('0x29')](_0x830a('0x2b'),_0x1c9933,_0x5ce252);_0x524fbf(_0x5ce252);});});}function respondWithStatusCode(_0x152edc,_0x1e1577){_0x1e1577=_0x1e1577||0xcc;return function(_0x4c9480){if(_0x4c9480){return _0x152edc[_0x830a('0x2f')](_0x1e1577);}return _0x152edc['status'](_0x1e1577)[_0x830a('0x30')]();};}function respondWithResult(_0x750638,_0x2e51c1){_0x2e51c1=_0x2e51c1||0xc8;return function(_0x132e4b){if(_0x132e4b){return _0x750638['status'](_0x2e51c1)[_0x830a('0x31')](_0x132e4b);}};}function respondWithFilteredResult(_0x19f29c,_0x5e94f6){return function(_0x20ea68){if(_0x20ea68){var _0x4b1ed1=_0x20ea68[_0x830a('0x32')],_0xfd37fa=_0x5e94f6[_0x830a('0x33')],_0x31e7a2=_0x5e94f6['offset']+_0x5e94f6['limit'],_0x26c41c;if(_0x31e7a2>=_0x4b1ed1){_0x31e7a2=_0x4b1ed1;_0x26c41c=0xc8;}else{_0x26c41c=0xce;}_0x19f29c[_0x830a('0x34')](_0x26c41c);return _0x19f29c[_0x830a('0x35')]('Content-Range',_0xfd37fa+'-'+_0x31e7a2+'/'+_0x4b1ed1)[_0x830a('0x31')](_0x20ea68);}return null;};}function patchUpdates(_0x10bcdf){return function(_0x1f8ed2){try{jsonpatch[_0x830a('0x36')](_0x1f8ed2,_0x10bcdf,!![]);}catch(_0x2c1abd){return BPromise[_0x830a('0x37')](_0x2c1abd);}return _0x1f8ed2[_0x830a('0x38')]();};}function saveUpdates(_0x361142,_0x2c1c1a){return function(_0x459fa6){if(_0x459fa6){return _0x459fa6['update'](_0x361142)[_0x830a('0x23')](function(_0x2e6c20){return _0x2e6c20;});}return null;};}function removeEntity(_0x208aa3,_0x14a4a9){return function(_0x3083c1){if(_0x3083c1){return _0x3083c1[_0x830a('0x39')]()['then'](function(){var _0x1ace1f=_0x3083c1['get']({'plain':!![]});var _0x186b38='FaxAccounts';return db[_0x830a('0x3a')][_0x830a('0x39')]({'where':{'type':_0x186b38,'resourceId':_0x1ace1f['id']}})[_0x830a('0x23')](function(){return _0x3083c1;});})[_0x830a('0x23')](function(){_0x208aa3[_0x830a('0x34')](0xcc)[_0x830a('0x30')]();});}};}function handleEntityNotFound(_0x100c2a,_0x38e920){return function(_0x365d9c){if(!_0x365d9c){_0x100c2a['sendStatus'](0x194);}return _0x365d9c;};}function handleError(_0x100646,_0x3d642d){_0x3d642d=_0x3d642d||0x1f4;return function(_0x38a983){logger[_0x830a('0x29')](_0x38a983[_0x830a('0x3b')]);if(_0x38a983[_0x830a('0x3c')]){delete _0x38a983['name'];}_0x100646[_0x830a('0x34')](_0x3d642d)['send'](_0x38a983);};}exports['index']=function(_0x3bc2e3,_0x7c12c9){var _0x208ff0={'include':[{'model':db[_0x830a('0x3d')],'as':_0x830a('0x3e')}]},_0x44bfe8={},_0x8d4702={'count':0x0,'rows':[]};var _0xb3bdb1=_[_0x830a('0x3f')](db['FaxAccount'][_0x830a('0x40')],function(_0xd1f5ac){return{'name':_0xd1f5ac['fieldName'],'type':_0xd1f5ac[_0x830a('0x41')][_0x830a('0x42')]};});_0x44bfe8[_0x830a('0x43')]=_[_0x830a('0x3f')](_0xb3bdb1,_0x830a('0x3c'));_0x44bfe8[_0x830a('0x44')]=_[_0x830a('0x45')](_0x3bc2e3[_0x830a('0x44')]);_0x44bfe8[_0x830a('0x46')]=_[_0x830a('0x47')](_0x44bfe8[_0x830a('0x43')],_0x44bfe8[_0x830a('0x44')]);_0x208ff0['attributes']=_[_0x830a('0x47')](_0x44bfe8['model'],qs[_0x830a('0x48')](_0x3bc2e3[_0x830a('0x44')][_0x830a('0x48')]));_0x208ff0[_0x830a('0x49')]=_0x208ff0[_0x830a('0x49')][_0x830a('0x4a')]?_0x208ff0[_0x830a('0x49')]:_0x44bfe8[_0x830a('0x43')];if(!_0x3bc2e3[_0x830a('0x44')]['hasOwnProperty']('nolimit')){_0x208ff0[_0x830a('0x4b')]=qs['limit'](_0x3bc2e3['query'][_0x830a('0x4b')]);_0x208ff0[_0x830a('0x33')]=qs[_0x830a('0x33')](_0x3bc2e3[_0x830a('0x44')][_0x830a('0x33')]);}_0x208ff0[_0x830a('0x4c')]=qs[_0x830a('0x4d')](_0x3bc2e3['query'][_0x830a('0x4d')]);_0x208ff0['where']=qs[_0x830a('0x46')](_[_0x830a('0x4e')](_0x3bc2e3[_0x830a('0x44')],_0x44bfe8[_0x830a('0x46')]),_0xb3bdb1);if(_0x3bc2e3[_0x830a('0x44')]['filter']){_0x208ff0['where']=_[_0x830a('0x4f')](_0x208ff0[_0x830a('0x50')],{'$or':_[_0x830a('0x3f')](_0xb3bdb1,function(_0x4e6517){if(_0x4e6517[_0x830a('0x41')]!==_0x830a('0x51')){var _0x5de516={};_0x5de516[_0x4e6517[_0x830a('0x3c')]]={'$like':'%'+_0x3bc2e3[_0x830a('0x44')][_0x830a('0x52')]+'%'};return _0x5de516;}})});}_0x208ff0=_[_0x830a('0x4f')]({},_0x208ff0,_0x3bc2e3[_0x830a('0x53')]);var _0x22d7c4={'where':_0x208ff0[_0x830a('0x50')]};return db[_0x830a('0x54')]['count'](_0x22d7c4)[_0x830a('0x23')](function(_0x5dbdbf){_0x8d4702['count']=_0x5dbdbf;if(_0x3bc2e3[_0x830a('0x44')][_0x830a('0x55')]){_0x208ff0[_0x830a('0x56')]=[{'all':!![]}];}return db['FaxAccount'][_0x830a('0x57')](_0x208ff0);})['then'](function(_0xeedbb3){_0x8d4702[_0x830a('0x58')]=_0xeedbb3;return _0x8d4702;})['then'](respondWithFilteredResult(_0x7c12c9,_0x208ff0))[_0x830a('0x2e')](handleError(_0x7c12c9,null));};exports[_0x830a('0x59')]=function(_0x515e28,_0x516fe0){var _0x3f161d={'raw':![],'where':{'id':_0x515e28[_0x830a('0x5a')]['id']},'include':[{'model':db[_0x830a('0x3d')],'as':'mandatoryDispositionPause'}]},_0x3cfdc3={};_0x3cfdc3[_0x830a('0x43')]=_['keys'](db[_0x830a('0x54')][_0x830a('0x40')]);_0x3cfdc3[_0x830a('0x44')]=_['keys'](_0x515e28[_0x830a('0x44')]);_0x3cfdc3['filters']=_[_0x830a('0x47')](_0x3cfdc3[_0x830a('0x43')],_0x3cfdc3[_0x830a('0x44')]);_0x3f161d['attributes']=_[_0x830a('0x47')](_0x3cfdc3[_0x830a('0x43')],qs[_0x830a('0x48')](_0x515e28[_0x830a('0x44')]['fields']));_0x3f161d['attributes']=_0x3f161d[_0x830a('0x49')][_0x830a('0x4a')]?_0x3f161d[_0x830a('0x49')]:_0x3cfdc3[_0x830a('0x43')];if(_0x515e28[_0x830a('0x44')]['includeAll']){_0x3f161d[_0x830a('0x56')]=[{'all':!![]}];}_0x3f161d=_[_0x830a('0x4f')]({},_0x3f161d,_0x515e28[_0x830a('0x53')]);return db[_0x830a('0x54')][_0x830a('0x5b')](_0x3f161d)[_0x830a('0x23')](handleEntityNotFound(_0x516fe0,null))['then'](respondWithResult(_0x516fe0,null))[_0x830a('0x2e')](handleError(_0x516fe0,null));};exports[_0x830a('0x5c')]=function(_0x65b115,_0x538f03){return db[_0x830a('0x54')]['create'](_0x65b115[_0x830a('0x5d')],{})[_0x830a('0x23')](function(_0x10dfdc){var _0x3be41a=_0x65b115[_0x830a('0x5e')]['get']({'plain':!![]});if(!_0x3be41a)throw new Error(_0x830a('0x5f'));if(_0x3be41a[_0x830a('0x60')]===_0x830a('0x5e')){var _0x4da053=_0x10dfdc['get']({'plain':!![]});var _0x209a4a=_0x830a('0x61');return db['UserProfileSection'][_0x830a('0x5b')]({'where':{'name':_0x209a4a,'userProfileId':_0x3be41a['userProfileId']},'raw':!![]})[_0x830a('0x23')](function(_0x29c2c0){if(_0x29c2c0&&_0x29c2c0[_0x830a('0x62')]===0x0){return db[_0x830a('0x3a')][_0x830a('0x5c')]({'name':_0x4da053[_0x830a('0x3c')],'resourceId':_0x4da053['id'],'type':_0x29c2c0[_0x830a('0x3c')],'sectionId':_0x29c2c0['id']},{})[_0x830a('0x23')](function(){return _0x10dfdc;});}else{return _0x10dfdc;}})[_0x830a('0x2e')](function(_0x49feea){logger[_0x830a('0x29')](_0x830a('0x63'),_0x49feea);throw _0x49feea;});}return _0x10dfdc;})[_0x830a('0x23')](respondWithResult(_0x538f03,0xc9))[_0x830a('0x2e')](handleError(_0x538f03,null));};exports[_0x830a('0x64')]=function(_0x5112ce,_0x4ce590){if(_0x5112ce[_0x830a('0x5d')]['id']){delete _0x5112ce[_0x830a('0x5d')]['id'];}return db[_0x830a('0x54')][_0x830a('0x5b')]({'where':{'id':_0x5112ce[_0x830a('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x830a('0x3e')}]})[_0x830a('0x23')](handleEntityNotFound(_0x4ce590,null))[_0x830a('0x23')](saveUpdates(_0x5112ce['body'],null))['then'](respondWithResult(_0x4ce590,null))[_0x830a('0x2e')](handleError(_0x4ce590,null));};exports[_0x830a('0x39')]=function(_0xeb8846,_0x4f3604){return db[_0x830a('0x54')][_0x830a('0x5b')]({'where':{'id':_0xeb8846[_0x830a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4f3604,null))['then'](removeEntity(_0x4f3604,null))['catch'](handleError(_0x4f3604,null));};exports['describe']=function(_0x1106e6,_0x8678dc){return db[_0x830a('0x54')]['describe']()[_0x830a('0x23')](respondWithResult(_0x8678dc,null))[_0x830a('0x2e')](handleError(_0x8678dc,null));};exports['addDisposition']=function(_0x2e9b4d,_0x3b968a,_0x2f4080){if(_0x2e9b4d[_0x830a('0x5d')]['id']){delete _0x2e9b4d[_0x830a('0x5d')]['id'];}return db['FaxAccount'][_0x830a('0x5b')]({'where':{'id':_0x2e9b4d[_0x830a('0x5a')]['id']}})[_0x830a('0x23')](handleEntityNotFound(_0x3b968a,null))[_0x830a('0x23')](function(_0x5a4a02){if(_0x5a4a02){_0x2e9b4d['body'][_0x830a('0x65')]=_0x5a4a02['id'];return db[_0x830a('0x66')][_0x830a('0x5c')](_0x2e9b4d[_0x830a('0x5d')]);}})[_0x830a('0x23')](respondWithResult(_0x3b968a,null))[_0x830a('0x2e')](handleError(_0x3b968a,null));};exports[_0x830a('0x67')]=function(_0x550acd,_0x230489,_0x156d46){var _0x3bde29={'raw':![],'where':{}};var _0x150901={};var _0x345e50={'count':0x0,'rows':[]};return db[_0x830a('0x54')][_0x830a('0x68')]({'where':{'id':_0x550acd[_0x830a('0x5a')]['id']}})[_0x830a('0x23')](handleEntityNotFound(_0x230489,null))[_0x830a('0x23')](function(_0x25b3dc){if(_0x25b3dc){_0x150901['model']=_[_0x830a('0x45')](db[_0x830a('0x66')]['rawAttributes']);_0x150901[_0x830a('0x44')]=_['keys'](_0x550acd[_0x830a('0x44')]);_0x150901[_0x830a('0x46')]=_[_0x830a('0x47')](_0x150901[_0x830a('0x43')],_0x150901[_0x830a('0x44')]);_0x3bde29[_0x830a('0x49')]=_['intersection'](_0x150901[_0x830a('0x43')],qs[_0x830a('0x48')](_0x550acd[_0x830a('0x44')][_0x830a('0x48')]));_0x3bde29['attributes']=_0x3bde29[_0x830a('0x49')][_0x830a('0x4a')]?_0x3bde29[_0x830a('0x49')]:_0x150901['model'];if(!_0x550acd[_0x830a('0x44')]['hasOwnProperty'](_0x830a('0x69'))){_0x3bde29['limit']=qs[_0x830a('0x4b')](_0x550acd['query']['limit']);_0x3bde29['offset']=qs[_0x830a('0x33')](_0x550acd[_0x830a('0x44')][_0x830a('0x33')]);}_0x3bde29['order']=qs[_0x830a('0x4d')](_0x550acd[_0x830a('0x44')][_0x830a('0x4d')]);_0x3bde29['where']=qs[_0x830a('0x46')](_[_0x830a('0x4e')](_0x550acd['query'],_0x150901[_0x830a('0x46')]));_0x3bde29[_0x830a('0x50')][_0x830a('0x65')]=_0x25b3dc['id'];if(_0x550acd[_0x830a('0x44')][_0x830a('0x52')]){_0x3bde29[_0x830a('0x50')]=_[_0x830a('0x4f')](_0x3bde29[_0x830a('0x50')],{'$or':_['map'](_0x3bde29[_0x830a('0x49')],function(_0x378664){var _0x1f3da0={};_0x1f3da0[_0x378664]={'$like':'%'+_0x550acd[_0x830a('0x44')][_0x830a('0x52')]+'%'};return _0x1f3da0;})});}_0x3bde29=_[_0x830a('0x4f')]({},_0x3bde29,_0x550acd[_0x830a('0x53')]);return db[_0x830a('0x66')][_0x830a('0x32')]({'where':_0x3bde29['where']})['then'](function(_0x3efb39){_0x345e50[_0x830a('0x32')]=_0x3efb39;if(_0x550acd['query'][_0x830a('0x55')]){_0x3bde29[_0x830a('0x56')]=[{'all':!![]}];}return db[_0x830a('0x66')][_0x830a('0x57')](_0x3bde29);})[_0x830a('0x23')](function(_0x31ead3){_0x345e50[_0x830a('0x58')]=_0x31ead3;return _0x345e50;});}})['then'](respondWithFilteredResult(_0x230489,_0x3bde29))['catch'](handleError(_0x230489,null));};exports['removeDispositions']=function(_0x13ca8c,_0x7cdb52,_0x55d497){return db[_0x830a('0x54')]['find']({'where':{'id':_0x13ca8c[_0x830a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x7cdb52,null))[_0x830a('0x23')](function(_0x1bbacf){if(_0x1bbacf){return _0x1bbacf[_0x830a('0x6a')](_0x13ca8c['query'][_0x830a('0x6b')]);}})['then'](respondWithStatusCode(_0x7cdb52,null))['catch'](handleError(_0x7cdb52,null));};exports[_0x830a('0x6c')]=function(_0x322827,_0x398e74,_0x4a8bbc){if(_0x322827[_0x830a('0x5d')]['id']){delete _0x322827[_0x830a('0x5d')]['id'];}return db[_0x830a('0x54')][_0x830a('0x5b')]({'where':{'id':_0x322827[_0x830a('0x5a')]['id']}})[_0x830a('0x23')](handleEntityNotFound(_0x398e74,null))['then'](function(_0x3059b2){if(_0x3059b2){_0x322827[_0x830a('0x5d')]['FaxAccountId']=_0x3059b2['id'];return db[_0x830a('0x6d')][_0x830a('0x5c')](_0x322827[_0x830a('0x5d')]);}})[_0x830a('0x23')](respondWithResult(_0x398e74,null))[_0x830a('0x2e')](handleError(_0x398e74,null));};exports[_0x830a('0x6e')]=function(_0x2d639d,_0x4b46b4,_0x19b410){var _0x4d5f15={'raw':![],'where':{}};var _0x22f9d7={};var _0xe90bb5={'count':0x0,'rows':[]};return db[_0x830a('0x54')][_0x830a('0x68')]({'where':{'id':_0x2d639d[_0x830a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4b46b4,null))[_0x830a('0x23')](function(_0x325805){if(_0x325805){_0x22f9d7[_0x830a('0x43')]=_['keys'](db[_0x830a('0x6d')][_0x830a('0x40')]);_0x22f9d7[_0x830a('0x44')]=_[_0x830a('0x45')](_0x2d639d[_0x830a('0x44')]);_0x22f9d7[_0x830a('0x46')]=_['intersection'](_0x22f9d7['model'],_0x22f9d7[_0x830a('0x44')]);_0x4d5f15[_0x830a('0x49')]=_[_0x830a('0x47')](_0x22f9d7[_0x830a('0x43')],qs[_0x830a('0x48')](_0x2d639d[_0x830a('0x44')][_0x830a('0x48')]));_0x4d5f15[_0x830a('0x49')]=_0x4d5f15[_0x830a('0x49')][_0x830a('0x4a')]?_0x4d5f15['attributes']:_0x22f9d7['model'];if(!_0x2d639d[_0x830a('0x44')][_0x830a('0x6f')](_0x830a('0x69'))){_0x4d5f15['limit']=qs[_0x830a('0x4b')](_0x2d639d[_0x830a('0x44')][_0x830a('0x4b')]);_0x4d5f15[_0x830a('0x33')]=qs[_0x830a('0x33')](_0x2d639d[_0x830a('0x44')]['offset']);}_0x4d5f15[_0x830a('0x4c')]=qs['sort'](_0x2d639d[_0x830a('0x44')][_0x830a('0x4d')]);_0x4d5f15[_0x830a('0x50')]=qs[_0x830a('0x46')](_['pick'](_0x2d639d['query'],_0x22f9d7[_0x830a('0x46')]));_0x4d5f15[_0x830a('0x50')]['FaxAccountId']=_0x325805['id'];if(_0x2d639d[_0x830a('0x44')][_0x830a('0x52')]){_0x4d5f15[_0x830a('0x50')]=_['merge'](_0x4d5f15[_0x830a('0x50')],{'$or':_[_0x830a('0x3f')](_0x4d5f15[_0x830a('0x49')],function(_0x36ac8f){var _0x1c83f8={};_0x1c83f8[_0x36ac8f]={'$like':'%'+_0x2d639d[_0x830a('0x44')][_0x830a('0x52')]+'%'};return _0x1c83f8;})});}_0x4d5f15=_[_0x830a('0x4f')]({},_0x4d5f15,_0x2d639d[_0x830a('0x53')]);return db[_0x830a('0x6d')]['count']({'where':_0x4d5f15[_0x830a('0x50')]})[_0x830a('0x23')](function(_0x2cc916){_0xe90bb5[_0x830a('0x32')]=_0x2cc916;if(_0x2d639d[_0x830a('0x44')][_0x830a('0x55')]){_0x4d5f15['include']=[{'all':!![]}];}return db[_0x830a('0x6d')][_0x830a('0x57')](_0x4d5f15);})[_0x830a('0x23')](function(_0x5b2817){_0xe90bb5[_0x830a('0x58')]=_0x5b2817;return _0xe90bb5;});}})[_0x830a('0x23')](respondWithFilteredResult(_0x4b46b4,_0x4d5f15))[_0x830a('0x2e')](handleError(_0x4b46b4,null));};exports[_0x830a('0x70')]=function(_0x35b30f,_0xd9d8d,_0xfa5b60){return db[_0x830a('0x54')][_0x830a('0x5b')]({'where':{'id':_0x35b30f[_0x830a('0x5a')]['id']}})['then'](handleEntityNotFound(_0xd9d8d,null))[_0x830a('0x23')](function(_0x1ac39c){if(_0x1ac39c){return _0x1ac39c[_0x830a('0x70')](_0x35b30f[_0x830a('0x44')][_0x830a('0x6b')]);}})[_0x830a('0x23')](respondWithStatusCode(_0xd9d8d,null))[_0x830a('0x2e')](handleError(_0xd9d8d,null));};exports[_0x830a('0x71')]=function(_0xcaeaa2,_0x52aae6,_0x4a73aa){return db[_0x830a('0x72')][_0x830a('0x5b')]({'where':{'id':_0xcaeaa2['params']['id']}})['then'](handleEntityNotFound(_0x52aae6,null))[_0x830a('0x23')](function(_0x5cb0e9){if(_0x5cb0e9){return _0x5cb0e9['addInteraction'](_0xcaeaa2[_0x830a('0x5d')][_0x830a('0x6b')],_[_0x830a('0x73')](_0xcaeaa2[_0x830a('0x5d')],['ids','id'])||{});}})[_0x830a('0x23')](respondWithResult(_0x52aae6,null))['catch'](handleError(_0x52aae6,null));};exports[_0x830a('0x74')]=function(_0x477759,_0x454a14,_0x701f33){var _0x2fa4ec={'raw':![],'where':{}};var _0x173328={};var _0x78c4b4={'count':0x0,'rows':[]};return db[_0x830a('0x54')][_0x830a('0x68')]({'where':{'id':_0x477759[_0x830a('0x5a')]['id']}})[_0x830a('0x23')](handleEntityNotFound(_0x454a14,null))['then'](function(_0x4b3e47){if(_0x4b3e47){_0x173328[_0x830a('0x43')]=_[_0x830a('0x45')](db[_0x830a('0x72')][_0x830a('0x40')]);_0x173328[_0x830a('0x44')]=_['keys'](_0x477759[_0x830a('0x44')]);_0x173328['filters']=_[_0x830a('0x47')](_0x173328['model'],_0x173328[_0x830a('0x44')]);_0x2fa4ec[_0x830a('0x49')]=_[_0x830a('0x47')](_0x173328['model'],qs[_0x830a('0x48')](_0x477759[_0x830a('0x44')][_0x830a('0x48')]));_0x2fa4ec[_0x830a('0x49')]=_0x2fa4ec[_0x830a('0x49')]['length']?_0x2fa4ec[_0x830a('0x49')]:_0x173328[_0x830a('0x43')];if(!_0x477759['query'][_0x830a('0x6f')](_0x830a('0x69'))){_0x2fa4ec[_0x830a('0x4b')]=qs['limit'](_0x477759['query']['limit']);_0x2fa4ec[_0x830a('0x33')]=qs[_0x830a('0x33')](_0x477759[_0x830a('0x44')]['offset']);}_0x2fa4ec[_0x830a('0x4c')]=qs['sort'](_0x477759[_0x830a('0x44')][_0x830a('0x4d')]);_0x2fa4ec['where']=qs[_0x830a('0x46')](_[_0x830a('0x4e')](_0x477759[_0x830a('0x44')],_0x173328[_0x830a('0x46')]));_0x2fa4ec[_0x830a('0x50')]['FaxAccountId']=_0x4b3e47['id'];if(_0x477759[_0x830a('0x44')][_0x830a('0x52')]){_0x2fa4ec[_0x830a('0x50')]=_[_0x830a('0x4f')](_0x2fa4ec[_0x830a('0x50')],{'$or':_[_0x830a('0x3f')](_0x2fa4ec[_0x830a('0x49')],function(_0x2df5ab){var _0x19e84e={};_0x19e84e[_0x2df5ab]={'$like':'%'+_0x477759[_0x830a('0x44')][_0x830a('0x52')]+'%'};return _0x19e84e;})});}_0x2fa4ec=_['merge']({},_0x2fa4ec,_0x477759['options']);return db[_0x830a('0x72')][_0x830a('0x32')]({'where':_0x2fa4ec[_0x830a('0x50')]})[_0x830a('0x23')](function(_0x4c1b77){_0x78c4b4[_0x830a('0x32')]=_0x4c1b77;if(_0x477759[_0x830a('0x44')][_0x830a('0x55')]){_0x2fa4ec[_0x830a('0x56')]=[{'model':db['CmContact'],'as':_0x830a('0x75'),'required':![]},{'model':db['User'],'as':_0x830a('0x76'),'attributes':[_0x830a('0x3c'),_0x830a('0x77'),_0x830a('0x78')],'required':![]},{'model':db[_0x830a('0x79')],'as':_0x830a('0x7a'),'attributes':['id',_0x830a('0x3c'),_0x830a('0x7b')],'where':_0x477759['query'][_0x830a('0x7c')]?{'id':_0x477759[_0x830a('0x44')][_0x830a('0x7c')]}:undefined,'required':_0x477759[_0x830a('0x44')][_0x830a('0x7c')]?!![]:![]}];}return db[_0x830a('0x72')]['findAll'](_0x2fa4ec);})['then'](function(_0x3558d9){_0x78c4b4[_0x830a('0x58')]=_0x3558d9;return _0x78c4b4;});}})['then'](respondWithFilteredResult(_0x454a14,_0x2fa4ec))[_0x830a('0x2e')](handleError(_0x454a14,null));};exports[_0x830a('0x7d')]=function(_0x2363a4,_0x3d33e9,_0x33a9b8){return db[_0x830a('0x54')][_0x830a('0x68')]({'where':{'id':_0x2363a4['params']['id']}})[_0x830a('0x23')](handleEntityNotFound(_0x3d33e9,null))[_0x830a('0x23')](function(_0x555379){if(_0x555379){return db['sequelize']['transaction'](function(_0x15f6d0){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x2363a4[_0x830a('0x5a')]['id']},'transaction':_0x15f6d0})[_0x830a('0x23')](function(_0x25d3ba){var _0x3781c4=_[_0x830a('0x3f')](_0x2363a4['body'],function(_0x42356e){_0x42356e[_0x830a('0x65')]=_0x2363a4['params']['id'];return _0x42356e;});return db[_0x830a('0x7e')]['bulkCreate'](_0x3781c4,{'transaction':_0x15f6d0});});})['then'](function(){return db[_0x830a('0x7e')][_0x830a('0x7f')]({'where':{'FaxAccountId':_0x2363a4[_0x830a('0x5a')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x3d33e9,null))[_0x830a('0x2e')](handleError(_0x3d33e9,null));};exports[_0x830a('0x80')]=function(_0x4638f7,_0x19ad56,_0x33aa01){var _0x1caae9={};var _0x52282a={};var _0x3afea6;var _0x2c07e6;return db[_0x830a('0x54')][_0x830a('0x68')]({'where':{'id':_0x4638f7[_0x830a('0x5a')]['id']}})[_0x830a('0x23')](handleEntityNotFound(_0x19ad56,null))[_0x830a('0x23')](function(_0x1d8d3a){if(_0x1d8d3a){_0x3afea6=_0x1d8d3a;_0x52282a['model']=_[_0x830a('0x45')](db[_0x830a('0x7e')][_0x830a('0x40')]);_0x52282a['query']=_['keys'](_0x4638f7['query']);_0x52282a[_0x830a('0x46')]=_[_0x830a('0x47')](_0x52282a[_0x830a('0x43')],_0x52282a['query']);_0x1caae9[_0x830a('0x49')]=_[_0x830a('0x47')](_0x52282a[_0x830a('0x43')],qs[_0x830a('0x48')](_0x4638f7['query']['fields']));_0x1caae9[_0x830a('0x49')]=_0x1caae9[_0x830a('0x49')][_0x830a('0x4a')]?_0x1caae9[_0x830a('0x49')]:_0x52282a['model'];_0x1caae9['order']=qs['sort'](_0x4638f7[_0x830a('0x44')][_0x830a('0x4d')]);_0x1caae9[_0x830a('0x50')]=qs[_0x830a('0x46')](_[_0x830a('0x4e')](_0x4638f7[_0x830a('0x44')],_0x52282a['filters']));if(_0x4638f7[_0x830a('0x44')][_0x830a('0x52')]){_0x1caae9[_0x830a('0x50')]=_[_0x830a('0x4f')](_0x1caae9[_0x830a('0x50')],{'$or':_[_0x830a('0x3f')](_0x1caae9[_0x830a('0x49')],function(_0x3e2cb8){var _0x4bcf39={};_0x4bcf39[_0x3e2cb8]={'$like':'%'+_0x4638f7['query'][_0x830a('0x52')]+'%'};return _0x4bcf39;})});}_0x1caae9=_[_0x830a('0x4f')]({},_0x1caae9,_0x4638f7[_0x830a('0x53')]);return _0x3afea6[_0x830a('0x80')](_0x1caae9);}})['then'](function(_0x3dc2ad){if(_0x3dc2ad){_0x2c07e6=_0x3dc2ad[_0x830a('0x4a')];if(!_0x4638f7['query'][_0x830a('0x6f')](_0x830a('0x69'))){_0x1caae9[_0x830a('0x4b')]=qs[_0x830a('0x4b')](_0x4638f7[_0x830a('0x44')][_0x830a('0x4b')]);_0x1caae9[_0x830a('0x33')]=qs[_0x830a('0x33')](_0x4638f7[_0x830a('0x44')][_0x830a('0x33')]);}return _0x3afea6[_0x830a('0x80')](_0x1caae9);}})[_0x830a('0x23')](function(_0x3eb676){if(_0x3eb676){return _0x3eb676?{'count':_0x2c07e6,'rows':_0x3eb676}:null;}})[_0x830a('0x23')](respondWithResult(_0x19ad56,null))[_0x830a('0x2e')](handleError(_0x19ad56,null));};function Extension(_0x1b3bc8,_0x45c3a9,_0x5c318b,_0x38c369){this[_0x830a('0x81')]='from-voip-provider';this[_0x830a('0x82')]=_0x1b3bc8[_0x830a('0x83')];this[_0x830a('0x84')]=_0x38c369;this[_0x830a('0x41')]=_0x830a('0x85');this[_0x830a('0x86')]=_0x830a('0x87');this[_0x830a('0x65')]=_0x1b3bc8['id'];this[_0x830a('0x88')]=_0x45c3a9;this['appdata']=_0x5c318b;}function createExtensionsReciveFax(_0xd5891){var _0x61513c=0x1;var _0x59c9ec=[];_0x59c9ec[_0x830a('0x89')](new Extension(_0xd5891,_0x61513c,'','Answer'));_0x61513c+=0x1;_0x59c9ec[_0x830a('0x89')](new Extension(_0xd5891,_0x61513c,_0x830a('0x8a'),'Set'));_0x61513c+=0x1;for(var _0x5e319a in _0xd5891){if(_0xd5891[_0x830a('0x6f')](_0x5e319a)&&(_0x5e319a===_0x830a('0x8b')||_0x5e319a===_0x830a('0x83')||_0x5e319a==='gateway'||_0x5e319a===_0x830a('0x8c')||_0x5e319a===_0x830a('0x8d')||_0x5e319a===_0x830a('0x8e')||_0x5e319a===_0x830a('0x8f')||_0x5e319a===_0x830a('0x90')||_0x5e319a===_0x830a('0x91'))){_0x59c9ec[_0x830a('0x89')](new Extension(_0xd5891,_0x61513c,'FAXOPT('+_0x5e319a+')='+_0xd5891[_0x5e319a],_0x830a('0x92')));_0x61513c+=0x1;}}_0x59c9ec[_0x830a('0x89')](new Extension(_0xd5891,_0x61513c,'6',_0x830a('0x93')));_0x61513c+=0x1;_0x59c9ec[_0x830a('0x89')](new Extension(_0xd5891,_0x61513c,_0x830a('0x94'),_0x830a('0x95')));_0x61513c=0x0;return _0x59c9ec;}exports[_0x830a('0x96')]=function(_0x432354,_0x5a9408,_0xedfcd9){var _0x177ba3;return db[_0x830a('0x97')][_0x830a('0x98')](function(_0x58bac1){return db[_0x830a('0x54')][_0x830a('0x5c')](_0x432354[_0x830a('0x5d')],{'transaction':_0x58bac1})[_0x830a('0x23')](function(_0x41212d){_0x177ba3=_0x41212d[_0x830a('0x99')]({'plain':!![]});return db[_0x830a('0x9a')][_0x830a('0x9b')](createExtensionsReciveFax(_0x177ba3),{'transaction':_0x58bac1});});})[_0x830a('0x23')](function(){return _0x177ba3;})['then'](respondWithResult(_0x5a9408,null))['catch'](handleError(_0x5a9408,null));};exports[_0x830a('0x9c')]=function(_0x338218,_0x1500ab,_0x15aac1){var _0xafae3;return db['sequelize'][_0x830a('0x98')](function(_0x54af05){return db[_0x830a('0x54')]['update'](_0x338218['body'],{'where':{'id':_0x338218[_0x830a('0x5d')]['id']},'transaction':_0x54af05})[_0x830a('0x23')](function(_0x55e996){return db[_0x830a('0x9a')][_0x830a('0x39')]({'where':{'FaxAccountId':_0x338218[_0x830a('0x5d')]['id']},'transaction':_0x54af05})['then'](function(_0x414481){return db['VoiceExtension'][_0x830a('0x9b')](createExtensionsReciveFax(_[_0x830a('0x73')](_0x338218['body'],['tech',_0x830a('0x42'),_0x830a('0x9d'),'updatedAt','TrunkId',_0x830a('0x9e')])),{'transaction':_0x54af05});});});})['then'](function(){return db[_0x830a('0x54')][_0x830a('0x9f')](_0x338218[_0x830a('0x5d')]['id']);})[_0x830a('0x23')](respondWithResult(_0x1500ab,null))['catch'](handleError(_0x1500ab,null));};exports[_0x830a('0xa0')]=function(_0x56bffc,_0x56f028,_0x470a18){var _0x570508={'raw':!![],'where':{}};var _0x1c2c09={};var _0x19c6a9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x830a('0x68')]({'where':{'id':_0x56bffc[_0x830a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x56f028,null))[_0x830a('0x23')](function(_0x510ea0){if(_0x510ea0){_0x1c2c09[_0x830a('0x43')]=_[_0x830a('0x45')](db[_0x830a('0xa1')][_0x830a('0x40')]);_0x1c2c09[_0x830a('0x44')]=_[_0x830a('0x45')](_0x56bffc[_0x830a('0x44')]);_0x1c2c09[_0x830a('0x46')]=_[_0x830a('0x47')](_0x1c2c09['model'],_0x1c2c09['query']);_0x570508[_0x830a('0x49')]=_[_0x830a('0x47')](_0x1c2c09[_0x830a('0x43')],qs[_0x830a('0x48')](_0x56bffc[_0x830a('0x44')]['fields']));_0x570508[_0x830a('0x49')]=_0x570508['attributes'][_0x830a('0x4a')]?_0x570508[_0x830a('0x49')]:_0x1c2c09[_0x830a('0x43')];if(!_0x56bffc[_0x830a('0x44')]['hasOwnProperty'](_0x830a('0x69'))){_0x570508[_0x830a('0x4b')]=qs[_0x830a('0x4b')](_0x56bffc['query']['limit']);_0x570508[_0x830a('0x33')]=qs['offset'](_0x56bffc[_0x830a('0x44')][_0x830a('0x33')]);}_0x570508[_0x830a('0x4c')]=qs[_0x830a('0x4d')](_0x56bffc[_0x830a('0x44')]['sort']);_0x570508[_0x830a('0x50')]=qs['filters'](_['pick'](_0x56bffc[_0x830a('0x44')],_0x1c2c09[_0x830a('0x46')]));_0x570508[_0x830a('0x50')][_0x830a('0x65')]=_0x510ea0['id'];if(_0x56bffc['query'][_0x830a('0x52')]){_0x570508[_0x830a('0x50')]=_[_0x830a('0x4f')](_0x570508[_0x830a('0x50')],{'$or':_[_0x830a('0x3f')](_0x570508[_0x830a('0x49')],function(_0x5c12ce){var _0x2a3274={};_0x2a3274[_0x5c12ce]={'$like':'%'+_0x56bffc[_0x830a('0x44')]['filter']+'%'};return _0x2a3274;})});}if(_0x56bffc[_0x830a('0x44')][_0x830a('0xa2')]){var _0xaf1a29=_0x56bffc['query'][_0x830a('0xa2')][_0x830a('0xa3')](',');var _0x2beaef={};_0x2beaef[_0xaf1a29[0x0]]={'$gte':moment(_0xaf1a29[0x1])[_0x830a('0xa4')](_0x830a('0xa5'))};_0x570508[_0x830a('0x50')]=_[_0x830a('0x4f')](_0x570508[_0x830a('0x50')],_0x2beaef);}_0x570508=_[_0x830a('0x4f')]({},_0x570508,_0x56bffc[_0x830a('0x53')]);return db[_0x830a('0xa1')][_0x830a('0x32')]({'where':_0x570508[_0x830a('0x50')]})[_0x830a('0x23')](function(_0x56296d){_0x19c6a9[_0x830a('0x32')]=_0x56296d;if(_0x56bffc[_0x830a('0x44')][_0x830a('0x55')]){_0x570508[_0x830a('0x56')]=[{'all':!![]}];}return db[_0x830a('0xa1')][_0x830a('0x57')](_0x570508);})['then'](function(_0x41183d){_0x19c6a9[_0x830a('0x58')]=_0x41183d;return _0x19c6a9;});}})[_0x830a('0x23')](respondWithFilteredResult(_0x56f028,_0x570508))[_0x830a('0x2e')](handleError(_0x56f028,null));};exports[_0x830a('0xa6')]=function(_0x4f4965,_0x346990,_0x1e6143){var _0x2a8417,_0x4d6e7c={},_0x12a697;if(_0x4f4965['body']['to']){_0x12a697=_0x4f4965[_0x830a('0x5d')]['to'][0x0];}return db[_0x830a('0x54')][_0x830a('0x5b')]({'where':{'id':_0x4f4965[_0x830a('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x830a('0xa7'),'include':[{'model':db[_0x830a('0xa8')],'as':_0x830a('0xa9'),'where':{'fax':_0x12a697},'limit':0x1,'order':[[_0x830a('0xaa'),_0x830a('0xab')]]}]}]})[_0x830a('0x23')](handleEntityNotFound(_0x346990,null))[_0x830a('0x23')](function(_0x17c738){_0x2a8417=_0x17c738;if(_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')]&&_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][_0x830a('0x4a')]){for(var _0x12b8c9=0x0;_0x12b8c9<_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][_0x830a('0x4a')];_0x12b8c9+=0x1){_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][_0x12b8c9]={'filename':_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][_0x12b8c9][_0x830a('0x3c')],'id':_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][_0x12b8c9]['id'],'path':path[_0x830a('0xad')](config[_0x830a('0xae')],'server/files/attachments',_0x4f4965[_0x830a('0x5d')]['attachments'][_0x12b8c9]['basename'])};}}return respondWithRpcPromise(_0x830a('0xaf'),_0x830a('0xaf'),{'FaxAccountId':_[_0x830a('0xb0')](_0x4f4965[_0x830a('0x5a')]['id'])?undefined:_0x4f4965[_0x830a('0x5a')]['id'],'path':_[_0x830a('0xb0')](_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][0x0][_0x830a('0x8')])?undefined:_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][0x0][_0x830a('0x8')],'fax':_[_0x830a('0xb0')](_0x4f4965[_0x830a('0x5d')]['to'][0x0])?undefined:_0x4f4965[_0x830a('0x5d')]['to'][0x0]},client9002);})['then'](function(){if(_0x2a8417){if(_['isNil'](_0x4f4965[_0x830a('0x5d')][_0x830a('0xb1')])){_0x4f4965['body']['from']=util['format'](_0x830a('0xb2'),_0x2a8417['name'],_0x2a8417[_0x830a('0xb3')]);}if(_0x2a8417[_0x830a('0xa7')]){if(_0x2a8417[_0x830a('0xa7')]['Contacts'][_0x830a('0x4a')]){return _0x2a8417[_0x830a('0xa7')]['Contacts'][0x0];}else{return db[_0x830a('0xa8')][_0x830a('0x5c')](_[_0x830a('0x18')](_0x4f4965[_0x830a('0x5d')],{'firstName':_0x4f4965[_0x830a('0x5d')]['to'][0x0],'phone':_0x4f4965[_0x830a('0x5d')]['to'][0x0],'fax':_0x4f4965['body']['to'][0x0],'ListId':_0x2a8417['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x830a('0xb4'));}})['then'](function(_0x249e7c){if(_0x249e7c){return db[_0x830a('0x72')]['find']({'where':{'ContactId':_0x249e7c['id'],'closed':![],'FaxAccountId':_0x2a8417['id']}})[_0x830a('0x23')](function(_0x15d58a){if(_0x15d58a){return[_0x15d58a,![]];}return db[_0x830a('0x72')][_0x830a('0x5c')]({'UserId':_0x4f4965['user']['id'],'ContactId':_0x249e7c['id'],'FaxAccountId':_0x2a8417['id'],'fax':_0x4f4965[_0x830a('0x5d')]['to'][0x0],'firstMsgDirection':_0x830a('0xb5'),'Messages':[_[_0x830a('0x4f')](_0x4f4965[_0x830a('0x5d')],{'read':![],'body':_0x4f4965['body'][_0x830a('0xac')][0x0][_0x830a('0xb6')],'FaxAccountId':_0x2a8417['id'],'UserId':_0x4f4965[_0x830a('0x5e')]['id'],'ContactId':_0x249e7c['id'],'AttachmentId':_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x830a('0xa1')],'as':_0x830a('0xb7')}]})[_0x830a('0x23')](function(_0x4c4682){return[_0x4c4682,!![]];});});}else{throw new Error(_0x830a('0xb8'));}})[_0x830a('0xb9')](function(_0x5cdc88,_0x48c68d){if(_0x48c68d){return _0x5cdc88;}return db[_0x830a('0xa1')][_0x830a('0x5c')]({'direction':_0x830a('0xb5'),'read':![],'body':_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][0x0][_0x830a('0xb6')],'FaxAccountId':_0x2a8417['id'],'FaxInteractionId':_0x5cdc88['id'],'UserId':_0x4f4965['user']['id'],'ContactId':_0x5cdc88['ContactId'],'AttachmentId':_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][0x0]['id']})[_0x830a('0x23')](function(_0x37ae53){_0x5cdc88[_0x830a('0xba')][_0x830a('0xb7')]=[];_0x5cdc88[_0x830a('0xba')][_0x830a('0xb7')]['push'](_0x37ae53[_0x830a('0xba')]);return _0x5cdc88;});})[_0x830a('0x23')](function(_0x3f00be){respondWithRpcPromise(_0x830a('0xbb'),_0x830a('0xbb'),{'FaxAccountId':_[_0x830a('0xb0')](_0x4f4965[_0x830a('0x5a')]['id'])?undefined:_0x4f4965[_0x830a('0x5a')]['id'],'path':_[_0x830a('0xb0')](_0x4f4965['body'][_0x830a('0xac')][0x0][_0x830a('0x8')])?undefined:_0x4f4965['body'][_0x830a('0xac')][0x0][_0x830a('0x8')],'fax':_[_0x830a('0xb0')](_0x4f4965[_0x830a('0x5d')]['to'][0x0])?undefined:_0x4f4965[_0x830a('0x5d')]['to'][0x0],'AttachmentId':_0x4f4965[_0x830a('0x5d')][_0x830a('0xac')][0x0]['id']},client9002)['then'](function(_0x571ee8){logger[_0x830a('0x24')](_0x830a('0xbc'),_0x571ee8);})[_0x830a('0x2e')](function(_0x372d7e){logger[_0x830a('0x24')](_0x830a('0xbc'),_0x372d7e);});return _0x3f00be;})[_0x830a('0x23')](respondWithResult(_0x346990,null))[_0x830a('0x2e')](handleError(_0x346990,null));};exports['addAgents']=function(_0xfd8bc7,_0xde6e5e,_0x378fe7){return db['FaxAccount']['find']({'where':{'id':_0xfd8bc7[_0x830a('0x5a')]['id']}})[_0x830a('0x23')](handleEntityNotFound(_0xde6e5e,null))[_0x830a('0x23')](function(_0x816cba){if(_0x816cba){return _0x816cba[_0x830a('0xbd')](_0xfd8bc7[_0x830a('0x5d')][_0x830a('0x6b')],_[_0x830a('0x73')](_0xfd8bc7[_0x830a('0x5d')],['ids','id'])||{})[_0x830a('0xb9')](function(_0x409b1a){for(var _0x6b2e99=0x0;_0x6b2e99<_0xfd8bc7[_0x830a('0x5d')][_0x830a('0x6b')][_0x830a('0x4a')];_0x6b2e99+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0xfd8bc7[_0x830a('0x5d')]['ids'][_0x6b2e99],'FaxAccountId':_0xfd8bc7['params']['id']});}return _0x409b1a;});}})[_0x830a('0x23')](respondWithResult(_0xde6e5e,null))[_0x830a('0x2e')](handleError(_0xde6e5e,null));};exports[_0x830a('0xbe')]=function(_0x42383e,_0x254e3d,_0x14990a){return db['FaxAccount']['find']({'where':{'id':_0x42383e['params']['id']}})[_0x830a('0x23')](handleEntityNotFound(_0x254e3d,null))[_0x830a('0x23')](function(_0x29a46e){if(_0x29a46e){return _0x29a46e['removeAgents'](_0x42383e[_0x830a('0x44')]['ids'])[_0x830a('0x23')](function(){if(_[_0x830a('0xbf')](_0x42383e[_0x830a('0x44')]['ids'])){for(var _0x471b1f=0x0;_0x471b1f<_0x42383e['query'][_0x830a('0x6b')][_0x830a('0x4a')];_0x471b1f+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x42383e['query'][_0x830a('0x6b')][_0x471b1f]),'FaxAccountId':Number(_0x42383e[_0x830a('0x5a')]['id'])});}}else{socket['emit'](_0x830a('0xc0'),{'UserId':Number(_0x42383e[_0x830a('0x44')]['ids']),'FaxAccountId':Number(_0x42383e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x254e3d,null))[_0x830a('0x2e')](handleError(_0x254e3d,null));};exports[_0x830a('0xc1')]=function(_0x172ade,_0x52ff2d,_0x5b47e9){var _0x43b203={};var _0xb7324d={};var _0xb56d0c;var _0x50a7f3;return db[_0x830a('0x54')][_0x830a('0x68')]({'where':{'id':_0x172ade[_0x830a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x52ff2d,null))[_0x830a('0x23')](function(_0x3ee0e3){if(_0x3ee0e3){_0xb56d0c=_0x3ee0e3;_0xb7324d[_0x830a('0x43')]=_[_0x830a('0x45')](db[_0x830a('0xc2')][_0x830a('0x40')]);_0xb7324d[_0x830a('0x44')]=_[_0x830a('0x45')](_0x172ade[_0x830a('0x44')]);_0xb7324d[_0x830a('0x46')]=_[_0x830a('0x47')](_0xb7324d['model'],_0xb7324d['query']);_0x43b203['attributes']=_[_0x830a('0x47')](_0xb7324d[_0x830a('0x43')],qs[_0x830a('0x48')](_0x172ade[_0x830a('0x44')][_0x830a('0x48')]));_0x43b203['attributes']=_0x43b203[_0x830a('0x49')][_0x830a('0x4a')]?_0x43b203[_0x830a('0x49')]:_0xb7324d['model'];_0x43b203['order']=qs['sort'](_0x172ade[_0x830a('0x44')][_0x830a('0x4d')]);_0x43b203[_0x830a('0x50')]=qs[_0x830a('0x46')](_[_0x830a('0x4e')](_0x172ade[_0x830a('0x44')],_0xb7324d[_0x830a('0x46')]));if(_0x172ade['query'][_0x830a('0x52')]){_0x43b203[_0x830a('0x50')]=_[_0x830a('0x4f')](_0x43b203[_0x830a('0x50')],{'$or':_['map'](_0x43b203[_0x830a('0x49')],function(_0x5596e5){var _0x53c00d={};_0x53c00d[_0x5596e5]={'$like':'%'+_0x172ade[_0x830a('0x44')][_0x830a('0x52')]+'%'};return _0x53c00d;})});}_0x43b203=_[_0x830a('0x4f')]({},_0x43b203,_0x172ade['options']);return _0xb56d0c['getAgents'](_0x43b203);}})[_0x830a('0x23')](function(_0x4f5d6c){if(_0x4f5d6c){_0x50a7f3=_0x4f5d6c[_0x830a('0x4a')];if(!_0x172ade['query']['hasOwnProperty'](_0x830a('0x69'))){_0x43b203[_0x830a('0x4b')]=qs[_0x830a('0x4b')](_0x172ade[_0x830a('0x44')][_0x830a('0x4b')]);_0x43b203['offset']=qs['offset'](_0x172ade[_0x830a('0x44')]['offset']);}return _0xb56d0c['getAgents'](_0x43b203);}})['then'](function(_0x4c2700){if(_0x4c2700){return _0x4c2700?{'count':_0x50a7f3,'rows':_0x4c2700}:null;}})[_0x830a('0x23')](respondWithResult(_0x52ff2d,null))[_0x830a('0x2e')](handleError(_0x52ff2d,null));}; \ No newline at end of file +var _0x73ac=['addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','register','client','http','Sequelize','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxAccount,\x20%s,\x20%s','result','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','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','body','describe','Disposition','findOne','ids','FaxAccountId','CannedAnswer','getAnswers','nolimit','findAll','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','attachments','join','root','basename','CheckAfterSend','path','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s'];(function(_0x33b97d,_0x369a67){var _0x3feb89=function(_0x5925ae){while(--_0x5925ae){_0x33b97d['push'](_0x33b97d['shift']());}};_0x3feb89(++_0x369a67);}(_0x73ac,0x186));var _0xc73a=function(_0x4b2a66,_0x41fc9b){_0x4b2a66=_0x4b2a66-0x0;var _0x256528=_0x73ac[_0x4b2a66];return _0x256528;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc73a('0x0'));var rimraf=require(_0xc73a('0x1'));var zipdir=require(_0xc73a('0x2'));var jsonpatch=require(_0xc73a('0x3'));var rp=require(_0xc73a('0x4'));var moment=require('moment');var BPromise=require(_0xc73a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc73a('0x6'));var csv=require('to-csv');var ejs=require(_0xc73a('0x7'));var fs=require('fs');var _=require(_0xc73a('0x8'));var squel=require(_0xc73a('0x9'));var crypto=require(_0xc73a('0xa'));var jsforce=require(_0xc73a('0xb'));var deskjs=require(_0xc73a('0xc'));var toCsv=require(_0xc73a('0xd'));var querystring=require(_0xc73a('0xe'));var Papa=require(_0xc73a('0xf'));var Redis=require(_0xc73a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc73a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc73a('0x12'));var logger=require(_0xc73a('0x13'))(_0xc73a('0x14'));var utils=require(_0xc73a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc73a('0x16')]=_[_0xc73a('0x17')](config[_0xc73a('0x16')],{'host':_0xc73a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc73a('0x16')]));require('./faxAccount.socket')[_0xc73a('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc73a('0x1a')][_0xc73a('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xc73a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x55d081,_0x4c1e76,_0x3d72c9){if(_0x3d72c9){var _0x40cfb7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40cfb7['test'](_0x4c1e76)){return _0x55d081;}else{throw new db[(_0xc73a('0x1c'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x55d081;}}function respondWithRpcPromise(_0x32d33b,_0x10f460,_0x8eb9d5,_0x55d431){return new BPromise(function(_0x52068b,_0x279fed){var _0x55d7f9=_0x55d431||client;return _0x55d7f9['request'](_0x32d33b,_0x8eb9d5)[_0xc73a('0x1d')](function(_0xe4591){logger['info']('FaxAccount,\x20%s,\x20%s',_0x10f460,_0xc73a('0x1e'));logger[_0xc73a('0x1f')](_0xc73a('0x20'),_0x10f460,_0xc73a('0x1e'),JSON[_0xc73a('0x21')](_0xe4591));if(_0xe4591['error']){if(_0xe4591[_0xc73a('0x22')][_0xc73a('0x23')]===0x1f4){logger[_0xc73a('0x22')]('FaxAccount,\x20%s,\x20%s',_0x10f460,_0xe4591[_0xc73a('0x22')][_0xc73a('0x24')]);return _0x279fed(_0xe4591['error'][_0xc73a('0x24')]);}logger[_0xc73a('0x22')]('FaxAccount,\x20%s,\x20%s',_0x10f460,_0xe4591[_0xc73a('0x22')][_0xc73a('0x24')]);return _0x52068b(_0xe4591[_0xc73a('0x22')][_0xc73a('0x24')]);}else{logger[_0xc73a('0x25')](_0xc73a('0x26'),_0x10f460,'request\x20sent');_0x52068b(_0xe4591[_0xc73a('0x27')][_0xc73a('0x24')]);}})['catch'](function(_0x29a23e){logger['error'](_0xc73a('0x26'),_0x10f460,_0x29a23e);_0x279fed(_0x29a23e);});});}function respondWithStatusCode(_0x4e619b,_0x2c2ec0){_0x2c2ec0=_0x2c2ec0||0xcc;return function(_0x10d352){if(_0x10d352){return _0x4e619b['sendStatus'](_0x2c2ec0);}return _0x4e619b[_0xc73a('0x28')](_0x2c2ec0)[_0xc73a('0x29')]();};}function respondWithResult(_0x291224,_0x23fdaa){_0x23fdaa=_0x23fdaa||0xc8;return function(_0x3df3e5){if(_0x3df3e5){return _0x291224[_0xc73a('0x28')](_0x23fdaa)[_0xc73a('0x2a')](_0x3df3e5);}};}function respondWithFilteredResult(_0x26f7b7,_0x3e442f){return function(_0x2450fa){if(_0x2450fa){var _0x4b27d0=_0x2450fa[_0xc73a('0x2b')],_0x77219d=_0x3e442f[_0xc73a('0x2c')],_0x146569=_0x3e442f['offset']+_0x3e442f[_0xc73a('0x2d')],_0xb7d1b4;if(_0x146569>=_0x4b27d0){_0x146569=_0x4b27d0;_0xb7d1b4=0xc8;}else{_0xb7d1b4=0xce;}_0x26f7b7[_0xc73a('0x28')](_0xb7d1b4);return _0x26f7b7[_0xc73a('0x2e')](_0xc73a('0x2f'),_0x77219d+'-'+_0x146569+'/'+_0x4b27d0)[_0xc73a('0x2a')](_0x2450fa);}return null;};}function patchUpdates(_0x3f9a69){return function(_0x53e9fa){try{jsonpatch[_0xc73a('0x30')](_0x53e9fa,_0x3f9a69,!![]);}catch(_0x38fbde){return BPromise['reject'](_0x38fbde);}return _0x53e9fa[_0xc73a('0x31')]();};}function saveUpdates(_0x5b2ed9,_0x342c75){return function(_0x356d79){if(_0x356d79){return _0x356d79[_0xc73a('0x32')](_0x5b2ed9)[_0xc73a('0x1d')](function(_0xf1ce37){return _0xf1ce37;});}return null;};}function removeEntity(_0x2e20eb,_0x209480){return function(_0x309b2c){if(_0x309b2c){return _0x309b2c[_0xc73a('0x33')]()[_0xc73a('0x1d')](function(){var _0x5124f3=_0x309b2c['get']({'plain':!![]});var _0x3bec3d=_0xc73a('0x34');return db[_0xc73a('0x35')][_0xc73a('0x33')]({'where':{'type':_0x3bec3d,'resourceId':_0x5124f3['id']}})[_0xc73a('0x1d')](function(){return _0x309b2c;});})[_0xc73a('0x1d')](function(){_0x2e20eb[_0xc73a('0x28')](0xcc)[_0xc73a('0x29')]();});}};}function handleEntityNotFound(_0x5686cd,_0x3d4a1c){return function(_0x324152){if(!_0x324152){_0x5686cd[_0xc73a('0x36')](0x194);}return _0x324152;};}function handleError(_0x4d9721,_0x26c02f){_0x26c02f=_0x26c02f||0x1f4;return function(_0x38b697){logger[_0xc73a('0x22')](_0x38b697[_0xc73a('0x37')]);if(_0x38b697[_0xc73a('0x38')]){delete _0x38b697[_0xc73a('0x38')];}_0x4d9721[_0xc73a('0x28')](_0x26c02f)[_0xc73a('0x39')](_0x38b697);};}exports['index']=function(_0x2ce99e,_0x33aa17){var _0x37f4d2={'include':[{'model':db[_0xc73a('0x3a')],'as':_0xc73a('0x3b')}]},_0x5468aa={},_0xeae88e={'count':0x0,'rows':[]};var _0x1336a6=_[_0xc73a('0x3c')](db[_0xc73a('0x3d')][_0xc73a('0x3e')],function(_0x144ef9){return{'name':_0x144ef9[_0xc73a('0x3f')],'type':_0x144ef9['type'][_0xc73a('0x40')]};});_0x5468aa[_0xc73a('0x41')]=_[_0xc73a('0x3c')](_0x1336a6,'name');_0x5468aa[_0xc73a('0x42')]=_[_0xc73a('0x43')](_0x2ce99e[_0xc73a('0x42')]);_0x5468aa[_0xc73a('0x44')]=_[_0xc73a('0x45')](_0x5468aa[_0xc73a('0x41')],_0x5468aa[_0xc73a('0x42')]);_0x37f4d2[_0xc73a('0x46')]=_['intersection'](_0x5468aa['model'],qs[_0xc73a('0x47')](_0x2ce99e[_0xc73a('0x42')][_0xc73a('0x47')]));_0x37f4d2[_0xc73a('0x46')]=_0x37f4d2[_0xc73a('0x46')][_0xc73a('0x48')]?_0x37f4d2[_0xc73a('0x46')]:_0x5468aa[_0xc73a('0x41')];if(!_0x2ce99e[_0xc73a('0x42')][_0xc73a('0x49')]('nolimit')){_0x37f4d2[_0xc73a('0x2d')]=qs[_0xc73a('0x2d')](_0x2ce99e[_0xc73a('0x42')]['limit']);_0x37f4d2['offset']=qs['offset'](_0x2ce99e['query'][_0xc73a('0x2c')]);}_0x37f4d2[_0xc73a('0x4a')]=qs[_0xc73a('0x4b')](_0x2ce99e[_0xc73a('0x42')][_0xc73a('0x4b')]);_0x37f4d2[_0xc73a('0x4c')]=qs[_0xc73a('0x44')](_[_0xc73a('0x4d')](_0x2ce99e[_0xc73a('0x42')],_0x5468aa[_0xc73a('0x44')]),_0x1336a6);if(_0x2ce99e[_0xc73a('0x42')][_0xc73a('0x4e')]){_0x37f4d2[_0xc73a('0x4c')]=_[_0xc73a('0x4f')](_0x37f4d2['where'],{'$or':_[_0xc73a('0x3c')](_0x1336a6,function(_0x48c076){if(_0x48c076[_0xc73a('0x50')]!==_0xc73a('0x51')){var _0x5cea09={};_0x5cea09[_0x48c076[_0xc73a('0x38')]]={'$like':'%'+_0x2ce99e[_0xc73a('0x42')]['filter']+'%'};return _0x5cea09;}})});}_0x37f4d2=_[_0xc73a('0x4f')]({},_0x37f4d2,_0x2ce99e[_0xc73a('0x52')]);var _0x119f78={'where':_0x37f4d2[_0xc73a('0x4c')]};return db[_0xc73a('0x3d')][_0xc73a('0x2b')](_0x119f78)[_0xc73a('0x1d')](function(_0x513560){_0xeae88e[_0xc73a('0x2b')]=_0x513560;if(_0x2ce99e[_0xc73a('0x42')][_0xc73a('0x53')]){_0x37f4d2[_0xc73a('0x54')]=[{'all':!![]}];}return db[_0xc73a('0x3d')]['findAll'](_0x37f4d2);})[_0xc73a('0x1d')](function(_0x23915b){_0xeae88e[_0xc73a('0x55')]=_0x23915b;return _0xeae88e;})[_0xc73a('0x1d')](respondWithFilteredResult(_0x33aa17,_0x37f4d2))[_0xc73a('0x56')](handleError(_0x33aa17,null));};exports['show']=function(_0x4d2a81,_0x12bb29){var _0x1a735c={'raw':![],'where':{'id':_0x4d2a81[_0xc73a('0x57')]['id']},'include':[{'model':db[_0xc73a('0x3a')],'as':_0xc73a('0x3b')}]},_0x1d4251={};_0x1d4251[_0xc73a('0x41')]=_[_0xc73a('0x43')](db[_0xc73a('0x3d')][_0xc73a('0x3e')]);_0x1d4251[_0xc73a('0x42')]=_[_0xc73a('0x43')](_0x4d2a81['query']);_0x1d4251['filters']=_[_0xc73a('0x45')](_0x1d4251[_0xc73a('0x41')],_0x1d4251[_0xc73a('0x42')]);_0x1a735c[_0xc73a('0x46')]=_[_0xc73a('0x45')](_0x1d4251[_0xc73a('0x41')],qs[_0xc73a('0x47')](_0x4d2a81[_0xc73a('0x42')][_0xc73a('0x47')]));_0x1a735c['attributes']=_0x1a735c['attributes'][_0xc73a('0x48')]?_0x1a735c['attributes']:_0x1d4251[_0xc73a('0x41')];if(_0x4d2a81[_0xc73a('0x42')]['includeAll']){_0x1a735c[_0xc73a('0x54')]=[{'all':!![]}];}_0x1a735c=_[_0xc73a('0x4f')]({},_0x1a735c,_0x4d2a81[_0xc73a('0x52')]);return db[_0xc73a('0x3d')][_0xc73a('0x58')](_0x1a735c)[_0xc73a('0x1d')](handleEntityNotFound(_0x12bb29,null))['then'](respondWithResult(_0x12bb29,null))[_0xc73a('0x56')](handleError(_0x12bb29,null));};exports[_0xc73a('0x59')]=function(_0x29e1e2,_0x4634b8){return db[_0xc73a('0x3d')][_0xc73a('0x59')](_0x29e1e2['body'],{})[_0xc73a('0x1d')](function(_0x45e0f4){var _0x26c46e=_0x29e1e2[_0xc73a('0x5a')]['get']({'plain':!![]});if(!_0x26c46e)throw new Error(_0xc73a('0x5b'));if(_0x26c46e[_0xc73a('0x5c')]===_0xc73a('0x5a')){var _0x5e15c4=_0x45e0f4[_0xc73a('0x5d')]({'plain':!![]});var _0x27e1cf=_0xc73a('0x34');return db[_0xc73a('0x5e')]['find']({'where':{'name':_0x27e1cf,'userProfileId':_0x26c46e[_0xc73a('0x5f')]},'raw':!![]})[_0xc73a('0x1d')](function(_0x47327d){if(_0x47327d&&_0x47327d[_0xc73a('0x60')]===0x0){return db['UserProfileResource'][_0xc73a('0x59')]({'name':_0x5e15c4['name'],'resourceId':_0x5e15c4['id'],'type':_0x47327d['name'],'sectionId':_0x47327d['id']},{})['then'](function(){return _0x45e0f4;});}else{return _0x45e0f4;}})[_0xc73a('0x56')](function(_0x1e7204){logger[_0xc73a('0x22')](_0xc73a('0x61'),_0x1e7204);throw _0x1e7204;});}return _0x45e0f4;})[_0xc73a('0x1d')](respondWithResult(_0x4634b8,0xc9))[_0xc73a('0x56')](handleError(_0x4634b8,null));};exports[_0xc73a('0x32')]=function(_0xd74806,_0xbe3a8e){if(_0xd74806[_0xc73a('0x62')]['id']){delete _0xd74806[_0xc73a('0x62')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0xd74806[_0xc73a('0x57')]['id']},'include':[{'model':db[_0xc73a('0x3a')],'as':_0xc73a('0x3b')}]})[_0xc73a('0x1d')](handleEntityNotFound(_0xbe3a8e,null))[_0xc73a('0x1d')](saveUpdates(_0xd74806['body'],null))[_0xc73a('0x1d')](respondWithResult(_0xbe3a8e,null))[_0xc73a('0x56')](handleError(_0xbe3a8e,null));};exports[_0xc73a('0x33')]=function(_0x17bbdd,_0x242c54){return db[_0xc73a('0x3d')][_0xc73a('0x58')]({'where':{'id':_0x17bbdd[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x242c54,null))[_0xc73a('0x1d')](removeEntity(_0x242c54,null))[_0xc73a('0x56')](handleError(_0x242c54,null));};exports[_0xc73a('0x63')]=function(_0x9b6b61,_0xaba550){return db[_0xc73a('0x3d')][_0xc73a('0x63')]()['then'](respondWithResult(_0xaba550,null))['catch'](handleError(_0xaba550,null));};exports['addDisposition']=function(_0x1d297f,_0x48c9d7,_0xf75999){if(_0x1d297f[_0xc73a('0x62')]['id']){delete _0x1d297f[_0xc73a('0x62')]['id'];}return db[_0xc73a('0x3d')]['find']({'where':{'id':_0x1d297f['params']['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x48c9d7,null))[_0xc73a('0x1d')](function(_0x106911){if(_0x106911){_0x1d297f[_0xc73a('0x62')]['FaxAccountId']=_0x106911['id'];return db[_0xc73a('0x64')]['create'](_0x1d297f['body']);}})[_0xc73a('0x1d')](respondWithResult(_0x48c9d7,null))[_0xc73a('0x56')](handleError(_0x48c9d7,null));};exports['getDispositions']=function(_0x5d7241,_0x2e1fff,_0x1ebcec){var _0x398285={'raw':![],'where':{}};var _0x10aec1={};var _0xd3a558={'count':0x0,'rows':[]};return db[_0xc73a('0x3d')][_0xc73a('0x65')]({'where':{'id':_0x5d7241[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x2e1fff,null))[_0xc73a('0x1d')](function(_0x2ed02b){if(_0x2ed02b){_0x10aec1[_0xc73a('0x41')]=_[_0xc73a('0x43')](db['Disposition'][_0xc73a('0x3e')]);_0x10aec1['query']=_[_0xc73a('0x43')](_0x5d7241[_0xc73a('0x42')]);_0x10aec1['filters']=_[_0xc73a('0x45')](_0x10aec1[_0xc73a('0x41')],_0x10aec1[_0xc73a('0x42')]);_0x398285['attributes']=_['intersection'](_0x10aec1['model'],qs[_0xc73a('0x47')](_0x5d7241[_0xc73a('0x42')][_0xc73a('0x47')]));_0x398285['attributes']=_0x398285['attributes']['length']?_0x398285[_0xc73a('0x46')]:_0x10aec1['model'];if(!_0x5d7241[_0xc73a('0x42')]['hasOwnProperty']('nolimit')){_0x398285[_0xc73a('0x2d')]=qs[_0xc73a('0x2d')](_0x5d7241[_0xc73a('0x42')][_0xc73a('0x2d')]);_0x398285['offset']=qs[_0xc73a('0x2c')](_0x5d7241[_0xc73a('0x42')]['offset']);}_0x398285[_0xc73a('0x4a')]=qs[_0xc73a('0x4b')](_0x5d7241[_0xc73a('0x42')][_0xc73a('0x4b')]);_0x398285['where']=qs[_0xc73a('0x44')](_['pick'](_0x5d7241['query'],_0x10aec1[_0xc73a('0x44')]));_0x398285[_0xc73a('0x4c')]['FaxAccountId']=_0x2ed02b['id'];if(_0x5d7241[_0xc73a('0x42')]['filter']){_0x398285['where']=_[_0xc73a('0x4f')](_0x398285[_0xc73a('0x4c')],{'$or':_[_0xc73a('0x3c')](_0x398285['attributes'],function(_0x327d44){var _0x45bfe6={};_0x45bfe6[_0x327d44]={'$like':'%'+_0x5d7241[_0xc73a('0x42')][_0xc73a('0x4e')]+'%'};return _0x45bfe6;})});}_0x398285=_['merge']({},_0x398285,_0x5d7241[_0xc73a('0x52')]);return db[_0xc73a('0x64')][_0xc73a('0x2b')]({'where':_0x398285[_0xc73a('0x4c')]})[_0xc73a('0x1d')](function(_0x6e4e24){_0xd3a558[_0xc73a('0x2b')]=_0x6e4e24;if(_0x5d7241['query']['includeAll']){_0x398285[_0xc73a('0x54')]=[{'all':!![]}];}return db[_0xc73a('0x64')]['findAll'](_0x398285);})[_0xc73a('0x1d')](function(_0x1bfc7b){_0xd3a558[_0xc73a('0x55')]=_0x1bfc7b;return _0xd3a558;});}})['then'](respondWithFilteredResult(_0x2e1fff,_0x398285))[_0xc73a('0x56')](handleError(_0x2e1fff,null));};exports['removeDispositions']=function(_0x4ae3a8,_0x2f6f52,_0xbfb026){return db[_0xc73a('0x3d')][_0xc73a('0x58')]({'where':{'id':_0x4ae3a8[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x2f6f52,null))[_0xc73a('0x1d')](function(_0x565d44){if(_0x565d44){return _0x565d44['removeDispositions'](_0x4ae3a8[_0xc73a('0x42')][_0xc73a('0x66')]);}})[_0xc73a('0x1d')](respondWithStatusCode(_0x2f6f52,null))[_0xc73a('0x56')](handleError(_0x2f6f52,null));};exports['addAnswer']=function(_0x15b1d7,_0x5206f2,_0x22c6b6){if(_0x15b1d7[_0xc73a('0x62')]['id']){delete _0x15b1d7[_0xc73a('0x62')]['id'];}return db[_0xc73a('0x3d')]['find']({'where':{'id':_0x15b1d7[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x5206f2,null))['then'](function(_0x337f96){if(_0x337f96){_0x15b1d7[_0xc73a('0x62')][_0xc73a('0x67')]=_0x337f96['id'];return db[_0xc73a('0x68')][_0xc73a('0x59')](_0x15b1d7[_0xc73a('0x62')]);}})['then'](respondWithResult(_0x5206f2,null))[_0xc73a('0x56')](handleError(_0x5206f2,null));};exports[_0xc73a('0x69')]=function(_0x1122a5,_0x5323e7,_0x11af8d){var _0x55ae49={'raw':![],'where':{}};var _0x488054={};var _0x524a41={'count':0x0,'rows':[]};return db[_0xc73a('0x3d')][_0xc73a('0x65')]({'where':{'id':_0x1122a5[_0xc73a('0x57')]['id']}})['then'](handleEntityNotFound(_0x5323e7,null))[_0xc73a('0x1d')](function(_0x316a01){if(_0x316a01){_0x488054[_0xc73a('0x41')]=_[_0xc73a('0x43')](db[_0xc73a('0x68')][_0xc73a('0x3e')]);_0x488054[_0xc73a('0x42')]=_[_0xc73a('0x43')](_0x1122a5[_0xc73a('0x42')]);_0x488054[_0xc73a('0x44')]=_['intersection'](_0x488054['model'],_0x488054[_0xc73a('0x42')]);_0x55ae49[_0xc73a('0x46')]=_[_0xc73a('0x45')](_0x488054[_0xc73a('0x41')],qs['fields'](_0x1122a5[_0xc73a('0x42')][_0xc73a('0x47')]));_0x55ae49[_0xc73a('0x46')]=_0x55ae49[_0xc73a('0x46')][_0xc73a('0x48')]?_0x55ae49[_0xc73a('0x46')]:_0x488054[_0xc73a('0x41')];if(!_0x1122a5[_0xc73a('0x42')][_0xc73a('0x49')](_0xc73a('0x6a'))){_0x55ae49['limit']=qs['limit'](_0x1122a5[_0xc73a('0x42')][_0xc73a('0x2d')]);_0x55ae49[_0xc73a('0x2c')]=qs['offset'](_0x1122a5[_0xc73a('0x42')]['offset']);}_0x55ae49[_0xc73a('0x4a')]=qs[_0xc73a('0x4b')](_0x1122a5[_0xc73a('0x42')][_0xc73a('0x4b')]);_0x55ae49[_0xc73a('0x4c')]=qs[_0xc73a('0x44')](_['pick'](_0x1122a5[_0xc73a('0x42')],_0x488054[_0xc73a('0x44')]));_0x55ae49['where']['FaxAccountId']=_0x316a01['id'];if(_0x1122a5[_0xc73a('0x42')][_0xc73a('0x4e')]){_0x55ae49['where']=_[_0xc73a('0x4f')](_0x55ae49[_0xc73a('0x4c')],{'$or':_[_0xc73a('0x3c')](_0x55ae49[_0xc73a('0x46')],function(_0x50dc51){var _0x5b2d4d={};_0x5b2d4d[_0x50dc51]={'$like':'%'+_0x1122a5[_0xc73a('0x42')][_0xc73a('0x4e')]+'%'};return _0x5b2d4d;})});}_0x55ae49=_[_0xc73a('0x4f')]({},_0x55ae49,_0x1122a5[_0xc73a('0x52')]);return db[_0xc73a('0x68')][_0xc73a('0x2b')]({'where':_0x55ae49['where']})[_0xc73a('0x1d')](function(_0x3ae439){_0x524a41['count']=_0x3ae439;if(_0x1122a5[_0xc73a('0x42')]['includeAll']){_0x55ae49[_0xc73a('0x54')]=[{'all':!![]}];}return db[_0xc73a('0x68')][_0xc73a('0x6b')](_0x55ae49);})['then'](function(_0xaa841e){_0x524a41[_0xc73a('0x55')]=_0xaa841e;return _0x524a41;});}})[_0xc73a('0x1d')](respondWithFilteredResult(_0x5323e7,_0x55ae49))['catch'](handleError(_0x5323e7,null));};exports[_0xc73a('0x6c')]=function(_0x5390bc,_0x1a3e3b,_0x3227db){return db[_0xc73a('0x3d')][_0xc73a('0x58')]({'where':{'id':_0x5390bc['params']['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x1a3e3b,null))[_0xc73a('0x1d')](function(_0x2459bf){if(_0x2459bf){return _0x2459bf[_0xc73a('0x6c')](_0x5390bc[_0xc73a('0x42')][_0xc73a('0x66')]);}})[_0xc73a('0x1d')](respondWithStatusCode(_0x1a3e3b,null))[_0xc73a('0x56')](handleError(_0x1a3e3b,null));};exports['addInteraction']=function(_0x2faad4,_0x45f9bc,_0x522f8c){return db[_0xc73a('0x6d')][_0xc73a('0x58')]({'where':{'id':_0x2faad4[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x45f9bc,null))['then'](function(_0x50d8b2){if(_0x50d8b2){return _0x50d8b2[_0xc73a('0x6e')](_0x2faad4[_0xc73a('0x62')][_0xc73a('0x66')],_[_0xc73a('0x6f')](_0x2faad4[_0xc73a('0x62')],[_0xc73a('0x66'),'id'])||{});}})[_0xc73a('0x1d')](respondWithResult(_0x45f9bc,null))[_0xc73a('0x56')](handleError(_0x45f9bc,null));};exports[_0xc73a('0x70')]=function(_0x14019e,_0x3f878e,_0x58d509){var _0x45d1a8={'raw':![],'where':{}};var _0x38f39a={};var _0x90be50={'count':0x0,'rows':[]};return db[_0xc73a('0x3d')]['findOne']({'where':{'id':_0x14019e[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x3f878e,null))['then'](function(_0x118d6b){if(_0x118d6b){_0x38f39a[_0xc73a('0x41')]=_[_0xc73a('0x43')](db['FaxInteraction'][_0xc73a('0x3e')]);_0x38f39a[_0xc73a('0x42')]=_['keys'](_0x14019e['query']);_0x38f39a[_0xc73a('0x44')]=_[_0xc73a('0x45')](_0x38f39a[_0xc73a('0x41')],_0x38f39a['query']);_0x45d1a8[_0xc73a('0x46')]=_[_0xc73a('0x45')](_0x38f39a[_0xc73a('0x41')],qs[_0xc73a('0x47')](_0x14019e[_0xc73a('0x42')][_0xc73a('0x47')]));_0x45d1a8[_0xc73a('0x46')]=_0x45d1a8[_0xc73a('0x46')][_0xc73a('0x48')]?_0x45d1a8[_0xc73a('0x46')]:_0x38f39a[_0xc73a('0x41')];if(!_0x14019e[_0xc73a('0x42')][_0xc73a('0x49')]('nolimit')){_0x45d1a8[_0xc73a('0x2d')]=qs[_0xc73a('0x2d')](_0x14019e['query'][_0xc73a('0x2d')]);_0x45d1a8['offset']=qs[_0xc73a('0x2c')](_0x14019e[_0xc73a('0x42')][_0xc73a('0x2c')]);}_0x45d1a8['order']=qs[_0xc73a('0x4b')](_0x14019e[_0xc73a('0x42')][_0xc73a('0x4b')]);_0x45d1a8[_0xc73a('0x4c')]=qs[_0xc73a('0x44')](_[_0xc73a('0x4d')](_0x14019e[_0xc73a('0x42')],_0x38f39a[_0xc73a('0x44')]));_0x45d1a8[_0xc73a('0x4c')][_0xc73a('0x67')]=_0x118d6b['id'];if(_0x14019e['query'][_0xc73a('0x4e')]){_0x45d1a8[_0xc73a('0x4c')]=_[_0xc73a('0x4f')](_0x45d1a8[_0xc73a('0x4c')],{'$or':_[_0xc73a('0x3c')](_0x45d1a8[_0xc73a('0x46')],function(_0xacdf2e){var _0xc680f9={};_0xc680f9[_0xacdf2e]={'$like':'%'+_0x14019e[_0xc73a('0x42')][_0xc73a('0x4e')]+'%'};return _0xc680f9;})});}_0x45d1a8=_[_0xc73a('0x4f')]({},_0x45d1a8,_0x14019e[_0xc73a('0x52')]);return db[_0xc73a('0x6d')][_0xc73a('0x2b')]({'where':_0x45d1a8[_0xc73a('0x4c')]})[_0xc73a('0x1d')](function(_0x472fa9){_0x90be50[_0xc73a('0x2b')]=_0x472fa9;if(_0x14019e[_0xc73a('0x42')]['includeAll']){_0x45d1a8[_0xc73a('0x54')]=[{'model':db[_0xc73a('0x71')],'as':_0xc73a('0x72'),'required':![]},{'model':db[_0xc73a('0x73')],'as':_0xc73a('0x74'),'attributes':[_0xc73a('0x38'),_0xc73a('0x75'),'internal'],'required':![]},{'model':db[_0xc73a('0x76')],'as':_0xc73a('0x77'),'attributes':['id',_0xc73a('0x38'),_0xc73a('0x78')],'where':_0x14019e[_0xc73a('0x42')]['tag']?{'id':_0x14019e[_0xc73a('0x42')][_0xc73a('0x79')]}:undefined,'required':_0x14019e['query'][_0xc73a('0x79')]?!![]:![]}];}return db[_0xc73a('0x6d')]['findAll'](_0x45d1a8);})[_0xc73a('0x1d')](function(_0x383029){_0x90be50[_0xc73a('0x55')]=_0x383029;return _0x90be50;});}})[_0xc73a('0x1d')](respondWithFilteredResult(_0x3f878e,_0x45d1a8))['catch'](handleError(_0x3f878e,null));};exports['addApplications']=function(_0x59309f,_0x461d14,_0x3c045e){return db[_0xc73a('0x3d')]['findOne']({'where':{'id':_0x59309f[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x461d14,null))[_0xc73a('0x1d')](function(_0x1cf2e2){if(_0x1cf2e2){return db[_0xc73a('0x7a')][_0xc73a('0x7b')](function(_0x5a2045){return db['FaxApplication'][_0xc73a('0x33')]({'where':{'FaxAccountId':_0x59309f[_0xc73a('0x57')]['id']},'transaction':_0x5a2045})['then'](function(_0x203bac){var _0x1cd6d0=_[_0xc73a('0x3c')](_0x59309f['body'],function(_0x3f01f1){_0x3f01f1[_0xc73a('0x67')]=_0x59309f[_0xc73a('0x57')]['id'];return _0x3f01f1;});return db[_0xc73a('0x7c')][_0xc73a('0x7d')](_0x1cd6d0,{'transaction':_0x5a2045});});})[_0xc73a('0x1d')](function(){return db[_0xc73a('0x7c')]['findAndCountAll']({'where':{'FaxAccountId':_0x59309f[_0xc73a('0x57')]['id']},'order':_0xc73a('0x7e')});});}})[_0xc73a('0x1d')](respondWithResult(_0x461d14,null))['catch'](handleError(_0x461d14,null));};exports['getApplications']=function(_0x1684cd,_0x324a4f,_0x458315){var _0x1d7132={};var _0x4ad3ce={};var _0x24b31c;var _0x15a958;return db['FaxAccount'][_0xc73a('0x65')]({'where':{'id':_0x1684cd[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x324a4f,null))[_0xc73a('0x1d')](function(_0x193b2e){if(_0x193b2e){_0x24b31c=_0x193b2e;_0x4ad3ce[_0xc73a('0x41')]=_[_0xc73a('0x43')](db[_0xc73a('0x7c')]['rawAttributes']);_0x4ad3ce[_0xc73a('0x42')]=_[_0xc73a('0x43')](_0x1684cd['query']);_0x4ad3ce['filters']=_['intersection'](_0x4ad3ce[_0xc73a('0x41')],_0x4ad3ce[_0xc73a('0x42')]);_0x1d7132[_0xc73a('0x46')]=_[_0xc73a('0x45')](_0x4ad3ce[_0xc73a('0x41')],qs[_0xc73a('0x47')](_0x1684cd[_0xc73a('0x42')]['fields']));_0x1d7132[_0xc73a('0x46')]=_0x1d7132[_0xc73a('0x46')][_0xc73a('0x48')]?_0x1d7132[_0xc73a('0x46')]:_0x4ad3ce[_0xc73a('0x41')];_0x1d7132[_0xc73a('0x4a')]=qs['sort'](_0x1684cd['query']['sort']);_0x1d7132['where']=qs[_0xc73a('0x44')](_['pick'](_0x1684cd['query'],_0x4ad3ce[_0xc73a('0x44')]));if(_0x1684cd[_0xc73a('0x42')][_0xc73a('0x4e')]){_0x1d7132[_0xc73a('0x4c')]=_[_0xc73a('0x4f')](_0x1d7132[_0xc73a('0x4c')],{'$or':_['map'](_0x1d7132[_0xc73a('0x46')],function(_0x33a120){var _0x21194b={};_0x21194b[_0x33a120]={'$like':'%'+_0x1684cd[_0xc73a('0x42')][_0xc73a('0x4e')]+'%'};return _0x21194b;})});}_0x1d7132=_['merge']({},_0x1d7132,_0x1684cd[_0xc73a('0x52')]);return _0x24b31c['getApplications'](_0x1d7132);}})['then'](function(_0x101d82){if(_0x101d82){_0x15a958=_0x101d82[_0xc73a('0x48')];if(!_0x1684cd[_0xc73a('0x42')][_0xc73a('0x49')]('nolimit')){_0x1d7132['limit']=qs[_0xc73a('0x2d')](_0x1684cd[_0xc73a('0x42')][_0xc73a('0x2d')]);_0x1d7132[_0xc73a('0x2c')]=qs[_0xc73a('0x2c')](_0x1684cd['query'][_0xc73a('0x2c')]);}return _0x24b31c[_0xc73a('0x7f')](_0x1d7132);}})[_0xc73a('0x1d')](function(_0x395c61){if(_0x395c61){return _0x395c61?{'count':_0x15a958,'rows':_0x395c61}:null;}})['then'](respondWithResult(_0x324a4f,null))[_0xc73a('0x56')](handleError(_0x324a4f,null));};function Extension(_0x40b27a,_0x5345d3,_0x1abc04,_0x13a473){this[_0xc73a('0x80')]=_0xc73a('0x81');this[_0xc73a('0x82')]=_0x40b27a[_0xc73a('0x83')];this[_0xc73a('0x84')]=_0x13a473;this[_0xc73a('0x50')]=_0xc73a('0x85');this[_0xc73a('0x86')]=_0xc73a('0x87');this['FaxAccountId']=_0x40b27a['id'];this[_0xc73a('0x7e')]=_0x5345d3;this[_0xc73a('0x88')]=_0x1abc04;}function createExtensionsReciveFax(_0x19edc1){var _0x199bbd=0x1;var _0x1487d1=[];_0x1487d1[_0xc73a('0x89')](new Extension(_0x19edc1,_0x199bbd,'','Answer'));_0x199bbd+=0x1;_0x1487d1['push'](new Extension(_0x19edc1,_0x199bbd,_0xc73a('0x8a'),_0xc73a('0x8b')));_0x199bbd+=0x1;for(var _0x115a30 in _0x19edc1){if(_0x19edc1[_0xc73a('0x49')](_0x115a30)&&(_0x115a30===_0xc73a('0x8c')||_0x115a30===_0xc73a('0x83')||_0x115a30===_0xc73a('0x8d')||_0x115a30===_0xc73a('0x8e')||_0x115a30===_0xc73a('0x8f')||_0x115a30===_0xc73a('0x90')||_0x115a30===_0xc73a('0x91')||_0x115a30==='modem'||_0x115a30==='t38timeout')){_0x1487d1[_0xc73a('0x89')](new Extension(_0x19edc1,_0x199bbd,_0xc73a('0x92')+_0x115a30+')='+_0x19edc1[_0x115a30],_0xc73a('0x8b')));_0x199bbd+=0x1;}}_0x1487d1[_0xc73a('0x89')](new Extension(_0x19edc1,_0x199bbd,'6',_0xc73a('0x93')));_0x199bbd+=0x1;_0x1487d1[_0xc73a('0x89')](new Extension(_0x19edc1,_0x199bbd,_0xc73a('0x94'),_0xc73a('0x95')));_0x199bbd=0x0;return _0x1487d1;}exports[_0xc73a('0x96')]=function(_0x263230,_0x3001d9,_0xaaeb05){var _0x3bede9;return db[_0xc73a('0x7a')][_0xc73a('0x7b')](function(_0x3aaff8){return db['FaxAccount'][_0xc73a('0x59')](_0x263230[_0xc73a('0x62')],{'transaction':_0x3aaff8})[_0xc73a('0x1d')](function(_0x11555a){_0x3bede9=_0x11555a[_0xc73a('0x5d')]({'plain':!![]});return db[_0xc73a('0x97')][_0xc73a('0x7d')](createExtensionsReciveFax(_0x3bede9),{'transaction':_0x3aaff8});});})[_0xc73a('0x1d')](function(){return _0x3bede9;})[_0xc73a('0x1d')](respondWithResult(_0x3001d9,null))[_0xc73a('0x56')](handleError(_0x3001d9,null));};exports[_0xc73a('0x98')]=function(_0x308c98,_0x22b834,_0x2d9d1f){var _0x4a4456;return db[_0xc73a('0x7a')][_0xc73a('0x7b')](function(_0x36234c){return db['FaxAccount']['update'](_0x308c98[_0xc73a('0x62')],{'where':{'id':_0x308c98[_0xc73a('0x62')]['id']},'transaction':_0x36234c})[_0xc73a('0x1d')](function(_0x489990){return db['VoiceExtension'][_0xc73a('0x33')]({'where':{'FaxAccountId':_0x308c98[_0xc73a('0x62')]['id']},'transaction':_0x36234c})[_0xc73a('0x1d')](function(_0x1d83b9){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0xc73a('0x6f')](_0x308c98[_0xc73a('0x62')],[_0xc73a('0x99'),_0xc73a('0x40'),'createdAt','updatedAt',_0xc73a('0x9a'),_0xc73a('0x9b')])),{'transaction':_0x36234c});});});})['then'](function(){return db[_0xc73a('0x3d')][_0xc73a('0x9c')](_0x308c98['body']['id']);})[_0xc73a('0x1d')](respondWithResult(_0x22b834,null))['catch'](handleError(_0x22b834,null));};exports[_0xc73a('0x9d')]=function(_0x33114d,_0x374878,_0x51fd84){var _0x3f1fc7={'raw':!![],'where':{}};var _0x5bc703={};var _0xe12790={'count':0x0,'rows':[]};return db[_0xc73a('0x3d')]['findOne']({'where':{'id':_0x33114d[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x374878,null))[_0xc73a('0x1d')](function(_0x584d32){if(_0x584d32){_0x5bc703[_0xc73a('0x41')]=_[_0xc73a('0x43')](db[_0xc73a('0x9e')][_0xc73a('0x3e')]);_0x5bc703[_0xc73a('0x42')]=_[_0xc73a('0x43')](_0x33114d[_0xc73a('0x42')]);_0x5bc703['filters']=_[_0xc73a('0x45')](_0x5bc703[_0xc73a('0x41')],_0x5bc703[_0xc73a('0x42')]);_0x3f1fc7[_0xc73a('0x46')]=_['intersection'](_0x5bc703[_0xc73a('0x41')],qs[_0xc73a('0x47')](_0x33114d['query'][_0xc73a('0x47')]));_0x3f1fc7[_0xc73a('0x46')]=_0x3f1fc7[_0xc73a('0x46')][_0xc73a('0x48')]?_0x3f1fc7[_0xc73a('0x46')]:_0x5bc703['model'];if(!_0x33114d[_0xc73a('0x42')][_0xc73a('0x49')](_0xc73a('0x6a'))){_0x3f1fc7[_0xc73a('0x2d')]=qs[_0xc73a('0x2d')](_0x33114d[_0xc73a('0x42')]['limit']);_0x3f1fc7[_0xc73a('0x2c')]=qs['offset'](_0x33114d[_0xc73a('0x42')][_0xc73a('0x2c')]);}_0x3f1fc7[_0xc73a('0x4a')]=qs[_0xc73a('0x4b')](_0x33114d[_0xc73a('0x42')][_0xc73a('0x4b')]);_0x3f1fc7[_0xc73a('0x4c')]=qs['filters'](_[_0xc73a('0x4d')](_0x33114d['query'],_0x5bc703[_0xc73a('0x44')]));_0x3f1fc7[_0xc73a('0x4c')][_0xc73a('0x67')]=_0x584d32['id'];if(_0x33114d['query'][_0xc73a('0x4e')]){_0x3f1fc7[_0xc73a('0x4c')]=_[_0xc73a('0x4f')](_0x3f1fc7[_0xc73a('0x4c')],{'$or':_[_0xc73a('0x3c')](_0x3f1fc7[_0xc73a('0x46')],function(_0x1345e4){var _0x22ed5b={};_0x22ed5b[_0x1345e4]={'$like':'%'+_0x33114d[_0xc73a('0x42')]['filter']+'%'};return _0x22ed5b;})});}if(_0x33114d[_0xc73a('0x42')]['$gte']){var _0x2f8c0d=_0x33114d[_0xc73a('0x42')][_0xc73a('0x9f')][_0xc73a('0xa0')](',');var _0x34fef0={};_0x34fef0[_0x2f8c0d[0x0]]={'$gte':moment(_0x2f8c0d[0x1])['format'](_0xc73a('0xa1'))};_0x3f1fc7[_0xc73a('0x4c')]=_[_0xc73a('0x4f')](_0x3f1fc7['where'],_0x34fef0);}_0x3f1fc7=_[_0xc73a('0x4f')]({},_0x3f1fc7,_0x33114d[_0xc73a('0x52')]);return db[_0xc73a('0x9e')][_0xc73a('0x2b')]({'where':_0x3f1fc7['where']})[_0xc73a('0x1d')](function(_0x575786){_0xe12790[_0xc73a('0x2b')]=_0x575786;if(_0x33114d[_0xc73a('0x42')][_0xc73a('0x53')]){_0x3f1fc7[_0xc73a('0x54')]=[{'all':!![]}];}return db[_0xc73a('0x9e')][_0xc73a('0x6b')](_0x3f1fc7);})[_0xc73a('0x1d')](function(_0x1582e6){_0xe12790[_0xc73a('0x55')]=_0x1582e6;return _0xe12790;});}})['then'](respondWithFilteredResult(_0x374878,_0x3f1fc7))[_0xc73a('0x56')](handleError(_0x374878,null));};exports[_0xc73a('0x39')]=function(_0x7aeb6,_0x4dc13d,_0xe726b6){var _0x196c7f,_0x4aa3e1={},_0x2d6da8;if(_0x7aeb6[_0xc73a('0x62')]['to']){_0x2d6da8=_0x7aeb6['body']['to'][0x0];}return db[_0xc73a('0x3d')][_0xc73a('0x58')]({'where':{'id':_0x7aeb6[_0xc73a('0x57')]['id']},'include':[{'model':db[_0xc73a('0xa2')],'as':_0xc73a('0xa3'),'include':[{'model':db[_0xc73a('0x71')],'as':'Contacts','where':{'fax':_0x2d6da8},'limit':0x1,'order':[[_0xc73a('0xa4'),_0xc73a('0xa5')]]}]}]})[_0xc73a('0x1d')](handleEntityNotFound(_0x4dc13d,null))[_0xc73a('0x1d')](function(_0x418916){_0x196c7f=_0x418916;if(_0x7aeb6['body'][_0xc73a('0xa6')]&&_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xa6')]['length']){for(var _0x24bb09=0x0;_0x24bb09<_0x7aeb6['body'][_0xc73a('0xa6')][_0xc73a('0x48')];_0x24bb09+=0x1){_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xa6')][_0x24bb09]={'filename':_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xa6')][_0x24bb09][_0xc73a('0x38')],'id':_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xa6')][_0x24bb09]['id'],'path':path[_0xc73a('0xa7')](config[_0xc73a('0xa8')],'server/files/attachments',_0x7aeb6[_0xc73a('0x62')]['attachments'][_0x24bb09][_0xc73a('0xa9')])};}}return respondWithRpcPromise('CheckAfterSend',_0xc73a('0xaa'),{'FaxAccountId':_['isNil'](_0x7aeb6['params']['id'])?undefined:_0x7aeb6[_0xc73a('0x57')]['id'],'path':_['isNil'](_0x7aeb6[_0xc73a('0x62')]['attachments'][0x0][_0xc73a('0xab')])?undefined:_0x7aeb6[_0xc73a('0x62')]['attachments'][0x0][_0xc73a('0xab')],'fax':_['isNil'](_0x7aeb6[_0xc73a('0x62')]['to'][0x0])?undefined:_0x7aeb6['body']['to'][0x0]},client9002);})[_0xc73a('0x1d')](function(){if(_0x196c7f){if(_[_0xc73a('0xac')](_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xad')])){_0x7aeb6[_0xc73a('0x62')]['from']=util['format'](_0xc73a('0xae'),_0x196c7f[_0xc73a('0x38')],_0x196c7f[_0xc73a('0xaf')]);}if(_0x196c7f['List']){if(_0x196c7f[_0xc73a('0xa3')][_0xc73a('0xb0')]['length']){return _0x196c7f[_0xc73a('0xa3')][_0xc73a('0xb0')][0x0];}else{return db[_0xc73a('0x71')]['create'](_[_0xc73a('0x17')](_0x7aeb6[_0xc73a('0x62')],{'firstName':_0x7aeb6[_0xc73a('0x62')]['to'][0x0],'phone':_0x7aeb6[_0xc73a('0x62')]['to'][0x0],'fax':_0x7aeb6['body']['to'][0x0],'ListId':_0x196c7f[_0xc73a('0x9b')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xc73a('0xb1'));}})[_0xc73a('0x1d')](function(_0x3589a1){if(_0x3589a1){return db[_0xc73a('0x6d')][_0xc73a('0x58')]({'where':{'ContactId':_0x3589a1['id'],'closed':![],'FaxAccountId':_0x196c7f['id']}})['then'](function(_0x436937){if(_0x436937){return[_0x436937,![]];}return db[_0xc73a('0x6d')]['create']({'UserId':_0x7aeb6[_0xc73a('0x5a')]['id'],'ContactId':_0x3589a1['id'],'FaxAccountId':_0x196c7f['id'],'fax':_0x7aeb6[_0xc73a('0x62')]['to'][0x0],'firstMsgDirection':_0xc73a('0xb2'),'Messages':[_[_0xc73a('0x4f')](_0x7aeb6[_0xc73a('0x62')],{'read':![],'body':_0x7aeb6['body'][_0xc73a('0xa6')][0x0][_0xc73a('0xb3')],'FaxAccountId':_0x196c7f['id'],'UserId':_0x7aeb6[_0xc73a('0x5a')]['id'],'ContactId':_0x3589a1['id'],'AttachmentId':_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xc73a('0xb4')}]})[_0xc73a('0x1d')](function(_0x311197){return[_0x311197,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc73a('0xb5')](function(_0xc1a80c,_0x3febe0){if(_0x3febe0){return _0xc1a80c;}return db[_0xc73a('0x9e')][_0xc73a('0x59')]({'direction':_0xc73a('0xb2'),'read':![],'body':_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xa6')][0x0]['filename'],'FaxAccountId':_0x196c7f['id'],'FaxInteractionId':_0xc1a80c['id'],'UserId':_0x7aeb6['user']['id'],'ContactId':_0xc1a80c[_0xc73a('0xb6')],'AttachmentId':_0x7aeb6['body'][_0xc73a('0xa6')][0x0]['id']})['then'](function(_0x4a7944){_0xc1a80c[_0xc73a('0xb7')]['Messages']=[];_0xc1a80c[_0xc73a('0xb7')][_0xc73a('0xb4')][_0xc73a('0x89')](_0x4a7944[_0xc73a('0xb7')]);return _0xc1a80c;});})['then'](function(_0x42763f){respondWithRpcPromise('SendFax',_0xc73a('0xb8'),{'FaxAccountId':_[_0xc73a('0xac')](_0x7aeb6['params']['id'])?undefined:_0x7aeb6[_0xc73a('0x57')]['id'],'path':_[_0xc73a('0xac')](_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xa6')][0x0][_0xc73a('0xab')])?undefined:_0x7aeb6[_0xc73a('0x62')][_0xc73a('0xa6')][0x0]['path'],'fax':_[_0xc73a('0xac')](_0x7aeb6[_0xc73a('0x62')]['to'][0x0])?undefined:_0x7aeb6[_0xc73a('0x62')]['to'][0x0],'AttachmentId':_0x7aeb6['body'][_0xc73a('0xa6')][0x0]['id']},client9002)['then'](function(_0x5eb01d){logger[_0xc73a('0x25')](_0xc73a('0xb9'),_0x5eb01d);})[_0xc73a('0x56')](function(_0x1e02d6){logger[_0xc73a('0x25')](_0xc73a('0xb9'),_0x1e02d6);});return _0x42763f;})[_0xc73a('0x1d')](respondWithResult(_0x4dc13d,null))[_0xc73a('0x56')](handleError(_0x4dc13d,null));};exports[_0xc73a('0xba')]=function(_0xb5f627,_0x6dfc67,_0xed0d81){return db[_0xc73a('0x3d')][_0xc73a('0x58')]({'where':{'id':_0xb5f627['params']['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x6dfc67,null))['then'](function(_0x357478){if(_0x357478){return _0x357478[_0xc73a('0xba')](_0xb5f627[_0xc73a('0x62')][_0xc73a('0x66')],_['omit'](_0xb5f627[_0xc73a('0x62')],[_0xc73a('0x66'),'id'])||{})[_0xc73a('0xb5')](function(_0x387cda){for(var _0x533edf=0x0;_0x533edf<_0xb5f627['body'][_0xc73a('0x66')][_0xc73a('0x48')];_0x533edf+=0x1){socket[_0xc73a('0xbb')]('userFaxAccount:save',{'UserId':_0xb5f627[_0xc73a('0x62')][_0xc73a('0x66')][_0x533edf],'FaxAccountId':_0xb5f627[_0xc73a('0x57')]['id']});}return _0x387cda;});}})[_0xc73a('0x1d')](respondWithResult(_0x6dfc67,null))['catch'](handleError(_0x6dfc67,null));};exports[_0xc73a('0xbc')]=function(_0x1e5f3e,_0x116f33,_0x48210b){return db[_0xc73a('0x3d')][_0xc73a('0x58')]({'where':{'id':_0x1e5f3e[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x116f33,null))[_0xc73a('0x1d')](function(_0x389cae){if(_0x389cae){return _0x389cae['removeAgents'](_0x1e5f3e['query'][_0xc73a('0x66')])[_0xc73a('0x1d')](function(){if(_[_0xc73a('0xbd')](_0x1e5f3e[_0xc73a('0x42')][_0xc73a('0x66')])){for(var _0x31a23c=0x0;_0x31a23c<_0x1e5f3e[_0xc73a('0x42')][_0xc73a('0x66')][_0xc73a('0x48')];_0x31a23c+=0x1){socket[_0xc73a('0xbb')]('userFaxAccount:remove',{'UserId':Number(_0x1e5f3e['query'][_0xc73a('0x66')][_0x31a23c]),'FaxAccountId':Number(_0x1e5f3e[_0xc73a('0x57')]['id'])});}}else{socket[_0xc73a('0xbb')](_0xc73a('0xbe'),{'UserId':Number(_0x1e5f3e[_0xc73a('0x42')][_0xc73a('0x66')]),'FaxAccountId':Number(_0x1e5f3e['params']['id'])});}});}})[_0xc73a('0x1d')](respondWithStatusCode(_0x116f33,null))[_0xc73a('0x56')](handleError(_0x116f33,null));};exports[_0xc73a('0xbf')]=function(_0xb04bb9,_0x970374,_0x10e5dd){var _0x235b2f={};var _0x46f7bb={};var _0x502a1c;var _0x3ceab6;return db[_0xc73a('0x3d')][_0xc73a('0x65')]({'where':{'id':_0xb04bb9[_0xc73a('0x57')]['id']}})[_0xc73a('0x1d')](handleEntityNotFound(_0x970374,null))[_0xc73a('0x1d')](function(_0x1fae64){if(_0x1fae64){_0x502a1c=_0x1fae64;_0x46f7bb['model']=_['keys'](db['User'][_0xc73a('0x3e')]);_0x46f7bb['query']=_['keys'](_0xb04bb9[_0xc73a('0x42')]);_0x46f7bb[_0xc73a('0x44')]=_[_0xc73a('0x45')](_0x46f7bb[_0xc73a('0x41')],_0x46f7bb[_0xc73a('0x42')]);_0x235b2f[_0xc73a('0x46')]=_['intersection'](_0x46f7bb[_0xc73a('0x41')],qs[_0xc73a('0x47')](_0xb04bb9[_0xc73a('0x42')][_0xc73a('0x47')]));_0x235b2f['attributes']=_0x235b2f[_0xc73a('0x46')][_0xc73a('0x48')]?_0x235b2f[_0xc73a('0x46')]:_0x46f7bb[_0xc73a('0x41')];_0x235b2f['order']=qs['sort'](_0xb04bb9['query'][_0xc73a('0x4b')]);_0x235b2f[_0xc73a('0x4c')]=qs['filters'](_[_0xc73a('0x4d')](_0xb04bb9[_0xc73a('0x42')],_0x46f7bb[_0xc73a('0x44')]));if(_0xb04bb9[_0xc73a('0x42')][_0xc73a('0x4e')]){_0x235b2f[_0xc73a('0x4c')]=_[_0xc73a('0x4f')](_0x235b2f[_0xc73a('0x4c')],{'$or':_[_0xc73a('0x3c')](_0x235b2f[_0xc73a('0x46')],function(_0x5b52f0){var _0x3e1081={};_0x3e1081[_0x5b52f0]={'$like':'%'+_0xb04bb9['query']['filter']+'%'};return _0x3e1081;})});}_0x235b2f=_[_0xc73a('0x4f')]({},_0x235b2f,_0xb04bb9[_0xc73a('0x52')]);return _0x502a1c[_0xc73a('0xbf')](_0x235b2f);}})[_0xc73a('0x1d')](function(_0x236871){if(_0x236871){_0x3ceab6=_0x236871[_0xc73a('0x48')];if(!_0xb04bb9[_0xc73a('0x42')][_0xc73a('0x49')](_0xc73a('0x6a'))){_0x235b2f[_0xc73a('0x2d')]=qs[_0xc73a('0x2d')](_0xb04bb9[_0xc73a('0x42')]['limit']);_0x235b2f['offset']=qs[_0xc73a('0x2c')](_0xb04bb9[_0xc73a('0x42')][_0xc73a('0x2c')]);}return _0x502a1c[_0xc73a('0xbf')](_0x235b2f);}})[_0xc73a('0x1d')](function(_0x4494be){if(_0x4494be){return _0x4494be?{'count':_0x3ceab6,'rows':_0x4494be}:null;}})['then'](respondWithResult(_0x970374,null))[_0xc73a('0x56')](handleError(_0x970374,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 21fa764..666435c 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 _0x4c4e=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4c4e,0x146));var _0xe4c4=function(_0x1b57a2,_0x5db8a1){_0x1b57a2=_0x1b57a2-0x0;var _0x43bdc6=_0x4c4e[_0x1b57a2];return _0x43bdc6;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xe4c4('0x0'))['db'][_0xe4c4('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xe4c4('0x2')](0x0);var events={'afterCreate':_0xe4c4('0x3'),'afterUpdate':_0xe4c4('0x4'),'afterDestroy':_0xe4c4('0x5')};function emitEvent(_0x1c445c){return function(_0x41d084,_0x35c38a,_0x113a52){FaxAccountEvents['emit'](_0x1c445c+':'+_0x41d084['id'],_0x41d084);FaxAccountEvents[_0xe4c4('0x6')](_0x1c445c,_0x41d084);_0x113a52(null);};}for(var e in events){if(events[_0xe4c4('0x7')](e)){var event=events[e];FaxAccount[_0xe4c4('0x8')](e,emitEvent(event));}}module[_0xe4c4('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x23ec=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x32e093,_0x35ac32){var _0x3c5ff6=function(_0x1afdd0){while(--_0x1afdd0){_0x32e093['push'](_0x32e093['shift']());}};_0x3c5ff6(++_0x35ac32);}(_0x23ec,0x164));var _0xc23e=function(_0x24d819,_0x466dcf){_0x24d819=_0x24d819-0x0;var _0x28a949=_0x23ec[_0x24d819];return _0x28a949;};'use strict';var EventEmitter=require(_0xc23e('0x0'));var FaxAccount=require(_0xc23e('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc23e('0x2'),'afterUpdate':_0xc23e('0x3'),'afterDestroy':_0xc23e('0x4')};function emitEvent(_0x2eb75f){return function(_0x541066,_0xff2d62,_0x44d78f){FaxAccountEvents[_0xc23e('0x5')](_0x2eb75f+':'+_0x541066['id'],_0x541066);FaxAccountEvents[_0xc23e('0x5')](_0x2eb75f,_0x541066);_0x44d78f(null);};}for(var e in events){if(events[_0xc23e('0x6')](e)){var event=events[e];FaxAccount[_0xc23e('0x7')](e,emitEvent(event));}}module[_0xc23e('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 302eebc..e7a605e 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 _0xcd8a=['../../config/environment','exports','define','FaxAccount','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x1f1950,_0x8af02d){var _0x17d2e8=function(_0x394041){while(--_0x394041){_0x1f1950['push'](_0x1f1950['shift']());}};_0x17d2e8(++_0x8af02d);}(_0xcd8a,0x1a8));var _0xacd8=function(_0x58e910,_0xe00990){_0x58e910=_0x58e910-0x0;var _0xde413c=_0xcd8a[_0x58e910];return _0xde413c;};'use strict';var _=require(_0xacd8('0x0'));var util=require('util');var logger=require(_0xacd8('0x1'))(_0xacd8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xacd8('0x3'));var fs=require('fs');var path=require(_0xacd8('0x4'));var rimraf=require(_0xacd8('0x5'));var config=require(_0xacd8('0x6'));var attributes=require('./faxAccount.attributes');module[_0xacd8('0x7')]=function(_0x461468,_0x4201cc){return _0x461468[_0xacd8('0x8')](_0xacd8('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c9e=['./faxAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x57968f,_0x325a3d){var _0x590f3b=function(_0x52490a){while(--_0x52490a){_0x57968f['push'](_0x57968f['shift']());}};_0x590f3b(++_0x325a3d);}(_0x7c9e,0x155));var _0xe7c9=function(_0x3084f6,_0x40809a){_0x3084f6=_0x3084f6-0x0;var _0xbcda8d=_0x7c9e[_0x3084f6];return _0xbcda8d;};'use strict';var _=require(_0xe7c9('0x0'));var util=require(_0xe7c9('0x1'));var logger=require(_0xe7c9('0x2'))(_0xe7c9('0x3'));var moment=require(_0xe7c9('0x4'));var BPromise=require(_0xe7c9('0x5'));var rp=require(_0xe7c9('0x6'));var fs=require('fs');var path=require(_0xe7c9('0x7'));var rimraf=require(_0xe7c9('0x8'));var config=require(_0xe7c9('0x9'));var attributes=require(_0xe7c9('0xa'));module[_0xe7c9('0xb')]=function(_0xf252bf,_0x18d6db){return _0xf252bf[_0xe7c9('0xc')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 4d57452..00af42c 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 _0x5b91=['updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','find','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','describe','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b91,0x89));var _0x15b9=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x5b91[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x15b9('0x0'));var util=require('util');var moment=require(_0x15b9('0x1'));var BPromise=require(_0x15b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15b9('0x3'));var db=require(_0x15b9('0x4'))['db'];var utils=require(_0x15b9('0x5'));var logger=require(_0x15b9('0x6'))('rpc');var config=require(_0x15b9('0x7'));var jayson=require(_0x15b9('0x8'));var client=jayson['client'][_0x15b9('0x9')]({'port':0x232c});config['redis']=_[_0x15b9('0xa')](config[_0x15b9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x15b9('0xc'))(new Redis(config[_0x15b9('0xb')]));require('./faxAccount.socket')[_0x15b9('0xd')](socket);function respondWithRpcPromise(_0xee0339,_0x45b7e5,_0x1ef0a3){return new BPromise(function(_0x36d9f2,_0xd1c4b0){return client['request'](_0xee0339,_0x1ef0a3)['then'](function(_0x521ba7){logger[_0x15b9('0xe')](_0x15b9('0xf'),_0x45b7e5,_0x15b9('0x10'));logger[_0x15b9('0x11')](_0x15b9('0x12'),_0x45b7e5,'request\x20sent',JSON[_0x15b9('0x13')](_0x521ba7));if(_0x521ba7[_0x15b9('0x14')]){if(_0x521ba7[_0x15b9('0x14')][_0x15b9('0x15')]===0x1f4){logger[_0x15b9('0x14')](_0x15b9('0xf'),_0x45b7e5,_0x521ba7[_0x15b9('0x14')][_0x15b9('0x16')]);return _0xd1c4b0(_0x521ba7[_0x15b9('0x14')][_0x15b9('0x16')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x45b7e5,_0x521ba7[_0x15b9('0x14')][_0x15b9('0x16')]);return _0x36d9f2(_0x521ba7[_0x15b9('0x14')][_0x15b9('0x16')]);}else{logger[_0x15b9('0xe')]('FaxAccount,\x20%s,\x20%s',_0x45b7e5,_0x15b9('0x10'));_0x36d9f2(_0x521ba7[_0x15b9('0x17')][_0x15b9('0x16')]);}})[_0x15b9('0x18')](function(_0x5ce004){logger[_0x15b9('0x14')]('FaxAccount,\x20%s,\x20%s',_0x45b7e5,_0x5ce004);_0xd1c4b0(_0x5ce004);});});}exports[_0x15b9('0x19')]=function(_0x2b0932){var _0xf31507=this;return new Promise(function(_0x12d76f,_0x444d31){return db[_0x15b9('0x1a')][_0x15b9('0x1b')]({'raw':_0x2b0932[_0x15b9('0x1c')]?_0x2b0932[_0x15b9('0x1c')][_0x15b9('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b0932['options']?_0x2b0932[_0x15b9('0x1c')][_0x15b9('0x1e')]||null:null,'attributes':_0x2b0932[_0x15b9('0x1c')]?_0x2b0932[_0x15b9('0x1c')][_0x15b9('0x1f')]||null:null,'limit':_0x2b0932['options']?_0x2b0932[_0x15b9('0x1c')][_0x15b9('0x20')]||null:null,'include':_0x2b0932['options']?_0x2b0932[_0x15b9('0x1c')][_0x15b9('0x21')]?_[_0x15b9('0x22')](_0x2b0932[_0x15b9('0x1c')]['include'],function(_0xa8767b){return{'model':db[_0xa8767b[_0x15b9('0x23')]],'as':_0xa8767b['as'],'attributes':_0xa8767b[_0x15b9('0x1f')],'include':_0xa8767b[_0x15b9('0x21')]?_[_0x15b9('0x22')](_0xa8767b[_0x15b9('0x21')],function(_0x27b2c7){return{'model':db[_0x27b2c7[_0x15b9('0x23')]],'as':_0x27b2c7['as'],'attributes':_0x27b2c7[_0x15b9('0x1f')],'include':_0x27b2c7[_0x15b9('0x21')]?_[_0x15b9('0x22')](_0x27b2c7[_0x15b9('0x21')],function(_0x327458){return{'model':db[_0x327458['model']],'as':_0x327458['as'],'attributes':_0x327458[_0x15b9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10895e){logger[_0x15b9('0xe')](_0x15b9('0x19'),_0x2b0932);logger['debug'](_0x15b9('0x19'),_0x2b0932,JSON[_0x15b9('0x13')](_0x10895e));_0x12d76f(_0x10895e);})[_0x15b9('0x18')](function(_0x3c53b4){logger['error'](_0x15b9('0x19'),_0x3c53b4[_0x15b9('0x16')],_0x2b0932);_0x444d31(_0xf31507[_0x15b9('0x14')](0x1f4,_0x3c53b4[_0x15b9('0x16')]));});});};exports[_0x15b9('0x24')]=function(_0x245e1e,_0x24bb62,_0x58da76){var _0x3edb00=this;return new Promise(function(_0x360884,_0x23a738){var _0x3f123d={'body':_0x245e1e[_0x15b9('0x25')],'channel':'fax'};var _0x12df86=[];var _0x3d8f92=[];var _0x297c35={};return db[_0x15b9('0x26')][_0x15b9('0x27')]()[_0x15b9('0x28')](function(_0x4a2247){if(!_0x4a2247){throw new db[(_0x15b9('0x29'))][(_0x15b9('0x2a'))](_0x15b9('0x2b'));}_0x12df86=_[_0x15b9('0x2c')](_[_0x15b9('0x2d')](_0x4a2247),[_0x15b9('0x2e'),_0x15b9('0x2f')]);_0x3d8f92=_[_0x15b9('0x2c')](_['keys'](_0x4a2247),[_0x15b9('0x2e'),_0x15b9('0x2f'),_0x15b9('0x30'),_0x15b9('0x31')]);if(_0x245e1e[_0x15b9('0x25')]['id']){delete _0x245e1e[_0x15b9('0x25')]['id'];}if(_[_0x15b9('0x32')](_0x245e1e[_0x15b9('0x25')][_0x15b9('0x33')])){throw new db[(_0x15b9('0x29'))][(_0x15b9('0x2a'))](_0x15b9('0x34'));}if(_['isNil'](_0x245e1e[_0x15b9('0x25')][_0x15b9('0x25')])||_0x245e1e[_0x15b9('0x25')][_0x15b9('0x25')]===''){throw new db[(_0x15b9('0x29'))][(_0x15b9('0x2a'))](_0x15b9('0x35'));}if(_[_0x15b9('0x32')](_0x245e1e['body'][_0x15b9('0x36')])){throw new db[(_0x15b9('0x29'))][(_0x15b9('0x2a'))](_0x15b9('0x37')+_0x3d8f92);}if(!_[_0x15b9('0x38')](_0x3d8f92,_0x245e1e[_0x15b9('0x25')][_0x15b9('0x36')])){throw new db[(_0x15b9('0x29'))]['ValidationError'](_0x15b9('0x39')+_0x3d8f92);}_0x297c35[_0x245e1e['body']['mapKey']]=_0x245e1e[_0x15b9('0x25')][_0x15b9('0x33')];})['then'](function(){return db[_0x15b9('0x1a')]['find']({'where':{'id':_0x245e1e[_0x15b9('0x3a')]['id']},'include':[{'model':db[_0x15b9('0x3b')],'as':_0x15b9('0x3c'),'include':[{'model':db[_0x15b9('0x26')],'as':_0x15b9('0x3d'),'where':_0x297c35,'limit':0x1,'order':[[_0x15b9('0x2f'),'DESC']]}]},{'model':db[_0x15b9('0x3e')],'as':_0x15b9('0x3f')}]});})['then'](function(_0x1028ec){if(_0x1028ec&&_0x1028ec['List']){var _0xca07f6=_0x1028ec[_0x15b9('0x40')]({'plain':!![]});_0x3f123d[_0x15b9('0x3a')]=_0xca07f6;_0x3f123d[_0x15b9('0x41')]=_0xca07f6[_0x15b9('0x3f')];_0x3f123d[_0x15b9('0x42')]=_0xca07f6['List'];_0x3f123d[_0x15b9('0x41')]=_[_0x15b9('0x43')](_0x3f123d[_0x15b9('0x41')],[_0x15b9('0x44')],[_0x15b9('0x45')]);if(_0x3f123d[_0x15b9('0x3a')][_0x15b9('0x3f')]){delete _0x3f123d[_0x15b9('0x3a')][_0x15b9('0x3f')];}if(_0x3f123d[_0x15b9('0x3a')][_0x15b9('0x3c')]&&_0x3f123d[_0x15b9('0x3a')][_0x15b9('0x3c')][_0x15b9('0x3d')][_0x15b9('0x46')]){return _0x3f123d[_0x15b9('0x3a')][_0x15b9('0x3c')][_0x15b9('0x3d')][0x0];}var _0x116cfa=_['defaults'](_0x245e1e[_0x15b9('0x25')],{'firstName':_0x245e1e['body'][_0x15b9('0x33')],'ListId':_0xca07f6[_0x15b9('0x31')]});_0x116cfa[_0x245e1e[_0x15b9('0x25')][_0x15b9('0x36')]]=_0x245e1e[_0x15b9('0x25')][_0x15b9('0x33')];return db[_0x15b9('0x26')][_0x15b9('0x47')](_0x116cfa,{'fields':_0x12df86,'raw':!![]});}})[_0x15b9('0x28')](function(_0x3e0a82){_0x3f123d[_0x15b9('0x48')]=_0x3e0a82;if(_0x3e0a82){var _0x4be747={'ContactId':_0x3e0a82['id'],'FaxAccountId':_0x245e1e[_0x15b9('0x3a')]['id'],'fax':_0x3e0a82[_0x15b9('0x49')]};return db[_0x15b9('0x4a')]['find']({'where':{'ContactId':_0x3e0a82['id'],'closed':![],'FaxAccountId':_0x245e1e[_0x15b9('0x3a')]['id']}})[_0x15b9('0x28')](function(_0x3fdc00){if(_0x3fdc00){return[_0x3fdc00,![]];}return db['FaxInteraction']['create'](_0x4be747)[_0x15b9('0x28')](function(_0x41e458){return[_0x41e458,!![]];});});}else{throw new Error(_0x15b9('0x4b'));}})[_0x15b9('0x4c')](function(_0x2687ec,_0x427cef){var _0xe7982b=_0x2687ec['get']({'plain':!![]});if(_0x427cef){if(_0x3f123d[_0x15b9('0x3a')][_0x15b9('0x4d')]){_0x3f123d['applications'][_0x15b9('0x4e')]({'id':0x0,'priority':_0x3f123d[_0x15b9('0x41')][_0x15b9('0x46')]+0x1,'app':_0x15b9('0x4f'),'appdata':_0x15b9('0x50'),'interval':'*,*,*,*'});}_0xe7982b[_0x15b9('0x51')]=!![];}else{_0xe7982b[_0x15b9('0x51')]=![];}_0x3f123d[_0x15b9('0x52')]=_0xe7982b;return db[_0x15b9('0x53')][_0x15b9('0x47')]({'body':_0x245e1e[_0x15b9('0x25')][_0x15b9('0x25')],'FaxAccountId':_0x245e1e['account']['id'],'FaxInteractionId':_0x2687ec['id'],'direction':'in','ContactId':_0x2687ec[_0x15b9('0x54')],'AttachmentId':_0x245e1e[_0x15b9('0x25')][_0x15b9('0x55')]});})['then'](function(_0x49c13b){_0x3f123d[_0x15b9('0x16')]=_0x49c13b;if(_0x3f123d[_0x15b9('0x52')]['UserId']){return db['User'][_0x15b9('0x56')]({'attributes':['id',_0x15b9('0x57')],'where':{'id':_0x3f123d[_0x15b9('0x52')]['UserId']}})[_0x15b9('0x28')](function(_0x33b71c){if(_0x33b71c){_0x3f123d[_0x15b9('0x41')][_0x15b9('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x33b71c[_0x15b9('0x57')]+','+(_0x3f123d[_0x15b9('0x3a')][_0x15b9('0x59')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x15b9('0x5a'),_0x15b9('0x5b'),_0x3f123d);});}return respondWithRpcPromise(_0x15b9('0x5a'),_0x15b9('0x5b'),_0x3f123d);})['then'](function(_0x21bc68){_0x360884(_0x21bc68);})[_0x15b9('0x18')](function(_0x39105e){_0x23a738(_0x3edb00[_0x15b9('0x14')](0x1f4,_0x39105e[_0x15b9('0x16')]));});});}; \ No newline at end of file +var _0xc081=['account','List','DESC','get','applications','priority','asc','Applications','length','create','find','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','AttachmentId','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','info','debug','NotifyFaxAccount','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x35c5dd,_0x2fd0a2){var _0x4563c8=function(_0x102b47){while(--_0x102b47){_0x35c5dd['push'](_0x35c5dd['shift']());}};_0x4563c8(++_0x2fd0a2);}(_0xc081,0x71));var _0x1c08=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xc081[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require('lodash');var util=require(_0x1c08('0x0'));var moment=require(_0x1c08('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c08('0x2'));var fs=require('fs');var Redis=require(_0x1c08('0x3'));var db=require(_0x1c08('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1c08('0x5'));var config=require(_0x1c08('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1c08('0x7')]['http']({'port':0x232c});config[_0x1c08('0x8')]=_[_0x1c08('0x9')](config[_0x1c08('0x8')],{'host':_0x1c08('0xa'),'port':0x18eb});var socket=require(_0x1c08('0xb'))(new Redis(config['redis']));require(_0x1c08('0xc'))[_0x1c08('0xd')](socket);function respondWithRpcPromise(_0x30fa9f,_0x24fc9a,_0x456b2d){return new BPromise(function(_0x5bdbdd,_0x1b7071){return client[_0x1c08('0xe')](_0x30fa9f,_0x456b2d)[_0x1c08('0xf')](function(_0x5c892f){logger['info'](_0x1c08('0x10'),_0x24fc9a,'request\x20sent');logger['debug'](_0x1c08('0x11'),_0x24fc9a,'request\x20sent',JSON[_0x1c08('0x12')](_0x5c892f));if(_0x5c892f[_0x1c08('0x13')]){if(_0x5c892f['error'][_0x1c08('0x14')]===0x1f4){logger['error'](_0x1c08('0x10'),_0x24fc9a,_0x5c892f[_0x1c08('0x13')][_0x1c08('0x15')]);return _0x1b7071(_0x5c892f['error'][_0x1c08('0x15')]);}logger[_0x1c08('0x13')]('FaxAccount,\x20%s,\x20%s',_0x24fc9a,_0x5c892f[_0x1c08('0x13')][_0x1c08('0x15')]);return _0x5bdbdd(_0x5c892f[_0x1c08('0x13')][_0x1c08('0x15')]);}else{logger['info'](_0x1c08('0x10'),_0x24fc9a,_0x1c08('0x16'));_0x5bdbdd(_0x5c892f['result']['message']);}})[_0x1c08('0x17')](function(_0x28aaeb){logger[_0x1c08('0x13')](_0x1c08('0x10'),_0x24fc9a,_0x28aaeb);_0x1b7071(_0x28aaeb);});});}exports[_0x1c08('0x18')]=function(_0x59fb7a){var _0x14d8d7=this;return new Promise(function(_0x3c2701,_0x1af735){return db[_0x1c08('0x19')][_0x1c08('0x1a')]({'raw':_0x59fb7a[_0x1c08('0x1b')]?_0x59fb7a['options']['raw']===undefined?!![]:![]:!![],'where':_0x59fb7a['options']?_0x59fb7a[_0x1c08('0x1b')][_0x1c08('0x1c')]||null:null,'attributes':_0x59fb7a[_0x1c08('0x1b')]?_0x59fb7a[_0x1c08('0x1b')][_0x1c08('0x1d')]||null:null,'limit':_0x59fb7a[_0x1c08('0x1b')]?_0x59fb7a[_0x1c08('0x1b')][_0x1c08('0x1e')]||null:null,'include':_0x59fb7a[_0x1c08('0x1b')]?_0x59fb7a[_0x1c08('0x1b')][_0x1c08('0x1f')]?_[_0x1c08('0x20')](_0x59fb7a['options']['include'],function(_0x3b32a6){return{'model':db[_0x3b32a6['model']],'as':_0x3b32a6['as'],'attributes':_0x3b32a6['attributes'],'include':_0x3b32a6[_0x1c08('0x1f')]?_[_0x1c08('0x20')](_0x3b32a6[_0x1c08('0x1f')],function(_0x56d718){return{'model':db[_0x56d718[_0x1c08('0x21')]],'as':_0x56d718['as'],'attributes':_0x56d718[_0x1c08('0x1d')],'include':_0x56d718[_0x1c08('0x1f')]?_[_0x1c08('0x20')](_0x56d718[_0x1c08('0x1f')],function(_0x3663a0){return{'model':db[_0x3663a0['model']],'as':_0x3663a0['as'],'attributes':_0x3663a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c08('0xf')](function(_0x385888){logger[_0x1c08('0x22')]('GetFaxAccount',_0x59fb7a);logger[_0x1c08('0x23')](_0x1c08('0x18'),_0x59fb7a,JSON['stringify'](_0x385888));_0x3c2701(_0x385888);})[_0x1c08('0x17')](function(_0x1c48d6){logger[_0x1c08('0x13')]('GetFaxAccount',_0x1c48d6['message'],_0x59fb7a);_0x1af735(_0x14d8d7['error'](0x1f4,_0x1c48d6[_0x1c08('0x15')]));});});};exports[_0x1c08('0x24')]=function(_0x215e69,_0x28d966,_0x6e188c){var _0x597f3c=this;return new Promise(function(_0x43d9ee,_0x2a4ee9){var _0x1e7566={'body':_0x215e69['body'],'channel':_0x1c08('0x25')};var _0x834bdf=[];var _0x5b0266=[];var _0x43dbd7={};return db[_0x1c08('0x26')][_0x1c08('0x27')]()['then'](function(_0x5be5c9){if(!_0x5be5c9){throw new db[(_0x1c08('0x28'))]['ValidationError'](_0x1c08('0x29'));}_0x834bdf=_[_0x1c08('0x2a')](_[_0x1c08('0x2b')](_0x5be5c9),[_0x1c08('0x2c'),_0x1c08('0x2d')]);_0x5b0266=_[_0x1c08('0x2a')](_['keys'](_0x5be5c9),[_0x1c08('0x2c'),_0x1c08('0x2d'),_0x1c08('0x2e'),_0x1c08('0x2f')]);if(_0x215e69[_0x1c08('0x30')]['id']){delete _0x215e69[_0x1c08('0x30')]['id'];}if(_[_0x1c08('0x31')](_0x215e69[_0x1c08('0x30')][_0x1c08('0x32')])){throw new db[(_0x1c08('0x28'))][(_0x1c08('0x33'))](_0x1c08('0x34'));}if(_['isNil'](_0x215e69[_0x1c08('0x30')]['body'])||_0x215e69[_0x1c08('0x30')][_0x1c08('0x30')]===''){throw new db[(_0x1c08('0x28'))][(_0x1c08('0x33'))](_0x1c08('0x35'));}if(_[_0x1c08('0x31')](_0x215e69[_0x1c08('0x30')][_0x1c08('0x36')])){throw new db[(_0x1c08('0x28'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b0266);}if(!_[_0x1c08('0x37')](_0x5b0266,_0x215e69[_0x1c08('0x30')][_0x1c08('0x36')])){throw new db[(_0x1c08('0x28'))][(_0x1c08('0x33'))](_0x1c08('0x38')+_0x5b0266);}_0x43dbd7[_0x215e69[_0x1c08('0x30')]['mapKey']]=_0x215e69[_0x1c08('0x30')][_0x1c08('0x32')];})[_0x1c08('0xf')](function(){return db[_0x1c08('0x19')]['find']({'where':{'id':_0x215e69[_0x1c08('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x1c08('0x3a'),'include':[{'model':db[_0x1c08('0x26')],'as':'Contacts','where':_0x43dbd7,'limit':0x1,'order':[[_0x1c08('0x2d'),_0x1c08('0x3b')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})['then'](function(_0x3d04f9){if(_0x3d04f9&&_0x3d04f9[_0x1c08('0x3a')]){var _0x596fed=_0x3d04f9[_0x1c08('0x3c')]({'plain':!![]});_0x1e7566[_0x1c08('0x39')]=_0x596fed;_0x1e7566['applications']=_0x596fed['Applications'];_0x1e7566['list']=_0x596fed['List'];_0x1e7566[_0x1c08('0x3d')]=_['orderBy'](_0x1e7566[_0x1c08('0x3d')],[_0x1c08('0x3e')],[_0x1c08('0x3f')]);if(_0x1e7566[_0x1c08('0x39')]['Applications']){delete _0x1e7566['account'][_0x1c08('0x40')];}if(_0x1e7566[_0x1c08('0x39')]['List']&&_0x1e7566[_0x1c08('0x39')][_0x1c08('0x3a')]['Contacts'][_0x1c08('0x41')]){return _0x1e7566['account']['List']['Contacts'][0x0];}var _0x439aaf=_[_0x1c08('0x9')](_0x215e69[_0x1c08('0x30')],{'firstName':_0x215e69[_0x1c08('0x30')]['from'],'ListId':_0x596fed[_0x1c08('0x2f')]});_0x439aaf[_0x215e69[_0x1c08('0x30')]['mapKey']]=_0x215e69[_0x1c08('0x30')][_0x1c08('0x32')];return db[_0x1c08('0x26')][_0x1c08('0x42')](_0x439aaf,{'fields':_0x834bdf,'raw':!![]});}})['then'](function(_0xdb3918){_0x1e7566['contact']=_0xdb3918;if(_0xdb3918){var _0x88fb5d={'ContactId':_0xdb3918['id'],'FaxAccountId':_0x215e69[_0x1c08('0x39')]['id'],'fax':_0xdb3918[_0x1c08('0x25')]};return db['FaxInteraction'][_0x1c08('0x43')]({'where':{'ContactId':_0xdb3918['id'],'closed':![],'FaxAccountId':_0x215e69[_0x1c08('0x39')]['id']}})[_0x1c08('0xf')](function(_0x22b590){if(_0x22b590){return[_0x22b590,![]];}return db['FaxInteraction'][_0x1c08('0x42')](_0x88fb5d)[_0x1c08('0xf')](function(_0x46b98f){return[_0x46b98f,!![]];});});}else{throw new Error(_0x1c08('0x44'));}})[_0x1c08('0x45')](function(_0x4ee578,_0x1f3069){var _0x2d077f=_0x4ee578[_0x1c08('0x3c')]({'plain':!![]});if(_0x1f3069){if(_0x1e7566[_0x1c08('0x39')][_0x1c08('0x46')]){_0x1e7566[_0x1c08('0x3d')][_0x1c08('0x47')]({'id':0x0,'priority':_0x1e7566['applications']['length']+0x1,'app':_0x1c08('0x48'),'appdata':_0x1c08('0x49'),'interval':_0x1c08('0x4a')});}_0x2d077f[_0x1c08('0x4b')]=!![];}else{_0x2d077f[_0x1c08('0x4b')]=![];}_0x1e7566[_0x1c08('0x4c')]=_0x2d077f;return db['FaxMessage'][_0x1c08('0x42')]({'body':_0x215e69[_0x1c08('0x30')][_0x1c08('0x30')],'FaxAccountId':_0x215e69[_0x1c08('0x39')]['id'],'FaxInteractionId':_0x4ee578['id'],'direction':'in','ContactId':_0x4ee578['ContactId'],'AttachmentId':_0x215e69[_0x1c08('0x30')][_0x1c08('0x4d')]});})[_0x1c08('0xf')](function(_0x403258){_0x1e7566[_0x1c08('0x15')]=_0x403258;if(_0x1e7566['interaction'][_0x1c08('0x4e')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x1e7566['interaction'][_0x1c08('0x4e')]}})[_0x1c08('0xf')](function(_0x47183d){if(_0x47183d){_0x1e7566[_0x1c08('0x3d')][_0x1c08('0x4f')]({'id':0x0,'priority':0x0,'app':_0x1c08('0x50'),'appdata':_0x47183d[_0x1c08('0x51')]+','+(_0x1e7566['account'][_0x1c08('0x52')]||0xa),'interval':_0x1c08('0x4a')});}return respondWithRpcPromise(_0x1c08('0x53'),'startRouting',_0x1e7566);});}return respondWithRpcPromise(_0x1c08('0x53'),_0x1c08('0x54'),_0x1e7566);})[_0x1c08('0xf')](function(_0x10d25e){_0x43d9ee(_0x10d25e);})[_0x1c08('0x17')](function(_0x4216d1){_0x2a4ee9(_0x597f3c['error'](0x1f4,_0x4216d1[_0x1c08('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c6466f3..5caffde 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 _0xda2d=['remove','update','removeListener','register','length','faxAccount:','save'];(function(_0x4b872d,_0x3da0da){var _0x1708b2=function(_0x3c240e){while(--_0x3c240e){_0x4b872d['push'](_0x4b872d['shift']());}};_0x1708b2(++_0x3da0da);}(_0xda2d,0x102));var _0xdda2=function(_0x23c1b2,_0x5b865f){_0x23c1b2=_0x23c1b2-0x0;var _0x5db67c=_0xda2d[_0x23c1b2];return _0x5db67c;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2')];function createListener(_0x1f1fcc,_0x329c5e){return function(_0x58973d){_0x329c5e['emit'](_0x1f1fcc,_0x58973d);};}function removeListener(_0x5a5f9f,_0x357e97){return function(){FaxAccountEvents[_0xdda2('0x3')](_0x5a5f9f,_0x357e97);};}exports[_0xdda2('0x4')]=function(_0x39f6c9){for(var _0xc256bc=0x0,_0xf38e58=events[_0xdda2('0x5')];_0xc256bc<_0xf38e58;_0xc256bc++){var _0x436676=events[_0xc256bc];var _0x2e2523=createListener(_0xdda2('0x6')+_0x436676,_0x39f6c9);FaxAccountEvents['on'](_0x436676,_0x2e2523);}}; \ No newline at end of file +var _0xe5af=['faxAccount:','save','remove','register','length'];(function(_0x40deb8,_0xc72268){var _0x1cacc0=function(_0xc0058f){while(--_0xc0058f){_0x40deb8['push'](_0x40deb8['shift']());}};_0x1cacc0(++_0xc72268);}(_0xe5af,0x9c));var _0xfe5a=function(_0xa754ec,_0x13eb35){_0xa754ec=_0xa754ec-0x0;var _0x494eb8=_0xe5af[_0xa754ec];return _0x494eb8;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xfe5a('0x0'),_0xfe5a('0x1'),'update'];function createListener(_0x9a3743,_0x1bad12){return function(_0x23b7f0){_0x1bad12['emit'](_0x9a3743,_0x23b7f0);};}function removeListener(_0x1165e3,_0x48e3a7){return function(){FaxAccountEvents['removeListener'](_0x1165e3,_0x48e3a7);};}exports[_0xfe5a('0x2')]=function(_0x2039cd){for(var _0x4e418f=0x0,_0x5eea2e=events[_0xfe5a('0x3')];_0x4e418f<_0x5eea2e;_0x4e418f++){var _0x106492=events[_0x4e418f];var _0xfb4357=createListener(_0xfe5a('0x4')+_0x106492,_0x2039cd);FaxAccountEvents['on'](_0x106492,_0xfb4357);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7caac9c..7d5bd1a 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 _0x29e6=['isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x29e6,0x78));var _0x629e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x29e6[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x629e('0x0'));var path=require('path');var timeout=require(_0x629e('0x1'));var express=require(_0x629e('0x2'));var router=express['Router']();var auth=require(_0x629e('0x3'));var interaction=require(_0x629e('0x4'));var config=require(_0x629e('0x5'));var controller=require('./faxAccount.controller');router[_0x629e('0x6')]('/',auth['isAuthenticated'](),controller[_0x629e('0x7')]);router['get'](_0x629e('0x8'),auth[_0x629e('0x9')](),controller[_0x629e('0xa')]);router['get'](_0x629e('0xb'),auth[_0x629e('0x9')](),controller[_0x629e('0xc')]);router[_0x629e('0x6')](_0x629e('0xd'),auth[_0x629e('0x9')](),controller[_0x629e('0xe')]);router['get'](_0x629e('0xf'),auth[_0x629e('0x9')](),controller[_0x629e('0x10')]);router[_0x629e('0x6')](_0x629e('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x629e('0x6')](_0x629e('0x12'),auth[_0x629e('0x9')](),controller[_0x629e('0x13')]);router[_0x629e('0x6')](_0x629e('0x14'),auth[_0x629e('0x9')](),controller[_0x629e('0x15')]);router[_0x629e('0x6')](_0x629e('0x16'),auth[_0x629e('0x9')](),controller[_0x629e('0x17')]);router[_0x629e('0x18')]('/',auth[_0x629e('0x9')](),controller[_0x629e('0x19')]);router['post'](_0x629e('0xd'),auth[_0x629e('0x9')](),controller[_0x629e('0x1a')]);router['post'](_0x629e('0xf'),auth[_0x629e('0x9')](),controller[_0x629e('0x1b')]);router[_0x629e('0x18')]('/:id/interactions',auth[_0x629e('0x9')](),controller[_0x629e('0x1c')]);router[_0x629e('0x18')](_0x629e('0x12'),auth['isAuthenticated'](),controller[_0x629e('0x1d')]);router['post'](_0x629e('0x1e'),auth[_0x629e('0x9')](),controller[_0x629e('0x1f')]);router['post'](_0x629e('0x20'),auth[_0x629e('0x9')](),controller[_0x629e('0x21')]);router['post']('/:id/send',auth[_0x629e('0x9')](),controller[_0x629e('0x22')]);router[_0x629e('0x18')]('/:id/users',auth[_0x629e('0x9')](),controller[_0x629e('0x23')]);router[_0x629e('0x24')]('/:id',auth['isAuthenticated'](),controller[_0x629e('0x25')]);router[_0x629e('0x26')](_0x629e('0xb'),auth['isAuthenticated'](),controller[_0x629e('0x27')]);router[_0x629e('0x26')](_0x629e('0xd'),auth[_0x629e('0x9')](),controller[_0x629e('0x28')]);router[_0x629e('0x26')](_0x629e('0xf'),auth[_0x629e('0x9')](),controller[_0x629e('0x29')]);router[_0x629e('0x26')](_0x629e('0x16'),auth['isAuthenticated'](),controller[_0x629e('0x2a')]);module['exports']=router; \ No newline at end of file +var _0xd152=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','addDisposition','addApplications','addAccountApplications','updateAccountApplications','/:id/send','/:id/users','addAgents','put','/:id','delete','destroy','removeAnswers','removeAgents','multer'];(function(_0xc2f2bc,_0x58574c){var _0x4226b6=function(_0x391372){while(--_0x391372){_0xc2f2bc['push'](_0xc2f2bc['shift']());}};_0x4226b6(++_0x58574c);}(_0xd152,0x185));var _0x2d15=function(_0x56daf9,_0x3f21a6){_0x56daf9=_0x56daf9-0x0;var _0x55bae9=_0xd152[_0x56daf9];return _0x55bae9;};'use strict';var multer=require(_0x2d15('0x0'));var util=require(_0x2d15('0x1'));var path=require('path');var timeout=require(_0x2d15('0x2'));var express=require(_0x2d15('0x3'));var router=express['Router']();var auth=require(_0x2d15('0x4'));var interaction=require(_0x2d15('0x5'));var config=require(_0x2d15('0x6'));var controller=require(_0x2d15('0x7'));router[_0x2d15('0x8')]('/',auth[_0x2d15('0x9')](),controller[_0x2d15('0xa')]);router[_0x2d15('0x8')](_0x2d15('0xb'),auth[_0x2d15('0x9')](),controller[_0x2d15('0xc')]);router[_0x2d15('0x8')]('/:id',auth[_0x2d15('0x9')](),controller[_0x2d15('0xd')]);router[_0x2d15('0x8')](_0x2d15('0xe'),auth[_0x2d15('0x9')](),controller[_0x2d15('0xf')]);router[_0x2d15('0x8')](_0x2d15('0x10'),auth[_0x2d15('0x9')](),controller[_0x2d15('0x11')]);router[_0x2d15('0x8')](_0x2d15('0x12'),auth[_0x2d15('0x9')](),controller[_0x2d15('0x13')]);router[_0x2d15('0x8')](_0x2d15('0x14'),auth[_0x2d15('0x9')](),controller[_0x2d15('0x15')]);router[_0x2d15('0x8')](_0x2d15('0x16'),auth[_0x2d15('0x9')](),controller[_0x2d15('0x17')]);router[_0x2d15('0x8')]('/:id/users',auth[_0x2d15('0x9')](),controller[_0x2d15('0x18')]);router[_0x2d15('0x19')]('/',auth[_0x2d15('0x9')](),controller['create']);router['post'](_0x2d15('0xe'),auth[_0x2d15('0x9')](),controller[_0x2d15('0x1a')]);router['post'](_0x2d15('0x10'),auth[_0x2d15('0x9')](),controller['addAnswer']);router[_0x2d15('0x19')](_0x2d15('0x12'),auth[_0x2d15('0x9')](),controller['addInteraction']);router['post'](_0x2d15('0x14'),auth[_0x2d15('0x9')](),controller[_0x2d15('0x1b')]);router[_0x2d15('0x19')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0x2d15('0x1c')]);router[_0x2d15('0x19')]('/updateaccountapplications',auth[_0x2d15('0x9')](),controller[_0x2d15('0x1d')]);router[_0x2d15('0x19')](_0x2d15('0x1e'),auth['isAuthenticated'](),controller['send']);router[_0x2d15('0x19')](_0x2d15('0x1f'),auth['isAuthenticated'](),controller[_0x2d15('0x20')]);router[_0x2d15('0x21')](_0x2d15('0x22'),auth[_0x2d15('0x9')](),controller['update']);router[_0x2d15('0x23')](_0x2d15('0x22'),auth[_0x2d15('0x9')](),controller[_0x2d15('0x24')]);router[_0x2d15('0x23')]('/:id/dispositions',auth[_0x2d15('0x9')](),controller['removeDispositions']);router[_0x2d15('0x23')]('/:id/canned_answers',auth[_0x2d15('0x9')](),controller[_0x2d15('0x25')]);router[_0x2d15('0x23')](_0x2d15('0x1f'),auth[_0x2d15('0x9')](),controller[_0x2d15('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 2aea618..a33d0dc 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 _0xd9d6=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd9d6,0x19c));var _0x6d9d=function(_0x253bd2,_0x4e88ff){_0x253bd2=_0x253bd2-0x0;var _0x457ff9=_0xd9d6[_0x253bd2];return _0x457ff9;};'use strict';var Sequelize=require(_0x6d9d('0x0'));module[_0x6d9d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6d9d('0x2')],'allowNull':![],'defaultValue':_0x6d9d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6d9d('0x4')}}; \ No newline at end of file +var _0x5fe0=['INTEGER','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x23653e,_0x38328e){var _0x431c17=function(_0x5c1a12){while(--_0x5c1a12){_0x23653e['push'](_0x23653e['shift']());}};_0x431c17(++_0x38328e);}(_0x5fe0,0xe8));var _0x05fe=function(_0x5c4b01,_0x74b53c){_0x5c4b01=_0x5c4b01-0x0;var _0x4ae3a5=_0x5fe0[_0x5c4b01];return _0x4ae3a5;};'use strict';var Sequelize=require(_0x05fe('0x0'));module[_0x05fe('0x1')]={'priority':{'type':Sequelize[_0x05fe('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x05fe('0x3')},'appdata':{'type':Sequelize[_0x05fe('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x05fe('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ae5148e..9df2b5a 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 _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x7ab570,_0x5581de){var _0x555a22=function(_0xeb8a14){while(--_0xeb8a14){_0x7ab570['push'](_0x7ab570['shift']());}};_0x555a22(++_0x5581de);}(_0x8ef6,0xf2));var _0x68ef=function(_0xf4566,_0x14eeb2){_0xf4566=_0xf4566-0x0;var _0x5ca357=_0x8ef6[_0xf4566];return _0x5ca357;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file +var _0xabce=['offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','FaxApplication','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xabce,0x103));var _0xeabc=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xabce[_0x31cb5f];return _0x586042;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];function respondWithStatusCode(_0x435ea7,_0x3fd0b5){_0x3fd0b5=_0x3fd0b5||0xcc;return function(_0x36a92e){if(_0x36a92e){return _0x435ea7[_0xeabc('0x19')](_0x3fd0b5);}return _0x435ea7['status'](_0x3fd0b5)[_0xeabc('0x1a')]();};}function respondWithResult(_0x1319f3,_0x3251c6){_0x3251c6=_0x3251c6||0xc8;return function(_0x55f0de){if(_0x55f0de){return _0x1319f3['status'](_0x3251c6)[_0xeabc('0x1b')](_0x55f0de);}};}function respondWithFilteredResult(_0x3ae954,_0x326bac){return function(_0x53d5cb){if(_0x53d5cb){var _0xf913d7=_0x53d5cb[_0xeabc('0x1c')],_0x638976=_0x326bac['offset'],_0x49f2d8=_0x326bac[_0xeabc('0x1d')]+_0x326bac[_0xeabc('0x1e')],_0x53fe28;if(_0x49f2d8>=_0xf913d7){_0x49f2d8=_0xf913d7;_0x53fe28=0xc8;}else{_0x53fe28=0xce;}_0x3ae954[_0xeabc('0x1f')](_0x53fe28);return _0x3ae954[_0xeabc('0x20')](_0xeabc('0x21'),_0x638976+'-'+_0x49f2d8+'/'+_0xf913d7)[_0xeabc('0x1b')](_0x53d5cb);}return null;};}function patchUpdates(_0x384be5){return function(_0x5e30ee){try{jsonpatch['apply'](_0x5e30ee,_0x384be5,!![]);}catch(_0x1253e4){return BPromise['reject'](_0x1253e4);}return _0x5e30ee[_0xeabc('0x22')]();};}function saveUpdates(_0x16530c,_0x502947){return function(_0x28063a){if(_0x28063a){return _0x28063a[_0xeabc('0x23')](_0x16530c)[_0xeabc('0x24')](function(_0x184e60){return _0x184e60;});}return null;};}function removeEntity(_0x3c9611,_0x4e99a4){return function(_0xecdbf){if(_0xecdbf){return _0xecdbf[_0xeabc('0x25')]()[_0xeabc('0x24')](function(){_0x3c9611['status'](0xcc)[_0xeabc('0x1a')]();});}};}function handleEntityNotFound(_0x3854d2,_0x214953){return function(_0x319119){if(!_0x319119){_0x3854d2['sendStatus'](0x194);}return _0x319119;};}function handleError(_0x109e1d,_0x480440){_0x480440=_0x480440||0x1f4;return function(_0x27dbaf){logger['error'](_0x27dbaf[_0xeabc('0x26')]);if(_0x27dbaf[_0xeabc('0x27')]){delete _0x27dbaf[_0xeabc('0x27')];}_0x109e1d[_0xeabc('0x1f')](_0x480440)[_0xeabc('0x28')](_0x27dbaf);};}exports[_0xeabc('0x29')]=function(_0x131722,_0x4c2693){var _0x5b2934={},_0x459c8a={},_0x5bf8f2={'count':0x0,'rows':[]};var _0x3c1b5b=_[_0xeabc('0x2a')](db['FaxApplication'][_0xeabc('0x2b')],function(_0x38572d){return{'name':_0x38572d[_0xeabc('0x2c')],'type':_0x38572d[_0xeabc('0x2d')][_0xeabc('0x2e')]};});_0x459c8a[_0xeabc('0x2f')]=_[_0xeabc('0x2a')](_0x3c1b5b,_0xeabc('0x27'));_0x459c8a[_0xeabc('0x30')]=_['keys'](_0x131722[_0xeabc('0x30')]);_0x459c8a['filters']=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],_0x459c8a[_0xeabc('0x30')]);_0x5b2934[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x131722['query'][_0xeabc('0x33')]));_0x5b2934[_0xeabc('0x32')]=_0x5b2934[_0xeabc('0x32')]['length']?_0x5b2934[_0xeabc('0x32')]:_0x459c8a[_0xeabc('0x2f')];if(!_0x131722[_0xeabc('0x30')]['hasOwnProperty'](_0xeabc('0x34'))){_0x5b2934[_0xeabc('0x1e')]=qs[_0xeabc('0x1e')](_0x131722['query'][_0xeabc('0x1e')]);_0x5b2934[_0xeabc('0x1d')]=qs['offset'](_0x131722['query'][_0xeabc('0x1d')]);}_0x5b2934[_0xeabc('0x35')]=qs['sort'](_0x131722[_0xeabc('0x30')][_0xeabc('0x36')]);_0x5b2934[_0xeabc('0x37')]=qs[_0xeabc('0x38')](_[_0xeabc('0x39')](_0x131722['query'],_0x459c8a[_0xeabc('0x38')]),_0x3c1b5b);if(_0x131722['query'][_0xeabc('0x3a')]){_0x5b2934[_0xeabc('0x37')]=_[_0xeabc('0x3b')](_0x5b2934['where'],{'$or':_['map'](_0x3c1b5b,function(_0x452580){if(_0x452580['type']!==_0xeabc('0x3c')){var _0x4ebd64={};_0x4ebd64[_0x452580['name']]={'$like':'%'+_0x131722['query']['filter']+'%'};return _0x4ebd64;}})});}_0x5b2934=_[_0xeabc('0x3b')]({},_0x5b2934,_0x131722['options']);var _0x257fe8={'where':_0x5b2934[_0xeabc('0x37')]};return db['FaxApplication'][_0xeabc('0x1c')](_0x257fe8)['then'](function(_0x3d48f4){_0x5bf8f2['count']=_0x3d48f4;if(_0x131722[_0xeabc('0x30')][_0xeabc('0x3d')]){_0x5b2934[_0xeabc('0x3e')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5b2934);})['then'](function(_0x46056c){_0x5bf8f2[_0xeabc('0x3f')]=_0x46056c;return _0x5bf8f2;})[_0xeabc('0x24')](respondWithFilteredResult(_0x4c2693,_0x5b2934))['catch'](handleError(_0x4c2693,null));};exports['show']=function(_0x5cd62e,_0x1680e8){var _0x5e9cb3={'raw':!![],'where':{'id':_0x5cd62e['params']['id']}},_0xc6af4d={};_0xc6af4d[_0xeabc('0x2f')]=_['keys'](db['FaxApplication']['rawAttributes']);_0xc6af4d[_0xeabc('0x30')]=_[_0xeabc('0x40')](_0x5cd62e[_0xeabc('0x30')]);_0xc6af4d[_0xeabc('0x38')]=_['intersection'](_0xc6af4d[_0xeabc('0x2f')],_0xc6af4d['query']);_0x5e9cb3[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0xc6af4d[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x5cd62e[_0xeabc('0x30')]['fields']));_0x5e9cb3['attributes']=_0x5e9cb3[_0xeabc('0x32')]['length']?_0x5e9cb3[_0xeabc('0x32')]:_0xc6af4d[_0xeabc('0x2f')];if(_0x5cd62e['query'][_0xeabc('0x3d')]){_0x5e9cb3[_0xeabc('0x3e')]=[{'all':!![]}];}_0x5e9cb3=_[_0xeabc('0x3b')]({},_0x5e9cb3,_0x5cd62e[_0xeabc('0x41')]);return db[_0xeabc('0x42')][_0xeabc('0x43')](_0x5e9cb3)[_0xeabc('0x24')](handleEntityNotFound(_0x1680e8,null))['then'](respondWithResult(_0x1680e8,null))[_0xeabc('0x44')](handleError(_0x1680e8,null));};exports[_0xeabc('0x45')]=function(_0x2e7a5e,_0x1b41c8){return db[_0xeabc('0x42')][_0xeabc('0x45')](_0x2e7a5e[_0xeabc('0x46')],{})[_0xeabc('0x24')](respondWithResult(_0x1b41c8,0xc9))[_0xeabc('0x44')](handleError(_0x1b41c8,null));};exports[_0xeabc('0x23')]=function(_0x5689fc,_0x38356c){if(_0x5689fc[_0xeabc('0x46')]['id']){delete _0x5689fc[_0xeabc('0x46')]['id'];}return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x5689fc[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x38356c,null))['then'](saveUpdates(_0x5689fc[_0xeabc('0x46')],null))[_0xeabc('0x24')](respondWithResult(_0x38356c,null))[_0xeabc('0x44')](handleError(_0x38356c,null));};exports[_0xeabc('0x25')]=function(_0x47440e,_0x58e2c1){return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x47440e[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x58e2c1,null))['then'](removeEntity(_0x58e2c1,null))[_0xeabc('0x44')](handleError(_0x58e2c1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 78e62c1..1b4e557 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 _0x535b=['bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x535b,0xf4));var _0xb535=function(_0x5be1f1,_0x1ab126){_0x5be1f1=_0x5be1f1-0x0;var _0x29bbd2=_0x535b[_0x5be1f1];return _0x29bbd2;};'use strict';var _=require('lodash');var util=require(_0xb535('0x0'));var logger=require(_0xb535('0x1'))('api');var moment=require(_0xb535('0x2'));var BPromise=require(_0xb535('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb535('0x4'));var rimraf=require(_0xb535('0x5'));var config=require(_0xb535('0x6'));var attributes=require(_0xb535('0x7'));module[_0xb535('0x8')]=function(_0x34f376,_0x244818){return _0x34f376[_0xb535('0x9')](_0xb535('0xa'),attributes,{'tableName':_0xb535('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb535('0xc')});}; \ No newline at end of file +var _0x1652=['define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x46351b,_0x4aa3ec){var _0x5bf04d=function(_0x43a413){while(--_0x43a413){_0x46351b['push'](_0x46351b['shift']());}};_0x5bf04d(++_0x4aa3ec);}(_0x1652,0xba));var _0x2165=function(_0x3fcfb6,_0x515024){_0x3fcfb6=_0x3fcfb6-0x0;var _0x3b99a7=_0x1652[_0x3fcfb6];return _0x3b99a7;};'use strict';var _=require('lodash');var util=require(_0x2165('0x0'));var logger=require('../../config/logger')(_0x2165('0x1'));var moment=require(_0x2165('0x2'));var BPromise=require(_0x2165('0x3'));var rp=require(_0x2165('0x4'));var fs=require('fs');var path=require(_0x2165('0x5'));var rimraf=require(_0x2165('0x6'));var config=require(_0x2165('0x7'));var attributes=require(_0x2165('0x8'));module['exports']=function(_0x39d2c2,_0x450ddd){return _0x39d2c2[_0x2165('0x9')](_0x2165('0xa'),attributes,{'tableName':_0x2165('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2165('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 799ca65..94dc373 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 _0x850d=['attributes','limit','UpdateFaxApplication','stringify','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','update','body','options','where'];(function(_0x5bff6e,_0x122537){var _0x58eddf=function(_0x6966b4){while(--_0x6966b4){_0x5bff6e['push'](_0x5bff6e['shift']());}};_0x58eddf(++_0x122537);}(_0x850d,0x14e));var _0xd850=function(_0x4e52ee,_0xced5f5){_0x4e52ee=_0x4e52ee-0x0;var _0x12c428=_0x850d[_0x4e52ee];return _0x12c428;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd850('0x0'));var BPromise=require(_0xd850('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd850('0x2'));var db=require(_0xd850('0x3'))['db'];var utils=require(_0xd850('0x4'));var logger=require(_0xd850('0x5'))(_0xd850('0x6'));var config=require(_0xd850('0x7'));var jayson=require(_0xd850('0x8'));var client=jayson['client'][_0xd850('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b9f64,_0x28857d,_0x291f43){return new BPromise(function(_0x1f903f,_0x3f754c){return client[_0xd850('0xa')](_0x2b9f64,_0x291f43)[_0xd850('0xb')](function(_0x405950){logger[_0xd850('0xc')](_0xd850('0xd'),_0x28857d,'request\x20sent');logger[_0xd850('0xe')](_0xd850('0xf'),_0x28857d,_0xd850('0x10'),JSON['stringify'](_0x405950));if(_0x405950['error']){if(_0x405950[_0xd850('0x11')][_0xd850('0x12')]===0x1f4){logger['error'](_0xd850('0xd'),_0x28857d,_0x405950[_0xd850('0x11')][_0xd850('0x13')]);return _0x3f754c(_0x405950['error'][_0xd850('0x13')]);}logger[_0xd850('0x11')](_0xd850('0xd'),_0x28857d,_0x405950[_0xd850('0x11')]['message']);return _0x1f903f(_0x405950[_0xd850('0x11')][_0xd850('0x13')]);}else{logger[_0xd850('0xc')](_0xd850('0xd'),_0x28857d,_0xd850('0x10'));_0x1f903f(_0x405950[_0xd850('0x14')][_0xd850('0x13')]);}})[_0xd850('0x15')](function(_0x5ba30d){logger[_0xd850('0x11')](_0xd850('0xd'),_0x28857d,_0x5ba30d);_0x3f754c(_0x5ba30d);});});}exports['UpdateFaxApplication']=function(_0x482cce){var _0x445c17=this;return new Promise(function(_0x2aef81,_0x416b4a){return db['FaxApplication'][_0xd850('0x16')](_0x482cce[_0xd850('0x17')],{'raw':_0x482cce[_0xd850('0x18')]?_0x482cce[_0xd850('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x482cce['options']?_0x482cce[_0xd850('0x18')][_0xd850('0x19')]||null:null,'attributes':_0x482cce['options']?_0x482cce[_0xd850('0x18')][_0xd850('0x1a')]||null:null,'limit':_0x482cce[_0xd850('0x18')]?_0x482cce[_0xd850('0x18')][_0xd850('0x1b')]||null:null})[_0xd850('0xb')](function(_0x3a7980){logger[_0xd850('0xc')](_0xd850('0x1c'),_0x482cce);logger[_0xd850('0xe')](_0xd850('0x1c'),_0x482cce,JSON[_0xd850('0x1d')](_0x3a7980));_0x2aef81(_0x3a7980);})[_0xd850('0x15')](function(_0x330199){logger['error'](_0xd850('0x1c'),_0x330199[_0xd850('0x13')],_0x482cce);_0x416b4a(_0x445c17[_0xd850('0x11')](0x1f4,_0x330199[_0xd850('0x13')]));});});}; \ No newline at end of file +var _0xd66b=['jayson/promise','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','raw','options','limit','debug','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4d94d1,_0x258abc){var _0x4e96b3=function(_0xdd2774){while(--_0xdd2774){_0x4d94d1['push'](_0x4d94d1['shift']());}};_0x4e96b3(++_0x258abc);}(_0xd66b,0xeb));var _0xbd66=function(_0x1a2299,_0x31788f){_0x1a2299=_0x1a2299-0x0;var _0x24165b=_0xd66b[_0x1a2299];return _0x24165b;};'use strict';var _=require(_0xbd66('0x0'));var util=require('util');var moment=require(_0xbd66('0x1'));var BPromise=require(_0xbd66('0x2'));var rs=require(_0xbd66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd66('0x4'));var logger=require(_0xbd66('0x5'))(_0xbd66('0x6'));var config=require(_0xbd66('0x7'));var jayson=require(_0xbd66('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bda68,_0x29d3c2,_0x309912){return new BPromise(function(_0x17c17f,_0x3ecf00){return client[_0xbd66('0x9')](_0x5bda68,_0x309912)[_0xbd66('0xa')](function(_0x22a46a){logger['info'](_0xbd66('0xb'),_0x29d3c2,_0xbd66('0xc'));logger['debug'](_0xbd66('0xd'),_0x29d3c2,_0xbd66('0xc'),JSON[_0xbd66('0xe')](_0x22a46a));if(_0x22a46a[_0xbd66('0xf')]){if(_0x22a46a[_0xbd66('0xf')]['code']===0x1f4){logger[_0xbd66('0xf')](_0xbd66('0xb'),_0x29d3c2,_0x22a46a[_0xbd66('0xf')]['message']);return _0x3ecf00(_0x22a46a[_0xbd66('0xf')]['message']);}logger[_0xbd66('0xf')](_0xbd66('0xb'),_0x29d3c2,_0x22a46a['error'][_0xbd66('0x10')]);return _0x17c17f(_0x22a46a['error'][_0xbd66('0x10')]);}else{logger[_0xbd66('0x11')]('FaxApplication,\x20%s,\x20%s',_0x29d3c2,_0xbd66('0xc'));_0x17c17f(_0x22a46a[_0xbd66('0x12')][_0xbd66('0x10')]);}})[_0xbd66('0x13')](function(_0x3e860f){logger[_0xbd66('0xf')]('FaxApplication,\x20%s,\x20%s',_0x29d3c2,_0x3e860f);_0x3ecf00(_0x3e860f);});});}exports[_0xbd66('0x14')]=function(_0x4ad784){var _0x4731e2=this;return new Promise(function(_0x461440,_0x186b82){return db[_0xbd66('0x15')][_0xbd66('0x16')](_0x4ad784['body'],{'raw':_0x4ad784['options']?_0x4ad784['options'][_0xbd66('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad784[_0xbd66('0x18')]?_0x4ad784['options']['where']||null:null,'attributes':_0x4ad784[_0xbd66('0x18')]?_0x4ad784[_0xbd66('0x18')]['attributes']||null:null,'limit':_0x4ad784[_0xbd66('0x18')]?_0x4ad784[_0xbd66('0x18')][_0xbd66('0x19')]||null:null})[_0xbd66('0xa')](function(_0x5c1927){logger[_0xbd66('0x11')](_0xbd66('0x14'),_0x4ad784);logger[_0xbd66('0x1a')](_0xbd66('0x14'),_0x4ad784,JSON[_0xbd66('0xe')](_0x5c1927));_0x461440(_0x5c1927);})['catch'](function(_0x48fc43){logger['error']('UpdateFaxApplication',_0x48fc43[_0xbd66('0x10')],_0x4ad784);_0x186b82(_0x4731e2[_0xbd66('0xf')](0x1f4,_0x48fc43[_0xbd66('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 51c6ada..d191332 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 _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x26732e,_0x26f6f6){var _0x1ec750=function(_0x474eaf){while(--_0x474eaf){_0x26732e['push'](_0x26732e['shift']());}};_0x1ec750(++_0x26f6f6);}(_0x6aa7,0x178));var _0x76aa=function(_0xf43969,_0x14b8ca){_0xf43969=_0xf43969-0x0;var _0x27ec7e=_0x6aa7[_0xf43969];return _0x27ec7e;};'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 auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['post']('/',auth[_0x76aa('0xa')](),controller[_0x76aa('0xc')]);router[_0x76aa('0xd')]('/:id',auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);module[_0x76aa('0x11')]=router; \ No newline at end of file +var _0x5d58=['../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','Router'];(function(_0x243e10,_0x120386){var _0x51b610=function(_0xfa9df1){while(--_0xfa9df1){_0x243e10['push'](_0x243e10['shift']());}};_0x51b610(++_0x120386);}(_0x5d58,0x187));var _0x85d5=function(_0x14603f,_0x4e452f){_0x14603f=_0x14603f-0x0;var _0x4f377a=_0x5d58[_0x14603f];return _0x4f377a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var auth=require(_0x85d5('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x85d5('0x2'));var controller=require(_0x85d5('0x3'));router['get']('/',auth[_0x85d5('0x4')](),controller[_0x85d5('0x5')]);router[_0x85d5('0x6')](_0x85d5('0x7'),auth['isAuthenticated'](),controller[_0x85d5('0x8')]);router[_0x85d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x85d5('0xa')]);router['put'](_0x85d5('0x7'),auth[_0x85d5('0x4')](),controller[_0x85d5('0xb')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x85d5('0xc')]);module[_0x85d5('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 32b81a8..c88d1d2 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 _0x9465=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x9465,0x98));var _0x5946=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x9465[_0x22cc16];return _0x399b70;};'use strict';var Sequelize=require('sequelize');module[_0x5946('0x0')]={'closed':{'type':Sequelize[_0x5946('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5946('0x2')]},'disposition':{'type':Sequelize[_0x5946('0x3')]},'note':{'type':Sequelize[_0x5946('0x3')]},'read1stAt':{'type':Sequelize[_0x5946('0x2')]},'fax':{'type':Sequelize[_0x5946('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5946('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5946('0x4')]('in',_0x5946('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe63d=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x2943b,_0xc3452){var _0x29ea44=function(_0x3d9b79){while(--_0x3d9b79){_0x2943b['push'](_0x2943b['shift']());}};_0x29ea44(++_0xc3452);}(_0xe63d,0x17c));var _0xde63=function(_0x22e513,_0x53d375){_0x22e513=_0x22e513-0x0;var _0x55d29b=_0xe63d[_0x22e513];return _0x55d29b;};'use strict';var Sequelize=require(_0xde63('0x0'));module[_0xde63('0x1')]={'closed':{'type':Sequelize[_0xde63('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xde63('0x3')]},'read1stAt':{'type':Sequelize[_0xde63('0x4')]},'fax':{'type':Sequelize[_0xde63('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xde63('0x5')]('in',_0xde63('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xde63('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xde63('0x6')),'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 443e9db..4d1953f 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 _0xbca8=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','then','error','stack','name','send','Users','map','Tags','TagIds','split','FaxInteraction','type','key','query','filters','attributes','fields','length','model','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','tools_tags','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','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','value','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','some','isEmpty','FaxAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','push','rows','catch','show','params','rawAttributes','intersection','includeAll','create','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','include','addTags','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Attachment','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','unlinkSync','html-pdf','eml-format'];(function(_0x3fd750,_0x120661){var _0x4f15d9=function(_0x3181b8){while(--_0x3181b8){_0x3fd750['push'](_0x3fd750['shift']());}};_0x4f15d9(++_0x120661);}(_0xbca8,0xcc));var _0x8bca=function(_0x357a96,_0x30c5fb){_0x357a96=_0x357a96-0x0;var _0x19d06c=_0xbca8[_0x357a96];return _0x19d06c;};'use strict';var pdf=require(_0x8bca('0x0'));var emlformat=require(_0x8bca('0x1'));var rimraf=require(_0x8bca('0x2'));var zipdir=require(_0x8bca('0x3'));var jsonpatch=require(_0x8bca('0x4'));var rp=require('request-promise');var moment=require(_0x8bca('0x5'));var BPromise=require(_0x8bca('0x6'));var Mustache=require(_0x8bca('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8bca('0x8'));var csv=require(_0x8bca('0x9'));var ejs=require(_0x8bca('0xa'));var fs=require('fs');var _=require(_0x8bca('0xb'));var squel=require('squel');var crypto=require(_0x8bca('0xc'));var jsforce=require(_0x8bca('0xd'));var deskjs=require(_0x8bca('0xe'));var toCsv=require(_0x8bca('0x9'));var querystring=require(_0x8bca('0xf'));var Papa=require(_0x8bca('0x10'));var Redis=require(_0x8bca('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bca('0x12'));var hardwareService=require(_0x8bca('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8bca('0x14'));var config=require('../../config/environment');var db=require(_0x8bca('0x15'))['db'];config[_0x8bca('0x16')]=_['defaults'](config[_0x8bca('0x16')],{'host':_0x8bca('0x17'),'port':0x18eb});var socket=require(_0x8bca('0x18'))(new Redis(config[_0x8bca('0x16')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x250d09,_0x59b65b){_0x59b65b=_0x59b65b||0xcc;return function(_0x25691b){if(_0x25691b){return _0x250d09[_0x8bca('0x19')](_0x59b65b);}return _0x250d09[_0x8bca('0x1a')](_0x59b65b)[_0x8bca('0x1b')]();};}function respondWithResult(_0x1c3590,_0x1c78d5){_0x1c78d5=_0x1c78d5||0xc8;return function(_0x487305){if(_0x487305){return _0x1c3590['status'](_0x1c78d5)[_0x8bca('0x1c')](_0x487305);}};}function respondWithFilteredResult(_0x4d3cc3,_0x2bd7b1){return function(_0x25c5c1){if(_0x25c5c1){var _0x4e24c8=_0x25c5c1[_0x8bca('0x1d')],_0x5e735b=_0x2bd7b1['offset'],_0x5622ba=_0x2bd7b1[_0x8bca('0x1e')]+_0x2bd7b1['limit'],_0x1963c0;if(_0x5622ba>=_0x4e24c8){_0x5622ba=_0x4e24c8;_0x1963c0=0xc8;}else{_0x1963c0=0xce;}_0x4d3cc3['status'](_0x1963c0);return _0x4d3cc3['set'](_0x8bca('0x1f'),_0x5e735b+'-'+_0x5622ba+'/'+_0x4e24c8)[_0x8bca('0x1c')](_0x25c5c1);}return null;};}function patchUpdates(_0xdafaa1){return function(_0xaaee66){try{jsonpatch[_0x8bca('0x20')](_0xaaee66,_0xdafaa1,!![]);}catch(_0x3b73e5){return BPromise['reject'](_0x3b73e5);}return _0xaaee66[_0x8bca('0x21')]();};}function saveUpdates(_0x20dc10,_0xf3296b){return function(_0x50d5a3){if(_0x50d5a3){return _0x50d5a3[_0x8bca('0x22')](_0x20dc10)['then'](function(_0x1f014d){return _0x1f014d;});}return null;};}function removeEntity(_0x4e4bff,_0x2e3522){return function(_0x3be409){if(_0x3be409){return _0x3be409[_0x8bca('0x23')]()[_0x8bca('0x24')](function(){_0x4e4bff[_0x8bca('0x1a')](0xcc)[_0x8bca('0x1b')]();});}};}function handleEntityNotFound(_0x2dc5c8,_0x5f056b){return function(_0x50051a){if(!_0x50051a){_0x2dc5c8[_0x8bca('0x19')](0x194);}return _0x50051a;};}function handleError(_0x1feba3,_0x4c10db){_0x4c10db=_0x4c10db||0x1f4;return function(_0x3bcf71){logger[_0x8bca('0x25')](_0x3bcf71[_0x8bca('0x26')]);if(_0x3bcf71[_0x8bca('0x27')]){delete _0x3bcf71[_0x8bca('0x27')];}_0x1feba3['status'](_0x4c10db)[_0x8bca('0x28')](_0x3bcf71);};}function getInteractionUsers(_0x58bfda,_0x18c7f2){return new BPromise(function(_0x4e8525,_0x18ff94){try{if(_0x18c7f2[_0x58bfda['id']]){_0x58bfda[_0x8bca('0x29')]=_[_0x8bca('0x2a')](_0x18c7f2[_0x58bfda['id']],function(_0x3a5d8a){return{'id':_0x3a5d8a['id'],'fullname':_0x3a5d8a['fullname']};});}}catch(_0x252819){_0x18ff94(_0x252819);}_0x4e8525(_0x58bfda);});}function getInteractionTags(_0x429c3a,_0x288f99){return new BPromise(function(_0x543897,_0x539f7e){try{if(_0x429c3a['TagIds']){_0x429c3a[_0x8bca('0x2b')]=[];_0x429c3a[_0x8bca('0x2c')][_0x8bca('0x2d')](',')['forEach'](function(_0x85b9bc){_0x429c3a[_0x8bca('0x2b')]['push'](_0x288f99[_0x85b9bc]);});}delete _0x429c3a[_0x8bca('0x2c')];}catch(_0x10015c){_0x539f7e(_0x10015c);}_0x543897(_0x429c3a);});}function updateFaxInteraction(_0x21b1f1,_0x1e6d27,_0x26e2c2){return new BPromise(function(_0x49c197,_0x251cd3){return getInteractionUsers(_0x21b1f1,_0x26e2c2)[_0x8bca('0x24')](function(_0x462b12){return getInteractionTags(_0x462b12,_0x1e6d27);})[_0x8bca('0x24')](function(_0x102000){_0x49c197(_0x102000);})['catch'](function(_0x156d67){_0x251cd3(_0x156d67);});});}exports['index']=function(_0x520837,_0x3d39c1){var _0x78d94a={},_0x5e4607={},_0x51bb8a={'count':0x0,'rows':[]};var _0x3c6f25=_[_0x8bca('0x2a')](db[_0x8bca('0x2e')]['rawAttributes'],function(_0x420e30){return{'name':_0x420e30['fieldName'],'type':_0x420e30[_0x8bca('0x2f')][_0x8bca('0x30')]};});_0x5e4607['model']=_[_0x8bca('0x2a')](_0x3c6f25,_0x8bca('0x27'));_0x5e4607[_0x8bca('0x31')]=_['keys'](_0x520837[_0x8bca('0x31')]);_0x5e4607[_0x8bca('0x32')]=_['intersection'](_0x5e4607['model'],_0x5e4607[_0x8bca('0x31')]);_0x78d94a[_0x8bca('0x33')]=_['intersection'](_0x5e4607['model'],qs[_0x8bca('0x34')](_0x520837[_0x8bca('0x31')][_0x8bca('0x34')]));_0x78d94a[_0x8bca('0x33')]=_0x78d94a[_0x8bca('0x33')][_0x8bca('0x35')]?_0x78d94a['attributes']:_0x5e4607[_0x8bca('0x36')];if(!_0x520837[_0x8bca('0x31')][_0x8bca('0x37')](_0x8bca('0x38'))){_0x78d94a[_0x8bca('0x39')]=qs[_0x8bca('0x39')](_0x520837[_0x8bca('0x31')][_0x8bca('0x39')]);_0x78d94a['offset']=qs['offset'](_0x520837[_0x8bca('0x31')][_0x8bca('0x1e')]);}_0x78d94a['order']=qs[_0x8bca('0x3a')](_0x520837[_0x8bca('0x31')][_0x8bca('0x3a')]);_0x78d94a[_0x8bca('0x3b')]=qs[_0x8bca('0x32')](_[_0x8bca('0x3c')](_0x520837[_0x8bca('0x31')],_0x5e4607[_0x8bca('0x32')]),_0x3c6f25);var _0x19dbfe=[];var _0x4b2839=squel[_0x8bca('0x3d')]()['field']('id')[_0x8bca('0x3e')](_0x8bca('0x27'))[_0x8bca('0x3e')](_0x8bca('0x3f'))[_0x8bca('0x40')](_0x8bca('0x41'));var _0x516b3e=squel[_0x8bca('0x3d')]()[_0x8bca('0x3e')]('u.id')[_0x8bca('0x3e')]('u.fullname')['field']('ui.FaxInteractionId')['from'](_0x8bca('0x42'),'ui')[_0x8bca('0x43')](_0x8bca('0x44'),'u',_0x8bca('0x45'));var _0x579ef4=squel[_0x8bca('0x3d')]()[_0x8bca('0x40')](_0x8bca('0x46'),'i')[_0x8bca('0x43')]('cm_contacts','c',_0x8bca('0x47'))[_0x8bca('0x43')](_0x8bca('0x44'),'o',_0x8bca('0x48'))[_0x8bca('0x43')](_0x8bca('0x49'),'a',_0x8bca('0x4a'))[_0x8bca('0x43')]('fax_messages','me',_0x8bca('0x4b'))[_0x8bca('0x43')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x8bca('0x43')](_0x8bca('0x41'),'t',_0x8bca('0x4c'));var _0x58a6c0=squel[_0x8bca('0x4d')]();var _0x601674=[];var _0x56f1c1=squel[_0x8bca('0x4d')]();var _0x123e37;if(_0x520837[_0x8bca('0x31')][_0x8bca('0x4e')]){_0x123e37=as['parseSearch'](_0x520837[_0x8bca('0x31')][_0x8bca('0x4e')]);var _0x4a1380=_0x123e37[_0x8bca('0x4f')];for(var _0x1eae5a=0x0;_0x1eae5a<_0x123e37[_0x8bca('0x50')]['length'];_0x1eae5a++){var _0x5c6313=_0x123e37['conditions'][_0x1eae5a];var _0xcd371e='i';var _0x4ac610=_[_0x8bca('0x51')](_0x3c6f25,[_0x8bca('0x27'),_0x5c6313['field']]);if(!_0x4ac610){switch(_0x5c6313[_0x8bca('0x3e')]){case _0x8bca('0x52'):if(_0x5c6313['value']==0x1){_0x579ef4[_0x8bca('0x53')]('`'+_0x5c6313[_0x8bca('0x3e')]+'`\x20=\x200');}else{_0x579ef4['having']('`'+_0x5c6313['field']+_0x8bca('0x54'));}break;case _0x8bca('0x55'):if(_0x5c6313[_0x8bca('0x56')]===_0x8bca('0x57')){if(_0x5c6313['value'][_0x8bca('0x2d')]('\x20')[_0x8bca('0x35')]>0x1){_0x58a6c0[_0x4a1380](_0x8bca('0x58'),qs[_0x8bca('0x59')](_0x5c6313[_0x8bca('0x5a')]),null);}else{var _0x895d7d='%'+_0x5c6313[_0x8bca('0x5a')]+'%';_0x58a6c0[_0x4a1380](_0x8bca('0x5b'),_0x895d7d,_0x895d7d,_0x895d7d);}}else{_0x4ac610=_[_0x8bca('0x51')](_0x3c6f25,[_0x8bca('0x27'),_0x8bca('0x5c')]);_0x5c6313[_0x8bca('0x3e')]=_0x8bca('0x5c');_0x30f6b3=as[_0x8bca('0x5d')](_0xcd371e,_0x4ac610[_0x8bca('0x2f')],_0x5c6313);_0x58a6c0[_0x4a1380](_0x30f6b3['text'],_0x30f6b3[_0x8bca('0x5a')][_0x8bca('0x5e')],_0x30f6b3['value'][_0x8bca('0x1b')]);}break;case _0x8bca('0x5f'):var _0x3fa042=_0x5c6313[_0x8bca('0x5a')][_0x8bca('0x2d')](',')[_0x8bca('0x2a')](function(_0x443873){return Number(_0x443873);});_0x3fa042[_0x8bca('0x60')](function(_0x2ce8fb){_0x56f1c1['or'](_0x8bca('0x61'),'%,'+_0x2ce8fb+',%');});_0x601674=_[_0x8bca('0x62')](_0x601674,_0x3fa042);break;case'User':if(_0x5c6313[_0x8bca('0x56')]===_0x8bca('0x57')){_0x58a6c0[_0x4a1380](_0x8bca('0x63'),'%'+_0x5c6313[_0x8bca('0x5a')]+'%',null);}else{_0x4ac610=_['find'](_0x3c6f25,[_0x8bca('0x27'),_0x8bca('0x64')]);_0x5c6313[_0x8bca('0x3e')]=_0x8bca('0x64');_0x30f6b3=as['buildExpression'](_0xcd371e,_0x4ac610[_0x8bca('0x2f')],_0x5c6313);_0x58a6c0[_0x4a1380](_0x30f6b3[_0x8bca('0x65')],_0x30f6b3[_0x8bca('0x5a')][_0x8bca('0x5e')],_0x30f6b3[_0x8bca('0x5a')][_0x8bca('0x1b')]);}break;case _0x8bca('0x66'):_0x30f6b3=as[_0x8bca('0x5d')]('me',null,_0x5c6313);_0x58a6c0[_0x4a1380](_0x30f6b3['text'],_0x30f6b3['value'][_0x8bca('0x5e')],_0x30f6b3[_0x8bca('0x5a')][_0x8bca('0x1b')]);break;}}else{var _0x30f6b3=as[_0x8bca('0x5d')](_0xcd371e,_0x4ac610[_0x8bca('0x2f')],_0x5c6313);_0x58a6c0[_0x4a1380](_0x30f6b3['text'],_0x30f6b3[_0x8bca('0x5a')]['start'],_0x30f6b3[_0x8bca('0x5a')]['end']);}}}else{var _0x58beb3=_(_0x520837['query'])[_0x8bca('0x67')]()[_0x8bca('0x2a')](function(_0x9cc051){return _[_0x8bca('0x68')](_0x3c6f25,[_0x8bca('0x27'),_0x9cc051])?_0x9cc051:undefined;})['compact']()[_0x8bca('0x5a')]();if(!_[_0x8bca('0x69')](_0x58beb3)){_0x58beb3[_0x8bca('0x60')](function(_0x327999){if(_0x327999===_0x8bca('0x6a')){_0x579ef4[_0x8bca('0x3b')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x520837[_0x8bca('0x31')][_0x327999]));}else if(_0x327999===_0x8bca('0x6b')){var _0x4ec6c9=JSON[_0x8bca('0x6c')](_0x520837[_0x8bca('0x31')][_0x327999])[_0x8bca('0x6d')];var _0xec40f8=JSON[_0x8bca('0x6c')](_0x520837[_0x8bca('0x31')][_0x327999])[_0x8bca('0x6e')];_0x579ef4[_0x8bca('0x3b')](_0x8bca('0x6f'),_0x4ec6c9,_0xec40f8);}else{if(_0x520837[_0x8bca('0x31')][_0x327999]==='null'){_0x579ef4['where']('i.'+_0x327999+_0x8bca('0x70'));}else{_0x579ef4[_0x8bca('0x3b')]('i.'+_0x327999+_0x8bca('0x71'),_0x520837[_0x8bca('0x31')][_0x327999]);}}});}if(_0x520837[_0x8bca('0x31')][_0x8bca('0x72')]){if(_0x520837[_0x8bca('0x31')]['read']==0x1){_0x579ef4[_0x8bca('0x53')](_0x8bca('0x73'));}else{_0x579ef4['having'](_0x8bca('0x74'));}}if(_0x520837[_0x8bca('0x31')][_0x8bca('0x75')]){_0x601674=_[_0x8bca('0x76')](_0x520837['query'][_0x8bca('0x75')])?_0x520837[_0x8bca('0x31')][_0x8bca('0x75')]:new Array(_0x520837[_0x8bca('0x31')][_0x8bca('0x75')]);_0x601674[_0x8bca('0x60')](function(_0x7abc45){_0x56f1c1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x7abc45+',%');});}if(_0x520837['query'][_0x8bca('0x77')]){var _0x197928=_0x520837[_0x8bca('0x31')][_0x8bca('0x77')][_0x8bca('0x78')]('\x5c','\x5c\x5c')[_0x8bca('0x78')]('\x27\x27',_0x8bca('0x79'));if(qs['isNumeric'](_0x197928)){_0x58a6c0['or'](_0x8bca('0x7a'),_0x197928+'%')['or'](_0x8bca('0x7b'),_0x197928+'%');}_0x58a6c0['or'](_0x8bca('0x7c'),_0x197928+'%');}}_0x579ef4[_0x8bca('0x3b')](_0x58a6c0);_0x579ef4[_0x8bca('0x7d')](_0x8bca('0x7e'));var _0x567f46={'type':db[_0x8bca('0x7f')][_0x8bca('0x80')][_0x8bca('0x81')],'raw':!![]};var _0x5a4e31=_0x579ef4[_0x8bca('0x82')]();_0x5a4e31[_0x8bca('0x3e')]('i.id');_0x5a4e31[_0x8bca('0x3e')](_0x8bca('0x83'),_0x8bca('0x52'));if(_0x78d94a[_0x8bca('0x84')]){_0x78d94a[_0x8bca('0x84')]['forEach'](function(_0x349d31){_0x579ef4[_0x8bca('0x84')]('i.'+_0x349d31[0x0],_0x349d31[0x1]===_0x8bca('0x85')?![]:!![]);});}if(!_[_0x8bca('0x69')](_0x601674)){_0x579ef4[_0x8bca('0x53')](_0x56f1c1);_0x5a4e31[_0x8bca('0x3b')]('t.id\x20IN\x20?',_0x601674);}BPromise[_0x8bca('0x86')]()[_0x8bca('0x24')](function(){if(!_0x123e37){if(_0x520837[_0x8bca('0x31')][_0x8bca('0x6a')]||_0x520837[_0x8bca('0x31')]['journey'])return;_0x5a4e31[_0x8bca('0x3b')](_0x8bca('0x87'));_0x579ef4[_0x8bca('0x3b')](_0x8bca('0x87'));return;}return _0x520837[_0x8bca('0x88')][_0x8bca('0x89')]({'attributes':['id'],'raw':!![]})['then'](function(_0xff10be){if(_[_0x8bca('0x69')](_0xff10be)){_0x5a4e31[_0x8bca('0x3b')]('i.FaxAccountId\x20IS\x20NULL');_0x579ef4['where'](_0x8bca('0x8a'));}else{_0x5a4e31[_0x8bca('0x3b')](_0x8bca('0x8b'),_['map'](_0xff10be,'id'));_0x579ef4[_0x8bca('0x3b')]('i.FaxAccountId\x20IN\x20?',_[_0x8bca('0x2a')](_0xff10be,'id'));}});})['then'](function(){db['sequelize'][_0x8bca('0x31')](_0x5a4e31[_0x8bca('0x8c')](),_0x567f46)[_0x8bca('0x24')](function(_0x57ae60){_0x51bb8a[_0x8bca('0x1d')]=_0x57ae60[_0x8bca('0x35')];if(_0x51bb8a['count']===0x0)return[];return db[_0x8bca('0x8d')]['query'](_0x4b2839[_0x8bca('0x8c')](),_0x567f46)['then'](function(_0x49e138){_0x19dbfe=_[_0x8bca('0x8e')](_0x49e138,'id');_0x567f46=_[_0x8bca('0x8f')](_0x567f46,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x520837[_0x8bca('0x31')][_0x8bca('0x34')]){_0x78d94a[_0x8bca('0x33')][_0x8bca('0x60')](function(_0x145006){_0x579ef4[_0x8bca('0x3e')]('i.'+_0x145006);});}else{_0x579ef4['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8bca('0x52'));_0x579ef4['field']('a.key','Account.key');_0x579ef4['field'](_0x8bca('0x90'),'Account.mandatoryDisposition');_0x579ef4[_0x8bca('0x3e')](_0x8bca('0x91'));_0x579ef4[_0x8bca('0x3e')](_0x8bca('0x92'),_0x8bca('0x93'));_0x579ef4[_0x8bca('0x3e')](_0x8bca('0x94'),_0x8bca('0x95'));_0x579ef4['field']('c.email',_0x8bca('0x96'));_0x579ef4[_0x8bca('0x3e')](_0x8bca('0x97'),_0x8bca('0x98'));_0x579ef4[_0x8bca('0x3e')](_0x8bca('0x99'),_0x8bca('0x9a'));_0x579ef4['field'](_0x8bca('0x9b'),_0x8bca('0x9c'));_0x579ef4[_0x8bca('0x3e')](_0x8bca('0x9d'),_0x8bca('0x9e'));_0x579ef4['field']('o.internal',_0x8bca('0x9f'));_0x579ef4[_0x8bca('0x3e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8bca('0x2c'));}if(_0x78d94a['limit'])_0x579ef4[_0x8bca('0x39')](_0x78d94a[_0x8bca('0x39')]);if(_0x78d94a[_0x8bca('0x1e')])_0x579ef4[_0x8bca('0x1e')](_0x78d94a[_0x8bca('0x1e')]);return db[_0x8bca('0x8d')][_0x8bca('0x31')](_0x579ef4[_0x8bca('0x8c')](),_0x567f46);})[_0x8bca('0x24')](function(_0x4c6afe){_0x516b3e[_0x8bca('0x3b')](_0x8bca('0xa0'),_[_0x8bca('0x2a')](_0x4c6afe,'id'));return db[_0x8bca('0x8d')][_0x8bca('0x31')](_0x516b3e['toString'](),_0x567f46)['then'](function(_0x27c35d){var _0xd110e0=_['groupBy'](_0x27c35d,_0x8bca('0xa1'));var _0x34c43f=[];_0x4c6afe[_0x8bca('0x60')](function(_0x3dde74){_0x34c43f[_0x8bca('0xa2')](updateFaxInteraction(_0x3dde74,_0x19dbfe,_0xd110e0));});return BPromise['all'](_0x34c43f);});});})[_0x8bca('0x24')](function(_0x18e0af){_0x51bb8a[_0x8bca('0xa3')]=_0x18e0af;return _0x51bb8a;})[_0x8bca('0x24')](respondWithFilteredResult(_0x3d39c1,_0x78d94a));})[_0x8bca('0xa4')](handleError(_0x3d39c1,null));};exports[_0x8bca('0xa5')]=function(_0x222efa,_0x90fafe){var _0x18b110={'raw':![],'where':{'id':_0x222efa[_0x8bca('0xa6')]['id']}},_0x496d39={};_0x496d39[_0x8bca('0x36')]=_['keys'](db[_0x8bca('0x2e')][_0x8bca('0xa7')]);_0x496d39[_0x8bca('0x31')]=_['keys'](_0x222efa[_0x8bca('0x31')]);_0x496d39[_0x8bca('0x32')]=_['intersection'](_0x496d39[_0x8bca('0x36')],_0x496d39[_0x8bca('0x31')]);_0x18b110[_0x8bca('0x33')]=_[_0x8bca('0xa8')](_0x496d39[_0x8bca('0x36')],qs['fields'](_0x222efa[_0x8bca('0x31')][_0x8bca('0x34')]));_0x18b110[_0x8bca('0x33')]=_0x18b110[_0x8bca('0x33')][_0x8bca('0x35')]?_0x18b110['attributes']:_0x496d39[_0x8bca('0x36')];if(_0x222efa[_0x8bca('0x31')][_0x8bca('0xa9')]){_0x18b110['include']=[{'all':!![]}];}_0x18b110=_['merge']({},_0x18b110,_0x222efa['options']);return db[_0x8bca('0x2e')][_0x8bca('0x51')](_0x18b110)[_0x8bca('0x24')](handleEntityNotFound(_0x90fafe,null))[_0x8bca('0x24')](respondWithResult(_0x90fafe,null))['catch'](handleError(_0x90fafe,null));};exports['create']=function(_0x2043bc,_0x1acee9){return db[_0x8bca('0x2e')][_0x8bca('0xaa')](_0x2043bc['body'],{})['then'](respondWithResult(_0x1acee9,0xc9))[_0x8bca('0xa4')](handleError(_0x1acee9,null));};exports['update']=function(_0x1c1de6,_0x374e65){if(_0x1c1de6[_0x8bca('0x66')]['id']){delete _0x1c1de6[_0x8bca('0x66')]['id'];}return db[_0x8bca('0x2e')]['find']({'where':{'id':_0x1c1de6['params']['id']}})[_0x8bca('0x24')](handleEntityNotFound(_0x374e65,null))[_0x8bca('0x24')](saveUpdates(_0x1c1de6[_0x8bca('0x66')],null))[_0x8bca('0x24')](respondWithResult(_0x374e65,null))[_0x8bca('0xa4')](handleError(_0x374e65,null));};exports['destroy']=function(_0x49e6f0,_0x2d6d91){return db[_0x8bca('0x2e')][_0x8bca('0x51')]({'where':{'id':_0x49e6f0[_0x8bca('0xa6')]['id']}})[_0x8bca('0x24')](handleEntityNotFound(_0x2d6d91,null))[_0x8bca('0x24')](removeEntity(_0x2d6d91,null))[_0x8bca('0xa4')](handleError(_0x2d6d91,null));};exports[_0x8bca('0xab')]=function(_0x55606a,_0x30470c){return db[_0x8bca('0x2e')][_0x8bca('0xab')]()[_0x8bca('0x24')](respondWithResult(_0x30470c,null))['catch'](handleError(_0x30470c,null));};exports['addMessage']=function(_0x44496c,_0xd929ca,_0x5dbd2e){return db[_0x8bca('0xac')][_0x8bca('0x51')]({'where':{'id':_0x44496c[_0x8bca('0xa6')]['id']}})[_0x8bca('0x24')](handleEntityNotFound(_0xd929ca,null))[_0x8bca('0x24')](function(_0x215c78){if(_0x215c78){return _0x215c78[_0x8bca('0xad')](_0x44496c[_0x8bca('0x66')][_0x8bca('0xae')],_[_0x8bca('0xaf')](_0x44496c['body'],[_0x8bca('0xae'),'id'])||{});}})[_0x8bca('0x24')](respondWithResult(_0xd929ca,null))[_0x8bca('0xa4')](handleError(_0xd929ca,null));};exports[_0x8bca('0xb0')]=function(_0xd09bd0,_0x161b0d,_0x34847e){var _0x3cb478={'raw':![],'where':{}};var _0x10652d={};var _0x3e50f5={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x8bca('0xb1')]({'where':{'id':_0xd09bd0[_0x8bca('0xa6')]['id']}})[_0x8bca('0x24')](handleEntityNotFound(_0x161b0d,null))['then'](function(_0x2940c4){if(_0x2940c4){_0x10652d[_0x8bca('0x36')]=_[_0x8bca('0x67')](db[_0x8bca('0xac')][_0x8bca('0xa7')]);_0x10652d[_0x8bca('0x31')]=_[_0x8bca('0x67')](_0xd09bd0[_0x8bca('0x31')]);_0x10652d[_0x8bca('0x32')]=_[_0x8bca('0xa8')](_0x10652d[_0x8bca('0x36')],_0x10652d[_0x8bca('0x31')]);_0x3cb478[_0x8bca('0x33')]=_[_0x8bca('0xa8')](_0x10652d['model'],qs[_0x8bca('0x34')](_0xd09bd0[_0x8bca('0x31')][_0x8bca('0x34')]));_0x3cb478[_0x8bca('0x33')]=_0x3cb478[_0x8bca('0x33')]['length']?_0x3cb478['attributes']:_0x10652d['model'];if(!_0xd09bd0[_0x8bca('0x31')][_0x8bca('0x37')](_0x8bca('0x38'))){_0x3cb478[_0x8bca('0x39')]=qs[_0x8bca('0x39')](_0xd09bd0[_0x8bca('0x31')]['limit']);_0x3cb478[_0x8bca('0x1e')]=qs['offset'](_0xd09bd0[_0x8bca('0x31')]['offset']);}_0x3cb478[_0x8bca('0x84')]=qs[_0x8bca('0x3a')](_0xd09bd0['query']['sort']);_0x3cb478[_0x8bca('0x3b')]=qs[_0x8bca('0x32')](_[_0x8bca('0x3c')](_0xd09bd0['query'],_0x10652d['filters']));_0x3cb478[_0x8bca('0x3b')][_0x8bca('0xa1')]=_0x2940c4['id'];if(_0xd09bd0[_0x8bca('0x31')][_0x8bca('0x77')]){_0x3cb478[_0x8bca('0x3b')]=_[_0x8bca('0x8f')](_0x3cb478['where'],{'$or':_['map'](_0x3cb478[_0x8bca('0x33')],function(_0x1631fe){var _0x791795={};_0x791795[_0x1631fe]={'$like':'%'+_0xd09bd0[_0x8bca('0x31')][_0x8bca('0x77')]+'%'};return _0x791795;})});}if(_0xd09bd0[_0x8bca('0x31')][_0x8bca('0x6d')]){var _0x3699c4=_0xd09bd0[_0x8bca('0x31')][_0x8bca('0x6d')][_0x8bca('0x2d')](',');var _0x191615={};_0x191615[_0x3699c4[0x0]]={'$gte':moment(_0x3699c4[0x1])[_0x8bca('0xb2')](_0x8bca('0xb3'))};_0x3cb478[_0x8bca('0x3b')]=_[_0x8bca('0x8f')](_0x3cb478[_0x8bca('0x3b')],_0x191615);}_0x3cb478=_[_0x8bca('0x8f')]({},_0x3cb478,_0xd09bd0[_0x8bca('0xb4')]);return db[_0x8bca('0xac')][_0x8bca('0x1d')]({'where':_0x3cb478[_0x8bca('0x3b')]})[_0x8bca('0x24')](function(_0x18d98c){_0x3e50f5[_0x8bca('0x1d')]=_0x18d98c;if(_0xd09bd0['query'][_0x8bca('0xa9')]){_0x3cb478[_0x8bca('0xb5')]=[{'all':!![]}];}return db[_0x8bca('0xac')]['findAll'](_0x3cb478);})[_0x8bca('0x24')](function(_0x485083){_0x3e50f5[_0x8bca('0xa3')]=_0x485083;return _0x3e50f5;});}})[_0x8bca('0x24')](respondWithFilteredResult(_0x161b0d,_0x3cb478))['catch'](handleError(_0x161b0d,null));};exports[_0x8bca('0xb6')]=function(_0x5df344,_0x3ec78b,_0x481d3e){return db[_0x8bca('0x2e')][_0x8bca('0x51')]({'where':{'id':_0x5df344[_0x8bca('0xa6')]['id']}})['then'](handleEntityNotFound(_0x3ec78b,null))[_0x8bca('0x24')](function(_0x4fc233){if(_0x4fc233){return _0x4fc233[_0x8bca('0xb7')](_0x5df344[_0x8bca('0x66')]['ids'],_[_0x8bca('0xaf')](_0x5df344[_0x8bca('0x66')],[_0x8bca('0xae'),'id'])||{})[_0x8bca('0xb8')](function(){return db[_0x8bca('0x5f')][_0x8bca('0xb9')]({'attributes':['id','name','color'],'where':{'id':_0x5df344[_0x8bca('0x66')]['ids']}});})[_0x8bca('0x24')](function(_0x365495){socket[_0x8bca('0xba')](_0x8bca('0xbb'),{'id':Number(_0x5df344[_0x8bca('0xa6')]['id']),'tags':_0x365495||[]});return{'id':Number(_0x5df344[_0x8bca('0xa6')]['id']),'tags':_0x365495||[]};});}})['then'](respondWithResult(_0x3ec78b,null))['catch'](handleError(_0x3ec78b,null));};exports['removeTags']=function(_0x576415,_0x46eae1,_0x1709db){return db[_0x8bca('0x2e')][_0x8bca('0x51')]({'where':{'id':_0x576415[_0x8bca('0xa6')]['id']}})['then'](handleEntityNotFound(_0x46eae1,null))['then'](function(_0x3f6e0d){if(_0x3f6e0d){return _0x3f6e0d[_0x8bca('0xbc')](_0x576415[_0x8bca('0x31')][_0x8bca('0xae')]);}})['then'](respondWithStatusCode(_0x46eae1,null))[_0x8bca('0xa4')](handleError(_0x46eae1,null));};exports[_0x8bca('0xbd')]=function(_0x2cf698,_0x4b1d29){var _0xf371d0=moment()[_0x8bca('0xbe')]()[_0x8bca('0x8c')]();var _0xe6d2c6=path['join'](config[_0x8bca('0xbf')],_0x8bca('0xc0'),_0x8bca('0xc1'),_0x8bca('0xc2'));var _0x3e7d0c=path[_0x8bca('0xc3')](config['root'],_0x8bca('0xc0'),_0x8bca('0xc1'),_0x8bca('0xc4'));var _0x4d0b16=path[_0x8bca('0xc3')](_0xe6d2c6,_0xf371d0);var _0x3c3bfd=util[_0x8bca('0xb2')](_0x8bca('0xc5'),_0x2cf698[_0x8bca('0xa6')]['id'],_0xf371d0);var _0x5b601d=path['join'](_0xe6d2c6,_0x3c3bfd);var _0x1b670d=[];_0x1b670d[_0x8bca('0xa2')]({'model':db[_0x8bca('0xc6')],'as':_0x8bca('0xc6'),'raw':!![]});var _0x19f108=[{'model':db[_0x8bca('0xac')],'as':_0x8bca('0xc7'),'attributes':['id','body',_0x8bca('0x6b')],'include':_0x1b670d}];return db[_0x8bca('0x2e')][_0x8bca('0x51')]({'where':{'id':_0x2cf698[_0x8bca('0xa6')]['id']},'include':_0x19f108})[_0x8bca('0x24')](handleEntityNotFound(_0x4b1d29,null))[_0x8bca('0x24')](function(_0x383166){if(_0x383166&&_0x383166[_0x8bca('0xc7')]){var _0x22d5d3=_0x383166['get']({'plain':!![]});fs['mkdirSync'](_0x4d0b16);for(var _0x51bb6b=0x0;_0x51bb6b<_0x22d5d3[_0x8bca('0xc7')][_0x8bca('0x35')];_0x51bb6b++){var _0x49746f=_0x22d5d3[_0x8bca('0xc7')][_0x51bb6b][_0x8bca('0xc6')];if(_0x49746f){var _0x3ef138=path[_0x8bca('0xc3')](_0x3e7d0c,_0x49746f[_0x8bca('0xc8')]);if(fs[_0x8bca('0xc9')](_0x3ef138)){fs[_0x8bca('0xca')](_0x3ef138)[_0x8bca('0xcb')](fs[_0x8bca('0xcc')](path[_0x8bca('0xc3')](_0x4d0b16,_0x49746f[_0x8bca('0xc8')])));}}}return BPromise['resolve']()[_0x8bca('0x24')](function(){return new BPromise(function(_0x3c5da0,_0x3cce27){zipdir(_0x4d0b16,{'saveTo':_0x5b601d},function(_0x530d1d,_0x113c25){if(_0x530d1d)return _0x3cce27(_0x530d1d);return _0x3c5da0(_0x113c25);});})[_0x8bca('0x24')](function(){return new BPromise(function(_0x547245,_0x460331){rimraf(_0x4d0b16,function(_0x15850e){if(_0x15850e)_0x460331(_0x15850e);return _0x547245();});});})[_0x8bca('0x24')](function(){return _0x4b1d29[_0x8bca('0xbd')](_0x5b601d,_0x3c3bfd,function(_0x5f2ddf){if(_0x5f2ddf){console['log']('err',_0x5f2ddf);}else{fs[_0x8bca('0xcd')](_0x5b601d);}});});});}else{return _0x4b1d29[_0x8bca('0x19')](0xc8);}})['catch'](handleError(_0x4b1d29,null));}; \ No newline at end of file +var _0x3306=['c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','params','includeAll','include','options','body','describe','FaxMessage','addMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','json','count','offset','limit','status','set','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','isEmpty','FaxAccountId','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','DESC','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName'];(function(_0x2e689d,_0x4c3b29){var _0x540160=function(_0xac5c81){while(--_0xac5c81){_0x2e689d['push'](_0x2e689d['shift']());}};_0x540160(++_0x4c3b29);}(_0x3306,0x107));var _0x6330=function(_0x1202f0,_0x1534d8){_0x1202f0=_0x1202f0-0x0;var _0x3f4172=_0x3306[_0x1202f0];return _0x3f4172;};'use strict';var pdf=require(_0x6330('0x0'));var emlformat=require(_0x6330('0x1'));var rimraf=require(_0x6330('0x2'));var zipdir=require(_0x6330('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6330('0x4'));var moment=require(_0x6330('0x5'));var BPromise=require(_0x6330('0x6'));var Mustache=require(_0x6330('0x7'));var util=require(_0x6330('0x8'));var path=require('path');var sox=require(_0x6330('0x9'));var csv=require(_0x6330('0xa'));var ejs=require(_0x6330('0xb'));var fs=require('fs');var _=require(_0x6330('0xc'));var squel=require(_0x6330('0xd'));var crypto=require(_0x6330('0xe'));var jsforce=require(_0x6330('0xf'));var deskjs=require(_0x6330('0x10'));var toCsv=require(_0x6330('0xa'));var querystring=require(_0x6330('0x11'));var Papa=require('papaparse');var Redis=require(_0x6330('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6330('0x13'));var as=require(_0x6330('0x14'));var hardwareService=require(_0x6330('0x15'));var logger=require(_0x6330('0x16'))(_0x6330('0x17'));var utils=require(_0x6330('0x18'));var config=require(_0x6330('0x19'));var db=require(_0x6330('0x1a'))['db'];config['redis']=_['defaults'](config[_0x6330('0x1b')],{'host':_0x6330('0x1c'),'port':0x18eb});var socket=require(_0x6330('0x1d'))(new Redis(config[_0x6330('0x1b')]));require(_0x6330('0x1e'))['register'](socket);function respondWithStatusCode(_0x15fa68,_0x38367a){_0x38367a=_0x38367a||0xcc;return function(_0x11306d){if(_0x11306d){return _0x15fa68[_0x6330('0x1f')](_0x38367a);}return _0x15fa68['status'](_0x38367a)['end']();};}function respondWithResult(_0x32b59f,_0x476774){_0x476774=_0x476774||0xc8;return function(_0x3c3fac){if(_0x3c3fac){return _0x32b59f['status'](_0x476774)[_0x6330('0x20')](_0x3c3fac);}};}function respondWithFilteredResult(_0x40b99f,_0x5a643e){return function(_0x5c35fa){if(_0x5c35fa){var _0x348b34=_0x5c35fa[_0x6330('0x21')],_0x29fd07=_0x5a643e[_0x6330('0x22')],_0x3ba601=_0x5a643e[_0x6330('0x22')]+_0x5a643e[_0x6330('0x23')],_0x1545c8;if(_0x3ba601>=_0x348b34){_0x3ba601=_0x348b34;_0x1545c8=0xc8;}else{_0x1545c8=0xce;}_0x40b99f[_0x6330('0x24')](_0x1545c8);return _0x40b99f[_0x6330('0x25')]('Content-Range',_0x29fd07+'-'+_0x3ba601+'/'+_0x348b34)[_0x6330('0x20')](_0x5c35fa);}return null;};}function patchUpdates(_0x206757){return function(_0x29836d){try{jsonpatch[_0x6330('0x26')](_0x29836d,_0x206757,!![]);}catch(_0x352767){return BPromise['reject'](_0x352767);}return _0x29836d[_0x6330('0x27')]();};}function saveUpdates(_0x415840,_0x282809){return function(_0x1a6169){if(_0x1a6169){return _0x1a6169[_0x6330('0x28')](_0x415840)[_0x6330('0x29')](function(_0x50af90){return _0x50af90;});}return null;};}function removeEntity(_0x54cbeb,_0x59144c){return function(_0xd535b9){if(_0xd535b9){return _0xd535b9[_0x6330('0x2a')]()[_0x6330('0x29')](function(){_0x54cbeb[_0x6330('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ea33,_0x25aa25){return function(_0xba8b22){if(!_0xba8b22){_0x10ea33[_0x6330('0x1f')](0x194);}return _0xba8b22;};}function handleError(_0x1d8280,_0x4cf9d9){_0x4cf9d9=_0x4cf9d9||0x1f4;return function(_0x4ead1d){logger[_0x6330('0x2b')](_0x4ead1d[_0x6330('0x2c')]);if(_0x4ead1d[_0x6330('0x2d')]){delete _0x4ead1d['name'];}_0x1d8280[_0x6330('0x24')](_0x4cf9d9)[_0x6330('0x2e')](_0x4ead1d);};}function getInteractionUsers(_0x325037,_0x395578){return new BPromise(function(_0x4a55c4,_0x46011b){try{if(_0x395578[_0x325037['id']]){_0x325037['Users']=_[_0x6330('0x2f')](_0x395578[_0x325037['id']],function(_0x43799b){return{'id':_0x43799b['id'],'fullname':_0x43799b[_0x6330('0x30')]};});}}catch(_0x3e8efc){_0x46011b(_0x3e8efc);}_0x4a55c4(_0x325037);});}function getInteractionTags(_0x4d41c5,_0x102315){return new BPromise(function(_0x26a76e,_0x547f35){try{if(_0x4d41c5[_0x6330('0x31')]){_0x4d41c5[_0x6330('0x32')]=[];_0x4d41c5['TagIds'][_0x6330('0x33')](',')['forEach'](function(_0xaaf11d){_0x4d41c5['Tags'][_0x6330('0x34')](_0x102315[_0xaaf11d]);});}delete _0x4d41c5['TagIds'];}catch(_0x4d6a7a){_0x547f35(_0x4d6a7a);}_0x26a76e(_0x4d41c5);});}function updateFaxInteraction(_0x3c83bd,_0x431574,_0x2cff0f){return new BPromise(function(_0x12d432,_0x215c72){return getInteractionUsers(_0x3c83bd,_0x2cff0f)[_0x6330('0x29')](function(_0x3c62e3){return getInteractionTags(_0x3c62e3,_0x431574);})[_0x6330('0x29')](function(_0x24f857){_0x12d432(_0x24f857);})[_0x6330('0x35')](function(_0x28742a){_0x215c72(_0x28742a);});});}exports[_0x6330('0x36')]=function(_0x4c9b94,_0x293ffd){var _0x59eeb7={},_0x33fbf4={},_0x129175={'count':0x0,'rows':[]};var _0x2a193b=_[_0x6330('0x2f')](db[_0x6330('0x37')][_0x6330('0x38')],function(_0x370d40){return{'name':_0x370d40[_0x6330('0x39')],'type':_0x370d40[_0x6330('0x3a')][_0x6330('0x3b')]};});_0x33fbf4['model']=_[_0x6330('0x2f')](_0x2a193b,_0x6330('0x2d'));_0x33fbf4['query']=_['keys'](_0x4c9b94[_0x6330('0x3c')]);_0x33fbf4['filters']=_[_0x6330('0x3d')](_0x33fbf4[_0x6330('0x3e')],_0x33fbf4[_0x6330('0x3c')]);_0x59eeb7[_0x6330('0x3f')]=_[_0x6330('0x3d')](_0x33fbf4[_0x6330('0x3e')],qs[_0x6330('0x40')](_0x4c9b94[_0x6330('0x3c')]['fields']));_0x59eeb7[_0x6330('0x3f')]=_0x59eeb7[_0x6330('0x3f')][_0x6330('0x41')]?_0x59eeb7['attributes']:_0x33fbf4['model'];if(!_0x4c9b94[_0x6330('0x3c')][_0x6330('0x42')](_0x6330('0x43'))){_0x59eeb7['limit']=qs['limit'](_0x4c9b94['query']['limit']);_0x59eeb7['offset']=qs[_0x6330('0x22')](_0x4c9b94['query']['offset']);}_0x59eeb7[_0x6330('0x44')]=qs[_0x6330('0x45')](_0x4c9b94[_0x6330('0x3c')][_0x6330('0x45')]);_0x59eeb7[_0x6330('0x46')]=qs[_0x6330('0x47')](_[_0x6330('0x48')](_0x4c9b94[_0x6330('0x3c')],_0x33fbf4[_0x6330('0x47')]),_0x2a193b);var _0x326a75=[];var _0x531c8a=squel[_0x6330('0x49')]()[_0x6330('0x4a')]('id')[_0x6330('0x4a')](_0x6330('0x2d'))[_0x6330('0x4a')]('color')[_0x6330('0x4b')](_0x6330('0x4c'));var _0x4fca9b=squel[_0x6330('0x49')]()[_0x6330('0x4a')](_0x6330('0x4d'))['field'](_0x6330('0x4e'))[_0x6330('0x4a')](_0x6330('0x4f'))[_0x6330('0x4b')](_0x6330('0x50'),'ui')['left_join'](_0x6330('0x51'),'u',_0x6330('0x52'));var _0xb8555a=squel[_0x6330('0x49')]()[_0x6330('0x4b')](_0x6330('0x53'),'i')[_0x6330('0x54')]('cm_contacts','c',_0x6330('0x55'))[_0x6330('0x54')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x6330('0x56'),'a','a.id\x20=\x20i.FaxAccountId')[_0x6330('0x54')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x6330('0x54')](_0x6330('0x57'),'it',_0x6330('0x58'))[_0x6330('0x54')]('tools_tags','t',_0x6330('0x59'));var _0x66f6a2=squel['expr']();var _0x1831e2=[];var _0x5d0ffc=squel[_0x6330('0x5a')]();var _0x2ffb53;if(_0x4c9b94[_0x6330('0x3c')][_0x6330('0x5b')]){_0x2ffb53=as[_0x6330('0x5c')](_0x4c9b94[_0x6330('0x3c')][_0x6330('0x5b')]);var _0x489612=_0x2ffb53[_0x6330('0x5d')];for(var _0x17a0dd=0x0;_0x17a0dd<_0x2ffb53[_0x6330('0x5e')]['length'];_0x17a0dd++){var _0x3365a0=_0x2ffb53['conditions'][_0x17a0dd];var _0x28c280='i';var _0x57b611=_[_0x6330('0x5f')](_0x2a193b,[_0x6330('0x2d'),_0x3365a0[_0x6330('0x4a')]]);if(!_0x57b611){switch(_0x3365a0[_0x6330('0x4a')]){case _0x6330('0x60'):if(_0x3365a0['value']==0x1){_0xb8555a[_0x6330('0x61')]('`'+_0x3365a0[_0x6330('0x4a')]+_0x6330('0x62'));}else{_0xb8555a[_0x6330('0x61')]('`'+_0x3365a0[_0x6330('0x4a')]+_0x6330('0x63'));}break;case'Contact':if(_0x3365a0[_0x6330('0x64')]===_0x6330('0x65')){if(_0x3365a0[_0x6330('0x66')][_0x6330('0x33')]('\x20')[_0x6330('0x41')]>0x1){_0x66f6a2[_0x489612](_0x6330('0x67'),qs['getFullTextValue'](_0x3365a0[_0x6330('0x66')]),null);}else{var _0x1ff69b='%'+_0x3365a0[_0x6330('0x66')]+'%';_0x66f6a2[_0x489612](_0x6330('0x68'),_0x1ff69b,_0x1ff69b,_0x1ff69b);}}else{_0x57b611=_['find'](_0x2a193b,[_0x6330('0x2d'),'ContactId']);_0x3365a0[_0x6330('0x4a')]=_0x6330('0x69');_0x47a841=as[_0x6330('0x6a')](_0x28c280,_0x57b611['type'],_0x3365a0);_0x66f6a2[_0x489612](_0x47a841[_0x6330('0x6b')],_0x47a841[_0x6330('0x66')][_0x6330('0x6c')],_0x47a841[_0x6330('0x66')][_0x6330('0x6d')]);}break;case _0x6330('0x6e'):var _0x5689e6=_0x3365a0[_0x6330('0x66')]['split'](',')['map'](function(_0xfa70bf){return Number(_0xfa70bf);});_0x5689e6[_0x6330('0x6f')](function(_0x1ae62f){_0x5d0ffc['or'](_0x6330('0x70'),'%,'+_0x1ae62f+',%');});_0x1831e2=_['union'](_0x1831e2,_0x5689e6);break;case _0x6330('0x71'):if(_0x3365a0['operator']===_0x6330('0x65')){_0x66f6a2[_0x489612](_0x6330('0x72'),'%'+_0x3365a0[_0x6330('0x66')]+'%',null);}else{_0x57b611=_[_0x6330('0x5f')](_0x2a193b,['name',_0x6330('0x73')]);_0x3365a0['field']=_0x6330('0x73');_0x47a841=as[_0x6330('0x6a')](_0x28c280,_0x57b611[_0x6330('0x3a')],_0x3365a0);_0x66f6a2[_0x489612](_0x47a841[_0x6330('0x6b')],_0x47a841[_0x6330('0x66')]['start'],_0x47a841['value'][_0x6330('0x6d')]);}break;case'body':_0x47a841=as[_0x6330('0x6a')]('me',null,_0x3365a0);_0x66f6a2[_0x489612](_0x47a841['text'],_0x47a841[_0x6330('0x66')][_0x6330('0x6c')],_0x47a841[_0x6330('0x66')][_0x6330('0x6d')]);break;}}else{var _0x47a841=as[_0x6330('0x6a')](_0x28c280,_0x57b611[_0x6330('0x3a')],_0x3365a0);_0x66f6a2[_0x489612](_0x47a841[_0x6330('0x6b')],_0x47a841[_0x6330('0x66')][_0x6330('0x6c')],_0x47a841['value'][_0x6330('0x6d')]);}}}else{var _0x139ace=_(_0x4c9b94[_0x6330('0x3c')])[_0x6330('0x74')]()[_0x6330('0x2f')](function(_0x2e4932){return _[_0x6330('0x75')](_0x2a193b,[_0x6330('0x2d'),_0x2e4932])?_0x2e4932:undefined;})['compact']()[_0x6330('0x66')]();if(!_[_0x6330('0x76')](_0x139ace)){_0x139ace['forEach'](function(_0x39a46f){if(_0x39a46f===_0x6330('0x77')){_0xb8555a[_0x6330('0x46')]('i.FaxAccountId\x20IN\x20?',[][_0x6330('0x78')](_0x4c9b94[_0x6330('0x3c')][_0x39a46f]));}else if(_0x39a46f===_0x6330('0x79')){var _0x4f13fe=JSON[_0x6330('0x7a')](_0x4c9b94['query'][_0x39a46f])[_0x6330('0x7b')];var _0xf6b465=JSON[_0x6330('0x7a')](_0x4c9b94[_0x6330('0x3c')][_0x39a46f])[_0x6330('0x7c')];_0xb8555a['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f13fe,_0xf6b465);}else{if(_0x4c9b94[_0x6330('0x3c')][_0x39a46f]===_0x6330('0x7d')){_0xb8555a[_0x6330('0x46')]('i.'+_0x39a46f+_0x6330('0x7e'));}else{_0xb8555a[_0x6330('0x46')]('i.'+_0x39a46f+_0x6330('0x7f'),_0x4c9b94[_0x6330('0x3c')][_0x39a46f]);}}});}if(_0x4c9b94['query']['read']){if(_0x4c9b94[_0x6330('0x3c')][_0x6330('0x80')]==0x1){_0xb8555a[_0x6330('0x61')](_0x6330('0x81'));}else{_0xb8555a[_0x6330('0x61')](_0x6330('0x82'));}}if(_0x4c9b94[_0x6330('0x3c')][_0x6330('0x83')]){_0x1831e2=_[_0x6330('0x84')](_0x4c9b94['query'][_0x6330('0x83')])?_0x4c9b94[_0x6330('0x3c')]['tag']:new Array(_0x4c9b94[_0x6330('0x3c')][_0x6330('0x83')]);_0x1831e2[_0x6330('0x6f')](function(_0x4322fc){_0x5d0ffc['or'](_0x6330('0x70'),'%,'+_0x4322fc+',%');});}if(_0x4c9b94['query']['filter']){var _0x5cf3c4=_0x4c9b94[_0x6330('0x3c')][_0x6330('0x85')][_0x6330('0x86')]('\x5c','\x5c\x5c')[_0x6330('0x86')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x6330('0x87')](_0x5cf3c4)){_0x66f6a2['or'](_0x6330('0x88'),_0x5cf3c4+'%')['or']('i.fax\x20LIKE\x20?',_0x5cf3c4+'%');}_0x66f6a2['or'](_0x6330('0x89'),_0x5cf3c4+'%');}}_0xb8555a[_0x6330('0x46')](_0x66f6a2);_0xb8555a[_0x6330('0x8a')](_0x6330('0x8b'));var _0x5a2e42={'type':db[_0x6330('0x8c')][_0x6330('0x8d')]['SELECT'],'raw':!![]};var _0x2d8b70=_0xb8555a[_0x6330('0x8e')]();_0x2d8b70[_0x6330('0x4a')](_0x6330('0x8b'));_0x2d8b70[_0x6330('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6330('0x60'));if(_0x59eeb7[_0x6330('0x44')]){_0x59eeb7[_0x6330('0x44')][_0x6330('0x6f')](function(_0x11c4e3){_0xb8555a['order']('i.'+_0x11c4e3[0x0],_0x11c4e3[0x1]===_0x6330('0x8f')?![]:!![]);});}if(!_[_0x6330('0x76')](_0x1831e2)){_0xb8555a[_0x6330('0x61')](_0x5d0ffc);_0x2d8b70[_0x6330('0x46')]('t.id\x20IN\x20?',_0x1831e2);}BPromise[_0x6330('0x90')]()[_0x6330('0x29')](function(){if(!_0x2ffb53){if(_0x4c9b94[_0x6330('0x3c')][_0x6330('0x77')]||_0x4c9b94[_0x6330('0x3c')][_0x6330('0x91')])return;_0x2d8b70['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xb8555a[_0x6330('0x46')](_0x6330('0x92'));return;}return _0x4c9b94[_0x6330('0x93')][_0x6330('0x94')]({'attributes':['id'],'raw':!![]})[_0x6330('0x29')](function(_0x3fcb29){if(_['isEmpty'](_0x3fcb29)){_0x2d8b70['where'](_0x6330('0x95'));_0xb8555a[_0x6330('0x46')](_0x6330('0x95'));}else{_0x2d8b70[_0x6330('0x46')]('i.FaxAccountId\x20IN\x20?',_[_0x6330('0x2f')](_0x3fcb29,'id'));_0xb8555a[_0x6330('0x46')](_0x6330('0x96'),_['map'](_0x3fcb29,'id'));}});})[_0x6330('0x29')](function(){db[_0x6330('0x97')][_0x6330('0x3c')](_0x2d8b70[_0x6330('0x98')](),_0x5a2e42)['then'](function(_0x3c764b){_0x129175[_0x6330('0x21')]=_0x3c764b[_0x6330('0x41')];if(_0x129175[_0x6330('0x21')]===0x0)return[];return db[_0x6330('0x97')]['query'](_0x531c8a[_0x6330('0x98')](),_0x5a2e42)['then'](function(_0x1858a3){_0x326a75=_['keyBy'](_0x1858a3,'id');_0x5a2e42=_[_0x6330('0x99')](_0x5a2e42,{'model':db[_0x6330('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c9b94[_0x6330('0x3c')]['fields']){_0x59eeb7[_0x6330('0x3f')][_0x6330('0x6f')](function(_0x31d996){_0xb8555a[_0x6330('0x4a')]('i.'+_0x31d996);});}else{_0xb8555a['field'](_0x6330('0x9a'),_0x6330('0x60'));_0xb8555a['field'](_0x6330('0x9b'),_0x6330('0x9c'));_0xb8555a['field'](_0x6330('0x9d'),_0x6330('0x9e'));_0xb8555a[_0x6330('0x4a')](_0x6330('0x9f'));_0xb8555a[_0x6330('0x4a')](_0x6330('0xa0'),_0x6330('0xa1'));_0xb8555a[_0x6330('0x4a')]('c.lastName',_0x6330('0xa2'));_0xb8555a[_0x6330('0x4a')](_0x6330('0xa3'),_0x6330('0xa4'));_0xb8555a[_0x6330('0x4a')](_0x6330('0xa5'),_0x6330('0xa6'));_0xb8555a[_0x6330('0x4a')](_0x6330('0xa7'),'Contact.mobile');_0xb8555a[_0x6330('0x4a')]('c.fax',_0x6330('0xa8'));_0xb8555a[_0x6330('0x4a')](_0x6330('0xa9'),_0x6330('0xaa'));_0xb8555a[_0x6330('0x4a')]('o.internal','Owner.internal');_0xb8555a[_0x6330('0x4a')](_0x6330('0xab'),_0x6330('0x31'));}if(_0x59eeb7['limit'])_0xb8555a[_0x6330('0x23')](_0x59eeb7['limit']);if(_0x59eeb7[_0x6330('0x22')])_0xb8555a['offset'](_0x59eeb7[_0x6330('0x22')]);return db[_0x6330('0x97')][_0x6330('0x3c')](_0xb8555a[_0x6330('0x98')](),_0x5a2e42);})[_0x6330('0x29')](function(_0x45fcfd){_0x4fca9b['where'](_0x6330('0xac'),_[_0x6330('0x2f')](_0x45fcfd,'id'));return db[_0x6330('0x97')][_0x6330('0x3c')](_0x4fca9b[_0x6330('0x98')](),_0x5a2e42)['then'](function(_0xd67f96){var _0x279a56=_[_0x6330('0xad')](_0xd67f96,_0x6330('0xae'));var _0x264b43=[];_0x45fcfd['forEach'](function(_0x527d33){_0x264b43[_0x6330('0x34')](updateFaxInteraction(_0x527d33,_0x326a75,_0x279a56));});return BPromise[_0x6330('0xaf')](_0x264b43);});});})['then'](function(_0x2e4293){_0x129175[_0x6330('0xb0')]=_0x2e4293;return _0x129175;})[_0x6330('0x29')](respondWithFilteredResult(_0x293ffd,_0x59eeb7));})['catch'](handleError(_0x293ffd,null));};exports['show']=function(_0x43e3c1,_0x2c464b){var _0x377c66={'raw':![],'where':{'id':_0x43e3c1[_0x6330('0xb1')]['id']}},_0x13311e={};_0x13311e[_0x6330('0x3e')]=_[_0x6330('0x74')](db[_0x6330('0x37')]['rawAttributes']);_0x13311e[_0x6330('0x3c')]=_[_0x6330('0x74')](_0x43e3c1[_0x6330('0x3c')]);_0x13311e[_0x6330('0x47')]=_[_0x6330('0x3d')](_0x13311e[_0x6330('0x3e')],_0x13311e[_0x6330('0x3c')]);_0x377c66['attributes']=_[_0x6330('0x3d')](_0x13311e[_0x6330('0x3e')],qs[_0x6330('0x40')](_0x43e3c1[_0x6330('0x3c')][_0x6330('0x40')]));_0x377c66['attributes']=_0x377c66[_0x6330('0x3f')][_0x6330('0x41')]?_0x377c66['attributes']:_0x13311e[_0x6330('0x3e')];if(_0x43e3c1[_0x6330('0x3c')][_0x6330('0xb2')]){_0x377c66[_0x6330('0xb3')]=[{'all':!![]}];}_0x377c66=_[_0x6330('0x99')]({},_0x377c66,_0x43e3c1[_0x6330('0xb4')]);return db[_0x6330('0x37')][_0x6330('0x5f')](_0x377c66)[_0x6330('0x29')](handleEntityNotFound(_0x2c464b,null))[_0x6330('0x29')](respondWithResult(_0x2c464b,null))[_0x6330('0x35')](handleError(_0x2c464b,null));};exports['create']=function(_0x5eda6e,_0x190102){return db['FaxInteraction']['create'](_0x5eda6e[_0x6330('0xb5')],{})[_0x6330('0x29')](respondWithResult(_0x190102,0xc9))['catch'](handleError(_0x190102,null));};exports[_0x6330('0x28')]=function(_0x20de10,_0x4f9f99){if(_0x20de10[_0x6330('0xb5')]['id']){delete _0x20de10[_0x6330('0xb5')]['id'];}return db[_0x6330('0x37')][_0x6330('0x5f')]({'where':{'id':_0x20de10[_0x6330('0xb1')]['id']}})[_0x6330('0x29')](handleEntityNotFound(_0x4f9f99,null))[_0x6330('0x29')](saveUpdates(_0x20de10[_0x6330('0xb5')],null))[_0x6330('0x29')](respondWithResult(_0x4f9f99,null))[_0x6330('0x35')](handleError(_0x4f9f99,null));};exports[_0x6330('0x2a')]=function(_0x375c00,_0x12eabf){return db[_0x6330('0x37')][_0x6330('0x5f')]({'where':{'id':_0x375c00[_0x6330('0xb1')]['id']}})['then'](handleEntityNotFound(_0x12eabf,null))[_0x6330('0x29')](removeEntity(_0x12eabf,null))[_0x6330('0x35')](handleError(_0x12eabf,null));};exports[_0x6330('0xb6')]=function(_0x2f9917,_0x46e243){return db[_0x6330('0x37')][_0x6330('0xb6')]()[_0x6330('0x29')](respondWithResult(_0x46e243,null))[_0x6330('0x35')](handleError(_0x46e243,null));};exports['addMessage']=function(_0x4f39f0,_0x3e2fac,_0x30ff61){return db[_0x6330('0xb7')][_0x6330('0x5f')]({'where':{'id':_0x4f39f0[_0x6330('0xb1')]['id']}})['then'](handleEntityNotFound(_0x3e2fac,null))['then'](function(_0xe7c69){if(_0xe7c69){return _0xe7c69[_0x6330('0xb8')](_0x4f39f0[_0x6330('0xb5')][_0x6330('0xb9')],_['omit'](_0x4f39f0[_0x6330('0xb5')],[_0x6330('0xb9'),'id'])||{});}})[_0x6330('0x29')](respondWithResult(_0x3e2fac,null))[_0x6330('0x35')](handleError(_0x3e2fac,null));};exports[_0x6330('0xba')]=function(_0x19a100,_0x478015,_0x58976d){var _0x38c6fd={'raw':![],'where':{}};var _0x9a1631={};var _0x113513={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x19a100[_0x6330('0xb1')]['id']}})[_0x6330('0x29')](handleEntityNotFound(_0x478015,null))[_0x6330('0x29')](function(_0x20d10f){if(_0x20d10f){_0x9a1631[_0x6330('0x3e')]=_['keys'](db[_0x6330('0xb7')][_0x6330('0x38')]);_0x9a1631[_0x6330('0x3c')]=_[_0x6330('0x74')](_0x19a100[_0x6330('0x3c')]);_0x9a1631['filters']=_[_0x6330('0x3d')](_0x9a1631[_0x6330('0x3e')],_0x9a1631[_0x6330('0x3c')]);_0x38c6fd['attributes']=_[_0x6330('0x3d')](_0x9a1631['model'],qs['fields'](_0x19a100[_0x6330('0x3c')][_0x6330('0x40')]));_0x38c6fd[_0x6330('0x3f')]=_0x38c6fd[_0x6330('0x3f')][_0x6330('0x41')]?_0x38c6fd[_0x6330('0x3f')]:_0x9a1631[_0x6330('0x3e')];if(!_0x19a100[_0x6330('0x3c')]['hasOwnProperty'](_0x6330('0x43'))){_0x38c6fd[_0x6330('0x23')]=qs[_0x6330('0x23')](_0x19a100[_0x6330('0x3c')][_0x6330('0x23')]);_0x38c6fd[_0x6330('0x22')]=qs[_0x6330('0x22')](_0x19a100[_0x6330('0x3c')][_0x6330('0x22')]);}_0x38c6fd[_0x6330('0x44')]=qs[_0x6330('0x45')](_0x19a100[_0x6330('0x3c')][_0x6330('0x45')]);_0x38c6fd[_0x6330('0x46')]=qs[_0x6330('0x47')](_[_0x6330('0x48')](_0x19a100['query'],_0x9a1631[_0x6330('0x47')]));_0x38c6fd[_0x6330('0x46')]['FaxInteractionId']=_0x20d10f['id'];if(_0x19a100[_0x6330('0x3c')][_0x6330('0x85')]){_0x38c6fd[_0x6330('0x46')]=_['merge'](_0x38c6fd[_0x6330('0x46')],{'$or':_[_0x6330('0x2f')](_0x38c6fd[_0x6330('0x3f')],function(_0x4fd3c7){var _0x562457={};_0x562457[_0x4fd3c7]={'$like':'%'+_0x19a100[_0x6330('0x3c')][_0x6330('0x85')]+'%'};return _0x562457;})});}if(_0x19a100['query']['$gte']){var _0x4262b0=_0x19a100[_0x6330('0x3c')]['$gte'][_0x6330('0x33')](',');var _0x3817b1={};_0x3817b1[_0x4262b0[0x0]]={'$gte':moment(_0x4262b0[0x1])[_0x6330('0xbb')](_0x6330('0xbc'))};_0x38c6fd[_0x6330('0x46')]=_[_0x6330('0x99')](_0x38c6fd['where'],_0x3817b1);}_0x38c6fd=_[_0x6330('0x99')]({},_0x38c6fd,_0x19a100[_0x6330('0xb4')]);return db[_0x6330('0xb7')]['count']({'where':_0x38c6fd[_0x6330('0x46')]})['then'](function(_0x3d5156){_0x113513['count']=_0x3d5156;if(_0x19a100[_0x6330('0x3c')][_0x6330('0xb2')]){_0x38c6fd[_0x6330('0xb3')]=[{'all':!![]}];}return db[_0x6330('0xb7')][_0x6330('0xbd')](_0x38c6fd);})[_0x6330('0x29')](function(_0x4c1ef0){_0x113513['rows']=_0x4c1ef0;return _0x113513;});}})['then'](respondWithFilteredResult(_0x478015,_0x38c6fd))[_0x6330('0x35')](handleError(_0x478015,null));};exports[_0x6330('0xbe')]=function(_0x6b15f,_0x1a0056,_0xef9881){return db[_0x6330('0x37')][_0x6330('0x5f')]({'where':{'id':_0x6b15f[_0x6330('0xb1')]['id']}})[_0x6330('0x29')](handleEntityNotFound(_0x1a0056,null))['then'](function(_0x27160d){if(_0x27160d){return _0x27160d['setTags'](_0x6b15f[_0x6330('0xb5')][_0x6330('0xb9')],_[_0x6330('0xbf')](_0x6b15f[_0x6330('0xb5')],[_0x6330('0xb9'),'id'])||{})[_0x6330('0xc0')](function(){return db[_0x6330('0x6e')][_0x6330('0xbd')]({'attributes':['id',_0x6330('0x2d'),_0x6330('0xc1')],'where':{'id':_0x6b15f['body'][_0x6330('0xb9')]}});})[_0x6330('0x29')](function(_0x2a1915){socket[_0x6330('0xc2')](_0x6330('0xc3'),{'id':Number(_0x6b15f['params']['id']),'tags':_0x2a1915||[]});return{'id':Number(_0x6b15f[_0x6330('0xb1')]['id']),'tags':_0x2a1915||[]};});}})[_0x6330('0x29')](respondWithResult(_0x1a0056,null))[_0x6330('0x35')](handleError(_0x1a0056,null));};exports[_0x6330('0xc4')]=function(_0xe0092f,_0xfcbaf3,_0x23613c){return db[_0x6330('0x37')]['find']({'where':{'id':_0xe0092f['params']['id']}})[_0x6330('0x29')](handleEntityNotFound(_0xfcbaf3,null))['then'](function(_0x517f6d){if(_0x517f6d){return _0x517f6d['removeTags'](_0xe0092f[_0x6330('0x3c')][_0x6330('0xb9')]);}})[_0x6330('0x29')](respondWithStatusCode(_0xfcbaf3,null))[_0x6330('0x35')](handleError(_0xfcbaf3,null));};exports[_0x6330('0xc5')]=function(_0x3edc0f,_0x43fbb7){var _0x5d7e46=moment()[_0x6330('0xc6')]()['toString']();var _0x536f17=path[_0x6330('0xc7')](config[_0x6330('0xc8')],_0x6330('0xc9'),_0x6330('0xca'),_0x6330('0xcb'));var _0x448b45=path['join'](config[_0x6330('0xc8')],'server',_0x6330('0xca'),_0x6330('0xcc'));var _0x41a990=path[_0x6330('0xc7')](_0x536f17,_0x5d7e46);var _0x1bf601=util['format'](_0x6330('0xcd'),_0x3edc0f[_0x6330('0xb1')]['id'],_0x5d7e46);var _0x1d450f=path[_0x6330('0xc7')](_0x536f17,_0x1bf601);var _0x21fefd=[];_0x21fefd[_0x6330('0x34')]({'model':db[_0x6330('0xce')],'as':_0x6330('0xce'),'raw':!![]});var _0x53bb63=[{'model':db[_0x6330('0xb7')],'as':_0x6330('0xcf'),'attributes':['id',_0x6330('0xb5'),'createdAt'],'include':_0x21fefd}];return db['FaxInteraction'][_0x6330('0x5f')]({'where':{'id':_0x3edc0f['params']['id']},'include':_0x53bb63})[_0x6330('0x29')](handleEntityNotFound(_0x43fbb7,null))[_0x6330('0x29')](function(_0x18ca7b){if(_0x18ca7b&&_0x18ca7b[_0x6330('0xcf')]){var _0x19e723=_0x18ca7b[_0x6330('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x41a990);for(var _0x4472ba=0x0;_0x4472ba<_0x19e723[_0x6330('0xcf')][_0x6330('0x41')];_0x4472ba++){var _0x51a7fd=_0x19e723[_0x6330('0xcf')][_0x4472ba][_0x6330('0xce')];if(_0x51a7fd){var _0x1495db=path[_0x6330('0xc7')](_0x448b45,_0x51a7fd[_0x6330('0xd1')]);if(fs[_0x6330('0xd2')](_0x1495db)){fs[_0x6330('0xd3')](_0x1495db)[_0x6330('0xd4')](fs['createWriteStream'](path['join'](_0x41a990,_0x51a7fd['basename'])));}}}return BPromise[_0x6330('0x90')]()[_0x6330('0x29')](function(){return new BPromise(function(_0x49cb3e,_0x9d42a){zipdir(_0x41a990,{'saveTo':_0x1d450f},function(_0x3b7a62,_0x56f5d6){if(_0x3b7a62)return _0x9d42a(_0x3b7a62);return _0x49cb3e(_0x56f5d6);});})['then'](function(){return new BPromise(function(_0x1027b5,_0x585d9c){rimraf(_0x41a990,function(_0x431507){if(_0x431507)_0x585d9c(_0x431507);return _0x1027b5();});});})[_0x6330('0x29')](function(){return _0x43fbb7[_0x6330('0xc5')](_0x1d450f,_0x1bf601,function(_0x17d5c6){if(_0x17d5c6){console['log']('err',_0x17d5c6);}else{fs['unlinkSync'](_0x1d450f);}});});});}else{return _0x43fbb7['sendStatus'](0xc8);}})[_0x6330('0x35')](handleError(_0x43fbb7,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9905723..06c41f5 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 _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x4e72ee,_0x12dfa0){var _0xa767bf=function(_0x37346b){while(--_0x37346b){_0x4e72ee['push'](_0x4e72ee['shift']());}};_0xa767bf(++_0x12dfa0);}(_0x7a54,0x106));var _0x47a5=function(_0x5ae47d,_0x10f660){_0x5ae47d=_0x5ae47d-0x0;var _0x21f4c1=_0x7a54[_0x5ae47d];return _0x21f4c1;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x55d3ab,_0x548b3d){var _0x5e50b4=function(_0x5f5872){while(--_0x5f5872){_0x55d3ab['push'](_0x55d3ab['shift']());}};_0x5e50b4(++_0x548b3d);}(_0x814b,0x1a2));var _0xb814=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x814b[_0x1de43c];return _0x296d3e;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('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 7d32cf3..0d1c8c6 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 _0x510d=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x510d,0xba));var _0xd510=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x510d[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0xd510('0x0'));var util=require(_0xd510('0x1'));var logger=require(_0xd510('0x2'))(_0xd510('0x3'));var moment=require(_0xd510('0x4'));var BPromise=require(_0xd510('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd510('0x6'));var rimraf=require(_0xd510('0x7'));var config=require(_0xd510('0x8'));var attributes=require(_0xd510('0x9'));module[_0xd510('0xa')]=function(_0x2488ec,_0x29efdc){return _0x2488ec['define'](_0xd510('0xb'),attributes,{'tableName':_0xd510('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36416b,_0x3af276,_0x88bb16){if(_0x36416b['changed'](_0xd510('0xd'))){_0x36416b[_0xd510('0xe')]=moment()['format'](_0xd510('0xf'));}_0x88bb16(null,_0x36416b);}}});}; \ No newline at end of file +var _0x7f79=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x33536e,_0x31bde3){var _0x4c699e=function(_0xaf6387){while(--_0xaf6387){_0x33536e['push'](_0x33536e['shift']());}};_0x4c699e(++_0x31bde3);}(_0x7f79,0xab));var _0x97f7=function(_0x227287,_0x2f36a9){_0x227287=_0x227287-0x0;var _0x1beef6=_0x7f79[_0x227287];return _0x1beef6;};'use strict';var _=require(_0x97f7('0x0'));var util=require(_0x97f7('0x1'));var logger=require(_0x97f7('0x2'))('api');var moment=require(_0x97f7('0x3'));var BPromise=require('bluebird');var rp=require(_0x97f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x97f7('0x5'));var attributes=require(_0x97f7('0x6'));module[_0x97f7('0x7')]=function(_0x48653a,_0x703fea){return _0x48653a[_0x97f7('0x8')]('FaxInteraction',attributes,{'tableName':_0x97f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x76e478,_0x4f7f46,_0x418066){if(_0x76e478[_0x97f7('0xa')](_0x97f7('0xb'))){_0x76e478[_0x97f7('0xc')]=moment()[_0x97f7('0xd')](_0x97f7('0xe'));}_0x418066(null,_0x76e478);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 63a3bea..44bd062 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 _0x8561=['redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxInteraction','options','where','limit','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x145c5b,_0x12d913){var _0x11cd3c=function(_0x20be08){while(--_0x20be08){_0x145c5b['push'](_0x145c5b['shift']());}};_0x11cd3c(++_0x12d913);}(_0x8561,0x78));var _0x1856=function(_0x31aa84,_0x3bcc8b){_0x31aa84=_0x31aa84-0x0;var _0x2d9e3e=_0x8561[_0x31aa84];return _0x2d9e3e;};'use strict';var _=require(_0x1856('0x0'));var util=require(_0x1856('0x1'));var moment=require(_0x1856('0x2'));var BPromise=require(_0x1856('0x3'));var rs=require(_0x1856('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1856('0x5'))['db'];var utils=require(_0x1856('0x6'));var logger=require('../../config/logger')(_0x1856('0x7'));var config=require(_0x1856('0x8'));var jayson=require(_0x1856('0x9'));var client=jayson[_0x1856('0xa')][_0x1856('0xb')]({'port':0x232a});config[_0x1856('0xc')]=_[_0x1856('0xd')](config[_0x1856('0xc')],{'host':_0x1856('0xe'),'port':0x18eb});var socket=require(_0x1856('0xf'))(new Redis(config['redis']));require(_0x1856('0x10'))[_0x1856('0x11')](socket);function respondWithRpcPromise(_0x58a223,_0x284e92,_0x76f757){return new BPromise(function(_0x20a6e7,_0x1860f4){return client[_0x1856('0x12')](_0x58a223,_0x76f757)[_0x1856('0x13')](function(_0x54febc){logger[_0x1856('0x14')](_0x1856('0x15'),_0x284e92,_0x1856('0x16'));logger[_0x1856('0x17')](_0x1856('0x18'),_0x284e92,_0x1856('0x16'),JSON['stringify'](_0x54febc));if(_0x54febc[_0x1856('0x19')]){if(_0x54febc[_0x1856('0x19')][_0x1856('0x1a')]===0x1f4){logger[_0x1856('0x19')](_0x1856('0x15'),_0x284e92,_0x54febc[_0x1856('0x19')][_0x1856('0x1b')]);return _0x1860f4(_0x54febc['error'][_0x1856('0x1b')]);}logger[_0x1856('0x19')](_0x1856('0x15'),_0x284e92,_0x54febc[_0x1856('0x19')][_0x1856('0x1b')]);return _0x20a6e7(_0x54febc[_0x1856('0x19')][_0x1856('0x1b')]);}else{logger['info'](_0x1856('0x15'),_0x284e92,'request\x20sent');_0x20a6e7(_0x54febc[_0x1856('0x1c')][_0x1856('0x1b')]);}})[_0x1856('0x1d')](function(_0xcd82d8){logger[_0x1856('0x19')](_0x1856('0x15'),_0x284e92,_0xcd82d8);_0x1860f4(_0xcd82d8);});});}exports['UpdateFaxInteraction']=function(_0x4770c2){var _0x5d84f9=this;return new Promise(function(_0x4f7492,_0x3a6613){return db[_0x1856('0x1e')]['update'](_0x4770c2['body'],{'raw':_0x4770c2[_0x1856('0x1f')]?_0x4770c2[_0x1856('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4770c2['options']?_0x4770c2['options'][_0x1856('0x20')]||null:null,'attributes':_0x4770c2[_0x1856('0x1f')]?_0x4770c2[_0x1856('0x1f')]['attributes']||null:null,'limit':_0x4770c2['options']?_0x4770c2[_0x1856('0x1f')][_0x1856('0x21')]||null:null})['then'](function(_0x48ee6f){logger[_0x1856('0x14')](_0x1856('0x22'),_0x4770c2);logger[_0x1856('0x17')](_0x1856('0x22'),_0x4770c2,JSON[_0x1856('0x23')](_0x48ee6f));_0x4f7492(_0x48ee6f);})['catch'](function(_0x435651){logger[_0x1856('0x19')](_0x1856('0x22'),_0x435651[_0x1856('0x1b')],_0x4770c2);_0x3a6613(_0x5d84f9[_0x1856('0x19')](0x1f4,_0x435651[_0x1856('0x1b')]));});});};exports[_0x1856('0x24')]=function(_0x583990){return new Promise(function(_0x257ad7,_0x4db1c6){return db[_0x1856('0x1e')][_0x1856('0x25')]({'where':_0x583990[_0x1856('0x1f')]?_0x583990['options'][_0x1856('0x20')]||null:null})['then'](function(_0x47d9bd){if(_0x47d9bd){return _0x47d9bd[_0x1856('0x26')](_0x583990[_0x1856('0x27')]['ids'],_[_0x1856('0x28')](_0x583990[_0x1856('0x27')],[_0x1856('0x29'),'id'])||{});}})[_0x1856('0x2a')](function(_0x131ea1){logger[_0x1856('0x14')](_0x1856('0x2b'),_0x583990);logger['debug']('AddTags',_0x583990,JSON[_0x1856('0x23')](_0x131ea1));_0x257ad7(_0x131ea1);})[_0x1856('0x1d')](function(_0xbf7bcd){logger['error'](_0x1856('0x2b'),_0xbf7bcd[_0x1856('0x1b')],_0x583990);_0x4db1c6(_this[_0x1856('0x19')](0x1f4,_0xbf7bcd[_0x1856('0x1b')]));});});}; \ No newline at end of file +var _0xf926=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateFaxInteraction','FaxInteraction','body','raw','options','attributes','limit','AddTagsToFaxInteraction','find','where','ids','omit','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xbe48a,_0x4d3ec5){var _0x3eeda0=function(_0x2d758d){while(--_0x2d758d){_0xbe48a['push'](_0xbe48a['shift']());}};_0x3eeda0(++_0x4d3ec5);}(_0xf926,0xd6));var _0x6f92=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf926[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x6f92('0x0'));var util=require(_0x6f92('0x1'));var moment=require(_0x6f92('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f92('0x3'));var fs=require('fs');var Redis=require(_0x6f92('0x4'));var db=require(_0x6f92('0x5'))['db'];var utils=require(_0x6f92('0x6'));var logger=require(_0x6f92('0x7'))(_0x6f92('0x8'));var config=require(_0x6f92('0x9'));var jayson=require(_0x6f92('0xa'));var client=jayson[_0x6f92('0xb')][_0x6f92('0xc')]({'port':0x232a});config['redis']=_[_0x6f92('0xd')](config[_0x6f92('0xe')],{'host':_0x6f92('0xf'),'port':0x18eb});var socket=require(_0x6f92('0x10'))(new Redis(config[_0x6f92('0xe')]));require(_0x6f92('0x11'))[_0x6f92('0x12')](socket);function respondWithRpcPromise(_0x4d18e8,_0x2d67bb,_0x321188){return new BPromise(function(_0x1039c0,_0x3876db){return client['request'](_0x4d18e8,_0x321188)[_0x6f92('0x13')](function(_0x21d0bc){logger[_0x6f92('0x14')](_0x6f92('0x15'),_0x2d67bb,'request\x20sent');logger[_0x6f92('0x16')](_0x6f92('0x17'),_0x2d67bb,_0x6f92('0x18'),JSON[_0x6f92('0x19')](_0x21d0bc));if(_0x21d0bc[_0x6f92('0x1a')]){if(_0x21d0bc[_0x6f92('0x1a')][_0x6f92('0x1b')]===0x1f4){logger[_0x6f92('0x1a')](_0x6f92('0x15'),_0x2d67bb,_0x21d0bc[_0x6f92('0x1a')][_0x6f92('0x1c')]);return _0x3876db(_0x21d0bc['error'][_0x6f92('0x1c')]);}logger[_0x6f92('0x1a')](_0x6f92('0x15'),_0x2d67bb,_0x21d0bc[_0x6f92('0x1a')][_0x6f92('0x1c')]);return _0x1039c0(_0x21d0bc[_0x6f92('0x1a')]['message']);}else{logger[_0x6f92('0x14')](_0x6f92('0x15'),_0x2d67bb,'request\x20sent');_0x1039c0(_0x21d0bc['result']['message']);}})['catch'](function(_0x5977de){logger[_0x6f92('0x1a')](_0x6f92('0x15'),_0x2d67bb,_0x5977de);_0x3876db(_0x5977de);});});}exports[_0x6f92('0x1d')]=function(_0x1f481e){var _0x38a74f=this;return new Promise(function(_0x363b2c,_0xe1d9d4){return db[_0x6f92('0x1e')]['update'](_0x1f481e[_0x6f92('0x1f')],{'raw':_0x1f481e['options']?_0x1f481e['options'][_0x6f92('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f481e[_0x6f92('0x21')]?_0x1f481e[_0x6f92('0x21')]['where']||null:null,'attributes':_0x1f481e['options']?_0x1f481e['options'][_0x6f92('0x22')]||null:null,'limit':_0x1f481e[_0x6f92('0x21')]?_0x1f481e[_0x6f92('0x21')][_0x6f92('0x23')]||null:null})[_0x6f92('0x13')](function(_0x305695){logger['info'](_0x6f92('0x1d'),_0x1f481e);logger[_0x6f92('0x16')]('UpdateFaxInteraction',_0x1f481e,JSON['stringify'](_0x305695));_0x363b2c(_0x305695);})['catch'](function(_0x34e9ca){logger[_0x6f92('0x1a')](_0x6f92('0x1d'),_0x34e9ca[_0x6f92('0x1c')],_0x1f481e);_0xe1d9d4(_0x38a74f[_0x6f92('0x1a')](0x1f4,_0x34e9ca['message']));});});};exports[_0x6f92('0x24')]=function(_0x19e32f){return new Promise(function(_0x802ef0,_0x55ee88){return db['FaxInteraction'][_0x6f92('0x25')]({'where':_0x19e32f[_0x6f92('0x21')]?_0x19e32f[_0x6f92('0x21')][_0x6f92('0x26')]||null:null})[_0x6f92('0x13')](function(_0x2dab08){if(_0x2dab08){return _0x2dab08['addTags'](_0x19e32f['body'][_0x6f92('0x27')],_[_0x6f92('0x28')](_0x19e32f[_0x6f92('0x1f')],[_0x6f92('0x27'),'id'])||{});}})[_0x6f92('0x29')](function(_0x3367fe){logger[_0x6f92('0x14')](_0x6f92('0x2a'),_0x19e32f);logger[_0x6f92('0x16')]('AddTags',_0x19e32f,JSON[_0x6f92('0x19')](_0x3367fe));_0x802ef0(_0x3367fe);})[_0x6f92('0x2b')](function(_0x3ab6cf){logger[_0x6f92('0x1a')]('AddTags',_0x3ab6cf[_0x6f92('0x1c')],_0x19e32f);_0x55ee88(_this[_0x6f92('0x1a')](0x1f4,_0x3ab6cf[_0x6f92('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 192f2bd..8f27b05 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 _0x2927=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x2927,0x154));var _0x7292=function(_0x8864b1,_0x1d42a3){_0x8864b1=_0x8864b1-0x0;var _0x21ff3c=_0x2927[_0x8864b1];return _0x21ff3c;};'use strict';var FaxInteractionEvents=require(_0x7292('0x0'));var events=[_0x7292('0x1'),_0x7292('0x2'),'update'];function createListener(_0x8e290d,_0x41e945){return function(_0x51df93){_0x41e945[_0x7292('0x3')](_0x8e290d,_0x51df93);};}function removeListener(_0x15aaa2,_0xc8589){return function(){FaxInteractionEvents[_0x7292('0x4')](_0x15aaa2,_0xc8589);};}exports[_0x7292('0x5')]=function(_0x53f97){for(var _0x24980a=0x0,_0x1e6821=events[_0x7292('0x6')];_0x24980a<_0x1e6821;_0x24980a++){var _0x530fb3=events[_0x24980a];var _0x3eb5f1=createListener(_0x7292('0x7')+_0x530fb3,_0x53f97);FaxInteractionEvents['on'](_0x530fb3,_0x3eb5f1);}}; \ No newline at end of file +var _0x82ac=['length','faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82ac,0xda));var _0xc82a=function(_0xcc39e2,_0x193710){_0xcc39e2=_0xcc39e2-0x0;var _0x192ec2=_0x82ac[_0xcc39e2];return _0x192ec2;};'use strict';var FaxInteractionEvents=require(_0xc82a('0x0'));var events=['save',_0xc82a('0x1'),_0xc82a('0x2')];function createListener(_0x547569,_0x4d96ac){return function(_0x4a36c2){_0x4d96ac[_0xc82a('0x3')](_0x547569,_0x4a36c2);};}function removeListener(_0x1155ef,_0xf798a4){return function(){FaxInteractionEvents[_0xc82a('0x4')](_0x1155ef,_0xf798a4);};}exports[_0xc82a('0x5')]=function(_0x4450ed){for(var _0x5ca7a8=0x0,_0x11b3a0=events[_0xc82a('0x6')];_0x5ca7a8<_0x11b3a0;_0x5ca7a8++){var _0x3db9d0=events[_0x5ca7a8];var _0x39f112=createListener(_0xc82a('0x7')+_0x3db9d0,_0x4450ed);FaxInteractionEvents['on'](_0x3db9d0,_0x39f112);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 220da67..aba3e34 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 _0xc91b=['fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','isAuthenticated','describe','/:id','show','getMessages','download','post','addMessage','/:id/tags','faxinteraction:addtags','addTags','tracked'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc91b,0x16f));var _0xbc91=function(_0x3ec0ba,_0x1cbc98){_0x3ec0ba=_0x3ec0ba-0x0;var _0x4ef5ef=_0xc91b[_0x3ec0ba];return _0x4ef5ef;};'use strict';var multer=require(_0xbc91('0x0'));var util=require(_0xbc91('0x1'));var path=require(_0xbc91('0x2'));var timeout=require(_0xbc91('0x3'));var express=require(_0xbc91('0x4'));var router=express[_0xbc91('0x5')]();var auth=require(_0xbc91('0x6'));var interaction=require(_0xbc91('0x7'));var config=require('../../config/environment');var controller=require(_0xbc91('0x8'));router[_0xbc91('0x9')]('/',auth['isAuthenticated'](),controller[_0xbc91('0xa')]);router[_0xbc91('0x9')]('/describe',auth[_0xbc91('0xb')](),controller[_0xbc91('0xc')]);router[_0xbc91('0x9')](_0xbc91('0xd'),auth[_0xbc91('0xb')](),controller[_0xbc91('0xe')]);router[_0xbc91('0x9')]('/:id/messages',auth[_0xbc91('0xb')](),controller[_0xbc91('0xf')]);router[_0xbc91('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xbc91('0x10')]);router[_0xbc91('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbc91('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbc91('0x12')]);router[_0xbc91('0x11')](_0xbc91('0x13'),auth[_0xbc91('0xb')](),interaction['tracked']('fax',_0xbc91('0x14')),controller[_0xbc91('0x15')]);router['put'](_0xbc91('0xd'),auth[_0xbc91('0xb')](),interaction[_0xbc91('0x16')](_0xbc91('0x17'),_0xbc91('0x18')),controller[_0xbc91('0x19')]);router[_0xbc91('0x1a')](_0xbc91('0xd'),auth[_0xbc91('0xb')](),interaction['tracked'](_0xbc91('0x17'),_0xbc91('0x1b')),controller[_0xbc91('0x1c')]);router[_0xbc91('0x1a')](_0xbc91('0x13'),auth[_0xbc91('0xb')](),controller[_0xbc91('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xaf9d=['Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','multer','path','connect-timeout','express'];(function(_0x336df4,_0x52c1dc){var _0x580d8c=function(_0x2febf1){while(--_0x2febf1){_0x336df4['push'](_0x336df4['shift']());}};_0x580d8c(++_0x52c1dc);}(_0xaf9d,0x146));var _0xdaf9=function(_0x1551ab,_0x14b2a4){_0x1551ab=_0x1551ab-0x0;var _0xc70c7c=_0xaf9d[_0x1551ab];return _0xc70c7c;};'use strict';var multer=require(_0xdaf9('0x0'));var util=require('util');var path=require(_0xdaf9('0x1'));var timeout=require(_0xdaf9('0x2'));var express=require(_0xdaf9('0x3'));var router=express[_0xdaf9('0x4')]();var auth=require(_0xdaf9('0x5'));var interaction=require(_0xdaf9('0x6'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xdaf9('0x7')](),controller[_0xdaf9('0x8')]);router['get'](_0xdaf9('0x9'),auth[_0xdaf9('0x7')](),controller[_0xdaf9('0xa')]);router[_0xdaf9('0xb')](_0xdaf9('0xc'),auth['isAuthenticated'](),controller[_0xdaf9('0xd')]);router[_0xdaf9('0xb')](_0xdaf9('0xe'),auth[_0xdaf9('0x7')](),controller[_0xdaf9('0xf')]);router['get'](_0xdaf9('0x10'),auth[_0xdaf9('0x7')](),controller[_0xdaf9('0x11')]);router[_0xdaf9('0x12')]('/',auth[_0xdaf9('0x7')](),controller[_0xdaf9('0x13')]);router[_0xdaf9('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0xdaf9('0x14')]);router[_0xdaf9('0x12')](_0xdaf9('0x15'),auth[_0xdaf9('0x7')](),interaction[_0xdaf9('0x16')](_0xdaf9('0x17'),_0xdaf9('0x18')),controller[_0xdaf9('0x19')]);router['put'](_0xdaf9('0xc'),auth[_0xdaf9('0x7')](),interaction['tracked'](_0xdaf9('0x17'),_0xdaf9('0x1a')),controller[_0xdaf9('0x1b')]);router[_0xdaf9('0x1c')]('/:id',auth['isAuthenticated'](),interaction[_0xdaf9('0x16')]('fax',_0xdaf9('0x1d')),controller['destroy']);router[_0xdaf9('0x1c')]('/:id/tags',auth[_0xdaf9('0x7')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5167d8d..b295c92 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 _0xe6f2=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x404064,_0x5382a8){var _0x5e2835=function(_0x485243){while(--_0x485243){_0x404064['push'](_0x404064['shift']());}};_0x5e2835(++_0x5382a8);}(_0xe6f2,0x1c7));var _0x2e6f=function(_0x6a5715,_0x5f3de4){_0x6a5715=_0x6a5715-0x0;var _0x24206b=_0xe6f2[_0x6a5715];return _0x24206b;};'use strict';var Sequelize=require(_0x2e6f('0x0'));module[_0x2e6f('0x1')]={'body':{'type':Sequelize[_0x2e6f('0x2')](_0x2e6f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2e6f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2e6f('0x5')]('in',_0x2e6f('0x6')),'defaultValue':_0x2e6f('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2e6f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2e6f('0x7')]}}; \ No newline at end of file +var _0x5b67=['medium','BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x3bae40,_0x41c983){var _0x3f7543=function(_0x236def){while(--_0x236def){_0x3bae40['push'](_0x3bae40['shift']());}};_0x3f7543(++_0x41c983);}(_0x5b67,0xe5));var _0x75b6=function(_0x35aa84,_0x483162){_0x35aa84=_0x35aa84-0x0;var _0x21d0d1=_0x5b67[_0x35aa84];return _0x21d0d1;};'use strict';var Sequelize=require(_0x75b6('0x0'));module['exports']={'body':{'type':Sequelize[_0x75b6('0x1')](_0x75b6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x75b6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x75b6('0x4')]('in',_0x75b6('0x5')),'defaultValue':_0x75b6('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x75b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7aa68d6..94e99d7 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 _0x4407=['EventManager','acceptmessage','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','findOne','ContactId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','Attachment','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','status','json','offset','limit','set','apply','reject','save','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','FaxMessage','count','includeAll','findAll','rows','filters','include','find','catch','body','params','describe','../../config/logger','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','isNil','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event'];(function(_0x22baa8,_0x3d82e9){var _0x76deaa=function(_0x1989fe){while(--_0x1989fe){_0x22baa8['push'](_0x22baa8['shift']());}};_0x76deaa(++_0x3d82e9);}(_0x4407,0x10e));var _0x7440=function(_0x345fde,_0x206cd7){_0x345fde=_0x345fde-0x0;var _0x64f93a=_0x4407[_0x345fde];return _0x64f93a;};'use strict';var pdf=require(_0x7440('0x0'));var emlformat=require(_0x7440('0x1'));var rimraf=require(_0x7440('0x2'));var zipdir=require(_0x7440('0x3'));var jsonpatch=require(_0x7440('0x4'));var rp=require(_0x7440('0x5'));var moment=require(_0x7440('0x6'));var BPromise=require(_0x7440('0x7'));var Mustache=require('mustache');var util=require(_0x7440('0x8'));var path=require(_0x7440('0x9'));var sox=require('sox');var csv=require(_0x7440('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7440('0xb'));var squel=require('squel');var crypto=require(_0x7440('0xc'));var jsforce=require(_0x7440('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7440('0xe'));var Papa=require(_0x7440('0xf'));var Redis=require('ioredis');var authService=require(_0x7440('0x10'));var qs=require(_0x7440('0x11'));var as=require(_0x7440('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7440('0x13'));var utils=require(_0x7440('0x14'));var config=require(_0x7440('0x15'));var db=require(_0x7440('0x16'))['db'];config[_0x7440('0x17')]=_[_0x7440('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7440('0x19'))(new Redis(config[_0x7440('0x17')]));require('./faxMessage.socket')[_0x7440('0x1a')](socket);var jayson=require(_0x7440('0x1b'));var client=jayson[_0x7440('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x7440('0x1c')][_0x7440('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3c58cc,_0x4dfc55,_0x269545){if(_0x269545){var _0x3b3955=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b3955['test'](_0x4dfc55)){return _0x3c58cc;}else{throw new db[(_0x7440('0x1e'))][(_0x7440('0x1f'))](_0x7440('0x20'));}}else{return _0x3c58cc;}}function respondWithRpcPromise(_0x4ae43d,_0x26d775,_0x2bfd2c,_0x1dc553){return new BPromise(function(_0xa75380,_0xefbf14){var _0xc699e6=_0x1dc553||client;return _0xc699e6[_0x7440('0x21')](_0x4ae43d,_0x2bfd2c)[_0x7440('0x22')](function(_0x294981){logger[_0x7440('0x23')](_0x7440('0x24'),_0x26d775,_0x7440('0x25'));logger[_0x7440('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x26d775,_0x7440('0x25'),JSON[_0x7440('0x27')](_0x294981));if(_0x294981['error']){if(_0x294981[_0x7440('0x28')]['code']===0x1f4){logger['error'](_0x7440('0x24'),_0x26d775,_0x294981[_0x7440('0x28')][_0x7440('0x29')]);return _0xefbf14(_0x294981[_0x7440('0x28')][_0x7440('0x29')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x26d775,_0x294981[_0x7440('0x28')][_0x7440('0x29')]);return _0xa75380(_0x294981[_0x7440('0x28')]['message']);}else{logger[_0x7440('0x23')](_0x7440('0x24'),_0x26d775,_0x7440('0x25'));_0xa75380(_0x294981['result'][_0x7440('0x29')]);}})['catch'](function(_0x1a75fe){logger['error'](_0x7440('0x24'),_0x26d775,_0x1a75fe);_0xefbf14(_0x1a75fe);});});}function respondWithStatusCode(_0x18246f,_0x503aeb){_0x503aeb=_0x503aeb||0xcc;return function(_0x1f749c){if(_0x1f749c){return _0x18246f['sendStatus'](_0x503aeb);}return _0x18246f['status'](_0x503aeb)['end']();};}function respondWithResult(_0x38a0f3,_0x1c2ca3){_0x1c2ca3=_0x1c2ca3||0xc8;return function(_0x3adbff){if(_0x3adbff){return _0x38a0f3[_0x7440('0x2a')](_0x1c2ca3)[_0x7440('0x2b')](_0x3adbff);}};}function respondWithFilteredResult(_0x2c89b4,_0x2f9a80){return function(_0x1410e0){if(_0x1410e0){var _0x1c0a74=_0x1410e0['count'],_0x3785e1=_0x2f9a80[_0x7440('0x2c')],_0x4013bc=_0x2f9a80[_0x7440('0x2c')]+_0x2f9a80[_0x7440('0x2d')],_0x56695c;if(_0x4013bc>=_0x1c0a74){_0x4013bc=_0x1c0a74;_0x56695c=0xc8;}else{_0x56695c=0xce;}_0x2c89b4[_0x7440('0x2a')](_0x56695c);return _0x2c89b4[_0x7440('0x2e')]('Content-Range',_0x3785e1+'-'+_0x4013bc+'/'+_0x1c0a74)['json'](_0x1410e0);}return null;};}function patchUpdates(_0x57059f){return function(_0x3f8ac0){try{jsonpatch[_0x7440('0x2f')](_0x3f8ac0,_0x57059f,!![]);}catch(_0x518492){return BPromise[_0x7440('0x30')](_0x518492);}return _0x3f8ac0[_0x7440('0x31')]();};}function saveUpdates(_0x46196c,_0x4e8a8e){return function(_0x393aed){if(_0x393aed){return _0x393aed[_0x7440('0x32')](_0x46196c)[_0x7440('0x22')](function(_0x2cb93f){return _0x2cb93f;});}return null;};}function removeEntity(_0x4573d7,_0x86fa20){return function(_0x5126c2){if(_0x5126c2){return _0x5126c2[_0x7440('0x33')]()['then'](function(){_0x4573d7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f75a9,_0x46a14e){return function(_0x2b6521){if(!_0x2b6521){_0x4f75a9[_0x7440('0x34')](0x194);}return _0x2b6521;};}function handleError(_0x1d6290,_0x2b74a3){_0x2b74a3=_0x2b74a3||0x1f4;return function(_0x5c9269){logger[_0x7440('0x28')](_0x5c9269['stack']);if(_0x5c9269[_0x7440('0x35')]){delete _0x5c9269[_0x7440('0x35')];}_0x1d6290['status'](_0x2b74a3)[_0x7440('0x36')](_0x5c9269);};}exports[_0x7440('0x37')]=function(_0x48b35c,_0x20717e){var _0x14beac={},_0x1932c9={},_0x1ba244={'count':0x0,'rows':[]};var _0x48b679=_[_0x7440('0x38')](db['FaxMessage'][_0x7440('0x39')],function(_0x5ecd3e){return{'name':_0x5ecd3e[_0x7440('0x3a')],'type':_0x5ecd3e[_0x7440('0x3b')][_0x7440('0x3c')]};});_0x1932c9[_0x7440('0x3d')]=_['map'](_0x48b679,_0x7440('0x35'));_0x1932c9[_0x7440('0x3e')]=_[_0x7440('0x3f')](_0x48b35c[_0x7440('0x3e')]);_0x1932c9['filters']=_[_0x7440('0x40')](_0x1932c9[_0x7440('0x3d')],_0x1932c9['query']);_0x14beac[_0x7440('0x41')]=_[_0x7440('0x40')](_0x1932c9[_0x7440('0x3d')],qs['fields'](_0x48b35c[_0x7440('0x3e')][_0x7440('0x42')]));_0x14beac[_0x7440('0x41')]=_0x14beac[_0x7440('0x41')][_0x7440('0x43')]?_0x14beac[_0x7440('0x41')]:_0x1932c9['model'];if(!_0x48b35c[_0x7440('0x3e')]['hasOwnProperty'](_0x7440('0x44'))){_0x14beac['limit']=qs['limit'](_0x48b35c[_0x7440('0x3e')][_0x7440('0x2d')]);_0x14beac[_0x7440('0x2c')]=qs['offset'](_0x48b35c[_0x7440('0x3e')][_0x7440('0x2c')]);}_0x14beac['order']=qs['sort'](_0x48b35c['query'][_0x7440('0x45')]);_0x14beac['where']=qs['filters'](_[_0x7440('0x46')](_0x48b35c['query'],_0x1932c9['filters']),_0x48b679);if(_0x48b35c[_0x7440('0x3e')][_0x7440('0x47')]){_0x14beac[_0x7440('0x48')]=_[_0x7440('0x49')](_0x14beac[_0x7440('0x48')],{'$or':_['map'](_0x48b679,function(_0x2416f3){if(_0x2416f3[_0x7440('0x3b')]!==_0x7440('0x4a')){var _0x4f8cf2={};_0x4f8cf2[_0x2416f3[_0x7440('0x35')]]={'$like':'%'+_0x48b35c['query']['filter']+'%'};return _0x4f8cf2;}})});}_0x14beac=_[_0x7440('0x49')]({},_0x14beac,_0x48b35c[_0x7440('0x4b')]);var _0x50e5cb={'where':_0x14beac[_0x7440('0x48')]};return db[_0x7440('0x4c')][_0x7440('0x4d')](_0x50e5cb)[_0x7440('0x22')](function(_0x3e37f4){_0x1ba244[_0x7440('0x4d')]=_0x3e37f4;if(_0x48b35c[_0x7440('0x3e')][_0x7440('0x4e')]){_0x14beac['include']=[{'all':!![]}];}return db[_0x7440('0x4c')][_0x7440('0x4f')](_0x14beac);})['then'](function(_0x1900a2){_0x1ba244[_0x7440('0x50')]=_0x1900a2;return _0x1ba244;})[_0x7440('0x22')](respondWithFilteredResult(_0x20717e,_0x14beac))['catch'](handleError(_0x20717e,null));};exports['show']=function(_0x534977,_0x3f019f){var _0x3f8e48={'raw':!![],'where':{'id':_0x534977['params']['id']}},_0x32c327={};_0x32c327[_0x7440('0x3d')]=_['keys'](db[_0x7440('0x4c')][_0x7440('0x39')]);_0x32c327[_0x7440('0x3e')]=_[_0x7440('0x3f')](_0x534977[_0x7440('0x3e')]);_0x32c327[_0x7440('0x51')]=_['intersection'](_0x32c327['model'],_0x32c327[_0x7440('0x3e')]);_0x3f8e48[_0x7440('0x41')]=_[_0x7440('0x40')](_0x32c327['model'],qs['fields'](_0x534977[_0x7440('0x3e')][_0x7440('0x42')]));_0x3f8e48['attributes']=_0x3f8e48[_0x7440('0x41')]['length']?_0x3f8e48[_0x7440('0x41')]:_0x32c327[_0x7440('0x3d')];if(_0x534977[_0x7440('0x3e')][_0x7440('0x4e')]){_0x3f8e48[_0x7440('0x52')]=[{'all':!![]}];}_0x3f8e48=_[_0x7440('0x49')]({},_0x3f8e48,_0x534977['options']);return db[_0x7440('0x4c')][_0x7440('0x53')](_0x3f8e48)['then'](handleEntityNotFound(_0x3f019f,null))[_0x7440('0x22')](respondWithResult(_0x3f019f,null))[_0x7440('0x54')](handleError(_0x3f019f,null));};exports[_0x7440('0x32')]=function(_0x4e1567,_0x58383d){if(_0x4e1567[_0x7440('0x55')]['id']){delete _0x4e1567[_0x7440('0x55')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x4e1567[_0x7440('0x56')]['id']}})[_0x7440('0x22')](handleEntityNotFound(_0x58383d,null))['then'](saveUpdates(_0x4e1567[_0x7440('0x55')],null))['then'](respondWithResult(_0x58383d,null))['catch'](handleError(_0x58383d,null));};exports['destroy']=function(_0x1566bc,_0x52d6b4){return db['FaxMessage'][_0x7440('0x53')]({'where':{'id':_0x1566bc[_0x7440('0x56')]['id']}})['then'](handleEntityNotFound(_0x52d6b4,null))['then'](removeEntity(_0x52d6b4,null))[_0x7440('0x54')](handleError(_0x52d6b4,null));};exports[_0x7440('0x57')]=function(_0x391e77,_0x1df4a7){return db[_0x7440('0x4c')][_0x7440('0x57')]()[_0x7440('0x22')](respondWithResult(_0x1df4a7,null))[_0x7440('0x54')](handleError(_0x1df4a7,null));};var interaction_log=require(_0x7440('0x58'))('fax-interactions');exports[_0x7440('0x59')]=function(_0x55903a,_0x16f96c,_0x12cc76){var _0x20b229={'channel':_0x7440('0x5a')};if(_0x55903a[_0x7440('0x55')]['id']){delete _0x55903a[_0x7440('0x55')]['id'];}_0x55903a[_0x7440('0x55')][_0x7440('0x5b')]=!![];_0x55903a['body']['readAt']=moment()[_0x7440('0x5c')](_0x7440('0x5d'));_0x55903a[_0x7440('0x55')][_0x7440('0x5e')]=_0x55903a[_0x7440('0x55')]['UserId']||_0x55903a[_0x7440('0x5f')]['id'];return db[_0x7440('0x4c')][_0x7440('0x53')]({'where':{'id':_0x55903a[_0x7440('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x7440('0x60')],'as':_0x7440('0x61')}]})[_0x7440('0x22')](handleEntityNotFound(_0x16f96c,null))[_0x7440('0x22')](saveUpdates(_0x55903a[_0x7440('0x55')],null))[_0x7440('0x22')](function(_0x44661d){if(_0x44661d){_0x20b229['message']=_0x44661d[_0x7440('0x62')]({'plain':!![]});return db[_0x7440('0x63')][_0x7440('0x53')]({'where':{'id':_0x44661d['FaxInteractionId']}});}return null;})[_0x7440('0x22')](handleEntityNotFound(_0x16f96c,null))['then'](function(_0x21bf1b){if(_0x21bf1b){return _0x21bf1b['update']({'UserId':_0x55903a['body'][_0x7440('0x5e')],'read1stAt':_[_0x7440('0x64')](_0x21bf1b['read1stAt'])?moment()[_0x7440('0x5c')](_0x7440('0x5d')):undefined});}return null;})[_0x7440('0x22')](function(_0x2c0e06){if(_0x2c0e06){_0x20b229['interaction']=_0x2c0e06['get']({'plain':!![]});interaction_log[_0x7440('0x23')](_0x7440('0x65'),_0x55903a['user']['id'],_0x55903a[_0x7440('0x5f')][_0x7440('0x35')],_0x55903a[_0x7440('0x5f')]['role'],_0x20b229[_0x7440('0x66')]['id'],_0x55903a[_0x7440('0x55')]?JSON['stringify'](_0x55903a['body']):_0x7440('0x67'));return respondWithRpcPromise(_0x7440('0x68'),_0x7440('0x69'),_0x20b229);}return null;})[_0x7440('0x22')](function(_0x2efe62){if(_0x2efe62){if(_0x55903a[_0x7440('0x55')][_0x7440('0x6a')]){_0x20b229[_0x7440('0x29')][_0x7440('0x6b')]=util[_0x7440('0x5c')](_0x7440('0x6c'),_0x55903a[_0x7440('0x5f')][_0x7440('0x35')]);_0x20b229[_0x7440('0x29')]['channel']=_0x20b229[_0x7440('0x6d')];_0x20b229['message'][_0x7440('0x6e')]='accept';return respondWithRpcPromise(_0x7440('0x6f'),'EventManager',{'event':_0x7440('0x70'),'message':_0x20b229['message']},client9002)['then'](function(){return _0x20b229;});}return _0x20b229;}return null;})[_0x7440('0x22')](respondWithResult(_0x16f96c,null))[_0x7440('0x54')](handleError(_0x16f96c,null));};var interaction_log=require(_0x7440('0x58'))('fax-interactions');exports[_0x7440('0x30')]=function(_0x1be337,_0x2a5e19,_0x4b27c7){var _0xe05f78={'agent':{},'channel':_0x7440('0x5a')};if(_0x1be337[_0x7440('0x55')]['id']){delete _0x1be337[_0x7440('0x55')]['id'];}_0x1be337[_0x7440('0x55')][_0x7440('0x5e')]=_0x1be337[_0x7440('0x55')][_0x7440('0x5e')]||_0x1be337['user']['id'];_0xe05f78[_0x7440('0x71')]['id']=_0x1be337[_0x7440('0x55')][_0x7440('0x5e')];return db['FaxMessage']['find']({'where':{'id':_0x1be337[_0x7440('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2a5e19,null))[_0x7440('0x22')](function(_0x4fac58){if(_0x4fac58){_0xe05f78[_0x7440('0x29')]=_0x4fac58[_0x7440('0x62')]({'plain':!![]});return db[_0x7440('0x63')][_0x7440('0x53')]({'where':{'id':_0x4fac58[_0x7440('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x2a5e19,null))[_0x7440('0x22')](function(_0x38af02){if(_0x38af02){_0xe05f78['interaction']=_0x38af02[_0x7440('0x62')]({'plain':!![]});interaction_log['info'](_0x7440('0x73'),_0x1be337['user']['id'],_0x1be337[_0x7440('0x5f')][_0x7440('0x35')],_0x1be337[_0x7440('0x5f')][_0x7440('0x74')],_0xe05f78[_0x7440('0x66')]['id'],_0x1be337[_0x7440('0x55')]?JSON[_0x7440('0x27')](_0x1be337[_0x7440('0x55')]):_0x7440('0x67'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0xe05f78);}return null;})[_0x7440('0x22')](function(_0x1634aa){if(_0x1634aa){_0x1634aa[_0x7440('0x29')]['interface']=util[_0x7440('0x5c')](_0x7440('0x6c'),_0x1be337[_0x7440('0x5f')]['name']);_0x1634aa['message'][_0x7440('0x6d')]=_0xe05f78[_0x7440('0x6d')];_0x1634aa[_0x7440('0x29')][_0x7440('0x6e')]=_0x7440('0x30');respondWithRpcPromise(_0x7440('0x6f'),'EventManager',{'event':'rejectmessage','message':_0x1634aa['message']},client9002);return _0xe05f78;}return null;})['then'](respondWithResult(_0x2a5e19,null))[_0x7440('0x54')](handleError(_0x2a5e19,null));};exports['create']=function(_0x372004,_0x38700b){var _0x2cf9f1;return db['FaxMessage']['create'](_0x372004[_0x7440('0x55')],{})[_0x7440('0x22')](function(_0x1066f2){_0x2cf9f1=_0x1066f2;return db[_0x7440('0x60')][_0x7440('0x75')]({'where':{'id':_0x2cf9f1[_0x7440('0x76')]}});})[_0x7440('0x22')](function(_0x4a1a13){if(_['isNil'](_0x4a1a13)){return;}else{_0x2cf9f1['fax']=_0x4a1a13[_0x7440('0x5a')];return db['Attachment'][_0x7440('0x75')]({'where':{'id':_0x2cf9f1['AttachmentId']}});}})['then'](function(_0x1bd170){return respondWithRpcPromise(_0x7440('0x77'),_0x7440('0x77'),{'FaxAccountId':_[_0x7440('0x64')](_0x372004[_0x7440('0x55')])?undefined:_0x372004['body']['FaxAccountId'],'path':_[_0x7440('0x64')](_0x1bd170)?undefined:util[_0x7440('0x5c')](_0x7440('0x78'),_0x1bd170[_0x7440('0x79')]),'fax':_['isNil'](_0x2cf9f1[_0x7440('0x5a')])?undefined:_0x2cf9f1[_0x7440('0x5a')],'AttachmentId':_0x2cf9f1['AttachmentId']},client9002);})[_0x7440('0x22')](respondWithResult(_0x38700b,0xc9))[_0x7440('0x54')](handleError(_0x38700b,null));};exports['download']=function(_0x537f56,_0x33e2df){var _0x22f18f=path[_0x7440('0x7a')](config[_0x7440('0x7b')],'server',_0x7440('0x7c'),'attachments');return db[_0x7440('0x4c')][_0x7440('0x53')]({'where':{'id':_0x537f56[_0x7440('0x56')]['id']},'include':[{'model':db[_0x7440('0x7d')],'as':_0x7440('0x7d')}]})[_0x7440('0x22')](handleEntityNotFound(_0x33e2df,null))[_0x7440('0x22')](function(_0x1d2756){if(_0x1d2756){return _0x33e2df[_0x7440('0x7e')](path[_0x7440('0x7a')](_0x22f18f,_0x1d2756[_0x7440('0x7d')][_0x7440('0x79')]));}})[_0x7440('0x54')](handleError(_0x33e2df,null));}; \ No newline at end of file +var _0x8191=['update','destroy','name','send','map','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','FaxMessage','count','includeAll','findAll','rows','show','params','keys','include','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','role','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0xfe8bef,_0x453526){var _0x20659f=function(_0x1f3483){while(--_0x1f3483){_0xfe8bef['push'](_0xfe8bef['shift']());}};_0x20659f(++_0x453526);}(_0x8191,0x1da));var _0x1819=function(_0x59591b,_0x354045){_0x59591b=_0x59591b-0x0;var _0x576642=_0x8191[_0x59591b];return _0x576642;};'use strict';var pdf=require(_0x1819('0x0'));var emlformat=require(_0x1819('0x1'));var rimraf=require(_0x1819('0x2'));var zipdir=require(_0x1819('0x3'));var jsonpatch=require(_0x1819('0x4'));var rp=require(_0x1819('0x5'));var moment=require('moment');var BPromise=require(_0x1819('0x6'));var Mustache=require('mustache');var util=require(_0x1819('0x7'));var path=require(_0x1819('0x8'));var sox=require('sox');var csv=require(_0x1819('0x9'));var ejs=require(_0x1819('0xa'));var fs=require('fs');var _=require(_0x1819('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1819('0xc'));var deskjs=require(_0x1819('0xd'));var toCsv=require(_0x1819('0x9'));var querystring=require('querystring');var Papa=require(_0x1819('0xe'));var Redis=require(_0x1819('0xf'));var authService=require(_0x1819('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1819('0x11'));var hardwareService=require(_0x1819('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1819('0x13'));var config=require(_0x1819('0x14'));var db=require('../../mysqldb')['db'];config[_0x1819('0x15')]=_['defaults'](config[_0x1819('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x1819('0x16'))(new Redis(config[_0x1819('0x15')]));require('./faxMessage.socket')[_0x1819('0x17')](socket);var jayson=require(_0x1819('0x18'));var client=jayson[_0x1819('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x1819('0x19')][_0x1819('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3d792f,_0x303e3f,_0x4323a9){if(_0x4323a9){var _0x2c3320=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c3320[_0x1819('0x1b')](_0x303e3f)){return _0x3d792f;}else{throw new db[(_0x1819('0x1c'))][(_0x1819('0x1d'))](_0x1819('0x1e'));}}else{return _0x3d792f;}}function respondWithRpcPromise(_0xa85087,_0x545ded,_0x2d6d0c,_0x439ca6){return new BPromise(function(_0x1684d8,_0xc981ba){var _0x3d4911=_0x439ca6||client;return _0x3d4911[_0x1819('0x1f')](_0xa85087,_0x2d6d0c)[_0x1819('0x20')](function(_0x2773f0){logger[_0x1819('0x21')]('FaxMessage,\x20%s,\x20%s',_0x545ded,_0x1819('0x22'));logger['debug'](_0x1819('0x23'),_0x545ded,_0x1819('0x22'),JSON[_0x1819('0x24')](_0x2773f0));if(_0x2773f0['error']){if(_0x2773f0[_0x1819('0x25')][_0x1819('0x26')]===0x1f4){logger[_0x1819('0x25')](_0x1819('0x27'),_0x545ded,_0x2773f0[_0x1819('0x25')][_0x1819('0x28')]);return _0xc981ba(_0x2773f0['error']['message']);}logger[_0x1819('0x25')](_0x1819('0x27'),_0x545ded,_0x2773f0[_0x1819('0x25')]['message']);return _0x1684d8(_0x2773f0[_0x1819('0x25')][_0x1819('0x28')]);}else{logger[_0x1819('0x21')](_0x1819('0x27'),_0x545ded,_0x1819('0x22'));_0x1684d8(_0x2773f0[_0x1819('0x29')][_0x1819('0x28')]);}})[_0x1819('0x2a')](function(_0xd00bdd){logger[_0x1819('0x25')](_0x1819('0x27'),_0x545ded,_0xd00bdd);_0xc981ba(_0xd00bdd);});});}function respondWithStatusCode(_0x5a0606,_0x310a89){_0x310a89=_0x310a89||0xcc;return function(_0x5557e9){if(_0x5557e9){return _0x5a0606[_0x1819('0x2b')](_0x310a89);}return _0x5a0606[_0x1819('0x2c')](_0x310a89)[_0x1819('0x2d')]();};}function respondWithResult(_0x5ce530,_0x3b35a4){_0x3b35a4=_0x3b35a4||0xc8;return function(_0x2f6f3e){if(_0x2f6f3e){return _0x5ce530['status'](_0x3b35a4)[_0x1819('0x2e')](_0x2f6f3e);}};}function respondWithFilteredResult(_0x2cbf20,_0x26479d){return function(_0x4f4408){if(_0x4f4408){var _0x4416a9=_0x4f4408['count'],_0x67fb4d=_0x26479d[_0x1819('0x2f')],_0x389fd3=_0x26479d[_0x1819('0x2f')]+_0x26479d[_0x1819('0x30')],_0x1f175f;if(_0x389fd3>=_0x4416a9){_0x389fd3=_0x4416a9;_0x1f175f=0xc8;}else{_0x1f175f=0xce;}_0x2cbf20[_0x1819('0x2c')](_0x1f175f);return _0x2cbf20[_0x1819('0x31')](_0x1819('0x32'),_0x67fb4d+'-'+_0x389fd3+'/'+_0x4416a9)[_0x1819('0x2e')](_0x4f4408);}return null;};}function patchUpdates(_0x3ad0f0){return function(_0xdb7601){try{jsonpatch[_0x1819('0x33')](_0xdb7601,_0x3ad0f0,!![]);}catch(_0x5dc1cb){return BPromise[_0x1819('0x34')](_0x5dc1cb);}return _0xdb7601[_0x1819('0x35')]();};}function saveUpdates(_0x5904d2,_0x3f10f2){return function(_0x37f29d){if(_0x37f29d){return _0x37f29d[_0x1819('0x36')](_0x5904d2)[_0x1819('0x20')](function(_0x3d21e4){return _0x3d21e4;});}return null;};}function removeEntity(_0x5e68de,_0x45e3f9){return function(_0x49ecc7){if(_0x49ecc7){return _0x49ecc7[_0x1819('0x37')]()[_0x1819('0x20')](function(){_0x5e68de[_0x1819('0x2c')](0xcc)[_0x1819('0x2d')]();});}};}function handleEntityNotFound(_0xa5e439,_0x375f97){return function(_0x383cd9){if(!_0x383cd9){_0xa5e439['sendStatus'](0x194);}return _0x383cd9;};}function handleError(_0x443103,_0x59bbed){_0x59bbed=_0x59bbed||0x1f4;return function(_0x4a3a21){logger[_0x1819('0x25')](_0x4a3a21['stack']);if(_0x4a3a21['name']){delete _0x4a3a21[_0x1819('0x38')];}_0x443103[_0x1819('0x2c')](_0x59bbed)[_0x1819('0x39')](_0x4a3a21);};}exports['index']=function(_0x5362b2,_0x1f7da7){var _0x56fe2d={},_0x433a03={},_0x1b50c9={'count':0x0,'rows':[]};var _0x37710b=_[_0x1819('0x3a')](db['FaxMessage'][_0x1819('0x3b')],function(_0x10e39e){return{'name':_0x10e39e[_0x1819('0x3c')],'type':_0x10e39e[_0x1819('0x3d')]['key']};});_0x433a03['model']=_[_0x1819('0x3a')](_0x37710b,_0x1819('0x38'));_0x433a03['query']=_['keys'](_0x5362b2[_0x1819('0x3e')]);_0x433a03[_0x1819('0x3f')]=_[_0x1819('0x40')](_0x433a03[_0x1819('0x41')],_0x433a03['query']);_0x56fe2d['attributes']=_[_0x1819('0x40')](_0x433a03[_0x1819('0x41')],qs[_0x1819('0x42')](_0x5362b2[_0x1819('0x3e')][_0x1819('0x42')]));_0x56fe2d[_0x1819('0x43')]=_0x56fe2d[_0x1819('0x43')][_0x1819('0x44')]?_0x56fe2d[_0x1819('0x43')]:_0x433a03[_0x1819('0x41')];if(!_0x5362b2[_0x1819('0x3e')][_0x1819('0x45')]('nolimit')){_0x56fe2d[_0x1819('0x30')]=qs[_0x1819('0x30')](_0x5362b2[_0x1819('0x3e')][_0x1819('0x30')]);_0x56fe2d[_0x1819('0x2f')]=qs['offset'](_0x5362b2[_0x1819('0x3e')][_0x1819('0x2f')]);}_0x56fe2d[_0x1819('0x46')]=qs[_0x1819('0x47')](_0x5362b2[_0x1819('0x3e')][_0x1819('0x47')]);_0x56fe2d[_0x1819('0x48')]=qs[_0x1819('0x3f')](_[_0x1819('0x49')](_0x5362b2[_0x1819('0x3e')],_0x433a03[_0x1819('0x3f')]),_0x37710b);if(_0x5362b2['query'][_0x1819('0x4a')]){_0x56fe2d['where']=_[_0x1819('0x4b')](_0x56fe2d[_0x1819('0x48')],{'$or':_[_0x1819('0x3a')](_0x37710b,function(_0x321f3a){if(_0x321f3a['type']!=='VIRTUAL'){var _0x5eb3c7={};_0x5eb3c7[_0x321f3a[_0x1819('0x38')]]={'$like':'%'+_0x5362b2[_0x1819('0x3e')]['filter']+'%'};return _0x5eb3c7;}})});}_0x56fe2d=_[_0x1819('0x4b')]({},_0x56fe2d,_0x5362b2[_0x1819('0x4c')]);var _0x5243d2={'where':_0x56fe2d[_0x1819('0x48')]};return db[_0x1819('0x4d')][_0x1819('0x4e')](_0x5243d2)['then'](function(_0x49c139){_0x1b50c9['count']=_0x49c139;if(_0x5362b2[_0x1819('0x3e')][_0x1819('0x4f')]){_0x56fe2d['include']=[{'all':!![]}];}return db[_0x1819('0x4d')][_0x1819('0x50')](_0x56fe2d);})[_0x1819('0x20')](function(_0x4bfa3a){_0x1b50c9[_0x1819('0x51')]=_0x4bfa3a;return _0x1b50c9;})[_0x1819('0x20')](respondWithFilteredResult(_0x1f7da7,_0x56fe2d))['catch'](handleError(_0x1f7da7,null));};exports[_0x1819('0x52')]=function(_0x2a8be5,_0x6be3c1){var _0x52a5e2={'raw':!![],'where':{'id':_0x2a8be5[_0x1819('0x53')]['id']}},_0x562735={};_0x562735[_0x1819('0x41')]=_[_0x1819('0x54')](db['FaxMessage']['rawAttributes']);_0x562735[_0x1819('0x3e')]=_[_0x1819('0x54')](_0x2a8be5[_0x1819('0x3e')]);_0x562735['filters']=_[_0x1819('0x40')](_0x562735[_0x1819('0x41')],_0x562735['query']);_0x52a5e2[_0x1819('0x43')]=_[_0x1819('0x40')](_0x562735['model'],qs[_0x1819('0x42')](_0x2a8be5[_0x1819('0x3e')][_0x1819('0x42')]));_0x52a5e2[_0x1819('0x43')]=_0x52a5e2[_0x1819('0x43')][_0x1819('0x44')]?_0x52a5e2[_0x1819('0x43')]:_0x562735[_0x1819('0x41')];if(_0x2a8be5[_0x1819('0x3e')][_0x1819('0x4f')]){_0x52a5e2[_0x1819('0x55')]=[{'all':!![]}];}_0x52a5e2=_[_0x1819('0x4b')]({},_0x52a5e2,_0x2a8be5[_0x1819('0x4c')]);return db[_0x1819('0x4d')][_0x1819('0x56')](_0x52a5e2)['then'](handleEntityNotFound(_0x6be3c1,null))['then'](respondWithResult(_0x6be3c1,null))[_0x1819('0x2a')](handleError(_0x6be3c1,null));};exports[_0x1819('0x36')]=function(_0x284f7e,_0x1f580e){if(_0x284f7e[_0x1819('0x57')]['id']){delete _0x284f7e[_0x1819('0x57')]['id'];}return db[_0x1819('0x4d')][_0x1819('0x56')]({'where':{'id':_0x284f7e[_0x1819('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f580e,null))[_0x1819('0x20')](saveUpdates(_0x284f7e[_0x1819('0x57')],null))[_0x1819('0x20')](respondWithResult(_0x1f580e,null))[_0x1819('0x2a')](handleError(_0x1f580e,null));};exports[_0x1819('0x37')]=function(_0x42a8be,_0x4c1ced){return db[_0x1819('0x4d')][_0x1819('0x56')]({'where':{'id':_0x42a8be[_0x1819('0x53')]['id']}})[_0x1819('0x20')](handleEntityNotFound(_0x4c1ced,null))[_0x1819('0x20')](removeEntity(_0x4c1ced,null))[_0x1819('0x2a')](handleError(_0x4c1ced,null));};exports[_0x1819('0x58')]=function(_0xd1e5d6,_0x3f8d21){return db[_0x1819('0x4d')][_0x1819('0x58')]()[_0x1819('0x20')](respondWithResult(_0x3f8d21,null))[_0x1819('0x2a')](handleError(_0x3f8d21,null));};var interaction_log=require(_0x1819('0x59'))(_0x1819('0x5a'));exports[_0x1819('0x5b')]=function(_0x18caa4,_0x2390f7,_0x1ea605){var _0x559154={'channel':_0x1819('0x5c')};if(_0x18caa4[_0x1819('0x57')]['id']){delete _0x18caa4['body']['id'];}_0x18caa4[_0x1819('0x57')][_0x1819('0x5d')]=!![];_0x18caa4[_0x1819('0x57')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x18caa4['body'][_0x1819('0x5e')]=_0x18caa4[_0x1819('0x57')][_0x1819('0x5e')]||_0x18caa4[_0x1819('0x5f')]['id'];return db[_0x1819('0x4d')][_0x1819('0x56')]({'where':{'id':_0x18caa4[_0x1819('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x1819('0x60')],'as':_0x1819('0x61')}]})[_0x1819('0x20')](handleEntityNotFound(_0x2390f7,null))[_0x1819('0x20')](saveUpdates(_0x18caa4[_0x1819('0x57')],null))['then'](function(_0x3690bb){if(_0x3690bb){_0x559154['message']=_0x3690bb[_0x1819('0x62')]({'plain':!![]});return db[_0x1819('0x63')][_0x1819('0x56')]({'where':{'id':_0x3690bb[_0x1819('0x64')]}});}return null;})[_0x1819('0x20')](handleEntityNotFound(_0x2390f7,null))[_0x1819('0x20')](function(_0x293248){if(_0x293248){return _0x293248[_0x1819('0x36')]({'UserId':_0x18caa4[_0x1819('0x57')][_0x1819('0x5e')],'read1stAt':_[_0x1819('0x65')](_0x293248[_0x1819('0x66')])?moment()[_0x1819('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1819('0x20')](function(_0x3f5662){if(_0x3f5662){_0x559154['interaction']=_0x3f5662[_0x1819('0x62')]({'plain':!![]});interaction_log[_0x1819('0x21')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18caa4[_0x1819('0x5f')]['id'],_0x18caa4[_0x1819('0x5f')][_0x1819('0x38')],_0x18caa4[_0x1819('0x5f')][_0x1819('0x68')],_0x559154['interaction']['id'],_0x18caa4[_0x1819('0x57')]?JSON[_0x1819('0x24')](_0x18caa4[_0x1819('0x57')]):'null');return respondWithRpcPromise(_0x1819('0x69'),'acceptMessage',_0x559154);}return null;})[_0x1819('0x20')](function(_0x48059c){if(_0x48059c){if(_0x18caa4[_0x1819('0x57')][_0x1819('0x6a')]){_0x559154['message'][_0x1819('0x6b')]=util[_0x1819('0x67')](_0x1819('0x6c'),_0x18caa4[_0x1819('0x5f')][_0x1819('0x38')]);_0x559154[_0x1819('0x28')][_0x1819('0x6d')]=_0x559154[_0x1819('0x6d')];_0x559154['message'][_0x1819('0x6e')]=_0x1819('0x5b');return respondWithRpcPromise(_0x1819('0x6f'),_0x1819('0x6f'),{'event':'acceptmessage','message':_0x559154['message']},client9002)[_0x1819('0x20')](function(){return _0x559154;});}return _0x559154;}return null;})['then'](respondWithResult(_0x2390f7,null))[_0x1819('0x2a')](handleError(_0x2390f7,null));};var interaction_log=require(_0x1819('0x59'))('fax-interactions');exports['reject']=function(_0x38d519,_0x318be4,_0x156be6){var _0x3b3813={'agent':{},'channel':_0x1819('0x5c')};if(_0x38d519[_0x1819('0x57')]['id']){delete _0x38d519['body']['id'];}_0x38d519[_0x1819('0x57')][_0x1819('0x5e')]=_0x38d519[_0x1819('0x57')][_0x1819('0x5e')]||_0x38d519[_0x1819('0x5f')]['id'];_0x3b3813[_0x1819('0x70')]['id']=_0x38d519[_0x1819('0x57')][_0x1819('0x5e')];return db[_0x1819('0x4d')][_0x1819('0x56')]({'where':{'id':_0x38d519[_0x1819('0x53')]['id'],'UserId':null}})[_0x1819('0x20')](handleEntityNotFound(_0x318be4,null))[_0x1819('0x20')](function(_0x4c3b7e){if(_0x4c3b7e){_0x3b3813[_0x1819('0x28')]=_0x4c3b7e[_0x1819('0x62')]({'plain':!![]});return db[_0x1819('0x63')][_0x1819('0x56')]({'where':{'id':_0x4c3b7e[_0x1819('0x64')]}});}return null;})[_0x1819('0x20')](handleEntityNotFound(_0x318be4,null))[_0x1819('0x20')](function(_0x4be7d7){if(_0x4be7d7){_0x3b3813[_0x1819('0x71')]=_0x4be7d7[_0x1819('0x62')]({'plain':!![]});interaction_log['info'](_0x1819('0x72'),_0x38d519[_0x1819('0x5f')]['id'],_0x38d519[_0x1819('0x5f')][_0x1819('0x38')],_0x38d519['user']['role'],_0x3b3813[_0x1819('0x71')]['id'],_0x38d519['body']?JSON['stringify'](_0x38d519[_0x1819('0x57')]):_0x1819('0x73'));return respondWithRpcPromise(_0x1819('0x74'),'rejectMessage',_0x3b3813);}return null;})[_0x1819('0x20')](function(_0x219959){if(_0x219959){_0x219959[_0x1819('0x28')]['interface']=util[_0x1819('0x67')](_0x1819('0x6c'),_0x38d519[_0x1819('0x5f')][_0x1819('0x38')]);_0x219959[_0x1819('0x28')]['channel']=_0x3b3813['channel'];_0x219959[_0x1819('0x28')][_0x1819('0x6e')]=_0x1819('0x34');respondWithRpcPromise('EventManager',_0x1819('0x6f'),{'event':_0x1819('0x75'),'message':_0x219959[_0x1819('0x28')]},client9002);return _0x3b3813;}return null;})[_0x1819('0x20')](respondWithResult(_0x318be4,null))[_0x1819('0x2a')](handleError(_0x318be4,null));};exports[_0x1819('0x76')]=function(_0x50eefd,_0x47af6d){var _0x30e501;return db[_0x1819('0x4d')][_0x1819('0x76')](_0x50eefd['body'],{})[_0x1819('0x20')](function(_0x56c61c){_0x30e501=_0x56c61c;return db[_0x1819('0x60')][_0x1819('0x77')]({'where':{'id':_0x30e501[_0x1819('0x78')]}});})[_0x1819('0x20')](function(_0x8947f3){if(_[_0x1819('0x65')](_0x8947f3)){return;}else{_0x30e501[_0x1819('0x5c')]=_0x8947f3[_0x1819('0x5c')];return db[_0x1819('0x79')]['findOne']({'where':{'id':_0x30e501[_0x1819('0x7a')]}});}})[_0x1819('0x20')](function(_0x250cda){return respondWithRpcPromise(_0x1819('0x7b'),'SendFax',{'FaxAccountId':_[_0x1819('0x65')](_0x50eefd[_0x1819('0x57')])?undefined:_0x50eefd[_0x1819('0x57')]['FaxAccountId'],'path':_[_0x1819('0x65')](_0x250cda)?undefined:util[_0x1819('0x67')](_0x1819('0x7c'),_0x250cda[_0x1819('0x7d')]),'fax':_[_0x1819('0x65')](_0x30e501[_0x1819('0x5c')])?undefined:_0x30e501['fax'],'AttachmentId':_0x30e501[_0x1819('0x7a')]},client9002);})['then'](respondWithResult(_0x47af6d,0xc9))[_0x1819('0x2a')](handleError(_0x47af6d,null));};exports[_0x1819('0x7e')]=function(_0xd7c237,_0xa009f1){var _0x762503=path[_0x1819('0x7f')](config[_0x1819('0x80')],_0x1819('0x81'),_0x1819('0x82'),_0x1819('0x83'));return db[_0x1819('0x4d')]['find']({'where':{'id':_0xd7c237[_0x1819('0x53')]['id']},'include':[{'model':db[_0x1819('0x79')],'as':_0x1819('0x79')}]})['then'](handleEntityNotFound(_0xa009f1,null))['then'](function(_0x3b2248){if(_0x3b2248){return _0xa009f1[_0x1819('0x7e')](path[_0x1819('0x7f')](_0x762503,_0x3b2248[_0x1819('0x79')]['basename']));}})[_0x1819('0x2a')](handleError(_0xa009f1,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9091afd..db1ac3f 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(_0xe5ac0b,_0x5b367d){var _0x56aebb=function(_0x29b689){while(--_0x29b689){_0xe5ac0b['push'](_0xe5ac0b['shift']());}};_0x56aebb(++_0x5b367d);}(_0x008c,0x188));var _0xc008=function(_0x3afd09,_0x52634e){_0x3afd09=_0x3afd09-0x0;var _0x451138=_0x008c[_0x3afd09];return _0x451138;};'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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x55ca,0x126));var _0xa55c=function(_0x3df21d,_0xa44265){_0x3df21d=_0x3df21d-0x0;var _0x37ab8a=_0x55ca[_0x3df21d];return _0x37ab8a;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 5aacbc4..a10e3e2 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 _0xe920=['path','../../config/environment','define','FaxMessage','fti_fax_messages','body','get','direction','toLowerCase','out','secret','isNil','findOne','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise'];(function(_0x29800e,_0x5693d0){var _0x464826=function(_0x4e44a3){while(--_0x4e44a3){_0x29800e['push'](_0x29800e['shift']());}};_0x464826(++_0x5693d0);}(_0xe920,0x18a));var _0x0e92=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xe920[_0x6e1239];return _0x418150;};'use strict';var _=require('lodash');var util=require(_0x0e92('0x0'));var logger=require('../../config/logger')(_0x0e92('0x1'));var moment=require(_0x0e92('0x2'));var BPromise=require(_0x0e92('0x3'));var rp=require(_0x0e92('0x4'));var fs=require('fs');var path=require(_0x0e92('0x5'));var rimraf=require('rimraf');var config=require(_0x0e92('0x6'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x3822d3,_0x55d74b){return _0x3822d3[_0x0e92('0x7')](_0x0e92('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x0e92('0x9'),'fields':[_0x0e92('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26541f,_0x5b3ad7,_0xf229be){var _0x28a948=_0x3822d3['models'];var _0x11f59a=_0x26541f[_0x0e92('0xb')]({'plain':!![]});if(_0x11f59a[_0x0e92('0xc')][_0x0e92('0xd')]()==='in'||_0x11f59a[_0x0e92('0xc')][_0x0e92('0xd')]()===_0x0e92('0xe')&&!_0x11f59a[_0x0e92('0xf')]&&!_[_0x0e92('0x10')](_0x11f59a['UserId'])){_0x28a948['FaxInteraction'][_0x0e92('0x11')]({'where':{'id':_0x11f59a['FaxInteractionId']}})['then'](function(_0x381c3d){if(_0x381c3d){_0x381c3d['update']({'lastMsgAt':_0x11f59a['createdAt'],'lastMsgDirection':_0x11f59a[_0x0e92('0xc')][_0x0e92('0xd')]()});}})['catch'](function(_0x5a1e59){console[_0x0e92('0x12')](_0x5a1e59);});}_0xf229be();}},'charset':_0x0e92('0x13'),'collate':_0x0e92('0x14')});}; \ No newline at end of file +var _0x6ff2=['toLowerCase','out','secret','isNil','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','get','direction'];(function(_0x22ff70,_0xe67bde){var _0x4515cf=function(_0x22a09d){while(--_0x22a09d){_0x22ff70['push'](_0x22ff70['shift']());}};_0x4515cf(++_0xe67bde);}(_0x6ff2,0xfe));var _0x26ff=function(_0x2d259f,_0x37ca77){_0x2d259f=_0x2d259f-0x0;var _0x2240c1=_0x6ff2[_0x2d259f];return _0x2240c1;};'use strict';var _=require(_0x26ff('0x0'));var util=require(_0x26ff('0x1'));var logger=require(_0x26ff('0x2'))('api');var moment=require(_0x26ff('0x3'));var BPromise=require(_0x26ff('0x4'));var rp=require(_0x26ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x26ff('0x6'));var config=require('../../config/environment');var attributes=require(_0x26ff('0x7'));module[_0x26ff('0x8')]=function(_0x140554,_0x1a0eb9){return _0x140554[_0x26ff('0x9')](_0x26ff('0xa'),attributes,{'tableName':_0x26ff('0xb'),'paranoid':![],'indexes':[{'name':_0x26ff('0xc'),'fields':[_0x26ff('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cc718,_0x3c5c66,_0x192dbd){var _0x2d5077=_0x140554['models'];var _0x64cf08=_0x1cc718[_0x26ff('0xe')]({'plain':!![]});if(_0x64cf08[_0x26ff('0xf')][_0x26ff('0x10')]()==='in'||_0x64cf08['direction']['toLowerCase']()===_0x26ff('0x11')&&!_0x64cf08[_0x26ff('0x12')]&&!_[_0x26ff('0x13')](_0x64cf08['UserId'])){_0x2d5077[_0x26ff('0x14')]['findOne']({'where':{'id':_0x64cf08[_0x26ff('0x15')]}})[_0x26ff('0x16')](function(_0x55747b){if(_0x55747b){_0x55747b[_0x26ff('0x17')]({'lastMsgAt':_0x64cf08[_0x26ff('0x18')],'lastMsgDirection':_0x64cf08[_0x26ff('0xf')][_0x26ff('0x10')]()});}})[_0x26ff('0x19')](function(_0x192e04){console['error'](_0x192e04);});}_0x192dbd();}},'charset':'utf8mb4','collate':_0x26ff('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a036464..e3f2c8a 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 _0x08d0=['result','catch','create','body','options','raw','CreateFaxMessage','stringify','FaxMessage','update','UpdateFaxMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x19d4dc,_0x46e8e0){var _0x1cf72f=function(_0x42402c){while(--_0x42402c){_0x19d4dc['push'](_0x19d4dc['shift']());}};_0x1cf72f(++_0x46e8e0);}(_0x08d0,0x133));var _0x008d=function(_0x3df1ca,_0x49fb2a){_0x3df1ca=_0x3df1ca-0x0;var _0x5e7db8=_0x08d0[_0x3df1ca];return _0x5e7db8;};'use strict';var _=require(_0x008d('0x0'));var util=require(_0x008d('0x1'));var moment=require(_0x008d('0x2'));var BPromise=require('bluebird');var rs=require(_0x008d('0x3'));var fs=require('fs');var Redis=require(_0x008d('0x4'));var db=require(_0x008d('0x5'))['db'];var utils=require(_0x008d('0x6'));var logger=require(_0x008d('0x7'))(_0x008d('0x8'));var config=require(_0x008d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x008d('0xa')][_0x008d('0xb')]({'port':0x232a});config[_0x008d('0xc')]=_[_0x008d('0xd')](config[_0x008d('0xc')],{'host':_0x008d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x008d('0xc')]));require(_0x008d('0xf'))[_0x008d('0x10')](socket);function respondWithRpcPromise(_0x3cc775,_0x9ed474,_0x246030){return new BPromise(function(_0x43c56e,_0x214e5a){return client[_0x008d('0x11')](_0x3cc775,_0x246030)['then'](function(_0x59cc3a){logger[_0x008d('0x12')](_0x008d('0x13'),_0x9ed474,_0x008d('0x14'));logger[_0x008d('0x15')](_0x008d('0x16'),_0x9ed474,_0x008d('0x14'),JSON['stringify'](_0x59cc3a));if(_0x59cc3a[_0x008d('0x17')]){if(_0x59cc3a[_0x008d('0x17')][_0x008d('0x18')]===0x1f4){logger[_0x008d('0x17')](_0x008d('0x13'),_0x9ed474,_0x59cc3a['error'][_0x008d('0x19')]);return _0x214e5a(_0x59cc3a[_0x008d('0x17')][_0x008d('0x19')]);}logger[_0x008d('0x17')](_0x008d('0x13'),_0x9ed474,_0x59cc3a[_0x008d('0x17')][_0x008d('0x19')]);return _0x43c56e(_0x59cc3a[_0x008d('0x17')][_0x008d('0x19')]);}else{logger[_0x008d('0x12')](_0x008d('0x13'),_0x9ed474,'request\x20sent');_0x43c56e(_0x59cc3a[_0x008d('0x1a')]['message']);}})[_0x008d('0x1b')](function(_0x3274b0){logger[_0x008d('0x17')](_0x008d('0x13'),_0x9ed474,_0x3274b0);_0x214e5a(_0x3274b0);});});}exports['CreateFaxMessage']=function(_0x415ba1){var _0x2c0ba0=this;return new Promise(function(_0x4e3f02,_0x12cb21){return db['FaxMessage'][_0x008d('0x1c')](_0x415ba1[_0x008d('0x1d')],{'raw':_0x415ba1[_0x008d('0x1e')]?_0x415ba1[_0x008d('0x1e')][_0x008d('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x177ce8){logger['info'](_0x008d('0x20'),_0x415ba1);logger[_0x008d('0x15')]('CreateFaxMessage',_0x415ba1,JSON[_0x008d('0x21')](_0x177ce8));_0x4e3f02(_0x177ce8);})[_0x008d('0x1b')](function(_0x12406b){logger[_0x008d('0x17')]('CreateFaxMessage',_0x12406b[_0x008d('0x19')],_0x415ba1);_0x12cb21(_0x2c0ba0['error'](0x1f4,_0x12406b[_0x008d('0x19')]));});});};exports['UpdateFaxMessage']=function(_0x522b25){var _0x32f83a=this;return new Promise(function(_0x4b91cf,_0x31d12a){return db[_0x008d('0x22')][_0x008d('0x23')](_0x522b25[_0x008d('0x1d')],{'raw':_0x522b25['options']?_0x522b25['options'][_0x008d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522b25[_0x008d('0x1e')]?_0x522b25['options']['where']||null:null,'attributes':_0x522b25['options']?_0x522b25[_0x008d('0x1e')]['attributes']||null:null,'limit':_0x522b25[_0x008d('0x1e')]?_0x522b25[_0x008d('0x1e')]['limit']||null:null})['then'](function(_0x2a8105){logger[_0x008d('0x12')](_0x008d('0x24'),_0x522b25);logger[_0x008d('0x15')](_0x008d('0x24'),_0x522b25,JSON[_0x008d('0x21')](_0x2a8105));_0x4b91cf(_0x2a8105);})[_0x008d('0x1b')](function(_0x24cd5d){logger[_0x008d('0x17')](_0x008d('0x24'),_0x24cd5d[_0x008d('0x19')],_0x522b25);_0x31d12a(_0x32f83a[_0x008d('0x17')](0x1f4,_0x24cd5d[_0x008d('0x19')]));});});}; \ No newline at end of file +var _0x5a52=['FaxMessage','create','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x5a52,0xc3));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x25a5('0x0'));var util=require(_0x25a5('0x1'));var moment=require('moment');var BPromise=require(_0x25a5('0x2'));var rs=require(_0x25a5('0x3'));var fs=require('fs');var Redis=require(_0x25a5('0x4'));var db=require(_0x25a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x25a5('0x6'))(_0x25a5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25a5('0x8')][_0x25a5('0x9')]({'port':0x232a});config['redis']=_[_0x25a5('0xa')](config[_0x25a5('0xb')],{'host':_0x25a5('0xc'),'port':0x18eb});var socket=require(_0x25a5('0xd'))(new Redis(config[_0x25a5('0xb')]));require(_0x25a5('0xe'))['register'](socket);function respondWithRpcPromise(_0x3721fc,_0x26d817,_0x54e86b){return new BPromise(function(_0x5f0860,_0x4db68c){return client[_0x25a5('0xf')](_0x3721fc,_0x54e86b)[_0x25a5('0x10')](function(_0x8ae0f9){logger[_0x25a5('0x11')](_0x25a5('0x12'),_0x26d817,_0x25a5('0x13'));logger['debug'](_0x25a5('0x14'),_0x26d817,'request\x20sent',JSON[_0x25a5('0x15')](_0x8ae0f9));if(_0x8ae0f9['error']){if(_0x8ae0f9['error'][_0x25a5('0x16')]===0x1f4){logger[_0x25a5('0x17')]('FaxMessage,\x20%s,\x20%s',_0x26d817,_0x8ae0f9[_0x25a5('0x17')]['message']);return _0x4db68c(_0x8ae0f9[_0x25a5('0x17')][_0x25a5('0x18')]);}logger[_0x25a5('0x17')]('FaxMessage,\x20%s,\x20%s',_0x26d817,_0x8ae0f9[_0x25a5('0x17')]['message']);return _0x5f0860(_0x8ae0f9['error'][_0x25a5('0x18')]);}else{logger[_0x25a5('0x11')](_0x25a5('0x12'),_0x26d817,_0x25a5('0x13'));_0x5f0860(_0x8ae0f9[_0x25a5('0x19')][_0x25a5('0x18')]);}})[_0x25a5('0x1a')](function(_0x3b7399){logger[_0x25a5('0x17')](_0x25a5('0x12'),_0x26d817,_0x3b7399);_0x4db68c(_0x3b7399);});});}exports['CreateFaxMessage']=function(_0x4d45e6){var _0x4a94fc=this;return new Promise(function(_0x47846f,_0x109c50){return db[_0x25a5('0x1b')][_0x25a5('0x1c')](_0x4d45e6['body'],{'raw':_0x4d45e6[_0x25a5('0x1d')]?_0x4d45e6[_0x25a5('0x1d')][_0x25a5('0x1e')]===undefined?!![]:![]:!![]})[_0x25a5('0x10')](function(_0x2cd874){logger[_0x25a5('0x11')](_0x25a5('0x1f'),_0x4d45e6);logger[_0x25a5('0x20')](_0x25a5('0x1f'),_0x4d45e6,JSON[_0x25a5('0x15')](_0x2cd874));_0x47846f(_0x2cd874);})[_0x25a5('0x1a')](function(_0x29aa90){logger[_0x25a5('0x17')](_0x25a5('0x1f'),_0x29aa90[_0x25a5('0x18')],_0x4d45e6);_0x109c50(_0x4a94fc['error'](0x1f4,_0x29aa90[_0x25a5('0x18')]));});});};exports[_0x25a5('0x21')]=function(_0x39dd00){var _0xb7fe7=this;return new Promise(function(_0x11b793,_0x3175db){return db['FaxMessage'][_0x25a5('0x22')](_0x39dd00['body'],{'raw':_0x39dd00['options']?_0x39dd00[_0x25a5('0x1d')][_0x25a5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39dd00[_0x25a5('0x1d')]?_0x39dd00[_0x25a5('0x1d')][_0x25a5('0x23')]||null:null,'attributes':_0x39dd00[_0x25a5('0x1d')]?_0x39dd00['options'][_0x25a5('0x24')]||null:null,'limit':_0x39dd00['options']?_0x39dd00[_0x25a5('0x1d')]['limit']||null:null})[_0x25a5('0x10')](function(_0x3ac11b){logger[_0x25a5('0x11')]('UpdateFaxMessage',_0x39dd00);logger[_0x25a5('0x20')]('UpdateFaxMessage',_0x39dd00,JSON[_0x25a5('0x15')](_0x3ac11b));_0x11b793(_0x3ac11b);})[_0x25a5('0x1a')](function(_0x47daed){logger[_0x25a5('0x17')](_0x25a5('0x21'),_0x47daed[_0x25a5('0x18')],_0x39dd00);_0x3175db(_0xb7fe7[_0x25a5('0x17')](0x1f4,_0x47daed[_0x25a5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5d8c109..946612b 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 _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 a170ff6..6206a4d 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 _0x5561=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','/:id/download','download','post','fax','faxmessage:create','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','exports'];(function(_0x2cab03,_0x56f5d3){var _0x4fea07=function(_0x56c020){while(--_0x56c020){_0x2cab03['push'](_0x2cab03['shift']());}};_0x4fea07(++_0x56f5d3);}(_0x5561,0xe0));var _0x1556=function(_0x1107bf,_0x189372){_0x1107bf=_0x1107bf-0x0;var _0x53a840=_0x5561[_0x1107bf];return _0x53a840;};'use strict';var multer=require(_0x1556('0x0'));var util=require(_0x1556('0x1'));var path=require(_0x1556('0x2'));var timeout=require(_0x1556('0x3'));var express=require(_0x1556('0x4'));var router=express[_0x1556('0x5')]();var auth=require(_0x1556('0x6'));var interaction=require(_0x1556('0x7'));var config=require(_0x1556('0x8'));var controller=require(_0x1556('0x9'));router[_0x1556('0xa')]('/',auth['isAuthenticated'](),controller[_0x1556('0xb')]);router[_0x1556('0xa')](_0x1556('0xc'),auth[_0x1556('0xd')](),controller[_0x1556('0xe')]);router[_0x1556('0xa')]('/:id',auth[_0x1556('0xd')](),controller['show']);router['get'](_0x1556('0xf'),auth[_0x1556('0xd')](),controller[_0x1556('0x10')]);router[_0x1556('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x1556('0x12'),_0x1556('0x13')),controller['create']);router[_0x1556('0x14')](_0x1556('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x1556('0x14')](_0x1556('0x16'),auth[_0x1556('0xd')](),controller[_0x1556('0x17')]);router['put'](_0x1556('0x18'),auth[_0x1556('0xd')](),controller[_0x1556('0x19')]);router[_0x1556('0x1a')](_0x1556('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0x1556('0x1b')]=router; \ No newline at end of file +var _0xcc57=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','tracked','fax','faxmessage:create','create','/:id','update','put','/:id/accept','/:id/reject','reject','delete'];(function(_0x29894f,_0x2a63f2){var _0x24d21c=function(_0x3506a9){while(--_0x3506a9){_0x29894f['push'](_0x29894f['shift']());}};_0x24d21c(++_0x2a63f2);}(_0xcc57,0x98));var _0x7cc5=function(_0x5b5411,_0x41100a){_0x5b5411=_0x5b5411-0x0;var _0xe8054=_0xcc57[_0x5b5411];return _0xe8054;};'use strict';var multer=require('multer');var util=require(_0x7cc5('0x0'));var path=require(_0x7cc5('0x1'));var timeout=require(_0x7cc5('0x2'));var express=require(_0x7cc5('0x3'));var router=express[_0x7cc5('0x4')]();var auth=require(_0x7cc5('0x5'));var interaction=require(_0x7cc5('0x6'));var config=require(_0x7cc5('0x7'));var controller=require(_0x7cc5('0x8'));router[_0x7cc5('0x9')]('/',auth[_0x7cc5('0xa')](),controller[_0x7cc5('0xb')]);router[_0x7cc5('0x9')](_0x7cc5('0xc'),auth['isAuthenticated'](),controller[_0x7cc5('0xd')]);router['get']('/:id',auth[_0x7cc5('0xa')](),controller[_0x7cc5('0xe')]);router[_0x7cc5('0x9')](_0x7cc5('0xf'),auth[_0x7cc5('0xa')](),controller[_0x7cc5('0x10')]);router['post']('/',auth[_0x7cc5('0xa')](),interaction[_0x7cc5('0x11')](_0x7cc5('0x12'),_0x7cc5('0x13')),controller[_0x7cc5('0x14')]);router['put'](_0x7cc5('0x15'),auth[_0x7cc5('0xa')](),controller[_0x7cc5('0x16')]);router[_0x7cc5('0x17')](_0x7cc5('0x18'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x7cc5('0x19'),auth['isAuthenticated'](),controller[_0x7cc5('0x1a')]);router[_0x7cc5('0x1b')](_0x7cc5('0x15'),auth[_0x7cc5('0xa')](),controller[_0x7cc5('0x1c')]);module[_0x7cc5('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 dcdef13..c14ac28 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 _0xc3b0=['STRING','name','ENUM','rrmemory','roundrobin','INTEGER','sequelize','exports'];(function(_0x369f69,_0x3b127a){var _0x20dbfe=function(_0x296797){while(--_0x296797){_0x369f69['push'](_0x369f69['shift']());}};_0x20dbfe(++_0x3b127a);}(_0xc3b0,0x166));var _0x0c3b=function(_0x2a15f1,_0x4d7cd4){_0x2a15f1=_0x2a15f1-0x0;var _0xe776aa=_0xc3b0[_0x2a15f1];return _0xe776aa;};'use strict';var Sequelize=require(_0x0c3b('0x0'));module[_0x0c3b('0x1')]={'name':{'type':Sequelize[_0x0c3b('0x2')],'unique':_0x0c3b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0c3b('0x4')](_0x0c3b('0x5'),'beepall',_0x0c3b('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0c3b('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7dc2=['INTEGER','rrmemory','beepall','STRING','name'];(function(_0x49af2e,_0x55f373){var _0x8329b0=function(_0x48010b){while(--_0x48010b){_0x49af2e['push'](_0x49af2e['shift']());}};_0x8329b0(++_0x55f373);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x27dc('0x0')],'unique':_0x27dc('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x27dc('0x0')]},'timeout':{'type':Sequelize[_0x27dc('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x27dc('0x3'),_0x27dc('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x27dc('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 0f641a2..c2ebb10 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 _0xa8d9=['index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','FaxQueue','includeAll','include','findAll','rows','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','Agents','flatMap','transaction','each','findOrCreate','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','every','TeamId','all','compact','value','isEmpty','forEach','emit','userFaxQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','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','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send'];(function(_0x291ba0,_0x2ad93c){var _0x2045b0=function(_0x38f199){while(--_0x38f199){_0x291ba0['push'](_0x291ba0['shift']());}};_0x2045b0(++_0x2ad93c);}(_0xa8d9,0x1f1));var _0x9a8d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa8d9[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x9a8d('0x0'));var emlformat=require(_0x9a8d('0x1'));var rimraf=require(_0x9a8d('0x2'));var zipdir=require(_0x9a8d('0x3'));var jsonpatch=require(_0x9a8d('0x4'));var rp=require('request-promise');var moment=require(_0x9a8d('0x5'));var BPromise=require(_0x9a8d('0x6'));var Mustache=require('mustache');var util=require(_0x9a8d('0x7'));var path=require(_0x9a8d('0x8'));var sox=require(_0x9a8d('0x9'));var csv=require(_0x9a8d('0xa'));var ejs=require(_0x9a8d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9a8d('0xc'));var crypto=require(_0x9a8d('0xd'));var jsforce=require(_0x9a8d('0xe'));var deskjs=require(_0x9a8d('0xf'));var toCsv=require(_0x9a8d('0xa'));var querystring=require('querystring');var Papa=require(_0x9a8d('0x10'));var Redis=require(_0x9a8d('0x11'));var authService=require(_0x9a8d('0x12'));var qs=require(_0x9a8d('0x13'));var as=require(_0x9a8d('0x14'));var hardwareService=require(_0x9a8d('0x15'));var logger=require(_0x9a8d('0x16'))(_0x9a8d('0x17'));var utils=require(_0x9a8d('0x18'));var config=require(_0x9a8d('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9a8d('0x1a')](config[_0x9a8d('0x1b')],{'host':_0x9a8d('0x1c'),'port':0x18eb});var socket=require(_0x9a8d('0x1d'))(new Redis(config[_0x9a8d('0x1b')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x257ec8,_0x17b06e){_0x17b06e=_0x17b06e||0xcc;return function(_0x2feb27){if(_0x2feb27){return _0x257ec8[_0x9a8d('0x1e')](_0x17b06e);}return _0x257ec8[_0x9a8d('0x1f')](_0x17b06e)[_0x9a8d('0x20')]();};}function respondWithResult(_0x59e984,_0x419173){_0x419173=_0x419173||0xc8;return function(_0x37c632){if(_0x37c632){return _0x59e984[_0x9a8d('0x1f')](_0x419173)[_0x9a8d('0x21')](_0x37c632);}};}function respondWithFilteredResult(_0x32d491,_0x9df34d){return function(_0x47d80e){if(_0x47d80e){var _0x2c1360=_0x47d80e[_0x9a8d('0x22')],_0x5565f8=_0x9df34d[_0x9a8d('0x23')],_0x24c080=_0x9df34d[_0x9a8d('0x23')]+_0x9df34d[_0x9a8d('0x24')],_0x48a0a8;if(_0x24c080>=_0x2c1360){_0x24c080=_0x2c1360;_0x48a0a8=0xc8;}else{_0x48a0a8=0xce;}_0x32d491['status'](_0x48a0a8);return _0x32d491[_0x9a8d('0x25')](_0x9a8d('0x26'),_0x5565f8+'-'+_0x24c080+'/'+_0x2c1360)['json'](_0x47d80e);}return null;};}function patchUpdates(_0x497c26){return function(_0x36b7a5){try{jsonpatch[_0x9a8d('0x27')](_0x36b7a5,_0x497c26,!![]);}catch(_0x4f2e89){return BPromise[_0x9a8d('0x28')](_0x4f2e89);}return _0x36b7a5[_0x9a8d('0x29')]();};}function saveUpdates(_0x5d08b6,_0x2bbeb3){return function(_0x213e90){if(_0x213e90){return _0x213e90['update'](_0x5d08b6)[_0x9a8d('0x2a')](function(_0x1a93c2){return _0x1a93c2;});}return null;};}function removeEntity(_0x3fc5cd,_0x50ce89){return function(_0x2177c7){if(_0x2177c7){return _0x2177c7[_0x9a8d('0x2b')]()[_0x9a8d('0x2a')](function(){var _0x57e5a2=_0x2177c7[_0x9a8d('0x2c')]({'plain':!![]});var _0xe5c78f=_0x9a8d('0x2d');return db[_0x9a8d('0x2e')][_0x9a8d('0x2b')]({'where':{'type':_0xe5c78f,'resourceId':_0x57e5a2['id']}})[_0x9a8d('0x2a')](function(){return _0x2177c7;});})['then'](function(){_0x3fc5cd[_0x9a8d('0x1f')](0xcc)[_0x9a8d('0x20')]();});}};}function handleEntityNotFound(_0x50af6b,_0x404d2f){return function(_0x5dbb2a){if(!_0x5dbb2a){_0x50af6b[_0x9a8d('0x1e')](0x194);}return _0x5dbb2a;};}function handleError(_0x4c3ec7,_0x3dde53){_0x3dde53=_0x3dde53||0x1f4;return function(_0x50ef61){logger[_0x9a8d('0x2f')](_0x50ef61[_0x9a8d('0x30')]);if(_0x50ef61[_0x9a8d('0x31')]){delete _0x50ef61[_0x9a8d('0x31')];}_0x4c3ec7[_0x9a8d('0x1f')](_0x3dde53)[_0x9a8d('0x32')](_0x50ef61);};}exports[_0x9a8d('0x33')]=function(_0x55e93c,_0x15056c){var _0x48d2b8={},_0x3b5051={},_0x17b5b6={'count':0x0,'rows':[]};var _0xbd5e88=_[_0x9a8d('0x34')](db['FaxQueue'][_0x9a8d('0x35')],function(_0x25cbdb){return{'name':_0x25cbdb[_0x9a8d('0x36')],'type':_0x25cbdb[_0x9a8d('0x37')][_0x9a8d('0x38')]};});_0x3b5051[_0x9a8d('0x39')]=_[_0x9a8d('0x34')](_0xbd5e88,'name');_0x3b5051[_0x9a8d('0x3a')]=_[_0x9a8d('0x3b')](_0x55e93c[_0x9a8d('0x3a')]);_0x3b5051['filters']=_[_0x9a8d('0x3c')](_0x3b5051[_0x9a8d('0x39')],_0x3b5051[_0x9a8d('0x3a')]);_0x48d2b8[_0x9a8d('0x3d')]=_[_0x9a8d('0x3c')](_0x3b5051[_0x9a8d('0x39')],qs[_0x9a8d('0x3e')](_0x55e93c[_0x9a8d('0x3a')]['fields']));_0x48d2b8[_0x9a8d('0x3d')]=_0x48d2b8[_0x9a8d('0x3d')][_0x9a8d('0x3f')]?_0x48d2b8['attributes']:_0x3b5051['model'];if(!_0x55e93c[_0x9a8d('0x3a')]['hasOwnProperty'](_0x9a8d('0x40'))){_0x48d2b8['limit']=qs['limit'](_0x55e93c[_0x9a8d('0x3a')][_0x9a8d('0x24')]);_0x48d2b8[_0x9a8d('0x23')]=qs[_0x9a8d('0x23')](_0x55e93c[_0x9a8d('0x3a')][_0x9a8d('0x23')]);}_0x48d2b8['order']=qs['sort'](_0x55e93c[_0x9a8d('0x3a')][_0x9a8d('0x41')]);_0x48d2b8[_0x9a8d('0x42')]=qs[_0x9a8d('0x43')](_[_0x9a8d('0x44')](_0x55e93c[_0x9a8d('0x3a')],_0x3b5051[_0x9a8d('0x43')]),_0xbd5e88);if(_0x55e93c[_0x9a8d('0x3a')][_0x9a8d('0x45')]){_0x48d2b8[_0x9a8d('0x42')]=_[_0x9a8d('0x46')](_0x48d2b8[_0x9a8d('0x42')],{'$or':_['map'](_0xbd5e88,function(_0x8d6d94){if(_0x8d6d94[_0x9a8d('0x37')]!=='VIRTUAL'){var _0x48e96d={};_0x48e96d[_0x8d6d94[_0x9a8d('0x31')]]={'$like':'%'+_0x55e93c[_0x9a8d('0x3a')][_0x9a8d('0x45')]+'%'};return _0x48e96d;}})});}_0x48d2b8=_['merge']({},_0x48d2b8,_0x55e93c[_0x9a8d('0x47')]);var _0x3e768d={'where':_0x48d2b8[_0x9a8d('0x42')]};return db[_0x9a8d('0x48')][_0x9a8d('0x22')](_0x3e768d)[_0x9a8d('0x2a')](function(_0x1745ab){_0x17b5b6[_0x9a8d('0x22')]=_0x1745ab;if(_0x55e93c[_0x9a8d('0x3a')][_0x9a8d('0x49')]){_0x48d2b8[_0x9a8d('0x4a')]=[{'all':!![]}];}return db[_0x9a8d('0x48')][_0x9a8d('0x4b')](_0x48d2b8);})[_0x9a8d('0x2a')](function(_0x16241c){_0x17b5b6[_0x9a8d('0x4c')]=_0x16241c;return _0x17b5b6;})[_0x9a8d('0x2a')](respondWithFilteredResult(_0x15056c,_0x48d2b8))[_0x9a8d('0x4d')](handleError(_0x15056c,null));};exports['show']=function(_0x1fdc6f,_0x16c6e7){var _0x55ee81={'raw':!![],'where':{'id':_0x1fdc6f['params']['id']}},_0x4ce3b6={};_0x4ce3b6[_0x9a8d('0x39')]=_[_0x9a8d('0x3b')](db[_0x9a8d('0x48')][_0x9a8d('0x35')]);_0x4ce3b6[_0x9a8d('0x3a')]=_[_0x9a8d('0x3b')](_0x1fdc6f['query']);_0x4ce3b6['filters']=_[_0x9a8d('0x3c')](_0x4ce3b6[_0x9a8d('0x39')],_0x4ce3b6['query']);_0x55ee81[_0x9a8d('0x3d')]=_['intersection'](_0x4ce3b6['model'],qs[_0x9a8d('0x3e')](_0x1fdc6f[_0x9a8d('0x3a')][_0x9a8d('0x3e')]));_0x55ee81[_0x9a8d('0x3d')]=_0x55ee81[_0x9a8d('0x3d')][_0x9a8d('0x3f')]?_0x55ee81[_0x9a8d('0x3d')]:_0x4ce3b6[_0x9a8d('0x39')];if(_0x1fdc6f['query'][_0x9a8d('0x49')]){_0x55ee81[_0x9a8d('0x4a')]=[{'all':!![]}];}_0x55ee81=_['merge']({},_0x55ee81,_0x1fdc6f['options']);return db[_0x9a8d('0x48')]['find'](_0x55ee81)[_0x9a8d('0x2a')](handleEntityNotFound(_0x16c6e7,null))[_0x9a8d('0x2a')](respondWithResult(_0x16c6e7,null))[_0x9a8d('0x4d')](handleError(_0x16c6e7,null));};exports[_0x9a8d('0x4e')]=function(_0x3c627a,_0x4b39b5){return db[_0x9a8d('0x48')][_0x9a8d('0x4e')](_0x3c627a[_0x9a8d('0x4f')],{})['then'](function(_0x5f009f){var _0x511045=_0x3c627a[_0x9a8d('0x50')]['get']({'plain':!![]});if(!_0x511045)throw new Error(_0x9a8d('0x51'));if(_0x511045[_0x9a8d('0x52')]===_0x9a8d('0x50')){var _0x1c3359=_0x5f009f[_0x9a8d('0x2c')]({'plain':!![]});var _0x438f94=_0x9a8d('0x2d');return db[_0x9a8d('0x53')][_0x9a8d('0x54')]({'where':{'name':_0x438f94,'userProfileId':_0x511045[_0x9a8d('0x55')]},'raw':!![]})[_0x9a8d('0x2a')](function(_0x527663){if(_0x527663&&_0x527663['autoAssociation']===0x0){return db[_0x9a8d('0x2e')]['create']({'name':_0x1c3359[_0x9a8d('0x31')],'resourceId':_0x1c3359['id'],'type':_0x527663[_0x9a8d('0x31')],'sectionId':_0x527663['id']},{})[_0x9a8d('0x2a')](function(){return _0x5f009f;});}else{return _0x5f009f;}})[_0x9a8d('0x4d')](function(_0x4e59c0){logger[_0x9a8d('0x2f')](_0x9a8d('0x56'),_0x4e59c0);throw _0x4e59c0;});}return _0x5f009f;})['then'](respondWithResult(_0x4b39b5,0xc9))['catch'](handleError(_0x4b39b5,null));};exports['update']=function(_0xc905ee,_0x517754){if(_0xc905ee[_0x9a8d('0x4f')]['id']){delete _0xc905ee[_0x9a8d('0x4f')]['id'];}return db[_0x9a8d('0x48')][_0x9a8d('0x54')]({'where':{'id':_0xc905ee['params']['id']}})['then'](handleEntityNotFound(_0x517754,null))[_0x9a8d('0x2a')](saveUpdates(_0xc905ee['body'],null))[_0x9a8d('0x2a')](respondWithResult(_0x517754,null))[_0x9a8d('0x4d')](handleError(_0x517754,null));};exports[_0x9a8d('0x2b')]=function(_0x4b80c2,_0x192651){return db[_0x9a8d('0x48')][_0x9a8d('0x54')]({'where':{'id':_0x4b80c2[_0x9a8d('0x57')]['id']}})[_0x9a8d('0x2a')](handleEntityNotFound(_0x192651,null))[_0x9a8d('0x2a')](removeEntity(_0x192651,null))[_0x9a8d('0x4d')](handleError(_0x192651,null));};exports['describe']=function(_0x108910,_0x24369c){return db[_0x9a8d('0x48')][_0x9a8d('0x58')]()[_0x9a8d('0x2a')](respondWithResult(_0x24369c,null))[_0x9a8d('0x4d')](handleError(_0x24369c,null));};exports[_0x9a8d('0x59')]=function(_0x4093b4,_0x35adab,_0x2a9b3f){var _0x1339de={'raw':!![],'where':{}},_0x538682={},_0x1ee8e7;return db[_0x9a8d('0x48')][_0x9a8d('0x5a')]({'where':{'id':_0x4093b4[_0x9a8d('0x57')]['id']}})[_0x9a8d('0x2a')](handleEntityNotFound(_0x35adab,null))[_0x9a8d('0x2a')](function(_0x4e4842){if(_0x4e4842){_0x1ee8e7=_0x4e4842['get']({'plain':!![]});_0x538682[_0x9a8d('0x39')]=_[_0x9a8d('0x3b')](db[_0x9a8d('0x5b')][_0x9a8d('0x35')]);_0x538682[_0x9a8d('0x3a')]=_[_0x9a8d('0x3b')](_0x4093b4['query']);_0x538682[_0x9a8d('0x43')]=_[_0x9a8d('0x3c')](_0x538682['model'],_0x538682['query']);_0x1339de[_0x9a8d('0x3d')]=_[_0x9a8d('0x3c')](_0x538682[_0x9a8d('0x39')],qs[_0x9a8d('0x3e')](_0x4093b4[_0x9a8d('0x3a')][_0x9a8d('0x3e')]));_0x1339de['attributes']=_0x1339de[_0x9a8d('0x3d')][_0x9a8d('0x3f')]?_0x1339de[_0x9a8d('0x3d')]:_0x538682[_0x9a8d('0x39')];if(!_0x4093b4[_0x9a8d('0x3a')]['hasOwnProperty'](_0x9a8d('0x40'))){_0x1339de[_0x9a8d('0x24')]=qs[_0x9a8d('0x24')](_0x4093b4[_0x9a8d('0x3a')]['limit']);_0x1339de['offset']=qs[_0x9a8d('0x23')](_0x4093b4[_0x9a8d('0x3a')][_0x9a8d('0x23')]);}_0x1339de[_0x9a8d('0x5c')]=qs[_0x9a8d('0x41')](_0x4093b4[_0x9a8d('0x3a')][_0x9a8d('0x41')]);_0x1339de[_0x9a8d('0x42')]=qs[_0x9a8d('0x43')](_[_0x9a8d('0x44')](_0x4093b4[_0x9a8d('0x3a')],_0x538682[_0x9a8d('0x43')]));_0x1339de[_0x9a8d('0x42')][_0x9a8d('0x5d')]=_0x4e4842['id'];if(_0x4093b4[_0x9a8d('0x3a')]['filter']){_0x1339de[_0x9a8d('0x42')]=_['merge'](_0x1339de[_0x9a8d('0x42')],{'$or':_['map'](_0x1339de[_0x9a8d('0x3d')],function(_0x1f0f14){var _0x502f3e={};_0x502f3e[_0x1f0f14]={'$like':'%'+_0x4093b4[_0x9a8d('0x3a')][_0x9a8d('0x45')]+'%'};return _0x502f3e;})});}_0x1339de=_[_0x9a8d('0x46')]({},_0x1339de,_0x4093b4[_0x9a8d('0x47')]);return db['UserFaxQueue'][_0x9a8d('0x4b')](_0x1339de);}})[_0x9a8d('0x2a')](function(_0x4b4a8b){if(_0x4b4a8b){return db[_0x9a8d('0x5e')][_0x9a8d('0x5f')]({'where':{'id':_[_0x9a8d('0x34')](_0x4b4a8b,_0x9a8d('0x60')),'role':_0x9a8d('0x61')},'attributes':['id',_0x9a8d('0x31'),'faxPause','updatedAt',_0x9a8d('0x62')]});}})[_0x9a8d('0x2a')](function(_0x229e1a){if(_0x229e1a){return{'count':_0x229e1a[_0x9a8d('0x22')],'rows':_[_0x9a8d('0x34')](_0x229e1a[_0x9a8d('0x4c')],function(_0x4f16e5){return{'membername':_0x4f16e5[_0x9a8d('0x31')],'UserId':_0x4f16e5['id'],'queue_name':_0x1ee8e7[_0x9a8d('0x31')],'FaxQueueId':_0x1ee8e7['id'],'interface':util[_0x9a8d('0x63')](_0x9a8d('0x64'),_0x9a8d('0x65'),_0x4f16e5[_0x9a8d('0x31')]),'penalty':0x0,'paused':_0x4f16e5['faxPause'],'createdAt':_0x4f16e5[_0x9a8d('0x62')],'updatedAt':_0x4f16e5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9a8d('0x2a')](respondWithFilteredResult(_0x35adab,_0x1339de))[_0x9a8d('0x4d')](handleError(_0x35adab,null));};exports[_0x9a8d('0x66')]=function(_0x133509,_0x4c3803,_0x4dc6f5){var _0x2bda91={};var _0x333a3d={};var _0x1443b8;var _0x3bfb12;return db[_0x9a8d('0x48')][_0x9a8d('0x5a')]({'where':{'id':_0x133509['params']['id']}})[_0x9a8d('0x2a')](handleEntityNotFound(_0x4c3803,null))['then'](function(_0x331fc7){if(_0x331fc7){_0x1443b8=_0x331fc7;_0x333a3d[_0x9a8d('0x39')]=_['keys'](db[_0x9a8d('0x67')][_0x9a8d('0x35')]);_0x333a3d[_0x9a8d('0x3a')]=_[_0x9a8d('0x3b')](_0x133509['query']);_0x333a3d[_0x9a8d('0x43')]=_[_0x9a8d('0x3c')](_0x333a3d[_0x9a8d('0x39')],_0x333a3d['query']);_0x2bda91[_0x9a8d('0x3d')]=_[_0x9a8d('0x3c')](_0x333a3d[_0x9a8d('0x39')],qs[_0x9a8d('0x3e')](_0x133509[_0x9a8d('0x3a')][_0x9a8d('0x3e')]));_0x2bda91[_0x9a8d('0x3d')]=_0x2bda91[_0x9a8d('0x3d')]['length']?_0x2bda91[_0x9a8d('0x3d')]:_0x333a3d[_0x9a8d('0x39')];_0x2bda91[_0x9a8d('0x5c')]=qs[_0x9a8d('0x41')](_0x133509[_0x9a8d('0x3a')]['sort']);_0x2bda91[_0x9a8d('0x42')]=qs[_0x9a8d('0x43')](_[_0x9a8d('0x44')](_0x133509[_0x9a8d('0x3a')],_0x333a3d['filters']));if(_0x133509[_0x9a8d('0x3a')][_0x9a8d('0x45')]){_0x2bda91[_0x9a8d('0x42')]=_['merge'](_0x2bda91[_0x9a8d('0x42')],{'$or':_[_0x9a8d('0x34')](_0x2bda91[_0x9a8d('0x3d')],function(_0x3a661e){var _0x9f582a={};_0x9f582a[_0x3a661e]={'$like':'%'+_0x133509[_0x9a8d('0x3a')][_0x9a8d('0x45')]+'%'};return _0x9f582a;})});}_0x2bda91=_['merge']({},_0x2bda91,_0x133509[_0x9a8d('0x47')]);return _0x1443b8[_0x9a8d('0x66')](_0x2bda91);}})[_0x9a8d('0x2a')](function(_0x2f6da9){if(_0x2f6da9){_0x3bfb12=_0x2f6da9['length'];if(!_0x133509[_0x9a8d('0x3a')][_0x9a8d('0x68')]('nolimit')){_0x2bda91['limit']=qs['limit'](_0x133509[_0x9a8d('0x3a')][_0x9a8d('0x24')]);_0x2bda91[_0x9a8d('0x23')]=qs[_0x9a8d('0x23')](_0x133509[_0x9a8d('0x3a')][_0x9a8d('0x23')]);}return _0x1443b8[_0x9a8d('0x66')](_0x2bda91);}})[_0x9a8d('0x2a')](function(_0xcb65b6){if(_0xcb65b6){return _0xcb65b6?{'count':_0x3bfb12,'rows':_0xcb65b6}:null;}})[_0x9a8d('0x2a')](respondWithResult(_0x4c3803,null))['catch'](handleError(_0x4c3803,null));};exports[_0x9a8d('0x69')]=function(_0x4c79a1,_0x18c938,_0x72b73b){var _0x47c95b=_0x4c79a1['body']['ids'];return db['Team'][_0x9a8d('0x4b')]({'where':{'id':_0x47c95b},'attributes':['id'],'include':[{'model':db[_0x9a8d('0x5e')],'as':_0x9a8d('0x6a'),'attributes':['id',_0x9a8d('0x31'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x4ff71a){if(_0x4ff71a){var _0x264a31=_[_0x9a8d('0x6b')](_0x4ff71a,function(_0x324802){var _0x372821=_0x324802['get']({'plain':!![]});return _0x372821['Agents'];});return db[_0x9a8d('0x48')][_0x9a8d('0x54')]({'where':{'id':_0x4c79a1[_0x9a8d('0x57')]['id']}})[_0x9a8d('0x2a')](function(_0x38eed3){return db['sequelize'][_0x9a8d('0x6c')](function(_0x2739f8){return _0x38eed3[_0x9a8d('0x69')](_0x47c95b,{'transaction':_0x2739f8})[_0x9a8d('0x2a')](function(){return BPromise[_0x9a8d('0x6d')](_0x264a31,function(_0x29f1af){return db[_0x9a8d('0x5b')][_0x9a8d('0x6e')]({'where':{'UserId':_0x29f1af['id'],'FaxQueueId':_0x4c79a1[_0x9a8d('0x57')]['id']},'transaction':_0x2739f8});});})[_0x9a8d('0x2a')](function(){_0x264a31['forEach'](function(_0x5ddbee){socket['emit'](_0x9a8d('0x6f'),{'UserId':_0x5ddbee['id'],'FaxQueueId':_0x38eed3['id']});});});});});}})[_0x9a8d('0x2a')](respondWithStatusCode(_0x18c938,null))[_0x9a8d('0x4d')](handleError(_0x18c938,null));};exports[_0x9a8d('0x70')]=function(_0x36f81d,_0x277a5d,_0x3e63ca){return db[_0x9a8d('0x67')][_0x9a8d('0x4b')]({'where':{'id':_0x36f81d[_0x9a8d('0x3a')][_0x9a8d('0x71')]},'attributes':['id'],'include':[{'model':db[_0x9a8d('0x5e')],'as':_0x9a8d('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x277a5d,null))[_0x9a8d('0x2a')](function(_0x5f2f88){var _0x1ed1e7=_['map'](_0x5f2f88,'id');var _0xab4e1=[];var _0x226596=[];var _0x6f84ea=squel[_0x9a8d('0x72')]();_0x6f84ea['field'](_0x9a8d('0x73'))[_0x9a8d('0x74')](_0x9a8d('0x75'),'tq')[_0x9a8d('0x76')](_0x9a8d('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9a8d('0x42')](_0x9a8d('0x78'),_0x36f81d['params']['id']);for(var _0x3d12de=0x0;_0x3d12de<_0x5f2f88[_0x9a8d('0x3f')];_0x3d12de+=0x1){let _0x8fc80c=_0x5f2f88[_0x3d12de];for(var _0x41329e=0x0;_0x41329e<_0x8fc80c[_0x9a8d('0x6a')][_0x9a8d('0x3f')];_0x41329e+=0x1){let _0x4b7ea8=_0x8fc80c[_0x9a8d('0x6a')][_0x41329e];var _0x4d4a0e=_0x6f84ea['clone']();_0x4d4a0e[_0x9a8d('0x42')](_0x9a8d('0x79'),_0x4b7ea8['id']);_0x226596['push'](db[_0x9a8d('0x7a')][_0x9a8d('0x3a')](_0x4d4a0e['toString'](),{'type':db[_0x9a8d('0x7a')]['QueryTypes']['SELECT']})[_0x9a8d('0x2a')](function(_0x2a1ab8){if(_0x2a1ab8['length']===0x1){return _0x4b7ea8['id'];}else{var _0x18a2df=_[_0x9a8d('0x7b')](_[_0x9a8d('0x34')](_0x2a1ab8,_0x9a8d('0x7c')),function(_0x14c9ab){return _['includes'](_0x1ed1e7,_0x14c9ab);});if(_0x18a2df){return _0x4b7ea8['id'];}}}));}}return BPromise[_0x9a8d('0x7d')](_0x226596)[_0x9a8d('0x2a')](function(_0x2ddb4a){_0xab4e1=_(_0xab4e1)['union'](_0x2ddb4a)[_0x9a8d('0x7e')]()[_0x9a8d('0x7f')]();return db['FaxQueue'][_0x9a8d('0x54')]({'where':{'id':_0x36f81d[_0x9a8d('0x57')]['id']}})[_0x9a8d('0x2a')](function(_0x2d78a6){return db[_0x9a8d('0x7a')]['transaction'](function(_0x40a5ea){return _0x2d78a6[_0x9a8d('0x70')](_0x36f81d[_0x9a8d('0x3a')]['ids'],{'transaction':_0x40a5ea})[_0x9a8d('0x2a')](function(){if(!_[_0x9a8d('0x80')](_0xab4e1)){return _0x2d78a6['removeAgents'](_0xab4e1,{'transaction':_0x40a5ea});}})[_0x9a8d('0x2a')](function(){_0xab4e1[_0x9a8d('0x81')](function(_0x50e7a7){socket[_0x9a8d('0x82')](_0x9a8d('0x83'),{'UserId':_0x50e7a7,'FaxQueueId':_0x2d78a6['id']});});});});});});})[_0x9a8d('0x2a')](respondWithStatusCode(_0x277a5d,null))['catch'](handleError(_0x277a5d,null));};exports[_0x9a8d('0x84')]=function(_0x3de695,_0x203337,_0x2b9744){return db[_0x9a8d('0x48')][_0x9a8d('0x54')]({'where':{'id':_0x3de695[_0x9a8d('0x57')]['id']}})[_0x9a8d('0x2a')](handleEntityNotFound(_0x203337,null))[_0x9a8d('0x2a')](function(_0x38dce1){if(_0x38dce1){return _0x38dce1[_0x9a8d('0x84')](_0x3de695['body']['ids'],_[_0x9a8d('0x85')](_0x3de695[_0x9a8d('0x4f')],[_0x9a8d('0x71'),'id'])||{})['spread'](function(_0x3efa67){for(var _0x26a0c4=0x0;_0x26a0c4<_0x3de695['body'][_0x9a8d('0x71')][_0x9a8d('0x3f')];_0x26a0c4+=0x1){socket['emit'](_0x9a8d('0x6f'),{'UserId':_0x3de695[_0x9a8d('0x4f')]['ids'][_0x26a0c4],'FaxQueueId':_0x3de695[_0x9a8d('0x57')]['id']});}return _0x3efa67;});}})[_0x9a8d('0x2a')](respondWithResult(_0x203337,null))[_0x9a8d('0x4d')](handleError(_0x203337,null));};exports[_0x9a8d('0x86')]=function(_0x1d7b4a,_0x16f010,_0x2961ce){return db[_0x9a8d('0x48')][_0x9a8d('0x54')]({'where':{'id':_0x1d7b4a[_0x9a8d('0x57')]['id']}})['then'](handleEntityNotFound(_0x16f010,null))[_0x9a8d('0x2a')](function(_0x127e03){if(_0x127e03){return _0x127e03[_0x9a8d('0x86')](_0x1d7b4a[_0x9a8d('0x3a')][_0x9a8d('0x71')])['then'](function(){if(_[_0x9a8d('0x87')](_0x1d7b4a['query'][_0x9a8d('0x71')])){for(var _0x31f79c=0x0;_0x31f79c<_0x1d7b4a[_0x9a8d('0x3a')][_0x9a8d('0x71')][_0x9a8d('0x3f')];_0x31f79c+=0x1){socket[_0x9a8d('0x82')](_0x9a8d('0x83'),{'UserId':Number(_0x1d7b4a[_0x9a8d('0x3a')][_0x9a8d('0x71')][_0x31f79c]),'FaxQueueId':Number(_0x1d7b4a[_0x9a8d('0x57')]['id'])});}}else{socket[_0x9a8d('0x82')](_0x9a8d('0x83'),{'UserId':Number(_0x1d7b4a[_0x9a8d('0x3a')][_0x9a8d('0x71')]),'FaxQueueId':Number(_0x1d7b4a[_0x9a8d('0x57')]['id'])});}});}})[_0x9a8d('0x2a')](respondWithStatusCode(_0x16f010,null))[_0x9a8d('0x4d')](handleError(_0x16f010,null));};exports[_0x9a8d('0x88')]=function(_0x51cf0f,_0x1341fd,_0x1d9fea){var _0x4dfcbc={};var _0x25adb1={};var _0x5417bc;var _0x10564d;return db[_0x9a8d('0x48')][_0x9a8d('0x5a')]({'where':{'id':_0x51cf0f[_0x9a8d('0x57')]['id']}})[_0x9a8d('0x2a')](handleEntityNotFound(_0x1341fd,null))[_0x9a8d('0x2a')](function(_0xe6573b){if(_0xe6573b){_0x5417bc=_0xe6573b;_0x25adb1['model']=_[_0x9a8d('0x3b')](db[_0x9a8d('0x5e')][_0x9a8d('0x35')]);_0x25adb1[_0x9a8d('0x3a')]=_[_0x9a8d('0x3b')](_0x51cf0f['query']);_0x25adb1[_0x9a8d('0x43')]=_[_0x9a8d('0x3c')](_0x25adb1[_0x9a8d('0x39')],_0x25adb1[_0x9a8d('0x3a')]);_0x4dfcbc[_0x9a8d('0x3d')]=_[_0x9a8d('0x3c')](_0x25adb1[_0x9a8d('0x39')],qs[_0x9a8d('0x3e')](_0x51cf0f[_0x9a8d('0x3a')][_0x9a8d('0x3e')]));_0x4dfcbc[_0x9a8d('0x3d')]=_0x4dfcbc[_0x9a8d('0x3d')][_0x9a8d('0x3f')]?_0x4dfcbc[_0x9a8d('0x3d')]:_0x25adb1[_0x9a8d('0x39')];_0x4dfcbc[_0x9a8d('0x5c')]=qs['sort'](_0x51cf0f[_0x9a8d('0x3a')][_0x9a8d('0x41')]);_0x4dfcbc[_0x9a8d('0x42')]=qs[_0x9a8d('0x43')](_['pick'](_0x51cf0f['query'],_0x25adb1[_0x9a8d('0x43')]));if(_0x51cf0f[_0x9a8d('0x3a')][_0x9a8d('0x45')]){_0x4dfcbc[_0x9a8d('0x42')]=_[_0x9a8d('0x46')](_0x4dfcbc[_0x9a8d('0x42')],{'$or':_[_0x9a8d('0x34')](_0x4dfcbc[_0x9a8d('0x3d')],function(_0x5c48c4){var _0x539ee1={};_0x539ee1[_0x5c48c4]={'$like':'%'+_0x51cf0f['query']['filter']+'%'};return _0x539ee1;})});}_0x4dfcbc=_['merge']({},_0x4dfcbc,_0x51cf0f[_0x9a8d('0x47')]);return _0x5417bc['getAgents'](_0x4dfcbc);}})[_0x9a8d('0x2a')](function(_0x21eb30){if(_0x21eb30){_0x10564d=_0x21eb30[_0x9a8d('0x3f')];if(!_0x51cf0f[_0x9a8d('0x3a')][_0x9a8d('0x68')](_0x9a8d('0x40'))){_0x4dfcbc[_0x9a8d('0x24')]=qs[_0x9a8d('0x24')](_0x51cf0f[_0x9a8d('0x3a')][_0x9a8d('0x24')]);_0x4dfcbc[_0x9a8d('0x23')]=qs['offset'](_0x51cf0f[_0x9a8d('0x3a')][_0x9a8d('0x23')]);}return _0x5417bc[_0x9a8d('0x88')](_0x4dfcbc);}})[_0x9a8d('0x2a')](function(_0xea03ee){if(_0xea03ee){return _0xea03ee?{'count':_0x10564d,'rows':_0xea03ee}:null;}})[_0x9a8d('0x2a')](respondWithResult(_0x1341fd,null))['catch'](handleError(_0x1341fd,null));}; \ No newline at end of file +var _0xf567=['spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','error','name','map','FaxQueue','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','fields','include','find','create','body','user','role','get','FaxQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','length','order','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','includes','all','union','value','isEmpty','userFaxQueue:remove','addAgents'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xf567,0x118));var _0x7f56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf567[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x7f56('0x0'));var emlformat=require(_0x7f56('0x1'));var rimraf=require(_0x7f56('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f56('0x3'));var rp=require(_0x7f56('0x4'));var moment=require('moment');var BPromise=require(_0x7f56('0x5'));var Mustache=require(_0x7f56('0x6'));var util=require(_0x7f56('0x7'));var path=require(_0x7f56('0x8'));var sox=require('sox');var csv=require(_0x7f56('0x9'));var ejs=require(_0x7f56('0xa'));var fs=require('fs');var _=require(_0x7f56('0xb'));var squel=require('squel');var crypto=require(_0x7f56('0xc'));var jsforce=require(_0x7f56('0xd'));var deskjs=require(_0x7f56('0xe'));var toCsv=require(_0x7f56('0x9'));var querystring=require(_0x7f56('0xf'));var Papa=require(_0x7f56('0x10'));var Redis=require(_0x7f56('0x11'));var authService=require(_0x7f56('0x12'));var qs=require(_0x7f56('0x13'));var as=require(_0x7f56('0x14'));var hardwareService=require(_0x7f56('0x15'));var logger=require(_0x7f56('0x16'))(_0x7f56('0x17'));var utils=require(_0x7f56('0x18'));var config=require(_0x7f56('0x19'));var db=require(_0x7f56('0x1a'))['db'];config[_0x7f56('0x1b')]=_[_0x7f56('0x1c')](config[_0x7f56('0x1b')],{'host':_0x7f56('0x1d'),'port':0x18eb});var socket=require(_0x7f56('0x1e'))(new Redis(config[_0x7f56('0x1b')]));require('./faxQueue.socket')[_0x7f56('0x1f')](socket);function respondWithStatusCode(_0x32119f,_0x11d663){_0x11d663=_0x11d663||0xcc;return function(_0x53befd){if(_0x53befd){return _0x32119f[_0x7f56('0x20')](_0x11d663);}return _0x32119f[_0x7f56('0x21')](_0x11d663)['end']();};}function respondWithResult(_0x5f9e3c,_0x441459){_0x441459=_0x441459||0xc8;return function(_0x4ad41a){if(_0x4ad41a){return _0x5f9e3c['status'](_0x441459)[_0x7f56('0x22')](_0x4ad41a);}};}function respondWithFilteredResult(_0x4bc6cb,_0x415b6f){return function(_0x2a2d7b){if(_0x2a2d7b){var _0x5201eb=_0x2a2d7b[_0x7f56('0x23')],_0xc4d664=_0x415b6f[_0x7f56('0x24')],_0x3779a9=_0x415b6f[_0x7f56('0x24')]+_0x415b6f['limit'],_0x350c7a;if(_0x3779a9>=_0x5201eb){_0x3779a9=_0x5201eb;_0x350c7a=0xc8;}else{_0x350c7a=0xce;}_0x4bc6cb[_0x7f56('0x21')](_0x350c7a);return _0x4bc6cb['set'](_0x7f56('0x25'),_0xc4d664+'-'+_0x3779a9+'/'+_0x5201eb)['json'](_0x2a2d7b);}return null;};}function patchUpdates(_0x38e7d5){return function(_0x36407f){try{jsonpatch[_0x7f56('0x26')](_0x36407f,_0x38e7d5,!![]);}catch(_0x2cc4f1){return BPromise[_0x7f56('0x27')](_0x2cc4f1);}return _0x36407f[_0x7f56('0x28')]();};}function saveUpdates(_0x9b7f15,_0x3f54f8){return function(_0x879e3a){if(_0x879e3a){return _0x879e3a[_0x7f56('0x29')](_0x9b7f15)['then'](function(_0x19bc9f){return _0x19bc9f;});}return null;};}function removeEntity(_0xe8f270,_0x2943fe){return function(_0x3c8658){if(_0x3c8658){return _0x3c8658[_0x7f56('0x2a')]()[_0x7f56('0x2b')](function(){var _0x100ea7=_0x3c8658['get']({'plain':!![]});var _0x4a20d5='FaxQueues';return db[_0x7f56('0x2c')]['destroy']({'where':{'type':_0x4a20d5,'resourceId':_0x100ea7['id']}})[_0x7f56('0x2b')](function(){return _0x3c8658;});})[_0x7f56('0x2b')](function(){_0xe8f270[_0x7f56('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x236120,_0x3d0faa){return function(_0x3dbb41){if(!_0x3dbb41){_0x236120[_0x7f56('0x20')](0x194);}return _0x3dbb41;};}function handleError(_0x5ea887,_0x3d3095){_0x3d3095=_0x3d3095||0x1f4;return function(_0x35d40b){logger[_0x7f56('0x2d')](_0x35d40b['stack']);if(_0x35d40b[_0x7f56('0x2e')]){delete _0x35d40b[_0x7f56('0x2e')];}_0x5ea887['status'](_0x3d3095)['send'](_0x35d40b);};}exports['index']=function(_0x2849f8,_0x47e4ce){var _0x4d92c0={},_0x25bd28={},_0x56a70b={'count':0x0,'rows':[]};var _0x290739=_[_0x7f56('0x2f')](db[_0x7f56('0x30')]['rawAttributes'],function(_0x134cfb){return{'name':_0x134cfb[_0x7f56('0x31')],'type':_0x134cfb[_0x7f56('0x32')]['key']};});_0x25bd28[_0x7f56('0x33')]=_[_0x7f56('0x2f')](_0x290739,_0x7f56('0x2e'));_0x25bd28[_0x7f56('0x34')]=_[_0x7f56('0x35')](_0x2849f8[_0x7f56('0x34')]);_0x25bd28[_0x7f56('0x36')]=_[_0x7f56('0x37')](_0x25bd28[_0x7f56('0x33')],_0x25bd28[_0x7f56('0x34')]);_0x4d92c0[_0x7f56('0x38')]=_[_0x7f56('0x37')](_0x25bd28['model'],qs['fields'](_0x2849f8[_0x7f56('0x34')]['fields']));_0x4d92c0[_0x7f56('0x38')]=_0x4d92c0[_0x7f56('0x38')]['length']?_0x4d92c0[_0x7f56('0x38')]:_0x25bd28[_0x7f56('0x33')];if(!_0x2849f8['query'][_0x7f56('0x39')](_0x7f56('0x3a'))){_0x4d92c0['limit']=qs[_0x7f56('0x3b')](_0x2849f8[_0x7f56('0x34')][_0x7f56('0x3b')]);_0x4d92c0['offset']=qs[_0x7f56('0x24')](_0x2849f8['query'][_0x7f56('0x24')]);}_0x4d92c0['order']=qs[_0x7f56('0x3c')](_0x2849f8[_0x7f56('0x34')]['sort']);_0x4d92c0['where']=qs['filters'](_[_0x7f56('0x3d')](_0x2849f8[_0x7f56('0x34')],_0x25bd28['filters']),_0x290739);if(_0x2849f8[_0x7f56('0x34')][_0x7f56('0x3e')]){_0x4d92c0[_0x7f56('0x3f')]=_[_0x7f56('0x40')](_0x4d92c0[_0x7f56('0x3f')],{'$or':_[_0x7f56('0x2f')](_0x290739,function(_0x39c017){if(_0x39c017[_0x7f56('0x32')]!==_0x7f56('0x41')){var _0x21897f={};_0x21897f[_0x39c017[_0x7f56('0x2e')]]={'$like':'%'+_0x2849f8[_0x7f56('0x34')][_0x7f56('0x3e')]+'%'};return _0x21897f;}})});}_0x4d92c0=_[_0x7f56('0x40')]({},_0x4d92c0,_0x2849f8[_0x7f56('0x42')]);var _0xa7e287={'where':_0x4d92c0[_0x7f56('0x3f')]};return db[_0x7f56('0x30')][_0x7f56('0x23')](_0xa7e287)[_0x7f56('0x2b')](function(_0x3337f2){_0x56a70b[_0x7f56('0x23')]=_0x3337f2;if(_0x2849f8['query'][_0x7f56('0x43')]){_0x4d92c0['include']=[{'all':!![]}];}return db['FaxQueue'][_0x7f56('0x44')](_0x4d92c0);})[_0x7f56('0x2b')](function(_0x1f0d55){_0x56a70b[_0x7f56('0x45')]=_0x1f0d55;return _0x56a70b;})[_0x7f56('0x2b')](respondWithFilteredResult(_0x47e4ce,_0x4d92c0))[_0x7f56('0x46')](handleError(_0x47e4ce,null));};exports['show']=function(_0x3725e6,_0x2d0756){var _0x4a4767={'raw':!![],'where':{'id':_0x3725e6[_0x7f56('0x47')]['id']}},_0x43591e={};_0x43591e[_0x7f56('0x33')]=_[_0x7f56('0x35')](db[_0x7f56('0x30')][_0x7f56('0x48')]);_0x43591e[_0x7f56('0x34')]=_[_0x7f56('0x35')](_0x3725e6[_0x7f56('0x34')]);_0x43591e[_0x7f56('0x36')]=_[_0x7f56('0x37')](_0x43591e['model'],_0x43591e['query']);_0x4a4767[_0x7f56('0x38')]=_[_0x7f56('0x37')](_0x43591e['model'],qs[_0x7f56('0x49')](_0x3725e6['query'][_0x7f56('0x49')]));_0x4a4767[_0x7f56('0x38')]=_0x4a4767[_0x7f56('0x38')]['length']?_0x4a4767[_0x7f56('0x38')]:_0x43591e['model'];if(_0x3725e6['query'][_0x7f56('0x43')]){_0x4a4767[_0x7f56('0x4a')]=[{'all':!![]}];}_0x4a4767=_['merge']({},_0x4a4767,_0x3725e6[_0x7f56('0x42')]);return db['FaxQueue'][_0x7f56('0x4b')](_0x4a4767)[_0x7f56('0x2b')](handleEntityNotFound(_0x2d0756,null))[_0x7f56('0x2b')](respondWithResult(_0x2d0756,null))[_0x7f56('0x46')](handleError(_0x2d0756,null));};exports['create']=function(_0x25704f,_0xaff68e){return db[_0x7f56('0x30')][_0x7f56('0x4c')](_0x25704f[_0x7f56('0x4d')],{})[_0x7f56('0x2b')](function(_0x3abdd3){var _0x21ed5c=_0x25704f[_0x7f56('0x4e')]['get']({'plain':!![]});if(!_0x21ed5c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ed5c[_0x7f56('0x4f')]==='user'){var _0x1b2bfb=_0x3abdd3[_0x7f56('0x50')]({'plain':!![]});var _0x4fe12d=_0x7f56('0x51');return db[_0x7f56('0x52')]['find']({'where':{'name':_0x4fe12d,'userProfileId':_0x21ed5c[_0x7f56('0x53')]},'raw':!![]})[_0x7f56('0x2b')](function(_0x145238){if(_0x145238&&_0x145238['autoAssociation']===0x0){return db[_0x7f56('0x2c')][_0x7f56('0x4c')]({'name':_0x1b2bfb[_0x7f56('0x2e')],'resourceId':_0x1b2bfb['id'],'type':_0x145238[_0x7f56('0x2e')],'sectionId':_0x145238['id']},{})['then'](function(){return _0x3abdd3;});}else{return _0x3abdd3;}})[_0x7f56('0x46')](function(_0x47b14a){logger[_0x7f56('0x2d')](_0x7f56('0x54'),_0x47b14a);throw _0x47b14a;});}return _0x3abdd3;})[_0x7f56('0x2b')](respondWithResult(_0xaff68e,0xc9))[_0x7f56('0x46')](handleError(_0xaff68e,null));};exports[_0x7f56('0x29')]=function(_0xf7a451,_0x14acdc){if(_0xf7a451[_0x7f56('0x4d')]['id']){delete _0xf7a451[_0x7f56('0x4d')]['id'];}return db[_0x7f56('0x30')][_0x7f56('0x4b')]({'where':{'id':_0xf7a451[_0x7f56('0x47')]['id']}})[_0x7f56('0x2b')](handleEntityNotFound(_0x14acdc,null))[_0x7f56('0x2b')](saveUpdates(_0xf7a451[_0x7f56('0x4d')],null))[_0x7f56('0x2b')](respondWithResult(_0x14acdc,null))[_0x7f56('0x46')](handleError(_0x14acdc,null));};exports[_0x7f56('0x2a')]=function(_0x487c8e,_0xabe51e){return db[_0x7f56('0x30')]['find']({'where':{'id':_0x487c8e[_0x7f56('0x47')]['id']}})['then'](handleEntityNotFound(_0xabe51e,null))[_0x7f56('0x2b')](removeEntity(_0xabe51e,null))['catch'](handleError(_0xabe51e,null));};exports[_0x7f56('0x55')]=function(_0x4c5a24,_0x36d8a0){return db[_0x7f56('0x30')][_0x7f56('0x55')]()['then'](respondWithResult(_0x36d8a0,null))[_0x7f56('0x46')](handleError(_0x36d8a0,null));};exports[_0x7f56('0x56')]=function(_0x2a58d2,_0x517630,_0x588c){var _0x3be0a1={'raw':!![],'where':{}},_0x1db23a={},_0x61201d;return db[_0x7f56('0x30')][_0x7f56('0x57')]({'where':{'id':_0x2a58d2[_0x7f56('0x47')]['id']}})[_0x7f56('0x2b')](handleEntityNotFound(_0x517630,null))[_0x7f56('0x2b')](function(_0x3d3e48){if(_0x3d3e48){_0x61201d=_0x3d3e48[_0x7f56('0x50')]({'plain':!![]});_0x1db23a[_0x7f56('0x33')]=_[_0x7f56('0x35')](db[_0x7f56('0x58')][_0x7f56('0x48')]);_0x1db23a[_0x7f56('0x34')]=_[_0x7f56('0x35')](_0x2a58d2[_0x7f56('0x34')]);_0x1db23a[_0x7f56('0x36')]=_[_0x7f56('0x37')](_0x1db23a[_0x7f56('0x33')],_0x1db23a[_0x7f56('0x34')]);_0x3be0a1[_0x7f56('0x38')]=_[_0x7f56('0x37')](_0x1db23a[_0x7f56('0x33')],qs[_0x7f56('0x49')](_0x2a58d2['query']['fields']));_0x3be0a1[_0x7f56('0x38')]=_0x3be0a1[_0x7f56('0x38')][_0x7f56('0x59')]?_0x3be0a1[_0x7f56('0x38')]:_0x1db23a[_0x7f56('0x33')];if(!_0x2a58d2[_0x7f56('0x34')][_0x7f56('0x39')](_0x7f56('0x3a'))){_0x3be0a1['limit']=qs[_0x7f56('0x3b')](_0x2a58d2[_0x7f56('0x34')]['limit']);_0x3be0a1[_0x7f56('0x24')]=qs[_0x7f56('0x24')](_0x2a58d2[_0x7f56('0x34')][_0x7f56('0x24')]);}_0x3be0a1[_0x7f56('0x5a')]=qs[_0x7f56('0x3c')](_0x2a58d2[_0x7f56('0x34')][_0x7f56('0x3c')]);_0x3be0a1['where']=qs[_0x7f56('0x36')](_['pick'](_0x2a58d2[_0x7f56('0x34')],_0x1db23a[_0x7f56('0x36')]));_0x3be0a1[_0x7f56('0x3f')][_0x7f56('0x5b')]=_0x3d3e48['id'];if(_0x2a58d2[_0x7f56('0x34')][_0x7f56('0x3e')]){_0x3be0a1['where']=_['merge'](_0x3be0a1[_0x7f56('0x3f')],{'$or':_[_0x7f56('0x2f')](_0x3be0a1[_0x7f56('0x38')],function(_0x55fea9){var _0x5e1334={};_0x5e1334[_0x55fea9]={'$like':'%'+_0x2a58d2['query'][_0x7f56('0x3e')]+'%'};return _0x5e1334;})});}_0x3be0a1=_['merge']({},_0x3be0a1,_0x2a58d2[_0x7f56('0x42')]);return db[_0x7f56('0x58')][_0x7f56('0x44')](_0x3be0a1);}})['then'](function(_0x91b714){if(_0x91b714){return db['User'][_0x7f56('0x5c')]({'where':{'id':_[_0x7f56('0x2f')](_0x91b714,_0x7f56('0x5d')),'role':_0x7f56('0x5e')},'attributes':['id','name',_0x7f56('0x5f'),_0x7f56('0x60'),_0x7f56('0x61')]});}})[_0x7f56('0x2b')](function(_0x480876){if(_0x480876){return{'count':_0x480876[_0x7f56('0x23')],'rows':_[_0x7f56('0x2f')](_0x480876[_0x7f56('0x45')],function(_0x2c8c48){return{'membername':_0x2c8c48[_0x7f56('0x2e')],'UserId':_0x2c8c48['id'],'queue_name':_0x61201d[_0x7f56('0x2e')],'FaxQueueId':_0x61201d['id'],'interface':util[_0x7f56('0x62')]('%s/%s',_0x7f56('0x63'),_0x2c8c48['name']),'penalty':0x0,'paused':_0x2c8c48[_0x7f56('0x5f')],'createdAt':_0x2c8c48[_0x7f56('0x61')],'updatedAt':_0x2c8c48[_0x7f56('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7f56('0x2b')](respondWithFilteredResult(_0x517630,_0x3be0a1))[_0x7f56('0x46')](handleError(_0x517630,null));};exports['getTeams']=function(_0x25297a,_0xe7f022,_0x211d3e){var _0x32bcc3={};var _0xb88bbf={};var _0x402f38;var _0x2e2471;return db[_0x7f56('0x30')]['findOne']({'where':{'id':_0x25297a['params']['id']}})[_0x7f56('0x2b')](handleEntityNotFound(_0xe7f022,null))[_0x7f56('0x2b')](function(_0x465e3f){if(_0x465e3f){_0x402f38=_0x465e3f;_0xb88bbf[_0x7f56('0x33')]=_[_0x7f56('0x35')](db[_0x7f56('0x64')][_0x7f56('0x48')]);_0xb88bbf['query']=_[_0x7f56('0x35')](_0x25297a[_0x7f56('0x34')]);_0xb88bbf['filters']=_[_0x7f56('0x37')](_0xb88bbf[_0x7f56('0x33')],_0xb88bbf['query']);_0x32bcc3[_0x7f56('0x38')]=_[_0x7f56('0x37')](_0xb88bbf[_0x7f56('0x33')],qs[_0x7f56('0x49')](_0x25297a[_0x7f56('0x34')][_0x7f56('0x49')]));_0x32bcc3['attributes']=_0x32bcc3[_0x7f56('0x38')][_0x7f56('0x59')]?_0x32bcc3[_0x7f56('0x38')]:_0xb88bbf['model'];_0x32bcc3[_0x7f56('0x5a')]=qs[_0x7f56('0x3c')](_0x25297a['query'][_0x7f56('0x3c')]);_0x32bcc3['where']=qs[_0x7f56('0x36')](_[_0x7f56('0x3d')](_0x25297a[_0x7f56('0x34')],_0xb88bbf['filters']));if(_0x25297a[_0x7f56('0x34')][_0x7f56('0x3e')]){_0x32bcc3['where']=_[_0x7f56('0x40')](_0x32bcc3[_0x7f56('0x3f')],{'$or':_[_0x7f56('0x2f')](_0x32bcc3[_0x7f56('0x38')],function(_0x37ec62){var _0x84c93c={};_0x84c93c[_0x37ec62]={'$like':'%'+_0x25297a['query'][_0x7f56('0x3e')]+'%'};return _0x84c93c;})});}_0x32bcc3=_[_0x7f56('0x40')]({},_0x32bcc3,_0x25297a[_0x7f56('0x42')]);return _0x402f38[_0x7f56('0x65')](_0x32bcc3);}})[_0x7f56('0x2b')](function(_0x18187a){if(_0x18187a){_0x2e2471=_0x18187a['length'];if(!_0x25297a[_0x7f56('0x34')][_0x7f56('0x39')]('nolimit')){_0x32bcc3[_0x7f56('0x3b')]=qs[_0x7f56('0x3b')](_0x25297a[_0x7f56('0x34')][_0x7f56('0x3b')]);_0x32bcc3[_0x7f56('0x24')]=qs[_0x7f56('0x24')](_0x25297a[_0x7f56('0x34')][_0x7f56('0x24')]);}return _0x402f38[_0x7f56('0x65')](_0x32bcc3);}})['then'](function(_0xf65309){if(_0xf65309){return _0xf65309?{'count':_0x2e2471,'rows':_0xf65309}:null;}})['then'](respondWithResult(_0xe7f022,null))[_0x7f56('0x46')](handleError(_0xe7f022,null));};exports[_0x7f56('0x66')]=function(_0xd4f4ba,_0x40572d,_0x379ef9){var _0x5a200f=_0xd4f4ba[_0x7f56('0x4d')][_0x7f56('0x67')];return db['Team'][_0x7f56('0x44')]({'where':{'id':_0x5a200f},'attributes':['id'],'include':[{'model':db[_0x7f56('0x68')],'as':_0x7f56('0x69'),'attributes':['id','name',_0x7f56('0x6a'),_0x7f56('0x6b'),_0x7f56('0x6c')],'raw':!![]}]})[_0x7f56('0x2b')](function(_0x1febc1){if(_0x1febc1){var _0x5aa159=_['flatMap'](_0x1febc1,function(_0x5165d9){var _0x4c708a=_0x5165d9['get']({'plain':!![]});return _0x4c708a[_0x7f56('0x69')];});return db[_0x7f56('0x30')][_0x7f56('0x4b')]({'where':{'id':_0xd4f4ba[_0x7f56('0x47')]['id']}})['then'](function(_0x13e3ce){return db[_0x7f56('0x6d')][_0x7f56('0x6e')](function(_0x3a9216){return _0x13e3ce[_0x7f56('0x66')](_0x5a200f,{'transaction':_0x3a9216})[_0x7f56('0x2b')](function(){return BPromise[_0x7f56('0x6f')](_0x5aa159,function(_0x436f88){return db[_0x7f56('0x58')]['findOrCreate']({'where':{'UserId':_0x436f88['id'],'FaxQueueId':_0xd4f4ba[_0x7f56('0x47')]['id']},'transaction':_0x3a9216});});})['then'](function(){_0x5aa159[_0x7f56('0x70')](function(_0x46c201){socket[_0x7f56('0x71')](_0x7f56('0x72'),{'UserId':_0x46c201['id'],'FaxQueueId':_0x13e3ce['id']});});});});});}})[_0x7f56('0x2b')](respondWithStatusCode(_0x40572d,null))['catch'](handleError(_0x40572d,null));};exports[_0x7f56('0x73')]=function(_0x4133d6,_0x2f4336,_0x4b769a){return db[_0x7f56('0x64')][_0x7f56('0x44')]({'where':{'id':_0x4133d6[_0x7f56('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7f56('0x68')],'as':_0x7f56('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7f56('0x2b')](handleEntityNotFound(_0x2f4336,null))[_0x7f56('0x2b')](function(_0xd07ceb){var _0x20e3e4=_[_0x7f56('0x2f')](_0xd07ceb,'id');var _0x286daf=[];var _0x2358e0=[];var _0x39576e=squel[_0x7f56('0x74')]();_0x39576e['field'](_0x7f56('0x75'))['from']('team_has_fax_queues','tq')[_0x7f56('0x76')](_0x7f56('0x77'),'ut',_0x7f56('0x78'))[_0x7f56('0x3f')](_0x7f56('0x79'),_0x4133d6[_0x7f56('0x47')]['id']);for(var _0xaf31f5=0x0;_0xaf31f5<_0xd07ceb['length'];_0xaf31f5+=0x1){let _0x284a7f=_0xd07ceb[_0xaf31f5];for(var _0x322099=0x0;_0x322099<_0x284a7f[_0x7f56('0x69')][_0x7f56('0x59')];_0x322099+=0x1){let _0x217d9c=_0x284a7f[_0x7f56('0x69')][_0x322099];var _0x4aa9bf=_0x39576e[_0x7f56('0x7a')]();_0x4aa9bf[_0x7f56('0x3f')](_0x7f56('0x7b'),_0x217d9c['id']);_0x2358e0[_0x7f56('0x7c')](db[_0x7f56('0x6d')][_0x7f56('0x34')](_0x4aa9bf[_0x7f56('0x7d')](),{'type':db[_0x7f56('0x6d')]['QueryTypes'][_0x7f56('0x7e')]})[_0x7f56('0x2b')](function(_0x2eed0a){if(_0x2eed0a[_0x7f56('0x59')]===0x1){return _0x217d9c['id'];}else{var _0x703ca=_['every'](_[_0x7f56('0x2f')](_0x2eed0a,'TeamId'),function(_0x4063a4){return _[_0x7f56('0x7f')](_0x20e3e4,_0x4063a4);});if(_0x703ca){return _0x217d9c['id'];}}}));}}return BPromise[_0x7f56('0x80')](_0x2358e0)[_0x7f56('0x2b')](function(_0xc28e1c){_0x286daf=_(_0x286daf)[_0x7f56('0x81')](_0xc28e1c)['compact']()[_0x7f56('0x82')]();return db['FaxQueue']['find']({'where':{'id':_0x4133d6[_0x7f56('0x47')]['id']}})[_0x7f56('0x2b')](function(_0x95a962){return db['sequelize'][_0x7f56('0x6e')](function(_0x82b63d){return _0x95a962[_0x7f56('0x73')](_0x4133d6[_0x7f56('0x34')][_0x7f56('0x67')],{'transaction':_0x82b63d})['then'](function(){if(!_[_0x7f56('0x83')](_0x286daf)){return _0x95a962['removeAgents'](_0x286daf,{'transaction':_0x82b63d});}})[_0x7f56('0x2b')](function(){_0x286daf[_0x7f56('0x70')](function(_0x236af8){socket[_0x7f56('0x71')](_0x7f56('0x84'),{'UserId':_0x236af8,'FaxQueueId':_0x95a962['id']});});});});});});})[_0x7f56('0x2b')](respondWithStatusCode(_0x2f4336,null))[_0x7f56('0x46')](handleError(_0x2f4336,null));};exports['addAgents']=function(_0x12888b,_0x38ddb3,_0x8098ba){return db[_0x7f56('0x30')][_0x7f56('0x4b')]({'where':{'id':_0x12888b[_0x7f56('0x47')]['id']}})[_0x7f56('0x2b')](handleEntityNotFound(_0x38ddb3,null))[_0x7f56('0x2b')](function(_0x1ce6f5){if(_0x1ce6f5){return _0x1ce6f5[_0x7f56('0x85')](_0x12888b[_0x7f56('0x4d')][_0x7f56('0x67')],_['omit'](_0x12888b[_0x7f56('0x4d')],['ids','id'])||{})[_0x7f56('0x86')](function(_0x1e662d){for(var _0x4689bb=0x0;_0x4689bb<_0x12888b[_0x7f56('0x4d')][_0x7f56('0x67')][_0x7f56('0x59')];_0x4689bb+=0x1){socket['emit'](_0x7f56('0x72'),{'UserId':_0x12888b[_0x7f56('0x4d')][_0x7f56('0x67')][_0x4689bb],'FaxQueueId':_0x12888b[_0x7f56('0x47')]['id']});}return _0x1e662d;});}})['then'](respondWithResult(_0x38ddb3,null))[_0x7f56('0x46')](handleError(_0x38ddb3,null));};exports['removeAgents']=function(_0x2c6627,_0x344af5,_0x2c6b37){return db[_0x7f56('0x30')]['find']({'where':{'id':_0x2c6627[_0x7f56('0x47')]['id']}})[_0x7f56('0x2b')](handleEntityNotFound(_0x344af5,null))[_0x7f56('0x2b')](function(_0x2a668f){if(_0x2a668f){return _0x2a668f[_0x7f56('0x87')](_0x2c6627[_0x7f56('0x34')]['ids'])['then'](function(){if(_[_0x7f56('0x88')](_0x2c6627[_0x7f56('0x34')]['ids'])){for(var _0x43ff8e=0x0;_0x43ff8e<_0x2c6627[_0x7f56('0x34')][_0x7f56('0x67')][_0x7f56('0x59')];_0x43ff8e+=0x1){socket[_0x7f56('0x71')](_0x7f56('0x84'),{'UserId':Number(_0x2c6627['query'][_0x7f56('0x67')][_0x43ff8e]),'FaxQueueId':Number(_0x2c6627[_0x7f56('0x47')]['id'])});}}else{socket['emit'](_0x7f56('0x84'),{'UserId':Number(_0x2c6627[_0x7f56('0x34')][_0x7f56('0x67')]),'FaxQueueId':Number(_0x2c6627['params']['id'])});}});}})[_0x7f56('0x2b')](respondWithStatusCode(_0x344af5,null))['catch'](handleError(_0x344af5,null));};exports[_0x7f56('0x89')]=function(_0x4b6d3a,_0x4ec691,_0x59f21d){var _0x5ce6c7={};var _0x35d25c={};var _0x125262;var _0x144815;return db[_0x7f56('0x30')][_0x7f56('0x57')]({'where':{'id':_0x4b6d3a[_0x7f56('0x47')]['id']}})[_0x7f56('0x2b')](handleEntityNotFound(_0x4ec691,null))['then'](function(_0x35a3e3){if(_0x35a3e3){_0x125262=_0x35a3e3;_0x35d25c[_0x7f56('0x33')]=_['keys'](db[_0x7f56('0x68')][_0x7f56('0x48')]);_0x35d25c[_0x7f56('0x34')]=_[_0x7f56('0x35')](_0x4b6d3a[_0x7f56('0x34')]);_0x35d25c[_0x7f56('0x36')]=_[_0x7f56('0x37')](_0x35d25c[_0x7f56('0x33')],_0x35d25c[_0x7f56('0x34')]);_0x5ce6c7[_0x7f56('0x38')]=_[_0x7f56('0x37')](_0x35d25c[_0x7f56('0x33')],qs[_0x7f56('0x49')](_0x4b6d3a[_0x7f56('0x34')][_0x7f56('0x49')]));_0x5ce6c7[_0x7f56('0x38')]=_0x5ce6c7['attributes'][_0x7f56('0x59')]?_0x5ce6c7[_0x7f56('0x38')]:_0x35d25c[_0x7f56('0x33')];_0x5ce6c7[_0x7f56('0x5a')]=qs['sort'](_0x4b6d3a[_0x7f56('0x34')][_0x7f56('0x3c')]);_0x5ce6c7[_0x7f56('0x3f')]=qs[_0x7f56('0x36')](_['pick'](_0x4b6d3a['query'],_0x35d25c[_0x7f56('0x36')]));if(_0x4b6d3a[_0x7f56('0x34')]['filter']){_0x5ce6c7[_0x7f56('0x3f')]=_[_0x7f56('0x40')](_0x5ce6c7[_0x7f56('0x3f')],{'$or':_[_0x7f56('0x2f')](_0x5ce6c7[_0x7f56('0x38')],function(_0x3a7a9f){var _0x1dfaeb={};_0x1dfaeb[_0x3a7a9f]={'$like':'%'+_0x4b6d3a[_0x7f56('0x34')][_0x7f56('0x3e')]+'%'};return _0x1dfaeb;})});}_0x5ce6c7=_[_0x7f56('0x40')]({},_0x5ce6c7,_0x4b6d3a[_0x7f56('0x42')]);return _0x125262[_0x7f56('0x89')](_0x5ce6c7);}})[_0x7f56('0x2b')](function(_0x310b12){if(_0x310b12){_0x144815=_0x310b12[_0x7f56('0x59')];if(!_0x4b6d3a['query'][_0x7f56('0x39')](_0x7f56('0x3a'))){_0x5ce6c7[_0x7f56('0x3b')]=qs[_0x7f56('0x3b')](_0x4b6d3a['query'][_0x7f56('0x3b')]);_0x5ce6c7[_0x7f56('0x24')]=qs[_0x7f56('0x24')](_0x4b6d3a[_0x7f56('0x34')][_0x7f56('0x24')]);}return _0x125262[_0x7f56('0x89')](_0x5ce6c7);}})[_0x7f56('0x2b')](function(_0x5009be){if(_0x5009be){return _0x5009be?{'count':_0x144815,'rows':_0x5009be}:null;}})[_0x7f56('0x2b')](respondWithResult(_0x4ec691,null))['catch'](handleError(_0x4ec691,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7e7da8b..874f798 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 _0xecd8=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x10bca9,_0x10c2c3){var _0x1b9da8=function(_0x358170){while(--_0x358170){_0x10bca9['push'](_0x10bca9['shift']());}};_0x1b9da8(++_0x10c2c3);}(_0xecd8,0xa0));var _0x8ecd=function(_0x37c830,_0x5368ab){_0x37c830=_0x37c830-0x0;var _0x4b128a=_0xecd8[_0x37c830];return _0x4b128a;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x8ecd('0x0'))['db'][_0x8ecd('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8ecd('0x2')](0x0);var events={'afterCreate':_0x8ecd('0x3'),'afterUpdate':_0x8ecd('0x4'),'afterDestroy':_0x8ecd('0x5')};function emitEvent(_0x4fcb1b){return function(_0x555a52,_0x50ab11,_0x35123c){FaxQueueEvents[_0x8ecd('0x6')](_0x4fcb1b+':'+_0x555a52['id'],_0x555a52);FaxQueueEvents[_0x8ecd('0x6')](_0x4fcb1b,_0x555a52);_0x35123c(null);};}for(var e in events){if(events[_0x8ecd('0x7')](e)){var event=events[e];FaxQueue[_0x8ecd('0x8')](e,emitEvent(event));}}module[_0x8ecd('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x1bc9=['events','../../mysqldb','FaxQueue','update','emit','hook'];(function(_0x4c99c6,_0x263a2e){var _0xe93a7e=function(_0x24e10b){while(--_0x24e10b){_0x4c99c6['push'](_0x4c99c6['shift']());}};_0xe93a7e(++_0x263a2e);}(_0x1bc9,0x6c));var _0x91bc=function(_0x309e16,_0xb88c0d){_0x309e16=_0x309e16-0x0;var _0x5f4052=_0x1bc9[_0x309e16];return _0x5f4052;};'use strict';var EventEmitter=require(_0x91bc('0x0'));var FaxQueue=require(_0x91bc('0x1'))['db'][_0x91bc('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x91bc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x182c1d){return function(_0x26fcd9,_0x13640c,_0x54746a){FaxQueueEvents[_0x91bc('0x4')](_0x182c1d+':'+_0x26fcd9['id'],_0x26fcd9);FaxQueueEvents[_0x91bc('0x4')](_0x182c1d,_0x26fcd9);_0x54746a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x91bc('0x5')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2313596..fe54f17 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 _0xf5fd=['exports','define','FaxQueue','fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxQueue.attributes'];(function(_0x348f97,_0x40734c){var _0x4ad01c=function(_0x6ba041){while(--_0x6ba041){_0x348f97['push'](_0x348f97['shift']());}};_0x4ad01c(++_0x40734c);}(_0xf5fd,0x1a8));var _0xdf5f=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xf5fd[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require(_0xdf5f('0x0'));var logger=require(_0xdf5f('0x1'))(_0xdf5f('0x2'));var moment=require(_0xdf5f('0x3'));var BPromise=require(_0xdf5f('0x4'));var rp=require(_0xdf5f('0x5'));var fs=require('fs');var path=require(_0xdf5f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdf5f('0x7'));module[_0xdf5f('0x8')]=function(_0x197247,_0x533378){return _0x197247[_0xdf5f('0x9')](_0xdf5f('0xa'),attributes,{'tableName':_0xdf5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed94=['util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','fax_queues'];(function(_0x2241ad,_0xbd8748){var _0x169099=function(_0x1a75eb){while(--_0x1a75eb){_0x2241ad['push'](_0x2241ad['shift']());}};_0x169099(++_0xbd8748);}(_0xed94,0x1d4));var _0x4ed9=function(_0x237ead,_0x1869d8){_0x237ead=_0x237ead-0x0;var _0x3f78bf=_0xed94[_0x237ead];return _0x3f78bf;};'use strict';var _=require('lodash');var util=require(_0x4ed9('0x0'));var logger=require(_0x4ed9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4ed9('0x2'));var rp=require(_0x4ed9('0x3'));var fs=require('fs');var path=require(_0x4ed9('0x4'));var rimraf=require(_0x4ed9('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x4ed9('0x6')]=function(_0x129958,_0x294297){return _0x129958[_0x4ed9('0x7')]('FaxQueue',attributes,{'tableName':_0x4ed9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index fc93b63..88b81c9 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 _0xf32d=['socket.io-emitter','./faxQueue.socket','register','request','then','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','attributes','limit','map','include','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x696135,_0x2d015d){var _0x1fcfdb=function(_0x2cc5a2){while(--_0x2cc5a2){_0x696135['push'](_0x696135['shift']());}};_0x1fcfdb(++_0x2d015d);}(_0xf32d,0x17d));var _0xdf32=function(_0x5ccdeb,_0x4a9c12){_0x5ccdeb=_0x5ccdeb-0x0;var _0x552ca4=_0xf32d[_0x5ccdeb];return _0x552ca4;};'use strict';var _=require(_0xdf32('0x0'));var util=require(_0xdf32('0x1'));var moment=require(_0xdf32('0x2'));var BPromise=require(_0xdf32('0x3'));var rs=require(_0xdf32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf32('0x5'))['db'];var utils=require(_0xdf32('0x6'));var logger=require(_0xdf32('0x7'))(_0xdf32('0x8'));var config=require(_0xdf32('0x9'));var jayson=require(_0xdf32('0xa'));var client=jayson['client'][_0xdf32('0xb')]({'port':0x232a});config[_0xdf32('0xc')]=_[_0xdf32('0xd')](config[_0xdf32('0xc')],{'host':_0xdf32('0xe'),'port':0x18eb});var socket=require(_0xdf32('0xf'))(new Redis(config['redis']));require(_0xdf32('0x10'))[_0xdf32('0x11')](socket);function respondWithRpcPromise(_0x5c0140,_0x3fdb9f,_0x5d249c){return new BPromise(function(_0x449685,_0x15873b){return client[_0xdf32('0x12')](_0x5c0140,_0x5d249c)[_0xdf32('0x13')](function(_0x272404){logger[_0xdf32('0x14')](_0xdf32('0x15'),_0x3fdb9f,_0xdf32('0x16'));logger[_0xdf32('0x17')](_0xdf32('0x18'),_0x3fdb9f,_0xdf32('0x16'),JSON[_0xdf32('0x19')](_0x272404));if(_0x272404[_0xdf32('0x1a')]){if(_0x272404[_0xdf32('0x1a')][_0xdf32('0x1b')]===0x1f4){logger[_0xdf32('0x1a')]('FaxQueue,\x20%s,\x20%s',_0x3fdb9f,_0x272404[_0xdf32('0x1a')][_0xdf32('0x1c')]);return _0x15873b(_0x272404['error']['message']);}logger[_0xdf32('0x1a')]('FaxQueue,\x20%s,\x20%s',_0x3fdb9f,_0x272404['error'][_0xdf32('0x1c')]);return _0x449685(_0x272404[_0xdf32('0x1a')][_0xdf32('0x1c')]);}else{logger[_0xdf32('0x14')]('FaxQueue,\x20%s,\x20%s',_0x3fdb9f,_0xdf32('0x16'));_0x449685(_0x272404[_0xdf32('0x1d')]['message']);}})[_0xdf32('0x1e')](function(_0x3c02a9){logger['error'](_0xdf32('0x15'),_0x3fdb9f,_0x3c02a9);_0x15873b(_0x3c02a9);});});}exports[_0xdf32('0x1f')]=function(_0x402f51){var _0x36dac4=this;return new Promise(function(_0x3d66a1,_0x4e1f0a){return db[_0xdf32('0x20')][_0xdf32('0x21')]({'raw':_0x402f51[_0xdf32('0x22')]?_0x402f51[_0xdf32('0x22')][_0xdf32('0x23')]===undefined?!![]:![]:!![],'where':_0x402f51['options']?_0x402f51['options'][_0xdf32('0x24')]||null:null,'attributes':_0x402f51['options']?_0x402f51[_0xdf32('0x22')][_0xdf32('0x25')]||null:null,'limit':_0x402f51['options']?_0x402f51[_0xdf32('0x22')][_0xdf32('0x26')]||null:null,'include':_0x402f51[_0xdf32('0x22')]?_0x402f51['options']['include']?_[_0xdf32('0x27')](_0x402f51['options'][_0xdf32('0x28')],function(_0x3debec){return{'model':db[_0x3debec['model']],'as':_0x3debec['as'],'attributes':_0x3debec[_0xdf32('0x25')],'include':_0x3debec[_0xdf32('0x28')]?_['map'](_0x3debec[_0xdf32('0x28')],function(_0x3d8444){return{'model':db[_0x3d8444[_0xdf32('0x29')]],'as':_0x3d8444['as'],'attributes':_0x3d8444['attributes'],'include':_0x3d8444[_0xdf32('0x28')]?_[_0xdf32('0x27')](_0x3d8444[_0xdf32('0x28')],function(_0x222fad){return{'model':db[_0x222fad[_0xdf32('0x29')]],'as':_0x222fad['as'],'attributes':_0x222fad[_0xdf32('0x25')]};}):[]};}):[]};}):[]:[]})[_0xdf32('0x13')](function(_0x4beb92){logger[_0xdf32('0x14')](_0xdf32('0x1f'),_0x402f51);logger['debug'](_0xdf32('0x1f'),_0x402f51,JSON['stringify'](_0x4beb92));_0x3d66a1(_0x4beb92);})[_0xdf32('0x1e')](function(_0x125357){logger[_0xdf32('0x1a')]('GetFaxQueue',_0x125357[_0xdf32('0x1c')],_0x402f51);_0x4e1f0a(_0x36dac4[_0xdf32('0x1a')](0x1f4,_0x125357[_0xdf32('0x1c')]));});});};exports[_0xdf32('0x2a')]=function(_0x3aa7b5){var _0x17cce0=this;return new Promise(function(_0x27f8cc,_0x7f7de2){return db[_0xdf32('0x20')][_0xdf32('0x2b')]({'raw':_0x3aa7b5[_0xdf32('0x22')]?_0x3aa7b5[_0xdf32('0x22')][_0xdf32('0x23')]===undefined?!![]:![]:!![],'where':_0x3aa7b5[_0xdf32('0x22')]?_0x3aa7b5[_0xdf32('0x22')][_0xdf32('0x24')]||null:null,'attributes':_0x3aa7b5[_0xdf32('0x22')]?_0x3aa7b5[_0xdf32('0x22')]['attributes']||null:null,'include':_0x3aa7b5[_0xdf32('0x22')]?_0x3aa7b5[_0xdf32('0x22')]['include']?_['map'](_0x3aa7b5[_0xdf32('0x22')]['include'],function(_0x14bd02){return{'model':db[_0x14bd02[_0xdf32('0x29')]],'as':_0x14bd02['as'],'attributes':_0x14bd02[_0xdf32('0x25')],'include':_0x14bd02[_0xdf32('0x28')]?_['map'](_0x14bd02[_0xdf32('0x28')],function(_0x52aeec){return{'model':db[_0x52aeec[_0xdf32('0x29')]],'as':_0x52aeec['as'],'attributes':_0x52aeec['attributes'],'include':_0x52aeec['include']?_[_0xdf32('0x27')](_0x52aeec[_0xdf32('0x28')],function(_0x529e49){return{'model':db[_0x529e49[_0xdf32('0x29')]],'as':_0x529e49['as'],'attributes':_0x529e49[_0xdf32('0x25')]};}):[]};}):[]};}):[]:[]})[_0xdf32('0x13')](function(_0x5f2e51){logger[_0xdf32('0x14')](_0xdf32('0x2a'),_0x3aa7b5);logger['debug'](_0xdf32('0x2a'),_0x3aa7b5,JSON['stringify'](_0x5f2e51));_0x27f8cc(_0x5f2e51);})[_0xdf32('0x1e')](function(_0x438e73){logger[_0xdf32('0x1a')](_0xdf32('0x2a'),_0x438e73[_0xdf32('0x1c')],_0x3aa7b5);_0x7f7de2(_0x17cce0[_0xdf32('0x1a')](0x1f4,_0x438e73['message']));});});}; \ No newline at end of file +var _0xe1ee=['./faxQueue.socket','register','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFaxQueue','findAll','options','where','attributes','include','map','model','then','stringify','FaxQueue','raw','ShowFaxQueue','lodash','util','moment','randomstring','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x505cfe,_0x509d32){var _0x558207=function(_0x224c3f){while(--_0x224c3f){_0x505cfe['push'](_0x505cfe['shift']());}};_0x558207(++_0x509d32);}(_0xe1ee,0x84));var _0xee1e=function(_0x590275,_0x9451d){_0x590275=_0x590275-0x0;var _0x4fc880=_0xe1ee[_0x590275];return _0x4fc880;};'use strict';var _=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var moment=require(_0xee1e('0x2'));var BPromise=require('bluebird');var rs=require(_0xee1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee1e('0x4'));var logger=require('../../config/logger')(_0xee1e('0x5'));var config=require('../../config/environment');var jayson=require(_0xee1e('0x6'));var client=jayson[_0xee1e('0x7')][_0xee1e('0x8')]({'port':0x232a});config[_0xee1e('0x9')]=_[_0xee1e('0xa')](config[_0xee1e('0x9')],{'host':_0xee1e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee1e('0x9')]));require(_0xee1e('0xc'))[_0xee1e('0xd')](socket);function respondWithRpcPromise(_0x5a8b99,_0x4dfcb5,_0x30c564){return new BPromise(function(_0x29b24b,_0x8100e7){return client['request'](_0x5a8b99,_0x30c564)['then'](function(_0x4db0bb){logger['info'](_0xee1e('0xe'),_0x4dfcb5,_0xee1e('0xf'));logger[_0xee1e('0x10')](_0xee1e('0x11'),_0x4dfcb5,_0xee1e('0xf'),JSON['stringify'](_0x4db0bb));if(_0x4db0bb[_0xee1e('0x12')]){if(_0x4db0bb[_0xee1e('0x12')][_0xee1e('0x13')]===0x1f4){logger[_0xee1e('0x12')]('FaxQueue,\x20%s,\x20%s',_0x4dfcb5,_0x4db0bb['error'][_0xee1e('0x14')]);return _0x8100e7(_0x4db0bb[_0xee1e('0x12')][_0xee1e('0x14')]);}logger[_0xee1e('0x12')](_0xee1e('0xe'),_0x4dfcb5,_0x4db0bb[_0xee1e('0x12')]['message']);return _0x29b24b(_0x4db0bb[_0xee1e('0x12')][_0xee1e('0x14')]);}else{logger[_0xee1e('0x15')](_0xee1e('0xe'),_0x4dfcb5,_0xee1e('0xf'));_0x29b24b(_0x4db0bb['result'][_0xee1e('0x14')]);}})[_0xee1e('0x16')](function(_0x3bd63d){logger['error'](_0xee1e('0xe'),_0x4dfcb5,_0x3bd63d);_0x8100e7(_0x3bd63d);});});}exports[_0xee1e('0x17')]=function(_0xca2c78){var _0x3c0ce4=this;return new Promise(function(_0xab790c,_0x33efb0){return db['FaxQueue'][_0xee1e('0x18')]({'raw':_0xca2c78[_0xee1e('0x19')]?_0xca2c78[_0xee1e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xca2c78[_0xee1e('0x19')]?_0xca2c78[_0xee1e('0x19')][_0xee1e('0x1a')]||null:null,'attributes':_0xca2c78[_0xee1e('0x19')]?_0xca2c78[_0xee1e('0x19')][_0xee1e('0x1b')]||null:null,'limit':_0xca2c78[_0xee1e('0x19')]?_0xca2c78['options']['limit']||null:null,'include':_0xca2c78['options']?_0xca2c78[_0xee1e('0x19')][_0xee1e('0x1c')]?_[_0xee1e('0x1d')](_0xca2c78[_0xee1e('0x19')]['include'],function(_0x406d21){return{'model':db[_0x406d21[_0xee1e('0x1e')]],'as':_0x406d21['as'],'attributes':_0x406d21[_0xee1e('0x1b')],'include':_0x406d21[_0xee1e('0x1c')]?_[_0xee1e('0x1d')](_0x406d21[_0xee1e('0x1c')],function(_0x21eddc){return{'model':db[_0x21eddc[_0xee1e('0x1e')]],'as':_0x21eddc['as'],'attributes':_0x21eddc[_0xee1e('0x1b')],'include':_0x21eddc[_0xee1e('0x1c')]?_[_0xee1e('0x1d')](_0x21eddc[_0xee1e('0x1c')],function(_0x308f43){return{'model':db[_0x308f43[_0xee1e('0x1e')]],'as':_0x308f43['as'],'attributes':_0x308f43[_0xee1e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee1e('0x1f')](function(_0x2a7be4){logger[_0xee1e('0x15')]('GetFaxQueue',_0xca2c78);logger[_0xee1e('0x10')](_0xee1e('0x17'),_0xca2c78,JSON[_0xee1e('0x20')](_0x2a7be4));_0xab790c(_0x2a7be4);})[_0xee1e('0x16')](function(_0x10aaa9){logger[_0xee1e('0x12')]('GetFaxQueue',_0x10aaa9[_0xee1e('0x14')],_0xca2c78);_0x33efb0(_0x3c0ce4[_0xee1e('0x12')](0x1f4,_0x10aaa9[_0xee1e('0x14')]));});});};exports['ShowFaxQueue']=function(_0x1f55ad){var _0xd14851=this;return new Promise(function(_0x4fd795,_0xbd7fb9){return db[_0xee1e('0x21')]['find']({'raw':_0x1f55ad[_0xee1e('0x19')]?_0x1f55ad[_0xee1e('0x19')][_0xee1e('0x22')]===undefined?!![]:![]:!![],'where':_0x1f55ad[_0xee1e('0x19')]?_0x1f55ad['options'][_0xee1e('0x1a')]||null:null,'attributes':_0x1f55ad[_0xee1e('0x19')]?_0x1f55ad[_0xee1e('0x19')][_0xee1e('0x1b')]||null:null,'include':_0x1f55ad[_0xee1e('0x19')]?_0x1f55ad[_0xee1e('0x19')][_0xee1e('0x1c')]?_['map'](_0x1f55ad['options'][_0xee1e('0x1c')],function(_0x19531e){return{'model':db[_0x19531e[_0xee1e('0x1e')]],'as':_0x19531e['as'],'attributes':_0x19531e[_0xee1e('0x1b')],'include':_0x19531e['include']?_[_0xee1e('0x1d')](_0x19531e[_0xee1e('0x1c')],function(_0x34c99a){return{'model':db[_0x34c99a[_0xee1e('0x1e')]],'as':_0x34c99a['as'],'attributes':_0x34c99a[_0xee1e('0x1b')],'include':_0x34c99a[_0xee1e('0x1c')]?_[_0xee1e('0x1d')](_0x34c99a['include'],function(_0x22a9c8){return{'model':db[_0x22a9c8[_0xee1e('0x1e')]],'as':_0x22a9c8['as'],'attributes':_0x22a9c8[_0xee1e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee1e('0x1f')](function(_0x50fdec){logger[_0xee1e('0x15')](_0xee1e('0x23'),_0x1f55ad);logger['debug']('ShowFaxQueue',_0x1f55ad,JSON[_0xee1e('0x20')](_0x50fdec));_0x4fd795(_0x50fdec);})[_0xee1e('0x16')](function(_0x5e1b25){logger['error']('ShowFaxQueue',_0x5e1b25[_0xee1e('0x14')],_0x1f55ad);_0xbd7fb9(_0xd14851['error'](0x1f4,_0x5e1b25[_0xee1e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6031209..93a2ff9 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 _0xa13e=['length','./faxQueue.events','remove','emit','removeListener'];(function(_0x20076b,_0x4f218e){var _0x1ae3de=function(_0x545d7a){while(--_0x545d7a){_0x20076b['push'](_0x20076b['shift']());}};_0x1ae3de(++_0x4f218e);}(_0xa13e,0xd8));var _0xea13=function(_0x5ac536,_0xfa9625){_0x5ac536=_0x5ac536-0x0;var _0x22c2c7=_0xa13e[_0x5ac536];return _0x22c2c7;};'use strict';var FaxQueueEvents=require(_0xea13('0x0'));var events=['save',_0xea13('0x1'),'update'];function createListener(_0x90c6d2,_0x18d696){return function(_0x317b36){_0x18d696[_0xea13('0x2')](_0x90c6d2,_0x317b36);};}function removeListener(_0x542226,_0x49e732){return function(){FaxQueueEvents[_0xea13('0x3')](_0x542226,_0x49e732);};}exports['register']=function(_0x2bc659){for(var _0x49b92b=0x0,_0x4ee7d1=events[_0xea13('0x4')];_0x49b92b<_0x4ee7d1;_0x49b92b++){var _0x2717e5=events[_0x49b92b];var _0x3532e0=createListener('faxQueue:'+_0x2717e5,_0x2bc659);FaxQueueEvents['on'](_0x2717e5,_0x3532e0);}}; \ No newline at end of file +var _0x36b8=['save','remove','update','register','length','faxQueue:','./faxQueue.events'];(function(_0x3059c6,_0x53955c){var _0x5036ac=function(_0x30a181){while(--_0x30a181){_0x3059c6['push'](_0x3059c6['shift']());}};_0x5036ac(++_0x53955c);}(_0x36b8,0xfb));var _0x836b=function(_0x2723ed,_0x5da280){_0x2723ed=_0x2723ed-0x0;var _0xa034f9=_0x36b8[_0x2723ed];return _0xa034f9;};'use strict';var FaxQueueEvents=require(_0x836b('0x0'));var events=[_0x836b('0x1'),_0x836b('0x2'),_0x836b('0x3')];function createListener(_0x3121ee,_0x5881f7){return function(_0x47c32a){_0x5881f7['emit'](_0x3121ee,_0x47c32a);};}function removeListener(_0x56e2c1,_0x3f0a2d){return function(){FaxQueueEvents['removeListener'](_0x56e2c1,_0x3f0a2d);};}exports[_0x836b('0x4')]=function(_0x22d5ca){for(var _0x4c2197=0x0,_0x5d9384=events[_0x836b('0x5')];_0x4c2197<_0x5d9384;_0x4c2197++){var _0x4fe1f4=events[_0x4c2197];var _0x1522e0=createListener(_0x836b('0x6')+_0x4fe1f4,_0x22d5ca);FaxQueueEvents['on'](_0x4fe1f4,_0x1522e0);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 33dc0bc..3f9cc28 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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xb10b,0x12a));var _0xbb10=function(_0x49dd7e,_0x48b1e5){_0x49dd7e=_0x49dd7e-0x0;var _0x4c4f6e=_0xb10b[_0x49dd7e];return _0x4c4f6e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xb10b,0x12a));var _0xbb10=function(_0x32ce61,_0x2ba733){_0x32ce61=_0x32ce61-0x0;var _0x28eded=_0xb10b[_0x32ce61];return _0x28eded;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 6f22b3b..eea094c 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 _0x2d73=['sequelize','exports','STRING','DATE','moment'];(function(_0x20b328,_0x11174d){var _0x3d0297=function(_0x15c475){while(--_0x15c475){_0x20b328['push'](_0x20b328['shift']());}};_0x3d0297(++_0x11174d);}(_0x2d73,0x112));var _0x32d7=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x2d73[_0x1daaa9];return _0x1dd221;};'use strict';var moment=require(_0x32d7('0x0'));var Sequelize=require(_0x32d7('0x1'));module[_0x32d7('0x2')]={'uniqueid':{'type':Sequelize[_0x32d7('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x32d7('0x4')]},'leaveAt':{'type':Sequelize[_0x32d7('0x4')]},'acceptAt':{'type':Sequelize[_0x32d7('0x4')]},'exitAt':{'type':Sequelize[_0x32d7('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1393=['DATE','moment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1393,0x1e7));var _0x3139=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1393[_0x21a9d9];return _0x46adce;};'use strict';var moment=require(_0x3139('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3139('0x1')]},'leaveAt':{'type':Sequelize[_0x3139('0x1')]},'acceptAt':{'type':Sequelize[_0x3139('0x1')]},'exitAt':{'type':Sequelize[_0x3139('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index fb2bf3f..327cd0c 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 _0x520d=['options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','error','stack','send','index','FaxQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','include','findAll','catch','show','params','length','includeAll'];(function(_0x3136fa,_0x179312){var _0x4fdecb=function(_0x4b7c9d){while(--_0x4b7c9d){_0x3136fa['push'](_0x3136fa['shift']());}};_0x4fdecb(++_0x179312);}(_0x520d,0x1d3));var _0xd520=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x520d[_0x500419];return _0x241c1a;};'use strict';var pdf=require(_0xd520('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd520('0x1'));var zipdir=require(_0xd520('0x2'));var jsonpatch=require(_0xd520('0x3'));var rp=require(_0xd520('0x4'));var moment=require(_0xd520('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd520('0x6'));var util=require(_0xd520('0x7'));var path=require(_0xd520('0x8'));var sox=require(_0xd520('0x9'));var csv=require('to-csv');var ejs=require(_0xd520('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd520('0xb'));var crypto=require(_0xd520('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd520('0xd'));var toCsv=require(_0xd520('0xe'));var querystring=require(_0xd520('0xf'));var Papa=require(_0xd520('0x10'));var Redis=require('ioredis');var authService=require(_0xd520('0x11'));var qs=require(_0xd520('0x12'));var as=require(_0xd520('0x13'));var hardwareService=require(_0xd520('0x14'));var logger=require(_0xd520('0x15'))(_0xd520('0x16'));var utils=require(_0xd520('0x17'));var config=require('../../config/environment');var db=require(_0xd520('0x18'))['db'];function respondWithStatusCode(_0x2e3194,_0x20f49c){_0x20f49c=_0x20f49c||0xcc;return function(_0x227eaf){if(_0x227eaf){return _0x2e3194[_0xd520('0x19')](_0x20f49c);}return _0x2e3194[_0xd520('0x1a')](_0x20f49c)['end']();};}function respondWithResult(_0x582e55,_0x17636d){_0x17636d=_0x17636d||0xc8;return function(_0x12d0ed){if(_0x12d0ed){return _0x582e55[_0xd520('0x1a')](_0x17636d)[_0xd520('0x1b')](_0x12d0ed);}};}function respondWithFilteredResult(_0x1fdd04,_0x2d7653){return function(_0x2d8e1e){if(_0x2d8e1e){var _0x4c1da9=_0x2d8e1e[_0xd520('0x1c')],_0x5ac5e5=_0x2d7653[_0xd520('0x1d')],_0x54783e=_0x2d7653[_0xd520('0x1d')]+_0x2d7653[_0xd520('0x1e')],_0x459d8d;if(_0x54783e>=_0x4c1da9){_0x54783e=_0x4c1da9;_0x459d8d=0xc8;}else{_0x459d8d=0xce;}_0x1fdd04[_0xd520('0x1a')](_0x459d8d);return _0x1fdd04[_0xd520('0x1f')]('Content-Range',_0x5ac5e5+'-'+_0x54783e+'/'+_0x4c1da9)['json'](_0x2d8e1e);}return null;};}function patchUpdates(_0x10f002){return function(_0x49443a){try{jsonpatch[_0xd520('0x20')](_0x49443a,_0x10f002,!![]);}catch(_0x4334fe){return BPromise[_0xd520('0x21')](_0x4334fe);}return _0x49443a[_0xd520('0x22')]();};}function saveUpdates(_0x5c4f15,_0x56afc9){return function(_0x40894f){if(_0x40894f){return _0x40894f[_0xd520('0x23')](_0x5c4f15)['then'](function(_0x3cbfaa){return _0x3cbfaa;});}return null;};}function removeEntity(_0x247520,_0x1459d4){return function(_0x4e0954){if(_0x4e0954){return _0x4e0954[_0xd520('0x24')]()[_0xd520('0x25')](function(){_0x247520[_0xd520('0x1a')](0xcc)[_0xd520('0x26')]();});}};}function handleEntityNotFound(_0x40e195,_0x32dee1){return function(_0x4d5d0a){if(!_0x4d5d0a){_0x40e195[_0xd520('0x19')](0x194);}return _0x4d5d0a;};}function handleError(_0x2bcd0d,_0x30825c){_0x30825c=_0x30825c||0x1f4;return function(_0x300286){logger[_0xd520('0x27')](_0x300286[_0xd520('0x28')]);if(_0x300286['name']){delete _0x300286['name'];}_0x2bcd0d[_0xd520('0x1a')](_0x30825c)[_0xd520('0x29')](_0x300286);};}exports[_0xd520('0x2a')]=function(_0x10bb9e,_0x338194){var _0x2f930d={},_0x26430c={},_0x15c44e={'count':0x0,'rows':[]};var _0x5a54dc=_['map'](db[_0xd520('0x2b')][_0xd520('0x2c')],function(_0x198dc4){return{'name':_0x198dc4['fieldName'],'type':_0x198dc4[_0xd520('0x2d')][_0xd520('0x2e')]};});_0x26430c[_0xd520('0x2f')]=_[_0xd520('0x30')](_0x5a54dc,'name');_0x26430c[_0xd520('0x31')]=_[_0xd520('0x32')](_0x10bb9e[_0xd520('0x31')]);_0x26430c[_0xd520('0x33')]=_[_0xd520('0x34')](_0x26430c[_0xd520('0x2f')],_0x26430c['query']);_0x2f930d[_0xd520('0x35')]=_[_0xd520('0x34')](_0x26430c[_0xd520('0x2f')],qs['fields'](_0x10bb9e[_0xd520('0x31')][_0xd520('0x36')]));_0x2f930d[_0xd520('0x35')]=_0x2f930d[_0xd520('0x35')]['length']?_0x2f930d[_0xd520('0x35')]:_0x26430c[_0xd520('0x2f')];if(!_0x10bb9e[_0xd520('0x31')][_0xd520('0x37')](_0xd520('0x38'))){_0x2f930d['limit']=qs[_0xd520('0x1e')](_0x10bb9e[_0xd520('0x31')][_0xd520('0x1e')]);_0x2f930d[_0xd520('0x1d')]=qs[_0xd520('0x1d')](_0x10bb9e[_0xd520('0x31')][_0xd520('0x1d')]);}_0x2f930d[_0xd520('0x39')]=qs[_0xd520('0x3a')](_0x10bb9e['query'][_0xd520('0x3a')]);_0x2f930d[_0xd520('0x3b')]=qs[_0xd520('0x33')](_[_0xd520('0x3c')](_0x10bb9e[_0xd520('0x31')],_0x26430c[_0xd520('0x33')]),_0x5a54dc);if(_0x10bb9e['query'][_0xd520('0x3d')]){_0x2f930d[_0xd520('0x3b')]=_[_0xd520('0x3e')](_0x2f930d['where'],{'$or':_[_0xd520('0x30')](_0x5a54dc,function(_0x1da5be){if(_0x1da5be[_0xd520('0x2d')]!==_0xd520('0x3f')){var _0x2f354a={};_0x2f354a[_0x1da5be[_0xd520('0x40')]]={'$like':'%'+_0x10bb9e[_0xd520('0x31')][_0xd520('0x3d')]+'%'};return _0x2f354a;}})});}_0x2f930d=_[_0xd520('0x3e')]({},_0x2f930d,_0x10bb9e['options']);var _0x4af265={'where':_0x2f930d[_0xd520('0x3b')]};return db[_0xd520('0x2b')][_0xd520('0x1c')](_0x4af265)[_0xd520('0x25')](function(_0x5d73dc){_0x15c44e['count']=_0x5d73dc;if(_0x10bb9e[_0xd520('0x31')]['includeAll']){_0x2f930d[_0xd520('0x41')]=[{'all':!![]}];}return db[_0xd520('0x2b')][_0xd520('0x42')](_0x2f930d);})[_0xd520('0x25')](function(_0xe21099){_0x15c44e['rows']=_0xe21099;return _0x15c44e;})['then'](respondWithFilteredResult(_0x338194,_0x2f930d))[_0xd520('0x43')](handleError(_0x338194,null));};exports[_0xd520('0x44')]=function(_0x5d25f9,_0x47ee2a){var _0x390f77={'raw':!![],'where':{'id':_0x5d25f9[_0xd520('0x45')]['id']}},_0x1d7274={};_0x1d7274[_0xd520('0x2f')]=_[_0xd520('0x32')](db[_0xd520('0x2b')]['rawAttributes']);_0x1d7274[_0xd520('0x31')]=_['keys'](_0x5d25f9[_0xd520('0x31')]);_0x1d7274['filters']=_['intersection'](_0x1d7274[_0xd520('0x2f')],_0x1d7274[_0xd520('0x31')]);_0x390f77[_0xd520('0x35')]=_[_0xd520('0x34')](_0x1d7274[_0xd520('0x2f')],qs[_0xd520('0x36')](_0x5d25f9[_0xd520('0x31')]['fields']));_0x390f77[_0xd520('0x35')]=_0x390f77[_0xd520('0x35')][_0xd520('0x46')]?_0x390f77[_0xd520('0x35')]:_0x1d7274[_0xd520('0x2f')];if(_0x5d25f9[_0xd520('0x31')][_0xd520('0x47')]){_0x390f77[_0xd520('0x41')]=[{'all':!![]}];}_0x390f77=_[_0xd520('0x3e')]({},_0x390f77,_0x5d25f9[_0xd520('0x48')]);return db[_0xd520('0x2b')][_0xd520('0x49')](_0x390f77)[_0xd520('0x25')](handleEntityNotFound(_0x47ee2a,null))[_0xd520('0x25')](respondWithResult(_0x47ee2a,null))['catch'](handleError(_0x47ee2a,null));};exports[_0xd520('0x4a')]=function(_0xc4bf92,_0x3d34bb){return db[_0xd520('0x2b')][_0xd520('0x4a')](_0xc4bf92[_0xd520('0x4b')],{})['then'](respondWithResult(_0x3d34bb,0xc9))[_0xd520('0x43')](handleError(_0x3d34bb,null));};exports['update']=function(_0x2fe663,_0x56214d){if(_0x2fe663[_0xd520('0x4b')]['id']){delete _0x2fe663[_0xd520('0x4b')]['id'];}return db[_0xd520('0x2b')]['find']({'where':{'id':_0x2fe663['params']['id']}})[_0xd520('0x25')](handleEntityNotFound(_0x56214d,null))[_0xd520('0x25')](saveUpdates(_0x2fe663['body'],null))[_0xd520('0x25')](respondWithResult(_0x56214d,null))['catch'](handleError(_0x56214d,null));};exports[_0xd520('0x24')]=function(_0x19cdaf,_0x20ebb1){return db['FaxQueueReport'][_0xd520('0x49')]({'where':{'id':_0x19cdaf[_0xd520('0x45')]['id']}})[_0xd520('0x25')](handleEntityNotFound(_0x20ebb1,null))[_0xd520('0x25')](removeEntity(_0x20ebb1,null))[_0xd520('0x43')](handleError(_0x20ebb1,null));};exports[_0xd520('0x4c')]=function(_0x54ee2a,_0x27f10f){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x27f10f,null))['catch'](handleError(_0x27f10f,null));}; \ No newline at end of file +var _0x2317=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','type','VIRTUAL','options','where','includeAll','include','rows','show','params','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x2317,0x85));var _0x7231=function(_0x42fc0a,_0x2b29ae){_0x42fc0a=_0x42fc0a-0x0;var _0x2853ed=_0x2317[_0x42fc0a];return _0x2853ed;};'use strict';var pdf=require(_0x7231('0x0'));var emlformat=require(_0x7231('0x1'));var rimraf=require(_0x7231('0x2'));var zipdir=require(_0x7231('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7231('0x4'));var moment=require('moment');var BPromise=require(_0x7231('0x5'));var Mustache=require(_0x7231('0x6'));var util=require('util');var path=require(_0x7231('0x7'));var sox=require(_0x7231('0x8'));var csv=require('to-csv');var ejs=require(_0x7231('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7231('0xa'));var crypto=require(_0x7231('0xb'));var jsforce=require(_0x7231('0xc'));var deskjs=require(_0x7231('0xd'));var toCsv=require(_0x7231('0xe'));var querystring=require(_0x7231('0xf'));var Papa=require('papaparse');var Redis=require(_0x7231('0x10'));var authService=require(_0x7231('0x11'));var qs=require(_0x7231('0x12'));var as=require(_0x7231('0x13'));var hardwareService=require(_0x7231('0x14'));var logger=require(_0x7231('0x15'))(_0x7231('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7231('0x17'))['db'];function respondWithStatusCode(_0x20dd9f,_0x314f1a){_0x314f1a=_0x314f1a||0xcc;return function(_0x5cd126){if(_0x5cd126){return _0x20dd9f[_0x7231('0x18')](_0x314f1a);}return _0x20dd9f[_0x7231('0x19')](_0x314f1a)[_0x7231('0x1a')]();};}function respondWithResult(_0x4a6ef9,_0x12b2e1){_0x12b2e1=_0x12b2e1||0xc8;return function(_0x49f065){if(_0x49f065){return _0x4a6ef9[_0x7231('0x19')](_0x12b2e1)[_0x7231('0x1b')](_0x49f065);}};}function respondWithFilteredResult(_0x375ad7,_0xc775f2){return function(_0x3e23a7){if(_0x3e23a7){var _0x2aa46a=_0x3e23a7[_0x7231('0x1c')],_0x57af28=_0xc775f2['offset'],_0x508108=_0xc775f2[_0x7231('0x1d')]+_0xc775f2['limit'],_0x46d88f;if(_0x508108>=_0x2aa46a){_0x508108=_0x2aa46a;_0x46d88f=0xc8;}else{_0x46d88f=0xce;}_0x375ad7[_0x7231('0x19')](_0x46d88f);return _0x375ad7[_0x7231('0x1e')]('Content-Range',_0x57af28+'-'+_0x508108+'/'+_0x2aa46a)['json'](_0x3e23a7);}return null;};}function patchUpdates(_0x552c81){return function(_0x3aecdc){try{jsonpatch['apply'](_0x3aecdc,_0x552c81,!![]);}catch(_0xafbfd6){return BPromise[_0x7231('0x1f')](_0xafbfd6);}return _0x3aecdc[_0x7231('0x20')]();};}function saveUpdates(_0x3f50a2,_0x549649){return function(_0x59f5a7){if(_0x59f5a7){return _0x59f5a7['update'](_0x3f50a2)[_0x7231('0x21')](function(_0x3d97e1){return _0x3d97e1;});}return null;};}function removeEntity(_0x307efe,_0x5f2078){return function(_0x2fa2d9){if(_0x2fa2d9){return _0x2fa2d9[_0x7231('0x22')]()[_0x7231('0x21')](function(){_0x307efe[_0x7231('0x19')](0xcc)[_0x7231('0x1a')]();});}};}function handleEntityNotFound(_0x4fea99,_0x438069){return function(_0x5a07d1){if(!_0x5a07d1){_0x4fea99[_0x7231('0x18')](0x194);}return _0x5a07d1;};}function handleError(_0x38a535,_0x42f207){_0x42f207=_0x42f207||0x1f4;return function(_0x536e){logger[_0x7231('0x23')](_0x536e[_0x7231('0x24')]);if(_0x536e[_0x7231('0x25')]){delete _0x536e[_0x7231('0x25')];}_0x38a535[_0x7231('0x19')](_0x42f207)[_0x7231('0x26')](_0x536e);};}exports[_0x7231('0x27')]=function(_0x4a0e80,_0x27efe6){var _0x3b41c4={},_0x41e44c={},_0x446dea={'count':0x0,'rows':[]};var _0x5ea67c=_[_0x7231('0x28')](db[_0x7231('0x29')][_0x7231('0x2a')],function(_0x4e6969){return{'name':_0x4e6969[_0x7231('0x2b')],'type':_0x4e6969['type'][_0x7231('0x2c')]};});_0x41e44c[_0x7231('0x2d')]=_[_0x7231('0x28')](_0x5ea67c,_0x7231('0x25'));_0x41e44c['query']=_[_0x7231('0x2e')](_0x4a0e80[_0x7231('0x2f')]);_0x41e44c[_0x7231('0x30')]=_['intersection'](_0x41e44c[_0x7231('0x2d')],_0x41e44c[_0x7231('0x2f')]);_0x3b41c4[_0x7231('0x31')]=_[_0x7231('0x32')](_0x41e44c[_0x7231('0x2d')],qs[_0x7231('0x33')](_0x4a0e80[_0x7231('0x2f')][_0x7231('0x33')]));_0x3b41c4[_0x7231('0x31')]=_0x3b41c4[_0x7231('0x31')][_0x7231('0x34')]?_0x3b41c4['attributes']:_0x41e44c['model'];if(!_0x4a0e80[_0x7231('0x2f')][_0x7231('0x35')](_0x7231('0x36'))){_0x3b41c4['limit']=qs[_0x7231('0x37')](_0x4a0e80[_0x7231('0x2f')][_0x7231('0x37')]);_0x3b41c4[_0x7231('0x1d')]=qs[_0x7231('0x1d')](_0x4a0e80['query'][_0x7231('0x1d')]);}_0x3b41c4[_0x7231('0x38')]=qs[_0x7231('0x39')](_0x4a0e80[_0x7231('0x2f')][_0x7231('0x39')]);_0x3b41c4['where']=qs[_0x7231('0x30')](_['pick'](_0x4a0e80['query'],_0x41e44c[_0x7231('0x30')]),_0x5ea67c);if(_0x4a0e80['query'][_0x7231('0x3a')]){_0x3b41c4['where']=_[_0x7231('0x3b')](_0x3b41c4['where'],{'$or':_['map'](_0x5ea67c,function(_0x153c48){if(_0x153c48[_0x7231('0x3c')]!==_0x7231('0x3d')){var _0x569a63={};_0x569a63[_0x153c48[_0x7231('0x25')]]={'$like':'%'+_0x4a0e80[_0x7231('0x2f')][_0x7231('0x3a')]+'%'};return _0x569a63;}})});}_0x3b41c4=_['merge']({},_0x3b41c4,_0x4a0e80[_0x7231('0x3e')]);var _0x112630={'where':_0x3b41c4[_0x7231('0x3f')]};return db[_0x7231('0x29')][_0x7231('0x1c')](_0x112630)[_0x7231('0x21')](function(_0x318493){_0x446dea[_0x7231('0x1c')]=_0x318493;if(_0x4a0e80['query'][_0x7231('0x40')]){_0x3b41c4[_0x7231('0x41')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x3b41c4);})[_0x7231('0x21')](function(_0x783557){_0x446dea[_0x7231('0x42')]=_0x783557;return _0x446dea;})['then'](respondWithFilteredResult(_0x27efe6,_0x3b41c4))['catch'](handleError(_0x27efe6,null));};exports[_0x7231('0x43')]=function(_0x81a2,_0x437c78){var _0xa42a82={'raw':!![],'where':{'id':_0x81a2[_0x7231('0x44')]['id']}},_0xf22e10={};_0xf22e10[_0x7231('0x2d')]=_['keys'](db[_0x7231('0x29')][_0x7231('0x2a')]);_0xf22e10[_0x7231('0x2f')]=_[_0x7231('0x2e')](_0x81a2[_0x7231('0x2f')]);_0xf22e10['filters']=_[_0x7231('0x32')](_0xf22e10['model'],_0xf22e10[_0x7231('0x2f')]);_0xa42a82[_0x7231('0x31')]=_[_0x7231('0x32')](_0xf22e10[_0x7231('0x2d')],qs[_0x7231('0x33')](_0x81a2[_0x7231('0x2f')][_0x7231('0x33')]));_0xa42a82[_0x7231('0x31')]=_0xa42a82[_0x7231('0x31')][_0x7231('0x34')]?_0xa42a82[_0x7231('0x31')]:_0xf22e10[_0x7231('0x2d')];if(_0x81a2[_0x7231('0x2f')]['includeAll']){_0xa42a82[_0x7231('0x41')]=[{'all':!![]}];}_0xa42a82=_[_0x7231('0x3b')]({},_0xa42a82,_0x81a2[_0x7231('0x3e')]);return db[_0x7231('0x29')][_0x7231('0x45')](_0xa42a82)[_0x7231('0x21')](handleEntityNotFound(_0x437c78,null))[_0x7231('0x21')](respondWithResult(_0x437c78,null))['catch'](handleError(_0x437c78,null));};exports[_0x7231('0x46')]=function(_0x9530b3,_0x2053b0){return db[_0x7231('0x29')]['create'](_0x9530b3['body'],{})[_0x7231('0x21')](respondWithResult(_0x2053b0,0xc9))['catch'](handleError(_0x2053b0,null));};exports['update']=function(_0x1cff05,_0x39be91){if(_0x1cff05['body']['id']){delete _0x1cff05['body']['id'];}return db[_0x7231('0x29')][_0x7231('0x45')]({'where':{'id':_0x1cff05[_0x7231('0x44')]['id']}})['then'](handleEntityNotFound(_0x39be91,null))[_0x7231('0x21')](saveUpdates(_0x1cff05[_0x7231('0x47')],null))[_0x7231('0x21')](respondWithResult(_0x39be91,null))[_0x7231('0x48')](handleError(_0x39be91,null));};exports['destroy']=function(_0x482a3d,_0x148aeb){return db['FaxQueueReport'][_0x7231('0x45')]({'where':{'id':_0x482a3d[_0x7231('0x44')]['id']}})[_0x7231('0x21')](handleEntityNotFound(_0x148aeb,null))[_0x7231('0x21')](removeEntity(_0x148aeb,null))[_0x7231('0x48')](handleError(_0x148aeb,null));};exports[_0x7231('0x49')]=function(_0x2f76dd,_0x4382f5){return db[_0x7231('0x29')]['describe']()[_0x7231('0x21')](respondWithResult(_0x4382f5,null))[_0x7231('0x48')](handleError(_0x4382f5,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 45eb293..ecf052e 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 _0x2bd7=['exports','define','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x28de91,_0x866d78){var _0x4270e8=function(_0x12555b){while(--_0x12555b){_0x28de91['push'](_0x28de91['shift']());}};_0x4270e8(++_0x866d78);}(_0x2bd7,0x14d));var _0x72bd=function(_0x59e481,_0x230e86){_0x59e481=_0x59e481-0x0;var _0x3b19f7=_0x2bd7[_0x59e481];return _0x3b19f7;};'use strict';var _=require(_0x72bd('0x0'));var util=require(_0x72bd('0x1'));var logger=require(_0x72bd('0x2'))(_0x72bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x72bd('0x4'));var fs=require('fs');var path=require(_0x72bd('0x5'));var rimraf=require(_0x72bd('0x6'));var config=require(_0x72bd('0x7'));var attributes=require('./faxQueueReport.attributes');module[_0x72bd('0x8')]=function(_0x3f22ce,_0x19267a){return _0x3f22ce[_0x72bd('0x9')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x72bd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1508=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x1508,0xeb));var _0x8150=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1508[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x8150('0x0'));var util=require(_0x8150('0x1'));var logger=require(_0x8150('0x2'))(_0x8150('0x3'));var moment=require(_0x8150('0x4'));var BPromise=require(_0x8150('0x5'));var rp=require(_0x8150('0x6'));var fs=require('fs');var path=require(_0x8150('0x7'));var rimraf=require('rimraf');var config=require(_0x8150('0x8'));var attributes=require(_0x8150('0x9'));module[_0x8150('0xa')]=function(_0x5dec07,_0x34c4eb){return _0x5dec07['define'](_0x8150('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x8150('0xc'),'fields':[_0x8150('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ffb5363..68dc2ce 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 _0x3d13=['message','info','catch','CreateFaxQueueReport','create','body','options','raw','stringify','UpdateFaxQueueReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2831cf,_0x24babf){var _0x5ec206=function(_0x590587){while(--_0x590587){_0x2831cf['push'](_0x2831cf['shift']());}};_0x5ec206(++_0x24babf);}(_0x3d13,0x85));var _0x33d1=function(_0x4e1929,_0x67d4b7){_0x4e1929=_0x4e1929-0x0;var _0x46f25e=_0x3d13[_0x4e1929];return _0x46f25e;};'use strict';var _=require('lodash');var util=require(_0x33d1('0x0'));var moment=require(_0x33d1('0x1'));var BPromise=require(_0x33d1('0x2'));var rs=require(_0x33d1('0x3'));var fs=require('fs');var Redis=require(_0x33d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x33d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x33d1('0x6'));var jayson=require(_0x33d1('0x7'));var client=jayson['client'][_0x33d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x310c4e,_0x5964f3,_0x71a8ed){return new BPromise(function(_0x441d3a,_0x359871){return client[_0x33d1('0x9')](_0x310c4e,_0x71a8ed)[_0x33d1('0xa')](function(_0x34e5b3){logger['info'](_0x33d1('0xb'),_0x5964f3,'request\x20sent');logger[_0x33d1('0xc')](_0x33d1('0xd'),_0x5964f3,_0x33d1('0xe'),JSON['stringify'](_0x34e5b3));if(_0x34e5b3[_0x33d1('0xf')]){if(_0x34e5b3[_0x33d1('0xf')][_0x33d1('0x10')]===0x1f4){logger[_0x33d1('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x5964f3,_0x34e5b3[_0x33d1('0xf')][_0x33d1('0x11')]);return _0x359871(_0x34e5b3[_0x33d1('0xf')][_0x33d1('0x11')]);}logger[_0x33d1('0xf')](_0x33d1('0xb'),_0x5964f3,_0x34e5b3['error'][_0x33d1('0x11')]);return _0x441d3a(_0x34e5b3[_0x33d1('0xf')][_0x33d1('0x11')]);}else{logger[_0x33d1('0x12')](_0x33d1('0xb'),_0x5964f3,_0x33d1('0xe'));_0x441d3a(_0x34e5b3['result'][_0x33d1('0x11')]);}})[_0x33d1('0x13')](function(_0x215e7d){logger[_0x33d1('0xf')](_0x33d1('0xb'),_0x5964f3,_0x215e7d);_0x359871(_0x215e7d);});});}exports[_0x33d1('0x14')]=function(_0x11418a){var _0x323041=this;return new Promise(function(_0xf6751b,_0x3b35f6){return db['FaxQueueReport'][_0x33d1('0x15')](_0x11418a[_0x33d1('0x16')],{'raw':_0x11418a[_0x33d1('0x17')]?_0x11418a[_0x33d1('0x17')][_0x33d1('0x18')]===undefined?!![]:![]:!![]})[_0x33d1('0xa')](function(_0x27457a){logger[_0x33d1('0x12')](_0x33d1('0x14'),_0x11418a);logger['debug']('CreateFaxQueueReport',_0x11418a,JSON[_0x33d1('0x19')](_0x27457a));_0xf6751b(_0x27457a);})[_0x33d1('0x13')](function(_0x322aa9){logger['error']('CreateFaxQueueReport',_0x322aa9[_0x33d1('0x11')],_0x11418a);_0x3b35f6(_0x323041[_0x33d1('0xf')](0x1f4,_0x322aa9[_0x33d1('0x11')]));});});};exports[_0x33d1('0x1a')]=function(_0x5bc4b4){var _0x455939=this;return new Promise(function(_0x2e86cd,_0x57360e){return db['FaxQueueReport'][_0x33d1('0x1b')](_0x5bc4b4[_0x33d1('0x16')],{'raw':_0x5bc4b4[_0x33d1('0x17')]?_0x5bc4b4[_0x33d1('0x17')][_0x33d1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bc4b4['options']?_0x5bc4b4[_0x33d1('0x17')][_0x33d1('0x1c')]||null:null,'attributes':_0x5bc4b4[_0x33d1('0x17')]?_0x5bc4b4[_0x33d1('0x17')]['attributes']||null:null,'limit':_0x5bc4b4[_0x33d1('0x17')]?_0x5bc4b4[_0x33d1('0x17')][_0x33d1('0x1d')]||null:null})[_0x33d1('0xa')](function(_0x447086){logger[_0x33d1('0x12')](_0x33d1('0x1a'),_0x5bc4b4);logger[_0x33d1('0xc')](_0x33d1('0x1a'),_0x5bc4b4,JSON[_0x33d1('0x19')](_0x447086));_0x2e86cd(_0x447086);})['catch'](function(_0x251a61){logger['error']('UpdateFaxQueueReport',_0x251a61['message'],_0x5bc4b4);_0x57360e(_0x455939[_0x33d1('0xf')](0x1f4,_0x251a61[_0x33d1('0x11')]));});});}; \ No newline at end of file +var _0x622e=['FaxQueueReport','create','body','options','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport'];(function(_0x28ecb9,_0x47df3b){var _0xcca48b=function(_0x1812c7){while(--_0x1812c7){_0x28ecb9['push'](_0x28ecb9['shift']());}};_0xcca48b(++_0x47df3b);}(_0x622e,0x1d0));var _0xe622=function(_0x59db6c,_0x41e38b){_0x59db6c=_0x59db6c-0x0;var _0x475416=_0x622e[_0x59db6c];return _0x475416;};'use strict';var _=require(_0xe622('0x0'));var util=require(_0xe622('0x1'));var moment=require(_0xe622('0x2'));var BPromise=require(_0xe622('0x3'));var rs=require(_0xe622('0x4'));var fs=require('fs');var Redis=require(_0xe622('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe622('0x6'));var logger=require(_0xe622('0x7'))(_0xe622('0x8'));var config=require(_0xe622('0x9'));var jayson=require(_0xe622('0xa'));var client=jayson['client'][_0xe622('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fe659,_0x5d0ea0,_0x395f4f){return new BPromise(function(_0x1d23ad,_0x11e22d){return client[_0xe622('0xc')](_0x1fe659,_0x395f4f)[_0xe622('0xd')](function(_0x23c793){logger[_0xe622('0xe')](_0xe622('0xf'),_0x5d0ea0,_0xe622('0x10'));logger[_0xe622('0x11')](_0xe622('0x12'),_0x5d0ea0,'request\x20sent',JSON[_0xe622('0x13')](_0x23c793));if(_0x23c793[_0xe622('0x14')]){if(_0x23c793['error'][_0xe622('0x15')]===0x1f4){logger[_0xe622('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x5d0ea0,_0x23c793['error'][_0xe622('0x16')]);return _0x11e22d(_0x23c793[_0xe622('0x14')][_0xe622('0x16')]);}logger[_0xe622('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x5d0ea0,_0x23c793['error']['message']);return _0x1d23ad(_0x23c793[_0xe622('0x14')][_0xe622('0x16')]);}else{logger[_0xe622('0xe')](_0xe622('0xf'),_0x5d0ea0,_0xe622('0x10'));_0x1d23ad(_0x23c793[_0xe622('0x17')][_0xe622('0x16')]);}})[_0xe622('0x18')](function(_0x280add){logger[_0xe622('0x14')](_0xe622('0xf'),_0x5d0ea0,_0x280add);_0x11e22d(_0x280add);});});}exports[_0xe622('0x19')]=function(_0x297566){var _0x1e4a76=this;return new Promise(function(_0x4532e3,_0x3b90ee){return db[_0xe622('0x1a')][_0xe622('0x1b')](_0x297566[_0xe622('0x1c')],{'raw':_0x297566[_0xe622('0x1d')]?_0x297566[_0xe622('0x1d')][_0xe622('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x396951){logger[_0xe622('0xe')](_0xe622('0x19'),_0x297566);logger[_0xe622('0x11')](_0xe622('0x19'),_0x297566,JSON['stringify'](_0x396951));_0x4532e3(_0x396951);})[_0xe622('0x18')](function(_0x1cdc4e){logger[_0xe622('0x14')](_0xe622('0x19'),_0x1cdc4e[_0xe622('0x16')],_0x297566);_0x3b90ee(_0x1e4a76[_0xe622('0x14')](0x1f4,_0x1cdc4e[_0xe622('0x16')]));});});};exports['UpdateFaxQueueReport']=function(_0x33f3b3){var _0x1ff696=this;return new Promise(function(_0x2becd3,_0x2917bb){return db['FaxQueueReport']['update'](_0x33f3b3[_0xe622('0x1c')],{'raw':_0x33f3b3[_0xe622('0x1d')]?_0x33f3b3[_0xe622('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33f3b3['options']?_0x33f3b3[_0xe622('0x1d')][_0xe622('0x1f')]||null:null,'attributes':_0x33f3b3[_0xe622('0x1d')]?_0x33f3b3['options'][_0xe622('0x20')]||null:null,'limit':_0x33f3b3[_0xe622('0x1d')]?_0x33f3b3[_0xe622('0x1d')][_0xe622('0x21')]||null:null})[_0xe622('0xd')](function(_0x2fe373){logger['info'](_0xe622('0x22'),_0x33f3b3);logger[_0xe622('0x11')]('UpdateFaxQueueReport',_0x33f3b3,JSON[_0xe622('0x13')](_0x2fe373));_0x2becd3(_0x2fe373);})[_0xe622('0x18')](function(_0x44df8e){logger[_0xe622('0x14')]('UpdateFaxQueueReport',_0x44df8e[_0xe622('0x16')],_0x33f3b3);_0x2917bb(_0x1ff696['error'](0x1f4,_0x44df8e[_0xe622('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c6bb0f6..0d5e748 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 _0x6d6b=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2eee73,_0x3eecc4){var _0xb94756=function(_0x5ecf5d){while(--_0x5ecf5d){_0x2eee73['push'](_0x2eee73['shift']());}};_0xb94756(++_0x3eecc4);}(_0x6d6b,0x1ab));var _0xb6d6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6d6b[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb6d6('0x0'));var util=require(_0xb6d6('0x1'));var path=require('path');var timeout=require(_0xb6d6('0x2'));var express=require(_0xb6d6('0x3'));var router=express[_0xb6d6('0x4')]();var auth=require(_0xb6d6('0x5'));var interaction=require(_0xb6d6('0x6'));var config=require('../../config/environment');var controller=require(_0xb6d6('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb6d6('0x8')](_0xb6d6('0x9'),auth[_0xb6d6('0xa')](),controller[_0xb6d6('0xb')]);router['get'](_0xb6d6('0xc'),auth[_0xb6d6('0xa')](),controller[_0xb6d6('0xd')]);router[_0xb6d6('0xe')]('/',auth[_0xb6d6('0xa')](),controller[_0xb6d6('0xf')]);router[_0xb6d6('0x10')](_0xb6d6('0xc'),auth[_0xb6d6('0xa')](),controller[_0xb6d6('0x11')]);router[_0xb6d6('0x12')](_0xb6d6('0xc'),auth[_0xb6d6('0xa')](),controller[_0xb6d6('0x13')]);module[_0xb6d6('0x14')]=router; \ No newline at end of file +var _0xbf26=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x16f339,_0x21c709){var _0x2b61c4=function(_0x30dbe2){while(--_0x30dbe2){_0x16f339['push'](_0x16f339['shift']());}};_0x2b61c4(++_0x21c709);}(_0xbf26,0x142));var _0x6bf2=function(_0x553ccc,_0x48c69c){_0x553ccc=_0x553ccc-0x0;var _0x372475=_0xbf26[_0x553ccc];return _0x372475;};'use strict';var multer=require(_0x6bf2('0x0'));var util=require(_0x6bf2('0x1'));var path=require(_0x6bf2('0x2'));var timeout=require(_0x6bf2('0x3'));var express=require(_0x6bf2('0x4'));var router=express[_0x6bf2('0x5')]();var auth=require(_0x6bf2('0x6'));var interaction=require(_0x6bf2('0x7'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x6bf2('0x8')](),controller['index']);router[_0x6bf2('0x9')](_0x6bf2('0xa'),auth['isAuthenticated'](),controller[_0x6bf2('0xb')]);router['get'](_0x6bf2('0xc'),auth[_0x6bf2('0x8')](),controller[_0x6bf2('0xd')]);router[_0x6bf2('0xe')]('/',auth[_0x6bf2('0x8')](),controller[_0x6bf2('0xf')]);router[_0x6bf2('0x10')](_0x6bf2('0xc'),auth[_0x6bf2('0x8')](),controller[_0x6bf2('0x11')]);router[_0x6bf2('0x12')]('/:id',auth[_0x6bf2('0x8')](),controller['destroy']);module[_0x6bf2('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 eab333d..d283431 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 _0xec49=['DATE','NOW','moment','sequelize','STRING','ENUM','queue'];(function(_0x238290,_0x2a083f){var _0x334fc3=function(_0x3266a4){while(--_0x3266a4){_0x238290['push'](_0x238290['shift']());}};_0x334fc3(++_0x2a083f);}(_0xec49,0x12f));var _0x9ec4=function(_0x32e9f2,_0x256ad6){_0x32e9f2=_0x32e9f2-0x0;var _0x8b1ae0=_0xec49[_0x32e9f2];return _0x8b1ae0;};'use strict';var moment=require(_0x9ec4('0x0'));var Sequelize=require(_0x9ec4('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9ec4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9ec4('0x3')]('account','agent',_0x9ec4('0x4')),'allowNull':![],'defaultValue':_0x9ec4('0x4')},'transferredAt':{'type':Sequelize[_0x9ec4('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x9ec4('0x6')]}}; \ No newline at end of file +var _0x2814=['STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x298d21,_0x45f019){var _0x5b9e54=function(_0x270926){while(--_0x270926){_0x298d21['push'](_0x298d21['shift']());}};_0x5b9e54(++_0x45f019);}(_0x2814,0x16f));var _0x4281=function(_0x327d6e,_0x5923bd){_0x327d6e=_0x327d6e-0x0;var _0x4dc5d3=_0x2814[_0x327d6e];return _0x4dc5d3;};'use strict';var moment=require(_0x4281('0x0'));var Sequelize=require(_0x4281('0x1'));module[_0x4281('0x2')]={'uniqueid':{'type':Sequelize[_0x4281('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4281('0x4')](_0x4281('0x5'),_0x4281('0x6'),_0x4281('0x7')),'allowNull':![],'defaultValue':_0x4281('0x7')},'transferredAt':{'type':Sequelize[_0x4281('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x4281('0x9')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 83a23c3..fddf092 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 _0xdb28=['Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','set'];(function(_0x435893,_0x1be4eb){var _0x373985=function(_0x1cb5b6){while(--_0x1cb5b6){_0x435893['push'](_0x435893['shift']());}};_0x373985(++_0x1be4eb);}(_0xdb28,0x106));var _0x8db2=function(_0x493960,_0x42422f){_0x493960=_0x493960-0x0;var _0x2dd638=_0xdb28[_0x493960];return _0x2dd638;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];function respondWithStatusCode(_0x1349f6,_0x204f49){_0x204f49=_0x204f49||0xcc;return function(_0x37d017){if(_0x37d017){return _0x1349f6['sendStatus'](_0x204f49);}return _0x1349f6['status'](_0x204f49)[_0x8db2('0x18')]();};}function respondWithResult(_0x15e87c,_0x350d61){_0x350d61=_0x350d61||0xc8;return function(_0x1d6a15){if(_0x1d6a15){return _0x15e87c[_0x8db2('0x19')](_0x350d61)[_0x8db2('0x1a')](_0x1d6a15);}};}function respondWithFilteredResult(_0x2f177a,_0x3c96a7){return function(_0x131252){if(_0x131252){var _0x16c8c2=_0x131252['count'],_0x5489a9=_0x3c96a7[_0x8db2('0x1b')],_0x13b0f5=_0x3c96a7[_0x8db2('0x1b')]+_0x3c96a7[_0x8db2('0x1c')],_0x24da1b;if(_0x13b0f5>=_0x16c8c2){_0x13b0f5=_0x16c8c2;_0x24da1b=0xc8;}else{_0x24da1b=0xce;}_0x2f177a[_0x8db2('0x19')](_0x24da1b);return _0x2f177a[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x5489a9+'-'+_0x13b0f5+'/'+_0x16c8c2)['json'](_0x131252);}return null;};}function patchUpdates(_0x5df464){return function(_0x77789){try{jsonpatch[_0x8db2('0x1f')](_0x77789,_0x5df464,!![]);}catch(_0x1310d3){return BPromise[_0x8db2('0x20')](_0x1310d3);}return _0x77789['save']();};}function saveUpdates(_0x431d60,_0x36a9ff){return function(_0x260940){if(_0x260940){return _0x260940[_0x8db2('0x21')](_0x431d60)[_0x8db2('0x22')](function(_0x597260){return _0x597260;});}return null;};}function removeEntity(_0x124467,_0x3e30e6){return function(_0x18f69c){if(_0x18f69c){return _0x18f69c[_0x8db2('0x23')]()[_0x8db2('0x22')](function(){_0x124467[_0x8db2('0x19')](0xcc)[_0x8db2('0x18')]();});}};}function handleEntityNotFound(_0x5c6614,_0x256202){return function(_0x4f6516){if(!_0x4f6516){_0x5c6614['sendStatus'](0x194);}return _0x4f6516;};}function handleError(_0x52a9ca,_0x4d923c){_0x4d923c=_0x4d923c||0x1f4;return function(_0xec8cd2){logger[_0x8db2('0x24')](_0xec8cd2[_0x8db2('0x25')]);if(_0xec8cd2[_0x8db2('0x26')]){delete _0xec8cd2[_0x8db2('0x26')];}_0x52a9ca[_0x8db2('0x19')](_0x4d923c)['send'](_0xec8cd2);};}exports[_0x8db2('0x27')]=function(_0x372311,_0x430dd5){var _0x8b7cec={},_0x483aee={},_0x2e0691={'count':0x0,'rows':[]};var _0x11f398=_[_0x8db2('0x28')](db[_0x8db2('0x29')][_0x8db2('0x2a')],function(_0x21bae5){return{'name':_0x21bae5[_0x8db2('0x2b')],'type':_0x21bae5[_0x8db2('0x2c')][_0x8db2('0x2d')]};});_0x483aee['model']=_[_0x8db2('0x28')](_0x11f398,'name');_0x483aee['query']=_[_0x8db2('0x2e')](_0x372311[_0x8db2('0x2f')]);_0x483aee[_0x8db2('0x30')]=_['intersection'](_0x483aee[_0x8db2('0x31')],_0x483aee['query']);_0x8b7cec[_0x8db2('0x32')]=_[_0x8db2('0x33')](_0x483aee[_0x8db2('0x31')],qs['fields'](_0x372311['query'][_0x8db2('0x34')]));_0x8b7cec[_0x8db2('0x32')]=_0x8b7cec['attributes']['length']?_0x8b7cec[_0x8db2('0x32')]:_0x483aee[_0x8db2('0x31')];if(!_0x372311[_0x8db2('0x2f')][_0x8db2('0x35')](_0x8db2('0x36'))){_0x8b7cec[_0x8db2('0x1c')]=qs[_0x8db2('0x1c')](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1c')]);_0x8b7cec[_0x8db2('0x1b')]=qs['offset'](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1b')]);}_0x8b7cec['order']=qs[_0x8db2('0x37')](_0x372311[_0x8db2('0x2f')]['sort']);_0x8b7cec['where']=qs[_0x8db2('0x30')](_['pick'](_0x372311[_0x8db2('0x2f')],_0x483aee[_0x8db2('0x30')]),_0x11f398);if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]){_0x8b7cec['where']=_[_0x8db2('0x39')](_0x8b7cec['where'],{'$or':_[_0x8db2('0x28')](_0x11f398,function(_0xd550ae){if(_0xd550ae[_0x8db2('0x2c')]!==_0x8db2('0x3a')){var _0x50e88a={};_0x50e88a[_0xd550ae['name']]={'$like':'%'+_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]+'%'};return _0x50e88a;}})});}_0x8b7cec=_['merge']({},_0x8b7cec,_0x372311[_0x8db2('0x3b')]);var _0x24bcfe={'where':_0x8b7cec[_0x8db2('0x3c')]};return db['FaxTransferReport'][_0x8db2('0x3d')](_0x24bcfe)[_0x8db2('0x22')](function(_0x953349){_0x2e0691[_0x8db2('0x3d')]=_0x953349;if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x3e')]){_0x8b7cec[_0x8db2('0x3f')]=[{'all':!![]}];}return db[_0x8db2('0x29')][_0x8db2('0x40')](_0x8b7cec);})[_0x8db2('0x22')](function(_0x21cf7c){_0x2e0691[_0x8db2('0x41')]=_0x21cf7c;return _0x2e0691;})[_0x8db2('0x22')](respondWithFilteredResult(_0x430dd5,_0x8b7cec))['catch'](handleError(_0x430dd5,null));};exports[_0x8db2('0x42')]=function(_0x2b2472,_0x5e0382){var _0x49a7ae={'raw':!![],'where':{'id':_0x2b2472['params']['id']}},_0x249c73={};_0x249c73[_0x8db2('0x31')]=_[_0x8db2('0x2e')](db[_0x8db2('0x29')][_0x8db2('0x2a')]);_0x249c73[_0x8db2('0x2f')]=_[_0x8db2('0x2e')](_0x2b2472[_0x8db2('0x2f')]);_0x249c73['filters']=_[_0x8db2('0x33')](_0x249c73[_0x8db2('0x31')],_0x249c73[_0x8db2('0x2f')]);_0x49a7ae[_0x8db2('0x32')]=_['intersection'](_0x249c73[_0x8db2('0x31')],qs[_0x8db2('0x34')](_0x2b2472[_0x8db2('0x2f')][_0x8db2('0x34')]));_0x49a7ae['attributes']=_0x49a7ae[_0x8db2('0x32')]['length']?_0x49a7ae[_0x8db2('0x32')]:_0x249c73[_0x8db2('0x31')];if(_0x2b2472[_0x8db2('0x2f')]['includeAll']){_0x49a7ae['include']=[{'all':!![]}];}_0x49a7ae=_[_0x8db2('0x39')]({},_0x49a7ae,_0x2b2472['options']);return db[_0x8db2('0x29')][_0x8db2('0x43')](_0x49a7ae)[_0x8db2('0x22')](handleEntityNotFound(_0x5e0382,null))[_0x8db2('0x22')](respondWithResult(_0x5e0382,null))[_0x8db2('0x44')](handleError(_0x5e0382,null));};exports[_0x8db2('0x45')]=function(_0x4355e2,_0xab6bdd){return db[_0x8db2('0x29')][_0x8db2('0x45')](_0x4355e2[_0x8db2('0x46')],{})[_0x8db2('0x22')](respondWithResult(_0xab6bdd,0xc9))['catch'](handleError(_0xab6bdd,null));};exports[_0x8db2('0x21')]=function(_0x2ada52,_0xdbba64){if(_0x2ada52[_0x8db2('0x46')]['id']){delete _0x2ada52['body']['id'];}return db['FaxTransferReport'][_0x8db2('0x43')]({'where':{'id':_0x2ada52[_0x8db2('0x47')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0xdbba64,null))['then'](saveUpdates(_0x2ada52['body'],null))['then'](respondWithResult(_0xdbba64,null))[_0x8db2('0x44')](handleError(_0xdbba64,null));};exports[_0x8db2('0x23')]=function(_0x55c7dd,_0x383fa1){return db[_0x8db2('0x29')][_0x8db2('0x43')]({'where':{'id':_0x55c7dd[_0x8db2('0x47')]['id']}})['then'](handleEntityNotFound(_0x383fa1,null))['then'](removeEntity(_0x383fa1,null))[_0x8db2('0x44')](handleError(_0x383fa1,null));};exports[_0x8db2('0x48')]=function(_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x29')][_0x8db2('0x48')]()[_0x8db2('0x22')](respondWithResult(_0x2f0bd0,null))[_0x8db2('0x44')](handleError(_0x2f0bd0,null));}; \ No newline at end of file +var _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x8bdc41,_0x13f1a8){var _0x394b30=function(_0x53f029){while(--_0x53f029){_0x8bdc41['push'](_0x8bdc41['shift']());}};_0x394b30(++_0x13f1a8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 622e68f..217bdcc 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 _0xf604=['FaxTransferReport','report_fax_transfer','uniqueid','api','moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x5dd218,_0x4bc745){var _0x2e1004=function(_0x1f8c87){while(--_0x1f8c87){_0x5dd218['push'](_0x5dd218['shift']());}};_0x2e1004(++_0x4bc745);}(_0xf604,0x67));var _0x4f60=function(_0x1b62b8,_0x3e78d9){_0x1b62b8=_0x1b62b8-0x0;var _0x47a5a0=_0xf604[_0x1b62b8];return _0x47a5a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4f60('0x0'));var moment=require(_0x4f60('0x1'));var BPromise=require('bluebird');var rp=require(_0x4f60('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f60('0x3'));var config=require(_0x4f60('0x4'));var attributes=require(_0x4f60('0x5'));module[_0x4f60('0x6')]=function(_0x40a81e,_0x47cc4b){return _0x40a81e['define'](_0x4f60('0x7'),attributes,{'tableName':_0x4f60('0x8'),'paranoid':![],'indexes':[{'name':_0x4f60('0x9'),'fields':[_0x4f60('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xecb1=['moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xecb1,0x19d));var _0x1ecb=function(_0xf7ca15,_0x25ca35){_0xf7ca15=_0xf7ca15-0x0;var _0x4fdb4f=_0xecb1[_0xf7ca15];return _0x4fdb4f;};'use strict';var _=require(_0x1ecb('0x0'));var util=require(_0x1ecb('0x1'));var logger=require(_0x1ecb('0x2'))('api');var moment=require(_0x1ecb('0x3'));var BPromise=require(_0x1ecb('0x4'));var rp=require(_0x1ecb('0x5'));var fs=require('fs');var path=require(_0x1ecb('0x6'));var rimraf=require('rimraf');var config=require(_0x1ecb('0x7'));var attributes=require(_0x1ecb('0x8'));module['exports']=function(_0x344150,_0x1d4fd3){return _0x344150[_0x1ecb('0x9')](_0x1ecb('0xa'),attributes,{'tableName':_0x1ecb('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1ecb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 340eb3b..8014897 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 _0x8ee0=['then','info','request\x20sent','debug','error','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x400b01,_0xbb869d){var _0x10c75e=function(_0x5b592b){while(--_0x5b592b){_0x400b01['push'](_0x400b01['shift']());}};_0x10c75e(++_0xbb869d);}(_0x8ee0,0xd0));var _0x08ee=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x8ee0[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0x08ee('0x0'));var util=require(_0x08ee('0x1'));var moment=require(_0x08ee('0x2'));var BPromise=require(_0x08ee('0x3'));var rs=require(_0x08ee('0x4'));var fs=require('fs');var Redis=require(_0x08ee('0x5'));var db=require(_0x08ee('0x6'))['db'];var utils=require(_0x08ee('0x7'));var logger=require(_0x08ee('0x8'))('rpc');var config=require(_0x08ee('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x08ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30bf1b,_0x443b0f,_0x484490){return new BPromise(function(_0x1450a1,_0x244c08){return client[_0x08ee('0xb')](_0x30bf1b,_0x484490)[_0x08ee('0xc')](function(_0x54e968){logger[_0x08ee('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x443b0f,_0x08ee('0xe'));logger[_0x08ee('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x443b0f,_0x08ee('0xe'),JSON['stringify'](_0x54e968));if(_0x54e968['error']){if(_0x54e968[_0x08ee('0x10')]['code']===0x1f4){logger[_0x08ee('0x10')](_0x08ee('0x11'),_0x443b0f,_0x54e968[_0x08ee('0x10')][_0x08ee('0x12')]);return _0x244c08(_0x54e968['error'][_0x08ee('0x12')]);}logger[_0x08ee('0x10')](_0x08ee('0x11'),_0x443b0f,_0x54e968['error'][_0x08ee('0x12')]);return _0x1450a1(_0x54e968['error'][_0x08ee('0x12')]);}else{logger[_0x08ee('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x443b0f,_0x08ee('0xe'));_0x1450a1(_0x54e968[_0x08ee('0x13')]['message']);}})['catch'](function(_0x3238a3){logger[_0x08ee('0x10')](_0x08ee('0x11'),_0x443b0f,_0x3238a3);_0x244c08(_0x3238a3);});});} \ No newline at end of file +var _0xfa67=['info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','then'];(function(_0x2d9db9,_0x5a9756){var _0x1168f5=function(_0x1be06d){while(--_0x1be06d){_0x2d9db9['push'](_0x2d9db9['shift']());}};_0x1168f5(++_0x5a9756);}(_0xfa67,0x15e));var _0x7fa6=function(_0x1ec3fe,_0x2b8c1e){_0x1ec3fe=_0x1ec3fe-0x0;var _0x47695b=_0xfa67[_0x1ec3fe];return _0x47695b;};'use strict';var _=require(_0x7fa6('0x0'));var util=require(_0x7fa6('0x1'));var moment=require(_0x7fa6('0x2'));var BPromise=require(_0x7fa6('0x3'));var rs=require(_0x7fa6('0x4'));var fs=require('fs');var Redis=require(_0x7fa6('0x5'));var db=require(_0x7fa6('0x6'))['db'];var utils=require(_0x7fa6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7fa6('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca62f,_0x5df59e,_0x31d0d3){return new BPromise(function(_0x4b7b53,_0x67fe40){return client['request'](_0x5ca62f,_0x31d0d3)[_0x7fa6('0x9')](function(_0x127f41){logger[_0x7fa6('0xa')](_0x7fa6('0xb'),_0x5df59e,'request\x20sent');logger[_0x7fa6('0xc')](_0x7fa6('0xd'),_0x5df59e,_0x7fa6('0xe'),JSON[_0x7fa6('0xf')](_0x127f41));if(_0x127f41['error']){if(_0x127f41[_0x7fa6('0x10')][_0x7fa6('0x11')]===0x1f4){logger[_0x7fa6('0x10')](_0x7fa6('0xb'),_0x5df59e,_0x127f41[_0x7fa6('0x10')]['message']);return _0x67fe40(_0x127f41[_0x7fa6('0x10')][_0x7fa6('0x12')]);}logger[_0x7fa6('0x10')](_0x7fa6('0xb'),_0x5df59e,_0x127f41[_0x7fa6('0x10')][_0x7fa6('0x12')]);return _0x4b7b53(_0x127f41['error']['message']);}else{logger[_0x7fa6('0xa')](_0x7fa6('0xb'),_0x5df59e,'request\x20sent');_0x4b7b53(_0x127f41[_0x7fa6('0x13')]['message']);}})['catch'](function(_0x55d83f){logger[_0x7fa6('0x10')](_0x7fa6('0xb'),_0x5df59e,_0x55d83f);_0x67fe40(_0x55d83f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a18789f..5679b94 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 _0xb3a4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x28555b,_0x342cdc){var _0x4d11fb=function(_0x172a0f){while(--_0x172a0f){_0x28555b['push'](_0x28555b['shift']());}};_0x4d11fb(++_0x342cdc);}(_0xb3a4,0x151));var _0x4b3a=function(_0x101b82,_0x26e3ac){_0x101b82=_0x101b82-0x0;var _0xfb5edd=_0xb3a4[_0x101b82];return _0xfb5edd;};'use strict';var multer=require(_0x4b3a('0x0'));var util=require('util');var path=require(_0x4b3a('0x1'));var timeout=require(_0x4b3a('0x2'));var express=require(_0x4b3a('0x3'));var router=express[_0x4b3a('0x4')]();var auth=require(_0x4b3a('0x5'));var interaction=require(_0x4b3a('0x6'));var config=require(_0x4b3a('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x4b3a('0x8')](),controller[_0x4b3a('0x9')]);router['get'](_0x4b3a('0xa'),auth[_0x4b3a('0x8')](),controller[_0x4b3a('0xb')]);router[_0x4b3a('0xc')](_0x4b3a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4b3a('0xe')]('/',auth[_0x4b3a('0x8')](),controller[_0x4b3a('0xf')]);router[_0x4b3a('0x10')](_0x4b3a('0xd'),auth[_0x4b3a('0x8')](),controller['update']);router[_0x4b3a('0x11')](_0x4b3a('0xd'),auth[_0x4b3a('0x8')](),controller[_0x4b3a('0x12')]);module[_0x4b3a('0x13')]=router; \ No newline at end of file +var _0x70b0=['isAuthenticated','describe','/:id','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','index','/describe'];(function(_0x37b843,_0x4fe38a){var _0x150307=function(_0x4cdaf2){while(--_0x4cdaf2){_0x37b843['push'](_0x37b843['shift']());}};_0x150307(++_0x4fe38a);}(_0x70b0,0x1d0));var _0x070b=function(_0x3b1e6f,_0x17e752){_0x3b1e6f=_0x3b1e6f-0x0;var _0x5760a2=_0x70b0[_0x3b1e6f];return _0x5760a2;};'use strict';var multer=require(_0x070b('0x0'));var util=require(_0x070b('0x1'));var path=require(_0x070b('0x2'));var timeout=require('connect-timeout');var express=require(_0x070b('0x3'));var router=express[_0x070b('0x4')]();var auth=require(_0x070b('0x5'));var interaction=require(_0x070b('0x6'));var config=require('../../config/environment');var controller=require(_0x070b('0x7'));router[_0x070b('0x8')]('/',auth['isAuthenticated'](),controller[_0x070b('0x9')]);router['get'](_0x070b('0xa'),auth[_0x070b('0xb')](),controller[_0x070b('0xc')]);router[_0x070b('0x8')](_0x070b('0xd'),auth[_0x070b('0xb')](),controller['show']);router['post']('/',auth[_0x070b('0xb')](),controller[_0x070b('0xe')]);router[_0x070b('0xf')]('/:id',auth[_0x070b('0xb')](),controller[_0x070b('0x10')]);router[_0x070b('0x11')]('/:id',auth[_0x070b('0xb')](),controller[_0x070b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index fa2818a..7b55adf 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 _0x6b8f=['destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','addConfiguration','put','delete'];(function(_0x3c2407,_0x3c9a47){var _0x5d2eac=function(_0xb33bf8){while(--_0xb33bf8){_0x3c2407['push'](_0x3c2407['shift']());}};_0x5d2eac(++_0x3c9a47);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x57d6e7,_0x209339){_0x57d6e7=_0x57d6e7-0x0;var _0x33a428=_0x6b8f[_0x57d6e7];return _0x33a428;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xf6b8('0x2'));var interaction=require(_0xf6b8('0x3'));var config=require('../../config/environment');var controller=require(_0xf6b8('0x4'));router[_0xf6b8('0x5')]('/',auth[_0xf6b8('0x6')](),controller['index']);router[_0xf6b8('0x5')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x8')]);router['get']('/:id/configurations',auth[_0xf6b8('0x6')](),controller['getConfigurations']);router[_0xf6b8('0x5')](_0xf6b8('0x9'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xa')]);router[_0xf6b8('0xb')]('/',auth[_0xf6b8('0x6')](),controller['create']);router['post']('/:id/configurations',auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xc')]);router[_0xf6b8('0xd')](_0xf6b8('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xf6b8('0xe')](_0xf6b8('0x7'),auth['isAuthenticated'](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file +var _0x41fe=['isAuthenticated','index','/:id','show','/:id/configurations','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0x143fc3,_0x31c880){var _0x3ea3d4=function(_0x3a2f3e){while(--_0x3a2f3e){_0x143fc3['push'](_0x143fc3['shift']());}};_0x3ea3d4(++_0x31c880);}(_0x41fe,0xd1));var _0xe41f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x41fe[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var path=require(_0xe41f('0x2'));var timeout=require(_0xe41f('0x3'));var express=require(_0xe41f('0x4'));var router=express[_0xe41f('0x5')]();var auth=require(_0xe41f('0x6'));var interaction=require(_0xe41f('0x7'));var config=require(_0xe41f('0x8'));var controller=require(_0xe41f('0x9'));router[_0xe41f('0xa')]('/',auth[_0xe41f('0xb')](),controller[_0xe41f('0xc')]);router[_0xe41f('0xa')](_0xe41f('0xd'),auth[_0xe41f('0xb')](),controller[_0xe41f('0xe')]);router['get'](_0xe41f('0xf'),auth[_0xe41f('0xb')](),controller['getConfigurations']);router[_0xe41f('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xe41f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe41f('0xf'),auth[_0xe41f('0xb')](),controller[_0xe41f('0x11')]);router[_0xe41f('0x12')](_0xe41f('0xd'),auth[_0xe41f('0xb')](),controller[_0xe41f('0x13')]);router[_0xe41f('0x14')](_0xe41f('0xd'),auth[_0xe41f('0xb')](),controller['destroy']);module[_0xe41f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index bf880ce..4c7eb64 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 _0x3d7c=['sequelize','exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d7c,0x19d));var _0xc3d7=function(_0x51a72c,_0x2143d7){_0x51a72c=_0x51a72c-0x0;var _0x262c9b=_0x3d7c[_0x51a72c];return _0x262c9b;};'use strict';var Sequelize=require(_0xc3d7('0x0'));module[_0xc3d7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc3d7('0x2')]},'username':{'type':Sequelize[_0xc3d7('0x2')]},'remoteUri':{'type':Sequelize[_0xc3d7('0x2')]},'authType':{'type':Sequelize[_0xc3d7('0x3')](_0xc3d7('0x4')),'defaultValue':_0xc3d7('0x4')},'password':{'type':Sequelize[_0xc3d7('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xc3d7('0x2')]},'token':{'type':Sequelize[_0xc3d7('0x2')]},'tokenSecret':{'type':Sequelize[_0xc3d7('0x2')]},'serverUrl':{'type':Sequelize[_0xc3d7('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xc3d7('0x5')),'defaultValue':_0xc3d7('0x6')}}; \ No newline at end of file +var _0x9df7=['sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x28f8ce,_0x54a540){var _0x1b351c=function(_0x3564c7){while(--_0x3564c7){_0x28f8ce['push'](_0x28f8ce['shift']());}};_0x1b351c(++_0x54a540);}(_0x9df7,0xf0));var _0x79df=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0x9df7[_0x18b344];return _0x5ef6bb;};'use strict';var Sequelize=require(_0x79df('0x0'));module[_0x79df('0x1')]={'name':{'type':Sequelize[_0x79df('0x2')]},'description':{'type':Sequelize[_0x79df('0x2')]},'username':{'type':Sequelize[_0x79df('0x2')]},'remoteUri':{'type':Sequelize[_0x79df('0x2')]},'authType':{'type':Sequelize[_0x79df('0x3')](_0x79df('0x4')),'defaultValue':_0x79df('0x4')},'password':{'type':Sequelize[_0x79df('0x2')]},'consumerKey':{'type':Sequelize[_0x79df('0x2')]},'consumerSecret':{'type':Sequelize[_0x79df('0x2')]},'token':{'type':Sequelize[_0x79df('0x2')]},'tokenSecret':{'type':Sequelize[_0x79df('0x2')]},'serverUrl':{'type':Sequelize[_0x79df('0x2')]},'type':{'type':Sequelize[_0x79df('0x3')](_0x79df('0x5'),'newTab'),'defaultValue':_0x79df('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index de6ced3..4a86785 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 _0x2c65=['reject','save','update','destroy','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','params','length','find','create','body','getConfigurations','findOne','DeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','authType','basic','headers','Basic\x20%s','format','%s:%s','toString','concat','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','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~!@#$%^&-_=+[{]}.','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','end','json','count','limit','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c65,0xd1));var _0x52c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c65[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x52c6('0x0'));var emlformat=require(_0x52c6('0x1'));var rimraf=require(_0x52c6('0x2'));var zipdir=require(_0x52c6('0x3'));var jsonpatch=require(_0x52c6('0x4'));var rp=require(_0x52c6('0x5'));var moment=require(_0x52c6('0x6'));var BPromise=require(_0x52c6('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x52c6('0x8'));var sox=require(_0x52c6('0x9'));var csv=require('to-csv');var ejs=require(_0x52c6('0xa'));var fs=require('fs');var _=require(_0x52c6('0xb'));var squel=require(_0x52c6('0xc'));var crypto=require('crypto');var jsforce=require(_0x52c6('0xd'));var deskjs=require(_0x52c6('0xe'));var toCsv=require(_0x52c6('0xf'));var querystring=require(_0x52c6('0x10'));var Papa=require(_0x52c6('0x11'));var Redis=require(_0x52c6('0x12'));var authService=require(_0x52c6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52c6('0x14'));var logger=require(_0x52c6('0x15'))('api');var utils=require(_0x52c6('0x16'));var config=require(_0x52c6('0x17'));var db=require(_0x52c6('0x18'))['db'];var integrations=require(_0x52c6('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x52c6('0x1a')][_0x52c6('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x403872,_0x3c4967,_0x4ce6c1){if(_0x4ce6c1){var _0x17ca90=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17ca90['test'](_0x3c4967)){return _0x403872;}else{throw new db['Sequelize'][(_0x52c6('0x1c'))](_0x52c6('0x1d'));}}else{return _0x403872;}}function respondWithRpcPromise(_0x578d22,_0x4f03da,_0x139166,_0xd41f5f){return new BPromise(function(_0x7d7b4f,_0x23e4ac){var _0x1e61e4=_0xd41f5f||client;return _0x1e61e4[_0x52c6('0x1e')](_0x578d22,_0x139166)[_0x52c6('0x1f')](function(_0x120c81){logger['info'](_0x52c6('0x20'),_0x4f03da,_0x52c6('0x21'));logger[_0x52c6('0x22')](_0x52c6('0x23'),_0x4f03da,_0x52c6('0x21'),JSON['stringify'](_0x120c81));if(_0x120c81[_0x52c6('0x24')]){if(_0x120c81[_0x52c6('0x24')][_0x52c6('0x25')]===0x1f4){logger[_0x52c6('0x24')](_0x52c6('0x20'),_0x4f03da,_0x120c81[_0x52c6('0x24')][_0x52c6('0x26')]);return _0x23e4ac(_0x120c81[_0x52c6('0x24')][_0x52c6('0x26')]);}logger['error'](_0x52c6('0x20'),_0x4f03da,_0x120c81[_0x52c6('0x24')][_0x52c6('0x26')]);return _0x7d7b4f(_0x120c81['error'][_0x52c6('0x26')]);}else{logger[_0x52c6('0x27')](_0x52c6('0x20'),_0x4f03da,_0x52c6('0x21'));_0x7d7b4f(_0x120c81['result'][_0x52c6('0x26')]);}})[_0x52c6('0x28')](function(_0xca5739){logger[_0x52c6('0x24')](_0x52c6('0x20'),_0x4f03da,_0xca5739);_0x23e4ac(_0xca5739);});});}function respondWithStatusCode(_0x5dceb4,_0x54cd10){_0x54cd10=_0x54cd10||0xcc;return function(_0x55abdb){if(_0x55abdb){return _0x5dceb4['sendStatus'](_0x54cd10);}return _0x5dceb4[_0x52c6('0x29')](_0x54cd10)[_0x52c6('0x2a')]();};}function respondWithResult(_0x3c0707,_0x2b40ba){_0x2b40ba=_0x2b40ba||0xc8;return function(_0x24abc5){if(_0x24abc5){return _0x3c0707['status'](_0x2b40ba)[_0x52c6('0x2b')](_0x24abc5);}};}function respondWithFilteredResult(_0x1f5213,_0x4ec787){return function(_0x23ea3a){if(_0x23ea3a){var _0x4659c1=_0x23ea3a[_0x52c6('0x2c')],_0x6203c8=_0x4ec787['offset'],_0x9e1e47=_0x4ec787['offset']+_0x4ec787[_0x52c6('0x2d')],_0x2b41c0;if(_0x9e1e47>=_0x4659c1){_0x9e1e47=_0x4659c1;_0x2b41c0=0xc8;}else{_0x2b41c0=0xce;}_0x1f5213[_0x52c6('0x29')](_0x2b41c0);return _0x1f5213['set'](_0x52c6('0x2e'),_0x6203c8+'-'+_0x9e1e47+'/'+_0x4659c1)[_0x52c6('0x2b')](_0x23ea3a);}return null;};}function patchUpdates(_0x746de3){return function(_0x46d8d1){try{jsonpatch['apply'](_0x46d8d1,_0x746de3,!![]);}catch(_0x3c84ba){return BPromise[_0x52c6('0x2f')](_0x3c84ba);}return _0x46d8d1[_0x52c6('0x30')]();};}function saveUpdates(_0x41d0fa,_0x19998c){return function(_0x1b3770){if(_0x1b3770){return _0x1b3770[_0x52c6('0x31')](_0x41d0fa)['then'](function(_0x5b0bcc){return _0x5b0bcc;});}return null;};}function removeEntity(_0x2818e3,_0x515da2){return function(_0x1a6b90){if(_0x1a6b90){return _0x1a6b90[_0x52c6('0x32')]()['then'](function(){_0x2818e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x257eab,_0x1cac5c){return function(_0x22c8f7){if(!_0x22c8f7){_0x257eab[_0x52c6('0x33')](0x194);}return _0x22c8f7;};}function handleError(_0x40a9a6,_0x5d3761){_0x5d3761=_0x5d3761||0x1f4;return function(_0x9c8017){logger[_0x52c6('0x24')](_0x9c8017[_0x52c6('0x34')]);if(_0x9c8017[_0x52c6('0x35')]){delete _0x9c8017['name'];}_0x40a9a6[_0x52c6('0x29')](_0x5d3761)[_0x52c6('0x36')](_0x9c8017);};}exports[_0x52c6('0x37')]=function(_0x334e40,_0x2b1d3b){var _0x4eb287={},_0x391fd8={},_0x4c4e39={'count':0x0,'rows':[]};var _0x3ce5ca=_['map'](db[_0x52c6('0x38')][_0x52c6('0x39')],function(_0x231dce){return{'name':_0x231dce[_0x52c6('0x3a')],'type':_0x231dce[_0x52c6('0x3b')][_0x52c6('0x3c')]};});_0x391fd8[_0x52c6('0x3d')]=_[_0x52c6('0x3e')](_0x3ce5ca,_0x52c6('0x35'));_0x391fd8['query']=_[_0x52c6('0x3f')](_0x334e40[_0x52c6('0x40')]);_0x391fd8['filters']=_['intersection'](_0x391fd8[_0x52c6('0x3d')],_0x391fd8['query']);_0x4eb287[_0x52c6('0x41')]=_[_0x52c6('0x42')](_0x391fd8[_0x52c6('0x3d')],qs[_0x52c6('0x43')](_0x334e40[_0x52c6('0x40')][_0x52c6('0x43')]));_0x4eb287[_0x52c6('0x41')]=_0x4eb287[_0x52c6('0x41')]['length']?_0x4eb287['attributes']:_0x391fd8[_0x52c6('0x3d')];if(!_0x334e40[_0x52c6('0x40')][_0x52c6('0x44')](_0x52c6('0x45'))){_0x4eb287[_0x52c6('0x2d')]=qs[_0x52c6('0x2d')](_0x334e40['query'][_0x52c6('0x2d')]);_0x4eb287[_0x52c6('0x46')]=qs[_0x52c6('0x46')](_0x334e40[_0x52c6('0x40')]['offset']);}_0x4eb287[_0x52c6('0x47')]=qs[_0x52c6('0x48')](_0x334e40['query'][_0x52c6('0x48')]);_0x4eb287[_0x52c6('0x49')]=qs[_0x52c6('0x4a')](_['pick'](_0x334e40['query'],_0x391fd8[_0x52c6('0x4a')]),_0x3ce5ca);if(_0x334e40[_0x52c6('0x40')][_0x52c6('0x4b')]){_0x4eb287[_0x52c6('0x49')]=_[_0x52c6('0x4c')](_0x4eb287[_0x52c6('0x49')],{'$or':_[_0x52c6('0x3e')](_0x3ce5ca,function(_0xf4290d){if(_0xf4290d[_0x52c6('0x3b')]!==_0x52c6('0x4d')){var _0x1caf0c={};_0x1caf0c[_0xf4290d[_0x52c6('0x35')]]={'$like':'%'+_0x334e40[_0x52c6('0x40')][_0x52c6('0x4b')]+'%'};return _0x1caf0c;}})});}_0x4eb287=_[_0x52c6('0x4c')]({},_0x4eb287,_0x334e40[_0x52c6('0x4e')]);var _0x4e840a={'where':_0x4eb287[_0x52c6('0x49')]};return db[_0x52c6('0x38')][_0x52c6('0x2c')](_0x4e840a)['then'](function(_0x2a011b){_0x4c4e39[_0x52c6('0x2c')]=_0x2a011b;if(_0x334e40[_0x52c6('0x40')][_0x52c6('0x4f')]){_0x4eb287[_0x52c6('0x50')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x4eb287);})['then'](function(_0x49018e){_0x4c4e39[_0x52c6('0x51')]=_0x49018e;return _0x4c4e39;})[_0x52c6('0x1f')](respondWithFilteredResult(_0x2b1d3b,_0x4eb287))[_0x52c6('0x28')](handleError(_0x2b1d3b,null));};exports['show']=function(_0x142630,_0x5eb8c6){var _0x1aaef1={'raw':![],'where':{'id':_0x142630[_0x52c6('0x52')]['id']}},_0x58c21d={};_0x58c21d[_0x52c6('0x3d')]=_['keys'](db[_0x52c6('0x38')][_0x52c6('0x39')]);_0x58c21d['query']=_['keys'](_0x142630[_0x52c6('0x40')]);_0x58c21d[_0x52c6('0x4a')]=_['intersection'](_0x58c21d[_0x52c6('0x3d')],_0x58c21d[_0x52c6('0x40')]);_0x1aaef1[_0x52c6('0x41')]=_[_0x52c6('0x42')](_0x58c21d[_0x52c6('0x3d')],qs['fields'](_0x142630[_0x52c6('0x40')]['fields']));_0x1aaef1[_0x52c6('0x41')]=_0x1aaef1[_0x52c6('0x41')][_0x52c6('0x53')]?_0x1aaef1[_0x52c6('0x41')]:_0x58c21d[_0x52c6('0x3d')];if(_0x142630['query']['includeAll']){_0x1aaef1[_0x52c6('0x50')]=[{'all':!![]}];}_0x1aaef1=_[_0x52c6('0x4c')]({},_0x1aaef1,_0x142630[_0x52c6('0x4e')]);return db[_0x52c6('0x38')][_0x52c6('0x54')](_0x1aaef1)[_0x52c6('0x1f')](handleEntityNotFound(_0x5eb8c6,null))['then'](respondWithResult(_0x5eb8c6,null))['catch'](handleError(_0x5eb8c6,null));};exports[_0x52c6('0x55')]=function(_0x1eb99c,_0x14bb0d){return db[_0x52c6('0x38')][_0x52c6('0x55')](_0x1eb99c[_0x52c6('0x56')],{})['then'](respondWithResult(_0x14bb0d,0xc9))[_0x52c6('0x28')](handleError(_0x14bb0d,null));};exports[_0x52c6('0x31')]=function(_0x310297,_0x2d1397){if(_0x310297['body']['id']){delete _0x310297[_0x52c6('0x56')]['id'];}return db[_0x52c6('0x38')][_0x52c6('0x54')]({'where':{'id':_0x310297['params']['id']}})['then'](handleEntityNotFound(_0x2d1397,null))[_0x52c6('0x1f')](saveUpdates(_0x310297[_0x52c6('0x56')],null))['then'](respondWithResult(_0x2d1397,null))[_0x52c6('0x28')](handleError(_0x2d1397,null));};exports['destroy']=function(_0x48a4f2,_0x11b75f){return db[_0x52c6('0x38')][_0x52c6('0x54')]({'where':{'id':_0x48a4f2[_0x52c6('0x52')]['id']}})[_0x52c6('0x1f')](handleEntityNotFound(_0x11b75f,null))[_0x52c6('0x1f')](removeEntity(_0x11b75f,null))['catch'](handleError(_0x11b75f,null));};exports[_0x52c6('0x57')]=function(_0x45701f,_0x214821,_0x461a66){var _0x5a1eed={};var _0x1c4dda={};var _0x4df1da;var _0x2a818d;return db['DeskAccount'][_0x52c6('0x58')]({'where':{'id':_0x45701f['params']['id']}})['then'](handleEntityNotFound(_0x214821,null))['then'](function(_0x1aed82){if(_0x1aed82){_0x4df1da=_0x1aed82;_0x1c4dda[_0x52c6('0x3d')]=_['keys'](db[_0x52c6('0x59')][_0x52c6('0x39')]);_0x1c4dda['query']=_[_0x52c6('0x3f')](_0x45701f[_0x52c6('0x40')]);_0x1c4dda[_0x52c6('0x4a')]=_[_0x52c6('0x42')](_0x1c4dda['model'],_0x1c4dda[_0x52c6('0x40')]);_0x5a1eed[_0x52c6('0x41')]=_[_0x52c6('0x42')](_0x1c4dda[_0x52c6('0x3d')],qs[_0x52c6('0x43')](_0x45701f['query'][_0x52c6('0x43')]));_0x5a1eed['attributes']=_0x5a1eed[_0x52c6('0x41')]['length']?_0x5a1eed[_0x52c6('0x41')]:_0x1c4dda[_0x52c6('0x3d')];_0x5a1eed[_0x52c6('0x47')]=qs[_0x52c6('0x48')](_0x45701f[_0x52c6('0x40')][_0x52c6('0x48')]);_0x5a1eed[_0x52c6('0x49')]=qs['filters'](_[_0x52c6('0x5a')](_0x45701f[_0x52c6('0x40')],_0x1c4dda[_0x52c6('0x4a')]));if(_0x45701f[_0x52c6('0x40')][_0x52c6('0x4b')]){_0x5a1eed['where']=_[_0x52c6('0x4c')](_0x5a1eed[_0x52c6('0x49')],{'$or':_[_0x52c6('0x3e')](_0x5a1eed[_0x52c6('0x41')],function(_0x3ce827){var _0x1812c9={};_0x1812c9[_0x3ce827]={'$like':'%'+_0x45701f['query']['filter']+'%'};return _0x1812c9;})});}_0x5a1eed=_[_0x52c6('0x4c')]({},_0x5a1eed,_0x45701f['options']);return _0x4df1da['getConfigurations'](_0x5a1eed);}})['then'](function(_0x26c84f){if(_0x26c84f){_0x2a818d=_0x26c84f[_0x52c6('0x53')];if(!_0x45701f[_0x52c6('0x40')]['hasOwnProperty'](_0x52c6('0x45'))){_0x5a1eed['limit']=qs[_0x52c6('0x2d')](_0x45701f['query'][_0x52c6('0x2d')]);_0x5a1eed['offset']=qs['offset'](_0x45701f[_0x52c6('0x40')][_0x52c6('0x46')]);}return _0x4df1da['getConfigurations'](_0x5a1eed);}})['then'](function(_0x43501e){if(_0x43501e){return _0x43501e?{'count':_0x2a818d,'rows':_0x43501e}:null;}})[_0x52c6('0x1f')](respondWithResult(_0x214821,null))[_0x52c6('0x28')](handleError(_0x214821,null));};exports[_0x52c6('0x5b')]=function(_0x46bbe8,_0x4ca643,_0x393e23){if(_0x46bbe8[_0x52c6('0x56')]['id']){delete _0x46bbe8[_0x52c6('0x56')]['id'];}return db[_0x52c6('0x38')][_0x52c6('0x58')]({'where':{'id':_0x46bbe8['params']['id']}})[_0x52c6('0x1f')](handleEntityNotFound(_0x4ca643,null))['then'](function(_0x20f7e0){if(_0x20f7e0){_0x46bbe8['body'][_0x52c6('0x5c')]=_0x20f7e0['id'];_0x46bbe8[_0x52c6('0x56')][_0x52c6('0x5d')]=integrations[_0x52c6('0x5e')](_0x46bbe8[_0x52c6('0x56')][_0x52c6('0x5f')],_0x46bbe8[_0x52c6('0x56')][_0x52c6('0x3b')]);_0x46bbe8['body'][_0x52c6('0x60')]=integrations[_0x52c6('0x61')](_0x46bbe8[_0x52c6('0x56')][_0x52c6('0x5f')],_0x46bbe8[_0x52c6('0x56')][_0x52c6('0x3b')]);return db[_0x52c6('0x59')][_0x52c6('0x55')](_0x46bbe8[_0x52c6('0x56')],{'include':[{'model':db[_0x52c6('0x62')],'as':_0x52c6('0x5d')},{'model':db[_0x52c6('0x62')],'as':_0x52c6('0x60')}]});}return null;})['then'](respondWithResult(_0x4ca643,null))['catch'](handleError(_0x4ca643,null));};exports[_0x52c6('0x63')]=function(_0x42c59d,_0xe555e,_0x58f305){var _0x528ede=[{'name':_0x52c6('0x64'),'label':_0x52c6('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 _0x2f27d4='';return db[_0x52c6('0x38')]['findOne']({'where':{'id':_0x42c59d[_0x52c6('0x52')]['id']},'attributes':['id','remoteUri','authType',_0x52c6('0x65'),_0x52c6('0x66'),_0x52c6('0x67'),'consumerSecret',_0x52c6('0x68'),_0x52c6('0x69')]})['then'](handleEntityNotFound(_0xe555e,null))[_0x52c6('0x1f')](function(_0x176722){if(_0x176722){_0x2f27d4=_0x176722['remoteUri'];var _0x5c2b60=_0x2f27d4[_0x52c6('0x6a')](-0x1);if(_0x5c2b60==='/'){_0x2f27d4=_0x2f27d4[_0x52c6('0x6b')](0x0,_0x2f27d4[_0x52c6('0x6c')](_0x5c2b60));}var _0x2c59e={'method':_0x52c6('0x6d'),'uri':util['format'](_0x52c6('0x6e'),_0x2f27d4),'headers':{'Content-Type':_0x52c6('0x6f'),'Accept':_0x52c6('0x6f')},'json':!![]};if(_0x176722[_0x52c6('0x70')]===_0x52c6('0x71')){_0x2c59e[_0x52c6('0x72')]['Authorization']=util['format'](_0x52c6('0x73'),new Buffer(util[_0x52c6('0x74')](_0x52c6('0x75'),_0x176722[_0x52c6('0x65')],_0x176722['password']))[_0x52c6('0x76')]('base64'));}return rp(_0x2c59e)['then'](function(_0x2b2d02){return _0x528ede[_0x52c6('0x77')](_[_0x52c6('0x3e')](_0x2b2d02['_embedded'][_0x52c6('0x78')],function(_0x480775){return{'id':_0x480775[_0x52c6('0x35')],'name':_0x480775[_0x52c6('0x35')],'type':_0x480775['type'],'active':_0x480775[_0x52c6('0x79')],'label':_0x480775[_0x52c6('0x7a')],'custom':!![]};}));});}})['then'](function(_0x3ff6ff){return{'count':_0x3ff6ff[_0x52c6('0x53')],'rows':_0x3ff6ff};})[_0x52c6('0x1f')](respondWithResult(_0xe555e,null))[_0x52c6('0x28')](function(_0x78c1d8){var _0x46f0fc=_0x42c59d[_0x52c6('0x40')]['test']?0x1f4:_0x78c1d8['statusCode']||0x1f4;logger[_0x52c6('0x24')](_0x52c6('0x7b'),_0x52c6('0x63'),_0x46f0fc,JSON[_0x52c6('0x7c')](_0x78c1d8));delete _0x78c1d8['name'];if(_0x46f0fc===0x191){_0x46f0fc=0x190;}_0xe555e[_0x52c6('0x29')](_0x46f0fc)[_0x52c6('0x36')](_0x42c59d[_0x52c6('0x40')][_0x52c6('0x7d')]?{'message':_0x52c6('0x7e'),'statusCode':_0x78c1d8[_0x52c6('0x7f')]}:_0x78c1d8);});}; \ No newline at end of file +var _0x628e=['message','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','end','name','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','findAll','rows','includeAll','include','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','params','AccountId','Subjects','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','consumerSecret','token','slice','lastIndexOf','GET','application/json','basic','headers','Authorization','format','%s:%s','username','password','toString','base64','concat','_embedded','entries','active','label','Wrong\x20credentials','html-pdf','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0x628e,0x1b8));var _0xe628=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x628e[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xe628('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe628('0x1'));var zipdir=require(_0xe628('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe628('0x3'));var Mustache=require(_0xe628('0x4'));var util=require(_0xe628('0x5'));var path=require(_0xe628('0x6'));var sox=require(_0xe628('0x7'));var csv=require('to-csv');var ejs=require(_0xe628('0x8'));var fs=require('fs');var _=require(_0xe628('0x9'));var squel=require(_0xe628('0xa'));var crypto=require(_0xe628('0xb'));var jsforce=require(_0xe628('0xc'));var deskjs=require(_0xe628('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe628('0xe'));var Redis=require(_0xe628('0xf'));var authService=require(_0xe628('0x10'));var qs=require(_0xe628('0x11'));var as=require(_0xe628('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe628('0x13'))('api');var utils=require(_0xe628('0x14'));var config=require(_0xe628('0x15'));var db=require(_0xe628('0x16'))['db'];var integrations=require(_0xe628('0x17'));var jayson=require(_0xe628('0x18'));var client=jayson['client'][_0xe628('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1e58ef,_0x6a0bec,_0x462974){if(_0x462974){var _0x3810bb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3810bb[_0xe628('0x1a')](_0x6a0bec)){return _0x1e58ef;}else{throw new db[(_0xe628('0x1b'))][(_0xe628('0x1c'))](_0xe628('0x1d'));}}else{return _0x1e58ef;}}function respondWithRpcPromise(_0x476b8c,_0xa2bf50,_0x386674,_0xcb7d68){return new BPromise(function(_0xc412ec,_0x1b743e){var _0x4a4c9f=_0xcb7d68||client;return _0x4a4c9f[_0xe628('0x1e')](_0x476b8c,_0x386674)[_0xe628('0x1f')](function(_0xf0641e){logger[_0xe628('0x20')](_0xe628('0x21'),_0xa2bf50,_0xe628('0x22'));logger[_0xe628('0x23')](_0xe628('0x24'),_0xa2bf50,_0xe628('0x22'),JSON[_0xe628('0x25')](_0xf0641e));if(_0xf0641e[_0xe628('0x26')]){if(_0xf0641e[_0xe628('0x26')][_0xe628('0x27')]===0x1f4){logger['error'](_0xe628('0x21'),_0xa2bf50,_0xf0641e['error'][_0xe628('0x28')]);return _0x1b743e(_0xf0641e[_0xe628('0x26')][_0xe628('0x28')]);}logger[_0xe628('0x26')]('DeskAccount,\x20%s,\x20%s',_0xa2bf50,_0xf0641e[_0xe628('0x26')][_0xe628('0x28')]);return _0xc412ec(_0xf0641e[_0xe628('0x26')][_0xe628('0x28')]);}else{logger['info'](_0xe628('0x21'),_0xa2bf50,_0xe628('0x22'));_0xc412ec(_0xf0641e['result']['message']);}})[_0xe628('0x29')](function(_0x1af077){logger[_0xe628('0x26')]('DeskAccount,\x20%s,\x20%s',_0xa2bf50,_0x1af077);_0x1b743e(_0x1af077);});});}function respondWithStatusCode(_0x1bc67b,_0x3d4b8d){_0x3d4b8d=_0x3d4b8d||0xcc;return function(_0x103805){if(_0x103805){return _0x1bc67b['sendStatus'](_0x3d4b8d);}return _0x1bc67b[_0xe628('0x2a')](_0x3d4b8d)['end']();};}function respondWithResult(_0x517b44,_0x1b3bb9){_0x1b3bb9=_0x1b3bb9||0xc8;return function(_0x4e9243){if(_0x4e9243){return _0x517b44['status'](_0x1b3bb9)[_0xe628('0x2b')](_0x4e9243);}};}function respondWithFilteredResult(_0x3fc2f4,_0x283db6){return function(_0x46888b){if(_0x46888b){var _0x20f4ab=_0x46888b[_0xe628('0x2c')],_0x474df3=_0x283db6[_0xe628('0x2d')],_0x26bee6=_0x283db6[_0xe628('0x2d')]+_0x283db6[_0xe628('0x2e')],_0x49e447;if(_0x26bee6>=_0x20f4ab){_0x26bee6=_0x20f4ab;_0x49e447=0xc8;}else{_0x49e447=0xce;}_0x3fc2f4[_0xe628('0x2a')](_0x49e447);return _0x3fc2f4[_0xe628('0x2f')](_0xe628('0x30'),_0x474df3+'-'+_0x26bee6+'/'+_0x20f4ab)[_0xe628('0x2b')](_0x46888b);}return null;};}function patchUpdates(_0x50e81f){return function(_0x5ce881){try{jsonpatch[_0xe628('0x31')](_0x5ce881,_0x50e81f,!![]);}catch(_0x75ab54){return BPromise[_0xe628('0x32')](_0x75ab54);}return _0x5ce881[_0xe628('0x33')]();};}function saveUpdates(_0x9fce7c,_0x26236f){return function(_0x2f5aab){if(_0x2f5aab){return _0x2f5aab[_0xe628('0x34')](_0x9fce7c)[_0xe628('0x1f')](function(_0x28aeac){return _0x28aeac;});}return null;};}function removeEntity(_0x39e8de,_0xb03903){return function(_0x291e42){if(_0x291e42){return _0x291e42['destroy']()[_0xe628('0x1f')](function(){_0x39e8de['status'](0xcc)[_0xe628('0x35')]();});}};}function handleEntityNotFound(_0x1f5db3,_0x5be4f0){return function(_0x153d5d){if(!_0x153d5d){_0x1f5db3['sendStatus'](0x194);}return _0x153d5d;};}function handleError(_0x4f970a,_0x16aebe){_0x16aebe=_0x16aebe||0x1f4;return function(_0x369cf1){logger[_0xe628('0x26')](_0x369cf1['stack']);if(_0x369cf1[_0xe628('0x36')]){delete _0x369cf1[_0xe628('0x36')];}_0x4f970a[_0xe628('0x2a')](_0x16aebe)['send'](_0x369cf1);};}exports['index']=function(_0x5b20ae,_0x5abb48){var _0x1787b9={},_0x5ea5ff={},_0xdad445={'count':0x0,'rows':[]};var _0x14b5d3=_['map'](db[_0xe628('0x37')][_0xe628('0x38')],function(_0x1bfe56){return{'name':_0x1bfe56[_0xe628('0x39')],'type':_0x1bfe56[_0xe628('0x3a')][_0xe628('0x3b')]};});_0x5ea5ff[_0xe628('0x3c')]=_[_0xe628('0x3d')](_0x14b5d3,'name');_0x5ea5ff[_0xe628('0x3e')]=_[_0xe628('0x3f')](_0x5b20ae[_0xe628('0x3e')]);_0x5ea5ff['filters']=_['intersection'](_0x5ea5ff['model'],_0x5ea5ff[_0xe628('0x3e')]);_0x1787b9[_0xe628('0x40')]=_[_0xe628('0x41')](_0x5ea5ff['model'],qs[_0xe628('0x42')](_0x5b20ae[_0xe628('0x3e')]['fields']));_0x1787b9['attributes']=_0x1787b9[_0xe628('0x40')][_0xe628('0x43')]?_0x1787b9['attributes']:_0x5ea5ff['model'];if(!_0x5b20ae[_0xe628('0x3e')][_0xe628('0x44')](_0xe628('0x45'))){_0x1787b9[_0xe628('0x2e')]=qs[_0xe628('0x2e')](_0x5b20ae[_0xe628('0x3e')][_0xe628('0x2e')]);_0x1787b9[_0xe628('0x2d')]=qs[_0xe628('0x2d')](_0x5b20ae[_0xe628('0x3e')][_0xe628('0x2d')]);}_0x1787b9[_0xe628('0x46')]=qs[_0xe628('0x47')](_0x5b20ae[_0xe628('0x3e')][_0xe628('0x47')]);_0x1787b9['where']=qs['filters'](_[_0xe628('0x48')](_0x5b20ae[_0xe628('0x3e')],_0x5ea5ff[_0xe628('0x49')]),_0x14b5d3);if(_0x5b20ae['query'][_0xe628('0x4a')]){_0x1787b9[_0xe628('0x4b')]=_[_0xe628('0x4c')](_0x1787b9[_0xe628('0x4b')],{'$or':_[_0xe628('0x3d')](_0x14b5d3,function(_0x37d4d5){if(_0x37d4d5[_0xe628('0x3a')]!==_0xe628('0x4d')){var _0x2df9e9={};_0x2df9e9[_0x37d4d5[_0xe628('0x36')]]={'$like':'%'+_0x5b20ae[_0xe628('0x3e')][_0xe628('0x4a')]+'%'};return _0x2df9e9;}})});}_0x1787b9=_[_0xe628('0x4c')]({},_0x1787b9,_0x5b20ae['options']);var _0x9edf9c={'where':_0x1787b9['where']};return db[_0xe628('0x37')][_0xe628('0x2c')](_0x9edf9c)[_0xe628('0x1f')](function(_0x7c2329){_0xdad445[_0xe628('0x2c')]=_0x7c2329;if(_0x5b20ae[_0xe628('0x3e')]['includeAll']){_0x1787b9['include']=[{'all':!![]}];}return db['DeskAccount'][_0xe628('0x4e')](_0x1787b9);})['then'](function(_0x595eac){_0xdad445[_0xe628('0x4f')]=_0x595eac;return _0xdad445;})[_0xe628('0x1f')](respondWithFilteredResult(_0x5abb48,_0x1787b9))[_0xe628('0x29')](handleError(_0x5abb48,null));};exports['show']=function(_0x9835fd,_0x15421c){var _0x3ab4e5={'raw':![],'where':{'id':_0x9835fd['params']['id']}},_0xe879ca={};_0xe879ca[_0xe628('0x3c')]=_[_0xe628('0x3f')](db[_0xe628('0x37')][_0xe628('0x38')]);_0xe879ca[_0xe628('0x3e')]=_[_0xe628('0x3f')](_0x9835fd[_0xe628('0x3e')]);_0xe879ca[_0xe628('0x49')]=_[_0xe628('0x41')](_0xe879ca[_0xe628('0x3c')],_0xe879ca[_0xe628('0x3e')]);_0x3ab4e5[_0xe628('0x40')]=_[_0xe628('0x41')](_0xe879ca[_0xe628('0x3c')],qs[_0xe628('0x42')](_0x9835fd[_0xe628('0x3e')][_0xe628('0x42')]));_0x3ab4e5['attributes']=_0x3ab4e5[_0xe628('0x40')][_0xe628('0x43')]?_0x3ab4e5[_0xe628('0x40')]:_0xe879ca[_0xe628('0x3c')];if(_0x9835fd[_0xe628('0x3e')][_0xe628('0x50')]){_0x3ab4e5[_0xe628('0x51')]=[{'all':!![]}];}_0x3ab4e5=_[_0xe628('0x4c')]({},_0x3ab4e5,_0x9835fd['options']);return db[_0xe628('0x37')][_0xe628('0x52')](_0x3ab4e5)['then'](handleEntityNotFound(_0x15421c,null))['then'](respondWithResult(_0x15421c,null))[_0xe628('0x29')](handleError(_0x15421c,null));};exports[_0xe628('0x53')]=function(_0x577fa1,_0x218602){return db[_0xe628('0x37')][_0xe628('0x53')](_0x577fa1[_0xe628('0x54')],{})['then'](respondWithResult(_0x218602,0xc9))[_0xe628('0x29')](handleError(_0x218602,null));};exports[_0xe628('0x34')]=function(_0x58a4ab,_0xc4e6b6){if(_0x58a4ab['body']['id']){delete _0x58a4ab[_0xe628('0x54')]['id'];}return db[_0xe628('0x37')][_0xe628('0x52')]({'where':{'id':_0x58a4ab['params']['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0xc4e6b6,null))[_0xe628('0x1f')](saveUpdates(_0x58a4ab['body'],null))[_0xe628('0x1f')](respondWithResult(_0xc4e6b6,null))[_0xe628('0x29')](handleError(_0xc4e6b6,null));};exports['destroy']=function(_0x435ffa,_0x3f73e2){return db[_0xe628('0x37')][_0xe628('0x52')]({'where':{'id':_0x435ffa['params']['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x3f73e2,null))[_0xe628('0x1f')](removeEntity(_0x3f73e2,null))['catch'](handleError(_0x3f73e2,null));};exports[_0xe628('0x55')]=function(_0x261b5b,_0x5aa766,_0x38cbda){var _0x15482a={};var _0x25b3f1={};var _0xa781e3;var _0x58a523;return db[_0xe628('0x37')][_0xe628('0x56')]({'where':{'id':_0x261b5b['params']['id']}})['then'](handleEntityNotFound(_0x5aa766,null))[_0xe628('0x1f')](function(_0x397997){if(_0x397997){_0xa781e3=_0x397997;_0x25b3f1[_0xe628('0x3c')]=_['keys'](db[_0xe628('0x57')][_0xe628('0x38')]);_0x25b3f1[_0xe628('0x3e')]=_[_0xe628('0x3f')](_0x261b5b[_0xe628('0x3e')]);_0x25b3f1[_0xe628('0x49')]=_[_0xe628('0x41')](_0x25b3f1['model'],_0x25b3f1['query']);_0x15482a[_0xe628('0x40')]=_[_0xe628('0x41')](_0x25b3f1[_0xe628('0x3c')],qs['fields'](_0x261b5b[_0xe628('0x3e')][_0xe628('0x42')]));_0x15482a[_0xe628('0x40')]=_0x15482a[_0xe628('0x40')][_0xe628('0x43')]?_0x15482a['attributes']:_0x25b3f1[_0xe628('0x3c')];_0x15482a['order']=qs[_0xe628('0x47')](_0x261b5b[_0xe628('0x3e')][_0xe628('0x47')]);_0x15482a[_0xe628('0x4b')]=qs[_0xe628('0x49')](_[_0xe628('0x48')](_0x261b5b[_0xe628('0x3e')],_0x25b3f1[_0xe628('0x49')]));if(_0x261b5b['query'][_0xe628('0x4a')]){_0x15482a['where']=_[_0xe628('0x4c')](_0x15482a[_0xe628('0x4b')],{'$or':_[_0xe628('0x3d')](_0x15482a[_0xe628('0x40')],function(_0x5ceaa9){var _0x573e67={};_0x573e67[_0x5ceaa9]={'$like':'%'+_0x261b5b['query']['filter']+'%'};return _0x573e67;})});}_0x15482a=_[_0xe628('0x4c')]({},_0x15482a,_0x261b5b['options']);return _0xa781e3['getConfigurations'](_0x15482a);}})[_0xe628('0x1f')](function(_0x9dd598){if(_0x9dd598){_0x58a523=_0x9dd598['length'];if(!_0x261b5b[_0xe628('0x3e')][_0xe628('0x44')]('nolimit')){_0x15482a[_0xe628('0x2e')]=qs[_0xe628('0x2e')](_0x261b5b[_0xe628('0x3e')][_0xe628('0x2e')]);_0x15482a[_0xe628('0x2d')]=qs[_0xe628('0x2d')](_0x261b5b[_0xe628('0x3e')][_0xe628('0x2d')]);}return _0xa781e3['getConfigurations'](_0x15482a);}})[_0xe628('0x1f')](function(_0x511f92){if(_0x511f92){return _0x511f92?{'count':_0x58a523,'rows':_0x511f92}:null;}})['then'](respondWithResult(_0x5aa766,null))[_0xe628('0x29')](handleError(_0x5aa766,null));};exports[_0xe628('0x58')]=function(_0x4b9c51,_0x596110,_0x37038b){if(_0x4b9c51[_0xe628('0x54')]['id']){delete _0x4b9c51[_0xe628('0x54')]['id'];}return db[_0xe628('0x37')][_0xe628('0x56')]({'where':{'id':_0x4b9c51[_0xe628('0x59')]['id']}})[_0xe628('0x1f')](handleEntityNotFound(_0x596110,null))[_0xe628('0x1f')](function(_0x3cbe6f){if(_0x3cbe6f){_0x4b9c51[_0xe628('0x54')][_0xe628('0x5a')]=_0x3cbe6f['id'];_0x4b9c51[_0xe628('0x54')][_0xe628('0x5b')]=integrations['getSubjects'](_0x4b9c51[_0xe628('0x54')]['channel'],_0x4b9c51[_0xe628('0x54')][_0xe628('0x3a')]);_0x4b9c51[_0xe628('0x54')]['Descriptions']=integrations[_0xe628('0x5c')](_0x4b9c51[_0xe628('0x54')][_0xe628('0x5d')],_0x4b9c51[_0xe628('0x54')][_0xe628('0x3a')]);return db[_0xe628('0x57')][_0xe628('0x53')](_0x4b9c51['body'],{'include':[{'model':db[_0xe628('0x5e')],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xe628('0x1f')](respondWithResult(_0x596110,null))[_0xe628('0x29')](handleError(_0x596110,null));};exports[_0xe628('0x5f')]=function(_0x910f1f,_0x3e7454,_0x5a32c8){var _0x48648b=[{'name':'priority','label':_0xe628('0x60'),'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 _0x497265='';return db['DeskAccount']['findOne']({'where':{'id':_0x910f1f[_0xe628('0x59')]['id']},'attributes':['id',_0xe628('0x61'),_0xe628('0x62'),'username','password','consumerKey',_0xe628('0x63'),_0xe628('0x64'),'tokenSecret']})['then'](handleEntityNotFound(_0x3e7454,null))['then'](function(_0x497713){if(_0x497713){_0x497265=_0x497713[_0xe628('0x61')];var _0x3627c4=_0x497265[_0xe628('0x65')](-0x1);if(_0x3627c4==='/'){_0x497265=_0x497265['substring'](0x0,_0x497265[_0xe628('0x66')](_0x3627c4));}var _0x2b2803={'method':_0xe628('0x67'),'uri':util['format']('%s/custom_fields',_0x497265),'headers':{'Content-Type':_0xe628('0x68'),'Accept':_0xe628('0x68')},'json':!![]};if(_0x497713[_0xe628('0x62')]===_0xe628('0x69')){_0x2b2803[_0xe628('0x6a')][_0xe628('0x6b')]=util[_0xe628('0x6c')]('Basic\x20%s',new Buffer(util[_0xe628('0x6c')](_0xe628('0x6d'),_0x497713[_0xe628('0x6e')],_0x497713[_0xe628('0x6f')]))[_0xe628('0x70')](_0xe628('0x71')));}return rp(_0x2b2803)[_0xe628('0x1f')](function(_0xb91f5f){return _0x48648b[_0xe628('0x72')](_[_0xe628('0x3d')](_0xb91f5f[_0xe628('0x73')][_0xe628('0x74')],function(_0x324bd0){return{'id':_0x324bd0[_0xe628('0x36')],'name':_0x324bd0[_0xe628('0x36')],'type':_0x324bd0[_0xe628('0x3a')],'active':_0x324bd0[_0xe628('0x75')],'label':_0x324bd0[_0xe628('0x76')],'custom':!![]};}));});}})[_0xe628('0x1f')](function(_0x4e5d0d){return{'count':_0x4e5d0d[_0xe628('0x43')],'rows':_0x4e5d0d};})[_0xe628('0x1f')](respondWithResult(_0x3e7454,null))[_0xe628('0x29')](function(_0x1ec464){var _0x5fa005=_0x910f1f[_0xe628('0x3e')][_0xe628('0x1a')]?0x1f4:_0x1ec464['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe628('0x5f'),_0x5fa005,JSON[_0xe628('0x25')](_0x1ec464));delete _0x1ec464[_0xe628('0x36')];if(_0x5fa005===0x191){_0x5fa005=0x190;}_0x3e7454[_0xe628('0x2a')](_0x5fa005)['send'](_0x910f1f[_0xe628('0x3e')][_0xe628('0x1a')]?{'message':_0xe628('0x77'),'statusCode':_0x1ec464['statusCode']}:_0x1ec464);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3c59876..ebc816f 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 _0x8329=['../../config/logger','api','moment','request-promise','rimraf','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','util'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x8329,0x1e9));var _0x9832=function(_0x58dfd8,_0x59d720){_0x58dfd8=_0x58dfd8-0x0;var _0x4cb9ab=_0x8329[_0x58dfd8];return _0x4cb9ab;};'use strict';var _=require('lodash');var util=require(_0x9832('0x0'));var logger=require(_0x9832('0x1'))(_0x9832('0x2'));var moment=require(_0x9832('0x3'));var BPromise=require('bluebird');var rp=require(_0x9832('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9832('0x5'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x9832('0x6'));module[_0x9832('0x7')]=function(_0x571d1b,_0x3b6026){return _0x571d1b['define'](_0x9832('0x8'),attributes,{'tableName':_0x9832('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf919=['moment','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','lodash','../../config/logger','api'];(function(_0x3f333e,_0x4506b3){var _0x14d157=function(_0x360154){while(--_0x360154){_0x3f333e['push'](_0x3f333e['shift']());}};_0x14d157(++_0x4506b3);}(_0xf919,0x97));var _0x9f91=function(_0x343b56,_0x27ebbf){_0x343b56=_0x343b56-0x0;var _0x4bdc57=_0xf919[_0x343b56];return _0x4bdc57;};'use strict';var _=require(_0x9f91('0x0'));var util=require('util');var logger=require(_0x9f91('0x1'))(_0x9f91('0x2'));var moment=require(_0x9f91('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f91('0x5'));var config=require(_0x9f91('0x6'));var attributes=require(_0x9f91('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x9f91('0x8')]=function(_0x389035,_0x58908c){return _0x389035[_0x9f91('0x9')](_0x9f91('0xa'),attributes,{'tableName':'int_desk_accounts','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 87d5ee1..c26a227 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 _0x48ff=['message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x48ff,0x84));var _0xf48f=function(_0x22184c,_0x10cfd4){_0x22184c=_0x22184c-0x0;var _0x2d32b8=_0x48ff[_0x22184c];return _0x2d32b8;};'use strict';var _=require(_0xf48f('0x0'));var util=require(_0xf48f('0x1'));var moment=require(_0xf48f('0x2'));var BPromise=require(_0xf48f('0x3'));var rs=require(_0xf48f('0x4'));var fs=require('fs');var Redis=require(_0xf48f('0x5'));var db=require(_0xf48f('0x6'))['db'];var utils=require(_0xf48f('0x7'));var logger=require(_0xf48f('0x8'))(_0xf48f('0x9'));var config=require('../../config/environment');var jayson=require(_0xf48f('0xa'));var client=jayson[_0xf48f('0xb')][_0xf48f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c994b,_0x49263a,_0x5d1a54){return new BPromise(function(_0x1dec06,_0x4108e7){return client[_0xf48f('0xd')](_0x5c994b,_0x5d1a54)[_0xf48f('0xe')](function(_0x331b61){logger['info']('DeskAccount,\x20%s,\x20%s',_0x49263a,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x49263a,_0xf48f('0xf'),JSON[_0xf48f('0x10')](_0x331b61));if(_0x331b61[_0xf48f('0x11')]){if(_0x331b61[_0xf48f('0x11')][_0xf48f('0x12')]===0x1f4){logger['error'](_0xf48f('0x13'),_0x49263a,_0x331b61['error']['message']);return _0x4108e7(_0x331b61[_0xf48f('0x11')][_0xf48f('0x14')]);}logger[_0xf48f('0x11')](_0xf48f('0x13'),_0x49263a,_0x331b61['error'][_0xf48f('0x14')]);return _0x1dec06(_0x331b61[_0xf48f('0x11')][_0xf48f('0x14')]);}else{logger[_0xf48f('0x15')]('DeskAccount,\x20%s,\x20%s',_0x49263a,_0xf48f('0xf'));_0x1dec06(_0x331b61[_0xf48f('0x16')][_0xf48f('0x14')]);}})[_0xf48f('0x17')](function(_0x1f1d74){logger[_0xf48f('0x11')]('DeskAccount,\x20%s,\x20%s',_0x49263a,_0x1f1d74);_0x4108e7(_0x1f1d74);});});}exports[_0xf48f('0x18')]=function(_0x211221){var _0x31fe54=this;return new Promise(function(_0x23f37d,_0x1b8c22){return db[_0xf48f('0x19')][_0xf48f('0x1a')]({'raw':_0x211221[_0xf48f('0x1b')]?_0x211221['options'][_0xf48f('0x1c')]===undefined?!![]:![]:!![],'where':_0x211221[_0xf48f('0x1b')]?_0x211221[_0xf48f('0x1b')][_0xf48f('0x1d')]||null:null,'attributes':_0x211221[_0xf48f('0x1b')]?_0x211221[_0xf48f('0x1b')][_0xf48f('0x1e')]||null:null,'limit':_0x211221[_0xf48f('0x1b')]?_0x211221[_0xf48f('0x1b')][_0xf48f('0x1f')]||null:null,'include':_0x211221[_0xf48f('0x1b')]?_0x211221[_0xf48f('0x1b')]['include']?_[_0xf48f('0x20')](_0x211221[_0xf48f('0x1b')][_0xf48f('0x21')],function(_0x306e74){return{'model':db[_0x306e74[_0xf48f('0x22')]],'as':_0x306e74['as'],'attributes':_0x306e74['attributes'],'include':_0x306e74['include']?_[_0xf48f('0x20')](_0x306e74[_0xf48f('0x21')],function(_0x1cca83){return{'model':db[_0x1cca83['model']],'as':_0x1cca83['as'],'attributes':_0x1cca83[_0xf48f('0x1e')],'include':_0x1cca83[_0xf48f('0x21')]?_[_0xf48f('0x20')](_0x1cca83[_0xf48f('0x21')],function(_0x476aaa){return{'model':db[_0x476aaa[_0xf48f('0x22')]],'as':_0x476aaa['as'],'attributes':_0x476aaa[_0xf48f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf48f('0xe')](function(_0x530c7b){logger['info'](_0xf48f('0x18'),_0x211221);logger[_0xf48f('0x23')](_0xf48f('0x18'),_0x211221,JSON['stringify'](_0x530c7b));_0x23f37d(_0x530c7b);})[_0xf48f('0x17')](function(_0x2e8be6){logger[_0xf48f('0x11')](_0xf48f('0x18'),_0x2e8be6[_0xf48f('0x14')],_0x211221);_0x1b8c22(_0x31fe54['error'](0x1f4,_0x2e8be6[_0xf48f('0x14')]));});});};exports['ShowDeskAccount']=function(_0x51a3e6){var _0x430007=this;return new Promise(function(_0x2af73a,_0x3c9bf4){return db[_0xf48f('0x19')][_0xf48f('0x24')]({'raw':_0x51a3e6[_0xf48f('0x1b')]?_0x51a3e6[_0xf48f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x51a3e6[_0xf48f('0x1b')]?_0x51a3e6[_0xf48f('0x1b')][_0xf48f('0x1d')]||null:null,'attributes':_0x51a3e6[_0xf48f('0x1b')]?_0x51a3e6[_0xf48f('0x1b')][_0xf48f('0x1e')]||null:null,'include':_0x51a3e6[_0xf48f('0x1b')]?_0x51a3e6[_0xf48f('0x1b')]['include']?_[_0xf48f('0x20')](_0x51a3e6[_0xf48f('0x1b')][_0xf48f('0x21')],function(_0x4af66b){return{'model':db[_0x4af66b[_0xf48f('0x22')]],'as':_0x4af66b['as'],'attributes':_0x4af66b[_0xf48f('0x1e')],'include':_0x4af66b[_0xf48f('0x21')]?_[_0xf48f('0x20')](_0x4af66b[_0xf48f('0x21')],function(_0x261f55){return{'model':db[_0x261f55[_0xf48f('0x22')]],'as':_0x261f55['as'],'attributes':_0x261f55[_0xf48f('0x1e')],'include':_0x261f55[_0xf48f('0x21')]?_['map'](_0x261f55[_0xf48f('0x21')],function(_0x461c5e){return{'model':db[_0x461c5e['model']],'as':_0x461c5e['as'],'attributes':_0x461c5e[_0xf48f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x500ff8){logger[_0xf48f('0x15')](_0xf48f('0x25'),_0x51a3e6);logger[_0xf48f('0x23')](_0xf48f('0x25'),_0x51a3e6,JSON['stringify'](_0x500ff8));_0x2af73a(_0x500ff8);})[_0xf48f('0x17')](function(_0x12d78a){logger[_0xf48f('0x11')](_0xf48f('0x25'),_0x12d78a[_0xf48f('0x14')],_0x51a3e6);_0x3c9bf4(_0x430007['error'](0x1f4,_0x12d78a[_0xf48f('0x14')]));});});}; \ No newline at end of file +var _0xc1b0=['error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4ad3dd,_0x428f52){var _0x570571=function(_0xbd3825){while(--_0xbd3825){_0x4ad3dd['push'](_0x4ad3dd['shift']());}};_0x570571(++_0x428f52);}(_0xc1b0,0xf2));var _0x0c1b=function(_0x8a565b,_0x49df9f){_0x8a565b=_0x8a565b-0x0;var _0x231c1d=_0xc1b0[_0x8a565b];return _0x231c1d;};'use strict';var _=require('lodash');var util=require(_0x0c1b('0x0'));var moment=require(_0x0c1b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c1b('0x2'))['db'];var utils=require(_0x0c1b('0x3'));var logger=require(_0x0c1b('0x4'))('rpc');var config=require(_0x0c1b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0c1b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x178db5,_0x4b4539,_0x20e3b7){return new BPromise(function(_0x3a8b75,_0x10d58f){return client[_0x0c1b('0x7')](_0x178db5,_0x20e3b7)[_0x0c1b('0x8')](function(_0x5d3080){logger[_0x0c1b('0x9')]('DeskAccount,\x20%s,\x20%s',_0x4b4539,_0x0c1b('0xa'));logger[_0x0c1b('0xb')](_0x0c1b('0xc'),_0x4b4539,_0x0c1b('0xa'),JSON[_0x0c1b('0xd')](_0x5d3080));if(_0x5d3080['error']){if(_0x5d3080[_0x0c1b('0xe')][_0x0c1b('0xf')]===0x1f4){logger[_0x0c1b('0xe')](_0x0c1b('0x10'),_0x4b4539,_0x5d3080[_0x0c1b('0xe')]['message']);return _0x10d58f(_0x5d3080[_0x0c1b('0xe')][_0x0c1b('0x11')]);}logger[_0x0c1b('0xe')](_0x0c1b('0x10'),_0x4b4539,_0x5d3080[_0x0c1b('0xe')][_0x0c1b('0x11')]);return _0x3a8b75(_0x5d3080[_0x0c1b('0xe')]['message']);}else{logger[_0x0c1b('0x9')](_0x0c1b('0x10'),_0x4b4539,_0x0c1b('0xa'));_0x3a8b75(_0x5d3080[_0x0c1b('0x12')][_0x0c1b('0x11')]);}})[_0x0c1b('0x13')](function(_0x1b5329){logger[_0x0c1b('0xe')]('DeskAccount,\x20%s,\x20%s',_0x4b4539,_0x1b5329);_0x10d58f(_0x1b5329);});});}exports[_0x0c1b('0x14')]=function(_0x26ba39){var _0x38ea03=this;return new Promise(function(_0x576a57,_0x3dd2e8){return db[_0x0c1b('0x15')][_0x0c1b('0x16')]({'raw':_0x26ba39[_0x0c1b('0x17')]?_0x26ba39['options'][_0x0c1b('0x18')]===undefined?!![]:![]:!![],'where':_0x26ba39[_0x0c1b('0x17')]?_0x26ba39[_0x0c1b('0x17')][_0x0c1b('0x19')]||null:null,'attributes':_0x26ba39['options']?_0x26ba39[_0x0c1b('0x17')][_0x0c1b('0x1a')]||null:null,'limit':_0x26ba39[_0x0c1b('0x17')]?_0x26ba39['options'][_0x0c1b('0x1b')]||null:null,'include':_0x26ba39[_0x0c1b('0x17')]?_0x26ba39['options'][_0x0c1b('0x1c')]?_[_0x0c1b('0x1d')](_0x26ba39[_0x0c1b('0x17')][_0x0c1b('0x1c')],function(_0x3ba5d5){return{'model':db[_0x3ba5d5['model']],'as':_0x3ba5d5['as'],'attributes':_0x3ba5d5[_0x0c1b('0x1a')],'include':_0x3ba5d5[_0x0c1b('0x1c')]?_['map'](_0x3ba5d5[_0x0c1b('0x1c')],function(_0x3798a6){return{'model':db[_0x3798a6[_0x0c1b('0x1e')]],'as':_0x3798a6['as'],'attributes':_0x3798a6[_0x0c1b('0x1a')],'include':_0x3798a6[_0x0c1b('0x1c')]?_[_0x0c1b('0x1d')](_0x3798a6[_0x0c1b('0x1c')],function(_0x5ed1d5){return{'model':db[_0x5ed1d5[_0x0c1b('0x1e')]],'as':_0x5ed1d5['as'],'attributes':_0x5ed1d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c1b('0x8')](function(_0x415699){logger['info'](_0x0c1b('0x14'),_0x26ba39);logger[_0x0c1b('0xb')](_0x0c1b('0x14'),_0x26ba39,JSON[_0x0c1b('0xd')](_0x415699));_0x576a57(_0x415699);})[_0x0c1b('0x13')](function(_0x2a06d7){logger[_0x0c1b('0xe')]('GetDeskAccount',_0x2a06d7[_0x0c1b('0x11')],_0x26ba39);_0x3dd2e8(_0x38ea03['error'](0x1f4,_0x2a06d7[_0x0c1b('0x11')]));});});};exports['ShowDeskAccount']=function(_0x5a8e5c){var _0x1d7368=this;return new Promise(function(_0x2dd9ca,_0x34d1c0){return db[_0x0c1b('0x15')]['find']({'raw':_0x5a8e5c[_0x0c1b('0x17')]?_0x5a8e5c['options'][_0x0c1b('0x18')]===undefined?!![]:![]:!![],'where':_0x5a8e5c[_0x0c1b('0x17')]?_0x5a8e5c[_0x0c1b('0x17')]['where']||null:null,'attributes':_0x5a8e5c[_0x0c1b('0x17')]?_0x5a8e5c[_0x0c1b('0x17')][_0x0c1b('0x1a')]||null:null,'include':_0x5a8e5c['options']?_0x5a8e5c[_0x0c1b('0x17')][_0x0c1b('0x1c')]?_[_0x0c1b('0x1d')](_0x5a8e5c[_0x0c1b('0x17')][_0x0c1b('0x1c')],function(_0x2fc113){return{'model':db[_0x2fc113[_0x0c1b('0x1e')]],'as':_0x2fc113['as'],'attributes':_0x2fc113[_0x0c1b('0x1a')],'include':_0x2fc113[_0x0c1b('0x1c')]?_[_0x0c1b('0x1d')](_0x2fc113[_0x0c1b('0x1c')],function(_0x1d830f){return{'model':db[_0x1d830f[_0x0c1b('0x1e')]],'as':_0x1d830f['as'],'attributes':_0x1d830f[_0x0c1b('0x1a')],'include':_0x1d830f[_0x0c1b('0x1c')]?_['map'](_0x1d830f[_0x0c1b('0x1c')],function(_0x3f5a22){return{'model':db[_0x3f5a22[_0x0c1b('0x1e')]],'as':_0x3f5a22['as'],'attributes':_0x3f5a22[_0x0c1b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4856a7){logger[_0x0c1b('0x9')](_0x0c1b('0x1f'),_0x5a8e5c);logger[_0x0c1b('0xb')](_0x0c1b('0x1f'),_0x5a8e5c,JSON[_0x0c1b('0xd')](_0x4856a7));_0x2dd9ca(_0x4856a7);})['catch'](function(_0x3b749c){logger[_0x0c1b('0xe')](_0x0c1b('0x1f'),_0x3b749c[_0x0c1b('0x11')],_0x5a8e5c);_0x34d1c0(_0x1d7368[_0x0c1b('0xe')](0x1f4,_0x3b749c[_0x0c1b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b21d263..a1d9fe9 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 _0x870d=['express','Router','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','create','/:id/tags','setTags','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0xa09cf,_0x2e2d8b){var _0x13a307=function(_0x57cc34){while(--_0x57cc34){_0xa09cf['push'](_0xa09cf['shift']());}};_0x13a307(++_0x2e2d8b);}(_0x870d,0xde));var _0xd870=function(_0x5e1ade,_0x58500d){_0x5e1ade=_0x5e1ade-0x0;var _0x42123e=_0x870d[_0x5e1ade];return _0x42123e;};'use strict';var multer=require('multer');var util=require(_0xd870('0x0'));var path=require(_0xd870('0x1'));var timeout=require(_0xd870('0x2'));var express=require(_0xd870('0x3'));var router=express[_0xd870('0x4')]();var auth=require(_0xd870('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd870('0x6'));var controller=require(_0xd870('0x7'));router[_0xd870('0x8')]('/',auth[_0xd870('0x9')](),controller[_0xd870('0xa')]);router['get'](_0xd870('0xb'),auth[_0xd870('0x9')](),controller[_0xd870('0xc')]);router['get']('/:id/fields',auth[_0xd870('0x9')](),controller[_0xd870('0xd')]);router[_0xd870('0x8')](_0xd870('0xe'),auth[_0xd870('0x9')](),controller[_0xd870('0xf')]);router['get']('/:id/descriptions',auth[_0xd870('0x9')](),controller[_0xd870('0x10')]);router[_0xd870('0x8')]('/:id/tags',auth[_0xd870('0x9')](),controller[_0xd870('0x11')]);router['post']('/',auth[_0xd870('0x9')](),controller[_0xd870('0x12')]);router['post'](_0xd870('0x13'),auth['isAuthenticated'](),controller[_0xd870('0x14')]);router[_0xd870('0x15')](_0xd870('0xb'),auth[_0xd870('0x9')](),controller['update']);router[_0xd870('0x16')](_0xd870('0xb'),auth['isAuthenticated'](),controller[_0xd870('0x17')]);module[_0xd870('0x18')]=router; \ No newline at end of file +var _0x1419=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x39be44,_0x3feb72){var _0x217970=function(_0x2171cf){while(--_0x2171cf){_0x39be44['push'](_0x39be44['shift']());}};_0x217970(++_0x3feb72);}(_0x1419,0x127));var _0x9141=function(_0x16d9b6,_0x3f5f87){_0x16d9b6=_0x16d9b6-0x0;var _0x5178df=_0x1419[_0x16d9b6];return _0x5178df;};'use strict';var multer=require(_0x9141('0x0'));var util=require(_0x9141('0x1'));var path=require(_0x9141('0x2'));var timeout=require(_0x9141('0x3'));var express=require(_0x9141('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9141('0x5'));var config=require(_0x9141('0x6'));var controller=require('./intDeskConfiguration.controller');router['get']('/',auth[_0x9141('0x7')](),controller[_0x9141('0x8')]);router[_0x9141('0x9')](_0x9141('0xa'),auth[_0x9141('0x7')](),controller[_0x9141('0xb')]);router[_0x9141('0x9')](_0x9141('0xc'),auth[_0x9141('0x7')](),controller[_0x9141('0xd')]);router['get'](_0x9141('0xe'),auth[_0x9141('0x7')](),controller[_0x9141('0xf')]);router[_0x9141('0x9')](_0x9141('0x10'),auth[_0x9141('0x7')](),controller[_0x9141('0x11')]);router[_0x9141('0x9')](_0x9141('0x12'),auth[_0x9141('0x7')](),controller['getTags']);router[_0x9141('0x13')]('/',auth[_0x9141('0x7')](),controller[_0x9141('0x14')]);router[_0x9141('0x13')](_0x9141('0x12'),auth[_0x9141('0x7')](),controller['setTags']);router['put'](_0x9141('0xa'),auth[_0x9141('0x7')](),controller[_0x9141('0x15')]);router[_0x9141('0x16')](_0x9141('0xa'),auth[_0x9141('0x7')](),controller[_0x9141('0x17')]);module[_0x9141('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c5ec010..70eda97 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 _0xb049=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb049,0x167));var _0x9b04=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb049[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x9b04('0x0'));module[_0x9b04('0x1')]={'name':{'type':Sequelize[_0x9b04('0x2')]},'description':{'type':Sequelize[_0x9b04('0x2')]}}; \ No newline at end of file +var _0x95d6=['sequelize','exports','STRING'];(function(_0x57b7ff,_0x75d153){var _0x34578f=function(_0x5d0727){while(--_0x5d0727){_0x57b7ff['push'](_0x57b7ff['shift']());}};_0x34578f(++_0x75d153);}(_0x95d6,0xae));var _0x695d=function(_0x521e81,_0x48a6fb){_0x521e81=_0x521e81-0x0;var _0x23d85f=_0x95d6[_0x521e81];return _0x23d85f;};'use strict';var Sequelize=require(_0x695d('0x0'));module[_0x695d('0x1')]={'name':{'type':Sequelize[_0x695d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 368aab1..b2205e1 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 _0x8b7c=['bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','DeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','destroy','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','body','findOne','DeskField','length','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5283d8,_0x59bc1b){var _0x2a17a6=function(_0x9fe86b){while(--_0x9fe86b){_0x5283d8['push'](_0x5283d8['shift']());}};_0x2a17a6(++_0x59bc1b);}(_0x8b7c,0x119));var _0xc8b7=function(_0x3a902a,_0xca8442){_0x3a902a=_0x3a902a-0x0;var _0x24f2d5=_0x8b7c[_0x3a902a];return _0x24f2d5;};'use strict';var pdf=require(_0xc8b7('0x0'));var emlformat=require(_0xc8b7('0x1'));var rimraf=require(_0xc8b7('0x2'));var zipdir=require(_0xc8b7('0x3'));var jsonpatch=require(_0xc8b7('0x4'));var rp=require(_0xc8b7('0x5'));var moment=require(_0xc8b7('0x6'));var BPromise=require(_0xc8b7('0x7'));var Mustache=require('mustache');var util=require(_0xc8b7('0x8'));var path=require(_0xc8b7('0x9'));var sox=require(_0xc8b7('0xa'));var csv=require('to-csv');var ejs=require(_0xc8b7('0xb'));var fs=require('fs');var _=require(_0xc8b7('0xc'));var squel=require(_0xc8b7('0xd'));var crypto=require(_0xc8b7('0xe'));var jsforce=require(_0xc8b7('0xf'));var deskjs=require(_0xc8b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc8b7('0x11'));var Papa=require('papaparse');var Redis=require(_0xc8b7('0x12'));var authService=require(_0xc8b7('0x13'));var qs=require(_0xc8b7('0x14'));var as=require(_0xc8b7('0x15'));var hardwareService=require(_0xc8b7('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc8b7('0x17'));var db=require(_0xc8b7('0x18'))['db'];var jayson=require(_0xc8b7('0x19'));var client=jayson[_0xc8b7('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x5495e9,_0x4d4269,_0x5e8f7){if(_0x5e8f7){var _0x373391=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x373391[_0xc8b7('0x1b')](_0x4d4269)){return _0x5495e9;}else{throw new db['Sequelize'][(_0xc8b7('0x1c'))](_0xc8b7('0x1d'));}}else{return _0x5495e9;}}function respondWithRpcPromise(_0x337fbc,_0x1b7dc0,_0x3d189e,_0x5d412e){return new BPromise(function(_0xb53183,_0x26d70a){var _0x2ee1b5=_0x5d412e||client;return _0x2ee1b5[_0xc8b7('0x1e')](_0x337fbc,_0x3d189e)[_0xc8b7('0x1f')](function(_0x186dbd){logger[_0xc8b7('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x1b7dc0,'request\x20sent');logger[_0xc8b7('0x21')](_0xc8b7('0x22'),_0x1b7dc0,_0xc8b7('0x23'),JSON['stringify'](_0x186dbd));if(_0x186dbd['error']){if(_0x186dbd[_0xc8b7('0x24')]['code']===0x1f4){logger[_0xc8b7('0x24')]('DeskConfiguration,\x20%s,\x20%s',_0x1b7dc0,_0x186dbd[_0xc8b7('0x24')][_0xc8b7('0x25')]);return _0x26d70a(_0x186dbd['error'][_0xc8b7('0x25')]);}logger['error'](_0xc8b7('0x26'),_0x1b7dc0,_0x186dbd[_0xc8b7('0x24')][_0xc8b7('0x25')]);return _0xb53183(_0x186dbd['error'][_0xc8b7('0x25')]);}else{logger[_0xc8b7('0x20')](_0xc8b7('0x26'),_0x1b7dc0,'request\x20sent');_0xb53183(_0x186dbd[_0xc8b7('0x27')][_0xc8b7('0x25')]);}})[_0xc8b7('0x28')](function(_0x210fec){logger[_0xc8b7('0x24')](_0xc8b7('0x26'),_0x1b7dc0,_0x210fec);_0x26d70a(_0x210fec);});});}function respondWithStatusCode(_0x2acda2,_0x1c119f){_0x1c119f=_0x1c119f||0xcc;return function(_0x11f863){if(_0x11f863){return _0x2acda2[_0xc8b7('0x29')](_0x1c119f);}return _0x2acda2[_0xc8b7('0x2a')](_0x1c119f)['end']();};}function respondWithResult(_0x28e65d,_0x387d44){_0x387d44=_0x387d44||0xc8;return function(_0x3a9ce2){if(_0x3a9ce2){return _0x28e65d[_0xc8b7('0x2a')](_0x387d44)[_0xc8b7('0x2b')](_0x3a9ce2);}};}function respondWithFilteredResult(_0x311047,_0x5629ce){return function(_0x48682b){if(_0x48682b){var _0x16cc83=_0x48682b[_0xc8b7('0x2c')],_0x13ac30=_0x5629ce[_0xc8b7('0x2d')],_0x1eff90=_0x5629ce[_0xc8b7('0x2d')]+_0x5629ce['limit'],_0x2a2b25;if(_0x1eff90>=_0x16cc83){_0x1eff90=_0x16cc83;_0x2a2b25=0xc8;}else{_0x2a2b25=0xce;}_0x311047[_0xc8b7('0x2a')](_0x2a2b25);return _0x311047[_0xc8b7('0x2e')](_0xc8b7('0x2f'),_0x13ac30+'-'+_0x1eff90+'/'+_0x16cc83)[_0xc8b7('0x2b')](_0x48682b);}return null;};}function patchUpdates(_0x27f4b7){return function(_0x340af1){try{jsonpatch[_0xc8b7('0x30')](_0x340af1,_0x27f4b7,!![]);}catch(_0x9bb1af){return BPromise['reject'](_0x9bb1af);}return _0x340af1[_0xc8b7('0x31')]();};}function saveUpdates(_0x3c5db5,_0x982b0b){return function(_0x2971fc){if(_0x2971fc){return _0x2971fc[_0xc8b7('0x32')](_0x3c5db5)[_0xc8b7('0x1f')](function(_0x165094){return _0x165094;});}return null;};}function removeEntity(_0x34c7d6,_0x3f233e){return function(_0x37b57f){if(_0x37b57f){return _0x37b57f[_0xc8b7('0x33')]()[_0xc8b7('0x1f')](function(){_0x34c7d6[_0xc8b7('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0c30,_0x174c3a){return function(_0x500da8){if(!_0x500da8){_0x4b0c30[_0xc8b7('0x29')](0x194);}return _0x500da8;};}function handleError(_0x13b56e,_0x36504d){_0x36504d=_0x36504d||0x1f4;return function(_0x129e78){logger[_0xc8b7('0x24')](_0x129e78['stack']);if(_0x129e78[_0xc8b7('0x34')]){delete _0x129e78['name'];}_0x13b56e[_0xc8b7('0x2a')](_0x36504d)[_0xc8b7('0x35')](_0x129e78);};}exports[_0xc8b7('0x36')]=function(_0x28b134,_0x3706db){var _0x11cb85={},_0x18e3d8={},_0x145d7c={'count':0x0,'rows':[]};var _0x3911bd=_[_0xc8b7('0x37')](db[_0xc8b7('0x38')][_0xc8b7('0x39')],function(_0x1bc40e){return{'name':_0x1bc40e[_0xc8b7('0x3a')],'type':_0x1bc40e[_0xc8b7('0x3b')][_0xc8b7('0x3c')]};});_0x18e3d8['model']=_[_0xc8b7('0x37')](_0x3911bd,_0xc8b7('0x34'));_0x18e3d8[_0xc8b7('0x3d')]=_[_0xc8b7('0x3e')](_0x28b134[_0xc8b7('0x3d')]);_0x18e3d8[_0xc8b7('0x3f')]=_['intersection'](_0x18e3d8[_0xc8b7('0x40')],_0x18e3d8[_0xc8b7('0x3d')]);_0x11cb85[_0xc8b7('0x41')]=_[_0xc8b7('0x42')](_0x18e3d8['model'],qs['fields'](_0x28b134[_0xc8b7('0x3d')][_0xc8b7('0x43')]));_0x11cb85[_0xc8b7('0x41')]=_0x11cb85['attributes']['length']?_0x11cb85[_0xc8b7('0x41')]:_0x18e3d8[_0xc8b7('0x40')];if(!_0x28b134[_0xc8b7('0x3d')][_0xc8b7('0x44')](_0xc8b7('0x45'))){_0x11cb85[_0xc8b7('0x46')]=qs[_0xc8b7('0x46')](_0x28b134[_0xc8b7('0x3d')][_0xc8b7('0x46')]);_0x11cb85[_0xc8b7('0x2d')]=qs[_0xc8b7('0x2d')](_0x28b134['query'][_0xc8b7('0x2d')]);}_0x11cb85[_0xc8b7('0x47')]=qs['sort'](_0x28b134['query'][_0xc8b7('0x48')]);_0x11cb85[_0xc8b7('0x49')]=qs['filters'](_[_0xc8b7('0x4a')](_0x28b134[_0xc8b7('0x3d')],_0x18e3d8[_0xc8b7('0x3f')]),_0x3911bd);if(_0x28b134[_0xc8b7('0x3d')][_0xc8b7('0x4b')]){_0x11cb85[_0xc8b7('0x49')]=_[_0xc8b7('0x4c')](_0x11cb85[_0xc8b7('0x49')],{'$or':_[_0xc8b7('0x37')](_0x3911bd,function(_0x13c7b1){if(_0x13c7b1[_0xc8b7('0x3b')]!=='VIRTUAL'){var _0x4daa0d={};_0x4daa0d[_0x13c7b1[_0xc8b7('0x34')]]={'$like':'%'+_0x28b134['query'][_0xc8b7('0x4b')]+'%'};return _0x4daa0d;}})});}_0x11cb85=_[_0xc8b7('0x4c')]({},_0x11cb85,_0x28b134[_0xc8b7('0x4d')]);var _0x3a15be={'where':_0x11cb85[_0xc8b7('0x49')]};return db[_0xc8b7('0x38')][_0xc8b7('0x2c')](_0x3a15be)['then'](function(_0x2e3f7c){_0x145d7c[_0xc8b7('0x2c')]=_0x2e3f7c;if(_0x28b134[_0xc8b7('0x3d')][_0xc8b7('0x4e')]){_0x11cb85[_0xc8b7('0x4f')]=[{'all':!![]}];}return db[_0xc8b7('0x38')][_0xc8b7('0x50')](_0x11cb85);})[_0xc8b7('0x1f')](function(_0x100cf5){_0x145d7c[_0xc8b7('0x51')]=_0x100cf5;return _0x145d7c;})[_0xc8b7('0x1f')](respondWithFilteredResult(_0x3706db,_0x11cb85))[_0xc8b7('0x28')](handleError(_0x3706db,null));};exports[_0xc8b7('0x52')]=function(_0x3ebc99,_0x493681){var _0x3bd1c8={'raw':![],'where':{'id':_0x3ebc99[_0xc8b7('0x53')]['id']}},_0x41f284={};_0x41f284[_0xc8b7('0x40')]=_[_0xc8b7('0x3e')](db['DeskConfiguration'][_0xc8b7('0x39')]);_0x41f284[_0xc8b7('0x3d')]=_['keys'](_0x3ebc99[_0xc8b7('0x3d')]);_0x41f284[_0xc8b7('0x3f')]=_[_0xc8b7('0x42')](_0x41f284[_0xc8b7('0x40')],_0x41f284[_0xc8b7('0x3d')]);_0x3bd1c8[_0xc8b7('0x41')]=_['intersection'](_0x41f284[_0xc8b7('0x40')],qs[_0xc8b7('0x43')](_0x3ebc99['query'][_0xc8b7('0x43')]));_0x3bd1c8[_0xc8b7('0x41')]=_0x3bd1c8['attributes']['length']?_0x3bd1c8[_0xc8b7('0x41')]:_0x41f284['model'];if(_0x3ebc99['query'][_0xc8b7('0x4e')]){_0x3bd1c8[_0xc8b7('0x4f')]=[{'all':!![]}];}_0x3bd1c8=_[_0xc8b7('0x4c')]({},_0x3bd1c8,_0x3ebc99[_0xc8b7('0x4d')]);return db['DeskConfiguration'][_0xc8b7('0x54')](_0x3bd1c8)[_0xc8b7('0x1f')](handleEntityNotFound(_0x493681,null))[_0xc8b7('0x1f')](respondWithResult(_0x493681,null))[_0xc8b7('0x28')](handleError(_0x493681,null));};exports['create']=function(_0x11c7a9,_0x452196){return db[_0xc8b7('0x38')]['create'](_0x11c7a9[_0xc8b7('0x55')],{})[_0xc8b7('0x1f')](respondWithResult(_0x452196,0xc9))['catch'](handleError(_0x452196,null));};exports[_0xc8b7('0x32')]=function(_0xa708dc,_0x511f3f){if(_0xa708dc[_0xc8b7('0x55')]['id']){delete _0xa708dc[_0xc8b7('0x55')]['id'];}return db[_0xc8b7('0x38')][_0xc8b7('0x54')]({'where':{'id':_0xa708dc['params']['id']}})['then'](handleEntityNotFound(_0x511f3f,null))[_0xc8b7('0x1f')](saveUpdates(_0xa708dc[_0xc8b7('0x55')],null))[_0xc8b7('0x1f')](respondWithResult(_0x511f3f,null))[_0xc8b7('0x28')](handleError(_0x511f3f,null));};exports[_0xc8b7('0x33')]=function(_0x21e655,_0x28c60b){return db[_0xc8b7('0x38')][_0xc8b7('0x54')]({'where':{'id':_0x21e655[_0xc8b7('0x53')]['id']}})[_0xc8b7('0x1f')](handleEntityNotFound(_0x28c60b,null))[_0xc8b7('0x1f')](removeEntity(_0x28c60b,null))['catch'](handleError(_0x28c60b,null));};exports['getFields']=function(_0x46fd63,_0x40b351,_0x402797){var _0x262051={};var _0x49437d={};var _0x5422d6;var _0x13c15c;return db[_0xc8b7('0x38')][_0xc8b7('0x56')]({'where':{'id':_0x46fd63[_0xc8b7('0x53')]['id']}})[_0xc8b7('0x1f')](handleEntityNotFound(_0x40b351,null))['then'](function(_0x33b425){if(_0x33b425){_0x5422d6=_0x33b425;_0x49437d[_0xc8b7('0x40')]=_[_0xc8b7('0x3e')](db[_0xc8b7('0x57')][_0xc8b7('0x39')]);_0x49437d['query']=_['keys'](_0x46fd63['query']);_0x49437d['filters']=_[_0xc8b7('0x42')](_0x49437d['model'],_0x49437d['query']);_0x262051[_0xc8b7('0x41')]=_['intersection'](_0x49437d['model'],qs[_0xc8b7('0x43')](_0x46fd63[_0xc8b7('0x3d')][_0xc8b7('0x43')]));_0x262051[_0xc8b7('0x41')]=_0x262051[_0xc8b7('0x41')][_0xc8b7('0x58')]?_0x262051['attributes']:_0x49437d[_0xc8b7('0x40')];_0x262051['order']=qs['sort'](_0x46fd63[_0xc8b7('0x3d')][_0xc8b7('0x48')]);_0x262051['where']=qs['filters'](_[_0xc8b7('0x4a')](_0x46fd63['query'],_0x49437d[_0xc8b7('0x3f')]));if(_0x46fd63[_0xc8b7('0x3d')][_0xc8b7('0x4b')]){_0x262051[_0xc8b7('0x49')]=_['merge'](_0x262051['where'],{'$or':_[_0xc8b7('0x37')](_0x262051['attributes'],function(_0x3cd9a4){var _0x5e9769={};_0x5e9769[_0x3cd9a4]={'$like':'%'+_0x46fd63['query'][_0xc8b7('0x4b')]+'%'};return _0x5e9769;})});}_0x262051=_[_0xc8b7('0x4c')]({},_0x262051,_0x46fd63[_0xc8b7('0x4d')]);return _0x5422d6[_0xc8b7('0x59')](_0x262051);}})[_0xc8b7('0x1f')](function(_0x1ff99d){if(_0x1ff99d){_0x13c15c=_0x1ff99d[_0xc8b7('0x58')];if(!_0x46fd63['query'][_0xc8b7('0x44')](_0xc8b7('0x45'))){_0x262051[_0xc8b7('0x46')]=qs[_0xc8b7('0x46')](_0x46fd63[_0xc8b7('0x3d')][_0xc8b7('0x46')]);_0x262051['offset']=qs[_0xc8b7('0x2d')](_0x46fd63[_0xc8b7('0x3d')][_0xc8b7('0x2d')]);}return _0x5422d6['getFields'](_0x262051);}})[_0xc8b7('0x1f')](function(_0x31e61a){if(_0x31e61a){return _0x31e61a?{'count':_0x13c15c,'rows':_0x31e61a}:null;}})['then'](respondWithResult(_0x40b351,null))[_0xc8b7('0x28')](handleError(_0x40b351,null));};exports[_0xc8b7('0x5a')]=function(_0x3553d4,_0x7cf64,_0x4afbf2){var _0x19a564={};var _0x39cbbb={};var _0x38c264;var _0x22876b;return db[_0xc8b7('0x38')][_0xc8b7('0x56')]({'where':{'id':_0x3553d4[_0xc8b7('0x53')]['id']}})[_0xc8b7('0x1f')](handleEntityNotFound(_0x7cf64,null))[_0xc8b7('0x1f')](function(_0x2ceb11){if(_0x2ceb11){_0x38c264=_0x2ceb11;_0x39cbbb[_0xc8b7('0x40')]=_[_0xc8b7('0x3e')](db[_0xc8b7('0x57')]['rawAttributes']);_0x39cbbb[_0xc8b7('0x3d')]=_[_0xc8b7('0x3e')](_0x3553d4[_0xc8b7('0x3d')]);_0x39cbbb[_0xc8b7('0x3f')]=_[_0xc8b7('0x42')](_0x39cbbb['model'],_0x39cbbb['query']);_0x19a564[_0xc8b7('0x41')]=_[_0xc8b7('0x42')](_0x39cbbb[_0xc8b7('0x40')],qs['fields'](_0x3553d4[_0xc8b7('0x3d')]['fields']));_0x19a564[_0xc8b7('0x41')]=_0x19a564['attributes'][_0xc8b7('0x58')]?_0x19a564[_0xc8b7('0x41')]:_0x39cbbb[_0xc8b7('0x40')];_0x19a564['order']=qs[_0xc8b7('0x48')](_0x3553d4[_0xc8b7('0x3d')][_0xc8b7('0x48')]);_0x19a564[_0xc8b7('0x49')]=qs[_0xc8b7('0x3f')](_[_0xc8b7('0x4a')](_0x3553d4[_0xc8b7('0x3d')],_0x39cbbb['filters']));if(_0x3553d4[_0xc8b7('0x3d')][_0xc8b7('0x4b')]){_0x19a564[_0xc8b7('0x49')]=_['merge'](_0x19a564['where'],{'$or':_['map'](_0x19a564[_0xc8b7('0x41')],function(_0x479601){var _0x28266e={};_0x28266e[_0x479601]={'$like':'%'+_0x3553d4['query'][_0xc8b7('0x4b')]+'%'};return _0x28266e;})});}_0x19a564=_['merge']({},_0x19a564,_0x3553d4[_0xc8b7('0x4d')]);return _0x38c264[_0xc8b7('0x5a')](_0x19a564);}})[_0xc8b7('0x1f')](function(_0x8b8ca3){if(_0x8b8ca3){_0x22876b=_0x8b8ca3[_0xc8b7('0x58')];if(!_0x3553d4[_0xc8b7('0x3d')][_0xc8b7('0x44')]('nolimit')){_0x19a564[_0xc8b7('0x46')]=qs[_0xc8b7('0x46')](_0x3553d4[_0xc8b7('0x3d')]['limit']);_0x19a564[_0xc8b7('0x2d')]=qs[_0xc8b7('0x2d')](_0x3553d4[_0xc8b7('0x3d')]['offset']);}return _0x38c264[_0xc8b7('0x5a')](_0x19a564);}})[_0xc8b7('0x1f')](function(_0x541742){if(_0x541742){return _0x541742?{'count':_0x22876b,'rows':_0x541742}:null;}})[_0xc8b7('0x1f')](respondWithResult(_0x7cf64,null))['catch'](handleError(_0x7cf64,null));};exports[_0xc8b7('0x5b')]=function(_0x48d4e1,_0xbabecb,_0x5e2563){var _0x5a2d65={};var _0x416593={};var _0x417f9b;var _0x249068;return db[_0xc8b7('0x38')]['findOne']({'where':{'id':_0x48d4e1[_0xc8b7('0x53')]['id']}})[_0xc8b7('0x1f')](handleEntityNotFound(_0xbabecb,null))[_0xc8b7('0x1f')](function(_0xaee3b1){if(_0xaee3b1){_0x417f9b=_0xaee3b1;_0x416593[_0xc8b7('0x40')]=_['keys'](db[_0xc8b7('0x57')][_0xc8b7('0x39')]);_0x416593['query']=_[_0xc8b7('0x3e')](_0x48d4e1['query']);_0x416593[_0xc8b7('0x3f')]=_[_0xc8b7('0x42')](_0x416593['model'],_0x416593[_0xc8b7('0x3d')]);_0x5a2d65['attributes']=_['intersection'](_0x416593[_0xc8b7('0x40')],qs[_0xc8b7('0x43')](_0x48d4e1[_0xc8b7('0x3d')][_0xc8b7('0x43')]));_0x5a2d65['attributes']=_0x5a2d65[_0xc8b7('0x41')][_0xc8b7('0x58')]?_0x5a2d65[_0xc8b7('0x41')]:_0x416593['model'];_0x5a2d65[_0xc8b7('0x47')]=qs[_0xc8b7('0x48')](_0x48d4e1['query'][_0xc8b7('0x48')]);_0x5a2d65[_0xc8b7('0x49')]=qs[_0xc8b7('0x3f')](_['pick'](_0x48d4e1['query'],_0x416593[_0xc8b7('0x3f')]));if(_0x48d4e1[_0xc8b7('0x3d')][_0xc8b7('0x4b')]){_0x5a2d65[_0xc8b7('0x49')]=_['merge'](_0x5a2d65[_0xc8b7('0x49')],{'$or':_['map'](_0x5a2d65[_0xc8b7('0x41')],function(_0x1e9cb6){var _0x48c73c={};_0x48c73c[_0x1e9cb6]={'$like':'%'+_0x48d4e1[_0xc8b7('0x3d')][_0xc8b7('0x4b')]+'%'};return _0x48c73c;})});}_0x5a2d65=_[_0xc8b7('0x4c')]({},_0x5a2d65,_0x48d4e1[_0xc8b7('0x4d')]);return _0x417f9b[_0xc8b7('0x5b')](_0x5a2d65);}})[_0xc8b7('0x1f')](function(_0x3926e6){if(_0x3926e6){_0x249068=_0x3926e6[_0xc8b7('0x58')];if(!_0x48d4e1[_0xc8b7('0x3d')][_0xc8b7('0x44')](_0xc8b7('0x45'))){_0x5a2d65[_0xc8b7('0x46')]=qs['limit'](_0x48d4e1[_0xc8b7('0x3d')][_0xc8b7('0x46')]);_0x5a2d65[_0xc8b7('0x2d')]=qs['offset'](_0x48d4e1[_0xc8b7('0x3d')]['offset']);}return _0x417f9b['getDescriptions'](_0x5a2d65);}})[_0xc8b7('0x1f')](function(_0x2ffc95){if(_0x2ffc95){return _0x2ffc95?{'count':_0x249068,'rows':_0x2ffc95}:null;}})['then'](respondWithResult(_0xbabecb,null))[_0xc8b7('0x28')](handleError(_0xbabecb,null));};exports['getTags']=function(_0x4323e7,_0x52af9f,_0x23d0ea){var _0x15f060={};var _0x3c1bed={};var _0x44d89f;var _0x5615b6;return db[_0xc8b7('0x38')][_0xc8b7('0x56')]({'where':{'id':_0x4323e7[_0xc8b7('0x53')]['id']}})[_0xc8b7('0x1f')](handleEntityNotFound(_0x52af9f,null))[_0xc8b7('0x1f')](function(_0x43b9a1){if(_0x43b9a1){_0x44d89f=_0x43b9a1;_0x3c1bed['model']=_[_0xc8b7('0x3e')](db[_0xc8b7('0x5c')]['rawAttributes']);_0x3c1bed['query']=_[_0xc8b7('0x3e')](_0x4323e7[_0xc8b7('0x3d')]);_0x3c1bed[_0xc8b7('0x3f')]=_[_0xc8b7('0x42')](_0x3c1bed['model'],_0x3c1bed['query']);_0x15f060[_0xc8b7('0x41')]=_[_0xc8b7('0x42')](_0x3c1bed['model'],qs[_0xc8b7('0x43')](_0x4323e7[_0xc8b7('0x3d')][_0xc8b7('0x43')]));_0x15f060[_0xc8b7('0x41')]=_0x15f060['attributes'][_0xc8b7('0x58')]?_0x15f060[_0xc8b7('0x41')]:_0x3c1bed[_0xc8b7('0x40')];_0x15f060[_0xc8b7('0x47')]=qs[_0xc8b7('0x48')](_0x4323e7[_0xc8b7('0x3d')][_0xc8b7('0x48')]);_0x15f060[_0xc8b7('0x49')]=qs[_0xc8b7('0x3f')](_['pick'](_0x4323e7[_0xc8b7('0x3d')],_0x3c1bed[_0xc8b7('0x3f')]));if(_0x4323e7[_0xc8b7('0x3d')]['filter']){_0x15f060[_0xc8b7('0x49')]=_['merge'](_0x15f060['where'],{'$or':_[_0xc8b7('0x37')](_0x15f060['attributes'],function(_0xbcb695){var _0x298fe1={};_0x298fe1[_0xbcb695]={'$like':'%'+_0x4323e7[_0xc8b7('0x3d')][_0xc8b7('0x4b')]+'%'};return _0x298fe1;})});}_0x15f060=_[_0xc8b7('0x4c')]({},_0x15f060,_0x4323e7[_0xc8b7('0x4d')]);return _0x44d89f['getTags'](_0x15f060);}})[_0xc8b7('0x1f')](function(_0xf95833){if(_0xf95833){_0x5615b6=_0xf95833[_0xc8b7('0x58')];if(!_0x4323e7[_0xc8b7('0x3d')][_0xc8b7('0x44')]('nolimit')){_0x15f060[_0xc8b7('0x46')]=qs[_0xc8b7('0x46')](_0x4323e7[_0xc8b7('0x3d')][_0xc8b7('0x46')]);_0x15f060['offset']=qs[_0xc8b7('0x2d')](_0x4323e7[_0xc8b7('0x3d')][_0xc8b7('0x2d')]);}return _0x44d89f[_0xc8b7('0x5d')](_0x15f060);}})['then'](function(_0x491827){if(_0x491827){return _0x491827?{'count':_0x5615b6,'rows':_0x491827}:null;}})[_0xc8b7('0x1f')](respondWithResult(_0x52af9f,null))['catch'](handleError(_0x52af9f,null));};exports[_0xc8b7('0x5e')]=function(_0x2962d3,_0x5aa661,_0x406cc0){if(_0x2962d3[_0xc8b7('0x55')]['id']){delete _0x2962d3['body']['id'];}return db['DeskConfiguration'][_0xc8b7('0x56')]({'where':{'id':_0x2962d3['params']['id']}})[_0xc8b7('0x1f')](handleEntityNotFound(_0x5aa661,null))[_0xc8b7('0x1f')](function(_0x4954a4){if(_0x4954a4){return _0x4954a4['setTags'](_0x2962d3[_0xc8b7('0x55')][_0xc8b7('0x5f')]||[]);}return null;})['then'](respondWithResult(_0x5aa661,null))[_0xc8b7('0x28')](handleError(_0x5aa661,null));}; \ No newline at end of file +var _0x639d=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','show','options','find','create','body','params','getFields','findOne','DeskField','pick','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util'];(function(_0x25653d,_0x19e9d6){var _0x426255=function(_0x48e765){while(--_0x48e765){_0x25653d['push'](_0x25653d['shift']());}};_0x426255(++_0x19e9d6);}(_0x639d,0xbb));var _0xd639=function(_0x2aecea,_0x63e479){_0x2aecea=_0x2aecea-0x0;var _0x1f10d0=_0x639d[_0x2aecea];return _0x1f10d0;};'use strict';var pdf=require(_0xd639('0x0'));var emlformat=require(_0xd639('0x1'));var rimraf=require(_0xd639('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd639('0x3'));var rp=require(_0xd639('0x4'));var moment=require('moment');var BPromise=require(_0xd639('0x5'));var Mustache=require('mustache');var util=require(_0xd639('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd639('0x7'));var ejs=require(_0xd639('0x8'));var fs=require('fs');var _=require(_0xd639('0x9'));var squel=require(_0xd639('0xa'));var crypto=require(_0xd639('0xb'));var jsforce=require(_0xd639('0xc'));var deskjs=require(_0xd639('0xd'));var toCsv=require(_0xd639('0x7'));var querystring=require('querystring');var Papa=require(_0xd639('0xe'));var Redis=require(_0xd639('0xf'));var authService=require(_0xd639('0x10'));var qs=require(_0xd639('0x11'));var as=require(_0xd639('0x12'));var hardwareService=require(_0xd639('0x13'));var logger=require(_0xd639('0x14'))(_0xd639('0x15'));var utils=require(_0xd639('0x16'));var config=require('../../config/environment');var db=require(_0xd639('0x17'))['db'];var jayson=require(_0xd639('0x18'));var client=jayson[_0xd639('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x176d2a,_0x2d064e,_0x43d09b){if(_0x43d09b){var _0x59a6e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59a6e2[_0xd639('0x1a')](_0x2d064e)){return _0x176d2a;}else{throw new db[(_0xd639('0x1b'))]['ValidationError'](_0xd639('0x1c'));}}else{return _0x176d2a;}}function respondWithRpcPromise(_0x66d977,_0x4c7671,_0x3e4080,_0x1cc87b){return new BPromise(function(_0x3b7d7b,_0x1c30a1){var _0x27320e=_0x1cc87b||client;return _0x27320e['request'](_0x66d977,_0x3e4080)[_0xd639('0x1d')](function(_0x3a7c21){logger[_0xd639('0x1e')]('DeskConfiguration,\x20%s,\x20%s',_0x4c7671,_0xd639('0x1f'));logger[_0xd639('0x20')](_0xd639('0x21'),_0x4c7671,'request\x20sent',JSON[_0xd639('0x22')](_0x3a7c21));if(_0x3a7c21[_0xd639('0x23')]){if(_0x3a7c21[_0xd639('0x23')]['code']===0x1f4){logger[_0xd639('0x23')](_0xd639('0x24'),_0x4c7671,_0x3a7c21[_0xd639('0x23')][_0xd639('0x25')]);return _0x1c30a1(_0x3a7c21[_0xd639('0x23')][_0xd639('0x25')]);}logger[_0xd639('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x4c7671,_0x3a7c21['error'][_0xd639('0x25')]);return _0x3b7d7b(_0x3a7c21[_0xd639('0x23')][_0xd639('0x25')]);}else{logger[_0xd639('0x1e')](_0xd639('0x24'),_0x4c7671,_0xd639('0x1f'));_0x3b7d7b(_0x3a7c21[_0xd639('0x26')][_0xd639('0x25')]);}})[_0xd639('0x27')](function(_0x30265c){logger[_0xd639('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x4c7671,_0x30265c);_0x1c30a1(_0x30265c);});});}function respondWithStatusCode(_0x22f65c,_0x2497b3){_0x2497b3=_0x2497b3||0xcc;return function(_0x12a2f2){if(_0x12a2f2){return _0x22f65c[_0xd639('0x28')](_0x2497b3);}return _0x22f65c[_0xd639('0x29')](_0x2497b3)[_0xd639('0x2a')]();};}function respondWithResult(_0x5d026c,_0x1b0638){_0x1b0638=_0x1b0638||0xc8;return function(_0x2c40eb){if(_0x2c40eb){return _0x5d026c['status'](_0x1b0638)[_0xd639('0x2b')](_0x2c40eb);}};}function respondWithFilteredResult(_0x415347,_0x474c90){return function(_0x161426){if(_0x161426){var _0xbd387d=_0x161426[_0xd639('0x2c')],_0x19f4dd=_0x474c90[_0xd639('0x2d')],_0x4347d5=_0x474c90['offset']+_0x474c90['limit'],_0x5303df;if(_0x4347d5>=_0xbd387d){_0x4347d5=_0xbd387d;_0x5303df=0xc8;}else{_0x5303df=0xce;}_0x415347[_0xd639('0x29')](_0x5303df);return _0x415347[_0xd639('0x2e')](_0xd639('0x2f'),_0x19f4dd+'-'+_0x4347d5+'/'+_0xbd387d)[_0xd639('0x2b')](_0x161426);}return null;};}function patchUpdates(_0x5a8941){return function(_0x1a0e14){try{jsonpatch[_0xd639('0x30')](_0x1a0e14,_0x5a8941,!![]);}catch(_0x2a23aa){return BPromise[_0xd639('0x31')](_0x2a23aa);}return _0x1a0e14[_0xd639('0x32')]();};}function saveUpdates(_0x582dcd,_0x560324){return function(_0x4abb38){if(_0x4abb38){return _0x4abb38[_0xd639('0x33')](_0x582dcd)[_0xd639('0x1d')](function(_0x1bb821){return _0x1bb821;});}return null;};}function removeEntity(_0x55be3f,_0xc8f394){return function(_0x406f75){if(_0x406f75){return _0x406f75[_0xd639('0x34')]()[_0xd639('0x1d')](function(){_0x55be3f[_0xd639('0x29')](0xcc)[_0xd639('0x2a')]();});}};}function handleEntityNotFound(_0x1ba513,_0x1338e8){return function(_0x19f17c){if(!_0x19f17c){_0x1ba513[_0xd639('0x28')](0x194);}return _0x19f17c;};}function handleError(_0x1ce5bb,_0x4ae612){_0x4ae612=_0x4ae612||0x1f4;return function(_0x30e903){logger[_0xd639('0x23')](_0x30e903[_0xd639('0x35')]);if(_0x30e903[_0xd639('0x36')]){delete _0x30e903[_0xd639('0x36')];}_0x1ce5bb[_0xd639('0x29')](_0x4ae612)[_0xd639('0x37')](_0x30e903);};}exports[_0xd639('0x38')]=function(_0x1b96f0,_0x39c857){var _0x2d9e05={},_0x57d642={},_0x2f6d35={'count':0x0,'rows':[]};var _0xf79ff6=_[_0xd639('0x39')](db[_0xd639('0x3a')][_0xd639('0x3b')],function(_0x4dfb90){return{'name':_0x4dfb90['fieldName'],'type':_0x4dfb90[_0xd639('0x3c')]['key']};});_0x57d642[_0xd639('0x3d')]=_[_0xd639('0x39')](_0xf79ff6,_0xd639('0x36'));_0x57d642['query']=_[_0xd639('0x3e')](_0x1b96f0[_0xd639('0x3f')]);_0x57d642[_0xd639('0x40')]=_[_0xd639('0x41')](_0x57d642['model'],_0x57d642[_0xd639('0x3f')]);_0x2d9e05['attributes']=_['intersection'](_0x57d642['model'],qs[_0xd639('0x42')](_0x1b96f0[_0xd639('0x3f')][_0xd639('0x42')]));_0x2d9e05[_0xd639('0x43')]=_0x2d9e05[_0xd639('0x43')][_0xd639('0x44')]?_0x2d9e05[_0xd639('0x43')]:_0x57d642[_0xd639('0x3d')];if(!_0x1b96f0[_0xd639('0x3f')][_0xd639('0x45')]('nolimit')){_0x2d9e05[_0xd639('0x46')]=qs['limit'](_0x1b96f0['query']['limit']);_0x2d9e05[_0xd639('0x2d')]=qs[_0xd639('0x2d')](_0x1b96f0[_0xd639('0x3f')][_0xd639('0x2d')]);}_0x2d9e05[_0xd639('0x47')]=qs[_0xd639('0x48')](_0x1b96f0['query'][_0xd639('0x48')]);_0x2d9e05[_0xd639('0x49')]=qs['filters'](_['pick'](_0x1b96f0['query'],_0x57d642[_0xd639('0x40')]),_0xf79ff6);if(_0x1b96f0['query'][_0xd639('0x4a')]){_0x2d9e05['where']=_['merge'](_0x2d9e05[_0xd639('0x49')],{'$or':_[_0xd639('0x39')](_0xf79ff6,function(_0x2b6132){if(_0x2b6132[_0xd639('0x3c')]!==_0xd639('0x4b')){var _0x27524b={};_0x27524b[_0x2b6132[_0xd639('0x36')]]={'$like':'%'+_0x1b96f0['query'][_0xd639('0x4a')]+'%'};return _0x27524b;}})});}_0x2d9e05=_[_0xd639('0x4c')]({},_0x2d9e05,_0x1b96f0['options']);var _0x2f3cfb={'where':_0x2d9e05[_0xd639('0x49')]};return db[_0xd639('0x3a')][_0xd639('0x2c')](_0x2f3cfb)[_0xd639('0x1d')](function(_0x80dbf3){_0x2f6d35[_0xd639('0x2c')]=_0x80dbf3;if(_0x1b96f0[_0xd639('0x3f')][_0xd639('0x4d')]){_0x2d9e05[_0xd639('0x4e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xd639('0x4f')](_0x2d9e05);})[_0xd639('0x1d')](function(_0x54bfd2){_0x2f6d35['rows']=_0x54bfd2;return _0x2f6d35;})[_0xd639('0x1d')](respondWithFilteredResult(_0x39c857,_0x2d9e05))[_0xd639('0x27')](handleError(_0x39c857,null));};exports[_0xd639('0x50')]=function(_0x4a3556,_0x2c37e3){var _0x2009be={'raw':![],'where':{'id':_0x4a3556['params']['id']}},_0x42b412={};_0x42b412['model']=_[_0xd639('0x3e')](db[_0xd639('0x3a')]['rawAttributes']);_0x42b412[_0xd639('0x3f')]=_[_0xd639('0x3e')](_0x4a3556['query']);_0x42b412[_0xd639('0x40')]=_[_0xd639('0x41')](_0x42b412[_0xd639('0x3d')],_0x42b412[_0xd639('0x3f')]);_0x2009be[_0xd639('0x43')]=_[_0xd639('0x41')](_0x42b412[_0xd639('0x3d')],qs[_0xd639('0x42')](_0x4a3556[_0xd639('0x3f')][_0xd639('0x42')]));_0x2009be[_0xd639('0x43')]=_0x2009be[_0xd639('0x43')][_0xd639('0x44')]?_0x2009be[_0xd639('0x43')]:_0x42b412[_0xd639('0x3d')];if(_0x4a3556[_0xd639('0x3f')][_0xd639('0x4d')]){_0x2009be[_0xd639('0x4e')]=[{'all':!![]}];}_0x2009be=_[_0xd639('0x4c')]({},_0x2009be,_0x4a3556[_0xd639('0x51')]);return db[_0xd639('0x3a')][_0xd639('0x52')](_0x2009be)[_0xd639('0x1d')](handleEntityNotFound(_0x2c37e3,null))['then'](respondWithResult(_0x2c37e3,null))[_0xd639('0x27')](handleError(_0x2c37e3,null));};exports['create']=function(_0x268693,_0x4d52a2){return db[_0xd639('0x3a')][_0xd639('0x53')](_0x268693[_0xd639('0x54')],{})[_0xd639('0x1d')](respondWithResult(_0x4d52a2,0xc9))[_0xd639('0x27')](handleError(_0x4d52a2,null));};exports[_0xd639('0x33')]=function(_0x5db663,_0x18c62f){if(_0x5db663[_0xd639('0x54')]['id']){delete _0x5db663[_0xd639('0x54')]['id'];}return db[_0xd639('0x3a')][_0xd639('0x52')]({'where':{'id':_0x5db663[_0xd639('0x55')]['id']}})[_0xd639('0x1d')](handleEntityNotFound(_0x18c62f,null))['then'](saveUpdates(_0x5db663[_0xd639('0x54')],null))[_0xd639('0x1d')](respondWithResult(_0x18c62f,null))[_0xd639('0x27')](handleError(_0x18c62f,null));};exports['destroy']=function(_0x3ca4ec,_0x8454e4){return db[_0xd639('0x3a')]['find']({'where':{'id':_0x3ca4ec[_0xd639('0x55')]['id']}})[_0xd639('0x1d')](handleEntityNotFound(_0x8454e4,null))['then'](removeEntity(_0x8454e4,null))[_0xd639('0x27')](handleError(_0x8454e4,null));};exports[_0xd639('0x56')]=function(_0x2758d4,_0x3817de,_0x5ac5f1){var _0x482d74={};var _0x489608={};var _0x5c512f;var _0x111594;return db[_0xd639('0x3a')][_0xd639('0x57')]({'where':{'id':_0x2758d4['params']['id']}})[_0xd639('0x1d')](handleEntityNotFound(_0x3817de,null))[_0xd639('0x1d')](function(_0x15b329){if(_0x15b329){_0x5c512f=_0x15b329;_0x489608[_0xd639('0x3d')]=_[_0xd639('0x3e')](db[_0xd639('0x58')][_0xd639('0x3b')]);_0x489608[_0xd639('0x3f')]=_[_0xd639('0x3e')](_0x2758d4[_0xd639('0x3f')]);_0x489608[_0xd639('0x40')]=_[_0xd639('0x41')](_0x489608[_0xd639('0x3d')],_0x489608[_0xd639('0x3f')]);_0x482d74[_0xd639('0x43')]=_['intersection'](_0x489608[_0xd639('0x3d')],qs[_0xd639('0x42')](_0x2758d4['query']['fields']));_0x482d74[_0xd639('0x43')]=_0x482d74[_0xd639('0x43')]['length']?_0x482d74[_0xd639('0x43')]:_0x489608[_0xd639('0x3d')];_0x482d74[_0xd639('0x47')]=qs['sort'](_0x2758d4[_0xd639('0x3f')]['sort']);_0x482d74[_0xd639('0x49')]=qs[_0xd639('0x40')](_[_0xd639('0x59')](_0x2758d4[_0xd639('0x3f')],_0x489608[_0xd639('0x40')]));if(_0x2758d4['query'][_0xd639('0x4a')]){_0x482d74[_0xd639('0x49')]=_[_0xd639('0x4c')](_0x482d74[_0xd639('0x49')],{'$or':_[_0xd639('0x39')](_0x482d74[_0xd639('0x43')],function(_0xb47604){var _0x33df56={};_0x33df56[_0xb47604]={'$like':'%'+_0x2758d4[_0xd639('0x3f')][_0xd639('0x4a')]+'%'};return _0x33df56;})});}_0x482d74=_['merge']({},_0x482d74,_0x2758d4[_0xd639('0x51')]);return _0x5c512f[_0xd639('0x56')](_0x482d74);}})[_0xd639('0x1d')](function(_0x3b92a9){if(_0x3b92a9){_0x111594=_0x3b92a9['length'];if(!_0x2758d4[_0xd639('0x3f')][_0xd639('0x45')](_0xd639('0x5a'))){_0x482d74['limit']=qs['limit'](_0x2758d4[_0xd639('0x3f')][_0xd639('0x46')]);_0x482d74[_0xd639('0x2d')]=qs[_0xd639('0x2d')](_0x2758d4[_0xd639('0x3f')]['offset']);}return _0x5c512f[_0xd639('0x56')](_0x482d74);}})[_0xd639('0x1d')](function(_0x40436b){if(_0x40436b){return _0x40436b?{'count':_0x111594,'rows':_0x40436b}:null;}})[_0xd639('0x1d')](respondWithResult(_0x3817de,null))[_0xd639('0x27')](handleError(_0x3817de,null));};exports[_0xd639('0x5b')]=function(_0x35b3e9,_0x273a8d,_0x44ee47){var _0x16def5={};var _0x238a4b={};var _0x24fa27;var _0x19bc89;return db[_0xd639('0x3a')][_0xd639('0x57')]({'where':{'id':_0x35b3e9[_0xd639('0x55')]['id']}})[_0xd639('0x1d')](handleEntityNotFound(_0x273a8d,null))['then'](function(_0x707a80){if(_0x707a80){_0x24fa27=_0x707a80;_0x238a4b[_0xd639('0x3d')]=_['keys'](db[_0xd639('0x58')][_0xd639('0x3b')]);_0x238a4b[_0xd639('0x3f')]=_['keys'](_0x35b3e9[_0xd639('0x3f')]);_0x238a4b['filters']=_['intersection'](_0x238a4b['model'],_0x238a4b['query']);_0x16def5['attributes']=_[_0xd639('0x41')](_0x238a4b['model'],qs[_0xd639('0x42')](_0x35b3e9[_0xd639('0x3f')][_0xd639('0x42')]));_0x16def5[_0xd639('0x43')]=_0x16def5['attributes'][_0xd639('0x44')]?_0x16def5['attributes']:_0x238a4b[_0xd639('0x3d')];_0x16def5['order']=qs[_0xd639('0x48')](_0x35b3e9[_0xd639('0x3f')]['sort']);_0x16def5[_0xd639('0x49')]=qs[_0xd639('0x40')](_['pick'](_0x35b3e9[_0xd639('0x3f')],_0x238a4b[_0xd639('0x40')]));if(_0x35b3e9['query']['filter']){_0x16def5[_0xd639('0x49')]=_[_0xd639('0x4c')](_0x16def5['where'],{'$or':_[_0xd639('0x39')](_0x16def5['attributes'],function(_0x354977){var _0x5c276d={};_0x5c276d[_0x354977]={'$like':'%'+_0x35b3e9[_0xd639('0x3f')][_0xd639('0x4a')]+'%'};return _0x5c276d;})});}_0x16def5=_[_0xd639('0x4c')]({},_0x16def5,_0x35b3e9[_0xd639('0x51')]);return _0x24fa27[_0xd639('0x5b')](_0x16def5);}})[_0xd639('0x1d')](function(_0x16e141){if(_0x16e141){_0x19bc89=_0x16e141['length'];if(!_0x35b3e9[_0xd639('0x3f')][_0xd639('0x45')](_0xd639('0x5a'))){_0x16def5['limit']=qs[_0xd639('0x46')](_0x35b3e9['query'][_0xd639('0x46')]);_0x16def5[_0xd639('0x2d')]=qs[_0xd639('0x2d')](_0x35b3e9[_0xd639('0x3f')][_0xd639('0x2d')]);}return _0x24fa27[_0xd639('0x5b')](_0x16def5);}})[_0xd639('0x1d')](function(_0x47b369){if(_0x47b369){return _0x47b369?{'count':_0x19bc89,'rows':_0x47b369}:null;}})[_0xd639('0x1d')](respondWithResult(_0x273a8d,null))[_0xd639('0x27')](handleError(_0x273a8d,null));};exports[_0xd639('0x5c')]=function(_0x348d0c,_0x2a1c64,_0x5b489d){var _0x55a438={};var _0x5c5657={};var _0x1387e8;var _0x73592;return db['DeskConfiguration']['findOne']({'where':{'id':_0x348d0c[_0xd639('0x55')]['id']}})[_0xd639('0x1d')](handleEntityNotFound(_0x2a1c64,null))[_0xd639('0x1d')](function(_0x5b54eb){if(_0x5b54eb){_0x1387e8=_0x5b54eb;_0x5c5657[_0xd639('0x3d')]=_[_0xd639('0x3e')](db[_0xd639('0x58')][_0xd639('0x3b')]);_0x5c5657[_0xd639('0x3f')]=_[_0xd639('0x3e')](_0x348d0c[_0xd639('0x3f')]);_0x5c5657['filters']=_['intersection'](_0x5c5657[_0xd639('0x3d')],_0x5c5657[_0xd639('0x3f')]);_0x55a438[_0xd639('0x43')]=_[_0xd639('0x41')](_0x5c5657[_0xd639('0x3d')],qs['fields'](_0x348d0c[_0xd639('0x3f')][_0xd639('0x42')]));_0x55a438[_0xd639('0x43')]=_0x55a438['attributes'][_0xd639('0x44')]?_0x55a438[_0xd639('0x43')]:_0x5c5657['model'];_0x55a438[_0xd639('0x47')]=qs[_0xd639('0x48')](_0x348d0c[_0xd639('0x3f')][_0xd639('0x48')]);_0x55a438[_0xd639('0x49')]=qs['filters'](_[_0xd639('0x59')](_0x348d0c[_0xd639('0x3f')],_0x5c5657[_0xd639('0x40')]));if(_0x348d0c['query'][_0xd639('0x4a')]){_0x55a438[_0xd639('0x49')]=_[_0xd639('0x4c')](_0x55a438[_0xd639('0x49')],{'$or':_[_0xd639('0x39')](_0x55a438[_0xd639('0x43')],function(_0x2abaa2){var _0x1804ac={};_0x1804ac[_0x2abaa2]={'$like':'%'+_0x348d0c[_0xd639('0x3f')]['filter']+'%'};return _0x1804ac;})});}_0x55a438=_['merge']({},_0x55a438,_0x348d0c['options']);return _0x1387e8[_0xd639('0x5c')](_0x55a438);}})[_0xd639('0x1d')](function(_0x24b19a){if(_0x24b19a){_0x73592=_0x24b19a[_0xd639('0x44')];if(!_0x348d0c[_0xd639('0x3f')][_0xd639('0x45')](_0xd639('0x5a'))){_0x55a438[_0xd639('0x46')]=qs[_0xd639('0x46')](_0x348d0c[_0xd639('0x3f')][_0xd639('0x46')]);_0x55a438[_0xd639('0x2d')]=qs[_0xd639('0x2d')](_0x348d0c[_0xd639('0x3f')][_0xd639('0x2d')]);}return _0x1387e8[_0xd639('0x5c')](_0x55a438);}})[_0xd639('0x1d')](function(_0x46a79d){if(_0x46a79d){return _0x46a79d?{'count':_0x73592,'rows':_0x46a79d}:null;}})[_0xd639('0x1d')](respondWithResult(_0x2a1c64,null))[_0xd639('0x27')](handleError(_0x2a1c64,null));};exports['getTags']=function(_0x13f605,_0x1f50bf,_0xe41c81){var _0x38e195={};var _0x183347={};var _0x359cdf;var _0x13b56e;return db['DeskConfiguration'][_0xd639('0x57')]({'where':{'id':_0x13f605[_0xd639('0x55')]['id']}})[_0xd639('0x1d')](handleEntityNotFound(_0x1f50bf,null))[_0xd639('0x1d')](function(_0x51db50){if(_0x51db50){_0x359cdf=_0x51db50;_0x183347[_0xd639('0x3d')]=_[_0xd639('0x3e')](db[_0xd639('0x5d')][_0xd639('0x3b')]);_0x183347['query']=_['keys'](_0x13f605[_0xd639('0x3f')]);_0x183347['filters']=_[_0xd639('0x41')](_0x183347['model'],_0x183347['query']);_0x38e195[_0xd639('0x43')]=_[_0xd639('0x41')](_0x183347['model'],qs['fields'](_0x13f605[_0xd639('0x3f')]['fields']));_0x38e195[_0xd639('0x43')]=_0x38e195[_0xd639('0x43')]['length']?_0x38e195[_0xd639('0x43')]:_0x183347[_0xd639('0x3d')];_0x38e195[_0xd639('0x47')]=qs['sort'](_0x13f605[_0xd639('0x3f')][_0xd639('0x48')]);_0x38e195['where']=qs[_0xd639('0x40')](_[_0xd639('0x59')](_0x13f605['query'],_0x183347[_0xd639('0x40')]));if(_0x13f605[_0xd639('0x3f')]['filter']){_0x38e195[_0xd639('0x49')]=_[_0xd639('0x4c')](_0x38e195[_0xd639('0x49')],{'$or':_[_0xd639('0x39')](_0x38e195['attributes'],function(_0x34ec57){var _0x39e92c={};_0x39e92c[_0x34ec57]={'$like':'%'+_0x13f605['query'][_0xd639('0x4a')]+'%'};return _0x39e92c;})});}_0x38e195=_[_0xd639('0x4c')]({},_0x38e195,_0x13f605[_0xd639('0x51')]);return _0x359cdf[_0xd639('0x5e')](_0x38e195);}})[_0xd639('0x1d')](function(_0x5810e9){if(_0x5810e9){_0x13b56e=_0x5810e9[_0xd639('0x44')];if(!_0x13f605[_0xd639('0x3f')][_0xd639('0x45')](_0xd639('0x5a'))){_0x38e195[_0xd639('0x46')]=qs[_0xd639('0x46')](_0x13f605['query'][_0xd639('0x46')]);_0x38e195[_0xd639('0x2d')]=qs[_0xd639('0x2d')](_0x13f605['query'][_0xd639('0x2d')]);}return _0x359cdf[_0xd639('0x5e')](_0x38e195);}})[_0xd639('0x1d')](function(_0x18b1c5){if(_0x18b1c5){return _0x18b1c5?{'count':_0x13b56e,'rows':_0x18b1c5}:null;}})[_0xd639('0x1d')](respondWithResult(_0x1f50bf,null))[_0xd639('0x27')](handleError(_0x1f50bf,null));};exports[_0xd639('0x5f')]=function(_0x16cbe9,_0x2ff78d,_0x30fbbf){if(_0x16cbe9[_0xd639('0x54')]['id']){delete _0x16cbe9['body']['id'];}return db[_0xd639('0x3a')][_0xd639('0x57')]({'where':{'id':_0x16cbe9['params']['id']}})[_0xd639('0x1d')](handleEntityNotFound(_0x2ff78d,null))[_0xd639('0x1d')](function(_0x349a46){if(_0x349a46){return _0x349a46[_0xd639('0x5f')](_0x16cbe9[_0xd639('0x54')][_0xd639('0x60')]||[]);}return null;})[_0xd639('0x1d')](respondWithResult(_0x2ff78d,null))[_0xd639('0x27')](handleError(_0x2ff78d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3e4d2a4..d0854b8 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 _0xdcbf=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define','DeskConfiguration','int_desk_configurations'];(function(_0x159287,_0x1b3975){var _0x729661=function(_0x5099b5){while(--_0x5099b5){_0x159287['push'](_0x159287['shift']());}};_0x729661(++_0x1b3975);}(_0xdcbf,0x9a));var _0xfdcb=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xdcbf[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xfdcb('0x0'));var util=require(_0xfdcb('0x1'));var logger=require('../../config/logger')(_0xfdcb('0x2'));var moment=require(_0xfdcb('0x3'));var BPromise=require(_0xfdcb('0x4'));var rp=require(_0xfdcb('0x5'));var fs=require('fs');var path=require(_0xfdcb('0x6'));var rimraf=require('rimraf');var config=require(_0xfdcb('0x7'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x500b54,_0x4ff13f){return _0x500b54[_0xfdcb('0x8')](_0xfdcb('0x9'),attributes,{'tableName':_0xfdcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c8d=['bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x10d64b,_0x37205d){var _0x56cdbd=function(_0x540dd7){while(--_0x540dd7){_0x10d64b['push'](_0x10d64b['shift']());}};_0x56cdbd(++_0x37205d);}(_0x9c8d,0x113));var _0xd9c8=function(_0x1aa249,_0xacf92){_0x1aa249=_0x1aa249-0x0;var _0x4d7310=_0x9c8d[_0x1aa249];return _0x4d7310;};'use strict';var _=require(_0xd9c8('0x0'));var util=require(_0xd9c8('0x1'));var logger=require(_0xd9c8('0x2'))(_0xd9c8('0x3'));var moment=require(_0xd9c8('0x4'));var BPromise=require(_0xd9c8('0x5'));var rp=require(_0xd9c8('0x6'));var fs=require('fs');var path=require(_0xd9c8('0x7'));var rimraf=require('rimraf');var config=require(_0xd9c8('0x8'));var attributes=require(_0xd9c8('0x9'));module[_0xd9c8('0xa')]=function(_0x4c45ea,_0x5b9cf7){return _0x4c45ea[_0xd9c8('0xb')](_0xd9c8('0xc'),attributes,{'tableName':_0xd9c8('0xd'),'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 35e158b..455cdab 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 _0xa446=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x1df4e8,_0x356fdd){var _0x14ee7b=function(_0x54b0ac){while(--_0x54b0ac){_0x1df4e8['push'](_0x1df4e8['shift']());}};_0x14ee7b(++_0x356fdd);}(_0xa446,0xc6));var _0x6a44=function(_0x24d9eb,_0x425f8e){_0x24d9eb=_0x24d9eb-0x0;var _0x318c5f=_0xa446[_0x24d9eb];return _0x318c5f;};'use strict';var _=require(_0x6a44('0x0'));var util=require(_0x6a44('0x1'));var moment=require('moment');var BPromise=require(_0x6a44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a44('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a44('0x4'));var logger=require('../../config/logger')(_0x6a44('0x5'));var config=require(_0x6a44('0x6'));var jayson=require(_0x6a44('0x7'));var client=jayson[_0x6a44('0x8')][_0x6a44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x417c8c,_0x58be49,_0x1569ec){return new BPromise(function(_0x36a426,_0x4f72f8){return client[_0x6a44('0xa')](_0x417c8c,_0x1569ec)[_0x6a44('0xb')](function(_0x5596eb){logger[_0x6a44('0xc')](_0x6a44('0xd'),_0x58be49,_0x6a44('0xe'));logger[_0x6a44('0xf')](_0x6a44('0x10'),_0x58be49,_0x6a44('0xe'),JSON[_0x6a44('0x11')](_0x5596eb));if(_0x5596eb['error']){if(_0x5596eb[_0x6a44('0x12')][_0x6a44('0x13')]===0x1f4){logger['error'](_0x6a44('0xd'),_0x58be49,_0x5596eb[_0x6a44('0x12')][_0x6a44('0x14')]);return _0x4f72f8(_0x5596eb['error'][_0x6a44('0x14')]);}logger[_0x6a44('0x12')](_0x6a44('0xd'),_0x58be49,_0x5596eb[_0x6a44('0x12')][_0x6a44('0x14')]);return _0x36a426(_0x5596eb[_0x6a44('0x12')]['message']);}else{logger['info'](_0x6a44('0xd'),_0x58be49,_0x6a44('0xe'));_0x36a426(_0x5596eb['result'][_0x6a44('0x14')]);}})[_0x6a44('0x15')](function(_0x41af8f){logger[_0x6a44('0x12')](_0x6a44('0xd'),_0x58be49,_0x41af8f);_0x4f72f8(_0x41af8f);});});} \ No newline at end of file +var _0x1ae3=['request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4562f6,_0x4a6db5){var _0xad22d1=function(_0x94ca82){while(--_0x94ca82){_0x4562f6['push'](_0x4562f6['shift']());}};_0xad22d1(++_0x4a6db5);}(_0x1ae3,0x139));var _0x31ae=function(_0x499cd3,_0x244380){_0x499cd3=_0x499cd3-0x0;var _0xa0c04f=_0x1ae3[_0x499cd3];return _0xa0c04f;};'use strict';var _=require(_0x31ae('0x0'));var util=require(_0x31ae('0x1'));var moment=require('moment');var BPromise=require(_0x31ae('0x2'));var rs=require(_0x31ae('0x3'));var fs=require('fs');var Redis=require(_0x31ae('0x4'));var db=require(_0x31ae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x31ae('0x6'))(_0x31ae('0x7'));var config=require(_0x31ae('0x8'));var jayson=require(_0x31ae('0x9'));var client=jayson[_0x31ae('0xa')][_0x31ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3500b4,_0xea80aa,_0x43773f){return new BPromise(function(_0x1d2071,_0x3bf1d7){return client[_0x31ae('0xc')](_0x3500b4,_0x43773f)[_0x31ae('0xd')](function(_0x3b63ad){logger[_0x31ae('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xea80aa,_0x31ae('0xf'));logger[_0x31ae('0x10')](_0x31ae('0x11'),_0xea80aa,'request\x20sent',JSON[_0x31ae('0x12')](_0x3b63ad));if(_0x3b63ad[_0x31ae('0x13')]){if(_0x3b63ad['error'][_0x31ae('0x14')]===0x1f4){logger['error'](_0x31ae('0x15'),_0xea80aa,_0x3b63ad[_0x31ae('0x13')][_0x31ae('0x16')]);return _0x3bf1d7(_0x3b63ad['error'][_0x31ae('0x16')]);}logger[_0x31ae('0x13')](_0x31ae('0x15'),_0xea80aa,_0x3b63ad[_0x31ae('0x13')][_0x31ae('0x16')]);return _0x1d2071(_0x3b63ad[_0x31ae('0x13')]['message']);}else{logger[_0x31ae('0xe')](_0x31ae('0x15'),_0xea80aa,_0x31ae('0xf'));_0x1d2071(_0x3b63ad[_0x31ae('0x17')][_0x31ae('0x16')]);}})[_0x31ae('0x18')](function(_0x25be89){logger[_0x31ae('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0xea80aa,_0x25be89);_0x3bf1d7(_0x25be89);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3d8725b..3813b2b 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 _0xe9c2=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3c5ce3,_0x18c28e){var _0x4dc6dd=function(_0x3d994a){while(--_0x3d994a){_0x3c5ce3['push'](_0x3c5ce3['shift']());}};_0x4dc6dd(++_0x18c28e);}(_0xe9c2,0x72));var _0x2e9c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe9c2[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x2e9c('0x0'));var util=require(_0x2e9c('0x1'));var path=require('path');var timeout=require(_0x2e9c('0x2'));var express=require(_0x2e9c('0x3'));var router=express[_0x2e9c('0x4')]();var auth=require(_0x2e9c('0x5'));var interaction=require(_0x2e9c('0x6'));var config=require(_0x2e9c('0x7'));var controller=require(_0x2e9c('0x8'));router[_0x2e9c('0x9')]('/',auth[_0x2e9c('0xa')](),controller[_0x2e9c('0xb')]);router[_0x2e9c('0x9')](_0x2e9c('0xc'),auth['isAuthenticated'](),controller[_0x2e9c('0xd')]);router[_0x2e9c('0xe')]('/',auth[_0x2e9c('0xa')](),controller[_0x2e9c('0xf')]);router[_0x2e9c('0x10')]('/:id',auth[_0x2e9c('0xa')](),controller[_0x2e9c('0x11')]);router['delete'](_0x2e9c('0xc'),auth[_0x2e9c('0xa')](),controller[_0x2e9c('0x12')]);module[_0x2e9c('0x13')]=router; \ No newline at end of file +var _0x7fef=['util','path','express','Router','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x7fef,0xbb));var _0xf7fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7fef[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xf7fe('0x0'));var path=require(_0xf7fe('0x1'));var timeout=require('connect-timeout');var express=require(_0xf7fe('0x2'));var router=express[_0xf7fe('0x3')]();var auth=require(_0xf7fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf7fe('0x5'));var controller=require(_0xf7fe('0x6'));router[_0xf7fe('0x7')]('/',auth[_0xf7fe('0x8')](),controller[_0xf7fe('0x9')]);router[_0xf7fe('0x7')](_0xf7fe('0xa'),auth[_0xf7fe('0x8')](),controller[_0xf7fe('0xb')]);router[_0xf7fe('0xc')]('/',auth[_0xf7fe('0x8')](),controller[_0xf7fe('0xd')]);router[_0xf7fe('0xe')](_0xf7fe('0xa'),auth[_0xf7fe('0x8')](),controller['update']);router[_0xf7fe('0xf')](_0xf7fe('0xa'),auth['isAuthenticated'](),controller[_0xf7fe('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e740b03..bb30c24 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 _0x18e8=['customVariable','keyValue','ENUM','string','variable','STRING','BOOLEAN','sequelize','exports'];(function(_0x34ba14,_0x3db2af){var _0x288a36=function(_0xd588b7){while(--_0xd588b7){_0x34ba14['push'](_0x34ba14['shift']());}};_0x288a36(++_0x3db2af);}(_0x18e8,0xdf));var _0x818e=function(_0x4ca7da,_0x173924){_0x4ca7da=_0x4ca7da-0x0;var _0x3e0238=_0x18e8[_0x4ca7da];return _0x3e0238;};'use strict';var Sequelize=require(_0x818e('0x0'));module[_0x818e('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x818e('0x2'),_0x818e('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x818e('0x4')](_0x818e('0x5'),_0x818e('0x6'),_0x818e('0x2'))},'keyContent':{'type':Sequelize[_0x818e('0x7')]},'idField':{'type':Sequelize[_0x818e('0x7')]},'nameField':{'type':Sequelize[_0x818e('0x7')]},'customField':{'type':Sequelize[_0x818e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa963=['sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN'];(function(_0x4cad20,_0x385dcf){var _0x93aeba=function(_0x27a305){while(--_0x27a305){_0x4cad20['push'](_0x4cad20['shift']());}};_0x93aeba(++_0x385dcf);}(_0xa963,0x195));var _0x3a96=function(_0x24460f,_0x348536){_0x24460f=_0x24460f-0x0;var _0x4765da=_0xa963[_0x24460f];return _0x4765da;};'use strict';var Sequelize=require(_0x3a96('0x0'));module[_0x3a96('0x1')]={'type':{'type':Sequelize[_0x3a96('0x2')](_0x3a96('0x3'),_0x3a96('0x4'),'customVariable',_0x3a96('0x5')),'defaultValue':_0x3a96('0x3')},'content':{'type':Sequelize[_0x3a96('0x6')]},'key':{'type':Sequelize[_0x3a96('0x6')]},'keyType':{'type':Sequelize[_0x3a96('0x2')](_0x3a96('0x3'),_0x3a96('0x4'),_0x3a96('0x7'))},'keyContent':{'type':Sequelize[_0x3a96('0x6')]},'idField':{'type':Sequelize[_0x3a96('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3a96('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3a96('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 319d1d3..2238294 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 _0xdd34=['bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','attributes','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x5161fc,_0x37c5f6){var _0x38490b=function(_0x49ebd8){while(--_0x49ebd8){_0x5161fc['push'](_0x5161fc['shift']());}};_0x38490b(++_0x37c5f6);}(_0xdd34,0x1a5));var _0x4dd3=function(_0x5da187,_0x45b0a8){_0x5da187=_0x5da187-0x0;var _0x1a8cd6=_0xdd34[_0x5da187];return _0x1a8cd6;};'use strict';var pdf=require(_0x4dd3('0x0'));var emlformat=require(_0x4dd3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4dd3('0x2'));var jsonpatch=require(_0x4dd3('0x3'));var rp=require(_0x4dd3('0x4'));var moment=require('moment');var BPromise=require(_0x4dd3('0x5'));var Mustache=require('mustache');var util=require(_0x4dd3('0x6'));var path=require(_0x4dd3('0x7'));var sox=require(_0x4dd3('0x8'));var csv=require(_0x4dd3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4dd3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4dd3('0xb'));var deskjs=require(_0x4dd3('0xc'));var toCsv=require(_0x4dd3('0x9'));var querystring=require('querystring');var Papa=require(_0x4dd3('0xd'));var Redis=require(_0x4dd3('0xe'));var authService=require(_0x4dd3('0xf'));var qs=require(_0x4dd3('0x10'));var as=require(_0x4dd3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4dd3('0x12'));var config=require(_0x4dd3('0x13'));var db=require(_0x4dd3('0x14'))['db'];function respondWithStatusCode(_0x4b0d78,_0x115b40){_0x115b40=_0x115b40||0xcc;return function(_0xc1bc3f){if(_0xc1bc3f){return _0x4b0d78[_0x4dd3('0x15')](_0x115b40);}return _0x4b0d78['status'](_0x115b40)[_0x4dd3('0x16')]();};}function respondWithResult(_0x540bd0,_0x5e2918){_0x5e2918=_0x5e2918||0xc8;return function(_0x157a2d){if(_0x157a2d){return _0x540bd0[_0x4dd3('0x17')](_0x5e2918)['json'](_0x157a2d);}};}function respondWithFilteredResult(_0x2608ee,_0xb4dce7){return function(_0x54eedf){if(_0x54eedf){var _0x2e993f=_0x54eedf[_0x4dd3('0x18')],_0x21b09f=_0xb4dce7[_0x4dd3('0x19')],_0x4c0592=_0xb4dce7[_0x4dd3('0x19')]+_0xb4dce7[_0x4dd3('0x1a')],_0x3a36c7;if(_0x4c0592>=_0x2e993f){_0x4c0592=_0x2e993f;_0x3a36c7=0xc8;}else{_0x3a36c7=0xce;}_0x2608ee[_0x4dd3('0x17')](_0x3a36c7);return _0x2608ee['set'](_0x4dd3('0x1b'),_0x21b09f+'-'+_0x4c0592+'/'+_0x2e993f)[_0x4dd3('0x1c')](_0x54eedf);}return null;};}function patchUpdates(_0x1d74dd){return function(_0x2142ec){try{jsonpatch[_0x4dd3('0x1d')](_0x2142ec,_0x1d74dd,!![]);}catch(_0x43882e){return BPromise[_0x4dd3('0x1e')](_0x43882e);}return _0x2142ec[_0x4dd3('0x1f')]();};}function saveUpdates(_0x5b533c,_0x1787d8){return function(_0x2a5f1e){if(_0x2a5f1e){return _0x2a5f1e[_0x4dd3('0x20')](_0x5b533c)[_0x4dd3('0x21')](function(_0x4d2278){return _0x4d2278;});}return null;};}function removeEntity(_0x4f3243,_0x400e56){return function(_0x584a28){if(_0x584a28){return _0x584a28[_0x4dd3('0x22')]()[_0x4dd3('0x21')](function(){_0x4f3243[_0x4dd3('0x17')](0xcc)[_0x4dd3('0x16')]();});}};}function handleEntityNotFound(_0x1f4069,_0x5c24bf){return function(_0x595ebe){if(!_0x595ebe){_0x1f4069[_0x4dd3('0x15')](0x194);}return _0x595ebe;};}function handleError(_0x4e26c0,_0x473281){_0x473281=_0x473281||0x1f4;return function(_0x38b4f2){logger[_0x4dd3('0x23')](_0x38b4f2[_0x4dd3('0x24')]);if(_0x38b4f2['name']){delete _0x38b4f2[_0x4dd3('0x25')];}_0x4e26c0[_0x4dd3('0x17')](_0x473281)['send'](_0x38b4f2);};}exports[_0x4dd3('0x26')]=function(_0x291d09,_0x426619){var _0x20791b={},_0xc5b1bf={},_0x553fe2={'count':0x0,'rows':[]};var _0x2018c6=_[_0x4dd3('0x27')](db[_0x4dd3('0x28')][_0x4dd3('0x29')],function(_0xf59b37){return{'name':_0xf59b37[_0x4dd3('0x2a')],'type':_0xf59b37[_0x4dd3('0x2b')][_0x4dd3('0x2c')]};});_0xc5b1bf[_0x4dd3('0x2d')]=_[_0x4dd3('0x27')](_0x2018c6,_0x4dd3('0x25'));_0xc5b1bf[_0x4dd3('0x2e')]=_[_0x4dd3('0x2f')](_0x291d09['query']);_0xc5b1bf[_0x4dd3('0x30')]=_[_0x4dd3('0x31')](_0xc5b1bf[_0x4dd3('0x2d')],_0xc5b1bf[_0x4dd3('0x2e')]);_0x20791b['attributes']=_[_0x4dd3('0x31')](_0xc5b1bf['model'],qs[_0x4dd3('0x32')](_0x291d09['query'][_0x4dd3('0x32')]));_0x20791b['attributes']=_0x20791b['attributes'][_0x4dd3('0x33')]?_0x20791b['attributes']:_0xc5b1bf[_0x4dd3('0x2d')];if(!_0x291d09[_0x4dd3('0x2e')][_0x4dd3('0x34')](_0x4dd3('0x35'))){_0x20791b[_0x4dd3('0x1a')]=qs[_0x4dd3('0x1a')](_0x291d09['query'][_0x4dd3('0x1a')]);_0x20791b[_0x4dd3('0x19')]=qs[_0x4dd3('0x19')](_0x291d09[_0x4dd3('0x2e')][_0x4dd3('0x19')]);}_0x20791b[_0x4dd3('0x36')]=qs[_0x4dd3('0x37')](_0x291d09[_0x4dd3('0x2e')][_0x4dd3('0x37')]);_0x20791b['where']=qs[_0x4dd3('0x30')](_[_0x4dd3('0x38')](_0x291d09[_0x4dd3('0x2e')],_0xc5b1bf[_0x4dd3('0x30')]),_0x2018c6);if(_0x291d09[_0x4dd3('0x2e')][_0x4dd3('0x39')]){_0x20791b[_0x4dd3('0x3a')]=_[_0x4dd3('0x3b')](_0x20791b[_0x4dd3('0x3a')],{'$or':_[_0x4dd3('0x27')](_0x2018c6,function(_0x22aaa8){if(_0x22aaa8['type']!=='VIRTUAL'){var _0x4ae586={};_0x4ae586[_0x22aaa8[_0x4dd3('0x25')]]={'$like':'%'+_0x291d09[_0x4dd3('0x2e')]['filter']+'%'};return _0x4ae586;}})});}_0x20791b=_['merge']({},_0x20791b,_0x291d09[_0x4dd3('0x3c')]);var _0xea5b16={'where':_0x20791b[_0x4dd3('0x3a')]};return db['DeskField']['count'](_0xea5b16)['then'](function(_0x242d97){_0x553fe2[_0x4dd3('0x18')]=_0x242d97;if(_0x291d09[_0x4dd3('0x2e')][_0x4dd3('0x3d')]){_0x20791b[_0x4dd3('0x3e')]=[{'all':!![]}];}return db[_0x4dd3('0x28')][_0x4dd3('0x3f')](_0x20791b);})[_0x4dd3('0x21')](function(_0x4721b5){_0x553fe2[_0x4dd3('0x40')]=_0x4721b5;return _0x553fe2;})[_0x4dd3('0x21')](respondWithFilteredResult(_0x426619,_0x20791b))[_0x4dd3('0x41')](handleError(_0x426619,null));};exports['show']=function(_0x344600,_0x52b2b2){var _0x33977a={'raw':!![],'where':{'id':_0x344600[_0x4dd3('0x42')]['id']}},_0x19e3b7={};_0x19e3b7[_0x4dd3('0x2d')]=_['keys'](db[_0x4dd3('0x28')]['rawAttributes']);_0x19e3b7[_0x4dd3('0x2e')]=_[_0x4dd3('0x2f')](_0x344600['query']);_0x19e3b7['filters']=_[_0x4dd3('0x31')](_0x19e3b7[_0x4dd3('0x2d')],_0x19e3b7['query']);_0x33977a[_0x4dd3('0x43')]=_['intersection'](_0x19e3b7[_0x4dd3('0x2d')],qs['fields'](_0x344600[_0x4dd3('0x2e')]['fields']));_0x33977a['attributes']=_0x33977a[_0x4dd3('0x43')][_0x4dd3('0x33')]?_0x33977a[_0x4dd3('0x43')]:_0x19e3b7[_0x4dd3('0x2d')];if(_0x344600['query'][_0x4dd3('0x3d')]){_0x33977a[_0x4dd3('0x3e')]=[{'all':!![]}];}_0x33977a=_[_0x4dd3('0x3b')]({},_0x33977a,_0x344600['options']);return db['DeskField']['find'](_0x33977a)['then'](handleEntityNotFound(_0x52b2b2,null))['then'](respondWithResult(_0x52b2b2,null))['catch'](handleError(_0x52b2b2,null));};exports['create']=function(_0x2d04a5,_0x3e390){return db['DeskField'][_0x4dd3('0x44')](_0x2d04a5[_0x4dd3('0x45')],{})[_0x4dd3('0x21')](respondWithResult(_0x3e390,0xc9))[_0x4dd3('0x41')](handleError(_0x3e390,null));};exports['update']=function(_0x5c4141,_0x35bad8){if(_0x5c4141['body']['id']){delete _0x5c4141['body']['id'];}return db['DeskField'][_0x4dd3('0x46')]({'where':{'id':_0x5c4141[_0x4dd3('0x42')]['id']}})[_0x4dd3('0x21')](handleEntityNotFound(_0x35bad8,null))[_0x4dd3('0x21')](saveUpdates(_0x5c4141['body'],null))[_0x4dd3('0x21')](respondWithResult(_0x35bad8,null))[_0x4dd3('0x41')](handleError(_0x35bad8,null));};exports[_0x4dd3('0x22')]=function(_0x23e54f,_0x54e4f9){return db[_0x4dd3('0x28')][_0x4dd3('0x46')]({'where':{'id':_0x23e54f[_0x4dd3('0x42')]['id']}})[_0x4dd3('0x21')](handleEntityNotFound(_0x54e4f9,null))[_0x4dd3('0x21')](removeEntity(_0x54e4f9,null))[_0x4dd3('0x41')](handleError(_0x54e4f9,null));}; \ No newline at end of file +var _0xec09=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','DeskField','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xec09,0x180));var _0x9ec0=function(_0x1938c5,_0x2a6738){_0x1938c5=_0x1938c5-0x0;var _0x2604f6=_0xec09[_0x1938c5];return _0x2604f6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9ec0('0x0'));var rimraf=require(_0x9ec0('0x1'));var zipdir=require(_0x9ec0('0x2'));var jsonpatch=require(_0x9ec0('0x3'));var rp=require(_0x9ec0('0x4'));var moment=require(_0x9ec0('0x5'));var BPromise=require(_0x9ec0('0x6'));var Mustache=require('mustache');var util=require(_0x9ec0('0x7'));var path=require('path');var sox=require(_0x9ec0('0x8'));var csv=require(_0x9ec0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ec0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ec0('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ec0('0xc'));var Papa=require('papaparse');var Redis=require(_0x9ec0('0xd'));var authService=require(_0x9ec0('0xe'));var qs=require(_0x9ec0('0xf'));var as=require(_0x9ec0('0x10'));var hardwareService=require(_0x9ec0('0x11'));var logger=require(_0x9ec0('0x12'))('api');var utils=require(_0x9ec0('0x13'));var config=require(_0x9ec0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b86ca,_0x3b3ce3){_0x3b3ce3=_0x3b3ce3||0xcc;return function(_0x44c886){if(_0x44c886){return _0x1b86ca['sendStatus'](_0x3b3ce3);}return _0x1b86ca[_0x9ec0('0x15')](_0x3b3ce3)[_0x9ec0('0x16')]();};}function respondWithResult(_0x13eae7,_0x1bcc49){_0x1bcc49=_0x1bcc49||0xc8;return function(_0x3849de){if(_0x3849de){return _0x13eae7[_0x9ec0('0x15')](_0x1bcc49)[_0x9ec0('0x17')](_0x3849de);}};}function respondWithFilteredResult(_0x1b6ca5,_0x1beee9){return function(_0x3f1f6f){if(_0x3f1f6f){var _0x53b8a1=_0x3f1f6f[_0x9ec0('0x18')],_0x40ecfd=_0x1beee9[_0x9ec0('0x19')],_0x53de44=_0x1beee9[_0x9ec0('0x19')]+_0x1beee9[_0x9ec0('0x1a')],_0x175c32;if(_0x53de44>=_0x53b8a1){_0x53de44=_0x53b8a1;_0x175c32=0xc8;}else{_0x175c32=0xce;}_0x1b6ca5[_0x9ec0('0x15')](_0x175c32);return _0x1b6ca5[_0x9ec0('0x1b')](_0x9ec0('0x1c'),_0x40ecfd+'-'+_0x53de44+'/'+_0x53b8a1)[_0x9ec0('0x17')](_0x3f1f6f);}return null;};}function patchUpdates(_0xdbb40b){return function(_0x27287f){try{jsonpatch[_0x9ec0('0x1d')](_0x27287f,_0xdbb40b,!![]);}catch(_0x384726){return BPromise[_0x9ec0('0x1e')](_0x384726);}return _0x27287f[_0x9ec0('0x1f')]();};}function saveUpdates(_0x29e61a,_0x56c3fb){return function(_0x207b33){if(_0x207b33){return _0x207b33[_0x9ec0('0x20')](_0x29e61a)[_0x9ec0('0x21')](function(_0x4fdf96){return _0x4fdf96;});}return null;};}function removeEntity(_0x321978,_0x420672){return function(_0x24cd40){if(_0x24cd40){return _0x24cd40[_0x9ec0('0x22')]()['then'](function(){_0x321978[_0x9ec0('0x15')](0xcc)[_0x9ec0('0x16')]();});}};}function handleEntityNotFound(_0x4f54ba,_0x1dc0b0){return function(_0x361635){if(!_0x361635){_0x4f54ba[_0x9ec0('0x23')](0x194);}return _0x361635;};}function handleError(_0x31d85d,_0x28efdb){_0x28efdb=_0x28efdb||0x1f4;return function(_0x17c82b){logger[_0x9ec0('0x24')](_0x17c82b['stack']);if(_0x17c82b['name']){delete _0x17c82b[_0x9ec0('0x25')];}_0x31d85d[_0x9ec0('0x15')](_0x28efdb)[_0x9ec0('0x26')](_0x17c82b);};}exports['index']=function(_0x16d7e7,_0x2b3650){var _0x338e30={},_0x2cc08c={},_0x34da33={'count':0x0,'rows':[]};var _0x1d1f2d=_[_0x9ec0('0x27')](db[_0x9ec0('0x28')]['rawAttributes'],function(_0x524de1){return{'name':_0x524de1[_0x9ec0('0x29')],'type':_0x524de1[_0x9ec0('0x2a')]['key']};});_0x2cc08c[_0x9ec0('0x2b')]=_[_0x9ec0('0x27')](_0x1d1f2d,_0x9ec0('0x25'));_0x2cc08c[_0x9ec0('0x2c')]=_[_0x9ec0('0x2d')](_0x16d7e7[_0x9ec0('0x2c')]);_0x2cc08c[_0x9ec0('0x2e')]=_['intersection'](_0x2cc08c['model'],_0x2cc08c['query']);_0x338e30[_0x9ec0('0x2f')]=_[_0x9ec0('0x30')](_0x2cc08c[_0x9ec0('0x2b')],qs[_0x9ec0('0x31')](_0x16d7e7['query']['fields']));_0x338e30['attributes']=_0x338e30[_0x9ec0('0x2f')]['length']?_0x338e30[_0x9ec0('0x2f')]:_0x2cc08c[_0x9ec0('0x2b')];if(!_0x16d7e7[_0x9ec0('0x2c')][_0x9ec0('0x32')](_0x9ec0('0x33'))){_0x338e30[_0x9ec0('0x1a')]=qs[_0x9ec0('0x1a')](_0x16d7e7[_0x9ec0('0x2c')][_0x9ec0('0x1a')]);_0x338e30[_0x9ec0('0x19')]=qs[_0x9ec0('0x19')](_0x16d7e7[_0x9ec0('0x2c')][_0x9ec0('0x19')]);}_0x338e30[_0x9ec0('0x34')]=qs['sort'](_0x16d7e7[_0x9ec0('0x2c')][_0x9ec0('0x35')]);_0x338e30['where']=qs[_0x9ec0('0x2e')](_[_0x9ec0('0x36')](_0x16d7e7[_0x9ec0('0x2c')],_0x2cc08c[_0x9ec0('0x2e')]),_0x1d1f2d);if(_0x16d7e7[_0x9ec0('0x2c')]['filter']){_0x338e30['where']=_[_0x9ec0('0x37')](_0x338e30['where'],{'$or':_[_0x9ec0('0x27')](_0x1d1f2d,function(_0x4cb012){if(_0x4cb012['type']!==_0x9ec0('0x38')){var _0x42d8b2={};_0x42d8b2[_0x4cb012[_0x9ec0('0x25')]]={'$like':'%'+_0x16d7e7[_0x9ec0('0x2c')][_0x9ec0('0x39')]+'%'};return _0x42d8b2;}})});}_0x338e30=_[_0x9ec0('0x37')]({},_0x338e30,_0x16d7e7[_0x9ec0('0x3a')]);var _0x34fcaf={'where':_0x338e30['where']};return db[_0x9ec0('0x28')][_0x9ec0('0x18')](_0x34fcaf)['then'](function(_0x48e0d8){_0x34da33[_0x9ec0('0x18')]=_0x48e0d8;if(_0x16d7e7[_0x9ec0('0x2c')][_0x9ec0('0x3b')]){_0x338e30[_0x9ec0('0x3c')]=[{'all':!![]}];}return db[_0x9ec0('0x28')]['findAll'](_0x338e30);})[_0x9ec0('0x21')](function(_0xcb3166){_0x34da33[_0x9ec0('0x3d')]=_0xcb3166;return _0x34da33;})['then'](respondWithFilteredResult(_0x2b3650,_0x338e30))[_0x9ec0('0x3e')](handleError(_0x2b3650,null));};exports['show']=function(_0x42a715,_0x4a3cdb){var _0x267cd5={'raw':!![],'where':{'id':_0x42a715[_0x9ec0('0x3f')]['id']}},_0x52a9f8={};_0x52a9f8[_0x9ec0('0x2b')]=_[_0x9ec0('0x2d')](db[_0x9ec0('0x28')]['rawAttributes']);_0x52a9f8['query']=_['keys'](_0x42a715[_0x9ec0('0x2c')]);_0x52a9f8[_0x9ec0('0x2e')]=_[_0x9ec0('0x30')](_0x52a9f8[_0x9ec0('0x2b')],_0x52a9f8['query']);_0x267cd5[_0x9ec0('0x2f')]=_['intersection'](_0x52a9f8[_0x9ec0('0x2b')],qs[_0x9ec0('0x31')](_0x42a715[_0x9ec0('0x2c')][_0x9ec0('0x31')]));_0x267cd5['attributes']=_0x267cd5[_0x9ec0('0x2f')][_0x9ec0('0x40')]?_0x267cd5[_0x9ec0('0x2f')]:_0x52a9f8['model'];if(_0x42a715[_0x9ec0('0x2c')][_0x9ec0('0x3b')]){_0x267cd5['include']=[{'all':!![]}];}_0x267cd5=_[_0x9ec0('0x37')]({},_0x267cd5,_0x42a715['options']);return db[_0x9ec0('0x28')][_0x9ec0('0x41')](_0x267cd5)[_0x9ec0('0x21')](handleEntityNotFound(_0x4a3cdb,null))[_0x9ec0('0x21')](respondWithResult(_0x4a3cdb,null))[_0x9ec0('0x3e')](handleError(_0x4a3cdb,null));};exports[_0x9ec0('0x42')]=function(_0x4c52c6,_0x10c450){return db[_0x9ec0('0x28')]['create'](_0x4c52c6[_0x9ec0('0x43')],{})[_0x9ec0('0x21')](respondWithResult(_0x10c450,0xc9))['catch'](handleError(_0x10c450,null));};exports[_0x9ec0('0x20')]=function(_0x4f315c,_0x1f5da4){if(_0x4f315c[_0x9ec0('0x43')]['id']){delete _0x4f315c[_0x9ec0('0x43')]['id'];}return db[_0x9ec0('0x28')][_0x9ec0('0x41')]({'where':{'id':_0x4f315c[_0x9ec0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1f5da4,null))['then'](saveUpdates(_0x4f315c[_0x9ec0('0x43')],null))['then'](respondWithResult(_0x1f5da4,null))['catch'](handleError(_0x1f5da4,null));};exports[_0x9ec0('0x22')]=function(_0x5f280c,_0x43a16d){return db['DeskField'][_0x9ec0('0x41')]({'where':{'id':_0x5f280c[_0x9ec0('0x3f')]['id']}})[_0x9ec0('0x21')](handleEntityNotFound(_0x43a16d,null))[_0x9ec0('0x21')](removeEntity(_0x43a16d,null))['catch'](handleError(_0x43a16d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 262f203..4cf72c2 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 _0x7802=['exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskField.attributes'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0x7802,0x9c));var _0x2780=function(_0x4145ed,_0x1965e3){_0x4145ed=_0x4145ed-0x0;var _0x2294a6=_0x7802[_0x4145ed];return _0x2294a6;};'use strict';var _=require(_0x2780('0x0'));var util=require(_0x2780('0x1'));var logger=require(_0x2780('0x2'))(_0x2780('0x3'));var moment=require('moment');var BPromise=require(_0x2780('0x4'));var rp=require(_0x2780('0x5'));var fs=require('fs');var path=require(_0x2780('0x6'));var rimraf=require(_0x2780('0x7'));var config=require('../../config/environment');var attributes=require(_0x2780('0x8'));module[_0x2780('0x9')]=function(_0x35c001,_0x2ee5ee){return _0x35c001[_0x2780('0xa')]('DeskField',attributes,{'tableName':_0x2780('0xb'),'paranoid':![],'indexes':[{'name':_0x2780('0xc'),'fields':[_0x2780('0xd'),_0x2780('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb924=['../../config/environment','./intDeskField.attributes','define','desk_unique_index','idField','FieldId','lodash','moment','request-promise','path','rimraf'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0xb924,0x19d));var _0x4b92=function(_0x19d535,_0x22f531){_0x19d535=_0x19d535-0x0;var _0x529f3f=_0xb924[_0x19d535];return _0x529f3f;};'use strict';var _=require(_0x4b92('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4b92('0x1'));var BPromise=require('bluebird');var rp=require(_0x4b92('0x2'));var fs=require('fs');var path=require(_0x4b92('0x3'));var rimraf=require(_0x4b92('0x4'));var config=require(_0x4b92('0x5'));var attributes=require(_0x4b92('0x6'));module['exports']=function(_0x1d1b52,_0x5a789d){return _0x1d1b52[_0x4b92('0x7')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x4b92('0x8'),'fields':[_0x4b92('0x9'),_0x4b92('0xa')],'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 02bc017..25cd62a 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 _0x8b7e=['../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x4de378,_0x13f2f3){var _0x2e8aae=function(_0x16a670){while(--_0x16a670){_0x4de378['push'](_0x4de378['shift']());}};_0x2e8aae(++_0x13f2f3);}(_0x8b7e,0x19e));var _0xe8b7=function(_0x2e9c85,_0x465dff){_0x2e9c85=_0x2e9c85-0x0;var _0x46a3e7=_0x8b7e[_0x2e9c85];return _0x46a3e7;};'use strict';var _=require('lodash');var util=require(_0xe8b7('0x0'));var moment=require(_0xe8b7('0x1'));var BPromise=require('bluebird');var rs=require(_0xe8b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8b7('0x4'))(_0xe8b7('0x5'));var config=require(_0xe8b7('0x6'));var jayson=require(_0xe8b7('0x7'));var client=jayson[_0xe8b7('0x8')][_0xe8b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56a029,_0x19d523,_0xc1c9b8){return new BPromise(function(_0x127618,_0x185bf9){return client[_0xe8b7('0xa')](_0x56a029,_0xc1c9b8)['then'](function(_0x44dbb8){logger[_0xe8b7('0xb')](_0xe8b7('0xc'),_0x19d523,'request\x20sent');logger[_0xe8b7('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x19d523,'request\x20sent',JSON[_0xe8b7('0xe')](_0x44dbb8));if(_0x44dbb8[_0xe8b7('0xf')]){if(_0x44dbb8[_0xe8b7('0xf')][_0xe8b7('0x10')]===0x1f4){logger[_0xe8b7('0xf')](_0xe8b7('0xc'),_0x19d523,_0x44dbb8[_0xe8b7('0xf')]['message']);return _0x185bf9(_0x44dbb8[_0xe8b7('0xf')]['message']);}logger[_0xe8b7('0xf')]('DeskField,\x20%s,\x20%s',_0x19d523,_0x44dbb8['error']['message']);return _0x127618(_0x44dbb8[_0xe8b7('0xf')][_0xe8b7('0x11')]);}else{logger[_0xe8b7('0xb')](_0xe8b7('0xc'),_0x19d523,_0xe8b7('0x12'));_0x127618(_0x44dbb8[_0xe8b7('0x13')][_0xe8b7('0x11')]);}})[_0xe8b7('0x14')](function(_0x26a364){logger[_0xe8b7('0xf')]('DeskField,\x20%s,\x20%s',_0x19d523,_0x26a364);_0x185bf9(_0x26a364);});});} \ No newline at end of file +var _0x71f3=['message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/environment','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x56844e,_0xfe44e0){var _0x1a6b64=function(_0x5b4078){while(--_0x5b4078){_0x56844e['push'](_0x56844e['shift']());}};_0x1a6b64(++_0xfe44e0);}(_0x71f3,0xf2));var _0x371f=function(_0x14b8e0,_0x1f2235){_0x14b8e0=_0x14b8e0-0x0;var _0x5be547=_0x71f3[_0x14b8e0];return _0x5be547;};'use strict';var _=require(_0x371f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x371f('0x1'));var rs=require(_0x371f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x371f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x371f('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc98835,_0x230a30,_0x53a24f){return new BPromise(function(_0x339e43,_0x1b3031){return client[_0x371f('0x5')](_0xc98835,_0x53a24f)[_0x371f('0x6')](function(_0x15b548){logger[_0x371f('0x7')](_0x371f('0x8'),_0x230a30,_0x371f('0x9'));logger[_0x371f('0xa')](_0x371f('0xb'),_0x230a30,_0x371f('0x9'),JSON[_0x371f('0xc')](_0x15b548));if(_0x15b548[_0x371f('0xd')]){if(_0x15b548[_0x371f('0xd')]['code']===0x1f4){logger[_0x371f('0xd')](_0x371f('0x8'),_0x230a30,_0x15b548[_0x371f('0xd')][_0x371f('0xe')]);return _0x1b3031(_0x15b548['error'][_0x371f('0xe')]);}logger[_0x371f('0xd')]('DeskField,\x20%s,\x20%s',_0x230a30,_0x15b548[_0x371f('0xd')]['message']);return _0x339e43(_0x15b548[_0x371f('0xd')][_0x371f('0xe')]);}else{logger['info'](_0x371f('0x8'),_0x230a30,_0x371f('0x9'));_0x339e43(_0x15b548['result'][_0x371f('0xe')]);}})[_0x371f('0xf')](function(_0x38fa23){logger[_0x371f('0xd')](_0x371f('0x8'),_0x230a30,_0x38fa23);_0x1b3031(_0x38fa23);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6dc390a..d0b8b16 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 _0x1c8e=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','exports','util'];(function(_0x548174,_0x81ee29){var _0xd5bba1=function(_0x210921){while(--_0x210921){_0x548174['push'](_0x548174['shift']());}};_0xd5bba1(++_0x81ee29);}(_0x1c8e,0x13a));var _0xe1c8=function(_0x3f8294,_0x496d14){_0x3f8294=_0x3f8294-0x0;var _0x5249ae=_0x1c8e[_0x3f8294];return _0x5249ae;};'use strict';var multer=require('multer');var util=require(_0xe1c8('0x0'));var path=require('path');var timeout=require(_0xe1c8('0x1'));var express=require(_0xe1c8('0x2'));var router=express[_0xe1c8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe1c8('0x4'));var config=require(_0xe1c8('0x5'));var controller=require(_0xe1c8('0x6'));router[_0xe1c8('0x7')]('/',auth[_0xe1c8('0x8')](),controller[_0xe1c8('0x9')]);router['get'](_0xe1c8('0xa'),auth[_0xe1c8('0x8')](),controller['show']);router[_0xe1c8('0x7')](_0xe1c8('0xb'),auth[_0xe1c8('0x8')](),controller[_0xe1c8('0xc')]);router[_0xe1c8('0x7')](_0xe1c8('0xd'),auth[_0xe1c8('0x8')](),controller[_0xe1c8('0xe')]);router[_0xe1c8('0xf')]('/',auth[_0xe1c8('0x8')](),controller[_0xe1c8('0x10')]);router[_0xe1c8('0xf')](_0xe1c8('0xb'),auth[_0xe1c8('0x8')](),controller[_0xe1c8('0x11')]);router['put'](_0xe1c8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe1c8('0x12')](_0xe1c8('0xa'),auth['isAuthenticated'](),controller[_0xe1c8('0x13')]);module[_0xe1c8('0x14')]=router; \ No newline at end of file +var _0x9c6b=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','util','path','express','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9c6b,0x102));var _0xb9c6=function(_0x251b25,_0x35b453){_0x251b25=_0x251b25-0x0;var _0x1671a1=_0x9c6b[_0x251b25];return _0x1671a1;};'use strict';var multer=require('multer');var util=require(_0xb9c6('0x0'));var path=require(_0xb9c6('0x1'));var timeout=require('connect-timeout');var express=require(_0xb9c6('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb9c6('0x3'));var controller=require('./intDynamics365Account.controller');router[_0xb9c6('0x4')]('/',auth[_0xb9c6('0x5')](),controller[_0xb9c6('0x6')]);router[_0xb9c6('0x4')](_0xb9c6('0x7'),auth[_0xb9c6('0x5')](),controller['show']);router[_0xb9c6('0x4')](_0xb9c6('0x8'),auth[_0xb9c6('0x5')](),controller[_0xb9c6('0x9')]);router[_0xb9c6('0x4')](_0xb9c6('0xa'),auth['isAuthenticated'](),controller[_0xb9c6('0xb')]);router['post']('/',auth[_0xb9c6('0x5')](),controller[_0xb9c6('0xc')]);router['post'](_0xb9c6('0x8'),auth[_0xb9c6('0x5')](),controller[_0xb9c6('0xd')]);router[_0xb9c6('0xe')](_0xb9c6('0x7'),auth[_0xb9c6('0x5')](),controller[_0xb9c6('0xf')]);router[_0xb9c6('0x10')]('/:id',auth[_0xb9c6('0x5')](),controller[_0xb9c6('0x11')]);module[_0xb9c6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 44190f5..99c6c42 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 _0xcb4c=['STRING','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcb4c,0xa1));var _0xccb4=function(_0x7aeac8,_0x2eae0e){_0x7aeac8=_0x7aeac8-0x0;var _0x37ffa0=_0xcb4c[_0x7aeac8];return _0x37ffa0;};'use strict';var Sequelize=require('sequelize');module[_0xccb4('0x0')]={'name':{'type':Sequelize[_0xccb4('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xccb4('0x1')]},'tenantId':{'type':Sequelize[_0xccb4('0x1')]},'clientId':{'type':Sequelize[_0xccb4('0x1')]},'clientSecret':{'type':Sequelize[_0xccb4('0x1')]},'serverUrl':{'type':Sequelize[_0xccb4('0x1')]},'description':{'type':Sequelize[_0xccb4('0x1')]}}; \ No newline at end of file +var _0xe172=['STRING','sequelize'];(function(_0x2ac89b,_0x1f6b7b){var _0x53be19=function(_0x57f02e){while(--_0x57f02e){_0x2ac89b['push'](_0x2ac89b['shift']());}};_0x53be19(++_0x1f6b7b);}(_0xe172,0x121));var _0x2e17=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xe172[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require(_0x2e17('0x0'));module['exports']={'name':{'type':Sequelize[_0x2e17('0x1')]},'username':{'type':Sequelize[_0x2e17('0x1')]},'password':{'type':Sequelize[_0x2e17('0x1')]},'remoteUri':{'type':Sequelize[_0x2e17('0x1')]},'tenantId':{'type':Sequelize[_0x2e17('0x1')]},'clientId':{'type':Sequelize[_0x2e17('0x1')]},'clientSecret':{'type':Sequelize[_0x2e17('0x1')]},'serverUrl':{'type':Sequelize[_0x2e17('0x1')]},'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 713f8af..3222bde 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 _0x2edb=['fieldName','type','model','map','query','keys','intersection','attributes','fields','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','length','find','body','Dynamics365Configuration','order','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','Descriptions','channel','Dynamics365Field','Incident','PhoneCall','title','customerid','ownerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','POST','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','apply','reject','save','update','destroy','name','Dynamics365Account','rawAttributes'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2edb,0x16b));var _0xb2ed=function(_0x4904af,_0x4418bc){_0x4904af=_0x4904af-0x0;var _0x2a2f45=_0x2edb[_0x4904af];return _0x2a2f45;};'use strict';var pdf=require(_0xb2ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb2ed('0x1'));var zipdir=require(_0xb2ed('0x2'));var jsonpatch=require(_0xb2ed('0x3'));var rp=require(_0xb2ed('0x4'));var moment=require('moment');var BPromise=require(_0xb2ed('0x5'));var Mustache=require('mustache');var util=require(_0xb2ed('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb2ed('0x7'));var ejs=require(_0xb2ed('0x8'));var fs=require('fs');var _=require(_0xb2ed('0x9'));var squel=require(_0xb2ed('0xa'));var crypto=require('crypto');var jsforce=require(_0xb2ed('0xb'));var deskjs=require(_0xb2ed('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb2ed('0xd'));var Papa=require(_0xb2ed('0xe'));var Redis=require(_0xb2ed('0xf'));var authService=require(_0xb2ed('0x10'));var qs=require(_0xb2ed('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2ed('0x12'));var logger=require(_0xb2ed('0x13'))(_0xb2ed('0x14'));var utils=require(_0xb2ed('0x15'));var config=require(_0xb2ed('0x16'));var db=require(_0xb2ed('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb2ed('0x18'));var client=jayson['client'][_0xb2ed('0x19')]({'port':0x232a});function checkPasswordPattern(_0x24be49,_0x6d0e9d,_0x276f29){if(_0x276f29){var _0x54d85e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54d85e[_0xb2ed('0x1a')](_0x6d0e9d)){return _0x24be49;}else{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~!@#$%^&-_=+[{]}.');}}else{return _0x24be49;}}function respondWithRpcPromise(_0x33da60,_0x5a4c2d,_0x6c8905,_0x247622){return new BPromise(function(_0x77ff79,_0x1a305a){var _0x695f1e=_0x247622||client;return _0x695f1e[_0xb2ed('0x1b')](_0x33da60,_0x6c8905)[_0xb2ed('0x1c')](function(_0x2846d2){logger[_0xb2ed('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x5a4c2d,'request\x20sent');logger[_0xb2ed('0x1e')](_0xb2ed('0x1f'),_0x5a4c2d,_0xb2ed('0x20'),JSON['stringify'](_0x2846d2));if(_0x2846d2[_0xb2ed('0x21')]){if(_0x2846d2[_0xb2ed('0x21')][_0xb2ed('0x22')]===0x1f4){logger[_0xb2ed('0x21')](_0xb2ed('0x23'),_0x5a4c2d,_0x2846d2['error'][_0xb2ed('0x24')]);return _0x1a305a(_0x2846d2[_0xb2ed('0x21')][_0xb2ed('0x24')]);}logger[_0xb2ed('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x5a4c2d,_0x2846d2[_0xb2ed('0x21')][_0xb2ed('0x24')]);return _0x77ff79(_0x2846d2[_0xb2ed('0x21')][_0xb2ed('0x24')]);}else{logger[_0xb2ed('0x1d')](_0xb2ed('0x23'),_0x5a4c2d,_0xb2ed('0x20'));_0x77ff79(_0x2846d2[_0xb2ed('0x25')][_0xb2ed('0x24')]);}})[_0xb2ed('0x26')](function(_0xb2173a){logger['error'](_0xb2ed('0x23'),_0x5a4c2d,_0xb2173a);_0x1a305a(_0xb2173a);});});}function respondWithStatusCode(_0x1292f3,_0x22667d){_0x22667d=_0x22667d||0xcc;return function(_0x510187){if(_0x510187){return _0x1292f3[_0xb2ed('0x27')](_0x22667d);}return _0x1292f3[_0xb2ed('0x28')](_0x22667d)[_0xb2ed('0x29')]();};}function respondWithResult(_0x863dc6,_0x9eec1a){_0x9eec1a=_0x9eec1a||0xc8;return function(_0x9337b5){if(_0x9337b5){return _0x863dc6[_0xb2ed('0x28')](_0x9eec1a)[_0xb2ed('0x2a')](_0x9337b5);}};}function respondWithFilteredResult(_0x25e615,_0x332cdb){return function(_0x5531b3){if(_0x5531b3){var _0x570b66=_0x5531b3['count'],_0x13fb03=_0x332cdb[_0xb2ed('0x2b')],_0x35baae=_0x332cdb[_0xb2ed('0x2b')]+_0x332cdb[_0xb2ed('0x2c')],_0x397a95;if(_0x35baae>=_0x570b66){_0x35baae=_0x570b66;_0x397a95=0xc8;}else{_0x397a95=0xce;}_0x25e615[_0xb2ed('0x28')](_0x397a95);return _0x25e615['set']('Content-Range',_0x13fb03+'-'+_0x35baae+'/'+_0x570b66)[_0xb2ed('0x2a')](_0x5531b3);}return null;};}function patchUpdates(_0x1c2c33){return function(_0x49a1c2){try{jsonpatch[_0xb2ed('0x2d')](_0x49a1c2,_0x1c2c33,!![]);}catch(_0x1c0aaf){return BPromise[_0xb2ed('0x2e')](_0x1c0aaf);}return _0x49a1c2[_0xb2ed('0x2f')]();};}function saveUpdates(_0xc87b81,_0x460446){return function(_0x3fffb7){if(_0x3fffb7){return _0x3fffb7[_0xb2ed('0x30')](_0xc87b81)[_0xb2ed('0x1c')](function(_0x2caca2){return _0x2caca2;});}return null;};}function removeEntity(_0xa5ac06,_0x22ee4c){return function(_0x3f6a1){if(_0x3f6a1){return _0x3f6a1[_0xb2ed('0x31')]()[_0xb2ed('0x1c')](function(){_0xa5ac06['status'](0xcc)[_0xb2ed('0x29')]();});}};}function handleEntityNotFound(_0x35542a,_0x3b01ed){return function(_0x126fbd){if(!_0x126fbd){_0x35542a[_0xb2ed('0x27')](0x194);}return _0x126fbd;};}function handleError(_0x7235d4,_0x479073){_0x479073=_0x479073||0x1f4;return function(_0x2c843f){logger['error'](_0x2c843f['stack']);if(_0x2c843f[_0xb2ed('0x32')]){delete _0x2c843f[_0xb2ed('0x32')];}_0x7235d4[_0xb2ed('0x28')](_0x479073)['send'](_0x2c843f);};}exports['index']=function(_0x21a643,_0x1517c7){var _0x47536d={},_0x1065b8={},_0x4283b1={'count':0x0,'rows':[]};var _0x247167=_['map'](db[_0xb2ed('0x33')][_0xb2ed('0x34')],function(_0x1295ea){return{'name':_0x1295ea[_0xb2ed('0x35')],'type':_0x1295ea[_0xb2ed('0x36')]['key']};});_0x1065b8[_0xb2ed('0x37')]=_[_0xb2ed('0x38')](_0x247167,_0xb2ed('0x32'));_0x1065b8[_0xb2ed('0x39')]=_[_0xb2ed('0x3a')](_0x21a643[_0xb2ed('0x39')]);_0x1065b8['filters']=_[_0xb2ed('0x3b')](_0x1065b8['model'],_0x1065b8['query']);_0x47536d[_0xb2ed('0x3c')]=_[_0xb2ed('0x3b')](_0x1065b8['model'],qs[_0xb2ed('0x3d')](_0x21a643[_0xb2ed('0x39')][_0xb2ed('0x3d')]));_0x47536d['attributes']=_0x47536d[_0xb2ed('0x3c')]['length']?_0x47536d[_0xb2ed('0x3c')]:_0x1065b8['model'];if(!_0x21a643[_0xb2ed('0x39')]['hasOwnProperty'](_0xb2ed('0x3e'))){_0x47536d[_0xb2ed('0x2c')]=qs['limit'](_0x21a643[_0xb2ed('0x39')][_0xb2ed('0x2c')]);_0x47536d['offset']=qs[_0xb2ed('0x2b')](_0x21a643[_0xb2ed('0x39')][_0xb2ed('0x2b')]);}_0x47536d['order']=qs[_0xb2ed('0x3f')](_0x21a643[_0xb2ed('0x39')]['sort']);_0x47536d['where']=qs[_0xb2ed('0x40')](_[_0xb2ed('0x41')](_0x21a643[_0xb2ed('0x39')],_0x1065b8[_0xb2ed('0x40')]),_0x247167);if(_0x21a643[_0xb2ed('0x39')][_0xb2ed('0x42')]){_0x47536d[_0xb2ed('0x43')]=_['merge'](_0x47536d[_0xb2ed('0x43')],{'$or':_[_0xb2ed('0x38')](_0x247167,function(_0x56cf1d){if(_0x56cf1d[_0xb2ed('0x36')]!==_0xb2ed('0x44')){var _0x113b28={};_0x113b28[_0x56cf1d['name']]={'$like':'%'+_0x21a643[_0xb2ed('0x39')][_0xb2ed('0x42')]+'%'};return _0x113b28;}})});}_0x47536d=_[_0xb2ed('0x45')]({},_0x47536d,_0x21a643[_0xb2ed('0x46')]);var _0x36d77a={'where':_0x47536d[_0xb2ed('0x43')]};return db['Dynamics365Account'][_0xb2ed('0x47')](_0x36d77a)[_0xb2ed('0x1c')](function(_0x5853a6){_0x4283b1['count']=_0x5853a6;if(_0x21a643[_0xb2ed('0x39')][_0xb2ed('0x48')]){_0x47536d[_0xb2ed('0x49')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xb2ed('0x4a')](_0x47536d);})[_0xb2ed('0x1c')](function(_0xc7da4c){_0x4283b1[_0xb2ed('0x4b')]=_0xc7da4c;return _0x4283b1;})[_0xb2ed('0x1c')](respondWithFilteredResult(_0x1517c7,_0x47536d))[_0xb2ed('0x26')](handleError(_0x1517c7,null));};exports[_0xb2ed('0x4c')]=function(_0x34b1ca,_0x417b18){var _0x7988fc={'raw':![],'where':{'id':_0x34b1ca[_0xb2ed('0x4d')]['id']}},_0x4ef434={};_0x4ef434['model']=_[_0xb2ed('0x3a')](db['Dynamics365Account'][_0xb2ed('0x34')]);_0x4ef434[_0xb2ed('0x39')]=_['keys'](_0x34b1ca['query']);_0x4ef434[_0xb2ed('0x40')]=_[_0xb2ed('0x3b')](_0x4ef434['model'],_0x4ef434['query']);_0x7988fc['attributes']=_[_0xb2ed('0x3b')](_0x4ef434['model'],qs[_0xb2ed('0x3d')](_0x34b1ca[_0xb2ed('0x39')][_0xb2ed('0x3d')]));_0x7988fc[_0xb2ed('0x3c')]=_0x7988fc[_0xb2ed('0x3c')][_0xb2ed('0x4e')]?_0x7988fc['attributes']:_0x4ef434['model'];if(_0x34b1ca[_0xb2ed('0x39')]['includeAll']){_0x7988fc[_0xb2ed('0x49')]=[{'all':!![]}];}_0x7988fc=_[_0xb2ed('0x45')]({},_0x7988fc,_0x34b1ca[_0xb2ed('0x46')]);return db[_0xb2ed('0x33')][_0xb2ed('0x4f')](_0x7988fc)[_0xb2ed('0x1c')](handleEntityNotFound(_0x417b18,null))[_0xb2ed('0x1c')](respondWithResult(_0x417b18,null))[_0xb2ed('0x26')](handleError(_0x417b18,null));};exports['create']=function(_0x448660,_0x1bc4bd){return db[_0xb2ed('0x33')]['create'](_0x448660[_0xb2ed('0x50')],{})[_0xb2ed('0x1c')](respondWithResult(_0x1bc4bd,0xc9))[_0xb2ed('0x26')](handleError(_0x1bc4bd,null));};exports[_0xb2ed('0x30')]=function(_0x128dbb,_0xa24189){if(_0x128dbb['body']['id']){delete _0x128dbb[_0xb2ed('0x50')]['id'];}return db['Dynamics365Account'][_0xb2ed('0x4f')]({'where':{'id':_0x128dbb['params']['id']}})[_0xb2ed('0x1c')](handleEntityNotFound(_0xa24189,null))[_0xb2ed('0x1c')](saveUpdates(_0x128dbb['body'],null))[_0xb2ed('0x1c')](respondWithResult(_0xa24189,null))[_0xb2ed('0x26')](handleError(_0xa24189,null));};exports[_0xb2ed('0x31')]=function(_0x599b92,_0x18b785){return db[_0xb2ed('0x33')]['find']({'where':{'id':_0x599b92['params']['id']}})[_0xb2ed('0x1c')](handleEntityNotFound(_0x18b785,null))[_0xb2ed('0x1c')](removeEntity(_0x18b785,null))['catch'](handleError(_0x18b785,null));};exports['getConfigurations']=function(_0x3cdc50,_0x2b0411,_0x1f95c2){var _0xd1dbd={};var _0x437023={};var _0x30bac3;var _0x51c039;return db['Dynamics365Account']['findOne']({'where':{'id':_0x3cdc50[_0xb2ed('0x4d')]['id']}})[_0xb2ed('0x1c')](handleEntityNotFound(_0x2b0411,null))[_0xb2ed('0x1c')](function(_0x378023){if(_0x378023){_0x30bac3=_0x378023;_0x437023[_0xb2ed('0x37')]=_['keys'](db[_0xb2ed('0x51')][_0xb2ed('0x34')]);_0x437023['query']=_[_0xb2ed('0x3a')](_0x3cdc50[_0xb2ed('0x39')]);_0x437023[_0xb2ed('0x40')]=_[_0xb2ed('0x3b')](_0x437023[_0xb2ed('0x37')],_0x437023[_0xb2ed('0x39')]);_0xd1dbd[_0xb2ed('0x3c')]=_['intersection'](_0x437023['model'],qs['fields'](_0x3cdc50[_0xb2ed('0x39')][_0xb2ed('0x3d')]));_0xd1dbd[_0xb2ed('0x3c')]=_0xd1dbd[_0xb2ed('0x3c')]['length']?_0xd1dbd[_0xb2ed('0x3c')]:_0x437023[_0xb2ed('0x37')];_0xd1dbd[_0xb2ed('0x52')]=qs['sort'](_0x3cdc50['query'][_0xb2ed('0x3f')]);_0xd1dbd[_0xb2ed('0x43')]=qs[_0xb2ed('0x40')](_[_0xb2ed('0x41')](_0x3cdc50[_0xb2ed('0x39')],_0x437023['filters']));if(_0x3cdc50[_0xb2ed('0x39')][_0xb2ed('0x42')]){_0xd1dbd[_0xb2ed('0x43')]=_[_0xb2ed('0x45')](_0xd1dbd[_0xb2ed('0x43')],{'$or':_[_0xb2ed('0x38')](_0xd1dbd[_0xb2ed('0x3c')],function(_0x489afb){var _0x38f898={};_0x38f898[_0x489afb]={'$like':'%'+_0x3cdc50[_0xb2ed('0x39')][_0xb2ed('0x42')]+'%'};return _0x38f898;})});}_0xd1dbd=_[_0xb2ed('0x45')]({},_0xd1dbd,_0x3cdc50[_0xb2ed('0x46')]);return _0x30bac3[_0xb2ed('0x53')](_0xd1dbd);}})[_0xb2ed('0x1c')](function(_0x50e9fb){if(_0x50e9fb){_0x51c039=_0x50e9fb[_0xb2ed('0x4e')];if(!_0x3cdc50['query'][_0xb2ed('0x54')](_0xb2ed('0x3e'))){_0xd1dbd[_0xb2ed('0x2c')]=qs['limit'](_0x3cdc50[_0xb2ed('0x39')][_0xb2ed('0x2c')]);_0xd1dbd[_0xb2ed('0x2b')]=qs[_0xb2ed('0x2b')](_0x3cdc50[_0xb2ed('0x39')][_0xb2ed('0x2b')]);}return _0x30bac3['getConfigurations'](_0xd1dbd);}})[_0xb2ed('0x1c')](function(_0x3a064c){if(_0x3a064c){return _0x3a064c?{'count':_0x51c039,'rows':_0x3a064c}:null;}})[_0xb2ed('0x1c')](respondWithResult(_0x2b0411,null))[_0xb2ed('0x26')](handleError(_0x2b0411,null));};exports['addConfiguration']=function(_0x308318,_0x479c77,_0x230e15){if(_0x308318[_0xb2ed('0x50')]['id']){delete _0x308318[_0xb2ed('0x50')]['id'];}return db['Dynamics365Account'][_0xb2ed('0x55')]({'where':{'id':_0x308318[_0xb2ed('0x4d')]['id']}})['then'](handleEntityNotFound(_0x479c77,null))[_0xb2ed('0x1c')](function(_0x48933d){if(_0x48933d){_0x308318['body'][_0xb2ed('0x56')]=_0x48933d['id'];_0x308318[_0xb2ed('0x50')][_0xb2ed('0x57')]=integrations['getSubjects'](_0x308318[_0xb2ed('0x50')]['channel'],_0x308318[_0xb2ed('0x50')][_0xb2ed('0x36')]);_0x308318[_0xb2ed('0x50')][_0xb2ed('0x58')]=integrations['getDescriptions'](_0x308318['body'][_0xb2ed('0x59')],_0x308318[_0xb2ed('0x50')][_0xb2ed('0x36')]);return db[_0xb2ed('0x51')]['create'](_0x308318[_0xb2ed('0x50')],{'include':[{'model':db[_0xb2ed('0x5a')],'as':'Subjects'},{'model':db[_0xb2ed('0x5a')],'as':_0xb2ed('0x58')}]});}return null;})[_0xb2ed('0x1c')](respondWithResult(_0x479c77,null))[_0xb2ed('0x26')](handleError(_0x479c77,null));};exports['getFields']=function(_0x30045d,_0x32369f,_0x54b8ea){var _0x50d1c8=_0x30045d['query']['ticketType'];var _0x537fbd=_0x50d1c8==='incident'?_0xb2ed('0x5b'):_0xb2ed('0x5c');var _0x397de8='';var _0x55a0ad='';var _0x595082='';var _0x240f43='';var _0x4c2642='';var _0x955e7='';var _0x3b33c9='';var _0x229a19='';var _0x21947c=[_0xb2ed('0x5d'),'description',_0xb2ed('0x5e'),_0xb2ed('0x5f'),'caseorigincode',_0xb2ed('0x60'),'phonenumber',_0xb2ed('0x61'),_0xb2ed('0x62'),_0xb2ed('0x63')];var _0x448fd=['accountidname',_0xb2ed('0x64'),_0xb2ed('0x65'),_0xb2ed('0x66'),_0xb2ed('0x67'),_0xb2ed('0x68'),_0xb2ed('0x69'),'contractidname','createdbyexternalpartyname',_0xb2ed('0x6a'),'createdbyname','createdbyyominame',_0xb2ed('0x6b'),_0xb2ed('0x6c'),_0xb2ed('0x6d'),'customeridname','customeridtype',_0xb2ed('0x6e'),'emailaddress','entitlementidname',_0xb2ed('0x6f'),_0xb2ed('0x70'),_0xb2ed('0x71'),_0xb2ed('0x72'),_0xb2ed('0x73'),_0xb2ed('0x74'),'importsequencenumber',_0xb2ed('0x75'),_0xb2ed('0x76'),_0xb2ed('0x77'),_0xb2ed('0x78'),_0xb2ed('0x79'),_0xb2ed('0x7a'),'modifiedbyname','modifiedbyyominame',_0xb2ed('0x7b'),'modifiedonbehalfbyname',_0xb2ed('0x7c'),'msdyn_incidenttypename',_0xb2ed('0x7d'),_0xb2ed('0x7e'),_0xb2ed('0x7f'),_0xb2ed('0x80'),_0xb2ed('0x81'),'owneridtype',_0xb2ed('0x82'),_0xb2ed('0x83'),'primarycontactidname',_0xb2ed('0x84'),_0xb2ed('0x85'),_0xb2ed('0x86'),_0xb2ed('0x87'),_0xb2ed('0x88'),'resolvebykpiidname',_0xb2ed('0x89'),_0xb2ed('0x8a'),'responsiblecontactidyominame',_0xb2ed('0x8b'),_0xb2ed('0x8c'),_0xb2ed('0x8d'),_0xb2ed('0x8e'),'statecode',_0xb2ed('0x8f'),'subjectidname',_0xb2ed('0x90'),_0xb2ed('0x91'),_0xb2ed('0x92'),_0xb2ed('0x93'),_0xb2ed('0x94'),_0xb2ed('0x95')];var _0x49bdd5=_0x21947c[_0xb2ed('0x96')](_0x448fd);return db[_0xb2ed('0x33')][_0xb2ed('0x55')]({'where':{'id':_0x30045d[_0xb2ed('0x4d')]['id']},'attributes':['id','username','password',_0xb2ed('0x97'),_0xb2ed('0x98'),'clientId',_0xb2ed('0x99')]})[_0xb2ed('0x1c')](handleEntityNotFound(_0x32369f,null))[_0xb2ed('0x1c')](function(_0xde2394){if(_0xde2394){_0x229a19=_0xde2394[_0xb2ed('0x97')];var _0x41ab11=_0x229a19[_0xb2ed('0x9a')](-0x1);if(_0x41ab11==='/'){_0x229a19=_0x229a19[_0xb2ed('0x9b')](0x0,_0x229a19[_0xb2ed('0x9c')](_0x41ab11));}_0x3b33c9=util[_0xb2ed('0x9d')]('%s/api/data/v9.0/',_0x229a19);var _0x34a79b={'method':_0xb2ed('0x9e'),'uri':'https://login.microsoftonline.com/'+_0xde2394[_0xb2ed('0x98')]+_0xb2ed('0x9f'),'form':{'client_id':_0xde2394['clientId'],'resource':_0x229a19,'username':_0xde2394['username'],'password':_0xde2394[_0xb2ed('0xa0')],'grant_type':_0xb2ed('0xa0'),'client_secret':_0xde2394['clientSecret']},'json':!![]};return rp(_0x34a79b);}})[_0xb2ed('0x1c')](function(_0x530658){_0x955e7=_0x530658[_0xb2ed('0xa1')];var _0x37392b={'method':_0xb2ed('0xa2'),'uri':encodeURI(_0x3b33c9+_0xb2ed('0xa3')+_0x537fbd+'\x27'),'headers':{'Authorization':_0xb2ed('0xa4')+_0x955e7,'If-None-Match':null,'OData-Version':_0xb2ed('0xa5')},'json':!![]};return rp(_0x37392b);})[_0xb2ed('0x1c')](function(_0x59d316){var _0x1c22c4=_0x59d316[_0xb2ed('0xa6')][0x0];var _0x44e85f=_0x1c22c4[_0xb2ed('0xa7')];var _0x44f072={'method':'GET','uri':_0x3b33c9+'EntityDefinitions('+_0x44e85f+_0xb2ed('0xa8'),'headers':{'Authorization':_0xb2ed('0xa4')+_0x955e7,'If-None-Match':null,'OData-Version':_0xb2ed('0xa5')},'json':!![]};return rp(_0x44f072);})[_0xb2ed('0x1c')](function(_0x4555f8){_0x397de8=_0x4555f8;_0x55a0ad=_0x397de8['Attributes'];_0x55a0ad=_[_0xb2ed('0xa9')](_0x55a0ad,function(_0x3aefd4){return!_0x49bdd5[_0xb2ed('0xaa')](_0x3aefd4['LogicalName']);});var _0xa70b61=[];var _0x272eb9=[];_0x55a0ad[_0xb2ed('0xab')](function(_0x29ccf3){if(_0x29ccf3[_0xb2ed('0xac')]){var _0x59d866=_0x29ccf3[_0xb2ed('0xac')][_0xb2ed('0x9b')](_0x29ccf3[_0xb2ed('0xac')][_0xb2ed('0x9c')]('.')+0x1);if(_0x59d866===_0xb2ed('0xad')){_0xa70b61['push'](getSelectList(_0x3b33c9,_0x50d1c8,_0x272eb9,_0x397de8[_0xb2ed('0xa7')],_0x29ccf3[_0xb2ed('0xa7')],_0x955e7));}}});return Promise[_0xb2ed('0xae')](_0xa70b61);})[_0xb2ed('0x1c')](function(_0x119dc7){_0x595082=_0x119dc7[0x0];var _0x589a93=[];var _0x2ce0fa=[];_0x55a0ad[_0xb2ed('0xab')](function(_0x33c3d7){if(!_[_0xb2ed('0xaf')](_0x33c3d7[_0xb2ed('0xac')])){var _0x4cad79=_0x33c3d7['@odata.type']['substring'](_0x33c3d7[_0xb2ed('0xac')][_0xb2ed('0x9c')]('.')+0x1);if(_0x4cad79===_0xb2ed('0xb0')){_0x589a93[_0xb2ed('0xb1')](getBooleanList(_0x3b33c9,_0x50d1c8,_0x2ce0fa,_0x397de8[_0xb2ed('0xa7')],_0x33c3d7['MetadataId'],_0x955e7));}}});return Promise[_0xb2ed('0xae')](_0x589a93);})[_0xb2ed('0x1c')](function(_0x5881d8){_0x240f43=_0x5881d8[0x0];var _0x150c35=[];var _0x37bae3=[];_0x55a0ad[_0xb2ed('0xab')](function(_0x3a74db){if(_0x3a74db[_0xb2ed('0xac')]){var _0x4618a2=_0x3a74db[_0xb2ed('0xac')][_0xb2ed('0x9b')](_0x3a74db[_0xb2ed('0xac')][_0xb2ed('0x9c')]('.')+0x1);if(_0x4618a2===_0xb2ed('0xb2')||_0x4618a2===_0xb2ed('0xb3')||_0x4618a2===_0xb2ed('0xb4')||_0x4618a2===_0xb2ed('0xb5')||_0x4618a2===_0xb2ed('0xb6')||_0x4618a2===_0xb2ed('0xb7')||_0x4618a2===_0xb2ed('0xb8')||_0x4618a2===_0xb2ed('0xb9')||_0x4618a2===_0xb2ed('0xba')||_0x4618a2===_0xb2ed('0xbb')){_0x150c35[_0xb2ed('0xb1')](getInputList(_0x3b33c9,_0x50d1c8,_0x4618a2,_0x37bae3,_0x397de8[_0xb2ed('0xa7')],_0x3a74db[_0xb2ed('0xa7')],_0x955e7));}}});return Promise[_0xb2ed('0xae')](_0x150c35);})[_0xb2ed('0x1c')](function(_0x44b04c){_0x4c2642=_0x44b04c[0x0];var _0x306e51=_0x595082[_0xb2ed('0x96')](_0x240f43)[_0xb2ed('0x96')](_0x4c2642);var _0x49359d={'count':_0x306e51['length'],'rows':_0x306e51};return _0x49359d;})[_0xb2ed('0x1c')](respondWithResult(_0x32369f,null))[_0xb2ed('0x26')](function(_0x474c82){var _0x1a8294=_0x30045d[_0xb2ed('0x39')][_0xb2ed('0x1a')]?0x1f4:_0x474c82[_0xb2ed('0xbc')]||0x1f4;logger['error'](_0x474c82[_0xb2ed('0xbd')]);delete _0x474c82['name'];if(_0x1a8294===0x191){_0x1a8294=0x190;}_0x32369f['status'](_0x1a8294)['send'](_0x30045d['query'][_0xb2ed('0x1a')]?{'message':_0xb2ed('0xbe'),'statusCode':_0x474c82['statusCode']}:_0x474c82);});};function getSelectList(_0x5bd4a6,_0x58b3d0,_0x539daf,_0x5b31be,_0x9b2a4e,_0x4b0190){var _0x4a48c6={'method':'GET','uri':_0x5bd4a6+'EntityDefinitions('+_0x5b31be+_0xb2ed('0xbf')+_0x9b2a4e+_0xb2ed('0xc0')+_0xb2ed('0xc1'),'headers':{'Authorization':_0xb2ed('0xa4')+_0x4b0190,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4a48c6)[_0xb2ed('0x1c')](function(_0x157c8f){var _0x42ff3b=[];var _0x240045=_0x157c8f['OptionSet']['Options'];_0x240045[_0xb2ed('0xab')](function(_0x147477){_0x42ff3b[_0xb2ed('0xb1')]({'name':_0x147477[_0xb2ed('0xc2')][_0xb2ed('0xc3')][_0xb2ed('0xc2')],'value':String(_0x147477[_0xb2ed('0xc4')])});});var _0x2c426f={'id':_0x58b3d0+'_'+_0x157c8f['LogicalName'],'name':_0x157c8f[_0xb2ed('0xc5')][_0xb2ed('0xc3')][_0xb2ed('0xc2')],'custom':![],'options':_0x42ff3b};_0x539daf[_0xb2ed('0xb1')](_0x2c426f);return _0x539daf;});}function getBooleanList(_0x1f162b,_0x29af6e,_0x1712dc,_0x12c08b,_0x53b4c5,_0x550bae){var _0x18d1cc={'method':'GET','uri':_0x1f162b+_0xb2ed('0xc6')+_0x12c08b+_0xb2ed('0xbf')+_0x53b4c5+_0xb2ed('0xc7'),'headers':{'Authorization':'Bearer\x20'+_0x550bae,'If-None-Match':null,'OData-Version':_0xb2ed('0xa5')},'json':!![]};return rp(_0x18d1cc)['then'](function(_0x4607da){var _0x59e3ee=[];_0x59e3ee[_0xb2ed('0xb1')]({'name':_0x4607da[_0xb2ed('0xc8')][_0xb2ed('0xc9')][_0xb2ed('0xc2')]['UserLocalizedLabel']['Label'],'value':_0xb2ed('0xca')},{'name':_0x4607da['OptionSet'][_0xb2ed('0xcb')][_0xb2ed('0xc2')][_0xb2ed('0xc3')][_0xb2ed('0xc2')],'value':_0xb2ed('0xcc')});var _0x98f206={'id':_0x29af6e+'_'+_0x4607da[_0xb2ed('0xcd')],'name':_0x4607da[_0xb2ed('0xc5')]['UserLocalizedLabel'][_0xb2ed('0xc2')],'custom':![],'options':_0x59e3ee};_0x1712dc[_0xb2ed('0xb1')](_0x98f206);return _0x1712dc;});}function getInputList(_0x58aabe,_0x41ebf8,_0x5ad062,_0x1f6259,_0x4e0e29,_0x6c58da,_0x33e79a){var _0x4e5655={'method':_0xb2ed('0xa2'),'uri':_0x58aabe+'EntityDefinitions('+_0x4e0e29+_0xb2ed('0xbf')+_0x6c58da+_0xb2ed('0xce')+_0x5ad062+_0xb2ed('0xcf'),'headers':{'Authorization':_0xb2ed('0xa4')+_0x33e79a,'If-None-Match':null,'OData-Version':_0xb2ed('0xa5')},'json':!![]};return rp(_0x4e5655)['then'](function(_0x4bee6a){var _0x5901a3={'id':_0x41ebf8+'_'+_0x4bee6a['LogicalName'],'name':_0x4bee6a[_0xb2ed('0xc5')][_0xb2ed('0xc3')]?_0x4bee6a[_0xb2ed('0xc5')]['UserLocalizedLabel'][_0xb2ed('0xc2')]:_0x4bee6a[_0xb2ed('0xcd')],'custom':![],'options':[]};_0x1f6259['push'](_0x5901a3);return _0x1f6259;});} \ No newline at end of file +var _0xd269=['code','message','result','catch','sendStatus','end','status','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','Dynamics365Account','count','includeAll','include','findAll','rows','show','params','options','find','create','body','Dynamics365Configuration','addConfiguration','AccountId','getDescriptions','channel','Dynamics365Field','Subjects','Descriptions','getFields','ticketType','Incident','description','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','password','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd269,0x199));var _0x9d26=function(_0x3c93bd,_0x3293bf){_0x3c93bd=_0x3c93bd-0x0;var _0x381231=_0xd269[_0x3c93bd];return _0x381231;};'use strict';var pdf=require(_0x9d26('0x0'));var emlformat=require(_0x9d26('0x1'));var rimraf=require(_0x9d26('0x2'));var zipdir=require(_0x9d26('0x3'));var jsonpatch=require(_0x9d26('0x4'));var rp=require('request-promise');var moment=require(_0x9d26('0x5'));var BPromise=require(_0x9d26('0x6'));var Mustache=require(_0x9d26('0x7'));var util=require(_0x9d26('0x8'));var path=require(_0x9d26('0x9'));var sox=require('sox');var csv=require(_0x9d26('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9d26('0xb'));var squel=require(_0x9d26('0xc'));var crypto=require(_0x9d26('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9d26('0xe'));var toCsv=require(_0x9d26('0xa'));var querystring=require(_0x9d26('0xf'));var Papa=require('papaparse');var Redis=require(_0x9d26('0x10'));var authService=require(_0x9d26('0x11'));var qs=require(_0x9d26('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d26('0x13'))(_0x9d26('0x14'));var utils=require(_0x9d26('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x9d26('0x16'));var client=jayson['client'][_0x9d26('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1e4975,_0x25efde,_0xc13d6c){if(_0xc13d6c){var _0x245cd4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x245cd4[_0x9d26('0x18')](_0x25efde)){return _0x1e4975;}else{throw new db[(_0x9d26('0x19'))][(_0x9d26('0x1a'))](_0x9d26('0x1b'));}}else{return _0x1e4975;}}function respondWithRpcPromise(_0x14ea7a,_0x5a7097,_0x355cde,_0x1f5f97){return new BPromise(function(_0x462188,_0x272b64){var _0x577c78=_0x1f5f97||client;return _0x577c78[_0x9d26('0x1c')](_0x14ea7a,_0x355cde)[_0x9d26('0x1d')](function(_0x54ed63){logger[_0x9d26('0x1e')](_0x9d26('0x1f'),_0x5a7097,_0x9d26('0x20'));logger[_0x9d26('0x21')](_0x9d26('0x22'),_0x5a7097,_0x9d26('0x20'),JSON[_0x9d26('0x23')](_0x54ed63));if(_0x54ed63[_0x9d26('0x24')]){if(_0x54ed63[_0x9d26('0x24')][_0x9d26('0x25')]===0x1f4){logger[_0x9d26('0x24')](_0x9d26('0x1f'),_0x5a7097,_0x54ed63[_0x9d26('0x24')][_0x9d26('0x26')]);return _0x272b64(_0x54ed63['error'][_0x9d26('0x26')]);}logger['error'](_0x9d26('0x1f'),_0x5a7097,_0x54ed63[_0x9d26('0x24')][_0x9d26('0x26')]);return _0x462188(_0x54ed63[_0x9d26('0x24')][_0x9d26('0x26')]);}else{logger[_0x9d26('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x5a7097,_0x9d26('0x20'));_0x462188(_0x54ed63[_0x9d26('0x27')][_0x9d26('0x26')]);}})[_0x9d26('0x28')](function(_0x594d9f){logger[_0x9d26('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x5a7097,_0x594d9f);_0x272b64(_0x594d9f);});});}function respondWithStatusCode(_0x5e4e05,_0x1b0fad){_0x1b0fad=_0x1b0fad||0xcc;return function(_0x13fa94){if(_0x13fa94){return _0x5e4e05[_0x9d26('0x29')](_0x1b0fad);}return _0x5e4e05['status'](_0x1b0fad)[_0x9d26('0x2a')]();};}function respondWithResult(_0x2fa4ef,_0x3efb92){_0x3efb92=_0x3efb92||0xc8;return function(_0x590344){if(_0x590344){return _0x2fa4ef[_0x9d26('0x2b')](_0x3efb92)['json'](_0x590344);}};}function respondWithFilteredResult(_0x3b8add,_0x50bb62){return function(_0x453ea3){if(_0x453ea3){var _0x2495c2=_0x453ea3['count'],_0x1b6767=_0x50bb62[_0x9d26('0x2c')],_0x387fb6=_0x50bb62['offset']+_0x50bb62['limit'],_0x5acae5;if(_0x387fb6>=_0x2495c2){_0x387fb6=_0x2495c2;_0x5acae5=0xc8;}else{_0x5acae5=0xce;}_0x3b8add[_0x9d26('0x2b')](_0x5acae5);return _0x3b8add[_0x9d26('0x2d')](_0x9d26('0x2e'),_0x1b6767+'-'+_0x387fb6+'/'+_0x2495c2)[_0x9d26('0x2f')](_0x453ea3);}return null;};}function patchUpdates(_0x3b0bce){return function(_0x5e1905){try{jsonpatch[_0x9d26('0x30')](_0x5e1905,_0x3b0bce,!![]);}catch(_0x49e349){return BPromise[_0x9d26('0x31')](_0x49e349);}return _0x5e1905[_0x9d26('0x32')]();};}function saveUpdates(_0x178bec,_0x3b97fa){return function(_0x4a67ce){if(_0x4a67ce){return _0x4a67ce[_0x9d26('0x33')](_0x178bec)[_0x9d26('0x1d')](function(_0x2d9c9b){return _0x2d9c9b;});}return null;};}function removeEntity(_0x23157b,_0x402258){return function(_0x54e031){if(_0x54e031){return _0x54e031[_0x9d26('0x34')]()[_0x9d26('0x1d')](function(){_0x23157b['status'](0xcc)[_0x9d26('0x2a')]();});}};}function handleEntityNotFound(_0x58e14c,_0x240f32){return function(_0x3ad372){if(!_0x3ad372){_0x58e14c[_0x9d26('0x29')](0x194);}return _0x3ad372;};}function handleError(_0xccc6b,_0x51add6){_0x51add6=_0x51add6||0x1f4;return function(_0x2cc6c8){logger[_0x9d26('0x24')](_0x2cc6c8[_0x9d26('0x35')]);if(_0x2cc6c8[_0x9d26('0x36')]){delete _0x2cc6c8[_0x9d26('0x36')];}_0xccc6b[_0x9d26('0x2b')](_0x51add6)[_0x9d26('0x37')](_0x2cc6c8);};}exports[_0x9d26('0x38')]=function(_0x1fe56e,_0x7e4e48){var _0x43c279={},_0x1149d2={},_0x5f07b1={'count':0x0,'rows':[]};var _0x3e5bde=_[_0x9d26('0x39')](db['Dynamics365Account'][_0x9d26('0x3a')],function(_0x501b3f){return{'name':_0x501b3f[_0x9d26('0x3b')],'type':_0x501b3f[_0x9d26('0x3c')][_0x9d26('0x3d')]};});_0x1149d2['model']=_[_0x9d26('0x39')](_0x3e5bde,_0x9d26('0x36'));_0x1149d2[_0x9d26('0x3e')]=_[_0x9d26('0x3f')](_0x1fe56e[_0x9d26('0x3e')]);_0x1149d2[_0x9d26('0x40')]=_[_0x9d26('0x41')](_0x1149d2[_0x9d26('0x42')],_0x1149d2[_0x9d26('0x3e')]);_0x43c279[_0x9d26('0x43')]=_['intersection'](_0x1149d2['model'],qs[_0x9d26('0x44')](_0x1fe56e[_0x9d26('0x3e')][_0x9d26('0x44')]));_0x43c279['attributes']=_0x43c279[_0x9d26('0x43')][_0x9d26('0x45')]?_0x43c279[_0x9d26('0x43')]:_0x1149d2[_0x9d26('0x42')];if(!_0x1fe56e[_0x9d26('0x3e')][_0x9d26('0x46')](_0x9d26('0x47'))){_0x43c279[_0x9d26('0x48')]=qs[_0x9d26('0x48')](_0x1fe56e[_0x9d26('0x3e')][_0x9d26('0x48')]);_0x43c279[_0x9d26('0x2c')]=qs['offset'](_0x1fe56e[_0x9d26('0x3e')][_0x9d26('0x2c')]);}_0x43c279[_0x9d26('0x49')]=qs[_0x9d26('0x4a')](_0x1fe56e[_0x9d26('0x3e')][_0x9d26('0x4a')]);_0x43c279['where']=qs[_0x9d26('0x40')](_['pick'](_0x1fe56e[_0x9d26('0x3e')],_0x1149d2[_0x9d26('0x40')]),_0x3e5bde);if(_0x1fe56e[_0x9d26('0x3e')][_0x9d26('0x4b')]){_0x43c279[_0x9d26('0x4c')]=_[_0x9d26('0x4d')](_0x43c279[_0x9d26('0x4c')],{'$or':_[_0x9d26('0x39')](_0x3e5bde,function(_0x5b6d34){if(_0x5b6d34['type']!==_0x9d26('0x4e')){var _0x107d18={};_0x107d18[_0x5b6d34[_0x9d26('0x36')]]={'$like':'%'+_0x1fe56e[_0x9d26('0x3e')]['filter']+'%'};return _0x107d18;}})});}_0x43c279=_[_0x9d26('0x4d')]({},_0x43c279,_0x1fe56e['options']);var _0x1501a4={'where':_0x43c279[_0x9d26('0x4c')]};return db[_0x9d26('0x4f')][_0x9d26('0x50')](_0x1501a4)['then'](function(_0x4ad7be){_0x5f07b1['count']=_0x4ad7be;if(_0x1fe56e[_0x9d26('0x3e')][_0x9d26('0x51')]){_0x43c279[_0x9d26('0x52')]=[{'all':!![]}];}return db[_0x9d26('0x4f')][_0x9d26('0x53')](_0x43c279);})[_0x9d26('0x1d')](function(_0x417f4f){_0x5f07b1[_0x9d26('0x54')]=_0x417f4f;return _0x5f07b1;})[_0x9d26('0x1d')](respondWithFilteredResult(_0x7e4e48,_0x43c279))[_0x9d26('0x28')](handleError(_0x7e4e48,null));};exports[_0x9d26('0x55')]=function(_0x5bc459,_0x62ddd9){var _0x23bf3e={'raw':![],'where':{'id':_0x5bc459[_0x9d26('0x56')]['id']}},_0x2d740a={};_0x2d740a[_0x9d26('0x42')]=_[_0x9d26('0x3f')](db['Dynamics365Account'][_0x9d26('0x3a')]);_0x2d740a['query']=_[_0x9d26('0x3f')](_0x5bc459[_0x9d26('0x3e')]);_0x2d740a[_0x9d26('0x40')]=_[_0x9d26('0x41')](_0x2d740a[_0x9d26('0x42')],_0x2d740a['query']);_0x23bf3e[_0x9d26('0x43')]=_[_0x9d26('0x41')](_0x2d740a[_0x9d26('0x42')],qs['fields'](_0x5bc459[_0x9d26('0x3e')][_0x9d26('0x44')]));_0x23bf3e[_0x9d26('0x43')]=_0x23bf3e[_0x9d26('0x43')][_0x9d26('0x45')]?_0x23bf3e['attributes']:_0x2d740a['model'];if(_0x5bc459[_0x9d26('0x3e')][_0x9d26('0x51')]){_0x23bf3e[_0x9d26('0x52')]=[{'all':!![]}];}_0x23bf3e=_[_0x9d26('0x4d')]({},_0x23bf3e,_0x5bc459[_0x9d26('0x57')]);return db[_0x9d26('0x4f')][_0x9d26('0x58')](_0x23bf3e)['then'](handleEntityNotFound(_0x62ddd9,null))['then'](respondWithResult(_0x62ddd9,null))[_0x9d26('0x28')](handleError(_0x62ddd9,null));};exports[_0x9d26('0x59')]=function(_0x28071f,_0x353408){return db['Dynamics365Account'][_0x9d26('0x59')](_0x28071f[_0x9d26('0x5a')],{})['then'](respondWithResult(_0x353408,0xc9))['catch'](handleError(_0x353408,null));};exports[_0x9d26('0x33')]=function(_0x255a36,_0x52da46){if(_0x255a36[_0x9d26('0x5a')]['id']){delete _0x255a36[_0x9d26('0x5a')]['id'];}return db[_0x9d26('0x4f')]['find']({'where':{'id':_0x255a36['params']['id']}})[_0x9d26('0x1d')](handleEntityNotFound(_0x52da46,null))['then'](saveUpdates(_0x255a36[_0x9d26('0x5a')],null))[_0x9d26('0x1d')](respondWithResult(_0x52da46,null))[_0x9d26('0x28')](handleError(_0x52da46,null));};exports[_0x9d26('0x34')]=function(_0x166324,_0x184925){return db[_0x9d26('0x4f')][_0x9d26('0x58')]({'where':{'id':_0x166324[_0x9d26('0x56')]['id']}})['then'](handleEntityNotFound(_0x184925,null))['then'](removeEntity(_0x184925,null))[_0x9d26('0x28')](handleError(_0x184925,null));};exports['getConfigurations']=function(_0x3434fa,_0x140ca7,_0x258f43){var _0x3ff45e={};var _0x388e1a={};var _0x137201;var _0x5361a8;return db[_0x9d26('0x4f')]['findOne']({'where':{'id':_0x3434fa[_0x9d26('0x56')]['id']}})[_0x9d26('0x1d')](handleEntityNotFound(_0x140ca7,null))[_0x9d26('0x1d')](function(_0x475391){if(_0x475391){_0x137201=_0x475391;_0x388e1a['model']=_[_0x9d26('0x3f')](db[_0x9d26('0x5b')][_0x9d26('0x3a')]);_0x388e1a['query']=_[_0x9d26('0x3f')](_0x3434fa[_0x9d26('0x3e')]);_0x388e1a[_0x9d26('0x40')]=_['intersection'](_0x388e1a[_0x9d26('0x42')],_0x388e1a[_0x9d26('0x3e')]);_0x3ff45e['attributes']=_[_0x9d26('0x41')](_0x388e1a[_0x9d26('0x42')],qs[_0x9d26('0x44')](_0x3434fa[_0x9d26('0x3e')][_0x9d26('0x44')]));_0x3ff45e['attributes']=_0x3ff45e[_0x9d26('0x43')][_0x9d26('0x45')]?_0x3ff45e['attributes']:_0x388e1a['model'];_0x3ff45e['order']=qs['sort'](_0x3434fa['query'][_0x9d26('0x4a')]);_0x3ff45e[_0x9d26('0x4c')]=qs['filters'](_['pick'](_0x3434fa[_0x9d26('0x3e')],_0x388e1a[_0x9d26('0x40')]));if(_0x3434fa[_0x9d26('0x3e')][_0x9d26('0x4b')]){_0x3ff45e[_0x9d26('0x4c')]=_[_0x9d26('0x4d')](_0x3ff45e[_0x9d26('0x4c')],{'$or':_['map'](_0x3ff45e[_0x9d26('0x43')],function(_0x38b5a8){var _0x528017={};_0x528017[_0x38b5a8]={'$like':'%'+_0x3434fa['query']['filter']+'%'};return _0x528017;})});}_0x3ff45e=_[_0x9d26('0x4d')]({},_0x3ff45e,_0x3434fa['options']);return _0x137201['getConfigurations'](_0x3ff45e);}})[_0x9d26('0x1d')](function(_0xe28c21){if(_0xe28c21){_0x5361a8=_0xe28c21['length'];if(!_0x3434fa[_0x9d26('0x3e')][_0x9d26('0x46')](_0x9d26('0x47'))){_0x3ff45e['limit']=qs[_0x9d26('0x48')](_0x3434fa[_0x9d26('0x3e')][_0x9d26('0x48')]);_0x3ff45e['offset']=qs[_0x9d26('0x2c')](_0x3434fa[_0x9d26('0x3e')][_0x9d26('0x2c')]);}return _0x137201['getConfigurations'](_0x3ff45e);}})[_0x9d26('0x1d')](function(_0x145745){if(_0x145745){return _0x145745?{'count':_0x5361a8,'rows':_0x145745}:null;}})[_0x9d26('0x1d')](respondWithResult(_0x140ca7,null))[_0x9d26('0x28')](handleError(_0x140ca7,null));};exports[_0x9d26('0x5c')]=function(_0x566ac1,_0x48ae9f,_0x53ecd2){if(_0x566ac1[_0x9d26('0x5a')]['id']){delete _0x566ac1[_0x9d26('0x5a')]['id'];}return db[_0x9d26('0x4f')]['findOne']({'where':{'id':_0x566ac1[_0x9d26('0x56')]['id']}})[_0x9d26('0x1d')](handleEntityNotFound(_0x48ae9f,null))[_0x9d26('0x1d')](function(_0x3fff99){if(_0x3fff99){_0x566ac1[_0x9d26('0x5a')][_0x9d26('0x5d')]=_0x3fff99['id'];_0x566ac1[_0x9d26('0x5a')]['Subjects']=integrations['getSubjects'](_0x566ac1[_0x9d26('0x5a')]['channel'],_0x566ac1[_0x9d26('0x5a')][_0x9d26('0x3c')]);_0x566ac1[_0x9d26('0x5a')]['Descriptions']=integrations[_0x9d26('0x5e')](_0x566ac1[_0x9d26('0x5a')][_0x9d26('0x5f')],_0x566ac1['body']['type']);return db['Dynamics365Configuration'][_0x9d26('0x59')](_0x566ac1[_0x9d26('0x5a')],{'include':[{'model':db[_0x9d26('0x60')],'as':_0x9d26('0x61')},{'model':db[_0x9d26('0x60')],'as':_0x9d26('0x62')}]});}return null;})[_0x9d26('0x1d')](respondWithResult(_0x48ae9f,null))[_0x9d26('0x28')](handleError(_0x48ae9f,null));};exports[_0x9d26('0x63')]=function(_0x1273f1,_0x32af18,_0x2b459b){var _0x14d38a=_0x1273f1[_0x9d26('0x3e')][_0x9d26('0x64')];var _0x10b6d1=_0x14d38a==='incident'?_0x9d26('0x65'):'PhoneCall';var _0x2fbeda='';var _0x5eaa4b='';var _0x50298f='';var _0x3b4de7='';var _0x2a6a78='';var _0x2b6d03='';var _0xe28ca7='';var _0x31f79a='';var _0x14cd38=['title',_0x9d26('0x66'),'customerid',_0x9d26('0x67'),_0x9d26('0x68'),_0x9d26('0x69'),'phonenumber',_0x9d26('0x6a'),_0x9d26('0x6b'),_0x9d26('0x6c')];var _0x44186c=['accountidname',_0x9d26('0x6d'),_0x9d26('0x6e'),_0x9d26('0x6f'),_0x9d26('0x70'),_0x9d26('0x71'),_0x9d26('0x72'),'contractidname',_0x9d26('0x73'),'createdbyexternalpartyyominame',_0x9d26('0x74'),'createdbyyominame',_0x9d26('0x75'),_0x9d26('0x76'),_0x9d26('0x77'),_0x9d26('0x78'),_0x9d26('0x79'),_0x9d26('0x7a'),'emailaddress',_0x9d26('0x7b'),_0x9d26('0x7c'),_0x9d26('0x7d'),_0x9d26('0x7e'),_0x9d26('0x7f'),_0x9d26('0x80'),_0x9d26('0x81'),'importsequencenumber',_0x9d26('0x82'),_0x9d26('0x83'),_0x9d26('0x84'),_0x9d26('0x85'),_0x9d26('0x86'),'modifiedbyexternalpartyyominame',_0x9d26('0x87'),_0x9d26('0x88'),_0x9d26('0x89'),_0x9d26('0x8a'),_0x9d26('0x8b'),_0x9d26('0x8c'),_0x9d26('0x8d'),_0x9d26('0x8e'),_0x9d26('0x8f'),_0x9d26('0x90'),'owneridname','owneridtype',_0x9d26('0x91'),_0x9d26('0x92'),_0x9d26('0x93'),_0x9d26('0x94'),'prioritycodename',_0x9d26('0x95'),_0x9d26('0x96'),_0x9d26('0x97'),_0x9d26('0x98'),_0x9d26('0x99'),_0x9d26('0x9a'),_0x9d26('0x9b'),_0x9d26('0x9c'),_0x9d26('0x9d'),_0x9d26('0x9e'),_0x9d26('0x9f'),_0x9d26('0xa0'),_0x9d26('0xa1'),_0x9d26('0xa2'),_0x9d26('0xa3'),_0x9d26('0xa4'),_0x9d26('0xa5'),_0x9d26('0xa6'),_0x9d26('0xa7'),_0x9d26('0xa8')];var _0x164cdc=_0x14cd38[_0x9d26('0xa9')](_0x44186c);return db[_0x9d26('0x4f')][_0x9d26('0xaa')]({'where':{'id':_0x1273f1['params']['id']},'attributes':['id',_0x9d26('0xab'),_0x9d26('0xac'),_0x9d26('0xad'),_0x9d26('0xae'),_0x9d26('0xaf'),'clientSecret']})[_0x9d26('0x1d')](handleEntityNotFound(_0x32af18,null))[_0x9d26('0x1d')](function(_0x258f4d){if(_0x258f4d){_0x31f79a=_0x258f4d['remoteUri'];var _0x18d59f=_0x31f79a[_0x9d26('0xb0')](-0x1);if(_0x18d59f==='/'){_0x31f79a=_0x31f79a[_0x9d26('0xb1')](0x0,_0x31f79a[_0x9d26('0xb2')](_0x18d59f));}_0xe28ca7=util[_0x9d26('0xb3')](_0x9d26('0xb4'),_0x31f79a);var _0x34470c={'method':_0x9d26('0xb5'),'uri':'https://login.microsoftonline.com/'+_0x258f4d[_0x9d26('0xae')]+_0x9d26('0xb6'),'form':{'client_id':_0x258f4d[_0x9d26('0xaf')],'resource':_0x31f79a,'username':_0x258f4d[_0x9d26('0xab')],'password':_0x258f4d[_0x9d26('0xac')],'grant_type':_0x9d26('0xac'),'client_secret':_0x258f4d['clientSecret']},'json':!![]};return rp(_0x34470c);}})[_0x9d26('0x1d')](function(_0x37c933){_0x2b6d03=_0x37c933['access_token'];var _0x538876={'method':_0x9d26('0xb7'),'uri':encodeURI(_0xe28ca7+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x10b6d1+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2b6d03,'If-None-Match':null,'OData-Version':_0x9d26('0xb8')},'json':!![]};return rp(_0x538876);})[_0x9d26('0x1d')](function(_0xa55d3d){var _0x3b9fb2=_0xa55d3d[_0x9d26('0xb9')][0x0];var _0x383e16=_0x3b9fb2[_0x9d26('0xba')];var _0x15c293={'method':'GET','uri':_0xe28ca7+_0x9d26('0xbb')+_0x383e16+_0x9d26('0xbc'),'headers':{'Authorization':_0x9d26('0xbd')+_0x2b6d03,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x15c293);})[_0x9d26('0x1d')](function(_0xb90641){_0x2fbeda=_0xb90641;_0x5eaa4b=_0x2fbeda[_0x9d26('0xbe')];_0x5eaa4b=_[_0x9d26('0xbf')](_0x5eaa4b,function(_0x2ff03e){return!_0x164cdc[_0x9d26('0xc0')](_0x2ff03e['LogicalName']);});var _0x322d77=[];var _0x6a6d5c=[];_0x5eaa4b[_0x9d26('0xc1')](function(_0x265131){if(_0x265131[_0x9d26('0xc2')]){var _0x11bb1c=_0x265131['@odata.type'][_0x9d26('0xb1')](_0x265131[_0x9d26('0xc2')][_0x9d26('0xb2')]('.')+0x1);if(_0x11bb1c===_0x9d26('0xc3')){_0x322d77[_0x9d26('0xc4')](getSelectList(_0xe28ca7,_0x14d38a,_0x6a6d5c,_0x2fbeda[_0x9d26('0xba')],_0x265131[_0x9d26('0xba')],_0x2b6d03));}}});return Promise[_0x9d26('0xc5')](_0x322d77);})['then'](function(_0x2adce0){_0x50298f=_0x2adce0[0x0];var _0x2c73d9=[];var _0x380843=[];_0x5eaa4b[_0x9d26('0xc1')](function(_0x469233){if(!_[_0x9d26('0xc6')](_0x469233[_0x9d26('0xc2')])){var _0x56873e=_0x469233[_0x9d26('0xc2')][_0x9d26('0xb1')](_0x469233[_0x9d26('0xc2')]['lastIndexOf']('.')+0x1);if(_0x56873e==='BooleanAttributeMetadata'){_0x2c73d9['push'](getBooleanList(_0xe28ca7,_0x14d38a,_0x380843,_0x2fbeda[_0x9d26('0xba')],_0x469233[_0x9d26('0xba')],_0x2b6d03));}}});return Promise[_0x9d26('0xc5')](_0x2c73d9);})[_0x9d26('0x1d')](function(_0x2598c0){_0x3b4de7=_0x2598c0[0x0];var _0x2ccb1a=[];var _0x17b272=[];_0x5eaa4b[_0x9d26('0xc1')](function(_0x526b32){if(_0x526b32[_0x9d26('0xc2')]){var _0x23873d=_0x526b32[_0x9d26('0xc2')]['substring'](_0x526b32['@odata.type']['lastIndexOf']('.')+0x1);if(_0x23873d==='StringAttributeMetadata'||_0x23873d===_0x9d26('0xc7')||_0x23873d==='BigIntAttributeMetadata'||_0x23873d===_0x9d26('0xc8')||_0x23873d===_0x9d26('0xc9')||_0x23873d===_0x9d26('0xca')||_0x23873d===_0x9d26('0xcb')||_0x23873d===_0x9d26('0xcc')||_0x23873d==='StateAttributeMetadata'||_0x23873d===_0x9d26('0xcd')){_0x2ccb1a[_0x9d26('0xc4')](getInputList(_0xe28ca7,_0x14d38a,_0x23873d,_0x17b272,_0x2fbeda[_0x9d26('0xba')],_0x526b32[_0x9d26('0xba')],_0x2b6d03));}}});return Promise[_0x9d26('0xc5')](_0x2ccb1a);})[_0x9d26('0x1d')](function(_0x3a37f5){_0x2a6a78=_0x3a37f5[0x0];var _0x4991c7=_0x50298f[_0x9d26('0xa9')](_0x3b4de7)[_0x9d26('0xa9')](_0x2a6a78);var _0x3ea231={'count':_0x4991c7['length'],'rows':_0x4991c7};return _0x3ea231;})[_0x9d26('0x1d')](respondWithResult(_0x32af18,null))[_0x9d26('0x28')](function(_0x33a2f9){var _0x1d3f8a=_0x1273f1[_0x9d26('0x3e')][_0x9d26('0x18')]?0x1f4:_0x33a2f9[_0x9d26('0xce')]||0x1f4;logger[_0x9d26('0x24')](_0x33a2f9[_0x9d26('0x35')]);delete _0x33a2f9[_0x9d26('0x36')];if(_0x1d3f8a===0x191){_0x1d3f8a=0x190;}_0x32af18[_0x9d26('0x2b')](_0x1d3f8a)[_0x9d26('0x37')](_0x1273f1[_0x9d26('0x3e')][_0x9d26('0x18')]?{'message':_0x9d26('0xcf'),'statusCode':_0x33a2f9[_0x9d26('0xce')]}:_0x33a2f9);});};function getSelectList(_0x4c7ff4,_0x1c56ab,_0x435b3e,_0x39d83d,_0x179fa2,_0x2d51ab){var _0xc1c73b={'method':_0x9d26('0xb7'),'uri':_0x4c7ff4+_0x9d26('0xbb')+_0x39d83d+_0x9d26('0xd0')+_0x179fa2+_0x9d26('0xd1')+_0x9d26('0xd2'),'headers':{'Authorization':_0x9d26('0xbd')+_0x2d51ab,'If-None-Match':null,'OData-Version':_0x9d26('0xb8')},'json':!![]};return rp(_0xc1c73b)['then'](function(_0x2f9d7b){var _0x47669c=[];var _0x174fae=_0x2f9d7b['OptionSet']['Options'];_0x174fae['forEach'](function(_0x1b7783){_0x47669c[_0x9d26('0xc4')]({'name':_0x1b7783[_0x9d26('0xd3')][_0x9d26('0xd4')]['Label'],'value':String(_0x1b7783[_0x9d26('0xd5')])});});var _0x4dd97e={'id':_0x1c56ab+'_'+_0x2f9d7b[_0x9d26('0xd6')],'name':_0x2f9d7b[_0x9d26('0xd7')]['UserLocalizedLabel'][_0x9d26('0xd3')],'custom':![],'options':_0x47669c};_0x435b3e[_0x9d26('0xc4')](_0x4dd97e);return _0x435b3e;});}function getBooleanList(_0x354c5b,_0x50f87a,_0x1c7a0f,_0x57df11,_0x3c27a4,_0x5ddb8d){var _0x322279={'method':'GET','uri':_0x354c5b+_0x9d26('0xbb')+_0x57df11+_0x9d26('0xd0')+_0x3c27a4+_0x9d26('0xd8'),'headers':{'Authorization':'Bearer\x20'+_0x5ddb8d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x322279)['then'](function(_0x4dfc07){var _0x50d4b8=[];_0x50d4b8['push']({'name':_0x4dfc07[_0x9d26('0xd9')][_0x9d26('0xda')][_0x9d26('0xd3')]['UserLocalizedLabel'][_0x9d26('0xd3')],'value':_0x9d26('0xdb')},{'name':_0x4dfc07['OptionSet'][_0x9d26('0xdc')][_0x9d26('0xd3')][_0x9d26('0xd4')][_0x9d26('0xd3')],'value':_0x9d26('0xdd')});var _0x54b1be={'id':_0x50f87a+'_'+_0x4dfc07[_0x9d26('0xd6')],'name':_0x4dfc07[_0x9d26('0xd7')][_0x9d26('0xd4')]['Label'],'custom':![],'options':_0x50d4b8};_0x1c7a0f[_0x9d26('0xc4')](_0x54b1be);return _0x1c7a0f;});}function getInputList(_0xd04e4b,_0x196b30,_0x5a5fba,_0x569735,_0x5a51ee,_0x36d8da,_0x44ffd8){var _0x358808={'method':_0x9d26('0xb7'),'uri':_0xd04e4b+_0x9d26('0xbb')+_0x5a51ee+_0x9d26('0xd0')+_0x36d8da+')/Microsoft.Dynamics.CRM.'+_0x5a5fba+_0x9d26('0xde'),'headers':{'Authorization':_0x9d26('0xbd')+_0x44ffd8,'If-None-Match':null,'OData-Version':_0x9d26('0xb8')},'json':!![]};return rp(_0x358808)[_0x9d26('0x1d')](function(_0x1ebc6d){var _0x1a3a6d={'id':_0x196b30+'_'+_0x1ebc6d[_0x9d26('0xd6')],'name':_0x1ebc6d[_0x9d26('0xd7')][_0x9d26('0xd4')]?_0x1ebc6d['DisplayName'][_0x9d26('0xd4')]['Label']:_0x1ebc6d['LogicalName'],'custom':![],'options':[]};_0x569735[_0x9d26('0xc4')](_0x1a3a6d);return _0x569735;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 47da68e..e696bd7 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 _0x03d3=['../../components/integrations/configuration','Dynamics365Account','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes'];(function(_0x6a9ff5,_0x2b823e){var _0x31b23b=function(_0x225aac){while(--_0x225aac){_0x6a9ff5['push'](_0x6a9ff5['shift']());}};_0x31b23b(++_0x2b823e);}(_0x03d3,0xe6));var _0x303d=function(_0x26b192,_0x385457){_0x26b192=_0x26b192-0x0;var _0x18fd35=_0x03d3[_0x26b192];return _0x18fd35;};'use strict';var _=require(_0x303d('0x0'));var util=require(_0x303d('0x1'));var logger=require(_0x303d('0x2'))(_0x303d('0x3'));var moment=require(_0x303d('0x4'));var BPromise=require(_0x303d('0x5'));var rp=require(_0x303d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x303d('0x7'));var config=require(_0x303d('0x8'));var attributes=require(_0x303d('0x9'));var integrations=require(_0x303d('0xa'));module['exports']=function(_0x4a7cde,_0x13acff){return _0x4a7cde['define'](_0x303d('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77c2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','exports','define','Dynamics365Account','lodash','util','../../config/logger'];(function(_0x13d499,_0x5dc664){var _0x538502=function(_0x16c016){while(--_0x16c016){_0x13d499['push'](_0x13d499['shift']());}};_0x538502(++_0x5dc664);}(_0x77c2,0x177));var _0x277c=function(_0x2ccb91,_0xa2c1b4){_0x2ccb91=_0x2ccb91-0x0;var _0x4136ca=_0x77c2[_0x2ccb91];return _0x4136ca;};'use strict';var _=require(_0x277c('0x0'));var util=require(_0x277c('0x1'));var logger=require(_0x277c('0x2'))(_0x277c('0x3'));var moment=require(_0x277c('0x4'));var BPromise=require(_0x277c('0x5'));var rp=require(_0x277c('0x6'));var fs=require('fs');var path=require(_0x277c('0x7'));var rimraf=require(_0x277c('0x8'));var config=require(_0x277c('0x9'));var attributes=require(_0x277c('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x277c('0xb')]=function(_0xdcd77e,_0x215c8e){return _0xdcd77e[_0x277c('0xc')](_0x277c('0xd'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index cf6c17a..e9e3d22 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 _0x5fab=['map','model','info','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5fab,0x177));var _0xb5fa=function(_0x571c00,_0x3ae028){_0x571c00=_0x571c00-0x0;var _0x2887df=_0x5fab[_0x571c00];return _0x2887df;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});}exports[_0xb5fa('0x18')]=function(_0x32e9e5){var _0x46eef0=this;return new Promise(function(_0x324ba5,_0x13e82b){return db[_0xb5fa('0x19')][_0xb5fa('0x1a')]({'raw':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5['options'][_0xb5fa('0x1d')]||null:null,'attributes':_0x32e9e5['options']?_0x32e9e5[_0xb5fa('0x1b')]['attributes']||null:null,'limit':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')]['limit']||null:null,'include':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1e')]?_['map'](_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1e')],function(_0x444237){return{'model':db[_0x444237['model']],'as':_0x444237['as'],'attributes':_0x444237[_0xb5fa('0x1f')],'include':_0x444237['include']?_[_0xb5fa('0x20')](_0x444237[_0xb5fa('0x1e')],function(_0x11053a){return{'model':db[_0x11053a[_0xb5fa('0x21')]],'as':_0x11053a['as'],'attributes':_0x11053a[_0xb5fa('0x1f')],'include':_0x11053a[_0xb5fa('0x1e')]?_[_0xb5fa('0x20')](_0x11053a[_0xb5fa('0x1e')],function(_0x568870){return{'model':db[_0x568870['model']],'as':_0x568870['as'],'attributes':_0x568870['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28a350){logger[_0xb5fa('0x22')](_0xb5fa('0x18'),_0x32e9e5);logger[_0xb5fa('0xf')](_0xb5fa('0x18'),_0x32e9e5,JSON[_0xb5fa('0x11')](_0x28a350));_0x324ba5(_0x28a350);})[_0xb5fa('0x17')](function(_0x353314){logger[_0xb5fa('0x12')](_0xb5fa('0x18'),_0x353314[_0xb5fa('0x14')],_0x32e9e5);_0x13e82b(_0x46eef0[_0xb5fa('0x12')](0x1f4,_0x353314[_0xb5fa('0x14')]));});});};exports[_0xb5fa('0x23')]=function(_0xed02e){var _0x116773=this;return new Promise(function(_0x5a0152,_0x3fd1fb){return db[_0xb5fa('0x19')][_0xb5fa('0x24')]({'raw':_0xed02e[_0xb5fa('0x1b')]?_0xed02e[_0xb5fa('0x1b')][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0xed02e[_0xb5fa('0x1b')]?_0xed02e['options'][_0xb5fa('0x1d')]||null:null,'attributes':_0xed02e['options']?_0xed02e['options']['attributes']||null:null,'include':_0xed02e[_0xb5fa('0x1b')]?_0xed02e['options'][_0xb5fa('0x1e')]?_['map'](_0xed02e['options'][_0xb5fa('0x1e')],function(_0x934b49){return{'model':db[_0x934b49['model']],'as':_0x934b49['as'],'attributes':_0x934b49['attributes'],'include':_0x934b49[_0xb5fa('0x1e')]?_[_0xb5fa('0x20')](_0x934b49[_0xb5fa('0x1e')],function(_0x560b53){return{'model':db[_0x560b53[_0xb5fa('0x21')]],'as':_0x560b53['as'],'attributes':_0x560b53[_0xb5fa('0x1f')],'include':_0x560b53['include']?_[_0xb5fa('0x20')](_0x560b53[_0xb5fa('0x1e')],function(_0x204d6b){return{'model':db[_0x204d6b['model']],'as':_0x204d6b['as'],'attributes':_0x204d6b[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0xd')](function(_0x24ef11){logger['info'](_0xb5fa('0x23'),_0xed02e);logger[_0xb5fa('0xf')](_0xb5fa('0x23'),_0xed02e,JSON[_0xb5fa('0x11')](_0x24ef11));_0x5a0152(_0x24ef11);})['catch'](function(_0x4bba91){logger['error']('ShowDynamics365Account',_0x4bba91['message'],_0xed02e);_0x3fd1fb(_0x116773['error'](0x1f4,_0x4bba91[_0xb5fa('0x14')]));});});}; \ No newline at end of file +var _0x44ff=['find','where','ShowDynamics365Account','util','moment','bluebird','../../config/logger','rpc','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','raw','options','limit','map','include','model','attributes','Dynamics365Account'];(function(_0x38c8c7,_0x19300e){var _0x5bc772=function(_0x39e61b){while(--_0x39e61b){_0x38c8c7['push'](_0x38c8c7['shift']());}};_0x5bc772(++_0x19300e);}(_0x44ff,0x1c3));var _0xf44f=function(_0xacc326,_0x56bc9f){_0xacc326=_0xacc326-0x0;var _0x37143f=_0x44ff[_0xacc326];return _0x37143f;};'use strict';var _=require('lodash');var util=require(_0xf44f('0x0'));var moment=require(_0xf44f('0x1'));var BPromise=require(_0xf44f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf44f('0x3'))(_0xf44f('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf44f('0x5')][_0xf44f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x24baf4,_0x536b0e,_0x1aa3e5){return new BPromise(function(_0x2dae46,_0x1a1b8a){return client['request'](_0x24baf4,_0x1aa3e5)[_0xf44f('0x7')](function(_0x1f12d7){logger[_0xf44f('0x8')](_0xf44f('0x9'),_0x536b0e,_0xf44f('0xa'));logger[_0xf44f('0xb')](_0xf44f('0xc'),_0x536b0e,_0xf44f('0xa'),JSON[_0xf44f('0xd')](_0x1f12d7));if(_0x1f12d7[_0xf44f('0xe')]){if(_0x1f12d7['error'][_0xf44f('0xf')]===0x1f4){logger[_0xf44f('0xe')](_0xf44f('0x9'),_0x536b0e,_0x1f12d7[_0xf44f('0xe')][_0xf44f('0x10')]);return _0x1a1b8a(_0x1f12d7[_0xf44f('0xe')][_0xf44f('0x10')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x536b0e,_0x1f12d7[_0xf44f('0xe')]['message']);return _0x2dae46(_0x1f12d7['error']['message']);}else{logger[_0xf44f('0x8')](_0xf44f('0x9'),_0x536b0e,_0xf44f('0xa'));_0x2dae46(_0x1f12d7[_0xf44f('0x11')]['message']);}})[_0xf44f('0x12')](function(_0x56b1ca){logger[_0xf44f('0xe')](_0xf44f('0x9'),_0x536b0e,_0x56b1ca);_0x1a1b8a(_0x56b1ca);});});}exports[_0xf44f('0x13')]=function(_0x15e5b6){var _0x542786=this;return new Promise(function(_0x4f0338,_0x5d4a52){return db['Dynamics365Account'][_0xf44f('0x14')]({'raw':_0x15e5b6['options']?_0x15e5b6['options'][_0xf44f('0x15')]===undefined?!![]:![]:!![],'where':_0x15e5b6[_0xf44f('0x16')]?_0x15e5b6[_0xf44f('0x16')]['where']||null:null,'attributes':_0x15e5b6[_0xf44f('0x16')]?_0x15e5b6[_0xf44f('0x16')]['attributes']||null:null,'limit':_0x15e5b6[_0xf44f('0x16')]?_0x15e5b6['options'][_0xf44f('0x17')]||null:null,'include':_0x15e5b6[_0xf44f('0x16')]?_0x15e5b6[_0xf44f('0x16')]['include']?_[_0xf44f('0x18')](_0x15e5b6[_0xf44f('0x16')][_0xf44f('0x19')],function(_0x58d4af){return{'model':db[_0x58d4af[_0xf44f('0x1a')]],'as':_0x58d4af['as'],'attributes':_0x58d4af[_0xf44f('0x1b')],'include':_0x58d4af[_0xf44f('0x19')]?_[_0xf44f('0x18')](_0x58d4af[_0xf44f('0x19')],function(_0x5313f5){return{'model':db[_0x5313f5[_0xf44f('0x1a')]],'as':_0x5313f5['as'],'attributes':_0x5313f5[_0xf44f('0x1b')],'include':_0x5313f5[_0xf44f('0x19')]?_[_0xf44f('0x18')](_0x5313f5['include'],function(_0x1af2a2){return{'model':db[_0x1af2a2[_0xf44f('0x1a')]],'as':_0x1af2a2['as'],'attributes':_0x1af2a2[_0xf44f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf44f('0x7')](function(_0xc6ed8a){logger[_0xf44f('0x8')]('GetDynamics365Account',_0x15e5b6);logger[_0xf44f('0xb')]('GetDynamics365Account',_0x15e5b6,JSON[_0xf44f('0xd')](_0xc6ed8a));_0x4f0338(_0xc6ed8a);})[_0xf44f('0x12')](function(_0x5a5a83){logger['error'](_0xf44f('0x13'),_0x5a5a83[_0xf44f('0x10')],_0x15e5b6);_0x5d4a52(_0x542786[_0xf44f('0xe')](0x1f4,_0x5a5a83[_0xf44f('0x10')]));});});};exports['ShowDynamics365Account']=function(_0x1ee969){var _0x37a208=this;return new Promise(function(_0x5d3ac2,_0x3ec317){return db[_0xf44f('0x1c')][_0xf44f('0x1d')]({'raw':_0x1ee969[_0xf44f('0x16')]?_0x1ee969[_0xf44f('0x16')][_0xf44f('0x15')]===undefined?!![]:![]:!![],'where':_0x1ee969[_0xf44f('0x16')]?_0x1ee969[_0xf44f('0x16')][_0xf44f('0x1e')]||null:null,'attributes':_0x1ee969[_0xf44f('0x16')]?_0x1ee969['options'][_0xf44f('0x1b')]||null:null,'include':_0x1ee969[_0xf44f('0x16')]?_0x1ee969['options'][_0xf44f('0x19')]?_[_0xf44f('0x18')](_0x1ee969[_0xf44f('0x16')][_0xf44f('0x19')],function(_0x2cf878){return{'model':db[_0x2cf878['model']],'as':_0x2cf878['as'],'attributes':_0x2cf878[_0xf44f('0x1b')],'include':_0x2cf878[_0xf44f('0x19')]?_[_0xf44f('0x18')](_0x2cf878[_0xf44f('0x19')],function(_0x35e5c6){return{'model':db[_0x35e5c6[_0xf44f('0x1a')]],'as':_0x35e5c6['as'],'attributes':_0x35e5c6[_0xf44f('0x1b')],'include':_0x35e5c6[_0xf44f('0x19')]?_[_0xf44f('0x18')](_0x35e5c6['include'],function(_0x1114aa){return{'model':db[_0x1114aa[_0xf44f('0x1a')]],'as':_0x1114aa['as'],'attributes':_0x1114aa[_0xf44f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf44f('0x7')](function(_0x2865bf){logger[_0xf44f('0x8')](_0xf44f('0x1f'),_0x1ee969);logger[_0xf44f('0xb')](_0xf44f('0x1f'),_0x1ee969,JSON[_0xf44f('0xd')](_0x2865bf));_0x5d3ac2(_0x2865bf);})[_0xf44f('0x12')](function(_0x13ae55){logger[_0xf44f('0xe')](_0xf44f('0x1f'),_0x13ae55[_0xf44f('0x10')],_0x1ee969);_0x3ec317(_0x37a208[_0xf44f('0xe')](0x1f4,_0x13ae55[_0xf44f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9720869..4419a1b 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 _0x32bc=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5c4ba6,_0x11a3ff){var _0x5e1715=function(_0x32984a){while(--_0x32984a){_0x5c4ba6['push'](_0x5c4ba6['shift']());}};_0x5e1715(++_0x11a3ff);}(_0x32bc,0x9b));var _0xc32b=function(_0xcdaf54,_0x4c77ee){_0xcdaf54=_0xcdaf54-0x0;var _0x28efd1=_0x32bc[_0xcdaf54];return _0x28efd1;};'use strict';var multer=require(_0xc32b('0x0'));var util=require(_0xc32b('0x1'));var path=require('path');var timeout=require(_0xc32b('0x2'));var express=require(_0xc32b('0x3'));var router=express[_0xc32b('0x4')]();var auth=require(_0xc32b('0x5'));var interaction=require(_0xc32b('0x6'));var config=require(_0xc32b('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0xc32b('0x8')]('/',auth[_0xc32b('0x9')](),controller['index']);router[_0xc32b('0x8')](_0xc32b('0xa'),auth[_0xc32b('0x9')](),controller[_0xc32b('0xb')]);router['get'](_0xc32b('0xc'),auth[_0xc32b('0x9')](),controller[_0xc32b('0xd')]);router['get'](_0xc32b('0xe'),auth[_0xc32b('0x9')](),controller[_0xc32b('0xf')]);router[_0xc32b('0x8')](_0xc32b('0x10'),auth[_0xc32b('0x9')](),controller[_0xc32b('0x11')]);router[_0xc32b('0x12')]('/',auth[_0xc32b('0x9')](),controller[_0xc32b('0x13')]);router[_0xc32b('0x14')]('/:id',auth[_0xc32b('0x9')](),controller[_0xc32b('0x15')]);router['delete'](_0xc32b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc32b('0x16')]=router; \ No newline at end of file +var _0xd722=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports'];(function(_0x2f7cd7,_0x35694f){var _0x362776=function(_0xbb5e40){while(--_0xbb5e40){_0x2f7cd7['push'](_0x2f7cd7['shift']());}};_0x362776(++_0x35694f);}(_0xd722,0x9a));var _0x2d72=function(_0x5f4b43,_0x67fc43){_0x5f4b43=_0x5f4b43-0x0;var _0x4ac112=_0xd722[_0x5f4b43];return _0x4ac112;};'use strict';var multer=require('multer');var util=require(_0x2d72('0x0'));var path=require('path');var timeout=require(_0x2d72('0x1'));var express=require('express');var router=express[_0x2d72('0x2')]();var auth=require(_0x2d72('0x3'));var interaction=require(_0x2d72('0x4'));var config=require(_0x2d72('0x5'));var controller=require(_0x2d72('0x6'));router[_0x2d72('0x7')]('/',auth[_0x2d72('0x8')](),controller[_0x2d72('0x9')]);router[_0x2d72('0x7')](_0x2d72('0xa'),auth['isAuthenticated'](),controller[_0x2d72('0xb')]);router[_0x2d72('0x7')](_0x2d72('0xc'),auth['isAuthenticated'](),controller[_0x2d72('0xd')]);router[_0x2d72('0x7')](_0x2d72('0xe'),auth[_0x2d72('0x8')](),controller['getSubjects']);router[_0x2d72('0x7')](_0x2d72('0xf'),auth[_0x2d72('0x8')](),controller[_0x2d72('0x10')]);router['post']('/',auth[_0x2d72('0x8')](),controller[_0x2d72('0x11')]);router['put']('/:id',auth[_0x2d72('0x8')](),controller[_0x2d72('0x12')]);router[_0x2d72('0x13')](_0x2d72('0xa'),auth[_0x2d72('0x8')](),controller[_0x2d72('0x14')]);module[_0x2d72('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 63d24e4..a2e1d30 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 _0x69ca=['phonecall','sequelize','exports','STRING','ENUM','incident'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x69ca,0xa9));var _0xa69c=function(_0x3a4938,_0x2d38bc){_0x3a4938=_0x3a4938-0x0;var _0x2ce7ca=_0x69ca[_0x3a4938];return _0x2ce7ca;};'use strict';var Sequelize=require(_0xa69c('0x0'));module[_0xa69c('0x1')]={'name':{'type':Sequelize[_0xa69c('0x2')]},'description':{'type':Sequelize[_0xa69c('0x2')]},'ticketType':{'type':Sequelize[_0xa69c('0x3')](_0xa69c('0x4'),_0xa69c('0x5')),'defaultValue':_0xa69c('0x4')}}; \ No newline at end of file +var _0xa43c=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x1f0824,_0x1be6a8){var _0x59d1df=function(_0x2343b5){while(--_0x2343b5){_0x1f0824['push'](_0x1f0824['shift']());}};_0x59d1df(++_0x1be6a8);}(_0xa43c,0x159));var _0xca43=function(_0x2087b8,_0x1b7448){_0x2087b8=_0x2087b8-0x0;var _0x45603d=_0xa43c[_0x2087b8];return _0x45603d;};'use strict';var Sequelize=require(_0xca43('0x0'));module[_0xca43('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xca43('0x2')]},'ticketType':{'type':Sequelize[_0xca43('0x3')](_0xca43('0x4'),_0xca43('0x5')),'defaultValue':_0xca43('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 07860ad..83c4dd0 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 _0x1968=['client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','keys','query','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','destroy','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1968,0x10c));var _0x8196=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1968[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0x8196('0x0'));var emlformat=require(_0x8196('0x1'));var rimraf=require(_0x8196('0x2'));var zipdir=require(_0x8196('0x3'));var jsonpatch=require(_0x8196('0x4'));var rp=require(_0x8196('0x5'));var moment=require(_0x8196('0x6'));var BPromise=require(_0x8196('0x7'));var Mustache=require(_0x8196('0x8'));var util=require(_0x8196('0x9'));var path=require('path');var sox=require(_0x8196('0xa'));var csv=require(_0x8196('0xb'));var ejs=require(_0x8196('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8196('0xd'));var crypto=require(_0x8196('0xe'));var jsforce=require(_0x8196('0xf'));var deskjs=require(_0x8196('0x10'));var toCsv=require(_0x8196('0xb'));var querystring=require(_0x8196('0x11'));var Papa=require(_0x8196('0x12'));var Redis=require(_0x8196('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8196('0x14'));var hardwareService=require(_0x8196('0x15'));var logger=require(_0x8196('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8196('0x17'));var db=require(_0x8196('0x18'))['db'];var jayson=require(_0x8196('0x19'));var client=jayson[_0x8196('0x1a')][_0x8196('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2b48a0,_0x5e565e,_0x2470e9){if(_0x2470e9){var _0x5493c0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5493c0[_0x8196('0x1c')](_0x5e565e)){return _0x2b48a0;}else{throw new db[(_0x8196('0x1d'))]['ValidationError'](_0x8196('0x1e'));}}else{return _0x2b48a0;}}function respondWithRpcPromise(_0x24e207,_0xb223ef,_0x1e37c5,_0x7e3b05){return new BPromise(function(_0x37ad82,_0x623b24){var _0x487c1c=_0x7e3b05||client;return _0x487c1c[_0x8196('0x1f')](_0x24e207,_0x1e37c5)[_0x8196('0x20')](function(_0x21b8a6){logger[_0x8196('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0xb223ef,_0x8196('0x22'));logger[_0x8196('0x23')](_0x8196('0x24'),_0xb223ef,_0x8196('0x22'),JSON[_0x8196('0x25')](_0x21b8a6));if(_0x21b8a6[_0x8196('0x26')]){if(_0x21b8a6[_0x8196('0x26')]['code']===0x1f4){logger[_0x8196('0x26')](_0x8196('0x27'),_0xb223ef,_0x21b8a6[_0x8196('0x26')][_0x8196('0x28')]);return _0x623b24(_0x21b8a6[_0x8196('0x26')]['message']);}logger['error'](_0x8196('0x27'),_0xb223ef,_0x21b8a6[_0x8196('0x26')][_0x8196('0x28')]);return _0x37ad82(_0x21b8a6[_0x8196('0x26')]['message']);}else{logger[_0x8196('0x21')](_0x8196('0x27'),_0xb223ef,_0x8196('0x22'));_0x37ad82(_0x21b8a6[_0x8196('0x29')][_0x8196('0x28')]);}})['catch'](function(_0x1a9b44){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0xb223ef,_0x1a9b44);_0x623b24(_0x1a9b44);});});}function respondWithStatusCode(_0x53ca46,_0x1576df){_0x1576df=_0x1576df||0xcc;return function(_0x177750){if(_0x177750){return _0x53ca46[_0x8196('0x2a')](_0x1576df);}return _0x53ca46[_0x8196('0x2b')](_0x1576df)[_0x8196('0x2c')]();};}function respondWithResult(_0x13ba91,_0x3a0d16){_0x3a0d16=_0x3a0d16||0xc8;return function(_0x15d879){if(_0x15d879){return _0x13ba91['status'](_0x3a0d16)[_0x8196('0x2d')](_0x15d879);}};}function respondWithFilteredResult(_0x58edfe,_0x27aa25){return function(_0x1ce203){if(_0x1ce203){var _0x44b6fd=_0x1ce203['count'],_0x47784d=_0x27aa25[_0x8196('0x2e')],_0x3e39ff=_0x27aa25['offset']+_0x27aa25[_0x8196('0x2f')],_0x50a7b5;if(_0x3e39ff>=_0x44b6fd){_0x3e39ff=_0x44b6fd;_0x50a7b5=0xc8;}else{_0x50a7b5=0xce;}_0x58edfe[_0x8196('0x2b')](_0x50a7b5);return _0x58edfe[_0x8196('0x30')](_0x8196('0x31'),_0x47784d+'-'+_0x3e39ff+'/'+_0x44b6fd)[_0x8196('0x2d')](_0x1ce203);}return null;};}function patchUpdates(_0x59ab9c){return function(_0x351671){try{jsonpatch[_0x8196('0x32')](_0x351671,_0x59ab9c,!![]);}catch(_0x294f94){return BPromise[_0x8196('0x33')](_0x294f94);}return _0x351671[_0x8196('0x34')]();};}function saveUpdates(_0x5d307a,_0x413d2b){return function(_0x48a8e9){if(_0x48a8e9){return _0x48a8e9[_0x8196('0x35')](_0x5d307a)['then'](function(_0xa3032e){return _0xa3032e;});}return null;};}function removeEntity(_0x52493a,_0x35c952){return function(_0x347b84){if(_0x347b84){return _0x347b84['destroy']()[_0x8196('0x20')](function(){_0x52493a[_0x8196('0x2b')](0xcc)[_0x8196('0x2c')]();});}};}function handleEntityNotFound(_0x38f75f,_0x1322ad){return function(_0x5f5230){if(!_0x5f5230){_0x38f75f[_0x8196('0x2a')](0x194);}return _0x5f5230;};}function handleError(_0x12d851,_0x568663){_0x568663=_0x568663||0x1f4;return function(_0x4f31dd){logger[_0x8196('0x26')](_0x4f31dd[_0x8196('0x36')]);if(_0x4f31dd[_0x8196('0x37')]){delete _0x4f31dd[_0x8196('0x37')];}_0x12d851[_0x8196('0x2b')](_0x568663)[_0x8196('0x38')](_0x4f31dd);};}exports[_0x8196('0x39')]=function(_0x336d89,_0x2e7fd2){var _0xf00d3c={},_0x544d91={},_0x10e781={'count':0x0,'rows':[]};var _0x5ee331=_[_0x8196('0x3a')](db[_0x8196('0x3b')][_0x8196('0x3c')],function(_0x47d770){return{'name':_0x47d770['fieldName'],'type':_0x47d770[_0x8196('0x3d')][_0x8196('0x3e')]};});_0x544d91['model']=_['map'](_0x5ee331,_0x8196('0x37'));_0x544d91['query']=_[_0x8196('0x3f')](_0x336d89[_0x8196('0x40')]);_0x544d91['filters']=_['intersection'](_0x544d91[_0x8196('0x41')],_0x544d91['query']);_0xf00d3c['attributes']=_['intersection'](_0x544d91[_0x8196('0x41')],qs[_0x8196('0x42')](_0x336d89[_0x8196('0x40')]['fields']));_0xf00d3c['attributes']=_0xf00d3c['attributes'][_0x8196('0x43')]?_0xf00d3c[_0x8196('0x44')]:_0x544d91[_0x8196('0x41')];if(!_0x336d89[_0x8196('0x40')][_0x8196('0x45')](_0x8196('0x46'))){_0xf00d3c[_0x8196('0x2f')]=qs[_0x8196('0x2f')](_0x336d89[_0x8196('0x40')][_0x8196('0x2f')]);_0xf00d3c['offset']=qs[_0x8196('0x2e')](_0x336d89[_0x8196('0x40')][_0x8196('0x2e')]);}_0xf00d3c[_0x8196('0x47')]=qs[_0x8196('0x48')](_0x336d89[_0x8196('0x40')][_0x8196('0x48')]);_0xf00d3c['where']=qs[_0x8196('0x49')](_['pick'](_0x336d89[_0x8196('0x40')],_0x544d91[_0x8196('0x49')]),_0x5ee331);if(_0x336d89[_0x8196('0x40')][_0x8196('0x4a')]){_0xf00d3c[_0x8196('0x4b')]=_[_0x8196('0x4c')](_0xf00d3c[_0x8196('0x4b')],{'$or':_[_0x8196('0x3a')](_0x5ee331,function(_0x46dc8b){if(_0x46dc8b[_0x8196('0x3d')]!==_0x8196('0x4d')){var _0x1d8f04={};_0x1d8f04[_0x46dc8b['name']]={'$like':'%'+_0x336d89[_0x8196('0x40')][_0x8196('0x4a')]+'%'};return _0x1d8f04;}})});}_0xf00d3c=_['merge']({},_0xf00d3c,_0x336d89[_0x8196('0x4e')]);var _0x3da1fe={'where':_0xf00d3c[_0x8196('0x4b')]};return db['Dynamics365Configuration'][_0x8196('0x4f')](_0x3da1fe)[_0x8196('0x20')](function(_0x133f4f){_0x10e781['count']=_0x133f4f;if(_0x336d89[_0x8196('0x40')]['includeAll']){_0xf00d3c[_0x8196('0x50')]=[{'all':!![]}];}return db[_0x8196('0x3b')][_0x8196('0x51')](_0xf00d3c);})[_0x8196('0x20')](function(_0x4aac9b){_0x10e781[_0x8196('0x52')]=_0x4aac9b;return _0x10e781;})['then'](respondWithFilteredResult(_0x2e7fd2,_0xf00d3c))[_0x8196('0x53')](handleError(_0x2e7fd2,null));};exports[_0x8196('0x54')]=function(_0x4b0638,_0x4a9b2c){var _0x135698={'raw':![],'where':{'id':_0x4b0638[_0x8196('0x55')]['id']}},_0x403fb5={};_0x403fb5[_0x8196('0x41')]=_[_0x8196('0x3f')](db['Dynamics365Configuration'][_0x8196('0x3c')]);_0x403fb5[_0x8196('0x40')]=_['keys'](_0x4b0638[_0x8196('0x40')]);_0x403fb5[_0x8196('0x49')]=_[_0x8196('0x56')](_0x403fb5['model'],_0x403fb5[_0x8196('0x40')]);_0x135698['attributes']=_['intersection'](_0x403fb5[_0x8196('0x41')],qs[_0x8196('0x42')](_0x4b0638[_0x8196('0x40')]['fields']));_0x135698[_0x8196('0x44')]=_0x135698[_0x8196('0x44')][_0x8196('0x43')]?_0x135698[_0x8196('0x44')]:_0x403fb5[_0x8196('0x41')];if(_0x4b0638[_0x8196('0x40')][_0x8196('0x57')]){_0x135698[_0x8196('0x50')]=[{'all':!![]}];}_0x135698=_[_0x8196('0x4c')]({},_0x135698,_0x4b0638['options']);return db['Dynamics365Configuration'][_0x8196('0x58')](_0x135698)[_0x8196('0x20')](handleEntityNotFound(_0x4a9b2c,null))['then'](respondWithResult(_0x4a9b2c,null))[_0x8196('0x53')](handleError(_0x4a9b2c,null));};exports[_0x8196('0x59')]=function(_0x430594,_0x1adb71){return db[_0x8196('0x3b')][_0x8196('0x59')](_0x430594[_0x8196('0x5a')],{})[_0x8196('0x20')](respondWithResult(_0x1adb71,0xc9))['catch'](handleError(_0x1adb71,null));};exports[_0x8196('0x35')]=function(_0x5a532a,_0x2a64bb){if(_0x5a532a[_0x8196('0x5a')]['id']){delete _0x5a532a[_0x8196('0x5a')]['id'];}return db[_0x8196('0x3b')][_0x8196('0x58')]({'where':{'id':_0x5a532a[_0x8196('0x55')]['id']}})[_0x8196('0x20')](handleEntityNotFound(_0x2a64bb,null))[_0x8196('0x20')](saveUpdates(_0x5a532a[_0x8196('0x5a')],null))['then'](respondWithResult(_0x2a64bb,null))[_0x8196('0x53')](handleError(_0x2a64bb,null));};exports[_0x8196('0x5b')]=function(_0x34a591,_0x2ff59a){return db['Dynamics365Configuration'][_0x8196('0x58')]({'where':{'id':_0x34a591[_0x8196('0x55')]['id']}})['then'](handleEntityNotFound(_0x2ff59a,null))[_0x8196('0x20')](removeEntity(_0x2ff59a,null))[_0x8196('0x53')](handleError(_0x2ff59a,null));};exports[_0x8196('0x5c')]=function(_0x55de50,_0x4c58c5,_0x4ca6bd){var _0x37708d={};var _0x4abc07={};var _0x3a6987;var _0x3c9335;return db['Dynamics365Configuration'][_0x8196('0x5d')]({'where':{'id':_0x55de50[_0x8196('0x55')]['id']}})[_0x8196('0x20')](handleEntityNotFound(_0x4c58c5,null))[_0x8196('0x20')](function(_0x2ca8b0){if(_0x2ca8b0){_0x3a6987=_0x2ca8b0;_0x4abc07[_0x8196('0x41')]=_['keys'](db[_0x8196('0x5e')][_0x8196('0x3c')]);_0x4abc07[_0x8196('0x40')]=_[_0x8196('0x3f')](_0x55de50[_0x8196('0x40')]);_0x4abc07[_0x8196('0x49')]=_['intersection'](_0x4abc07[_0x8196('0x41')],_0x4abc07['query']);_0x37708d[_0x8196('0x44')]=_[_0x8196('0x56')](_0x4abc07[_0x8196('0x41')],qs[_0x8196('0x42')](_0x55de50[_0x8196('0x40')]['fields']));_0x37708d[_0x8196('0x44')]=_0x37708d[_0x8196('0x44')]['length']?_0x37708d[_0x8196('0x44')]:_0x4abc07[_0x8196('0x41')];_0x37708d[_0x8196('0x47')]=qs[_0x8196('0x48')](_0x55de50[_0x8196('0x40')][_0x8196('0x48')]);_0x37708d['where']=qs[_0x8196('0x49')](_[_0x8196('0x5f')](_0x55de50[_0x8196('0x40')],_0x4abc07[_0x8196('0x49')]));if(_0x55de50[_0x8196('0x40')]['filter']){_0x37708d[_0x8196('0x4b')]=_[_0x8196('0x4c')](_0x37708d['where'],{'$or':_[_0x8196('0x3a')](_0x37708d[_0x8196('0x44')],function(_0x248077){var _0x4965ec={};_0x4965ec[_0x248077]={'$like':'%'+_0x55de50[_0x8196('0x40')]['filter']+'%'};return _0x4965ec;})});}_0x37708d=_['merge']({},_0x37708d,_0x55de50[_0x8196('0x4e')]);return _0x3a6987[_0x8196('0x5c')](_0x37708d);}})[_0x8196('0x20')](function(_0x4d5571){if(_0x4d5571){_0x3c9335=_0x4d5571[_0x8196('0x43')];if(!_0x55de50[_0x8196('0x40')]['hasOwnProperty'](_0x8196('0x46'))){_0x37708d[_0x8196('0x2f')]=qs[_0x8196('0x2f')](_0x55de50[_0x8196('0x40')][_0x8196('0x2f')]);_0x37708d[_0x8196('0x2e')]=qs[_0x8196('0x2e')](_0x55de50[_0x8196('0x40')][_0x8196('0x2e')]);}return _0x3a6987[_0x8196('0x5c')](_0x37708d);}})[_0x8196('0x20')](function(_0x243a88){if(_0x243a88){return _0x243a88?{'count':_0x3c9335,'rows':_0x243a88}:null;}})[_0x8196('0x20')](respondWithResult(_0x4c58c5,null))[_0x8196('0x53')](handleError(_0x4c58c5,null));};exports[_0x8196('0x60')]=function(_0x517a76,_0x2223e7,_0x2fc886){var _0x1e9897={};var _0x14106b={};var _0x2621c1;var _0x370c6a;return db[_0x8196('0x3b')][_0x8196('0x5d')]({'where':{'id':_0x517a76[_0x8196('0x55')]['id']}})[_0x8196('0x20')](handleEntityNotFound(_0x2223e7,null))[_0x8196('0x20')](function(_0x445b39){if(_0x445b39){_0x2621c1=_0x445b39;_0x14106b[_0x8196('0x41')]=_[_0x8196('0x3f')](db[_0x8196('0x5e')]['rawAttributes']);_0x14106b[_0x8196('0x40')]=_[_0x8196('0x3f')](_0x517a76['query']);_0x14106b[_0x8196('0x49')]=_['intersection'](_0x14106b['model'],_0x14106b['query']);_0x1e9897[_0x8196('0x44')]=_['intersection'](_0x14106b[_0x8196('0x41')],qs[_0x8196('0x42')](_0x517a76[_0x8196('0x40')]['fields']));_0x1e9897[_0x8196('0x44')]=_0x1e9897['attributes'][_0x8196('0x43')]?_0x1e9897[_0x8196('0x44')]:_0x14106b[_0x8196('0x41')];_0x1e9897[_0x8196('0x47')]=qs[_0x8196('0x48')](_0x517a76[_0x8196('0x40')]['sort']);_0x1e9897['where']=qs['filters'](_[_0x8196('0x5f')](_0x517a76[_0x8196('0x40')],_0x14106b[_0x8196('0x49')]));if(_0x517a76[_0x8196('0x40')][_0x8196('0x4a')]){_0x1e9897[_0x8196('0x4b')]=_['merge'](_0x1e9897[_0x8196('0x4b')],{'$or':_[_0x8196('0x3a')](_0x1e9897[_0x8196('0x44')],function(_0x5e2ec0){var _0x4b7305={};_0x4b7305[_0x5e2ec0]={'$like':'%'+_0x517a76[_0x8196('0x40')][_0x8196('0x4a')]+'%'};return _0x4b7305;})});}_0x1e9897=_[_0x8196('0x4c')]({},_0x1e9897,_0x517a76[_0x8196('0x4e')]);return _0x2621c1['getSubjects'](_0x1e9897);}})[_0x8196('0x20')](function(_0x31dce2){if(_0x31dce2){_0x370c6a=_0x31dce2[_0x8196('0x43')];if(!_0x517a76[_0x8196('0x40')][_0x8196('0x45')](_0x8196('0x46'))){_0x1e9897[_0x8196('0x2f')]=qs[_0x8196('0x2f')](_0x517a76['query'][_0x8196('0x2f')]);_0x1e9897['offset']=qs[_0x8196('0x2e')](_0x517a76[_0x8196('0x40')][_0x8196('0x2e')]);}return _0x2621c1['getSubjects'](_0x1e9897);}})[_0x8196('0x20')](function(_0x342db8){if(_0x342db8){return _0x342db8?{'count':_0x370c6a,'rows':_0x342db8}:null;}})[_0x8196('0x20')](respondWithResult(_0x2223e7,null))[_0x8196('0x53')](handleError(_0x2223e7,null));};exports[_0x8196('0x61')]=function(_0x171c78,_0x44278c,_0x357bed){var _0x505456={};var _0x313bc6={};var _0x3a1784;var _0x3f48af;return db['Dynamics365Configuration'][_0x8196('0x5d')]({'where':{'id':_0x171c78[_0x8196('0x55')]['id']}})[_0x8196('0x20')](handleEntityNotFound(_0x44278c,null))['then'](function(_0x10cbe4){if(_0x10cbe4){_0x3a1784=_0x10cbe4;_0x313bc6[_0x8196('0x41')]=_[_0x8196('0x3f')](db[_0x8196('0x5e')][_0x8196('0x3c')]);_0x313bc6[_0x8196('0x40')]=_[_0x8196('0x3f')](_0x171c78[_0x8196('0x40')]);_0x313bc6[_0x8196('0x49')]=_['intersection'](_0x313bc6[_0x8196('0x41')],_0x313bc6['query']);_0x505456[_0x8196('0x44')]=_[_0x8196('0x56')](_0x313bc6[_0x8196('0x41')],qs['fields'](_0x171c78['query'][_0x8196('0x42')]));_0x505456['attributes']=_0x505456[_0x8196('0x44')][_0x8196('0x43')]?_0x505456[_0x8196('0x44')]:_0x313bc6[_0x8196('0x41')];_0x505456['order']=qs[_0x8196('0x48')](_0x171c78[_0x8196('0x40')]['sort']);_0x505456[_0x8196('0x4b')]=qs[_0x8196('0x49')](_['pick'](_0x171c78[_0x8196('0x40')],_0x313bc6[_0x8196('0x49')]));if(_0x171c78[_0x8196('0x40')][_0x8196('0x4a')]){_0x505456['where']=_['merge'](_0x505456[_0x8196('0x4b')],{'$or':_[_0x8196('0x3a')](_0x505456[_0x8196('0x44')],function(_0x332624){var _0x55ad88={};_0x55ad88[_0x332624]={'$like':'%'+_0x171c78[_0x8196('0x40')][_0x8196('0x4a')]+'%'};return _0x55ad88;})});}_0x505456=_[_0x8196('0x4c')]({},_0x505456,_0x171c78[_0x8196('0x4e')]);return _0x3a1784[_0x8196('0x61')](_0x505456);}})['then'](function(_0x26da3d){if(_0x26da3d){_0x3f48af=_0x26da3d[_0x8196('0x43')];if(!_0x171c78[_0x8196('0x40')]['hasOwnProperty'](_0x8196('0x46'))){_0x505456[_0x8196('0x2f')]=qs[_0x8196('0x2f')](_0x171c78[_0x8196('0x40')]['limit']);_0x505456[_0x8196('0x2e')]=qs[_0x8196('0x2e')](_0x171c78[_0x8196('0x40')]['offset']);}return _0x3a1784['getDescriptions'](_0x505456);}})[_0x8196('0x20')](function(_0x4dc2e3){if(_0x4dc2e3){return _0x4dc2e3?{'count':_0x3f48af,'rows':_0x4dc2e3}:null;}})['then'](respondWithResult(_0x44278c,null))[_0x8196('0x53')](handleError(_0x44278c,null));}; \ No newline at end of file +var _0xdf48=['findOne','Dynamics365Field','order','getFields','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','test','Sequelize','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','create','body','find'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xdf48,0xbf));var _0x8df4=function(_0x3bb863,_0x5b0355){_0x3bb863=_0x3bb863-0x0;var _0x1047e3=_0xdf48[_0x3bb863];return _0x1047e3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8df4('0x0'));var zipdir=require(_0x8df4('0x1'));var jsonpatch=require(_0x8df4('0x2'));var rp=require(_0x8df4('0x3'));var moment=require(_0x8df4('0x4'));var BPromise=require(_0x8df4('0x5'));var Mustache=require(_0x8df4('0x6'));var util=require(_0x8df4('0x7'));var path=require(_0x8df4('0x8'));var sox=require(_0x8df4('0x9'));var csv=require(_0x8df4('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8df4('0xb'));var crypto=require(_0x8df4('0xc'));var jsforce=require(_0x8df4('0xd'));var deskjs=require(_0x8df4('0xe'));var toCsv=require(_0x8df4('0xa'));var querystring=require(_0x8df4('0xf'));var Papa=require(_0x8df4('0x10'));var Redis=require(_0x8df4('0x11'));var authService=require(_0x8df4('0x12'));var qs=require(_0x8df4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8df4('0x14'));var logger=require(_0x8df4('0x15'))(_0x8df4('0x16'));var utils=require(_0x8df4('0x17'));var config=require('../../config/environment');var db=require(_0x8df4('0x18'))['db'];var jayson=require(_0x8df4('0x19'));var client=jayson[_0x8df4('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x4fccf0,_0x29efc5,_0x3a5480){if(_0x3a5480){var _0x49f2fe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49f2fe[_0x8df4('0x1b')](_0x29efc5)){return _0x4fccf0;}else{throw new db[(_0x8df4('0x1c'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x4fccf0;}}function respondWithRpcPromise(_0xb47659,_0x3e62be,_0x4b2a18,_0x4d0874){return new BPromise(function(_0x5ff938,_0x1ae256){var _0x18aa3f=_0x4d0874||client;return _0x18aa3f[_0x8df4('0x1d')](_0xb47659,_0x4b2a18)['then'](function(_0x16f914){logger[_0x8df4('0x1e')](_0x8df4('0x1f'),_0x3e62be,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3e62be,_0x8df4('0x20'),JSON[_0x8df4('0x21')](_0x16f914));if(_0x16f914[_0x8df4('0x22')]){if(_0x16f914[_0x8df4('0x22')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3e62be,_0x16f914[_0x8df4('0x22')]['message']);return _0x1ae256(_0x16f914[_0x8df4('0x22')][_0x8df4('0x23')]);}logger[_0x8df4('0x22')](_0x8df4('0x1f'),_0x3e62be,_0x16f914['error'][_0x8df4('0x23')]);return _0x5ff938(_0x16f914['error'][_0x8df4('0x23')]);}else{logger['info'](_0x8df4('0x1f'),_0x3e62be,_0x8df4('0x20'));_0x5ff938(_0x16f914['result'][_0x8df4('0x23')]);}})[_0x8df4('0x24')](function(_0x9e09ac){logger[_0x8df4('0x22')](_0x8df4('0x1f'),_0x3e62be,_0x9e09ac);_0x1ae256(_0x9e09ac);});});}function respondWithStatusCode(_0x3847fa,_0x1fb800){_0x1fb800=_0x1fb800||0xcc;return function(_0x2932bc){if(_0x2932bc){return _0x3847fa[_0x8df4('0x25')](_0x1fb800);}return _0x3847fa[_0x8df4('0x26')](_0x1fb800)[_0x8df4('0x27')]();};}function respondWithResult(_0x2d37bd,_0xa5bb61){_0xa5bb61=_0xa5bb61||0xc8;return function(_0x4e6b99){if(_0x4e6b99){return _0x2d37bd[_0x8df4('0x26')](_0xa5bb61)[_0x8df4('0x28')](_0x4e6b99);}};}function respondWithFilteredResult(_0x325a64,_0x42e99c){return function(_0x219dcf){if(_0x219dcf){var _0x5af829=_0x219dcf['count'],_0x1c8036=_0x42e99c[_0x8df4('0x29')],_0x58f4e2=_0x42e99c[_0x8df4('0x29')]+_0x42e99c[_0x8df4('0x2a')],_0xbe8552;if(_0x58f4e2>=_0x5af829){_0x58f4e2=_0x5af829;_0xbe8552=0xc8;}else{_0xbe8552=0xce;}_0x325a64[_0x8df4('0x26')](_0xbe8552);return _0x325a64[_0x8df4('0x2b')](_0x8df4('0x2c'),_0x1c8036+'-'+_0x58f4e2+'/'+_0x5af829)[_0x8df4('0x28')](_0x219dcf);}return null;};}function patchUpdates(_0x1ea1b8){return function(_0x34349f){try{jsonpatch[_0x8df4('0x2d')](_0x34349f,_0x1ea1b8,!![]);}catch(_0x314fea){return BPromise[_0x8df4('0x2e')](_0x314fea);}return _0x34349f[_0x8df4('0x2f')]();};}function saveUpdates(_0x531ee0,_0x1f6a34){return function(_0x9052cd){if(_0x9052cd){return _0x9052cd[_0x8df4('0x30')](_0x531ee0)[_0x8df4('0x31')](function(_0x3c53e9){return _0x3c53e9;});}return null;};}function removeEntity(_0x540829,_0x1a1dbb){return function(_0x358aa2){if(_0x358aa2){return _0x358aa2[_0x8df4('0x32')]()[_0x8df4('0x31')](function(){_0x540829[_0x8df4('0x26')](0xcc)[_0x8df4('0x27')]();});}};}function handleEntityNotFound(_0x230f8a,_0x421303){return function(_0xd0593d){if(!_0xd0593d){_0x230f8a[_0x8df4('0x25')](0x194);}return _0xd0593d;};}function handleError(_0x1c532a,_0x25b1ab){_0x25b1ab=_0x25b1ab||0x1f4;return function(_0x1c927c){logger[_0x8df4('0x22')](_0x1c927c[_0x8df4('0x33')]);if(_0x1c927c[_0x8df4('0x34')]){delete _0x1c927c['name'];}_0x1c532a[_0x8df4('0x26')](_0x25b1ab)[_0x8df4('0x35')](_0x1c927c);};}exports[_0x8df4('0x36')]=function(_0x1f77f8,_0x597cf8){var _0x5d7726={},_0x39f6fd={},_0x12a7b6={'count':0x0,'rows':[]};var _0xdf59d8=_[_0x8df4('0x37')](db[_0x8df4('0x38')][_0x8df4('0x39')],function(_0x3e0bf2){return{'name':_0x3e0bf2['fieldName'],'type':_0x3e0bf2[_0x8df4('0x3a')]['key']};});_0x39f6fd[_0x8df4('0x3b')]=_[_0x8df4('0x37')](_0xdf59d8,_0x8df4('0x34'));_0x39f6fd['query']=_['keys'](_0x1f77f8[_0x8df4('0x3c')]);_0x39f6fd[_0x8df4('0x3d')]=_[_0x8df4('0x3e')](_0x39f6fd[_0x8df4('0x3b')],_0x39f6fd[_0x8df4('0x3c')]);_0x5d7726[_0x8df4('0x3f')]=_['intersection'](_0x39f6fd[_0x8df4('0x3b')],qs[_0x8df4('0x40')](_0x1f77f8[_0x8df4('0x3c')][_0x8df4('0x40')]));_0x5d7726[_0x8df4('0x3f')]=_0x5d7726[_0x8df4('0x3f')][_0x8df4('0x41')]?_0x5d7726[_0x8df4('0x3f')]:_0x39f6fd[_0x8df4('0x3b')];if(!_0x1f77f8['query'][_0x8df4('0x42')]('nolimit')){_0x5d7726['limit']=qs[_0x8df4('0x2a')](_0x1f77f8[_0x8df4('0x3c')]['limit']);_0x5d7726[_0x8df4('0x29')]=qs[_0x8df4('0x29')](_0x1f77f8[_0x8df4('0x3c')]['offset']);}_0x5d7726['order']=qs[_0x8df4('0x43')](_0x1f77f8['query']['sort']);_0x5d7726[_0x8df4('0x44')]=qs['filters'](_[_0x8df4('0x45')](_0x1f77f8['query'],_0x39f6fd[_0x8df4('0x3d')]),_0xdf59d8);if(_0x1f77f8['query'][_0x8df4('0x46')]){_0x5d7726[_0x8df4('0x44')]=_[_0x8df4('0x47')](_0x5d7726['where'],{'$or':_[_0x8df4('0x37')](_0xdf59d8,function(_0x146e37){if(_0x146e37[_0x8df4('0x3a')]!==_0x8df4('0x48')){var _0x16d5e4={};_0x16d5e4[_0x146e37['name']]={'$like':'%'+_0x1f77f8[_0x8df4('0x3c')][_0x8df4('0x46')]+'%'};return _0x16d5e4;}})});}_0x5d7726=_[_0x8df4('0x47')]({},_0x5d7726,_0x1f77f8[_0x8df4('0x49')]);var _0x269eab={'where':_0x5d7726[_0x8df4('0x44')]};return db['Dynamics365Configuration'][_0x8df4('0x4a')](_0x269eab)[_0x8df4('0x31')](function(_0x4088ef){_0x12a7b6['count']=_0x4088ef;if(_0x1f77f8[_0x8df4('0x3c')][_0x8df4('0x4b')]){_0x5d7726[_0x8df4('0x4c')]=[{'all':!![]}];}return db[_0x8df4('0x38')][_0x8df4('0x4d')](_0x5d7726);})[_0x8df4('0x31')](function(_0x5df2b3){_0x12a7b6[_0x8df4('0x4e')]=_0x5df2b3;return _0x12a7b6;})[_0x8df4('0x31')](respondWithFilteredResult(_0x597cf8,_0x5d7726))[_0x8df4('0x24')](handleError(_0x597cf8,null));};exports[_0x8df4('0x4f')]=function(_0x12016b,_0x457350){var _0x54ef36={'raw':![],'where':{'id':_0x12016b[_0x8df4('0x50')]['id']}},_0x3e51c8={};_0x3e51c8['model']=_['keys'](db[_0x8df4('0x38')][_0x8df4('0x39')]);_0x3e51c8[_0x8df4('0x3c')]=_[_0x8df4('0x51')](_0x12016b['query']);_0x3e51c8[_0x8df4('0x3d')]=_[_0x8df4('0x3e')](_0x3e51c8[_0x8df4('0x3b')],_0x3e51c8[_0x8df4('0x3c')]);_0x54ef36['attributes']=_[_0x8df4('0x3e')](_0x3e51c8[_0x8df4('0x3b')],qs[_0x8df4('0x40')](_0x12016b[_0x8df4('0x3c')][_0x8df4('0x40')]));_0x54ef36[_0x8df4('0x3f')]=_0x54ef36[_0x8df4('0x3f')][_0x8df4('0x41')]?_0x54ef36[_0x8df4('0x3f')]:_0x3e51c8['model'];if(_0x12016b[_0x8df4('0x3c')][_0x8df4('0x4b')]){_0x54ef36[_0x8df4('0x4c')]=[{'all':!![]}];}_0x54ef36=_['merge']({},_0x54ef36,_0x12016b[_0x8df4('0x49')]);return db[_0x8df4('0x38')]['find'](_0x54ef36)[_0x8df4('0x31')](handleEntityNotFound(_0x457350,null))['then'](respondWithResult(_0x457350,null))[_0x8df4('0x24')](handleError(_0x457350,null));};exports[_0x8df4('0x52')]=function(_0x5bba35,_0x2b455f){return db[_0x8df4('0x38')][_0x8df4('0x52')](_0x5bba35['body'],{})[_0x8df4('0x31')](respondWithResult(_0x2b455f,0xc9))[_0x8df4('0x24')](handleError(_0x2b455f,null));};exports[_0x8df4('0x30')]=function(_0x255621,_0x1744e9){if(_0x255621[_0x8df4('0x53')]['id']){delete _0x255621['body']['id'];}return db['Dynamics365Configuration'][_0x8df4('0x54')]({'where':{'id':_0x255621[_0x8df4('0x50')]['id']}})[_0x8df4('0x31')](handleEntityNotFound(_0x1744e9,null))['then'](saveUpdates(_0x255621['body'],null))[_0x8df4('0x31')](respondWithResult(_0x1744e9,null))[_0x8df4('0x24')](handleError(_0x1744e9,null));};exports[_0x8df4('0x32')]=function(_0x982c49,_0x63f2e4){return db[_0x8df4('0x38')]['find']({'where':{'id':_0x982c49[_0x8df4('0x50')]['id']}})[_0x8df4('0x31')](handleEntityNotFound(_0x63f2e4,null))[_0x8df4('0x31')](removeEntity(_0x63f2e4,null))[_0x8df4('0x24')](handleError(_0x63f2e4,null));};exports['getFields']=function(_0x1f64f3,_0x5cf21a,_0xbc2b06){var _0x26450a={};var _0x4ae106={};var _0x112aa9;var _0x215b78;return db[_0x8df4('0x38')][_0x8df4('0x55')]({'where':{'id':_0x1f64f3[_0x8df4('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cf21a,null))[_0x8df4('0x31')](function(_0x2f164d){if(_0x2f164d){_0x112aa9=_0x2f164d;_0x4ae106[_0x8df4('0x3b')]=_['keys'](db[_0x8df4('0x56')][_0x8df4('0x39')]);_0x4ae106['query']=_[_0x8df4('0x51')](_0x1f64f3[_0x8df4('0x3c')]);_0x4ae106['filters']=_[_0x8df4('0x3e')](_0x4ae106['model'],_0x4ae106['query']);_0x26450a[_0x8df4('0x3f')]=_[_0x8df4('0x3e')](_0x4ae106[_0x8df4('0x3b')],qs[_0x8df4('0x40')](_0x1f64f3['query']['fields']));_0x26450a['attributes']=_0x26450a[_0x8df4('0x3f')]['length']?_0x26450a[_0x8df4('0x3f')]:_0x4ae106[_0x8df4('0x3b')];_0x26450a[_0x8df4('0x57')]=qs[_0x8df4('0x43')](_0x1f64f3[_0x8df4('0x3c')][_0x8df4('0x43')]);_0x26450a[_0x8df4('0x44')]=qs[_0x8df4('0x3d')](_[_0x8df4('0x45')](_0x1f64f3[_0x8df4('0x3c')],_0x4ae106[_0x8df4('0x3d')]));if(_0x1f64f3[_0x8df4('0x3c')][_0x8df4('0x46')]){_0x26450a[_0x8df4('0x44')]=_[_0x8df4('0x47')](_0x26450a[_0x8df4('0x44')],{'$or':_[_0x8df4('0x37')](_0x26450a[_0x8df4('0x3f')],function(_0x1ab0fe){var _0x52be9f={};_0x52be9f[_0x1ab0fe]={'$like':'%'+_0x1f64f3[_0x8df4('0x3c')]['filter']+'%'};return _0x52be9f;})});}_0x26450a=_['merge']({},_0x26450a,_0x1f64f3['options']);return _0x112aa9[_0x8df4('0x58')](_0x26450a);}})[_0x8df4('0x31')](function(_0x560ced){if(_0x560ced){_0x215b78=_0x560ced[_0x8df4('0x41')];if(!_0x1f64f3['query']['hasOwnProperty'](_0x8df4('0x59'))){_0x26450a['limit']=qs['limit'](_0x1f64f3[_0x8df4('0x3c')][_0x8df4('0x2a')]);_0x26450a[_0x8df4('0x29')]=qs['offset'](_0x1f64f3['query']['offset']);}return _0x112aa9['getFields'](_0x26450a);}})[_0x8df4('0x31')](function(_0x535b6c){if(_0x535b6c){return _0x535b6c?{'count':_0x215b78,'rows':_0x535b6c}:null;}})[_0x8df4('0x31')](respondWithResult(_0x5cf21a,null))[_0x8df4('0x24')](handleError(_0x5cf21a,null));};exports['getSubjects']=function(_0x18fa6b,_0xc1a782,_0x38af23){var _0x42fe00={};var _0xc0151d={};var _0x425ad9;var _0x3bc6f3;return db[_0x8df4('0x38')][_0x8df4('0x55')]({'where':{'id':_0x18fa6b[_0x8df4('0x50')]['id']}})[_0x8df4('0x31')](handleEntityNotFound(_0xc1a782,null))[_0x8df4('0x31')](function(_0x3eb815){if(_0x3eb815){_0x425ad9=_0x3eb815;_0xc0151d[_0x8df4('0x3b')]=_['keys'](db['Dynamics365Field'][_0x8df4('0x39')]);_0xc0151d[_0x8df4('0x3c')]=_[_0x8df4('0x51')](_0x18fa6b[_0x8df4('0x3c')]);_0xc0151d[_0x8df4('0x3d')]=_[_0x8df4('0x3e')](_0xc0151d[_0x8df4('0x3b')],_0xc0151d['query']);_0x42fe00[_0x8df4('0x3f')]=_[_0x8df4('0x3e')](_0xc0151d[_0x8df4('0x3b')],qs['fields'](_0x18fa6b[_0x8df4('0x3c')][_0x8df4('0x40')]));_0x42fe00[_0x8df4('0x3f')]=_0x42fe00[_0x8df4('0x3f')][_0x8df4('0x41')]?_0x42fe00[_0x8df4('0x3f')]:_0xc0151d[_0x8df4('0x3b')];_0x42fe00[_0x8df4('0x57')]=qs['sort'](_0x18fa6b['query'][_0x8df4('0x43')]);_0x42fe00[_0x8df4('0x44')]=qs[_0x8df4('0x3d')](_[_0x8df4('0x45')](_0x18fa6b['query'],_0xc0151d[_0x8df4('0x3d')]));if(_0x18fa6b[_0x8df4('0x3c')][_0x8df4('0x46')]){_0x42fe00['where']=_[_0x8df4('0x47')](_0x42fe00[_0x8df4('0x44')],{'$or':_[_0x8df4('0x37')](_0x42fe00['attributes'],function(_0x104c65){var _0x3b0069={};_0x3b0069[_0x104c65]={'$like':'%'+_0x18fa6b[_0x8df4('0x3c')][_0x8df4('0x46')]+'%'};return _0x3b0069;})});}_0x42fe00=_[_0x8df4('0x47')]({},_0x42fe00,_0x18fa6b[_0x8df4('0x49')]);return _0x425ad9[_0x8df4('0x5a')](_0x42fe00);}})[_0x8df4('0x31')](function(_0x2d3197){if(_0x2d3197){_0x3bc6f3=_0x2d3197[_0x8df4('0x41')];if(!_0x18fa6b[_0x8df4('0x3c')][_0x8df4('0x42')](_0x8df4('0x59'))){_0x42fe00[_0x8df4('0x2a')]=qs[_0x8df4('0x2a')](_0x18fa6b[_0x8df4('0x3c')][_0x8df4('0x2a')]);_0x42fe00[_0x8df4('0x29')]=qs['offset'](_0x18fa6b[_0x8df4('0x3c')]['offset']);}return _0x425ad9[_0x8df4('0x5a')](_0x42fe00);}})[_0x8df4('0x31')](function(_0x1553a7){if(_0x1553a7){return _0x1553a7?{'count':_0x3bc6f3,'rows':_0x1553a7}:null;}})[_0x8df4('0x31')](respondWithResult(_0xc1a782,null))['catch'](handleError(_0xc1a782,null));};exports['getDescriptions']=function(_0x343fae,_0x2cfb1d,_0x18a699){var _0x16a906={};var _0x22408a={};var _0x3f2d9f;var _0x1278e9;return db[_0x8df4('0x38')]['findOne']({'where':{'id':_0x343fae[_0x8df4('0x50')]['id']}})['then'](handleEntityNotFound(_0x2cfb1d,null))[_0x8df4('0x31')](function(_0x5395d1){if(_0x5395d1){_0x3f2d9f=_0x5395d1;_0x22408a['model']=_['keys'](db[_0x8df4('0x56')][_0x8df4('0x39')]);_0x22408a[_0x8df4('0x3c')]=_[_0x8df4('0x51')](_0x343fae[_0x8df4('0x3c')]);_0x22408a[_0x8df4('0x3d')]=_['intersection'](_0x22408a[_0x8df4('0x3b')],_0x22408a['query']);_0x16a906[_0x8df4('0x3f')]=_[_0x8df4('0x3e')](_0x22408a['model'],qs[_0x8df4('0x40')](_0x343fae[_0x8df4('0x3c')][_0x8df4('0x40')]));_0x16a906['attributes']=_0x16a906[_0x8df4('0x3f')][_0x8df4('0x41')]?_0x16a906['attributes']:_0x22408a['model'];_0x16a906[_0x8df4('0x57')]=qs[_0x8df4('0x43')](_0x343fae[_0x8df4('0x3c')]['sort']);_0x16a906[_0x8df4('0x44')]=qs['filters'](_[_0x8df4('0x45')](_0x343fae[_0x8df4('0x3c')],_0x22408a[_0x8df4('0x3d')]));if(_0x343fae[_0x8df4('0x3c')][_0x8df4('0x46')]){_0x16a906[_0x8df4('0x44')]=_[_0x8df4('0x47')](_0x16a906[_0x8df4('0x44')],{'$or':_['map'](_0x16a906[_0x8df4('0x3f')],function(_0x1e4692){var _0x5d70aa={};_0x5d70aa[_0x1e4692]={'$like':'%'+_0x343fae[_0x8df4('0x3c')]['filter']+'%'};return _0x5d70aa;})});}_0x16a906=_[_0x8df4('0x47')]({},_0x16a906,_0x343fae[_0x8df4('0x49')]);return _0x3f2d9f[_0x8df4('0x5b')](_0x16a906);}})[_0x8df4('0x31')](function(_0x666385){if(_0x666385){_0x1278e9=_0x666385[_0x8df4('0x41')];if(!_0x343fae[_0x8df4('0x3c')][_0x8df4('0x42')]('nolimit')){_0x16a906['limit']=qs[_0x8df4('0x2a')](_0x343fae[_0x8df4('0x3c')][_0x8df4('0x2a')]);_0x16a906[_0x8df4('0x29')]=qs[_0x8df4('0x29')](_0x343fae[_0x8df4('0x3c')][_0x8df4('0x29')]);}return _0x3f2d9f[_0x8df4('0x5b')](_0x16a906);}})[_0x8df4('0x31')](function(_0x3287b3){if(_0x3287b3){return _0x3287b3?{'count':_0x1278e9,'rows':_0x3287b3}:null;}})[_0x8df4('0x31')](respondWithResult(_0x2cfb1d,null))[_0x8df4('0x24')](handleError(_0x2cfb1d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1fe3ab2..1266a65 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 _0xbfc1=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbfc1,0x155));var _0x1bfc=function(_0x4f49e8,_0x466e6f){_0x4f49e8=_0x4f49e8-0x0;var _0x4d5967=_0xbfc1[_0x4f49e8];return _0x4d5967;};'use strict';var _=require(_0x1bfc('0x0'));var util=require(_0x1bfc('0x1'));var logger=require(_0x1bfc('0x2'))(_0x1bfc('0x3'));var moment=require(_0x1bfc('0x4'));var BPromise=require(_0x1bfc('0x5'));var rp=require(_0x1bfc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1bfc('0x7'));var config=require(_0x1bfc('0x8'));var attributes=require(_0x1bfc('0x9'));module['exports']=function(_0x251d5f,_0x112868){return _0x251d5f[_0x1bfc('0xa')](_0x1bfc('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdef0=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xfab9a0,_0x4c7203){var _0x3a0808=function(_0x4d2138){while(--_0x4d2138){_0xfab9a0['push'](_0xfab9a0['shift']());}};_0x3a0808(++_0x4c7203);}(_0xdef0,0x14f));var _0x0def=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdef0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0def('0x0'));var util=require(_0x0def('0x1'));var logger=require(_0x0def('0x2'))(_0x0def('0x3'));var moment=require('moment');var BPromise=require(_0x0def('0x4'));var rp=require(_0x0def('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0def('0x6'));var config=require(_0x0def('0x7'));var attributes=require(_0x0def('0x8'));module['exports']=function(_0x4161a8,_0x250ff9){return _0x4161a8['define'](_0x0def('0x9'),attributes,{'tableName':_0x0def('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index f91f72a..cd91476 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 _0xde90=['http','request','then','info','request\x20sent','debug','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x53d6b5,_0x2eddc2){var _0x112f51=function(_0x4c53dd){while(--_0x4c53dd){_0x53d6b5['push'](_0x53d6b5['shift']());}};_0x112f51(++_0x2eddc2);}(_0xde90,0x170));var _0x0de9=function(_0x1ccda4,_0x1647d3){_0x1ccda4=_0x1ccda4-0x0;var _0x334196=_0xde90[_0x1ccda4];return _0x334196;};'use strict';var _=require(_0x0de9('0x0'));var util=require(_0x0de9('0x1'));var moment=require(_0x0de9('0x2'));var BPromise=require('bluebird');var rs=require(_0x0de9('0x3'));var fs=require('fs');var Redis=require(_0x0de9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0de9('0x5'))(_0x0de9('0x6'));var config=require(_0x0de9('0x7'));var jayson=require(_0x0de9('0x8'));var client=jayson[_0x0de9('0x9')][_0x0de9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b3bc,_0x15cd83,_0x280e3a){return new BPromise(function(_0xc8ef5a,_0x2512be){return client[_0x0de9('0xb')](_0x1b3bc,_0x280e3a)[_0x0de9('0xc')](function(_0xda9528){logger[_0x0de9('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x15cd83,_0x0de9('0xe'));logger[_0x0de9('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x15cd83,_0x0de9('0xe'),JSON[_0x0de9('0x10')](_0xda9528));if(_0xda9528[_0x0de9('0x11')]){if(_0xda9528[_0x0de9('0x11')]['code']===0x1f4){logger[_0x0de9('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x15cd83,_0xda9528['error'][_0x0de9('0x12')]);return _0x2512be(_0xda9528[_0x0de9('0x11')]['message']);}logger[_0x0de9('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x15cd83,_0xda9528['error'][_0x0de9('0x12')]);return _0xc8ef5a(_0xda9528['error'][_0x0de9('0x12')]);}else{logger[_0x0de9('0xd')](_0x0de9('0x13'),_0x15cd83,'request\x20sent');_0xc8ef5a(_0xda9528['result'][_0x0de9('0x12')]);}})[_0x0de9('0x14')](function(_0x532823){logger['error'](_0x0de9('0x13'),_0x15cd83,_0x532823);_0x2512be(_0x532823);});});} \ No newline at end of file +var _0x14da=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','client','http','request','then','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info'];(function(_0x3ab063,_0x466339){var _0x33086d=function(_0x549e99){while(--_0x549e99){_0x3ab063['push'](_0x3ab063['shift']());}};_0x33086d(++_0x466339);}(_0x14da,0x16a));var _0xa14d=function(_0x2af353,_0x418430){_0x2af353=_0x2af353-0x0;var _0x3f3f4e=_0x14da[_0x2af353];return _0x3f3f4e;};'use strict';var _=require(_0xa14d('0x0'));var util=require(_0xa14d('0x1'));var moment=require(_0xa14d('0x2'));var BPromise=require(_0xa14d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa14d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa14d('0x5'));var logger=require(_0xa14d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa14d('0x7')][_0xa14d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x153601,_0x301cfa,_0x2dd474){return new BPromise(function(_0x3f1c38,_0x13c56a){return client[_0xa14d('0x9')](_0x153601,_0x2dd474)[_0xa14d('0xa')](function(_0x4e9db4){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x301cfa,_0xa14d('0xb'));logger['debug'](_0xa14d('0xc'),_0x301cfa,_0xa14d('0xb'),JSON['stringify'](_0x4e9db4));if(_0x4e9db4[_0xa14d('0xd')]){if(_0x4e9db4[_0xa14d('0xd')][_0xa14d('0xe')]===0x1f4){logger[_0xa14d('0xd')](_0xa14d('0xf'),_0x301cfa,_0x4e9db4[_0xa14d('0xd')][_0xa14d('0x10')]);return _0x13c56a(_0x4e9db4[_0xa14d('0xd')]['message']);}logger[_0xa14d('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x301cfa,_0x4e9db4[_0xa14d('0xd')][_0xa14d('0x10')]);return _0x3f1c38(_0x4e9db4[_0xa14d('0xd')][_0xa14d('0x10')]);}else{logger[_0xa14d('0x11')](_0xa14d('0xf'),_0x301cfa,_0xa14d('0xb'));_0x3f1c38(_0x4e9db4[_0xa14d('0x12')][_0xa14d('0x10')]);}})[_0xa14d('0x13')](function(_0x170a3a){logger[_0xa14d('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x301cfa,_0x170a3a);_0x13c56a(_0x170a3a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 84e5546..c38d10f 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 _0x5db8=['../../components/auth/service','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','put','update','delete','/:id','multer','util','path','express','Router'];(function(_0x62a18e,_0x420fd2){var _0x58845d=function(_0x3f8f33){while(--_0x3f8f33){_0x62a18e['push'](_0x62a18e['shift']());}};_0x58845d(++_0x420fd2);}(_0x5db8,0xbb));var _0x85db=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x5db8[_0x15e6fe];return _0x34894d;};'use strict';var multer=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var timeout=require('connect-timeout');var express=require(_0x85db('0x3'));var router=express[_0x85db('0x4')]();var auth=require(_0x85db('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x85db('0x6'));router[_0x85db('0x7')]('/',auth[_0x85db('0x8')](),controller[_0x85db('0x9')]);router['get']('/:id',auth[_0x85db('0x8')](),controller[_0x85db('0xa')]);router[_0x85db('0xb')]('/',auth[_0x85db('0x8')](),controller['create']);router[_0x85db('0xc')]('/:id',auth[_0x85db('0x8')](),controller[_0x85db('0xd')]);router[_0x85db('0xe')](_0x85db('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2121=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2121,0x1b4));var _0x1212=function(_0x48ef94,_0x1a3273){_0x48ef94=_0x48ef94-0x0;var _0x5cb145=_0x2121[_0x48ef94];return _0x5cb145;};'use strict';var multer=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1212('0x2'));var router=express[_0x1212('0x3')]();var auth=require(_0x1212('0x4'));var interaction=require(_0x1212('0x5'));var config=require(_0x1212('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x1212('0x7')]('/',auth['isAuthenticated'](),controller[_0x1212('0x8')]);router[_0x1212('0x7')](_0x1212('0x9'),auth[_0x1212('0xa')](),controller[_0x1212('0xb')]);router[_0x1212('0xc')]('/',auth['isAuthenticated'](),controller[_0x1212('0xd')]);router[_0x1212('0xe')](_0x1212('0x9'),auth[_0x1212('0xa')](),controller[_0x1212('0xf')]);router[_0x1212('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1212('0x11')]);module[_0x1212('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 ffa3579..5eaba75 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 _0x6720=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x5d0f3d,_0x51bdee){var _0x45e0f8=function(_0x3b402c){while(--_0x3b402c){_0x5d0f3d['push'](_0x5d0f3d['shift']());}};_0x45e0f8(++_0x51bdee);}(_0x6720,0x114));var _0x0672=function(_0x2dc46c,_0x35a454){_0x2dc46c=_0x2dc46c-0x0;var _0x222234=_0x6720[_0x2dc46c];return _0x222234;};'use strict';var Sequelize=require(_0x0672('0x0'));module[_0x0672('0x1')]={'type':{'type':Sequelize[_0x0672('0x2')](_0x0672('0x3'),_0x0672('0x4'),'customVariable',_0x0672('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0672('0x6')]},'key':{'type':Sequelize[_0x0672('0x6')]},'keyType':{'type':Sequelize[_0x0672('0x2')](_0x0672('0x3'),_0x0672('0x4'),_0x0672('0x7'))},'keyContent':{'type':Sequelize[_0x0672('0x6')]},'idField':{'type':Sequelize[_0x0672('0x6')]},'nameField':{'type':Sequelize[_0x0672('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0672('0x6')]}}; \ No newline at end of file +var _0xf969=['STRING','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','string'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf969,0x13a));var _0x9f96=function(_0x28ff9b,_0x47fa28){_0x28ff9b=_0x28ff9b-0x0;var _0xb460c9=_0xf969[_0x28ff9b];return _0xb460c9;};'use strict';var Sequelize=require(_0x9f96('0x0'));module[_0x9f96('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x9f96('0x2'),_0x9f96('0x3'),_0x9f96('0x4')),'defaultValue':_0x9f96('0x5')},'content':{'type':Sequelize[_0x9f96('0x6')]},'key':{'type':Sequelize[_0x9f96('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x9f96('0x5'),_0x9f96('0x2'),_0x9f96('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9f96('0x6')]},'nameField':{'type':Sequelize[_0x9f96('0x6')]},'customField':{'type':Sequelize[_0x9f96('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f96('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b0da4f1..6966640 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 _0x1858=['update','then','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject'];(function(_0x46086c,_0x2f02d9){var _0x311f8c=function(_0x3ec8e3){while(--_0x3ec8e3){_0x46086c['push'](_0x46086c['shift']());}};_0x311f8c(++_0x2f02d9);}(_0x1858,0x184));var _0x8185=function(_0x5bf080,_0x59353c){_0x5bf080=_0x5bf080-0x0;var _0x4da824=_0x1858[_0x5bf080];return _0x4da824;};'use strict';var pdf=require(_0x8185('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8185('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8185('0x2'));var rp=require(_0x8185('0x3'));var moment=require('moment');var BPromise=require(_0x8185('0x4'));var Mustache=require(_0x8185('0x5'));var util=require(_0x8185('0x6'));var path=require(_0x8185('0x7'));var sox=require('sox');var csv=require(_0x8185('0x8'));var ejs=require(_0x8185('0x9'));var fs=require('fs');var _=require(_0x8185('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8185('0xb'));var deskjs=require(_0x8185('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8185('0xd'));var Papa=require('papaparse');var Redis=require(_0x8185('0xe'));var authService=require(_0x8185('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8185('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8185('0x11'))(_0x8185('0x12'));var utils=require(_0x8185('0x13'));var config=require(_0x8185('0x14'));var db=require(_0x8185('0x15'))['db'];function respondWithStatusCode(_0x5cc626,_0x15eeff){_0x15eeff=_0x15eeff||0xcc;return function(_0x21cad4){if(_0x21cad4){return _0x5cc626[_0x8185('0x16')](_0x15eeff);}return _0x5cc626[_0x8185('0x17')](_0x15eeff)[_0x8185('0x18')]();};}function respondWithResult(_0x42ed6b,_0x5443b0){_0x5443b0=_0x5443b0||0xc8;return function(_0x3d7a85){if(_0x3d7a85){return _0x42ed6b[_0x8185('0x17')](_0x5443b0)[_0x8185('0x19')](_0x3d7a85);}};}function respondWithFilteredResult(_0x3782ca,_0x51e76d){return function(_0x245e52){if(_0x245e52){var _0x14dcb5=_0x245e52[_0x8185('0x1a')],_0x5298ac=_0x51e76d[_0x8185('0x1b')],_0x1c8464=_0x51e76d['offset']+_0x51e76d[_0x8185('0x1c')],_0x310f80;if(_0x1c8464>=_0x14dcb5){_0x1c8464=_0x14dcb5;_0x310f80=0xc8;}else{_0x310f80=0xce;}_0x3782ca[_0x8185('0x17')](_0x310f80);return _0x3782ca[_0x8185('0x1d')](_0x8185('0x1e'),_0x5298ac+'-'+_0x1c8464+'/'+_0x14dcb5)[_0x8185('0x19')](_0x245e52);}return null;};}function patchUpdates(_0x57b374){return function(_0xb5490e){try{jsonpatch['apply'](_0xb5490e,_0x57b374,!![]);}catch(_0x345b91){return BPromise[_0x8185('0x1f')](_0x345b91);}return _0xb5490e['save']();};}function saveUpdates(_0x36c315,_0x3a7f03){return function(_0x2de97a){if(_0x2de97a){return _0x2de97a[_0x8185('0x20')](_0x36c315)[_0x8185('0x21')](function(_0x3234da){return _0x3234da;});}return null;};}function removeEntity(_0x82ea2a,_0x1b089b){return function(_0x398b91){if(_0x398b91){return _0x398b91['destroy']()[_0x8185('0x21')](function(){_0x82ea2a['status'](0xcc)[_0x8185('0x18')]();});}};}function handleEntityNotFound(_0x48e994,_0x50b269){return function(_0x104bbc){if(!_0x104bbc){_0x48e994['sendStatus'](0x194);}return _0x104bbc;};}function handleError(_0x41b7ae,_0x4f5efd){_0x4f5efd=_0x4f5efd||0x1f4;return function(_0x17b1bc){logger[_0x8185('0x22')](_0x17b1bc[_0x8185('0x23')]);if(_0x17b1bc[_0x8185('0x24')]){delete _0x17b1bc[_0x8185('0x24')];}_0x41b7ae[_0x8185('0x17')](_0x4f5efd)[_0x8185('0x25')](_0x17b1bc);};}exports['index']=function(_0x4d3b32,_0x5de64e){var _0x4ef0aa={},_0x49aa31={},_0x62e0e8={'count':0x0,'rows':[]};var _0xb16944=_[_0x8185('0x26')](db[_0x8185('0x27')][_0x8185('0x28')],function(_0x51a15d){return{'name':_0x51a15d[_0x8185('0x29')],'type':_0x51a15d[_0x8185('0x2a')]['key']};});_0x49aa31[_0x8185('0x2b')]=_[_0x8185('0x26')](_0xb16944,'name');_0x49aa31[_0x8185('0x2c')]=_[_0x8185('0x2d')](_0x4d3b32[_0x8185('0x2c')]);_0x49aa31[_0x8185('0x2e')]=_[_0x8185('0x2f')](_0x49aa31[_0x8185('0x2b')],_0x49aa31[_0x8185('0x2c')]);_0x4ef0aa[_0x8185('0x30')]=_[_0x8185('0x2f')](_0x49aa31[_0x8185('0x2b')],qs['fields'](_0x4d3b32[_0x8185('0x2c')][_0x8185('0x31')]));_0x4ef0aa[_0x8185('0x30')]=_0x4ef0aa['attributes'][_0x8185('0x32')]?_0x4ef0aa[_0x8185('0x30')]:_0x49aa31['model'];if(!_0x4d3b32[_0x8185('0x2c')][_0x8185('0x33')](_0x8185('0x34'))){_0x4ef0aa[_0x8185('0x1c')]=qs[_0x8185('0x1c')](_0x4d3b32['query']['limit']);_0x4ef0aa[_0x8185('0x1b')]=qs['offset'](_0x4d3b32['query']['offset']);}_0x4ef0aa['order']=qs['sort'](_0x4d3b32[_0x8185('0x2c')][_0x8185('0x35')]);_0x4ef0aa['where']=qs['filters'](_[_0x8185('0x36')](_0x4d3b32[_0x8185('0x2c')],_0x49aa31['filters']),_0xb16944);if(_0x4d3b32[_0x8185('0x2c')][_0x8185('0x37')]){_0x4ef0aa[_0x8185('0x38')]=_[_0x8185('0x39')](_0x4ef0aa[_0x8185('0x38')],{'$or':_[_0x8185('0x26')](_0xb16944,function(_0x46d4a0){if(_0x46d4a0[_0x8185('0x2a')]!=='VIRTUAL'){var _0x284bf6={};_0x284bf6[_0x46d4a0[_0x8185('0x24')]]={'$like':'%'+_0x4d3b32[_0x8185('0x2c')][_0x8185('0x37')]+'%'};return _0x284bf6;}})});}_0x4ef0aa=_[_0x8185('0x39')]({},_0x4ef0aa,_0x4d3b32[_0x8185('0x3a')]);var _0x5c36f6={'where':_0x4ef0aa[_0x8185('0x38')]};return db['Dynamics365Field']['count'](_0x5c36f6)[_0x8185('0x21')](function(_0x5762df){_0x62e0e8[_0x8185('0x1a')]=_0x5762df;if(_0x4d3b32[_0x8185('0x2c')][_0x8185('0x3b')]){_0x4ef0aa['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x8185('0x3c')](_0x4ef0aa);})[_0x8185('0x21')](function(_0x2df748){_0x62e0e8[_0x8185('0x3d')]=_0x2df748;return _0x62e0e8;})[_0x8185('0x21')](respondWithFilteredResult(_0x5de64e,_0x4ef0aa))[_0x8185('0x3e')](handleError(_0x5de64e,null));};exports[_0x8185('0x3f')]=function(_0x1a7831,_0x1655a6){var _0x488759={'raw':!![],'where':{'id':_0x1a7831[_0x8185('0x40')]['id']}},_0x436c7e={};_0x436c7e[_0x8185('0x2b')]=_['keys'](db[_0x8185('0x27')]['rawAttributes']);_0x436c7e[_0x8185('0x2c')]=_['keys'](_0x1a7831[_0x8185('0x2c')]);_0x436c7e[_0x8185('0x2e')]=_['intersection'](_0x436c7e[_0x8185('0x2b')],_0x436c7e['query']);_0x488759[_0x8185('0x30')]=_[_0x8185('0x2f')](_0x436c7e[_0x8185('0x2b')],qs[_0x8185('0x31')](_0x1a7831[_0x8185('0x2c')][_0x8185('0x31')]));_0x488759[_0x8185('0x30')]=_0x488759[_0x8185('0x30')][_0x8185('0x32')]?_0x488759[_0x8185('0x30')]:_0x436c7e[_0x8185('0x2b')];if(_0x1a7831[_0x8185('0x2c')]['includeAll']){_0x488759[_0x8185('0x41')]=[{'all':!![]}];}_0x488759=_['merge']({},_0x488759,_0x1a7831[_0x8185('0x3a')]);return db[_0x8185('0x27')]['find'](_0x488759)[_0x8185('0x21')](handleEntityNotFound(_0x1655a6,null))[_0x8185('0x21')](respondWithResult(_0x1655a6,null))[_0x8185('0x3e')](handleError(_0x1655a6,null));};exports[_0x8185('0x42')]=function(_0x22a363,_0x22a3e3){return db[_0x8185('0x27')][_0x8185('0x42')](_0x22a363[_0x8185('0x43')],{})[_0x8185('0x21')](respondWithResult(_0x22a3e3,0xc9))[_0x8185('0x3e')](handleError(_0x22a3e3,null));};exports[_0x8185('0x20')]=function(_0x566d4d,_0x362cb9){if(_0x566d4d[_0x8185('0x43')]['id']){delete _0x566d4d['body']['id'];}return db[_0x8185('0x27')][_0x8185('0x44')]({'where':{'id':_0x566d4d[_0x8185('0x40')]['id']}})[_0x8185('0x21')](handleEntityNotFound(_0x362cb9,null))[_0x8185('0x21')](saveUpdates(_0x566d4d['body'],null))[_0x8185('0x21')](respondWithResult(_0x362cb9,null))[_0x8185('0x3e')](handleError(_0x362cb9,null));};exports[_0x8185('0x45')]=function(_0xafa9b8,_0x27bf8e){return db[_0x8185('0x27')][_0x8185('0x44')]({'where':{'id':_0xafa9b8[_0x8185('0x40')]['id']}})[_0x8185('0x21')](handleEntityNotFound(_0x27bf8e,null))['then'](removeEntity(_0x27bf8e,null))[_0x8185('0x3e')](handleError(_0x27bf8e,null));}; \ No newline at end of file +var _0x76f0=['Dynamics365Field','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','then','error','stack','name','send','index'];(function(_0x901b2e,_0x53ffc2){var _0x4d85c6=function(_0x1f86f1){while(--_0x1f86f1){_0x901b2e['push'](_0x901b2e['shift']());}};_0x4d85c6(++_0x53ffc2);}(_0x76f0,0x157));var _0x076f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x76f0[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x076f('0x0'));var emlformat=require(_0x076f('0x1'));var rimraf=require(_0x076f('0x2'));var zipdir=require(_0x076f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x076f('0x4'));var moment=require(_0x076f('0x5'));var BPromise=require(_0x076f('0x6'));var Mustache=require(_0x076f('0x7'));var util=require('util');var path=require(_0x076f('0x8'));var sox=require(_0x076f('0x9'));var csv=require('to-csv');var ejs=require(_0x076f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x076f('0xb'));var crypto=require(_0x076f('0xc'));var jsforce=require(_0x076f('0xd'));var deskjs=require(_0x076f('0xe'));var toCsv=require(_0x076f('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x076f('0x10'));var authService=require(_0x076f('0x11'));var qs=require(_0x076f('0x12'));var as=require(_0x076f('0x13'));var hardwareService=require(_0x076f('0x14'));var logger=require(_0x076f('0x15'))(_0x076f('0x16'));var utils=require(_0x076f('0x17'));var config=require(_0x076f('0x18'));var db=require(_0x076f('0x19'))['db'];function respondWithStatusCode(_0x4ee499,_0x2448da){_0x2448da=_0x2448da||0xcc;return function(_0x440207){if(_0x440207){return _0x4ee499[_0x076f('0x1a')](_0x2448da);}return _0x4ee499[_0x076f('0x1b')](_0x2448da)[_0x076f('0x1c')]();};}function respondWithResult(_0x247a64,_0x5772ee){_0x5772ee=_0x5772ee||0xc8;return function(_0x1dee46){if(_0x1dee46){return _0x247a64[_0x076f('0x1b')](_0x5772ee)[_0x076f('0x1d')](_0x1dee46);}};}function respondWithFilteredResult(_0x43af29,_0x13151b){return function(_0x5b9f1e){if(_0x5b9f1e){var _0x4be0d0=_0x5b9f1e[_0x076f('0x1e')],_0x1a1349=_0x13151b[_0x076f('0x1f')],_0x11e986=_0x13151b['offset']+_0x13151b['limit'],_0x215d1f;if(_0x11e986>=_0x4be0d0){_0x11e986=_0x4be0d0;_0x215d1f=0xc8;}else{_0x215d1f=0xce;}_0x43af29[_0x076f('0x1b')](_0x215d1f);return _0x43af29['set'](_0x076f('0x20'),_0x1a1349+'-'+_0x11e986+'/'+_0x4be0d0)[_0x076f('0x1d')](_0x5b9f1e);}return null;};}function patchUpdates(_0x414830){return function(_0x2e2c3e){try{jsonpatch[_0x076f('0x21')](_0x2e2c3e,_0x414830,!![]);}catch(_0x5e82a3){return BPromise['reject'](_0x5e82a3);}return _0x2e2c3e[_0x076f('0x22')]();};}function saveUpdates(_0x4d3f63,_0x1b203f){return function(_0x547f00){if(_0x547f00){return _0x547f00[_0x076f('0x23')](_0x4d3f63)['then'](function(_0x2b115e){return _0x2b115e;});}return null;};}function removeEntity(_0x26161d,_0x2da00c){return function(_0x227cfe){if(_0x227cfe){return _0x227cfe['destroy']()[_0x076f('0x24')](function(){_0x26161d[_0x076f('0x1b')](0xcc)[_0x076f('0x1c')]();});}};}function handleEntityNotFound(_0x35317d,_0xbeef21){return function(_0xa36193){if(!_0xa36193){_0x35317d[_0x076f('0x1a')](0x194);}return _0xa36193;};}function handleError(_0x58b5da,_0x317a5d){_0x317a5d=_0x317a5d||0x1f4;return function(_0x3b9e5b){logger[_0x076f('0x25')](_0x3b9e5b[_0x076f('0x26')]);if(_0x3b9e5b[_0x076f('0x27')]){delete _0x3b9e5b['name'];}_0x58b5da[_0x076f('0x1b')](_0x317a5d)[_0x076f('0x28')](_0x3b9e5b);};}exports[_0x076f('0x29')]=function(_0x2f0fef,_0x31fd93){var _0x2b7fd7={},_0x4257b2={},_0x49b25d={'count':0x0,'rows':[]};var _0x2fe34b=_['map'](db[_0x076f('0x2a')][_0x076f('0x2b')],function(_0x4562d1){return{'name':_0x4562d1['fieldName'],'type':_0x4562d1[_0x076f('0x2c')][_0x076f('0x2d')]};});_0x4257b2[_0x076f('0x2e')]=_[_0x076f('0x2f')](_0x2fe34b,'name');_0x4257b2['query']=_[_0x076f('0x30')](_0x2f0fef[_0x076f('0x31')]);_0x4257b2['filters']=_[_0x076f('0x32')](_0x4257b2[_0x076f('0x2e')],_0x4257b2[_0x076f('0x31')]);_0x2b7fd7[_0x076f('0x33')]=_[_0x076f('0x32')](_0x4257b2[_0x076f('0x2e')],qs[_0x076f('0x34')](_0x2f0fef[_0x076f('0x31')][_0x076f('0x34')]));_0x2b7fd7[_0x076f('0x33')]=_0x2b7fd7[_0x076f('0x33')]['length']?_0x2b7fd7['attributes']:_0x4257b2[_0x076f('0x2e')];if(!_0x2f0fef[_0x076f('0x31')][_0x076f('0x35')](_0x076f('0x36'))){_0x2b7fd7[_0x076f('0x37')]=qs[_0x076f('0x37')](_0x2f0fef[_0x076f('0x31')]['limit']);_0x2b7fd7['offset']=qs[_0x076f('0x1f')](_0x2f0fef[_0x076f('0x31')][_0x076f('0x1f')]);}_0x2b7fd7[_0x076f('0x38')]=qs['sort'](_0x2f0fef[_0x076f('0x31')][_0x076f('0x39')]);_0x2b7fd7[_0x076f('0x3a')]=qs[_0x076f('0x3b')](_[_0x076f('0x3c')](_0x2f0fef[_0x076f('0x31')],_0x4257b2[_0x076f('0x3b')]),_0x2fe34b);if(_0x2f0fef[_0x076f('0x31')][_0x076f('0x3d')]){_0x2b7fd7['where']=_[_0x076f('0x3e')](_0x2b7fd7[_0x076f('0x3a')],{'$or':_[_0x076f('0x2f')](_0x2fe34b,function(_0x191e46){if(_0x191e46[_0x076f('0x2c')]!==_0x076f('0x3f')){var _0x35dd85={};_0x35dd85[_0x191e46[_0x076f('0x27')]]={'$like':'%'+_0x2f0fef['query'][_0x076f('0x3d')]+'%'};return _0x35dd85;}})});}_0x2b7fd7=_[_0x076f('0x3e')]({},_0x2b7fd7,_0x2f0fef[_0x076f('0x40')]);var _0x45496e={'where':_0x2b7fd7[_0x076f('0x3a')]};return db[_0x076f('0x2a')]['count'](_0x45496e)[_0x076f('0x24')](function(_0x1b1fd1){_0x49b25d['count']=_0x1b1fd1;if(_0x2f0fef['query'][_0x076f('0x41')]){_0x2b7fd7[_0x076f('0x42')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x076f('0x43')](_0x2b7fd7);})[_0x076f('0x24')](function(_0x4ac455){_0x49b25d[_0x076f('0x44')]=_0x4ac455;return _0x49b25d;})[_0x076f('0x24')](respondWithFilteredResult(_0x31fd93,_0x2b7fd7))[_0x076f('0x45')](handleError(_0x31fd93,null));};exports[_0x076f('0x46')]=function(_0x5a0337,_0x173715){var _0x15d804={'raw':!![],'where':{'id':_0x5a0337[_0x076f('0x47')]['id']}},_0x498dd8={};_0x498dd8[_0x076f('0x2e')]=_[_0x076f('0x30')](db['Dynamics365Field'][_0x076f('0x2b')]);_0x498dd8[_0x076f('0x31')]=_[_0x076f('0x30')](_0x5a0337[_0x076f('0x31')]);_0x498dd8['filters']=_['intersection'](_0x498dd8[_0x076f('0x2e')],_0x498dd8['query']);_0x15d804[_0x076f('0x33')]=_['intersection'](_0x498dd8['model'],qs[_0x076f('0x34')](_0x5a0337[_0x076f('0x31')]['fields']));_0x15d804[_0x076f('0x33')]=_0x15d804[_0x076f('0x33')][_0x076f('0x48')]?_0x15d804[_0x076f('0x33')]:_0x498dd8[_0x076f('0x2e')];if(_0x5a0337[_0x076f('0x31')]['includeAll']){_0x15d804[_0x076f('0x42')]=[{'all':!![]}];}_0x15d804=_[_0x076f('0x3e')]({},_0x15d804,_0x5a0337['options']);return db[_0x076f('0x2a')][_0x076f('0x49')](_0x15d804)['then'](handleEntityNotFound(_0x173715,null))['then'](respondWithResult(_0x173715,null))[_0x076f('0x45')](handleError(_0x173715,null));};exports[_0x076f('0x4a')]=function(_0x4d4e04,_0x7b1c03){return db[_0x076f('0x2a')]['create'](_0x4d4e04[_0x076f('0x4b')],{})[_0x076f('0x24')](respondWithResult(_0x7b1c03,0xc9))[_0x076f('0x45')](handleError(_0x7b1c03,null));};exports[_0x076f('0x23')]=function(_0x6c1c72,_0x1a5c47){if(_0x6c1c72[_0x076f('0x4b')]['id']){delete _0x6c1c72[_0x076f('0x4b')]['id'];}return db[_0x076f('0x2a')][_0x076f('0x49')]({'where':{'id':_0x6c1c72['params']['id']}})[_0x076f('0x24')](handleEntityNotFound(_0x1a5c47,null))[_0x076f('0x24')](saveUpdates(_0x6c1c72[_0x076f('0x4b')],null))[_0x076f('0x24')](respondWithResult(_0x1a5c47,null))[_0x076f('0x45')](handleError(_0x1a5c47,null));};exports[_0x076f('0x4c')]=function(_0x30e3b6,_0x2bf226){return db[_0x076f('0x2a')][_0x076f('0x49')]({'where':{'id':_0x30e3b6[_0x076f('0x47')]['id']}})[_0x076f('0x24')](handleEntityNotFound(_0x2bf226,null))['then'](removeEntity(_0x2bf226,null))['catch'](handleError(_0x2bf226,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9f23b41..3e445c6 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 _0x37d7=['int_dynamics365_fields','dynamics365_unique_index','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','Dynamics365Field'];(function(_0x31bce6,_0x1cd3d6){var _0x443645=function(_0x2a8516){while(--_0x2a8516){_0x31bce6['push'](_0x31bce6['shift']());}};_0x443645(++_0x1cd3d6);}(_0x37d7,0x113));var _0x737d=function(_0x5c9a04,_0x1c1ebd){_0x5c9a04=_0x5c9a04-0x0;var _0x1cb316=_0x37d7[_0x5c9a04];return _0x1cb316;};'use strict';var _=require(_0x737d('0x0'));var util=require(_0x737d('0x1'));var logger=require(_0x737d('0x2'))(_0x737d('0x3'));var moment=require(_0x737d('0x4'));var BPromise=require(_0x737d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x737d('0x6'));var rimraf=require('rimraf');var config=require(_0x737d('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x737d('0x8')]=function(_0x9d784a,_0x4626a2){return _0x9d784a[_0x737d('0x9')](_0x737d('0xa'),attributes,{'tableName':_0x737d('0xb'),'paranoid':![],'indexes':[{'name':_0x737d('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc55f=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x4d435b,_0x8e93b5){var _0x4bad9d=function(_0x592083){while(--_0x592083){_0x4d435b['push'](_0x4d435b['shift']());}};_0x4bad9d(++_0x8e93b5);}(_0xc55f,0x1b7));var _0xfc55=function(_0x129735,_0x3983e4){_0x129735=_0x129735-0x0;var _0x5893c8=_0xc55f[_0x129735];return _0x5893c8;};'use strict';var _=require('lodash');var util=require(_0xfc55('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xfc55('0x1'));var BPromise=require(_0xfc55('0x2'));var rp=require(_0xfc55('0x3'));var fs=require('fs');var path=require(_0xfc55('0x4'));var rimraf=require(_0xfc55('0x5'));var config=require(_0xfc55('0x6'));var attributes=require(_0xfc55('0x7'));module[_0xfc55('0x8')]=function(_0x5474c2,_0x2bff54){return _0x5474c2[_0xfc55('0x9')](_0xfc55('0xa'),attributes,{'tableName':_0xfc55('0xb'),'paranoid':![],'indexes':[{'name':_0xfc55('0xc'),'fields':[_0xfc55('0xd'),'FieldId'],'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 b6a09e1..5207c8b 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 _0xcedf=['moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0xcedf,0x1b6));var _0xfced=function(_0x2d6b4f,_0x229c4f){_0x2d6b4f=_0x2d6b4f-0x0;var _0x5334f9=_0xcedf[_0x2d6b4f];return _0x5334f9;};'use strict';var _=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var moment=require(_0xfced('0x2'));var BPromise=require(_0xfced('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfced('0x4'));var db=require(_0xfced('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfced('0x6'));var config=require('../../config/environment');var jayson=require(_0xfced('0x7'));var client=jayson['client'][_0xfced('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x571725,_0x2cc4d1,_0x5bd518){return new BPromise(function(_0x5c6588,_0x27a65b){return client[_0xfced('0x9')](_0x571725,_0x5bd518)[_0xfced('0xa')](function(_0x1479e5){logger['info'](_0xfced('0xb'),_0x2cc4d1,_0xfced('0xc'));logger[_0xfced('0xd')](_0xfced('0xe'),_0x2cc4d1,_0xfced('0xc'),JSON[_0xfced('0xf')](_0x1479e5));if(_0x1479e5[_0xfced('0x10')]){if(_0x1479e5[_0xfced('0x10')][_0xfced('0x11')]===0x1f4){logger['error'](_0xfced('0xb'),_0x2cc4d1,_0x1479e5['error'][_0xfced('0x12')]);return _0x27a65b(_0x1479e5[_0xfced('0x10')][_0xfced('0x12')]);}logger[_0xfced('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x2cc4d1,_0x1479e5[_0xfced('0x10')][_0xfced('0x12')]);return _0x5c6588(_0x1479e5[_0xfced('0x10')][_0xfced('0x12')]);}else{logger[_0xfced('0x13')](_0xfced('0xb'),_0x2cc4d1,_0xfced('0xc'));_0x5c6588(_0x1479e5[_0xfced('0x14')]['message']);}})[_0xfced('0x15')](function(_0x5f1ac5){logger[_0xfced('0x10')](_0xfced('0xb'),_0x2cc4d1,_0x5f1ac5);_0x27a65b(_0x5f1ac5);});});} \ No newline at end of file +var _0xef66=['jayson/promise','client','http','request','then','info','request\x20sent','error','code','message','Dynamics365Field,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5c9b72,_0x105023){var _0x2c5f0d=function(_0x2d7c8c){while(--_0x2d7c8c){_0x5c9b72['push'](_0x5c9b72['shift']());}};_0x2c5f0d(++_0x105023);}(_0xef66,0x1db));var _0x6ef6=function(_0x4e9763,_0x53b20c){_0x4e9763=_0x4e9763-0x0;var _0x33b4b4=_0xef66[_0x4e9763];return _0x33b4b4;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ef6('0x5'));var logger=require(_0x6ef6('0x6'))(_0x6ef6('0x7'));var config=require(_0x6ef6('0x8'));var jayson=require(_0x6ef6('0x9'));var client=jayson[_0x6ef6('0xa')][_0x6ef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830aa,_0x3755b5,_0x4f06b9){return new BPromise(function(_0x5a7c74,_0xc0d555){return client[_0x6ef6('0xc')](_0x1830aa,_0x4f06b9)[_0x6ef6('0xd')](function(_0x391e0e){logger[_0x6ef6('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'),JSON['stringify'](_0x391e0e));if(_0x391e0e[_0x6ef6('0x10')]){if(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x11')]===0x1f4){logger[_0x6ef6('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x3755b5,_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0xc0d555(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);}logger['error'](_0x6ef6('0x13'),_0x3755b5,_0x391e0e['error'][_0x6ef6('0x12')]);return _0x5a7c74(_0x391e0e[_0x6ef6('0x10')]['message']);}else{logger[_0x6ef6('0xe')](_0x6ef6('0x13'),_0x3755b5,_0x6ef6('0xf'));_0x5a7c74(_0x391e0e[_0x6ef6('0x14')][_0x6ef6('0x12')]);}})[_0x6ef6('0x15')](function(_0x4ea222){logger[_0x6ef6('0x10')](_0x6ef6('0x13'),_0x3755b5,_0x4ea222);_0xc0d555(_0x4ea222);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c9d0ad0..a216e84 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 _0xedfd=['create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x1af5bb,_0x406f04){var _0x4360d4=function(_0xc49611){while(--_0xc49611){_0x1af5bb['push'](_0x1af5bb['shift']());}};_0x4360d4(++_0x406f04);}(_0xedfd,0x17b));var _0xdedf=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xedfd[_0x2405bc];return _0x5272d4;};'use strict';var multer=require(_0xdedf('0x0'));var util=require('util');var path=require(_0xdedf('0x1'));var timeout=require(_0xdedf('0x2'));var express=require(_0xdedf('0x3'));var router=express[_0xdedf('0x4')]();var auth=require(_0xdedf('0x5'));var interaction=require(_0xdedf('0x6'));var config=require(_0xdedf('0x7'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdedf('0x8')]);router[_0xdedf('0x9')](_0xdedf('0xa'),auth['isAuthenticated'](),controller[_0xdedf('0xb')]);router[_0xdedf('0x9')](_0xdedf('0xc'),auth[_0xdedf('0xd')](),controller[_0xdedf('0xe')]);router[_0xdedf('0x9')](_0xdedf('0xf'),auth['isAuthenticated'](),controller[_0xdedf('0x10')]);router['post']('/',auth[_0xdedf('0xd')](),controller[_0xdedf('0x11')]);router['post'](_0xdedf('0xc'),auth[_0xdedf('0xd')](),controller['addConfiguration']);router[_0xdedf('0x12')](_0xdedf('0xa'),auth['isAuthenticated'](),controller[_0xdedf('0x13')]);router[_0xdedf('0x14')]('/:id',auth[_0xdedf('0xd')](),controller[_0xdedf('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe335=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express'];(function(_0x57b27c,_0x84abfa){var _0xe0c87a=function(_0x238d19){while(--_0x238d19){_0x57b27c['push'](_0x57b27c['shift']());}};_0xe0c87a(++_0x84abfa);}(_0xe335,0xca));var _0x5e33=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe335[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x5e33('0x0'));var util=require(_0x5e33('0x1'));var path=require(_0x5e33('0x2'));var timeout=require(_0x5e33('0x3'));var express=require(_0x5e33('0x4'));var router=express['Router']();var auth=require(_0x5e33('0x5'));var interaction=require(_0x5e33('0x6'));var config=require(_0x5e33('0x7'));var controller=require(_0x5e33('0x8'));router[_0x5e33('0x9')]('/',auth[_0x5e33('0xa')](),controller[_0x5e33('0xb')]);router['get']('/:id',auth[_0x5e33('0xa')](),controller[_0x5e33('0xc')]);router['get'](_0x5e33('0xd'),auth[_0x5e33('0xa')](),controller[_0x5e33('0xe')]);router['get'](_0x5e33('0xf'),auth['isAuthenticated'](),controller[_0x5e33('0x10')]);router[_0x5e33('0x11')]('/',auth[_0x5e33('0xa')](),controller[_0x5e33('0x12')]);router[_0x5e33('0x11')](_0x5e33('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5e33('0x13')](_0x5e33('0x14'),auth[_0x5e33('0xa')](),controller[_0x5e33('0x15')]);router['delete']('/:id',auth[_0x5e33('0xa')](),controller['destroy']);module[_0x5e33('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 17d487e..d29deb7 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 _0x0adf=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0adf,0x1d2));var _0xf0ad=function(_0xe0f846,_0x439cc9){_0xe0f846=_0xe0f846-0x0;var _0x3815df=_0x0adf[_0xe0f846];return _0x3815df;};'use strict';var Sequelize=require(_0xf0ad('0x0'));module[_0xf0ad('0x1')]={'name':{'type':Sequelize[_0xf0ad('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x3')},'apiKey':{'type':Sequelize[_0xf0ad('0x2')]},'remoteUri':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x4')},'serverUrl':{'type':Sequelize[_0xf0ad('0x2')]}}; \ No newline at end of file +var _0x2cf5=['exports','STRING','username','sequelize'];(function(_0x1fa30b,_0x33ea0e){var _0x510ef6=function(_0x4fb7c1){while(--_0x4fb7c1){_0x1fa30b['push'](_0x1fa30b['shift']());}};_0x510ef6(++_0x33ea0e);}(_0x2cf5,0x19f));var _0x52cf=function(_0x3123da,_0x12c16d){_0x3123da=_0x3123da-0x0;var _0xea8e7d=_0x2cf5[_0x3123da];return _0xea8e7d;};'use strict';var Sequelize=require(_0x52cf('0x0'));module[_0x52cf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x52cf('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x52cf('0x3')},'apiKey':{'type':Sequelize[_0x52cf('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x52cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 23cce28..8d05e85 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 _0xa41a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','sendStatus','name','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','map','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','description','priority','source','ticket_type','company','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','send','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce'];(function(_0x389607,_0x3891dd){var _0x5013af=function(_0x41fb0a){while(--_0x41fb0a){_0x389607['push'](_0x389607['shift']());}};_0x5013af(++_0x3891dd);}(_0xa41a,0x6b));var _0xaa41=function(_0x34ab3c,_0x468dd3){_0x34ab3c=_0x34ab3c-0x0;var _0x54fb0b=_0xa41a[_0x34ab3c];return _0x54fb0b;};'use strict';var pdf=require(_0xaa41('0x0'));var emlformat=require(_0xaa41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa41('0x2'));var jsonpatch=require(_0xaa41('0x3'));var rp=require(_0xaa41('0x4'));var moment=require(_0xaa41('0x5'));var BPromise=require(_0xaa41('0x6'));var Mustache=require(_0xaa41('0x7'));var util=require(_0xaa41('0x8'));var path=require(_0xaa41('0x9'));var sox=require('sox');var csv=require(_0xaa41('0xa'));var ejs=require(_0xaa41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xa'));var querystring=require(_0xaa41('0xe'));var Papa=require(_0xaa41('0xf'));var Redis=require(_0xaa41('0x10'));var authService=require(_0xaa41('0x11'));var qs=require(_0xaa41('0x12'));var as=require(_0xaa41('0x13'));var hardwareService=require(_0xaa41('0x14'));var logger=require(_0xaa41('0x15'))('api');var utils=require(_0xaa41('0x16'));var config=require(_0xaa41('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xaa41('0x18'));var client=jayson['client'][_0xaa41('0x19')]({'port':0x232a});function checkPasswordPattern(_0x12d9e6,_0x2f64bc,_0x889d44){if(_0x889d44){var _0x6f9ade=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6f9ade['test'](_0x2f64bc)){return _0x12d9e6;}else{throw new db[(_0xaa41('0x1a'))][(_0xaa41('0x1b'))](_0xaa41('0x1c'));}}else{return _0x12d9e6;}}function respondWithRpcPromise(_0x1ef7d9,_0x2a6988,_0x2005ae,_0x1e1e02){return new BPromise(function(_0x550ad5,_0x2d868a){var _0x16b930=_0x1e1e02||client;return _0x16b930[_0xaa41('0x1d')](_0x1ef7d9,_0x2005ae)[_0xaa41('0x1e')](function(_0x230a6a){logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));logger[_0xaa41('0x22')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2a6988,'request\x20sent',JSON[_0xaa41('0x23')](_0x230a6a));if(_0x230a6a[_0xaa41('0x24')]){if(_0x230a6a[_0xaa41('0x24')]['code']===0x1f4){logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a['error']['message']);return _0x2d868a(_0x230a6a[_0xaa41('0x24')]['message']);}logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a[_0xaa41('0x24')][_0xaa41('0x25')]);return _0x550ad5(_0x230a6a[_0xaa41('0x24')]['message']);}else{logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));_0x550ad5(_0x230a6a[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x5c3074){logger['error'](_0xaa41('0x20'),_0x2a6988,_0x5c3074);_0x2d868a(_0x5c3074);});});}function respondWithStatusCode(_0x527cac,_0x493a10){_0x493a10=_0x493a10||0xcc;return function(_0x12e362){if(_0x12e362){return _0x527cac['sendStatus'](_0x493a10);}return _0x527cac['status'](_0x493a10)[_0xaa41('0x28')]();};}function respondWithResult(_0x9c8c21,_0x392214){_0x392214=_0x392214||0xc8;return function(_0x632fd2){if(_0x632fd2){return _0x9c8c21[_0xaa41('0x29')](_0x392214)[_0xaa41('0x2a')](_0x632fd2);}};}function respondWithFilteredResult(_0x57ef96,_0x30a174){return function(_0x1f0275){if(_0x1f0275){var _0x63c18c=_0x1f0275[_0xaa41('0x2b')],_0x9a16e3=_0x30a174[_0xaa41('0x2c')],_0x1d8c2b=_0x30a174['offset']+_0x30a174[_0xaa41('0x2d')],_0x4466a3;if(_0x1d8c2b>=_0x63c18c){_0x1d8c2b=_0x63c18c;_0x4466a3=0xc8;}else{_0x4466a3=0xce;}_0x57ef96['status'](_0x4466a3);return _0x57ef96['set'](_0xaa41('0x2e'),_0x9a16e3+'-'+_0x1d8c2b+'/'+_0x63c18c)[_0xaa41('0x2a')](_0x1f0275);}return null;};}function patchUpdates(_0x534a85){return function(_0x392b5d){try{jsonpatch[_0xaa41('0x2f')](_0x392b5d,_0x534a85,!![]);}catch(_0x4e3b44){return BPromise['reject'](_0x4e3b44);}return _0x392b5d['save']();};}function saveUpdates(_0x1cf3da,_0x2f5cc0){return function(_0x2a186e){if(_0x2a186e){return _0x2a186e[_0xaa41('0x30')](_0x1cf3da)['then'](function(_0x289c4a){return _0x289c4a;});}return null;};}function removeEntity(_0x45c8fe,_0x3e0204){return function(_0x4de770){if(_0x4de770){return _0x4de770[_0xaa41('0x31')]()[_0xaa41('0x1e')](function(){_0x45c8fe[_0xaa41('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252c62,_0x374117){return function(_0x57fe1d){if(!_0x57fe1d){_0x252c62[_0xaa41('0x32')](0x194);}return _0x57fe1d;};}function handleError(_0x13b6d4,_0x2298ed){_0x2298ed=_0x2298ed||0x1f4;return function(_0x5cec87){logger[_0xaa41('0x24')](_0x5cec87['stack']);if(_0x5cec87[_0xaa41('0x33')]){delete _0x5cec87[_0xaa41('0x33')];}_0x13b6d4[_0xaa41('0x29')](_0x2298ed)['send'](_0x5cec87);};}exports['index']=function(_0x4cdd42,_0x2dc05a){var _0x2e785f={},_0x1334c8={},_0x224eb3={'count':0x0,'rows':[]};var _0x4fbb92=_['map'](db[_0xaa41('0x34')][_0xaa41('0x35')],function(_0x951e52){return{'name':_0x951e52[_0xaa41('0x36')],'type':_0x951e52[_0xaa41('0x37')][_0xaa41('0x38')]};});_0x1334c8[_0xaa41('0x39')]=_['map'](_0x4fbb92,_0xaa41('0x33'));_0x1334c8[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x4cdd42[_0xaa41('0x3a')]);_0x1334c8['filters']=_['intersection'](_0x1334c8[_0xaa41('0x39')],_0x1334c8[_0xaa41('0x3a')]);_0x2e785f['attributes']=_[_0xaa41('0x3c')](_0x1334c8['model'],qs[_0xaa41('0x3d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x3d')]));_0x2e785f[_0xaa41('0x3e')]=_0x2e785f[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0x2e785f[_0xaa41('0x3e')]:_0x1334c8[_0xaa41('0x39')];if(!_0x4cdd42['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0x2e785f[_0xaa41('0x2d')]=qs[_0xaa41('0x2d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0x2e785f['offset']=qs['offset'](_0x4cdd42[_0xaa41('0x3a')]['offset']);}_0x2e785f[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x43')]);_0x2e785f[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x4cdd42['query'],_0x1334c8[_0xaa41('0x45')]),_0x4fbb92);if(_0x4cdd42['query']['filter']){_0x2e785f[_0xaa41('0x44')]=_['merge'](_0x2e785f['where'],{'$or':_['map'](_0x4fbb92,function(_0x3bad48){if(_0x3bad48['type']!==_0xaa41('0x47')){var _0x198716={};_0x198716[_0x3bad48['name']]={'$like':'%'+_0x4cdd42['query'][_0xaa41('0x48')]+'%'};return _0x198716;}})});}_0x2e785f=_[_0xaa41('0x49')]({},_0x2e785f,_0x4cdd42[_0xaa41('0x4a')]);var _0x2af8ba={'where':_0x2e785f[_0xaa41('0x44')]};return db[_0xaa41('0x34')][_0xaa41('0x2b')](_0x2af8ba)[_0xaa41('0x1e')](function(_0x2fa6ec){_0x224eb3['count']=_0x2fa6ec;if(_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x2e785f[_0xaa41('0x4c')]=[{'all':!![]}];}return db[_0xaa41('0x34')][_0xaa41('0x4d')](_0x2e785f);})[_0xaa41('0x1e')](function(_0x538b12){_0x224eb3[_0xaa41('0x4e')]=_0x538b12;return _0x224eb3;})[_0xaa41('0x1e')](respondWithFilteredResult(_0x2dc05a,_0x2e785f))[_0xaa41('0x27')](handleError(_0x2dc05a,null));};exports[_0xaa41('0x4f')]=function(_0x57d1f6,_0x23bc61){var _0x5787f3={'raw':![],'where':{'id':_0x57d1f6[_0xaa41('0x50')]['id']}},_0x49fedd={};_0x49fedd[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db['FreshdeskAccount'][_0xaa41('0x35')]);_0x49fedd[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x57d1f6['query']);_0x49fedd[_0xaa41('0x45')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],_0x49fedd[_0xaa41('0x3a')]);_0x5787f3[_0xaa41('0x3e')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],qs[_0xaa41('0x3d')](_0x57d1f6['query'][_0xaa41('0x3d')]));_0x5787f3['attributes']=_0x5787f3['attributes'][_0xaa41('0x3f')]?_0x5787f3[_0xaa41('0x3e')]:_0x49fedd[_0xaa41('0x39')];if(_0x57d1f6[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x5787f3[_0xaa41('0x4c')]=[{'all':!![]}];}_0x5787f3=_[_0xaa41('0x49')]({},_0x5787f3,_0x57d1f6[_0xaa41('0x4a')]);return db['FreshdeskAccount'][_0xaa41('0x51')](_0x5787f3)[_0xaa41('0x1e')](handleEntityNotFound(_0x23bc61,null))[_0xaa41('0x1e')](respondWithResult(_0x23bc61,null))['catch'](handleError(_0x23bc61,null));};exports[_0xaa41('0x52')]=function(_0x35f664,_0x4cf674){return db[_0xaa41('0x34')][_0xaa41('0x52')](_0x35f664[_0xaa41('0x53')],{})['then'](respondWithResult(_0x4cf674,0xc9))[_0xaa41('0x27')](handleError(_0x4cf674,null));};exports[_0xaa41('0x30')]=function(_0x4e3b13,_0x49789a){if(_0x4e3b13[_0xaa41('0x53')]['id']){delete _0x4e3b13[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')]['find']({'where':{'id':_0x4e3b13[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x49789a,null))[_0xaa41('0x1e')](saveUpdates(_0x4e3b13[_0xaa41('0x53')],null))[_0xaa41('0x1e')](respondWithResult(_0x49789a,null))['catch'](handleError(_0x49789a,null));};exports[_0xaa41('0x31')]=function(_0x57cb70,_0x555186){return db[_0xaa41('0x34')]['find']({'where':{'id':_0x57cb70[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x555186,null))[_0xaa41('0x1e')](removeEntity(_0x555186,null))['catch'](handleError(_0x555186,null));};exports[_0xaa41('0x54')]=function(_0x41c7f4,_0x36154e,_0x857bbc){var _0xa1f9f9={};var _0x332a3c={};var _0xc56018;var _0x337059;return db[_0xaa41('0x34')]['findOne']({'where':{'id':_0x41c7f4[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x36154e,null))[_0xaa41('0x1e')](function(_0x5a5a55){if(_0x5a5a55){_0xc56018=_0x5a5a55;_0x332a3c[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db[_0xaa41('0x55')][_0xaa41('0x35')]);_0x332a3c[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x41c7f4[_0xaa41('0x3a')]);_0x332a3c['filters']=_['intersection'](_0x332a3c['model'],_0x332a3c['query']);_0xa1f9f9['attributes']=_['intersection'](_0x332a3c[_0xaa41('0x39')],qs['fields'](_0x41c7f4['query'][_0xaa41('0x3d')]));_0xa1f9f9[_0xaa41('0x3e')]=_0xa1f9f9[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0xa1f9f9['attributes']:_0x332a3c[_0xaa41('0x39')];_0xa1f9f9[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x43')]);_0xa1f9f9[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x41c7f4[_0xaa41('0x3a')],_0x332a3c['filters']));if(_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]){_0xa1f9f9['where']=_['merge'](_0xa1f9f9['where'],{'$or':_[_0xaa41('0x56')](_0xa1f9f9['attributes'],function(_0x1eac4a){var _0x5c8028={};_0x5c8028[_0x1eac4a]={'$like':'%'+_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]+'%'};return _0x5c8028;})});}_0xa1f9f9=_['merge']({},_0xa1f9f9,_0x41c7f4[_0xaa41('0x4a')]);return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})[_0xaa41('0x1e')](function(_0x33f5c2){if(_0x33f5c2){_0x337059=_0x33f5c2['length'];if(!_0x41c7f4['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0xa1f9f9['limit']=qs['limit'](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0xa1f9f9[_0xaa41('0x2c')]=qs[_0xaa41('0x2c')](_0x41c7f4[_0xaa41('0x3a')]['offset']);}return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})['then'](function(_0x5062db){if(_0x5062db){return _0x5062db?{'count':_0x337059,'rows':_0x5062db}:null;}})['then'](respondWithResult(_0x36154e,null))[_0xaa41('0x27')](handleError(_0x36154e,null));};exports[_0xaa41('0x57')]=function(_0x436362,_0x5bad74,_0x229297){if(_0x436362[_0xaa41('0x53')]['id']){delete _0x436362[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x436362[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x5bad74,null))['then'](function(_0x1d2978){if(_0x1d2978){_0x436362[_0xaa41('0x53')][_0xaa41('0x59')]=_0x1d2978['id'];_0x436362[_0xaa41('0x53')]['Subjects']=integrations[_0xaa41('0x5a')](_0x436362['body'][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')][_0xaa41('0x37')]);_0x436362[_0xaa41('0x53')]['Descriptions']=integrations[_0xaa41('0x5c')](_0x436362[_0xaa41('0x53')][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')]['type']);return db[_0xaa41('0x55')]['create'](_0x436362[_0xaa41('0x53')],{'include':[{'model':db[_0xaa41('0x5d')],'as':'Subjects'},{'model':db[_0xaa41('0x5d')],'as':_0xaa41('0x5e')}]});}return null;})[_0xaa41('0x1e')](respondWithResult(_0x5bad74,null))[_0xaa41('0x27')](handleError(_0x5bad74,null));};exports[_0xaa41('0x5f')]=function(_0x1338d3,_0x384aba,_0x297ec6){var _0x33b5f4='';return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x1338d3['params']['id']},'attributes':['id',_0xaa41('0x60'),_0xaa41('0x61')]})[_0xaa41('0x1e')](handleEntityNotFound(_0x384aba,null))['then'](function(_0x5ec19b){if(_0x5ec19b){_0x33b5f4=_0x5ec19b[_0xaa41('0x60')];var _0x39da69=_0x33b5f4['slice'](-0x1);if(_0x39da69==='/'){_0x33b5f4=_0x33b5f4[_0xaa41('0x62')](0x0,_0x33b5f4[_0xaa41('0x63')](_0x39da69));}return rp({'method':'GET','uri':util[_0xaa41('0x64')](_0xaa41('0x65'),_0x33b5f4,_0xaa41('0x66')),'headers':{'Authorization':util[_0xaa41('0x64')](_0xaa41('0x67'),new Buffer(util[_0xaa41('0x64')](_0xaa41('0x68'),_0x5ec19b[_0xaa41('0x61')]))['toString']('base64'))},'json':!![]});}})[_0xaa41('0x1e')](function(_0x481db9){if(_0x481db9){var _0x654594=[_0xaa41('0x69'),_0xaa41('0x6a'),'agent',_0xaa41('0x6b'),_0xaa41('0x29'),_0xaa41('0x6c'),'group',_0xaa41('0x6d'),_0xaa41('0x6e'),'group',_0xaa41('0x6f')];_['remove'](_0x481db9,function(_0x53faf4){return _0x654594[_0xaa41('0x70')](_0x53faf4[_0xaa41('0x33')])||!_0x53faf4['default']&&_0x53faf4['type']!==_0xaa41('0x71')&&_0x53faf4[_0xaa41('0x37')]!==_0xaa41('0x72');});return{'count':_0x481db9[_0xaa41('0x3f')],'rows':_['map'](_0x481db9,function(_0x9741a8){return{'id':_0x9741a8[_0xaa41('0x33')],'name':_0x9741a8[_0xaa41('0x73')],'custom':!_0x9741a8['default'],'options':_0x9741a8[_0xaa41('0x74')]?_[_0xaa41('0x56')](_0x9741a8[_0xaa41('0x74')],function(_0x5697b6){return{'name':_[_0xaa41('0x75')](_0x5697b6),'value':_0x5697b6};}):[]};})};}})['then'](respondWithResult(_0x384aba,null))['catch'](function(_0x364d24){var _0x25c4d0=_0x1338d3['query'][_0xaa41('0x76')]?0x1f4:_0x364d24[_0xaa41('0x77')]||0x1f4;logger[_0xaa41('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa41('0x5f'),_0x25c4d0,JSON[_0xaa41('0x23')](_0x364d24));delete _0x364d24[_0xaa41('0x33')];if(_0x25c4d0===0x191){_0x25c4d0=0x190;}_0x384aba[_0xaa41('0x29')](_0x25c4d0)[_0xaa41('0x78')](_0x1338d3['query'][_0xaa41('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x364d24[_0xaa41('0x77')]}:_0x364d24);});}; \ No newline at end of file +var _0xa41a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','sendStatus','name','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','map','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','description','priority','source','ticket_type','company','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','send','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce'];(function(_0x259d33,_0x23b98a){var _0x48e80a=function(_0x126296){while(--_0x126296){_0x259d33['push'](_0x259d33['shift']());}};_0x48e80a(++_0x23b98a);}(_0xa41a,0x6b));var _0xaa41=function(_0x28af43,_0x5bf7ca){_0x28af43=_0x28af43-0x0;var _0x5a5df2=_0xa41a[_0x28af43];return _0x5a5df2;};'use strict';var pdf=require(_0xaa41('0x0'));var emlformat=require(_0xaa41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa41('0x2'));var jsonpatch=require(_0xaa41('0x3'));var rp=require(_0xaa41('0x4'));var moment=require(_0xaa41('0x5'));var BPromise=require(_0xaa41('0x6'));var Mustache=require(_0xaa41('0x7'));var util=require(_0xaa41('0x8'));var path=require(_0xaa41('0x9'));var sox=require('sox');var csv=require(_0xaa41('0xa'));var ejs=require(_0xaa41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xa'));var querystring=require(_0xaa41('0xe'));var Papa=require(_0xaa41('0xf'));var Redis=require(_0xaa41('0x10'));var authService=require(_0xaa41('0x11'));var qs=require(_0xaa41('0x12'));var as=require(_0xaa41('0x13'));var hardwareService=require(_0xaa41('0x14'));var logger=require(_0xaa41('0x15'))('api');var utils=require(_0xaa41('0x16'));var config=require(_0xaa41('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xaa41('0x18'));var client=jayson['client'][_0xaa41('0x19')]({'port':0x232a});function checkPasswordPattern(_0x12d9e6,_0x2f64bc,_0x889d44){if(_0x889d44){var _0x6f9ade=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6f9ade['test'](_0x2f64bc)){return _0x12d9e6;}else{throw new db[(_0xaa41('0x1a'))][(_0xaa41('0x1b'))](_0xaa41('0x1c'));}}else{return _0x12d9e6;}}function respondWithRpcPromise(_0x1ef7d9,_0x2a6988,_0x2005ae,_0x1e1e02){return new BPromise(function(_0x550ad5,_0x2d868a){var _0x16b930=_0x1e1e02||client;return _0x16b930[_0xaa41('0x1d')](_0x1ef7d9,_0x2005ae)[_0xaa41('0x1e')](function(_0x230a6a){logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));logger[_0xaa41('0x22')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2a6988,'request\x20sent',JSON[_0xaa41('0x23')](_0x230a6a));if(_0x230a6a[_0xaa41('0x24')]){if(_0x230a6a[_0xaa41('0x24')]['code']===0x1f4){logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a['error']['message']);return _0x2d868a(_0x230a6a[_0xaa41('0x24')]['message']);}logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a[_0xaa41('0x24')][_0xaa41('0x25')]);return _0x550ad5(_0x230a6a[_0xaa41('0x24')]['message']);}else{logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));_0x550ad5(_0x230a6a[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x5c3074){logger['error'](_0xaa41('0x20'),_0x2a6988,_0x5c3074);_0x2d868a(_0x5c3074);});});}function respondWithStatusCode(_0x527cac,_0x493a10){_0x493a10=_0x493a10||0xcc;return function(_0x12e362){if(_0x12e362){return _0x527cac['sendStatus'](_0x493a10);}return _0x527cac['status'](_0x493a10)[_0xaa41('0x28')]();};}function respondWithResult(_0x9c8c21,_0x392214){_0x392214=_0x392214||0xc8;return function(_0x632fd2){if(_0x632fd2){return _0x9c8c21[_0xaa41('0x29')](_0x392214)[_0xaa41('0x2a')](_0x632fd2);}};}function respondWithFilteredResult(_0x57ef96,_0x30a174){return function(_0x1f0275){if(_0x1f0275){var _0x63c18c=_0x1f0275[_0xaa41('0x2b')],_0x9a16e3=_0x30a174[_0xaa41('0x2c')],_0x1d8c2b=_0x30a174['offset']+_0x30a174[_0xaa41('0x2d')],_0x4466a3;if(_0x1d8c2b>=_0x63c18c){_0x1d8c2b=_0x63c18c;_0x4466a3=0xc8;}else{_0x4466a3=0xce;}_0x57ef96['status'](_0x4466a3);return _0x57ef96['set'](_0xaa41('0x2e'),_0x9a16e3+'-'+_0x1d8c2b+'/'+_0x63c18c)[_0xaa41('0x2a')](_0x1f0275);}return null;};}function patchUpdates(_0x534a85){return function(_0x392b5d){try{jsonpatch[_0xaa41('0x2f')](_0x392b5d,_0x534a85,!![]);}catch(_0x4e3b44){return BPromise['reject'](_0x4e3b44);}return _0x392b5d['save']();};}function saveUpdates(_0x1cf3da,_0x2f5cc0){return function(_0x2a186e){if(_0x2a186e){return _0x2a186e[_0xaa41('0x30')](_0x1cf3da)['then'](function(_0x289c4a){return _0x289c4a;});}return null;};}function removeEntity(_0x45c8fe,_0x3e0204){return function(_0x4de770){if(_0x4de770){return _0x4de770[_0xaa41('0x31')]()[_0xaa41('0x1e')](function(){_0x45c8fe[_0xaa41('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252c62,_0x374117){return function(_0x57fe1d){if(!_0x57fe1d){_0x252c62[_0xaa41('0x32')](0x194);}return _0x57fe1d;};}function handleError(_0x13b6d4,_0x2298ed){_0x2298ed=_0x2298ed||0x1f4;return function(_0x5cec87){logger[_0xaa41('0x24')](_0x5cec87['stack']);if(_0x5cec87[_0xaa41('0x33')]){delete _0x5cec87[_0xaa41('0x33')];}_0x13b6d4[_0xaa41('0x29')](_0x2298ed)['send'](_0x5cec87);};}exports['index']=function(_0x4cdd42,_0x2dc05a){var _0x2e785f={},_0x1334c8={},_0x224eb3={'count':0x0,'rows':[]};var _0x4fbb92=_['map'](db[_0xaa41('0x34')][_0xaa41('0x35')],function(_0x951e52){return{'name':_0x951e52[_0xaa41('0x36')],'type':_0x951e52[_0xaa41('0x37')][_0xaa41('0x38')]};});_0x1334c8[_0xaa41('0x39')]=_['map'](_0x4fbb92,_0xaa41('0x33'));_0x1334c8[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x4cdd42[_0xaa41('0x3a')]);_0x1334c8['filters']=_['intersection'](_0x1334c8[_0xaa41('0x39')],_0x1334c8[_0xaa41('0x3a')]);_0x2e785f['attributes']=_[_0xaa41('0x3c')](_0x1334c8['model'],qs[_0xaa41('0x3d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x3d')]));_0x2e785f[_0xaa41('0x3e')]=_0x2e785f[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0x2e785f[_0xaa41('0x3e')]:_0x1334c8[_0xaa41('0x39')];if(!_0x4cdd42['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0x2e785f[_0xaa41('0x2d')]=qs[_0xaa41('0x2d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0x2e785f['offset']=qs['offset'](_0x4cdd42[_0xaa41('0x3a')]['offset']);}_0x2e785f[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x43')]);_0x2e785f[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x4cdd42['query'],_0x1334c8[_0xaa41('0x45')]),_0x4fbb92);if(_0x4cdd42['query']['filter']){_0x2e785f[_0xaa41('0x44')]=_['merge'](_0x2e785f['where'],{'$or':_['map'](_0x4fbb92,function(_0x3bad48){if(_0x3bad48['type']!==_0xaa41('0x47')){var _0x198716={};_0x198716[_0x3bad48['name']]={'$like':'%'+_0x4cdd42['query'][_0xaa41('0x48')]+'%'};return _0x198716;}})});}_0x2e785f=_[_0xaa41('0x49')]({},_0x2e785f,_0x4cdd42[_0xaa41('0x4a')]);var _0x2af8ba={'where':_0x2e785f[_0xaa41('0x44')]};return db[_0xaa41('0x34')][_0xaa41('0x2b')](_0x2af8ba)[_0xaa41('0x1e')](function(_0x2fa6ec){_0x224eb3['count']=_0x2fa6ec;if(_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x2e785f[_0xaa41('0x4c')]=[{'all':!![]}];}return db[_0xaa41('0x34')][_0xaa41('0x4d')](_0x2e785f);})[_0xaa41('0x1e')](function(_0x538b12){_0x224eb3[_0xaa41('0x4e')]=_0x538b12;return _0x224eb3;})[_0xaa41('0x1e')](respondWithFilteredResult(_0x2dc05a,_0x2e785f))[_0xaa41('0x27')](handleError(_0x2dc05a,null));};exports[_0xaa41('0x4f')]=function(_0x57d1f6,_0x23bc61){var _0x5787f3={'raw':![],'where':{'id':_0x57d1f6[_0xaa41('0x50')]['id']}},_0x49fedd={};_0x49fedd[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db['FreshdeskAccount'][_0xaa41('0x35')]);_0x49fedd[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x57d1f6['query']);_0x49fedd[_0xaa41('0x45')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],_0x49fedd[_0xaa41('0x3a')]);_0x5787f3[_0xaa41('0x3e')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],qs[_0xaa41('0x3d')](_0x57d1f6['query'][_0xaa41('0x3d')]));_0x5787f3['attributes']=_0x5787f3['attributes'][_0xaa41('0x3f')]?_0x5787f3[_0xaa41('0x3e')]:_0x49fedd[_0xaa41('0x39')];if(_0x57d1f6[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x5787f3[_0xaa41('0x4c')]=[{'all':!![]}];}_0x5787f3=_[_0xaa41('0x49')]({},_0x5787f3,_0x57d1f6[_0xaa41('0x4a')]);return db['FreshdeskAccount'][_0xaa41('0x51')](_0x5787f3)[_0xaa41('0x1e')](handleEntityNotFound(_0x23bc61,null))[_0xaa41('0x1e')](respondWithResult(_0x23bc61,null))['catch'](handleError(_0x23bc61,null));};exports[_0xaa41('0x52')]=function(_0x35f664,_0x4cf674){return db[_0xaa41('0x34')][_0xaa41('0x52')](_0x35f664[_0xaa41('0x53')],{})['then'](respondWithResult(_0x4cf674,0xc9))[_0xaa41('0x27')](handleError(_0x4cf674,null));};exports[_0xaa41('0x30')]=function(_0x4e3b13,_0x49789a){if(_0x4e3b13[_0xaa41('0x53')]['id']){delete _0x4e3b13[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')]['find']({'where':{'id':_0x4e3b13[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x49789a,null))[_0xaa41('0x1e')](saveUpdates(_0x4e3b13[_0xaa41('0x53')],null))[_0xaa41('0x1e')](respondWithResult(_0x49789a,null))['catch'](handleError(_0x49789a,null));};exports[_0xaa41('0x31')]=function(_0x57cb70,_0x555186){return db[_0xaa41('0x34')]['find']({'where':{'id':_0x57cb70[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x555186,null))[_0xaa41('0x1e')](removeEntity(_0x555186,null))['catch'](handleError(_0x555186,null));};exports[_0xaa41('0x54')]=function(_0x41c7f4,_0x36154e,_0x857bbc){var _0xa1f9f9={};var _0x332a3c={};var _0xc56018;var _0x337059;return db[_0xaa41('0x34')]['findOne']({'where':{'id':_0x41c7f4[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x36154e,null))[_0xaa41('0x1e')](function(_0x5a5a55){if(_0x5a5a55){_0xc56018=_0x5a5a55;_0x332a3c[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db[_0xaa41('0x55')][_0xaa41('0x35')]);_0x332a3c[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x41c7f4[_0xaa41('0x3a')]);_0x332a3c['filters']=_['intersection'](_0x332a3c['model'],_0x332a3c['query']);_0xa1f9f9['attributes']=_['intersection'](_0x332a3c[_0xaa41('0x39')],qs['fields'](_0x41c7f4['query'][_0xaa41('0x3d')]));_0xa1f9f9[_0xaa41('0x3e')]=_0xa1f9f9[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0xa1f9f9['attributes']:_0x332a3c[_0xaa41('0x39')];_0xa1f9f9[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x43')]);_0xa1f9f9[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x41c7f4[_0xaa41('0x3a')],_0x332a3c['filters']));if(_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]){_0xa1f9f9['where']=_['merge'](_0xa1f9f9['where'],{'$or':_[_0xaa41('0x56')](_0xa1f9f9['attributes'],function(_0x1eac4a){var _0x5c8028={};_0x5c8028[_0x1eac4a]={'$like':'%'+_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]+'%'};return _0x5c8028;})});}_0xa1f9f9=_['merge']({},_0xa1f9f9,_0x41c7f4[_0xaa41('0x4a')]);return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})[_0xaa41('0x1e')](function(_0x33f5c2){if(_0x33f5c2){_0x337059=_0x33f5c2['length'];if(!_0x41c7f4['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0xa1f9f9['limit']=qs['limit'](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0xa1f9f9[_0xaa41('0x2c')]=qs[_0xaa41('0x2c')](_0x41c7f4[_0xaa41('0x3a')]['offset']);}return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})['then'](function(_0x5062db){if(_0x5062db){return _0x5062db?{'count':_0x337059,'rows':_0x5062db}:null;}})['then'](respondWithResult(_0x36154e,null))[_0xaa41('0x27')](handleError(_0x36154e,null));};exports[_0xaa41('0x57')]=function(_0x436362,_0x5bad74,_0x229297){if(_0x436362[_0xaa41('0x53')]['id']){delete _0x436362[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x436362[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x5bad74,null))['then'](function(_0x1d2978){if(_0x1d2978){_0x436362[_0xaa41('0x53')][_0xaa41('0x59')]=_0x1d2978['id'];_0x436362[_0xaa41('0x53')]['Subjects']=integrations[_0xaa41('0x5a')](_0x436362['body'][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')][_0xaa41('0x37')]);_0x436362[_0xaa41('0x53')]['Descriptions']=integrations[_0xaa41('0x5c')](_0x436362[_0xaa41('0x53')][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')]['type']);return db[_0xaa41('0x55')]['create'](_0x436362[_0xaa41('0x53')],{'include':[{'model':db[_0xaa41('0x5d')],'as':'Subjects'},{'model':db[_0xaa41('0x5d')],'as':_0xaa41('0x5e')}]});}return null;})[_0xaa41('0x1e')](respondWithResult(_0x5bad74,null))[_0xaa41('0x27')](handleError(_0x5bad74,null));};exports[_0xaa41('0x5f')]=function(_0x1338d3,_0x384aba,_0x297ec6){var _0x33b5f4='';return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x1338d3['params']['id']},'attributes':['id',_0xaa41('0x60'),_0xaa41('0x61')]})[_0xaa41('0x1e')](handleEntityNotFound(_0x384aba,null))['then'](function(_0x5ec19b){if(_0x5ec19b){_0x33b5f4=_0x5ec19b[_0xaa41('0x60')];var _0x39da69=_0x33b5f4['slice'](-0x1);if(_0x39da69==='/'){_0x33b5f4=_0x33b5f4[_0xaa41('0x62')](0x0,_0x33b5f4[_0xaa41('0x63')](_0x39da69));}return rp({'method':'GET','uri':util[_0xaa41('0x64')](_0xaa41('0x65'),_0x33b5f4,_0xaa41('0x66')),'headers':{'Authorization':util[_0xaa41('0x64')](_0xaa41('0x67'),new Buffer(util[_0xaa41('0x64')](_0xaa41('0x68'),_0x5ec19b[_0xaa41('0x61')]))['toString']('base64'))},'json':!![]});}})[_0xaa41('0x1e')](function(_0x481db9){if(_0x481db9){var _0x654594=[_0xaa41('0x69'),_0xaa41('0x6a'),'agent',_0xaa41('0x6b'),_0xaa41('0x29'),_0xaa41('0x6c'),'group',_0xaa41('0x6d'),_0xaa41('0x6e'),'group',_0xaa41('0x6f')];_['remove'](_0x481db9,function(_0x53faf4){return _0x654594[_0xaa41('0x70')](_0x53faf4[_0xaa41('0x33')])||!_0x53faf4['default']&&_0x53faf4['type']!==_0xaa41('0x71')&&_0x53faf4[_0xaa41('0x37')]!==_0xaa41('0x72');});return{'count':_0x481db9[_0xaa41('0x3f')],'rows':_['map'](_0x481db9,function(_0x9741a8){return{'id':_0x9741a8[_0xaa41('0x33')],'name':_0x9741a8[_0xaa41('0x73')],'custom':!_0x9741a8['default'],'options':_0x9741a8[_0xaa41('0x74')]?_[_0xaa41('0x56')](_0x9741a8[_0xaa41('0x74')],function(_0x5697b6){return{'name':_[_0xaa41('0x75')](_0x5697b6),'value':_0x5697b6};}):[]};})};}})['then'](respondWithResult(_0x384aba,null))['catch'](function(_0x364d24){var _0x25c4d0=_0x1338d3['query'][_0xaa41('0x76')]?0x1f4:_0x364d24[_0xaa41('0x77')]||0x1f4;logger[_0xaa41('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa41('0x5f'),_0x25c4d0,JSON[_0xaa41('0x23')](_0x364d24));delete _0x364d24[_0xaa41('0x33')];if(_0x25c4d0===0x191){_0x25c4d0=0x190;}_0x384aba[_0xaa41('0x29')](_0x25c4d0)[_0xaa41('0x78')](_0x1338d3['query'][_0xaa41('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x364d24[_0xaa41('0x77')]}:_0x364d24);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index cfa4121..cdfc21b 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 _0x9a38=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x56b4d0,_0x49fcda){var _0x848f22=function(_0x2befe4){while(--_0x2befe4){_0x56b4d0['push'](_0x56b4d0['shift']());}};_0x848f22(++_0x49fcda);}(_0x9a38,0xc3));var _0x89a3=function(_0x542a6e,_0x19c45a){_0x542a6e=_0x542a6e-0x0;var _0x423fd0=_0x9a38[_0x542a6e];return _0x423fd0;};'use strict';var _=require(_0x89a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x89a3('0x1'));var moment=require(_0x89a3('0x2'));var BPromise=require('bluebird');var rp=require(_0x89a3('0x3'));var fs=require('fs');var path=require(_0x89a3('0x4'));var rimraf=require(_0x89a3('0x5'));var config=require(_0x89a3('0x6'));var attributes=require(_0x89a3('0x7'));var integrations=require(_0x89a3('0x8'));module[_0x89a3('0x9')]=function(_0x2dcd79,_0x535606){return _0x2dcd79[_0x89a3('0xa')](_0x89a3('0xb'),attributes,{'tableName':_0x89a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe20d=['../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x5eb0fd,_0x17d8ef){var _0x22cb4a=function(_0x138247){while(--_0x138247){_0x5eb0fd['push'](_0x5eb0fd['shift']());}};_0x22cb4a(++_0x17d8ef);}(_0xe20d,0x11a));var _0xde20=function(_0x908d2e,_0x1e52b7){_0x908d2e=_0x908d2e-0x0;var _0x2be763=_0xe20d[_0x908d2e];return _0x2be763;};'use strict';var _=require(_0xde20('0x0'));var util=require(_0xde20('0x1'));var logger=require('../../config/logger')(_0xde20('0x2'));var moment=require('moment');var BPromise=require(_0xde20('0x3'));var rp=require(_0xde20('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde20('0x5'));var config=require(_0xde20('0x6'));var attributes=require(_0xde20('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xde20('0x8')]=function(_0x2f60f0,_0x2b9718){return _0x2f60f0[_0xde20('0x9')](_0xde20('0xa'),attributes,{'tableName':_0xde20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index d341f7c..c4718fd 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 _0xb5c2=['find','info','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','attributes','map','include','model','ShowFreshdeskAccount'];(function(_0x2209de,_0x501ddd){var _0x2f5c38=function(_0x5a831e){while(--_0x5a831e){_0x2209de['push'](_0x2209de['shift']());}};_0x2f5c38(++_0x501ddd);}(_0xb5c2,0x156));var _0x2b5c=function(_0x30821d,_0x3a35c2){_0x30821d=_0x30821d-0x0;var _0x551759=_0xb5c2[_0x30821d];return _0x551759;};'use strict';var _=require(_0x2b5c('0x0'));var util=require(_0x2b5c('0x1'));var moment=require(_0x2b5c('0x2'));var BPromise=require('bluebird');var rs=require(_0x2b5c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b5c('0x4'))['db'];var utils=require(_0x2b5c('0x5'));var logger=require(_0x2b5c('0x6'))(_0x2b5c('0x7'));var config=require(_0x2b5c('0x8'));var jayson=require(_0x2b5c('0x9'));var client=jayson[_0x2b5c('0xa')][_0x2b5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x508285,_0x508d3c,_0x34e328){return new BPromise(function(_0x5f3bc6,_0x54553c){return client[_0x2b5c('0xc')](_0x508285,_0x34e328)[_0x2b5c('0xd')](function(_0x91f186){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x508d3c,_0x2b5c('0xe'));logger[_0x2b5c('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x508d3c,_0x2b5c('0xe'),JSON[_0x2b5c('0x10')](_0x91f186));if(_0x91f186[_0x2b5c('0x11')]){if(_0x91f186[_0x2b5c('0x11')][_0x2b5c('0x12')]===0x1f4){logger[_0x2b5c('0x11')](_0x2b5c('0x13'),_0x508d3c,_0x91f186[_0x2b5c('0x11')][_0x2b5c('0x14')]);return _0x54553c(_0x91f186[_0x2b5c('0x11')]['message']);}logger[_0x2b5c('0x11')](_0x2b5c('0x13'),_0x508d3c,_0x91f186[_0x2b5c('0x11')][_0x2b5c('0x14')]);return _0x5f3bc6(_0x91f186[_0x2b5c('0x11')]['message']);}else{logger['info'](_0x2b5c('0x13'),_0x508d3c,_0x2b5c('0xe'));_0x5f3bc6(_0x91f186[_0x2b5c('0x15')]['message']);}})[_0x2b5c('0x16')](function(_0x3c937e){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x508d3c,_0x3c937e);_0x54553c(_0x3c937e);});});}exports[_0x2b5c('0x17')]=function(_0x496c5f){var _0x55bfd9=this;return new Promise(function(_0x3fcf35,_0x496057){return db[_0x2b5c('0x18')]['findAll']({'raw':_0x496c5f['options']?_0x496c5f[_0x2b5c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x496c5f[_0x2b5c('0x19')]?_0x496c5f[_0x2b5c('0x19')][_0x2b5c('0x1a')]||null:null,'attributes':_0x496c5f[_0x2b5c('0x19')]?_0x496c5f[_0x2b5c('0x19')][_0x2b5c('0x1b')]||null:null,'limit':_0x496c5f['options']?_0x496c5f[_0x2b5c('0x19')]['limit']||null:null,'include':_0x496c5f['options']?_0x496c5f[_0x2b5c('0x19')]['include']?_[_0x2b5c('0x1c')](_0x496c5f[_0x2b5c('0x19')][_0x2b5c('0x1d')],function(_0x9c69f){return{'model':db[_0x9c69f[_0x2b5c('0x1e')]],'as':_0x9c69f['as'],'attributes':_0x9c69f['attributes'],'include':_0x9c69f['include']?_[_0x2b5c('0x1c')](_0x9c69f[_0x2b5c('0x1d')],function(_0x45d88a){return{'model':db[_0x45d88a[_0x2b5c('0x1e')]],'as':_0x45d88a['as'],'attributes':_0x45d88a[_0x2b5c('0x1b')],'include':_0x45d88a[_0x2b5c('0x1d')]?_[_0x2b5c('0x1c')](_0x45d88a[_0x2b5c('0x1d')],function(_0x445538){return{'model':db[_0x445538[_0x2b5c('0x1e')]],'as':_0x445538['as'],'attributes':_0x445538[_0x2b5c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2b5c('0xd')](function(_0x1e29ce){logger['info'](_0x2b5c('0x17'),_0x496c5f);logger['debug'](_0x2b5c('0x17'),_0x496c5f,JSON[_0x2b5c('0x10')](_0x1e29ce));_0x3fcf35(_0x1e29ce);})[_0x2b5c('0x16')](function(_0x49760e){logger[_0x2b5c('0x11')]('GetFreshdeskAccount',_0x49760e[_0x2b5c('0x14')],_0x496c5f);_0x496057(_0x55bfd9[_0x2b5c('0x11')](0x1f4,_0x49760e['message']));});});};exports[_0x2b5c('0x1f')]=function(_0x5bf810){var _0x374b6c=this;return new Promise(function(_0x2725b5,_0x11be63){return db[_0x2b5c('0x18')][_0x2b5c('0x20')]({'raw':_0x5bf810[_0x2b5c('0x19')]?_0x5bf810[_0x2b5c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5bf810[_0x2b5c('0x19')]?_0x5bf810['options'][_0x2b5c('0x1a')]||null:null,'attributes':_0x5bf810[_0x2b5c('0x19')]?_0x5bf810[_0x2b5c('0x19')][_0x2b5c('0x1b')]||null:null,'include':_0x5bf810[_0x2b5c('0x19')]?_0x5bf810[_0x2b5c('0x19')]['include']?_[_0x2b5c('0x1c')](_0x5bf810[_0x2b5c('0x19')][_0x2b5c('0x1d')],function(_0x1fd634){return{'model':db[_0x1fd634[_0x2b5c('0x1e')]],'as':_0x1fd634['as'],'attributes':_0x1fd634[_0x2b5c('0x1b')],'include':_0x1fd634[_0x2b5c('0x1d')]?_[_0x2b5c('0x1c')](_0x1fd634['include'],function(_0x404f59){return{'model':db[_0x404f59[_0x2b5c('0x1e')]],'as':_0x404f59['as'],'attributes':_0x404f59[_0x2b5c('0x1b')],'include':_0x404f59['include']?_['map'](_0x404f59['include'],function(_0x1ab595){return{'model':db[_0x1ab595[_0x2b5c('0x1e')]],'as':_0x1ab595['as'],'attributes':_0x1ab595[_0x2b5c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2658ad){logger[_0x2b5c('0x21')](_0x2b5c('0x1f'),_0x5bf810);logger['debug'](_0x2b5c('0x1f'),_0x5bf810,JSON['stringify'](_0x2658ad));_0x2725b5(_0x2658ad);})[_0x2b5c('0x16')](function(_0xab48ec){logger[_0x2b5c('0x11')](_0x2b5c('0x1f'),_0xab48ec[_0x2b5c('0x14')],_0x5bf810);_0x11be63(_0x374b6c[_0x2b5c('0x11')](0x1f4,_0xab48ec['message']));});});}; \ No newline at end of file +var _0x6259=['limit','include','model','map','stringify','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes'];(function(_0x32dd60,_0x3088b1){var _0x4db97f=function(_0x3fe212){while(--_0x3fe212){_0x32dd60['push'](_0x32dd60['shift']());}};_0x4db97f(++_0x3088b1);}(_0x6259,0xfc));var _0x9625=function(_0x53d48c,_0x58575d){_0x53d48c=_0x53d48c-0x0;var _0x2888a9=_0x6259[_0x53d48c];return _0x2888a9;};'use strict';var _=require(_0x9625('0x0'));var util=require(_0x9625('0x1'));var moment=require(_0x9625('0x2'));var BPromise=require(_0x9625('0x3'));var rs=require(_0x9625('0x4'));var fs=require('fs');var Redis=require(_0x9625('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9625('0x6'))('rpc');var config=require(_0x9625('0x7'));var jayson=require(_0x9625('0x8'));var client=jayson[_0x9625('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26de2d,_0x43cf62,_0x475ec3){return new BPromise(function(_0x202f3a,_0x1d0487){return client[_0x9625('0xa')](_0x26de2d,_0x475ec3)[_0x9625('0xb')](function(_0x10d710){logger[_0x9625('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x43cf62,_0x9625('0xd'));logger[_0x9625('0xe')](_0x9625('0xf'),_0x43cf62,_0x9625('0xd'),JSON['stringify'](_0x10d710));if(_0x10d710[_0x9625('0x10')]){if(_0x10d710['error'][_0x9625('0x11')]===0x1f4){logger[_0x9625('0x10')](_0x9625('0x12'),_0x43cf62,_0x10d710['error'][_0x9625('0x13')]);return _0x1d0487(_0x10d710[_0x9625('0x10')][_0x9625('0x13')]);}logger[_0x9625('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x43cf62,_0x10d710[_0x9625('0x10')]['message']);return _0x202f3a(_0x10d710[_0x9625('0x10')][_0x9625('0x13')]);}else{logger[_0x9625('0xc')](_0x9625('0x12'),_0x43cf62,'request\x20sent');_0x202f3a(_0x10d710[_0x9625('0x14')][_0x9625('0x13')]);}})[_0x9625('0x15')](function(_0x281c58){logger[_0x9625('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x43cf62,_0x281c58);_0x1d0487(_0x281c58);});});}exports[_0x9625('0x16')]=function(_0x4f1b09){var _0x8a8838=this;return new Promise(function(_0x349272,_0x4e2042){return db[_0x9625('0x17')]['findAll']({'raw':_0x4f1b09[_0x9625('0x18')]?_0x4f1b09['options'][_0x9625('0x19')]===undefined?!![]:![]:!![],'where':_0x4f1b09[_0x9625('0x18')]?_0x4f1b09[_0x9625('0x18')][_0x9625('0x1a')]||null:null,'attributes':_0x4f1b09[_0x9625('0x18')]?_0x4f1b09['options'][_0x9625('0x1b')]||null:null,'limit':_0x4f1b09[_0x9625('0x18')]?_0x4f1b09[_0x9625('0x18')][_0x9625('0x1c')]||null:null,'include':_0x4f1b09[_0x9625('0x18')]?_0x4f1b09[_0x9625('0x18')][_0x9625('0x1d')]?_['map'](_0x4f1b09[_0x9625('0x18')][_0x9625('0x1d')],function(_0x4147e7){return{'model':db[_0x4147e7[_0x9625('0x1e')]],'as':_0x4147e7['as'],'attributes':_0x4147e7[_0x9625('0x1b')],'include':_0x4147e7[_0x9625('0x1d')]?_[_0x9625('0x1f')](_0x4147e7[_0x9625('0x1d')],function(_0x2afe4b){return{'model':db[_0x2afe4b[_0x9625('0x1e')]],'as':_0x2afe4b['as'],'attributes':_0x2afe4b[_0x9625('0x1b')],'include':_0x2afe4b[_0x9625('0x1d')]?_[_0x9625('0x1f')](_0x2afe4b[_0x9625('0x1d')],function(_0x1a6b73){return{'model':db[_0x1a6b73['model']],'as':_0x1a6b73['as'],'attributes':_0x1a6b73[_0x9625('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcd5387){logger[_0x9625('0xc')](_0x9625('0x16'),_0x4f1b09);logger[_0x9625('0xe')]('GetFreshdeskAccount',_0x4f1b09,JSON[_0x9625('0x20')](_0xcd5387));_0x349272(_0xcd5387);})[_0x9625('0x15')](function(_0x2522e0){logger[_0x9625('0x10')](_0x9625('0x16'),_0x2522e0[_0x9625('0x13')],_0x4f1b09);_0x4e2042(_0x8a8838[_0x9625('0x10')](0x1f4,_0x2522e0[_0x9625('0x13')]));});});};exports[_0x9625('0x21')]=function(_0xe5b378){var _0x37c80d=this;return new Promise(function(_0xa8fcb4,_0x4440f3){return db[_0x9625('0x17')][_0x9625('0x22')]({'raw':_0xe5b378[_0x9625('0x18')]?_0xe5b378['options'][_0x9625('0x19')]===undefined?!![]:![]:!![],'where':_0xe5b378[_0x9625('0x18')]?_0xe5b378[_0x9625('0x18')][_0x9625('0x1a')]||null:null,'attributes':_0xe5b378['options']?_0xe5b378[_0x9625('0x18')][_0x9625('0x1b')]||null:null,'include':_0xe5b378[_0x9625('0x18')]?_0xe5b378[_0x9625('0x18')]['include']?_['map'](_0xe5b378[_0x9625('0x18')][_0x9625('0x1d')],function(_0x4f41d4){return{'model':db[_0x4f41d4['model']],'as':_0x4f41d4['as'],'attributes':_0x4f41d4['attributes'],'include':_0x4f41d4[_0x9625('0x1d')]?_['map'](_0x4f41d4[_0x9625('0x1d')],function(_0x33171d){return{'model':db[_0x33171d[_0x9625('0x1e')]],'as':_0x33171d['as'],'attributes':_0x33171d['attributes'],'include':_0x33171d[_0x9625('0x1d')]?_[_0x9625('0x1f')](_0x33171d[_0x9625('0x1d')],function(_0x19a50e){return{'model':db[_0x19a50e[_0x9625('0x1e')]],'as':_0x19a50e['as'],'attributes':_0x19a50e[_0x9625('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9625('0xb')](function(_0x515a53){logger['info'](_0x9625('0x21'),_0xe5b378);logger['debug'](_0x9625('0x21'),_0xe5b378,JSON[_0x9625('0x20')](_0x515a53));_0xa8fcb4(_0x515a53);})['catch'](function(_0x1857d1){logger[_0x9625('0x10')](_0x9625('0x21'),_0x1857d1[_0x9625('0x13')],_0xe5b378);_0x4440f3(_0x37c80d[_0x9625('0x10')](0x1f4,_0x1857d1['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 2739a7a..d0cbb67 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 _0x9bc1=['post','update','destroy','exports','multer','util','path','express','Router','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bc1,0xe0));var _0x19bc=function(_0x4460fb,_0x3d20e8){_0x4460fb=_0x4460fb-0x0;var _0x222b46=_0x9bc1[_0x4460fb];return _0x222b46;};'use strict';var multer=require(_0x19bc('0x0'));var util=require(_0x19bc('0x1'));var path=require(_0x19bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x19bc('0x3'));var router=express[_0x19bc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19bc('0x5'));var controller=require(_0x19bc('0x6'));router[_0x19bc('0x7')]('/',auth['isAuthenticated'](),controller[_0x19bc('0x8')]);router[_0x19bc('0x7')](_0x19bc('0x9'),auth['isAuthenticated'](),controller[_0x19bc('0xa')]);router[_0x19bc('0x7')]('/:id/fields',auth[_0x19bc('0xb')](),controller[_0x19bc('0xc')]);router['get'](_0x19bc('0xd'),auth['isAuthenticated'](),controller[_0x19bc('0xe')]);router[_0x19bc('0x7')](_0x19bc('0xf'),auth[_0x19bc('0xb')](),controller['getDescriptions']);router[_0x19bc('0x7')](_0x19bc('0x10'),auth[_0x19bc('0xb')](),controller[_0x19bc('0x11')]);router[_0x19bc('0x12')]('/',auth[_0x19bc('0xb')](),controller['create']);router[_0x19bc('0x12')](_0x19bc('0x10'),auth[_0x19bc('0xb')](),controller['setTags']);router['put']('/:id',auth[_0x19bc('0xb')](),controller[_0x19bc('0x13')]);router['delete'](_0x19bc('0x9'),auth['isAuthenticated'](),controller[_0x19bc('0x14')]);module[_0x19bc('0x15')]=router; \ No newline at end of file +var _0x25e5=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','put','/:id','update','delete','destroy'];(function(_0x53298a,_0x1660b6){var _0x232e46=function(_0x52413b){while(--_0x52413b){_0x53298a['push'](_0x53298a['shift']());}};_0x232e46(++_0x1660b6);}(_0x25e5,0xa9));var _0x525e=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x25e5[_0x3db122];return _0x325b67;};'use strict';var multer=require(_0x525e('0x0'));var util=require(_0x525e('0x1'));var path=require('path');var timeout=require(_0x525e('0x2'));var express=require(_0x525e('0x3'));var router=express[_0x525e('0x4')]();var auth=require(_0x525e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x525e('0x6'));var controller=require(_0x525e('0x7'));router[_0x525e('0x8')]('/',auth[_0x525e('0x9')](),controller[_0x525e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x525e('0xb')]);router[_0x525e('0x8')](_0x525e('0xc'),auth[_0x525e('0x9')](),controller[_0x525e('0xd')]);router[_0x525e('0x8')](_0x525e('0xe'),auth[_0x525e('0x9')](),controller[_0x525e('0xf')]);router['get'](_0x525e('0x10'),auth[_0x525e('0x9')](),controller[_0x525e('0x11')]);router[_0x525e('0x8')](_0x525e('0x12'),auth[_0x525e('0x9')](),controller['getTags']);router['post']('/',auth[_0x525e('0x9')](),controller[_0x525e('0x13')]);router[_0x525e('0x14')](_0x525e('0x12'),auth[_0x525e('0x9')](),controller[_0x525e('0x15')]);router[_0x525e('0x16')](_0x525e('0x17'),auth[_0x525e('0x9')](),controller[_0x525e('0x18')]);router[_0x525e('0x19')](_0x525e('0x17'),auth[_0x525e('0x9')](),controller[_0x525e('0x1a')]);module[_0x525e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 400e7a4..312fb5c 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 _0xd80b=['STRING','sequelize'];(function(_0x11ab09,_0xfcefe7){var _0x48314a=function(_0xc5492d){while(--_0xc5492d){_0x11ab09['push'](_0x11ab09['shift']());}};_0x48314a(++_0xfcefe7);}(_0xd80b,0x1cd));var _0xbd80=function(_0x460cdb,_0x3929ba){_0x460cdb=_0x460cdb-0x0;var _0x2b7e30=_0xd80b[_0x460cdb];return _0x2b7e30;};'use strict';var Sequelize=require(_0xbd80('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd80('0x1')]},'description':{'type':Sequelize[_0xbd80('0x1')]}}; \ No newline at end of file +var _0x2b01=['exports','STRING','sequelize'];(function(_0x2b8048,_0x1ed78a){var _0xd5eb33=function(_0x4e4619){while(--_0x4e4619){_0x2b8048['push'](_0x2b8048['shift']());}};_0xd5eb33(++_0x1ed78a);}(_0x2b01,0x188));var _0x12b0=function(_0x8a8990,_0x332eeb){_0x8a8990=_0x8a8990-0x0;var _0x58a572=_0x2b01[_0x8a8990];return _0x58a572;};'use strict';var Sequelize=require(_0x12b0('0x0'));module[_0x12b0('0x1')]={'name':{'type':Sequelize[_0x12b0('0x2')]},'description':{'type':Sequelize[_0x12b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f5532e9..ce53e73 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 _0x6666=['findAll','rows','show','params','length','options','find','create','body','findOne','FreshdeskField','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','includeAll','include'];(function(_0x296ddf,_0x1da783){var _0x4da5b9=function(_0x39fc32){while(--_0x39fc32){_0x296ddf['push'](_0x296ddf['shift']());}};_0x4da5b9(++_0x1da783);}(_0x6666,0x6e));var _0x6666=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0x6666[_0x15a634];return _0xf4f7a0;};'use strict';var pdf=require(_0x6666('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6666('0x1'));var moment=require(_0x6666('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6666('0x3'));var path=require(_0x6666('0x4'));var sox=require(_0x6666('0x5'));var csv=require(_0x6666('0x6'));var ejs=require(_0x6666('0x7'));var fs=require('fs');var _=require(_0x6666('0x8'));var squel=require(_0x6666('0x9'));var crypto=require(_0x6666('0xa'));var jsforce=require(_0x6666('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6666('0x6'));var querystring=require(_0x6666('0xc'));var Papa=require(_0x6666('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6666('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6666('0xf'));var logger=require('../../config/logger')(_0x6666('0x10'));var utils=require('../../config/utils');var config=require(_0x6666('0x11'));var db=require(_0x6666('0x12'))['db'];var jayson=require(_0x6666('0x13'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5c8fc9,_0x11d408,_0x4d154a){if(_0x4d154a){var _0x10466d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10466d[_0x6666('0x14')](_0x11d408)){return _0x5c8fc9;}else{throw new db['Sequelize'][(_0x6666('0x15'))](_0x6666('0x16'));}}else{return _0x5c8fc9;}}function respondWithRpcPromise(_0x114ef6,_0x383a49,_0x181358,_0x403ef1){return new BPromise(function(_0x5ccfe0,_0x52762c){var _0xf731ec=_0x403ef1||client;return _0xf731ec[_0x6666('0x17')](_0x114ef6,_0x181358)[_0x6666('0x18')](function(_0x4c7f2d){logger[_0x6666('0x19')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x383a49,_0x6666('0x1a'));logger[_0x6666('0x1b')](_0x6666('0x1c'),_0x383a49,_0x6666('0x1a'),JSON[_0x6666('0x1d')](_0x4c7f2d));if(_0x4c7f2d[_0x6666('0x1e')]){if(_0x4c7f2d['error']['code']===0x1f4){logger[_0x6666('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x383a49,_0x4c7f2d[_0x6666('0x1e')][_0x6666('0x1f')]);return _0x52762c(_0x4c7f2d['error'][_0x6666('0x1f')]);}logger[_0x6666('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x383a49,_0x4c7f2d['error'][_0x6666('0x1f')]);return _0x5ccfe0(_0x4c7f2d[_0x6666('0x1e')]['message']);}else{logger[_0x6666('0x19')](_0x6666('0x20'),_0x383a49,_0x6666('0x1a'));_0x5ccfe0(_0x4c7f2d[_0x6666('0x21')][_0x6666('0x1f')]);}})[_0x6666('0x22')](function(_0x33ae47){logger[_0x6666('0x1e')](_0x6666('0x20'),_0x383a49,_0x33ae47);_0x52762c(_0x33ae47);});});}function respondWithStatusCode(_0x3d53b3,_0x3fbc92){_0x3fbc92=_0x3fbc92||0xcc;return function(_0xf75f6a){if(_0xf75f6a){return _0x3d53b3[_0x6666('0x23')](_0x3fbc92);}return _0x3d53b3[_0x6666('0x24')](_0x3fbc92)[_0x6666('0x25')]();};}function respondWithResult(_0x300f4d,_0x487c17){_0x487c17=_0x487c17||0xc8;return function(_0x5f0212){if(_0x5f0212){return _0x300f4d[_0x6666('0x24')](_0x487c17)[_0x6666('0x26')](_0x5f0212);}};}function respondWithFilteredResult(_0x415a51,_0x4e40d5){return function(_0x2bfcaf){if(_0x2bfcaf){var _0x509dab=_0x2bfcaf[_0x6666('0x27')],_0xe911f2=_0x4e40d5['offset'],_0x321b1f=_0x4e40d5[_0x6666('0x28')]+_0x4e40d5[_0x6666('0x29')],_0x3c7522;if(_0x321b1f>=_0x509dab){_0x321b1f=_0x509dab;_0x3c7522=0xc8;}else{_0x3c7522=0xce;}_0x415a51[_0x6666('0x24')](_0x3c7522);return _0x415a51['set'](_0x6666('0x2a'),_0xe911f2+'-'+_0x321b1f+'/'+_0x509dab)['json'](_0x2bfcaf);}return null;};}function patchUpdates(_0x8aef6b){return function(_0x6e1a83){try{jsonpatch['apply'](_0x6e1a83,_0x8aef6b,!![]);}catch(_0x532be8){return BPromise[_0x6666('0x2b')](_0x532be8);}return _0x6e1a83[_0x6666('0x2c')]();};}function saveUpdates(_0xaa2894,_0x597280){return function(_0x3795cd){if(_0x3795cd){return _0x3795cd[_0x6666('0x2d')](_0xaa2894)['then'](function(_0x59b166){return _0x59b166;});}return null;};}function removeEntity(_0x297ce3,_0x30d2d5){return function(_0x450db9){if(_0x450db9){return _0x450db9[_0x6666('0x2e')]()[_0x6666('0x18')](function(){_0x297ce3[_0x6666('0x24')](0xcc)[_0x6666('0x25')]();});}};}function handleEntityNotFound(_0x52c7cd,_0x583cb2){return function(_0x33237a){if(!_0x33237a){_0x52c7cd[_0x6666('0x23')](0x194);}return _0x33237a;};}function handleError(_0x551568,_0x4c11c3){_0x4c11c3=_0x4c11c3||0x1f4;return function(_0x5ad580){logger[_0x6666('0x1e')](_0x5ad580[_0x6666('0x2f')]);if(_0x5ad580[_0x6666('0x30')]){delete _0x5ad580[_0x6666('0x30')];}_0x551568[_0x6666('0x24')](_0x4c11c3)[_0x6666('0x31')](_0x5ad580);};}exports[_0x6666('0x32')]=function(_0x3fd710,_0x1166fd){var _0x1d3ef8={},_0x2e4ed4={},_0x3ea400={'count':0x0,'rows':[]};var _0x34f908=_['map'](db[_0x6666('0x33')][_0x6666('0x34')],function(_0x1f99c4){return{'name':_0x1f99c4['fieldName'],'type':_0x1f99c4[_0x6666('0x35')]['key']};});_0x2e4ed4[_0x6666('0x36')]=_[_0x6666('0x37')](_0x34f908,_0x6666('0x30'));_0x2e4ed4[_0x6666('0x38')]=_[_0x6666('0x39')](_0x3fd710[_0x6666('0x38')]);_0x2e4ed4[_0x6666('0x3a')]=_[_0x6666('0x3b')](_0x2e4ed4['model'],_0x2e4ed4['query']);_0x1d3ef8[_0x6666('0x3c')]=_[_0x6666('0x3b')](_0x2e4ed4[_0x6666('0x36')],qs[_0x6666('0x3d')](_0x3fd710[_0x6666('0x38')][_0x6666('0x3d')]));_0x1d3ef8['attributes']=_0x1d3ef8['attributes']['length']?_0x1d3ef8['attributes']:_0x2e4ed4[_0x6666('0x36')];if(!_0x3fd710[_0x6666('0x38')]['hasOwnProperty'](_0x6666('0x3e'))){_0x1d3ef8['limit']=qs[_0x6666('0x29')](_0x3fd710['query']['limit']);_0x1d3ef8['offset']=qs[_0x6666('0x28')](_0x3fd710[_0x6666('0x38')][_0x6666('0x28')]);}_0x1d3ef8[_0x6666('0x3f')]=qs['sort'](_0x3fd710[_0x6666('0x38')][_0x6666('0x40')]);_0x1d3ef8[_0x6666('0x41')]=qs[_0x6666('0x3a')](_['pick'](_0x3fd710[_0x6666('0x38')],_0x2e4ed4['filters']),_0x34f908);if(_0x3fd710[_0x6666('0x38')][_0x6666('0x42')]){_0x1d3ef8[_0x6666('0x41')]=_[_0x6666('0x43')](_0x1d3ef8[_0x6666('0x41')],{'$or':_[_0x6666('0x37')](_0x34f908,function(_0x13d5ec){if(_0x13d5ec[_0x6666('0x35')]!=='VIRTUAL'){var _0x5e7967={};_0x5e7967[_0x13d5ec['name']]={'$like':'%'+_0x3fd710[_0x6666('0x38')][_0x6666('0x42')]+'%'};return _0x5e7967;}})});}_0x1d3ef8=_['merge']({},_0x1d3ef8,_0x3fd710['options']);var _0x4ba79c={'where':_0x1d3ef8[_0x6666('0x41')]};return db[_0x6666('0x33')][_0x6666('0x27')](_0x4ba79c)[_0x6666('0x18')](function(_0x5c5ee5){_0x3ea400['count']=_0x5c5ee5;if(_0x3fd710[_0x6666('0x38')][_0x6666('0x44')]){_0x1d3ef8[_0x6666('0x45')]=[{'all':!![]}];}return db[_0x6666('0x33')][_0x6666('0x46')](_0x1d3ef8);})[_0x6666('0x18')](function(_0x1e3b04){_0x3ea400[_0x6666('0x47')]=_0x1e3b04;return _0x3ea400;})[_0x6666('0x18')](respondWithFilteredResult(_0x1166fd,_0x1d3ef8))[_0x6666('0x22')](handleError(_0x1166fd,null));};exports[_0x6666('0x48')]=function(_0x359fbd,_0x5988c1){var _0xc78a70={'raw':![],'where':{'id':_0x359fbd[_0x6666('0x49')]['id']}},_0xd63929={};_0xd63929[_0x6666('0x36')]=_[_0x6666('0x39')](db['FreshdeskConfiguration'][_0x6666('0x34')]);_0xd63929['query']=_[_0x6666('0x39')](_0x359fbd['query']);_0xd63929[_0x6666('0x3a')]=_[_0x6666('0x3b')](_0xd63929[_0x6666('0x36')],_0xd63929[_0x6666('0x38')]);_0xc78a70[_0x6666('0x3c')]=_['intersection'](_0xd63929[_0x6666('0x36')],qs[_0x6666('0x3d')](_0x359fbd[_0x6666('0x38')][_0x6666('0x3d')]));_0xc78a70['attributes']=_0xc78a70['attributes'][_0x6666('0x4a')]?_0xc78a70[_0x6666('0x3c')]:_0xd63929[_0x6666('0x36')];if(_0x359fbd[_0x6666('0x38')][_0x6666('0x44')]){_0xc78a70[_0x6666('0x45')]=[{'all':!![]}];}_0xc78a70=_[_0x6666('0x43')]({},_0xc78a70,_0x359fbd[_0x6666('0x4b')]);return db[_0x6666('0x33')][_0x6666('0x4c')](_0xc78a70)[_0x6666('0x18')](handleEntityNotFound(_0x5988c1,null))['then'](respondWithResult(_0x5988c1,null))[_0x6666('0x22')](handleError(_0x5988c1,null));};exports[_0x6666('0x4d')]=function(_0x4cc54b,_0x3827bd){return db['FreshdeskConfiguration']['create'](_0x4cc54b['body'],{})[_0x6666('0x18')](respondWithResult(_0x3827bd,0xc9))[_0x6666('0x22')](handleError(_0x3827bd,null));};exports[_0x6666('0x2d')]=function(_0x1e0964,_0x4ac84f){if(_0x1e0964[_0x6666('0x4e')]['id']){delete _0x1e0964[_0x6666('0x4e')]['id'];}return db[_0x6666('0x33')][_0x6666('0x4c')]({'where':{'id':_0x1e0964['params']['id']}})['then'](handleEntityNotFound(_0x4ac84f,null))[_0x6666('0x18')](saveUpdates(_0x1e0964[_0x6666('0x4e')],null))[_0x6666('0x18')](respondWithResult(_0x4ac84f,null))[_0x6666('0x22')](handleError(_0x4ac84f,null));};exports[_0x6666('0x2e')]=function(_0x3b0431,_0x2b03f9){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x3b0431['params']['id']}})[_0x6666('0x18')](handleEntityNotFound(_0x2b03f9,null))[_0x6666('0x18')](removeEntity(_0x2b03f9,null))[_0x6666('0x22')](handleError(_0x2b03f9,null));};exports['getFields']=function(_0x20bae4,_0x3528bd,_0x34786f){var _0x46c1df={};var _0x4b20c2={};var _0x3ad9cb;var _0x2fee26;return db[_0x6666('0x33')][_0x6666('0x4f')]({'where':{'id':_0x20bae4[_0x6666('0x49')]['id']}})[_0x6666('0x18')](handleEntityNotFound(_0x3528bd,null))[_0x6666('0x18')](function(_0x2fc6e6){if(_0x2fc6e6){_0x3ad9cb=_0x2fc6e6;_0x4b20c2[_0x6666('0x36')]=_[_0x6666('0x39')](db[_0x6666('0x50')][_0x6666('0x34')]);_0x4b20c2[_0x6666('0x38')]=_[_0x6666('0x39')](_0x20bae4[_0x6666('0x38')]);_0x4b20c2[_0x6666('0x3a')]=_[_0x6666('0x3b')](_0x4b20c2[_0x6666('0x36')],_0x4b20c2[_0x6666('0x38')]);_0x46c1df[_0x6666('0x3c')]=_[_0x6666('0x3b')](_0x4b20c2['model'],qs[_0x6666('0x3d')](_0x20bae4[_0x6666('0x38')]['fields']));_0x46c1df[_0x6666('0x3c')]=_0x46c1df['attributes']['length']?_0x46c1df['attributes']:_0x4b20c2[_0x6666('0x36')];_0x46c1df[_0x6666('0x3f')]=qs[_0x6666('0x40')](_0x20bae4[_0x6666('0x38')][_0x6666('0x40')]);_0x46c1df[_0x6666('0x41')]=qs[_0x6666('0x3a')](_[_0x6666('0x51')](_0x20bae4[_0x6666('0x38')],_0x4b20c2[_0x6666('0x3a')]));if(_0x20bae4['query']['filter']){_0x46c1df[_0x6666('0x41')]=_['merge'](_0x46c1df[_0x6666('0x41')],{'$or':_['map'](_0x46c1df[_0x6666('0x3c')],function(_0x154171){var _0x13a8c1={};_0x13a8c1[_0x154171]={'$like':'%'+_0x20bae4[_0x6666('0x38')][_0x6666('0x42')]+'%'};return _0x13a8c1;})});}_0x46c1df=_['merge']({},_0x46c1df,_0x20bae4[_0x6666('0x4b')]);return _0x3ad9cb[_0x6666('0x52')](_0x46c1df);}})[_0x6666('0x18')](function(_0x297ceb){if(_0x297ceb){_0x2fee26=_0x297ceb[_0x6666('0x4a')];if(!_0x20bae4[_0x6666('0x38')][_0x6666('0x53')](_0x6666('0x3e'))){_0x46c1df[_0x6666('0x29')]=qs[_0x6666('0x29')](_0x20bae4[_0x6666('0x38')][_0x6666('0x29')]);_0x46c1df['offset']=qs[_0x6666('0x28')](_0x20bae4[_0x6666('0x38')][_0x6666('0x28')]);}return _0x3ad9cb[_0x6666('0x52')](_0x46c1df);}})[_0x6666('0x18')](function(_0x5946f5){if(_0x5946f5){return _0x5946f5?{'count':_0x2fee26,'rows':_0x5946f5}:null;}})['then'](respondWithResult(_0x3528bd,null))[_0x6666('0x22')](handleError(_0x3528bd,null));};exports[_0x6666('0x54')]=function(_0x27a804,_0x1dfee6,_0x308948){var _0xbc692e={};var _0x4ca975={};var _0x416a09;var _0x585520;return db[_0x6666('0x33')][_0x6666('0x4f')]({'where':{'id':_0x27a804[_0x6666('0x49')]['id']}})[_0x6666('0x18')](handleEntityNotFound(_0x1dfee6,null))[_0x6666('0x18')](function(_0xce77a4){if(_0xce77a4){_0x416a09=_0xce77a4;_0x4ca975[_0x6666('0x36')]=_[_0x6666('0x39')](db['FreshdeskField'][_0x6666('0x34')]);_0x4ca975[_0x6666('0x38')]=_['keys'](_0x27a804[_0x6666('0x38')]);_0x4ca975['filters']=_[_0x6666('0x3b')](_0x4ca975[_0x6666('0x36')],_0x4ca975[_0x6666('0x38')]);_0xbc692e[_0x6666('0x3c')]=_['intersection'](_0x4ca975[_0x6666('0x36')],qs['fields'](_0x27a804['query']['fields']));_0xbc692e[_0x6666('0x3c')]=_0xbc692e['attributes'][_0x6666('0x4a')]?_0xbc692e[_0x6666('0x3c')]:_0x4ca975[_0x6666('0x36')];_0xbc692e[_0x6666('0x3f')]=qs[_0x6666('0x40')](_0x27a804[_0x6666('0x38')][_0x6666('0x40')]);_0xbc692e[_0x6666('0x41')]=qs[_0x6666('0x3a')](_[_0x6666('0x51')](_0x27a804['query'],_0x4ca975[_0x6666('0x3a')]));if(_0x27a804['query'][_0x6666('0x42')]){_0xbc692e[_0x6666('0x41')]=_[_0x6666('0x43')](_0xbc692e[_0x6666('0x41')],{'$or':_[_0x6666('0x37')](_0xbc692e[_0x6666('0x3c')],function(_0x2cd09f){var _0x135578={};_0x135578[_0x2cd09f]={'$like':'%'+_0x27a804[_0x6666('0x38')][_0x6666('0x42')]+'%'};return _0x135578;})});}_0xbc692e=_[_0x6666('0x43')]({},_0xbc692e,_0x27a804[_0x6666('0x4b')]);return _0x416a09[_0x6666('0x54')](_0xbc692e);}})[_0x6666('0x18')](function(_0x200d91){if(_0x200d91){_0x585520=_0x200d91[_0x6666('0x4a')];if(!_0x27a804[_0x6666('0x38')][_0x6666('0x53')](_0x6666('0x3e'))){_0xbc692e[_0x6666('0x29')]=qs['limit'](_0x27a804[_0x6666('0x38')][_0x6666('0x29')]);_0xbc692e[_0x6666('0x28')]=qs[_0x6666('0x28')](_0x27a804[_0x6666('0x38')][_0x6666('0x28')]);}return _0x416a09[_0x6666('0x54')](_0xbc692e);}})[_0x6666('0x18')](function(_0xae7dd6){if(_0xae7dd6){return _0xae7dd6?{'count':_0x585520,'rows':_0xae7dd6}:null;}})[_0x6666('0x18')](respondWithResult(_0x1dfee6,null))[_0x6666('0x22')](handleError(_0x1dfee6,null));};exports[_0x6666('0x55')]=function(_0x519973,_0x2a5de0,_0x54c073){var _0xe6f9e7={};var _0x1173bd={};var _0x35117d;var _0x5d0258;return db[_0x6666('0x33')]['findOne']({'where':{'id':_0x519973['params']['id']}})['then'](handleEntityNotFound(_0x2a5de0,null))[_0x6666('0x18')](function(_0x25b19){if(_0x25b19){_0x35117d=_0x25b19;_0x1173bd[_0x6666('0x36')]=_['keys'](db[_0x6666('0x50')][_0x6666('0x34')]);_0x1173bd[_0x6666('0x38')]=_[_0x6666('0x39')](_0x519973[_0x6666('0x38')]);_0x1173bd[_0x6666('0x3a')]=_[_0x6666('0x3b')](_0x1173bd[_0x6666('0x36')],_0x1173bd['query']);_0xe6f9e7[_0x6666('0x3c')]=_['intersection'](_0x1173bd[_0x6666('0x36')],qs[_0x6666('0x3d')](_0x519973['query'][_0x6666('0x3d')]));_0xe6f9e7[_0x6666('0x3c')]=_0xe6f9e7[_0x6666('0x3c')][_0x6666('0x4a')]?_0xe6f9e7[_0x6666('0x3c')]:_0x1173bd[_0x6666('0x36')];_0xe6f9e7[_0x6666('0x3f')]=qs[_0x6666('0x40')](_0x519973['query'][_0x6666('0x40')]);_0xe6f9e7['where']=qs['filters'](_['pick'](_0x519973[_0x6666('0x38')],_0x1173bd['filters']));if(_0x519973['query']['filter']){_0xe6f9e7[_0x6666('0x41')]=_[_0x6666('0x43')](_0xe6f9e7[_0x6666('0x41')],{'$or':_['map'](_0xe6f9e7[_0x6666('0x3c')],function(_0x16a5ba){var _0x3f079e={};_0x3f079e[_0x16a5ba]={'$like':'%'+_0x519973['query'][_0x6666('0x42')]+'%'};return _0x3f079e;})});}_0xe6f9e7=_[_0x6666('0x43')]({},_0xe6f9e7,_0x519973[_0x6666('0x4b')]);return _0x35117d[_0x6666('0x55')](_0xe6f9e7);}})[_0x6666('0x18')](function(_0x17f814){if(_0x17f814){_0x5d0258=_0x17f814[_0x6666('0x4a')];if(!_0x519973[_0x6666('0x38')][_0x6666('0x53')]('nolimit')){_0xe6f9e7[_0x6666('0x29')]=qs[_0x6666('0x29')](_0x519973[_0x6666('0x38')][_0x6666('0x29')]);_0xe6f9e7[_0x6666('0x28')]=qs[_0x6666('0x28')](_0x519973['query'][_0x6666('0x28')]);}return _0x35117d['getDescriptions'](_0xe6f9e7);}})[_0x6666('0x18')](function(_0x2c09ba){if(_0x2c09ba){return _0x2c09ba?{'count':_0x5d0258,'rows':_0x2c09ba}:null;}})[_0x6666('0x18')](respondWithResult(_0x2a5de0,null))[_0x6666('0x22')](handleError(_0x2a5de0,null));};exports[_0x6666('0x56')]=function(_0x1d739a,_0x7ed298,_0x365b84){var _0x4ab225={};var _0x2be903={};var _0x137a9f;var _0x488345;return db['FreshdeskConfiguration'][_0x6666('0x4f')]({'where':{'id':_0x1d739a[_0x6666('0x49')]['id']}})[_0x6666('0x18')](handleEntityNotFound(_0x7ed298,null))[_0x6666('0x18')](function(_0x4c4046){if(_0x4c4046){_0x137a9f=_0x4c4046;_0x2be903[_0x6666('0x36')]=_[_0x6666('0x39')](db[_0x6666('0x57')][_0x6666('0x34')]);_0x2be903[_0x6666('0x38')]=_[_0x6666('0x39')](_0x1d739a[_0x6666('0x38')]);_0x2be903[_0x6666('0x3a')]=_[_0x6666('0x3b')](_0x2be903[_0x6666('0x36')],_0x2be903[_0x6666('0x38')]);_0x4ab225['attributes']=_[_0x6666('0x3b')](_0x2be903['model'],qs[_0x6666('0x3d')](_0x1d739a[_0x6666('0x38')][_0x6666('0x3d')]));_0x4ab225[_0x6666('0x3c')]=_0x4ab225[_0x6666('0x3c')][_0x6666('0x4a')]?_0x4ab225[_0x6666('0x3c')]:_0x2be903[_0x6666('0x36')];_0x4ab225['order']=qs['sort'](_0x1d739a[_0x6666('0x38')][_0x6666('0x40')]);_0x4ab225[_0x6666('0x41')]=qs[_0x6666('0x3a')](_[_0x6666('0x51')](_0x1d739a[_0x6666('0x38')],_0x2be903['filters']));if(_0x1d739a[_0x6666('0x38')][_0x6666('0x42')]){_0x4ab225[_0x6666('0x41')]=_[_0x6666('0x43')](_0x4ab225['where'],{'$or':_[_0x6666('0x37')](_0x4ab225['attributes'],function(_0xd6dc94){var _0x526920={};_0x526920[_0xd6dc94]={'$like':'%'+_0x1d739a['query'][_0x6666('0x42')]+'%'};return _0x526920;})});}_0x4ab225=_[_0x6666('0x43')]({},_0x4ab225,_0x1d739a[_0x6666('0x4b')]);return _0x137a9f[_0x6666('0x56')](_0x4ab225);}})[_0x6666('0x18')](function(_0x5757e9){if(_0x5757e9){_0x488345=_0x5757e9[_0x6666('0x4a')];if(!_0x1d739a[_0x6666('0x38')][_0x6666('0x53')]('nolimit')){_0x4ab225['limit']=qs[_0x6666('0x29')](_0x1d739a[_0x6666('0x38')]['limit']);_0x4ab225['offset']=qs[_0x6666('0x28')](_0x1d739a[_0x6666('0x38')][_0x6666('0x28')]);}return _0x137a9f['getTags'](_0x4ab225);}})[_0x6666('0x18')](function(_0x603868){if(_0x603868){return _0x603868?{'count':_0x488345,'rows':_0x603868}:null;}})[_0x6666('0x18')](respondWithResult(_0x7ed298,null))[_0x6666('0x22')](handleError(_0x7ed298,null));};exports[_0x6666('0x58')]=function(_0x4e3cb7,_0x11b9b3,_0x80086d){if(_0x4e3cb7[_0x6666('0x4e')]['id']){delete _0x4e3cb7[_0x6666('0x4e')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4e3cb7[_0x6666('0x49')]['id']}})[_0x6666('0x18')](handleEntityNotFound(_0x11b9b3,null))['then'](function(_0x586fde){if(_0x586fde){return _0x586fde[_0x6666('0x58')](_0x4e3cb7[_0x6666('0x4e')][_0x6666('0x59')]||[]);}return null;})[_0x6666('0x18')](respondWithResult(_0x11b9b3,null))[_0x6666('0x22')](handleError(_0x11b9b3,null));}; \ No newline at end of file +var _0x55d2=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','find','create','body','getFields','findOne','FreshdeskField','fields','pick','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError'];(function(_0x49e3be,_0x213410){var _0xe9eea1=function(_0x41a93c){while(--_0x41a93c){_0x49e3be['push'](_0x49e3be['shift']());}};_0xe9eea1(++_0x213410);}(_0x55d2,0x9f));var _0x255d=function(_0x10f0a5,_0x42ecec){_0x10f0a5=_0x10f0a5-0x0;var _0x1849cb=_0x55d2[_0x10f0a5];return _0x1849cb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x255d('0x0'));var zipdir=require(_0x255d('0x1'));var jsonpatch=require(_0x255d('0x2'));var rp=require(_0x255d('0x3'));var moment=require(_0x255d('0x4'));var BPromise=require(_0x255d('0x5'));var Mustache=require('mustache');var util=require(_0x255d('0x6'));var path=require(_0x255d('0x7'));var sox=require(_0x255d('0x8'));var csv=require(_0x255d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x255d('0xa'));var crypto=require(_0x255d('0xb'));var jsforce=require(_0x255d('0xc'));var deskjs=require(_0x255d('0xd'));var toCsv=require(_0x255d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x255d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x255d('0xf'));var logger=require(_0x255d('0x10'))(_0x255d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x255d('0x12'))['db'];var jayson=require(_0x255d('0x13'));var client=jayson[_0x255d('0x14')][_0x255d('0x15')]({'port':0x232a});function checkPasswordPattern(_0xf8abb3,_0x30d8f0,_0xe59201){if(_0xe59201){var _0x460fa4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x460fa4[_0x255d('0x16')](_0x30d8f0)){return _0xf8abb3;}else{throw new db[(_0x255d('0x17'))][(_0x255d('0x18'))](_0x255d('0x19'));}}else{return _0xf8abb3;}}function respondWithRpcPromise(_0x389e2e,_0x500002,_0x29bf44,_0x1be65e){return new BPromise(function(_0x58f0fa,_0x477c48){var _0x19497c=_0x1be65e||client;return _0x19497c[_0x255d('0x1a')](_0x389e2e,_0x29bf44)[_0x255d('0x1b')](function(_0x201313){logger[_0x255d('0x1c')](_0x255d('0x1d'),_0x500002,_0x255d('0x1e'));logger[_0x255d('0x1f')](_0x255d('0x20'),_0x500002,'request\x20sent',JSON[_0x255d('0x21')](_0x201313));if(_0x201313[_0x255d('0x22')]){if(_0x201313[_0x255d('0x22')][_0x255d('0x23')]===0x1f4){logger[_0x255d('0x22')](_0x255d('0x1d'),_0x500002,_0x201313[_0x255d('0x22')][_0x255d('0x24')]);return _0x477c48(_0x201313[_0x255d('0x22')]['message']);}logger[_0x255d('0x22')](_0x255d('0x1d'),_0x500002,_0x201313[_0x255d('0x22')][_0x255d('0x24')]);return _0x58f0fa(_0x201313[_0x255d('0x22')][_0x255d('0x24')]);}else{logger[_0x255d('0x1c')](_0x255d('0x1d'),_0x500002,_0x255d('0x1e'));_0x58f0fa(_0x201313[_0x255d('0x25')][_0x255d('0x24')]);}})[_0x255d('0x26')](function(_0x1b8dcd){logger[_0x255d('0x22')](_0x255d('0x1d'),_0x500002,_0x1b8dcd);_0x477c48(_0x1b8dcd);});});}function respondWithStatusCode(_0x17f38b,_0x911934){_0x911934=_0x911934||0xcc;return function(_0x28a795){if(_0x28a795){return _0x17f38b[_0x255d('0x27')](_0x911934);}return _0x17f38b['status'](_0x911934)[_0x255d('0x28')]();};}function respondWithResult(_0xff763b,_0xf3c710){_0xf3c710=_0xf3c710||0xc8;return function(_0x22c91b){if(_0x22c91b){return _0xff763b[_0x255d('0x29')](_0xf3c710)[_0x255d('0x2a')](_0x22c91b);}};}function respondWithFilteredResult(_0x56f124,_0x7da738){return function(_0x53d0e4){if(_0x53d0e4){var _0x3ed01d=_0x53d0e4[_0x255d('0x2b')],_0xb4bd1a=_0x7da738[_0x255d('0x2c')],_0x144dd0=_0x7da738[_0x255d('0x2c')]+_0x7da738[_0x255d('0x2d')],_0x547502;if(_0x144dd0>=_0x3ed01d){_0x144dd0=_0x3ed01d;_0x547502=0xc8;}else{_0x547502=0xce;}_0x56f124[_0x255d('0x29')](_0x547502);return _0x56f124[_0x255d('0x2e')]('Content-Range',_0xb4bd1a+'-'+_0x144dd0+'/'+_0x3ed01d)[_0x255d('0x2a')](_0x53d0e4);}return null;};}function patchUpdates(_0x529680){return function(_0x5e7231){try{jsonpatch[_0x255d('0x2f')](_0x5e7231,_0x529680,!![]);}catch(_0x289fbb){return BPromise[_0x255d('0x30')](_0x289fbb);}return _0x5e7231[_0x255d('0x31')]();};}function saveUpdates(_0x5d28bd,_0x3d3de7){return function(_0x26aa87){if(_0x26aa87){return _0x26aa87[_0x255d('0x32')](_0x5d28bd)['then'](function(_0x1799cc){return _0x1799cc;});}return null;};}function removeEntity(_0x57acc7,_0x4c212c){return function(_0x2ee7a6){if(_0x2ee7a6){return _0x2ee7a6[_0x255d('0x33')]()[_0x255d('0x1b')](function(){_0x57acc7[_0x255d('0x29')](0xcc)[_0x255d('0x28')]();});}};}function handleEntityNotFound(_0x4e44f7,_0x322da){return function(_0x5c9243){if(!_0x5c9243){_0x4e44f7[_0x255d('0x27')](0x194);}return _0x5c9243;};}function handleError(_0x1a4178,_0xffc958){_0xffc958=_0xffc958||0x1f4;return function(_0x3fa0b6){logger['error'](_0x3fa0b6['stack']);if(_0x3fa0b6['name']){delete _0x3fa0b6['name'];}_0x1a4178[_0x255d('0x29')](_0xffc958)['send'](_0x3fa0b6);};}exports[_0x255d('0x34')]=function(_0x4826e0,_0x2ce9a2){var _0x16a389={},_0x596f1f={},_0x3a8471={'count':0x0,'rows':[]};var _0x13b9ce=_[_0x255d('0x35')](db[_0x255d('0x36')][_0x255d('0x37')],function(_0x1c84be){return{'name':_0x1c84be[_0x255d('0x38')],'type':_0x1c84be[_0x255d('0x39')]['key']};});_0x596f1f[_0x255d('0x3a')]=_[_0x255d('0x35')](_0x13b9ce,_0x255d('0x3b'));_0x596f1f['query']=_[_0x255d('0x3c')](_0x4826e0[_0x255d('0x3d')]);_0x596f1f[_0x255d('0x3e')]=_[_0x255d('0x3f')](_0x596f1f['model'],_0x596f1f['query']);_0x16a389['attributes']=_[_0x255d('0x3f')](_0x596f1f[_0x255d('0x3a')],qs['fields'](_0x4826e0[_0x255d('0x3d')]['fields']));_0x16a389[_0x255d('0x40')]=_0x16a389[_0x255d('0x40')][_0x255d('0x41')]?_0x16a389[_0x255d('0x40')]:_0x596f1f['model'];if(!_0x4826e0['query'][_0x255d('0x42')](_0x255d('0x43'))){_0x16a389[_0x255d('0x2d')]=qs['limit'](_0x4826e0[_0x255d('0x3d')][_0x255d('0x2d')]);_0x16a389['offset']=qs['offset'](_0x4826e0['query'][_0x255d('0x2c')]);}_0x16a389[_0x255d('0x44')]=qs[_0x255d('0x45')](_0x4826e0[_0x255d('0x3d')][_0x255d('0x45')]);_0x16a389[_0x255d('0x46')]=qs['filters'](_['pick'](_0x4826e0[_0x255d('0x3d')],_0x596f1f[_0x255d('0x3e')]),_0x13b9ce);if(_0x4826e0[_0x255d('0x3d')][_0x255d('0x47')]){_0x16a389['where']=_[_0x255d('0x48')](_0x16a389[_0x255d('0x46')],{'$or':_[_0x255d('0x35')](_0x13b9ce,function(_0x8f5521){if(_0x8f5521['type']!=='VIRTUAL'){var _0x12f38f={};_0x12f38f[_0x8f5521[_0x255d('0x3b')]]={'$like':'%'+_0x4826e0[_0x255d('0x3d')][_0x255d('0x47')]+'%'};return _0x12f38f;}})});}_0x16a389=_['merge']({},_0x16a389,_0x4826e0[_0x255d('0x49')]);var _0x43662f={'where':_0x16a389[_0x255d('0x46')]};return db[_0x255d('0x36')][_0x255d('0x2b')](_0x43662f)[_0x255d('0x1b')](function(_0x109c1d){_0x3a8471[_0x255d('0x2b')]=_0x109c1d;if(_0x4826e0[_0x255d('0x3d')][_0x255d('0x4a')]){_0x16a389[_0x255d('0x4b')]=[{'all':!![]}];}return db[_0x255d('0x36')]['findAll'](_0x16a389);})[_0x255d('0x1b')](function(_0x2287fe){_0x3a8471[_0x255d('0x4c')]=_0x2287fe;return _0x3a8471;})[_0x255d('0x1b')](respondWithFilteredResult(_0x2ce9a2,_0x16a389))[_0x255d('0x26')](handleError(_0x2ce9a2,null));};exports[_0x255d('0x4d')]=function(_0x5987ef,_0x504b25){var _0x2911d2={'raw':![],'where':{'id':_0x5987ef[_0x255d('0x4e')]['id']}},_0x154474={};_0x154474[_0x255d('0x3a')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x154474['query']=_['keys'](_0x5987ef[_0x255d('0x3d')]);_0x154474[_0x255d('0x3e')]=_[_0x255d('0x3f')](_0x154474['model'],_0x154474[_0x255d('0x3d')]);_0x2911d2[_0x255d('0x40')]=_['intersection'](_0x154474['model'],qs['fields'](_0x5987ef['query']['fields']));_0x2911d2['attributes']=_0x2911d2[_0x255d('0x40')][_0x255d('0x41')]?_0x2911d2[_0x255d('0x40')]:_0x154474[_0x255d('0x3a')];if(_0x5987ef[_0x255d('0x3d')]['includeAll']){_0x2911d2[_0x255d('0x4b')]=[{'all':!![]}];}_0x2911d2=_['merge']({},_0x2911d2,_0x5987ef[_0x255d('0x49')]);return db[_0x255d('0x36')][_0x255d('0x4f')](_0x2911d2)[_0x255d('0x1b')](handleEntityNotFound(_0x504b25,null))['then'](respondWithResult(_0x504b25,null))['catch'](handleError(_0x504b25,null));};exports[_0x255d('0x50')]=function(_0x116618,_0x5cea1c){return db[_0x255d('0x36')][_0x255d('0x50')](_0x116618[_0x255d('0x51')],{})[_0x255d('0x1b')](respondWithResult(_0x5cea1c,0xc9))[_0x255d('0x26')](handleError(_0x5cea1c,null));};exports[_0x255d('0x32')]=function(_0x4ea624,_0x55b977){if(_0x4ea624[_0x255d('0x51')]['id']){delete _0x4ea624[_0x255d('0x51')]['id'];}return db[_0x255d('0x36')][_0x255d('0x4f')]({'where':{'id':_0x4ea624[_0x255d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x55b977,null))[_0x255d('0x1b')](saveUpdates(_0x4ea624[_0x255d('0x51')],null))['then'](respondWithResult(_0x55b977,null))[_0x255d('0x26')](handleError(_0x55b977,null));};exports[_0x255d('0x33')]=function(_0x4c9c74,_0x5cd32d){return db[_0x255d('0x36')][_0x255d('0x4f')]({'where':{'id':_0x4c9c74[_0x255d('0x4e')]['id']}})[_0x255d('0x1b')](handleEntityNotFound(_0x5cd32d,null))['then'](removeEntity(_0x5cd32d,null))['catch'](handleError(_0x5cd32d,null));};exports[_0x255d('0x52')]=function(_0x1b8529,_0x3936ef,_0x43ab10){var _0x28b858={};var _0x3a4d1d={};var _0x62ddce;var _0x76ae58;return db[_0x255d('0x36')][_0x255d('0x53')]({'where':{'id':_0x1b8529['params']['id']}})[_0x255d('0x1b')](handleEntityNotFound(_0x3936ef,null))['then'](function(_0x2c30e1){if(_0x2c30e1){_0x62ddce=_0x2c30e1;_0x3a4d1d['model']=_['keys'](db[_0x255d('0x54')]['rawAttributes']);_0x3a4d1d[_0x255d('0x3d')]=_['keys'](_0x1b8529[_0x255d('0x3d')]);_0x3a4d1d[_0x255d('0x3e')]=_['intersection'](_0x3a4d1d[_0x255d('0x3a')],_0x3a4d1d[_0x255d('0x3d')]);_0x28b858[_0x255d('0x40')]=_[_0x255d('0x3f')](_0x3a4d1d[_0x255d('0x3a')],qs['fields'](_0x1b8529[_0x255d('0x3d')][_0x255d('0x55')]));_0x28b858['attributes']=_0x28b858['attributes'][_0x255d('0x41')]?_0x28b858['attributes']:_0x3a4d1d['model'];_0x28b858[_0x255d('0x44')]=qs[_0x255d('0x45')](_0x1b8529[_0x255d('0x3d')][_0x255d('0x45')]);_0x28b858['where']=qs[_0x255d('0x3e')](_['pick'](_0x1b8529['query'],_0x3a4d1d['filters']));if(_0x1b8529[_0x255d('0x3d')][_0x255d('0x47')]){_0x28b858['where']=_['merge'](_0x28b858[_0x255d('0x46')],{'$or':_[_0x255d('0x35')](_0x28b858[_0x255d('0x40')],function(_0xc9b8d){var _0x4827cf={};_0x4827cf[_0xc9b8d]={'$like':'%'+_0x1b8529[_0x255d('0x3d')]['filter']+'%'};return _0x4827cf;})});}_0x28b858=_['merge']({},_0x28b858,_0x1b8529[_0x255d('0x49')]);return _0x62ddce[_0x255d('0x52')](_0x28b858);}})[_0x255d('0x1b')](function(_0x103ad0){if(_0x103ad0){_0x76ae58=_0x103ad0[_0x255d('0x41')];if(!_0x1b8529[_0x255d('0x3d')][_0x255d('0x42')](_0x255d('0x43'))){_0x28b858['limit']=qs[_0x255d('0x2d')](_0x1b8529['query'][_0x255d('0x2d')]);_0x28b858[_0x255d('0x2c')]=qs['offset'](_0x1b8529[_0x255d('0x3d')][_0x255d('0x2c')]);}return _0x62ddce[_0x255d('0x52')](_0x28b858);}})[_0x255d('0x1b')](function(_0x237846){if(_0x237846){return _0x237846?{'count':_0x76ae58,'rows':_0x237846}:null;}})['then'](respondWithResult(_0x3936ef,null))['catch'](handleError(_0x3936ef,null));};exports['getSubjects']=function(_0x1b99c7,_0x15e49d,_0x99dfd){var _0x316505={};var _0x495bf1={};var _0x40799f;var _0x49a6cc;return db['FreshdeskConfiguration'][_0x255d('0x53')]({'where':{'id':_0x1b99c7[_0x255d('0x4e')]['id']}})[_0x255d('0x1b')](handleEntityNotFound(_0x15e49d,null))[_0x255d('0x1b')](function(_0x48ae9f){if(_0x48ae9f){_0x40799f=_0x48ae9f;_0x495bf1[_0x255d('0x3a')]=_[_0x255d('0x3c')](db[_0x255d('0x54')][_0x255d('0x37')]);_0x495bf1[_0x255d('0x3d')]=_[_0x255d('0x3c')](_0x1b99c7[_0x255d('0x3d')]);_0x495bf1[_0x255d('0x3e')]=_[_0x255d('0x3f')](_0x495bf1[_0x255d('0x3a')],_0x495bf1['query']);_0x316505[_0x255d('0x40')]=_[_0x255d('0x3f')](_0x495bf1['model'],qs[_0x255d('0x55')](_0x1b99c7[_0x255d('0x3d')]['fields']));_0x316505[_0x255d('0x40')]=_0x316505[_0x255d('0x40')]['length']?_0x316505[_0x255d('0x40')]:_0x495bf1['model'];_0x316505[_0x255d('0x44')]=qs[_0x255d('0x45')](_0x1b99c7[_0x255d('0x3d')][_0x255d('0x45')]);_0x316505[_0x255d('0x46')]=qs['filters'](_[_0x255d('0x56')](_0x1b99c7[_0x255d('0x3d')],_0x495bf1['filters']));if(_0x1b99c7['query'][_0x255d('0x47')]){_0x316505[_0x255d('0x46')]=_[_0x255d('0x48')](_0x316505[_0x255d('0x46')],{'$or':_[_0x255d('0x35')](_0x316505['attributes'],function(_0x595548){var _0x531513={};_0x531513[_0x595548]={'$like':'%'+_0x1b99c7[_0x255d('0x3d')][_0x255d('0x47')]+'%'};return _0x531513;})});}_0x316505=_[_0x255d('0x48')]({},_0x316505,_0x1b99c7[_0x255d('0x49')]);return _0x40799f['getSubjects'](_0x316505);}})[_0x255d('0x1b')](function(_0x20187b){if(_0x20187b){_0x49a6cc=_0x20187b['length'];if(!_0x1b99c7[_0x255d('0x3d')][_0x255d('0x42')](_0x255d('0x43'))){_0x316505[_0x255d('0x2d')]=qs[_0x255d('0x2d')](_0x1b99c7[_0x255d('0x3d')]['limit']);_0x316505[_0x255d('0x2c')]=qs[_0x255d('0x2c')](_0x1b99c7[_0x255d('0x3d')]['offset']);}return _0x40799f[_0x255d('0x57')](_0x316505);}})[_0x255d('0x1b')](function(_0x1370ef){if(_0x1370ef){return _0x1370ef?{'count':_0x49a6cc,'rows':_0x1370ef}:null;}})[_0x255d('0x1b')](respondWithResult(_0x15e49d,null))['catch'](handleError(_0x15e49d,null));};exports[_0x255d('0x58')]=function(_0x576b49,_0x1c5ae9,_0x4e3d53){var _0x1d5ca7={};var _0x66d099={};var _0xd85fec;var _0x3cc4b7;return db['FreshdeskConfiguration'][_0x255d('0x53')]({'where':{'id':_0x576b49['params']['id']}})[_0x255d('0x1b')](handleEntityNotFound(_0x1c5ae9,null))[_0x255d('0x1b')](function(_0x2dfad8){if(_0x2dfad8){_0xd85fec=_0x2dfad8;_0x66d099[_0x255d('0x3a')]=_[_0x255d('0x3c')](db[_0x255d('0x54')][_0x255d('0x37')]);_0x66d099[_0x255d('0x3d')]=_[_0x255d('0x3c')](_0x576b49[_0x255d('0x3d')]);_0x66d099[_0x255d('0x3e')]=_['intersection'](_0x66d099['model'],_0x66d099[_0x255d('0x3d')]);_0x1d5ca7['attributes']=_['intersection'](_0x66d099[_0x255d('0x3a')],qs['fields'](_0x576b49[_0x255d('0x3d')][_0x255d('0x55')]));_0x1d5ca7['attributes']=_0x1d5ca7['attributes'][_0x255d('0x41')]?_0x1d5ca7[_0x255d('0x40')]:_0x66d099[_0x255d('0x3a')];_0x1d5ca7[_0x255d('0x44')]=qs['sort'](_0x576b49['query'][_0x255d('0x45')]);_0x1d5ca7[_0x255d('0x46')]=qs[_0x255d('0x3e')](_[_0x255d('0x56')](_0x576b49[_0x255d('0x3d')],_0x66d099[_0x255d('0x3e')]));if(_0x576b49[_0x255d('0x3d')][_0x255d('0x47')]){_0x1d5ca7['where']=_['merge'](_0x1d5ca7[_0x255d('0x46')],{'$or':_[_0x255d('0x35')](_0x1d5ca7[_0x255d('0x40')],function(_0x2e519b){var _0x4a468c={};_0x4a468c[_0x2e519b]={'$like':'%'+_0x576b49[_0x255d('0x3d')]['filter']+'%'};return _0x4a468c;})});}_0x1d5ca7=_['merge']({},_0x1d5ca7,_0x576b49[_0x255d('0x49')]);return _0xd85fec['getDescriptions'](_0x1d5ca7);}})[_0x255d('0x1b')](function(_0x145325){if(_0x145325){_0x3cc4b7=_0x145325[_0x255d('0x41')];if(!_0x576b49['query'][_0x255d('0x42')]('nolimit')){_0x1d5ca7[_0x255d('0x2d')]=qs[_0x255d('0x2d')](_0x576b49[_0x255d('0x3d')]['limit']);_0x1d5ca7[_0x255d('0x2c')]=qs[_0x255d('0x2c')](_0x576b49[_0x255d('0x3d')][_0x255d('0x2c')]);}return _0xd85fec[_0x255d('0x58')](_0x1d5ca7);}})['then'](function(_0x278721){if(_0x278721){return _0x278721?{'count':_0x3cc4b7,'rows':_0x278721}:null;}})[_0x255d('0x1b')](respondWithResult(_0x1c5ae9,null))[_0x255d('0x26')](handleError(_0x1c5ae9,null));};exports[_0x255d('0x59')]=function(_0x35beda,_0x466816,_0x219041){var _0x3ffca1={};var _0x3a072e={};var _0x1e2399;var _0x9f45f;return db[_0x255d('0x36')][_0x255d('0x53')]({'where':{'id':_0x35beda['params']['id']}})[_0x255d('0x1b')](handleEntityNotFound(_0x466816,null))['then'](function(_0x1c7469){if(_0x1c7469){_0x1e2399=_0x1c7469;_0x3a072e[_0x255d('0x3a')]=_[_0x255d('0x3c')](db[_0x255d('0x5a')][_0x255d('0x37')]);_0x3a072e['query']=_[_0x255d('0x3c')](_0x35beda['query']);_0x3a072e[_0x255d('0x3e')]=_['intersection'](_0x3a072e['model'],_0x3a072e[_0x255d('0x3d')]);_0x3ffca1[_0x255d('0x40')]=_[_0x255d('0x3f')](_0x3a072e[_0x255d('0x3a')],qs[_0x255d('0x55')](_0x35beda['query'][_0x255d('0x55')]));_0x3ffca1[_0x255d('0x40')]=_0x3ffca1[_0x255d('0x40')][_0x255d('0x41')]?_0x3ffca1['attributes']:_0x3a072e[_0x255d('0x3a')];_0x3ffca1[_0x255d('0x44')]=qs['sort'](_0x35beda[_0x255d('0x3d')][_0x255d('0x45')]);_0x3ffca1[_0x255d('0x46')]=qs[_0x255d('0x3e')](_['pick'](_0x35beda[_0x255d('0x3d')],_0x3a072e[_0x255d('0x3e')]));if(_0x35beda[_0x255d('0x3d')][_0x255d('0x47')]){_0x3ffca1[_0x255d('0x46')]=_[_0x255d('0x48')](_0x3ffca1[_0x255d('0x46')],{'$or':_[_0x255d('0x35')](_0x3ffca1[_0x255d('0x40')],function(_0x15af11){var _0x415f18={};_0x415f18[_0x15af11]={'$like':'%'+_0x35beda['query']['filter']+'%'};return _0x415f18;})});}_0x3ffca1=_[_0x255d('0x48')]({},_0x3ffca1,_0x35beda[_0x255d('0x49')]);return _0x1e2399[_0x255d('0x59')](_0x3ffca1);}})[_0x255d('0x1b')](function(_0x56d373){if(_0x56d373){_0x9f45f=_0x56d373['length'];if(!_0x35beda['query'][_0x255d('0x42')](_0x255d('0x43'))){_0x3ffca1[_0x255d('0x2d')]=qs[_0x255d('0x2d')](_0x35beda[_0x255d('0x3d')][_0x255d('0x2d')]);_0x3ffca1[_0x255d('0x2c')]=qs[_0x255d('0x2c')](_0x35beda[_0x255d('0x3d')][_0x255d('0x2c')]);}return _0x1e2399[_0x255d('0x59')](_0x3ffca1);}})[_0x255d('0x1b')](function(_0x2b5a2f){if(_0x2b5a2f){return _0x2b5a2f?{'count':_0x9f45f,'rows':_0x2b5a2f}:null;}})['then'](respondWithResult(_0x466816,null))[_0x255d('0x26')](handleError(_0x466816,null));};exports[_0x255d('0x5b')]=function(_0x28e191,_0x4cd689,_0x4c1024){if(_0x28e191[_0x255d('0x51')]['id']){delete _0x28e191[_0x255d('0x51')]['id'];}return db[_0x255d('0x36')][_0x255d('0x53')]({'where':{'id':_0x28e191[_0x255d('0x4e')]['id']}})[_0x255d('0x1b')](handleEntityNotFound(_0x4cd689,null))[_0x255d('0x1b')](function(_0x3f458e){if(_0x3f458e){return _0x3f458e[_0x255d('0x5b')](_0x28e191['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x4cd689,null))[_0x255d('0x26')](handleError(_0x4cd689,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 9fdce10..e375e14 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 _0xe4c7=['int_freshdesk_configurations','lodash','api','moment','bluebird','path','rimraf','../../config/environment','define','FreshdeskConfiguration'];(function(_0x308fea,_0x2d709e){var _0xc39f21=function(_0x10bbb6){while(--_0x10bbb6){_0x308fea['push'](_0x308fea['shift']());}};_0xc39f21(++_0x2d709e);}(_0xe4c7,0x1c3));var _0x7e4c=function(_0x314115,_0x22f606){_0x314115=_0x314115-0x0;var _0x1347df=_0xe4c7[_0x314115];return _0x1347df;};'use strict';var _=require(_0x7e4c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7e4c('0x1'));var moment=require(_0x7e4c('0x2'));var BPromise=require(_0x7e4c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e4c('0x4'));var rimraf=require(_0x7e4c('0x5'));var config=require(_0x7e4c('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x297cc1,_0x173852){return _0x297cc1[_0x7e4c('0x7')](_0x7e4c('0x8'),attributes,{'tableName':_0x7e4c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x346e=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x2ed828,_0x1f48ea){var _0x301a08=function(_0x60b45d){while(--_0x60b45d){_0x2ed828['push'](_0x2ed828['shift']());}};_0x301a08(++_0x1f48ea);}(_0x346e,0x1f1));var _0xe346=function(_0x21ef1e,_0x16e4a2){_0x21ef1e=_0x21ef1e-0x0;var _0xdd0e96=_0x346e[_0x21ef1e];return _0xdd0e96;};'use strict';var _=require(_0xe346('0x0'));var util=require(_0xe346('0x1'));var logger=require(_0xe346('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe346('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe346('0x4'));var rimraf=require(_0xe346('0x5'));var config=require(_0xe346('0x6'));var attributes=require(_0xe346('0x7'));module[_0xe346('0x8')]=function(_0xf438c7,_0xb47b3b){return _0xf438c7['define'](_0xe346('0x9'),attributes,{'tableName':_0xe346('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 f1601a8..a07b653 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 _0x6104=['util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x211789,_0x3425a7){var _0x1d1d64=function(_0x44ca89){while(--_0x44ca89){_0x211789['push'](_0x211789['shift']());}};_0x1d1d64(++_0x3425a7);}(_0x6104,0x92));var _0x4610=function(_0x55a1ad,_0x518b70){_0x55a1ad=_0x55a1ad-0x0;var _0x2bd39c=_0x6104[_0x55a1ad];return _0x2bd39c;};'use strict';var _=require(_0x4610('0x0'));var util=require(_0x4610('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4610('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4610('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4610('0x4'))(_0x4610('0x5'));var config=require('../../config/environment');var jayson=require(_0x4610('0x6'));var client=jayson[_0x4610('0x7')][_0x4610('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19f4b8,_0x32b82d,_0x322f72){return new BPromise(function(_0x2964e4,_0x150b28){return client[_0x4610('0x9')](_0x19f4b8,_0x322f72)['then'](function(_0x27700c){logger['info'](_0x4610('0xa'),_0x32b82d,_0x4610('0xb'));logger[_0x4610('0xc')](_0x4610('0xd'),_0x32b82d,_0x4610('0xb'),JSON[_0x4610('0xe')](_0x27700c));if(_0x27700c[_0x4610('0xf')]){if(_0x27700c[_0x4610('0xf')][_0x4610('0x10')]===0x1f4){logger[_0x4610('0xf')](_0x4610('0xa'),_0x32b82d,_0x27700c['error']['message']);return _0x150b28(_0x27700c['error'][_0x4610('0x11')]);}logger['error'](_0x4610('0xa'),_0x32b82d,_0x27700c[_0x4610('0xf')][_0x4610('0x11')]);return _0x2964e4(_0x27700c[_0x4610('0xf')][_0x4610('0x11')]);}else{logger[_0x4610('0x12')](_0x4610('0xa'),_0x32b82d,_0x4610('0xb'));_0x2964e4(_0x27700c[_0x4610('0x13')][_0x4610('0x11')]);}})[_0x4610('0x14')](function(_0x8beb2d){logger[_0x4610('0xf')](_0x4610('0xa'),_0x32b82d,_0x8beb2d);_0x150b28(_0x8beb2d);});});} \ No newline at end of file +var _0xd547=['stringify','error','code','message','info','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd547,0x103));var _0x7d54=function(_0x26793a,_0x49cf51){_0x26793a=_0x26793a-0x0;var _0x575efb=_0xd547[_0x26793a];return _0x575efb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7d54('0x0'));var fs=require('fs');var Redis=require(_0x7d54('0x1'));var db=require(_0x7d54('0x2'))['db'];var utils=require(_0x7d54('0x3'));var logger=require(_0x7d54('0x4'))(_0x7d54('0x5'));var config=require(_0x7d54('0x6'));var jayson=require(_0x7d54('0x7'));var client=jayson[_0x7d54('0x8')][_0x7d54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e03ee,_0x173633,_0x36cce6){return new BPromise(function(_0x45bfdd,_0x587a86){return client[_0x7d54('0xa')](_0x2e03ee,_0x36cce6)[_0x7d54('0xb')](function(_0x2775d8){logger['info'](_0x7d54('0xc'),_0x173633,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x173633,_0x7d54('0xd'),JSON[_0x7d54('0xe')](_0x2775d8));if(_0x2775d8[_0x7d54('0xf')]){if(_0x2775d8[_0x7d54('0xf')][_0x7d54('0x10')]===0x1f4){logger[_0x7d54('0xf')](_0x7d54('0xc'),_0x173633,_0x2775d8[_0x7d54('0xf')][_0x7d54('0x11')]);return _0x587a86(_0x2775d8[_0x7d54('0xf')][_0x7d54('0x11')]);}logger[_0x7d54('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x173633,_0x2775d8[_0x7d54('0xf')][_0x7d54('0x11')]);return _0x45bfdd(_0x2775d8[_0x7d54('0xf')][_0x7d54('0x11')]);}else{logger[_0x7d54('0x12')](_0x7d54('0xc'),_0x173633,'request\x20sent');_0x45bfdd(_0x2775d8[_0x7d54('0x13')][_0x7d54('0x11')]);}})[_0x7d54('0x14')](function(_0x1347a8){logger[_0x7d54('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x173633,_0x1347a8);_0x587a86(_0x1347a8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f96fd52..8887f94 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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x180cd0,_0x386c6e){var _0x49fc32=function(_0x551c2c){while(--_0x551c2c){_0x180cd0['push'](_0x180cd0['shift']());}};_0x49fc32(++_0x386c6e);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x4cc1c1,_0x3ad908){var _0x483778=function(_0x358fc5){while(--_0x358fc5){_0x4cc1c1['push'](_0x4cc1c1['shift']());}};_0x483778(++_0x3ad908);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('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 6513e78..303ecfc 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 _0x68f5=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x31d5cf,_0x438305){var _0x2ce3f6=function(_0x29dbcd){while(--_0x29dbcd){_0x31d5cf['push'](_0x31d5cf['shift']());}};_0x2ce3f6(++_0x438305);}(_0x68f5,0x11a));var _0x568f=function(_0x38d883,_0x3be1ae){_0x38d883=_0x38d883-0x0;var _0x5e1601=_0x68f5[_0x38d883];return _0x5e1601;};'use strict';var Sequelize=require(_0x568f('0x0'));module[_0x568f('0x1')]={'type':{'type':Sequelize[_0x568f('0x2')]('string',_0x568f('0x3'),_0x568f('0x4'),_0x568f('0x5')),'defaultValue':_0x568f('0x6')},'content':{'type':Sequelize[_0x568f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x568f('0x2')](_0x568f('0x6'),_0x568f('0x3'),_0x568f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x568f('0x7')]},'customField':{'type':Sequelize[_0x568f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x568f('0x7')]}}; \ No newline at end of file +var _0x37cc=['string','variable','customVariable','STRING','sequelize','exports','ENUM'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x37cc,0x185));var _0xc37c=function(_0x568d13,_0x3acd44){_0x568d13=_0x568d13-0x0;var _0x1918ef=_0x37cc[_0x568d13];return _0x1918ef;};'use strict';var Sequelize=require(_0xc37c('0x0'));module[_0xc37c('0x1')]={'type':{'type':Sequelize[_0xc37c('0x2')](_0xc37c('0x3'),_0xc37c('0x4'),_0xc37c('0x5'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc37c('0x6')]},'key':{'type':Sequelize[_0xc37c('0x6')]},'keyType':{'type':Sequelize[_0xc37c('0x2')](_0xc37c('0x3'),_0xc37c('0x4'),_0xc37c('0x5'))},'keyContent':{'type':Sequelize[_0xc37c('0x6')]},'idField':{'type':Sequelize[_0xc37c('0x6')]},'nameField':{'type':Sequelize[_0xc37c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc37c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 71a9434..4a1c772 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 _0x01dc=['fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x01dc,0xa9));var _0xc01d=function(_0x1f4347,_0x25ce53){_0x1f4347=_0x1f4347-0x0;var _0x1bf631=_0x01dc[_0x1f4347];return _0x1bf631;};'use strict';var pdf=require(_0xc01d('0x0'));var emlformat=require(_0xc01d('0x1'));var rimraf=require(_0xc01d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc01d('0x3'));var rp=require(_0xc01d('0x4'));var moment=require(_0xc01d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc01d('0x6'));var util=require(_0xc01d('0x7'));var path=require(_0xc01d('0x8'));var sox=require(_0xc01d('0x9'));var csv=require(_0xc01d('0xa'));var ejs=require(_0xc01d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc01d('0xc'));var jsforce=require(_0xc01d('0xd'));var deskjs=require(_0xc01d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc01d('0xf'));var Papa=require(_0xc01d('0x10'));var Redis=require(_0xc01d('0x11'));var authService=require(_0xc01d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc01d('0x13'));var hardwareService=require(_0xc01d('0x14'));var logger=require('../../config/logger')(_0xc01d('0x15'));var utils=require(_0xc01d('0x16'));var config=require(_0xc01d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d6545,_0xe4f407){_0xe4f407=_0xe4f407||0xcc;return function(_0x2113ab){if(_0x2113ab){return _0x4d6545[_0xc01d('0x18')](_0xe4f407);}return _0x4d6545[_0xc01d('0x19')](_0xe4f407)['end']();};}function respondWithResult(_0x4bccdc,_0x4e2bf2){_0x4e2bf2=_0x4e2bf2||0xc8;return function(_0x312003){if(_0x312003){return _0x4bccdc[_0xc01d('0x19')](_0x4e2bf2)[_0xc01d('0x1a')](_0x312003);}};}function respondWithFilteredResult(_0xbd060b,_0xac408f){return function(_0x4d4f5d){if(_0x4d4f5d){var _0x5a4300=_0x4d4f5d[_0xc01d('0x1b')],_0x5427fe=_0xac408f['offset'],_0x1c3352=_0xac408f[_0xc01d('0x1c')]+_0xac408f[_0xc01d('0x1d')],_0x302fa6;if(_0x1c3352>=_0x5a4300){_0x1c3352=_0x5a4300;_0x302fa6=0xc8;}else{_0x302fa6=0xce;}_0xbd060b[_0xc01d('0x19')](_0x302fa6);return _0xbd060b[_0xc01d('0x1e')](_0xc01d('0x1f'),_0x5427fe+'-'+_0x1c3352+'/'+_0x5a4300)[_0xc01d('0x1a')](_0x4d4f5d);}return null;};}function patchUpdates(_0xada4e1){return function(_0x5a9686){try{jsonpatch[_0xc01d('0x20')](_0x5a9686,_0xada4e1,!![]);}catch(_0x1f71fa){return BPromise[_0xc01d('0x21')](_0x1f71fa);}return _0x5a9686['save']();};}function saveUpdates(_0x1798f7,_0xf223e7){return function(_0x4df6c0){if(_0x4df6c0){return _0x4df6c0[_0xc01d('0x22')](_0x1798f7)[_0xc01d('0x23')](function(_0x4774ab){return _0x4774ab;});}return null;};}function removeEntity(_0x4091ed,_0xa89a5e){return function(_0x238a1f){if(_0x238a1f){return _0x238a1f[_0xc01d('0x24')]()[_0xc01d('0x23')](function(){_0x4091ed[_0xc01d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59aa32,_0x521034){return function(_0x2fae34){if(!_0x2fae34){_0x59aa32[_0xc01d('0x18')](0x194);}return _0x2fae34;};}function handleError(_0x4e83a6,_0x5c8ebd){_0x5c8ebd=_0x5c8ebd||0x1f4;return function(_0x1aed31){logger[_0xc01d('0x25')](_0x1aed31[_0xc01d('0x26')]);if(_0x1aed31[_0xc01d('0x27')]){delete _0x1aed31[_0xc01d('0x27')];}_0x4e83a6[_0xc01d('0x19')](_0x5c8ebd)[_0xc01d('0x28')](_0x1aed31);};}exports[_0xc01d('0x29')]=function(_0x117546,_0x5afdad){var _0xfbc029={},_0x5ec187={},_0x517cb6={'count':0x0,'rows':[]};var _0x30dec2=_[_0xc01d('0x2a')](db[_0xc01d('0x2b')][_0xc01d('0x2c')],function(_0xf9a644){return{'name':_0xf9a644[_0xc01d('0x2d')],'type':_0xf9a644[_0xc01d('0x2e')][_0xc01d('0x2f')]};});_0x5ec187[_0xc01d('0x30')]=_['map'](_0x30dec2,_0xc01d('0x27'));_0x5ec187[_0xc01d('0x31')]=_[_0xc01d('0x32')](_0x117546[_0xc01d('0x31')]);_0x5ec187['filters']=_[_0xc01d('0x33')](_0x5ec187['model'],_0x5ec187[_0xc01d('0x31')]);_0xfbc029[_0xc01d('0x34')]=_['intersection'](_0x5ec187[_0xc01d('0x30')],qs[_0xc01d('0x35')](_0x117546['query']['fields']));_0xfbc029['attributes']=_0xfbc029[_0xc01d('0x34')]['length']?_0xfbc029[_0xc01d('0x34')]:_0x5ec187[_0xc01d('0x30')];if(!_0x117546[_0xc01d('0x31')][_0xc01d('0x36')](_0xc01d('0x37'))){_0xfbc029[_0xc01d('0x1d')]=qs[_0xc01d('0x1d')](_0x117546[_0xc01d('0x31')][_0xc01d('0x1d')]);_0xfbc029[_0xc01d('0x1c')]=qs[_0xc01d('0x1c')](_0x117546[_0xc01d('0x31')][_0xc01d('0x1c')]);}_0xfbc029['order']=qs[_0xc01d('0x38')](_0x117546['query'][_0xc01d('0x38')]);_0xfbc029[_0xc01d('0x39')]=qs[_0xc01d('0x3a')](_[_0xc01d('0x3b')](_0x117546['query'],_0x5ec187[_0xc01d('0x3a')]),_0x30dec2);if(_0x117546[_0xc01d('0x31')][_0xc01d('0x3c')]){_0xfbc029[_0xc01d('0x39')]=_[_0xc01d('0x3d')](_0xfbc029[_0xc01d('0x39')],{'$or':_['map'](_0x30dec2,function(_0xb32d5c){if(_0xb32d5c[_0xc01d('0x2e')]!==_0xc01d('0x3e')){var _0x540483={};_0x540483[_0xb32d5c['name']]={'$like':'%'+_0x117546[_0xc01d('0x31')][_0xc01d('0x3c')]+'%'};return _0x540483;}})});}_0xfbc029=_[_0xc01d('0x3d')]({},_0xfbc029,_0x117546[_0xc01d('0x3f')]);var _0x88f3c3={'where':_0xfbc029[_0xc01d('0x39')]};return db[_0xc01d('0x2b')][_0xc01d('0x1b')](_0x88f3c3)[_0xc01d('0x23')](function(_0x5a3973){_0x517cb6[_0xc01d('0x1b')]=_0x5a3973;if(_0x117546['query'][_0xc01d('0x40')]){_0xfbc029['include']=[{'all':!![]}];}return db[_0xc01d('0x2b')][_0xc01d('0x41')](_0xfbc029);})[_0xc01d('0x23')](function(_0x565e91){_0x517cb6[_0xc01d('0x42')]=_0x565e91;return _0x517cb6;})[_0xc01d('0x23')](respondWithFilteredResult(_0x5afdad,_0xfbc029))[_0xc01d('0x43')](handleError(_0x5afdad,null));};exports['show']=function(_0x20b49d,_0x122a1d){var _0xa9fc27={'raw':!![],'where':{'id':_0x20b49d[_0xc01d('0x44')]['id']}},_0x1d35f6={};_0x1d35f6['model']=_[_0xc01d('0x32')](db['FreshdeskField'][_0xc01d('0x2c')]);_0x1d35f6[_0xc01d('0x31')]=_[_0xc01d('0x32')](_0x20b49d['query']);_0x1d35f6[_0xc01d('0x3a')]=_[_0xc01d('0x33')](_0x1d35f6[_0xc01d('0x30')],_0x1d35f6[_0xc01d('0x31')]);_0xa9fc27['attributes']=_[_0xc01d('0x33')](_0x1d35f6[_0xc01d('0x30')],qs[_0xc01d('0x35')](_0x20b49d['query']['fields']));_0xa9fc27[_0xc01d('0x34')]=_0xa9fc27[_0xc01d('0x34')][_0xc01d('0x45')]?_0xa9fc27[_0xc01d('0x34')]:_0x1d35f6[_0xc01d('0x30')];if(_0x20b49d[_0xc01d('0x31')][_0xc01d('0x40')]){_0xa9fc27[_0xc01d('0x46')]=[{'all':!![]}];}_0xa9fc27=_[_0xc01d('0x3d')]({},_0xa9fc27,_0x20b49d[_0xc01d('0x3f')]);return db['FreshdeskField']['find'](_0xa9fc27)[_0xc01d('0x23')](handleEntityNotFound(_0x122a1d,null))[_0xc01d('0x23')](respondWithResult(_0x122a1d,null))[_0xc01d('0x43')](handleError(_0x122a1d,null));};exports[_0xc01d('0x47')]=function(_0x314b50,_0x4813e3){return db[_0xc01d('0x2b')][_0xc01d('0x47')](_0x314b50[_0xc01d('0x48')],{})[_0xc01d('0x23')](respondWithResult(_0x4813e3,0xc9))[_0xc01d('0x43')](handleError(_0x4813e3,null));};exports[_0xc01d('0x22')]=function(_0x27435c,_0x538a8b){if(_0x27435c[_0xc01d('0x48')]['id']){delete _0x27435c[_0xc01d('0x48')]['id'];}return db[_0xc01d('0x2b')][_0xc01d('0x49')]({'where':{'id':_0x27435c[_0xc01d('0x44')]['id']}})[_0xc01d('0x23')](handleEntityNotFound(_0x538a8b,null))[_0xc01d('0x23')](saveUpdates(_0x27435c[_0xc01d('0x48')],null))[_0xc01d('0x23')](respondWithResult(_0x538a8b,null))[_0xc01d('0x43')](handleError(_0x538a8b,null));};exports[_0xc01d('0x24')]=function(_0x5ccfd1,_0x1b05b0){return db[_0xc01d('0x2b')]['find']({'where':{'id':_0x5ccfd1[_0xc01d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b05b0,null))[_0xc01d('0x23')](removeEntity(_0x1b05b0,null))[_0xc01d('0x43')](handleError(_0x1b05b0,null));}; \ No newline at end of file +var _0x961a=['sendStatus','end','json','count','offset','limit','set','apply','reject','save','update','destroy','status','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x961a,0x15d));var _0xa961=function(_0x369769,_0x387704){_0x369769=_0x369769-0x0;var _0x52451b=_0x961a[_0x369769];return _0x52451b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa961('0x0'));var rimraf=require(_0xa961('0x1'));var zipdir=require(_0xa961('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa961('0x3'));var moment=require(_0xa961('0x4'));var BPromise=require(_0xa961('0x5'));var Mustache=require(_0xa961('0x6'));var util=require('util');var path=require(_0xa961('0x7'));var sox=require('sox');var csv=require(_0xa961('0x8'));var ejs=require(_0xa961('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa961('0xa'));var crypto=require(_0xa961('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa961('0xc'));var toCsv=require(_0xa961('0x8'));var querystring=require(_0xa961('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa961('0xe'));var qs=require(_0xa961('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa961('0x10'));var logger=require('../../config/logger')(_0xa961('0x11'));var utils=require(_0xa961('0x12'));var config=require(_0xa961('0x13'));var db=require(_0xa961('0x14'))['db'];function respondWithStatusCode(_0x24ec87,_0x1de817){_0x1de817=_0x1de817||0xcc;return function(_0x75d79f){if(_0x75d79f){return _0x24ec87[_0xa961('0x15')](_0x1de817);}return _0x24ec87['status'](_0x1de817)[_0xa961('0x16')]();};}function respondWithResult(_0x3cc376,_0x53b865){_0x53b865=_0x53b865||0xc8;return function(_0x1d36ed){if(_0x1d36ed){return _0x3cc376['status'](_0x53b865)[_0xa961('0x17')](_0x1d36ed);}};}function respondWithFilteredResult(_0x4d040c,_0x91bfe){return function(_0x27b654){if(_0x27b654){var _0x3a9da6=_0x27b654[_0xa961('0x18')],_0x550dce=_0x91bfe[_0xa961('0x19')],_0x2a6d74=_0x91bfe[_0xa961('0x19')]+_0x91bfe[_0xa961('0x1a')],_0x55324e;if(_0x2a6d74>=_0x3a9da6){_0x2a6d74=_0x3a9da6;_0x55324e=0xc8;}else{_0x55324e=0xce;}_0x4d040c['status'](_0x55324e);return _0x4d040c[_0xa961('0x1b')]('Content-Range',_0x550dce+'-'+_0x2a6d74+'/'+_0x3a9da6)[_0xa961('0x17')](_0x27b654);}return null;};}function patchUpdates(_0x3bcbb9){return function(_0x5696ea){try{jsonpatch[_0xa961('0x1c')](_0x5696ea,_0x3bcbb9,!![]);}catch(_0x579bc1){return BPromise[_0xa961('0x1d')](_0x579bc1);}return _0x5696ea[_0xa961('0x1e')]();};}function saveUpdates(_0x518690,_0x56551c){return function(_0x26f3d9){if(_0x26f3d9){return _0x26f3d9[_0xa961('0x1f')](_0x518690)['then'](function(_0x2c90a2){return _0x2c90a2;});}return null;};}function removeEntity(_0x5b6532,_0x26f5c8){return function(_0x11ca0d){if(_0x11ca0d){return _0x11ca0d[_0xa961('0x20')]()['then'](function(){_0x5b6532[_0xa961('0x21')](0xcc)[_0xa961('0x16')]();});}};}function handleEntityNotFound(_0x2c9984,_0x3eab07){return function(_0x53f83a){if(!_0x53f83a){_0x2c9984[_0xa961('0x15')](0x194);}return _0x53f83a;};}function handleError(_0x3b3a89,_0x3398a0){_0x3398a0=_0x3398a0||0x1f4;return function(_0xeca7df){logger[_0xa961('0x22')](_0xeca7df[_0xa961('0x23')]);if(_0xeca7df['name']){delete _0xeca7df[_0xa961('0x24')];}_0x3b3a89[_0xa961('0x21')](_0x3398a0)[_0xa961('0x25')](_0xeca7df);};}exports[_0xa961('0x26')]=function(_0x53493a,_0x2eae15){var _0x49c3fc={},_0x7fe5d2={},_0xa8f132={'count':0x0,'rows':[]};var _0x25ee05=_[_0xa961('0x27')](db[_0xa961('0x28')][_0xa961('0x29')],function(_0x5f40db){return{'name':_0x5f40db[_0xa961('0x2a')],'type':_0x5f40db[_0xa961('0x2b')][_0xa961('0x2c')]};});_0x7fe5d2[_0xa961('0x2d')]=_[_0xa961('0x27')](_0x25ee05,_0xa961('0x24'));_0x7fe5d2[_0xa961('0x2e')]=_[_0xa961('0x2f')](_0x53493a[_0xa961('0x2e')]);_0x7fe5d2[_0xa961('0x30')]=_[_0xa961('0x31')](_0x7fe5d2['model'],_0x7fe5d2['query']);_0x49c3fc[_0xa961('0x32')]=_[_0xa961('0x31')](_0x7fe5d2[_0xa961('0x2d')],qs[_0xa961('0x33')](_0x53493a[_0xa961('0x2e')][_0xa961('0x33')]));_0x49c3fc[_0xa961('0x32')]=_0x49c3fc[_0xa961('0x32')][_0xa961('0x34')]?_0x49c3fc[_0xa961('0x32')]:_0x7fe5d2[_0xa961('0x2d')];if(!_0x53493a['query'][_0xa961('0x35')](_0xa961('0x36'))){_0x49c3fc[_0xa961('0x1a')]=qs[_0xa961('0x1a')](_0x53493a[_0xa961('0x2e')][_0xa961('0x1a')]);_0x49c3fc[_0xa961('0x19')]=qs[_0xa961('0x19')](_0x53493a[_0xa961('0x2e')]['offset']);}_0x49c3fc[_0xa961('0x37')]=qs[_0xa961('0x38')](_0x53493a[_0xa961('0x2e')]['sort']);_0x49c3fc[_0xa961('0x39')]=qs[_0xa961('0x30')](_[_0xa961('0x3a')](_0x53493a['query'],_0x7fe5d2[_0xa961('0x30')]),_0x25ee05);if(_0x53493a[_0xa961('0x2e')]['filter']){_0x49c3fc[_0xa961('0x39')]=_[_0xa961('0x3b')](_0x49c3fc[_0xa961('0x39')],{'$or':_[_0xa961('0x27')](_0x25ee05,function(_0x4c2558){if(_0x4c2558[_0xa961('0x2b')]!==_0xa961('0x3c')){var _0x310ff3={};_0x310ff3[_0x4c2558[_0xa961('0x24')]]={'$like':'%'+_0x53493a[_0xa961('0x2e')][_0xa961('0x3d')]+'%'};return _0x310ff3;}})});}_0x49c3fc=_[_0xa961('0x3b')]({},_0x49c3fc,_0x53493a[_0xa961('0x3e')]);var _0x163580={'where':_0x49c3fc[_0xa961('0x39')]};return db['FreshdeskField'][_0xa961('0x18')](_0x163580)[_0xa961('0x3f')](function(_0x597de9){_0xa8f132[_0xa961('0x18')]=_0x597de9;if(_0x53493a[_0xa961('0x2e')]['includeAll']){_0x49c3fc[_0xa961('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa961('0x41')](_0x49c3fc);})[_0xa961('0x3f')](function(_0x46bfc6){_0xa8f132[_0xa961('0x42')]=_0x46bfc6;return _0xa8f132;})['then'](respondWithFilteredResult(_0x2eae15,_0x49c3fc))[_0xa961('0x43')](handleError(_0x2eae15,null));};exports[_0xa961('0x44')]=function(_0x266e79,_0x40e179){var _0x2b3b25={'raw':!![],'where':{'id':_0x266e79[_0xa961('0x45')]['id']}},_0x3f1d3a={};_0x3f1d3a[_0xa961('0x2d')]=_[_0xa961('0x2f')](db[_0xa961('0x28')][_0xa961('0x29')]);_0x3f1d3a[_0xa961('0x2e')]=_[_0xa961('0x2f')](_0x266e79[_0xa961('0x2e')]);_0x3f1d3a[_0xa961('0x30')]=_['intersection'](_0x3f1d3a[_0xa961('0x2d')],_0x3f1d3a[_0xa961('0x2e')]);_0x2b3b25[_0xa961('0x32')]=_[_0xa961('0x31')](_0x3f1d3a[_0xa961('0x2d')],qs['fields'](_0x266e79[_0xa961('0x2e')]['fields']));_0x2b3b25[_0xa961('0x32')]=_0x2b3b25[_0xa961('0x32')][_0xa961('0x34')]?_0x2b3b25[_0xa961('0x32')]:_0x3f1d3a[_0xa961('0x2d')];if(_0x266e79[_0xa961('0x2e')][_0xa961('0x46')]){_0x2b3b25[_0xa961('0x40')]=[{'all':!![]}];}_0x2b3b25=_['merge']({},_0x2b3b25,_0x266e79[_0xa961('0x3e')]);return db[_0xa961('0x28')][_0xa961('0x47')](_0x2b3b25)[_0xa961('0x3f')](handleEntityNotFound(_0x40e179,null))[_0xa961('0x3f')](respondWithResult(_0x40e179,null))[_0xa961('0x43')](handleError(_0x40e179,null));};exports[_0xa961('0x48')]=function(_0xb749df,_0xbf85b8){return db[_0xa961('0x28')][_0xa961('0x48')](_0xb749df['body'],{})['then'](respondWithResult(_0xbf85b8,0xc9))[_0xa961('0x43')](handleError(_0xbf85b8,null));};exports[_0xa961('0x1f')]=function(_0x3de0a7,_0x1fd38e){if(_0x3de0a7['body']['id']){delete _0x3de0a7[_0xa961('0x49')]['id'];}return db[_0xa961('0x28')][_0xa961('0x47')]({'where':{'id':_0x3de0a7[_0xa961('0x45')]['id']}})[_0xa961('0x3f')](handleEntityNotFound(_0x1fd38e,null))[_0xa961('0x3f')](saveUpdates(_0x3de0a7[_0xa961('0x49')],null))[_0xa961('0x3f')](respondWithResult(_0x1fd38e,null))[_0xa961('0x43')](handleError(_0x1fd38e,null));};exports[_0xa961('0x20')]=function(_0x91a3f0,_0x5df5c6){return db['FreshdeskField'][_0xa961('0x47')]({'where':{'id':_0x91a3f0[_0xa961('0x45')]['id']}})[_0xa961('0x3f')](handleEntityNotFound(_0x5df5c6,null))[_0xa961('0x3f')](removeEntity(_0x5df5c6,null))[_0xa961('0x43')](handleError(_0x5df5c6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 129daab..c05f7c7 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 _0xe318=['request-promise','../../config/environment','./intFreshdeskField.attributes','exports','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe318,0x70));var _0x8e31=function(_0x2b7d,_0x3aba6f){_0x2b7d=_0x2b7d-0x0;var _0x6e5585=_0xe318[_0x2b7d];return _0x6e5585;};'use strict';var _=require(_0x8e31('0x0'));var util=require(_0x8e31('0x1'));var logger=require(_0x8e31('0x2'))(_0x8e31('0x3'));var moment=require(_0x8e31('0x4'));var BPromise=require('bluebird');var rp=require(_0x8e31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e31('0x6'));var attributes=require(_0x8e31('0x7'));module[_0x8e31('0x8')]=function(_0x3abb78,_0x36fe85){return _0x3abb78['define']('FreshdeskField',attributes,{'tableName':_0x8e31('0x9'),'paranoid':![],'indexes':[{'name':_0x8e31('0xa'),'fields':[_0x8e31('0xb'),_0x8e31('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x901a=['freshdesk_unique_index','util','../../config/logger','api','moment','bluebird','rimraf','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x882c43,_0x3f9678){var _0x297932=function(_0x3437a8){while(--_0x3437a8){_0x882c43['push'](_0x882c43['shift']());}};_0x297932(++_0x3f9678);}(_0x901a,0x109));var _0xa901=function(_0x1f2100,_0x476547){_0x1f2100=_0x1f2100-0x0;var _0x1c3073=_0x901a[_0x1f2100];return _0x1c3073;};'use strict';var _=require('lodash');var util=require(_0xa901('0x0'));var logger=require(_0xa901('0x1'))(_0xa901('0x2'));var moment=require(_0xa901('0x3'));var BPromise=require(_0xa901('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa901('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xa901('0x6')]=function(_0x145bca,_0x566d0e){return _0x145bca[_0xa901('0x7')](_0xa901('0x8'),attributes,{'tableName':_0xa901('0x9'),'paranoid':![],'indexes':[{'name':_0xa901('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 6d6687d..8b6df82 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x24617a,_0x2b9154){var _0x3f235b=function(_0x49623b){while(--_0x49623b){_0x24617a['push'](_0x24617a['shift']());}};_0x3f235b(++_0x2b9154);}(_0xb10b,0x12a));var _0xbb10=function(_0x7d261d,_0x4e1d2f){_0x7d261d=_0x7d261d-0x0;var _0x1a992a=_0xb10b[_0x7d261d];return _0x1a992a;};'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);});});} \ 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x25db40,_0x341aa4){_0x25db40=_0x25db40-0x0;var _0x706f01=_0x7a54[_0x25db40];return _0x706f01;};'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 435a4b0..8e6ba39 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 _0xa83b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0xa83b,0x1bf));var _0xba83=function(_0x2029ef,_0x28a5a6){_0x2029ef=_0x2029ef-0x0;var _0xcbaf98=_0xa83b[_0x2029ef];return _0xcbaf98;};'use strict';var multer=require(_0xba83('0x0'));var util=require(_0xba83('0x1'));var path=require('path');var timeout=require(_0xba83('0x2'));var express=require(_0xba83('0x3'));var router=express[_0xba83('0x4')]();var auth=require(_0xba83('0x5'));var interaction=require(_0xba83('0x6'));var config=require(_0xba83('0x7'));var controller=require(_0xba83('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xba83('0x9')]);router[_0xba83('0xa')](_0xba83('0xb'),auth['isAuthenticated'](),controller[_0xba83('0xc')]);router['get'](_0xba83('0xd'),auth[_0xba83('0xe')](),controller[_0xba83('0xf')]);router[_0xba83('0xa')](_0xba83('0x10'),auth[_0xba83('0xe')](),controller[_0xba83('0x11')]);router[_0xba83('0x12')]('/',auth[_0xba83('0xe')](),controller[_0xba83('0x13')]);router[_0xba83('0x12')](_0xba83('0xd'),auth[_0xba83('0xe')](),controller['addConfiguration']);router[_0xba83('0x14')](_0xba83('0xb'),auth['isAuthenticated'](),controller[_0xba83('0x15')]);router[_0xba83('0x16')](_0xba83('0xb'),auth['isAuthenticated'](),controller[_0xba83('0x17')]);module[_0xba83('0x18')]=router; \ No newline at end of file +var _0xec04=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x1d94f7,_0x31b17f){var _0x2de986=function(_0x5ad760){while(--_0x5ad760){_0x1d94f7['push'](_0x1d94f7['shift']());}};_0x2de986(++_0x31b17f);}(_0xec04,0xfe));var _0x4ec0=function(_0x1e6c4c,_0x3cabd2){_0x1e6c4c=_0x1e6c4c-0x0;var _0x197114=_0xec04[_0x1e6c4c];return _0x197114;};'use strict';var multer=require(_0x4ec0('0x0'));var util=require(_0x4ec0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4ec0('0x2'));var router=express[_0x4ec0('0x3')]();var auth=require(_0x4ec0('0x4'));var interaction=require(_0x4ec0('0x5'));var config=require(_0x4ec0('0x6'));var controller=require(_0x4ec0('0x7'));router[_0x4ec0('0x8')]('/',auth[_0x4ec0('0x9')](),controller['index']);router['get'](_0x4ec0('0xa'),auth['isAuthenticated'](),controller[_0x4ec0('0xb')]);router[_0x4ec0('0x8')](_0x4ec0('0xc'),auth[_0x4ec0('0x9')](),controller[_0x4ec0('0xd')]);router[_0x4ec0('0x8')](_0x4ec0('0xe'),auth[_0x4ec0('0x9')](),controller[_0x4ec0('0xf')]);router[_0x4ec0('0x10')]('/',auth[_0x4ec0('0x9')](),controller[_0x4ec0('0x11')]);router[_0x4ec0('0x10')](_0x4ec0('0xc'),auth['isAuthenticated'](),controller[_0x4ec0('0x12')]);router[_0x4ec0('0x13')](_0x4ec0('0xa'),auth[_0x4ec0('0x9')](),controller[_0x4ec0('0x14')]);router[_0x4ec0('0x15')](_0x4ec0('0xa'),auth[_0x4ec0('0x9')](),controller[_0x4ec0('0x16')]);module[_0x4ec0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b98480d..a9a605e 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 _0xd5f9=['username','remoteUri','sequelize','exports','STRING'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x19c7a8,_0x10508d){_0x19c7a8=_0x19c7a8-0x0;var _0x1462ce=_0xd5f9[_0x19c7a8];return _0x1462ce;};'use strict';var Sequelize=require(_0x9d5f('0x0'));module[_0x9d5f('0x1')]={'name':{'type':Sequelize[_0x9d5f('0x2')]},'description':{'type':Sequelize[_0x9d5f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9d5f('0x3')},'apiKey':{'type':Sequelize[_0x9d5f('0x2')]},'remoteUri':{'type':Sequelize[_0x9d5f('0x2')],'unique':_0x9d5f('0x4')},'serverUrl':{'type':Sequelize[_0x9d5f('0x2')]}}; \ No newline at end of file +var _0xac35=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4f8a0f,_0x13c2cf){var _0x4e474a=function(_0x309ef6){while(--_0x309ef6){_0x4f8a0f['push'](_0x4f8a0f['shift']());}};_0x4e474a(++_0x13c2cf);}(_0xac35,0x141));var _0x5ac3=function(_0x11e3ef,_0x9abacf){_0x11e3ef=_0x11e3ef-0x0;var _0x2ea4f7=_0xac35[_0x11e3ef];return _0x2ea4f7;};'use strict';var Sequelize=require(_0x5ac3('0x0'));module[_0x5ac3('0x1')]={'name':{'type':Sequelize[_0x5ac3('0x2')]},'description':{'type':Sequelize[_0x5ac3('0x2')]},'username':{'type':Sequelize[_0x5ac3('0x2')],'unique':_0x5ac3('0x3')},'apiKey':{'type':Sequelize[_0x5ac3('0x2')]},'remoteUri':{'type':Sequelize[_0x5ac3('0x2')],'unique':_0x5ac3('0x4')},'serverUrl':{'type':Sequelize[_0x5ac3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 78ca02a..42ce2d4 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 _0x16e6=['lastIndexOf','GET','format','%s%s','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','end','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','fields','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring'];(function(_0x4c4f6f,_0x1fa579){var _0x4ec19e=function(_0x37ff69){while(--_0x37ff69){_0x4c4f6f['push'](_0x4c4f6f['shift']());}};_0x4ec19e(++_0x1fa579);}(_0x16e6,0x1c6));var _0x616e=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x16e6[_0x1ca9e9];return _0x309f3c;};'use strict';var pdf=require(_0x616e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x616e('0x1'));var jsonpatch=require(_0x616e('0x2'));var rp=require(_0x616e('0x3'));var moment=require(_0x616e('0x4'));var BPromise=require(_0x616e('0x5'));var Mustache=require(_0x616e('0x6'));var util=require(_0x616e('0x7'));var path=require(_0x616e('0x8'));var sox=require(_0x616e('0x9'));var csv=require('to-csv');var ejs=require(_0x616e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x616e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x616e('0xc'));var querystring=require(_0x616e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x616e('0xe'));var qs=require(_0x616e('0xf'));var as=require(_0x616e('0x10'));var hardwareService=require(_0x616e('0x11'));var logger=require('../../config/logger')(_0x616e('0x12'));var utils=require(_0x616e('0x13'));var config=require(_0x616e('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x616e('0x15'));var jayson=require(_0x616e('0x16'));var client=jayson[_0x616e('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x23af7f,_0x2a61ef,_0x1c2875){if(_0x1c2875){var _0x4c08da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c08da[_0x616e('0x18')](_0x2a61ef)){return _0x23af7f;}else{throw new db[(_0x616e('0x19'))][(_0x616e('0x1a'))](_0x616e('0x1b'));}}else{return _0x23af7f;}}function respondWithRpcPromise(_0x380088,_0x52a689,_0xc90f26,_0x10138e){return new BPromise(function(_0x191afa,_0x382e8f){var _0x3d91da=_0x10138e||client;return _0x3d91da['request'](_0x380088,_0xc90f26)['then'](function(_0x38d2a7){logger[_0x616e('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x52a689,_0x616e('0x1d'));logger[_0x616e('0x1e')](_0x616e('0x1f'),_0x52a689,_0x616e('0x1d'),JSON[_0x616e('0x20')](_0x38d2a7));if(_0x38d2a7['error']){if(_0x38d2a7[_0x616e('0x21')][_0x616e('0x22')]===0x1f4){logger[_0x616e('0x21')](_0x616e('0x23'),_0x52a689,_0x38d2a7[_0x616e('0x21')]['message']);return _0x382e8f(_0x38d2a7[_0x616e('0x21')][_0x616e('0x24')]);}logger['error'](_0x616e('0x23'),_0x52a689,_0x38d2a7[_0x616e('0x21')]['message']);return _0x191afa(_0x38d2a7[_0x616e('0x21')][_0x616e('0x24')]);}else{logger[_0x616e('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x52a689,_0x616e('0x1d'));_0x191afa(_0x38d2a7[_0x616e('0x25')][_0x616e('0x24')]);}})[_0x616e('0x26')](function(_0x3e052f){logger[_0x616e('0x21')](_0x616e('0x23'),_0x52a689,_0x3e052f);_0x382e8f(_0x3e052f);});});}function respondWithStatusCode(_0x542e9d,_0x45d473){_0x45d473=_0x45d473||0xcc;return function(_0x47320d){if(_0x47320d){return _0x542e9d[_0x616e('0x27')](_0x45d473);}return _0x542e9d[_0x616e('0x28')](_0x45d473)['end']();};}function respondWithResult(_0x5b2234,_0x13e30e){_0x13e30e=_0x13e30e||0xc8;return function(_0x3e744b){if(_0x3e744b){return _0x5b2234[_0x616e('0x28')](_0x13e30e)[_0x616e('0x29')](_0x3e744b);}};}function respondWithFilteredResult(_0x1017b1,_0x499fa3){return function(_0x501011){if(_0x501011){var _0x13fc7e=_0x501011[_0x616e('0x2a')],_0x23da99=_0x499fa3['offset'],_0x177c80=_0x499fa3[_0x616e('0x2b')]+_0x499fa3[_0x616e('0x2c')],_0x435c3c;if(_0x177c80>=_0x13fc7e){_0x177c80=_0x13fc7e;_0x435c3c=0xc8;}else{_0x435c3c=0xce;}_0x1017b1['status'](_0x435c3c);return _0x1017b1['set'](_0x616e('0x2d'),_0x23da99+'-'+_0x177c80+'/'+_0x13fc7e)[_0x616e('0x29')](_0x501011);}return null;};}function patchUpdates(_0x5efcb3){return function(_0x53b6c2){try{jsonpatch[_0x616e('0x2e')](_0x53b6c2,_0x5efcb3,!![]);}catch(_0x4895b1){return BPromise[_0x616e('0x2f')](_0x4895b1);}return _0x53b6c2['save']();};}function saveUpdates(_0x229953,_0x4810ea){return function(_0x3904bc){if(_0x3904bc){return _0x3904bc['update'](_0x229953)[_0x616e('0x30')](function(_0x102599){return _0x102599;});}return null;};}function removeEntity(_0x1341cc,_0x1e91a9){return function(_0x863d59){if(_0x863d59){return _0x863d59[_0x616e('0x31')]()['then'](function(){_0x1341cc['status'](0xcc)[_0x616e('0x32')]();});}};}function handleEntityNotFound(_0x2ab816,_0x2bbf5e){return function(_0x4551a3){if(!_0x4551a3){_0x2ab816[_0x616e('0x27')](0x194);}return _0x4551a3;};}function handleError(_0x4fe04d,_0x44b9b6){_0x44b9b6=_0x44b9b6||0x1f4;return function(_0x5116b9){logger[_0x616e('0x21')](_0x5116b9[_0x616e('0x33')]);if(_0x5116b9[_0x616e('0x34')]){delete _0x5116b9['name'];}_0x4fe04d[_0x616e('0x28')](_0x44b9b6)['send'](_0x5116b9);};}exports[_0x616e('0x35')]=function(_0x182351,_0x4d84a2){var _0x4237aa={},_0x1ca4f1={},_0x139a01={'count':0x0,'rows':[]};var _0x2a7aa8=_[_0x616e('0x36')](db[_0x616e('0x37')][_0x616e('0x38')],function(_0x5895fa){return{'name':_0x5895fa[_0x616e('0x39')],'type':_0x5895fa['type'][_0x616e('0x3a')]};});_0x1ca4f1[_0x616e('0x3b')]=_[_0x616e('0x36')](_0x2a7aa8,_0x616e('0x34'));_0x1ca4f1[_0x616e('0x3c')]=_[_0x616e('0x3d')](_0x182351['query']);_0x1ca4f1[_0x616e('0x3e')]=_['intersection'](_0x1ca4f1[_0x616e('0x3b')],_0x1ca4f1[_0x616e('0x3c')]);_0x4237aa[_0x616e('0x3f')]=_[_0x616e('0x40')](_0x1ca4f1[_0x616e('0x3b')],qs['fields'](_0x182351['query']['fields']));_0x4237aa[_0x616e('0x3f')]=_0x4237aa['attributes'][_0x616e('0x41')]?_0x4237aa[_0x616e('0x3f')]:_0x1ca4f1[_0x616e('0x3b')];if(!_0x182351[_0x616e('0x3c')]['hasOwnProperty'](_0x616e('0x42'))){_0x4237aa['limit']=qs['limit'](_0x182351[_0x616e('0x3c')][_0x616e('0x2c')]);_0x4237aa['offset']=qs[_0x616e('0x2b')](_0x182351[_0x616e('0x3c')]['offset']);}_0x4237aa[_0x616e('0x43')]=qs['sort'](_0x182351['query']['sort']);_0x4237aa[_0x616e('0x44')]=qs[_0x616e('0x3e')](_[_0x616e('0x45')](_0x182351['query'],_0x1ca4f1[_0x616e('0x3e')]),_0x2a7aa8);if(_0x182351['query'][_0x616e('0x46')]){_0x4237aa[_0x616e('0x44')]=_[_0x616e('0x47')](_0x4237aa['where'],{'$or':_[_0x616e('0x36')](_0x2a7aa8,function(_0x31f9c8){if(_0x31f9c8[_0x616e('0x48')]!==_0x616e('0x49')){var _0x4acd59={};_0x4acd59[_0x31f9c8[_0x616e('0x34')]]={'$like':'%'+_0x182351[_0x616e('0x3c')]['filter']+'%'};return _0x4acd59;}})});}_0x4237aa=_[_0x616e('0x47')]({},_0x4237aa,_0x182351['options']);var _0x270387={'where':_0x4237aa['where']};return db[_0x616e('0x37')]['count'](_0x270387)[_0x616e('0x30')](function(_0x2a3c26){_0x139a01[_0x616e('0x2a')]=_0x2a3c26;if(_0x182351[_0x616e('0x3c')][_0x616e('0x4a')]){_0x4237aa[_0x616e('0x4b')]=[{'all':!![]}];}return db[_0x616e('0x37')][_0x616e('0x4c')](_0x4237aa);})[_0x616e('0x30')](function(_0x560673){_0x139a01['rows']=_0x560673;return _0x139a01;})[_0x616e('0x30')](respondWithFilteredResult(_0x4d84a2,_0x4237aa))['catch'](handleError(_0x4d84a2,null));};exports[_0x616e('0x4d')]=function(_0xfa55f2,_0x4fc641){var _0x2b4f25={'raw':![],'where':{'id':_0xfa55f2[_0x616e('0x4e')]['id']}},_0x73d7ef={};_0x73d7ef['model']=_[_0x616e('0x3d')](db[_0x616e('0x37')][_0x616e('0x38')]);_0x73d7ef['query']=_[_0x616e('0x3d')](_0xfa55f2[_0x616e('0x3c')]);_0x73d7ef[_0x616e('0x3e')]=_[_0x616e('0x40')](_0x73d7ef[_0x616e('0x3b')],_0x73d7ef[_0x616e('0x3c')]);_0x2b4f25[_0x616e('0x3f')]=_[_0x616e('0x40')](_0x73d7ef[_0x616e('0x3b')],qs[_0x616e('0x4f')](_0xfa55f2[_0x616e('0x3c')][_0x616e('0x4f')]));_0x2b4f25[_0x616e('0x3f')]=_0x2b4f25[_0x616e('0x3f')][_0x616e('0x41')]?_0x2b4f25[_0x616e('0x3f')]:_0x73d7ef[_0x616e('0x3b')];if(_0xfa55f2['query'][_0x616e('0x4a')]){_0x2b4f25['include']=[{'all':!![]}];}_0x2b4f25=_[_0x616e('0x47')]({},_0x2b4f25,_0xfa55f2[_0x616e('0x50')]);return db[_0x616e('0x37')][_0x616e('0x51')](_0x2b4f25)['then'](handleEntityNotFound(_0x4fc641,null))[_0x616e('0x30')](respondWithResult(_0x4fc641,null))['catch'](handleError(_0x4fc641,null));};exports['create']=function(_0x9dc563,_0x5f2e24){return db[_0x616e('0x37')][_0x616e('0x52')](_0x9dc563[_0x616e('0x53')],{})[_0x616e('0x30')](respondWithResult(_0x5f2e24,0xc9))[_0x616e('0x26')](handleError(_0x5f2e24,null));};exports['update']=function(_0x4073de,_0x1714d0){if(_0x4073de['body']['id']){delete _0x4073de['body']['id'];}return db[_0x616e('0x37')][_0x616e('0x51')]({'where':{'id':_0x4073de['params']['id']}})[_0x616e('0x30')](handleEntityNotFound(_0x1714d0,null))[_0x616e('0x30')](saveUpdates(_0x4073de[_0x616e('0x53')],null))[_0x616e('0x30')](respondWithResult(_0x1714d0,null))[_0x616e('0x26')](handleError(_0x1714d0,null));};exports[_0x616e('0x31')]=function(_0xd96dae,_0xb7e706){return db[_0x616e('0x37')][_0x616e('0x51')]({'where':{'id':_0xd96dae[_0x616e('0x4e')]['id']}})[_0x616e('0x30')](handleEntityNotFound(_0xb7e706,null))[_0x616e('0x30')](removeEntity(_0xb7e706,null))[_0x616e('0x26')](handleError(_0xb7e706,null));};exports[_0x616e('0x54')]=function(_0x8175d3,_0x5ec96b,_0x216c92){var _0x46d286={};var _0x4839e9={};var _0x5eb757;var _0x1eb47f;return db['FreshsalesAccount'][_0x616e('0x55')]({'where':{'id':_0x8175d3[_0x616e('0x4e')]['id']}})[_0x616e('0x30')](handleEntityNotFound(_0x5ec96b,null))[_0x616e('0x30')](function(_0x406477){if(_0x406477){_0x5eb757=_0x406477;_0x4839e9[_0x616e('0x3b')]=_[_0x616e('0x3d')](db[_0x616e('0x56')][_0x616e('0x38')]);_0x4839e9[_0x616e('0x3c')]=_[_0x616e('0x3d')](_0x8175d3['query']);_0x4839e9['filters']=_[_0x616e('0x40')](_0x4839e9['model'],_0x4839e9['query']);_0x46d286[_0x616e('0x3f')]=_[_0x616e('0x40')](_0x4839e9[_0x616e('0x3b')],qs[_0x616e('0x4f')](_0x8175d3[_0x616e('0x3c')]['fields']));_0x46d286['attributes']=_0x46d286[_0x616e('0x3f')][_0x616e('0x41')]?_0x46d286[_0x616e('0x3f')]:_0x4839e9[_0x616e('0x3b')];_0x46d286['order']=qs['sort'](_0x8175d3[_0x616e('0x3c')][_0x616e('0x57')]);_0x46d286[_0x616e('0x44')]=qs[_0x616e('0x3e')](_[_0x616e('0x45')](_0x8175d3[_0x616e('0x3c')],_0x4839e9[_0x616e('0x3e')]));if(_0x8175d3[_0x616e('0x3c')][_0x616e('0x46')]){_0x46d286['where']=_[_0x616e('0x47')](_0x46d286[_0x616e('0x44')],{'$or':_[_0x616e('0x36')](_0x46d286['attributes'],function(_0x3518df){var _0x37d8cd={};_0x37d8cd[_0x3518df]={'$like':'%'+_0x8175d3[_0x616e('0x3c')][_0x616e('0x46')]+'%'};return _0x37d8cd;})});}_0x46d286=_[_0x616e('0x47')]({},_0x46d286,_0x8175d3[_0x616e('0x50')]);return _0x5eb757[_0x616e('0x54')](_0x46d286);}})[_0x616e('0x30')](function(_0x2028cc){if(_0x2028cc){_0x1eb47f=_0x2028cc[_0x616e('0x41')];if(!_0x8175d3['query'][_0x616e('0x58')]('nolimit')){_0x46d286['limit']=qs[_0x616e('0x2c')](_0x8175d3['query'][_0x616e('0x2c')]);_0x46d286[_0x616e('0x2b')]=qs[_0x616e('0x2b')](_0x8175d3[_0x616e('0x3c')][_0x616e('0x2b')]);}return _0x5eb757['getConfigurations'](_0x46d286);}})['then'](function(_0xafa072){if(_0xafa072){return _0xafa072?{'count':_0x1eb47f,'rows':_0xafa072}:null;}})['then'](respondWithResult(_0x5ec96b,null))[_0x616e('0x26')](handleError(_0x5ec96b,null));};exports['addConfiguration']=function(_0x49d5ce,_0x413d96,_0x11cb42){if(_0x49d5ce[_0x616e('0x53')]['id']){delete _0x49d5ce[_0x616e('0x53')]['id'];}return db[_0x616e('0x37')][_0x616e('0x55')]({'where':{'id':_0x49d5ce[_0x616e('0x4e')]['id']}})[_0x616e('0x30')](handleEntityNotFound(_0x413d96,null))[_0x616e('0x30')](function(_0x2c6595){if(_0x2c6595){_0x49d5ce[_0x616e('0x53')][_0x616e('0x59')]=_0x2c6595['id'];_0x49d5ce['body'][_0x616e('0x5a')]=integrations[_0x616e('0x5b')](_0x49d5ce[_0x616e('0x53')][_0x616e('0x5c')],_0x49d5ce[_0x616e('0x53')][_0x616e('0x48')]);_0x49d5ce[_0x616e('0x53')][_0x616e('0x5d')]=integrations['getDescriptions'](_0x49d5ce['body'][_0x616e('0x5c')],_0x49d5ce[_0x616e('0x53')][_0x616e('0x48')]);return db[_0x616e('0x56')][_0x616e('0x52')](_0x49d5ce[_0x616e('0x53')],{'include':[{'model':db[_0x616e('0x5e')],'as':_0x616e('0x5a')},{'model':db[_0x616e('0x5e')],'as':'Descriptions'}]});}return null;})[_0x616e('0x30')](respondWithResult(_0x413d96,null))[_0x616e('0x26')](handleError(_0x413d96,null));};exports[_0x616e('0x5f')]=function(_0x518fcf,_0x400a05,_0x57bc55){var _0x529bf6='';var _0x593d2c='';return db[_0x616e('0x37')][_0x616e('0x55')]({'where':{'id':_0x518fcf[_0x616e('0x4e')]['id']},'attributes':['id',_0x616e('0x60'),_0x616e('0x61'),_0x616e('0x62')]})[_0x616e('0x30')](handleEntityNotFound(_0x400a05,null))[_0x616e('0x30')](function(_0x1e4e31){if(_0x1e4e31){_0x593d2c=_0x1e4e31[_0x616e('0x60')];_0x529bf6=_0x1e4e31[_0x616e('0x61')];var _0x2df528=_0x1e4e31['remoteUri'][_0x616e('0x63')](-0x1);if(_0x2df528==='/'){_0x529bf6=_0x529bf6[_0x616e('0x64')](0x0,_0x529bf6[_0x616e('0x65')](_0x2df528));}return rp({'method':_0x616e('0x66'),'uri':util[_0x616e('0x67')](_0x616e('0x68'),_0x529bf6,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x1e4e31[_0x616e('0x62')]},'json':!![]});}})[_0x616e('0x30')](function(_0xa61cb0){if(_0xa61cb0){var _0x354b13=_0xa61cb0[_0x616e('0x69')];var _0x300163=![];var _0x156cd7=null;for(_0x156cd7=0x0;_0x156cd7<_0x354b13['length'];_0x156cd7++){if(_0x354b13[_0x156cd7][_0x616e('0x6a')]===_0x593d2c){_0x300163=!![];}}if(_0x300163){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x616e('0x6b')});}}})[_0x616e('0x30')](respondWithResult(_0x400a05,null))[_0x616e('0x26')](function(_0xbc75b9){var _0x54b8c7=_0x518fcf[_0x616e('0x3c')][_0x616e('0x18')]?0x1f4:_0xbc75b9[_0x616e('0x6c')]||0x1f4;logger[_0x616e('0x21')](_0x616e('0x6d'),_0x616e('0x5f'),_0x54b8c7,JSON[_0x616e('0x20')](_0xbc75b9));delete _0xbc75b9[_0x616e('0x34')];if(_0x54b8c7===0x191){_0x54b8c7=0x190;}_0x400a05[_0x616e('0x28')](_0x54b8c7)['send'](_0x518fcf[_0x616e('0x3c')][_0x616e('0x18')]?{'message':_0x616e('0x6e'),'statusCode':_0xbc75b9['statusCode']}:_0xbc75b9);});}; \ No newline at end of file +var _0xf237=['hasOwnProperty','nolimit','order','sort','filters','pick','filter','VIRTUAL','merge','options','where','FreshsalesAccount','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x5f2a45,_0x671ddb){var _0x2e1455=function(_0x592df4){while(--_0x592df4){_0x5f2a45['push'](_0x5f2a45['shift']());}};_0x2e1455(++_0x671ddb);}(_0xf237,0x17e));var _0x7f23=function(_0x3788b7,_0x58da91){_0x3788b7=_0x3788b7-0x0;var _0x173510=_0xf237[_0x3788b7];return _0x173510;};'use strict';var pdf=require(_0x7f23('0x0'));var emlformat=require(_0x7f23('0x1'));var rimraf=require(_0x7f23('0x2'));var zipdir=require(_0x7f23('0x3'));var jsonpatch=require(_0x7f23('0x4'));var rp=require(_0x7f23('0x5'));var moment=require(_0x7f23('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7f23('0x7'));var util=require(_0x7f23('0x8'));var path=require('path');var sox=require(_0x7f23('0x9'));var csv=require(_0x7f23('0xa'));var ejs=require(_0x7f23('0xb'));var fs=require('fs');var _=require(_0x7f23('0xc'));var squel=require(_0x7f23('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7f23('0xe'));var toCsv=require(_0x7f23('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7f23('0xf'));var authService=require(_0x7f23('0x10'));var qs=require(_0x7f23('0x11'));var as=require(_0x7f23('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f23('0x13'))('api');var utils=require(_0x7f23('0x14'));var config=require(_0x7f23('0x15'));var db=require(_0x7f23('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7f23('0x17'));var client=jayson[_0x7f23('0x18')][_0x7f23('0x19')]({'port':0x232a});function checkPasswordPattern(_0x13810a,_0x29eb00,_0x541be3){if(_0x541be3){var _0x4eb8a5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4eb8a5[_0x7f23('0x1a')](_0x29eb00)){return _0x13810a;}else{throw new db['Sequelize'][(_0x7f23('0x1b'))](_0x7f23('0x1c'));}}else{return _0x13810a;}}function respondWithRpcPromise(_0x311449,_0x3566f4,_0x4108ef,_0x52d267){return new BPromise(function(_0x1183df,_0x365e61){var _0x2f220f=_0x52d267||client;return _0x2f220f[_0x7f23('0x1d')](_0x311449,_0x4108ef)[_0x7f23('0x1e')](function(_0x529970){logger[_0x7f23('0x1f')](_0x7f23('0x20'),_0x3566f4,'request\x20sent');logger[_0x7f23('0x21')](_0x7f23('0x22'),_0x3566f4,_0x7f23('0x23'),JSON[_0x7f23('0x24')](_0x529970));if(_0x529970[_0x7f23('0x25')]){if(_0x529970[_0x7f23('0x25')][_0x7f23('0x26')]===0x1f4){logger[_0x7f23('0x25')](_0x7f23('0x20'),_0x3566f4,_0x529970[_0x7f23('0x25')][_0x7f23('0x27')]);return _0x365e61(_0x529970[_0x7f23('0x25')][_0x7f23('0x27')]);}logger[_0x7f23('0x25')](_0x7f23('0x20'),_0x3566f4,_0x529970[_0x7f23('0x25')][_0x7f23('0x27')]);return _0x1183df(_0x529970[_0x7f23('0x25')][_0x7f23('0x27')]);}else{logger[_0x7f23('0x1f')](_0x7f23('0x20'),_0x3566f4,_0x7f23('0x23'));_0x1183df(_0x529970['result'][_0x7f23('0x27')]);}})[_0x7f23('0x28')](function(_0x240804){logger[_0x7f23('0x25')](_0x7f23('0x20'),_0x3566f4,_0x240804);_0x365e61(_0x240804);});});}function respondWithStatusCode(_0x4e54bf,_0x541580){_0x541580=_0x541580||0xcc;return function(_0x32567b){if(_0x32567b){return _0x4e54bf[_0x7f23('0x29')](_0x541580);}return _0x4e54bf[_0x7f23('0x2a')](_0x541580)[_0x7f23('0x2b')]();};}function respondWithResult(_0x260f3b,_0xe30347){_0xe30347=_0xe30347||0xc8;return function(_0x12412d){if(_0x12412d){return _0x260f3b[_0x7f23('0x2a')](_0xe30347)[_0x7f23('0x2c')](_0x12412d);}};}function respondWithFilteredResult(_0x435065,_0x506a47){return function(_0x58b8cd){if(_0x58b8cd){var _0x2a5c88=_0x58b8cd[_0x7f23('0x2d')],_0x33c40e=_0x506a47[_0x7f23('0x2e')],_0x2efa50=_0x506a47[_0x7f23('0x2e')]+_0x506a47[_0x7f23('0x2f')],_0xf1bbc6;if(_0x2efa50>=_0x2a5c88){_0x2efa50=_0x2a5c88;_0xf1bbc6=0xc8;}else{_0xf1bbc6=0xce;}_0x435065[_0x7f23('0x2a')](_0xf1bbc6);return _0x435065[_0x7f23('0x30')]('Content-Range',_0x33c40e+'-'+_0x2efa50+'/'+_0x2a5c88)[_0x7f23('0x2c')](_0x58b8cd);}return null;};}function patchUpdates(_0x1b37b2){return function(_0x6840a5){try{jsonpatch['apply'](_0x6840a5,_0x1b37b2,!![]);}catch(_0x5dbcbd){return BPromise[_0x7f23('0x31')](_0x5dbcbd);}return _0x6840a5[_0x7f23('0x32')]();};}function saveUpdates(_0x37b3a8,_0x58a8f2){return function(_0x1bd3ac){if(_0x1bd3ac){return _0x1bd3ac['update'](_0x37b3a8)['then'](function(_0xa817e0){return _0xa817e0;});}return null;};}function removeEntity(_0x1a649f,_0x6f56a6){return function(_0x9ade64){if(_0x9ade64){return _0x9ade64[_0x7f23('0x33')]()[_0x7f23('0x1e')](function(){_0x1a649f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4708b4,_0xb2ab46){return function(_0xe61678){if(!_0xe61678){_0x4708b4[_0x7f23('0x29')](0x194);}return _0xe61678;};}function handleError(_0x2faa65,_0xb9bdbd){_0xb9bdbd=_0xb9bdbd||0x1f4;return function(_0x3183d0){logger[_0x7f23('0x25')](_0x3183d0[_0x7f23('0x34')]);if(_0x3183d0[_0x7f23('0x35')]){delete _0x3183d0[_0x7f23('0x35')];}_0x2faa65[_0x7f23('0x2a')](_0xb9bdbd)[_0x7f23('0x36')](_0x3183d0);};}exports['index']=function(_0x1645fb,_0x4e2188){var _0x7d6d8e={},_0x1d6ab4={},_0x3396b6={'count':0x0,'rows':[]};var _0x563ab0=_[_0x7f23('0x37')](db['FreshsalesAccount']['rawAttributes'],function(_0x226f87){return{'name':_0x226f87[_0x7f23('0x38')],'type':_0x226f87[_0x7f23('0x39')][_0x7f23('0x3a')]};});_0x1d6ab4[_0x7f23('0x3b')]=_[_0x7f23('0x37')](_0x563ab0,_0x7f23('0x35'));_0x1d6ab4[_0x7f23('0x3c')]=_[_0x7f23('0x3d')](_0x1645fb[_0x7f23('0x3c')]);_0x1d6ab4['filters']=_[_0x7f23('0x3e')](_0x1d6ab4[_0x7f23('0x3b')],_0x1d6ab4[_0x7f23('0x3c')]);_0x7d6d8e[_0x7f23('0x3f')]=_['intersection'](_0x1d6ab4['model'],qs[_0x7f23('0x40')](_0x1645fb[_0x7f23('0x3c')][_0x7f23('0x40')]));_0x7d6d8e[_0x7f23('0x3f')]=_0x7d6d8e[_0x7f23('0x3f')][_0x7f23('0x41')]?_0x7d6d8e[_0x7f23('0x3f')]:_0x1d6ab4[_0x7f23('0x3b')];if(!_0x1645fb[_0x7f23('0x3c')][_0x7f23('0x42')](_0x7f23('0x43'))){_0x7d6d8e[_0x7f23('0x2f')]=qs[_0x7f23('0x2f')](_0x1645fb[_0x7f23('0x3c')][_0x7f23('0x2f')]);_0x7d6d8e[_0x7f23('0x2e')]=qs[_0x7f23('0x2e')](_0x1645fb['query']['offset']);}_0x7d6d8e[_0x7f23('0x44')]=qs['sort'](_0x1645fb[_0x7f23('0x3c')][_0x7f23('0x45')]);_0x7d6d8e['where']=qs[_0x7f23('0x46')](_[_0x7f23('0x47')](_0x1645fb[_0x7f23('0x3c')],_0x1d6ab4[_0x7f23('0x46')]),_0x563ab0);if(_0x1645fb[_0x7f23('0x3c')][_0x7f23('0x48')]){_0x7d6d8e['where']=_['merge'](_0x7d6d8e['where'],{'$or':_['map'](_0x563ab0,function(_0xaf491c){if(_0xaf491c['type']!==_0x7f23('0x49')){var _0x3fb8a0={};_0x3fb8a0[_0xaf491c['name']]={'$like':'%'+_0x1645fb[_0x7f23('0x3c')][_0x7f23('0x48')]+'%'};return _0x3fb8a0;}})});}_0x7d6d8e=_[_0x7f23('0x4a')]({},_0x7d6d8e,_0x1645fb[_0x7f23('0x4b')]);var _0x56da81={'where':_0x7d6d8e[_0x7f23('0x4c')]};return db[_0x7f23('0x4d')][_0x7f23('0x2d')](_0x56da81)[_0x7f23('0x1e')](function(_0x1d1aff){_0x3396b6[_0x7f23('0x2d')]=_0x1d1aff;if(_0x1645fb[_0x7f23('0x3c')][_0x7f23('0x4e')]){_0x7d6d8e[_0x7f23('0x4f')]=[{'all':!![]}];}return db[_0x7f23('0x4d')][_0x7f23('0x50')](_0x7d6d8e);})[_0x7f23('0x1e')](function(_0x5378af){_0x3396b6[_0x7f23('0x51')]=_0x5378af;return _0x3396b6;})[_0x7f23('0x1e')](respondWithFilteredResult(_0x4e2188,_0x7d6d8e))['catch'](handleError(_0x4e2188,null));};exports[_0x7f23('0x52')]=function(_0x31149b,_0x219ed6){var _0x2f8099={'raw':![],'where':{'id':_0x31149b[_0x7f23('0x53')]['id']}},_0x33233a={};_0x33233a[_0x7f23('0x3b')]=_[_0x7f23('0x3d')](db[_0x7f23('0x4d')][_0x7f23('0x54')]);_0x33233a['query']=_['keys'](_0x31149b[_0x7f23('0x3c')]);_0x33233a[_0x7f23('0x46')]=_[_0x7f23('0x3e')](_0x33233a[_0x7f23('0x3b')],_0x33233a[_0x7f23('0x3c')]);_0x2f8099[_0x7f23('0x3f')]=_[_0x7f23('0x3e')](_0x33233a['model'],qs['fields'](_0x31149b['query'][_0x7f23('0x40')]));_0x2f8099['attributes']=_0x2f8099['attributes'][_0x7f23('0x41')]?_0x2f8099[_0x7f23('0x3f')]:_0x33233a[_0x7f23('0x3b')];if(_0x31149b[_0x7f23('0x3c')][_0x7f23('0x4e')]){_0x2f8099['include']=[{'all':!![]}];}_0x2f8099=_[_0x7f23('0x4a')]({},_0x2f8099,_0x31149b['options']);return db['FreshsalesAccount'][_0x7f23('0x55')](_0x2f8099)[_0x7f23('0x1e')](handleEntityNotFound(_0x219ed6,null))[_0x7f23('0x1e')](respondWithResult(_0x219ed6,null))['catch'](handleError(_0x219ed6,null));};exports[_0x7f23('0x56')]=function(_0x3692b0,_0x5096ee){return db[_0x7f23('0x4d')][_0x7f23('0x56')](_0x3692b0[_0x7f23('0x57')],{})[_0x7f23('0x1e')](respondWithResult(_0x5096ee,0xc9))[_0x7f23('0x28')](handleError(_0x5096ee,null));};exports[_0x7f23('0x58')]=function(_0x1d838a,_0x2fc034){if(_0x1d838a[_0x7f23('0x57')]['id']){delete _0x1d838a[_0x7f23('0x57')]['id'];}return db['FreshsalesAccount'][_0x7f23('0x55')]({'where':{'id':_0x1d838a[_0x7f23('0x53')]['id']}})[_0x7f23('0x1e')](handleEntityNotFound(_0x2fc034,null))[_0x7f23('0x1e')](saveUpdates(_0x1d838a[_0x7f23('0x57')],null))[_0x7f23('0x1e')](respondWithResult(_0x2fc034,null))[_0x7f23('0x28')](handleError(_0x2fc034,null));};exports[_0x7f23('0x33')]=function(_0x3ee505,_0x55d604){return db['FreshsalesAccount'][_0x7f23('0x55')]({'where':{'id':_0x3ee505[_0x7f23('0x53')]['id']}})[_0x7f23('0x1e')](handleEntityNotFound(_0x55d604,null))[_0x7f23('0x1e')](removeEntity(_0x55d604,null))[_0x7f23('0x28')](handleError(_0x55d604,null));};exports[_0x7f23('0x59')]=function(_0x5dfde0,_0x2c0224,_0x24e6b9){var _0x135c5b={};var _0x1680b1={};var _0x388628;var _0x4bdf92;return db[_0x7f23('0x4d')][_0x7f23('0x5a')]({'where':{'id':_0x5dfde0['params']['id']}})['then'](handleEntityNotFound(_0x2c0224,null))[_0x7f23('0x1e')](function(_0x41749e){if(_0x41749e){_0x388628=_0x41749e;_0x1680b1['model']=_[_0x7f23('0x3d')](db[_0x7f23('0x5b')][_0x7f23('0x54')]);_0x1680b1[_0x7f23('0x3c')]=_[_0x7f23('0x3d')](_0x5dfde0[_0x7f23('0x3c')]);_0x1680b1[_0x7f23('0x46')]=_['intersection'](_0x1680b1[_0x7f23('0x3b')],_0x1680b1['query']);_0x135c5b[_0x7f23('0x3f')]=_['intersection'](_0x1680b1[_0x7f23('0x3b')],qs[_0x7f23('0x40')](_0x5dfde0['query']['fields']));_0x135c5b['attributes']=_0x135c5b['attributes']['length']?_0x135c5b[_0x7f23('0x3f')]:_0x1680b1[_0x7f23('0x3b')];_0x135c5b[_0x7f23('0x44')]=qs[_0x7f23('0x45')](_0x5dfde0[_0x7f23('0x3c')][_0x7f23('0x45')]);_0x135c5b[_0x7f23('0x4c')]=qs[_0x7f23('0x46')](_[_0x7f23('0x47')](_0x5dfde0['query'],_0x1680b1[_0x7f23('0x46')]));if(_0x5dfde0[_0x7f23('0x3c')][_0x7f23('0x48')]){_0x135c5b[_0x7f23('0x4c')]=_['merge'](_0x135c5b[_0x7f23('0x4c')],{'$or':_[_0x7f23('0x37')](_0x135c5b[_0x7f23('0x3f')],function(_0x349d90){var _0x423f1b={};_0x423f1b[_0x349d90]={'$like':'%'+_0x5dfde0[_0x7f23('0x3c')][_0x7f23('0x48')]+'%'};return _0x423f1b;})});}_0x135c5b=_[_0x7f23('0x4a')]({},_0x135c5b,_0x5dfde0[_0x7f23('0x4b')]);return _0x388628[_0x7f23('0x59')](_0x135c5b);}})[_0x7f23('0x1e')](function(_0x30dfdf){if(_0x30dfdf){_0x4bdf92=_0x30dfdf[_0x7f23('0x41')];if(!_0x5dfde0[_0x7f23('0x3c')][_0x7f23('0x42')](_0x7f23('0x43'))){_0x135c5b[_0x7f23('0x2f')]=qs[_0x7f23('0x2f')](_0x5dfde0[_0x7f23('0x3c')][_0x7f23('0x2f')]);_0x135c5b[_0x7f23('0x2e')]=qs[_0x7f23('0x2e')](_0x5dfde0[_0x7f23('0x3c')][_0x7f23('0x2e')]);}return _0x388628[_0x7f23('0x59')](_0x135c5b);}})[_0x7f23('0x1e')](function(_0x4ee1bc){if(_0x4ee1bc){return _0x4ee1bc?{'count':_0x4bdf92,'rows':_0x4ee1bc}:null;}})['then'](respondWithResult(_0x2c0224,null))[_0x7f23('0x28')](handleError(_0x2c0224,null));};exports['addConfiguration']=function(_0x1172d1,_0x4649b0,_0x7e78dd){if(_0x1172d1[_0x7f23('0x57')]['id']){delete _0x1172d1['body']['id'];}return db[_0x7f23('0x4d')]['findOne']({'where':{'id':_0x1172d1[_0x7f23('0x53')]['id']}})[_0x7f23('0x1e')](handleEntityNotFound(_0x4649b0,null))[_0x7f23('0x1e')](function(_0x1e3f2e){if(_0x1e3f2e){_0x1172d1[_0x7f23('0x57')][_0x7f23('0x5c')]=_0x1e3f2e['id'];_0x1172d1[_0x7f23('0x57')][_0x7f23('0x5d')]=integrations[_0x7f23('0x5e')](_0x1172d1[_0x7f23('0x57')][_0x7f23('0x5f')],_0x1172d1[_0x7f23('0x57')]['type']);_0x1172d1[_0x7f23('0x57')]['Descriptions']=integrations[_0x7f23('0x60')](_0x1172d1[_0x7f23('0x57')][_0x7f23('0x5f')],_0x1172d1['body']['type']);return db['FreshsalesConfiguration'][_0x7f23('0x56')](_0x1172d1[_0x7f23('0x57')],{'include':[{'model':db[_0x7f23('0x61')],'as':_0x7f23('0x5d')},{'model':db[_0x7f23('0x61')],'as':_0x7f23('0x62')}]});}return null;})['then'](respondWithResult(_0x4649b0,null))[_0x7f23('0x28')](handleError(_0x4649b0,null));};exports[_0x7f23('0x63')]=function(_0x57caa8,_0x2b7631,_0x3e2b8c){var _0xa36883='';var _0x11b6ed='';return db[_0x7f23('0x4d')]['findOne']({'where':{'id':_0x57caa8[_0x7f23('0x53')]['id']},'attributes':['id',_0x7f23('0x64'),'remoteUri','apiKey']})[_0x7f23('0x1e')](handleEntityNotFound(_0x2b7631,null))[_0x7f23('0x1e')](function(_0x51419e){if(_0x51419e){_0x11b6ed=_0x51419e[_0x7f23('0x64')];_0xa36883=_0x51419e[_0x7f23('0x65')];var _0xe34d80=_0x51419e['remoteUri'][_0x7f23('0x66')](-0x1);if(_0xe34d80==='/'){_0xa36883=_0xa36883[_0x7f23('0x67')](0x0,_0xa36883[_0x7f23('0x68')](_0xe34d80));}return rp({'method':_0x7f23('0x69'),'uri':util['format']('%s%s',_0xa36883,'/api/selector/owners'),'headers':{'Authorization':_0x7f23('0x6a')+_0x51419e[_0x7f23('0x6b')]},'json':!![]});}})[_0x7f23('0x1e')](function(_0x151fff){if(_0x151fff){var _0x4ae1a5=_0x151fff['users'];var _0xc9b689=![];var _0xc1252a=null;for(_0xc1252a=0x0;_0xc1252a<_0x4ae1a5[_0x7f23('0x41')];_0xc1252a++){if(_0x4ae1a5[_0xc1252a][_0x7f23('0x6c')]===_0x11b6ed){_0xc9b689=!![];}}if(_0xc9b689){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7f23('0x6d')});}}})[_0x7f23('0x1e')](respondWithResult(_0x2b7631,null))[_0x7f23('0x28')](function(_0x336d95){var _0x5950e5=_0x57caa8[_0x7f23('0x3c')]['test']?0x1f4:_0x336d95['statusCode']||0x1f4;logger[_0x7f23('0x25')](_0x7f23('0x6e'),'getFields',_0x5950e5,JSON['stringify'](_0x336d95));delete _0x336d95[_0x7f23('0x35')];if(_0x5950e5===0x191){_0x5950e5=0x190;}_0x2b7631[_0x7f23('0x2a')](_0x5950e5)['send'](_0x57caa8[_0x7f23('0x3c')][_0x7f23('0x1a')]?{'message':_0x7f23('0x6f'),'statusCode':_0x336d95['statusCode']}:_0x336d95);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ae426f9..cd15663 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 _0xc6ad=['define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6ad,0x157));var _0xdc6a=function(_0x51ca27,_0x21990b){_0x51ca27=_0x51ca27-0x0;var _0x35fd7d=_0xc6ad[_0x51ca27];return _0x35fd7d;};'use strict';var _=require(_0xdc6a('0x0'));var util=require('util');var logger=require(_0xdc6a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc6a('0x2'));var rimraf=require('rimraf');var config=require(_0xdc6a('0x3'));var attributes=require(_0xdc6a('0x4'));var integrations=require(_0xdc6a('0x5'));module[_0xdc6a('0x6')]=function(_0x37ca0d,_0xad37a7){return _0x37ca0d[_0xdc6a('0x7')](_0xdc6a('0x8'),attributes,{'tableName':_0xdc6a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28b0=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x457c96,_0x13785c){var _0x4e5ebc=function(_0x2fddc2){while(--_0x2fddc2){_0x457c96['push'](_0x457c96['shift']());}};_0x4e5ebc(++_0x13785c);}(_0x28b0,0x174));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x028b('0x0'));var logger=require(_0x028b('0x1'))(_0x028b('0x2'));var moment=require(_0x028b('0x3'));var BPromise=require(_0x028b('0x4'));var rp=require(_0x028b('0x5'));var fs=require('fs');var path=require(_0x028b('0x6'));var rimraf=require(_0x028b('0x7'));var config=require(_0x028b('0x8'));var attributes=require(_0x028b('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x028b('0xa')]=function(_0x5bbe03,_0xe6ffb9){return _0x5bbe03[_0x028b('0xb')](_0x028b('0xc'),attributes,{'tableName':_0x028b('0xd'),'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 2f6ac71..4ce04bd 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 _0x04d5=['where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','FreshsalesAccount','options','raw','include','map','model','attributes','GetFreshsalesAccount','find'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x04d5,0xe1));var _0x504d=function(_0x2c8f78,_0x53ab14){_0x2c8f78=_0x2c8f78-0x0;var _0x5ed48e=_0x04d5[_0x2c8f78];return _0x5ed48e;};'use strict';var _=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var moment=require('moment');var BPromise=require(_0x504d('0x2'));var rs=require(_0x504d('0x3'));var fs=require('fs');var Redis=require(_0x504d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x504d('0x5'));var logger=require(_0x504d('0x6'))(_0x504d('0x7'));var config=require(_0x504d('0x8'));var jayson=require(_0x504d('0x9'));var client=jayson['client'][_0x504d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x278262,_0x87bf04,_0x49cb76){return new BPromise(function(_0x5712a7,_0x16da4f){return client[_0x504d('0xb')](_0x278262,_0x49cb76)[_0x504d('0xc')](function(_0x48e0e6){logger[_0x504d('0xd')](_0x504d('0xe'),_0x87bf04,_0x504d('0xf'));logger[_0x504d('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x87bf04,_0x504d('0xf'),JSON[_0x504d('0x11')](_0x48e0e6));if(_0x48e0e6[_0x504d('0x12')]){if(_0x48e0e6[_0x504d('0x12')][_0x504d('0x13')]===0x1f4){logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x48e0e6['error']['message']);return _0x16da4f(_0x48e0e6[_0x504d('0x12')][_0x504d('0x14')]);}logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x48e0e6[_0x504d('0x12')][_0x504d('0x14')]);return _0x5712a7(_0x48e0e6['error'][_0x504d('0x14')]);}else{logger['info'](_0x504d('0xe'),_0x87bf04,_0x504d('0xf'));_0x5712a7(_0x48e0e6['result'][_0x504d('0x14')]);}})[_0x504d('0x15')](function(_0x1e3722){logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x1e3722);_0x16da4f(_0x1e3722);});});}exports['GetFreshsalesAccount']=function(_0x150cc7){var _0x4e11a0=this;return new Promise(function(_0x2bfc57,_0x4eec88){return db[_0x504d('0x16')]['findAll']({'raw':_0x150cc7[_0x504d('0x17')]?_0x150cc7[_0x504d('0x17')][_0x504d('0x18')]===undefined?!![]:![]:!![],'where':_0x150cc7[_0x504d('0x17')]?_0x150cc7[_0x504d('0x17')]['where']||null:null,'attributes':_0x150cc7['options']?_0x150cc7[_0x504d('0x17')]['attributes']||null:null,'limit':_0x150cc7[_0x504d('0x17')]?_0x150cc7[_0x504d('0x17')]['limit']||null:null,'include':_0x150cc7[_0x504d('0x17')]?_0x150cc7['options'][_0x504d('0x19')]?_[_0x504d('0x1a')](_0x150cc7[_0x504d('0x17')]['include'],function(_0x18fece){return{'model':db[_0x18fece['model']],'as':_0x18fece['as'],'attributes':_0x18fece['attributes'],'include':_0x18fece[_0x504d('0x19')]?_[_0x504d('0x1a')](_0x18fece['include'],function(_0x5bbef7){return{'model':db[_0x5bbef7[_0x504d('0x1b')]],'as':_0x5bbef7['as'],'attributes':_0x5bbef7[_0x504d('0x1c')],'include':_0x5bbef7['include']?_[_0x504d('0x1a')](_0x5bbef7[_0x504d('0x19')],function(_0xdce2f9){return{'model':db[_0xdce2f9[_0x504d('0x1b')]],'as':_0xdce2f9['as'],'attributes':_0xdce2f9[_0x504d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d4300){logger[_0x504d('0xd')](_0x504d('0x1d'),_0x150cc7);logger[_0x504d('0x10')]('GetFreshsalesAccount',_0x150cc7,JSON['stringify'](_0x3d4300));_0x2bfc57(_0x3d4300);})[_0x504d('0x15')](function(_0x544296){logger[_0x504d('0x12')]('GetFreshsalesAccount',_0x544296[_0x504d('0x14')],_0x150cc7);_0x4eec88(_0x4e11a0[_0x504d('0x12')](0x1f4,_0x544296[_0x504d('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x2e564c){var _0x4b0575=this;return new Promise(function(_0x506a22,_0x156472){return db[_0x504d('0x16')][_0x504d('0x1e')]({'raw':_0x2e564c['options']?_0x2e564c[_0x504d('0x17')][_0x504d('0x18')]===undefined?!![]:![]:!![],'where':_0x2e564c['options']?_0x2e564c['options'][_0x504d('0x1f')]||null:null,'attributes':_0x2e564c[_0x504d('0x17')]?_0x2e564c[_0x504d('0x17')]['attributes']||null:null,'include':_0x2e564c[_0x504d('0x17')]?_0x2e564c[_0x504d('0x17')][_0x504d('0x19')]?_[_0x504d('0x1a')](_0x2e564c[_0x504d('0x17')][_0x504d('0x19')],function(_0x6298bb){return{'model':db[_0x6298bb[_0x504d('0x1b')]],'as':_0x6298bb['as'],'attributes':_0x6298bb[_0x504d('0x1c')],'include':_0x6298bb['include']?_['map'](_0x6298bb[_0x504d('0x19')],function(_0x5f129b){return{'model':db[_0x5f129b[_0x504d('0x1b')]],'as':_0x5f129b['as'],'attributes':_0x5f129b[_0x504d('0x1c')],'include':_0x5f129b[_0x504d('0x19')]?_[_0x504d('0x1a')](_0x5f129b[_0x504d('0x19')],function(_0x45c80e){return{'model':db[_0x45c80e[_0x504d('0x1b')]],'as':_0x45c80e['as'],'attributes':_0x45c80e[_0x504d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x504d('0xc')](function(_0xfe6f06){logger[_0x504d('0xd')]('ShowFreshsalesAccount',_0x2e564c);logger[_0x504d('0x10')]('ShowFreshsalesAccount',_0x2e564c,JSON['stringify'](_0xfe6f06));_0x506a22(_0xfe6f06);})['catch'](function(_0x1310be){logger[_0x504d('0x12')]('ShowFreshsalesAccount',_0x1310be[_0x504d('0x14')],_0x2e564c);_0x156472(_0x4b0575['error'](0x1f4,_0x1310be[_0x504d('0x14')]));});});}; \ No newline at end of file +var _0x5454=['model','debug','catch','ShowFreshsalesAccount','find','raw','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes','map','include'];(function(_0x57aec1,_0x2b6744){var _0x4597ae=function(_0x505364){while(--_0x505364){_0x57aec1['push'](_0x57aec1['shift']());}};_0x4597ae(++_0x2b6744);}(_0x5454,0x15b));var _0x4545=function(_0x56d1aa,_0x1fdbf1){_0x56d1aa=_0x56d1aa-0x0;var _0x1defd3=_0x5454[_0x56d1aa];return _0x1defd3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4545('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4545('0x1'));var logger=require(_0x4545('0x2'))(_0x4545('0x3'));var config=require(_0x4545('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4545('0x5')][_0x4545('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6fd3bb,_0xc79c57,_0x3f1134){return new BPromise(function(_0x1fd7e5,_0x1c5649){return client[_0x4545('0x7')](_0x6fd3bb,_0x3f1134)[_0x4545('0x8')](function(_0x3e2526){logger[_0x4545('0x9')](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));logger['debug'](_0x4545('0xc'),_0xc79c57,_0x4545('0xb'),JSON[_0x4545('0xd')](_0x3e2526));if(_0x3e2526[_0x4545('0xe')]){if(_0x3e2526[_0x4545('0xe')][_0x4545('0xf')]===0x1f4){logger['error'](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1c5649(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1fd7e5(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}else{logger['info'](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));_0x1fd7e5(_0x3e2526[_0x4545('0x11')][_0x4545('0x10')]);}})['catch'](function(_0x4a5bdf){logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x4a5bdf);_0x1c5649(_0x4a5bdf);});});}exports[_0x4545('0x12')]=function(_0x2e13e0){var _0x207e38=this;return new Promise(function(_0x33393b,_0x3161c8){return db[_0x4545('0x13')]['findAll']({'raw':_0x2e13e0['options']?_0x2e13e0[_0x4545('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2e13e0[_0x4545('0x14')]?_0x2e13e0[_0x4545('0x14')][_0x4545('0x15')]||null:null,'attributes':_0x2e13e0[_0x4545('0x14')]?_0x2e13e0[_0x4545('0x14')][_0x4545('0x16')]||null:null,'limit':_0x2e13e0[_0x4545('0x14')]?_0x2e13e0[_0x4545('0x14')]['limit']||null:null,'include':_0x2e13e0['options']?_0x2e13e0[_0x4545('0x14')]['include']?_[_0x4545('0x17')](_0x2e13e0['options'][_0x4545('0x18')],function(_0x4c47c0){return{'model':db[_0x4c47c0['model']],'as':_0x4c47c0['as'],'attributes':_0x4c47c0[_0x4545('0x16')],'include':_0x4c47c0[_0x4545('0x18')]?_[_0x4545('0x17')](_0x4c47c0[_0x4545('0x18')],function(_0x344633){return{'model':db[_0x344633[_0x4545('0x19')]],'as':_0x344633['as'],'attributes':_0x344633[_0x4545('0x16')],'include':_0x344633[_0x4545('0x18')]?_[_0x4545('0x17')](_0x344633[_0x4545('0x18')],function(_0x3e5807){return{'model':db[_0x3e5807[_0x4545('0x19')]],'as':_0x3e5807['as'],'attributes':_0x3e5807[_0x4545('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4545('0x8')](function(_0x1d8c39){logger[_0x4545('0x9')]('GetFreshsalesAccount',_0x2e13e0);logger[_0x4545('0x1a')](_0x4545('0x12'),_0x2e13e0,JSON[_0x4545('0xd')](_0x1d8c39));_0x33393b(_0x1d8c39);})[_0x4545('0x1b')](function(_0xb9c5ee){logger['error'](_0x4545('0x12'),_0xb9c5ee[_0x4545('0x10')],_0x2e13e0);_0x3161c8(_0x207e38[_0x4545('0xe')](0x1f4,_0xb9c5ee[_0x4545('0x10')]));});});};exports[_0x4545('0x1c')]=function(_0x27b7d7){var _0x52dd8e=this;return new Promise(function(_0x406920,_0x80b55f){return db[_0x4545('0x13')][_0x4545('0x1d')]({'raw':_0x27b7d7[_0x4545('0x14')]?_0x27b7d7[_0x4545('0x14')][_0x4545('0x1e')]===undefined?!![]:![]:!![],'where':_0x27b7d7[_0x4545('0x14')]?_0x27b7d7[_0x4545('0x14')][_0x4545('0x15')]||null:null,'attributes':_0x27b7d7[_0x4545('0x14')]?_0x27b7d7['options'][_0x4545('0x16')]||null:null,'include':_0x27b7d7['options']?_0x27b7d7[_0x4545('0x14')][_0x4545('0x18')]?_['map'](_0x27b7d7[_0x4545('0x14')][_0x4545('0x18')],function(_0x46e814){return{'model':db[_0x46e814[_0x4545('0x19')]],'as':_0x46e814['as'],'attributes':_0x46e814[_0x4545('0x16')],'include':_0x46e814[_0x4545('0x18')]?_[_0x4545('0x17')](_0x46e814['include'],function(_0x1abc06){return{'model':db[_0x1abc06[_0x4545('0x19')]],'as':_0x1abc06['as'],'attributes':_0x1abc06[_0x4545('0x16')],'include':_0x1abc06[_0x4545('0x18')]?_[_0x4545('0x17')](_0x1abc06[_0x4545('0x18')],function(_0x5bc452){return{'model':db[_0x5bc452[_0x4545('0x19')]],'as':_0x5bc452['as'],'attributes':_0x5bc452[_0x4545('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4545('0x8')](function(_0x3cee1a){logger[_0x4545('0x9')](_0x4545('0x1c'),_0x27b7d7);logger[_0x4545('0x1a')](_0x4545('0x1c'),_0x27b7d7,JSON[_0x4545('0xd')](_0x3cee1a));_0x406920(_0x3cee1a);})['catch'](function(_0x47c85d){logger['error'](_0x4545('0x1c'),_0x47c85d['message'],_0x27b7d7);_0x80b55f(_0x52dd8e[_0x4545('0xe')](0x1f4,_0x47c85d[_0x4545('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 5d1b5f4..18a918b 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 _0xf37f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','path','express'];(function(_0x463337,_0x47a28c){var _0x4da453=function(_0x1d250c){while(--_0x1d250c){_0x463337['push'](_0x463337['shift']());}};_0x4da453(++_0x47a28c);}(_0xf37f,0x15a));var _0xff37=function(_0xe5acd3,_0xa15c46){_0xe5acd3=_0xe5acd3-0x0;var _0x47a60d=_0xf37f[_0xe5acd3];return _0x47a60d;};'use strict';var multer=require(_0xff37('0x0'));var util=require(_0xff37('0x1'));var path=require(_0xff37('0x2'));var timeout=require('connect-timeout');var express=require(_0xff37('0x3'));var router=express[_0xff37('0x4')]();var auth=require(_0xff37('0x5'));var interaction=require(_0xff37('0x6'));var config=require(_0xff37('0x7'));var controller=require(_0xff37('0x8'));router[_0xff37('0x9')]('/',auth[_0xff37('0xa')](),controller[_0xff37('0xb')]);router[_0xff37('0x9')](_0xff37('0xc'),auth['isAuthenticated'](),controller[_0xff37('0xd')]);router[_0xff37('0x9')]('/:id/subjects',auth[_0xff37('0xa')](),controller[_0xff37('0xe')]);router['get'](_0xff37('0xf'),auth[_0xff37('0xa')](),controller[_0xff37('0x10')]);router[_0xff37('0x9')](_0xff37('0x11'),auth['isAuthenticated'](),controller[_0xff37('0x12')]);router[_0xff37('0x13')]('/',auth['isAuthenticated'](),controller[_0xff37('0x14')]);router[_0xff37('0x15')](_0xff37('0xc'),auth[_0xff37('0xa')](),controller['update']);router[_0xff37('0x16')](_0xff37('0xc'),auth[_0xff37('0xa')](),controller[_0xff37('0x17')]);module[_0xff37('0x18')]=router; \ No newline at end of file +var _0x9fac=['../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','getFields','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x9fac,0xd6));var _0xc9fa=function(_0x1c451c,_0x4f8340){_0x1c451c=_0x1c451c-0x0;var _0x4f36ef=_0x9fac[_0x1c451c];return _0x4f36ef;};'use strict';var multer=require(_0xc9fa('0x0'));var util=require(_0xc9fa('0x1'));var path=require(_0xc9fa('0x2'));var timeout=require(_0xc9fa('0x3'));var express=require(_0xc9fa('0x4'));var router=express[_0xc9fa('0x5')]();var auth=require(_0xc9fa('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc9fa('0x7'));router[_0xc9fa('0x8')]('/',auth[_0xc9fa('0x9')](),controller[_0xc9fa('0xa')]);router[_0xc9fa('0x8')](_0xc9fa('0xb'),auth[_0xc9fa('0x9')](),controller['show']);router[_0xc9fa('0x8')](_0xc9fa('0xc'),auth[_0xc9fa('0x9')](),controller[_0xc9fa('0xd')]);router[_0xc9fa('0x8')]('/:id/descriptions',auth[_0xc9fa('0x9')](),controller['getDescriptions']);router[_0xc9fa('0x8')]('/:id/fields',auth[_0xc9fa('0x9')](),controller[_0xc9fa('0xe')]);router[_0xc9fa('0xf')]('/',auth[_0xc9fa('0x9')](),controller[_0xc9fa('0x10')]);router[_0xc9fa('0x11')](_0xc9fa('0xb'),auth[_0xc9fa('0x9')](),controller['update']);router[_0xc9fa('0x12')](_0xc9fa('0xb'),auth[_0xc9fa('0x9')](),controller['destroy']);module[_0xc9fa('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4ef736d..cb65542 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 _0x1734=['sequelize'];(function(_0x5e2d28,_0x5e49b5){var _0x2fb7b2=function(_0x5c9f98){while(--_0x5c9f98){_0x5e2d28['push'](_0x5e2d28['shift']());}};_0x2fb7b2(++_0x5e49b5);}(_0x1734,0x145));var _0x4173=function(_0x44f469,_0x24d99a){_0x44f469=_0x44f469-0x0;var _0x2f765a=_0x1734[_0x44f469];return _0x2f765a;};'use strict';var Sequelize=require(_0x4173('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc410=['STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc410,0x1ce));var _0x0c41=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0xc410[_0x2e68db];return _0x12df4c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c41('0x0')]},'description':{'type':Sequelize[_0x0c41('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 4a200b8..f9c29e0 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 _0x62bc=['nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','params','find','create','body','getSubjects','FreshsalesField','getDescriptions','getFields','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','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~!@#$%^&-_=+[{]}.','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4d399b,_0x3bd4a4){var _0x4435e5=function(_0x587f0a){while(--_0x587f0a){_0x4d399b['push'](_0x4d399b['shift']());}};_0x4435e5(++_0x3bd4a4);}(_0x62bc,0x126));var _0xc62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc62b('0x0'));var emlformat=require(_0xc62b('0x1'));var rimraf=require(_0xc62b('0x2'));var zipdir=require(_0xc62b('0x3'));var jsonpatch=require(_0xc62b('0x4'));var rp=require(_0xc62b('0x5'));var moment=require(_0xc62b('0x6'));var BPromise=require(_0xc62b('0x7'));var Mustache=require(_0xc62b('0x8'));var util=require('util');var path=require(_0xc62b('0x9'));var sox=require(_0xc62b('0xa'));var csv=require(_0xc62b('0xb'));var ejs=require(_0xc62b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc62b('0xd'));var crypto=require(_0xc62b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc62b('0xb'));var querystring=require(_0xc62b('0xf'));var Papa=require(_0xc62b('0x10'));var Redis=require('ioredis');var authService=require(_0xc62b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc62b('0x12'));var hardwareService=require(_0xc62b('0x13'));var logger=require(_0xc62b('0x14'))(_0xc62b('0x15'));var utils=require(_0xc62b('0x16'));var config=require(_0xc62b('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc62b('0x18'));var client=jayson[_0xc62b('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x52c74d,_0x4d9e42,_0x2e5702){if(_0x2e5702){var _0x4198e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4198e9['test'](_0x4d9e42)){return _0x52c74d;}else{throw new db[(_0xc62b('0x1a'))][(_0xc62b('0x1b'))](_0xc62b('0x1c'));}}else{return _0x52c74d;}}function respondWithRpcPromise(_0x2d833a,_0x457640,_0x291a96,_0x22d767){return new BPromise(function(_0x10afba,_0x1b316c){var _0x514c1c=_0x22d767||client;return _0x514c1c['request'](_0x2d833a,_0x291a96)[_0xc62b('0x1d')](function(_0x4cb0bf){logger['info'](_0xc62b('0x1e'),_0x457640,_0xc62b('0x1f'));logger[_0xc62b('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x457640,_0xc62b('0x1f'),JSON[_0xc62b('0x21')](_0x4cb0bf));if(_0x4cb0bf[_0xc62b('0x22')]){if(_0x4cb0bf[_0xc62b('0x22')][_0xc62b('0x23')]===0x1f4){logger[_0xc62b('0x22')](_0xc62b('0x1e'),_0x457640,_0x4cb0bf[_0xc62b('0x22')][_0xc62b('0x24')]);return _0x1b316c(_0x4cb0bf[_0xc62b('0x22')][_0xc62b('0x24')]);}logger[_0xc62b('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x457640,_0x4cb0bf[_0xc62b('0x22')][_0xc62b('0x24')]);return _0x10afba(_0x4cb0bf[_0xc62b('0x22')][_0xc62b('0x24')]);}else{logger['info'](_0xc62b('0x1e'),_0x457640,_0xc62b('0x1f'));_0x10afba(_0x4cb0bf[_0xc62b('0x25')]['message']);}})[_0xc62b('0x26')](function(_0x50b073){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x457640,_0x50b073);_0x1b316c(_0x50b073);});});}function respondWithStatusCode(_0x325678,_0x1ecd02){_0x1ecd02=_0x1ecd02||0xcc;return function(_0x8b474){if(_0x8b474){return _0x325678[_0xc62b('0x27')](_0x1ecd02);}return _0x325678[_0xc62b('0x28')](_0x1ecd02)['end']();};}function respondWithResult(_0x2a75d1,_0x15d2fe){_0x15d2fe=_0x15d2fe||0xc8;return function(_0x392f19){if(_0x392f19){return _0x2a75d1[_0xc62b('0x28')](_0x15d2fe)['json'](_0x392f19);}};}function respondWithFilteredResult(_0x4c9951,_0x4f662d){return function(_0x5a3e40){if(_0x5a3e40){var _0x3ce97d=_0x5a3e40[_0xc62b('0x29')],_0x529405=_0x4f662d[_0xc62b('0x2a')],_0x33a28e=_0x4f662d[_0xc62b('0x2a')]+_0x4f662d[_0xc62b('0x2b')],_0x2449f6;if(_0x33a28e>=_0x3ce97d){_0x33a28e=_0x3ce97d;_0x2449f6=0xc8;}else{_0x2449f6=0xce;}_0x4c9951[_0xc62b('0x28')](_0x2449f6);return _0x4c9951['set'](_0xc62b('0x2c'),_0x529405+'-'+_0x33a28e+'/'+_0x3ce97d)[_0xc62b('0x2d')](_0x5a3e40);}return null;};}function patchUpdates(_0x42e33e){return function(_0x184bf5){try{jsonpatch[_0xc62b('0x2e')](_0x184bf5,_0x42e33e,!![]);}catch(_0x4d2d5d){return BPromise[_0xc62b('0x2f')](_0x4d2d5d);}return _0x184bf5[_0xc62b('0x30')]();};}function saveUpdates(_0x595999,_0x97faf1){return function(_0x3f059c){if(_0x3f059c){return _0x3f059c[_0xc62b('0x31')](_0x595999)['then'](function(_0x476b78){return _0x476b78;});}return null;};}function removeEntity(_0x2191a3,_0x124cb4){return function(_0x2965a4){if(_0x2965a4){return _0x2965a4[_0xc62b('0x32')]()[_0xc62b('0x1d')](function(){_0x2191a3[_0xc62b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1943f2,_0x3e5356){return function(_0x4b3d05){if(!_0x4b3d05){_0x1943f2['sendStatus'](0x194);}return _0x4b3d05;};}function handleError(_0x3cbe0f,_0x4c6143){_0x4c6143=_0x4c6143||0x1f4;return function(_0x2015a4){logger[_0xc62b('0x22')](_0x2015a4[_0xc62b('0x33')]);if(_0x2015a4[_0xc62b('0x34')]){delete _0x2015a4['name'];}_0x3cbe0f[_0xc62b('0x28')](_0x4c6143)[_0xc62b('0x35')](_0x2015a4);};}exports['index']=function(_0x534a1d,_0x10cab5){var _0x1c36f1={},_0x264cba={},_0x4cfcac={'count':0x0,'rows':[]};var _0x30acf6=_['map'](db['FreshsalesConfiguration'][_0xc62b('0x36')],function(_0x59c197){return{'name':_0x59c197[_0xc62b('0x37')],'type':_0x59c197[_0xc62b('0x38')][_0xc62b('0x39')]};});_0x264cba[_0xc62b('0x3a')]=_['map'](_0x30acf6,'name');_0x264cba['query']=_[_0xc62b('0x3b')](_0x534a1d[_0xc62b('0x3c')]);_0x264cba['filters']=_[_0xc62b('0x3d')](_0x264cba['model'],_0x264cba[_0xc62b('0x3c')]);_0x1c36f1[_0xc62b('0x3e')]=_['intersection'](_0x264cba[_0xc62b('0x3a')],qs[_0xc62b('0x3f')](_0x534a1d[_0xc62b('0x3c')][_0xc62b('0x3f')]));_0x1c36f1['attributes']=_0x1c36f1['attributes'][_0xc62b('0x40')]?_0x1c36f1[_0xc62b('0x3e')]:_0x264cba['model'];if(!_0x534a1d['query'][_0xc62b('0x41')](_0xc62b('0x42'))){_0x1c36f1[_0xc62b('0x2b')]=qs['limit'](_0x534a1d[_0xc62b('0x3c')][_0xc62b('0x2b')]);_0x1c36f1[_0xc62b('0x2a')]=qs[_0xc62b('0x2a')](_0x534a1d[_0xc62b('0x3c')]['offset']);}_0x1c36f1[_0xc62b('0x43')]=qs[_0xc62b('0x44')](_0x534a1d[_0xc62b('0x3c')][_0xc62b('0x44')]);_0x1c36f1[_0xc62b('0x45')]=qs[_0xc62b('0x46')](_[_0xc62b('0x47')](_0x534a1d[_0xc62b('0x3c')],_0x264cba[_0xc62b('0x46')]),_0x30acf6);if(_0x534a1d[_0xc62b('0x3c')][_0xc62b('0x48')]){_0x1c36f1[_0xc62b('0x45')]=_[_0xc62b('0x49')](_0x1c36f1[_0xc62b('0x45')],{'$or':_[_0xc62b('0x4a')](_0x30acf6,function(_0x172d09){if(_0x172d09[_0xc62b('0x38')]!==_0xc62b('0x4b')){var _0x20d40d={};_0x20d40d[_0x172d09['name']]={'$like':'%'+_0x534a1d[_0xc62b('0x3c')][_0xc62b('0x48')]+'%'};return _0x20d40d;}})});}_0x1c36f1=_['merge']({},_0x1c36f1,_0x534a1d[_0xc62b('0x4c')]);var _0x7e69c3={'where':_0x1c36f1[_0xc62b('0x45')]};return db[_0xc62b('0x4d')][_0xc62b('0x29')](_0x7e69c3)[_0xc62b('0x1d')](function(_0x44cb26){_0x4cfcac['count']=_0x44cb26;if(_0x534a1d[_0xc62b('0x3c')][_0xc62b('0x4e')]){_0x1c36f1[_0xc62b('0x4f')]=[{'all':!![]}];}return db[_0xc62b('0x4d')][_0xc62b('0x50')](_0x1c36f1);})['then'](function(_0x5e037b){_0x4cfcac['rows']=_0x5e037b;return _0x4cfcac;})[_0xc62b('0x1d')](respondWithFilteredResult(_0x10cab5,_0x1c36f1))[_0xc62b('0x26')](handleError(_0x10cab5,null));};exports['show']=function(_0x1c02e5,_0x1e2830){var _0x568bcb={'raw':![],'where':{'id':_0x1c02e5[_0xc62b('0x51')]['id']}},_0x718314={};_0x718314[_0xc62b('0x3a')]=_['keys'](db[_0xc62b('0x4d')][_0xc62b('0x36')]);_0x718314[_0xc62b('0x3c')]=_[_0xc62b('0x3b')](_0x1c02e5[_0xc62b('0x3c')]);_0x718314[_0xc62b('0x46')]=_['intersection'](_0x718314[_0xc62b('0x3a')],_0x718314['query']);_0x568bcb[_0xc62b('0x3e')]=_[_0xc62b('0x3d')](_0x718314[_0xc62b('0x3a')],qs[_0xc62b('0x3f')](_0x1c02e5['query'][_0xc62b('0x3f')]));_0x568bcb['attributes']=_0x568bcb[_0xc62b('0x3e')][_0xc62b('0x40')]?_0x568bcb[_0xc62b('0x3e')]:_0x718314[_0xc62b('0x3a')];if(_0x1c02e5['query'][_0xc62b('0x4e')]){_0x568bcb[_0xc62b('0x4f')]=[{'all':!![]}];}_0x568bcb=_['merge']({},_0x568bcb,_0x1c02e5[_0xc62b('0x4c')]);return db[_0xc62b('0x4d')][_0xc62b('0x52')](_0x568bcb)[_0xc62b('0x1d')](handleEntityNotFound(_0x1e2830,null))[_0xc62b('0x1d')](respondWithResult(_0x1e2830,null))['catch'](handleError(_0x1e2830,null));};exports[_0xc62b('0x53')]=function(_0x346bde,_0x7a6aa7){return db[_0xc62b('0x4d')][_0xc62b('0x53')](_0x346bde[_0xc62b('0x54')],{})[_0xc62b('0x1d')](respondWithResult(_0x7a6aa7,0xc9))[_0xc62b('0x26')](handleError(_0x7a6aa7,null));};exports[_0xc62b('0x31')]=function(_0x20c4da,_0x16e4ff){if(_0x20c4da[_0xc62b('0x54')]['id']){delete _0x20c4da['body']['id'];}return db['FreshsalesConfiguration'][_0xc62b('0x52')]({'where':{'id':_0x20c4da[_0xc62b('0x51')]['id']}})[_0xc62b('0x1d')](handleEntityNotFound(_0x16e4ff,null))['then'](saveUpdates(_0x20c4da[_0xc62b('0x54')],null))[_0xc62b('0x1d')](respondWithResult(_0x16e4ff,null))[_0xc62b('0x26')](handleError(_0x16e4ff,null));};exports[_0xc62b('0x32')]=function(_0x599b52,_0x3b36f7){return db[_0xc62b('0x4d')][_0xc62b('0x52')]({'where':{'id':_0x599b52['params']['id']}})[_0xc62b('0x1d')](handleEntityNotFound(_0x3b36f7,null))[_0xc62b('0x1d')](removeEntity(_0x3b36f7,null))[_0xc62b('0x26')](handleError(_0x3b36f7,null));};exports[_0xc62b('0x55')]=function(_0x3e663d,_0x12f007,_0x3ab917){var _0x542597={};var _0x4530f6={};var _0x1a1349;var _0x57503f;return db[_0xc62b('0x4d')]['findOne']({'where':{'id':_0x3e663d[_0xc62b('0x51')]['id']}})['then'](handleEntityNotFound(_0x12f007,null))[_0xc62b('0x1d')](function(_0x5345e4){if(_0x5345e4){_0x1a1349=_0x5345e4;_0x4530f6[_0xc62b('0x3a')]=_[_0xc62b('0x3b')](db[_0xc62b('0x56')][_0xc62b('0x36')]);_0x4530f6[_0xc62b('0x3c')]=_['keys'](_0x3e663d['query']);_0x4530f6['filters']=_[_0xc62b('0x3d')](_0x4530f6['model'],_0x4530f6[_0xc62b('0x3c')]);_0x542597[_0xc62b('0x3e')]=_['intersection'](_0x4530f6[_0xc62b('0x3a')],qs[_0xc62b('0x3f')](_0x3e663d[_0xc62b('0x3c')][_0xc62b('0x3f')]));_0x542597[_0xc62b('0x3e')]=_0x542597[_0xc62b('0x3e')]['length']?_0x542597[_0xc62b('0x3e')]:_0x4530f6['model'];_0x542597[_0xc62b('0x43')]=qs[_0xc62b('0x44')](_0x3e663d[_0xc62b('0x3c')][_0xc62b('0x44')]);_0x542597['where']=qs[_0xc62b('0x46')](_[_0xc62b('0x47')](_0x3e663d[_0xc62b('0x3c')],_0x4530f6['filters']));if(_0x3e663d[_0xc62b('0x3c')][_0xc62b('0x48')]){_0x542597[_0xc62b('0x45')]=_[_0xc62b('0x49')](_0x542597[_0xc62b('0x45')],{'$or':_[_0xc62b('0x4a')](_0x542597['attributes'],function(_0x10fbf2){var _0x1f9647={};_0x1f9647[_0x10fbf2]={'$like':'%'+_0x3e663d[_0xc62b('0x3c')][_0xc62b('0x48')]+'%'};return _0x1f9647;})});}_0x542597=_[_0xc62b('0x49')]({},_0x542597,_0x3e663d[_0xc62b('0x4c')]);return _0x1a1349['getSubjects'](_0x542597);}})['then'](function(_0x25626f){if(_0x25626f){_0x57503f=_0x25626f[_0xc62b('0x40')];if(!_0x3e663d[_0xc62b('0x3c')][_0xc62b('0x41')](_0xc62b('0x42'))){_0x542597[_0xc62b('0x2b')]=qs[_0xc62b('0x2b')](_0x3e663d[_0xc62b('0x3c')]['limit']);_0x542597[_0xc62b('0x2a')]=qs[_0xc62b('0x2a')](_0x3e663d[_0xc62b('0x3c')][_0xc62b('0x2a')]);}return _0x1a1349[_0xc62b('0x55')](_0x542597);}})[_0xc62b('0x1d')](function(_0x192bae){if(_0x192bae){return _0x192bae?{'count':_0x57503f,'rows':_0x192bae}:null;}})[_0xc62b('0x1d')](respondWithResult(_0x12f007,null))['catch'](handleError(_0x12f007,null));};exports[_0xc62b('0x57')]=function(_0x608c65,_0x2f1674,_0x1c10f4){var _0x1480af={};var _0x4414ed={};var _0x1b96eb;var _0x1a0d54;return db[_0xc62b('0x4d')]['findOne']({'where':{'id':_0x608c65[_0xc62b('0x51')]['id']}})[_0xc62b('0x1d')](handleEntityNotFound(_0x2f1674,null))[_0xc62b('0x1d')](function(_0x160205){if(_0x160205){_0x1b96eb=_0x160205;_0x4414ed[_0xc62b('0x3a')]=_['keys'](db['FreshsalesField'][_0xc62b('0x36')]);_0x4414ed[_0xc62b('0x3c')]=_['keys'](_0x608c65['query']);_0x4414ed[_0xc62b('0x46')]=_[_0xc62b('0x3d')](_0x4414ed[_0xc62b('0x3a')],_0x4414ed[_0xc62b('0x3c')]);_0x1480af['attributes']=_[_0xc62b('0x3d')](_0x4414ed[_0xc62b('0x3a')],qs['fields'](_0x608c65[_0xc62b('0x3c')]['fields']));_0x1480af['attributes']=_0x1480af[_0xc62b('0x3e')][_0xc62b('0x40')]?_0x1480af['attributes']:_0x4414ed[_0xc62b('0x3a')];_0x1480af[_0xc62b('0x43')]=qs[_0xc62b('0x44')](_0x608c65[_0xc62b('0x3c')][_0xc62b('0x44')]);_0x1480af['where']=qs[_0xc62b('0x46')](_['pick'](_0x608c65[_0xc62b('0x3c')],_0x4414ed['filters']));if(_0x608c65[_0xc62b('0x3c')][_0xc62b('0x48')]){_0x1480af[_0xc62b('0x45')]=_[_0xc62b('0x49')](_0x1480af[_0xc62b('0x45')],{'$or':_[_0xc62b('0x4a')](_0x1480af[_0xc62b('0x3e')],function(_0x2c8c7b){var _0x1255ea={};_0x1255ea[_0x2c8c7b]={'$like':'%'+_0x608c65[_0xc62b('0x3c')][_0xc62b('0x48')]+'%'};return _0x1255ea;})});}_0x1480af=_['merge']({},_0x1480af,_0x608c65[_0xc62b('0x4c')]);return _0x1b96eb[_0xc62b('0x57')](_0x1480af);}})[_0xc62b('0x1d')](function(_0x5dffb9){if(_0x5dffb9){_0x1a0d54=_0x5dffb9['length'];if(!_0x608c65[_0xc62b('0x3c')][_0xc62b('0x41')](_0xc62b('0x42'))){_0x1480af['limit']=qs[_0xc62b('0x2b')](_0x608c65[_0xc62b('0x3c')]['limit']);_0x1480af[_0xc62b('0x2a')]=qs[_0xc62b('0x2a')](_0x608c65['query'][_0xc62b('0x2a')]);}return _0x1b96eb[_0xc62b('0x57')](_0x1480af);}})[_0xc62b('0x1d')](function(_0x4b4e2a){if(_0x4b4e2a){return _0x4b4e2a?{'count':_0x1a0d54,'rows':_0x4b4e2a}:null;}})[_0xc62b('0x1d')](respondWithResult(_0x2f1674,null))[_0xc62b('0x26')](handleError(_0x2f1674,null));};exports[_0xc62b('0x58')]=function(_0x1afc21,_0x59f157,_0xe9c97){var _0x291f75={};var _0x187617={};var _0x4d8e37;var _0x202a9a;return db[_0xc62b('0x4d')][_0xc62b('0x59')]({'where':{'id':_0x1afc21[_0xc62b('0x51')]['id']}})[_0xc62b('0x1d')](handleEntityNotFound(_0x59f157,null))['then'](function(_0x1c5c9a){if(_0x1c5c9a){_0x4d8e37=_0x1c5c9a;_0x187617[_0xc62b('0x3a')]=_['keys'](db[_0xc62b('0x56')]['rawAttributes']);_0x187617['query']=_[_0xc62b('0x3b')](_0x1afc21[_0xc62b('0x3c')]);_0x187617[_0xc62b('0x46')]=_[_0xc62b('0x3d')](_0x187617[_0xc62b('0x3a')],_0x187617[_0xc62b('0x3c')]);_0x291f75['attributes']=_[_0xc62b('0x3d')](_0x187617['model'],qs[_0xc62b('0x3f')](_0x1afc21[_0xc62b('0x3c')][_0xc62b('0x3f')]));_0x291f75['attributes']=_0x291f75['attributes'][_0xc62b('0x40')]?_0x291f75['attributes']:_0x187617['model'];_0x291f75[_0xc62b('0x43')]=qs[_0xc62b('0x44')](_0x1afc21[_0xc62b('0x3c')][_0xc62b('0x44')]);_0x291f75[_0xc62b('0x45')]=qs[_0xc62b('0x46')](_['pick'](_0x1afc21[_0xc62b('0x3c')],_0x187617[_0xc62b('0x46')]));if(_0x1afc21[_0xc62b('0x3c')][_0xc62b('0x48')]){_0x291f75[_0xc62b('0x45')]=_[_0xc62b('0x49')](_0x291f75[_0xc62b('0x45')],{'$or':_[_0xc62b('0x4a')](_0x291f75['attributes'],function(_0x265327){var _0x56a595={};_0x56a595[_0x265327]={'$like':'%'+_0x1afc21[_0xc62b('0x3c')][_0xc62b('0x48')]+'%'};return _0x56a595;})});}_0x291f75=_[_0xc62b('0x49')]({},_0x291f75,_0x1afc21[_0xc62b('0x4c')]);return _0x4d8e37[_0xc62b('0x58')](_0x291f75);}})[_0xc62b('0x1d')](function(_0x330ca8){if(_0x330ca8){_0x202a9a=_0x330ca8['length'];if(!_0x1afc21[_0xc62b('0x3c')][_0xc62b('0x41')](_0xc62b('0x42'))){_0x291f75[_0xc62b('0x2b')]=qs[_0xc62b('0x2b')](_0x1afc21[_0xc62b('0x3c')][_0xc62b('0x2b')]);_0x291f75[_0xc62b('0x2a')]=qs[_0xc62b('0x2a')](_0x1afc21[_0xc62b('0x3c')][_0xc62b('0x2a')]);}return _0x4d8e37[_0xc62b('0x58')](_0x291f75);}})['then'](function(_0xabdbfe){if(_0xabdbfe){return _0xabdbfe?{'count':_0x202a9a,'rows':_0xabdbfe}:null;}})[_0xc62b('0x1d')](respondWithResult(_0x59f157,null))[_0xc62b('0x26')](handleError(_0x59f157,null));}; \ No newline at end of file +var _0xcec8=['reject','save','update','destroy','then','end','stack','name','send','map','FreshsalesConfiguration','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','VIRTUAL','merge','count','includeAll','include','findAll','catch','show','rawAttributes','length','options','find','create','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','client','http','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~!@#$%^&-_=+[{]}.','info','request\x20sent','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','set','apply'];(function(_0x2920d1,_0x5095b5){var _0x4a733b=function(_0x1bb28b){while(--_0x1bb28b){_0x2920d1['push'](_0x2920d1['shift']());}};_0x4a733b(++_0x5095b5);}(_0xcec8,0x183));var _0x8cec=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xcec8[_0x59c301];return _0x3866b9;};'use strict';var pdf=require(_0x8cec('0x0'));var emlformat=require(_0x8cec('0x1'));var rimraf=require(_0x8cec('0x2'));var zipdir=require(_0x8cec('0x3'));var jsonpatch=require(_0x8cec('0x4'));var rp=require('request-promise');var moment=require(_0x8cec('0x5'));var BPromise=require(_0x8cec('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8cec('0x7'));var sox=require(_0x8cec('0x8'));var csv=require(_0x8cec('0x9'));var ejs=require(_0x8cec('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8cec('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cec('0x9'));var querystring=require(_0x8cec('0xc'));var Papa=require(_0x8cec('0xd'));var Redis=require(_0x8cec('0xe'));var authService=require(_0x8cec('0xf'));var qs=require(_0x8cec('0x10'));var as=require(_0x8cec('0x11'));var hardwareService=require(_0x8cec('0x12'));var logger=require(_0x8cec('0x13'))('api');var utils=require(_0x8cec('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x8cec('0x15')][_0x8cec('0x16')]({'port':0x232a});function checkPasswordPattern(_0x265de7,_0x139336,_0x941cc1){if(_0x941cc1){var _0x2bd8de=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2bd8de['test'](_0x139336)){return _0x265de7;}else{throw new db[(_0x8cec('0x17'))][(_0x8cec('0x18'))](_0x8cec('0x19'));}}else{return _0x265de7;}}function respondWithRpcPromise(_0x50ed51,_0x14b554,_0x5065d5,_0x4d1a58){return new BPromise(function(_0x5a53fd,_0x85ac40){var _0x6ad5a5=_0x4d1a58||client;return _0x6ad5a5['request'](_0x50ed51,_0x5065d5)['then'](function(_0x6342e){logger[_0x8cec('0x1a')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x14b554,_0x8cec('0x1b'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x14b554,_0x8cec('0x1b'),JSON['stringify'](_0x6342e));if(_0x6342e['error']){if(_0x6342e[_0x8cec('0x1c')]['code']===0x1f4){logger[_0x8cec('0x1c')](_0x8cec('0x1d'),_0x14b554,_0x6342e[_0x8cec('0x1c')][_0x8cec('0x1e')]);return _0x85ac40(_0x6342e['error']['message']);}logger[_0x8cec('0x1c')](_0x8cec('0x1d'),_0x14b554,_0x6342e['error'][_0x8cec('0x1e')]);return _0x5a53fd(_0x6342e[_0x8cec('0x1c')][_0x8cec('0x1e')]);}else{logger[_0x8cec('0x1a')](_0x8cec('0x1d'),_0x14b554,_0x8cec('0x1b'));_0x5a53fd(_0x6342e[_0x8cec('0x1f')][_0x8cec('0x1e')]);}})['catch'](function(_0xc0fb0){logger[_0x8cec('0x1c')](_0x8cec('0x1d'),_0x14b554,_0xc0fb0);_0x85ac40(_0xc0fb0);});});}function respondWithStatusCode(_0x20e9a7,_0x18eb5d){_0x18eb5d=_0x18eb5d||0xcc;return function(_0x4463c6){if(_0x4463c6){return _0x20e9a7[_0x8cec('0x20')](_0x18eb5d);}return _0x20e9a7[_0x8cec('0x21')](_0x18eb5d)['end']();};}function respondWithResult(_0x1cdad8,_0x4112a2){_0x4112a2=_0x4112a2||0xc8;return function(_0x4501e5){if(_0x4501e5){return _0x1cdad8['status'](_0x4112a2)[_0x8cec('0x22')](_0x4501e5);}};}function respondWithFilteredResult(_0xb528cd,_0x4a5cd2){return function(_0x5aaf92){if(_0x5aaf92){var _0x416f19=_0x5aaf92['count'],_0x406c66=_0x4a5cd2[_0x8cec('0x23')],_0x5751c4=_0x4a5cd2[_0x8cec('0x23')]+_0x4a5cd2['limit'],_0x1a1cdc;if(_0x5751c4>=_0x416f19){_0x5751c4=_0x416f19;_0x1a1cdc=0xc8;}else{_0x1a1cdc=0xce;}_0xb528cd[_0x8cec('0x21')](_0x1a1cdc);return _0xb528cd[_0x8cec('0x24')]('Content-Range',_0x406c66+'-'+_0x5751c4+'/'+_0x416f19)[_0x8cec('0x22')](_0x5aaf92);}return null;};}function patchUpdates(_0x2ad5f3){return function(_0x346302){try{jsonpatch[_0x8cec('0x25')](_0x346302,_0x2ad5f3,!![]);}catch(_0x3680ae){return BPromise[_0x8cec('0x26')](_0x3680ae);}return _0x346302[_0x8cec('0x27')]();};}function saveUpdates(_0x45a837,_0x507cc5){return function(_0x179e62){if(_0x179e62){return _0x179e62[_0x8cec('0x28')](_0x45a837)['then'](function(_0x2a1a74){return _0x2a1a74;});}return null;};}function removeEntity(_0x19a2e2,_0x16b22f){return function(_0x52ebee){if(_0x52ebee){return _0x52ebee[_0x8cec('0x29')]()[_0x8cec('0x2a')](function(){_0x19a2e2[_0x8cec('0x21')](0xcc)[_0x8cec('0x2b')]();});}};}function handleEntityNotFound(_0xd212f2,_0x17e125){return function(_0x2d431d){if(!_0x2d431d){_0xd212f2['sendStatus'](0x194);}return _0x2d431d;};}function handleError(_0xd408ab,_0x3cfc1e){_0x3cfc1e=_0x3cfc1e||0x1f4;return function(_0x1938b3){logger[_0x8cec('0x1c')](_0x1938b3[_0x8cec('0x2c')]);if(_0x1938b3['name']){delete _0x1938b3[_0x8cec('0x2d')];}_0xd408ab['status'](_0x3cfc1e)[_0x8cec('0x2e')](_0x1938b3);};}exports['index']=function(_0x58acf1,_0x19e088){var _0x395ca9={},_0x21a57c={},_0x4f0b41={'count':0x0,'rows':[]};var _0x5ed2c6=_[_0x8cec('0x2f')](db[_0x8cec('0x30')]['rawAttributes'],function(_0x3ef5a2){return{'name':_0x3ef5a2['fieldName'],'type':_0x3ef5a2[_0x8cec('0x31')]['key']};});_0x21a57c['model']=_['map'](_0x5ed2c6,_0x8cec('0x2d'));_0x21a57c[_0x8cec('0x32')]=_[_0x8cec('0x33')](_0x58acf1[_0x8cec('0x32')]);_0x21a57c[_0x8cec('0x34')]=_['intersection'](_0x21a57c[_0x8cec('0x35')],_0x21a57c[_0x8cec('0x32')]);_0x395ca9[_0x8cec('0x36')]=_[_0x8cec('0x37')](_0x21a57c['model'],qs[_0x8cec('0x38')](_0x58acf1[_0x8cec('0x32')][_0x8cec('0x38')]));_0x395ca9[_0x8cec('0x36')]=_0x395ca9[_0x8cec('0x36')]['length']?_0x395ca9['attributes']:_0x21a57c['model'];if(!_0x58acf1[_0x8cec('0x32')][_0x8cec('0x39')](_0x8cec('0x3a'))){_0x395ca9[_0x8cec('0x3b')]=qs[_0x8cec('0x3b')](_0x58acf1['query'][_0x8cec('0x3b')]);_0x395ca9[_0x8cec('0x23')]=qs['offset'](_0x58acf1['query']['offset']);}_0x395ca9[_0x8cec('0x3c')]=qs[_0x8cec('0x3d')](_0x58acf1['query']['sort']);_0x395ca9['where']=qs[_0x8cec('0x34')](_['pick'](_0x58acf1[_0x8cec('0x32')],_0x21a57c[_0x8cec('0x34')]),_0x5ed2c6);if(_0x58acf1[_0x8cec('0x32')][_0x8cec('0x3e')]){_0x395ca9['where']=_['merge'](_0x395ca9[_0x8cec('0x3f')],{'$or':_['map'](_0x5ed2c6,function(_0x6a343e){if(_0x6a343e[_0x8cec('0x31')]!==_0x8cec('0x40')){var _0xdff9cd={};_0xdff9cd[_0x6a343e[_0x8cec('0x2d')]]={'$like':'%'+_0x58acf1['query'][_0x8cec('0x3e')]+'%'};return _0xdff9cd;}})});}_0x395ca9=_[_0x8cec('0x41')]({},_0x395ca9,_0x58acf1['options']);var _0x29a62e={'where':_0x395ca9[_0x8cec('0x3f')]};return db[_0x8cec('0x30')][_0x8cec('0x42')](_0x29a62e)[_0x8cec('0x2a')](function(_0x21f697){_0x4f0b41[_0x8cec('0x42')]=_0x21f697;if(_0x58acf1[_0x8cec('0x32')][_0x8cec('0x43')]){_0x395ca9[_0x8cec('0x44')]=[{'all':!![]}];}return db[_0x8cec('0x30')][_0x8cec('0x45')](_0x395ca9);})[_0x8cec('0x2a')](function(_0x237640){_0x4f0b41['rows']=_0x237640;return _0x4f0b41;})[_0x8cec('0x2a')](respondWithFilteredResult(_0x19e088,_0x395ca9))[_0x8cec('0x46')](handleError(_0x19e088,null));};exports[_0x8cec('0x47')]=function(_0x2e0654,_0x52bcdc){var _0x317ee2={'raw':![],'where':{'id':_0x2e0654['params']['id']}},_0x103814={};_0x103814[_0x8cec('0x35')]=_[_0x8cec('0x33')](db[_0x8cec('0x30')][_0x8cec('0x48')]);_0x103814[_0x8cec('0x32')]=_[_0x8cec('0x33')](_0x2e0654['query']);_0x103814['filters']=_['intersection'](_0x103814[_0x8cec('0x35')],_0x103814[_0x8cec('0x32')]);_0x317ee2['attributes']=_[_0x8cec('0x37')](_0x103814[_0x8cec('0x35')],qs[_0x8cec('0x38')](_0x2e0654['query']['fields']));_0x317ee2[_0x8cec('0x36')]=_0x317ee2[_0x8cec('0x36')][_0x8cec('0x49')]?_0x317ee2[_0x8cec('0x36')]:_0x103814[_0x8cec('0x35')];if(_0x2e0654[_0x8cec('0x32')][_0x8cec('0x43')]){_0x317ee2[_0x8cec('0x44')]=[{'all':!![]}];}_0x317ee2=_[_0x8cec('0x41')]({},_0x317ee2,_0x2e0654[_0x8cec('0x4a')]);return db[_0x8cec('0x30')][_0x8cec('0x4b')](_0x317ee2)[_0x8cec('0x2a')](handleEntityNotFound(_0x52bcdc,null))[_0x8cec('0x2a')](respondWithResult(_0x52bcdc,null))[_0x8cec('0x46')](handleError(_0x52bcdc,null));};exports[_0x8cec('0x4c')]=function(_0x59a0c6,_0x412f47){return db[_0x8cec('0x30')]['create'](_0x59a0c6[_0x8cec('0x4d')],{})[_0x8cec('0x2a')](respondWithResult(_0x412f47,0xc9))['catch'](handleError(_0x412f47,null));};exports[_0x8cec('0x28')]=function(_0x22e8ff,_0x18bf53){if(_0x22e8ff[_0x8cec('0x4d')]['id']){delete _0x22e8ff[_0x8cec('0x4d')]['id'];}return db[_0x8cec('0x30')][_0x8cec('0x4b')]({'where':{'id':_0x22e8ff['params']['id']}})[_0x8cec('0x2a')](handleEntityNotFound(_0x18bf53,null))[_0x8cec('0x2a')](saveUpdates(_0x22e8ff['body'],null))[_0x8cec('0x2a')](respondWithResult(_0x18bf53,null))[_0x8cec('0x46')](handleError(_0x18bf53,null));};exports[_0x8cec('0x29')]=function(_0x27a641,_0x2f6f74){return db[_0x8cec('0x30')][_0x8cec('0x4b')]({'where':{'id':_0x27a641[_0x8cec('0x4e')]['id']}})[_0x8cec('0x2a')](handleEntityNotFound(_0x2f6f74,null))['then'](removeEntity(_0x2f6f74,null))[_0x8cec('0x46')](handleError(_0x2f6f74,null));};exports[_0x8cec('0x4f')]=function(_0x4bae49,_0x2b7814,_0x2dbe20){var _0xc7e42c={};var _0x42e8c8={};var _0x4fabde;var _0xb7b333;return db[_0x8cec('0x30')][_0x8cec('0x50')]({'where':{'id':_0x4bae49[_0x8cec('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b7814,null))[_0x8cec('0x2a')](function(_0x3c593e){if(_0x3c593e){_0x4fabde=_0x3c593e;_0x42e8c8[_0x8cec('0x35')]=_[_0x8cec('0x33')](db[_0x8cec('0x51')][_0x8cec('0x48')]);_0x42e8c8[_0x8cec('0x32')]=_[_0x8cec('0x33')](_0x4bae49[_0x8cec('0x32')]);_0x42e8c8[_0x8cec('0x34')]=_[_0x8cec('0x37')](_0x42e8c8[_0x8cec('0x35')],_0x42e8c8['query']);_0xc7e42c[_0x8cec('0x36')]=_['intersection'](_0x42e8c8[_0x8cec('0x35')],qs['fields'](_0x4bae49[_0x8cec('0x32')][_0x8cec('0x38')]));_0xc7e42c[_0x8cec('0x36')]=_0xc7e42c[_0x8cec('0x36')][_0x8cec('0x49')]?_0xc7e42c[_0x8cec('0x36')]:_0x42e8c8[_0x8cec('0x35')];_0xc7e42c[_0x8cec('0x3c')]=qs[_0x8cec('0x3d')](_0x4bae49['query'][_0x8cec('0x3d')]);_0xc7e42c[_0x8cec('0x3f')]=qs[_0x8cec('0x34')](_[_0x8cec('0x52')](_0x4bae49['query'],_0x42e8c8[_0x8cec('0x34')]));if(_0x4bae49[_0x8cec('0x32')]['filter']){_0xc7e42c[_0x8cec('0x3f')]=_[_0x8cec('0x41')](_0xc7e42c[_0x8cec('0x3f')],{'$or':_[_0x8cec('0x2f')](_0xc7e42c[_0x8cec('0x36')],function(_0x40ddb8){var _0x135cdd={};_0x135cdd[_0x40ddb8]={'$like':'%'+_0x4bae49['query'][_0x8cec('0x3e')]+'%'};return _0x135cdd;})});}_0xc7e42c=_[_0x8cec('0x41')]({},_0xc7e42c,_0x4bae49[_0x8cec('0x4a')]);return _0x4fabde['getSubjects'](_0xc7e42c);}})['then'](function(_0x4112da){if(_0x4112da){_0xb7b333=_0x4112da[_0x8cec('0x49')];if(!_0x4bae49['query']['hasOwnProperty'](_0x8cec('0x3a'))){_0xc7e42c[_0x8cec('0x3b')]=qs['limit'](_0x4bae49[_0x8cec('0x32')][_0x8cec('0x3b')]);_0xc7e42c['offset']=qs[_0x8cec('0x23')](_0x4bae49[_0x8cec('0x32')][_0x8cec('0x23')]);}return _0x4fabde['getSubjects'](_0xc7e42c);}})[_0x8cec('0x2a')](function(_0xfeeff8){if(_0xfeeff8){return _0xfeeff8?{'count':_0xb7b333,'rows':_0xfeeff8}:null;}})['then'](respondWithResult(_0x2b7814,null))[_0x8cec('0x46')](handleError(_0x2b7814,null));};exports[_0x8cec('0x53')]=function(_0x1abf61,_0x4c09a9,_0x3f943a){var _0x5811e9={};var _0x3b63e6={};var _0x8ff31;var _0x48915f;return db[_0x8cec('0x30')]['findOne']({'where':{'id':_0x1abf61[_0x8cec('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c09a9,null))['then'](function(_0xac1427){if(_0xac1427){_0x8ff31=_0xac1427;_0x3b63e6[_0x8cec('0x35')]=_['keys'](db['FreshsalesField'][_0x8cec('0x48')]);_0x3b63e6[_0x8cec('0x32')]=_['keys'](_0x1abf61[_0x8cec('0x32')]);_0x3b63e6[_0x8cec('0x34')]=_[_0x8cec('0x37')](_0x3b63e6['model'],_0x3b63e6[_0x8cec('0x32')]);_0x5811e9[_0x8cec('0x36')]=_['intersection'](_0x3b63e6['model'],qs[_0x8cec('0x38')](_0x1abf61[_0x8cec('0x32')][_0x8cec('0x38')]));_0x5811e9['attributes']=_0x5811e9['attributes']['length']?_0x5811e9[_0x8cec('0x36')]:_0x3b63e6[_0x8cec('0x35')];_0x5811e9[_0x8cec('0x3c')]=qs[_0x8cec('0x3d')](_0x1abf61[_0x8cec('0x32')][_0x8cec('0x3d')]);_0x5811e9[_0x8cec('0x3f')]=qs[_0x8cec('0x34')](_[_0x8cec('0x52')](_0x1abf61[_0x8cec('0x32')],_0x3b63e6[_0x8cec('0x34')]));if(_0x1abf61[_0x8cec('0x32')]['filter']){_0x5811e9[_0x8cec('0x3f')]=_['merge'](_0x5811e9[_0x8cec('0x3f')],{'$or':_[_0x8cec('0x2f')](_0x5811e9[_0x8cec('0x36')],function(_0x19ceb3){var _0x456df1={};_0x456df1[_0x19ceb3]={'$like':'%'+_0x1abf61['query'][_0x8cec('0x3e')]+'%'};return _0x456df1;})});}_0x5811e9=_['merge']({},_0x5811e9,_0x1abf61[_0x8cec('0x4a')]);return _0x8ff31[_0x8cec('0x53')](_0x5811e9);}})['then'](function(_0x27c0f9){if(_0x27c0f9){_0x48915f=_0x27c0f9[_0x8cec('0x49')];if(!_0x1abf61[_0x8cec('0x32')][_0x8cec('0x39')](_0x8cec('0x3a'))){_0x5811e9['limit']=qs[_0x8cec('0x3b')](_0x1abf61[_0x8cec('0x32')]['limit']);_0x5811e9[_0x8cec('0x23')]=qs[_0x8cec('0x23')](_0x1abf61[_0x8cec('0x32')][_0x8cec('0x23')]);}return _0x8ff31[_0x8cec('0x53')](_0x5811e9);}})[_0x8cec('0x2a')](function(_0x3d5cb1){if(_0x3d5cb1){return _0x3d5cb1?{'count':_0x48915f,'rows':_0x3d5cb1}:null;}})[_0x8cec('0x2a')](respondWithResult(_0x4c09a9,null))[_0x8cec('0x46')](handleError(_0x4c09a9,null));};exports[_0x8cec('0x54')]=function(_0x549ffb,_0x168b5f,_0x4492a9){var _0x150a48={};var _0x421e1b={};var _0x5e51d6;var _0x52b65d;return db[_0x8cec('0x30')]['findOne']({'where':{'id':_0x549ffb['params']['id']}})[_0x8cec('0x2a')](handleEntityNotFound(_0x168b5f,null))['then'](function(_0x416a37){if(_0x416a37){_0x5e51d6=_0x416a37;_0x421e1b[_0x8cec('0x35')]=_[_0x8cec('0x33')](db[_0x8cec('0x51')][_0x8cec('0x48')]);_0x421e1b['query']=_['keys'](_0x549ffb['query']);_0x421e1b[_0x8cec('0x34')]=_[_0x8cec('0x37')](_0x421e1b['model'],_0x421e1b[_0x8cec('0x32')]);_0x150a48[_0x8cec('0x36')]=_[_0x8cec('0x37')](_0x421e1b['model'],qs['fields'](_0x549ffb[_0x8cec('0x32')]['fields']));_0x150a48[_0x8cec('0x36')]=_0x150a48[_0x8cec('0x36')][_0x8cec('0x49')]?_0x150a48[_0x8cec('0x36')]:_0x421e1b[_0x8cec('0x35')];_0x150a48[_0x8cec('0x3c')]=qs[_0x8cec('0x3d')](_0x549ffb[_0x8cec('0x32')]['sort']);_0x150a48[_0x8cec('0x3f')]=qs[_0x8cec('0x34')](_[_0x8cec('0x52')](_0x549ffb[_0x8cec('0x32')],_0x421e1b[_0x8cec('0x34')]));if(_0x549ffb[_0x8cec('0x32')]['filter']){_0x150a48['where']=_[_0x8cec('0x41')](_0x150a48['where'],{'$or':_['map'](_0x150a48[_0x8cec('0x36')],function(_0xd90d5a){var _0x192332={};_0x192332[_0xd90d5a]={'$like':'%'+_0x549ffb[_0x8cec('0x32')][_0x8cec('0x3e')]+'%'};return _0x192332;})});}_0x150a48=_[_0x8cec('0x41')]({},_0x150a48,_0x549ffb[_0x8cec('0x4a')]);return _0x5e51d6[_0x8cec('0x54')](_0x150a48);}})[_0x8cec('0x2a')](function(_0x507edd){if(_0x507edd){_0x52b65d=_0x507edd[_0x8cec('0x49')];if(!_0x549ffb[_0x8cec('0x32')]['hasOwnProperty'](_0x8cec('0x3a'))){_0x150a48[_0x8cec('0x3b')]=qs[_0x8cec('0x3b')](_0x549ffb[_0x8cec('0x32')][_0x8cec('0x3b')]);_0x150a48['offset']=qs['offset'](_0x549ffb[_0x8cec('0x32')]['offset']);}return _0x5e51d6[_0x8cec('0x54')](_0x150a48);}})['then'](function(_0x291324){if(_0x291324){return _0x291324?{'count':_0x52b65d,'rows':_0x291324}:null;}})['then'](respondWithResult(_0x168b5f,null))[_0x8cec('0x46')](handleError(_0x168b5f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 61e4b21..69cec89 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 _0x1e1a=['FreshsalesConfiguration','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x51d3ac,_0x2cdcfc){var _0x29b333=function(_0xd4e32){while(--_0xd4e32){_0x51d3ac['push'](_0x51d3ac['shift']());}};_0x29b333(++_0x2cdcfc);}(_0x1e1a,0x175));var _0xa1e1=function(_0x1cfb0e,_0x325578){_0x1cfb0e=_0x1cfb0e-0x0;var _0x4d6f6f=_0x1e1a[_0x1cfb0e];return _0x4d6f6f;};'use strict';var _=require('lodash');var util=require(_0xa1e1('0x0'));var logger=require(_0xa1e1('0x1'))(_0xa1e1('0x2'));var moment=require(_0xa1e1('0x3'));var BPromise=require(_0xa1e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1e1('0x5'));var rimraf=require(_0xa1e1('0x6'));var config=require(_0xa1e1('0x7'));var attributes=require(_0xa1e1('0x8'));module[_0xa1e1('0x9')]=function(_0x55342f,_0x2b8a8a){return _0x55342f[_0xa1e1('0xa')](_0xa1e1('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d98=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0d98,0x149));var _0x80d9=function(_0x2ce3a3,_0x529cd6){_0x2ce3a3=_0x2ce3a3-0x0;var _0x52ce9d=_0x0d98[_0x2ce3a3];return _0x52ce9d;};'use strict';var _=require(_0x80d9('0x0'));var util=require(_0x80d9('0x1'));var logger=require(_0x80d9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x80d9('0x3'));var fs=require('fs');var path=require(_0x80d9('0x4'));var rimraf=require(_0x80d9('0x5'));var config=require(_0x80d9('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x80d9('0x7')]=function(_0x4c6e77,_0x4a7aad){return _0x4c6e77['define'](_0x80d9('0x8'),attributes,{'tableName':_0x80d9('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 f3f1585..c84e064 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 _0x1491=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x1491,0x1b1));var _0x1149=function(_0x4d6746,_0x4e2e23){_0x4d6746=_0x4d6746-0x0;var _0x257e65=_0x1491[_0x4d6746];return _0x257e65;};'use strict';var _=require(_0x1149('0x0'));var util=require(_0x1149('0x1'));var moment=require(_0x1149('0x2'));var BPromise=require(_0x1149('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1149('0x4'));var db=require(_0x1149('0x5'))['db'];var utils=require(_0x1149('0x6'));var logger=require(_0x1149('0x7'))(_0x1149('0x8'));var config=require(_0x1149('0x9'));var jayson=require(_0x1149('0xa'));var client=jayson[_0x1149('0xb')][_0x1149('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xaa7515,_0x15513b,_0x3bf02f){return new BPromise(function(_0x285f6c,_0xde257c){return client[_0x1149('0xd')](_0xaa7515,_0x3bf02f)[_0x1149('0xe')](function(_0x17a116){logger[_0x1149('0xf')](_0x1149('0x10'),_0x15513b,'request\x20sent');logger[_0x1149('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x15513b,'request\x20sent',JSON['stringify'](_0x17a116));if(_0x17a116[_0x1149('0x12')]){if(_0x17a116['error']['code']===0x1f4){logger[_0x1149('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x15513b,_0x17a116[_0x1149('0x12')][_0x1149('0x13')]);return _0xde257c(_0x17a116[_0x1149('0x12')][_0x1149('0x13')]);}logger[_0x1149('0x12')](_0x1149('0x10'),_0x15513b,_0x17a116['error'][_0x1149('0x13')]);return _0x285f6c(_0x17a116['error']['message']);}else{logger[_0x1149('0xf')](_0x1149('0x10'),_0x15513b,'request\x20sent');_0x285f6c(_0x17a116[_0x1149('0x14')][_0x1149('0x13')]);}})[_0x1149('0x15')](function(_0x165b15){logger[_0x1149('0x12')](_0x1149('0x10'),_0x15513b,_0x165b15);_0xde257c(_0x165b15);});});} \ No newline at end of file +var _0xde1e=['client','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2da8d9,_0x32cae5){var _0x525afb=function(_0x3f6f14){while(--_0x3f6f14){_0x2da8d9['push'](_0x2da8d9['shift']());}};_0x525afb(++_0x32cae5);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var moment=require(_0xede1('0x2'));var BPromise=require(_0xede1('0x3'));var rs=require(_0xede1('0x4'));var fs=require('fs');var Redis=require(_0xede1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xede1('0x6'));var logger=require(_0xede1('0x7'))(_0xede1('0x8'));var config=require(_0xede1('0x9'));var jayson=require(_0xede1('0xa'));var client=jayson[_0xede1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4671,_0xeeec58,_0x1722c9){return new BPromise(function(_0x452e74,_0x29fe67){return client[_0xede1('0xc')](_0x3a4671,_0x1722c9)['then'](function(_0xa1641){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0xeeec58,_0xede1('0xd'));logger[_0xede1('0xe')](_0xede1('0xf'),_0xeeec58,_0xede1('0xd'),JSON[_0xede1('0x10')](_0xa1641));if(_0xa1641[_0xede1('0x11')]){if(_0xa1641['error'][_0xede1('0x12')]===0x1f4){logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0xa1641['error']['message']);return _0x29fe67(_0xa1641[_0xede1('0x11')][_0xede1('0x14')]);}logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0xa1641[_0xede1('0x11')]['message']);return _0x452e74(_0xa1641[_0xede1('0x11')][_0xede1('0x14')]);}else{logger[_0xede1('0x15')](_0xede1('0x13'),_0xeeec58,_0xede1('0xd'));_0x452e74(_0xa1641[_0xede1('0x16')][_0xede1('0x14')]);}})[_0xede1('0x17')](function(_0x5648fb){logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0x5648fb);_0x29fe67(_0x5648fb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 1a36673..d479741 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 _0x6c81=['/:id','show','post','create','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated'];(function(_0x2c4f98,_0x5d7327){var _0x29330d=function(_0x471e58){while(--_0x471e58){_0x2c4f98['push'](_0x2c4f98['shift']());}};_0x29330d(++_0x5d7327);}(_0x6c81,0x13d));var _0x16c8=function(_0x3fb05b,_0x473ea3){_0x3fb05b=_0x3fb05b-0x0;var _0x36c70b=_0x6c81[_0x3fb05b];return _0x36c70b;};'use strict';var multer=require('multer');var util=require(_0x16c8('0x0'));var path=require('path');var timeout=require(_0x16c8('0x1'));var express=require(_0x16c8('0x2'));var router=express['Router']();var auth=require(_0x16c8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x16c8('0x4'));var controller=require(_0x16c8('0x5'));router['get']('/',auth[_0x16c8('0x6')](),controller['index']);router['get'](_0x16c8('0x7'),auth['isAuthenticated'](),controller[_0x16c8('0x8')]);router[_0x16c8('0x9')]('/',auth[_0x16c8('0x6')](),controller[_0x16c8('0xa')]);router['put'](_0x16c8('0x7'),auth[_0x16c8('0x6')](),controller['update']);router['delete']('/:id',auth[_0x16c8('0x6')](),controller['destroy']);module[_0x16c8('0xb')]=router; \ No newline at end of file +var _0xebac=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','util','path'];(function(_0x59d7ee,_0xd25303){var _0x11f4e9=function(_0x4b92f2){while(--_0x4b92f2){_0x59d7ee['push'](_0x59d7ee['shift']());}};_0x11f4e9(++_0xd25303);}(_0xebac,0x18e));var _0xceba=function(_0x58cc71,_0x2c45d1){_0x58cc71=_0x58cc71-0x0;var _0x1d67e9=_0xebac[_0x58cc71];return _0x1d67e9;};'use strict';var multer=require('multer');var util=require(_0xceba('0x0'));var path=require(_0xceba('0x1'));var timeout=require(_0xceba('0x2'));var express=require('express');var router=express[_0xceba('0x3')]();var auth=require(_0xceba('0x4'));var interaction=require(_0xceba('0x5'));var config=require('../../config/environment');var controller=require(_0xceba('0x6'));router[_0xceba('0x7')]('/',auth[_0xceba('0x8')](),controller['index']);router[_0xceba('0x7')](_0xceba('0x9'),auth[_0xceba('0x8')](),controller[_0xceba('0xa')]);router[_0xceba('0xb')]('/',auth[_0xceba('0x8')](),controller[_0xceba('0xc')]);router[_0xceba('0xd')]('/:id',auth[_0xceba('0x8')](),controller[_0xceba('0xe')]);router[_0xceba('0xf')](_0xceba('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index b7e742d..68b6fc2 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 _0xa9b7=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9b7,0x18a));var _0x7a9b=function(_0x3d6ef3,_0x37b625){_0x3d6ef3=_0x3d6ef3-0x0;var _0x202f16=_0xa9b7[_0x3d6ef3];return _0x202f16;};'use strict';var Sequelize=require(_0x7a9b('0x0'));module[_0x7a9b('0x1')]={'type':{'type':Sequelize[_0x7a9b('0x2')](_0x7a9b('0x3'),_0x7a9b('0x4'),_0x7a9b('0x5'),_0x7a9b('0x6')),'defaultValue':_0x7a9b('0x3')},'content':{'type':Sequelize[_0x7a9b('0x7')]},'key':{'type':Sequelize[_0x7a9b('0x7')]},'keyType':{'type':Sequelize[_0x7a9b('0x2')](_0x7a9b('0x3'),_0x7a9b('0x4'),_0x7a9b('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7a9b('0x7')]},'customField':{'type':Sequelize[_0x7a9b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a9b('0x7')]}}; \ No newline at end of file +var _0x3e84=['customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x55cf87,_0x943e6d){var _0x33c268=function(_0x39d6fe){while(--_0x39d6fe){_0x55cf87['push'](_0x55cf87['shift']());}};_0x33c268(++_0x943e6d);}(_0x3e84,0xd4));var _0x43e8=function(_0x3b9d79,_0x42f721){_0x3b9d79=_0x3b9d79-0x0;var _0x16d93e=_0x3e84[_0x3b9d79];return _0x16d93e;};'use strict';var Sequelize=require('sequelize');module[_0x43e8('0x0')]={'type':{'type':Sequelize[_0x43e8('0x1')](_0x43e8('0x2'),_0x43e8('0x3'),_0x43e8('0x4'),_0x43e8('0x5')),'defaultValue':_0x43e8('0x2')},'content':{'type':Sequelize[_0x43e8('0x6')]},'key':{'type':Sequelize[_0x43e8('0x6')]},'keyType':{'type':Sequelize[_0x43e8('0x1')]('string','variable',_0x43e8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x43e8('0x6')]},'nameField':{'type':Sequelize[_0x43e8('0x6')]},'customField':{'type':Sequelize[_0x43e8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f771637..c1d1a58 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 _0x188a=['send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x188a,0xfb));var _0xa188=function(_0x55b854,_0x3a8327){_0x55b854=_0x55b854-0x0;var _0x2b8c07=_0x188a[_0x55b854];return _0x2b8c07;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa188('0x0'));var rimraf=require(_0xa188('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa188('0x2'));var moment=require(_0xa188('0x3'));var BPromise=require(_0xa188('0x4'));var Mustache=require(_0xa188('0x5'));var util=require(_0xa188('0x6'));var path=require(_0xa188('0x7'));var sox=require(_0xa188('0x8'));var csv=require(_0xa188('0x9'));var ejs=require(_0xa188('0xa'));var fs=require('fs');var _=require(_0xa188('0xb'));var squel=require(_0xa188('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa188('0xd'));var authService=require(_0xa188('0xe'));var qs=require(_0xa188('0xf'));var as=require(_0xa188('0x10'));var hardwareService=require(_0xa188('0x11'));var logger=require(_0xa188('0x12'))(_0xa188('0x13'));var utils=require('../../config/utils');var config=require(_0xa188('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22deba,_0x578812){_0x578812=_0x578812||0xcc;return function(_0x12f78d){if(_0x12f78d){return _0x22deba[_0xa188('0x15')](_0x578812);}return _0x22deba[_0xa188('0x16')](_0x578812)[_0xa188('0x17')]();};}function respondWithResult(_0x4d193a,_0x51b01e){_0x51b01e=_0x51b01e||0xc8;return function(_0x21141a){if(_0x21141a){return _0x4d193a[_0xa188('0x16')](_0x51b01e)[_0xa188('0x18')](_0x21141a);}};}function respondWithFilteredResult(_0x5648a4,_0x360275){return function(_0x429a54){if(_0x429a54){var _0x5dd582=_0x429a54[_0xa188('0x19')],_0x5dae8c=_0x360275['offset'],_0x8a1b74=_0x360275[_0xa188('0x1a')]+_0x360275[_0xa188('0x1b')],_0x3e6e1e;if(_0x8a1b74>=_0x5dd582){_0x8a1b74=_0x5dd582;_0x3e6e1e=0xc8;}else{_0x3e6e1e=0xce;}_0x5648a4['status'](_0x3e6e1e);return _0x5648a4[_0xa188('0x1c')](_0xa188('0x1d'),_0x5dae8c+'-'+_0x8a1b74+'/'+_0x5dd582)['json'](_0x429a54);}return null;};}function patchUpdates(_0x48b571){return function(_0xd6b30b){try{jsonpatch[_0xa188('0x1e')](_0xd6b30b,_0x48b571,!![]);}catch(_0x4be6f7){return BPromise[_0xa188('0x1f')](_0x4be6f7);}return _0xd6b30b[_0xa188('0x20')]();};}function saveUpdates(_0x49dc8a,_0x4f1231){return function(_0x56419b){if(_0x56419b){return _0x56419b['update'](_0x49dc8a)[_0xa188('0x21')](function(_0xb42b5f){return _0xb42b5f;});}return null;};}function removeEntity(_0x639051,_0x40337e){return function(_0x3bf588){if(_0x3bf588){return _0x3bf588[_0xa188('0x22')]()['then'](function(){_0x639051[_0xa188('0x16')](0xcc)[_0xa188('0x17')]();});}};}function handleEntityNotFound(_0x41b20f,_0x1bef76){return function(_0x3921af){if(!_0x3921af){_0x41b20f['sendStatus'](0x194);}return _0x3921af;};}function handleError(_0x2cad7a,_0x208a43){_0x208a43=_0x208a43||0x1f4;return function(_0x55b6ea){logger[_0xa188('0x23')](_0x55b6ea['stack']);if(_0x55b6ea['name']){delete _0x55b6ea[_0xa188('0x24')];}_0x2cad7a[_0xa188('0x16')](_0x208a43)[_0xa188('0x25')](_0x55b6ea);};}exports[_0xa188('0x26')]=function(_0x2b67ac,_0x2f6b42){var _0x21de58={},_0xb96e14={},_0x296da8={'count':0x0,'rows':[]};var _0x288bbc=_[_0xa188('0x27')](db[_0xa188('0x28')][_0xa188('0x29')],function(_0x5a34a4){return{'name':_0x5a34a4[_0xa188('0x2a')],'type':_0x5a34a4[_0xa188('0x2b')][_0xa188('0x2c')]};});_0xb96e14['model']=_[_0xa188('0x27')](_0x288bbc,_0xa188('0x24'));_0xb96e14['query']=_[_0xa188('0x2d')](_0x2b67ac[_0xa188('0x2e')]);_0xb96e14[_0xa188('0x2f')]=_['intersection'](_0xb96e14[_0xa188('0x30')],_0xb96e14[_0xa188('0x2e')]);_0x21de58['attributes']=_[_0xa188('0x31')](_0xb96e14[_0xa188('0x30')],qs[_0xa188('0x32')](_0x2b67ac[_0xa188('0x2e')][_0xa188('0x32')]));_0x21de58['attributes']=_0x21de58[_0xa188('0x33')][_0xa188('0x34')]?_0x21de58['attributes']:_0xb96e14['model'];if(!_0x2b67ac['query'][_0xa188('0x35')](_0xa188('0x36'))){_0x21de58[_0xa188('0x1b')]=qs['limit'](_0x2b67ac[_0xa188('0x2e')][_0xa188('0x1b')]);_0x21de58[_0xa188('0x1a')]=qs['offset'](_0x2b67ac['query'][_0xa188('0x1a')]);}_0x21de58['order']=qs[_0xa188('0x37')](_0x2b67ac[_0xa188('0x2e')][_0xa188('0x37')]);_0x21de58[_0xa188('0x38')]=qs[_0xa188('0x2f')](_[_0xa188('0x39')](_0x2b67ac[_0xa188('0x2e')],_0xb96e14[_0xa188('0x2f')]),_0x288bbc);if(_0x2b67ac[_0xa188('0x2e')]['filter']){_0x21de58[_0xa188('0x38')]=_[_0xa188('0x3a')](_0x21de58['where'],{'$or':_[_0xa188('0x27')](_0x288bbc,function(_0x282f0a){if(_0x282f0a[_0xa188('0x2b')]!==_0xa188('0x3b')){var _0x388515={};_0x388515[_0x282f0a[_0xa188('0x24')]]={'$like':'%'+_0x2b67ac[_0xa188('0x2e')][_0xa188('0x3c')]+'%'};return _0x388515;}})});}_0x21de58=_[_0xa188('0x3a')]({},_0x21de58,_0x2b67ac[_0xa188('0x3d')]);var _0x43fb14={'where':_0x21de58[_0xa188('0x38')]};return db['FreshsalesField'][_0xa188('0x19')](_0x43fb14)['then'](function(_0x906e4e){_0x296da8[_0xa188('0x19')]=_0x906e4e;if(_0x2b67ac[_0xa188('0x2e')][_0xa188('0x3e')]){_0x21de58[_0xa188('0x3f')]=[{'all':!![]}];}return db[_0xa188('0x28')][_0xa188('0x40')](_0x21de58);})['then'](function(_0x21442c){_0x296da8[_0xa188('0x41')]=_0x21442c;return _0x296da8;})['then'](respondWithFilteredResult(_0x2f6b42,_0x21de58))[_0xa188('0x42')](handleError(_0x2f6b42,null));};exports[_0xa188('0x43')]=function(_0x5b50df,_0x52465c){var _0x3b1bfa={'raw':!![],'where':{'id':_0x5b50df['params']['id']}},_0x33775a={};_0x33775a[_0xa188('0x30')]=_['keys'](db[_0xa188('0x28')][_0xa188('0x29')]);_0x33775a['query']=_[_0xa188('0x2d')](_0x5b50df[_0xa188('0x2e')]);_0x33775a['filters']=_[_0xa188('0x31')](_0x33775a[_0xa188('0x30')],_0x33775a[_0xa188('0x2e')]);_0x3b1bfa[_0xa188('0x33')]=_[_0xa188('0x31')](_0x33775a[_0xa188('0x30')],qs[_0xa188('0x32')](_0x5b50df[_0xa188('0x2e')][_0xa188('0x32')]));_0x3b1bfa['attributes']=_0x3b1bfa[_0xa188('0x33')][_0xa188('0x34')]?_0x3b1bfa[_0xa188('0x33')]:_0x33775a['model'];if(_0x5b50df[_0xa188('0x2e')][_0xa188('0x3e')]){_0x3b1bfa[_0xa188('0x3f')]=[{'all':!![]}];}_0x3b1bfa=_['merge']({},_0x3b1bfa,_0x5b50df['options']);return db['FreshsalesField'][_0xa188('0x44')](_0x3b1bfa)['then'](handleEntityNotFound(_0x52465c,null))['then'](respondWithResult(_0x52465c,null))[_0xa188('0x42')](handleError(_0x52465c,null));};exports[_0xa188('0x45')]=function(_0x297f36,_0x3e1069){return db[_0xa188('0x28')][_0xa188('0x45')](_0x297f36[_0xa188('0x46')],{})[_0xa188('0x21')](respondWithResult(_0x3e1069,0xc9))[_0xa188('0x42')](handleError(_0x3e1069,null));};exports['update']=function(_0x686ccf,_0x1d21b2){if(_0x686ccf[_0xa188('0x46')]['id']){delete _0x686ccf[_0xa188('0x46')]['id'];}return db[_0xa188('0x28')][_0xa188('0x44')]({'where':{'id':_0x686ccf[_0xa188('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d21b2,null))[_0xa188('0x21')](saveUpdates(_0x686ccf[_0xa188('0x46')],null))['then'](respondWithResult(_0x1d21b2,null))[_0xa188('0x42')](handleError(_0x1d21b2,null));};exports[_0xa188('0x22')]=function(_0x4cebe1,_0x3d6ee8){return db['FreshsalesField'][_0xa188('0x44')]({'where':{'id':_0x4cebe1[_0xa188('0x47')]['id']}})[_0xa188('0x21')](handleEntityNotFound(_0x3d6ee8,null))[_0xa188('0x21')](removeEntity(_0x3d6ee8,null))[_0xa188('0x42')](handleError(_0x3d6ee8,null));}; \ No newline at end of file +var _0x044a=['filters','query','attributes','fields','length','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','include','rows','show','params','rawAttributes','intersection','includeAll','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','then','stack','name','send','FreshsalesField','fieldName','model','map','keys'];(function(_0x123a80,_0x949abf){var _0x346530=function(_0x42b31b){while(--_0x42b31b){_0x123a80['push'](_0x123a80['shift']());}};_0x346530(++_0x949abf);}(_0x044a,0xdd));var _0xa044=function(_0x33962f,_0x337edd){_0x33962f=_0x33962f-0x0;var _0x3cf377=_0x044a[_0x33962f];return _0x3cf377;};'use strict';var pdf=require(_0xa044('0x0'));var emlformat=require(_0xa044('0x1'));var rimraf=require(_0xa044('0x2'));var zipdir=require(_0xa044('0x3'));var jsonpatch=require(_0xa044('0x4'));var rp=require('request-promise');var moment=require(_0xa044('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa044('0x6'));var path=require('path');var sox=require(_0xa044('0x7'));var csv=require(_0xa044('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa044('0x9'));var squel=require(_0xa044('0xa'));var crypto=require(_0xa044('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa044('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa044('0xd'));var Papa=require(_0xa044('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa044('0xf'));var as=require(_0xa044('0x10'));var hardwareService=require(_0xa044('0x11'));var logger=require(_0xa044('0x12'))('api');var utils=require(_0xa044('0x13'));var config=require('../../config/environment');var db=require(_0xa044('0x14'))['db'];function respondWithStatusCode(_0x1869fb,_0x52f129){_0x52f129=_0x52f129||0xcc;return function(_0x4fb043){if(_0x4fb043){return _0x1869fb[_0xa044('0x15')](_0x52f129);}return _0x1869fb[_0xa044('0x16')](_0x52f129)[_0xa044('0x17')]();};}function respondWithResult(_0x447526,_0x1c978e){_0x1c978e=_0x1c978e||0xc8;return function(_0x49aff5){if(_0x49aff5){return _0x447526[_0xa044('0x16')](_0x1c978e)['json'](_0x49aff5);}};}function respondWithFilteredResult(_0x4e5121,_0x528a85){return function(_0x29da2c){if(_0x29da2c){var _0x450a6b=_0x29da2c[_0xa044('0x18')],_0x35ee93=_0x528a85['offset'],_0x53dd5e=_0x528a85[_0xa044('0x19')]+_0x528a85[_0xa044('0x1a')],_0x15c40c;if(_0x53dd5e>=_0x450a6b){_0x53dd5e=_0x450a6b;_0x15c40c=0xc8;}else{_0x15c40c=0xce;}_0x4e5121[_0xa044('0x16')](_0x15c40c);return _0x4e5121[_0xa044('0x1b')]('Content-Range',_0x35ee93+'-'+_0x53dd5e+'/'+_0x450a6b)['json'](_0x29da2c);}return null;};}function patchUpdates(_0x553617){return function(_0x2aec32){try{jsonpatch[_0xa044('0x1c')](_0x2aec32,_0x553617,!![]);}catch(_0x40891e){return BPromise[_0xa044('0x1d')](_0x40891e);}return _0x2aec32['save']();};}function saveUpdates(_0x4dc42b,_0x472bee){return function(_0x492c9a){if(_0x492c9a){return _0x492c9a['update'](_0x4dc42b)['then'](function(_0x394f95){return _0x394f95;});}return null;};}function removeEntity(_0x42a38a,_0x2c89b7){return function(_0x3eeede){if(_0x3eeede){return _0x3eeede['destroy']()[_0xa044('0x1e')](function(){_0x42a38a['status'](0xcc)[_0xa044('0x17')]();});}};}function handleEntityNotFound(_0x33ca4a,_0x9830bb){return function(_0x648897){if(!_0x648897){_0x33ca4a[_0xa044('0x15')](0x194);}return _0x648897;};}function handleError(_0x281833,_0x259159){_0x259159=_0x259159||0x1f4;return function(_0x14dc86){logger['error'](_0x14dc86[_0xa044('0x1f')]);if(_0x14dc86[_0xa044('0x20')]){delete _0x14dc86[_0xa044('0x20')];}_0x281833[_0xa044('0x16')](_0x259159)[_0xa044('0x21')](_0x14dc86);};}exports['index']=function(_0x51f977,_0x442bd8){var _0x213c76={},_0x29cb6b={},_0x1d6246={'count':0x0,'rows':[]};var _0x34384b=_['map'](db[_0xa044('0x22')]['rawAttributes'],function(_0x1539fa){return{'name':_0x1539fa[_0xa044('0x23')],'type':_0x1539fa['type']['key']};});_0x29cb6b[_0xa044('0x24')]=_[_0xa044('0x25')](_0x34384b,'name');_0x29cb6b['query']=_[_0xa044('0x26')](_0x51f977['query']);_0x29cb6b[_0xa044('0x27')]=_['intersection'](_0x29cb6b[_0xa044('0x24')],_0x29cb6b[_0xa044('0x28')]);_0x213c76[_0xa044('0x29')]=_['intersection'](_0x29cb6b[_0xa044('0x24')],qs[_0xa044('0x2a')](_0x51f977['query']['fields']));_0x213c76[_0xa044('0x29')]=_0x213c76['attributes'][_0xa044('0x2b')]?_0x213c76[_0xa044('0x29')]:_0x29cb6b[_0xa044('0x24')];if(!_0x51f977[_0xa044('0x28')]['hasOwnProperty'](_0xa044('0x2c'))){_0x213c76['limit']=qs[_0xa044('0x1a')](_0x51f977[_0xa044('0x28')]['limit']);_0x213c76[_0xa044('0x19')]=qs['offset'](_0x51f977['query']['offset']);}_0x213c76['order']=qs[_0xa044('0x2d')](_0x51f977[_0xa044('0x28')]['sort']);_0x213c76['where']=qs[_0xa044('0x27')](_[_0xa044('0x2e')](_0x51f977[_0xa044('0x28')],_0x29cb6b[_0xa044('0x27')]),_0x34384b);if(_0x51f977[_0xa044('0x28')][_0xa044('0x2f')]){_0x213c76['where']=_[_0xa044('0x30')](_0x213c76[_0xa044('0x31')],{'$or':_[_0xa044('0x25')](_0x34384b,function(_0x1659a3){if(_0x1659a3[_0xa044('0x32')]!==_0xa044('0x33')){var _0x4e1a08={};_0x4e1a08[_0x1659a3['name']]={'$like':'%'+_0x51f977['query'][_0xa044('0x2f')]+'%'};return _0x4e1a08;}})});}_0x213c76=_[_0xa044('0x30')]({},_0x213c76,_0x51f977[_0xa044('0x34')]);var _0x1c8f3f={'where':_0x213c76[_0xa044('0x31')]};return db[_0xa044('0x22')][_0xa044('0x18')](_0x1c8f3f)['then'](function(_0x2da5cc){_0x1d6246[_0xa044('0x18')]=_0x2da5cc;if(_0x51f977[_0xa044('0x28')]['includeAll']){_0x213c76[_0xa044('0x35')]=[{'all':!![]}];}return db[_0xa044('0x22')]['findAll'](_0x213c76);})['then'](function(_0x2649ba){_0x1d6246[_0xa044('0x36')]=_0x2649ba;return _0x1d6246;})[_0xa044('0x1e')](respondWithFilteredResult(_0x442bd8,_0x213c76))['catch'](handleError(_0x442bd8,null));};exports[_0xa044('0x37')]=function(_0x5004a6,_0x16e8b2){var _0x4ad077={'raw':!![],'where':{'id':_0x5004a6[_0xa044('0x38')]['id']}},_0x5d5ac8={};_0x5d5ac8[_0xa044('0x24')]=_['keys'](db[_0xa044('0x22')][_0xa044('0x39')]);_0x5d5ac8[_0xa044('0x28')]=_['keys'](_0x5004a6[_0xa044('0x28')]);_0x5d5ac8['filters']=_[_0xa044('0x3a')](_0x5d5ac8[_0xa044('0x24')],_0x5d5ac8[_0xa044('0x28')]);_0x4ad077['attributes']=_[_0xa044('0x3a')](_0x5d5ac8[_0xa044('0x24')],qs[_0xa044('0x2a')](_0x5004a6[_0xa044('0x28')]['fields']));_0x4ad077[_0xa044('0x29')]=_0x4ad077['attributes'][_0xa044('0x2b')]?_0x4ad077[_0xa044('0x29')]:_0x5d5ac8[_0xa044('0x24')];if(_0x5004a6[_0xa044('0x28')][_0xa044('0x3b')]){_0x4ad077[_0xa044('0x35')]=[{'all':!![]}];}_0x4ad077=_[_0xa044('0x30')]({},_0x4ad077,_0x5004a6[_0xa044('0x34')]);return db['FreshsalesField'][_0xa044('0x3c')](_0x4ad077)[_0xa044('0x1e')](handleEntityNotFound(_0x16e8b2,null))[_0xa044('0x1e')](respondWithResult(_0x16e8b2,null))[_0xa044('0x3d')](handleError(_0x16e8b2,null));};exports['create']=function(_0x4acadd,_0x9c3a62){return db[_0xa044('0x22')][_0xa044('0x3e')](_0x4acadd[_0xa044('0x3f')],{})[_0xa044('0x1e')](respondWithResult(_0x9c3a62,0xc9))[_0xa044('0x3d')](handleError(_0x9c3a62,null));};exports[_0xa044('0x40')]=function(_0x7f69fa,_0x35e9df){if(_0x7f69fa[_0xa044('0x3f')]['id']){delete _0x7f69fa['body']['id'];}return db[_0xa044('0x22')][_0xa044('0x3c')]({'where':{'id':_0x7f69fa['params']['id']}})[_0xa044('0x1e')](handleEntityNotFound(_0x35e9df,null))['then'](saveUpdates(_0x7f69fa[_0xa044('0x3f')],null))[_0xa044('0x1e')](respondWithResult(_0x35e9df,null))[_0xa044('0x3d')](handleError(_0x35e9df,null));};exports['destroy']=function(_0x42262f,_0x3c9a74){return db['FreshsalesField'][_0xa044('0x3c')]({'where':{'id':_0x42262f[_0xa044('0x38')]['id']}})[_0xa044('0x1e')](handleEntityNotFound(_0x3c9a74,null))[_0xa044('0x1e')](removeEntity(_0x3c9a74,null))[_0xa044('0x3d')](handleError(_0x3c9a74,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index aa44176..1c0c9a6 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 _0x953b=['FreshsalesField','int_freshsales_fields','idField','FieldId','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x258363,_0x20bb31){var _0x33a199=function(_0x15f586){while(--_0x15f586){_0x258363['push'](_0x258363['shift']());}};_0x33a199(++_0x20bb31);}(_0x953b,0x90));var _0xb953=function(_0x571c65,_0x374b32){_0x571c65=_0x571c65-0x0;var _0x411fe2=_0x953b[_0x571c65];return _0x411fe2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb953('0x0'))('api');var moment=require(_0xb953('0x1'));var BPromise=require(_0xb953('0x2'));var rp=require(_0xb953('0x3'));var fs=require('fs');var path=require(_0xb953('0x4'));var rimraf=require(_0xb953('0x5'));var config=require(_0xb953('0x6'));var attributes=require(_0xb953('0x7'));module[_0xb953('0x8')]=function(_0x17e05f,_0x4afd58){return _0x17e05f[_0xb953('0x9')](_0xb953('0xa'),attributes,{'tableName':_0xb953('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb953('0xc'),_0xb953('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce96=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId'];(function(_0x453480,_0x4bd29d){var _0x425bf4=function(_0x1a8b29){while(--_0x1a8b29){_0x453480['push'](_0x453480['shift']());}};_0x425bf4(++_0x4bd29d);}(_0xce96,0x134));var _0x6ce9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xce96[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6ce9('0x0'));var util=require('util');var logger=require(_0x6ce9('0x1'))(_0x6ce9('0x2'));var moment=require('moment');var BPromise=require(_0x6ce9('0x3'));var rp=require(_0x6ce9('0x4'));var fs=require('fs');var path=require(_0x6ce9('0x5'));var rimraf=require('rimraf');var config=require(_0x6ce9('0x6'));var attributes=require(_0x6ce9('0x7'));module['exports']=function(_0x81aaf,_0x371e9e){return _0x81aaf[_0x6ce9('0x8')](_0x6ce9('0x9'),attributes,{'tableName':_0x6ce9('0xa'),'paranoid':![],'indexes':[{'name':_0x6ce9('0xb'),'fields':[_0x6ce9('0xc'),_0x6ce9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index c990481..8411a92 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 _0x98ee=['request\x20sent','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0x98ee,0x131));var _0xe98e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x98ee[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xe98e('0x0'));var util=require(_0xe98e('0x1'));var moment=require(_0xe98e('0x2'));var BPromise=require(_0xe98e('0x3'));var rs=require(_0xe98e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe98e('0x5'));var logger=require(_0xe98e('0x6'))(_0xe98e('0x7'));var config=require(_0xe98e('0x8'));var jayson=require(_0xe98e('0x9'));var client=jayson[_0xe98e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d83c,_0x4b6dbd,_0x1810ce){return new BPromise(function(_0xabc7c2,_0x2af810){return client[_0xe98e('0xb')](_0x39d83c,_0x1810ce)['then'](function(_0x3349a0){logger['info'](_0xe98e('0xc'),_0x4b6dbd,'request\x20sent');logger[_0xe98e('0xd')](_0xe98e('0xe'),_0x4b6dbd,_0xe98e('0xf'),JSON['stringify'](_0x3349a0));if(_0x3349a0['error']){if(_0x3349a0['error'][_0xe98e('0x10')]===0x1f4){logger[_0xe98e('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4b6dbd,_0x3349a0[_0xe98e('0x11')][_0xe98e('0x12')]);return _0x2af810(_0x3349a0[_0xe98e('0x11')][_0xe98e('0x12')]);}logger[_0xe98e('0x11')](_0xe98e('0xc'),_0x4b6dbd,_0x3349a0[_0xe98e('0x11')][_0xe98e('0x12')]);return _0xabc7c2(_0x3349a0['error'][_0xe98e('0x12')]);}else{logger['info'](_0xe98e('0xc'),_0x4b6dbd,_0xe98e('0xf'));_0xabc7c2(_0x3349a0[_0xe98e('0x13')][_0xe98e('0x12')]);}})['catch'](function(_0x30f9d2){logger[_0xe98e('0x11')](_0xe98e('0xc'),_0x4b6dbd,_0x30f9d2);_0x2af810(_0x30f9d2);});});} \ No newline at end of file +var _0x239b=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0xd8baf3,_0x238fd0){var _0x492838=function(_0xaffd75){while(--_0xaffd75){_0xd8baf3['push'](_0xd8baf3['shift']());}};_0x492838(++_0x238fd0);}(_0x239b,0x18b));var _0xb239=function(_0x5e82f4,_0x3c9bc0){_0x5e82f4=_0x5e82f4-0x0;var _0xfc1dbf=_0x239b[_0x5e82f4];return _0xfc1dbf;};'use strict';var _=require(_0xb239('0x0'));var util=require(_0xb239('0x1'));var moment=require('moment');var BPromise=require(_0xb239('0x2'));var rs=require(_0xb239('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb239('0x4'))['db'];var utils=require(_0xb239('0x5'));var logger=require('../../config/logger')(_0xb239('0x6'));var config=require(_0xb239('0x7'));var jayson=require(_0xb239('0x8'));var client=jayson['client'][_0xb239('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b0b81,_0x589aa7,_0x4cb3bf){return new BPromise(function(_0x47b190,_0x5d5642){return client['request'](_0x1b0b81,_0x4cb3bf)['then'](function(_0x489554){logger[_0xb239('0xa')]('FreshsalesField,\x20%s,\x20%s',_0x589aa7,_0xb239('0xb'));logger[_0xb239('0xc')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x589aa7,_0xb239('0xb'),JSON['stringify'](_0x489554));if(_0x489554[_0xb239('0xd')]){if(_0x489554['error'][_0xb239('0xe')]===0x1f4){logger[_0xb239('0xd')](_0xb239('0xf'),_0x589aa7,_0x489554[_0xb239('0xd')][_0xb239('0x10')]);return _0x5d5642(_0x489554['error']['message']);}logger[_0xb239('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x589aa7,_0x489554[_0xb239('0xd')][_0xb239('0x10')]);return _0x47b190(_0x489554[_0xb239('0xd')][_0xb239('0x10')]);}else{logger[_0xb239('0xa')](_0xb239('0xf'),_0x589aa7,_0xb239('0xb'));_0x47b190(_0x489554[_0xb239('0x11')][_0xb239('0x10')]);}})[_0xb239('0x12')](function(_0x899687){logger[_0xb239('0xd')](_0xb239('0xf'),_0x589aa7,_0x899687);_0x5d5642(_0x899687);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index cc22350..88135c0 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 _0xf364=['/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x4bb37a,_0x2c3526){var _0x336e12=function(_0x5800d6){while(--_0x5800d6){_0x4bb37a['push'](_0x4bb37a['shift']());}};_0x336e12(++_0x2c3526);}(_0xf364,0x78));var _0x4f36=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xf364[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x4f36('0x0'));var util=require('util');var path=require(_0x4f36('0x1'));var timeout=require(_0x4f36('0x2'));var express=require(_0x4f36('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f36('0x4'));var config=require(_0x4f36('0x5'));var controller=require(_0x4f36('0x6'));router['get']('/',auth[_0x4f36('0x7')](),controller[_0x4f36('0x8')]);router[_0x4f36('0x9')](_0x4f36('0xa'),auth[_0x4f36('0x7')](),controller[_0x4f36('0xb')]);router[_0x4f36('0x9')](_0x4f36('0xc'),auth[_0x4f36('0x7')](),controller['getConfigurations']);router[_0x4f36('0x9')](_0x4f36('0xd'),auth[_0x4f36('0x7')](),controller[_0x4f36('0xe')]);router['post']('/',auth[_0x4f36('0x7')](),controller[_0x4f36('0xf')]);router[_0x4f36('0x10')](_0x4f36('0xc'),auth[_0x4f36('0x7')](),controller[_0x4f36('0x11')]);router['put'](_0x4f36('0xa'),auth[_0x4f36('0x7')](),controller[_0x4f36('0x12')]);router[_0x4f36('0x13')](_0x4f36('0xa'),auth[_0x4f36('0x7')](),controller[_0x4f36('0x14')]);module[_0x4f36('0x15')]=router; \ No newline at end of file +var _0x5aa1=['/:id','update','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0xf47939,_0x124b6a){var _0x5f1ec1=function(_0x58f724){while(--_0x58f724){_0xf47939['push'](_0xf47939['shift']());}};_0x5f1ec1(++_0x124b6a);}(_0x5aa1,0x12a));var _0x15aa=function(_0x30c381,_0x346ba2){_0x30c381=_0x30c381-0x0;var _0x498163=_0x5aa1[_0x30c381];return _0x498163;};'use strict';var multer=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var path=require('path');var timeout=require(_0x15aa('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x15aa('0x3'));var interaction=require(_0x15aa('0x4'));var config=require(_0x15aa('0x5'));var controller=require(_0x15aa('0x6'));router[_0x15aa('0x7')]('/',auth[_0x15aa('0x8')](),controller['index']);router[_0x15aa('0x7')]('/:id',auth[_0x15aa('0x8')](),controller[_0x15aa('0x9')]);router[_0x15aa('0x7')](_0x15aa('0xa'),auth[_0x15aa('0x8')](),controller[_0x15aa('0xb')]);router[_0x15aa('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x15aa('0xc')]);router[_0x15aa('0xd')]('/',auth['isAuthenticated'](),controller[_0x15aa('0xe')]);router[_0x15aa('0xd')](_0x15aa('0xa'),auth[_0x15aa('0x8')](),controller[_0x15aa('0xf')]);router[_0x15aa('0x10')](_0x15aa('0x11'),auth[_0x15aa('0x8')](),controller[_0x15aa('0x12')]);router['delete'](_0x15aa('0x11'),auth['isAuthenticated'](),controller[_0x15aa('0x13')]);module[_0x15aa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3435fdf..0ffa1ae 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 _0x814b=['STRING','username','ENUM','newTab','integrationTab','sequelize','exports'];(function(_0x22e837,_0x422c68){var _0x4e87cc=function(_0x3a099a){while(--_0x3a099a){_0x22e837['push'](_0x22e837['shift']());}};_0x4e87cc(++_0x422c68);}(_0x814b,0x1a2));var _0xb814=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0x814b[_0x246f92];return _0x2b8e7d;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')]},'description':{'type':Sequelize[_0xb814('0x2')]},'username':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb814('0x2')]},'clientId':{'type':Sequelize[_0xb814('0x2')]},'clientSecret':{'type':Sequelize[_0xb814('0x2')]},'securityToken':{'type':Sequelize[_0xb814('0x2')]},'serverUrl':{'type':Sequelize[_0xb814('0x2')]},'type':{'type':Sequelize[_0xb814('0x4')]('integrationTab',_0xb814('0x5')),'defaultValue':_0xb814('0x6')}}; \ No newline at end of file +var _0x8ef6=['newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x129102,_0x3ac9c9){var _0x346551=function(_0x4040e5){while(--_0x4040e5){_0x129102['push'](_0x129102['shift']());}};_0x346551(++_0x3ac9c9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x143496,_0xce62b1){_0x143496=_0x143496-0x0;var _0x2fcc62=_0x8ef6[_0x143496];return _0x2fcc62;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')]},'description':{'type':Sequelize[_0x68ef('0x2')]},'username':{'type':Sequelize[_0x68ef('0x2')],'unique':_0x68ef('0x3')},'remoteUri':{'type':Sequelize[_0x68ef('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x68ef('0x2')]},'clientSecret':{'type':Sequelize[_0x68ef('0x2')]},'securityToken':{'type':Sequelize[_0x68ef('0x2')]},'serverUrl':{'type':Sequelize[_0x68ef('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x68ef('0x4')),'defaultValue':_0x68ef('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index af15e78..b650c01 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 _0x819b=['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~!@#$%^&-_=+[{]}.','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','params','options','create','body','find','findOne','SalesforceConfiguration','getConfigurations','nolimit','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','clientId','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','clientSecret','login','concat','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Type','isNil','Case','Origin','Reason','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','boolean','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test'];(function(_0x3e1db1,_0x2463db){var _0x1dd6ca=function(_0x58b848){while(--_0x58b848){_0x3e1db1['push'](_0x3e1db1['shift']());}};_0x1dd6ca(++_0x2463db);}(_0x819b,0x18d));var _0xb819=function(_0x57e090,_0x49d5e4){_0x57e090=_0x57e090-0x0;var _0x5136a7=_0x819b[_0x57e090];return _0x5136a7;};'use strict';var pdf=require(_0xb819('0x0'));var emlformat=require(_0xb819('0x1'));var rimraf=require(_0xb819('0x2'));var zipdir=require(_0xb819('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb819('0x4'));var moment=require('moment');var BPromise=require(_0xb819('0x5'));var Mustache=require('mustache');var util=require(_0xb819('0x6'));var path=require(_0xb819('0x7'));var sox=require(_0xb819('0x8'));var csv=require('to-csv');var ejs=require(_0xb819('0x9'));var fs=require('fs');var _=require(_0xb819('0xa'));var squel=require(_0xb819('0xb'));var crypto=require(_0xb819('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb819('0xd'));var toCsv=require(_0xb819('0xe'));var querystring=require(_0xb819('0xf'));var Papa=require(_0xb819('0x10'));var Redis=require('ioredis');var authService=require(_0xb819('0x11'));var qs=require(_0xb819('0x12'));var as=require(_0xb819('0x13'));var hardwareService=require(_0xb819('0x14'));var logger=require(_0xb819('0x15'))(_0xb819('0x16'));var utils=require(_0xb819('0x17'));var config=require('../../config/environment');var db=require(_0xb819('0x18'))['db'];var integrations=require(_0xb819('0x19'));var jayson=require(_0xb819('0x1a'));var client=jayson[_0xb819('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x2ceba2,_0x5ac377,_0x1c1654){if(_0x1c1654){var _0x3c6d85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c6d85[_0xb819('0x1c')](_0x5ac377)){return _0x2ceba2;}else{throw new db['Sequelize'][(_0xb819('0x1d'))](_0xb819('0x1e'));}}else{return _0x2ceba2;}}function respondWithRpcPromise(_0x55e29f,_0x689f81,_0x3b4d6f,_0x5b8c9b){return new BPromise(function(_0xcb171a,_0x5ceb00){var _0xfd14ef=_0x5b8c9b||client;return _0xfd14ef[_0xb819('0x1f')](_0x55e29f,_0x3b4d6f)['then'](function(_0x5efea2){logger[_0xb819('0x20')](_0xb819('0x21'),_0x689f81,_0xb819('0x22'));logger[_0xb819('0x23')](_0xb819('0x24'),_0x689f81,_0xb819('0x22'),JSON['stringify'](_0x5efea2));if(_0x5efea2[_0xb819('0x25')]){if(_0x5efea2[_0xb819('0x25')][_0xb819('0x26')]===0x1f4){logger[_0xb819('0x25')](_0xb819('0x21'),_0x689f81,_0x5efea2[_0xb819('0x25')]['message']);return _0x5ceb00(_0x5efea2[_0xb819('0x25')][_0xb819('0x27')]);}logger[_0xb819('0x25')](_0xb819('0x21'),_0x689f81,_0x5efea2[_0xb819('0x25')][_0xb819('0x27')]);return _0xcb171a(_0x5efea2[_0xb819('0x25')][_0xb819('0x27')]);}else{logger[_0xb819('0x20')](_0xb819('0x21'),_0x689f81,_0xb819('0x22'));_0xcb171a(_0x5efea2[_0xb819('0x28')][_0xb819('0x27')]);}})[_0xb819('0x29')](function(_0x1409f7){logger[_0xb819('0x25')](_0xb819('0x21'),_0x689f81,_0x1409f7);_0x5ceb00(_0x1409f7);});});}function respondWithStatusCode(_0x38b8c6,_0x539a88){_0x539a88=_0x539a88||0xcc;return function(_0x3537f3){if(_0x3537f3){return _0x38b8c6[_0xb819('0x2a')](_0x539a88);}return _0x38b8c6[_0xb819('0x2b')](_0x539a88)[_0xb819('0x2c')]();};}function respondWithResult(_0xa8f95e,_0x688bf){_0x688bf=_0x688bf||0xc8;return function(_0xc31978){if(_0xc31978){return _0xa8f95e[_0xb819('0x2b')](_0x688bf)[_0xb819('0x2d')](_0xc31978);}};}function respondWithFilteredResult(_0x453630,_0x360801){return function(_0x21a038){if(_0x21a038){var _0x5ce120=_0x21a038['count'],_0x3bb9aa=_0x360801[_0xb819('0x2e')],_0x72e250=_0x360801[_0xb819('0x2e')]+_0x360801['limit'],_0x518bf9;if(_0x72e250>=_0x5ce120){_0x72e250=_0x5ce120;_0x518bf9=0xc8;}else{_0x518bf9=0xce;}_0x453630['status'](_0x518bf9);return _0x453630[_0xb819('0x2f')](_0xb819('0x30'),_0x3bb9aa+'-'+_0x72e250+'/'+_0x5ce120)[_0xb819('0x2d')](_0x21a038);}return null;};}function patchUpdates(_0x4c64ee){return function(_0xe609ab){try{jsonpatch[_0xb819('0x31')](_0xe609ab,_0x4c64ee,!![]);}catch(_0x2c3742){return BPromise[_0xb819('0x32')](_0x2c3742);}return _0xe609ab['save']();};}function saveUpdates(_0x1c6324,_0x1ea4da){return function(_0x40a1a0){if(_0x40a1a0){return _0x40a1a0[_0xb819('0x33')](_0x1c6324)[_0xb819('0x34')](function(_0x456b9c){return _0x456b9c;});}return null;};}function removeEntity(_0xa4c563,_0x3fe66e){return function(_0x2058eb){if(_0x2058eb){return _0x2058eb[_0xb819('0x35')]()['then'](function(){_0xa4c563[_0xb819('0x2b')](0xcc)[_0xb819('0x2c')]();});}};}function handleEntityNotFound(_0x797a5c,_0x26b6f9){return function(_0x9f7a9b){if(!_0x9f7a9b){_0x797a5c[_0xb819('0x2a')](0x194);}return _0x9f7a9b;};}function handleError(_0x82e428,_0x47a0be){_0x47a0be=_0x47a0be||0x1f4;return function(_0x54b57e){logger[_0xb819('0x25')](_0x54b57e[_0xb819('0x36')]);if(_0x54b57e[_0xb819('0x37')]){delete _0x54b57e[_0xb819('0x37')];}_0x82e428[_0xb819('0x2b')](_0x47a0be)[_0xb819('0x38')](_0x54b57e);};}exports[_0xb819('0x39')]=function(_0x1939c4,_0x73ecf1){var _0x476afa={},_0x21f6c3={},_0x5e8896={'count':0x0,'rows':[]};var _0x3e624d=_[_0xb819('0x3a')](db[_0xb819('0x3b')][_0xb819('0x3c')],function(_0x114051){return{'name':_0x114051[_0xb819('0x3d')],'type':_0x114051[_0xb819('0x3e')][_0xb819('0x3f')]};});_0x21f6c3[_0xb819('0x40')]=_[_0xb819('0x3a')](_0x3e624d,'name');_0x21f6c3[_0xb819('0x41')]=_[_0xb819('0x42')](_0x1939c4[_0xb819('0x41')]);_0x21f6c3[_0xb819('0x43')]=_[_0xb819('0x44')](_0x21f6c3[_0xb819('0x40')],_0x21f6c3[_0xb819('0x41')]);_0x476afa[_0xb819('0x45')]=_[_0xb819('0x44')](_0x21f6c3[_0xb819('0x40')],qs[_0xb819('0x46')](_0x1939c4[_0xb819('0x41')][_0xb819('0x46')]));_0x476afa[_0xb819('0x45')]=_0x476afa['attributes'][_0xb819('0x47')]?_0x476afa[_0xb819('0x45')]:_0x21f6c3[_0xb819('0x40')];if(!_0x1939c4['query'][_0xb819('0x48')]('nolimit')){_0x476afa[_0xb819('0x49')]=qs[_0xb819('0x49')](_0x1939c4[_0xb819('0x41')][_0xb819('0x49')]);_0x476afa['offset']=qs[_0xb819('0x2e')](_0x1939c4['query'][_0xb819('0x2e')]);}_0x476afa[_0xb819('0x4a')]=qs[_0xb819('0x4b')](_0x1939c4[_0xb819('0x41')]['sort']);_0x476afa[_0xb819('0x4c')]=qs['filters'](_[_0xb819('0x4d')](_0x1939c4[_0xb819('0x41')],_0x21f6c3[_0xb819('0x43')]),_0x3e624d);if(_0x1939c4['query'][_0xb819('0x4e')]){_0x476afa[_0xb819('0x4c')]=_[_0xb819('0x4f')](_0x476afa[_0xb819('0x4c')],{'$or':_[_0xb819('0x3a')](_0x3e624d,function(_0x531f11){if(_0x531f11[_0xb819('0x3e')]!==_0xb819('0x50')){var _0xa96907={};_0xa96907[_0x531f11[_0xb819('0x37')]]={'$like':'%'+_0x1939c4['query'][_0xb819('0x4e')]+'%'};return _0xa96907;}})});}_0x476afa=_[_0xb819('0x4f')]({},_0x476afa,_0x1939c4['options']);var _0x2d0b19={'where':_0x476afa[_0xb819('0x4c')]};return db['SalesforceAccount'][_0xb819('0x51')](_0x2d0b19)[_0xb819('0x34')](function(_0x2ba50f){_0x5e8896[_0xb819('0x51')]=_0x2ba50f;if(_0x1939c4['query'][_0xb819('0x52')]){_0x476afa[_0xb819('0x53')]=[{'all':!![]}];}return db[_0xb819('0x3b')][_0xb819('0x54')](_0x476afa);})[_0xb819('0x34')](function(_0x58759a){_0x5e8896[_0xb819('0x55')]=_0x58759a;return _0x5e8896;})[_0xb819('0x34')](respondWithFilteredResult(_0x73ecf1,_0x476afa))[_0xb819('0x29')](handleError(_0x73ecf1,null));};exports['show']=function(_0xea8ea5,_0x41a0c3){var _0x44552d={'raw':![],'where':{'id':_0xea8ea5[_0xb819('0x56')]['id']}},_0x2fa095={};_0x2fa095['model']=_[_0xb819('0x42')](db[_0xb819('0x3b')][_0xb819('0x3c')]);_0x2fa095[_0xb819('0x41')]=_['keys'](_0xea8ea5['query']);_0x2fa095[_0xb819('0x43')]=_['intersection'](_0x2fa095[_0xb819('0x40')],_0x2fa095[_0xb819('0x41')]);_0x44552d[_0xb819('0x45')]=_['intersection'](_0x2fa095[_0xb819('0x40')],qs[_0xb819('0x46')](_0xea8ea5[_0xb819('0x41')]['fields']));_0x44552d[_0xb819('0x45')]=_0x44552d[_0xb819('0x45')]['length']?_0x44552d[_0xb819('0x45')]:_0x2fa095[_0xb819('0x40')];if(_0xea8ea5[_0xb819('0x41')]['includeAll']){_0x44552d[_0xb819('0x53')]=[{'all':!![]}];}_0x44552d=_[_0xb819('0x4f')]({},_0x44552d,_0xea8ea5[_0xb819('0x57')]);return db['SalesforceAccount']['find'](_0x44552d)[_0xb819('0x34')](handleEntityNotFound(_0x41a0c3,null))[_0xb819('0x34')](respondWithResult(_0x41a0c3,null))['catch'](handleError(_0x41a0c3,null));};exports[_0xb819('0x58')]=function(_0x1f49e4,_0x15d63f){return db[_0xb819('0x3b')][_0xb819('0x58')](_0x1f49e4[_0xb819('0x59')],{})[_0xb819('0x34')](respondWithResult(_0x15d63f,0xc9))[_0xb819('0x29')](handleError(_0x15d63f,null));};exports[_0xb819('0x33')]=function(_0x228afc,_0x1c8d62){if(_0x228afc['body']['id']){delete _0x228afc[_0xb819('0x59')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x228afc['params']['id']}})[_0xb819('0x34')](handleEntityNotFound(_0x1c8d62,null))[_0xb819('0x34')](saveUpdates(_0x228afc[_0xb819('0x59')],null))[_0xb819('0x34')](respondWithResult(_0x1c8d62,null))[_0xb819('0x29')](handleError(_0x1c8d62,null));};exports['destroy']=function(_0xd5cb1,_0x3a2249){return db['SalesforceAccount'][_0xb819('0x5a')]({'where':{'id':_0xd5cb1[_0xb819('0x56')]['id']}})[_0xb819('0x34')](handleEntityNotFound(_0x3a2249,null))[_0xb819('0x34')](removeEntity(_0x3a2249,null))[_0xb819('0x29')](handleError(_0x3a2249,null));};exports['getConfigurations']=function(_0x25a742,_0x2f7186,_0x452b4a){var _0x219bf9={};var _0x3773ae={};var _0x2c94b9;var _0x4209bb;return db[_0xb819('0x3b')][_0xb819('0x5b')]({'where':{'id':_0x25a742[_0xb819('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f7186,null))[_0xb819('0x34')](function(_0x115174){if(_0x115174){_0x2c94b9=_0x115174;_0x3773ae['model']=_['keys'](db[_0xb819('0x5c')][_0xb819('0x3c')]);_0x3773ae[_0xb819('0x41')]=_['keys'](_0x25a742['query']);_0x3773ae[_0xb819('0x43')]=_[_0xb819('0x44')](_0x3773ae['model'],_0x3773ae[_0xb819('0x41')]);_0x219bf9['attributes']=_['intersection'](_0x3773ae[_0xb819('0x40')],qs['fields'](_0x25a742[_0xb819('0x41')][_0xb819('0x46')]));_0x219bf9[_0xb819('0x45')]=_0x219bf9[_0xb819('0x45')][_0xb819('0x47')]?_0x219bf9[_0xb819('0x45')]:_0x3773ae[_0xb819('0x40')];_0x219bf9[_0xb819('0x4a')]=qs[_0xb819('0x4b')](_0x25a742['query'][_0xb819('0x4b')]);_0x219bf9[_0xb819('0x4c')]=qs[_0xb819('0x43')](_[_0xb819('0x4d')](_0x25a742[_0xb819('0x41')],_0x3773ae[_0xb819('0x43')]));if(_0x25a742[_0xb819('0x41')]['filter']){_0x219bf9[_0xb819('0x4c')]=_['merge'](_0x219bf9[_0xb819('0x4c')],{'$or':_['map'](_0x219bf9[_0xb819('0x45')],function(_0x5449e5){var _0x90f37a={};_0x90f37a[_0x5449e5]={'$like':'%'+_0x25a742[_0xb819('0x41')][_0xb819('0x4e')]+'%'};return _0x90f37a;})});}_0x219bf9=_[_0xb819('0x4f')]({},_0x219bf9,_0x25a742[_0xb819('0x57')]);return _0x2c94b9[_0xb819('0x5d')](_0x219bf9);}})[_0xb819('0x34')](function(_0x16c020){if(_0x16c020){_0x4209bb=_0x16c020['length'];if(!_0x25a742[_0xb819('0x41')][_0xb819('0x48')](_0xb819('0x5e'))){_0x219bf9['limit']=qs[_0xb819('0x49')](_0x25a742[_0xb819('0x41')][_0xb819('0x49')]);_0x219bf9['offset']=qs['offset'](_0x25a742[_0xb819('0x41')]['offset']);}return _0x2c94b9['getConfigurations'](_0x219bf9);}})['then'](function(_0x1a3da8){if(_0x1a3da8){return _0x1a3da8?{'count':_0x4209bb,'rows':_0x1a3da8}:null;}})[_0xb819('0x34')](respondWithResult(_0x2f7186,null))[_0xb819('0x29')](handleError(_0x2f7186,null));};exports['addConfiguration']=function(_0x1f2578,_0x45074b,_0xbf9b03){if(_0x1f2578[_0xb819('0x59')]['id']){delete _0x1f2578['body']['id'];}return db[_0xb819('0x3b')][_0xb819('0x5b')]({'where':{'id':_0x1f2578[_0xb819('0x56')]['id']}})[_0xb819('0x34')](handleEntityNotFound(_0x45074b,null))[_0xb819('0x34')](function(_0x57c3d4){if(_0x57c3d4){_0x1f2578[_0xb819('0x59')]['AccountId']=_0x57c3d4['id'];_0x1f2578[_0xb819('0x59')][_0xb819('0x5f')]=integrations[_0xb819('0x60')](_0x1f2578[_0xb819('0x59')][_0xb819('0x61')],_0x1f2578[_0xb819('0x59')]['type']);_0x1f2578[_0xb819('0x59')][_0xb819('0x62')]=integrations[_0xb819('0x63')](_0x1f2578['body'][_0xb819('0x61')],_0x1f2578[_0xb819('0x59')][_0xb819('0x3e')]);return db[_0xb819('0x5c')][_0xb819('0x58')](_0x1f2578[_0xb819('0x59')],{'include':[{'model':db[_0xb819('0x64')],'as':_0xb819('0x5f')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xb819('0x34')](respondWithResult(_0x45074b,null))['catch'](handleError(_0x45074b,null));};exports['getFields']=function(_0x1a98cb,_0x42ddf3,_0x136d1d){var _0x53fc90;var _0x5a49dd='';var _0x7eb2e1='Task';return db[_0xb819('0x3b')][_0xb819('0x5b')]({'where':{'id':_0x1a98cb[_0xb819('0x56')]['id']},'attributes':['id','remoteUri',_0xb819('0x65'),'clientSecret',_0xb819('0x66'),_0xb819('0x67'),_0xb819('0x68')]})['then'](handleEntityNotFound(_0x42ddf3,null))['then'](function(_0x2ab669){if(_0x2ab669){_0x5a49dd=_0x2ab669[_0xb819('0x69')];var _0x3b1a56=_0x5a49dd[_0xb819('0x6a')](-0x1);if(_0x3b1a56==='/'){_0x5a49dd=_0x5a49dd[_0xb819('0x6b')](0x0,_0x5a49dd[_0xb819('0x6c')](_0x3b1a56));}_0x53fc90=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5a49dd,'clientId':_0x2ab669[_0xb819('0x65')],'clientSecret':_0x2ab669[_0xb819('0x6d')]}});return _0x53fc90[_0xb819('0x6e')](_0x2ab669[_0xb819('0x66')],_0x2ab669[_0xb819('0x67')][_0xb819('0x6f')](_0x2ab669[_0xb819('0x68')]));}})[_0xb819('0x34')](function(_0x32f0eb){if(_0x32f0eb){if(!_['isNil'](_0x1a98cb[_0xb819('0x41')][_0xb819('0x70')])){_0x7eb2e1=_0x1a98cb[_0xb819('0x41')][_0xb819('0x70')];}return _0x53fc90[_0xb819('0x71')](_0x7eb2e1)[_0xb819('0x72')]();}})['then'](function(_0x26f037){var _0x4ea505=[_0xb819('0x73'),'CallDurationInSeconds',_0xb819('0x74'),_0xb819('0x75'),_0xb819('0x76'),_0xb819('0x77'),'Status',_0xb819('0x78')];if(!_[_0xb819('0x79')](_0x1a98cb[_0xb819('0x41')][_0xb819('0x70')])&&_0x1a98cb[_0xb819('0x41')][_0xb819('0x70')]===_0xb819('0x7a')){_0x4ea505=[_0xb819('0x78'),_0xb819('0x7b'),_0xb819('0x7c'),'Status',_0xb819('0x77'),_0xb819('0x7d'),_0xb819('0x7e'),_0xb819('0x7f')];}if(_0x26f037){_[_0xb819('0x80')](_0x26f037[_0xb819('0x46')],function(_0x3b1cb4){return _0x3b1cb4[_0xb819('0x81')]===![]&&!_0x4ea505[_0xb819('0x82')](_0x3b1cb4[_0xb819('0x37')]);});return{'count':_0x26f037[_0xb819('0x46')]['length'],'rows':_[_0xb819('0x3a')](_0x26f037[_0xb819('0x46')],function(_0x2887db){return{'id':_0x2887db[_0xb819('0x37')],'name':_0x2887db[_0xb819('0x83')],'custom':_0x2887db[_0xb819('0x81')],'options':_0x2887db[_0xb819('0x84')]['length']>0x0?_['map'](_0x2887db[_0xb819('0x84')],function(_0x230d76){return{'name':_0x230d76[_0xb819('0x83')],'value':_0x230d76[_0xb819('0x85')]};}):_0x2887db[_0xb819('0x3e')]==_0xb819('0x86')?[{'name':_0xb819('0x87'),'value':_0xb819('0x88')},{'name':_0xb819('0x89'),'value':'false'}]:[]};})};}})[_0xb819('0x34')](respondWithResult(_0x42ddf3,null))[_0xb819('0x29')](function(_0x289e04){var _0x303e51=_0x1a98cb[_0xb819('0x41')][_0xb819('0x1c')]?0x1f4:_0x289e04[_0xb819('0x8a')]||0x1f4;logger[_0xb819('0x25')](_0xb819('0x8b'),_0xb819('0x8c'),_0x303e51,JSON['stringify'](_0x289e04));delete _0x289e04[_0xb819('0x37')];if(_0x303e51===0x191){_0x303e51=0x190;}_0x42ddf3[_0xb819('0x2b')](_0x303e51)[_0xb819('0x38')](_0x1a98cb[_0xb819('0x41')]['test']?{'message':_0xb819('0x8d'),'statusCode':_0x289e04[_0xb819('0x8a')]}:_0x289e04);});}; \ No newline at end of file +var _0x66bb=['concat','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Origin','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','boolean','True','true','False','statusCode','getFields','test','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','hasOwnProperty','nolimit','limit','order','where','VIRTUAL','filter','includeAll','rows','params','fields','length','include','merge','find','create','body','findOne','SalesforceConfiguration','sort','pick','options','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x66bb,0x1b3));var _0xb66b=function(_0x5d07a8,_0x383775){_0x5d07a8=_0x5d07a8-0x0;var _0x37401c=_0x66bb[_0x5d07a8];return _0x37401c;};'use strict';var pdf=require(_0xb66b('0x0'));var emlformat=require(_0xb66b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb66b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb66b('0x3'));var moment=require(_0xb66b('0x4'));var BPromise=require(_0xb66b('0x5'));var Mustache=require(_0xb66b('0x6'));var util=require('util');var path=require(_0xb66b('0x7'));var sox=require(_0xb66b('0x8'));var csv=require(_0xb66b('0x9'));var ejs=require(_0xb66b('0xa'));var fs=require('fs');var _=require(_0xb66b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb66b('0xc'));var deskjs=require(_0xb66b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb66b('0xe'));var Papa=require(_0xb66b('0xf'));var Redis=require('ioredis');var authService=require(_0xb66b('0x10'));var qs=require(_0xb66b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb66b('0x12'));var logger=require(_0xb66b('0x13'))('api');var utils=require(_0xb66b('0x14'));var config=require(_0xb66b('0x15'));var db=require(_0xb66b('0x16'))['db'];var integrations=require(_0xb66b('0x17'));var jayson=require(_0xb66b('0x18'));var client=jayson[_0xb66b('0x19')][_0xb66b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5c40cc,_0x1e0828,_0x568dfb){if(_0x568dfb){var _0x3ff116=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ff116['test'](_0x1e0828)){return _0x5c40cc;}else{throw new db['Sequelize'][(_0xb66b('0x1b'))](_0xb66b('0x1c'));}}else{return _0x5c40cc;}}function respondWithRpcPromise(_0x2b7fec,_0x3ff9c2,_0x7c5da2,_0xfb50fc){return new BPromise(function(_0x46465f,_0x1fe3cc){var _0xbe71c4=_0xfb50fc||client;return _0xbe71c4['request'](_0x2b7fec,_0x7c5da2)[_0xb66b('0x1d')](function(_0x36238b){logger[_0xb66b('0x1e')](_0xb66b('0x1f'),_0x3ff9c2,'request\x20sent');logger[_0xb66b('0x20')](_0xb66b('0x21'),_0x3ff9c2,_0xb66b('0x22'),JSON[_0xb66b('0x23')](_0x36238b));if(_0x36238b[_0xb66b('0x24')]){if(_0x36238b[_0xb66b('0x24')][_0xb66b('0x25')]===0x1f4){logger[_0xb66b('0x24')](_0xb66b('0x1f'),_0x3ff9c2,_0x36238b['error']['message']);return _0x1fe3cc(_0x36238b['error'][_0xb66b('0x26')]);}logger[_0xb66b('0x24')](_0xb66b('0x1f'),_0x3ff9c2,_0x36238b[_0xb66b('0x24')][_0xb66b('0x26')]);return _0x46465f(_0x36238b[_0xb66b('0x24')][_0xb66b('0x26')]);}else{logger[_0xb66b('0x1e')](_0xb66b('0x1f'),_0x3ff9c2,_0xb66b('0x22'));_0x46465f(_0x36238b[_0xb66b('0x27')][_0xb66b('0x26')]);}})[_0xb66b('0x28')](function(_0x50d3c7){logger[_0xb66b('0x24')](_0xb66b('0x1f'),_0x3ff9c2,_0x50d3c7);_0x1fe3cc(_0x50d3c7);});});}function respondWithStatusCode(_0x27ea9d,_0x2b401b){_0x2b401b=_0x2b401b||0xcc;return function(_0x1463ed){if(_0x1463ed){return _0x27ea9d[_0xb66b('0x29')](_0x2b401b);}return _0x27ea9d[_0xb66b('0x2a')](_0x2b401b)['end']();};}function respondWithResult(_0x252eb6,_0x5af9da){_0x5af9da=_0x5af9da||0xc8;return function(_0x255e1d){if(_0x255e1d){return _0x252eb6['status'](_0x5af9da)['json'](_0x255e1d);}};}function respondWithFilteredResult(_0x5affed,_0x1c19cf){return function(_0x5f190a){if(_0x5f190a){var _0x4b3c27=_0x5f190a[_0xb66b('0x2b')],_0x120d26=_0x1c19cf[_0xb66b('0x2c')],_0x41b8de=_0x1c19cf[_0xb66b('0x2c')]+_0x1c19cf['limit'],_0xb69e21;if(_0x41b8de>=_0x4b3c27){_0x41b8de=_0x4b3c27;_0xb69e21=0xc8;}else{_0xb69e21=0xce;}_0x5affed[_0xb66b('0x2a')](_0xb69e21);return _0x5affed[_0xb66b('0x2d')](_0xb66b('0x2e'),_0x120d26+'-'+_0x41b8de+'/'+_0x4b3c27)['json'](_0x5f190a);}return null;};}function patchUpdates(_0xb6fb11){return function(_0x530803){try{jsonpatch[_0xb66b('0x2f')](_0x530803,_0xb6fb11,!![]);}catch(_0x2ed8dd){return BPromise[_0xb66b('0x30')](_0x2ed8dd);}return _0x530803['save']();};}function saveUpdates(_0x3b8c97,_0x3e524c){return function(_0x37bacc){if(_0x37bacc){return _0x37bacc[_0xb66b('0x31')](_0x3b8c97)[_0xb66b('0x1d')](function(_0x311b8c){return _0x311b8c;});}return null;};}function removeEntity(_0x4e940a,_0x4abeba){return function(_0x44de40){if(_0x44de40){return _0x44de40[_0xb66b('0x32')]()[_0xb66b('0x1d')](function(){_0x4e940a[_0xb66b('0x2a')](0xcc)[_0xb66b('0x33')]();});}};}function handleEntityNotFound(_0x2d57fd,_0x3df4ce){return function(_0xddf993){if(!_0xddf993){_0x2d57fd[_0xb66b('0x29')](0x194);}return _0xddf993;};}function handleError(_0x3136a8,_0x3b40ac){_0x3b40ac=_0x3b40ac||0x1f4;return function(_0x47d1a8){logger[_0xb66b('0x24')](_0x47d1a8[_0xb66b('0x34')]);if(_0x47d1a8[_0xb66b('0x35')]){delete _0x47d1a8[_0xb66b('0x35')];}_0x3136a8['status'](_0x3b40ac)[_0xb66b('0x36')](_0x47d1a8);};}exports[_0xb66b('0x37')]=function(_0x1c2e16,_0x4d4e02){var _0x6fb523={},_0x3dcdd1={},_0x40cac9={'count':0x0,'rows':[]};var _0x966cb5=_[_0xb66b('0x38')](db[_0xb66b('0x39')][_0xb66b('0x3a')],function(_0x3a7a0d){return{'name':_0x3a7a0d[_0xb66b('0x3b')],'type':_0x3a7a0d[_0xb66b('0x3c')][_0xb66b('0x3d')]};});_0x3dcdd1['model']=_['map'](_0x966cb5,'name');_0x3dcdd1['query']=_[_0xb66b('0x3e')](_0x1c2e16[_0xb66b('0x3f')]);_0x3dcdd1[_0xb66b('0x40')]=_[_0xb66b('0x41')](_0x3dcdd1['model'],_0x3dcdd1[_0xb66b('0x3f')]);_0x6fb523[_0xb66b('0x42')]=_[_0xb66b('0x41')](_0x3dcdd1[_0xb66b('0x43')],qs['fields'](_0x1c2e16['query']['fields']));_0x6fb523[_0xb66b('0x42')]=_0x6fb523[_0xb66b('0x42')]['length']?_0x6fb523[_0xb66b('0x42')]:_0x3dcdd1[_0xb66b('0x43')];if(!_0x1c2e16[_0xb66b('0x3f')][_0xb66b('0x44')](_0xb66b('0x45'))){_0x6fb523[_0xb66b('0x46')]=qs['limit'](_0x1c2e16[_0xb66b('0x3f')][_0xb66b('0x46')]);_0x6fb523['offset']=qs['offset'](_0x1c2e16[_0xb66b('0x3f')][_0xb66b('0x2c')]);}_0x6fb523[_0xb66b('0x47')]=qs['sort'](_0x1c2e16[_0xb66b('0x3f')]['sort']);_0x6fb523['where']=qs[_0xb66b('0x40')](_['pick'](_0x1c2e16[_0xb66b('0x3f')],_0x3dcdd1[_0xb66b('0x40')]),_0x966cb5);if(_0x1c2e16[_0xb66b('0x3f')]['filter']){_0x6fb523[_0xb66b('0x48')]=_['merge'](_0x6fb523['where'],{'$or':_[_0xb66b('0x38')](_0x966cb5,function(_0x4a72ee){if(_0x4a72ee[_0xb66b('0x3c')]!==_0xb66b('0x49')){var _0x49b86f={};_0x49b86f[_0x4a72ee[_0xb66b('0x35')]]={'$like':'%'+_0x1c2e16[_0xb66b('0x3f')][_0xb66b('0x4a')]+'%'};return _0x49b86f;}})});}_0x6fb523=_['merge']({},_0x6fb523,_0x1c2e16['options']);var _0x51c168={'where':_0x6fb523[_0xb66b('0x48')]};return db['SalesforceAccount'][_0xb66b('0x2b')](_0x51c168)[_0xb66b('0x1d')](function(_0x2c85cb){_0x40cac9[_0xb66b('0x2b')]=_0x2c85cb;if(_0x1c2e16['query'][_0xb66b('0x4b')]){_0x6fb523['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x6fb523);})[_0xb66b('0x1d')](function(_0xf13167){_0x40cac9[_0xb66b('0x4c')]=_0xf13167;return _0x40cac9;})['then'](respondWithFilteredResult(_0x4d4e02,_0x6fb523))[_0xb66b('0x28')](handleError(_0x4d4e02,null));};exports['show']=function(_0x58e165,_0x4ba694){var _0x6b362b={'raw':![],'where':{'id':_0x58e165[_0xb66b('0x4d')]['id']}},_0x32e6a2={};_0x32e6a2['model']=_[_0xb66b('0x3e')](db[_0xb66b('0x39')][_0xb66b('0x3a')]);_0x32e6a2[_0xb66b('0x3f')]=_['keys'](_0x58e165[_0xb66b('0x3f')]);_0x32e6a2[_0xb66b('0x40')]=_['intersection'](_0x32e6a2['model'],_0x32e6a2[_0xb66b('0x3f')]);_0x6b362b[_0xb66b('0x42')]=_[_0xb66b('0x41')](_0x32e6a2['model'],qs[_0xb66b('0x4e')](_0x58e165['query'][_0xb66b('0x4e')]));_0x6b362b[_0xb66b('0x42')]=_0x6b362b[_0xb66b('0x42')][_0xb66b('0x4f')]?_0x6b362b[_0xb66b('0x42')]:_0x32e6a2[_0xb66b('0x43')];if(_0x58e165[_0xb66b('0x3f')][_0xb66b('0x4b')]){_0x6b362b[_0xb66b('0x50')]=[{'all':!![]}];}_0x6b362b=_[_0xb66b('0x51')]({},_0x6b362b,_0x58e165['options']);return db['SalesforceAccount'][_0xb66b('0x52')](_0x6b362b)[_0xb66b('0x1d')](handleEntityNotFound(_0x4ba694,null))[_0xb66b('0x1d')](respondWithResult(_0x4ba694,null))[_0xb66b('0x28')](handleError(_0x4ba694,null));};exports[_0xb66b('0x53')]=function(_0x534ef5,_0x22b12d){return db[_0xb66b('0x39')][_0xb66b('0x53')](_0x534ef5['body'],{})['then'](respondWithResult(_0x22b12d,0xc9))[_0xb66b('0x28')](handleError(_0x22b12d,null));};exports[_0xb66b('0x31')]=function(_0x5d97ba,_0x1acf31){if(_0x5d97ba['body']['id']){delete _0x5d97ba[_0xb66b('0x54')]['id'];}return db[_0xb66b('0x39')][_0xb66b('0x52')]({'where':{'id':_0x5d97ba[_0xb66b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1acf31,null))[_0xb66b('0x1d')](saveUpdates(_0x5d97ba[_0xb66b('0x54')],null))[_0xb66b('0x1d')](respondWithResult(_0x1acf31,null))['catch'](handleError(_0x1acf31,null));};exports[_0xb66b('0x32')]=function(_0x382265,_0x43d1ea){return db[_0xb66b('0x39')][_0xb66b('0x52')]({'where':{'id':_0x382265[_0xb66b('0x4d')]['id']}})[_0xb66b('0x1d')](handleEntityNotFound(_0x43d1ea,null))[_0xb66b('0x1d')](removeEntity(_0x43d1ea,null))[_0xb66b('0x28')](handleError(_0x43d1ea,null));};exports['getConfigurations']=function(_0x8a695f,_0x33b41e,_0x5f1192){var _0x5c7091={};var _0x5e9fda={};var _0x4d343b;var _0x428177;return db[_0xb66b('0x39')][_0xb66b('0x55')]({'where':{'id':_0x8a695f[_0xb66b('0x4d')]['id']}})[_0xb66b('0x1d')](handleEntityNotFound(_0x33b41e,null))[_0xb66b('0x1d')](function(_0x540505){if(_0x540505){_0x4d343b=_0x540505;_0x5e9fda[_0xb66b('0x43')]=_[_0xb66b('0x3e')](db[_0xb66b('0x56')]['rawAttributes']);_0x5e9fda[_0xb66b('0x3f')]=_[_0xb66b('0x3e')](_0x8a695f[_0xb66b('0x3f')]);_0x5e9fda[_0xb66b('0x40')]=_[_0xb66b('0x41')](_0x5e9fda['model'],_0x5e9fda[_0xb66b('0x3f')]);_0x5c7091[_0xb66b('0x42')]=_[_0xb66b('0x41')](_0x5e9fda[_0xb66b('0x43')],qs[_0xb66b('0x4e')](_0x8a695f[_0xb66b('0x3f')]['fields']));_0x5c7091[_0xb66b('0x42')]=_0x5c7091[_0xb66b('0x42')][_0xb66b('0x4f')]?_0x5c7091[_0xb66b('0x42')]:_0x5e9fda[_0xb66b('0x43')];_0x5c7091[_0xb66b('0x47')]=qs['sort'](_0x8a695f[_0xb66b('0x3f')][_0xb66b('0x57')]);_0x5c7091[_0xb66b('0x48')]=qs[_0xb66b('0x40')](_[_0xb66b('0x58')](_0x8a695f['query'],_0x5e9fda[_0xb66b('0x40')]));if(_0x8a695f[_0xb66b('0x3f')]['filter']){_0x5c7091[_0xb66b('0x48')]=_[_0xb66b('0x51')](_0x5c7091[_0xb66b('0x48')],{'$or':_[_0xb66b('0x38')](_0x5c7091[_0xb66b('0x42')],function(_0x24b2c7){var _0x56ab05={};_0x56ab05[_0x24b2c7]={'$like':'%'+_0x8a695f[_0xb66b('0x3f')][_0xb66b('0x4a')]+'%'};return _0x56ab05;})});}_0x5c7091=_['merge']({},_0x5c7091,_0x8a695f[_0xb66b('0x59')]);return _0x4d343b['getConfigurations'](_0x5c7091);}})[_0xb66b('0x1d')](function(_0x5da1eb){if(_0x5da1eb){_0x428177=_0x5da1eb[_0xb66b('0x4f')];if(!_0x8a695f['query'][_0xb66b('0x44')](_0xb66b('0x45'))){_0x5c7091[_0xb66b('0x46')]=qs[_0xb66b('0x46')](_0x8a695f[_0xb66b('0x3f')][_0xb66b('0x46')]);_0x5c7091[_0xb66b('0x2c')]=qs[_0xb66b('0x2c')](_0x8a695f[_0xb66b('0x3f')][_0xb66b('0x2c')]);}return _0x4d343b['getConfigurations'](_0x5c7091);}})['then'](function(_0x513fa5){if(_0x513fa5){return _0x513fa5?{'count':_0x428177,'rows':_0x513fa5}:null;}})['then'](respondWithResult(_0x33b41e,null))[_0xb66b('0x28')](handleError(_0x33b41e,null));};exports['addConfiguration']=function(_0x243217,_0x4ded5d,_0x48d26a){if(_0x243217['body']['id']){delete _0x243217[_0xb66b('0x54')]['id'];}return db[_0xb66b('0x39')][_0xb66b('0x55')]({'where':{'id':_0x243217[_0xb66b('0x4d')]['id']}})[_0xb66b('0x1d')](handleEntityNotFound(_0x4ded5d,null))[_0xb66b('0x1d')](function(_0x1deff9){if(_0x1deff9){_0x243217[_0xb66b('0x54')][_0xb66b('0x5a')]=_0x1deff9['id'];_0x243217[_0xb66b('0x54')][_0xb66b('0x5b')]=integrations[_0xb66b('0x5c')](_0x243217[_0xb66b('0x54')][_0xb66b('0x5d')],_0x243217[_0xb66b('0x54')][_0xb66b('0x3c')]);_0x243217['body'][_0xb66b('0x5e')]=integrations['getDescriptions'](_0x243217[_0xb66b('0x54')][_0xb66b('0x5d')],_0x243217['body'][_0xb66b('0x3c')]);return db[_0xb66b('0x56')]['create'](_0x243217[_0xb66b('0x54')],{'include':[{'model':db[_0xb66b('0x5f')],'as':'Subjects'},{'model':db[_0xb66b('0x5f')],'as':'Descriptions'}]});}return null;})[_0xb66b('0x1d')](respondWithResult(_0x4ded5d,null))[_0xb66b('0x28')](handleError(_0x4ded5d,null));};exports['getFields']=function(_0x154d3c,_0x261606,_0x57f3a0){var _0x2178aa;var _0x2155b3='';var _0x16481b='Task';return db[_0xb66b('0x39')]['findOne']({'where':{'id':_0x154d3c[_0xb66b('0x4d')]['id']},'attributes':['id','remoteUri',_0xb66b('0x60'),_0xb66b('0x61'),'username',_0xb66b('0x62'),_0xb66b('0x63')]})[_0xb66b('0x1d')](handleEntityNotFound(_0x261606,null))[_0xb66b('0x1d')](function(_0x5399f3){if(_0x5399f3){_0x2155b3=_0x5399f3['remoteUri'];var _0x3bf508=_0x2155b3[_0xb66b('0x64')](-0x1);if(_0x3bf508==='/'){_0x2155b3=_0x2155b3[_0xb66b('0x65')](0x0,_0x2155b3[_0xb66b('0x66')](_0x3bf508));}_0x2178aa=new jsforce[(_0xb66b('0x67'))]({'oauth2':{'loginUrl':_0x2155b3,'clientId':_0x5399f3[_0xb66b('0x60')],'clientSecret':_0x5399f3[_0xb66b('0x61')]}});return _0x2178aa[_0xb66b('0x68')](_0x5399f3['username'],_0x5399f3[_0xb66b('0x62')][_0xb66b('0x69')](_0x5399f3[_0xb66b('0x63')]));}})[_0xb66b('0x1d')](function(_0x2e4d38){if(_0x2e4d38){if(!_[_0xb66b('0x6a')](_0x154d3c[_0xb66b('0x3f')][_0xb66b('0x6b')])){_0x16481b=_0x154d3c[_0xb66b('0x3f')][_0xb66b('0x6b')];}return _0x2178aa[_0xb66b('0x6c')](_0x16481b)['describe']();}})[_0xb66b('0x1d')](function(_0x129c05){var _0x2fac78=[_0xb66b('0x6d'),_0xb66b('0x6e'),_0xb66b('0x6f'),_0xb66b('0x70'),_0xb66b('0x71'),_0xb66b('0x72'),_0xb66b('0x73'),_0xb66b('0x74')];if(!_[_0xb66b('0x6a')](_0x154d3c[_0xb66b('0x3f')][_0xb66b('0x6b')])&&_0x154d3c['query']['ticketType']===_0xb66b('0x75')){_0x2fac78=[_0xb66b('0x74'),_0xb66b('0x76'),'Reason',_0xb66b('0x73'),'Priority',_0xb66b('0x77'),_0xb66b('0x78'),_0xb66b('0x79')];}if(_0x129c05){_[_0xb66b('0x7a')](_0x129c05[_0xb66b('0x4e')],function(_0xa4561){return _0xa4561[_0xb66b('0x7b')]===![]&&!_0x2fac78[_0xb66b('0x7c')](_0xa4561['name']);});return{'count':_0x129c05[_0xb66b('0x4e')][_0xb66b('0x4f')],'rows':_[_0xb66b('0x38')](_0x129c05['fields'],function(_0x139371){return{'id':_0x139371[_0xb66b('0x35')],'name':_0x139371[_0xb66b('0x7d')],'custom':_0x139371[_0xb66b('0x7b')],'options':_0x139371[_0xb66b('0x7e')][_0xb66b('0x4f')]>0x0?_[_0xb66b('0x38')](_0x139371[_0xb66b('0x7e')],function(_0x338ed0){return{'name':_0x338ed0[_0xb66b('0x7d')],'value':_0x338ed0['value']};}):_0x139371['type']==_0xb66b('0x7f')?[{'name':_0xb66b('0x80'),'value':_0xb66b('0x81')},{'name':_0xb66b('0x82'),'value':'false'}]:[]};})};}})[_0xb66b('0x1d')](respondWithResult(_0x261606,null))[_0xb66b('0x28')](function(_0x5b94a9){var _0x46072b=_0x154d3c[_0xb66b('0x3f')]['test']?0x1f4:_0x5b94a9[_0xb66b('0x83')]||0x1f4;logger[_0xb66b('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xb66b('0x84'),_0x46072b,JSON[_0xb66b('0x23')](_0x5b94a9));delete _0x5b94a9[_0xb66b('0x35')];if(_0x46072b===0x191){_0x46072b=0x190;}_0x261606[_0xb66b('0x2a')](_0x46072b)['send'](_0x154d3c[_0xb66b('0x3f')][_0xb66b('0x85')]?{'message':_0xb66b('0x86'),'statusCode':_0x5b94a9[_0xb66b('0x83')]}:_0x5b94a9);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5b1bb5c..a21aac0 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 _0x12e2=['rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4595bb,_0x4240cb){var _0x2bf381=function(_0x857023){while(--_0x857023){_0x4595bb['push'](_0x4595bb['shift']());}};_0x2bf381(++_0x4240cb);}(_0x12e2,0x11a));var _0x212e=function(_0x37d3a0,_0x3a1d6c){_0x37d3a0=_0x37d3a0-0x0;var _0x1bf3ea=_0x12e2[_0x37d3a0];return _0x1bf3ea;};'use strict';var _=require(_0x212e('0x0'));var util=require('util');var logger=require(_0x212e('0x1'))(_0x212e('0x2'));var moment=require('moment');var BPromise=require(_0x212e('0x3'));var rp=require(_0x212e('0x4'));var fs=require('fs');var path=require(_0x212e('0x5'));var rimraf=require(_0x212e('0x6'));var config=require('../../config/environment');var attributes=require(_0x212e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x212e('0x8')]=function(_0x6c8a60,_0x36b7a9){return _0x6c8a60[_0x212e('0x9')](_0x212e('0xa'),attributes,{'tableName':_0x212e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4472=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x290ca8,_0x55b865){var _0x46ceec=function(_0x4b62b4){while(--_0x4b62b4){_0x290ca8['push'](_0x290ca8['shift']());}};_0x46ceec(++_0x55b865);}(_0x4472,0x1d4));var _0x2447=function(_0x423fe1,_0x465670){_0x423fe1=_0x423fe1-0x0;var _0x110932=_0x4472[_0x423fe1];return _0x110932;};'use strict';var _=require(_0x2447('0x0'));var util=require(_0x2447('0x1'));var logger=require(_0x2447('0x2'))(_0x2447('0x3'));var moment=require('moment');var BPromise=require(_0x2447('0x4'));var rp=require(_0x2447('0x5'));var fs=require('fs');var path=require(_0x2447('0x6'));var rimraf=require(_0x2447('0x7'));var config=require(_0x2447('0x8'));var attributes=require(_0x2447('0x9'));var integrations=require(_0x2447('0xa'));module[_0x2447('0xb')]=function(_0x3902de,_0x3369cd){return _0x3902de[_0x2447('0xc')](_0x2447('0xd'),attributes,{'tableName':_0x2447('0xe'),'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 042756d..17108f5 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 _0x153f=['GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4eca68,_0x3d9c52){var _0x5cfa94=function(_0xc6a5a2){while(--_0xc6a5a2){_0x4eca68['push'](_0x4eca68['shift']());}};_0x5cfa94(++_0x3d9c52);}(_0x153f,0x15b));var _0xf153=function(_0x211a6d,_0x3c3309){_0x211a6d=_0x211a6d-0x0;var _0x1e591d=_0x153f[_0x211a6d];return _0x1e591d;};'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')]('SalesforceAccount,\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);});});}exports[_0xf153('0x17')]=function(_0x138dbe){var _0x44272e=this;return new Promise(function(_0x4e790d,_0x357d57){return db[_0xf153('0x18')][_0xf153('0x19')]({'raw':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1b')]===undefined?!![]:![]:!![],'where':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1c')]||null:null,'attributes':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1d')]||null:null,'limit':_0x138dbe['options']?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1e')]||null:null,'include':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1f')]?_[_0xf153('0x20')](_0x138dbe[_0xf153('0x1a')][_0xf153('0x1f')],function(_0xf67cde){return{'model':db[_0xf67cde[_0xf153('0x21')]],'as':_0xf67cde['as'],'attributes':_0xf67cde[_0xf153('0x1d')],'include':_0xf67cde[_0xf153('0x1f')]?_[_0xf153('0x20')](_0xf67cde[_0xf153('0x1f')],function(_0xe490f8){return{'model':db[_0xe490f8[_0xf153('0x21')]],'as':_0xe490f8['as'],'attributes':_0xe490f8[_0xf153('0x1d')],'include':_0xe490f8[_0xf153('0x1f')]?_[_0xf153('0x20')](_0xe490f8[_0xf153('0x1f')],function(_0x48ebdc){return{'model':db[_0x48ebdc[_0xf153('0x21')]],'as':_0x48ebdc['as'],'attributes':_0x48ebdc[_0xf153('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16cdcd){logger[_0xf153('0xe')]('GetSalesforceAccount',_0x138dbe);logger[_0xf153('0x11')](_0xf153('0x17'),_0x138dbe,JSON[_0xf153('0x12')](_0x16cdcd));_0x4e790d(_0x16cdcd);})[_0xf153('0x22')](function(_0x339e96){logger[_0xf153('0x13')](_0xf153('0x17'),_0x339e96[_0xf153('0x15')],_0x138dbe);_0x357d57(_0x44272e[_0xf153('0x13')](0x1f4,_0x339e96[_0xf153('0x15')]));});});};exports[_0xf153('0x23')]=function(_0x415a5f){var _0x5b5237=this;return new Promise(function(_0x258fb0,_0xbb3619){return db[_0xf153('0x18')][_0xf153('0x24')]({'raw':_0x415a5f['options']?_0x415a5f['options'][_0xf153('0x1b')]===undefined?!![]:![]:!![],'where':_0x415a5f['options']?_0x415a5f['options'][_0xf153('0x1c')]||null:null,'attributes':_0x415a5f['options']?_0x415a5f[_0xf153('0x1a')]['attributes']||null:null,'include':_0x415a5f[_0xf153('0x1a')]?_0x415a5f[_0xf153('0x1a')]['include']?_[_0xf153('0x20')](_0x415a5f[_0xf153('0x1a')][_0xf153('0x1f')],function(_0x40be52){return{'model':db[_0x40be52[_0xf153('0x21')]],'as':_0x40be52['as'],'attributes':_0x40be52[_0xf153('0x1d')],'include':_0x40be52['include']?_[_0xf153('0x20')](_0x40be52['include'],function(_0x40834b){return{'model':db[_0x40834b[_0xf153('0x21')]],'as':_0x40834b['as'],'attributes':_0x40834b[_0xf153('0x1d')],'include':_0x40834b[_0xf153('0x1f')]?_[_0xf153('0x20')](_0x40834b[_0xf153('0x1f')],function(_0x4becf3){return{'model':db[_0x4becf3[_0xf153('0x21')]],'as':_0x4becf3['as'],'attributes':_0x4becf3[_0xf153('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf153('0xd')](function(_0x4e0634){logger[_0xf153('0xe')](_0xf153('0x23'),_0x415a5f);logger[_0xf153('0x11')](_0xf153('0x23'),_0x415a5f,JSON[_0xf153('0x12')](_0x4e0634));_0x258fb0(_0x4e0634);})[_0xf153('0x22')](function(_0x4cc481){logger[_0xf153('0x13')](_0xf153('0x23'),_0x4cc481['message'],_0x415a5f);_0xbb3619(_0x5b5237[_0xf153('0x13')](0x1f4,_0x4cc481[_0xf153('0x15')]));});});}; \ No newline at end of file +var _0xf3cd=['find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','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'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x15fc07,_0x41cc0c){_0x15fc07=_0x15fc07-0x0;var _0x3d2c0f=_0xf3cd[_0x15fc07];return _0x3d2c0f;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});}exports[_0xdf3c('0x17')]=function(_0x465e7d){var _0xf1da1f=this;return new Promise(function(_0x18d4ec,_0x1e2690){return db[_0xdf3c('0x18')][_0xdf3c('0x19')]({'raw':_0x465e7d[_0xdf3c('0x1a')]?_0x465e7d[_0xdf3c('0x1a')][_0xdf3c('0x1b')]===undefined?!![]:![]:!![],'where':_0x465e7d[_0xdf3c('0x1a')]?_0x465e7d[_0xdf3c('0x1a')][_0xdf3c('0x1c')]||null:null,'attributes':_0x465e7d['options']?_0x465e7d['options'][_0xdf3c('0x1d')]||null:null,'limit':_0x465e7d['options']?_0x465e7d[_0xdf3c('0x1a')][_0xdf3c('0x1e')]||null:null,'include':_0x465e7d[_0xdf3c('0x1a')]?_0x465e7d[_0xdf3c('0x1a')][_0xdf3c('0x1f')]?_[_0xdf3c('0x20')](_0x465e7d['options'][_0xdf3c('0x1f')],function(_0x213d75){return{'model':db[_0x213d75[_0xdf3c('0x21')]],'as':_0x213d75['as'],'attributes':_0x213d75[_0xdf3c('0x1d')],'include':_0x213d75[_0xdf3c('0x1f')]?_[_0xdf3c('0x20')](_0x213d75[_0xdf3c('0x1f')],function(_0x155f54){return{'model':db[_0x155f54[_0xdf3c('0x21')]],'as':_0x155f54['as'],'attributes':_0x155f54[_0xdf3c('0x1d')],'include':_0x155f54['include']?_[_0xdf3c('0x20')](_0x155f54[_0xdf3c('0x1f')],function(_0x4b57a4){return{'model':db[_0x4b57a4[_0xdf3c('0x21')]],'as':_0x4b57a4['as'],'attributes':_0x4b57a4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x508be9){logger[_0xdf3c('0xc')](_0xdf3c('0x17'),_0x465e7d);logger['debug']('GetSalesforceAccount',_0x465e7d,JSON[_0xdf3c('0x10')](_0x508be9));_0x18d4ec(_0x508be9);})[_0xdf3c('0x16')](function(_0xd3cfcb){logger[_0xdf3c('0x11')]('GetSalesforceAccount',_0xd3cfcb[_0xdf3c('0x14')],_0x465e7d);_0x1e2690(_0xf1da1f[_0xdf3c('0x11')](0x1f4,_0xd3cfcb['message']));});});};exports['ShowSalesforceAccount']=function(_0x1f1d8a){var _0x46f0e3=this;return new Promise(function(_0x36937e,_0x540f3a){return db[_0xdf3c('0x18')][_0xdf3c('0x22')]({'raw':_0x1f1d8a[_0xdf3c('0x1a')]?_0x1f1d8a[_0xdf3c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1f1d8a[_0xdf3c('0x1a')]?_0x1f1d8a[_0xdf3c('0x1a')]['where']||null:null,'attributes':_0x1f1d8a[_0xdf3c('0x1a')]?_0x1f1d8a[_0xdf3c('0x1a')][_0xdf3c('0x1d')]||null:null,'include':_0x1f1d8a[_0xdf3c('0x1a')]?_0x1f1d8a['options'][_0xdf3c('0x1f')]?_[_0xdf3c('0x20')](_0x1f1d8a[_0xdf3c('0x1a')][_0xdf3c('0x1f')],function(_0x4c1f49){return{'model':db[_0x4c1f49[_0xdf3c('0x21')]],'as':_0x4c1f49['as'],'attributes':_0x4c1f49[_0xdf3c('0x1d')],'include':_0x4c1f49['include']?_['map'](_0x4c1f49[_0xdf3c('0x1f')],function(_0x588d02){return{'model':db[_0x588d02[_0xdf3c('0x21')]],'as':_0x588d02['as'],'attributes':_0x588d02['attributes'],'include':_0x588d02['include']?_['map'](_0x588d02[_0xdf3c('0x1f')],function(_0x2ee9ad){return{'model':db[_0x2ee9ad[_0xdf3c('0x21')]],'as':_0x2ee9ad['as'],'attributes':_0x2ee9ad[_0xdf3c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49f147){logger[_0xdf3c('0xc')]('ShowSalesforceAccount',_0x1f1d8a);logger[_0xdf3c('0xe')](_0xdf3c('0x23'),_0x1f1d8a,JSON[_0xdf3c('0x10')](_0x49f147));_0x36937e(_0x49f147);})[_0xdf3c('0x16')](function(_0x1004e9){logger[_0xdf3c('0x11')](_0xdf3c('0x23'),_0x1004e9[_0xdf3c('0x14')],_0x1f1d8a);_0x540f3a(_0x46f0e3[_0xdf3c('0x11')](0x1f4,_0x1004e9['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9227ca9..6fc413d 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 _0x256b=['get','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated'];(function(_0x1e092,_0x1c2b52){var _0x1b0fa5=function(_0x123408){while(--_0x123408){_0x1e092['push'](_0x1e092['shift']());}};_0x1b0fa5(++_0x1c2b52);}(_0x256b,0x15f));var _0xb256=function(_0x1d3fdc,_0x2b5c54){_0x1d3fdc=_0x1d3fdc-0x0;var _0x128bb0=_0x256b[_0x1d3fdc];return _0x128bb0;};'use strict';var multer=require(_0xb256('0x0'));var util=require(_0xb256('0x1'));var path=require(_0xb256('0x2'));var timeout=require(_0xb256('0x3'));var express=require(_0xb256('0x4'));var router=express[_0xb256('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb256('0x6'));var controller=require(_0xb256('0x7'));router['get']('/',auth[_0xb256('0x8')](),controller['index']);router[_0xb256('0x9')](_0xb256('0xa'),auth[_0xb256('0x8')](),controller[_0xb256('0xb')]);router[_0xb256('0x9')]('/:id/fields',auth[_0xb256('0x8')](),controller[_0xb256('0xc')]);router[_0xb256('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xb256('0xd')]);router[_0xb256('0x9')](_0xb256('0xe'),auth['isAuthenticated'](),controller[_0xb256('0xf')]);router['post']('/',auth[_0xb256('0x8')](),controller['create']);router['put'](_0xb256('0xa'),auth[_0xb256('0x8')](),controller[_0xb256('0x10')]);router['delete'](_0xb256('0xa'),auth[_0xb256('0x8')](),controller[_0xb256('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3d0f=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy'];(function(_0x8ce839,_0x3f538c){var _0x480b3f=function(_0x1f7cb1){while(--_0x1f7cb1){_0x8ce839['push'](_0x8ce839['shift']());}};_0x480b3f(++_0x3f538c);}(_0x3d0f,0x176));var _0xf3d0=function(_0x4cb095,_0x58da07){_0x4cb095=_0x4cb095-0x0;var _0x2b565d=_0x3d0f[_0x4cb095];return _0x2b565d;};'use strict';var multer=require(_0xf3d0('0x0'));var util=require(_0xf3d0('0x1'));var path=require(_0xf3d0('0x2'));var timeout=require(_0xf3d0('0x3'));var express=require(_0xf3d0('0x4'));var router=express['Router']();var auth=require(_0xf3d0('0x5'));var interaction=require(_0xf3d0('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceConfiguration.controller');router[_0xf3d0('0x7')]('/',auth[_0xf3d0('0x8')](),controller[_0xf3d0('0x9')]);router[_0xf3d0('0x7')](_0xf3d0('0xa'),auth[_0xf3d0('0x8')](),controller['show']);router[_0xf3d0('0x7')](_0xf3d0('0xb'),auth[_0xf3d0('0x8')](),controller[_0xf3d0('0xc')]);router['get'](_0xf3d0('0xd'),auth['isAuthenticated'](),controller[_0xf3d0('0xe')]);router['get'](_0xf3d0('0xf'),auth[_0xf3d0('0x8')](),controller[_0xf3d0('0x10')]);router['post']('/',auth[_0xf3d0('0x8')](),controller[_0xf3d0('0x11')]);router[_0xf3d0('0x12')](_0xf3d0('0xa'),auth[_0xf3d0('0x8')](),controller[_0xf3d0('0x13')]);router[_0xf3d0('0x14')]('/:id',auth[_0xf3d0('0x8')](),controller[_0xf3d0('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3ad8e18..5f36ff7 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 _0x6731=['contact','lead','contact_lead','nothing','sequelize','exports','STRING','Case','ENUM'];(function(_0x11e0bd,_0x563305){var _0x55edcb=function(_0x43fc44){while(--_0x43fc44){_0x11e0bd['push'](_0x11e0bd['shift']());}};_0x55edcb(++_0x563305);}(_0x6731,0x1f3));var _0x1673=function(_0x2052cc,_0x4f76dc){_0x2052cc=_0x2052cc-0x0;var _0x58609f=_0x6731[_0x2052cc];return _0x58609f;};'use strict';var Sequelize=require(_0x1673('0x0'));module[_0x1673('0x1')]={'name':{'type':Sequelize[_0x1673('0x2')]},'description':{'type':Sequelize[_0x1673('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x1673('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x1673('0x4')]('contact_lead',_0x1673('0x5'),_0x1673('0x6')),'defaultValue':_0x1673('0x7')},'moduleCreate':{'type':Sequelize[_0x1673('0x4')](_0x1673('0x8'),_0x1673('0x5'),_0x1673('0x6')),'defaultValue':'lead'}}; \ No newline at end of file +var _0x4aee=['lead','contact_lead','sequelize','exports','STRING','ENUM','Task','Case','contact'];(function(_0x24f604,_0x37a202){var _0x4d3fb7=function(_0x254bfd){while(--_0x254bfd){_0x24f604['push'](_0x24f604['shift']());}};_0x4d3fb7(++_0x37a202);}(_0x4aee,0x1b2));var _0xe4ae=function(_0x201102,_0x21ec2f){_0x201102=_0x201102-0x0;var _0x4bead1=_0x4aee[_0x201102];return _0x4bead1;};'use strict';var Sequelize=require(_0xe4ae('0x0'));module[_0xe4ae('0x1')]={'name':{'type':Sequelize[_0xe4ae('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xe4ae('0x3')](_0xe4ae('0x4'),_0xe4ae('0x5')),'defaultValue':_0xe4ae('0x4')},'moduleSearch':{'type':Sequelize[_0xe4ae('0x3')]('contact_lead',_0xe4ae('0x6'),_0xe4ae('0x7')),'defaultValue':_0xe4ae('0x8')},'moduleCreate':{'type':Sequelize['ENUM']('nothing','contact','lead'),'defaultValue':_0xe4ae('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index c5631d9..4feef76 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 _0x6d66=['test','Sequelize','ValidationError','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','SalesforceConfiguration','findAll','rows','show','params','includeAll','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x36f36b,_0x1f4cb3){var _0x2b3d4c=function(_0x6feda2){while(--_0x6feda2){_0x36f36b['push'](_0x36f36b['shift']());}};_0x2b3d4c(++_0x1f4cb3);}(_0x6d66,0x9c));var _0x66d6=function(_0x13b37c,_0x4f616b){_0x13b37c=_0x13b37c-0x0;var _0x2d13fa=_0x6d66[_0x13b37c];return _0x2d13fa;};'use strict';var pdf=require(_0x66d6('0x0'));var emlformat=require(_0x66d6('0x1'));var rimraf=require(_0x66d6('0x2'));var zipdir=require(_0x66d6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66d6('0x4'));var moment=require('moment');var BPromise=require(_0x66d6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x66d6('0x6'));var sox=require(_0x66d6('0x7'));var csv=require(_0x66d6('0x8'));var ejs=require(_0x66d6('0x9'));var fs=require('fs');var _=require(_0x66d6('0xa'));var squel=require(_0x66d6('0xb'));var crypto=require(_0x66d6('0xc'));var jsforce=require(_0x66d6('0xd'));var deskjs=require(_0x66d6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x66d6('0xf'));var Redis=require(_0x66d6('0x10'));var authService=require(_0x66d6('0x11'));var qs=require(_0x66d6('0x12'));var as=require(_0x66d6('0x13'));var hardwareService=require(_0x66d6('0x14'));var logger=require(_0x66d6('0x15'))(_0x66d6('0x16'));var utils=require(_0x66d6('0x17'));var config=require(_0x66d6('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x66d6('0x19'));var client=jayson[_0x66d6('0x1a')][_0x66d6('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x89dff5,_0x278ea1,_0x58421e){if(_0x58421e){var _0x1e4503=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4503[_0x66d6('0x1c')](_0x278ea1)){return _0x89dff5;}else{throw new db[(_0x66d6('0x1d'))][(_0x66d6('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x89dff5;}}function respondWithRpcPromise(_0x3be1f0,_0x156323,_0x3da88b,_0x4dab78){return new BPromise(function(_0x36e04b,_0x15891b){var _0x2654f0=_0x4dab78||client;return _0x2654f0['request'](_0x3be1f0,_0x3da88b)[_0x66d6('0x1f')](function(_0x238f3){logger[_0x66d6('0x20')](_0x66d6('0x21'),_0x156323,'request\x20sent');logger[_0x66d6('0x22')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x156323,_0x66d6('0x23'),JSON['stringify'](_0x238f3));if(_0x238f3[_0x66d6('0x24')]){if(_0x238f3[_0x66d6('0x24')][_0x66d6('0x25')]===0x1f4){logger['error'](_0x66d6('0x21'),_0x156323,_0x238f3[_0x66d6('0x24')][_0x66d6('0x26')]);return _0x15891b(_0x238f3[_0x66d6('0x24')][_0x66d6('0x26')]);}logger[_0x66d6('0x24')]('SalesforceConfiguration,\x20%s,\x20%s',_0x156323,_0x238f3[_0x66d6('0x24')]['message']);return _0x36e04b(_0x238f3[_0x66d6('0x24')]['message']);}else{logger[_0x66d6('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x156323,_0x66d6('0x23'));_0x36e04b(_0x238f3[_0x66d6('0x27')][_0x66d6('0x26')]);}})[_0x66d6('0x28')](function(_0x307119){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x156323,_0x307119);_0x15891b(_0x307119);});});}function respondWithStatusCode(_0xe2d330,_0x41b4cd){_0x41b4cd=_0x41b4cd||0xcc;return function(_0x175386){if(_0x175386){return _0xe2d330[_0x66d6('0x29')](_0x41b4cd);}return _0xe2d330[_0x66d6('0x2a')](_0x41b4cd)[_0x66d6('0x2b')]();};}function respondWithResult(_0x39dc40,_0x487338){_0x487338=_0x487338||0xc8;return function(_0x100f13){if(_0x100f13){return _0x39dc40[_0x66d6('0x2a')](_0x487338)['json'](_0x100f13);}};}function respondWithFilteredResult(_0x325e6e,_0x4ad96c){return function(_0x2a0432){if(_0x2a0432){var _0x15cfa5=_0x2a0432['count'],_0x158800=_0x4ad96c['offset'],_0x1ffa7c=_0x4ad96c[_0x66d6('0x2c')]+_0x4ad96c[_0x66d6('0x2d')],_0x1cc259;if(_0x1ffa7c>=_0x15cfa5){_0x1ffa7c=_0x15cfa5;_0x1cc259=0xc8;}else{_0x1cc259=0xce;}_0x325e6e['status'](_0x1cc259);return _0x325e6e[_0x66d6('0x2e')](_0x66d6('0x2f'),_0x158800+'-'+_0x1ffa7c+'/'+_0x15cfa5)['json'](_0x2a0432);}return null;};}function patchUpdates(_0x3ec0a5){return function(_0x9ad459){try{jsonpatch['apply'](_0x9ad459,_0x3ec0a5,!![]);}catch(_0x10ef79){return BPromise[_0x66d6('0x30')](_0x10ef79);}return _0x9ad459[_0x66d6('0x31')]();};}function saveUpdates(_0x4a1eae,_0x46d66e){return function(_0x274b07){if(_0x274b07){return _0x274b07[_0x66d6('0x32')](_0x4a1eae)['then'](function(_0x33d00d){return _0x33d00d;});}return null;};}function removeEntity(_0x5ac61f,_0x5391e3){return function(_0x145aa7){if(_0x145aa7){return _0x145aa7[_0x66d6('0x33')]()[_0x66d6('0x1f')](function(){_0x5ac61f[_0x66d6('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e63ef,_0x3da765){return function(_0x38afcd){if(!_0x38afcd){_0x5e63ef[_0x66d6('0x29')](0x194);}return _0x38afcd;};}function handleError(_0x14084e,_0x9f82c9){_0x9f82c9=_0x9f82c9||0x1f4;return function(_0x66aa71){logger[_0x66d6('0x24')](_0x66aa71['stack']);if(_0x66aa71[_0x66d6('0x34')]){delete _0x66aa71[_0x66d6('0x34')];}_0x14084e['status'](_0x9f82c9)[_0x66d6('0x35')](_0x66aa71);};}exports[_0x66d6('0x36')]=function(_0x470f4b,_0x15bffd){var _0x5d7f0f={},_0x38d926={},_0x18b198={'count':0x0,'rows':[]};var _0x2247b9=_['map'](db['SalesforceConfiguration'][_0x66d6('0x37')],function(_0x41242f){return{'name':_0x41242f[_0x66d6('0x38')],'type':_0x41242f[_0x66d6('0x39')]['key']};});_0x38d926[_0x66d6('0x3a')]=_[_0x66d6('0x3b')](_0x2247b9,_0x66d6('0x34'));_0x38d926['query']=_[_0x66d6('0x3c')](_0x470f4b['query']);_0x38d926[_0x66d6('0x3d')]=_[_0x66d6('0x3e')](_0x38d926[_0x66d6('0x3a')],_0x38d926[_0x66d6('0x3f')]);_0x5d7f0f[_0x66d6('0x40')]=_['intersection'](_0x38d926[_0x66d6('0x3a')],qs[_0x66d6('0x41')](_0x470f4b[_0x66d6('0x3f')][_0x66d6('0x41')]));_0x5d7f0f[_0x66d6('0x40')]=_0x5d7f0f[_0x66d6('0x40')][_0x66d6('0x42')]?_0x5d7f0f['attributes']:_0x38d926[_0x66d6('0x3a')];if(!_0x470f4b[_0x66d6('0x3f')][_0x66d6('0x43')](_0x66d6('0x44'))){_0x5d7f0f[_0x66d6('0x2d')]=qs[_0x66d6('0x2d')](_0x470f4b[_0x66d6('0x3f')][_0x66d6('0x2d')]);_0x5d7f0f[_0x66d6('0x2c')]=qs['offset'](_0x470f4b[_0x66d6('0x3f')][_0x66d6('0x2c')]);}_0x5d7f0f[_0x66d6('0x45')]=qs['sort'](_0x470f4b[_0x66d6('0x3f')][_0x66d6('0x46')]);_0x5d7f0f[_0x66d6('0x47')]=qs[_0x66d6('0x3d')](_[_0x66d6('0x48')](_0x470f4b[_0x66d6('0x3f')],_0x38d926['filters']),_0x2247b9);if(_0x470f4b[_0x66d6('0x3f')][_0x66d6('0x49')]){_0x5d7f0f[_0x66d6('0x47')]=_[_0x66d6('0x4a')](_0x5d7f0f[_0x66d6('0x47')],{'$or':_[_0x66d6('0x3b')](_0x2247b9,function(_0x5b520e){if(_0x5b520e[_0x66d6('0x39')]!==_0x66d6('0x4b')){var _0x55c6c4={};_0x55c6c4[_0x5b520e[_0x66d6('0x34')]]={'$like':'%'+_0x470f4b[_0x66d6('0x3f')]['filter']+'%'};return _0x55c6c4;}})});}_0x5d7f0f=_['merge']({},_0x5d7f0f,_0x470f4b[_0x66d6('0x4c')]);var _0x48b09c={'where':_0x5d7f0f[_0x66d6('0x47')]};return db['SalesforceConfiguration']['count'](_0x48b09c)[_0x66d6('0x1f')](function(_0x47906d){_0x18b198['count']=_0x47906d;if(_0x470f4b[_0x66d6('0x3f')]['includeAll']){_0x5d7f0f[_0x66d6('0x4d')]=[{'all':!![]}];}return db[_0x66d6('0x4e')][_0x66d6('0x4f')](_0x5d7f0f);})['then'](function(_0x186280){_0x18b198[_0x66d6('0x50')]=_0x186280;return _0x18b198;})[_0x66d6('0x1f')](respondWithFilteredResult(_0x15bffd,_0x5d7f0f))[_0x66d6('0x28')](handleError(_0x15bffd,null));};exports[_0x66d6('0x51')]=function(_0x5e171a,_0x405dc1){var _0x21565a={'raw':![],'where':{'id':_0x5e171a[_0x66d6('0x52')]['id']}},_0x47e930={};_0x47e930[_0x66d6('0x3a')]=_[_0x66d6('0x3c')](db[_0x66d6('0x4e')]['rawAttributes']);_0x47e930['query']=_[_0x66d6('0x3c')](_0x5e171a['query']);_0x47e930[_0x66d6('0x3d')]=_['intersection'](_0x47e930[_0x66d6('0x3a')],_0x47e930[_0x66d6('0x3f')]);_0x21565a[_0x66d6('0x40')]=_[_0x66d6('0x3e')](_0x47e930['model'],qs['fields'](_0x5e171a['query']['fields']));_0x21565a[_0x66d6('0x40')]=_0x21565a[_0x66d6('0x40')][_0x66d6('0x42')]?_0x21565a[_0x66d6('0x40')]:_0x47e930[_0x66d6('0x3a')];if(_0x5e171a[_0x66d6('0x3f')][_0x66d6('0x53')]){_0x21565a[_0x66d6('0x4d')]=[{'all':!![]}];}_0x21565a=_[_0x66d6('0x4a')]({},_0x21565a,_0x5e171a[_0x66d6('0x4c')]);return db[_0x66d6('0x4e')][_0x66d6('0x54')](_0x21565a)[_0x66d6('0x1f')](handleEntityNotFound(_0x405dc1,null))[_0x66d6('0x1f')](respondWithResult(_0x405dc1,null))[_0x66d6('0x28')](handleError(_0x405dc1,null));};exports[_0x66d6('0x55')]=function(_0x33a2e3,_0x3bdc7f){return db[_0x66d6('0x4e')]['create'](_0x33a2e3[_0x66d6('0x56')],{})[_0x66d6('0x1f')](respondWithResult(_0x3bdc7f,0xc9))['catch'](handleError(_0x3bdc7f,null));};exports[_0x66d6('0x32')]=function(_0x18eb55,_0x581507){if(_0x18eb55[_0x66d6('0x56')]['id']){delete _0x18eb55[_0x66d6('0x56')]['id'];}return db[_0x66d6('0x4e')][_0x66d6('0x54')]({'where':{'id':_0x18eb55[_0x66d6('0x52')]['id']}})['then'](handleEntityNotFound(_0x581507,null))[_0x66d6('0x1f')](saveUpdates(_0x18eb55[_0x66d6('0x56')],null))[_0x66d6('0x1f')](respondWithResult(_0x581507,null))['catch'](handleError(_0x581507,null));};exports[_0x66d6('0x33')]=function(_0x2122fb,_0x582644){return db[_0x66d6('0x4e')][_0x66d6('0x54')]({'where':{'id':_0x2122fb[_0x66d6('0x52')]['id']}})[_0x66d6('0x1f')](handleEntityNotFound(_0x582644,null))[_0x66d6('0x1f')](removeEntity(_0x582644,null))[_0x66d6('0x28')](handleError(_0x582644,null));};exports[_0x66d6('0x57')]=function(_0x10e543,_0x76e9a8,_0x3121c8){var _0xffaf55={};var _0x5c414f={};var _0x145a06;var _0x11fb10;return db[_0x66d6('0x4e')][_0x66d6('0x58')]({'where':{'id':_0x10e543[_0x66d6('0x52')]['id']}})['then'](handleEntityNotFound(_0x76e9a8,null))[_0x66d6('0x1f')](function(_0x575850){if(_0x575850){_0x145a06=_0x575850;_0x5c414f[_0x66d6('0x3a')]=_['keys'](db[_0x66d6('0x59')][_0x66d6('0x37')]);_0x5c414f[_0x66d6('0x3f')]=_[_0x66d6('0x3c')](_0x10e543[_0x66d6('0x3f')]);_0x5c414f['filters']=_['intersection'](_0x5c414f[_0x66d6('0x3a')],_0x5c414f['query']);_0xffaf55[_0x66d6('0x40')]=_[_0x66d6('0x3e')](_0x5c414f['model'],qs[_0x66d6('0x41')](_0x10e543[_0x66d6('0x3f')][_0x66d6('0x41')]));_0xffaf55[_0x66d6('0x40')]=_0xffaf55[_0x66d6('0x40')]['length']?_0xffaf55[_0x66d6('0x40')]:_0x5c414f[_0x66d6('0x3a')];_0xffaf55[_0x66d6('0x45')]=qs['sort'](_0x10e543['query']['sort']);_0xffaf55[_0x66d6('0x47')]=qs['filters'](_[_0x66d6('0x48')](_0x10e543['query'],_0x5c414f[_0x66d6('0x3d')]));if(_0x10e543[_0x66d6('0x3f')][_0x66d6('0x49')]){_0xffaf55[_0x66d6('0x47')]=_['merge'](_0xffaf55[_0x66d6('0x47')],{'$or':_[_0x66d6('0x3b')](_0xffaf55['attributes'],function(_0x2baa14){var _0x1c98ec={};_0x1c98ec[_0x2baa14]={'$like':'%'+_0x10e543['query'][_0x66d6('0x49')]+'%'};return _0x1c98ec;})});}_0xffaf55=_[_0x66d6('0x4a')]({},_0xffaf55,_0x10e543[_0x66d6('0x4c')]);return _0x145a06[_0x66d6('0x57')](_0xffaf55);}})[_0x66d6('0x1f')](function(_0x2ca793){if(_0x2ca793){_0x11fb10=_0x2ca793[_0x66d6('0x42')];if(!_0x10e543[_0x66d6('0x3f')][_0x66d6('0x43')]('nolimit')){_0xffaf55['limit']=qs[_0x66d6('0x2d')](_0x10e543['query'][_0x66d6('0x2d')]);_0xffaf55[_0x66d6('0x2c')]=qs['offset'](_0x10e543[_0x66d6('0x3f')][_0x66d6('0x2c')]);}return _0x145a06[_0x66d6('0x57')](_0xffaf55);}})[_0x66d6('0x1f')](function(_0x5ca480){if(_0x5ca480){return _0x5ca480?{'count':_0x11fb10,'rows':_0x5ca480}:null;}})[_0x66d6('0x1f')](respondWithResult(_0x76e9a8,null))[_0x66d6('0x28')](handleError(_0x76e9a8,null));};exports[_0x66d6('0x5a')]=function(_0x1614db,_0x4b6016,_0x469f00){var _0x112396={};var _0x281675={};var _0x4df3ac;var _0x6f2a3b;return db['SalesforceConfiguration'][_0x66d6('0x58')]({'where':{'id':_0x1614db[_0x66d6('0x52')]['id']}})[_0x66d6('0x1f')](handleEntityNotFound(_0x4b6016,null))[_0x66d6('0x1f')](function(_0x1f58b7){if(_0x1f58b7){_0x4df3ac=_0x1f58b7;_0x281675[_0x66d6('0x3a')]=_[_0x66d6('0x3c')](db[_0x66d6('0x59')]['rawAttributes']);_0x281675[_0x66d6('0x3f')]=_[_0x66d6('0x3c')](_0x1614db[_0x66d6('0x3f')]);_0x281675[_0x66d6('0x3d')]=_[_0x66d6('0x3e')](_0x281675[_0x66d6('0x3a')],_0x281675[_0x66d6('0x3f')]);_0x112396[_0x66d6('0x40')]=_[_0x66d6('0x3e')](_0x281675[_0x66d6('0x3a')],qs[_0x66d6('0x41')](_0x1614db[_0x66d6('0x3f')]['fields']));_0x112396[_0x66d6('0x40')]=_0x112396['attributes'][_0x66d6('0x42')]?_0x112396[_0x66d6('0x40')]:_0x281675[_0x66d6('0x3a')];_0x112396[_0x66d6('0x45')]=qs[_0x66d6('0x46')](_0x1614db[_0x66d6('0x3f')]['sort']);_0x112396[_0x66d6('0x47')]=qs[_0x66d6('0x3d')](_[_0x66d6('0x48')](_0x1614db[_0x66d6('0x3f')],_0x281675[_0x66d6('0x3d')]));if(_0x1614db[_0x66d6('0x3f')][_0x66d6('0x49')]){_0x112396[_0x66d6('0x47')]=_[_0x66d6('0x4a')](_0x112396[_0x66d6('0x47')],{'$or':_[_0x66d6('0x3b')](_0x112396[_0x66d6('0x40')],function(_0x34e2ab){var _0x2eb5d0={};_0x2eb5d0[_0x34e2ab]={'$like':'%'+_0x1614db['query'][_0x66d6('0x49')]+'%'};return _0x2eb5d0;})});}_0x112396=_['merge']({},_0x112396,_0x1614db[_0x66d6('0x4c')]);return _0x4df3ac[_0x66d6('0x5a')](_0x112396);}})[_0x66d6('0x1f')](function(_0x3d01c7){if(_0x3d01c7){_0x6f2a3b=_0x3d01c7[_0x66d6('0x42')];if(!_0x1614db[_0x66d6('0x3f')][_0x66d6('0x43')]('nolimit')){_0x112396[_0x66d6('0x2d')]=qs[_0x66d6('0x2d')](_0x1614db['query']['limit']);_0x112396['offset']=qs[_0x66d6('0x2c')](_0x1614db[_0x66d6('0x3f')]['offset']);}return _0x4df3ac[_0x66d6('0x5a')](_0x112396);}})[_0x66d6('0x1f')](function(_0x225d26){if(_0x225d26){return _0x225d26?{'count':_0x6f2a3b,'rows':_0x225d26}:null;}})[_0x66d6('0x1f')](respondWithResult(_0x4b6016,null))[_0x66d6('0x28')](handleError(_0x4b6016,null));};exports[_0x66d6('0x5b')]=function(_0x59eb8f,_0x98525a,_0x4faeb1){var _0x3b2c71={};var _0x3a216b={};var _0x39b6b4;var _0x9f276a;return db[_0x66d6('0x4e')][_0x66d6('0x58')]({'where':{'id':_0x59eb8f[_0x66d6('0x52')]['id']}})[_0x66d6('0x1f')](handleEntityNotFound(_0x98525a,null))[_0x66d6('0x1f')](function(_0x557f6f){if(_0x557f6f){_0x39b6b4=_0x557f6f;_0x3a216b[_0x66d6('0x3a')]=_['keys'](db[_0x66d6('0x59')][_0x66d6('0x37')]);_0x3a216b[_0x66d6('0x3f')]=_[_0x66d6('0x3c')](_0x59eb8f['query']);_0x3a216b[_0x66d6('0x3d')]=_[_0x66d6('0x3e')](_0x3a216b[_0x66d6('0x3a')],_0x3a216b[_0x66d6('0x3f')]);_0x3b2c71[_0x66d6('0x40')]=_[_0x66d6('0x3e')](_0x3a216b['model'],qs[_0x66d6('0x41')](_0x59eb8f[_0x66d6('0x3f')][_0x66d6('0x41')]));_0x3b2c71['attributes']=_0x3b2c71['attributes'][_0x66d6('0x42')]?_0x3b2c71['attributes']:_0x3a216b['model'];_0x3b2c71[_0x66d6('0x45')]=qs['sort'](_0x59eb8f['query'][_0x66d6('0x46')]);_0x3b2c71['where']=qs[_0x66d6('0x3d')](_[_0x66d6('0x48')](_0x59eb8f['query'],_0x3a216b[_0x66d6('0x3d')]));if(_0x59eb8f[_0x66d6('0x3f')][_0x66d6('0x49')]){_0x3b2c71[_0x66d6('0x47')]=_[_0x66d6('0x4a')](_0x3b2c71['where'],{'$or':_['map'](_0x3b2c71[_0x66d6('0x40')],function(_0x8b612f){var _0x4ac7e2={};_0x4ac7e2[_0x8b612f]={'$like':'%'+_0x59eb8f[_0x66d6('0x3f')]['filter']+'%'};return _0x4ac7e2;})});}_0x3b2c71=_[_0x66d6('0x4a')]({},_0x3b2c71,_0x59eb8f['options']);return _0x39b6b4[_0x66d6('0x5b')](_0x3b2c71);}})[_0x66d6('0x1f')](function(_0x199a85){if(_0x199a85){_0x9f276a=_0x199a85[_0x66d6('0x42')];if(!_0x59eb8f['query'][_0x66d6('0x43')](_0x66d6('0x44'))){_0x3b2c71[_0x66d6('0x2d')]=qs['limit'](_0x59eb8f[_0x66d6('0x3f')][_0x66d6('0x2d')]);_0x3b2c71[_0x66d6('0x2c')]=qs[_0x66d6('0x2c')](_0x59eb8f[_0x66d6('0x3f')][_0x66d6('0x2c')]);}return _0x39b6b4[_0x66d6('0x5b')](_0x3b2c71);}})[_0x66d6('0x1f')](function(_0x1a2d49){if(_0x1a2d49){return _0x1a2d49?{'count':_0x9f276a,'rows':_0x1a2d49}:null;}})[_0x66d6('0x1f')](respondWithResult(_0x98525a,null))[_0x66d6('0x28')](handleError(_0x98525a,null));}; \ No newline at end of file +var _0x7fb2=['save','then','destroy','sendStatus','stack','name','index','map','SalesforceConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','getFields','findOne','SalesforceField','nolimit','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','apply','reject'];(function(_0x377959,_0x1a54a3){var _0x15709d=function(_0x5df9af){while(--_0x5df9af){_0x377959['push'](_0x377959['shift']());}};_0x15709d(++_0x1a54a3);}(_0x7fb2,0xe1));var _0x27fb=function(_0x412b0d,_0x3f9c97){_0x412b0d=_0x412b0d-0x0;var _0x5af428=_0x7fb2[_0x412b0d];return _0x5af428;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x27fb('0x0'));var rimraf=require(_0x27fb('0x1'));var zipdir=require(_0x27fb('0x2'));var jsonpatch=require(_0x27fb('0x3'));var rp=require(_0x27fb('0x4'));var moment=require(_0x27fb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x27fb('0x6'));var util=require(_0x27fb('0x7'));var path=require(_0x27fb('0x8'));var sox=require(_0x27fb('0x9'));var csv=require(_0x27fb('0xa'));var ejs=require(_0x27fb('0xb'));var fs=require('fs');var _=require(_0x27fb('0xc'));var squel=require(_0x27fb('0xd'));var crypto=require(_0x27fb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x27fb('0xf'));var toCsv=require(_0x27fb('0xa'));var querystring=require('querystring');var Papa=require(_0x27fb('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27fb('0x11'));var logger=require(_0x27fb('0x12'))(_0x27fb('0x13'));var utils=require(_0x27fb('0x14'));var config=require(_0x27fb('0x15'));var db=require(_0x27fb('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x27fb('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23bf84,_0x5b625f,_0x44c9d2){if(_0x44c9d2){var _0x5b0ffc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b0ffc[_0x27fb('0x18')](_0x5b625f)){return _0x23bf84;}else{throw new db[(_0x27fb('0x19'))][(_0x27fb('0x1a'))](_0x27fb('0x1b'));}}else{return _0x23bf84;}}function respondWithRpcPromise(_0x1d6267,_0x344af5,_0x5b7d2e,_0x4a082c){return new BPromise(function(_0x27e6e2,_0x4c6885){var _0x444416=_0x4a082c||client;return _0x444416[_0x27fb('0x1c')](_0x1d6267,_0x5b7d2e)['then'](function(_0x186fce){logger[_0x27fb('0x1d')](_0x27fb('0x1e'),_0x344af5,_0x27fb('0x1f'));logger[_0x27fb('0x20')](_0x27fb('0x21'),_0x344af5,_0x27fb('0x1f'),JSON[_0x27fb('0x22')](_0x186fce));if(_0x186fce['error']){if(_0x186fce[_0x27fb('0x23')][_0x27fb('0x24')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x344af5,_0x186fce[_0x27fb('0x23')][_0x27fb('0x25')]);return _0x4c6885(_0x186fce[_0x27fb('0x23')]['message']);}logger[_0x27fb('0x23')](_0x27fb('0x1e'),_0x344af5,_0x186fce[_0x27fb('0x23')]['message']);return _0x27e6e2(_0x186fce[_0x27fb('0x23')][_0x27fb('0x25')]);}else{logger[_0x27fb('0x1d')](_0x27fb('0x1e'),_0x344af5,'request\x20sent');_0x27e6e2(_0x186fce['result'][_0x27fb('0x25')]);}})[_0x27fb('0x26')](function(_0x33e719){logger[_0x27fb('0x23')](_0x27fb('0x1e'),_0x344af5,_0x33e719);_0x4c6885(_0x33e719);});});}function respondWithStatusCode(_0xc0cf42,_0x36b084){_0x36b084=_0x36b084||0xcc;return function(_0x550fd6){if(_0x550fd6){return _0xc0cf42['sendStatus'](_0x36b084);}return _0xc0cf42[_0x27fb('0x27')](_0x36b084)[_0x27fb('0x28')]();};}function respondWithResult(_0x2f34ee,_0x122f3f){_0x122f3f=_0x122f3f||0xc8;return function(_0x418c3c){if(_0x418c3c){return _0x2f34ee[_0x27fb('0x27')](_0x122f3f)[_0x27fb('0x29')](_0x418c3c);}};}function respondWithFilteredResult(_0x444aa4,_0x36a900){return function(_0x4ad654){if(_0x4ad654){var _0x578396=_0x4ad654[_0x27fb('0x2a')],_0x46a1b0=_0x36a900[_0x27fb('0x2b')],_0xad171d=_0x36a900[_0x27fb('0x2b')]+_0x36a900[_0x27fb('0x2c')],_0x273579;if(_0xad171d>=_0x578396){_0xad171d=_0x578396;_0x273579=0xc8;}else{_0x273579=0xce;}_0x444aa4[_0x27fb('0x27')](_0x273579);return _0x444aa4[_0x27fb('0x2d')]('Content-Range',_0x46a1b0+'-'+_0xad171d+'/'+_0x578396)[_0x27fb('0x29')](_0x4ad654);}return null;};}function patchUpdates(_0x4b7f13){return function(_0x276cf2){try{jsonpatch[_0x27fb('0x2e')](_0x276cf2,_0x4b7f13,!![]);}catch(_0x3b0d67){return BPromise[_0x27fb('0x2f')](_0x3b0d67);}return _0x276cf2[_0x27fb('0x30')]();};}function saveUpdates(_0x4976f8,_0x390cf6){return function(_0x49847f){if(_0x49847f){return _0x49847f['update'](_0x4976f8)[_0x27fb('0x31')](function(_0x106540){return _0x106540;});}return null;};}function removeEntity(_0x411ad6,_0x16c967){return function(_0x2ae0eb){if(_0x2ae0eb){return _0x2ae0eb[_0x27fb('0x32')]()['then'](function(){_0x411ad6[_0x27fb('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d2714,_0x514174){return function(_0x4d9d4d){if(!_0x4d9d4d){_0x7d2714[_0x27fb('0x33')](0x194);}return _0x4d9d4d;};}function handleError(_0x1e9b6c,_0x2977b5){_0x2977b5=_0x2977b5||0x1f4;return function(_0x46c62b){logger[_0x27fb('0x23')](_0x46c62b[_0x27fb('0x34')]);if(_0x46c62b[_0x27fb('0x35')]){delete _0x46c62b[_0x27fb('0x35')];}_0x1e9b6c[_0x27fb('0x27')](_0x2977b5)['send'](_0x46c62b);};}exports[_0x27fb('0x36')]=function(_0x3cf8ef,_0x49ebdf){var _0x1a1508={},_0x348ccb={},_0x36f313={'count':0x0,'rows':[]};var _0x744d65=_[_0x27fb('0x37')](db[_0x27fb('0x38')][_0x27fb('0x39')],function(_0x1b4358){return{'name':_0x1b4358['fieldName'],'type':_0x1b4358[_0x27fb('0x3a')][_0x27fb('0x3b')]};});_0x348ccb['model']=_[_0x27fb('0x37')](_0x744d65,_0x27fb('0x35'));_0x348ccb[_0x27fb('0x3c')]=_[_0x27fb('0x3d')](_0x3cf8ef['query']);_0x348ccb[_0x27fb('0x3e')]=_[_0x27fb('0x3f')](_0x348ccb[_0x27fb('0x40')],_0x348ccb[_0x27fb('0x3c')]);_0x1a1508[_0x27fb('0x41')]=_[_0x27fb('0x3f')](_0x348ccb[_0x27fb('0x40')],qs[_0x27fb('0x42')](_0x3cf8ef['query'][_0x27fb('0x42')]));_0x1a1508[_0x27fb('0x41')]=_0x1a1508[_0x27fb('0x41')][_0x27fb('0x43')]?_0x1a1508[_0x27fb('0x41')]:_0x348ccb[_0x27fb('0x40')];if(!_0x3cf8ef[_0x27fb('0x3c')][_0x27fb('0x44')]('nolimit')){_0x1a1508[_0x27fb('0x2c')]=qs[_0x27fb('0x2c')](_0x3cf8ef[_0x27fb('0x3c')][_0x27fb('0x2c')]);_0x1a1508['offset']=qs[_0x27fb('0x2b')](_0x3cf8ef[_0x27fb('0x3c')]['offset']);}_0x1a1508[_0x27fb('0x45')]=qs['sort'](_0x3cf8ef[_0x27fb('0x3c')][_0x27fb('0x46')]);_0x1a1508[_0x27fb('0x47')]=qs[_0x27fb('0x3e')](_[_0x27fb('0x48')](_0x3cf8ef[_0x27fb('0x3c')],_0x348ccb[_0x27fb('0x3e')]),_0x744d65);if(_0x3cf8ef[_0x27fb('0x3c')][_0x27fb('0x49')]){_0x1a1508[_0x27fb('0x47')]=_[_0x27fb('0x4a')](_0x1a1508[_0x27fb('0x47')],{'$or':_[_0x27fb('0x37')](_0x744d65,function(_0x44c5a5){if(_0x44c5a5[_0x27fb('0x3a')]!==_0x27fb('0x4b')){var _0x39c6b0={};_0x39c6b0[_0x44c5a5[_0x27fb('0x35')]]={'$like':'%'+_0x3cf8ef[_0x27fb('0x3c')][_0x27fb('0x49')]+'%'};return _0x39c6b0;}})});}_0x1a1508=_[_0x27fb('0x4a')]({},_0x1a1508,_0x3cf8ef[_0x27fb('0x4c')]);var _0x1a2aea={'where':_0x1a1508[_0x27fb('0x47')]};return db['SalesforceConfiguration']['count'](_0x1a2aea)[_0x27fb('0x31')](function(_0x509f41){_0x36f313[_0x27fb('0x2a')]=_0x509f41;if(_0x3cf8ef[_0x27fb('0x3c')][_0x27fb('0x4d')]){_0x1a1508[_0x27fb('0x4e')]=[{'all':!![]}];}return db[_0x27fb('0x38')][_0x27fb('0x4f')](_0x1a1508);})[_0x27fb('0x31')](function(_0x4f9212){_0x36f313[_0x27fb('0x50')]=_0x4f9212;return _0x36f313;})[_0x27fb('0x31')](respondWithFilteredResult(_0x49ebdf,_0x1a1508))['catch'](handleError(_0x49ebdf,null));};exports[_0x27fb('0x51')]=function(_0x186b6d,_0x1c3426){var _0x4f3427={'raw':![],'where':{'id':_0x186b6d[_0x27fb('0x52')]['id']}},_0x482100={};_0x482100[_0x27fb('0x40')]=_[_0x27fb('0x3d')](db[_0x27fb('0x38')][_0x27fb('0x39')]);_0x482100[_0x27fb('0x3c')]=_[_0x27fb('0x3d')](_0x186b6d[_0x27fb('0x3c')]);_0x482100['filters']=_['intersection'](_0x482100[_0x27fb('0x40')],_0x482100['query']);_0x4f3427['attributes']=_[_0x27fb('0x3f')](_0x482100[_0x27fb('0x40')],qs['fields'](_0x186b6d['query']['fields']));_0x4f3427['attributes']=_0x4f3427['attributes'][_0x27fb('0x43')]?_0x4f3427[_0x27fb('0x41')]:_0x482100[_0x27fb('0x40')];if(_0x186b6d[_0x27fb('0x3c')][_0x27fb('0x4d')]){_0x4f3427['include']=[{'all':!![]}];}_0x4f3427=_[_0x27fb('0x4a')]({},_0x4f3427,_0x186b6d[_0x27fb('0x4c')]);return db[_0x27fb('0x38')]['find'](_0x4f3427)[_0x27fb('0x31')](handleEntityNotFound(_0x1c3426,null))[_0x27fb('0x31')](respondWithResult(_0x1c3426,null))[_0x27fb('0x26')](handleError(_0x1c3426,null));};exports[_0x27fb('0x53')]=function(_0x39d248,_0x46f335){return db['SalesforceConfiguration'][_0x27fb('0x53')](_0x39d248[_0x27fb('0x54')],{})['then'](respondWithResult(_0x46f335,0xc9))[_0x27fb('0x26')](handleError(_0x46f335,null));};exports['update']=function(_0x47484e,_0x4f8f51){if(_0x47484e[_0x27fb('0x54')]['id']){delete _0x47484e[_0x27fb('0x54')]['id'];}return db[_0x27fb('0x38')][_0x27fb('0x55')]({'where':{'id':_0x47484e[_0x27fb('0x52')]['id']}})['then'](handleEntityNotFound(_0x4f8f51,null))[_0x27fb('0x31')](saveUpdates(_0x47484e[_0x27fb('0x54')],null))[_0x27fb('0x31')](respondWithResult(_0x4f8f51,null))[_0x27fb('0x26')](handleError(_0x4f8f51,null));};exports[_0x27fb('0x32')]=function(_0x1b15a0,_0x1bb5aa){return db[_0x27fb('0x38')][_0x27fb('0x55')]({'where':{'id':_0x1b15a0[_0x27fb('0x52')]['id']}})[_0x27fb('0x31')](handleEntityNotFound(_0x1bb5aa,null))['then'](removeEntity(_0x1bb5aa,null))[_0x27fb('0x26')](handleError(_0x1bb5aa,null));};exports[_0x27fb('0x56')]=function(_0x27a230,_0x4aa1f2,_0x2508e5){var _0x12a2d2={};var _0x1d2298={};var _0x1d2a97;var _0x3ea4dd;return db['SalesforceConfiguration'][_0x27fb('0x57')]({'where':{'id':_0x27a230[_0x27fb('0x52')]['id']}})[_0x27fb('0x31')](handleEntityNotFound(_0x4aa1f2,null))[_0x27fb('0x31')](function(_0x4445ab){if(_0x4445ab){_0x1d2a97=_0x4445ab;_0x1d2298[_0x27fb('0x40')]=_[_0x27fb('0x3d')](db[_0x27fb('0x58')][_0x27fb('0x39')]);_0x1d2298[_0x27fb('0x3c')]=_[_0x27fb('0x3d')](_0x27a230['query']);_0x1d2298[_0x27fb('0x3e')]=_['intersection'](_0x1d2298[_0x27fb('0x40')],_0x1d2298['query']);_0x12a2d2[_0x27fb('0x41')]=_['intersection'](_0x1d2298[_0x27fb('0x40')],qs[_0x27fb('0x42')](_0x27a230['query']['fields']));_0x12a2d2['attributes']=_0x12a2d2[_0x27fb('0x41')][_0x27fb('0x43')]?_0x12a2d2['attributes']:_0x1d2298[_0x27fb('0x40')];_0x12a2d2[_0x27fb('0x45')]=qs[_0x27fb('0x46')](_0x27a230[_0x27fb('0x3c')][_0x27fb('0x46')]);_0x12a2d2['where']=qs['filters'](_['pick'](_0x27a230[_0x27fb('0x3c')],_0x1d2298[_0x27fb('0x3e')]));if(_0x27a230['query'][_0x27fb('0x49')]){_0x12a2d2['where']=_[_0x27fb('0x4a')](_0x12a2d2[_0x27fb('0x47')],{'$or':_[_0x27fb('0x37')](_0x12a2d2[_0x27fb('0x41')],function(_0x4ed9ec){var _0x515049={};_0x515049[_0x4ed9ec]={'$like':'%'+_0x27a230[_0x27fb('0x3c')][_0x27fb('0x49')]+'%'};return _0x515049;})});}_0x12a2d2=_['merge']({},_0x12a2d2,_0x27a230[_0x27fb('0x4c')]);return _0x1d2a97[_0x27fb('0x56')](_0x12a2d2);}})[_0x27fb('0x31')](function(_0x1783a1){if(_0x1783a1){_0x3ea4dd=_0x1783a1['length'];if(!_0x27a230[_0x27fb('0x3c')][_0x27fb('0x44')](_0x27fb('0x59'))){_0x12a2d2[_0x27fb('0x2c')]=qs[_0x27fb('0x2c')](_0x27a230['query'][_0x27fb('0x2c')]);_0x12a2d2['offset']=qs['offset'](_0x27a230[_0x27fb('0x3c')][_0x27fb('0x2b')]);}return _0x1d2a97[_0x27fb('0x56')](_0x12a2d2);}})[_0x27fb('0x31')](function(_0x2e5ba1){if(_0x2e5ba1){return _0x2e5ba1?{'count':_0x3ea4dd,'rows':_0x2e5ba1}:null;}})[_0x27fb('0x31')](respondWithResult(_0x4aa1f2,null))[_0x27fb('0x26')](handleError(_0x4aa1f2,null));};exports[_0x27fb('0x5a')]=function(_0x467856,_0x2e8dc1,_0x3c60de){var _0x546965={};var _0x2aae6d={};var _0x1abc4e;var _0x49373a;return db['SalesforceConfiguration'][_0x27fb('0x57')]({'where':{'id':_0x467856[_0x27fb('0x52')]['id']}})[_0x27fb('0x31')](handleEntityNotFound(_0x2e8dc1,null))[_0x27fb('0x31')](function(_0x47dbea){if(_0x47dbea){_0x1abc4e=_0x47dbea;_0x2aae6d[_0x27fb('0x40')]=_[_0x27fb('0x3d')](db[_0x27fb('0x58')][_0x27fb('0x39')]);_0x2aae6d[_0x27fb('0x3c')]=_[_0x27fb('0x3d')](_0x467856['query']);_0x2aae6d[_0x27fb('0x3e')]=_[_0x27fb('0x3f')](_0x2aae6d[_0x27fb('0x40')],_0x2aae6d[_0x27fb('0x3c')]);_0x546965[_0x27fb('0x41')]=_['intersection'](_0x2aae6d[_0x27fb('0x40')],qs[_0x27fb('0x42')](_0x467856[_0x27fb('0x3c')]['fields']));_0x546965[_0x27fb('0x41')]=_0x546965[_0x27fb('0x41')][_0x27fb('0x43')]?_0x546965[_0x27fb('0x41')]:_0x2aae6d[_0x27fb('0x40')];_0x546965['order']=qs['sort'](_0x467856[_0x27fb('0x3c')][_0x27fb('0x46')]);_0x546965['where']=qs[_0x27fb('0x3e')](_[_0x27fb('0x48')](_0x467856['query'],_0x2aae6d[_0x27fb('0x3e')]));if(_0x467856['query'][_0x27fb('0x49')]){_0x546965['where']=_[_0x27fb('0x4a')](_0x546965[_0x27fb('0x47')],{'$or':_[_0x27fb('0x37')](_0x546965[_0x27fb('0x41')],function(_0x56de4d){var _0x191d8b={};_0x191d8b[_0x56de4d]={'$like':'%'+_0x467856['query'][_0x27fb('0x49')]+'%'};return _0x191d8b;})});}_0x546965=_[_0x27fb('0x4a')]({},_0x546965,_0x467856['options']);return _0x1abc4e['getSubjects'](_0x546965);}})[_0x27fb('0x31')](function(_0x30d419){if(_0x30d419){_0x49373a=_0x30d419[_0x27fb('0x43')];if(!_0x467856[_0x27fb('0x3c')][_0x27fb('0x44')](_0x27fb('0x59'))){_0x546965[_0x27fb('0x2c')]=qs[_0x27fb('0x2c')](_0x467856['query']['limit']);_0x546965[_0x27fb('0x2b')]=qs[_0x27fb('0x2b')](_0x467856[_0x27fb('0x3c')][_0x27fb('0x2b')]);}return _0x1abc4e[_0x27fb('0x5a')](_0x546965);}})[_0x27fb('0x31')](function(_0x200394){if(_0x200394){return _0x200394?{'count':_0x49373a,'rows':_0x200394}:null;}})[_0x27fb('0x31')](respondWithResult(_0x2e8dc1,null))[_0x27fb('0x26')](handleError(_0x2e8dc1,null));};exports['getDescriptions']=function(_0x259541,_0xea4d0d,_0x33acd0){var _0x73b724={};var _0x5729b7={};var _0x19e7a0;var _0x52a5a3;return db[_0x27fb('0x38')][_0x27fb('0x57')]({'where':{'id':_0x259541[_0x27fb('0x52')]['id']}})['then'](handleEntityNotFound(_0xea4d0d,null))[_0x27fb('0x31')](function(_0x59b29b){if(_0x59b29b){_0x19e7a0=_0x59b29b;_0x5729b7[_0x27fb('0x40')]=_[_0x27fb('0x3d')](db[_0x27fb('0x58')][_0x27fb('0x39')]);_0x5729b7['query']=_[_0x27fb('0x3d')](_0x259541[_0x27fb('0x3c')]);_0x5729b7['filters']=_[_0x27fb('0x3f')](_0x5729b7[_0x27fb('0x40')],_0x5729b7['query']);_0x73b724[_0x27fb('0x41')]=_['intersection'](_0x5729b7[_0x27fb('0x40')],qs[_0x27fb('0x42')](_0x259541[_0x27fb('0x3c')][_0x27fb('0x42')]));_0x73b724[_0x27fb('0x41')]=_0x73b724['attributes'][_0x27fb('0x43')]?_0x73b724['attributes']:_0x5729b7[_0x27fb('0x40')];_0x73b724['order']=qs[_0x27fb('0x46')](_0x259541[_0x27fb('0x3c')][_0x27fb('0x46')]);_0x73b724[_0x27fb('0x47')]=qs['filters'](_[_0x27fb('0x48')](_0x259541[_0x27fb('0x3c')],_0x5729b7[_0x27fb('0x3e')]));if(_0x259541[_0x27fb('0x3c')]['filter']){_0x73b724[_0x27fb('0x47')]=_[_0x27fb('0x4a')](_0x73b724[_0x27fb('0x47')],{'$or':_[_0x27fb('0x37')](_0x73b724[_0x27fb('0x41')],function(_0x2f844a){var _0x54273d={};_0x54273d[_0x2f844a]={'$like':'%'+_0x259541[_0x27fb('0x3c')][_0x27fb('0x49')]+'%'};return _0x54273d;})});}_0x73b724=_[_0x27fb('0x4a')]({},_0x73b724,_0x259541[_0x27fb('0x4c')]);return _0x19e7a0['getDescriptions'](_0x73b724);}})[_0x27fb('0x31')](function(_0x35c00e){if(_0x35c00e){_0x52a5a3=_0x35c00e[_0x27fb('0x43')];if(!_0x259541[_0x27fb('0x3c')][_0x27fb('0x44')]('nolimit')){_0x73b724['limit']=qs[_0x27fb('0x2c')](_0x259541[_0x27fb('0x3c')][_0x27fb('0x2c')]);_0x73b724[_0x27fb('0x2b')]=qs[_0x27fb('0x2b')](_0x259541[_0x27fb('0x3c')]['offset']);}return _0x19e7a0['getDescriptions'](_0x73b724);}})[_0x27fb('0x31')](function(_0x5b157a){if(_0x5b157a){return _0x5b157a?{'count':_0x52a5a3,'rows':_0x5b157a}:null;}})[_0x27fb('0x31')](respondWithResult(_0xea4d0d,null))[_0x27fb('0x26')](handleError(_0xea4d0d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4e54ac6..847db88 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 _0xa1bf=['moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api'];(function(_0x4bbb54,_0x529e61){var _0x51c41c=function(_0x19b52e){while(--_0x19b52e){_0x4bbb54['push'](_0x4bbb54['shift']());}};_0x51c41c(++_0x529e61);}(_0xa1bf,0x192));var _0xfa1b=function(_0x66adbd,_0xa70710){_0x66adbd=_0x66adbd-0x0;var _0xcf294f=_0xa1bf[_0x66adbd];return _0xcf294f;};'use strict';var _=require(_0xfa1b('0x0'));var util=require(_0xfa1b('0x1'));var logger=require(_0xfa1b('0x2'))(_0xfa1b('0x3'));var moment=require(_0xfa1b('0x4'));var BPromise=require(_0xfa1b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa1b('0x6'));var rimraf=require(_0xfa1b('0x7'));var config=require(_0xfa1b('0x8'));var attributes=require(_0xfa1b('0x9'));module[_0xfa1b('0xa')]=function(_0x51fd9e,_0x2743e7){return _0x51fd9e[_0xfa1b('0xb')](_0xfa1b('0xc'),attributes,{'tableName':_0xfa1b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc52f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc52f,0xea));var _0xfc52=function(_0x63154f,_0x2bc439){_0x63154f=_0x63154f-0x0;var _0x3aa611=_0xc52f[_0x63154f];return _0x3aa611;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var logger=require(_0xfc52('0x2'))(_0xfc52('0x3'));var moment=require(_0xfc52('0x4'));var BPromise=require(_0xfc52('0x5'));var rp=require(_0xfc52('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc52('0x7'));var config=require(_0xfc52('0x8'));var attributes=require(_0xfc52('0x9'));module[_0xfc52('0xa')]=function(_0x1d9e26,_0x433bcd){return _0x1d9e26['define'](_0xfc52('0xb'),attributes,{'tableName':_0xfc52('0xc'),'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 763c70a..6ab234b 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 _0xbdad=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0xad5300,_0x40ed33){var _0x21390f=function(_0x56940a){while(--_0x56940a){_0xad5300['push'](_0xad5300['shift']());}};_0x21390f(++_0x40ed33);}(_0xbdad,0xa9));var _0xdbda=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdad[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdbda('0x0'));var util=require(_0xdbda('0x1'));var moment=require(_0xdbda('0x2'));var BPromise=require('bluebird');var rs=require(_0xdbda('0x3'));var fs=require('fs');var Redis=require(_0xdbda('0x4'));var db=require(_0xdbda('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdbda('0x6'))(_0xdbda('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdbda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1de1ed,_0x510e00,_0x207daa){return new BPromise(function(_0x2eacbf,_0x2d70b7){return client['request'](_0x1de1ed,_0x207daa)['then'](function(_0xf9773b){logger[_0xdbda('0x9')](_0xdbda('0xa'),_0x510e00,_0xdbda('0xb'));logger[_0xdbda('0xc')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x510e00,'request\x20sent',JSON[_0xdbda('0xd')](_0xf9773b));if(_0xf9773b[_0xdbda('0xe')]){if(_0xf9773b[_0xdbda('0xe')][_0xdbda('0xf')]===0x1f4){logger[_0xdbda('0xe')](_0xdbda('0xa'),_0x510e00,_0xf9773b[_0xdbda('0xe')]['message']);return _0x2d70b7(_0xf9773b[_0xdbda('0xe')][_0xdbda('0x10')]);}logger[_0xdbda('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x510e00,_0xf9773b['error']['message']);return _0x2eacbf(_0xf9773b['error'][_0xdbda('0x10')]);}else{logger['info'](_0xdbda('0xa'),_0x510e00,_0xdbda('0xb'));_0x2eacbf(_0xf9773b['result'][_0xdbda('0x10')]);}})[_0xdbda('0x11')](function(_0xdc6b81){logger[_0xdbda('0xe')](_0xdbda('0xa'),_0x510e00,_0xdc6b81);_0x2d70b7(_0xdc6b81);});});} \ No newline at end of file +var _0xc535=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch'];(function(_0x4e7215,_0x3a11bb){var _0xc5ba80=function(_0x41cc10){while(--_0x41cc10){_0x4e7215['push'](_0x4e7215['shift']());}};_0xc5ba80(++_0x3a11bb);}(_0xc535,0x78));var _0x5c53=function(_0x51029d,_0x31eb21){_0x51029d=_0x51029d-0x0;var _0x292e95=_0xc535[_0x51029d];return _0x292e95;};'use strict';var _=require('lodash');var util=require(_0x5c53('0x0'));var moment=require(_0x5c53('0x1'));var BPromise=require(_0x5c53('0x2'));var rs=require(_0x5c53('0x3'));var fs=require('fs');var Redis=require(_0x5c53('0x4'));var db=require(_0x5c53('0x5'))['db'];var utils=require(_0x5c53('0x6'));var logger=require(_0x5c53('0x7'))('rpc');var config=require(_0x5c53('0x8'));var jayson=require(_0x5c53('0x9'));var client=jayson[_0x5c53('0xa')][_0x5c53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37e865,_0x4d501d,_0xcf484b){return new BPromise(function(_0x565537,_0x1ce513){return client[_0x5c53('0xc')](_0x37e865,_0xcf484b)[_0x5c53('0xd')](function(_0x91547e){logger[_0x5c53('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4d501d,'request\x20sent');logger['debug'](_0x5c53('0xf'),_0x4d501d,_0x5c53('0x10'),JSON[_0x5c53('0x11')](_0x91547e));if(_0x91547e[_0x5c53('0x12')]){if(_0x91547e['error'][_0x5c53('0x13')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4d501d,_0x91547e[_0x5c53('0x12')][_0x5c53('0x14')]);return _0x1ce513(_0x91547e[_0x5c53('0x12')][_0x5c53('0x14')]);}logger[_0x5c53('0x12')](_0x5c53('0x15'),_0x4d501d,_0x91547e[_0x5c53('0x12')][_0x5c53('0x14')]);return _0x565537(_0x91547e[_0x5c53('0x12')]['message']);}else{logger[_0x5c53('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4d501d,'request\x20sent');_0x565537(_0x91547e[_0x5c53('0x16')][_0x5c53('0x14')]);}})[_0x5c53('0x17')](function(_0x5c02e5){logger[_0x5c53('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4d501d,_0x5c02e5);_0x1ce513(_0x5c02e5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0d5e699..1400023 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 _0x0adf=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2599a3,_0x8a1808){var _0xb67d9a=function(_0x10fd8e){while(--_0x10fd8e){_0x2599a3['push'](_0x2599a3['shift']());}};_0xb67d9a(++_0x8a1808);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x209ee3,_0x5cbc56){_0x209ee3=_0x209ee3-0x0;var _0x89c7cc=_0x0adf[_0x209ee3];return _0x89c7cc;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var auth=require(_0xf0ad('0x5'));var interaction=require(_0xf0ad('0x6'));var config=require(_0xf0ad('0x7'));var controller=require(_0xf0ad('0x8'));router[_0xf0ad('0x9')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0xa')]);router['get'](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xe')]('/',auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xf')]);router[_0xf0ad('0x10')]('/:id',auth[_0xf0ad('0xc')](),controller['update']);router[_0xf0ad('0x11')](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0x12')]);module[_0xf0ad('0x13')]=router; \ No newline at end of file +var _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x57a06a,_0x58d2e6){var _0x5a4b86=function(_0x2272b0){while(--_0x2272b0){_0x57a06a['push'](_0x57a06a['shift']());}};_0x5a4b86(++_0x58d2e6);}(_0x187d,0x93));var _0xd187=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x187d[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d9fbf21..6afabb3 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 _0x2437=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0xa1b489,_0x1d5fd7){var _0x5d116e=function(_0x1371ed){while(--_0x1371ed){_0xa1b489['push'](_0xa1b489['shift']());}};_0x5d116e(++_0x1d5fd7);}(_0x2437,0x147));var _0x7243=function(_0x56ee7e,_0x31be7a){_0x56ee7e=_0x56ee7e-0x0;var _0x5a8d6a=_0x2437[_0x56ee7e];return _0x5a8d6a;};'use strict';var Sequelize=require(_0x7243('0x0'));module[_0x7243('0x1')]={'type':{'type':Sequelize[_0x7243('0x2')](_0x7243('0x3'),_0x7243('0x4'),_0x7243('0x5'),_0x7243('0x6')),'defaultValue':_0x7243('0x3')},'content':{'type':Sequelize[_0x7243('0x7')]},'key':{'type':Sequelize[_0x7243('0x7')]},'keyType':{'type':Sequelize[_0x7243('0x2')]('string',_0x7243('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x7243('0x7')]},'idField':{'type':Sequelize[_0x7243('0x7')]},'variableName':{'type':Sequelize[_0x7243('0x7')]}}; \ No newline at end of file +var _0xc013=['STRING','exports','variable','customVariable','keyValue','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc013,0x16f));var _0x3c01=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xc013[_0x29e3b6];return _0x55d4b0;};'use strict';var Sequelize=require('sequelize');module[_0x3c01('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x3c01('0x1'),_0x3c01('0x2'),_0x3c01('0x3')),'defaultValue':_0x3c01('0x4')},'content':{'type':Sequelize[_0x3c01('0x5')]},'key':{'type':Sequelize[_0x3c01('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3c01('0x1'),_0x3c01('0x2'))},'keyContent':{'type':Sequelize[_0x3c01('0x5')]},'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 37be5b4..ab9d637 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 _0xe39d=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceField','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xe39d,0x7c));var _0xde39=function(_0x1b940b,_0x370e63){_0x1b940b=_0x1b940b-0x0;var _0x18cc00=_0xe39d[_0x1b940b];return _0x18cc00;};'use strict';var pdf=require(_0xde39('0x0'));var emlformat=require(_0xde39('0x1'));var rimraf=require(_0xde39('0x2'));var zipdir=require(_0xde39('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde39('0x4'));var moment=require(_0xde39('0x5'));var BPromise=require(_0xde39('0x6'));var Mustache=require('mustache');var util=require(_0xde39('0x7'));var path=require('path');var sox=require(_0xde39('0x8'));var csv=require(_0xde39('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xde39('0xa'));var jsforce=require(_0xde39('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xde39('0x9'));var querystring=require(_0xde39('0xc'));var Papa=require(_0xde39('0xd'));var Redis=require('ioredis');var authService=require(_0xde39('0xe'));var qs=require(_0xde39('0xf'));var as=require(_0xde39('0x10'));var hardwareService=require(_0xde39('0x11'));var logger=require(_0xde39('0x12'))(_0xde39('0x13'));var utils=require(_0xde39('0x14'));var config=require(_0xde39('0x15'));var db=require(_0xde39('0x16'))['db'];function respondWithStatusCode(_0xea94d1,_0x4e093c){_0x4e093c=_0x4e093c||0xcc;return function(_0x98f743){if(_0x98f743){return _0xea94d1[_0xde39('0x17')](_0x4e093c);}return _0xea94d1[_0xde39('0x18')](_0x4e093c)[_0xde39('0x19')]();};}function respondWithResult(_0x169f1a,_0x3eb291){_0x3eb291=_0x3eb291||0xc8;return function(_0x34a0ef){if(_0x34a0ef){return _0x169f1a[_0xde39('0x18')](_0x3eb291)['json'](_0x34a0ef);}};}function respondWithFilteredResult(_0x3096bd,_0x3fa96b){return function(_0x129896){if(_0x129896){var _0x1570f1=_0x129896['count'],_0x341a33=_0x3fa96b['offset'],_0x5ab1cc=_0x3fa96b[_0xde39('0x1a')]+_0x3fa96b[_0xde39('0x1b')],_0x328144;if(_0x5ab1cc>=_0x1570f1){_0x5ab1cc=_0x1570f1;_0x328144=0xc8;}else{_0x328144=0xce;}_0x3096bd[_0xde39('0x18')](_0x328144);return _0x3096bd[_0xde39('0x1c')](_0xde39('0x1d'),_0x341a33+'-'+_0x5ab1cc+'/'+_0x1570f1)['json'](_0x129896);}return null;};}function patchUpdates(_0x261aba){return function(_0x5edc93){try{jsonpatch[_0xde39('0x1e')](_0x5edc93,_0x261aba,!![]);}catch(_0x4de00f){return BPromise[_0xde39('0x1f')](_0x4de00f);}return _0x5edc93[_0xde39('0x20')]();};}function saveUpdates(_0x228118,_0x7bdfe9){return function(_0x234d46){if(_0x234d46){return _0x234d46['update'](_0x228118)[_0xde39('0x21')](function(_0x4bcf2e){return _0x4bcf2e;});}return null;};}function removeEntity(_0x1ac03d,_0x43b2cc){return function(_0x148094){if(_0x148094){return _0x148094[_0xde39('0x22')]()[_0xde39('0x21')](function(){_0x1ac03d['status'](0xcc)[_0xde39('0x19')]();});}};}function handleEntityNotFound(_0x19322c,_0x579390){return function(_0x2ce243){if(!_0x2ce243){_0x19322c[_0xde39('0x17')](0x194);}return _0x2ce243;};}function handleError(_0x32b8b4,_0x3361bf){_0x3361bf=_0x3361bf||0x1f4;return function(_0x496bf2){logger[_0xde39('0x23')](_0x496bf2['stack']);if(_0x496bf2[_0xde39('0x24')]){delete _0x496bf2[_0xde39('0x24')];}_0x32b8b4[_0xde39('0x18')](_0x3361bf)[_0xde39('0x25')](_0x496bf2);};}exports[_0xde39('0x26')]=function(_0x16d995,_0x2a39d7){var _0x500639={},_0x17a0bb={},_0x734e7={'count':0x0,'rows':[]};var _0x5500f6=_['map'](db['SalesforceField'][_0xde39('0x27')],function(_0x50f9b4){return{'name':_0x50f9b4[_0xde39('0x28')],'type':_0x50f9b4[_0xde39('0x29')][_0xde39('0x2a')]};});_0x17a0bb['model']=_['map'](_0x5500f6,_0xde39('0x24'));_0x17a0bb[_0xde39('0x2b')]=_['keys'](_0x16d995[_0xde39('0x2b')]);_0x17a0bb[_0xde39('0x2c')]=_[_0xde39('0x2d')](_0x17a0bb[_0xde39('0x2e')],_0x17a0bb['query']);_0x500639[_0xde39('0x2f')]=_['intersection'](_0x17a0bb[_0xde39('0x2e')],qs[_0xde39('0x30')](_0x16d995['query']['fields']));_0x500639[_0xde39('0x2f')]=_0x500639['attributes']['length']?_0x500639[_0xde39('0x2f')]:_0x17a0bb[_0xde39('0x2e')];if(!_0x16d995[_0xde39('0x2b')][_0xde39('0x31')](_0xde39('0x32'))){_0x500639['limit']=qs['limit'](_0x16d995['query'][_0xde39('0x1b')]);_0x500639[_0xde39('0x1a')]=qs['offset'](_0x16d995[_0xde39('0x2b')][_0xde39('0x1a')]);}_0x500639['order']=qs[_0xde39('0x33')](_0x16d995[_0xde39('0x2b')][_0xde39('0x33')]);_0x500639[_0xde39('0x34')]=qs['filters'](_[_0xde39('0x35')](_0x16d995['query'],_0x17a0bb[_0xde39('0x2c')]),_0x5500f6);if(_0x16d995[_0xde39('0x2b')][_0xde39('0x36')]){_0x500639[_0xde39('0x34')]=_[_0xde39('0x37')](_0x500639[_0xde39('0x34')],{'$or':_['map'](_0x5500f6,function(_0x32a8a6){if(_0x32a8a6[_0xde39('0x29')]!==_0xde39('0x38')){var _0x5745c9={};_0x5745c9[_0x32a8a6['name']]={'$like':'%'+_0x16d995[_0xde39('0x2b')][_0xde39('0x36')]+'%'};return _0x5745c9;}})});}_0x500639=_[_0xde39('0x37')]({},_0x500639,_0x16d995[_0xde39('0x39')]);var _0x3c864a={'where':_0x500639['where']};return db[_0xde39('0x3a')][_0xde39('0x3b')](_0x3c864a)[_0xde39('0x21')](function(_0x2da51b){_0x734e7[_0xde39('0x3b')]=_0x2da51b;if(_0x16d995[_0xde39('0x2b')][_0xde39('0x3c')]){_0x500639['include']=[{'all':!![]}];}return db[_0xde39('0x3a')][_0xde39('0x3d')](_0x500639);})[_0xde39('0x21')](function(_0x2c39f7){_0x734e7[_0xde39('0x3e')]=_0x2c39f7;return _0x734e7;})[_0xde39('0x21')](respondWithFilteredResult(_0x2a39d7,_0x500639))[_0xde39('0x3f')](handleError(_0x2a39d7,null));};exports[_0xde39('0x40')]=function(_0x1aad2b,_0x14ad0b){var _0x489985={'raw':!![],'where':{'id':_0x1aad2b[_0xde39('0x41')]['id']}},_0x2f46a7={};_0x2f46a7[_0xde39('0x2e')]=_[_0xde39('0x42')](db[_0xde39('0x3a')][_0xde39('0x27')]);_0x2f46a7[_0xde39('0x2b')]=_[_0xde39('0x42')](_0x1aad2b[_0xde39('0x2b')]);_0x2f46a7[_0xde39('0x2c')]=_[_0xde39('0x2d')](_0x2f46a7[_0xde39('0x2e')],_0x2f46a7[_0xde39('0x2b')]);_0x489985[_0xde39('0x2f')]=_[_0xde39('0x2d')](_0x2f46a7['model'],qs[_0xde39('0x30')](_0x1aad2b[_0xde39('0x2b')][_0xde39('0x30')]));_0x489985[_0xde39('0x2f')]=_0x489985[_0xde39('0x2f')]['length']?_0x489985[_0xde39('0x2f')]:_0x2f46a7[_0xde39('0x2e')];if(_0x1aad2b[_0xde39('0x2b')][_0xde39('0x3c')]){_0x489985[_0xde39('0x43')]=[{'all':!![]}];}_0x489985=_[_0xde39('0x37')]({},_0x489985,_0x1aad2b[_0xde39('0x39')]);return db[_0xde39('0x3a')][_0xde39('0x44')](_0x489985)['then'](handleEntityNotFound(_0x14ad0b,null))[_0xde39('0x21')](respondWithResult(_0x14ad0b,null))[_0xde39('0x3f')](handleError(_0x14ad0b,null));};exports[_0xde39('0x45')]=function(_0x4fdd5a,_0x341689){return db[_0xde39('0x3a')]['create'](_0x4fdd5a['body'],{})[_0xde39('0x21')](respondWithResult(_0x341689,0xc9))['catch'](handleError(_0x341689,null));};exports[_0xde39('0x46')]=function(_0x2c45fb,_0x21fd0b){if(_0x2c45fb[_0xde39('0x47')]['id']){delete _0x2c45fb[_0xde39('0x47')]['id'];}return db[_0xde39('0x3a')][_0xde39('0x44')]({'where':{'id':_0x2c45fb[_0xde39('0x41')]['id']}})[_0xde39('0x21')](handleEntityNotFound(_0x21fd0b,null))[_0xde39('0x21')](saveUpdates(_0x2c45fb[_0xde39('0x47')],null))[_0xde39('0x21')](respondWithResult(_0x21fd0b,null))[_0xde39('0x3f')](handleError(_0x21fd0b,null));};exports[_0xde39('0x22')]=function(_0x5065d3,_0x113fe9){return db[_0xde39('0x3a')][_0xde39('0x44')]({'where':{'id':_0x5065d3[_0xde39('0x41')]['id']}})[_0xde39('0x21')](handleEntityNotFound(_0x113fe9,null))[_0xde39('0x21')](removeEntity(_0x113fe9,null))[_0xde39('0x3f')](handleError(_0x113fe9,null));}; \ No newline at end of file +var _0xd7b8=['rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','includeAll','include','findAll','rows','show','params','keys','length','create','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','SalesforceField'];(function(_0x13dc29,_0x8a6cd4){var _0x4ed367=function(_0x566578){while(--_0x566578){_0x13dc29['push'](_0x13dc29['shift']());}};_0x4ed367(++_0x8a6cd4);}(_0xd7b8,0xb0));var _0x8d7b=function(_0x511588,_0x4fb963){_0x511588=_0x511588-0x0;var _0x393e21=_0xd7b8[_0x511588];return _0x393e21;};'use strict';var pdf=require(_0x8d7b('0x0'));var emlformat=require(_0x8d7b('0x1'));var rimraf=require(_0x8d7b('0x2'));var zipdir=require(_0x8d7b('0x3'));var jsonpatch=require(_0x8d7b('0x4'));var rp=require(_0x8d7b('0x5'));var moment=require(_0x8d7b('0x6'));var BPromise=require(_0x8d7b('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8d7b('0x8'));var csv=require(_0x8d7b('0x9'));var ejs=require(_0x8d7b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8d7b('0xb'));var jsforce=require(_0x8d7b('0xc'));var deskjs=require(_0x8d7b('0xd'));var toCsv=require(_0x8d7b('0x9'));var querystring=require('querystring');var Papa=require(_0x8d7b('0xe'));var Redis=require('ioredis');var authService=require(_0x8d7b('0xf'));var qs=require(_0x8d7b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d7b('0x11'));var logger=require(_0x8d7b('0x12'))(_0x8d7b('0x13'));var utils=require(_0x8d7b('0x14'));var config=require(_0x8d7b('0x15'));var db=require(_0x8d7b('0x16'))['db'];function respondWithStatusCode(_0x4bd756,_0x3747b2){_0x3747b2=_0x3747b2||0xcc;return function(_0x1ae79e){if(_0x1ae79e){return _0x4bd756[_0x8d7b('0x17')](_0x3747b2);}return _0x4bd756['status'](_0x3747b2)['end']();};}function respondWithResult(_0x2afc10,_0x165c70){_0x165c70=_0x165c70||0xc8;return function(_0x311bc3){if(_0x311bc3){return _0x2afc10[_0x8d7b('0x18')](_0x165c70)[_0x8d7b('0x19')](_0x311bc3);}};}function respondWithFilteredResult(_0x4880c3,_0x35eb74){return function(_0x12d014){if(_0x12d014){var _0x3556e1=_0x12d014[_0x8d7b('0x1a')],_0x431bb8=_0x35eb74[_0x8d7b('0x1b')],_0x300e41=_0x35eb74[_0x8d7b('0x1b')]+_0x35eb74[_0x8d7b('0x1c')],_0xe595c2;if(_0x300e41>=_0x3556e1){_0x300e41=_0x3556e1;_0xe595c2=0xc8;}else{_0xe595c2=0xce;}_0x4880c3[_0x8d7b('0x18')](_0xe595c2);return _0x4880c3[_0x8d7b('0x1d')](_0x8d7b('0x1e'),_0x431bb8+'-'+_0x300e41+'/'+_0x3556e1)[_0x8d7b('0x19')](_0x12d014);}return null;};}function patchUpdates(_0xdc8e65){return function(_0x1b51bb){try{jsonpatch[_0x8d7b('0x1f')](_0x1b51bb,_0xdc8e65,!![]);}catch(_0x48c21d){return BPromise[_0x8d7b('0x20')](_0x48c21d);}return _0x1b51bb[_0x8d7b('0x21')]();};}function saveUpdates(_0xf9fd28,_0x5dafed){return function(_0x3cce41){if(_0x3cce41){return _0x3cce41[_0x8d7b('0x22')](_0xf9fd28)['then'](function(_0x49927f){return _0x49927f;});}return null;};}function removeEntity(_0x3f832f,_0x5c27e8){return function(_0x4136e8){if(_0x4136e8){return _0x4136e8[_0x8d7b('0x23')]()[_0x8d7b('0x24')](function(){_0x3f832f[_0x8d7b('0x18')](0xcc)[_0x8d7b('0x25')]();});}};}function handleEntityNotFound(_0x52c9b0,_0x5d0afd){return function(_0x1f8398){if(!_0x1f8398){_0x52c9b0[_0x8d7b('0x17')](0x194);}return _0x1f8398;};}function handleError(_0x98b209,_0x52d4eb){_0x52d4eb=_0x52d4eb||0x1f4;return function(_0x41e6eb){logger[_0x8d7b('0x26')](_0x41e6eb[_0x8d7b('0x27')]);if(_0x41e6eb[_0x8d7b('0x28')]){delete _0x41e6eb['name'];}_0x98b209['status'](_0x52d4eb)[_0x8d7b('0x29')](_0x41e6eb);};}exports['index']=function(_0x5962b6,_0x19c15a){var _0xf9826f={},_0x319348={},_0x48f7df={'count':0x0,'rows':[]};var _0x167409=_['map'](db[_0x8d7b('0x2a')][_0x8d7b('0x2b')],function(_0x305318){return{'name':_0x305318[_0x8d7b('0x2c')],'type':_0x305318[_0x8d7b('0x2d')][_0x8d7b('0x2e')]};});_0x319348['model']=_[_0x8d7b('0x2f')](_0x167409,'name');_0x319348[_0x8d7b('0x30')]=_['keys'](_0x5962b6['query']);_0x319348['filters']=_[_0x8d7b('0x31')](_0x319348[_0x8d7b('0x32')],_0x319348[_0x8d7b('0x30')]);_0xf9826f[_0x8d7b('0x33')]=_[_0x8d7b('0x31')](_0x319348[_0x8d7b('0x32')],qs[_0x8d7b('0x34')](_0x5962b6['query'][_0x8d7b('0x34')]));_0xf9826f[_0x8d7b('0x33')]=_0xf9826f[_0x8d7b('0x33')]['length']?_0xf9826f['attributes']:_0x319348[_0x8d7b('0x32')];if(!_0x5962b6[_0x8d7b('0x30')][_0x8d7b('0x35')](_0x8d7b('0x36'))){_0xf9826f['limit']=qs['limit'](_0x5962b6['query']['limit']);_0xf9826f[_0x8d7b('0x1b')]=qs[_0x8d7b('0x1b')](_0x5962b6[_0x8d7b('0x30')][_0x8d7b('0x1b')]);}_0xf9826f[_0x8d7b('0x37')]=qs[_0x8d7b('0x38')](_0x5962b6['query']['sort']);_0xf9826f[_0x8d7b('0x39')]=qs['filters'](_[_0x8d7b('0x3a')](_0x5962b6[_0x8d7b('0x30')],_0x319348[_0x8d7b('0x3b')]),_0x167409);if(_0x5962b6[_0x8d7b('0x30')]['filter']){_0xf9826f['where']=_[_0x8d7b('0x3c')](_0xf9826f[_0x8d7b('0x39')],{'$or':_[_0x8d7b('0x2f')](_0x167409,function(_0xc868fc){if(_0xc868fc[_0x8d7b('0x2d')]!=='VIRTUAL'){var _0x43ad6e={};_0x43ad6e[_0xc868fc[_0x8d7b('0x28')]]={'$like':'%'+_0x5962b6[_0x8d7b('0x30')][_0x8d7b('0x3d')]+'%'};return _0x43ad6e;}})});}_0xf9826f=_['merge']({},_0xf9826f,_0x5962b6['options']);var _0x2d08e0={'where':_0xf9826f[_0x8d7b('0x39')]};return db[_0x8d7b('0x2a')]['count'](_0x2d08e0)[_0x8d7b('0x24')](function(_0x66f6b0){_0x48f7df['count']=_0x66f6b0;if(_0x5962b6['query'][_0x8d7b('0x3e')]){_0xf9826f[_0x8d7b('0x3f')]=[{'all':!![]}];}return db[_0x8d7b('0x2a')][_0x8d7b('0x40')](_0xf9826f);})['then'](function(_0x57126c){_0x48f7df[_0x8d7b('0x41')]=_0x57126c;return _0x48f7df;})[_0x8d7b('0x24')](respondWithFilteredResult(_0x19c15a,_0xf9826f))['catch'](handleError(_0x19c15a,null));};exports[_0x8d7b('0x42')]=function(_0x59e43d,_0x5e68e7){var _0xf8f857={'raw':!![],'where':{'id':_0x59e43d[_0x8d7b('0x43')]['id']}},_0x36dea6={};_0x36dea6[_0x8d7b('0x32')]=_[_0x8d7b('0x44')](db[_0x8d7b('0x2a')]['rawAttributes']);_0x36dea6[_0x8d7b('0x30')]=_[_0x8d7b('0x44')](_0x59e43d[_0x8d7b('0x30')]);_0x36dea6[_0x8d7b('0x3b')]=_[_0x8d7b('0x31')](_0x36dea6['model'],_0x36dea6[_0x8d7b('0x30')]);_0xf8f857[_0x8d7b('0x33')]=_[_0x8d7b('0x31')](_0x36dea6[_0x8d7b('0x32')],qs[_0x8d7b('0x34')](_0x59e43d[_0x8d7b('0x30')]['fields']));_0xf8f857['attributes']=_0xf8f857['attributes'][_0x8d7b('0x45')]?_0xf8f857[_0x8d7b('0x33')]:_0x36dea6[_0x8d7b('0x32')];if(_0x59e43d[_0x8d7b('0x30')][_0x8d7b('0x3e')]){_0xf8f857[_0x8d7b('0x3f')]=[{'all':!![]}];}_0xf8f857=_['merge']({},_0xf8f857,_0x59e43d['options']);return db[_0x8d7b('0x2a')]['find'](_0xf8f857)[_0x8d7b('0x24')](handleEntityNotFound(_0x5e68e7,null))['then'](respondWithResult(_0x5e68e7,null))['catch'](handleError(_0x5e68e7,null));};exports[_0x8d7b('0x46')]=function(_0x454d70,_0x45daab){return db[_0x8d7b('0x2a')][_0x8d7b('0x46')](_0x454d70['body'],{})[_0x8d7b('0x24')](respondWithResult(_0x45daab,0xc9))['catch'](handleError(_0x45daab,null));};exports[_0x8d7b('0x22')]=function(_0xc8e229,_0x1eff46){if(_0xc8e229['body']['id']){delete _0xc8e229[_0x8d7b('0x47')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0xc8e229[_0x8d7b('0x43')]['id']}})[_0x8d7b('0x24')](handleEntityNotFound(_0x1eff46,null))[_0x8d7b('0x24')](saveUpdates(_0xc8e229[_0x8d7b('0x47')],null))['then'](respondWithResult(_0x1eff46,null))[_0x8d7b('0x48')](handleError(_0x1eff46,null));};exports[_0x8d7b('0x23')]=function(_0x38bf38,_0x5efa26){return db[_0x8d7b('0x2a')]['find']({'where':{'id':_0x38bf38['params']['id']}})['then'](handleEntityNotFound(_0x5efa26,null))[_0x8d7b('0x24')](removeEntity(_0x5efa26,null))['catch'](handleError(_0x5efa26,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ebf1ff6..99b31a8 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 _0x49e5=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','idField'];(function(_0x47786b,_0x5453e8){var _0x8eb999=function(_0xaeab7a){while(--_0xaeab7a){_0x47786b['push'](_0x47786b['shift']());}};_0x8eb999(++_0x5453e8);}(_0x49e5,0x196));var _0x549e=function(_0xd0b0ec,_0x1fc627){_0xd0b0ec=_0xd0b0ec-0x0;var _0x155ccc=_0x49e5[_0xd0b0ec];return _0x155ccc;};'use strict';var _=require(_0x549e('0x0'));var util=require(_0x549e('0x1'));var logger=require(_0x549e('0x2'))(_0x549e('0x3'));var moment=require(_0x549e('0x4'));var BPromise=require(_0x549e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x549e('0x6'));var rimraf=require(_0x549e('0x7'));var config=require(_0x549e('0x8'));var attributes=require(_0x549e('0x9'));module[_0x549e('0xa')]=function(_0x480e2c,_0x1b110f){return _0x480e2c[_0x549e('0xb')](_0x549e('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x549e('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e3c=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','idField','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x313754,_0x147f5e){var _0x5a3f2a=function(_0x28267e){while(--_0x28267e){_0x313754['push'](_0x313754['shift']());}};_0x5a3f2a(++_0x147f5e);}(_0x4e3c,0x1b4));var _0xc4e3=function(_0x50f9ab,_0x5009b4){_0x50f9ab=_0x50f9ab-0x0;var _0x58dda4=_0x4e3c[_0x50f9ab];return _0x58dda4;};'use strict';var _=require('lodash');var util=require(_0xc4e3('0x0'));var logger=require(_0xc4e3('0x1'))('api');var moment=require(_0xc4e3('0x2'));var BPromise=require(_0xc4e3('0x3'));var rp=require(_0xc4e3('0x4'));var fs=require('fs');var path=require(_0xc4e3('0x5'));var rimraf=require(_0xc4e3('0x6'));var config=require(_0xc4e3('0x7'));var attributes=require(_0xc4e3('0x8'));module[_0xc4e3('0x9')]=function(_0x45eef0,_0x50f9b9){return _0x45eef0[_0xc4e3('0xa')]('SalesforceField',attributes,{'tableName':_0xc4e3('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xc4e3('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b265cd5..7a3d58e 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 _0x6f0d=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x2bdf61,_0x6660cc){var _0x10b5ff=function(_0x126e08){while(--_0x126e08){_0x2bdf61['push'](_0x2bdf61['shift']());}};_0x10b5ff(++_0x6660cc);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2ab679,_0x5e85c0){_0x2ab679=_0x2ab679-0x0;var _0x550386=_0x6f0d[_0x2ab679];return _0x550386;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0xf109=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x207ec9,_0x2e8510){var _0x964f6c=function(_0x5344fa){while(--_0x5344fa){_0x207ec9['push'](_0x207ec9['shift']());}};_0x964f6c(++_0x2e8510);}(_0xf109,0xce));var _0x9f10=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xf109[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x3'))['db'];var utils=require(_0x9f10('0x4'));var logger=require(_0x9f10('0x5'))(_0x9f10('0x6'));var config=require(_0x9f10('0x7'));var jayson=require(_0x9f10('0x8'));var client=jayson[_0x9f10('0x9')][_0x9f10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a29,_0x2a877e,_0x3fd82f){return new BPromise(function(_0x5c8719,_0x42a8cd){return client[_0x9f10('0xb')](_0x227a29,_0x3fd82f)[_0x9f10('0xc')](function(_0x1bde2e){logger[_0x9f10('0xd')]('SalesforceField,\x20%s,\x20%s',_0x2a877e,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x2a877e,'request\x20sent',JSON['stringify'](_0x1bde2e));if(_0x1bde2e[_0x9f10('0x11')]){if(_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x12')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x42a8cd(_0x1bde2e['error'][_0x9f10('0x14')]);}logger[_0x9f10('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x5c8719(_0x1bde2e['error']['message']);}else{logger[_0x9f10('0xd')](_0x9f10('0x13'),_0x2a877e,'request\x20sent');_0x5c8719(_0x1bde2e[_0x9f10('0x15')]['message']);}})[_0x9f10('0x16')](function(_0x1f68d8){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1f68d8);_0x42a8cd(_0x1f68d8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 718cd80..27f858c 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 _0xc23a=['exports','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','create','/:id/configurations','addConfiguration','put','/:id','update','delete'];(function(_0x183ffc,_0x37e6f5){var _0x536c48=function(_0x20473d){while(--_0x20473d){_0x183ffc['push'](_0x183ffc['shift']());}};_0x536c48(++_0x37e6f5);}(_0xc23a,0xd2));var _0xac23=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xc23a[_0x4d8666];return _0x37175b;};'use strict';var multer=require('multer');var util=require(_0xac23('0x0'));var path=require(_0xac23('0x1'));var timeout=require(_0xac23('0x2'));var express=require('express');var router=express[_0xac23('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac23('0x4'));var controller=require('./intServicenowAccount.controller');router[_0xac23('0x5')]('/',auth[_0xac23('0x6')](),controller[_0xac23('0x7')]);router['get']('/:id',auth[_0xac23('0x6')](),controller[_0xac23('0x8')]);router[_0xac23('0x5')]('/:id/configurations',auth[_0xac23('0x6')](),controller[_0xac23('0x9')]);router[_0xac23('0x5')](_0xac23('0xa'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xac23('0x6')](),controller[_0xac23('0xb')]);router['post'](_0xac23('0xc'),auth[_0xac23('0x6')](),controller[_0xac23('0xd')]);router[_0xac23('0xe')](_0xac23('0xf'),auth[_0xac23('0x6')](),controller[_0xac23('0x10')]);router[_0xac23('0x11')](_0xac23('0xf'),auth[_0xac23('0x6')](),controller['destroy']);module[_0xac23('0x12')]=router; \ No newline at end of file +var _0x3379=['isAuthenticated','index','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x23e0fe,_0x568b82){var _0x38491f=function(_0x4013d6){while(--_0x4013d6){_0x23e0fe['push'](_0x23e0fe['shift']());}};_0x38491f(++_0x568b82);}(_0x3379,0x115));var _0x9337=function(_0x35c3c8,_0x5adb61){_0x35c3c8=_0x35c3c8-0x0;var _0x1b5d50=_0x3379[_0x35c3c8];return _0x1b5d50;};'use strict';var multer=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var path=require(_0x9337('0x2'));var timeout=require(_0x9337('0x3'));var express=require('express');var router=express[_0x9337('0x4')]();var auth=require(_0x9337('0x5'));var interaction=require(_0x9337('0x6'));var config=require(_0x9337('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x9337('0x8')]('/',auth[_0x9337('0x9')](),controller[_0x9337('0xa')]);router[_0x9337('0x8')]('/:id',auth[_0x9337('0x9')](),controller['show']);router[_0x9337('0x8')](_0x9337('0xb'),auth[_0x9337('0x9')](),controller[_0x9337('0xc')]);router[_0x9337('0x8')]('/:id/fields',auth[_0x9337('0x9')](),controller[_0x9337('0xd')]);router[_0x9337('0xe')]('/',auth[_0x9337('0x9')](),controller[_0x9337('0xf')]);router['post'](_0x9337('0xb'),auth[_0x9337('0x9')](),controller[_0x9337('0x10')]);router[_0x9337('0x11')](_0x9337('0x12'),auth[_0x9337('0x9')](),controller[_0x9337('0x13')]);router['delete']('/:id',auth[_0x9337('0x9')](),controller[_0x9337('0x14')]);module[_0x9337('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 00103bd..c58cfd0 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 _0x24fa=['STRING','username','sequelize','exports'];(function(_0x2f3ac8,_0xc69934){var _0x391e67=function(_0x50d8e0){while(--_0x50d8e0){_0x2f3ac8['push'](_0x2f3ac8['shift']());}};_0x391e67(++_0xc69934);}(_0x24fa,0x112));var _0xa24f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24fa[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xa24f('0x0'));module[_0xa24f('0x1')]={'name':{'type':Sequelize[_0xa24f('0x2')]},'description':{'type':Sequelize[_0xa24f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xa24f('0x3')},'password':{'type':Sequelize[_0xa24f('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa24f('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa24f('0x2')]}}; \ No newline at end of file +var _0x81ba=['sequelize','exports','STRING','username','remoteUri'];(function(_0x43d98c,_0x1f7bab){var _0x12dc8d=function(_0xfbaa09){while(--_0xfbaa09){_0x43d98c['push'](_0x43d98c['shift']());}};_0x12dc8d(++_0x1f7bab);}(_0x81ba,0x69));var _0xa81b=function(_0x217066,_0x25e7ab){_0x217066=_0x217066-0x0;var _0x3dbcff=_0x81ba[_0x217066];return _0x3dbcff;};'use strict';var Sequelize=require(_0xa81b('0x0'));module[_0xa81b('0x1')]={'name':{'type':Sequelize[_0xa81b('0x2')]},'description':{'type':Sequelize[_0xa81b('0x2')]},'username':{'type':Sequelize[_0xa81b('0x2')],'unique':_0xa81b('0x3')},'password':{'type':Sequelize[_0xa81b('0x2')]},'email':{'type':Sequelize[_0xa81b('0x2')]},'remoteUri':{'type':Sequelize[_0xa81b('0x2')],'unique':_0xa81b('0x4')},'serverUrl':{'type':Sequelize[_0xa81b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 440eb30..c29bdbd 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 _0x61bb=['request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','end','sendStatus','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','intersection','create','body','update','find','params','getConfigurations','findOne','ServicenowConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','knowledge','subcategory','close_code','incident_state','category','parent','made_sla','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','activity_due','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','includes','forEach','internalType','label','push','TCL:\x20_object','remove','all','concat','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s'];(function(_0x16b853,_0x235257){var _0x2f3033=function(_0x21f717){while(--_0x21f717){_0x16b853['push'](_0x16b853['shift']());}};_0x2f3033(++_0x235257);}(_0x61bb,0xa1));var _0xb61b=function(_0x5c3be3,_0x1cb85e){_0x5c3be3=_0x5c3be3-0x0;var _0x547377=_0x61bb[_0x5c3be3];return _0x547377;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb61b('0x0'));var rimraf=require(_0xb61b('0x1'));var zipdir=require(_0xb61b('0x2'));var jsonpatch=require(_0xb61b('0x3'));var rp=require(_0xb61b('0x4'));var moment=require(_0xb61b('0x5'));var BPromise=require(_0xb61b('0x6'));var Mustache=require(_0xb61b('0x7'));var util=require(_0xb61b('0x8'));var path=require(_0xb61b('0x9'));var sox=require(_0xb61b('0xa'));var csv=require(_0xb61b('0xb'));var ejs=require(_0xb61b('0xc'));var fs=require('fs');var _=require(_0xb61b('0xd'));var squel=require(_0xb61b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb61b('0xb'));var querystring=require(_0xb61b('0xf'));var Papa=require(_0xb61b('0x10'));var Redis=require(_0xb61b('0x11'));var authService=require(_0xb61b('0x12'));var qs=require(_0xb61b('0x13'));var as=require(_0xb61b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb61b('0x15'))(_0xb61b('0x16'));var utils=require(_0xb61b('0x17'));var config=require(_0xb61b('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xb61b('0x19')][_0xb61b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4617d3,_0x374e2e,_0x544123){if(_0x544123){var _0x2545c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2545c7['test'](_0x374e2e)){return _0x4617d3;}else{throw new db[(_0xb61b('0x1b'))]['ValidationError'](_0xb61b('0x1c'));}}else{return _0x4617d3;}}function respondWithRpcPromise(_0x52fe98,_0x567bbc,_0x270497,_0xcf1d88){return new BPromise(function(_0xccb57a,_0x324bc8){var _0x283b2c=_0xcf1d88||client;return _0x283b2c[_0xb61b('0x1d')](_0x52fe98,_0x270497)[_0xb61b('0x1e')](function(_0x48ea41){logger[_0xb61b('0x1f')](_0xb61b('0x20'),_0x567bbc,_0xb61b('0x21'));logger[_0xb61b('0x22')](_0xb61b('0x23'),_0x567bbc,_0xb61b('0x21'),JSON[_0xb61b('0x24')](_0x48ea41));if(_0x48ea41[_0xb61b('0x25')]){if(_0x48ea41[_0xb61b('0x25')]['code']===0x1f4){logger[_0xb61b('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x567bbc,_0x48ea41[_0xb61b('0x25')][_0xb61b('0x26')]);return _0x324bc8(_0x48ea41[_0xb61b('0x25')][_0xb61b('0x26')]);}logger['error'](_0xb61b('0x20'),_0x567bbc,_0x48ea41['error']['message']);return _0xccb57a(_0x48ea41['error'][_0xb61b('0x26')]);}else{logger[_0xb61b('0x1f')](_0xb61b('0x20'),_0x567bbc,_0xb61b('0x21'));_0xccb57a(_0x48ea41['result']['message']);}})['catch'](function(_0x3a0060){logger[_0xb61b('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x567bbc,_0x3a0060);_0x324bc8(_0x3a0060);});});}function respondWithStatusCode(_0x5ca62e,_0xd3055){_0xd3055=_0xd3055||0xcc;return function(_0x1d3309){if(_0x1d3309){return _0x5ca62e['sendStatus'](_0xd3055);}return _0x5ca62e[_0xb61b('0x27')](_0xd3055)['end']();};}function respondWithResult(_0x4de95b,_0x40fd8c){_0x40fd8c=_0x40fd8c||0xc8;return function(_0x1acbd6){if(_0x1acbd6){return _0x4de95b['status'](_0x40fd8c)[_0xb61b('0x28')](_0x1acbd6);}};}function respondWithFilteredResult(_0x662b98,_0x48f9a0){return function(_0x431ae4){if(_0x431ae4){var _0x417c02=_0x431ae4[_0xb61b('0x29')],_0x1c4d4d=_0x48f9a0['offset'],_0x425ce8=_0x48f9a0[_0xb61b('0x2a')]+_0x48f9a0[_0xb61b('0x2b')],_0x5e78c8;if(_0x425ce8>=_0x417c02){_0x425ce8=_0x417c02;_0x5e78c8=0xc8;}else{_0x5e78c8=0xce;}_0x662b98[_0xb61b('0x27')](_0x5e78c8);return _0x662b98[_0xb61b('0x2c')](_0xb61b('0x2d'),_0x1c4d4d+'-'+_0x425ce8+'/'+_0x417c02)[_0xb61b('0x28')](_0x431ae4);}return null;};}function patchUpdates(_0x150568){return function(_0x169dce){try{jsonpatch['apply'](_0x169dce,_0x150568,!![]);}catch(_0x597cb2){return BPromise[_0xb61b('0x2e')](_0x597cb2);}return _0x169dce[_0xb61b('0x2f')]();};}function saveUpdates(_0x1d6c53,_0xe00564){return function(_0x2ff298){if(_0x2ff298){return _0x2ff298['update'](_0x1d6c53)[_0xb61b('0x1e')](function(_0x3b4294){return _0x3b4294;});}return null;};}function removeEntity(_0x14731d,_0xa269f6){return function(_0x13b38a){if(_0x13b38a){return _0x13b38a[_0xb61b('0x30')]()[_0xb61b('0x1e')](function(){_0x14731d[_0xb61b('0x27')](0xcc)[_0xb61b('0x31')]();});}};}function handleEntityNotFound(_0x3e73aa,_0xde96f0){return function(_0xd79546){if(!_0xd79546){_0x3e73aa[_0xb61b('0x32')](0x194);}return _0xd79546;};}function handleError(_0x2186ad,_0x28d739){_0x28d739=_0x28d739||0x1f4;return function(_0x51269b){logger[_0xb61b('0x25')](_0x51269b[_0xb61b('0x33')]);if(_0x51269b[_0xb61b('0x34')]){delete _0x51269b[_0xb61b('0x34')];}_0x2186ad[_0xb61b('0x27')](_0x28d739)[_0xb61b('0x35')](_0x51269b);};}exports[_0xb61b('0x36')]=function(_0x904f9d,_0x2882ae){var _0x2e4a2c={},_0x8527f3={},_0x1f5783={'count':0x0,'rows':[]};var _0x58ba9b=_[_0xb61b('0x37')](db[_0xb61b('0x38')][_0xb61b('0x39')],function(_0x4a5b5a){return{'name':_0x4a5b5a[_0xb61b('0x3a')],'type':_0x4a5b5a[_0xb61b('0x3b')][_0xb61b('0x3c')]};});_0x8527f3[_0xb61b('0x3d')]=_[_0xb61b('0x37')](_0x58ba9b,_0xb61b('0x34'));_0x8527f3['query']=_[_0xb61b('0x3e')](_0x904f9d['query']);_0x8527f3[_0xb61b('0x3f')]=_['intersection'](_0x8527f3[_0xb61b('0x3d')],_0x8527f3[_0xb61b('0x40')]);_0x2e4a2c['attributes']=_['intersection'](_0x8527f3[_0xb61b('0x3d')],qs[_0xb61b('0x41')](_0x904f9d[_0xb61b('0x40')][_0xb61b('0x41')]));_0x2e4a2c[_0xb61b('0x42')]=_0x2e4a2c[_0xb61b('0x42')][_0xb61b('0x43')]?_0x2e4a2c[_0xb61b('0x42')]:_0x8527f3['model'];if(!_0x904f9d['query'][_0xb61b('0x44')](_0xb61b('0x45'))){_0x2e4a2c[_0xb61b('0x2b')]=qs[_0xb61b('0x2b')](_0x904f9d[_0xb61b('0x40')][_0xb61b('0x2b')]);_0x2e4a2c[_0xb61b('0x2a')]=qs[_0xb61b('0x2a')](_0x904f9d[_0xb61b('0x40')][_0xb61b('0x2a')]);}_0x2e4a2c[_0xb61b('0x46')]=qs['sort'](_0x904f9d[_0xb61b('0x40')]['sort']);_0x2e4a2c[_0xb61b('0x47')]=qs[_0xb61b('0x3f')](_[_0xb61b('0x48')](_0x904f9d['query'],_0x8527f3[_0xb61b('0x3f')]),_0x58ba9b);if(_0x904f9d[_0xb61b('0x40')][_0xb61b('0x49')]){_0x2e4a2c['where']=_[_0xb61b('0x4a')](_0x2e4a2c[_0xb61b('0x47')],{'$or':_[_0xb61b('0x37')](_0x58ba9b,function(_0x14870a){if(_0x14870a['type']!==_0xb61b('0x4b')){var _0x46c789={};_0x46c789[_0x14870a[_0xb61b('0x34')]]={'$like':'%'+_0x904f9d[_0xb61b('0x40')][_0xb61b('0x49')]+'%'};return _0x46c789;}})});}_0x2e4a2c=_['merge']({},_0x2e4a2c,_0x904f9d[_0xb61b('0x4c')]);var _0x45b007={'where':_0x2e4a2c[_0xb61b('0x47')]};return db[_0xb61b('0x38')][_0xb61b('0x29')](_0x45b007)[_0xb61b('0x1e')](function(_0x2d9b4d){_0x1f5783[_0xb61b('0x29')]=_0x2d9b4d;if(_0x904f9d[_0xb61b('0x40')][_0xb61b('0x4d')]){_0x2e4a2c['include']=[{'all':!![]}];}return db[_0xb61b('0x38')][_0xb61b('0x4e')](_0x2e4a2c);})[_0xb61b('0x1e')](function(_0x4ee218){_0x1f5783[_0xb61b('0x4f')]=_0x4ee218;return _0x1f5783;})[_0xb61b('0x1e')](respondWithFilteredResult(_0x2882ae,_0x2e4a2c))[_0xb61b('0x50')](handleError(_0x2882ae,null));};exports[_0xb61b('0x51')]=function(_0x57dafd,_0x4f13eb){var _0xecb81f={'raw':![],'where':{'id':_0x57dafd['params']['id']}},_0x36ff22={};_0x36ff22[_0xb61b('0x3d')]=_['keys'](db[_0xb61b('0x38')][_0xb61b('0x39')]);_0x36ff22[_0xb61b('0x40')]=_['keys'](_0x57dafd[_0xb61b('0x40')]);_0x36ff22[_0xb61b('0x3f')]=_[_0xb61b('0x52')](_0x36ff22[_0xb61b('0x3d')],_0x36ff22[_0xb61b('0x40')]);_0xecb81f[_0xb61b('0x42')]=_[_0xb61b('0x52')](_0x36ff22[_0xb61b('0x3d')],qs[_0xb61b('0x41')](_0x57dafd[_0xb61b('0x40')][_0xb61b('0x41')]));_0xecb81f['attributes']=_0xecb81f[_0xb61b('0x42')][_0xb61b('0x43')]?_0xecb81f[_0xb61b('0x42')]:_0x36ff22[_0xb61b('0x3d')];if(_0x57dafd[_0xb61b('0x40')]['includeAll']){_0xecb81f['include']=[{'all':!![]}];}_0xecb81f=_[_0xb61b('0x4a')]({},_0xecb81f,_0x57dafd[_0xb61b('0x4c')]);return db[_0xb61b('0x38')]['find'](_0xecb81f)[_0xb61b('0x1e')](handleEntityNotFound(_0x4f13eb,null))[_0xb61b('0x1e')](respondWithResult(_0x4f13eb,null))[_0xb61b('0x50')](handleError(_0x4f13eb,null));};exports[_0xb61b('0x53')]=function(_0x35b0b5,_0x34ff2c){return db[_0xb61b('0x38')][_0xb61b('0x53')](_0x35b0b5[_0xb61b('0x54')],{})[_0xb61b('0x1e')](respondWithResult(_0x34ff2c,0xc9))[_0xb61b('0x50')](handleError(_0x34ff2c,null));};exports[_0xb61b('0x55')]=function(_0x4f3699,_0xcabd75){if(_0x4f3699[_0xb61b('0x54')]['id']){delete _0x4f3699[_0xb61b('0x54')]['id'];}return db[_0xb61b('0x38')][_0xb61b('0x56')]({'where':{'id':_0x4f3699[_0xb61b('0x57')]['id']}})[_0xb61b('0x1e')](handleEntityNotFound(_0xcabd75,null))[_0xb61b('0x1e')](saveUpdates(_0x4f3699['body'],null))['then'](respondWithResult(_0xcabd75,null))[_0xb61b('0x50')](handleError(_0xcabd75,null));};exports[_0xb61b('0x30')]=function(_0x2e8ef4,_0x29319c){return db['ServicenowAccount'][_0xb61b('0x56')]({'where':{'id':_0x2e8ef4['params']['id']}})[_0xb61b('0x1e')](handleEntityNotFound(_0x29319c,null))[_0xb61b('0x1e')](removeEntity(_0x29319c,null))[_0xb61b('0x50')](handleError(_0x29319c,null));};exports[_0xb61b('0x58')]=function(_0x2e7f0a,_0x5d2445,_0x1000ca){var _0x266a05={};var _0x569ae2={};var _0x47422b;var _0x337b30;return db[_0xb61b('0x38')][_0xb61b('0x59')]({'where':{'id':_0x2e7f0a[_0xb61b('0x57')]['id']}})[_0xb61b('0x1e')](handleEntityNotFound(_0x5d2445,null))[_0xb61b('0x1e')](function(_0x34e7e8){if(_0x34e7e8){_0x47422b=_0x34e7e8;_0x569ae2[_0xb61b('0x3d')]=_[_0xb61b('0x3e')](db[_0xb61b('0x5a')][_0xb61b('0x39')]);_0x569ae2[_0xb61b('0x40')]=_[_0xb61b('0x3e')](_0x2e7f0a['query']);_0x569ae2[_0xb61b('0x3f')]=_[_0xb61b('0x52')](_0x569ae2[_0xb61b('0x3d')],_0x569ae2[_0xb61b('0x40')]);_0x266a05[_0xb61b('0x42')]=_['intersection'](_0x569ae2['model'],qs[_0xb61b('0x41')](_0x2e7f0a['query']['fields']));_0x266a05[_0xb61b('0x42')]=_0x266a05[_0xb61b('0x42')]['length']?_0x266a05[_0xb61b('0x42')]:_0x569ae2[_0xb61b('0x3d')];_0x266a05[_0xb61b('0x46')]=qs[_0xb61b('0x5b')](_0x2e7f0a[_0xb61b('0x40')][_0xb61b('0x5b')]);_0x266a05[_0xb61b('0x47')]=qs['filters'](_[_0xb61b('0x48')](_0x2e7f0a[_0xb61b('0x40')],_0x569ae2[_0xb61b('0x3f')]));if(_0x2e7f0a['query'][_0xb61b('0x49')]){_0x266a05[_0xb61b('0x47')]=_[_0xb61b('0x4a')](_0x266a05['where'],{'$or':_[_0xb61b('0x37')](_0x266a05[_0xb61b('0x42')],function(_0x20a070){var _0x2e766d={};_0x2e766d[_0x20a070]={'$like':'%'+_0x2e7f0a[_0xb61b('0x40')][_0xb61b('0x49')]+'%'};return _0x2e766d;})});}_0x266a05=_[_0xb61b('0x4a')]({},_0x266a05,_0x2e7f0a[_0xb61b('0x4c')]);return _0x47422b[_0xb61b('0x58')](_0x266a05);}})[_0xb61b('0x1e')](function(_0x446c93){if(_0x446c93){_0x337b30=_0x446c93[_0xb61b('0x43')];if(!_0x2e7f0a[_0xb61b('0x40')][_0xb61b('0x44')](_0xb61b('0x45'))){_0x266a05['limit']=qs[_0xb61b('0x2b')](_0x2e7f0a[_0xb61b('0x40')]['limit']);_0x266a05[_0xb61b('0x2a')]=qs[_0xb61b('0x2a')](_0x2e7f0a['query'][_0xb61b('0x2a')]);}return _0x47422b[_0xb61b('0x58')](_0x266a05);}})['then'](function(_0x5a1b9f){if(_0x5a1b9f){return _0x5a1b9f?{'count':_0x337b30,'rows':_0x5a1b9f}:null;}})['then'](respondWithResult(_0x5d2445,null))[_0xb61b('0x50')](handleError(_0x5d2445,null));};exports[_0xb61b('0x5c')]=function(_0x467b89,_0x5bddf3,_0x579484){if(_0x467b89[_0xb61b('0x54')]['id']){delete _0x467b89[_0xb61b('0x54')]['id'];}return db[_0xb61b('0x38')][_0xb61b('0x59')]({'where':{'id':_0x467b89[_0xb61b('0x57')]['id']}})[_0xb61b('0x1e')](handleEntityNotFound(_0x5bddf3,null))[_0xb61b('0x1e')](function(_0x319ee2){if(_0x319ee2){_0x467b89[_0xb61b('0x54')][_0xb61b('0x5d')]=_0x319ee2['id'];_0x467b89['body'][_0xb61b('0x5e')]=integrations[_0xb61b('0x5f')](_0x467b89['body'][_0xb61b('0x60')],_0x467b89[_0xb61b('0x54')][_0xb61b('0x3b')]);_0x467b89[_0xb61b('0x54')][_0xb61b('0x61')]=integrations[_0xb61b('0x62')](_0x467b89['body'][_0xb61b('0x60')],_0x467b89['body']['type']);return db['ServicenowConfiguration'][_0xb61b('0x53')](_0x467b89[_0xb61b('0x54')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xb61b('0x63')],'as':_0xb61b('0x61')}]});}return null;})[_0xb61b('0x1e')](respondWithResult(_0x5bddf3,null))[_0xb61b('0x50')](handleError(_0x5bddf3,null));};exports['getFields']=function(_0x5c31ef,_0x5afdfc,_0x4395df){var _0x4f3b17=['made_sla','hold_reason',_0xb61b('0x64'),_0xb61b('0x65'),_0xb61b('0x66'),'notify',_0xb61b('0x67'),'severity',_0xb61b('0x68')];var _0x5b54c2=[_0xb61b('0x69'),_0xb61b('0x6a'),'caused_by',_0xb61b('0x6b'),_0xb61b('0x6c'),_0xb61b('0x6d'),_0xb61b('0x6e'),'hold_reason',_0xb61b('0x6f'),_0xb61b('0x70'),'resolved_by','sys_updated_by','opened_by','user_input','sys_created_on',_0xb61b('0x71'),_0xb61b('0x72'),_0xb61b('0x73'),_0xb61b('0x64'),'order',_0xb61b('0x74'),_0xb61b('0x75'),_0xb61b('0x76'),'delivery_plan','impact','active','work_notes_list','business_service','priority',_0xb61b('0x77'),_0xb61b('0x78'),_0xb61b('0x79'),_0xb61b('0x7a'),_0xb61b('0x7b'),_0xb61b('0x7c'),_0xb61b('0x7d'),'work_end',_0xb61b('0x7e'),_0xb61b('0x7f'),_0xb61b('0x80'),_0xb61b('0x81'),_0xb61b('0x65'),_0xb61b('0x82'),_0xb61b('0x83'),_0xb61b('0x66'),'correlation_display','delivery_task',_0xb61b('0x84'),_0xb61b('0x85'),_0xb61b('0x86'),_0xb61b('0x87'),_0xb61b('0x88'),_0xb61b('0x89'),_0xb61b('0x8a'),_0xb61b('0x8b'),'close_notes',_0xb61b('0x8c'),_0xb61b('0x8d'),_0xb61b('0x8e'),_0xb61b('0x8f'),_0xb61b('0x90'),_0xb61b('0x91'),_0xb61b('0x67'),'urgency',_0xb61b('0x92'),_0xb61b('0x93'),'reassignment_count',_0xb61b('0x94'),'assigned_to',_0xb61b('0x95'),_0xb61b('0x96'),_0xb61b('0x97'),_0xb61b('0x98'),_0xb61b('0x99'),_0xb61b('0x9a'),_0xb61b('0x9b'),_0xb61b('0x9c'),'sys_tags',_0xb61b('0x9d'),'upon_approval',_0xb61b('0x9e'),_0xb61b('0x9f'),_0xb61b('0x68')];var _0x26bbf8='';var _0x10ea5d='';var _0x1e6bcb=[];var _0x107092='';var _0x343aea='';var _0xd49085=[];var _0x81743b='';var _0x387ab9='';var _0x69a5f4={};var _0x267713='';return db[_0xb61b('0x38')]['findOne']({'where':{'id':_0x5c31ef[_0xb61b('0x57')]['id']},'attributes':['id',_0xb61b('0xa0'),_0xb61b('0xa1'),_0xb61b('0xa2'),_0xb61b('0xa3'),_0xb61b('0xa4')]})[_0xb61b('0x1e')](handleEntityNotFound(_0x5afdfc,null))[_0xb61b('0x1e')](function(_0x1f7438){if(_0x1f7438){_0x267713=_0x1f7438[_0xb61b('0xa3')];var _0x99e44=_0x267713[_0xb61b('0xa5')](-0x1);if(_0x99e44==='/'){_0x267713=_0x267713[_0xb61b('0xa6')](0x0,_0x267713[_0xb61b('0xa7')](_0x99e44));}_0x387ab9=util[_0xb61b('0xa8')](_0xb61b('0xa9'),_0x267713);_0x81743b=util[_0xb61b('0xa8')](_0xb61b('0xaa'),_0x267713);_0x69a5f4={'user':_0x1f7438[_0xb61b('0xa0')],'pass':_0x1f7438[_0xb61b('0xa1')]};var _0x22c460={'method':_0xb61b('0xab'),'uri':_0x387ab9+_0xb61b('0xac'),'auth':_0x69a5f4,'json':!![]};return rp(_0x22c460);}})[_0xb61b('0x1e')](function(_0x5def38){if(_0x5def38[_0xb61b('0xad')][_0xb61b('0x43')]>0x0){_0x26bbf8=_0x5def38['result'];}console[_0xb61b('0xae')]('incident\x20table\x20objects',_0x26bbf8);_0xd49085=[];_0x10ea5d=Object[_0xb61b('0xaf')]([],_0x26bbf8);_['remove'](_0x10ea5d,function(_0x48eab6){return!_0x4f3b17[_0xb61b('0xb0')](_0x48eab6[_0xb61b('0x34')]);});_0x10ea5d[_0xb61b('0xb1')](function(_0x297ee8){var _0x1b929b=createFieldObject(_0x81743b,_0x69a5f4,_0x297ee8[_0xb61b('0xb2')],_0x297ee8[_0xb61b('0x34')],_0x297ee8[_0xb61b('0xb3')],![]);_0xd49085[_0xb61b('0xb4')](_0x1b929b);});return Promise['all'](_0xd49085);})[_0xb61b('0x1e')](function(_0x43497c){_0x1e6bcb=_0x43497c;_0x107092=Object[_0xb61b('0xaf')]([],_0x26bbf8);console['log'](_0xb61b('0xb5'),_0x26bbf8);_[_0xb61b('0xb6')](_0x107092,function(_0x4648aa){return _0x5b54c2[_0xb61b('0xb0')](_0x4648aa[_0xb61b('0x34')]);});console[_0xb61b('0xae')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x107092);_0xd49085=[];_0x107092[_0xb61b('0xb1')](function(_0xe17c8){var _0xca204=createFieldObject(_0x81743b,_0x69a5f4,_0xe17c8[_0xb61b('0xb2')],_0xe17c8[_0xb61b('0x34')],_0xe17c8[_0xb61b('0xb3')],!![]);_0xd49085[_0xb61b('0xb4')](_0xca204);});return Promise[_0xb61b('0xb7')](_0xd49085);})[_0xb61b('0x1e')](function(_0x28b8fd){_0x343aea=_0x28b8fd;var _0x4753ad=_0x1e6bcb[_0xb61b('0xb8')](_0x343aea);return{'count':_0x4753ad[_0xb61b('0x43')],'rows':_0x4753ad};})[_0xb61b('0x1e')](respondWithResult(_0x5afdfc,null))[_0xb61b('0x50')](function(_0x274588){console[_0xb61b('0xae')]('ServiceNow\x20error:\x20'+_0x274588);var _0x29f9a1=_0x5c31ef[_0xb61b('0x40')][_0xb61b('0xb9')]?0x1f4:_0x274588['statusCode']||0x1f4;logger[_0xb61b('0x25')](_0x274588['stack']);delete _0x274588['name'];if(_0x29f9a1===0x191){_0x29f9a1=0x190;}_0x5afdfc[_0xb61b('0x27')](_0x29f9a1)[_0xb61b('0x35')](_0x5c31ef[_0xb61b('0x40')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x274588[_0xb61b('0xba')]}:_0x274588);});};function createFieldObject(_0x1fa650,_0x289255,_0x424744,_0x1a54b4,_0x342e98,_0x287c5a){return new Promise(function(_0x210aa6,_0x1be2a0){var _0x182934={'id':_0x1a54b4,'name':_0x342e98,'custom':_0x287c5a};if(_0x424744===_0xb61b('0xbb')){_0x182934[_0xb61b('0x4c')]=[{'name':_0xb61b('0xbc'),'value':_0xb61b('0xbd')},{'name':_0xb61b('0xbe'),'value':_0xb61b('0xbf')}];_0x210aa6(_0x182934);}else{var _0x3a226e={'method':_0xb61b('0xab'),'uri':_0x1fa650+_0xb61b('0xc0')+_0x1a54b4,'auth':_0x289255,'json':!![]};return rp(_0x3a226e)[_0xb61b('0x1e')](function(_0x105880){var _0x309679=[];if(_0x105880[_0xb61b('0xad')]['length']>0x0){_0x105880[_0xb61b('0xad')][_0xb61b('0xb1')](function(_0x317a73){if(_0x317a73[_0xb61b('0xc1')]==='false'){var _0x451ed9={'name':_0x317a73[_0xb61b('0xb3')],'value':_0x317a73['value']};_0x309679[_0xb61b('0xb4')](_0x451ed9);}});}_0x182934[_0xb61b('0x4c')]=_0x309679;if(_0x182934[_0xb61b('0x4c')][_0xb61b('0x43')]>0x0){_0x210aa6(_0x182934);}else{if(_0x287c5a==![]){_0x210aa6();}else{_0x210aa6(_0x182934);}}});}});} \ No newline at end of file +var _0xbd85=['fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','show','length','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','subcategory','close_code','notify','incident_state','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','closed_by','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','boolean','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../components/integrations/configuration','jayson/promise','client','http','ValidationError','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','ServicenowAccount','rawAttributes','type','model','keys','query','filters','intersection'];(function(_0x1ea029,_0x2bb3be){var _0x4e0f9e=function(_0x3cedf0){while(--_0x3cedf0){_0x1ea029['push'](_0x1ea029['shift']());}};_0x4e0f9e(++_0x2bb3be);}(_0xbd85,0x1f4));var _0x5bd8=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xbd85[_0x47adb8];return _0x4689a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5bd8('0x0'));var rimraf=require(_0x5bd8('0x1'));var zipdir=require(_0x5bd8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bd8('0x3'));var moment=require('moment');var BPromise=require(_0x5bd8('0x4'));var Mustache=require(_0x5bd8('0x5'));var util=require('util');var path=require(_0x5bd8('0x6'));var sox=require(_0x5bd8('0x7'));var csv=require(_0x5bd8('0x8'));var ejs=require(_0x5bd8('0x9'));var fs=require('fs');var _=require(_0x5bd8('0xa'));var squel=require('squel');var crypto=require(_0x5bd8('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bd8('0x8'));var querystring=require('querystring');var Papa=require(_0x5bd8('0xc'));var Redis=require('ioredis');var authService=require(_0x5bd8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5bd8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bd8('0xf'))(_0x5bd8('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x5bd8('0x11'));var jayson=require(_0x5bd8('0x12'));var client=jayson[_0x5bd8('0x13')][_0x5bd8('0x14')]({'port':0x232a});function checkPasswordPattern(_0x3b62bd,_0x5a5321,_0x345e5d){if(_0x345e5d){var _0x5266a5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5266a5['test'](_0x5a5321)){return _0x3b62bd;}else{throw new db['Sequelize'][(_0x5bd8('0x15'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3b62bd;}}function respondWithRpcPromise(_0x1c4244,_0x40d423,_0x59e54d,_0x26ba74){return new BPromise(function(_0x21dab6,_0x19145a){var _0x1595aa=_0x26ba74||client;return _0x1595aa[_0x5bd8('0x16')](_0x1c4244,_0x59e54d)[_0x5bd8('0x17')](function(_0x16c9bb){logger[_0x5bd8('0x18')](_0x5bd8('0x19'),_0x40d423,_0x5bd8('0x1a'));logger[_0x5bd8('0x1b')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x40d423,'request\x20sent',JSON['stringify'](_0x16c9bb));if(_0x16c9bb[_0x5bd8('0x1c')]){if(_0x16c9bb[_0x5bd8('0x1c')][_0x5bd8('0x1d')]===0x1f4){logger[_0x5bd8('0x1c')]('ServicenowAccount,\x20%s,\x20%s',_0x40d423,_0x16c9bb[_0x5bd8('0x1c')][_0x5bd8('0x1e')]);return _0x19145a(_0x16c9bb[_0x5bd8('0x1c')][_0x5bd8('0x1e')]);}logger['error'](_0x5bd8('0x19'),_0x40d423,_0x16c9bb['error'][_0x5bd8('0x1e')]);return _0x21dab6(_0x16c9bb[_0x5bd8('0x1c')][_0x5bd8('0x1e')]);}else{logger[_0x5bd8('0x18')](_0x5bd8('0x19'),_0x40d423,_0x5bd8('0x1a'));_0x21dab6(_0x16c9bb['result']['message']);}})[_0x5bd8('0x1f')](function(_0x18510a){logger[_0x5bd8('0x1c')](_0x5bd8('0x19'),_0x40d423,_0x18510a);_0x19145a(_0x18510a);});});}function respondWithStatusCode(_0x3a53d5,_0x1ba144){_0x1ba144=_0x1ba144||0xcc;return function(_0xa0c722){if(_0xa0c722){return _0x3a53d5[_0x5bd8('0x20')](_0x1ba144);}return _0x3a53d5['status'](_0x1ba144)[_0x5bd8('0x21')]();};}function respondWithResult(_0x2c917b,_0x2ef9ba){_0x2ef9ba=_0x2ef9ba||0xc8;return function(_0x4af9b8){if(_0x4af9b8){return _0x2c917b[_0x5bd8('0x22')](_0x2ef9ba)['json'](_0x4af9b8);}};}function respondWithFilteredResult(_0x966fb4,_0x3d30d0){return function(_0x5a6edd){if(_0x5a6edd){var _0x334c53=_0x5a6edd['count'],_0x10e238=_0x3d30d0[_0x5bd8('0x23')],_0x5abf50=_0x3d30d0[_0x5bd8('0x23')]+_0x3d30d0[_0x5bd8('0x24')],_0x136de9;if(_0x5abf50>=_0x334c53){_0x5abf50=_0x334c53;_0x136de9=0xc8;}else{_0x136de9=0xce;}_0x966fb4[_0x5bd8('0x22')](_0x136de9);return _0x966fb4[_0x5bd8('0x25')](_0x5bd8('0x26'),_0x10e238+'-'+_0x5abf50+'/'+_0x334c53)[_0x5bd8('0x27')](_0x5a6edd);}return null;};}function patchUpdates(_0x3fe55d){return function(_0x2bbad3){try{jsonpatch[_0x5bd8('0x28')](_0x2bbad3,_0x3fe55d,!![]);}catch(_0x42940b){return BPromise[_0x5bd8('0x29')](_0x42940b);}return _0x2bbad3['save']();};}function saveUpdates(_0x2b21cd,_0x37c8ad){return function(_0x14706d){if(_0x14706d){return _0x14706d[_0x5bd8('0x2a')](_0x2b21cd)['then'](function(_0x1fb24e){return _0x1fb24e;});}return null;};}function removeEntity(_0x193745,_0x5df645){return function(_0x1ffaac){if(_0x1ffaac){return _0x1ffaac[_0x5bd8('0x2b')]()[_0x5bd8('0x17')](function(){_0x193745[_0x5bd8('0x22')](0xcc)[_0x5bd8('0x21')]();});}};}function handleEntityNotFound(_0x2b0451,_0x2cbaa9){return function(_0x45adea){if(!_0x45adea){_0x2b0451['sendStatus'](0x194);}return _0x45adea;};}function handleError(_0x47eb54,_0x59dc94){_0x59dc94=_0x59dc94||0x1f4;return function(_0x54d641){logger[_0x5bd8('0x1c')](_0x54d641[_0x5bd8('0x2c')]);if(_0x54d641['name']){delete _0x54d641[_0x5bd8('0x2d')];}_0x47eb54[_0x5bd8('0x22')](_0x59dc94)[_0x5bd8('0x2e')](_0x54d641);};}exports['index']=function(_0x3d9a24,_0x1a1f04){var _0x15d85f={},_0x17f728={},_0x2c9ec4={'count':0x0,'rows':[]};var _0x53cf21=_['map'](db[_0x5bd8('0x2f')][_0x5bd8('0x30')],function(_0x54d298){return{'name':_0x54d298['fieldName'],'type':_0x54d298[_0x5bd8('0x31')]['key']};});_0x17f728[_0x5bd8('0x32')]=_['map'](_0x53cf21,_0x5bd8('0x2d'));_0x17f728['query']=_[_0x5bd8('0x33')](_0x3d9a24[_0x5bd8('0x34')]);_0x17f728[_0x5bd8('0x35')]=_['intersection'](_0x17f728['model'],_0x17f728[_0x5bd8('0x34')]);_0x15d85f['attributes']=_[_0x5bd8('0x36')](_0x17f728['model'],qs[_0x5bd8('0x37')](_0x3d9a24[_0x5bd8('0x34')][_0x5bd8('0x37')]));_0x15d85f[_0x5bd8('0x38')]=_0x15d85f[_0x5bd8('0x38')]['length']?_0x15d85f[_0x5bd8('0x38')]:_0x17f728['model'];if(!_0x3d9a24['query'][_0x5bd8('0x39')](_0x5bd8('0x3a'))){_0x15d85f[_0x5bd8('0x24')]=qs[_0x5bd8('0x24')](_0x3d9a24[_0x5bd8('0x34')][_0x5bd8('0x24')]);_0x15d85f[_0x5bd8('0x23')]=qs[_0x5bd8('0x23')](_0x3d9a24['query'][_0x5bd8('0x23')]);}_0x15d85f['order']=qs[_0x5bd8('0x3b')](_0x3d9a24[_0x5bd8('0x34')]['sort']);_0x15d85f[_0x5bd8('0x3c')]=qs[_0x5bd8('0x35')](_[_0x5bd8('0x3d')](_0x3d9a24[_0x5bd8('0x34')],_0x17f728[_0x5bd8('0x35')]),_0x53cf21);if(_0x3d9a24[_0x5bd8('0x34')][_0x5bd8('0x3e')]){_0x15d85f[_0x5bd8('0x3c')]=_[_0x5bd8('0x3f')](_0x15d85f['where'],{'$or':_[_0x5bd8('0x40')](_0x53cf21,function(_0x2a62a9){if(_0x2a62a9[_0x5bd8('0x31')]!==_0x5bd8('0x41')){var _0x2a79ea={};_0x2a79ea[_0x2a62a9[_0x5bd8('0x2d')]]={'$like':'%'+_0x3d9a24[_0x5bd8('0x34')][_0x5bd8('0x3e')]+'%'};return _0x2a79ea;}})});}_0x15d85f=_['merge']({},_0x15d85f,_0x3d9a24[_0x5bd8('0x42')]);var _0x4d7b99={'where':_0x15d85f[_0x5bd8('0x3c')]};return db[_0x5bd8('0x2f')][_0x5bd8('0x43')](_0x4d7b99)[_0x5bd8('0x17')](function(_0x4bc0d7){_0x2c9ec4[_0x5bd8('0x43')]=_0x4bc0d7;if(_0x3d9a24[_0x5bd8('0x34')][_0x5bd8('0x44')]){_0x15d85f[_0x5bd8('0x45')]=[{'all':!![]}];}return db[_0x5bd8('0x2f')][_0x5bd8('0x46')](_0x15d85f);})[_0x5bd8('0x17')](function(_0x4852cc){_0x2c9ec4[_0x5bd8('0x47')]=_0x4852cc;return _0x2c9ec4;})['then'](respondWithFilteredResult(_0x1a1f04,_0x15d85f))['catch'](handleError(_0x1a1f04,null));};exports[_0x5bd8('0x48')]=function(_0x193eca,_0x13c254){var _0x1c5da0={'raw':![],'where':{'id':_0x193eca['params']['id']}},_0x5e79e8={};_0x5e79e8[_0x5bd8('0x32')]=_['keys'](db['ServicenowAccount'][_0x5bd8('0x30')]);_0x5e79e8[_0x5bd8('0x34')]=_['keys'](_0x193eca['query']);_0x5e79e8[_0x5bd8('0x35')]=_[_0x5bd8('0x36')](_0x5e79e8[_0x5bd8('0x32')],_0x5e79e8['query']);_0x1c5da0[_0x5bd8('0x38')]=_[_0x5bd8('0x36')](_0x5e79e8[_0x5bd8('0x32')],qs[_0x5bd8('0x37')](_0x193eca['query'][_0x5bd8('0x37')]));_0x1c5da0[_0x5bd8('0x38')]=_0x1c5da0[_0x5bd8('0x38')][_0x5bd8('0x49')]?_0x1c5da0['attributes']:_0x5e79e8['model'];if(_0x193eca[_0x5bd8('0x34')][_0x5bd8('0x44')]){_0x1c5da0[_0x5bd8('0x45')]=[{'all':!![]}];}_0x1c5da0=_[_0x5bd8('0x3f')]({},_0x1c5da0,_0x193eca[_0x5bd8('0x42')]);return db['ServicenowAccount'][_0x5bd8('0x4a')](_0x1c5da0)[_0x5bd8('0x17')](handleEntityNotFound(_0x13c254,null))[_0x5bd8('0x17')](respondWithResult(_0x13c254,null))['catch'](handleError(_0x13c254,null));};exports[_0x5bd8('0x4b')]=function(_0x454d5a,_0x42f74e){return db[_0x5bd8('0x2f')]['create'](_0x454d5a[_0x5bd8('0x4c')],{})['then'](respondWithResult(_0x42f74e,0xc9))[_0x5bd8('0x1f')](handleError(_0x42f74e,null));};exports[_0x5bd8('0x2a')]=function(_0x3b2ad4,_0x22b727){if(_0x3b2ad4[_0x5bd8('0x4c')]['id']){delete _0x3b2ad4['body']['id'];}return db['ServicenowAccount'][_0x5bd8('0x4a')]({'where':{'id':_0x3b2ad4['params']['id']}})[_0x5bd8('0x17')](handleEntityNotFound(_0x22b727,null))['then'](saveUpdates(_0x3b2ad4[_0x5bd8('0x4c')],null))[_0x5bd8('0x17')](respondWithResult(_0x22b727,null))[_0x5bd8('0x1f')](handleError(_0x22b727,null));};exports[_0x5bd8('0x2b')]=function(_0x3df260,_0x155232){return db[_0x5bd8('0x2f')][_0x5bd8('0x4a')]({'where':{'id':_0x3df260[_0x5bd8('0x4d')]['id']}})[_0x5bd8('0x17')](handleEntityNotFound(_0x155232,null))['then'](removeEntity(_0x155232,null))['catch'](handleError(_0x155232,null));};exports[_0x5bd8('0x4e')]=function(_0x4f6f03,_0x5086fa,_0x47f89b){var _0x309961={};var _0x493e03={};var _0x16bd4;var _0x5d67f9;return db[_0x5bd8('0x2f')][_0x5bd8('0x4f')]({'where':{'id':_0x4f6f03[_0x5bd8('0x4d')]['id']}})[_0x5bd8('0x17')](handleEntityNotFound(_0x5086fa,null))[_0x5bd8('0x17')](function(_0x5c1f51){if(_0x5c1f51){_0x16bd4=_0x5c1f51;_0x493e03[_0x5bd8('0x32')]=_[_0x5bd8('0x33')](db[_0x5bd8('0x50')][_0x5bd8('0x30')]);_0x493e03[_0x5bd8('0x34')]=_[_0x5bd8('0x33')](_0x4f6f03['query']);_0x493e03[_0x5bd8('0x35')]=_[_0x5bd8('0x36')](_0x493e03[_0x5bd8('0x32')],_0x493e03[_0x5bd8('0x34')]);_0x309961[_0x5bd8('0x38')]=_[_0x5bd8('0x36')](_0x493e03['model'],qs[_0x5bd8('0x37')](_0x4f6f03[_0x5bd8('0x34')]['fields']));_0x309961['attributes']=_0x309961[_0x5bd8('0x38')]['length']?_0x309961['attributes']:_0x493e03[_0x5bd8('0x32')];_0x309961[_0x5bd8('0x51')]=qs[_0x5bd8('0x3b')](_0x4f6f03['query'][_0x5bd8('0x3b')]);_0x309961[_0x5bd8('0x3c')]=qs[_0x5bd8('0x35')](_[_0x5bd8('0x3d')](_0x4f6f03[_0x5bd8('0x34')],_0x493e03[_0x5bd8('0x35')]));if(_0x4f6f03[_0x5bd8('0x34')][_0x5bd8('0x3e')]){_0x309961[_0x5bd8('0x3c')]=_['merge'](_0x309961['where'],{'$or':_['map'](_0x309961[_0x5bd8('0x38')],function(_0x194b8f){var _0x43d316={};_0x43d316[_0x194b8f]={'$like':'%'+_0x4f6f03['query'][_0x5bd8('0x3e')]+'%'};return _0x43d316;})});}_0x309961=_[_0x5bd8('0x3f')]({},_0x309961,_0x4f6f03['options']);return _0x16bd4['getConfigurations'](_0x309961);}})[_0x5bd8('0x17')](function(_0x151ebc){if(_0x151ebc){_0x5d67f9=_0x151ebc[_0x5bd8('0x49')];if(!_0x4f6f03['query'][_0x5bd8('0x39')]('nolimit')){_0x309961['limit']=qs['limit'](_0x4f6f03['query'][_0x5bd8('0x24')]);_0x309961[_0x5bd8('0x23')]=qs[_0x5bd8('0x23')](_0x4f6f03[_0x5bd8('0x34')]['offset']);}return _0x16bd4[_0x5bd8('0x4e')](_0x309961);}})[_0x5bd8('0x17')](function(_0x2ec990){if(_0x2ec990){return _0x2ec990?{'count':_0x5d67f9,'rows':_0x2ec990}:null;}})[_0x5bd8('0x17')](respondWithResult(_0x5086fa,null))[_0x5bd8('0x1f')](handleError(_0x5086fa,null));};exports[_0x5bd8('0x52')]=function(_0x5db799,_0x5d2cb4,_0x13768b){if(_0x5db799['body']['id']){delete _0x5db799[_0x5bd8('0x4c')]['id'];}return db[_0x5bd8('0x2f')]['findOne']({'where':{'id':_0x5db799[_0x5bd8('0x4d')]['id']}})[_0x5bd8('0x17')](handleEntityNotFound(_0x5d2cb4,null))['then'](function(_0x4b47ed){if(_0x4b47ed){_0x5db799[_0x5bd8('0x4c')][_0x5bd8('0x53')]=_0x4b47ed['id'];_0x5db799[_0x5bd8('0x4c')][_0x5bd8('0x54')]=integrations[_0x5bd8('0x55')](_0x5db799[_0x5bd8('0x4c')][_0x5bd8('0x56')],_0x5db799[_0x5bd8('0x4c')][_0x5bd8('0x31')]);_0x5db799[_0x5bd8('0x4c')][_0x5bd8('0x57')]=integrations[_0x5bd8('0x58')](_0x5db799[_0x5bd8('0x4c')][_0x5bd8('0x56')],_0x5db799[_0x5bd8('0x4c')][_0x5bd8('0x31')]);return db['ServicenowConfiguration'][_0x5bd8('0x4b')](_0x5db799['body'],{'include':[{'model':db[_0x5bd8('0x59')],'as':_0x5bd8('0x54')},{'model':db[_0x5bd8('0x59')],'as':_0x5bd8('0x57')}]});}return null;})[_0x5bd8('0x17')](respondWithResult(_0x5d2cb4,null))['catch'](handleError(_0x5d2cb4,null));};exports[_0x5bd8('0x5a')]=function(_0x3488d6,_0x4df4ec,_0x1ab4b1){var _0x1d83ba=['made_sla','hold_reason','knowledge',_0x5bd8('0x5b'),_0x5bd8('0x5c'),_0x5bd8('0x5d'),_0x5bd8('0x5e'),'severity','category'];var _0x1acf2a=[_0x5bd8('0x5f'),_0x5bd8('0x60'),_0x5bd8('0x61'),_0x5bd8('0x62'),_0x5bd8('0x63'),_0x5bd8('0x64'),_0x5bd8('0x65'),'hold_reason',_0x5bd8('0x66'),_0x5bd8('0x67'),_0x5bd8('0x68'),_0x5bd8('0x69'),'opened_by',_0x5bd8('0x6a'),_0x5bd8('0x6b'),'sys_domain',_0x5bd8('0x6c'),_0x5bd8('0x6d'),'knowledge','order',_0x5bd8('0x6e'),_0x5bd8('0x6f'),_0x5bd8('0x70'),_0x5bd8('0x71'),_0x5bd8('0x72'),_0x5bd8('0x73'),_0x5bd8('0x74'),'business_service',_0x5bd8('0x75'),_0x5bd8('0x76'),_0x5bd8('0x77'),_0x5bd8('0x78'),_0x5bd8('0x79'),'opened_at',_0x5bd8('0x7a'),_0x5bd8('0x7b'),_0x5bd8('0x7c'),'reopened_time',_0x5bd8('0x7d'),_0x5bd8('0x7e'),_0x5bd8('0x7f'),_0x5bd8('0x5b'),'work_notes',_0x5bd8('0x80'),_0x5bd8('0x5c'),_0x5bd8('0x81'),_0x5bd8('0x82'),'work_start',_0x5bd8('0x83'),_0x5bd8('0x84'),_0x5bd8('0x85'),_0x5bd8('0x86'),_0x5bd8('0x87'),_0x5bd8('0x5d'),'sys_class_name','close_notes',_0x5bd8('0x88'),'follow_up',_0x5bd8('0x89'),'sys_id',_0x5bd8('0x8a'),_0x5bd8('0x8b'),_0x5bd8('0x5e'),_0x5bd8('0x8c'),'problem_id',_0x5bd8('0x8d'),_0x5bd8('0x8e'),'activity_due','assigned_to','severity','comments','sla_due','approval',_0x5bd8('0x8f'),_0x5bd8('0x90'),'sys_mod_count',_0x5bd8('0x91'),_0x5bd8('0x92'),_0x5bd8('0x93'),_0x5bd8('0x94'),_0x5bd8('0x95'),_0x5bd8('0x96'),_0x5bd8('0x97')];var _0x2e0d71='';var _0x59485f='';var _0x4b9ae2=[];var _0x595dbc='';var _0x47a509='';var _0x17e5ff=[];var _0x3beffe='';var _0x88fcb4='';var _0x13d044={};var _0x4b87a2='';return db['ServicenowAccount'][_0x5bd8('0x4f')]({'where':{'id':_0x3488d6[_0x5bd8('0x4d')]['id']},'attributes':['id',_0x5bd8('0x98'),'password',_0x5bd8('0x99'),_0x5bd8('0x9a'),_0x5bd8('0x9b')]})[_0x5bd8('0x17')](handleEntityNotFound(_0x4df4ec,null))[_0x5bd8('0x17')](function(_0x243295){if(_0x243295){_0x4b87a2=_0x243295['remoteUri'];var _0x651662=_0x4b87a2[_0x5bd8('0x9c')](-0x1);if(_0x651662==='/'){_0x4b87a2=_0x4b87a2['substring'](0x0,_0x4b87a2['lastIndexOf'](_0x651662));}_0x88fcb4=util[_0x5bd8('0x9d')](_0x5bd8('0x9e'),_0x4b87a2);_0x3beffe=util[_0x5bd8('0x9d')](_0x5bd8('0x9f'),_0x4b87a2);_0x13d044={'user':_0x243295[_0x5bd8('0x98')],'pass':_0x243295[_0x5bd8('0xa0')]};var _0x8704b3={'method':'GET','uri':_0x88fcb4+_0x5bd8('0xa1'),'auth':_0x13d044,'json':!![]};return rp(_0x8704b3);}})[_0x5bd8('0x17')](function(_0x3dfd57){if(_0x3dfd57[_0x5bd8('0xa2')][_0x5bd8('0x49')]>0x0){_0x2e0d71=_0x3dfd57['result'];}console[_0x5bd8('0xa3')](_0x5bd8('0xa4'),_0x2e0d71);_0x17e5ff=[];_0x59485f=Object[_0x5bd8('0xa5')]([],_0x2e0d71);_[_0x5bd8('0xa6')](_0x59485f,function(_0x139216){return!_0x1d83ba['includes'](_0x139216['name']);});_0x59485f[_0x5bd8('0xa7')](function(_0x15bba5){var _0x3377e8=createFieldObject(_0x3beffe,_0x13d044,_0x15bba5['internalType'],_0x15bba5[_0x5bd8('0x2d')],_0x15bba5[_0x5bd8('0xa8')],![]);_0x17e5ff[_0x5bd8('0xa9')](_0x3377e8);});return Promise[_0x5bd8('0xaa')](_0x17e5ff);})[_0x5bd8('0x17')](function(_0x2b3f0b){_0x4b9ae2=_0x2b3f0b;_0x595dbc=Object['assign']([],_0x2e0d71);console[_0x5bd8('0xa3')](_0x5bd8('0xab'),_0x2e0d71);_[_0x5bd8('0xa6')](_0x595dbc,function(_0x597a86){return _0x1acf2a[_0x5bd8('0xac')](_0x597a86[_0x5bd8('0x2d')]);});console[_0x5bd8('0xa3')](_0x5bd8('0xad'),_0x595dbc);_0x17e5ff=[];_0x595dbc[_0x5bd8('0xa7')](function(_0x2cf9fa){var _0xa9f24b=createFieldObject(_0x3beffe,_0x13d044,_0x2cf9fa['internalType'],_0x2cf9fa['name'],_0x2cf9fa[_0x5bd8('0xa8')],!![]);_0x17e5ff[_0x5bd8('0xa9')](_0xa9f24b);});return Promise[_0x5bd8('0xaa')](_0x17e5ff);})[_0x5bd8('0x17')](function(_0x49aef0){_0x47a509=_0x49aef0;var _0x39c534=_0x4b9ae2[_0x5bd8('0xae')](_0x47a509);return{'count':_0x39c534[_0x5bd8('0x49')],'rows':_0x39c534};})['then'](respondWithResult(_0x4df4ec,null))['catch'](function(_0x20bed6){console[_0x5bd8('0xa3')](_0x5bd8('0xaf')+_0x20bed6);var _0x5bcff2=_0x3488d6['query'][_0x5bd8('0xb0')]?0x1f4:_0x20bed6['statusCode']||0x1f4;logger[_0x5bd8('0x1c')](_0x20bed6[_0x5bd8('0x2c')]);delete _0x20bed6[_0x5bd8('0x2d')];if(_0x5bcff2===0x191){_0x5bcff2=0x190;}_0x4df4ec[_0x5bd8('0x22')](_0x5bcff2)[_0x5bd8('0x2e')](_0x3488d6[_0x5bd8('0x34')][_0x5bd8('0xb0')]?{'message':_0x5bd8('0xb1'),'statusCode':_0x20bed6['statusCode']}:_0x20bed6);});};function createFieldObject(_0x51a9da,_0x550428,_0x5d4c21,_0x1dd3d1,_0x44d5c2,_0x3ea48b){return new Promise(function(_0x47f9d1,_0x336885){var _0x2706db={'id':_0x1dd3d1,'name':_0x44d5c2,'custom':_0x3ea48b};if(_0x5d4c21===_0x5bd8('0xb2')){_0x2706db['options']=[{'name':_0x5bd8('0xb3'),'value':_0x5bd8('0xb4')},{'name':'False','value':_0x5bd8('0xb5')}];_0x47f9d1(_0x2706db);}else{var _0x186da9={'method':_0x5bd8('0xb6'),'uri':_0x51a9da+_0x5bd8('0xb7')+_0x1dd3d1,'auth':_0x550428,'json':!![]};return rp(_0x186da9)[_0x5bd8('0x17')](function(_0x486095){var _0x289480=[];if(_0x486095[_0x5bd8('0xa2')][_0x5bd8('0x49')]>0x0){_0x486095['result'][_0x5bd8('0xa7')](function(_0x28e465){if(_0x28e465['inactive']==='false'){var _0x16eb75={'name':_0x28e465[_0x5bd8('0xa8')],'value':_0x28e465[_0x5bd8('0xb8')]};_0x289480[_0x5bd8('0xa9')](_0x16eb75);}});}_0x2706db[_0x5bd8('0x42')]=_0x289480;if(_0x2706db[_0x5bd8('0x42')][_0x5bd8('0x49')]>0x0){_0x47f9d1(_0x2706db);}else{if(_0x3ea48b==![]){_0x47f9d1();}else{_0x47f9d1(_0x2706db);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e35759c..93b27fd 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x308dcc,_0x2d1178){var _0x361717=function(_0x618aae){while(--_0x618aae){_0x308dcc['push'](_0x308dcc['shift']());}};_0x361717(++_0x2d1178);}(_0x1cb9,0x14e));var _0x91cb=function(_0xd9f83e,_0x48b9b7){_0xd9f83e=_0xd9f83e-0x0;var _0x4ea59f=_0x1cb9[_0xd9f83e];return _0x4ea59f;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));var integrations=require(_0x91cb('0x8'));module[_0x91cb('0x9')]=function(_0x28543e,_0x3b9d98){return _0x28543e[_0x91cb('0xa')]('ServicenowAccount',attributes,{'tableName':_0x91cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eea=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4940f7,_0x50da48){_0x4940f7=_0x4940f7-0x0;var _0x469d03=_0x3eea[_0x4940f7];return _0x469d03;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));var integrations=require(_0xa3ee('0xa'));module[_0xa3ee('0xb')]=function(_0x5776bb,_0x538bf9){return _0x5776bb[_0xa3ee('0xc')]('ServicenowAccount',attributes,{'tableName':_0xa3ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 990f83f..dd314d2 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 _0x960c=['ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message'];(function(_0x5b8188,_0x1b31a5){var _0x476798=function(_0x473a4d){while(--_0x473a4d){_0x5b8188['push'](_0x5b8188['shift']());}};_0x476798(++_0x1b31a5);}(_0x960c,0x130));var _0xc960=function(_0x171226,_0x5dbc43){_0x171226=_0x171226-0x0;var _0x3d607b=_0x960c[_0x171226];return _0x3d607b;};'use strict';var _=require('lodash');var util=require(_0xc960('0x0'));var moment=require(_0xc960('0x1'));var BPromise=require(_0xc960('0x2'));var rs=require(_0xc960('0x3'));var fs=require('fs');var Redis=require(_0xc960('0x4'));var db=require(_0xc960('0x5'))['db'];var utils=require(_0xc960('0x6'));var logger=require(_0xc960('0x7'))('rpc');var config=require(_0xc960('0x8'));var jayson=require(_0xc960('0x9'));var client=jayson[_0xc960('0xa')][_0xc960('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x551979,_0x53a128,_0x453eb2){return new BPromise(function(_0x3789ba,_0x172c1e){return client[_0xc960('0xc')](_0x551979,_0x453eb2)[_0xc960('0xd')](function(_0xd79e4f){logger[_0xc960('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x53a128,_0xc960('0xf'));logger[_0xc960('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x53a128,'request\x20sent',JSON['stringify'](_0xd79e4f));if(_0xd79e4f[_0xc960('0x11')]){if(_0xd79e4f[_0xc960('0x11')][_0xc960('0x12')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x53a128,_0xd79e4f[_0xc960('0x11')][_0xc960('0x13')]);return _0x172c1e(_0xd79e4f[_0xc960('0x11')][_0xc960('0x13')]);}logger[_0xc960('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x53a128,_0xd79e4f[_0xc960('0x11')][_0xc960('0x13')]);return _0x3789ba(_0xd79e4f[_0xc960('0x11')][_0xc960('0x13')]);}else{logger[_0xc960('0xe')](_0xc960('0x14'),_0x53a128,'request\x20sent');_0x3789ba(_0xd79e4f[_0xc960('0x15')]['message']);}})[_0xc960('0x16')](function(_0x4225e1){logger[_0xc960('0x11')](_0xc960('0x14'),_0x53a128,_0x4225e1);_0x172c1e(_0x4225e1);});});}exports[_0xc960('0x17')]=function(_0x164e57){var _0x4b13f6=this;return new Promise(function(_0x29ed85,_0x4ffbd3){return db['ServicenowAccount'][_0xc960('0x18')]({'raw':_0x164e57[_0xc960('0x19')]?_0x164e57['options'][_0xc960('0x1a')]===undefined?!![]:![]:!![],'where':_0x164e57[_0xc960('0x19')]?_0x164e57['options'][_0xc960('0x1b')]||null:null,'attributes':_0x164e57[_0xc960('0x19')]?_0x164e57[_0xc960('0x19')][_0xc960('0x1c')]||null:null,'limit':_0x164e57[_0xc960('0x19')]?_0x164e57[_0xc960('0x19')][_0xc960('0x1d')]||null:null,'include':_0x164e57[_0xc960('0x19')]?_0x164e57[_0xc960('0x19')][_0xc960('0x1e')]?_[_0xc960('0x1f')](_0x164e57[_0xc960('0x19')][_0xc960('0x1e')],function(_0x3e85a4){return{'model':db[_0x3e85a4[_0xc960('0x20')]],'as':_0x3e85a4['as'],'attributes':_0x3e85a4[_0xc960('0x1c')],'include':_0x3e85a4[_0xc960('0x1e')]?_[_0xc960('0x1f')](_0x3e85a4[_0xc960('0x1e')],function(_0x5aa8d0){return{'model':db[_0x5aa8d0['model']],'as':_0x5aa8d0['as'],'attributes':_0x5aa8d0[_0xc960('0x1c')],'include':_0x5aa8d0['include']?_[_0xc960('0x1f')](_0x5aa8d0['include'],function(_0x391cee){return{'model':db[_0x391cee['model']],'as':_0x391cee['as'],'attributes':_0x391cee[_0xc960('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc960('0xd')](function(_0x5127e4){logger[_0xc960('0xe')](_0xc960('0x17'),_0x164e57);logger[_0xc960('0x10')](_0xc960('0x17'),_0x164e57,JSON[_0xc960('0x21')](_0x5127e4));_0x29ed85(_0x5127e4);})['catch'](function(_0x2e38c2){logger[_0xc960('0x11')](_0xc960('0x17'),_0x2e38c2['message'],_0x164e57);_0x4ffbd3(_0x4b13f6[_0xc960('0x11')](0x1f4,_0x2e38c2[_0xc960('0x13')]));});});};exports[_0xc960('0x22')]=function(_0x44f1fb){var _0x46d59d=this;return new Promise(function(_0x5f271d,_0x2e618d){return db['ServicenowAccount'][_0xc960('0x23')]({'raw':_0x44f1fb[_0xc960('0x19')]?_0x44f1fb[_0xc960('0x19')][_0xc960('0x1a')]===undefined?!![]:![]:!![],'where':_0x44f1fb[_0xc960('0x19')]?_0x44f1fb['options'][_0xc960('0x1b')]||null:null,'attributes':_0x44f1fb['options']?_0x44f1fb[_0xc960('0x19')][_0xc960('0x1c')]||null:null,'include':_0x44f1fb[_0xc960('0x19')]?_0x44f1fb[_0xc960('0x19')][_0xc960('0x1e')]?_[_0xc960('0x1f')](_0x44f1fb[_0xc960('0x19')][_0xc960('0x1e')],function(_0x1a300){return{'model':db[_0x1a300['model']],'as':_0x1a300['as'],'attributes':_0x1a300[_0xc960('0x1c')],'include':_0x1a300[_0xc960('0x1e')]?_[_0xc960('0x1f')](_0x1a300[_0xc960('0x1e')],function(_0x29e5f6){return{'model':db[_0x29e5f6[_0xc960('0x20')]],'as':_0x29e5f6['as'],'attributes':_0x29e5f6['attributes'],'include':_0x29e5f6[_0xc960('0x1e')]?_[_0xc960('0x1f')](_0x29e5f6[_0xc960('0x1e')],function(_0x4f35df){return{'model':db[_0x4f35df[_0xc960('0x20')]],'as':_0x4f35df['as'],'attributes':_0x4f35df[_0xc960('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc960('0xd')](function(_0x3b0f44){logger[_0xc960('0xe')](_0xc960('0x22'),_0x44f1fb);logger[_0xc960('0x10')](_0xc960('0x22'),_0x44f1fb,JSON[_0xc960('0x21')](_0x3b0f44));_0x5f271d(_0x3b0f44);})[_0xc960('0x16')](function(_0x1d2a38){logger['error'](_0xc960('0x22'),_0x1d2a38[_0xc960('0x13')],_0x44f1fb);_0x2e618d(_0x46d59d[_0xc960('0x11')](0x1f4,_0x1d2a38['message']));});});}; \ No newline at end of file +var _0xe8c8=['options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','catch','ShowServicenowAccount','find','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowAccount','findAll'];(function(_0x27e119,_0x20df5d){var _0x5124fc=function(_0x64583d){while(--_0x64583d){_0x27e119['push'](_0x27e119['shift']());}};_0x5124fc(++_0x20df5d);}(_0xe8c8,0x72));var _0x8e8c=function(_0x279c56,_0x338042){_0x279c56=_0x279c56-0x0;var _0x35f8f3=_0xe8c8[_0x279c56];return _0x35f8f3;};'use strict';var _=require(_0x8e8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e8c('0x1'));var fs=require('fs');var Redis=require(_0x8e8c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e8c('0x3'));var logger=require(_0x8e8c('0x4'))(_0x8e8c('0x5'));var config=require(_0x8e8c('0x6'));var jayson=require(_0x8e8c('0x7'));var client=jayson[_0x8e8c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x200045,_0x4e5c93,_0x51ccd7){return new BPromise(function(_0x1dbb2a,_0x5b884e){return client[_0x8e8c('0x9')](_0x200045,_0x51ccd7)[_0x8e8c('0xa')](function(_0x4cf97b){logger[_0x8e8c('0xb')](_0x8e8c('0xc'),_0x4e5c93,'request\x20sent');logger[_0x8e8c('0xd')](_0x8e8c('0xe'),_0x4e5c93,_0x8e8c('0xf'),JSON[_0x8e8c('0x10')](_0x4cf97b));if(_0x4cf97b['error']){if(_0x4cf97b[_0x8e8c('0x11')][_0x8e8c('0x12')]===0x1f4){logger[_0x8e8c('0x11')](_0x8e8c('0xc'),_0x4e5c93,_0x4cf97b[_0x8e8c('0x11')][_0x8e8c('0x13')]);return _0x5b884e(_0x4cf97b[_0x8e8c('0x11')][_0x8e8c('0x13')]);}logger[_0x8e8c('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4e5c93,_0x4cf97b[_0x8e8c('0x11')][_0x8e8c('0x13')]);return _0x1dbb2a(_0x4cf97b[_0x8e8c('0x11')]['message']);}else{logger[_0x8e8c('0xb')](_0x8e8c('0xc'),_0x4e5c93,_0x8e8c('0xf'));_0x1dbb2a(_0x4cf97b['result'][_0x8e8c('0x13')]);}})['catch'](function(_0x324256){logger[_0x8e8c('0x11')](_0x8e8c('0xc'),_0x4e5c93,_0x324256);_0x5b884e(_0x324256);});});}exports['GetServicenowAccount']=function(_0x19e5bb){var _0x302eb3=this;return new Promise(function(_0x2b6f5b,_0x5234a4){return db[_0x8e8c('0x14')][_0x8e8c('0x15')]({'raw':_0x19e5bb['options']?_0x19e5bb[_0x8e8c('0x16')][_0x8e8c('0x17')]===undefined?!![]:![]:!![],'where':_0x19e5bb[_0x8e8c('0x16')]?_0x19e5bb['options'][_0x8e8c('0x18')]||null:null,'attributes':_0x19e5bb['options']?_0x19e5bb[_0x8e8c('0x16')][_0x8e8c('0x19')]||null:null,'limit':_0x19e5bb[_0x8e8c('0x16')]?_0x19e5bb[_0x8e8c('0x16')][_0x8e8c('0x1a')]||null:null,'include':_0x19e5bb['options']?_0x19e5bb[_0x8e8c('0x16')][_0x8e8c('0x1b')]?_[_0x8e8c('0x1c')](_0x19e5bb[_0x8e8c('0x16')][_0x8e8c('0x1b')],function(_0x1d2c5d){return{'model':db[_0x1d2c5d[_0x8e8c('0x1d')]],'as':_0x1d2c5d['as'],'attributes':_0x1d2c5d[_0x8e8c('0x19')],'include':_0x1d2c5d[_0x8e8c('0x1b')]?_['map'](_0x1d2c5d[_0x8e8c('0x1b')],function(_0x121ff6){return{'model':db[_0x121ff6[_0x8e8c('0x1d')]],'as':_0x121ff6['as'],'attributes':_0x121ff6[_0x8e8c('0x19')],'include':_0x121ff6[_0x8e8c('0x1b')]?_['map'](_0x121ff6[_0x8e8c('0x1b')],function(_0x48ae0a){return{'model':db[_0x48ae0a[_0x8e8c('0x1d')]],'as':_0x48ae0a['as'],'attributes':_0x48ae0a[_0x8e8c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8e8c('0xa')](function(_0x160509){logger['info'](_0x8e8c('0x1e'),_0x19e5bb);logger['debug'](_0x8e8c('0x1e'),_0x19e5bb,JSON[_0x8e8c('0x10')](_0x160509));_0x2b6f5b(_0x160509);})[_0x8e8c('0x1f')](function(_0x103d9b){logger[_0x8e8c('0x11')]('GetServicenowAccount',_0x103d9b[_0x8e8c('0x13')],_0x19e5bb);_0x5234a4(_0x302eb3[_0x8e8c('0x11')](0x1f4,_0x103d9b['message']));});});};exports[_0x8e8c('0x20')]=function(_0x177335){var _0x547208=this;return new Promise(function(_0x1cd2f4,_0x357c7b){return db[_0x8e8c('0x14')][_0x8e8c('0x21')]({'raw':_0x177335[_0x8e8c('0x16')]?_0x177335[_0x8e8c('0x16')][_0x8e8c('0x17')]===undefined?!![]:![]:!![],'where':_0x177335['options']?_0x177335[_0x8e8c('0x16')][_0x8e8c('0x18')]||null:null,'attributes':_0x177335[_0x8e8c('0x16')]?_0x177335[_0x8e8c('0x16')][_0x8e8c('0x19')]||null:null,'include':_0x177335[_0x8e8c('0x16')]?_0x177335[_0x8e8c('0x16')]['include']?_[_0x8e8c('0x1c')](_0x177335[_0x8e8c('0x16')][_0x8e8c('0x1b')],function(_0x3845e6){return{'model':db[_0x3845e6['model']],'as':_0x3845e6['as'],'attributes':_0x3845e6[_0x8e8c('0x19')],'include':_0x3845e6[_0x8e8c('0x1b')]?_[_0x8e8c('0x1c')](_0x3845e6[_0x8e8c('0x1b')],function(_0x174b35){return{'model':db[_0x174b35['model']],'as':_0x174b35['as'],'attributes':_0x174b35[_0x8e8c('0x19')],'include':_0x174b35[_0x8e8c('0x1b')]?_['map'](_0x174b35[_0x8e8c('0x1b')],function(_0x152681){return{'model':db[_0x152681[_0x8e8c('0x1d')]],'as':_0x152681['as'],'attributes':_0x152681[_0x8e8c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8e8c('0xa')](function(_0x57f5e0){logger[_0x8e8c('0xb')]('ShowServicenowAccount',_0x177335);logger[_0x8e8c('0xd')]('ShowServicenowAccount',_0x177335,JSON[_0x8e8c('0x10')](_0x57f5e0));_0x1cd2f4(_0x57f5e0);})[_0x8e8c('0x1f')](function(_0x3440f6){logger['error'](_0x8e8c('0x20'),_0x3440f6[_0x8e8c('0x13')],_0x177335);_0x357c7b(_0x547208['error'](0x1f4,_0x3440f6[_0x8e8c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ddaa51d..f5d696e 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 _0x37c2=['create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','./intServicenowConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','get','/:id/descriptions','getDescriptions','post'];(function(_0x3d1047,_0x11dc15){var _0x48e52e=function(_0x25d11d){while(--_0x25d11d){_0x3d1047['push'](_0x3d1047['shift']());}};_0x48e52e(++_0x11dc15);}(_0x37c2,0xae));var _0x237c=function(_0x47639d,_0x3a16d1){_0x47639d=_0x47639d-0x0;var _0x5ad69e=_0x37c2[_0x47639d];return _0x5ad69e;};'use strict';var multer=require(_0x237c('0x0'));var util=require(_0x237c('0x1'));var path=require(_0x237c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x237c('0x3')]();var auth=require(_0x237c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x237c('0x5'));router['get']('/',auth[_0x237c('0x6')](),controller[_0x237c('0x7')]);router['get'](_0x237c('0x8'),auth[_0x237c('0x6')](),controller[_0x237c('0x9')]);router['get'](_0x237c('0xa'),auth[_0x237c('0x6')](),controller[_0x237c('0xb')]);router['get'](_0x237c('0xc'),auth['isAuthenticated'](),controller[_0x237c('0xd')]);router[_0x237c('0xe')](_0x237c('0xf'),auth[_0x237c('0x6')](),controller[_0x237c('0x10')]);router[_0x237c('0x11')]('/',auth[_0x237c('0x6')](),controller[_0x237c('0x12')]);router[_0x237c('0x13')](_0x237c('0x8'),auth[_0x237c('0x6')](),controller[_0x237c('0x14')]);router[_0x237c('0x15')](_0x237c('0x8'),auth['isAuthenticated'](),controller[_0x237c('0x16')]);module[_0x237c('0x17')]=router; \ No newline at end of file +var _0x703d=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','isAuthenticated'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x703d,0xf8));var _0xd703=function(_0x46d116,_0x13634a){_0x46d116=_0x46d116-0x0;var _0x50c886=_0x703d[_0x46d116];return _0x50c886;};'use strict';var multer=require(_0xd703('0x0'));var util=require(_0xd703('0x1'));var path=require(_0xd703('0x2'));var timeout=require(_0xd703('0x3'));var express=require(_0xd703('0x4'));var router=express['Router']();var auth=require(_0xd703('0x5'));var interaction=require(_0xd703('0x6'));var config=require(_0xd703('0x7'));var controller=require(_0xd703('0x8'));router[_0xd703('0x9')]('/',auth['isAuthenticated'](),controller[_0xd703('0xa')]);router[_0xd703('0x9')]('/:id',auth[_0xd703('0xb')](),controller[_0xd703('0xc')]);router[_0xd703('0x9')](_0xd703('0xd'),auth[_0xd703('0xb')](),controller[_0xd703('0xe')]);router[_0xd703('0x9')](_0xd703('0xf'),auth[_0xd703('0xb')](),controller[_0xd703('0x10')]);router[_0xd703('0x9')](_0xd703('0x11'),auth['isAuthenticated'](),controller[_0xd703('0x12')]);router[_0xd703('0x13')]('/',auth[_0xd703('0xb')](),controller[_0xd703('0x14')]);router[_0xd703('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xd703('0x16')]);router[_0xd703('0x17')](_0xd703('0x18'),auth[_0xd703('0xb')](),controller['destroy']);module[_0xd703('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0512b90..7e78b11 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 _0x107d=['exports','STRING','sequelize'];(function(_0x235f24,_0x21b6cb){var _0x483f9c=function(_0x2b55d6){while(--_0x2b55d6){_0x235f24['push'](_0x235f24['shift']());}};_0x483f9c(++_0x21b6cb);}(_0x107d,0x71));var _0xd107=function(_0x2a9692,_0x39bf44){_0x2a9692=_0x2a9692-0x0;var _0x8f42bd=_0x107d[_0x2a9692];return _0x8f42bd;};'use strict';var Sequelize=require(_0xd107('0x0'));module[_0xd107('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd107('0x2')]}}; \ No newline at end of file +var _0x94ef=['exports','STRING'];(function(_0x31ac5a,_0x40d54c){var _0x1c660a=function(_0x15e365){while(--_0x15e365){_0x31ac5a['push'](_0x31ac5a['shift']());}};_0x1c660a(++_0x40d54c);}(_0x94ef,0x1c8));var _0xf94e=function(_0x466769,_0x5715c7){_0x466769=_0x466769-0x0;var _0x5a9a3a=_0x94ef[_0x466769];return _0x5a9a3a;};'use strict';var Sequelize=require('sequelize');module[_0xf94e('0x0')]={'name':{'type':Sequelize[_0xf94e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 637c6c2..9c9448b 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 _0xea28=['model','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','fields','body','destroy','ServicenowField','order','options','getFields','findOne','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','count','offset','limit','set','Content-Range','apply','update','end','sendStatus','stack','name','send','index','map','ServicenowConfiguration','key','query','keys','intersection','attributes'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0xea28,0x13a));var _0x8ea2=function(_0x3e56d2,_0x7635dc){_0x3e56d2=_0x3e56d2-0x0;var _0x5dda9d=_0xea28[_0x3e56d2];return _0x5dda9d;};'use strict';var pdf=require(_0x8ea2('0x0'));var emlformat=require(_0x8ea2('0x1'));var rimraf=require(_0x8ea2('0x2'));var zipdir=require(_0x8ea2('0x3'));var jsonpatch=require(_0x8ea2('0x4'));var rp=require(_0x8ea2('0x5'));var moment=require(_0x8ea2('0x6'));var BPromise=require(_0x8ea2('0x7'));var Mustache=require('mustache');var util=require(_0x8ea2('0x8'));var path=require(_0x8ea2('0x9'));var sox=require(_0x8ea2('0xa'));var csv=require('to-csv');var ejs=require(_0x8ea2('0xb'));var fs=require('fs');var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0x11'));var querystring=require(_0x8ea2('0x12'));var Papa=require(_0x8ea2('0x13'));var Redis=require(_0x8ea2('0x14'));var authService=require(_0x8ea2('0x15'));var qs=require(_0x8ea2('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require(_0x8ea2('0x19'));var config=require('../../config/environment');var db=require(_0x8ea2('0x1a'))['db'];var jayson=require(_0x8ea2('0x1b'));var client=jayson[_0x8ea2('0x1c')][_0x8ea2('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xe47c0e,_0x5e662e,_0x2879d6){if(_0x2879d6){var _0x553154=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x553154['test'](_0x5e662e)){return _0xe47c0e;}else{throw new db[(_0x8ea2('0x1e'))][(_0x8ea2('0x1f'))](_0x8ea2('0x20'));}}else{return _0xe47c0e;}}function respondWithRpcPromise(_0x78669a,_0x393faf,_0xbb9bd1,_0x3cff96){return new BPromise(function(_0x11f5e8,_0x474873){var _0x396aab=_0x3cff96||client;return _0x396aab[_0x8ea2('0x21')](_0x78669a,_0xbb9bd1)[_0x8ea2('0x22')](function(_0x3bc774){logger[_0x8ea2('0x23')](_0x8ea2('0x24'),_0x393faf,_0x8ea2('0x25'));logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x393faf,_0x8ea2('0x25'),JSON[_0x8ea2('0x28')](_0x3bc774));if(_0x3bc774[_0x8ea2('0x29')]){if(_0x3bc774[_0x8ea2('0x29')]['code']===0x1f4){logger['error'](_0x8ea2('0x24'),_0x393faf,_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);return _0x474873(_0x3bc774['error'][_0x8ea2('0x2a')]);}logger[_0x8ea2('0x29')]('ServicenowConfiguration,\x20%s,\x20%s',_0x393faf,_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);return _0x11f5e8(_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);}else{logger[_0x8ea2('0x23')](_0x8ea2('0x24'),_0x393faf,_0x8ea2('0x25'));_0x11f5e8(_0x3bc774[_0x8ea2('0x2b')][_0x8ea2('0x2a')]);}})['catch'](function(_0x433bc5){logger['error'](_0x8ea2('0x24'),_0x393faf,_0x433bc5);_0x474873(_0x433bc5);});});}function respondWithStatusCode(_0x42bec8,_0x29b38f){_0x29b38f=_0x29b38f||0xcc;return function(_0x4e2106){if(_0x4e2106){return _0x42bec8['sendStatus'](_0x29b38f);}return _0x42bec8[_0x8ea2('0x2c')](_0x29b38f)['end']();};}function respondWithResult(_0x200a49,_0x4e786d){_0x4e786d=_0x4e786d||0xc8;return function(_0x3be291){if(_0x3be291){return _0x200a49[_0x8ea2('0x2c')](_0x4e786d)[_0x8ea2('0x2d')](_0x3be291);}};}function respondWithFilteredResult(_0x266db8,_0x4e1b90){return function(_0x5ce1d4){if(_0x5ce1d4){var _0xacaa6c=_0x5ce1d4[_0x8ea2('0x2e')],_0x4da5b3=_0x4e1b90[_0x8ea2('0x2f')],_0x4a9875=_0x4e1b90[_0x8ea2('0x2f')]+_0x4e1b90[_0x8ea2('0x30')],_0x287078;if(_0x4a9875>=_0xacaa6c){_0x4a9875=_0xacaa6c;_0x287078=0xc8;}else{_0x287078=0xce;}_0x266db8[_0x8ea2('0x2c')](_0x287078);return _0x266db8[_0x8ea2('0x31')](_0x8ea2('0x32'),_0x4da5b3+'-'+_0x4a9875+'/'+_0xacaa6c)[_0x8ea2('0x2d')](_0x5ce1d4);}return null;};}function patchUpdates(_0x56d914){return function(_0x5b7ff9){try{jsonpatch[_0x8ea2('0x33')](_0x5b7ff9,_0x56d914,!![]);}catch(_0x188553){return BPromise['reject'](_0x188553);}return _0x5b7ff9['save']();};}function saveUpdates(_0x1ee7b2,_0x4e273e){return function(_0x64475b){if(_0x64475b){return _0x64475b[_0x8ea2('0x34')](_0x1ee7b2)['then'](function(_0x17b21c){return _0x17b21c;});}return null;};}function removeEntity(_0x38f3d5,_0x33abc8){return function(_0x4cfdc6){if(_0x4cfdc6){return _0x4cfdc6['destroy']()['then'](function(){_0x38f3d5[_0x8ea2('0x2c')](0xcc)[_0x8ea2('0x35')]();});}};}function handleEntityNotFound(_0x3fc785,_0x5ef924){return function(_0x456487){if(!_0x456487){_0x3fc785[_0x8ea2('0x36')](0x194);}return _0x456487;};}function handleError(_0x3d5bf0,_0x278e5d){_0x278e5d=_0x278e5d||0x1f4;return function(_0x253031){logger[_0x8ea2('0x29')](_0x253031[_0x8ea2('0x37')]);if(_0x253031[_0x8ea2('0x38')]){delete _0x253031['name'];}_0x3d5bf0[_0x8ea2('0x2c')](_0x278e5d)[_0x8ea2('0x39')](_0x253031);};}exports[_0x8ea2('0x3a')]=function(_0x467d97,_0x4eebc1){var _0x2a1f14={},_0x5355aa={},_0x1e03f2={'count':0x0,'rows':[]};var _0x103d5a=_[_0x8ea2('0x3b')](db[_0x8ea2('0x3c')]['rawAttributes'],function(_0x2bed24){return{'name':_0x2bed24['fieldName'],'type':_0x2bed24['type'][_0x8ea2('0x3d')]};});_0x5355aa['model']=_[_0x8ea2('0x3b')](_0x103d5a,_0x8ea2('0x38'));_0x5355aa[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x467d97[_0x8ea2('0x3e')]);_0x5355aa['filters']=_[_0x8ea2('0x40')](_0x5355aa['model'],_0x5355aa[_0x8ea2('0x3e')]);_0x2a1f14[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x5355aa[_0x8ea2('0x42')],qs['fields'](_0x467d97[_0x8ea2('0x3e')]['fields']));_0x2a1f14[_0x8ea2('0x41')]=_0x2a1f14['attributes'][_0x8ea2('0x43')]?_0x2a1f14[_0x8ea2('0x41')]:_0x5355aa[_0x8ea2('0x42')];if(!_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x44')](_0x8ea2('0x45'))){_0x2a1f14[_0x8ea2('0x30')]=qs['limit'](_0x467d97['query'][_0x8ea2('0x30')]);_0x2a1f14['offset']=qs['offset'](_0x467d97['query'][_0x8ea2('0x2f')]);}_0x2a1f14['order']=qs[_0x8ea2('0x46')](_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x2a1f14[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x467d97[_0x8ea2('0x3e')],_0x5355aa[_0x8ea2('0x48')]),_0x103d5a);if(_0x467d97['query'][_0x8ea2('0x4a')]){_0x2a1f14[_0x8ea2('0x47')]=_[_0x8ea2('0x4b')](_0x2a1f14['where'],{'$or':_[_0x8ea2('0x3b')](_0x103d5a,function(_0x17df7b){if(_0x17df7b[_0x8ea2('0x4c')]!==_0x8ea2('0x4d')){var _0x20992d={};_0x20992d[_0x17df7b['name']]={'$like':'%'+_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x20992d;}})});}_0x2a1f14=_[_0x8ea2('0x4b')]({},_0x2a1f14,_0x467d97['options']);var _0x99fe91={'where':_0x2a1f14[_0x8ea2('0x47')]};return db[_0x8ea2('0x3c')][_0x8ea2('0x2e')](_0x99fe91)[_0x8ea2('0x22')](function(_0x3ca1c8){_0x1e03f2[_0x8ea2('0x2e')]=_0x3ca1c8;if(_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x4e')]){_0x2a1f14[_0x8ea2('0x4f')]=[{'all':!![]}];}return db[_0x8ea2('0x3c')][_0x8ea2('0x50')](_0x2a1f14);})[_0x8ea2('0x22')](function(_0x12e81f){_0x1e03f2['rows']=_0x12e81f;return _0x1e03f2;})[_0x8ea2('0x22')](respondWithFilteredResult(_0x4eebc1,_0x2a1f14))[_0x8ea2('0x51')](handleError(_0x4eebc1,null));};exports[_0x8ea2('0x52')]=function(_0x6ed85a,_0x182a46){var _0x1daa25={'raw':![],'where':{'id':_0x6ed85a[_0x8ea2('0x53')]['id']}},_0x11b3ef={};_0x11b3ef['model']=_[_0x8ea2('0x3f')](db[_0x8ea2('0x3c')][_0x8ea2('0x54')]);_0x11b3ef['query']=_['keys'](_0x6ed85a[_0x8ea2('0x3e')]);_0x11b3ef[_0x8ea2('0x48')]=_[_0x8ea2('0x40')](_0x11b3ef['model'],_0x11b3ef[_0x8ea2('0x3e')]);_0x1daa25[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x11b3ef[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x6ed85a['query']['fields']));_0x1daa25[_0x8ea2('0x41')]=_0x1daa25[_0x8ea2('0x41')][_0x8ea2('0x43')]?_0x1daa25['attributes']:_0x11b3ef[_0x8ea2('0x42')];if(_0x6ed85a[_0x8ea2('0x3e')][_0x8ea2('0x4e')]){_0x1daa25['include']=[{'all':!![]}];}_0x1daa25=_['merge']({},_0x1daa25,_0x6ed85a['options']);return db['ServicenowConfiguration']['find'](_0x1daa25)[_0x8ea2('0x22')](handleEntityNotFound(_0x182a46,null))[_0x8ea2('0x22')](respondWithResult(_0x182a46,null))['catch'](handleError(_0x182a46,null));};exports['create']=function(_0x1a7a75,_0x12c0db){return db[_0x8ea2('0x3c')]['create'](_0x1a7a75[_0x8ea2('0x56')],{})[_0x8ea2('0x22')](respondWithResult(_0x12c0db,0xc9))['catch'](handleError(_0x12c0db,null));};exports[_0x8ea2('0x34')]=function(_0x28e56a,_0x293dd8){if(_0x28e56a[_0x8ea2('0x56')]['id']){delete _0x28e56a[_0x8ea2('0x56')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x28e56a['params']['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x293dd8,null))[_0x8ea2('0x22')](saveUpdates(_0x28e56a[_0x8ea2('0x56')],null))[_0x8ea2('0x22')](respondWithResult(_0x293dd8,null))[_0x8ea2('0x51')](handleError(_0x293dd8,null));};exports[_0x8ea2('0x57')]=function(_0x36fda3,_0x5265e7){return db['ServicenowConfiguration']['find']({'where':{'id':_0x36fda3[_0x8ea2('0x53')]['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x5265e7,null))[_0x8ea2('0x22')](removeEntity(_0x5265e7,null))[_0x8ea2('0x51')](handleError(_0x5265e7,null));};exports['getFields']=function(_0x11824e,_0x2b8662,_0x4ec833){var _0x21485a={};var _0x193c32={};var _0x142ede;var _0xf78d1d;return db[_0x8ea2('0x3c')]['findOne']({'where':{'id':_0x11824e['params']['id']}})['then'](handleEntityNotFound(_0x2b8662,null))[_0x8ea2('0x22')](function(_0x1e2066){if(_0x1e2066){_0x142ede=_0x1e2066;_0x193c32[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x193c32[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x11824e[_0x8ea2('0x3e')]);_0x193c32[_0x8ea2('0x48')]=_['intersection'](_0x193c32[_0x8ea2('0x42')],_0x193c32['query']);_0x21485a[_0x8ea2('0x41')]=_['intersection'](_0x193c32[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x11824e['query']['fields']));_0x21485a[_0x8ea2('0x41')]=_0x21485a['attributes'][_0x8ea2('0x43')]?_0x21485a[_0x8ea2('0x41')]:_0x193c32[_0x8ea2('0x42')];_0x21485a[_0x8ea2('0x59')]=qs['sort'](_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x21485a[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x11824e[_0x8ea2('0x3e')],_0x193c32[_0x8ea2('0x48')]));if(_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x21485a[_0x8ea2('0x47')]=_[_0x8ea2('0x4b')](_0x21485a[_0x8ea2('0x47')],{'$or':_['map'](_0x21485a[_0x8ea2('0x41')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x4de6ba;})});}_0x21485a=_[_0x8ea2('0x4b')]({},_0x21485a,_0x11824e[_0x8ea2('0x5a')]);return _0x142ede[_0x8ea2('0x5b')](_0x21485a);}})[_0x8ea2('0x22')](function(_0xefb7b){if(_0xefb7b){_0xf78d1d=_0xefb7b[_0x8ea2('0x43')];if(!_0x11824e[_0x8ea2('0x3e')]['hasOwnProperty'](_0x8ea2('0x45'))){_0x21485a[_0x8ea2('0x30')]=qs[_0x8ea2('0x30')](_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x30')]);_0x21485a['offset']=qs['offset'](_0x11824e['query'][_0x8ea2('0x2f')]);}return _0x142ede[_0x8ea2('0x5b')](_0x21485a);}})[_0x8ea2('0x22')](function(_0x31bda0){if(_0x31bda0){return _0x31bda0?{'count':_0xf78d1d,'rows':_0x31bda0}:null;}})[_0x8ea2('0x22')](respondWithResult(_0x2b8662,null))[_0x8ea2('0x51')](handleError(_0x2b8662,null));};exports['getSubjects']=function(_0x428106,_0x14dd7d,_0x5712a3){var _0x55f929={};var _0x2a7ccc={};var _0x145a88;var _0x1bf4cb;return db[_0x8ea2('0x3c')][_0x8ea2('0x5c')]({'where':{'id':_0x428106[_0x8ea2('0x53')]['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x14dd7d,null))['then'](function(_0x435233){if(_0x435233){_0x145a88=_0x435233;_0x2a7ccc[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x2a7ccc[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x428106[_0x8ea2('0x3e')]);_0x2a7ccc['filters']=_[_0x8ea2('0x40')](_0x2a7ccc['model'],_0x2a7ccc['query']);_0x55f929[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x2a7ccc['model'],qs['fields'](_0x428106['query'][_0x8ea2('0x55')]));_0x55f929['attributes']=_0x55f929['attributes'][_0x8ea2('0x43')]?_0x55f929[_0x8ea2('0x41')]:_0x2a7ccc[_0x8ea2('0x42')];_0x55f929[_0x8ea2('0x59')]=qs[_0x8ea2('0x46')](_0x428106[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x55f929[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x428106[_0x8ea2('0x3e')],_0x2a7ccc[_0x8ea2('0x48')]));if(_0x428106[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x55f929['where']=_[_0x8ea2('0x4b')](_0x55f929[_0x8ea2('0x47')],{'$or':_[_0x8ea2('0x3b')](_0x55f929['attributes'],function(_0x1807bb){var _0x486ae8={};_0x486ae8[_0x1807bb]={'$like':'%'+_0x428106[_0x8ea2('0x3e')]['filter']+'%'};return _0x486ae8;})});}_0x55f929=_[_0x8ea2('0x4b')]({},_0x55f929,_0x428106['options']);return _0x145a88[_0x8ea2('0x5d')](_0x55f929);}})[_0x8ea2('0x22')](function(_0x4cdc8d){if(_0x4cdc8d){_0x1bf4cb=_0x4cdc8d[_0x8ea2('0x43')];if(!_0x428106['query'][_0x8ea2('0x44')](_0x8ea2('0x45'))){_0x55f929[_0x8ea2('0x30')]=qs[_0x8ea2('0x30')](_0x428106[_0x8ea2('0x3e')]['limit']);_0x55f929['offset']=qs[_0x8ea2('0x2f')](_0x428106['query'][_0x8ea2('0x2f')]);}return _0x145a88[_0x8ea2('0x5d')](_0x55f929);}})[_0x8ea2('0x22')](function(_0x1c365e){if(_0x1c365e){return _0x1c365e?{'count':_0x1bf4cb,'rows':_0x1c365e}:null;}})[_0x8ea2('0x22')](respondWithResult(_0x14dd7d,null))[_0x8ea2('0x51')](handleError(_0x14dd7d,null));};exports['getDescriptions']=function(_0x4aa32e,_0x53d9f3,_0x1f50dc){var _0x576075={};var _0x27b7c6={};var _0x36a913;var _0x3d9242;return db[_0x8ea2('0x3c')][_0x8ea2('0x5c')]({'where':{'id':_0x4aa32e[_0x8ea2('0x53')]['id']}})['then'](handleEntityNotFound(_0x53d9f3,null))[_0x8ea2('0x22')](function(_0x1a6426){if(_0x1a6426){_0x36a913=_0x1a6426;_0x27b7c6[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x27b7c6['query']=_[_0x8ea2('0x3f')](_0x4aa32e[_0x8ea2('0x3e')]);_0x27b7c6[_0x8ea2('0x48')]=_[_0x8ea2('0x40')](_0x27b7c6[_0x8ea2('0x42')],_0x27b7c6[_0x8ea2('0x3e')]);_0x576075[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x27b7c6[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x55')]));_0x576075[_0x8ea2('0x41')]=_0x576075[_0x8ea2('0x41')][_0x8ea2('0x43')]?_0x576075[_0x8ea2('0x41')]:_0x27b7c6[_0x8ea2('0x42')];_0x576075['order']=qs['sort'](_0x4aa32e[_0x8ea2('0x3e')]['sort']);_0x576075[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_['pick'](_0x4aa32e[_0x8ea2('0x3e')],_0x27b7c6['filters']));if(_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x576075['where']=_[_0x8ea2('0x4b')](_0x576075[_0x8ea2('0x47')],{'$or':_[_0x8ea2('0x3b')](_0x576075[_0x8ea2('0x41')],function(_0x14dac9){var _0x28e80a={};_0x28e80a[_0x14dac9]={'$like':'%'+_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x28e80a;})});}_0x576075=_[_0x8ea2('0x4b')]({},_0x576075,_0x4aa32e[_0x8ea2('0x5a')]);return _0x36a913['getDescriptions'](_0x576075);}})[_0x8ea2('0x22')](function(_0x1051ac){if(_0x1051ac){_0x3d9242=_0x1051ac['length'];if(!_0x4aa32e[_0x8ea2('0x3e')]['hasOwnProperty']('nolimit')){_0x576075['limit']=qs[_0x8ea2('0x30')](_0x4aa32e['query'][_0x8ea2('0x30')]);_0x576075[_0x8ea2('0x2f')]=qs[_0x8ea2('0x2f')](_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x2f')]);}return _0x36a913[_0x8ea2('0x5e')](_0x576075);}})['then'](function(_0x2f4f45){if(_0x2f4f45){return _0x2f4f45?{'count':_0x3d9242,'rows':_0x2f4f45}:null;}})['then'](respondWithResult(_0x53d9f3,null))[_0x8ea2('0x51')](handleError(_0x53d9f3,null));}; \ No newline at end of file +var _0xb62e=['body','getFields','findOne','ServicenowField','options','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','limit','apply','reject','save','destroy','sendStatus','stack','send','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','name','filter','merge','include','ServicenowConfiguration','findAll','show','params','rawAttributes','includeAll','find','catch','create'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xb62e,0x1de));var _0xeb62=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb62e[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var db=require(_0xeb62('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xeb62('0x1a')][_0xeb62('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x27671e,_0x6822bc,_0x55a629){if(_0x55a629){var _0x333126=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x333126[_0xeb62('0x1c')](_0x6822bc)){return _0x27671e;}else{throw new db[(_0xeb62('0x1d'))]['ValidationError'](_0xeb62('0x1e'));}}else{return _0x27671e;}}function respondWithRpcPromise(_0x195837,_0x2fd4c7,_0x4ce9fa,_0x1f6a1f){return new BPromise(function(_0x15b3e8,_0x184106){var _0x353e2c=_0x1f6a1f||client;return _0x353e2c[_0xeb62('0x1f')](_0x195837,_0x4ce9fa)[_0xeb62('0x20')](function(_0x1fb460){logger[_0xeb62('0x21')](_0xeb62('0x22'),_0x2fd4c7,_0xeb62('0x23'));logger[_0xeb62('0x24')](_0xeb62('0x25'),_0x2fd4c7,_0xeb62('0x23'),JSON['stringify'](_0x1fb460));if(_0x1fb460[_0xeb62('0x26')]){if(_0x1fb460[_0xeb62('0x26')][_0xeb62('0x27')]===0x1f4){logger[_0xeb62('0x26')](_0xeb62('0x22'),_0x2fd4c7,_0x1fb460[_0xeb62('0x26')][_0xeb62('0x28')]);return _0x184106(_0x1fb460['error']['message']);}logger[_0xeb62('0x26')](_0xeb62('0x22'),_0x2fd4c7,_0x1fb460[_0xeb62('0x26')][_0xeb62('0x28')]);return _0x15b3e8(_0x1fb460[_0xeb62('0x26')]['message']);}else{logger['info'](_0xeb62('0x22'),_0x2fd4c7,_0xeb62('0x23'));_0x15b3e8(_0x1fb460[_0xeb62('0x29')][_0xeb62('0x28')]);}})['catch'](function(_0x4e92f5){logger[_0xeb62('0x26')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2fd4c7,_0x4e92f5);_0x184106(_0x4e92f5);});});}function respondWithStatusCode(_0x448327,_0x4b0f46){_0x4b0f46=_0x4b0f46||0xcc;return function(_0xfe3e16){if(_0xfe3e16){return _0x448327['sendStatus'](_0x4b0f46);}return _0x448327[_0xeb62('0x2a')](_0x4b0f46)[_0xeb62('0x2b')]();};}function respondWithResult(_0x46d1bb,_0x4e4268){_0x4e4268=_0x4e4268||0xc8;return function(_0x3ef784){if(_0x3ef784){return _0x46d1bb[_0xeb62('0x2a')](_0x4e4268)[_0xeb62('0x2c')](_0x3ef784);}};}function respondWithFilteredResult(_0xe8872c,_0x42f486){return function(_0x360efd){if(_0x360efd){var _0x511202=_0x360efd[_0xeb62('0x2d')],_0x192517=_0x42f486[_0xeb62('0x2e')],_0x1616ee=_0x42f486[_0xeb62('0x2e')]+_0x42f486[_0xeb62('0x2f')],_0x57169a;if(_0x1616ee>=_0x511202){_0x1616ee=_0x511202;_0x57169a=0xc8;}else{_0x57169a=0xce;}_0xe8872c[_0xeb62('0x2a')](_0x57169a);return _0xe8872c['set']('Content-Range',_0x192517+'-'+_0x1616ee+'/'+_0x511202)[_0xeb62('0x2c')](_0x360efd);}return null;};}function patchUpdates(_0x357cf4){return function(_0x1607ef){try{jsonpatch[_0xeb62('0x30')](_0x1607ef,_0x357cf4,!![]);}catch(_0x42b197){return BPromise[_0xeb62('0x31')](_0x42b197);}return _0x1607ef[_0xeb62('0x32')]();};}function saveUpdates(_0x4be25d,_0x411062){return function(_0x47a94b){if(_0x47a94b){return _0x47a94b['update'](_0x4be25d)[_0xeb62('0x20')](function(_0x286455){return _0x286455;});}return null;};}function removeEntity(_0x4978e8,_0x1ade38){return function(_0x4bcfce){if(_0x4bcfce){return _0x4bcfce[_0xeb62('0x33')]()[_0xeb62('0x20')](function(){_0x4978e8['status'](0xcc)[_0xeb62('0x2b')]();});}};}function handleEntityNotFound(_0xe2589,_0x5914c9){return function(_0x1b3a60){if(!_0x1b3a60){_0xe2589[_0xeb62('0x34')](0x194);}return _0x1b3a60;};}function handleError(_0x38b116,_0x2203cb){_0x2203cb=_0x2203cb||0x1f4;return function(_0x513dd8){logger[_0xeb62('0x26')](_0x513dd8[_0xeb62('0x35')]);if(_0x513dd8['name']){delete _0x513dd8['name'];}_0x38b116[_0xeb62('0x2a')](_0x2203cb)[_0xeb62('0x36')](_0x513dd8);};}exports['index']=function(_0x338ab7,_0x30cff0){var _0x11eadb={},_0x1f839a={},_0x21f604={'count':0x0,'rows':[]};var _0x15387a=_[_0xeb62('0x37')](db['ServicenowConfiguration']['rawAttributes'],function(_0x3306e3){return{'name':_0x3306e3[_0xeb62('0x38')],'type':_0x3306e3[_0xeb62('0x39')][_0xeb62('0x3a')]};});_0x1f839a['model']=_[_0xeb62('0x37')](_0x15387a,'name');_0x1f839a[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x338ab7[_0xeb62('0x3b')]);_0x1f839a[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x1f839a[_0xeb62('0x3f')],_0x1f839a[_0xeb62('0x3b')]);_0x11eadb[_0xeb62('0x40')]=_['intersection'](_0x1f839a[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x11eadb['attributes']=_0x11eadb['attributes'][_0xeb62('0x42')]?_0x11eadb[_0xeb62('0x40')]:_0x1f839a['model'];if(!_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x43')]('nolimit')){_0x11eadb[_0xeb62('0x2f')]=qs['limit'](_0x338ab7[_0xeb62('0x3b')]['limit']);_0x11eadb[_0xeb62('0x2e')]=qs['offset'](_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x2e')]);}_0x11eadb[_0xeb62('0x44')]=qs['sort'](_0x338ab7['query'][_0xeb62('0x45')]);_0x11eadb[_0xeb62('0x46')]=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x338ab7[_0xeb62('0x3b')],_0x1f839a['filters']),_0x15387a);if(_0x338ab7[_0xeb62('0x3b')]['filter']){_0x11eadb[_0xeb62('0x46')]=_['merge'](_0x11eadb[_0xeb62('0x46')],{'$or':_['map'](_0x15387a,function(_0x26c77d){if(_0x26c77d['type']!==_0xeb62('0x48')){var _0x4624e7={};_0x4624e7[_0x26c77d[_0xeb62('0x49')]]={'$like':'%'+_0x338ab7[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x4624e7;}})});}_0x11eadb=_[_0xeb62('0x4b')]({},_0x11eadb,_0x338ab7['options']);var _0x19af97={'where':_0x11eadb[_0xeb62('0x46')]};return db['ServicenowConfiguration']['count'](_0x19af97)['then'](function(_0x4d4c5a){_0x21f604[_0xeb62('0x2d')]=_0x4d4c5a;if(_0x338ab7[_0xeb62('0x3b')]['includeAll']){_0x11eadb[_0xeb62('0x4c')]=[{'all':!![]}];}return db[_0xeb62('0x4d')][_0xeb62('0x4e')](_0x11eadb);})[_0xeb62('0x20')](function(_0x39595c){_0x21f604['rows']=_0x39595c;return _0x21f604;})[_0xeb62('0x20')](respondWithFilteredResult(_0x30cff0,_0x11eadb))['catch'](handleError(_0x30cff0,null));};exports[_0xeb62('0x4f')]=function(_0x2cf2b5,_0x7fb53f){var _0x18c40d={'raw':![],'where':{'id':_0x2cf2b5[_0xeb62('0x50')]['id']}},_0x1f2d87={};_0x1f2d87[_0xeb62('0x3f')]=_[_0xeb62('0x3c')](db[_0xeb62('0x4d')][_0xeb62('0x51')]);_0x1f2d87[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x2cf2b5['query']);_0x1f2d87[_0xeb62('0x3d')]=_['intersection'](_0x1f2d87['model'],_0x1f2d87[_0xeb62('0x3b')]);_0x18c40d[_0xeb62('0x40')]=_['intersection'](_0x1f2d87[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x2cf2b5['query'][_0xeb62('0x41')]));_0x18c40d[_0xeb62('0x40')]=_0x18c40d[_0xeb62('0x40')][_0xeb62('0x42')]?_0x18c40d[_0xeb62('0x40')]:_0x1f2d87[_0xeb62('0x3f')];if(_0x2cf2b5[_0xeb62('0x3b')][_0xeb62('0x52')]){_0x18c40d['include']=[{'all':!![]}];}_0x18c40d=_[_0xeb62('0x4b')]({},_0x18c40d,_0x2cf2b5['options']);return db[_0xeb62('0x4d')][_0xeb62('0x53')](_0x18c40d)[_0xeb62('0x20')](handleEntityNotFound(_0x7fb53f,null))[_0xeb62('0x20')](respondWithResult(_0x7fb53f,null))[_0xeb62('0x54')](handleError(_0x7fb53f,null));};exports[_0xeb62('0x55')]=function(_0xc3aee0,_0xf12d72){return db['ServicenowConfiguration']['create'](_0xc3aee0['body'],{})['then'](respondWithResult(_0xf12d72,0xc9))[_0xeb62('0x54')](handleError(_0xf12d72,null));};exports['update']=function(_0x3876ca,_0x5c0e7f){if(_0x3876ca[_0xeb62('0x56')]['id']){delete _0x3876ca[_0xeb62('0x56')]['id'];}return db[_0xeb62('0x4d')]['find']({'where':{'id':_0x3876ca[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x5c0e7f,null))['then'](saveUpdates(_0x3876ca[_0xeb62('0x56')],null))[_0xeb62('0x20')](respondWithResult(_0x5c0e7f,null))[_0xeb62('0x54')](handleError(_0x5c0e7f,null));};exports[_0xeb62('0x33')]=function(_0x55370c,_0x3be3e1){return db[_0xeb62('0x4d')]['find']({'where':{'id':_0x55370c[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x3be3e1,null))[_0xeb62('0x20')](removeEntity(_0x3be3e1,null))[_0xeb62('0x54')](handleError(_0x3be3e1,null));};exports[_0xeb62('0x57')]=function(_0x46da69,_0x3e55bf,_0x1b354d){var _0x222d0c={};var _0x1db841={};var _0x130153;var _0x15c93f;return db[_0xeb62('0x4d')][_0xeb62('0x58')]({'where':{'id':_0x46da69[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x3e55bf,null))['then'](function(_0x5550b6){if(_0x5550b6){_0x130153=_0x5550b6;_0x1db841['model']=_['keys'](db[_0xeb62('0x59')]['rawAttributes']);_0x1db841[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x46da69[_0xeb62('0x3b')]);_0x1db841[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0x1db841[_0xeb62('0x3f')],_0x1db841[_0xeb62('0x3b')]);_0x222d0c[_0xeb62('0x40')]=_[_0xeb62('0x3e')](_0x1db841[_0xeb62('0x3f')],qs['fields'](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x222d0c[_0xeb62('0x40')]=_0x222d0c[_0xeb62('0x40')]['length']?_0x222d0c[_0xeb62('0x40')]:_0x1db841[_0xeb62('0x3f')];_0x222d0c[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x45')]);_0x222d0c[_0xeb62('0x46')]=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x46da69[_0xeb62('0x3b')],_0x1db841[_0xeb62('0x3d')]));if(_0x46da69['query'][_0xeb62('0x4a')]){_0x222d0c[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x222d0c[_0xeb62('0x46')],{'$or':_[_0xeb62('0x37')](_0x222d0c[_0xeb62('0x40')],function(_0x388b31){var _0x1dcc91={};_0x1dcc91[_0x388b31]={'$like':'%'+_0x46da69[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x1dcc91;})});}_0x222d0c=_['merge']({},_0x222d0c,_0x46da69[_0xeb62('0x5a')]);return _0x130153[_0xeb62('0x57')](_0x222d0c);}})[_0xeb62('0x20')](function(_0xdd124f){if(_0xdd124f){_0x15c93f=_0xdd124f['length'];if(!_0x46da69[_0xeb62('0x3b')][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x222d0c[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x46da69[_0xeb62('0x3b')]['limit']);_0x222d0c[_0xeb62('0x2e')]=qs[_0xeb62('0x2e')](_0x46da69[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x130153[_0xeb62('0x57')](_0x222d0c);}})[_0xeb62('0x20')](function(_0x2e4502){if(_0x2e4502){return _0x2e4502?{'count':_0x15c93f,'rows':_0x2e4502}:null;}})[_0xeb62('0x20')](respondWithResult(_0x3e55bf,null))[_0xeb62('0x54')](handleError(_0x3e55bf,null));};exports[_0xeb62('0x5c')]=function(_0x1c3cb0,_0x1bf4f2,_0x1cbf33){var _0x129d44={};var _0xddc862={};var _0x2bbbff;var _0x4eb152;return db[_0xeb62('0x4d')]['findOne']({'where':{'id':_0x1c3cb0[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x1bf4f2,null))['then'](function(_0x2d8bbe){if(_0x2d8bbe){_0x2bbbff=_0x2d8bbe;_0xddc862[_0xeb62('0x3f')]=_[_0xeb62('0x3c')](db[_0xeb62('0x59')][_0xeb62('0x51')]);_0xddc862[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x1c3cb0[_0xeb62('0x3b')]);_0xddc862[_0xeb62('0x3d')]=_[_0xeb62('0x3e')](_0xddc862[_0xeb62('0x3f')],_0xddc862[_0xeb62('0x3b')]);_0x129d44[_0xeb62('0x40')]=_['intersection'](_0xddc862[_0xeb62('0x3f')],qs[_0xeb62('0x41')](_0x1c3cb0['query'][_0xeb62('0x41')]));_0x129d44['attributes']=_0x129d44[_0xeb62('0x40')][_0xeb62('0x42')]?_0x129d44[_0xeb62('0x40')]:_0xddc862[_0xeb62('0x3f')];_0x129d44[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x1c3cb0['query'][_0xeb62('0x45')]);_0x129d44['where']=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x1c3cb0[_0xeb62('0x3b')],_0xddc862[_0xeb62('0x3d')]));if(_0x1c3cb0[_0xeb62('0x3b')]['filter']){_0x129d44[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x129d44[_0xeb62('0x46')],{'$or':_['map'](_0x129d44[_0xeb62('0x40')],function(_0x3ad496){var _0x8a8ef3={};_0x8a8ef3[_0x3ad496]={'$like':'%'+_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x8a8ef3;})});}_0x129d44=_[_0xeb62('0x4b')]({},_0x129d44,_0x1c3cb0['options']);return _0x2bbbff['getSubjects'](_0x129d44);}})['then'](function(_0x50590b){if(_0x50590b){_0x4eb152=_0x50590b['length'];if(!_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x129d44[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x2f')]);_0x129d44[_0xeb62('0x2e')]=qs[_0xeb62('0x2e')](_0x1c3cb0[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x2bbbff[_0xeb62('0x5c')](_0x129d44);}})['then'](function(_0x71c47b){if(_0x71c47b){return _0x71c47b?{'count':_0x4eb152,'rows':_0x71c47b}:null;}})[_0xeb62('0x20')](respondWithResult(_0x1bf4f2,null))[_0xeb62('0x54')](handleError(_0x1bf4f2,null));};exports[_0xeb62('0x5d')]=function(_0x25106d,_0x2f43d6,_0x30c8e0){var _0x214fd0={};var _0x1bb222={};var _0x33b16b;var _0x124847;return db[_0xeb62('0x4d')][_0xeb62('0x58')]({'where':{'id':_0x25106d[_0xeb62('0x50')]['id']}})[_0xeb62('0x20')](handleEntityNotFound(_0x2f43d6,null))[_0xeb62('0x20')](function(_0x29648f){if(_0x29648f){_0x33b16b=_0x29648f;_0x1bb222[_0xeb62('0x3f')]=_['keys'](db[_0xeb62('0x59')]['rawAttributes']);_0x1bb222[_0xeb62('0x3b')]=_[_0xeb62('0x3c')](_0x25106d['query']);_0x1bb222[_0xeb62('0x3d')]=_['intersection'](_0x1bb222['model'],_0x1bb222[_0xeb62('0x3b')]);_0x214fd0[_0xeb62('0x40')]=_[_0xeb62('0x3e')](_0x1bb222[_0xeb62('0x3f')],qs['fields'](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x41')]));_0x214fd0['attributes']=_0x214fd0[_0xeb62('0x40')][_0xeb62('0x42')]?_0x214fd0[_0xeb62('0x40')]:_0x1bb222[_0xeb62('0x3f')];_0x214fd0[_0xeb62('0x44')]=qs[_0xeb62('0x45')](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x45')]);_0x214fd0['where']=qs[_0xeb62('0x3d')](_[_0xeb62('0x47')](_0x25106d['query'],_0x1bb222[_0xeb62('0x3d')]));if(_0x25106d['query']['filter']){_0x214fd0[_0xeb62('0x46')]=_[_0xeb62('0x4b')](_0x214fd0[_0xeb62('0x46')],{'$or':_[_0xeb62('0x37')](_0x214fd0[_0xeb62('0x40')],function(_0x5072fd){var _0x3da53a={};_0x3da53a[_0x5072fd]={'$like':'%'+_0x25106d[_0xeb62('0x3b')][_0xeb62('0x4a')]+'%'};return _0x3da53a;})});}_0x214fd0=_[_0xeb62('0x4b')]({},_0x214fd0,_0x25106d[_0xeb62('0x5a')]);return _0x33b16b[_0xeb62('0x5d')](_0x214fd0);}})[_0xeb62('0x20')](function(_0x50170b){if(_0x50170b){_0x124847=_0x50170b['length'];if(!_0x25106d['query'][_0xeb62('0x43')](_0xeb62('0x5b'))){_0x214fd0[_0xeb62('0x2f')]=qs[_0xeb62('0x2f')](_0x25106d['query'][_0xeb62('0x2f')]);_0x214fd0['offset']=qs['offset'](_0x25106d[_0xeb62('0x3b')][_0xeb62('0x2e')]);}return _0x33b16b['getDescriptions'](_0x214fd0);}})[_0xeb62('0x20')](function(_0x53aa1c){if(_0x53aa1c){return _0x53aa1c?{'count':_0x124847,'rows':_0x53aa1c}:null;}})[_0xeb62('0x20')](respondWithResult(_0x2f43d6,null))[_0xeb62('0x54')](handleError(_0x2f43d6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 8a81fb9..d5d8051 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 _0x25ab=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4e6290,_0x2f77b2){var _0x415ea3=function(_0xfee577){while(--_0xfee577){_0x4e6290['push'](_0x4e6290['shift']());}};_0x415ea3(++_0x2f77b2);}(_0x25ab,0x104));var _0xb25a=function(_0x12da4c,_0x1381cc){_0x12da4c=_0x12da4c-0x0;var _0x202289=_0x25ab[_0x12da4c];return _0x202289;};'use strict';var _=require(_0xb25a('0x0'));var util=require(_0xb25a('0x1'));var logger=require(_0xb25a('0x2'))(_0xb25a('0x3'));var moment=require(_0xb25a('0x4'));var BPromise=require(_0xb25a('0x5'));var rp=require(_0xb25a('0x6'));var fs=require('fs');var path=require(_0xb25a('0x7'));var rimraf=require(_0xb25a('0x8'));var config=require(_0xb25a('0x9'));var attributes=require(_0xb25a('0xa'));module['exports']=function(_0xaa2a54,_0x47cc9c){return _0xaa2a54[_0xb25a('0xb')](_0xb25a('0xc'),attributes,{'tableName':_0xb25a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd192=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xd192,0x8d));var _0x2d19=function(_0x4a86cf,_0xfc2079){_0x4a86cf=_0x4a86cf-0x0;var _0x14f66a=_0xd192[_0x4a86cf];return _0x14f66a;};'use strict';var _=require(_0x2d19('0x0'));var util=require(_0x2d19('0x1'));var logger=require(_0x2d19('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2d19('0x3'));var rp=require(_0x2d19('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d19('0x5'));var config=require(_0x2d19('0x6'));var attributes=require(_0x2d19('0x7'));module[_0x2d19('0x8')]=function(_0x34b65e,_0x5f1e91){return _0x34b65e[_0x2d19('0x9')](_0x2d19('0xa'),attributes,{'tableName':_0x2d19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 1edaf73..3e9dcb9 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 _0x9ba1=['../../config/environment','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x12ee31,_0x4fb176){var _0x5ede94=function(_0x455762){while(--_0x455762){_0x12ee31['push'](_0x12ee31['shift']());}};_0x5ede94(++_0x4fb176);}(_0x9ba1,0x1c1));var _0x19ba=function(_0x3b3879,_0x5eeb7f){_0x3b3879=_0x3b3879-0x0;var _0x8ddb6a=_0x9ba1[_0x3b3879];return _0x8ddb6a;};'use strict';var _=require(_0x19ba('0x0'));var util=require('util');var moment=require(_0x19ba('0x1'));var BPromise=require(_0x19ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19ba('0x3'));var db=require(_0x19ba('0x4'))['db'];var utils=require(_0x19ba('0x5'));var logger=require(_0x19ba('0x6'))('rpc');var config=require(_0x19ba('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb2d5,_0x38cb5f,_0x1ee4d9){return new BPromise(function(_0x720d61,_0x5be463){return client[_0x19ba('0x8')](_0x5bb2d5,_0x1ee4d9)[_0x19ba('0x9')](function(_0x86edbd){logger[_0x19ba('0xa')](_0x19ba('0xb'),_0x38cb5f,'request\x20sent');logger[_0x19ba('0xc')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x38cb5f,_0x19ba('0xd'),JSON['stringify'](_0x86edbd));if(_0x86edbd[_0x19ba('0xe')]){if(_0x86edbd[_0x19ba('0xe')][_0x19ba('0xf')]===0x1f4){logger['error'](_0x19ba('0xb'),_0x38cb5f,_0x86edbd['error'][_0x19ba('0x10')]);return _0x5be463(_0x86edbd[_0x19ba('0xe')][_0x19ba('0x10')]);}logger[_0x19ba('0xe')](_0x19ba('0xb'),_0x38cb5f,_0x86edbd[_0x19ba('0xe')]['message']);return _0x720d61(_0x86edbd['error']['message']);}else{logger[_0x19ba('0xa')](_0x19ba('0xb'),_0x38cb5f,'request\x20sent');_0x720d61(_0x86edbd[_0x19ba('0x11')]['message']);}})[_0x19ba('0x12')](function(_0x374132){logger[_0x19ba('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x38cb5f,_0x374132);_0x5be463(_0x374132);});});} \ No newline at end of file +var _0x2333=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1f500c,_0x1ea5d5){var _0x2402d7=function(_0x586594){while(--_0x586594){_0x1f500c['push'](_0x1f500c['shift']());}};_0x2402d7(++_0x1ea5d5);}(_0x2333,0x76));var _0x3233=function(_0x555532,_0x55a7d4){_0x555532=_0x555532-0x0;var _0x3f60da=_0x2333[_0x555532];return _0x3f60da;};'use strict';var _=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var moment=require(_0x3233('0x2'));var BPromise=require('bluebird');var rs=require(_0x3233('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3233('0x4'))['db'];var utils=require(_0x3233('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3233('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3233('0x7')][_0x3233('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38e60a,_0xcec35b,_0x53d12f){return new BPromise(function(_0x4b7926,_0x67d901){return client['request'](_0x38e60a,_0x53d12f)[_0x3233('0x9')](function(_0x8031cd){logger[_0x3233('0xa')](_0x3233('0xb'),_0xcec35b,_0x3233('0xc'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xcec35b,_0x3233('0xc'),JSON[_0x3233('0xd')](_0x8031cd));if(_0x8031cd[_0x3233('0xe')]){if(_0x8031cd['error'][_0x3233('0xf')]===0x1f4){logger['error'](_0x3233('0xb'),_0xcec35b,_0x8031cd[_0x3233('0xe')]['message']);return _0x67d901(_0x8031cd['error'][_0x3233('0x10')]);}logger[_0x3233('0xe')](_0x3233('0xb'),_0xcec35b,_0x8031cd[_0x3233('0xe')]['message']);return _0x4b7926(_0x8031cd[_0x3233('0xe')][_0x3233('0x10')]);}else{logger['info'](_0x3233('0xb'),_0xcec35b,_0x3233('0xc'));_0x4b7926(_0x8031cd[_0x3233('0x11')][_0x3233('0x10')]);}})[_0x3233('0x12')](function(_0x55cb96){logger[_0x3233('0xe')](_0x3233('0xb'),_0xcec35b,_0x55cb96);_0x67d901(_0x55cb96);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 1a5e74b..42d1ada 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 _0xa51c=['get','/:id','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x47e85f,_0x2e016e){var _0x4c3cfa=function(_0x541a17){while(--_0x541a17){_0x47e85f['push'](_0x47e85f['shift']());}};_0x4c3cfa(++_0x2e016e);}(_0xa51c,0x114));var _0xca51=function(_0x2a6569,_0x18e24e){_0x2a6569=_0x2a6569-0x0;var _0x4a40f4=_0xa51c[_0x2a6569];return _0x4a40f4;};'use strict';var multer=require(_0xca51('0x0'));var util=require(_0xca51('0x1'));var path=require(_0xca51('0x2'));var timeout=require(_0xca51('0x3'));var express=require('express');var router=express[_0xca51('0x4')]();var auth=require(_0xca51('0x5'));var interaction=require(_0xca51('0x6'));var config=require(_0xca51('0x7'));var controller=require(_0xca51('0x8'));router[_0xca51('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xca51('0x9')](_0xca51('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xca51('0xb')]('/',auth[_0xca51('0xc')](),controller[_0xca51('0xd')]);router[_0xca51('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xca51('0xf')]);router[_0xca51('0x10')](_0xca51('0xa'),auth[_0xca51('0xc')](),controller[_0xca51('0x11')]);module[_0xca51('0x12')]=router; \ No newline at end of file +var _0x9e62=['isAuthenticated','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','index','/:id'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9e62,0x7f));var _0x29e6=function(_0x5c54a8,_0x5273ff){_0x5c54a8=_0x5c54a8-0x0;var _0x4a159a=_0x9e62[_0x5c54a8];return _0x4a159a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x29e6('0x0'));var timeout=require(_0x29e6('0x1'));var express=require(_0x29e6('0x2'));var router=express['Router']();var auth=require(_0x29e6('0x3'));var interaction=require(_0x29e6('0x4'));var config=require('../../config/environment');var controller=require(_0x29e6('0x5'));router[_0x29e6('0x6')]('/',auth['isAuthenticated'](),controller[_0x29e6('0x7')]);router['get'](_0x29e6('0x8'),auth[_0x29e6('0x9')](),controller[_0x29e6('0xa')]);router['post']('/',auth[_0x29e6('0x9')](),controller[_0x29e6('0xb')]);router[_0x29e6('0xc')](_0x29e6('0x8'),auth[_0x29e6('0x9')](),controller[_0x29e6('0xd')]);router[_0x29e6('0xe')]('/:id',auth[_0x29e6('0x9')](),controller[_0x29e6('0xf')]);module[_0x29e6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1932376..ce35d79 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 _0x5cad=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5cad,0x8c));var _0xd5ca=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x5cad[_0x72a33d];return _0x2621d5;};'use strict';var Sequelize=require(_0xd5ca('0x0'));module[_0xd5ca('0x1')]={'type':{'type':Sequelize[_0xd5ca('0x2')](_0xd5ca('0x3'),_0xd5ca('0x4'),_0xd5ca('0x5'),_0xd5ca('0x6')),'defaultValue':_0xd5ca('0x3')},'content':{'type':Sequelize[_0xd5ca('0x7')]},'key':{'type':Sequelize[_0xd5ca('0x7')]},'keyType':{'type':Sequelize[_0xd5ca('0x2')](_0xd5ca('0x3'),_0xd5ca('0x4'),_0xd5ca('0x5'))},'keyContent':{'type':Sequelize[_0xd5ca('0x7')]},'idField':{'type':Sequelize[_0xd5ca('0x7')]},'nameField':{'type':Sequelize[_0xd5ca('0x7')]},'customField':{'type':Sequelize[_0xd5ca('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd5ca('0x7')]}}; \ No newline at end of file +var _0x2881=['customVariable','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x4f096e,_0x30d3c3){var _0x4a33ce=function(_0x107ba6){while(--_0x107ba6){_0x4f096e['push'](_0x4f096e['shift']());}};_0x4a33ce(++_0x30d3c3);}(_0x2881,0x1f1));var _0x1288=function(_0x4f609f,_0x3f82ec){_0x4f609f=_0x4f609f-0x0;var _0x14279b=_0x2881[_0x4f609f];return _0x14279b;};'use strict';var Sequelize=require(_0x1288('0x0'));module[_0x1288('0x1')]={'type':{'type':Sequelize[_0x1288('0x2')](_0x1288('0x3'),_0x1288('0x4'),'customVariable',_0x1288('0x5')),'defaultValue':_0x1288('0x3')},'content':{'type':Sequelize[_0x1288('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1288('0x2')](_0x1288('0x3'),_0x1288('0x4'),_0x1288('0x7'))},'keyContent':{'type':Sequelize[_0x1288('0x6')]},'idField':{'type':Sequelize[_0x1288('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1288('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index e7d9bf2..944b064 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x248c03,_0x327a19){var _0x393236=function(_0x2d2482){while(--_0x2d2482){_0x248c03['push'](_0x248c03['shift']());}};_0x393236(++_0x327a19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x2fa488,_0x408715){var _0x1ec0a9=function(_0x4841bf){while(--_0x4841bf){_0x2fa488['push'](_0x2fa488['shift']());}};_0x1ec0a9(++_0x408715);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c6dc7f4..8956634 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 _0x66a4=['idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intServicenowField.attributes','ServicenowField','servicenow_unique_index'];(function(_0x20fdc1,_0xde1296){var _0x25397c=function(_0x814b51){while(--_0x814b51){_0x20fdc1['push'](_0x20fdc1['shift']());}};_0x25397c(++_0xde1296);}(_0x66a4,0x136));var _0x466a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x466a('0x0'));var logger=require(_0x466a('0x1'))('api');var moment=require(_0x466a('0x2'));var BPromise=require(_0x466a('0x3'));var rp=require(_0x466a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x466a('0x5'));var attributes=require(_0x466a('0x6'));module['exports']=function(_0x40a590,_0x1bfaa6){return _0x40a590['define'](_0x466a('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x466a('0x8'),'fields':[_0x466a('0x9'),_0x466a('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9fc0=['path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a6a35,_0x3170eb){var _0x12a0b2=function(_0x56cb84){while(--_0x56cb84){_0x5a6a35['push'](_0x5a6a35['shift']());}};_0x12a0b2(++_0x3170eb);}(_0x9fc0,0x18e));var _0x09fc=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x9fc0[_0xdd82b4];return _0x549bb2;};'use strict';var _=require(_0x09fc('0x0'));var util=require(_0x09fc('0x1'));var logger=require(_0x09fc('0x2'))(_0x09fc('0x3'));var moment=require(_0x09fc('0x4'));var BPromise=require(_0x09fc('0x5'));var rp=require(_0x09fc('0x6'));var fs=require('fs');var path=require(_0x09fc('0x7'));var rimraf=require(_0x09fc('0x8'));var config=require(_0x09fc('0x9'));var attributes=require(_0x09fc('0xa'));module['exports']=function(_0x22117e,_0x2c7703){return _0x22117e[_0x09fc('0xb')](_0x09fc('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x09fc('0xd'),'fields':[_0x09fc('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 0dd33ff..e6fa281 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 _0xdab7=['request','then','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5b69c0,_0x76da81){var _0x23465c=function(_0x231ece){while(--_0x231ece){_0x5b69c0['push'](_0x5b69c0['shift']());}};_0x23465c(++_0x76da81);}(_0xdab7,0xd1));var _0x7dab=function(_0x4e2903,_0x105e61){_0x4e2903=_0x4e2903-0x0;var _0x1cc3c6=_0xdab7[_0x4e2903];return _0x1cc3c6;};'use strict';var _=require(_0x7dab('0x0'));var util=require(_0x7dab('0x1'));var moment=require('moment');var BPromise=require(_0x7dab('0x2'));var rs=require(_0x7dab('0x3'));var fs=require('fs');var Redis=require(_0x7dab('0x4'));var db=require(_0x7dab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7dab('0x6'))(_0x7dab('0x7'));var config=require(_0x7dab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7dab('0x9')][_0x7dab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bdd31,_0x304539,_0x1a547f){return new BPromise(function(_0x205efb,_0x1317ba){return client[_0x7dab('0xb')](_0x1bdd31,_0x1a547f)[_0x7dab('0xc')](function(_0x29a86e){logger[_0x7dab('0xd')](_0x7dab('0xe'),_0x304539,'request\x20sent');logger[_0x7dab('0xf')](_0x7dab('0x10'),_0x304539,_0x7dab('0x11'),JSON['stringify'](_0x29a86e));if(_0x29a86e['error']){if(_0x29a86e['error'][_0x7dab('0x12')]===0x1f4){logger[_0x7dab('0x13')](_0x7dab('0xe'),_0x304539,_0x29a86e[_0x7dab('0x13')][_0x7dab('0x14')]);return _0x1317ba(_0x29a86e[_0x7dab('0x13')][_0x7dab('0x14')]);}logger['error'](_0x7dab('0xe'),_0x304539,_0x29a86e[_0x7dab('0x13')]['message']);return _0x205efb(_0x29a86e['error']['message']);}else{logger[_0x7dab('0xd')](_0x7dab('0xe'),_0x304539,_0x7dab('0x11'));_0x205efb(_0x29a86e[_0x7dab('0x15')][_0x7dab('0x14')]);}})['catch'](function(_0x7528a4){logger[_0x7dab('0x13')](_0x7dab('0xe'),_0x304539,_0x7528a4);_0x1317ba(_0x7528a4);});});} \ No newline at end of file +var _0xec58=['debug','request\x20sent','error','message','ServicenowField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0xe999fe,_0x43b83f){var _0x1f2e44=function(_0x84c797){while(--_0x84c797){_0xe999fe['push'](_0xe999fe['shift']());}};_0x1f2e44(++_0x43b83f);}(_0xec58,0xbb));var _0x8ec5=function(_0x58c576,_0x3df9c6){_0x58c576=_0x58c576-0x0;var _0x2677c3=_0xec58[_0x58c576];return _0x2677c3;};'use strict';var _=require(_0x8ec5('0x0'));var util=require(_0x8ec5('0x1'));var moment=require(_0x8ec5('0x2'));var BPromise=require(_0x8ec5('0x3'));var rs=require(_0x8ec5('0x4'));var fs=require('fs');var Redis=require(_0x8ec5('0x5'));var db=require(_0x8ec5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ec5('0x7'));var config=require(_0x8ec5('0x8'));var jayson=require(_0x8ec5('0x9'));var client=jayson['client'][_0x8ec5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d7ba0,_0x458302,_0x535009){return new BPromise(function(_0x333099,_0x8132ef){return client[_0x8ec5('0xb')](_0x5d7ba0,_0x535009)['then'](function(_0x358cc2){logger[_0x8ec5('0xc')]('ServicenowField,\x20%s,\x20%s',_0x458302,'request\x20sent');logger[_0x8ec5('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x458302,_0x8ec5('0xe'),JSON['stringify'](_0x358cc2));if(_0x358cc2['error']){if(_0x358cc2[_0x8ec5('0xf')]['code']===0x1f4){logger[_0x8ec5('0xf')]('ServicenowField,\x20%s,\x20%s',_0x458302,_0x358cc2[_0x8ec5('0xf')][_0x8ec5('0x10')]);return _0x8132ef(_0x358cc2[_0x8ec5('0xf')]['message']);}logger[_0x8ec5('0xf')](_0x8ec5('0x11'),_0x458302,_0x358cc2[_0x8ec5('0xf')][_0x8ec5('0x10')]);return _0x333099(_0x358cc2[_0x8ec5('0xf')][_0x8ec5('0x10')]);}else{logger['info'](_0x8ec5('0x11'),_0x458302,_0x8ec5('0xe'));_0x333099(_0x358cc2[_0x8ec5('0x12')][_0x8ec5('0x10')]);}})[_0x8ec5('0x13')](function(_0x19d1d4){logger[_0x8ec5('0xf')]('ServicenowField,\x20%s,\x20%s',_0x458302,_0x19d1d4);_0x8132ef(_0x19d1d4);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bcbc530..272608e 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 _0x25d2=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','multer','util','path','express','../../components/auth/service','./intSugarcrmAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations'];(function(_0x441db3,_0x10f359){var _0x16c05d=function(_0x4c0d4e){while(--_0x4c0d4e){_0x441db3['push'](_0x441db3['shift']());}};_0x16c05d(++_0x10f359);}(_0x25d2,0xa9));var _0x225d=function(_0xca77a0,_0x421f3f){_0xca77a0=_0xca77a0-0x0;var _0x1d67b0=_0x25d2[_0xca77a0];return _0x1d67b0;};'use strict';var multer=require(_0x225d('0x0'));var util=require(_0x225d('0x1'));var path=require(_0x225d('0x2'));var timeout=require('connect-timeout');var express=require(_0x225d('0x3'));var router=express['Router']();var auth=require(_0x225d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x225d('0x5'));router[_0x225d('0x6')]('/',auth[_0x225d('0x7')](),controller['index']);router[_0x225d('0x6')](_0x225d('0x8'),auth['isAuthenticated'](),controller[_0x225d('0x9')]);router[_0x225d('0x6')](_0x225d('0xa'),auth['isAuthenticated'](),controller[_0x225d('0xb')]);router[_0x225d('0x6')](_0x225d('0xc'),auth[_0x225d('0x7')](),controller[_0x225d('0xd')]);router[_0x225d('0xe')]('/',auth[_0x225d('0x7')](),controller[_0x225d('0xf')]);router['post'](_0x225d('0xa'),auth[_0x225d('0x7')](),controller[_0x225d('0x10')]);router[_0x225d('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x225d('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x225d('0x13')]=router; \ No newline at end of file +var _0x8d26=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','post','create','addConfiguration','put','update'];(function(_0x4934dc,_0x5d530c){var _0x31cb62=function(_0x4cd574){while(--_0x4cd574){_0x4934dc['push'](_0x4934dc['shift']());}};_0x31cb62(++_0x5d530c);}(_0x8d26,0x76));var _0x68d2=function(_0x174a2d,_0x44cf92){_0x174a2d=_0x174a2d-0x0;var _0x3a58c3=_0x8d26[_0x174a2d];return _0x3a58c3;};'use strict';var multer=require(_0x68d2('0x0'));var util=require(_0x68d2('0x1'));var path=require(_0x68d2('0x2'));var timeout=require(_0x68d2('0x3'));var express=require(_0x68d2('0x4'));var router=express[_0x68d2('0x5')]();var auth=require(_0x68d2('0x6'));var interaction=require(_0x68d2('0x7'));var config=require(_0x68d2('0x8'));var controller=require(_0x68d2('0x9'));router[_0x68d2('0xa')]('/',auth[_0x68d2('0xb')](),controller[_0x68d2('0xc')]);router[_0x68d2('0xa')](_0x68d2('0xd'),auth[_0x68d2('0xb')](),controller['show']);router[_0x68d2('0xa')](_0x68d2('0xe'),auth[_0x68d2('0xb')](),controller['getConfigurations']);router[_0x68d2('0xa')]('/:id/fields',auth[_0x68d2('0xb')](),controller['getFields']);router[_0x68d2('0xf')]('/',auth['isAuthenticated'](),controller[_0x68d2('0x10')]);router['post'](_0x68d2('0xe'),auth['isAuthenticated'](),controller[_0x68d2('0x11')]);router[_0x68d2('0x12')]('/:id',auth[_0x68d2('0xb')](),controller[_0x68d2('0x13')]);router[_0x68d2('0x14')]('/:id',auth[_0x68d2('0xb')](),controller[_0x68d2('0x15')]);module[_0x68d2('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 397ca3e..c71a005 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 _0xc002=['STRING','username','remoteUri','sequelize'];(function(_0x3dede7,_0x7e6b4a){var _0x191ad5=function(_0x4c3e2f){while(--_0x4c3e2f){_0x3dede7['push'](_0x3dede7['shift']());}};_0x191ad5(++_0x7e6b4a);}(_0xc002,0x19f));var _0x2c00=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xc002[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x2c00('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c00('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x2c00('0x2')},'password':{'type':Sequelize[_0x2c00('0x1')]},'remoteUri':{'type':Sequelize[_0x2c00('0x1')],'unique':_0x2c00('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc93e=['remoteUri','username','STRING'];(function(_0xf41df4,_0x2bf29a){var _0x32dea7=function(_0x3493db){while(--_0x3493db){_0xf41df4['push'](_0xf41df4['shift']());}};_0x32dea7(++_0x2bf29a);}(_0xc93e,0x11b));var _0xec93=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0xc93e[_0x4bf96c];return _0x281d09;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xec93('0x0')},'password':{'type':Sequelize[_0xec93('0x1')]},'remoteUri':{'type':Sequelize[_0xec93('0x1')],'unique':_0xec93('0x2')},'serverUrl':{'type':Sequelize[_0xec93('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 9fd0bd1..f21b97e 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 _0xd94a=['JSON','username','PLAIN','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','values','module_fields','includes','label','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','SugarcrmAccount','count','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','direction','password','remoteUri','slice','substring','POST','format','/service/v4_1/rest.php','login'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0xd94a,0x115));var _0xad94=function(_0x49c513,_0x5d89b9){_0x49c513=_0x49c513-0x0;var _0x3ac591=_0xd94a[_0x49c513];return _0x3ac591;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xad94('0x0'));var rimraf=require(_0xad94('0x1'));var zipdir=require(_0xad94('0x2'));var jsonpatch=require(_0xad94('0x3'));var rp=require(_0xad94('0x4'));var moment=require(_0xad94('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad94('0x6'));var util=require(_0xad94('0x7'));var path=require(_0xad94('0x8'));var sox=require('sox');var csv=require(_0xad94('0x9'));var ejs=require(_0xad94('0xa'));var fs=require('fs');var _=require(_0xad94('0xb'));var squel=require(_0xad94('0xc'));var crypto=require(_0xad94('0xd'));var jsforce=require(_0xad94('0xe'));var deskjs=require(_0xad94('0xf'));var toCsv=require(_0xad94('0x9'));var querystring=require(_0xad94('0x10'));var Papa=require('papaparse');var Redis=require(_0xad94('0x11'));var authService=require(_0xad94('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad94('0x13'));var hardwareService=require(_0xad94('0x14'));var logger=require(_0xad94('0x15'))(_0xad94('0x16'));var utils=require('../../config/utils');var config=require(_0xad94('0x17'));var db=require(_0xad94('0x18'))['db'];var integrations=require(_0xad94('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xad94('0x1a')][_0xad94('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3fb013,_0x464497,_0x1ff524){if(_0x1ff524){var _0x5a05db=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a05db['test'](_0x464497)){return _0x3fb013;}else{throw new db[(_0xad94('0x1c'))][(_0xad94('0x1d'))](_0xad94('0x1e'));}}else{return _0x3fb013;}}function respondWithRpcPromise(_0x3f64b1,_0xa6a76e,_0x5479cd,_0x4104cc){return new BPromise(function(_0x2078cf,_0x5e7790){var _0xc41591=_0x4104cc||client;return _0xc41591[_0xad94('0x1f')](_0x3f64b1,_0x5479cd)[_0xad94('0x20')](function(_0x542afa){logger[_0xad94('0x21')](_0xad94('0x22'),_0xa6a76e,_0xad94('0x23'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xa6a76e,_0xad94('0x23'),JSON[_0xad94('0x24')](_0x542afa));if(_0x542afa[_0xad94('0x25')]){if(_0x542afa['error'][_0xad94('0x26')]===0x1f4){logger[_0xad94('0x25')](_0xad94('0x22'),_0xa6a76e,_0x542afa[_0xad94('0x25')]['message']);return _0x5e7790(_0x542afa[_0xad94('0x25')]['message']);}logger[_0xad94('0x25')](_0xad94('0x22'),_0xa6a76e,_0x542afa[_0xad94('0x25')][_0xad94('0x27')]);return _0x2078cf(_0x542afa[_0xad94('0x25')][_0xad94('0x27')]);}else{logger[_0xad94('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0xa6a76e,_0xad94('0x23'));_0x2078cf(_0x542afa['result']['message']);}})[_0xad94('0x28')](function(_0x430186){logger['error'](_0xad94('0x22'),_0xa6a76e,_0x430186);_0x5e7790(_0x430186);});});}function respondWithStatusCode(_0x4c8bf1,_0x255052){_0x255052=_0x255052||0xcc;return function(_0x4dfe01){if(_0x4dfe01){return _0x4c8bf1[_0xad94('0x29')](_0x255052);}return _0x4c8bf1[_0xad94('0x2a')](_0x255052)[_0xad94('0x2b')]();};}function respondWithResult(_0x20bd7b,_0x490fca){_0x490fca=_0x490fca||0xc8;return function(_0x824ac7){if(_0x824ac7){return _0x20bd7b[_0xad94('0x2a')](_0x490fca)[_0xad94('0x2c')](_0x824ac7);}};}function respondWithFilteredResult(_0x51f733,_0x5c7c78){return function(_0x577e77){if(_0x577e77){var _0x443384=_0x577e77['count'],_0xe64b14=_0x5c7c78[_0xad94('0x2d')],_0xb0b19c=_0x5c7c78[_0xad94('0x2d')]+_0x5c7c78['limit'],_0x221c64;if(_0xb0b19c>=_0x443384){_0xb0b19c=_0x443384;_0x221c64=0xc8;}else{_0x221c64=0xce;}_0x51f733[_0xad94('0x2a')](_0x221c64);return _0x51f733[_0xad94('0x2e')](_0xad94('0x2f'),_0xe64b14+'-'+_0xb0b19c+'/'+_0x443384)['json'](_0x577e77);}return null;};}function patchUpdates(_0x431a1e){return function(_0x3df553){try{jsonpatch[_0xad94('0x30')](_0x3df553,_0x431a1e,!![]);}catch(_0x5abe15){return BPromise[_0xad94('0x31')](_0x5abe15);}return _0x3df553['save']();};}function saveUpdates(_0xfe9fc,_0x1beb85){return function(_0x383728){if(_0x383728){return _0x383728[_0xad94('0x32')](_0xfe9fc)[_0xad94('0x20')](function(_0x2009c8){return _0x2009c8;});}return null;};}function removeEntity(_0x58b0f0,_0x4720ea){return function(_0x5d1e68){if(_0x5d1e68){return _0x5d1e68[_0xad94('0x33')]()['then'](function(){_0x58b0f0[_0xad94('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aec1b,_0x2be348){return function(_0x1eaebe){if(!_0x1eaebe){_0x5aec1b[_0xad94('0x29')](0x194);}return _0x1eaebe;};}function handleError(_0x135535,_0x54e281){_0x54e281=_0x54e281||0x1f4;return function(_0x59a413){logger[_0xad94('0x25')](_0x59a413[_0xad94('0x34')]);if(_0x59a413[_0xad94('0x35')]){delete _0x59a413[_0xad94('0x35')];}_0x135535[_0xad94('0x2a')](_0x54e281)[_0xad94('0x36')](_0x59a413);};}exports[_0xad94('0x37')]=function(_0x42cec8,_0x32c3aa){var _0xefd92c={},_0x2c7990={},_0x1159de={'count':0x0,'rows':[]};var _0x199508=_[_0xad94('0x38')](db['SugarcrmAccount']['rawAttributes'],function(_0x3f875f){return{'name':_0x3f875f[_0xad94('0x39')],'type':_0x3f875f['type'][_0xad94('0x3a')]};});_0x2c7990[_0xad94('0x3b')]=_[_0xad94('0x38')](_0x199508,_0xad94('0x35'));_0x2c7990[_0xad94('0x3c')]=_[_0xad94('0x3d')](_0x42cec8['query']);_0x2c7990[_0xad94('0x3e')]=_['intersection'](_0x2c7990[_0xad94('0x3b')],_0x2c7990['query']);_0xefd92c[_0xad94('0x3f')]=_[_0xad94('0x40')](_0x2c7990[_0xad94('0x3b')],qs[_0xad94('0x41')](_0x42cec8[_0xad94('0x3c')][_0xad94('0x41')]));_0xefd92c['attributes']=_0xefd92c[_0xad94('0x3f')]['length']?_0xefd92c[_0xad94('0x3f')]:_0x2c7990[_0xad94('0x3b')];if(!_0x42cec8[_0xad94('0x3c')][_0xad94('0x42')]('nolimit')){_0xefd92c[_0xad94('0x43')]=qs[_0xad94('0x43')](_0x42cec8[_0xad94('0x3c')][_0xad94('0x43')]);_0xefd92c[_0xad94('0x2d')]=qs[_0xad94('0x2d')](_0x42cec8[_0xad94('0x3c')][_0xad94('0x2d')]);}_0xefd92c['order']=qs[_0xad94('0x44')](_0x42cec8[_0xad94('0x3c')][_0xad94('0x44')]);_0xefd92c[_0xad94('0x45')]=qs['filters'](_[_0xad94('0x46')](_0x42cec8['query'],_0x2c7990[_0xad94('0x3e')]),_0x199508);if(_0x42cec8[_0xad94('0x3c')][_0xad94('0x47')]){_0xefd92c[_0xad94('0x45')]=_[_0xad94('0x48')](_0xefd92c[_0xad94('0x45')],{'$or':_[_0xad94('0x38')](_0x199508,function(_0x111e57){if(_0x111e57['type']!=='VIRTUAL'){var _0x40aa3e={};_0x40aa3e[_0x111e57['name']]={'$like':'%'+_0x42cec8[_0xad94('0x3c')][_0xad94('0x47')]+'%'};return _0x40aa3e;}})});}_0xefd92c=_[_0xad94('0x48')]({},_0xefd92c,_0x42cec8[_0xad94('0x49')]);var _0x421d64={'where':_0xefd92c['where']};return db[_0xad94('0x4a')][_0xad94('0x4b')](_0x421d64)[_0xad94('0x20')](function(_0x552184){_0x1159de[_0xad94('0x4b')]=_0x552184;if(_0x42cec8[_0xad94('0x3c')][_0xad94('0x4c')]){_0xefd92c[_0xad94('0x4d')]=[{'all':!![]}];}return db[_0xad94('0x4a')][_0xad94('0x4e')](_0xefd92c);})['then'](function(_0x2556c8){_0x1159de[_0xad94('0x4f')]=_0x2556c8;return _0x1159de;})[_0xad94('0x20')](respondWithFilteredResult(_0x32c3aa,_0xefd92c))[_0xad94('0x28')](handleError(_0x32c3aa,null));};exports[_0xad94('0x50')]=function(_0x426595,_0xd518c9){var _0x8a52f9={'raw':![],'where':{'id':_0x426595[_0xad94('0x51')]['id']}},_0x432ec6={};_0x432ec6['model']=_[_0xad94('0x3d')](db['SugarcrmAccount'][_0xad94('0x52')]);_0x432ec6[_0xad94('0x3c')]=_['keys'](_0x426595['query']);_0x432ec6[_0xad94('0x3e')]=_[_0xad94('0x40')](_0x432ec6['model'],_0x432ec6[_0xad94('0x3c')]);_0x8a52f9[_0xad94('0x3f')]=_[_0xad94('0x40')](_0x432ec6[_0xad94('0x3b')],qs['fields'](_0x426595[_0xad94('0x3c')]['fields']));_0x8a52f9[_0xad94('0x3f')]=_0x8a52f9['attributes'][_0xad94('0x53')]?_0x8a52f9[_0xad94('0x3f')]:_0x432ec6[_0xad94('0x3b')];if(_0x426595[_0xad94('0x3c')][_0xad94('0x4c')]){_0x8a52f9[_0xad94('0x4d')]=[{'all':!![]}];}_0x8a52f9=_[_0xad94('0x48')]({},_0x8a52f9,_0x426595[_0xad94('0x49')]);return db['SugarcrmAccount'][_0xad94('0x54')](_0x8a52f9)[_0xad94('0x20')](handleEntityNotFound(_0xd518c9,null))[_0xad94('0x20')](respondWithResult(_0xd518c9,null))[_0xad94('0x28')](handleError(_0xd518c9,null));};exports[_0xad94('0x55')]=function(_0x49a67a,_0x5bc4b9){return db[_0xad94('0x4a')]['create'](_0x49a67a[_0xad94('0x56')],{})[_0xad94('0x20')](respondWithResult(_0x5bc4b9,0xc9))[_0xad94('0x28')](handleError(_0x5bc4b9,null));};exports['update']=function(_0x165f77,_0x57bb79){if(_0x165f77['body']['id']){delete _0x165f77[_0xad94('0x56')]['id'];}return db[_0xad94('0x4a')][_0xad94('0x54')]({'where':{'id':_0x165f77[_0xad94('0x51')]['id']}})[_0xad94('0x20')](handleEntityNotFound(_0x57bb79,null))[_0xad94('0x20')](saveUpdates(_0x165f77[_0xad94('0x56')],null))[_0xad94('0x20')](respondWithResult(_0x57bb79,null))[_0xad94('0x28')](handleError(_0x57bb79,null));};exports['destroy']=function(_0x13490c,_0x41a805){return db['SugarcrmAccount'][_0xad94('0x54')]({'where':{'id':_0x13490c[_0xad94('0x51')]['id']}})[_0xad94('0x20')](handleEntityNotFound(_0x41a805,null))[_0xad94('0x20')](removeEntity(_0x41a805,null))[_0xad94('0x28')](handleError(_0x41a805,null));};exports[_0xad94('0x57')]=function(_0x126f6d,_0x4833c8,_0x32734d){var _0x1554bb={};var _0xfc0f13={};var _0x59c049;var _0x435ce5;return db[_0xad94('0x4a')][_0xad94('0x58')]({'where':{'id':_0x126f6d[_0xad94('0x51')]['id']}})[_0xad94('0x20')](handleEntityNotFound(_0x4833c8,null))[_0xad94('0x20')](function(_0xc2d32a){if(_0xc2d32a){_0x59c049=_0xc2d32a;_0xfc0f13[_0xad94('0x3b')]=_[_0xad94('0x3d')](db[_0xad94('0x59')][_0xad94('0x52')]);_0xfc0f13['query']=_[_0xad94('0x3d')](_0x126f6d[_0xad94('0x3c')]);_0xfc0f13[_0xad94('0x3e')]=_['intersection'](_0xfc0f13[_0xad94('0x3b')],_0xfc0f13[_0xad94('0x3c')]);_0x1554bb[_0xad94('0x3f')]=_['intersection'](_0xfc0f13[_0xad94('0x3b')],qs[_0xad94('0x41')](_0x126f6d[_0xad94('0x3c')][_0xad94('0x41')]));_0x1554bb[_0xad94('0x3f')]=_0x1554bb[_0xad94('0x3f')]['length']?_0x1554bb[_0xad94('0x3f')]:_0xfc0f13[_0xad94('0x3b')];_0x1554bb['order']=qs['sort'](_0x126f6d[_0xad94('0x3c')]['sort']);_0x1554bb[_0xad94('0x45')]=qs[_0xad94('0x3e')](_[_0xad94('0x46')](_0x126f6d['query'],_0xfc0f13['filters']));if(_0x126f6d[_0xad94('0x3c')][_0xad94('0x47')]){_0x1554bb[_0xad94('0x45')]=_[_0xad94('0x48')](_0x1554bb[_0xad94('0x45')],{'$or':_['map'](_0x1554bb[_0xad94('0x3f')],function(_0x567e89){var _0x32f5f3={};_0x32f5f3[_0x567e89]={'$like':'%'+_0x126f6d[_0xad94('0x3c')][_0xad94('0x47')]+'%'};return _0x32f5f3;})});}_0x1554bb=_['merge']({},_0x1554bb,_0x126f6d['options']);return _0x59c049['getConfigurations'](_0x1554bb);}})['then'](function(_0x3d3dfd){if(_0x3d3dfd){_0x435ce5=_0x3d3dfd[_0xad94('0x53')];if(!_0x126f6d['query'][_0xad94('0x42')](_0xad94('0x5a'))){_0x1554bb['limit']=qs[_0xad94('0x43')](_0x126f6d[_0xad94('0x3c')][_0xad94('0x43')]);_0x1554bb['offset']=qs[_0xad94('0x2d')](_0x126f6d['query'][_0xad94('0x2d')]);}return _0x59c049[_0xad94('0x57')](_0x1554bb);}})[_0xad94('0x20')](function(_0x16a9f3){if(_0x16a9f3){return _0x16a9f3?{'count':_0x435ce5,'rows':_0x16a9f3}:null;}})['then'](respondWithResult(_0x4833c8,null))[_0xad94('0x28')](handleError(_0x4833c8,null));};exports['addConfiguration']=function(_0x207b10,_0x44853b,_0x387631){if(_0x207b10[_0xad94('0x56')]['id']){delete _0x207b10[_0xad94('0x56')]['id'];}return db[_0xad94('0x4a')][_0xad94('0x58')]({'where':{'id':_0x207b10[_0xad94('0x51')]['id']}})[_0xad94('0x20')](handleEntityNotFound(_0x44853b,null))[_0xad94('0x20')](function(_0x51c6c2){if(_0x51c6c2){_0x207b10[_0xad94('0x56')][_0xad94('0x5b')]=_0x51c6c2['id'];_0x207b10[_0xad94('0x56')][_0xad94('0x5c')]=integrations[_0xad94('0x5d')](_0x207b10['body'][_0xad94('0x5e')],_0x207b10[_0xad94('0x56')][_0xad94('0x5f')]);_0x207b10[_0xad94('0x56')][_0xad94('0x60')]=integrations[_0xad94('0x61')](_0x207b10[_0xad94('0x56')][_0xad94('0x5e')],_0x207b10[_0xad94('0x56')][_0xad94('0x5f')]);return db[_0xad94('0x59')][_0xad94('0x55')](_0x207b10[_0xad94('0x56')],{'include':[{'model':db['SugarcrmField'],'as':_0xad94('0x5c')},{'model':db[_0xad94('0x62')],'as':_0xad94('0x60')}]});}return null;})['then'](respondWithResult(_0x44853b,null))[_0xad94('0x28')](handleError(_0x44853b,null));};exports[_0xad94('0x63')]=function(_0xf33566,_0x466b8e,_0x51a19b){var _0x133ad2='';var _0x525856=['id',_0xad94('0x35'),_0xad94('0x64'),_0xad94('0x65'),_0xad94('0x66'),_0xad94('0x67'),'duration_hours','duration_minutes','parent_id','parent_type','parent_name',_0xad94('0x68')];return db[_0xad94('0x4a')][_0xad94('0x58')]({'where':{'id':_0xf33566[_0xad94('0x51')]['id']},'attributes':['id','username',_0xad94('0x69'),_0xad94('0x6a')]})[_0xad94('0x20')](handleEntityNotFound(_0x466b8e,null))['then'](function(_0x46824a){if(_0x46824a){_0x133ad2=_0x46824a['remoteUri'];var _0x17236d=_0x133ad2[_0xad94('0x6b')](-0x1);if(_0x17236d==='/'){_0x133ad2=_0x133ad2[_0xad94('0x6c')](0x0,_0x133ad2['lastIndexOf'](_0x17236d));}return rp({'method':_0xad94('0x6d'),'uri':util[_0xad94('0x6e')]('%s%s',_0x133ad2,_0xad94('0x6f')),'json':!![],'form':{'method':_0xad94('0x70'),'input_type':'JSON','response_type':_0xad94('0x71'),'rest_data':JSON[_0xad94('0x24')]({'user_auth':{'user_name':_0x46824a[_0xad94('0x72')],'password':_0x46824a['password'],'encryption':_0xad94('0x73')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xad94('0x20')](function(_0x4b0399){if(_0x4b0399&&_0x4b0399['name']!==_0xad94('0x74')&&_0x4b0399['name']!==_0xad94('0x75')){return rp({'method':_0xad94('0x6d'),'uri':util[_0xad94('0x6e')](_0xad94('0x76'),_0x133ad2,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xad94('0x77'),'input_type':'JSON','response_type':_0xad94('0x71'),'rest_data':JSON['stringify']({'session':_0x4b0399['id'],'module_name':_0xad94('0x78')})}})[_0xad94('0x20')](function(_0x213d4c){if(_0x213d4c){var _0x5e4934=_[_0xad94('0x79')](_0x213d4c[_0xad94('0x7a')]);_['remove'](_0x5e4934,function(_0x6a026b){return _0x525856[_0xad94('0x7b')](_0x6a026b['name']);});return{'count':_0x5e4934[_0xad94('0x53')],'rows':_[_0xad94('0x38')](_0x5e4934,function(_0x39a973){return{'id':_0x39a973[_0xad94('0x35')],'name':_0x39a973[_0xad94('0x7c')],'custom':_['endsWith'](_0x39a973[_0xad94('0x35')],'_c')?!![]:![],'options':_0x39a973[_0xad94('0x49')]?_[_0xad94('0x38')](_[_0xad94('0x79')](_0x39a973[_0xad94('0x49')]),function(_0x13a4ba){return{'name':_0x13a4ba[_0xad94('0x7d')],'value':_0x13a4ba[_0xad94('0x35')]};}):[]};})};}})[_0xad94('0x20')](respondWithResult(_0x466b8e,null))[_0xad94('0x28')](function(_0x18ff9f){var _0x3d0f51=_0xf33566[_0xad94('0x3c')][_0xad94('0x7e')]?0x1f4:_0x18ff9f['statusCode']||0x1f4;logger[_0xad94('0x25')](_0xad94('0x7f'),_0xad94('0x63'),_0x3d0f51,JSON[_0xad94('0x24')](_0x18ff9f));delete _0x18ff9f['name'];if(_0x3d0f51===0x191){_0x3d0f51=0x190;}_0x466b8e['status'](_0x3d0f51)[_0xad94('0x36')](_0xf33566[_0xad94('0x3c')][_0xad94('0x7e')]?{'message':_0xad94('0x80'),'statusCode':_0x18ff9f[_0xad94('0x81')]}:_0x18ff9f);});}else{var _0xe123a=0x1f4;_0x466b8e['status'](_0xe123a)[_0xad94('0x36')]({'message':_0xad94('0x80'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xa2ed=['JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','values','module_fields','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','show','params','keys','rawAttributes','find','create','update','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa2ed,0x95));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xda2e('0x0'));var emlformat=require(_0xda2e('0x1'));var rimraf=require(_0xda2e('0x2'));var zipdir=require(_0xda2e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda2e('0x4'));var moment=require(_0xda2e('0x5'));var BPromise=require(_0xda2e('0x6'));var Mustache=require(_0xda2e('0x7'));var util=require(_0xda2e('0x8'));var path=require(_0xda2e('0x9'));var sox=require(_0xda2e('0xa'));var csv=require('to-csv');var ejs=require(_0xda2e('0xb'));var fs=require('fs');var _=require(_0xda2e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda2e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xda2e('0xe'));var querystring=require(_0xda2e('0xf'));var Papa=require(_0xda2e('0x10'));var Redis=require(_0xda2e('0x11'));var authService=require(_0xda2e('0x12'));var qs=require(_0xda2e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda2e('0x14'));var logger=require('../../config/logger')(_0xda2e('0x15'));var utils=require('../../config/utils');var config=require(_0xda2e('0x16'));var db=require(_0xda2e('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xda2e('0x18'));var client=jayson[_0xda2e('0x19')][_0xda2e('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x37b667,_0x151d05,_0x4fd581){if(_0x4fd581){var _0x5d2ccd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d2ccd[_0xda2e('0x1b')](_0x151d05)){return _0x37b667;}else{throw new db[(_0xda2e('0x1c'))][(_0xda2e('0x1d'))](_0xda2e('0x1e'));}}else{return _0x37b667;}}function respondWithRpcPromise(_0x5d2a4a,_0x4f9e63,_0x1e3b62,_0x18df3b){return new BPromise(function(_0x2ed212,_0x53307c){var _0x2d4978=_0x18df3b||client;return _0x2d4978[_0xda2e('0x1f')](_0x5d2a4a,_0x1e3b62)[_0xda2e('0x20')](function(_0x34c6c0){logger[_0xda2e('0x21')](_0xda2e('0x22'),_0x4f9e63,_0xda2e('0x23'));logger[_0xda2e('0x24')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4f9e63,_0xda2e('0x23'),JSON['stringify'](_0x34c6c0));if(_0x34c6c0[_0xda2e('0x25')]){if(_0x34c6c0['error'][_0xda2e('0x26')]===0x1f4){logger[_0xda2e('0x25')](_0xda2e('0x22'),_0x4f9e63,_0x34c6c0[_0xda2e('0x25')]['message']);return _0x53307c(_0x34c6c0[_0xda2e('0x25')][_0xda2e('0x27')]);}logger[_0xda2e('0x25')](_0xda2e('0x22'),_0x4f9e63,_0x34c6c0[_0xda2e('0x25')][_0xda2e('0x27')]);return _0x2ed212(_0x34c6c0[_0xda2e('0x25')][_0xda2e('0x27')]);}else{logger['info'](_0xda2e('0x22'),_0x4f9e63,_0xda2e('0x23'));_0x2ed212(_0x34c6c0['result']['message']);}})[_0xda2e('0x28')](function(_0x3deeb3){logger[_0xda2e('0x25')](_0xda2e('0x22'),_0x4f9e63,_0x3deeb3);_0x53307c(_0x3deeb3);});});}function respondWithStatusCode(_0x2f7698,_0x5e37dd){_0x5e37dd=_0x5e37dd||0xcc;return function(_0x100365){if(_0x100365){return _0x2f7698[_0xda2e('0x29')](_0x5e37dd);}return _0x2f7698[_0xda2e('0x2a')](_0x5e37dd)[_0xda2e('0x2b')]();};}function respondWithResult(_0x1df224,_0x2c365d){_0x2c365d=_0x2c365d||0xc8;return function(_0x48a6d8){if(_0x48a6d8){return _0x1df224[_0xda2e('0x2a')](_0x2c365d)[_0xda2e('0x2c')](_0x48a6d8);}};}function respondWithFilteredResult(_0x2e4cbf,_0x3f009c){return function(_0x332ce8){if(_0x332ce8){var _0x35d7a1=_0x332ce8[_0xda2e('0x2d')],_0x5c9a31=_0x3f009c[_0xda2e('0x2e')],_0x7ab080=_0x3f009c[_0xda2e('0x2e')]+_0x3f009c[_0xda2e('0x2f')],_0x3cd9e0;if(_0x7ab080>=_0x35d7a1){_0x7ab080=_0x35d7a1;_0x3cd9e0=0xc8;}else{_0x3cd9e0=0xce;}_0x2e4cbf[_0xda2e('0x2a')](_0x3cd9e0);return _0x2e4cbf[_0xda2e('0x30')](_0xda2e('0x31'),_0x5c9a31+'-'+_0x7ab080+'/'+_0x35d7a1)['json'](_0x332ce8);}return null;};}function patchUpdates(_0x4703fa){return function(_0x3b4c77){try{jsonpatch[_0xda2e('0x32')](_0x3b4c77,_0x4703fa,!![]);}catch(_0x41923e){return BPromise[_0xda2e('0x33')](_0x41923e);}return _0x3b4c77['save']();};}function saveUpdates(_0x22d75d,_0x6da964){return function(_0x3d9e95){if(_0x3d9e95){return _0x3d9e95['update'](_0x22d75d)['then'](function(_0x2305d6){return _0x2305d6;});}return null;};}function removeEntity(_0x321114,_0x1d34ee){return function(_0xe15c4a){if(_0xe15c4a){return _0xe15c4a[_0xda2e('0x34')]()['then'](function(){_0x321114[_0xda2e('0x2a')](0xcc)[_0xda2e('0x2b')]();});}};}function handleEntityNotFound(_0x2246c8,_0x4b3982){return function(_0x4829f6){if(!_0x4829f6){_0x2246c8[_0xda2e('0x29')](0x194);}return _0x4829f6;};}function handleError(_0x1c6ab4,_0x47044e){_0x47044e=_0x47044e||0x1f4;return function(_0x551829){logger[_0xda2e('0x25')](_0x551829[_0xda2e('0x35')]);if(_0x551829[_0xda2e('0x36')]){delete _0x551829[_0xda2e('0x36')];}_0x1c6ab4['status'](_0x47044e)[_0xda2e('0x37')](_0x551829);};}exports[_0xda2e('0x38')]=function(_0x359e8d,_0x11ff53){var _0x2cbc9b={},_0x294dca={},_0x88f379={'count':0x0,'rows':[]};var _0x2b1154=_[_0xda2e('0x39')](db[_0xda2e('0x3a')]['rawAttributes'],function(_0x13ee0e){return{'name':_0x13ee0e[_0xda2e('0x3b')],'type':_0x13ee0e['type'][_0xda2e('0x3c')]};});_0x294dca['model']=_[_0xda2e('0x39')](_0x2b1154,_0xda2e('0x36'));_0x294dca['query']=_['keys'](_0x359e8d[_0xda2e('0x3d')]);_0x294dca[_0xda2e('0x3e')]=_['intersection'](_0x294dca[_0xda2e('0x3f')],_0x294dca['query']);_0x2cbc9b['attributes']=_[_0xda2e('0x40')](_0x294dca[_0xda2e('0x3f')],qs[_0xda2e('0x41')](_0x359e8d[_0xda2e('0x3d')][_0xda2e('0x41')]));_0x2cbc9b['attributes']=_0x2cbc9b[_0xda2e('0x42')][_0xda2e('0x43')]?_0x2cbc9b[_0xda2e('0x42')]:_0x294dca[_0xda2e('0x3f')];if(!_0x359e8d['query'][_0xda2e('0x44')]('nolimit')){_0x2cbc9b[_0xda2e('0x2f')]=qs['limit'](_0x359e8d[_0xda2e('0x3d')][_0xda2e('0x2f')]);_0x2cbc9b[_0xda2e('0x2e')]=qs[_0xda2e('0x2e')](_0x359e8d['query'][_0xda2e('0x2e')]);}_0x2cbc9b[_0xda2e('0x45')]=qs['sort'](_0x359e8d[_0xda2e('0x3d')][_0xda2e('0x46')]);_0x2cbc9b[_0xda2e('0x47')]=qs['filters'](_[_0xda2e('0x48')](_0x359e8d[_0xda2e('0x3d')],_0x294dca[_0xda2e('0x3e')]),_0x2b1154);if(_0x359e8d[_0xda2e('0x3d')][_0xda2e('0x49')]){_0x2cbc9b['where']=_[_0xda2e('0x4a')](_0x2cbc9b[_0xda2e('0x47')],{'$or':_[_0xda2e('0x39')](_0x2b1154,function(_0x22086b){if(_0x22086b[_0xda2e('0x4b')]!=='VIRTUAL'){var _0xce4acc={};_0xce4acc[_0x22086b[_0xda2e('0x36')]]={'$like':'%'+_0x359e8d['query'][_0xda2e('0x49')]+'%'};return _0xce4acc;}})});}_0x2cbc9b=_[_0xda2e('0x4a')]({},_0x2cbc9b,_0x359e8d[_0xda2e('0x4c')]);var _0x204009={'where':_0x2cbc9b[_0xda2e('0x47')]};return db[_0xda2e('0x3a')][_0xda2e('0x2d')](_0x204009)[_0xda2e('0x20')](function(_0x570f83){_0x88f379[_0xda2e('0x2d')]=_0x570f83;if(_0x359e8d[_0xda2e('0x3d')][_0xda2e('0x4d')]){_0x2cbc9b[_0xda2e('0x4e')]=[{'all':!![]}];}return db[_0xda2e('0x3a')]['findAll'](_0x2cbc9b);})[_0xda2e('0x20')](function(_0x50bbdd){_0x88f379[_0xda2e('0x4f')]=_0x50bbdd;return _0x88f379;})['then'](respondWithFilteredResult(_0x11ff53,_0x2cbc9b))[_0xda2e('0x28')](handleError(_0x11ff53,null));};exports[_0xda2e('0x50')]=function(_0x55056c,_0x198288){var _0x392579={'raw':![],'where':{'id':_0x55056c[_0xda2e('0x51')]['id']}},_0x5c8408={};_0x5c8408[_0xda2e('0x3f')]=_[_0xda2e('0x52')](db[_0xda2e('0x3a')][_0xda2e('0x53')]);_0x5c8408[_0xda2e('0x3d')]=_[_0xda2e('0x52')](_0x55056c[_0xda2e('0x3d')]);_0x5c8408[_0xda2e('0x3e')]=_[_0xda2e('0x40')](_0x5c8408[_0xda2e('0x3f')],_0x5c8408[_0xda2e('0x3d')]);_0x392579['attributes']=_[_0xda2e('0x40')](_0x5c8408[_0xda2e('0x3f')],qs[_0xda2e('0x41')](_0x55056c['query'][_0xda2e('0x41')]));_0x392579[_0xda2e('0x42')]=_0x392579[_0xda2e('0x42')][_0xda2e('0x43')]?_0x392579[_0xda2e('0x42')]:_0x5c8408[_0xda2e('0x3f')];if(_0x55056c[_0xda2e('0x3d')][_0xda2e('0x4d')]){_0x392579[_0xda2e('0x4e')]=[{'all':!![]}];}_0x392579=_['merge']({},_0x392579,_0x55056c[_0xda2e('0x4c')]);return db[_0xda2e('0x3a')][_0xda2e('0x54')](_0x392579)['then'](handleEntityNotFound(_0x198288,null))['then'](respondWithResult(_0x198288,null))[_0xda2e('0x28')](handleError(_0x198288,null));};exports[_0xda2e('0x55')]=function(_0x266915,_0x5add21){return db[_0xda2e('0x3a')][_0xda2e('0x55')](_0x266915['body'],{})[_0xda2e('0x20')](respondWithResult(_0x5add21,0xc9))[_0xda2e('0x28')](handleError(_0x5add21,null));};exports[_0xda2e('0x56')]=function(_0x48a910,_0xf1f4d5){if(_0x48a910['body']['id']){delete _0x48a910['body']['id'];}return db[_0xda2e('0x3a')][_0xda2e('0x54')]({'where':{'id':_0x48a910[_0xda2e('0x51')]['id']}})[_0xda2e('0x20')](handleEntityNotFound(_0xf1f4d5,null))['then'](saveUpdates(_0x48a910[_0xda2e('0x57')],null))[_0xda2e('0x20')](respondWithResult(_0xf1f4d5,null))[_0xda2e('0x28')](handleError(_0xf1f4d5,null));};exports[_0xda2e('0x34')]=function(_0x1da4e5,_0x83c7f8){return db[_0xda2e('0x3a')]['find']({'where':{'id':_0x1da4e5[_0xda2e('0x51')]['id']}})[_0xda2e('0x20')](handleEntityNotFound(_0x83c7f8,null))['then'](removeEntity(_0x83c7f8,null))[_0xda2e('0x28')](handleError(_0x83c7f8,null));};exports[_0xda2e('0x58')]=function(_0x2ff07d,_0x32f785,_0x51d996){var _0x3794ad={};var _0x26731f={};var _0x1a4a66;var _0x4334b2;return db[_0xda2e('0x3a')][_0xda2e('0x59')]({'where':{'id':_0x2ff07d[_0xda2e('0x51')]['id']}})[_0xda2e('0x20')](handleEntityNotFound(_0x32f785,null))[_0xda2e('0x20')](function(_0x355961){if(_0x355961){_0x1a4a66=_0x355961;_0x26731f[_0xda2e('0x3f')]=_['keys'](db['SugarcrmConfiguration'][_0xda2e('0x53')]);_0x26731f[_0xda2e('0x3d')]=_[_0xda2e('0x52')](_0x2ff07d[_0xda2e('0x3d')]);_0x26731f[_0xda2e('0x3e')]=_['intersection'](_0x26731f[_0xda2e('0x3f')],_0x26731f[_0xda2e('0x3d')]);_0x3794ad['attributes']=_[_0xda2e('0x40')](_0x26731f['model'],qs[_0xda2e('0x41')](_0x2ff07d[_0xda2e('0x3d')][_0xda2e('0x41')]));_0x3794ad[_0xda2e('0x42')]=_0x3794ad[_0xda2e('0x42')]['length']?_0x3794ad[_0xda2e('0x42')]:_0x26731f[_0xda2e('0x3f')];_0x3794ad[_0xda2e('0x45')]=qs['sort'](_0x2ff07d['query'][_0xda2e('0x46')]);_0x3794ad['where']=qs[_0xda2e('0x3e')](_['pick'](_0x2ff07d[_0xda2e('0x3d')],_0x26731f[_0xda2e('0x3e')]));if(_0x2ff07d['query'][_0xda2e('0x49')]){_0x3794ad[_0xda2e('0x47')]=_[_0xda2e('0x4a')](_0x3794ad['where'],{'$or':_['map'](_0x3794ad[_0xda2e('0x42')],function(_0x43455c){var _0x46e804={};_0x46e804[_0x43455c]={'$like':'%'+_0x2ff07d[_0xda2e('0x3d')][_0xda2e('0x49')]+'%'};return _0x46e804;})});}_0x3794ad=_[_0xda2e('0x4a')]({},_0x3794ad,_0x2ff07d[_0xda2e('0x4c')]);return _0x1a4a66[_0xda2e('0x58')](_0x3794ad);}})[_0xda2e('0x20')](function(_0x5840e3){if(_0x5840e3){_0x4334b2=_0x5840e3['length'];if(!_0x2ff07d[_0xda2e('0x3d')][_0xda2e('0x44')](_0xda2e('0x5a'))){_0x3794ad['limit']=qs['limit'](_0x2ff07d['query'][_0xda2e('0x2f')]);_0x3794ad[_0xda2e('0x2e')]=qs['offset'](_0x2ff07d[_0xda2e('0x3d')][_0xda2e('0x2e')]);}return _0x1a4a66['getConfigurations'](_0x3794ad);}})['then'](function(_0x2a14de){if(_0x2a14de){return _0x2a14de?{'count':_0x4334b2,'rows':_0x2a14de}:null;}})[_0xda2e('0x20')](respondWithResult(_0x32f785,null))[_0xda2e('0x28')](handleError(_0x32f785,null));};exports[_0xda2e('0x5b')]=function(_0x53d3ad,_0x832f97,_0x35fc1a){if(_0x53d3ad['body']['id']){delete _0x53d3ad[_0xda2e('0x57')]['id'];}return db[_0xda2e('0x3a')][_0xda2e('0x59')]({'where':{'id':_0x53d3ad[_0xda2e('0x51')]['id']}})[_0xda2e('0x20')](handleEntityNotFound(_0x832f97,null))[_0xda2e('0x20')](function(_0x4a2b3c){if(_0x4a2b3c){_0x53d3ad[_0xda2e('0x57')][_0xda2e('0x5c')]=_0x4a2b3c['id'];_0x53d3ad[_0xda2e('0x57')][_0xda2e('0x5d')]=integrations[_0xda2e('0x5e')](_0x53d3ad[_0xda2e('0x57')]['channel'],_0x53d3ad['body'][_0xda2e('0x4b')]);_0x53d3ad[_0xda2e('0x57')][_0xda2e('0x5f')]=integrations[_0xda2e('0x60')](_0x53d3ad[_0xda2e('0x57')][_0xda2e('0x61')],_0x53d3ad['body']['type']);return db['SugarcrmConfiguration'][_0xda2e('0x55')](_0x53d3ad['body'],{'include':[{'model':db[_0xda2e('0x62')],'as':'Subjects'},{'model':db[_0xda2e('0x62')],'as':_0xda2e('0x5f')}]});}return null;})[_0xda2e('0x20')](respondWithResult(_0x832f97,null))['catch'](handleError(_0x832f97,null));};exports[_0xda2e('0x63')]=function(_0x1c3611,_0x51a982,_0x324ff3){var _0x17dd0c='';var _0x2d0a32=['id',_0xda2e('0x36'),'assigned_user_id','created_by',_0xda2e('0x64'),_0xda2e('0x65'),_0xda2e('0x66'),_0xda2e('0x67'),'parent_id',_0xda2e('0x68'),_0xda2e('0x69'),_0xda2e('0x6a')];return db[_0xda2e('0x3a')]['findOne']({'where':{'id':_0x1c3611[_0xda2e('0x51')]['id']},'attributes':['id',_0xda2e('0x6b'),'password',_0xda2e('0x6c')]})['then'](handleEntityNotFound(_0x51a982,null))[_0xda2e('0x20')](function(_0x30ebab){if(_0x30ebab){_0x17dd0c=_0x30ebab['remoteUri'];var _0x41d8b3=_0x17dd0c[_0xda2e('0x6d')](-0x1);if(_0x41d8b3==='/'){_0x17dd0c=_0x17dd0c[_0xda2e('0x6e')](0x0,_0x17dd0c[_0xda2e('0x6f')](_0x41d8b3));}return rp({'method':_0xda2e('0x70'),'uri':util[_0xda2e('0x71')](_0xda2e('0x72'),_0x17dd0c,_0xda2e('0x73')),'json':!![],'form':{'method':_0xda2e('0x74'),'input_type':_0xda2e('0x75'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x30ebab[_0xda2e('0x6b')],'password':_0x30ebab[_0xda2e('0x76')],'encryption':_0xda2e('0x77')},'application':_0xda2e('0x78')})}});}})[_0xda2e('0x20')](function(_0x283858){if(_0x283858&&_0x283858[_0xda2e('0x36')]!=='Invalid\x20Login'&&_0x283858[_0xda2e('0x36')]!==_0xda2e('0x79')){return rp({'method':'POST','uri':util[_0xda2e('0x71')](_0xda2e('0x72'),_0x17dd0c,_0xda2e('0x73')),'json':!![],'form':{'method':_0xda2e('0x7a'),'input_type':'JSON','response_type':_0xda2e('0x75'),'rest_data':JSON['stringify']({'session':_0x283858['id'],'module_name':_0xda2e('0x7b')})}})['then'](function(_0x58ba12){if(_0x58ba12){var _0x46f953=_[_0xda2e('0x7c')](_0x58ba12[_0xda2e('0x7d')]);_['remove'](_0x46f953,function(_0x2c365f){return _0x2d0a32['includes'](_0x2c365f['name']);});return{'count':_0x46f953[_0xda2e('0x43')],'rows':_['map'](_0x46f953,function(_0xcdf1c3){return{'id':_0xcdf1c3[_0xda2e('0x36')],'name':_0xcdf1c3[_0xda2e('0x7e')],'custom':_[_0xda2e('0x7f')](_0xcdf1c3[_0xda2e('0x36')],'_c')?!![]:![],'options':_0xcdf1c3[_0xda2e('0x4c')]?_[_0xda2e('0x39')](_[_0xda2e('0x7c')](_0xcdf1c3['options']),function(_0x3db8f1){return{'name':_0x3db8f1[_0xda2e('0x80')],'value':_0x3db8f1[_0xda2e('0x36')]};}):[]};})};}})[_0xda2e('0x20')](respondWithResult(_0x51a982,null))[_0xda2e('0x28')](function(_0x4310c5){var _0x125cfb=_0x1c3611[_0xda2e('0x3d')][_0xda2e('0x1b')]?0x1f4:_0x4310c5[_0xda2e('0x81')]||0x1f4;logger['error'](_0xda2e('0x82'),_0xda2e('0x63'),_0x125cfb,JSON[_0xda2e('0x83')](_0x4310c5));delete _0x4310c5[_0xda2e('0x36')];if(_0x125cfb===0x191){_0x125cfb=0x190;}_0x51a982['status'](_0x125cfb)[_0xda2e('0x37')](_0x1c3611[_0xda2e('0x3d')][_0xda2e('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x4310c5[_0xda2e('0x81')]}:_0x4310c5);});}else{var _0x52b4e0=0x1f4;_0x51a982['status'](_0x52b4e0)[_0xda2e('0x37')]({'message':_0xda2e('0x84'),'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 45d0f6a..877a4d4 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 _0x4a27=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4a27,0x1a9));var _0x74a2=function(_0x44357a,_0x5732e7){_0x44357a=_0x44357a-0x0;var _0x2bd627=_0x4a27[_0x44357a];return _0x2bd627;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x74a2('0x0'))(_0x74a2('0x1'));var moment=require(_0x74a2('0x2'));var BPromise=require(_0x74a2('0x3'));var rp=require(_0x74a2('0x4'));var fs=require('fs');var path=require(_0x74a2('0x5'));var rimraf=require(_0x74a2('0x6'));var config=require(_0x74a2('0x7'));var attributes=require(_0x74a2('0x8'));var integrations=require(_0x74a2('0x9'));module[_0x74a2('0xa')]=function(_0x296bc2,_0x478509){return _0x296bc2[_0x74a2('0xb')](_0x74a2('0xc'),attributes,{'tableName':_0x74a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7007=['../../components/integrations/configuration','exports','define','SugarcrmAccount','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes'];(function(_0xcc8db4,_0x3c3b49){var _0x3598eb=function(_0x2502c5){while(--_0x2502c5){_0xcc8db4['push'](_0xcc8db4['shift']());}};_0x3598eb(++_0x3c3b49);}(_0x7007,0x1a8));var _0x7700=function(_0x1fe711,_0x40e7fa){_0x1fe711=_0x1fe711-0x0;var _0x4a3087=_0x7007[_0x1fe711];return _0x4a3087;};'use strict';var _=require('lodash');var util=require(_0x7700('0x0'));var logger=require(_0x7700('0x1'))(_0x7700('0x2'));var moment=require('moment');var BPromise=require(_0x7700('0x3'));var rp=require(_0x7700('0x4'));var fs=require('fs');var path=require(_0x7700('0x5'));var rimraf=require(_0x7700('0x6'));var config=require('../../config/environment');var attributes=require(_0x7700('0x7'));var integrations=require(_0x7700('0x8'));module[_0x7700('0x9')]=function(_0xb58c5a,_0x5d6233){return _0xb58c5a[_0x7700('0xa')](_0x7700('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 13a9f27..8300962 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 _0x720f=['error','code','message','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','limit','map','include','model','attributes','ShowSugarcrmAccount','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1098a9,_0x2748f9){var _0x166c83=function(_0x55a645){while(--_0x55a645){_0x1098a9['push'](_0x1098a9['shift']());}};_0x166c83(++_0x2748f9);}(_0x720f,0x142));var _0xf720=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x720f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf720('0x0'));var util=require(_0xf720('0x1'));var moment=require(_0xf720('0x2'));var BPromise=require(_0xf720('0x3'));var rs=require(_0xf720('0x4'));var fs=require('fs');var Redis=require(_0xf720('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf720('0x6'));var logger=require(_0xf720('0x7'))(_0xf720('0x8'));var config=require(_0xf720('0x9'));var jayson=require(_0xf720('0xa'));var client=jayson['client'][_0xf720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427e8f,_0x1055a9,_0x1be13d){return new BPromise(function(_0x95cc5d,_0xad50af){return client[_0xf720('0xc')](_0x427e8f,_0x1be13d)[_0xf720('0xd')](function(_0x19db0a){logger[_0xf720('0xe')](_0xf720('0xf'),_0x1055a9,_0xf720('0x10'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1055a9,_0xf720('0x10'),JSON[_0xf720('0x11')](_0x19db0a));if(_0x19db0a[_0xf720('0x12')]){if(_0x19db0a[_0xf720('0x12')][_0xf720('0x13')]===0x1f4){logger['error'](_0xf720('0xf'),_0x1055a9,_0x19db0a[_0xf720('0x12')]['message']);return _0xad50af(_0x19db0a[_0xf720('0x12')]['message']);}logger[_0xf720('0x12')](_0xf720('0xf'),_0x1055a9,_0x19db0a[_0xf720('0x12')][_0xf720('0x14')]);return _0x95cc5d(_0x19db0a[_0xf720('0x12')]['message']);}else{logger[_0xf720('0xe')](_0xf720('0xf'),_0x1055a9,'request\x20sent');_0x95cc5d(_0x19db0a['result'][_0xf720('0x14')]);}})['catch'](function(_0x10eb65){logger[_0xf720('0x12')](_0xf720('0xf'),_0x1055a9,_0x10eb65);_0xad50af(_0x10eb65);});});}exports[_0xf720('0x15')]=function(_0x46a7d6){var _0x2de4a4=this;return new Promise(function(_0x2449c,_0x1b667c){return db[_0xf720('0x16')][_0xf720('0x17')]({'raw':_0x46a7d6[_0xf720('0x18')]?_0x46a7d6['options'][_0xf720('0x19')]===undefined?!![]:![]:!![],'where':_0x46a7d6[_0xf720('0x18')]?_0x46a7d6[_0xf720('0x18')]['where']||null:null,'attributes':_0x46a7d6[_0xf720('0x18')]?_0x46a7d6['options']['attributes']||null:null,'limit':_0x46a7d6['options']?_0x46a7d6[_0xf720('0x18')][_0xf720('0x1a')]||null:null,'include':_0x46a7d6[_0xf720('0x18')]?_0x46a7d6[_0xf720('0x18')]['include']?_[_0xf720('0x1b')](_0x46a7d6[_0xf720('0x18')][_0xf720('0x1c')],function(_0x51c31a){return{'model':db[_0x51c31a[_0xf720('0x1d')]],'as':_0x51c31a['as'],'attributes':_0x51c31a['attributes'],'include':_0x51c31a[_0xf720('0x1c')]?_[_0xf720('0x1b')](_0x51c31a[_0xf720('0x1c')],function(_0x3d9c10){return{'model':db[_0x3d9c10['model']],'as':_0x3d9c10['as'],'attributes':_0x3d9c10[_0xf720('0x1e')],'include':_0x3d9c10[_0xf720('0x1c')]?_['map'](_0x3d9c10[_0xf720('0x1c')],function(_0x3d9104){return{'model':db[_0x3d9104[_0xf720('0x1d')]],'as':_0x3d9104['as'],'attributes':_0x3d9104[_0xf720('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf720('0xd')](function(_0x5620e8){logger[_0xf720('0xe')](_0xf720('0x15'),_0x46a7d6);logger['debug'](_0xf720('0x15'),_0x46a7d6,JSON['stringify'](_0x5620e8));_0x2449c(_0x5620e8);})['catch'](function(_0x2b920c){logger[_0xf720('0x12')](_0xf720('0x15'),_0x2b920c[_0xf720('0x14')],_0x46a7d6);_0x1b667c(_0x2de4a4[_0xf720('0x12')](0x1f4,_0x2b920c['message']));});});};exports[_0xf720('0x1f')]=function(_0xb92062){var _0x147d8b=this;return new Promise(function(_0x4e1128,_0x25de11){return db['SugarcrmAccount']['find']({'raw':_0xb92062['options']?_0xb92062[_0xf720('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xb92062[_0xf720('0x18')]?_0xb92062[_0xf720('0x18')]['where']||null:null,'attributes':_0xb92062[_0xf720('0x18')]?_0xb92062['options'][_0xf720('0x1e')]||null:null,'include':_0xb92062[_0xf720('0x18')]?_0xb92062[_0xf720('0x18')]['include']?_[_0xf720('0x1b')](_0xb92062[_0xf720('0x18')][_0xf720('0x1c')],function(_0x3d0691){return{'model':db[_0x3d0691[_0xf720('0x1d')]],'as':_0x3d0691['as'],'attributes':_0x3d0691['attributes'],'include':_0x3d0691['include']?_[_0xf720('0x1b')](_0x3d0691[_0xf720('0x1c')],function(_0x12a4b4){return{'model':db[_0x12a4b4[_0xf720('0x1d')]],'as':_0x12a4b4['as'],'attributes':_0x12a4b4[_0xf720('0x1e')],'include':_0x12a4b4[_0xf720('0x1c')]?_['map'](_0x12a4b4[_0xf720('0x1c')],function(_0x5a4bb3){return{'model':db[_0x5a4bb3[_0xf720('0x1d')]],'as':_0x5a4bb3['as'],'attributes':_0x5a4bb3[_0xf720('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf720('0xd')](function(_0x4dcbc2){logger['info']('ShowSugarcrmAccount',_0xb92062);logger[_0xf720('0x20')](_0xf720('0x1f'),_0xb92062,JSON[_0xf720('0x11')](_0x4dcbc2));_0x4e1128(_0x4dcbc2);})[_0xf720('0x21')](function(_0x5e3223){logger[_0xf720('0x12')](_0xf720('0x1f'),_0x5e3223['message'],_0xb92062);_0x25de11(_0x147d8b[_0xf720('0x12')](0x1f4,_0x5e3223[_0xf720('0x14')]));});});}; \ No newline at end of file +var _0xc14d=['../../config/environment','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2aff5c,_0x36f637){var _0x242984=function(_0x24f324){while(--_0x24f324){_0x2aff5c['push'](_0x2aff5c['shift']());}};_0x242984(++_0x36f637);}(_0xc14d,0xd0));var _0xdc14=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc14d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdc14('0x0'));var util=require(_0xdc14('0x1'));var moment=require('moment');var BPromise=require(_0xdc14('0x2'));var rs=require(_0xdc14('0x3'));var fs=require('fs');var Redis=require(_0xdc14('0x4'));var db=require(_0xdc14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc14('0x6'))(_0xdc14('0x7'));var config=require(_0xdc14('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26d225,_0xa0bec9,_0x58e372){return new BPromise(function(_0x169eaa,_0x206f7d){return client[_0xdc14('0xa')](_0x26d225,_0x58e372)[_0xdc14('0xb')](function(_0x17e100){logger[_0xdc14('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0xa0bec9,_0xdc14('0xd'));logger[_0xdc14('0xe')](_0xdc14('0xf'),_0xa0bec9,_0xdc14('0xd'),JSON[_0xdc14('0x10')](_0x17e100));if(_0x17e100[_0xdc14('0x11')]){if(_0x17e100[_0xdc14('0x11')][_0xdc14('0x12')]===0x1f4){logger[_0xdc14('0x11')](_0xdc14('0x13'),_0xa0bec9,_0x17e100['error'][_0xdc14('0x14')]);return _0x206f7d(_0x17e100['error']['message']);}logger[_0xdc14('0x11')](_0xdc14('0x13'),_0xa0bec9,_0x17e100[_0xdc14('0x11')][_0xdc14('0x14')]);return _0x169eaa(_0x17e100['error'][_0xdc14('0x14')]);}else{logger['info'](_0xdc14('0x13'),_0xa0bec9,_0xdc14('0xd'));_0x169eaa(_0x17e100[_0xdc14('0x15')]['message']);}})[_0xdc14('0x16')](function(_0x24c28a){logger[_0xdc14('0x11')](_0xdc14('0x13'),_0xa0bec9,_0x24c28a);_0x206f7d(_0x24c28a);});});}exports['GetSugarcrmAccount']=function(_0x18ea01){var _0x5dfc6f=this;return new Promise(function(_0x114bae,_0x568880){return db[_0xdc14('0x17')][_0xdc14('0x18')]({'raw':_0x18ea01[_0xdc14('0x19')]?_0x18ea01[_0xdc14('0x19')][_0xdc14('0x1a')]===undefined?!![]:![]:!![],'where':_0x18ea01[_0xdc14('0x19')]?_0x18ea01[_0xdc14('0x19')][_0xdc14('0x1b')]||null:null,'attributes':_0x18ea01[_0xdc14('0x19')]?_0x18ea01[_0xdc14('0x19')][_0xdc14('0x1c')]||null:null,'limit':_0x18ea01[_0xdc14('0x19')]?_0x18ea01['options'][_0xdc14('0x1d')]||null:null,'include':_0x18ea01['options']?_0x18ea01['options'][_0xdc14('0x1e')]?_['map'](_0x18ea01[_0xdc14('0x19')][_0xdc14('0x1e')],function(_0x35da50){return{'model':db[_0x35da50[_0xdc14('0x1f')]],'as':_0x35da50['as'],'attributes':_0x35da50[_0xdc14('0x1c')],'include':_0x35da50[_0xdc14('0x1e')]?_[_0xdc14('0x20')](_0x35da50[_0xdc14('0x1e')],function(_0xff7662){return{'model':db[_0xff7662[_0xdc14('0x1f')]],'as':_0xff7662['as'],'attributes':_0xff7662[_0xdc14('0x1c')],'include':_0xff7662[_0xdc14('0x1e')]?_[_0xdc14('0x20')](_0xff7662['include'],function(_0x4e393c){return{'model':db[_0x4e393c[_0xdc14('0x1f')]],'as':_0x4e393c['as'],'attributes':_0x4e393c[_0xdc14('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdc14('0xb')](function(_0x20b128){logger[_0xdc14('0xc')](_0xdc14('0x21'),_0x18ea01);logger[_0xdc14('0xe')](_0xdc14('0x21'),_0x18ea01,JSON[_0xdc14('0x10')](_0x20b128));_0x114bae(_0x20b128);})[_0xdc14('0x16')](function(_0x45eeab){logger[_0xdc14('0x11')](_0xdc14('0x21'),_0x45eeab['message'],_0x18ea01);_0x568880(_0x5dfc6f['error'](0x1f4,_0x45eeab[_0xdc14('0x14')]));});});};exports[_0xdc14('0x22')]=function(_0x1998b4){var _0x255a80=this;return new Promise(function(_0x21ab21,_0x334e66){return db['SugarcrmAccount'][_0xdc14('0x23')]({'raw':_0x1998b4[_0xdc14('0x19')]?_0x1998b4[_0xdc14('0x19')][_0xdc14('0x1a')]===undefined?!![]:![]:!![],'where':_0x1998b4[_0xdc14('0x19')]?_0x1998b4[_0xdc14('0x19')][_0xdc14('0x1b')]||null:null,'attributes':_0x1998b4[_0xdc14('0x19')]?_0x1998b4['options'][_0xdc14('0x1c')]||null:null,'include':_0x1998b4[_0xdc14('0x19')]?_0x1998b4[_0xdc14('0x19')][_0xdc14('0x1e')]?_[_0xdc14('0x20')](_0x1998b4[_0xdc14('0x19')][_0xdc14('0x1e')],function(_0x43b28d){return{'model':db[_0x43b28d[_0xdc14('0x1f')]],'as':_0x43b28d['as'],'attributes':_0x43b28d[_0xdc14('0x1c')],'include':_0x43b28d['include']?_[_0xdc14('0x20')](_0x43b28d['include'],function(_0x39501b){return{'model':db[_0x39501b['model']],'as':_0x39501b['as'],'attributes':_0x39501b[_0xdc14('0x1c')],'include':_0x39501b[_0xdc14('0x1e')]?_['map'](_0x39501b['include'],function(_0x14529d){return{'model':db[_0x14529d['model']],'as':_0x14529d['as'],'attributes':_0x14529d[_0xdc14('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x496b35){logger[_0xdc14('0xc')](_0xdc14('0x22'),_0x1998b4);logger[_0xdc14('0xe')](_0xdc14('0x22'),_0x1998b4,JSON[_0xdc14('0x10')](_0x496b35));_0x21ab21(_0x496b35);})[_0xdc14('0x16')](function(_0x57b595){logger[_0xdc14('0x11')](_0xdc14('0x22'),_0x57b595[_0xdc14('0x14')],_0x1998b4);_0x334e66(_0x255a80[_0xdc14('0x11')](0x1f4,_0x57b595[_0xdc14('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c9e169b..3c0b5d4 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 _0xfc99=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','multer','util','connect-timeout'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfc99,0x1a1));var _0x9fc9=function(_0x470818,_0x321b0a){_0x470818=_0x470818-0x0;var _0xfcb8d5=_0xfc99[_0x470818];return _0xfcb8d5;};'use strict';var multer=require(_0x9fc9('0x0'));var util=require(_0x9fc9('0x1'));var path=require('path');var timeout=require(_0x9fc9('0x2'));var express=require(_0x9fc9('0x3'));var router=express[_0x9fc9('0x4')]();var auth=require(_0x9fc9('0x5'));var interaction=require(_0x9fc9('0x6'));var config=require(_0x9fc9('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x9fc9('0x8')]('/',auth[_0x9fc9('0x9')](),controller[_0x9fc9('0xa')]);router['get']('/:id',auth[_0x9fc9('0x9')](),controller['show']);router[_0x9fc9('0x8')](_0x9fc9('0xb'),auth['isAuthenticated'](),controller[_0x9fc9('0xc')]);router[_0x9fc9('0x8')](_0x9fc9('0xd'),auth[_0x9fc9('0x9')](),controller['getSubjects']);router[_0x9fc9('0x8')](_0x9fc9('0xe'),auth['isAuthenticated'](),controller[_0x9fc9('0xf')]);router[_0x9fc9('0x10')]('/',auth[_0x9fc9('0x9')](),controller[_0x9fc9('0x11')]);router['put'](_0x9fc9('0x12'),auth[_0x9fc9('0x9')](),controller[_0x9fc9('0x13')]);router[_0x9fc9('0x14')](_0x9fc9('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfa31=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','/:id','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x65f140,_0x45cbc7){var _0x18fbda=function(_0x26fb39){while(--_0x26fb39){_0x65f140['push'](_0x65f140['shift']());}};_0x18fbda(++_0x45cbc7);}(_0xfa31,0x1db));var _0x1fa3=function(_0x52dc13,_0x5813c2){_0x52dc13=_0x52dc13-0x0;var _0x1143e7=_0xfa31[_0x52dc13];return _0x1143e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1fa3('0x0'));var timeout=require(_0x1fa3('0x1'));var express=require(_0x1fa3('0x2'));var router=express[_0x1fa3('0x3')]();var auth=require(_0x1fa3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fa3('0x5'));var controller=require(_0x1fa3('0x6'));router[_0x1fa3('0x7')]('/',auth[_0x1fa3('0x8')](),controller[_0x1fa3('0x9')]);router['get']('/:id',auth[_0x1fa3('0x8')](),controller[_0x1fa3('0xa')]);router[_0x1fa3('0x7')]('/:id/fields',auth[_0x1fa3('0x8')](),controller[_0x1fa3('0xb')]);router['get'](_0x1fa3('0xc'),auth['isAuthenticated'](),controller[_0x1fa3('0xd')]);router[_0x1fa3('0x7')](_0x1fa3('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x1fa3('0x8')](),controller[_0x1fa3('0xf')]);router[_0x1fa3('0x10')](_0x1fa3('0x11'),auth[_0x1fa3('0x8')](),controller['update']);router['delete'](_0x1fa3('0x11'),auth[_0x1fa3('0x8')](),controller[_0x1fa3('0x12')]);module[_0x1fa3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c758899..d7f467b 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 _0x5bfe=['exports','STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5bfe,0xc2));var _0xe5bf=function(_0x394169,_0x10ee58){_0x394169=_0x394169-0x0;var _0x107253=_0x5bfe[_0x394169];return _0x107253;};'use strict';var Sequelize=require(_0xe5bf('0x0'));module[_0xe5bf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5bf('0x2')]}}; \ No newline at end of file +var _0xf890=['sequelize','exports','STRING'];(function(_0x1969a2,_0x11a5f3){var _0x13325e=function(_0x4498c5){while(--_0x4498c5){_0x1969a2['push'](_0x1969a2['shift']());}};_0x13325e(++_0x11a5f3);}(_0xf890,0x1b0));var _0x0f89=function(_0x258c8f,_0x3c7632){_0x258c8f=_0x258c8f-0x0;var _0x508682=_0xf890[_0x258c8f];return _0x508682;};'use strict';var Sequelize=require(_0x0f89('0x0'));module[_0x0f89('0x1')]={'name':{'type':Sequelize[_0x0f89('0x2')]},'description':{'type':Sequelize[_0x0f89('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 20aed8b..f3ed419 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 _0x0d35=['apply','reject','save','update','then','destroy','name','send','index','map','SugarcrmConfiguration','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','count','findAll','params','includeAll','include','find','create','body','getFields','findOne','SugarcrmField','rawAttributes','getSubjects','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','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','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','Content-Range'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0d35,0x1a9));var _0x50d3=function(_0x113a1b,_0x2f3ae6){_0x113a1b=_0x113a1b-0x0;var _0x26f0b4=_0x0d35[_0x113a1b];return _0x26f0b4;};'use strict';var pdf=require(_0x50d3('0x0'));var emlformat=require(_0x50d3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x50d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x50d3('0x3'));var BPromise=require(_0x50d3('0x4'));var Mustache=require('mustache');var util=require(_0x50d3('0x5'));var path=require(_0x50d3('0x6'));var sox=require(_0x50d3('0x7'));var csv=require(_0x50d3('0x8'));var ejs=require(_0x50d3('0x9'));var fs=require('fs');var _=require(_0x50d3('0xa'));var squel=require(_0x50d3('0xb'));var crypto=require(_0x50d3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x50d3('0xd'));var toCsv=require(_0x50d3('0x8'));var querystring=require(_0x50d3('0xe'));var Papa=require(_0x50d3('0xf'));var Redis=require(_0x50d3('0x10'));var authService=require(_0x50d3('0x11'));var qs=require(_0x50d3('0x12'));var as=require(_0x50d3('0x13'));var hardwareService=require(_0x50d3('0x14'));var logger=require(_0x50d3('0x15'))(_0x50d3('0x16'));var utils=require(_0x50d3('0x17'));var config=require(_0x50d3('0x18'));var db=require(_0x50d3('0x19'))['db'];var jayson=require(_0x50d3('0x1a'));var client=jayson[_0x50d3('0x1b')][_0x50d3('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x59d42e,_0xc66267,_0x2e38f6){if(_0x2e38f6){var _0x581e58=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x581e58[_0x50d3('0x1d')](_0xc66267)){return _0x59d42e;}else{throw new db[(_0x50d3('0x1e'))][(_0x50d3('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x59d42e;}}function respondWithRpcPromise(_0x1a2ace,_0x2c5272,_0x3c961e,_0xe3a19){return new BPromise(function(_0x3dc937,_0x12606){var _0x101281=_0xe3a19||client;return _0x101281[_0x50d3('0x20')](_0x1a2ace,_0x3c961e)['then'](function(_0x51127d){logger[_0x50d3('0x21')](_0x50d3('0x22'),_0x2c5272,_0x50d3('0x23'));logger[_0x50d3('0x24')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2c5272,'request\x20sent',JSON[_0x50d3('0x25')](_0x51127d));if(_0x51127d[_0x50d3('0x26')]){if(_0x51127d['error'][_0x50d3('0x27')]===0x1f4){logger[_0x50d3('0x26')](_0x50d3('0x22'),_0x2c5272,_0x51127d[_0x50d3('0x26')][_0x50d3('0x28')]);return _0x12606(_0x51127d['error'][_0x50d3('0x28')]);}logger[_0x50d3('0x26')](_0x50d3('0x22'),_0x2c5272,_0x51127d[_0x50d3('0x26')][_0x50d3('0x28')]);return _0x3dc937(_0x51127d[_0x50d3('0x26')][_0x50d3('0x28')]);}else{logger[_0x50d3('0x21')](_0x50d3('0x22'),_0x2c5272,_0x50d3('0x23'));_0x3dc937(_0x51127d[_0x50d3('0x29')][_0x50d3('0x28')]);}})[_0x50d3('0x2a')](function(_0x4a24cd){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c5272,_0x4a24cd);_0x12606(_0x4a24cd);});});}function respondWithStatusCode(_0x546ee7,_0x34ba10){_0x34ba10=_0x34ba10||0xcc;return function(_0x280196){if(_0x280196){return _0x546ee7[_0x50d3('0x2b')](_0x34ba10);}return _0x546ee7['status'](_0x34ba10)[_0x50d3('0x2c')]();};}function respondWithResult(_0x2cec44,_0x1a2351){_0x1a2351=_0x1a2351||0xc8;return function(_0x4aa6f7){if(_0x4aa6f7){return _0x2cec44[_0x50d3('0x2d')](_0x1a2351)[_0x50d3('0x2e')](_0x4aa6f7);}};}function respondWithFilteredResult(_0x1b0491,_0x5dd11a){return function(_0x417cca){if(_0x417cca){var _0x18648d=_0x417cca['count'],_0x1e063f=_0x5dd11a[_0x50d3('0x2f')],_0x164c29=_0x5dd11a[_0x50d3('0x2f')]+_0x5dd11a[_0x50d3('0x30')],_0x32c898;if(_0x164c29>=_0x18648d){_0x164c29=_0x18648d;_0x32c898=0xc8;}else{_0x32c898=0xce;}_0x1b0491[_0x50d3('0x2d')](_0x32c898);return _0x1b0491['set'](_0x50d3('0x31'),_0x1e063f+'-'+_0x164c29+'/'+_0x18648d)[_0x50d3('0x2e')](_0x417cca);}return null;};}function patchUpdates(_0x5690d0){return function(_0x176406){try{jsonpatch[_0x50d3('0x32')](_0x176406,_0x5690d0,!![]);}catch(_0x808725){return BPromise[_0x50d3('0x33')](_0x808725);}return _0x176406[_0x50d3('0x34')]();};}function saveUpdates(_0x739794,_0x154385){return function(_0x103ca1){if(_0x103ca1){return _0x103ca1[_0x50d3('0x35')](_0x739794)[_0x50d3('0x36')](function(_0x16a1d4){return _0x16a1d4;});}return null;};}function removeEntity(_0x2f8176,_0x2a4a52){return function(_0x32fe10){if(_0x32fe10){return _0x32fe10[_0x50d3('0x37')]()[_0x50d3('0x36')](function(){_0x2f8176[_0x50d3('0x2d')](0xcc)[_0x50d3('0x2c')]();});}};}function handleEntityNotFound(_0x484420,_0x34d404){return function(_0x24a36e){if(!_0x24a36e){_0x484420['sendStatus'](0x194);}return _0x24a36e;};}function handleError(_0x34143a,_0x3e751a){_0x3e751a=_0x3e751a||0x1f4;return function(_0x6a2818){logger['error'](_0x6a2818['stack']);if(_0x6a2818[_0x50d3('0x38')]){delete _0x6a2818[_0x50d3('0x38')];}_0x34143a[_0x50d3('0x2d')](_0x3e751a)[_0x50d3('0x39')](_0x6a2818);};}exports[_0x50d3('0x3a')]=function(_0xbc3468,_0x148821){var _0x350aaa={},_0x1b91c9={},_0x438051={'count':0x0,'rows':[]};var _0xf79767=_[_0x50d3('0x3b')](db[_0x50d3('0x3c')]['rawAttributes'],function(_0x40a310){return{'name':_0x40a310[_0x50d3('0x3d')],'type':_0x40a310['type'][_0x50d3('0x3e')]};});_0x1b91c9[_0x50d3('0x3f')]=_[_0x50d3('0x3b')](_0xf79767,_0x50d3('0x38'));_0x1b91c9[_0x50d3('0x40')]=_[_0x50d3('0x41')](_0xbc3468['query']);_0x1b91c9['filters']=_[_0x50d3('0x42')](_0x1b91c9[_0x50d3('0x3f')],_0x1b91c9['query']);_0x350aaa[_0x50d3('0x43')]=_[_0x50d3('0x42')](_0x1b91c9[_0x50d3('0x3f')],qs[_0x50d3('0x44')](_0xbc3468[_0x50d3('0x40')][_0x50d3('0x44')]));_0x350aaa[_0x50d3('0x43')]=_0x350aaa[_0x50d3('0x43')][_0x50d3('0x45')]?_0x350aaa[_0x50d3('0x43')]:_0x1b91c9[_0x50d3('0x3f')];if(!_0xbc3468[_0x50d3('0x40')][_0x50d3('0x46')](_0x50d3('0x47'))){_0x350aaa['limit']=qs[_0x50d3('0x30')](_0xbc3468['query'][_0x50d3('0x30')]);_0x350aaa[_0x50d3('0x2f')]=qs[_0x50d3('0x2f')](_0xbc3468['query'][_0x50d3('0x2f')]);}_0x350aaa[_0x50d3('0x48')]=qs[_0x50d3('0x49')](_0xbc3468[_0x50d3('0x40')][_0x50d3('0x49')]);_0x350aaa[_0x50d3('0x4a')]=qs['filters'](_[_0x50d3('0x4b')](_0xbc3468[_0x50d3('0x40')],_0x1b91c9[_0x50d3('0x4c')]),_0xf79767);if(_0xbc3468[_0x50d3('0x40')][_0x50d3('0x4d')]){_0x350aaa['where']=_[_0x50d3('0x4e')](_0x350aaa[_0x50d3('0x4a')],{'$or':_[_0x50d3('0x3b')](_0xf79767,function(_0xc8a54f){if(_0xc8a54f[_0x50d3('0x4f')]!==_0x50d3('0x50')){var _0x350ed4={};_0x350ed4[_0xc8a54f[_0x50d3('0x38')]]={'$like':'%'+_0xbc3468[_0x50d3('0x40')][_0x50d3('0x4d')]+'%'};return _0x350ed4;}})});}_0x350aaa=_[_0x50d3('0x4e')]({},_0x350aaa,_0xbc3468[_0x50d3('0x51')]);var _0x5e1a1a={'where':_0x350aaa[_0x50d3('0x4a')]};return db[_0x50d3('0x3c')][_0x50d3('0x52')](_0x5e1a1a)['then'](function(_0xaca5b7){_0x438051[_0x50d3('0x52')]=_0xaca5b7;if(_0xbc3468[_0x50d3('0x40')]['includeAll']){_0x350aaa['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x50d3('0x53')](_0x350aaa);})[_0x50d3('0x36')](function(_0x11cb77){_0x438051['rows']=_0x11cb77;return _0x438051;})[_0x50d3('0x36')](respondWithFilteredResult(_0x148821,_0x350aaa))[_0x50d3('0x2a')](handleError(_0x148821,null));};exports['show']=function(_0x3d3fa2,_0x59939c){var _0x551408={'raw':![],'where':{'id':_0x3d3fa2[_0x50d3('0x54')]['id']}},_0x47e275={};_0x47e275[_0x50d3('0x3f')]=_[_0x50d3('0x41')](db[_0x50d3('0x3c')]['rawAttributes']);_0x47e275[_0x50d3('0x40')]=_[_0x50d3('0x41')](_0x3d3fa2[_0x50d3('0x40')]);_0x47e275[_0x50d3('0x4c')]=_[_0x50d3('0x42')](_0x47e275[_0x50d3('0x3f')],_0x47e275['query']);_0x551408[_0x50d3('0x43')]=_[_0x50d3('0x42')](_0x47e275[_0x50d3('0x3f')],qs[_0x50d3('0x44')](_0x3d3fa2['query']['fields']));_0x551408[_0x50d3('0x43')]=_0x551408[_0x50d3('0x43')]['length']?_0x551408[_0x50d3('0x43')]:_0x47e275[_0x50d3('0x3f')];if(_0x3d3fa2['query'][_0x50d3('0x55')]){_0x551408[_0x50d3('0x56')]=[{'all':!![]}];}_0x551408=_[_0x50d3('0x4e')]({},_0x551408,_0x3d3fa2[_0x50d3('0x51')]);return db[_0x50d3('0x3c')][_0x50d3('0x57')](_0x551408)[_0x50d3('0x36')](handleEntityNotFound(_0x59939c,null))[_0x50d3('0x36')](respondWithResult(_0x59939c,null))[_0x50d3('0x2a')](handleError(_0x59939c,null));};exports['create']=function(_0x10176d,_0x5039ce){return db[_0x50d3('0x3c')][_0x50d3('0x58')](_0x10176d[_0x50d3('0x59')],{})[_0x50d3('0x36')](respondWithResult(_0x5039ce,0xc9))['catch'](handleError(_0x5039ce,null));};exports['update']=function(_0x27e81e,_0x6c69e9){if(_0x27e81e[_0x50d3('0x59')]['id']){delete _0x27e81e[_0x50d3('0x59')]['id'];}return db[_0x50d3('0x3c')][_0x50d3('0x57')]({'where':{'id':_0x27e81e[_0x50d3('0x54')]['id']}})[_0x50d3('0x36')](handleEntityNotFound(_0x6c69e9,null))[_0x50d3('0x36')](saveUpdates(_0x27e81e[_0x50d3('0x59')],null))[_0x50d3('0x36')](respondWithResult(_0x6c69e9,null))[_0x50d3('0x2a')](handleError(_0x6c69e9,null));};exports[_0x50d3('0x37')]=function(_0x2cd416,_0x324cfd){return db[_0x50d3('0x3c')]['find']({'where':{'id':_0x2cd416[_0x50d3('0x54')]['id']}})[_0x50d3('0x36')](handleEntityNotFound(_0x324cfd,null))[_0x50d3('0x36')](removeEntity(_0x324cfd,null))[_0x50d3('0x2a')](handleError(_0x324cfd,null));};exports[_0x50d3('0x5a')]=function(_0x452d2c,_0x5e2fdb,_0x2cc079){var _0x32bbd3={};var _0x30fcd1={};var _0x4c86b0;var _0xbd4e70;return db[_0x50d3('0x3c')][_0x50d3('0x5b')]({'where':{'id':_0x452d2c[_0x50d3('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e2fdb,null))[_0x50d3('0x36')](function(_0x37b4e9){if(_0x37b4e9){_0x4c86b0=_0x37b4e9;_0x30fcd1[_0x50d3('0x3f')]=_[_0x50d3('0x41')](db[_0x50d3('0x5c')][_0x50d3('0x5d')]);_0x30fcd1[_0x50d3('0x40')]=_[_0x50d3('0x41')](_0x452d2c['query']);_0x30fcd1[_0x50d3('0x4c')]=_[_0x50d3('0x42')](_0x30fcd1[_0x50d3('0x3f')],_0x30fcd1[_0x50d3('0x40')]);_0x32bbd3[_0x50d3('0x43')]=_[_0x50d3('0x42')](_0x30fcd1[_0x50d3('0x3f')],qs[_0x50d3('0x44')](_0x452d2c['query'][_0x50d3('0x44')]));_0x32bbd3[_0x50d3('0x43')]=_0x32bbd3['attributes'][_0x50d3('0x45')]?_0x32bbd3['attributes']:_0x30fcd1[_0x50d3('0x3f')];_0x32bbd3[_0x50d3('0x48')]=qs[_0x50d3('0x49')](_0x452d2c['query'][_0x50d3('0x49')]);_0x32bbd3[_0x50d3('0x4a')]=qs[_0x50d3('0x4c')](_[_0x50d3('0x4b')](_0x452d2c[_0x50d3('0x40')],_0x30fcd1[_0x50d3('0x4c')]));if(_0x452d2c[_0x50d3('0x40')]['filter']){_0x32bbd3[_0x50d3('0x4a')]=_[_0x50d3('0x4e')](_0x32bbd3[_0x50d3('0x4a')],{'$or':_[_0x50d3('0x3b')](_0x32bbd3['attributes'],function(_0x41efb8){var _0x39e8ae={};_0x39e8ae[_0x41efb8]={'$like':'%'+_0x452d2c[_0x50d3('0x40')]['filter']+'%'};return _0x39e8ae;})});}_0x32bbd3=_[_0x50d3('0x4e')]({},_0x32bbd3,_0x452d2c[_0x50d3('0x51')]);return _0x4c86b0['getFields'](_0x32bbd3);}})[_0x50d3('0x36')](function(_0x4dc53a){if(_0x4dc53a){_0xbd4e70=_0x4dc53a[_0x50d3('0x45')];if(!_0x452d2c[_0x50d3('0x40')]['hasOwnProperty']('nolimit')){_0x32bbd3[_0x50d3('0x30')]=qs[_0x50d3('0x30')](_0x452d2c[_0x50d3('0x40')]['limit']);_0x32bbd3['offset']=qs[_0x50d3('0x2f')](_0x452d2c[_0x50d3('0x40')]['offset']);}return _0x4c86b0['getFields'](_0x32bbd3);}})[_0x50d3('0x36')](function(_0x5a930a){if(_0x5a930a){return _0x5a930a?{'count':_0xbd4e70,'rows':_0x5a930a}:null;}})[_0x50d3('0x36')](respondWithResult(_0x5e2fdb,null))[_0x50d3('0x2a')](handleError(_0x5e2fdb,null));};exports[_0x50d3('0x5e')]=function(_0x6c7984,_0x18849d,_0x3d8c13){var _0x293757={};var _0x57e556={};var _0x20261c;var _0x3ee3d9;return db[_0x50d3('0x3c')][_0x50d3('0x5b')]({'where':{'id':_0x6c7984['params']['id']}})[_0x50d3('0x36')](handleEntityNotFound(_0x18849d,null))[_0x50d3('0x36')](function(_0x4f6890){if(_0x4f6890){_0x20261c=_0x4f6890;_0x57e556[_0x50d3('0x3f')]=_['keys'](db[_0x50d3('0x5c')][_0x50d3('0x5d')]);_0x57e556[_0x50d3('0x40')]=_[_0x50d3('0x41')](_0x6c7984[_0x50d3('0x40')]);_0x57e556[_0x50d3('0x4c')]=_[_0x50d3('0x42')](_0x57e556[_0x50d3('0x3f')],_0x57e556[_0x50d3('0x40')]);_0x293757['attributes']=_[_0x50d3('0x42')](_0x57e556[_0x50d3('0x3f')],qs[_0x50d3('0x44')](_0x6c7984['query'][_0x50d3('0x44')]));_0x293757[_0x50d3('0x43')]=_0x293757[_0x50d3('0x43')][_0x50d3('0x45')]?_0x293757[_0x50d3('0x43')]:_0x57e556[_0x50d3('0x3f')];_0x293757[_0x50d3('0x48')]=qs[_0x50d3('0x49')](_0x6c7984[_0x50d3('0x40')][_0x50d3('0x49')]);_0x293757[_0x50d3('0x4a')]=qs[_0x50d3('0x4c')](_[_0x50d3('0x4b')](_0x6c7984[_0x50d3('0x40')],_0x57e556[_0x50d3('0x4c')]));if(_0x6c7984[_0x50d3('0x40')][_0x50d3('0x4d')]){_0x293757['where']=_[_0x50d3('0x4e')](_0x293757[_0x50d3('0x4a')],{'$or':_[_0x50d3('0x3b')](_0x293757['attributes'],function(_0x3d2924){var _0x59ab7e={};_0x59ab7e[_0x3d2924]={'$like':'%'+_0x6c7984[_0x50d3('0x40')][_0x50d3('0x4d')]+'%'};return _0x59ab7e;})});}_0x293757=_[_0x50d3('0x4e')]({},_0x293757,_0x6c7984[_0x50d3('0x51')]);return _0x20261c[_0x50d3('0x5e')](_0x293757);}})[_0x50d3('0x36')](function(_0x14063f){if(_0x14063f){_0x3ee3d9=_0x14063f[_0x50d3('0x45')];if(!_0x6c7984[_0x50d3('0x40')][_0x50d3('0x46')]('nolimit')){_0x293757[_0x50d3('0x30')]=qs[_0x50d3('0x30')](_0x6c7984['query'][_0x50d3('0x30')]);_0x293757[_0x50d3('0x2f')]=qs[_0x50d3('0x2f')](_0x6c7984[_0x50d3('0x40')][_0x50d3('0x2f')]);}return _0x20261c[_0x50d3('0x5e')](_0x293757);}})['then'](function(_0x5c49fe){if(_0x5c49fe){return _0x5c49fe?{'count':_0x3ee3d9,'rows':_0x5c49fe}:null;}})[_0x50d3('0x36')](respondWithResult(_0x18849d,null))[_0x50d3('0x2a')](handleError(_0x18849d,null));};exports['getDescriptions']=function(_0x5dd9c3,_0x1e9c6d,_0x6673){var _0x3c2e6b={};var _0x3f7fee={};var _0x2845b1;var _0x163809;return db[_0x50d3('0x3c')]['findOne']({'where':{'id':_0x5dd9c3[_0x50d3('0x54')]['id']}})['then'](handleEntityNotFound(_0x1e9c6d,null))['then'](function(_0x47e339){if(_0x47e339){_0x2845b1=_0x47e339;_0x3f7fee[_0x50d3('0x3f')]=_['keys'](db[_0x50d3('0x5c')][_0x50d3('0x5d')]);_0x3f7fee[_0x50d3('0x40')]=_[_0x50d3('0x41')](_0x5dd9c3['query']);_0x3f7fee[_0x50d3('0x4c')]=_[_0x50d3('0x42')](_0x3f7fee[_0x50d3('0x3f')],_0x3f7fee['query']);_0x3c2e6b[_0x50d3('0x43')]=_[_0x50d3('0x42')](_0x3f7fee[_0x50d3('0x3f')],qs['fields'](_0x5dd9c3[_0x50d3('0x40')]['fields']));_0x3c2e6b[_0x50d3('0x43')]=_0x3c2e6b['attributes'][_0x50d3('0x45')]?_0x3c2e6b['attributes']:_0x3f7fee['model'];_0x3c2e6b[_0x50d3('0x48')]=qs[_0x50d3('0x49')](_0x5dd9c3[_0x50d3('0x40')][_0x50d3('0x49')]);_0x3c2e6b[_0x50d3('0x4a')]=qs[_0x50d3('0x4c')](_['pick'](_0x5dd9c3[_0x50d3('0x40')],_0x3f7fee[_0x50d3('0x4c')]));if(_0x5dd9c3['query'][_0x50d3('0x4d')]){_0x3c2e6b[_0x50d3('0x4a')]=_['merge'](_0x3c2e6b[_0x50d3('0x4a')],{'$or':_[_0x50d3('0x3b')](_0x3c2e6b[_0x50d3('0x43')],function(_0x24b016){var _0xa9eb22={};_0xa9eb22[_0x24b016]={'$like':'%'+_0x5dd9c3[_0x50d3('0x40')][_0x50d3('0x4d')]+'%'};return _0xa9eb22;})});}_0x3c2e6b=_[_0x50d3('0x4e')]({},_0x3c2e6b,_0x5dd9c3[_0x50d3('0x51')]);return _0x2845b1['getDescriptions'](_0x3c2e6b);}})[_0x50d3('0x36')](function(_0x25bf4c){if(_0x25bf4c){_0x163809=_0x25bf4c[_0x50d3('0x45')];if(!_0x5dd9c3[_0x50d3('0x40')][_0x50d3('0x46')]('nolimit')){_0x3c2e6b[_0x50d3('0x30')]=qs[_0x50d3('0x30')](_0x5dd9c3[_0x50d3('0x40')][_0x50d3('0x30')]);_0x3c2e6b[_0x50d3('0x2f')]=qs[_0x50d3('0x2f')](_0x5dd9c3[_0x50d3('0x40')][_0x50d3('0x2f')]);}return _0x2845b1['getDescriptions'](_0x3c2e6b);}})[_0x50d3('0x36')](function(_0x450fe1){if(_0x450fe1){return _0x450fe1?{'count':_0x163809,'rows':_0x450fe1}:null;}})['then'](respondWithResult(_0x1e9c6d,null))[_0x50d3('0x2a')](handleError(_0x1e9c6d,null));}; \ No newline at end of file +var _0x9207=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','send','index','SugarcrmConfiguration','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','name','options','includeAll','include','findAll','show','params','length','merge','find','create','body','findOne','SugarcrmField','getFields','nolimit','rawAttributes','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','catch'];(function(_0x4e059d,_0x3bb649){var _0x4a5bc2=function(_0x41b8ba){while(--_0x41b8ba){_0x4e059d['push'](_0x4e059d['shift']());}};_0x4a5bc2(++_0x3bb649);}(_0x9207,0x93));var _0x7920=function(_0x17772e,_0x3d4d93){_0x17772e=_0x17772e-0x0;var _0x21e766=_0x9207[_0x17772e];return _0x21e766;};'use strict';var pdf=require(_0x7920('0x0'));var emlformat=require(_0x7920('0x1'));var rimraf=require(_0x7920('0x2'));var zipdir=require(_0x7920('0x3'));var jsonpatch=require(_0x7920('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7920('0x5'));var Mustache=require(_0x7920('0x6'));var util=require(_0x7920('0x7'));var path=require(_0x7920('0x8'));var sox=require(_0x7920('0x9'));var csv=require(_0x7920('0xa'));var ejs=require(_0x7920('0xb'));var fs=require('fs');var _=require(_0x7920('0xc'));var squel=require('squel');var crypto=require(_0x7920('0xd'));var jsforce=require(_0x7920('0xe'));var deskjs=require(_0x7920('0xf'));var toCsv=require(_0x7920('0xa'));var querystring=require(_0x7920('0x10'));var Papa=require(_0x7920('0x11'));var Redis=require('ioredis');var authService=require(_0x7920('0x12'));var qs=require(_0x7920('0x13'));var as=require(_0x7920('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7920('0x15'));var utils=require(_0x7920('0x16'));var config=require(_0x7920('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7920('0x18'));var client=jayson[_0x7920('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x34bb47,_0x5869c4,_0x50593d){if(_0x50593d){var _0x212f0a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x212f0a['test'](_0x5869c4)){return _0x34bb47;}else{throw new db[(_0x7920('0x1a'))]['ValidationError'](_0x7920('0x1b'));}}else{return _0x34bb47;}}function respondWithRpcPromise(_0x286ab6,_0x5a17ad,_0x90ba03,_0x155d0a){return new BPromise(function(_0x40ac5a,_0x519c6c){var _0x16f429=_0x155d0a||client;return _0x16f429[_0x7920('0x1c')](_0x286ab6,_0x90ba03)[_0x7920('0x1d')](function(_0x296990){logger[_0x7920('0x1e')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5a17ad,_0x7920('0x1f'));logger[_0x7920('0x20')](_0x7920('0x21'),_0x5a17ad,'request\x20sent',JSON[_0x7920('0x22')](_0x296990));if(_0x296990[_0x7920('0x23')]){if(_0x296990[_0x7920('0x23')]['code']===0x1f4){logger['error'](_0x7920('0x24'),_0x5a17ad,_0x296990[_0x7920('0x23')][_0x7920('0x25')]);return _0x519c6c(_0x296990[_0x7920('0x23')][_0x7920('0x25')]);}logger['error'](_0x7920('0x24'),_0x5a17ad,_0x296990[_0x7920('0x23')][_0x7920('0x25')]);return _0x40ac5a(_0x296990[_0x7920('0x23')][_0x7920('0x25')]);}else{logger[_0x7920('0x1e')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5a17ad,_0x7920('0x1f'));_0x40ac5a(_0x296990['result']['message']);}})[_0x7920('0x26')](function(_0x82dc45){logger['error'](_0x7920('0x24'),_0x5a17ad,_0x82dc45);_0x519c6c(_0x82dc45);});});}function respondWithStatusCode(_0x36187f,_0x2ef1ad){_0x2ef1ad=_0x2ef1ad||0xcc;return function(_0x5c6826){if(_0x5c6826){return _0x36187f[_0x7920('0x27')](_0x2ef1ad);}return _0x36187f[_0x7920('0x28')](_0x2ef1ad)[_0x7920('0x29')]();};}function respondWithResult(_0x3285b4,_0x3e72ec){_0x3e72ec=_0x3e72ec||0xc8;return function(_0x1d7fa6){if(_0x1d7fa6){return _0x3285b4[_0x7920('0x28')](_0x3e72ec)[_0x7920('0x2a')](_0x1d7fa6);}};}function respondWithFilteredResult(_0xb42870,_0x487da2){return function(_0xaad486){if(_0xaad486){var _0x1f2fa5=_0xaad486[_0x7920('0x2b')],_0x10e9e9=_0x487da2[_0x7920('0x2c')],_0x880a31=_0x487da2[_0x7920('0x2c')]+_0x487da2[_0x7920('0x2d')],_0x34477b;if(_0x880a31>=_0x1f2fa5){_0x880a31=_0x1f2fa5;_0x34477b=0xc8;}else{_0x34477b=0xce;}_0xb42870[_0x7920('0x28')](_0x34477b);return _0xb42870[_0x7920('0x2e')](_0x7920('0x2f'),_0x10e9e9+'-'+_0x880a31+'/'+_0x1f2fa5)[_0x7920('0x2a')](_0xaad486);}return null;};}function patchUpdates(_0x136dc9){return function(_0x2e1537){try{jsonpatch[_0x7920('0x30')](_0x2e1537,_0x136dc9,!![]);}catch(_0xf797b7){return BPromise[_0x7920('0x31')](_0xf797b7);}return _0x2e1537[_0x7920('0x32')]();};}function saveUpdates(_0x3ef88e,_0x163b79){return function(_0x343c8e){if(_0x343c8e){return _0x343c8e[_0x7920('0x33')](_0x3ef88e)['then'](function(_0x28da7f){return _0x28da7f;});}return null;};}function removeEntity(_0x49b17e,_0x1ac6f0){return function(_0x59049e){if(_0x59049e){return _0x59049e[_0x7920('0x34')]()[_0x7920('0x1d')](function(){_0x49b17e[_0x7920('0x28')](0xcc)[_0x7920('0x29')]();});}};}function handleEntityNotFound(_0x5007fc,_0x586f56){return function(_0x93df24){if(!_0x93df24){_0x5007fc['sendStatus'](0x194);}return _0x93df24;};}function handleError(_0x5cea09,_0x94ccdf){_0x94ccdf=_0x94ccdf||0x1f4;return function(_0x552ee7){logger[_0x7920('0x23')](_0x552ee7[_0x7920('0x35')]);if(_0x552ee7['name']){delete _0x552ee7['name'];}_0x5cea09[_0x7920('0x28')](_0x94ccdf)[_0x7920('0x36')](_0x552ee7);};}exports[_0x7920('0x37')]=function(_0x40b7fc,_0x41e7c2){var _0x5838c1={},_0x350111={},_0x52652e={'count':0x0,'rows':[]};var _0x2d4b7a=_['map'](db[_0x7920('0x38')]['rawAttributes'],function(_0x349095){return{'name':_0x349095[_0x7920('0x39')],'type':_0x349095[_0x7920('0x3a')][_0x7920('0x3b')]};});_0x350111['model']=_[_0x7920('0x3c')](_0x2d4b7a,'name');_0x350111[_0x7920('0x3d')]=_[_0x7920('0x3e')](_0x40b7fc[_0x7920('0x3d')]);_0x350111[_0x7920('0x3f')]=_[_0x7920('0x40')](_0x350111[_0x7920('0x41')],_0x350111[_0x7920('0x3d')]);_0x5838c1[_0x7920('0x42')]=_[_0x7920('0x40')](_0x350111['model'],qs[_0x7920('0x43')](_0x40b7fc[_0x7920('0x3d')][_0x7920('0x43')]));_0x5838c1[_0x7920('0x42')]=_0x5838c1[_0x7920('0x42')]['length']?_0x5838c1[_0x7920('0x42')]:_0x350111[_0x7920('0x41')];if(!_0x40b7fc[_0x7920('0x3d')][_0x7920('0x44')]('nolimit')){_0x5838c1['limit']=qs[_0x7920('0x2d')](_0x40b7fc['query'][_0x7920('0x2d')]);_0x5838c1[_0x7920('0x2c')]=qs[_0x7920('0x2c')](_0x40b7fc[_0x7920('0x3d')]['offset']);}_0x5838c1[_0x7920('0x45')]=qs[_0x7920('0x46')](_0x40b7fc['query']['sort']);_0x5838c1[_0x7920('0x47')]=qs[_0x7920('0x3f')](_[_0x7920('0x48')](_0x40b7fc[_0x7920('0x3d')],_0x350111[_0x7920('0x3f')]),_0x2d4b7a);if(_0x40b7fc['query'][_0x7920('0x49')]){_0x5838c1['where']=_['merge'](_0x5838c1[_0x7920('0x47')],{'$or':_['map'](_0x2d4b7a,function(_0x54e917){if(_0x54e917[_0x7920('0x3a')]!=='VIRTUAL'){var _0x4fa352={};_0x4fa352[_0x54e917[_0x7920('0x4a')]]={'$like':'%'+_0x40b7fc[_0x7920('0x3d')][_0x7920('0x49')]+'%'};return _0x4fa352;}})});}_0x5838c1=_['merge']({},_0x5838c1,_0x40b7fc[_0x7920('0x4b')]);var _0x4671c5={'where':_0x5838c1[_0x7920('0x47')]};return db[_0x7920('0x38')][_0x7920('0x2b')](_0x4671c5)[_0x7920('0x1d')](function(_0xe66a8f){_0x52652e['count']=_0xe66a8f;if(_0x40b7fc['query'][_0x7920('0x4c')]){_0x5838c1[_0x7920('0x4d')]=[{'all':!![]}];}return db[_0x7920('0x38')][_0x7920('0x4e')](_0x5838c1);})[_0x7920('0x1d')](function(_0x51e2d7){_0x52652e['rows']=_0x51e2d7;return _0x52652e;})['then'](respondWithFilteredResult(_0x41e7c2,_0x5838c1))['catch'](handleError(_0x41e7c2,null));};exports[_0x7920('0x4f')]=function(_0x5e9f9e,_0x2f0b59){var _0x77cada={'raw':![],'where':{'id':_0x5e9f9e[_0x7920('0x50')]['id']}},_0xf79623={};_0xf79623[_0x7920('0x41')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0xf79623[_0x7920('0x3d')]=_[_0x7920('0x3e')](_0x5e9f9e[_0x7920('0x3d')]);_0xf79623['filters']=_[_0x7920('0x40')](_0xf79623['model'],_0xf79623['query']);_0x77cada[_0x7920('0x42')]=_[_0x7920('0x40')](_0xf79623[_0x7920('0x41')],qs['fields'](_0x5e9f9e[_0x7920('0x3d')][_0x7920('0x43')]));_0x77cada[_0x7920('0x42')]=_0x77cada[_0x7920('0x42')][_0x7920('0x51')]?_0x77cada[_0x7920('0x42')]:_0xf79623[_0x7920('0x41')];if(_0x5e9f9e[_0x7920('0x3d')][_0x7920('0x4c')]){_0x77cada[_0x7920('0x4d')]=[{'all':!![]}];}_0x77cada=_[_0x7920('0x52')]({},_0x77cada,_0x5e9f9e[_0x7920('0x4b')]);return db['SugarcrmConfiguration'][_0x7920('0x53')](_0x77cada)[_0x7920('0x1d')](handleEntityNotFound(_0x2f0b59,null))[_0x7920('0x1d')](respondWithResult(_0x2f0b59,null))[_0x7920('0x26')](handleError(_0x2f0b59,null));};exports[_0x7920('0x54')]=function(_0x3d0756,_0x125dd0){return db['SugarcrmConfiguration'][_0x7920('0x54')](_0x3d0756[_0x7920('0x55')],{})['then'](respondWithResult(_0x125dd0,0xc9))[_0x7920('0x26')](handleError(_0x125dd0,null));};exports[_0x7920('0x33')]=function(_0x22427a,_0x4f114f){if(_0x22427a[_0x7920('0x55')]['id']){delete _0x22427a[_0x7920('0x55')]['id'];}return db[_0x7920('0x38')][_0x7920('0x53')]({'where':{'id':_0x22427a[_0x7920('0x50')]['id']}})[_0x7920('0x1d')](handleEntityNotFound(_0x4f114f,null))['then'](saveUpdates(_0x22427a[_0x7920('0x55')],null))[_0x7920('0x1d')](respondWithResult(_0x4f114f,null))[_0x7920('0x26')](handleError(_0x4f114f,null));};exports[_0x7920('0x34')]=function(_0x5d1a21,_0x4cb442){return db[_0x7920('0x38')][_0x7920('0x53')]({'where':{'id':_0x5d1a21['params']['id']}})['then'](handleEntityNotFound(_0x4cb442,null))[_0x7920('0x1d')](removeEntity(_0x4cb442,null))[_0x7920('0x26')](handleError(_0x4cb442,null));};exports['getFields']=function(_0x2ad7f3,_0xfe209a,_0x2bd20a){var _0x4c708f={};var _0xe0f585={};var _0x3f4bc1;var _0x52da29;return db[_0x7920('0x38')][_0x7920('0x56')]({'where':{'id':_0x2ad7f3[_0x7920('0x50')]['id']}})['then'](handleEntityNotFound(_0xfe209a,null))[_0x7920('0x1d')](function(_0x30207f){if(_0x30207f){_0x3f4bc1=_0x30207f;_0xe0f585[_0x7920('0x41')]=_[_0x7920('0x3e')](db[_0x7920('0x57')]['rawAttributes']);_0xe0f585[_0x7920('0x3d')]=_['keys'](_0x2ad7f3[_0x7920('0x3d')]);_0xe0f585[_0x7920('0x3f')]=_['intersection'](_0xe0f585['model'],_0xe0f585[_0x7920('0x3d')]);_0x4c708f[_0x7920('0x42')]=_['intersection'](_0xe0f585[_0x7920('0x41')],qs[_0x7920('0x43')](_0x2ad7f3[_0x7920('0x3d')]['fields']));_0x4c708f[_0x7920('0x42')]=_0x4c708f['attributes']['length']?_0x4c708f['attributes']:_0xe0f585['model'];_0x4c708f[_0x7920('0x45')]=qs[_0x7920('0x46')](_0x2ad7f3[_0x7920('0x3d')][_0x7920('0x46')]);_0x4c708f[_0x7920('0x47')]=qs[_0x7920('0x3f')](_['pick'](_0x2ad7f3[_0x7920('0x3d')],_0xe0f585[_0x7920('0x3f')]));if(_0x2ad7f3['query']['filter']){_0x4c708f[_0x7920('0x47')]=_[_0x7920('0x52')](_0x4c708f[_0x7920('0x47')],{'$or':_['map'](_0x4c708f[_0x7920('0x42')],function(_0x46b26a){var _0x20e43f={};_0x20e43f[_0x46b26a]={'$like':'%'+_0x2ad7f3['query'][_0x7920('0x49')]+'%'};return _0x20e43f;})});}_0x4c708f=_[_0x7920('0x52')]({},_0x4c708f,_0x2ad7f3[_0x7920('0x4b')]);return _0x3f4bc1[_0x7920('0x58')](_0x4c708f);}})['then'](function(_0xfb406e){if(_0xfb406e){_0x52da29=_0xfb406e[_0x7920('0x51')];if(!_0x2ad7f3['query'][_0x7920('0x44')](_0x7920('0x59'))){_0x4c708f[_0x7920('0x2d')]=qs['limit'](_0x2ad7f3[_0x7920('0x3d')][_0x7920('0x2d')]);_0x4c708f[_0x7920('0x2c')]=qs[_0x7920('0x2c')](_0x2ad7f3[_0x7920('0x3d')]['offset']);}return _0x3f4bc1[_0x7920('0x58')](_0x4c708f);}})[_0x7920('0x1d')](function(_0x128bcd){if(_0x128bcd){return _0x128bcd?{'count':_0x52da29,'rows':_0x128bcd}:null;}})[_0x7920('0x1d')](respondWithResult(_0xfe209a,null))[_0x7920('0x26')](handleError(_0xfe209a,null));};exports['getSubjects']=function(_0xaede93,_0x52046c,_0x1806d7){var _0xe5b2ac={};var _0xce488b={};var _0x4b9890;var _0x4b48c1;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0xaede93[_0x7920('0x50')]['id']}})[_0x7920('0x1d')](handleEntityNotFound(_0x52046c,null))['then'](function(_0x49b975){if(_0x49b975){_0x4b9890=_0x49b975;_0xce488b[_0x7920('0x41')]=_[_0x7920('0x3e')](db[_0x7920('0x57')][_0x7920('0x5a')]);_0xce488b[_0x7920('0x3d')]=_[_0x7920('0x3e')](_0xaede93[_0x7920('0x3d')]);_0xce488b[_0x7920('0x3f')]=_['intersection'](_0xce488b['model'],_0xce488b[_0x7920('0x3d')]);_0xe5b2ac[_0x7920('0x42')]=_[_0x7920('0x40')](_0xce488b[_0x7920('0x41')],qs['fields'](_0xaede93[_0x7920('0x3d')][_0x7920('0x43')]));_0xe5b2ac['attributes']=_0xe5b2ac['attributes'][_0x7920('0x51')]?_0xe5b2ac[_0x7920('0x42')]:_0xce488b[_0x7920('0x41')];_0xe5b2ac[_0x7920('0x45')]=qs[_0x7920('0x46')](_0xaede93['query'][_0x7920('0x46')]);_0xe5b2ac[_0x7920('0x47')]=qs['filters'](_[_0x7920('0x48')](_0xaede93[_0x7920('0x3d')],_0xce488b[_0x7920('0x3f')]));if(_0xaede93['query'][_0x7920('0x49')]){_0xe5b2ac[_0x7920('0x47')]=_[_0x7920('0x52')](_0xe5b2ac[_0x7920('0x47')],{'$or':_[_0x7920('0x3c')](_0xe5b2ac[_0x7920('0x42')],function(_0x34514c){var _0x36d414={};_0x36d414[_0x34514c]={'$like':'%'+_0xaede93[_0x7920('0x3d')][_0x7920('0x49')]+'%'};return _0x36d414;})});}_0xe5b2ac=_[_0x7920('0x52')]({},_0xe5b2ac,_0xaede93[_0x7920('0x4b')]);return _0x4b9890['getSubjects'](_0xe5b2ac);}})[_0x7920('0x1d')](function(_0x4f2b63){if(_0x4f2b63){_0x4b48c1=_0x4f2b63[_0x7920('0x51')];if(!_0xaede93[_0x7920('0x3d')][_0x7920('0x44')]('nolimit')){_0xe5b2ac[_0x7920('0x2d')]=qs[_0x7920('0x2d')](_0xaede93[_0x7920('0x3d')][_0x7920('0x2d')]);_0xe5b2ac[_0x7920('0x2c')]=qs[_0x7920('0x2c')](_0xaede93[_0x7920('0x3d')][_0x7920('0x2c')]);}return _0x4b9890[_0x7920('0x5b')](_0xe5b2ac);}})[_0x7920('0x1d')](function(_0x37eb87){if(_0x37eb87){return _0x37eb87?{'count':_0x4b48c1,'rows':_0x37eb87}:null;}})[_0x7920('0x1d')](respondWithResult(_0x52046c,null))[_0x7920('0x26')](handleError(_0x52046c,null));};exports[_0x7920('0x5c')]=function(_0xb4a855,_0x9de400,_0x45aeba){var _0x2ede96={};var _0x4d2e22={};var _0x562370;var _0x11785a;return db[_0x7920('0x38')][_0x7920('0x56')]({'where':{'id':_0xb4a855[_0x7920('0x50')]['id']}})[_0x7920('0x1d')](handleEntityNotFound(_0x9de400,null))[_0x7920('0x1d')](function(_0xde8471){if(_0xde8471){_0x562370=_0xde8471;_0x4d2e22[_0x7920('0x41')]=_[_0x7920('0x3e')](db[_0x7920('0x57')][_0x7920('0x5a')]);_0x4d2e22[_0x7920('0x3d')]=_[_0x7920('0x3e')](_0xb4a855[_0x7920('0x3d')]);_0x4d2e22[_0x7920('0x3f')]=_[_0x7920('0x40')](_0x4d2e22[_0x7920('0x41')],_0x4d2e22['query']);_0x2ede96[_0x7920('0x42')]=_[_0x7920('0x40')](_0x4d2e22['model'],qs[_0x7920('0x43')](_0xb4a855[_0x7920('0x3d')][_0x7920('0x43')]));_0x2ede96[_0x7920('0x42')]=_0x2ede96['attributes'][_0x7920('0x51')]?_0x2ede96['attributes']:_0x4d2e22[_0x7920('0x41')];_0x2ede96[_0x7920('0x45')]=qs['sort'](_0xb4a855['query'][_0x7920('0x46')]);_0x2ede96[_0x7920('0x47')]=qs[_0x7920('0x3f')](_['pick'](_0xb4a855[_0x7920('0x3d')],_0x4d2e22['filters']));if(_0xb4a855[_0x7920('0x3d')][_0x7920('0x49')]){_0x2ede96['where']=_['merge'](_0x2ede96['where'],{'$or':_['map'](_0x2ede96[_0x7920('0x42')],function(_0x261260){var _0x237706={};_0x237706[_0x261260]={'$like':'%'+_0xb4a855[_0x7920('0x3d')][_0x7920('0x49')]+'%'};return _0x237706;})});}_0x2ede96=_[_0x7920('0x52')]({},_0x2ede96,_0xb4a855[_0x7920('0x4b')]);return _0x562370['getDescriptions'](_0x2ede96);}})['then'](function(_0x226cb9){if(_0x226cb9){_0x11785a=_0x226cb9['length'];if(!_0xb4a855[_0x7920('0x3d')][_0x7920('0x44')](_0x7920('0x59'))){_0x2ede96[_0x7920('0x2d')]=qs['limit'](_0xb4a855['query']['limit']);_0x2ede96['offset']=qs[_0x7920('0x2c')](_0xb4a855['query'][_0x7920('0x2c')]);}return _0x562370[_0x7920('0x5c')](_0x2ede96);}})[_0x7920('0x1d')](function(_0x47e064){if(_0x47e064){return _0x47e064?{'count':_0x11785a,'rows':_0x47e064}:null;}})[_0x7920('0x1d')](respondWithResult(_0x9de400,null))[_0x7920('0x26')](handleError(_0x9de400,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index b49d7a6..f3eadce 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 _0x4b9c=['moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x2d0e29,_0x43466c){var _0x525ce5=function(_0x4c35e9){while(--_0x4c35e9){_0x2d0e29['push'](_0x2d0e29['shift']());}};_0x525ce5(++_0x43466c);}(_0x4b9c,0x1ae));var _0xc4b9=function(_0x1d83a8,_0xe170f0){_0x1d83a8=_0x1d83a8-0x0;var _0x56c11d=_0x4b9c[_0x1d83a8];return _0x56c11d;};'use strict';var _=require(_0xc4b9('0x0'));var util=require(_0xc4b9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc4b9('0x2'));var BPromise=require('bluebird');var rp=require(_0xc4b9('0x3'));var fs=require('fs');var path=require(_0xc4b9('0x4'));var rimraf=require(_0xc4b9('0x5'));var config=require(_0xc4b9('0x6'));var attributes=require(_0xc4b9('0x7'));module[_0xc4b9('0x8')]=function(_0x37b6f5,_0x3f9cfb){return _0x37b6f5[_0xc4b9('0x9')](_0xc4b9('0xa'),attributes,{'tableName':_0xc4b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2261=['define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x2261,0x1d7));var _0x1226=function(_0x3d82cc,_0x273fbb){_0x3d82cc=_0x3d82cc-0x0;var _0x3fec19=_0x2261[_0x3d82cc];return _0x3fec19;};'use strict';var _=require('lodash');var util=require(_0x1226('0x0'));var logger=require(_0x1226('0x1'))(_0x1226('0x2'));var moment=require('moment');var BPromise=require(_0x1226('0x3'));var rp=require(_0x1226('0x4'));var fs=require('fs');var path=require(_0x1226('0x5'));var rimraf=require(_0x1226('0x6'));var config=require(_0x1226('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x1226('0x8')]=function(_0x58d7f2,_0x522da0){return _0x58d7f2[_0x1226('0x9')](_0x1226('0xa'),attributes,{'tableName':_0x1226('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index a525020..01c7c7f 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 _0x5d39=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash'];(function(_0x213edb,_0x47eff5){var _0x2f7e39=function(_0x15a11b){while(--_0x15a11b){_0x213edb['push'](_0x213edb['shift']());}};_0x2f7e39(++_0x47eff5);}(_0x5d39,0x11d));var _0x95d3=function(_0x52a359,_0xcd07e2){_0x52a359=_0x52a359-0x0;var _0x17ae87=_0x5d39[_0x52a359];return _0x17ae87;};'use strict';var _=require(_0x95d3('0x0'));var util=require('util');var moment=require(_0x95d3('0x1'));var BPromise=require(_0x95d3('0x2'));var rs=require(_0x95d3('0x3'));var fs=require('fs');var Redis=require(_0x95d3('0x4'));var db=require(_0x95d3('0x5'))['db'];var utils=require(_0x95d3('0x6'));var logger=require(_0x95d3('0x7'))(_0x95d3('0x8'));var config=require(_0x95d3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x95d3('0xa')][_0x95d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x453428,_0x276801,_0x1dd556){return new BPromise(function(_0x101727,_0x11f1aa){return client['request'](_0x453428,_0x1dd556)[_0x95d3('0xc')](function(_0x38dbd7){logger['info'](_0x95d3('0xd'),_0x276801,'request\x20sent');logger['debug'](_0x95d3('0xe'),_0x276801,'request\x20sent',JSON[_0x95d3('0xf')](_0x38dbd7));if(_0x38dbd7[_0x95d3('0x10')]){if(_0x38dbd7['error'][_0x95d3('0x11')]===0x1f4){logger[_0x95d3('0x10')](_0x95d3('0xd'),_0x276801,_0x38dbd7[_0x95d3('0x10')][_0x95d3('0x12')]);return _0x11f1aa(_0x38dbd7[_0x95d3('0x10')][_0x95d3('0x12')]);}logger[_0x95d3('0x10')](_0x95d3('0xd'),_0x276801,_0x38dbd7[_0x95d3('0x10')][_0x95d3('0x12')]);return _0x101727(_0x38dbd7['error']['message']);}else{logger[_0x95d3('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x276801,_0x95d3('0x14'));_0x101727(_0x38dbd7['result']['message']);}})[_0x95d3('0x15')](function(_0x2609d2){logger[_0x95d3('0x10')](_0x95d3('0xd'),_0x276801,_0x2609d2);_0x11f1aa(_0x2609d2);});});} \ No newline at end of file +var _0x270f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmConfiguration,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x270f,0x105));var _0xf270=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x270f[_0x500c0];return _0xdd146f;};'use strict';var _=require(_0xf270('0x0'));var util=require('util');var moment=require(_0xf270('0x1'));var BPromise=require(_0xf270('0x2'));var rs=require(_0xf270('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf270('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf270('0x5'))(_0xf270('0x6'));var config=require(_0xf270('0x7'));var jayson=require(_0xf270('0x8'));var client=jayson['client'][_0xf270('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ee0e6,_0x2249ae,_0x35f759){return new BPromise(function(_0x5445a4,_0x7dc3c0){return client[_0xf270('0xa')](_0x2ee0e6,_0x35f759)[_0xf270('0xb')](function(_0x3b9481){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2249ae,_0xf270('0xc'));logger[_0xf270('0xd')](_0xf270('0xe'),_0x2249ae,_0xf270('0xc'),JSON[_0xf270('0xf')](_0x3b9481));if(_0x3b9481[_0xf270('0x10')]){if(_0x3b9481[_0xf270('0x10')]['code']===0x1f4){logger[_0xf270('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2249ae,_0x3b9481[_0xf270('0x10')][_0xf270('0x11')]);return _0x7dc3c0(_0x3b9481[_0xf270('0x10')][_0xf270('0x11')]);}logger[_0xf270('0x10')](_0xf270('0x12'),_0x2249ae,_0x3b9481[_0xf270('0x10')][_0xf270('0x11')]);return _0x5445a4(_0x3b9481[_0xf270('0x10')][_0xf270('0x11')]);}else{logger[_0xf270('0x13')](_0xf270('0x12'),_0x2249ae,'request\x20sent');_0x5445a4(_0x3b9481[_0xf270('0x14')][_0xf270('0x11')]);}})[_0xf270('0x15')](function(_0xd881a1){logger[_0xf270('0x10')](_0xf270('0x12'),_0x2249ae,_0xd881a1);_0x7dc3c0(_0xd881a1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 9b79053..95c2f1c 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 _0x8aba=['put','/:id','update','delete','exports','multer','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','post','create'];(function(_0x3a2d5a,_0xd856d7){var _0x571e32=function(_0x42dbf8){while(--_0x42dbf8){_0x3a2d5a['push'](_0x3a2d5a['shift']());}};_0x571e32(++_0xd856d7);}(_0x8aba,0x91));var _0xa8ab=function(_0xe13dbe,_0x48ff5c){_0xe13dbe=_0xe13dbe-0x0;var _0x416fb8=_0x8aba[_0xe13dbe];return _0x416fb8;};'use strict';var multer=require(_0xa8ab('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa8ab('0x1')]();var auth=require(_0xa8ab('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa8ab('0x3'));var controller=require('./intSugarcrmField.controller');router[_0xa8ab('0x4')]('/',auth['isAuthenticated'](),controller[_0xa8ab('0x5')]);router[_0xa8ab('0x4')]('/:id',auth[_0xa8ab('0x6')](),controller['show']);router[_0xa8ab('0x7')]('/',auth[_0xa8ab('0x6')](),controller[_0xa8ab('0x8')]);router[_0xa8ab('0x9')](_0xa8ab('0xa'),auth[_0xa8ab('0x6')](),controller[_0xa8ab('0xb')]);router[_0xa8ab('0xc')](_0xa8ab('0xa'),auth[_0xa8ab('0x6')](),controller['destroy']);module[_0xa8ab('0xd')]=router; \ No newline at end of file +var _0xa87a=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x35b493,_0xa0c2db){var _0x42cca0=function(_0x5294f9){while(--_0x5294f9){_0x35b493['push'](_0x35b493['shift']());}};_0x42cca0(++_0xa0c2db);}(_0xa87a,0xac));var _0xaa87=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xa87a[_0x42bc91];return _0x3f5507;};'use strict';var multer=require(_0xaa87('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa87('0x1'));var express=require(_0xaa87('0x2'));var router=express[_0xaa87('0x3')]();var auth=require(_0xaa87('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaa87('0x5'));var controller=require(_0xaa87('0x6'));router[_0xaa87('0x7')]('/',auth[_0xaa87('0x8')](),controller['index']);router[_0xaa87('0x7')](_0xaa87('0x9'),auth['isAuthenticated'](),controller[_0xaa87('0xa')]);router[_0xaa87('0xb')]('/',auth['isAuthenticated'](),controller[_0xaa87('0xc')]);router[_0xaa87('0xd')]('/:id',auth[_0xaa87('0x8')](),controller[_0xaa87('0xe')]);router[_0xaa87('0xf')](_0xaa87('0x9'),auth['isAuthenticated'](),controller[_0xaa87('0x10')]);module[_0xaa87('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index a6b9f54..86ec7c8 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 _0xe364=['string','STRING','customVariable','exports','ENUM','variable','keyValue'];(function(_0x2c0682,_0x523809){var _0x3a1fc6=function(_0x5ccd17){while(--_0x5ccd17){_0x2c0682['push'](_0x2c0682['shift']());}};_0x3a1fc6(++_0x523809);}(_0xe364,0x1c3));var _0x4e36=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xe364[_0x46f1a6];return _0x38429a;};'use strict';var Sequelize=require('sequelize');module[_0x4e36('0x0')]={'type':{'type':Sequelize[_0x4e36('0x1')]('string',_0x4e36('0x2'),'customVariable',_0x4e36('0x3')),'defaultValue':_0x4e36('0x4')},'content':{'type':Sequelize[_0x4e36('0x5')]},'key':{'type':Sequelize[_0x4e36('0x5')]},'keyType':{'type':Sequelize[_0x4e36('0x1')](_0x4e36('0x4'),_0x4e36('0x2'),_0x4e36('0x6'))},'keyContent':{'type':Sequelize[_0x4e36('0x5')]},'idField':{'type':Sequelize[_0x4e36('0x5')]},'nameField':{'type':Sequelize[_0x4e36('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4e36('0x5')]}}; \ No newline at end of file +var _0x8135=['BOOLEAN','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x3f89cb,_0x2b1b5e){var _0x430f4f=function(_0x35a03e){while(--_0x35a03e){_0x3f89cb['push'](_0x3f89cb['shift']());}};_0x430f4f(++_0x2b1b5e);}(_0x8135,0x99));var _0x5813=function(_0x27c619,_0x44ea27){_0x27c619=_0x27c619-0x0;var _0x595e39=_0x8135[_0x27c619];return _0x595e39;};'use strict';var Sequelize=require('sequelize');module[_0x5813('0x0')]={'type':{'type':Sequelize[_0x5813('0x1')](_0x5813('0x2'),_0x5813('0x3'),'customVariable',_0x5813('0x4')),'defaultValue':_0x5813('0x2')},'content':{'type':Sequelize[_0x5813('0x5')]},'key':{'type':Sequelize[_0x5813('0x5')]},'keyType':{'type':Sequelize[_0x5813('0x1')]('string','variable',_0x5813('0x6'))},'keyContent':{'type':Sequelize[_0x5813('0x5')]},'idField':{'type':Sequelize[_0x5813('0x5')]},'nameField':{'type':Sequelize[_0x5813('0x5')]},'customField':{'type':Sequelize[_0x5813('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5813('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index afaae77..850f687 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 _0x699e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','keys','length','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x18fcb7,_0x1738af){var _0xb70907=function(_0x32dee8){while(--_0x32dee8){_0x18fcb7['push'](_0x18fcb7['shift']());}};_0xb70907(++_0x1738af);}(_0x699e,0xcd));var _0xe699=function(_0x11183a,_0x815fba){_0x11183a=_0x11183a-0x0;var _0x5e9efc=_0x699e[_0x11183a];return _0x5e9efc;};'use strict';var pdf=require(_0xe699('0x0'));var emlformat=require(_0xe699('0x1'));var rimraf=require(_0xe699('0x2'));var zipdir=require(_0xe699('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe699('0x4'));var BPromise=require(_0xe699('0x5'));var Mustache=require(_0xe699('0x6'));var util=require(_0xe699('0x7'));var path=require(_0xe699('0x8'));var sox=require(_0xe699('0x9'));var csv=require(_0xe699('0xa'));var ejs=require(_0xe699('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe699('0xc'));var crypto=require(_0xe699('0xd'));var jsforce=require(_0xe699('0xe'));var deskjs=require(_0xe699('0xf'));var toCsv=require(_0xe699('0xa'));var querystring=require(_0xe699('0x10'));var Papa=require(_0xe699('0x11'));var Redis=require(_0xe699('0x12'));var authService=require(_0xe699('0x13'));var qs=require(_0xe699('0x14'));var as=require(_0xe699('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe699('0x16'))(_0xe699('0x17'));var utils=require(_0xe699('0x18'));var config=require('../../config/environment');var db=require(_0xe699('0x19'))['db'];function respondWithStatusCode(_0x58824f,_0x458712){_0x458712=_0x458712||0xcc;return function(_0x2af5a4){if(_0x2af5a4){return _0x58824f[_0xe699('0x1a')](_0x458712);}return _0x58824f[_0xe699('0x1b')](_0x458712)[_0xe699('0x1c')]();};}function respondWithResult(_0x494380,_0x481c29){_0x481c29=_0x481c29||0xc8;return function(_0x40083f){if(_0x40083f){return _0x494380[_0xe699('0x1b')](_0x481c29)[_0xe699('0x1d')](_0x40083f);}};}function respondWithFilteredResult(_0x6888be,_0x47b2ae){return function(_0x45618a){if(_0x45618a){var _0x175341=_0x45618a[_0xe699('0x1e')],_0x305b3e=_0x47b2ae[_0xe699('0x1f')],_0xd50f15=_0x47b2ae[_0xe699('0x1f')]+_0x47b2ae[_0xe699('0x20')],_0x188a8f;if(_0xd50f15>=_0x175341){_0xd50f15=_0x175341;_0x188a8f=0xc8;}else{_0x188a8f=0xce;}_0x6888be['status'](_0x188a8f);return _0x6888be[_0xe699('0x21')](_0xe699('0x22'),_0x305b3e+'-'+_0xd50f15+'/'+_0x175341)[_0xe699('0x1d')](_0x45618a);}return null;};}function patchUpdates(_0x519b6b){return function(_0x119acd){try{jsonpatch['apply'](_0x119acd,_0x519b6b,!![]);}catch(_0x465c4f){return BPromise[_0xe699('0x23')](_0x465c4f);}return _0x119acd[_0xe699('0x24')]();};}function saveUpdates(_0x662515,_0x229cf9){return function(_0x562eef){if(_0x562eef){return _0x562eef['update'](_0x662515)[_0xe699('0x25')](function(_0x5881c2){return _0x5881c2;});}return null;};}function removeEntity(_0x3dadc3,_0x4de43e){return function(_0x5ed30c){if(_0x5ed30c){return _0x5ed30c[_0xe699('0x26')]()[_0xe699('0x25')](function(){_0x3dadc3[_0xe699('0x1b')](0xcc)[_0xe699('0x1c')]();});}};}function handleEntityNotFound(_0x1b0cd0,_0x4a336f){return function(_0x45e5bc){if(!_0x45e5bc){_0x1b0cd0['sendStatus'](0x194);}return _0x45e5bc;};}function handleError(_0x2f7796,_0x4a6a66){_0x4a6a66=_0x4a6a66||0x1f4;return function(_0x3a4d40){logger[_0xe699('0x27')](_0x3a4d40[_0xe699('0x28')]);if(_0x3a4d40['name']){delete _0x3a4d40[_0xe699('0x29')];}_0x2f7796['status'](_0x4a6a66)[_0xe699('0x2a')](_0x3a4d40);};}exports[_0xe699('0x2b')]=function(_0x36f6c1,_0x116742){var _0x3067cd={},_0x4de94e={},_0x500847={'count':0x0,'rows':[]};var _0xd90265=_[_0xe699('0x2c')](db[_0xe699('0x2d')][_0xe699('0x2e')],function(_0x2277a1){return{'name':_0x2277a1[_0xe699('0x2f')],'type':_0x2277a1[_0xe699('0x30')][_0xe699('0x31')]};});_0x4de94e[_0xe699('0x32')]=_['map'](_0xd90265,_0xe699('0x29'));_0x4de94e[_0xe699('0x33')]=_['keys'](_0x36f6c1['query']);_0x4de94e['filters']=_[_0xe699('0x34')](_0x4de94e['model'],_0x4de94e['query']);_0x3067cd[_0xe699('0x35')]=_[_0xe699('0x34')](_0x4de94e[_0xe699('0x32')],qs[_0xe699('0x36')](_0x36f6c1[_0xe699('0x33')][_0xe699('0x36')]));_0x3067cd[_0xe699('0x35')]=_0x3067cd['attributes']['length']?_0x3067cd['attributes']:_0x4de94e[_0xe699('0x32')];if(!_0x36f6c1[_0xe699('0x33')][_0xe699('0x37')](_0xe699('0x38'))){_0x3067cd[_0xe699('0x20')]=qs[_0xe699('0x20')](_0x36f6c1[_0xe699('0x33')]['limit']);_0x3067cd[_0xe699('0x1f')]=qs[_0xe699('0x1f')](_0x36f6c1['query'][_0xe699('0x1f')]);}_0x3067cd[_0xe699('0x39')]=qs['sort'](_0x36f6c1[_0xe699('0x33')][_0xe699('0x3a')]);_0x3067cd[_0xe699('0x3b')]=qs['filters'](_[_0xe699('0x3c')](_0x36f6c1['query'],_0x4de94e[_0xe699('0x3d')]),_0xd90265);if(_0x36f6c1['query'][_0xe699('0x3e')]){_0x3067cd[_0xe699('0x3b')]=_[_0xe699('0x3f')](_0x3067cd[_0xe699('0x3b')],{'$or':_[_0xe699('0x2c')](_0xd90265,function(_0x12b7a2){if(_0x12b7a2[_0xe699('0x30')]!==_0xe699('0x40')){var _0x140f2f={};_0x140f2f[_0x12b7a2[_0xe699('0x29')]]={'$like':'%'+_0x36f6c1['query'][_0xe699('0x3e')]+'%'};return _0x140f2f;}})});}_0x3067cd=_[_0xe699('0x3f')]({},_0x3067cd,_0x36f6c1[_0xe699('0x41')]);var _0x2213be={'where':_0x3067cd[_0xe699('0x3b')]};return db['SugarcrmField'][_0xe699('0x1e')](_0x2213be)[_0xe699('0x25')](function(_0x2671e8){_0x500847[_0xe699('0x1e')]=_0x2671e8;if(_0x36f6c1[_0xe699('0x33')]['includeAll']){_0x3067cd[_0xe699('0x42')]=[{'all':!![]}];}return db[_0xe699('0x2d')]['findAll'](_0x3067cd);})[_0xe699('0x25')](function(_0x3558a1){_0x500847[_0xe699('0x43')]=_0x3558a1;return _0x500847;})[_0xe699('0x25')](respondWithFilteredResult(_0x116742,_0x3067cd))['catch'](handleError(_0x116742,null));};exports['show']=function(_0x35e96d,_0x3c73ae){var _0x110d23={'raw':!![],'where':{'id':_0x35e96d['params']['id']}},_0x447b02={};_0x447b02['model']=_['keys'](db[_0xe699('0x2d')]['rawAttributes']);_0x447b02[_0xe699('0x33')]=_[_0xe699('0x44')](_0x35e96d[_0xe699('0x33')]);_0x447b02['filters']=_['intersection'](_0x447b02[_0xe699('0x32')],_0x447b02[_0xe699('0x33')]);_0x110d23[_0xe699('0x35')]=_[_0xe699('0x34')](_0x447b02[_0xe699('0x32')],qs['fields'](_0x35e96d[_0xe699('0x33')][_0xe699('0x36')]));_0x110d23[_0xe699('0x35')]=_0x110d23['attributes'][_0xe699('0x45')]?_0x110d23['attributes']:_0x447b02[_0xe699('0x32')];if(_0x35e96d[_0xe699('0x33')]['includeAll']){_0x110d23[_0xe699('0x42')]=[{'all':!![]}];}_0x110d23=_[_0xe699('0x3f')]({},_0x110d23,_0x35e96d[_0xe699('0x41')]);return db[_0xe699('0x2d')][_0xe699('0x46')](_0x110d23)['then'](handleEntityNotFound(_0x3c73ae,null))[_0xe699('0x25')](respondWithResult(_0x3c73ae,null))[_0xe699('0x47')](handleError(_0x3c73ae,null));};exports[_0xe699('0x48')]=function(_0x3b7277,_0xd2761c){return db[_0xe699('0x2d')][_0xe699('0x48')](_0x3b7277['body'],{})['then'](respondWithResult(_0xd2761c,0xc9))[_0xe699('0x47')](handleError(_0xd2761c,null));};exports['update']=function(_0x5eadd9,_0xd5dfe5){if(_0x5eadd9['body']['id']){delete _0x5eadd9[_0xe699('0x49')]['id'];}return db[_0xe699('0x2d')][_0xe699('0x46')]({'where':{'id':_0x5eadd9[_0xe699('0x4a')]['id']}})[_0xe699('0x25')](handleEntityNotFound(_0xd5dfe5,null))[_0xe699('0x25')](saveUpdates(_0x5eadd9['body'],null))[_0xe699('0x25')](respondWithResult(_0xd5dfe5,null))[_0xe699('0x47')](handleError(_0xd5dfe5,null));};exports[_0xe699('0x26')]=function(_0x1ef395,_0x3b73a0){return db[_0xe699('0x2d')][_0xe699('0x46')]({'where':{'id':_0x1ef395[_0xe699('0x4a')]['id']}})[_0xe699('0x25')](handleEntityNotFound(_0x3b73a0,null))[_0xe699('0x25')](removeEntity(_0x3b73a0,null))[_0xe699('0x47')](handleError(_0x3b73a0,null));}; \ No newline at end of file +var _0x9fd0=['Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set'];(function(_0x4cbc27,_0x21f1e5){var _0x2a6ee9=function(_0x2bfb11){while(--_0x2bfb11){_0x4cbc27['push'](_0x4cbc27['shift']());}};_0x2a6ee9(++_0x21f1e5);}(_0x9fd0,0x1e8));var _0x09fd=function(_0x5a6817,_0x511848){_0x5a6817=_0x5a6817-0x0;var _0xb77cbd=_0x9fd0[_0x5a6817];return _0xb77cbd;};'use strict';var pdf=require(_0x09fd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x09fd('0x1'));var jsonpatch=require(_0x09fd('0x2'));var rp=require('request-promise');var moment=require(_0x09fd('0x3'));var BPromise=require(_0x09fd('0x4'));var Mustache=require(_0x09fd('0x5'));var util=require(_0x09fd('0x6'));var path=require(_0x09fd('0x7'));var sox=require(_0x09fd('0x8'));var csv=require(_0x09fd('0x9'));var ejs=require(_0x09fd('0xa'));var fs=require('fs');var _=require(_0x09fd('0xb'));var squel=require('squel');var crypto=require(_0x09fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x09fd('0xd'));var toCsv=require(_0x09fd('0x9'));var querystring=require(_0x09fd('0xe'));var Papa=require('papaparse');var Redis=require(_0x09fd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x09fd('0x10'));var as=require(_0x09fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09fd('0x12'))(_0x09fd('0x13'));var utils=require(_0x09fd('0x14'));var config=require(_0x09fd('0x15'));var db=require(_0x09fd('0x16'))['db'];function respondWithStatusCode(_0x5475fd,_0x24ff75){_0x24ff75=_0x24ff75||0xcc;return function(_0x2b05b7){if(_0x2b05b7){return _0x5475fd[_0x09fd('0x17')](_0x24ff75);}return _0x5475fd['status'](_0x24ff75)['end']();};}function respondWithResult(_0x49e92f,_0x23fe95){_0x23fe95=_0x23fe95||0xc8;return function(_0x48df22){if(_0x48df22){return _0x49e92f[_0x09fd('0x18')](_0x23fe95)[_0x09fd('0x19')](_0x48df22);}};}function respondWithFilteredResult(_0xd7fab0,_0x4deb50){return function(_0x548d79){if(_0x548d79){var _0x3b4fcc=_0x548d79[_0x09fd('0x1a')],_0x97a3c0=_0x4deb50['offset'],_0x534052=_0x4deb50[_0x09fd('0x1b')]+_0x4deb50[_0x09fd('0x1c')],_0x333ebe;if(_0x534052>=_0x3b4fcc){_0x534052=_0x3b4fcc;_0x333ebe=0xc8;}else{_0x333ebe=0xce;}_0xd7fab0[_0x09fd('0x18')](_0x333ebe);return _0xd7fab0[_0x09fd('0x1d')](_0x09fd('0x1e'),_0x97a3c0+'-'+_0x534052+'/'+_0x3b4fcc)[_0x09fd('0x19')](_0x548d79);}return null;};}function patchUpdates(_0x4e99c2){return function(_0x409d8f){try{jsonpatch['apply'](_0x409d8f,_0x4e99c2,!![]);}catch(_0x4d1a6f){return BPromise[_0x09fd('0x1f')](_0x4d1a6f);}return _0x409d8f[_0x09fd('0x20')]();};}function saveUpdates(_0xedc5c4,_0x2f87a2){return function(_0x373c69){if(_0x373c69){return _0x373c69[_0x09fd('0x21')](_0xedc5c4)[_0x09fd('0x22')](function(_0x789de6){return _0x789de6;});}return null;};}function removeEntity(_0x2b3519,_0x34de26){return function(_0x4cc06a){if(_0x4cc06a){return _0x4cc06a[_0x09fd('0x23')]()[_0x09fd('0x22')](function(){_0x2b3519[_0x09fd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f76ed,_0x8db80){return function(_0x41382f){if(!_0x41382f){_0x4f76ed[_0x09fd('0x17')](0x194);}return _0x41382f;};}function handleError(_0x1d56de,_0x2accd1){_0x2accd1=_0x2accd1||0x1f4;return function(_0x288c05){logger[_0x09fd('0x24')](_0x288c05[_0x09fd('0x25')]);if(_0x288c05['name']){delete _0x288c05[_0x09fd('0x26')];}_0x1d56de['status'](_0x2accd1)[_0x09fd('0x27')](_0x288c05);};}exports[_0x09fd('0x28')]=function(_0x337e1a,_0x309d39){var _0x47ed1d={},_0x1c486f={},_0x39a520={'count':0x0,'rows':[]};var _0x2b1178=_[_0x09fd('0x29')](db[_0x09fd('0x2a')][_0x09fd('0x2b')],function(_0x162e38){return{'name':_0x162e38[_0x09fd('0x2c')],'type':_0x162e38[_0x09fd('0x2d')][_0x09fd('0x2e')]};});_0x1c486f['model']=_['map'](_0x2b1178,_0x09fd('0x26'));_0x1c486f[_0x09fd('0x2f')]=_[_0x09fd('0x30')](_0x337e1a[_0x09fd('0x2f')]);_0x1c486f[_0x09fd('0x31')]=_[_0x09fd('0x32')](_0x1c486f[_0x09fd('0x33')],_0x1c486f[_0x09fd('0x2f')]);_0x47ed1d[_0x09fd('0x34')]=_[_0x09fd('0x32')](_0x1c486f[_0x09fd('0x33')],qs['fields'](_0x337e1a[_0x09fd('0x2f')][_0x09fd('0x35')]));_0x47ed1d[_0x09fd('0x34')]=_0x47ed1d[_0x09fd('0x34')][_0x09fd('0x36')]?_0x47ed1d[_0x09fd('0x34')]:_0x1c486f[_0x09fd('0x33')];if(!_0x337e1a[_0x09fd('0x2f')][_0x09fd('0x37')](_0x09fd('0x38'))){_0x47ed1d[_0x09fd('0x1c')]=qs[_0x09fd('0x1c')](_0x337e1a[_0x09fd('0x2f')][_0x09fd('0x1c')]);_0x47ed1d['offset']=qs[_0x09fd('0x1b')](_0x337e1a[_0x09fd('0x2f')][_0x09fd('0x1b')]);}_0x47ed1d[_0x09fd('0x39')]=qs[_0x09fd('0x3a')](_0x337e1a['query'][_0x09fd('0x3a')]);_0x47ed1d[_0x09fd('0x3b')]=qs['filters'](_[_0x09fd('0x3c')](_0x337e1a['query'],_0x1c486f[_0x09fd('0x31')]),_0x2b1178);if(_0x337e1a[_0x09fd('0x2f')][_0x09fd('0x3d')]){_0x47ed1d['where']=_[_0x09fd('0x3e')](_0x47ed1d[_0x09fd('0x3b')],{'$or':_['map'](_0x2b1178,function(_0x51f190){if(_0x51f190[_0x09fd('0x2d')]!==_0x09fd('0x3f')){var _0x467ba1={};_0x467ba1[_0x51f190[_0x09fd('0x26')]]={'$like':'%'+_0x337e1a['query'][_0x09fd('0x3d')]+'%'};return _0x467ba1;}})});}_0x47ed1d=_[_0x09fd('0x3e')]({},_0x47ed1d,_0x337e1a[_0x09fd('0x40')]);var _0x27d077={'where':_0x47ed1d[_0x09fd('0x3b')]};return db['SugarcrmField'][_0x09fd('0x1a')](_0x27d077)[_0x09fd('0x22')](function(_0x383f74){_0x39a520[_0x09fd('0x1a')]=_0x383f74;if(_0x337e1a[_0x09fd('0x2f')][_0x09fd('0x41')]){_0x47ed1d[_0x09fd('0x42')]=[{'all':!![]}];}return db[_0x09fd('0x2a')][_0x09fd('0x43')](_0x47ed1d);})[_0x09fd('0x22')](function(_0x5c8dcf){_0x39a520['rows']=_0x5c8dcf;return _0x39a520;})['then'](respondWithFilteredResult(_0x309d39,_0x47ed1d))[_0x09fd('0x44')](handleError(_0x309d39,null));};exports[_0x09fd('0x45')]=function(_0x349d10,_0x222cda){var _0x26f20c={'raw':!![],'where':{'id':_0x349d10[_0x09fd('0x46')]['id']}},_0x7088ed={};_0x7088ed['model']=_[_0x09fd('0x30')](db['SugarcrmField'][_0x09fd('0x2b')]);_0x7088ed[_0x09fd('0x2f')]=_[_0x09fd('0x30')](_0x349d10['query']);_0x7088ed['filters']=_[_0x09fd('0x32')](_0x7088ed[_0x09fd('0x33')],_0x7088ed[_0x09fd('0x2f')]);_0x26f20c['attributes']=_[_0x09fd('0x32')](_0x7088ed[_0x09fd('0x33')],qs[_0x09fd('0x35')](_0x349d10[_0x09fd('0x2f')][_0x09fd('0x35')]));_0x26f20c['attributes']=_0x26f20c[_0x09fd('0x34')][_0x09fd('0x36')]?_0x26f20c['attributes']:_0x7088ed[_0x09fd('0x33')];if(_0x349d10[_0x09fd('0x2f')]['includeAll']){_0x26f20c['include']=[{'all':!![]}];}_0x26f20c=_[_0x09fd('0x3e')]({},_0x26f20c,_0x349d10['options']);return db[_0x09fd('0x2a')]['find'](_0x26f20c)[_0x09fd('0x22')](handleEntityNotFound(_0x222cda,null))[_0x09fd('0x22')](respondWithResult(_0x222cda,null))[_0x09fd('0x44')](handleError(_0x222cda,null));};exports['create']=function(_0x3cf273,_0x391562){return db[_0x09fd('0x2a')][_0x09fd('0x47')](_0x3cf273['body'],{})[_0x09fd('0x22')](respondWithResult(_0x391562,0xc9))['catch'](handleError(_0x391562,null));};exports[_0x09fd('0x21')]=function(_0x487094,_0x56c3d4){if(_0x487094[_0x09fd('0x48')]['id']){delete _0x487094[_0x09fd('0x48')]['id'];}return db[_0x09fd('0x2a')][_0x09fd('0x49')]({'where':{'id':_0x487094[_0x09fd('0x46')]['id']}})[_0x09fd('0x22')](handleEntityNotFound(_0x56c3d4,null))[_0x09fd('0x22')](saveUpdates(_0x487094[_0x09fd('0x48')],null))[_0x09fd('0x22')](respondWithResult(_0x56c3d4,null))[_0x09fd('0x44')](handleError(_0x56c3d4,null));};exports['destroy']=function(_0x5d494e,_0x59cb5f){return db[_0x09fd('0x2a')]['find']({'where':{'id':_0x5d494e['params']['id']}})[_0x09fd('0x22')](handleEntityNotFound(_0x59cb5f,null))[_0x09fd('0x22')](removeEntity(_0x59cb5f,null))[_0x09fd('0x44')](handleError(_0x59cb5f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 760349b..10c01ea 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 _0x0fc5=['int_sugarcrm_fields','sugarcrm_unique_index','util','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField'];(function(_0x38edc7,_0x5d0576){var _0x3eb41e=function(_0x2c0917){while(--_0x2c0917){_0x38edc7['push'](_0x38edc7['shift']());}};_0x3eb41e(++_0x5d0576);}(_0x0fc5,0xac));var _0x50fc=function(_0x587381,_0x27f243){_0x587381=_0x587381-0x0;var _0x25cdd4=_0x0fc5[_0x587381];return _0x25cdd4;};'use strict';var _=require('lodash');var util=require(_0x50fc('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x50fc('0x1'));var rp=require(_0x50fc('0x2'));var fs=require('fs');var path=require(_0x50fc('0x3'));var rimraf=require('rimraf');var config=require(_0x50fc('0x4'));var attributes=require(_0x50fc('0x5'));module['exports']=function(_0x49d12a,_0x33d991){return _0x49d12a[_0x50fc('0x6')](_0x50fc('0x7'),attributes,{'tableName':_0x50fc('0x8'),'paranoid':![],'indexes':[{'name':_0x50fc('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7da3=['exports','define','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7da3,0x17f));var _0x37da=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x7da3[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x37da('0x0'));var util=require('util');var logger=require(_0x37da('0x1'))(_0x37da('0x2'));var moment=require(_0x37da('0x3'));var BPromise=require('bluebird');var rp=require(_0x37da('0x4'));var fs=require('fs');var path=require(_0x37da('0x5'));var rimraf=require(_0x37da('0x6'));var config=require(_0x37da('0x7'));var attributes=require(_0x37da('0x8'));module[_0x37da('0x9')]=function(_0x30716f,_0x5d093c){return _0x30716f[_0x37da('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x37da('0xb'),'fields':[_0x37da('0xc'),_0x37da('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 05ddfe8..b13fe42 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(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'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 _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8603,0x190));var _0x3860=function(_0x41598b,_0xb7a432){_0x41598b=_0x41598b-0x0;var _0x1a2849=_0x8603[_0x41598b];return _0x1a2849;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4bef6c2..3e3c586 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 _0xf968=['multer','util','connect-timeout','express','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x53c6b9,_0x5f25ee){var _0x3025c1=function(_0x535790){while(--_0x535790){_0x53c6b9['push'](_0x53c6b9['shift']());}};_0x3025c1(++_0x5f25ee);}(_0xf968,0xd2));var _0x8f96=function(_0x4c50b8,_0x33826c){_0x4c50b8=_0x4c50b8-0x0;var _0x592b18=_0xf968[_0x4c50b8];return _0x592b18;};'use strict';var multer=require(_0x8f96('0x0'));var util=require(_0x8f96('0x1'));var path=require('path');var timeout=require(_0x8f96('0x2'));var express=require(_0x8f96('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8f96('0x4'));router[_0x8f96('0x5')]('/',auth[_0x8f96('0x6')](),controller[_0x8f96('0x7')]);router[_0x8f96('0x5')]('/:id',auth[_0x8f96('0x6')](),controller[_0x8f96('0x8')]);router[_0x8f96('0x5')]('/:id/configurations',auth[_0x8f96('0x6')](),controller['getConfigurations']);router['get'](_0x8f96('0x9'),auth['isAuthenticated'](),controller[_0x8f96('0xa')]);router[_0x8f96('0xb')]('/',auth[_0x8f96('0x6')](),controller[_0x8f96('0xc')]);router[_0x8f96('0xb')](_0x8f96('0xd'),auth[_0x8f96('0x6')](),controller[_0x8f96('0xe')]);router[_0x8f96('0xf')](_0x8f96('0x10'),auth[_0x8f96('0x6')](),controller[_0x8f96('0x11')]);router[_0x8f96('0x12')](_0x8f96('0x10'),auth[_0x8f96('0x6')](),controller[_0x8f96('0x13')]);module[_0x8f96('0x14')]=router; \ No newline at end of file +var _0x3880=['../../components/interaction/service','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','Router','../../components/auth/service'];(function(_0x17760a,_0x134064){var _0x50b388=function(_0x53548e){while(--_0x53548e){_0x17760a['push'](_0x17760a['shift']());}};_0x50b388(++_0x134064);}(_0x3880,0x68));var _0x0388=function(_0x574d50,_0x201fd1){_0x574d50=_0x574d50-0x0;var _0xfd34e7=_0x3880[_0x574d50];return _0xfd34e7;};'use strict';var multer=require(_0x0388('0x0'));var util=require(_0x0388('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0388('0x2')]();var auth=require(_0x0388('0x3'));var interaction=require(_0x0388('0x4'));var config=require('../../config/environment');var controller=require(_0x0388('0x5'));router[_0x0388('0x6')]('/',auth['isAuthenticated'](),controller[_0x0388('0x7')]);router[_0x0388('0x6')](_0x0388('0x8'),auth[_0x0388('0x9')](),controller['show']);router[_0x0388('0x6')](_0x0388('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0388('0x6')](_0x0388('0xb'),auth[_0x0388('0x9')](),controller['getFields']);router[_0x0388('0xc')]('/',auth[_0x0388('0x9')](),controller[_0x0388('0xd')]);router[_0x0388('0xc')](_0x0388('0xa'),auth[_0x0388('0x9')](),controller[_0x0388('0xe')]);router[_0x0388('0xf')](_0x0388('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x0388('0x10')](_0x0388('0x8'),auth[_0x0388('0x9')](),controller['destroy']);module[_0x0388('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index fdb61cf..4da2cae 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 _0x0ad6=['sequelize','exports','STRING','HelpDesk'];(function(_0x1e6bd0,_0x472bce){var _0x137a58=function(_0x7c7c9a){while(--_0x7c7c9a){_0x1e6bd0['push'](_0x1e6bd0['shift']());}};_0x137a58(++_0x472bce);}(_0x0ad6,0xb0));var _0x60ad=function(_0x2ed211,_0x489e2a){_0x2ed211=_0x2ed211-0x0;var _0x3434ec=_0x0ad6[_0x2ed211];return _0x3434ec;};'use strict';var Sequelize=require(_0x60ad('0x0'));module[_0x60ad('0x1')]={'name':{'type':Sequelize[_0x60ad('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x60ad('0x2')]},'username':{'type':Sequelize[_0x60ad('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x60ad('0x2')],'allowNull':![],'defaultValue':_0x60ad('0x3')},'remoteUri':{'type':Sequelize[_0x60ad('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x60ad('0x2')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x107d=['STRING','HelpDesk','exports'];(function(_0xaab6e0,_0x515218){var _0x34d968=function(_0x44310f){while(--_0x44310f){_0xaab6e0['push'](_0xaab6e0['shift']());}};_0x34d968(++_0x515218);}(_0x107d,0xe3));var _0xd107=function(_0x1f6fd9,_0x477203){_0x1f6fd9=_0x1f6fd9-0x0;var _0x2ac12b=_0x107d[_0x1f6fd9];return _0x2ac12b;};'use strict';var Sequelize=require('sequelize');module[_0xd107('0x0')]={'name':{'type':Sequelize[_0xd107('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd107('0x1')],'allowNull':![],'defaultValue':_0xd107('0x2')},'remoteUri':{'type':Sequelize[_0xd107('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd107('0x1')]},'accessKey':{'type':Sequelize[_0xd107('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 f929c5d..2c432b3 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 _0x447a=['description','moduleName','remoteUri','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','POST','login','result','token','success','sessionName','autogenerated','reference','owner','remove','includes','false','label','startsWith','cf_','picklist','value','log','vTiger\x20error:\x20','statusCode','stringify','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','where','filter','VIRTUAL','merge','options','VtigerAccount','includeAll','include','findAll','rows','show','filters','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','order','sort','pick','nolimit','addConfiguration','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields'];(function(_0x1d76e1,_0x52625d){var _0x63840c=function(_0x29bc57){while(--_0x29bc57){_0x1d76e1['push'](_0x1d76e1['shift']());}};_0x63840c(++_0x52625d);}(_0x447a,0xaa));var _0xa447=function(_0xb22e94,_0xc843c6){_0xb22e94=_0xb22e94-0x0;var _0xcaada6=_0x447a[_0xb22e94];return _0xcaada6;};'use strict';var pdf=require(_0xa447('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa447('0x1'));var zipdir=require(_0xa447('0x2'));var jsonpatch=require(_0xa447('0x3'));var rp=require(_0xa447('0x4'));var moment=require(_0xa447('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa447('0x6'));var util=require(_0xa447('0x7'));var path=require(_0xa447('0x8'));var sox=require(_0xa447('0x9'));var csv=require(_0xa447('0xa'));var ejs=require(_0xa447('0xb'));var fs=require('fs');var _=require(_0xa447('0xc'));var squel=require(_0xa447('0xd'));var crypto=require(_0xa447('0xe'));var jsforce=require(_0xa447('0xf'));var deskjs=require(_0xa447('0x10'));var toCsv=require(_0xa447('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa447('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa447('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa447('0x13'))(_0xa447('0x14'));var utils=require(_0xa447('0x15'));var config=require(_0xa447('0x16'));var db=require(_0xa447('0x17'))['db'];var integrations=require(_0xa447('0x18'));var jayson=require(_0xa447('0x19'));var client=jayson[_0xa447('0x1a')][_0xa447('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x573c14,_0x433ff2,_0x3e603e){if(_0x3e603e){var _0xb1e3d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xb1e3d8[_0xa447('0x1c')](_0x433ff2)){return _0x573c14;}else{throw new db[(_0xa447('0x1d'))][(_0xa447('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x573c14;}}function respondWithRpcPromise(_0x2713cf,_0x48b8e1,_0x31b085,_0x1f931f){return new BPromise(function(_0x377c66,_0x49b845){var _0x6d29fa=_0x1f931f||client;return _0x6d29fa[_0xa447('0x1f')](_0x2713cf,_0x31b085)[_0xa447('0x20')](function(_0x1f62e9){logger[_0xa447('0x21')](_0xa447('0x22'),_0x48b8e1,_0xa447('0x23'));logger[_0xa447('0x24')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x48b8e1,_0xa447('0x23'),JSON['stringify'](_0x1f62e9));if(_0x1f62e9['error']){if(_0x1f62e9[_0xa447('0x25')][_0xa447('0x26')]===0x1f4){logger[_0xa447('0x25')](_0xa447('0x22'),_0x48b8e1,_0x1f62e9[_0xa447('0x25')][_0xa447('0x27')]);return _0x49b845(_0x1f62e9[_0xa447('0x25')]['message']);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x48b8e1,_0x1f62e9[_0xa447('0x25')][_0xa447('0x27')]);return _0x377c66(_0x1f62e9['error'][_0xa447('0x27')]);}else{logger[_0xa447('0x21')](_0xa447('0x22'),_0x48b8e1,'request\x20sent');_0x377c66(_0x1f62e9['result'][_0xa447('0x27')]);}})[_0xa447('0x28')](function(_0x597c1c){logger[_0xa447('0x25')](_0xa447('0x22'),_0x48b8e1,_0x597c1c);_0x49b845(_0x597c1c);});});}function respondWithStatusCode(_0x5dec77,_0x2ecd1f){_0x2ecd1f=_0x2ecd1f||0xcc;return function(_0x39aa91){if(_0x39aa91){return _0x5dec77['sendStatus'](_0x2ecd1f);}return _0x5dec77[_0xa447('0x29')](_0x2ecd1f)[_0xa447('0x2a')]();};}function respondWithResult(_0x2a598c,_0x3ac357){_0x3ac357=_0x3ac357||0xc8;return function(_0x810942){if(_0x810942){return _0x2a598c[_0xa447('0x29')](_0x3ac357)[_0xa447('0x2b')](_0x810942);}};}function respondWithFilteredResult(_0x38465b,_0x5ddaa2){return function(_0x384661){if(_0x384661){var _0x2b5b0f=_0x384661[_0xa447('0x2c')],_0x5daa18=_0x5ddaa2[_0xa447('0x2d')],_0x4a9c63=_0x5ddaa2[_0xa447('0x2d')]+_0x5ddaa2['limit'],_0x24ea47;if(_0x4a9c63>=_0x2b5b0f){_0x4a9c63=_0x2b5b0f;_0x24ea47=0xc8;}else{_0x24ea47=0xce;}_0x38465b[_0xa447('0x29')](_0x24ea47);return _0x38465b[_0xa447('0x2e')](_0xa447('0x2f'),_0x5daa18+'-'+_0x4a9c63+'/'+_0x2b5b0f)[_0xa447('0x2b')](_0x384661);}return null;};}function patchUpdates(_0x27999b){return function(_0x107ead){try{jsonpatch[_0xa447('0x30')](_0x107ead,_0x27999b,!![]);}catch(_0x5a1c00){return BPromise[_0xa447('0x31')](_0x5a1c00);}return _0x107ead[_0xa447('0x32')]();};}function saveUpdates(_0x2a4ae8,_0x17cf61){return function(_0x1b0d4f){if(_0x1b0d4f){return _0x1b0d4f[_0xa447('0x33')](_0x2a4ae8)[_0xa447('0x20')](function(_0x233631){return _0x233631;});}return null;};}function removeEntity(_0x36c215,_0x27f33d){return function(_0x14c0f1){if(_0x14c0f1){return _0x14c0f1[_0xa447('0x34')]()[_0xa447('0x20')](function(){_0x36c215['status'](0xcc)[_0xa447('0x2a')]();});}};}function handleEntityNotFound(_0xbdd335,_0x550d82){return function(_0x288f5e){if(!_0x288f5e){_0xbdd335[_0xa447('0x35')](0x194);}return _0x288f5e;};}function handleError(_0x584627,_0x339233){_0x339233=_0x339233||0x1f4;return function(_0x572d40){logger[_0xa447('0x25')](_0x572d40[_0xa447('0x36')]);if(_0x572d40[_0xa447('0x37')]){delete _0x572d40[_0xa447('0x37')];}_0x584627[_0xa447('0x29')](_0x339233)['send'](_0x572d40);};}exports[_0xa447('0x38')]=function(_0x5f3d34,_0x345392){var _0x3ff47b={},_0x4d9b4e={},_0xc16e87={'count':0x0,'rows':[]};var _0x301209=_[_0xa447('0x39')](db['VtigerAccount'][_0xa447('0x3a')],function(_0x32ae3f){return{'name':_0x32ae3f[_0xa447('0x3b')],'type':_0x32ae3f[_0xa447('0x3c')][_0xa447('0x3d')]};});_0x4d9b4e[_0xa447('0x3e')]=_['map'](_0x301209,_0xa447('0x37'));_0x4d9b4e[_0xa447('0x3f')]=_[_0xa447('0x40')](_0x5f3d34[_0xa447('0x3f')]);_0x4d9b4e['filters']=_['intersection'](_0x4d9b4e[_0xa447('0x3e')],_0x4d9b4e[_0xa447('0x3f')]);_0x3ff47b['attributes']=_[_0xa447('0x41')](_0x4d9b4e[_0xa447('0x3e')],qs['fields'](_0x5f3d34[_0xa447('0x3f')][_0xa447('0x42')]));_0x3ff47b[_0xa447('0x43')]=_0x3ff47b[_0xa447('0x43')][_0xa447('0x44')]?_0x3ff47b[_0xa447('0x43')]:_0x4d9b4e[_0xa447('0x3e')];if(!_0x5f3d34[_0xa447('0x3f')][_0xa447('0x45')]('nolimit')){_0x3ff47b[_0xa447('0x46')]=qs[_0xa447('0x46')](_0x5f3d34[_0xa447('0x3f')][_0xa447('0x46')]);_0x3ff47b['offset']=qs[_0xa447('0x2d')](_0x5f3d34[_0xa447('0x3f')]['offset']);}_0x3ff47b['order']=qs['sort'](_0x5f3d34[_0xa447('0x3f')]['sort']);_0x3ff47b[_0xa447('0x47')]=qs['filters'](_['pick'](_0x5f3d34['query'],_0x4d9b4e['filters']),_0x301209);if(_0x5f3d34['query'][_0xa447('0x48')]){_0x3ff47b[_0xa447('0x47')]=_['merge'](_0x3ff47b[_0xa447('0x47')],{'$or':_['map'](_0x301209,function(_0x4c0f28){if(_0x4c0f28['type']!==_0xa447('0x49')){var _0x2cc452={};_0x2cc452[_0x4c0f28[_0xa447('0x37')]]={'$like':'%'+_0x5f3d34[_0xa447('0x3f')]['filter']+'%'};return _0x2cc452;}})});}_0x3ff47b=_[_0xa447('0x4a')]({},_0x3ff47b,_0x5f3d34[_0xa447('0x4b')]);var _0x4facc4={'where':_0x3ff47b[_0xa447('0x47')]};return db[_0xa447('0x4c')]['count'](_0x4facc4)[_0xa447('0x20')](function(_0x3cc373){_0xc16e87[_0xa447('0x2c')]=_0x3cc373;if(_0x5f3d34[_0xa447('0x3f')][_0xa447('0x4d')]){_0x3ff47b[_0xa447('0x4e')]=[{'all':!![]}];}return db[_0xa447('0x4c')][_0xa447('0x4f')](_0x3ff47b);})['then'](function(_0x2c40b5){_0xc16e87[_0xa447('0x50')]=_0x2c40b5;return _0xc16e87;})[_0xa447('0x20')](respondWithFilteredResult(_0x345392,_0x3ff47b))[_0xa447('0x28')](handleError(_0x345392,null));};exports[_0xa447('0x51')]=function(_0x540217,_0x36ba16){var _0x1686dd={'raw':![],'where':{'id':_0x540217['params']['id']}},_0x50a23c={};_0x50a23c[_0xa447('0x3e')]=_[_0xa447('0x40')](db[_0xa447('0x4c')][_0xa447('0x3a')]);_0x50a23c[_0xa447('0x3f')]=_['keys'](_0x540217[_0xa447('0x3f')]);_0x50a23c[_0xa447('0x52')]=_['intersection'](_0x50a23c[_0xa447('0x3e')],_0x50a23c[_0xa447('0x3f')]);_0x1686dd[_0xa447('0x43')]=_[_0xa447('0x41')](_0x50a23c[_0xa447('0x3e')],qs[_0xa447('0x42')](_0x540217[_0xa447('0x3f')][_0xa447('0x42')]));_0x1686dd[_0xa447('0x43')]=_0x1686dd[_0xa447('0x43')][_0xa447('0x44')]?_0x1686dd['attributes']:_0x50a23c[_0xa447('0x3e')];if(_0x540217[_0xa447('0x3f')]['includeAll']){_0x1686dd[_0xa447('0x4e')]=[{'all':!![]}];}_0x1686dd=_['merge']({},_0x1686dd,_0x540217['options']);return db[_0xa447('0x4c')][_0xa447('0x53')](_0x1686dd)[_0xa447('0x20')](handleEntityNotFound(_0x36ba16,null))[_0xa447('0x20')](respondWithResult(_0x36ba16,null))[_0xa447('0x28')](handleError(_0x36ba16,null));};exports[_0xa447('0x54')]=function(_0x4a9ea9,_0x4ad739){return db[_0xa447('0x4c')]['create'](_0x4a9ea9[_0xa447('0x55')],{})[_0xa447('0x20')](respondWithResult(_0x4ad739,0xc9))[_0xa447('0x28')](handleError(_0x4ad739,null));};exports[_0xa447('0x33')]=function(_0x339d12,_0x1443c8){if(_0x339d12[_0xa447('0x55')]['id']){delete _0x339d12[_0xa447('0x55')]['id'];}return db[_0xa447('0x4c')][_0xa447('0x53')]({'where':{'id':_0x339d12[_0xa447('0x56')]['id']}})[_0xa447('0x20')](handleEntityNotFound(_0x1443c8,null))[_0xa447('0x20')](saveUpdates(_0x339d12[_0xa447('0x55')],null))[_0xa447('0x20')](respondWithResult(_0x1443c8,null))[_0xa447('0x28')](handleError(_0x1443c8,null));};exports[_0xa447('0x34')]=function(_0x515af0,_0x1294ea){return db[_0xa447('0x4c')][_0xa447('0x53')]({'where':{'id':_0x515af0[_0xa447('0x56')]['id']}})[_0xa447('0x20')](handleEntityNotFound(_0x1294ea,null))[_0xa447('0x20')](removeEntity(_0x1294ea,null))['catch'](handleError(_0x1294ea,null));};exports[_0xa447('0x57')]=function(_0x26d72e,_0x3c8a3f,_0x250ec1){var _0x3e6433={};var _0x560dc1={};var _0x20b99c;var _0x1ed165;return db[_0xa447('0x4c')][_0xa447('0x58')]({'where':{'id':_0x26d72e[_0xa447('0x56')]['id']}})['then'](handleEntityNotFound(_0x3c8a3f,null))[_0xa447('0x20')](function(_0x520836){if(_0x520836){_0x20b99c=_0x520836;_0x560dc1[_0xa447('0x3e')]=_[_0xa447('0x40')](db[_0xa447('0x59')][_0xa447('0x3a')]);_0x560dc1[_0xa447('0x3f')]=_[_0xa447('0x40')](_0x26d72e['query']);_0x560dc1['filters']=_[_0xa447('0x41')](_0x560dc1[_0xa447('0x3e')],_0x560dc1[_0xa447('0x3f')]);_0x3e6433['attributes']=_['intersection'](_0x560dc1[_0xa447('0x3e')],qs[_0xa447('0x42')](_0x26d72e[_0xa447('0x3f')]['fields']));_0x3e6433[_0xa447('0x43')]=_0x3e6433[_0xa447('0x43')]['length']?_0x3e6433[_0xa447('0x43')]:_0x560dc1[_0xa447('0x3e')];_0x3e6433[_0xa447('0x5a')]=qs[_0xa447('0x5b')](_0x26d72e['query'][_0xa447('0x5b')]);_0x3e6433[_0xa447('0x47')]=qs[_0xa447('0x52')](_[_0xa447('0x5c')](_0x26d72e[_0xa447('0x3f')],_0x560dc1[_0xa447('0x52')]));if(_0x26d72e[_0xa447('0x3f')][_0xa447('0x48')]){_0x3e6433['where']=_['merge'](_0x3e6433['where'],{'$or':_[_0xa447('0x39')](_0x3e6433[_0xa447('0x43')],function(_0xd3ef96){var _0x5ae9d0={};_0x5ae9d0[_0xd3ef96]={'$like':'%'+_0x26d72e[_0xa447('0x3f')]['filter']+'%'};return _0x5ae9d0;})});}_0x3e6433=_['merge']({},_0x3e6433,_0x26d72e[_0xa447('0x4b')]);return _0x20b99c['getConfigurations'](_0x3e6433);}})[_0xa447('0x20')](function(_0x4303dd){if(_0x4303dd){_0x1ed165=_0x4303dd[_0xa447('0x44')];if(!_0x26d72e[_0xa447('0x3f')][_0xa447('0x45')](_0xa447('0x5d'))){_0x3e6433[_0xa447('0x46')]=qs[_0xa447('0x46')](_0x26d72e[_0xa447('0x3f')][_0xa447('0x46')]);_0x3e6433['offset']=qs[_0xa447('0x2d')](_0x26d72e[_0xa447('0x3f')][_0xa447('0x2d')]);}return _0x20b99c['getConfigurations'](_0x3e6433);}})[_0xa447('0x20')](function(_0xf36e10){if(_0xf36e10){return _0xf36e10?{'count':_0x1ed165,'rows':_0xf36e10}:null;}})['then'](respondWithResult(_0x3c8a3f,null))[_0xa447('0x28')](handleError(_0x3c8a3f,null));};exports[_0xa447('0x5e')]=function(_0x4204f3,_0x5a68cd,_0x3617ee){if(_0x4204f3['body']['id']){delete _0x4204f3[_0xa447('0x55')]['id'];}return db[_0xa447('0x4c')][_0xa447('0x58')]({'where':{'id':_0x4204f3[_0xa447('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a68cd,null))[_0xa447('0x20')](function(_0x521caa){if(_0x521caa){_0x4204f3[_0xa447('0x55')]['AccountId']=_0x521caa['id'];_0x4204f3['body']['Subjects']=integrations['getSubjects'](_0x4204f3[_0xa447('0x55')][_0xa447('0x5f')],_0x4204f3['body'][_0xa447('0x3c')]);_0x4204f3['body'][_0xa447('0x60')]=integrations[_0xa447('0x61')](_0x4204f3['body'][_0xa447('0x5f')],_0x4204f3['body']['type']);return db['VtigerConfiguration'][_0xa447('0x54')](_0x4204f3[_0xa447('0x55')],{'include':[{'model':db[_0xa447('0x62')],'as':_0xa447('0x63')},{'model':db[_0xa447('0x62')],'as':_0xa447('0x60')}]});}return null;})['then'](respondWithResult(_0x5a68cd,null))[_0xa447('0x28')](handleError(_0x5a68cd,null));};var md5=require(_0xa447('0x64'));exports[_0xa447('0x65')]=function(_0x2ccc1e,_0x598c11,_0x49a4b9){var _0x259785=null;var _0x1357ea=null;var _0x5f000e=null;var _0x4ec34a=null;var _0x420bc9='';return db[_0xa447('0x4c')][_0xa447('0x58')]({'where':{'id':_0x2ccc1e[_0xa447('0x56')]['id']},'attributes':['id','name','username',_0xa447('0x66'),_0xa447('0x67'),_0xa447('0x68'),'serverUrl',_0xa447('0x69')]})['then'](handleEntityNotFound(_0x598c11,null))[_0xa447('0x20')](function(_0x4a9820){if(_0x4a9820){_0x259785=_0x4a9820[_0xa447('0x6a')];_0x1357ea=_0x4a9820[_0xa447('0x69')];_0x5f000e=_0x4a9820[_0xa447('0x67')];_0x420bc9=_0x4a9820['remoteUri'];var _0x12b851=_0x420bc9[_0xa447('0x6b')](-0x1);if(_0x12b851==='/'){_0x420bc9=_0x420bc9[_0xa447('0x6c')](0x0,_0x420bc9[_0xa447('0x6d')](_0x12b851));}_0x4ec34a=util[_0xa447('0x6e')](_0xa447('0x6f'),_0x420bc9);var _0x1b526a={'method':_0xa447('0x70'),'uri':_0x4ec34a,'qs':{'operation':'getchallenge','username':_0x4a9820[_0xa447('0x6a')]},'json':!![]};return rp(_0x1b526a);}})[_0xa447('0x20')](function(_0x5a1b84){if(_0x5a1b84['success']){var _0x464653={'method':_0xa447('0x71'),'uri':_0x4ec34a,'form':{'operation':_0xa447('0x72'),'username':_0x259785,'accessKey':md5(_0x5a1b84[_0xa447('0x73')][_0xa447('0x74')]+_0x1357ea)},'json':!![]};return rp(_0x464653);}})[_0xa447('0x20')](function(_0x103913){if(_0x103913[_0xa447('0x75')]){var _0x4bd131={'method':_0xa447('0x70'),'uri':_0x4ec34a,'qs':{'operation':'describe','username':_0x259785,'sessionName':_0x103913[_0xa447('0x73')][_0xa447('0x76')],'elementType':_0x5f000e},'json':!![]};return rp(_0x4bd131);}})[_0xa447('0x20')](function(_0x37bcec){if(_0x37bcec['success']){var _0x25bd38=[_0xa447('0x77'),_0xa447('0x78'),_0xa447('0x79')];_[_0xa447('0x7a')](_0x37bcec['result'][_0xa447('0x42')],function(_0x5a4c14){return _0x25bd38[_0xa447('0x7b')](_0x5a4c14[_0xa447('0x3c')][_0xa447('0x37')]);});_[_0xa447('0x7a')](_0x37bcec[_0xa447('0x73')][_0xa447('0x42')],function(_0x304496){return _0x304496['editable']===_0xa447('0x7c');});return{'count':_0x37bcec[_0xa447('0x73')][_0xa447('0x42')][_0xa447('0x44')],'rows':_['map'](_0x37bcec[_0xa447('0x73')][_0xa447('0x42')],function(_0x381396){return{'id':_0x381396[_0xa447('0x37')],'name':_0x381396[_0xa447('0x7d')],'custom':_[_0xa447('0x7e')](_0x381396[_0xa447('0x37')],_0xa447('0x7f'))?!![]:![],'options':_0x381396[_0xa447('0x3c')][_0xa447('0x37')]===_0xa447('0x80')&&_0x381396[_0xa447('0x3c')]['picklistValues'][_0xa447('0x44')]>0x0?_['map'](_0x381396[_0xa447('0x3c')]['picklistValues'],function(_0x4bc4e2){return{'name':_0x4bc4e2[_0xa447('0x7d')],'value':_0x4bc4e2[_0xa447('0x81')]};}):[]};})};}})[_0xa447('0x20')](respondWithResult(_0x598c11,null))[_0xa447('0x28')](function(_0x5d0687){console[_0xa447('0x82')](_0xa447('0x83')+_0x5d0687);var _0xff94c2=_0x2ccc1e[_0xa447('0x3f')][_0xa447('0x1c')]?0x1f4:_0x5d0687[_0xa447('0x84')]||0x1f4;logger[_0xa447('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xff94c2,JSON[_0xa447('0x85')](_0x5d0687));delete _0x5d0687['name'];if(_0xff94c2===0x191){_0xff94c2=0x190;}_0x598c11[_0xa447('0x29')](_0xff94c2)[_0xa447('0x86')](_0x2ccc1e[_0xa447('0x3f')][_0xa447('0x1c')]?{'message':_0xa447('0x87'),'statusCode':_0x5d0687[_0xa447('0x84')]}:_0x5d0687);});}; \ No newline at end of file +var _0xa6dd=['../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','json','count','limit','Content-Range','apply','reject','save','destroy','sendStatus','name','index','VtigerAccount','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','offset','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','create','update','find','getConfigurations','findOne','rawAttributes','order','nolimit','addConfiguration','body','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','getchallenge','success','login','result','GET','describe','sessionName','autogenerated','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xa6dd,0x68));var _0xda6d=function(_0x1ce4d1,_0xea0bcb){_0x1ce4d1=_0x1ce4d1-0x0;var _0x1b270e=_0xa6dd[_0x1ce4d1];return _0x1b270e;};'use strict';var pdf=require(_0xda6d('0x0'));var emlformat=require(_0xda6d('0x1'));var rimraf=require(_0xda6d('0x2'));var zipdir=require(_0xda6d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xda6d('0x4'));var util=require('util');var path=require(_0xda6d('0x5'));var sox=require(_0xda6d('0x6'));var csv=require(_0xda6d('0x7'));var ejs=require(_0xda6d('0x8'));var fs=require('fs');var _=require(_0xda6d('0x9'));var squel=require(_0xda6d('0xa'));var crypto=require(_0xda6d('0xb'));var jsforce=require(_0xda6d('0xc'));var deskjs=require(_0xda6d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xda6d('0xe'));var Papa=require(_0xda6d('0xf'));var Redis=require(_0xda6d('0x10'));var authService=require(_0xda6d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xda6d('0x12'));var hardwareService=require(_0xda6d('0x13'));var logger=require(_0xda6d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xda6d('0x15'));var db=require(_0xda6d('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xda6d('0x17'));var client=jayson[_0xda6d('0x18')][_0xda6d('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2305d2,_0x4a1043,_0x241e40){if(_0x241e40){var _0x528aac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x528aac[_0xda6d('0x1a')](_0x4a1043)){return _0x2305d2;}else{throw new db[(_0xda6d('0x1b'))]['ValidationError'](_0xda6d('0x1c'));}}else{return _0x2305d2;}}function respondWithRpcPromise(_0x2d81af,_0x22ee0c,_0x456c81,_0x2188a2){return new BPromise(function(_0x51ce13,_0xd9214){var _0x86296c=_0x2188a2||client;return _0x86296c['request'](_0x2d81af,_0x456c81)[_0xda6d('0x1d')](function(_0x645a0f){logger['info'](_0xda6d('0x1e'),_0x22ee0c,_0xda6d('0x1f'));logger[_0xda6d('0x20')](_0xda6d('0x21'),_0x22ee0c,_0xda6d('0x1f'),JSON['stringify'](_0x645a0f));if(_0x645a0f[_0xda6d('0x22')]){if(_0x645a0f[_0xda6d('0x22')]['code']===0x1f4){logger[_0xda6d('0x22')](_0xda6d('0x1e'),_0x22ee0c,_0x645a0f[_0xda6d('0x22')][_0xda6d('0x23')]);return _0xd9214(_0x645a0f[_0xda6d('0x22')][_0xda6d('0x23')]);}logger[_0xda6d('0x22')](_0xda6d('0x1e'),_0x22ee0c,_0x645a0f[_0xda6d('0x22')][_0xda6d('0x23')]);return _0x51ce13(_0x645a0f['error'][_0xda6d('0x23')]);}else{logger['info'](_0xda6d('0x1e'),_0x22ee0c,_0xda6d('0x1f'));_0x51ce13(_0x645a0f['result'][_0xda6d('0x23')]);}})[_0xda6d('0x24')](function(_0x381eee){logger[_0xda6d('0x22')](_0xda6d('0x1e'),_0x22ee0c,_0x381eee);_0xd9214(_0x381eee);});});}function respondWithStatusCode(_0x1e7987,_0x4cd146){_0x4cd146=_0x4cd146||0xcc;return function(_0x1a6ae0){if(_0x1a6ae0){return _0x1e7987['sendStatus'](_0x4cd146);}return _0x1e7987[_0xda6d('0x25')](_0x4cd146)[_0xda6d('0x26')]();};}function respondWithResult(_0x31d2eb,_0x598d7f){_0x598d7f=_0x598d7f||0xc8;return function(_0x160988){if(_0x160988){return _0x31d2eb[_0xda6d('0x25')](_0x598d7f)[_0xda6d('0x27')](_0x160988);}};}function respondWithFilteredResult(_0x3043aa,_0x47f835){return function(_0x700865){if(_0x700865){var _0x44bdd2=_0x700865[_0xda6d('0x28')],_0x216d00=_0x47f835['offset'],_0x54c60a=_0x47f835['offset']+_0x47f835[_0xda6d('0x29')],_0x1f8602;if(_0x54c60a>=_0x44bdd2){_0x54c60a=_0x44bdd2;_0x1f8602=0xc8;}else{_0x1f8602=0xce;}_0x3043aa['status'](_0x1f8602);return _0x3043aa['set'](_0xda6d('0x2a'),_0x216d00+'-'+_0x54c60a+'/'+_0x44bdd2)['json'](_0x700865);}return null;};}function patchUpdates(_0x4e9513){return function(_0x44f3e0){try{jsonpatch[_0xda6d('0x2b')](_0x44f3e0,_0x4e9513,!![]);}catch(_0x16a3f5){return BPromise[_0xda6d('0x2c')](_0x16a3f5);}return _0x44f3e0[_0xda6d('0x2d')]();};}function saveUpdates(_0x55a4b0,_0x149dfd){return function(_0x4dfa2e){if(_0x4dfa2e){return _0x4dfa2e['update'](_0x55a4b0)[_0xda6d('0x1d')](function(_0x460235){return _0x460235;});}return null;};}function removeEntity(_0xb4600c,_0x2f7efc){return function(_0x292109){if(_0x292109){return _0x292109[_0xda6d('0x2e')]()[_0xda6d('0x1d')](function(){_0xb4600c[_0xda6d('0x25')](0xcc)[_0xda6d('0x26')]();});}};}function handleEntityNotFound(_0x5ad99d,_0x207302){return function(_0x554032){if(!_0x554032){_0x5ad99d[_0xda6d('0x2f')](0x194);}return _0x554032;};}function handleError(_0x37a617,_0x4d3fff){_0x4d3fff=_0x4d3fff||0x1f4;return function(_0x45c1b7){logger[_0xda6d('0x22')](_0x45c1b7['stack']);if(_0x45c1b7['name']){delete _0x45c1b7[_0xda6d('0x30')];}_0x37a617[_0xda6d('0x25')](_0x4d3fff)['send'](_0x45c1b7);};}exports[_0xda6d('0x31')]=function(_0x2ce2d6,_0x5bd858){var _0x42cfa8={},_0x297ee3={},_0x4cf987={'count':0x0,'rows':[]};var _0x14e33a=_['map'](db[_0xda6d('0x32')]['rawAttributes'],function(_0x111a68){return{'name':_0x111a68['fieldName'],'type':_0x111a68[_0xda6d('0x33')]['key']};});_0x297ee3[_0xda6d('0x34')]=_['map'](_0x14e33a,_0xda6d('0x30'));_0x297ee3[_0xda6d('0x35')]=_['keys'](_0x2ce2d6[_0xda6d('0x35')]);_0x297ee3[_0xda6d('0x36')]=_[_0xda6d('0x37')](_0x297ee3[_0xda6d('0x34')],_0x297ee3[_0xda6d('0x35')]);_0x42cfa8[_0xda6d('0x38')]=_['intersection'](_0x297ee3['model'],qs[_0xda6d('0x39')](_0x2ce2d6['query'][_0xda6d('0x39')]));_0x42cfa8[_0xda6d('0x38')]=_0x42cfa8[_0xda6d('0x38')]['length']?_0x42cfa8[_0xda6d('0x38')]:_0x297ee3[_0xda6d('0x34')];if(!_0x2ce2d6[_0xda6d('0x35')][_0xda6d('0x3a')]('nolimit')){_0x42cfa8[_0xda6d('0x29')]=qs[_0xda6d('0x29')](_0x2ce2d6[_0xda6d('0x35')][_0xda6d('0x29')]);_0x42cfa8[_0xda6d('0x3b')]=qs[_0xda6d('0x3b')](_0x2ce2d6[_0xda6d('0x35')][_0xda6d('0x3b')]);}_0x42cfa8['order']=qs[_0xda6d('0x3c')](_0x2ce2d6['query'][_0xda6d('0x3c')]);_0x42cfa8[_0xda6d('0x3d')]=qs['filters'](_[_0xda6d('0x3e')](_0x2ce2d6['query'],_0x297ee3[_0xda6d('0x36')]),_0x14e33a);if(_0x2ce2d6['query'][_0xda6d('0x3f')]){_0x42cfa8[_0xda6d('0x3d')]=_[_0xda6d('0x40')](_0x42cfa8[_0xda6d('0x3d')],{'$or':_[_0xda6d('0x41')](_0x14e33a,function(_0x3c4ba9){if(_0x3c4ba9[_0xda6d('0x33')]!==_0xda6d('0x42')){var _0x15ade6={};_0x15ade6[_0x3c4ba9[_0xda6d('0x30')]]={'$like':'%'+_0x2ce2d6[_0xda6d('0x35')][_0xda6d('0x3f')]+'%'};return _0x15ade6;}})});}_0x42cfa8=_[_0xda6d('0x40')]({},_0x42cfa8,_0x2ce2d6[_0xda6d('0x43')]);var _0x51be75={'where':_0x42cfa8[_0xda6d('0x3d')]};return db[_0xda6d('0x32')][_0xda6d('0x28')](_0x51be75)[_0xda6d('0x1d')](function(_0xc05459){_0x4cf987[_0xda6d('0x28')]=_0xc05459;if(_0x2ce2d6[_0xda6d('0x35')][_0xda6d('0x44')]){_0x42cfa8[_0xda6d('0x45')]=[{'all':!![]}];}return db[_0xda6d('0x32')][_0xda6d('0x46')](_0x42cfa8);})[_0xda6d('0x1d')](function(_0xae50fb){_0x4cf987[_0xda6d('0x47')]=_0xae50fb;return _0x4cf987;})[_0xda6d('0x1d')](respondWithFilteredResult(_0x5bd858,_0x42cfa8))[_0xda6d('0x24')](handleError(_0x5bd858,null));};exports[_0xda6d('0x48')]=function(_0x5bce8c,_0x2ba42b){var _0x135532={'raw':![],'where':{'id':_0x5bce8c[_0xda6d('0x49')]['id']}},_0x3eb910={};_0x3eb910[_0xda6d('0x34')]=_[_0xda6d('0x4a')](db[_0xda6d('0x32')]['rawAttributes']);_0x3eb910[_0xda6d('0x35')]=_['keys'](_0x5bce8c[_0xda6d('0x35')]);_0x3eb910[_0xda6d('0x36')]=_[_0xda6d('0x37')](_0x3eb910[_0xda6d('0x34')],_0x3eb910[_0xda6d('0x35')]);_0x135532[_0xda6d('0x38')]=_[_0xda6d('0x37')](_0x3eb910[_0xda6d('0x34')],qs[_0xda6d('0x39')](_0x5bce8c[_0xda6d('0x35')][_0xda6d('0x39')]));_0x135532[_0xda6d('0x38')]=_0x135532[_0xda6d('0x38')][_0xda6d('0x4b')]?_0x135532[_0xda6d('0x38')]:_0x3eb910[_0xda6d('0x34')];if(_0x5bce8c[_0xda6d('0x35')][_0xda6d('0x44')]){_0x135532[_0xda6d('0x45')]=[{'all':!![]}];}_0x135532=_[_0xda6d('0x40')]({},_0x135532,_0x5bce8c['options']);return db[_0xda6d('0x32')]['find'](_0x135532)[_0xda6d('0x1d')](handleEntityNotFound(_0x2ba42b,null))[_0xda6d('0x1d')](respondWithResult(_0x2ba42b,null))[_0xda6d('0x24')](handleError(_0x2ba42b,null));};exports[_0xda6d('0x4c')]=function(_0x1a23cb,_0x5660b9){return db['VtigerAccount'][_0xda6d('0x4c')](_0x1a23cb['body'],{})[_0xda6d('0x1d')](respondWithResult(_0x5660b9,0xc9))[_0xda6d('0x24')](handleError(_0x5660b9,null));};exports[_0xda6d('0x4d')]=function(_0x2d852b,_0x4237bd){if(_0x2d852b['body']['id']){delete _0x2d852b['body']['id'];}return db[_0xda6d('0x32')][_0xda6d('0x4e')]({'where':{'id':_0x2d852b[_0xda6d('0x49')]['id']}})[_0xda6d('0x1d')](handleEntityNotFound(_0x4237bd,null))[_0xda6d('0x1d')](saveUpdates(_0x2d852b['body'],null))['then'](respondWithResult(_0x4237bd,null))['catch'](handleError(_0x4237bd,null));};exports[_0xda6d('0x2e')]=function(_0x2b2faf,_0x122ce0){return db['VtigerAccount']['find']({'where':{'id':_0x2b2faf[_0xda6d('0x49')]['id']}})['then'](handleEntityNotFound(_0x122ce0,null))[_0xda6d('0x1d')](removeEntity(_0x122ce0,null))[_0xda6d('0x24')](handleError(_0x122ce0,null));};exports[_0xda6d('0x4f')]=function(_0x223feb,_0x1a8819,_0xc632af){var _0x3b3969={};var _0x30fb5={};var _0x4c1e67;var _0x536ad7;return db['VtigerAccount'][_0xda6d('0x50')]({'where':{'id':_0x223feb[_0xda6d('0x49')]['id']}})[_0xda6d('0x1d')](handleEntityNotFound(_0x1a8819,null))[_0xda6d('0x1d')](function(_0x4a997c){if(_0x4a997c){_0x4c1e67=_0x4a997c;_0x30fb5['model']=_['keys'](db['VtigerConfiguration'][_0xda6d('0x51')]);_0x30fb5['query']=_[_0xda6d('0x4a')](_0x223feb[_0xda6d('0x35')]);_0x30fb5['filters']=_['intersection'](_0x30fb5[_0xda6d('0x34')],_0x30fb5[_0xda6d('0x35')]);_0x3b3969['attributes']=_[_0xda6d('0x37')](_0x30fb5[_0xda6d('0x34')],qs[_0xda6d('0x39')](_0x223feb[_0xda6d('0x35')]['fields']));_0x3b3969[_0xda6d('0x38')]=_0x3b3969[_0xda6d('0x38')]['length']?_0x3b3969[_0xda6d('0x38')]:_0x30fb5[_0xda6d('0x34')];_0x3b3969[_0xda6d('0x52')]=qs[_0xda6d('0x3c')](_0x223feb[_0xda6d('0x35')][_0xda6d('0x3c')]);_0x3b3969[_0xda6d('0x3d')]=qs[_0xda6d('0x36')](_['pick'](_0x223feb['query'],_0x30fb5[_0xda6d('0x36')]));if(_0x223feb[_0xda6d('0x35')][_0xda6d('0x3f')]){_0x3b3969[_0xda6d('0x3d')]=_[_0xda6d('0x40')](_0x3b3969[_0xda6d('0x3d')],{'$or':_['map'](_0x3b3969[_0xda6d('0x38')],function(_0x17353d){var _0x139dc8={};_0x139dc8[_0x17353d]={'$like':'%'+_0x223feb[_0xda6d('0x35')]['filter']+'%'};return _0x139dc8;})});}_0x3b3969=_[_0xda6d('0x40')]({},_0x3b3969,_0x223feb['options']);return _0x4c1e67[_0xda6d('0x4f')](_0x3b3969);}})[_0xda6d('0x1d')](function(_0x1c0423){if(_0x1c0423){_0x536ad7=_0x1c0423[_0xda6d('0x4b')];if(!_0x223feb['query']['hasOwnProperty'](_0xda6d('0x53'))){_0x3b3969[_0xda6d('0x29')]=qs[_0xda6d('0x29')](_0x223feb['query'][_0xda6d('0x29')]);_0x3b3969[_0xda6d('0x3b')]=qs[_0xda6d('0x3b')](_0x223feb[_0xda6d('0x35')][_0xda6d('0x3b')]);}return _0x4c1e67['getConfigurations'](_0x3b3969);}})['then'](function(_0x59db5c){if(_0x59db5c){return _0x59db5c?{'count':_0x536ad7,'rows':_0x59db5c}:null;}})[_0xda6d('0x1d')](respondWithResult(_0x1a8819,null))[_0xda6d('0x24')](handleError(_0x1a8819,null));};exports[_0xda6d('0x54')]=function(_0x185da6,_0x260240,_0x1008df){if(_0x185da6[_0xda6d('0x55')]['id']){delete _0x185da6[_0xda6d('0x55')]['id'];}return db[_0xda6d('0x32')][_0xda6d('0x50')]({'where':{'id':_0x185da6[_0xda6d('0x49')]['id']}})[_0xda6d('0x1d')](handleEntityNotFound(_0x260240,null))[_0xda6d('0x1d')](function(_0x58b374){if(_0x58b374){_0x185da6[_0xda6d('0x55')]['AccountId']=_0x58b374['id'];_0x185da6[_0xda6d('0x55')][_0xda6d('0x56')]=integrations[_0xda6d('0x57')](_0x185da6['body'][_0xda6d('0x58')],_0x185da6[_0xda6d('0x55')][_0xda6d('0x33')]);_0x185da6[_0xda6d('0x55')]['Descriptions']=integrations[_0xda6d('0x59')](_0x185da6[_0xda6d('0x55')]['channel'],_0x185da6[_0xda6d('0x55')][_0xda6d('0x33')]);return db[_0xda6d('0x5a')][_0xda6d('0x4c')](_0x185da6[_0xda6d('0x55')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xda6d('0x5b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x260240,null))['catch'](handleError(_0x260240,null));};var md5=require('md5');exports[_0xda6d('0x5c')]=function(_0x438a9f,_0x3be81d,_0x22673f){var _0x91ca52=null;var _0x492a39=null;var _0x287474=null;var _0x4a3193=null;var _0x51b44a='';return db[_0xda6d('0x32')][_0xda6d('0x50')]({'where':{'id':_0x438a9f[_0xda6d('0x49')]['id']},'attributes':['id','name','username',_0xda6d('0x5d'),_0xda6d('0x5e'),_0xda6d('0x5f'),_0xda6d('0x60'),_0xda6d('0x61')]})[_0xda6d('0x1d')](handleEntityNotFound(_0x3be81d,null))[_0xda6d('0x1d')](function(_0x3d53b8){if(_0x3d53b8){_0x91ca52=_0x3d53b8[_0xda6d('0x62')];_0x492a39=_0x3d53b8[_0xda6d('0x61')];_0x287474=_0x3d53b8[_0xda6d('0x5e')];_0x51b44a=_0x3d53b8[_0xda6d('0x5f')];var _0x428a7b=_0x51b44a[_0xda6d('0x63')](-0x1);if(_0x428a7b==='/'){_0x51b44a=_0x51b44a[_0xda6d('0x64')](0x0,_0x51b44a[_0xda6d('0x65')](_0x428a7b));}_0x4a3193=util['format']('%s/webservice.php',_0x51b44a);var _0x20115c={'method':'GET','uri':_0x4a3193,'qs':{'operation':_0xda6d('0x66'),'username':_0x3d53b8['username']},'json':!![]};return rp(_0x20115c);}})[_0xda6d('0x1d')](function(_0x50ba61){if(_0x50ba61[_0xda6d('0x67')]){var _0x423ea5={'method':'POST','uri':_0x4a3193,'form':{'operation':_0xda6d('0x68'),'username':_0x91ca52,'accessKey':md5(_0x50ba61[_0xda6d('0x69')]['token']+_0x492a39)},'json':!![]};return rp(_0x423ea5);}})[_0xda6d('0x1d')](function(_0x3b0b99){if(_0x3b0b99['success']){var _0x992d08={'method':_0xda6d('0x6a'),'uri':_0x4a3193,'qs':{'operation':_0xda6d('0x6b'),'username':_0x91ca52,'sessionName':_0x3b0b99[_0xda6d('0x69')][_0xda6d('0x6c')],'elementType':_0x287474},'json':!![]};return rp(_0x992d08);}})[_0xda6d('0x1d')](function(_0x4ceeca){if(_0x4ceeca['success']){var _0xe1f057=[_0xda6d('0x6d'),'reference',_0xda6d('0x6e')];_[_0xda6d('0x6f')](_0x4ceeca[_0xda6d('0x69')]['fields'],function(_0x546ec8){return _0xe1f057[_0xda6d('0x70')](_0x546ec8[_0xda6d('0x33')][_0xda6d('0x30')]);});_[_0xda6d('0x6f')](_0x4ceeca[_0xda6d('0x69')][_0xda6d('0x39')],function(_0x4577d0){return _0x4577d0[_0xda6d('0x71')]==='false';});return{'count':_0x4ceeca['result'][_0xda6d('0x39')][_0xda6d('0x4b')],'rows':_[_0xda6d('0x41')](_0x4ceeca[_0xda6d('0x69')][_0xda6d('0x39')],function(_0x494d1c){return{'id':_0x494d1c[_0xda6d('0x30')],'name':_0x494d1c[_0xda6d('0x72')],'custom':_[_0xda6d('0x73')](_0x494d1c['name'],_0xda6d('0x74'))?!![]:![],'options':_0x494d1c[_0xda6d('0x33')]['name']===_0xda6d('0x75')&&_0x494d1c[_0xda6d('0x33')][_0xda6d('0x76')][_0xda6d('0x4b')]>0x0?_[_0xda6d('0x41')](_0x494d1c['type'][_0xda6d('0x76')],function(_0x2e3595){return{'name':_0x2e3595[_0xda6d('0x72')],'value':_0x2e3595['value']};}):[]};})};}})[_0xda6d('0x1d')](respondWithResult(_0x3be81d,null))[_0xda6d('0x24')](function(_0x3c90b7){console[_0xda6d('0x77')](_0xda6d('0x78')+_0x3c90b7);var _0x4e200f=_0x438a9f[_0xda6d('0x35')][_0xda6d('0x1a')]?0x1f4:_0x3c90b7[_0xda6d('0x79')]||0x1f4;logger['error'](_0xda6d('0x7a'),'getFields',_0x4e200f,JSON[_0xda6d('0x7b')](_0x3c90b7));delete _0x3c90b7[_0xda6d('0x30')];if(_0x4e200f===0x191){_0x4e200f=0x190;}_0x3be81d[_0xda6d('0x25')](_0x4e200f)[_0xda6d('0x7c')](_0x438a9f['query']['test']?{'message':_0xda6d('0x7d'),'statusCode':_0x3c90b7[_0xda6d('0x79')]}:_0x3c90b7);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f772d3e..a294c14 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 _0x5d59=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','../../config/logger','api'];(function(_0x348664,_0x4d6c23){var _0x1df7a5=function(_0x276c0d){while(--_0x276c0d){_0x348664['push'](_0x348664['shift']());}};_0x1df7a5(++_0x4d6c23);}(_0x5d59,0x99));var _0x95d5=function(_0x338990,_0x4755d9){_0x338990=_0x338990-0x0;var _0x14f156=_0x5d59[_0x338990];return _0x14f156;};'use strict';var _=require(_0x95d5('0x0'));var util=require('util');var logger=require(_0x95d5('0x1'))(_0x95d5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95d5('0x3'));var fs=require('fs');var path=require(_0x95d5('0x4'));var rimraf=require(_0x95d5('0x5'));var config=require(_0x95d5('0x6'));var attributes=require(_0x95d5('0x7'));var integrations=require(_0x95d5('0x8'));module[_0x95d5('0x9')]=function(_0xf391e3,_0x1e3f64){return _0xf391e3[_0x95d5('0xa')](_0x95d5('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10de=['../../config/environment','../../components/integrations/configuration','define','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x26d89a,_0x3ee8e1){var _0xa5ca57=function(_0x156300){while(--_0x156300){_0x26d89a['push'](_0x26d89a['shift']());}};_0xa5ca57(++_0x3ee8e1);}(_0x10de,0x185));var _0xe10d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x10de[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xe10d('0x0'));var logger=require(_0xe10d('0x1'))(_0xe10d('0x2'));var moment=require(_0xe10d('0x3'));var BPromise=require(_0xe10d('0x4'));var rp=require(_0xe10d('0x5'));var fs=require('fs');var path=require(_0xe10d('0x6'));var rimraf=require('rimraf');var config=require(_0xe10d('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xe10d('0x8'));module['exports']=function(_0x1f75fa,_0x12342e){return _0x1f75fa[_0xe10d('0x9')]('VtigerAccount',attributes,{'tableName':_0xe10d('0xa'),'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 dc8520c..3bf2e26 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 _0x8a3e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','map','include','model','info','GetVtigerAccount','ShowVtigerAccount','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a67b4,_0x3baecc){var _0x2b4e0d=function(_0x534d8a){while(--_0x534d8a){_0x4a67b4['push'](_0x4a67b4['shift']());}};_0x2b4e0d(++_0x3baecc);}(_0x8a3e,0x186));var _0xe8a3=function(_0x33c6f4,_0xca5f5a){_0x33c6f4=_0x33c6f4-0x0;var _0x482a14=_0x8a3e[_0x33c6f4];return _0x482a14;};'use strict';var _=require(_0xe8a3('0x0'));var util=require(_0xe8a3('0x1'));var moment=require('moment');var BPromise=require(_0xe8a3('0x2'));var rs=require(_0xe8a3('0x3'));var fs=require('fs');var Redis=require(_0xe8a3('0x4'));var db=require(_0xe8a3('0x5'))['db'];var utils=require(_0xe8a3('0x6'));var logger=require(_0xe8a3('0x7'))(_0xe8a3('0x8'));var config=require(_0xe8a3('0x9'));var jayson=require(_0xe8a3('0xa'));var client=jayson[_0xe8a3('0xb')][_0xe8a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36ad00,_0x1f30e0,_0xb5c349){return new BPromise(function(_0x35d2a9,_0x25c216){return client[_0xe8a3('0xd')](_0x36ad00,_0xb5c349)[_0xe8a3('0xe')](function(_0x4a0285){logger['info'](_0xe8a3('0xf'),_0x1f30e0,_0xe8a3('0x10'));logger[_0xe8a3('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1f30e0,_0xe8a3('0x10'),JSON['stringify'](_0x4a0285));if(_0x4a0285[_0xe8a3('0x12')]){if(_0x4a0285[_0xe8a3('0x12')][_0xe8a3('0x13')]===0x1f4){logger[_0xe8a3('0x12')](_0xe8a3('0xf'),_0x1f30e0,_0x4a0285[_0xe8a3('0x12')][_0xe8a3('0x14')]);return _0x25c216(_0x4a0285[_0xe8a3('0x12')][_0xe8a3('0x14')]);}logger['error'](_0xe8a3('0xf'),_0x1f30e0,_0x4a0285['error'][_0xe8a3('0x14')]);return _0x35d2a9(_0x4a0285[_0xe8a3('0x12')][_0xe8a3('0x14')]);}else{logger['info'](_0xe8a3('0xf'),_0x1f30e0,_0xe8a3('0x10'));_0x35d2a9(_0x4a0285[_0xe8a3('0x15')]['message']);}})[_0xe8a3('0x16')](function(_0x1e7024){logger[_0xe8a3('0x12')](_0xe8a3('0xf'),_0x1f30e0,_0x1e7024);_0x25c216(_0x1e7024);});});}exports['GetVtigerAccount']=function(_0x427277){var _0x469c97=this;return new Promise(function(_0x218cf2,_0x214681){return db[_0xe8a3('0x17')][_0xe8a3('0x18')]({'raw':_0x427277[_0xe8a3('0x19')]?_0x427277[_0xe8a3('0x19')][_0xe8a3('0x1a')]===undefined?!![]:![]:!![],'where':_0x427277[_0xe8a3('0x19')]?_0x427277[_0xe8a3('0x19')][_0xe8a3('0x1b')]||null:null,'attributes':_0x427277['options']?_0x427277[_0xe8a3('0x19')][_0xe8a3('0x1c')]||null:null,'limit':_0x427277[_0xe8a3('0x19')]?_0x427277['options']['limit']||null:null,'include':_0x427277[_0xe8a3('0x19')]?_0x427277['options']['include']?_[_0xe8a3('0x1d')](_0x427277[_0xe8a3('0x19')][_0xe8a3('0x1e')],function(_0xc2e67b){return{'model':db[_0xc2e67b[_0xe8a3('0x1f')]],'as':_0xc2e67b['as'],'attributes':_0xc2e67b[_0xe8a3('0x1c')],'include':_0xc2e67b[_0xe8a3('0x1e')]?_[_0xe8a3('0x1d')](_0xc2e67b['include'],function(_0x5ee97a){return{'model':db[_0x5ee97a[_0xe8a3('0x1f')]],'as':_0x5ee97a['as'],'attributes':_0x5ee97a['attributes'],'include':_0x5ee97a[_0xe8a3('0x1e')]?_[_0xe8a3('0x1d')](_0x5ee97a['include'],function(_0x599bd6){return{'model':db[_0x599bd6[_0xe8a3('0x1f')]],'as':_0x599bd6['as'],'attributes':_0x599bd6[_0xe8a3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe8a3('0xe')](function(_0x46b668){logger[_0xe8a3('0x20')](_0xe8a3('0x21'),_0x427277);logger[_0xe8a3('0x11')](_0xe8a3('0x21'),_0x427277,JSON['stringify'](_0x46b668));_0x218cf2(_0x46b668);})[_0xe8a3('0x16')](function(_0x1436d8){logger['error']('GetVtigerAccount',_0x1436d8[_0xe8a3('0x14')],_0x427277);_0x214681(_0x469c97['error'](0x1f4,_0x1436d8[_0xe8a3('0x14')]));});});};exports[_0xe8a3('0x22')]=function(_0x5e48af){var _0x5acf7c=this;return new Promise(function(_0x327921,_0x1fb6f5){return db['VtigerAccount']['find']({'raw':_0x5e48af['options']?_0x5e48af[_0xe8a3('0x19')][_0xe8a3('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e48af[_0xe8a3('0x19')]?_0x5e48af[_0xe8a3('0x19')][_0xe8a3('0x1b')]||null:null,'attributes':_0x5e48af[_0xe8a3('0x19')]?_0x5e48af[_0xe8a3('0x19')]['attributes']||null:null,'include':_0x5e48af[_0xe8a3('0x19')]?_0x5e48af[_0xe8a3('0x19')][_0xe8a3('0x1e')]?_[_0xe8a3('0x1d')](_0x5e48af['options']['include'],function(_0x2b54ac){return{'model':db[_0x2b54ac[_0xe8a3('0x1f')]],'as':_0x2b54ac['as'],'attributes':_0x2b54ac[_0xe8a3('0x1c')],'include':_0x2b54ac[_0xe8a3('0x1e')]?_[_0xe8a3('0x1d')](_0x2b54ac[_0xe8a3('0x1e')],function(_0xd1975b){return{'model':db[_0xd1975b['model']],'as':_0xd1975b['as'],'attributes':_0xd1975b[_0xe8a3('0x1c')],'include':_0xd1975b[_0xe8a3('0x1e')]?_[_0xe8a3('0x1d')](_0xd1975b[_0xe8a3('0x1e')],function(_0x5c78b4){return{'model':db[_0x5c78b4[_0xe8a3('0x1f')]],'as':_0x5c78b4['as'],'attributes':_0x5c78b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe8a3('0xe')](function(_0x345253){logger[_0xe8a3('0x20')](_0xe8a3('0x22'),_0x5e48af);logger[_0xe8a3('0x11')]('ShowVtigerAccount',_0x5e48af,JSON[_0xe8a3('0x23')](_0x345253));_0x327921(_0x345253);})[_0xe8a3('0x16')](function(_0x44def1){logger[_0xe8a3('0x12')](_0xe8a3('0x22'),_0x44def1[_0xe8a3('0x14')],_0x5e48af);_0x1fb6f5(_0x5acf7c[_0xe8a3('0x12')](0x1f4,_0x44def1[_0xe8a3('0x14')]));});});}; \ No newline at end of file +var _0x0eed=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowVtigerAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x9c6f7,_0x3af339){var _0x54f2b5=function(_0x431c13){while(--_0x431c13){_0x9c6f7['push'](_0x9c6f7['shift']());}};_0x54f2b5(++_0x3af339);}(_0x0eed,0x1ad));var _0xd0ee=function(_0x52286a,_0x19b5ed){_0x52286a=_0x52286a-0x0;var _0xb8036e=_0x0eed[_0x52286a];return _0xb8036e;};'use strict';var _=require(_0xd0ee('0x0'));var util=require(_0xd0ee('0x1'));var moment=require(_0xd0ee('0x2'));var BPromise=require('bluebird');var rs=require(_0xd0ee('0x3'));var fs=require('fs');var Redis=require(_0xd0ee('0x4'));var db=require(_0xd0ee('0x5'))['db'];var utils=require(_0xd0ee('0x6'));var logger=require(_0xd0ee('0x7'))(_0xd0ee('0x8'));var config=require('../../config/environment');var jayson=require(_0xd0ee('0x9'));var client=jayson[_0xd0ee('0xa')][_0xd0ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1341dd,_0x1ee585,_0x8a87fe){return new BPromise(function(_0x4ae48f,_0x377d3c){return client['request'](_0x1341dd,_0x8a87fe)[_0xd0ee('0xc')](function(_0x4a9045){logger[_0xd0ee('0xd')](_0xd0ee('0xe'),_0x1ee585,_0xd0ee('0xf'));logger[_0xd0ee('0x10')](_0xd0ee('0x11'),_0x1ee585,_0xd0ee('0xf'),JSON[_0xd0ee('0x12')](_0x4a9045));if(_0x4a9045[_0xd0ee('0x13')]){if(_0x4a9045[_0xd0ee('0x13')][_0xd0ee('0x14')]===0x1f4){logger['error'](_0xd0ee('0xe'),_0x1ee585,_0x4a9045['error'][_0xd0ee('0x15')]);return _0x377d3c(_0x4a9045[_0xd0ee('0x13')][_0xd0ee('0x15')]);}logger[_0xd0ee('0x13')](_0xd0ee('0xe'),_0x1ee585,_0x4a9045[_0xd0ee('0x13')][_0xd0ee('0x15')]);return _0x4ae48f(_0x4a9045[_0xd0ee('0x13')][_0xd0ee('0x15')]);}else{logger[_0xd0ee('0xd')](_0xd0ee('0xe'),_0x1ee585,'request\x20sent');_0x4ae48f(_0x4a9045[_0xd0ee('0x16')]['message']);}})['catch'](function(_0x220afe){logger['error'](_0xd0ee('0xe'),_0x1ee585,_0x220afe);_0x377d3c(_0x220afe);});});}exports[_0xd0ee('0x17')]=function(_0x525b97){var _0x4eb52e=this;return new Promise(function(_0x4c2bd8,_0x9e23f5){return db[_0xd0ee('0x18')][_0xd0ee('0x19')]({'raw':_0x525b97[_0xd0ee('0x1a')]?_0x525b97[_0xd0ee('0x1a')][_0xd0ee('0x1b')]===undefined?!![]:![]:!![],'where':_0x525b97[_0xd0ee('0x1a')]?_0x525b97['options'][_0xd0ee('0x1c')]||null:null,'attributes':_0x525b97[_0xd0ee('0x1a')]?_0x525b97[_0xd0ee('0x1a')][_0xd0ee('0x1d')]||null:null,'limit':_0x525b97[_0xd0ee('0x1a')]?_0x525b97[_0xd0ee('0x1a')][_0xd0ee('0x1e')]||null:null,'include':_0x525b97[_0xd0ee('0x1a')]?_0x525b97[_0xd0ee('0x1a')][_0xd0ee('0x1f')]?_['map'](_0x525b97[_0xd0ee('0x1a')]['include'],function(_0x5b47ca){return{'model':db[_0x5b47ca[_0xd0ee('0x20')]],'as':_0x5b47ca['as'],'attributes':_0x5b47ca[_0xd0ee('0x1d')],'include':_0x5b47ca[_0xd0ee('0x1f')]?_[_0xd0ee('0x21')](_0x5b47ca[_0xd0ee('0x1f')],function(_0x51495f){return{'model':db[_0x51495f[_0xd0ee('0x20')]],'as':_0x51495f['as'],'attributes':_0x51495f[_0xd0ee('0x1d')],'include':_0x51495f[_0xd0ee('0x1f')]?_[_0xd0ee('0x21')](_0x51495f[_0xd0ee('0x1f')],function(_0x5ef2e1){return{'model':db[_0x5ef2e1[_0xd0ee('0x20')]],'as':_0x5ef2e1['as'],'attributes':_0x5ef2e1[_0xd0ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd0ee('0xc')](function(_0x3caad5){logger[_0xd0ee('0xd')](_0xd0ee('0x17'),_0x525b97);logger[_0xd0ee('0x10')](_0xd0ee('0x17'),_0x525b97,JSON[_0xd0ee('0x12')](_0x3caad5));_0x4c2bd8(_0x3caad5);})[_0xd0ee('0x22')](function(_0x1ef6f7){logger[_0xd0ee('0x13')]('GetVtigerAccount',_0x1ef6f7[_0xd0ee('0x15')],_0x525b97);_0x9e23f5(_0x4eb52e[_0xd0ee('0x13')](0x1f4,_0x1ef6f7['message']));});});};exports[_0xd0ee('0x23')]=function(_0x5acbce){var _0x449933=this;return new Promise(function(_0x1cbc3a,_0xc4ed62){return db[_0xd0ee('0x18')][_0xd0ee('0x24')]({'raw':_0x5acbce[_0xd0ee('0x1a')]?_0x5acbce['options'][_0xd0ee('0x1b')]===undefined?!![]:![]:!![],'where':_0x5acbce['options']?_0x5acbce[_0xd0ee('0x1a')][_0xd0ee('0x1c')]||null:null,'attributes':_0x5acbce[_0xd0ee('0x1a')]?_0x5acbce[_0xd0ee('0x1a')]['attributes']||null:null,'include':_0x5acbce[_0xd0ee('0x1a')]?_0x5acbce['options'][_0xd0ee('0x1f')]?_['map'](_0x5acbce[_0xd0ee('0x1a')]['include'],function(_0x208950){return{'model':db[_0x208950[_0xd0ee('0x20')]],'as':_0x208950['as'],'attributes':_0x208950[_0xd0ee('0x1d')],'include':_0x208950['include']?_[_0xd0ee('0x21')](_0x208950['include'],function(_0x4082ea){return{'model':db[_0x4082ea['model']],'as':_0x4082ea['as'],'attributes':_0x4082ea[_0xd0ee('0x1d')],'include':_0x4082ea['include']?_[_0xd0ee('0x21')](_0x4082ea[_0xd0ee('0x1f')],function(_0xba4ea7){return{'model':db[_0xba4ea7['model']],'as':_0xba4ea7['as'],'attributes':_0xba4ea7['attributes']};}):[]};}):[]};}):[]:[]})[_0xd0ee('0xc')](function(_0x392bf8){logger[_0xd0ee('0xd')]('ShowVtigerAccount',_0x5acbce);logger[_0xd0ee('0x10')](_0xd0ee('0x23'),_0x5acbce,JSON['stringify'](_0x392bf8));_0x1cbc3a(_0x392bf8);})[_0xd0ee('0x22')](function(_0x14b1ab){logger[_0xd0ee('0x13')](_0xd0ee('0x23'),_0x14b1ab[_0xd0ee('0x15')],_0x5acbce);_0xc4ed62(_0x449933[_0xd0ee('0x13')](0x1f4,_0x14b1ab[_0xd0ee('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index e5f1e29..60ab75b 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 _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x5e10f7,_0x4791d3){var _0x24ecf9=function(_0x3435b5){while(--_0x3435b5){_0x5e10f7['push'](_0x5e10f7['shift']());}};_0x24ecf9(++_0x4791d3);}(_0xb10b,0x12a));var _0xbb10=function(_0xafe951,_0x366ebd){_0xafe951=_0xafe951-0x0;var _0x3f287b=_0xb10b[_0xafe951];return _0x3f287b;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x1bb47b,_0x54e02e){var _0x566418=function(_0x4ceb66){while(--_0x4ceb66){_0x1bb47b['push'](_0x1bb47b['shift']());}};_0x566418(++_0x54e02e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 91e33dd..2114c3a 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 _0xd3e6=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd3e6,0xfe));var _0x6d3e=function(_0x43e0c3,_0x131fae){_0x43e0c3=_0x43e0c3-0x0;var _0x43eb90=_0xd3e6[_0x43e0c3];return _0x43eb90;};'use strict';var Sequelize=require(_0x6d3e('0x0'));module[_0x6d3e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d3e('0x2')]}}; \ No newline at end of file +var _0xf04b=['STRING','sequelize'];(function(_0x478d9a,_0x540249){var _0x4bf1ee=function(_0x566dc6){while(--_0x566dc6){_0x478d9a['push'](_0x478d9a['shift']());}};_0x4bf1ee(++_0x540249);}(_0xf04b,0x121));var _0xbf04=function(_0x3a5d7a,_0x18e1f6){_0x3a5d7a=_0x3a5d7a-0x0;var _0x20fc42=_0xf04b[_0x3a5d7a];return _0x20fc42;};'use strict';var Sequelize=require(_0xbf04('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf04('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6ad9ae5..3208fa0 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 _0x16c8=['set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','getFields','findOne','VtigerField','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','sendStatus','end','count','offset','status'];(function(_0x3cd128,_0x4c36f5){var _0x1c3e99=function(_0x2b009f){while(--_0x2b009f){_0x3cd128['push'](_0x3cd128['shift']());}};_0x1c3e99(++_0x4c36f5);}(_0x16c8,0x14e));var _0x816c=function(_0x330ed4,_0x55ecbe){_0x330ed4=_0x330ed4-0x0;var _0x8bbc3b=_0x16c8[_0x330ed4];return _0x8bbc3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x816c('0x0'));var rimraf=require(_0x816c('0x1'));var zipdir=require(_0x816c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x816c('0x3'));var moment=require('moment');var BPromise=require(_0x816c('0x4'));var Mustache=require(_0x816c('0x5'));var util=require(_0x816c('0x6'));var path=require(_0x816c('0x7'));var sox=require('sox');var csv=require(_0x816c('0x8'));var ejs=require(_0x816c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x816c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x816c('0xb'));var Papa=require(_0x816c('0xc'));var Redis=require(_0x816c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x816c('0xe'));var as=require(_0x816c('0xf'));var hardwareService=require(_0x816c('0x10'));var logger=require(_0x816c('0x11'))(_0x816c('0x12'));var utils=require(_0x816c('0x13'));var config=require(_0x816c('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x816c('0x15'));var client=jayson[_0x816c('0x16')][_0x816c('0x17')]({'port':0x232a});function checkPasswordPattern(_0x580c66,_0x32208b,_0x41790b){if(_0x41790b){var _0x436a98=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x436a98[_0x816c('0x18')](_0x32208b)){return _0x580c66;}else{throw new db[(_0x816c('0x19'))][(_0x816c('0x1a'))](_0x816c('0x1b'));}}else{return _0x580c66;}}function respondWithRpcPromise(_0x44fc01,_0xeecbe8,_0x327002,_0x7ae767){return new BPromise(function(_0x5edc40,_0x1cb749){var _0x2e038b=_0x7ae767||client;return _0x2e038b[_0x816c('0x1c')](_0x44fc01,_0x327002)[_0x816c('0x1d')](function(_0x399c1c){logger['info'](_0x816c('0x1e'),_0xeecbe8,_0x816c('0x1f'));logger[_0x816c('0x20')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xeecbe8,_0x816c('0x1f'),JSON[_0x816c('0x21')](_0x399c1c));if(_0x399c1c['error']){if(_0x399c1c[_0x816c('0x22')]['code']===0x1f4){logger[_0x816c('0x22')](_0x816c('0x1e'),_0xeecbe8,_0x399c1c['error'][_0x816c('0x23')]);return _0x1cb749(_0x399c1c[_0x816c('0x22')][_0x816c('0x23')]);}logger[_0x816c('0x22')](_0x816c('0x1e'),_0xeecbe8,_0x399c1c[_0x816c('0x22')][_0x816c('0x23')]);return _0x5edc40(_0x399c1c[_0x816c('0x22')][_0x816c('0x23')]);}else{logger[_0x816c('0x24')]('VtigerConfiguration,\x20%s,\x20%s',_0xeecbe8,_0x816c('0x1f'));_0x5edc40(_0x399c1c['result'][_0x816c('0x23')]);}})['catch'](function(_0x5c40e6){logger[_0x816c('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0xeecbe8,_0x5c40e6);_0x1cb749(_0x5c40e6);});});}function respondWithStatusCode(_0x5f56d6,_0x2d1edb){_0x2d1edb=_0x2d1edb||0xcc;return function(_0x4d341e){if(_0x4d341e){return _0x5f56d6[_0x816c('0x25')](_0x2d1edb);}return _0x5f56d6['status'](_0x2d1edb)[_0x816c('0x26')]();};}function respondWithResult(_0x3e8ede,_0x5df814){_0x5df814=_0x5df814||0xc8;return function(_0x3f45e1){if(_0x3f45e1){return _0x3e8ede['status'](_0x5df814)['json'](_0x3f45e1);}};}function respondWithFilteredResult(_0x403619,_0x2adb19){return function(_0x326b22){if(_0x326b22){var _0xd859ed=_0x326b22[_0x816c('0x27')],_0x5a580d=_0x2adb19[_0x816c('0x28')],_0x6e8641=_0x2adb19[_0x816c('0x28')]+_0x2adb19['limit'],_0x2fb7b1;if(_0x6e8641>=_0xd859ed){_0x6e8641=_0xd859ed;_0x2fb7b1=0xc8;}else{_0x2fb7b1=0xce;}_0x403619[_0x816c('0x29')](_0x2fb7b1);return _0x403619[_0x816c('0x2a')](_0x816c('0x2b'),_0x5a580d+'-'+_0x6e8641+'/'+_0xd859ed)[_0x816c('0x2c')](_0x326b22);}return null;};}function patchUpdates(_0x31a0bd){return function(_0x94f9d6){try{jsonpatch[_0x816c('0x2d')](_0x94f9d6,_0x31a0bd,!![]);}catch(_0x1f7271){return BPromise[_0x816c('0x2e')](_0x1f7271);}return _0x94f9d6[_0x816c('0x2f')]();};}function saveUpdates(_0x5905ff,_0x4137fa){return function(_0x309f11){if(_0x309f11){return _0x309f11[_0x816c('0x30')](_0x5905ff)[_0x816c('0x1d')](function(_0x2407a8){return _0x2407a8;});}return null;};}function removeEntity(_0x328a1e,_0x226aa6){return function(_0xca183d){if(_0xca183d){return _0xca183d[_0x816c('0x31')]()[_0x816c('0x1d')](function(){_0x328a1e['status'](0xcc)[_0x816c('0x26')]();});}};}function handleEntityNotFound(_0x43cf74,_0x43d859){return function(_0x819fbc){if(!_0x819fbc){_0x43cf74[_0x816c('0x25')](0x194);}return _0x819fbc;};}function handleError(_0x10be20,_0x3d8ab2){_0x3d8ab2=_0x3d8ab2||0x1f4;return function(_0x551d65){logger[_0x816c('0x22')](_0x551d65[_0x816c('0x32')]);if(_0x551d65['name']){delete _0x551d65[_0x816c('0x33')];}_0x10be20['status'](_0x3d8ab2)[_0x816c('0x34')](_0x551d65);};}exports[_0x816c('0x35')]=function(_0xc342b1,_0x5cd51c){var _0xdec5a1={},_0x305db5={},_0xd9f164={'count':0x0,'rows':[]};var _0xace86a=_[_0x816c('0x36')](db['VtigerConfiguration'][_0x816c('0x37')],function(_0x496a04){return{'name':_0x496a04[_0x816c('0x38')],'type':_0x496a04[_0x816c('0x39')][_0x816c('0x3a')]};});_0x305db5[_0x816c('0x3b')]=_[_0x816c('0x36')](_0xace86a,_0x816c('0x33'));_0x305db5[_0x816c('0x3c')]=_['keys'](_0xc342b1[_0x816c('0x3c')]);_0x305db5['filters']=_[_0x816c('0x3d')](_0x305db5[_0x816c('0x3b')],_0x305db5[_0x816c('0x3c')]);_0xdec5a1[_0x816c('0x3e')]=_['intersection'](_0x305db5[_0x816c('0x3b')],qs[_0x816c('0x3f')](_0xc342b1[_0x816c('0x3c')]['fields']));_0xdec5a1[_0x816c('0x3e')]=_0xdec5a1['attributes'][_0x816c('0x40')]?_0xdec5a1[_0x816c('0x3e')]:_0x305db5[_0x816c('0x3b')];if(!_0xc342b1[_0x816c('0x3c')][_0x816c('0x41')]('nolimit')){_0xdec5a1[_0x816c('0x42')]=qs[_0x816c('0x42')](_0xc342b1['query'][_0x816c('0x42')]);_0xdec5a1[_0x816c('0x28')]=qs['offset'](_0xc342b1['query'][_0x816c('0x28')]);}_0xdec5a1[_0x816c('0x43')]=qs[_0x816c('0x44')](_0xc342b1[_0x816c('0x3c')][_0x816c('0x44')]);_0xdec5a1['where']=qs['filters'](_[_0x816c('0x45')](_0xc342b1[_0x816c('0x3c')],_0x305db5[_0x816c('0x46')]),_0xace86a);if(_0xc342b1[_0x816c('0x3c')][_0x816c('0x47')]){_0xdec5a1[_0x816c('0x48')]=_[_0x816c('0x49')](_0xdec5a1[_0x816c('0x48')],{'$or':_[_0x816c('0x36')](_0xace86a,function(_0x4a03ae){if(_0x4a03ae[_0x816c('0x39')]!==_0x816c('0x4a')){var _0x46195a={};_0x46195a[_0x4a03ae[_0x816c('0x33')]]={'$like':'%'+_0xc342b1[_0x816c('0x3c')][_0x816c('0x47')]+'%'};return _0x46195a;}})});}_0xdec5a1=_['merge']({},_0xdec5a1,_0xc342b1['options']);var _0x48c6d4={'where':_0xdec5a1[_0x816c('0x48')]};return db[_0x816c('0x4b')][_0x816c('0x27')](_0x48c6d4)[_0x816c('0x1d')](function(_0x2d1019){_0xd9f164[_0x816c('0x27')]=_0x2d1019;if(_0xc342b1[_0x816c('0x3c')][_0x816c('0x4c')]){_0xdec5a1[_0x816c('0x4d')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x816c('0x4e')](_0xdec5a1);})[_0x816c('0x1d')](function(_0x2bac63){_0xd9f164[_0x816c('0x4f')]=_0x2bac63;return _0xd9f164;})[_0x816c('0x1d')](respondWithFilteredResult(_0x5cd51c,_0xdec5a1))[_0x816c('0x50')](handleError(_0x5cd51c,null));};exports[_0x816c('0x51')]=function(_0x2492b8,_0x1fd961){var _0x228dc={'raw':![],'where':{'id':_0x2492b8['params']['id']}},_0x1eff92={};_0x1eff92[_0x816c('0x3b')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x1eff92[_0x816c('0x3c')]=_[_0x816c('0x52')](_0x2492b8['query']);_0x1eff92[_0x816c('0x46')]=_[_0x816c('0x3d')](_0x1eff92[_0x816c('0x3b')],_0x1eff92[_0x816c('0x3c')]);_0x228dc[_0x816c('0x3e')]=_['intersection'](_0x1eff92['model'],qs[_0x816c('0x3f')](_0x2492b8[_0x816c('0x3c')][_0x816c('0x3f')]));_0x228dc[_0x816c('0x3e')]=_0x228dc[_0x816c('0x3e')][_0x816c('0x40')]?_0x228dc[_0x816c('0x3e')]:_0x1eff92[_0x816c('0x3b')];if(_0x2492b8[_0x816c('0x3c')]['includeAll']){_0x228dc[_0x816c('0x4d')]=[{'all':!![]}];}_0x228dc=_[_0x816c('0x49')]({},_0x228dc,_0x2492b8[_0x816c('0x53')]);return db[_0x816c('0x4b')][_0x816c('0x54')](_0x228dc)['then'](handleEntityNotFound(_0x1fd961,null))[_0x816c('0x1d')](respondWithResult(_0x1fd961,null))[_0x816c('0x50')](handleError(_0x1fd961,null));};exports['create']=function(_0x2c0de1,_0x204ae9){return db['VtigerConfiguration'][_0x816c('0x55')](_0x2c0de1['body'],{})['then'](respondWithResult(_0x204ae9,0xc9))[_0x816c('0x50')](handleError(_0x204ae9,null));};exports[_0x816c('0x30')]=function(_0x4d48ef,_0x2398fe){if(_0x4d48ef['body']['id']){delete _0x4d48ef[_0x816c('0x56')]['id'];}return db[_0x816c('0x4b')][_0x816c('0x54')]({'where':{'id':_0x4d48ef[_0x816c('0x57')]['id']}})[_0x816c('0x1d')](handleEntityNotFound(_0x2398fe,null))[_0x816c('0x1d')](saveUpdates(_0x4d48ef[_0x816c('0x56')],null))[_0x816c('0x1d')](respondWithResult(_0x2398fe,null))[_0x816c('0x50')](handleError(_0x2398fe,null));};exports[_0x816c('0x31')]=function(_0x41ac51,_0x2f70b3){return db[_0x816c('0x4b')][_0x816c('0x54')]({'where':{'id':_0x41ac51['params']['id']}})[_0x816c('0x1d')](handleEntityNotFound(_0x2f70b3,null))[_0x816c('0x1d')](removeEntity(_0x2f70b3,null))[_0x816c('0x50')](handleError(_0x2f70b3,null));};exports[_0x816c('0x58')]=function(_0x3bcad5,_0x110726,_0x5aa61d){var _0x224b79={};var _0x3ba82f={};var _0x428769;var _0x29a289;return db['VtigerConfiguration'][_0x816c('0x59')]({'where':{'id':_0x3bcad5[_0x816c('0x57')]['id']}})[_0x816c('0x1d')](handleEntityNotFound(_0x110726,null))[_0x816c('0x1d')](function(_0xed1e33){if(_0xed1e33){_0x428769=_0xed1e33;_0x3ba82f[_0x816c('0x3b')]=_[_0x816c('0x52')](db[_0x816c('0x5a')][_0x816c('0x37')]);_0x3ba82f[_0x816c('0x3c')]=_[_0x816c('0x52')](_0x3bcad5['query']);_0x3ba82f[_0x816c('0x46')]=_['intersection'](_0x3ba82f[_0x816c('0x3b')],_0x3ba82f['query']);_0x224b79[_0x816c('0x3e')]=_['intersection'](_0x3ba82f[_0x816c('0x3b')],qs[_0x816c('0x3f')](_0x3bcad5['query'][_0x816c('0x3f')]));_0x224b79[_0x816c('0x3e')]=_0x224b79[_0x816c('0x3e')]['length']?_0x224b79[_0x816c('0x3e')]:_0x3ba82f[_0x816c('0x3b')];_0x224b79[_0x816c('0x43')]=qs[_0x816c('0x44')](_0x3bcad5[_0x816c('0x3c')]['sort']);_0x224b79[_0x816c('0x48')]=qs[_0x816c('0x46')](_[_0x816c('0x45')](_0x3bcad5['query'],_0x3ba82f['filters']));if(_0x3bcad5[_0x816c('0x3c')]['filter']){_0x224b79[_0x816c('0x48')]=_['merge'](_0x224b79[_0x816c('0x48')],{'$or':_[_0x816c('0x36')](_0x224b79[_0x816c('0x3e')],function(_0x4a8f0d){var _0x2f4df7={};_0x2f4df7[_0x4a8f0d]={'$like':'%'+_0x3bcad5[_0x816c('0x3c')][_0x816c('0x47')]+'%'};return _0x2f4df7;})});}_0x224b79=_[_0x816c('0x49')]({},_0x224b79,_0x3bcad5[_0x816c('0x53')]);return _0x428769['getFields'](_0x224b79);}})[_0x816c('0x1d')](function(_0x5e5979){if(_0x5e5979){_0x29a289=_0x5e5979[_0x816c('0x40')];if(!_0x3bcad5[_0x816c('0x3c')][_0x816c('0x41')]('nolimit')){_0x224b79['limit']=qs[_0x816c('0x42')](_0x3bcad5['query'][_0x816c('0x42')]);_0x224b79[_0x816c('0x28')]=qs['offset'](_0x3bcad5[_0x816c('0x3c')][_0x816c('0x28')]);}return _0x428769[_0x816c('0x58')](_0x224b79);}})[_0x816c('0x1d')](function(_0x23f42e){if(_0x23f42e){return _0x23f42e?{'count':_0x29a289,'rows':_0x23f42e}:null;}})[_0x816c('0x1d')](respondWithResult(_0x110726,null))['catch'](handleError(_0x110726,null));};exports['getSubjects']=function(_0x3cf71f,_0x1cd92b,_0x15d8c1){var _0x3367ff={};var _0x1ae016={};var _0x45b10a;var _0x4a1131;return db[_0x816c('0x4b')][_0x816c('0x59')]({'where':{'id':_0x3cf71f['params']['id']}})[_0x816c('0x1d')](handleEntityNotFound(_0x1cd92b,null))[_0x816c('0x1d')](function(_0x588893){if(_0x588893){_0x45b10a=_0x588893;_0x1ae016['model']=_[_0x816c('0x52')](db['VtigerField'][_0x816c('0x37')]);_0x1ae016[_0x816c('0x3c')]=_['keys'](_0x3cf71f[_0x816c('0x3c')]);_0x1ae016[_0x816c('0x46')]=_[_0x816c('0x3d')](_0x1ae016[_0x816c('0x3b')],_0x1ae016[_0x816c('0x3c')]);_0x3367ff[_0x816c('0x3e')]=_[_0x816c('0x3d')](_0x1ae016[_0x816c('0x3b')],qs[_0x816c('0x3f')](_0x3cf71f[_0x816c('0x3c')][_0x816c('0x3f')]));_0x3367ff['attributes']=_0x3367ff['attributes'][_0x816c('0x40')]?_0x3367ff[_0x816c('0x3e')]:_0x1ae016[_0x816c('0x3b')];_0x3367ff[_0x816c('0x43')]=qs[_0x816c('0x44')](_0x3cf71f['query'][_0x816c('0x44')]);_0x3367ff['where']=qs[_0x816c('0x46')](_[_0x816c('0x45')](_0x3cf71f[_0x816c('0x3c')],_0x1ae016['filters']));if(_0x3cf71f[_0x816c('0x3c')][_0x816c('0x47')]){_0x3367ff[_0x816c('0x48')]=_[_0x816c('0x49')](_0x3367ff['where'],{'$or':_[_0x816c('0x36')](_0x3367ff[_0x816c('0x3e')],function(_0x1dafd1){var _0x59ad19={};_0x59ad19[_0x1dafd1]={'$like':'%'+_0x3cf71f['query'][_0x816c('0x47')]+'%'};return _0x59ad19;})});}_0x3367ff=_[_0x816c('0x49')]({},_0x3367ff,_0x3cf71f[_0x816c('0x53')]);return _0x45b10a[_0x816c('0x5b')](_0x3367ff);}})[_0x816c('0x1d')](function(_0x4b4560){if(_0x4b4560){_0x4a1131=_0x4b4560[_0x816c('0x40')];if(!_0x3cf71f['query'][_0x816c('0x41')](_0x816c('0x5c'))){_0x3367ff['limit']=qs[_0x816c('0x42')](_0x3cf71f['query'][_0x816c('0x42')]);_0x3367ff[_0x816c('0x28')]=qs[_0x816c('0x28')](_0x3cf71f['query'][_0x816c('0x28')]);}return _0x45b10a[_0x816c('0x5b')](_0x3367ff);}})[_0x816c('0x1d')](function(_0x183801){if(_0x183801){return _0x183801?{'count':_0x4a1131,'rows':_0x183801}:null;}})['then'](respondWithResult(_0x1cd92b,null))[_0x816c('0x50')](handleError(_0x1cd92b,null));};exports[_0x816c('0x5d')]=function(_0x9e5cb2,_0x167a06,_0x349d99){var _0x2792dc={};var _0x1f9823={};var _0x121140;var _0xfc055c;return db[_0x816c('0x4b')][_0x816c('0x59')]({'where':{'id':_0x9e5cb2[_0x816c('0x57')]['id']}})[_0x816c('0x1d')](handleEntityNotFound(_0x167a06,null))[_0x816c('0x1d')](function(_0x180886){if(_0x180886){_0x121140=_0x180886;_0x1f9823[_0x816c('0x3b')]=_['keys'](db[_0x816c('0x5a')][_0x816c('0x37')]);_0x1f9823[_0x816c('0x3c')]=_[_0x816c('0x52')](_0x9e5cb2[_0x816c('0x3c')]);_0x1f9823[_0x816c('0x46')]=_['intersection'](_0x1f9823[_0x816c('0x3b')],_0x1f9823[_0x816c('0x3c')]);_0x2792dc['attributes']=_[_0x816c('0x3d')](_0x1f9823['model'],qs[_0x816c('0x3f')](_0x9e5cb2[_0x816c('0x3c')][_0x816c('0x3f')]));_0x2792dc[_0x816c('0x3e')]=_0x2792dc[_0x816c('0x3e')]['length']?_0x2792dc[_0x816c('0x3e')]:_0x1f9823[_0x816c('0x3b')];_0x2792dc[_0x816c('0x43')]=qs['sort'](_0x9e5cb2[_0x816c('0x3c')][_0x816c('0x44')]);_0x2792dc['where']=qs[_0x816c('0x46')](_[_0x816c('0x45')](_0x9e5cb2['query'],_0x1f9823[_0x816c('0x46')]));if(_0x9e5cb2[_0x816c('0x3c')]['filter']){_0x2792dc[_0x816c('0x48')]=_['merge'](_0x2792dc[_0x816c('0x48')],{'$or':_[_0x816c('0x36')](_0x2792dc[_0x816c('0x3e')],function(_0xe7aaa3){var _0x1b0f80={};_0x1b0f80[_0xe7aaa3]={'$like':'%'+_0x9e5cb2[_0x816c('0x3c')][_0x816c('0x47')]+'%'};return _0x1b0f80;})});}_0x2792dc=_[_0x816c('0x49')]({},_0x2792dc,_0x9e5cb2[_0x816c('0x53')]);return _0x121140[_0x816c('0x5d')](_0x2792dc);}})[_0x816c('0x1d')](function(_0x2a41b5){if(_0x2a41b5){_0xfc055c=_0x2a41b5[_0x816c('0x40')];if(!_0x9e5cb2[_0x816c('0x3c')][_0x816c('0x41')](_0x816c('0x5c'))){_0x2792dc[_0x816c('0x42')]=qs['limit'](_0x9e5cb2['query'][_0x816c('0x42')]);_0x2792dc[_0x816c('0x28')]=qs['offset'](_0x9e5cb2['query'][_0x816c('0x28')]);}return _0x121140[_0x816c('0x5d')](_0x2792dc);}})[_0x816c('0x1d')](function(_0x2eb31d){if(_0x2eb31d){return _0x2eb31d?{'count':_0xfc055c,'rows':_0x2eb31d}:null;}})[_0x816c('0x1d')](respondWithResult(_0x167a06,null))[_0x816c('0x50')](handleError(_0x167a06,null));}; \ No newline at end of file +var _0x1ba8=['body','params','getFields','findOne','VtigerField','pick','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','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','../../mysqldb','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','save','update','destroy','stack','name','send','index','map','VtigerConfiguration','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','options','find','create'];(function(_0x344b8a,_0x51b79f){var _0x1b1fa3=function(_0x15d453){while(--_0x15d453){_0x344b8a['push'](_0x344b8a['shift']());}};_0x1b1fa3(++_0x51b79f);}(_0x1ba8,0x117));var _0x81ba=function(_0xcc8663,_0x10f593){_0xcc8663=_0xcc8663-0x0;var _0xc12f28=_0x1ba8[_0xcc8663];return _0xc12f28;};'use strict';var pdf=require(_0x81ba('0x0'));var emlformat=require(_0x81ba('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x81ba('0x2'));var jsonpatch=require(_0x81ba('0x3'));var rp=require(_0x81ba('0x4'));var moment=require(_0x81ba('0x5'));var BPromise=require(_0x81ba('0x6'));var Mustache=require('mustache');var util=require(_0x81ba('0x7'));var path=require(_0x81ba('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x81ba('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x81ba('0xa'));var deskjs=require(_0x81ba('0xb'));var toCsv=require(_0x81ba('0xc'));var querystring=require('querystring');var Papa=require(_0x81ba('0xd'));var Redis=require(_0x81ba('0xe'));var authService=require(_0x81ba('0xf'));var qs=require(_0x81ba('0x10'));var as=require(_0x81ba('0x11'));var hardwareService=require(_0x81ba('0x12'));var logger=require(_0x81ba('0x13'))(_0x81ba('0x14'));var utils=require(_0x81ba('0x15'));var config=require(_0x81ba('0x16'));var db=require(_0x81ba('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x81ba('0x18')][_0x81ba('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1e2b9f,_0x568d5f,_0x4f9e51){if(_0x4f9e51){var _0xed556b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xed556b['test'](_0x568d5f)){return _0x1e2b9f;}else{throw new db[(_0x81ba('0x1a'))]['ValidationError'](_0x81ba('0x1b'));}}else{return _0x1e2b9f;}}function respondWithRpcPromise(_0x557c1a,_0x341a31,_0x3ce7fa,_0x45df85){return new BPromise(function(_0x85759e,_0x4dc009){var _0x1e62b2=_0x45df85||client;return _0x1e62b2[_0x81ba('0x1c')](_0x557c1a,_0x3ce7fa)[_0x81ba('0x1d')](function(_0x2e71f9){logger[_0x81ba('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x341a31,_0x81ba('0x1f'));logger[_0x81ba('0x20')](_0x81ba('0x21'),_0x341a31,_0x81ba('0x1f'),JSON[_0x81ba('0x22')](_0x2e71f9));if(_0x2e71f9[_0x81ba('0x23')]){if(_0x2e71f9[_0x81ba('0x23')][_0x81ba('0x24')]===0x1f4){logger['error'](_0x81ba('0x25'),_0x341a31,_0x2e71f9['error']['message']);return _0x4dc009(_0x2e71f9[_0x81ba('0x23')][_0x81ba('0x26')]);}logger[_0x81ba('0x23')](_0x81ba('0x25'),_0x341a31,_0x2e71f9[_0x81ba('0x23')][_0x81ba('0x26')]);return _0x85759e(_0x2e71f9[_0x81ba('0x23')][_0x81ba('0x26')]);}else{logger[_0x81ba('0x1e')](_0x81ba('0x25'),_0x341a31,_0x81ba('0x1f'));_0x85759e(_0x2e71f9[_0x81ba('0x27')]['message']);}})[_0x81ba('0x28')](function(_0x5d86a5){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x341a31,_0x5d86a5);_0x4dc009(_0x5d86a5);});});}function respondWithStatusCode(_0x42e531,_0x3d3f5b){_0x3d3f5b=_0x3d3f5b||0xcc;return function(_0x324faf){if(_0x324faf){return _0x42e531[_0x81ba('0x29')](_0x3d3f5b);}return _0x42e531[_0x81ba('0x2a')](_0x3d3f5b)[_0x81ba('0x2b')]();};}function respondWithResult(_0x47ac57,_0x3916e3){_0x3916e3=_0x3916e3||0xc8;return function(_0x105dfc){if(_0x105dfc){return _0x47ac57[_0x81ba('0x2a')](_0x3916e3)[_0x81ba('0x2c')](_0x105dfc);}};}function respondWithFilteredResult(_0x2ecd3b,_0x321607){return function(_0x69bf30){if(_0x69bf30){var _0x2e57ef=_0x69bf30[_0x81ba('0x2d')],_0x60e8a8=_0x321607[_0x81ba('0x2e')],_0x1455fc=_0x321607[_0x81ba('0x2e')]+_0x321607[_0x81ba('0x2f')],_0x38eff8;if(_0x1455fc>=_0x2e57ef){_0x1455fc=_0x2e57ef;_0x38eff8=0xc8;}else{_0x38eff8=0xce;}_0x2ecd3b[_0x81ba('0x2a')](_0x38eff8);return _0x2ecd3b['set']('Content-Range',_0x60e8a8+'-'+_0x1455fc+'/'+_0x2e57ef)[_0x81ba('0x2c')](_0x69bf30);}return null;};}function patchUpdates(_0x5a2f91){return function(_0x3ef6ef){try{jsonpatch['apply'](_0x3ef6ef,_0x5a2f91,!![]);}catch(_0x30b458){return BPromise['reject'](_0x30b458);}return _0x3ef6ef[_0x81ba('0x30')]();};}function saveUpdates(_0x22df7f,_0x2795d5){return function(_0x1b2b59){if(_0x1b2b59){return _0x1b2b59[_0x81ba('0x31')](_0x22df7f)[_0x81ba('0x1d')](function(_0x216a6c){return _0x216a6c;});}return null;};}function removeEntity(_0x5dd614,_0x368e06){return function(_0x46d2ea){if(_0x46d2ea){return _0x46d2ea[_0x81ba('0x32')]()['then'](function(){_0x5dd614[_0x81ba('0x2a')](0xcc)[_0x81ba('0x2b')]();});}};}function handleEntityNotFound(_0x573b44,_0x128deb){return function(_0x134a1a){if(!_0x134a1a){_0x573b44[_0x81ba('0x29')](0x194);}return _0x134a1a;};}function handleError(_0x1e8f24,_0x463566){_0x463566=_0x463566||0x1f4;return function(_0x37c255){logger[_0x81ba('0x23')](_0x37c255[_0x81ba('0x33')]);if(_0x37c255['name']){delete _0x37c255[_0x81ba('0x34')];}_0x1e8f24[_0x81ba('0x2a')](_0x463566)[_0x81ba('0x35')](_0x37c255);};}exports[_0x81ba('0x36')]=function(_0x4a53e1,_0x9a7d92){var _0x5765c4={},_0x10ee29={},_0xa8ad8d={'count':0x0,'rows':[]};var _0xeeb156=_[_0x81ba('0x37')](db[_0x81ba('0x38')]['rawAttributes'],function(_0x1e5ff7){return{'name':_0x1e5ff7['fieldName'],'type':_0x1e5ff7['type'][_0x81ba('0x39')]};});_0x10ee29['model']=_[_0x81ba('0x37')](_0xeeb156,_0x81ba('0x34'));_0x10ee29['query']=_[_0x81ba('0x3a')](_0x4a53e1[_0x81ba('0x3b')]);_0x10ee29[_0x81ba('0x3c')]=_['intersection'](_0x10ee29[_0x81ba('0x3d')],_0x10ee29[_0x81ba('0x3b')]);_0x5765c4[_0x81ba('0x3e')]=_[_0x81ba('0x3f')](_0x10ee29[_0x81ba('0x3d')],qs['fields'](_0x4a53e1[_0x81ba('0x3b')][_0x81ba('0x40')]));_0x5765c4[_0x81ba('0x3e')]=_0x5765c4['attributes'][_0x81ba('0x41')]?_0x5765c4[_0x81ba('0x3e')]:_0x10ee29[_0x81ba('0x3d')];if(!_0x4a53e1[_0x81ba('0x3b')][_0x81ba('0x42')]('nolimit')){_0x5765c4[_0x81ba('0x2f')]=qs['limit'](_0x4a53e1['query']['limit']);_0x5765c4[_0x81ba('0x2e')]=qs[_0x81ba('0x2e')](_0x4a53e1[_0x81ba('0x3b')][_0x81ba('0x2e')]);}_0x5765c4[_0x81ba('0x43')]=qs[_0x81ba('0x44')](_0x4a53e1[_0x81ba('0x3b')][_0x81ba('0x44')]);_0x5765c4['where']=qs['filters'](_['pick'](_0x4a53e1[_0x81ba('0x3b')],_0x10ee29['filters']),_0xeeb156);if(_0x4a53e1[_0x81ba('0x3b')][_0x81ba('0x45')]){_0x5765c4[_0x81ba('0x46')]=_['merge'](_0x5765c4[_0x81ba('0x46')],{'$or':_['map'](_0xeeb156,function(_0x44eedb){if(_0x44eedb['type']!==_0x81ba('0x47')){var _0x1f8d10={};_0x1f8d10[_0x44eedb[_0x81ba('0x34')]]={'$like':'%'+_0x4a53e1['query'][_0x81ba('0x45')]+'%'};return _0x1f8d10;}})});}_0x5765c4=_[_0x81ba('0x48')]({},_0x5765c4,_0x4a53e1['options']);var _0x4c8fad={'where':_0x5765c4[_0x81ba('0x46')]};return db[_0x81ba('0x38')][_0x81ba('0x2d')](_0x4c8fad)[_0x81ba('0x1d')](function(_0x37da0f){_0xa8ad8d[_0x81ba('0x2d')]=_0x37da0f;if(_0x4a53e1[_0x81ba('0x3b')]['includeAll']){_0x5765c4[_0x81ba('0x49')]=[{'all':!![]}];}return db[_0x81ba('0x38')][_0x81ba('0x4a')](_0x5765c4);})[_0x81ba('0x1d')](function(_0x50bb80){_0xa8ad8d[_0x81ba('0x4b')]=_0x50bb80;return _0xa8ad8d;})[_0x81ba('0x1d')](respondWithFilteredResult(_0x9a7d92,_0x5765c4))[_0x81ba('0x28')](handleError(_0x9a7d92,null));};exports[_0x81ba('0x4c')]=function(_0x205aef,_0x4c0545){var _0xeee71e={'raw':![],'where':{'id':_0x205aef['params']['id']}},_0x587a7f={};_0x587a7f[_0x81ba('0x3d')]=_['keys'](db['VtigerConfiguration'][_0x81ba('0x4d')]);_0x587a7f[_0x81ba('0x3b')]=_['keys'](_0x205aef[_0x81ba('0x3b')]);_0x587a7f['filters']=_[_0x81ba('0x3f')](_0x587a7f['model'],_0x587a7f[_0x81ba('0x3b')]);_0xeee71e[_0x81ba('0x3e')]=_[_0x81ba('0x3f')](_0x587a7f[_0x81ba('0x3d')],qs[_0x81ba('0x40')](_0x205aef[_0x81ba('0x3b')][_0x81ba('0x40')]));_0xeee71e[_0x81ba('0x3e')]=_0xeee71e[_0x81ba('0x3e')][_0x81ba('0x41')]?_0xeee71e['attributes']:_0x587a7f[_0x81ba('0x3d')];if(_0x205aef[_0x81ba('0x3b')]['includeAll']){_0xeee71e[_0x81ba('0x49')]=[{'all':!![]}];}_0xeee71e=_[_0x81ba('0x48')]({},_0xeee71e,_0x205aef[_0x81ba('0x4e')]);return db[_0x81ba('0x38')][_0x81ba('0x4f')](_0xeee71e)[_0x81ba('0x1d')](handleEntityNotFound(_0x4c0545,null))[_0x81ba('0x1d')](respondWithResult(_0x4c0545,null))[_0x81ba('0x28')](handleError(_0x4c0545,null));};exports['create']=function(_0x1ab599,_0xcf8335){return db[_0x81ba('0x38')][_0x81ba('0x50')](_0x1ab599[_0x81ba('0x51')],{})[_0x81ba('0x1d')](respondWithResult(_0xcf8335,0xc9))[_0x81ba('0x28')](handleError(_0xcf8335,null));};exports[_0x81ba('0x31')]=function(_0x8310f1,_0x37d4b6){if(_0x8310f1[_0x81ba('0x51')]['id']){delete _0x8310f1[_0x81ba('0x51')]['id'];}return db[_0x81ba('0x38')][_0x81ba('0x4f')]({'where':{'id':_0x8310f1[_0x81ba('0x52')]['id']}})[_0x81ba('0x1d')](handleEntityNotFound(_0x37d4b6,null))['then'](saveUpdates(_0x8310f1[_0x81ba('0x51')],null))[_0x81ba('0x1d')](respondWithResult(_0x37d4b6,null))['catch'](handleError(_0x37d4b6,null));};exports[_0x81ba('0x32')]=function(_0xdb3c77,_0xc2d84a){return db[_0x81ba('0x38')][_0x81ba('0x4f')]({'where':{'id':_0xdb3c77[_0x81ba('0x52')]['id']}})[_0x81ba('0x1d')](handleEntityNotFound(_0xc2d84a,null))[_0x81ba('0x1d')](removeEntity(_0xc2d84a,null))['catch'](handleError(_0xc2d84a,null));};exports[_0x81ba('0x53')]=function(_0x3b4f1f,_0x23c2cd,_0x268005){var _0xf833ac={};var _0x2059bb={};var _0x426a29;var _0x3e9bc7;return db['VtigerConfiguration'][_0x81ba('0x54')]({'where':{'id':_0x3b4f1f[_0x81ba('0x52')]['id']}})[_0x81ba('0x1d')](handleEntityNotFound(_0x23c2cd,null))[_0x81ba('0x1d')](function(_0x18edd6){if(_0x18edd6){_0x426a29=_0x18edd6;_0x2059bb[_0x81ba('0x3d')]=_[_0x81ba('0x3a')](db[_0x81ba('0x55')][_0x81ba('0x4d')]);_0x2059bb[_0x81ba('0x3b')]=_[_0x81ba('0x3a')](_0x3b4f1f[_0x81ba('0x3b')]);_0x2059bb[_0x81ba('0x3c')]=_[_0x81ba('0x3f')](_0x2059bb[_0x81ba('0x3d')],_0x2059bb[_0x81ba('0x3b')]);_0xf833ac['attributes']=_['intersection'](_0x2059bb[_0x81ba('0x3d')],qs[_0x81ba('0x40')](_0x3b4f1f['query']['fields']));_0xf833ac[_0x81ba('0x3e')]=_0xf833ac[_0x81ba('0x3e')][_0x81ba('0x41')]?_0xf833ac[_0x81ba('0x3e')]:_0x2059bb[_0x81ba('0x3d')];_0xf833ac[_0x81ba('0x43')]=qs[_0x81ba('0x44')](_0x3b4f1f[_0x81ba('0x3b')]['sort']);_0xf833ac['where']=qs[_0x81ba('0x3c')](_[_0x81ba('0x56')](_0x3b4f1f[_0x81ba('0x3b')],_0x2059bb[_0x81ba('0x3c')]));if(_0x3b4f1f[_0x81ba('0x3b')][_0x81ba('0x45')]){_0xf833ac[_0x81ba('0x46')]=_[_0x81ba('0x48')](_0xf833ac[_0x81ba('0x46')],{'$or':_[_0x81ba('0x37')](_0xf833ac[_0x81ba('0x3e')],function(_0x3a7fce){var _0x43ce9e={};_0x43ce9e[_0x3a7fce]={'$like':'%'+_0x3b4f1f[_0x81ba('0x3b')][_0x81ba('0x45')]+'%'};return _0x43ce9e;})});}_0xf833ac=_[_0x81ba('0x48')]({},_0xf833ac,_0x3b4f1f[_0x81ba('0x4e')]);return _0x426a29[_0x81ba('0x53')](_0xf833ac);}})['then'](function(_0x5ec4e0){if(_0x5ec4e0){_0x3e9bc7=_0x5ec4e0[_0x81ba('0x41')];if(!_0x3b4f1f[_0x81ba('0x3b')][_0x81ba('0x42')](_0x81ba('0x57'))){_0xf833ac[_0x81ba('0x2f')]=qs[_0x81ba('0x2f')](_0x3b4f1f[_0x81ba('0x3b')]['limit']);_0xf833ac[_0x81ba('0x2e')]=qs[_0x81ba('0x2e')](_0x3b4f1f[_0x81ba('0x3b')][_0x81ba('0x2e')]);}return _0x426a29[_0x81ba('0x53')](_0xf833ac);}})[_0x81ba('0x1d')](function(_0x1f2535){if(_0x1f2535){return _0x1f2535?{'count':_0x3e9bc7,'rows':_0x1f2535}:null;}})['then'](respondWithResult(_0x23c2cd,null))[_0x81ba('0x28')](handleError(_0x23c2cd,null));};exports[_0x81ba('0x58')]=function(_0x2d8d4a,_0x22b5c1,_0x3f0279){var _0x743a35={};var _0x30cef3={};var _0x59010c;var _0x2c9b7b;return db[_0x81ba('0x38')]['findOne']({'where':{'id':_0x2d8d4a[_0x81ba('0x52')]['id']}})[_0x81ba('0x1d')](handleEntityNotFound(_0x22b5c1,null))[_0x81ba('0x1d')](function(_0x55a249){if(_0x55a249){_0x59010c=_0x55a249;_0x30cef3[_0x81ba('0x3d')]=_[_0x81ba('0x3a')](db[_0x81ba('0x55')][_0x81ba('0x4d')]);_0x30cef3['query']=_[_0x81ba('0x3a')](_0x2d8d4a[_0x81ba('0x3b')]);_0x30cef3[_0x81ba('0x3c')]=_[_0x81ba('0x3f')](_0x30cef3['model'],_0x30cef3[_0x81ba('0x3b')]);_0x743a35[_0x81ba('0x3e')]=_[_0x81ba('0x3f')](_0x30cef3[_0x81ba('0x3d')],qs[_0x81ba('0x40')](_0x2d8d4a['query'][_0x81ba('0x40')]));_0x743a35[_0x81ba('0x3e')]=_0x743a35['attributes'][_0x81ba('0x41')]?_0x743a35['attributes']:_0x30cef3[_0x81ba('0x3d')];_0x743a35[_0x81ba('0x43')]=qs['sort'](_0x2d8d4a['query'][_0x81ba('0x44')]);_0x743a35[_0x81ba('0x46')]=qs[_0x81ba('0x3c')](_[_0x81ba('0x56')](_0x2d8d4a[_0x81ba('0x3b')],_0x30cef3[_0x81ba('0x3c')]));if(_0x2d8d4a[_0x81ba('0x3b')][_0x81ba('0x45')]){_0x743a35[_0x81ba('0x46')]=_['merge'](_0x743a35[_0x81ba('0x46')],{'$or':_['map'](_0x743a35[_0x81ba('0x3e')],function(_0x1e8bde){var _0x3c6042={};_0x3c6042[_0x1e8bde]={'$like':'%'+_0x2d8d4a[_0x81ba('0x3b')][_0x81ba('0x45')]+'%'};return _0x3c6042;})});}_0x743a35=_[_0x81ba('0x48')]({},_0x743a35,_0x2d8d4a['options']);return _0x59010c['getSubjects'](_0x743a35);}})[_0x81ba('0x1d')](function(_0x354215){if(_0x354215){_0x2c9b7b=_0x354215[_0x81ba('0x41')];if(!_0x2d8d4a[_0x81ba('0x3b')][_0x81ba('0x42')](_0x81ba('0x57'))){_0x743a35[_0x81ba('0x2f')]=qs[_0x81ba('0x2f')](_0x2d8d4a['query'][_0x81ba('0x2f')]);_0x743a35[_0x81ba('0x2e')]=qs[_0x81ba('0x2e')](_0x2d8d4a[_0x81ba('0x3b')][_0x81ba('0x2e')]);}return _0x59010c[_0x81ba('0x58')](_0x743a35);}})['then'](function(_0x5e3abd){if(_0x5e3abd){return _0x5e3abd?{'count':_0x2c9b7b,'rows':_0x5e3abd}:null;}})[_0x81ba('0x1d')](respondWithResult(_0x22b5c1,null))[_0x81ba('0x28')](handleError(_0x22b5c1,null));};exports[_0x81ba('0x59')]=function(_0x15ea0f,_0x2f8758,_0x3a915a){var _0x57d26c={};var _0x1b8edb={};var _0xfdfeed;var _0x583b39;return db[_0x81ba('0x38')][_0x81ba('0x54')]({'where':{'id':_0x15ea0f[_0x81ba('0x52')]['id']}})[_0x81ba('0x1d')](handleEntityNotFound(_0x2f8758,null))[_0x81ba('0x1d')](function(_0x212683){if(_0x212683){_0xfdfeed=_0x212683;_0x1b8edb['model']=_['keys'](db[_0x81ba('0x55')]['rawAttributes']);_0x1b8edb['query']=_['keys'](_0x15ea0f[_0x81ba('0x3b')]);_0x1b8edb['filters']=_[_0x81ba('0x3f')](_0x1b8edb[_0x81ba('0x3d')],_0x1b8edb[_0x81ba('0x3b')]);_0x57d26c[_0x81ba('0x3e')]=_[_0x81ba('0x3f')](_0x1b8edb[_0x81ba('0x3d')],qs[_0x81ba('0x40')](_0x15ea0f[_0x81ba('0x3b')][_0x81ba('0x40')]));_0x57d26c[_0x81ba('0x3e')]=_0x57d26c[_0x81ba('0x3e')][_0x81ba('0x41')]?_0x57d26c[_0x81ba('0x3e')]:_0x1b8edb['model'];_0x57d26c[_0x81ba('0x43')]=qs[_0x81ba('0x44')](_0x15ea0f[_0x81ba('0x3b')][_0x81ba('0x44')]);_0x57d26c['where']=qs[_0x81ba('0x3c')](_[_0x81ba('0x56')](_0x15ea0f[_0x81ba('0x3b')],_0x1b8edb[_0x81ba('0x3c')]));if(_0x15ea0f[_0x81ba('0x3b')][_0x81ba('0x45')]){_0x57d26c[_0x81ba('0x46')]=_[_0x81ba('0x48')](_0x57d26c[_0x81ba('0x46')],{'$or':_['map'](_0x57d26c[_0x81ba('0x3e')],function(_0x1ec54b){var _0x21448e={};_0x21448e[_0x1ec54b]={'$like':'%'+_0x15ea0f[_0x81ba('0x3b')][_0x81ba('0x45')]+'%'};return _0x21448e;})});}_0x57d26c=_[_0x81ba('0x48')]({},_0x57d26c,_0x15ea0f[_0x81ba('0x4e')]);return _0xfdfeed[_0x81ba('0x59')](_0x57d26c);}})[_0x81ba('0x1d')](function(_0x25e69d){if(_0x25e69d){_0x583b39=_0x25e69d[_0x81ba('0x41')];if(!_0x15ea0f[_0x81ba('0x3b')][_0x81ba('0x42')]('nolimit')){_0x57d26c[_0x81ba('0x2f')]=qs[_0x81ba('0x2f')](_0x15ea0f[_0x81ba('0x3b')][_0x81ba('0x2f')]);_0x57d26c['offset']=qs[_0x81ba('0x2e')](_0x15ea0f['query'][_0x81ba('0x2e')]);}return _0xfdfeed['getDescriptions'](_0x57d26c);}})['then'](function(_0x2b17fd){if(_0x2b17fd){return _0x2b17fd?{'count':_0x583b39,'rows':_0x2b17fd}:null;}})['then'](respondWithResult(_0x2f8758,null))['catch'](handleError(_0x2f8758,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9b008d9..f947dbd 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 _0xa251=['request-promise','path','rimraf','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55269c,_0x38873d){var _0x570f64=function(_0xa64e60){while(--_0xa64e60){_0x55269c['push'](_0x55269c['shift']());}};_0x570f64(++_0x38873d);}(_0xa251,0x162));var _0x1a25=function(_0x3a44e4,_0x3ab711){_0x3a44e4=_0x3a44e4-0x0;var _0x2c94c1=_0xa251[_0x3a44e4];return _0x2c94c1;};'use strict';var _=require(_0x1a25('0x0'));var util=require(_0x1a25('0x1'));var logger=require(_0x1a25('0x2'))(_0x1a25('0x3'));var moment=require(_0x1a25('0x4'));var BPromise=require(_0x1a25('0x5'));var rp=require(_0x1a25('0x6'));var fs=require('fs');var path=require(_0x1a25('0x7'));var rimraf=require(_0x1a25('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x1a25('0x9')]=function(_0xc49b05,_0x531287){return _0xc49b05[_0x1a25('0xa')]('VtigerConfiguration',attributes,{'tableName':_0x1a25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca6c=['moment','request-promise','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','lodash','util','../../config/logger','api'];(function(_0xa144e7,_0x30ff6f){var _0x527237=function(_0x3c8e86){while(--_0x3c8e86){_0xa144e7['push'](_0xa144e7['shift']());}};_0x527237(++_0x30ff6f);}(_0xca6c,0xe2));var _0xcca6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcca6('0x0'));var util=require(_0xcca6('0x1'));var logger=require(_0xcca6('0x2'))(_0xcca6('0x3'));var moment=require(_0xcca6('0x4'));var BPromise=require('bluebird');var rp=require(_0xcca6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcca6('0x6'));var attributes=require(_0xcca6('0x7'));module['exports']=function(_0xdd7bcd,_0x1c6d74){return _0xdd7bcd[_0xcca6('0x8')](_0xcca6('0x9'),attributes,{'tableName':'int_vtiger_configurations','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 305f518..73a4363 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 _0xb9ad=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x28623c,_0x20b941){var _0x8d44b1=function(_0x5ca8c9){while(--_0x5ca8c9){_0x28623c['push'](_0x28623c['shift']());}};_0x8d44b1(++_0x20b941);}(_0xb9ad,0x125));var _0xdb9a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb9ad[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xdb9a('0x0'));var moment=require(_0xdb9a('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb9a('0x2'));var fs=require('fs');var Redis=require(_0xdb9a('0x3'));var db=require(_0xdb9a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb9a('0x5'))(_0xdb9a('0x6'));var config=require(_0xdb9a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdb9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50a416,_0x46c8e6,_0x252a41){return new BPromise(function(_0x229089,_0x52bde8){return client[_0xdb9a('0x9')](_0x50a416,_0x252a41)[_0xdb9a('0xa')](function(_0xf6cb9){logger['info'](_0xdb9a('0xb'),_0x46c8e6,_0xdb9a('0xc'));logger['debug'](_0xdb9a('0xd'),_0x46c8e6,_0xdb9a('0xc'),JSON['stringify'](_0xf6cb9));if(_0xf6cb9[_0xdb9a('0xe')]){if(_0xf6cb9['error'][_0xdb9a('0xf')]===0x1f4){logger[_0xdb9a('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x46c8e6,_0xf6cb9[_0xdb9a('0xe')][_0xdb9a('0x10')]);return _0x52bde8(_0xf6cb9[_0xdb9a('0xe')][_0xdb9a('0x10')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x46c8e6,_0xf6cb9[_0xdb9a('0xe')][_0xdb9a('0x10')]);return _0x229089(_0xf6cb9[_0xdb9a('0xe')][_0xdb9a('0x10')]);}else{logger['info'](_0xdb9a('0xb'),_0x46c8e6,_0xdb9a('0xc'));_0x229089(_0xf6cb9[_0xdb9a('0x11')][_0xdb9a('0x10')]);}})[_0xdb9a('0x12')](function(_0x52923e){logger[_0xdb9a('0xe')](_0xdb9a('0xb'),_0x46c8e6,_0x52923e);_0x52bde8(_0x52923e);});});} \ No newline at end of file +var _0x6626=['result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1f2aa5,_0x389c28){var _0x24b97c=function(_0x43300f){while(--_0x43300f){_0x1f2aa5['push'](_0x1f2aa5['shift']());}};_0x24b97c(++_0x389c28);}(_0x6626,0x106));var _0x6662=function(_0x4f8226,_0xa6dc43){_0x4f8226=_0x4f8226-0x0;var _0x341ae6=_0x6626[_0x4f8226];return _0x341ae6;};'use strict';var _=require(_0x6662('0x0'));var util=require('util');var moment=require(_0x6662('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6662('0x2'));var db=require(_0x6662('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6662('0x4'))(_0x6662('0x5'));var config=require(_0x6662('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6662('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4829cb,_0x413e46,_0x26df99){return new BPromise(function(_0x49aff0,_0x33035b){return client[_0x6662('0x8')](_0x4829cb,_0x26df99)[_0x6662('0x9')](function(_0x4d1ecd){logger[_0x6662('0xa')](_0x6662('0xb'),_0x413e46,_0x6662('0xc'));logger[_0x6662('0xd')](_0x6662('0xe'),_0x413e46,'request\x20sent',JSON[_0x6662('0xf')](_0x4d1ecd));if(_0x4d1ecd[_0x6662('0x10')]){if(_0x4d1ecd['error']['code']===0x1f4){logger[_0x6662('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x413e46,_0x4d1ecd[_0x6662('0x10')][_0x6662('0x11')]);return _0x33035b(_0x4d1ecd['error'][_0x6662('0x11')]);}logger[_0x6662('0x10')](_0x6662('0xb'),_0x413e46,_0x4d1ecd[_0x6662('0x10')][_0x6662('0x11')]);return _0x49aff0(_0x4d1ecd[_0x6662('0x10')]['message']);}else{logger[_0x6662('0xa')](_0x6662('0xb'),_0x413e46,_0x6662('0xc'));_0x49aff0(_0x4d1ecd[_0x6662('0x12')][_0x6662('0x11')]);}})[_0x6662('0x13')](function(_0x54ced9){logger['error'](_0x6662('0xb'),_0x413e46,_0x54ced9);_0x33035b(_0x54ced9);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0755bee..660e424 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 _0x8dad=['connect-timeout','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','put','update','delete','destroy','exports','util','path'];(function(_0x667487,_0x3c1c66){var _0x153566=function(_0x3422ca){while(--_0x3422ca){_0x667487['push'](_0x667487['shift']());}};_0x153566(++_0x3c1c66);}(_0x8dad,0xa7));var _0xd8da=function(_0x2574c6,_0xa470db){_0x2574c6=_0x2574c6-0x0;var _0x24e4a3=_0x8dad[_0x2574c6];return _0x24e4a3;};'use strict';var multer=require('multer');var util=require(_0xd8da('0x0'));var path=require(_0xd8da('0x1'));var timeout=require(_0xd8da('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8da('0x3'));var controller=require(_0xd8da('0x4'));router['get']('/',auth[_0xd8da('0x5')](),controller[_0xd8da('0x6')]);router[_0xd8da('0x7')]('/:id',auth[_0xd8da('0x5')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd8da('0x8')]('/:id',auth[_0xd8da('0x5')](),controller[_0xd8da('0x9')]);router[_0xd8da('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd8da('0xb')]);module[_0xd8da('0xc')]=router; \ No newline at end of file +var _0xa5d4=['update','delete','multer','util','path','express','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0xc40e1c,_0x287bf5){var _0x3e368f=function(_0x5b64d2){while(--_0x5b64d2){_0xc40e1c['push'](_0xc40e1c['shift']());}};_0x3e368f(++_0x287bf5);}(_0xa5d4,0x122));var _0x4a5d=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xa5d4[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x4a5d('0x0'));var util=require(_0x4a5d('0x1'));var path=require(_0x4a5d('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a5d('0x3'));var router=express['Router']();var auth=require(_0x4a5d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4a5d('0x5'));var controller=require(_0x4a5d('0x6'));router[_0x4a5d('0x7')]('/',auth[_0x4a5d('0x8')](),controller[_0x4a5d('0x9')]);router[_0x4a5d('0x7')](_0x4a5d('0xa'),auth[_0x4a5d('0x8')](),controller[_0x4a5d('0xb')]);router[_0x4a5d('0xc')]('/',auth[_0x4a5d('0x8')](),controller['create']);router[_0x4a5d('0xd')](_0x4a5d('0xa'),auth[_0x4a5d('0x8')](),controller[_0x4a5d('0xe')]);router[_0x4a5d('0xf')](_0x4a5d('0xa'),auth[_0x4a5d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a0ef0e3..0fc3cc4 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 _0xa13d=['string','customVariable','STRING','variable','sequelize','ENUM'];(function(_0x41a820,_0x48fa55){var _0xf3311f=function(_0x161e98){while(--_0x161e98){_0x41a820['push'](_0x41a820['shift']());}};_0xf3311f(++_0x48fa55);}(_0xa13d,0x154));var _0xda13=function(_0x3a6824,_0x2250f1){_0x3a6824=_0x3a6824-0x0;var _0x574927=_0xa13d[_0x3a6824];return _0x574927;};'use strict';var Sequelize=require(_0xda13('0x0'));module['exports']={'type':{'type':Sequelize[_0xda13('0x1')](_0xda13('0x2'),'variable',_0xda13('0x3'),'keyValue'),'defaultValue':_0xda13('0x2')},'content':{'type':Sequelize[_0xda13('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xda13('0x2'),_0xda13('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0xda13('0x4')]},'idField':{'type':Sequelize[_0xda13('0x4')]},'nameField':{'type':Sequelize[_0xda13('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xda13('0x4')]}}; \ No newline at end of file +var _0x2a9b=['ENUM','exports','variable','customVariable','string','STRING'];(function(_0x496bb9,_0x5d3490){var _0x1d3524=function(_0xe67c58){while(--_0xe67c58){_0x496bb9['push'](_0x496bb9['shift']());}};_0x1d3524(++_0x5d3490);}(_0x2a9b,0x14b));var _0xb2a9=function(_0x50bb8f,_0x27a332){_0x50bb8f=_0x50bb8f-0x0;var _0x37da65=_0x2a9b[_0x50bb8f];return _0x37da65;};'use strict';var Sequelize=require('sequelize');module[_0xb2a9('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xb2a9('0x1'),_0xb2a9('0x2'),'keyValue'),'defaultValue':_0xb2a9('0x3')},'content':{'type':Sequelize[_0xb2a9('0x4')]},'key':{'type':Sequelize[_0xb2a9('0x4')]},'keyType':{'type':Sequelize[_0xb2a9('0x5')](_0xb2a9('0x3'),_0xb2a9('0x1'),_0xb2a9('0x2'))},'keyContent':{'type':Sequelize[_0xb2a9('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ff7d788..de63fb7 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 _0xfeff=['merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','find','html-pdf','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xfeff,0xe5));var _0xffef=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xfeff[_0x20589d];return _0x422de9;};'use strict';var pdf=require(_0xffef('0x0'));var emlformat=require(_0xffef('0x1'));var rimraf=require(_0xffef('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xffef('0x3'));var Mustache=require(_0xffef('0x4'));var util=require(_0xffef('0x5'));var path=require(_0xffef('0x6'));var sox=require(_0xffef('0x7'));var csv=require(_0xffef('0x8'));var ejs=require(_0xffef('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xffef('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xffef('0xb'));var toCsv=require(_0xffef('0x8'));var querystring=require('querystring');var Papa=require(_0xffef('0xc'));var Redis=require(_0xffef('0xd'));var authService=require(_0xffef('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xffef('0xf'));var hardwareService=require(_0xffef('0x10'));var logger=require(_0xffef('0x11'))(_0xffef('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xffef('0x13'))['db'];function respondWithStatusCode(_0x106431,_0x37dba1){_0x37dba1=_0x37dba1||0xcc;return function(_0x553c37){if(_0x553c37){return _0x106431[_0xffef('0x14')](_0x37dba1);}return _0x106431[_0xffef('0x15')](_0x37dba1)[_0xffef('0x16')]();};}function respondWithResult(_0x483b5f,_0x1236ee){_0x1236ee=_0x1236ee||0xc8;return function(_0x3ec520){if(_0x3ec520){return _0x483b5f[_0xffef('0x15')](_0x1236ee)[_0xffef('0x17')](_0x3ec520);}};}function respondWithFilteredResult(_0x3d4223,_0x3f2765){return function(_0x1ff561){if(_0x1ff561){var _0x1f972b=_0x1ff561[_0xffef('0x18')],_0x2ab696=_0x3f2765[_0xffef('0x19')],_0x57ff61=_0x3f2765[_0xffef('0x19')]+_0x3f2765['limit'],_0x43abce;if(_0x57ff61>=_0x1f972b){_0x57ff61=_0x1f972b;_0x43abce=0xc8;}else{_0x43abce=0xce;}_0x3d4223[_0xffef('0x15')](_0x43abce);return _0x3d4223[_0xffef('0x1a')](_0xffef('0x1b'),_0x2ab696+'-'+_0x57ff61+'/'+_0x1f972b)['json'](_0x1ff561);}return null;};}function patchUpdates(_0x5d0bd0){return function(_0x29c720){try{jsonpatch[_0xffef('0x1c')](_0x29c720,_0x5d0bd0,!![]);}catch(_0x460232){return BPromise[_0xffef('0x1d')](_0x460232);}return _0x29c720[_0xffef('0x1e')]();};}function saveUpdates(_0x1b1dc3,_0x423eaa){return function(_0xa4ed95){if(_0xa4ed95){return _0xa4ed95[_0xffef('0x1f')](_0x1b1dc3)[_0xffef('0x20')](function(_0x24a3fc){return _0x24a3fc;});}return null;};}function removeEntity(_0x3644ed,_0x132216){return function(_0x16d167){if(_0x16d167){return _0x16d167[_0xffef('0x21')]()[_0xffef('0x20')](function(){_0x3644ed[_0xffef('0x15')](0xcc)[_0xffef('0x16')]();});}};}function handleEntityNotFound(_0x3f5de2,_0x3cf6e4){return function(_0x48bbf2){if(!_0x48bbf2){_0x3f5de2[_0xffef('0x14')](0x194);}return _0x48bbf2;};}function handleError(_0x49dabd,_0x3a9b21){_0x3a9b21=_0x3a9b21||0x1f4;return function(_0x514f91){logger[_0xffef('0x22')](_0x514f91['stack']);if(_0x514f91[_0xffef('0x23')]){delete _0x514f91[_0xffef('0x23')];}_0x49dabd[_0xffef('0x15')](_0x3a9b21)[_0xffef('0x24')](_0x514f91);};}exports[_0xffef('0x25')]=function(_0x1bea0e,_0x3e6ba3){var _0x455c24={},_0x5e3533={},_0x985603={'count':0x0,'rows':[]};var _0x32b125=_['map'](db[_0xffef('0x26')][_0xffef('0x27')],function(_0x51d762){return{'name':_0x51d762[_0xffef('0x28')],'type':_0x51d762[_0xffef('0x29')][_0xffef('0x2a')]};});_0x5e3533[_0xffef('0x2b')]=_['map'](_0x32b125,_0xffef('0x23'));_0x5e3533[_0xffef('0x2c')]=_[_0xffef('0x2d')](_0x1bea0e[_0xffef('0x2c')]);_0x5e3533[_0xffef('0x2e')]=_['intersection'](_0x5e3533[_0xffef('0x2b')],_0x5e3533[_0xffef('0x2c')]);_0x455c24[_0xffef('0x2f')]=_[_0xffef('0x30')](_0x5e3533[_0xffef('0x2b')],qs[_0xffef('0x31')](_0x1bea0e[_0xffef('0x2c')][_0xffef('0x31')]));_0x455c24[_0xffef('0x2f')]=_0x455c24[_0xffef('0x2f')][_0xffef('0x32')]?_0x455c24[_0xffef('0x2f')]:_0x5e3533[_0xffef('0x2b')];if(!_0x1bea0e['query'][_0xffef('0x33')](_0xffef('0x34'))){_0x455c24[_0xffef('0x35')]=qs['limit'](_0x1bea0e[_0xffef('0x2c')]['limit']);_0x455c24[_0xffef('0x19')]=qs['offset'](_0x1bea0e['query'][_0xffef('0x19')]);}_0x455c24[_0xffef('0x36')]=qs['sort'](_0x1bea0e[_0xffef('0x2c')][_0xffef('0x37')]);_0x455c24[_0xffef('0x38')]=qs[_0xffef('0x2e')](_[_0xffef('0x39')](_0x1bea0e['query'],_0x5e3533['filters']),_0x32b125);if(_0x1bea0e['query'][_0xffef('0x3a')]){_0x455c24[_0xffef('0x38')]=_[_0xffef('0x3b')](_0x455c24[_0xffef('0x38')],{'$or':_[_0xffef('0x3c')](_0x32b125,function(_0x106012){if(_0x106012[_0xffef('0x29')]!==_0xffef('0x3d')){var _0x21a70b={};_0x21a70b[_0x106012[_0xffef('0x23')]]={'$like':'%'+_0x1bea0e[_0xffef('0x2c')][_0xffef('0x3a')]+'%'};return _0x21a70b;}})});}_0x455c24=_[_0xffef('0x3b')]({},_0x455c24,_0x1bea0e[_0xffef('0x3e')]);var _0x58b62c={'where':_0x455c24[_0xffef('0x38')]};return db['VtigerField'][_0xffef('0x18')](_0x58b62c)[_0xffef('0x20')](function(_0xebb2c7){_0x985603[_0xffef('0x18')]=_0xebb2c7;if(_0x1bea0e[_0xffef('0x2c')][_0xffef('0x3f')]){_0x455c24['include']=[{'all':!![]}];}return db['VtigerField'][_0xffef('0x40')](_0x455c24);})[_0xffef('0x20')](function(_0x3a9a6d){_0x985603[_0xffef('0x41')]=_0x3a9a6d;return _0x985603;})[_0xffef('0x20')](respondWithFilteredResult(_0x3e6ba3,_0x455c24))[_0xffef('0x42')](handleError(_0x3e6ba3,null));};exports['show']=function(_0x5a252f,_0x2e8d52){var _0x50538f={'raw':!![],'where':{'id':_0x5a252f[_0xffef('0x43')]['id']}},_0x5a3117={};_0x5a3117[_0xffef('0x2b')]=_['keys'](db[_0xffef('0x26')][_0xffef('0x27')]);_0x5a3117['query']=_[_0xffef('0x2d')](_0x5a252f[_0xffef('0x2c')]);_0x5a3117[_0xffef('0x2e')]=_[_0xffef('0x30')](_0x5a3117[_0xffef('0x2b')],_0x5a3117[_0xffef('0x2c')]);_0x50538f['attributes']=_[_0xffef('0x30')](_0x5a3117['model'],qs[_0xffef('0x31')](_0x5a252f[_0xffef('0x2c')][_0xffef('0x31')]));_0x50538f[_0xffef('0x2f')]=_0x50538f['attributes'][_0xffef('0x32')]?_0x50538f[_0xffef('0x2f')]:_0x5a3117['model'];if(_0x5a252f['query'][_0xffef('0x3f')]){_0x50538f[_0xffef('0x44')]=[{'all':!![]}];}_0x50538f=_[_0xffef('0x3b')]({},_0x50538f,_0x5a252f['options']);return db[_0xffef('0x26')]['find'](_0x50538f)['then'](handleEntityNotFound(_0x2e8d52,null))[_0xffef('0x20')](respondWithResult(_0x2e8d52,null))[_0xffef('0x42')](handleError(_0x2e8d52,null));};exports[_0xffef('0x45')]=function(_0x4fdd1e,_0x2bf055){return db[_0xffef('0x26')][_0xffef('0x45')](_0x4fdd1e['body'],{})['then'](respondWithResult(_0x2bf055,0xc9))[_0xffef('0x42')](handleError(_0x2bf055,null));};exports[_0xffef('0x1f')]=function(_0x59db3d,_0x3c1712){if(_0x59db3d[_0xffef('0x46')]['id']){delete _0x59db3d[_0xffef('0x46')]['id'];}return db['VtigerField'][_0xffef('0x47')]({'where':{'id':_0x59db3d[_0xffef('0x43')]['id']}})[_0xffef('0x20')](handleEntityNotFound(_0x3c1712,null))[_0xffef('0x20')](saveUpdates(_0x59db3d[_0xffef('0x46')],null))[_0xffef('0x20')](respondWithResult(_0x3c1712,null))[_0xffef('0x42')](handleError(_0x3c1712,null));};exports[_0xffef('0x21')]=function(_0x5bfd14,_0x109f4d){return db[_0xffef('0x26')]['find']({'where':{'id':_0x5bfd14[_0xffef('0x43')]['id']}})[_0xffef('0x20')](handleEntityNotFound(_0x109f4d,null))['then'](removeEntity(_0x109f4d,null))[_0xffef('0x42')](handleError(_0x109f4d,null));}; \ No newline at end of file +var _0x4f14=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware'];(function(_0x41f7d1,_0xe1382e){var _0x5040f3=function(_0x528d2d){while(--_0x528d2d){_0x41f7d1['push'](_0x41f7d1['shift']());}};_0x5040f3(++_0xe1382e);}(_0x4f14,0xb3));var _0x44f1=function(_0x3a9a79,_0xb12070){_0x3a9a79=_0x3a9a79-0x0;var _0x2a7bd0=_0x4f14[_0x3a9a79];return _0x2a7bd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x44f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44f1('0x1'));var jsonpatch=require(_0x44f1('0x2'));var rp=require(_0x44f1('0x3'));var moment=require('moment');var BPromise=require(_0x44f1('0x4'));var Mustache=require(_0x44f1('0x5'));var util=require(_0x44f1('0x6'));var path=require(_0x44f1('0x7'));var sox=require('sox');var csv=require(_0x44f1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x44f1('0x9'));var squel=require('squel');var crypto=require(_0x44f1('0xa'));var jsforce=require(_0x44f1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x44f1('0x8'));var querystring=require(_0x44f1('0xc'));var Papa=require(_0x44f1('0xd'));var Redis=require('ioredis');var authService=require(_0x44f1('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44f1('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x44f1('0x10'));var db=require(_0x44f1('0x11'))['db'];function respondWithStatusCode(_0x5749bc,_0xf2a266){_0xf2a266=_0xf2a266||0xcc;return function(_0x5dfb47){if(_0x5dfb47){return _0x5749bc[_0x44f1('0x12')](_0xf2a266);}return _0x5749bc[_0x44f1('0x13')](_0xf2a266)[_0x44f1('0x14')]();};}function respondWithResult(_0x7e3bd2,_0x385cf7){_0x385cf7=_0x385cf7||0xc8;return function(_0x52e9c5){if(_0x52e9c5){return _0x7e3bd2[_0x44f1('0x13')](_0x385cf7)[_0x44f1('0x15')](_0x52e9c5);}};}function respondWithFilteredResult(_0x500a46,_0x33a829){return function(_0x1f4463){if(_0x1f4463){var _0x4d44cd=_0x1f4463[_0x44f1('0x16')],_0x344c5c=_0x33a829[_0x44f1('0x17')],_0x6b3ba7=_0x33a829[_0x44f1('0x17')]+_0x33a829[_0x44f1('0x18')],_0x58879f;if(_0x6b3ba7>=_0x4d44cd){_0x6b3ba7=_0x4d44cd;_0x58879f=0xc8;}else{_0x58879f=0xce;}_0x500a46['status'](_0x58879f);return _0x500a46[_0x44f1('0x19')](_0x44f1('0x1a'),_0x344c5c+'-'+_0x6b3ba7+'/'+_0x4d44cd)['json'](_0x1f4463);}return null;};}function patchUpdates(_0x4194d5){return function(_0x427d8b){try{jsonpatch['apply'](_0x427d8b,_0x4194d5,!![]);}catch(_0x5d7a44){return BPromise[_0x44f1('0x1b')](_0x5d7a44);}return _0x427d8b[_0x44f1('0x1c')]();};}function saveUpdates(_0x323480,_0xf2e523){return function(_0x275e3f){if(_0x275e3f){return _0x275e3f[_0x44f1('0x1d')](_0x323480)[_0x44f1('0x1e')](function(_0x97c3e9){return _0x97c3e9;});}return null;};}function removeEntity(_0x502dcd,_0x280bb4){return function(_0x1ce1b5){if(_0x1ce1b5){return _0x1ce1b5[_0x44f1('0x1f')]()[_0x44f1('0x1e')](function(){_0x502dcd[_0x44f1('0x13')](0xcc)[_0x44f1('0x14')]();});}};}function handleEntityNotFound(_0x2af482,_0x3dd40c){return function(_0x22a114){if(!_0x22a114){_0x2af482[_0x44f1('0x12')](0x194);}return _0x22a114;};}function handleError(_0x1fa8e1,_0x31759a){_0x31759a=_0x31759a||0x1f4;return function(_0x24f9f0){logger['error'](_0x24f9f0['stack']);if(_0x24f9f0[_0x44f1('0x20')]){delete _0x24f9f0['name'];}_0x1fa8e1[_0x44f1('0x13')](_0x31759a)[_0x44f1('0x21')](_0x24f9f0);};}exports['index']=function(_0x279316,_0x3e30a8){var _0x2b4cc0={},_0x5d1a79={},_0xcf4953={'count':0x0,'rows':[]};var _0x12a8a7=_[_0x44f1('0x22')](db[_0x44f1('0x23')][_0x44f1('0x24')],function(_0x4b13d7){return{'name':_0x4b13d7[_0x44f1('0x25')],'type':_0x4b13d7[_0x44f1('0x26')][_0x44f1('0x27')]};});_0x5d1a79['model']=_[_0x44f1('0x22')](_0x12a8a7,_0x44f1('0x20'));_0x5d1a79[_0x44f1('0x28')]=_[_0x44f1('0x29')](_0x279316[_0x44f1('0x28')]);_0x5d1a79['filters']=_[_0x44f1('0x2a')](_0x5d1a79[_0x44f1('0x2b')],_0x5d1a79[_0x44f1('0x28')]);_0x2b4cc0[_0x44f1('0x2c')]=_['intersection'](_0x5d1a79[_0x44f1('0x2b')],qs[_0x44f1('0x2d')](_0x279316[_0x44f1('0x28')]['fields']));_0x2b4cc0[_0x44f1('0x2c')]=_0x2b4cc0[_0x44f1('0x2c')][_0x44f1('0x2e')]?_0x2b4cc0[_0x44f1('0x2c')]:_0x5d1a79[_0x44f1('0x2b')];if(!_0x279316[_0x44f1('0x28')][_0x44f1('0x2f')](_0x44f1('0x30'))){_0x2b4cc0['limit']=qs[_0x44f1('0x18')](_0x279316[_0x44f1('0x28')][_0x44f1('0x18')]);_0x2b4cc0[_0x44f1('0x17')]=qs[_0x44f1('0x17')](_0x279316[_0x44f1('0x28')][_0x44f1('0x17')]);}_0x2b4cc0[_0x44f1('0x31')]=qs[_0x44f1('0x32')](_0x279316[_0x44f1('0x28')]['sort']);_0x2b4cc0[_0x44f1('0x33')]=qs[_0x44f1('0x34')](_[_0x44f1('0x35')](_0x279316[_0x44f1('0x28')],_0x5d1a79[_0x44f1('0x34')]),_0x12a8a7);if(_0x279316[_0x44f1('0x28')][_0x44f1('0x36')]){_0x2b4cc0[_0x44f1('0x33')]=_[_0x44f1('0x37')](_0x2b4cc0[_0x44f1('0x33')],{'$or':_[_0x44f1('0x22')](_0x12a8a7,function(_0x4829fe){if(_0x4829fe[_0x44f1('0x26')]!==_0x44f1('0x38')){var _0x267d2c={};_0x267d2c[_0x4829fe[_0x44f1('0x20')]]={'$like':'%'+_0x279316[_0x44f1('0x28')]['filter']+'%'};return _0x267d2c;}})});}_0x2b4cc0=_[_0x44f1('0x37')]({},_0x2b4cc0,_0x279316[_0x44f1('0x39')]);var _0x9c1475={'where':_0x2b4cc0[_0x44f1('0x33')]};return db[_0x44f1('0x23')][_0x44f1('0x16')](_0x9c1475)[_0x44f1('0x1e')](function(_0xdea722){_0xcf4953[_0x44f1('0x16')]=_0xdea722;if(_0x279316[_0x44f1('0x28')][_0x44f1('0x3a')]){_0x2b4cc0[_0x44f1('0x3b')]=[{'all':!![]}];}return db[_0x44f1('0x23')]['findAll'](_0x2b4cc0);})[_0x44f1('0x1e')](function(_0x5c1dac){_0xcf4953['rows']=_0x5c1dac;return _0xcf4953;})[_0x44f1('0x1e')](respondWithFilteredResult(_0x3e30a8,_0x2b4cc0))[_0x44f1('0x3c')](handleError(_0x3e30a8,null));};exports['show']=function(_0x1db3f7,_0x420e63){var _0x24726c={'raw':!![],'where':{'id':_0x1db3f7[_0x44f1('0x3d')]['id']}},_0x14ccc6={};_0x14ccc6[_0x44f1('0x2b')]=_[_0x44f1('0x29')](db[_0x44f1('0x23')]['rawAttributes']);_0x14ccc6[_0x44f1('0x28')]=_[_0x44f1('0x29')](_0x1db3f7[_0x44f1('0x28')]);_0x14ccc6[_0x44f1('0x34')]=_[_0x44f1('0x2a')](_0x14ccc6[_0x44f1('0x2b')],_0x14ccc6[_0x44f1('0x28')]);_0x24726c[_0x44f1('0x2c')]=_[_0x44f1('0x2a')](_0x14ccc6[_0x44f1('0x2b')],qs[_0x44f1('0x2d')](_0x1db3f7[_0x44f1('0x28')][_0x44f1('0x2d')]));_0x24726c[_0x44f1('0x2c')]=_0x24726c[_0x44f1('0x2c')][_0x44f1('0x2e')]?_0x24726c[_0x44f1('0x2c')]:_0x14ccc6[_0x44f1('0x2b')];if(_0x1db3f7[_0x44f1('0x28')]['includeAll']){_0x24726c[_0x44f1('0x3b')]=[{'all':!![]}];}_0x24726c=_['merge']({},_0x24726c,_0x1db3f7[_0x44f1('0x39')]);return db[_0x44f1('0x23')]['find'](_0x24726c)[_0x44f1('0x1e')](handleEntityNotFound(_0x420e63,null))['then'](respondWithResult(_0x420e63,null))[_0x44f1('0x3c')](handleError(_0x420e63,null));};exports['create']=function(_0x235561,_0x5c3384){return db['VtigerField'][_0x44f1('0x3e')](_0x235561[_0x44f1('0x3f')],{})[_0x44f1('0x1e')](respondWithResult(_0x5c3384,0xc9))[_0x44f1('0x3c')](handleError(_0x5c3384,null));};exports[_0x44f1('0x1d')]=function(_0x196b20,_0x26a5b1){if(_0x196b20[_0x44f1('0x3f')]['id']){delete _0x196b20[_0x44f1('0x3f')]['id'];}return db[_0x44f1('0x23')][_0x44f1('0x40')]({'where':{'id':_0x196b20['params']['id']}})[_0x44f1('0x1e')](handleEntityNotFound(_0x26a5b1,null))['then'](saveUpdates(_0x196b20['body'],null))[_0x44f1('0x1e')](respondWithResult(_0x26a5b1,null))[_0x44f1('0x3c')](handleError(_0x26a5b1,null));};exports[_0x44f1('0x1f')]=function(_0x5a1d8f,_0x4f5617){return db[_0x44f1('0x23')][_0x44f1('0x40')]({'where':{'id':_0x5a1d8f[_0x44f1('0x3d')]['id']}})[_0x44f1('0x1e')](handleEntityNotFound(_0x4f5617,null))[_0x44f1('0x1e')](removeEntity(_0x4f5617,null))['catch'](handleError(_0x4f5617,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0b66072..6d938cb 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x5de979,_0x150ade){var _0x4e6f1b=function(_0x336ca7){while(--_0x336ca7){_0x5de979['push'](_0x5de979['shift']());}};_0x4e6f1b(++_0x150ade);}(_0x7a54,0x106));var _0x47a5=function(_0x336675,_0xc521b4){_0x336675=_0x336675-0x0;var _0x179198=_0x7a54[_0x336675];return _0x179198;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_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 diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index d9b5994..e61a07c 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 _0x9db7=['client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4577d1,_0x4d7e3b){var _0x10dabb=function(_0x595fce){while(--_0x595fce){_0x4577d1['push'](_0x4577d1['shift']());}};_0x10dabb(++_0x4d7e3b);}(_0x9db7,0x1bf));var _0x79db=function(_0x27c2a2,_0x2ce50a){_0x27c2a2=_0x27c2a2-0x0;var _0x3cf0b5=_0x9db7[_0x27c2a2];return _0x3cf0b5;};'use strict';var _=require(_0x79db('0x0'));var util=require(_0x79db('0x1'));var moment=require(_0x79db('0x2'));var BPromise=require(_0x79db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x79db('0x5'));var logger=require(_0x79db('0x6'))('rpc');var config=require(_0x79db('0x7'));var jayson=require(_0x79db('0x8'));var client=jayson[_0x79db('0x9')][_0x79db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7980b1,_0x395883,_0x214bf9){return new BPromise(function(_0x792510,_0x27d02a){return client[_0x79db('0xb')](_0x7980b1,_0x214bf9)[_0x79db('0xc')](function(_0x145a31){logger['info'](_0x79db('0xd'),_0x395883,_0x79db('0xe'));logger[_0x79db('0xf')](_0x79db('0x10'),_0x395883,_0x79db('0xe'),JSON[_0x79db('0x11')](_0x145a31));if(_0x145a31[_0x79db('0x12')]){if(_0x145a31[_0x79db('0x12')][_0x79db('0x13')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x395883,_0x145a31['error'][_0x79db('0x14')]);return _0x27d02a(_0x145a31['error'][_0x79db('0x14')]);}logger['error'](_0x79db('0xd'),_0x395883,_0x145a31[_0x79db('0x12')][_0x79db('0x14')]);return _0x792510(_0x145a31[_0x79db('0x12')][_0x79db('0x14')]);}else{logger[_0x79db('0x15')](_0x79db('0xd'),_0x395883,_0x79db('0xe'));_0x792510(_0x145a31[_0x79db('0x16')][_0x79db('0x14')]);}})[_0x79db('0x17')](function(_0x365889){logger[_0x79db('0x12')]('VtigerField,\x20%s,\x20%s',_0x395883,_0x365889);_0x27d02a(_0x365889);});});} \ No newline at end of file +var _0x1572=['info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\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(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x1572,0xf5));var _0x2157=function(_0xc67456,_0xa06632){_0xc67456=_0xc67456-0x0;var _0xc552c9=_0x1572[_0xc67456];return _0xc552c9;};'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/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1e948d2..7032575 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 _0xec17=['index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x4a5974,_0x17d46f){var _0xc26fef=function(_0x21dc30){while(--_0x21dc30){_0x4a5974['push'](_0x4a5974['shift']());}};_0xc26fef(++_0x17d46f);}(_0xec17,0x132));var _0x7ec1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xec17[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x7ec1('0x0'));var util=require(_0x7ec1('0x1'));var path=require(_0x7ec1('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ec1('0x3'));var router=express['Router']();var auth=require(_0x7ec1('0x4'));var interaction=require(_0x7ec1('0x5'));var config=require('../../config/environment');var controller=require(_0x7ec1('0x6'));router[_0x7ec1('0x7')]('/',auth[_0x7ec1('0x8')](),controller[_0x7ec1('0x9')]);router[_0x7ec1('0x7')](_0x7ec1('0xa'),auth[_0x7ec1('0x8')](),controller[_0x7ec1('0xb')]);router[_0x7ec1('0x7')](_0x7ec1('0xc'),auth[_0x7ec1('0x8')](),controller['getConfigurations']);router[_0x7ec1('0x7')](_0x7ec1('0xd'),auth[_0x7ec1('0x8')](),controller[_0x7ec1('0xe')]);router[_0x7ec1('0xf')]('/',auth['isAuthenticated'](),controller[_0x7ec1('0x10')]);router['post']('/:id/configurations',auth[_0x7ec1('0x8')](),controller[_0x7ec1('0x11')]);router[_0x7ec1('0x12')]('/:id',auth[_0x7ec1('0x8')](),controller['update']);router[_0x7ec1('0x13')]('/:id',auth[_0x7ec1('0x8')](),controller['destroy']);module[_0x7ec1('0x14')]=router; \ No newline at end of file +var _0xe9ae=['update','delete','destroy','exports','util','path','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0xec961f,_0x3a279d){var _0x2431bf=function(_0x32153d){while(--_0x32153d){_0xec961f['push'](_0xec961f['shift']());}};_0x2431bf(++_0x3a279d);}(_0xe9ae,0xf4));var _0xee9a=function(_0x5be914,_0x4cdd9a){_0x5be914=_0x5be914-0x0;var _0x38ac85=_0xe9ae[_0x5be914];return _0x38ac85;};'use strict';var multer=require('multer');var util=require(_0xee9a('0x0'));var path=require(_0xee9a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xee9a('0x2'));var interaction=require(_0xee9a('0x3'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0xee9a('0x4')](),controller[_0xee9a('0x5')]);router[_0xee9a('0x6')](_0xee9a('0x7'),auth[_0xee9a('0x4')](),controller[_0xee9a('0x8')]);router['get'](_0xee9a('0x9'),auth[_0xee9a('0x4')](),controller[_0xee9a('0xa')]);router[_0xee9a('0x6')](_0xee9a('0xb'),auth[_0xee9a('0x4')](),controller['getFields']);router[_0xee9a('0xc')]('/',auth[_0xee9a('0x4')](),controller[_0xee9a('0xd')]);router[_0xee9a('0xc')](_0xee9a('0x9'),auth[_0xee9a('0x4')](),controller[_0xee9a('0xe')]);router[_0xee9a('0xf')](_0xee9a('0x7'),auth['isAuthenticated'](),controller[_0xee9a('0x10')]);router[_0xee9a('0x11')](_0xee9a('0x7'),auth['isAuthenticated'](),controller[_0xee9a('0x12')]);module[_0xee9a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5e0b1f8..75c8721 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 _0x070e=['STRING','remoteUri','ENUM','password','integrationTab','sequelize'];(function(_0x5359dc,_0x1d1d33){var _0x26cd87=function(_0x3e6c49){while(--_0x3e6c49){_0x5359dc['push'](_0x5359dc['shift']());}};_0x26cd87(++_0x1d1d33);}(_0x070e,0xcb));var _0xe070=function(_0x324626,_0x320a3e){_0x324626=_0x324626-0x0;var _0x3e6a1e=_0x070e[_0x324626];return _0x3e6a1e;};'use strict';var Sequelize=require(_0xe070('0x0'));module['exports']={'name':{'type':Sequelize[_0xe070('0x1')]},'description':{'type':Sequelize[_0xe070('0x1')]},'username':{'type':Sequelize[_0xe070('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xe070('0x1')]},'token':{'type':Sequelize[_0xe070('0x1')]},'remoteUri':{'type':Sequelize[_0xe070('0x1')],'unique':_0xe070('0x2')},'authType':{'type':Sequelize[_0xe070('0x3')](_0xe070('0x4'),'token'),'defaultValue':_0xe070('0x4')},'serverUrl':{'type':Sequelize[_0xe070('0x1')]},'type':{'type':Sequelize[_0xe070('0x3')](_0xe070('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x987a=['integrationTab','newTab','sequelize','STRING','username','ENUM','password','token'];(function(_0x50846e,_0x3f5126){var _0x437cea=function(_0x2c62b7){while(--_0x2c62b7){_0x50846e['push'](_0x50846e['shift']());}};_0x437cea(++_0x3f5126);}(_0x987a,0xe2));var _0xa987=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x987a[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0xa987('0x0'));module['exports']={'name':{'type':Sequelize[_0xa987('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa987('0x1')],'unique':_0xa987('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa987('0x1')]},'remoteUri':{'type':Sequelize[_0xa987('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa987('0x3')](_0xa987('0x4'),_0xa987('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa987('0x3')](_0xa987('0x6'),_0xa987('0x7')),'defaultValue':_0xa987('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 74564ac..816bbaf 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 _0x4e68=['send','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','ZendeskAccount','count','include','findAll','rows','show','params','length','includeAll','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','Subjects','Descriptions','getDescriptions','ZendeskField','username','password','token','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','toString','Basic\x20%s','%s/token:%s','base64','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','custom_field_options','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','update','destroy','stack','name'];(function(_0x68fcd,_0x27864d){var _0x5ca46e=function(_0x50756f){while(--_0x50756f){_0x68fcd['push'](_0x68fcd['shift']());}};_0x5ca46e(++_0x27864d);}(_0x4e68,0x13e));var _0x84e6=function(_0x431dae,_0x214f73){_0x431dae=_0x431dae-0x0;var _0x5e2ff0=_0x4e68[_0x431dae];return _0x5e2ff0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x84e6('0x0'));var rimraf=require(_0x84e6('0x1'));var zipdir=require(_0x84e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84e6('0x3'));var moment=require(_0x84e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x84e6('0x5'));var util=require(_0x84e6('0x6'));var path=require(_0x84e6('0x7'));var sox=require(_0x84e6('0x8'));var csv=require(_0x84e6('0x9'));var ejs=require(_0x84e6('0xa'));var fs=require('fs');var _=require(_0x84e6('0xb'));var squel=require(_0x84e6('0xc'));var crypto=require('crypto');var jsforce=require(_0x84e6('0xd'));var deskjs=require(_0x84e6('0xe'));var toCsv=require(_0x84e6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x84e6('0xf'));var authService=require(_0x84e6('0x10'));var qs=require(_0x84e6('0x11'));var as=require(_0x84e6('0x12'));var hardwareService=require(_0x84e6('0x13'));var logger=require(_0x84e6('0x14'))(_0x84e6('0x15'));var utils=require(_0x84e6('0x16'));var config=require(_0x84e6('0x17'));var db=require(_0x84e6('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x84e6('0x19'));var client=jayson[_0x84e6('0x1a')][_0x84e6('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2e8b0a,_0x36d6bc,_0x44028a){if(_0x44028a){var _0x1c94fc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c94fc[_0x84e6('0x1c')](_0x36d6bc)){return _0x2e8b0a;}else{throw new db[(_0x84e6('0x1d'))][(_0x84e6('0x1e'))](_0x84e6('0x1f'));}}else{return _0x2e8b0a;}}function respondWithRpcPromise(_0x409fa4,_0x1650a5,_0x404a0b,_0x17c91c){return new BPromise(function(_0x248832,_0x4efc0b){var _0xdf858d=_0x17c91c||client;return _0xdf858d[_0x84e6('0x20')](_0x409fa4,_0x404a0b)[_0x84e6('0x21')](function(_0x2ae1cb){logger['info'](_0x84e6('0x22'),_0x1650a5,'request\x20sent');logger[_0x84e6('0x23')](_0x84e6('0x24'),_0x1650a5,_0x84e6('0x25'),JSON[_0x84e6('0x26')](_0x2ae1cb));if(_0x2ae1cb[_0x84e6('0x27')]){if(_0x2ae1cb[_0x84e6('0x27')][_0x84e6('0x28')]===0x1f4){logger[_0x84e6('0x27')]('ZendeskAccount,\x20%s,\x20%s',_0x1650a5,_0x2ae1cb[_0x84e6('0x27')]['message']);return _0x4efc0b(_0x2ae1cb[_0x84e6('0x27')][_0x84e6('0x29')]);}logger[_0x84e6('0x27')](_0x84e6('0x22'),_0x1650a5,_0x2ae1cb[_0x84e6('0x27')]['message']);return _0x248832(_0x2ae1cb[_0x84e6('0x27')][_0x84e6('0x29')]);}else{logger[_0x84e6('0x2a')](_0x84e6('0x22'),_0x1650a5,_0x84e6('0x25'));_0x248832(_0x2ae1cb[_0x84e6('0x2b')][_0x84e6('0x29')]);}})[_0x84e6('0x2c')](function(_0x2cd59e){logger[_0x84e6('0x27')](_0x84e6('0x22'),_0x1650a5,_0x2cd59e);_0x4efc0b(_0x2cd59e);});});}function respondWithStatusCode(_0x3f870a,_0x432d00){_0x432d00=_0x432d00||0xcc;return function(_0x424c73){if(_0x424c73){return _0x3f870a[_0x84e6('0x2d')](_0x432d00);}return _0x3f870a[_0x84e6('0x2e')](_0x432d00)[_0x84e6('0x2f')]();};}function respondWithResult(_0x3b3236,_0x17bdd0){_0x17bdd0=_0x17bdd0||0xc8;return function(_0xfa52fb){if(_0xfa52fb){return _0x3b3236['status'](_0x17bdd0)[_0x84e6('0x30')](_0xfa52fb);}};}function respondWithFilteredResult(_0x35df03,_0x4db5a1){return function(_0x162c07){if(_0x162c07){var _0x1d5473=_0x162c07['count'],_0x28f08b=_0x4db5a1['offset'],_0xfda5da=_0x4db5a1[_0x84e6('0x31')]+_0x4db5a1[_0x84e6('0x32')],_0x525f95;if(_0xfda5da>=_0x1d5473){_0xfda5da=_0x1d5473;_0x525f95=0xc8;}else{_0x525f95=0xce;}_0x35df03['status'](_0x525f95);return _0x35df03[_0x84e6('0x33')]('Content-Range',_0x28f08b+'-'+_0xfda5da+'/'+_0x1d5473)[_0x84e6('0x30')](_0x162c07);}return null;};}function patchUpdates(_0xbd1a96){return function(_0x183aa9){try{jsonpatch[_0x84e6('0x34')](_0x183aa9,_0xbd1a96,!![]);}catch(_0x26f399){return BPromise['reject'](_0x26f399);}return _0x183aa9['save']();};}function saveUpdates(_0x2d5a5d,_0x4f2f8a){return function(_0x48a255){if(_0x48a255){return _0x48a255[_0x84e6('0x35')](_0x2d5a5d)[_0x84e6('0x21')](function(_0xb7b94d){return _0xb7b94d;});}return null;};}function removeEntity(_0xd160d8,_0x27d3fa){return function(_0x4094b6){if(_0x4094b6){return _0x4094b6[_0x84e6('0x36')]()[_0x84e6('0x21')](function(){_0xd160d8[_0x84e6('0x2e')](0xcc)[_0x84e6('0x2f')]();});}};}function handleEntityNotFound(_0x4cb1f7,_0x273192){return function(_0x4aecf7){if(!_0x4aecf7){_0x4cb1f7['sendStatus'](0x194);}return _0x4aecf7;};}function handleError(_0xa00f39,_0x4258ce){_0x4258ce=_0x4258ce||0x1f4;return function(_0x154774){logger[_0x84e6('0x27')](_0x154774[_0x84e6('0x37')]);if(_0x154774[_0x84e6('0x38')]){delete _0x154774[_0x84e6('0x38')];}_0xa00f39[_0x84e6('0x2e')](_0x4258ce)[_0x84e6('0x39')](_0x154774);};}exports['index']=function(_0x230f81,_0x10aaea){var _0x28390a={},_0x21dcb4={},_0x734c6a={'count':0x0,'rows':[]};var _0x5c4d94=_['map'](db['ZendeskAccount'][_0x84e6('0x3a')],function(_0x5f0baa){return{'name':_0x5f0baa['fieldName'],'type':_0x5f0baa[_0x84e6('0x3b')][_0x84e6('0x3c')]};});_0x21dcb4['model']=_[_0x84e6('0x3d')](_0x5c4d94,_0x84e6('0x38'));_0x21dcb4[_0x84e6('0x3e')]=_[_0x84e6('0x3f')](_0x230f81['query']);_0x21dcb4[_0x84e6('0x40')]=_[_0x84e6('0x41')](_0x21dcb4[_0x84e6('0x42')],_0x21dcb4[_0x84e6('0x3e')]);_0x28390a['attributes']=_[_0x84e6('0x41')](_0x21dcb4[_0x84e6('0x42')],qs[_0x84e6('0x43')](_0x230f81['query'][_0x84e6('0x43')]));_0x28390a[_0x84e6('0x44')]=_0x28390a[_0x84e6('0x44')]['length']?_0x28390a[_0x84e6('0x44')]:_0x21dcb4['model'];if(!_0x230f81[_0x84e6('0x3e')][_0x84e6('0x45')]('nolimit')){_0x28390a[_0x84e6('0x32')]=qs[_0x84e6('0x32')](_0x230f81['query'][_0x84e6('0x32')]);_0x28390a['offset']=qs[_0x84e6('0x31')](_0x230f81[_0x84e6('0x3e')]['offset']);}_0x28390a[_0x84e6('0x46')]=qs[_0x84e6('0x47')](_0x230f81['query']['sort']);_0x28390a['where']=qs[_0x84e6('0x40')](_['pick'](_0x230f81[_0x84e6('0x3e')],_0x21dcb4[_0x84e6('0x40')]),_0x5c4d94);if(_0x230f81['query']['filter']){_0x28390a[_0x84e6('0x48')]=_['merge'](_0x28390a[_0x84e6('0x48')],{'$or':_[_0x84e6('0x3d')](_0x5c4d94,function(_0x12e996){if(_0x12e996[_0x84e6('0x3b')]!==_0x84e6('0x49')){var _0x3d8a6f={};_0x3d8a6f[_0x12e996[_0x84e6('0x38')]]={'$like':'%'+_0x230f81[_0x84e6('0x3e')][_0x84e6('0x4a')]+'%'};return _0x3d8a6f;}})});}_0x28390a=_[_0x84e6('0x4b')]({},_0x28390a,_0x230f81['options']);var _0x187399={'where':_0x28390a[_0x84e6('0x48')]};return db[_0x84e6('0x4c')][_0x84e6('0x4d')](_0x187399)[_0x84e6('0x21')](function(_0x4acdae){_0x734c6a['count']=_0x4acdae;if(_0x230f81[_0x84e6('0x3e')]['includeAll']){_0x28390a[_0x84e6('0x4e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x84e6('0x4f')](_0x28390a);})['then'](function(_0x3414d2){_0x734c6a[_0x84e6('0x50')]=_0x3414d2;return _0x734c6a;})['then'](respondWithFilteredResult(_0x10aaea,_0x28390a))[_0x84e6('0x2c')](handleError(_0x10aaea,null));};exports[_0x84e6('0x51')]=function(_0x44d4b9,_0x3fd620){var _0x54f6cd={'raw':![],'where':{'id':_0x44d4b9[_0x84e6('0x52')]['id']}},_0x5603e8={};_0x5603e8[_0x84e6('0x42')]=_[_0x84e6('0x3f')](db[_0x84e6('0x4c')][_0x84e6('0x3a')]);_0x5603e8['query']=_[_0x84e6('0x3f')](_0x44d4b9['query']);_0x5603e8[_0x84e6('0x40')]=_[_0x84e6('0x41')](_0x5603e8[_0x84e6('0x42')],_0x5603e8[_0x84e6('0x3e')]);_0x54f6cd[_0x84e6('0x44')]=_['intersection'](_0x5603e8[_0x84e6('0x42')],qs[_0x84e6('0x43')](_0x44d4b9[_0x84e6('0x3e')][_0x84e6('0x43')]));_0x54f6cd['attributes']=_0x54f6cd[_0x84e6('0x44')][_0x84e6('0x53')]?_0x54f6cd[_0x84e6('0x44')]:_0x5603e8[_0x84e6('0x42')];if(_0x44d4b9[_0x84e6('0x3e')][_0x84e6('0x54')]){_0x54f6cd[_0x84e6('0x4e')]=[{'all':!![]}];}_0x54f6cd=_[_0x84e6('0x4b')]({},_0x54f6cd,_0x44d4b9[_0x84e6('0x55')]);return db['ZendeskAccount'][_0x84e6('0x56')](_0x54f6cd)[_0x84e6('0x21')](handleEntityNotFound(_0x3fd620,null))[_0x84e6('0x21')](respondWithResult(_0x3fd620,null))[_0x84e6('0x2c')](handleError(_0x3fd620,null));};exports[_0x84e6('0x57')]=function(_0x1cf460,_0x5b53a1){return db['ZendeskAccount'][_0x84e6('0x57')](_0x1cf460[_0x84e6('0x58')],{})[_0x84e6('0x21')](respondWithResult(_0x5b53a1,0xc9))[_0x84e6('0x2c')](handleError(_0x5b53a1,null));};exports[_0x84e6('0x35')]=function(_0x3ffb03,_0x912233){if(_0x3ffb03['body']['id']){delete _0x3ffb03[_0x84e6('0x58')]['id'];}return db[_0x84e6('0x4c')]['find']({'where':{'id':_0x3ffb03['params']['id']}})[_0x84e6('0x21')](handleEntityNotFound(_0x912233,null))['then'](saveUpdates(_0x3ffb03['body'],null))[_0x84e6('0x21')](respondWithResult(_0x912233,null))[_0x84e6('0x2c')](handleError(_0x912233,null));};exports[_0x84e6('0x36')]=function(_0x427e18,_0x6ce541){return db['ZendeskAccount'][_0x84e6('0x56')]({'where':{'id':_0x427e18[_0x84e6('0x52')]['id']}})[_0x84e6('0x21')](handleEntityNotFound(_0x6ce541,null))[_0x84e6('0x21')](removeEntity(_0x6ce541,null))[_0x84e6('0x2c')](handleError(_0x6ce541,null));};exports[_0x84e6('0x59')]=function(_0x282faa,_0x531847,_0xb6c39){var _0x29f5a0={};var _0x5b3cef={};var _0x499303;var _0x3b8a2b;return db[_0x84e6('0x4c')][_0x84e6('0x5a')]({'where':{'id':_0x282faa[_0x84e6('0x52')]['id']}})['then'](handleEntityNotFound(_0x531847,null))[_0x84e6('0x21')](function(_0x184ebe){if(_0x184ebe){_0x499303=_0x184ebe;_0x5b3cef['model']=_[_0x84e6('0x3f')](db[_0x84e6('0x5b')][_0x84e6('0x3a')]);_0x5b3cef[_0x84e6('0x3e')]=_[_0x84e6('0x3f')](_0x282faa[_0x84e6('0x3e')]);_0x5b3cef[_0x84e6('0x40')]=_['intersection'](_0x5b3cef[_0x84e6('0x42')],_0x5b3cef[_0x84e6('0x3e')]);_0x29f5a0[_0x84e6('0x44')]=_[_0x84e6('0x41')](_0x5b3cef[_0x84e6('0x42')],qs[_0x84e6('0x43')](_0x282faa[_0x84e6('0x3e')][_0x84e6('0x43')]));_0x29f5a0['attributes']=_0x29f5a0['attributes'][_0x84e6('0x53')]?_0x29f5a0[_0x84e6('0x44')]:_0x5b3cef[_0x84e6('0x42')];_0x29f5a0['order']=qs[_0x84e6('0x47')](_0x282faa[_0x84e6('0x3e')][_0x84e6('0x47')]);_0x29f5a0['where']=qs[_0x84e6('0x40')](_[_0x84e6('0x5c')](_0x282faa[_0x84e6('0x3e')],_0x5b3cef[_0x84e6('0x40')]));if(_0x282faa[_0x84e6('0x3e')][_0x84e6('0x4a')]){_0x29f5a0['where']=_['merge'](_0x29f5a0[_0x84e6('0x48')],{'$or':_[_0x84e6('0x3d')](_0x29f5a0[_0x84e6('0x44')],function(_0x11246b){var _0x21b24e={};_0x21b24e[_0x11246b]={'$like':'%'+_0x282faa[_0x84e6('0x3e')]['filter']+'%'};return _0x21b24e;})});}_0x29f5a0=_[_0x84e6('0x4b')]({},_0x29f5a0,_0x282faa[_0x84e6('0x55')]);return _0x499303[_0x84e6('0x59')](_0x29f5a0);}})[_0x84e6('0x21')](function(_0x57e372){if(_0x57e372){_0x3b8a2b=_0x57e372['length'];if(!_0x282faa['query'][_0x84e6('0x45')](_0x84e6('0x5d'))){_0x29f5a0[_0x84e6('0x32')]=qs[_0x84e6('0x32')](_0x282faa['query'][_0x84e6('0x32')]);_0x29f5a0['offset']=qs['offset'](_0x282faa[_0x84e6('0x3e')][_0x84e6('0x31')]);}return _0x499303[_0x84e6('0x59')](_0x29f5a0);}})[_0x84e6('0x21')](function(_0x266329){if(_0x266329){return _0x266329?{'count':_0x3b8a2b,'rows':_0x266329}:null;}})[_0x84e6('0x21')](respondWithResult(_0x531847,null))['catch'](handleError(_0x531847,null));};exports['addConfiguration']=function(_0x132bd0,_0x2c58f8,_0x286152){if(_0x132bd0[_0x84e6('0x58')]['id']){delete _0x132bd0[_0x84e6('0x58')]['id'];}return db[_0x84e6('0x4c')][_0x84e6('0x5a')]({'where':{'id':_0x132bd0[_0x84e6('0x52')]['id']}})[_0x84e6('0x21')](handleEntityNotFound(_0x2c58f8,null))[_0x84e6('0x21')](function(_0xf04ae9){if(_0xf04ae9){_0x132bd0[_0x84e6('0x58')]['AccountId']=_0xf04ae9['id'];_0x132bd0[_0x84e6('0x58')][_0x84e6('0x5e')]=integrations['getSubjects'](_0x132bd0[_0x84e6('0x58')]['channel'],_0x132bd0[_0x84e6('0x58')][_0x84e6('0x3b')]);_0x132bd0[_0x84e6('0x58')][_0x84e6('0x5f')]=integrations[_0x84e6('0x60')](_0x132bd0[_0x84e6('0x58')]['channel'],_0x132bd0[_0x84e6('0x58')][_0x84e6('0x3b')]);return db[_0x84e6('0x5b')][_0x84e6('0x57')](_0x132bd0[_0x84e6('0x58')],{'include':[{'model':db['ZendeskField'],'as':_0x84e6('0x5e')},{'model':db[_0x84e6('0x61')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2c58f8,null))[_0x84e6('0x2c')](handleError(_0x2c58f8,null));};exports['getFields']=function(_0x12adff,_0x2d9f35,_0xb6891d){var _0xa55681='';return db[_0x84e6('0x4c')][_0x84e6('0x5a')]({'where':{'id':_0x12adff[_0x84e6('0x52')]['id']},'attributes':['id',_0x84e6('0x62'),_0x84e6('0x63'),_0x84e6('0x64'),_0x84e6('0x65'),_0x84e6('0x66')]})['then'](handleEntityNotFound(_0x2d9f35,null))[_0x84e6('0x21')](function(_0x30b334){if(_0x30b334){_0xa55681=_0x30b334[_0x84e6('0x66')];var _0x3768d2=_0xa55681['slice'](-0x1);if(_0x3768d2==='/'){_0xa55681=_0xa55681[_0x84e6('0x67')](0x0,_0xa55681[_0x84e6('0x68')](_0x3768d2));}var _0x4ecf1f={'method':'GET','uri':util[_0x84e6('0x69')](_0x84e6('0x6a'),_0xa55681,_0x84e6('0x6b')),'json':!![]};switch(_0x30b334[_0x84e6('0x65')]){case _0x84e6('0x63'):_0x4ecf1f[_0x84e6('0x6c')]={'Authorization':util[_0x84e6('0x69')]('Basic\x20%s',new Buffer(util[_0x84e6('0x69')]('%s:%s',_0x30b334[_0x84e6('0x62')],_0x30b334[_0x84e6('0x63')]))[_0x84e6('0x6d')]('base64'))};break;case'token':_0x4ecf1f['headers']={'Authorization':util[_0x84e6('0x69')](_0x84e6('0x6e'),new Buffer(util[_0x84e6('0x69')](_0x84e6('0x6f'),_0x30b334[_0x84e6('0x62')],_0x30b334[_0x84e6('0x64')]))[_0x84e6('0x6d')](_0x84e6('0x70')))};break;default:throw new db[(_0x84e6('0x1d'))][(_0x84e6('0x1e'))](_0x84e6('0x71'));}return rp(_0x4ecf1f);}})[_0x84e6('0x21')](function(_0x1d420b){if(_0x1d420b){var _0x284488=[_0x84e6('0x72'),_0x84e6('0x73'),'group',_0x84e6('0x74')];_[_0x84e6('0x75')](_0x1d420b[_0x84e6('0x6b')],function(_0x33620f){return _0x284488[_0x84e6('0x76')](_0x33620f['type']);});return{'count':_0x1d420b['ticket_fields'][_0x84e6('0x53')],'rows':_[_0x84e6('0x3d')](_0x1d420b[_0x84e6('0x6b')],function(_0x25948e){return{'id':_0x25948e['id'],'name':_0x25948e[_0x84e6('0x77')]>0x7?_0x25948e[_0x84e6('0x78')]:_0x25948e[_0x84e6('0x3b')],'custom':_0x25948e[_0x84e6('0x77')]>0x7?!![]:![],'options':_0x25948e['system_field_options']?_0x25948e['system_field_options']:_0x25948e[_0x84e6('0x79')]?_0x25948e[_0x84e6('0x79')]:[]};})};}})[_0x84e6('0x21')](respondWithResult(_0x2d9f35,null))[_0x84e6('0x2c')](function(_0x4c64db){var _0x39cda1=_0x12adff[_0x84e6('0x3e')][_0x84e6('0x1c')]?0x1f4:_0x4c64db[_0x84e6('0x7a')]||0x1f4;logger[_0x84e6('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x84e6('0x7b'),_0x39cda1,JSON[_0x84e6('0x26')](_0x4c64db));delete _0x4c64db[_0x84e6('0x38')];if(_0x39cda1===0x191){_0x39cda1=0x190;}_0x2d9f35['status'](_0x39cda1)[_0x84e6('0x39')](_0x12adff[_0x84e6('0x3e')][_0x84e6('0x1c')]?{'message':_0x84e6('0x7c'),'statusCode':_0x4c64db[_0x84e6('0x7a')]}:_0x4c64db);});}; \ No newline at end of file +var _0xf5a0=['Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers','Sequelize','subject','group','assignee','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','key','keys','filters','intersection','model','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','pick','merge','where','type','filter','options','includeAll','params','include','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xf5a0,0x9a));var _0x0f5a=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0xf5a0[_0x1a3243];return _0x33f2ca;};'use strict';var pdf=require(_0x0f5a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0f5a('0x1'));var zipdir=require(_0x0f5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f5a('0x3'));var moment=require('moment');var BPromise=require(_0x0f5a('0x4'));var Mustache=require(_0x0f5a('0x5'));var util=require(_0x0f5a('0x6'));var path=require('path');var sox=require(_0x0f5a('0x7'));var csv=require('to-csv');var ejs=require(_0x0f5a('0x8'));var fs=require('fs');var _=require(_0x0f5a('0x9'));var squel=require('squel');var crypto=require(_0x0f5a('0xa'));var jsforce=require(_0x0f5a('0xb'));var deskjs=require(_0x0f5a('0xc'));var toCsv=require(_0x0f5a('0xd'));var querystring=require(_0x0f5a('0xe'));var Papa=require(_0x0f5a('0xf'));var Redis=require(_0x0f5a('0x10'));var authService=require(_0x0f5a('0x11'));var qs=require(_0x0f5a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f5a('0x13'));var logger=require(_0x0f5a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0f5a('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0f5a('0x16'));var jayson=require(_0x0f5a('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1c1997,_0x3c31ea,_0x349af1){if(_0x349af1){var _0x2bbd68=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2bbd68[_0x0f5a('0x18')](_0x3c31ea)){return _0x1c1997;}else{throw new db['Sequelize'][(_0x0f5a('0x19'))](_0x0f5a('0x1a'));}}else{return _0x1c1997;}}function respondWithRpcPromise(_0x11a1d0,_0x327c1b,_0x58fcfe,_0x21e328){return new BPromise(function(_0x7d6ce8,_0x2e0c91){var _0x2310b3=_0x21e328||client;return _0x2310b3[_0x0f5a('0x1b')](_0x11a1d0,_0x58fcfe)['then'](function(_0x5dd1b3){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x327c1b,_0x0f5a('0x1c'));logger['debug'](_0x0f5a('0x1d'),_0x327c1b,_0x0f5a('0x1c'),JSON['stringify'](_0x5dd1b3));if(_0x5dd1b3[_0x0f5a('0x1e')]){if(_0x5dd1b3[_0x0f5a('0x1e')][_0x0f5a('0x1f')]===0x1f4){logger['error'](_0x0f5a('0x20'),_0x327c1b,_0x5dd1b3[_0x0f5a('0x1e')][_0x0f5a('0x21')]);return _0x2e0c91(_0x5dd1b3[_0x0f5a('0x1e')][_0x0f5a('0x21')]);}logger[_0x0f5a('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x327c1b,_0x5dd1b3[_0x0f5a('0x1e')]['message']);return _0x7d6ce8(_0x5dd1b3[_0x0f5a('0x1e')][_0x0f5a('0x21')]);}else{logger[_0x0f5a('0x22')](_0x0f5a('0x20'),_0x327c1b,'request\x20sent');_0x7d6ce8(_0x5dd1b3[_0x0f5a('0x23')][_0x0f5a('0x21')]);}})[_0x0f5a('0x24')](function(_0x32e0fa){logger['error'](_0x0f5a('0x20'),_0x327c1b,_0x32e0fa);_0x2e0c91(_0x32e0fa);});});}function respondWithStatusCode(_0xd26d7e,_0x177c5c){_0x177c5c=_0x177c5c||0xcc;return function(_0x56da51){if(_0x56da51){return _0xd26d7e[_0x0f5a('0x25')](_0x177c5c);}return _0xd26d7e[_0x0f5a('0x26')](_0x177c5c)[_0x0f5a('0x27')]();};}function respondWithResult(_0x2bbd18,_0x271f08){_0x271f08=_0x271f08||0xc8;return function(_0x380f06){if(_0x380f06){return _0x2bbd18[_0x0f5a('0x26')](_0x271f08)['json'](_0x380f06);}};}function respondWithFilteredResult(_0x53e38f,_0x22d7e3){return function(_0x50fd7f){if(_0x50fd7f){var _0x59f630=_0x50fd7f[_0x0f5a('0x28')],_0x53026f=_0x22d7e3[_0x0f5a('0x29')],_0x5650ff=_0x22d7e3[_0x0f5a('0x29')]+_0x22d7e3[_0x0f5a('0x2a')],_0x1107c4;if(_0x5650ff>=_0x59f630){_0x5650ff=_0x59f630;_0x1107c4=0xc8;}else{_0x1107c4=0xce;}_0x53e38f[_0x0f5a('0x26')](_0x1107c4);return _0x53e38f[_0x0f5a('0x2b')](_0x0f5a('0x2c'),_0x53026f+'-'+_0x5650ff+'/'+_0x59f630)[_0x0f5a('0x2d')](_0x50fd7f);}return null;};}function patchUpdates(_0x2773a4){return function(_0x267141){try{jsonpatch[_0x0f5a('0x2e')](_0x267141,_0x2773a4,!![]);}catch(_0x40495d){return BPromise[_0x0f5a('0x2f')](_0x40495d);}return _0x267141[_0x0f5a('0x30')]();};}function saveUpdates(_0xa54a29,_0x53f24b){return function(_0x1eaef0){if(_0x1eaef0){return _0x1eaef0[_0x0f5a('0x31')](_0xa54a29)['then'](function(_0x4e3368){return _0x4e3368;});}return null;};}function removeEntity(_0x4128c6,_0x212499){return function(_0x53c188){if(_0x53c188){return _0x53c188['destroy']()[_0x0f5a('0x32')](function(){_0x4128c6[_0x0f5a('0x26')](0xcc)[_0x0f5a('0x27')]();});}};}function handleEntityNotFound(_0x11f4b2,_0x3914c1){return function(_0x45fc88){if(!_0x45fc88){_0x11f4b2[_0x0f5a('0x25')](0x194);}return _0x45fc88;};}function handleError(_0x585f65,_0x1f6c90){_0x1f6c90=_0x1f6c90||0x1f4;return function(_0x127f43){logger[_0x0f5a('0x1e')](_0x127f43[_0x0f5a('0x33')]);if(_0x127f43[_0x0f5a('0x34')]){delete _0x127f43[_0x0f5a('0x34')];}_0x585f65['status'](_0x1f6c90)[_0x0f5a('0x35')](_0x127f43);};}exports[_0x0f5a('0x36')]=function(_0xe594db,_0x2cbd06){var _0x4ae8e3={},_0x5dedd6={},_0x18c12e={'count':0x0,'rows':[]};var _0x1e50fd=_[_0x0f5a('0x37')](db[_0x0f5a('0x38')][_0x0f5a('0x39')],function(_0xc5fd8e){return{'name':_0xc5fd8e[_0x0f5a('0x3a')],'type':_0xc5fd8e['type'][_0x0f5a('0x3b')]};});_0x5dedd6['model']=_[_0x0f5a('0x37')](_0x1e50fd,_0x0f5a('0x34'));_0x5dedd6['query']=_[_0x0f5a('0x3c')](_0xe594db['query']);_0x5dedd6[_0x0f5a('0x3d')]=_[_0x0f5a('0x3e')](_0x5dedd6['model'],_0x5dedd6['query']);_0x4ae8e3['attributes']=_[_0x0f5a('0x3e')](_0x5dedd6[_0x0f5a('0x3f')],qs[_0x0f5a('0x40')](_0xe594db['query'][_0x0f5a('0x40')]));_0x4ae8e3[_0x0f5a('0x41')]=_0x4ae8e3['attributes'][_0x0f5a('0x42')]?_0x4ae8e3[_0x0f5a('0x41')]:_0x5dedd6['model'];if(!_0xe594db[_0x0f5a('0x43')][_0x0f5a('0x44')](_0x0f5a('0x45'))){_0x4ae8e3[_0x0f5a('0x2a')]=qs['limit'](_0xe594db['query'][_0x0f5a('0x2a')]);_0x4ae8e3['offset']=qs[_0x0f5a('0x29')](_0xe594db[_0x0f5a('0x43')][_0x0f5a('0x29')]);}_0x4ae8e3[_0x0f5a('0x46')]=qs[_0x0f5a('0x47')](_0xe594db[_0x0f5a('0x43')]['sort']);_0x4ae8e3['where']=qs['filters'](_[_0x0f5a('0x48')](_0xe594db[_0x0f5a('0x43')],_0x5dedd6[_0x0f5a('0x3d')]),_0x1e50fd);if(_0xe594db[_0x0f5a('0x43')]['filter']){_0x4ae8e3['where']=_[_0x0f5a('0x49')](_0x4ae8e3[_0x0f5a('0x4a')],{'$or':_['map'](_0x1e50fd,function(_0x5187b){if(_0x5187b[_0x0f5a('0x4b')]!=='VIRTUAL'){var _0x97ace5={};_0x97ace5[_0x5187b[_0x0f5a('0x34')]]={'$like':'%'+_0xe594db['query'][_0x0f5a('0x4c')]+'%'};return _0x97ace5;}})});}_0x4ae8e3=_[_0x0f5a('0x49')]({},_0x4ae8e3,_0xe594db[_0x0f5a('0x4d')]);var _0x1162aa={'where':_0x4ae8e3[_0x0f5a('0x4a')]};return db[_0x0f5a('0x38')]['count'](_0x1162aa)[_0x0f5a('0x32')](function(_0x2c3deb){_0x18c12e[_0x0f5a('0x28')]=_0x2c3deb;if(_0xe594db['query'][_0x0f5a('0x4e')]){_0x4ae8e3['include']=[{'all':!![]}];}return db[_0x0f5a('0x38')]['findAll'](_0x4ae8e3);})[_0x0f5a('0x32')](function(_0x8ec84f){_0x18c12e['rows']=_0x8ec84f;return _0x18c12e;})[_0x0f5a('0x32')](respondWithFilteredResult(_0x2cbd06,_0x4ae8e3))['catch'](handleError(_0x2cbd06,null));};exports['show']=function(_0x47df01,_0x4cf016){var _0x3ee8d={'raw':![],'where':{'id':_0x47df01[_0x0f5a('0x4f')]['id']}},_0x78b127={};_0x78b127[_0x0f5a('0x3f')]=_['keys'](db['ZendeskAccount']['rawAttributes']);_0x78b127[_0x0f5a('0x43')]=_[_0x0f5a('0x3c')](_0x47df01[_0x0f5a('0x43')]);_0x78b127[_0x0f5a('0x3d')]=_[_0x0f5a('0x3e')](_0x78b127['model'],_0x78b127[_0x0f5a('0x43')]);_0x3ee8d[_0x0f5a('0x41')]=_[_0x0f5a('0x3e')](_0x78b127[_0x0f5a('0x3f')],qs['fields'](_0x47df01[_0x0f5a('0x43')]['fields']));_0x3ee8d[_0x0f5a('0x41')]=_0x3ee8d[_0x0f5a('0x41')]['length']?_0x3ee8d['attributes']:_0x78b127[_0x0f5a('0x3f')];if(_0x47df01[_0x0f5a('0x43')][_0x0f5a('0x4e')]){_0x3ee8d[_0x0f5a('0x50')]=[{'all':!![]}];}_0x3ee8d=_[_0x0f5a('0x49')]({},_0x3ee8d,_0x47df01[_0x0f5a('0x4d')]);return db[_0x0f5a('0x38')][_0x0f5a('0x51')](_0x3ee8d)[_0x0f5a('0x32')](handleEntityNotFound(_0x4cf016,null))[_0x0f5a('0x32')](respondWithResult(_0x4cf016,null))['catch'](handleError(_0x4cf016,null));};exports[_0x0f5a('0x52')]=function(_0xf95d3a,_0x54812e){return db['ZendeskAccount'][_0x0f5a('0x52')](_0xf95d3a[_0x0f5a('0x53')],{})['then'](respondWithResult(_0x54812e,0xc9))[_0x0f5a('0x24')](handleError(_0x54812e,null));};exports[_0x0f5a('0x31')]=function(_0x4b9d66,_0xbdc84a){if(_0x4b9d66['body']['id']){delete _0x4b9d66[_0x0f5a('0x53')]['id'];}return db[_0x0f5a('0x38')][_0x0f5a('0x51')]({'where':{'id':_0x4b9d66[_0x0f5a('0x4f')]['id']}})[_0x0f5a('0x32')](handleEntityNotFound(_0xbdc84a,null))[_0x0f5a('0x32')](saveUpdates(_0x4b9d66['body'],null))[_0x0f5a('0x32')](respondWithResult(_0xbdc84a,null))[_0x0f5a('0x24')](handleError(_0xbdc84a,null));};exports['destroy']=function(_0x4cb879,_0x12a545){return db[_0x0f5a('0x38')][_0x0f5a('0x51')]({'where':{'id':_0x4cb879['params']['id']}})['then'](handleEntityNotFound(_0x12a545,null))[_0x0f5a('0x32')](removeEntity(_0x12a545,null))['catch'](handleError(_0x12a545,null));};exports['getConfigurations']=function(_0x5d242b,_0x286148,_0x2d7ccd){var _0x4a5c45={};var _0x1f9f18={};var _0x3d006c;var _0x56d33d;return db[_0x0f5a('0x38')]['findOne']({'where':{'id':_0x5d242b[_0x0f5a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x286148,null))[_0x0f5a('0x32')](function(_0x4674c6){if(_0x4674c6){_0x3d006c=_0x4674c6;_0x1f9f18[_0x0f5a('0x3f')]=_['keys'](db[_0x0f5a('0x54')][_0x0f5a('0x39')]);_0x1f9f18[_0x0f5a('0x43')]=_[_0x0f5a('0x3c')](_0x5d242b[_0x0f5a('0x43')]);_0x1f9f18[_0x0f5a('0x3d')]=_[_0x0f5a('0x3e')](_0x1f9f18[_0x0f5a('0x3f')],_0x1f9f18[_0x0f5a('0x43')]);_0x4a5c45[_0x0f5a('0x41')]=_['intersection'](_0x1f9f18['model'],qs[_0x0f5a('0x40')](_0x5d242b[_0x0f5a('0x43')][_0x0f5a('0x40')]));_0x4a5c45[_0x0f5a('0x41')]=_0x4a5c45[_0x0f5a('0x41')]['length']?_0x4a5c45[_0x0f5a('0x41')]:_0x1f9f18['model'];_0x4a5c45[_0x0f5a('0x46')]=qs[_0x0f5a('0x47')](_0x5d242b[_0x0f5a('0x43')][_0x0f5a('0x47')]);_0x4a5c45['where']=qs[_0x0f5a('0x3d')](_[_0x0f5a('0x48')](_0x5d242b[_0x0f5a('0x43')],_0x1f9f18[_0x0f5a('0x3d')]));if(_0x5d242b[_0x0f5a('0x43')][_0x0f5a('0x4c')]){_0x4a5c45['where']=_[_0x0f5a('0x49')](_0x4a5c45[_0x0f5a('0x4a')],{'$or':_[_0x0f5a('0x37')](_0x4a5c45['attributes'],function(_0x3cc2d2){var _0x223fae={};_0x223fae[_0x3cc2d2]={'$like':'%'+_0x5d242b[_0x0f5a('0x43')][_0x0f5a('0x4c')]+'%'};return _0x223fae;})});}_0x4a5c45=_[_0x0f5a('0x49')]({},_0x4a5c45,_0x5d242b[_0x0f5a('0x4d')]);return _0x3d006c['getConfigurations'](_0x4a5c45);}})[_0x0f5a('0x32')](function(_0x12a1f5){if(_0x12a1f5){_0x56d33d=_0x12a1f5[_0x0f5a('0x42')];if(!_0x5d242b['query'][_0x0f5a('0x44')](_0x0f5a('0x45'))){_0x4a5c45['limit']=qs[_0x0f5a('0x2a')](_0x5d242b[_0x0f5a('0x43')][_0x0f5a('0x2a')]);_0x4a5c45['offset']=qs[_0x0f5a('0x29')](_0x5d242b[_0x0f5a('0x43')][_0x0f5a('0x29')]);}return _0x3d006c[_0x0f5a('0x55')](_0x4a5c45);}})['then'](function(_0x310e04){if(_0x310e04){return _0x310e04?{'count':_0x56d33d,'rows':_0x310e04}:null;}})[_0x0f5a('0x32')](respondWithResult(_0x286148,null))['catch'](handleError(_0x286148,null));};exports[_0x0f5a('0x56')]=function(_0x530901,_0xc35f57,_0x1f5cf3){if(_0x530901[_0x0f5a('0x53')]['id']){delete _0x530901[_0x0f5a('0x53')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x530901['params']['id']}})[_0x0f5a('0x32')](handleEntityNotFound(_0xc35f57,null))[_0x0f5a('0x32')](function(_0x5dc382){if(_0x5dc382){_0x530901[_0x0f5a('0x53')][_0x0f5a('0x57')]=_0x5dc382['id'];_0x530901['body'][_0x0f5a('0x58')]=integrations[_0x0f5a('0x59')](_0x530901['body'][_0x0f5a('0x5a')],_0x530901[_0x0f5a('0x53')][_0x0f5a('0x4b')]);_0x530901[_0x0f5a('0x53')][_0x0f5a('0x5b')]=integrations[_0x0f5a('0x5c')](_0x530901[_0x0f5a('0x53')][_0x0f5a('0x5a')],_0x530901[_0x0f5a('0x53')][_0x0f5a('0x4b')]);return db[_0x0f5a('0x54')][_0x0f5a('0x52')](_0x530901[_0x0f5a('0x53')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x0f5a('0x5b')}]});}return null;})[_0x0f5a('0x32')](respondWithResult(_0xc35f57,null))['catch'](handleError(_0xc35f57,null));};exports[_0x0f5a('0x5d')]=function(_0x1de9b2,_0x4935fd,_0x3da1d9){var _0x5303f6='';return db[_0x0f5a('0x38')]['findOne']({'where':{'id':_0x1de9b2['params']['id']},'attributes':['id',_0x0f5a('0x5e'),_0x0f5a('0x5f'),_0x0f5a('0x60'),_0x0f5a('0x61'),_0x0f5a('0x62')]})[_0x0f5a('0x32')](handleEntityNotFound(_0x4935fd,null))[_0x0f5a('0x32')](function(_0x434023){if(_0x434023){_0x5303f6=_0x434023[_0x0f5a('0x62')];var _0x18f9d3=_0x5303f6[_0x0f5a('0x63')](-0x1);if(_0x18f9d3==='/'){_0x5303f6=_0x5303f6[_0x0f5a('0x64')](0x0,_0x5303f6[_0x0f5a('0x65')](_0x18f9d3));}var _0x4fc906={'method':_0x0f5a('0x66'),'uri':util[_0x0f5a('0x67')]('%s/%s',_0x5303f6,_0x0f5a('0x68')),'json':!![]};switch(_0x434023['authType']){case _0x0f5a('0x5f'):_0x4fc906['headers']={'Authorization':util[_0x0f5a('0x67')](_0x0f5a('0x69'),new Buffer(util[_0x0f5a('0x67')](_0x0f5a('0x6a'),_0x434023[_0x0f5a('0x5e')],_0x434023[_0x0f5a('0x5f')]))[_0x0f5a('0x6b')](_0x0f5a('0x6c')))};break;case _0x0f5a('0x60'):_0x4fc906[_0x0f5a('0x6d')]={'Authorization':util[_0x0f5a('0x67')]('Basic\x20%s',new Buffer(util[_0x0f5a('0x67')]('%s/token:%s',_0x434023['username'],_0x434023[_0x0f5a('0x60')]))[_0x0f5a('0x6b')](_0x0f5a('0x6c')))};break;default:throw new db[(_0x0f5a('0x6e'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x4fc906);}})[_0x0f5a('0x32')](function(_0x48474a){if(_0x48474a){var _0x379ce3=[_0x0f5a('0x6f'),'description',_0x0f5a('0x70'),_0x0f5a('0x71')];_['remove'](_0x48474a[_0x0f5a('0x68')],function(_0x348c79){return _0x379ce3['includes'](_0x348c79['type']);});return{'count':_0x48474a[_0x0f5a('0x68')][_0x0f5a('0x42')],'rows':_['map'](_0x48474a[_0x0f5a('0x68')],function(_0xf63108){return{'id':_0xf63108['id'],'name':_0xf63108['position']>0x7?_0xf63108['title']:_0xf63108[_0x0f5a('0x4b')],'custom':_0xf63108[_0x0f5a('0x72')]>0x7?!![]:![],'options':_0xf63108['system_field_options']?_0xf63108[_0x0f5a('0x73')]:_0xf63108[_0x0f5a('0x74')]?_0xf63108[_0x0f5a('0x74')]:[]};})};}})[_0x0f5a('0x32')](respondWithResult(_0x4935fd,null))['catch'](function(_0x1c6ffe){var _0x32bfcc=_0x1de9b2[_0x0f5a('0x43')][_0x0f5a('0x18')]?0x1f4:_0x1c6ffe[_0x0f5a('0x75')]||0x1f4;logger['error'](_0x0f5a('0x76'),_0x0f5a('0x5d'),_0x32bfcc,JSON[_0x0f5a('0x77')](_0x1c6ffe));delete _0x1c6ffe[_0x0f5a('0x34')];if(_0x32bfcc===0x191){_0x32bfcc=0x190;}_0x4935fd[_0x0f5a('0x26')](_0x32bfcc)[_0x0f5a('0x35')](_0x1de9b2['query'][_0x0f5a('0x18')]?{'message':_0x0f5a('0x78'),'statusCode':_0x1c6ffe[_0x0f5a('0x75')]}:_0x1c6ffe);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4843538..c9c0f81 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 _0x2221=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x4e356e,_0xa31d9d){var _0x3166ca=function(_0x1ad864){while(--_0x1ad864){_0x4e356e['push'](_0x4e356e['shift']());}};_0x3166ca(++_0xa31d9d);}(_0x2221,0x1ea));var _0x1222=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x2221[_0x29c3b2];return _0x4b3aa7;};'use strict';var _=require(_0x1222('0x0'));var util=require('util');var logger=require(_0x1222('0x1'))(_0x1222('0x2'));var moment=require(_0x1222('0x3'));var BPromise=require(_0x1222('0x4'));var rp=require(_0x1222('0x5'));var fs=require('fs');var path=require(_0x1222('0x6'));var rimraf=require(_0x1222('0x7'));var config=require(_0x1222('0x8'));var attributes=require(_0x1222('0x9'));var integrations=require(_0x1222('0xa'));module[_0x1222('0xb')]=function(_0x1c81aa,_0x3ead30){return _0x1c81aa[_0x1222('0xc')](_0x1222('0xd'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d38=['moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x1fbc48,_0x34c37d){var _0x46d8c0=function(_0x4f7384){while(--_0x4f7384){_0x1fbc48['push'](_0x1fbc48['shift']());}};_0x46d8c0(++_0x34c37d);}(_0x9d38,0x127));var _0x89d3=function(_0x4e03f8,_0x336d12){_0x4e03f8=_0x4e03f8-0x0;var _0x1ea68c=_0x9d38[_0x4e03f8];return _0x1ea68c;};'use strict';var _=require(_0x89d3('0x0'));var util=require(_0x89d3('0x1'));var logger=require(_0x89d3('0x2'))(_0x89d3('0x3'));var moment=require(_0x89d3('0x4'));var BPromise=require(_0x89d3('0x5'));var rp=require(_0x89d3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x89d3('0x8'));var integrations=require(_0x89d3('0x9'));module[_0x89d3('0xa')]=function(_0xbada29,_0x5b04bf){return _0xbada29[_0x89d3('0xb')]('ZendeskAccount',attributes,{'tableName':_0x89d3('0xc'),'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 673ea1b..0deb16f 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 _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x4dc0a9,_0x34f782){var _0x121311=function(_0xdeed30){while(--_0xdeed30){_0x4dc0a9['push'](_0x4dc0a9['shift']());}};_0x121311(++_0x34f782);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file +var _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x328b40,_0x370642){var _0x556a56=function(_0x467553){while(--_0x467553){_0x328b40['push'](_0x328b40['shift']());}};_0x556a56(++_0x370642);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'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')]('ZendeskAccount,\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);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 34c0a55..b5e7bde 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 _0x193f=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getTags','create','post','/:id/tags','setTags','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller'];(function(_0x4a5750,_0x36aed3){var _0x41ec0b=function(_0x5736c4){while(--_0x5736c4){_0x4a5750['push'](_0x4a5750['shift']());}};_0x41ec0b(++_0x36aed3);}(_0x193f,0x1b9));var _0xf193=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0x193f[_0x374ccf];return _0x443cde;};'use strict';var multer=require(_0xf193('0x0'));var util=require(_0xf193('0x1'));var path=require(_0xf193('0x2'));var timeout=require(_0xf193('0x3'));var express=require(_0xf193('0x4'));var router=express[_0xf193('0x5')]();var auth=require(_0xf193('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf193('0x7'));var controller=require(_0xf193('0x8'));router[_0xf193('0x9')]('/',auth[_0xf193('0xa')](),controller[_0xf193('0xb')]);router['get'](_0xf193('0xc'),auth[_0xf193('0xa')](),controller[_0xf193('0xd')]);router[_0xf193('0x9')](_0xf193('0xe'),auth['isAuthenticated'](),controller[_0xf193('0xf')]);router[_0xf193('0x9')]('/:id/subjects',auth[_0xf193('0xa')](),controller[_0xf193('0x10')]);router['get']('/:id/descriptions',auth[_0xf193('0xa')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0xf193('0xa')](),controller[_0xf193('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf193('0x12')]);router[_0xf193('0x13')](_0xf193('0x14'),auth[_0xf193('0xa')](),controller[_0xf193('0x15')]);router[_0xf193('0x16')]('/:id',auth[_0xf193('0xa')](),controller[_0xf193('0x17')]);router['delete']('/:id',auth[_0xf193('0xa')](),controller['destroy']);module[_0xf193('0x18')]=router; \ No newline at end of file +var _0xd244=['setTags','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create'];(function(_0x300d13,_0x412659){var _0x39541d=function(_0x4dd523){while(--_0x4dd523){_0x300d13['push'](_0x300d13['shift']());}};_0x39541d(++_0x412659);}(_0xd244,0x77));var _0x4d24=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0xd244[_0x102ff9];return _0x24fa97;};'use strict';var multer=require('multer');var util=require(_0x4d24('0x0'));var path=require(_0x4d24('0x1'));var timeout=require(_0x4d24('0x2'));var express=require(_0x4d24('0x3'));var router=express[_0x4d24('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4d24('0x5'));var config=require(_0x4d24('0x6'));var controller=require(_0x4d24('0x7'));router[_0x4d24('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4d24('0x8')]('/:id',auth[_0x4d24('0x9')](),controller[_0x4d24('0xa')]);router[_0x4d24('0x8')](_0x4d24('0xb'),auth['isAuthenticated'](),controller[_0x4d24('0xc')]);router[_0x4d24('0x8')](_0x4d24('0xd'),auth[_0x4d24('0x9')](),controller[_0x4d24('0xe')]);router[_0x4d24('0x8')](_0x4d24('0xf'),auth[_0x4d24('0x9')](),controller[_0x4d24('0x10')]);router[_0x4d24('0x8')](_0x4d24('0x11'),auth[_0x4d24('0x9')](),controller[_0x4d24('0x12')]);router[_0x4d24('0x13')]('/',auth[_0x4d24('0x9')](),controller[_0x4d24('0x14')]);router[_0x4d24('0x13')]('/:id/tags',auth[_0x4d24('0x9')](),controller[_0x4d24('0x15')]);router[_0x4d24('0x16')](_0x4d24('0x17'),auth[_0x4d24('0x9')](),controller[_0x4d24('0x18')]);router[_0x4d24('0x19')](_0x4d24('0x17'),auth[_0x4d24('0x9')](),controller[_0x4d24('0x1a')]);module[_0x4d24('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b239091..5ccc44d 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 _0xafaf=['STRING','sequelize','exports'];(function(_0x42dd78,_0xca4fb7){var _0x11b824=function(_0x864fcf){while(--_0x864fcf){_0x42dd78['push'](_0x42dd78['shift']());}};_0x11b824(++_0xca4fb7);}(_0xafaf,0xcd));var _0xfafa=function(_0x491265,_0xd1cd81){_0x491265=_0x491265-0x0;var _0x586703=_0xafaf[_0x491265];return _0x586703;};'use strict';var Sequelize=require(_0xfafa('0x0'));module[_0xfafa('0x1')]={'name':{'type':Sequelize[_0xfafa('0x2')]},'description':{'type':Sequelize[_0xfafa('0x2')]}}; \ No newline at end of file +var _0x3b09=['STRING','sequelize','exports'];(function(_0x3d9c47,_0x2fc9f9){var _0x548a05=function(_0x3e2dd4){while(--_0x3e2dd4){_0x3d9c47['push'](_0x3d9c47['shift']());}};_0x548a05(++_0x2fc9f9);}(_0x3b09,0x17e));var _0x93b0=function(_0x295ea9,_0x19d658){_0x295ea9=_0x295ea9-0x0;var _0x59a3fe=_0x3b09[_0x295ea9];return _0x59a3fe;};'use strict';var Sequelize=require(_0x93b0('0x0'));module[_0x93b0('0x1')]={'name':{'type':Sequelize[_0x93b0('0x2')]},'description':{'type':Sequelize[_0x93b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 21ee665..361f5a5 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 _0xfde6=['sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','count','findAll','rows','catch','show','params','includeAll','include','find','create','body','ZendeskField','order','pick','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2b4cde,_0x135b3d){var _0x2af61c=function(_0x35ae7b){while(--_0x35ae7b){_0x2b4cde['push'](_0x2b4cde['shift']());}};_0x2af61c(++_0x135b3d);}(_0xfde6,0xb8));var _0x6fde=function(_0x19425a,_0xe26520){_0x19425a=_0x19425a-0x0;var _0x383ac3=_0xfde6[_0x19425a];return _0x383ac3;};'use strict';var pdf=require(_0x6fde('0x0'));var emlformat=require(_0x6fde('0x1'));var rimraf=require(_0x6fde('0x2'));var zipdir=require(_0x6fde('0x3'));var jsonpatch=require(_0x6fde('0x4'));var rp=require(_0x6fde('0x5'));var moment=require(_0x6fde('0x6'));var BPromise=require(_0x6fde('0x7'));var Mustache=require(_0x6fde('0x8'));var util=require(_0x6fde('0x9'));var path=require('path');var sox=require(_0x6fde('0xa'));var csv=require(_0x6fde('0xb'));var ejs=require(_0x6fde('0xc'));var fs=require('fs');var _=require(_0x6fde('0xd'));var squel=require(_0x6fde('0xe'));var crypto=require(_0x6fde('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6fde('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6fde('0x11'));var Redis=require('ioredis');var authService=require(_0x6fde('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6fde('0x13'));var hardwareService=require(_0x6fde('0x14'));var logger=require(_0x6fde('0x15'))(_0x6fde('0x16'));var utils=require(_0x6fde('0x17'));var config=require(_0x6fde('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6fde('0x19'));var client=jayson[_0x6fde('0x1a')][_0x6fde('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4f2a20,_0x50bf42,_0xd8a3ae){if(_0xd8a3ae){var _0x4d39c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d39c2[_0x6fde('0x1c')](_0x50bf42)){return _0x4f2a20;}else{throw new db['Sequelize']['ValidationError'](_0x6fde('0x1d'));}}else{return _0x4f2a20;}}function respondWithRpcPromise(_0x30aeb3,_0x438d81,_0x394942,_0x3da924){return new BPromise(function(_0x2dc32a,_0x67be6c){var _0x2bf1b4=_0x3da924||client;return _0x2bf1b4[_0x6fde('0x1e')](_0x30aeb3,_0x394942)[_0x6fde('0x1f')](function(_0x30c682){logger[_0x6fde('0x20')](_0x6fde('0x21'),_0x438d81,'request\x20sent');logger[_0x6fde('0x22')](_0x6fde('0x23'),_0x438d81,_0x6fde('0x24'),JSON[_0x6fde('0x25')](_0x30c682));if(_0x30c682[_0x6fde('0x26')]){if(_0x30c682['error'][_0x6fde('0x27')]===0x1f4){logger[_0x6fde('0x26')]('ZendeskConfiguration,\x20%s,\x20%s',_0x438d81,_0x30c682[_0x6fde('0x26')][_0x6fde('0x28')]);return _0x67be6c(_0x30c682['error'][_0x6fde('0x28')]);}logger[_0x6fde('0x26')](_0x6fde('0x21'),_0x438d81,_0x30c682['error'][_0x6fde('0x28')]);return _0x2dc32a(_0x30c682[_0x6fde('0x26')]['message']);}else{logger[_0x6fde('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x438d81,_0x6fde('0x24'));_0x2dc32a(_0x30c682['result'][_0x6fde('0x28')]);}})['catch'](function(_0x22b3ff){logger[_0x6fde('0x26')]('ZendeskConfiguration,\x20%s,\x20%s',_0x438d81,_0x22b3ff);_0x67be6c(_0x22b3ff);});});}function respondWithStatusCode(_0xfa5fef,_0x572cef){_0x572cef=_0x572cef||0xcc;return function(_0x4f4f16){if(_0x4f4f16){return _0xfa5fef[_0x6fde('0x29')](_0x572cef);}return _0xfa5fef[_0x6fde('0x2a')](_0x572cef)[_0x6fde('0x2b')]();};}function respondWithResult(_0x15b49e,_0x4e6473){_0x4e6473=_0x4e6473||0xc8;return function(_0x52c699){if(_0x52c699){return _0x15b49e['status'](_0x4e6473)[_0x6fde('0x2c')](_0x52c699);}};}function respondWithFilteredResult(_0x464c0b,_0x510d9c){return function(_0x4f2f41){if(_0x4f2f41){var _0x2aba22=_0x4f2f41['count'],_0x4a3ad6=_0x510d9c['offset'],_0xace237=_0x510d9c['offset']+_0x510d9c[_0x6fde('0x2d')],_0xb51499;if(_0xace237>=_0x2aba22){_0xace237=_0x2aba22;_0xb51499=0xc8;}else{_0xb51499=0xce;}_0x464c0b[_0x6fde('0x2a')](_0xb51499);return _0x464c0b[_0x6fde('0x2e')](_0x6fde('0x2f'),_0x4a3ad6+'-'+_0xace237+'/'+_0x2aba22)['json'](_0x4f2f41);}return null;};}function patchUpdates(_0x2a912f){return function(_0x31b7ed){try{jsonpatch[_0x6fde('0x30')](_0x31b7ed,_0x2a912f,!![]);}catch(_0x5b8f9f){return BPromise[_0x6fde('0x31')](_0x5b8f9f);}return _0x31b7ed[_0x6fde('0x32')]();};}function saveUpdates(_0x7f0d8b,_0x57fbce){return function(_0x456a15){if(_0x456a15){return _0x456a15[_0x6fde('0x33')](_0x7f0d8b)[_0x6fde('0x1f')](function(_0x3138a9){return _0x3138a9;});}return null;};}function removeEntity(_0x37fd85,_0x5f356d){return function(_0x83d21){if(_0x83d21){return _0x83d21[_0x6fde('0x34')]()[_0x6fde('0x1f')](function(){_0x37fd85[_0x6fde('0x2a')](0xcc)[_0x6fde('0x2b')]();});}};}function handleEntityNotFound(_0x4557b3,_0x43513d){return function(_0x561390){if(!_0x561390){_0x4557b3['sendStatus'](0x194);}return _0x561390;};}function handleError(_0x4a51fa,_0x11df30){_0x11df30=_0x11df30||0x1f4;return function(_0x4dee6e){logger[_0x6fde('0x26')](_0x4dee6e[_0x6fde('0x35')]);if(_0x4dee6e[_0x6fde('0x36')]){delete _0x4dee6e['name'];}_0x4a51fa['status'](_0x11df30)[_0x6fde('0x37')](_0x4dee6e);};}exports['index']=function(_0x1b41cf,_0x39c015){var _0x5873c2={},_0x3a4333={},_0x2c513a={'count':0x0,'rows':[]};var _0x4ead43=_[_0x6fde('0x38')](db[_0x6fde('0x39')][_0x6fde('0x3a')],function(_0x3537c0){return{'name':_0x3537c0[_0x6fde('0x3b')],'type':_0x3537c0[_0x6fde('0x3c')]['key']};});_0x3a4333[_0x6fde('0x3d')]=_[_0x6fde('0x38')](_0x4ead43,'name');_0x3a4333[_0x6fde('0x3e')]=_[_0x6fde('0x3f')](_0x1b41cf['query']);_0x3a4333[_0x6fde('0x40')]=_[_0x6fde('0x41')](_0x3a4333[_0x6fde('0x3d')],_0x3a4333[_0x6fde('0x3e')]);_0x5873c2[_0x6fde('0x42')]=_[_0x6fde('0x41')](_0x3a4333[_0x6fde('0x3d')],qs[_0x6fde('0x43')](_0x1b41cf[_0x6fde('0x3e')]['fields']));_0x5873c2['attributes']=_0x5873c2[_0x6fde('0x42')][_0x6fde('0x44')]?_0x5873c2[_0x6fde('0x42')]:_0x3a4333['model'];if(!_0x1b41cf['query'][_0x6fde('0x45')](_0x6fde('0x46'))){_0x5873c2[_0x6fde('0x2d')]=qs[_0x6fde('0x2d')](_0x1b41cf[_0x6fde('0x3e')][_0x6fde('0x2d')]);_0x5873c2['offset']=qs[_0x6fde('0x47')](_0x1b41cf[_0x6fde('0x3e')][_0x6fde('0x47')]);}_0x5873c2['order']=qs[_0x6fde('0x48')](_0x1b41cf[_0x6fde('0x3e')][_0x6fde('0x48')]);_0x5873c2[_0x6fde('0x49')]=qs[_0x6fde('0x40')](_['pick'](_0x1b41cf[_0x6fde('0x3e')],_0x3a4333[_0x6fde('0x40')]),_0x4ead43);if(_0x1b41cf['query'][_0x6fde('0x4a')]){_0x5873c2['where']=_['merge'](_0x5873c2[_0x6fde('0x49')],{'$or':_[_0x6fde('0x38')](_0x4ead43,function(_0x5e18f8){if(_0x5e18f8['type']!=='VIRTUAL'){var _0x22005c={};_0x22005c[_0x5e18f8['name']]={'$like':'%'+_0x1b41cf[_0x6fde('0x3e')][_0x6fde('0x4a')]+'%'};return _0x22005c;}})});}_0x5873c2=_[_0x6fde('0x4b')]({},_0x5873c2,_0x1b41cf[_0x6fde('0x4c')]);var _0x3be29d={'where':_0x5873c2[_0x6fde('0x49')]};return db[_0x6fde('0x39')][_0x6fde('0x4d')](_0x3be29d)['then'](function(_0x2a7167){_0x2c513a[_0x6fde('0x4d')]=_0x2a7167;if(_0x1b41cf[_0x6fde('0x3e')]['includeAll']){_0x5873c2['include']=[{'all':!![]}];}return db[_0x6fde('0x39')][_0x6fde('0x4e')](_0x5873c2);})[_0x6fde('0x1f')](function(_0x39755c){_0x2c513a[_0x6fde('0x4f')]=_0x39755c;return _0x2c513a;})[_0x6fde('0x1f')](respondWithFilteredResult(_0x39c015,_0x5873c2))[_0x6fde('0x50')](handleError(_0x39c015,null));};exports[_0x6fde('0x51')]=function(_0x3a0a10,_0x3e20ce){var _0x52cb5f={'raw':![],'where':{'id':_0x3a0a10[_0x6fde('0x52')]['id']}},_0x2c9131={};_0x2c9131[_0x6fde('0x3d')]=_['keys'](db[_0x6fde('0x39')]['rawAttributes']);_0x2c9131['query']=_['keys'](_0x3a0a10['query']);_0x2c9131[_0x6fde('0x40')]=_[_0x6fde('0x41')](_0x2c9131[_0x6fde('0x3d')],_0x2c9131[_0x6fde('0x3e')]);_0x52cb5f[_0x6fde('0x42')]=_[_0x6fde('0x41')](_0x2c9131[_0x6fde('0x3d')],qs['fields'](_0x3a0a10['query']['fields']));_0x52cb5f[_0x6fde('0x42')]=_0x52cb5f[_0x6fde('0x42')][_0x6fde('0x44')]?_0x52cb5f[_0x6fde('0x42')]:_0x2c9131[_0x6fde('0x3d')];if(_0x3a0a10[_0x6fde('0x3e')][_0x6fde('0x53')]){_0x52cb5f[_0x6fde('0x54')]=[{'all':!![]}];}_0x52cb5f=_['merge']({},_0x52cb5f,_0x3a0a10[_0x6fde('0x4c')]);return db['ZendeskConfiguration'][_0x6fde('0x55')](_0x52cb5f)[_0x6fde('0x1f')](handleEntityNotFound(_0x3e20ce,null))['then'](respondWithResult(_0x3e20ce,null))['catch'](handleError(_0x3e20ce,null));};exports['create']=function(_0x1d15b4,_0x579d5b){return db[_0x6fde('0x39')][_0x6fde('0x56')](_0x1d15b4[_0x6fde('0x57')],{})['then'](respondWithResult(_0x579d5b,0xc9))[_0x6fde('0x50')](handleError(_0x579d5b,null));};exports[_0x6fde('0x33')]=function(_0x4c6bea,_0x361705){if(_0x4c6bea[_0x6fde('0x57')]['id']){delete _0x4c6bea[_0x6fde('0x57')]['id'];}return db[_0x6fde('0x39')]['find']({'where':{'id':_0x4c6bea['params']['id']}})['then'](handleEntityNotFound(_0x361705,null))[_0x6fde('0x1f')](saveUpdates(_0x4c6bea['body'],null))['then'](respondWithResult(_0x361705,null))[_0x6fde('0x50')](handleError(_0x361705,null));};exports[_0x6fde('0x34')]=function(_0x489eb0,_0x4c2229){return db['ZendeskConfiguration'][_0x6fde('0x55')]({'where':{'id':_0x489eb0[_0x6fde('0x52')]['id']}})[_0x6fde('0x1f')](handleEntityNotFound(_0x4c2229,null))[_0x6fde('0x1f')](removeEntity(_0x4c2229,null))[_0x6fde('0x50')](handleError(_0x4c2229,null));};exports['getFields']=function(_0x2547a1,_0x44120c,_0x3c7404){var _0x524a79={};var _0x3dc277={};var _0x2b80e3;var _0x5a0a65;return db[_0x6fde('0x39')]['findOne']({'where':{'id':_0x2547a1[_0x6fde('0x52')]['id']}})[_0x6fde('0x1f')](handleEntityNotFound(_0x44120c,null))[_0x6fde('0x1f')](function(_0xf96c4){if(_0xf96c4){_0x2b80e3=_0xf96c4;_0x3dc277[_0x6fde('0x3d')]=_[_0x6fde('0x3f')](db[_0x6fde('0x58')][_0x6fde('0x3a')]);_0x3dc277[_0x6fde('0x3e')]=_['keys'](_0x2547a1[_0x6fde('0x3e')]);_0x3dc277[_0x6fde('0x40')]=_[_0x6fde('0x41')](_0x3dc277['model'],_0x3dc277[_0x6fde('0x3e')]);_0x524a79[_0x6fde('0x42')]=_[_0x6fde('0x41')](_0x3dc277['model'],qs[_0x6fde('0x43')](_0x2547a1[_0x6fde('0x3e')][_0x6fde('0x43')]));_0x524a79['attributes']=_0x524a79[_0x6fde('0x42')][_0x6fde('0x44')]?_0x524a79[_0x6fde('0x42')]:_0x3dc277[_0x6fde('0x3d')];_0x524a79[_0x6fde('0x59')]=qs[_0x6fde('0x48')](_0x2547a1[_0x6fde('0x3e')][_0x6fde('0x48')]);_0x524a79[_0x6fde('0x49')]=qs[_0x6fde('0x40')](_[_0x6fde('0x5a')](_0x2547a1[_0x6fde('0x3e')],_0x3dc277['filters']));if(_0x2547a1[_0x6fde('0x3e')][_0x6fde('0x4a')]){_0x524a79['where']=_[_0x6fde('0x4b')](_0x524a79[_0x6fde('0x49')],{'$or':_[_0x6fde('0x38')](_0x524a79['attributes'],function(_0x19fb44){var _0x5e2cfb={};_0x5e2cfb[_0x19fb44]={'$like':'%'+_0x2547a1[_0x6fde('0x3e')][_0x6fde('0x4a')]+'%'};return _0x5e2cfb;})});}_0x524a79=_[_0x6fde('0x4b')]({},_0x524a79,_0x2547a1[_0x6fde('0x4c')]);return _0x2b80e3[_0x6fde('0x5b')](_0x524a79);}})[_0x6fde('0x1f')](function(_0x43b665){if(_0x43b665){_0x5a0a65=_0x43b665[_0x6fde('0x44')];if(!_0x2547a1[_0x6fde('0x3e')][_0x6fde('0x45')]('nolimit')){_0x524a79['limit']=qs[_0x6fde('0x2d')](_0x2547a1[_0x6fde('0x3e')][_0x6fde('0x2d')]);_0x524a79[_0x6fde('0x47')]=qs[_0x6fde('0x47')](_0x2547a1['query'][_0x6fde('0x47')]);}return _0x2b80e3[_0x6fde('0x5b')](_0x524a79);}})[_0x6fde('0x1f')](function(_0x2c4ea1){if(_0x2c4ea1){return _0x2c4ea1?{'count':_0x5a0a65,'rows':_0x2c4ea1}:null;}})[_0x6fde('0x1f')](respondWithResult(_0x44120c,null))['catch'](handleError(_0x44120c,null));};exports[_0x6fde('0x5c')]=function(_0x565358,_0xdec5d2,_0x1463b2){var _0x53ba36={};var _0x246e5e={};var _0x1e62d9;var _0x19867c;return db['ZendeskConfiguration'][_0x6fde('0x5d')]({'where':{'id':_0x565358[_0x6fde('0x52')]['id']}})[_0x6fde('0x1f')](handleEntityNotFound(_0xdec5d2,null))[_0x6fde('0x1f')](function(_0x3ebbaa){if(_0x3ebbaa){_0x1e62d9=_0x3ebbaa;_0x246e5e['model']=_[_0x6fde('0x3f')](db[_0x6fde('0x58')][_0x6fde('0x3a')]);_0x246e5e['query']=_['keys'](_0x565358[_0x6fde('0x3e')]);_0x246e5e['filters']=_[_0x6fde('0x41')](_0x246e5e[_0x6fde('0x3d')],_0x246e5e['query']);_0x53ba36[_0x6fde('0x42')]=_[_0x6fde('0x41')](_0x246e5e[_0x6fde('0x3d')],qs[_0x6fde('0x43')](_0x565358[_0x6fde('0x3e')]['fields']));_0x53ba36[_0x6fde('0x42')]=_0x53ba36[_0x6fde('0x42')]['length']?_0x53ba36[_0x6fde('0x42')]:_0x246e5e[_0x6fde('0x3d')];_0x53ba36['order']=qs[_0x6fde('0x48')](_0x565358['query'][_0x6fde('0x48')]);_0x53ba36[_0x6fde('0x49')]=qs[_0x6fde('0x40')](_['pick'](_0x565358[_0x6fde('0x3e')],_0x246e5e[_0x6fde('0x40')]));if(_0x565358[_0x6fde('0x3e')]['filter']){_0x53ba36[_0x6fde('0x49')]=_[_0x6fde('0x4b')](_0x53ba36[_0x6fde('0x49')],{'$or':_[_0x6fde('0x38')](_0x53ba36[_0x6fde('0x42')],function(_0x7294e3){var _0x479597={};_0x479597[_0x7294e3]={'$like':'%'+_0x565358[_0x6fde('0x3e')][_0x6fde('0x4a')]+'%'};return _0x479597;})});}_0x53ba36=_[_0x6fde('0x4b')]({},_0x53ba36,_0x565358[_0x6fde('0x4c')]);return _0x1e62d9[_0x6fde('0x5c')](_0x53ba36);}})[_0x6fde('0x1f')](function(_0xcfec4d){if(_0xcfec4d){_0x19867c=_0xcfec4d[_0x6fde('0x44')];if(!_0x565358[_0x6fde('0x3e')][_0x6fde('0x45')]('nolimit')){_0x53ba36['limit']=qs[_0x6fde('0x2d')](_0x565358[_0x6fde('0x3e')][_0x6fde('0x2d')]);_0x53ba36[_0x6fde('0x47')]=qs[_0x6fde('0x47')](_0x565358[_0x6fde('0x3e')]['offset']);}return _0x1e62d9[_0x6fde('0x5c')](_0x53ba36);}})[_0x6fde('0x1f')](function(_0x57bf3e){if(_0x57bf3e){return _0x57bf3e?{'count':_0x19867c,'rows':_0x57bf3e}:null;}})[_0x6fde('0x1f')](respondWithResult(_0xdec5d2,null))[_0x6fde('0x50')](handleError(_0xdec5d2,null));};exports[_0x6fde('0x5e')]=function(_0x200532,_0x5ec6f5,_0x331f38){var _0x495496={};var _0x27966c={};var _0x4d787f;var _0xd53854;return db[_0x6fde('0x39')][_0x6fde('0x5d')]({'where':{'id':_0x200532[_0x6fde('0x52')]['id']}})[_0x6fde('0x1f')](handleEntityNotFound(_0x5ec6f5,null))[_0x6fde('0x1f')](function(_0x551626){if(_0x551626){_0x4d787f=_0x551626;_0x27966c[_0x6fde('0x3d')]=_[_0x6fde('0x3f')](db[_0x6fde('0x58')][_0x6fde('0x3a')]);_0x27966c['query']=_[_0x6fde('0x3f')](_0x200532[_0x6fde('0x3e')]);_0x27966c[_0x6fde('0x40')]=_[_0x6fde('0x41')](_0x27966c[_0x6fde('0x3d')],_0x27966c[_0x6fde('0x3e')]);_0x495496[_0x6fde('0x42')]=_[_0x6fde('0x41')](_0x27966c[_0x6fde('0x3d')],qs[_0x6fde('0x43')](_0x200532[_0x6fde('0x3e')][_0x6fde('0x43')]));_0x495496[_0x6fde('0x42')]=_0x495496[_0x6fde('0x42')]['length']?_0x495496[_0x6fde('0x42')]:_0x27966c['model'];_0x495496[_0x6fde('0x59')]=qs[_0x6fde('0x48')](_0x200532[_0x6fde('0x3e')][_0x6fde('0x48')]);_0x495496[_0x6fde('0x49')]=qs['filters'](_[_0x6fde('0x5a')](_0x200532['query'],_0x27966c[_0x6fde('0x40')]));if(_0x200532[_0x6fde('0x3e')][_0x6fde('0x4a')]){_0x495496['where']=_['merge'](_0x495496['where'],{'$or':_['map'](_0x495496[_0x6fde('0x42')],function(_0x3fa811){var _0x3c876d={};_0x3c876d[_0x3fa811]={'$like':'%'+_0x200532[_0x6fde('0x3e')][_0x6fde('0x4a')]+'%'};return _0x3c876d;})});}_0x495496=_[_0x6fde('0x4b')]({},_0x495496,_0x200532[_0x6fde('0x4c')]);return _0x4d787f[_0x6fde('0x5e')](_0x495496);}})[_0x6fde('0x1f')](function(_0x13cf96){if(_0x13cf96){_0xd53854=_0x13cf96[_0x6fde('0x44')];if(!_0x200532[_0x6fde('0x3e')]['hasOwnProperty'](_0x6fde('0x46'))){_0x495496[_0x6fde('0x2d')]=qs[_0x6fde('0x2d')](_0x200532[_0x6fde('0x3e')][_0x6fde('0x2d')]);_0x495496[_0x6fde('0x47')]=qs[_0x6fde('0x47')](_0x200532['query'][_0x6fde('0x47')]);}return _0x4d787f[_0x6fde('0x5e')](_0x495496);}})[_0x6fde('0x1f')](function(_0x1a4208){if(_0x1a4208){return _0x1a4208?{'count':_0xd53854,'rows':_0x1a4208}:null;}})[_0x6fde('0x1f')](respondWithResult(_0x5ec6f5,null))['catch'](handleError(_0x5ec6f5,null));};exports['getTags']=function(_0x1d3f79,_0x2f4880,_0x19d2cd){var _0x2acfba={};var _0x5bc924={};var _0x1e7e25;var _0x16994a;return db[_0x6fde('0x39')][_0x6fde('0x5d')]({'where':{'id':_0x1d3f79['params']['id']}})[_0x6fde('0x1f')](handleEntityNotFound(_0x2f4880,null))['then'](function(_0x2b7dce){if(_0x2b7dce){_0x1e7e25=_0x2b7dce;_0x5bc924[_0x6fde('0x3d')]=_['keys'](db['Tag'][_0x6fde('0x3a')]);_0x5bc924[_0x6fde('0x3e')]=_[_0x6fde('0x3f')](_0x1d3f79[_0x6fde('0x3e')]);_0x5bc924[_0x6fde('0x40')]=_[_0x6fde('0x41')](_0x5bc924['model'],_0x5bc924[_0x6fde('0x3e')]);_0x2acfba[_0x6fde('0x42')]=_[_0x6fde('0x41')](_0x5bc924[_0x6fde('0x3d')],qs[_0x6fde('0x43')](_0x1d3f79[_0x6fde('0x3e')]['fields']));_0x2acfba['attributes']=_0x2acfba[_0x6fde('0x42')][_0x6fde('0x44')]?_0x2acfba[_0x6fde('0x42')]:_0x5bc924[_0x6fde('0x3d')];_0x2acfba[_0x6fde('0x59')]=qs[_0x6fde('0x48')](_0x1d3f79[_0x6fde('0x3e')][_0x6fde('0x48')]);_0x2acfba[_0x6fde('0x49')]=qs[_0x6fde('0x40')](_[_0x6fde('0x5a')](_0x1d3f79[_0x6fde('0x3e')],_0x5bc924[_0x6fde('0x40')]));if(_0x1d3f79[_0x6fde('0x3e')]['filter']){_0x2acfba['where']=_[_0x6fde('0x4b')](_0x2acfba[_0x6fde('0x49')],{'$or':_[_0x6fde('0x38')](_0x2acfba[_0x6fde('0x42')],function(_0x1b779b){var _0x2e5709={};_0x2e5709[_0x1b779b]={'$like':'%'+_0x1d3f79[_0x6fde('0x3e')][_0x6fde('0x4a')]+'%'};return _0x2e5709;})});}_0x2acfba=_[_0x6fde('0x4b')]({},_0x2acfba,_0x1d3f79[_0x6fde('0x4c')]);return _0x1e7e25['getTags'](_0x2acfba);}})['then'](function(_0x2a866c){if(_0x2a866c){_0x16994a=_0x2a866c[_0x6fde('0x44')];if(!_0x1d3f79[_0x6fde('0x3e')][_0x6fde('0x45')](_0x6fde('0x46'))){_0x2acfba[_0x6fde('0x2d')]=qs[_0x6fde('0x2d')](_0x1d3f79['query'][_0x6fde('0x2d')]);_0x2acfba[_0x6fde('0x47')]=qs['offset'](_0x1d3f79['query']['offset']);}return _0x1e7e25[_0x6fde('0x5f')](_0x2acfba);}})[_0x6fde('0x1f')](function(_0x396302){if(_0x396302){return _0x396302?{'count':_0x16994a,'rows':_0x396302}:null;}})[_0x6fde('0x1f')](respondWithResult(_0x2f4880,null))[_0x6fde('0x50')](handleError(_0x2f4880,null));};exports[_0x6fde('0x60')]=function(_0x1791ed,_0x4bbe9d,_0x1297c2){if(_0x1791ed[_0x6fde('0x57')]['id']){delete _0x1791ed['body']['id'];}return db[_0x6fde('0x39')][_0x6fde('0x5d')]({'where':{'id':_0x1791ed['params']['id']}})[_0x6fde('0x1f')](handleEntityNotFound(_0x4bbe9d,null))[_0x6fde('0x1f')](function(_0x31ff21){if(_0x31ff21){return _0x31ff21[_0x6fde('0x60')](_0x1791ed[_0x6fde('0x57')]['ids']||[]);}return null;})[_0x6fde('0x1f')](respondWithResult(_0x4bbe9d,null))[_0x6fde('0x50')](handleError(_0x4bbe9d,null));}; \ No newline at end of file +var _0xd51d=['catch','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getFields','ZendeskField','getSubjects','findOne','pick','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xa0195,_0x1eac94){var _0x21755e=function(_0x4caccf){while(--_0x4caccf){_0xa0195['push'](_0xa0195['shift']());}};_0x21755e(++_0x1eac94);}(_0xd51d,0xa1));var _0xdd51=function(_0xdf46fe,_0x4e7d26){_0xdf46fe=_0xdf46fe-0x0;var _0x40b8b8=_0xd51d[_0xdf46fe];return _0x40b8b8;};'use strict';var pdf=require(_0xdd51('0x0'));var emlformat=require(_0xdd51('0x1'));var rimraf=require(_0xdd51('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd51('0x3'));var rp=require(_0xdd51('0x4'));var moment=require(_0xdd51('0x5'));var BPromise=require(_0xdd51('0x6'));var Mustache=require(_0xdd51('0x7'));var util=require(_0xdd51('0x8'));var path=require(_0xdd51('0x9'));var sox=require(_0xdd51('0xa'));var csv=require(_0xdd51('0xb'));var ejs=require(_0xdd51('0xc'));var fs=require('fs');var _=require(_0xdd51('0xd'));var squel=require(_0xdd51('0xe'));var crypto=require(_0xdd51('0xf'));var jsforce=require(_0xdd51('0x10'));var deskjs=require(_0xdd51('0x11'));var toCsv=require(_0xdd51('0xb'));var querystring=require('querystring');var Papa=require(_0xdd51('0x12'));var Redis=require('ioredis');var authService=require(_0xdd51('0x13'));var qs=require(_0xdd51('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd51('0x15'));var logger=require(_0xdd51('0x16'))(_0xdd51('0x17'));var utils=require(_0xdd51('0x18'));var config=require(_0xdd51('0x19'));var db=require(_0xdd51('0x1a'))['db'];var jayson=require(_0xdd51('0x1b'));var client=jayson[_0xdd51('0x1c')][_0xdd51('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4d4751,_0x274995,_0x277a6a){if(_0x277a6a){var _0x5940b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5940b0[_0xdd51('0x1e')](_0x274995)){return _0x4d4751;}else{throw new db['Sequelize'][(_0xdd51('0x1f'))](_0xdd51('0x20'));}}else{return _0x4d4751;}}function respondWithRpcPromise(_0xeceeca,_0x5c122d,_0x1f9080,_0x5877a3){return new BPromise(function(_0x3c28ff,_0x236eaa){var _0x409737=_0x5877a3||client;return _0x409737[_0xdd51('0x21')](_0xeceeca,_0x1f9080)['then'](function(_0x4a7ceb){logger[_0xdd51('0x22')](_0xdd51('0x23'),_0x5c122d,_0xdd51('0x24'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5c122d,'request\x20sent',JSON[_0xdd51('0x25')](_0x4a7ceb));if(_0x4a7ceb[_0xdd51('0x26')]){if(_0x4a7ceb[_0xdd51('0x26')][_0xdd51('0x27')]===0x1f4){logger['error'](_0xdd51('0x23'),_0x5c122d,_0x4a7ceb['error'][_0xdd51('0x28')]);return _0x236eaa(_0x4a7ceb[_0xdd51('0x26')][_0xdd51('0x28')]);}logger[_0xdd51('0x26')](_0xdd51('0x23'),_0x5c122d,_0x4a7ceb['error'][_0xdd51('0x28')]);return _0x3c28ff(_0x4a7ceb['error'][_0xdd51('0x28')]);}else{logger[_0xdd51('0x22')](_0xdd51('0x23'),_0x5c122d,_0xdd51('0x24'));_0x3c28ff(_0x4a7ceb['result']['message']);}})[_0xdd51('0x29')](function(_0x4996d6){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5c122d,_0x4996d6);_0x236eaa(_0x4996d6);});});}function respondWithStatusCode(_0x26f4e0,_0x11e55c){_0x11e55c=_0x11e55c||0xcc;return function(_0x368c64){if(_0x368c64){return _0x26f4e0['sendStatus'](_0x11e55c);}return _0x26f4e0[_0xdd51('0x2a')](_0x11e55c)['end']();};}function respondWithResult(_0x3c63f3,_0xd6e763){_0xd6e763=_0xd6e763||0xc8;return function(_0x56dbbe){if(_0x56dbbe){return _0x3c63f3['status'](_0xd6e763)[_0xdd51('0x2b')](_0x56dbbe);}};}function respondWithFilteredResult(_0x2da5d6,_0x4b5f8e){return function(_0x1e3fe0){if(_0x1e3fe0){var _0x3f7e8f=_0x1e3fe0[_0xdd51('0x2c')],_0x5bd1d0=_0x4b5f8e[_0xdd51('0x2d')],_0x4cf833=_0x4b5f8e[_0xdd51('0x2d')]+_0x4b5f8e[_0xdd51('0x2e')],_0x2efd78;if(_0x4cf833>=_0x3f7e8f){_0x4cf833=_0x3f7e8f;_0x2efd78=0xc8;}else{_0x2efd78=0xce;}_0x2da5d6[_0xdd51('0x2a')](_0x2efd78);return _0x2da5d6['set'](_0xdd51('0x2f'),_0x5bd1d0+'-'+_0x4cf833+'/'+_0x3f7e8f)[_0xdd51('0x2b')](_0x1e3fe0);}return null;};}function patchUpdates(_0x4859cc){return function(_0x295c4d){try{jsonpatch[_0xdd51('0x30')](_0x295c4d,_0x4859cc,!![]);}catch(_0x9ee878){return BPromise[_0xdd51('0x31')](_0x9ee878);}return _0x295c4d[_0xdd51('0x32')]();};}function saveUpdates(_0xdb0385,_0xffa0e9){return function(_0x49a7ed){if(_0x49a7ed){return _0x49a7ed[_0xdd51('0x33')](_0xdb0385)[_0xdd51('0x34')](function(_0x2cf24a){return _0x2cf24a;});}return null;};}function removeEntity(_0x124846,_0x1e6342){return function(_0x2395a8){if(_0x2395a8){return _0x2395a8['destroy']()[_0xdd51('0x34')](function(){_0x124846[_0xdd51('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x226223,_0x2e8966){return function(_0x57b3a9){if(!_0x57b3a9){_0x226223[_0xdd51('0x35')](0x194);}return _0x57b3a9;};}function handleError(_0xc5faa5,_0xc51473){_0xc51473=_0xc51473||0x1f4;return function(_0x48e727){logger[_0xdd51('0x26')](_0x48e727[_0xdd51('0x36')]);if(_0x48e727['name']){delete _0x48e727[_0xdd51('0x37')];}_0xc5faa5[_0xdd51('0x2a')](_0xc51473)[_0xdd51('0x38')](_0x48e727);};}exports[_0xdd51('0x39')]=function(_0x5af3af,_0x2f7ae5){var _0x447580={},_0x18a2e5={},_0x50f373={'count':0x0,'rows':[]};var _0x30f6ff=_['map'](db[_0xdd51('0x3a')][_0xdd51('0x3b')],function(_0x261b93){return{'name':_0x261b93[_0xdd51('0x3c')],'type':_0x261b93[_0xdd51('0x3d')][_0xdd51('0x3e')]};});_0x18a2e5['model']=_[_0xdd51('0x3f')](_0x30f6ff,_0xdd51('0x37'));_0x18a2e5[_0xdd51('0x40')]=_[_0xdd51('0x41')](_0x5af3af[_0xdd51('0x40')]);_0x18a2e5[_0xdd51('0x42')]=_[_0xdd51('0x43')](_0x18a2e5['model'],_0x18a2e5[_0xdd51('0x40')]);_0x447580[_0xdd51('0x44')]=_['intersection'](_0x18a2e5[_0xdd51('0x45')],qs[_0xdd51('0x46')](_0x5af3af[_0xdd51('0x40')][_0xdd51('0x46')]));_0x447580[_0xdd51('0x44')]=_0x447580[_0xdd51('0x44')][_0xdd51('0x47')]?_0x447580[_0xdd51('0x44')]:_0x18a2e5['model'];if(!_0x5af3af[_0xdd51('0x40')][_0xdd51('0x48')](_0xdd51('0x49'))){_0x447580['limit']=qs[_0xdd51('0x2e')](_0x5af3af[_0xdd51('0x40')][_0xdd51('0x2e')]);_0x447580[_0xdd51('0x2d')]=qs[_0xdd51('0x2d')](_0x5af3af[_0xdd51('0x40')][_0xdd51('0x2d')]);}_0x447580[_0xdd51('0x4a')]=qs[_0xdd51('0x4b')](_0x5af3af[_0xdd51('0x40')][_0xdd51('0x4b')]);_0x447580[_0xdd51('0x4c')]=qs[_0xdd51('0x42')](_['pick'](_0x5af3af[_0xdd51('0x40')],_0x18a2e5[_0xdd51('0x42')]),_0x30f6ff);if(_0x5af3af[_0xdd51('0x40')][_0xdd51('0x4d')]){_0x447580[_0xdd51('0x4c')]=_[_0xdd51('0x4e')](_0x447580['where'],{'$or':_[_0xdd51('0x3f')](_0x30f6ff,function(_0x570ed9){if(_0x570ed9[_0xdd51('0x3d')]!==_0xdd51('0x4f')){var _0x309038={};_0x309038[_0x570ed9[_0xdd51('0x37')]]={'$like':'%'+_0x5af3af['query'][_0xdd51('0x4d')]+'%'};return _0x309038;}})});}_0x447580=_[_0xdd51('0x4e')]({},_0x447580,_0x5af3af[_0xdd51('0x50')]);var _0x4ac4f6={'where':_0x447580[_0xdd51('0x4c')]};return db[_0xdd51('0x3a')][_0xdd51('0x2c')](_0x4ac4f6)[_0xdd51('0x34')](function(_0x326307){_0x50f373['count']=_0x326307;if(_0x5af3af[_0xdd51('0x40')][_0xdd51('0x51')]){_0x447580[_0xdd51('0x52')]=[{'all':!![]}];}return db[_0xdd51('0x3a')][_0xdd51('0x53')](_0x447580);})[_0xdd51('0x34')](function(_0x279660){_0x50f373[_0xdd51('0x54')]=_0x279660;return _0x50f373;})[_0xdd51('0x34')](respondWithFilteredResult(_0x2f7ae5,_0x447580))[_0xdd51('0x29')](handleError(_0x2f7ae5,null));};exports[_0xdd51('0x55')]=function(_0x3c59a1,_0x169e1a){var _0x1e66a5={'raw':![],'where':{'id':_0x3c59a1[_0xdd51('0x56')]['id']}},_0x57d4dd={};_0x57d4dd[_0xdd51('0x45')]=_[_0xdd51('0x41')](db[_0xdd51('0x3a')][_0xdd51('0x3b')]);_0x57d4dd[_0xdd51('0x40')]=_['keys'](_0x3c59a1['query']);_0x57d4dd[_0xdd51('0x42')]=_[_0xdd51('0x43')](_0x57d4dd['model'],_0x57d4dd['query']);_0x1e66a5[_0xdd51('0x44')]=_[_0xdd51('0x43')](_0x57d4dd[_0xdd51('0x45')],qs[_0xdd51('0x46')](_0x3c59a1[_0xdd51('0x40')][_0xdd51('0x46')]));_0x1e66a5[_0xdd51('0x44')]=_0x1e66a5[_0xdd51('0x44')][_0xdd51('0x47')]?_0x1e66a5['attributes']:_0x57d4dd[_0xdd51('0x45')];if(_0x3c59a1[_0xdd51('0x40')]['includeAll']){_0x1e66a5[_0xdd51('0x52')]=[{'all':!![]}];}_0x1e66a5=_[_0xdd51('0x4e')]({},_0x1e66a5,_0x3c59a1[_0xdd51('0x50')]);return db[_0xdd51('0x3a')][_0xdd51('0x57')](_0x1e66a5)[_0xdd51('0x34')](handleEntityNotFound(_0x169e1a,null))[_0xdd51('0x34')](respondWithResult(_0x169e1a,null))[_0xdd51('0x29')](handleError(_0x169e1a,null));};exports[_0xdd51('0x58')]=function(_0x1cf065,_0x47687b){return db[_0xdd51('0x3a')][_0xdd51('0x58')](_0x1cf065[_0xdd51('0x59')],{})[_0xdd51('0x34')](respondWithResult(_0x47687b,0xc9))['catch'](handleError(_0x47687b,null));};exports['update']=function(_0x4a89f2,_0x533f16){if(_0x4a89f2[_0xdd51('0x59')]['id']){delete _0x4a89f2['body']['id'];}return db[_0xdd51('0x3a')][_0xdd51('0x57')]({'where':{'id':_0x4a89f2[_0xdd51('0x56')]['id']}})[_0xdd51('0x34')](handleEntityNotFound(_0x533f16,null))['then'](saveUpdates(_0x4a89f2[_0xdd51('0x59')],null))[_0xdd51('0x34')](respondWithResult(_0x533f16,null))['catch'](handleError(_0x533f16,null));};exports[_0xdd51('0x5a')]=function(_0x1c3070,_0x32051d){return db[_0xdd51('0x3a')][_0xdd51('0x57')]({'where':{'id':_0x1c3070[_0xdd51('0x56')]['id']}})[_0xdd51('0x34')](handleEntityNotFound(_0x32051d,null))[_0xdd51('0x34')](removeEntity(_0x32051d,null))[_0xdd51('0x29')](handleError(_0x32051d,null));};exports[_0xdd51('0x5b')]=function(_0x114759,_0x1fe676,_0xbddc0f){var _0xa79aa5={};var _0xa5641d={};var _0xff0e58;var _0x1e4465;return db[_0xdd51('0x3a')]['findOne']({'where':{'id':_0x114759['params']['id']}})[_0xdd51('0x34')](handleEntityNotFound(_0x1fe676,null))[_0xdd51('0x34')](function(_0x459da2){if(_0x459da2){_0xff0e58=_0x459da2;_0xa5641d[_0xdd51('0x45')]=_[_0xdd51('0x41')](db[_0xdd51('0x5c')][_0xdd51('0x3b')]);_0xa5641d[_0xdd51('0x40')]=_[_0xdd51('0x41')](_0x114759[_0xdd51('0x40')]);_0xa5641d[_0xdd51('0x42')]=_[_0xdd51('0x43')](_0xa5641d[_0xdd51('0x45')],_0xa5641d[_0xdd51('0x40')]);_0xa79aa5[_0xdd51('0x44')]=_[_0xdd51('0x43')](_0xa5641d['model'],qs[_0xdd51('0x46')](_0x114759['query']['fields']));_0xa79aa5[_0xdd51('0x44')]=_0xa79aa5['attributes'][_0xdd51('0x47')]?_0xa79aa5[_0xdd51('0x44')]:_0xa5641d[_0xdd51('0x45')];_0xa79aa5[_0xdd51('0x4a')]=qs[_0xdd51('0x4b')](_0x114759[_0xdd51('0x40')][_0xdd51('0x4b')]);_0xa79aa5[_0xdd51('0x4c')]=qs[_0xdd51('0x42')](_['pick'](_0x114759[_0xdd51('0x40')],_0xa5641d[_0xdd51('0x42')]));if(_0x114759[_0xdd51('0x40')][_0xdd51('0x4d')]){_0xa79aa5['where']=_[_0xdd51('0x4e')](_0xa79aa5[_0xdd51('0x4c')],{'$or':_[_0xdd51('0x3f')](_0xa79aa5['attributes'],function(_0x38a04d){var _0x3bd586={};_0x3bd586[_0x38a04d]={'$like':'%'+_0x114759[_0xdd51('0x40')][_0xdd51('0x4d')]+'%'};return _0x3bd586;})});}_0xa79aa5=_[_0xdd51('0x4e')]({},_0xa79aa5,_0x114759['options']);return _0xff0e58['getFields'](_0xa79aa5);}})[_0xdd51('0x34')](function(_0xdc121e){if(_0xdc121e){_0x1e4465=_0xdc121e[_0xdd51('0x47')];if(!_0x114759['query']['hasOwnProperty'](_0xdd51('0x49'))){_0xa79aa5[_0xdd51('0x2e')]=qs[_0xdd51('0x2e')](_0x114759[_0xdd51('0x40')][_0xdd51('0x2e')]);_0xa79aa5['offset']=qs[_0xdd51('0x2d')](_0x114759[_0xdd51('0x40')][_0xdd51('0x2d')]);}return _0xff0e58[_0xdd51('0x5b')](_0xa79aa5);}})[_0xdd51('0x34')](function(_0x37de7f){if(_0x37de7f){return _0x37de7f?{'count':_0x1e4465,'rows':_0x37de7f}:null;}})[_0xdd51('0x34')](respondWithResult(_0x1fe676,null))[_0xdd51('0x29')](handleError(_0x1fe676,null));};exports[_0xdd51('0x5d')]=function(_0x1fb56e,_0x1e7ae4,_0x11b13d){var _0x5abc2f={};var _0x9813e8={};var _0x29f2fb;var _0x2d07a8;return db[_0xdd51('0x3a')][_0xdd51('0x5e')]({'where':{'id':_0x1fb56e[_0xdd51('0x56')]['id']}})[_0xdd51('0x34')](handleEntityNotFound(_0x1e7ae4,null))['then'](function(_0x581f8d){if(_0x581f8d){_0x29f2fb=_0x581f8d;_0x9813e8[_0xdd51('0x45')]=_[_0xdd51('0x41')](db[_0xdd51('0x5c')]['rawAttributes']);_0x9813e8[_0xdd51('0x40')]=_[_0xdd51('0x41')](_0x1fb56e[_0xdd51('0x40')]);_0x9813e8[_0xdd51('0x42')]=_[_0xdd51('0x43')](_0x9813e8[_0xdd51('0x45')],_0x9813e8[_0xdd51('0x40')]);_0x5abc2f[_0xdd51('0x44')]=_['intersection'](_0x9813e8[_0xdd51('0x45')],qs['fields'](_0x1fb56e[_0xdd51('0x40')][_0xdd51('0x46')]));_0x5abc2f[_0xdd51('0x44')]=_0x5abc2f[_0xdd51('0x44')]['length']?_0x5abc2f[_0xdd51('0x44')]:_0x9813e8[_0xdd51('0x45')];_0x5abc2f[_0xdd51('0x4a')]=qs['sort'](_0x1fb56e[_0xdd51('0x40')][_0xdd51('0x4b')]);_0x5abc2f['where']=qs[_0xdd51('0x42')](_[_0xdd51('0x5f')](_0x1fb56e['query'],_0x9813e8[_0xdd51('0x42')]));if(_0x1fb56e[_0xdd51('0x40')][_0xdd51('0x4d')]){_0x5abc2f[_0xdd51('0x4c')]=_[_0xdd51('0x4e')](_0x5abc2f[_0xdd51('0x4c')],{'$or':_[_0xdd51('0x3f')](_0x5abc2f[_0xdd51('0x44')],function(_0x5f1b23){var _0x354245={};_0x354245[_0x5f1b23]={'$like':'%'+_0x1fb56e[_0xdd51('0x40')][_0xdd51('0x4d')]+'%'};return _0x354245;})});}_0x5abc2f=_[_0xdd51('0x4e')]({},_0x5abc2f,_0x1fb56e[_0xdd51('0x50')]);return _0x29f2fb[_0xdd51('0x5d')](_0x5abc2f);}})['then'](function(_0x3ffe1b){if(_0x3ffe1b){_0x2d07a8=_0x3ffe1b['length'];if(!_0x1fb56e['query']['hasOwnProperty'](_0xdd51('0x49'))){_0x5abc2f[_0xdd51('0x2e')]=qs[_0xdd51('0x2e')](_0x1fb56e['query']['limit']);_0x5abc2f[_0xdd51('0x2d')]=qs[_0xdd51('0x2d')](_0x1fb56e[_0xdd51('0x40')][_0xdd51('0x2d')]);}return _0x29f2fb['getSubjects'](_0x5abc2f);}})[_0xdd51('0x34')](function(_0x37760b){if(_0x37760b){return _0x37760b?{'count':_0x2d07a8,'rows':_0x37760b}:null;}})[_0xdd51('0x34')](respondWithResult(_0x1e7ae4,null))['catch'](handleError(_0x1e7ae4,null));};exports[_0xdd51('0x60')]=function(_0x3de230,_0x441227,_0x56f5c){var _0xa50d1e={};var _0x318bb3={};var _0x2b219b;var _0x466835;return db[_0xdd51('0x3a')][_0xdd51('0x5e')]({'where':{'id':_0x3de230['params']['id']}})[_0xdd51('0x34')](handleEntityNotFound(_0x441227,null))[_0xdd51('0x34')](function(_0x3f5d76){if(_0x3f5d76){_0x2b219b=_0x3f5d76;_0x318bb3[_0xdd51('0x45')]=_[_0xdd51('0x41')](db[_0xdd51('0x5c')]['rawAttributes']);_0x318bb3[_0xdd51('0x40')]=_[_0xdd51('0x41')](_0x3de230[_0xdd51('0x40')]);_0x318bb3[_0xdd51('0x42')]=_['intersection'](_0x318bb3['model'],_0x318bb3[_0xdd51('0x40')]);_0xa50d1e[_0xdd51('0x44')]=_['intersection'](_0x318bb3[_0xdd51('0x45')],qs[_0xdd51('0x46')](_0x3de230[_0xdd51('0x40')][_0xdd51('0x46')]));_0xa50d1e[_0xdd51('0x44')]=_0xa50d1e[_0xdd51('0x44')][_0xdd51('0x47')]?_0xa50d1e[_0xdd51('0x44')]:_0x318bb3['model'];_0xa50d1e[_0xdd51('0x4a')]=qs['sort'](_0x3de230[_0xdd51('0x40')][_0xdd51('0x4b')]);_0xa50d1e[_0xdd51('0x4c')]=qs[_0xdd51('0x42')](_[_0xdd51('0x5f')](_0x3de230[_0xdd51('0x40')],_0x318bb3[_0xdd51('0x42')]));if(_0x3de230[_0xdd51('0x40')][_0xdd51('0x4d')]){_0xa50d1e[_0xdd51('0x4c')]=_[_0xdd51('0x4e')](_0xa50d1e['where'],{'$or':_[_0xdd51('0x3f')](_0xa50d1e[_0xdd51('0x44')],function(_0x118397){var _0x56a322={};_0x56a322[_0x118397]={'$like':'%'+_0x3de230[_0xdd51('0x40')][_0xdd51('0x4d')]+'%'};return _0x56a322;})});}_0xa50d1e=_['merge']({},_0xa50d1e,_0x3de230[_0xdd51('0x50')]);return _0x2b219b['getDescriptions'](_0xa50d1e);}})[_0xdd51('0x34')](function(_0x32aa78){if(_0x32aa78){_0x466835=_0x32aa78['length'];if(!_0x3de230[_0xdd51('0x40')][_0xdd51('0x48')]('nolimit')){_0xa50d1e[_0xdd51('0x2e')]=qs['limit'](_0x3de230['query'][_0xdd51('0x2e')]);_0xa50d1e[_0xdd51('0x2d')]=qs[_0xdd51('0x2d')](_0x3de230['query'][_0xdd51('0x2d')]);}return _0x2b219b['getDescriptions'](_0xa50d1e);}})[_0xdd51('0x34')](function(_0x39f1ce){if(_0x39f1ce){return _0x39f1ce?{'count':_0x466835,'rows':_0x39f1ce}:null;}})[_0xdd51('0x34')](respondWithResult(_0x441227,null))[_0xdd51('0x29')](handleError(_0x441227,null));};exports[_0xdd51('0x61')]=function(_0x2f35b0,_0x33d265,_0x129a29){var _0x380d41={};var _0x2d1cf2={};var _0x2c5b6a;var _0x297ce4;return db['ZendeskConfiguration'][_0xdd51('0x5e')]({'where':{'id':_0x2f35b0[_0xdd51('0x56')]['id']}})[_0xdd51('0x34')](handleEntityNotFound(_0x33d265,null))[_0xdd51('0x34')](function(_0x51f41b){if(_0x51f41b){_0x2c5b6a=_0x51f41b;_0x2d1cf2[_0xdd51('0x45')]=_[_0xdd51('0x41')](db[_0xdd51('0x62')][_0xdd51('0x3b')]);_0x2d1cf2['query']=_[_0xdd51('0x41')](_0x2f35b0[_0xdd51('0x40')]);_0x2d1cf2['filters']=_[_0xdd51('0x43')](_0x2d1cf2['model'],_0x2d1cf2[_0xdd51('0x40')]);_0x380d41[_0xdd51('0x44')]=_[_0xdd51('0x43')](_0x2d1cf2['model'],qs['fields'](_0x2f35b0[_0xdd51('0x40')][_0xdd51('0x46')]));_0x380d41[_0xdd51('0x44')]=_0x380d41['attributes'][_0xdd51('0x47')]?_0x380d41['attributes']:_0x2d1cf2[_0xdd51('0x45')];_0x380d41[_0xdd51('0x4a')]=qs[_0xdd51('0x4b')](_0x2f35b0[_0xdd51('0x40')][_0xdd51('0x4b')]);_0x380d41[_0xdd51('0x4c')]=qs[_0xdd51('0x42')](_[_0xdd51('0x5f')](_0x2f35b0[_0xdd51('0x40')],_0x2d1cf2[_0xdd51('0x42')]));if(_0x2f35b0['query'][_0xdd51('0x4d')]){_0x380d41[_0xdd51('0x4c')]=_[_0xdd51('0x4e')](_0x380d41[_0xdd51('0x4c')],{'$or':_['map'](_0x380d41[_0xdd51('0x44')],function(_0x4d2462){var _0x1b2633={};_0x1b2633[_0x4d2462]={'$like':'%'+_0x2f35b0['query'][_0xdd51('0x4d')]+'%'};return _0x1b2633;})});}_0x380d41=_['merge']({},_0x380d41,_0x2f35b0[_0xdd51('0x50')]);return _0x2c5b6a[_0xdd51('0x61')](_0x380d41);}})['then'](function(_0x22005d){if(_0x22005d){_0x297ce4=_0x22005d[_0xdd51('0x47')];if(!_0x2f35b0[_0xdd51('0x40')][_0xdd51('0x48')](_0xdd51('0x49'))){_0x380d41['limit']=qs[_0xdd51('0x2e')](_0x2f35b0[_0xdd51('0x40')][_0xdd51('0x2e')]);_0x380d41[_0xdd51('0x2d')]=qs[_0xdd51('0x2d')](_0x2f35b0[_0xdd51('0x40')][_0xdd51('0x2d')]);}return _0x2c5b6a['getTags'](_0x380d41);}})[_0xdd51('0x34')](function(_0xadafc9){if(_0xadafc9){return _0xadafc9?{'count':_0x297ce4,'rows':_0xadafc9}:null;}})[_0xdd51('0x34')](respondWithResult(_0x33d265,null))['catch'](handleError(_0x33d265,null));};exports[_0xdd51('0x63')]=function(_0x18b957,_0x3c035a,_0x3cfd17){if(_0x18b957[_0xdd51('0x59')]['id']){delete _0x18b957[_0xdd51('0x59')]['id'];}return db[_0xdd51('0x3a')][_0xdd51('0x5e')]({'where':{'id':_0x18b957['params']['id']}})[_0xdd51('0x34')](handleEntityNotFound(_0x3c035a,null))[_0xdd51('0x34')](function(_0x209a1e){if(_0x209a1e){return _0x209a1e[_0xdd51('0x63')](_0x18b957[_0xdd51('0x59')][_0xdd51('0x64')]||[]);}return null;})[_0xdd51('0x34')](respondWithResult(_0x3c035a,null))['catch'](handleError(_0x3c035a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6fdd9ef..28762c1 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 _0x190c=['./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','api','moment','request-promise','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x190c,0x15a));var _0xc190=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0x190c[_0x4cc492];return _0x1f36b9;};'use strict';var _=require(_0xc190('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc190('0x1'));var moment=require(_0xc190('0x2'));var BPromise=require('bluebird');var rp=require(_0xc190('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc190('0x4'));var attributes=require(_0xc190('0x5'));module[_0xc190('0x6')]=function(_0x73d9fc,_0x1e7154){return _0x73d9fc[_0xc190('0x7')]('ZendeskConfiguration',attributes,{'tableName':_0xc190('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51e1=['rimraf','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','request-promise','path'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x51e1,0x145));var _0x151e=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x51e1[_0x502953];return _0x2fa32d;};'use strict';var _=require('lodash');var util=require(_0x151e('0x0'));var logger=require(_0x151e('0x1'))(_0x151e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x151e('0x3'));var fs=require('fs');var path=require(_0x151e('0x4'));var rimraf=require(_0x151e('0x5'));var config=require(_0x151e('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x151e('0x7')]=function(_0xc8ced5,_0x5087de){return _0xc8ced5[_0x151e('0x8')](_0x151e('0x9'),attributes,{'tableName':_0x151e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 4781d15..cb61b14 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 _0xece8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1b819f,_0x223aab){var _0x287f70=function(_0x47b76c){while(--_0x47b76c){_0x1b819f['push'](_0x1b819f['shift']());}};_0x287f70(++_0x223aab);}(_0xece8,0x16e));var _0x8ece=function(_0x35f84f,_0x16e6ab){_0x35f84f=_0x35f84f-0x0;var _0x51b6c7=_0xece8[_0x35f84f];return _0x51b6c7;};'use strict';var _=require(_0x8ece('0x0'));var util=require(_0x8ece('0x1'));var moment=require(_0x8ece('0x2'));var BPromise=require(_0x8ece('0x3'));var rs=require(_0x8ece('0x4'));var fs=require('fs');var Redis=require(_0x8ece('0x5'));var db=require(_0x8ece('0x6'))['db'];var utils=require(_0x8ece('0x7'));var logger=require(_0x8ece('0x8'))(_0x8ece('0x9'));var config=require(_0x8ece('0xa'));var jayson=require(_0x8ece('0xb'));var client=jayson[_0x8ece('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x95ed9e,_0x189d6d,_0x504d60){return new BPromise(function(_0x2ebf4f,_0x15d9eb){return client['request'](_0x95ed9e,_0x504d60)[_0x8ece('0xd')](function(_0x22d03f){logger[_0x8ece('0xe')](_0x8ece('0xf'),_0x189d6d,_0x8ece('0x10'));logger[_0x8ece('0x11')](_0x8ece('0x12'),_0x189d6d,_0x8ece('0x10'),JSON[_0x8ece('0x13')](_0x22d03f));if(_0x22d03f[_0x8ece('0x14')]){if(_0x22d03f[_0x8ece('0x14')]['code']===0x1f4){logger[_0x8ece('0x14')](_0x8ece('0xf'),_0x189d6d,_0x22d03f['error'][_0x8ece('0x15')]);return _0x15d9eb(_0x22d03f[_0x8ece('0x14')][_0x8ece('0x15')]);}logger[_0x8ece('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x189d6d,_0x22d03f[_0x8ece('0x14')]['message']);return _0x2ebf4f(_0x22d03f[_0x8ece('0x14')][_0x8ece('0x15')]);}else{logger[_0x8ece('0xe')](_0x8ece('0xf'),_0x189d6d,_0x8ece('0x10'));_0x2ebf4f(_0x22d03f['result'][_0x8ece('0x15')]);}})['catch'](function(_0x517003){logger[_0x8ece('0x14')](_0x8ece('0xf'),_0x189d6d,_0x517003);_0x15d9eb(_0x517003);});});} \ No newline at end of file +var _0xeaaf=['client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x19dcc8,_0x4bae0e){var _0x2810f4=function(_0x507cf4){while(--_0x507cf4){_0x19dcc8['push'](_0x19dcc8['shift']());}};_0x2810f4(++_0x4bae0e);}(_0xeaaf,0x9b));var _0xfeaa=function(_0x962c65,_0x2e050c){_0x962c65=_0x962c65-0x0;var _0x49aa29=_0xeaaf[_0x962c65];return _0x49aa29;};'use strict';var _=require(_0xfeaa('0x0'));var util=require(_0xfeaa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeaa('0x2'));var db=require(_0xfeaa('0x3'))['db'];var utils=require(_0xfeaa('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xfeaa('0x5'));var jayson=require(_0xfeaa('0x6'));var client=jayson[_0xfeaa('0x7')][_0xfeaa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3db3c3,_0x413c26,_0x59f008){return new BPromise(function(_0x56f8aa,_0x1198a4){return client[_0xfeaa('0x9')](_0x3db3c3,_0x59f008)[_0xfeaa('0xa')](function(_0x53278c){logger[_0xfeaa('0xb')](_0xfeaa('0xc'),_0x413c26,_0xfeaa('0xd'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x413c26,_0xfeaa('0xd'),JSON[_0xfeaa('0xe')](_0x53278c));if(_0x53278c['error']){if(_0x53278c['error'][_0xfeaa('0xf')]===0x1f4){logger['error'](_0xfeaa('0xc'),_0x413c26,_0x53278c[_0xfeaa('0x10')]['message']);return _0x1198a4(_0x53278c['error'][_0xfeaa('0x11')]);}logger[_0xfeaa('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x413c26,_0x53278c[_0xfeaa('0x10')][_0xfeaa('0x11')]);return _0x56f8aa(_0x53278c['error']['message']);}else{logger[_0xfeaa('0xb')](_0xfeaa('0xc'),_0x413c26,_0xfeaa('0xd'));_0x56f8aa(_0x53278c['result'][_0xfeaa('0x11')]);}})['catch'](function(_0x3914ff){logger[_0xfeaa('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x413c26,_0x3914ff);_0x1198a4(_0x3914ff);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 30413c6..97cc6c3 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 _0x547b=['express','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','isAuthenticated','create','put','/:id','update','destroy','multer','util','path','connect-timeout'];(function(_0x5a37c4,_0x2558b8){var _0xfafa3e=function(_0x1c11d6){while(--_0x1c11d6){_0x5a37c4['push'](_0x5a37c4['shift']());}};_0xfafa3e(++_0x2558b8);}(_0x547b,0x150));var _0xb547=function(_0xefb732,_0x18643f){_0xefb732=_0xefb732-0x0;var _0x444a08=_0x547b[_0xefb732];return _0x444a08;};'use strict';var multer=require(_0xb547('0x0'));var util=require(_0xb547('0x1'));var path=require(_0xb547('0x2'));var timeout=require(_0xb547('0x3'));var express=require(_0xb547('0x4'));var router=express[_0xb547('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb547('0x6'));var config=require(_0xb547('0x7'));var controller=require(_0xb547('0x8'));router[_0xb547('0x9')]('/',auth['isAuthenticated'](),controller[_0xb547('0xa')]);router[_0xb547('0x9')]('/:id',auth[_0xb547('0xb')](),controller['show']);router['post']('/',auth[_0xb547('0xb')](),controller[_0xb547('0xc')]);router[_0xb547('0xd')](_0xb547('0xe'),auth['isAuthenticated'](),controller[_0xb547('0xf')]);router['delete']('/:id',auth[_0xb547('0xb')](),controller[_0xb547('0x10')]);module['exports']=router; \ No newline at end of file +var _0x684d=['update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','create','put'];(function(_0x2e482e,_0x5c251a){var _0x12d7b9=function(_0x35f9c3){while(--_0x35f9c3){_0x2e482e['push'](_0x2e482e['shift']());}};_0x12d7b9(++_0x5c251a);}(_0x684d,0xcf));var _0xd684=function(_0x19fb82,_0x4d1b74){_0x19fb82=_0x19fb82-0x0;var _0x2899e3=_0x684d[_0x19fb82];return _0x2899e3;};'use strict';var multer=require(_0xd684('0x0'));var util=require(_0xd684('0x1'));var path=require('path');var timeout=require(_0xd684('0x2'));var express=require(_0xd684('0x3'));var router=express['Router']();var auth=require(_0xd684('0x4'));var interaction=require(_0xd684('0x5'));var config=require(_0xd684('0x6'));var controller=require(_0xd684('0x7'));router[_0xd684('0x8')]('/',auth[_0xd684('0x9')](),controller[_0xd684('0xa')]);router[_0xd684('0x8')](_0xd684('0xb'),auth[_0xd684('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd684('0xc')]);router[_0xd684('0xd')](_0xd684('0xb'),auth[_0xd684('0x9')](),controller[_0xd684('0xe')]);router[_0xd684('0xf')](_0xd684('0xb'),auth[_0xd684('0x9')](),controller[_0xd684('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index e73c55d..44003ee 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 _0x98a7=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2c11fc,_0x4a1c4b){var _0x3fac9b=function(_0x4bdb71){while(--_0x4bdb71){_0x2c11fc['push'](_0x2c11fc['shift']());}};_0x3fac9b(++_0x4a1c4b);}(_0x98a7,0x9e));var _0x798a=function(_0x5039fc,_0x4cb901){_0x5039fc=_0x5039fc-0x0;var _0x13a44e=_0x98a7[_0x5039fc];return _0x13a44e;};'use strict';var Sequelize=require(_0x798a('0x0'));module[_0x798a('0x1')]={'type':{'type':Sequelize[_0x798a('0x2')](_0x798a('0x3'),_0x798a('0x4'),_0x798a('0x5'),_0x798a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x798a('0x7')]},'key':{'type':Sequelize[_0x798a('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x798a('0x4'),_0x798a('0x5'))},'keyContent':{'type':Sequelize[_0x798a('0x7')]},'idField':{'type':Sequelize[_0x798a('0x7')]},'nameField':{'type':Sequelize[_0x798a('0x7')]},'customField':{'type':Sequelize[_0x798a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x798a('0x7')]}}; \ No newline at end of file +var _0x35d0=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x35d0,0xf9));var _0x035d=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x35d0[_0x1d6a82];return _0x5834ac;};'use strict';var Sequelize=require(_0x035d('0x0'));module[_0x035d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x035d('0x2'),_0x035d('0x3'),_0x035d('0x4'),_0x035d('0x5')),'defaultValue':_0x035d('0x2')},'content':{'type':Sequelize[_0x035d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x035d('0x7')](_0x035d('0x2'),_0x035d('0x3'),_0x035d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x035d('0x6')]},'nameField':{'type':Sequelize[_0x035d('0x6')]},'customField':{'type':Sequelize[_0x035d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x035d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 57bb290..e859ff5 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 _0x0f8a=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','find','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','name','map','ZendeskField','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge'];(function(_0x6698b9,_0x488a36){var _0x5a1971=function(_0x126a45){while(--_0x126a45){_0x6698b9['push'](_0x6698b9['shift']());}};_0x5a1971(++_0x488a36);}(_0x0f8a,0x1b7));var _0xa0f8=function(_0x57c86e,_0x15c6ff){_0x57c86e=_0x57c86e-0x0;var _0x14c67c=_0x0f8a[_0x57c86e];return _0x14c67c;};'use strict';var pdf=require(_0xa0f8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa0f8('0x1'));var jsonpatch=require(_0xa0f8('0x2'));var rp=require(_0xa0f8('0x3'));var moment=require(_0xa0f8('0x4'));var BPromise=require(_0xa0f8('0x5'));var Mustache=require(_0xa0f8('0x6'));var util=require(_0xa0f8('0x7'));var path=require('path');var sox=require(_0xa0f8('0x8'));var csv=require(_0xa0f8('0x9'));var ejs=require(_0xa0f8('0xa'));var fs=require('fs');var _=require(_0xa0f8('0xb'));var squel=require(_0xa0f8('0xc'));var crypto=require(_0xa0f8('0xd'));var jsforce=require(_0xa0f8('0xe'));var deskjs=require(_0xa0f8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa0f8('0x10'));var Papa=require('papaparse');var Redis=require(_0xa0f8('0x11'));var authService=require(_0xa0f8('0x12'));var qs=require(_0xa0f8('0x13'));var as=require(_0xa0f8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0f8('0x15'))(_0xa0f8('0x16'));var utils=require(_0xa0f8('0x17'));var config=require('../../config/environment');var db=require(_0xa0f8('0x18'))['db'];function respondWithStatusCode(_0x25b8ff,_0xfe6204){_0xfe6204=_0xfe6204||0xcc;return function(_0x5a089e){if(_0x5a089e){return _0x25b8ff[_0xa0f8('0x19')](_0xfe6204);}return _0x25b8ff[_0xa0f8('0x1a')](_0xfe6204)[_0xa0f8('0x1b')]();};}function respondWithResult(_0x59add0,_0x19e813){_0x19e813=_0x19e813||0xc8;return function(_0x16773a){if(_0x16773a){return _0x59add0[_0xa0f8('0x1a')](_0x19e813)[_0xa0f8('0x1c')](_0x16773a);}};}function respondWithFilteredResult(_0x41f2ff,_0x1aeec9){return function(_0x3a8ae2){if(_0x3a8ae2){var _0x1f4ba1=_0x3a8ae2[_0xa0f8('0x1d')],_0x195ccb=_0x1aeec9[_0xa0f8('0x1e')],_0x4e12b9=_0x1aeec9[_0xa0f8('0x1e')]+_0x1aeec9[_0xa0f8('0x1f')],_0x2b0474;if(_0x4e12b9>=_0x1f4ba1){_0x4e12b9=_0x1f4ba1;_0x2b0474=0xc8;}else{_0x2b0474=0xce;}_0x41f2ff[_0xa0f8('0x1a')](_0x2b0474);return _0x41f2ff['set'](_0xa0f8('0x20'),_0x195ccb+'-'+_0x4e12b9+'/'+_0x1f4ba1)['json'](_0x3a8ae2);}return null;};}function patchUpdates(_0x301da6){return function(_0x31af8d){try{jsonpatch[_0xa0f8('0x21')](_0x31af8d,_0x301da6,!![]);}catch(_0x5e36b8){return BPromise[_0xa0f8('0x22')](_0x5e36b8);}return _0x31af8d[_0xa0f8('0x23')]();};}function saveUpdates(_0x9bc4b2,_0x4041ef){return function(_0x4dbd69){if(_0x4dbd69){return _0x4dbd69['update'](_0x9bc4b2)[_0xa0f8('0x24')](function(_0x5df183){return _0x5df183;});}return null;};}function removeEntity(_0x3f4772,_0x5f42c4){return function(_0x3ac7d2){if(_0x3ac7d2){return _0x3ac7d2['destroy']()['then'](function(){_0x3f4772[_0xa0f8('0x1a')](0xcc)[_0xa0f8('0x1b')]();});}};}function handleEntityNotFound(_0x21b9ea,_0x4521c9){return function(_0x2e2a56){if(!_0x2e2a56){_0x21b9ea[_0xa0f8('0x19')](0x194);}return _0x2e2a56;};}function handleError(_0x5e3d1f,_0x1cab1d){_0x1cab1d=_0x1cab1d||0x1f4;return function(_0x3adf9e){logger[_0xa0f8('0x25')](_0x3adf9e['stack']);if(_0x3adf9e[_0xa0f8('0x26')]){delete _0x3adf9e[_0xa0f8('0x26')];}_0x5e3d1f[_0xa0f8('0x1a')](_0x1cab1d)['send'](_0x3adf9e);};}exports['index']=function(_0x21ecf6,_0x1feb5d){var _0x1b1109={},_0x51f8c3={},_0x3fdbb3={'count':0x0,'rows':[]};var _0x1e1a87=_[_0xa0f8('0x27')](db[_0xa0f8('0x28')]['rawAttributes'],function(_0x1327a8){return{'name':_0x1327a8[_0xa0f8('0x29')],'type':_0x1327a8[_0xa0f8('0x2a')]['key']};});_0x51f8c3[_0xa0f8('0x2b')]=_[_0xa0f8('0x27')](_0x1e1a87,_0xa0f8('0x26'));_0x51f8c3[_0xa0f8('0x2c')]=_[_0xa0f8('0x2d')](_0x21ecf6[_0xa0f8('0x2c')]);_0x51f8c3['filters']=_[_0xa0f8('0x2e')](_0x51f8c3[_0xa0f8('0x2b')],_0x51f8c3['query']);_0x1b1109[_0xa0f8('0x2f')]=_[_0xa0f8('0x2e')](_0x51f8c3['model'],qs[_0xa0f8('0x30')](_0x21ecf6['query'][_0xa0f8('0x30')]));_0x1b1109[_0xa0f8('0x2f')]=_0x1b1109['attributes'][_0xa0f8('0x31')]?_0x1b1109[_0xa0f8('0x2f')]:_0x51f8c3[_0xa0f8('0x2b')];if(!_0x21ecf6[_0xa0f8('0x2c')][_0xa0f8('0x32')](_0xa0f8('0x33'))){_0x1b1109[_0xa0f8('0x1f')]=qs[_0xa0f8('0x1f')](_0x21ecf6['query']['limit']);_0x1b1109[_0xa0f8('0x1e')]=qs[_0xa0f8('0x1e')](_0x21ecf6[_0xa0f8('0x2c')][_0xa0f8('0x1e')]);}_0x1b1109[_0xa0f8('0x34')]=qs[_0xa0f8('0x35')](_0x21ecf6['query'][_0xa0f8('0x35')]);_0x1b1109[_0xa0f8('0x36')]=qs[_0xa0f8('0x37')](_[_0xa0f8('0x38')](_0x21ecf6[_0xa0f8('0x2c')],_0x51f8c3[_0xa0f8('0x37')]),_0x1e1a87);if(_0x21ecf6[_0xa0f8('0x2c')]['filter']){_0x1b1109['where']=_[_0xa0f8('0x39')](_0x1b1109['where'],{'$or':_['map'](_0x1e1a87,function(_0x282e32){if(_0x282e32[_0xa0f8('0x2a')]!==_0xa0f8('0x3a')){var _0x5bfc3c={};_0x5bfc3c[_0x282e32[_0xa0f8('0x26')]]={'$like':'%'+_0x21ecf6[_0xa0f8('0x2c')]['filter']+'%'};return _0x5bfc3c;}})});}_0x1b1109=_[_0xa0f8('0x39')]({},_0x1b1109,_0x21ecf6[_0xa0f8('0x3b')]);var _0x124adc={'where':_0x1b1109[_0xa0f8('0x36')]};return db['ZendeskField'][_0xa0f8('0x1d')](_0x124adc)[_0xa0f8('0x24')](function(_0x26039e){_0x3fdbb3[_0xa0f8('0x1d')]=_0x26039e;if(_0x21ecf6[_0xa0f8('0x2c')][_0xa0f8('0x3c')]){_0x1b1109[_0xa0f8('0x3d')]=[{'all':!![]}];}return db[_0xa0f8('0x28')][_0xa0f8('0x3e')](_0x1b1109);})['then'](function(_0x2a892e){_0x3fdbb3[_0xa0f8('0x3f')]=_0x2a892e;return _0x3fdbb3;})[_0xa0f8('0x24')](respondWithFilteredResult(_0x1feb5d,_0x1b1109))[_0xa0f8('0x40')](handleError(_0x1feb5d,null));};exports[_0xa0f8('0x41')]=function(_0x2993e0,_0xeae137){var _0x5ec2fc={'raw':!![],'where':{'id':_0x2993e0[_0xa0f8('0x42')]['id']}},_0x2436e7={};_0x2436e7['model']=_[_0xa0f8('0x2d')](db['ZendeskField']['rawAttributes']);_0x2436e7[_0xa0f8('0x2c')]=_[_0xa0f8('0x2d')](_0x2993e0[_0xa0f8('0x2c')]);_0x2436e7['filters']=_['intersection'](_0x2436e7[_0xa0f8('0x2b')],_0x2436e7[_0xa0f8('0x2c')]);_0x5ec2fc[_0xa0f8('0x2f')]=_[_0xa0f8('0x2e')](_0x2436e7[_0xa0f8('0x2b')],qs[_0xa0f8('0x30')](_0x2993e0[_0xa0f8('0x2c')][_0xa0f8('0x30')]));_0x5ec2fc['attributes']=_0x5ec2fc[_0xa0f8('0x2f')][_0xa0f8('0x31')]?_0x5ec2fc['attributes']:_0x2436e7[_0xa0f8('0x2b')];if(_0x2993e0[_0xa0f8('0x2c')]['includeAll']){_0x5ec2fc['include']=[{'all':!![]}];}_0x5ec2fc=_[_0xa0f8('0x39')]({},_0x5ec2fc,_0x2993e0[_0xa0f8('0x3b')]);return db[_0xa0f8('0x28')]['find'](_0x5ec2fc)[_0xa0f8('0x24')](handleEntityNotFound(_0xeae137,null))[_0xa0f8('0x24')](respondWithResult(_0xeae137,null))[_0xa0f8('0x40')](handleError(_0xeae137,null));};exports[_0xa0f8('0x43')]=function(_0x119d7b,_0xe7757f){return db[_0xa0f8('0x28')][_0xa0f8('0x43')](_0x119d7b['body'],{})[_0xa0f8('0x24')](respondWithResult(_0xe7757f,0xc9))[_0xa0f8('0x40')](handleError(_0xe7757f,null));};exports['update']=function(_0x5cb642,_0x1c3cae){if(_0x5cb642[_0xa0f8('0x44')]['id']){delete _0x5cb642[_0xa0f8('0x44')]['id'];}return db[_0xa0f8('0x28')]['find']({'where':{'id':_0x5cb642['params']['id']}})[_0xa0f8('0x24')](handleEntityNotFound(_0x1c3cae,null))[_0xa0f8('0x24')](saveUpdates(_0x5cb642[_0xa0f8('0x44')],null))['then'](respondWithResult(_0x1c3cae,null))[_0xa0f8('0x40')](handleError(_0x1c3cae,null));};exports[_0xa0f8('0x45')]=function(_0x34b189,_0x14e9bd){return db[_0xa0f8('0x28')][_0xa0f8('0x46')]({'where':{'id':_0x34b189['params']['id']}})[_0xa0f8('0x24')](handleEntityNotFound(_0x14e9bd,null))['then'](removeEntity(_0x14e9bd,null))['catch'](handleError(_0x14e9bd,null));}; \ No newline at end of file +var _0xc22d=['offset','limit','set','apply','save','update','then','destroy','name','index','map','ZendeskField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0xc22d,0x172));var _0xdc22=function(_0x46172f,_0xe64cc0){_0x46172f=_0x46172f-0x0;var _0x26566b=_0xc22d[_0x46172f];return _0x26566b;};'use strict';var pdf=require(_0xdc22('0x0'));var emlformat=require(_0xdc22('0x1'));var rimraf=require(_0xdc22('0x2'));var zipdir=require(_0xdc22('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc22('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdc22('0x5'));var util=require(_0xdc22('0x6'));var path=require(_0xdc22('0x7'));var sox=require(_0xdc22('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdc22('0x9'));var crypto=require(_0xdc22('0xa'));var jsforce=require(_0xdc22('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdc22('0xc'));var querystring=require('querystring');var Papa=require(_0xdc22('0xd'));var Redis=require(_0xdc22('0xe'));var authService=require(_0xdc22('0xf'));var qs=require(_0xdc22('0x10'));var as=require(_0xdc22('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdc22('0x12'));var utils=require('../../config/utils');var config=require(_0xdc22('0x13'));var db=require(_0xdc22('0x14'))['db'];function respondWithStatusCode(_0x294478,_0x11f556){_0x11f556=_0x11f556||0xcc;return function(_0x320adf){if(_0x320adf){return _0x294478[_0xdc22('0x15')](_0x11f556);}return _0x294478[_0xdc22('0x16')](_0x11f556)[_0xdc22('0x17')]();};}function respondWithResult(_0x2a9f1d,_0x103f2e){_0x103f2e=_0x103f2e||0xc8;return function(_0x39d51e){if(_0x39d51e){return _0x2a9f1d[_0xdc22('0x16')](_0x103f2e)[_0xdc22('0x18')](_0x39d51e);}};}function respondWithFilteredResult(_0x26b1d9,_0x4c6b86){return function(_0x319e02){if(_0x319e02){var _0x3098ea=_0x319e02[_0xdc22('0x19')],_0x3ee84f=_0x4c6b86[_0xdc22('0x1a')],_0x23588c=_0x4c6b86[_0xdc22('0x1a')]+_0x4c6b86[_0xdc22('0x1b')],_0x1901d2;if(_0x23588c>=_0x3098ea){_0x23588c=_0x3098ea;_0x1901d2=0xc8;}else{_0x1901d2=0xce;}_0x26b1d9['status'](_0x1901d2);return _0x26b1d9[_0xdc22('0x1c')]('Content-Range',_0x3ee84f+'-'+_0x23588c+'/'+_0x3098ea)[_0xdc22('0x18')](_0x319e02);}return null;};}function patchUpdates(_0x4f7a22){return function(_0x57dd9d){try{jsonpatch[_0xdc22('0x1d')](_0x57dd9d,_0x4f7a22,!![]);}catch(_0x1b3981){return BPromise['reject'](_0x1b3981);}return _0x57dd9d[_0xdc22('0x1e')]();};}function saveUpdates(_0x27ea1c,_0x2ad449){return function(_0x1cf4eb){if(_0x1cf4eb){return _0x1cf4eb[_0xdc22('0x1f')](_0x27ea1c)[_0xdc22('0x20')](function(_0x20204b){return _0x20204b;});}return null;};}function removeEntity(_0x110977,_0x3740cb){return function(_0x1ff450){if(_0x1ff450){return _0x1ff450[_0xdc22('0x21')]()['then'](function(){_0x110977[_0xdc22('0x16')](0xcc)[_0xdc22('0x17')]();});}};}function handleEntityNotFound(_0x5f485e,_0x23f45d){return function(_0x46c9b2){if(!_0x46c9b2){_0x5f485e['sendStatus'](0x194);}return _0x46c9b2;};}function handleError(_0x49dd40,_0x5e7665){_0x5e7665=_0x5e7665||0x1f4;return function(_0x325e48){logger['error'](_0x325e48['stack']);if(_0x325e48[_0xdc22('0x22')]){delete _0x325e48[_0xdc22('0x22')];}_0x49dd40['status'](_0x5e7665)['send'](_0x325e48);};}exports[_0xdc22('0x23')]=function(_0x163868,_0x3e0e1a){var _0x1efe94={},_0x1c91a8={},_0x50e151={'count':0x0,'rows':[]};var _0x265508=_[_0xdc22('0x24')](db[_0xdc22('0x25')][_0xdc22('0x26')],function(_0x1a0809){return{'name':_0x1a0809[_0xdc22('0x27')],'type':_0x1a0809[_0xdc22('0x28')]['key']};});_0x1c91a8[_0xdc22('0x29')]=_[_0xdc22('0x24')](_0x265508,_0xdc22('0x22'));_0x1c91a8[_0xdc22('0x2a')]=_[_0xdc22('0x2b')](_0x163868[_0xdc22('0x2a')]);_0x1c91a8['filters']=_[_0xdc22('0x2c')](_0x1c91a8['model'],_0x1c91a8['query']);_0x1efe94[_0xdc22('0x2d')]=_['intersection'](_0x1c91a8['model'],qs['fields'](_0x163868[_0xdc22('0x2a')][_0xdc22('0x2e')]));_0x1efe94[_0xdc22('0x2d')]=_0x1efe94['attributes'][_0xdc22('0x2f')]?_0x1efe94[_0xdc22('0x2d')]:_0x1c91a8[_0xdc22('0x29')];if(!_0x163868[_0xdc22('0x2a')][_0xdc22('0x30')]('nolimit')){_0x1efe94[_0xdc22('0x1b')]=qs[_0xdc22('0x1b')](_0x163868[_0xdc22('0x2a')][_0xdc22('0x1b')]);_0x1efe94[_0xdc22('0x1a')]=qs[_0xdc22('0x1a')](_0x163868['query'][_0xdc22('0x1a')]);}_0x1efe94['order']=qs[_0xdc22('0x31')](_0x163868[_0xdc22('0x2a')][_0xdc22('0x31')]);_0x1efe94['where']=qs[_0xdc22('0x32')](_['pick'](_0x163868['query'],_0x1c91a8[_0xdc22('0x32')]),_0x265508);if(_0x163868[_0xdc22('0x2a')][_0xdc22('0x33')]){_0x1efe94[_0xdc22('0x34')]=_[_0xdc22('0x35')](_0x1efe94[_0xdc22('0x34')],{'$or':_[_0xdc22('0x24')](_0x265508,function(_0x33b51d){if(_0x33b51d[_0xdc22('0x28')]!==_0xdc22('0x36')){var _0x42318d={};_0x42318d[_0x33b51d[_0xdc22('0x22')]]={'$like':'%'+_0x163868[_0xdc22('0x2a')][_0xdc22('0x33')]+'%'};return _0x42318d;}})});}_0x1efe94=_['merge']({},_0x1efe94,_0x163868[_0xdc22('0x37')]);var _0x3dea61={'where':_0x1efe94['where']};return db[_0xdc22('0x25')][_0xdc22('0x19')](_0x3dea61)['then'](function(_0x99de15){_0x50e151[_0xdc22('0x19')]=_0x99de15;if(_0x163868[_0xdc22('0x2a')][_0xdc22('0x38')]){_0x1efe94[_0xdc22('0x39')]=[{'all':!![]}];}return db[_0xdc22('0x25')][_0xdc22('0x3a')](_0x1efe94);})['then'](function(_0x2e758e){_0x50e151[_0xdc22('0x3b')]=_0x2e758e;return _0x50e151;})[_0xdc22('0x20')](respondWithFilteredResult(_0x3e0e1a,_0x1efe94))[_0xdc22('0x3c')](handleError(_0x3e0e1a,null));};exports[_0xdc22('0x3d')]=function(_0x58a5a6,_0x51d544){var _0x5e1910={'raw':!![],'where':{'id':_0x58a5a6[_0xdc22('0x3e')]['id']}},_0x388ebd={};_0x388ebd[_0xdc22('0x29')]=_[_0xdc22('0x2b')](db['ZendeskField']['rawAttributes']);_0x388ebd[_0xdc22('0x2a')]=_[_0xdc22('0x2b')](_0x58a5a6[_0xdc22('0x2a')]);_0x388ebd[_0xdc22('0x32')]=_[_0xdc22('0x2c')](_0x388ebd[_0xdc22('0x29')],_0x388ebd['query']);_0x5e1910[_0xdc22('0x2d')]=_[_0xdc22('0x2c')](_0x388ebd[_0xdc22('0x29')],qs[_0xdc22('0x2e')](_0x58a5a6['query'][_0xdc22('0x2e')]));_0x5e1910['attributes']=_0x5e1910['attributes'][_0xdc22('0x2f')]?_0x5e1910[_0xdc22('0x2d')]:_0x388ebd['model'];if(_0x58a5a6['query']['includeAll']){_0x5e1910[_0xdc22('0x39')]=[{'all':!![]}];}_0x5e1910=_[_0xdc22('0x35')]({},_0x5e1910,_0x58a5a6[_0xdc22('0x37')]);return db[_0xdc22('0x25')][_0xdc22('0x3f')](_0x5e1910)[_0xdc22('0x20')](handleEntityNotFound(_0x51d544,null))[_0xdc22('0x20')](respondWithResult(_0x51d544,null))['catch'](handleError(_0x51d544,null));};exports[_0xdc22('0x40')]=function(_0x46e46e,_0x1321a7){return db[_0xdc22('0x25')][_0xdc22('0x40')](_0x46e46e[_0xdc22('0x41')],{})[_0xdc22('0x20')](respondWithResult(_0x1321a7,0xc9))[_0xdc22('0x3c')](handleError(_0x1321a7,null));};exports[_0xdc22('0x1f')]=function(_0x482cb8,_0x3e3f06){if(_0x482cb8[_0xdc22('0x41')]['id']){delete _0x482cb8[_0xdc22('0x41')]['id'];}return db['ZendeskField'][_0xdc22('0x3f')]({'where':{'id':_0x482cb8[_0xdc22('0x3e')]['id']}})[_0xdc22('0x20')](handleEntityNotFound(_0x3e3f06,null))[_0xdc22('0x20')](saveUpdates(_0x482cb8[_0xdc22('0x41')],null))[_0xdc22('0x20')](respondWithResult(_0x3e3f06,null))[_0xdc22('0x3c')](handleError(_0x3e3f06,null));};exports[_0xdc22('0x21')]=function(_0x46b5a5,_0x51c189){return db[_0xdc22('0x25')][_0xdc22('0x3f')]({'where':{'id':_0x46b5a5[_0xdc22('0x3e')]['id']}})['then'](handleEntityNotFound(_0x51c189,null))[_0xdc22('0x20')](removeEntity(_0x51c189,null))[_0xdc22('0x3c')](handleError(_0x51c189,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 3694e2f..76bb9d8 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 _0xbdb7=['define','zendesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0xbdb7[_0x3fc97b];return _0x3a0c82;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x7bdb('0xb'),'fields':[_0x7bdb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f73=['ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x0f73,0x146));var _0x30f7=function(_0x11bc72,_0x3cc4cd){_0x11bc72=_0x11bc72-0x0;var _0x159b12=_0x0f73[_0x11bc72];return _0x159b12;};'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('./intZendeskField.attributes');module[_0x30f7('0x8')]=function(_0x593fe7,_0x49b5b8){return _0x593fe7[_0x30f7('0x9')](_0x30f7('0xa'),attributes,{'tableName':_0x30f7('0xb'),'paranoid':![],'indexes':[{'name':_0x30f7('0xc'),'fields':['idField',_0x30f7('0xd')],'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 822caf7..3e3a725 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 _0x6786=['catch','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0xf10eb9,_0x2e0701){var _0x5bc828=function(_0x45eecf){while(--_0x45eecf){_0xf10eb9['push'](_0xf10eb9['shift']());}};_0x5bc828(++_0x2e0701);}(_0x6786,0xa1));var _0x6678=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x6786[_0x2f6233];return _0x1c9c36;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6678('0x0'));var BPromise=require(_0x6678('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6678('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6678('0x3'))(_0x6678('0x4'));var config=require(_0x6678('0x5'));var jayson=require(_0x6678('0x6'));var client=jayson[_0x6678('0x7')][_0x6678('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33bc36,_0x11464d,_0x276db3){return new BPromise(function(_0x732f2c,_0x2f0b5d){return client[_0x6678('0x9')](_0x33bc36,_0x276db3)[_0x6678('0xa')](function(_0x3b298b){logger[_0x6678('0xb')](_0x6678('0xc'),_0x11464d,'request\x20sent');logger[_0x6678('0xd')](_0x6678('0xe'),_0x11464d,_0x6678('0xf'),JSON['stringify'](_0x3b298b));if(_0x3b298b[_0x6678('0x10')]){if(_0x3b298b[_0x6678('0x10')][_0x6678('0x11')]===0x1f4){logger[_0x6678('0x10')](_0x6678('0xc'),_0x11464d,_0x3b298b[_0x6678('0x10')][_0x6678('0x12')]);return _0x2f0b5d(_0x3b298b[_0x6678('0x10')]['message']);}logger[_0x6678('0x10')]('ZendeskField,\x20%s,\x20%s',_0x11464d,_0x3b298b[_0x6678('0x10')]['message']);return _0x732f2c(_0x3b298b[_0x6678('0x10')][_0x6678('0x12')]);}else{logger[_0x6678('0xb')](_0x6678('0xc'),_0x11464d,_0x6678('0xf'));_0x732f2c(_0x3b298b['result']['message']);}})[_0x6678('0x13')](function(_0x248d9c){logger['error'](_0x6678('0xc'),_0x11464d,_0x248d9c);_0x2f0b5d(_0x248d9c);});});} \ No newline at end of file +var _0xeec9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','util','randomstring','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeec9,0x1a0));var _0x9eec=function(_0x3a03fd,_0x4ebdc5){_0x3a03fd=_0x3a03fd-0x0;var _0x4e3e29=_0xeec9[_0x3a03fd];return _0x4e3e29;};'use strict';var _=require(_0x9eec('0x0'));var util=require(_0x9eec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9eec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9eec('0x3'))['db'];var utils=require(_0x9eec('0x4'));var logger=require(_0x9eec('0x5'))('rpc');var config=require(_0x9eec('0x6'));var jayson=require(_0x9eec('0x7'));var client=jayson[_0x9eec('0x8')][_0x9eec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5519b0,_0x3e6de5,_0x564de6){return new BPromise(function(_0x468ed4,_0x25914a){return client[_0x9eec('0xa')](_0x5519b0,_0x564de6)[_0x9eec('0xb')](function(_0x18a9cd){logger[_0x9eec('0xc')](_0x9eec('0xd'),_0x3e6de5,_0x9eec('0xe'));logger[_0x9eec('0xf')](_0x9eec('0x10'),_0x3e6de5,_0x9eec('0xe'),JSON['stringify'](_0x18a9cd));if(_0x18a9cd['error']){if(_0x18a9cd['error'][_0x9eec('0x11')]===0x1f4){logger[_0x9eec('0x12')](_0x9eec('0xd'),_0x3e6de5,_0x18a9cd[_0x9eec('0x12')][_0x9eec('0x13')]);return _0x25914a(_0x18a9cd[_0x9eec('0x12')]['message']);}logger[_0x9eec('0x12')](_0x9eec('0xd'),_0x3e6de5,_0x18a9cd['error']['message']);return _0x468ed4(_0x18a9cd[_0x9eec('0x12')][_0x9eec('0x13')]);}else{logger[_0x9eec('0xc')](_0x9eec('0xd'),_0x3e6de5,'request\x20sent');_0x468ed4(_0x18a9cd['result'][_0x9eec('0x13')]);}})[_0x9eec('0x14')](function(_0x5f300d){logger[_0x9eec('0x12')](_0x9eec('0xd'),_0x3e6de5,_0x5f300d);_0x25914a(_0x5f300d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 400c084..51f433a 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 _0xc49c=['/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index'];(function(_0x5ad391,_0x34a023){var _0x5a5f4d=function(_0x13422c){while(--_0x13422c){_0x5ad391['push'](_0x5ad391['shift']());}};_0x5a5f4d(++_0x34a023);}(_0xc49c,0x73));var _0xcc49=function(_0x14eb45,_0x335f50){_0x14eb45=_0x14eb45-0x0;var _0x2c45f2=_0xc49c[_0x14eb45];return _0x2c45f2;};'use strict';var multer=require(_0xcc49('0x0'));var util=require(_0xcc49('0x1'));var path=require(_0xcc49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcc49('0x3')]();var auth=require(_0xcc49('0x4'));var interaction=require(_0xcc49('0x5'));var config=require(_0xcc49('0x6'));var controller=require(_0xcc49('0x7'));router[_0xcc49('0x8')]('/',auth[_0xcc49('0x9')](),controller[_0xcc49('0xa')]);router[_0xcc49('0x8')](_0xcc49('0xb'),auth['isAuthenticated'](),controller[_0xcc49('0xc')]);router[_0xcc49('0x8')]('/:id/configurations',auth[_0xcc49('0x9')](),controller[_0xcc49('0xd')]);router[_0xcc49('0x8')](_0xcc49('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xcc49('0xf')]('/',auth[_0xcc49('0x9')](),controller['create']);router[_0xcc49('0xf')](_0xcc49('0x10'),auth[_0xcc49('0x9')](),controller['addConfiguration']);router[_0xcc49('0x11')](_0xcc49('0xb'),auth['isAuthenticated'](),controller[_0xcc49('0x12')]);router[_0xcc49('0x13')](_0xcc49('0xb'),auth['isAuthenticated'](),controller[_0xcc49('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe37a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','post','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x495cc,_0x2f2535){var _0x4d2cf6=function(_0x222f74){while(--_0x222f74){_0x495cc['push'](_0x495cc['shift']());}};_0x4d2cf6(++_0x2f2535);}(_0xe37a,0x153));var _0xae37=function(_0x232dd0,_0x6b3547){_0x232dd0=_0x232dd0-0x0;var _0x5ea81a=_0xe37a[_0x232dd0];return _0x5ea81a;};'use strict';var multer=require(_0xae37('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xae37('0x1'));var express=require('express');var router=express[_0xae37('0x2')]();var auth=require(_0xae37('0x3'));var interaction=require(_0xae37('0x4'));var config=require(_0xae37('0x5'));var controller=require(_0xae37('0x6'));router[_0xae37('0x7')]('/',auth['isAuthenticated'](),controller[_0xae37('0x8')]);router[_0xae37('0x7')](_0xae37('0x9'),auth[_0xae37('0xa')](),controller[_0xae37('0xb')]);router['get']('/:id/configurations',auth[_0xae37('0xa')](),controller[_0xae37('0xc')]);router[_0xae37('0x7')](_0xae37('0xd'),auth[_0xae37('0xa')](),controller['getFields']);router[_0xae37('0xe')]('/',auth[_0xae37('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0xae37('0xa')](),controller[_0xae37('0xf')]);router[_0xae37('0x10')](_0xae37('0x9'),auth[_0xae37('0xa')](),controller['update']);router[_0xae37('0x11')]('/:id',auth[_0xae37('0xa')](),controller[_0xae37('0x12')]);module[_0xae37('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index d283454..2f49dd9 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 _0x0b42=['exports','STRING','sequelize'];(function(_0x56e247,_0x14a77e){var _0x55c7b1=function(_0x59cb7b){while(--_0x59cb7b){_0x56e247['push'](_0x56e247['shift']());}};_0x55c7b1(++_0x14a77e);}(_0x0b42,0x116));var _0x20b4=function(_0x4d5796,_0x5ae1a0){_0x4d5796=_0x4d5796-0x0;var _0x447742=_0x0b42[_0x4d5796];return _0x447742;};'use strict';var Sequelize=require(_0x20b4('0x0'));module[_0x20b4('0x1')]={'name':{'type':Sequelize[_0x20b4('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x20b4('0x2')]},'zone':{'type':Sequelize[_0x20b4('0x2')]},'clientId':{'type':Sequelize[_0x20b4('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x20b4('0x2')]},'code':{'type':Sequelize[_0x20b4('0x2')]},'refreshToken':{'type':Sequelize[_0x20b4('0x2')]}}; \ No newline at end of file +var _0x05ae=['sequelize','exports','STRING'];(function(_0x16f09a,_0x1e411b){var _0x346444=function(_0x578800){while(--_0x578800){_0x16f09a['push'](_0x16f09a['shift']());}};_0x346444(++_0x1e411b);}(_0x05ae,0x120));var _0xe05a=function(_0x160110,_0x4606c5){_0x160110=_0x160110-0x0;var _0x4c1ac9=_0x05ae[_0x160110];return _0x4c1ac9;};'use strict';var Sequelize=require(_0xe05a('0x0'));module[_0xe05a('0x1')]={'name':{'type':Sequelize[_0xe05a('0x2')]},'description':{'type':Sequelize[_0xe05a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xe05a('0x2')]},'clientId':{'type':Sequelize[_0xe05a('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe05a('0x2')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xe05a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f0344b5..7747138 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 _0x454c=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','debug','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','ZohoAccount','count','includeAll','params','include','find','create','body','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','Subjects','channel','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','getFields','host','serverUrl','zoho.eu','com','slice','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0xf371c2,_0x38e4bc){var _0x47c3bb=function(_0x16b34c){while(--_0x16b34c){_0xf371c2['push'](_0xf371c2['shift']());}};_0x47c3bb(++_0x38e4bc);}(_0x454c,0x195));var _0xc454=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x454c[_0x8ba19a];return _0x2bd8b4;};'use strict';var pdf=require(_0xc454('0x0'));var emlformat=require(_0xc454('0x1'));var rimraf=require(_0xc454('0x2'));var zipdir=require(_0xc454('0x3'));var jsonpatch=require(_0xc454('0x4'));var rp=require(_0xc454('0x5'));var moment=require(_0xc454('0x6'));var BPromise=require(_0xc454('0x7'));var Mustache=require(_0xc454('0x8'));var util=require(_0xc454('0x9'));var path=require(_0xc454('0xa'));var sox=require(_0xc454('0xb'));var csv=require(_0xc454('0xc'));var ejs=require(_0xc454('0xd'));var fs=require('fs');var _=require(_0xc454('0xe'));var squel=require(_0xc454('0xf'));var crypto=require(_0xc454('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xc454('0x11'));var toCsv=require(_0xc454('0xc'));var querystring=require(_0xc454('0x12'));var Papa=require(_0xc454('0x13'));var Redis=require(_0xc454('0x14'));var authService=require(_0xc454('0x15'));var qs=require(_0xc454('0x16'));var as=require(_0xc454('0x17'));var hardwareService=require(_0xc454('0x18'));var logger=require(_0xc454('0x19'))(_0xc454('0x1a'));var utils=require('../../config/utils');var config=require(_0xc454('0x1b'));var db=require(_0xc454('0x1c'))['db'];var integrations=require(_0xc454('0x1d'));var jayson=require(_0xc454('0x1e'));var client=jayson[_0xc454('0x1f')][_0xc454('0x20')]({'port':0x232a});function checkPasswordPattern(_0x18e75b,_0x525678,_0x4ef1c1){if(_0x4ef1c1){var _0x584379=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x584379[_0xc454('0x21')](_0x525678)){return _0x18e75b;}else{throw new db[(_0xc454('0x22'))][(_0xc454('0x23'))](_0xc454('0x24'));}}else{return _0x18e75b;}}function respondWithRpcPromise(_0xc031ad,_0x84c365,_0x2600aa,_0x585745){return new BPromise(function(_0xb30b92,_0x1c71b2){var _0x3dcf27=_0x585745||client;return _0x3dcf27['request'](_0xc031ad,_0x2600aa)['then'](function(_0xd6d4c8){logger[_0xc454('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x84c365,'request\x20sent');logger[_0xc454('0x26')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x84c365,_0xc454('0x27'),JSON[_0xc454('0x28')](_0xd6d4c8));if(_0xd6d4c8[_0xc454('0x29')]){if(_0xd6d4c8[_0xc454('0x29')][_0xc454('0x2a')]===0x1f4){logger[_0xc454('0x29')](_0xc454('0x2b'),_0x84c365,_0xd6d4c8['error'][_0xc454('0x2c')]);return _0x1c71b2(_0xd6d4c8[_0xc454('0x29')][_0xc454('0x2c')]);}logger['error'](_0xc454('0x2b'),_0x84c365,_0xd6d4c8[_0xc454('0x29')]['message']);return _0xb30b92(_0xd6d4c8[_0xc454('0x29')][_0xc454('0x2c')]);}else{logger['info'](_0xc454('0x2b'),_0x84c365,_0xc454('0x27'));_0xb30b92(_0xd6d4c8['result'][_0xc454('0x2c')]);}})[_0xc454('0x2d')](function(_0x390112){logger[_0xc454('0x29')](_0xc454('0x2b'),_0x84c365,_0x390112);_0x1c71b2(_0x390112);});});}function respondWithStatusCode(_0x18dd37,_0x4a2b2c){_0x4a2b2c=_0x4a2b2c||0xcc;return function(_0x4c99f5){if(_0x4c99f5){return _0x18dd37[_0xc454('0x2e')](_0x4a2b2c);}return _0x18dd37[_0xc454('0x2f')](_0x4a2b2c)[_0xc454('0x30')]();};}function respondWithResult(_0x32e850,_0x21267a){_0x21267a=_0x21267a||0xc8;return function(_0x2d7766){if(_0x2d7766){return _0x32e850['status'](_0x21267a)[_0xc454('0x31')](_0x2d7766);}};}function respondWithFilteredResult(_0x3e26bb,_0x5075a0){return function(_0xbb6fab){if(_0xbb6fab){var _0x2fdcbc=_0xbb6fab['count'],_0x5bcb54=_0x5075a0[_0xc454('0x32')],_0x54bd33=_0x5075a0[_0xc454('0x32')]+_0x5075a0[_0xc454('0x33')],_0x364413;if(_0x54bd33>=_0x2fdcbc){_0x54bd33=_0x2fdcbc;_0x364413=0xc8;}else{_0x364413=0xce;}_0x3e26bb[_0xc454('0x2f')](_0x364413);return _0x3e26bb[_0xc454('0x34')](_0xc454('0x35'),_0x5bcb54+'-'+_0x54bd33+'/'+_0x2fdcbc)[_0xc454('0x31')](_0xbb6fab);}return null;};}function patchUpdates(_0x13b39e){return function(_0x5d850c){try{jsonpatch['apply'](_0x5d850c,_0x13b39e,!![]);}catch(_0xf2bf30){return BPromise['reject'](_0xf2bf30);}return _0x5d850c[_0xc454('0x36')]();};}function saveUpdates(_0x21ac38,_0x4ba7f3){return function(_0x5d50e2){if(_0x5d50e2){return _0x5d50e2[_0xc454('0x37')](_0x21ac38)['then'](function(_0x4971c1){return _0x4971c1;});}return null;};}function removeEntity(_0x38b73a,_0x3e7a4e){return function(_0x220157){if(_0x220157){return _0x220157[_0xc454('0x38')]()[_0xc454('0x39')](function(){_0x38b73a[_0xc454('0x2f')](0xcc)[_0xc454('0x30')]();});}};}function handleEntityNotFound(_0x4dfa49,_0x2c8d6a){return function(_0x3f70ad){if(!_0x3f70ad){_0x4dfa49[_0xc454('0x2e')](0x194);}return _0x3f70ad;};}function handleError(_0x3da842,_0xcc9db){_0xcc9db=_0xcc9db||0x1f4;return function(_0x4a0166){logger['error'](_0x4a0166[_0xc454('0x3a')]);if(_0x4a0166[_0xc454('0x3b')]){delete _0x4a0166['name'];}_0x3da842[_0xc454('0x2f')](_0xcc9db)[_0xc454('0x3c')](_0x4a0166);};}exports[_0xc454('0x3d')]=function(_0x1bc7d8,_0x32b8e3){var _0x3f074d={},_0x5653a5={},_0x21b696={'count':0x0,'rows':[]};var _0x379f0b=_[_0xc454('0x3e')](db['ZohoAccount'][_0xc454('0x3f')],function(_0x365fee){return{'name':_0x365fee[_0xc454('0x40')],'type':_0x365fee[_0xc454('0x41')]['key']};});_0x5653a5[_0xc454('0x42')]=_[_0xc454('0x3e')](_0x379f0b,_0xc454('0x3b'));_0x5653a5[_0xc454('0x43')]=_[_0xc454('0x44')](_0x1bc7d8[_0xc454('0x43')]);_0x5653a5['filters']=_[_0xc454('0x45')](_0x5653a5[_0xc454('0x42')],_0x5653a5['query']);_0x3f074d[_0xc454('0x46')]=_[_0xc454('0x45')](_0x5653a5[_0xc454('0x42')],qs[_0xc454('0x47')](_0x1bc7d8[_0xc454('0x43')][_0xc454('0x47')]));_0x3f074d[_0xc454('0x46')]=_0x3f074d[_0xc454('0x46')][_0xc454('0x48')]?_0x3f074d[_0xc454('0x46')]:_0x5653a5[_0xc454('0x42')];if(!_0x1bc7d8[_0xc454('0x43')][_0xc454('0x49')](_0xc454('0x4a'))){_0x3f074d['limit']=qs[_0xc454('0x33')](_0x1bc7d8['query'][_0xc454('0x33')]);_0x3f074d[_0xc454('0x32')]=qs[_0xc454('0x32')](_0x1bc7d8[_0xc454('0x43')][_0xc454('0x32')]);}_0x3f074d[_0xc454('0x4b')]=qs[_0xc454('0x4c')](_0x1bc7d8[_0xc454('0x43')]['sort']);_0x3f074d[_0xc454('0x4d')]=qs[_0xc454('0x4e')](_['pick'](_0x1bc7d8[_0xc454('0x43')],_0x5653a5['filters']),_0x379f0b);if(_0x1bc7d8[_0xc454('0x43')]['filter']){_0x3f074d[_0xc454('0x4d')]=_[_0xc454('0x4f')](_0x3f074d['where'],{'$or':_[_0xc454('0x3e')](_0x379f0b,function(_0x2fb0e5){if(_0x2fb0e5['type']!==_0xc454('0x50')){var _0x218967={};_0x218967[_0x2fb0e5['name']]={'$like':'%'+_0x1bc7d8['query'][_0xc454('0x51')]+'%'};return _0x218967;}})});}_0x3f074d=_[_0xc454('0x4f')]({},_0x3f074d,_0x1bc7d8[_0xc454('0x52')]);var _0x41bcde={'where':_0x3f074d[_0xc454('0x4d')]};return db[_0xc454('0x53')][_0xc454('0x54')](_0x41bcde)['then'](function(_0x1cb8cd){_0x21b696['count']=_0x1cb8cd;if(_0x1bc7d8['query'][_0xc454('0x55')]){_0x3f074d['include']=[{'all':!![]}];}return db[_0xc454('0x53')]['findAll'](_0x3f074d);})[_0xc454('0x39')](function(_0x4aa8ef){_0x21b696['rows']=_0x4aa8ef;return _0x21b696;})[_0xc454('0x39')](respondWithFilteredResult(_0x32b8e3,_0x3f074d))[_0xc454('0x2d')](handleError(_0x32b8e3,null));};exports['show']=function(_0x502563,_0x23c6d8){var _0x58321a={'raw':![],'where':{'id':_0x502563[_0xc454('0x56')]['id']}},_0x2270ed={};_0x2270ed[_0xc454('0x42')]=_[_0xc454('0x44')](db[_0xc454('0x53')][_0xc454('0x3f')]);_0x2270ed[_0xc454('0x43')]=_[_0xc454('0x44')](_0x502563['query']);_0x2270ed[_0xc454('0x4e')]=_[_0xc454('0x45')](_0x2270ed[_0xc454('0x42')],_0x2270ed[_0xc454('0x43')]);_0x58321a[_0xc454('0x46')]=_[_0xc454('0x45')](_0x2270ed[_0xc454('0x42')],qs[_0xc454('0x47')](_0x502563['query'][_0xc454('0x47')]));_0x58321a[_0xc454('0x46')]=_0x58321a[_0xc454('0x46')][_0xc454('0x48')]?_0x58321a['attributes']:_0x2270ed[_0xc454('0x42')];if(_0x502563[_0xc454('0x43')][_0xc454('0x55')]){_0x58321a[_0xc454('0x57')]=[{'all':!![]}];}_0x58321a=_['merge']({},_0x58321a,_0x502563['options']);return db[_0xc454('0x53')][_0xc454('0x58')](_0x58321a)[_0xc454('0x39')](handleEntityNotFound(_0x23c6d8,null))[_0xc454('0x39')](respondWithResult(_0x23c6d8,null))[_0xc454('0x2d')](handleError(_0x23c6d8,null));};exports[_0xc454('0x59')]=function(_0x487196,_0x23f7ca){return db['ZohoAccount'][_0xc454('0x59')](_0x487196['body'],{})[_0xc454('0x39')](respondWithResult(_0x23f7ca,0xc9))[_0xc454('0x2d')](handleError(_0x23f7ca,null));};exports[_0xc454('0x37')]=function(_0x22e920,_0xcd8177){if(_0x22e920[_0xc454('0x5a')]['id']){delete _0x22e920['body']['id'];}return db[_0xc454('0x53')][_0xc454('0x58')]({'where':{'id':_0x22e920[_0xc454('0x56')]['id']}})['then'](handleEntityNotFound(_0xcd8177,null))[_0xc454('0x39')](saveUpdates(_0x22e920[_0xc454('0x5a')],null))['then'](respondWithResult(_0xcd8177,null))[_0xc454('0x2d')](handleError(_0xcd8177,null));};exports[_0xc454('0x38')]=function(_0x3688bc,_0x2450d8){return db[_0xc454('0x53')][_0xc454('0x58')]({'where':{'id':_0x3688bc[_0xc454('0x56')]['id']}})[_0xc454('0x39')](handleEntityNotFound(_0x2450d8,null))[_0xc454('0x39')](removeEntity(_0x2450d8,null))[_0xc454('0x2d')](handleError(_0x2450d8,null));};exports[_0xc454('0x5b')]=function(_0x319232,_0x297573,_0xe6b74b){var _0x1f5102={};var _0x5a6b25={};var _0x4ab5d3;var _0x487db6;return db[_0xc454('0x53')][_0xc454('0x5c')]({'where':{'id':_0x319232[_0xc454('0x56')]['id']}})[_0xc454('0x39')](handleEntityNotFound(_0x297573,null))[_0xc454('0x39')](function(_0x3eb01e){if(_0x3eb01e){_0x4ab5d3=_0x3eb01e;_0x5a6b25[_0xc454('0x42')]=_['keys'](db[_0xc454('0x5d')]['rawAttributes']);_0x5a6b25['query']=_[_0xc454('0x44')](_0x319232['query']);_0x5a6b25[_0xc454('0x4e')]=_[_0xc454('0x45')](_0x5a6b25[_0xc454('0x42')],_0x5a6b25[_0xc454('0x43')]);_0x1f5102[_0xc454('0x46')]=_[_0xc454('0x45')](_0x5a6b25[_0xc454('0x42')],qs[_0xc454('0x47')](_0x319232[_0xc454('0x43')][_0xc454('0x47')]));_0x1f5102[_0xc454('0x46')]=_0x1f5102[_0xc454('0x46')][_0xc454('0x48')]?_0x1f5102[_0xc454('0x46')]:_0x5a6b25[_0xc454('0x42')];_0x1f5102['order']=qs[_0xc454('0x4c')](_0x319232[_0xc454('0x43')][_0xc454('0x4c')]);_0x1f5102['where']=qs[_0xc454('0x4e')](_[_0xc454('0x5e')](_0x319232[_0xc454('0x43')],_0x5a6b25['filters']));if(_0x319232['query'][_0xc454('0x51')]){_0x1f5102[_0xc454('0x4d')]=_[_0xc454('0x4f')](_0x1f5102['where'],{'$or':_[_0xc454('0x3e')](_0x1f5102['attributes'],function(_0x184406){var _0x5ca0c7={};_0x5ca0c7[_0x184406]={'$like':'%'+_0x319232['query']['filter']+'%'};return _0x5ca0c7;})});}_0x1f5102=_[_0xc454('0x4f')]({},_0x1f5102,_0x319232[_0xc454('0x52')]);return _0x4ab5d3[_0xc454('0x5b')](_0x1f5102);}})[_0xc454('0x39')](function(_0xb3538f){if(_0xb3538f){_0x487db6=_0xb3538f[_0xc454('0x48')];if(!_0x319232[_0xc454('0x43')][_0xc454('0x49')](_0xc454('0x4a'))){_0x1f5102['limit']=qs[_0xc454('0x33')](_0x319232[_0xc454('0x43')]['limit']);_0x1f5102[_0xc454('0x32')]=qs[_0xc454('0x32')](_0x319232[_0xc454('0x43')]['offset']);}return _0x4ab5d3[_0xc454('0x5b')](_0x1f5102);}})['then'](function(_0x5eb3d0){if(_0x5eb3d0){return _0x5eb3d0?{'count':_0x487db6,'rows':_0x5eb3d0}:null;}})['then'](respondWithResult(_0x297573,null))[_0xc454('0x2d')](handleError(_0x297573,null));};exports[_0xc454('0x5f')]=function(_0x12539d,_0x26ecd3,_0x11020a){if(_0x12539d[_0xc454('0x5a')]['id']){delete _0x12539d[_0xc454('0x5a')]['id'];}return db[_0xc454('0x53')][_0xc454('0x5c')]({'where':{'id':_0x12539d[_0xc454('0x56')]['id']}})[_0xc454('0x39')](handleEntityNotFound(_0x26ecd3,null))['then'](function(_0x526793){if(_0x526793){_0x12539d['body']['AccountId']=_0x526793['id'];_0x12539d[_0xc454('0x5a')][_0xc454('0x60')]=integrations['getSubjects'](_0x12539d[_0xc454('0x5a')][_0xc454('0x61')],_0x12539d[_0xc454('0x5a')][_0xc454('0x41')]);_0x12539d[_0xc454('0x5a')]['Descriptions']=integrations[_0xc454('0x62')](_0x12539d[_0xc454('0x5a')][_0xc454('0x61')],_0x12539d[_0xc454('0x5a')][_0xc454('0x41')]);return db[_0xc454('0x5d')][_0xc454('0x59')](_0x12539d[_0xc454('0x5a')],{'include':[{'model':db[_0xc454('0x63')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x26ecd3,null))[_0xc454('0x2d')](handleError(_0x26ecd3,null));};function getAccessToken(_0x460153){return new Promise(function(_0x1215a5,_0x57ad4b){var _0x655d5f;switch(_0x460153['zone']){case'US':_0x655d5f='https://accounts.zoho.com';break;case'AU':_0x655d5f=_0xc454('0x64');break;case'EU':_0x655d5f=_0xc454('0x65');break;case'IN':_0x655d5f='https://accounts.zoho.in';break;case'CN':_0x655d5f=_0xc454('0x66');break;default:_0x655d5f=_0xc454('0x65');break;}var _0x56ec39={'method':_0xc454('0x67'),'uri':_0x655d5f+_0xc454('0x68'),'qs':{'refresh_token':_0x460153[_0xc454('0x69')],'client_id':_0x460153[_0xc454('0x6a')],'client_secret':_0x460153[_0xc454('0x6b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x56ec39)['then'](function(_0x358d2e){if(_0x358d2e[_0xc454('0x6c')]){_0x1215a5(_0x358d2e[_0xc454('0x6c')]);}else{_0x57ad4b('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xc454('0x2d')](function(_0x1419b7){_0x57ad4b(_0x1419b7);});});}exports[_0xc454('0x6d')]=function(_0xc3b936,_0x270f24,_0x3a88f2){var _0x547005,_0x5e0d3d,_0x31c555,_0x53238c,_0xc92f08;return db[_0xc454('0x53')]['findOne']({'where':{'id':_0xc3b936[_0xc454('0x56')]['id']},'attributes':['id',_0xc454('0x6e'),'zone',_0xc454('0x6a'),_0xc454('0x6b'),_0xc454('0x6f'),_0xc454('0x2a'),'refreshToken']})[_0xc454('0x39')](handleEntityNotFound(_0x270f24,null))[_0xc454('0x39')](function(_0x22f2ef){_0xc92f08=_0x22f2ef;_0x547005=_0xc92f08[_0xc454('0x6e')];_0x5e0d3d=_0x547005===_0xc454('0x70')?'eu':_0xc454('0x71');_0x31c555=_0xc92f08[_0xc454('0x6f')];var _0x22bb1b=_0x31c555[_0xc454('0x72')](-0x1);if(_0x22bb1b==='/'||_0x22bb1b==='\x5c'||_0x22bb1b===':'){_0x31c555=_0x31c555['substring'](0x0,_0x31c555[_0xc454('0x73')](_0x22bb1b));}if(!_0xc92f08[_0xc454('0x69')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0xc92f08);})['then'](function(_0x5e45fb){if(_0x5e45fb){return rp({'method':_0xc454('0x74'),'uri':util[_0xc454('0x75')](_0xc454('0x76'),_0x5e0d3d),'qs':{'module':_0xc454('0x77')},'headers':{'Authorization':_0xc454('0x78')+_0x5e45fb},'json':!![]});}})[_0xc454('0x39')](function(_0x372129){if(_0x372129){if(_0x372129[_0xc454('0x79')]&&_0x372129['response'][_0xc454('0x29')]){throw new Error(_0x372129[_0xc454('0x79')]['error']['message']);}var _0x3da70c=[];var _0x381819=[];var _0x3cd553=[_0xc454('0x7a'),'Subject',_0xc454('0x7b'),_0xc454('0x7c'),_0xc454('0x7d'),_0xc454('0x7e'),_0xc454('0x7f'),_0xc454('0x80')];_0x381819=_[_0xc454('0x81')](_0x372129[_0xc454('0x47')],function(_0x2c62bd){return _0x3cd553[_0xc454('0x82')](_0x2c62bd['api_name']);});for(var _0x1fb133=0x0;_0x1fb133<_0x381819[_0xc454('0x48')];_0x1fb133++){if(_0x381819[_0x1fb133][_0xc454('0x83')]===![]){_0x3da70c['push']({'id':_0x381819[_0x1fb133]['id'],'name':_0x381819[_0x1fb133][_0xc454('0x84')],'custom':_0x381819[_0x1fb133][_0xc454('0x85')],'options':_0x381819[_0x1fb133][_0xc454('0x86')]===_0xc454('0x87')&&_0x381819[_0x1fb133][_0xc454('0x88')][_0xc454('0x48')]>-0x1?_['map'](_0x381819[_0x1fb133][_0xc454('0x88')],function(_0x146e6a){return{'name':_0x146e6a,'value':_0x146e6a};}):[]});}}return{'count':_0x3da70c[_0xc454('0x48')],'rows':_0x3da70c};}else{return{'count':0x0,'rows':[]};}})[_0xc454('0x39')](respondWithResult(_0x270f24,null))[_0xc454('0x2d')](function(_0x4e3ff1){var _0x5ae809=_0xc3b936[_0xc454('0x43')][_0xc454('0x21')]?0x1f4:_0x4e3ff1['statusCode']||0x1f4;logger[_0xc454('0x29')](_0xc454('0x89'),_0xc454('0x6d'),_0x5ae809,JSON[_0xc454('0x28')](_0x4e3ff1));delete _0x4e3ff1[_0xc454('0x3b')];if(_0x5ae809===0x191){_0x5ae809=0x190;}_0x270f24[_0xc454('0x2f')](_0x5ae809)[_0xc454('0x3c')](_0xc3b936[_0xc454('0x43')][_0xc454('0x21')]?{'message':_0xc454('0x8a'),'statusCode':_0x4e3ff1['statusCode']}:_0x4e3ff1);});}; \ No newline at end of file +var _0x390f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','body','getConfigurations','ZohoConfiguration','order','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse'];(function(_0x14a129,_0x319fc4){var _0x20d46d=function(_0x22a8ce){while(--_0x22a8ce){_0x14a129['push'](_0x14a129['shift']());}};_0x20d46d(++_0x319fc4);}(_0x390f,0x111));var _0xf390=function(_0x42b3a2,_0x3f7f79){_0x42b3a2=_0x42b3a2-0x0;var _0x57917f=_0x390f[_0x42b3a2];return _0x57917f;};'use strict';var pdf=require(_0xf390('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf390('0x1'));var zipdir=require(_0xf390('0x2'));var jsonpatch=require(_0xf390('0x3'));var rp=require(_0xf390('0x4'));var moment=require(_0xf390('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf390('0x6'));var util=require(_0xf390('0x7'));var path=require(_0xf390('0x8'));var sox=require(_0xf390('0x9'));var csv=require(_0xf390('0xa'));var ejs=require(_0xf390('0xb'));var fs=require('fs');var _=require(_0xf390('0xc'));var squel=require(_0xf390('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf390('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf390('0xf'));var Papa=require(_0xf390('0x10'));var Redis=require(_0xf390('0x11'));var authService=require(_0xf390('0x12'));var qs=require(_0xf390('0x13'));var as=require(_0xf390('0x14'));var hardwareService=require(_0xf390('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf390('0x16'));var config=require(_0xf390('0x17'));var db=require(_0xf390('0x18'))['db'];var integrations=require(_0xf390('0x19'));var jayson=require(_0xf390('0x1a'));var client=jayson['client'][_0xf390('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4e16c1,_0x583db3,_0x8031b8){if(_0x8031b8){var _0x43562d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43562d[_0xf390('0x1c')](_0x583db3)){return _0x4e16c1;}else{throw new db[(_0xf390('0x1d'))][(_0xf390('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4e16c1;}}function respondWithRpcPromise(_0x28c135,_0x18f703,_0x22c0b3,_0x105896){return new BPromise(function(_0x366458,_0x15ee87){var _0x4003ec=_0x105896||client;return _0x4003ec[_0xf390('0x1f')](_0x28c135,_0x22c0b3)[_0xf390('0x20')](function(_0x460b8a){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x18f703,_0xf390('0x21'));logger[_0xf390('0x22')](_0xf390('0x23'),_0x18f703,_0xf390('0x21'),JSON[_0xf390('0x24')](_0x460b8a));if(_0x460b8a[_0xf390('0x25')]){if(_0x460b8a[_0xf390('0x25')]['code']===0x1f4){logger[_0xf390('0x25')](_0xf390('0x26'),_0x18f703,_0x460b8a[_0xf390('0x25')]['message']);return _0x15ee87(_0x460b8a['error'][_0xf390('0x27')]);}logger[_0xf390('0x25')](_0xf390('0x26'),_0x18f703,_0x460b8a[_0xf390('0x25')][_0xf390('0x27')]);return _0x366458(_0x460b8a[_0xf390('0x25')][_0xf390('0x27')]);}else{logger[_0xf390('0x28')](_0xf390('0x26'),_0x18f703,'request\x20sent');_0x366458(_0x460b8a[_0xf390('0x29')]['message']);}})[_0xf390('0x2a')](function(_0x2d5884){logger[_0xf390('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x18f703,_0x2d5884);_0x15ee87(_0x2d5884);});});}function respondWithStatusCode(_0x18e220,_0x1a5155){_0x1a5155=_0x1a5155||0xcc;return function(_0x4a54e9){if(_0x4a54e9){return _0x18e220[_0xf390('0x2b')](_0x1a5155);}return _0x18e220[_0xf390('0x2c')](_0x1a5155)[_0xf390('0x2d')]();};}function respondWithResult(_0x20adff,_0x1980c2){_0x1980c2=_0x1980c2||0xc8;return function(_0x25ceb6){if(_0x25ceb6){return _0x20adff[_0xf390('0x2c')](_0x1980c2)[_0xf390('0x2e')](_0x25ceb6);}};}function respondWithFilteredResult(_0x50894e,_0x11c337){return function(_0x4bb4f0){if(_0x4bb4f0){var _0x5a7a49=_0x4bb4f0[_0xf390('0x2f')],_0x3151e6=_0x11c337['offset'],_0x33f15a=_0x11c337[_0xf390('0x30')]+_0x11c337[_0xf390('0x31')],_0x3bdc1a;if(_0x33f15a>=_0x5a7a49){_0x33f15a=_0x5a7a49;_0x3bdc1a=0xc8;}else{_0x3bdc1a=0xce;}_0x50894e[_0xf390('0x2c')](_0x3bdc1a);return _0x50894e[_0xf390('0x32')]('Content-Range',_0x3151e6+'-'+_0x33f15a+'/'+_0x5a7a49)[_0xf390('0x2e')](_0x4bb4f0);}return null;};}function patchUpdates(_0x54ee9a){return function(_0x3daab){try{jsonpatch[_0xf390('0x33')](_0x3daab,_0x54ee9a,!![]);}catch(_0x123bdc){return BPromise[_0xf390('0x34')](_0x123bdc);}return _0x3daab[_0xf390('0x35')]();};}function saveUpdates(_0x335c1f,_0x4427fd){return function(_0x234e01){if(_0x234e01){return _0x234e01[_0xf390('0x36')](_0x335c1f)[_0xf390('0x20')](function(_0x2aad58){return _0x2aad58;});}return null;};}function removeEntity(_0x18fa31,_0x5f25f5){return function(_0x3125bb){if(_0x3125bb){return _0x3125bb[_0xf390('0x37')]()[_0xf390('0x20')](function(){_0x18fa31['status'](0xcc)[_0xf390('0x2d')]();});}};}function handleEntityNotFound(_0x1a5867,_0x24d096){return function(_0x3ca9dc){if(!_0x3ca9dc){_0x1a5867[_0xf390('0x2b')](0x194);}return _0x3ca9dc;};}function handleError(_0x435cd7,_0xefb511){_0xefb511=_0xefb511||0x1f4;return function(_0x14a491){logger[_0xf390('0x25')](_0x14a491[_0xf390('0x38')]);if(_0x14a491[_0xf390('0x39')]){delete _0x14a491[_0xf390('0x39')];}_0x435cd7[_0xf390('0x2c')](_0xefb511)[_0xf390('0x3a')](_0x14a491);};}exports[_0xf390('0x3b')]=function(_0x413f11,_0x567eeb){var _0x701eb4={},_0x5c8b14={},_0x5e3c86={'count':0x0,'rows':[]};var _0x1ffa77=_['map'](db[_0xf390('0x3c')][_0xf390('0x3d')],function(_0x34f429){return{'name':_0x34f429[_0xf390('0x3e')],'type':_0x34f429[_0xf390('0x3f')][_0xf390('0x40')]};});_0x5c8b14[_0xf390('0x41')]=_[_0xf390('0x42')](_0x1ffa77,'name');_0x5c8b14['query']=_['keys'](_0x413f11[_0xf390('0x43')]);_0x5c8b14[_0xf390('0x44')]=_['intersection'](_0x5c8b14['model'],_0x5c8b14[_0xf390('0x43')]);_0x701eb4[_0xf390('0x45')]=_[_0xf390('0x46')](_0x5c8b14[_0xf390('0x41')],qs[_0xf390('0x47')](_0x413f11['query'][_0xf390('0x47')]));_0x701eb4[_0xf390('0x45')]=_0x701eb4[_0xf390('0x45')][_0xf390('0x48')]?_0x701eb4[_0xf390('0x45')]:_0x5c8b14[_0xf390('0x41')];if(!_0x413f11[_0xf390('0x43')][_0xf390('0x49')](_0xf390('0x4a'))){_0x701eb4[_0xf390('0x31')]=qs[_0xf390('0x31')](_0x413f11['query'][_0xf390('0x31')]);_0x701eb4[_0xf390('0x30')]=qs[_0xf390('0x30')](_0x413f11[_0xf390('0x43')][_0xf390('0x30')]);}_0x701eb4['order']=qs[_0xf390('0x4b')](_0x413f11[_0xf390('0x43')]['sort']);_0x701eb4[_0xf390('0x4c')]=qs[_0xf390('0x44')](_['pick'](_0x413f11[_0xf390('0x43')],_0x5c8b14[_0xf390('0x44')]),_0x1ffa77);if(_0x413f11['query'][_0xf390('0x4d')]){_0x701eb4[_0xf390('0x4c')]=_[_0xf390('0x4e')](_0x701eb4[_0xf390('0x4c')],{'$or':_[_0xf390('0x42')](_0x1ffa77,function(_0x2b06b8){if(_0x2b06b8[_0xf390('0x3f')]!=='VIRTUAL'){var _0x62ac2b={};_0x62ac2b[_0x2b06b8[_0xf390('0x39')]]={'$like':'%'+_0x413f11[_0xf390('0x43')][_0xf390('0x4d')]+'%'};return _0x62ac2b;}})});}_0x701eb4=_['merge']({},_0x701eb4,_0x413f11[_0xf390('0x4f')]);var _0x80b550={'where':_0x701eb4[_0xf390('0x4c')]};return db[_0xf390('0x3c')]['count'](_0x80b550)['then'](function(_0x433d28){_0x5e3c86[_0xf390('0x2f')]=_0x433d28;if(_0x413f11['query'][_0xf390('0x50')]){_0x701eb4[_0xf390('0x51')]=[{'all':!![]}];}return db[_0xf390('0x3c')][_0xf390('0x52')](_0x701eb4);})[_0xf390('0x20')](function(_0x91c394){_0x5e3c86[_0xf390('0x53')]=_0x91c394;return _0x5e3c86;})[_0xf390('0x20')](respondWithFilteredResult(_0x567eeb,_0x701eb4))['catch'](handleError(_0x567eeb,null));};exports[_0xf390('0x54')]=function(_0x4280cb,_0x4e483b){var _0x5d64ea={'raw':![],'where':{'id':_0x4280cb[_0xf390('0x55')]['id']}},_0x25fead={};_0x25fead[_0xf390('0x41')]=_[_0xf390('0x56')](db[_0xf390('0x3c')][_0xf390('0x3d')]);_0x25fead['query']=_[_0xf390('0x56')](_0x4280cb[_0xf390('0x43')]);_0x25fead['filters']=_[_0xf390('0x46')](_0x25fead['model'],_0x25fead[_0xf390('0x43')]);_0x5d64ea[_0xf390('0x45')]=_[_0xf390('0x46')](_0x25fead[_0xf390('0x41')],qs[_0xf390('0x47')](_0x4280cb[_0xf390('0x43')][_0xf390('0x47')]));_0x5d64ea[_0xf390('0x45')]=_0x5d64ea[_0xf390('0x45')][_0xf390('0x48')]?_0x5d64ea['attributes']:_0x25fead[_0xf390('0x41')];if(_0x4280cb[_0xf390('0x43')][_0xf390('0x50')]){_0x5d64ea[_0xf390('0x51')]=[{'all':!![]}];}_0x5d64ea=_[_0xf390('0x4e')]({},_0x5d64ea,_0x4280cb[_0xf390('0x4f')]);return db['ZohoAccount'][_0xf390('0x57')](_0x5d64ea)['then'](handleEntityNotFound(_0x4e483b,null))[_0xf390('0x20')](respondWithResult(_0x4e483b,null))['catch'](handleError(_0x4e483b,null));};exports['create']=function(_0x2446af,_0x5afeab){return db[_0xf390('0x3c')]['create'](_0x2446af[_0xf390('0x58')],{})[_0xf390('0x20')](respondWithResult(_0x5afeab,0xc9))[_0xf390('0x2a')](handleError(_0x5afeab,null));};exports[_0xf390('0x36')]=function(_0x62fc0c,_0x454c63){if(_0x62fc0c['body']['id']){delete _0x62fc0c[_0xf390('0x58')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x62fc0c[_0xf390('0x55')]['id']}})['then'](handleEntityNotFound(_0x454c63,null))['then'](saveUpdates(_0x62fc0c[_0xf390('0x58')],null))[_0xf390('0x20')](respondWithResult(_0x454c63,null))[_0xf390('0x2a')](handleError(_0x454c63,null));};exports[_0xf390('0x37')]=function(_0x129b01,_0x13eabf){return db[_0xf390('0x3c')][_0xf390('0x57')]({'where':{'id':_0x129b01['params']['id']}})['then'](handleEntityNotFound(_0x13eabf,null))[_0xf390('0x20')](removeEntity(_0x13eabf,null))[_0xf390('0x2a')](handleError(_0x13eabf,null));};exports[_0xf390('0x59')]=function(_0x170923,_0x1fe1d7,_0x429f39){var _0x1cb27e={};var _0x58453f={};var _0x346475;var _0x522dd4;return db['ZohoAccount']['findOne']({'where':{'id':_0x170923[_0xf390('0x55')]['id']}})[_0xf390('0x20')](handleEntityNotFound(_0x1fe1d7,null))[_0xf390('0x20')](function(_0x1f6924){if(_0x1f6924){_0x346475=_0x1f6924;_0x58453f[_0xf390('0x41')]=_['keys'](db[_0xf390('0x5a')][_0xf390('0x3d')]);_0x58453f['query']=_[_0xf390('0x56')](_0x170923[_0xf390('0x43')]);_0x58453f[_0xf390('0x44')]=_[_0xf390('0x46')](_0x58453f[_0xf390('0x41')],_0x58453f[_0xf390('0x43')]);_0x1cb27e['attributes']=_[_0xf390('0x46')](_0x58453f['model'],qs[_0xf390('0x47')](_0x170923[_0xf390('0x43')][_0xf390('0x47')]));_0x1cb27e[_0xf390('0x45')]=_0x1cb27e['attributes'][_0xf390('0x48')]?_0x1cb27e['attributes']:_0x58453f['model'];_0x1cb27e[_0xf390('0x5b')]=qs[_0xf390('0x4b')](_0x170923[_0xf390('0x43')][_0xf390('0x4b')]);_0x1cb27e[_0xf390('0x4c')]=qs[_0xf390('0x44')](_[_0xf390('0x5c')](_0x170923['query'],_0x58453f['filters']));if(_0x170923['query'][_0xf390('0x4d')]){_0x1cb27e[_0xf390('0x4c')]=_['merge'](_0x1cb27e[_0xf390('0x4c')],{'$or':_['map'](_0x1cb27e['attributes'],function(_0x49a892){var _0x304c3b={};_0x304c3b[_0x49a892]={'$like':'%'+_0x170923['query']['filter']+'%'};return _0x304c3b;})});}_0x1cb27e=_[_0xf390('0x4e')]({},_0x1cb27e,_0x170923[_0xf390('0x4f')]);return _0x346475[_0xf390('0x59')](_0x1cb27e);}})['then'](function(_0x31b965){if(_0x31b965){_0x522dd4=_0x31b965[_0xf390('0x48')];if(!_0x170923[_0xf390('0x43')]['hasOwnProperty'](_0xf390('0x4a'))){_0x1cb27e[_0xf390('0x31')]=qs[_0xf390('0x31')](_0x170923[_0xf390('0x43')][_0xf390('0x31')]);_0x1cb27e[_0xf390('0x30')]=qs[_0xf390('0x30')](_0x170923['query'][_0xf390('0x30')]);}return _0x346475[_0xf390('0x59')](_0x1cb27e);}})[_0xf390('0x20')](function(_0xcfdb0){if(_0xcfdb0){return _0xcfdb0?{'count':_0x522dd4,'rows':_0xcfdb0}:null;}})['then'](respondWithResult(_0x1fe1d7,null))[_0xf390('0x2a')](handleError(_0x1fe1d7,null));};exports[_0xf390('0x5d')]=function(_0x5cd43f,_0xc51e1d,_0x243b13){if(_0x5cd43f[_0xf390('0x58')]['id']){delete _0x5cd43f[_0xf390('0x58')]['id'];}return db[_0xf390('0x3c')]['findOne']({'where':{'id':_0x5cd43f[_0xf390('0x55')]['id']}})['then'](handleEntityNotFound(_0xc51e1d,null))[_0xf390('0x20')](function(_0x41dfaa){if(_0x41dfaa){_0x5cd43f[_0xf390('0x58')][_0xf390('0x5e')]=_0x41dfaa['id'];_0x5cd43f[_0xf390('0x58')]['Subjects']=integrations[_0xf390('0x5f')](_0x5cd43f[_0xf390('0x58')][_0xf390('0x60')],_0x5cd43f['body'][_0xf390('0x3f')]);_0x5cd43f[_0xf390('0x58')][_0xf390('0x61')]=integrations[_0xf390('0x62')](_0x5cd43f[_0xf390('0x58')][_0xf390('0x60')],_0x5cd43f[_0xf390('0x58')][_0xf390('0x3f')]);return db[_0xf390('0x5a')][_0xf390('0x63')](_0x5cd43f['body'],{'include':[{'model':db[_0xf390('0x64')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xf390('0x61')}]});}return null;})[_0xf390('0x20')](respondWithResult(_0xc51e1d,null))[_0xf390('0x2a')](handleError(_0xc51e1d,null));};function getAccessToken(_0x4e0dcd){return new Promise(function(_0x390d3b,_0x1c04d1){var _0xb29a47;switch(_0x4e0dcd[_0xf390('0x65')]){case'US':_0xb29a47=_0xf390('0x66');break;case'AU':_0xb29a47=_0xf390('0x67');break;case'EU':_0xb29a47=_0xf390('0x68');break;case'IN':_0xb29a47=_0xf390('0x69');break;case'CN':_0xb29a47=_0xf390('0x6a');break;default:_0xb29a47=_0xf390('0x68');break;}var _0x53bb60={'method':_0xf390('0x6b'),'uri':_0xb29a47+_0xf390('0x6c'),'qs':{'refresh_token':_0x4e0dcd[_0xf390('0x6d')],'client_id':_0x4e0dcd[_0xf390('0x6e')],'client_secret':_0x4e0dcd[_0xf390('0x6f')],'grant_type':_0xf390('0x70')},'json':!![]};return rp(_0x53bb60)[_0xf390('0x20')](function(_0x2ae65e){if(_0x2ae65e[_0xf390('0x71')]){_0x390d3b(_0x2ae65e[_0xf390('0x71')]);}else{_0x1c04d1(_0xf390('0x72'));}})[_0xf390('0x2a')](function(_0xc38404){_0x1c04d1(_0xc38404);});});}exports[_0xf390('0x73')]=function(_0x3e33b3,_0x10fb2a,_0x94027f){var _0x373f13,_0x32ae0d,_0x4e5b73,_0x8320ba,_0x8bc6b6;return db['ZohoAccount']['findOne']({'where':{'id':_0x3e33b3[_0xf390('0x55')]['id']},'attributes':['id',_0xf390('0x74'),_0xf390('0x65'),'clientId','clientSecret',_0xf390('0x75'),_0xf390('0x76'),_0xf390('0x6d')]})['then'](handleEntityNotFound(_0x10fb2a,null))[_0xf390('0x20')](function(_0x51dde9){_0x8bc6b6=_0x51dde9;_0x373f13=_0x8bc6b6[_0xf390('0x74')];_0x32ae0d=_0x373f13==='zoho.eu'?'eu':_0xf390('0x77');_0x4e5b73=_0x8bc6b6['serverUrl'];var _0x21d663=_0x4e5b73[_0xf390('0x78')](-0x1);if(_0x21d663==='/'||_0x21d663==='\x5c'||_0x21d663===':'){_0x4e5b73=_0x4e5b73[_0xf390('0x79')](0x0,_0x4e5b73[_0xf390('0x7a')](_0x21d663));}if(!_0x8bc6b6[_0xf390('0x6d')]){throw new Error(_0xf390('0x7b'));}return getAccessToken(_0x8bc6b6);})['then'](function(_0x3d7d92){if(_0x3d7d92){return rp({'method':'GET','uri':util[_0xf390('0x7c')](_0xf390('0x7d'),_0x32ae0d),'qs':{'module':_0xf390('0x7e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3d7d92},'json':!![]});}})[_0xf390('0x20')](function(_0x4f6bbc){if(_0x4f6bbc){if(_0x4f6bbc[_0xf390('0x7f')]&&_0x4f6bbc[_0xf390('0x7f')]['error']){throw new Error(_0x4f6bbc['response'][_0xf390('0x25')][_0xf390('0x27')]);}var _0xdcba21=[];var _0x4f0944=[];var _0x2792f9=[_0xf390('0x80'),_0xf390('0x81'),_0xf390('0x82'),_0xf390('0x83'),'Call_Duration',_0xf390('0x84'),_0xf390('0x85'),_0xf390('0x86')];_0x4f0944=_['remove'](_0x4f6bbc['fields'],function(_0x2f9c1d){return _0x2792f9[_0xf390('0x87')](_0x2f9c1d['api_name']);});for(var _0x148e8e=0x0;_0x148e8e<_0x4f0944[_0xf390('0x48')];_0x148e8e++){if(_0x4f0944[_0x148e8e][_0xf390('0x88')]===![]){_0xdcba21[_0xf390('0x89')]({'id':_0x4f0944[_0x148e8e]['id'],'name':_0x4f0944[_0x148e8e][_0xf390('0x8a')],'custom':_0x4f0944[_0x148e8e][_0xf390('0x8b')],'options':_0x4f0944[_0x148e8e][_0xf390('0x8c')]==='picklist'&&_0x4f0944[_0x148e8e][_0xf390('0x8d')]['length']>-0x1?_['map'](_0x4f0944[_0x148e8e][_0xf390('0x8d')],function(_0x58a70f){return{'name':_0x58a70f,'value':_0x58a70f};}):[]});}}return{'count':_0xdcba21['length'],'rows':_0xdcba21};}else{return{'count':0x0,'rows':[]};}})[_0xf390('0x20')](respondWithResult(_0x10fb2a,null))['catch'](function(_0x510f6d){var _0x3f5d52=_0x3e33b3[_0xf390('0x43')]['test']?0x1f4:_0x510f6d['statusCode']||0x1f4;logger[_0xf390('0x25')](_0xf390('0x8e'),_0xf390('0x73'),_0x3f5d52,JSON['stringify'](_0x510f6d));delete _0x510f6d[_0xf390('0x39')];if(_0x3f5d52===0x191){_0x3f5d52=0x190;}_0x10fb2a[_0xf390('0x2c')](_0x3f5d52)['send'](_0x3e33b3[_0xf390('0x43')][_0xf390('0x1c')]?{'message':_0xf390('0x8f'),'statusCode':_0x510f6d[_0xf390('0x90')]}:_0x510f6d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4d5d98e..e20d9c6 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 _0x1e5e=['/oauth/v2/token','authorization_code','then','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','serverUrl','slice','https://accounts.zoho.in','application/x-www-form-urlencoded','catch','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code','host','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST'];(function(_0x2af504,_0x46a924){var _0x2abb2e=function(_0x53f705){while(--_0x53f705){_0x2af504['push'](_0x2af504['shift']());}};_0x2abb2e(++_0x46a924);}(_0x1e5e,0x18c));var _0xe1e5=function(_0x5ea740,_0x2903ab){_0x5ea740=_0x5ea740-0x0;var _0x57489c=_0x1e5e[_0x5ea740];return _0x57489c;};'use strict';var _=require('lodash');var util=require(_0xe1e5('0x0'));var logger=require(_0xe1e5('0x1'))(_0xe1e5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe1e5('0x3'));var fs=require('fs');var path=require(_0xe1e5('0x4'));var rimraf=require(_0xe1e5('0x5'));var config=require(_0xe1e5('0x6'));var attributes=require(_0xe1e5('0x7'));var integrations=require(_0xe1e5('0x8'));module['exports']=function(_0x2d2ee6,_0x589d4c){return _0x2d2ee6[_0xe1e5('0x9')](_0xe1e5('0xa'),attributes,{'tableName':_0xe1e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x278f50,_0x8437bb,_0x314ffd){if(_0x278f50[_0xe1e5('0xc')]('zone')||_0x278f50[_0xe1e5('0xc')]('serverUrl')||_0x278f50['changed'](_0xe1e5('0xd'))||_0x278f50[_0xe1e5('0xc')](_0xe1e5('0xe'))||_0x278f50['changed'](_0xe1e5('0xf'))||_0x278f50['changed'](_0xe1e5('0x10'))){var _0x2a663a,_0x4a4624;_0x2a663a=_0x278f50['serverUrl'];var _0xf64d13=_0x2a663a['slice'](-0x1);if(_0xf64d13==='/'||_0xf64d13==='\x5c'||_0xf64d13===':'){_0x2a663a=_0x2a663a[_0xe1e5('0x11')](0x0,_0x2a663a[_0xe1e5('0x12')](_0xf64d13));}switch(_0x278f50[_0xe1e5('0x13')]){case'US':_0x4a4624=_0xe1e5('0x14');break;case'AU':_0x4a4624='https://accounts.zoho.com.au';break;case'IN':_0x4a4624='https://accounts.zoho.in';break;case'CN':_0x4a4624=_0xe1e5('0x15');break;default:_0x4a4624=_0xe1e5('0x16');break;}var _0x13b987={'method':_0xe1e5('0x17'),'uri':_0x4a4624+_0xe1e5('0x18'),'form':{'grant_type':_0xe1e5('0x19'),'client_id':_0x278f50[_0xe1e5('0xd')],'client_secret':_0x278f50[_0xe1e5('0xe')],'redirect_uri':_0x278f50['serverUrl'],'code':_0x278f50[_0xe1e5('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x13b987)[_0xe1e5('0x1a')](function(_0x3e1cf2){var _0x462616=JSON[_0xe1e5('0x1b')](_0x3e1cf2);if(_0x462616['refresh_token']){_0x278f50[_0xe1e5('0x1c')]=_0x462616[_0xe1e5('0x1d')];logger[_0xe1e5('0x1e')](util['format'](_0xe1e5('0x1f'),_0x278f50[_0xe1e5('0x20')],_0x278f50['id']));}else{logger[_0xe1e5('0x21')](util[_0xe1e5('0x22')](_0xe1e5('0x23'),_0x278f50[_0xe1e5('0x20')],_0x278f50['id']),util[_0xe1e5('0x24')](_0x462616,{'showHidden':![],'depth':null}));}return _0x314ffd(null,_0x8437bb);})['catch'](function(_0x420d21){logger[_0xe1e5('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x278f50[_0xe1e5('0x20')],_0x278f50['id']),util[_0xe1e5('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x314ffd(_0x420d21);});}else{return _0x314ffd(null,_0x8437bb);}},'beforeUpdate':function(_0x58be90,_0x4fbf69,_0x5dcb6e){if(_0x58be90[_0xe1e5('0xc')](_0xe1e5('0x13'))||_0x58be90[_0xe1e5('0xc')]('serverUrl')||_0x58be90[_0xe1e5('0xc')]('clientId')||_0x58be90[_0xe1e5('0xc')]('clientSecret')||_0x58be90[_0xe1e5('0xc')](_0xe1e5('0xf'))||_0x58be90[_0xe1e5('0xc')]('host')){var _0x4eb252,_0x30e0b3;_0x4eb252=_0x58be90[_0xe1e5('0x25')];var _0xf19072=_0x4eb252[_0xe1e5('0x26')](-0x1);if(_0xf19072==='/'||_0xf19072==='\x5c'||_0xf19072===':'){_0x4eb252=_0x4eb252[_0xe1e5('0x11')](0x0,_0x4eb252[_0xe1e5('0x12')](_0xf19072));}switch(_0x58be90[_0xe1e5('0x13')]){case'US':_0x30e0b3=_0xe1e5('0x14');break;case'AU':_0x30e0b3='https://accounts.zoho.com.au';break;case'IN':_0x30e0b3=_0xe1e5('0x27');break;case'CN':_0x30e0b3=_0xe1e5('0x15');break;default:_0x30e0b3=_0xe1e5('0x16');break;}var _0x75a4cd={'method':_0xe1e5('0x17'),'uri':_0x30e0b3+_0xe1e5('0x18'),'form':{'grant_type':_0xe1e5('0x19'),'client_id':_0x58be90[_0xe1e5('0xd')],'client_secret':_0x58be90[_0xe1e5('0xe')],'redirect_uri':_0x58be90[_0xe1e5('0x25')],'code':_0x58be90[_0xe1e5('0xf')]},'headers':{'Content-Type':_0xe1e5('0x28')}};return rp(_0x75a4cd)[_0xe1e5('0x1a')](function(_0x3ac8e9){var _0x493fdb=JSON['parse'](_0x3ac8e9);if(_0x493fdb['refresh_token']){_0x58be90[_0xe1e5('0x1c')]=_0x493fdb['refresh_token'];logger['info'](util[_0xe1e5('0x22')](_0xe1e5('0x1f'),_0x58be90[_0xe1e5('0x20')],_0x58be90['id']));}else{logger[_0xe1e5('0x21')](util[_0xe1e5('0x22')](_0xe1e5('0x23'),_0x58be90['name'],_0x58be90['id']),util[_0xe1e5('0x24')](_0x493fdb,{'showHidden':![],'depth':null}));}return _0x5dcb6e(null,_0x4fbf69);})[_0xe1e5('0x29')](function(_0x28558f){logger[_0xe1e5('0x21')](util[_0xe1e5('0x22')](_0xe1e5('0x23'),_0x58be90[_0xe1e5('0x20')],_0x58be90['id']),util[_0xe1e5('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5dcb6e(_0x28558f);});}else{return _0x5dcb6e(null,_0x4fbf69);}}}});}; \ No newline at end of file +var _0xe5ed=['zone','changed','serverUrl','clientId','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','slice','substring','/oauth/v2/token','lodash','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount'];(function(_0x1bbec1,_0x7e86d3){var _0x10ab97=function(_0xd461ca){while(--_0xd461ca){_0x1bbec1['push'](_0x1bbec1['shift']());}};_0x10ab97(++_0x7e86d3);}(_0xe5ed,0x13d));var _0xde5e=function(_0x29a5de,_0x43db85){_0x29a5de=_0x29a5de-0x0;var _0x15fe2b=_0xe5ed[_0x29a5de];return _0x15fe2b;};'use strict';var _=require(_0xde5e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xde5e('0x1'));var moment=require(_0xde5e('0x2'));var BPromise=require(_0xde5e('0x3'));var rp=require(_0xde5e('0x4'));var fs=require('fs');var path=require(_0xde5e('0x5'));var rimraf=require(_0xde5e('0x6'));var config=require('../../config/environment');var attributes=require(_0xde5e('0x7'));var integrations=require(_0xde5e('0x8'));module['exports']=function(_0x1ab94a,_0x58f431){return _0x1ab94a[_0xde5e('0x9')](_0xde5e('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x8c1d00,_0x302061,_0x28c293){if(_0x8c1d00['changed'](_0xde5e('0xb'))||_0x8c1d00[_0xde5e('0xc')](_0xde5e('0xd'))||_0x8c1d00[_0xde5e('0xc')](_0xde5e('0xe'))||_0x8c1d00['changed']('clientSecret')||_0x8c1d00[_0xde5e('0xc')]('code')||_0x8c1d00[_0xde5e('0xc')]('host')){var _0x31be11,_0x560620;_0x31be11=_0x8c1d00[_0xde5e('0xd')];var _0x170e9b=_0x31be11['slice'](-0x1);if(_0x170e9b==='/'||_0x170e9b==='\x5c'||_0x170e9b===':'){_0x31be11=_0x31be11['substring'](0x0,_0x31be11[_0xde5e('0xf')](_0x170e9b));}switch(_0x8c1d00[_0xde5e('0xb')]){case'US':_0x560620=_0xde5e('0x10');break;case'AU':_0x560620=_0xde5e('0x11');break;case'IN':_0x560620=_0xde5e('0x12');break;case'CN':_0x560620='https://accounts.zoho.com.cn';break;default:_0x560620=_0xde5e('0x13');break;}var _0x3d1828={'method':_0xde5e('0x14'),'uri':_0x560620+'/oauth/v2/token','form':{'grant_type':_0xde5e('0x15'),'client_id':_0x8c1d00[_0xde5e('0xe')],'client_secret':_0x8c1d00[_0xde5e('0x16')],'redirect_uri':_0x8c1d00['serverUrl'],'code':_0x8c1d00[_0xde5e('0x17')]},'headers':{'Content-Type':_0xde5e('0x18')}};return rp(_0x3d1828)[_0xde5e('0x19')](function(_0x25caef){var _0x2de855=JSON[_0xde5e('0x1a')](_0x25caef);if(_0x2de855[_0xde5e('0x1b')]){_0x8c1d00[_0xde5e('0x1c')]=_0x2de855[_0xde5e('0x1b')];logger[_0xde5e('0x1d')](util[_0xde5e('0x1e')](_0xde5e('0x1f'),_0x8c1d00[_0xde5e('0x20')],_0x8c1d00['id']));}else{logger[_0xde5e('0x21')](util[_0xde5e('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x8c1d00[_0xde5e('0x20')],_0x8c1d00['id']),util[_0xde5e('0x22')](_0x2de855,{'showHidden':![],'depth':null}));}return _0x28c293(null,_0x302061);})[_0xde5e('0x23')](function(_0xf96c44){logger['error'](util['format'](_0xde5e('0x24'),_0x8c1d00[_0xde5e('0x20')],_0x8c1d00['id']),util[_0xde5e('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x28c293(_0xf96c44);});}else{return _0x28c293(null,_0x302061);}},'beforeUpdate':function(_0x4159e4,_0x478e66,_0x15393a){if(_0x4159e4[_0xde5e('0xc')](_0xde5e('0xb'))||_0x4159e4['changed']('serverUrl')||_0x4159e4[_0xde5e('0xc')](_0xde5e('0xe'))||_0x4159e4['changed'](_0xde5e('0x16'))||_0x4159e4[_0xde5e('0xc')](_0xde5e('0x17'))||_0x4159e4[_0xde5e('0xc')](_0xde5e('0x25'))){var _0x1709bd,_0x553814;_0x1709bd=_0x4159e4[_0xde5e('0xd')];var _0x4ac4a9=_0x1709bd[_0xde5e('0x26')](-0x1);if(_0x4ac4a9==='/'||_0x4ac4a9==='\x5c'||_0x4ac4a9===':'){_0x1709bd=_0x1709bd[_0xde5e('0x27')](0x0,_0x1709bd[_0xde5e('0xf')](_0x4ac4a9));}switch(_0x4159e4[_0xde5e('0xb')]){case'US':_0x553814=_0xde5e('0x10');break;case'AU':_0x553814=_0xde5e('0x11');break;case'IN':_0x553814=_0xde5e('0x12');break;case'CN':_0x553814='https://accounts.zoho.com.cn';break;default:_0x553814=_0xde5e('0x13');break;}var _0x3bbc06={'method':'POST','uri':_0x553814+_0xde5e('0x28'),'form':{'grant_type':_0xde5e('0x15'),'client_id':_0x4159e4['clientId'],'client_secret':_0x4159e4['clientSecret'],'redirect_uri':_0x4159e4[_0xde5e('0xd')],'code':_0x4159e4[_0xde5e('0x17')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3bbc06)['then'](function(_0x17babc){var _0x2da6ce=JSON['parse'](_0x17babc);if(_0x2da6ce['refresh_token']){_0x4159e4[_0xde5e('0x1c')]=_0x2da6ce['refresh_token'];logger['info'](util[_0xde5e('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4159e4[_0xde5e('0x20')],_0x4159e4['id']));}else{logger[_0xde5e('0x21')](util[_0xde5e('0x1e')](_0xde5e('0x24'),_0x4159e4[_0xde5e('0x20')],_0x4159e4['id']),util[_0xde5e('0x22')](_0x2da6ce,{'showHidden':![],'depth':null}));}return _0x15393a(null,_0x478e66);})[_0xde5e('0x23')](function(_0x298897){logger[_0xde5e('0x21')](util[_0xde5e('0x1e')](_0xde5e('0x24'),_0x4159e4[_0xde5e('0x20')],_0x4159e4['id']),util[_0xde5e('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x15393a(_0x298897);});}else{return _0x15393a(null,_0x478e66);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 9ae3e57..12abd87 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 _0x0075=['ShowZohoAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x0075,0x150));var _0x5007=function(_0x221928,_0x484c9d){_0x221928=_0x221928-0x0;var _0xe9759=_0x0075[_0x221928];return _0xe9759;};'use strict';var _=require(_0x5007('0x0'));var util=require(_0x5007('0x1'));var moment=require(_0x5007('0x2'));var BPromise=require(_0x5007('0x3'));var rs=require(_0x5007('0x4'));var fs=require('fs');var Redis=require(_0x5007('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5007('0x6'));var logger=require(_0x5007('0x7'))(_0x5007('0x8'));var config=require(_0x5007('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5007('0xa')][_0x5007('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x588e9a,_0x2cd2de,_0x8925e8){return new BPromise(function(_0x417532,_0x557859){return client[_0x5007('0xc')](_0x588e9a,_0x8925e8)[_0x5007('0xd')](function(_0x3cf043){logger[_0x5007('0xe')](_0x5007('0xf'),_0x2cd2de,_0x5007('0x10'));logger['debug'](_0x5007('0x11'),_0x2cd2de,'request\x20sent',JSON[_0x5007('0x12')](_0x3cf043));if(_0x3cf043[_0x5007('0x13')]){if(_0x3cf043[_0x5007('0x13')][_0x5007('0x14')]===0x1f4){logger[_0x5007('0x13')](_0x5007('0xf'),_0x2cd2de,_0x3cf043[_0x5007('0x13')][_0x5007('0x15')]);return _0x557859(_0x3cf043[_0x5007('0x13')][_0x5007('0x15')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2cd2de,_0x3cf043[_0x5007('0x13')][_0x5007('0x15')]);return _0x417532(_0x3cf043[_0x5007('0x13')][_0x5007('0x15')]);}else{logger[_0x5007('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x2cd2de,_0x5007('0x10'));_0x417532(_0x3cf043[_0x5007('0x16')]['message']);}})[_0x5007('0x17')](function(_0x5a030d){logger['error'](_0x5007('0xf'),_0x2cd2de,_0x5a030d);_0x557859(_0x5a030d);});});}exports[_0x5007('0x18')]=function(_0x194063){var _0x20a471=this;return new Promise(function(_0x22326d,_0x231b91){return db[_0x5007('0x19')]['findAll']({'raw':_0x194063[_0x5007('0x1a')]?_0x194063[_0x5007('0x1a')][_0x5007('0x1b')]===undefined?!![]:![]:!![],'where':_0x194063['options']?_0x194063['options'][_0x5007('0x1c')]||null:null,'attributes':_0x194063['options']?_0x194063[_0x5007('0x1a')][_0x5007('0x1d')]||null:null,'limit':_0x194063[_0x5007('0x1a')]?_0x194063[_0x5007('0x1a')][_0x5007('0x1e')]||null:null,'include':_0x194063[_0x5007('0x1a')]?_0x194063['options'][_0x5007('0x1f')]?_[_0x5007('0x20')](_0x194063['options']['include'],function(_0x2fe341){return{'model':db[_0x2fe341[_0x5007('0x21')]],'as':_0x2fe341['as'],'attributes':_0x2fe341['attributes'],'include':_0x2fe341[_0x5007('0x1f')]?_['map'](_0x2fe341['include'],function(_0x4f0910){return{'model':db[_0x4f0910['model']],'as':_0x4f0910['as'],'attributes':_0x4f0910[_0x5007('0x1d')],'include':_0x4f0910[_0x5007('0x1f')]?_[_0x5007('0x20')](_0x4f0910[_0x5007('0x1f')],function(_0x5d5bae){return{'model':db[_0x5d5bae[_0x5007('0x21')]],'as':_0x5d5bae['as'],'attributes':_0x5d5bae['attributes']};}):[]};}):[]};}):[]:[]})[_0x5007('0xd')](function(_0x345b80){logger[_0x5007('0xe')](_0x5007('0x18'),_0x194063);logger['debug']('GetZohoAccount',_0x194063,JSON['stringify'](_0x345b80));_0x22326d(_0x345b80);})[_0x5007('0x17')](function(_0x210e1b){logger['error'](_0x5007('0x18'),_0x210e1b['message'],_0x194063);_0x231b91(_0x20a471[_0x5007('0x13')](0x1f4,_0x210e1b[_0x5007('0x15')]));});});};exports[_0x5007('0x22')]=function(_0x383f38){var _0x55fd27=this;return new Promise(function(_0xd970a4,_0x456671){return db[_0x5007('0x19')][_0x5007('0x23')]({'raw':_0x383f38[_0x5007('0x1a')]?_0x383f38[_0x5007('0x1a')][_0x5007('0x1b')]===undefined?!![]:![]:!![],'where':_0x383f38[_0x5007('0x1a')]?_0x383f38[_0x5007('0x1a')][_0x5007('0x1c')]||null:null,'attributes':_0x383f38[_0x5007('0x1a')]?_0x383f38['options'][_0x5007('0x1d')]||null:null,'include':_0x383f38[_0x5007('0x1a')]?_0x383f38[_0x5007('0x1a')][_0x5007('0x1f')]?_['map'](_0x383f38['options'][_0x5007('0x1f')],function(_0x8d2d65){return{'model':db[_0x8d2d65[_0x5007('0x21')]],'as':_0x8d2d65['as'],'attributes':_0x8d2d65['attributes'],'include':_0x8d2d65[_0x5007('0x1f')]?_[_0x5007('0x20')](_0x8d2d65['include'],function(_0x4ce932){return{'model':db[_0x4ce932[_0x5007('0x21')]],'as':_0x4ce932['as'],'attributes':_0x4ce932[_0x5007('0x1d')],'include':_0x4ce932[_0x5007('0x1f')]?_[_0x5007('0x20')](_0x4ce932[_0x5007('0x1f')],function(_0x2b8543){return{'model':db[_0x2b8543[_0x5007('0x21')]],'as':_0x2b8543['as'],'attributes':_0x2b8543[_0x5007('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5007('0xd')](function(_0x11d38a){logger[_0x5007('0xe')](_0x5007('0x22'),_0x383f38);logger[_0x5007('0x24')]('ShowZohoAccount',_0x383f38,JSON['stringify'](_0x11d38a));_0xd970a4(_0x11d38a);})[_0x5007('0x17')](function(_0x585c01){logger[_0x5007('0x13')](_0x5007('0x22'),_0x585c01[_0x5007('0x15')],_0x383f38);_0x456671(_0x55fd27[_0x5007('0x13')](0x1f4,_0x585c01[_0x5007('0x15')]));});});}; \ No newline at end of file +var _0x9769=['options','raw','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ZohoAccount','findAll'];(function(_0x4d6f3e,_0x5b09c0){var _0x3bf30f=function(_0x37230f){while(--_0x37230f){_0x4d6f3e['push'](_0x4d6f3e['shift']());}};_0x3bf30f(++_0x5b09c0);}(_0x9769,0x74));var _0x9976=function(_0x2e0a54,_0x4c6a2f){_0x2e0a54=_0x2e0a54-0x0;var _0xcc1d53=_0x9769[_0x2e0a54];return _0xcc1d53;};'use strict';var _=require('lodash');var util=require(_0x9976('0x0'));var moment=require('moment');var BPromise=require(_0x9976('0x1'));var rs=require(_0x9976('0x2'));var fs=require('fs');var Redis=require(_0x9976('0x3'));var db=require(_0x9976('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9976('0x5'))(_0x9976('0x6'));var config=require('../../config/environment');var jayson=require(_0x9976('0x7'));var client=jayson[_0x9976('0x8')][_0x9976('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc74767,_0xad6425,_0x2b7fdd){return new BPromise(function(_0x19acd9,_0x260fe0){return client[_0x9976('0xa')](_0xc74767,_0x2b7fdd)[_0x9976('0xb')](function(_0x143da5){logger[_0x9976('0xc')](_0x9976('0xd'),_0xad6425,_0x9976('0xe'));logger[_0x9976('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xad6425,'request\x20sent',JSON[_0x9976('0x10')](_0x143da5));if(_0x143da5[_0x9976('0x11')]){if(_0x143da5[_0x9976('0x11')][_0x9976('0x12')]===0x1f4){logger[_0x9976('0x11')](_0x9976('0xd'),_0xad6425,_0x143da5[_0x9976('0x11')][_0x9976('0x13')]);return _0x260fe0(_0x143da5[_0x9976('0x11')]['message']);}logger[_0x9976('0x11')](_0x9976('0xd'),_0xad6425,_0x143da5[_0x9976('0x11')][_0x9976('0x13')]);return _0x19acd9(_0x143da5[_0x9976('0x11')][_0x9976('0x13')]);}else{logger[_0x9976('0xc')](_0x9976('0xd'),_0xad6425,_0x9976('0xe'));_0x19acd9(_0x143da5[_0x9976('0x14')]['message']);}})[_0x9976('0x15')](function(_0x33e59b){logger[_0x9976('0x11')](_0x9976('0xd'),_0xad6425,_0x33e59b);_0x260fe0(_0x33e59b);});});}exports['GetZohoAccount']=function(_0x3bd2cd){var _0x3e7e27=this;return new Promise(function(_0x5dd97a,_0x5d2828){return db[_0x9976('0x16')][_0x9976('0x17')]({'raw':_0x3bd2cd[_0x9976('0x18')]?_0x3bd2cd[_0x9976('0x18')][_0x9976('0x19')]===undefined?!![]:![]:!![],'where':_0x3bd2cd[_0x9976('0x18')]?_0x3bd2cd[_0x9976('0x18')][_0x9976('0x1a')]||null:null,'attributes':_0x3bd2cd[_0x9976('0x18')]?_0x3bd2cd[_0x9976('0x18')][_0x9976('0x1b')]||null:null,'limit':_0x3bd2cd['options']?_0x3bd2cd['options'][_0x9976('0x1c')]||null:null,'include':_0x3bd2cd[_0x9976('0x18')]?_0x3bd2cd[_0x9976('0x18')][_0x9976('0x1d')]?_[_0x9976('0x1e')](_0x3bd2cd[_0x9976('0x18')]['include'],function(_0x13eafc){return{'model':db[_0x13eafc[_0x9976('0x1f')]],'as':_0x13eafc['as'],'attributes':_0x13eafc[_0x9976('0x1b')],'include':_0x13eafc[_0x9976('0x1d')]?_[_0x9976('0x1e')](_0x13eafc[_0x9976('0x1d')],function(_0x2780fb){return{'model':db[_0x2780fb[_0x9976('0x1f')]],'as':_0x2780fb['as'],'attributes':_0x2780fb[_0x9976('0x1b')],'include':_0x2780fb['include']?_[_0x9976('0x1e')](_0x2780fb[_0x9976('0x1d')],function(_0x40e51c){return{'model':db[_0x40e51c[_0x9976('0x1f')]],'as':_0x40e51c['as'],'attributes':_0x40e51c[_0x9976('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9976('0xb')](function(_0x191ef8){logger['info'](_0x9976('0x20'),_0x3bd2cd);logger[_0x9976('0xf')](_0x9976('0x20'),_0x3bd2cd,JSON[_0x9976('0x10')](_0x191ef8));_0x5dd97a(_0x191ef8);})[_0x9976('0x15')](function(_0xf4c672){logger[_0x9976('0x11')](_0x9976('0x20'),_0xf4c672[_0x9976('0x13')],_0x3bd2cd);_0x5d2828(_0x3e7e27['error'](0x1f4,_0xf4c672['message']));});});};exports[_0x9976('0x21')]=function(_0x3f5fea){var _0x332c50=this;return new Promise(function(_0x328009,_0x46d9bf){return db['ZohoAccount'][_0x9976('0x22')]({'raw':_0x3f5fea['options']?_0x3f5fea[_0x9976('0x18')][_0x9976('0x19')]===undefined?!![]:![]:!![],'where':_0x3f5fea[_0x9976('0x18')]?_0x3f5fea[_0x9976('0x18')]['where']||null:null,'attributes':_0x3f5fea[_0x9976('0x18')]?_0x3f5fea[_0x9976('0x18')]['attributes']||null:null,'include':_0x3f5fea['options']?_0x3f5fea[_0x9976('0x18')][_0x9976('0x1d')]?_[_0x9976('0x1e')](_0x3f5fea[_0x9976('0x18')][_0x9976('0x1d')],function(_0x4e1dbd){return{'model':db[_0x4e1dbd[_0x9976('0x1f')]],'as':_0x4e1dbd['as'],'attributes':_0x4e1dbd[_0x9976('0x1b')],'include':_0x4e1dbd[_0x9976('0x1d')]?_[_0x9976('0x1e')](_0x4e1dbd[_0x9976('0x1d')],function(_0x24799c){return{'model':db[_0x24799c[_0x9976('0x1f')]],'as':_0x24799c['as'],'attributes':_0x24799c[_0x9976('0x1b')],'include':_0x24799c[_0x9976('0x1d')]?_[_0x9976('0x1e')](_0x24799c['include'],function(_0x59daf3){return{'model':db[_0x59daf3[_0x9976('0x1f')]],'as':_0x59daf3['as'],'attributes':_0x59daf3[_0x9976('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9976('0xb')](function(_0x4598ab){logger['info']('ShowZohoAccount',_0x3f5fea);logger[_0x9976('0xf')](_0x9976('0x21'),_0x3f5fea,JSON['stringify'](_0x4598ab));_0x328009(_0x4598ab);})[_0x9976('0x15')](function(_0x51a42c){logger[_0x9976('0x11')]('ShowZohoAccount',_0x51a42c['message'],_0x3f5fea);_0x46d9bf(_0x332c50[_0x9976('0x11')](0x1f4,_0x51a42c['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 349b0d8..8dc519d 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 _0x3d15=['getDescriptions','post','create','put','update','delete','/:id','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','index','isAuthenticated','show','getFields','/:id/descriptions'];(function(_0x405891,_0x3d89de){var _0x1cb4a3=function(_0x4cbe13){while(--_0x4cbe13){_0x405891['push'](_0x405891['shift']());}};_0x1cb4a3(++_0x3d89de);}(_0x3d15,0x127));var _0x53d1=function(_0x426711,_0x12264c){_0x426711=_0x426711-0x0;var _0x592991=_0x3d15[_0x426711];return _0x592991;};'use strict';var multer=require('multer');var util=require(_0x53d1('0x0'));var path=require(_0x53d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x53d1('0x2'));var router=express[_0x53d1('0x3')]();var auth=require(_0x53d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53d1('0x5'));var controller=require(_0x53d1('0x6'));router[_0x53d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x53d1('0x8')]);router[_0x53d1('0x7')]('/:id',auth[_0x53d1('0x9')](),controller[_0x53d1('0xa')]);router[_0x53d1('0x7')]('/:id/fields',auth[_0x53d1('0x9')](),controller[_0x53d1('0xb')]);router['get']('/:id/subjects',auth[_0x53d1('0x9')](),controller['getSubjects']);router[_0x53d1('0x7')](_0x53d1('0xc'),auth[_0x53d1('0x9')](),controller[_0x53d1('0xd')]);router[_0x53d1('0xe')]('/',auth[_0x53d1('0x9')](),controller[_0x53d1('0xf')]);router[_0x53d1('0x10')]('/:id',auth[_0x53d1('0x9')](),controller[_0x53d1('0x11')]);router[_0x53d1('0x12')](_0x53d1('0x13'),auth[_0x53d1('0x9')](),controller[_0x53d1('0x14')]);module[_0x53d1('0x15')]=router; \ No newline at end of file +var _0x2868=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2868,0x191));var _0x8286=function(_0xf97ead,_0x9ad3cb){_0xf97ead=_0xf97ead-0x0;var _0x201d3c=_0x2868[_0xf97ead];return _0x201d3c;};'use strict';var multer=require(_0x8286('0x0'));var util=require('util');var path=require(_0x8286('0x1'));var timeout=require(_0x8286('0x2'));var express=require('express');var router=express[_0x8286('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8286('0x4'));var config=require('../../config/environment');var controller=require(_0x8286('0x5'));router[_0x8286('0x6')]('/',auth['isAuthenticated'](),controller[_0x8286('0x7')]);router[_0x8286('0x6')](_0x8286('0x8'),auth[_0x8286('0x9')](),controller['show']);router[_0x8286('0x6')](_0x8286('0xa'),auth[_0x8286('0x9')](),controller[_0x8286('0xb')]);router[_0x8286('0x6')](_0x8286('0xc'),auth[_0x8286('0x9')](),controller['getSubjects']);router[_0x8286('0x6')](_0x8286('0xd'),auth[_0x8286('0x9')](),controller[_0x8286('0xe')]);router[_0x8286('0xf')]('/',auth[_0x8286('0x9')](),controller[_0x8286('0x10')]);router[_0x8286('0x11')](_0x8286('0x8'),auth['isAuthenticated'](),controller[_0x8286('0x12')]);router[_0x8286('0x13')](_0x8286('0x8'),auth[_0x8286('0x9')](),controller[_0x8286('0x14')]);module[_0x8286('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8fe095b..92172c1 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 _0x4c7b=['sequelize','exports','ENUM','lead','contact','nothing','contact_lead','STRING'];(function(_0x442c77,_0x364010){var _0x2ddc1c=function(_0x2d998e){while(--_0x2d998e){_0x442c77['push'](_0x442c77['shift']());}};_0x2ddc1c(++_0x364010);}(_0x4c7b,0x68));var _0xb4c7=function(_0x189562,_0x4e8504){_0x189562=_0x189562-0x0;var _0x1ca12c=_0x4c7b[_0x189562];return _0x1ca12c;};'use strict';var Sequelize=require(_0xb4c7('0x0'));module[_0xb4c7('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xb4c7('0x2')](_0xb4c7('0x3'),_0xb4c7('0x4'),_0xb4c7('0x5')),'defaultValue':_0xb4c7('0x3')},'moduleSearch':{'type':Sequelize[_0xb4c7('0x2')](_0xb4c7('0x6'),_0xb4c7('0x4'),_0xb4c7('0x3')),'defaultValue':_0xb4c7('0x6')},'description':{'type':Sequelize[_0xb4c7('0x7')]}}; \ No newline at end of file +var _0x65e1=['lead','contact','contact_lead','sequelize','ENUM'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x65e1,0xe4));var _0x165e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x65e1[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x165e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x165e('0x1')](_0x165e('0x2'),_0x165e('0x3'),'nothing'),'defaultValue':_0x165e('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x165e('0x3'),_0x165e('0x2')),'defaultValue':_0x165e('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 3d3def6..a320839 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 _0xb7a0=['request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','stack','name','index','map','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','ZohoConfiguration','findAll','rows','show','params','length','includeAll','find','create','body','update','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x533ef3,_0x42fc7c){var _0x25ceac=function(_0x462932){while(--_0x462932){_0x533ef3['push'](_0x533ef3['shift']());}};_0x25ceac(++_0x42fc7c);}(_0xb7a0,0x97));var _0x0b7a=function(_0x20ec4b,_0x4867d8){_0x20ec4b=_0x20ec4b-0x0;var _0x1e15ba=_0xb7a0[_0x20ec4b];return _0x1e15ba;};'use strict';var pdf=require(_0x0b7a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0b7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b7a('0x2'));var rp=require(_0x0b7a('0x3'));var moment=require(_0x0b7a('0x4'));var BPromise=require(_0x0b7a('0x5'));var Mustache=require(_0x0b7a('0x6'));var util=require(_0x0b7a('0x7'));var path=require(_0x0b7a('0x8'));var sox=require(_0x0b7a('0x9'));var csv=require(_0x0b7a('0xa'));var ejs=require(_0x0b7a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0b7a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0b7a('0xd'));var toCsv=require(_0x0b7a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0b7a('0xe'));var authService=require(_0x0b7a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0b7a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0b7a('0x11'));var config=require(_0x0b7a('0x12'));var db=require(_0x0b7a('0x13'))['db'];var jayson=require(_0x0b7a('0x14'));var client=jayson[_0x0b7a('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x179c50,_0x39d646,_0x44b6a2){if(_0x44b6a2){var _0x3beccc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3beccc[_0x0b7a('0x16')](_0x39d646)){return _0x179c50;}else{throw new db[(_0x0b7a('0x17'))][(_0x0b7a('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x179c50;}}function respondWithRpcPromise(_0x1211ea,_0x52eef9,_0x388faf,_0x26f638){return new BPromise(function(_0x4cbf53,_0x456403){var _0x17d4b4=_0x26f638||client;return _0x17d4b4[_0x0b7a('0x19')](_0x1211ea,_0x388faf)[_0x0b7a('0x1a')](function(_0x5e937b){logger[_0x0b7a('0x1b')](_0x0b7a('0x1c'),_0x52eef9,'request\x20sent');logger[_0x0b7a('0x1d')](_0x0b7a('0x1e'),_0x52eef9,_0x0b7a('0x1f'),JSON[_0x0b7a('0x20')](_0x5e937b));if(_0x5e937b[_0x0b7a('0x21')]){if(_0x5e937b['error']['code']===0x1f4){logger[_0x0b7a('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x52eef9,_0x5e937b[_0x0b7a('0x21')][_0x0b7a('0x22')]);return _0x456403(_0x5e937b[_0x0b7a('0x21')][_0x0b7a('0x22')]);}logger[_0x0b7a('0x21')](_0x0b7a('0x1c'),_0x52eef9,_0x5e937b[_0x0b7a('0x21')][_0x0b7a('0x22')]);return _0x4cbf53(_0x5e937b[_0x0b7a('0x21')][_0x0b7a('0x22')]);}else{logger[_0x0b7a('0x1b')](_0x0b7a('0x1c'),_0x52eef9,'request\x20sent');_0x4cbf53(_0x5e937b[_0x0b7a('0x23')][_0x0b7a('0x22')]);}})[_0x0b7a('0x24')](function(_0x50603f){logger[_0x0b7a('0x21')](_0x0b7a('0x1c'),_0x52eef9,_0x50603f);_0x456403(_0x50603f);});});}function respondWithStatusCode(_0x16028c,_0x5f2c20){_0x5f2c20=_0x5f2c20||0xcc;return function(_0x1a6014){if(_0x1a6014){return _0x16028c[_0x0b7a('0x25')](_0x5f2c20);}return _0x16028c[_0x0b7a('0x26')](_0x5f2c20)['end']();};}function respondWithResult(_0x593282,_0x2a2f25){_0x2a2f25=_0x2a2f25||0xc8;return function(_0x46d85a){if(_0x46d85a){return _0x593282['status'](_0x2a2f25)[_0x0b7a('0x27')](_0x46d85a);}};}function respondWithFilteredResult(_0x15ee54,_0x39e0f9){return function(_0xf980bf){if(_0xf980bf){var _0x4facfc=_0xf980bf[_0x0b7a('0x28')],_0x36e8a4=_0x39e0f9[_0x0b7a('0x29')],_0x255bb0=_0x39e0f9[_0x0b7a('0x29')]+_0x39e0f9[_0x0b7a('0x2a')],_0x88f324;if(_0x255bb0>=_0x4facfc){_0x255bb0=_0x4facfc;_0x88f324=0xc8;}else{_0x88f324=0xce;}_0x15ee54[_0x0b7a('0x26')](_0x88f324);return _0x15ee54[_0x0b7a('0x2b')](_0x0b7a('0x2c'),_0x36e8a4+'-'+_0x255bb0+'/'+_0x4facfc)['json'](_0xf980bf);}return null;};}function patchUpdates(_0x487327){return function(_0x12d588){try{jsonpatch[_0x0b7a('0x2d')](_0x12d588,_0x487327,!![]);}catch(_0x139dbc){return BPromise[_0x0b7a('0x2e')](_0x139dbc);}return _0x12d588[_0x0b7a('0x2f')]();};}function saveUpdates(_0x44c4da,_0x31d5de){return function(_0x48c2fa){if(_0x48c2fa){return _0x48c2fa['update'](_0x44c4da)[_0x0b7a('0x1a')](function(_0x226dab){return _0x226dab;});}return null;};}function removeEntity(_0x42fda2,_0x5748ae){return function(_0x5ec50d){if(_0x5ec50d){return _0x5ec50d[_0x0b7a('0x30')]()[_0x0b7a('0x1a')](function(){_0x42fda2[_0x0b7a('0x26')](0xcc)[_0x0b7a('0x31')]();});}};}function handleEntityNotFound(_0x306016,_0xf201e5){return function(_0x3ef6a3){if(!_0x3ef6a3){_0x306016['sendStatus'](0x194);}return _0x3ef6a3;};}function handleError(_0x397e01,_0x328424){_0x328424=_0x328424||0x1f4;return function(_0x1c14bb){logger[_0x0b7a('0x21')](_0x1c14bb[_0x0b7a('0x32')]);if(_0x1c14bb[_0x0b7a('0x33')]){delete _0x1c14bb[_0x0b7a('0x33')];}_0x397e01[_0x0b7a('0x26')](_0x328424)['send'](_0x1c14bb);};}exports[_0x0b7a('0x34')]=function(_0x3e0e9e,_0x7c8ae3){var _0x54e81b={},_0x2ab9bf={},_0x5dfa20={'count':0x0,'rows':[]};var _0x414f11=_[_0x0b7a('0x35')](db['ZohoConfiguration'][_0x0b7a('0x36')],function(_0x5af96b){return{'name':_0x5af96b['fieldName'],'type':_0x5af96b['type'][_0x0b7a('0x37')]};});_0x2ab9bf[_0x0b7a('0x38')]=_[_0x0b7a('0x35')](_0x414f11,'name');_0x2ab9bf['query']=_[_0x0b7a('0x39')](_0x3e0e9e[_0x0b7a('0x3a')]);_0x2ab9bf[_0x0b7a('0x3b')]=_[_0x0b7a('0x3c')](_0x2ab9bf[_0x0b7a('0x38')],_0x2ab9bf[_0x0b7a('0x3a')]);_0x54e81b['attributes']=_['intersection'](_0x2ab9bf[_0x0b7a('0x38')],qs['fields'](_0x3e0e9e['query'][_0x0b7a('0x3d')]));_0x54e81b['attributes']=_0x54e81b[_0x0b7a('0x3e')]['length']?_0x54e81b[_0x0b7a('0x3e')]:_0x2ab9bf[_0x0b7a('0x38')];if(!_0x3e0e9e[_0x0b7a('0x3a')]['hasOwnProperty'](_0x0b7a('0x3f'))){_0x54e81b[_0x0b7a('0x2a')]=qs[_0x0b7a('0x2a')](_0x3e0e9e['query'][_0x0b7a('0x2a')]);_0x54e81b[_0x0b7a('0x29')]=qs[_0x0b7a('0x29')](_0x3e0e9e[_0x0b7a('0x3a')][_0x0b7a('0x29')]);}_0x54e81b[_0x0b7a('0x40')]=qs[_0x0b7a('0x41')](_0x3e0e9e[_0x0b7a('0x3a')][_0x0b7a('0x41')]);_0x54e81b[_0x0b7a('0x42')]=qs[_0x0b7a('0x3b')](_[_0x0b7a('0x43')](_0x3e0e9e[_0x0b7a('0x3a')],_0x2ab9bf[_0x0b7a('0x3b')]),_0x414f11);if(_0x3e0e9e[_0x0b7a('0x3a')][_0x0b7a('0x44')]){_0x54e81b[_0x0b7a('0x42')]=_[_0x0b7a('0x45')](_0x54e81b[_0x0b7a('0x42')],{'$or':_[_0x0b7a('0x35')](_0x414f11,function(_0x855c09){if(_0x855c09[_0x0b7a('0x46')]!==_0x0b7a('0x47')){var _0x207b3d={};_0x207b3d[_0x855c09['name']]={'$like':'%'+_0x3e0e9e[_0x0b7a('0x3a')][_0x0b7a('0x44')]+'%'};return _0x207b3d;}})});}_0x54e81b=_['merge']({},_0x54e81b,_0x3e0e9e[_0x0b7a('0x48')]);var _0x3a86c6={'where':_0x54e81b[_0x0b7a('0x42')]};return db['ZohoConfiguration'][_0x0b7a('0x28')](_0x3a86c6)[_0x0b7a('0x1a')](function(_0xabb50b){_0x5dfa20[_0x0b7a('0x28')]=_0xabb50b;if(_0x3e0e9e[_0x0b7a('0x3a')]['includeAll']){_0x54e81b[_0x0b7a('0x49')]=[{'all':!![]}];}return db[_0x0b7a('0x4a')][_0x0b7a('0x4b')](_0x54e81b);})['then'](function(_0x22c4be){_0x5dfa20[_0x0b7a('0x4c')]=_0x22c4be;return _0x5dfa20;})['then'](respondWithFilteredResult(_0x7c8ae3,_0x54e81b))[_0x0b7a('0x24')](handleError(_0x7c8ae3,null));};exports[_0x0b7a('0x4d')]=function(_0x5e1252,_0xe18c6b){var _0x3031c9={'raw':![],'where':{'id':_0x5e1252[_0x0b7a('0x4e')]['id']}},_0x1f3a8e={};_0x1f3a8e[_0x0b7a('0x38')]=_[_0x0b7a('0x39')](db[_0x0b7a('0x4a')][_0x0b7a('0x36')]);_0x1f3a8e[_0x0b7a('0x3a')]=_[_0x0b7a('0x39')](_0x5e1252[_0x0b7a('0x3a')]);_0x1f3a8e['filters']=_[_0x0b7a('0x3c')](_0x1f3a8e[_0x0b7a('0x38')],_0x1f3a8e[_0x0b7a('0x3a')]);_0x3031c9[_0x0b7a('0x3e')]=_['intersection'](_0x1f3a8e[_0x0b7a('0x38')],qs[_0x0b7a('0x3d')](_0x5e1252[_0x0b7a('0x3a')][_0x0b7a('0x3d')]));_0x3031c9['attributes']=_0x3031c9[_0x0b7a('0x3e')][_0x0b7a('0x4f')]?_0x3031c9[_0x0b7a('0x3e')]:_0x1f3a8e['model'];if(_0x5e1252[_0x0b7a('0x3a')][_0x0b7a('0x50')]){_0x3031c9['include']=[{'all':!![]}];}_0x3031c9=_[_0x0b7a('0x45')]({},_0x3031c9,_0x5e1252[_0x0b7a('0x48')]);return db[_0x0b7a('0x4a')][_0x0b7a('0x51')](_0x3031c9)[_0x0b7a('0x1a')](handleEntityNotFound(_0xe18c6b,null))[_0x0b7a('0x1a')](respondWithResult(_0xe18c6b,null))['catch'](handleError(_0xe18c6b,null));};exports[_0x0b7a('0x52')]=function(_0x315f8f,_0x405e14){return db[_0x0b7a('0x4a')]['create'](_0x315f8f[_0x0b7a('0x53')],{})[_0x0b7a('0x1a')](respondWithResult(_0x405e14,0xc9))['catch'](handleError(_0x405e14,null));};exports[_0x0b7a('0x54')]=function(_0xaf94d0,_0x4f4d43){if(_0xaf94d0[_0x0b7a('0x53')]['id']){delete _0xaf94d0[_0x0b7a('0x53')]['id'];}return db[_0x0b7a('0x4a')]['find']({'where':{'id':_0xaf94d0[_0x0b7a('0x4e')]['id']}})[_0x0b7a('0x1a')](handleEntityNotFound(_0x4f4d43,null))['then'](saveUpdates(_0xaf94d0[_0x0b7a('0x53')],null))[_0x0b7a('0x1a')](respondWithResult(_0x4f4d43,null))[_0x0b7a('0x24')](handleError(_0x4f4d43,null));};exports['destroy']=function(_0x22eba5,_0x2994de){return db[_0x0b7a('0x4a')][_0x0b7a('0x51')]({'where':{'id':_0x22eba5[_0x0b7a('0x4e')]['id']}})[_0x0b7a('0x1a')](handleEntityNotFound(_0x2994de,null))[_0x0b7a('0x1a')](removeEntity(_0x2994de,null))['catch'](handleError(_0x2994de,null));};exports[_0x0b7a('0x55')]=function(_0x16383d,_0x368a5e,_0x44cfe8){var _0x21590d={};var _0x1fa9e4={};var _0x2a3b74;var _0x47f571;return db[_0x0b7a('0x4a')][_0x0b7a('0x56')]({'where':{'id':_0x16383d[_0x0b7a('0x4e')]['id']}})[_0x0b7a('0x1a')](handleEntityNotFound(_0x368a5e,null))[_0x0b7a('0x1a')](function(_0x2ff6f8){if(_0x2ff6f8){_0x2a3b74=_0x2ff6f8;_0x1fa9e4[_0x0b7a('0x38')]=_['keys'](db[_0x0b7a('0x57')][_0x0b7a('0x36')]);_0x1fa9e4['query']=_[_0x0b7a('0x39')](_0x16383d[_0x0b7a('0x3a')]);_0x1fa9e4[_0x0b7a('0x3b')]=_[_0x0b7a('0x3c')](_0x1fa9e4[_0x0b7a('0x38')],_0x1fa9e4[_0x0b7a('0x3a')]);_0x21590d[_0x0b7a('0x3e')]=_[_0x0b7a('0x3c')](_0x1fa9e4[_0x0b7a('0x38')],qs[_0x0b7a('0x3d')](_0x16383d[_0x0b7a('0x3a')][_0x0b7a('0x3d')]));_0x21590d[_0x0b7a('0x3e')]=_0x21590d[_0x0b7a('0x3e')][_0x0b7a('0x4f')]?_0x21590d['attributes']:_0x1fa9e4[_0x0b7a('0x38')];_0x21590d[_0x0b7a('0x40')]=qs[_0x0b7a('0x41')](_0x16383d['query'][_0x0b7a('0x41')]);_0x21590d[_0x0b7a('0x42')]=qs[_0x0b7a('0x3b')](_[_0x0b7a('0x43')](_0x16383d[_0x0b7a('0x3a')],_0x1fa9e4['filters']));if(_0x16383d[_0x0b7a('0x3a')][_0x0b7a('0x44')]){_0x21590d['where']=_['merge'](_0x21590d[_0x0b7a('0x42')],{'$or':_[_0x0b7a('0x35')](_0x21590d[_0x0b7a('0x3e')],function(_0x31ed82){var _0x5cb210={};_0x5cb210[_0x31ed82]={'$like':'%'+_0x16383d['query']['filter']+'%'};return _0x5cb210;})});}_0x21590d=_[_0x0b7a('0x45')]({},_0x21590d,_0x16383d['options']);return _0x2a3b74[_0x0b7a('0x55')](_0x21590d);}})[_0x0b7a('0x1a')](function(_0x224232){if(_0x224232){_0x47f571=_0x224232[_0x0b7a('0x4f')];if(!_0x16383d[_0x0b7a('0x3a')][_0x0b7a('0x58')](_0x0b7a('0x3f'))){_0x21590d[_0x0b7a('0x2a')]=qs['limit'](_0x16383d[_0x0b7a('0x3a')][_0x0b7a('0x2a')]);_0x21590d[_0x0b7a('0x29')]=qs['offset'](_0x16383d[_0x0b7a('0x3a')][_0x0b7a('0x29')]);}return _0x2a3b74['getFields'](_0x21590d);}})['then'](function(_0x6f00b9){if(_0x6f00b9){return _0x6f00b9?{'count':_0x47f571,'rows':_0x6f00b9}:null;}})['then'](respondWithResult(_0x368a5e,null))[_0x0b7a('0x24')](handleError(_0x368a5e,null));};exports[_0x0b7a('0x59')]=function(_0x3e8aec,_0x238f70,_0x19c54f){var _0x23e974={};var _0x1e5ab3={};var _0xbfd655;var _0x52d95c;return db[_0x0b7a('0x4a')][_0x0b7a('0x56')]({'where':{'id':_0x3e8aec[_0x0b7a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x238f70,null))[_0x0b7a('0x1a')](function(_0x156f9c){if(_0x156f9c){_0xbfd655=_0x156f9c;_0x1e5ab3[_0x0b7a('0x38')]=_[_0x0b7a('0x39')](db[_0x0b7a('0x57')]['rawAttributes']);_0x1e5ab3['query']=_[_0x0b7a('0x39')](_0x3e8aec[_0x0b7a('0x3a')]);_0x1e5ab3['filters']=_[_0x0b7a('0x3c')](_0x1e5ab3[_0x0b7a('0x38')],_0x1e5ab3[_0x0b7a('0x3a')]);_0x23e974[_0x0b7a('0x3e')]=_['intersection'](_0x1e5ab3[_0x0b7a('0x38')],qs[_0x0b7a('0x3d')](_0x3e8aec['query']['fields']));_0x23e974[_0x0b7a('0x3e')]=_0x23e974[_0x0b7a('0x3e')][_0x0b7a('0x4f')]?_0x23e974['attributes']:_0x1e5ab3[_0x0b7a('0x38')];_0x23e974['order']=qs['sort'](_0x3e8aec['query']['sort']);_0x23e974[_0x0b7a('0x42')]=qs['filters'](_[_0x0b7a('0x43')](_0x3e8aec['query'],_0x1e5ab3[_0x0b7a('0x3b')]));if(_0x3e8aec['query'][_0x0b7a('0x44')]){_0x23e974[_0x0b7a('0x42')]=_['merge'](_0x23e974[_0x0b7a('0x42')],{'$or':_[_0x0b7a('0x35')](_0x23e974[_0x0b7a('0x3e')],function(_0x4504f3){var _0x54e791={};_0x54e791[_0x4504f3]={'$like':'%'+_0x3e8aec[_0x0b7a('0x3a')][_0x0b7a('0x44')]+'%'};return _0x54e791;})});}_0x23e974=_[_0x0b7a('0x45')]({},_0x23e974,_0x3e8aec[_0x0b7a('0x48')]);return _0xbfd655[_0x0b7a('0x59')](_0x23e974);}})[_0x0b7a('0x1a')](function(_0x35779a){if(_0x35779a){_0x52d95c=_0x35779a[_0x0b7a('0x4f')];if(!_0x3e8aec[_0x0b7a('0x3a')][_0x0b7a('0x58')](_0x0b7a('0x3f'))){_0x23e974['limit']=qs[_0x0b7a('0x2a')](_0x3e8aec[_0x0b7a('0x3a')][_0x0b7a('0x2a')]);_0x23e974['offset']=qs['offset'](_0x3e8aec[_0x0b7a('0x3a')]['offset']);}return _0xbfd655[_0x0b7a('0x59')](_0x23e974);}})[_0x0b7a('0x1a')](function(_0x505429){if(_0x505429){return _0x505429?{'count':_0x52d95c,'rows':_0x505429}:null;}})[_0x0b7a('0x1a')](respondWithResult(_0x238f70,null))[_0x0b7a('0x24')](handleError(_0x238f70,null));};exports[_0x0b7a('0x5a')]=function(_0x33a739,_0x170b08,_0x982dc4){var _0x3ccba6={};var _0xa68283={};var _0x2bce55;var _0xcb784f;return db['ZohoConfiguration'][_0x0b7a('0x56')]({'where':{'id':_0x33a739[_0x0b7a('0x4e')]['id']}})[_0x0b7a('0x1a')](handleEntityNotFound(_0x170b08,null))[_0x0b7a('0x1a')](function(_0x13482d){if(_0x13482d){_0x2bce55=_0x13482d;_0xa68283[_0x0b7a('0x38')]=_[_0x0b7a('0x39')](db[_0x0b7a('0x57')][_0x0b7a('0x36')]);_0xa68283[_0x0b7a('0x3a')]=_[_0x0b7a('0x39')](_0x33a739[_0x0b7a('0x3a')]);_0xa68283[_0x0b7a('0x3b')]=_['intersection'](_0xa68283[_0x0b7a('0x38')],_0xa68283['query']);_0x3ccba6[_0x0b7a('0x3e')]=_[_0x0b7a('0x3c')](_0xa68283[_0x0b7a('0x38')],qs[_0x0b7a('0x3d')](_0x33a739[_0x0b7a('0x3a')][_0x0b7a('0x3d')]));_0x3ccba6[_0x0b7a('0x3e')]=_0x3ccba6[_0x0b7a('0x3e')]['length']?_0x3ccba6[_0x0b7a('0x3e')]:_0xa68283[_0x0b7a('0x38')];_0x3ccba6[_0x0b7a('0x40')]=qs[_0x0b7a('0x41')](_0x33a739['query'][_0x0b7a('0x41')]);_0x3ccba6[_0x0b7a('0x42')]=qs[_0x0b7a('0x3b')](_['pick'](_0x33a739[_0x0b7a('0x3a')],_0xa68283[_0x0b7a('0x3b')]));if(_0x33a739['query'][_0x0b7a('0x44')]){_0x3ccba6[_0x0b7a('0x42')]=_['merge'](_0x3ccba6['where'],{'$or':_[_0x0b7a('0x35')](_0x3ccba6['attributes'],function(_0x10282c){var _0x105f4d={};_0x105f4d[_0x10282c]={'$like':'%'+_0x33a739[_0x0b7a('0x3a')][_0x0b7a('0x44')]+'%'};return _0x105f4d;})});}_0x3ccba6=_[_0x0b7a('0x45')]({},_0x3ccba6,_0x33a739['options']);return _0x2bce55[_0x0b7a('0x5a')](_0x3ccba6);}})[_0x0b7a('0x1a')](function(_0x370491){if(_0x370491){_0xcb784f=_0x370491['length'];if(!_0x33a739['query'][_0x0b7a('0x58')](_0x0b7a('0x3f'))){_0x3ccba6[_0x0b7a('0x2a')]=qs[_0x0b7a('0x2a')](_0x33a739[_0x0b7a('0x3a')]['limit']);_0x3ccba6[_0x0b7a('0x29')]=qs[_0x0b7a('0x29')](_0x33a739[_0x0b7a('0x3a')][_0x0b7a('0x29')]);}return _0x2bce55['getDescriptions'](_0x3ccba6);}})[_0x0b7a('0x1a')](function(_0x1a15a3){if(_0x1a15a3){return _0x1a15a3?{'count':_0xcb784f,'rows':_0x1a15a3}:null;}})[_0x0b7a('0x1a')](respondWithResult(_0x170b08,null))[_0x0b7a('0x24')](handleError(_0x170b08,null));}; \ No newline at end of file +var _0xbc2d=['api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','destroy','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','rows','show','params','keys','length','include','find','create','body','ZohoField','hasOwnProperty','getFields','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4d1645,_0x5bd694){var _0x53b408=function(_0x25d06b){while(--_0x25d06b){_0x4d1645['push'](_0x4d1645['shift']());}};_0x53b408(++_0x5bd694);}(_0xbc2d,0xa3));var _0xdbc2=function(_0x27146c,_0x1c0ccd){_0x27146c=_0x27146c-0x0;var _0x1adf55=_0xbc2d[_0x27146c];return _0x1adf55;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdbc2('0x0'));var rimraf=require(_0xdbc2('0x1'));var zipdir=require(_0xdbc2('0x2'));var jsonpatch=require(_0xdbc2('0x3'));var rp=require(_0xdbc2('0x4'));var moment=require(_0xdbc2('0x5'));var BPromise=require(_0xdbc2('0x6'));var Mustache=require('mustache');var util=require(_0xdbc2('0x7'));var path=require(_0xdbc2('0x8'));var sox=require(_0xdbc2('0x9'));var csv=require('to-csv');var ejs=require(_0xdbc2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdbc2('0xb'));var crypto=require('crypto');var jsforce=require(_0xdbc2('0xc'));var deskjs=require(_0xdbc2('0xd'));var toCsv=require(_0xdbc2('0xe'));var querystring=require('querystring');var Papa=require(_0xdbc2('0xf'));var Redis=require(_0xdbc2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdbc2('0x11'));var as=require(_0xdbc2('0x12'));var hardwareService=require(_0xdbc2('0x13'));var logger=require(_0xdbc2('0x14'))(_0xdbc2('0x15'));var utils=require(_0xdbc2('0x16'));var config=require(_0xdbc2('0x17'));var db=require(_0xdbc2('0x18'))['db'];var jayson=require(_0xdbc2('0x19'));var client=jayson[_0xdbc2('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x19f5c5,_0x5c2eb9,_0x28c4a3){if(_0x28c4a3){var _0x4b29cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b29cc[_0xdbc2('0x1b')](_0x5c2eb9)){return _0x19f5c5;}else{throw new db[(_0xdbc2('0x1c'))][(_0xdbc2('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x19f5c5;}}function respondWithRpcPromise(_0x34dc38,_0x3c1c0a,_0xa71c93,_0x3b5805){return new BPromise(function(_0x2eb86f,_0xe26607){var _0x165c8d=_0x3b5805||client;return _0x165c8d[_0xdbc2('0x1e')](_0x34dc38,_0xa71c93)[_0xdbc2('0x1f')](function(_0x55a5aa){logger[_0xdbc2('0x20')](_0xdbc2('0x21'),_0x3c1c0a,_0xdbc2('0x22'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3c1c0a,_0xdbc2('0x22'),JSON['stringify'](_0x55a5aa));if(_0x55a5aa[_0xdbc2('0x23')]){if(_0x55a5aa[_0xdbc2('0x23')][_0xdbc2('0x24')]===0x1f4){logger['error'](_0xdbc2('0x21'),_0x3c1c0a,_0x55a5aa['error'][_0xdbc2('0x25')]);return _0xe26607(_0x55a5aa[_0xdbc2('0x23')][_0xdbc2('0x25')]);}logger[_0xdbc2('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x3c1c0a,_0x55a5aa['error'][_0xdbc2('0x25')]);return _0x2eb86f(_0x55a5aa['error'][_0xdbc2('0x25')]);}else{logger['info'](_0xdbc2('0x21'),_0x3c1c0a,_0xdbc2('0x22'));_0x2eb86f(_0x55a5aa[_0xdbc2('0x26')]['message']);}})[_0xdbc2('0x27')](function(_0xa3940c){logger[_0xdbc2('0x23')](_0xdbc2('0x21'),_0x3c1c0a,_0xa3940c);_0xe26607(_0xa3940c);});});}function respondWithStatusCode(_0x3016cf,_0x3c412a){_0x3c412a=_0x3c412a||0xcc;return function(_0x3eca1a){if(_0x3eca1a){return _0x3016cf[_0xdbc2('0x28')](_0x3c412a);}return _0x3016cf[_0xdbc2('0x29')](_0x3c412a)[_0xdbc2('0x2a')]();};}function respondWithResult(_0x25d162,_0x388613){_0x388613=_0x388613||0xc8;return function(_0x301f90){if(_0x301f90){return _0x25d162[_0xdbc2('0x29')](_0x388613)['json'](_0x301f90);}};}function respondWithFilteredResult(_0x5c5193,_0x364d05){return function(_0x134e01){if(_0x134e01){var _0x91b953=_0x134e01[_0xdbc2('0x2b')],_0x38ebf5=_0x364d05[_0xdbc2('0x2c')],_0x4790bd=_0x364d05[_0xdbc2('0x2c')]+_0x364d05[_0xdbc2('0x2d')],_0x2f441f;if(_0x4790bd>=_0x91b953){_0x4790bd=_0x91b953;_0x2f441f=0xc8;}else{_0x2f441f=0xce;}_0x5c5193[_0xdbc2('0x29')](_0x2f441f);return _0x5c5193['set'](_0xdbc2('0x2e'),_0x38ebf5+'-'+_0x4790bd+'/'+_0x91b953)[_0xdbc2('0x2f')](_0x134e01);}return null;};}function patchUpdates(_0x4b22b0){return function(_0x35b796){try{jsonpatch[_0xdbc2('0x30')](_0x35b796,_0x4b22b0,!![]);}catch(_0x5472d4){return BPromise[_0xdbc2('0x31')](_0x5472d4);}return _0x35b796['save']();};}function saveUpdates(_0x2774b4,_0x21f020){return function(_0x2e35b8){if(_0x2e35b8){return _0x2e35b8[_0xdbc2('0x32')](_0x2774b4)[_0xdbc2('0x1f')](function(_0x5c9921){return _0x5c9921;});}return null;};}function removeEntity(_0x144d0a,_0x3b495a){return function(_0xa885ba){if(_0xa885ba){return _0xa885ba[_0xdbc2('0x33')]()['then'](function(){_0x144d0a['status'](0xcc)[_0xdbc2('0x2a')]();});}};}function handleEntityNotFound(_0x23ff56,_0x58e51b){return function(_0x530527){if(!_0x530527){_0x23ff56['sendStatus'](0x194);}return _0x530527;};}function handleError(_0x1ca128,_0x43b56){_0x43b56=_0x43b56||0x1f4;return function(_0x5716fc){logger[_0xdbc2('0x23')](_0x5716fc['stack']);if(_0x5716fc[_0xdbc2('0x34')]){delete _0x5716fc[_0xdbc2('0x34')];}_0x1ca128['status'](_0x43b56)[_0xdbc2('0x35')](_0x5716fc);};}exports[_0xdbc2('0x36')]=function(_0x15ae84,_0x3a2313){var _0x1bdef0={},_0x14a02d={},_0x489801={'count':0x0,'rows':[]};var _0x32cac3=_[_0xdbc2('0x37')](db[_0xdbc2('0x38')][_0xdbc2('0x39')],function(_0x2d2f14){return{'name':_0x2d2f14[_0xdbc2('0x3a')],'type':_0x2d2f14['type'][_0xdbc2('0x3b')]};});_0x14a02d['model']=_[_0xdbc2('0x37')](_0x32cac3,_0xdbc2('0x34'));_0x14a02d[_0xdbc2('0x3c')]=_['keys'](_0x15ae84[_0xdbc2('0x3c')]);_0x14a02d[_0xdbc2('0x3d')]=_[_0xdbc2('0x3e')](_0x14a02d[_0xdbc2('0x3f')],_0x14a02d['query']);_0x1bdef0[_0xdbc2('0x40')]=_[_0xdbc2('0x3e')](_0x14a02d[_0xdbc2('0x3f')],qs[_0xdbc2('0x41')](_0x15ae84[_0xdbc2('0x3c')][_0xdbc2('0x41')]));_0x1bdef0[_0xdbc2('0x40')]=_0x1bdef0[_0xdbc2('0x40')]['length']?_0x1bdef0[_0xdbc2('0x40')]:_0x14a02d[_0xdbc2('0x3f')];if(!_0x15ae84['query']['hasOwnProperty'](_0xdbc2('0x42'))){_0x1bdef0[_0xdbc2('0x2d')]=qs[_0xdbc2('0x2d')](_0x15ae84[_0xdbc2('0x3c')][_0xdbc2('0x2d')]);_0x1bdef0[_0xdbc2('0x2c')]=qs[_0xdbc2('0x2c')](_0x15ae84['query'][_0xdbc2('0x2c')]);}_0x1bdef0[_0xdbc2('0x43')]=qs[_0xdbc2('0x44')](_0x15ae84[_0xdbc2('0x3c')][_0xdbc2('0x44')]);_0x1bdef0['where']=qs['filters'](_[_0xdbc2('0x45')](_0x15ae84['query'],_0x14a02d['filters']),_0x32cac3);if(_0x15ae84['query'][_0xdbc2('0x46')]){_0x1bdef0[_0xdbc2('0x47')]=_[_0xdbc2('0x48')](_0x1bdef0[_0xdbc2('0x47')],{'$or':_[_0xdbc2('0x37')](_0x32cac3,function(_0x277782){if(_0x277782[_0xdbc2('0x49')]!==_0xdbc2('0x4a')){var _0x4494fe={};_0x4494fe[_0x277782[_0xdbc2('0x34')]]={'$like':'%'+_0x15ae84[_0xdbc2('0x3c')]['filter']+'%'};return _0x4494fe;}})});}_0x1bdef0=_[_0xdbc2('0x48')]({},_0x1bdef0,_0x15ae84[_0xdbc2('0x4b')]);var _0x5901f8={'where':_0x1bdef0[_0xdbc2('0x47')]};return db['ZohoConfiguration'][_0xdbc2('0x2b')](_0x5901f8)[_0xdbc2('0x1f')](function(_0x47608c){_0x489801[_0xdbc2('0x2b')]=_0x47608c;if(_0x15ae84[_0xdbc2('0x3c')][_0xdbc2('0x4c')]){_0x1bdef0['include']=[{'all':!![]}];}return db[_0xdbc2('0x38')]['findAll'](_0x1bdef0);})[_0xdbc2('0x1f')](function(_0x42df81){_0x489801[_0xdbc2('0x4d')]=_0x42df81;return _0x489801;})['then'](respondWithFilteredResult(_0x3a2313,_0x1bdef0))[_0xdbc2('0x27')](handleError(_0x3a2313,null));};exports[_0xdbc2('0x4e')]=function(_0xe3d359,_0x7ca3ec){var _0x4381f6={'raw':![],'where':{'id':_0xe3d359[_0xdbc2('0x4f')]['id']}},_0x6b3e4f={};_0x6b3e4f[_0xdbc2('0x3f')]=_[_0xdbc2('0x50')](db[_0xdbc2('0x38')][_0xdbc2('0x39')]);_0x6b3e4f[_0xdbc2('0x3c')]=_[_0xdbc2('0x50')](_0xe3d359[_0xdbc2('0x3c')]);_0x6b3e4f[_0xdbc2('0x3d')]=_[_0xdbc2('0x3e')](_0x6b3e4f['model'],_0x6b3e4f[_0xdbc2('0x3c')]);_0x4381f6[_0xdbc2('0x40')]=_[_0xdbc2('0x3e')](_0x6b3e4f[_0xdbc2('0x3f')],qs['fields'](_0xe3d359[_0xdbc2('0x3c')]['fields']));_0x4381f6[_0xdbc2('0x40')]=_0x4381f6[_0xdbc2('0x40')][_0xdbc2('0x51')]?_0x4381f6[_0xdbc2('0x40')]:_0x6b3e4f['model'];if(_0xe3d359[_0xdbc2('0x3c')][_0xdbc2('0x4c')]){_0x4381f6[_0xdbc2('0x52')]=[{'all':!![]}];}_0x4381f6=_['merge']({},_0x4381f6,_0xe3d359[_0xdbc2('0x4b')]);return db[_0xdbc2('0x38')][_0xdbc2('0x53')](_0x4381f6)[_0xdbc2('0x1f')](handleEntityNotFound(_0x7ca3ec,null))[_0xdbc2('0x1f')](respondWithResult(_0x7ca3ec,null))[_0xdbc2('0x27')](handleError(_0x7ca3ec,null));};exports[_0xdbc2('0x54')]=function(_0x21d1ed,_0x18daa1){return db[_0xdbc2('0x38')][_0xdbc2('0x54')](_0x21d1ed[_0xdbc2('0x55')],{})['then'](respondWithResult(_0x18daa1,0xc9))[_0xdbc2('0x27')](handleError(_0x18daa1,null));};exports['update']=function(_0x633c44,_0x5ee8c2){if(_0x633c44[_0xdbc2('0x55')]['id']){delete _0x633c44['body']['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x633c44[_0xdbc2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5ee8c2,null))[_0xdbc2('0x1f')](saveUpdates(_0x633c44[_0xdbc2('0x55')],null))[_0xdbc2('0x1f')](respondWithResult(_0x5ee8c2,null))[_0xdbc2('0x27')](handleError(_0x5ee8c2,null));};exports[_0xdbc2('0x33')]=function(_0x27b1bb,_0x51bd19){return db['ZohoConfiguration']['find']({'where':{'id':_0x27b1bb['params']['id']}})[_0xdbc2('0x1f')](handleEntityNotFound(_0x51bd19,null))[_0xdbc2('0x1f')](removeEntity(_0x51bd19,null))[_0xdbc2('0x27')](handleError(_0x51bd19,null));};exports['getFields']=function(_0x1ccdf0,_0x53422d,_0x408893){var _0x5d65cc={};var _0x48d9c0={};var _0x2ad207;var _0x7216bf;return db[_0xdbc2('0x38')]['findOne']({'where':{'id':_0x1ccdf0[_0xdbc2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x53422d,null))['then'](function(_0x33d2a4){if(_0x33d2a4){_0x2ad207=_0x33d2a4;_0x48d9c0['model']=_[_0xdbc2('0x50')](db[_0xdbc2('0x56')][_0xdbc2('0x39')]);_0x48d9c0['query']=_['keys'](_0x1ccdf0[_0xdbc2('0x3c')]);_0x48d9c0['filters']=_[_0xdbc2('0x3e')](_0x48d9c0['model'],_0x48d9c0[_0xdbc2('0x3c')]);_0x5d65cc[_0xdbc2('0x40')]=_[_0xdbc2('0x3e')](_0x48d9c0[_0xdbc2('0x3f')],qs[_0xdbc2('0x41')](_0x1ccdf0[_0xdbc2('0x3c')][_0xdbc2('0x41')]));_0x5d65cc[_0xdbc2('0x40')]=_0x5d65cc[_0xdbc2('0x40')]['length']?_0x5d65cc[_0xdbc2('0x40')]:_0x48d9c0[_0xdbc2('0x3f')];_0x5d65cc[_0xdbc2('0x43')]=qs[_0xdbc2('0x44')](_0x1ccdf0[_0xdbc2('0x3c')][_0xdbc2('0x44')]);_0x5d65cc['where']=qs['filters'](_[_0xdbc2('0x45')](_0x1ccdf0[_0xdbc2('0x3c')],_0x48d9c0[_0xdbc2('0x3d')]));if(_0x1ccdf0[_0xdbc2('0x3c')][_0xdbc2('0x46')]){_0x5d65cc['where']=_['merge'](_0x5d65cc[_0xdbc2('0x47')],{'$or':_['map'](_0x5d65cc[_0xdbc2('0x40')],function(_0x1f7d9c){var _0x1c60ef={};_0x1c60ef[_0x1f7d9c]={'$like':'%'+_0x1ccdf0[_0xdbc2('0x3c')][_0xdbc2('0x46')]+'%'};return _0x1c60ef;})});}_0x5d65cc=_[_0xdbc2('0x48')]({},_0x5d65cc,_0x1ccdf0[_0xdbc2('0x4b')]);return _0x2ad207['getFields'](_0x5d65cc);}})[_0xdbc2('0x1f')](function(_0x2c898c){if(_0x2c898c){_0x7216bf=_0x2c898c[_0xdbc2('0x51')];if(!_0x1ccdf0['query'][_0xdbc2('0x57')](_0xdbc2('0x42'))){_0x5d65cc[_0xdbc2('0x2d')]=qs[_0xdbc2('0x2d')](_0x1ccdf0[_0xdbc2('0x3c')][_0xdbc2('0x2d')]);_0x5d65cc[_0xdbc2('0x2c')]=qs[_0xdbc2('0x2c')](_0x1ccdf0[_0xdbc2('0x3c')]['offset']);}return _0x2ad207[_0xdbc2('0x58')](_0x5d65cc);}})[_0xdbc2('0x1f')](function(_0x2db89d){if(_0x2db89d){return _0x2db89d?{'count':_0x7216bf,'rows':_0x2db89d}:null;}})[_0xdbc2('0x1f')](respondWithResult(_0x53422d,null))[_0xdbc2('0x27')](handleError(_0x53422d,null));};exports['getSubjects']=function(_0x57a9af,_0xf79209,_0x334e5a){var _0x5a8b1d={};var _0x198d89={};var _0x3758f7;var _0x1d590f;return db[_0xdbc2('0x38')][_0xdbc2('0x59')]({'where':{'id':_0x57a9af['params']['id']}})[_0xdbc2('0x1f')](handleEntityNotFound(_0xf79209,null))[_0xdbc2('0x1f')](function(_0x3ff035){if(_0x3ff035){_0x3758f7=_0x3ff035;_0x198d89[_0xdbc2('0x3f')]=_[_0xdbc2('0x50')](db[_0xdbc2('0x56')]['rawAttributes']);_0x198d89[_0xdbc2('0x3c')]=_[_0xdbc2('0x50')](_0x57a9af[_0xdbc2('0x3c')]);_0x198d89[_0xdbc2('0x3d')]=_[_0xdbc2('0x3e')](_0x198d89['model'],_0x198d89['query']);_0x5a8b1d[_0xdbc2('0x40')]=_[_0xdbc2('0x3e')](_0x198d89[_0xdbc2('0x3f')],qs[_0xdbc2('0x41')](_0x57a9af[_0xdbc2('0x3c')][_0xdbc2('0x41')]));_0x5a8b1d[_0xdbc2('0x40')]=_0x5a8b1d[_0xdbc2('0x40')][_0xdbc2('0x51')]?_0x5a8b1d['attributes']:_0x198d89[_0xdbc2('0x3f')];_0x5a8b1d['order']=qs[_0xdbc2('0x44')](_0x57a9af['query'][_0xdbc2('0x44')]);_0x5a8b1d[_0xdbc2('0x47')]=qs[_0xdbc2('0x3d')](_[_0xdbc2('0x45')](_0x57a9af[_0xdbc2('0x3c')],_0x198d89[_0xdbc2('0x3d')]));if(_0x57a9af['query'][_0xdbc2('0x46')]){_0x5a8b1d[_0xdbc2('0x47')]=_[_0xdbc2('0x48')](_0x5a8b1d[_0xdbc2('0x47')],{'$or':_[_0xdbc2('0x37')](_0x5a8b1d[_0xdbc2('0x40')],function(_0x447cd4){var _0x17de85={};_0x17de85[_0x447cd4]={'$like':'%'+_0x57a9af[_0xdbc2('0x3c')][_0xdbc2('0x46')]+'%'};return _0x17de85;})});}_0x5a8b1d=_[_0xdbc2('0x48')]({},_0x5a8b1d,_0x57a9af[_0xdbc2('0x4b')]);return _0x3758f7[_0xdbc2('0x5a')](_0x5a8b1d);}})[_0xdbc2('0x1f')](function(_0x185916){if(_0x185916){_0x1d590f=_0x185916['length'];if(!_0x57a9af[_0xdbc2('0x3c')][_0xdbc2('0x57')](_0xdbc2('0x42'))){_0x5a8b1d[_0xdbc2('0x2d')]=qs[_0xdbc2('0x2d')](_0x57a9af[_0xdbc2('0x3c')][_0xdbc2('0x2d')]);_0x5a8b1d[_0xdbc2('0x2c')]=qs[_0xdbc2('0x2c')](_0x57a9af[_0xdbc2('0x3c')][_0xdbc2('0x2c')]);}return _0x3758f7[_0xdbc2('0x5a')](_0x5a8b1d);}})[_0xdbc2('0x1f')](function(_0x26e0be){if(_0x26e0be){return _0x26e0be?{'count':_0x1d590f,'rows':_0x26e0be}:null;}})[_0xdbc2('0x1f')](respondWithResult(_0xf79209,null))[_0xdbc2('0x27')](handleError(_0xf79209,null));};exports['getDescriptions']=function(_0x49ac9b,_0x2346de,_0x3be23c){var _0xf0d9f9={};var _0x43614e={};var _0x43996c;var _0x2d7207;return db['ZohoConfiguration'][_0xdbc2('0x59')]({'where':{'id':_0x49ac9b['params']['id']}})[_0xdbc2('0x1f')](handleEntityNotFound(_0x2346de,null))['then'](function(_0x368d7a){if(_0x368d7a){_0x43996c=_0x368d7a;_0x43614e['model']=_[_0xdbc2('0x50')](db[_0xdbc2('0x56')]['rawAttributes']);_0x43614e[_0xdbc2('0x3c')]=_['keys'](_0x49ac9b['query']);_0x43614e[_0xdbc2('0x3d')]=_[_0xdbc2('0x3e')](_0x43614e['model'],_0x43614e[_0xdbc2('0x3c')]);_0xf0d9f9[_0xdbc2('0x40')]=_[_0xdbc2('0x3e')](_0x43614e['model'],qs['fields'](_0x49ac9b[_0xdbc2('0x3c')][_0xdbc2('0x41')]));_0xf0d9f9['attributes']=_0xf0d9f9[_0xdbc2('0x40')]['length']?_0xf0d9f9[_0xdbc2('0x40')]:_0x43614e[_0xdbc2('0x3f')];_0xf0d9f9[_0xdbc2('0x43')]=qs[_0xdbc2('0x44')](_0x49ac9b[_0xdbc2('0x3c')][_0xdbc2('0x44')]);_0xf0d9f9[_0xdbc2('0x47')]=qs['filters'](_['pick'](_0x49ac9b[_0xdbc2('0x3c')],_0x43614e[_0xdbc2('0x3d')]));if(_0x49ac9b[_0xdbc2('0x3c')][_0xdbc2('0x46')]){_0xf0d9f9[_0xdbc2('0x47')]=_['merge'](_0xf0d9f9[_0xdbc2('0x47')],{'$or':_[_0xdbc2('0x37')](_0xf0d9f9['attributes'],function(_0x19ad35){var _0x1a9013={};_0x1a9013[_0x19ad35]={'$like':'%'+_0x49ac9b['query'][_0xdbc2('0x46')]+'%'};return _0x1a9013;})});}_0xf0d9f9=_['merge']({},_0xf0d9f9,_0x49ac9b[_0xdbc2('0x4b')]);return _0x43996c[_0xdbc2('0x5b')](_0xf0d9f9);}})['then'](function(_0x404a09){if(_0x404a09){_0x2d7207=_0x404a09[_0xdbc2('0x51')];if(!_0x49ac9b[_0xdbc2('0x3c')][_0xdbc2('0x57')](_0xdbc2('0x42'))){_0xf0d9f9[_0xdbc2('0x2d')]=qs[_0xdbc2('0x2d')](_0x49ac9b[_0xdbc2('0x3c')][_0xdbc2('0x2d')]);_0xf0d9f9[_0xdbc2('0x2c')]=qs[_0xdbc2('0x2c')](_0x49ac9b[_0xdbc2('0x3c')][_0xdbc2('0x2c')]);}return _0x43996c[_0xdbc2('0x5b')](_0xf0d9f9);}})['then'](function(_0x5f57ab){if(_0x5f57ab){return _0x5f57ab?{'count':_0x2d7207,'rows':_0x5f57ab}:null;}})[_0xdbc2('0x1f')](respondWithResult(_0x2346de,null))['catch'](handleError(_0x2346de,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 055db76..a708791 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 _0x01d9=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x274991,_0x36c23a){var _0x7a516a=function(_0x53c865){while(--_0x53c865){_0x274991['push'](_0x274991['shift']());}};_0x7a516a(++_0x36c23a);}(_0x01d9,0x90));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var rp=require(_0x901d('0x6'));var fs=require('fs');var path=require(_0x901d('0x7'));var rimraf=require(_0x901d('0x8'));var config=require(_0x901d('0x9'));var attributes=require(_0x901d('0xa'));module[_0x901d('0xb')]=function(_0x39a146,_0x5e72ec){return _0x39a146[_0x901d('0xc')](_0x901d('0xd'),attributes,{'tableName':_0x901d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x580e=['define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x580e,0xdd));var _0xe580=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x580e[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xe580('0x0'));var util=require('util');var logger=require(_0xe580('0x1'))(_0xe580('0x2'));var moment=require(_0xe580('0x3'));var BPromise=require(_0xe580('0x4'));var rp=require(_0xe580('0x5'));var fs=require('fs');var path=require(_0xe580('0x6'));var rimraf=require('rimraf');var config=require(_0xe580('0x7'));var attributes=require(_0xe580('0x8'));module['exports']=function(_0x558be9,_0x368883){return _0x558be9[_0xe580('0x9')]('ZohoConfiguration',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 41c3661..a9dba33 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 _0xe367=['jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe367,0x15e));var _0x7e36=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe367[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x7e36('0x0'));var util=require(_0x7e36('0x1'));var moment=require(_0x7e36('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e36('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e36('0x5'))('rpc');var config=require(_0x7e36('0x6'));var jayson=require(_0x7e36('0x7'));var client=jayson[_0x7e36('0x8')][_0x7e36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cefe2,_0x56d4ed,_0x48df2e){return new BPromise(function(_0x561a49,_0x1dd732){return client[_0x7e36('0xa')](_0x1cefe2,_0x48df2e)['then'](function(_0x3ca5c5){logger[_0x7e36('0xb')](_0x7e36('0xc'),_0x56d4ed,_0x7e36('0xd'));logger[_0x7e36('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x56d4ed,_0x7e36('0xd'),JSON[_0x7e36('0xf')](_0x3ca5c5));if(_0x3ca5c5[_0x7e36('0x10')]){if(_0x3ca5c5[_0x7e36('0x10')][_0x7e36('0x11')]===0x1f4){logger[_0x7e36('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x56d4ed,_0x3ca5c5[_0x7e36('0x10')][_0x7e36('0x12')]);return _0x1dd732(_0x3ca5c5['error'][_0x7e36('0x12')]);}logger[_0x7e36('0x10')](_0x7e36('0xc'),_0x56d4ed,_0x3ca5c5['error'][_0x7e36('0x12')]);return _0x561a49(_0x3ca5c5[_0x7e36('0x10')][_0x7e36('0x12')]);}else{logger[_0x7e36('0xb')](_0x7e36('0xc'),_0x56d4ed,_0x7e36('0xd'));_0x561a49(_0x3ca5c5[_0x7e36('0x13')][_0x7e36('0x12')]);}})[_0x7e36('0x14')](function(_0x5c5837){logger[_0x7e36('0x10')](_0x7e36('0xc'),_0x56d4ed,_0x5c5837);_0x1dd732(_0x5c5837);});});} \ No newline at end of file +var _0x23d6=['error','code','message','info','result','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x17784a,_0x42fe44){var _0x41aded=function(_0x2e7319){while(--_0x2e7319){_0x17784a['push'](_0x17784a['shift']());}};_0x41aded(++_0x42fe44);}(_0x23d6,0xc2));var _0x623d=function(_0x4667e3,_0x4d446c){_0x4667e3=_0x4667e3-0x0;var _0x3d3ed4=_0x23d6[_0x4667e3];return _0x3d3ed4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x623d('0x0'));var BPromise=require('bluebird');var rs=require(_0x623d('0x1'));var fs=require('fs');var Redis=require(_0x623d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x623d('0x3'));var logger=require(_0x623d('0x4'))(_0x623d('0x5'));var config=require(_0x623d('0x6'));var jayson=require(_0x623d('0x7'));var client=jayson[_0x623d('0x8')][_0x623d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52aa5c,_0x35d386,_0x1150b5){return new BPromise(function(_0x102f86,_0x1a563c){return client[_0x623d('0xa')](_0x52aa5c,_0x1150b5)['then'](function(_0x5b32d8){logger['info'](_0x623d('0xb'),_0x35d386,_0x623d('0xc'));logger[_0x623d('0xd')](_0x623d('0xe'),_0x35d386,'request\x20sent',JSON[_0x623d('0xf')](_0x5b32d8));if(_0x5b32d8[_0x623d('0x10')]){if(_0x5b32d8[_0x623d('0x10')][_0x623d('0x11')]===0x1f4){logger[_0x623d('0x10')](_0x623d('0xb'),_0x35d386,_0x5b32d8[_0x623d('0x10')][_0x623d('0x12')]);return _0x1a563c(_0x5b32d8[_0x623d('0x10')]['message']);}logger[_0x623d('0x10')](_0x623d('0xb'),_0x35d386,_0x5b32d8[_0x623d('0x10')]['message']);return _0x102f86(_0x5b32d8[_0x623d('0x10')][_0x623d('0x12')]);}else{logger[_0x623d('0x13')](_0x623d('0xb'),_0x35d386,_0x623d('0xc'));_0x102f86(_0x5b32d8[_0x623d('0x14')][_0x623d('0x12')]);}})['catch'](function(_0x31af1a){logger[_0x623d('0x10')](_0x623d('0xb'),_0x35d386,_0x31af1a);_0x1a563c(_0x31af1a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 4b46434..7de2f71 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 _0x781d=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','put','update','/:id','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1250f8,_0x44f296){var _0xe00575=function(_0x138cf6){while(--_0x138cf6){_0x1250f8['push'](_0x1250f8['shift']());}};_0xe00575(++_0x44f296);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var auth=require(_0xd781('0x4'));var interaction=require(_0xd781('0x5'));var config=require(_0xd781('0x6'));var controller=require(_0xd781('0x7'));router[_0xd781('0x8')]('/',auth[_0xd781('0x9')](),controller[_0xd781('0xa')]);router[_0xd781('0x8')]('/:id',auth[_0xd781('0x9')](),controller[_0xd781('0xb')]);router[_0xd781('0xc')]('/',auth[_0xd781('0x9')](),controller['create']);router[_0xd781('0xd')]('/:id',auth[_0xd781('0x9')](),controller[_0xd781('0xe')]);router['delete'](_0xd781('0xf'),auth[_0xd781('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9536=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x442ec4,_0x2d9cb2){var _0x3843cf=function(_0x3509c8){while(--_0x3509c8){_0x442ec4['push'](_0x442ec4['shift']());}};_0x3843cf(++_0x2d9cb2);}(_0x9536,0x179));var _0x6953=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x9536[_0x236c89];return _0x3b2a15;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6953('0x5'));var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller['index']);router[_0x6953('0x8')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0xb')]);router[_0x6953('0xc')]('/',auth['isAuthenticated'](),controller[_0x6953('0xd')]);router[_0x6953('0xe')](_0x6953('0xa'),auth['isAuthenticated'](),controller[_0x6953('0xf')]);router[_0x6953('0x10')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0x11')]);module[_0x6953('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2fd4ecb..cea15b9 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 _0x8075=['STRING','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x8075,0xab));var _0x5807=function(_0x410d9c,_0x592361){_0x410d9c=_0x410d9c-0x0;var _0x2b327f=_0x8075[_0x410d9c];return _0x2b327f;};'use strict';var Sequelize=require(_0x5807('0x0'));module[_0x5807('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5807('0x2'),'variable',_0x5807('0x3'),_0x5807('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5807('0x5')]},'key':{'type':Sequelize[_0x5807('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5807('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x5807('0x5')]},'idField':{'type':Sequelize[_0x5807('0x5')]},'nameField':{'type':Sequelize[_0x5807('0x5')]},'customField':{'type':Sequelize[_0x5807('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5807('0x5')]}}; \ No newline at end of file +var _0xe489=['customVariable','keyValue','ENUM','STRING','BOOLEAN','sequelize','exports','string','variable'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xe489,0x9e));var _0x9e48=function(_0x32b289,_0x4ca66f){_0x32b289=_0x32b289-0x0;var _0x20dd4f=_0xe489[_0x32b289];return _0x20dd4f;};'use strict';var Sequelize=require(_0x9e48('0x0'));module[_0x9e48('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9e48('0x2'),_0x9e48('0x3'),_0x9e48('0x4'),_0x9e48('0x5')),'defaultValue':_0x9e48('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9e48('0x6')]('string',_0x9e48('0x3'),_0x9e48('0x4'))},'keyContent':{'type':Sequelize[_0x9e48('0x7')]},'idField':{'type':Sequelize[_0x9e48('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9e48('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e48('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 04a8e4c..c309b4e 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x3fa0f7,_0x2f5821){var _0x4f2070=function(_0x2cf33f){while(--_0x2cf33f){_0x3fa0f7['push'](_0x3fa0f7['shift']());}};_0x4f2070(++_0x2f5821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x308d7b,_0x27eb82){var _0x27afcb=function(_0x51a73e){while(--_0x51a73e){_0x308d7b['push'](_0x308d7b['shift']());}};_0x27afcb(++_0x27eb82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 2583ecc..34a153f 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 _0x9bfc=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoField.attributes','exports'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x9bfc,0x6d));var _0xc9bf=function(_0x39af22,_0x1cb1ae){_0x39af22=_0x39af22-0x0;var _0x2dcdf0=_0x9bfc[_0x39af22];return _0x2dcdf0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9bf('0x0'))(_0xc9bf('0x1'));var moment=require(_0xc9bf('0x2'));var BPromise=require('bluebird');var rp=require(_0xc9bf('0x3'));var fs=require('fs');var path=require(_0xc9bf('0x4'));var rimraf=require('rimraf');var config=require(_0xc9bf('0x5'));var attributes=require(_0xc9bf('0x6'));module[_0xc9bf('0x7')]=function(_0x330a1d,_0x504f29){return _0x330a1d['define'](_0xc9bf('0x8'),attributes,{'tableName':_0xc9bf('0x9'),'paranoid':![],'indexes':[{'name':_0xc9bf('0xa'),'fields':[_0xc9bf('0xb'),_0xc9bf('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde27=['../../config/environment','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x275a36,_0x36bf43){var _0x3c2ce1=function(_0x28b021){while(--_0x28b021){_0x275a36['push'](_0x275a36['shift']());}};_0x3c2ce1(++_0x36bf43);}(_0xde27,0x185));var _0x7de2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xde27[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7de2('0x0'));var util=require(_0x7de2('0x1'));var logger=require(_0x7de2('0x2'))(_0x7de2('0x3'));var moment=require('moment');var BPromise=require(_0x7de2('0x4'));var rp=require(_0x7de2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7de2('0x6'));var config=require(_0x7de2('0x7'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x4f65f0,_0x2676f0){return _0x4f65f0['define']('ZohoField',attributes,{'tableName':_0x7de2('0x8'),'paranoid':![],'indexes':[{'name':_0x7de2('0x9'),'fields':[_0x7de2('0xa'),_0x7de2('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 7d8b474..ec7f65a 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x45343e,_0x19937d){var _0x549a54=function(_0x127d87){while(--_0x127d87){_0x45343e['push'](_0x45343e['shift']());}};_0x549a54(++_0x19937d);}(_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 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']('ZohoField,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x5636=['code','ZohoField,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5636,0x102));var _0x6563=function(_0x2c598f,_0x23ff29){_0x2c598f=_0x2c598f-0x0;var _0x2cf00d=_0x5636[_0x2c598f];return _0x2cf00d;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('ZohoField,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('ZohoField,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('ZohoField,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2c08ad9..5546d96 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 _0x7356=['express','Router','../../components/auth/service','../../components/interaction/service','util'];(function(_0x2a2e72,_0x1de962){var _0x3cfb4a=function(_0x3d435c){while(--_0x3d435c){_0x2a2e72['push'](_0x2a2e72['shift']());}};_0x3cfb4a(++_0x1de962);}(_0x7356,0xd1));var _0x6735=function(_0x5de72b,_0x3d3ce5){_0x5de72b=_0x5de72b-0x0;var _0x4ef7d4=_0x7356[_0x5de72b];return _0x4ef7d4;};'use strict';var multer=require('multer');var util=require(_0x6735('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6735('0x1'));var router=express[_0x6735('0x2')]();var auth=require(_0x6735('0x3'));var interaction=require(_0x6735('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x7517=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x115f04,_0xdcc29){var _0x204445=function(_0x230fa9){while(--_0x230fa9){_0x115f04['push'](_0x115f04['shift']());}};_0x204445(++_0xdcc29);}(_0x7517,0x1d9));var _0x7751=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x7517[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x7751('0x0'));var util=require(_0x7751('0x1'));var path=require(_0x7751('0x2'));var timeout=require(_0x7751('0x3'));var express=require(_0x7751('0x4'));var router=express[_0x7751('0x5')]();var auth=require(_0x7751('0x6'));var interaction=require(_0x7751('0x7'));var config=require(_0x7751('0x8'));module[_0x7751('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b6aa2c0..25457d7 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 _0xcc99=['unique_name_and_version','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x33ed20,_0x5701d8){var _0x3913d5=function(_0x2ecb65){while(--_0x2ecb65){_0x33ed20['push'](_0x33ed20['shift']());}};_0x3913d5(++_0x5701d8);}(_0xcc99,0xfa));var _0x9cc9=function(_0x2b4982,_0x25cfd9){_0x2b4982=_0x2b4982-0x0;var _0x56b6ed=_0xcc99[_0x2b4982];return _0x56b6ed;};'use strict';var Sequelize=require('sequelize');module[_0x9cc9('0x0')]={'name':{'type':Sequelize[_0x9cc9('0x1')],'allowNull':![],'unique':_0x9cc9('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9cc9('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x9cc9('0x1')]},'path':{'type':Sequelize[_0x9cc9('0x1')]},'type':{'type':Sequelize[_0x9cc9('0x1')]},'size':{'type':Sequelize[_0x9cc9('0x3')]},'active':{'type':Sequelize[_0x9cc9('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x9cc9('0x1')]},'logo':{'type':Sequelize[_0x9cc9('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x9cc9('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x9cc9('0x1')]},'remoteUri':{'type':Sequelize[_0x9cc9('0x1')]},'link':{'type':Sequelize[_0x9cc9('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x236f=['STRING','unique_name_and_version','BOOLEAN','state','sequelize','exports'];(function(_0x3703fe,_0x10ad36){var _0x23c2b0=function(_0x2609e1){while(--_0x2609e1){_0x3703fe['push'](_0x3703fe['shift']());}};_0x23c2b0(++_0x10ad36);}(_0x236f,0x178));var _0xf236=function(_0xac8698,_0x416d86){_0xac8698=_0xac8698-0x0;var _0x4a314b=_0x236f[_0xac8698];return _0x4a314b;};'use strict';var Sequelize=require(_0xf236('0x0'));module[_0xf236('0x1')]={'name':{'type':Sequelize[_0xf236('0x2')],'allowNull':![],'unique':_0xf236('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf236('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xf236('0x2')]},'path':{'type':Sequelize[_0xf236('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xf236('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xf236('0x2')]},'logo':{'type':Sequelize[_0xf236('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xf236('0x5')},'description':{'type':Sequelize[_0xf236('0x2')]},'title':{'type':Sequelize[_0xf236('0x2')]},'remoteUri':{'type':Sequelize[_0xf236('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index a3f280f..7899d07 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 _0x8132=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','save','update','then','destroy','error','stack','name','send','Integration','fieldName','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','params','keys','rawAttributes','intersection','length','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x45b374,_0x20dccb){var _0x24fc74=function(_0x357eaf){while(--_0x357eaf){_0x45b374['push'](_0x45b374['shift']());}};_0x24fc74(++_0x20dccb);}(_0x8132,0xc1));var _0x2813=function(_0x4056a0,_0x351ab2){_0x4056a0=_0x4056a0-0x0;var _0x26374b=_0x8132[_0x4056a0];return _0x26374b;};'use strict';var pdf=require(_0x2813('0x0'));var emlformat=require(_0x2813('0x1'));var rimraf=require(_0x2813('0x2'));var zipdir=require(_0x2813('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2813('0x4'));var moment=require(_0x2813('0x5'));var BPromise=require(_0x2813('0x6'));var Mustache=require(_0x2813('0x7'));var util=require(_0x2813('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2813('0x9'));var ejs=require(_0x2813('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2813('0xb'));var jsforce=require(_0x2813('0xc'));var deskjs=require(_0x2813('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2813('0xe'));var Papa=require(_0x2813('0xf'));var Redis=require(_0x2813('0x10'));var authService=require(_0x2813('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2813('0x12'));var hardwareService=require(_0x2813('0x13'));var logger=require('../../config/logger')(_0x2813('0x14'));var utils=require(_0x2813('0x15'));var config=require(_0x2813('0x16'));var db=require(_0x2813('0x17'))['db'];function respondWithStatusCode(_0x4a6be3,_0x2d6da0){_0x2d6da0=_0x2d6da0||0xcc;return function(_0x6fd9d9){if(_0x6fd9d9){return _0x4a6be3[_0x2813('0x18')](_0x2d6da0);}return _0x4a6be3['status'](_0x2d6da0)['end']();};}function respondWithResult(_0x33cca5,_0x1910c5){_0x1910c5=_0x1910c5||0xc8;return function(_0x5b0d70){if(_0x5b0d70){return _0x33cca5[_0x2813('0x19')](_0x1910c5)['json'](_0x5b0d70);}};}function respondWithFilteredResult(_0x24c3ee,_0xce985d){return function(_0x5442a0){if(_0x5442a0){var _0x3ce490=_0x5442a0[_0x2813('0x1a')],_0x5b3e16=_0xce985d['offset'],_0x356da2=_0xce985d[_0x2813('0x1b')]+_0xce985d[_0x2813('0x1c')],_0x501983;if(_0x356da2>=_0x3ce490){_0x356da2=_0x3ce490;_0x501983=0xc8;}else{_0x501983=0xce;}_0x24c3ee[_0x2813('0x19')](_0x501983);return _0x24c3ee[_0x2813('0x1d')]('Content-Range',_0x5b3e16+'-'+_0x356da2+'/'+_0x3ce490)[_0x2813('0x1e')](_0x5442a0);}return null;};}function patchUpdates(_0x22dd1d){return function(_0x39b6eb){try{jsonpatch[_0x2813('0x1f')](_0x39b6eb,_0x22dd1d,!![]);}catch(_0x2bf92e){return BPromise['reject'](_0x2bf92e);}return _0x39b6eb[_0x2813('0x20')]();};}function saveUpdates(_0x298bc0,_0x4498c9){return function(_0xbcaa2){if(_0xbcaa2){return _0xbcaa2[_0x2813('0x21')](_0x298bc0)[_0x2813('0x22')](function(_0x5cab37){return _0x5cab37;});}return null;};}function removeEntity(_0x21ad6c,_0x150941){return function(_0x44065f){if(_0x44065f){return _0x44065f[_0x2813('0x23')]()[_0x2813('0x22')](function(){_0x21ad6c[_0x2813('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e5d00,_0x5a6268){return function(_0x55d552){if(!_0x55d552){_0x1e5d00['sendStatus'](0x194);}return _0x55d552;};}function handleError(_0x412778,_0x75e572){_0x75e572=_0x75e572||0x1f4;return function(_0x35021b){logger[_0x2813('0x24')](_0x35021b[_0x2813('0x25')]);if(_0x35021b['name']){delete _0x35021b[_0x2813('0x26')];}_0x412778[_0x2813('0x19')](_0x75e572)[_0x2813('0x27')](_0x35021b);};}exports['index']=function(_0x4f463a,_0x4f471e){var _0x94489b={},_0xdbb4bc={},_0x565826={'count':0x0,'rows':[]};var _0x21bc67=_['map'](db[_0x2813('0x28')]['rawAttributes'],function(_0x22c455){return{'name':_0x22c455[_0x2813('0x29')],'type':_0x22c455['type']['key']};});_0xdbb4bc[_0x2813('0x2a')]=_[_0x2813('0x2b')](_0x21bc67,'name');_0xdbb4bc[_0x2813('0x2c')]=_['keys'](_0x4f463a['query']);_0xdbb4bc[_0x2813('0x2d')]=_['intersection'](_0xdbb4bc['model'],_0xdbb4bc[_0x2813('0x2c')]);_0x94489b[_0x2813('0x2e')]=_['intersection'](_0xdbb4bc[_0x2813('0x2a')],qs['fields'](_0x4f463a[_0x2813('0x2c')][_0x2813('0x2f')]));_0x94489b[_0x2813('0x2e')]=_0x94489b['attributes']['length']?_0x94489b[_0x2813('0x2e')]:_0xdbb4bc['model'];if(!_0x4f463a[_0x2813('0x2c')][_0x2813('0x30')](_0x2813('0x31'))){_0x94489b[_0x2813('0x1c')]=qs[_0x2813('0x1c')](_0x4f463a['query']['limit']);_0x94489b[_0x2813('0x1b')]=qs[_0x2813('0x1b')](_0x4f463a['query'][_0x2813('0x1b')]);}_0x94489b[_0x2813('0x32')]=qs['sort'](_0x4f463a[_0x2813('0x2c')]['sort']);_0x94489b[_0x2813('0x33')]=qs['filters'](_[_0x2813('0x34')](_0x4f463a['query'],_0xdbb4bc[_0x2813('0x2d')]),_0x21bc67);if(_0x4f463a[_0x2813('0x2c')][_0x2813('0x35')]){_0x94489b[_0x2813('0x33')]=_[_0x2813('0x36')](_0x94489b['where'],{'$or':_[_0x2813('0x2b')](_0x21bc67,function(_0x492fe5){if(_0x492fe5[_0x2813('0x37')]!==_0x2813('0x38')){var _0x5a89df={};_0x5a89df[_0x492fe5[_0x2813('0x26')]]={'$like':'%'+_0x4f463a[_0x2813('0x2c')][_0x2813('0x35')]+'%'};return _0x5a89df;}})});}_0x94489b=_[_0x2813('0x36')]({},_0x94489b,_0x4f463a['options']);var _0x588882={'where':_0x94489b[_0x2813('0x33')]};return db[_0x2813('0x28')][_0x2813('0x1a')](_0x588882)[_0x2813('0x22')](function(_0x5186ca){_0x565826['count']=_0x5186ca;if(_0x4f463a[_0x2813('0x2c')][_0x2813('0x39')]){_0x94489b[_0x2813('0x3a')]=[{'all':!![]}];}return db[_0x2813('0x28')]['findAll'](_0x94489b);})[_0x2813('0x22')](function(_0x55c344){_0x565826[_0x2813('0x3b')]=_0x55c344;return _0x565826;})['then'](respondWithFilteredResult(_0x4f471e,_0x94489b))[_0x2813('0x3c')](handleError(_0x4f471e,null));};exports['show']=function(_0xb20810,_0x55d716){var _0x4a6efb={'raw':![],'where':{'id':_0xb20810[_0x2813('0x3d')]['id']}},_0x1e3f68={};_0x1e3f68[_0x2813('0x2a')]=_[_0x2813('0x3e')](db[_0x2813('0x28')][_0x2813('0x3f')]);_0x1e3f68[_0x2813('0x2c')]=_[_0x2813('0x3e')](_0xb20810[_0x2813('0x2c')]);_0x1e3f68[_0x2813('0x2d')]=_[_0x2813('0x40')](_0x1e3f68[_0x2813('0x2a')],_0x1e3f68['query']);_0x4a6efb['attributes']=_[_0x2813('0x40')](_0x1e3f68[_0x2813('0x2a')],qs['fields'](_0xb20810['query'][_0x2813('0x2f')]));_0x4a6efb['attributes']=_0x4a6efb[_0x2813('0x2e')][_0x2813('0x41')]?_0x4a6efb['attributes']:_0x1e3f68['model'];if(_0xb20810[_0x2813('0x2c')][_0x2813('0x39')]){_0x4a6efb[_0x2813('0x3a')]=[{'all':!![]}];}_0x4a6efb=_[_0x2813('0x36')]({},_0x4a6efb,_0xb20810[_0x2813('0x42')]);return db['Integration'][_0x2813('0x43')](_0x4a6efb)[_0x2813('0x22')](handleEntityNotFound(_0x55d716,null))[_0x2813('0x22')](respondWithResult(_0x55d716,null))[_0x2813('0x3c')](handleError(_0x55d716,null));};exports[_0x2813('0x44')]=function(_0x5a39d6,_0x81e509){return db[_0x2813('0x28')][_0x2813('0x44')](_0x5a39d6[_0x2813('0x45')],{})[_0x2813('0x22')](respondWithResult(_0x81e509,0xc9))[_0x2813('0x3c')](handleError(_0x81e509,null));};exports['update']=function(_0x45d575,_0x16c79c){if(_0x45d575[_0x2813('0x45')]['id']){delete _0x45d575[_0x2813('0x45')]['id'];}return db[_0x2813('0x28')][_0x2813('0x43')]({'where':{'id':_0x45d575[_0x2813('0x3d')]['id']}})['then'](handleEntityNotFound(_0x16c79c,null))[_0x2813('0x22')](saveUpdates(_0x45d575[_0x2813('0x45')],null))[_0x2813('0x22')](respondWithResult(_0x16c79c,null))['catch'](handleError(_0x16c79c,null));};exports[_0x2813('0x23')]=function(_0x22d33e,_0x5e6398){return db[_0x2813('0x28')][_0x2813('0x43')]({'where':{'id':_0x22d33e['params']['id']}})['then'](handleEntityNotFound(_0x5e6398,null))[_0x2813('0x22')](removeEntity(_0x5e6398,null))[_0x2813('0x3c')](handleError(_0x5e6398,null));}; \ No newline at end of file +var _0x3781=['findAll','catch','show','params','keys','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0xc471d2,_0x26ab16){var _0x334c68=function(_0x2deae4){while(--_0x2deae4){_0xc471d2['push'](_0xc471d2['shift']());}};_0x334c68(++_0x26ab16);}(_0x3781,0xe7));var _0x1378=function(_0x3d4d91,_0x577d8a){_0x3d4d91=_0x3d4d91-0x0;var _0xa30755=_0x3781[_0x3d4d91];return _0xa30755;};'use strict';var pdf=require(_0x1378('0x0'));var emlformat=require(_0x1378('0x1'));var rimraf=require(_0x1378('0x2'));var zipdir=require(_0x1378('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1378('0x4'));var moment=require(_0x1378('0x5'));var BPromise=require(_0x1378('0x6'));var Mustache=require(_0x1378('0x7'));var util=require(_0x1378('0x8'));var path=require(_0x1378('0x9'));var sox=require(_0x1378('0xa'));var csv=require(_0x1378('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1378('0xc'));var crypto=require(_0x1378('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1378('0xe'));var toCsv=require(_0x1378('0xb'));var querystring=require(_0x1378('0xf'));var Papa=require(_0x1378('0x10'));var Redis=require(_0x1378('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1378('0x12'));var as=require(_0x1378('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1378('0x14'))(_0x1378('0x15'));var utils=require(_0x1378('0x16'));var config=require('../../config/environment');var db=require(_0x1378('0x17'))['db'];function respondWithStatusCode(_0x411607,_0x14065c){_0x14065c=_0x14065c||0xcc;return function(_0x4b78b8){if(_0x4b78b8){return _0x411607[_0x1378('0x18')](_0x14065c);}return _0x411607[_0x1378('0x19')](_0x14065c)[_0x1378('0x1a')]();};}function respondWithResult(_0x40e83e,_0x5b499c){_0x5b499c=_0x5b499c||0xc8;return function(_0x158b64){if(_0x158b64){return _0x40e83e['status'](_0x5b499c)[_0x1378('0x1b')](_0x158b64);}};}function respondWithFilteredResult(_0x55336d,_0x46e398){return function(_0x11d0c7){if(_0x11d0c7){var _0x145127=_0x11d0c7[_0x1378('0x1c')],_0x52e943=_0x46e398[_0x1378('0x1d')],_0x1daa86=_0x46e398[_0x1378('0x1d')]+_0x46e398['limit'],_0x27d0d3;if(_0x1daa86>=_0x145127){_0x1daa86=_0x145127;_0x27d0d3=0xc8;}else{_0x27d0d3=0xce;}_0x55336d[_0x1378('0x19')](_0x27d0d3);return _0x55336d[_0x1378('0x1e')](_0x1378('0x1f'),_0x52e943+'-'+_0x1daa86+'/'+_0x145127)[_0x1378('0x1b')](_0x11d0c7);}return null;};}function patchUpdates(_0x314d16){return function(_0x591655){try{jsonpatch['apply'](_0x591655,_0x314d16,!![]);}catch(_0x462297){return BPromise[_0x1378('0x20')](_0x462297);}return _0x591655[_0x1378('0x21')]();};}function saveUpdates(_0x1024e5,_0x23c7f6){return function(_0x50e6f1){if(_0x50e6f1){return _0x50e6f1[_0x1378('0x22')](_0x1024e5)[_0x1378('0x23')](function(_0x49fc8c){return _0x49fc8c;});}return null;};}function removeEntity(_0x547b4f,_0x44708d){return function(_0x3c499a){if(_0x3c499a){return _0x3c499a['destroy']()[_0x1378('0x23')](function(){_0x547b4f[_0x1378('0x19')](0xcc)[_0x1378('0x1a')]();});}};}function handleEntityNotFound(_0x2c398b,_0x133960){return function(_0x38e763){if(!_0x38e763){_0x2c398b['sendStatus'](0x194);}return _0x38e763;};}function handleError(_0x1f80a8,_0x3cf526){_0x3cf526=_0x3cf526||0x1f4;return function(_0x4167f4){logger[_0x1378('0x24')](_0x4167f4[_0x1378('0x25')]);if(_0x4167f4[_0x1378('0x26')]){delete _0x4167f4['name'];}_0x1f80a8[_0x1378('0x19')](_0x3cf526)['send'](_0x4167f4);};}exports[_0x1378('0x27')]=function(_0x4f66ea,_0x46001b){var _0x4a5700={},_0x42fb0f={},_0x26c004={'count':0x0,'rows':[]};var _0x2b05ee=_[_0x1378('0x28')](db[_0x1378('0x29')][_0x1378('0x2a')],function(_0x1281c3){return{'name':_0x1281c3[_0x1378('0x2b')],'type':_0x1281c3[_0x1378('0x2c')][_0x1378('0x2d')]};});_0x42fb0f['model']=_['map'](_0x2b05ee,_0x1378('0x26'));_0x42fb0f['query']=_['keys'](_0x4f66ea[_0x1378('0x2e')]);_0x42fb0f[_0x1378('0x2f')]=_[_0x1378('0x30')](_0x42fb0f[_0x1378('0x31')],_0x42fb0f[_0x1378('0x2e')]);_0x4a5700[_0x1378('0x32')]=_['intersection'](_0x42fb0f[_0x1378('0x31')],qs[_0x1378('0x33')](_0x4f66ea['query']['fields']));_0x4a5700['attributes']=_0x4a5700[_0x1378('0x32')][_0x1378('0x34')]?_0x4a5700['attributes']:_0x42fb0f[_0x1378('0x31')];if(!_0x4f66ea[_0x1378('0x2e')]['hasOwnProperty'](_0x1378('0x35'))){_0x4a5700[_0x1378('0x36')]=qs['limit'](_0x4f66ea[_0x1378('0x2e')][_0x1378('0x36')]);_0x4a5700['offset']=qs[_0x1378('0x1d')](_0x4f66ea[_0x1378('0x2e')][_0x1378('0x1d')]);}_0x4a5700[_0x1378('0x37')]=qs[_0x1378('0x38')](_0x4f66ea['query'][_0x1378('0x38')]);_0x4a5700[_0x1378('0x39')]=qs[_0x1378('0x2f')](_[_0x1378('0x3a')](_0x4f66ea['query'],_0x42fb0f[_0x1378('0x2f')]),_0x2b05ee);if(_0x4f66ea[_0x1378('0x2e')][_0x1378('0x3b')]){_0x4a5700[_0x1378('0x39')]=_[_0x1378('0x3c')](_0x4a5700[_0x1378('0x39')],{'$or':_[_0x1378('0x28')](_0x2b05ee,function(_0x479c47){if(_0x479c47[_0x1378('0x2c')]!==_0x1378('0x3d')){var _0x338ef3={};_0x338ef3[_0x479c47['name']]={'$like':'%'+_0x4f66ea[_0x1378('0x2e')]['filter']+'%'};return _0x338ef3;}})});}_0x4a5700=_[_0x1378('0x3c')]({},_0x4a5700,_0x4f66ea[_0x1378('0x3e')]);var _0x1e970d={'where':_0x4a5700[_0x1378('0x39')]};return db[_0x1378('0x29')]['count'](_0x1e970d)['then'](function(_0x1616d8){_0x26c004[_0x1378('0x1c')]=_0x1616d8;if(_0x4f66ea[_0x1378('0x2e')][_0x1378('0x3f')]){_0x4a5700[_0x1378('0x40')]=[{'all':!![]}];}return db[_0x1378('0x29')][_0x1378('0x41')](_0x4a5700);})['then'](function(_0x38f892){_0x26c004['rows']=_0x38f892;return _0x26c004;})[_0x1378('0x23')](respondWithFilteredResult(_0x46001b,_0x4a5700))[_0x1378('0x42')](handleError(_0x46001b,null));};exports[_0x1378('0x43')]=function(_0x47ba19,_0x440eb8){var _0x255351={'raw':![],'where':{'id':_0x47ba19[_0x1378('0x44')]['id']}},_0x22c60f={};_0x22c60f[_0x1378('0x31')]=_[_0x1378('0x45')](db[_0x1378('0x29')][_0x1378('0x2a')]);_0x22c60f[_0x1378('0x2e')]=_[_0x1378('0x45')](_0x47ba19[_0x1378('0x2e')]);_0x22c60f[_0x1378('0x2f')]=_[_0x1378('0x30')](_0x22c60f[_0x1378('0x31')],_0x22c60f[_0x1378('0x2e')]);_0x255351['attributes']=_[_0x1378('0x30')](_0x22c60f['model'],qs[_0x1378('0x33')](_0x47ba19['query'][_0x1378('0x33')]));_0x255351[_0x1378('0x32')]=_0x255351['attributes'][_0x1378('0x34')]?_0x255351['attributes']:_0x22c60f[_0x1378('0x31')];if(_0x47ba19[_0x1378('0x2e')]['includeAll']){_0x255351['include']=[{'all':!![]}];}_0x255351=_[_0x1378('0x3c')]({},_0x255351,_0x47ba19[_0x1378('0x3e')]);return db[_0x1378('0x29')][_0x1378('0x46')](_0x255351)['then'](handleEntityNotFound(_0x440eb8,null))[_0x1378('0x23')](respondWithResult(_0x440eb8,null))[_0x1378('0x42')](handleError(_0x440eb8,null));};exports[_0x1378('0x47')]=function(_0x362593,_0x1f5757){return db[_0x1378('0x29')]['create'](_0x362593[_0x1378('0x48')],{})['then'](respondWithResult(_0x1f5757,0xc9))[_0x1378('0x42')](handleError(_0x1f5757,null));};exports[_0x1378('0x22')]=function(_0x1db798,_0x4304f8){if(_0x1db798['body']['id']){delete _0x1db798['body']['id'];}return db[_0x1378('0x29')][_0x1378('0x46')]({'where':{'id':_0x1db798['params']['id']}})['then'](handleEntityNotFound(_0x4304f8,null))[_0x1378('0x23')](saveUpdates(_0x1db798['body'],null))[_0x1378('0x23')](respondWithResult(_0x4304f8,null))[_0x1378('0x42')](handleError(_0x4304f8,null));};exports[_0x1378('0x49')]=function(_0xe400a3,_0x46f3f6){return db[_0x1378('0x29')]['find']({'where':{'id':_0xe400a3[_0x1378('0x44')]['id']}})[_0x1378('0x23')](handleEntityNotFound(_0x46f3f6,null))[_0x1378('0x23')](removeEntity(_0x46f3f6,null))[_0x1378('0x42')](handleError(_0x46f3f6,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 4452e80..b227d6c 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 _0xa037=['bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','moment'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xa037,0xa6));var _0x7a03=function(_0x1ebc4e,_0x9f13ca){_0x1ebc4e=_0x1ebc4e-0x0;var _0x1150e5=_0xa037[_0x1ebc4e];return _0x1150e5;};'use strict';var _=require(_0x7a03('0x0'));var util=require(_0x7a03('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7a03('0x2'));var BPromise=require(_0x7a03('0x3'));var rp=require(_0x7a03('0x4'));var fs=require('fs');var path=require(_0x7a03('0x5'));var rimraf=require(_0x7a03('0x6'));var config=require(_0x7a03('0x7'));var attributes=require(_0x7a03('0x8'));module[_0x7a03('0x9')]=function(_0x10341b,_0x45b485){return _0x10341b[_0x7a03('0xa')](_0x7a03('0xb'),attributes,{'tableName':_0x7a03('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19bc=['moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','util'];(function(_0x5364b6,_0x317f32){var _0x44ed9a=function(_0x577c64){while(--_0x577c64){_0x5364b6['push'](_0x5364b6['shift']());}};_0x44ed9a(++_0x317f32);}(_0x19bc,0xcf));var _0xc19b=function(_0x4ec788,_0x32fc44){_0x4ec788=_0x4ec788-0x0;var _0x9769a6=_0x19bc[_0x4ec788];return _0x9769a6;};'use strict';var _=require(_0xc19b('0x0'));var util=require(_0xc19b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc19b('0x2'));var BPromise=require(_0xc19b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc19b('0x4'));var rimraf=require(_0xc19b('0x5'));var config=require(_0xc19b('0x6'));var attributes=require(_0xc19b('0x7'));module[_0xc19b('0x8')]=function(_0x12ec09,_0x286121){return _0x12ec09['define'](_0xc19b('0x9'),attributes,{'tableName':_0xc19b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index c2237bc..275520b 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 _0xbe02=['debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','Integration,\x20%s,\x20%s','request\x20sent'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xbe02,0x124));var _0x2be0=function(_0x1f770f,_0x163473){_0x1f770f=_0x1f770f-0x0;var _0x339d31=_0xbe02[_0x1f770f];return _0x339d31;};'use strict';var _=require('lodash');var util=require(_0x2be0('0x0'));var moment=require(_0x2be0('0x1'));var BPromise=require(_0x2be0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2be0('0x3'))['db'];var utils=require(_0x2be0('0x4'));var logger=require('../../config/logger')(_0x2be0('0x5'));var config=require(_0x2be0('0x6'));var jayson=require(_0x2be0('0x7'));var client=jayson[_0x2be0('0x8')][_0x2be0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10c27b,_0x27c030,_0x484f21){return new BPromise(function(_0xdf1605,_0x186b3c){return client['request'](_0x10c27b,_0x484f21)['then'](function(_0xd08ceb){logger['info'](_0x2be0('0xa'),_0x27c030,_0x2be0('0xb'));logger[_0x2be0('0xc')](_0x2be0('0xd'),_0x27c030,_0x2be0('0xb'),JSON['stringify'](_0xd08ceb));if(_0xd08ceb[_0x2be0('0xe')]){if(_0xd08ceb[_0x2be0('0xe')][_0x2be0('0xf')]===0x1f4){logger[_0x2be0('0xe')]('Integration,\x20%s,\x20%s',_0x27c030,_0xd08ceb['error'][_0x2be0('0x10')]);return _0x186b3c(_0xd08ceb[_0x2be0('0xe')][_0x2be0('0x10')]);}logger[_0x2be0('0xe')]('Integration,\x20%s,\x20%s',_0x27c030,_0xd08ceb[_0x2be0('0xe')][_0x2be0('0x10')]);return _0xdf1605(_0xd08ceb[_0x2be0('0xe')][_0x2be0('0x10')]);}else{logger[_0x2be0('0x11')]('Integration,\x20%s,\x20%s',_0x27c030,_0x2be0('0xb'));_0xdf1605(_0xd08ceb['result'][_0x2be0('0x10')]);}})[_0x2be0('0x12')](function(_0x12de3f){logger[_0x2be0('0xe')](_0x2be0('0xa'),_0x27c030,_0x12de3f);_0x186b3c(_0x12de3f);});});} \ No newline at end of file +var _0x2234=['rpc','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f8382,_0x1ee671){var _0xb9cb2=function(_0x1ce702){while(--_0x1ce702){_0x1f8382['push'](_0x1f8382['shift']());}};_0xb9cb2(++_0x1ee671);}(_0x2234,0x16e));var _0x4223=function(_0x591053,_0x523072){_0x591053=_0x591053-0x0;var _0x31ab80=_0x2234[_0x591053];return _0x31ab80;};'use strict';var _=require(_0x4223('0x0'));var util=require(_0x4223('0x1'));var moment=require(_0x4223('0x2'));var BPromise=require(_0x4223('0x3'));var rs=require(_0x4223('0x4'));var fs=require('fs');var Redis=require(_0x4223('0x5'));var db=require(_0x4223('0x6'))['db'];var utils=require(_0x4223('0x7'));var logger=require(_0x4223('0x8'))(_0x4223('0x9'));var config=require('../../config/environment');var jayson=require(_0x4223('0xa'));var client=jayson['client'][_0x4223('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f1a2,_0x8ea996,_0x4e8325){return new BPromise(function(_0x5ec1b3,_0x55e81d){return client[_0x4223('0xc')](_0x4f1a2,_0x4e8325)[_0x4223('0xd')](function(_0xa8f28b){logger[_0x4223('0xe')](_0x4223('0xf'),_0x8ea996,'request\x20sent');logger[_0x4223('0x10')](_0x4223('0x11'),_0x8ea996,_0x4223('0x12'),JSON[_0x4223('0x13')](_0xa8f28b));if(_0xa8f28b[_0x4223('0x14')]){if(_0xa8f28b[_0x4223('0x14')][_0x4223('0x15')]===0x1f4){logger[_0x4223('0x14')]('Integration,\x20%s,\x20%s',_0x8ea996,_0xa8f28b[_0x4223('0x14')]['message']);return _0x55e81d(_0xa8f28b[_0x4223('0x14')]['message']);}logger[_0x4223('0x14')](_0x4223('0xf'),_0x8ea996,_0xa8f28b[_0x4223('0x14')]['message']);return _0x5ec1b3(_0xa8f28b['error']['message']);}else{logger[_0x4223('0xe')](_0x4223('0xf'),_0x8ea996,_0x4223('0x12'));_0x5ec1b3(_0xa8f28b[_0x4223('0x16')][_0x4223('0x17')]);}})[_0x4223('0x18')](function(_0x28219c){logger[_0x4223('0x14')](_0x4223('0xf'),_0x8ea996,_0x28219c);_0x55e81d(_0x28219c);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0e69a7c..d9b3332 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 _0xa149=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','exports','multer','util','path'];(function(_0x5c0e9c,_0x5a9bb0){var _0x4fd2fc=function(_0x12bf38){while(--_0x12bf38){_0x5c0e9c['push'](_0x5c0e9c['shift']());}};_0x4fd2fc(++_0x5a9bb0);}(_0xa149,0x18c));var _0x9a14=function(_0x1b6414,_0x3941f9){_0x1b6414=_0x1b6414-0x0;var _0x337b52=_0xa149[_0x1b6414];return _0x337b52;};'use strict';var multer=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var path=require(_0x9a14('0x2'));var timeout=require(_0x9a14('0x3'));var express=require(_0x9a14('0x4'));var router=express[_0x9a14('0x5')]();var auth=require(_0x9a14('0x6'));var interaction=require(_0x9a14('0x7'));var config=require(_0x9a14('0x8'));var controller=require('./integrationReport.controller');router[_0x9a14('0x9')]('/',auth[_0x9a14('0xa')](),controller['index']);router[_0x9a14('0x9')](_0x9a14('0xb'),auth[_0x9a14('0xa')](),controller[_0x9a14('0xc')]);router[_0x9a14('0x9')](_0x9a14('0xd'),auth['isAuthenticated'](),controller[_0x9a14('0xe')]);router['post']('/',auth[_0x9a14('0xa')](),controller[_0x9a14('0xf')]);router[_0x9a14('0x10')](_0x9a14('0xd'),auth[_0x9a14('0xa')](),controller[_0x9a14('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9a14('0x12')]=router; \ No newline at end of file +var _0x6b62=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','delete'];(function(_0x52c6bf,_0x29c95b){var _0x37fea0=function(_0xb23096){while(--_0xb23096){_0x52c6bf['push'](_0x52c6bf['shift']());}};_0x37fea0(++_0x29c95b);}(_0x6b62,0x73));var _0x26b6=function(_0x2a9035,_0x208940){_0x2a9035=_0x2a9035-0x0;var _0x47cb13=_0x6b62[_0x2a9035];return _0x47cb13;};'use strict';var multer=require(_0x26b6('0x0'));var util=require(_0x26b6('0x1'));var path=require(_0x26b6('0x2'));var timeout=require(_0x26b6('0x3'));var express=require(_0x26b6('0x4'));var router=express[_0x26b6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x26b6('0x6'));var config=require('../../config/environment');var controller=require(_0x26b6('0x7'));router[_0x26b6('0x8')]('/',auth[_0x26b6('0x9')](),controller[_0x26b6('0xa')]);router[_0x26b6('0x8')]('/describe',auth[_0x26b6('0x9')](),controller[_0x26b6('0xb')]);router[_0x26b6('0x8')]('/:id',auth[_0x26b6('0x9')](),controller[_0x26b6('0xc')]);router[_0x26b6('0xd')]('/',auth[_0x26b6('0x9')](),controller[_0x26b6('0xe')]);router[_0x26b6('0xf')](_0x26b6('0x10'),auth[_0x26b6('0x9')](),controller['update']);router[_0x26b6('0x11')]('/:id',auth[_0x26b6('0x9')](),controller['destroy']);module[_0x26b6('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4a0bfc8..4329580 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 _0x90e6=['INTEGER','DATE','BOOLEAN','TEXT','sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x90e6,0xcf));var _0x690e=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x90e6[_0x54b062];return _0x255e41;};'use strict';var Sequelize=require(_0x690e('0x0'));module[_0x690e('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x690e('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x690e('0x3')]},'contacts':{'type':Sequelize[_0x690e('0x2')]},'uniqueid':{'type':Sequelize[_0x690e('0x2')]},'calleridnum':{'type':Sequelize[_0x690e('0x2')]},'calleridname':{'type':Sequelize[_0x690e('0x2')]},'queue':{'type':Sequelize[_0x690e('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x690e('0x4')]},'agentconnectAt':{'type':Sequelize[_0x690e('0x4')]},'holdtime':{'type':Sequelize[_0x690e('0x3')]},'agentcomplete':{'type':Sequelize[_0x690e('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x690e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x690e('0x3')]},'reason':{'type':Sequelize[_0x690e('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x690e('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x690e('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x690e('0x4')]},'lastevent':{'type':Sequelize[_0x690e('0x2')]},'channel':{'type':Sequelize[_0x690e('0x2')]},'channelstate':{'type':Sequelize[_0x690e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x690e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x690e('0x2')]},'connectedlinename':{'type':Sequelize[_0x690e('0x2')]},'language':{'type':Sequelize[_0x690e('0x2')]},'accountcode':{'type':Sequelize[_0x690e('0x2')]},'context':{'type':Sequelize[_0x690e('0x2')]},'exten':{'type':Sequelize[_0x690e('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x690e('0x2')]},'destchannelstate':{'type':Sequelize[_0x690e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x690e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x690e('0x2')]},'destcalleridname':{'type':Sequelize[_0x690e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x690e('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x690e('0x2')]},'destcontext':{'type':Sequelize[_0x690e('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x690e('0x2')]},'destuniqueid':{'type':Sequelize[_0x690e('0x2')]},'messageId':{'type':Sequelize[_0x690e('0x2')]},'inReplyTo':{'type':Sequelize[_0x690e('0x2')]},'subject':{'type':Sequelize[_0x690e('0x2')]},'from':{'type':Sequelize[_0x690e('0x2')]},'to':{'type':Sequelize[_0x690e('0x2')]},'cc':{'type':Sequelize[_0x690e('0x2')]},'attachment':{'type':Sequelize[_0x690e('0x6')]},'html':{'type':Sequelize[_0x690e('0x6')]},'text':{'type':Sequelize[_0x690e('0x6')]},'status':{'type':Sequelize['ENUM']('SENT','SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0x690e('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc3d0=['BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE'];(function(_0x4ddd07,_0x5cf3e8){var _0x6f4068=function(_0x5337a2){while(--_0x5337a2){_0x4ddd07['push'](_0x4ddd07['shift']());}};_0x6f4068(++_0x5cf3e8);}(_0xc3d0,0x1b4));var _0x0c3d=function(_0x24bf9b,_0x466a5e){_0x24bf9b=_0x24bf9b-0x0;var _0x5eb58b=_0xc3d0[_0x24bf9b];return _0x5eb58b;};'use strict';var Sequelize=require('sequelize');module[_0x0c3d('0x0')]={'integration':{'type':Sequelize[_0x0c3d('0x1')]},'eventChannel':{'type':Sequelize[_0x0c3d('0x1')]},'exitStatus':{'type':Sequelize[_0x0c3d('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x0c3d('0x2')]},'contacts':{'type':Sequelize[_0x0c3d('0x1')]},'uniqueid':{'type':Sequelize[_0x0c3d('0x1')]},'calleridnum':{'type':Sequelize[_0x0c3d('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0c3d('0x1')]},'agentcalledAt':{'type':Sequelize[_0x0c3d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0c3d('0x3')]},'holdtime':{'type':Sequelize[_0x0c3d('0x2')]},'agentcomplete':{'type':Sequelize[_0x0c3d('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0c3d('0x3')]},'talktime':{'type':Sequelize[_0x0c3d('0x2')]},'agentacw':{'type':Sequelize[_0x0c3d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0c3d('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x0c3d('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0c3d('0x3')]},'agentdump':{'type':Sequelize[_0x0c3d('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0c3d('0x3')]},'lastevent':{'type':Sequelize[_0x0c3d('0x1')]},'channel':{'type':Sequelize[_0x0c3d('0x1')]},'channelstate':{'type':Sequelize[_0x0c3d('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0c3d('0x1')]},'connectedlinename':{'type':Sequelize[_0x0c3d('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0c3d('0x1')]},'context':{'type':Sequelize[_0x0c3d('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x0c3d('0x1')]},'destchannelstate':{'type':Sequelize[_0x0c3d('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x0c3d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x0c3d('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0c3d('0x1')]},'destlanguage':{'type':Sequelize[_0x0c3d('0x1')]},'destaccountcode':{'type':Sequelize[_0x0c3d('0x1')]},'destcontext':{'type':Sequelize[_0x0c3d('0x1')]},'destexten':{'type':Sequelize[_0x0c3d('0x1')]},'destpriority':{'type':Sequelize[_0x0c3d('0x1')]},'destuniqueid':{'type':Sequelize[_0x0c3d('0x1')]},'messageId':{'type':Sequelize[_0x0c3d('0x1')]},'inReplyTo':{'type':Sequelize[_0x0c3d('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x0c3d('0x1')]},'attachment':{'type':Sequelize[_0x0c3d('0x5')]},'html':{'type':Sequelize[_0x0c3d('0x5')]},'text':{'type':Sequelize[_0x0c3d('0x5')]},'status':{'type':Sequelize['ENUM'](_0x0c3d('0x6'),_0x0c3d('0x7'),_0x0c3d('0x8'),_0x0c3d('0x9'))},'url':{'type':Sequelize[_0x0c3d('0x1')]},'app':{'type':Sequelize[_0x0c3d('0x1')]},'appdata':{'type':Sequelize[_0x0c3d('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8adf0d8..1f95384 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 _0x7e74=['filters','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','attributes','includeAll','body','destroy','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','IntegrationReport','rawAttributes','type','key','model','map','query','keys'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x7e74,0x1c9));var _0x47e7=function(_0x9ec725,_0x15f9d9){_0x9ec725=_0x9ec725-0x0;var _0x3692d0=_0x7e74[_0x9ec725];return _0x3692d0;};'use strict';var pdf=require(_0x47e7('0x0'));var emlformat=require(_0x47e7('0x1'));var rimraf=require(_0x47e7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47e7('0x3'));var rp=require(_0x47e7('0x4'));var moment=require(_0x47e7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x47e7('0x6'));var util=require(_0x47e7('0x7'));var path=require(_0x47e7('0x8'));var sox=require(_0x47e7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x47e7('0xa'));var squel=require(_0x47e7('0xb'));var crypto=require(_0x47e7('0xc'));var jsforce=require(_0x47e7('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x47e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x47e7('0xf'));var as=require(_0x47e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47e7('0x11'))('api');var utils=require(_0x47e7('0x12'));var config=require(_0x47e7('0x13'));var db=require(_0x47e7('0x14'))['db'];function respondWithStatusCode(_0x3f0cce,_0x2d4ee3){_0x2d4ee3=_0x2d4ee3||0xcc;return function(_0x369395){if(_0x369395){return _0x3f0cce[_0x47e7('0x15')](_0x2d4ee3);}return _0x3f0cce[_0x47e7('0x16')](_0x2d4ee3)[_0x47e7('0x17')]();};}function respondWithResult(_0x1ff127,_0x45a587){_0x45a587=_0x45a587||0xc8;return function(_0x55e1e2){if(_0x55e1e2){return _0x1ff127[_0x47e7('0x16')](_0x45a587)[_0x47e7('0x18')](_0x55e1e2);}};}function respondWithFilteredResult(_0x1bf45a,_0x45d264){return function(_0x305400){if(_0x305400){var _0xef978b=_0x305400[_0x47e7('0x19')],_0x28a2df=_0x45d264['offset'],_0x20dfe6=_0x45d264[_0x47e7('0x1a')]+_0x45d264[_0x47e7('0x1b')],_0x17ea36;if(_0x20dfe6>=_0xef978b){_0x20dfe6=_0xef978b;_0x17ea36=0xc8;}else{_0x17ea36=0xce;}_0x1bf45a[_0x47e7('0x16')](_0x17ea36);return _0x1bf45a[_0x47e7('0x1c')](_0x47e7('0x1d'),_0x28a2df+'-'+_0x20dfe6+'/'+_0xef978b)[_0x47e7('0x18')](_0x305400);}return null;};}function patchUpdates(_0x127a73){return function(_0x45901b){try{jsonpatch[_0x47e7('0x1e')](_0x45901b,_0x127a73,!![]);}catch(_0x316910){return BPromise[_0x47e7('0x1f')](_0x316910);}return _0x45901b[_0x47e7('0x20')]();};}function saveUpdates(_0x6c13fa,_0xcd5000){return function(_0x421c12){if(_0x421c12){return _0x421c12[_0x47e7('0x21')](_0x6c13fa)[_0x47e7('0x22')](function(_0x2931c0){return _0x2931c0;});}return null;};}function removeEntity(_0x266488,_0x3ad431){return function(_0x38e8e3){if(_0x38e8e3){return _0x38e8e3['destroy']()[_0x47e7('0x22')](function(){_0x266488[_0x47e7('0x16')](0xcc)[_0x47e7('0x17')]();});}};}function handleEntityNotFound(_0x591b6f,_0x4dc38d){return function(_0x227e24){if(!_0x227e24){_0x591b6f['sendStatus'](0x194);}return _0x227e24;};}function handleError(_0x58d811,_0xe8ce78){_0xe8ce78=_0xe8ce78||0x1f4;return function(_0x450e04){logger[_0x47e7('0x23')](_0x450e04[_0x47e7('0x24')]);if(_0x450e04[_0x47e7('0x25')]){delete _0x450e04['name'];}_0x58d811[_0x47e7('0x16')](_0xe8ce78)['send'](_0x450e04);};}exports[_0x47e7('0x26')]=function(_0x3f1023,_0x1cbd91){var _0x3be45f={},_0x2f347f={},_0x3b6980={'count':0x0,'rows':[]};var _0x549d23=_['map'](db[_0x47e7('0x27')][_0x47e7('0x28')],function(_0x72525a){return{'name':_0x72525a['fieldName'],'type':_0x72525a[_0x47e7('0x29')][_0x47e7('0x2a')]};});_0x2f347f[_0x47e7('0x2b')]=_[_0x47e7('0x2c')](_0x549d23,_0x47e7('0x25'));_0x2f347f[_0x47e7('0x2d')]=_[_0x47e7('0x2e')](_0x3f1023[_0x47e7('0x2d')]);_0x2f347f[_0x47e7('0x2f')]=_[_0x47e7('0x30')](_0x2f347f[_0x47e7('0x2b')],_0x2f347f['query']);_0x3be45f['attributes']=_[_0x47e7('0x30')](_0x2f347f[_0x47e7('0x2b')],qs[_0x47e7('0x31')](_0x3f1023[_0x47e7('0x2d')]['fields']));_0x3be45f['attributes']=_0x3be45f['attributes'][_0x47e7('0x32')]?_0x3be45f['attributes']:_0x2f347f[_0x47e7('0x2b')];if(!_0x3f1023[_0x47e7('0x2d')][_0x47e7('0x33')](_0x47e7('0x34'))){_0x3be45f['limit']=qs[_0x47e7('0x1b')](_0x3f1023[_0x47e7('0x2d')][_0x47e7('0x1b')]);_0x3be45f[_0x47e7('0x1a')]=qs[_0x47e7('0x1a')](_0x3f1023[_0x47e7('0x2d')][_0x47e7('0x1a')]);}_0x3be45f['order']=qs[_0x47e7('0x35')](_0x3f1023[_0x47e7('0x2d')][_0x47e7('0x35')]);_0x3be45f[_0x47e7('0x36')]=qs[_0x47e7('0x2f')](_[_0x47e7('0x37')](_0x3f1023[_0x47e7('0x2d')],_0x2f347f[_0x47e7('0x2f')]),_0x549d23);if(_0x3f1023['query'][_0x47e7('0x38')]){_0x3be45f['where']=_['merge'](_0x3be45f[_0x47e7('0x36')],{'$or':_[_0x47e7('0x2c')](_0x549d23,function(_0x47557e){if(_0x47557e['type']!==_0x47e7('0x39')){var _0x44eaf1={};_0x44eaf1[_0x47557e['name']]={'$like':'%'+_0x3f1023[_0x47e7('0x2d')][_0x47e7('0x38')]+'%'};return _0x44eaf1;}})});}_0x3be45f=_[_0x47e7('0x3a')]({},_0x3be45f,_0x3f1023[_0x47e7('0x3b')]);var _0x5a2140={'where':_0x3be45f[_0x47e7('0x36')]};return db[_0x47e7('0x27')][_0x47e7('0x19')](_0x5a2140)[_0x47e7('0x22')](function(_0x31f403){_0x3b6980[_0x47e7('0x19')]=_0x31f403;if(_0x3f1023[_0x47e7('0x2d')]['includeAll']){_0x3be45f[_0x47e7('0x3c')]=[{'all':!![]}];}return db[_0x47e7('0x27')][_0x47e7('0x3d')](_0x3be45f);})['then'](function(_0x135927){_0x3b6980[_0x47e7('0x3e')]=_0x135927;return _0x3b6980;})[_0x47e7('0x22')](respondWithFilteredResult(_0x1cbd91,_0x3be45f))[_0x47e7('0x3f')](handleError(_0x1cbd91,null));};exports[_0x47e7('0x40')]=function(_0x3bcd8d,_0x3e0a7a){var _0x21eac6={'raw':![],'where':{'id':_0x3bcd8d[_0x47e7('0x41')]['id']}},_0x423511={};_0x423511[_0x47e7('0x2b')]=_[_0x47e7('0x2e')](db[_0x47e7('0x27')][_0x47e7('0x28')]);_0x423511[_0x47e7('0x2d')]=_[_0x47e7('0x2e')](_0x3bcd8d[_0x47e7('0x2d')]);_0x423511[_0x47e7('0x2f')]=_['intersection'](_0x423511[_0x47e7('0x2b')],_0x423511[_0x47e7('0x2d')]);_0x21eac6['attributes']=_['intersection'](_0x423511[_0x47e7('0x2b')],qs[_0x47e7('0x31')](_0x3bcd8d[_0x47e7('0x2d')][_0x47e7('0x31')]));_0x21eac6[_0x47e7('0x42')]=_0x21eac6[_0x47e7('0x42')]['length']?_0x21eac6['attributes']:_0x423511[_0x47e7('0x2b')];if(_0x3bcd8d[_0x47e7('0x2d')][_0x47e7('0x43')]){_0x21eac6['include']=[{'all':!![]}];}_0x21eac6=_['merge']({},_0x21eac6,_0x3bcd8d[_0x47e7('0x3b')]);return db[_0x47e7('0x27')]['find'](_0x21eac6)[_0x47e7('0x22')](handleEntityNotFound(_0x3e0a7a,null))[_0x47e7('0x22')](respondWithResult(_0x3e0a7a,null))[_0x47e7('0x3f')](handleError(_0x3e0a7a,null));};exports['create']=function(_0x7fc5db,_0x46a0d7){return db[_0x47e7('0x27')]['create'](_0x7fc5db[_0x47e7('0x44')],{})['then'](respondWithResult(_0x46a0d7,0xc9))[_0x47e7('0x3f')](handleError(_0x46a0d7,null));};exports[_0x47e7('0x21')]=function(_0x422726,_0x3c425b){if(_0x422726[_0x47e7('0x44')]['id']){delete _0x422726[_0x47e7('0x44')]['id'];}return db[_0x47e7('0x27')]['find']({'where':{'id':_0x422726[_0x47e7('0x41')]['id']}})[_0x47e7('0x22')](handleEntityNotFound(_0x3c425b,null))[_0x47e7('0x22')](saveUpdates(_0x422726[_0x47e7('0x44')],null))[_0x47e7('0x22')](respondWithResult(_0x3c425b,null))[_0x47e7('0x3f')](handleError(_0x3c425b,null));};exports[_0x47e7('0x45')]=function(_0x3b7a44,_0x1ab1f2){return db[_0x47e7('0x27')][_0x47e7('0x46')]({'where':{'id':_0x3b7a44[_0x47e7('0x41')]['id']}})[_0x47e7('0x22')](handleEntityNotFound(_0x1ab1f2,null))[_0x47e7('0x22')](removeEntity(_0x1ab1f2,null))[_0x47e7('0x3f')](handleError(_0x1ab1f2,null));};exports[_0x47e7('0x47')]=function(_0x12f734,_0x3aa8d9){return db[_0x47e7('0x27')][_0x47e7('0x47')]()[_0x47e7('0x22')](respondWithResult(_0x3aa8d9,null))[_0x47e7('0x3f')](handleError(_0x3aa8d9,null));}; \ No newline at end of file +var _0x14aa=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','IntegrationReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','where','filter','VIRTUAL','merge','options','count','includeAll','findAll','catch','params','rawAttributes','length','include','create','body','find','describe','html-pdf','eml-format'];(function(_0xb2257a,_0xf5e937){var _0x579659=function(_0x5e4c9c){while(--_0x5e4c9c){_0xb2257a['push'](_0xb2257a['shift']());}};_0x579659(++_0xf5e937);}(_0x14aa,0x1ae));var _0xa14a=function(_0x283684,_0x560678){_0x283684=_0x283684-0x0;var _0x246d29=_0x14aa[_0x283684];return _0x246d29;};'use strict';var pdf=require(_0xa14a('0x0'));var emlformat=require(_0xa14a('0x1'));var rimraf=require(_0xa14a('0x2'));var zipdir=require(_0xa14a('0x3'));var jsonpatch=require(_0xa14a('0x4'));var rp=require(_0xa14a('0x5'));var moment=require(_0xa14a('0x6'));var BPromise=require(_0xa14a('0x7'));var Mustache=require('mustache');var util=require(_0xa14a('0x8'));var path=require('path');var sox=require(_0xa14a('0x9'));var csv=require(_0xa14a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa14a('0xb'));var crypto=require(_0xa14a('0xc'));var jsforce=require(_0xa14a('0xd'));var deskjs=require(_0xa14a('0xe'));var toCsv=require(_0xa14a('0xa'));var querystring=require(_0xa14a('0xf'));var Papa=require(_0xa14a('0x10'));var Redis=require(_0xa14a('0x11'));var authService=require(_0xa14a('0x12'));var qs=require(_0xa14a('0x13'));var as=require(_0xa14a('0x14'));var hardwareService=require(_0xa14a('0x15'));var logger=require(_0xa14a('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa14a('0x17'))['db'];function respondWithStatusCode(_0x160d2c,_0x1dba5f){_0x1dba5f=_0x1dba5f||0xcc;return function(_0x2a34b9){if(_0x2a34b9){return _0x160d2c['sendStatus'](_0x1dba5f);}return _0x160d2c['status'](_0x1dba5f)[_0xa14a('0x18')]();};}function respondWithResult(_0x1801cf,_0x5045b7){_0x5045b7=_0x5045b7||0xc8;return function(_0x455161){if(_0x455161){return _0x1801cf[_0xa14a('0x19')](_0x5045b7)[_0xa14a('0x1a')](_0x455161);}};}function respondWithFilteredResult(_0x13daab,_0x1c8ade){return function(_0x18b13b){if(_0x18b13b){var _0x332648=_0x18b13b['count'],_0x187d33=_0x1c8ade[_0xa14a('0x1b')],_0x2e4c44=_0x1c8ade['offset']+_0x1c8ade[_0xa14a('0x1c')],_0x16894d;if(_0x2e4c44>=_0x332648){_0x2e4c44=_0x332648;_0x16894d=0xc8;}else{_0x16894d=0xce;}_0x13daab[_0xa14a('0x19')](_0x16894d);return _0x13daab[_0xa14a('0x1d')](_0xa14a('0x1e'),_0x187d33+'-'+_0x2e4c44+'/'+_0x332648)[_0xa14a('0x1a')](_0x18b13b);}return null;};}function patchUpdates(_0x4c720e){return function(_0xf46c8){try{jsonpatch[_0xa14a('0x1f')](_0xf46c8,_0x4c720e,!![]);}catch(_0x4d2d8e){return BPromise[_0xa14a('0x20')](_0x4d2d8e);}return _0xf46c8[_0xa14a('0x21')]();};}function saveUpdates(_0x288396,_0x4cbfb6){return function(_0x313053){if(_0x313053){return _0x313053[_0xa14a('0x22')](_0x288396)['then'](function(_0x3d0098){return _0x3d0098;});}return null;};}function removeEntity(_0x208edf,_0xd61916){return function(_0x3faea6){if(_0x3faea6){return _0x3faea6[_0xa14a('0x23')]()[_0xa14a('0x24')](function(){_0x208edf[_0xa14a('0x19')](0xcc)[_0xa14a('0x18')]();});}};}function handleEntityNotFound(_0x5dfd49,_0x57b448){return function(_0x3cca92){if(!_0x3cca92){_0x5dfd49[_0xa14a('0x25')](0x194);}return _0x3cca92;};}function handleError(_0xa9066d,_0x429356){_0x429356=_0x429356||0x1f4;return function(_0x36c8e2){logger[_0xa14a('0x26')](_0x36c8e2[_0xa14a('0x27')]);if(_0x36c8e2[_0xa14a('0x28')]){delete _0x36c8e2[_0xa14a('0x28')];}_0xa9066d[_0xa14a('0x19')](_0x429356)[_0xa14a('0x29')](_0x36c8e2);};}exports['index']=function(_0x24a9eb,_0x58eadb){var _0x1c3ba6={},_0x1dd1d3={},_0x1357c8={'count':0x0,'rows':[]};var _0x3c9e45=_[_0xa14a('0x2a')](db[_0xa14a('0x2b')]['rawAttributes'],function(_0x37b637){return{'name':_0x37b637[_0xa14a('0x2c')],'type':_0x37b637[_0xa14a('0x2d')][_0xa14a('0x2e')]};});_0x1dd1d3[_0xa14a('0x2f')]=_[_0xa14a('0x2a')](_0x3c9e45,_0xa14a('0x28'));_0x1dd1d3['query']=_[_0xa14a('0x30')](_0x24a9eb[_0xa14a('0x31')]);_0x1dd1d3[_0xa14a('0x32')]=_[_0xa14a('0x33')](_0x1dd1d3[_0xa14a('0x2f')],_0x1dd1d3[_0xa14a('0x31')]);_0x1c3ba6['attributes']=_[_0xa14a('0x33')](_0x1dd1d3['model'],qs['fields'](_0x24a9eb[_0xa14a('0x31')][_0xa14a('0x34')]));_0x1c3ba6[_0xa14a('0x35')]=_0x1c3ba6[_0xa14a('0x35')]['length']?_0x1c3ba6[_0xa14a('0x35')]:_0x1dd1d3[_0xa14a('0x2f')];if(!_0x24a9eb[_0xa14a('0x31')][_0xa14a('0x36')]('nolimit')){_0x1c3ba6[_0xa14a('0x1c')]=qs[_0xa14a('0x1c')](_0x24a9eb[_0xa14a('0x31')][_0xa14a('0x1c')]);_0x1c3ba6[_0xa14a('0x1b')]=qs['offset'](_0x24a9eb[_0xa14a('0x31')][_0xa14a('0x1b')]);}_0x1c3ba6['order']=qs['sort'](_0x24a9eb[_0xa14a('0x31')]['sort']);_0x1c3ba6[_0xa14a('0x37')]=qs['filters'](_['pick'](_0x24a9eb[_0xa14a('0x31')],_0x1dd1d3[_0xa14a('0x32')]),_0x3c9e45);if(_0x24a9eb[_0xa14a('0x31')][_0xa14a('0x38')]){_0x1c3ba6[_0xa14a('0x37')]=_['merge'](_0x1c3ba6[_0xa14a('0x37')],{'$or':_['map'](_0x3c9e45,function(_0x401e13){if(_0x401e13[_0xa14a('0x2d')]!==_0xa14a('0x39')){var _0x4ec771={};_0x4ec771[_0x401e13[_0xa14a('0x28')]]={'$like':'%'+_0x24a9eb['query'][_0xa14a('0x38')]+'%'};return _0x4ec771;}})});}_0x1c3ba6=_[_0xa14a('0x3a')]({},_0x1c3ba6,_0x24a9eb[_0xa14a('0x3b')]);var _0x1c2438={'where':_0x1c3ba6[_0xa14a('0x37')]};return db[_0xa14a('0x2b')][_0xa14a('0x3c')](_0x1c2438)[_0xa14a('0x24')](function(_0x23a40d){_0x1357c8[_0xa14a('0x3c')]=_0x23a40d;if(_0x24a9eb['query'][_0xa14a('0x3d')]){_0x1c3ba6['include']=[{'all':!![]}];}return db[_0xa14a('0x2b')][_0xa14a('0x3e')](_0x1c3ba6);})['then'](function(_0x1e6bbd){_0x1357c8['rows']=_0x1e6bbd;return _0x1357c8;})['then'](respondWithFilteredResult(_0x58eadb,_0x1c3ba6))[_0xa14a('0x3f')](handleError(_0x58eadb,null));};exports['show']=function(_0x416a4a,_0x369199){var _0x5769ea={'raw':![],'where':{'id':_0x416a4a[_0xa14a('0x40')]['id']}},_0xb5d689={};_0xb5d689['model']=_[_0xa14a('0x30')](db[_0xa14a('0x2b')][_0xa14a('0x41')]);_0xb5d689['query']=_[_0xa14a('0x30')](_0x416a4a[_0xa14a('0x31')]);_0xb5d689['filters']=_[_0xa14a('0x33')](_0xb5d689[_0xa14a('0x2f')],_0xb5d689['query']);_0x5769ea[_0xa14a('0x35')]=_['intersection'](_0xb5d689['model'],qs[_0xa14a('0x34')](_0x416a4a[_0xa14a('0x31')][_0xa14a('0x34')]));_0x5769ea[_0xa14a('0x35')]=_0x5769ea[_0xa14a('0x35')][_0xa14a('0x42')]?_0x5769ea[_0xa14a('0x35')]:_0xb5d689['model'];if(_0x416a4a[_0xa14a('0x31')][_0xa14a('0x3d')]){_0x5769ea[_0xa14a('0x43')]=[{'all':!![]}];}_0x5769ea=_[_0xa14a('0x3a')]({},_0x5769ea,_0x416a4a[_0xa14a('0x3b')]);return db[_0xa14a('0x2b')]['find'](_0x5769ea)[_0xa14a('0x24')](handleEntityNotFound(_0x369199,null))[_0xa14a('0x24')](respondWithResult(_0x369199,null))['catch'](handleError(_0x369199,null));};exports[_0xa14a('0x44')]=function(_0x4e7c3c,_0x25699e){return db[_0xa14a('0x2b')][_0xa14a('0x44')](_0x4e7c3c[_0xa14a('0x45')],{})['then'](respondWithResult(_0x25699e,0xc9))[_0xa14a('0x3f')](handleError(_0x25699e,null));};exports[_0xa14a('0x22')]=function(_0x1bb4c8,_0x2ef5a1){if(_0x1bb4c8[_0xa14a('0x45')]['id']){delete _0x1bb4c8[_0xa14a('0x45')]['id'];}return db['IntegrationReport'][_0xa14a('0x46')]({'where':{'id':_0x1bb4c8[_0xa14a('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ef5a1,null))[_0xa14a('0x24')](saveUpdates(_0x1bb4c8[_0xa14a('0x45')],null))[_0xa14a('0x24')](respondWithResult(_0x2ef5a1,null))[_0xa14a('0x3f')](handleError(_0x2ef5a1,null));};exports['destroy']=function(_0x520896,_0x4eb7ab){return db[_0xa14a('0x2b')][_0xa14a('0x46')]({'where':{'id':_0x520896['params']['id']}})['then'](handleEntityNotFound(_0x4eb7ab,null))[_0xa14a('0x24')](removeEntity(_0x4eb7ab,null))['catch'](handleError(_0x4eb7ab,null));};exports[_0xa14a('0x47')]=function(_0x160a75,_0x2cdeab){return db[_0xa14a('0x2b')][_0xa14a('0x47')]()['then'](respondWithResult(_0x2cdeab,null))[_0xa14a('0x3f')](handleError(_0x2cdeab,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7be06d6..6d59365 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 _0xd97a=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash'];(function(_0x14a54f,_0x25b31b){var _0x17ca68=function(_0x5ab6e8){while(--_0x5ab6e8){_0x14a54f['push'](_0x14a54f['shift']());}};_0x17ca68(++_0x25b31b);}(_0xd97a,0x15b));var _0xad97=function(_0x28d833,_0x4277bd){_0x28d833=_0x28d833-0x0;var _0x7efd99=_0xd97a[_0x28d833];return _0x7efd99;};'use strict';var _=require(_0xad97('0x0'));var util=require(_0xad97('0x1'));var logger=require('../../config/logger')(_0xad97('0x2'));var moment=require(_0xad97('0x3'));var BPromise=require(_0xad97('0x4'));var rp=require(_0xad97('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad97('0x6'));var config=require(_0xad97('0x7'));var attributes=require(_0xad97('0x8'));module[_0xad97('0x9')]=function(_0xc9ba0e,_0x3b71cb){return _0xc9ba0e[_0xad97('0xa')]('IntegrationReport',attributes,{'tableName':_0xad97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00c8=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x340e76,_0x58a10d){var _0x7467e9=function(_0x4c1ac3){while(--_0x4c1ac3){_0x340e76['push'](_0x340e76['shift']());}};_0x7467e9(++_0x58a10d);}(_0x00c8,0xcb));var _0x800c=function(_0xba21d1,_0x5ea074){_0xba21d1=_0xba21d1-0x0;var _0xad42b6=_0x00c8[_0xba21d1];return _0xad42b6;};'use strict';var _=require(_0x800c('0x0'));var util=require(_0x800c('0x1'));var logger=require(_0x800c('0x2'))(_0x800c('0x3'));var moment=require(_0x800c('0x4'));var BPromise=require(_0x800c('0x5'));var rp=require(_0x800c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x800c('0x7'));var config=require(_0x800c('0x8'));var attributes=require(_0x800c('0x9'));module[_0x800c('0xa')]=function(_0x310fc8,_0x2b3f54){return _0x310fc8[_0x800c('0xb')](_0x800c('0xc'),attributes,{'tableName':_0x800c('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 f6cfc50..0a018ac 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 _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x4fc2,0x111));var _0x24fc=function(_0x58eb93,_0x3b8263){_0x58eb93=_0x58eb93-0x0;var _0xc0d5c0=_0x4fc2[_0x58eb93];return _0xc0d5c0;};'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')]('IntegrationReport,\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')]('IntegrationReport,\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 +var _0x0713=['IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x480a68,_0x3ecad5){var _0xfd893a=function(_0x11ad6b){while(--_0x11ad6b){_0x480a68['push'](_0x480a68['shift']());}};_0xfd893a(++_0x3ecad5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 21990c7..db56f1e 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 _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x5cf087,_0x54db5d){var _0xc6cd28=function(_0x2a1633){while(--_0x2a1633){_0x5cf087['push'](_0x5cf087['shift']());}};_0xc6cd28(++_0x54db5d);}(_0x008c,0x188));var _0xc008=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0x008c[_0x3d78d7];return _0x4b6784;};'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 auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x115e4a,_0x2d1d31){var _0x143795=function(_0x57d127){while(--_0x57d127){_0x115e4a['push'](_0x115e4a['shift']());}};_0x143795(++_0x2d1d31);}(_0x008c,0x188));var _0xc008=function(_0x23f4cc,_0x4b6d1a){_0x23f4cc=_0x23f4cc-0x0;var _0x8d3d1a=_0x008c[_0x23f4cc];return _0x8d3d1a;};'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 auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('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 be609a7..b0acdac 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 _0xfc0d=['sequelize','exports','STRING'];(function(_0x543d4f,_0x471d27){var _0x491997=function(_0xd490bd){while(--_0xd490bd){_0x543d4f['push'](_0x543d4f['shift']());}};_0x491997(++_0x471d27);}(_0xfc0d,0x1ad));var _0xdfc0=function(_0x11ecb7,_0x4d5fe1){_0x11ecb7=_0x11ecb7-0x0;var _0x5dad3c=_0xfc0d[_0x11ecb7];return _0x5dad3c;};'use strict';var Sequelize=require(_0xdfc0('0x0'));module[_0xdfc0('0x1')]={'name':{'type':Sequelize[_0xdfc0('0x2')]},'description':{'type':Sequelize[_0xdfc0('0x2')]},'interval':{'type':Sequelize[_0xdfc0('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x82ca=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x82ca,0xa6));var _0xa82c=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x82ca[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0xa82c('0x0'));module[_0xa82c('0x1')]={'name':{'type':Sequelize[_0xa82c('0x2')]},'description':{'type':Sequelize[_0xa82c('0x2')]},'interval':{'type':Sequelize[_0xa82c('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c2b724a..c12e642 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 _0xf498=['status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','send','map','Interval','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','count','include','findAll','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','bulkCreate','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus'];(function(_0xd72084,_0x3a9ed2){var _0x4328ad=function(_0x277d35){while(--_0x277d35){_0xd72084['push'](_0xd72084['shift']());}};_0x4328ad(++_0x3a9ed2);}(_0xf498,0x9b));var _0x8f49=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xf498[_0xb24a3e];return _0x4038d7;};'use strict';var pdf=require(_0x8f49('0x0'));var emlformat=require(_0x8f49('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f49('0x3'));var moment=require(_0x8f49('0x4'));var BPromise=require(_0x8f49('0x5'));var Mustache=require(_0x8f49('0x6'));var util=require(_0x8f49('0x7'));var path=require(_0x8f49('0x8'));var sox=require(_0x8f49('0x9'));var csv=require(_0x8f49('0xa'));var ejs=require(_0x8f49('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8f49('0xc'));var crypto=require(_0x8f49('0xd'));var jsforce=require(_0x8f49('0xe'));var deskjs=require(_0x8f49('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8f49('0x10'));var Papa=require('papaparse');var Redis=require(_0x8f49('0x11'));var authService=require(_0x8f49('0x12'));var qs=require(_0x8f49('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f49('0x14'));var logger=require(_0x8f49('0x15'))(_0x8f49('0x16'));var utils=require(_0x8f49('0x17'));var config=require(_0x8f49('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0x8f49('0x19'));function respondWithStatusCode(_0x1cc452,_0x482940){_0x482940=_0x482940||0xcc;return function(_0x30801c){if(_0x30801c){return _0x1cc452[_0x8f49('0x1a')](_0x482940);}return _0x1cc452[_0x8f49('0x1b')](_0x482940)['end']();};}function respondWithResult(_0x20207c,_0x53a23d){_0x53a23d=_0x53a23d||0xc8;return function(_0x3d25e0){if(_0x3d25e0){return _0x20207c[_0x8f49('0x1b')](_0x53a23d)[_0x8f49('0x1c')](_0x3d25e0);}};}function respondWithFilteredResult(_0x250f9b,_0x2a05e9){return function(_0x5046d3){if(_0x5046d3){var _0x5928d6=_0x5046d3['count'],_0x1f950a=_0x2a05e9[_0x8f49('0x1d')],_0x2e781e=_0x2a05e9[_0x8f49('0x1d')]+_0x2a05e9['limit'],_0x93085e;if(_0x2e781e>=_0x5928d6){_0x2e781e=_0x5928d6;_0x93085e=0xc8;}else{_0x93085e=0xce;}_0x250f9b['status'](_0x93085e);return _0x250f9b[_0x8f49('0x1e')](_0x8f49('0x1f'),_0x1f950a+'-'+_0x2e781e+'/'+_0x5928d6)[_0x8f49('0x1c')](_0x5046d3);}return null;};}function patchUpdates(_0x262024){return function(_0x3c48b9){try{jsonpatch[_0x8f49('0x20')](_0x3c48b9,_0x262024,!![]);}catch(_0x184ebd){return BPromise[_0x8f49('0x21')](_0x184ebd);}return _0x3c48b9[_0x8f49('0x22')]();};}function saveUpdates(_0x2e9ee8,_0x149c6e){return function(_0x38eb4e){if(_0x38eb4e){return _0x38eb4e[_0x8f49('0x23')](_0x2e9ee8)[_0x8f49('0x24')](function(_0x1cf1f0){return _0x1cf1f0;});}return null;};}function removeEntity(_0x3606b2,_0x314f28){return function(_0x5c9310){if(_0x5c9310){return _0x5c9310[_0x8f49('0x25')]()['then'](function(){var _0x4fae2d=_0x5c9310[_0x8f49('0x26')]({'plain':!![]});var _0x70b538=_0x8f49('0x27');return db[_0x8f49('0x28')]['destroy']({'where':{'type':_0x70b538,'resourceId':_0x4fae2d['id']}})['then'](function(){return _0x5c9310;});})[_0x8f49('0x24')](function(){_0x3606b2[_0x8f49('0x1b')](0xcc)[_0x8f49('0x29')]();});}};}function handleEntityNotFound(_0x125c9e,_0x223442){return function(_0x4f29e9){if(!_0x4f29e9){_0x125c9e[_0x8f49('0x1a')](0x194);}return _0x4f29e9;};}function handleError(_0x368531,_0xe5bc1f){_0xe5bc1f=_0xe5bc1f||0x1f4;return function(_0x1c91f8){logger[_0x8f49('0x2a')](_0x1c91f8['stack']);if(_0x1c91f8['name']){delete _0x1c91f8['name'];}_0x368531[_0x8f49('0x1b')](_0xe5bc1f)[_0x8f49('0x2b')](_0x1c91f8);};}exports['index']=function(_0x2a0f60,_0x5e0ab7){var _0xc15e32={},_0x444516={},_0x40fbb5={'count':0x0,'rows':[]};var _0x2a6afc=_[_0x8f49('0x2c')](db[_0x8f49('0x2d')][_0x8f49('0x2e')],function(_0x362ccf){return{'name':_0x362ccf[_0x8f49('0x2f')],'type':_0x362ccf[_0x8f49('0x30')][_0x8f49('0x31')]};});_0x444516[_0x8f49('0x32')]=_['map'](_0x2a6afc,_0x8f49('0x33'));_0x444516[_0x8f49('0x34')]=_[_0x8f49('0x35')](_0x2a0f60[_0x8f49('0x34')]);_0x444516[_0x8f49('0x36')]=_['intersection'](_0x444516[_0x8f49('0x32')],_0x444516[_0x8f49('0x34')]);_0xc15e32[_0x8f49('0x37')]=_[_0x8f49('0x38')](_0x444516[_0x8f49('0x32')],qs[_0x8f49('0x39')](_0x2a0f60['query']['fields']));_0xc15e32[_0x8f49('0x37')]=_0xc15e32[_0x8f49('0x37')][_0x8f49('0x3a')]?_0xc15e32['attributes']:_0x444516[_0x8f49('0x32')];if(!_0x2a0f60[_0x8f49('0x34')][_0x8f49('0x3b')](_0x8f49('0x3c'))){_0xc15e32['limit']=qs[_0x8f49('0x3d')](_0x2a0f60[_0x8f49('0x34')][_0x8f49('0x3d')]);_0xc15e32['offset']=qs[_0x8f49('0x1d')](_0x2a0f60['query'][_0x8f49('0x1d')]);}_0xc15e32[_0x8f49('0x3e')]=qs[_0x8f49('0x3f')](_0x2a0f60[_0x8f49('0x34')][_0x8f49('0x3f')]);_0xc15e32['where']=qs[_0x8f49('0x36')](_[_0x8f49('0x40')](_0x2a0f60[_0x8f49('0x34')],_0x444516[_0x8f49('0x36')]),_0x2a6afc);if(_0x2a0f60[_0x8f49('0x34')][_0x8f49('0x41')]){_0xc15e32[_0x8f49('0x42')]=_[_0x8f49('0x43')](_0xc15e32['where'],{'$or':_['map'](_0x2a6afc,function(_0x156fe6){if(_0x156fe6[_0x8f49('0x30')]!=='VIRTUAL'){var _0x1cf0ee={};_0x1cf0ee[_0x156fe6[_0x8f49('0x33')]]={'$like':'%'+_0x2a0f60[_0x8f49('0x34')][_0x8f49('0x41')]+'%'};return _0x1cf0ee;}})});}_0xc15e32=_['merge']({},_0xc15e32,_0x2a0f60[_0x8f49('0x44')]);var _0x599fde={'where':_0xc15e32['where']};return db['Interval'][_0x8f49('0x45')](_0x599fde)[_0x8f49('0x24')](function(_0x419292){_0x40fbb5[_0x8f49('0x45')]=_0x419292;if(_0x2a0f60[_0x8f49('0x34')]['includeAll']){_0xc15e32[_0x8f49('0x46')]=[{'all':!![]}];}return db[_0x8f49('0x2d')][_0x8f49('0x47')](_0xc15e32);})['then'](function(_0xf5b40e){_0x40fbb5['rows']=_0xf5b40e;return _0x40fbb5;})[_0x8f49('0x24')](respondWithFilteredResult(_0x5e0ab7,_0xc15e32))['catch'](handleError(_0x5e0ab7,null));};exports[_0x8f49('0x48')]=function(_0x4e0559,_0x3e2bd7){var _0x360424={'raw':!![],'where':{'id':_0x4e0559[_0x8f49('0x49')]['id']}},_0x48abae={};_0x48abae['model']=_[_0x8f49('0x35')](db['Interval'][_0x8f49('0x2e')]);_0x48abae[_0x8f49('0x34')]=_['keys'](_0x4e0559[_0x8f49('0x34')]);_0x48abae['filters']=_[_0x8f49('0x38')](_0x48abae[_0x8f49('0x32')],_0x48abae[_0x8f49('0x34')]);_0x360424[_0x8f49('0x37')]=_['intersection'](_0x48abae[_0x8f49('0x32')],qs['fields'](_0x4e0559['query'][_0x8f49('0x39')]));_0x360424[_0x8f49('0x37')]=_0x360424[_0x8f49('0x37')][_0x8f49('0x3a')]?_0x360424['attributes']:_0x48abae['model'];if(_0x4e0559[_0x8f49('0x34')][_0x8f49('0x4a')]){_0x360424['include']=[{'all':!![]}];}_0x360424=_[_0x8f49('0x43')]({},_0x360424,_0x4e0559['options']);return db[_0x8f49('0x2d')][_0x8f49('0x4b')](_0x360424)[_0x8f49('0x24')](handleEntityNotFound(_0x3e2bd7,null))['then'](respondWithResult(_0x3e2bd7,null))[_0x8f49('0x4c')](handleError(_0x3e2bd7,null));};exports[_0x8f49('0x4d')]=function(_0x20a4af,_0x371a09){return db['Interval'][_0x8f49('0x4d')](_0x20a4af[_0x8f49('0x4e')],{})['then'](function(_0x57ed09){var _0x2442ca=_0x20a4af[_0x8f49('0x4f')][_0x8f49('0x26')]({'plain':!![]});if(!_0x2442ca)throw new Error(_0x8f49('0x50'));if(_0x2442ca[_0x8f49('0x51')]===_0x8f49('0x4f')){var _0x5cfab7=_0x57ed09[_0x8f49('0x26')]({'plain':!![]});var _0x2d7324='Intervals';return db[_0x8f49('0x52')][_0x8f49('0x4b')]({'where':{'name':_0x2d7324,'userProfileId':_0x2442ca[_0x8f49('0x53')]},'raw':!![]})[_0x8f49('0x24')](function(_0x317ba5){if(_0x317ba5&&_0x317ba5['autoAssociation']===0x0){return db[_0x8f49('0x28')][_0x8f49('0x4d')]({'name':_0x5cfab7[_0x8f49('0x33')],'resourceId':_0x5cfab7['id'],'type':_0x317ba5[_0x8f49('0x33')],'sectionId':_0x317ba5['id']},{})[_0x8f49('0x24')](function(){return _0x57ed09;});}else{return _0x57ed09;}})['catch'](function(_0x5afb3e){logger[_0x8f49('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5afb3e);throw _0x5afb3e;});}return _0x57ed09;})['then'](respondWithResult(_0x371a09,0xc9))[_0x8f49('0x4c')](handleError(_0x371a09,null));};exports[_0x8f49('0x23')]=function(_0x865eb9,_0x45b41c){if(_0x865eb9[_0x8f49('0x4e')]['id']){delete _0x865eb9['body']['id'];}return db['Interval'][_0x8f49('0x4b')]({'where':{'id':_0x865eb9[_0x8f49('0x49')]['id']}})[_0x8f49('0x24')](handleEntityNotFound(_0x45b41c,null))[_0x8f49('0x24')](saveUpdates(_0x865eb9[_0x8f49('0x4e')],null))[_0x8f49('0x24')](respondWithResult(_0x45b41c,null))[_0x8f49('0x4c')](handleError(_0x45b41c,null));};exports[_0x8f49('0x25')]=function(_0x247a19,_0x58475c){return db['Interval']['find']({'where':{'id':_0x247a19[_0x8f49('0x49')]['id']}})[_0x8f49('0x24')](handleEntityNotFound(_0x58475c,null))[_0x8f49('0x24')](removeEntity(_0x58475c,null))[_0x8f49('0x4c')](handleError(_0x58475c,null));};exports[_0x8f49('0x54')]=function(_0x258fe1,_0x2b7767,_0x435a8b){if(_0x258fe1[_0x8f49('0x4e')]['id']){delete _0x258fe1[_0x8f49('0x4e')]['id'];}return db[_0x8f49('0x2d')]['find']({'where':{'id':_0x258fe1[_0x8f49('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b7767,null))['then'](function(_0x202a9d){if(_0x202a9d){_0x258fe1[_0x8f49('0x4e')][_0x8f49('0x55')]=_0x202a9d['id'];return db[_0x8f49('0x2d')][_0x8f49('0x4d')](_0x258fe1[_0x8f49('0x4e')]);}})[_0x8f49('0x24')](respondWithResult(_0x2b7767,null))['catch'](handleError(_0x2b7767,null));};exports['getIntervals']=function(_0x354ee9,_0x4d07b6,_0x28cb4e){var _0x17bf98={};var _0x2a9a18={};var _0x51ca8a;var _0x1bb75c;return db[_0x8f49('0x2d')][_0x8f49('0x56')]({'where':{'id':_0x354ee9[_0x8f49('0x49')]['id']}})[_0x8f49('0x24')](handleEntityNotFound(_0x4d07b6,null))['then'](function(_0x247706){if(_0x247706){_0x51ca8a=_0x247706;_0x2a9a18['model']=_[_0x8f49('0x35')](db[_0x8f49('0x2d')][_0x8f49('0x2e')]);_0x2a9a18['query']=_[_0x8f49('0x35')](_0x354ee9[_0x8f49('0x34')]);_0x2a9a18[_0x8f49('0x36')]=_[_0x8f49('0x38')](_0x2a9a18[_0x8f49('0x32')],_0x2a9a18[_0x8f49('0x34')]);_0x17bf98[_0x8f49('0x37')]=_[_0x8f49('0x38')](_0x2a9a18[_0x8f49('0x32')],qs['fields'](_0x354ee9['query'][_0x8f49('0x39')]));_0x17bf98[_0x8f49('0x37')]=_0x17bf98[_0x8f49('0x37')][_0x8f49('0x3a')]?_0x17bf98[_0x8f49('0x37')]:_0x2a9a18[_0x8f49('0x32')];_0x17bf98[_0x8f49('0x3e')]=qs['sort'](_0x354ee9[_0x8f49('0x34')][_0x8f49('0x3f')]);_0x17bf98[_0x8f49('0x42')]=qs['filters'](_[_0x8f49('0x40')](_0x354ee9['query'],_0x2a9a18['filters']));if(_0x354ee9['query'][_0x8f49('0x41')]){_0x17bf98[_0x8f49('0x42')]=_[_0x8f49('0x43')](_0x17bf98[_0x8f49('0x42')],{'$or':_[_0x8f49('0x2c')](_0x17bf98[_0x8f49('0x37')],function(_0x230b2b){var _0xc097e6={};_0xc097e6[_0x230b2b]={'$like':'%'+_0x354ee9[_0x8f49('0x34')][_0x8f49('0x41')]+'%'};return _0xc097e6;})});}_0x17bf98=_['merge']({},_0x17bf98,_0x354ee9['options']);return _0x51ca8a[_0x8f49('0x57')](_0x17bf98);}})[_0x8f49('0x24')](function(_0x5dddf4){if(_0x5dddf4){_0x1bb75c=_0x5dddf4['length'];if(!_0x354ee9[_0x8f49('0x34')]['hasOwnProperty'](_0x8f49('0x3c'))){_0x17bf98[_0x8f49('0x3d')]=qs['limit'](_0x354ee9[_0x8f49('0x34')][_0x8f49('0x3d')]);_0x17bf98[_0x8f49('0x1d')]=qs['offset'](_0x354ee9[_0x8f49('0x34')][_0x8f49('0x1d')]);}return _0x51ca8a[_0x8f49('0x57')](_0x17bf98);}})[_0x8f49('0x24')](function(_0x90c96f){if(_0x90c96f){return _0x90c96f?{'count':_0x1bb75c,'rows':_0x90c96f}:null;}})[_0x8f49('0x24')](respondWithResult(_0x4d07b6,null))[_0x8f49('0x4c')](handleError(_0x4d07b6,null));};exports[_0x8f49('0x58')]=function(_0x22343a,_0x1a7538,_0xd68cb0){return db[_0x8f49('0x2d')][_0x8f49('0x56')]({'where':{'id':_0x22343a['params']['id']}})['then'](handleEntityNotFound(_0x1a7538,null))[_0x8f49('0x24')](function(_0x31c6cd){if(_0x31c6cd){return db[_0x8f49('0x59')]['transaction'](function(_0x35aabb){return db['Interval'][_0x8f49('0x25')]({'where':{'IntervalId':_0x22343a[_0x8f49('0x49')]['id']},'transaction':_0x35aabb})[_0x8f49('0x24')](function(_0xa34130){var _0x31d849=_[_0x8f49('0x2c')](_0x22343a['body'],function(_0x3d705e){delete _0x3d705e['id'];_0x3d705e[_0x8f49('0x55')]=_0x22343a[_0x8f49('0x49')]['id'];return _0x3d705e;});return db['Interval'][_0x8f49('0x5a')](_0x31d849,{'transaction':_0x35aabb});});})[_0x8f49('0x24')](function(){return db[_0x8f49('0x2d')]['findAll']({'where':{'IntervalId':_0x22343a['params']['id']}});});}})[_0x8f49('0x24')](respondWithResult(_0x1a7538,null))['catch'](handleError(_0x1a7538,null));}; \ No newline at end of file +var _0x5f2a=['sequelize','transaction','IntervalId','html-pdf','rimraf','zip-dir','request-promise','moment','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/extensions/rewrite','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','get','Intervals','UserProfileResource','end','stack','name','map','Interval','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','rawAttributes','getIntervals','addIntervals'];(function(_0x373361,_0x379b2d){var _0x62a504=function(_0x313326){while(--_0x313326){_0x373361['push'](_0x373361['shift']());}};_0x62a504(++_0x379b2d);}(_0x5f2a,0x108));var _0xa5f2=function(_0x33dda3,_0x5c4f23){_0x33dda3=_0x33dda3-0x0;var _0x2b9878=_0x5f2a[_0x33dda3];return _0x2b9878;};'use strict';var pdf=require(_0xa5f2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa5f2('0x1'));var zipdir=require(_0xa5f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5f2('0x3'));var moment=require(_0xa5f2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa5f2('0x5'));var path=require(_0xa5f2('0x6'));var sox=require('sox');var csv=require(_0xa5f2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa5f2('0x8'));var squel=require(_0xa5f2('0x9'));var crypto=require(_0xa5f2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa5f2('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa5f2('0xc'));var Papa=require(_0xa5f2('0xd'));var Redis=require('ioredis');var authService=require(_0xa5f2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa5f2('0xf'));var hardwareService=require(_0xa5f2('0x10'));var logger=require(_0xa5f2('0x11'))(_0xa5f2('0x12'));var utils=require(_0xa5f2('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var extensions=require(_0xa5f2('0x14'));function respondWithStatusCode(_0xea018a,_0x7eb16e){_0x7eb16e=_0x7eb16e||0xcc;return function(_0x309d4b){if(_0x309d4b){return _0xea018a[_0xa5f2('0x15')](_0x7eb16e);}return _0xea018a[_0xa5f2('0x16')](_0x7eb16e)['end']();};}function respondWithResult(_0x12e9a6,_0x467952){_0x467952=_0x467952||0xc8;return function(_0x30e8e6){if(_0x30e8e6){return _0x12e9a6[_0xa5f2('0x16')](_0x467952)['json'](_0x30e8e6);}};}function respondWithFilteredResult(_0x2030f7,_0x462aa3){return function(_0x5225ef){if(_0x5225ef){var _0x1c5094=_0x5225ef[_0xa5f2('0x17')],_0x5a4b8a=_0x462aa3[_0xa5f2('0x18')],_0x14e964=_0x462aa3[_0xa5f2('0x18')]+_0x462aa3[_0xa5f2('0x19')],_0x54f19a;if(_0x14e964>=_0x1c5094){_0x14e964=_0x1c5094;_0x54f19a=0xc8;}else{_0x54f19a=0xce;}_0x2030f7[_0xa5f2('0x16')](_0x54f19a);return _0x2030f7[_0xa5f2('0x1a')](_0xa5f2('0x1b'),_0x5a4b8a+'-'+_0x14e964+'/'+_0x1c5094)[_0xa5f2('0x1c')](_0x5225ef);}return null;};}function patchUpdates(_0x569d44){return function(_0xaa70d1){try{jsonpatch[_0xa5f2('0x1d')](_0xaa70d1,_0x569d44,!![]);}catch(_0x172a1a){return BPromise['reject'](_0x172a1a);}return _0xaa70d1['save']();};}function saveUpdates(_0x3a5fa4,_0x2a3827){return function(_0x31468b){if(_0x31468b){return _0x31468b[_0xa5f2('0x1e')](_0x3a5fa4)[_0xa5f2('0x1f')](function(_0x4b7e69){return _0x4b7e69;});}return null;};}function removeEntity(_0x10dc31,_0x2b3643){return function(_0x1f1211){if(_0x1f1211){return _0x1f1211[_0xa5f2('0x20')]()[_0xa5f2('0x1f')](function(){var _0x599ab1=_0x1f1211[_0xa5f2('0x21')]({'plain':!![]});var _0xcb4832=_0xa5f2('0x22');return db[_0xa5f2('0x23')][_0xa5f2('0x20')]({'where':{'type':_0xcb4832,'resourceId':_0x599ab1['id']}})[_0xa5f2('0x1f')](function(){return _0x1f1211;});})[_0xa5f2('0x1f')](function(){_0x10dc31[_0xa5f2('0x16')](0xcc)[_0xa5f2('0x24')]();});}};}function handleEntityNotFound(_0x510f5f,_0x59be9a){return function(_0x16b0cc){if(!_0x16b0cc){_0x510f5f[_0xa5f2('0x15')](0x194);}return _0x16b0cc;};}function handleError(_0x9ce993,_0x1602f3){_0x1602f3=_0x1602f3||0x1f4;return function(_0x33a165){logger['error'](_0x33a165[_0xa5f2('0x25')]);if(_0x33a165['name']){delete _0x33a165[_0xa5f2('0x26')];}_0x9ce993[_0xa5f2('0x16')](_0x1602f3)['send'](_0x33a165);};}exports['index']=function(_0xecd05a,_0x40446b){var _0x7855fe={},_0x54669b={},_0xcbf32b={'count':0x0,'rows':[]};var _0x183103=_[_0xa5f2('0x27')](db[_0xa5f2('0x28')]['rawAttributes'],function(_0x4e1eed){return{'name':_0x4e1eed[_0xa5f2('0x29')],'type':_0x4e1eed['type'][_0xa5f2('0x2a')]};});_0x54669b['model']=_['map'](_0x183103,_0xa5f2('0x26'));_0x54669b[_0xa5f2('0x2b')]=_[_0xa5f2('0x2c')](_0xecd05a[_0xa5f2('0x2b')]);_0x54669b[_0xa5f2('0x2d')]=_[_0xa5f2('0x2e')](_0x54669b['model'],_0x54669b[_0xa5f2('0x2b')]);_0x7855fe[_0xa5f2('0x2f')]=_[_0xa5f2('0x2e')](_0x54669b[_0xa5f2('0x30')],qs[_0xa5f2('0x31')](_0xecd05a[_0xa5f2('0x2b')][_0xa5f2('0x31')]));_0x7855fe[_0xa5f2('0x2f')]=_0x7855fe[_0xa5f2('0x2f')][_0xa5f2('0x32')]?_0x7855fe[_0xa5f2('0x2f')]:_0x54669b[_0xa5f2('0x30')];if(!_0xecd05a[_0xa5f2('0x2b')][_0xa5f2('0x33')](_0xa5f2('0x34'))){_0x7855fe[_0xa5f2('0x19')]=qs[_0xa5f2('0x19')](_0xecd05a['query'][_0xa5f2('0x19')]);_0x7855fe[_0xa5f2('0x18')]=qs[_0xa5f2('0x18')](_0xecd05a[_0xa5f2('0x2b')]['offset']);}_0x7855fe[_0xa5f2('0x35')]=qs['sort'](_0xecd05a[_0xa5f2('0x2b')][_0xa5f2('0x36')]);_0x7855fe[_0xa5f2('0x37')]=qs['filters'](_[_0xa5f2('0x38')](_0xecd05a[_0xa5f2('0x2b')],_0x54669b[_0xa5f2('0x2d')]),_0x183103);if(_0xecd05a[_0xa5f2('0x2b')][_0xa5f2('0x39')]){_0x7855fe['where']=_[_0xa5f2('0x3a')](_0x7855fe[_0xa5f2('0x37')],{'$or':_[_0xa5f2('0x27')](_0x183103,function(_0xb878d6){if(_0xb878d6[_0xa5f2('0x3b')]!==_0xa5f2('0x3c')){var _0x1fb135={};_0x1fb135[_0xb878d6[_0xa5f2('0x26')]]={'$like':'%'+_0xecd05a['query'][_0xa5f2('0x39')]+'%'};return _0x1fb135;}})});}_0x7855fe=_[_0xa5f2('0x3a')]({},_0x7855fe,_0xecd05a['options']);var _0x4cb302={'where':_0x7855fe[_0xa5f2('0x37')]};return db[_0xa5f2('0x28')][_0xa5f2('0x17')](_0x4cb302)[_0xa5f2('0x1f')](function(_0xc7bd59){_0xcbf32b['count']=_0xc7bd59;if(_0xecd05a[_0xa5f2('0x2b')][_0xa5f2('0x3d')]){_0x7855fe[_0xa5f2('0x3e')]=[{'all':!![]}];}return db[_0xa5f2('0x28')][_0xa5f2('0x3f')](_0x7855fe);})[_0xa5f2('0x1f')](function(_0x46662f){_0xcbf32b[_0xa5f2('0x40')]=_0x46662f;return _0xcbf32b;})[_0xa5f2('0x1f')](respondWithFilteredResult(_0x40446b,_0x7855fe))['catch'](handleError(_0x40446b,null));};exports[_0xa5f2('0x41')]=function(_0x368016,_0x97fd8d){var _0x5db0ae={'raw':!![],'where':{'id':_0x368016[_0xa5f2('0x42')]['id']}},_0x5cc616={};_0x5cc616['model']=_[_0xa5f2('0x2c')](db[_0xa5f2('0x28')]['rawAttributes']);_0x5cc616[_0xa5f2('0x2b')]=_[_0xa5f2('0x2c')](_0x368016[_0xa5f2('0x2b')]);_0x5cc616[_0xa5f2('0x2d')]=_[_0xa5f2('0x2e')](_0x5cc616[_0xa5f2('0x30')],_0x5cc616[_0xa5f2('0x2b')]);_0x5db0ae['attributes']=_[_0xa5f2('0x2e')](_0x5cc616[_0xa5f2('0x30')],qs['fields'](_0x368016[_0xa5f2('0x2b')]['fields']));_0x5db0ae[_0xa5f2('0x2f')]=_0x5db0ae[_0xa5f2('0x2f')][_0xa5f2('0x32')]?_0x5db0ae[_0xa5f2('0x2f')]:_0x5cc616['model'];if(_0x368016['query']['includeAll']){_0x5db0ae[_0xa5f2('0x3e')]=[{'all':!![]}];}_0x5db0ae=_[_0xa5f2('0x3a')]({},_0x5db0ae,_0x368016[_0xa5f2('0x43')]);return db['Interval'][_0xa5f2('0x44')](_0x5db0ae)[_0xa5f2('0x1f')](handleEntityNotFound(_0x97fd8d,null))[_0xa5f2('0x1f')](respondWithResult(_0x97fd8d,null))[_0xa5f2('0x45')](handleError(_0x97fd8d,null));};exports[_0xa5f2('0x46')]=function(_0x12b7ed,_0x459239){return db[_0xa5f2('0x28')][_0xa5f2('0x46')](_0x12b7ed[_0xa5f2('0x47')],{})[_0xa5f2('0x1f')](function(_0x239ca8){var _0x3c11ee=_0x12b7ed[_0xa5f2('0x48')][_0xa5f2('0x21')]({'plain':!![]});if(!_0x3c11ee)throw new Error(_0xa5f2('0x49'));if(_0x3c11ee['role']===_0xa5f2('0x48')){var _0xc639f1=_0x239ca8[_0xa5f2('0x21')]({'plain':!![]});var _0x57cf94='Intervals';return db[_0xa5f2('0x4a')][_0xa5f2('0x44')]({'where':{'name':_0x57cf94,'userProfileId':_0x3c11ee[_0xa5f2('0x4b')]},'raw':!![]})[_0xa5f2('0x1f')](function(_0x356290){if(_0x356290&&_0x356290[_0xa5f2('0x4c')]===0x0){return db[_0xa5f2('0x23')]['create']({'name':_0xc639f1[_0xa5f2('0x26')],'resourceId':_0xc639f1['id'],'type':_0x356290['name'],'sectionId':_0x356290['id']},{})[_0xa5f2('0x1f')](function(){return _0x239ca8;});}else{return _0x239ca8;}})[_0xa5f2('0x45')](function(_0xfc60d6){logger[_0xa5f2('0x4d')](_0xa5f2('0x4e'),_0xfc60d6);throw _0xfc60d6;});}return _0x239ca8;})[_0xa5f2('0x1f')](respondWithResult(_0x459239,0xc9))[_0xa5f2('0x45')](handleError(_0x459239,null));};exports[_0xa5f2('0x1e')]=function(_0x6fc611,_0x1c1e39){if(_0x6fc611[_0xa5f2('0x47')]['id']){delete _0x6fc611[_0xa5f2('0x47')]['id'];}return db[_0xa5f2('0x28')][_0xa5f2('0x44')]({'where':{'id':_0x6fc611[_0xa5f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c1e39,null))[_0xa5f2('0x1f')](saveUpdates(_0x6fc611[_0xa5f2('0x47')],null))[_0xa5f2('0x1f')](respondWithResult(_0x1c1e39,null))[_0xa5f2('0x45')](handleError(_0x1c1e39,null));};exports[_0xa5f2('0x20')]=function(_0x4febbd,_0x44634c){return db['Interval'][_0xa5f2('0x44')]({'where':{'id':_0x4febbd[_0xa5f2('0x42')]['id']}})[_0xa5f2('0x1f')](handleEntityNotFound(_0x44634c,null))[_0xa5f2('0x1f')](removeEntity(_0x44634c,null))[_0xa5f2('0x45')](handleError(_0x44634c,null));};exports[_0xa5f2('0x4f')]=function(_0x108e42,_0x23ef22,_0x120f0e){if(_0x108e42[_0xa5f2('0x47')]['id']){delete _0x108e42['body']['id'];}return db[_0xa5f2('0x28')][_0xa5f2('0x44')]({'where':{'id':_0x108e42[_0xa5f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x23ef22,null))[_0xa5f2('0x1f')](function(_0x5a96cf){if(_0x5a96cf){_0x108e42[_0xa5f2('0x47')]['IntervalId']=_0x5a96cf['id'];return db[_0xa5f2('0x28')]['create'](_0x108e42[_0xa5f2('0x47')]);}})['then'](respondWithResult(_0x23ef22,null))[_0xa5f2('0x45')](handleError(_0x23ef22,null));};exports['getIntervals']=function(_0x1a1a04,_0x3ebc86,_0x363358){var _0x4b23dd={};var _0x31f71e={};var _0x57bd9a;var _0x1c3a96;return db[_0xa5f2('0x28')][_0xa5f2('0x50')]({'where':{'id':_0x1a1a04[_0xa5f2('0x42')]['id']}})[_0xa5f2('0x1f')](handleEntityNotFound(_0x3ebc86,null))[_0xa5f2('0x1f')](function(_0x52e052){if(_0x52e052){_0x57bd9a=_0x52e052;_0x31f71e['model']=_['keys'](db[_0xa5f2('0x28')][_0xa5f2('0x51')]);_0x31f71e[_0xa5f2('0x2b')]=_[_0xa5f2('0x2c')](_0x1a1a04[_0xa5f2('0x2b')]);_0x31f71e['filters']=_['intersection'](_0x31f71e[_0xa5f2('0x30')],_0x31f71e[_0xa5f2('0x2b')]);_0x4b23dd[_0xa5f2('0x2f')]=_['intersection'](_0x31f71e[_0xa5f2('0x30')],qs[_0xa5f2('0x31')](_0x1a1a04[_0xa5f2('0x2b')][_0xa5f2('0x31')]));_0x4b23dd['attributes']=_0x4b23dd['attributes']['length']?_0x4b23dd[_0xa5f2('0x2f')]:_0x31f71e[_0xa5f2('0x30')];_0x4b23dd[_0xa5f2('0x35')]=qs['sort'](_0x1a1a04[_0xa5f2('0x2b')]['sort']);_0x4b23dd[_0xa5f2('0x37')]=qs['filters'](_[_0xa5f2('0x38')](_0x1a1a04[_0xa5f2('0x2b')],_0x31f71e[_0xa5f2('0x2d')]));if(_0x1a1a04[_0xa5f2('0x2b')][_0xa5f2('0x39')]){_0x4b23dd[_0xa5f2('0x37')]=_[_0xa5f2('0x3a')](_0x4b23dd[_0xa5f2('0x37')],{'$or':_[_0xa5f2('0x27')](_0x4b23dd['attributes'],function(_0x271df8){var _0x690c3a={};_0x690c3a[_0x271df8]={'$like':'%'+_0x1a1a04[_0xa5f2('0x2b')]['filter']+'%'};return _0x690c3a;})});}_0x4b23dd=_['merge']({},_0x4b23dd,_0x1a1a04[_0xa5f2('0x43')]);return _0x57bd9a[_0xa5f2('0x52')](_0x4b23dd);}})['then'](function(_0x4eb435){if(_0x4eb435){_0x1c3a96=_0x4eb435[_0xa5f2('0x32')];if(!_0x1a1a04[_0xa5f2('0x2b')][_0xa5f2('0x33')](_0xa5f2('0x34'))){_0x4b23dd[_0xa5f2('0x19')]=qs['limit'](_0x1a1a04[_0xa5f2('0x2b')][_0xa5f2('0x19')]);_0x4b23dd[_0xa5f2('0x18')]=qs['offset'](_0x1a1a04[_0xa5f2('0x2b')][_0xa5f2('0x18')]);}return _0x57bd9a['getIntervals'](_0x4b23dd);}})[_0xa5f2('0x1f')](function(_0x2a9128){if(_0x2a9128){return _0x2a9128?{'count':_0x1c3a96,'rows':_0x2a9128}:null;}})[_0xa5f2('0x1f')](respondWithResult(_0x3ebc86,null))[_0xa5f2('0x45')](handleError(_0x3ebc86,null));};exports[_0xa5f2('0x53')]=function(_0x3f9476,_0x4fea80,_0x4fddf6){return db[_0xa5f2('0x28')][_0xa5f2('0x50')]({'where':{'id':_0x3f9476[_0xa5f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x4fea80,null))[_0xa5f2('0x1f')](function(_0xac8460){if(_0xac8460){return db[_0xa5f2('0x54')][_0xa5f2('0x55')](function(_0x571b99){return db['Interval']['destroy']({'where':{'IntervalId':_0x3f9476[_0xa5f2('0x42')]['id']},'transaction':_0x571b99})[_0xa5f2('0x1f')](function(_0x467ff5){var _0x38dc3b=_[_0xa5f2('0x27')](_0x3f9476[_0xa5f2('0x47')],function(_0x444a44){delete _0x444a44['id'];_0x444a44[_0xa5f2('0x56')]=_0x3f9476[_0xa5f2('0x42')]['id'];return _0x444a44;});return db[_0xa5f2('0x28')]['bulkCreate'](_0x38dc3b,{'transaction':_0x571b99});});})[_0xa5f2('0x1f')](function(){return db[_0xa5f2('0x28')][_0xa5f2('0x3f')]({'where':{'IntervalId':_0x3f9476[_0xa5f2('0x42')]['id']}});});}})['then'](respondWithResult(_0x4fea80,null))['catch'](handleError(_0x4fea80,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 410013b..f63a09b 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 _0x280d=['path','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2903e7,_0x53237e){var _0x383d28=function(_0x52c175){while(--_0x52c175){_0x2903e7['push'](_0x2903e7['shift']());}};_0x383d28(++_0x53237e);}(_0x280d,0x69));var _0xd280=function(_0xebb29e,_0x59e08d){_0xebb29e=_0xebb29e-0x0;var _0x14398a=_0x280d[_0xebb29e];return _0x14398a;};'use strict';var _=require(_0xd280('0x0'));var util=require(_0xd280('0x1'));var logger=require(_0xd280('0x2'))(_0xd280('0x3'));var moment=require(_0xd280('0x4'));var BPromise=require(_0xd280('0x5'));var rp=require(_0xd280('0x6'));var fs=require('fs');var path=require(_0xd280('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd280('0x8'));var extensions=require(_0xd280('0x9'));module['exports']=function(_0x598f3d,_0xe183ad){return _0x598f3d[_0xd280('0xa')](_0xd280('0xb'),attributes,{'tableName':_0xd280('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3092d5,_0xdf2eb1){extensions['rewrite'](_0x598f3d,_0x3092d5);},'afterBulkCreate':function(_0x35e8c1,_0x229e37,_0xacdf01){_0xacdf01();extensions[_0xd280('0xd')](_0x598f3d,_0x35e8c1[0x0]);},'afterUpdate':function(_0x2d0da3,_0x336f3e){extensions[_0xd280('0xd')](_0x598f3d,_0x2d0da3);},'afterDestroy':function(_0x23971c,_0x2d55d9){extensions[_0xd280('0xd')](_0x598f3d,_0x23971c);}}});}; \ No newline at end of file +var _0x222f=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','Interval','tools_intervals','rewrite'];(function(_0x3cd863,_0xc53a7b){var _0x3dc863=function(_0x2565f7){while(--_0x2565f7){_0x3cd863['push'](_0x3cd863['shift']());}};_0x3dc863(++_0xc53a7b);}(_0x222f,0x1a4));var _0xf222=function(_0x4c99d0,_0x1febe1){_0x4c99d0=_0x4c99d0-0x0;var _0x5e541f=_0x222f[_0x4c99d0];return _0x5e541f;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf222('0x4'));var fs=require('fs');var path=require(_0xf222('0x5'));var rimraf=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0xf222('0x8'));module['exports']=function(_0x112e6d,_0x26f129){return _0x112e6d['define'](_0xf222('0x9'),attributes,{'tableName':_0xf222('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4aceb4,_0x31c027){extensions[_0xf222('0xb')](_0x112e6d,_0x4aceb4);},'afterBulkCreate':function(_0x878804,_0x2eb41f,_0x46ccfe){_0x46ccfe();extensions[_0xf222('0xb')](_0x112e6d,_0x878804[0x0]);},'afterUpdate':function(_0x47d55a,_0x2e29ad){extensions[_0xf222('0xb')](_0x112e6d,_0x47d55a);},'afterDestroy':function(_0x226dbd,_0x182bc3){extensions['rewrite'](_0x112e6d,_0x226dbd);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5386de0..d31345f 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 _0x756d=['info','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','ShowInterval','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Interval,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2e72d2,_0x11a00e){var _0x2b4119=function(_0x13421a){while(--_0x13421a){_0x2e72d2['push'](_0x2e72d2['shift']());}};_0x2b4119(++_0x11a00e);}(_0x756d,0x112));var _0xd756=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x756d[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xd756('0x0'));var util=require(_0xd756('0x1'));var moment=require(_0xd756('0x2'));var BPromise=require(_0xd756('0x3'));var rs=require(_0xd756('0x4'));var fs=require('fs');var Redis=require(_0xd756('0x5'));var db=require(_0xd756('0x6'))['db'];var utils=require(_0xd756('0x7'));var logger=require('../../config/logger')(_0xd756('0x8'));var config=require(_0xd756('0x9'));var jayson=require(_0xd756('0xa'));var client=jayson[_0xd756('0xb')][_0xd756('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2868b1,_0x531274,_0x10dd08){return new BPromise(function(_0x31ea44,_0x188cbb){return client[_0xd756('0xd')](_0x2868b1,_0x10dd08)[_0xd756('0xe')](function(_0x5c3014){logger['info'](_0xd756('0xf'),_0x531274,_0xd756('0x10'));logger[_0xd756('0x11')]('Interval,\x20%s,\x20%s,\x20%s',_0x531274,_0xd756('0x10'),JSON[_0xd756('0x12')](_0x5c3014));if(_0x5c3014[_0xd756('0x13')]){if(_0x5c3014[_0xd756('0x13')][_0xd756('0x14')]===0x1f4){logger['error'](_0xd756('0xf'),_0x531274,_0x5c3014[_0xd756('0x13')]['message']);return _0x188cbb(_0x5c3014[_0xd756('0x13')]['message']);}logger[_0xd756('0x13')](_0xd756('0xf'),_0x531274,_0x5c3014[_0xd756('0x13')][_0xd756('0x15')]);return _0x31ea44(_0x5c3014[_0xd756('0x13')][_0xd756('0x15')]);}else{logger[_0xd756('0x16')](_0xd756('0xf'),_0x531274,'request\x20sent');_0x31ea44(_0x5c3014[_0xd756('0x17')][_0xd756('0x15')]);}})[_0xd756('0x18')](function(_0x13cf55){logger[_0xd756('0x13')]('Interval,\x20%s,\x20%s',_0x531274,_0x13cf55);_0x188cbb(_0x13cf55);});});}exports[_0xd756('0x19')]=function(_0x45e51d){var _0x188be4=this;return new Promise(function(_0x5c75f3,_0x28eeae){return db[_0xd756('0x1a')][_0xd756('0x1b')]({'raw':_0x45e51d[_0xd756('0x1c')]?_0x45e51d[_0xd756('0x1c')][_0xd756('0x1d')]===undefined?!![]:![]:!![],'where':_0x45e51d[_0xd756('0x1c')]?_0x45e51d['options'][_0xd756('0x1e')]||null:null,'attributes':_0x45e51d['options']?_0x45e51d[_0xd756('0x1c')][_0xd756('0x1f')]||null:null,'limit':_0x45e51d[_0xd756('0x1c')]?_0x45e51d[_0xd756('0x1c')]['limit']||null:null,'include':_0x45e51d[_0xd756('0x1c')]?_0x45e51d[_0xd756('0x1c')][_0xd756('0x20')]?_[_0xd756('0x21')](_0x45e51d[_0xd756('0x1c')][_0xd756('0x20')],function(_0x27e602){return{'model':db[_0x27e602[_0xd756('0x22')]],'as':_0x27e602['as'],'attributes':_0x27e602['attributes'],'include':_0x27e602[_0xd756('0x20')]?_[_0xd756('0x21')](_0x27e602[_0xd756('0x20')],function(_0x1dd101){return{'model':db[_0x1dd101[_0xd756('0x22')]],'as':_0x1dd101['as'],'attributes':_0x1dd101[_0xd756('0x1f')],'include':_0x1dd101[_0xd756('0x20')]?_[_0xd756('0x21')](_0x1dd101[_0xd756('0x20')],function(_0x46d401){return{'model':db[_0x46d401['model']],'as':_0x46d401['as'],'attributes':_0x46d401['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52a957){logger[_0xd756('0x16')](_0xd756('0x19'),_0x45e51d);logger[_0xd756('0x11')](_0xd756('0x19'),_0x45e51d,JSON[_0xd756('0x12')](_0x52a957));_0x5c75f3(_0x52a957);})['catch'](function(_0x3d301b){logger[_0xd756('0x13')](_0xd756('0x19'),_0x3d301b['message'],_0x45e51d);_0x28eeae(_0x188be4['error'](0x1f4,_0x3d301b[_0xd756('0x15')]));});});};exports[_0xd756('0x23')]=function(_0x280f3d){var _0x40385f=this;return new Promise(function(_0x25f2e4,_0x4d9ff9){return db[_0xd756('0x1a')][_0xd756('0x24')]({'raw':_0x280f3d[_0xd756('0x1c')]?_0x280f3d[_0xd756('0x1c')][_0xd756('0x1d')]===undefined?!![]:![]:!![],'where':_0x280f3d[_0xd756('0x1c')]?_0x280f3d[_0xd756('0x1c')][_0xd756('0x1e')]||null:null,'attributes':_0x280f3d['options']?_0x280f3d['options'][_0xd756('0x1f')]||null:null,'include':_0x280f3d[_0xd756('0x1c')]?_0x280f3d[_0xd756('0x1c')][_0xd756('0x20')]?_[_0xd756('0x21')](_0x280f3d[_0xd756('0x1c')]['include'],function(_0x3e0928){return{'model':db[_0x3e0928[_0xd756('0x22')]],'as':_0x3e0928['as'],'attributes':_0x3e0928[_0xd756('0x1f')],'include':_0x3e0928['include']?_[_0xd756('0x21')](_0x3e0928[_0xd756('0x20')],function(_0x29d3b5){return{'model':db[_0x29d3b5['model']],'as':_0x29d3b5['as'],'attributes':_0x29d3b5[_0xd756('0x1f')],'include':_0x29d3b5['include']?_['map'](_0x29d3b5[_0xd756('0x20')],function(_0x4dffbe){return{'model':db[_0x4dffbe[_0xd756('0x22')]],'as':_0x4dffbe['as'],'attributes':_0x4dffbe[_0xd756('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35c587){logger[_0xd756('0x16')]('ShowInterval',_0x280f3d);logger[_0xd756('0x11')](_0xd756('0x23'),_0x280f3d,JSON['stringify'](_0x35c587));_0x25f2e4(_0x35c587);})[_0xd756('0x18')](function(_0x2044c9){logger['error'](_0xd756('0x23'),_0x2044c9[_0xd756('0x15')],_0x280f3d);_0x4d9ff9(_0x40385f[_0xd756('0x13')](0x1f4,_0x2044c9[_0xd756('0x15')]));});});}; \ No newline at end of file +var _0x6805=['../../config/utils','../../config/environment','http','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','options','raw','attributes','limit','include','map','model','ShowInterval','find','lodash','util','moment','bluebird','ioredis'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0x6805,0x19f));var _0x5680=function(_0x28879f,_0x23edb3){_0x28879f=_0x28879f-0x0;var _0x13c71e=_0x6805[_0x28879f];return _0x13c71e;};'use strict';var _=require(_0x5680('0x0'));var util=require(_0x5680('0x1'));var moment=require(_0x5680('0x2'));var BPromise=require(_0x5680('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5680('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5680('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5680('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5680('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ba613,_0x359662,_0x5d8b68){return new BPromise(function(_0x8b1134,_0x499e0b){return client['request'](_0x3ba613,_0x5d8b68)[_0x5680('0x8')](function(_0x7c84d6){logger[_0x5680('0x9')](_0x5680('0xa'),_0x359662,_0x5680('0xb'));logger[_0x5680('0xc')](_0x5680('0xd'),_0x359662,_0x5680('0xb'),JSON[_0x5680('0xe')](_0x7c84d6));if(_0x7c84d6[_0x5680('0xf')]){if(_0x7c84d6['error'][_0x5680('0x10')]===0x1f4){logger[_0x5680('0xf')](_0x5680('0xa'),_0x359662,_0x7c84d6[_0x5680('0xf')]['message']);return _0x499e0b(_0x7c84d6[_0x5680('0xf')]['message']);}logger[_0x5680('0xf')]('Interval,\x20%s,\x20%s',_0x359662,_0x7c84d6['error'][_0x5680('0x11')]);return _0x8b1134(_0x7c84d6[_0x5680('0xf')][_0x5680('0x11')]);}else{logger[_0x5680('0x9')](_0x5680('0xa'),_0x359662,_0x5680('0xb'));_0x8b1134(_0x7c84d6[_0x5680('0x12')][_0x5680('0x11')]);}})[_0x5680('0x13')](function(_0x32862){logger['error'](_0x5680('0xa'),_0x359662,_0x32862);_0x499e0b(_0x32862);});});}exports[_0x5680('0x14')]=function(_0x17748c){var _0x17f6fa=this;return new Promise(function(_0x42f8f4,_0x506a40){return db['Interval']['findAll']({'raw':_0x17748c['options']?_0x17748c[_0x5680('0x15')][_0x5680('0x16')]===undefined?!![]:![]:!![],'where':_0x17748c[_0x5680('0x15')]?_0x17748c[_0x5680('0x15')]['where']||null:null,'attributes':_0x17748c['options']?_0x17748c['options'][_0x5680('0x17')]||null:null,'limit':_0x17748c[_0x5680('0x15')]?_0x17748c['options'][_0x5680('0x18')]||null:null,'include':_0x17748c[_0x5680('0x15')]?_0x17748c[_0x5680('0x15')][_0x5680('0x19')]?_['map'](_0x17748c[_0x5680('0x15')][_0x5680('0x19')],function(_0x39674d){return{'model':db[_0x39674d['model']],'as':_0x39674d['as'],'attributes':_0x39674d[_0x5680('0x17')],'include':_0x39674d[_0x5680('0x19')]?_[_0x5680('0x1a')](_0x39674d[_0x5680('0x19')],function(_0x32e333){return{'model':db[_0x32e333[_0x5680('0x1b')]],'as':_0x32e333['as'],'attributes':_0x32e333[_0x5680('0x17')],'include':_0x32e333[_0x5680('0x19')]?_[_0x5680('0x1a')](_0x32e333[_0x5680('0x19')],function(_0x1eb43c){return{'model':db[_0x1eb43c['model']],'as':_0x1eb43c['as'],'attributes':_0x1eb43c[_0x5680('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5680('0x8')](function(_0x735f52){logger['info'](_0x5680('0x14'),_0x17748c);logger[_0x5680('0xc')](_0x5680('0x14'),_0x17748c,JSON[_0x5680('0xe')](_0x735f52));_0x42f8f4(_0x735f52);})[_0x5680('0x13')](function(_0x354c07){logger[_0x5680('0xf')](_0x5680('0x14'),_0x354c07[_0x5680('0x11')],_0x17748c);_0x506a40(_0x17f6fa[_0x5680('0xf')](0x1f4,_0x354c07['message']));});});};exports[_0x5680('0x1c')]=function(_0x4d9d6e){var _0x1a92df=this;return new Promise(function(_0x3eea41,_0x2d7208){return db['Interval'][_0x5680('0x1d')]({'raw':_0x4d9d6e[_0x5680('0x15')]?_0x4d9d6e[_0x5680('0x15')][_0x5680('0x16')]===undefined?!![]:![]:!![],'where':_0x4d9d6e[_0x5680('0x15')]?_0x4d9d6e[_0x5680('0x15')]['where']||null:null,'attributes':_0x4d9d6e[_0x5680('0x15')]?_0x4d9d6e['options'][_0x5680('0x17')]||null:null,'include':_0x4d9d6e['options']?_0x4d9d6e[_0x5680('0x15')][_0x5680('0x19')]?_[_0x5680('0x1a')](_0x4d9d6e['options'][_0x5680('0x19')],function(_0x1ee695){return{'model':db[_0x1ee695[_0x5680('0x1b')]],'as':_0x1ee695['as'],'attributes':_0x1ee695[_0x5680('0x17')],'include':_0x1ee695[_0x5680('0x19')]?_['map'](_0x1ee695[_0x5680('0x19')],function(_0x3886c1){return{'model':db[_0x3886c1[_0x5680('0x1b')]],'as':_0x3886c1['as'],'attributes':_0x3886c1[_0x5680('0x17')],'include':_0x3886c1['include']?_[_0x5680('0x1a')](_0x3886c1[_0x5680('0x19')],function(_0x27aefb){return{'model':db[_0x27aefb[_0x5680('0x1b')]],'as':_0x27aefb['as'],'attributes':_0x27aefb[_0x5680('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5680('0x8')](function(_0x2249dc){logger[_0x5680('0x9')](_0x5680('0x1c'),_0x4d9d6e);logger[_0x5680('0xc')](_0x5680('0x1c'),_0x4d9d6e,JSON[_0x5680('0xe')](_0x2249dc));_0x3eea41(_0x2249dc);})[_0x5680('0x13')](function(_0x56594b){logger['error'](_0x5680('0x1c'),_0x56594b[_0x5680('0x11')],_0x4d9d6e);_0x2d7208(_0x1a92df[_0x5680('0xf')](0x1f4,_0x56594b[_0x5680('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ecc2132..fd8bafa 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 _0xd67a=['../../components/auth/service','post','send','exports','express','Router'];(function(_0x4801e7,_0x20e62a){var _0xccd433=function(_0x5a80fb){while(--_0x5a80fb){_0x4801e7['push'](_0x4801e7['shift']());}};_0xccd433(++_0x20e62a);}(_0xd67a,0x160));var _0xad67=function(_0x9d4774,_0x51f872){_0x9d4774=_0x9d4774-0x0;var _0x4fa26b=_0xd67a[_0x9d4774];return _0x4fa26b;};'use strict';var express=require(_0xad67('0x0'));var router=express[_0xad67('0x1')]();var auth=require(_0xad67('0x2'));var controller=require('./jira.controller');router[_0xad67('0x3')]('/',auth['isAuthenticated'](),controller[_0xad67('0x4')]);module[_0xad67('0x5')]=router; \ No newline at end of file +var _0xf3ef=['express','./jira.controller','post','send','exports'];(function(_0x5251a1,_0x2ca97c){var _0x2cca73=function(_0x4722d1){while(--_0x4722d1){_0x5251a1['push'](_0x5251a1['shift']());}};_0x2cca73(++_0x2ca97c);}(_0xf3ef,0x18b));var _0xff3e=function(_0x575e6d,_0x1e19ac){_0x575e6d=_0x575e6d-0x0;var _0x5d4dfd=_0xf3ef[_0x575e6d];return _0x5d4dfd;};'use strict';var express=require(_0xff3e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xff3e('0x1'));router[_0xff3e('0x2')]('/',auth['isAuthenticated'](),controller[_0xff3e('0x3')]);module[_0xff3e('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 726ae1f..317e74b 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 _0xdcd7=['request','setEncoding','utf8','data','end','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64'];(function(_0x55b159,_0x45ae93){var _0x25a243=function(_0x429ef7){while(--_0x429ef7){_0x55b159['push'](_0x55b159['shift']());}};_0x25a243(++_0x45ae93);}(_0xdcd7,0x103));var _0x7dcd=function(_0x25d06a,_0x5f5442){_0x25d06a=_0x25d06a-0x0;var _0x15abef=_0xdcd7[_0x25d06a];return _0x15abef;};'use strict';var BPromise=require(_0x7dcd('0x0'));var https=require(_0x7dcd('0x1'));var logger=require(_0x7dcd('0x2'))(_0x7dcd('0x3'));var USERNAME=_0x7dcd('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2e8e03,_0x3ae72b){var _0x371cf0={'fields':{'project':{'key':_0x2e8e03[_0x7dcd('0x5')]||_0x7dcd('0x6')},'summary':(_0x2e8e03[_0x7dcd('0x7')]||_0x7dcd('0x8'))+_0x7dcd('0x9')+_0x2e8e03['ip'],'description':_0x2e8e03[_0x7dcd('0xa')]||JSON[_0x7dcd('0xb')](_0x2e8e03),'issuetype':{'name':_0x2e8e03[_0x7dcd('0xc')]||'Bug'}}};_0x371cf0['fields'][_0x7dcd('0xd')]=_0x2e8e03[_0x7dcd('0xe')];_0x371cf0['fields'][_0x7dcd('0xf')]=_0x2e8e03[_0x7dcd('0x10')];_0x371cf0[_0x7dcd('0x11')][_0x7dcd('0x12')]=_0x2e8e03[_0x7dcd('0x13')];_0x371cf0[_0x7dcd('0x11')]['customfield_11503']=_0x2e8e03[_0x7dcd('0x14')];_0x371cf0[_0x7dcd('0x11')][_0x7dcd('0x15')]=_0x2e8e03[_0x7dcd('0x16')];_0x371cf0[_0x7dcd('0x11')][_0x7dcd('0x17')]=_0x2e8e03['ip'];var _0x322450={'host':_0x7dcd('0x18'),'port':0x1bb,'path':_0x7dcd('0x19'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x7dcd('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x7dcd('0x1b')](_0x7dcd('0x1c'))}};var _0x7b2454=JSON[_0x7dcd('0xb')](_0x371cf0);var _0x5936f4=https[_0x7dcd('0x1d')](_0x322450,function(_0x386f41){_0x386f41[_0x7dcd('0x1e')](_0x7dcd('0x1f'));var _0x5c0dab='';_0x386f41['on'](_0x7dcd('0x20'),function(_0x5b1d11){_0x5c0dab+=_0x5b1d11;});_0x386f41['on'](_0x7dcd('0x21'),function(){if(_0x3ae72b){return _0x3ae72b['status'](_0x386f41['statusCode'])[_0x7dcd('0x22')](JSON[_0x7dcd('0x23')](_0x5c0dab));}});});_0x5936f4['on'](_0x7dcd('0x24'),function(_0x5ce904){if(_0x3ae72b){return _0x3ae72b[_0x7dcd('0x25')](0x1f4)[_0x7dcd('0x22')]({'errors':[{'message':_0x7dcd('0x26'),'type':'api.jira'}]});}});_0x5936f4[_0x7dcd('0x27')](_0x7b2454);_0x5936f4[_0x7dcd('0x21')]();}exports[_0x7dcd('0x28')]=openIssue;exports[_0x7dcd('0x29')]=function(_0x341df4,_0x2d2480){_0x341df4['body']['ip']=_0x341df4[_0x7dcd('0x2a')][_0x7dcd('0x2b')]||_0x341df4[_0x7dcd('0x2c')][_0x7dcd('0x2d')]||_0x341df4[_0x7dcd('0x2e')][_0x7dcd('0x2d')]||_0x341df4[_0x7dcd('0x2c')]['socket'][_0x7dcd('0x2d')];return openIssue(_0x341df4[_0x7dcd('0x2f')],_0x2d2480);}; \ No newline at end of file +var _0x0e2a=['socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','base64','setEncoding','end','statusCode','json','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','body','headers','connection','remoteAddress'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0e2a,0x7c));var _0xa0e2=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x0e2a[_0x32f9ca];return _0x52e083;};'use strict';var BPromise=require('bluebird');var https=require(_0xa0e2('0x0'));var logger=require(_0xa0e2('0x1'))(_0xa0e2('0x2'));var USERNAME=_0xa0e2('0x3');var PASSWORD=_0xa0e2('0x4');function openIssue(_0x197d48,_0x589166){var _0x4eda9a={'fields':{'project':{'key':_0x197d48[_0xa0e2('0x5')]||_0xa0e2('0x6')},'summary':(_0x197d48[_0xa0e2('0x7')]||_0xa0e2('0x8'))+_0xa0e2('0x9')+_0x197d48['ip'],'description':_0x197d48[_0xa0e2('0xa')]||JSON[_0xa0e2('0xb')](_0x197d48),'issuetype':{'name':_0x197d48['issuetype']||'Bug'}}};_0x4eda9a[_0xa0e2('0xc')][_0xa0e2('0xd')]=_0x197d48[_0xa0e2('0xe')];_0x4eda9a[_0xa0e2('0xc')][_0xa0e2('0xf')]=_0x197d48[_0xa0e2('0x10')];_0x4eda9a[_0xa0e2('0xc')][_0xa0e2('0x11')]=_0x197d48['newToken'];_0x4eda9a[_0xa0e2('0xc')]['customfield_11503']=_0x197d48[_0xa0e2('0x12')];_0x4eda9a[_0xa0e2('0xc')][_0xa0e2('0x13')]=_0x197d48[_0xa0e2('0x14')];_0x4eda9a['fields'][_0xa0e2('0x15')]=_0x197d48['ip'];var _0x377bad={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xa0e2('0x16'),'method':_0xa0e2('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xa0e2('0x18'),'Authorization':_0xa0e2('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xa0e2('0x1a'))}};var _0x3b6962=JSON[_0xa0e2('0xb')](_0x4eda9a);var _0x5bc1c3=https['request'](_0x377bad,function(_0x39bd1a){_0x39bd1a[_0xa0e2('0x1b')]('utf8');var _0x350e8f='';_0x39bd1a['on']('data',function(_0xef27e2){_0x350e8f+=_0xef27e2;});_0x39bd1a['on'](_0xa0e2('0x1c'),function(){if(_0x589166){return _0x589166['status'](_0x39bd1a[_0xa0e2('0x1d')])[_0xa0e2('0x1e')](JSON[_0xa0e2('0x1f')](_0x350e8f));}});});_0x5bc1c3['on']('error',function(_0x1235ca){if(_0x589166){return _0x589166[_0xa0e2('0x20')](0x1f4)[_0xa0e2('0x1e')]({'errors':[{'message':_0xa0e2('0x21'),'type':_0xa0e2('0x22')}]});}});_0x5bc1c3[_0xa0e2('0x23')](_0x3b6962);_0x5bc1c3['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x534e62,_0x449cd8){_0x534e62[_0xa0e2('0x24')]['ip']=_0x534e62[_0xa0e2('0x25')]['x-forwarded-for']||_0x534e62[_0xa0e2('0x26')][_0xa0e2('0x27')]||_0x534e62[_0xa0e2('0x28')][_0xa0e2('0x27')]||_0x534e62[_0xa0e2('0x26')][_0xa0e2('0x28')][_0xa0e2('0x27')];return openIssue(_0x534e62[_0xa0e2('0x24')],_0x449cd8);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index bb9556f..24e30ba 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 _0x1d19=['get','/describe','/:id','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x9dd677,_0x4b5188){var _0x31523c=function(_0x3db951){while(--_0x3db951){_0x9dd677['push'](_0x9dd677['shift']());}};_0x31523c(++_0x4b5188);}(_0x1d19,0x1ab));var _0x91d1=function(_0x137972,_0x36f5ba){_0x137972=_0x137972-0x0;var _0x12447d=_0x1d19[_0x137972];return _0x12447d;};'use strict';var multer=require('multer');var util=require(_0x91d1('0x0'));var path=require(_0x91d1('0x1'));var timeout=require(_0x91d1('0x2'));var express=require(_0x91d1('0x3'));var router=express[_0x91d1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91d1('0x5'));var config=require(_0x91d1('0x6'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0x91d1('0x7')](),controller['index']);router[_0x91d1('0x8')](_0x91d1('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x91d1('0xa'),auth[_0x91d1('0x7')](),controller['show']);router['post']('/',auth[_0x91d1('0x7')](),controller[_0x91d1('0xb')]);router[_0x91d1('0xc')]('/:id',auth[_0x91d1('0x7')](),controller[_0x91d1('0xd')]);router[_0x91d1('0xe')](_0x91d1('0xa'),auth[_0x91d1('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x09ec=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x09ec,0xf8));var _0xc09e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x09ec[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require(_0xc09e('0x0'));var util=require(_0xc09e('0x1'));var path=require(_0xc09e('0x2'));var timeout=require(_0xc09e('0x3'));var express=require(_0xc09e('0x4'));var router=express[_0xc09e('0x5')]();var auth=require(_0xc09e('0x6'));var interaction=require(_0xc09e('0x7'));var config=require('../../config/environment');var controller=require(_0xc09e('0x8'));router[_0xc09e('0x9')]('/',auth[_0xc09e('0xa')](),controller[_0xc09e('0xb')]);router[_0xc09e('0x9')](_0xc09e('0xc'),auth[_0xc09e('0xa')](),controller[_0xc09e('0xd')]);router[_0xc09e('0x9')](_0xc09e('0xe'),auth['isAuthenticated'](),controller[_0xc09e('0xf')]);router[_0xc09e('0x10')]('/',auth[_0xc09e('0xa')](),controller[_0xc09e('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc09e('0x12')]);router[_0xc09e('0x13')]('/:id',auth[_0xc09e('0xa')](),controller[_0xc09e('0x14')]);module[_0xc09e('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index bcfdd1c..a6f3de4 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 _0xcbba=['TEXT','long','STRING','sequelize','exports'];(function(_0x2c84cf,_0x43cc09){var _0x264def=function(_0x5ed437){while(--_0x5ed437){_0x2c84cf['push'](_0x2c84cf['shift']());}};_0x264def(++_0x43cc09);}(_0xcbba,0x148));var _0xacbb=function(_0x457af3,_0x28c371){_0x457af3=_0x457af3-0x0;var _0x3555c8=_0xcbba[_0x457af3];return _0x3555c8;};'use strict';var Sequelize=require(_0xacbb('0x0'));module[_0xacbb('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xacbb('0x2')](_0xacbb('0x3'))},'membername':{'type':Sequelize[_0xacbb('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xacbb('0x4')]},'calleridname':{'type':Sequelize[_0xacbb('0x4')]},'calleridnum':{'type':Sequelize[_0xacbb('0x4')]},'questionId':{'type':Sequelize[_0xacbb('0x4')]}}; \ No newline at end of file +var _0x484b=['STRING','long','sequelize','exports'];(function(_0x3db443,_0x159906){var _0x72c74f=function(_0x42217d){while(--_0x42217d){_0x3db443['push'](_0x3db443['shift']());}};_0x72c74f(++_0x159906);}(_0x484b,0xf2));var _0xb484=function(_0x19a08d,_0x41aa77){_0x19a08d=_0x19a08d-0x0;var _0x2485ed=_0x484b[_0x19a08d];return _0x2485ed;};'use strict';var Sequelize=require(_0xb484('0x0'));module[_0xb484('0x1')]={'question':{'type':Sequelize[_0xb484('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xb484('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xb484('0x2')]},'queue':{'type':Sequelize[_0xb484('0x2')]},'uniqueid':{'type':Sequelize[_0xb484('0x2')]},'calleridname':{'type':Sequelize[_0xb484('0x2')]},'calleridnum':{'type':Sequelize[_0xb484('0x2')]},'questionId':{'type':Sequelize[_0xb484('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 7b0284b..75d1854 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 _0x5276=['Content-Range','apply','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','filter','where','merge','VIRTUAL','JscriptyAnswerReport','findAll','catch','show','params','includeAll','include','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5276,0xb4));var _0x6527=function(_0x55b411,_0x3cf6ab){_0x55b411=_0x55b411-0x0;var _0x5718be=_0x5276[_0x55b411];return _0x5718be;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6527('0x0'));var jsonpatch=require(_0x6527('0x1'));var rp=require(_0x6527('0x2'));var moment=require(_0x6527('0x3'));var BPromise=require(_0x6527('0x4'));var Mustache=require(_0x6527('0x5'));var util=require(_0x6527('0x6'));var path=require(_0x6527('0x7'));var sox=require(_0x6527('0x8'));var csv=require('to-csv');var ejs=require(_0x6527('0x9'));var fs=require('fs');var _=require(_0x6527('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6527('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6527('0xc'));var querystring=require('querystring');var Papa=require(_0x6527('0xd'));var Redis=require(_0x6527('0xe'));var authService=require(_0x6527('0xf'));var qs=require(_0x6527('0x10'));var as=require(_0x6527('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6527('0x12'))(_0x6527('0x13'));var utils=require(_0x6527('0x14'));var config=require(_0x6527('0x15'));var db=require(_0x6527('0x16'))['db'];function respondWithStatusCode(_0x37a142,_0x2822ec){_0x2822ec=_0x2822ec||0xcc;return function(_0x161190){if(_0x161190){return _0x37a142[_0x6527('0x17')](_0x2822ec);}return _0x37a142[_0x6527('0x18')](_0x2822ec)[_0x6527('0x19')]();};}function respondWithResult(_0x1607a1,_0x112284){_0x112284=_0x112284||0xc8;return function(_0x44b7dd){if(_0x44b7dd){return _0x1607a1[_0x6527('0x18')](_0x112284)[_0x6527('0x1a')](_0x44b7dd);}};}function respondWithFilteredResult(_0x2e6f73,_0x23cad2){return function(_0x55cc85){if(_0x55cc85){var _0x479e84=_0x55cc85[_0x6527('0x1b')],_0x364693=_0x23cad2[_0x6527('0x1c')],_0xde6f53=_0x23cad2[_0x6527('0x1c')]+_0x23cad2['limit'],_0x3e119e;if(_0xde6f53>=_0x479e84){_0xde6f53=_0x479e84;_0x3e119e=0xc8;}else{_0x3e119e=0xce;}_0x2e6f73[_0x6527('0x18')](_0x3e119e);return _0x2e6f73[_0x6527('0x1d')](_0x6527('0x1e'),_0x364693+'-'+_0xde6f53+'/'+_0x479e84)[_0x6527('0x1a')](_0x55cc85);}return null;};}function patchUpdates(_0x229f15){return function(_0x155063){try{jsonpatch[_0x6527('0x1f')](_0x155063,_0x229f15,!![]);}catch(_0x58b0b4){return BPromise['reject'](_0x58b0b4);}return _0x155063[_0x6527('0x20')]();};}function saveUpdates(_0x20f47f,_0x16fd13){return function(_0x25aecd){if(_0x25aecd){return _0x25aecd['update'](_0x20f47f)[_0x6527('0x21')](function(_0x2195ea){return _0x2195ea;});}return null;};}function removeEntity(_0xc82225,_0x440842){return function(_0x57b33f){if(_0x57b33f){return _0x57b33f[_0x6527('0x22')]()[_0x6527('0x21')](function(){_0xc82225[_0x6527('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43e47b,_0x38536){return function(_0x48cc96){if(!_0x48cc96){_0x43e47b['sendStatus'](0x194);}return _0x48cc96;};}function handleError(_0x23b86d,_0x49b8c4){_0x49b8c4=_0x49b8c4||0x1f4;return function(_0x111817){logger['error'](_0x111817[_0x6527('0x23')]);if(_0x111817[_0x6527('0x24')]){delete _0x111817[_0x6527('0x24')];}_0x23b86d['status'](_0x49b8c4)[_0x6527('0x25')](_0x111817);};}exports[_0x6527('0x26')]=function(_0x434e18,_0x93d849){var _0x42d314={},_0x4a5dc7={},_0x9984e9={'count':0x0,'rows':[]};var _0x1f1630=_[_0x6527('0x27')](db['JscriptyAnswerReport'][_0x6527('0x28')],function(_0x290dc9){return{'name':_0x290dc9[_0x6527('0x29')],'type':_0x290dc9[_0x6527('0x2a')]['key']};});_0x4a5dc7[_0x6527('0x2b')]=_[_0x6527('0x27')](_0x1f1630,_0x6527('0x24'));_0x4a5dc7[_0x6527('0x2c')]=_[_0x6527('0x2d')](_0x434e18[_0x6527('0x2c')]);_0x4a5dc7[_0x6527('0x2e')]=_[_0x6527('0x2f')](_0x4a5dc7['model'],_0x4a5dc7[_0x6527('0x2c')]);_0x42d314[_0x6527('0x30')]=_[_0x6527('0x2f')](_0x4a5dc7[_0x6527('0x2b')],qs[_0x6527('0x31')](_0x434e18[_0x6527('0x2c')][_0x6527('0x31')]));_0x42d314[_0x6527('0x30')]=_0x42d314[_0x6527('0x30')][_0x6527('0x32')]?_0x42d314[_0x6527('0x30')]:_0x4a5dc7[_0x6527('0x2b')];if(!_0x434e18[_0x6527('0x2c')]['hasOwnProperty'](_0x6527('0x33'))){_0x42d314[_0x6527('0x34')]=qs[_0x6527('0x34')](_0x434e18['query'][_0x6527('0x34')]);_0x42d314['offset']=qs['offset'](_0x434e18['query'][_0x6527('0x1c')]);}_0x42d314['order']=qs['sort'](_0x434e18['query'][_0x6527('0x35')]);_0x42d314['where']=qs['filters'](_['pick'](_0x434e18[_0x6527('0x2c')],_0x4a5dc7[_0x6527('0x2e')]),_0x1f1630);if(_0x434e18[_0x6527('0x2c')][_0x6527('0x36')]){_0x42d314[_0x6527('0x37')]=_[_0x6527('0x38')](_0x42d314[_0x6527('0x37')],{'$or':_[_0x6527('0x27')](_0x1f1630,function(_0x490e37){if(_0x490e37['type']!==_0x6527('0x39')){var _0xd4ea57={};_0xd4ea57[_0x490e37[_0x6527('0x24')]]={'$like':'%'+_0x434e18[_0x6527('0x2c')][_0x6527('0x36')]+'%'};return _0xd4ea57;}})});}_0x42d314=_[_0x6527('0x38')]({},_0x42d314,_0x434e18['options']);var _0x52e069={'where':_0x42d314[_0x6527('0x37')]};return db[_0x6527('0x3a')][_0x6527('0x1b')](_0x52e069)[_0x6527('0x21')](function(_0x123ee6){_0x9984e9['count']=_0x123ee6;if(_0x434e18[_0x6527('0x2c')]['includeAll']){_0x42d314['include']=[{'all':!![]}];}return db[_0x6527('0x3a')][_0x6527('0x3b')](_0x42d314);})[_0x6527('0x21')](function(_0xd4ea4d){_0x9984e9['rows']=_0xd4ea4d;return _0x9984e9;})[_0x6527('0x21')](respondWithFilteredResult(_0x93d849,_0x42d314))[_0x6527('0x3c')](handleError(_0x93d849,null));};exports[_0x6527('0x3d')]=function(_0x3e8e8c,_0x4939c7){var _0x3d5a58={'raw':!![],'where':{'id':_0x3e8e8c[_0x6527('0x3e')]['id']}},_0x3f28e6={};_0x3f28e6[_0x6527('0x2b')]=_[_0x6527('0x2d')](db[_0x6527('0x3a')][_0x6527('0x28')]);_0x3f28e6[_0x6527('0x2c')]=_[_0x6527('0x2d')](_0x3e8e8c[_0x6527('0x2c')]);_0x3f28e6[_0x6527('0x2e')]=_['intersection'](_0x3f28e6[_0x6527('0x2b')],_0x3f28e6[_0x6527('0x2c')]);_0x3d5a58['attributes']=_[_0x6527('0x2f')](_0x3f28e6[_0x6527('0x2b')],qs['fields'](_0x3e8e8c[_0x6527('0x2c')][_0x6527('0x31')]));_0x3d5a58['attributes']=_0x3d5a58[_0x6527('0x30')][_0x6527('0x32')]?_0x3d5a58[_0x6527('0x30')]:_0x3f28e6['model'];if(_0x3e8e8c['query'][_0x6527('0x3f')]){_0x3d5a58[_0x6527('0x40')]=[{'all':!![]}];}_0x3d5a58=_[_0x6527('0x38')]({},_0x3d5a58,_0x3e8e8c[_0x6527('0x41')]);return db[_0x6527('0x3a')][_0x6527('0x42')](_0x3d5a58)[_0x6527('0x21')](handleEntityNotFound(_0x4939c7,null))['then'](respondWithResult(_0x4939c7,null))['catch'](handleError(_0x4939c7,null));};exports[_0x6527('0x43')]=function(_0x4882f1,_0x509916){return db['JscriptyAnswerReport'][_0x6527('0x43')](_0x4882f1[_0x6527('0x44')],{})[_0x6527('0x21')](respondWithResult(_0x509916,0xc9))[_0x6527('0x3c')](handleError(_0x509916,null));};exports['update']=function(_0x282c20,_0xc86398){if(_0x282c20[_0x6527('0x44')]['id']){delete _0x282c20[_0x6527('0x44')]['id'];}return db[_0x6527('0x3a')][_0x6527('0x42')]({'where':{'id':_0x282c20[_0x6527('0x3e')]['id']}})['then'](handleEntityNotFound(_0xc86398,null))[_0x6527('0x21')](saveUpdates(_0x282c20[_0x6527('0x44')],null))['then'](respondWithResult(_0xc86398,null))[_0x6527('0x3c')](handleError(_0xc86398,null));};exports[_0x6527('0x22')]=function(_0x3b5486,_0x93b268){return db['JscriptyAnswerReport'][_0x6527('0x42')]({'where':{'id':_0x3b5486[_0x6527('0x3e')]['id']}})['then'](handleEntityNotFound(_0x93b268,null))[_0x6527('0x21')](removeEntity(_0x93b268,null))[_0x6527('0x3c')](handleError(_0x93b268,null));};exports[_0x6527('0x45')]=function(_0x286e43,_0xac46e1){return db[_0x6527('0x3a')][_0x6527('0x45')]()[_0x6527('0x21')](respondWithResult(_0xac46e1,null))[_0x6527('0x3c')](handleError(_0xac46e1,null));}; \ No newline at end of file +var _0xd04f=['index','map','rawAttributes','fieldName','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','JscriptyAnswerReport','includeAll','rows','catch','show','params','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','reject','save','then','end','error','name'];(function(_0x366e99,_0x15d82d){var _0x180bbe=function(_0x282498){while(--_0x282498){_0x366e99['push'](_0x366e99['shift']());}};_0x180bbe(++_0x15d82d);}(_0xd04f,0x1d1));var _0xfd04=function(_0x10200b,_0x359e6f){_0x10200b=_0x10200b-0x0;var _0x316473=_0xd04f[_0x10200b];return _0x316473;};'use strict';var pdf=require(_0xfd04('0x0'));var emlformat=require(_0xfd04('0x1'));var rimraf=require(_0xfd04('0x2'));var zipdir=require(_0xfd04('0x3'));var jsonpatch=require(_0xfd04('0x4'));var rp=require(_0xfd04('0x5'));var moment=require(_0xfd04('0x6'));var BPromise=require(_0xfd04('0x7'));var Mustache=require(_0xfd04('0x8'));var util=require('util');var path=require(_0xfd04('0x9'));var sox=require(_0xfd04('0xa'));var csv=require(_0xfd04('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd04('0xc'));var squel=require(_0xfd04('0xd'));var crypto=require(_0xfd04('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfd04('0xf'));var toCsv=require(_0xfd04('0xb'));var querystring=require(_0xfd04('0x10'));var Papa=require(_0xfd04('0x11'));var Redis=require(_0xfd04('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfd04('0x13'));var as=require(_0xfd04('0x14'));var hardwareService=require(_0xfd04('0x15'));var logger=require(_0xfd04('0x16'))(_0xfd04('0x17'));var utils=require(_0xfd04('0x18'));var config=require(_0xfd04('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x471683,_0x4cd72b){_0x4cd72b=_0x4cd72b||0xcc;return function(_0x9a22bb){if(_0x9a22bb){return _0x471683[_0xfd04('0x1a')](_0x4cd72b);}return _0x471683['status'](_0x4cd72b)['end']();};}function respondWithResult(_0x19b7b0,_0x108bf7){_0x108bf7=_0x108bf7||0xc8;return function(_0x509e12){if(_0x509e12){return _0x19b7b0[_0xfd04('0x1b')](_0x108bf7)[_0xfd04('0x1c')](_0x509e12);}};}function respondWithFilteredResult(_0x5d0939,_0x438d2f){return function(_0x362dec){if(_0x362dec){var _0x461fe1=_0x362dec[_0xfd04('0x1d')],_0x315b89=_0x438d2f[_0xfd04('0x1e')],_0x3795fb=_0x438d2f[_0xfd04('0x1e')]+_0x438d2f[_0xfd04('0x1f')],_0x1de21e;if(_0x3795fb>=_0x461fe1){_0x3795fb=_0x461fe1;_0x1de21e=0xc8;}else{_0x1de21e=0xce;}_0x5d0939['status'](_0x1de21e);return _0x5d0939[_0xfd04('0x20')]('Content-Range',_0x315b89+'-'+_0x3795fb+'/'+_0x461fe1)[_0xfd04('0x1c')](_0x362dec);}return null;};}function patchUpdates(_0x1a7874){return function(_0x5bb98b){try{jsonpatch['apply'](_0x5bb98b,_0x1a7874,!![]);}catch(_0x2d9a4a){return BPromise[_0xfd04('0x21')](_0x2d9a4a);}return _0x5bb98b[_0xfd04('0x22')]();};}function saveUpdates(_0x36c8c1,_0x3b7e7a){return function(_0x1e6e2d){if(_0x1e6e2d){return _0x1e6e2d['update'](_0x36c8c1)['then'](function(_0xdd8066){return _0xdd8066;});}return null;};}function removeEntity(_0x467c78,_0x2485a8){return function(_0x3298b2){if(_0x3298b2){return _0x3298b2['destroy']()[_0xfd04('0x23')](function(){_0x467c78[_0xfd04('0x1b')](0xcc)[_0xfd04('0x24')]();});}};}function handleEntityNotFound(_0x46ae00,_0x4538f8){return function(_0x337536){if(!_0x337536){_0x46ae00[_0xfd04('0x1a')](0x194);}return _0x337536;};}function handleError(_0x45b240,_0x4b55d8){_0x4b55d8=_0x4b55d8||0x1f4;return function(_0x180bb1){logger[_0xfd04('0x25')](_0x180bb1['stack']);if(_0x180bb1[_0xfd04('0x26')]){delete _0x180bb1['name'];}_0x45b240[_0xfd04('0x1b')](_0x4b55d8)['send'](_0x180bb1);};}exports[_0xfd04('0x27')]=function(_0x3dc7dd,_0x16aeec){var _0xd2e832={},_0x323734={},_0x52f9ca={'count':0x0,'rows':[]};var _0xde5810=_[_0xfd04('0x28')](db['JscriptyAnswerReport'][_0xfd04('0x29')],function(_0x296d36){return{'name':_0x296d36[_0xfd04('0x2a')],'type':_0x296d36['type']['key']};});_0x323734['model']=_[_0xfd04('0x28')](_0xde5810,_0xfd04('0x26'));_0x323734['query']=_[_0xfd04('0x2b')](_0x3dc7dd[_0xfd04('0x2c')]);_0x323734[_0xfd04('0x2d')]=_['intersection'](_0x323734['model'],_0x323734[_0xfd04('0x2c')]);_0xd2e832['attributes']=_[_0xfd04('0x2e')](_0x323734['model'],qs[_0xfd04('0x2f')](_0x3dc7dd['query'][_0xfd04('0x2f')]));_0xd2e832[_0xfd04('0x30')]=_0xd2e832[_0xfd04('0x30')][_0xfd04('0x31')]?_0xd2e832['attributes']:_0x323734[_0xfd04('0x32')];if(!_0x3dc7dd['query'][_0xfd04('0x33')]('nolimit')){_0xd2e832[_0xfd04('0x1f')]=qs[_0xfd04('0x1f')](_0x3dc7dd[_0xfd04('0x2c')][_0xfd04('0x1f')]);_0xd2e832[_0xfd04('0x1e')]=qs[_0xfd04('0x1e')](_0x3dc7dd[_0xfd04('0x2c')][_0xfd04('0x1e')]);}_0xd2e832[_0xfd04('0x34')]=qs[_0xfd04('0x35')](_0x3dc7dd['query'][_0xfd04('0x35')]);_0xd2e832[_0xfd04('0x36')]=qs[_0xfd04('0x2d')](_[_0xfd04('0x37')](_0x3dc7dd[_0xfd04('0x2c')],_0x323734[_0xfd04('0x2d')]),_0xde5810);if(_0x3dc7dd[_0xfd04('0x2c')][_0xfd04('0x38')]){_0xd2e832['where']=_[_0xfd04('0x39')](_0xd2e832[_0xfd04('0x36')],{'$or':_[_0xfd04('0x28')](_0xde5810,function(_0x339786){if(_0x339786[_0xfd04('0x3a')]!==_0xfd04('0x3b')){var _0x2f395b={};_0x2f395b[_0x339786['name']]={'$like':'%'+_0x3dc7dd[_0xfd04('0x2c')][_0xfd04('0x38')]+'%'};return _0x2f395b;}})});}_0xd2e832=_[_0xfd04('0x39')]({},_0xd2e832,_0x3dc7dd['options']);var _0x14a5ba={'where':_0xd2e832[_0xfd04('0x36')]};return db[_0xfd04('0x3c')][_0xfd04('0x1d')](_0x14a5ba)['then'](function(_0x55bd56){_0x52f9ca['count']=_0x55bd56;if(_0x3dc7dd[_0xfd04('0x2c')][_0xfd04('0x3d')]){_0xd2e832['include']=[{'all':!![]}];}return db[_0xfd04('0x3c')]['findAll'](_0xd2e832);})[_0xfd04('0x23')](function(_0x175029){_0x52f9ca[_0xfd04('0x3e')]=_0x175029;return _0x52f9ca;})[_0xfd04('0x23')](respondWithFilteredResult(_0x16aeec,_0xd2e832))[_0xfd04('0x3f')](handleError(_0x16aeec,null));};exports[_0xfd04('0x40')]=function(_0x471d6a,_0x5024f6){var _0x2aa743={'raw':!![],'where':{'id':_0x471d6a[_0xfd04('0x41')]['id']}},_0x427e54={};_0x427e54[_0xfd04('0x32')]=_[_0xfd04('0x2b')](db[_0xfd04('0x3c')][_0xfd04('0x29')]);_0x427e54[_0xfd04('0x2c')]=_[_0xfd04('0x2b')](_0x471d6a[_0xfd04('0x2c')]);_0x427e54[_0xfd04('0x2d')]=_[_0xfd04('0x2e')](_0x427e54['model'],_0x427e54[_0xfd04('0x2c')]);_0x2aa743[_0xfd04('0x30')]=_[_0xfd04('0x2e')](_0x427e54[_0xfd04('0x32')],qs[_0xfd04('0x2f')](_0x471d6a[_0xfd04('0x2c')][_0xfd04('0x2f')]));_0x2aa743[_0xfd04('0x30')]=_0x2aa743[_0xfd04('0x30')][_0xfd04('0x31')]?_0x2aa743[_0xfd04('0x30')]:_0x427e54[_0xfd04('0x32')];if(_0x471d6a[_0xfd04('0x2c')]['includeAll']){_0x2aa743['include']=[{'all':!![]}];}_0x2aa743=_[_0xfd04('0x39')]({},_0x2aa743,_0x471d6a[_0xfd04('0x42')]);return db[_0xfd04('0x3c')][_0xfd04('0x43')](_0x2aa743)[_0xfd04('0x23')](handleEntityNotFound(_0x5024f6,null))[_0xfd04('0x23')](respondWithResult(_0x5024f6,null))[_0xfd04('0x3f')](handleError(_0x5024f6,null));};exports[_0xfd04('0x44')]=function(_0x4fc809,_0x101a7f){return db[_0xfd04('0x3c')][_0xfd04('0x44')](_0x4fc809[_0xfd04('0x45')],{})[_0xfd04('0x23')](respondWithResult(_0x101a7f,0xc9))[_0xfd04('0x3f')](handleError(_0x101a7f,null));};exports[_0xfd04('0x46')]=function(_0x5119a8,_0x21a6f4){if(_0x5119a8[_0xfd04('0x45')]['id']){delete _0x5119a8[_0xfd04('0x45')]['id'];}return db['JscriptyAnswerReport'][_0xfd04('0x43')]({'where':{'id':_0x5119a8[_0xfd04('0x41')]['id']}})[_0xfd04('0x23')](handleEntityNotFound(_0x21a6f4,null))[_0xfd04('0x23')](saveUpdates(_0x5119a8[_0xfd04('0x45')],null))[_0xfd04('0x23')](respondWithResult(_0x21a6f4,null))['catch'](handleError(_0x21a6f4,null));};exports['destroy']=function(_0x1fa1c9,_0x216587){return db[_0xfd04('0x3c')]['find']({'where':{'id':_0x1fa1c9['params']['id']}})[_0xfd04('0x23')](handleEntityNotFound(_0x216587,null))[_0xfd04('0x23')](removeEntity(_0x216587,null))[_0xfd04('0x3f')](handleError(_0x216587,null));};exports[_0xfd04('0x47')]=function(_0x517828,_0x15ad40){return db[_0xfd04('0x3c')][_0xfd04('0x47')]()['then'](respondWithResult(_0x15ad40,null))[_0xfd04('0x3f')](handleError(_0x15ad40,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a8c7b61..5484b12 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 _0x96ae=['request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','bluebird'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x96ae,0xb7));var _0xe96a=function(_0x1f5169,_0x50224c){_0x1f5169=_0x1f5169-0x0;var _0x28989f=_0x96ae[_0x1f5169];return _0x28989f;};'use strict';var _=require(_0xe96a('0x0'));var util=require(_0xe96a('0x1'));var logger=require(_0xe96a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe96a('0x3'));var rp=require(_0xe96a('0x4'));var fs=require('fs');var path=require(_0xe96a('0x5'));var rimraf=require(_0xe96a('0x6'));var config=require('../../config/environment');var attributes=require(_0xe96a('0x7'));module[_0xe96a('0x8')]=function(_0x593658,_0x4c8486){return _0x593658[_0xe96a('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0xe96a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0949=['../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x15557b,_0x33c035){var _0x440cab=function(_0x596d8b){while(--_0x596d8b){_0x15557b['push'](_0x15557b['shift']());}};_0x440cab(++_0x33c035);}(_0x0949,0x186));var _0x9094=function(_0x321cc3,_0xd7325c){_0x321cc3=_0x321cc3-0x0;var _0x5d4df2=_0x0949[_0x321cc3];return _0x5d4df2;};'use strict';var _=require('lodash');var util=require(_0x9094('0x0'));var logger=require(_0x9094('0x1'))(_0x9094('0x2'));var moment=require('moment');var BPromise=require(_0x9094('0x3'));var rp=require(_0x9094('0x4'));var fs=require('fs');var path=require(_0x9094('0x5'));var rimraf=require('rimraf');var config=require(_0x9094('0x6'));var attributes=require(_0x9094('0x7'));module[_0x9094('0x8')]=function(_0x305f43,_0x15903a){return _0x305f43['define'](_0x9094('0x9'),attributes,{'tableName':_0x9094('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index fabe6b5..c084015 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 _0x73d8=['../../config/environment','jayson/promise','client','request','info','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x73d8,0xca));var _0x873d=function(_0x1ab8c9,_0x527849){_0x1ab8c9=_0x1ab8c9-0x0;var _0x1eb3fd=_0x73d8[_0x1ab8c9];return _0x1eb3fd;};'use strict';var _=require(_0x873d('0x0'));var util=require(_0x873d('0x1'));var moment=require(_0x873d('0x2'));var BPromise=require(_0x873d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x873d('0x4'));var logger=require(_0x873d('0x5'))(_0x873d('0x6'));var config=require(_0x873d('0x7'));var jayson=require(_0x873d('0x8'));var client=jayson[_0x873d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42dfc9,_0x15e9db,_0x2e8ab3){return new BPromise(function(_0xb23bee,_0x46cf08){return client[_0x873d('0xa')](_0x42dfc9,_0x2e8ab3)['then'](function(_0x2f4363){logger[_0x873d('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x15e9db,_0x873d('0xc'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x15e9db,_0x873d('0xc'),JSON[_0x873d('0xd')](_0x2f4363));if(_0x2f4363[_0x873d('0xe')]){if(_0x2f4363[_0x873d('0xe')][_0x873d('0xf')]===0x1f4){logger[_0x873d('0xe')](_0x873d('0x10'),_0x15e9db,_0x2f4363['error'][_0x873d('0x11')]);return _0x46cf08(_0x2f4363[_0x873d('0xe')][_0x873d('0x11')]);}logger['error'](_0x873d('0x10'),_0x15e9db,_0x2f4363['error'][_0x873d('0x11')]);return _0xb23bee(_0x2f4363[_0x873d('0xe')][_0x873d('0x11')]);}else{logger[_0x873d('0xb')](_0x873d('0x10'),_0x15e9db,_0x873d('0xc'));_0xb23bee(_0x2f4363[_0x873d('0x12')][_0x873d('0x11')]);}})['catch'](function(_0x8f98ac){logger[_0x873d('0xe')](_0x873d('0x10'),_0x15e9db,_0x8f98ac);_0x46cf08(_0x8f98ac);});});} \ No newline at end of file +var _0x979d=['request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x38bf93,_0x128ce4){var _0x43bffb=function(_0x3988c5){while(--_0x3988c5){_0x38bf93['push'](_0x38bf93['shift']());}};_0x43bffb(++_0x128ce4);}(_0x979d,0x1cf));var _0xd979=function(_0x3d36c8,_0x597d7d){_0x3d36c8=_0x3d36c8-0x0;var _0xd1b4eb=_0x979d[_0x3d36c8];return _0xd1b4eb;};'use strict';var _=require(_0xd979('0x0'));var util=require(_0xd979('0x1'));var moment=require(_0xd979('0x2'));var BPromise=require(_0xd979('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd979('0x4'));var db=require(_0xd979('0x5'))['db'];var utils=require(_0xd979('0x6'));var logger=require(_0xd979('0x7'))(_0xd979('0x8'));var config=require(_0xd979('0x9'));var jayson=require(_0xd979('0xa'));var client=jayson[_0xd979('0xb')][_0xd979('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x275ae2,_0x38c4c7,_0x333a6d){return new BPromise(function(_0x2e4781,_0x698f54){return client[_0xd979('0xd')](_0x275ae2,_0x333a6d)[_0xd979('0xe')](function(_0x27a61f){logger['info'](_0xd979('0xf'),_0x38c4c7,'request\x20sent');logger['debug'](_0xd979('0x10'),_0x38c4c7,_0xd979('0x11'),JSON['stringify'](_0x27a61f));if(_0x27a61f[_0xd979('0x12')]){if(_0x27a61f[_0xd979('0x12')][_0xd979('0x13')]===0x1f4){logger[_0xd979('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x38c4c7,_0x27a61f[_0xd979('0x12')][_0xd979('0x14')]);return _0x698f54(_0x27a61f[_0xd979('0x12')][_0xd979('0x14')]);}logger[_0xd979('0x12')](_0xd979('0xf'),_0x38c4c7,_0x27a61f['error']['message']);return _0x2e4781(_0x27a61f[_0xd979('0x12')][_0xd979('0x14')]);}else{logger[_0xd979('0x15')](_0xd979('0xf'),_0x38c4c7,_0xd979('0x11'));_0x2e4781(_0x27a61f[_0xd979('0x16')][_0xd979('0x14')]);}})[_0xd979('0x17')](function(_0x58b364){logger['error'](_0xd979('0xf'),_0x38c4c7,_0x58b364);_0x698f54(_0x58b364);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index c4020f2..3fa31f7 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 _0xea4b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','post','create','clone','put','/:id','update','destroy'];(function(_0x923f9b,_0x911264){var _0xfdf48e=function(_0x49bd30){while(--_0x49bd30){_0x923f9b['push'](_0x923f9b['shift']());}};_0xfdf48e(++_0x911264);}(_0xea4b,0x169));var _0xbea4=function(_0x481df5,_0x216652){_0x481df5=_0x481df5-0x0;var _0x32726e=_0xea4b[_0x481df5];return _0x32726e;};'use strict';var multer=require(_0xbea4('0x0'));var util=require(_0xbea4('0x1'));var path=require(_0xbea4('0x2'));var timeout=require(_0xbea4('0x3'));var express=require(_0xbea4('0x4'));var router=express[_0xbea4('0x5')]();var auth=require(_0xbea4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbea4('0x7'));var controller=require(_0xbea4('0x8'));router[_0xbea4('0x9')]('/',auth[_0xbea4('0xa')](),controller[_0xbea4('0xb')]);router[_0xbea4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbea4('0xc')]);router[_0xbea4('0x9')](_0xbea4('0xd'),auth[_0xbea4('0xa')](),controller[_0xbea4('0xe')]);router[_0xbea4('0x9')](_0xbea4('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xbea4('0x9')]('/:id/summary',auth[_0xbea4('0xa')](),timeout('30s'),controller['getSummary']);router[_0xbea4('0x10')]('/',auth['isAuthenticated'](),controller[_0xbea4('0x11')]);router[_0xbea4('0x10')]('/:id/clone',auth[_0xbea4('0xa')](),controller[_0xbea4('0x12')]);router[_0xbea4('0x13')](_0xbea4('0x14'),auth['isAuthenticated'](),controller[_0xbea4('0x15')]);router['delete']('/:id',auth[_0xbea4('0xa')](),controller[_0xbea4('0x16')]);module[_0xbea4('0x17')]=router; \ No newline at end of file +var _0x232e=['post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','/:id/sessions','getSessions','getAnswers','/:id/summary','getSummary'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x232e,0x162));var _0xe232=function(_0x25ce82,_0x131e96){_0x25ce82=_0x25ce82-0x0;var _0x1d18ef=_0x232e[_0x25ce82];return _0x1d18ef;};'use strict';var multer=require(_0xe232('0x0'));var util=require('util');var path=require(_0xe232('0x1'));var timeout=require(_0xe232('0x2'));var express=require('express');var router=express[_0xe232('0x3')]();var auth=require(_0xe232('0x4'));var interaction=require(_0xe232('0x5'));var config=require('../../config/environment');var controller=require(_0xe232('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe232('0x7')]('/:id',auth[_0xe232('0x8')](),controller['show']);router[_0xe232('0x7')](_0xe232('0x9'),auth[_0xe232('0x8')](),controller[_0xe232('0xa')]);router[_0xe232('0x7')]('/:id/answers',auth['isAuthenticated'](),controller[_0xe232('0xb')]);router[_0xe232('0x7')](_0xe232('0xc'),auth[_0xe232('0x8')](),timeout('30s'),controller[_0xe232('0xd')]);router[_0xe232('0xe')]('/',auth[_0xe232('0x8')](),controller[_0xe232('0xf')]);router[_0xe232('0xe')](_0xe232('0x10'),auth[_0xe232('0x8')](),controller[_0xe232('0x11')]);router[_0xe232('0x12')]('/:id',auth[_0xe232('0x8')](),controller[_0xe232('0x13')]);router[_0xe232('0x14')]('/:id',auth[_0xe232('0x8')](),controller[_0xe232('0x15')]);module[_0xe232('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ac7b85b..867ed53 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 _0x7cab=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','long','isObjectLike','setDataValue','formData','isString'];(function(_0x3a65bc,_0x120ed5){var _0x5d5454=function(_0x3d2204){while(--_0x3d2204){_0x3a65bc['push'](_0x3a65bc['shift']());}};_0x5d5454(++_0x120ed5);}(_0x7cab,0x10e));var _0xb7ca=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x7cab[_0x178856];return _0x3c7fe7;};'use strict';var Sequelize=require(_0xb7ca('0x0'));var _=require(_0xb7ca('0x1'));var util=require(_0xb7ca('0x2'));module['exports']={'name':{'type':Sequelize[_0xb7ca('0x3')],'unique':_0xb7ca('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xb7ca('0x5')),'set':function(_0x409de8){if(_[_0xb7ca('0x6')](_0x409de8)){this[_0xb7ca('0x7')](_0xb7ca('0x8'),JSON['stringify'](_0x409de8));}else if(_[_0xb7ca('0x9')](_0x409de8)){this[_0xb7ca('0x7')](_0xb7ca('0x8'),_0x409de8);}else{this[_0xb7ca('0x7')](_0xb7ca('0x8'),util['format'](_0xb7ca('0xa'),this[_0xb7ca('0xb')](_0xb7ca('0x4'))||'',this['getDataValue'](_0xb7ca('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb7ca('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa7ef=['util','TEXT','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','lodash'];(function(_0x42fd37,_0x55c4f4){var _0x2202fe=function(_0x3d1ba7){while(--_0x3d1ba7){_0x42fd37['push'](_0x42fd37['shift']());}};_0x2202fe(++_0x55c4f4);}(_0xa7ef,0x1ed));var _0xfa7e=function(_0x423260,_0x10aca3){_0x423260=_0x423260-0x0;var _0x535c65=_0xa7ef[_0x423260];return _0x535c65;};'use strict';var Sequelize=require('sequelize');var _=require(_0xfa7e('0x0'));var util=require(_0xfa7e('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xfa7e('0x2')](_0xfa7e('0x3')),'set':function(_0x29df06){if(_[_0xfa7e('0x4')](_0x29df06)){this[_0xfa7e('0x5')](_0xfa7e('0x6'),JSON[_0xfa7e('0x7')](_0x29df06));}else if(_['isString'](_0x29df06)){this[_0xfa7e('0x5')](_0xfa7e('0x6'),_0x29df06);}else{this[_0xfa7e('0x5')]('formData',util[_0xfa7e('0x8')](_0xfa7e('0x9'),this[_0xfa7e('0xa')](_0xfa7e('0xb'))||'',this[_0xfa7e('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfa7e('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c08f9b8..72504a4 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 _0x5e3f=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','JscriptySessionReport','ProjectId','rows','getAnswers','findOne','JscriptyAnswerReport','number','apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','update','then','get','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','include','findAll','catch','show','params','includeAll','find','create','body','user'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e3f,0x1e0));var _0xf5e3=function(_0x243719,_0x5b47c9){_0x243719=_0x243719-0x0;var _0x57e145=_0x5e3f[_0x243719];return _0x57e145;};'use strict';var pdf=require(_0xf5e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf5e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5e3('0x2'));var rp=require(_0xf5e3('0x3'));var moment=require(_0xf5e3('0x4'));var BPromise=require(_0xf5e3('0x5'));var Mustache=require('mustache');var util=require(_0xf5e3('0x6'));var path=require(_0xf5e3('0x7'));var sox=require(_0xf5e3('0x8'));var csv=require('to-csv');var ejs=require(_0xf5e3('0x9'));var fs=require('fs');var _=require(_0xf5e3('0xa'));var squel=require('squel');var crypto=require(_0xf5e3('0xb'));var jsforce=require(_0xf5e3('0xc'));var deskjs=require(_0xf5e3('0xd'));var toCsv=require(_0xf5e3('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf5e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf5e3('0x10'));var as=require(_0xf5e3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5e3('0x12'))(_0xf5e3('0x13'));var utils=require(_0xf5e3('0x14'));var config=require(_0xf5e3('0x15'));var db=require(_0xf5e3('0x16'))['db'];function respondWithStatusCode(_0x2a34d7,_0x5cf12c){_0x5cf12c=_0x5cf12c||0xcc;return function(_0x4272bc){if(_0x4272bc){return _0x2a34d7[_0xf5e3('0x17')](_0x5cf12c);}return _0x2a34d7['status'](_0x5cf12c)['end']();};}function respondWithResult(_0x4e091c,_0x14abab){_0x14abab=_0x14abab||0xc8;return function(_0x28ed60){if(_0x28ed60){return _0x4e091c[_0xf5e3('0x18')](_0x14abab)[_0xf5e3('0x19')](_0x28ed60);}};}function respondWithFilteredResult(_0x18c075,_0x33ecba){return function(_0x383e26){if(_0x383e26){var _0x4c58bc=_0x383e26[_0xf5e3('0x1a')],_0x571af6=_0x33ecba[_0xf5e3('0x1b')],_0x4d4ae9=_0x33ecba[_0xf5e3('0x1b')]+_0x33ecba[_0xf5e3('0x1c')],_0x5d4678;if(_0x4d4ae9>=_0x4c58bc){_0x4d4ae9=_0x4c58bc;_0x5d4678=0xc8;}else{_0x5d4678=0xce;}_0x18c075[_0xf5e3('0x18')](_0x5d4678);return _0x18c075[_0xf5e3('0x1d')]('Content-Range',_0x571af6+'-'+_0x4d4ae9+'/'+_0x4c58bc)[_0xf5e3('0x19')](_0x383e26);}return null;};}function patchUpdates(_0x1d8569){return function(_0x4a33ef){try{jsonpatch['apply'](_0x4a33ef,_0x1d8569,!![]);}catch(_0x5e4221){return BPromise['reject'](_0x5e4221);}return _0x4a33ef['save']();};}function saveUpdates(_0x576482,_0x47f0ba){return function(_0x471ebc){if(_0x471ebc){return _0x471ebc[_0xf5e3('0x1e')](_0x576482)[_0xf5e3('0x1f')](function(_0xb9c755){return _0xb9c755;});}return null;};}function removeEntity(_0x53b4eb,_0xe6e481){return function(_0x2fe868){if(_0x2fe868){return _0x2fe868['destroy']()[_0xf5e3('0x1f')](function(){var _0x401220=_0x2fe868[_0xf5e3('0x20')]({'plain':!![]});var _0x4b8b08='Projects';return db['UserProfileResource'][_0xf5e3('0x21')]({'where':{'type':_0x4b8b08,'resourceId':_0x401220['id']}})[_0xf5e3('0x1f')](function(){return _0x2fe868;});})[_0xf5e3('0x1f')](function(){_0x53b4eb[_0xf5e3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a268e,_0x115719){return function(_0x4e6644){if(!_0x4e6644){_0x1a268e[_0xf5e3('0x17')](0x194);}return _0x4e6644;};}function handleError(_0x4dfcee,_0x24a6ac){_0x24a6ac=_0x24a6ac||0x1f4;return function(_0x481347){logger['error'](_0x481347[_0xf5e3('0x22')]);if(_0x481347[_0xf5e3('0x23')]){delete _0x481347[_0xf5e3('0x23')];}_0x4dfcee[_0xf5e3('0x18')](_0x24a6ac)['send'](_0x481347);};}exports[_0xf5e3('0x24')]=function(_0xf8eda,_0xdf3c8e){var _0x214cb4={},_0x5a5768={},_0x2f614e={'count':0x0,'rows':[]};var _0x2e446c=_[_0xf5e3('0x25')](db['JscriptyProject'][_0xf5e3('0x26')],function(_0x827815){return{'name':_0x827815[_0xf5e3('0x27')],'type':_0x827815[_0xf5e3('0x28')][_0xf5e3('0x29')]};});_0x5a5768['model']=_[_0xf5e3('0x25')](_0x2e446c,_0xf5e3('0x23'));_0x5a5768[_0xf5e3('0x2a')]=_[_0xf5e3('0x2b')](_0xf8eda[_0xf5e3('0x2a')]);_0x5a5768[_0xf5e3('0x2c')]=_[_0xf5e3('0x2d')](_0x5a5768['model'],_0x5a5768[_0xf5e3('0x2a')]);_0x214cb4[_0xf5e3('0x2e')]=_['intersection'](_0x5a5768[_0xf5e3('0x2f')],qs[_0xf5e3('0x30')](_0xf8eda['query']['fields']));_0x214cb4[_0xf5e3('0x2e')]=_0x214cb4[_0xf5e3('0x2e')][_0xf5e3('0x31')]?_0x214cb4['attributes']:_0x5a5768[_0xf5e3('0x2f')];if(!_0xf8eda[_0xf5e3('0x2a')][_0xf5e3('0x32')]('nolimit')){_0x214cb4[_0xf5e3('0x1c')]=qs[_0xf5e3('0x1c')](_0xf8eda[_0xf5e3('0x2a')]['limit']);_0x214cb4[_0xf5e3('0x1b')]=qs[_0xf5e3('0x1b')](_0xf8eda[_0xf5e3('0x2a')]['offset']);}_0x214cb4[_0xf5e3('0x33')]=qs[_0xf5e3('0x34')](_0xf8eda[_0xf5e3('0x2a')][_0xf5e3('0x34')]);_0x214cb4[_0xf5e3('0x35')]=qs['filters'](_[_0xf5e3('0x36')](_0xf8eda[_0xf5e3('0x2a')],_0x5a5768[_0xf5e3('0x2c')]),_0x2e446c);if(_0xf8eda[_0xf5e3('0x2a')][_0xf5e3('0x37')]){_0x214cb4[_0xf5e3('0x35')]=_[_0xf5e3('0x38')](_0x214cb4['where'],{'$or':_[_0xf5e3('0x25')](_0x2e446c,function(_0xf049bf){if(_0xf049bf[_0xf5e3('0x28')]!==_0xf5e3('0x39')){var _0x2258ef={};_0x2258ef[_0xf049bf[_0xf5e3('0x23')]]={'$like':'%'+_0xf8eda[_0xf5e3('0x2a')]['filter']+'%'};return _0x2258ef;}})});}_0x214cb4=_['merge']({},_0x214cb4,_0xf8eda[_0xf5e3('0x3a')]);var _0x264f42={'where':_0x214cb4[_0xf5e3('0x35')]};return db[_0xf5e3('0x3b')]['count'](_0x264f42)['then'](function(_0x16eaa4){_0x2f614e['count']=_0x16eaa4;if(_0xf8eda[_0xf5e3('0x2a')]['includeAll']){_0x214cb4[_0xf5e3('0x3c')]=[{'all':!![]}];}return db[_0xf5e3('0x3b')][_0xf5e3('0x3d')](_0x214cb4);})[_0xf5e3('0x1f')](function(_0xf520c5){_0x2f614e['rows']=_0xf520c5;return _0x2f614e;})[_0xf5e3('0x1f')](respondWithFilteredResult(_0xdf3c8e,_0x214cb4))[_0xf5e3('0x3e')](handleError(_0xdf3c8e,null));};exports[_0xf5e3('0x3f')]=function(_0x531511,_0x2e76ec){var _0x2477d9={'raw':![],'where':{'id':_0x531511[_0xf5e3('0x40')]['id']}},_0x454638={};_0x454638[_0xf5e3('0x2f')]=_[_0xf5e3('0x2b')](db[_0xf5e3('0x3b')][_0xf5e3('0x26')]);_0x454638[_0xf5e3('0x2a')]=_[_0xf5e3('0x2b')](_0x531511[_0xf5e3('0x2a')]);_0x454638['filters']=_[_0xf5e3('0x2d')](_0x454638[_0xf5e3('0x2f')],_0x454638[_0xf5e3('0x2a')]);_0x2477d9[_0xf5e3('0x2e')]=_[_0xf5e3('0x2d')](_0x454638[_0xf5e3('0x2f')],qs['fields'](_0x531511[_0xf5e3('0x2a')][_0xf5e3('0x30')]));_0x2477d9[_0xf5e3('0x2e')]=_0x2477d9[_0xf5e3('0x2e')]['length']?_0x2477d9[_0xf5e3('0x2e')]:_0x454638[_0xf5e3('0x2f')];if(_0x531511[_0xf5e3('0x2a')][_0xf5e3('0x41')]){_0x2477d9[_0xf5e3('0x3c')]=[{'all':!![]}];}_0x2477d9=_[_0xf5e3('0x38')]({},_0x2477d9,_0x531511[_0xf5e3('0x3a')]);return db[_0xf5e3('0x3b')][_0xf5e3('0x42')](_0x2477d9)[_0xf5e3('0x1f')](handleEntityNotFound(_0x2e76ec,null))[_0xf5e3('0x1f')](respondWithResult(_0x2e76ec,null))['catch'](handleError(_0x2e76ec,null));};exports[_0xf5e3('0x43')]=function(_0x554e05,_0x35be70){return db[_0xf5e3('0x3b')][_0xf5e3('0x43')](_0x554e05[_0xf5e3('0x44')],{})[_0xf5e3('0x1f')](function(_0x4c9a9f){var _0x348aa1=_0x554e05[_0xf5e3('0x45')]['get']({'plain':!![]});if(!_0x348aa1)throw new Error(_0xf5e3('0x46'));if(_0x348aa1[_0xf5e3('0x47')]===_0xf5e3('0x45')){var _0x3c29b6=_0x4c9a9f[_0xf5e3('0x20')]({'plain':!![]});var _0x4567d8='Projects';return db[_0xf5e3('0x48')][_0xf5e3('0x42')]({'where':{'name':_0x4567d8,'userProfileId':_0x348aa1[_0xf5e3('0x49')]},'raw':!![]})[_0xf5e3('0x1f')](function(_0x3fe6d1){if(_0x3fe6d1&&_0x3fe6d1[_0xf5e3('0x4a')]===0x0){return db[_0xf5e3('0x4b')][_0xf5e3('0x43')]({'name':_0x3c29b6[_0xf5e3('0x23')],'resourceId':_0x3c29b6['id'],'type':_0x3fe6d1[_0xf5e3('0x23')],'sectionId':_0x3fe6d1['id']},{})[_0xf5e3('0x1f')](function(){return _0x4c9a9f;});}else{return _0x4c9a9f;}})[_0xf5e3('0x3e')](function(_0x372874){logger['error'](_0xf5e3('0x4c'),_0x372874);throw _0x372874;});}return _0x4c9a9f;})[_0xf5e3('0x1f')](respondWithResult(_0x35be70,0xc9))[_0xf5e3('0x3e')](handleError(_0x35be70,null));};exports[_0xf5e3('0x4d')]=function(_0x4185a0,_0x3a4c1a){var _0x1793f0={'where':{'id':_0x4185a0[_0xf5e3('0x40')]['id']}},_0xb2611={};_0xb2611[_0xf5e3('0x2f')]=_[_0xf5e3('0x2b')](db[_0xf5e3('0x3b')]['rawAttributes']);_0x1793f0[_0xf5e3('0x2e')]=_[_0xf5e3('0x2d')](_0xb2611[_0xf5e3('0x2f')],qs['fields'](_0x4185a0['query'][_0xf5e3('0x30')]));_0x1793f0['attributes']=_0x1793f0[_0xf5e3('0x2e')][_0xf5e3('0x31')]?_0x1793f0[_0xf5e3('0x2e')]:_0xb2611[_0xf5e3('0x2f')];if(_0x4185a0['query']['includeAll']){_0x1793f0[_0xf5e3('0x3c')]=[{'all':!![]}];}_0x1793f0=_[_0xf5e3('0x38')]({},_0x1793f0,_0x4185a0[_0xf5e3('0x3a')]);return db[_0xf5e3('0x3b')][_0xf5e3('0x42')](_0x1793f0)[_0xf5e3('0x1f')](handleEntityNotFound(_0x3a4c1a,null))[_0xf5e3('0x1f')](function(_0x1211af){if(_0x1211af){var _0x5e624f=_0x1211af[_0xf5e3('0x20')]({'plain':!![]});_0x5e624f=qs[_0xf5e3('0x4e')](_0x5e624f,['id',_0xf5e3('0x4f'),_0xf5e3('0x50')]);_0x4185a0[_0xf5e3('0x44')]=_[_0xf5e3('0x4e')](_0x4185a0[_0xf5e3('0x44')],['id',_0xf5e3('0x4f'),_0xf5e3('0x50')]);return db[_0xf5e3('0x3b')][_0xf5e3('0x43')](_['merge'](_0x5e624f,_0x4185a0['body']),{'include':_0x4185a0[_0xf5e3('0x2a')][_0xf5e3('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x28c324){var _0x35b61e=_0x4185a0['user'][_0xf5e3('0x20')]({'plain':!![]});if(!_0x35b61e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35b61e[_0xf5e3('0x47')]==='user'){var _0x2d747b=_0x28c324['get']({'plain':!![]});var _0x23983a='Projects';return db[_0xf5e3('0x48')][_0xf5e3('0x42')]({'where':{'name':_0x23983a,'userProfileId':_0x35b61e['userProfileId']},'raw':!![]})[_0xf5e3('0x1f')](function(_0x2784ae){if(_0x2784ae&&_0x2784ae['autoAssociation']===0x0){return db[_0xf5e3('0x4b')][_0xf5e3('0x43')]({'name':_0x2d747b[_0xf5e3('0x23')],'resourceId':_0x2d747b['id'],'type':_0x2784ae[_0xf5e3('0x23')],'sectionId':_0x2784ae['id']},{})[_0xf5e3('0x1f')](function(){return _0x28c324;});}else{return _0x28c324;}})[_0xf5e3('0x3e')](function(_0x1a9e42){logger['error'](_0xf5e3('0x4c'),_0x1a9e42);throw _0x1a9e42;});}return _0x28c324;});}})[_0xf5e3('0x1f')](respondWithResult(_0x3a4c1a,0xc9))[_0xf5e3('0x3e')](handleError(_0x3a4c1a,null));};exports['update']=function(_0x28b268,_0x57d1a4){if(_0x28b268[_0xf5e3('0x44')]['id']){delete _0x28b268[_0xf5e3('0x44')]['id'];}return db['JscriptyProject'][_0xf5e3('0x42')]({'where':{'id':_0x28b268[_0xf5e3('0x40')]['id']}})[_0xf5e3('0x1f')](handleEntityNotFound(_0x57d1a4,null))['then'](saveUpdates(_0x28b268[_0xf5e3('0x44')],null))[_0xf5e3('0x1f')](respondWithResult(_0x57d1a4,null))[_0xf5e3('0x3e')](handleError(_0x57d1a4,null));};exports[_0xf5e3('0x21')]=function(_0xbb4b2b,_0x1b78ed){return db[_0xf5e3('0x3b')][_0xf5e3('0x42')]({'where':{'id':_0xbb4b2b['params']['id']}})[_0xf5e3('0x1f')](handleEntityNotFound(_0x1b78ed,null))[_0xf5e3('0x1f')](removeEntity(_0x1b78ed,null))[_0xf5e3('0x3e')](handleError(_0x1b78ed,null));};exports[_0xf5e3('0x51')]=function(_0x24cc9d,_0xdb7168,_0xb5e8a7){var _0x34ba90={'raw':!![],'where':{}};var _0x352b9c={};var _0x588c3a={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x24cc9d[_0xf5e3('0x40')]['id']}})['then'](handleEntityNotFound(_0xdb7168,null))[_0xf5e3('0x1f')](function(_0x510851){if(_0x510851){_0x352b9c[_0xf5e3('0x2f')]=_[_0xf5e3('0x2b')](db[_0xf5e3('0x52')][_0xf5e3('0x26')]);_0x352b9c['query']=_[_0xf5e3('0x2b')](_0x24cc9d[_0xf5e3('0x2a')]);_0x352b9c[_0xf5e3('0x2c')]=_[_0xf5e3('0x2d')](_0x352b9c['model'],_0x352b9c[_0xf5e3('0x2a')]);_0x34ba90[_0xf5e3('0x2e')]=_[_0xf5e3('0x2d')](_0x352b9c[_0xf5e3('0x2f')],qs[_0xf5e3('0x30')](_0x24cc9d['query'][_0xf5e3('0x30')]));_0x34ba90[_0xf5e3('0x2e')]=_0x34ba90['attributes'][_0xf5e3('0x31')]?_0x34ba90[_0xf5e3('0x2e')]:_0x352b9c[_0xf5e3('0x2f')];if(!_0x24cc9d[_0xf5e3('0x2a')][_0xf5e3('0x32')]('nolimit')){_0x34ba90[_0xf5e3('0x1c')]=qs[_0xf5e3('0x1c')](_0x24cc9d[_0xf5e3('0x2a')][_0xf5e3('0x1c')]);_0x34ba90[_0xf5e3('0x1b')]=qs[_0xf5e3('0x1b')](_0x24cc9d[_0xf5e3('0x2a')][_0xf5e3('0x1b')]);}_0x34ba90[_0xf5e3('0x33')]=qs[_0xf5e3('0x34')](_0x24cc9d[_0xf5e3('0x2a')][_0xf5e3('0x34')]);_0x34ba90[_0xf5e3('0x35')]=qs['filters'](_[_0xf5e3('0x36')](_0x24cc9d[_0xf5e3('0x2a')],_0x352b9c['filters']));_0x34ba90[_0xf5e3('0x35')][_0xf5e3('0x53')]=_0x510851['id'];if(_0x24cc9d[_0xf5e3('0x2a')][_0xf5e3('0x37')]){_0x34ba90['where']=_[_0xf5e3('0x38')](_0x34ba90[_0xf5e3('0x35')],{'$or':_[_0xf5e3('0x25')](_0x34ba90['attributes'],function(_0x52f0b4){var _0xb255d={};_0xb255d[_0x52f0b4]={'$like':'%'+_0x24cc9d[_0xf5e3('0x2a')][_0xf5e3('0x37')]+'%'};return _0xb255d;})});}_0x34ba90=_[_0xf5e3('0x38')]({},_0x34ba90,_0x24cc9d['options']);return db[_0xf5e3('0x52')][_0xf5e3('0x1a')]({'where':_0x34ba90['where']})['then'](function(_0x2b5396){_0x588c3a[_0xf5e3('0x1a')]=_0x2b5396;if(_0x24cc9d['query']['includeAll']){_0x34ba90[_0xf5e3('0x3c')]=[{'all':!![]}];}return db[_0xf5e3('0x52')]['findAll'](_0x34ba90);})[_0xf5e3('0x1f')](function(_0x111f5c){_0x588c3a[_0xf5e3('0x54')]=_0x111f5c;return _0x588c3a;});}})['then'](respondWithFilteredResult(_0xdb7168,_0x34ba90))[_0xf5e3('0x3e')](handleError(_0xdb7168,null));};exports[_0xf5e3('0x55')]=function(_0x4d9d44,_0x2c0cdc,_0x2481ca){var _0x286c32={'raw':!![],'where':{}};var _0x3aa56a={};var _0x4865d5={'count':0x0,'rows':[]};return db[_0xf5e3('0x3b')][_0xf5e3('0x56')]({'where':{'id':_0x4d9d44[_0xf5e3('0x40')]['id']}})[_0xf5e3('0x1f')](handleEntityNotFound(_0x2c0cdc,null))[_0xf5e3('0x1f')](function(_0x32f6ac){if(_0x32f6ac){_0x3aa56a[_0xf5e3('0x2f')]=_[_0xf5e3('0x2b')](db[_0xf5e3('0x57')]['rawAttributes']);_0x3aa56a[_0xf5e3('0x2a')]=_[_0xf5e3('0x2b')](_0x4d9d44[_0xf5e3('0x2a')]);_0x3aa56a[_0xf5e3('0x2c')]=_[_0xf5e3('0x2d')](_0x3aa56a[_0xf5e3('0x2f')],_0x3aa56a[_0xf5e3('0x2a')]);_0x286c32[_0xf5e3('0x2e')]=_['intersection'](_0x3aa56a[_0xf5e3('0x2f')],qs[_0xf5e3('0x30')](_0x4d9d44[_0xf5e3('0x2a')][_0xf5e3('0x30')]));_0x286c32[_0xf5e3('0x2e')]=_0x286c32[_0xf5e3('0x2e')]['length']?_0x286c32[_0xf5e3('0x2e')]:_0x3aa56a['model'];if(!_0x4d9d44['query'][_0xf5e3('0x32')]('nolimit')){_0x286c32[_0xf5e3('0x1c')]=qs[_0xf5e3('0x1c')](_0x4d9d44[_0xf5e3('0x2a')][_0xf5e3('0x1c')]);_0x286c32[_0xf5e3('0x1b')]=qs['offset'](_0x4d9d44[_0xf5e3('0x2a')][_0xf5e3('0x1b')]);}_0x286c32[_0xf5e3('0x33')]=qs[_0xf5e3('0x34')](_0x4d9d44[_0xf5e3('0x2a')][_0xf5e3('0x34')]);_0x286c32['where']=qs['filters'](_['pick'](_0x4d9d44[_0xf5e3('0x2a')],_0x3aa56a[_0xf5e3('0x2c')]));_0x286c32[_0xf5e3('0x35')][_0xf5e3('0x53')]=_0x32f6ac['id'];if(_0x4d9d44[_0xf5e3('0x2a')]['filter']){_0x286c32[_0xf5e3('0x35')]=_[_0xf5e3('0x38')](_0x286c32[_0xf5e3('0x35')],{'$or':_[_0xf5e3('0x25')](_0x286c32[_0xf5e3('0x2e')],function(_0x4b0c00){var _0x1bc31f={};_0x1bc31f[_0x4b0c00]={'$like':'%'+_0x4d9d44['query'][_0xf5e3('0x37')]+'%'};return _0x1bc31f;})});}_0x286c32=_[_0xf5e3('0x38')]({},_0x286c32,_0x4d9d44[_0xf5e3('0x3a')]);return db[_0xf5e3('0x57')][_0xf5e3('0x1a')]({'where':_0x286c32['where']})[_0xf5e3('0x1f')](function(_0x28eff3){_0x4865d5[_0xf5e3('0x1a')]=_0x28eff3;if(_0x4d9d44[_0xf5e3('0x2a')][_0xf5e3('0x41')]){_0x286c32[_0xf5e3('0x3c')]=[{'all':!![]}];}return db[_0xf5e3('0x57')][_0xf5e3('0x3d')](_0x286c32);})[_0xf5e3('0x1f')](function(_0x5e4aeb){_0x4865d5[_0xf5e3('0x54')]=_0x5e4aeb;return _0x4865d5;});}})[_0xf5e3('0x1f')](respondWithFilteredResult(_0x2c0cdc,_0x286c32))[_0xf5e3('0x3e')](handleError(_0x2c0cdc,null));};function char(_0x63c097){return _0xf5e3('0x58')===typeof _0x63c097?String['fromCharCode'][_0xf5e3('0x59')](null,arguments):_0x63c097;}function needsEncapsulation(_0xc5830d){return!!_0xc5830d&&(_0xc5830d[_0xf5e3('0x5a')]()[_0xf5e3('0x5b')](char(0xd))>=0x0||_0xc5830d[_0xf5e3('0x5a')]()[_0xf5e3('0x5b')](char(0xa))>=0x0||_0xc5830d['toString']()[_0xf5e3('0x5b')](char(0x2c))>=0x0||_0xc5830d[_0xf5e3('0x5a')]()[_0xf5e3('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x2e5fc6){var _0x49ab0f=char(0x22),_0x3b103c='\x5c'+char(0x22),_0x23198c=_0x2e5fc6['toString']()[_0xf5e3('0x5c')](new RegExp(_0x49ab0f,'g'),_0x3b103c);return _0x49ab0f+_0x23198c+_0x49ab0f;}exports[_0xf5e3('0x5d')]=function(_0x194392,_0x21d9b3,_0x2bd7e3){var _0x292bc4,_0x3db805;var _0xb2cefa={'where':{'ProjectId':_0x194392[_0xf5e3('0x40')]['id']}};if(_0x194392[_0xf5e3('0x2a')][_0xf5e3('0x5e')]){_0xb2cefa[_0xf5e3('0x35')]['starttime']=JSON[_0xf5e3('0x5f')](_0x194392[_0xf5e3('0x2a')][_0xf5e3('0x5e')]);}return db[_0xf5e3('0x52')]['findAll'](_0xb2cefa)[_0xf5e3('0x1f')](handleEntityNotFound(_0x21d9b3,null))[_0xf5e3('0x1f')](function(_0x3bfb07){if(_0x3bfb07){_0x292bc4=_0x3bfb07;return db[_0xf5e3('0x60')][_0xf5e3('0x3d')]({'where':{'SessionId':{'$in':_[_0xf5e3('0x25')](_0x292bc4,'id')},'ProjectId':_0x194392[_0xf5e3('0x40')]['id']},'order':'-createdAt'});}})[_0xf5e3('0x1f')](handleEntityNotFound(_0x21d9b3,null))[_0xf5e3('0x1f')](function(_0x696965){if(_0x696965){_0x3db805=_0x696965;var _0x2b25e4={};for(var _0x463817=0x0,_0x4e2d65=_0x3db805[_0xf5e3('0x31')];_0x463817<_0x4e2d65;_0x463817++){if(!_0x2b25e4['hasOwnProperty'](_0x3db805[_0x463817][_0xf5e3('0x61')])){_0x2b25e4[_0x3db805[_0x463817][_0xf5e3('0x61')]]=needsEncapsulation(_0x3db805[_0x463817][_0xf5e3('0x62')])?encapsulate(_0x3db805[_0x463817][_0xf5e3('0x62')]):_0x3db805[_0x463817][_0xf5e3('0x62')];}}var _0x5aee69=[],_0x1ceb8c={};for(var _0x10c33b=0x0,_0xaf0fda=_0x292bc4[_0xf5e3('0x31')];_0x10c33b<_0xaf0fda;_0x10c33b++){_0x1ceb8c={'ProjectId':_0x194392[_0xf5e3('0x40')]['id'],'SessionId':_0x292bc4[_0x10c33b]['id'],'StartTime':moment(_0x292bc4[_0x10c33b][_0xf5e3('0x63')])[_0xf5e3('0x64')](_0xf5e3('0x65'))};for(var _0x32e0d4=0x0,_0x5cfae3=_0x3db805[_0xf5e3('0x31')];_0x32e0d4<_0x5cfae3;_0x32e0d4++){if(_0x3db805[_0x32e0d4][_0xf5e3('0x66')]==_0x292bc4[_0x10c33b]['id']&&_0x2b25e4[_0xf5e3('0x32')](_0x3db805[_0x32e0d4][_0xf5e3('0x61')])){_0x1ceb8c[_0x2b25e4[_0x3db805[_0x32e0d4][_0xf5e3('0x61')]]]=_0x3db805[_0x32e0d4]['answer'];}}for(var _0x2c664a in _0x2b25e4){if(!_0x1ceb8c[_0xf5e3('0x32')](_0x2b25e4[_0x2c664a])){_0x1ceb8c[_0x2b25e4[_0x2c664a]]=null;}}_0x5aee69['push'](_0x1ceb8c);}return _0x5aee69;}})[_0xf5e3('0x1f')](function(_0x3fe6e7){if(!_['isEmpty'](_0x3fe6e7)){var _0x328243=toCsv(_0x3fe6e7);var _0x3fbfc8=Date[_0xf5e3('0x67')]();fs[_0xf5e3('0x68')](util['format'](_0xf5e3('0x69'),_0x194392[_0xf5e3('0x40')]['id'],_0x3fbfc8),_0x328243);_0x21d9b3[_0xf5e3('0x6a')]('Content-disposition',_0xf5e3('0x6b')+util['format'](_0xf5e3('0x6c'),_0x194392[_0xf5e3('0x40')]['id'],_0x3fbfc8));_0x21d9b3[_0xf5e3('0x6a')](_0xf5e3('0x6d'),'text/csv');return _0x21d9b3['download'](util['format'](_0xf5e3('0x69'),_0x194392['params']['id'],_0x3fbfc8));}else{return _0x21d9b3['sendStatus'](0xcc);}})[_0xf5e3('0x3e')](handleError(_0x21d9b3,null));}; \ No newline at end of file +var _0xdf67=['json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','JscriptyProject','includeAll','findAll','rows','params','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','Projects','findOne','JscriptySessionReport','ProjectId','getAnswers','hasOwnProperty','JscriptyAnswerReport','fromCharCode','toString','indexOf','getSummary','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x310832,_0xe72c7e){var _0x103f74=function(_0x4a217c){while(--_0x4a217c){_0x310832['push'](_0x310832['shift']());}};_0x103f74(++_0xe72c7e);}(_0xdf67,0xbb));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7df6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7df6('0x1'));var moment=require('moment');var BPromise=require(_0x7df6('0x2'));var Mustache=require(_0x7df6('0x3'));var util=require(_0x7df6('0x4'));var path=require(_0x7df6('0x5'));var sox=require(_0x7df6('0x6'));var csv=require(_0x7df6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7df6('0x8'));var deskjs=require(_0x7df6('0x9'));var toCsv=require(_0x7df6('0x7'));var querystring=require('querystring');var Papa=require(_0x7df6('0xa'));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(_0x7df6('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x7df6('0xc'));var config=require(_0x7df6('0xd'));var db=require(_0x7df6('0xe'))['db'];function respondWithStatusCode(_0x574bcc,_0x8e7d4c){_0x8e7d4c=_0x8e7d4c||0xcc;return function(_0x3ca6ce){if(_0x3ca6ce){return _0x574bcc['sendStatus'](_0x8e7d4c);}return _0x574bcc[_0x7df6('0xf')](_0x8e7d4c)[_0x7df6('0x10')]();};}function respondWithResult(_0x5834e8,_0x5405cc){_0x5405cc=_0x5405cc||0xc8;return function(_0x20a65a){if(_0x20a65a){return _0x5834e8[_0x7df6('0xf')](_0x5405cc)[_0x7df6('0x11')](_0x20a65a);}};}function respondWithFilteredResult(_0x557f7c,_0x1f92f5){return function(_0x503845){if(_0x503845){var _0x32ac23=_0x503845[_0x7df6('0x12')],_0x38410a=_0x1f92f5[_0x7df6('0x13')],_0xf4009c=_0x1f92f5[_0x7df6('0x13')]+_0x1f92f5[_0x7df6('0x14')],_0x1e9f57;if(_0xf4009c>=_0x32ac23){_0xf4009c=_0x32ac23;_0x1e9f57=0xc8;}else{_0x1e9f57=0xce;}_0x557f7c[_0x7df6('0xf')](_0x1e9f57);return _0x557f7c['set'](_0x7df6('0x15'),_0x38410a+'-'+_0xf4009c+'/'+_0x32ac23)['json'](_0x503845);}return null;};}function patchUpdates(_0x5de2f2){return function(_0x6682c3){try{jsonpatch[_0x7df6('0x16')](_0x6682c3,_0x5de2f2,!![]);}catch(_0x2e4db0){return BPromise['reject'](_0x2e4db0);}return _0x6682c3[_0x7df6('0x17')]();};}function saveUpdates(_0x1f1bb9,_0x27a515){return function(_0x24949c){if(_0x24949c){return _0x24949c[_0x7df6('0x18')](_0x1f1bb9)[_0x7df6('0x19')](function(_0x184029){return _0x184029;});}return null;};}function removeEntity(_0x14a13c,_0x27c85c){return function(_0x3a56bb){if(_0x3a56bb){return _0x3a56bb[_0x7df6('0x1a')]()[_0x7df6('0x19')](function(){var _0x435854=_0x3a56bb[_0x7df6('0x1b')]({'plain':!![]});var _0x1dc155='Projects';return db['UserProfileResource'][_0x7df6('0x1a')]({'where':{'type':_0x1dc155,'resourceId':_0x435854['id']}})['then'](function(){return _0x3a56bb;});})['then'](function(){_0x14a13c[_0x7df6('0xf')](0xcc)[_0x7df6('0x10')]();});}};}function handleEntityNotFound(_0x5141c1,_0x1a8ce7){return function(_0x54f265){if(!_0x54f265){_0x5141c1[_0x7df6('0x1c')](0x194);}return _0x54f265;};}function handleError(_0x32ac16,_0x4f0494){_0x4f0494=_0x4f0494||0x1f4;return function(_0x41d990){logger[_0x7df6('0x1d')](_0x41d990[_0x7df6('0x1e')]);if(_0x41d990['name']){delete _0x41d990[_0x7df6('0x1f')];}_0x32ac16[_0x7df6('0xf')](_0x4f0494)[_0x7df6('0x20')](_0x41d990);};}exports[_0x7df6('0x21')]=function(_0x17e155,_0x28eae6){var _0x4d238c={},_0x896a1d={},_0xa18d40={'count':0x0,'rows':[]};var _0x2b5c6d=_[_0x7df6('0x22')](db['JscriptyProject'][_0x7df6('0x23')],function(_0x1cec30){return{'name':_0x1cec30['fieldName'],'type':_0x1cec30[_0x7df6('0x24')][_0x7df6('0x25')]};});_0x896a1d[_0x7df6('0x26')]=_[_0x7df6('0x22')](_0x2b5c6d,_0x7df6('0x1f'));_0x896a1d[_0x7df6('0x27')]=_[_0x7df6('0x28')](_0x17e155[_0x7df6('0x27')]);_0x896a1d[_0x7df6('0x29')]=_[_0x7df6('0x2a')](_0x896a1d[_0x7df6('0x26')],_0x896a1d[_0x7df6('0x27')]);_0x4d238c[_0x7df6('0x2b')]=_[_0x7df6('0x2a')](_0x896a1d[_0x7df6('0x26')],qs['fields'](_0x17e155[_0x7df6('0x27')][_0x7df6('0x2c')]));_0x4d238c[_0x7df6('0x2b')]=_0x4d238c['attributes'][_0x7df6('0x2d')]?_0x4d238c[_0x7df6('0x2b')]:_0x896a1d[_0x7df6('0x26')];if(!_0x17e155[_0x7df6('0x27')]['hasOwnProperty'](_0x7df6('0x2e'))){_0x4d238c[_0x7df6('0x14')]=qs[_0x7df6('0x14')](_0x17e155['query'][_0x7df6('0x14')]);_0x4d238c[_0x7df6('0x13')]=qs[_0x7df6('0x13')](_0x17e155[_0x7df6('0x27')][_0x7df6('0x13')]);}_0x4d238c[_0x7df6('0x2f')]=qs[_0x7df6('0x30')](_0x17e155[_0x7df6('0x27')][_0x7df6('0x30')]);_0x4d238c[_0x7df6('0x31')]=qs[_0x7df6('0x29')](_[_0x7df6('0x32')](_0x17e155[_0x7df6('0x27')],_0x896a1d['filters']),_0x2b5c6d);if(_0x17e155[_0x7df6('0x27')][_0x7df6('0x33')]){_0x4d238c[_0x7df6('0x31')]=_['merge'](_0x4d238c[_0x7df6('0x31')],{'$or':_[_0x7df6('0x22')](_0x2b5c6d,function(_0x207807){if(_0x207807[_0x7df6('0x24')]!=='VIRTUAL'){var _0x6bdd41={};_0x6bdd41[_0x207807[_0x7df6('0x1f')]]={'$like':'%'+_0x17e155[_0x7df6('0x27')]['filter']+'%'};return _0x6bdd41;}})});}_0x4d238c=_[_0x7df6('0x34')]({},_0x4d238c,_0x17e155[_0x7df6('0x35')]);var _0x4a0cad={'where':_0x4d238c[_0x7df6('0x31')]};return db[_0x7df6('0x36')][_0x7df6('0x12')](_0x4a0cad)[_0x7df6('0x19')](function(_0xf0aac0){_0xa18d40['count']=_0xf0aac0;if(_0x17e155[_0x7df6('0x27')][_0x7df6('0x37')]){_0x4d238c['include']=[{'all':!![]}];}return db[_0x7df6('0x36')][_0x7df6('0x38')](_0x4d238c);})[_0x7df6('0x19')](function(_0x9946ae){_0xa18d40[_0x7df6('0x39')]=_0x9946ae;return _0xa18d40;})[_0x7df6('0x19')](respondWithFilteredResult(_0x28eae6,_0x4d238c))['catch'](handleError(_0x28eae6,null));};exports['show']=function(_0x468ea4,_0x370062){var _0x29422a={'raw':![],'where':{'id':_0x468ea4[_0x7df6('0x3a')]['id']}},_0x1ac1aa={};_0x1ac1aa['model']=_['keys'](db['JscriptyProject'][_0x7df6('0x23')]);_0x1ac1aa[_0x7df6('0x27')]=_[_0x7df6('0x28')](_0x468ea4[_0x7df6('0x27')]);_0x1ac1aa[_0x7df6('0x29')]=_[_0x7df6('0x2a')](_0x1ac1aa[_0x7df6('0x26')],_0x1ac1aa[_0x7df6('0x27')]);_0x29422a[_0x7df6('0x2b')]=_[_0x7df6('0x2a')](_0x1ac1aa[_0x7df6('0x26')],qs[_0x7df6('0x2c')](_0x468ea4[_0x7df6('0x27')][_0x7df6('0x2c')]));_0x29422a[_0x7df6('0x2b')]=_0x29422a[_0x7df6('0x2b')][_0x7df6('0x2d')]?_0x29422a[_0x7df6('0x2b')]:_0x1ac1aa[_0x7df6('0x26')];if(_0x468ea4['query'][_0x7df6('0x37')]){_0x29422a[_0x7df6('0x3b')]=[{'all':!![]}];}_0x29422a=_[_0x7df6('0x34')]({},_0x29422a,_0x468ea4[_0x7df6('0x35')]);return db[_0x7df6('0x36')]['find'](_0x29422a)[_0x7df6('0x19')](handleEntityNotFound(_0x370062,null))[_0x7df6('0x19')](respondWithResult(_0x370062,null))['catch'](handleError(_0x370062,null));};exports['create']=function(_0x107589,_0x28fc37){return db[_0x7df6('0x36')]['create'](_0x107589[_0x7df6('0x3c')],{})['then'](function(_0x3e305e){var _0x499a79=_0x107589[_0x7df6('0x3d')][_0x7df6('0x1b')]({'plain':!![]});if(!_0x499a79)throw new Error(_0x7df6('0x3e'));if(_0x499a79[_0x7df6('0x3f')]==='user'){var _0x332c5c=_0x3e305e[_0x7df6('0x1b')]({'plain':!![]});var _0x4663f3='Projects';return db[_0x7df6('0x40')][_0x7df6('0x41')]({'where':{'name':_0x4663f3,'userProfileId':_0x499a79[_0x7df6('0x42')]},'raw':!![]})['then'](function(_0x374fe5){if(_0x374fe5&&_0x374fe5['autoAssociation']===0x0){return db[_0x7df6('0x43')][_0x7df6('0x44')]({'name':_0x332c5c[_0x7df6('0x1f')],'resourceId':_0x332c5c['id'],'type':_0x374fe5[_0x7df6('0x1f')],'sectionId':_0x374fe5['id']},{})[_0x7df6('0x19')](function(){return _0x3e305e;});}else{return _0x3e305e;}})[_0x7df6('0x45')](function(_0x3715b4){logger[_0x7df6('0x1d')](_0x7df6('0x46'),_0x3715b4);throw _0x3715b4;});}return _0x3e305e;})['then'](respondWithResult(_0x28fc37,0xc9))['catch'](handleError(_0x28fc37,null));};exports['clone']=function(_0x48ec1e,_0x4ada02){var _0xe1e77a={'where':{'id':_0x48ec1e['params']['id']}},_0x76da2f={};_0x76da2f[_0x7df6('0x26')]=_[_0x7df6('0x28')](db[_0x7df6('0x36')][_0x7df6('0x23')]);_0xe1e77a[_0x7df6('0x2b')]=_[_0x7df6('0x2a')](_0x76da2f[_0x7df6('0x26')],qs[_0x7df6('0x2c')](_0x48ec1e[_0x7df6('0x27')]['fields']));_0xe1e77a[_0x7df6('0x2b')]=_0xe1e77a[_0x7df6('0x2b')][_0x7df6('0x2d')]?_0xe1e77a['attributes']:_0x76da2f[_0x7df6('0x26')];if(_0x48ec1e[_0x7df6('0x27')][_0x7df6('0x37')]){_0xe1e77a[_0x7df6('0x3b')]=[{'all':!![]}];}_0xe1e77a=_[_0x7df6('0x34')]({},_0xe1e77a,_0x48ec1e[_0x7df6('0x35')]);return db[_0x7df6('0x36')][_0x7df6('0x41')](_0xe1e77a)[_0x7df6('0x19')](handleEntityNotFound(_0x4ada02,null))[_0x7df6('0x19')](function(_0x2d3b57){if(_0x2d3b57){var _0x16d040=_0x2d3b57[_0x7df6('0x1b')]({'plain':!![]});_0x16d040=qs['omit'](_0x16d040,['id',_0x7df6('0x47'),'updatedAt']);_0x48ec1e['body']=_['omit'](_0x48ec1e['body'],['id','createdAt','updatedAt']);return db[_0x7df6('0x36')][_0x7df6('0x44')](_[_0x7df6('0x34')](_0x16d040,_0x48ec1e['body']),{'include':_0x48ec1e[_0x7df6('0x27')][_0x7df6('0x37')]?[{'all':!![]}]:undefined})['then'](function(_0x167397){var _0x2a2f9a=_0x48ec1e[_0x7df6('0x3d')][_0x7df6('0x1b')]({'plain':!![]});if(!_0x2a2f9a)throw new Error(_0x7df6('0x3e'));if(_0x2a2f9a['role']==='user'){var _0x160afa=_0x167397['get']({'plain':!![]});var _0x8037a0=_0x7df6('0x48');return db[_0x7df6('0x40')][_0x7df6('0x41')]({'where':{'name':_0x8037a0,'userProfileId':_0x2a2f9a[_0x7df6('0x42')]},'raw':!![]})[_0x7df6('0x19')](function(_0x2681f8){if(_0x2681f8&&_0x2681f8['autoAssociation']===0x0){return db[_0x7df6('0x43')]['create']({'name':_0x160afa['name'],'resourceId':_0x160afa['id'],'type':_0x2681f8[_0x7df6('0x1f')],'sectionId':_0x2681f8['id']},{})[_0x7df6('0x19')](function(){return _0x167397;});}else{return _0x167397;}})[_0x7df6('0x45')](function(_0x440b91){logger['error'](_0x7df6('0x46'),_0x440b91);throw _0x440b91;});}return _0x167397;});}})[_0x7df6('0x19')](respondWithResult(_0x4ada02,0xc9))[_0x7df6('0x45')](handleError(_0x4ada02,null));};exports[_0x7df6('0x18')]=function(_0x1e80b2,_0x37ae2e){if(_0x1e80b2[_0x7df6('0x3c')]['id']){delete _0x1e80b2[_0x7df6('0x3c')]['id'];}return db['JscriptyProject'][_0x7df6('0x41')]({'where':{'id':_0x1e80b2[_0x7df6('0x3a')]['id']}})[_0x7df6('0x19')](handleEntityNotFound(_0x37ae2e,null))[_0x7df6('0x19')](saveUpdates(_0x1e80b2[_0x7df6('0x3c')],null))[_0x7df6('0x19')](respondWithResult(_0x37ae2e,null))[_0x7df6('0x45')](handleError(_0x37ae2e,null));};exports[_0x7df6('0x1a')]=function(_0x214dd4,_0x118e66){return db['JscriptyProject'][_0x7df6('0x41')]({'where':{'id':_0x214dd4['params']['id']}})[_0x7df6('0x19')](handleEntityNotFound(_0x118e66,null))[_0x7df6('0x19')](removeEntity(_0x118e66,null))[_0x7df6('0x45')](handleError(_0x118e66,null));};exports['getSessions']=function(_0xcac603,_0x236cbb,_0x3dc393){var _0x469492={'raw':!![],'where':{}};var _0x5a2088={};var _0x1e737c={'count':0x0,'rows':[]};return db[_0x7df6('0x36')][_0x7df6('0x49')]({'where':{'id':_0xcac603[_0x7df6('0x3a')]['id']}})[_0x7df6('0x19')](handleEntityNotFound(_0x236cbb,null))['then'](function(_0x149c4a){if(_0x149c4a){_0x5a2088['model']=_[_0x7df6('0x28')](db[_0x7df6('0x4a')][_0x7df6('0x23')]);_0x5a2088[_0x7df6('0x27')]=_['keys'](_0xcac603['query']);_0x5a2088[_0x7df6('0x29')]=_['intersection'](_0x5a2088['model'],_0x5a2088[_0x7df6('0x27')]);_0x469492[_0x7df6('0x2b')]=_[_0x7df6('0x2a')](_0x5a2088[_0x7df6('0x26')],qs[_0x7df6('0x2c')](_0xcac603[_0x7df6('0x27')][_0x7df6('0x2c')]));_0x469492[_0x7df6('0x2b')]=_0x469492[_0x7df6('0x2b')]['length']?_0x469492['attributes']:_0x5a2088[_0x7df6('0x26')];if(!_0xcac603[_0x7df6('0x27')]['hasOwnProperty']('nolimit')){_0x469492[_0x7df6('0x14')]=qs[_0x7df6('0x14')](_0xcac603['query']['limit']);_0x469492[_0x7df6('0x13')]=qs[_0x7df6('0x13')](_0xcac603['query'][_0x7df6('0x13')]);}_0x469492[_0x7df6('0x2f')]=qs[_0x7df6('0x30')](_0xcac603['query'][_0x7df6('0x30')]);_0x469492[_0x7df6('0x31')]=qs['filters'](_[_0x7df6('0x32')](_0xcac603[_0x7df6('0x27')],_0x5a2088['filters']));_0x469492[_0x7df6('0x31')][_0x7df6('0x4b')]=_0x149c4a['id'];if(_0xcac603[_0x7df6('0x27')][_0x7df6('0x33')]){_0x469492[_0x7df6('0x31')]=_[_0x7df6('0x34')](_0x469492[_0x7df6('0x31')],{'$or':_[_0x7df6('0x22')](_0x469492[_0x7df6('0x2b')],function(_0x2588f4){var _0xd56978={};_0xd56978[_0x2588f4]={'$like':'%'+_0xcac603[_0x7df6('0x27')]['filter']+'%'};return _0xd56978;})});}_0x469492=_[_0x7df6('0x34')]({},_0x469492,_0xcac603['options']);return db[_0x7df6('0x4a')][_0x7df6('0x12')]({'where':_0x469492[_0x7df6('0x31')]})['then'](function(_0x5d6595){_0x1e737c[_0x7df6('0x12')]=_0x5d6595;if(_0xcac603[_0x7df6('0x27')][_0x7df6('0x37')]){_0x469492[_0x7df6('0x3b')]=[{'all':!![]}];}return db[_0x7df6('0x4a')][_0x7df6('0x38')](_0x469492);})[_0x7df6('0x19')](function(_0x2068f5){_0x1e737c['rows']=_0x2068f5;return _0x1e737c;});}})['then'](respondWithFilteredResult(_0x236cbb,_0x469492))[_0x7df6('0x45')](handleError(_0x236cbb,null));};exports[_0x7df6('0x4c')]=function(_0x50ae7,_0x1fef45,_0x49ee17){var _0x3cb874={'raw':!![],'where':{}};var _0x12335e={};var _0x423434={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x7df6('0x49')]({'where':{'id':_0x50ae7[_0x7df6('0x3a')]['id']}})[_0x7df6('0x19')](handleEntityNotFound(_0x1fef45,null))['then'](function(_0x3e97b4){if(_0x3e97b4){_0x12335e[_0x7df6('0x26')]=_[_0x7df6('0x28')](db['JscriptyAnswerReport'][_0x7df6('0x23')]);_0x12335e['query']=_[_0x7df6('0x28')](_0x50ae7[_0x7df6('0x27')]);_0x12335e[_0x7df6('0x29')]=_['intersection'](_0x12335e['model'],_0x12335e[_0x7df6('0x27')]);_0x3cb874[_0x7df6('0x2b')]=_[_0x7df6('0x2a')](_0x12335e[_0x7df6('0x26')],qs['fields'](_0x50ae7['query'][_0x7df6('0x2c')]));_0x3cb874[_0x7df6('0x2b')]=_0x3cb874['attributes'][_0x7df6('0x2d')]?_0x3cb874[_0x7df6('0x2b')]:_0x12335e['model'];if(!_0x50ae7[_0x7df6('0x27')][_0x7df6('0x4d')](_0x7df6('0x2e'))){_0x3cb874[_0x7df6('0x14')]=qs[_0x7df6('0x14')](_0x50ae7[_0x7df6('0x27')][_0x7df6('0x14')]);_0x3cb874[_0x7df6('0x13')]=qs[_0x7df6('0x13')](_0x50ae7[_0x7df6('0x27')][_0x7df6('0x13')]);}_0x3cb874[_0x7df6('0x2f')]=qs[_0x7df6('0x30')](_0x50ae7[_0x7df6('0x27')][_0x7df6('0x30')]);_0x3cb874[_0x7df6('0x31')]=qs[_0x7df6('0x29')](_[_0x7df6('0x32')](_0x50ae7[_0x7df6('0x27')],_0x12335e['filters']));_0x3cb874['where'][_0x7df6('0x4b')]=_0x3e97b4['id'];if(_0x50ae7[_0x7df6('0x27')][_0x7df6('0x33')]){_0x3cb874[_0x7df6('0x31')]=_[_0x7df6('0x34')](_0x3cb874[_0x7df6('0x31')],{'$or':_[_0x7df6('0x22')](_0x3cb874['attributes'],function(_0xcb4de8){var _0x26b07d={};_0x26b07d[_0xcb4de8]={'$like':'%'+_0x50ae7[_0x7df6('0x27')][_0x7df6('0x33')]+'%'};return _0x26b07d;})});}_0x3cb874=_[_0x7df6('0x34')]({},_0x3cb874,_0x50ae7[_0x7df6('0x35')]);return db[_0x7df6('0x4e')][_0x7df6('0x12')]({'where':_0x3cb874[_0x7df6('0x31')]})[_0x7df6('0x19')](function(_0x4f7248){_0x423434[_0x7df6('0x12')]=_0x4f7248;if(_0x50ae7['query'][_0x7df6('0x37')]){_0x3cb874['include']=[{'all':!![]}];}return db[_0x7df6('0x4e')][_0x7df6('0x38')](_0x3cb874);})['then'](function(_0x3d718d){_0x423434[_0x7df6('0x39')]=_0x3d718d;return _0x423434;});}})['then'](respondWithFilteredResult(_0x1fef45,_0x3cb874))[_0x7df6('0x45')](handleError(_0x1fef45,null));};function char(_0x3d49f2){return'number'===typeof _0x3d49f2?String[_0x7df6('0x4f')][_0x7df6('0x16')](null,arguments):_0x3d49f2;}function needsEncapsulation(_0x218b11){return!!_0x218b11&&(_0x218b11[_0x7df6('0x50')]()[_0x7df6('0x51')](char(0xd))>=0x0||_0x218b11[_0x7df6('0x50')]()[_0x7df6('0x51')](char(0xa))>=0x0||_0x218b11[_0x7df6('0x50')]()[_0x7df6('0x51')](char(0x2c))>=0x0||_0x218b11[_0x7df6('0x50')]()[_0x7df6('0x51')](char(0x22))>=0x0);}function encapsulate(_0x1a77b0){var _0x287b30=char(0x22),_0x2ffc5a='\x5c'+char(0x22),_0x2dfc87=_0x1a77b0[_0x7df6('0x50')]()['replace'](new RegExp(_0x287b30,'g'),_0x2ffc5a);return _0x287b30+_0x2dfc87+_0x287b30;}exports[_0x7df6('0x52')]=function(_0x4ccaed,_0x4fc459,_0x30aaed){var _0x574574,_0x9b2e7b;var _0xd72fe8={'where':{'ProjectId':_0x4ccaed[_0x7df6('0x3a')]['id']}};if(_0x4ccaed[_0x7df6('0x27')]['startTime']){_0xd72fe8[_0x7df6('0x31')][_0x7df6('0x53')]=JSON[_0x7df6('0x54')](_0x4ccaed[_0x7df6('0x27')]['startTime']);}return db[_0x7df6('0x4a')][_0x7df6('0x38')](_0xd72fe8)[_0x7df6('0x19')](handleEntityNotFound(_0x4fc459,null))['then'](function(_0x3f5d81){if(_0x3f5d81){_0x574574=_0x3f5d81;return db['JscriptyQuestionReport'][_0x7df6('0x38')]({'where':{'SessionId':{'$in':_[_0x7df6('0x22')](_0x574574,'id')},'ProjectId':_0x4ccaed[_0x7df6('0x3a')]['id']},'order':_0x7df6('0x55')});}})[_0x7df6('0x19')](handleEntityNotFound(_0x4fc459,null))[_0x7df6('0x19')](function(_0x45e100){if(_0x45e100){_0x9b2e7b=_0x45e100;var _0xb8b0c3={};for(var _0x2028a3=0x0,_0x5e56e5=_0x9b2e7b[_0x7df6('0x2d')];_0x2028a3<_0x5e56e5;_0x2028a3++){if(!_0xb8b0c3[_0x7df6('0x4d')](_0x9b2e7b[_0x2028a3][_0x7df6('0x56')])){_0xb8b0c3[_0x9b2e7b[_0x2028a3][_0x7df6('0x56')]]=needsEncapsulation(_0x9b2e7b[_0x2028a3][_0x7df6('0x57')])?encapsulate(_0x9b2e7b[_0x2028a3][_0x7df6('0x57')]):_0x9b2e7b[_0x2028a3][_0x7df6('0x57')];}}var _0x5e3f35=[],_0x25cba5={};for(var _0x383e6e=0x0,_0x544024=_0x574574[_0x7df6('0x2d')];_0x383e6e<_0x544024;_0x383e6e++){_0x25cba5={'ProjectId':_0x4ccaed['params']['id'],'SessionId':_0x574574[_0x383e6e]['id'],'StartTime':moment(_0x574574[_0x383e6e][_0x7df6('0x53')])[_0x7df6('0x58')](_0x7df6('0x59'))};for(var _0x414c07=0x0,_0x36b8f0=_0x9b2e7b['length'];_0x414c07<_0x36b8f0;_0x414c07++){if(_0x9b2e7b[_0x414c07][_0x7df6('0x5a')]==_0x574574[_0x383e6e]['id']&&_0xb8b0c3['hasOwnProperty'](_0x9b2e7b[_0x414c07][_0x7df6('0x56')])){_0x25cba5[_0xb8b0c3[_0x9b2e7b[_0x414c07][_0x7df6('0x56')]]]=_0x9b2e7b[_0x414c07][_0x7df6('0x5b')];}}for(var _0x5d7fcd in _0xb8b0c3){if(!_0x25cba5[_0x7df6('0x4d')](_0xb8b0c3[_0x5d7fcd])){_0x25cba5[_0xb8b0c3[_0x5d7fcd]]=null;}}_0x5e3f35[_0x7df6('0x5c')](_0x25cba5);}return _0x5e3f35;}})[_0x7df6('0x19')](function(_0x39c7e8){if(!_[_0x7df6('0x5d')](_0x39c7e8)){var _0x4938bc=toCsv(_0x39c7e8);var _0x53a6a8=Date['now']();fs[_0x7df6('0x5e')](util[_0x7df6('0x58')](_0x7df6('0x5f'),_0x4ccaed[_0x7df6('0x3a')]['id'],_0x53a6a8),_0x4938bc);_0x4fc459[_0x7df6('0x60')](_0x7df6('0x61'),_0x7df6('0x62')+util[_0x7df6('0x58')]('Jscripty_Project_%d_Summary_%s.csv',_0x4ccaed[_0x7df6('0x3a')]['id'],_0x53a6a8));_0x4fc459[_0x7df6('0x60')](_0x7df6('0x63'),_0x7df6('0x64'));return _0x4fc459[_0x7df6('0x65')](util[_0x7df6('0x58')](_0x7df6('0x5f'),_0x4ccaed['params']['id'],_0x53a6a8));}else{return _0x4fc459[_0x7df6('0x1c')](0xcc);}})['catch'](handleError(_0x4fc459,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5683df0..3921256 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 _0x4bcb=['./jscriptyProject.attributes','define','JscriptyProject','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x4bcb,0x7c));var _0xb4bc=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0x4bcb[_0x3b16e1];return _0x311d1b;};'use strict';var _=require(_0xb4bc('0x0'));var util=require(_0xb4bc('0x1'));var logger=require('../../config/logger')(_0xb4bc('0x2'));var moment=require('moment');var BPromise=require(_0xb4bc('0x3'));var rp=require(_0xb4bc('0x4'));var fs=require('fs');var path=require(_0xb4bc('0x5'));var rimraf=require(_0xb4bc('0x6'));var config=require(_0xb4bc('0x7'));var attributes=require(_0xb4bc('0x8'));module['exports']=function(_0x2fa90b,_0x131e75){return _0x2fa90b[_0xb4bc('0x9')](_0xb4bc('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebc7=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x44ea58,_0x5020fc){var _0x276d2a=function(_0x563ef8){while(--_0x563ef8){_0x44ea58['push'](_0x44ea58['shift']());}};_0x276d2a(++_0x5020fc);}(_0xebc7,0x79));var _0x7ebc=function(_0x56fb81,_0x3ef549){_0x56fb81=_0x56fb81-0x0;var _0x3b59eb=_0xebc7[_0x56fb81];return _0x3b59eb;};'use strict';var _=require(_0x7ebc('0x0'));var util=require(_0x7ebc('0x1'));var logger=require(_0x7ebc('0x2'))('api');var moment=require(_0x7ebc('0x3'));var BPromise=require(_0x7ebc('0x4'));var rp=require(_0x7ebc('0x5'));var fs=require('fs');var path=require(_0x7ebc('0x6'));var rimraf=require(_0x7ebc('0x7'));var config=require(_0x7ebc('0x8'));var attributes=require(_0x7ebc('0x9'));module[_0x7ebc('0xa')]=function(_0x1b47df,_0x4f4d88){return _0x1b47df[_0x7ebc('0xb')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 989e7a7..40998ca 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 _0xbe46=['jayson/promise','http','request','JscriptyProject,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x18147c,_0x312c73){var _0x564e85=function(_0x5def03){while(--_0x5def03){_0x18147c['push'](_0x18147c['shift']());}};_0x564e85(++_0x312c73);}(_0xbe46,0x102));var _0x6be4=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xbe46[_0x29b609];return _0x54c952;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6be4('0x0'));var BPromise=require(_0x6be4('0x1'));var rs=require(_0x6be4('0x2'));var fs=require('fs');var Redis=require(_0x6be4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6be4('0x4'));var logger=require(_0x6be4('0x5'))(_0x6be4('0x6'));var config=require(_0x6be4('0x7'));var jayson=require(_0x6be4('0x8'));var client=jayson['client'][_0x6be4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b1ee4,_0xf9a001,_0x334d84){return new BPromise(function(_0x143d59,_0x48ee2f){return client[_0x6be4('0xa')](_0x1b1ee4,_0x334d84)['then'](function(_0x425f61){logger['info'](_0x6be4('0xb'),_0xf9a001,'request\x20sent');logger[_0x6be4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0xf9a001,_0x6be4('0xd'),JSON['stringify'](_0x425f61));if(_0x425f61[_0x6be4('0xe')]){if(_0x425f61['error'][_0x6be4('0xf')]===0x1f4){logger[_0x6be4('0xe')]('JscriptyProject,\x20%s,\x20%s',_0xf9a001,_0x425f61['error'][_0x6be4('0x10')]);return _0x48ee2f(_0x425f61[_0x6be4('0xe')][_0x6be4('0x10')]);}logger[_0x6be4('0xe')](_0x6be4('0xb'),_0xf9a001,_0x425f61[_0x6be4('0xe')][_0x6be4('0x10')]);return _0x143d59(_0x425f61['error'][_0x6be4('0x10')]);}else{logger[_0x6be4('0x11')](_0x6be4('0xb'),_0xf9a001,'request\x20sent');_0x143d59(_0x425f61[_0x6be4('0x12')][_0x6be4('0x10')]);}})['catch'](function(_0x55aa55){logger[_0x6be4('0xe')](_0x6be4('0xb'),_0xf9a001,_0x55aa55);_0x48ee2f(_0x55aa55);});});} \ No newline at end of file +var _0x3078=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa6cf5,_0x1cf410){var _0x2daf75=function(_0x49eb71){while(--_0x49eb71){_0xa6cf5['push'](_0xa6cf5['shift']());}};_0x2daf75(++_0x1cf410);}(_0x3078,0x1c5));var _0x8307=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x3078[_0x1d8119];return _0x3e30f6;};'use strict';var _=require(_0x8307('0x0'));var util=require(_0x8307('0x1'));var moment=require(_0x8307('0x2'));var BPromise=require(_0x8307('0x3'));var rs=require(_0x8307('0x4'));var fs=require('fs');var Redis=require(_0x8307('0x5'));var db=require(_0x8307('0x6'))['db'];var utils=require(_0x8307('0x7'));var logger=require(_0x8307('0x8'))('rpc');var config=require(_0x8307('0x9'));var jayson=require(_0x8307('0xa'));var client=jayson['client'][_0x8307('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x262552,_0x37893d,_0x2f4314){return new BPromise(function(_0x105ff5,_0x4523b5){return client[_0x8307('0xc')](_0x262552,_0x2f4314)[_0x8307('0xd')](function(_0x9f3c2e){logger['info'](_0x8307('0xe'),_0x37893d,_0x8307('0xf'));logger[_0x8307('0x10')](_0x8307('0x11'),_0x37893d,'request\x20sent',JSON[_0x8307('0x12')](_0x9f3c2e));if(_0x9f3c2e['error']){if(_0x9f3c2e[_0x8307('0x13')][_0x8307('0x14')]===0x1f4){logger[_0x8307('0x13')](_0x8307('0xe'),_0x37893d,_0x9f3c2e[_0x8307('0x13')][_0x8307('0x15')]);return _0x4523b5(_0x9f3c2e['error'][_0x8307('0x15')]);}logger[_0x8307('0x13')](_0x8307('0xe'),_0x37893d,_0x9f3c2e[_0x8307('0x13')][_0x8307('0x15')]);return _0x105ff5(_0x9f3c2e[_0x8307('0x13')][_0x8307('0x15')]);}else{logger[_0x8307('0x16')](_0x8307('0xe'),_0x37893d,_0x8307('0xf'));_0x105ff5(_0x9f3c2e[_0x8307('0x17')][_0x8307('0x15')]);}})[_0x8307('0x18')](function(_0x46da5b){logger[_0x8307('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x37893d,_0x46da5b);_0x4523b5(_0x46da5b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 31c2fa2..a14474d 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 _0xae15=['create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x4fbf38,_0x378af8){var _0x382d3d=function(_0x138062){while(--_0x138062){_0x4fbf38['push'](_0x4fbf38['shift']());}};_0x382d3d(++_0x378af8);}(_0xae15,0xce));var _0x5ae1=function(_0x51aeb1,_0x4c7977){_0x51aeb1=_0x51aeb1-0x0;var _0x4ae392=_0xae15[_0x51aeb1];return _0x4ae392;};'use strict';var multer=require(_0x5ae1('0x0'));var util=require(_0x5ae1('0x1'));var path=require(_0x5ae1('0x2'));var timeout=require(_0x5ae1('0x3'));var express=require(_0x5ae1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5ae1('0x5'));var config=require(_0x5ae1('0x6'));var controller=require(_0x5ae1('0x7'));router[_0x5ae1('0x8')]('/',auth['isAuthenticated'](),controller[_0x5ae1('0x9')]);router[_0x5ae1('0x8')](_0x5ae1('0xa'),auth[_0x5ae1('0xb')](),controller[_0x5ae1('0xc')]);router['get']('/:id',auth[_0x5ae1('0xb')](),controller[_0x5ae1('0xd')]);router['post']('/',auth[_0x5ae1('0xb')](),controller[_0x5ae1('0xe')]);router[_0x5ae1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5ae1('0x10')]);router[_0x5ae1('0x11')](_0x5ae1('0x12'),auth[_0x5ae1('0xb')](),controller[_0x5ae1('0x13')]);module['exports']=router; \ No newline at end of file +var _0x94bf=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x159761,_0x52ccfd){var _0x35b541=function(_0x4e6244){while(--_0x4e6244){_0x159761['push'](_0x159761['shift']());}};_0x35b541(++_0x52ccfd);}(_0x94bf,0x188));var _0xf94b=function(_0xfa66b0,_0x138fa1){_0xfa66b0=_0xfa66b0-0x0;var _0x492e32=_0x94bf[_0xfa66b0];return _0x492e32;};'use strict';var multer=require(_0xf94b('0x0'));var util=require(_0xf94b('0x1'));var path=require(_0xf94b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf94b('0x3')]();var auth=require(_0xf94b('0x4'));var interaction=require(_0xf94b('0x5'));var config=require(_0xf94b('0x6'));var controller=require(_0xf94b('0x7'));router[_0xf94b('0x8')]('/',auth[_0xf94b('0x9')](),controller[_0xf94b('0xa')]);router[_0xf94b('0x8')](_0xf94b('0xb'),auth['isAuthenticated'](),controller[_0xf94b('0xc')]);router['get'](_0xf94b('0xd'),auth[_0xf94b('0x9')](),controller[_0xf94b('0xe')]);router[_0xf94b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf94b('0x10')](_0xf94b('0xd'),auth[_0xf94b('0x9')](),controller[_0xf94b('0x11')]);router[_0xf94b('0x12')](_0xf94b('0xd'),auth['isAuthenticated'](),controller[_0xf94b('0x13')]);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 0c0291f..26efa79 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 _0x6ce1=['STRING','sequelize','TEXT'];(function(_0x79c5a,_0x48b2ae){var _0x3c78eb=function(_0x51d46f){while(--_0x51d46f){_0x79c5a['push'](_0x79c5a['shift']());}};_0x3c78eb(++_0x48b2ae);}(_0x6ce1,0x85));var _0x16ce=function(_0x4e4f9d,_0x1f71b4){_0x4e4f9d=_0x4e4f9d-0x0;var _0x368095=_0x6ce1[_0x4e4f9d];return _0x368095;};'use strict';var Sequelize=require(_0x16ce('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x16ce('0x1')]('long')},'membername':{'type':Sequelize[_0x16ce('0x2')]},'projectname':{'type':Sequelize[_0x16ce('0x2')]},'queue':{'type':Sequelize[_0x16ce('0x2')]},'uniqueid':{'type':Sequelize[_0x16ce('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x16ce('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7679=['exports','STRING','TEXT','sequelize'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7679,0x13f));var _0x9767=function(_0x50d401,_0x49c3ba){_0x50d401=_0x50d401-0x0;var _0xc462ed=_0x7679[_0x50d401];return _0xc462ed;};'use strict';var Sequelize=require(_0x9767('0x0'));module[_0x9767('0x1')]={'question':{'type':Sequelize[_0x9767('0x2')]},'answer':{'type':Sequelize[_0x9767('0x3')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x9767('0x2')]},'queue':{'type':Sequelize[_0x9767('0x2')]},'uniqueid':{'type':Sequelize[_0x9767('0x2')]},'calleridname':{'type':Sequelize[_0x9767('0x2')]},'calleridnum':{'type':Sequelize[_0x9767('0x2')]},'questionId':{'type':Sequelize[_0x9767('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 1b410d1..cceec07 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 _0x7a41=['to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','merge','options','count','include','findAll','show','params','keys','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','desk.js'];(function(_0x13696a,_0x533911){var _0x985801=function(_0x3adc75){while(--_0x3adc75){_0x13696a['push'](_0x13696a['shift']());}};_0x985801(++_0x533911);}(_0x7a41,0x190));var _0x17a4=function(_0x47ad90,_0x1f3b24){_0x47ad90=_0x47ad90-0x0;var _0x1750bc=_0x7a41[_0x47ad90];return _0x1750bc;};'use strict';var pdf=require(_0x17a4('0x0'));var emlformat=require(_0x17a4('0x1'));var rimraf=require(_0x17a4('0x2'));var zipdir=require(_0x17a4('0x3'));var jsonpatch=require(_0x17a4('0x4'));var rp=require(_0x17a4('0x5'));var moment=require(_0x17a4('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x17a4('0x7'));var util=require(_0x17a4('0x8'));var path=require(_0x17a4('0x9'));var sox=require(_0x17a4('0xa'));var csv=require('to-csv');var ejs=require(_0x17a4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x17a4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x17a4('0xd'));var toCsv=require(_0x17a4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x17a4('0xf'));var authService=require(_0x17a4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17a4('0x11'));var logger=require(_0x17a4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x17a4('0x13'));var db=require(_0x17a4('0x14'))['db'];function respondWithStatusCode(_0x4167b9,_0x174637){_0x174637=_0x174637||0xcc;return function(_0x1f0930){if(_0x1f0930){return _0x4167b9['sendStatus'](_0x174637);}return _0x4167b9[_0x17a4('0x15')](_0x174637)['end']();};}function respondWithResult(_0x1df077,_0x4a3195){_0x4a3195=_0x4a3195||0xc8;return function(_0x5008a6){if(_0x5008a6){return _0x1df077[_0x17a4('0x15')](_0x4a3195)[_0x17a4('0x16')](_0x5008a6);}};}function respondWithFilteredResult(_0x5c3377,_0x3134a6){return function(_0x1d8df6){if(_0x1d8df6){var _0x3044ff=_0x1d8df6['count'],_0x3dbe14=_0x3134a6[_0x17a4('0x17')],_0x37a061=_0x3134a6[_0x17a4('0x17')]+_0x3134a6[_0x17a4('0x18')],_0x53f1f0;if(_0x37a061>=_0x3044ff){_0x37a061=_0x3044ff;_0x53f1f0=0xc8;}else{_0x53f1f0=0xce;}_0x5c3377[_0x17a4('0x15')](_0x53f1f0);return _0x5c3377['set'](_0x17a4('0x19'),_0x3dbe14+'-'+_0x37a061+'/'+_0x3044ff)['json'](_0x1d8df6);}return null;};}function patchUpdates(_0x443b97){return function(_0x59ca7e){try{jsonpatch['apply'](_0x59ca7e,_0x443b97,!![]);}catch(_0x2369e3){return BPromise[_0x17a4('0x1a')](_0x2369e3);}return _0x59ca7e[_0x17a4('0x1b')]();};}function saveUpdates(_0x2963f3,_0x3ffddd){return function(_0x316929){if(_0x316929){return _0x316929[_0x17a4('0x1c')](_0x2963f3)[_0x17a4('0x1d')](function(_0x40f7fd){return _0x40f7fd;});}return null;};}function removeEntity(_0x158585,_0x5a2243){return function(_0xc12e86){if(_0xc12e86){return _0xc12e86[_0x17a4('0x1e')]()['then'](function(){_0x158585[_0x17a4('0x15')](0xcc)[_0x17a4('0x1f')]();});}};}function handleEntityNotFound(_0x1a643a,_0x59972b){return function(_0x52bb47){if(!_0x52bb47){_0x1a643a[_0x17a4('0x20')](0x194);}return _0x52bb47;};}function handleError(_0xc5fd54,_0x221892){_0x221892=_0x221892||0x1f4;return function(_0x4a9357){logger[_0x17a4('0x21')](_0x4a9357['stack']);if(_0x4a9357[_0x17a4('0x22')]){delete _0x4a9357[_0x17a4('0x22')];}_0xc5fd54[_0x17a4('0x15')](_0x221892)[_0x17a4('0x23')](_0x4a9357);};}exports[_0x17a4('0x24')]=function(_0x11ec42,_0x4b4f18){var _0x5c95cf={},_0x1001ff={},_0x2bcf4e={'count':0x0,'rows':[]};var _0x15ec90=_[_0x17a4('0x25')](db[_0x17a4('0x26')][_0x17a4('0x27')],function(_0x21c94e){return{'name':_0x21c94e['fieldName'],'type':_0x21c94e['type'][_0x17a4('0x28')]};});_0x1001ff[_0x17a4('0x29')]=_[_0x17a4('0x25')](_0x15ec90,_0x17a4('0x22'));_0x1001ff[_0x17a4('0x2a')]=_['keys'](_0x11ec42[_0x17a4('0x2a')]);_0x1001ff['filters']=_[_0x17a4('0x2b')](_0x1001ff[_0x17a4('0x29')],_0x1001ff[_0x17a4('0x2a')]);_0x5c95cf[_0x17a4('0x2c')]=_['intersection'](_0x1001ff[_0x17a4('0x29')],qs[_0x17a4('0x2d')](_0x11ec42[_0x17a4('0x2a')][_0x17a4('0x2d')]));_0x5c95cf[_0x17a4('0x2c')]=_0x5c95cf[_0x17a4('0x2c')][_0x17a4('0x2e')]?_0x5c95cf[_0x17a4('0x2c')]:_0x1001ff['model'];if(!_0x11ec42[_0x17a4('0x2a')][_0x17a4('0x2f')](_0x17a4('0x30'))){_0x5c95cf[_0x17a4('0x18')]=qs[_0x17a4('0x18')](_0x11ec42['query'][_0x17a4('0x18')]);_0x5c95cf[_0x17a4('0x17')]=qs[_0x17a4('0x17')](_0x11ec42[_0x17a4('0x2a')][_0x17a4('0x17')]);}_0x5c95cf['order']=qs[_0x17a4('0x31')](_0x11ec42[_0x17a4('0x2a')]['sort']);_0x5c95cf[_0x17a4('0x32')]=qs[_0x17a4('0x33')](_[_0x17a4('0x34')](_0x11ec42['query'],_0x1001ff[_0x17a4('0x33')]),_0x15ec90);if(_0x11ec42[_0x17a4('0x2a')][_0x17a4('0x35')]){_0x5c95cf[_0x17a4('0x32')]=_['merge'](_0x5c95cf['where'],{'$or':_[_0x17a4('0x25')](_0x15ec90,function(_0x19c123){if(_0x19c123[_0x17a4('0x36')]!=='VIRTUAL'){var _0x315d81={};_0x315d81[_0x19c123['name']]={'$like':'%'+_0x11ec42[_0x17a4('0x2a')][_0x17a4('0x35')]+'%'};return _0x315d81;}})});}_0x5c95cf=_[_0x17a4('0x37')]({},_0x5c95cf,_0x11ec42[_0x17a4('0x38')]);var _0x5cc51c={'where':_0x5c95cf[_0x17a4('0x32')]};return db[_0x17a4('0x26')][_0x17a4('0x39')](_0x5cc51c)[_0x17a4('0x1d')](function(_0x40e627){_0x2bcf4e[_0x17a4('0x39')]=_0x40e627;if(_0x11ec42[_0x17a4('0x2a')]['includeAll']){_0x5c95cf[_0x17a4('0x3a')]=[{'all':!![]}];}return db[_0x17a4('0x26')][_0x17a4('0x3b')](_0x5c95cf);})[_0x17a4('0x1d')](function(_0x5ebc6d){_0x2bcf4e['rows']=_0x5ebc6d;return _0x2bcf4e;})['then'](respondWithFilteredResult(_0x4b4f18,_0x5c95cf))['catch'](handleError(_0x4b4f18,null));};exports[_0x17a4('0x3c')]=function(_0x4310c8,_0x42d878){var _0x664edb={'raw':!![],'where':{'id':_0x4310c8[_0x17a4('0x3d')]['id']}},_0xf260e={};_0xf260e[_0x17a4('0x29')]=_[_0x17a4('0x3e')](db['JscriptyQuestionReport'][_0x17a4('0x27')]);_0xf260e[_0x17a4('0x2a')]=_[_0x17a4('0x3e')](_0x4310c8[_0x17a4('0x2a')]);_0xf260e[_0x17a4('0x33')]=_[_0x17a4('0x2b')](_0xf260e[_0x17a4('0x29')],_0xf260e['query']);_0x664edb['attributes']=_[_0x17a4('0x2b')](_0xf260e[_0x17a4('0x29')],qs[_0x17a4('0x2d')](_0x4310c8[_0x17a4('0x2a')][_0x17a4('0x2d')]));_0x664edb['attributes']=_0x664edb[_0x17a4('0x2c')]['length']?_0x664edb['attributes']:_0xf260e['model'];if(_0x4310c8[_0x17a4('0x2a')][_0x17a4('0x3f')]){_0x664edb[_0x17a4('0x3a')]=[{'all':!![]}];}_0x664edb=_[_0x17a4('0x37')]({},_0x664edb,_0x4310c8['options']);return db[_0x17a4('0x26')][_0x17a4('0x40')](_0x664edb)[_0x17a4('0x1d')](handleEntityNotFound(_0x42d878,null))[_0x17a4('0x1d')](respondWithResult(_0x42d878,null))[_0x17a4('0x41')](handleError(_0x42d878,null));};exports[_0x17a4('0x42')]=function(_0x3c857a,_0x1afb9f){return db[_0x17a4('0x26')][_0x17a4('0x42')](_0x3c857a[_0x17a4('0x43')],{})[_0x17a4('0x1d')](respondWithResult(_0x1afb9f,0xc9))['catch'](handleError(_0x1afb9f,null));};exports[_0x17a4('0x1c')]=function(_0x15abd7,_0x38bc86){if(_0x15abd7[_0x17a4('0x43')]['id']){delete _0x15abd7['body']['id'];}return db[_0x17a4('0x26')]['find']({'where':{'id':_0x15abd7[_0x17a4('0x3d')]['id']}})[_0x17a4('0x1d')](handleEntityNotFound(_0x38bc86,null))[_0x17a4('0x1d')](saveUpdates(_0x15abd7[_0x17a4('0x43')],null))[_0x17a4('0x1d')](respondWithResult(_0x38bc86,null))[_0x17a4('0x41')](handleError(_0x38bc86,null));};exports[_0x17a4('0x1e')]=function(_0x32d921,_0x155e63){return db[_0x17a4('0x26')]['find']({'where':{'id':_0x32d921[_0x17a4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x155e63,null))['then'](removeEntity(_0x155e63,null))[_0x17a4('0x41')](handleError(_0x155e63,null));};exports[_0x17a4('0x44')]=function(_0x87a78,_0x2cd6f9){return db['JscriptyQuestionReport'][_0x17a4('0x44')]()['then'](respondWithResult(_0x2cd6f9,null))[_0x17a4('0x41')](handleError(_0x2cd6f9,null));}; \ No newline at end of file +var _0x785b=['../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','JscriptyQuestionReport','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x785b,0x7b));var _0xb785=function(_0x57d9f7,_0x1ed117){_0x57d9f7=_0x57d9f7-0x0;var _0x3d761e=_0x785b[_0x57d9f7];return _0x3d761e;};'use strict';var pdf=require(_0xb785('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb785('0x1'));var zipdir=require(_0xb785('0x2'));var jsonpatch=require(_0xb785('0x3'));var rp=require(_0xb785('0x4'));var moment=require(_0xb785('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb785('0x6'));var util=require('util');var path=require(_0xb785('0x7'));var sox=require(_0xb785('0x8'));var csv=require(_0xb785('0x9'));var ejs=require(_0xb785('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb785('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb785('0xc'));var toCsv=require(_0xb785('0x9'));var querystring=require(_0xb785('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb785('0xe'));var qs=require(_0xb785('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb785('0x10'));var utils=require('../../config/utils');var config=require(_0xb785('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb3c187,_0x4325f5){_0x4325f5=_0x4325f5||0xcc;return function(_0x34d350){if(_0x34d350){return _0xb3c187[_0xb785('0x12')](_0x4325f5);}return _0xb3c187[_0xb785('0x13')](_0x4325f5)['end']();};}function respondWithResult(_0xda9bd9,_0x2a8011){_0x2a8011=_0x2a8011||0xc8;return function(_0x3ec43f){if(_0x3ec43f){return _0xda9bd9[_0xb785('0x13')](_0x2a8011)[_0xb785('0x14')](_0x3ec43f);}};}function respondWithFilteredResult(_0x333f23,_0xe06d51){return function(_0x4c3645){if(_0x4c3645){var _0x5c3999=_0x4c3645[_0xb785('0x15')],_0x2469e8=_0xe06d51[_0xb785('0x16')],_0x17ac1f=_0xe06d51[_0xb785('0x16')]+_0xe06d51[_0xb785('0x17')],_0x22667a;if(_0x17ac1f>=_0x5c3999){_0x17ac1f=_0x5c3999;_0x22667a=0xc8;}else{_0x22667a=0xce;}_0x333f23[_0xb785('0x13')](_0x22667a);return _0x333f23[_0xb785('0x18')](_0xb785('0x19'),_0x2469e8+'-'+_0x17ac1f+'/'+_0x5c3999)[_0xb785('0x14')](_0x4c3645);}return null;};}function patchUpdates(_0x2d840c){return function(_0x1e9c2a){try{jsonpatch[_0xb785('0x1a')](_0x1e9c2a,_0x2d840c,!![]);}catch(_0x37bc2e){return BPromise[_0xb785('0x1b')](_0x37bc2e);}return _0x1e9c2a[_0xb785('0x1c')]();};}function saveUpdates(_0x304579,_0x49e7d1){return function(_0xac0e18){if(_0xac0e18){return _0xac0e18[_0xb785('0x1d')](_0x304579)['then'](function(_0x14c04d){return _0x14c04d;});}return null;};}function removeEntity(_0x4983c3,_0x579647){return function(_0xd767e6){if(_0xd767e6){return _0xd767e6[_0xb785('0x1e')]()[_0xb785('0x1f')](function(){_0x4983c3[_0xb785('0x13')](0xcc)[_0xb785('0x20')]();});}};}function handleEntityNotFound(_0x473e6a,_0x17085f){return function(_0x285ae5){if(!_0x285ae5){_0x473e6a[_0xb785('0x12')](0x194);}return _0x285ae5;};}function handleError(_0x42f2fb,_0x4f2bba){_0x4f2bba=_0x4f2bba||0x1f4;return function(_0xae7d0e){logger[_0xb785('0x21')](_0xae7d0e[_0xb785('0x22')]);if(_0xae7d0e['name']){delete _0xae7d0e[_0xb785('0x23')];}_0x42f2fb[_0xb785('0x13')](_0x4f2bba)['send'](_0xae7d0e);};}exports[_0xb785('0x24')]=function(_0x1efa96,_0xa3ed){var _0x4e759f={},_0x302702={},_0x455b3b={'count':0x0,'rows':[]};var _0x13914c=_[_0xb785('0x25')](db['JscriptyQuestionReport'][_0xb785('0x26')],function(_0x329025){return{'name':_0x329025['fieldName'],'type':_0x329025['type'][_0xb785('0x27')]};});_0x302702['model']=_[_0xb785('0x25')](_0x13914c,_0xb785('0x23'));_0x302702[_0xb785('0x28')]=_[_0xb785('0x29')](_0x1efa96['query']);_0x302702[_0xb785('0x2a')]=_['intersection'](_0x302702[_0xb785('0x2b')],_0x302702[_0xb785('0x28')]);_0x4e759f[_0xb785('0x2c')]=_[_0xb785('0x2d')](_0x302702[_0xb785('0x2b')],qs[_0xb785('0x2e')](_0x1efa96[_0xb785('0x28')]['fields']));_0x4e759f[_0xb785('0x2c')]=_0x4e759f[_0xb785('0x2c')][_0xb785('0x2f')]?_0x4e759f[_0xb785('0x2c')]:_0x302702[_0xb785('0x2b')];if(!_0x1efa96['query'][_0xb785('0x30')](_0xb785('0x31'))){_0x4e759f[_0xb785('0x17')]=qs[_0xb785('0x17')](_0x1efa96['query']['limit']);_0x4e759f[_0xb785('0x16')]=qs[_0xb785('0x16')](_0x1efa96[_0xb785('0x28')]['offset']);}_0x4e759f[_0xb785('0x32')]=qs['sort'](_0x1efa96[_0xb785('0x28')][_0xb785('0x33')]);_0x4e759f[_0xb785('0x34')]=qs['filters'](_[_0xb785('0x35')](_0x1efa96[_0xb785('0x28')],_0x302702[_0xb785('0x2a')]),_0x13914c);if(_0x1efa96[_0xb785('0x28')][_0xb785('0x36')]){_0x4e759f['where']=_['merge'](_0x4e759f[_0xb785('0x34')],{'$or':_['map'](_0x13914c,function(_0x36246b){if(_0x36246b[_0xb785('0x37')]!==_0xb785('0x38')){var _0x46b925={};_0x46b925[_0x36246b[_0xb785('0x23')]]={'$like':'%'+_0x1efa96[_0xb785('0x28')]['filter']+'%'};return _0x46b925;}})});}_0x4e759f=_[_0xb785('0x39')]({},_0x4e759f,_0x1efa96[_0xb785('0x3a')]);var _0x523c46={'where':_0x4e759f[_0xb785('0x34')]};return db[_0xb785('0x3b')][_0xb785('0x15')](_0x523c46)[_0xb785('0x1f')](function(_0x331778){_0x455b3b[_0xb785('0x15')]=_0x331778;if(_0x1efa96['query']['includeAll']){_0x4e759f[_0xb785('0x3c')]=[{'all':!![]}];}return db[_0xb785('0x3b')][_0xb785('0x3d')](_0x4e759f);})[_0xb785('0x1f')](function(_0x44f5bd){_0x455b3b[_0xb785('0x3e')]=_0x44f5bd;return _0x455b3b;})[_0xb785('0x1f')](respondWithFilteredResult(_0xa3ed,_0x4e759f))[_0xb785('0x3f')](handleError(_0xa3ed,null));};exports[_0xb785('0x40')]=function(_0xa2c9dd,_0x5b6e16){var _0x2a152c={'raw':!![],'where':{'id':_0xa2c9dd[_0xb785('0x41')]['id']}},_0x1ccecc={};_0x1ccecc[_0xb785('0x2b')]=_[_0xb785('0x29')](db[_0xb785('0x3b')][_0xb785('0x26')]);_0x1ccecc[_0xb785('0x28')]=_['keys'](_0xa2c9dd[_0xb785('0x28')]);_0x1ccecc[_0xb785('0x2a')]=_['intersection'](_0x1ccecc[_0xb785('0x2b')],_0x1ccecc[_0xb785('0x28')]);_0x2a152c[_0xb785('0x2c')]=_['intersection'](_0x1ccecc[_0xb785('0x2b')],qs[_0xb785('0x2e')](_0xa2c9dd[_0xb785('0x28')][_0xb785('0x2e')]));_0x2a152c[_0xb785('0x2c')]=_0x2a152c['attributes'][_0xb785('0x2f')]?_0x2a152c[_0xb785('0x2c')]:_0x1ccecc[_0xb785('0x2b')];if(_0xa2c9dd['query']['includeAll']){_0x2a152c[_0xb785('0x3c')]=[{'all':!![]}];}_0x2a152c=_[_0xb785('0x39')]({},_0x2a152c,_0xa2c9dd[_0xb785('0x3a')]);return db[_0xb785('0x3b')][_0xb785('0x42')](_0x2a152c)[_0xb785('0x1f')](handleEntityNotFound(_0x5b6e16,null))['then'](respondWithResult(_0x5b6e16,null))[_0xb785('0x3f')](handleError(_0x5b6e16,null));};exports[_0xb785('0x43')]=function(_0x44b0f0,_0x486748){return db[_0xb785('0x3b')]['create'](_0x44b0f0[_0xb785('0x44')],{})[_0xb785('0x1f')](respondWithResult(_0x486748,0xc9))[_0xb785('0x3f')](handleError(_0x486748,null));};exports[_0xb785('0x1d')]=function(_0xf96690,_0x22b214){if(_0xf96690[_0xb785('0x44')]['id']){delete _0xf96690[_0xb785('0x44')]['id'];}return db[_0xb785('0x3b')][_0xb785('0x42')]({'where':{'id':_0xf96690[_0xb785('0x41')]['id']}})[_0xb785('0x1f')](handleEntityNotFound(_0x22b214,null))[_0xb785('0x1f')](saveUpdates(_0xf96690['body'],null))[_0xb785('0x1f')](respondWithResult(_0x22b214,null))['catch'](handleError(_0x22b214,null));};exports[_0xb785('0x1e')]=function(_0x26e630,_0x465c9c){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x26e630['params']['id']}})[_0xb785('0x1f')](handleEntityNotFound(_0x465c9c,null))[_0xb785('0x1f')](removeEntity(_0x465c9c,null))[_0xb785('0x3f')](handleError(_0x465c9c,null));};exports[_0xb785('0x45')]=function(_0x44bea9,_0x5505de){return db[_0xb785('0x3b')][_0xb785('0x45')]()['then'](respondWithResult(_0x5505de,null))[_0xb785('0x3f')](handleError(_0x5505de,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 37bfdb9..c627d68 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 _0x2581=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2581,0x159));var _0x1258=function(_0xf95594,_0x44b311){_0xf95594=_0xf95594-0x0;var _0x54a375=_0x2581[_0xf95594];return _0x54a375;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var logger=require(_0x1258('0x2'))('api');var moment=require(_0x1258('0x3'));var BPromise=require(_0x1258('0x4'));var rp=require(_0x1258('0x5'));var fs=require('fs');var path=require(_0x1258('0x6'));var rimraf=require(_0x1258('0x7'));var config=require(_0x1258('0x8'));var attributes=require(_0x1258('0x9'));module[_0x1258('0xa')]=function(_0x41f1ea,_0x259a6b){return _0x41f1ea[_0x1258('0xb')](_0x1258('0xc'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ab9=['api','moment','bluebird','request-promise','rimraf','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger'];(function(_0x48ae57,_0x18afa1){var _0x355ce2=function(_0x20af85){while(--_0x20af85){_0x48ae57['push'](_0x48ae57['shift']());}};_0x355ce2(++_0x18afa1);}(_0x7ab9,0xda));var _0x97ab=function(_0x46aaaa,_0x3af897){_0x46aaaa=_0x46aaaa-0x0;var _0x26d04e=_0x7ab9[_0x46aaaa];return _0x26d04e;};'use strict';var _=require(_0x97ab('0x0'));var util=require('util');var logger=require(_0x97ab('0x1'))(_0x97ab('0x2'));var moment=require(_0x97ab('0x3'));var BPromise=require(_0x97ab('0x4'));var rp=require(_0x97ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97ab('0x6'));var config=require('../../config/environment');var attributes=require(_0x97ab('0x7'));module[_0x97ab('0x8')]=function(_0x3691e6,_0x473ae6){return _0x3691e6[_0x97ab('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x97ab('0xa'),'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 c8581ee..8aba7da 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 _0xda32=['http','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xda32,0x138));var _0x2da3=function(_0x28dd23,_0x48d4e0){_0x28dd23=_0x28dd23-0x0;var _0x110188=_0xda32[_0x28dd23];return _0x110188;};'use strict';var _=require('lodash');var util=require(_0x2da3('0x0'));var moment=require(_0x2da3('0x1'));var BPromise=require(_0x2da3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2da3('0x3'));var db=require(_0x2da3('0x4'))['db'];var utils=require(_0x2da3('0x5'));var logger=require(_0x2da3('0x6'))('rpc');var config=require(_0x2da3('0x7'));var jayson=require(_0x2da3('0x8'));var client=jayson[_0x2da3('0x9')][_0x2da3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c2b8e,_0x686ff6,_0x339abb){return new BPromise(function(_0x1e599a,_0x7de8ba){return client['request'](_0x2c2b8e,_0x339abb)[_0x2da3('0xb')](function(_0x14266f){logger[_0x2da3('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x686ff6,_0x2da3('0xd'));logger[_0x2da3('0xe')](_0x2da3('0xf'),_0x686ff6,_0x2da3('0xd'),JSON[_0x2da3('0x10')](_0x14266f));if(_0x14266f[_0x2da3('0x11')]){if(_0x14266f[_0x2da3('0x11')][_0x2da3('0x12')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x686ff6,_0x14266f[_0x2da3('0x11')]['message']);return _0x7de8ba(_0x14266f['error']['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x686ff6,_0x14266f[_0x2da3('0x11')][_0x2da3('0x13')]);return _0x1e599a(_0x14266f[_0x2da3('0x11')]['message']);}else{logger[_0x2da3('0xc')](_0x2da3('0x14'),_0x686ff6,'request\x20sent');_0x1e599a(_0x14266f[_0x2da3('0x15')][_0x2da3('0x13')]);}})[_0x2da3('0x16')](function(_0x523099){logger['error'](_0x2da3('0x14'),_0x686ff6,_0x523099);_0x7de8ba(_0x523099);});});} \ No newline at end of file +var _0xa833=['stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x19e079,_0x2d7ba4){var _0x441dc8=function(_0x575ef6){while(--_0x575ef6){_0x19e079['push'](_0x19e079['shift']());}};_0x441dc8(++_0x2d7ba4);}(_0xa833,0x6f));var _0x3a83=function(_0x49def3,_0x14e8da){_0x49def3=_0x49def3-0x0;var _0x2dcbe9=_0xa833[_0x49def3];return _0x2dcbe9;};'use strict';var _=require(_0x3a83('0x0'));var util=require(_0x3a83('0x1'));var moment=require('moment');var BPromise=require(_0x3a83('0x2'));var rs=require(_0x3a83('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a83('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a83('0x5'))(_0x3a83('0x6'));var config=require(_0x3a83('0x7'));var jayson=require(_0x3a83('0x8'));var client=jayson[_0x3a83('0x9')][_0x3a83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ca65d,_0x40e2b2,_0x1aa58e){return new BPromise(function(_0x597753,_0x30bf71){return client['request'](_0x3ca65d,_0x1aa58e)[_0x3a83('0xb')](function(_0x2ea732){logger['info'](_0x3a83('0xc'),_0x40e2b2,_0x3a83('0xd'));logger['debug'](_0x3a83('0xe'),_0x40e2b2,'request\x20sent',JSON[_0x3a83('0xf')](_0x2ea732));if(_0x2ea732[_0x3a83('0x10')]){if(_0x2ea732[_0x3a83('0x10')][_0x3a83('0x11')]===0x1f4){logger[_0x3a83('0x10')](_0x3a83('0xc'),_0x40e2b2,_0x2ea732[_0x3a83('0x10')]['message']);return _0x30bf71(_0x2ea732[_0x3a83('0x10')][_0x3a83('0x12')]);}logger[_0x3a83('0x10')](_0x3a83('0xc'),_0x40e2b2,_0x2ea732[_0x3a83('0x10')][_0x3a83('0x12')]);return _0x597753(_0x2ea732[_0x3a83('0x10')][_0x3a83('0x12')]);}else{logger[_0x3a83('0x13')](_0x3a83('0xc'),_0x40e2b2,'request\x20sent');_0x597753(_0x2ea732['result'][_0x3a83('0x12')]);}})[_0x3a83('0x14')](function(_0x5d7d9b){logger[_0x3a83('0x10')](_0x3a83('0xc'),_0x40e2b2,_0x5d7d9b);_0x30bf71(_0x5d7d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9340c13..572e635 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 _0xb18e=['create','put','update','/:id','exports','path','express','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xb18e,0x181));var _0xeb18=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xb18e[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb18('0x0'));var timeout=require('connect-timeout');var express=require(_0xeb18('0x1'));var router=express['Router']();var auth=require(_0xeb18('0x2'));var interaction=require(_0xeb18('0x3'));var config=require('../../config/environment');var controller=require(_0xeb18('0x4'));router[_0xeb18('0x5')]('/',auth[_0xeb18('0x6')](),controller[_0xeb18('0x7')]);router[_0xeb18('0x5')](_0xeb18('0x8'),auth['isAuthenticated'](),controller[_0xeb18('0x9')]);router[_0xeb18('0x5')]('/:id',auth[_0xeb18('0x6')](),controller[_0xeb18('0xa')]);router[_0xeb18('0x5')](_0xeb18('0xb'),auth[_0xeb18('0x6')](),controller[_0xeb18('0xc')]);router[_0xeb18('0xd')]('/',auth[_0xeb18('0x6')](),controller[_0xeb18('0xe')]);router[_0xeb18('0xf')]('/:id',auth[_0xeb18('0x6')](),controller[_0xeb18('0x10')]);router['delete'](_0xeb18('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb18('0x12')]=router; \ No newline at end of file +var _0x2b83=['isAuthenticated','describe','show','post','create','put','update','exports','util','path','express','Router','../../components/auth/service','./jscriptySessionReport.controller','get','index','/describe'];(function(_0x44ef99,_0x5da86d){var _0x5710b1=function(_0xdba5e){while(--_0xdba5e){_0x44ef99['push'](_0x44ef99['shift']());}};_0x5710b1(++_0x5da86d);}(_0x2b83,0x1d3));var _0x32b8=function(_0x492f34,_0x13ecb5){_0x492f34=_0x492f34-0x0;var _0x1692fd=_0x2b83[_0x492f34];return _0x1692fd;};'use strict';var multer=require('multer');var util=require(_0x32b8('0x0'));var path=require(_0x32b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x32b8('0x2'));var router=express[_0x32b8('0x3')]();var auth=require(_0x32b8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32b8('0x5'));router[_0x32b8('0x6')]('/',auth['isAuthenticated'](),controller[_0x32b8('0x7')]);router['get'](_0x32b8('0x8'),auth[_0x32b8('0x9')](),controller[_0x32b8('0xa')]);router[_0x32b8('0x6')]('/:id',auth[_0x32b8('0x9')](),controller[_0x32b8('0xb')]);router['get']('/:id/questions',auth[_0x32b8('0x9')](),controller['getQuestions']);router[_0x32b8('0xc')]('/',auth[_0x32b8('0x9')](),controller[_0x32b8('0xd')]);router[_0x32b8('0xe')]('/:id',auth[_0x32b8('0x9')](),controller[_0x32b8('0xf')]);router['delete']('/:id',auth[_0x32b8('0x9')](),controller['destroy']);module[_0x32b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index cebcc44..40d17cd 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 _0x8d1c=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0x8d1c,0x7f));var _0xc8d1=function(_0x59e7ec,_0x43e0d6){_0x59e7ec=_0x59e7ec-0x0;var _0xd81d22=_0x8d1c[_0x59e7ec];return _0xd81d22;};'use strict';var moment=require(_0xc8d1('0x0'));var Sequelize=require(_0xc8d1('0x1'));module[_0xc8d1('0x2')]={'starttime':{'type':Sequelize[_0xc8d1('0x3')],'set':function(_0x241f17){this[_0xc8d1('0x4')](_0xc8d1('0x5'),_0x241f17);this[_0xc8d1('0x4')](_0xc8d1('0x6'),moment()[_0xc8d1('0x7')](_0xc8d1('0x8')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xc8d1('0x9')]},'queue':{'type':Sequelize[_0xc8d1('0x9')]},'uniqueid':{'type':Sequelize[_0xc8d1('0x9')]},'calleridname':{'type':Sequelize[_0xc8d1('0x9')]},'calleridnum':{'type':Sequelize[_0xc8d1('0x9')]},'completed':{'type':Sequelize[_0xc8d1('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xbf60=['endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x1cc07e,_0x527192){var _0xb762fc=function(_0x408f78){while(--_0x408f78){_0x1cc07e['push'](_0x1cc07e['shift']());}};_0xb762fc(++_0x527192);}(_0xbf60,0x144));var _0x0bf6=function(_0x5e34a4,_0x2e63ed){_0x5e34a4=_0x5e34a4-0x0;var _0x8d41d7=_0xbf60[_0x5e34a4];return _0x8d41d7;};'use strict';var moment=require(_0x0bf6('0x0'));var Sequelize=require(_0x0bf6('0x1'));module[_0x0bf6('0x2')]={'starttime':{'type':Sequelize[_0x0bf6('0x3')],'set':function(_0x92b03){this[_0x0bf6('0x4')](_0x0bf6('0x5'),_0x92b03);this[_0x0bf6('0x4')](_0x0bf6('0x6'),moment()[_0x0bf6('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x0bf6('0x3')]},'membername':{'type':Sequelize[_0x0bf6('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0bf6('0x8')]},'uniqueid':{'type':Sequelize[_0x0bf6('0x8')]},'calleridname':{'type':Sequelize[_0x0bf6('0x8')]},'calleridnum':{'type':Sequelize[_0x0bf6('0x8')]},'completed':{'type':Sequelize[_0x0bf6('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 3e1833a..bad7592 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 _0x7a84=['stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','filters','merge','create','body','find','describe','getQuestions','JscriptyQuestionReport','length','order','SessionId','rows','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','json','apply','reject','save','then','destroy'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a84,0x15c));var _0x47a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a84[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x47a8('0x0'));var emlformat=require(_0x47a8('0x1'));var rimraf=require(_0x47a8('0x2'));var zipdir=require(_0x47a8('0x3'));var jsonpatch=require(_0x47a8('0x4'));var rp=require('request-promise');var moment=require(_0x47a8('0x5'));var BPromise=require(_0x47a8('0x6'));var Mustache=require(_0x47a8('0x7'));var util=require(_0x47a8('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x47a8('0x9'));var ejs=require(_0x47a8('0xa'));var fs=require('fs');var _=require(_0x47a8('0xb'));var squel=require(_0x47a8('0xc'));var crypto=require(_0x47a8('0xd'));var jsforce=require(_0x47a8('0xe'));var deskjs=require(_0x47a8('0xf'));var toCsv=require(_0x47a8('0x9'));var querystring=require(_0x47a8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x47a8('0x11'));var qs=require(_0x47a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a8('0x13'))('api');var utils=require(_0x47a8('0x14'));var config=require('../../config/environment');var db=require(_0x47a8('0x15'))['db'];function respondWithStatusCode(_0x56e9b5,_0x3ba983){_0x3ba983=_0x3ba983||0xcc;return function(_0x5f1308){if(_0x5f1308){return _0x56e9b5[_0x47a8('0x16')](_0x3ba983);}return _0x56e9b5[_0x47a8('0x17')](_0x3ba983)[_0x47a8('0x18')]();};}function respondWithResult(_0x5b5faf,_0x22aede){_0x22aede=_0x22aede||0xc8;return function(_0x1f5880){if(_0x1f5880){return _0x5b5faf[_0x47a8('0x17')](_0x22aede)['json'](_0x1f5880);}};}function respondWithFilteredResult(_0x5b1814,_0x393393){return function(_0x2c4c4c){if(_0x2c4c4c){var _0x125fa4=_0x2c4c4c['count'],_0xa9ffa4=_0x393393[_0x47a8('0x19')],_0x42b9df=_0x393393[_0x47a8('0x19')]+_0x393393['limit'],_0x52b728;if(_0x42b9df>=_0x125fa4){_0x42b9df=_0x125fa4;_0x52b728=0xc8;}else{_0x52b728=0xce;}_0x5b1814[_0x47a8('0x17')](_0x52b728);return _0x5b1814['set']('Content-Range',_0xa9ffa4+'-'+_0x42b9df+'/'+_0x125fa4)[_0x47a8('0x1a')](_0x2c4c4c);}return null;};}function patchUpdates(_0x16b7f2){return function(_0x3844f1){try{jsonpatch[_0x47a8('0x1b')](_0x3844f1,_0x16b7f2,!![]);}catch(_0x153341){return BPromise[_0x47a8('0x1c')](_0x153341);}return _0x3844f1[_0x47a8('0x1d')]();};}function saveUpdates(_0x44298f,_0x33cd36){return function(_0x5cf78b){if(_0x5cf78b){return _0x5cf78b['update'](_0x44298f)[_0x47a8('0x1e')](function(_0x300c5f){return _0x300c5f;});}return null;};}function removeEntity(_0x156f89,_0x64932e){return function(_0xa901e6){if(_0xa901e6){return _0xa901e6[_0x47a8('0x1f')]()[_0x47a8('0x1e')](function(){_0x156f89[_0x47a8('0x17')](0xcc)[_0x47a8('0x18')]();});}};}function handleEntityNotFound(_0x1fe3ba,_0x22dfc1){return function(_0x11975f){if(!_0x11975f){_0x1fe3ba['sendStatus'](0x194);}return _0x11975f;};}function handleError(_0x200dc1,_0xc303f0){_0xc303f0=_0xc303f0||0x1f4;return function(_0x4afeb7){logger['error'](_0x4afeb7[_0x47a8('0x20')]);if(_0x4afeb7[_0x47a8('0x21')]){delete _0x4afeb7[_0x47a8('0x21')];}_0x200dc1['status'](_0xc303f0)[_0x47a8('0x22')](_0x4afeb7);};}exports[_0x47a8('0x23')]=function(_0x50617d,_0x10974d){var _0x25f80f={},_0x4b8790={},_0x526dca={'count':0x0,'rows':[]};var _0x3a7a85=_[_0x47a8('0x24')](db[_0x47a8('0x25')][_0x47a8('0x26')],function(_0x9397cd){return{'name':_0x9397cd[_0x47a8('0x27')],'type':_0x9397cd[_0x47a8('0x28')][_0x47a8('0x29')]};});_0x4b8790[_0x47a8('0x2a')]=_[_0x47a8('0x24')](_0x3a7a85,'name');_0x4b8790[_0x47a8('0x2b')]=_[_0x47a8('0x2c')](_0x50617d[_0x47a8('0x2b')]);_0x4b8790['filters']=_['intersection'](_0x4b8790[_0x47a8('0x2a')],_0x4b8790[_0x47a8('0x2b')]);_0x25f80f[_0x47a8('0x2d')]=_[_0x47a8('0x2e')](_0x4b8790['model'],qs[_0x47a8('0x2f')](_0x50617d['query']['fields']));_0x25f80f[_0x47a8('0x2d')]=_0x25f80f['attributes']['length']?_0x25f80f['attributes']:_0x4b8790['model'];if(!_0x50617d['query'][_0x47a8('0x30')](_0x47a8('0x31'))){_0x25f80f[_0x47a8('0x32')]=qs[_0x47a8('0x32')](_0x50617d['query']['limit']);_0x25f80f[_0x47a8('0x19')]=qs[_0x47a8('0x19')](_0x50617d['query']['offset']);}_0x25f80f['order']=qs['sort'](_0x50617d[_0x47a8('0x2b')][_0x47a8('0x33')]);_0x25f80f[_0x47a8('0x34')]=qs['filters'](_[_0x47a8('0x35')](_0x50617d[_0x47a8('0x2b')],_0x4b8790['filters']),_0x3a7a85);if(_0x50617d[_0x47a8('0x2b')][_0x47a8('0x36')]){_0x25f80f['where']=_['merge'](_0x25f80f['where'],{'$or':_[_0x47a8('0x24')](_0x3a7a85,function(_0x553695){if(_0x553695['type']!==_0x47a8('0x37')){var _0x31ba17={};_0x31ba17[_0x553695[_0x47a8('0x21')]]={'$like':'%'+_0x50617d[_0x47a8('0x2b')][_0x47a8('0x36')]+'%'};return _0x31ba17;}})});}_0x25f80f=_['merge']({},_0x25f80f,_0x50617d[_0x47a8('0x38')]);var _0x106afb={'where':_0x25f80f[_0x47a8('0x34')]};return db['JscriptySessionReport'][_0x47a8('0x39')](_0x106afb)['then'](function(_0x2fe291){_0x526dca[_0x47a8('0x39')]=_0x2fe291;if(_0x50617d[_0x47a8('0x2b')][_0x47a8('0x3a')]){_0x25f80f[_0x47a8('0x3b')]=[{'all':!![]}];}return db[_0x47a8('0x25')][_0x47a8('0x3c')](_0x25f80f);})[_0x47a8('0x1e')](function(_0x233693){_0x526dca['rows']=_0x233693;return _0x526dca;})['then'](respondWithFilteredResult(_0x10974d,_0x25f80f))[_0x47a8('0x3d')](handleError(_0x10974d,null));};exports[_0x47a8('0x3e')]=function(_0x233b67,_0x4af101){var _0x17a501={'raw':!![],'where':{'id':_0x233b67[_0x47a8('0x3f')]['id']}},_0x140dd7={};_0x140dd7[_0x47a8('0x2a')]=_[_0x47a8('0x2c')](db['JscriptySessionReport']['rawAttributes']);_0x140dd7[_0x47a8('0x2b')]=_[_0x47a8('0x2c')](_0x233b67[_0x47a8('0x2b')]);_0x140dd7[_0x47a8('0x40')]=_[_0x47a8('0x2e')](_0x140dd7['model'],_0x140dd7['query']);_0x17a501[_0x47a8('0x2d')]=_[_0x47a8('0x2e')](_0x140dd7[_0x47a8('0x2a')],qs[_0x47a8('0x2f')](_0x233b67[_0x47a8('0x2b')][_0x47a8('0x2f')]));_0x17a501['attributes']=_0x17a501['attributes']['length']?_0x17a501[_0x47a8('0x2d')]:_0x140dd7['model'];if(_0x233b67[_0x47a8('0x2b')][_0x47a8('0x3a')]){_0x17a501[_0x47a8('0x3b')]=[{'all':!![]}];}_0x17a501=_[_0x47a8('0x41')]({},_0x17a501,_0x233b67[_0x47a8('0x38')]);return db['JscriptySessionReport']['find'](_0x17a501)[_0x47a8('0x1e')](handleEntityNotFound(_0x4af101,null))[_0x47a8('0x1e')](respondWithResult(_0x4af101,null))[_0x47a8('0x3d')](handleError(_0x4af101,null));};exports[_0x47a8('0x42')]=function(_0x3b8ce6,_0x5883c5){return db[_0x47a8('0x25')][_0x47a8('0x42')](_0x3b8ce6[_0x47a8('0x43')],{})['then'](respondWithResult(_0x5883c5,0xc9))[_0x47a8('0x3d')](handleError(_0x5883c5,null));};exports['update']=function(_0x4e1272,_0x3861be){if(_0x4e1272[_0x47a8('0x43')]['id']){delete _0x4e1272[_0x47a8('0x43')]['id'];}return db[_0x47a8('0x25')][_0x47a8('0x44')]({'where':{'id':_0x4e1272[_0x47a8('0x3f')]['id']}})[_0x47a8('0x1e')](handleEntityNotFound(_0x3861be,null))[_0x47a8('0x1e')](saveUpdates(_0x4e1272[_0x47a8('0x43')],null))[_0x47a8('0x1e')](respondWithResult(_0x3861be,null))['catch'](handleError(_0x3861be,null));};exports['destroy']=function(_0x12e7d2,_0x5ec167){return db['JscriptySessionReport'][_0x47a8('0x44')]({'where':{'id':_0x12e7d2[_0x47a8('0x3f')]['id']}})[_0x47a8('0x1e')](handleEntityNotFound(_0x5ec167,null))[_0x47a8('0x1e')](removeEntity(_0x5ec167,null))[_0x47a8('0x3d')](handleError(_0x5ec167,null));};exports['describe']=function(_0x26c0a2,_0x9d4168){return db[_0x47a8('0x25')][_0x47a8('0x45')]()['then'](respondWithResult(_0x9d4168,null))[_0x47a8('0x3d')](handleError(_0x9d4168,null));};exports[_0x47a8('0x46')]=function(_0x21a6f0,_0x24c693,_0x5c96a6){var _0x4f83a0={'raw':!![],'where':{}};var _0x435f39={};var _0x352e96={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x21a6f0['params']['id']}})[_0x47a8('0x1e')](handleEntityNotFound(_0x24c693,null))['then'](function(_0x4abf7a){if(_0x4abf7a){_0x435f39[_0x47a8('0x2a')]=_[_0x47a8('0x2c')](db[_0x47a8('0x47')]['rawAttributes']);_0x435f39['query']=_['keys'](_0x21a6f0['query']);_0x435f39[_0x47a8('0x40')]=_[_0x47a8('0x2e')](_0x435f39[_0x47a8('0x2a')],_0x435f39[_0x47a8('0x2b')]);_0x4f83a0[_0x47a8('0x2d')]=_['intersection'](_0x435f39['model'],qs[_0x47a8('0x2f')](_0x21a6f0[_0x47a8('0x2b')][_0x47a8('0x2f')]));_0x4f83a0[_0x47a8('0x2d')]=_0x4f83a0[_0x47a8('0x2d')][_0x47a8('0x48')]?_0x4f83a0[_0x47a8('0x2d')]:_0x435f39[_0x47a8('0x2a')];if(!_0x21a6f0[_0x47a8('0x2b')][_0x47a8('0x30')](_0x47a8('0x31'))){_0x4f83a0[_0x47a8('0x32')]=qs[_0x47a8('0x32')](_0x21a6f0[_0x47a8('0x2b')][_0x47a8('0x32')]);_0x4f83a0[_0x47a8('0x19')]=qs['offset'](_0x21a6f0[_0x47a8('0x2b')][_0x47a8('0x19')]);}_0x4f83a0[_0x47a8('0x49')]=qs['sort'](_0x21a6f0[_0x47a8('0x2b')][_0x47a8('0x33')]);_0x4f83a0[_0x47a8('0x34')]=qs[_0x47a8('0x40')](_[_0x47a8('0x35')](_0x21a6f0[_0x47a8('0x2b')],_0x435f39[_0x47a8('0x40')]));_0x4f83a0['where'][_0x47a8('0x4a')]=_0x4abf7a['id'];if(_0x21a6f0['query'][_0x47a8('0x36')]){_0x4f83a0[_0x47a8('0x34')]=_['merge'](_0x4f83a0['where'],{'$or':_[_0x47a8('0x24')](_0x4f83a0[_0x47a8('0x2d')],function(_0x560595){var _0x5e17fe={};_0x5e17fe[_0x560595]={'$like':'%'+_0x21a6f0[_0x47a8('0x2b')]['filter']+'%'};return _0x5e17fe;})});}_0x4f83a0=_[_0x47a8('0x41')]({},_0x4f83a0,_0x21a6f0[_0x47a8('0x38')]);return db[_0x47a8('0x47')][_0x47a8('0x39')]({'where':_0x4f83a0[_0x47a8('0x34')]})[_0x47a8('0x1e')](function(_0x1c2332){_0x352e96['count']=_0x1c2332;if(_0x21a6f0[_0x47a8('0x2b')]['includeAll']){_0x4f83a0[_0x47a8('0x3b')]=[{'all':!![]}];}return db[_0x47a8('0x47')][_0x47a8('0x3c')](_0x4f83a0);})[_0x47a8('0x1e')](function(_0x28995b){_0x352e96[_0x47a8('0x4b')]=_0x28995b;return _0x352e96;});}})[_0x47a8('0x1e')](respondWithFilteredResult(_0x24c693,_0x4f83a0))['catch'](handleError(_0x24c693,null));}; \ No newline at end of file +var _0x5526=['attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','error','name','send','map','JscriptySessionReport','rawAttributes','key','model','query','keys','filters','intersection'];(function(_0x3128f7,_0x5ec08a){var _0x5ce976=function(_0x463e28){while(--_0x463e28){_0x3128f7['push'](_0x3128f7['shift']());}};_0x5ce976(++_0x5ec08a);}(_0x5526,0x102));var _0x6552=function(_0x36a997,_0x288f0b){_0x36a997=_0x36a997-0x0;var _0x561b1b=_0x5526[_0x36a997];return _0x561b1b;};'use strict';var pdf=require(_0x6552('0x0'));var emlformat=require(_0x6552('0x1'));var rimraf=require(_0x6552('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6552('0x3'));var moment=require(_0x6552('0x4'));var BPromise=require(_0x6552('0x5'));var Mustache=require(_0x6552('0x6'));var util=require(_0x6552('0x7'));var path=require(_0x6552('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6552('0x9'));var fs=require('fs');var _=require(_0x6552('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6552('0xb'));var toCsv=require(_0x6552('0xc'));var querystring=require(_0x6552('0xd'));var Papa=require(_0x6552('0xe'));var Redis=require('ioredis');var authService=require(_0x6552('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6552('0x10'));var hardwareService=require(_0x6552('0x11'));var logger=require(_0x6552('0x12'))('api');var utils=require(_0x6552('0x13'));var config=require(_0x6552('0x14'));var db=require(_0x6552('0x15'))['db'];function respondWithStatusCode(_0xef40f7,_0x35fa8a){_0x35fa8a=_0x35fa8a||0xcc;return function(_0x4cb0c5){if(_0x4cb0c5){return _0xef40f7[_0x6552('0x16')](_0x35fa8a);}return _0xef40f7[_0x6552('0x17')](_0x35fa8a)[_0x6552('0x18')]();};}function respondWithResult(_0x614107,_0x359dd6){_0x359dd6=_0x359dd6||0xc8;return function(_0x5740ce){if(_0x5740ce){return _0x614107['status'](_0x359dd6)['json'](_0x5740ce);}};}function respondWithFilteredResult(_0xd47ce4,_0x38485e){return function(_0xd2f6c4){if(_0xd2f6c4){var _0x5116d9=_0xd2f6c4[_0x6552('0x19')],_0x4758a1=_0x38485e[_0x6552('0x1a')],_0x36b5ff=_0x38485e[_0x6552('0x1a')]+_0x38485e[_0x6552('0x1b')],_0x4e1405;if(_0x36b5ff>=_0x5116d9){_0x36b5ff=_0x5116d9;_0x4e1405=0xc8;}else{_0x4e1405=0xce;}_0xd47ce4[_0x6552('0x17')](_0x4e1405);return _0xd47ce4[_0x6552('0x1c')](_0x6552('0x1d'),_0x4758a1+'-'+_0x36b5ff+'/'+_0x5116d9)[_0x6552('0x1e')](_0xd2f6c4);}return null;};}function patchUpdates(_0x4459f6){return function(_0x5696e0){try{jsonpatch['apply'](_0x5696e0,_0x4459f6,!![]);}catch(_0x4eb4e1){return BPromise[_0x6552('0x1f')](_0x4eb4e1);}return _0x5696e0[_0x6552('0x20')]();};}function saveUpdates(_0x85c263,_0x2d53ae){return function(_0x48cc0e){if(_0x48cc0e){return _0x48cc0e['update'](_0x85c263)['then'](function(_0x531d52){return _0x531d52;});}return null;};}function removeEntity(_0x493cc6,_0x60d386){return function(_0x22c1b4){if(_0x22c1b4){return _0x22c1b4['destroy']()[_0x6552('0x21')](function(){_0x493cc6[_0x6552('0x17')](0xcc)[_0x6552('0x18')]();});}};}function handleEntityNotFound(_0x427632,_0x492fe9){return function(_0x49dda9){if(!_0x49dda9){_0x427632[_0x6552('0x16')](0x194);}return _0x49dda9;};}function handleError(_0xe10af2,_0x4fa138){_0x4fa138=_0x4fa138||0x1f4;return function(_0x27bdfa){logger[_0x6552('0x22')](_0x27bdfa['stack']);if(_0x27bdfa[_0x6552('0x23')]){delete _0x27bdfa['name'];}_0xe10af2[_0x6552('0x17')](_0x4fa138)[_0x6552('0x24')](_0x27bdfa);};}exports['index']=function(_0x3e1f44,_0x183749){var _0x508737={},_0xa3c3fc={},_0x520c0e={'count':0x0,'rows':[]};var _0x42464d=_[_0x6552('0x25')](db[_0x6552('0x26')][_0x6552('0x27')],function(_0x1bbad4){return{'name':_0x1bbad4['fieldName'],'type':_0x1bbad4['type'][_0x6552('0x28')]};});_0xa3c3fc[_0x6552('0x29')]=_['map'](_0x42464d,_0x6552('0x23'));_0xa3c3fc[_0x6552('0x2a')]=_[_0x6552('0x2b')](_0x3e1f44['query']);_0xa3c3fc[_0x6552('0x2c')]=_[_0x6552('0x2d')](_0xa3c3fc[_0x6552('0x29')],_0xa3c3fc[_0x6552('0x2a')]);_0x508737[_0x6552('0x2e')]=_[_0x6552('0x2d')](_0xa3c3fc[_0x6552('0x29')],qs[_0x6552('0x2f')](_0x3e1f44['query'][_0x6552('0x2f')]));_0x508737['attributes']=_0x508737[_0x6552('0x2e')][_0x6552('0x30')]?_0x508737['attributes']:_0xa3c3fc['model'];if(!_0x3e1f44['query'][_0x6552('0x31')](_0x6552('0x32'))){_0x508737['limit']=qs['limit'](_0x3e1f44[_0x6552('0x2a')][_0x6552('0x1b')]);_0x508737[_0x6552('0x1a')]=qs[_0x6552('0x1a')](_0x3e1f44[_0x6552('0x2a')]['offset']);}_0x508737['order']=qs['sort'](_0x3e1f44[_0x6552('0x2a')][_0x6552('0x33')]);_0x508737['where']=qs[_0x6552('0x2c')](_[_0x6552('0x34')](_0x3e1f44[_0x6552('0x2a')],_0xa3c3fc[_0x6552('0x2c')]),_0x42464d);if(_0x3e1f44[_0x6552('0x2a')]['filter']){_0x508737['where']=_[_0x6552('0x35')](_0x508737[_0x6552('0x36')],{'$or':_[_0x6552('0x25')](_0x42464d,function(_0x3b898f){if(_0x3b898f[_0x6552('0x37')]!==_0x6552('0x38')){var _0x186526={};_0x186526[_0x3b898f[_0x6552('0x23')]]={'$like':'%'+_0x3e1f44['query'][_0x6552('0x39')]+'%'};return _0x186526;}})});}_0x508737=_['merge']({},_0x508737,_0x3e1f44[_0x6552('0x3a')]);var _0x139705={'where':_0x508737[_0x6552('0x36')]};return db[_0x6552('0x26')][_0x6552('0x19')](_0x139705)[_0x6552('0x21')](function(_0x15bb5f){_0x520c0e['count']=_0x15bb5f;if(_0x3e1f44['query'][_0x6552('0x3b')]){_0x508737[_0x6552('0x3c')]=[{'all':!![]}];}return db[_0x6552('0x26')][_0x6552('0x3d')](_0x508737);})[_0x6552('0x21')](function(_0x6c8635){_0x520c0e[_0x6552('0x3e')]=_0x6c8635;return _0x520c0e;})[_0x6552('0x21')](respondWithFilteredResult(_0x183749,_0x508737))[_0x6552('0x3f')](handleError(_0x183749,null));};exports[_0x6552('0x40')]=function(_0x41d7ad,_0x4ecac6){var _0x1dd2cf={'raw':!![],'where':{'id':_0x41d7ad[_0x6552('0x41')]['id']}},_0x1780c6={};_0x1780c6[_0x6552('0x29')]=_[_0x6552('0x2b')](db['JscriptySessionReport'][_0x6552('0x27')]);_0x1780c6[_0x6552('0x2a')]=_[_0x6552('0x2b')](_0x41d7ad[_0x6552('0x2a')]);_0x1780c6[_0x6552('0x2c')]=_[_0x6552('0x2d')](_0x1780c6['model'],_0x1780c6[_0x6552('0x2a')]);_0x1dd2cf[_0x6552('0x2e')]=_[_0x6552('0x2d')](_0x1780c6[_0x6552('0x29')],qs['fields'](_0x41d7ad[_0x6552('0x2a')][_0x6552('0x2f')]));_0x1dd2cf[_0x6552('0x2e')]=_0x1dd2cf['attributes'][_0x6552('0x30')]?_0x1dd2cf[_0x6552('0x2e')]:_0x1780c6['model'];if(_0x41d7ad[_0x6552('0x2a')][_0x6552('0x3b')]){_0x1dd2cf[_0x6552('0x3c')]=[{'all':!![]}];}_0x1dd2cf=_[_0x6552('0x35')]({},_0x1dd2cf,_0x41d7ad[_0x6552('0x3a')]);return db['JscriptySessionReport']['find'](_0x1dd2cf)['then'](handleEntityNotFound(_0x4ecac6,null))['then'](respondWithResult(_0x4ecac6,null))[_0x6552('0x3f')](handleError(_0x4ecac6,null));};exports[_0x6552('0x42')]=function(_0x51941f,_0x18c8ce){return db['JscriptySessionReport'][_0x6552('0x42')](_0x51941f[_0x6552('0x43')],{})[_0x6552('0x21')](respondWithResult(_0x18c8ce,0xc9))[_0x6552('0x3f')](handleError(_0x18c8ce,null));};exports[_0x6552('0x44')]=function(_0x1b2307,_0x46a6a3){if(_0x1b2307['body']['id']){delete _0x1b2307[_0x6552('0x43')]['id'];}return db['JscriptySessionReport'][_0x6552('0x45')]({'where':{'id':_0x1b2307[_0x6552('0x41')]['id']}})['then'](handleEntityNotFound(_0x46a6a3,null))[_0x6552('0x21')](saveUpdates(_0x1b2307[_0x6552('0x43')],null))[_0x6552('0x21')](respondWithResult(_0x46a6a3,null))[_0x6552('0x3f')](handleError(_0x46a6a3,null));};exports['destroy']=function(_0xbac3e8,_0x32a838){return db[_0x6552('0x26')][_0x6552('0x45')]({'where':{'id':_0xbac3e8[_0x6552('0x41')]['id']}})[_0x6552('0x21')](handleEntityNotFound(_0x32a838,null))[_0x6552('0x21')](removeEntity(_0x32a838,null))['catch'](handleError(_0x32a838,null));};exports[_0x6552('0x46')]=function(_0x3966db,_0x109d08){return db['JscriptySessionReport']['describe']()[_0x6552('0x21')](respondWithResult(_0x109d08,null))[_0x6552('0x3f')](handleError(_0x109d08,null));};exports[_0x6552('0x47')]=function(_0x28b75a,_0x356cb3,_0x35b625){var _0x1baea8={'raw':!![],'where':{}};var _0x25e41b={};var _0x17e9b8={'count':0x0,'rows':[]};return db[_0x6552('0x26')][_0x6552('0x48')]({'where':{'id':_0x28b75a[_0x6552('0x41')]['id']}})[_0x6552('0x21')](handleEntityNotFound(_0x356cb3,null))[_0x6552('0x21')](function(_0x1fbe1e){if(_0x1fbe1e){_0x25e41b[_0x6552('0x29')]=_['keys'](db[_0x6552('0x49')][_0x6552('0x27')]);_0x25e41b[_0x6552('0x2a')]=_[_0x6552('0x2b')](_0x28b75a[_0x6552('0x2a')]);_0x25e41b[_0x6552('0x2c')]=_[_0x6552('0x2d')](_0x25e41b[_0x6552('0x29')],_0x25e41b[_0x6552('0x2a')]);_0x1baea8[_0x6552('0x2e')]=_[_0x6552('0x2d')](_0x25e41b[_0x6552('0x29')],qs[_0x6552('0x2f')](_0x28b75a[_0x6552('0x2a')][_0x6552('0x2f')]));_0x1baea8[_0x6552('0x2e')]=_0x1baea8[_0x6552('0x2e')][_0x6552('0x30')]?_0x1baea8[_0x6552('0x2e')]:_0x25e41b[_0x6552('0x29')];if(!_0x28b75a[_0x6552('0x2a')]['hasOwnProperty'](_0x6552('0x32'))){_0x1baea8['limit']=qs[_0x6552('0x1b')](_0x28b75a[_0x6552('0x2a')][_0x6552('0x1b')]);_0x1baea8['offset']=qs[_0x6552('0x1a')](_0x28b75a[_0x6552('0x2a')][_0x6552('0x1a')]);}_0x1baea8[_0x6552('0x4a')]=qs['sort'](_0x28b75a['query'][_0x6552('0x33')]);_0x1baea8[_0x6552('0x36')]=qs[_0x6552('0x2c')](_[_0x6552('0x34')](_0x28b75a[_0x6552('0x2a')],_0x25e41b[_0x6552('0x2c')]));_0x1baea8['where'][_0x6552('0x4b')]=_0x1fbe1e['id'];if(_0x28b75a['query'][_0x6552('0x39')]){_0x1baea8['where']=_['merge'](_0x1baea8[_0x6552('0x36')],{'$or':_[_0x6552('0x25')](_0x1baea8['attributes'],function(_0xd4a6b0){var _0x32f305={};_0x32f305[_0xd4a6b0]={'$like':'%'+_0x28b75a[_0x6552('0x2a')][_0x6552('0x39')]+'%'};return _0x32f305;})});}_0x1baea8=_['merge']({},_0x1baea8,_0x28b75a['options']);return db['JscriptyQuestionReport'][_0x6552('0x19')]({'where':_0x1baea8[_0x6552('0x36')]})[_0x6552('0x21')](function(_0x158402){_0x17e9b8[_0x6552('0x19')]=_0x158402;if(_0x28b75a['query'][_0x6552('0x3b')]){_0x1baea8['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6552('0x3d')](_0x1baea8);})[_0x6552('0x21')](function(_0x457627){_0x17e9b8[_0x6552('0x3e')]=_0x457627;return _0x17e9b8;});}})['then'](respondWithFilteredResult(_0x356cb3,_0x1baea8))['catch'](handleError(_0x356cb3,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c9e6115..42f8fae 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 _0x28ca=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x46af62,_0x22051f){var _0x26ad4d=function(_0x4ac1fc){while(--_0x4ac1fc){_0x46af62['push'](_0x46af62['shift']());}};_0x26ad4d(++_0x22051f);}(_0x28ca,0x18a));var _0xa28c=function(_0x522398,_0x40b665){_0x522398=_0x522398-0x0;var _0x29e158=_0x28ca[_0x522398];return _0x29e158;};'use strict';var _=require(_0xa28c('0x0'));var util=require(_0xa28c('0x1'));var logger=require(_0xa28c('0x2'))(_0xa28c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa28c('0x4'));var fs=require('fs');var path=require(_0xa28c('0x5'));var rimraf=require(_0xa28c('0x6'));var config=require(_0xa28c('0x7'));var attributes=require(_0xa28c('0x8'));module[_0xa28c('0x9')]=function(_0x31c26a,_0x2756d7){return _0x31c26a['define'](_0xa28c('0xa'),attributes,{'tableName':_0xa28c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb270=['api','request-promise','path','../../config/environment','exports','define','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x3cf31d,_0x173e29){var _0x4e5878=function(_0x342df0){while(--_0x342df0){_0x3cf31d['push'](_0x3cf31d['shift']());}};_0x4e5878(++_0x173e29);}(_0xb270,0xd6));var _0x0b27=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0xb270[_0x456032];return _0x1a53cd;};'use strict';var _=require(_0x0b27('0x0'));var util=require('util');var logger=require(_0x0b27('0x1'))(_0x0b27('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b27('0x3'));var fs=require('fs');var path=require(_0x0b27('0x4'));var rimraf=require('rimraf');var config=require(_0x0b27('0x5'));var attributes=require('./jscriptySessionReport.attributes');module[_0x0b27('0x6')]=function(_0x4a8b44,_0x5f1f27){return _0x4a8b44[_0x0b27('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x0b27('0x8'),'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 49ac9fe..de3ef4b 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 _0x8c45=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9eafd4,_0x6c31df){var _0x390716=function(_0x3023cc){while(--_0x3023cc){_0x9eafd4['push'](_0x9eafd4['shift']());}};_0x390716(++_0x6c31df);}(_0x8c45,0x7c));var _0x58c4=function(_0x1d9458,_0x204ce3){_0x1d9458=_0x1d9458-0x0;var _0x46726a=_0x8c45[_0x1d9458];return _0x46726a;};'use strict';var _=require(_0x58c4('0x0'));var util=require(_0x58c4('0x1'));var moment=require(_0x58c4('0x2'));var BPromise=require(_0x58c4('0x3'));var rs=require(_0x58c4('0x4'));var fs=require('fs');var Redis=require(_0x58c4('0x5'));var db=require(_0x58c4('0x6'))['db'];var utils=require(_0x58c4('0x7'));var logger=require('../../config/logger')(_0x58c4('0x8'));var config=require(_0x58c4('0x9'));var jayson=require(_0x58c4('0xa'));var client=jayson[_0x58c4('0xb')][_0x58c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17e027,_0x1834a8,_0x56a8d3){return new BPromise(function(_0x5cad16,_0x2e0bb6){return client[_0x58c4('0xd')](_0x17e027,_0x56a8d3)['then'](function(_0x375a87){logger[_0x58c4('0xe')](_0x58c4('0xf'),_0x1834a8,_0x58c4('0x10'));logger[_0x58c4('0x11')](_0x58c4('0x12'),_0x1834a8,'request\x20sent',JSON[_0x58c4('0x13')](_0x375a87));if(_0x375a87['error']){if(_0x375a87[_0x58c4('0x14')][_0x58c4('0x15')]===0x1f4){logger[_0x58c4('0x14')]('JscriptySessionReport,\x20%s,\x20%s',_0x1834a8,_0x375a87[_0x58c4('0x14')][_0x58c4('0x16')]);return _0x2e0bb6(_0x375a87[_0x58c4('0x14')][_0x58c4('0x16')]);}logger[_0x58c4('0x14')](_0x58c4('0xf'),_0x1834a8,_0x375a87[_0x58c4('0x14')]['message']);return _0x5cad16(_0x375a87[_0x58c4('0x14')][_0x58c4('0x16')]);}else{logger[_0x58c4('0xe')](_0x58c4('0xf'),_0x1834a8,_0x58c4('0x10'));_0x5cad16(_0x375a87[_0x58c4('0x17')][_0x58c4('0x16')]);}})['catch'](function(_0x46bda9){logger['error'](_0x58c4('0xf'),_0x1834a8,_0x46bda9);_0x2e0bb6(_0x46bda9);});});} \ No newline at end of file +var _0x6c56=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x6c56,0x1af));var _0x66c5=function(_0x41ed37,_0xbcd1d4){_0x41ed37=_0x41ed37-0x0;var _0x13f7ea=_0x6c56[_0x41ed37];return _0x13f7ea;};'use strict';var _=require(_0x66c5('0x0'));var util=require(_0x66c5('0x1'));var moment=require(_0x66c5('0x2'));var BPromise=require(_0x66c5('0x3'));var rs=require(_0x66c5('0x4'));var fs=require('fs');var Redis=require(_0x66c5('0x5'));var db=require(_0x66c5('0x6'))['db'];var utils=require(_0x66c5('0x7'));var logger=require('../../config/logger')(_0x66c5('0x8'));var config=require(_0x66c5('0x9'));var jayson=require(_0x66c5('0xa'));var client=jayson['client'][_0x66c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dc4e3,_0x1a0808,_0x23debe){return new BPromise(function(_0x157683,_0x48b564){return client[_0x66c5('0xc')](_0x5dc4e3,_0x23debe)[_0x66c5('0xd')](function(_0x94c27d){logger[_0x66c5('0xe')](_0x66c5('0xf'),_0x1a0808,_0x66c5('0x10'));logger[_0x66c5('0x11')](_0x66c5('0x12'),_0x1a0808,_0x66c5('0x10'),JSON[_0x66c5('0x13')](_0x94c27d));if(_0x94c27d[_0x66c5('0x14')]){if(_0x94c27d['error'][_0x66c5('0x15')]===0x1f4){logger[_0x66c5('0x14')](_0x66c5('0xf'),_0x1a0808,_0x94c27d[_0x66c5('0x14')][_0x66c5('0x16')]);return _0x48b564(_0x94c27d[_0x66c5('0x14')][_0x66c5('0x16')]);}logger[_0x66c5('0x14')](_0x66c5('0xf'),_0x1a0808,_0x94c27d[_0x66c5('0x14')][_0x66c5('0x16')]);return _0x157683(_0x94c27d[_0x66c5('0x14')]['message']);}else{logger[_0x66c5('0xe')](_0x66c5('0xf'),_0x1a0808,_0x66c5('0x10'));_0x157683(_0x94c27d[_0x66c5('0x17')]['message']);}})[_0x66c5('0x18')](function(_0x4dff38){logger[_0x66c5('0x14')]('JscriptySessionReport,\x20%s,\x20%s',_0x1a0808,_0x4dff38);_0x48b564(_0x4dff38);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index dffb14c..63275a4 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 _0xc9c8=['isAuthenticated','update','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','index','put','/:id'];(function(_0x4266b4,_0x4859ad){var _0x1442aa=function(_0x21f8c1){while(--_0x21f8c1){_0x4266b4['push'](_0x4266b4['shift']());}};_0x1442aa(++_0x4859ad);}(_0xc9c8,0x9d));var _0x8c9c=function(_0x2bd602,_0x451928){_0x2bd602=_0x2bd602-0x0;var _0x2b4e71=_0xc9c8[_0x2bd602];return _0x2b4e71;};'use strict';var multer=require(_0x8c9c('0x0'));var util=require('util');var path=require(_0x8c9c('0x1'));var timeout=require(_0x8c9c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8c9c('0x3'));var interaction=require(_0x8c9c('0x4'));var config=require('../../config/environment');var controller=require('./license.controller');router['get']('/',controller[_0x8c9c('0x5')]);router[_0x8c9c('0x6')](_0x8c9c('0x7'),auth[_0x8c9c('0x8')](),controller[_0x8c9c('0x9')]);module[_0x8c9c('0xa')]=router; \ No newline at end of file +var _0x7572=['update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x2d1ebd,_0x5526aa){var _0x2079fd=function(_0x59012c){while(--_0x59012c){_0x2d1ebd['push'](_0x2d1ebd['shift']());}};_0x2079fd(++_0x5526aa);}(_0x7572,0x188));var _0x2757=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x7572[_0x623e7];return _0x121131;};'use strict';var multer=require('multer');var util=require(_0x2757('0x0'));var path=require(_0x2757('0x1'));var timeout=require(_0x2757('0x2'));var express=require(_0x2757('0x3'));var router=express[_0x2757('0x4')]();var auth=require(_0x2757('0x5'));var interaction=require(_0x2757('0x6'));var config=require(_0x2757('0x7'));var controller=require('./license.controller');router[_0x2757('0x8')]('/',controller['index']);router['put'](_0x2757('0x9'),auth[_0x2757('0xa')](),controller[_0x2757('0xb')]);module[_0x2757('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 9dca61f..3495842 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(_0x8033b7,_0x399fef){var _0x3477d4=function(_0x25436f){while(--_0x25436f){_0x8033b7['push'](_0x8033b7['shift']());}};_0x3477d4(++_0x399fef);}(_0x5fc3,0xa8));var _0x35fc=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x5fc3[_0x422be2];return _0x1b820e;};'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(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x524e,0x15e));var _0xe524=function(_0x339123,_0x38253b){_0x339123=_0x339123-0x0;var _0x342467=_0x524e[_0x339123];return _0x342467;};'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 9a5c1e7..a4a25da 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 _0x70f5=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','../../config/license/util','model','keys','License','query','filters','intersection','fields','merge','options','getLicense','catch','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x468cce,_0x29dabd){var _0xabfe0b=function(_0x2f7a61){while(--_0x2f7a61){_0x468cce['push'](_0x468cce['shift']());}};_0xabfe0b(++_0x29dabd);}(_0x70f5,0x69));var _0x570f=function(_0x4facd4,_0x28a0b7){_0x4facd4=_0x4facd4-0x0;var _0xc1cadd=_0x70f5[_0x4facd4];return _0xc1cadd;};'use strict';var pdf=require(_0x570f('0x0'));var emlformat=require(_0x570f('0x1'));var rimraf=require(_0x570f('0x2'));var zipdir=require(_0x570f('0x3'));var jsonpatch=require(_0x570f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x570f('0x5'));var path=require(_0x570f('0x6'));var sox=require('sox');var csv=require(_0x570f('0x7'));var ejs=require(_0x570f('0x8'));var fs=require('fs');var _=require(_0x570f('0x9'));var squel=require(_0x570f('0xa'));var crypto=require(_0x570f('0xb'));var jsforce=require(_0x570f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x570f('0xd'));var Papa=require('papaparse');var Redis=require(_0x570f('0xe'));var authService=require(_0x570f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x570f('0x10'));var hardwareService=require(_0x570f('0x11'));var logger=require(_0x570f('0x12'))('api');var utils=require(_0x570f('0x13'));var config=require(_0x570f('0x14'));var db=require(_0x570f('0x15'))['db'];function respondWithStatusCode(_0x93bb3,_0x672326){_0x672326=_0x672326||0xcc;return function(_0x108a1c){if(_0x108a1c){return _0x93bb3[_0x570f('0x16')](_0x672326);}return _0x93bb3['status'](_0x672326)[_0x570f('0x17')]();};}function respondWithResult(_0x4a9f81,_0x395bec){_0x395bec=_0x395bec||0xc8;return function(_0x575313){if(_0x575313){return _0x4a9f81[_0x570f('0x18')](_0x395bec)[_0x570f('0x19')](_0x575313);}};}function respondWithFilteredResult(_0x44b759,_0x2bfb62){return function(_0x2cd2ee){if(_0x2cd2ee){var _0xcd2bdc=_0x2cd2ee[_0x570f('0x1a')],_0x659d93=_0x2bfb62[_0x570f('0x1b')],_0x4ca302=_0x2bfb62['offset']+_0x2bfb62[_0x570f('0x1c')],_0x1937bb;if(_0x4ca302>=_0xcd2bdc){_0x4ca302=_0xcd2bdc;_0x1937bb=0xc8;}else{_0x1937bb=0xce;}_0x44b759['status'](_0x1937bb);return _0x44b759[_0x570f('0x1d')](_0x570f('0x1e'),_0x659d93+'-'+_0x4ca302+'/'+_0xcd2bdc)[_0x570f('0x19')](_0x2cd2ee);}return null;};}function patchUpdates(_0x7e25ad){return function(_0x387d66){try{jsonpatch['apply'](_0x387d66,_0x7e25ad,!![]);}catch(_0x1bc724){return BPromise[_0x570f('0x1f')](_0x1bc724);}return _0x387d66[_0x570f('0x20')]();};}function saveUpdates(_0x8d76bf,_0x5c94e0){return function(_0x21b481){if(_0x21b481){return _0x21b481[_0x570f('0x21')](_0x8d76bf)[_0x570f('0x22')](function(_0xa5c892){return _0xa5c892;});}return null;};}function removeEntity(_0x28f222,_0x5a0292){return function(_0x1cbc87){if(_0x1cbc87){return _0x1cbc87[_0x570f('0x23')]()[_0x570f('0x22')](function(){_0x28f222[_0x570f('0x18')](0xcc)[_0x570f('0x17')]();});}};}function handleEntityNotFound(_0x135128,_0x590269){return function(_0x37b8af){if(!_0x37b8af){_0x135128['sendStatus'](0x194);}return _0x37b8af;};}function handleError(_0x4ffc71,_0x2d550a){_0x2d550a=_0x2d550a||0x1f4;return function(_0x370596){logger[_0x570f('0x24')](_0x370596[_0x570f('0x25')]);if(_0x370596[_0x570f('0x26')]){delete _0x370596[_0x570f('0x26')];}_0x4ffc71[_0x570f('0x18')](_0x2d550a)[_0x570f('0x27')](_0x370596);};}var utilLicense=require(_0x570f('0x28'));exports['index']=function(_0x1d4265,_0x3686c2){var _0x2118e3={'raw':!![],'where':{'id':0x1}},_0x2ab2b6={};_0x2ab2b6[_0x570f('0x29')]=_[_0x570f('0x2a')](db[_0x570f('0x2b')]['rawAttributes']);_0x2ab2b6[_0x570f('0x2c')]=_[_0x570f('0x2a')](_0x1d4265[_0x570f('0x2c')]);_0x2ab2b6[_0x570f('0x2d')]=_[_0x570f('0x2e')](_0x2ab2b6['model'],_0x2ab2b6['query']);_0x2118e3['attributes']=_[_0x570f('0x2e')](_0x2ab2b6[_0x570f('0x29')],qs['fields'](_0x1d4265[_0x570f('0x2c')][_0x570f('0x2f')]));_0x2118e3['attributes']=_0x2118e3['attributes']['length']?_0x2118e3['attributes']:_0x2ab2b6[_0x570f('0x29')];_0x2118e3=_[_0x570f('0x30')]({},_0x2118e3,_0x1d4265[_0x570f('0x31')]);return utilLicense[_0x570f('0x32')](_0x2118e3)['then'](respondWithResult(_0x3686c2,null))[_0x570f('0x33')](handleError(_0x3686c2,null));};exports[_0x570f('0x21')]=function(_0x100cae,_0x3f66a2){if(_0x100cae[_0x570f('0x34')]['id']){delete _0x100cae[_0x570f('0x34')]['id'];}return db[_0x570f('0x2b')][_0x570f('0x35')]({'where':{'id':_0x100cae[_0x570f('0x36')]['id']}})[_0x570f('0x22')](handleEntityNotFound(_0x3f66a2,null))[_0x570f('0x22')](function(_0x1b471b){var _0x235d4c=_0x1b471b['get']({'plain':!![]});return utilLicense['checkLicense'](_0x235d4c,_0x100cae[_0x570f('0x34')]['key']);})['then'](function(_0x5e9092){if(!_0x5e9092['demo']){return saveUpdates(_0x100cae[_0x570f('0x34')],null);}return _0x5e9092;})[_0x570f('0x22')](respondWithResult(_0x3f66a2,null))['catch'](handleError(_0x3f66a2,null));}; \ No newline at end of file +var _0xafeb=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','save','update','then','error','stack','name','index','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','getLicense','catch','body','find','params','get','checkLicense','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xafeb,0x1bb));var _0xbafe=function(_0x582a4f,_0x488986){_0x582a4f=_0x582a4f-0x0;var _0x1325d5=_0xafeb[_0x582a4f];return _0x1325d5;};'use strict';var pdf=require(_0xbafe('0x0'));var emlformat=require(_0xbafe('0x1'));var rimraf=require(_0xbafe('0x2'));var zipdir=require(_0xbafe('0x3'));var jsonpatch=require(_0xbafe('0x4'));var rp=require(_0xbafe('0x5'));var moment=require('moment');var BPromise=require(_0xbafe('0x6'));var Mustache=require(_0xbafe('0x7'));var util=require('util');var path=require(_0xbafe('0x8'));var sox=require(_0xbafe('0x9'));var csv=require(_0xbafe('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbafe('0xb'));var crypto=require(_0xbafe('0xc'));var jsforce=require(_0xbafe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbafe('0xa'));var querystring=require(_0xbafe('0xe'));var Papa=require(_0xbafe('0xf'));var Redis=require(_0xbafe('0x10'));var authService=require(_0xbafe('0x11'));var qs=require(_0xbafe('0x12'));var as=require(_0xbafe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbafe('0x14'))(_0xbafe('0x15'));var utils=require(_0xbafe('0x16'));var config=require(_0xbafe('0x17'));var db=require(_0xbafe('0x18'))['db'];function respondWithStatusCode(_0x501698,_0x38a85f){_0x38a85f=_0x38a85f||0xcc;return function(_0x252dd5){if(_0x252dd5){return _0x501698[_0xbafe('0x19')](_0x38a85f);}return _0x501698['status'](_0x38a85f)[_0xbafe('0x1a')]();};}function respondWithResult(_0x3dd9f8,_0x1d55cc){_0x1d55cc=_0x1d55cc||0xc8;return function(_0x5f2754){if(_0x5f2754){return _0x3dd9f8[_0xbafe('0x1b')](_0x1d55cc)[_0xbafe('0x1c')](_0x5f2754);}};}function respondWithFilteredResult(_0x3c726d,_0x59b1cb){return function(_0x272820){if(_0x272820){var _0x589396=_0x272820['count'],_0x24e60e=_0x59b1cb[_0xbafe('0x1d')],_0x17a3e2=_0x59b1cb['offset']+_0x59b1cb[_0xbafe('0x1e')],_0x5c266b;if(_0x17a3e2>=_0x589396){_0x17a3e2=_0x589396;_0x5c266b=0xc8;}else{_0x5c266b=0xce;}_0x3c726d[_0xbafe('0x1b')](_0x5c266b);return _0x3c726d[_0xbafe('0x1f')](_0xbafe('0x20'),_0x24e60e+'-'+_0x17a3e2+'/'+_0x589396)[_0xbafe('0x1c')](_0x272820);}return null;};}function patchUpdates(_0x85c24d){return function(_0x9b57db){try{jsonpatch['apply'](_0x9b57db,_0x85c24d,!![]);}catch(_0x206082){return BPromise['reject'](_0x206082);}return _0x9b57db[_0xbafe('0x21')]();};}function saveUpdates(_0x14fbc8,_0x754c2f){return function(_0x1d1882){if(_0x1d1882){return _0x1d1882[_0xbafe('0x22')](_0x14fbc8)[_0xbafe('0x23')](function(_0x421209){return _0x421209;});}return null;};}function removeEntity(_0x35db7d,_0x145f02){return function(_0x3fff94){if(_0x3fff94){return _0x3fff94['destroy']()[_0xbafe('0x23')](function(){_0x35db7d['status'](0xcc)[_0xbafe('0x1a')]();});}};}function handleEntityNotFound(_0x2efe30,_0x5a7d5f){return function(_0x7d14e7){if(!_0x7d14e7){_0x2efe30[_0xbafe('0x19')](0x194);}return _0x7d14e7;};}function handleError(_0x3c35d7,_0x504da7){_0x504da7=_0x504da7||0x1f4;return function(_0x1a7cda){logger[_0xbafe('0x24')](_0x1a7cda[_0xbafe('0x25')]);if(_0x1a7cda[_0xbafe('0x26')]){delete _0x1a7cda[_0xbafe('0x26')];}_0x3c35d7[_0xbafe('0x1b')](_0x504da7)['send'](_0x1a7cda);};}var utilLicense=require('../../config/license/util');exports[_0xbafe('0x27')]=function(_0x18205f,_0x145b46){var _0x2e4d12={'raw':!![],'where':{'id':0x1}},_0xbd7f8e={};_0xbd7f8e[_0xbafe('0x28')]=_['keys'](db[_0xbafe('0x29')][_0xbafe('0x2a')]);_0xbd7f8e[_0xbafe('0x2b')]=_[_0xbafe('0x2c')](_0x18205f['query']);_0xbd7f8e[_0xbafe('0x2d')]=_[_0xbafe('0x2e')](_0xbd7f8e[_0xbafe('0x28')],_0xbd7f8e[_0xbafe('0x2b')]);_0x2e4d12[_0xbafe('0x2f')]=_['intersection'](_0xbd7f8e[_0xbafe('0x28')],qs['fields'](_0x18205f[_0xbafe('0x2b')][_0xbafe('0x30')]));_0x2e4d12[_0xbafe('0x2f')]=_0x2e4d12[_0xbafe('0x2f')][_0xbafe('0x31')]?_0x2e4d12[_0xbafe('0x2f')]:_0xbd7f8e[_0xbafe('0x28')];_0x2e4d12=_['merge']({},_0x2e4d12,_0x18205f['options']);return utilLicense[_0xbafe('0x32')](_0x2e4d12)[_0xbafe('0x23')](respondWithResult(_0x145b46,null))[_0xbafe('0x33')](handleError(_0x145b46,null));};exports[_0xbafe('0x22')]=function(_0x548a05,_0x46950a){if(_0x548a05['body']['id']){delete _0x548a05[_0xbafe('0x34')]['id'];}return db[_0xbafe('0x29')][_0xbafe('0x35')]({'where':{'id':_0x548a05[_0xbafe('0x36')]['id']}})['then'](handleEntityNotFound(_0x46950a,null))[_0xbafe('0x23')](function(_0x1196be){var _0x2d5db8=_0x1196be[_0xbafe('0x37')]({'plain':!![]});return utilLicense[_0xbafe('0x38')](_0x2d5db8,_0x548a05[_0xbafe('0x34')]['key']);})[_0xbafe('0x23')](function(_0x5c24a1){if(!_0x5c24a1[_0xbafe('0x39')]){return saveUpdates(_0x548a05[_0xbafe('0x34')],null);}return _0x5c24a1;})[_0xbafe('0x23')](respondWithResult(_0x46950a,null))['catch'](handleError(_0x46950a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ac5de16..51ce79b 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 _0xb76d=['rimraf','../../config/environment','./license.attributes','define','License','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0xb76d,0x1cd));var _0xdb76=function(_0x3f0270,_0x185488){_0x3f0270=_0x3f0270-0x0;var _0x189c27=_0xb76d[_0x3f0270];return _0x189c27;};'use strict';var _=require('lodash');var util=require(_0xdb76('0x0'));var logger=require(_0xdb76('0x1'))(_0xdb76('0x2'));var moment=require(_0xdb76('0x3'));var BPromise=require(_0xdb76('0x4'));var rp=require(_0xdb76('0x5'));var fs=require('fs');var path=require(_0xdb76('0x6'));var rimraf=require(_0xdb76('0x7'));var config=require(_0xdb76('0x8'));var attributes=require(_0xdb76('0x9'));module['exports']=function(_0x23270d,_0x199c47){return _0x23270d[_0xdb76('0xa')](_0xdb76('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a05=['License','license','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5a05,0xce));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x55a0('0x0'));var util=require(_0x55a0('0x1'));var logger=require(_0x55a0('0x2'))(_0x55a0('0x3'));var moment=require(_0x55a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x55a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55a0('0x6'));var config=require(_0x55a0('0x7'));var attributes=require(_0x55a0('0x8'));module[_0x55a0('0x9')]=function(_0x29ae73,_0x40fd8d){return _0x29ae73['define'](_0x55a0('0xa'),attributes,{'tableName':_0x55a0('0xb'),'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 4d5df03..70b746d 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 _0x3c2c=['request\x20sent','error','code','message','License,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x4d34a7,_0x146390){var _0x171cc4=function(_0x1acb99){while(--_0x1acb99){_0x4d34a7['push'](_0x4d34a7['shift']());}};_0x171cc4(++_0x146390);}(_0x3c2c,0x160));var _0xc3c2=function(_0x13a21c,_0x4ce26d){_0x13a21c=_0x13a21c-0x0;var _0x2d4b9d=_0x3c2c[_0x13a21c];return _0x2d4b9d;};'use strict';var _=require(_0xc3c2('0x0'));var util=require(_0xc3c2('0x1'));var moment=require(_0xc3c2('0x2'));var BPromise=require(_0xc3c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3c2('0x4'))['db'];var utils=require(_0xc3c2('0x5'));var logger=require(_0xc3c2('0x6'))(_0xc3c2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc3c2('0x8'));var client=jayson[_0xc3c2('0x9')][_0xc3c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21fa50,_0xc36639,_0x48cab1){return new BPromise(function(_0x5daa76,_0x55840b){return client[_0xc3c2('0xb')](_0x21fa50,_0x48cab1)[_0xc3c2('0xc')](function(_0x5bf3d4){logger[_0xc3c2('0xd')]('License,\x20%s,\x20%s',_0xc36639,'request\x20sent');logger[_0xc3c2('0xe')](_0xc3c2('0xf'),_0xc36639,_0xc3c2('0x10'),JSON['stringify'](_0x5bf3d4));if(_0x5bf3d4[_0xc3c2('0x11')]){if(_0x5bf3d4[_0xc3c2('0x11')][_0xc3c2('0x12')]===0x1f4){logger[_0xc3c2('0x11')]('License,\x20%s,\x20%s',_0xc36639,_0x5bf3d4[_0xc3c2('0x11')][_0xc3c2('0x13')]);return _0x55840b(_0x5bf3d4['error'][_0xc3c2('0x13')]);}logger['error'](_0xc3c2('0x14'),_0xc36639,_0x5bf3d4['error'][_0xc3c2('0x13')]);return _0x5daa76(_0x5bf3d4['error'][_0xc3c2('0x13')]);}else{logger[_0xc3c2('0xd')]('License,\x20%s,\x20%s',_0xc36639,_0xc3c2('0x10'));_0x5daa76(_0x5bf3d4[_0xc3c2('0x15')][_0xc3c2('0x13')]);}})[_0xc3c2('0x16')](function(_0x342d4a){logger[_0xc3c2('0x11')]('License,\x20%s,\x20%s',_0xc36639,_0x342d4a);_0x55840b(_0x342d4a);});});} \ No newline at end of file +var _0x2242=['code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x591483,_0x2a82fb){var _0x31d6ea=function(_0x427f35){while(--_0x427f35){_0x591483['push'](_0x591483['shift']());}};_0x31d6ea(++_0x2a82fb);}(_0x2242,0x1a3));var _0x2224=function(_0x3be2ba,_0x5d2fff){_0x3be2ba=_0x3be2ba-0x0;var _0x445ff4=_0x2242[_0x3be2ba];return _0x445ff4;};'use strict';var _=require(_0x2224('0x0'));var util=require(_0x2224('0x1'));var moment=require(_0x2224('0x2'));var BPromise=require('bluebird');var rs=require(_0x2224('0x3'));var fs=require('fs');var Redis=require(_0x2224('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2224('0x5'));var logger=require(_0x2224('0x6'))('rpc');var config=require(_0x2224('0x7'));var jayson=require(_0x2224('0x8'));var client=jayson[_0x2224('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28833b,_0x16893c,_0x35f807){return new BPromise(function(_0x25c6d4,_0x18149e){return client[_0x2224('0xa')](_0x28833b,_0x35f807)[_0x2224('0xb')](function(_0x147bd7){logger[_0x2224('0xc')](_0x2224('0xd'),_0x16893c,_0x2224('0xe'));logger[_0x2224('0xf')](_0x2224('0x10'),_0x16893c,_0x2224('0xe'),JSON[_0x2224('0x11')](_0x147bd7));if(_0x147bd7['error']){if(_0x147bd7['error'][_0x2224('0x12')]===0x1f4){logger[_0x2224('0x13')](_0x2224('0xd'),_0x16893c,_0x147bd7[_0x2224('0x13')]['message']);return _0x18149e(_0x147bd7[_0x2224('0x13')][_0x2224('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x16893c,_0x147bd7[_0x2224('0x13')][_0x2224('0x14')]);return _0x25c6d4(_0x147bd7['error']['message']);}else{logger[_0x2224('0xc')](_0x2224('0xd'),_0x16893c,_0x2224('0xe'));_0x25c6d4(_0x147bd7[_0x2224('0x15')][_0x2224('0x14')]);}})[_0x2224('0x16')](function(_0x34d045){logger[_0x2224('0x13')]('License,\x20%s,\x20%s',_0x16893c,_0x34d045);_0x18149e(_0x34d045);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 74a8058..9ea7dd9 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 _0x049a=['show','getDispositions','/:id/canned_answers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','removeDispositions','delete','removeAnswers','removeImap','/:id/out_servers','removeSmtp','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x049a,0x129));var _0xa049=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x049a[_0x119280];return _0x481797;};'use strict';var multer=require(_0xa049('0x0'));var util=require(_0xa049('0x1'));var path=require('path');var timeout=require(_0xa049('0x2'));var express=require('express');var router=express[_0xa049('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa049('0x4'));var config=require('../../config/environment');var controller=require(_0xa049('0x5'));router['get']('/',auth[_0xa049('0x6')](),controller[_0xa049('0x7')]);router[_0xa049('0x8')](_0xa049('0x9'),auth[_0xa049('0x6')](),controller[_0xa049('0xa')]);router[_0xa049('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa049('0xb')]);router['get']('/:id/dispositions',auth[_0xa049('0x6')](),controller[_0xa049('0xc')]);router[_0xa049('0x8')](_0xa049('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xa049('0x8')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa049('0xe')]);router[_0xa049('0x8')]('/:id/out_servers',auth[_0xa049('0x6')](),controller['getSmtp']);router['get'](_0xa049('0xf'),auth[_0xa049('0x6')](),controller[_0xa049('0x10')]);router[_0xa049('0x8')](_0xa049('0x11'),auth['isAuthenticated'](),controller[_0xa049('0x12')]);router[_0xa049('0x8')]('/:id/messages',auth[_0xa049('0x6')](),controller['getMessages']);router[_0xa049('0x8')](_0xa049('0x13'),auth[_0xa049('0x6')](),controller[_0xa049('0x14')]);router['get'](_0xa049('0x15'),auth[_0xa049('0x6')](),controller[_0xa049('0x16')]);router['post'](_0xa049('0x17'),auth[_0xa049('0x6')](),controller[_0xa049('0x18')]);router[_0xa049('0x19')](_0xa049('0xd'),auth[_0xa049('0x6')](),controller[_0xa049('0x1a')]);router[_0xa049('0x19')]('/',auth[_0xa049('0x6')](),controller[_0xa049('0x1b')]);router[_0xa049('0x19')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa049('0x1c')]);router[_0xa049('0x19')]('/:id/out_servers',auth[_0xa049('0x6')](),controller[_0xa049('0x1d')]);router[_0xa049('0x19')](_0xa049('0xf'),auth[_0xa049('0x6')](),controller[_0xa049('0x1e')]);router[_0xa049('0x19')](_0xa049('0x11'),auth[_0xa049('0x6')](),controller[_0xa049('0x1f')]);router['post'](_0xa049('0x20'),auth[_0xa049('0x6')](),controller[_0xa049('0x21')]);router[_0xa049('0x19')](_0xa049('0x15'),auth[_0xa049('0x6')](),controller[_0xa049('0x22')]);router[_0xa049('0x23')](_0xa049('0x24'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa049('0x17'),auth[_0xa049('0x6')](),controller[_0xa049('0x25')]);router[_0xa049('0x26')](_0xa049('0xd'),auth[_0xa049('0x6')](),controller[_0xa049('0x27')]);router[_0xa049('0x26')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa049('0x28')]);router[_0xa049('0x26')](_0xa049('0x29'),auth[_0xa049('0x6')](),controller[_0xa049('0x2a')]);router[_0xa049('0x26')]('/:id',auth['isAuthenticated'](),controller[_0xa049('0x2b')]);router[_0xa049('0x26')](_0xa049('0x15'),auth[_0xa049('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xb64b=['removeAnswers','removeImap','removeSmtp','destroy','/:id/users','removeAgents','multer','path','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','post','addDisposition','/:id/canned_answers','create','addInteraction','addApplications','/:id/send','addAgents','put','update','delete'];(function(_0x23401f,_0xa23abb){var _0x11093f=function(_0xc42daa){while(--_0xc42daa){_0x23401f['push'](_0x23401f['shift']());}};_0x11093f(++_0xa23abb);}(_0xb64b,0xce));var _0xbb64=function(_0x31ad1e,_0x5fdfb8){_0x31ad1e=_0x31ad1e-0x0;var _0x21215c=_0xb64b[_0x31ad1e];return _0x21215c;};'use strict';var multer=require(_0xbb64('0x0'));var util=require('util');var path=require(_0xbb64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbb64('0x2'));var router=express[_0xbb64('0x3')]();var auth=require(_0xbb64('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0xbb64('0x5')]('/',auth[_0xbb64('0x6')](),controller[_0xbb64('0x7')]);router[_0xbb64('0x5')](_0xbb64('0x8'),auth[_0xbb64('0x6')](),controller[_0xbb64('0x9')]);router[_0xbb64('0x5')](_0xbb64('0xa'),auth[_0xbb64('0x6')](),controller[_0xbb64('0xb')]);router[_0xbb64('0x5')](_0xbb64('0xc'),auth[_0xbb64('0x6')](),controller['getDispositions']);router[_0xbb64('0x5')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbb64('0xd')]);router[_0xbb64('0x5')](_0xbb64('0xe'),auth[_0xbb64('0x6')](),controller['getImap']);router[_0xbb64('0x5')](_0xbb64('0xf'),auth[_0xbb64('0x6')](),controller[_0xbb64('0x10')]);router['get'](_0xbb64('0x11'),auth['isAuthenticated'](),controller[_0xbb64('0x12')]);router[_0xbb64('0x5')](_0xbb64('0x13'),auth[_0xbb64('0x6')](),controller[_0xbb64('0x14')]);router[_0xbb64('0x5')](_0xbb64('0x15'),auth[_0xbb64('0x6')](),controller['getMessages']);router['get']('/:id/verify',auth[_0xbb64('0x6')](),controller[_0xbb64('0x16')]);router[_0xbb64('0x5')]('/:id/users',auth[_0xbb64('0x6')](),controller['getAgents']);router[_0xbb64('0x17')](_0xbb64('0xc'),auth[_0xbb64('0x6')](),controller[_0xbb64('0x18')]);router[_0xbb64('0x17')](_0xbb64('0x19'),auth[_0xbb64('0x6')](),controller['addAnswer']);router[_0xbb64('0x17')]('/',auth[_0xbb64('0x6')](),controller[_0xbb64('0x1a')]);router[_0xbb64('0x17')](_0xbb64('0xe'),auth[_0xbb64('0x6')](),controller['addImap']);router[_0xbb64('0x17')](_0xbb64('0xf'),auth[_0xbb64('0x6')](),controller['addSmtp']);router[_0xbb64('0x17')](_0xbb64('0x11'),auth[_0xbb64('0x6')](),controller[_0xbb64('0x1b')]);router[_0xbb64('0x17')](_0xbb64('0x13'),auth[_0xbb64('0x6')](),controller[_0xbb64('0x1c')]);router[_0xbb64('0x17')](_0xbb64('0x1d'),auth['isAuthenticated'](),controller['send']);router[_0xbb64('0x17')]('/:id/users',auth[_0xbb64('0x6')](),controller[_0xbb64('0x1e')]);router[_0xbb64('0x1f')](_0xbb64('0xa'),auth['isAuthenticated'](),controller[_0xbb64('0x20')]);router['delete'](_0xbb64('0xc'),auth[_0xbb64('0x6')](),controller['removeDispositions']);router[_0xbb64('0x21')](_0xbb64('0x19'),auth['isAuthenticated'](),controller[_0xbb64('0x22')]);router[_0xbb64('0x21')](_0xbb64('0xe'),auth['isAuthenticated'](),controller[_0xbb64('0x23')]);router['delete']('/:id/out_servers',auth[_0xbb64('0x6')](),controller[_0xbb64('0x24')]);router[_0xbb64('0x21')]('/:id',auth[_0xbb64('0x6')](),controller[_0xbb64('0x25')]);router['delete'](_0xbb64('0x26'),auth['isAuthenticated'](),controller[_0xbb64('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 010f324..f06d20e 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 _0xb46b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4de74b,_0x2c5adc){var _0x3ad39b=function(_0x44f244){while(--_0x44f244){_0x4de74b['push'](_0x4de74b['shift']());}};_0x3ad39b(++_0x2c5adc);}(_0xb46b,0x121));var _0xbb46=function(_0x2087ba,_0x187343){_0x2087ba=_0x2087ba-0x0;var _0xa550ed=_0xb46b[_0x2087ba];return _0xa550ed;};'use strict';var Sequelize=require(_0xbb46('0x0'));module[_0xbb46('0x1')]={'description':{'type':Sequelize[_0xbb46('0x2')]},'name':{'type':Sequelize[_0xbb46('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xbb46('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xbb46('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xbb46('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xbb46('0x4')]},'markAsUnread':{'type':Sequelize[_0xbb46('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xbb46('0x2')],'allowNull':![],'defaultValue':_0xbb46('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xbb46('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbb46('0x4')],'defaultValue':function(){return _0xbb46('0x7');}},'notificationSound':{'type':Sequelize[_0xbb46('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbb46('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbb46('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb46('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb46('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbb46('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb46('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xbb46('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xbb46('0x3')],'defaultValue':![],'comment':_0xbb46('0xa'),'set':function(_0x5e2fc1){if(!_0x5e2fc1)this[_0xbb46('0xb')]('mandatoryDispositionPauseId',null);this[_0xbb46('0xb')](_0xbb46('0xc'),_0x5e2fc1);}}}; \ No newline at end of file +var _0xe367=['UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','STRING','BOOLEAN','TEXT','INTEGER'];(function(_0x37f467,_0x37cb08){var _0x5b0273=function(_0x4319ca){while(--_0x4319ca){_0x37f467['push'](_0x37f467['shift']());}};_0x5b0273(++_0x37cb08);}(_0xe367,0x1f3));var _0x7e36=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xe367[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x7e36('0x0'));module['exports']={'description':{'type':Sequelize[_0x7e36('0x1')]},'name':{'type':Sequelize[_0x7e36('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7e36('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7e36('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7e36('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7e36('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x7e36('0x4')](0x2)[_0x7e36('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7e36('0x3')],'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[_0x7e36('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7e36('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7e36('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7e36('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7e36('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7e36('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7e36('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7e36('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7e36('0x6'),'set':function(_0x5afd94){if(!_0x5afd94)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x7e36('0x7')]('mandatoryDisposition',_0x5afd94);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 88084b7..714d1bd 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 _0xcd0a=['from','attachments','join','root','server/files/attachments','authentication','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','emit','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','set','apply','reject','update','then','destroy','MailAccounts','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','show','params','keys','intersection','length','body','describe','addDisposition','find','Disposition','create','getDispositions','MailAccountId','count','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','ListId','isNil','description','user','cuser','password','pass','host','port','service','cservice','cpassword','get','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','DESC'];(function(_0x223906,_0x1e71d3){var _0x2e903d=function(_0x3f77c6){while(--_0x3f77c6){_0x223906['push'](_0x223906['shift']());}};_0x2e903d(++_0x1e71d3);}(_0xcd0a,0x19c));var _0xacd0=function(_0x12d0ea,_0x1d19b3){_0x12d0ea=_0x12d0ea-0x0;var _0x25ed27=_0xcd0a[_0x12d0ea];return _0x25ed27;};'use strict';var pdf=require(_0xacd0('0x0'));var emlformat=require(_0xacd0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xacd0('0x2'));var rp=require(_0xacd0('0x3'));var moment=require(_0xacd0('0x4'));var BPromise=require(_0xacd0('0x5'));var Mustache=require('mustache');var util=require(_0xacd0('0x6'));var path=require(_0xacd0('0x7'));var sox=require(_0xacd0('0x8'));var csv=require(_0xacd0('0x9'));var ejs=require(_0xacd0('0xa'));var fs=require('fs');var _=require(_0xacd0('0xb'));var squel=require('squel');var crypto=require(_0xacd0('0xc'));var jsforce=require(_0xacd0('0xd'));var deskjs=require(_0xacd0('0xe'));var toCsv=require(_0xacd0('0x9'));var querystring=require(_0xacd0('0xf'));var Papa=require(_0xacd0('0x10'));var Redis=require('ioredis');var authService=require(_0xacd0('0x11'));var qs=require(_0xacd0('0x12'));var as=require(_0xacd0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacd0('0x14'))(_0xacd0('0x15'));var utils=require(_0xacd0('0x16'));var config=require(_0xacd0('0x17'));var db=require(_0xacd0('0x18'))['db'];config[_0xacd0('0x19')]=_[_0xacd0('0x1a')](config[_0xacd0('0x19')],{'host':_0xacd0('0x1b'),'port':0x18eb});var socket=require(_0xacd0('0x1c'))(new Redis(config[_0xacd0('0x19')]));require(_0xacd0('0x1d'))['register'](socket);var jayson=require(_0xacd0('0x1e'));var client=jayson[_0xacd0('0x1f')]['http']({'port':0x232b});function checkPasswordPattern(_0x431328,_0x9359b9,_0x4fd44d){if(_0x4fd44d){var _0x520a5b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x520a5b['test'](_0x9359b9)){return _0x431328;}else{throw new db['Sequelize'][(_0xacd0('0x20'))](_0xacd0('0x21'));}}else{return _0x431328;}}function respondWithRpcPromise(_0x2e8443,_0x463941,_0x29a30c,_0x3d1855){return new BPromise(function(_0x1067e9,_0x58a6d6){var _0x373f4e=_0x3d1855||client;return _0x373f4e[_0xacd0('0x22')](_0x2e8443,_0x29a30c)['then'](function(_0x2690b7){logger['info'](_0xacd0('0x23'),_0x463941,_0xacd0('0x24'));logger['debug'](_0xacd0('0x25'),_0x463941,_0xacd0('0x24'),JSON[_0xacd0('0x26')](_0x2690b7));if(_0x2690b7['error']){if(_0x2690b7['error']['code']===0x1f4){logger[_0xacd0('0x27')]('MailAccount,\x20%s,\x20%s',_0x463941,_0x2690b7[_0xacd0('0x27')]['message']);return _0x58a6d6(_0x2690b7[_0xacd0('0x27')][_0xacd0('0x28')]);}logger[_0xacd0('0x27')](_0xacd0('0x23'),_0x463941,_0x2690b7['error'][_0xacd0('0x28')]);return _0x1067e9(_0x2690b7[_0xacd0('0x27')]['message']);}else{logger[_0xacd0('0x29')](_0xacd0('0x23'),_0x463941,'request\x20sent');_0x1067e9(_0x2690b7[_0xacd0('0x2a')]['message']);}})[_0xacd0('0x2b')](function(_0x49272f){logger[_0xacd0('0x27')]('MailAccount,\x20%s,\x20%s',_0x463941,_0x49272f);_0x58a6d6(_0x49272f);});});}function respondWithStatusCode(_0xd17047,_0x11fb84){_0x11fb84=_0x11fb84||0xcc;return function(_0x3dc161){if(_0x3dc161){return _0xd17047[_0xacd0('0x2c')](_0x11fb84);}return _0xd17047[_0xacd0('0x2d')](_0x11fb84)[_0xacd0('0x2e')]();};}function respondWithResult(_0x3fac2c,_0x33563a){_0x33563a=_0x33563a||0xc8;return function(_0x22c0f9){if(_0x22c0f9){return _0x3fac2c[_0xacd0('0x2d')](_0x33563a)[_0xacd0('0x2f')](_0x22c0f9);}};}function respondWithFilteredResult(_0x1da4d9,_0x39ca49){return function(_0x5037e6){if(_0x5037e6){var _0x2740b3=_0x5037e6['count'],_0x35aab1=_0x39ca49[_0xacd0('0x30')],_0x1c95d0=_0x39ca49[_0xacd0('0x30')]+_0x39ca49['limit'],_0x5683ea;if(_0x1c95d0>=_0x2740b3){_0x1c95d0=_0x2740b3;_0x5683ea=0xc8;}else{_0x5683ea=0xce;}_0x1da4d9[_0xacd0('0x2d')](_0x5683ea);return _0x1da4d9[_0xacd0('0x31')]('Content-Range',_0x35aab1+'-'+_0x1c95d0+'/'+_0x2740b3)[_0xacd0('0x2f')](_0x5037e6);}return null;};}function patchUpdates(_0x4f2691){return function(_0x770e78){try{jsonpatch[_0xacd0('0x32')](_0x770e78,_0x4f2691,!![]);}catch(_0x1dcd61){return BPromise[_0xacd0('0x33')](_0x1dcd61);}return _0x770e78['save']();};}function saveUpdates(_0x2cf3fa,_0x395653){return function(_0x430abe){if(_0x430abe){return _0x430abe[_0xacd0('0x34')](_0x2cf3fa)[_0xacd0('0x35')](function(_0x23a2ac){return _0x23a2ac;});}return null;};}function removeEntity(_0x280eeb,_0x19548a){return function(_0x27f939){if(_0x27f939){return _0x27f939[_0xacd0('0x36')]()[_0xacd0('0x35')](function(){var _0x2bbc70=_0x27f939['get']({'plain':!![]});var _0x7700a6=_0xacd0('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x7700a6,'resourceId':_0x2bbc70['id']}})[_0xacd0('0x35')](function(){return _0x27f939;});})[_0xacd0('0x35')](function(){_0x280eeb[_0xacd0('0x2d')](0xcc)[_0xacd0('0x2e')]();});}};}function handleEntityNotFound(_0x4633f4,_0x35f4d8){return function(_0x40d6b7){if(!_0x40d6b7){_0x4633f4[_0xacd0('0x2c')](0x194);}return _0x40d6b7;};}function handleError(_0x29f7b8,_0x3aa814){_0x3aa814=_0x3aa814||0x1f4;return function(_0x37b783){logger[_0xacd0('0x27')](_0x37b783[_0xacd0('0x38')]);if(_0x37b783['name']){delete _0x37b783[_0xacd0('0x39')];}_0x29f7b8[_0xacd0('0x2d')](_0x3aa814)['send'](_0x37b783);};}exports[_0xacd0('0x3a')]=function(_0x1bf1a1,_0x4b0f4e){var _0x117fdc={'include':[{'model':db[_0xacd0('0x3b')],'as':_0xacd0('0x3c')},{'model':db[_0xacd0('0x3d')],'as':_0xacd0('0x3e')},{'model':db[_0xacd0('0x3f')],'as':_0xacd0('0x40')}]},_0x3fdbce={},_0x324dbd={'count':0x0,'rows':[]};var _0x5d1543=_['map'](db[_0xacd0('0x41')][_0xacd0('0x42')],function(_0x58dada){return{'name':_0x58dada[_0xacd0('0x43')],'type':_0x58dada[_0xacd0('0x44')][_0xacd0('0x45')]};});_0x3fdbce[_0xacd0('0x46')]=_['map'](_0x5d1543,'name');_0x3fdbce[_0xacd0('0x47')]=_['keys'](_0x1bf1a1[_0xacd0('0x47')]);_0x3fdbce[_0xacd0('0x48')]=_['intersection'](_0x3fdbce[_0xacd0('0x46')],_0x3fdbce[_0xacd0('0x47')]);_0x117fdc['attributes']=_['intersection'](_0x3fdbce[_0xacd0('0x46')],qs[_0xacd0('0x49')](_0x1bf1a1[_0xacd0('0x47')][_0xacd0('0x49')]));_0x117fdc['attributes']=_0x117fdc[_0xacd0('0x4a')]['length']?_0x117fdc['attributes']:_0x3fdbce['model'];if(!_0x1bf1a1[_0xacd0('0x47')][_0xacd0('0x4b')](_0xacd0('0x4c'))){_0x117fdc['limit']=qs[_0xacd0('0x4d')](_0x1bf1a1['query'][_0xacd0('0x4d')]);_0x117fdc[_0xacd0('0x30')]=qs[_0xacd0('0x30')](_0x1bf1a1['query']['offset']);}_0x117fdc[_0xacd0('0x4e')]=qs['sort'](_0x1bf1a1[_0xacd0('0x47')][_0xacd0('0x4f')]);_0x117fdc[_0xacd0('0x50')]=qs['filters'](_[_0xacd0('0x51')](_0x1bf1a1['query'],_0x3fdbce[_0xacd0('0x48')]),_0x5d1543);if(_0x1bf1a1[_0xacd0('0x47')][_0xacd0('0x52')]){_0x117fdc[_0xacd0('0x50')]=_[_0xacd0('0x53')](_0x117fdc['where'],{'$or':_[_0xacd0('0x54')](_0x5d1543,function(_0x3a10ca){if(_0x3a10ca[_0xacd0('0x44')]!==_0xacd0('0x55')){var _0x555b2f={};_0x555b2f[_0x3a10ca[_0xacd0('0x39')]]={'$like':'%'+_0x1bf1a1[_0xacd0('0x47')][_0xacd0('0x52')]+'%'};return _0x555b2f;}})});}_0x117fdc=_[_0xacd0('0x53')]({},_0x117fdc,_0x1bf1a1[_0xacd0('0x56')]);var _0x5347f9={'where':_0x117fdc[_0xacd0('0x50')]};return db['MailAccount']['count'](_0x5347f9)[_0xacd0('0x35')](function(_0xea9b){_0x324dbd['count']=_0xea9b;if(_0x1bf1a1['query'][_0xacd0('0x57')]){_0x117fdc[_0xacd0('0x58')]=[{'all':!![]}];}return db[_0xacd0('0x41')]['findAll'](_0x117fdc);})[_0xacd0('0x35')](function(_0xa210ed){_0x324dbd['rows']=_0xa210ed;return _0x324dbd;})[_0xacd0('0x35')](respondWithFilteredResult(_0x4b0f4e,_0x117fdc))[_0xacd0('0x2b')](handleError(_0x4b0f4e,null));};exports[_0xacd0('0x59')]=function(_0x2d345d,_0x2ba795){var _0x5d57b9={'raw':![],'where':{'id':_0x2d345d[_0xacd0('0x5a')]['id']},'include':[{'model':db[_0xacd0('0x3b')],'as':_0xacd0('0x3c')},{'model':db['MailServerOut'],'as':_0xacd0('0x3e')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x29e32b={};_0x29e32b[_0xacd0('0x46')]=_[_0xacd0('0x5b')](db[_0xacd0('0x41')][_0xacd0('0x42')]);_0x29e32b[_0xacd0('0x47')]=_[_0xacd0('0x5b')](_0x2d345d[_0xacd0('0x47')]);_0x29e32b[_0xacd0('0x48')]=_[_0xacd0('0x5c')](_0x29e32b['model'],_0x29e32b['query']);_0x5d57b9[_0xacd0('0x4a')]=_[_0xacd0('0x5c')](_0x29e32b['model'],qs[_0xacd0('0x49')](_0x2d345d['query'][_0xacd0('0x49')]));_0x5d57b9[_0xacd0('0x4a')]=_0x5d57b9['attributes'][_0xacd0('0x5d')]?_0x5d57b9[_0xacd0('0x4a')]:_0x29e32b[_0xacd0('0x46')];if(_0x2d345d[_0xacd0('0x47')][_0xacd0('0x57')]){_0x5d57b9['include']=[{'all':!![]}];}_0x5d57b9=_['merge']({},_0x5d57b9,_0x2d345d[_0xacd0('0x56')]);return db[_0xacd0('0x41')]['find'](_0x5d57b9)[_0xacd0('0x35')](handleEntityNotFound(_0x2ba795,null))[_0xacd0('0x35')](respondWithResult(_0x2ba795,null))[_0xacd0('0x2b')](handleError(_0x2ba795,null));};exports[_0xacd0('0x34')]=function(_0x474298,_0x462c67){if(_0x474298[_0xacd0('0x5e')]['id']){delete _0x474298['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x474298[_0xacd0('0x5a')]['id']},'include':[{'model':db[_0xacd0('0x3b')],'as':_0xacd0('0x3c')},{'model':db[_0xacd0('0x3d')],'as':_0xacd0('0x3e')},{'model':db[_0xacd0('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xacd0('0x35')](handleEntityNotFound(_0x462c67,null))[_0xacd0('0x35')](saveUpdates(_0x474298[_0xacd0('0x5e')],null))['then'](function(_0x2e1a39){if(_0x2e1a39&&_0x474298['body'][_0xacd0('0x3c')]){return db[_0xacd0('0x3b')][_0xacd0('0x34')](_0x474298['body'][_0xacd0('0x3c')],{'where':{'MailAccountId':_0x2e1a39['id']}})[_0xacd0('0x35')](function(){return _0x2e1a39;});}return _0x2e1a39;})[_0xacd0('0x35')](function(_0x3bae5e){if(_0x3bae5e&&_0x474298[_0xacd0('0x5e')]['Smtp']){return db[_0xacd0('0x3d')][_0xacd0('0x34')](_0x474298['body'][_0xacd0('0x3e')],{'where':{'MailAccountId':_0x3bae5e['id']}})[_0xacd0('0x35')](function(){return _0x3bae5e;});}return _0x3bae5e;})[_0xacd0('0x35')](respondWithResult(_0x462c67,null))[_0xacd0('0x2b')](handleError(_0x462c67,null));};exports['describe']=function(_0x2dea2a,_0x26c6aa){return db[_0xacd0('0x41')][_0xacd0('0x5f')]()[_0xacd0('0x35')](respondWithResult(_0x26c6aa,null))['catch'](handleError(_0x26c6aa,null));};exports[_0xacd0('0x60')]=function(_0x57bc9e,_0x9a3a98,_0x51a567){if(_0x57bc9e[_0xacd0('0x5e')]['id']){delete _0x57bc9e[_0xacd0('0x5e')]['id'];}return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0x57bc9e[_0xacd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x9a3a98,null))[_0xacd0('0x35')](function(_0x170089){if(_0x170089){_0x57bc9e[_0xacd0('0x5e')]['MailAccountId']=_0x170089['id'];return db[_0xacd0('0x62')][_0xacd0('0x63')](_0x57bc9e[_0xacd0('0x5e')]);}})[_0xacd0('0x35')](respondWithResult(_0x9a3a98,null))[_0xacd0('0x2b')](handleError(_0x9a3a98,null));};exports[_0xacd0('0x64')]=function(_0x6d28dc,_0x31d664,_0x3b2255){var _0x3ac25b={'raw':![],'where':{}};var _0x4eca55={};var _0x4ce724={'count':0x0,'rows':[]};return db[_0xacd0('0x41')]['findOne']({'where':{'id':_0x6d28dc[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x31d664,null))['then'](function(_0x26260f){if(_0x26260f){_0x4eca55[_0xacd0('0x46')]=_[_0xacd0('0x5b')](db[_0xacd0('0x62')]['rawAttributes']);_0x4eca55['query']=_[_0xacd0('0x5b')](_0x6d28dc[_0xacd0('0x47')]);_0x4eca55['filters']=_['intersection'](_0x4eca55[_0xacd0('0x46')],_0x4eca55['query']);_0x3ac25b['attributes']=_[_0xacd0('0x5c')](_0x4eca55['model'],qs[_0xacd0('0x49')](_0x6d28dc[_0xacd0('0x47')][_0xacd0('0x49')]));_0x3ac25b[_0xacd0('0x4a')]=_0x3ac25b['attributes'][_0xacd0('0x5d')]?_0x3ac25b[_0xacd0('0x4a')]:_0x4eca55[_0xacd0('0x46')];if(!_0x6d28dc['query']['hasOwnProperty']('nolimit')){_0x3ac25b[_0xacd0('0x4d')]=qs[_0xacd0('0x4d')](_0x6d28dc[_0xacd0('0x47')][_0xacd0('0x4d')]);_0x3ac25b[_0xacd0('0x30')]=qs[_0xacd0('0x30')](_0x6d28dc[_0xacd0('0x47')][_0xacd0('0x30')]);}_0x3ac25b[_0xacd0('0x4e')]=qs[_0xacd0('0x4f')](_0x6d28dc['query'][_0xacd0('0x4f')]);_0x3ac25b[_0xacd0('0x50')]=qs['filters'](_[_0xacd0('0x51')](_0x6d28dc['query'],_0x4eca55[_0xacd0('0x48')]));_0x3ac25b[_0xacd0('0x50')][_0xacd0('0x65')]=_0x26260f['id'];if(_0x6d28dc[_0xacd0('0x47')][_0xacd0('0x52')]){_0x3ac25b[_0xacd0('0x50')]=_[_0xacd0('0x53')](_0x3ac25b[_0xacd0('0x50')],{'$or':_[_0xacd0('0x54')](_0x3ac25b[_0xacd0('0x4a')],function(_0x2ac73d){var _0x5d9258={};_0x5d9258[_0x2ac73d]={'$like':'%'+_0x6d28dc[_0xacd0('0x47')]['filter']+'%'};return _0x5d9258;})});}_0x3ac25b=_[_0xacd0('0x53')]({},_0x3ac25b,_0x6d28dc[_0xacd0('0x56')]);return db[_0xacd0('0x62')][_0xacd0('0x66')]({'where':_0x3ac25b[_0xacd0('0x50')]})[_0xacd0('0x35')](function(_0x5d6c32){_0x4ce724[_0xacd0('0x66')]=_0x5d6c32;if(_0x6d28dc[_0xacd0('0x47')][_0xacd0('0x57')]){_0x3ac25b[_0xacd0('0x58')]=[{'all':!![]}];}return db[_0xacd0('0x62')][_0xacd0('0x67')](_0x3ac25b);})[_0xacd0('0x35')](function(_0x214a9d){_0x4ce724[_0xacd0('0x68')]=_0x214a9d;return _0x4ce724;});}})[_0xacd0('0x35')](respondWithFilteredResult(_0x31d664,_0x3ac25b))[_0xacd0('0x2b')](handleError(_0x31d664,null));};exports[_0xacd0('0x69')]=function(_0x1b7c12,_0x2446c0,_0x2c8805){return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0x1b7c12[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x2446c0,null))[_0xacd0('0x35')](function(_0x56f997){if(_0x56f997){return _0x56f997[_0xacd0('0x69')](_0x1b7c12[_0xacd0('0x47')][_0xacd0('0x6a')]);}})[_0xacd0('0x35')](respondWithStatusCode(_0x2446c0,null))[_0xacd0('0x2b')](handleError(_0x2446c0,null));};exports[_0xacd0('0x6b')]=function(_0x90f75,_0x42bdd2,_0x477ae3){if(_0x90f75['body']['id']){delete _0x90f75['body']['id'];}return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0x90f75[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x42bdd2,null))['then'](function(_0x4d1918){if(_0x4d1918){_0x90f75[_0xacd0('0x5e')][_0xacd0('0x65')]=_0x4d1918['id'];return db[_0xacd0('0x6c')]['create'](_0x90f75[_0xacd0('0x5e')]);}})['then'](respondWithResult(_0x42bdd2,null))['catch'](handleError(_0x42bdd2,null));};exports[_0xacd0('0x6d')]=function(_0x33e0bf,_0x51a5dc,_0x46640a){var _0x567a09={'raw':![],'where':{}};var _0x185478={};var _0x4baa2c={'count':0x0,'rows':[]};return db['MailAccount'][_0xacd0('0x6e')]({'where':{'id':_0x33e0bf[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x51a5dc,null))[_0xacd0('0x35')](function(_0x3ac1c1){if(_0x3ac1c1){_0x185478['model']=_[_0xacd0('0x5b')](db[_0xacd0('0x6c')]['rawAttributes']);_0x185478[_0xacd0('0x47')]=_[_0xacd0('0x5b')](_0x33e0bf['query']);_0x185478['filters']=_[_0xacd0('0x5c')](_0x185478['model'],_0x185478[_0xacd0('0x47')]);_0x567a09[_0xacd0('0x4a')]=_[_0xacd0('0x5c')](_0x185478['model'],qs[_0xacd0('0x49')](_0x33e0bf['query'][_0xacd0('0x49')]));_0x567a09[_0xacd0('0x4a')]=_0x567a09[_0xacd0('0x4a')][_0xacd0('0x5d')]?_0x567a09[_0xacd0('0x4a')]:_0x185478['model'];if(!_0x33e0bf['query'][_0xacd0('0x4b')]('nolimit')){_0x567a09[_0xacd0('0x4d')]=qs[_0xacd0('0x4d')](_0x33e0bf[_0xacd0('0x47')][_0xacd0('0x4d')]);_0x567a09[_0xacd0('0x30')]=qs[_0xacd0('0x30')](_0x33e0bf['query']['offset']);}_0x567a09[_0xacd0('0x4e')]=qs[_0xacd0('0x4f')](_0x33e0bf[_0xacd0('0x47')]['sort']);_0x567a09[_0xacd0('0x50')]=qs[_0xacd0('0x48')](_[_0xacd0('0x51')](_0x33e0bf['query'],_0x185478['filters']));_0x567a09[_0xacd0('0x50')]['MailAccountId']=_0x3ac1c1['id'];if(_0x33e0bf['query'][_0xacd0('0x52')]){_0x567a09[_0xacd0('0x50')]=_[_0xacd0('0x53')](_0x567a09[_0xacd0('0x50')],{'$or':_[_0xacd0('0x54')](_0x567a09['attributes'],function(_0x1e67b4){var _0x42ef75={};_0x42ef75[_0x1e67b4]={'$like':'%'+_0x33e0bf[_0xacd0('0x47')][_0xacd0('0x52')]+'%'};return _0x42ef75;})});}_0x567a09=_['merge']({},_0x567a09,_0x33e0bf[_0xacd0('0x56')]);return db['CannedAnswer'][_0xacd0('0x66')]({'where':_0x567a09['where']})[_0xacd0('0x35')](function(_0x47923a){_0x4baa2c[_0xacd0('0x66')]=_0x47923a;if(_0x33e0bf[_0xacd0('0x47')][_0xacd0('0x57')]){_0x567a09[_0xacd0('0x58')]=[{'all':!![]}];}return db[_0xacd0('0x6c')][_0xacd0('0x67')](_0x567a09);})['then'](function(_0x5eddd6){_0x4baa2c['rows']=_0x5eddd6;return _0x4baa2c;});}})[_0xacd0('0x35')](respondWithFilteredResult(_0x51a5dc,_0x567a09))['catch'](handleError(_0x51a5dc,null));};exports[_0xacd0('0x6f')]=function(_0x5b8c76,_0x12d858,_0x1ae885){return db[_0xacd0('0x41')]['find']({'where':{'id':_0x5b8c76[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x12d858,null))['then'](function(_0x22f998){if(_0x22f998){return _0x22f998['removeAnswers'](_0x5b8c76[_0xacd0('0x47')][_0xacd0('0x6a')]);}})[_0xacd0('0x35')](respondWithStatusCode(_0x12d858,null))[_0xacd0('0x2b')](handleError(_0x12d858,null));};exports['create']=function(_0x4759a6,_0x25827a){var _0xdae2cb={'name':_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x39')],'key':_0x4759a6[_0xacd0('0x5e')]['key'],'email':_0x4759a6['body'][_0xacd0('0x70')],'ListId':_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x71')],'active':!_[_0xacd0('0x72')](_0x4759a6['body']['active'])?_0x4759a6['body']['active']:!![],'description':_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0xacd0('0x72')](_0x4759a6['body']['cservice'])){if(_0x4759a6[_0xacd0('0x5e')]['cauthentication']){_0xdae2cb[_0xacd0('0x3c')][_0xacd0('0x74')]=_0xdae2cb['Smtp'][_0xacd0('0x74')]=_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x75')];_0xdae2cb['Imap'][_0xacd0('0x76')]=_0xdae2cb[_0xacd0('0x3e')][_0xacd0('0x77')]=_0x4759a6['body']['cpassword'];}else{_0xdae2cb[_0xacd0('0x3c')]['authentication']=_0xdae2cb['Smtp']['authentication']=![];}_0xdae2cb[_0xacd0('0x3c')][_0xacd0('0x78')]=_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x3c')][_0xacd0('0x78')];_0xdae2cb['Imap']['port']=_0x4759a6[_0xacd0('0x5e')]['Imap'][_0xacd0('0x79')];_0xdae2cb['Smtp']['host']=_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x3e')][_0xacd0('0x78')];_0xdae2cb['Smtp'][_0xacd0('0x79')]=_0x4759a6['body'][_0xacd0('0x3e')][_0xacd0('0x79')];}else{_0xdae2cb[_0xacd0('0x3c')][_0xacd0('0x7a')]=_0xdae2cb[_0xacd0('0x3e')]['service']=_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x7b')];_0xdae2cb['Imap'][_0xacd0('0x74')]=_0xdae2cb['Smtp']['user']=_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x75')];_0xdae2cb[_0xacd0('0x3c')]['password']=_0xdae2cb['Smtp'][_0xacd0('0x77')]=_0x4759a6[_0xacd0('0x5e')][_0xacd0('0x7c')];}return db['MailAccount'][_0xacd0('0x63')](_0xdae2cb,{'include':[{'model':db[_0xacd0('0x3d')],'as':_0xacd0('0x3e')},{'model':db[_0xacd0('0x3b')],'as':'Imap'}]})[_0xacd0('0x35')](function(_0x5a2ff0){var _0x3fb601=_0x4759a6[_0xacd0('0x74')][_0xacd0('0x7d')]({'plain':!![]});if(!_0x3fb601)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fb601[_0xacd0('0x7e')]===_0xacd0('0x74')){var _0x2a9646=_0x5a2ff0[_0xacd0('0x7d')]({'plain':!![]});return db['UserProfileSection'][_0xacd0('0x61')]({'where':{'name':_0xacd0('0x37'),'userProfileId':_0x3fb601['userProfileId']},'raw':!![]})[_0xacd0('0x35')](function(_0x6b352e){if(_0x6b352e&&_0x6b352e['autoAssociation']===0x0){return db[_0xacd0('0x7f')][_0xacd0('0x63')]({'name':_0x2a9646[_0xacd0('0x39')],'resourceId':_0x2a9646['id'],'type':_0x6b352e[_0xacd0('0x39')],'sectionId':_0x6b352e['id']},{})[_0xacd0('0x35')](function(){return _0x5a2ff0;});}else{return _0x5a2ff0;}})[_0xacd0('0x2b')](function(_0x365911){logger[_0xacd0('0x27')](_0xacd0('0x80'),_0x365911);throw _0x365911;});}return _0x5a2ff0;})[_0xacd0('0x35')](respondWithResult(_0x25827a,0xc9))[_0xacd0('0x2b')](handleError(_0x25827a,null));};exports[_0xacd0('0x81')]=function(_0x321f46,_0x3d0f76,_0x1a3827){return db[_0xacd0('0x41')][_0xacd0('0x6e')]({'where':{'id':_0x321f46['params']['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x3d0f76,null))['then'](function(_0x3abf95){if(_0x3abf95){return _0x3abf95[_0xacd0('0x81')]();}return null;})['then'](respondWithResult(_0x3d0f76,null))['catch'](handleError(_0x3d0f76,null));};exports[_0xacd0('0x82')]=function(_0x23f372,_0x5b4157,_0x4ea9fe){if(_0x23f372[_0xacd0('0x5e')]['id']){delete _0x23f372['body']['id'];}return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0x23f372[_0xacd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5b4157,null))['then'](function(_0x282310){if(_0x282310){_0x23f372[_0xacd0('0x5e')][_0xacd0('0x65')]=_0x282310['id'];return db[_0xacd0('0x3b')][_0xacd0('0x63')](_0x23f372[_0xacd0('0x5e')]);}})[_0xacd0('0x35')](respondWithResult(_0x5b4157,null))['catch'](handleError(_0x5b4157,null));};exports[_0xacd0('0x83')]=function(_0x5bb3c3,_0x1b38c9,_0x41c110){return db[_0xacd0('0x41')]['findOne']({'where':{'id':_0x5bb3c3[_0xacd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1b38c9,null))['then'](function(_0x122c92){if(_0x122c92){return _0x122c92[_0xacd0('0x84')](null);}return null;})[_0xacd0('0x35')](respondWithStatusCode(_0x1b38c9,null))[_0xacd0('0x2b')](handleError(_0x1b38c9,null));};exports[_0xacd0('0x85')]=function(_0x1f8e65,_0x5f53cd,_0x2658fe){return db[_0xacd0('0x41')][_0xacd0('0x6e')]({'where':{'id':_0x1f8e65[_0xacd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5f53cd,null))[_0xacd0('0x35')](function(_0x259e62){if(_0x259e62){return _0x259e62[_0xacd0('0x85')]();}return null;})[_0xacd0('0x35')](respondWithResult(_0x5f53cd,null))['catch'](handleError(_0x5f53cd,null));};exports[_0xacd0('0x86')]=function(_0x72e85,_0x45521f,_0x277b16){if(_0x72e85[_0xacd0('0x5e')]['id']){delete _0x72e85[_0xacd0('0x5e')]['id'];}return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0x72e85[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x45521f,null))['then'](function(_0x1328da){if(_0x1328da){_0x72e85[_0xacd0('0x5e')][_0xacd0('0x65')]=_0x1328da['id'];return db[_0xacd0('0x3d')]['create'](_0x72e85[_0xacd0('0x5e')]);}})[_0xacd0('0x35')](respondWithResult(_0x45521f,null))['catch'](handleError(_0x45521f,null));};exports[_0xacd0('0x87')]=function(_0x76571c,_0xdaa121,_0x1543eb){return db['MailAccount']['findOne']({'where':{'id':_0x76571c[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0xdaa121,null))[_0xacd0('0x35')](function(_0x4ac910){if(_0x4ac910){return _0x4ac910[_0xacd0('0x88')](null);}return null;})[_0xacd0('0x35')](respondWithStatusCode(_0xdaa121,null))[_0xacd0('0x2b')](handleError(_0xdaa121,null));};exports[_0xacd0('0x89')]=function(_0x6546a8,_0x510f41,_0x1d8c05){return db[_0xacd0('0x8a')]['find']({'where':{'id':_0x6546a8[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x510f41,null))[_0xacd0('0x35')](function(_0x3e7ff0){if(_0x3e7ff0){return _0x3e7ff0['addInteraction'](_0x6546a8[_0xacd0('0x5e')][_0xacd0('0x6a')],_[_0xacd0('0x8b')](_0x6546a8[_0xacd0('0x5e')],['ids','id'])||{});}})['then'](respondWithResult(_0x510f41,null))['catch'](handleError(_0x510f41,null));};exports['getInteractions']=function(_0x5695ab,_0x492d04,_0x2259bb){var _0xc718e1={'raw':![],'where':{}};var _0x47f335={};var _0x3fadd7={'count':0x0,'rows':[]};return db[_0xacd0('0x41')][_0xacd0('0x6e')]({'where':{'id':_0x5695ab[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x492d04,null))[_0xacd0('0x35')](function(_0x491b11){if(_0x491b11){_0x47f335[_0xacd0('0x46')]=_[_0xacd0('0x5b')](db['MailInteraction'][_0xacd0('0x42')]);_0x47f335[_0xacd0('0x47')]=_['keys'](_0x5695ab[_0xacd0('0x47')]);_0x47f335[_0xacd0('0x48')]=_[_0xacd0('0x5c')](_0x47f335[_0xacd0('0x46')],_0x47f335[_0xacd0('0x47')]);_0xc718e1['attributes']=_['intersection'](_0x47f335[_0xacd0('0x46')],qs['fields'](_0x5695ab[_0xacd0('0x47')][_0xacd0('0x49')]));_0xc718e1[_0xacd0('0x4a')]=_0xc718e1[_0xacd0('0x4a')]['length']?_0xc718e1['attributes']:_0x47f335['model'];if(!_0x5695ab[_0xacd0('0x47')][_0xacd0('0x4b')](_0xacd0('0x4c'))){_0xc718e1[_0xacd0('0x4d')]=qs['limit'](_0x5695ab['query'][_0xacd0('0x4d')]);_0xc718e1[_0xacd0('0x30')]=qs[_0xacd0('0x30')](_0x5695ab[_0xacd0('0x47')][_0xacd0('0x30')]);}_0xc718e1[_0xacd0('0x4e')]=qs['sort'](_0x5695ab['query'][_0xacd0('0x4f')]);_0xc718e1['where']=qs[_0xacd0('0x48')](_[_0xacd0('0x51')](_0x5695ab[_0xacd0('0x47')],_0x47f335[_0xacd0('0x48')]));_0xc718e1[_0xacd0('0x50')][_0xacd0('0x65')]=_0x491b11['id'];if(_0x5695ab['query'][_0xacd0('0x52')]){_0xc718e1[_0xacd0('0x50')]=_[_0xacd0('0x53')](_0xc718e1[_0xacd0('0x50')],{'$or':_['map'](_0xc718e1[_0xacd0('0x4a')],function(_0x3ebc08){var _0x310dd1={};_0x310dd1[_0x3ebc08]={'$like':'%'+_0x5695ab[_0xacd0('0x47')][_0xacd0('0x52')]+'%'};return _0x310dd1;})});}_0xc718e1=_[_0xacd0('0x53')]({},_0xc718e1,_0x5695ab[_0xacd0('0x56')]);return db['MailInteraction'][_0xacd0('0x66')]({'where':_0xc718e1[_0xacd0('0x50')]})[_0xacd0('0x35')](function(_0x5961a6){_0x3fadd7[_0xacd0('0x66')]=_0x5961a6;if(_0x5695ab[_0xacd0('0x47')][_0xacd0('0x57')]){_0xc718e1[_0xacd0('0x58')]=[{'model':db[_0xacd0('0x8c')],'as':'Contact','required':![]},{'model':db[_0xacd0('0x8d')],'as':_0xacd0('0x8e'),'attributes':['name',_0xacd0('0x8f'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xacd0('0x90'),'attributes':['id',_0xacd0('0x39'),_0xacd0('0x91')],'where':_0x5695ab[_0xacd0('0x47')][_0xacd0('0x92')]?{'id':_0x5695ab[_0xacd0('0x47')]['tag']}:undefined,'required':_0x5695ab[_0xacd0('0x47')][_0xacd0('0x92')]?!![]:![]}];}return db[_0xacd0('0x8a')][_0xacd0('0x67')](_0xc718e1);})[_0xacd0('0x35')](function(_0xb421e3){_0x3fadd7[_0xacd0('0x68')]=_0xb421e3;return _0x3fadd7;});}})[_0xacd0('0x35')](respondWithFilteredResult(_0x492d04,_0xc718e1))['catch'](handleError(_0x492d04,null));};exports[_0xacd0('0x93')]=function(_0x22c111,_0x234edd,_0x1785a8){return db[_0xacd0('0x41')][_0xacd0('0x6e')]({'where':{'id':_0x22c111[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x234edd,null))[_0xacd0('0x35')](function(_0xad6271){if(_0xad6271){return db[_0xacd0('0x94')][_0xacd0('0x95')](function(_0x58ec33){return db[_0xacd0('0x96')][_0xacd0('0x36')]({'where':{'MailAccountId':_0x22c111['params']['id']},'transaction':_0x58ec33})[_0xacd0('0x35')](function(_0x3fb6c6){var _0x6535d2=_['map'](_0x22c111[_0xacd0('0x5e')],function(_0x42b5cf){_0x42b5cf[_0xacd0('0x65')]=_0x22c111[_0xacd0('0x5a')]['id'];return _0x42b5cf;});return db[_0xacd0('0x96')][_0xacd0('0x97')](_0x6535d2,{'transaction':_0x58ec33});});})['then'](function(){return db[_0xacd0('0x96')][_0xacd0('0x98')]({'where':{'MailAccountId':_0x22c111[_0xacd0('0x5a')]['id']},'order':_0xacd0('0x99')});});}})[_0xacd0('0x35')](respondWithResult(_0x234edd,null))[_0xacd0('0x2b')](handleError(_0x234edd,null));};exports[_0xacd0('0x9a')]=function(_0x15f969,_0x267408,_0x4e2a9c){var _0x1c44b9={};var _0x3d60a7={};var _0x17fcd9;var _0x4bd7f4;return db['MailAccount']['findOne']({'where':{'id':_0x15f969[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x267408,null))[_0xacd0('0x35')](function(_0x477de5){if(_0x477de5){_0x17fcd9=_0x477de5;_0x3d60a7[_0xacd0('0x46')]=_[_0xacd0('0x5b')](db['MailApplication'][_0xacd0('0x42')]);_0x3d60a7['query']=_[_0xacd0('0x5b')](_0x15f969[_0xacd0('0x47')]);_0x3d60a7['filters']=_[_0xacd0('0x5c')](_0x3d60a7[_0xacd0('0x46')],_0x3d60a7[_0xacd0('0x47')]);_0x1c44b9[_0xacd0('0x4a')]=_['intersection'](_0x3d60a7['model'],qs[_0xacd0('0x49')](_0x15f969['query'][_0xacd0('0x49')]));_0x1c44b9['attributes']=_0x1c44b9['attributes'][_0xacd0('0x5d')]?_0x1c44b9[_0xacd0('0x4a')]:_0x3d60a7[_0xacd0('0x46')];_0x1c44b9[_0xacd0('0x4e')]=qs['sort'](_0x15f969[_0xacd0('0x47')]['sort']);_0x1c44b9['where']=qs['filters'](_[_0xacd0('0x51')](_0x15f969[_0xacd0('0x47')],_0x3d60a7[_0xacd0('0x48')]));if(_0x15f969[_0xacd0('0x47')][_0xacd0('0x52')]){_0x1c44b9['where']=_[_0xacd0('0x53')](_0x1c44b9['where'],{'$or':_['map'](_0x1c44b9['attributes'],function(_0x4bc8f4){var _0x15f47a={};_0x15f47a[_0x4bc8f4]={'$like':'%'+_0x15f969[_0xacd0('0x47')][_0xacd0('0x52')]+'%'};return _0x15f47a;})});}_0x1c44b9=_[_0xacd0('0x53')]({},_0x1c44b9,_0x15f969[_0xacd0('0x56')]);return _0x17fcd9[_0xacd0('0x9a')](_0x1c44b9);}})['then'](function(_0x305fde){if(_0x305fde){_0x4bd7f4=_0x305fde['length'];if(!_0x15f969['query']['hasOwnProperty'](_0xacd0('0x4c'))){_0x1c44b9[_0xacd0('0x4d')]=qs[_0xacd0('0x4d')](_0x15f969[_0xacd0('0x47')][_0xacd0('0x4d')]);_0x1c44b9[_0xacd0('0x30')]=qs[_0xacd0('0x30')](_0x15f969['query']['offset']);}return _0x17fcd9[_0xacd0('0x9a')](_0x1c44b9);}})[_0xacd0('0x35')](function(_0x5190fb){if(_0x5190fb){return _0x5190fb?{'count':_0x4bd7f4,'rows':_0x5190fb}:null;}})[_0xacd0('0x35')](respondWithResult(_0x267408,null))[_0xacd0('0x2b')](handleError(_0x267408,null));};exports['getMessages']=function(_0x5587e0,_0x2220d7,_0x19a346){var _0x3aec3e={'raw':!![],'where':{}};var _0x34e33b={};var _0x480057={'count':0x0,'rows':[]};return db[_0xacd0('0x41')][_0xacd0('0x6e')]({'where':{'id':_0x5587e0[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x2220d7,null))[_0xacd0('0x35')](function(_0x3a1e18){if(_0x3a1e18){_0x34e33b['model']=_[_0xacd0('0x5b')](db[_0xacd0('0x9b')][_0xacd0('0x42')]);_0x34e33b[_0xacd0('0x47')]=_[_0xacd0('0x5b')](_0x5587e0[_0xacd0('0x47')]);_0x34e33b[_0xacd0('0x48')]=_['intersection'](_0x34e33b[_0xacd0('0x46')],_0x34e33b[_0xacd0('0x47')]);_0x3aec3e[_0xacd0('0x4a')]=_['intersection'](_0x34e33b[_0xacd0('0x46')],qs[_0xacd0('0x49')](_0x5587e0[_0xacd0('0x47')]['fields']));_0x3aec3e['attributes']=_0x3aec3e[_0xacd0('0x4a')]['length']?_0x3aec3e[_0xacd0('0x4a')]:_0x34e33b[_0xacd0('0x46')];if(!_0x5587e0['query'][_0xacd0('0x4b')](_0xacd0('0x4c'))){_0x3aec3e[_0xacd0('0x4d')]=qs['limit'](_0x5587e0[_0xacd0('0x47')]['limit']);_0x3aec3e[_0xacd0('0x30')]=qs['offset'](_0x5587e0['query']['offset']);}_0x3aec3e[_0xacd0('0x4e')]=qs['sort'](_0x5587e0[_0xacd0('0x47')][_0xacd0('0x4f')]);_0x3aec3e[_0xacd0('0x50')]=qs[_0xacd0('0x48')](_[_0xacd0('0x51')](_0x5587e0[_0xacd0('0x47')],_0x34e33b[_0xacd0('0x48')]));_0x3aec3e[_0xacd0('0x50')][_0xacd0('0x65')]=_0x3a1e18['id'];if(_0x5587e0[_0xacd0('0x47')]['filter']){_0x3aec3e['where']=_[_0xacd0('0x53')](_0x3aec3e[_0xacd0('0x50')],{'$or':_[_0xacd0('0x54')](_0x3aec3e[_0xacd0('0x4a')],function(_0x14c0ea){var _0x230655={};_0x230655[_0x14c0ea]={'$like':'%'+_0x5587e0[_0xacd0('0x47')][_0xacd0('0x52')]+'%'};return _0x230655;})});}if(_0x5587e0[_0xacd0('0x47')][_0xacd0('0x9c')]){var _0x52b33d=_0x5587e0[_0xacd0('0x47')][_0xacd0('0x9c')][_0xacd0('0x9d')](',');var _0x123237={};_0x123237[_0x52b33d[0x0]]={'$gte':moment(_0x52b33d[0x1])[_0xacd0('0x9e')](_0xacd0('0x9f'))};_0x3aec3e['where']=_['merge'](_0x3aec3e[_0xacd0('0x50')],_0x123237);}_0x3aec3e=_[_0xacd0('0x53')]({},_0x3aec3e,_0x5587e0[_0xacd0('0x56')]);return db['MailMessage'][_0xacd0('0x66')]({'where':_0x3aec3e[_0xacd0('0x50')]})['then'](function(_0x1a41b4){_0x480057[_0xacd0('0x66')]=_0x1a41b4;if(_0x5587e0[_0xacd0('0x47')]['includeAll']){_0x3aec3e[_0xacd0('0x58')]=[{'all':!![]}];}return db[_0xacd0('0x9b')][_0xacd0('0x67')](_0x3aec3e);})[_0xacd0('0x35')](function(_0x4fc01c){_0x480057['rows']=_0x4fc01c;return _0x480057;});}})['then'](respondWithFilteredResult(_0x2220d7,_0x3aec3e))[_0xacd0('0x2b')](handleError(_0x2220d7,null));};exports[_0xacd0('0xa0')]=function(_0x42ea87,_0x4e154e,_0x54aec1){var _0x133f50,_0x100ae2={},_0x4337ab;if(_0x42ea87[_0xacd0('0x5e')]['to']){_0x4337ab=_0x42ea87[_0xacd0('0x5e')]['to'][_0xacd0('0x9d')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x42ea87[_0xacd0('0x5a')]['id']},'include':[{'model':db[_0xacd0('0xa1')],'as':_0xacd0('0xa2'),'include':[{'model':db[_0xacd0('0x8c')],'as':'Contacts','where':{'email':_0x4337ab},'limit':0x1,'order':[['updatedAt',_0xacd0('0xa3')]]}]},{'model':db[_0xacd0('0x3d')],'as':'Smtp','raw':!![]}]})[_0xacd0('0x35')](handleEntityNotFound(_0x4e154e,null))['then'](function(_0x41c7be){if(_0x41c7be){_0x133f50=_0x41c7be;if(_0x41c7be['Smtp']){if(_[_0xacd0('0x72')](_0x42ea87[_0xacd0('0x5e')][_0xacd0('0xa4')])){_0x42ea87[_0xacd0('0x5e')][_0xacd0('0xa4')]=util[_0xacd0('0x9e')]('%s\x20<%s>',_0x41c7be[_0xacd0('0x39')],_0x41c7be[_0xacd0('0x70')]||_0x41c7be[_0xacd0('0x3e')]['user']);}if(_0x42ea87[_0xacd0('0x5e')][_0xacd0('0xa5')]&&_0x42ea87[_0xacd0('0x5e')][_0xacd0('0xa5')][_0xacd0('0x5d')]){for(var _0x16a816=0x0;_0x16a816<_0x42ea87[_0xacd0('0x5e')]['attachments'][_0xacd0('0x5d')];_0x16a816+=0x1){_0x42ea87['body'][_0xacd0('0xa5')][_0x16a816]={'filename':_0x42ea87[_0xacd0('0x5e')]['attachments'][_0x16a816][_0xacd0('0x39')],'path':path[_0xacd0('0xa6')](config[_0xacd0('0xa7')],_0xacd0('0xa8'),_0x42ea87[_0xacd0('0x5e')][_0xacd0('0xa5')][_0x16a816]['basename'])};}}var _0x11df94={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x41c7be['Smtp'][_0xacd0('0x7a')])){if(_0x41c7be[_0xacd0('0x3e')][_0xacd0('0xa9')]){_0x11df94[_0xacd0('0xaa')]={'user':_0x41c7be[_0xacd0('0x3e')][_0xacd0('0x74')],'pass':_0x41c7be[_0xacd0('0x3e')][_0xacd0('0x77')]};}_0x11df94[_0xacd0('0x78')]=_0x41c7be['Smtp']['host'];_0x11df94[_0xacd0('0x79')]=_0x41c7be['Smtp'][_0xacd0('0x79')];_0x11df94[_0xacd0('0xab')]=_0x41c7be[_0xacd0('0x3e')][_0xacd0('0xab')];}else{_0x11df94['service']=_0x41c7be[_0xacd0('0x3e')]['service'];_0x11df94['auth']={'user':_0x41c7be[_0xacd0('0x3e')]['user'],'pass':_0x41c7be[_0xacd0('0x3e')][_0xacd0('0x77')]};}return respondWithRpcPromise(_0xacd0('0xac'),_0xacd0('0xad'),{'account':_0x11df94,'message':_0x42ea87[_0xacd0('0x5e')]});}else{throw new Error(_0xacd0('0xae'));}}})[_0xacd0('0x35')](function(_0x571cd9){if(_0x571cd9){_0x100ae2=_0x571cd9;if(_0x133f50[_0xacd0('0xa2')]){if(_0x133f50[_0xacd0('0xa2')][_0xacd0('0xaf')][_0xacd0('0x5d')]){return _0x133f50[_0xacd0('0xa2')][_0xacd0('0xaf')][0x0];}else{return db[_0xacd0('0x8c')]['create'](_[_0xacd0('0x1a')](_0x42ea87['body'],{'firstName':_0x42ea87[_0xacd0('0x5e')]['to'],'email':_0x42ea87['body']['to'],'phone':_0x42ea87[_0xacd0('0x5e')]['to'],'ListId':_0x133f50['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0xacd0('0x35')](function(_0x53d00c){if(_0x53d00c){var _0x424b20={'UserId':_0x42ea87['user']['id'],'ContactId':_0x53d00c['id'],'MailAccountId':_0x133f50['id'],'inReplyTo':_0x100ae2['messageId'],'to':_0x42ea87[_0xacd0('0x5e')]['from'],'cc':_0x42ea87[_0xacd0('0x5e')]['cc'],'subject':_0x42ea87['body']['subject'],'attach':_0x42ea87[_0xacd0('0x5e')][_0xacd0('0xb0')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xacd0('0x9e')](_0xacd0('0x9f')),'lastMsgDirection':_0xacd0('0xb1'),'lastMsgBody':_0x42ea87[_0xacd0('0x5e')]['body'],'Messages':[_['merge'](_0x42ea87['body'],{'messageId':_0x100ae2['messageId'],'sentAt':moment()['format'](_0xacd0('0x9f')),'read':!![],'MailAccountId':_0x133f50['id'],'UserId':_0x42ea87[_0xacd0('0x74')]['id'],'ContactId':_0x53d00c['id']})]};if(_0x42ea87['body'][_0xacd0('0xb2')]){_0x424b20=_[_0xacd0('0x53')](_0x424b20,_0x42ea87[_0xacd0('0x5e')][_0xacd0('0xb2')]);}return db[_0xacd0('0x8a')][_0xacd0('0x63')](_0x424b20,{'include':[{'model':db[_0xacd0('0x9b')],'as':_0xacd0('0xb3')}]});}})['then'](respondWithResult(_0x4e154e,null))[_0xacd0('0x2b')](handleError(_0x4e154e,null));};exports[_0xacd0('0xb4')]=function(_0x6891fd,_0x2a2bcf,_0x123b88){return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0x6891fd[_0xacd0('0x5a')]['id']},'include':[{'model':db[_0xacd0('0x3d')],'as':_0xacd0('0x3e'),'raw':!![]}]})[_0xacd0('0x35')](handleEntityNotFound(_0x2a2bcf,null))['then'](function(_0x47db06){if(_0x47db06&&_0x47db06['Smtp']){var _0x5ea462={'id':_0x47db06['id'],'tls':{'rejectUnauthorized':![]}};if(_0x47db06[_0xacd0('0x3e')]['service']){_0x5ea462[_0xacd0('0x7a')]=_0x47db06['Smtp'][_0xacd0('0x7a')];}else{_0x5ea462[_0xacd0('0x78')]=_0x47db06[_0xacd0('0x3e')]['host'];_0x5ea462['port']=_0x47db06[_0xacd0('0x3e')]['port'];_0x5ea462[_0xacd0('0xab')]=_0x47db06[_0xacd0('0x3e')][_0xacd0('0xab')];}if(_0x47db06['Smtp'][_0xacd0('0xa9')]){_0x5ea462['auth']={'user':_0x47db06[_0xacd0('0x3e')][_0xacd0('0x74')],'pass':_0x47db06[_0xacd0('0x3e')][_0xacd0('0x77')]};}return respondWithRpcPromise(_0xacd0('0xb5'),_0xacd0('0xb4'),{'account':_0x5ea462});}})['then'](respondWithResult(_0x2a2bcf,null))[_0xacd0('0x2b')](handleError(_0x2a2bcf,null));};exports[_0xacd0('0x36')]=function(_0xbc1a6,_0x3fd653){return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0xbc1a6[_0xacd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3fd653,null))[_0xacd0('0x35')](function(_0x504782){if(_0x504782&&_0x504782[_0xacd0('0x7a')]){throw new db[(_0xacd0('0xb6'))][(_0xacd0('0x20'))](_0xacd0('0xb7'));}return _0x504782;})[_0xacd0('0x35')](removeEntity(_0x3fd653,null))[_0xacd0('0x2b')](handleError(_0x3fd653,null));};exports[_0xacd0('0xb8')]=function(_0x456fe0,_0x27e85d,_0x21f615){return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0x456fe0[_0xacd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x27e85d,null))['then'](function(_0x4e57aa){if(_0x4e57aa){return _0x4e57aa[_0xacd0('0xb8')](_0x456fe0[_0xacd0('0x5e')][_0xacd0('0x6a')],_[_0xacd0('0x8b')](_0x456fe0['body'],[_0xacd0('0x6a'),'id'])||{})[_0xacd0('0xb9')](function(_0x5b9b9f){for(var _0x1e89bc=0x0;_0x1e89bc<_0x456fe0[_0xacd0('0x5e')]['ids'][_0xacd0('0x5d')];_0x1e89bc+=0x1){socket['emit'](_0xacd0('0xba'),{'UserId':_0x456fe0['body']['ids'][_0x1e89bc],'MailAccountId':_0x456fe0[_0xacd0('0x5a')]['id']});}return _0x5b9b9f;});}})[_0xacd0('0x35')](respondWithResult(_0x27e85d,null))[_0xacd0('0x2b')](handleError(_0x27e85d,null));};exports['removeAgents']=function(_0x2ad6ae,_0x121220,_0x10fd10){return db[_0xacd0('0x41')][_0xacd0('0x61')]({'where':{'id':_0x2ad6ae[_0xacd0('0x5a')]['id']}})[_0xacd0('0x35')](handleEntityNotFound(_0x121220,null))[_0xacd0('0x35')](function(_0x7938ba){if(_0x7938ba){return _0x7938ba[_0xacd0('0xbb')](_0x2ad6ae[_0xacd0('0x47')][_0xacd0('0x6a')])[_0xacd0('0x35')](function(){if(_[_0xacd0('0xbc')](_0x2ad6ae[_0xacd0('0x47')][_0xacd0('0x6a')])){for(var _0x52a5d4=0x0;_0x52a5d4<_0x2ad6ae[_0xacd0('0x47')][_0xacd0('0x6a')][_0xacd0('0x5d')];_0x52a5d4+=0x1){socket['emit'](_0xacd0('0xbd'),{'UserId':Number(_0x2ad6ae['query'][_0xacd0('0x6a')][_0x52a5d4]),'MailAccountId':Number(_0x2ad6ae[_0xacd0('0x5a')]['id'])});}}else{socket[_0xacd0('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x2ad6ae[_0xacd0('0x47')][_0xacd0('0x6a')]),'MailAccountId':Number(_0x2ad6ae[_0xacd0('0x5a')]['id'])});}});}})[_0xacd0('0x35')](respondWithStatusCode(_0x121220,null))['catch'](handleError(_0x121220,null));};exports[_0xacd0('0xbf')]=function(_0x10c21a,_0x421c77,_0x81a50e){var _0x2a4eae={};var _0x35d913={};var _0x2b75dd;var _0x977d52;return db[_0xacd0('0x41')][_0xacd0('0x6e')]({'where':{'id':_0x10c21a[_0xacd0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x421c77,null))[_0xacd0('0x35')](function(_0x13fe97){if(_0x13fe97){_0x2b75dd=_0x13fe97;_0x35d913[_0xacd0('0x46')]=_['keys'](db[_0xacd0('0x8d')][_0xacd0('0x42')]);_0x35d913[_0xacd0('0x47')]=_[_0xacd0('0x5b')](_0x10c21a['query']);_0x35d913['filters']=_[_0xacd0('0x5c')](_0x35d913[_0xacd0('0x46')],_0x35d913[_0xacd0('0x47')]);_0x2a4eae[_0xacd0('0x4a')]=_[_0xacd0('0x5c')](_0x35d913[_0xacd0('0x46')],qs[_0xacd0('0x49')](_0x10c21a['query'][_0xacd0('0x49')]));_0x2a4eae['attributes']=_0x2a4eae[_0xacd0('0x4a')][_0xacd0('0x5d')]?_0x2a4eae[_0xacd0('0x4a')]:_0x35d913[_0xacd0('0x46')];_0x2a4eae[_0xacd0('0x4e')]=qs[_0xacd0('0x4f')](_0x10c21a['query'][_0xacd0('0x4f')]);_0x2a4eae[_0xacd0('0x50')]=qs[_0xacd0('0x48')](_[_0xacd0('0x51')](_0x10c21a['query'],_0x35d913[_0xacd0('0x48')]));if(_0x10c21a[_0xacd0('0x47')][_0xacd0('0x52')]){_0x2a4eae[_0xacd0('0x50')]=_['merge'](_0x2a4eae[_0xacd0('0x50')],{'$or':_['map'](_0x2a4eae['attributes'],function(_0x596a14){var _0xa80ab7={};_0xa80ab7[_0x596a14]={'$like':'%'+_0x10c21a[_0xacd0('0x47')][_0xacd0('0x52')]+'%'};return _0xa80ab7;})});}_0x2a4eae=_[_0xacd0('0x53')]({},_0x2a4eae,_0x10c21a['options']);return _0x2b75dd[_0xacd0('0xbf')](_0x2a4eae);}})[_0xacd0('0x35')](function(_0x1cfc9a){if(_0x1cfc9a){_0x977d52=_0x1cfc9a[_0xacd0('0x5d')];if(!_0x10c21a[_0xacd0('0x47')][_0xacd0('0x4b')]('nolimit')){_0x2a4eae['limit']=qs[_0xacd0('0x4d')](_0x10c21a[_0xacd0('0x47')][_0xacd0('0x4d')]);_0x2a4eae[_0xacd0('0x30')]=qs[_0xacd0('0x30')](_0x10c21a[_0xacd0('0x47')][_0xacd0('0x30')]);}return _0x2b75dd[_0xacd0('0xbf')](_0x2a4eae);}})[_0xacd0('0x35')](function(_0x5d9dae){if(_0x5d9dae){return _0x5d9dae?{'count':_0x977d52,'rows':_0x5d9dae}:null;}})[_0xacd0('0x35')](respondWithResult(_0x421c77,null))[_0xacd0('0x2b')](handleError(_0x421c77,null));}; \ No newline at end of file +var _0xa0ee=['count','offset','Content-Range','reject','get','MailAccounts','destroy','stack','index','Imap','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','MailServerIn','Smtp','keys','find','update','body','MailServerOut','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','findAll','rows','removeDispositions','ids','CannedAnswer','nolimit','removeAnswers','email','ListId','isNil','active','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','send','Contacts','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','auth','secure','SendMail','List\x20not\x20found','List','messageId','subject','out','format','Interaction','Messages','VerifySmtp','verifySmtp','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json'];(function(_0x26cf74,_0x45c203){var _0x1659f3=function(_0x274e65){while(--_0x274e65){_0x26cf74['push'](_0x26cf74['shift']());}};_0x1659f3(++_0x45c203);}(_0xa0ee,0x144));var _0xea0e=function(_0x4ede04,_0x58132b){_0x4ede04=_0x4ede04-0x0;var _0x49ccfc=_0xa0ee[_0x4ede04];return _0x49ccfc;};'use strict';var pdf=require(_0xea0e('0x0'));var emlformat=require(_0xea0e('0x1'));var rimraf=require(_0xea0e('0x2'));var zipdir=require(_0xea0e('0x3'));var jsonpatch=require(_0xea0e('0x4'));var rp=require('request-promise');var moment=require(_0xea0e('0x5'));var BPromise=require(_0xea0e('0x6'));var Mustache=require(_0xea0e('0x7'));var util=require(_0xea0e('0x8'));var path=require('path');var sox=require(_0xea0e('0x9'));var csv=require(_0xea0e('0xa'));var ejs=require(_0xea0e('0xb'));var fs=require('fs');var _=require(_0xea0e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea0e('0xd'));var deskjs=require(_0xea0e('0xe'));var toCsv=require(_0xea0e('0xa'));var querystring=require(_0xea0e('0xf'));var Papa=require('papaparse');var Redis=require(_0xea0e('0x10'));var authService=require(_0xea0e('0x11'));var qs=require(_0xea0e('0x12'));var as=require(_0xea0e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea0e('0x14'))('api');var utils=require(_0xea0e('0x15'));var config=require('../../config/environment');var db=require(_0xea0e('0x16'))['db'];config[_0xea0e('0x17')]=_[_0xea0e('0x18')](config['redis'],{'host':_0xea0e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xea0e('0x1a'))[_0xea0e('0x1b')](socket);var jayson=require(_0xea0e('0x1c'));var client=jayson[_0xea0e('0x1d')][_0xea0e('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x5c4972,_0x15e12d,_0x29e361){if(_0x29e361){var _0x294bff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x294bff[_0xea0e('0x1f')](_0x15e12d)){return _0x5c4972;}else{throw new db[(_0xea0e('0x20'))]['ValidationError'](_0xea0e('0x21'));}}else{return _0x5c4972;}}function respondWithRpcPromise(_0x56f025,_0x59d58a,_0x6bf65,_0x107545){return new BPromise(function(_0x30fbd2,_0x322335){var _0x5f17e4=_0x107545||client;return _0x5f17e4[_0xea0e('0x22')](_0x56f025,_0x6bf65)[_0xea0e('0x23')](function(_0x5a1c02){logger[_0xea0e('0x24')]('MailAccount,\x20%s,\x20%s',_0x59d58a,_0xea0e('0x25'));logger[_0xea0e('0x26')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x59d58a,_0xea0e('0x25'),JSON['stringify'](_0x5a1c02));if(_0x5a1c02['error']){if(_0x5a1c02[_0xea0e('0x27')]['code']===0x1f4){logger[_0xea0e('0x27')](_0xea0e('0x28'),_0x59d58a,_0x5a1c02[_0xea0e('0x27')][_0xea0e('0x29')]);return _0x322335(_0x5a1c02[_0xea0e('0x27')][_0xea0e('0x29')]);}logger[_0xea0e('0x27')](_0xea0e('0x28'),_0x59d58a,_0x5a1c02[_0xea0e('0x27')]['message']);return _0x30fbd2(_0x5a1c02[_0xea0e('0x27')][_0xea0e('0x29')]);}else{logger[_0xea0e('0x24')](_0xea0e('0x28'),_0x59d58a,_0xea0e('0x25'));_0x30fbd2(_0x5a1c02[_0xea0e('0x2a')][_0xea0e('0x29')]);}})[_0xea0e('0x2b')](function(_0x42decf){logger[_0xea0e('0x27')]('MailAccount,\x20%s,\x20%s',_0x59d58a,_0x42decf);_0x322335(_0x42decf);});});}function respondWithStatusCode(_0x3dbb8d,_0x19e7fd){_0x19e7fd=_0x19e7fd||0xcc;return function(_0x411565){if(_0x411565){return _0x3dbb8d[_0xea0e('0x2c')](_0x19e7fd);}return _0x3dbb8d['status'](_0x19e7fd)[_0xea0e('0x2d')]();};}function respondWithResult(_0x2258ce,_0x458779){_0x458779=_0x458779||0xc8;return function(_0x37a199){if(_0x37a199){return _0x2258ce[_0xea0e('0x2e')](_0x458779)[_0xea0e('0x2f')](_0x37a199);}};}function respondWithFilteredResult(_0x17127e,_0x515bb9){return function(_0x1bdffe){if(_0x1bdffe){var _0x4766c9=_0x1bdffe[_0xea0e('0x30')],_0xe501ca=_0x515bb9[_0xea0e('0x31')],_0x5ac64e=_0x515bb9[_0xea0e('0x31')]+_0x515bb9['limit'],_0x414bbd;if(_0x5ac64e>=_0x4766c9){_0x5ac64e=_0x4766c9;_0x414bbd=0xc8;}else{_0x414bbd=0xce;}_0x17127e['status'](_0x414bbd);return _0x17127e['set'](_0xea0e('0x32'),_0xe501ca+'-'+_0x5ac64e+'/'+_0x4766c9)[_0xea0e('0x2f')](_0x1bdffe);}return null;};}function patchUpdates(_0xb1bc2e){return function(_0x35b12a){try{jsonpatch['apply'](_0x35b12a,_0xb1bc2e,!![]);}catch(_0x2cadf5){return BPromise[_0xea0e('0x33')](_0x2cadf5);}return _0x35b12a['save']();};}function saveUpdates(_0xc5bc00,_0x18bdae){return function(_0x327b77){if(_0x327b77){return _0x327b77['update'](_0xc5bc00)[_0xea0e('0x23')](function(_0x457dce){return _0x457dce;});}return null;};}function removeEntity(_0x3d1b77,_0x445d45){return function(_0x3e86f1){if(_0x3e86f1){return _0x3e86f1['destroy']()[_0xea0e('0x23')](function(){var _0x55024b=_0x3e86f1[_0xea0e('0x34')]({'plain':!![]});var _0x3bcd28=_0xea0e('0x35');return db['UserProfileResource'][_0xea0e('0x36')]({'where':{'type':_0x3bcd28,'resourceId':_0x55024b['id']}})[_0xea0e('0x23')](function(){return _0x3e86f1;});})['then'](function(){_0x3d1b77['status'](0xcc)[_0xea0e('0x2d')]();});}};}function handleEntityNotFound(_0x58d22b,_0x2da846){return function(_0x33d7e2){if(!_0x33d7e2){_0x58d22b[_0xea0e('0x2c')](0x194);}return _0x33d7e2;};}function handleError(_0x593f8e,_0x12beca){_0x12beca=_0x12beca||0x1f4;return function(_0x20884e){logger[_0xea0e('0x27')](_0x20884e[_0xea0e('0x37')]);if(_0x20884e['name']){delete _0x20884e['name'];}_0x593f8e[_0xea0e('0x2e')](_0x12beca)['send'](_0x20884e);};}exports[_0xea0e('0x38')]=function(_0x4c4737,_0x3ad3dc){var _0x4e585e={'include':[{'model':db['MailServerIn'],'as':_0xea0e('0x39')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xea0e('0x3a')],'as':_0xea0e('0x3b')}]},_0x24cc7e={},_0x448268={'count':0x0,'rows':[]};var _0x13bfa2=_[_0xea0e('0x3c')](db[_0xea0e('0x3d')][_0xea0e('0x3e')],function(_0x5738b3){return{'name':_0x5738b3[_0xea0e('0x3f')],'type':_0x5738b3[_0xea0e('0x40')][_0xea0e('0x41')]};});_0x24cc7e[_0xea0e('0x42')]=_[_0xea0e('0x3c')](_0x13bfa2,_0xea0e('0x43'));_0x24cc7e[_0xea0e('0x44')]=_['keys'](_0x4c4737[_0xea0e('0x44')]);_0x24cc7e[_0xea0e('0x45')]=_[_0xea0e('0x46')](_0x24cc7e['model'],_0x24cc7e[_0xea0e('0x44')]);_0x4e585e['attributes']=_[_0xea0e('0x46')](_0x24cc7e[_0xea0e('0x42')],qs['fields'](_0x4c4737[_0xea0e('0x44')][_0xea0e('0x47')]));_0x4e585e['attributes']=_0x4e585e[_0xea0e('0x48')][_0xea0e('0x49')]?_0x4e585e[_0xea0e('0x48')]:_0x24cc7e[_0xea0e('0x42')];if(!_0x4c4737['query']['hasOwnProperty']('nolimit')){_0x4e585e['limit']=qs[_0xea0e('0x4a')](_0x4c4737['query'][_0xea0e('0x4a')]);_0x4e585e[_0xea0e('0x31')]=qs[_0xea0e('0x31')](_0x4c4737[_0xea0e('0x44')][_0xea0e('0x31')]);}_0x4e585e[_0xea0e('0x4b')]=qs[_0xea0e('0x4c')](_0x4c4737[_0xea0e('0x44')]['sort']);_0x4e585e[_0xea0e('0x4d')]=qs['filters'](_[_0xea0e('0x4e')](_0x4c4737[_0xea0e('0x44')],_0x24cc7e[_0xea0e('0x45')]),_0x13bfa2);if(_0x4c4737[_0xea0e('0x44')][_0xea0e('0x4f')]){_0x4e585e['where']=_['merge'](_0x4e585e[_0xea0e('0x4d')],{'$or':_[_0xea0e('0x3c')](_0x13bfa2,function(_0x55b38d){if(_0x55b38d[_0xea0e('0x40')]!==_0xea0e('0x50')){var _0x5066e6={};_0x5066e6[_0x55b38d['name']]={'$like':'%'+_0x4c4737[_0xea0e('0x44')][_0xea0e('0x4f')]+'%'};return _0x5066e6;}})});}_0x4e585e=_[_0xea0e('0x51')]({},_0x4e585e,_0x4c4737[_0xea0e('0x52')]);var _0x2e8372={'where':_0x4e585e['where']};return db[_0xea0e('0x3d')][_0xea0e('0x30')](_0x2e8372)[_0xea0e('0x23')](function(_0x1ed881){_0x448268['count']=_0x1ed881;if(_0x4c4737['query'][_0xea0e('0x53')]){_0x4e585e[_0xea0e('0x54')]=[{'all':!![]}];}return db[_0xea0e('0x3d')]['findAll'](_0x4e585e);})[_0xea0e('0x23')](function(_0x8ca6f2){_0x448268['rows']=_0x8ca6f2;return _0x448268;})[_0xea0e('0x23')](respondWithFilteredResult(_0x3ad3dc,_0x4e585e))[_0xea0e('0x2b')](handleError(_0x3ad3dc,null));};exports[_0xea0e('0x55')]=function(_0x1f6122,_0x4f57a4){var _0xee7f15={'raw':![],'where':{'id':_0x1f6122[_0xea0e('0x56')]['id']},'include':[{'model':db[_0xea0e('0x57')],'as':_0xea0e('0x39')},{'model':db['MailServerOut'],'as':_0xea0e('0x58')},{'model':db[_0xea0e('0x3a')],'as':'mandatoryDispositionPause'}]},_0x285cc7={};_0x285cc7[_0xea0e('0x42')]=_[_0xea0e('0x59')](db['MailAccount'][_0xea0e('0x3e')]);_0x285cc7[_0xea0e('0x44')]=_[_0xea0e('0x59')](_0x1f6122[_0xea0e('0x44')]);_0x285cc7['filters']=_[_0xea0e('0x46')](_0x285cc7[_0xea0e('0x42')],_0x285cc7['query']);_0xee7f15[_0xea0e('0x48')]=_[_0xea0e('0x46')](_0x285cc7[_0xea0e('0x42')],qs[_0xea0e('0x47')](_0x1f6122[_0xea0e('0x44')]['fields']));_0xee7f15[_0xea0e('0x48')]=_0xee7f15[_0xea0e('0x48')][_0xea0e('0x49')]?_0xee7f15[_0xea0e('0x48')]:_0x285cc7[_0xea0e('0x42')];if(_0x1f6122[_0xea0e('0x44')][_0xea0e('0x53')]){_0xee7f15[_0xea0e('0x54')]=[{'all':!![]}];}_0xee7f15=_[_0xea0e('0x51')]({},_0xee7f15,_0x1f6122[_0xea0e('0x52')]);return db[_0xea0e('0x3d')][_0xea0e('0x5a')](_0xee7f15)[_0xea0e('0x23')](handleEntityNotFound(_0x4f57a4,null))['then'](respondWithResult(_0x4f57a4,null))[_0xea0e('0x2b')](handleError(_0x4f57a4,null));};exports[_0xea0e('0x5b')]=function(_0x14c956,_0x29601f){if(_0x14c956['body']['id']){delete _0x14c956[_0xea0e('0x5c')]['id'];}return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0x14c956[_0xea0e('0x56')]['id']},'include':[{'model':db[_0xea0e('0x57')],'as':_0xea0e('0x39')},{'model':db[_0xea0e('0x5d')],'as':_0xea0e('0x58')},{'model':db['Pause'],'as':_0xea0e('0x3b')}]})['then'](handleEntityNotFound(_0x29601f,null))[_0xea0e('0x23')](saveUpdates(_0x14c956[_0xea0e('0x5c')],null))['then'](function(_0x140f7e){if(_0x140f7e&&_0x14c956[_0xea0e('0x5c')][_0xea0e('0x39')]){return db[_0xea0e('0x57')][_0xea0e('0x5b')](_0x14c956['body'][_0xea0e('0x39')],{'where':{'MailAccountId':_0x140f7e['id']}})[_0xea0e('0x23')](function(){return _0x140f7e;});}return _0x140f7e;})[_0xea0e('0x23')](function(_0x28f0aa){if(_0x28f0aa&&_0x14c956['body'][_0xea0e('0x58')]){return db['MailServerOut'][_0xea0e('0x5b')](_0x14c956[_0xea0e('0x5c')][_0xea0e('0x58')],{'where':{'MailAccountId':_0x28f0aa['id']}})['then'](function(){return _0x28f0aa;});}return _0x28f0aa;})[_0xea0e('0x23')](respondWithResult(_0x29601f,null))[_0xea0e('0x2b')](handleError(_0x29601f,null));};exports[_0xea0e('0x5e')]=function(_0x1a366f,_0x36dfc1){return db[_0xea0e('0x3d')][_0xea0e('0x5e')]()['then'](respondWithResult(_0x36dfc1,null))[_0xea0e('0x2b')](handleError(_0x36dfc1,null));};exports[_0xea0e('0x5f')]=function(_0x1f51ca,_0x373243,_0xeb1208){if(_0x1f51ca[_0xea0e('0x5c')]['id']){delete _0x1f51ca[_0xea0e('0x5c')]['id'];}return db[_0xea0e('0x3d')]['find']({'where':{'id':_0x1f51ca[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x373243,null))[_0xea0e('0x23')](function(_0x4a3b2b){if(_0x4a3b2b){_0x1f51ca[_0xea0e('0x5c')][_0xea0e('0x60')]=_0x4a3b2b['id'];return db[_0xea0e('0x61')][_0xea0e('0x62')](_0x1f51ca[_0xea0e('0x5c')]);}})['then'](respondWithResult(_0x373243,null))['catch'](handleError(_0x373243,null));};exports[_0xea0e('0x63')]=function(_0x559093,_0x6e3420,_0x55d6da){var _0x51921f={'raw':![],'where':{}};var _0x51424b={};var _0xb7781f={'count':0x0,'rows':[]};return db['MailAccount'][_0xea0e('0x64')]({'where':{'id':_0x559093['params']['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x6e3420,null))[_0xea0e('0x23')](function(_0x3af7c4){if(_0x3af7c4){_0x51424b[_0xea0e('0x42')]=_[_0xea0e('0x59')](db['Disposition'][_0xea0e('0x3e')]);_0x51424b[_0xea0e('0x44')]=_[_0xea0e('0x59')](_0x559093['query']);_0x51424b[_0xea0e('0x45')]=_['intersection'](_0x51424b[_0xea0e('0x42')],_0x51424b[_0xea0e('0x44')]);_0x51921f[_0xea0e('0x48')]=_[_0xea0e('0x46')](_0x51424b[_0xea0e('0x42')],qs['fields'](_0x559093[_0xea0e('0x44')][_0xea0e('0x47')]));_0x51921f['attributes']=_0x51921f[_0xea0e('0x48')]['length']?_0x51921f['attributes']:_0x51424b['model'];if(!_0x559093[_0xea0e('0x44')][_0xea0e('0x65')]('nolimit')){_0x51921f[_0xea0e('0x4a')]=qs[_0xea0e('0x4a')](_0x559093[_0xea0e('0x44')][_0xea0e('0x4a')]);_0x51921f[_0xea0e('0x31')]=qs['offset'](_0x559093[_0xea0e('0x44')][_0xea0e('0x31')]);}_0x51921f['order']=qs[_0xea0e('0x4c')](_0x559093[_0xea0e('0x44')]['sort']);_0x51921f[_0xea0e('0x4d')]=qs[_0xea0e('0x45')](_[_0xea0e('0x4e')](_0x559093[_0xea0e('0x44')],_0x51424b[_0xea0e('0x45')]));_0x51921f[_0xea0e('0x4d')]['MailAccountId']=_0x3af7c4['id'];if(_0x559093['query']['filter']){_0x51921f[_0xea0e('0x4d')]=_[_0xea0e('0x51')](_0x51921f[_0xea0e('0x4d')],{'$or':_[_0xea0e('0x3c')](_0x51921f[_0xea0e('0x48')],function(_0x13e3cf){var _0x15aea6={};_0x15aea6[_0x13e3cf]={'$like':'%'+_0x559093['query'][_0xea0e('0x4f')]+'%'};return _0x15aea6;})});}_0x51921f=_[_0xea0e('0x51')]({},_0x51921f,_0x559093[_0xea0e('0x52')]);return db[_0xea0e('0x61')][_0xea0e('0x30')]({'where':_0x51921f[_0xea0e('0x4d')]})[_0xea0e('0x23')](function(_0x46e7c2){_0xb7781f[_0xea0e('0x30')]=_0x46e7c2;if(_0x559093[_0xea0e('0x44')][_0xea0e('0x53')]){_0x51921f[_0xea0e('0x54')]=[{'all':!![]}];}return db[_0xea0e('0x61')][_0xea0e('0x66')](_0x51921f);})['then'](function(_0x5776c9){_0xb7781f[_0xea0e('0x67')]=_0x5776c9;return _0xb7781f;});}})[_0xea0e('0x23')](respondWithFilteredResult(_0x6e3420,_0x51921f))[_0xea0e('0x2b')](handleError(_0x6e3420,null));};exports[_0xea0e('0x68')]=function(_0x289255,_0x45e8ec,_0xa40c07){return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0x289255[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x45e8ec,null))['then'](function(_0x5b116e){if(_0x5b116e){return _0x5b116e['removeDispositions'](_0x289255[_0xea0e('0x44')][_0xea0e('0x69')]);}})[_0xea0e('0x23')](respondWithStatusCode(_0x45e8ec,null))[_0xea0e('0x2b')](handleError(_0x45e8ec,null));};exports['addAnswer']=function(_0x40123e,_0x45e5bf,_0xe2766){if(_0x40123e['body']['id']){delete _0x40123e[_0xea0e('0x5c')]['id'];}return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0x40123e['params']['id']}})['then'](handleEntityNotFound(_0x45e5bf,null))[_0xea0e('0x23')](function(_0x2d8860){if(_0x2d8860){_0x40123e[_0xea0e('0x5c')][_0xea0e('0x60')]=_0x2d8860['id'];return db['CannedAnswer'][_0xea0e('0x62')](_0x40123e['body']);}})[_0xea0e('0x23')](respondWithResult(_0x45e5bf,null))[_0xea0e('0x2b')](handleError(_0x45e5bf,null));};exports['getAnswers']=function(_0x3eccbb,_0x5d828f,_0x28f5a9){var _0x2f7759={'raw':![],'where':{}};var _0x5e655f={};var _0x5c48fe={'count':0x0,'rows':[]};return db[_0xea0e('0x3d')]['findOne']({'where':{'id':_0x3eccbb[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x5d828f,null))[_0xea0e('0x23')](function(_0x5ab6c2){if(_0x5ab6c2){_0x5e655f[_0xea0e('0x42')]=_[_0xea0e('0x59')](db[_0xea0e('0x6a')][_0xea0e('0x3e')]);_0x5e655f['query']=_[_0xea0e('0x59')](_0x3eccbb[_0xea0e('0x44')]);_0x5e655f[_0xea0e('0x45')]=_[_0xea0e('0x46')](_0x5e655f[_0xea0e('0x42')],_0x5e655f['query']);_0x2f7759[_0xea0e('0x48')]=_[_0xea0e('0x46')](_0x5e655f[_0xea0e('0x42')],qs[_0xea0e('0x47')](_0x3eccbb[_0xea0e('0x44')]['fields']));_0x2f7759[_0xea0e('0x48')]=_0x2f7759[_0xea0e('0x48')]['length']?_0x2f7759['attributes']:_0x5e655f[_0xea0e('0x42')];if(!_0x3eccbb[_0xea0e('0x44')][_0xea0e('0x65')](_0xea0e('0x6b'))){_0x2f7759['limit']=qs[_0xea0e('0x4a')](_0x3eccbb[_0xea0e('0x44')]['limit']);_0x2f7759[_0xea0e('0x31')]=qs[_0xea0e('0x31')](_0x3eccbb['query'][_0xea0e('0x31')]);}_0x2f7759[_0xea0e('0x4b')]=qs[_0xea0e('0x4c')](_0x3eccbb[_0xea0e('0x44')][_0xea0e('0x4c')]);_0x2f7759[_0xea0e('0x4d')]=qs['filters'](_['pick'](_0x3eccbb[_0xea0e('0x44')],_0x5e655f[_0xea0e('0x45')]));_0x2f7759[_0xea0e('0x4d')][_0xea0e('0x60')]=_0x5ab6c2['id'];if(_0x3eccbb[_0xea0e('0x44')]['filter']){_0x2f7759[_0xea0e('0x4d')]=_[_0xea0e('0x51')](_0x2f7759[_0xea0e('0x4d')],{'$or':_['map'](_0x2f7759[_0xea0e('0x48')],function(_0x11c7b6){var _0x399f49={};_0x399f49[_0x11c7b6]={'$like':'%'+_0x3eccbb[_0xea0e('0x44')][_0xea0e('0x4f')]+'%'};return _0x399f49;})});}_0x2f7759=_[_0xea0e('0x51')]({},_0x2f7759,_0x3eccbb[_0xea0e('0x52')]);return db[_0xea0e('0x6a')]['count']({'where':_0x2f7759[_0xea0e('0x4d')]})[_0xea0e('0x23')](function(_0x1d9b2d){_0x5c48fe[_0xea0e('0x30')]=_0x1d9b2d;if(_0x3eccbb[_0xea0e('0x44')][_0xea0e('0x53')]){_0x2f7759[_0xea0e('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2f7759);})['then'](function(_0x27d3c4){_0x5c48fe['rows']=_0x27d3c4;return _0x5c48fe;});}})[_0xea0e('0x23')](respondWithFilteredResult(_0x5d828f,_0x2f7759))[_0xea0e('0x2b')](handleError(_0x5d828f,null));};exports[_0xea0e('0x6c')]=function(_0x21d2ec,_0x32bf59,_0x5591c3){return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0x21d2ec[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x32bf59,null))[_0xea0e('0x23')](function(_0x1712c1){if(_0x1712c1){return _0x1712c1['removeAnswers'](_0x21d2ec[_0xea0e('0x44')][_0xea0e('0x69')]);}})[_0xea0e('0x23')](respondWithStatusCode(_0x32bf59,null))[_0xea0e('0x2b')](handleError(_0x32bf59,null));};exports[_0xea0e('0x62')]=function(_0x48e439,_0xd57e25){var _0x51b8a8={'name':_0x48e439[_0xea0e('0x5c')][_0xea0e('0x43')],'key':_0x48e439[_0xea0e('0x5c')][_0xea0e('0x41')],'email':_0x48e439[_0xea0e('0x5c')][_0xea0e('0x6d')],'ListId':_0x48e439[_0xea0e('0x5c')][_0xea0e('0x6e')],'active':!_[_0xea0e('0x6f')](_0x48e439['body'][_0xea0e('0x70')])?_0x48e439['body'][_0xea0e('0x70')]:!![],'description':_0x48e439[_0xea0e('0x5c')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xea0e('0x6f')](_0x48e439[_0xea0e('0x5c')]['cservice'])){if(_0x48e439[_0xea0e('0x5c')][_0xea0e('0x71')]){_0x51b8a8[_0xea0e('0x39')][_0xea0e('0x72')]=_0x51b8a8[_0xea0e('0x58')][_0xea0e('0x72')]=_0x48e439[_0xea0e('0x5c')][_0xea0e('0x73')];_0x51b8a8[_0xea0e('0x39')][_0xea0e('0x74')]=_0x51b8a8[_0xea0e('0x58')][_0xea0e('0x75')]=_0x48e439['body'][_0xea0e('0x76')];}else{_0x51b8a8[_0xea0e('0x39')][_0xea0e('0x77')]=_0x51b8a8[_0xea0e('0x58')][_0xea0e('0x77')]=![];}_0x51b8a8[_0xea0e('0x39')]['host']=_0x48e439['body'][_0xea0e('0x39')][_0xea0e('0x78')];_0x51b8a8[_0xea0e('0x39')][_0xea0e('0x79')]=_0x48e439[_0xea0e('0x5c')][_0xea0e('0x39')][_0xea0e('0x79')];_0x51b8a8[_0xea0e('0x58')][_0xea0e('0x78')]=_0x48e439[_0xea0e('0x5c')][_0xea0e('0x58')][_0xea0e('0x78')];_0x51b8a8[_0xea0e('0x58')]['port']=_0x48e439[_0xea0e('0x5c')]['Smtp']['port'];}else{_0x51b8a8[_0xea0e('0x39')][_0xea0e('0x7a')]=_0x51b8a8['Smtp'][_0xea0e('0x7a')]=_0x48e439[_0xea0e('0x5c')]['cservice'];_0x51b8a8[_0xea0e('0x39')][_0xea0e('0x72')]=_0x51b8a8[_0xea0e('0x58')][_0xea0e('0x72')]=_0x48e439[_0xea0e('0x5c')][_0xea0e('0x73')];_0x51b8a8[_0xea0e('0x39')]['password']=_0x51b8a8[_0xea0e('0x58')]['pass']=_0x48e439[_0xea0e('0x5c')][_0xea0e('0x76')];}return db[_0xea0e('0x3d')][_0xea0e('0x62')](_0x51b8a8,{'include':[{'model':db[_0xea0e('0x5d')],'as':_0xea0e('0x58')},{'model':db[_0xea0e('0x57')],'as':_0xea0e('0x39')}]})[_0xea0e('0x23')](function(_0x1f4532){var _0x559895=_0x48e439['user']['get']({'plain':!![]});if(!_0x559895)throw new Error(_0xea0e('0x7b'));if(_0x559895[_0xea0e('0x7c')]===_0xea0e('0x72')){var _0x50b094=_0x1f4532[_0xea0e('0x34')]({'plain':!![]});return db[_0xea0e('0x7d')][_0xea0e('0x5a')]({'where':{'name':_0xea0e('0x35'),'userProfileId':_0x559895['userProfileId']},'raw':!![]})[_0xea0e('0x23')](function(_0x5e9075){if(_0x5e9075&&_0x5e9075[_0xea0e('0x7e')]===0x0){return db[_0xea0e('0x7f')][_0xea0e('0x62')]({'name':_0x50b094[_0xea0e('0x43')],'resourceId':_0x50b094['id'],'type':_0x5e9075[_0xea0e('0x43')],'sectionId':_0x5e9075['id']},{})[_0xea0e('0x23')](function(){return _0x1f4532;});}else{return _0x1f4532;}})[_0xea0e('0x2b')](function(_0x8d261d){logger[_0xea0e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8d261d);throw _0x8d261d;});}return _0x1f4532;})[_0xea0e('0x23')](respondWithResult(_0xd57e25,0xc9))[_0xea0e('0x2b')](handleError(_0xd57e25,null));};exports['getImap']=function(_0x117d93,_0x5099d0,_0x3278d3){return db[_0xea0e('0x3d')][_0xea0e('0x64')]({'where':{'id':_0x117d93[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x5099d0,null))['then'](function(_0x3942f0){if(_0x3942f0){return _0x3942f0[_0xea0e('0x80')]();}return null;})[_0xea0e('0x23')](respondWithResult(_0x5099d0,null))[_0xea0e('0x2b')](handleError(_0x5099d0,null));};exports[_0xea0e('0x81')]=function(_0xc78c81,_0x1d342a,_0x11c0ee){if(_0xc78c81['body']['id']){delete _0xc78c81[_0xea0e('0x5c')]['id'];}return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0xc78c81[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x1d342a,null))[_0xea0e('0x23')](function(_0x167d7c){if(_0x167d7c){_0xc78c81[_0xea0e('0x5c')][_0xea0e('0x60')]=_0x167d7c['id'];return db[_0xea0e('0x57')]['create'](_0xc78c81[_0xea0e('0x5c')]);}})[_0xea0e('0x23')](respondWithResult(_0x1d342a,null))[_0xea0e('0x2b')](handleError(_0x1d342a,null));};exports[_0xea0e('0x82')]=function(_0x4a4a04,_0x2794bd,_0xe5ad7a){return db['MailAccount'][_0xea0e('0x64')]({'where':{'id':_0x4a4a04['params']['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x2794bd,null))[_0xea0e('0x23')](function(_0x94f29f){if(_0x94f29f){return _0x94f29f[_0xea0e('0x83')](null);}return null;})[_0xea0e('0x23')](respondWithStatusCode(_0x2794bd,null))[_0xea0e('0x2b')](handleError(_0x2794bd,null));};exports['getSmtp']=function(_0x5d3264,_0x576688,_0x400286){return db[_0xea0e('0x3d')]['findOne']({'where':{'id':_0x5d3264['params']['id']}})['then'](handleEntityNotFound(_0x576688,null))[_0xea0e('0x23')](function(_0x4135b4){if(_0x4135b4){return _0x4135b4['getSmtp']();}return null;})[_0xea0e('0x23')](respondWithResult(_0x576688,null))[_0xea0e('0x2b')](handleError(_0x576688,null));};exports[_0xea0e('0x84')]=function(_0x553563,_0x4a1249,_0x1d1a22){if(_0x553563['body']['id']){delete _0x553563['body']['id'];}return db['MailAccount'][_0xea0e('0x5a')]({'where':{'id':_0x553563[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x4a1249,null))['then'](function(_0x287928){if(_0x287928){_0x553563[_0xea0e('0x5c')][_0xea0e('0x60')]=_0x287928['id'];return db[_0xea0e('0x5d')][_0xea0e('0x62')](_0x553563['body']);}})[_0xea0e('0x23')](respondWithResult(_0x4a1249,null))[_0xea0e('0x2b')](handleError(_0x4a1249,null));};exports[_0xea0e('0x85')]=function(_0x479e11,_0xeca22a,_0x1884af){return db[_0xea0e('0x3d')][_0xea0e('0x64')]({'where':{'id':_0x479e11[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0xeca22a,null))[_0xea0e('0x23')](function(_0x2dd413){if(_0x2dd413){return _0x2dd413[_0xea0e('0x86')](null);}return null;})['then'](respondWithStatusCode(_0xeca22a,null))[_0xea0e('0x2b')](handleError(_0xeca22a,null));};exports[_0xea0e('0x87')]=function(_0x34e908,_0x2c0edd,_0x364cae){return db[_0xea0e('0x88')][_0xea0e('0x5a')]({'where':{'id':_0x34e908[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x2c0edd,null))['then'](function(_0x1f80cc){if(_0x1f80cc){return _0x1f80cc[_0xea0e('0x87')](_0x34e908[_0xea0e('0x5c')]['ids'],_[_0xea0e('0x89')](_0x34e908['body'],['ids','id'])||{});}})[_0xea0e('0x23')](respondWithResult(_0x2c0edd,null))['catch'](handleError(_0x2c0edd,null));};exports[_0xea0e('0x8a')]=function(_0x2d4dc0,_0xae1385,_0x4af53c){var _0x528054={'raw':![],'where':{}};var _0x279bbe={};var _0x2c77af={'count':0x0,'rows':[]};return db[_0xea0e('0x3d')][_0xea0e('0x64')]({'where':{'id':_0x2d4dc0['params']['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0xae1385,null))[_0xea0e('0x23')](function(_0x37d320){if(_0x37d320){_0x279bbe[_0xea0e('0x42')]=_['keys'](db[_0xea0e('0x88')][_0xea0e('0x3e')]);_0x279bbe[_0xea0e('0x44')]=_['keys'](_0x2d4dc0['query']);_0x279bbe[_0xea0e('0x45')]=_[_0xea0e('0x46')](_0x279bbe[_0xea0e('0x42')],_0x279bbe['query']);_0x528054[_0xea0e('0x48')]=_['intersection'](_0x279bbe[_0xea0e('0x42')],qs[_0xea0e('0x47')](_0x2d4dc0['query'][_0xea0e('0x47')]));_0x528054[_0xea0e('0x48')]=_0x528054[_0xea0e('0x48')][_0xea0e('0x49')]?_0x528054[_0xea0e('0x48')]:_0x279bbe['model'];if(!_0x2d4dc0[_0xea0e('0x44')]['hasOwnProperty'](_0xea0e('0x6b'))){_0x528054['limit']=qs[_0xea0e('0x4a')](_0x2d4dc0[_0xea0e('0x44')][_0xea0e('0x4a')]);_0x528054[_0xea0e('0x31')]=qs['offset'](_0x2d4dc0[_0xea0e('0x44')]['offset']);}_0x528054[_0xea0e('0x4b')]=qs[_0xea0e('0x4c')](_0x2d4dc0['query'][_0xea0e('0x4c')]);_0x528054[_0xea0e('0x4d')]=qs[_0xea0e('0x45')](_[_0xea0e('0x4e')](_0x2d4dc0[_0xea0e('0x44')],_0x279bbe[_0xea0e('0x45')]));_0x528054[_0xea0e('0x4d')][_0xea0e('0x60')]=_0x37d320['id'];if(_0x2d4dc0[_0xea0e('0x44')][_0xea0e('0x4f')]){_0x528054[_0xea0e('0x4d')]=_[_0xea0e('0x51')](_0x528054[_0xea0e('0x4d')],{'$or':_[_0xea0e('0x3c')](_0x528054[_0xea0e('0x48')],function(_0x39dedb){var _0x391ef1={};_0x391ef1[_0x39dedb]={'$like':'%'+_0x2d4dc0[_0xea0e('0x44')][_0xea0e('0x4f')]+'%'};return _0x391ef1;})});}_0x528054=_['merge']({},_0x528054,_0x2d4dc0[_0xea0e('0x52')]);return db[_0xea0e('0x88')][_0xea0e('0x30')]({'where':_0x528054[_0xea0e('0x4d')]})[_0xea0e('0x23')](function(_0x3bbe42){_0x2c77af[_0xea0e('0x30')]=_0x3bbe42;if(_0x2d4dc0[_0xea0e('0x44')]['includeAll']){_0x528054[_0xea0e('0x54')]=[{'model':db[_0xea0e('0x8b')],'as':_0xea0e('0x8c'),'required':![]},{'model':db['User'],'as':_0xea0e('0x8d'),'attributes':[_0xea0e('0x43'),_0xea0e('0x8e'),_0xea0e('0x8f')],'required':![]},{'model':db[_0xea0e('0x90')],'as':'Tags','attributes':['id',_0xea0e('0x43'),_0xea0e('0x91')],'where':_0x2d4dc0[_0xea0e('0x44')][_0xea0e('0x92')]?{'id':_0x2d4dc0['query'][_0xea0e('0x92')]}:undefined,'required':_0x2d4dc0[_0xea0e('0x44')]['tag']?!![]:![]}];}return db[_0xea0e('0x88')][_0xea0e('0x66')](_0x528054);})[_0xea0e('0x23')](function(_0x4a87cb){_0x2c77af[_0xea0e('0x67')]=_0x4a87cb;return _0x2c77af;});}})['then'](respondWithFilteredResult(_0xae1385,_0x528054))['catch'](handleError(_0xae1385,null));};exports['addApplications']=function(_0x42214f,_0x5d4efc,_0x169811){return db[_0xea0e('0x3d')][_0xea0e('0x64')]({'where':{'id':_0x42214f[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x5d4efc,null))['then'](function(_0x418bfe){if(_0x418bfe){return db[_0xea0e('0x93')][_0xea0e('0x94')](function(_0x263f18){return db[_0xea0e('0x95')][_0xea0e('0x36')]({'where':{'MailAccountId':_0x42214f[_0xea0e('0x56')]['id']},'transaction':_0x263f18})[_0xea0e('0x23')](function(_0x2d9605){var _0x56e773=_['map'](_0x42214f[_0xea0e('0x5c')],function(_0x4863d7){_0x4863d7[_0xea0e('0x60')]=_0x42214f[_0xea0e('0x56')]['id'];return _0x4863d7;});return db[_0xea0e('0x95')][_0xea0e('0x96')](_0x56e773,{'transaction':_0x263f18});});})['then'](function(){return db[_0xea0e('0x95')][_0xea0e('0x97')]({'where':{'MailAccountId':_0x42214f[_0xea0e('0x56')]['id']},'order':'priority'});});}})[_0xea0e('0x23')](respondWithResult(_0x5d4efc,null))[_0xea0e('0x2b')](handleError(_0x5d4efc,null));};exports[_0xea0e('0x98')]=function(_0x2f43aa,_0x5b0699,_0x3db820){var _0x3b9a8a={};var _0x280355={};var _0x2f0cbe;var _0x3e856e;return db['MailAccount'][_0xea0e('0x64')]({'where':{'id':_0x2f43aa['params']['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x5b0699,null))[_0xea0e('0x23')](function(_0x485cc6){if(_0x485cc6){_0x2f0cbe=_0x485cc6;_0x280355[_0xea0e('0x42')]=_['keys'](db[_0xea0e('0x95')][_0xea0e('0x3e')]);_0x280355[_0xea0e('0x44')]=_[_0xea0e('0x59')](_0x2f43aa[_0xea0e('0x44')]);_0x280355[_0xea0e('0x45')]=_[_0xea0e('0x46')](_0x280355[_0xea0e('0x42')],_0x280355[_0xea0e('0x44')]);_0x3b9a8a[_0xea0e('0x48')]=_[_0xea0e('0x46')](_0x280355['model'],qs[_0xea0e('0x47')](_0x2f43aa[_0xea0e('0x44')][_0xea0e('0x47')]));_0x3b9a8a[_0xea0e('0x48')]=_0x3b9a8a[_0xea0e('0x48')][_0xea0e('0x49')]?_0x3b9a8a[_0xea0e('0x48')]:_0x280355[_0xea0e('0x42')];_0x3b9a8a[_0xea0e('0x4b')]=qs[_0xea0e('0x4c')](_0x2f43aa[_0xea0e('0x44')][_0xea0e('0x4c')]);_0x3b9a8a['where']=qs[_0xea0e('0x45')](_[_0xea0e('0x4e')](_0x2f43aa[_0xea0e('0x44')],_0x280355[_0xea0e('0x45')]));if(_0x2f43aa[_0xea0e('0x44')][_0xea0e('0x4f')]){_0x3b9a8a['where']=_[_0xea0e('0x51')](_0x3b9a8a[_0xea0e('0x4d')],{'$or':_[_0xea0e('0x3c')](_0x3b9a8a[_0xea0e('0x48')],function(_0x3e48b9){var _0x2696b6={};_0x2696b6[_0x3e48b9]={'$like':'%'+_0x2f43aa['query'][_0xea0e('0x4f')]+'%'};return _0x2696b6;})});}_0x3b9a8a=_[_0xea0e('0x51')]({},_0x3b9a8a,_0x2f43aa['options']);return _0x2f0cbe['getApplications'](_0x3b9a8a);}})[_0xea0e('0x23')](function(_0x45fcad){if(_0x45fcad){_0x3e856e=_0x45fcad[_0xea0e('0x49')];if(!_0x2f43aa['query'][_0xea0e('0x65')](_0xea0e('0x6b'))){_0x3b9a8a[_0xea0e('0x4a')]=qs['limit'](_0x2f43aa['query'][_0xea0e('0x4a')]);_0x3b9a8a[_0xea0e('0x31')]=qs[_0xea0e('0x31')](_0x2f43aa[_0xea0e('0x44')]['offset']);}return _0x2f0cbe[_0xea0e('0x98')](_0x3b9a8a);}})[_0xea0e('0x23')](function(_0x47993e){if(_0x47993e){return _0x47993e?{'count':_0x3e856e,'rows':_0x47993e}:null;}})[_0xea0e('0x23')](respondWithResult(_0x5b0699,null))['catch'](handleError(_0x5b0699,null));};exports[_0xea0e('0x99')]=function(_0x8d4f4d,_0x5042a5,_0x4ca9a3){var _0x5add23={'raw':!![],'where':{}};var _0x437819={};var _0xdc0537={'count':0x0,'rows':[]};return db[_0xea0e('0x3d')]['findOne']({'where':{'id':_0x8d4f4d[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x5042a5,null))[_0xea0e('0x23')](function(_0x523df8){if(_0x523df8){_0x437819[_0xea0e('0x42')]=_[_0xea0e('0x59')](db[_0xea0e('0x9a')][_0xea0e('0x3e')]);_0x437819[_0xea0e('0x44')]=_[_0xea0e('0x59')](_0x8d4f4d['query']);_0x437819[_0xea0e('0x45')]=_['intersection'](_0x437819[_0xea0e('0x42')],_0x437819[_0xea0e('0x44')]);_0x5add23[_0xea0e('0x48')]=_[_0xea0e('0x46')](_0x437819[_0xea0e('0x42')],qs[_0xea0e('0x47')](_0x8d4f4d['query'][_0xea0e('0x47')]));_0x5add23[_0xea0e('0x48')]=_0x5add23['attributes'][_0xea0e('0x49')]?_0x5add23['attributes']:_0x437819[_0xea0e('0x42')];if(!_0x8d4f4d[_0xea0e('0x44')]['hasOwnProperty'](_0xea0e('0x6b'))){_0x5add23['limit']=qs['limit'](_0x8d4f4d[_0xea0e('0x44')][_0xea0e('0x4a')]);_0x5add23[_0xea0e('0x31')]=qs[_0xea0e('0x31')](_0x8d4f4d[_0xea0e('0x44')][_0xea0e('0x31')]);}_0x5add23['order']=qs['sort'](_0x8d4f4d[_0xea0e('0x44')][_0xea0e('0x4c')]);_0x5add23['where']=qs[_0xea0e('0x45')](_['pick'](_0x8d4f4d[_0xea0e('0x44')],_0x437819['filters']));_0x5add23[_0xea0e('0x4d')][_0xea0e('0x60')]=_0x523df8['id'];if(_0x8d4f4d['query'][_0xea0e('0x4f')]){_0x5add23[_0xea0e('0x4d')]=_[_0xea0e('0x51')](_0x5add23[_0xea0e('0x4d')],{'$or':_[_0xea0e('0x3c')](_0x5add23['attributes'],function(_0x4aa361){var _0x3a358f={};_0x3a358f[_0x4aa361]={'$like':'%'+_0x8d4f4d[_0xea0e('0x44')][_0xea0e('0x4f')]+'%'};return _0x3a358f;})});}if(_0x8d4f4d[_0xea0e('0x44')]['$gte']){var _0x323a03=_0x8d4f4d['query'][_0xea0e('0x9b')][_0xea0e('0x9c')](',');var _0x35e658={};_0x35e658[_0x323a03[0x0]]={'$gte':moment(_0x323a03[0x1])['format'](_0xea0e('0x9d'))};_0x5add23[_0xea0e('0x4d')]=_['merge'](_0x5add23[_0xea0e('0x4d')],_0x35e658);}_0x5add23=_[_0xea0e('0x51')]({},_0x5add23,_0x8d4f4d[_0xea0e('0x52')]);return db[_0xea0e('0x9a')][_0xea0e('0x30')]({'where':_0x5add23[_0xea0e('0x4d')]})[_0xea0e('0x23')](function(_0x261da6){_0xdc0537[_0xea0e('0x30')]=_0x261da6;if(_0x8d4f4d['query'][_0xea0e('0x53')]){_0x5add23[_0xea0e('0x54')]=[{'all':!![]}];}return db[_0xea0e('0x9a')][_0xea0e('0x66')](_0x5add23);})['then'](function(_0x4b2c5a){_0xdc0537[_0xea0e('0x67')]=_0x4b2c5a;return _0xdc0537;});}})[_0xea0e('0x23')](respondWithFilteredResult(_0x5042a5,_0x5add23))['catch'](handleError(_0x5042a5,null));};exports[_0xea0e('0x9e')]=function(_0x56711f,_0x3eb480,_0x4ed227){var _0x3fef20,_0x884ab3={},_0x22cae9;if(_0x56711f[_0xea0e('0x5c')]['to']){_0x22cae9=_0x56711f[_0xea0e('0x5c')]['to'][_0xea0e('0x9c')](',')[0x0];}return db[_0xea0e('0x3d')]['find']({'where':{'id':_0x56711f[_0xea0e('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xea0e('0x9f'),'where':{'email':_0x22cae9},'limit':0x1,'order':[['updatedAt',_0xea0e('0xa0')]]}]},{'model':db['MailServerOut'],'as':_0xea0e('0x58'),'raw':!![]}]})[_0xea0e('0x23')](handleEntityNotFound(_0x3eb480,null))[_0xea0e('0x23')](function(_0x46746b){if(_0x46746b){_0x3fef20=_0x46746b;if(_0x46746b[_0xea0e('0x58')]){if(_[_0xea0e('0x6f')](_0x56711f[_0xea0e('0x5c')][_0xea0e('0xa1')])){_0x56711f[_0xea0e('0x5c')]['from']=util['format'](_0xea0e('0xa2'),_0x46746b[_0xea0e('0x43')],_0x46746b['email']||_0x46746b[_0xea0e('0x58')][_0xea0e('0x72')]);}if(_0x56711f['body'][_0xea0e('0xa3')]&&_0x56711f[_0xea0e('0x5c')][_0xea0e('0xa3')]['length']){for(var _0x2dd78c=0x0;_0x2dd78c<_0x56711f[_0xea0e('0x5c')]['attachments'][_0xea0e('0x49')];_0x2dd78c+=0x1){_0x56711f[_0xea0e('0x5c')]['attachments'][_0x2dd78c]={'filename':_0x56711f[_0xea0e('0x5c')][_0xea0e('0xa3')][_0x2dd78c][_0xea0e('0x43')],'path':path['join'](config[_0xea0e('0xa4')],_0xea0e('0xa5'),_0x56711f[_0xea0e('0x5c')]['attachments'][_0x2dd78c]['basename'])};}}var _0xa8362c={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x46746b['Smtp'][_0xea0e('0x7a')])){if(_0x46746b['Smtp'][_0xea0e('0x77')]){_0xa8362c[_0xea0e('0xa6')]={'user':_0x46746b['Smtp'][_0xea0e('0x72')],'pass':_0x46746b[_0xea0e('0x58')][_0xea0e('0x75')]};}_0xa8362c[_0xea0e('0x78')]=_0x46746b[_0xea0e('0x58')][_0xea0e('0x78')];_0xa8362c[_0xea0e('0x79')]=_0x46746b[_0xea0e('0x58')]['port'];_0xa8362c[_0xea0e('0xa7')]=_0x46746b[_0xea0e('0x58')]['secure'];}else{_0xa8362c[_0xea0e('0x7a')]=_0x46746b[_0xea0e('0x58')]['service'];_0xa8362c[_0xea0e('0xa6')]={'user':_0x46746b['Smtp'][_0xea0e('0x72')],'pass':_0x46746b[_0xea0e('0x58')][_0xea0e('0x75')]};}return respondWithRpcPromise(_0xea0e('0xa8'),'sendMail',{'account':_0xa8362c,'message':_0x56711f['body']});}else{throw new Error(_0xea0e('0xa9'));}}})[_0xea0e('0x23')](function(_0x179d55){if(_0x179d55){_0x884ab3=_0x179d55;if(_0x3fef20[_0xea0e('0xaa')]){if(_0x3fef20[_0xea0e('0xaa')][_0xea0e('0x9f')][_0xea0e('0x49')]){return _0x3fef20[_0xea0e('0xaa')][_0xea0e('0x9f')][0x0];}else{return db[_0xea0e('0x8b')][_0xea0e('0x62')](_[_0xea0e('0x18')](_0x56711f['body'],{'firstName':_0x56711f[_0xea0e('0x5c')]['to'],'email':_0x56711f[_0xea0e('0x5c')]['to'],'phone':_0x56711f['body']['to'],'ListId':_0x3fef20[_0xea0e('0x6e')]}));}}else{throw new Error(_0xea0e('0xa9'));}}})['then'](function(_0x4f0c6c){if(_0x4f0c6c){var _0x46d434={'UserId':_0x56711f[_0xea0e('0x72')]['id'],'ContactId':_0x4f0c6c['id'],'MailAccountId':_0x3fef20['id'],'inReplyTo':_0x884ab3[_0xea0e('0xab')],'to':_0x56711f[_0xea0e('0x5c')][_0xea0e('0xa1')],'cc':_0x56711f[_0xea0e('0x5c')]['cc'],'subject':_0x56711f['body'][_0xea0e('0xac')],'attach':_0x56711f[_0xea0e('0x5c')]['attach'],'firstMsgDirection':_0xea0e('0xad'),'lastMsgAt':moment()[_0xea0e('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xea0e('0xad'),'lastMsgBody':_0x56711f[_0xea0e('0x5c')][_0xea0e('0x5c')],'Messages':[_[_0xea0e('0x51')](_0x56711f[_0xea0e('0x5c')],{'messageId':_0x884ab3[_0xea0e('0xab')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3fef20['id'],'UserId':_0x56711f[_0xea0e('0x72')]['id'],'ContactId':_0x4f0c6c['id']})]};if(_0x56711f[_0xea0e('0x5c')][_0xea0e('0xaf')]){_0x46d434=_[_0xea0e('0x51')](_0x46d434,_0x56711f['body'][_0xea0e('0xaf')]);}return db['MailInteraction'][_0xea0e('0x62')](_0x46d434,{'include':[{'model':db[_0xea0e('0x9a')],'as':_0xea0e('0xb0')}]});}})[_0xea0e('0x23')](respondWithResult(_0x3eb480,null))['catch'](handleError(_0x3eb480,null));};exports['verifySmtp']=function(_0x2d453c,_0x5a5b71,_0x4751c4){return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0x2d453c[_0xea0e('0x56')]['id']},'include':[{'model':db[_0xea0e('0x5d')],'as':_0xea0e('0x58'),'raw':!![]}]})[_0xea0e('0x23')](handleEntityNotFound(_0x5a5b71,null))[_0xea0e('0x23')](function(_0x32eeb9){if(_0x32eeb9&&_0x32eeb9['Smtp']){var _0x176b0b={'id':_0x32eeb9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x32eeb9[_0xea0e('0x58')][_0xea0e('0x7a')]){_0x176b0b['service']=_0x32eeb9[_0xea0e('0x58')][_0xea0e('0x7a')];}else{_0x176b0b[_0xea0e('0x78')]=_0x32eeb9[_0xea0e('0x58')][_0xea0e('0x78')];_0x176b0b[_0xea0e('0x79')]=_0x32eeb9[_0xea0e('0x58')][_0xea0e('0x79')];_0x176b0b[_0xea0e('0xa7')]=_0x32eeb9['Smtp']['secure'];}if(_0x32eeb9['Smtp'][_0xea0e('0x77')]){_0x176b0b[_0xea0e('0xa6')]={'user':_0x32eeb9['Smtp'][_0xea0e('0x72')],'pass':_0x32eeb9['Smtp'][_0xea0e('0x75')]};}return respondWithRpcPromise(_0xea0e('0xb1'),_0xea0e('0xb2'),{'account':_0x176b0b});}})[_0xea0e('0x23')](respondWithResult(_0x5a5b71,null))['catch'](handleError(_0x5a5b71,null));};exports[_0xea0e('0x36')]=function(_0x3991e1,_0x33e439){return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0x3991e1[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x33e439,null))[_0xea0e('0x23')](function(_0x2208bd){if(_0x2208bd&&_0x2208bd[_0xea0e('0x7a')]){throw new db['Sequelize']['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2208bd;})[_0xea0e('0x23')](removeEntity(_0x33e439,null))[_0xea0e('0x2b')](handleError(_0x33e439,null));};exports[_0xea0e('0xb3')]=function(_0x8fec4b,_0x53b5f2,_0x4ca851){return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0x8fec4b[_0xea0e('0x56')]['id']}})['then'](handleEntityNotFound(_0x53b5f2,null))[_0xea0e('0x23')](function(_0x50e189){if(_0x50e189){return _0x50e189['addAgents'](_0x8fec4b[_0xea0e('0x5c')][_0xea0e('0x69')],_[_0xea0e('0x89')](_0x8fec4b[_0xea0e('0x5c')],[_0xea0e('0x69'),'id'])||{})[_0xea0e('0xb4')](function(_0x2a5bfa){for(var _0x19fa1a=0x0;_0x19fa1a<_0x8fec4b['body'][_0xea0e('0x69')][_0xea0e('0x49')];_0x19fa1a+=0x1){socket[_0xea0e('0xb5')](_0xea0e('0xb6'),{'UserId':_0x8fec4b[_0xea0e('0x5c')][_0xea0e('0x69')][_0x19fa1a],'MailAccountId':_0x8fec4b[_0xea0e('0x56')]['id']});}return _0x2a5bfa;});}})[_0xea0e('0x23')](respondWithResult(_0x53b5f2,null))['catch'](handleError(_0x53b5f2,null));};exports[_0xea0e('0xb7')]=function(_0xd10003,_0x3c2cc2,_0x35609d){return db[_0xea0e('0x3d')][_0xea0e('0x5a')]({'where':{'id':_0xd10003[_0xea0e('0x56')]['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x3c2cc2,null))[_0xea0e('0x23')](function(_0x3a7830){if(_0x3a7830){return _0x3a7830['removeAgents'](_0xd10003[_0xea0e('0x44')][_0xea0e('0x69')])[_0xea0e('0x23')](function(){if(_['isArray'](_0xd10003[_0xea0e('0x44')][_0xea0e('0x69')])){for(var _0x59074d=0x0;_0x59074d<_0xd10003['query']['ids']['length'];_0x59074d+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0xd10003[_0xea0e('0x44')][_0xea0e('0x69')][_0x59074d]),'MailAccountId':Number(_0xd10003[_0xea0e('0x56')]['id'])});}}else{socket[_0xea0e('0xb5')](_0xea0e('0xb8'),{'UserId':Number(_0xd10003[_0xea0e('0x44')]['ids']),'MailAccountId':Number(_0xd10003[_0xea0e('0x56')]['id'])});}});}})[_0xea0e('0x23')](respondWithStatusCode(_0x3c2cc2,null))[_0xea0e('0x2b')](handleError(_0x3c2cc2,null));};exports[_0xea0e('0xb9')]=function(_0x33ef6c,_0x271ab7,_0x679a03){var _0x579219={};var _0x13ffb7={};var _0x43a37e;var _0x56d3c3;return db[_0xea0e('0x3d')][_0xea0e('0x64')]({'where':{'id':_0x33ef6c['params']['id']}})[_0xea0e('0x23')](handleEntityNotFound(_0x271ab7,null))[_0xea0e('0x23')](function(_0x234290){if(_0x234290){_0x43a37e=_0x234290;_0x13ffb7[_0xea0e('0x42')]=_[_0xea0e('0x59')](db['User'][_0xea0e('0x3e')]);_0x13ffb7[_0xea0e('0x44')]=_[_0xea0e('0x59')](_0x33ef6c[_0xea0e('0x44')]);_0x13ffb7['filters']=_[_0xea0e('0x46')](_0x13ffb7[_0xea0e('0x42')],_0x13ffb7['query']);_0x579219[_0xea0e('0x48')]=_[_0xea0e('0x46')](_0x13ffb7[_0xea0e('0x42')],qs[_0xea0e('0x47')](_0x33ef6c[_0xea0e('0x44')][_0xea0e('0x47')]));_0x579219[_0xea0e('0x48')]=_0x579219[_0xea0e('0x48')][_0xea0e('0x49')]?_0x579219['attributes']:_0x13ffb7[_0xea0e('0x42')];_0x579219[_0xea0e('0x4b')]=qs[_0xea0e('0x4c')](_0x33ef6c['query'][_0xea0e('0x4c')]);_0x579219[_0xea0e('0x4d')]=qs[_0xea0e('0x45')](_[_0xea0e('0x4e')](_0x33ef6c['query'],_0x13ffb7[_0xea0e('0x45')]));if(_0x33ef6c[_0xea0e('0x44')][_0xea0e('0x4f')]){_0x579219[_0xea0e('0x4d')]=_[_0xea0e('0x51')](_0x579219[_0xea0e('0x4d')],{'$or':_['map'](_0x579219['attributes'],function(_0x9ad23c){var _0x521b86={};_0x521b86[_0x9ad23c]={'$like':'%'+_0x33ef6c[_0xea0e('0x44')][_0xea0e('0x4f')]+'%'};return _0x521b86;})});}_0x579219=_[_0xea0e('0x51')]({},_0x579219,_0x33ef6c[_0xea0e('0x52')]);return _0x43a37e['getAgents'](_0x579219);}})[_0xea0e('0x23')](function(_0x5f3ec5){if(_0x5f3ec5){_0x56d3c3=_0x5f3ec5[_0xea0e('0x49')];if(!_0x33ef6c['query'][_0xea0e('0x65')](_0xea0e('0x6b'))){_0x579219[_0xea0e('0x4a')]=qs[_0xea0e('0x4a')](_0x33ef6c[_0xea0e('0x44')][_0xea0e('0x4a')]);_0x579219[_0xea0e('0x31')]=qs[_0xea0e('0x31')](_0x33ef6c[_0xea0e('0x44')]['offset']);}return _0x43a37e['getAgents'](_0x579219);}})['then'](function(_0x1ce317){if(_0x1ce317){return _0x1ce317?{'count':_0x56d3c3,'rows':_0x1ce317}:null;}})[_0xea0e('0x23')](respondWithResult(_0x271ab7,null))['catch'](handleError(_0x271ab7,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6c95f69..b56c612 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 _0x012a=['MailAccount','setMaxListeners','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2dca6b,_0x36779b){var _0x51914a=function(_0x2614fc){while(--_0x2614fc){_0x2dca6b['push'](_0x2dca6b['shift']());}};_0x51914a(++_0x36779b);}(_0x012a,0x156));var _0xa012=function(_0x152b99,_0x43cd30){_0x152b99=_0x152b99-0x0;var _0x387eb2=_0x012a[_0x152b99];return _0x387eb2;};'use strict';var EventEmitter=require(_0xa012('0x0'));var MailAccount=require(_0xa012('0x1'))['db'][_0xa012('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa012('0x3')](0x0);var events={'afterCreate':_0xa012('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4c87f5){return function(_0x4d55b0,_0x299117,_0x1a870a){MailAccountEvents['emit'](_0x4c87f5+':'+_0x4d55b0['id'],_0x4d55b0);MailAccountEvents[_0xa012('0x5')](_0x4c87f5,_0x4d55b0);_0x1a870a(null);};}for(var e in events){if(events[_0xa012('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xa012('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x4f1d=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4f1d,0x70));var _0xd4f1=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x4f1d[_0x16dbcd];return _0x34706e;};'use strict';var EventEmitter=require(_0xd4f1('0x0'));var MailAccount=require(_0xd4f1('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd4f1('0x2')](0x0);var events={'afterCreate':_0xd4f1('0x3'),'afterUpdate':_0xd4f1('0x4'),'afterDestroy':_0xd4f1('0x5')};function emitEvent(_0x39adbe){return function(_0x1b0896,_0x16a971,_0x5aa410){MailAccountEvents['emit'](_0x39adbe+':'+_0x1b0896['id'],_0x1b0896);MailAccountEvents[_0xd4f1('0x6')](_0x39adbe,_0x1b0896);_0x5aa410(null);};}for(var e in events){if(events[_0xd4f1('0x7')](e)){var event=events[e];MailAccount[_0xd4f1('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2e9d6ef..4d792d2 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 _0x0af9=['../../config/environment','./mailAccount.attributes','exports','define','MailAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xc864d,_0x3443f2){var _0x4a1305=function(_0x162dd6){while(--_0x162dd6){_0xc864d['push'](_0xc864d['shift']());}};_0x4a1305(++_0x3443f2);}(_0x0af9,0xb9));var _0x90af=function(_0x5622cd,_0x7d59ba){_0x5622cd=_0x5622cd-0x0;var _0x43ae05=_0x0af9[_0x5622cd];return _0x43ae05;};'use strict';var _=require(_0x90af('0x0'));var util=require(_0x90af('0x1'));var logger=require(_0x90af('0x2'))(_0x90af('0x3'));var moment=require('moment');var BPromise=require(_0x90af('0x4'));var rp=require(_0x90af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90af('0x6'));var config=require(_0x90af('0x7'));var attributes=require(_0x90af('0x8'));module[_0x90af('0x9')]=function(_0x2ddc2a,_0x29a4c7){return _0x2ddc2a[_0x90af('0xa')](_0x90af('0xb'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc698=['mail_accounts','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','MailAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc698,0x85));var _0x8c69=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xc698[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x8c69('0x0'));var util=require(_0x8c69('0x1'));var logger=require(_0x8c69('0x2'))(_0x8c69('0x3'));var moment=require(_0x8c69('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c69('0x5'));var rimraf=require('rimraf');var config=require(_0x8c69('0x6'));var attributes=require('./mailAccount.attributes');module[_0x8c69('0x7')]=function(_0x5e8069,_0x5c0109){return _0x5e8069[_0x8c69('0x8')](_0x8c69('0x9'),attributes,{'tableName':_0x8c69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 9d659e4..5bb6659 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 _0xcee0=['Applications','MailServerOut','account','omit','applications','list','orderBy','priority','push','close','autoclose','*,*,*,*','length','defaults','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','interaction','get','created','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailAccount','findAll','options','raw','where','attributes','include','model','map','GetMailAccount','ShowMailAccount','find','then','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','MailApplication'];(function(_0x203981,_0x4edaad){var _0x1bb867=function(_0x4e4074){while(--_0x4e4074){_0x203981['push'](_0x203981['shift']());}};_0x1bb867(++_0x4edaad);}(_0xcee0,0x1e1));var _0x0cee=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0xcee0[_0x3e0763];return _0x351ca2;};'use strict';var _=require(_0x0cee('0x0'));var util=require(_0x0cee('0x1'));var moment=require(_0x0cee('0x2'));var BPromise=require(_0x0cee('0x3'));var rs=require(_0x0cee('0x4'));var fs=require('fs');var Redis=require(_0x0cee('0x5'));var db=require(_0x0cee('0x6'))['db'];var utils=require(_0x0cee('0x7'));var logger=require(_0x0cee('0x8'))('rpc');var config=require(_0x0cee('0x9'));var jayson=require(_0x0cee('0xa'));var client=jayson[_0x0cee('0xb')][_0x0cee('0xc')]({'port':0x232c});config[_0x0cee('0xd')]=_['defaults'](config[_0x0cee('0xd')],{'host':_0x0cee('0xe'),'port':0x18eb});var socket=require(_0x0cee('0xf'))(new Redis(config[_0x0cee('0xd')]));require(_0x0cee('0x10'))[_0x0cee('0x11')](socket);function respondWithRpcPromise(_0x21e244,_0x1a57fd,_0x3c35f0){return new BPromise(function(_0x24be79,_0x26ad5a){return client[_0x0cee('0x12')](_0x21e244,_0x3c35f0)['then'](function(_0x6dd05f){logger[_0x0cee('0x13')](_0x0cee('0x14'),_0x1a57fd,_0x0cee('0x15'));logger[_0x0cee('0x16')](_0x0cee('0x17'),_0x1a57fd,_0x0cee('0x15'),JSON[_0x0cee('0x18')](_0x6dd05f));if(_0x6dd05f['error']){if(_0x6dd05f[_0x0cee('0x19')][_0x0cee('0x1a')]===0x1f4){logger[_0x0cee('0x19')](_0x0cee('0x14'),_0x1a57fd,_0x6dd05f[_0x0cee('0x19')][_0x0cee('0x1b')]);return _0x26ad5a(_0x6dd05f[_0x0cee('0x19')][_0x0cee('0x1b')]);}logger['error'](_0x0cee('0x14'),_0x1a57fd,_0x6dd05f[_0x0cee('0x19')][_0x0cee('0x1b')]);return _0x24be79(_0x6dd05f[_0x0cee('0x19')][_0x0cee('0x1b')]);}else{logger[_0x0cee('0x13')](_0x0cee('0x14'),_0x1a57fd,_0x0cee('0x15'));_0x24be79(_0x6dd05f[_0x0cee('0x1c')]['message']);}})[_0x0cee('0x1d')](function(_0x5a1fc7){logger[_0x0cee('0x19')](_0x0cee('0x14'),_0x1a57fd,_0x5a1fc7);_0x26ad5a(_0x5a1fc7);});});}exports['GetMailAccount']=function(_0x280698){var _0x46cd4c=this;return new Promise(function(_0x4213bc,_0x1e4e17){return db[_0x0cee('0x1e')][_0x0cee('0x1f')]({'raw':_0x280698[_0x0cee('0x20')]?_0x280698[_0x0cee('0x20')][_0x0cee('0x21')]===undefined?!![]:![]:!![],'where':_0x280698[_0x0cee('0x20')]?_0x280698[_0x0cee('0x20')][_0x0cee('0x22')]||null:null,'attributes':_0x280698[_0x0cee('0x20')]?_0x280698['options'][_0x0cee('0x23')]||null:null,'limit':_0x280698[_0x0cee('0x20')]?_0x280698['options']['limit']||null:null,'include':_0x280698[_0x0cee('0x20')]?_0x280698[_0x0cee('0x20')][_0x0cee('0x24')]?_['map'](_0x280698[_0x0cee('0x20')][_0x0cee('0x24')],function(_0x411c76){return{'model':db[_0x411c76[_0x0cee('0x25')]],'as':_0x411c76['as'],'attributes':_0x411c76[_0x0cee('0x23')],'include':_0x411c76[_0x0cee('0x24')]?_[_0x0cee('0x26')](_0x411c76[_0x0cee('0x24')],function(_0x260349){return{'model':db[_0x260349['model']],'as':_0x260349['as'],'attributes':_0x260349[_0x0cee('0x23')],'include':_0x260349[_0x0cee('0x24')]?_['map'](_0x260349[_0x0cee('0x24')],function(_0x3b59eb){return{'model':db[_0x3b59eb[_0x0cee('0x25')]],'as':_0x3b59eb['as'],'attributes':_0x3b59eb[_0x0cee('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a1d96){logger[_0x0cee('0x13')](_0x0cee('0x27'),_0x280698);logger[_0x0cee('0x16')](_0x0cee('0x27'),_0x280698,JSON[_0x0cee('0x18')](_0x1a1d96));_0x4213bc(_0x1a1d96);})['catch'](function(_0x5b836a){logger[_0x0cee('0x19')]('GetMailAccount',_0x5b836a['message'],_0x280698);_0x1e4e17(_0x46cd4c['error'](0x1f4,_0x5b836a[_0x0cee('0x1b')]));});});};exports[_0x0cee('0x28')]=function(_0x5c3c5e){var _0x4d5b3d=this;return new Promise(function(_0x26ddd3,_0xbd0ce7){return db[_0x0cee('0x1e')][_0x0cee('0x29')]({'raw':_0x5c3c5e['options']?_0x5c3c5e[_0x0cee('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5c3c5e[_0x0cee('0x20')]?_0x5c3c5e[_0x0cee('0x20')]['where']||null:null,'attributes':_0x5c3c5e[_0x0cee('0x20')]?_0x5c3c5e[_0x0cee('0x20')]['attributes']||null:null,'include':_0x5c3c5e[_0x0cee('0x20')]?_0x5c3c5e[_0x0cee('0x20')][_0x0cee('0x24')]?_[_0x0cee('0x26')](_0x5c3c5e['options'][_0x0cee('0x24')],function(_0x32b5b8){return{'model':db[_0x32b5b8[_0x0cee('0x25')]],'as':_0x32b5b8['as'],'attributes':_0x32b5b8[_0x0cee('0x23')],'include':_0x32b5b8[_0x0cee('0x24')]?_[_0x0cee('0x26')](_0x32b5b8['include'],function(_0x5d9208){return{'model':db[_0x5d9208['model']],'as':_0x5d9208['as'],'attributes':_0x5d9208[_0x0cee('0x23')],'include':_0x5d9208[_0x0cee('0x24')]?_[_0x0cee('0x26')](_0x5d9208[_0x0cee('0x24')],function(_0x228769){return{'model':db[_0x228769[_0x0cee('0x25')]],'as':_0x228769['as'],'attributes':_0x228769[_0x0cee('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0cee('0x2a')](function(_0x251990){logger[_0x0cee('0x13')](_0x0cee('0x28'),_0x5c3c5e);logger[_0x0cee('0x16')](_0x0cee('0x28'),_0x5c3c5e,JSON['stringify'](_0x251990));_0x26ddd3(_0x251990);})['catch'](function(_0x5c0380){logger[_0x0cee('0x19')](_0x0cee('0x28'),_0x5c0380[_0x0cee('0x1b')],_0x5c3c5e);_0xbd0ce7(_0x4d5b3d[_0x0cee('0x19')](0x1f4,_0x5c0380[_0x0cee('0x1b')]));});});};exports[_0x0cee('0x2b')]=function(_0x3f85b6){var _0x2b50ee=this;return new Promise(function(_0x5da5be,_0x5ed048){var _0x550e78={'body':_0x3f85b6[_0x0cee('0x2c')],'channel':_0x0cee('0x2d')};var _0x5418b8=_[_0x0cee('0x2e')](_[_0x0cee('0x2f')](db[_0x0cee('0x30')][_0x0cee('0x31')]),[_0x0cee('0x32'),_0x0cee('0x33'),_0x0cee('0x34'),_0x0cee('0x35')]);var _0x3a4279=![];if(_0x3f85b6['body']['id']){delete _0x3f85b6[_0x0cee('0x2c')]['id'];}if(_[_0x0cee('0x36')](_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x37')])){return _0x5ed048(_0x2b50ee[_0x0cee('0x19')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x0cee('0x36')](_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x2c')])||_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x2c')]===''){return _0x5ed048(_0x2b50ee[_0x0cee('0x19')](0x1f4,_0x0cee('0x38')));}if(_[_0x0cee('0x36')](_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x39')])){return _0x5ed048(_0x2b50ee[_0x0cee('0x19')](0x1f4,_0x0cee('0x3a')+_0x5418b8));}if(!_['includes'](_0x5418b8,_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x39')])){return _0x5ed048(_0x2b50ee[_0x0cee('0x19')](0x1f4,_0x0cee('0x3b')+_0x5418b8));}var _0x5e8c41={};_0x5e8c41[_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x39')]]=_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x37')];return db[_0x0cee('0x1e')][_0x0cee('0x29')]({'where':{'id':_0x3f85b6['account']['id']},'include':[{'model':db['CmList'],'as':_0x0cee('0x3c'),'include':[{'model':db['CmContact'],'as':_0x0cee('0x3d'),'where':_0x5e8c41,'limit':0x1,'order':[[_0x0cee('0x33'),_0x0cee('0x3e')]]}]},{'model':db[_0x0cee('0x3f')],'as':_0x0cee('0x40')},{'model':db[_0x0cee('0x41')],'as':'Smtp'}]})['then'](function(_0x1d465f){if(_0x1d465f&&_0x1d465f['List']){var _0x53d935=_0x1d465f['get']({'plain':!![]});_0x550e78[_0x0cee('0x42')]=_[_0x0cee('0x43')](_0x53d935,[_0x0cee('0x40'),_0x0cee('0x3c')]);_0x550e78[_0x0cee('0x44')]=_0x53d935[_0x0cee('0x40')];_0x550e78[_0x0cee('0x45')]=_0x53d935['List'];_0x550e78[_0x0cee('0x44')]=_[_0x0cee('0x46')](_0x550e78[_0x0cee('0x44')],[_0x0cee('0x47')],['asc']);if(_0x550e78[_0x0cee('0x42')]&&_0x550e78[_0x0cee('0x42')]['autoclose']){_0x550e78[_0x0cee('0x44')][_0x0cee('0x48')]({'id':0x0,'priority':_0x550e78[_0x0cee('0x44')]['length']+0x1,'app':_0x0cee('0x49'),'appdata':_0x0cee('0x4a'),'interval':_0x0cee('0x4b')});}if(_0x550e78[_0x0cee('0x42')][_0x0cee('0x40')]){delete _0x550e78['account']['Applications'];}if(_0x550e78[_0x0cee('0x42')][_0x0cee('0x3c')]){delete _0x550e78[_0x0cee('0x42')]['List'];}if(_0x53d935['List'][_0x0cee('0x3d')][_0x0cee('0x4c')]){return _0x53d935[_0x0cee('0x3c')][_0x0cee('0x3d')][0x0];}var _0xdafa8=_[_0x0cee('0x4d')](_0x3f85b6['body'],{'firstName':_0x3f85b6[_0x0cee('0x2c')]['from'],'ListId':_0x53d935[_0x0cee('0x35')]});_0xdafa8[_0x3f85b6['body']['mapKey']]=_0x3f85b6['body'][_0x0cee('0x37')];return db['CmContact']['create'](_0xdafa8);}else{throw new Error('List\x20not\x20found');}})[_0x0cee('0x2a')](function(_0x27842e){_0x550e78[_0x0cee('0x4e')]=_0x27842e;if(_0x27842e){if(!_0x3f85b6[_0x0cee('0x2c')]['message'][_0x0cee('0x4f')]){_0x3f85b6[_0x0cee('0x2c')]['message'][_0x0cee('0x4f')]=rs[_0x0cee('0x50')]()+'\x20'+_0x3f85b6[_0x0cee('0x2c')]['message'][_0x0cee('0x37')];}var _0xf40d1f={'ContactId':_0x27842e['id'],'MailAccountId':_0x3f85b6[_0x0cee('0x42')]['id'],'inReplyTo':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')][_0x0cee('0x4f')],'to':_0x3f85b6['body'][_0x0cee('0x1b')][_0x0cee('0x37')],'cc':_0x3f85b6[_0x0cee('0x2c')]['message']['cc'],'subject':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')][_0x0cee('0x51')],'attach':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')][_0x0cee('0x52')],'lastMsgAt':moment()[_0x0cee('0x53')](_0x0cee('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x3f85b6[_0x0cee('0x2c')]['body']};return db[_0x0cee('0x55')][_0x0cee('0x29')]({'where':{'closed':![],'MailAccountId':_0x3f85b6['account']['id']},'include':[{'model':db[_0x0cee('0x56')],'as':_0x0cee('0x57'),'attributes':['messageId'],'where':{'messageId':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')][_0x0cee('0x58')]}}]})[_0x0cee('0x2a')](function(_0x4658f6){if(_0x4658f6){return[_0x4658f6,![]];}return db['MailInteraction'][_0x0cee('0x59')](_0xf40d1f)[_0x0cee('0x2a')](function(_0x89d020){return[_0x89d020,!![]];});});}else{throw new Error(_0x0cee('0x5a'));}})[_0x0cee('0x5b')](function(_0x3b4668,_0x29e67a){if(_0x3b4668){_0x3a4279=_0x29e67a;if(!_0x29e67a){return _0x3b4668[_0x0cee('0x5c')]({'inReplyTo':_0x3f85b6['body'][_0x0cee('0x1b')][_0x0cee('0x4f')],'to':_0x3f85b6[_0x0cee('0x2c')]['message'][_0x0cee('0x37')],'cc':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')]['cc'],'subject':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')][_0x0cee('0x51')],'attach':_0x3b4668[_0x0cee('0x52')]?_0x3b4668[_0x0cee('0x52')]:_0x3f85b6['body'][_0x0cee('0x1b')][_0x0cee('0x52')],'substatus':null,'substatusAt':moment()['format'](_0x0cee('0x54')),'lastMsgAt':moment()[_0x0cee('0x53')](_0x0cee('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x2c')]});}else{return _0x3b4668;}}})[_0x0cee('0x2a')](function(_0x3e5f50){_0x550e78[_0x0cee('0x5d')]=_0x3e5f50[_0x0cee('0x5e')]({'plain':!![]});_0x550e78['interaction'][_0x0cee('0x5f')]=_0x3a4279;return db[_0x0cee('0x56')][_0x0cee('0x59')]({'body':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x2c')],'MailAccountId':_0x3f85b6[_0x0cee('0x42')]['id'],'MailInteractionId':_0x3e5f50['id'],'direction':'in','ContactId':_0x550e78[_0x0cee('0x4e')]['id'],'messageId':_0x3f85b6['body'][_0x0cee('0x1b')][_0x0cee('0x4f')],'from':_0x3f85b6[_0x0cee('0x2c')]['message'][_0x0cee('0x37')],'to':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')]['to'],'cc':_0x3f85b6[_0x0cee('0x2c')]['message']['cc'],'subject':_0x3f85b6[_0x0cee('0x2c')]['message'][_0x0cee('0x51')],'attach':_0x3f85b6['body']['message']['attach'],'Attachments':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')]['attachments'],'originTo':_0x3f85b6[_0x0cee('0x2c')][_0x0cee('0x1b')][_0x0cee('0x60')],'originCc':_0x3f85b6['body'][_0x0cee('0x1b')][_0x0cee('0x61')],'bcc':_0x3f85b6['body'][_0x0cee('0x1b')][_0x0cee('0x62')]},{'include':[{'model':db[_0x0cee('0x63')],'as':_0x0cee('0x64')}]});})['then'](function(_0x11e132){_0x550e78[_0x0cee('0x1b')]=_0x11e132;if(_0x550e78['interaction'][_0x0cee('0x65')]){return db[_0x0cee('0x66')][_0x0cee('0x29')]({'attributes':['id',_0x0cee('0x67')],'where':{'id':_0x550e78[_0x0cee('0x5d')][_0x0cee('0x65')]}})['then'](function(_0x30da5e){if(_0x30da5e){_0x550e78[_0x0cee('0x44')][_0x0cee('0x68')]({'id':0x0,'priority':0x0,'app':_0x0cee('0x69'),'appdata':_0x30da5e[_0x0cee('0x67')]+','+(_0x550e78[_0x0cee('0x42')][_0x0cee('0x6a')]||0xa),'interval':_0x0cee('0x4b')});}return respondWithRpcPromise(_0x0cee('0x6b'),_0x0cee('0x6c'),_0x550e78);});}return respondWithRpcPromise(_0x0cee('0x6b'),_0x0cee('0x6c'),_0x550e78);})[_0x0cee('0x2a')](function(_0x5f0ffa){_0x5da5be(_0x5f0ffa);})[_0x0cee('0x1d')](function(_0x2cfa46){_0x5ed048(_0x2b50ee[_0x0cee('0x19')](0x1f4,_0x2cfa46[_0x0cee('0x1b')]));});});}; \ No newline at end of file +var _0x94dc=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailAccount','findAll','options','raw','where','attributes','include','map','model','then','debug','GetMailAccount','ShowMailAccount','find','catch','body','mail','CmContact','rawAttributes','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','updatedAt','DESC','Applications','Smtp','get','omit','applications','asc','close','length','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','update','interaction','created','originTo','originCc','bcc','Attachment','UserId','User','agent','startRouting','Start','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1bfd90,_0x50325b){var _0x1202d2=function(_0x10b817){while(--_0x10b817){_0x1bfd90['push'](_0x1bfd90['shift']());}};_0x1202d2(++_0x50325b);}(_0x94dc,0xb1));var _0xc94d=function(_0x3a1925,_0x57ea93){_0x3a1925=_0x3a1925-0x0;var _0x5844c6=_0x94dc[_0x3a1925];return _0x5844c6;};'use strict';var _=require(_0xc94d('0x0'));var util=require('util');var moment=require(_0xc94d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc94d('0x2'));var fs=require('fs');var Redis=require(_0xc94d('0x3'));var db=require(_0xc94d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc94d('0x5'))(_0xc94d('0x6'));var config=require(_0xc94d('0x7'));var jayson=require(_0xc94d('0x8'));var client=jayson[_0xc94d('0x9')][_0xc94d('0xa')]({'port':0x232c});config[_0xc94d('0xb')]=_['defaults'](config[_0xc94d('0xb')],{'host':_0xc94d('0xc'),'port':0x18eb});var socket=require(_0xc94d('0xd'))(new Redis(config[_0xc94d('0xb')]));require(_0xc94d('0xe'))['register'](socket);function respondWithRpcPromise(_0x342423,_0x13096c,_0x2cc483){return new BPromise(function(_0x1c8769,_0x4b41eb){return client[_0xc94d('0xf')](_0x342423,_0x2cc483)['then'](function(_0x3e9b00){logger[_0xc94d('0x10')](_0xc94d('0x11'),_0x13096c,_0xc94d('0x12'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x13096c,'request\x20sent',JSON[_0xc94d('0x13')](_0x3e9b00));if(_0x3e9b00[_0xc94d('0x14')]){if(_0x3e9b00[_0xc94d('0x14')][_0xc94d('0x15')]===0x1f4){logger[_0xc94d('0x14')](_0xc94d('0x11'),_0x13096c,_0x3e9b00[_0xc94d('0x14')][_0xc94d('0x16')]);return _0x4b41eb(_0x3e9b00[_0xc94d('0x14')][_0xc94d('0x16')]);}logger[_0xc94d('0x14')](_0xc94d('0x11'),_0x13096c,_0x3e9b00[_0xc94d('0x14')][_0xc94d('0x16')]);return _0x1c8769(_0x3e9b00[_0xc94d('0x14')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x13096c,'request\x20sent');_0x1c8769(_0x3e9b00[_0xc94d('0x17')][_0xc94d('0x16')]);}})['catch'](function(_0x54b934){logger[_0xc94d('0x14')](_0xc94d('0x11'),_0x13096c,_0x54b934);_0x4b41eb(_0x54b934);});});}exports['GetMailAccount']=function(_0x4e23ec){var _0x30af80=this;return new Promise(function(_0x27a4e4,_0xb5c1fd){return db[_0xc94d('0x18')][_0xc94d('0x19')]({'raw':_0x4e23ec[_0xc94d('0x1a')]?_0x4e23ec[_0xc94d('0x1a')][_0xc94d('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e23ec[_0xc94d('0x1a')]?_0x4e23ec['options'][_0xc94d('0x1c')]||null:null,'attributes':_0x4e23ec[_0xc94d('0x1a')]?_0x4e23ec[_0xc94d('0x1a')][_0xc94d('0x1d')]||null:null,'limit':_0x4e23ec[_0xc94d('0x1a')]?_0x4e23ec['options']['limit']||null:null,'include':_0x4e23ec['options']?_0x4e23ec[_0xc94d('0x1a')][_0xc94d('0x1e')]?_[_0xc94d('0x1f')](_0x4e23ec[_0xc94d('0x1a')]['include'],function(_0x5b9099){return{'model':db[_0x5b9099[_0xc94d('0x20')]],'as':_0x5b9099['as'],'attributes':_0x5b9099['attributes'],'include':_0x5b9099[_0xc94d('0x1e')]?_[_0xc94d('0x1f')](_0x5b9099[_0xc94d('0x1e')],function(_0x565b96){return{'model':db[_0x565b96[_0xc94d('0x20')]],'as':_0x565b96['as'],'attributes':_0x565b96[_0xc94d('0x1d')],'include':_0x565b96[_0xc94d('0x1e')]?_[_0xc94d('0x1f')](_0x565b96[_0xc94d('0x1e')],function(_0x57428c){return{'model':db[_0x57428c[_0xc94d('0x20')]],'as':_0x57428c['as'],'attributes':_0x57428c[_0xc94d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc94d('0x21')](function(_0x204a48){logger[_0xc94d('0x10')]('GetMailAccount',_0x4e23ec);logger[_0xc94d('0x22')](_0xc94d('0x23'),_0x4e23ec,JSON['stringify'](_0x204a48));_0x27a4e4(_0x204a48);})['catch'](function(_0x204a38){logger[_0xc94d('0x14')](_0xc94d('0x23'),_0x204a38[_0xc94d('0x16')],_0x4e23ec);_0xb5c1fd(_0x30af80[_0xc94d('0x14')](0x1f4,_0x204a38[_0xc94d('0x16')]));});});};exports[_0xc94d('0x24')]=function(_0x3d4743){var _0x5eb671=this;return new Promise(function(_0x4bee47,_0x47c789){return db['MailAccount'][_0xc94d('0x25')]({'raw':_0x3d4743[_0xc94d('0x1a')]?_0x3d4743[_0xc94d('0x1a')][_0xc94d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d4743[_0xc94d('0x1a')]?_0x3d4743[_0xc94d('0x1a')][_0xc94d('0x1c')]||null:null,'attributes':_0x3d4743[_0xc94d('0x1a')]?_0x3d4743['options'][_0xc94d('0x1d')]||null:null,'include':_0x3d4743[_0xc94d('0x1a')]?_0x3d4743[_0xc94d('0x1a')]['include']?_[_0xc94d('0x1f')](_0x3d4743[_0xc94d('0x1a')]['include'],function(_0x1cd8d0){return{'model':db[_0x1cd8d0['model']],'as':_0x1cd8d0['as'],'attributes':_0x1cd8d0[_0xc94d('0x1d')],'include':_0x1cd8d0[_0xc94d('0x1e')]?_[_0xc94d('0x1f')](_0x1cd8d0[_0xc94d('0x1e')],function(_0x253f49){return{'model':db[_0x253f49['model']],'as':_0x253f49['as'],'attributes':_0x253f49['attributes'],'include':_0x253f49[_0xc94d('0x1e')]?_[_0xc94d('0x1f')](_0x253f49[_0xc94d('0x1e')],function(_0x4efe76){return{'model':db[_0x4efe76['model']],'as':_0x4efe76['as'],'attributes':_0x4efe76[_0xc94d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc94d('0x21')](function(_0x3c2190){logger[_0xc94d('0x10')]('ShowMailAccount',_0x3d4743);logger[_0xc94d('0x22')](_0xc94d('0x24'),_0x3d4743,JSON['stringify'](_0x3c2190));_0x4bee47(_0x3c2190);})[_0xc94d('0x26')](function(_0x109056){logger[_0xc94d('0x14')](_0xc94d('0x24'),_0x109056[_0xc94d('0x16')],_0x3d4743);_0x47c789(_0x5eb671[_0xc94d('0x14')](0x1f4,_0x109056[_0xc94d('0x16')]));});});};exports['NotifyMailAccount']=function(_0x43aeb6){var _0x5dee2c=this;return new Promise(function(_0x2e497e,_0x1bdb0c){var _0x3f8886={'body':_0x43aeb6[_0xc94d('0x27')],'channel':_0xc94d('0x28')};var _0x2b2f3e=_['difference'](_['keys'](db[_0xc94d('0x29')][_0xc94d('0x2a')]),['createdAt','updatedAt',_0xc94d('0x2b'),_0xc94d('0x2c')]);var _0x52c4b6=![];if(_0x43aeb6['body']['id']){delete _0x43aeb6['body']['id'];}if(_[_0xc94d('0x2d')](_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x2e')])){return _0x1bdb0c(_0x5dee2c[_0xc94d('0x14')](0x1f4,_0xc94d('0x2f')));}if(_[_0xc94d('0x2d')](_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x27')])||_0x43aeb6['body'][_0xc94d('0x27')]===''){return _0x1bdb0c(_0x5dee2c[_0xc94d('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xc94d('0x2d')](_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x30')])){return _0x1bdb0c(_0x5dee2c['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b2f3e));}if(!_[_0xc94d('0x31')](_0x2b2f3e,_0x43aeb6['body'][_0xc94d('0x30')])){return _0x1bdb0c(_0x5dee2c[_0xc94d('0x14')](0x1f4,_0xc94d('0x32')+_0x2b2f3e));}var _0x2b7c7c={};_0x2b7c7c[_0x43aeb6['body'][_0xc94d('0x30')]]=_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x2e')];return db[_0xc94d('0x18')]['find']({'where':{'id':_0x43aeb6[_0xc94d('0x33')]['id']},'include':[{'model':db[_0xc94d('0x34')],'as':_0xc94d('0x35'),'include':[{'model':db[_0xc94d('0x29')],'as':_0xc94d('0x36'),'where':_0x2b7c7c,'limit':0x1,'order':[[_0xc94d('0x37'),_0xc94d('0x38')]]}]},{'model':db['MailApplication'],'as':_0xc94d('0x39')},{'model':db['MailServerOut'],'as':_0xc94d('0x3a')}]})[_0xc94d('0x21')](function(_0x2e0c76){if(_0x2e0c76&&_0x2e0c76['List']){var _0x21ec83=_0x2e0c76[_0xc94d('0x3b')]({'plain':!![]});_0x3f8886[_0xc94d('0x33')]=_[_0xc94d('0x3c')](_0x21ec83,['Applications','List']);_0x3f8886['applications']=_0x21ec83[_0xc94d('0x39')];_0x3f8886['list']=_0x21ec83['List'];_0x3f8886[_0xc94d('0x3d')]=_['orderBy'](_0x3f8886[_0xc94d('0x3d')],['priority'],[_0xc94d('0x3e')]);if(_0x3f8886[_0xc94d('0x33')]&&_0x3f8886[_0xc94d('0x33')]['autoclose']){_0x3f8886[_0xc94d('0x3d')]['push']({'id':0x0,'priority':_0x3f8886[_0xc94d('0x3d')]['length']+0x1,'app':_0xc94d('0x3f'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x3f8886['account'][_0xc94d('0x39')]){delete _0x3f8886[_0xc94d('0x33')]['Applications'];}if(_0x3f8886[_0xc94d('0x33')]['List']){delete _0x3f8886[_0xc94d('0x33')][_0xc94d('0x35')];}if(_0x21ec83[_0xc94d('0x35')][_0xc94d('0x36')][_0xc94d('0x40')]){return _0x21ec83[_0xc94d('0x35')]['Contacts'][0x0];}var _0x7d624f=_[_0xc94d('0x41')](_0x43aeb6[_0xc94d('0x27')],{'firstName':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x2e')],'ListId':_0x21ec83[_0xc94d('0x2c')]});_0x7d624f[_0x43aeb6[_0xc94d('0x27')]['mapKey']]=_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x2e')];return db[_0xc94d('0x29')]['create'](_0x7d624f);}else{throw new Error(_0xc94d('0x42'));}})[_0xc94d('0x21')](function(_0x3be791){_0x3f8886[_0xc94d('0x43')]=_0x3be791;if(_0x3be791){if(!_0x43aeb6['body'][_0xc94d('0x16')][_0xc94d('0x44')]){_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x44')]=rs[_0xc94d('0x45')]()+'\x20'+_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x2e')];}var _0x136059={'ContactId':_0x3be791['id'],'MailAccountId':_0x43aeb6[_0xc94d('0x33')]['id'],'inReplyTo':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x44')],'to':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x2e')],'cc':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')]['cc'],'subject':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x46')],'attach':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x47')],'lastMsgAt':moment()[_0xc94d('0x48')](_0xc94d('0x49')),'lastMsgDirection':'in','lastMsgBody':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x27')]};return db['MailInteraction'][_0xc94d('0x25')]({'where':{'closed':![],'MailAccountId':_0x43aeb6[_0xc94d('0x33')]['id']},'include':[{'model':db[_0xc94d('0x4a')],'as':_0xc94d('0x4b'),'attributes':['messageId'],'where':{'messageId':_0x43aeb6[_0xc94d('0x27')]['message'][_0xc94d('0x4c')]}}]})[_0xc94d('0x21')](function(_0x4d1453){if(_0x4d1453){return[_0x4d1453,![]];}return db[_0xc94d('0x4d')][_0xc94d('0x4e')](_0x136059)[_0xc94d('0x21')](function(_0x292c84){return[_0x292c84,!![]];});});}else{throw new Error(_0xc94d('0x4f'));}})['spread'](function(_0x3cbd7d,_0xc5f96f){if(_0x3cbd7d){_0x52c4b6=_0xc5f96f;if(!_0xc5f96f){return _0x3cbd7d[_0xc94d('0x50')]({'inReplyTo':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x44')],'to':_0x43aeb6['body'][_0xc94d('0x16')][_0xc94d('0x2e')],'cc':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')]['cc'],'subject':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x46')],'attach':_0x3cbd7d['attach']?_0x3cbd7d[_0xc94d('0x47')]:_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x47')],'substatus':null,'substatusAt':moment()['format'](_0xc94d('0x49')),'lastMsgAt':moment()['format'](_0xc94d('0x49')),'lastMsgDirection':'in','lastMsgBody':_0x43aeb6[_0xc94d('0x27')]['body']});}else{return _0x3cbd7d;}}})[_0xc94d('0x21')](function(_0x217941){_0x3f8886[_0xc94d('0x51')]=_0x217941['get']({'plain':!![]});_0x3f8886['interaction'][_0xc94d('0x52')]=_0x52c4b6;return db['MailMessage'][_0xc94d('0x4e')]({'body':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x27')],'MailAccountId':_0x43aeb6[_0xc94d('0x33')]['id'],'MailInteractionId':_0x217941['id'],'direction':'in','ContactId':_0x3f8886[_0xc94d('0x43')]['id'],'messageId':_0x43aeb6[_0xc94d('0x27')]['message'][_0xc94d('0x44')],'from':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')]['from'],'to':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')]['to'],'cc':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')]['cc'],'subject':_0x43aeb6['body'][_0xc94d('0x16')][_0xc94d('0x46')],'attach':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')]['attach'],'Attachments':_0x43aeb6['body'][_0xc94d('0x16')]['attachments'],'originTo':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x53')],'originCc':_0x43aeb6[_0xc94d('0x27')][_0xc94d('0x16')][_0xc94d('0x54')],'bcc':_0x43aeb6[_0xc94d('0x27')]['message'][_0xc94d('0x55')]},{'include':[{'model':db[_0xc94d('0x56')],'as':'Attachments'}]});})['then'](function(_0x2a9aa2){_0x3f8886[_0xc94d('0x16')]=_0x2a9aa2;if(_0x3f8886[_0xc94d('0x51')][_0xc94d('0x57')]){return db[_0xc94d('0x58')][_0xc94d('0x25')]({'attributes':['id','name'],'where':{'id':_0x3f8886[_0xc94d('0x51')][_0xc94d('0x57')]}})['then'](function(_0x5911b6){if(_0x5911b6){_0x3f8886[_0xc94d('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc94d('0x59'),'appdata':_0x5911b6['name']+','+(_0x3f8886[_0xc94d('0x33')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xc94d('0x5a'),_0x3f8886);});}return respondWithRpcPromise(_0xc94d('0x5b'),_0xc94d('0x5a'),_0x3f8886);})[_0xc94d('0x21')](function(_0xa0f9c0){_0x2e497e(_0xa0f9c0);})[_0xc94d('0x26')](function(_0x12f8fa){_0x1bdb0c(_0x5dee2c[_0xc94d('0x14')](0x1f4,_0x12f8fa['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 45d43da..aa5dd2b 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 _0x25fa=['remove','update','emit','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x524232,_0x2fc41b){var _0x175d22=function(_0x4cf858){while(--_0x4cf858){_0x524232['push'](_0x524232['shift']());}};_0x175d22(++_0x2fc41b);}(_0x25fa,0x109));var _0xa25f=function(_0x45d061,_0x4852e4){_0x45d061=_0x45d061-0x0;var _0x108cbf=_0x25fa[_0x45d061];return _0x108cbf;};'use strict';var MailAccountEvents=require(_0xa25f('0x0'));var events=['save',_0xa25f('0x1'),_0xa25f('0x2')];function createListener(_0x57e272,_0x408155){return function(_0xb88bd8){_0x408155[_0xa25f('0x3')](_0x57e272,_0xb88bd8);};}function removeListener(_0x4d0b34,_0x4e444d){return function(){MailAccountEvents[_0xa25f('0x4')](_0x4d0b34,_0x4e444d);};}exports['register']=function(_0x2ea9ea){for(var _0x3ab530=0x0,_0x29666d=events[_0xa25f('0x5')];_0x3ab530<_0x29666d;_0x3ab530++){var _0x22982b=events[_0x3ab530];var _0x168907=createListener(_0xa25f('0x6')+_0x22982b,_0x2ea9ea);MailAccountEvents['on'](_0x22982b,_0x168907);}}; \ No newline at end of file +var _0x3edc=['remove','update','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x5135f1,_0xf4d1b){_0x5135f1=_0x5135f1-0x0;var _0x1ad043=_0x3edc[_0x5135f1];return _0x1ad043;};'use strict';var MailAccountEvents=require(_0xc3ed('0x0'));var events=[_0xc3ed('0x1'),_0xc3ed('0x2'),_0xc3ed('0x3')];function createListener(_0xae2b4f,_0x47a242){return function(_0x2a8714){_0x47a242['emit'](_0xae2b4f,_0x2a8714);};}function removeListener(_0x3519ab,_0x19d8dc){return function(){MailAccountEvents[_0xc3ed('0x4')](_0x3519ab,_0x19d8dc);};}exports[_0xc3ed('0x5')]=function(_0x3f8468){for(var _0x50b95c=0x0,_0x1b28d4=events[_0xc3ed('0x6')];_0x50b95c<_0x1b28d4;_0x50b95c++){var _0x14d194=events[_0x50b95c];var _0x2f28ce=createListener(_0xc3ed('0x7')+_0x14d194,_0x3f8468);MailAccountEvents['on'](_0x14d194,_0x2f28ce);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index be8d481..6995926 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 _0x373d=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','/:id','update'];(function(_0x3a6671,_0x360433){var _0x18d65d=function(_0x3f30fb){while(--_0x3f30fb){_0x3a6671['push'](_0x3a6671['shift']());}};_0x18d65d(++_0x360433);}(_0x373d,0x1e2));var _0xd373=function(_0x8bf471,_0x2e9da0){_0x8bf471=_0x8bf471-0x0;var _0x3d93d7=_0x373d[_0x8bf471];return _0x3d93d7;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require(_0xd373('0x3'));var router=express[_0xd373('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd373('0x5'));var config=require(_0xd373('0x6'));var controller=require(_0xd373('0x7'));router['get']('/:id',auth[_0xd373('0x8')](),controller[_0xd373('0x9')]);router[_0xd373('0xa')](_0xd373('0xb'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd373('0xd')]);module[_0xd373('0xe')]=router; \ No newline at end of file +var _0xa571=['put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./mailApplication.controller','/:id','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa571,0x107));var _0x1a57=function(_0x2ab1c1,_0x39b0b6){_0x2ab1c1=_0x2ab1c1-0x0;var _0x527164=_0xa571[_0x2ab1c1];return _0x527164;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var auth=require(_0x1a57('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a57('0x6'));router['get'](_0x1a57('0x7'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0xa')](_0x1a57('0x7'),auth[_0x1a57('0x8')](),controller['update']);router[_0x1a57('0xb')](_0x1a57('0x7'),auth[_0x1a57('0x8')](),controller['destroy']);module[_0x1a57('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e4f9b35..ad0800a 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 _0x9897=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x21dc19,_0x3015ea){var _0xfbd44d=function(_0x4a5ca9){while(--_0x4a5ca9){_0x21dc19['push'](_0x21dc19['shift']());}};_0xfbd44d(++_0x3015ea);}(_0x9897,0xc5));var _0x7989=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x9897[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0x7989('0x0'));module[_0x7989('0x1')]={'priority':{'type':Sequelize[_0x7989('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7989('0x3')],'allowNull':![],'defaultValue':_0x7989('0x4')},'appdata':{'type':Sequelize[_0x7989('0x5')]()},'description':{'type':Sequelize[_0x7989('0x3')]},'interval':{'type':Sequelize[_0x7989('0x3')],'defaultValue':_0x7989('0x6')}}; \ No newline at end of file +var _0xd6a9=['STRING','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x4b185e,_0x31c299){var _0x558b84=function(_0x5aa4d5){while(--_0x5aa4d5){_0x4b185e['push'](_0x4b185e['shift']());}};_0x558b84(++_0x31c299);}(_0xd6a9,0x79));var _0x9d6a=function(_0x281c2a,_0x18bde1){_0x281c2a=_0x281c2a-0x0;var _0x1dd48d=_0xd6a9[_0x281c2a];return _0x1dd48d;};'use strict';var Sequelize=require(_0x9d6a('0x0'));module[_0x9d6a('0x1')]={'priority':{'type':Sequelize[_0x9d6a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9d6a('0x3')},'appdata':{'type':Sequelize[_0x9d6a('0x4')]()},'description':{'type':Sequelize[_0x9d6a('0x5')]},'interval':{'type':Sequelize[_0x9d6a('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5aedc58..2642334 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 _0x669d=['path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','intersection','attributes','length','includeAll','options','find','catch','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x669d,0x97));var _0xd669=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x669d[_0x24f31b];return _0x488401;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd669('0x0'));var rimraf=require(_0xd669('0x1'));var zipdir=require(_0xd669('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd669('0x3'));var moment=require(_0xd669('0x4'));var BPromise=require(_0xd669('0x5'));var Mustache=require(_0xd669('0x6'));var util=require(_0xd669('0x7'));var path=require(_0xd669('0x8'));var sox=require(_0xd669('0x9'));var csv=require('to-csv');var ejs=require(_0xd669('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd669('0xb'));var crypto=require(_0xd669('0xc'));var jsforce=require(_0xd669('0xd'));var deskjs=require(_0xd669('0xe'));var toCsv=require(_0xd669('0xf'));var querystring=require(_0xd669('0x10'));var Papa=require('papaparse');var Redis=require(_0xd669('0x11'));var authService=require(_0xd669('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd669('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd669('0x14'));var db=require(_0xd669('0x15'))['db'];function respondWithStatusCode(_0x1ac633,_0x56575c){_0x56575c=_0x56575c||0xcc;return function(_0x3900cf){if(_0x3900cf){return _0x1ac633[_0xd669('0x16')](_0x56575c);}return _0x1ac633[_0xd669('0x17')](_0x56575c)[_0xd669('0x18')]();};}function respondWithResult(_0x525f4c,_0x765d8d){_0x765d8d=_0x765d8d||0xc8;return function(_0x2660f0){if(_0x2660f0){return _0x525f4c[_0xd669('0x17')](_0x765d8d)['json'](_0x2660f0);}};}function respondWithFilteredResult(_0x45ad9f,_0x5ca1eb){return function(_0x1733c1){if(_0x1733c1){var _0x48c0d7=_0x1733c1[_0xd669('0x19')],_0x3e4499=_0x5ca1eb['offset'],_0x4ac6f9=_0x5ca1eb['offset']+_0x5ca1eb[_0xd669('0x1a')],_0x301c5f;if(_0x4ac6f9>=_0x48c0d7){_0x4ac6f9=_0x48c0d7;_0x301c5f=0xc8;}else{_0x301c5f=0xce;}_0x45ad9f[_0xd669('0x17')](_0x301c5f);return _0x45ad9f['set'](_0xd669('0x1b'),_0x3e4499+'-'+_0x4ac6f9+'/'+_0x48c0d7)['json'](_0x1733c1);}return null;};}function patchUpdates(_0x328446){return function(_0x11cc99){try{jsonpatch[_0xd669('0x1c')](_0x11cc99,_0x328446,!![]);}catch(_0x48e1ad){return BPromise[_0xd669('0x1d')](_0x48e1ad);}return _0x11cc99[_0xd669('0x1e')]();};}function saveUpdates(_0x2b42c0,_0x167650){return function(_0x54c166){if(_0x54c166){return _0x54c166['update'](_0x2b42c0)[_0xd669('0x1f')](function(_0x386f25){return _0x386f25;});}return null;};}function removeEntity(_0x2500d1,_0x4c2e82){return function(_0x5eb617){if(_0x5eb617){return _0x5eb617[_0xd669('0x20')]()[_0xd669('0x1f')](function(){_0x2500d1[_0xd669('0x17')](0xcc)[_0xd669('0x18')]();});}};}function handleEntityNotFound(_0x399d1b,_0x40d3dd){return function(_0x194c05){if(!_0x194c05){_0x399d1b[_0xd669('0x16')](0x194);}return _0x194c05;};}function handleError(_0x28e7ea,_0x347381){_0x347381=_0x347381||0x1f4;return function(_0x2c3c6e){logger[_0xd669('0x21')](_0x2c3c6e[_0xd669('0x22')]);if(_0x2c3c6e[_0xd669('0x23')]){delete _0x2c3c6e[_0xd669('0x23')];}_0x28e7ea[_0xd669('0x17')](_0x347381)[_0xd669('0x24')](_0x2c3c6e);};}exports[_0xd669('0x25')]=function(_0x5b4e27,_0x1e7cf5){var _0x35b94d={'raw':!![],'where':{'id':_0x5b4e27[_0xd669('0x26')]['id']}},_0xadbf0f={};_0xadbf0f[_0xd669('0x27')]=_[_0xd669('0x28')](db[_0xd669('0x29')][_0xd669('0x2a')]);_0xadbf0f[_0xd669('0x2b')]=_[_0xd669('0x28')](_0x5b4e27[_0xd669('0x2b')]);_0xadbf0f['filters']=_[_0xd669('0x2c')](_0xadbf0f[_0xd669('0x27')],_0xadbf0f[_0xd669('0x2b')]);_0x35b94d[_0xd669('0x2d')]=_['intersection'](_0xadbf0f[_0xd669('0x27')],qs['fields'](_0x5b4e27[_0xd669('0x2b')]['fields']));_0x35b94d[_0xd669('0x2d')]=_0x35b94d[_0xd669('0x2d')][_0xd669('0x2e')]?_0x35b94d['attributes']:_0xadbf0f[_0xd669('0x27')];if(_0x5b4e27['query'][_0xd669('0x2f')]){_0x35b94d['include']=[{'all':!![]}];}_0x35b94d=_['merge']({},_0x35b94d,_0x5b4e27[_0xd669('0x30')]);return db[_0xd669('0x29')][_0xd669('0x31')](_0x35b94d)[_0xd669('0x1f')](handleEntityNotFound(_0x1e7cf5,null))[_0xd669('0x1f')](respondWithResult(_0x1e7cf5,null))[_0xd669('0x32')](handleError(_0x1e7cf5,null));};exports[_0xd669('0x33')]=function(_0x4ccf57,_0x4aac66){if(_0x4ccf57[_0xd669('0x34')]['id']){delete _0x4ccf57[_0xd669('0x34')]['id'];}return db['MailApplication'][_0xd669('0x31')]({'where':{'id':_0x4ccf57[_0xd669('0x26')]['id']}})[_0xd669('0x1f')](handleEntityNotFound(_0x4aac66,null))[_0xd669('0x1f')](saveUpdates(_0x4ccf57[_0xd669('0x34')],null))[_0xd669('0x1f')](respondWithResult(_0x4aac66,null))[_0xd669('0x32')](handleError(_0x4aac66,null));};exports[_0xd669('0x20')]=function(_0x16ea27,_0x11fa64){return db['MailApplication']['find']({'where':{'id':_0x16ea27[_0xd669('0x26')]['id']}})[_0xd669('0x1f')](handleEntityNotFound(_0x11fa64,null))[_0xd669('0x1f')](removeEntity(_0x11fa64,null))['catch'](handleError(_0x11fa64,null));}; \ No newline at end of file +var _0xb096=['../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0xb096,0x156));var _0x6b09=function(_0xd6d2ac,_0x193e95){_0xd6d2ac=_0xd6d2ac-0x0;var _0x5e808d=_0xb096[_0xd6d2ac];return _0x5e808d;};'use strict';var pdf=require(_0x6b09('0x0'));var emlformat=require(_0x6b09('0x1'));var rimraf=require(_0x6b09('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b09('0x3'));var rp=require(_0x6b09('0x4'));var moment=require(_0x6b09('0x5'));var BPromise=require(_0x6b09('0x6'));var Mustache=require(_0x6b09('0x7'));var util=require(_0x6b09('0x8'));var path=require(_0x6b09('0x9'));var sox=require(_0x6b09('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6b09('0xb'));var crypto=require(_0x6b09('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6b09('0xd'));var toCsv=require(_0x6b09('0xe'));var querystring=require('querystring');var Papa=require(_0x6b09('0xf'));var Redis=require(_0x6b09('0x10'));var authService=require(_0x6b09('0x11'));var qs=require(_0x6b09('0x12'));var as=require(_0x6b09('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b09('0x14'))(_0x6b09('0x15'));var utils=require(_0x6b09('0x16'));var config=require(_0x6b09('0x17'));var db=require(_0x6b09('0x18'))['db'];function respondWithStatusCode(_0x38ce97,_0x30f5f8){_0x30f5f8=_0x30f5f8||0xcc;return function(_0x52e697){if(_0x52e697){return _0x38ce97[_0x6b09('0x19')](_0x30f5f8);}return _0x38ce97[_0x6b09('0x1a')](_0x30f5f8)[_0x6b09('0x1b')]();};}function respondWithResult(_0x1ccffc,_0x3165ad){_0x3165ad=_0x3165ad||0xc8;return function(_0x706d57){if(_0x706d57){return _0x1ccffc[_0x6b09('0x1a')](_0x3165ad)[_0x6b09('0x1c')](_0x706d57);}};}function respondWithFilteredResult(_0x3613e8,_0x68ec40){return function(_0x40ba49){if(_0x40ba49){var _0x45932b=_0x40ba49['count'],_0x531e0e=_0x68ec40[_0x6b09('0x1d')],_0x4e705e=_0x68ec40[_0x6b09('0x1d')]+_0x68ec40[_0x6b09('0x1e')],_0xb371bb;if(_0x4e705e>=_0x45932b){_0x4e705e=_0x45932b;_0xb371bb=0xc8;}else{_0xb371bb=0xce;}_0x3613e8[_0x6b09('0x1a')](_0xb371bb);return _0x3613e8[_0x6b09('0x1f')]('Content-Range',_0x531e0e+'-'+_0x4e705e+'/'+_0x45932b)[_0x6b09('0x1c')](_0x40ba49);}return null;};}function patchUpdates(_0x3fa892){return function(_0x368338){try{jsonpatch[_0x6b09('0x20')](_0x368338,_0x3fa892,!![]);}catch(_0x4b0ea7){return BPromise[_0x6b09('0x21')](_0x4b0ea7);}return _0x368338[_0x6b09('0x22')]();};}function saveUpdates(_0x797739,_0x520a05){return function(_0x36ff5f){if(_0x36ff5f){return _0x36ff5f[_0x6b09('0x23')](_0x797739)[_0x6b09('0x24')](function(_0x2c3810){return _0x2c3810;});}return null;};}function removeEntity(_0x20e7ee,_0x5ef895){return function(_0x365ad1){if(_0x365ad1){return _0x365ad1[_0x6b09('0x25')]()[_0x6b09('0x24')](function(){_0x20e7ee[_0x6b09('0x1a')](0xcc)[_0x6b09('0x1b')]();});}};}function handleEntityNotFound(_0x27d1a5,_0x479984){return function(_0xfa1ac2){if(!_0xfa1ac2){_0x27d1a5[_0x6b09('0x19')](0x194);}return _0xfa1ac2;};}function handleError(_0x4e2011,_0x454ebf){_0x454ebf=_0x454ebf||0x1f4;return function(_0x1f5a52){logger[_0x6b09('0x26')](_0x1f5a52[_0x6b09('0x27')]);if(_0x1f5a52[_0x6b09('0x28')]){delete _0x1f5a52[_0x6b09('0x28')];}_0x4e2011[_0x6b09('0x1a')](_0x454ebf)[_0x6b09('0x29')](_0x1f5a52);};}exports[_0x6b09('0x2a')]=function(_0x353051,_0x165b21){var _0x173963={'raw':!![],'where':{'id':_0x353051[_0x6b09('0x2b')]['id']}},_0xce2c65={};_0xce2c65[_0x6b09('0x2c')]=_[_0x6b09('0x2d')](db[_0x6b09('0x2e')][_0x6b09('0x2f')]);_0xce2c65[_0x6b09('0x30')]=_[_0x6b09('0x2d')](_0x353051[_0x6b09('0x30')]);_0xce2c65[_0x6b09('0x31')]=_['intersection'](_0xce2c65[_0x6b09('0x2c')],_0xce2c65[_0x6b09('0x30')]);_0x173963['attributes']=_[_0x6b09('0x32')](_0xce2c65[_0x6b09('0x2c')],qs[_0x6b09('0x33')](_0x353051[_0x6b09('0x30')][_0x6b09('0x33')]));_0x173963[_0x6b09('0x34')]=_0x173963['attributes'][_0x6b09('0x35')]?_0x173963[_0x6b09('0x34')]:_0xce2c65[_0x6b09('0x2c')];if(_0x353051[_0x6b09('0x30')][_0x6b09('0x36')]){_0x173963[_0x6b09('0x37')]=[{'all':!![]}];}_0x173963=_[_0x6b09('0x38')]({},_0x173963,_0x353051[_0x6b09('0x39')]);return db['MailApplication']['find'](_0x173963)[_0x6b09('0x24')](handleEntityNotFound(_0x165b21,null))[_0x6b09('0x24')](respondWithResult(_0x165b21,null))[_0x6b09('0x3a')](handleError(_0x165b21,null));};exports['update']=function(_0x106aa4,_0x1af000){if(_0x106aa4[_0x6b09('0x3b')]['id']){delete _0x106aa4[_0x6b09('0x3b')]['id'];}return db[_0x6b09('0x2e')][_0x6b09('0x3c')]({'where':{'id':_0x106aa4[_0x6b09('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1af000,null))[_0x6b09('0x24')](saveUpdates(_0x106aa4[_0x6b09('0x3b')],null))['then'](respondWithResult(_0x1af000,null))[_0x6b09('0x3a')](handleError(_0x1af000,null));};exports[_0x6b09('0x25')]=function(_0x5ce498,_0x412b6a){return db[_0x6b09('0x2e')][_0x6b09('0x3c')]({'where':{'id':_0x5ce498[_0x6b09('0x2b')]['id']}})['then'](handleEntityNotFound(_0x412b6a,null))[_0x6b09('0x24')](removeEntity(_0x412b6a,null))[_0x6b09('0x3a')](handleError(_0x412b6a,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a0a8920..c6d3aac 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 _0x79d7=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4'];(function(_0x39d0ca,_0x477b93){var _0x16acfa=function(_0xd69e11){while(--_0xd69e11){_0x39d0ca['push'](_0x39d0ca['shift']());}};_0x16acfa(++_0x477b93);}(_0x79d7,0x9c));var _0x779d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x79d7[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x779d('0x0'));var util=require('util');var logger=require(_0x779d('0x1'))(_0x779d('0x2'));var moment=require(_0x779d('0x3'));var BPromise=require(_0x779d('0x4'));var rp=require(_0x779d('0x5'));var fs=require('fs');var path=require(_0x779d('0x6'));var rimraf=require('rimraf');var config=require(_0x779d('0x7'));var attributes=require(_0x779d('0x8'));module[_0x779d('0x9')]=function(_0x4f0103,_0x51870f){return _0x4f0103[_0x779d('0xa')]('MailApplication',attributes,{'tableName':_0x779d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x779d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5853=['mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x285387,_0x4a226d){var _0x3a18b6=function(_0x2ae4a1){while(--_0x2ae4a1){_0x285387['push'](_0x285387['shift']());}};_0x3a18b6(++_0x4a226d);}(_0x5853,0x113));var _0x3585=function(_0x25c4f6,_0x1d79a6){_0x25c4f6=_0x25c4f6-0x0;var _0x1279a7=_0x5853[_0x25c4f6];return _0x1279a7;};'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']('MailApplication',attributes,{'tableName':_0x3585('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3585('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a6591e0..0957dd0 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 _0xe2e4=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','result','catch','MailApplication','body','options','raw','where','attributes','then','UpdateMailApplication','message','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1af135,_0x223724){var _0x2316a8=function(_0x2fb600){while(--_0x2fb600){_0x1af135['push'](_0x1af135['shift']());}};_0x2316a8(++_0x223724);}(_0xe2e4,0xc6));var _0x4e2e=function(_0x1ae636,_0x212002){_0x1ae636=_0x1ae636-0x0;var _0x4385ec=_0xe2e4[_0x1ae636];return _0x4385ec;};'use strict';var _=require(_0x4e2e('0x0'));var util=require('util');var moment=require(_0x4e2e('0x1'));var BPromise=require(_0x4e2e('0x2'));var rs=require(_0x4e2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e2e('0x4'))['db'];var utils=require(_0x4e2e('0x5'));var logger=require('../../config/logger')(_0x4e2e('0x6'));var config=require(_0x4e2e('0x7'));var jayson=require(_0x4e2e('0x8'));var client=jayson[_0x4e2e('0x9')][_0x4e2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x715127,_0xdab939,_0x4103f6){return new BPromise(function(_0x3e9905,_0x333c07){return client['request'](_0x715127,_0x4103f6)['then'](function(_0x3878eb){logger[_0x4e2e('0xb')]('MailApplication,\x20%s,\x20%s',_0xdab939,_0x4e2e('0xc'));logger[_0x4e2e('0xd')](_0x4e2e('0xe'),_0xdab939,_0x4e2e('0xc'),JSON['stringify'](_0x3878eb));if(_0x3878eb[_0x4e2e('0xf')]){if(_0x3878eb[_0x4e2e('0xf')][_0x4e2e('0x10')]===0x1f4){logger['error'](_0x4e2e('0x11'),_0xdab939,_0x3878eb[_0x4e2e('0xf')]['message']);return _0x333c07(_0x3878eb[_0x4e2e('0xf')]['message']);}logger['error'](_0x4e2e('0x11'),_0xdab939,_0x3878eb[_0x4e2e('0xf')]['message']);return _0x3e9905(_0x3878eb[_0x4e2e('0xf')]['message']);}else{logger['info'](_0x4e2e('0x11'),_0xdab939,_0x4e2e('0xc'));_0x3e9905(_0x3878eb[_0x4e2e('0x12')]['message']);}})[_0x4e2e('0x13')](function(_0x3fd73c){logger[_0x4e2e('0xf')](_0x4e2e('0x11'),_0xdab939,_0x3fd73c);_0x333c07(_0x3fd73c);});});}exports['UpdateMailApplication']=function(_0x35e2f0){var _0x4e0aed=this;return new Promise(function(_0x4fbe76,_0x12e0fc){return db[_0x4e2e('0x14')]['update'](_0x35e2f0[_0x4e2e('0x15')],{'raw':_0x35e2f0[_0x4e2e('0x16')]?_0x35e2f0['options'][_0x4e2e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35e2f0[_0x4e2e('0x16')]?_0x35e2f0['options'][_0x4e2e('0x18')]||null:null,'attributes':_0x35e2f0['options']?_0x35e2f0[_0x4e2e('0x16')][_0x4e2e('0x19')]||null:null,'limit':_0x35e2f0[_0x4e2e('0x16')]?_0x35e2f0[_0x4e2e('0x16')]['limit']||null:null})[_0x4e2e('0x1a')](function(_0x5e81f0){logger['info']('UpdateMailApplication',_0x35e2f0);logger[_0x4e2e('0xd')](_0x4e2e('0x1b'),_0x35e2f0,JSON['stringify'](_0x5e81f0));_0x4fbe76(_0x5e81f0);})[_0x4e2e('0x13')](function(_0x4b27d7){logger[_0x4e2e('0xf')](_0x4e2e('0x1b'),_0x4b27d7[_0x4e2e('0x1c')],_0x35e2f0);_0x12e0fc(_0x4e0aed[_0x4e2e('0xf')](0x1f4,_0x4b27d7['message']));});});}; \ No newline at end of file +var _0xde0d=['update','options','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateMailApplication'];(function(_0x12c69e,_0x14d081){var _0x542719=function(_0x1ab5e0){while(--_0x1ab5e0){_0x12c69e['push'](_0x12c69e['shift']());}};_0x542719(++_0x14d081);}(_0xde0d,0x19d));var _0xdde0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xde0d[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xdde0('0x0'));var util=require(_0xdde0('0x1'));var moment=require(_0xdde0('0x2'));var BPromise=require(_0xdde0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdde0('0x4'));var db=require(_0xdde0('0x5'))['db'];var utils=require(_0xdde0('0x6'));var logger=require(_0xdde0('0x7'))(_0xdde0('0x8'));var config=require('../../config/environment');var jayson=require(_0xdde0('0x9'));var client=jayson[_0xdde0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x497c41,_0x54dc8a,_0x87b6e4){return new BPromise(function(_0x29b52,_0x33db86){return client[_0xdde0('0xb')](_0x497c41,_0x87b6e4)[_0xdde0('0xc')](function(_0x18fc9a){logger[_0xdde0('0xd')](_0xdde0('0xe'),_0x54dc8a,_0xdde0('0xf'));logger[_0xdde0('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x54dc8a,_0xdde0('0xf'),JSON[_0xdde0('0x11')](_0x18fc9a));if(_0x18fc9a[_0xdde0('0x12')]){if(_0x18fc9a[_0xdde0('0x12')][_0xdde0('0x13')]===0x1f4){logger[_0xdde0('0x12')](_0xdde0('0xe'),_0x54dc8a,_0x18fc9a[_0xdde0('0x12')][_0xdde0('0x14')]);return _0x33db86(_0x18fc9a[_0xdde0('0x12')][_0xdde0('0x14')]);}logger['error'](_0xdde0('0xe'),_0x54dc8a,_0x18fc9a[_0xdde0('0x12')]['message']);return _0x29b52(_0x18fc9a['error'][_0xdde0('0x14')]);}else{logger[_0xdde0('0xd')](_0xdde0('0xe'),_0x54dc8a,_0xdde0('0xf'));_0x29b52(_0x18fc9a['result']['message']);}})['catch'](function(_0x5ac118){logger[_0xdde0('0x12')](_0xdde0('0xe'),_0x54dc8a,_0x5ac118);_0x33db86(_0x5ac118);});});}exports[_0xdde0('0x15')]=function(_0x2a3121){var _0x17b077=this;return new Promise(function(_0x4c74a2,_0x3a098e){return db['MailApplication'][_0xdde0('0x16')](_0x2a3121['body'],{'raw':_0x2a3121[_0xdde0('0x17')]?_0x2a3121[_0xdde0('0x17')][_0xdde0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a3121[_0xdde0('0x17')]?_0x2a3121[_0xdde0('0x17')][_0xdde0('0x19')]||null:null,'attributes':_0x2a3121[_0xdde0('0x17')]?_0x2a3121[_0xdde0('0x17')][_0xdde0('0x1a')]||null:null,'limit':_0x2a3121[_0xdde0('0x17')]?_0x2a3121[_0xdde0('0x17')][_0xdde0('0x1b')]||null:null})[_0xdde0('0xc')](function(_0x436917){logger[_0xdde0('0xd')]('UpdateMailApplication',_0x2a3121);logger[_0xdde0('0x10')]('UpdateMailApplication',_0x2a3121,JSON['stringify'](_0x436917));_0x4c74a2(_0x436917);})[_0xdde0('0x1c')](function(_0x13148b){logger[_0xdde0('0x12')](_0xdde0('0x15'),_0x13148b[_0xdde0('0x14')],_0x2a3121);_0x3a098e(_0x17b077[_0xdde0('0x12')](0x1f4,_0x13148b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e8c00fe..5ec17b7 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 _0x741c=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','put','tracked','delete','destroy','removeTags'];(function(_0xa25f3f,_0x26f71d){var _0x3f67ae=function(_0xb56184){while(--_0xb56184){_0xa25f3f['push'](_0xa25f3f['shift']());}};_0x3f67ae(++_0x26f71d);}(_0x741c,0x196));var _0xc741=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x741c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc741('0x6'));var controller=require('./mailInteraction.controller');router[_0xc741('0x7')]('/',auth[_0xc741('0x8')](),controller[_0xc741('0x9')]);router[_0xc741('0x7')](_0xc741('0xa'),auth[_0xc741('0x8')](),controller[_0xc741('0xb')]);router['get'](_0xc741('0xc'),auth[_0xc741('0x8')](),controller['show']);router[_0xc741('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc741('0xd')]);router[_0xc741('0x7')](_0xc741('0xe'),auth[_0xc741('0x8')](),controller[_0xc741('0xf')]);router[_0xc741('0x10')]('/',auth[_0xc741('0x8')](),controller['create']);router['post']('/:id/messages',auth[_0xc741('0x8')](),controller[_0xc741('0x11')]);router[_0xc741('0x10')](_0xc741('0x12'),auth[_0xc741('0x8')](),interaction['tracked'](_0xc741('0x13'),_0xc741('0x14')),controller['addTags']);router[_0xc741('0x15')](_0xc741('0xc'),auth[_0xc741('0x8')](),interaction[_0xc741('0x16')](_0xc741('0x13'),'mailinteraction:update'),controller['update']);router[_0xc741('0x17')]('/:id',auth[_0xc741('0x8')](),interaction[_0xc741('0x16')]('mail','mailinteraction:destroy'),controller[_0xc741('0x18')]);router[_0xc741('0x17')](_0xc741('0x12'),auth['isAuthenticated'](),controller[_0xc741('0x19')]);module[_0xc741('0x1a')]=router; \ No newline at end of file +var _0xbb93=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','removeTags','exports'];(function(_0x2a225f,_0x52614b){var _0x1d6b69=function(_0x357746){while(--_0x357746){_0x2a225f['push'](_0x2a225f['shift']());}};_0x1d6b69(++_0x52614b);}(_0xbb93,0x120));var _0x3bb9=function(_0x3f9621,_0xf5ccd4){_0x3f9621=_0x3f9621-0x0;var _0x758044=_0xbb93[_0x3f9621];return _0x758044;};'use strict';var multer=require(_0x3bb9('0x0'));var util=require('util');var path=require(_0x3bb9('0x1'));var timeout=require('connect-timeout');var express=require(_0x3bb9('0x2'));var router=express[_0x3bb9('0x3')]();var auth=require(_0x3bb9('0x4'));var interaction=require(_0x3bb9('0x5'));var config=require(_0x3bb9('0x6'));var controller=require(_0x3bb9('0x7'));router['get']('/',auth[_0x3bb9('0x8')](),controller[_0x3bb9('0x9')]);router[_0x3bb9('0xa')]('/describe',auth[_0x3bb9('0x8')](),controller['describe']);router[_0x3bb9('0xa')](_0x3bb9('0xb'),auth[_0x3bb9('0x8')](),controller[_0x3bb9('0xc')]);router[_0x3bb9('0xa')](_0x3bb9('0xd'),auth[_0x3bb9('0x8')](),controller[_0x3bb9('0xe')]);router[_0x3bb9('0xa')](_0x3bb9('0xf'),auth[_0x3bb9('0x8')](),controller[_0x3bb9('0x10')]);router[_0x3bb9('0x11')]('/',auth['isAuthenticated'](),controller[_0x3bb9('0x12')]);router[_0x3bb9('0x11')](_0x3bb9('0xd'),auth[_0x3bb9('0x8')](),controller[_0x3bb9('0x13')]);router[_0x3bb9('0x11')](_0x3bb9('0x14'),auth[_0x3bb9('0x8')](),interaction[_0x3bb9('0x15')](_0x3bb9('0x16'),_0x3bb9('0x17')),controller[_0x3bb9('0x18')]);router[_0x3bb9('0x19')](_0x3bb9('0xb'),auth[_0x3bb9('0x8')](),interaction[_0x3bb9('0x15')](_0x3bb9('0x16'),_0x3bb9('0x1a')),controller[_0x3bb9('0x1b')]);router['delete'](_0x3bb9('0xb'),auth[_0x3bb9('0x8')](),interaction['tracked']('mail',_0x3bb9('0x1c')),controller[_0x3bb9('0x1d')]);router['delete'](_0x3bb9('0x14'),auth[_0x3bb9('0x8')](),controller[_0x3bb9('0x1e')]);module[_0x3bb9('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 5fa2e57..3a40067 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 _0x2b43=['STRING','TEXT','long','ENUM','sequelize','iconv','BOOLEAN','DATE'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x2b43,0x13c));var _0x32b4=function(_0x2c25a1,_0x5a8bb8){_0x2c25a1=_0x2c25a1-0x0;var _0x47ed44=_0x2b43[_0x2c25a1];return _0x47ed44;};'use strict';var Sequelize=require(_0x32b4('0x0'));var iconv=require(_0x32b4('0x1'));module['exports']={'closed':{'type':Sequelize[_0x32b4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x32b4('0x3')]},'disposition':{'type':Sequelize[_0x32b4('0x4')]},'note':{'type':Sequelize[_0x32b4('0x4')]},'inReplyTo':{'type':Sequelize[_0x32b4('0x4')](0x1fe)},'to':{'type':Sequelize[_0x32b4('0x4')]},'cc':{'type':Sequelize[_0x32b4('0x5')](_0x32b4('0x6'))},'subject':{'type':Sequelize[_0x32b4('0x5')]()},'attach':{'type':Sequelize[_0x32b4('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x32b4('0x3')]},'substatus':{'type':Sequelize[_0x32b4('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x32b4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x32b4('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x32b4('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x32b4('0x5')]('long')},'lastMsgText':{'type':Sequelize['TEXT'](_0x32b4('0x6'))}}; \ No newline at end of file +var _0x0ebb=['ENUM','out','iconv','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x0ebb,0x142));var _0xb0eb=function(_0x38b887,_0xb71329){_0x38b887=_0x38b887-0x0;var _0x4844ca=_0x0ebb[_0x38b887];return _0x4844ca;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xb0eb('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb0eb('0x1')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb0eb('0x2')]},'inReplyTo':{'type':Sequelize[_0xb0eb('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb0eb('0x3')](_0xb0eb('0x4'))},'subject':{'type':Sequelize[_0xb0eb('0x3')]()},'attach':{'type':Sequelize[_0xb0eb('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb0eb('0x1')]},'substatus':{'type':Sequelize[_0xb0eb('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0xb0eb('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xb0eb('0x6')]('in',_0xb0eb('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb0eb('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xb0eb('0x6')]('in',_0xb0eb('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xb0eb('0x3')]('long')},'lastMsgText':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 61b6ee8..2af485c 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 _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','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','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x4a8fe2,_0x29f7c9){var _0x1c1281=function(_0x547510){while(--_0x547510){_0x4a8fe2['push'](_0x4a8fe2['shift']());}};_0x1c1281(++_0x29f7c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=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 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);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','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','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x1f7c67,_0x455cfb){var _0x41440b=function(_0x53fb13){while(--_0x53fb13){_0x1f7c67['push'](_0x1f7c67['shift']());}};_0x41440b(++_0x455cfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=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 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);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 481ec7c..387f1e4 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 _0xb319=['remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update'];(function(_0x324798,_0x32187b){var _0x4c8cc2=function(_0x1c62c0){while(--_0x1c62c0){_0x324798['push'](_0x324798['shift']());}};_0x4c8cc2(++_0x32187b);}(_0xb319,0x1b4));var _0x9b31=function(_0x11187b,_0x95f00e){_0x11187b=_0x11187b-0x0;var _0x276233=_0xb319[_0x11187b];return _0x276233;};'use strict';var EventEmitter=require(_0x9b31('0x0'));var MailInteraction=require(_0x9b31('0x1'))['db'][_0x9b31('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x9b31('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9b31('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b31('0x5'),'afterDestroy':_0x9b31('0x6')};function emitEvent(_0x1f1493){return function(_0x18a07d,_0x350dcd,_0x2febe1){_0x18a07d[_0x9b31('0x7')]({'attributes':['id'],'raw':!![]})[_0x9b31('0x8')](function(_0x1b20cd){_0x18a07d['setDataValue'](_0x9b31('0x9'),_0x1b20cd[_0x9b31('0xa')](function(_0x27a48b){return{'id':_0x27a48b['id']};}));return MailMessage[_0x9b31('0xb')]({'where':{'MailInteractionId':_0x18a07d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x35e858){_0x18a07d[_0x9b31('0xc')]('unreadMessages',_0x35e858[_0x9b31('0xd')]);MailInteractionEvents['emit'](_0x1f1493+':'+_0x18a07d['id'],_0x18a07d);MailInteractionEvents[_0x9b31('0xe')](_0x1f1493,_0x18a07d);_0x2febe1(null);})['catch'](_0x2febe1(null));};}for(var e in events){if(events[_0x9b31('0xf')](e)){var event=events[e];MailInteraction[_0x9b31('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x16e0=['then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove'];(function(_0x27221f,_0x3f0125){var _0x1946d4=function(_0x2c7b20){while(--_0x2c7b20){_0x27221f['push'](_0x27221f['shift']());}};_0x1946d4(++_0x3f0125);}(_0x16e0,0x18e));var _0x016e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16e0[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x016e('0x0'));var MailInteraction=require(_0x016e('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x016e('0x1'))['db'][_0x016e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x016e('0x3')](0x0);var events={'afterCreate':_0x016e('0x4'),'afterUpdate':_0x016e('0x5'),'afterDestroy':_0x016e('0x6')};function emitEvent(_0x1d00ce){return function(_0x3e5d20,_0x39788e,_0x3a2727){_0x3e5d20['getUsers']({'attributes':['id'],'raw':!![]})[_0x016e('0x7')](function(_0x719d4c){_0x3e5d20[_0x016e('0x8')](_0x016e('0x9'),_0x719d4c[_0x016e('0xa')](function(_0xc5cdb7){return{'id':_0xc5cdb7['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3e5d20['id'],'direction':'in','read':![]},'raw':!![]});})[_0x016e('0x7')](function(_0x4a75f2){_0x3e5d20[_0x016e('0x8')]('unreadMessages',_0x4a75f2[_0x016e('0xb')]);MailInteractionEvents['emit'](_0x1d00ce+':'+_0x3e5d20['id'],_0x3e5d20);MailInteractionEvents[_0x016e('0xc')](_0x1d00ce,_0x3e5d20);_0x3a2727(null);})[_0x016e('0xd')](_0x3a2727(null));};}for(var e in events){if(events[_0x016e('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d4b9409..5e62550 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 _0x5451=['models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','../../config/environment','./mailInteraction.attributes','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x5451,0x16f));var _0x1545=function(_0x52dc5c,_0x5d796f){_0x52dc5c=_0x52dc5c-0x0;var _0x3a4f1f=_0x5451[_0x52dc5c];return _0x3a4f1f;};'use strict';var _=require('lodash');var util=require(_0x1545('0x0'));var logger=require(_0x1545('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1545('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1545('0x3'));var rimraf=require('rimraf');var config=require(_0x1545('0x4'));var attributes=require(_0x1545('0x5'));module['exports']=function(_0x35e486,_0x3494d2){return _0x35e486[_0x1545('0x6')]('MailInteraction',attributes,{'tableName':_0x1545('0x7'),'paranoid':![],'indexes':[{'name':_0x1545('0x8'),'fields':['subject','to'],'type':_0x1545('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa4242b,_0x2e2b83,_0x595e3b){if(_0xa4242b['substatus']){_0xa4242b[_0x1545('0xa')]=moment()[_0x1545('0xb')](_0x1545('0xc'));}if(_0xa4242b[_0x1545('0xd')]){_0xa4242b[_0x1545('0xe')]=moment()[_0x1545('0xb')](_0x1545('0xc'));}_0x595e3b(null,_0x2e2b83);},'beforeUpdate':function(_0x261b1f,_0x498c95,_0x1bf287){if(_0x261b1f[_0x1545('0xf')](_0x1545('0x10'))){_0x261b1f[_0x1545('0xa')]=_0x261b1f[_0x1545('0x10')]?moment()[_0x1545('0xb')](_0x1545('0xc')):null;}if(_0x261b1f[_0x1545('0xf')]('closed')){_0x261b1f[_0x1545('0xe')]=moment()[_0x1545('0xb')](_0x1545('0xc'));_0x261b1f[_0x1545('0x10')]=null;_0x261b1f[_0x1545('0xa')]=null;}_0x1bf287(null,_0x261b1f);},'afterUpdate':function(_0x2007da,_0x400bb2,_0x2c291e){var _0x15b2c3=_0x35e486[_0x1545('0x11')];var _0xf13a66=_0x2007da['get']({'plain':!![]});if(_0xf13a66[_0x1545('0xd')]){return _0x15b2c3[_0x1545('0x12')][_0x1545('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0xf13a66['id']}})[_0x1545('0x14')](function(){_0x2c291e();})[_0x1545('0x15')](function(_0x52c2a3){_0x2c291e(_0x52c2a3);});}else{_0x2c291e();}}},'charset':_0x1545('0x16'),'collate':_0x1545('0x17')});}; \ No newline at end of file +var _0x95c5=['./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatusAt','closedAt','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x43e242,_0x12aeec){var _0x3a90d7=function(_0x3406f4){while(--_0x3406f4){_0x43e242['push'](_0x43e242['shift']());}};_0x3a90d7(++_0x12aeec);}(_0x95c5,0x153));var _0x595c=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x95c5[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x595c('0x0'));var util=require(_0x595c('0x1'));var logger=require('../../config/logger')(_0x595c('0x2'));var moment=require(_0x595c('0x3'));var BPromise=require(_0x595c('0x4'));var rp=require(_0x595c('0x5'));var fs=require('fs');var path=require(_0x595c('0x6'));var rimraf=require(_0x595c('0x7'));var config=require(_0x595c('0x8'));var attributes=require(_0x595c('0x9'));module[_0x595c('0xa')]=function(_0x46be42,_0x4ff80b){return _0x46be42['define'](_0x595c('0xb'),attributes,{'tableName':_0x595c('0xc'),'paranoid':![],'indexes':[{'name':_0x595c('0xd'),'fields':[_0x595c('0xe'),'to'],'type':_0x595c('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x257d4b,_0x1250e7,_0x359da2){if(_0x257d4b[_0x595c('0x10')]){_0x257d4b['substatusAt']=moment()[_0x595c('0x11')](_0x595c('0x12'));}if(_0x257d4b[_0x595c('0x13')]){_0x257d4b['closedAt']=moment()[_0x595c('0x11')](_0x595c('0x12'));}_0x359da2(null,_0x1250e7);},'beforeUpdate':function(_0x39168d,_0x2e3e06,_0x913a30){if(_0x39168d[_0x595c('0x14')](_0x595c('0x10'))){_0x39168d[_0x595c('0x15')]=_0x39168d[_0x595c('0x10')]?moment()[_0x595c('0x11')](_0x595c('0x12')):null;}if(_0x39168d[_0x595c('0x14')](_0x595c('0x13'))){_0x39168d[_0x595c('0x16')]=moment()['format'](_0x595c('0x12'));_0x39168d[_0x595c('0x10')]=null;_0x39168d[_0x595c('0x15')]=null;}_0x913a30(null,_0x39168d);},'afterUpdate':function(_0x28c2ed,_0x5d28f4,_0x5c4afc){var _0x3a2a04=_0x46be42['models'];var _0x505f0c=_0x28c2ed[_0x595c('0x17')]({'plain':!![]});if(_0x505f0c[_0x595c('0x13')]){return _0x3a2a04[_0x595c('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x505f0c['id']}})[_0x595c('0x19')](function(){_0x5c4afc();})[_0x595c('0x1a')](function(_0x47ffbd){_0x5c4afc(_0x47ffbd);});}else{_0x5c4afc();}}},'charset':_0x595c('0x1b'),'collate':_0x595c('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d85b842..3ad4ab4 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 _0x5d31=['catch','UpdateMailInteraction','MailInteraction','update','body','raw','options','where','attributes','limit','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5d31,0xb7));var _0x15d3=function(_0x5055f1,_0x3cbb87){_0x5055f1=_0x5055f1-0x0;var _0x28a9f0=_0x5d31[_0x5055f1];return _0x28a9f0;};'use strict';var _=require(_0x15d3('0x0'));var util=require(_0x15d3('0x1'));var moment=require(_0x15d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x15d3('0x3'));var fs=require('fs');var Redis=require(_0x15d3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x15d3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x15d3('0x6'));var jayson=require(_0x15d3('0x7'));var client=jayson[_0x15d3('0x8')][_0x15d3('0x9')]({'port':0x232a});config[_0x15d3('0xa')]=_[_0x15d3('0xb')](config['redis'],{'host':_0x15d3('0xc'),'port':0x18eb});var socket=require(_0x15d3('0xd'))(new Redis(config[_0x15d3('0xa')]));require('./mailInteraction.socket')[_0x15d3('0xe')](socket);function respondWithRpcPromise(_0x51da1f,_0x52a1c1,_0x33bd06){return new BPromise(function(_0x43c62e,_0x40273d){return client[_0x15d3('0xf')](_0x51da1f,_0x33bd06)[_0x15d3('0x10')](function(_0x1d4a66){logger[_0x15d3('0x11')]('MailInteraction,\x20%s,\x20%s',_0x52a1c1,_0x15d3('0x12'));logger[_0x15d3('0x13')](_0x15d3('0x14'),_0x52a1c1,_0x15d3('0x12'),JSON[_0x15d3('0x15')](_0x1d4a66));if(_0x1d4a66[_0x15d3('0x16')]){if(_0x1d4a66['error'][_0x15d3('0x17')]===0x1f4){logger[_0x15d3('0x16')](_0x15d3('0x18'),_0x52a1c1,_0x1d4a66['error']['message']);return _0x40273d(_0x1d4a66[_0x15d3('0x16')]['message']);}logger[_0x15d3('0x16')](_0x15d3('0x18'),_0x52a1c1,_0x1d4a66[_0x15d3('0x16')][_0x15d3('0x19')]);return _0x43c62e(_0x1d4a66['error'][_0x15d3('0x19')]);}else{logger[_0x15d3('0x11')](_0x15d3('0x18'),_0x52a1c1,_0x15d3('0x12'));_0x43c62e(_0x1d4a66[_0x15d3('0x1a')][_0x15d3('0x19')]);}})[_0x15d3('0x1b')](function(_0x4ad933){logger[_0x15d3('0x16')](_0x15d3('0x18'),_0x52a1c1,_0x4ad933);_0x40273d(_0x4ad933);});});}exports[_0x15d3('0x1c')]=function(_0x482fe7){var _0x50e2e6=this;return new Promise(function(_0x1edff1,_0x25cfdb){return db[_0x15d3('0x1d')][_0x15d3('0x1e')](_0x482fe7[_0x15d3('0x1f')],{'raw':_0x482fe7['options']?_0x482fe7['options'][_0x15d3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x482fe7[_0x15d3('0x21')]?_0x482fe7[_0x15d3('0x21')][_0x15d3('0x22')]||null:null,'attributes':_0x482fe7['options']?_0x482fe7[_0x15d3('0x21')][_0x15d3('0x23')]||null:null,'limit':_0x482fe7[_0x15d3('0x21')]?_0x482fe7['options'][_0x15d3('0x24')]||null:null})[_0x15d3('0x10')](function(_0x3301c3){logger[_0x15d3('0x11')](_0x15d3('0x1c'),_0x482fe7);logger[_0x15d3('0x13')](_0x15d3('0x1c'),_0x482fe7,JSON[_0x15d3('0x15')](_0x3301c3));_0x1edff1(_0x3301c3);})['catch'](function(_0x5d939c){logger['error'](_0x15d3('0x1c'),_0x5d939c['message'],_0x482fe7);_0x25cfdb(_0x50e2e6['error'](0x1f4,_0x5d939c[_0x15d3('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x44776a){return new Promise(function(_0x173194,_0x1e895e){return db[_0x15d3('0x1d')][_0x15d3('0x25')]({'where':_0x44776a[_0x15d3('0x21')]?_0x44776a['options'][_0x15d3('0x22')]||null:null})[_0x15d3('0x10')](function(_0x5744c3){if(_0x5744c3){return _0x5744c3[_0x15d3('0x26')](_0x44776a[_0x15d3('0x1f')][_0x15d3('0x27')],_['omit'](_0x44776a[_0x15d3('0x1f')],[_0x15d3('0x27'),'id'])||{});}})[_0x15d3('0x28')](function(_0x5f457e){logger[_0x15d3('0x11')](_0x15d3('0x29'),_0x44776a);logger[_0x15d3('0x13')](_0x15d3('0x29'),_0x44776a,JSON[_0x15d3('0x15')](_0x5f457e));_0x173194(_0x5f457e);})[_0x15d3('0x1b')](function(_0x4a015e){logger[_0x15d3('0x16')](_0x15d3('0x29'),_0x4a015e['message'],_0x44776a);_0x1e895e(_this[_0x15d3('0x16')](0x1f4,_0x4a015e[_0x15d3('0x19')]));});});}; \ No newline at end of file +var _0x4899=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','MailInteraction','update','body','options','raw','where','attributes','UpdateMailInteraction','stringify','catch','AddTagsToMailInteraction','addTags','spread','AddTags','lodash','moment','randomstring','../../mysqldb'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x4899,0x74));var _0x9489=function(_0x128d13,_0x3db1cd){_0x128d13=_0x128d13-0x0;var _0x5688b2=_0x4899[_0x128d13];return _0x5688b2;};'use strict';var _=require(_0x9489('0x0'));var util=require('util');var moment=require(_0x9489('0x1'));var BPromise=require('bluebird');var rs=require(_0x9489('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9489('0x3'))['db'];var utils=require(_0x9489('0x4'));var logger=require(_0x9489('0x5'))(_0x9489('0x6'));var config=require(_0x9489('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9489('0x8')][_0x9489('0x9')]({'port':0x232a});config[_0x9489('0xa')]=_[_0x9489('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9489('0xc'))(new Redis(config['redis']));require(_0x9489('0xd'))[_0x9489('0xe')](socket);function respondWithRpcPromise(_0x52f169,_0x1dac7c,_0x12480e){return new BPromise(function(_0x141c15,_0x91d101){return client[_0x9489('0xf')](_0x52f169,_0x12480e)[_0x9489('0x10')](function(_0x3808a1){logger[_0x9489('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1dac7c,_0x9489('0x12'));logger[_0x9489('0x13')](_0x9489('0x14'),_0x1dac7c,'request\x20sent',JSON['stringify'](_0x3808a1));if(_0x3808a1[_0x9489('0x15')]){if(_0x3808a1[_0x9489('0x15')][_0x9489('0x16')]===0x1f4){logger['error'](_0x9489('0x17'),_0x1dac7c,_0x3808a1['error'][_0x9489('0x18')]);return _0x91d101(_0x3808a1['error'][_0x9489('0x18')]);}logger[_0x9489('0x15')](_0x9489('0x17'),_0x1dac7c,_0x3808a1[_0x9489('0x15')][_0x9489('0x18')]);return _0x141c15(_0x3808a1['error'][_0x9489('0x18')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x1dac7c,_0x9489('0x12'));_0x141c15(_0x3808a1[_0x9489('0x19')][_0x9489('0x18')]);}})['catch'](function(_0x23ef8f){logger[_0x9489('0x15')]('MailInteraction,\x20%s,\x20%s',_0x1dac7c,_0x23ef8f);_0x91d101(_0x23ef8f);});});}exports['UpdateMailInteraction']=function(_0x10a638){var _0xf4b083=this;return new Promise(function(_0x362ec7,_0x2430a6){return db[_0x9489('0x1a')][_0x9489('0x1b')](_0x10a638[_0x9489('0x1c')],{'raw':_0x10a638['options']?_0x10a638[_0x9489('0x1d')][_0x9489('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10a638[_0x9489('0x1d')]?_0x10a638['options'][_0x9489('0x1f')]||null:null,'attributes':_0x10a638[_0x9489('0x1d')]?_0x10a638[_0x9489('0x1d')][_0x9489('0x20')]||null:null,'limit':_0x10a638[_0x9489('0x1d')]?_0x10a638[_0x9489('0x1d')]['limit']||null:null})[_0x9489('0x10')](function(_0xf68ab6){logger[_0x9489('0x11')](_0x9489('0x21'),_0x10a638);logger[_0x9489('0x13')](_0x9489('0x21'),_0x10a638,JSON[_0x9489('0x22')](_0xf68ab6));_0x362ec7(_0xf68ab6);})[_0x9489('0x23')](function(_0xd92a57){logger[_0x9489('0x15')](_0x9489('0x21'),_0xd92a57[_0x9489('0x18')],_0x10a638);_0x2430a6(_0xf4b083[_0x9489('0x15')](0x1f4,_0xd92a57[_0x9489('0x18')]));});});};exports[_0x9489('0x24')]=function(_0xb9339b){return new Promise(function(_0x515ea8,_0x21b370){return db['MailInteraction']['find']({'where':_0xb9339b['options']?_0xb9339b[_0x9489('0x1d')][_0x9489('0x1f')]||null:null})['then'](function(_0x276003){if(_0x276003){return _0x276003[_0x9489('0x25')](_0xb9339b[_0x9489('0x1c')]['ids'],_['omit'](_0xb9339b[_0x9489('0x1c')],['ids','id'])||{});}})[_0x9489('0x26')](function(_0x1f1bf3){logger[_0x9489('0x11')](_0x9489('0x27'),_0xb9339b);logger[_0x9489('0x13')]('AddTags',_0xb9339b,JSON['stringify'](_0x1f1bf3));_0x515ea8(_0x1f1bf3);})[_0x9489('0x23')](function(_0x1a161f){logger[_0x9489('0x15')]('AddTags',_0x1a161f[_0x9489('0x18')],_0xb9339b);_0x21b370(_this['error'](0x1f4,_0x1a161f[_0x9489('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c0bb769..5a2b409 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 _0x716f=['./mailInteraction.events','save','remove','update','length','mailInteraction:'];(function(_0x5e09ff,_0x361bf3){var _0x294004=function(_0x54b33f){while(--_0x54b33f){_0x5e09ff['push'](_0x5e09ff['shift']());}};_0x294004(++_0x361bf3);}(_0x716f,0x12c));var _0xf716=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x716f[_0x2ae2ad];return _0x26dbd7;};'use strict';var MailInteractionEvents=require(_0xf716('0x0'));var events=[_0xf716('0x1'),_0xf716('0x2'),_0xf716('0x3')];function createListener(_0x46f62f,_0xfbd63c){return function(_0x4d788a){_0xfbd63c['emit'](_0x46f62f,_0x4d788a);};}function removeListener(_0x170e8b,_0x675323){return function(){MailInteractionEvents['removeListener'](_0x170e8b,_0x675323);};}exports['register']=function(_0x57f14e){for(var _0x411828=0x0,_0x2a4c5b=events[_0xf716('0x4')];_0x411828<_0x2a4c5b;_0x411828++){var _0xd171f=events[_0x411828];var _0x265b25=createListener(_0xf716('0x5')+_0xd171f,_0x57f14e);MailInteractionEvents['on'](_0xd171f,_0x265b25);}}; \ No newline at end of file +var _0x4061=['mailInteraction:','./mailInteraction.events','save','remove','emit','register'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x4061,0x91));var _0x1406=function(_0x8b07fc,_0x27a174){_0x8b07fc=_0x8b07fc-0x0;var _0x4c9652=_0x4061[_0x8b07fc];return _0x4c9652;};'use strict';var MailInteractionEvents=require(_0x1406('0x0'));var events=[_0x1406('0x1'),_0x1406('0x2'),'update'];function createListener(_0x198032,_0x33722f){return function(_0x381772){_0x33722f[_0x1406('0x3')](_0x198032,_0x381772);};}function removeListener(_0x3e6c96,_0x4f1dea){return function(){MailInteractionEvents['removeListener'](_0x3e6c96,_0x4f1dea);};}exports[_0x1406('0x4')]=function(_0x344ab2){for(var _0x3d104f=0x0,_0x26ab3b=events['length'];_0x3d104f<_0x26ab3b;_0x3d104f++){var _0x417489=events[_0x3d104f];var _0x8e4da5=createListener(_0x1406('0x5')+_0x417489,_0x344ab2);MailInteractionEvents['on'](_0x417489,_0x8e4da5);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 822cc0d..63aaa62 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 _0x7fbe=['update','/:id/accept','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','tracked','mail','mailmessage:create','create','put'];(function(_0x5d3bea,_0x5dd586){var _0x255103=function(_0x3684c1){while(--_0x3684c1){_0x5d3bea['push'](_0x5d3bea['shift']());}};_0x255103(++_0x5dd586);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xf64e5,_0x4a3232){_0xf64e5=_0xf64e5-0x0;var _0x5f312c=_0x7fbe[_0xf64e5];return _0x5f312c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')]('/',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xa')]);router[_0xe7fb('0x8')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller['describe']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['get']('/:id/download',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')]('/',auth[_0xe7fb('0x9')](),interaction[_0xe7fb('0x10')](_0xe7fb('0x11'),_0xe7fb('0x12')),controller[_0xe7fb('0x13')]);router[_0xe7fb('0x14')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x15')]);router[_0xe7fb('0x14')](_0xe7fb('0x16'),auth[_0xe7fb('0x9')](),controller['accept']);router[_0xe7fb('0x14')](_0xe7fb('0x17'),auth['isAuthenticated'](),controller[_0xe7fb('0x18')]);router[_0xe7fb('0x19')]('/:id',auth[_0xe7fb('0x9')](),controller['destroy']);module[_0xe7fb('0x1a')]=router; \ No newline at end of file +var _0xf3cd=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept'];(function(_0xd501,_0x435fbf){var _0x4b6c4e=function(_0x2e8b5c){while(--_0x2e8b5c){_0xd501['push'](_0xd501['shift']());}};_0x4b6c4e(++_0x435fbf);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xf3cd[_0x480bc8];return _0x28c245;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['get'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdf3c('0xb')](_0xdf3c('0xf'),auth['isAuthenticated'](),controller[_0xdf3c('0x10')]);router[_0xdf3c('0x11')]('/',auth[_0xdf3c('0x9')](),interaction[_0xdf3c('0x12')](_0xdf3c('0x13'),_0xdf3c('0x14')),controller[_0xdf3c('0x15')]);router[_0xdf3c('0x16')]('/:id',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x17')]);router[_0xdf3c('0x16')](_0xdf3c('0x18'),auth['isAuthenticated'](),controller[_0xdf3c('0x19')]);router[_0xdf3c('0x16')](_0xdf3c('0x1a'),auth['isAuthenticated'](),controller[_0xdf3c('0x1b')]);router[_0xdf3c('0x1c')](_0xdf3c('0xe'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1d')]);module[_0xdf3c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 4ce8aab..faf3fb4 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 _0xd301=['ENUM','out','STRING','DATE','INTEGER','sequelize','long','TEXT','medium','BOOLEAN'];(function(_0x496dcb,_0x3d7bb0){var _0x119f69=function(_0x43077f){while(--_0x43077f){_0x496dcb['push'](_0x496dcb['shift']());}};_0x119f69(++_0x3d7bb0);}(_0xd301,0x145));var _0x1d30=function(_0x52ed18,_0x722adb){_0x52ed18=_0x52ed18-0x0;var _0x5d0a9e=_0xd301[_0x52ed18];return _0x5d0a9e;};'use strict';var Sequelize=require(_0x1d30('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize['TEXT'](_0x1d30('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x1d30('0x2')](_0x1d30('0x3'))},'read':{'type':Sequelize[_0x1d30('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1d30('0x5')]('in',_0x1d30('0x6')),'defaultValue':_0x1d30('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1d30('0x7')](0x1fe)},'from':{'type':Sequelize[_0x1d30('0x7')]},'to':{'type':Sequelize['TEXT'](_0x1d30('0x1'))},'cc':{'type':Sequelize[_0x1d30('0x2')](_0x1d30('0x1'))},'bcc':{'type':Sequelize['TEXT'](_0x1d30('0x1'))},'subject':{'type':Sequelize[_0x1d30('0x2')]},'sentAt':{'type':Sequelize[_0x1d30('0x8')]},'attach':{'type':Sequelize[_0x1d30('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1d30('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1d30('0x8')]},'originTo':{'type':Sequelize[_0x1d30('0x2')]('long')},'originCc':{'type':Sequelize[_0x1d30('0x2')](_0x1d30('0x1'))}}; \ No newline at end of file +var _0x39d0=['out','STRING','sequelize','TEXT','long','medium','BOOLEAN'];(function(_0x185ce6,_0x80b049){var _0xb2b554=function(_0x132348){while(--_0x132348){_0x185ce6['push'](_0x185ce6['shift']());}};_0xb2b554(++_0x80b049);}(_0x39d0,0x144));var _0x039d=function(_0x257a11,_0x463b92){_0x257a11=_0x257a11-0x0;var _0x39939e=_0x39d0[_0x257a11];return _0x39939e;};'use strict';var Sequelize=require(_0x039d('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x039d('0x1')](_0x039d('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x039d('0x1')](_0x039d('0x3'))},'read':{'type':Sequelize[_0x039d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x039d('0x5')),'defaultValue':_0x039d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x039d('0x6')](0x1fe)},'from':{'type':Sequelize[_0x039d('0x6')]},'to':{'type':Sequelize[_0x039d('0x1')](_0x039d('0x2'))},'cc':{'type':Sequelize[_0x039d('0x1')](_0x039d('0x2'))},'bcc':{'type':Sequelize[_0x039d('0x1')](_0x039d('0x2'))},'subject':{'type':Sequelize[_0x039d('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x039d('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x039d('0x1')](_0x039d('0x2'))},'originCc':{'type':Sequelize[_0x039d('0x1')](_0x039d('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 7cc21b4..987b208 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 _0xf95f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','json','reject','save','update','destroy','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','params','intersection','fields','include','find','body','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','UserId','Contact','MailInteraction','MailInteractionId','read1stAt','interaction','get','role','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','null','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','server','tmp','message-%s.eml','from','bcc','subject','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','log','err','html-pdf','eml-format'];(function(_0x454d23,_0x5b8587){var _0x2ba5d4=function(_0x14795b){while(--_0x14795b){_0x454d23['push'](_0x454d23['shift']());}};_0x2ba5d4(++_0x5b8587);}(_0xf95f,0x142));var _0xff95=function(_0x972692,_0x2a1c56){_0x972692=_0x972692-0x0;var _0x542e84=_0xf95f[_0x972692];return _0x542e84;};'use strict';var pdf=require(_0xff95('0x0'));var emlformat=require(_0xff95('0x1'));var rimraf=require(_0xff95('0x2'));var zipdir=require(_0xff95('0x3'));var jsonpatch=require(_0xff95('0x4'));var rp=require(_0xff95('0x5'));var moment=require(_0xff95('0x6'));var BPromise=require(_0xff95('0x7'));var Mustache=require(_0xff95('0x8'));var util=require('util');var path=require(_0xff95('0x9'));var sox=require('sox');var csv=require(_0xff95('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xff95('0xb'));var squel=require(_0xff95('0xc'));var crypto=require(_0xff95('0xd'));var jsforce=require(_0xff95('0xe'));var deskjs=require(_0xff95('0xf'));var toCsv=require(_0xff95('0xa'));var querystring=require(_0xff95('0x10'));var Papa=require(_0xff95('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff95('0x12'));var as=require(_0xff95('0x13'));var hardwareService=require(_0xff95('0x14'));var logger=require(_0xff95('0x15'))(_0xff95('0x16'));var utils=require(_0xff95('0x17'));var config=require(_0xff95('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xff95('0x19')](config[_0xff95('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xff95('0x1b'))(new Redis(config['redis']));require('./mailMessage.socket')['register'](socket);var jayson=require(_0xff95('0x1c'));var client=jayson[_0xff95('0x1d')][_0xff95('0x1e')]({'port':0x232c});var client9003=jayson[_0xff95('0x1d')][_0xff95('0x1e')]({'port':0x232b});var client9002=jayson[_0xff95('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x5a8f0b,_0x42b565,_0x96d491){if(_0x96d491){var _0x83e644=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x83e644[_0xff95('0x1f')](_0x42b565)){return _0x5a8f0b;}else{throw new db[(_0xff95('0x20'))][(_0xff95('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5a8f0b;}}function respondWithRpcPromise(_0x3daf80,_0x10cfe5,_0x46fe3f,_0x49f1fb){return new BPromise(function(_0x48731e,_0x306d27){var _0x5dd67c=_0x49f1fb||client;return _0x5dd67c[_0xff95('0x22')](_0x3daf80,_0x46fe3f)[_0xff95('0x23')](function(_0x3a3f10){logger[_0xff95('0x24')](_0xff95('0x25'),_0x10cfe5,_0xff95('0x26'));logger[_0xff95('0x27')](_0xff95('0x28'),_0x10cfe5,_0xff95('0x26'),JSON[_0xff95('0x29')](_0x3a3f10));if(_0x3a3f10[_0xff95('0x2a')]){if(_0x3a3f10['error'][_0xff95('0x2b')]===0x1f4){logger[_0xff95('0x2a')](_0xff95('0x25'),_0x10cfe5,_0x3a3f10[_0xff95('0x2a')][_0xff95('0x2c')]);return _0x306d27(_0x3a3f10[_0xff95('0x2a')][_0xff95('0x2c')]);}logger[_0xff95('0x2a')](_0xff95('0x25'),_0x10cfe5,_0x3a3f10[_0xff95('0x2a')]['message']);return _0x48731e(_0x3a3f10['error']['message']);}else{logger['info'](_0xff95('0x25'),_0x10cfe5,_0xff95('0x26'));_0x48731e(_0x3a3f10[_0xff95('0x2d')][_0xff95('0x2c')]);}})[_0xff95('0x2e')](function(_0x4ef61a){logger[_0xff95('0x2a')](_0xff95('0x25'),_0x10cfe5,_0x4ef61a);_0x306d27(_0x4ef61a);});});}function respondWithStatusCode(_0x277167,_0x44330b){_0x44330b=_0x44330b||0xcc;return function(_0x2528a4){if(_0x2528a4){return _0x277167[_0xff95('0x2f')](_0x44330b);}return _0x277167[_0xff95('0x30')](_0x44330b)[_0xff95('0x31')]();};}function respondWithResult(_0x2c0f2c,_0x586956){_0x586956=_0x586956||0xc8;return function(_0x1c2673){if(_0x1c2673){return _0x2c0f2c[_0xff95('0x30')](_0x586956)['json'](_0x1c2673);}};}function respondWithFilteredResult(_0x3c2919,_0x54bf87){return function(_0x369036){if(_0x369036){var _0x5217de=_0x369036[_0xff95('0x32')],_0x495f01=_0x54bf87[_0xff95('0x33')],_0xd8e6f2=_0x54bf87[_0xff95('0x33')]+_0x54bf87['limit'],_0x19ab19;if(_0xd8e6f2>=_0x5217de){_0xd8e6f2=_0x5217de;_0x19ab19=0xc8;}else{_0x19ab19=0xce;}_0x3c2919['status'](_0x19ab19);return _0x3c2919[_0xff95('0x34')]('Content-Range',_0x495f01+'-'+_0xd8e6f2+'/'+_0x5217de)[_0xff95('0x35')](_0x369036);}return null;};}function patchUpdates(_0x532cd0){return function(_0x200050){try{jsonpatch['apply'](_0x200050,_0x532cd0,!![]);}catch(_0x1869a5){return BPromise[_0xff95('0x36')](_0x1869a5);}return _0x200050[_0xff95('0x37')]();};}function saveUpdates(_0x73a284,_0x14d98b){return function(_0xc8c8e6){if(_0xc8c8e6){return _0xc8c8e6[_0xff95('0x38')](_0x73a284)[_0xff95('0x23')](function(_0x207def){return _0x207def;});}return null;};}function removeEntity(_0x29153f,_0x1cc54f){return function(_0x641993){if(_0x641993){return _0x641993[_0xff95('0x39')]()[_0xff95('0x23')](function(){_0x29153f[_0xff95('0x30')](0xcc)[_0xff95('0x31')]();});}};}function handleEntityNotFound(_0x29adee,_0x40b645){return function(_0x49d5f9){if(!_0x49d5f9){_0x29adee[_0xff95('0x2f')](0x194);}return _0x49d5f9;};}function handleError(_0x20f1b4,_0x283b52){_0x283b52=_0x283b52||0x1f4;return function(_0x2eb5b8){logger[_0xff95('0x2a')](_0x2eb5b8['stack']);if(_0x2eb5b8['name']){delete _0x2eb5b8[_0xff95('0x3a')];}_0x20f1b4[_0xff95('0x30')](_0x283b52)[_0xff95('0x3b')](_0x2eb5b8);};}exports[_0xff95('0x3c')]=function(_0x5880a0,_0x3eebcc){var _0x9348c2={},_0x1a673b={},_0x4d9f7c={'count':0x0,'rows':[]};var _0x203f48=_[_0xff95('0x3d')](db[_0xff95('0x3e')][_0xff95('0x3f')],function(_0x5068ff){return{'name':_0x5068ff[_0xff95('0x40')],'type':_0x5068ff[_0xff95('0x41')][_0xff95('0x42')]};});_0x1a673b[_0xff95('0x43')]=_[_0xff95('0x3d')](_0x203f48,_0xff95('0x3a'));_0x1a673b[_0xff95('0x44')]=_[_0xff95('0x45')](_0x5880a0[_0xff95('0x44')]);_0x1a673b['filters']=_['intersection'](_0x1a673b['model'],_0x1a673b[_0xff95('0x44')]);_0x9348c2['attributes']=_['intersection'](_0x1a673b['model'],qs['fields'](_0x5880a0[_0xff95('0x44')]['fields']));_0x9348c2['attributes']=_0x9348c2[_0xff95('0x46')][_0xff95('0x47')]?_0x9348c2[_0xff95('0x46')]:_0x1a673b[_0xff95('0x43')];if(!_0x5880a0[_0xff95('0x44')]['hasOwnProperty']('nolimit')){_0x9348c2[_0xff95('0x48')]=qs[_0xff95('0x48')](_0x5880a0[_0xff95('0x44')]['limit']);_0x9348c2[_0xff95('0x33')]=qs[_0xff95('0x33')](_0x5880a0[_0xff95('0x44')][_0xff95('0x33')]);}_0x9348c2['order']=qs[_0xff95('0x49')](_0x5880a0['query'][_0xff95('0x49')]);_0x9348c2[_0xff95('0x4a')]=qs['filters'](_[_0xff95('0x4b')](_0x5880a0[_0xff95('0x44')],_0x1a673b[_0xff95('0x4c')]),_0x203f48);if(_0x5880a0[_0xff95('0x44')][_0xff95('0x4d')]){_0x9348c2[_0xff95('0x4a')]=_[_0xff95('0x4e')](_0x9348c2[_0xff95('0x4a')],{'$or':_['map'](_0x203f48,function(_0x36fdb6){if(_0x36fdb6[_0xff95('0x41')]!==_0xff95('0x4f')){var _0x186409={};_0x186409[_0x36fdb6[_0xff95('0x3a')]]={'$like':'%'+_0x5880a0[_0xff95('0x44')][_0xff95('0x4d')]+'%'};return _0x186409;}})});}_0x9348c2=_[_0xff95('0x4e')]({},_0x9348c2,_0x5880a0[_0xff95('0x50')]);var _0x324788={'where':_0x9348c2['where']};return db['MailMessage']['count'](_0x324788)[_0xff95('0x23')](function(_0x3a169a){_0x4d9f7c[_0xff95('0x32')]=_0x3a169a;if(_0x5880a0[_0xff95('0x44')][_0xff95('0x51')]){_0x9348c2['include']=[{'all':!![]}];}return db[_0xff95('0x3e')][_0xff95('0x52')](_0x9348c2);})[_0xff95('0x23')](function(_0x284e25){_0x4d9f7c['rows']=_0x284e25;return _0x4d9f7c;})['then'](respondWithFilteredResult(_0x3eebcc,_0x9348c2))[_0xff95('0x2e')](handleError(_0x3eebcc,null));};exports['show']=function(_0x33892f,_0x355d12){var _0xebfd0f={'raw':!![],'where':{'id':_0x33892f[_0xff95('0x53')]['id']}},_0x5c670a={};_0x5c670a[_0xff95('0x43')]=_[_0xff95('0x45')](db[_0xff95('0x3e')]['rawAttributes']);_0x5c670a['query']=_[_0xff95('0x45')](_0x33892f[_0xff95('0x44')]);_0x5c670a[_0xff95('0x4c')]=_[_0xff95('0x54')](_0x5c670a[_0xff95('0x43')],_0x5c670a[_0xff95('0x44')]);_0xebfd0f[_0xff95('0x46')]=_['intersection'](_0x5c670a[_0xff95('0x43')],qs[_0xff95('0x55')](_0x33892f[_0xff95('0x44')][_0xff95('0x55')]));_0xebfd0f['attributes']=_0xebfd0f['attributes'][_0xff95('0x47')]?_0xebfd0f[_0xff95('0x46')]:_0x5c670a[_0xff95('0x43')];if(_0x33892f[_0xff95('0x44')]['includeAll']){_0xebfd0f[_0xff95('0x56')]=[{'all':!![]}];}_0xebfd0f=_[_0xff95('0x4e')]({},_0xebfd0f,_0x33892f[_0xff95('0x50')]);return db['MailMessage'][_0xff95('0x57')](_0xebfd0f)[_0xff95('0x23')](handleEntityNotFound(_0x355d12,null))[_0xff95('0x23')](respondWithResult(_0x355d12,null))['catch'](handleError(_0x355d12,null));};exports[_0xff95('0x38')]=function(_0x465cb9,_0x1be49a){if(_0x465cb9[_0xff95('0x58')]['id']){delete _0x465cb9['body']['id'];}return db[_0xff95('0x3e')][_0xff95('0x57')]({'where':{'id':_0x465cb9[_0xff95('0x53')]['id']}})[_0xff95('0x23')](handleEntityNotFound(_0x1be49a,null))[_0xff95('0x23')](saveUpdates(_0x465cb9[_0xff95('0x58')],null))['then'](respondWithResult(_0x1be49a,null))[_0xff95('0x2e')](handleError(_0x1be49a,null));};exports[_0xff95('0x39')]=function(_0x5e556a,_0x595c98){return db[_0xff95('0x3e')][_0xff95('0x57')]({'where':{'id':_0x5e556a[_0xff95('0x53')]['id']}})[_0xff95('0x23')](handleEntityNotFound(_0x595c98,null))[_0xff95('0x23')](removeEntity(_0x595c98,null))[_0xff95('0x2e')](handleError(_0x595c98,null));};exports['describe']=function(_0x5807cb,_0x42b224){return db[_0xff95('0x3e')]['describe']()[_0xff95('0x23')](respondWithResult(_0x42b224,null))[_0xff95('0x2e')](handleError(_0x42b224,null));};exports[_0xff95('0x59')]=function(_0x3e7840,_0x593af3){return db[_0xff95('0x3e')][_0xff95('0x59')](_0x3e7840['body'])[_0xff95('0x23')](function(_0x36a611){if(_0x36a611){if(_0x36a611[_0xff95('0x5a')]==='out'&&!_0x36a611[_0xff95('0x5b')]){var _0x4bb2d4,_0x37b8a6,_0x5a9ed4;if(_0x3e7840[_0xff95('0x58')]['to']){_0x37b8a6=_0x3e7840['body']['to'][_0xff95('0x5c')](',')[0x0];}return db[_0xff95('0x5d')][_0xff95('0x5e')]({'where':{'id':_0x36a611[_0xff95('0x5f')]},'include':[{'model':db[_0xff95('0x60')],'as':_0xff95('0x61'),'include':[{'model':db[_0xff95('0x62')],'as':_0xff95('0x63'),'where':{'email':_0x37b8a6},'limit':0x1,'order':[[_0xff95('0x64'),_0xff95('0x65')]]}]},{'model':db[_0xff95('0x66')],'as':'Smtp','raw':!![]}]})[_0xff95('0x23')](function(_0x55665f){_0x4bb2d4=_0x55665f;if(_0x4bb2d4&&_0x4bb2d4[_0xff95('0x67')]){var _0x12d6d6={'tls':{'rejectUnauthorized':![]}};if(_[_0xff95('0x68')](_0x4bb2d4['Smtp'][_0xff95('0x69')])){_0x12d6d6[_0xff95('0x6a')]=_0x4bb2d4[_0xff95('0x67')][_0xff95('0x6a')];_0x12d6d6[_0xff95('0x6b')]=_0x4bb2d4['Smtp'][_0xff95('0x6b')];_0x12d6d6[_0xff95('0x6c')]=_0x4bb2d4['Smtp'][_0xff95('0x6c')];if(_0x4bb2d4[_0xff95('0x67')][_0xff95('0x6d')]){_0x12d6d6[_0xff95('0x6e')]={'user':_0x4bb2d4['Smtp'][_0xff95('0x6f')],'pass':_0x4bb2d4[_0xff95('0x67')]['pass']};}}else{_0x12d6d6[_0xff95('0x69')]=_0x4bb2d4[_0xff95('0x67')][_0xff95('0x69')];_0x12d6d6[_0xff95('0x6e')]={'user':_0x4bb2d4[_0xff95('0x67')][_0xff95('0x6f')],'pass':_0x4bb2d4[_0xff95('0x67')][_0xff95('0x70')]};_0x12d6d6[_0xff95('0x6c')]=_0x4bb2d4['Smtp'][_0xff95('0x6c')];}if(_0x3e7840[_0xff95('0x58')][_0xff95('0x71')]&&_0x3e7840[_0xff95('0x58')][_0xff95('0x71')]['length']){for(var _0x5906f9=0x0;_0x5906f9<_0x3e7840[_0xff95('0x58')][_0xff95('0x71')][_0xff95('0x47')];_0x5906f9+=0x1){_0x3e7840[_0xff95('0x58')][_0xff95('0x71')][_0x5906f9]={'filename':_0x3e7840[_0xff95('0x58')][_0xff95('0x71')][_0x5906f9]['name'],'path':path[_0xff95('0x72')](config[_0xff95('0x73')],'server/files/attachments',_0x3e7840[_0xff95('0x58')][_0xff95('0x71')][_0x5906f9]['basename'])};}}_0x5a9ed4={'account':_0x12d6d6,'message':_0x3e7840['body']};return;}})['then'](function(){if(_0x4bb2d4[_0xff95('0x61')]){if(_0x4bb2d4[_0xff95('0x61')]['Contacts']['length']){return _0x4bb2d4['List'][_0xff95('0x63')][0x0];}else{return db[_0xff95('0x62')]['create'](_['defaults'](_0x3e7840[_0xff95('0x58')],{'firstName':_0x3e7840[_0xff95('0x58')]['to'],'email':_0x3e7840[_0xff95('0x58')]['to'],'phone':_0x3e7840[_0xff95('0x58')]['to'],'ListId':_0x4bb2d4[_0xff95('0x74')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xff95('0x23')](function(){if(_0x5a9ed4){return respondWithRpcPromise(_0xff95('0x75'),_0xff95('0x76'),_0x5a9ed4,client9003)[_0xff95('0x23')](function(_0x2c2311){return _0x36a611[_0xff95('0x38')]({'read':!![],'messageId':_0x2c2311[_0xff95('0x77')],'sentAt':moment()[_0xff95('0x78')](_0xff95('0x79'))});})[_0xff95('0x2e')](function(_0xcb439a){logger['error']('%s',JSON[_0xff95('0x29')](_0xcb439a));return _0x36a611;});}return _0x36a611;});}return _0x36a611;}})['then'](respondWithResult(_0x593af3,0xc9))[_0xff95('0x2e')](handleError(_0x593af3,null));};var interaction_log=require('../../config/logger')(_0xff95('0x7a'));exports[_0xff95('0x7b')]=function(_0x15edbc,_0x4ec3fa,_0x37174e){var _0x525f37={'channel':_0xff95('0x7c')};if(_0x15edbc[_0xff95('0x58')]['id']){delete _0x15edbc[_0xff95('0x58')]['id'];}_0x15edbc[_0xff95('0x58')]['read']=!![];_0x15edbc[_0xff95('0x58')][_0xff95('0x7d')]=moment()[_0xff95('0x78')](_0xff95('0x79'));_0x15edbc[_0xff95('0x58')]['UserId']=_0x15edbc[_0xff95('0x58')][_0xff95('0x7e')]||_0x15edbc['user']['id'];return db['MailMessage'][_0xff95('0x57')]({'where':{'id':_0x15edbc[_0xff95('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xff95('0x62')],'as':_0xff95('0x7f')}]})[_0xff95('0x23')](handleEntityNotFound(_0x4ec3fa,null))['then'](saveUpdates(_0x15edbc[_0xff95('0x58')],null))[_0xff95('0x23')](function(_0x1db9de){if(_0x1db9de){_0x525f37[_0xff95('0x2c')]=_0x1db9de['get']({'plain':!![]});return db[_0xff95('0x80')][_0xff95('0x57')]({'where':{'id':_0x1db9de[_0xff95('0x81')]}});}return null;})['then'](handleEntityNotFound(_0x4ec3fa,null))[_0xff95('0x23')](function(_0x59f011){if(_0x59f011){return _0x59f011['update']({'UserId':_0x15edbc['body'][_0xff95('0x7e')],'read1stAt':_[_0xff95('0x68')](_0x59f011[_0xff95('0x82')])?moment()[_0xff95('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xff95('0x23')](function(_0x213542){if(_0x213542){_0x525f37[_0xff95('0x83')]=_0x213542[_0xff95('0x84')]({'plain':!![]});interaction_log[_0xff95('0x24')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x15edbc[_0xff95('0x6f')]['id'],_0x15edbc['user'][_0xff95('0x3a')],_0x15edbc[_0xff95('0x6f')][_0xff95('0x85')],_0x525f37['interaction']['id'],_0x15edbc['body']?JSON[_0xff95('0x29')](_0x15edbc[_0xff95('0x58')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x525f37);}return null;})['then'](function(_0x1d1e6f){if(_0x1d1e6f){if(_0x15edbc[_0xff95('0x58')][_0xff95('0x86')]){_0x525f37[_0xff95('0x2c')][_0xff95('0x87')]=util[_0xff95('0x78')](_0xff95('0x88'),_0x15edbc[_0xff95('0x6f')][_0xff95('0x3a')]);_0x525f37[_0xff95('0x2c')][_0xff95('0x89')]=_0x525f37[_0xff95('0x89')];_0x525f37[_0xff95('0x2c')]['event']=_0xff95('0x7b');return respondWithRpcPromise(_0xff95('0x8a'),_0xff95('0x8a'),{'event':_0xff95('0x8b'),'message':_0x525f37['message']},client9002)[_0xff95('0x23')](function(){return _0x525f37;});}return _0x525f37;}return null;})['then'](respondWithResult(_0x4ec3fa,null))[_0xff95('0x2e')](handleError(_0x4ec3fa,null));};var interaction_log=require('../../config/logger')(_0xff95('0x7a'));exports['reject']=function(_0x4fa4d0,_0x152b3a,_0x2d348d){var _0x3d8c69={'agent':{},'channel':_0xff95('0x7c')};if(_0x4fa4d0[_0xff95('0x58')]['id']){delete _0x4fa4d0[_0xff95('0x58')]['id'];}_0x4fa4d0['body'][_0xff95('0x7e')]=_0x4fa4d0[_0xff95('0x58')][_0xff95('0x7e')]||_0x4fa4d0[_0xff95('0x6f')]['id'];_0x3d8c69[_0xff95('0x8c')]['id']=_0x4fa4d0[_0xff95('0x58')][_0xff95('0x7e')];return db['MailMessage'][_0xff95('0x57')]({'where':{'id':_0x4fa4d0[_0xff95('0x53')]['id'],'UserId':null}})[_0xff95('0x23')](handleEntityNotFound(_0x152b3a,null))['then'](function(_0x11302d){if(_0x11302d){_0x3d8c69['message']=_0x11302d[_0xff95('0x84')]({'plain':!![]});return db['MailInteraction'][_0xff95('0x57')]({'where':{'id':_0x11302d[_0xff95('0x81')]}});}return null;})[_0xff95('0x23')](handleEntityNotFound(_0x152b3a,null))[_0xff95('0x23')](function(_0x30a87e){if(_0x30a87e){_0x3d8c69['interaction']=_0x30a87e[_0xff95('0x84')]({'plain':!![]});interaction_log[_0xff95('0x24')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fa4d0['user']['id'],_0x4fa4d0[_0xff95('0x6f')][_0xff95('0x3a')],_0x4fa4d0['user'][_0xff95('0x85')],_0x3d8c69[_0xff95('0x83')]['id'],_0x4fa4d0[_0xff95('0x58')]?JSON[_0xff95('0x29')](_0x4fa4d0['body']):_0xff95('0x8d'));return respondWithRpcPromise(_0xff95('0x8e'),_0xff95('0x8f'),_0x3d8c69);}return null;})['then'](function(_0x35f863){if(_0x35f863){_0x35f863[_0xff95('0x2c')][_0xff95('0x87')]=util[_0xff95('0x78')]('SIP/%s',_0x4fa4d0[_0xff95('0x6f')][_0xff95('0x3a')]);_0x35f863['message'][_0xff95('0x89')]=_0x3d8c69[_0xff95('0x89')];_0x35f863[_0xff95('0x2c')]['event']=_0xff95('0x36');respondWithRpcPromise(_0xff95('0x8a'),_0xff95('0x8a'),{'event':_0xff95('0x90'),'message':_0x35f863[_0xff95('0x2c')]},client9002);return _0x3d8c69;}return null;})[_0xff95('0x23')](respondWithResult(_0x152b3a,null))[_0xff95('0x2e')](handleError(_0x152b3a,null));};exports[_0xff95('0x91')]=function(_0x5abbfe,_0x1c3b4d){var _0x31ec6b=moment()[_0xff95('0x92')]()[_0xff95('0x93')]();var _0x9dffc8=path[_0xff95('0x72')](config[_0xff95('0x73')],_0xff95('0x94'),'files',_0xff95('0x95'));var _0x477f48=path[_0xff95('0x72')](config['root'],'server','files',_0xff95('0x71'));var _0x16bcfb=util[_0xff95('0x78')](_0xff95('0x96'),_0x31ec6b);return db[_0xff95('0x3e')][_0xff95('0x57')]({'where':{'id':_0x5abbfe[_0xff95('0x53')]['id']},'attributes':['id',_0xff95('0x58'),_0xff95('0x97'),'to','cc',_0xff95('0x98'),_0xff95('0x99'),'createdAt'],'include':_0x5abbfe[_0xff95('0x44')][_0xff95('0x71')]?[{'model':db['Attachment'],'as':_0xff95('0x9a')}]:undefined})[_0xff95('0x23')](handleEntityNotFound(_0x1c3b4d,null))[_0xff95('0x23')](function(_0x26cf15){if(_0x26cf15){var _0x324312=_0x26cf15;var _0x147c0d={'from':_0x324312['from'],'to':_0x324312['to'],'subject':_0x324312[_0xff95('0x99')],'html':_0x324312[_0xff95('0x58')],'headers':{'Date':moment(_0x324312['createdAt'])[_0xff95('0x78')](_0xff95('0x9b'))},'attachments':[]};if(_0x26cf15['cc']){_0x147c0d[_0xff95('0x9c')]['Cc']=_0x26cf15['cc'];}if(_0x26cf15['bcc']){_0x147c0d[_0xff95('0x9c')][_0xff95('0x9d')]=_0x26cf15[_0xff95('0x98')];}return new BPromise(function(_0x96bbb0,_0x5c3dc7){if(_0x26cf15[_0xff95('0x9a')]){for(var _0x5069b0=0x0;_0x5069b0<_0x26cf15['Attachments'][_0xff95('0x47')];_0x5069b0++){var _0x434002=_0x26cf15['Attachments'][_0x5069b0];var _0x524ee1=path[_0xff95('0x72')](_0x477f48,_0x434002['basename']);if(fs[_0xff95('0x9e')](_0x524ee1)){_0x147c0d['attachments']['push']({'name':_0x434002[_0xff95('0x3a')],'contentType':_0x434002[_0xff95('0x41')],'data':fs[_0xff95('0x9f')](_0x524ee1)});}}}emlformat['build'](_0x147c0d,function(_0x5bafde,_0x12b1c8){if(_0x5bafde)return _0x5c3dc7(_0x5bafde);fs['writeFileSync'](path[_0xff95('0x72')](_0x9dffc8,_0x16bcfb),_0x12b1c8);return _0x96bbb0(_0x12b1c8);});});}})['then'](function(_0x5ca71c){if(_0x5ca71c){return _0x1c3b4d[_0xff95('0x91')](path[_0xff95('0x72')](_0x9dffc8,_0x16bcfb),_0x16bcfb,function(_0x288cff){if(_0x288cff){console[_0xff95('0xa0')](_0xff95('0xa1'),_0x288cff);}else{fs['unlinkSync'](path[_0xff95('0x72')](_0x9dffc8,_0x16bcfb));}});}})[_0xff95('0x2e')](handleError(_0x1c3b4d,null));}; \ No newline at end of file +var _0x6797=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','client','http','test','Sequelize','ValidationError','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','apply','reject','update','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','findAll','rows','params','includeAll','include','find','body','describe','create','direction','out','secret','MailAccountId','MailServerOut','Smtp','isNil','host','port','secure','auth','pass','service','attachments','join','server/files/attachments','basename','List','Contacts','CmContact','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','Contact','get','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','interface','channel','event','EventManager','mail-interactions','agent','MailInteraction','null','RejectMessage','SIP/%s','rejectmessage','unix','toString','root','server','tmp','files','message-%s.eml','from','bcc','createdAt','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse'];(function(_0x559974,_0x116637){var _0x52c87d=function(_0x355028){while(--_0x355028){_0x559974['push'](_0x559974['shift']());}};_0x52c87d(++_0x116637);}(_0x6797,0x94));var _0x7679=function(_0x12127c,_0x26bc7d){_0x12127c=_0x12127c-0x0;var _0x42dec5=_0x6797[_0x12127c];return _0x42dec5;};'use strict';var pdf=require(_0x7679('0x0'));var emlformat=require(_0x7679('0x1'));var rimraf=require(_0x7679('0x2'));var zipdir=require(_0x7679('0x3'));var jsonpatch=require(_0x7679('0x4'));var rp=require(_0x7679('0x5'));var moment=require(_0x7679('0x6'));var BPromise=require(_0x7679('0x7'));var Mustache=require(_0x7679('0x8'));var util=require('util');var path=require(_0x7679('0x9'));var sox=require(_0x7679('0xa'));var csv=require('to-csv');var ejs=require(_0x7679('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7679('0xc'));var crypto=require(_0x7679('0xd'));var jsforce=require(_0x7679('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7679('0xf'));var querystring=require(_0x7679('0x10'));var Papa=require(_0x7679('0x11'));var Redis=require(_0x7679('0x12'));var authService=require(_0x7679('0x13'));var qs=require(_0x7679('0x14'));var as=require(_0x7679('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7679('0x16'))(_0x7679('0x17'));var utils=require(_0x7679('0x18'));var config=require(_0x7679('0x19'));var db=require(_0x7679('0x1a'))['db'];config[_0x7679('0x1b')]=_[_0x7679('0x1c')](config[_0x7679('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x7679('0x1d'))(new Redis(config[_0x7679('0x1b')]));require(_0x7679('0x1e'))[_0x7679('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7679('0x20')][_0x7679('0x21')]({'port':0x232c});var client9003=jayson['client'][_0x7679('0x21')]({'port':0x232b});var client9002=jayson[_0x7679('0x20')][_0x7679('0x21')]({'port':0x232a});function checkPasswordPattern(_0x136245,_0x2aa8c2,_0x283da3){if(_0x283da3){var _0x16eba5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16eba5[_0x7679('0x22')](_0x2aa8c2)){return _0x136245;}else{throw new db[(_0x7679('0x23'))][(_0x7679('0x24'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x136245;}}function respondWithRpcPromise(_0x424c51,_0x2cdec1,_0x59d23b,_0x174929){return new BPromise(function(_0x10f8c5,_0xc2bf2b){var _0x1de5af=_0x174929||client;return _0x1de5af[_0x7679('0x25')](_0x424c51,_0x59d23b)[_0x7679('0x26')](function(_0x3c1a41){logger['info'](_0x7679('0x27'),_0x2cdec1,'request\x20sent');logger[_0x7679('0x28')](_0x7679('0x29'),_0x2cdec1,_0x7679('0x2a'),JSON[_0x7679('0x2b')](_0x3c1a41));if(_0x3c1a41[_0x7679('0x2c')]){if(_0x3c1a41[_0x7679('0x2c')][_0x7679('0x2d')]===0x1f4){logger[_0x7679('0x2c')](_0x7679('0x27'),_0x2cdec1,_0x3c1a41[_0x7679('0x2c')]['message']);return _0xc2bf2b(_0x3c1a41[_0x7679('0x2c')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2cdec1,_0x3c1a41['error'][_0x7679('0x2e')]);return _0x10f8c5(_0x3c1a41[_0x7679('0x2c')][_0x7679('0x2e')]);}else{logger[_0x7679('0x2f')](_0x7679('0x27'),_0x2cdec1,_0x7679('0x2a'));_0x10f8c5(_0x3c1a41[_0x7679('0x30')]['message']);}})[_0x7679('0x31')](function(_0xba9a5a){logger['error'](_0x7679('0x27'),_0x2cdec1,_0xba9a5a);_0xc2bf2b(_0xba9a5a);});});}function respondWithStatusCode(_0x30fcb6,_0x5e0e49){_0x5e0e49=_0x5e0e49||0xcc;return function(_0x4cf0f5){if(_0x4cf0f5){return _0x30fcb6[_0x7679('0x32')](_0x5e0e49);}return _0x30fcb6[_0x7679('0x33')](_0x5e0e49)['end']();};}function respondWithResult(_0x387a1a,_0x5593af){_0x5593af=_0x5593af||0xc8;return function(_0x17769b){if(_0x17769b){return _0x387a1a['status'](_0x5593af)[_0x7679('0x34')](_0x17769b);}};}function respondWithFilteredResult(_0x553bd4,_0x1ebc35){return function(_0x4e93ae){if(_0x4e93ae){var _0x361c07=_0x4e93ae[_0x7679('0x35')],_0x3ee1ae=_0x1ebc35['offset'],_0x320369=_0x1ebc35[_0x7679('0x36')]+_0x1ebc35[_0x7679('0x37')],_0x4a731a;if(_0x320369>=_0x361c07){_0x320369=_0x361c07;_0x4a731a=0xc8;}else{_0x4a731a=0xce;}_0x553bd4[_0x7679('0x33')](_0x4a731a);return _0x553bd4['set']('Content-Range',_0x3ee1ae+'-'+_0x320369+'/'+_0x361c07)['json'](_0x4e93ae);}return null;};}function patchUpdates(_0x55bfb1){return function(_0x2b4c0d){try{jsonpatch[_0x7679('0x38')](_0x2b4c0d,_0x55bfb1,!![]);}catch(_0x13195b){return BPromise[_0x7679('0x39')](_0x13195b);}return _0x2b4c0d['save']();};}function saveUpdates(_0x540c2d,_0x15b712){return function(_0x5d86d9){if(_0x5d86d9){return _0x5d86d9[_0x7679('0x3a')](_0x540c2d)[_0x7679('0x26')](function(_0x45c67d){return _0x45c67d;});}return null;};}function removeEntity(_0x12ab8c,_0x1773e7){return function(_0x5b9bed){if(_0x5b9bed){return _0x5b9bed[_0x7679('0x3b')]()['then'](function(){_0x12ab8c[_0x7679('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eaa33,_0x2e4c13){return function(_0x30d7b0){if(!_0x30d7b0){_0x2eaa33[_0x7679('0x32')](0x194);}return _0x30d7b0;};}function handleError(_0xcbfe81,_0x4e485f){_0x4e485f=_0x4e485f||0x1f4;return function(_0x32c0a8){logger[_0x7679('0x2c')](_0x32c0a8[_0x7679('0x3c')]);if(_0x32c0a8['name']){delete _0x32c0a8[_0x7679('0x3d')];}_0xcbfe81[_0x7679('0x33')](_0x4e485f)[_0x7679('0x3e')](_0x32c0a8);};}exports['index']=function(_0x476c8d,_0x70ced7){var _0x2949aa={},_0x1c2405={},_0xc1d517={'count':0x0,'rows':[]};var _0x47d73c=_['map'](db['MailMessage'][_0x7679('0x3f')],function(_0x3fc6a1){return{'name':_0x3fc6a1[_0x7679('0x40')],'type':_0x3fc6a1[_0x7679('0x41')][_0x7679('0x42')]};});_0x1c2405[_0x7679('0x43')]=_[_0x7679('0x44')](_0x47d73c,_0x7679('0x3d'));_0x1c2405[_0x7679('0x45')]=_[_0x7679('0x46')](_0x476c8d[_0x7679('0x45')]);_0x1c2405[_0x7679('0x47')]=_[_0x7679('0x48')](_0x1c2405[_0x7679('0x43')],_0x1c2405[_0x7679('0x45')]);_0x2949aa[_0x7679('0x49')]=_[_0x7679('0x48')](_0x1c2405[_0x7679('0x43')],qs[_0x7679('0x4a')](_0x476c8d[_0x7679('0x45')][_0x7679('0x4a')]));_0x2949aa[_0x7679('0x49')]=_0x2949aa[_0x7679('0x49')][_0x7679('0x4b')]?_0x2949aa['attributes']:_0x1c2405[_0x7679('0x43')];if(!_0x476c8d[_0x7679('0x45')][_0x7679('0x4c')](_0x7679('0x4d'))){_0x2949aa[_0x7679('0x37')]=qs[_0x7679('0x37')](_0x476c8d[_0x7679('0x45')][_0x7679('0x37')]);_0x2949aa[_0x7679('0x36')]=qs['offset'](_0x476c8d['query']['offset']);}_0x2949aa[_0x7679('0x4e')]=qs[_0x7679('0x4f')](_0x476c8d[_0x7679('0x45')][_0x7679('0x4f')]);_0x2949aa[_0x7679('0x50')]=qs['filters'](_[_0x7679('0x51')](_0x476c8d[_0x7679('0x45')],_0x1c2405[_0x7679('0x47')]),_0x47d73c);if(_0x476c8d[_0x7679('0x45')][_0x7679('0x52')]){_0x2949aa[_0x7679('0x50')]=_[_0x7679('0x53')](_0x2949aa[_0x7679('0x50')],{'$or':_[_0x7679('0x44')](_0x47d73c,function(_0x4d02e1){if(_0x4d02e1['type']!==_0x7679('0x54')){var _0x394d8b={};_0x394d8b[_0x4d02e1[_0x7679('0x3d')]]={'$like':'%'+_0x476c8d[_0x7679('0x45')]['filter']+'%'};return _0x394d8b;}})});}_0x2949aa=_[_0x7679('0x53')]({},_0x2949aa,_0x476c8d[_0x7679('0x55')]);var _0x9fe1cb={'where':_0x2949aa[_0x7679('0x50')]};return db[_0x7679('0x56')][_0x7679('0x35')](_0x9fe1cb)[_0x7679('0x26')](function(_0x555dc1){_0xc1d517[_0x7679('0x35')]=_0x555dc1;if(_0x476c8d[_0x7679('0x45')]['includeAll']){_0x2949aa['include']=[{'all':!![]}];}return db['MailMessage'][_0x7679('0x57')](_0x2949aa);})[_0x7679('0x26')](function(_0x2fa9ca){_0xc1d517[_0x7679('0x58')]=_0x2fa9ca;return _0xc1d517;})[_0x7679('0x26')](respondWithFilteredResult(_0x70ced7,_0x2949aa))[_0x7679('0x31')](handleError(_0x70ced7,null));};exports['show']=function(_0x447c85,_0x9ddc47){var _0x1101c4={'raw':!![],'where':{'id':_0x447c85[_0x7679('0x59')]['id']}},_0x4e07eb={};_0x4e07eb[_0x7679('0x43')]=_[_0x7679('0x46')](db[_0x7679('0x56')][_0x7679('0x3f')]);_0x4e07eb['query']=_['keys'](_0x447c85[_0x7679('0x45')]);_0x4e07eb['filters']=_['intersection'](_0x4e07eb[_0x7679('0x43')],_0x4e07eb[_0x7679('0x45')]);_0x1101c4[_0x7679('0x49')]=_['intersection'](_0x4e07eb['model'],qs[_0x7679('0x4a')](_0x447c85['query'][_0x7679('0x4a')]));_0x1101c4[_0x7679('0x49')]=_0x1101c4[_0x7679('0x49')][_0x7679('0x4b')]?_0x1101c4[_0x7679('0x49')]:_0x4e07eb[_0x7679('0x43')];if(_0x447c85['query'][_0x7679('0x5a')]){_0x1101c4[_0x7679('0x5b')]=[{'all':!![]}];}_0x1101c4=_[_0x7679('0x53')]({},_0x1101c4,_0x447c85[_0x7679('0x55')]);return db['MailMessage'][_0x7679('0x5c')](_0x1101c4)[_0x7679('0x26')](handleEntityNotFound(_0x9ddc47,null))[_0x7679('0x26')](respondWithResult(_0x9ddc47,null))[_0x7679('0x31')](handleError(_0x9ddc47,null));};exports[_0x7679('0x3a')]=function(_0x12b6e9,_0x5ed8c9){if(_0x12b6e9[_0x7679('0x5d')]['id']){delete _0x12b6e9[_0x7679('0x5d')]['id'];}return db['MailMessage'][_0x7679('0x5c')]({'where':{'id':_0x12b6e9['params']['id']}})[_0x7679('0x26')](handleEntityNotFound(_0x5ed8c9,null))[_0x7679('0x26')](saveUpdates(_0x12b6e9['body'],null))[_0x7679('0x26')](respondWithResult(_0x5ed8c9,null))[_0x7679('0x31')](handleError(_0x5ed8c9,null));};exports[_0x7679('0x3b')]=function(_0x4f5278,_0x3b9291){return db['MailMessage'][_0x7679('0x5c')]({'where':{'id':_0x4f5278[_0x7679('0x59')]['id']}})[_0x7679('0x26')](handleEntityNotFound(_0x3b9291,null))[_0x7679('0x26')](removeEntity(_0x3b9291,null))[_0x7679('0x31')](handleError(_0x3b9291,null));};exports[_0x7679('0x5e')]=function(_0x2c6408,_0x1931f1){return db['MailMessage']['describe']()['then'](respondWithResult(_0x1931f1,null))['catch'](handleError(_0x1931f1,null));};exports[_0x7679('0x5f')]=function(_0x5b238a,_0x164ac7){return db[_0x7679('0x56')][_0x7679('0x5f')](_0x5b238a['body'])[_0x7679('0x26')](function(_0x520065){if(_0x520065){if(_0x520065[_0x7679('0x60')]===_0x7679('0x61')&&!_0x520065[_0x7679('0x62')]){var _0x273fb0,_0x4b9ad3,_0x52a946;if(_0x5b238a[_0x7679('0x5d')]['to']){_0x4b9ad3=_0x5b238a[_0x7679('0x5d')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x520065[_0x7679('0x63')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x4b9ad3},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x7679('0x64')],'as':_0x7679('0x65'),'raw':!![]}]})[_0x7679('0x26')](function(_0x33b477){_0x273fb0=_0x33b477;if(_0x273fb0&&_0x273fb0['Smtp']){var _0x266f65={'tls':{'rejectUnauthorized':![]}};if(_[_0x7679('0x66')](_0x273fb0['Smtp']['service'])){_0x266f65[_0x7679('0x67')]=_0x273fb0[_0x7679('0x65')][_0x7679('0x67')];_0x266f65['port']=_0x273fb0[_0x7679('0x65')][_0x7679('0x68')];_0x266f65[_0x7679('0x69')]=_0x273fb0[_0x7679('0x65')][_0x7679('0x69')];if(_0x273fb0[_0x7679('0x65')]['authentication']){_0x266f65[_0x7679('0x6a')]={'user':_0x273fb0[_0x7679('0x65')]['user'],'pass':_0x273fb0['Smtp'][_0x7679('0x6b')]};}}else{_0x266f65['service']=_0x273fb0[_0x7679('0x65')][_0x7679('0x6c')];_0x266f65[_0x7679('0x6a')]={'user':_0x273fb0[_0x7679('0x65')]['user'],'pass':_0x273fb0[_0x7679('0x65')][_0x7679('0x6b')]};_0x266f65[_0x7679('0x69')]=_0x273fb0[_0x7679('0x65')][_0x7679('0x69')];}if(_0x5b238a['body']['attachments']&&_0x5b238a['body'][_0x7679('0x6d')][_0x7679('0x4b')]){for(var _0x1ae639=0x0;_0x1ae639<_0x5b238a[_0x7679('0x5d')][_0x7679('0x6d')][_0x7679('0x4b')];_0x1ae639+=0x1){_0x5b238a['body'][_0x7679('0x6d')][_0x1ae639]={'filename':_0x5b238a[_0x7679('0x5d')]['attachments'][_0x1ae639][_0x7679('0x3d')],'path':path[_0x7679('0x6e')](config['root'],_0x7679('0x6f'),_0x5b238a[_0x7679('0x5d')][_0x7679('0x6d')][_0x1ae639][_0x7679('0x70')])};}}_0x52a946={'account':_0x266f65,'message':_0x5b238a[_0x7679('0x5d')]};return;}})[_0x7679('0x26')](function(){if(_0x273fb0[_0x7679('0x71')]){if(_0x273fb0[_0x7679('0x71')][_0x7679('0x72')][_0x7679('0x4b')]){return _0x273fb0[_0x7679('0x71')][_0x7679('0x72')][0x0];}else{return db[_0x7679('0x73')]['create'](_[_0x7679('0x1c')](_0x5b238a[_0x7679('0x5d')],{'firstName':_0x5b238a[_0x7679('0x5d')]['to'],'email':_0x5b238a[_0x7679('0x5d')]['to'],'phone':_0x5b238a[_0x7679('0x5d')]['to'],'ListId':_0x273fb0['ListId']}));}}else{throw new Error(_0x7679('0x74'));}})[_0x7679('0x26')](function(){if(_0x52a946){return respondWithRpcPromise(_0x7679('0x75'),_0x7679('0x76'),_0x52a946,client9003)[_0x7679('0x26')](function(_0x5cbe92){return _0x520065[_0x7679('0x3a')]({'read':!![],'messageId':_0x5cbe92['messageId'],'sentAt':moment()[_0x7679('0x77')](_0x7679('0x78'))});})[_0x7679('0x31')](function(_0x54e647){logger[_0x7679('0x2c')]('%s',JSON[_0x7679('0x2b')](_0x54e647));return _0x520065;});}return _0x520065;});}return _0x520065;}})[_0x7679('0x26')](respondWithResult(_0x164ac7,0xc9))[_0x7679('0x31')](handleError(_0x164ac7,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0x7679('0x79')]=function(_0x1eadc0,_0x141027,_0x143209){var _0x27e5b5={'channel':_0x7679('0x7a')};if(_0x1eadc0[_0x7679('0x5d')]['id']){delete _0x1eadc0[_0x7679('0x5d')]['id'];}_0x1eadc0[_0x7679('0x5d')][_0x7679('0x7b')]=!![];_0x1eadc0[_0x7679('0x5d')][_0x7679('0x7c')]=moment()[_0x7679('0x77')](_0x7679('0x78'));_0x1eadc0['body'][_0x7679('0x7d')]=_0x1eadc0[_0x7679('0x5d')][_0x7679('0x7d')]||_0x1eadc0[_0x7679('0x7e')]['id'];return db[_0x7679('0x56')]['find']({'where':{'id':_0x1eadc0['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7679('0x7f')}]})[_0x7679('0x26')](handleEntityNotFound(_0x141027,null))[_0x7679('0x26')](saveUpdates(_0x1eadc0[_0x7679('0x5d')],null))['then'](function(_0x48c9a0){if(_0x48c9a0){_0x27e5b5[_0x7679('0x2e')]=_0x48c9a0[_0x7679('0x80')]({'plain':!![]});return db['MailInteraction'][_0x7679('0x5c')]({'where':{'id':_0x48c9a0['MailInteractionId']}});}return null;})[_0x7679('0x26')](handleEntityNotFound(_0x141027,null))[_0x7679('0x26')](function(_0x31451d){if(_0x31451d){return _0x31451d['update']({'UserId':_0x1eadc0[_0x7679('0x5d')][_0x7679('0x7d')],'read1stAt':_[_0x7679('0x66')](_0x31451d[_0x7679('0x81')])?moment()[_0x7679('0x77')](_0x7679('0x78')):undefined});}return null;})['then'](function(_0x20c9db){if(_0x20c9db){_0x27e5b5['interaction']=_0x20c9db[_0x7679('0x80')]({'plain':!![]});interaction_log['info'](_0x7679('0x82'),_0x1eadc0[_0x7679('0x7e')]['id'],_0x1eadc0[_0x7679('0x7e')][_0x7679('0x3d')],_0x1eadc0[_0x7679('0x7e')][_0x7679('0x83')],_0x27e5b5[_0x7679('0x84')]['id'],_0x1eadc0[_0x7679('0x5d')]?JSON[_0x7679('0x2b')](_0x1eadc0[_0x7679('0x5d')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x27e5b5);}return null;})['then'](function(_0x17be86){if(_0x17be86){if(_0x1eadc0['body']['manual']){_0x27e5b5[_0x7679('0x2e')][_0x7679('0x85')]=util[_0x7679('0x77')]('SIP/%s',_0x1eadc0[_0x7679('0x7e')]['name']);_0x27e5b5['message']['channel']=_0x27e5b5[_0x7679('0x86')];_0x27e5b5[_0x7679('0x2e')][_0x7679('0x87')]='accept';return respondWithRpcPromise(_0x7679('0x88'),_0x7679('0x88'),{'event':'acceptmessage','message':_0x27e5b5[_0x7679('0x2e')]},client9002)[_0x7679('0x26')](function(){return _0x27e5b5;});}return _0x27e5b5;}return null;})['then'](respondWithResult(_0x141027,null))[_0x7679('0x31')](handleError(_0x141027,null));};var interaction_log=require('../../config/logger')(_0x7679('0x89'));exports[_0x7679('0x39')]=function(_0x3c54a7,_0x59c73e,_0x344d2c){var _0x213a77={'agent':{},'channel':_0x7679('0x7a')};if(_0x3c54a7[_0x7679('0x5d')]['id']){delete _0x3c54a7[_0x7679('0x5d')]['id'];}_0x3c54a7[_0x7679('0x5d')]['UserId']=_0x3c54a7[_0x7679('0x5d')][_0x7679('0x7d')]||_0x3c54a7[_0x7679('0x7e')]['id'];_0x213a77[_0x7679('0x8a')]['id']=_0x3c54a7['body']['UserId'];return db[_0x7679('0x56')][_0x7679('0x5c')]({'where':{'id':_0x3c54a7['params']['id'],'UserId':null}})[_0x7679('0x26')](handleEntityNotFound(_0x59c73e,null))['then'](function(_0x59ab5f){if(_0x59ab5f){_0x213a77[_0x7679('0x2e')]=_0x59ab5f['get']({'plain':!![]});return db[_0x7679('0x8b')][_0x7679('0x5c')]({'where':{'id':_0x59ab5f['MailInteractionId']}});}return null;})[_0x7679('0x26')](handleEntityNotFound(_0x59c73e,null))[_0x7679('0x26')](function(_0x4849df){if(_0x4849df){_0x213a77[_0x7679('0x84')]=_0x4849df[_0x7679('0x80')]({'plain':!![]});interaction_log[_0x7679('0x2f')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c54a7['user']['id'],_0x3c54a7[_0x7679('0x7e')][_0x7679('0x3d')],_0x3c54a7['user'][_0x7679('0x83')],_0x213a77[_0x7679('0x84')]['id'],_0x3c54a7[_0x7679('0x5d')]?JSON[_0x7679('0x2b')](_0x3c54a7[_0x7679('0x5d')]):_0x7679('0x8c'));return respondWithRpcPromise(_0x7679('0x8d'),'rejectMessage',_0x213a77);}return null;})[_0x7679('0x26')](function(_0xa8ad55){if(_0xa8ad55){_0xa8ad55[_0x7679('0x2e')]['interface']=util[_0x7679('0x77')](_0x7679('0x8e'),_0x3c54a7['user']['name']);_0xa8ad55['message'][_0x7679('0x86')]=_0x213a77[_0x7679('0x86')];_0xa8ad55[_0x7679('0x2e')][_0x7679('0x87')]=_0x7679('0x39');respondWithRpcPromise(_0x7679('0x88'),'EventManager',{'event':_0x7679('0x8f'),'message':_0xa8ad55[_0x7679('0x2e')]},client9002);return _0x213a77;}return null;})[_0x7679('0x26')](respondWithResult(_0x59c73e,null))['catch'](handleError(_0x59c73e,null));};exports['download']=function(_0x101ded,_0x2b9133){var _0x2fb5de=moment()[_0x7679('0x90')]()[_0x7679('0x91')]();var _0x57f8e6=path['join'](config[_0x7679('0x92')],_0x7679('0x93'),'files',_0x7679('0x94'));var _0x462edd=path[_0x7679('0x6e')](config[_0x7679('0x92')],_0x7679('0x93'),_0x7679('0x95'),_0x7679('0x6d'));var _0x35e220=util['format'](_0x7679('0x96'),_0x2fb5de);return db['MailMessage'][_0x7679('0x5c')]({'where':{'id':_0x101ded[_0x7679('0x59')]['id']},'attributes':['id',_0x7679('0x5d'),_0x7679('0x97'),'to','cc',_0x7679('0x98'),'subject',_0x7679('0x99')],'include':_0x101ded[_0x7679('0x45')][_0x7679('0x6d')]?[{'model':db['Attachment'],'as':_0x7679('0x9a')}]:undefined})[_0x7679('0x26')](handleEntityNotFound(_0x2b9133,null))[_0x7679('0x26')](function(_0x27539d){if(_0x27539d){var _0x502e1b=_0x27539d;var _0xffcb56={'from':_0x502e1b['from'],'to':_0x502e1b['to'],'subject':_0x502e1b[_0x7679('0x9b')],'html':_0x502e1b[_0x7679('0x5d')],'headers':{'Date':moment(_0x502e1b[_0x7679('0x99')])[_0x7679('0x77')](_0x7679('0x9c'))},'attachments':[]};if(_0x27539d['cc']){_0xffcb56[_0x7679('0x9d')]['Cc']=_0x27539d['cc'];}if(_0x27539d[_0x7679('0x98')]){_0xffcb56['headers'][_0x7679('0x9e')]=_0x27539d['bcc'];}return new BPromise(function(_0x5543b7,_0x3c1348){if(_0x27539d['Attachments']){for(var _0xd6948d=0x0;_0xd6948d<_0x27539d[_0x7679('0x9a')]['length'];_0xd6948d++){var _0x3c2cd0=_0x27539d[_0x7679('0x9a')][_0xd6948d];var _0x32821b=path['join'](_0x462edd,_0x3c2cd0['basename']);if(fs[_0x7679('0x9f')](_0x32821b)){_0xffcb56[_0x7679('0x6d')]['push']({'name':_0x3c2cd0['name'],'contentType':_0x3c2cd0['type'],'data':fs['readFileSync'](_0x32821b)});}}}emlformat[_0x7679('0xa0')](_0xffcb56,function(_0x4303b3,_0x46dfbb){if(_0x4303b3)return _0x3c1348(_0x4303b3);fs[_0x7679('0xa1')](path['join'](_0x57f8e6,_0x35e220),_0x46dfbb);return _0x5543b7(_0x46dfbb);});});}})[_0x7679('0x26')](function(_0x31386d){if(_0x31386d){return _0x2b9133[_0x7679('0xa2')](path['join'](_0x57f8e6,_0x35e220),_0x35e220,function(_0x2feabe){if(_0x2feabe){console[_0x7679('0xa3')](_0x7679('0xa4'),_0x2feabe);}else{fs[_0x7679('0xa5')](path[_0x7679('0x6e')](_0x57f8e6,_0x35e220));}});}})[_0x7679('0x31')](handleError(_0x2b9133,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index b209294..24e482a 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 _0x2ec2=['emit','exports','events','../../mysqldb','MailMessage','save','remove'];(function(_0x190b5f,_0x1dcf86){var _0x3525c6=function(_0x3af424){while(--_0x3af424){_0x190b5f['push'](_0x190b5f['shift']());}};_0x3525c6(++_0x1dcf86);}(_0x2ec2,0xd4));var _0x22ec=function(_0x574dea,_0x4cf209){_0x574dea=_0x574dea-0x0;var _0x3ed444=_0x2ec2[_0x574dea];return _0x3ed444;};'use strict';var EventEmitter=require(_0x22ec('0x0'));var MailMessage=require(_0x22ec('0x1'))['db'][_0x22ec('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x22ec('0x3'),'afterUpdate':'update','afterDestroy':_0x22ec('0x4')};function emitEvent(_0x3fee79){return function(_0x2b2f03,_0xe65575,_0x28fd64){MailMessageEvents[_0x22ec('0x5')](_0x3fee79+':'+_0x2b2f03['id'],_0x2b2f03);MailMessageEvents[_0x22ec('0x5')](_0x3fee79,_0x2b2f03);_0x28fd64(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x22ec('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x274b=['MailMessage','setMaxListeners','emit','hook','exports','events','../../mysqldb'];(function(_0x2e11f4,_0x48eb5c){var _0x489000=function(_0x299e6e){while(--_0x299e6e){_0x2e11f4['push'](_0x2e11f4['shift']());}};_0x489000(++_0x48eb5c);}(_0x274b,0x1a2));var _0xb274=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x274b[_0x1969a7];return _0x3d665f;};'use strict';var EventEmitter=require(_0xb274('0x0'));var MailMessage=require(_0xb274('0x1'))['db'][_0xb274('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb274('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x565179){return function(_0x6bfe70,_0x15a59e,_0x4fa073){MailMessageEvents[_0xb274('0x4')](_0x565179+':'+_0x6bfe70['id'],_0x6bfe70);MailMessageEvents['emit'](_0x565179,_0x6bfe70);_0x4fa073(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xb274('0x5')](e,emitEvent(event));}}module[_0xb274('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 24d49cf..259eac4 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 _0x97aa=['define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','models','get','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','direction','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports'];(function(_0x4f0317,_0xb2e5a1){var _0x4e24e3=function(_0x5070a3){while(--_0x5070a3){_0x4f0317['push'](_0x4f0317['shift']());}};_0x4e24e3(++_0xb2e5a1);}(_0x97aa,0x10e));var _0xa97a=function(_0x352a71,_0x4aab75){_0x352a71=_0x352a71-0x0;var _0x2a85bb=_0x97aa[_0x352a71];return _0x2a85bb;};'use strict';var _=require(_0xa97a('0x0'));var util=require(_0xa97a('0x1'));var logger=require('../../config/logger')(_0xa97a('0x2'));var moment=require(_0xa97a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa97a('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xa97a('0x5'));var rimraf=require(_0xa97a('0x6'));var config=require(_0xa97a('0x7'));var attributes=require(_0xa97a('0x8'));module[_0xa97a('0x9')]=function(_0xff3041,_0x4bc3fd){return _0xff3041[_0xa97a('0xa')](_0xa97a('0xb'),attributes,{'tableName':_0xa97a('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa97a('0xd')]},{'name':_0xa97a('0xe'),'fields':['plainBody',_0xa97a('0xf')],'type':_0xa97a('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x16700a,_0xd9e538,_0x107103){if(_0x16700a[_0xa97a('0x11')]){_0x16700a['plainBody']=htmlToText['fromString'](_0x16700a[_0xa97a('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x107103(null,_0xd9e538);},'afterCreate':function(_0x526c42,_0x1f63ce,_0x263424){var _0x1420bc=_0xff3041[_0xa97a('0x12')];var _0x478282=_0x526c42[_0xa97a('0x13')]({'plain':!![]});if(_0x478282['direction'][_0xa97a('0x14')]()==='in'||_0x478282['direction']['toLowerCase']()===_0xa97a('0x15')&&!_0x478282[_0xa97a('0x16')]&&!_[_0xa97a('0x17')](_0x478282[_0xa97a('0x18')])){_0x1420bc[_0xa97a('0x19')][_0xa97a('0x1a')]({'where':{'id':_0x478282[_0xa97a('0x1b')]}})[_0xa97a('0x1c')](function(_0x2b0d48){if(_0x2b0d48){_0x2b0d48[_0xa97a('0x1d')]({'lastMsgAt':_0x478282[_0xa97a('0x1e')],'lastMsgDirection':_0x478282[_0xa97a('0x1f')]['toLowerCase'](),'lastMsgBody':_0x478282[_0xa97a('0x11')]});}})[_0xa97a('0x20')](function(_0xabb2e){console[_0xa97a('0x21')](_0xabb2e);});}_0x263424();}},'charset':'utf8mb4','collate':_0xa97a('0x22')});}; \ No newline at end of file +var _0xb776=['body','models','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject'];(function(_0x46001d,_0x2ca20e){var _0x564620=function(_0x1c0590){while(--_0x1c0590){_0x46001d['push'](_0x46001d['shift']());}};_0x564620(++_0x2ca20e);}(_0xb776,0x126));var _0x6b77=function(_0x259ad0,_0xcec4a7){_0x259ad0=_0x259ad0-0x0;var _0x3b1d3c=_0xb776[_0x259ad0];return _0x3b1d3c;};'use strict';var _=require(_0x6b77('0x0'));var util=require(_0x6b77('0x1'));var logger=require(_0x6b77('0x2'))(_0x6b77('0x3'));var moment=require(_0x6b77('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b77('0x5'));var htmlToText=require(_0x6b77('0x6'));var fs=require('fs');var path=require(_0x6b77('0x7'));var rimraf=require(_0x6b77('0x8'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x6b77('0x9')]=function(_0x581fd1,_0x11fc23){return _0x581fd1[_0x6b77('0xa')](_0x6b77('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x6b77('0xc'),'fields':[_0x6b77('0xc')]},{'name':_0x6b77('0xd'),'fields':[_0x6b77('0xe'),_0x6b77('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2fa651,_0x3846b3,_0x22d902){if(_0x2fa651[_0x6b77('0x10')]){_0x2fa651[_0x6b77('0xe')]=htmlToText['fromString'](_0x2fa651[_0x6b77('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x22d902(null,_0x3846b3);},'afterCreate':function(_0x4812ac,_0x564297,_0x5978fa){var _0x19c21c=_0x581fd1[_0x6b77('0x11')];var _0x12408e=_0x4812ac['get']({'plain':!![]});if(_0x12408e[_0x6b77('0x12')][_0x6b77('0x13')]()==='in'||_0x12408e[_0x6b77('0x12')][_0x6b77('0x13')]()===_0x6b77('0x14')&&!_0x12408e['secret']&&!_[_0x6b77('0x15')](_0x12408e[_0x6b77('0x16')])){_0x19c21c[_0x6b77('0x17')][_0x6b77('0x18')]({'where':{'id':_0x12408e['MailInteractionId']}})[_0x6b77('0x19')](function(_0x4967d5){if(_0x4967d5){_0x4967d5[_0x6b77('0x1a')]({'lastMsgAt':_0x12408e[_0x6b77('0x1b')],'lastMsgDirection':_0x12408e['direction'][_0x6b77('0x13')](),'lastMsgBody':_0x12408e['body']});}})['catch'](function(_0x18426a){console[_0x6b77('0x1c')](_0x18426a);});}_0x5978fa();}},'charset':_0x6b77('0x1d'),'collate':_0x6b77('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b6ab38f..183e61f 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 _0x10dc=['create','options','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','CreateMailMessage','MailMessage'];(function(_0x59d48a,_0x3a79f6){var _0x3572ab=function(_0x33464e){while(--_0x33464e){_0x59d48a['push'](_0x59d48a['shift']());}};_0x3572ab(++_0x3a79f6);}(_0x10dc,0x107));var _0xc10d=function(_0x163555,_0x27ce78){_0x163555=_0x163555-0x0;var _0x250307=_0x10dc[_0x163555];return _0x250307;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var moment=require('moment');var BPromise=require(_0xc10d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc10d('0x3'));var db=require(_0xc10d('0x4'))['db'];var utils=require(_0xc10d('0x5'));var logger=require(_0xc10d('0x6'))(_0xc10d('0x7'));var config=require(_0xc10d('0x8'));var jayson=require(_0xc10d('0x9'));var client=jayson[_0xc10d('0xa')]['http']({'port':0x232a});config[_0xc10d('0xb')]=_['defaults'](config['redis'],{'host':_0xc10d('0xc'),'port':0x18eb});var socket=require(_0xc10d('0xd'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xc10d('0xe')](socket);function respondWithRpcPromise(_0x3ff52a,_0x1363e1,_0x1443ba){return new BPromise(function(_0x1b6b16,_0x4f2cf3){return client['request'](_0x3ff52a,_0x1443ba)[_0xc10d('0xf')](function(_0x5ef4ba){logger[_0xc10d('0x10')]('MailMessage,\x20%s,\x20%s',_0x1363e1,_0xc10d('0x11'));logger['debug'](_0xc10d('0x12'),_0x1363e1,_0xc10d('0x11'),JSON[_0xc10d('0x13')](_0x5ef4ba));if(_0x5ef4ba[_0xc10d('0x14')]){if(_0x5ef4ba[_0xc10d('0x14')]['code']===0x1f4){logger[_0xc10d('0x14')]('MailMessage,\x20%s,\x20%s',_0x1363e1,_0x5ef4ba[_0xc10d('0x14')][_0xc10d('0x15')]);return _0x4f2cf3(_0x5ef4ba[_0xc10d('0x14')][_0xc10d('0x15')]);}logger[_0xc10d('0x14')](_0xc10d('0x16'),_0x1363e1,_0x5ef4ba[_0xc10d('0x14')][_0xc10d('0x15')]);return _0x1b6b16(_0x5ef4ba['error']['message']);}else{logger[_0xc10d('0x10')](_0xc10d('0x16'),_0x1363e1,_0xc10d('0x11'));_0x1b6b16(_0x5ef4ba[_0xc10d('0x17')][_0xc10d('0x15')]);}})[_0xc10d('0x18')](function(_0x8c8cae){logger[_0xc10d('0x14')](_0xc10d('0x16'),_0x1363e1,_0x8c8cae);_0x4f2cf3(_0x8c8cae);});});}exports[_0xc10d('0x19')]=function(_0x28f7b5){var _0xb1016b=this;return new Promise(function(_0x2dccea,_0x49d9d5){return db[_0xc10d('0x1a')][_0xc10d('0x1b')](_0x28f7b5['body'],{'raw':_0x28f7b5[_0xc10d('0x1c')]?_0x28f7b5[_0xc10d('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc10d('0xf')](function(_0x4f8b05){logger['info'](_0xc10d('0x19'),_0x28f7b5);logger['debug']('CreateMailMessage',_0x28f7b5,JSON[_0xc10d('0x13')](_0x4f8b05));_0x2dccea(_0x4f8b05);})[_0xc10d('0x18')](function(_0x2ded8c){logger[_0xc10d('0x14')](_0xc10d('0x19'),_0x2ded8c['message'],_0x28f7b5);_0x49d9d5(_0xb1016b['error'](0x1f4,_0x2ded8c[_0xc10d('0x15')]));});});}; \ No newline at end of file +var _0xe260=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','info'];(function(_0x2fa067,_0x2c8969){var _0x34b760=function(_0x26cdd3){while(--_0x26cdd3){_0x2fa067['push'](_0x2fa067['shift']());}};_0x34b760(++_0x2c8969);}(_0xe260,0x94));var _0x0e26=function(_0x55cd67,_0x5155d6){_0x55cd67=_0x55cd67-0x0;var _0x489dc8=_0xe260[_0x55cd67];return _0x489dc8;};'use strict';var _=require(_0x0e26('0x0'));var util=require('util');var moment=require(_0x0e26('0x1'));var BPromise=require(_0x0e26('0x2'));var rs=require(_0x0e26('0x3'));var fs=require('fs');var Redis=require(_0x0e26('0x4'));var db=require(_0x0e26('0x5'))['db'];var utils=require(_0x0e26('0x6'));var logger=require(_0x0e26('0x7'))(_0x0e26('0x8'));var config=require(_0x0e26('0x9'));var jayson=require(_0x0e26('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0e26('0xb')]=_[_0x0e26('0xc')](config[_0x0e26('0xb')],{'host':_0x0e26('0xd'),'port':0x18eb});var socket=require(_0x0e26('0xe'))(new Redis(config[_0x0e26('0xb')]));require(_0x0e26('0xf'))['register'](socket);function respondWithRpcPromise(_0x10c177,_0x58e0fe,_0x45038c){return new BPromise(function(_0x246f2a,_0x27c2cc){return client['request'](_0x10c177,_0x45038c)['then'](function(_0x34d4fe){logger[_0x0e26('0x10')]('MailMessage,\x20%s,\x20%s',_0x58e0fe,_0x0e26('0x11'));logger[_0x0e26('0x12')](_0x0e26('0x13'),_0x58e0fe,'request\x20sent',JSON[_0x0e26('0x14')](_0x34d4fe));if(_0x34d4fe[_0x0e26('0x15')]){if(_0x34d4fe[_0x0e26('0x15')][_0x0e26('0x16')]===0x1f4){logger[_0x0e26('0x15')](_0x0e26('0x17'),_0x58e0fe,_0x34d4fe[_0x0e26('0x15')]['message']);return _0x27c2cc(_0x34d4fe[_0x0e26('0x15')][_0x0e26('0x18')]);}logger[_0x0e26('0x15')](_0x0e26('0x17'),_0x58e0fe,_0x34d4fe['error'][_0x0e26('0x18')]);return _0x246f2a(_0x34d4fe[_0x0e26('0x15')][_0x0e26('0x18')]);}else{logger[_0x0e26('0x10')](_0x0e26('0x17'),_0x58e0fe,'request\x20sent');_0x246f2a(_0x34d4fe[_0x0e26('0x19')][_0x0e26('0x18')]);}})[_0x0e26('0x1a')](function(_0xac68fb){logger[_0x0e26('0x15')](_0x0e26('0x17'),_0x58e0fe,_0xac68fb);_0x27c2cc(_0xac68fb);});});}exports[_0x0e26('0x1b')]=function(_0x1cb0b5){var _0x1af307=this;return new Promise(function(_0x23ad05,_0x2f1df7){return db[_0x0e26('0x1c')][_0x0e26('0x1d')](_0x1cb0b5[_0x0e26('0x1e')],{'raw':_0x1cb0b5['options']?_0x1cb0b5[_0x0e26('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x0e26('0x20')](function(_0x57fd1c){logger[_0x0e26('0x10')](_0x0e26('0x1b'),_0x1cb0b5);logger[_0x0e26('0x12')](_0x0e26('0x1b'),_0x1cb0b5,JSON[_0x0e26('0x14')](_0x57fd1c));_0x23ad05(_0x57fd1c);})[_0x0e26('0x1a')](function(_0x320d6b){logger[_0x0e26('0x15')](_0x0e26('0x1b'),_0x320d6b[_0x0e26('0x18')],_0x1cb0b5);_0x2f1df7(_0x1af307[_0x0e26('0x15')](0x1f4,_0x320d6b[_0x0e26('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 654dec3..816a8bf 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 _0xf684=['remove','emit','removeListener','register','length','./mailMessage.events'];(function(_0x365dd7,_0x36930c){var _0x54588f=function(_0x30243c){while(--_0x30243c){_0x365dd7['push'](_0x365dd7['shift']());}};_0x54588f(++_0x36930c);}(_0xf684,0x1d9));var _0x4f68=function(_0x2cd95e,_0x482885){_0x2cd95e=_0x2cd95e-0x0;var _0x3c6176=_0xf684[_0x2cd95e];return _0x3c6176;};'use strict';var MailMessageEvents=require(_0x4f68('0x0'));var events=['save',_0x4f68('0x1'),'update'];function createListener(_0x1fdc8e,_0x48fbf3){return function(_0x51f2b9){_0x48fbf3[_0x4f68('0x2')](_0x1fdc8e,_0x51f2b9);};}function removeListener(_0x764aad,_0x4d6a60){return function(){MailMessageEvents[_0x4f68('0x3')](_0x764aad,_0x4d6a60);};}exports[_0x4f68('0x4')]=function(_0x996aec){for(var _0x2173b7=0x0,_0x2ffcbc=events[_0x4f68('0x5')];_0x2173b7<_0x2ffcbc;_0x2173b7++){var _0x573572=events[_0x2173b7];var _0x476cd3=createListener('mailMessage:'+_0x573572,_0x996aec);MailMessageEvents['on'](_0x573572,_0x476cd3);}}; \ No newline at end of file +var _0xc285=['emit','removeListener','register','length','./mailMessage.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc285,0xcc));var _0x5c28=function(_0xd734c5,_0x2d6668){_0xd734c5=_0xd734c5-0x0;var _0x169b64=_0xc285[_0xd734c5];return _0x169b64;};'use strict';var MailMessageEvents=require(_0x5c28('0x0'));var events=[_0x5c28('0x1'),_0x5c28('0x2'),_0x5c28('0x3')];function createListener(_0x49f127,_0x3ab797){return function(_0x2f227e){_0x3ab797[_0x5c28('0x4')](_0x49f127,_0x2f227e);};}function removeListener(_0x305246,_0x4a63da){return function(){MailMessageEvents[_0x5c28('0x5')](_0x305246,_0x4a63da);};}exports[_0x5c28('0x6')]=function(_0x3e9398){for(var _0x2bd70e=0x0,_0x5505a5=events[_0x5c28('0x7')];_0x2bd70e<_0x5505a5;_0x2bd70e++){var _0x3a5d15=events[_0x2bd70e];var _0x398c05=createListener('mailMessage:'+_0x3a5d15,_0x3e9398);MailMessageEvents['on'](_0x3a5d15,_0x398c05);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d9da82c..71cfab8 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 _0x2113=['./mailQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../config/environment'];(function(_0x303e0c,_0x5e60b8){var _0x284ecc=function(_0x4c1bbd){while(--_0x4c1bbd){_0x303e0c['push'](_0x303e0c['shift']());}};_0x284ecc(++_0x5e60b8);}(_0x2113,0xf6));var _0x3211=function(_0x47d080,_0x3b9de0){_0x47d080=_0x47d080-0x0;var _0x32462b=_0x2113[_0x47d080];return _0x32462b;};'use strict';var multer=require(_0x3211('0x0'));var util=require(_0x3211('0x1'));var path=require(_0x3211('0x2'));var timeout=require(_0x3211('0x3'));var express=require(_0x3211('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3211('0x5'));var controller=require(_0x3211('0x6'));router[_0x3211('0x7')]('/',auth['isAuthenticated'](),controller[_0x3211('0x8')]);router[_0x3211('0x7')](_0x3211('0x9'),auth['isAuthenticated'](),controller[_0x3211('0xa')]);router[_0x3211('0x7')](_0x3211('0xb'),auth[_0x3211('0xc')](),controller[_0x3211('0xd')]);router[_0x3211('0x7')](_0x3211('0xe'),auth[_0x3211('0xc')](),controller[_0x3211('0xf')]);router[_0x3211('0x7')](_0x3211('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3211('0x7')](_0x3211('0x11'),auth[_0x3211('0xc')](),controller[_0x3211('0x12')]);router[_0x3211('0x13')]('/',auth[_0x3211('0xc')](),controller[_0x3211('0x14')]);router['post'](_0x3211('0x10'),auth[_0x3211('0xc')](),controller[_0x3211('0x15')]);router['post'](_0x3211('0x11'),auth[_0x3211('0xc')](),controller['addAgents']);router['put']('/:id',auth[_0x3211('0xc')](),controller[_0x3211('0x16')]);router['delete'](_0x3211('0xb'),auth['isAuthenticated'](),controller[_0x3211('0x17')]);router[_0x3211('0x18')](_0x3211('0x10'),auth[_0x3211('0xc')](),controller[_0x3211('0x19')]);router[_0x3211('0x18')](_0x3211('0x11'),auth['isAuthenticated'](),controller[_0x3211('0x1a')]);module[_0x3211('0x1b')]=router; \ No newline at end of file +var _0x9e7c=['index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x1638b6,_0x4d72dc){var _0x857ef=function(_0x4ed37a){while(--_0x4ed37a){_0x1638b6['push'](_0x1638b6['shift']());}};_0x857ef(++_0x4d72dc);}(_0x9e7c,0xc1));var _0xc9e7=function(_0x3a3b25,_0x57c04e){_0x3a3b25=_0x3a3b25-0x0;var _0x74fb28=_0x9e7c[_0x3a3b25];return _0x74fb28;};'use strict';var multer=require(_0xc9e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc9e7('0x1'));var express=require(_0xc9e7('0x2'));var router=express[_0xc9e7('0x3')]();var auth=require(_0xc9e7('0x4'));var interaction=require(_0xc9e7('0x5'));var config=require(_0xc9e7('0x6'));var controller=require(_0xc9e7('0x7'));router[_0xc9e7('0x8')]('/',auth[_0xc9e7('0x9')](),controller[_0xc9e7('0xa')]);router[_0xc9e7('0x8')](_0xc9e7('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc9e7('0xc'),auth[_0xc9e7('0x9')](),controller[_0xc9e7('0xd')]);router[_0xc9e7('0x8')](_0xc9e7('0xe'),auth[_0xc9e7('0x9')](),controller[_0xc9e7('0xf')]);router['get'](_0xc9e7('0x10'),auth[_0xc9e7('0x9')](),controller[_0xc9e7('0x11')]);router[_0xc9e7('0x8')](_0xc9e7('0x12'),auth[_0xc9e7('0x9')](),controller[_0xc9e7('0x13')]);router[_0xc9e7('0x14')]('/',auth[_0xc9e7('0x9')](),controller[_0xc9e7('0x15')]);router[_0xc9e7('0x14')](_0xc9e7('0x10'),auth[_0xc9e7('0x9')](),controller[_0xc9e7('0x16')]);router['post'](_0xc9e7('0x12'),auth[_0xc9e7('0x9')](),controller['addAgents']);router[_0xc9e7('0x17')](_0xc9e7('0xc'),auth[_0xc9e7('0x9')](),controller[_0xc9e7('0x18')]);router[_0xc9e7('0x19')]('/:id',auth[_0xc9e7('0x9')](),controller[_0xc9e7('0x1a')]);router['delete'](_0xc9e7('0x10'),auth[_0xc9e7('0x9')](),controller['removeTeams']);router[_0xc9e7('0x19')](_0xc9e7('0x12'),auth[_0xc9e7('0x9')](),controller[_0xc9e7('0x1b')]);module[_0xc9e7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7368938..fa89c20 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 _0x8165=['ENUM','rrmemory','beepall','sequelize','exports','name','STRING'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x8165,0x1c3));var _0x5816=function(_0xcbcd25,_0x24b282){_0xcbcd25=_0xcbcd25-0x0;var _0x4bd555=_0x8165[_0xcbcd25];return _0x4bd555;};'use strict';var Sequelize=require(_0x5816('0x0'));module[_0x5816('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5816('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5816('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5816('0x4')](_0x5816('0x5'),_0x5816('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x070f=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x070f,0x13a));var _0xf070=function(_0x8df904,_0xec10f){_0x8df904=_0x8df904-0x0;var _0x4d3b81=_0x070f[_0x8df904];return _0x4d3b81;};'use strict';var Sequelize=require(_0xf070('0x0'));module['exports']={'name':{'type':Sequelize[_0xf070('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf070('0x1')]},'timeout':{'type':Sequelize[_0xf070('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf070('0x3')](_0xf070('0x4'),_0xf070('0x5'),_0xf070('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 54ce06d..728caa9 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 _0x9e39=['json','apply','reject','save','update','then','get','MailQueues','destroy','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeTeams','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','order','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','count','offset','limit','set','Content-Range'];(function(_0x510bef,_0x45d98e){var _0x5af891=function(_0x477668){while(--_0x477668){_0x510bef['push'](_0x510bef['shift']());}};_0x5af891(++_0x45d98e);}(_0x9e39,0xff));var _0x99e3=function(_0x21553c,_0x1302ce){_0x21553c=_0x21553c-0x0;var _0x2c5546=_0x9e39[_0x21553c];return _0x2c5546;};'use strict';var pdf=require(_0x99e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x99e3('0x1'));var zipdir=require(_0x99e3('0x2'));var jsonpatch=require(_0x99e3('0x3'));var rp=require(_0x99e3('0x4'));var moment=require(_0x99e3('0x5'));var BPromise=require(_0x99e3('0x6'));var Mustache=require(_0x99e3('0x7'));var util=require(_0x99e3('0x8'));var path=require('path');var sox=require(_0x99e3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x99e3('0xa'));var crypto=require(_0x99e3('0xb'));var jsforce=require(_0x99e3('0xc'));var deskjs=require(_0x99e3('0xd'));var toCsv=require(_0x99e3('0xe'));var querystring=require(_0x99e3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x99e3('0x10'));var qs=require(_0x99e3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99e3('0x12'));var logger=require(_0x99e3('0x13'))(_0x99e3('0x14'));var utils=require(_0x99e3('0x15'));var config=require('../../config/environment');var db=require(_0x99e3('0x16'))['db'];config[_0x99e3('0x17')]=_[_0x99e3('0x18')](config[_0x99e3('0x17')],{'host':_0x99e3('0x19'),'port':0x18eb});var socket=require(_0x99e3('0x1a'))(new Redis(config[_0x99e3('0x17')]));require(_0x99e3('0x1b'))[_0x99e3('0x1c')](socket);function respondWithStatusCode(_0x3defda,_0x29fa71){_0x29fa71=_0x29fa71||0xcc;return function(_0x449c4a){if(_0x449c4a){return _0x3defda[_0x99e3('0x1d')](_0x29fa71);}return _0x3defda['status'](_0x29fa71)[_0x99e3('0x1e')]();};}function respondWithResult(_0x1eaf0a,_0x55a225){_0x55a225=_0x55a225||0xc8;return function(_0x495d0a){if(_0x495d0a){return _0x1eaf0a[_0x99e3('0x1f')](_0x55a225)['json'](_0x495d0a);}};}function respondWithFilteredResult(_0x3723fb,_0x7a115c){return function(_0x11744d){if(_0x11744d){var _0xd6d0=_0x11744d[_0x99e3('0x20')],_0x37a7b2=_0x7a115c[_0x99e3('0x21')],_0x52cd82=_0x7a115c[_0x99e3('0x21')]+_0x7a115c[_0x99e3('0x22')],_0x5dfdc7;if(_0x52cd82>=_0xd6d0){_0x52cd82=_0xd6d0;_0x5dfdc7=0xc8;}else{_0x5dfdc7=0xce;}_0x3723fb[_0x99e3('0x1f')](_0x5dfdc7);return _0x3723fb[_0x99e3('0x23')](_0x99e3('0x24'),_0x37a7b2+'-'+_0x52cd82+'/'+_0xd6d0)[_0x99e3('0x25')](_0x11744d);}return null;};}function patchUpdates(_0x42e7f5){return function(_0x2bc332){try{jsonpatch[_0x99e3('0x26')](_0x2bc332,_0x42e7f5,!![]);}catch(_0x364cc4){return BPromise[_0x99e3('0x27')](_0x364cc4);}return _0x2bc332[_0x99e3('0x28')]();};}function saveUpdates(_0x3a1c79,_0x46007c){return function(_0x86b1c4){if(_0x86b1c4){return _0x86b1c4[_0x99e3('0x29')](_0x3a1c79)[_0x99e3('0x2a')](function(_0x7d67f0){return _0x7d67f0;});}return null;};}function removeEntity(_0x34c019,_0x43e950){return function(_0x4518cd){if(_0x4518cd){return _0x4518cd['destroy']()[_0x99e3('0x2a')](function(){var _0x8ab5e1=_0x4518cd[_0x99e3('0x2b')]({'plain':!![]});var _0x4ada40=_0x99e3('0x2c');return db['UserProfileResource'][_0x99e3('0x2d')]({'where':{'type':_0x4ada40,'resourceId':_0x8ab5e1['id']}})[_0x99e3('0x2a')](function(){return _0x4518cd;});})[_0x99e3('0x2a')](function(){_0x34c019['status'](0xcc)[_0x99e3('0x1e')]();});}};}function handleEntityNotFound(_0x3b0125,_0x1ee922){return function(_0xd3f5db){if(!_0xd3f5db){_0x3b0125[_0x99e3('0x1d')](0x194);}return _0xd3f5db;};}function handleError(_0x1eb3c7,_0x3e3781){_0x3e3781=_0x3e3781||0x1f4;return function(_0x5a8ea1){logger[_0x99e3('0x2e')](_0x5a8ea1[_0x99e3('0x2f')]);if(_0x5a8ea1['name']){delete _0x5a8ea1[_0x99e3('0x30')];}_0x1eb3c7['status'](_0x3e3781)[_0x99e3('0x31')](_0x5a8ea1);};}exports[_0x99e3('0x32')]=function(_0x2f133d,_0x3169f9){var _0x51fc09={},_0x4af9d7={},_0x59abbe={'count':0x0,'rows':[]};var _0x54fa38=_['map'](db[_0x99e3('0x33')][_0x99e3('0x34')],function(_0x5e47d3){return{'name':_0x5e47d3[_0x99e3('0x35')],'type':_0x5e47d3[_0x99e3('0x36')][_0x99e3('0x37')]};});_0x4af9d7['model']=_[_0x99e3('0x38')](_0x54fa38,_0x99e3('0x30'));_0x4af9d7[_0x99e3('0x39')]=_[_0x99e3('0x3a')](_0x2f133d['query']);_0x4af9d7[_0x99e3('0x3b')]=_['intersection'](_0x4af9d7[_0x99e3('0x3c')],_0x4af9d7[_0x99e3('0x39')]);_0x51fc09['attributes']=_[_0x99e3('0x3d')](_0x4af9d7[_0x99e3('0x3c')],qs[_0x99e3('0x3e')](_0x2f133d[_0x99e3('0x39')][_0x99e3('0x3e')]));_0x51fc09[_0x99e3('0x3f')]=_0x51fc09[_0x99e3('0x3f')][_0x99e3('0x40')]?_0x51fc09[_0x99e3('0x3f')]:_0x4af9d7[_0x99e3('0x3c')];if(!_0x2f133d[_0x99e3('0x39')][_0x99e3('0x41')](_0x99e3('0x42'))){_0x51fc09[_0x99e3('0x22')]=qs[_0x99e3('0x22')](_0x2f133d['query'][_0x99e3('0x22')]);_0x51fc09[_0x99e3('0x21')]=qs[_0x99e3('0x21')](_0x2f133d[_0x99e3('0x39')][_0x99e3('0x21')]);}_0x51fc09['order']=qs['sort'](_0x2f133d['query'][_0x99e3('0x43')]);_0x51fc09[_0x99e3('0x44')]=qs['filters'](_[_0x99e3('0x45')](_0x2f133d[_0x99e3('0x39')],_0x4af9d7[_0x99e3('0x3b')]),_0x54fa38);if(_0x2f133d[_0x99e3('0x39')][_0x99e3('0x46')]){_0x51fc09['where']=_[_0x99e3('0x47')](_0x51fc09[_0x99e3('0x44')],{'$or':_[_0x99e3('0x38')](_0x54fa38,function(_0x23ec33){if(_0x23ec33[_0x99e3('0x36')]!=='VIRTUAL'){var _0x3e8d63={};_0x3e8d63[_0x23ec33[_0x99e3('0x30')]]={'$like':'%'+_0x2f133d[_0x99e3('0x39')]['filter']+'%'};return _0x3e8d63;}})});}_0x51fc09=_['merge']({},_0x51fc09,_0x2f133d[_0x99e3('0x48')]);var _0x521f8b={'where':_0x51fc09[_0x99e3('0x44')]};return db[_0x99e3('0x33')][_0x99e3('0x20')](_0x521f8b)[_0x99e3('0x2a')](function(_0x55e720){_0x59abbe[_0x99e3('0x20')]=_0x55e720;if(_0x2f133d[_0x99e3('0x39')][_0x99e3('0x49')]){_0x51fc09['include']=[{'all':!![]}];}return db['MailQueue'][_0x99e3('0x4a')](_0x51fc09);})[_0x99e3('0x2a')](function(_0x2ca552){_0x59abbe[_0x99e3('0x4b')]=_0x2ca552;return _0x59abbe;})[_0x99e3('0x2a')](respondWithFilteredResult(_0x3169f9,_0x51fc09))[_0x99e3('0x4c')](handleError(_0x3169f9,null));};exports[_0x99e3('0x4d')]=function(_0x1d06e7,_0x460138){var _0x25a67b={'raw':!![],'where':{'id':_0x1d06e7[_0x99e3('0x4e')]['id']}},_0x1c05a0={};_0x1c05a0['model']=_['keys'](db['MailQueue'][_0x99e3('0x34')]);_0x1c05a0[_0x99e3('0x39')]=_[_0x99e3('0x3a')](_0x1d06e7[_0x99e3('0x39')]);_0x1c05a0[_0x99e3('0x3b')]=_[_0x99e3('0x3d')](_0x1c05a0['model'],_0x1c05a0[_0x99e3('0x39')]);_0x25a67b[_0x99e3('0x3f')]=_[_0x99e3('0x3d')](_0x1c05a0[_0x99e3('0x3c')],qs[_0x99e3('0x3e')](_0x1d06e7[_0x99e3('0x39')][_0x99e3('0x3e')]));_0x25a67b[_0x99e3('0x3f')]=_0x25a67b[_0x99e3('0x3f')][_0x99e3('0x40')]?_0x25a67b[_0x99e3('0x3f')]:_0x1c05a0[_0x99e3('0x3c')];if(_0x1d06e7[_0x99e3('0x39')][_0x99e3('0x49')]){_0x25a67b[_0x99e3('0x4f')]=[{'all':!![]}];}_0x25a67b=_[_0x99e3('0x47')]({},_0x25a67b,_0x1d06e7[_0x99e3('0x48')]);return db[_0x99e3('0x33')]['find'](_0x25a67b)[_0x99e3('0x2a')](handleEntityNotFound(_0x460138,null))['then'](respondWithResult(_0x460138,null))['catch'](handleError(_0x460138,null));};exports[_0x99e3('0x50')]=function(_0xf12d2b,_0x2b66f5){return db[_0x99e3('0x33')][_0x99e3('0x50')](_0xf12d2b[_0x99e3('0x51')],{})[_0x99e3('0x2a')](function(_0x3a87b2){var _0x1faf5f=_0xf12d2b[_0x99e3('0x52')]['get']({'plain':!![]});if(!_0x1faf5f)throw new Error(_0x99e3('0x53'));if(_0x1faf5f[_0x99e3('0x54')]===_0x99e3('0x52')){var _0x38baf0=_0x3a87b2[_0x99e3('0x2b')]({'plain':!![]});var _0x4ea7ee=_0x99e3('0x2c');return db[_0x99e3('0x55')][_0x99e3('0x56')]({'where':{'name':_0x4ea7ee,'userProfileId':_0x1faf5f['userProfileId']},'raw':!![]})['then'](function(_0x4be5da){if(_0x4be5da&&_0x4be5da[_0x99e3('0x57')]===0x0){return db[_0x99e3('0x58')][_0x99e3('0x50')]({'name':_0x38baf0[_0x99e3('0x30')],'resourceId':_0x38baf0['id'],'type':_0x4be5da[_0x99e3('0x30')],'sectionId':_0x4be5da['id']},{})['then'](function(){return _0x3a87b2;});}else{return _0x3a87b2;}})[_0x99e3('0x4c')](function(_0x2c0f27){logger[_0x99e3('0x2e')](_0x99e3('0x59'),_0x2c0f27);throw _0x2c0f27;});}return _0x3a87b2;})['then'](respondWithResult(_0x2b66f5,0xc9))['catch'](handleError(_0x2b66f5,null));};exports['update']=function(_0x475a6f,_0x5c822b){if(_0x475a6f['body']['id']){delete _0x475a6f['body']['id'];}return db['MailQueue'][_0x99e3('0x56')]({'where':{'id':_0x475a6f['params']['id']}})[_0x99e3('0x2a')](handleEntityNotFound(_0x5c822b,null))[_0x99e3('0x2a')](saveUpdates(_0x475a6f['body'],null))[_0x99e3('0x2a')](respondWithResult(_0x5c822b,null))['catch'](handleError(_0x5c822b,null));};exports[_0x99e3('0x2d')]=function(_0x4a7dbb,_0x15dc6a){return db['MailQueue'][_0x99e3('0x56')]({'where':{'id':_0x4a7dbb[_0x99e3('0x4e')]['id']}})[_0x99e3('0x2a')](handleEntityNotFound(_0x15dc6a,null))[_0x99e3('0x2a')](removeEntity(_0x15dc6a,null))[_0x99e3('0x4c')](handleError(_0x15dc6a,null));};exports[_0x99e3('0x5a')]=function(_0x5d8de7,_0x1212cc){return db[_0x99e3('0x33')][_0x99e3('0x5a')]()['then'](respondWithResult(_0x1212cc,null))[_0x99e3('0x4c')](handleError(_0x1212cc,null));};exports[_0x99e3('0x5b')]=function(_0x4a9703,_0x247743,_0x216237){var _0x467a62={'raw':!![],'where':{}},_0x33256c={},_0x18bb53;return db[_0x99e3('0x33')][_0x99e3('0x5c')]({'where':{'id':_0x4a9703[_0x99e3('0x4e')]['id']}})[_0x99e3('0x2a')](handleEntityNotFound(_0x247743,null))[_0x99e3('0x2a')](function(_0x504f89){if(_0x504f89){_0x18bb53=_0x504f89[_0x99e3('0x2b')]({'plain':!![]});_0x33256c[_0x99e3('0x3c')]=_[_0x99e3('0x3a')](db[_0x99e3('0x5d')][_0x99e3('0x34')]);_0x33256c[_0x99e3('0x39')]=_['keys'](_0x4a9703[_0x99e3('0x39')]);_0x33256c['filters']=_[_0x99e3('0x3d')](_0x33256c[_0x99e3('0x3c')],_0x33256c[_0x99e3('0x39')]);_0x467a62['attributes']=_['intersection'](_0x33256c['model'],qs[_0x99e3('0x3e')](_0x4a9703[_0x99e3('0x39')][_0x99e3('0x3e')]));_0x467a62[_0x99e3('0x3f')]=_0x467a62[_0x99e3('0x3f')][_0x99e3('0x40')]?_0x467a62[_0x99e3('0x3f')]:_0x33256c[_0x99e3('0x3c')];if(!_0x4a9703[_0x99e3('0x39')][_0x99e3('0x41')](_0x99e3('0x42'))){_0x467a62[_0x99e3('0x22')]=qs[_0x99e3('0x22')](_0x4a9703[_0x99e3('0x39')][_0x99e3('0x22')]);_0x467a62[_0x99e3('0x21')]=qs[_0x99e3('0x21')](_0x4a9703[_0x99e3('0x39')][_0x99e3('0x21')]);}_0x467a62['order']=qs[_0x99e3('0x43')](_0x4a9703[_0x99e3('0x39')][_0x99e3('0x43')]);_0x467a62[_0x99e3('0x44')]=qs['filters'](_[_0x99e3('0x45')](_0x4a9703[_0x99e3('0x39')],_0x33256c['filters']));_0x467a62[_0x99e3('0x44')]['MailQueueId']=_0x504f89['id'];if(_0x4a9703[_0x99e3('0x39')]['filter']){_0x467a62[_0x99e3('0x44')]=_[_0x99e3('0x47')](_0x467a62[_0x99e3('0x44')],{'$or':_[_0x99e3('0x38')](_0x467a62[_0x99e3('0x3f')],function(_0x58850b){var _0x20579c={};_0x20579c[_0x58850b]={'$like':'%'+_0x4a9703[_0x99e3('0x39')]['filter']+'%'};return _0x20579c;})});}_0x467a62=_[_0x99e3('0x47')]({},_0x467a62,_0x4a9703[_0x99e3('0x48')]);return db['UserMailQueue'][_0x99e3('0x4a')](_0x467a62);}})[_0x99e3('0x2a')](function(_0x52f878){if(_0x52f878){return db[_0x99e3('0x5e')][_0x99e3('0x5f')]({'where':{'id':_[_0x99e3('0x38')](_0x52f878,_0x99e3('0x60')),'role':_0x99e3('0x61')},'attributes':['id',_0x99e3('0x30'),_0x99e3('0x62'),_0x99e3('0x63'),_0x99e3('0x64')]});}})[_0x99e3('0x2a')](function(_0x4bd737){if(_0x4bd737){return{'count':_0x4bd737['count'],'rows':_[_0x99e3('0x38')](_0x4bd737[_0x99e3('0x4b')],function(_0x4405e4){return{'membername':_0x4405e4[_0x99e3('0x30')],'UserId':_0x4405e4['id'],'queue_name':_0x18bb53[_0x99e3('0x30')],'MailQueueId':_0x18bb53['id'],'interface':util[_0x99e3('0x65')](_0x99e3('0x66'),'SIP',_0x4405e4['name']),'penalty':0x0,'paused':_0x4405e4[_0x99e3('0x62')],'createdAt':_0x4405e4[_0x99e3('0x64')],'updatedAt':_0x4405e4[_0x99e3('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x99e3('0x2a')](respondWithFilteredResult(_0x247743,_0x467a62))[_0x99e3('0x4c')](handleError(_0x247743,null));};exports[_0x99e3('0x67')]=function(_0x11d0c8,_0x4d6f95,_0x582b0d){var _0x227de1={};var _0x436ad5={};var _0x53be66;var _0x1b5ec3;return db[_0x99e3('0x33')][_0x99e3('0x5c')]({'where':{'id':_0x11d0c8[_0x99e3('0x4e')]['id']}})[_0x99e3('0x2a')](handleEntityNotFound(_0x4d6f95,null))[_0x99e3('0x2a')](function(_0x35a42d){if(_0x35a42d){_0x53be66=_0x35a42d;_0x436ad5[_0x99e3('0x3c')]=_[_0x99e3('0x3a')](db[_0x99e3('0x68')][_0x99e3('0x34')]);_0x436ad5[_0x99e3('0x39')]=_['keys'](_0x11d0c8[_0x99e3('0x39')]);_0x436ad5['filters']=_[_0x99e3('0x3d')](_0x436ad5['model'],_0x436ad5['query']);_0x227de1[_0x99e3('0x3f')]=_['intersection'](_0x436ad5[_0x99e3('0x3c')],qs[_0x99e3('0x3e')](_0x11d0c8[_0x99e3('0x39')][_0x99e3('0x3e')]));_0x227de1[_0x99e3('0x3f')]=_0x227de1['attributes'][_0x99e3('0x40')]?_0x227de1[_0x99e3('0x3f')]:_0x436ad5[_0x99e3('0x3c')];_0x227de1['order']=qs[_0x99e3('0x43')](_0x11d0c8['query']['sort']);_0x227de1['where']=qs[_0x99e3('0x3b')](_[_0x99e3('0x45')](_0x11d0c8['query'],_0x436ad5['filters']));if(_0x11d0c8[_0x99e3('0x39')][_0x99e3('0x46')]){_0x227de1[_0x99e3('0x44')]=_[_0x99e3('0x47')](_0x227de1[_0x99e3('0x44')],{'$or':_[_0x99e3('0x38')](_0x227de1[_0x99e3('0x3f')],function(_0xb7e972){var _0x19e9e3={};_0x19e9e3[_0xb7e972]={'$like':'%'+_0x11d0c8[_0x99e3('0x39')][_0x99e3('0x46')]+'%'};return _0x19e9e3;})});}_0x227de1=_['merge']({},_0x227de1,_0x11d0c8['options']);return _0x53be66[_0x99e3('0x67')](_0x227de1);}})[_0x99e3('0x2a')](function(_0x4784ca){if(_0x4784ca){_0x1b5ec3=_0x4784ca[_0x99e3('0x40')];if(!_0x11d0c8[_0x99e3('0x39')]['hasOwnProperty'](_0x99e3('0x42'))){_0x227de1['limit']=qs['limit'](_0x11d0c8[_0x99e3('0x39')][_0x99e3('0x22')]);_0x227de1[_0x99e3('0x21')]=qs[_0x99e3('0x21')](_0x11d0c8[_0x99e3('0x39')][_0x99e3('0x21')]);}return _0x53be66[_0x99e3('0x67')](_0x227de1);}})[_0x99e3('0x2a')](function(_0x5f4ca8){if(_0x5f4ca8){return _0x5f4ca8?{'count':_0x1b5ec3,'rows':_0x5f4ca8}:null;}})[_0x99e3('0x2a')](respondWithResult(_0x4d6f95,null))['catch'](handleError(_0x4d6f95,null));};exports['addTeams']=function(_0x3456d1,_0x142ec3,_0x59c3fa){var _0x49c535=_0x3456d1['body'][_0x99e3('0x69')];return db[_0x99e3('0x68')]['findAll']({'where':{'id':_0x49c535},'attributes':['id'],'include':[{'model':db['User'],'as':_0x99e3('0x6a'),'attributes':['id',_0x99e3('0x30'),_0x99e3('0x6b'),_0x99e3('0x6c'),_0x99e3('0x6d')],'raw':!![]}]})[_0x99e3('0x2a')](function(_0xc5674b){if(_0xc5674b){var _0x536ce3=_[_0x99e3('0x6e')](_0xc5674b,function(_0x38bb2f){var _0x26a692=_0x38bb2f['get']({'plain':!![]});return _0x26a692['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x3456d1[_0x99e3('0x4e')]['id']}})[_0x99e3('0x2a')](function(_0x4b7774){return db[_0x99e3('0x6f')][_0x99e3('0x70')](function(_0x6fd884){return _0x4b7774[_0x99e3('0x71')](_0x49c535,{'transaction':_0x6fd884})[_0x99e3('0x2a')](function(){return BPromise[_0x99e3('0x72')](_0x536ce3,function(_0x16f645){return db['UserMailQueue'][_0x99e3('0x73')]({'where':{'UserId':_0x16f645['id'],'MailQueueId':_0x3456d1['params']['id']},'transaction':_0x6fd884});});})[_0x99e3('0x2a')](function(){_0x536ce3[_0x99e3('0x74')](function(_0x524183){socket[_0x99e3('0x75')](_0x99e3('0x76'),{'UserId':_0x524183['id'],'MailQueueId':_0x4b7774['id']});});});});});}})[_0x99e3('0x2a')](respondWithStatusCode(_0x142ec3,null))['catch'](handleError(_0x142ec3,null));};exports['removeTeams']=function(_0x4db991,_0x5e3785,_0x21a2dd){return db[_0x99e3('0x68')][_0x99e3('0x4a')]({'where':{'id':_0x4db991[_0x99e3('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x99e3('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x99e3('0x2a')](handleEntityNotFound(_0x5e3785,null))[_0x99e3('0x2a')](function(_0x55f17b){var _0x41da67=_['map'](_0x55f17b,'id');var _0x56e49c=[];var _0x4b9b11=[];var _0x5e6ae8=squel['select']();_0x5e6ae8[_0x99e3('0x77')]('tq.TeamId')[_0x99e3('0x78')](_0x99e3('0x79'),'tq')[_0x99e3('0x7a')](_0x99e3('0x7b'),'ut',_0x99e3('0x7c'))['where'](_0x99e3('0x7d'),_0x4db991[_0x99e3('0x4e')]['id']);for(var _0x57a98c=0x0;_0x57a98c<_0x55f17b[_0x99e3('0x40')];_0x57a98c+=0x1){let _0x5a79c2=_0x55f17b[_0x57a98c];for(var _0x41541d=0x0;_0x41541d<_0x5a79c2['Agents'][_0x99e3('0x40')];_0x41541d+=0x1){let _0x134d64=_0x5a79c2['Agents'][_0x41541d];var _0x3928ef=_0x5e6ae8[_0x99e3('0x7e')]();_0x3928ef[_0x99e3('0x44')](_0x99e3('0x7f'),_0x134d64['id']);_0x4b9b11[_0x99e3('0x80')](db[_0x99e3('0x6f')][_0x99e3('0x39')](_0x3928ef[_0x99e3('0x81')](),{'type':db[_0x99e3('0x6f')][_0x99e3('0x82')][_0x99e3('0x83')]})[_0x99e3('0x2a')](function(_0x5d98f1){if(_0x5d98f1['length']===0x1){return _0x134d64['id'];}else{var _0x484bc3=_[_0x99e3('0x84')](_[_0x99e3('0x38')](_0x5d98f1,_0x99e3('0x85')),function(_0x2ac6b5){return _[_0x99e3('0x86')](_0x41da67,_0x2ac6b5);});if(_0x484bc3){return _0x134d64['id'];}}}));}}return BPromise[_0x99e3('0x87')](_0x4b9b11)[_0x99e3('0x2a')](function(_0x107d08){_0x56e49c=_(_0x56e49c)[_0x99e3('0x88')](_0x107d08)[_0x99e3('0x89')]()['value']();return db['MailQueue']['find']({'where':{'id':_0x4db991[_0x99e3('0x4e')]['id']}})[_0x99e3('0x2a')](function(_0x13b20f){return db['sequelize'][_0x99e3('0x70')](function(_0xcd69b3){return _0x13b20f[_0x99e3('0x8a')](_0x4db991['query'][_0x99e3('0x69')],{'transaction':_0xcd69b3})[_0x99e3('0x2a')](function(){if(!_['isEmpty'](_0x56e49c)){return _0x13b20f[_0x99e3('0x8b')](_0x56e49c,{'transaction':_0xcd69b3});}})[_0x99e3('0x2a')](function(){_0x56e49c[_0x99e3('0x74')](function(_0x190de6){socket[_0x99e3('0x75')](_0x99e3('0x8c'),{'UserId':_0x190de6,'MailQueueId':_0x13b20f['id']});});});});});});})[_0x99e3('0x2a')](respondWithStatusCode(_0x5e3785,null))[_0x99e3('0x4c')](handleError(_0x5e3785,null));};exports['addAgents']=function(_0x29d8c1,_0x17a1bb,_0x3d705f){return db[_0x99e3('0x33')][_0x99e3('0x56')]({'where':{'id':_0x29d8c1[_0x99e3('0x4e')]['id']}})[_0x99e3('0x2a')](handleEntityNotFound(_0x17a1bb,null))[_0x99e3('0x2a')](function(_0x1a465a){if(_0x1a465a){return _0x1a465a[_0x99e3('0x8d')](_0x29d8c1[_0x99e3('0x51')]['ids'],_[_0x99e3('0x8e')](_0x29d8c1['body'],[_0x99e3('0x69'),'id'])||{})[_0x99e3('0x8f')](function(_0x28b889){for(var _0x4e2b1d=0x0;_0x4e2b1d<_0x29d8c1[_0x99e3('0x51')][_0x99e3('0x69')]['length'];_0x4e2b1d+=0x1){socket[_0x99e3('0x75')]('userMailQueue:save',{'UserId':_0x29d8c1[_0x99e3('0x51')]['ids'][_0x4e2b1d],'MailQueueId':_0x29d8c1[_0x99e3('0x4e')]['id']});}return _0x28b889;});}})[_0x99e3('0x2a')](respondWithResult(_0x17a1bb,null))[_0x99e3('0x4c')](handleError(_0x17a1bb,null));};exports[_0x99e3('0x8b')]=function(_0x2449d4,_0x2f9c83,_0x18e083){return db[_0x99e3('0x33')][_0x99e3('0x56')]({'where':{'id':_0x2449d4[_0x99e3('0x4e')]['id']}})[_0x99e3('0x2a')](handleEntityNotFound(_0x2f9c83,null))['then'](function(_0x403c50){if(_0x403c50){return _0x403c50[_0x99e3('0x8b')](_0x2449d4[_0x99e3('0x39')][_0x99e3('0x69')])[_0x99e3('0x2a')](function(){if(_['isArray'](_0x2449d4['query'][_0x99e3('0x69')])){for(var _0x21ab6f=0x0;_0x21ab6f<_0x2449d4['query'][_0x99e3('0x69')][_0x99e3('0x40')];_0x21ab6f+=0x1){socket[_0x99e3('0x75')](_0x99e3('0x8c'),{'UserId':Number(_0x2449d4[_0x99e3('0x39')][_0x99e3('0x69')][_0x21ab6f]),'MailQueueId':Number(_0x2449d4[_0x99e3('0x4e')]['id'])});}}else{socket[_0x99e3('0x75')](_0x99e3('0x8c'),{'UserId':Number(_0x2449d4['query'][_0x99e3('0x69')]),'MailQueueId':Number(_0x2449d4[_0x99e3('0x4e')]['id'])});}});}})[_0x99e3('0x2a')](respondWithStatusCode(_0x2f9c83,null))[_0x99e3('0x4c')](handleError(_0x2f9c83,null));};exports[_0x99e3('0x90')]=function(_0x2311c5,_0x492fa4,_0x277315){var _0x36b38e={};var _0x587bc5={};var _0x1b5f1b;var _0x244ae6;return db[_0x99e3('0x33')][_0x99e3('0x5c')]({'where':{'id':_0x2311c5['params']['id']}})[_0x99e3('0x2a')](handleEntityNotFound(_0x492fa4,null))[_0x99e3('0x2a')](function(_0x6fadaa){if(_0x6fadaa){_0x1b5f1b=_0x6fadaa;_0x587bc5[_0x99e3('0x3c')]=_[_0x99e3('0x3a')](db[_0x99e3('0x5e')][_0x99e3('0x34')]);_0x587bc5[_0x99e3('0x39')]=_[_0x99e3('0x3a')](_0x2311c5[_0x99e3('0x39')]);_0x587bc5[_0x99e3('0x3b')]=_['intersection'](_0x587bc5[_0x99e3('0x3c')],_0x587bc5[_0x99e3('0x39')]);_0x36b38e['attributes']=_[_0x99e3('0x3d')](_0x587bc5[_0x99e3('0x3c')],qs[_0x99e3('0x3e')](_0x2311c5[_0x99e3('0x39')]['fields']));_0x36b38e[_0x99e3('0x3f')]=_0x36b38e[_0x99e3('0x3f')][_0x99e3('0x40')]?_0x36b38e[_0x99e3('0x3f')]:_0x587bc5[_0x99e3('0x3c')];_0x36b38e[_0x99e3('0x91')]=qs[_0x99e3('0x43')](_0x2311c5[_0x99e3('0x39')][_0x99e3('0x43')]);_0x36b38e[_0x99e3('0x44')]=qs['filters'](_[_0x99e3('0x45')](_0x2311c5[_0x99e3('0x39')],_0x587bc5[_0x99e3('0x3b')]));if(_0x2311c5[_0x99e3('0x39')][_0x99e3('0x46')]){_0x36b38e[_0x99e3('0x44')]=_[_0x99e3('0x47')](_0x36b38e[_0x99e3('0x44')],{'$or':_[_0x99e3('0x38')](_0x36b38e[_0x99e3('0x3f')],function(_0x1d73cc){var _0x2a59cc={};_0x2a59cc[_0x1d73cc]={'$like':'%'+_0x2311c5[_0x99e3('0x39')][_0x99e3('0x46')]+'%'};return _0x2a59cc;})});}_0x36b38e=_['merge']({},_0x36b38e,_0x2311c5[_0x99e3('0x48')]);return _0x1b5f1b['getAgents'](_0x36b38e);}})['then'](function(_0x40255b){if(_0x40255b){_0x244ae6=_0x40255b[_0x99e3('0x40')];if(!_0x2311c5[_0x99e3('0x39')][_0x99e3('0x41')](_0x99e3('0x42'))){_0x36b38e[_0x99e3('0x22')]=qs[_0x99e3('0x22')](_0x2311c5[_0x99e3('0x39')]['limit']);_0x36b38e[_0x99e3('0x21')]=qs[_0x99e3('0x21')](_0x2311c5[_0x99e3('0x39')][_0x99e3('0x21')]);}return _0x1b5f1b['getAgents'](_0x36b38e);}})[_0x99e3('0x2a')](function(_0x56a24d){if(_0x56a24d){return _0x56a24d?{'count':_0x244ae6,'rows':_0x56a24d}:null;}})[_0x99e3('0x2a')](respondWithResult(_0x492fa4,null))['catch'](handleError(_0x492fa4,null));}; \ No newline at end of file +var _0x0346=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','intersection','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','MailQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','MailQueueId','UserMailQueue','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','mailPause','Team','getTeams','hasOwnProperty','ids','Agents','online','sequelize','transaction','addTeams','each','forEach','emit','userMailQueue:save','removeTeams','select','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','pick','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0346,0x7e));var _0x6034=function(_0x672a75,_0x2d450f){_0x672a75=_0x672a75-0x0;var _0x4b1a7b=_0x0346[_0x672a75];return _0x4b1a7b;};'use strict';var pdf=require(_0x6034('0x0'));var emlformat=require(_0x6034('0x1'));var rimraf=require(_0x6034('0x2'));var zipdir=require(_0x6034('0x3'));var jsonpatch=require(_0x6034('0x4'));var rp=require('request-promise');var moment=require(_0x6034('0x5'));var BPromise=require(_0x6034('0x6'));var Mustache=require(_0x6034('0x7'));var util=require(_0x6034('0x8'));var path=require('path');var sox=require(_0x6034('0x9'));var csv=require('to-csv');var ejs=require(_0x6034('0xa'));var fs=require('fs');var _=require(_0x6034('0xb'));var squel=require(_0x6034('0xc'));var crypto=require(_0x6034('0xd'));var jsforce=require(_0x6034('0xe'));var deskjs=require(_0x6034('0xf'));var toCsv=require(_0x6034('0x10'));var querystring=require(_0x6034('0x11'));var Papa=require(_0x6034('0x12'));var Redis=require(_0x6034('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6034('0x14'));var as=require(_0x6034('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6034('0x16'));var utils=require(_0x6034('0x17'));var config=require(_0x6034('0x18'));var db=require(_0x6034('0x19'))['db'];config[_0x6034('0x1a')]=_[_0x6034('0x1b')](config[_0x6034('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x6034('0x1c'))(new Redis(config['redis']));require(_0x6034('0x1d'))[_0x6034('0x1e')](socket);function respondWithStatusCode(_0x2c358b,_0x3cb194){_0x3cb194=_0x3cb194||0xcc;return function(_0x30d590){if(_0x30d590){return _0x2c358b[_0x6034('0x1f')](_0x3cb194);}return _0x2c358b[_0x6034('0x20')](_0x3cb194)[_0x6034('0x21')]();};}function respondWithResult(_0x4a1e9f,_0x4c05ec){_0x4c05ec=_0x4c05ec||0xc8;return function(_0x443c98){if(_0x443c98){return _0x4a1e9f['status'](_0x4c05ec)[_0x6034('0x22')](_0x443c98);}};}function respondWithFilteredResult(_0x3bb3f1,_0x14735a){return function(_0x5c7335){if(_0x5c7335){var _0x87a1f8=_0x5c7335[_0x6034('0x23')],_0x36162d=_0x14735a[_0x6034('0x24')],_0x136d3b=_0x14735a[_0x6034('0x24')]+_0x14735a[_0x6034('0x25')],_0x5f18e2;if(_0x136d3b>=_0x87a1f8){_0x136d3b=_0x87a1f8;_0x5f18e2=0xc8;}else{_0x5f18e2=0xce;}_0x3bb3f1[_0x6034('0x20')](_0x5f18e2);return _0x3bb3f1[_0x6034('0x26')](_0x6034('0x27'),_0x36162d+'-'+_0x136d3b+'/'+_0x87a1f8)[_0x6034('0x22')](_0x5c7335);}return null;};}function patchUpdates(_0x44074c){return function(_0x4d2f26){try{jsonpatch['apply'](_0x4d2f26,_0x44074c,!![]);}catch(_0x3ecaa7){return BPromise[_0x6034('0x28')](_0x3ecaa7);}return _0x4d2f26[_0x6034('0x29')]();};}function saveUpdates(_0x2248c2,_0x3c582e){return function(_0x3499dc){if(_0x3499dc){return _0x3499dc[_0x6034('0x2a')](_0x2248c2)[_0x6034('0x2b')](function(_0xcca582){return _0xcca582;});}return null;};}function removeEntity(_0x111418,_0x475595){return function(_0xfb1a11){if(_0xfb1a11){return _0xfb1a11[_0x6034('0x2c')]()['then'](function(){var _0x1fa564=_0xfb1a11[_0x6034('0x2d')]({'plain':!![]});var _0x3f1366='MailQueues';return db[_0x6034('0x2e')]['destroy']({'where':{'type':_0x3f1366,'resourceId':_0x1fa564['id']}})[_0x6034('0x2b')](function(){return _0xfb1a11;});})[_0x6034('0x2b')](function(){_0x111418['status'](0xcc)[_0x6034('0x21')]();});}};}function handleEntityNotFound(_0xee77d1,_0x4d9391){return function(_0x5e183f){if(!_0x5e183f){_0xee77d1[_0x6034('0x1f')](0x194);}return _0x5e183f;};}function handleError(_0xd523bd,_0x147d6c){_0x147d6c=_0x147d6c||0x1f4;return function(_0x20e739){logger[_0x6034('0x2f')](_0x20e739[_0x6034('0x30')]);if(_0x20e739[_0x6034('0x31')]){delete _0x20e739[_0x6034('0x31')];}_0xd523bd['status'](_0x147d6c)[_0x6034('0x32')](_0x20e739);};}exports[_0x6034('0x33')]=function(_0x31734d,_0x2f0555){var _0xb89fc4={},_0x2aa811={},_0x47439a={'count':0x0,'rows':[]};var _0x371ccf=_[_0x6034('0x34')](db[_0x6034('0x35')][_0x6034('0x36')],function(_0x41be47){return{'name':_0x41be47[_0x6034('0x37')],'type':_0x41be47[_0x6034('0x38')][_0x6034('0x39')]};});_0x2aa811[_0x6034('0x3a')]=_['map'](_0x371ccf,_0x6034('0x31'));_0x2aa811[_0x6034('0x3b')]=_[_0x6034('0x3c')](_0x31734d[_0x6034('0x3b')]);_0x2aa811[_0x6034('0x3d')]=_['intersection'](_0x2aa811[_0x6034('0x3a')],_0x2aa811[_0x6034('0x3b')]);_0xb89fc4['attributes']=_['intersection'](_0x2aa811[_0x6034('0x3a')],qs[_0x6034('0x3e')](_0x31734d[_0x6034('0x3b')][_0x6034('0x3e')]));_0xb89fc4[_0x6034('0x3f')]=_0xb89fc4[_0x6034('0x3f')][_0x6034('0x40')]?_0xb89fc4[_0x6034('0x3f')]:_0x2aa811[_0x6034('0x3a')];if(!_0x31734d[_0x6034('0x3b')]['hasOwnProperty'](_0x6034('0x41'))){_0xb89fc4['limit']=qs[_0x6034('0x25')](_0x31734d[_0x6034('0x3b')]['limit']);_0xb89fc4[_0x6034('0x24')]=qs[_0x6034('0x24')](_0x31734d['query'][_0x6034('0x24')]);}_0xb89fc4[_0x6034('0x42')]=qs[_0x6034('0x43')](_0x31734d[_0x6034('0x3b')]['sort']);_0xb89fc4['where']=qs[_0x6034('0x3d')](_['pick'](_0x31734d[_0x6034('0x3b')],_0x2aa811[_0x6034('0x3d')]),_0x371ccf);if(_0x31734d[_0x6034('0x3b')][_0x6034('0x44')]){_0xb89fc4[_0x6034('0x45')]=_['merge'](_0xb89fc4['where'],{'$or':_[_0x6034('0x34')](_0x371ccf,function(_0x16c33c){if(_0x16c33c[_0x6034('0x38')]!=='VIRTUAL'){var _0x51fc70={};_0x51fc70[_0x16c33c['name']]={'$like':'%'+_0x31734d[_0x6034('0x3b')][_0x6034('0x44')]+'%'};return _0x51fc70;}})});}_0xb89fc4=_[_0x6034('0x46')]({},_0xb89fc4,_0x31734d[_0x6034('0x47')]);var _0x337ed2={'where':_0xb89fc4['where']};return db[_0x6034('0x35')][_0x6034('0x23')](_0x337ed2)[_0x6034('0x2b')](function(_0x5e599a){_0x47439a[_0x6034('0x23')]=_0x5e599a;if(_0x31734d[_0x6034('0x3b')][_0x6034('0x48')]){_0xb89fc4['include']=[{'all':!![]}];}return db[_0x6034('0x35')][_0x6034('0x49')](_0xb89fc4);})[_0x6034('0x2b')](function(_0x5595e0){_0x47439a[_0x6034('0x4a')]=_0x5595e0;return _0x47439a;})[_0x6034('0x2b')](respondWithFilteredResult(_0x2f0555,_0xb89fc4))[_0x6034('0x4b')](handleError(_0x2f0555,null));};exports[_0x6034('0x4c')]=function(_0x46a33d,_0x380caa){var _0x51f6ff={'raw':!![],'where':{'id':_0x46a33d[_0x6034('0x4d')]['id']}},_0x524888={};_0x524888['model']=_[_0x6034('0x3c')](db[_0x6034('0x35')][_0x6034('0x36')]);_0x524888[_0x6034('0x3b')]=_[_0x6034('0x3c')](_0x46a33d[_0x6034('0x3b')]);_0x524888[_0x6034('0x3d')]=_[_0x6034('0x4e')](_0x524888['model'],_0x524888[_0x6034('0x3b')]);_0x51f6ff[_0x6034('0x3f')]=_[_0x6034('0x4e')](_0x524888[_0x6034('0x3a')],qs[_0x6034('0x3e')](_0x46a33d[_0x6034('0x3b')]['fields']));_0x51f6ff[_0x6034('0x3f')]=_0x51f6ff[_0x6034('0x3f')]['length']?_0x51f6ff[_0x6034('0x3f')]:_0x524888['model'];if(_0x46a33d[_0x6034('0x3b')][_0x6034('0x48')]){_0x51f6ff[_0x6034('0x4f')]=[{'all':!![]}];}_0x51f6ff=_['merge']({},_0x51f6ff,_0x46a33d[_0x6034('0x47')]);return db[_0x6034('0x35')]['find'](_0x51f6ff)['then'](handleEntityNotFound(_0x380caa,null))[_0x6034('0x2b')](respondWithResult(_0x380caa,null))[_0x6034('0x4b')](handleError(_0x380caa,null));};exports[_0x6034('0x50')]=function(_0xfd31ec,_0xe2d778){return db[_0x6034('0x35')]['create'](_0xfd31ec[_0x6034('0x51')],{})['then'](function(_0xdab44f){var _0x4aa65d=_0xfd31ec['user'][_0x6034('0x2d')]({'plain':!![]});if(!_0x4aa65d)throw new Error(_0x6034('0x52'));if(_0x4aa65d['role']===_0x6034('0x53')){var _0x263d0c=_0xdab44f[_0x6034('0x2d')]({'plain':!![]});var _0x5c42f6=_0x6034('0x54');return db['UserProfileSection'][_0x6034('0x55')]({'where':{'name':_0x5c42f6,'userProfileId':_0x4aa65d[_0x6034('0x56')]},'raw':!![]})['then'](function(_0x45affa){if(_0x45affa&&_0x45affa[_0x6034('0x57')]===0x0){return db[_0x6034('0x2e')][_0x6034('0x50')]({'name':_0x263d0c[_0x6034('0x31')],'resourceId':_0x263d0c['id'],'type':_0x45affa[_0x6034('0x31')],'sectionId':_0x45affa['id']},{})['then'](function(){return _0xdab44f;});}else{return _0xdab44f;}})[_0x6034('0x4b')](function(_0xe3efbc){logger['error'](_0x6034('0x58'),_0xe3efbc);throw _0xe3efbc;});}return _0xdab44f;})[_0x6034('0x2b')](respondWithResult(_0xe2d778,0xc9))[_0x6034('0x4b')](handleError(_0xe2d778,null));};exports['update']=function(_0x287f72,_0x415bd6){if(_0x287f72[_0x6034('0x51')]['id']){delete _0x287f72[_0x6034('0x51')]['id'];}return db[_0x6034('0x35')][_0x6034('0x55')]({'where':{'id':_0x287f72[_0x6034('0x4d')]['id']}})[_0x6034('0x2b')](handleEntityNotFound(_0x415bd6,null))[_0x6034('0x2b')](saveUpdates(_0x287f72[_0x6034('0x51')],null))['then'](respondWithResult(_0x415bd6,null))['catch'](handleError(_0x415bd6,null));};exports[_0x6034('0x2c')]=function(_0x5771bd,_0x484b0e){return db['MailQueue'][_0x6034('0x55')]({'where':{'id':_0x5771bd[_0x6034('0x4d')]['id']}})[_0x6034('0x2b')](handleEntityNotFound(_0x484b0e,null))[_0x6034('0x2b')](removeEntity(_0x484b0e,null))[_0x6034('0x4b')](handleError(_0x484b0e,null));};exports[_0x6034('0x59')]=function(_0x270406,_0x469fb2){return db[_0x6034('0x35')][_0x6034('0x59')]()[_0x6034('0x2b')](respondWithResult(_0x469fb2,null))[_0x6034('0x4b')](handleError(_0x469fb2,null));};exports[_0x6034('0x5a')]=function(_0x54982c,_0xbae4d4,_0x4675f7){var _0x24cf61={'raw':!![],'where':{}},_0x35de05={},_0x4efb20;return db[_0x6034('0x35')][_0x6034('0x5b')]({'where':{'id':_0x54982c[_0x6034('0x4d')]['id']}})[_0x6034('0x2b')](handleEntityNotFound(_0xbae4d4,null))[_0x6034('0x2b')](function(_0x5ba092){if(_0x5ba092){_0x4efb20=_0x5ba092[_0x6034('0x2d')]({'plain':!![]});_0x35de05[_0x6034('0x3a')]=_[_0x6034('0x3c')](db['UserMailQueue'][_0x6034('0x36')]);_0x35de05['query']=_['keys'](_0x54982c[_0x6034('0x3b')]);_0x35de05['filters']=_[_0x6034('0x4e')](_0x35de05[_0x6034('0x3a')],_0x35de05['query']);_0x24cf61['attributes']=_['intersection'](_0x35de05[_0x6034('0x3a')],qs['fields'](_0x54982c[_0x6034('0x3b')][_0x6034('0x3e')]));_0x24cf61['attributes']=_0x24cf61[_0x6034('0x3f')][_0x6034('0x40')]?_0x24cf61[_0x6034('0x3f')]:_0x35de05[_0x6034('0x3a')];if(!_0x54982c[_0x6034('0x3b')]['hasOwnProperty'](_0x6034('0x41'))){_0x24cf61[_0x6034('0x25')]=qs['limit'](_0x54982c[_0x6034('0x3b')][_0x6034('0x25')]);_0x24cf61[_0x6034('0x24')]=qs[_0x6034('0x24')](_0x54982c['query'][_0x6034('0x24')]);}_0x24cf61[_0x6034('0x42')]=qs[_0x6034('0x43')](_0x54982c['query'][_0x6034('0x43')]);_0x24cf61[_0x6034('0x45')]=qs['filters'](_['pick'](_0x54982c['query'],_0x35de05['filters']));_0x24cf61[_0x6034('0x45')][_0x6034('0x5c')]=_0x5ba092['id'];if(_0x54982c[_0x6034('0x3b')][_0x6034('0x44')]){_0x24cf61[_0x6034('0x45')]=_[_0x6034('0x46')](_0x24cf61[_0x6034('0x45')],{'$or':_[_0x6034('0x34')](_0x24cf61['attributes'],function(_0x544533){var _0x548556={};_0x548556[_0x544533]={'$like':'%'+_0x54982c['query'][_0x6034('0x44')]+'%'};return _0x548556;})});}_0x24cf61=_['merge']({},_0x24cf61,_0x54982c[_0x6034('0x47')]);return db[_0x6034('0x5d')][_0x6034('0x49')](_0x24cf61);}})['then'](function(_0x1b4b85){if(_0x1b4b85){return db[_0x6034('0x5e')][_0x6034('0x5f')]({'where':{'id':_['map'](_0x1b4b85,'UserId'),'role':_0x6034('0x60')},'attributes':['id',_0x6034('0x31'),'mailPause',_0x6034('0x61'),_0x6034('0x62')]});}})['then'](function(_0x148406){if(_0x148406){return{'count':_0x148406[_0x6034('0x23')],'rows':_['map'](_0x148406[_0x6034('0x4a')],function(_0x1bbd11){return{'membername':_0x1bbd11['name'],'UserId':_0x1bbd11['id'],'queue_name':_0x4efb20[_0x6034('0x31')],'MailQueueId':_0x4efb20['id'],'interface':util[_0x6034('0x63')](_0x6034('0x64'),_0x6034('0x65'),_0x1bbd11[_0x6034('0x31')]),'penalty':0x0,'paused':_0x1bbd11[_0x6034('0x66')],'createdAt':_0x1bbd11[_0x6034('0x62')],'updatedAt':_0x1bbd11[_0x6034('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6034('0x2b')](respondWithFilteredResult(_0xbae4d4,_0x24cf61))[_0x6034('0x4b')](handleError(_0xbae4d4,null));};exports['getTeams']=function(_0xc5acc7,_0x17bb45,_0x478a8c){var _0x1a24d3={};var _0x343a26={};var _0x71a82;var _0x2ab6b7;return db['MailQueue']['findOne']({'where':{'id':_0xc5acc7['params']['id']}})[_0x6034('0x2b')](handleEntityNotFound(_0x17bb45,null))['then'](function(_0x176203){if(_0x176203){_0x71a82=_0x176203;_0x343a26['model']=_[_0x6034('0x3c')](db[_0x6034('0x67')][_0x6034('0x36')]);_0x343a26[_0x6034('0x3b')]=_[_0x6034('0x3c')](_0xc5acc7[_0x6034('0x3b')]);_0x343a26['filters']=_[_0x6034('0x4e')](_0x343a26[_0x6034('0x3a')],_0x343a26[_0x6034('0x3b')]);_0x1a24d3[_0x6034('0x3f')]=_[_0x6034('0x4e')](_0x343a26['model'],qs[_0x6034('0x3e')](_0xc5acc7[_0x6034('0x3b')][_0x6034('0x3e')]));_0x1a24d3[_0x6034('0x3f')]=_0x1a24d3[_0x6034('0x3f')][_0x6034('0x40')]?_0x1a24d3['attributes']:_0x343a26['model'];_0x1a24d3[_0x6034('0x42')]=qs[_0x6034('0x43')](_0xc5acc7[_0x6034('0x3b')][_0x6034('0x43')]);_0x1a24d3[_0x6034('0x45')]=qs[_0x6034('0x3d')](_['pick'](_0xc5acc7[_0x6034('0x3b')],_0x343a26[_0x6034('0x3d')]));if(_0xc5acc7[_0x6034('0x3b')][_0x6034('0x44')]){_0x1a24d3[_0x6034('0x45')]=_['merge'](_0x1a24d3[_0x6034('0x45')],{'$or':_[_0x6034('0x34')](_0x1a24d3[_0x6034('0x3f')],function(_0x1fe1c8){var _0x5f3bd1={};_0x5f3bd1[_0x1fe1c8]={'$like':'%'+_0xc5acc7[_0x6034('0x3b')][_0x6034('0x44')]+'%'};return _0x5f3bd1;})});}_0x1a24d3=_['merge']({},_0x1a24d3,_0xc5acc7[_0x6034('0x47')]);return _0x71a82[_0x6034('0x68')](_0x1a24d3);}})[_0x6034('0x2b')](function(_0x363368){if(_0x363368){_0x2ab6b7=_0x363368[_0x6034('0x40')];if(!_0xc5acc7['query'][_0x6034('0x69')](_0x6034('0x41'))){_0x1a24d3[_0x6034('0x25')]=qs['limit'](_0xc5acc7[_0x6034('0x3b')][_0x6034('0x25')]);_0x1a24d3[_0x6034('0x24')]=qs[_0x6034('0x24')](_0xc5acc7[_0x6034('0x3b')][_0x6034('0x24')]);}return _0x71a82[_0x6034('0x68')](_0x1a24d3);}})[_0x6034('0x2b')](function(_0x3b8385){if(_0x3b8385){return _0x3b8385?{'count':_0x2ab6b7,'rows':_0x3b8385}:null;}})[_0x6034('0x2b')](respondWithResult(_0x17bb45,null))[_0x6034('0x4b')](handleError(_0x17bb45,null));};exports['addTeams']=function(_0x3de265,_0x384212,_0x88660d){var _0x312359=_0x3de265[_0x6034('0x51')][_0x6034('0x6a')];return db['Team'][_0x6034('0x49')]({'where':{'id':_0x312359},'attributes':['id'],'include':[{'model':db[_0x6034('0x5e')],'as':_0x6034('0x6b'),'attributes':['id','name',_0x6034('0x6c'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x5c2b53){if(_0x5c2b53){var _0x208159=_['flatMap'](_0x5c2b53,function(_0x527434){var _0xd84e4b=_0x527434[_0x6034('0x2d')]({'plain':!![]});return _0xd84e4b[_0x6034('0x6b')];});return db[_0x6034('0x35')]['find']({'where':{'id':_0x3de265[_0x6034('0x4d')]['id']}})[_0x6034('0x2b')](function(_0x19d39c){return db[_0x6034('0x6d')][_0x6034('0x6e')](function(_0x39fb18){return _0x19d39c[_0x6034('0x6f')](_0x312359,{'transaction':_0x39fb18})[_0x6034('0x2b')](function(){return BPromise[_0x6034('0x70')](_0x208159,function(_0x10fce0){return db[_0x6034('0x5d')]['findOrCreate']({'where':{'UserId':_0x10fce0['id'],'MailQueueId':_0x3de265[_0x6034('0x4d')]['id']},'transaction':_0x39fb18});});})[_0x6034('0x2b')](function(){_0x208159[_0x6034('0x71')](function(_0x50f57c){socket[_0x6034('0x72')](_0x6034('0x73'),{'UserId':_0x50f57c['id'],'MailQueueId':_0x19d39c['id']});});});});});}})[_0x6034('0x2b')](respondWithStatusCode(_0x384212,null))['catch'](handleError(_0x384212,null));};exports[_0x6034('0x74')]=function(_0x14331e,_0x7c3acb,_0x2463ba){return db['Team']['findAll']({'where':{'id':_0x14331e[_0x6034('0x3b')][_0x6034('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x6034('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6034('0x2b')](handleEntityNotFound(_0x7c3acb,null))['then'](function(_0x5d5b13){var _0x237c2b=_[_0x6034('0x34')](_0x5d5b13,'id');var _0x319532=[];var _0x10e592=[];var _0x22ae47=squel[_0x6034('0x75')]();_0x22ae47['field']('tq.TeamId')[_0x6034('0x76')]('team_has_mail_queues','tq')['join'](_0x6034('0x77'),'ut',_0x6034('0x78'))[_0x6034('0x45')](_0x6034('0x79'),_0x14331e[_0x6034('0x4d')]['id']);for(var _0x352e5b=0x0;_0x352e5b<_0x5d5b13[_0x6034('0x40')];_0x352e5b+=0x1){let _0x3c1ec1=_0x5d5b13[_0x352e5b];for(var _0x34718b=0x0;_0x34718b<_0x3c1ec1['Agents'][_0x6034('0x40')];_0x34718b+=0x1){let _0x234272=_0x3c1ec1[_0x6034('0x6b')][_0x34718b];var _0x51e8dd=_0x22ae47[_0x6034('0x7a')]();_0x51e8dd['where'](_0x6034('0x7b'),_0x234272['id']);_0x10e592[_0x6034('0x7c')](db[_0x6034('0x6d')][_0x6034('0x3b')](_0x51e8dd[_0x6034('0x7d')](),{'type':db[_0x6034('0x6d')][_0x6034('0x7e')][_0x6034('0x7f')]})[_0x6034('0x2b')](function(_0x4437d0){if(_0x4437d0[_0x6034('0x40')]===0x1){return _0x234272['id'];}else{var _0x245f25=_[_0x6034('0x80')](_[_0x6034('0x34')](_0x4437d0,_0x6034('0x81')),function(_0xe76e8b){return _[_0x6034('0x82')](_0x237c2b,_0xe76e8b);});if(_0x245f25){return _0x234272['id'];}}}));}}return BPromise[_0x6034('0x83')](_0x10e592)['then'](function(_0x52921e){_0x319532=_(_0x319532)[_0x6034('0x84')](_0x52921e)[_0x6034('0x85')]()[_0x6034('0x86')]();return db[_0x6034('0x35')][_0x6034('0x55')]({'where':{'id':_0x14331e[_0x6034('0x4d')]['id']}})['then'](function(_0xc92968){return db[_0x6034('0x6d')]['transaction'](function(_0x4d103e){return _0xc92968['removeTeams'](_0x14331e[_0x6034('0x3b')][_0x6034('0x6a')],{'transaction':_0x4d103e})['then'](function(){if(!_[_0x6034('0x87')](_0x319532)){return _0xc92968['removeAgents'](_0x319532,{'transaction':_0x4d103e});}})[_0x6034('0x2b')](function(){_0x319532[_0x6034('0x71')](function(_0x421a38){socket[_0x6034('0x72')]('userMailQueue:remove',{'UserId':_0x421a38,'MailQueueId':_0xc92968['id']});});});});});});})[_0x6034('0x2b')](respondWithStatusCode(_0x7c3acb,null))[_0x6034('0x4b')](handleError(_0x7c3acb,null));};exports[_0x6034('0x88')]=function(_0x3054e7,_0x1b25f7,_0x556d50){return db['MailQueue'][_0x6034('0x55')]({'where':{'id':_0x3054e7[_0x6034('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1b25f7,null))[_0x6034('0x2b')](function(_0x363cf7){if(_0x363cf7){return _0x363cf7[_0x6034('0x88')](_0x3054e7[_0x6034('0x51')][_0x6034('0x6a')],_[_0x6034('0x89')](_0x3054e7[_0x6034('0x51')],[_0x6034('0x6a'),'id'])||{})[_0x6034('0x8a')](function(_0x5d9f09){for(var _0x554054=0x0;_0x554054<_0x3054e7['body'][_0x6034('0x6a')][_0x6034('0x40')];_0x554054+=0x1){socket[_0x6034('0x72')](_0x6034('0x73'),{'UserId':_0x3054e7[_0x6034('0x51')][_0x6034('0x6a')][_0x554054],'MailQueueId':_0x3054e7[_0x6034('0x4d')]['id']});}return _0x5d9f09;});}})[_0x6034('0x2b')](respondWithResult(_0x1b25f7,null))[_0x6034('0x4b')](handleError(_0x1b25f7,null));};exports[_0x6034('0x8b')]=function(_0x2332af,_0x1da1c8,_0x2e3c44){return db[_0x6034('0x35')][_0x6034('0x55')]({'where':{'id':_0x2332af[_0x6034('0x4d')]['id']}})[_0x6034('0x2b')](handleEntityNotFound(_0x1da1c8,null))[_0x6034('0x2b')](function(_0x2475be){if(_0x2475be){return _0x2475be['removeAgents'](_0x2332af['query'][_0x6034('0x6a')])[_0x6034('0x2b')](function(){if(_[_0x6034('0x8c')](_0x2332af[_0x6034('0x3b')][_0x6034('0x6a')])){for(var _0xf8de11=0x0;_0xf8de11<_0x2332af[_0x6034('0x3b')][_0x6034('0x6a')][_0x6034('0x40')];_0xf8de11+=0x1){socket[_0x6034('0x72')](_0x6034('0x8d'),{'UserId':Number(_0x2332af[_0x6034('0x3b')][_0x6034('0x6a')][_0xf8de11]),'MailQueueId':Number(_0x2332af[_0x6034('0x4d')]['id'])});}}else{socket['emit'](_0x6034('0x8d'),{'UserId':Number(_0x2332af[_0x6034('0x3b')][_0x6034('0x6a')]),'MailQueueId':Number(_0x2332af[_0x6034('0x4d')]['id'])});}});}})[_0x6034('0x2b')](respondWithStatusCode(_0x1da1c8,null))[_0x6034('0x4b')](handleError(_0x1da1c8,null));};exports['getAgents']=function(_0xeb1909,_0x591a32,_0x3a6a41){var _0x51f5ce={};var _0x35e405={};var _0x47aa17;var _0xa8d247;return db['MailQueue'][_0x6034('0x5b')]({'where':{'id':_0xeb1909[_0x6034('0x4d')]['id']}})[_0x6034('0x2b')](handleEntityNotFound(_0x591a32,null))[_0x6034('0x2b')](function(_0xd02041){if(_0xd02041){_0x47aa17=_0xd02041;_0x35e405[_0x6034('0x3a')]=_[_0x6034('0x3c')](db['User']['rawAttributes']);_0x35e405[_0x6034('0x3b')]=_['keys'](_0xeb1909['query']);_0x35e405[_0x6034('0x3d')]=_[_0x6034('0x4e')](_0x35e405[_0x6034('0x3a')],_0x35e405[_0x6034('0x3b')]);_0x51f5ce[_0x6034('0x3f')]=_['intersection'](_0x35e405['model'],qs[_0x6034('0x3e')](_0xeb1909[_0x6034('0x3b')][_0x6034('0x3e')]));_0x51f5ce[_0x6034('0x3f')]=_0x51f5ce[_0x6034('0x3f')][_0x6034('0x40')]?_0x51f5ce[_0x6034('0x3f')]:_0x35e405[_0x6034('0x3a')];_0x51f5ce[_0x6034('0x42')]=qs['sort'](_0xeb1909[_0x6034('0x3b')][_0x6034('0x43')]);_0x51f5ce[_0x6034('0x45')]=qs[_0x6034('0x3d')](_[_0x6034('0x8e')](_0xeb1909[_0x6034('0x3b')],_0x35e405['filters']));if(_0xeb1909['query'][_0x6034('0x44')]){_0x51f5ce[_0x6034('0x45')]=_[_0x6034('0x46')](_0x51f5ce['where'],{'$or':_[_0x6034('0x34')](_0x51f5ce[_0x6034('0x3f')],function(_0x50a876){var _0x5a97cd={};_0x5a97cd[_0x50a876]={'$like':'%'+_0xeb1909[_0x6034('0x3b')][_0x6034('0x44')]+'%'};return _0x5a97cd;})});}_0x51f5ce=_[_0x6034('0x46')]({},_0x51f5ce,_0xeb1909['options']);return _0x47aa17['getAgents'](_0x51f5ce);}})['then'](function(_0x361ff9){if(_0x361ff9){_0xa8d247=_0x361ff9[_0x6034('0x40')];if(!_0xeb1909[_0x6034('0x3b')]['hasOwnProperty'](_0x6034('0x41'))){_0x51f5ce[_0x6034('0x25')]=qs['limit'](_0xeb1909['query'][_0x6034('0x25')]);_0x51f5ce[_0x6034('0x24')]=qs[_0x6034('0x24')](_0xeb1909[_0x6034('0x3b')]['offset']);}return _0x47aa17[_0x6034('0x8f')](_0x51f5ce);}})[_0x6034('0x2b')](function(_0x1e6a26){if(_0x1e6a26){return _0x1e6a26?{'count':_0xa8d247,'rows':_0x1e6a26}:null;}})[_0x6034('0x2b')](respondWithResult(_0x591a32,null))[_0x6034('0x4b')](handleError(_0x591a32,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 786a357..5dc5a8d 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 _0xacba=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xacba,0x7a));var _0xaacb=function(_0x253f25,_0x428307){_0x253f25=_0x253f25-0x0;var _0x4ccd5b=_0xacba[_0x253f25];return _0x4ccd5b;};'use strict';var EventEmitter=require(_0xaacb('0x0'));var MailQueue=require(_0xaacb('0x1'))['db'][_0xaacb('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xaacb('0x3')](0x0);var events={'afterCreate':_0xaacb('0x4'),'afterUpdate':_0xaacb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3f36f2){return function(_0x1be87a,_0x2c4138,_0x12f235){MailQueueEvents[_0xaacb('0x6')](_0x3f36f2+':'+_0x1be87a['id'],_0x1be87a);MailQueueEvents['emit'](_0x3f36f2,_0x1be87a);_0x12f235(null);};}for(var e in events){if(events[_0xaacb('0x7')](e)){var event=events[e];MailQueue[_0xaacb('0x8')](e,emitEvent(event));}}module[_0xaacb('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xe05c=['events','../../mysqldb','MailQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x185369,_0x46be46){var _0x4b98ba=function(_0x40bbb4){while(--_0x40bbb4){_0x185369['push'](_0x185369['shift']());}};_0x4b98ba(++_0x46be46);}(_0xe05c,0x168));var _0xce05=function(_0x1f7d8a,_0x29c744){_0x1f7d8a=_0x1f7d8a-0x0;var _0xcbe6d5=_0xe05c[_0x1f7d8a];return _0xcbe6d5;};'use strict';var EventEmitter=require(_0xce05('0x0'));var MailQueue=require(_0xce05('0x1'))['db'][_0xce05('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce05('0x3'),'afterUpdate':_0xce05('0x4'),'afterDestroy':_0xce05('0x5')};function emitEvent(_0x347247){return function(_0x52d637,_0x3f76f3,_0x1176e2){MailQueueEvents['emit'](_0x347247+':'+_0x52d637['id'],_0x52d637);MailQueueEvents[_0xce05('0x6')](_0x347247,_0x52d637);_0x1176e2(null);};}for(var e in events){if(events[_0xce05('0x7')](e)){var event=events[e];MailQueue[_0xce05('0x8')](e,emitEvent(event));}}module[_0xce05('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 1a40d7e..4c96c22 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 _0xf614=['../../config/logger','api','bluebird','request-promise','path','rimraf','./mailQueue.attributes','define','MailQueue','lodash','util'];(function(_0x4cece1,_0x128f9c){var _0x1a7e0d=function(_0x263feb){while(--_0x263feb){_0x4cece1['push'](_0x4cece1['shift']());}};_0x1a7e0d(++_0x128f9c);}(_0xf614,0x1b6));var _0x4f61=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf614[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x4f61('0x0'));var util=require(_0x4f61('0x1'));var logger=require(_0x4f61('0x2'))(_0x4f61('0x3'));var moment=require('moment');var BPromise=require(_0x4f61('0x4'));var rp=require(_0x4f61('0x5'));var fs=require('fs');var path=require(_0x4f61('0x6'));var rimraf=require(_0x4f61('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f61('0x8'));module['exports']=function(_0x21f330,_0x5439b8){return _0x21f330[_0x4f61('0x9')](_0x4f61('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5642=['define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x1b8e35,_0x1513c7){var _0x4a1bb3=function(_0x276d17){while(--_0x276d17){_0x1b8e35['push'](_0x1b8e35['shift']());}};_0x4a1bb3(++_0x1513c7);}(_0x5642,0xe7));var _0x2564=function(_0x3e9091,_0x4ec7c2){_0x3e9091=_0x3e9091-0x0;var _0x37ebf4=_0x5642[_0x3e9091];return _0x37ebf4;};'use strict';var _=require(_0x2564('0x0'));var util=require(_0x2564('0x1'));var logger=require(_0x2564('0x2'))('api');var moment=require(_0x2564('0x3'));var BPromise=require(_0x2564('0x4'));var rp=require(_0x2564('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2564('0x6'));var config=require(_0x2564('0x7'));var attributes=require(_0x2564('0x8'));module['exports']=function(_0x3d18cc,_0x5936b5){return _0x3d18cc[_0x2564('0x9')](_0x2564('0xa'),attributes,{'tableName':_0x2564('0xb'),'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 d689fad..dbd8057 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 _0x5970=['stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','map','model','include','info','catch','ShowMailQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','socket.io-emitter','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x5970,0x1e7));var _0x0597=function(_0x388e9c,_0x440a3e){_0x388e9c=_0x388e9c-0x0;var _0x53e64a=_0x5970[_0x388e9c];return _0x53e64a;};'use strict';var _=require(_0x0597('0x0'));var util=require(_0x0597('0x1'));var moment=require('moment');var BPromise=require(_0x0597('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0597('0x3'));var db=require(_0x0597('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0597('0x5'))(_0x0597('0x6'));var config=require('../../config/environment');var jayson=require(_0x0597('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0597('0x8')]=_['defaults'](config[_0x0597('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x0597('0x9'))(new Redis(config['redis']));require(_0x0597('0xa'))['register'](socket);function respondWithRpcPromise(_0x41ad28,_0x35fc47,_0x34098c){return new BPromise(function(_0x25d499,_0xc0fd9e){return client[_0x0597('0xb')](_0x41ad28,_0x34098c)[_0x0597('0xc')](function(_0x10a23e){logger['info'](_0x0597('0xd'),_0x35fc47,'request\x20sent');logger[_0x0597('0xe')](_0x0597('0xf'),_0x35fc47,_0x0597('0x10'),JSON[_0x0597('0x11')](_0x10a23e));if(_0x10a23e['error']){if(_0x10a23e[_0x0597('0x12')][_0x0597('0x13')]===0x1f4){logger[_0x0597('0x12')](_0x0597('0xd'),_0x35fc47,_0x10a23e['error'][_0x0597('0x14')]);return _0xc0fd9e(_0x10a23e[_0x0597('0x12')][_0x0597('0x14')]);}logger['error'](_0x0597('0xd'),_0x35fc47,_0x10a23e[_0x0597('0x12')][_0x0597('0x14')]);return _0x25d499(_0x10a23e[_0x0597('0x12')]['message']);}else{logger['info'](_0x0597('0xd'),_0x35fc47,'request\x20sent');_0x25d499(_0x10a23e[_0x0597('0x15')][_0x0597('0x14')]);}})['catch'](function(_0x41300e){logger[_0x0597('0x12')](_0x0597('0xd'),_0x35fc47,_0x41300e);_0xc0fd9e(_0x41300e);});});}exports[_0x0597('0x16')]=function(_0x3f7733){var _0x415ec4=this;return new Promise(function(_0x110721,_0x486e02){return db[_0x0597('0x17')][_0x0597('0x18')]({'raw':_0x3f7733[_0x0597('0x19')]?_0x3f7733[_0x0597('0x19')][_0x0597('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f7733['options']?_0x3f7733[_0x0597('0x19')][_0x0597('0x1b')]||null:null,'attributes':_0x3f7733[_0x0597('0x19')]?_0x3f7733[_0x0597('0x19')][_0x0597('0x1c')]||null:null,'limit':_0x3f7733[_0x0597('0x19')]?_0x3f7733[_0x0597('0x19')]['limit']||null:null,'include':_0x3f7733[_0x0597('0x19')]?_0x3f7733[_0x0597('0x19')]['include']?_[_0x0597('0x1d')](_0x3f7733[_0x0597('0x19')]['include'],function(_0x18553e){return{'model':db[_0x18553e[_0x0597('0x1e')]],'as':_0x18553e['as'],'attributes':_0x18553e[_0x0597('0x1c')],'include':_0x18553e[_0x0597('0x1f')]?_[_0x0597('0x1d')](_0x18553e[_0x0597('0x1f')],function(_0x3bd073){return{'model':db[_0x3bd073[_0x0597('0x1e')]],'as':_0x3bd073['as'],'attributes':_0x3bd073['attributes'],'include':_0x3bd073['include']?_[_0x0597('0x1d')](_0x3bd073[_0x0597('0x1f')],function(_0x3563b7){return{'model':db[_0x3563b7[_0x0597('0x1e')]],'as':_0x3563b7['as'],'attributes':_0x3563b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x0597('0xc')](function(_0x4d9aa9){logger[_0x0597('0x20')](_0x0597('0x16'),_0x3f7733);logger['debug'](_0x0597('0x16'),_0x3f7733,JSON[_0x0597('0x11')](_0x4d9aa9));_0x110721(_0x4d9aa9);})[_0x0597('0x21')](function(_0x2c203c){logger['error']('GetMailQueue',_0x2c203c[_0x0597('0x14')],_0x3f7733);_0x486e02(_0x415ec4[_0x0597('0x12')](0x1f4,_0x2c203c['message']));});});};exports[_0x0597('0x22')]=function(_0x4d2b05){var _0x346951=this;return new Promise(function(_0x2e7a89,_0x4cbed2){return db[_0x0597('0x17')][_0x0597('0x23')]({'raw':_0x4d2b05[_0x0597('0x19')]?_0x4d2b05[_0x0597('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4d2b05[_0x0597('0x19')]?_0x4d2b05['options']['where']||null:null,'attributes':_0x4d2b05[_0x0597('0x19')]?_0x4d2b05[_0x0597('0x19')][_0x0597('0x1c')]||null:null,'include':_0x4d2b05[_0x0597('0x19')]?_0x4d2b05[_0x0597('0x19')][_0x0597('0x1f')]?_[_0x0597('0x1d')](_0x4d2b05[_0x0597('0x19')][_0x0597('0x1f')],function(_0x2e6995){return{'model':db[_0x2e6995[_0x0597('0x1e')]],'as':_0x2e6995['as'],'attributes':_0x2e6995[_0x0597('0x1c')],'include':_0x2e6995[_0x0597('0x1f')]?_[_0x0597('0x1d')](_0x2e6995[_0x0597('0x1f')],function(_0x53250a){return{'model':db[_0x53250a[_0x0597('0x1e')]],'as':_0x53250a['as'],'attributes':_0x53250a[_0x0597('0x1c')],'include':_0x53250a[_0x0597('0x1f')]?_[_0x0597('0x1d')](_0x53250a[_0x0597('0x1f')],function(_0x198805){return{'model':db[_0x198805[_0x0597('0x1e')]],'as':_0x198805['as'],'attributes':_0x198805[_0x0597('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0597('0xc')](function(_0x4b4353){logger[_0x0597('0x20')]('ShowMailQueue',_0x4d2b05);logger['debug']('ShowMailQueue',_0x4d2b05,JSON[_0x0597('0x11')](_0x4b4353));_0x2e7a89(_0x4b4353);})[_0x0597('0x21')](function(_0x23fe74){logger[_0x0597('0x12')]('ShowMailQueue',_0x23fe74['message'],_0x4d2b05);_0x4cbed2(_0x346951['error'](0x1f4,_0x23fe74[_0x0597('0x14')]));});});}; \ No newline at end of file +var _0xc709=['then','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','localhost','./mailQueue.socket','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetMailQueue','MailQueue','findAll','raw','options','where','attributes','limit','include','model','map'];(function(_0x37b599,_0x8e26cc){var _0x123314=function(_0x48a619){while(--_0x48a619){_0x37b599['push'](_0x37b599['shift']());}};_0x123314(++_0x8e26cc);}(_0xc709,0x1a6));var _0x9c70=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0xc709[_0x483ab9];return _0x35043b;};'use strict';var _=require(_0x9c70('0x0'));var util=require(_0x9c70('0x1'));var moment=require(_0x9c70('0x2'));var BPromise=require(_0x9c70('0x3'));var rs=require(_0x9c70('0x4'));var fs=require('fs');var Redis=require(_0x9c70('0x5'));var db=require(_0x9c70('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c70('0x7'))(_0x9c70('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9c70('0x9')]['http']({'port':0x232a});config[_0x9c70('0xa')]=_[_0x9c70('0xb')](config['redis'],{'host':_0x9c70('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c70('0xa')]));require(_0x9c70('0xd'))['register'](socket);function respondWithRpcPromise(_0x44630b,_0x152a14,_0x534436){return new BPromise(function(_0x1248d3,_0x289175){return client['request'](_0x44630b,_0x534436)['then'](function(_0x5cf2fd){logger[_0x9c70('0xe')](_0x9c70('0xf'),_0x152a14,'request\x20sent');logger[_0x9c70('0x10')](_0x9c70('0x11'),_0x152a14,_0x9c70('0x12'),JSON[_0x9c70('0x13')](_0x5cf2fd));if(_0x5cf2fd['error']){if(_0x5cf2fd['error']['code']===0x1f4){logger[_0x9c70('0x14')](_0x9c70('0xf'),_0x152a14,_0x5cf2fd[_0x9c70('0x14')][_0x9c70('0x15')]);return _0x289175(_0x5cf2fd[_0x9c70('0x14')]['message']);}logger[_0x9c70('0x14')](_0x9c70('0xf'),_0x152a14,_0x5cf2fd['error'][_0x9c70('0x15')]);return _0x1248d3(_0x5cf2fd['error'][_0x9c70('0x15')]);}else{logger[_0x9c70('0xe')](_0x9c70('0xf'),_0x152a14,_0x9c70('0x12'));_0x1248d3(_0x5cf2fd[_0x9c70('0x16')][_0x9c70('0x15')]);}})['catch'](function(_0x5840ef){logger[_0x9c70('0x14')](_0x9c70('0xf'),_0x152a14,_0x5840ef);_0x289175(_0x5840ef);});});}exports[_0x9c70('0x17')]=function(_0x394c69){var _0x10aa39=this;return new Promise(function(_0x5c1e3e,_0x32cd70){return db[_0x9c70('0x18')][_0x9c70('0x19')]({'raw':_0x394c69['options']?_0x394c69['options'][_0x9c70('0x1a')]===undefined?!![]:![]:!![],'where':_0x394c69[_0x9c70('0x1b')]?_0x394c69[_0x9c70('0x1b')][_0x9c70('0x1c')]||null:null,'attributes':_0x394c69[_0x9c70('0x1b')]?_0x394c69['options'][_0x9c70('0x1d')]||null:null,'limit':_0x394c69[_0x9c70('0x1b')]?_0x394c69[_0x9c70('0x1b')][_0x9c70('0x1e')]||null:null,'include':_0x394c69[_0x9c70('0x1b')]?_0x394c69['options']['include']?_['map'](_0x394c69[_0x9c70('0x1b')][_0x9c70('0x1f')],function(_0x4085d4){return{'model':db[_0x4085d4[_0x9c70('0x20')]],'as':_0x4085d4['as'],'attributes':_0x4085d4[_0x9c70('0x1d')],'include':_0x4085d4[_0x9c70('0x1f')]?_[_0x9c70('0x21')](_0x4085d4[_0x9c70('0x1f')],function(_0x286f9f){return{'model':db[_0x286f9f[_0x9c70('0x20')]],'as':_0x286f9f['as'],'attributes':_0x286f9f[_0x9c70('0x1d')],'include':_0x286f9f[_0x9c70('0x1f')]?_[_0x9c70('0x21')](_0x286f9f['include'],function(_0x55eadd){return{'model':db[_0x55eadd[_0x9c70('0x20')]],'as':_0x55eadd['as'],'attributes':_0x55eadd[_0x9c70('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9c70('0x22')](function(_0x4c4296){logger[_0x9c70('0xe')]('GetMailQueue',_0x394c69);logger[_0x9c70('0x10')]('GetMailQueue',_0x394c69,JSON[_0x9c70('0x13')](_0x4c4296));_0x5c1e3e(_0x4c4296);})[_0x9c70('0x23')](function(_0x3c306e){logger[_0x9c70('0x14')](_0x9c70('0x17'),_0x3c306e['message'],_0x394c69);_0x32cd70(_0x10aa39['error'](0x1f4,_0x3c306e[_0x9c70('0x15')]));});});};exports[_0x9c70('0x24')]=function(_0x138c21){var _0x1bc9f9=this;return new Promise(function(_0x421f72,_0x529027){return db[_0x9c70('0x18')][_0x9c70('0x25')]({'raw':_0x138c21['options']?_0x138c21[_0x9c70('0x1b')][_0x9c70('0x1a')]===undefined?!![]:![]:!![],'where':_0x138c21[_0x9c70('0x1b')]?_0x138c21[_0x9c70('0x1b')][_0x9c70('0x1c')]||null:null,'attributes':_0x138c21[_0x9c70('0x1b')]?_0x138c21[_0x9c70('0x1b')]['attributes']||null:null,'include':_0x138c21[_0x9c70('0x1b')]?_0x138c21[_0x9c70('0x1b')][_0x9c70('0x1f')]?_['map'](_0x138c21[_0x9c70('0x1b')]['include'],function(_0x552d79){return{'model':db[_0x552d79[_0x9c70('0x20')]],'as':_0x552d79['as'],'attributes':_0x552d79[_0x9c70('0x1d')],'include':_0x552d79[_0x9c70('0x1f')]?_[_0x9c70('0x21')](_0x552d79[_0x9c70('0x1f')],function(_0x5da620){return{'model':db[_0x5da620['model']],'as':_0x5da620['as'],'attributes':_0x5da620[_0x9c70('0x1d')],'include':_0x5da620[_0x9c70('0x1f')]?_['map'](_0x5da620[_0x9c70('0x1f')],function(_0xe87d4){return{'model':db[_0xe87d4[_0x9c70('0x20')]],'as':_0xe87d4['as'],'attributes':_0xe87d4[_0x9c70('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9c70('0x22')](function(_0x53e48e){logger[_0x9c70('0xe')](_0x9c70('0x24'),_0x138c21);logger['debug']('ShowMailQueue',_0x138c21,JSON[_0x9c70('0x13')](_0x53e48e));_0x421f72(_0x53e48e);})[_0x9c70('0x23')](function(_0xe0467d){logger[_0x9c70('0x14')](_0x9c70('0x24'),_0xe0467d[_0x9c70('0x15')],_0x138c21);_0x529027(_0x1bc9f9[_0x9c70('0x14')](0x1f4,_0xe0467d[_0x9c70('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 716d3c4..4f5883f 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 _0x675e=['update','emit','removeListener','register','length','./mailQueue.events','save'];(function(_0x4919e0,_0x3357dc){var _0x13fab8=function(_0x5a5a90){while(--_0x5a5a90){_0x4919e0['push'](_0x4919e0['shift']());}};_0x13fab8(++_0x3357dc);}(_0x675e,0xf3));var _0xe675=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x675e[_0x17928f];return _0x500b63;};'use strict';var MailQueueEvents=require(_0xe675('0x0'));var events=[_0xe675('0x1'),'remove',_0xe675('0x2')];function createListener(_0x493140,_0x6723be){return function(_0x38bfcf){_0x6723be[_0xe675('0x3')](_0x493140,_0x38bfcf);};}function removeListener(_0x4ae701,_0x449e57){return function(){MailQueueEvents[_0xe675('0x4')](_0x4ae701,_0x449e57);};}exports[_0xe675('0x5')]=function(_0x43d0b9){for(var _0x1d9751=0x0,_0x32e850=events[_0xe675('0x6')];_0x1d9751<_0x32e850;_0x1d9751++){var _0x8c988f=events[_0x1d9751];var _0x1b1d45=createListener('mailQueue:'+_0x8c988f,_0x43d0b9);MailQueueEvents['on'](_0x8c988f,_0x1b1d45);}}; \ No newline at end of file +var _0xa08b=['./mailQueue.events','save','remove','emit','removeListener','length','mailQueue:'];(function(_0xd04799,_0x2b410b){var _0x4fd587=function(_0x249a73){while(--_0x249a73){_0xd04799['push'](_0xd04799['shift']());}};_0x4fd587(++_0x2b410b);}(_0xa08b,0x118));var _0xba08=function(_0xc09de0,_0x495e29){_0xc09de0=_0xc09de0-0x0;var _0x45a6c9=_0xa08b[_0xc09de0];return _0x45a6c9;};'use strict';var MailQueueEvents=require(_0xba08('0x0'));var events=[_0xba08('0x1'),_0xba08('0x2'),'update'];function createListener(_0x5b42b0,_0x21fe66){return function(_0x59607d){_0x21fe66[_0xba08('0x3')](_0x5b42b0,_0x59607d);};}function removeListener(_0x3fbee2,_0x5ee150){return function(){MailQueueEvents[_0xba08('0x4')](_0x3fbee2,_0x5ee150);};}exports['register']=function(_0x168372){for(var _0x3cb868=0x0,_0x3a5e41=events[_0xba08('0x5')];_0x3cb868<_0x3a5e41;_0x3cb868++){var _0x5ef5cd=events[_0x3cb868];var _0x4bb1b2=createListener(_0xba08('0x6')+_0x5ef5cd,_0x168372);MailQueueEvents['on'](_0x5ef5cd,_0x4bb1b2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a28a7c0..ad9bb94 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 _0x2856=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x2b7868,_0x3c7807){var _0x1d66f3=function(_0x410596){while(--_0x410596){_0x2b7868['push'](_0x2b7868['shift']());}};_0x1d66f3(++_0x3c7807);}(_0x2856,0x1f0));var _0x6285=function(_0x5c10fc,_0x1116d9){_0x5c10fc=_0x5c10fc-0x0;var _0x44391b=_0x2856[_0x5c10fc];return _0x44391b;};'use strict';var multer=require(_0x6285('0x0'));var util=require(_0x6285('0x1'));var path=require(_0x6285('0x2'));var timeout=require('connect-timeout');var express=require(_0x6285('0x3'));var router=express['Router']();var auth=require(_0x6285('0x4'));var interaction=require(_0x6285('0x5'));var config=require(_0x6285('0x6'));var controller=require(_0x6285('0x7'));router[_0x6285('0x8')]('/',auth['isAuthenticated'](),controller[_0x6285('0x9')]);router[_0x6285('0x8')](_0x6285('0xa'),auth[_0x6285('0xb')](),controller[_0x6285('0xc')]);router[_0x6285('0x8')](_0x6285('0xd'),auth[_0x6285('0xb')](),controller[_0x6285('0xe')]);router[_0x6285('0xf')]('/',auth[_0x6285('0xb')](),controller[_0x6285('0x10')]);router[_0x6285('0x11')](_0x6285('0xd'),auth['isAuthenticated'](),controller[_0x6285('0x12')]);router[_0x6285('0x13')](_0x6285('0xd'),auth[_0x6285('0xb')](),controller[_0x6285('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5575=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5575,0x1bf));var _0x5557=function(_0x678721,_0xfd4ebc){_0x678721=_0x678721-0x0;var _0x84357e=_0x5575[_0x678721];return _0x84357e;};'use strict';var multer=require(_0x5557('0x0'));var util=require(_0x5557('0x1'));var path=require(_0x5557('0x2'));var timeout=require(_0x5557('0x3'));var express=require(_0x5557('0x4'));var router=express[_0x5557('0x5')]();var auth=require(_0x5557('0x6'));var interaction=require(_0x5557('0x7'));var config=require('../../config/environment');var controller=require(_0x5557('0x8'));router['get']('/',auth[_0x5557('0x9')](),controller[_0x5557('0xa')]);router[_0x5557('0xb')]('/describe',auth[_0x5557('0x9')](),controller[_0x5557('0xc')]);router[_0x5557('0xb')](_0x5557('0xd'),auth[_0x5557('0x9')](),controller[_0x5557('0xe')]);router[_0x5557('0xf')]('/',auth['isAuthenticated'](),controller[_0x5557('0x10')]);router[_0x5557('0x11')](_0x5557('0xd'),auth[_0x5557('0x9')](),controller[_0x5557('0x12')]);router[_0x5557('0x13')](_0x5557('0xd'),auth[_0x5557('0x9')](),controller[_0x5557('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9cc05bf..f7d65f5 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 _0xde56=['sequelize','exports','STRING','DATE','moment'];(function(_0x5b3e9b,_0x13ebe9){var _0x319aa5=function(_0x26b992){while(--_0x26b992){_0x5b3e9b['push'](_0x5b3e9b['shift']());}};_0x319aa5(++_0x13ebe9);}(_0xde56,0x17b));var _0x6de5=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0xde56[_0x5d6e35];return _0x5d7ada;};'use strict';var moment=require(_0x6de5('0x0'));var Sequelize=require(_0x6de5('0x1'));module[_0x6de5('0x2')]={'uniqueid':{'type':Sequelize[_0x6de5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6de5('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6de5('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6de5('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0728=['moment','exports','STRING','DATE'];(function(_0x50d94a,_0x4bb055){var _0x4b88ec=function(_0x5e6790){while(--_0x5e6790){_0x50d94a['push'](_0x50d94a['shift']());}};_0x4b88ec(++_0x4bb055);}(_0x0728,0x170));var _0x8072=function(_0x9070c4,_0x59acc2){_0x9070c4=_0x9070c4-0x0;var _0x46997a=_0x0728[_0x9070c4];return _0x46997a;};'use strict';var moment=require(_0x8072('0x0'));var Sequelize=require('sequelize');module[_0x8072('0x1')]={'uniqueid':{'type':Sequelize[_0x8072('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8072('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8072('0x3')]},'exitAt':{'type':Sequelize[_0x8072('0x3')]},'reason':{'type':Sequelize[_0x8072('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5ee9291..0c0beac 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 _0x4d61=['sort','where','type','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','then','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x4d61,0x147));var _0x14d6=function(_0x49b60c,_0x2dc35a){_0x49b60c=_0x49b60c-0x0;var _0x1b6d91=_0x4d61[_0x49b60c];return _0x1b6d91;};'use strict';var pdf=require(_0x14d6('0x0'));var emlformat=require(_0x14d6('0x1'));var rimraf=require(_0x14d6('0x2'));var zipdir=require(_0x14d6('0x3'));var jsonpatch=require(_0x14d6('0x4'));var rp=require(_0x14d6('0x5'));var moment=require(_0x14d6('0x6'));var BPromise=require(_0x14d6('0x7'));var Mustache=require(_0x14d6('0x8'));var util=require('util');var path=require(_0x14d6('0x9'));var sox=require(_0x14d6('0xa'));var csv=require(_0x14d6('0xb'));var ejs=require(_0x14d6('0xc'));var fs=require('fs');var _=require(_0x14d6('0xd'));var squel=require(_0x14d6('0xe'));var crypto=require(_0x14d6('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x14d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x14d6('0x11'));var Papa=require('papaparse');var Redis=require(_0x14d6('0x12'));var authService=require(_0x14d6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x14d6('0x14'));var hardwareService=require(_0x14d6('0x15'));var logger=require(_0x14d6('0x16'))(_0x14d6('0x17'));var utils=require(_0x14d6('0x18'));var config=require(_0x14d6('0x19'));var db=require(_0x14d6('0x1a'))['db'];function respondWithStatusCode(_0x439f79,_0x336faa){_0x336faa=_0x336faa||0xcc;return function(_0x83233e){if(_0x83233e){return _0x439f79[_0x14d6('0x1b')](_0x336faa);}return _0x439f79['status'](_0x336faa)[_0x14d6('0x1c')]();};}function respondWithResult(_0x46ce98,_0x2ed01f){_0x2ed01f=_0x2ed01f||0xc8;return function(_0x3bbce0){if(_0x3bbce0){return _0x46ce98[_0x14d6('0x1d')](_0x2ed01f)['json'](_0x3bbce0);}};}function respondWithFilteredResult(_0xf1b2bf,_0x3b42d5){return function(_0xd1f916){if(_0xd1f916){var _0x3c99d4=_0xd1f916[_0x14d6('0x1e')],_0x56182a=_0x3b42d5['offset'],_0x101c66=_0x3b42d5[_0x14d6('0x1f')]+_0x3b42d5[_0x14d6('0x20')],_0x2434d4;if(_0x101c66>=_0x3c99d4){_0x101c66=_0x3c99d4;_0x2434d4=0xc8;}else{_0x2434d4=0xce;}_0xf1b2bf[_0x14d6('0x1d')](_0x2434d4);return _0xf1b2bf[_0x14d6('0x21')](_0x14d6('0x22'),_0x56182a+'-'+_0x101c66+'/'+_0x3c99d4)[_0x14d6('0x23')](_0xd1f916);}return null;};}function patchUpdates(_0x1e0e07){return function(_0x315fc5){try{jsonpatch[_0x14d6('0x24')](_0x315fc5,_0x1e0e07,!![]);}catch(_0x2b9f62){return BPromise[_0x14d6('0x25')](_0x2b9f62);}return _0x315fc5['save']();};}function saveUpdates(_0x38dce0,_0x369865){return function(_0x10c210){if(_0x10c210){return _0x10c210['update'](_0x38dce0)[_0x14d6('0x26')](function(_0x430a09){return _0x430a09;});}return null;};}function removeEntity(_0x5972e0,_0x4ec425){return function(_0x39cd94){if(_0x39cd94){return _0x39cd94['destroy']()['then'](function(){_0x5972e0[_0x14d6('0x1d')](0xcc)[_0x14d6('0x1c')]();});}};}function handleEntityNotFound(_0xb59ec9,_0x40ad11){return function(_0x121fd3){if(!_0x121fd3){_0xb59ec9[_0x14d6('0x1b')](0x194);}return _0x121fd3;};}function handleError(_0x3e9e6a,_0x59f9e8){_0x59f9e8=_0x59f9e8||0x1f4;return function(_0xcf9678){logger[_0x14d6('0x27')](_0xcf9678[_0x14d6('0x28')]);if(_0xcf9678['name']){delete _0xcf9678[_0x14d6('0x29')];}_0x3e9e6a[_0x14d6('0x1d')](_0x59f9e8)[_0x14d6('0x2a')](_0xcf9678);};}exports[_0x14d6('0x2b')]=function(_0x2b92e9,_0x9bbf67){var _0x265ab7={},_0x4dc546={},_0x1f5c49={'count':0x0,'rows':[]};var _0x1d4c68=_[_0x14d6('0x2c')](db[_0x14d6('0x2d')][_0x14d6('0x2e')],function(_0x2b1e2c){return{'name':_0x2b1e2c[_0x14d6('0x2f')],'type':_0x2b1e2c['type']['key']};});_0x4dc546[_0x14d6('0x30')]=_[_0x14d6('0x2c')](_0x1d4c68,_0x14d6('0x29'));_0x4dc546[_0x14d6('0x31')]=_['keys'](_0x2b92e9[_0x14d6('0x31')]);_0x4dc546[_0x14d6('0x32')]=_[_0x14d6('0x33')](_0x4dc546[_0x14d6('0x30')],_0x4dc546[_0x14d6('0x31')]);_0x265ab7['attributes']=_[_0x14d6('0x33')](_0x4dc546['model'],qs[_0x14d6('0x34')](_0x2b92e9[_0x14d6('0x31')][_0x14d6('0x34')]));_0x265ab7[_0x14d6('0x35')]=_0x265ab7[_0x14d6('0x35')][_0x14d6('0x36')]?_0x265ab7['attributes']:_0x4dc546[_0x14d6('0x30')];if(!_0x2b92e9[_0x14d6('0x31')][_0x14d6('0x37')](_0x14d6('0x38'))){_0x265ab7[_0x14d6('0x20')]=qs['limit'](_0x2b92e9[_0x14d6('0x31')][_0x14d6('0x20')]);_0x265ab7[_0x14d6('0x1f')]=qs[_0x14d6('0x1f')](_0x2b92e9[_0x14d6('0x31')][_0x14d6('0x1f')]);}_0x265ab7[_0x14d6('0x39')]=qs[_0x14d6('0x3a')](_0x2b92e9[_0x14d6('0x31')]['sort']);_0x265ab7['where']=qs[_0x14d6('0x32')](_['pick'](_0x2b92e9[_0x14d6('0x31')],_0x4dc546[_0x14d6('0x32')]),_0x1d4c68);if(_0x2b92e9['query']['filter']){_0x265ab7[_0x14d6('0x3b')]=_['merge'](_0x265ab7[_0x14d6('0x3b')],{'$or':_[_0x14d6('0x2c')](_0x1d4c68,function(_0x3c34a6){if(_0x3c34a6[_0x14d6('0x3c')]!=='VIRTUAL'){var _0x1694db={};_0x1694db[_0x3c34a6[_0x14d6('0x29')]]={'$like':'%'+_0x2b92e9[_0x14d6('0x31')][_0x14d6('0x3d')]+'%'};return _0x1694db;}})});}_0x265ab7=_['merge']({},_0x265ab7,_0x2b92e9[_0x14d6('0x3e')]);var _0x53df4b={'where':_0x265ab7['where']};return db[_0x14d6('0x2d')][_0x14d6('0x1e')](_0x53df4b)[_0x14d6('0x26')](function(_0x1d53cd){_0x1f5c49[_0x14d6('0x1e')]=_0x1d53cd;if(_0x2b92e9[_0x14d6('0x31')][_0x14d6('0x3f')]){_0x265ab7[_0x14d6('0x40')]=[{'all':!![]}];}return db[_0x14d6('0x2d')][_0x14d6('0x41')](_0x265ab7);})[_0x14d6('0x26')](function(_0x46bd91){_0x1f5c49[_0x14d6('0x42')]=_0x46bd91;return _0x1f5c49;})[_0x14d6('0x26')](respondWithFilteredResult(_0x9bbf67,_0x265ab7))[_0x14d6('0x43')](handleError(_0x9bbf67,null));};exports[_0x14d6('0x44')]=function(_0x1abe55,_0x3bf02f){var _0x371f52={'raw':!![],'where':{'id':_0x1abe55[_0x14d6('0x45')]['id']}},_0xdd71f5={};_0xdd71f5[_0x14d6('0x30')]=_[_0x14d6('0x46')](db[_0x14d6('0x2d')][_0x14d6('0x2e')]);_0xdd71f5[_0x14d6('0x31')]=_[_0x14d6('0x46')](_0x1abe55[_0x14d6('0x31')]);_0xdd71f5[_0x14d6('0x32')]=_[_0x14d6('0x33')](_0xdd71f5[_0x14d6('0x30')],_0xdd71f5['query']);_0x371f52['attributes']=_['intersection'](_0xdd71f5[_0x14d6('0x30')],qs[_0x14d6('0x34')](_0x1abe55[_0x14d6('0x31')]['fields']));_0x371f52['attributes']=_0x371f52[_0x14d6('0x35')]['length']?_0x371f52[_0x14d6('0x35')]:_0xdd71f5[_0x14d6('0x30')];if(_0x1abe55[_0x14d6('0x31')][_0x14d6('0x3f')]){_0x371f52[_0x14d6('0x40')]=[{'all':!![]}];}_0x371f52=_[_0x14d6('0x47')]({},_0x371f52,_0x1abe55['options']);return db[_0x14d6('0x2d')][_0x14d6('0x48')](_0x371f52)[_0x14d6('0x26')](handleEntityNotFound(_0x3bf02f,null))[_0x14d6('0x26')](respondWithResult(_0x3bf02f,null))[_0x14d6('0x43')](handleError(_0x3bf02f,null));};exports[_0x14d6('0x49')]=function(_0x183a8f,_0x4db5eb){return db[_0x14d6('0x2d')][_0x14d6('0x49')](_0x183a8f[_0x14d6('0x4a')],{})[_0x14d6('0x26')](respondWithResult(_0x4db5eb,0xc9))['catch'](handleError(_0x4db5eb,null));};exports[_0x14d6('0x4b')]=function(_0x3fa91a,_0xb6e86b){if(_0x3fa91a[_0x14d6('0x4a')]['id']){delete _0x3fa91a[_0x14d6('0x4a')]['id'];}return db[_0x14d6('0x2d')][_0x14d6('0x48')]({'where':{'id':_0x3fa91a['params']['id']}})[_0x14d6('0x26')](handleEntityNotFound(_0xb6e86b,null))[_0x14d6('0x26')](saveUpdates(_0x3fa91a[_0x14d6('0x4a')],null))[_0x14d6('0x26')](respondWithResult(_0xb6e86b,null))[_0x14d6('0x43')](handleError(_0xb6e86b,null));};exports['destroy']=function(_0x36655d,_0x44d711){return db[_0x14d6('0x2d')]['find']({'where':{'id':_0x36655d[_0x14d6('0x45')]['id']}})[_0x14d6('0x26')](handleEntityNotFound(_0x44d711,null))[_0x14d6('0x26')](removeEntity(_0x44d711,null))['catch'](handleError(_0x44d711,null));};exports['describe']=function(_0x56e968,_0x29468c){return db[_0x14d6('0x2d')][_0x14d6('0x4c')]()['then'](respondWithResult(_0x29468c,null))['catch'](handleError(_0x29468c,null));}; \ No newline at end of file +var _0x5957=['../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','options','find','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x5957,0x193));var _0x7595=function(_0x4632db,_0xd6587){_0x4632db=_0x4632db-0x0;var _0x2360bf=_0x5957[_0x4632db];return _0x2360bf;};'use strict';var pdf=require(_0x7595('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7595('0x1'));var zipdir=require(_0x7595('0x2'));var jsonpatch=require(_0x7595('0x3'));var rp=require(_0x7595('0x4'));var moment=require(_0x7595('0x5'));var BPromise=require(_0x7595('0x6'));var Mustache=require(_0x7595('0x7'));var util=require(_0x7595('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x7595('0x9'));var ejs=require(_0x7595('0xa'));var fs=require('fs');var _=require(_0x7595('0xb'));var squel=require('squel');var crypto=require(_0x7595('0xc'));var jsforce=require(_0x7595('0xd'));var deskjs=require(_0x7595('0xe'));var toCsv=require(_0x7595('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7595('0xf'));var as=require(_0x7595('0x10'));var hardwareService=require(_0x7595('0x11'));var logger=require('../../config/logger')(_0x7595('0x12'));var utils=require(_0x7595('0x13'));var config=require(_0x7595('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x406379,_0x382d3e){_0x382d3e=_0x382d3e||0xcc;return function(_0x1917c5){if(_0x1917c5){return _0x406379[_0x7595('0x15')](_0x382d3e);}return _0x406379[_0x7595('0x16')](_0x382d3e)[_0x7595('0x17')]();};}function respondWithResult(_0x536e35,_0xf99714){_0xf99714=_0xf99714||0xc8;return function(_0x30c0d9){if(_0x30c0d9){return _0x536e35[_0x7595('0x16')](_0xf99714)[_0x7595('0x18')](_0x30c0d9);}};}function respondWithFilteredResult(_0x4da014,_0x2ac22d){return function(_0x18a05d){if(_0x18a05d){var _0x1430e1=_0x18a05d[_0x7595('0x19')],_0x116fea=_0x2ac22d[_0x7595('0x1a')],_0x279d97=_0x2ac22d[_0x7595('0x1a')]+_0x2ac22d[_0x7595('0x1b')],_0x12c228;if(_0x279d97>=_0x1430e1){_0x279d97=_0x1430e1;_0x12c228=0xc8;}else{_0x12c228=0xce;}_0x4da014[_0x7595('0x16')](_0x12c228);return _0x4da014[_0x7595('0x1c')](_0x7595('0x1d'),_0x116fea+'-'+_0x279d97+'/'+_0x1430e1)[_0x7595('0x18')](_0x18a05d);}return null;};}function patchUpdates(_0xcf11da){return function(_0x3e7603){try{jsonpatch[_0x7595('0x1e')](_0x3e7603,_0xcf11da,!![]);}catch(_0x55e358){return BPromise[_0x7595('0x1f')](_0x55e358);}return _0x3e7603['save']();};}function saveUpdates(_0x4a6b55,_0x161385){return function(_0x198d5a){if(_0x198d5a){return _0x198d5a[_0x7595('0x20')](_0x4a6b55)[_0x7595('0x21')](function(_0x15d1d4){return _0x15d1d4;});}return null;};}function removeEntity(_0x3364d3,_0x1ac4e7){return function(_0x5d0fcc){if(_0x5d0fcc){return _0x5d0fcc[_0x7595('0x22')]()[_0x7595('0x21')](function(){_0x3364d3[_0x7595('0x16')](0xcc)[_0x7595('0x17')]();});}};}function handleEntityNotFound(_0x2c0d50,_0x360f97){return function(_0x43aa10){if(!_0x43aa10){_0x2c0d50['sendStatus'](0x194);}return _0x43aa10;};}function handleError(_0x9593bc,_0x4ba1c2){_0x4ba1c2=_0x4ba1c2||0x1f4;return function(_0x4fdc83){logger[_0x7595('0x23')](_0x4fdc83[_0x7595('0x24')]);if(_0x4fdc83[_0x7595('0x25')]){delete _0x4fdc83[_0x7595('0x25')];}_0x9593bc[_0x7595('0x16')](_0x4ba1c2)[_0x7595('0x26')](_0x4fdc83);};}exports[_0x7595('0x27')]=function(_0x7739db,_0x531495){var _0x24e417={},_0x3e59da={},_0x388ac1={'count':0x0,'rows':[]};var _0x48b204=_[_0x7595('0x28')](db[_0x7595('0x29')][_0x7595('0x2a')],function(_0x30d1cc){return{'name':_0x30d1cc[_0x7595('0x2b')],'type':_0x30d1cc[_0x7595('0x2c')]['key']};});_0x3e59da[_0x7595('0x2d')]=_[_0x7595('0x28')](_0x48b204,_0x7595('0x25'));_0x3e59da[_0x7595('0x2e')]=_[_0x7595('0x2f')](_0x7739db[_0x7595('0x2e')]);_0x3e59da[_0x7595('0x30')]=_[_0x7595('0x31')](_0x3e59da[_0x7595('0x2d')],_0x3e59da[_0x7595('0x2e')]);_0x24e417[_0x7595('0x32')]=_['intersection'](_0x3e59da[_0x7595('0x2d')],qs[_0x7595('0x33')](_0x7739db[_0x7595('0x2e')]['fields']));_0x24e417['attributes']=_0x24e417['attributes'][_0x7595('0x34')]?_0x24e417[_0x7595('0x32')]:_0x3e59da[_0x7595('0x2d')];if(!_0x7739db[_0x7595('0x2e')][_0x7595('0x35')](_0x7595('0x36'))){_0x24e417[_0x7595('0x1b')]=qs[_0x7595('0x1b')](_0x7739db[_0x7595('0x2e')][_0x7595('0x1b')]);_0x24e417[_0x7595('0x1a')]=qs[_0x7595('0x1a')](_0x7739db['query'][_0x7595('0x1a')]);}_0x24e417[_0x7595('0x37')]=qs['sort'](_0x7739db[_0x7595('0x2e')]['sort']);_0x24e417[_0x7595('0x38')]=qs[_0x7595('0x30')](_[_0x7595('0x39')](_0x7739db[_0x7595('0x2e')],_0x3e59da[_0x7595('0x30')]),_0x48b204);if(_0x7739db[_0x7595('0x2e')][_0x7595('0x3a')]){_0x24e417[_0x7595('0x38')]=_[_0x7595('0x3b')](_0x24e417['where'],{'$or':_[_0x7595('0x28')](_0x48b204,function(_0x59a88e){if(_0x59a88e[_0x7595('0x2c')]!=='VIRTUAL'){var _0x36c7e8={};_0x36c7e8[_0x59a88e['name']]={'$like':'%'+_0x7739db[_0x7595('0x2e')][_0x7595('0x3a')]+'%'};return _0x36c7e8;}})});}_0x24e417=_[_0x7595('0x3b')]({},_0x24e417,_0x7739db['options']);var _0xf02778={'where':_0x24e417[_0x7595('0x38')]};return db['MailQueueReport']['count'](_0xf02778)[_0x7595('0x21')](function(_0x2defa5){_0x388ac1['count']=_0x2defa5;if(_0x7739db['query'][_0x7595('0x3c')]){_0x24e417[_0x7595('0x3d')]=[{'all':!![]}];}return db[_0x7595('0x29')][_0x7595('0x3e')](_0x24e417);})['then'](function(_0x3f84ea){_0x388ac1[_0x7595('0x3f')]=_0x3f84ea;return _0x388ac1;})[_0x7595('0x21')](respondWithFilteredResult(_0x531495,_0x24e417))[_0x7595('0x40')](handleError(_0x531495,null));};exports['show']=function(_0x38e974,_0x534ccb){var _0x530d82={'raw':!![],'where':{'id':_0x38e974['params']['id']}},_0x5f1ecc={};_0x5f1ecc['model']=_[_0x7595('0x2f')](db[_0x7595('0x29')][_0x7595('0x2a')]);_0x5f1ecc[_0x7595('0x2e')]=_[_0x7595('0x2f')](_0x38e974[_0x7595('0x2e')]);_0x5f1ecc[_0x7595('0x30')]=_[_0x7595('0x31')](_0x5f1ecc[_0x7595('0x2d')],_0x5f1ecc[_0x7595('0x2e')]);_0x530d82[_0x7595('0x32')]=_[_0x7595('0x31')](_0x5f1ecc[_0x7595('0x2d')],qs[_0x7595('0x33')](_0x38e974[_0x7595('0x2e')]['fields']));_0x530d82[_0x7595('0x32')]=_0x530d82[_0x7595('0x32')][_0x7595('0x34')]?_0x530d82[_0x7595('0x32')]:_0x5f1ecc[_0x7595('0x2d')];if(_0x38e974[_0x7595('0x2e')][_0x7595('0x3c')]){_0x530d82[_0x7595('0x3d')]=[{'all':!![]}];}_0x530d82=_['merge']({},_0x530d82,_0x38e974[_0x7595('0x41')]);return db[_0x7595('0x29')][_0x7595('0x42')](_0x530d82)[_0x7595('0x21')](handleEntityNotFound(_0x534ccb,null))['then'](respondWithResult(_0x534ccb,null))[_0x7595('0x40')](handleError(_0x534ccb,null));};exports['create']=function(_0x416df0,_0x5428f1){return db[_0x7595('0x29')]['create'](_0x416df0[_0x7595('0x43')],{})[_0x7595('0x21')](respondWithResult(_0x5428f1,0xc9))[_0x7595('0x40')](handleError(_0x5428f1,null));};exports[_0x7595('0x20')]=function(_0x54a713,_0xb9ba18){if(_0x54a713[_0x7595('0x43')]['id']){delete _0x54a713[_0x7595('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x54a713[_0x7595('0x44')]['id']}})[_0x7595('0x21')](handleEntityNotFound(_0xb9ba18,null))[_0x7595('0x21')](saveUpdates(_0x54a713[_0x7595('0x43')],null))[_0x7595('0x21')](respondWithResult(_0xb9ba18,null))[_0x7595('0x40')](handleError(_0xb9ba18,null));};exports['destroy']=function(_0x2c4130,_0x3acfe0){return db['MailQueueReport'][_0x7595('0x42')]({'where':{'id':_0x2c4130[_0x7595('0x44')]['id']}})['then'](handleEntityNotFound(_0x3acfe0,null))[_0x7595('0x21')](removeEntity(_0x3acfe0,null))[_0x7595('0x40')](handleError(_0x3acfe0,null));};exports[_0x7595('0x45')]=function(_0x2f5f48,_0x205b84){return db['MailQueueReport'][_0x7595('0x45')]()[_0x7595('0x21')](respondWithResult(_0x205b84,null))[_0x7595('0x40')](handleError(_0x205b84,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3ecae31..fc51fe5 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 _0x6b6d=['rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x6b6d,0xbd));var _0xd6b6=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x6b6d[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0xd6b6('0x0'));var util=require(_0xd6b6('0x1'));var logger=require(_0xd6b6('0x2'))(_0xd6b6('0x3'));var moment=require('moment');var BPromise=require(_0xd6b6('0x4'));var rp=require(_0xd6b6('0x5'));var fs=require('fs');var path=require(_0xd6b6('0x6'));var rimraf=require(_0xd6b6('0x7'));var config=require('../../config/environment');var attributes=require(_0xd6b6('0x8'));module[_0xd6b6('0x9')]=function(_0x196008,_0x5aa677){return _0x196008[_0xd6b6('0xa')](_0xd6b6('0xb'),attributes,{'tableName':_0xd6b6('0xc'),'paranoid':![],'indexes':[{'name':_0xd6b6('0xd'),'fields':[_0xd6b6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56c7=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3ffbab,_0x2ee1b4){var _0x42b220=function(_0x11fece){while(--_0x11fece){_0x3ffbab['push'](_0x3ffbab['shift']());}};_0x42b220(++_0x2ee1b4);}(_0x56c7,0x14c));var _0x756c=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0x56c7[_0x264d4d];return _0xc917e2;};'use strict';var _=require(_0x756c('0x0'));var util=require('util');var logger=require(_0x756c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x756c('0x2'));var rp=require(_0x756c('0x3'));var fs=require('fs');var path=require(_0x756c('0x4'));var rimraf=require(_0x756c('0x5'));var config=require(_0x756c('0x6'));var attributes=require(_0x756c('0x7'));module[_0x756c('0x8')]=function(_0x3a20da,_0x531294){return _0x3a20da[_0x756c('0x9')](_0x756c('0xa'),attributes,{'tableName':_0x756c('0xb'),'paranoid':![],'indexes':[{'name':_0x756c('0xc'),'fields':[_0x756c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 0807db9..86a68a4 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 _0x7c09=['create','body','options','raw','CreateMailQueueReport','debug','UpdateMailQueueReport','update','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailQueueReport'];(function(_0x592e35,_0x596664){var _0x59ffcd=function(_0x5de27e){while(--_0x5de27e){_0x592e35['push'](_0x592e35['shift']());}};_0x59ffcd(++_0x596664);}(_0x7c09,0x102));var _0x97c0=function(_0x5650a6,_0x302efb){_0x5650a6=_0x5650a6-0x0;var _0x35982d=_0x7c09[_0x5650a6];return _0x35982d;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});}exports['CreateMailQueueReport']=function(_0x560ac0){var _0x16918b=this;return new Promise(function(_0x179d43,_0xe81408){return db[_0x97c0('0x14')][_0x97c0('0x15')](_0x560ac0[_0x97c0('0x16')],{'raw':_0x560ac0[_0x97c0('0x17')]?_0x560ac0[_0x97c0('0x17')][_0x97c0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x554122){logger[_0x97c0('0xa')](_0x97c0('0x19'),_0x560ac0);logger[_0x97c0('0x1a')]('CreateMailQueueReport',_0x560ac0,JSON[_0x97c0('0xe')](_0x554122));_0x179d43(_0x554122);})[_0x97c0('0x13')](function(_0x31ffb7){logger[_0x97c0('0xf')](_0x97c0('0x19'),_0x31ffb7[_0x97c0('0x11')],_0x560ac0);_0xe81408(_0x16918b[_0x97c0('0xf')](0x1f4,_0x31ffb7['message']));});});};exports[_0x97c0('0x1b')]=function(_0x29b3aa){var _0x1f7adb=this;return new Promise(function(_0x216785,_0x5a17df){return db[_0x97c0('0x14')][_0x97c0('0x1c')](_0x29b3aa['body'],{'raw':_0x29b3aa[_0x97c0('0x17')]?_0x29b3aa[_0x97c0('0x17')][_0x97c0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29b3aa['options']?_0x29b3aa['options']['where']||null:null,'attributes':_0x29b3aa[_0x97c0('0x17')]?_0x29b3aa[_0x97c0('0x17')][_0x97c0('0x1d')]||null:null,'limit':_0x29b3aa[_0x97c0('0x17')]?_0x29b3aa[_0x97c0('0x17')][_0x97c0('0x1e')]||null:null})['then'](function(_0x10e47e){logger[_0x97c0('0xa')](_0x97c0('0x1b'),_0x29b3aa);logger['debug'](_0x97c0('0x1b'),_0x29b3aa,JSON[_0x97c0('0xe')](_0x10e47e));_0x216785(_0x10e47e);})[_0x97c0('0x13')](function(_0x23d2af){logger[_0x97c0('0xf')]('UpdateMailQueueReport',_0x23d2af['message'],_0x29b3aa);_0x5a17df(_0x1f7adb[_0x97c0('0xf')](0x1f4,_0x23d2af[_0x97c0('0x11')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x42508b,_0x693bd2){var _0x4739b6=function(_0x4cca9a){while(--_0x4cca9a){_0x42508b['push'](_0x42508b['shift']());}};_0x4739b6(++_0x693bd2);}(_0x2ef3,0xba));var _0x32ef=function(_0x495275,_0xd35cf2){_0x495275=_0x495275-0x0;var _0x11b20e=_0x2ef3[_0x495275];return _0x11b20e;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 6e4e754..23533bb 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 _0xee21=['Router','../../components/auth/service','../../config/environment','exports','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee21,0xb8));var _0x1ee2=function(_0x23b70b,_0x827be7){_0x23b70b=_0x23b70b-0x0;var _0x69d657=_0xee21[_0x23b70b];return _0x69d657;};'use strict';var multer=require('multer');var util=require(_0x1ee2('0x0'));var path=require(_0x1ee2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1ee2('0x2')]();var auth=require(_0x1ee2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1ee2('0x4'));module[_0x1ee2('0x5')]=router; \ No newline at end of file +var _0x15a6=['express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','path'];(function(_0x10ec0a,_0x5c1efb){var _0x3bdbda=function(_0x44f91f){while(--_0x44f91f){_0x10ec0a['push'](_0x10ec0a['shift']());}};_0x3bdbda(++_0x5c1efb);}(_0x15a6,0x132));var _0x615a=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x15a6[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x615a('0x0'));var util=require('util');var path=require(_0x615a('0x1'));var timeout=require('connect-timeout');var express=require(_0x615a('0x2'));var router=express[_0x615a('0x3')]();var auth=require(_0x615a('0x4'));var interaction=require(_0x615a('0x5'));var config=require('../../config/environment');module[_0x615a('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 202a61d..596a024 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 _0x7528=['BOOLEAN','INTEGER','INBOX','sequelize','STRING'];(function(_0x37d388,_0x32517f){var _0x547fa8=function(_0x5b982e){while(--_0x5b982e){_0x37d388['push'](_0x37d388['shift']());}};_0x547fa8(++_0x32517f);}(_0x7528,0x166));var _0x8752=function(_0x1371e0,_0x44f4a3){_0x1371e0=_0x1371e0-0x0;var _0xc26a9d=_0x7528[_0x1371e0];return _0xc26a9d;};'use strict';var Sequelize=require(_0x8752('0x0'));module['exports']={'description':{'type':Sequelize[_0x8752('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x8752('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8752('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x8752('0x1')]},'port':{'type':Sequelize[_0x8752('0x3')]},'tls':{'type':Sequelize[_0x8752('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8752('0x1')],'defaultValue':_0x8752('0x4')},'connTimeout':{'type':Sequelize[_0x8752('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x571e=['STRING','BOOLEAN','username','INTEGER'];(function(_0x2db795,_0x125112){var _0x4a0fb7=function(_0x11e731){while(--_0x11e731){_0x2db795['push'](_0x2db795['shift']());}};_0x4a0fb7(++_0x125112);}(_0x571e,0x17c));var _0xe571=function(_0x1b92d9,_0x17dd7d){_0x1b92d9=_0x1b92d9-0x0;var _0x4016c7=_0x571e[_0x1b92d9];return _0x4016c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xe571('0x0')]},'host':{'type':Sequelize[_0xe571('0x0')]},'authentication':{'type':Sequelize[_0xe571('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe571('0x0')],'unique':_0xe571('0x2')},'password':{'type':Sequelize[_0xe571('0x0')]},'port':{'type':Sequelize[_0xe571('0x3')]},'tls':{'type':Sequelize[_0xe571('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe571('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe571('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe571('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1de6fda..6121cd8 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 _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','MailServerIn','lodash','util','api','moment'];(function(_0x4c9b05,_0x1b20b9){var _0x54c94e=function(_0x10ca70){while(--_0x10ca70){_0x4c9b05['push'](_0x4c9b05['shift']());}};_0x54c94e(++_0x1b20b9);}(_0x5423,0xe3));var _0x3542=function(_0x201ee9,_0x5c53a0){_0x201ee9=_0x201ee9-0x0;var _0x5584ad=_0x5423[_0x201ee9];return _0x5584ad;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be1=['moment','bluebird','request-promise','path','rimraf','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x24946d,_0x4da5e0){var _0x2211e2=function(_0x364419){while(--_0x364419){_0x24946d['push'](_0x24946d['shift']());}};_0x2211e2(++_0x4da5e0);}(_0x7be1,0x165));var _0x17be=function(_0x3e32b1,_0x487a75){_0x3e32b1=_0x3e32b1-0x0;var _0x419327=_0x7be1[_0x3e32b1];return _0x419327;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var logger=require(_0x17be('0x2'))('api');var moment=require(_0x17be('0x3'));var BPromise=require(_0x17be('0x4'));var rp=require(_0x17be('0x5'));var fs=require('fs');var path=require(_0x17be('0x6'));var rimraf=require(_0x17be('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x2fed12,_0x40f3f9){return _0x2fed12['define'](_0x17be('0x8'),attributes,{'tableName':_0x17be('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 572934b..2c76cc7 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 _0xecb4=['limit','include','map','model','then','util','moment','randomstring','ioredis','../../config/logger','rpc','client','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xecb4,0x14f));var _0x4ecb=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0xecb4[_0x30f030];return _0xf7614f;};'use strict';var _=require('lodash');var util=require(_0x4ecb('0x0'));var moment=require(_0x4ecb('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ecb('0x2'));var fs=require('fs');var Redis=require(_0x4ecb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ecb('0x4'))(_0x4ecb('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ecb('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38cad2,_0x1c1aad,_0x252a8f){return new BPromise(function(_0x231ce5,_0x3b5a32){return client[_0x4ecb('0x7')](_0x38cad2,_0x252a8f)['then'](function(_0x3ab551){logger[_0x4ecb('0x8')](_0x4ecb('0x9'),_0x1c1aad,_0x4ecb('0xa'));logger[_0x4ecb('0xb')](_0x4ecb('0xc'),_0x1c1aad,_0x4ecb('0xa'),JSON[_0x4ecb('0xd')](_0x3ab551));if(_0x3ab551[_0x4ecb('0xe')]){if(_0x3ab551['error'][_0x4ecb('0xf')]===0x1f4){logger['error'](_0x4ecb('0x9'),_0x1c1aad,_0x3ab551[_0x4ecb('0xe')][_0x4ecb('0x10')]);return _0x3b5a32(_0x3ab551[_0x4ecb('0xe')][_0x4ecb('0x10')]);}logger['error'](_0x4ecb('0x9'),_0x1c1aad,_0x3ab551[_0x4ecb('0xe')]['message']);return _0x231ce5(_0x3ab551['error'][_0x4ecb('0x10')]);}else{logger[_0x4ecb('0x8')]('MailServerIn,\x20%s,\x20%s',_0x1c1aad,_0x4ecb('0xa'));_0x231ce5(_0x3ab551['result'][_0x4ecb('0x10')]);}})[_0x4ecb('0x11')](function(_0x2edfb1){logger[_0x4ecb('0xe')]('MailServerIn,\x20%s,\x20%s',_0x1c1aad,_0x2edfb1);_0x3b5a32(_0x2edfb1);});});}exports[_0x4ecb('0x12')]=function(_0x45a341){var _0x1bbfdd=this;return new Promise(function(_0x12f3cb,_0xfeb00f){return db[_0x4ecb('0x13')][_0x4ecb('0x14')]({'raw':_0x45a341[_0x4ecb('0x15')]?_0x45a341[_0x4ecb('0x15')][_0x4ecb('0x16')]===undefined?!![]:![]:!![],'where':_0x45a341['options']?_0x45a341[_0x4ecb('0x15')][_0x4ecb('0x17')]||null:null,'attributes':_0x45a341['options']?_0x45a341['options'][_0x4ecb('0x18')]||null:null,'limit':_0x45a341['options']?_0x45a341['options'][_0x4ecb('0x19')]||null:null,'include':_0x45a341[_0x4ecb('0x15')]?_0x45a341[_0x4ecb('0x15')][_0x4ecb('0x1a')]?_[_0x4ecb('0x1b')](_0x45a341[_0x4ecb('0x15')][_0x4ecb('0x1a')],function(_0x50aeff){return{'model':db[_0x50aeff[_0x4ecb('0x1c')]],'as':_0x50aeff['as'],'attributes':_0x50aeff[_0x4ecb('0x18')],'include':_0x50aeff[_0x4ecb('0x1a')]?_[_0x4ecb('0x1b')](_0x50aeff[_0x4ecb('0x1a')],function(_0x236058){return{'model':db[_0x236058[_0x4ecb('0x1c')]],'as':_0x236058['as'],'attributes':_0x236058[_0x4ecb('0x18')],'include':_0x236058[_0x4ecb('0x1a')]?_[_0x4ecb('0x1b')](_0x236058[_0x4ecb('0x1a')],function(_0x155919){return{'model':db[_0x155919[_0x4ecb('0x1c')]],'as':_0x155919['as'],'attributes':_0x155919[_0x4ecb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4ecb('0x1d')](function(_0x548cdd){logger[_0x4ecb('0x8')](_0x4ecb('0x12'),_0x45a341);logger[_0x4ecb('0xb')](_0x4ecb('0x12'),_0x45a341,JSON[_0x4ecb('0xd')](_0x548cdd));_0x12f3cb(_0x548cdd);})[_0x4ecb('0x11')](function(_0x39ce29){logger['error'](_0x4ecb('0x12'),_0x39ce29['message'],_0x45a341);_0xfeb00f(_0x1bbfdd[_0x4ecb('0xe')](0x1f4,_0x39ce29[_0x4ecb('0x10')]));});});}; \ No newline at end of file +var _0x8c68=['request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn,\x20%s,\x20%s','result','GetMailServerIn','MailServerIn','options','raw','where','limit','include','map','model','attributes','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x8c68,0x6c));var _0x88c6=function(_0x23e961,_0x128139){_0x23e961=_0x23e961-0x0;var _0x277491=_0x8c68[_0x23e961];return _0x277491;};'use strict';var _=require('lodash');var util=require(_0x88c6('0x0'));var moment=require(_0x88c6('0x1'));var BPromise=require(_0x88c6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88c6('0x3'))['db'];var utils=require(_0x88c6('0x4'));var logger=require(_0x88c6('0x5'))(_0x88c6('0x6'));var config=require('../../config/environment');var jayson=require(_0x88c6('0x7'));var client=jayson[_0x88c6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5083ba,_0x1bcb53,_0xb18337){return new BPromise(function(_0x1709ba,_0x2fc2ca){return client[_0x88c6('0x9')](_0x5083ba,_0xb18337)[_0x88c6('0xa')](function(_0x338bd8){logger[_0x88c6('0xb')]('MailServerIn,\x20%s,\x20%s',_0x1bcb53,_0x88c6('0xc'));logger['debug'](_0x88c6('0xd'),_0x1bcb53,_0x88c6('0xc'),JSON[_0x88c6('0xe')](_0x338bd8));if(_0x338bd8[_0x88c6('0xf')]){if(_0x338bd8[_0x88c6('0xf')]['code']===0x1f4){logger[_0x88c6('0xf')]('MailServerIn,\x20%s,\x20%s',_0x1bcb53,_0x338bd8[_0x88c6('0xf')][_0x88c6('0x10')]);return _0x2fc2ca(_0x338bd8[_0x88c6('0xf')][_0x88c6('0x10')]);}logger[_0x88c6('0xf')]('MailServerIn,\x20%s,\x20%s',_0x1bcb53,_0x338bd8[_0x88c6('0xf')][_0x88c6('0x10')]);return _0x1709ba(_0x338bd8[_0x88c6('0xf')]['message']);}else{logger[_0x88c6('0xb')](_0x88c6('0x11'),_0x1bcb53,_0x88c6('0xc'));_0x1709ba(_0x338bd8[_0x88c6('0x12')][_0x88c6('0x10')]);}})['catch'](function(_0x2841b2){logger['error'](_0x88c6('0x11'),_0x1bcb53,_0x2841b2);_0x2fc2ca(_0x2841b2);});});}exports[_0x88c6('0x13')]=function(_0x46bbf3){var _0x37716b=this;return new Promise(function(_0x2ef848,_0x26eed8){return db[_0x88c6('0x14')]['findAll']({'raw':_0x46bbf3[_0x88c6('0x15')]?_0x46bbf3[_0x88c6('0x15')][_0x88c6('0x16')]===undefined?!![]:![]:!![],'where':_0x46bbf3['options']?_0x46bbf3[_0x88c6('0x15')][_0x88c6('0x17')]||null:null,'attributes':_0x46bbf3[_0x88c6('0x15')]?_0x46bbf3['options']['attributes']||null:null,'limit':_0x46bbf3[_0x88c6('0x15')]?_0x46bbf3[_0x88c6('0x15')][_0x88c6('0x18')]||null:null,'include':_0x46bbf3[_0x88c6('0x15')]?_0x46bbf3[_0x88c6('0x15')][_0x88c6('0x19')]?_[_0x88c6('0x1a')](_0x46bbf3['options'][_0x88c6('0x19')],function(_0x50f51d){return{'model':db[_0x50f51d[_0x88c6('0x1b')]],'as':_0x50f51d['as'],'attributes':_0x50f51d[_0x88c6('0x1c')],'include':_0x50f51d[_0x88c6('0x19')]?_['map'](_0x50f51d[_0x88c6('0x19')],function(_0x5c5fd0){return{'model':db[_0x5c5fd0['model']],'as':_0x5c5fd0['as'],'attributes':_0x5c5fd0[_0x88c6('0x1c')],'include':_0x5c5fd0[_0x88c6('0x19')]?_['map'](_0x5c5fd0[_0x88c6('0x19')],function(_0x5ecc77){return{'model':db[_0x5ecc77[_0x88c6('0x1b')]],'as':_0x5ecc77['as'],'attributes':_0x5ecc77[_0x88c6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x186a5e){logger['info'](_0x88c6('0x13'),_0x46bbf3);logger['debug'](_0x88c6('0x13'),_0x46bbf3,JSON[_0x88c6('0xe')](_0x186a5e));_0x2ef848(_0x186a5e);})[_0x88c6('0x1d')](function(_0x1c869d){logger['error'](_0x88c6('0x13'),_0x1c869d[_0x88c6('0x10')],_0x46bbf3);_0x26eed8(_0x37716b['error'](0x1f4,_0x1c869d[_0x88c6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index eb51abc..4fda18c 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 _0x556f=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x4eb4cd,_0x286f3b){var _0x24872c=function(_0x2b8c11){while(--_0x2b8c11){_0x4eb4cd['push'](_0x4eb4cd['shift']());}};_0x24872c(++_0x286f3b);}(_0x556f,0xe8));var _0xf556=function(_0x4aa76c,_0x343513){_0x4aa76c=_0x4aa76c-0x0;var _0x2c6648=_0x556f[_0x4aa76c];return _0x2c6648;};'use strict';var multer=require(_0xf556('0x0'));var util=require(_0xf556('0x1'));var path=require(_0xf556('0x2'));var timeout=require(_0xf556('0x3'));var express=require(_0xf556('0x4'));var router=express[_0xf556('0x5')]();var auth=require(_0xf556('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf556('0x7'));var controller=require('./mailServerOut.controller');router['get']('/',auth[_0xf556('0x8')](),controller[_0xf556('0x9')]);router[_0xf556('0xa')](_0xf556('0xb'),auth[_0xf556('0x8')](),controller[_0xf556('0xc')]);router['post']('/',auth[_0xf556('0x8')](),controller[_0xf556('0xd')]);router[_0xf556('0xe')]('/:id',auth[_0xf556('0x8')](),controller[_0xf556('0xf')]);router[_0xf556('0x10')](_0xf556('0xb'),auth[_0xf556('0x8')](),controller[_0xf556('0x11')]);module[_0xf556('0x12')]=router; \ No newline at end of file +var _0x9b93=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete'];(function(_0x1ca993,_0x243c1e){var _0x150e5e=function(_0xaf1a3e){while(--_0xaf1a3e){_0x1ca993['push'](_0x1ca993['shift']());}};_0x150e5e(++_0x243c1e);}(_0x9b93,0x1b7));var _0x39b9=function(_0x37ae2e,_0x35be3a){_0x37ae2e=_0x37ae2e-0x0;var _0x19c50f=_0x9b93[_0x37ae2e];return _0x19c50f;};'use strict';var multer=require(_0x39b9('0x0'));var util=require(_0x39b9('0x1'));var path=require(_0x39b9('0x2'));var timeout=require(_0x39b9('0x3'));var express=require(_0x39b9('0x4'));var router=express[_0x39b9('0x5')]();var auth=require(_0x39b9('0x6'));var interaction=require(_0x39b9('0x7'));var config=require(_0x39b9('0x8'));var controller=require('./mailServerOut.controller');router[_0x39b9('0x9')]('/',auth[_0x39b9('0xa')](),controller['index']);router['get'](_0x39b9('0xb'),auth[_0x39b9('0xa')](),controller[_0x39b9('0xc')]);router[_0x39b9('0xd')]('/',auth[_0x39b9('0xa')](),controller[_0x39b9('0xe')]);router['put'](_0x39b9('0xb'),auth[_0x39b9('0xa')](),controller[_0x39b9('0xf')]);router[_0x39b9('0x10')](_0x39b9('0xb'),auth[_0x39b9('0xa')](),controller[_0x39b9('0x11')]);module[_0x39b9('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 3af2c3a..5e5dc9f 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 _0xc9ab=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0xc9ab,0x125));var _0xbc9a=function(_0x23d7e7,_0x471b25){_0x23d7e7=_0x23d7e7-0x0;var _0x17ef3e=_0xc9ab[_0x23d7e7];return _0x17ef3e;};'use strict';var Sequelize=require(_0xbc9a('0x0'));module[_0xbc9a('0x1')]={'description':{'type':Sequelize[_0xbc9a('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xbc9a('0x3')]},'secure':{'type':Sequelize[_0xbc9a('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xbc9a('0x2')]},'authentication':{'type':Sequelize[_0xbc9a('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1115=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1115,0x1b6));var _0x5111=function(_0x548d25,_0x3a7b13){_0x548d25=_0x548d25-0x0;var _0x305d96=_0x1115[_0x548d25];return _0x305d96;};'use strict';var Sequelize=require('sequelize');module[_0x5111('0x0')]={'description':{'type':Sequelize[_0x5111('0x1')]},'host':{'type':Sequelize[_0x5111('0x1')]},'user':{'type':Sequelize[_0x5111('0x1')]},'pass':{'type':Sequelize[_0x5111('0x1')]},'port':{'type':Sequelize[_0x5111('0x2')]},'secure':{'type':Sequelize[_0x5111('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5111('0x1')]},'authentication':{'type':Sequelize[_0x5111('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 9f652f4..0b548f2 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 _0x18c2=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','MailServerOut','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','catch','params','rawAttributes','include','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x18c2,0xcf));var _0x218c=function(_0x4d1eaa,_0xe950af){_0x4d1eaa=_0x4d1eaa-0x0;var _0x48445f=_0x18c2[_0x4d1eaa];return _0x48445f;};'use strict';var pdf=require(_0x218c('0x0'));var emlformat=require(_0x218c('0x1'));var rimraf=require(_0x218c('0x2'));var zipdir=require(_0x218c('0x3'));var jsonpatch=require(_0x218c('0x4'));var rp=require('request-promise');var moment=require(_0x218c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x218c('0x6'));var util=require(_0x218c('0x7'));var path=require(_0x218c('0x8'));var sox=require(_0x218c('0x9'));var csv=require('to-csv');var ejs=require(_0x218c('0xa'));var fs=require('fs');var _=require(_0x218c('0xb'));var squel=require(_0x218c('0xc'));var crypto=require(_0x218c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x218c('0xe'));var toCsv=require(_0x218c('0xf'));var querystring=require(_0x218c('0x10'));var Papa=require(_0x218c('0x11'));var Redis=require(_0x218c('0x12'));var authService=require(_0x218c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x218c('0x14'));var hardwareService=require(_0x218c('0x15'));var logger=require('../../config/logger')(_0x218c('0x16'));var utils=require(_0x218c('0x17'));var config=require(_0x218c('0x18'));var db=require(_0x218c('0x19'))['db'];function respondWithStatusCode(_0x21fd03,_0x2c0f8b){_0x2c0f8b=_0x2c0f8b||0xcc;return function(_0x8ea109){if(_0x8ea109){return _0x21fd03[_0x218c('0x1a')](_0x2c0f8b);}return _0x21fd03[_0x218c('0x1b')](_0x2c0f8b)[_0x218c('0x1c')]();};}function respondWithResult(_0x4e5eee,_0xae5311){_0xae5311=_0xae5311||0xc8;return function(_0x1585bf){if(_0x1585bf){return _0x4e5eee['status'](_0xae5311)[_0x218c('0x1d')](_0x1585bf);}};}function respondWithFilteredResult(_0x3de467,_0x4100db){return function(_0x437385){if(_0x437385){var _0x3536c2=_0x437385[_0x218c('0x1e')],_0x406067=_0x4100db[_0x218c('0x1f')],_0x3a8821=_0x4100db[_0x218c('0x1f')]+_0x4100db['limit'],_0x2c2c47;if(_0x3a8821>=_0x3536c2){_0x3a8821=_0x3536c2;_0x2c2c47=0xc8;}else{_0x2c2c47=0xce;}_0x3de467[_0x218c('0x1b')](_0x2c2c47);return _0x3de467[_0x218c('0x20')](_0x218c('0x21'),_0x406067+'-'+_0x3a8821+'/'+_0x3536c2)['json'](_0x437385);}return null;};}function patchUpdates(_0x488d47){return function(_0x4e675c){try{jsonpatch[_0x218c('0x22')](_0x4e675c,_0x488d47,!![]);}catch(_0x11e2e8){return BPromise['reject'](_0x11e2e8);}return _0x4e675c[_0x218c('0x23')]();};}function saveUpdates(_0x84bb65,_0x7ef69a){return function(_0x3d04ff){if(_0x3d04ff){return _0x3d04ff['update'](_0x84bb65)[_0x218c('0x24')](function(_0x391786){return _0x391786;});}return null;};}function removeEntity(_0xb79471,_0x2400e8){return function(_0x185ba3){if(_0x185ba3){return _0x185ba3[_0x218c('0x25')]()[_0x218c('0x24')](function(){_0xb79471[_0x218c('0x1b')](0xcc)[_0x218c('0x1c')]();});}};}function handleEntityNotFound(_0x273d63,_0x5df1ec){return function(_0x31cb3e){if(!_0x31cb3e){_0x273d63[_0x218c('0x1a')](0x194);}return _0x31cb3e;};}function handleError(_0x8da745,_0x4ab42f){_0x4ab42f=_0x4ab42f||0x1f4;return function(_0x266dcc){logger[_0x218c('0x26')](_0x266dcc[_0x218c('0x27')]);if(_0x266dcc[_0x218c('0x28')]){delete _0x266dcc[_0x218c('0x28')];}_0x8da745[_0x218c('0x1b')](_0x4ab42f)['send'](_0x266dcc);};}exports[_0x218c('0x29')]=function(_0x3cd202,_0x26f064){var _0x5073e7={},_0x1f6bb7={},_0x472c94={'count':0x0,'rows':[]};var _0x14b70c=_[_0x218c('0x2a')](db[_0x218c('0x2b')]['rawAttributes'],function(_0x2350ce){return{'name':_0x2350ce[_0x218c('0x2c')],'type':_0x2350ce['type'][_0x218c('0x2d')]};});_0x1f6bb7['model']=_[_0x218c('0x2a')](_0x14b70c,_0x218c('0x28'));_0x1f6bb7['query']=_[_0x218c('0x2e')](_0x3cd202[_0x218c('0x2f')]);_0x1f6bb7[_0x218c('0x30')]=_[_0x218c('0x31')](_0x1f6bb7[_0x218c('0x32')],_0x1f6bb7[_0x218c('0x2f')]);_0x5073e7['attributes']=_['intersection'](_0x1f6bb7[_0x218c('0x32')],qs[_0x218c('0x33')](_0x3cd202[_0x218c('0x2f')][_0x218c('0x33')]));_0x5073e7['attributes']=_0x5073e7[_0x218c('0x34')][_0x218c('0x35')]?_0x5073e7[_0x218c('0x34')]:_0x1f6bb7['model'];if(!_0x3cd202[_0x218c('0x2f')][_0x218c('0x36')]('nolimit')){_0x5073e7[_0x218c('0x37')]=qs['limit'](_0x3cd202[_0x218c('0x2f')][_0x218c('0x37')]);_0x5073e7[_0x218c('0x1f')]=qs[_0x218c('0x1f')](_0x3cd202[_0x218c('0x2f')][_0x218c('0x1f')]);}_0x5073e7[_0x218c('0x38')]=qs[_0x218c('0x39')](_0x3cd202[_0x218c('0x2f')][_0x218c('0x39')]);_0x5073e7[_0x218c('0x3a')]=qs[_0x218c('0x30')](_[_0x218c('0x3b')](_0x3cd202[_0x218c('0x2f')],_0x1f6bb7[_0x218c('0x30')]),_0x14b70c);if(_0x3cd202[_0x218c('0x2f')]['filter']){_0x5073e7[_0x218c('0x3a')]=_['merge'](_0x5073e7['where'],{'$or':_[_0x218c('0x2a')](_0x14b70c,function(_0x5e0d7f){if(_0x5e0d7f[_0x218c('0x3c')]!==_0x218c('0x3d')){var _0xa179a={};_0xa179a[_0x5e0d7f['name']]={'$like':'%'+_0x3cd202[_0x218c('0x2f')][_0x218c('0x3e')]+'%'};return _0xa179a;}})});}_0x5073e7=_[_0x218c('0x3f')]({},_0x5073e7,_0x3cd202[_0x218c('0x40')]);var _0x369b66={'where':_0x5073e7['where']};return db[_0x218c('0x2b')][_0x218c('0x1e')](_0x369b66)[_0x218c('0x24')](function(_0x63413f){_0x472c94['count']=_0x63413f;if(_0x3cd202[_0x218c('0x2f')][_0x218c('0x41')]){_0x5073e7['include']=[{'all':!![]}];}return db[_0x218c('0x2b')]['findAll'](_0x5073e7);})[_0x218c('0x24')](function(_0x2620cf){_0x472c94['rows']=_0x2620cf;return _0x472c94;})['then'](respondWithFilteredResult(_0x26f064,_0x5073e7))[_0x218c('0x42')](handleError(_0x26f064,null));};exports['show']=function(_0x217532,_0x34e4e3){var _0x1bb361={'raw':!![],'where':{'id':_0x217532[_0x218c('0x43')]['id']}},_0x2d2806={};_0x2d2806[_0x218c('0x32')]=_[_0x218c('0x2e')](db[_0x218c('0x2b')][_0x218c('0x44')]);_0x2d2806[_0x218c('0x2f')]=_[_0x218c('0x2e')](_0x217532[_0x218c('0x2f')]);_0x2d2806[_0x218c('0x30')]=_[_0x218c('0x31')](_0x2d2806['model'],_0x2d2806[_0x218c('0x2f')]);_0x1bb361[_0x218c('0x34')]=_['intersection'](_0x2d2806[_0x218c('0x32')],qs[_0x218c('0x33')](_0x217532[_0x218c('0x2f')]['fields']));_0x1bb361[_0x218c('0x34')]=_0x1bb361[_0x218c('0x34')][_0x218c('0x35')]?_0x1bb361['attributes']:_0x2d2806['model'];if(_0x217532[_0x218c('0x2f')]['includeAll']){_0x1bb361[_0x218c('0x45')]=[{'all':!![]}];}_0x1bb361=_[_0x218c('0x3f')]({},_0x1bb361,_0x217532['options']);return db[_0x218c('0x2b')][_0x218c('0x46')](_0x1bb361)['then'](handleEntityNotFound(_0x34e4e3,null))[_0x218c('0x24')](respondWithResult(_0x34e4e3,null))[_0x218c('0x42')](handleError(_0x34e4e3,null));};exports[_0x218c('0x47')]=function(_0x3a1c6b,_0x54f6f9){return db[_0x218c('0x2b')][_0x218c('0x47')](_0x3a1c6b['body'],{})[_0x218c('0x24')](respondWithResult(_0x54f6f9,0xc9))[_0x218c('0x42')](handleError(_0x54f6f9,null));};exports[_0x218c('0x48')]=function(_0x2e6e3c,_0xb10361){if(_0x2e6e3c[_0x218c('0x49')]['id']){delete _0x2e6e3c[_0x218c('0x49')]['id'];}return db['MailServerOut'][_0x218c('0x46')]({'where':{'id':_0x2e6e3c[_0x218c('0x43')]['id']}})[_0x218c('0x24')](handleEntityNotFound(_0xb10361,null))[_0x218c('0x24')](saveUpdates(_0x2e6e3c[_0x218c('0x49')],null))[_0x218c('0x24')](respondWithResult(_0xb10361,null))[_0x218c('0x42')](handleError(_0xb10361,null));};exports[_0x218c('0x25')]=function(_0x1b87b2,_0x4f2ec0){return db[_0x218c('0x2b')][_0x218c('0x46')]({'where':{'id':_0x1b87b2['params']['id']}})[_0x218c('0x24')](handleEntityNotFound(_0x4f2ec0,null))[_0x218c('0x24')](removeEntity(_0x4f2ec0,null))[_0x218c('0x42')](handleError(_0x4f2ec0,null));}; \ No newline at end of file +var _0x73d3=['model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','length','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','name','index','map','MailServerOut','rawAttributes','type','key'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x73d3,0x15f));var _0x373d=function(_0x1e07bc,_0xef9a37){_0x1e07bc=_0x1e07bc-0x0;var _0xa2f36=_0x73d3[_0x1e07bc];return _0xa2f36;};'use strict';var pdf=require(_0x373d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x373d('0x1'));var zipdir=require(_0x373d('0x2'));var jsonpatch=require(_0x373d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x373d('0x4'));var Mustache=require(_0x373d('0x5'));var util=require('util');var path=require(_0x373d('0x6'));var sox=require('sox');var csv=require(_0x373d('0x7'));var ejs=require(_0x373d('0x8'));var fs=require('fs');var _=require(_0x373d('0x9'));var squel=require(_0x373d('0xa'));var crypto=require('crypto');var jsforce=require(_0x373d('0xb'));var deskjs=require(_0x373d('0xc'));var toCsv=require(_0x373d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x373d('0xd'));var authService=require(_0x373d('0xe'));var qs=require(_0x373d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x373d('0x10'));var utils=require('../../config/utils');var config=require(_0x373d('0x11'));var db=require(_0x373d('0x12'))['db'];function respondWithStatusCode(_0x35f76b,_0x1cf372){_0x1cf372=_0x1cf372||0xcc;return function(_0x336924){if(_0x336924){return _0x35f76b[_0x373d('0x13')](_0x1cf372);}return _0x35f76b[_0x373d('0x14')](_0x1cf372)[_0x373d('0x15')]();};}function respondWithResult(_0x6db4f8,_0x565b96){_0x565b96=_0x565b96||0xc8;return function(_0x160a46){if(_0x160a46){return _0x6db4f8['status'](_0x565b96)[_0x373d('0x16')](_0x160a46);}};}function respondWithFilteredResult(_0x5939b0,_0x39e7a1){return function(_0x34b55e){if(_0x34b55e){var _0x25b506=_0x34b55e[_0x373d('0x17')],_0x32985c=_0x39e7a1[_0x373d('0x18')],_0x43c6ec=_0x39e7a1[_0x373d('0x18')]+_0x39e7a1[_0x373d('0x19')],_0x5430a3;if(_0x43c6ec>=_0x25b506){_0x43c6ec=_0x25b506;_0x5430a3=0xc8;}else{_0x5430a3=0xce;}_0x5939b0[_0x373d('0x14')](_0x5430a3);return _0x5939b0[_0x373d('0x1a')]('Content-Range',_0x32985c+'-'+_0x43c6ec+'/'+_0x25b506)[_0x373d('0x16')](_0x34b55e);}return null;};}function patchUpdates(_0x4913a5){return function(_0x560edb){try{jsonpatch['apply'](_0x560edb,_0x4913a5,!![]);}catch(_0x28f032){return BPromise[_0x373d('0x1b')](_0x28f032);}return _0x560edb[_0x373d('0x1c')]();};}function saveUpdates(_0x25e42e,_0x116bb8){return function(_0x5f2808){if(_0x5f2808){return _0x5f2808[_0x373d('0x1d')](_0x25e42e)[_0x373d('0x1e')](function(_0x5e1540){return _0x5e1540;});}return null;};}function removeEntity(_0x92a657,_0x81b3f3){return function(_0x4d3cb3){if(_0x4d3cb3){return _0x4d3cb3[_0x373d('0x1f')]()['then'](function(){_0x92a657[_0x373d('0x14')](0xcc)[_0x373d('0x15')]();});}};}function handleEntityNotFound(_0x6f2d04,_0x2e801f){return function(_0x387884){if(!_0x387884){_0x6f2d04[_0x373d('0x13')](0x194);}return _0x387884;};}function handleError(_0xe8d193,_0x1892b9){_0x1892b9=_0x1892b9||0x1f4;return function(_0x2eaa60){logger['error'](_0x2eaa60['stack']);if(_0x2eaa60[_0x373d('0x20')]){delete _0x2eaa60[_0x373d('0x20')];}_0xe8d193[_0x373d('0x14')](_0x1892b9)['send'](_0x2eaa60);};}exports[_0x373d('0x21')]=function(_0x235019,_0x31c228){var _0x4a1921={},_0x5750de={},_0x43d55f={'count':0x0,'rows':[]};var _0x1dd5f4=_[_0x373d('0x22')](db[_0x373d('0x23')][_0x373d('0x24')],function(_0x12437e){return{'name':_0x12437e['fieldName'],'type':_0x12437e[_0x373d('0x25')][_0x373d('0x26')]};});_0x5750de[_0x373d('0x27')]=_['map'](_0x1dd5f4,_0x373d('0x20'));_0x5750de[_0x373d('0x28')]=_[_0x373d('0x29')](_0x235019[_0x373d('0x28')]);_0x5750de[_0x373d('0x2a')]=_['intersection'](_0x5750de['model'],_0x5750de[_0x373d('0x28')]);_0x4a1921[_0x373d('0x2b')]=_[_0x373d('0x2c')](_0x5750de[_0x373d('0x27')],qs[_0x373d('0x2d')](_0x235019[_0x373d('0x28')][_0x373d('0x2d')]));_0x4a1921[_0x373d('0x2b')]=_0x4a1921['attributes']['length']?_0x4a1921['attributes']:_0x5750de[_0x373d('0x27')];if(!_0x235019[_0x373d('0x28')][_0x373d('0x2e')](_0x373d('0x2f'))){_0x4a1921[_0x373d('0x19')]=qs['limit'](_0x235019[_0x373d('0x28')][_0x373d('0x19')]);_0x4a1921[_0x373d('0x18')]=qs[_0x373d('0x18')](_0x235019[_0x373d('0x28')][_0x373d('0x18')]);}_0x4a1921['order']=qs[_0x373d('0x30')](_0x235019[_0x373d('0x28')][_0x373d('0x30')]);_0x4a1921['where']=qs['filters'](_[_0x373d('0x31')](_0x235019[_0x373d('0x28')],_0x5750de[_0x373d('0x2a')]),_0x1dd5f4);if(_0x235019['query']['filter']){_0x4a1921[_0x373d('0x32')]=_[_0x373d('0x33')](_0x4a1921['where'],{'$or':_[_0x373d('0x22')](_0x1dd5f4,function(_0x242dab){if(_0x242dab[_0x373d('0x25')]!==_0x373d('0x34')){var _0x13946d={};_0x13946d[_0x242dab[_0x373d('0x20')]]={'$like':'%'+_0x235019['query'][_0x373d('0x35')]+'%'};return _0x13946d;}})});}_0x4a1921=_[_0x373d('0x33')]({},_0x4a1921,_0x235019['options']);var _0x3aee87={'where':_0x4a1921[_0x373d('0x32')]};return db['MailServerOut'][_0x373d('0x17')](_0x3aee87)[_0x373d('0x1e')](function(_0x19fc92){_0x43d55f['count']=_0x19fc92;if(_0x235019[_0x373d('0x28')][_0x373d('0x36')]){_0x4a1921[_0x373d('0x37')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x4a1921);})[_0x373d('0x1e')](function(_0x46e1ea){_0x43d55f[_0x373d('0x38')]=_0x46e1ea;return _0x43d55f;})[_0x373d('0x1e')](respondWithFilteredResult(_0x31c228,_0x4a1921))[_0x373d('0x39')](handleError(_0x31c228,null));};exports[_0x373d('0x3a')]=function(_0x1d26bc,_0x3ad273){var _0x166de4={'raw':!![],'where':{'id':_0x1d26bc[_0x373d('0x3b')]['id']}},_0x48956c={};_0x48956c[_0x373d('0x27')]=_[_0x373d('0x29')](db[_0x373d('0x23')][_0x373d('0x24')]);_0x48956c[_0x373d('0x28')]=_['keys'](_0x1d26bc[_0x373d('0x28')]);_0x48956c[_0x373d('0x2a')]=_['intersection'](_0x48956c['model'],_0x48956c['query']);_0x166de4[_0x373d('0x2b')]=_[_0x373d('0x2c')](_0x48956c[_0x373d('0x27')],qs[_0x373d('0x2d')](_0x1d26bc['query']['fields']));_0x166de4['attributes']=_0x166de4[_0x373d('0x2b')][_0x373d('0x3c')]?_0x166de4['attributes']:_0x48956c['model'];if(_0x1d26bc[_0x373d('0x28')][_0x373d('0x36')]){_0x166de4[_0x373d('0x37')]=[{'all':!![]}];}_0x166de4=_[_0x373d('0x33')]({},_0x166de4,_0x1d26bc[_0x373d('0x3d')]);return db[_0x373d('0x23')][_0x373d('0x3e')](_0x166de4)[_0x373d('0x1e')](handleEntityNotFound(_0x3ad273,null))[_0x373d('0x1e')](respondWithResult(_0x3ad273,null))['catch'](handleError(_0x3ad273,null));};exports[_0x373d('0x3f')]=function(_0x506c74,_0x3e5064){return db[_0x373d('0x23')]['create'](_0x506c74[_0x373d('0x40')],{})[_0x373d('0x1e')](respondWithResult(_0x3e5064,0xc9))['catch'](handleError(_0x3e5064,null));};exports['update']=function(_0x52af7a,_0x4f71b0){if(_0x52af7a['body']['id']){delete _0x52af7a['body']['id'];}return db[_0x373d('0x23')][_0x373d('0x3e')]({'where':{'id':_0x52af7a[_0x373d('0x3b')]['id']}})[_0x373d('0x1e')](handleEntityNotFound(_0x4f71b0,null))[_0x373d('0x1e')](saveUpdates(_0x52af7a['body'],null))['then'](respondWithResult(_0x4f71b0,null))['catch'](handleError(_0x4f71b0,null));};exports[_0x373d('0x1f')]=function(_0xb76532,_0x309da9){return db[_0x373d('0x23')][_0x373d('0x3e')]({'where':{'id':_0xb76532[_0x373d('0x3b')]['id']}})['then'](handleEntityNotFound(_0x309da9,null))[_0x373d('0x1e')](removeEntity(_0x309da9,null))[_0x373d('0x39')](handleError(_0x309da9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 39a801d..85b8a21 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 _0x3f8a=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x51d061,_0x66d35){var _0x18e0ed=function(_0x2cef15){while(--_0x2cef15){_0x51d061['push'](_0x51d061['shift']());}};_0x18e0ed(++_0x66d35);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x4d91f8,_0x5874ec){_0x4d91f8=_0x4d91f8-0x0;var _0x4c346c=_0x3f8a[_0x4d91f8];return _0x4c346c;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'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(_0x4648ff,_0x582172){var _0x26070b=function(_0x370de5){while(--_0x370de5){_0x4648ff['push'](_0x4648ff['shift']());}};_0x26070b(++_0x582172);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x197c6d,_0x191831){_0x197c6d=_0x197c6d-0x0;var _0x4a6bcc=_0xdbf5[_0x197c6d];return _0x4a6bcc;};'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 9647f2c..dc5836b 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 _0xc7a1=['client','request','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x7f3e32,_0x598c04){var _0x261c77=function(_0x4e158a){while(--_0x4e158a){_0x7f3e32['push'](_0x7f3e32['shift']());}};_0x261c77(++_0x598c04);}(_0xc7a1,0x97));var _0x1c7a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc7a1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1c7a('0x0'));var util=require(_0x1c7a('0x1'));var moment=require(_0x1c7a('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c7a('0x3'));var fs=require('fs');var Redis=require(_0x1c7a('0x4'));var db=require(_0x1c7a('0x5'))['db'];var utils=require(_0x1c7a('0x6'));var logger=require(_0x1c7a('0x7'))('rpc');var config=require(_0x1c7a('0x8'));var jayson=require(_0x1c7a('0x9'));var client=jayson[_0x1c7a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9fb186,_0x56c7f4,_0xc5aac6){return new BPromise(function(_0x165a32,_0x174e77){return client[_0x1c7a('0xb')](_0x9fb186,_0xc5aac6)['then'](function(_0xd5c483){logger[_0x1c7a('0xc')](_0x1c7a('0xd'),_0x56c7f4,_0x1c7a('0xe'));logger[_0x1c7a('0xf')](_0x1c7a('0x10'),_0x56c7f4,'request\x20sent',JSON[_0x1c7a('0x11')](_0xd5c483));if(_0xd5c483['error']){if(_0xd5c483[_0x1c7a('0x12')][_0x1c7a('0x13')]===0x1f4){logger['error'](_0x1c7a('0xd'),_0x56c7f4,_0xd5c483['error']['message']);return _0x174e77(_0xd5c483['error'][_0x1c7a('0x14')]);}logger['error'](_0x1c7a('0xd'),_0x56c7f4,_0xd5c483[_0x1c7a('0x12')][_0x1c7a('0x14')]);return _0x165a32(_0xd5c483[_0x1c7a('0x12')]['message']);}else{logger[_0x1c7a('0xc')](_0x1c7a('0xd'),_0x56c7f4,_0x1c7a('0xe'));_0x165a32(_0xd5c483[_0x1c7a('0x15')][_0x1c7a('0x14')]);}})[_0x1c7a('0x16')](function(_0x24b38e){logger['error'](_0x1c7a('0xd'),_0x56c7f4,_0x24b38e);_0x174e77(_0x24b38e);});});} \ No newline at end of file +var _0x012a=['stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s'];(function(_0x20bd5a,_0x5754ef){var _0x15de57=function(_0x517de6){while(--_0x517de6){_0x20bd5a['push'](_0x20bd5a['shift']());}};_0x15de57(++_0x5754ef);}(_0x012a,0xbd));var _0xa012=function(_0x5243a5,_0x23bc67){_0x5243a5=_0x5243a5-0x0;var _0x33ef51=_0x012a[_0x5243a5];return _0x33ef51;};'use strict';var _=require(_0xa012('0x0'));var util=require('util');var moment=require(_0xa012('0x1'));var BPromise=require(_0xa012('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa012('0x3'));var db=require(_0xa012('0x4'))['db'];var utils=require(_0xa012('0x5'));var logger=require(_0xa012('0x6'))('rpc');var config=require(_0xa012('0x7'));var jayson=require(_0xa012('0x8'));var client=jayson[_0xa012('0x9')][_0xa012('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x321b4f,_0x248b05,_0x41945f){return new BPromise(function(_0x3c5de4,_0x1a41a7){return client[_0xa012('0xb')](_0x321b4f,_0x41945f)[_0xa012('0xc')](function(_0x35231c){logger[_0xa012('0xd')](_0xa012('0xe'),_0x248b05,_0xa012('0xf'));logger[_0xa012('0x10')](_0xa012('0x11'),_0x248b05,_0xa012('0xf'),JSON[_0xa012('0x12')](_0x35231c));if(_0x35231c[_0xa012('0x13')]){if(_0x35231c[_0xa012('0x13')]['code']===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x248b05,_0x35231c[_0xa012('0x13')]['message']);return _0x1a41a7(_0x35231c[_0xa012('0x13')]['message']);}logger[_0xa012('0x13')]('MailServerOut,\x20%s,\x20%s',_0x248b05,_0x35231c[_0xa012('0x13')][_0xa012('0x14')]);return _0x3c5de4(_0x35231c[_0xa012('0x13')][_0xa012('0x14')]);}else{logger[_0xa012('0xd')](_0xa012('0xe'),_0x248b05,_0xa012('0xf'));_0x3c5de4(_0x35231c[_0xa012('0x15')][_0xa012('0x14')]);}})[_0xa012('0x16')](function(_0x4c6d15){logger[_0xa012('0x13')]('MailServerOut,\x20%s,\x20%s',_0x248b05,_0x4c6d15);_0x1a41a7(_0x4c6d15);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a0aabcc..8ea416f 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 _0x102a=['put','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x4b7175,_0x2c2dd6){var _0x3eeb4b=function(_0x1d6daa){while(--_0x1d6daa){_0x4b7175['push'](_0x4b7175['shift']());}};_0x3eeb4b(++_0x2c2dd6);}(_0x102a,0xae));var _0xa102=function(_0x508e09,_0x5ba8a2){_0x508e09=_0x508e09-0x0;var _0x3d5387=_0x102a[_0x508e09];return _0x3d5387;};'use strict';var multer=require(_0xa102('0x0'));var util=require(_0xa102('0x1'));var path=require('path');var timeout=require(_0xa102('0x2'));var express=require('express');var router=express[_0xa102('0x3')]();var auth=require(_0xa102('0x4'));var interaction=require(_0xa102('0x5'));var config=require(_0xa102('0x6'));var controller=require(_0xa102('0x7'));router[_0xa102('0x8')]('/',auth[_0xa102('0x9')](),controller['index']);router[_0xa102('0x8')](_0xa102('0xa'),auth[_0xa102('0x9')](),controller[_0xa102('0xb')]);router[_0xa102('0x8')](_0xa102('0xc'),auth['isAuthenticated'](),controller[_0xa102('0xd')]);router[_0xa102('0xe')]('/',auth['isAuthenticated'](),controller[_0xa102('0xf')]);router[_0xa102('0x10')](_0xa102('0xc'),auth[_0xa102('0x9')](),controller[_0xa102('0x11')]);router[_0xa102('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8eb=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','get','describe','/:id','post','create','put','delete','util'];(function(_0x811a2,_0x5b7bba){var _0x5a85c0=function(_0x5b6a6f){while(--_0x5b6a6f){_0x811a2['push'](_0x811a2['shift']());}};_0x5a85c0(++_0x5b7bba);}(_0xd8eb,0xef));var _0xbd8e=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0xd8eb[_0x52e363];return _0x3fc2b5;};'use strict';var multer=require('multer');var util=require(_0xbd8e('0x0'));var path=require(_0xbd8e('0x1'));var timeout=require(_0xbd8e('0x2'));var express=require(_0xbd8e('0x3'));var router=express[_0xbd8e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbd8e('0x5'));var config=require(_0xbd8e('0x6'));var controller=require(_0xbd8e('0x7'));router['get']('/',auth[_0xbd8e('0x8')](),controller['index']);router[_0xbd8e('0x9')]('/describe',auth[_0xbd8e('0x8')](),controller[_0xbd8e('0xa')]);router[_0xbd8e('0x9')](_0xbd8e('0xb'),auth[_0xbd8e('0x8')](),controller['show']);router[_0xbd8e('0xc')]('/',auth[_0xbd8e('0x8')](),controller[_0xbd8e('0xd')]);router[_0xbd8e('0xe')](_0xbd8e('0xb'),auth[_0xbd8e('0x8')](),controller['update']);router[_0xbd8e('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 85a4f22..c027377 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 _0x7031=['name','STRING','sequelize','exports'];(function(_0x55e733,_0x2d38ee){var _0x5aa7d8=function(_0xba8609){while(--_0xba8609){_0x55e733['push'](_0x55e733['shift']());}};_0x5aa7d8(++_0x2d38ee);}(_0x7031,0x19a));var _0x1703=function(_0x309eb5,_0x36c7cf){_0x309eb5=_0x309eb5-0x0;var _0x1fa11e=_0x7031[_0x309eb5];return _0x1fa11e;};'use strict';var Sequelize=require(_0x1703('0x0'));module[_0x1703('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1703('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1703('0x3')]}}; \ No newline at end of file +var _0x6afc=['STRING','sequelize'];(function(_0x1abebf,_0x45f199){var _0x27b4fd=function(_0x60ae9b){while(--_0x60ae9b){_0x1abebf['push'](_0x1abebf['shift']());}};_0x27b4fd(++_0x45f199);}(_0x6afc,0x16b));var _0xc6af=function(_0x569489,_0x169c9f){_0x569489=_0x569489-0x0;var _0x5a79a9=_0x6afc[_0x569489];return _0x5a79a9;};'use strict';var Sequelize=require(_0xc6af('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6af('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc6af('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index cd04cd1..6da5e7f 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 _0x31db=['../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','count','includeAll','show','params','keys','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x51ab4f,_0x32f508){var _0xc004ae=function(_0x4d177b){while(--_0x4d177b){_0x51ab4f['push'](_0x51ab4f['shift']());}};_0xc004ae(++_0x32f508);}(_0x31db,0xbb));var _0xb31d=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0x31db[_0x2dc96f];return _0xd012da;};'use strict';var pdf=require(_0xb31d('0x0'));var emlformat=require(_0xb31d('0x1'));var rimraf=require(_0xb31d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb31d('0x3'));var rp=require(_0xb31d('0x4'));var moment=require(_0xb31d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb31d('0x6'));var util=require('util');var path=require(_0xb31d('0x7'));var sox=require('sox');var csv=require(_0xb31d('0x8'));var ejs=require(_0xb31d('0x9'));var fs=require('fs');var _=require(_0xb31d('0xa'));var squel=require(_0xb31d('0xb'));var crypto=require('crypto');var jsforce=require(_0xb31d('0xc'));var deskjs=require(_0xb31d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb31d('0xe'));var Papa=require(_0xb31d('0xf'));var Redis=require('ioredis');var authService=require(_0xb31d('0x10'));var qs=require(_0xb31d('0x11'));var as=require(_0xb31d('0x12'));var hardwareService=require(_0xb31d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb31d('0x14'));var config=require(_0xb31d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4190a8,_0x3090cc){_0x3090cc=_0x3090cc||0xcc;return function(_0x4affb3){if(_0x4affb3){return _0x4190a8[_0xb31d('0x16')](_0x3090cc);}return _0x4190a8[_0xb31d('0x17')](_0x3090cc)[_0xb31d('0x18')]();};}function respondWithResult(_0x1074c6,_0x29688b){_0x29688b=_0x29688b||0xc8;return function(_0x513807){if(_0x513807){return _0x1074c6['status'](_0x29688b)[_0xb31d('0x19')](_0x513807);}};}function respondWithFilteredResult(_0x5bf563,_0x25bf39){return function(_0x40f4d8){if(_0x40f4d8){var _0x2718c4=_0x40f4d8['count'],_0x38f853=_0x25bf39[_0xb31d('0x1a')],_0x430a85=_0x25bf39[_0xb31d('0x1a')]+_0x25bf39[_0xb31d('0x1b')],_0x1d3a36;if(_0x430a85>=_0x2718c4){_0x430a85=_0x2718c4;_0x1d3a36=0xc8;}else{_0x1d3a36=0xce;}_0x5bf563[_0xb31d('0x17')](_0x1d3a36);return _0x5bf563['set'](_0xb31d('0x1c'),_0x38f853+'-'+_0x430a85+'/'+_0x2718c4)[_0xb31d('0x19')](_0x40f4d8);}return null;};}function patchUpdates(_0x5f14d5){return function(_0x388c8a){try{jsonpatch[_0xb31d('0x1d')](_0x388c8a,_0x5f14d5,!![]);}catch(_0x587576){return BPromise[_0xb31d('0x1e')](_0x587576);}return _0x388c8a[_0xb31d('0x1f')]();};}function saveUpdates(_0x46a84c,_0xa177d1){return function(_0x39202a){if(_0x39202a){return _0x39202a[_0xb31d('0x20')](_0x46a84c)[_0xb31d('0x21')](function(_0x30ae14){return _0x30ae14;});}return null;};}function removeEntity(_0x18453c,_0x5e48cf){return function(_0x34495a){if(_0x34495a){return _0x34495a[_0xb31d('0x22')]()['then'](function(){_0x18453c[_0xb31d('0x17')](0xcc)[_0xb31d('0x18')]();});}};}function handleEntityNotFound(_0x3cf891,_0x2b1593){return function(_0x2c4a57){if(!_0x2c4a57){_0x3cf891[_0xb31d('0x16')](0x194);}return _0x2c4a57;};}function handleError(_0x294fd6,_0x391ce9){_0x391ce9=_0x391ce9||0x1f4;return function(_0x2caa81){logger[_0xb31d('0x23')](_0x2caa81['stack']);if(_0x2caa81[_0xb31d('0x24')]){delete _0x2caa81[_0xb31d('0x24')];}_0x294fd6[_0xb31d('0x17')](_0x391ce9)[_0xb31d('0x25')](_0x2caa81);};}exports[_0xb31d('0x26')]=function(_0x3f9952,_0x595ff8){var _0x5be37d={},_0x27fe8f={},_0x5270c1={'count':0x0,'rows':[]};var _0x28d2cd=_[_0xb31d('0x27')](db[_0xb31d('0x28')][_0xb31d('0x29')],function(_0x403380){return{'name':_0x403380['fieldName'],'type':_0x403380[_0xb31d('0x2a')][_0xb31d('0x2b')]};});_0x27fe8f[_0xb31d('0x2c')]=_[_0xb31d('0x27')](_0x28d2cd,_0xb31d('0x24'));_0x27fe8f['query']=_['keys'](_0x3f9952['query']);_0x27fe8f['filters']=_[_0xb31d('0x2d')](_0x27fe8f[_0xb31d('0x2c')],_0x27fe8f[_0xb31d('0x2e')]);_0x5be37d[_0xb31d('0x2f')]=_[_0xb31d('0x2d')](_0x27fe8f[_0xb31d('0x2c')],qs[_0xb31d('0x30')](_0x3f9952[_0xb31d('0x2e')][_0xb31d('0x30')]));_0x5be37d[_0xb31d('0x2f')]=_0x5be37d['attributes'][_0xb31d('0x31')]?_0x5be37d[_0xb31d('0x2f')]:_0x27fe8f['model'];if(!_0x3f9952[_0xb31d('0x2e')][_0xb31d('0x32')](_0xb31d('0x33'))){_0x5be37d['limit']=qs[_0xb31d('0x1b')](_0x3f9952[_0xb31d('0x2e')]['limit']);_0x5be37d[_0xb31d('0x1a')]=qs[_0xb31d('0x1a')](_0x3f9952['query'][_0xb31d('0x1a')]);}_0x5be37d['order']=qs[_0xb31d('0x34')](_0x3f9952[_0xb31d('0x2e')][_0xb31d('0x34')]);_0x5be37d[_0xb31d('0x35')]=qs[_0xb31d('0x36')](_[_0xb31d('0x37')](_0x3f9952[_0xb31d('0x2e')],_0x27fe8f[_0xb31d('0x36')]),_0x28d2cd);if(_0x3f9952[_0xb31d('0x2e')][_0xb31d('0x38')]){_0x5be37d[_0xb31d('0x35')]=_['merge'](_0x5be37d[_0xb31d('0x35')],{'$or':_[_0xb31d('0x27')](_0x28d2cd,function(_0x29443d){if(_0x29443d[_0xb31d('0x2a')]!=='VIRTUAL'){var _0x5a6e74={};_0x5a6e74[_0x29443d[_0xb31d('0x24')]]={'$like':'%'+_0x3f9952['query'][_0xb31d('0x38')]+'%'};return _0x5a6e74;}})});}_0x5be37d=_[_0xb31d('0x39')]({},_0x5be37d,_0x3f9952[_0xb31d('0x3a')]);var _0x43dc4d={'where':_0x5be37d[_0xb31d('0x35')]};return db[_0xb31d('0x28')][_0xb31d('0x3b')](_0x43dc4d)[_0xb31d('0x21')](function(_0x25e3ab){_0x5270c1[_0xb31d('0x3b')]=_0x25e3ab;if(_0x3f9952[_0xb31d('0x2e')][_0xb31d('0x3c')]){_0x5be37d['include']=[{'all':!![]}];}return db[_0xb31d('0x28')]['findAll'](_0x5be37d);})[_0xb31d('0x21')](function(_0x3358cd){_0x5270c1['rows']=_0x3358cd;return _0x5270c1;})['then'](respondWithFilteredResult(_0x595ff8,_0x5be37d))['catch'](handleError(_0x595ff8,null));};exports[_0xb31d('0x3d')]=function(_0x1c2128,_0x23116f){var _0x355238={'raw':!![],'where':{'id':_0x1c2128[_0xb31d('0x3e')]['id']}},_0x26e620={};_0x26e620[_0xb31d('0x2c')]=_[_0xb31d('0x3f')](db['MailSubstatus'][_0xb31d('0x29')]);_0x26e620[_0xb31d('0x2e')]=_[_0xb31d('0x3f')](_0x1c2128['query']);_0x26e620[_0xb31d('0x36')]=_[_0xb31d('0x2d')](_0x26e620[_0xb31d('0x2c')],_0x26e620['query']);_0x355238[_0xb31d('0x2f')]=_[_0xb31d('0x2d')](_0x26e620[_0xb31d('0x2c')],qs[_0xb31d('0x30')](_0x1c2128[_0xb31d('0x2e')][_0xb31d('0x30')]));_0x355238[_0xb31d('0x2f')]=_0x355238[_0xb31d('0x2f')][_0xb31d('0x31')]?_0x355238[_0xb31d('0x2f')]:_0x26e620[_0xb31d('0x2c')];if(_0x1c2128[_0xb31d('0x2e')][_0xb31d('0x3c')]){_0x355238['include']=[{'all':!![]}];}_0x355238=_[_0xb31d('0x39')]({},_0x355238,_0x1c2128[_0xb31d('0x3a')]);return db[_0xb31d('0x28')][_0xb31d('0x40')](_0x355238)[_0xb31d('0x21')](handleEntityNotFound(_0x23116f,null))[_0xb31d('0x21')](respondWithResult(_0x23116f,null))[_0xb31d('0x41')](handleError(_0x23116f,null));};exports[_0xb31d('0x42')]=function(_0x426bc7,_0x165f64){return db[_0xb31d('0x28')][_0xb31d('0x42')](_0x426bc7[_0xb31d('0x43')],{})[_0xb31d('0x21')](respondWithResult(_0x165f64,0xc9))[_0xb31d('0x41')](handleError(_0x165f64,null));};exports['update']=function(_0x3b0854,_0x2e77c7){if(_0x3b0854[_0xb31d('0x43')]['id']){delete _0x3b0854[_0xb31d('0x43')]['id'];}return db[_0xb31d('0x28')][_0xb31d('0x40')]({'where':{'id':_0x3b0854[_0xb31d('0x3e')]['id']}})[_0xb31d('0x21')](handleEntityNotFound(_0x2e77c7,null))['then'](saveUpdates(_0x3b0854[_0xb31d('0x43')],null))[_0xb31d('0x21')](respondWithResult(_0x2e77c7,null))['catch'](handleError(_0x2e77c7,null));};exports['destroy']=function(_0x4d17fa,_0x3ee0ab){return db[_0xb31d('0x28')]['find']({'where':{'id':_0x4d17fa['params']['id']}})[_0xb31d('0x21')](handleEntityNotFound(_0x3ee0ab,null))['then'](removeEntity(_0x3ee0ab,null))[_0xb31d('0x41')](handleError(_0x3ee0ab,null));};exports[_0xb31d('0x44')]=function(_0x4446f3,_0x2b16c9){return db[_0xb31d('0x28')][_0xb31d('0x44')]()[_0xb31d('0x21')](respondWithResult(_0x2b16c9,null))[_0xb31d('0x41')](handleError(_0x2b16c9,null));}; \ No newline at end of file +var _0xe33f=['include','options','find','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','update','then','error','stack','name','send','MailSubstatus','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params'];(function(_0x2b3b86,_0x6fbde7){var _0x5ec677=function(_0x24fa6f){while(--_0x24fa6f){_0x2b3b86['push'](_0x2b3b86['shift']());}};_0x5ec677(++_0x6fbde7);}(_0xe33f,0x12a));var _0xfe33=function(_0xb8c0b4,_0xcb4582){_0xb8c0b4=_0xb8c0b4-0x0;var _0x51f85f=_0xe33f[_0xb8c0b4];return _0x51f85f;};'use strict';var pdf=require(_0xfe33('0x0'));var emlformat=require(_0xfe33('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfe33('0x2'));var jsonpatch=require(_0xfe33('0x3'));var rp=require(_0xfe33('0x4'));var moment=require(_0xfe33('0x5'));var BPromise=require(_0xfe33('0x6'));var Mustache=require(_0xfe33('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfe33('0x8'));var csv=require(_0xfe33('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe33('0xa'));var squel=require(_0xfe33('0xb'));var crypto=require(_0xfe33('0xc'));var jsforce=require(_0xfe33('0xd'));var deskjs=require(_0xfe33('0xe'));var toCsv=require(_0xfe33('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfe33('0xf'));var authService=require(_0xfe33('0x10'));var qs=require(_0xfe33('0x11'));var as=require(_0xfe33('0x12'));var hardwareService=require(_0xfe33('0x13'));var logger=require(_0xfe33('0x14'))(_0xfe33('0x15'));var utils=require(_0xfe33('0x16'));var config=require(_0xfe33('0x17'));var db=require(_0xfe33('0x18'))['db'];function respondWithStatusCode(_0x22a5fe,_0x3372db){_0x3372db=_0x3372db||0xcc;return function(_0x3e47f1){if(_0x3e47f1){return _0x22a5fe[_0xfe33('0x19')](_0x3372db);}return _0x22a5fe[_0xfe33('0x1a')](_0x3372db)[_0xfe33('0x1b')]();};}function respondWithResult(_0x27d14c,_0x3c2248){_0x3c2248=_0x3c2248||0xc8;return function(_0x2b8edd){if(_0x2b8edd){return _0x27d14c[_0xfe33('0x1a')](_0x3c2248)[_0xfe33('0x1c')](_0x2b8edd);}};}function respondWithFilteredResult(_0x51f45b,_0x324995){return function(_0x4a857f){if(_0x4a857f){var _0x4259a6=_0x4a857f[_0xfe33('0x1d')],_0x55c376=_0x324995['offset'],_0x10d2df=_0x324995['offset']+_0x324995[_0xfe33('0x1e')],_0x38e1c0;if(_0x10d2df>=_0x4259a6){_0x10d2df=_0x4259a6;_0x38e1c0=0xc8;}else{_0x38e1c0=0xce;}_0x51f45b[_0xfe33('0x1a')](_0x38e1c0);return _0x51f45b[_0xfe33('0x1f')](_0xfe33('0x20'),_0x55c376+'-'+_0x10d2df+'/'+_0x4259a6)[_0xfe33('0x1c')](_0x4a857f);}return null;};}function patchUpdates(_0x5274d5){return function(_0x54040f){try{jsonpatch[_0xfe33('0x21')](_0x54040f,_0x5274d5,!![]);}catch(_0x387ddb){return BPromise['reject'](_0x387ddb);}return _0x54040f['save']();};}function saveUpdates(_0x4459b7,_0x4ffee5){return function(_0x4e7054){if(_0x4e7054){return _0x4e7054[_0xfe33('0x22')](_0x4459b7)['then'](function(_0x1f58c0){return _0x1f58c0;});}return null;};}function removeEntity(_0x3032f9,_0x518a60){return function(_0x21de62){if(_0x21de62){return _0x21de62['destroy']()[_0xfe33('0x23')](function(){_0x3032f9[_0xfe33('0x1a')](0xcc)[_0xfe33('0x1b')]();});}};}function handleEntityNotFound(_0x2cb7a0,_0x41cf61){return function(_0x581871){if(!_0x581871){_0x2cb7a0[_0xfe33('0x19')](0x194);}return _0x581871;};}function handleError(_0x7b9eb,_0x4f078b){_0x4f078b=_0x4f078b||0x1f4;return function(_0x2ddbcd){logger[_0xfe33('0x24')](_0x2ddbcd[_0xfe33('0x25')]);if(_0x2ddbcd[_0xfe33('0x26')]){delete _0x2ddbcd[_0xfe33('0x26')];}_0x7b9eb[_0xfe33('0x1a')](_0x4f078b)[_0xfe33('0x27')](_0x2ddbcd);};}exports['index']=function(_0x19a44c,_0x6526c1){var _0x2acbf3={},_0x5ebe12={},_0x233541={'count':0x0,'rows':[]};var _0xf8211f=_['map'](db[_0xfe33('0x28')][_0xfe33('0x29')],function(_0x5bd7da){return{'name':_0x5bd7da['fieldName'],'type':_0x5bd7da[_0xfe33('0x2a')][_0xfe33('0x2b')]};});_0x5ebe12[_0xfe33('0x2c')]=_[_0xfe33('0x2d')](_0xf8211f,_0xfe33('0x26'));_0x5ebe12['query']=_[_0xfe33('0x2e')](_0x19a44c[_0xfe33('0x2f')]);_0x5ebe12[_0xfe33('0x30')]=_['intersection'](_0x5ebe12['model'],_0x5ebe12[_0xfe33('0x2f')]);_0x2acbf3['attributes']=_[_0xfe33('0x31')](_0x5ebe12[_0xfe33('0x2c')],qs[_0xfe33('0x32')](_0x19a44c[_0xfe33('0x2f')][_0xfe33('0x32')]));_0x2acbf3['attributes']=_0x2acbf3[_0xfe33('0x33')][_0xfe33('0x34')]?_0x2acbf3[_0xfe33('0x33')]:_0x5ebe12[_0xfe33('0x2c')];if(!_0x19a44c[_0xfe33('0x2f')]['hasOwnProperty'](_0xfe33('0x35'))){_0x2acbf3[_0xfe33('0x1e')]=qs[_0xfe33('0x1e')](_0x19a44c[_0xfe33('0x2f')]['limit']);_0x2acbf3[_0xfe33('0x36')]=qs[_0xfe33('0x36')](_0x19a44c[_0xfe33('0x2f')][_0xfe33('0x36')]);}_0x2acbf3[_0xfe33('0x37')]=qs[_0xfe33('0x38')](_0x19a44c[_0xfe33('0x2f')][_0xfe33('0x38')]);_0x2acbf3[_0xfe33('0x39')]=qs['filters'](_[_0xfe33('0x3a')](_0x19a44c['query'],_0x5ebe12['filters']),_0xf8211f);if(_0x19a44c['query'][_0xfe33('0x3b')]){_0x2acbf3[_0xfe33('0x39')]=_[_0xfe33('0x3c')](_0x2acbf3['where'],{'$or':_[_0xfe33('0x2d')](_0xf8211f,function(_0x23d5f7){if(_0x23d5f7[_0xfe33('0x2a')]!==_0xfe33('0x3d')){var _0x2f733d={};_0x2f733d[_0x23d5f7['name']]={'$like':'%'+_0x19a44c['query'][_0xfe33('0x3b')]+'%'};return _0x2f733d;}})});}_0x2acbf3=_[_0xfe33('0x3c')]({},_0x2acbf3,_0x19a44c['options']);var _0x4885c6={'where':_0x2acbf3[_0xfe33('0x39')]};return db[_0xfe33('0x28')][_0xfe33('0x1d')](_0x4885c6)[_0xfe33('0x23')](function(_0x11bc9e){_0x233541[_0xfe33('0x1d')]=_0x11bc9e;if(_0x19a44c[_0xfe33('0x2f')][_0xfe33('0x3e')]){_0x2acbf3['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x2acbf3);})[_0xfe33('0x23')](function(_0x2dfb77){_0x233541[_0xfe33('0x3f')]=_0x2dfb77;return _0x233541;})[_0xfe33('0x23')](respondWithFilteredResult(_0x6526c1,_0x2acbf3))[_0xfe33('0x40')](handleError(_0x6526c1,null));};exports[_0xfe33('0x41')]=function(_0x1c26fe,_0x4f30a9){var _0x43946c={'raw':!![],'where':{'id':_0x1c26fe[_0xfe33('0x42')]['id']}},_0x21e39f={};_0x21e39f[_0xfe33('0x2c')]=_[_0xfe33('0x2e')](db[_0xfe33('0x28')]['rawAttributes']);_0x21e39f['query']=_[_0xfe33('0x2e')](_0x1c26fe[_0xfe33('0x2f')]);_0x21e39f['filters']=_[_0xfe33('0x31')](_0x21e39f['model'],_0x21e39f[_0xfe33('0x2f')]);_0x43946c[_0xfe33('0x33')]=_[_0xfe33('0x31')](_0x21e39f[_0xfe33('0x2c')],qs[_0xfe33('0x32')](_0x1c26fe[_0xfe33('0x2f')]['fields']));_0x43946c[_0xfe33('0x33')]=_0x43946c[_0xfe33('0x33')][_0xfe33('0x34')]?_0x43946c[_0xfe33('0x33')]:_0x21e39f[_0xfe33('0x2c')];if(_0x1c26fe[_0xfe33('0x2f')][_0xfe33('0x3e')]){_0x43946c[_0xfe33('0x43')]=[{'all':!![]}];}_0x43946c=_[_0xfe33('0x3c')]({},_0x43946c,_0x1c26fe[_0xfe33('0x44')]);return db[_0xfe33('0x28')][_0xfe33('0x45')](_0x43946c)[_0xfe33('0x23')](handleEntityNotFound(_0x4f30a9,null))[_0xfe33('0x23')](respondWithResult(_0x4f30a9,null))[_0xfe33('0x40')](handleError(_0x4f30a9,null));};exports['create']=function(_0x1e1fa7,_0x2e59f6){return db[_0xfe33('0x28')]['create'](_0x1e1fa7[_0xfe33('0x46')],{})[_0xfe33('0x23')](respondWithResult(_0x2e59f6,0xc9))[_0xfe33('0x40')](handleError(_0x2e59f6,null));};exports['update']=function(_0x324cc9,_0x3c2167){if(_0x324cc9[_0xfe33('0x46')]['id']){delete _0x324cc9[_0xfe33('0x46')]['id'];}return db[_0xfe33('0x28')]['find']({'where':{'id':_0x324cc9[_0xfe33('0x42')]['id']}})[_0xfe33('0x23')](handleEntityNotFound(_0x3c2167,null))[_0xfe33('0x23')](saveUpdates(_0x324cc9[_0xfe33('0x46')],null))[_0xfe33('0x23')](respondWithResult(_0x3c2167,null))['catch'](handleError(_0x3c2167,null));};exports[_0xfe33('0x47')]=function(_0x1ff1bd,_0x22f287){return db['MailSubstatus']['find']({'where':{'id':_0x1ff1bd['params']['id']}})[_0xfe33('0x23')](handleEntityNotFound(_0x22f287,null))[_0xfe33('0x23')](removeEntity(_0x22f287,null))['catch'](handleError(_0x22f287,null));};exports['describe']=function(_0x5ee474,_0x43a164){return db[_0xfe33('0x28')][_0xfe33('0x48')]()[_0xfe33('0x23')](respondWithResult(_0x43a164,null))[_0xfe33('0x40')](handleError(_0x43a164,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ebbb427..8917c50 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 _0x9c9b=['rimraf','define','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','bluebird','path'];(function(_0x36b8b4,_0x2c2fc8){var _0x16dda2=function(_0x326542){while(--_0x326542){_0x36b8b4['push'](_0x36b8b4['shift']());}};_0x16dda2(++_0x2c2fc8);}(_0x9c9b,0x194));var _0xb9c9=function(_0x1fbf34,_0x5e7256){_0x1fbf34=_0x1fbf34-0x0;var _0x2e981e=_0x9c9b[_0x1fbf34];return _0x2e981e;};'use strict';var _=require('lodash');var util=require(_0xb9c9('0x0'));var logger=require(_0xb9c9('0x1'))(_0xb9c9('0x2'));var moment=require(_0xb9c9('0x3'));var BPromise=require(_0xb9c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c9('0x5'));var rimraf=require(_0xb9c9('0x6'));var config=require('../../config/environment');var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0xfe4cb4,_0x26bf07){return _0xfe4cb4[_0xb9c9('0x7')](_0xb9c9('0x8'),attributes,{'tableName':_0xb9c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeca8=['exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailSubstatus.attributes'];(function(_0x9abfbd,_0x336f3b){var _0x456acb=function(_0x4c12f7){while(--_0x4c12f7){_0x9abfbd['push'](_0x9abfbd['shift']());}};_0x456acb(++_0x336f3b);}(_0xeca8,0x1f2));var _0x8eca=function(_0x56b089,_0x20c8d2){_0x56b089=_0x56b089-0x0;var _0x43eb2f=_0xeca8[_0x56b089];return _0x43eb2f;};'use strict';var _=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var logger=require(_0x8eca('0x2'))(_0x8eca('0x3'));var moment=require(_0x8eca('0x4'));var BPromise=require(_0x8eca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eca('0x6'));var rimraf=require('rimraf');var config=require(_0x8eca('0x7'));var attributes=require(_0x8eca('0x8'));module[_0x8eca('0x9')]=function(_0x599a26,_0x46f257){return _0x599a26[_0x8eca('0xa')](_0x8eca('0xb'),attributes,{'tableName':_0x8eca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index eaf75bc..e50e3d8 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 _0x2750=['jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4b2bf,_0x49e4bf){var _0x3b9e63=function(_0x2881dd){while(--_0x2881dd){_0x4b2bf['push'](_0x4b2bf['shift']());}};_0x3b9e63(++_0x49e4bf);}(_0x2750,0x13b));var _0x0275=function(_0x5e94ce,_0x592a7a){_0x5e94ce=_0x5e94ce-0x0;var _0x4433f6=_0x2750[_0x5e94ce];return _0x4433f6;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('MailSubstatus,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xff01d2,_0x55806d){_0xff01d2=_0xff01d2-0x0;var _0xde0945=_0xbdb7[_0xff01d2];return _0xde0945;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c40a134..6396771 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 _0x81cf=['get','isAuthenticated','/describe','describe','/:id','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x4d712a,_0x5f2622){var _0x24819f=function(_0x6b157a){while(--_0x6b157a){_0x4d712a['push'](_0x4d712a['shift']());}};_0x24819f(++_0x5f2622);}(_0x81cf,0xb6));var _0xf81c=function(_0x5ea691,_0x4f9844){_0x5ea691=_0x5ea691-0x0;var _0x1864ac=_0x81cf[_0x5ea691];return _0x1864ac;};'use strict';var multer=require('multer');var util=require(_0xf81c('0x0'));var path=require('path');var timeout=require(_0xf81c('0x1'));var express=require(_0xf81c('0x2'));var router=express[_0xf81c('0x3')]();var auth=require(_0xf81c('0x4'));var interaction=require(_0xf81c('0x5'));var config=require(_0xf81c('0x6'));var controller=require(_0xf81c('0x7'));router[_0xf81c('0x8')]('/',auth[_0xf81c('0x9')](),controller['index']);router[_0xf81c('0x8')](_0xf81c('0xa'),auth[_0xf81c('0x9')](),controller[_0xf81c('0xb')]);router[_0xf81c('0x8')](_0xf81c('0xc'),auth[_0xf81c('0x9')](),controller['show']);router[_0xf81c('0xd')]('/',auth[_0xf81c('0x9')](),controller['create']);router[_0xf81c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf81c('0xf')]);router[_0xf81c('0x10')](_0xf81c('0xc'),auth['isAuthenticated'](),controller[_0xf81c('0x11')]);module[_0xf81c('0x12')]=router; \ No newline at end of file +var _0x5589=['get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./mailTransferReport.controller'];(function(_0x3ee086,_0x362168){var _0x433bcc=function(_0xe738e4){while(--_0xe738e4){_0x3ee086['push'](_0x3ee086['shift']());}};_0x433bcc(++_0x362168);}(_0x5589,0x6c));var _0x9558=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5589[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x9558('0x0'));var util=require(_0x9558('0x1'));var path=require(_0x9558('0x2'));var timeout=require(_0x9558('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9558('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9558('0x5'));router[_0x9558('0x6')]('/',auth[_0x9558('0x7')](),controller[_0x9558('0x8')]);router[_0x9558('0x6')](_0x9558('0x9'),auth[_0x9558('0x7')](),controller[_0x9558('0xa')]);router[_0x9558('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x9558('0xb')]);router[_0x9558('0xc')]('/',auth[_0x9558('0x7')](),controller['create']);router[_0x9558('0xd')](_0x9558('0xe'),auth[_0x9558('0x7')](),controller[_0x9558('0xf')]);router[_0x9558('0x10')](_0x9558('0xe'),auth[_0x9558('0x7')](),controller[_0x9558('0x11')]);module[_0x9558('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 9e22f43..b7e8fd5 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 _0xa195=['agent','queue','DATE','NOW','sequelize','exports','ENUM','account'];(function(_0xb54b31,_0x4ac97c){var _0x49d88b=function(_0x3da58a){while(--_0x3da58a){_0xb54b31['push'](_0xb54b31['shift']());}};_0x49d88b(++_0x4ac97c);}(_0xa195,0xf4));var _0x5a19=function(_0x49504b,_0x276d90){_0x49504b=_0x49504b-0x0;var _0x268f8c=_0xa195[_0x49504b];return _0x268f8c;};'use strict';var moment=require('moment');var Sequelize=require(_0x5a19('0x0'));module[_0x5a19('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5a19('0x2')](_0x5a19('0x3'),_0x5a19('0x4'),_0x5a19('0x5')),'allowNull':![],'defaultValue':_0x5a19('0x5')},'transferredAt':{'type':Sequelize[_0x5a19('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x5a19('0x7')]}}; \ No newline at end of file +var _0xbce9=['account','agent','queue','DATE','moment','exports','STRING','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbce9,0x1dc));var _0x9bce=function(_0x455555,_0x2147fd){_0x455555=_0x455555-0x0;var _0x3cb183=_0xbce9[_0x455555];return _0x3cb183;};'use strict';var moment=require(_0x9bce('0x0'));var Sequelize=require('sequelize');module[_0x9bce('0x1')]={'uniqueid':{'type':Sequelize[_0x9bce('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9bce('0x3')](_0x9bce('0x4'),_0x9bce('0x5'),_0x9bce('0x6')),'allowNull':![],'defaultValue':_0x9bce('0x6')},'transferredAt':{'type':Sequelize[_0x9bce('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6aae54b..f177c48 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 _0x80b6=['update','destroy','then','error','stack','name','index','map','MailTransferReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x80b6,0x183));var _0x680b=function(_0x73c5f0,_0x58643d){_0x73c5f0=_0x73c5f0-0x0;var _0x307a12=_0x80b6[_0x73c5f0];return _0x307a12;};'use strict';var pdf=require(_0x680b('0x0'));var emlformat=require(_0x680b('0x1'));var rimraf=require(_0x680b('0x2'));var zipdir=require(_0x680b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x680b('0x4'));var moment=require('moment');var BPromise=require(_0x680b('0x5'));var Mustache=require(_0x680b('0x6'));var util=require(_0x680b('0x7'));var path=require(_0x680b('0x8'));var sox=require(_0x680b('0x9'));var csv=require(_0x680b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x680b('0xb'));var squel=require('squel');var crypto=require(_0x680b('0xc'));var jsforce=require(_0x680b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x680b('0xa'));var querystring=require(_0x680b('0xe'));var Papa=require(_0x680b('0xf'));var Redis=require(_0x680b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x680b('0x11'));var as=require(_0x680b('0x12'));var hardwareService=require(_0x680b('0x13'));var logger=require('../../config/logger')(_0x680b('0x14'));var utils=require(_0x680b('0x15'));var config=require(_0x680b('0x16'));var db=require(_0x680b('0x17'))['db'];function respondWithStatusCode(_0x3fcf89,_0x1c7ab1){_0x1c7ab1=_0x1c7ab1||0xcc;return function(_0x126820){if(_0x126820){return _0x3fcf89[_0x680b('0x18')](_0x1c7ab1);}return _0x3fcf89[_0x680b('0x19')](_0x1c7ab1)[_0x680b('0x1a')]();};}function respondWithResult(_0x274a8c,_0x5553cf){_0x5553cf=_0x5553cf||0xc8;return function(_0x33e93d){if(_0x33e93d){return _0x274a8c[_0x680b('0x19')](_0x5553cf)[_0x680b('0x1b')](_0x33e93d);}};}function respondWithFilteredResult(_0x420163,_0x5c157a){return function(_0x484a97){if(_0x484a97){var _0x3e1b5e=_0x484a97[_0x680b('0x1c')],_0x23faed=_0x5c157a[_0x680b('0x1d')],_0x381d74=_0x5c157a['offset']+_0x5c157a[_0x680b('0x1e')],_0x116871;if(_0x381d74>=_0x3e1b5e){_0x381d74=_0x3e1b5e;_0x116871=0xc8;}else{_0x116871=0xce;}_0x420163[_0x680b('0x19')](_0x116871);return _0x420163[_0x680b('0x1f')]('Content-Range',_0x23faed+'-'+_0x381d74+'/'+_0x3e1b5e)[_0x680b('0x1b')](_0x484a97);}return null;};}function patchUpdates(_0xbba6bd){return function(_0x592b42){try{jsonpatch['apply'](_0x592b42,_0xbba6bd,!![]);}catch(_0x3b2867){return BPromise['reject'](_0x3b2867);}return _0x592b42[_0x680b('0x20')]();};}function saveUpdates(_0x5578d5,_0x31a73b){return function(_0x31e871){if(_0x31e871){return _0x31e871[_0x680b('0x21')](_0x5578d5)['then'](function(_0x402383){return _0x402383;});}return null;};}function removeEntity(_0x510d88,_0x536323){return function(_0x39e06c){if(_0x39e06c){return _0x39e06c[_0x680b('0x22')]()[_0x680b('0x23')](function(){_0x510d88[_0x680b('0x19')](0xcc)[_0x680b('0x1a')]();});}};}function handleEntityNotFound(_0x1a904e,_0x35b52b){return function(_0x291a4f){if(!_0x291a4f){_0x1a904e[_0x680b('0x18')](0x194);}return _0x291a4f;};}function handleError(_0x221a52,_0xbd3cf){_0xbd3cf=_0xbd3cf||0x1f4;return function(_0x229748){logger[_0x680b('0x24')](_0x229748[_0x680b('0x25')]);if(_0x229748[_0x680b('0x26')]){delete _0x229748[_0x680b('0x26')];}_0x221a52['status'](_0xbd3cf)['send'](_0x229748);};}exports[_0x680b('0x27')]=function(_0x979f95,_0x3bffed){var _0x66bd81={},_0x19c414={},_0x364a41={'count':0x0,'rows':[]};var _0x1f688c=_[_0x680b('0x28')](db[_0x680b('0x29')][_0x680b('0x2a')],function(_0x585bec){return{'name':_0x585bec['fieldName'],'type':_0x585bec['type'][_0x680b('0x2b')]};});_0x19c414[_0x680b('0x2c')]=_[_0x680b('0x28')](_0x1f688c,_0x680b('0x26'));_0x19c414[_0x680b('0x2d')]=_[_0x680b('0x2e')](_0x979f95[_0x680b('0x2d')]);_0x19c414['filters']=_[_0x680b('0x2f')](_0x19c414['model'],_0x19c414[_0x680b('0x2d')]);_0x66bd81[_0x680b('0x30')]=_[_0x680b('0x2f')](_0x19c414['model'],qs[_0x680b('0x31')](_0x979f95[_0x680b('0x2d')][_0x680b('0x31')]));_0x66bd81[_0x680b('0x30')]=_0x66bd81[_0x680b('0x30')]['length']?_0x66bd81['attributes']:_0x19c414[_0x680b('0x2c')];if(!_0x979f95[_0x680b('0x2d')]['hasOwnProperty'](_0x680b('0x32'))){_0x66bd81[_0x680b('0x1e')]=qs['limit'](_0x979f95['query']['limit']);_0x66bd81['offset']=qs[_0x680b('0x1d')](_0x979f95['query'][_0x680b('0x1d')]);}_0x66bd81[_0x680b('0x33')]=qs['sort'](_0x979f95[_0x680b('0x2d')]['sort']);_0x66bd81[_0x680b('0x34')]=qs[_0x680b('0x35')](_[_0x680b('0x36')](_0x979f95[_0x680b('0x2d')],_0x19c414[_0x680b('0x35')]),_0x1f688c);if(_0x979f95['query'][_0x680b('0x37')]){_0x66bd81[_0x680b('0x34')]=_[_0x680b('0x38')](_0x66bd81[_0x680b('0x34')],{'$or':_[_0x680b('0x28')](_0x1f688c,function(_0x4e03e3){if(_0x4e03e3[_0x680b('0x39')]!==_0x680b('0x3a')){var _0x1e229d={};_0x1e229d[_0x4e03e3[_0x680b('0x26')]]={'$like':'%'+_0x979f95[_0x680b('0x2d')][_0x680b('0x37')]+'%'};return _0x1e229d;}})});}_0x66bd81=_[_0x680b('0x38')]({},_0x66bd81,_0x979f95[_0x680b('0x3b')]);var _0x408789={'where':_0x66bd81[_0x680b('0x34')]};return db[_0x680b('0x29')][_0x680b('0x1c')](_0x408789)['then'](function(_0x354855){_0x364a41['count']=_0x354855;if(_0x979f95[_0x680b('0x2d')][_0x680b('0x3c')]){_0x66bd81[_0x680b('0x3d')]=[{'all':!![]}];}return db[_0x680b('0x29')]['findAll'](_0x66bd81);})['then'](function(_0x5f6166){_0x364a41[_0x680b('0x3e')]=_0x5f6166;return _0x364a41;})[_0x680b('0x23')](respondWithFilteredResult(_0x3bffed,_0x66bd81))[_0x680b('0x3f')](handleError(_0x3bffed,null));};exports[_0x680b('0x40')]=function(_0x4aa0e5,_0x23baef){var _0x541053={'raw':!![],'where':{'id':_0x4aa0e5[_0x680b('0x41')]['id']}},_0xc7b353={};_0xc7b353[_0x680b('0x2c')]=_['keys'](db[_0x680b('0x29')][_0x680b('0x2a')]);_0xc7b353['query']=_['keys'](_0x4aa0e5[_0x680b('0x2d')]);_0xc7b353[_0x680b('0x35')]=_[_0x680b('0x2f')](_0xc7b353['model'],_0xc7b353[_0x680b('0x2d')]);_0x541053[_0x680b('0x30')]=_[_0x680b('0x2f')](_0xc7b353[_0x680b('0x2c')],qs[_0x680b('0x31')](_0x4aa0e5[_0x680b('0x2d')]['fields']));_0x541053[_0x680b('0x30')]=_0x541053[_0x680b('0x30')]['length']?_0x541053[_0x680b('0x30')]:_0xc7b353['model'];if(_0x4aa0e5[_0x680b('0x2d')][_0x680b('0x3c')]){_0x541053[_0x680b('0x3d')]=[{'all':!![]}];}_0x541053=_[_0x680b('0x38')]({},_0x541053,_0x4aa0e5[_0x680b('0x3b')]);return db[_0x680b('0x29')][_0x680b('0x42')](_0x541053)['then'](handleEntityNotFound(_0x23baef,null))[_0x680b('0x23')](respondWithResult(_0x23baef,null))[_0x680b('0x3f')](handleError(_0x23baef,null));};exports['create']=function(_0x36bb0b,_0xc731bb){return db['MailTransferReport'][_0x680b('0x43')](_0x36bb0b[_0x680b('0x44')],{})[_0x680b('0x23')](respondWithResult(_0xc731bb,0xc9))[_0x680b('0x3f')](handleError(_0xc731bb,null));};exports[_0x680b('0x21')]=function(_0x419abb,_0x9d51b0){if(_0x419abb[_0x680b('0x44')]['id']){delete _0x419abb[_0x680b('0x44')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x419abb[_0x680b('0x41')]['id']}})['then'](handleEntityNotFound(_0x9d51b0,null))[_0x680b('0x23')](saveUpdates(_0x419abb[_0x680b('0x44')],null))[_0x680b('0x23')](respondWithResult(_0x9d51b0,null))[_0x680b('0x3f')](handleError(_0x9d51b0,null));};exports['destroy']=function(_0x1ea8fe,_0x384f32){return db['MailTransferReport'][_0x680b('0x42')]({'where':{'id':_0x1ea8fe['params']['id']}})[_0x680b('0x23')](handleEntityNotFound(_0x384f32,null))[_0x680b('0x23')](removeEntity(_0x384f32,null))[_0x680b('0x3f')](handleError(_0x384f32,null));};exports[_0x680b('0x45')]=function(_0x745868,_0x1bf75b){return db['MailTransferReport'][_0x680b('0x45')]()[_0x680b('0x23')](respondWithResult(_0x1bf75b,null))[_0x680b('0x3f')](handleError(_0x1bf75b,null));}; \ No newline at end of file +var _0x5f76=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','merge','VIRTUAL','filter','options','MailTransferReport','findAll','catch','show','includeAll','include','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel'];(function(_0xf6387f,_0x17c21e){var _0x21614f=function(_0x360db8){while(--_0x360db8){_0xf6387f['push'](_0xf6387f['shift']());}};_0x21614f(++_0x17c21e);}(_0x5f76,0x8b));var _0x65f7=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0x5f76[_0x12833b];return _0x3acad3;};'use strict';var pdf=require(_0x65f7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x65f7('0x1'));var zipdir=require(_0x65f7('0x2'));var jsonpatch=require(_0x65f7('0x3'));var rp=require(_0x65f7('0x4'));var moment=require(_0x65f7('0x5'));var BPromise=require(_0x65f7('0x6'));var Mustache=require(_0x65f7('0x7'));var util=require(_0x65f7('0x8'));var path=require(_0x65f7('0x9'));var sox=require(_0x65f7('0xa'));var csv=require(_0x65f7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f7('0xc'));var crypto=require(_0x65f7('0xd'));var jsforce=require(_0x65f7('0xe'));var deskjs=require(_0x65f7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x65f7('0x10'));var Papa=require(_0x65f7('0x11'));var Redis=require('ioredis');var authService=require(_0x65f7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x65f7('0x13'));var hardwareService=require(_0x65f7('0x14'));var logger=require(_0x65f7('0x15'))(_0x65f7('0x16'));var utils=require(_0x65f7('0x17'));var config=require(_0x65f7('0x18'));var db=require(_0x65f7('0x19'))['db'];function respondWithStatusCode(_0x29f017,_0x229da2){_0x229da2=_0x229da2||0xcc;return function(_0x55cced){if(_0x55cced){return _0x29f017[_0x65f7('0x1a')](_0x229da2);}return _0x29f017[_0x65f7('0x1b')](_0x229da2)['end']();};}function respondWithResult(_0xbd07ff,_0x88e7e2){_0x88e7e2=_0x88e7e2||0xc8;return function(_0x5b2443){if(_0x5b2443){return _0xbd07ff[_0x65f7('0x1b')](_0x88e7e2)[_0x65f7('0x1c')](_0x5b2443);}};}function respondWithFilteredResult(_0x39794e,_0x51d9ea){return function(_0x4d4afd){if(_0x4d4afd){var _0x19f624=_0x4d4afd[_0x65f7('0x1d')],_0x56ca01=_0x51d9ea['offset'],_0x4593dc=_0x51d9ea['offset']+_0x51d9ea[_0x65f7('0x1e')],_0x4bb943;if(_0x4593dc>=_0x19f624){_0x4593dc=_0x19f624;_0x4bb943=0xc8;}else{_0x4bb943=0xce;}_0x39794e[_0x65f7('0x1b')](_0x4bb943);return _0x39794e[_0x65f7('0x1f')]('Content-Range',_0x56ca01+'-'+_0x4593dc+'/'+_0x19f624)['json'](_0x4d4afd);}return null;};}function patchUpdates(_0x333e18){return function(_0x48e919){try{jsonpatch[_0x65f7('0x20')](_0x48e919,_0x333e18,!![]);}catch(_0x2dc78a){return BPromise[_0x65f7('0x21')](_0x2dc78a);}return _0x48e919[_0x65f7('0x22')]();};}function saveUpdates(_0x111f38,_0x59d8d7){return function(_0x33c9cc){if(_0x33c9cc){return _0x33c9cc[_0x65f7('0x23')](_0x111f38)[_0x65f7('0x24')](function(_0x3726b5){return _0x3726b5;});}return null;};}function removeEntity(_0x3428a2,_0x431a65){return function(_0x640ae6){if(_0x640ae6){return _0x640ae6['destroy']()[_0x65f7('0x24')](function(){_0x3428a2['status'](0xcc)[_0x65f7('0x25')]();});}};}function handleEntityNotFound(_0x495408,_0xaaaabb){return function(_0x5683b8){if(!_0x5683b8){_0x495408[_0x65f7('0x1a')](0x194);}return _0x5683b8;};}function handleError(_0xec2033,_0x482b1d){_0x482b1d=_0x482b1d||0x1f4;return function(_0x356d7e){logger[_0x65f7('0x26')](_0x356d7e[_0x65f7('0x27')]);if(_0x356d7e['name']){delete _0x356d7e[_0x65f7('0x28')];}_0xec2033['status'](_0x482b1d)[_0x65f7('0x29')](_0x356d7e);};}exports[_0x65f7('0x2a')]=function(_0x102ead,_0x3a5e86){var _0x1b9524={},_0x3a7070={},_0xa9cbf3={'count':0x0,'rows':[]};var _0x5535d3=_[_0x65f7('0x2b')](db['MailTransferReport']['rawAttributes'],function(_0x231871){return{'name':_0x231871[_0x65f7('0x2c')],'type':_0x231871[_0x65f7('0x2d')][_0x65f7('0x2e')]};});_0x3a7070[_0x65f7('0x2f')]=_['map'](_0x5535d3,_0x65f7('0x28'));_0x3a7070[_0x65f7('0x30')]=_[_0x65f7('0x31')](_0x102ead[_0x65f7('0x30')]);_0x3a7070['filters']=_[_0x65f7('0x32')](_0x3a7070[_0x65f7('0x2f')],_0x3a7070['query']);_0x1b9524[_0x65f7('0x33')]=_[_0x65f7('0x32')](_0x3a7070[_0x65f7('0x2f')],qs[_0x65f7('0x34')](_0x102ead[_0x65f7('0x30')]['fields']));_0x1b9524[_0x65f7('0x33')]=_0x1b9524['attributes'][_0x65f7('0x35')]?_0x1b9524[_0x65f7('0x33')]:_0x3a7070[_0x65f7('0x2f')];if(!_0x102ead[_0x65f7('0x30')][_0x65f7('0x36')](_0x65f7('0x37'))){_0x1b9524[_0x65f7('0x1e')]=qs[_0x65f7('0x1e')](_0x102ead[_0x65f7('0x30')][_0x65f7('0x1e')]);_0x1b9524['offset']=qs['offset'](_0x102ead[_0x65f7('0x30')][_0x65f7('0x38')]);}_0x1b9524['order']=qs[_0x65f7('0x39')](_0x102ead[_0x65f7('0x30')]['sort']);_0x1b9524[_0x65f7('0x3a')]=qs[_0x65f7('0x3b')](_[_0x65f7('0x3c')](_0x102ead[_0x65f7('0x30')],_0x3a7070[_0x65f7('0x3b')]),_0x5535d3);if(_0x102ead[_0x65f7('0x30')]['filter']){_0x1b9524[_0x65f7('0x3a')]=_[_0x65f7('0x3d')](_0x1b9524[_0x65f7('0x3a')],{'$or':_[_0x65f7('0x2b')](_0x5535d3,function(_0x35a729){if(_0x35a729[_0x65f7('0x2d')]!==_0x65f7('0x3e')){var _0x15bd6a={};_0x15bd6a[_0x35a729[_0x65f7('0x28')]]={'$like':'%'+_0x102ead[_0x65f7('0x30')][_0x65f7('0x3f')]+'%'};return _0x15bd6a;}})});}_0x1b9524=_[_0x65f7('0x3d')]({},_0x1b9524,_0x102ead[_0x65f7('0x40')]);var _0x4f60f7={'where':_0x1b9524['where']};return db[_0x65f7('0x41')]['count'](_0x4f60f7)['then'](function(_0x28a81b){_0xa9cbf3[_0x65f7('0x1d')]=_0x28a81b;if(_0x102ead['query']['includeAll']){_0x1b9524['include']=[{'all':!![]}];}return db[_0x65f7('0x41')][_0x65f7('0x42')](_0x1b9524);})[_0x65f7('0x24')](function(_0x151633){_0xa9cbf3['rows']=_0x151633;return _0xa9cbf3;})[_0x65f7('0x24')](respondWithFilteredResult(_0x3a5e86,_0x1b9524))[_0x65f7('0x43')](handleError(_0x3a5e86,null));};exports[_0x65f7('0x44')]=function(_0x2e0184,_0x2f2343){var _0x44b469={'raw':!![],'where':{'id':_0x2e0184['params']['id']}},_0x3c2671={};_0x3c2671[_0x65f7('0x2f')]=_['keys'](db[_0x65f7('0x41')]['rawAttributes']);_0x3c2671[_0x65f7('0x30')]=_['keys'](_0x2e0184[_0x65f7('0x30')]);_0x3c2671[_0x65f7('0x3b')]=_[_0x65f7('0x32')](_0x3c2671[_0x65f7('0x2f')],_0x3c2671[_0x65f7('0x30')]);_0x44b469['attributes']=_[_0x65f7('0x32')](_0x3c2671[_0x65f7('0x2f')],qs[_0x65f7('0x34')](_0x2e0184[_0x65f7('0x30')][_0x65f7('0x34')]));_0x44b469[_0x65f7('0x33')]=_0x44b469[_0x65f7('0x33')][_0x65f7('0x35')]?_0x44b469['attributes']:_0x3c2671['model'];if(_0x2e0184[_0x65f7('0x30')][_0x65f7('0x45')]){_0x44b469[_0x65f7('0x46')]=[{'all':!![]}];}_0x44b469=_[_0x65f7('0x3d')]({},_0x44b469,_0x2e0184[_0x65f7('0x40')]);return db['MailTransferReport'][_0x65f7('0x47')](_0x44b469)[_0x65f7('0x24')](handleEntityNotFound(_0x2f2343,null))[_0x65f7('0x24')](respondWithResult(_0x2f2343,null))['catch'](handleError(_0x2f2343,null));};exports[_0x65f7('0x48')]=function(_0x5c4d70,_0x168822){return db[_0x65f7('0x41')][_0x65f7('0x48')](_0x5c4d70[_0x65f7('0x49')],{})[_0x65f7('0x24')](respondWithResult(_0x168822,0xc9))[_0x65f7('0x43')](handleError(_0x168822,null));};exports[_0x65f7('0x23')]=function(_0x895720,_0x14b7cd){if(_0x895720[_0x65f7('0x49')]['id']){delete _0x895720[_0x65f7('0x49')]['id'];}return db[_0x65f7('0x41')][_0x65f7('0x47')]({'where':{'id':_0x895720[_0x65f7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14b7cd,null))[_0x65f7('0x24')](saveUpdates(_0x895720[_0x65f7('0x49')],null))[_0x65f7('0x24')](respondWithResult(_0x14b7cd,null))[_0x65f7('0x43')](handleError(_0x14b7cd,null));};exports['destroy']=function(_0x4bdbe8,_0x45a169){return db[_0x65f7('0x41')][_0x65f7('0x47')]({'where':{'id':_0x4bdbe8[_0x65f7('0x4a')]['id']}})[_0x65f7('0x24')](handleEntityNotFound(_0x45a169,null))[_0x65f7('0x24')](removeEntity(_0x45a169,null))[_0x65f7('0x43')](handleError(_0x45a169,null));};exports['describe']=function(_0x765e9c,_0x11458d){return db['MailTransferReport'][_0x65f7('0x4b')]()[_0x65f7('0x24')](respondWithResult(_0x11458d,null))[_0x65f7('0x43')](handleError(_0x11458d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index efa6793..da2757c 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 _0x782e=['../../config/environment','exports','define','report_mail_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3adf59,_0x2801d5){var _0x58a600=function(_0x29fe68){while(--_0x29fe68){_0x3adf59['push'](_0x3adf59['shift']());}};_0x58a600(++_0x2801d5);}(_0x782e,0x155));var _0xe782=function(_0x32c45a,_0xae9ace){_0x32c45a=_0x32c45a-0x0;var _0x2a5dc0=_0x782e[_0x32c45a];return _0x2a5dc0;};'use strict';var _=require('lodash');var util=require(_0xe782('0x0'));var logger=require(_0xe782('0x1'))('api');var moment=require(_0xe782('0x2'));var BPromise=require(_0xe782('0x3'));var rp=require(_0xe782('0x4'));var fs=require('fs');var path=require(_0xe782('0x5'));var rimraf=require(_0xe782('0x6'));var config=require(_0xe782('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0xe782('0x8')]=function(_0x31ca53,_0xabaf7e){return _0x31ca53[_0xe782('0x9')]('MailTransferReport',attributes,{'tableName':_0xe782('0xa'),'paranoid':![],'indexes':[{'name':_0xe782('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe042=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe042,0x16d));var _0x2e04=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0xe042[_0x17823f];return _0x51fc21;};'use strict';var _=require(_0x2e04('0x0'));var util=require(_0x2e04('0x1'));var logger=require(_0x2e04('0x2'))(_0x2e04('0x3'));var moment=require(_0x2e04('0x4'));var BPromise=require(_0x2e04('0x5'));var rp=require(_0x2e04('0x6'));var fs=require('fs');var path=require(_0x2e04('0x7'));var rimraf=require(_0x2e04('0x8'));var config=require('../../config/environment');var attributes=require(_0x2e04('0x9'));module[_0x2e04('0xa')]=function(_0x35ab8b,_0x1817cf){return _0x35ab8b[_0x2e04('0xb')](_0x2e04('0xc'),attributes,{'tableName':_0x2e04('0xd'),'paranoid':![],'indexes':[{'name':_0x2e04('0xe'),'fields':[_0x2e04('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9e70271..7771d08 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 _0x1335=['request\x20sent','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','MailTransferReport,\x20%s,\x20%s','debug','stringify','error','message','info'];(function(_0x2df5ac,_0x5e8ade){var _0x42dc81=function(_0x2e6c07){while(--_0x2e6c07){_0x2df5ac['push'](_0x2df5ac['shift']());}};_0x42dc81(++_0x5e8ade);}(_0x1335,0x157));var _0x5133=function(_0x138c62,_0x4c88d5){_0x138c62=_0x138c62-0x0;var _0x1c289d=_0x1335[_0x138c62];return _0x1c289d;};'use strict';var _=require(_0x5133('0x0'));var util=require(_0x5133('0x1'));var moment=require(_0x5133('0x2'));var BPromise=require('bluebird');var rs=require(_0x5133('0x3'));var fs=require('fs');var Redis=require(_0x5133('0x4'));var db=require(_0x5133('0x5'))['db'];var utils=require(_0x5133('0x6'));var logger=require(_0x5133('0x7'))(_0x5133('0x8'));var config=require(_0x5133('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5133('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3b7d,_0x6f63ca,_0x558f6a){return new BPromise(function(_0x53d479,_0x21bd5c){return client[_0x5133('0xb')](_0x3c3b7d,_0x558f6a)['then'](function(_0x2a6327){logger['info'](_0x5133('0xc'),_0x6f63ca,'request\x20sent');logger[_0x5133('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x6f63ca,'request\x20sent',JSON[_0x5133('0xe')](_0x2a6327));if(_0x2a6327[_0x5133('0xf')]){if(_0x2a6327['error']['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x6f63ca,_0x2a6327['error'][_0x5133('0x10')]);return _0x21bd5c(_0x2a6327[_0x5133('0xf')][_0x5133('0x10')]);}logger[_0x5133('0xf')](_0x5133('0xc'),_0x6f63ca,_0x2a6327['error'][_0x5133('0x10')]);return _0x53d479(_0x2a6327[_0x5133('0xf')][_0x5133('0x10')]);}else{logger[_0x5133('0x11')](_0x5133('0xc'),_0x6f63ca,_0x5133('0x12'));_0x53d479(_0x2a6327['result'][_0x5133('0x10')]);}})['catch'](function(_0xf64ea3){logger['error'](_0x5133('0xc'),_0x6f63ca,_0xf64ea3);_0x21bd5c(_0xf64ea3);});});} \ No newline at end of file +var _0x914b=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x51da47,_0x5878af){var _0x332704=function(_0x479319){while(--_0x479319){_0x51da47['push'](_0x51da47['shift']());}};_0x332704(++_0x5878af);}(_0x914b,0x134));var _0xb914=function(_0x17ebb6,_0x465af7){_0x17ebb6=_0x17ebb6-0x0;var _0x32ec22=_0x914b[_0x17ebb6];return _0x32ec22;};'use strict';var _=require(_0xb914('0x0'));var util=require(_0xb914('0x1'));var moment=require(_0xb914('0x2'));var BPromise=require(_0xb914('0x3'));var rs=require(_0xb914('0x4'));var fs=require('fs');var Redis=require(_0xb914('0x5'));var db=require(_0xb914('0x6'))['db'];var utils=require(_0xb914('0x7'));var logger=require(_0xb914('0x8'))(_0xb914('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb914('0xa')][_0xb914('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ed98a,_0x4ea6e4,_0x544d78){return new BPromise(function(_0x1d4573,_0x1e3398){return client[_0xb914('0xc')](_0x4ed98a,_0x544d78)[_0xb914('0xd')](function(_0x572bba){logger[_0xb914('0xe')](_0xb914('0xf'),_0x4ea6e4,_0xb914('0x10'));logger[_0xb914('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4ea6e4,_0xb914('0x10'),JSON['stringify'](_0x572bba));if(_0x572bba[_0xb914('0x12')]){if(_0x572bba[_0xb914('0x12')][_0xb914('0x13')]===0x1f4){logger[_0xb914('0x12')](_0xb914('0xf'),_0x4ea6e4,_0x572bba[_0xb914('0x12')]['message']);return _0x1e3398(_0x572bba[_0xb914('0x12')][_0xb914('0x14')]);}logger[_0xb914('0x12')](_0xb914('0xf'),_0x4ea6e4,_0x572bba[_0xb914('0x12')][_0xb914('0x14')]);return _0x1d4573(_0x572bba['error'][_0xb914('0x14')]);}else{logger[_0xb914('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x4ea6e4,_0xb914('0x10'));_0x1d4573(_0x572bba[_0xb914('0x15')]['message']);}})[_0xb914('0x16')](function(_0x231fc4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x4ea6e4,_0x231fc4);_0x1e3398(_0x231fc4);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1e80da1..2bf475c 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 _0x23f2=['show','create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x3e9986,_0x4cda95){var _0x1ca1d5=function(_0x52471c){while(--_0x52471c){_0x3e9986['push'](_0x3e9986['shift']());}};_0x1ca1d5(++_0x4cda95);}(_0x23f2,0x1ce));var _0x223f=function(_0x17f210,_0x270842){_0x17f210=_0x17f210-0x0;var _0x48dac7=_0x23f2[_0x17f210];return _0x48dac7;};'use strict';var multer=require('multer');var util=require(_0x223f('0x0'));var path=require(_0x223f('0x1'));var timeout=require(_0x223f('0x2'));var express=require(_0x223f('0x3'));var router=express['Router']();var auth=require(_0x223f('0x4'));var interaction=require(_0x223f('0x5'));var config=require(_0x223f('0x6'));var controller=require(_0x223f('0x7'));router[_0x223f('0x8')]('/',auth[_0x223f('0x9')](),controller[_0x223f('0xa')]);router[_0x223f('0x8')]('/describe',auth[_0x223f('0x9')](),controller[_0x223f('0xb')]);router['get'](_0x223f('0xc'),auth['isAuthenticated'](),controller[_0x223f('0xd')]);router['post']('/',auth[_0x223f('0x9')](),controller[_0x223f('0xe')]);router[_0x223f('0xf')](_0x223f('0xc'),auth[_0x223f('0x9')](),controller[_0x223f('0x10')]);router['delete']('/:id',auth[_0x223f('0x9')](),controller[_0x223f('0x11')]);module[_0x223f('0x12')]=router; \ No newline at end of file +var _0x9d13=['update','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9d13,0xf3));var _0x39d1=function(_0x190bc1,_0x15e7bc){_0x190bc1=_0x190bc1-0x0;var _0x956b3b=_0x9d13[_0x190bc1];return _0x956b3b;};'use strict';var multer=require('multer');var util=require(_0x39d1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x39d1('0x1')]();var auth=require(_0x39d1('0x2'));var interaction=require(_0x39d1('0x3'));var config=require('../../config/environment');var controller=require(_0x39d1('0x4'));router[_0x39d1('0x5')]('/',auth[_0x39d1('0x6')](),controller['index']);router[_0x39d1('0x5')](_0x39d1('0x7'),auth[_0x39d1('0x6')](),controller[_0x39d1('0x8')]);router[_0x39d1('0x5')](_0x39d1('0x9'),auth['isAuthenticated'](),controller[_0x39d1('0xa')]);router[_0x39d1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x39d1('0xc')](_0x39d1('0x9'),auth[_0x39d1('0x6')](),controller[_0x39d1('0xd')]);router['delete'](_0x39d1('0x9'),auth[_0x39d1('0x6')](),controller[_0x39d1('0xe')]);module[_0x39d1('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9e7adcb..f0e0156 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 _0x822b=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','moment','exports'];(function(_0x56922c,_0x347c88){var _0xf896d7=function(_0x214e47){while(--_0x214e47){_0x56922c['push'](_0x56922c['shift']());}};_0xf896d7(++_0x347c88);}(_0x822b,0x1d7));var _0xb822=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0x822b[_0x2b8722];return _0x20c180;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb822('0x0'));module[_0xb822('0x1')]={'channel':{'type':Sequelize[_0xb822('0x2')]},'membername':{'type':Sequelize[_0xb822('0x2')]},'interface':{'type':Sequelize[_0xb822('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xb822('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xb822('0x4')]},'enterAt':{'type':Sequelize[_0xb822('0x5')]},'exitAt':{'type':Sequelize[_0xb822('0x5')],'set':function(_0x539c1b){var _0x1c44f8=moment(_0x539c1b);var _0x4f5102=moment(this['getDataValue'](_0xb822('0x6')));var _0x1faea7=_0x1c44f8['diff'](_0x4f5102,_0xb822('0x7'));this[_0xb822('0x8')]('exitAt',_0x539c1b);this[_0xb822('0x8')](_0xb822('0x9'),_0x1faea7||null);}},'data1':{'type':Sequelize[_0xb822('0x2')],'comment':_0xb822('0xa')},'data2':{'type':Sequelize[_0xb822('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xb822('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xb822('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xb822('0x4')]},'uniqueid':{'type':Sequelize[_0xb822('0x2')]}}; \ No newline at end of file +var _0x67f7=['setDataValue','duration','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','seconds'];(function(_0x4ed41a,_0x11a9d5){var _0x43d76c=function(_0x4390dc){while(--_0x4390dc){_0x4ed41a['push'](_0x4ed41a['shift']());}};_0x43d76c(++_0x11a9d5);}(_0x67f7,0x66));var _0x767f=function(_0x1b097d,_0x20b4df){_0x1b097d=_0x1b097d-0x0;var _0x50898c=_0x67f7[_0x1b097d];return _0x50898c;};'use strict';var Sequelize=require(_0x767f('0x0'));var moment=require(_0x767f('0x1'));module[_0x767f('0x2')]={'channel':{'type':Sequelize[_0x767f('0x3')]},'membername':{'type':Sequelize[_0x767f('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x767f('0x3')],'defaultValue':_0x767f('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x767f('0x5')]},'enterAt':{'type':Sequelize[_0x767f('0x6')]},'exitAt':{'type':Sequelize[_0x767f('0x6')],'set':function(_0x3694f1){var _0x49d4b1=moment(_0x3694f1);var _0x36af80=moment(this[_0x767f('0x7')](_0x767f('0x8')));var _0x446f65=_0x49d4b1['diff'](_0x36af80,_0x767f('0x9'));this['setDataValue']('exitAt',_0x3694f1);this[_0x767f('0xa')](_0x767f('0xb'),_0x446f65||null);}},'data1':{'type':Sequelize[_0x767f('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x767f('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x767f('0x3')],'comment':_0x767f('0xc')},'data4':{'type':Sequelize[_0x767f('0x3')],'comment':_0x767f('0xd')},'data5':{'type':Sequelize[_0x767f('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x767f('0x3')]},'internal':{'type':Sequelize[_0x767f('0x5')]},'uniqueid':{'type':Sequelize[_0x767f('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 4aef52d..802ee7f 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 _0x3653=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','merge','type','VIRTUAL','options','count','includeAll','include','params','keys','fields','catch','create','body','update','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x41396b,_0x56fbb9){var _0x38586f=function(_0x3374f0){while(--_0x3374f0){_0x41396b['push'](_0x41396b['shift']());}};_0x38586f(++_0x56fbb9);}(_0x3653,0x110));var _0x3365=function(_0x514c1b,_0x20e995){_0x514c1b=_0x514c1b-0x0;var _0x90b40c=_0x3653[_0x514c1b];return _0x90b40c;};'use strict';var pdf=require(_0x3365('0x0'));var emlformat=require(_0x3365('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3365('0x2'));var jsonpatch=require(_0x3365('0x3'));var rp=require(_0x3365('0x4'));var moment=require(_0x3365('0x5'));var BPromise=require(_0x3365('0x6'));var Mustache=require(_0x3365('0x7'));var util=require('util');var path=require(_0x3365('0x8'));var sox=require(_0x3365('0x9'));var csv=require(_0x3365('0xa'));var ejs=require(_0x3365('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3365('0xc'));var crypto=require('crypto');var jsforce=require(_0x3365('0xd'));var deskjs=require(_0x3365('0xe'));var toCsv=require(_0x3365('0xa'));var querystring=require(_0x3365('0xf'));var Papa=require(_0x3365('0x10'));var Redis=require(_0x3365('0x11'));var authService=require(_0x3365('0x12'));var qs=require(_0x3365('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3365('0x14'));var logger=require(_0x3365('0x15'))(_0x3365('0x16'));var utils=require(_0x3365('0x17'));var config=require(_0x3365('0x18'));var db=require(_0x3365('0x19'))['db'];function respondWithStatusCode(_0x66e4ed,_0x273019){_0x273019=_0x273019||0xcc;return function(_0x18d290){if(_0x18d290){return _0x66e4ed[_0x3365('0x1a')](_0x273019);}return _0x66e4ed['status'](_0x273019)['end']();};}function respondWithResult(_0x433546,_0x2b22a5){_0x2b22a5=_0x2b22a5||0xc8;return function(_0x370ce4){if(_0x370ce4){return _0x433546['status'](_0x2b22a5)[_0x3365('0x1b')](_0x370ce4);}};}function respondWithFilteredResult(_0x26df0c,_0x11488f){return function(_0x534714){if(_0x534714){var _0x5e6dba=_0x534714['count'],_0x22dc43=_0x11488f[_0x3365('0x1c')],_0x112fad=_0x11488f['offset']+_0x11488f[_0x3365('0x1d')],_0x8443c2;if(_0x112fad>=_0x5e6dba){_0x112fad=_0x5e6dba;_0x8443c2=0xc8;}else{_0x8443c2=0xce;}_0x26df0c[_0x3365('0x1e')](_0x8443c2);return _0x26df0c['set'](_0x3365('0x1f'),_0x22dc43+'-'+_0x112fad+'/'+_0x5e6dba)[_0x3365('0x1b')](_0x534714);}return null;};}function patchUpdates(_0x1f24f7){return function(_0x49efd1){try{jsonpatch['apply'](_0x49efd1,_0x1f24f7,!![]);}catch(_0x4cd0f6){return BPromise[_0x3365('0x20')](_0x4cd0f6);}return _0x49efd1[_0x3365('0x21')]();};}function saveUpdates(_0xf702db,_0x4da9a0){return function(_0x1449b1){if(_0x1449b1){return _0x1449b1['update'](_0xf702db)[_0x3365('0x22')](function(_0x465f66){return _0x465f66;});}return null;};}function removeEntity(_0x4118f4,_0x5cac92){return function(_0x2893dd){if(_0x2893dd){return _0x2893dd[_0x3365('0x23')]()[_0x3365('0x22')](function(){_0x4118f4[_0x3365('0x1e')](0xcc)[_0x3365('0x24')]();});}};}function handleEntityNotFound(_0x3661fc,_0x27eb5f){return function(_0xf430bf){if(!_0xf430bf){_0x3661fc[_0x3365('0x1a')](0x194);}return _0xf430bf;};}function handleError(_0x3b7f05,_0x5b12fd){_0x5b12fd=_0x5b12fd||0x1f4;return function(_0xa8423a){logger[_0x3365('0x25')](_0xa8423a[_0x3365('0x26')]);if(_0xa8423a[_0x3365('0x27')]){delete _0xa8423a[_0x3365('0x27')];}_0x3b7f05['status'](_0x5b12fd)[_0x3365('0x28')](_0xa8423a);};}exports[_0x3365('0x29')]=function(_0x34fb4e,_0x30e6ab){var _0x428cfb={},_0x5346ab={},_0x297360={'count':0x0,'rows':[]};var _0x7d8a36=_[_0x3365('0x2a')](db[_0x3365('0x2b')][_0x3365('0x2c')],function(_0x1bc074){return{'name':_0x1bc074[_0x3365('0x2d')],'type':_0x1bc074['type'][_0x3365('0x2e')]};});_0x5346ab[_0x3365('0x2f')]=_[_0x3365('0x2a')](_0x7d8a36,_0x3365('0x27'));_0x5346ab['query']=_['keys'](_0x34fb4e[_0x3365('0x30')]);_0x5346ab[_0x3365('0x31')]=_['intersection'](_0x5346ab[_0x3365('0x2f')],_0x5346ab[_0x3365('0x30')]);_0x428cfb['attributes']=_[_0x3365('0x32')](_0x5346ab[_0x3365('0x2f')],qs['fields'](_0x34fb4e[_0x3365('0x30')]['fields']));_0x428cfb['attributes']=_0x428cfb[_0x3365('0x33')][_0x3365('0x34')]?_0x428cfb[_0x3365('0x33')]:_0x5346ab['model'];if(!_0x34fb4e[_0x3365('0x30')][_0x3365('0x35')](_0x3365('0x36'))){_0x428cfb[_0x3365('0x1d')]=qs['limit'](_0x34fb4e[_0x3365('0x30')]['limit']);_0x428cfb[_0x3365('0x1c')]=qs['offset'](_0x34fb4e[_0x3365('0x30')][_0x3365('0x1c')]);}_0x428cfb[_0x3365('0x37')]=qs['sort'](_0x34fb4e[_0x3365('0x30')]['sort']);_0x428cfb['where']=qs['filters'](_['pick'](_0x34fb4e[_0x3365('0x30')],_0x5346ab[_0x3365('0x31')]),_0x7d8a36);if(_0x34fb4e[_0x3365('0x30')]['filter']){_0x428cfb[_0x3365('0x38')]=_[_0x3365('0x39')](_0x428cfb[_0x3365('0x38')],{'$or':_[_0x3365('0x2a')](_0x7d8a36,function(_0x3a236b){if(_0x3a236b[_0x3365('0x3a')]!==_0x3365('0x3b')){var _0x414734={};_0x414734[_0x3a236b[_0x3365('0x27')]]={'$like':'%'+_0x34fb4e[_0x3365('0x30')]['filter']+'%'};return _0x414734;}})});}_0x428cfb=_['merge']({},_0x428cfb,_0x34fb4e[_0x3365('0x3c')]);var _0x300320={'where':_0x428cfb[_0x3365('0x38')]};return db[_0x3365('0x2b')][_0x3365('0x3d')](_0x300320)[_0x3365('0x22')](function(_0x4d1489){_0x297360[_0x3365('0x3d')]=_0x4d1489;if(_0x34fb4e['query'][_0x3365('0x3e')]){_0x428cfb[_0x3365('0x3f')]=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x428cfb);})[_0x3365('0x22')](function(_0x35b33d){_0x297360['rows']=_0x35b33d;return _0x297360;})[_0x3365('0x22')](respondWithFilteredResult(_0x30e6ab,_0x428cfb))['catch'](handleError(_0x30e6ab,null));};exports['show']=function(_0x4cdad0,_0x177d16){var _0x23c319={'raw':!![],'where':{'id':_0x4cdad0[_0x3365('0x40')]['id']}},_0x53638d={};_0x53638d[_0x3365('0x2f')]=_[_0x3365('0x41')](db[_0x3365('0x2b')]['rawAttributes']);_0x53638d[_0x3365('0x30')]=_[_0x3365('0x41')](_0x4cdad0['query']);_0x53638d[_0x3365('0x31')]=_['intersection'](_0x53638d[_0x3365('0x2f')],_0x53638d[_0x3365('0x30')]);_0x23c319[_0x3365('0x33')]=_[_0x3365('0x32')](_0x53638d[_0x3365('0x2f')],qs[_0x3365('0x42')](_0x4cdad0[_0x3365('0x30')][_0x3365('0x42')]));_0x23c319[_0x3365('0x33')]=_0x23c319[_0x3365('0x33')][_0x3365('0x34')]?_0x23c319[_0x3365('0x33')]:_0x53638d['model'];if(_0x4cdad0['query'][_0x3365('0x3e')]){_0x23c319[_0x3365('0x3f')]=[{'all':!![]}];}_0x23c319=_[_0x3365('0x39')]({},_0x23c319,_0x4cdad0[_0x3365('0x3c')]);return db[_0x3365('0x2b')]['find'](_0x23c319)[_0x3365('0x22')](handleEntityNotFound(_0x177d16,null))[_0x3365('0x22')](respondWithResult(_0x177d16,null))[_0x3365('0x43')](handleError(_0x177d16,null));};exports[_0x3365('0x44')]=function(_0x44f4eb,_0x15e195){return db[_0x3365('0x2b')][_0x3365('0x44')](_0x44f4eb[_0x3365('0x45')],{})['then'](respondWithResult(_0x15e195,0xc9))[_0x3365('0x43')](handleError(_0x15e195,null));};exports[_0x3365('0x46')]=function(_0x2655e1,_0x20dea8){if(_0x2655e1[_0x3365('0x45')]['id']){delete _0x2655e1['body']['id'];}return db[_0x3365('0x2b')]['find']({'where':{'id':_0x2655e1[_0x3365('0x40')]['id']}})[_0x3365('0x22')](handleEntityNotFound(_0x20dea8,null))['then'](saveUpdates(_0x2655e1[_0x3365('0x45')],null))['then'](respondWithResult(_0x20dea8,null))['catch'](handleError(_0x20dea8,null));};exports['destroy']=function(_0x44368b,_0x1907a8){return db['MemberReport'][_0x3365('0x47')]({'where':{'id':_0x44368b[_0x3365('0x40')]['id']}})['then'](handleEntityNotFound(_0x1907a8,null))[_0x3365('0x22')](removeEntity(_0x1907a8,null))[_0x3365('0x43')](handleError(_0x1907a8,null));};exports[_0x3365('0x48')]=function(_0x403eda,_0x5882b4){return db[_0x3365('0x2b')][_0x3365('0x48')]()[_0x3365('0x22')](respondWithResult(_0x5882b4,null))[_0x3365('0x43')](handleError(_0x5882b4,null));}; \ No newline at end of file +var _0xd9df=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x102469,_0x3af853){var _0x57cd31=function(_0x57de24){while(--_0x57de24){_0x102469['push'](_0x102469['shift']());}};_0x57cd31(++_0x3af853);}(_0xd9df,0x7e));var _0xfd9d=function(_0x13d3ad,_0x245d7b){_0x13d3ad=_0x13d3ad-0x0;var _0x42fe16=_0xd9df[_0x13d3ad];return _0x42fe16;};'use strict';var pdf=require(_0xfd9d('0x0'));var emlformat=require(_0xfd9d('0x1'));var rimraf=require(_0xfd9d('0x2'));var zipdir=require(_0xfd9d('0x3'));var jsonpatch=require(_0xfd9d('0x4'));var rp=require(_0xfd9d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfd9d('0x6'));var util=require(_0xfd9d('0x7'));var path=require('path');var sox=require(_0xfd9d('0x8'));var csv=require(_0xfd9d('0x9'));var ejs=require(_0xfd9d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfd9d('0xb'));var crypto=require(_0xfd9d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd9d('0xd'));var toCsv=require(_0xfd9d('0x9'));var querystring=require(_0xfd9d('0xe'));var Papa=require(_0xfd9d('0xf'));var Redis=require(_0xfd9d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd9d('0x11'));var as=require(_0xfd9d('0x12'));var hardwareService=require(_0xfd9d('0x13'));var logger=require(_0xfd9d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xfd9d('0x15'));var db=require(_0xfd9d('0x16'))['db'];function respondWithStatusCode(_0x4dc71a,_0x55022a){_0x55022a=_0x55022a||0xcc;return function(_0x13ccfc){if(_0x13ccfc){return _0x4dc71a[_0xfd9d('0x17')](_0x55022a);}return _0x4dc71a[_0xfd9d('0x18')](_0x55022a)[_0xfd9d('0x19')]();};}function respondWithResult(_0x22ce18,_0x254e06){_0x254e06=_0x254e06||0xc8;return function(_0x32de76){if(_0x32de76){return _0x22ce18[_0xfd9d('0x18')](_0x254e06)['json'](_0x32de76);}};}function respondWithFilteredResult(_0x5a1753,_0x2f7e4c){return function(_0x226c24){if(_0x226c24){var _0x5f1881=_0x226c24['count'],_0x12bba5=_0x2f7e4c[_0xfd9d('0x1a')],_0x49b4dc=_0x2f7e4c['offset']+_0x2f7e4c[_0xfd9d('0x1b')],_0x3ac4b8;if(_0x49b4dc>=_0x5f1881){_0x49b4dc=_0x5f1881;_0x3ac4b8=0xc8;}else{_0x3ac4b8=0xce;}_0x5a1753[_0xfd9d('0x18')](_0x3ac4b8);return _0x5a1753[_0xfd9d('0x1c')](_0xfd9d('0x1d'),_0x12bba5+'-'+_0x49b4dc+'/'+_0x5f1881)['json'](_0x226c24);}return null;};}function patchUpdates(_0x510bb9){return function(_0x117d7e){try{jsonpatch['apply'](_0x117d7e,_0x510bb9,!![]);}catch(_0x81acf8){return BPromise[_0xfd9d('0x1e')](_0x81acf8);}return _0x117d7e['save']();};}function saveUpdates(_0x51eb79,_0x3148e5){return function(_0x13e269){if(_0x13e269){return _0x13e269[_0xfd9d('0x1f')](_0x51eb79)['then'](function(_0x5fd77){return _0x5fd77;});}return null;};}function removeEntity(_0x17b675,_0x27b42d){return function(_0x11a1d7){if(_0x11a1d7){return _0x11a1d7['destroy']()[_0xfd9d('0x20')](function(){_0x17b675['status'](0xcc)[_0xfd9d('0x19')]();});}};}function handleEntityNotFound(_0x32cc79,_0x331d94){return function(_0x5022c1){if(!_0x5022c1){_0x32cc79[_0xfd9d('0x17')](0x194);}return _0x5022c1;};}function handleError(_0x1fc14f,_0x4ea2ea){_0x4ea2ea=_0x4ea2ea||0x1f4;return function(_0x3bb9c4){logger[_0xfd9d('0x21')](_0x3bb9c4[_0xfd9d('0x22')]);if(_0x3bb9c4[_0xfd9d('0x23')]){delete _0x3bb9c4[_0xfd9d('0x23')];}_0x1fc14f['status'](_0x4ea2ea)[_0xfd9d('0x24')](_0x3bb9c4);};}exports[_0xfd9d('0x25')]=function(_0x247a62,_0x49cda3){var _0x1312a5={},_0x3aeb10={},_0x1edf5d={'count':0x0,'rows':[]};var _0x3c8628=_[_0xfd9d('0x26')](db[_0xfd9d('0x27')][_0xfd9d('0x28')],function(_0x4fce3f){return{'name':_0x4fce3f[_0xfd9d('0x29')],'type':_0x4fce3f['type'][_0xfd9d('0x2a')]};});_0x3aeb10[_0xfd9d('0x2b')]=_['map'](_0x3c8628,_0xfd9d('0x23'));_0x3aeb10['query']=_['keys'](_0x247a62[_0xfd9d('0x2c')]);_0x3aeb10['filters']=_[_0xfd9d('0x2d')](_0x3aeb10[_0xfd9d('0x2b')],_0x3aeb10[_0xfd9d('0x2c')]);_0x1312a5[_0xfd9d('0x2e')]=_[_0xfd9d('0x2d')](_0x3aeb10['model'],qs[_0xfd9d('0x2f')](_0x247a62['query'][_0xfd9d('0x2f')]));_0x1312a5[_0xfd9d('0x2e')]=_0x1312a5[_0xfd9d('0x2e')][_0xfd9d('0x30')]?_0x1312a5[_0xfd9d('0x2e')]:_0x3aeb10[_0xfd9d('0x2b')];if(!_0x247a62[_0xfd9d('0x2c')][_0xfd9d('0x31')](_0xfd9d('0x32'))){_0x1312a5[_0xfd9d('0x1b')]=qs[_0xfd9d('0x1b')](_0x247a62[_0xfd9d('0x2c')]['limit']);_0x1312a5[_0xfd9d('0x1a')]=qs[_0xfd9d('0x1a')](_0x247a62[_0xfd9d('0x2c')]['offset']);}_0x1312a5[_0xfd9d('0x33')]=qs[_0xfd9d('0x34')](_0x247a62['query'][_0xfd9d('0x34')]);_0x1312a5[_0xfd9d('0x35')]=qs['filters'](_['pick'](_0x247a62[_0xfd9d('0x2c')],_0x3aeb10[_0xfd9d('0x36')]),_0x3c8628);if(_0x247a62[_0xfd9d('0x2c')][_0xfd9d('0x37')]){_0x1312a5[_0xfd9d('0x35')]=_[_0xfd9d('0x38')](_0x1312a5[_0xfd9d('0x35')],{'$or':_[_0xfd9d('0x26')](_0x3c8628,function(_0x4ea3ec){if(_0x4ea3ec['type']!==_0xfd9d('0x39')){var _0x1dec65={};_0x1dec65[_0x4ea3ec[_0xfd9d('0x23')]]={'$like':'%'+_0x247a62['query']['filter']+'%'};return _0x1dec65;}})});}_0x1312a5=_[_0xfd9d('0x38')]({},_0x1312a5,_0x247a62[_0xfd9d('0x3a')]);var _0x27ad00={'where':_0x1312a5[_0xfd9d('0x35')]};return db['MemberReport']['count'](_0x27ad00)[_0xfd9d('0x20')](function(_0x4c8f47){_0x1edf5d[_0xfd9d('0x3b')]=_0x4c8f47;if(_0x247a62[_0xfd9d('0x2c')][_0xfd9d('0x3c')]){_0x1312a5['include']=[{'all':!![]}];}return db[_0xfd9d('0x27')][_0xfd9d('0x3d')](_0x1312a5);})[_0xfd9d('0x20')](function(_0xfdc31){_0x1edf5d[_0xfd9d('0x3e')]=_0xfdc31;return _0x1edf5d;})[_0xfd9d('0x20')](respondWithFilteredResult(_0x49cda3,_0x1312a5))[_0xfd9d('0x3f')](handleError(_0x49cda3,null));};exports[_0xfd9d('0x40')]=function(_0xc21ae9,_0x125d6a){var _0x58f647={'raw':!![],'where':{'id':_0xc21ae9[_0xfd9d('0x41')]['id']}},_0x134a1f={};_0x134a1f['model']=_[_0xfd9d('0x42')](db['MemberReport']['rawAttributes']);_0x134a1f['query']=_[_0xfd9d('0x42')](_0xc21ae9[_0xfd9d('0x2c')]);_0x134a1f[_0xfd9d('0x36')]=_[_0xfd9d('0x2d')](_0x134a1f[_0xfd9d('0x2b')],_0x134a1f['query']);_0x58f647[_0xfd9d('0x2e')]=_[_0xfd9d('0x2d')](_0x134a1f[_0xfd9d('0x2b')],qs['fields'](_0xc21ae9['query']['fields']));_0x58f647['attributes']=_0x58f647['attributes']['length']?_0x58f647[_0xfd9d('0x2e')]:_0x134a1f['model'];if(_0xc21ae9[_0xfd9d('0x2c')][_0xfd9d('0x3c')]){_0x58f647['include']=[{'all':!![]}];}_0x58f647=_[_0xfd9d('0x38')]({},_0x58f647,_0xc21ae9[_0xfd9d('0x3a')]);return db[_0xfd9d('0x27')]['find'](_0x58f647)[_0xfd9d('0x20')](handleEntityNotFound(_0x125d6a,null))[_0xfd9d('0x20')](respondWithResult(_0x125d6a,null))[_0xfd9d('0x3f')](handleError(_0x125d6a,null));};exports[_0xfd9d('0x43')]=function(_0x3f8e86,_0x400476){return db['MemberReport'][_0xfd9d('0x43')](_0x3f8e86[_0xfd9d('0x44')],{})[_0xfd9d('0x20')](respondWithResult(_0x400476,0xc9))[_0xfd9d('0x3f')](handleError(_0x400476,null));};exports['update']=function(_0xdf84b,_0xabc0af){if(_0xdf84b['body']['id']){delete _0xdf84b['body']['id'];}return db[_0xfd9d('0x27')][_0xfd9d('0x45')]({'where':{'id':_0xdf84b['params']['id']}})[_0xfd9d('0x20')](handleEntityNotFound(_0xabc0af,null))[_0xfd9d('0x20')](saveUpdates(_0xdf84b[_0xfd9d('0x44')],null))['then'](respondWithResult(_0xabc0af,null))[_0xfd9d('0x3f')](handleError(_0xabc0af,null));};exports[_0xfd9d('0x46')]=function(_0x5c46d8,_0x1987a2){return db[_0xfd9d('0x27')][_0xfd9d('0x45')]({'where':{'id':_0x5c46d8[_0xfd9d('0x41')]['id']}})[_0xfd9d('0x20')](handleEntityNotFound(_0x1987a2,null))[_0xfd9d('0x20')](removeEntity(_0x1987a2,null))[_0xfd9d('0x3f')](handleError(_0x1987a2,null));};exports[_0xfd9d('0x47')]=function(_0xd7a97d,_0x8684e8){return db[_0xfd9d('0x27')][_0xfd9d('0x47')]()[_0xfd9d('0x20')](respondWithResult(_0x8684e8,null))[_0xfd9d('0x3f')](handleError(_0x8684e8,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7734632..bc34d6c 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 _0x595b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MemberReport','membername_interface','interface','util'];(function(_0x41e8a8,_0x38b0fb){var _0x3437fc=function(_0x2d047d){while(--_0x2d047d){_0x41e8a8['push'](_0x41e8a8['shift']());}};_0x3437fc(++_0x38b0fb);}(_0x595b,0x1d3));var _0xb595=function(_0x25acfe,_0x3797bc){_0x25acfe=_0x25acfe-0x0;var _0x547928=_0x595b[_0x25acfe];return _0x547928;};'use strict';var _=require('lodash');var util=require(_0xb595('0x0'));var logger=require(_0xb595('0x1'))('api');var moment=require(_0xb595('0x2'));var BPromise=require(_0xb595('0x3'));var rp=require(_0xb595('0x4'));var fs=require('fs');var path=require(_0xb595('0x5'));var rimraf=require(_0xb595('0x6'));var config=require(_0xb595('0x7'));var attributes=require('./memberReport.attributes');module[_0xb595('0x8')]=function(_0x5d201d,_0x35d6e4){return _0x5d201d[_0xb595('0x9')](_0xb595('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xb595('0xb'),'fields':['membername',_0xb595('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d95=['define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./memberReport.attributes','exports'];(function(_0x25d4b1,_0x4e896d){var _0x2d51a5=function(_0x9c766){while(--_0x9c766){_0x25d4b1['push'](_0x25d4b1['shift']());}};_0x2d51a5(++_0x4e896d);}(_0x5d95,0x83));var _0x55d9=function(_0x37f0e0,_0x155351){_0x37f0e0=_0x37f0e0-0x0;var _0x363c7e=_0x5d95[_0x37f0e0];return _0x363c7e;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var logger=require(_0x55d9('0x2'))(_0x55d9('0x3'));var moment=require(_0x55d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x55d9('0x5'));var config=require(_0x55d9('0x6'));var attributes=require(_0x55d9('0x7'));module[_0x55d9('0x8')]=function(_0x4ed7fd,_0x162189){return _0x4ed7fd[_0x55d9('0x9')]('MemberReport',attributes,{'tableName':_0x55d9('0xa'),'paranoid':![],'indexes':[{'name':_0x55d9('0xb'),'fields':[_0x55d9('0xc'),_0x55d9('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 9c575e6..24fb038 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 _0x0c35=['error','MemberReport,\x20%s,\x20%s','message','result','findAll','options','raw','where','limit','include','map','model','attributes','then','info','GetMemberReport','catch','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xbe1758,_0x3e6fad){var _0x514837=function(_0x422f2a){while(--_0x422f2a){_0xbe1758['push'](_0xbe1758['shift']());}};_0x514837(++_0x3e6fad);}(_0x0c35,0x69));var _0x50c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c35[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x50c3('0x0'));var util=require(_0x50c3('0x1'));var moment=require('moment');var BPromise=require(_0x50c3('0x2'));var rs=require(_0x50c3('0x3'));var fs=require('fs');var Redis=require(_0x50c3('0x4'));var db=require(_0x50c3('0x5'))['db'];var utils=require(_0x50c3('0x6'));var logger=require(_0x50c3('0x7'))(_0x50c3('0x8'));var config=require(_0x50c3('0x9'));var jayson=require(_0x50c3('0xa'));var client=jayson[_0x50c3('0xb')][_0x50c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcf7744,_0x297906,_0x889568){return new BPromise(function(_0x378c91,_0x2e372e){return client[_0x50c3('0xd')](_0xcf7744,_0x889568)['then'](function(_0x5e458e){logger['info']('MemberReport,\x20%s,\x20%s',_0x297906,_0x50c3('0xe'));logger[_0x50c3('0xf')](_0x50c3('0x10'),_0x297906,_0x50c3('0xe'),JSON[_0x50c3('0x11')](_0x5e458e));if(_0x5e458e[_0x50c3('0x12')]){if(_0x5e458e[_0x50c3('0x12')]['code']===0x1f4){logger['error'](_0x50c3('0x13'),_0x297906,_0x5e458e[_0x50c3('0x12')][_0x50c3('0x14')]);return _0x2e372e(_0x5e458e['error'][_0x50c3('0x14')]);}logger[_0x50c3('0x12')](_0x50c3('0x13'),_0x297906,_0x5e458e[_0x50c3('0x12')][_0x50c3('0x14')]);return _0x378c91(_0x5e458e[_0x50c3('0x12')][_0x50c3('0x14')]);}else{logger['info'](_0x50c3('0x13'),_0x297906,_0x50c3('0xe'));_0x378c91(_0x5e458e[_0x50c3('0x15')][_0x50c3('0x14')]);}})['catch'](function(_0x182d00){logger[_0x50c3('0x12')](_0x50c3('0x13'),_0x297906,_0x182d00);_0x2e372e(_0x182d00);});});}exports['GetMemberReport']=function(_0x4da70f){var _0x1b77da=this;return new Promise(function(_0x1f1a3b,_0x519e1c){return db['MemberReport'][_0x50c3('0x16')]({'raw':_0x4da70f[_0x50c3('0x17')]?_0x4da70f[_0x50c3('0x17')][_0x50c3('0x18')]===undefined?!![]:![]:!![],'where':_0x4da70f[_0x50c3('0x17')]?_0x4da70f[_0x50c3('0x17')][_0x50c3('0x19')]||null:null,'attributes':_0x4da70f['options']?_0x4da70f[_0x50c3('0x17')]['attributes']||null:null,'limit':_0x4da70f['options']?_0x4da70f['options'][_0x50c3('0x1a')]||null:null,'include':_0x4da70f[_0x50c3('0x17')]?_0x4da70f[_0x50c3('0x17')][_0x50c3('0x1b')]?_[_0x50c3('0x1c')](_0x4da70f[_0x50c3('0x17')][_0x50c3('0x1b')],function(_0x35dc19){return{'model':db[_0x35dc19[_0x50c3('0x1d')]],'as':_0x35dc19['as'],'attributes':_0x35dc19[_0x50c3('0x1e')],'include':_0x35dc19['include']?_[_0x50c3('0x1c')](_0x35dc19[_0x50c3('0x1b')],function(_0x55578c){return{'model':db[_0x55578c['model']],'as':_0x55578c['as'],'attributes':_0x55578c['attributes'],'include':_0x55578c[_0x50c3('0x1b')]?_['map'](_0x55578c[_0x50c3('0x1b')],function(_0x1e8647){return{'model':db[_0x1e8647['model']],'as':_0x1e8647['as'],'attributes':_0x1e8647['attributes']};}):[]};}):[]};}):[]:[]})[_0x50c3('0x1f')](function(_0xef0a9a){logger[_0x50c3('0x20')]('GetMemberReport',_0x4da70f);logger[_0x50c3('0xf')](_0x50c3('0x21'),_0x4da70f,JSON[_0x50c3('0x11')](_0xef0a9a));_0x1f1a3b(_0xef0a9a);})[_0x50c3('0x22')](function(_0x1e6194){logger[_0x50c3('0x12')](_0x50c3('0x21'),_0x1e6194[_0x50c3('0x14')],_0x4da70f);_0x519e1c(_0x1b77da[_0x50c3('0x12')](0x1f4,_0x1e6194[_0x50c3('0x14')]));});});};exports[_0x50c3('0x23')]=function(_0x2dee3d){var _0x34ed1e=this;return new Promise(function(_0x3b3fe2,_0x487d20){return db[_0x50c3('0x24')][_0x50c3('0x25')](_0x2dee3d[_0x50c3('0x26')],{'raw':_0x2dee3d[_0x50c3('0x17')]?_0x2dee3d[_0x50c3('0x17')][_0x50c3('0x18')]===undefined?!![]:![]:!![]})[_0x50c3('0x1f')](function(_0x3d38c5){logger['info'](_0x50c3('0x23'),_0x2dee3d);logger[_0x50c3('0xf')](_0x50c3('0x23'),_0x2dee3d,JSON['stringify'](_0x3d38c5));_0x3b3fe2(_0x3d38c5);})['catch'](function(_0x5d6aa9){logger[_0x50c3('0x12')](_0x50c3('0x23'),_0x5d6aa9[_0x50c3('0x14')],_0x2dee3d);_0x487d20(_0x34ed1e['error'](0x1f4,_0x5d6aa9[_0x50c3('0x14')]));});});};exports[_0x50c3('0x27')]=function(_0xf26cf5){var _0x4ba87d=this;return new Promise(function(_0x9e1b07,_0x15e598){return db[_0x50c3('0x24')][_0x50c3('0x28')](_0xf26cf5[_0x50c3('0x26')],{'raw':_0xf26cf5[_0x50c3('0x17')]?_0xf26cf5[_0x50c3('0x17')][_0x50c3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf26cf5[_0x50c3('0x17')]?_0xf26cf5['options']['where']||null:null,'attributes':_0xf26cf5[_0x50c3('0x17')]?_0xf26cf5[_0x50c3('0x17')][_0x50c3('0x1e')]||null:null,'limit':_0xf26cf5[_0x50c3('0x17')]?_0xf26cf5['options'][_0x50c3('0x1a')]||null:null})[_0x50c3('0x1f')](function(_0x39fdda){logger[_0x50c3('0x20')](_0x50c3('0x27'),_0xf26cf5);logger[_0x50c3('0xf')]('UpdateMemberReport',_0xf26cf5,JSON['stringify'](_0x39fdda));_0x9e1b07(_0x39fdda);})[_0x50c3('0x22')](function(_0xea5103){logger[_0x50c3('0x12')](_0x50c3('0x27'),_0xea5103['message'],_0xf26cf5);_0x15e598(_0x4ba87d[_0x50c3('0x12')](0x1f4,_0xea5103[_0x50c3('0x14')]));});});}; \ No newline at end of file +var _0x450e=['MemberReport','findAll','options','raw','where','attributes','include','model','map','CreateMemberReport','body','UpdateMemberReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport'];(function(_0xc9e918,_0x5933af){var _0x4dbd3b=function(_0x4f495a){while(--_0x4f495a){_0xc9e918['push'](_0xc9e918['shift']());}};_0x4dbd3b(++_0x5933af);}(_0x450e,0x83));var _0xe450=function(_0x2f2760,_0x355d81){_0x2f2760=_0x2f2760-0x0;var _0xa6e967=_0x450e[_0x2f2760];return _0xa6e967;};'use strict';var _=require(_0xe450('0x0'));var util=require(_0xe450('0x1'));var moment=require(_0xe450('0x2'));var BPromise=require(_0xe450('0x3'));var rs=require(_0xe450('0x4'));var fs=require('fs');var Redis=require(_0xe450('0x5'));var db=require(_0xe450('0x6'))['db'];var utils=require(_0xe450('0x7'));var logger=require(_0xe450('0x8'))(_0xe450('0x9'));var config=require(_0xe450('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe450('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdbab9c,_0x448d6d,_0x567324){return new BPromise(function(_0x3920a1,_0x4b92f1){return client['request'](_0xdbab9c,_0x567324)[_0xe450('0xc')](function(_0x207a34){logger['info'](_0xe450('0xd'),_0x448d6d,_0xe450('0xe'));logger[_0xe450('0xf')](_0xe450('0x10'),_0x448d6d,_0xe450('0xe'),JSON[_0xe450('0x11')](_0x207a34));if(_0x207a34[_0xe450('0x12')]){if(_0x207a34[_0xe450('0x12')][_0xe450('0x13')]===0x1f4){logger[_0xe450('0x12')]('MemberReport,\x20%s,\x20%s',_0x448d6d,_0x207a34[_0xe450('0x12')][_0xe450('0x14')]);return _0x4b92f1(_0x207a34[_0xe450('0x12')]['message']);}logger[_0xe450('0x12')](_0xe450('0xd'),_0x448d6d,_0x207a34['error'][_0xe450('0x14')]);return _0x3920a1(_0x207a34['error']['message']);}else{logger[_0xe450('0x15')](_0xe450('0xd'),_0x448d6d,_0xe450('0xe'));_0x3920a1(_0x207a34[_0xe450('0x16')]['message']);}})[_0xe450('0x17')](function(_0x468156){logger['error'](_0xe450('0xd'),_0x448d6d,_0x468156);_0x4b92f1(_0x468156);});});}exports[_0xe450('0x18')]=function(_0x1e391d){var _0x50d07e=this;return new Promise(function(_0x5ea505,_0x52108e){return db[_0xe450('0x19')][_0xe450('0x1a')]({'raw':_0x1e391d[_0xe450('0x1b')]?_0x1e391d[_0xe450('0x1b')][_0xe450('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e391d['options']?_0x1e391d[_0xe450('0x1b')][_0xe450('0x1d')]||null:null,'attributes':_0x1e391d['options']?_0x1e391d['options'][_0xe450('0x1e')]||null:null,'limit':_0x1e391d[_0xe450('0x1b')]?_0x1e391d[_0xe450('0x1b')]['limit']||null:null,'include':_0x1e391d[_0xe450('0x1b')]?_0x1e391d[_0xe450('0x1b')][_0xe450('0x1f')]?_['map'](_0x1e391d['options'][_0xe450('0x1f')],function(_0x159472){return{'model':db[_0x159472[_0xe450('0x20')]],'as':_0x159472['as'],'attributes':_0x159472['attributes'],'include':_0x159472[_0xe450('0x1f')]?_[_0xe450('0x21')](_0x159472[_0xe450('0x1f')],function(_0x114fa0){return{'model':db[_0x114fa0[_0xe450('0x20')]],'as':_0x114fa0['as'],'attributes':_0x114fa0[_0xe450('0x1e')],'include':_0x114fa0[_0xe450('0x1f')]?_['map'](_0x114fa0[_0xe450('0x1f')],function(_0x424d33){return{'model':db[_0x424d33['model']],'as':_0x424d33['as'],'attributes':_0x424d33[_0xe450('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe450('0xc')](function(_0x5e6614){logger[_0xe450('0x15')](_0xe450('0x18'),_0x1e391d);logger['debug'](_0xe450('0x18'),_0x1e391d,JSON[_0xe450('0x11')](_0x5e6614));_0x5ea505(_0x5e6614);})[_0xe450('0x17')](function(_0x6a7db){logger['error'](_0xe450('0x18'),_0x6a7db['message'],_0x1e391d);_0x52108e(_0x50d07e[_0xe450('0x12')](0x1f4,_0x6a7db[_0xe450('0x14')]));});});};exports[_0xe450('0x22')]=function(_0xa21c38){var _0x3b39b2=this;return new Promise(function(_0x2dc380,_0x346bad){return db[_0xe450('0x19')]['create'](_0xa21c38[_0xe450('0x23')],{'raw':_0xa21c38[_0xe450('0x1b')]?_0xa21c38[_0xe450('0x1b')][_0xe450('0x1c')]===undefined?!![]:![]:!![]})[_0xe450('0xc')](function(_0x304c7c){logger[_0xe450('0x15')]('CreateMemberReport',_0xa21c38);logger[_0xe450('0xf')](_0xe450('0x22'),_0xa21c38,JSON[_0xe450('0x11')](_0x304c7c));_0x2dc380(_0x304c7c);})[_0xe450('0x17')](function(_0x3917ba){logger[_0xe450('0x12')](_0xe450('0x22'),_0x3917ba[_0xe450('0x14')],_0xa21c38);_0x346bad(_0x3b39b2[_0xe450('0x12')](0x1f4,_0x3917ba[_0xe450('0x14')]));});});};exports[_0xe450('0x24')]=function(_0x2e35f3){var _0x5a0fdf=this;return new Promise(function(_0xa07c53,_0x3b4144){return db[_0xe450('0x19')][_0xe450('0x25')](_0x2e35f3[_0xe450('0x23')],{'raw':_0x2e35f3[_0xe450('0x1b')]?_0x2e35f3['options'][_0xe450('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e35f3[_0xe450('0x1b')]?_0x2e35f3[_0xe450('0x1b')][_0xe450('0x1d')]||null:null,'attributes':_0x2e35f3[_0xe450('0x1b')]?_0x2e35f3['options'][_0xe450('0x1e')]||null:null,'limit':_0x2e35f3[_0xe450('0x1b')]?_0x2e35f3[_0xe450('0x1b')][_0xe450('0x26')]||null:null})['then'](function(_0x12cef4){logger[_0xe450('0x15')](_0xe450('0x24'),_0x2e35f3);logger[_0xe450('0xf')](_0xe450('0x24'),_0x2e35f3,JSON[_0xe450('0x11')](_0x12cef4));_0xa07c53(_0x12cef4);})[_0xe450('0x17')](function(_0x2d5bc1){logger[_0xe450('0x12')](_0xe450('0x24'),_0x2d5bc1[_0xe450('0x14')],_0x2e35f3);_0x3b4144(_0x5a0fdf['error'](0x1f4,_0x2d5bc1[_0xe450('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 3f8f89e..29d2ae7 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 _0x13f6=['../../config/environment','./migration.controller','get','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x13f6,0x124));var _0x613f=function(_0xd1a5ff,_0x267b33){_0xd1a5ff=_0xd1a5ff-0x0;var _0x2aa281=_0x13f6[_0xd1a5ff];return _0x2aa281;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var auth=require(_0x613f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x613f('0x5'));var controller=require(_0x613f('0x6'));router[_0x613f('0x7')]('/',controller['index']);module[_0x613f('0x8')]=router; \ No newline at end of file +var _0xb7e7=['./migration.controller','get','multer','path','express','../../components/auth/service','../../config/environment'];(function(_0x55e9e5,_0x587201){var _0x1af1f0=function(_0x4c23ea){while(--_0x4c23ea){_0x55e9e5['push'](_0x55e9e5['shift']());}};_0x1af1f0(++_0x587201);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb7e7[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',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 4ef9f1f..983c404 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 _0xd7d6=['sequelize','STRING','version'];(function(_0x302b5e,_0x564a8e){var _0x523ab7=function(_0x6aec8f){while(--_0x6aec8f){_0x302b5e['push'](_0x302b5e['shift']());}};_0x523ab7(++_0x564a8e);}(_0xd7d6,0x14a));var _0x6d7d=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0xd7d6[_0x3f25db];return _0x54f29d;};'use strict';var Sequelize=require(_0x6d7d('0x0'));module['exports']={'version':{'type':Sequelize[_0x6d7d('0x1')],'unique':_0x6d7d('0x2')}}; \ No newline at end of file +var _0x0eb6=['exports','version'];(function(_0x2f7db9,_0xb5a3a5){var _0x4440da=function(_0x12d35b){while(--_0x12d35b){_0x2f7db9['push'](_0x2f7db9['shift']());}};_0x4440da(++_0xb5a3a5);}(_0x0eb6,0xc4));var _0x60eb=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x0eb6[_0x2aee2f];return _0x19337f;};'use strict';var Sequelize=require('sequelize');module[_0x60eb('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x60eb('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 87c8efa..8712802 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 _0x9c44=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Migration','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['index']=function(_0x543ea2,_0x449960){var _0x53c199={},_0x3800b7={},_0x3852b2={'count':0x0,'rows':[]};var _0x3f1708=_[_0x49c4('0x24')](db['Migration'][_0x49c4('0x25')],function(_0x2b2793){return{'name':_0x2b2793[_0x49c4('0x26')],'type':_0x2b2793[_0x49c4('0x27')][_0x49c4('0x28')]};});_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x24')](_0x3f1708,_0x49c4('0x22'));_0x3800b7[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x543ea2[_0x49c4('0x2a')]);_0x3800b7['filters']=_['intersection'](_0x3800b7['model'],_0x3800b7[_0x49c4('0x2a')]);_0x53c199[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x3800b7[_0x49c4('0x29')],qs[_0x49c4('0x2e')](_0x543ea2['query'][_0x49c4('0x2e')]));_0x53c199[_0x49c4('0x2c')]=_0x53c199[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0x53c199['attributes']:_0x3800b7['model'];if(!_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x30')](_0x49c4('0x31'))){_0x53c199[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x543ea2['query'][_0x49c4('0x1a')]);_0x53c199[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x543ea2['query']['offset']);}_0x53c199[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x33')]);_0x53c199[_0x49c4('0x34')]=qs[_0x49c4('0x35')](_[_0x49c4('0x36')](_0x543ea2[_0x49c4('0x2a')],_0x3800b7[_0x49c4('0x35')]),_0x3f1708);if(_0x543ea2['query'][_0x49c4('0x37')]){_0x53c199['where']=_[_0x49c4('0x38')](_0x53c199[_0x49c4('0x34')],{'$or':_[_0x49c4('0x24')](_0x3f1708,function(_0x1c2830){if(_0x1c2830['type']!==_0x49c4('0x39')){var _0x31f3ff={};_0x31f3ff[_0x1c2830[_0x49c4('0x22')]]={'$like':'%'+_0x543ea2['query'][_0x49c4('0x37')]+'%'};return _0x31f3ff;}})});}_0x53c199=_[_0x49c4('0x38')]({},_0x53c199,_0x543ea2[_0x49c4('0x3a')]);var _0x5e5366={'where':_0x53c199[_0x49c4('0x34')]};return db[_0x49c4('0x3b')][_0x49c4('0x18')](_0x5e5366)[_0x49c4('0x20')](function(_0x70e552){_0x3852b2[_0x49c4('0x18')]=_0x70e552;if(_0x543ea2[_0x49c4('0x2a')]['includeAll']){_0x53c199[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x3b')][_0x49c4('0x3d')](_0x53c199);})[_0x49c4('0x20')](function(_0x41ad28){_0x3852b2[_0x49c4('0x3e')]=_0x41ad28;return _0x3852b2;})[_0x49c4('0x20')](respondWithFilteredResult(_0x449960,_0x53c199))[_0x49c4('0x3f')](handleError(_0x449960,null));}; \ No newline at end of file +var _0xb43b=['filters','pick','filter','merge','options','count','includeAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','Migration','rawAttributes','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb43b,0x1b2));var _0xbb43=function(_0x85f701,_0x2d999f){_0x85f701=_0x85f701-0x0;var _0x44c4e9=_0xb43b[_0x85f701];return _0x44c4e9;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require(_0xbb43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require('moment');var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb43('0x9'));var fs=require('fs');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 db=require(_0xbb43('0x17'))['db'];function respondWithStatusCode(_0x2a5a4d,_0x50e2c0){_0x50e2c0=_0x50e2c0||0xcc;return function(_0x578392){if(_0x578392){return _0x2a5a4d[_0xbb43('0x18')](_0x50e2c0);}return _0x2a5a4d['status'](_0x50e2c0)['end']();};}function respondWithResult(_0x438591,_0x5a509f){_0x5a509f=_0x5a509f||0xc8;return function(_0x68d45d){if(_0x68d45d){return _0x438591[_0xbb43('0x19')](_0x5a509f)['json'](_0x68d45d);}};}function respondWithFilteredResult(_0x4a6e18,_0x4d5bcf){return function(_0x338120){if(_0x338120){var _0x2abce0=_0x338120['count'],_0x57bd1d=_0x4d5bcf['offset'],_0x526330=_0x4d5bcf[_0xbb43('0x1a')]+_0x4d5bcf[_0xbb43('0x1b')],_0x202980;if(_0x526330>=_0x2abce0){_0x526330=_0x2abce0;_0x202980=0xc8;}else{_0x202980=0xce;}_0x4a6e18[_0xbb43('0x19')](_0x202980);return _0x4a6e18['set'](_0xbb43('0x1c'),_0x57bd1d+'-'+_0x526330+'/'+_0x2abce0)['json'](_0x338120);}return null;};}function patchUpdates(_0x3bb57d){return function(_0x8e6429){try{jsonpatch['apply'](_0x8e6429,_0x3bb57d,!![]);}catch(_0x5d765b){return BPromise[_0xbb43('0x1d')](_0x5d765b);}return _0x8e6429[_0xbb43('0x1e')]();};}function saveUpdates(_0xdb7f2e,_0x2bf2d4){return function(_0x5bcce7){if(_0x5bcce7){return _0x5bcce7[_0xbb43('0x1f')](_0xdb7f2e)['then'](function(_0x3a257d){return _0x3a257d;});}return null;};}function removeEntity(_0x4bfaca,_0x2f5e31){return function(_0x565256){if(_0x565256){return _0x565256[_0xbb43('0x20')]()[_0xbb43('0x21')](function(){_0x4bfaca['status'](0xcc)[_0xbb43('0x22')]();});}};}function handleEntityNotFound(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(!_0x298ce2){_0x4dfb7f[_0xbb43('0x18')](0x194);}return _0x298ce2;};}function handleError(_0x4d6d77,_0x53f0d5){_0x53f0d5=_0x53f0d5||0x1f4;return function(_0x59a24d){logger[_0xbb43('0x23')](_0x59a24d[_0xbb43('0x24')]);if(_0x59a24d['name']){delete _0x59a24d[_0xbb43('0x25')];}_0x4d6d77[_0xbb43('0x19')](_0x53f0d5)[_0xbb43('0x26')](_0x59a24d);};}exports[_0xbb43('0x27')]=function(_0x4ed43f,_0x4b5342){var _0x27fd7a={},_0x42800f={},_0xa88db0={'count':0x0,'rows':[]};var _0x8b3205=_[_0xbb43('0x28')](db[_0xbb43('0x29')][_0xbb43('0x2a')],function(_0x473828){return{'name':_0x473828['fieldName'],'type':_0x473828[_0xbb43('0x2b')]['key']};});_0x42800f[_0xbb43('0x2c')]=_[_0xbb43('0x28')](_0x8b3205,_0xbb43('0x25'));_0x42800f[_0xbb43('0x2d')]=_['keys'](_0x4ed43f[_0xbb43('0x2d')]);_0x42800f['filters']=_['intersection'](_0x42800f['model'],_0x42800f[_0xbb43('0x2d')]);_0x27fd7a['attributes']=_[_0xbb43('0x2e')](_0x42800f[_0xbb43('0x2c')],qs[_0xbb43('0x2f')](_0x4ed43f['query'][_0xbb43('0x2f')]));_0x27fd7a[_0xbb43('0x30')]=_0x27fd7a[_0xbb43('0x30')][_0xbb43('0x31')]?_0x27fd7a[_0xbb43('0x30')]:_0x42800f[_0xbb43('0x2c')];if(!_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x32')]('nolimit')){_0x27fd7a[_0xbb43('0x1b')]=qs[_0xbb43('0x1b')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x1b')]);_0x27fd7a[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x1a')]);}_0x27fd7a[_0xbb43('0x33')]=qs[_0xbb43('0x34')](_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x34')]);_0x27fd7a[_0xbb43('0x35')]=qs[_0xbb43('0x36')](_[_0xbb43('0x37')](_0x4ed43f[_0xbb43('0x2d')],_0x42800f['filters']),_0x8b3205);if(_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x38')]){_0x27fd7a['where']=_[_0xbb43('0x39')](_0x27fd7a[_0xbb43('0x35')],{'$or':_[_0xbb43('0x28')](_0x8b3205,function(_0x5374a2){if(_0x5374a2['type']!=='VIRTUAL'){var _0x40df31={};_0x40df31[_0x5374a2[_0xbb43('0x25')]]={'$like':'%'+_0x4ed43f['query']['filter']+'%'};return _0x40df31;}})});}_0x27fd7a=_[_0xbb43('0x39')]({},_0x27fd7a,_0x4ed43f[_0xbb43('0x3a')]);var _0x29f6e5={'where':_0x27fd7a[_0xbb43('0x35')]};return db[_0xbb43('0x29')]['count'](_0x29f6e5)[_0xbb43('0x21')](function(_0x526cb8){_0xa88db0[_0xbb43('0x3b')]=_0x526cb8;if(_0x4ed43f[_0xbb43('0x2d')][_0xbb43('0x3c')]){_0x27fd7a['include']=[{'all':!![]}];}return db[_0xbb43('0x29')]['findAll'](_0x27fd7a);})[_0xbb43('0x21')](function(_0x93aa1c){_0xa88db0['rows']=_0x93aa1c;return _0xa88db0;})[_0xbb43('0x21')](respondWithFilteredResult(_0x4b5342,_0x27fd7a))['catch'](handleError(_0x4b5342,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6d9e45f..66f7c9d 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 _0xbf36=['api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbf36,0x111));var _0x6bf3=function(_0x3b2428,_0x1f5029){_0x3b2428=_0x3b2428-0x0;var _0x3dad94=_0xbf36[_0x3b2428];return _0x3dad94;};'use strict';var _=require(_0x6bf3('0x0'));var util=require(_0x6bf3('0x1'));var logger=require(_0x6bf3('0x2'))(_0x6bf3('0x3'));var moment=require(_0x6bf3('0x4'));var BPromise=require(_0x6bf3('0x5'));var rp=require(_0x6bf3('0x6'));var fs=require('fs');var path=require(_0x6bf3('0x7'));var rimraf=require('rimraf');var config=require(_0x6bf3('0x8'));var attributes=require(_0x6bf3('0x9'));module[_0x6bf3('0xa')]=function(_0x1545a9,_0x4361be){return _0x1545a9[_0x6bf3('0xb')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x628d=['moment','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','util','../../config/logger','api'];(function(_0x15737b,_0x8dcab7){var _0x5ddba4=function(_0x3c526a){while(--_0x3c526a){_0x15737b['push'](_0x15737b['shift']());}};_0x5ddba4(++_0x8dcab7);}(_0x628d,0x11f));var _0xd628=function(_0x26317c,_0x481724){_0x26317c=_0x26317c-0x0;var _0x5e8279=_0x628d[_0x26317c];return _0x5e8279;};'use strict';var _=require('lodash');var util=require(_0xd628('0x0'));var logger=require(_0xd628('0x1'))(_0xd628('0x2'));var moment=require(_0xd628('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd628('0x4'));var config=require(_0xd628('0x5'));var attributes=require(_0xd628('0x6'));module[_0xd628('0x7')]=function(_0x2403ca,_0x3bf615){return _0x2403ca['define'](_0xd628('0x8'),attributes,{'tableName':_0xd628('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 4984625..64de84f 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 _0x4c84=['rpc','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4c84,0x14d));var _0x44c8=function(_0x33944e,_0x30368c){_0x33944e=_0x33944e-0x0;var _0xe722d5=_0x4c84[_0x33944e];return _0xe722d5;};'use strict';var _=require('lodash');var util=require(_0x44c8('0x0'));var moment=require(_0x44c8('0x1'));var BPromise=require(_0x44c8('0x2'));var rs=require(_0x44c8('0x3'));var fs=require('fs');var Redis=require(_0x44c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x44c8('0x5'));var logger=require(_0x44c8('0x6'))(_0x44c8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50dcac,_0xf05eb,_0x13e304){return new BPromise(function(_0x262aaf,_0x27e724){return client[_0x44c8('0x9')](_0x50dcac,_0x13e304)[_0x44c8('0xa')](function(_0x1aa0b1){logger[_0x44c8('0xb')](_0x44c8('0xc'),_0xf05eb,_0x44c8('0xd'));logger[_0x44c8('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0xf05eb,_0x44c8('0xd'),JSON[_0x44c8('0xf')](_0x1aa0b1));if(_0x1aa0b1['error']){if(_0x1aa0b1[_0x44c8('0x10')][_0x44c8('0x11')]===0x1f4){logger[_0x44c8('0x10')](_0x44c8('0xc'),_0xf05eb,_0x1aa0b1[_0x44c8('0x10')]['message']);return _0x27e724(_0x1aa0b1[_0x44c8('0x10')]['message']);}logger[_0x44c8('0x10')](_0x44c8('0xc'),_0xf05eb,_0x1aa0b1['error'][_0x44c8('0x12')]);return _0x262aaf(_0x1aa0b1[_0x44c8('0x10')][_0x44c8('0x12')]);}else{logger[_0x44c8('0xb')](_0x44c8('0xc'),_0xf05eb,_0x44c8('0xd'));_0x262aaf(_0x1aa0b1['result'][_0x44c8('0x12')]);}})[_0x44c8('0x13')](function(_0x2a098c){logger['error'](_0x44c8('0xc'),_0xf05eb,_0x2a098c);_0x27e724(_0x2a098c);});});} \ No newline at end of file +var _0x0570=['request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0x0570,0x172));var _0x0057=function(_0x42e3d5,_0x7ec79d){_0x42e3d5=_0x42e3d5-0x0;var _0x3ddb00=_0x0570[_0x42e3d5];return _0x3ddb00;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var moment=require(_0x0057('0x1'));var BPromise=require(_0x0057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0057('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0057('0x4'));var logger=require('../../config/logger')(_0x0057('0x5'));var config=require(_0x0057('0x6'));var jayson=require(_0x0057('0x7'));var client=jayson[_0x0057('0x8')][_0x0057('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5096e2,_0xc86734,_0x529f55){return new BPromise(function(_0x15d424,_0x2f9d7f){return client[_0x0057('0xa')](_0x5096e2,_0x529f55)[_0x0057('0xb')](function(_0x29b7c6){logger['info'](_0x0057('0xc'),_0xc86734,_0x0057('0xd'));logger[_0x0057('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'),JSON[_0x0057('0xf')](_0x29b7c6));if(_0x29b7c6['error']){if(_0x29b7c6['error'][_0x0057('0x10')]===0x1f4){logger[_0x0057('0x11')](_0x0057('0xc'),_0xc86734,_0x29b7c6['error'][_0x0057('0x12')]);return _0x2f9d7f(_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);}logger[_0x0057('0x11')]('Migration,\x20%s,\x20%s',_0xc86734,_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);return _0x15d424(_0x29b7c6['error'][_0x0057('0x12')]);}else{logger[_0x0057('0x13')]('Migration,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'));_0x15d424(_0x29b7c6['result'][_0x0057('0x12')]);}})['catch'](function(_0x4be851){logger[_0x0057('0x11')]('Migration,\x20%s,\x20%s',_0xc86734,_0x4be851);_0x2f9d7f(_0x4be851);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ed9dd44..c66c14e 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 _0x692c=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x692c,0x166));var _0xc692=function(_0x57771a,_0x1f8495){_0x57771a=_0x57771a-0x0;var _0x425811=_0x692c[_0x57771a];return _0x425811;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc692('0x0'));var timeout=require(_0xc692('0x1'));var express=require(_0xc692('0x2'));var router=express[_0xc692('0x3')]();var auth=require(_0xc692('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc692('0x5'));var controller=require(_0xc692('0x6'));router[_0xc692('0x7')]('/',auth[_0xc692('0x8')](),controller['index']);router[_0xc692('0x7')](_0xc692('0x9'),auth[_0xc692('0x8')](),controller[_0xc692('0xa')]);router[_0xc692('0xb')]('/',auth[_0xc692('0x8')](),controller[_0xc692('0xc')]);router[_0xc692('0xd')](_0xc692('0x9'),auth[_0xc692('0x8')](),controller[_0xc692('0xe')]);router['delete']('/:id',auth[_0xc692('0x8')](),controller[_0xc692('0xf')]);module[_0xc692('0x10')]=router; \ No newline at end of file +var _0xa1ca=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','create','put','destroy','exports'];(function(_0x665aa6,_0x3356ec){var _0x1bc384=function(_0x27ad60){while(--_0x27ad60){_0x665aa6['push'](_0x665aa6['shift']());}};_0x1bc384(++_0x3356ec);}(_0xa1ca,0x99));var _0xaa1c=function(_0x3eb998,_0x4f5cee){_0x3eb998=_0x3eb998-0x0;var _0x272be1=_0xa1ca[_0x3eb998];return _0x272be1;};'use strict';var multer=require(_0xaa1c('0x0'));var util=require(_0xaa1c('0x1'));var path=require(_0xaa1c('0x2'));var timeout=require(_0xaa1c('0x3'));var express=require(_0xaa1c('0x4'));var router=express['Router']();var auth=require(_0xaa1c('0x5'));var interaction=require(_0xaa1c('0x6'));var config=require(_0xaa1c('0x7'));var controller=require(_0xaa1c('0x8'));router[_0xaa1c('0x9')]('/',auth[_0xaa1c('0xa')](),controller[_0xaa1c('0xb')]);router[_0xaa1c('0x9')](_0xaa1c('0xc'),auth[_0xaa1c('0xa')](),controller['show']);router['post']('/',auth[_0xaa1c('0xa')](),controller[_0xaa1c('0xd')]);router[_0xaa1c('0xe')](_0xaa1c('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xaa1c('0xc'),auth['isAuthenticated'](),controller[_0xaa1c('0xf')]);module[_0xaa1c('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f0b9873..1655a22 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(_0x3109de,_0xf815c5){var _0xf4cd2d=function(_0x4ae376){while(--_0x4ae376){_0x3109de['push'](_0x3109de['shift']());}};_0xf4cd2d(++_0xf815c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x16891c,_0x20b5fc){var _0xfe15=function(_0x54366a){while(--_0x54366a){_0x16891c['push'](_0x16891c['shift']());}};_0xfe15(++_0x20b5fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 2ffe815..805518c 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 _0x09bf=['Network','rawAttributes','fieldName','key','map','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','type','VIRTUAL','options','where','count','then','findAll','rows','show','params','keys','include','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','destroy','find','server/files/templates/network.ejs','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Network,\x20%s,\x20%s','result','catch','status','offset','limit','Content-Range','json','apply','reject','save','update','end','stack','name','send','index'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x09bf,0xa5));var _0xf09b=function(_0x4fb84b,_0x1c9dd5){_0x4fb84b=_0x4fb84b-0x0;var _0x479b84=_0x09bf[_0x4fb84b];return _0x479b84;};'use strict';var pdf=require(_0xf09b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf09b('0x1'));var zipdir=require(_0xf09b('0x2'));var jsonpatch=require(_0xf09b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf09b('0x4'));var util=require(_0xf09b('0x5'));var path=require(_0xf09b('0x6'));var sox=require(_0xf09b('0x7'));var csv=require(_0xf09b('0x8'));var ejs=require(_0xf09b('0x9'));var fs=require('fs');var _=require(_0xf09b('0xa'));var squel=require(_0xf09b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf09b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf09b('0xd'));var Redis=require(_0xf09b('0xe'));var authService=require(_0xf09b('0xf'));var qs=require(_0xf09b('0x10'));var as=require(_0xf09b('0x11'));var hardwareService=require(_0xf09b('0x12'));var logger=require(_0xf09b('0x13'))(_0xf09b('0x14'));var utils=require(_0xf09b('0x15'));var config=require(_0xf09b('0x16'));var db=require(_0xf09b('0x17'))['db'];var jayson=require(_0xf09b('0x18'));var client=jayson[_0xf09b('0x19')][_0xf09b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x23b4d7,_0x2b56b2,_0x218ed8){if(_0x218ed8){var _0x2459cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2459cc[_0xf09b('0x1b')](_0x2b56b2)){return _0x23b4d7;}else{throw new db[(_0xf09b('0x1c'))][(_0xf09b('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x23b4d7;}}function respondWithRpcPromise(_0x4be651,_0x4ac260,_0x417c99,_0x2c5191){return new BPromise(function(_0x59951e,_0xd37a26){var _0x4ae84f=_0x2c5191||client;return _0x4ae84f[_0xf09b('0x1e')](_0x4be651,_0x417c99)['then'](function(_0x52776c){logger[_0xf09b('0x1f')]('Network,\x20%s,\x20%s',_0x4ac260,_0xf09b('0x20'));logger['debug'](_0xf09b('0x21'),_0x4ac260,_0xf09b('0x20'),JSON[_0xf09b('0x22')](_0x52776c));if(_0x52776c['error']){if(_0x52776c[_0xf09b('0x23')][_0xf09b('0x24')]===0x1f4){logger[_0xf09b('0x23')]('Network,\x20%s,\x20%s',_0x4ac260,_0x52776c[_0xf09b('0x23')][_0xf09b('0x25')]);return _0xd37a26(_0x52776c['error'][_0xf09b('0x25')]);}logger[_0xf09b('0x23')](_0xf09b('0x26'),_0x4ac260,_0x52776c[_0xf09b('0x23')][_0xf09b('0x25')]);return _0x59951e(_0x52776c[_0xf09b('0x23')][_0xf09b('0x25')]);}else{logger[_0xf09b('0x1f')]('Network,\x20%s,\x20%s',_0x4ac260,_0xf09b('0x20'));_0x59951e(_0x52776c[_0xf09b('0x27')][_0xf09b('0x25')]);}})[_0xf09b('0x28')](function(_0x1d5c6a){logger[_0xf09b('0x23')]('Network,\x20%s,\x20%s',_0x4ac260,_0x1d5c6a);_0xd37a26(_0x1d5c6a);});});}function respondWithStatusCode(_0x1ac62d,_0x45cde3){_0x45cde3=_0x45cde3||0xcc;return function(_0x3d08a4){if(_0x3d08a4){return _0x1ac62d['sendStatus'](_0x45cde3);}return _0x1ac62d['status'](_0x45cde3)['end']();};}function respondWithResult(_0x1969a4,_0xeb5250){_0xeb5250=_0xeb5250||0xc8;return function(_0x29f8b5){if(_0x29f8b5){return _0x1969a4[_0xf09b('0x29')](_0xeb5250)['json'](_0x29f8b5);}};}function respondWithFilteredResult(_0x3c2bf8,_0x48a145){return function(_0x2bd088){if(_0x2bd088){var _0x2631da=_0x2bd088['count'],_0x4bcb00=_0x48a145[_0xf09b('0x2a')],_0x455c67=_0x48a145[_0xf09b('0x2a')]+_0x48a145[_0xf09b('0x2b')],_0x5d3e4b;if(_0x455c67>=_0x2631da){_0x455c67=_0x2631da;_0x5d3e4b=0xc8;}else{_0x5d3e4b=0xce;}_0x3c2bf8[_0xf09b('0x29')](_0x5d3e4b);return _0x3c2bf8['set'](_0xf09b('0x2c'),_0x4bcb00+'-'+_0x455c67+'/'+_0x2631da)[_0xf09b('0x2d')](_0x2bd088);}return null;};}function patchUpdates(_0x2cfb84){return function(_0x377848){try{jsonpatch[_0xf09b('0x2e')](_0x377848,_0x2cfb84,!![]);}catch(_0x3d93fa){return BPromise[_0xf09b('0x2f')](_0x3d93fa);}return _0x377848[_0xf09b('0x30')]();};}function saveUpdates(_0x4971db,_0x4e9bfa){return function(_0x59c3d9){if(_0x59c3d9){return _0x59c3d9[_0xf09b('0x31')](_0x4971db)['then'](function(_0x3543e4){return _0x3543e4;});}return null;};}function removeEntity(_0x13104c,_0x20f700){return function(_0x12cdca){if(_0x12cdca){return _0x12cdca['destroy']()['then'](function(){_0x13104c[_0xf09b('0x29')](0xcc)[_0xf09b('0x32')]();});}};}function handleEntityNotFound(_0x259b4d,_0x2082e9){return function(_0x319c90){if(!_0x319c90){_0x259b4d['sendStatus'](0x194);}return _0x319c90;};}function handleError(_0x4521bd,_0x2675c3){_0x2675c3=_0x2675c3||0x1f4;return function(_0x34f7a6){logger[_0xf09b('0x23')](_0x34f7a6[_0xf09b('0x33')]);if(_0x34f7a6[_0xf09b('0x34')]){delete _0x34f7a6['name'];}_0x4521bd[_0xf09b('0x29')](_0x2675c3)[_0xf09b('0x35')](_0x34f7a6);};}exports[_0xf09b('0x36')]=function(_0x2239ba,_0x4a9a23){var _0x3aa182={},_0x4fa284={},_0x2e0260={'count':0x0,'rows':[]};var _0x539f58=_['map'](db[_0xf09b('0x37')][_0xf09b('0x38')],function(_0x1a566e){return{'name':_0x1a566e[_0xf09b('0x39')],'type':_0x1a566e['type'][_0xf09b('0x3a')]};});_0x4fa284['model']=_[_0xf09b('0x3b')](_0x539f58,_0xf09b('0x34'));_0x4fa284['query']=_['keys'](_0x2239ba['query']);_0x4fa284['filters']=_['intersection'](_0x4fa284[_0xf09b('0x3c')],_0x4fa284[_0xf09b('0x3d')]);_0x3aa182['attributes']=_[_0xf09b('0x3e')](_0x4fa284[_0xf09b('0x3c')],qs['fields'](_0x2239ba[_0xf09b('0x3d')][_0xf09b('0x3f')]));_0x3aa182[_0xf09b('0x40')]=_0x3aa182['attributes']['length']?_0x3aa182[_0xf09b('0x40')]:_0x4fa284[_0xf09b('0x3c')];if(!_0x2239ba[_0xf09b('0x3d')][_0xf09b('0x41')](_0xf09b('0x42'))){_0x3aa182[_0xf09b('0x2b')]=qs[_0xf09b('0x2b')](_0x2239ba[_0xf09b('0x3d')][_0xf09b('0x2b')]);_0x3aa182[_0xf09b('0x2a')]=qs[_0xf09b('0x2a')](_0x2239ba[_0xf09b('0x3d')][_0xf09b('0x2a')]);}_0x3aa182['order']=qs[_0xf09b('0x43')](_0x2239ba[_0xf09b('0x3d')][_0xf09b('0x43')]);_0x3aa182['where']=qs[_0xf09b('0x44')](_[_0xf09b('0x45')](_0x2239ba[_0xf09b('0x3d')],_0x4fa284[_0xf09b('0x44')]),_0x539f58);if(_0x2239ba[_0xf09b('0x3d')][_0xf09b('0x46')]){_0x3aa182['where']=_[_0xf09b('0x47')](_0x3aa182['where'],{'$or':_[_0xf09b('0x3b')](_0x539f58,function(_0x2769b8){if(_0x2769b8[_0xf09b('0x48')]!==_0xf09b('0x49')){var _0x5e36f5={};_0x5e36f5[_0x2769b8[_0xf09b('0x34')]]={'$like':'%'+_0x2239ba['query'][_0xf09b('0x46')]+'%'};return _0x5e36f5;}})});}_0x3aa182=_[_0xf09b('0x47')]({},_0x3aa182,_0x2239ba[_0xf09b('0x4a')]);var _0x325cbe={'where':_0x3aa182[_0xf09b('0x4b')]};return db[_0xf09b('0x37')][_0xf09b('0x4c')](_0x325cbe)[_0xf09b('0x4d')](function(_0x31c7bb){_0x2e0260[_0xf09b('0x4c')]=_0x31c7bb;if(_0x2239ba[_0xf09b('0x3d')]['includeAll']){_0x3aa182['include']=[{'all':!![]}];}return db[_0xf09b('0x37')][_0xf09b('0x4e')](_0x3aa182);})[_0xf09b('0x4d')](function(_0x29e1aa){_0x2e0260[_0xf09b('0x4f')]=_0x29e1aa;return _0x2e0260;})[_0xf09b('0x4d')](respondWithFilteredResult(_0x4a9a23,_0x3aa182))[_0xf09b('0x28')](handleError(_0x4a9a23,null));};exports[_0xf09b('0x50')]=function(_0x5849fd,_0x5449fd){var _0x112615={'raw':!![],'where':{'id':_0x5849fd[_0xf09b('0x51')]['id']}},_0x1038b0={};_0x1038b0['model']=_[_0xf09b('0x52')](db['Network']['rawAttributes']);_0x1038b0[_0xf09b('0x3d')]=_[_0xf09b('0x52')](_0x5849fd[_0xf09b('0x3d')]);_0x1038b0[_0xf09b('0x44')]=_[_0xf09b('0x3e')](_0x1038b0['model'],_0x1038b0[_0xf09b('0x3d')]);_0x112615[_0xf09b('0x40')]=_['intersection'](_0x1038b0['model'],qs[_0xf09b('0x3f')](_0x5849fd['query'][_0xf09b('0x3f')]));_0x112615[_0xf09b('0x40')]=_0x112615[_0xf09b('0x40')]['length']?_0x112615[_0xf09b('0x40')]:_0x1038b0[_0xf09b('0x3c')];if(_0x5849fd[_0xf09b('0x3d')]['includeAll']){_0x112615[_0xf09b('0x53')]=[{'all':!![]}];}_0x112615=_[_0xf09b('0x47')]({},_0x112615,_0x5849fd[_0xf09b('0x4a')]);return db[_0xf09b('0x37')]['find'](_0x112615)[_0xf09b('0x4d')](handleEntityNotFound(_0x5449fd,null))[_0xf09b('0x4d')](respondWithResult(_0x5449fd,null))[_0xf09b('0x28')](handleError(_0x5449fd,null));};exports[_0xf09b('0x54')]=function(_0x4a66dc,_0x5a0ccf,_0x35ffaa){var _0x3940a9;return db[_0xf09b('0x55')][_0xf09b('0x56')](function(_0x1119a7){return db['Network'][_0xf09b('0x54')](_0x4a66dc[_0xf09b('0x57')],{'raw':!![]})[_0xf09b('0x4d')](function(_0x13fc45){_0x3940a9=_0x13fc45;return db[_0xf09b('0x37')]['findAll']({'where':{'type':_0x4a66dc[_0xf09b('0x57')][_0xf09b('0x48')]},'raw':!![]});})[_0xf09b('0x4d')](function(_0xa8bcef){if(_0x3940a9[_0xf09b('0x48')][_0xf09b('0x58')]()==_0xf09b('0x59')){var _0x338d9d=fs[_0xf09b('0x5a')](path['join'](config[_0xf09b('0x5b')],_0xf09b('0x5c')),_0xf09b('0x5d'));var _0x411868=ejs[_0xf09b('0x5e')](_0x338d9d,{'networks':_0xa8bcef||[]});fs[_0xf09b('0x5f')](_0xf09b('0x60'),_0x411868);return respondWithRpcPromise(_0xf09b('0x61'),_0xf09b('0x54'),{'module':_0xf09b('0x62')});}else if(_0x3940a9[_0xf09b('0x48')][_0xf09b('0x58')]()==_0xf09b('0x63')){var _0x1627a5=fs['readFileSync'](path[_0xf09b('0x64')](config[_0xf09b('0x5b')],_0xf09b('0x65')),_0xf09b('0x5d'));var _0x5a35eb=ejs['render'](_0x1627a5,{'networks':_0xa8bcef||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5a35eb);return respondWithRpcPromise(_0xf09b('0x61'),'create',{'module':_0xf09b('0x62')});}else{var _0x35fd45=fs[_0xf09b('0x5a')](path[_0xf09b('0x64')](config[_0xf09b('0x5b')],'server/files/templates/network.ejs'),_0xf09b('0x5d'));var _0x2823b5=ejs[_0xf09b('0x5e')](_0x35fd45,{'networks':_0xa8bcef||[]});fs['writeFileSync'](util[_0xf09b('0x66')](_0xf09b('0x67'),_0x4a66dc[_0xf09b('0x57')][_0xf09b('0x48')][_0xf09b('0x68')]()),_0x2823b5);return respondWithRpcPromise(_0xf09b('0x61'),_0xf09b('0x54'),{'module':_0xf09b('0x69')});}return null;})[_0xf09b('0x4d')](function(){return _0x3940a9;});})[_0xf09b('0x4d')](respondWithResult(_0x5a0ccf,0xc9))[_0xf09b('0x28')](handleError(_0x5a0ccf,null));};exports[_0xf09b('0x31')]=function(_0x366b96,_0x5eea32,_0x1c6f15){var _0x3097e8;return db[_0xf09b('0x55')][_0xf09b('0x56')](function(_0x3144e1){return db['Network']['find']({'where':{'id':_0x366b96[_0xf09b('0x51')]['id']}})[_0xf09b('0x4d')](handleEntityNotFound(_0x5eea32,null))['then'](saveUpdates(_0x366b96[_0xf09b('0x57')],null))[_0xf09b('0x4d')](function(_0x143cf3){if(_0x143cf3){_0x3097e8=_0x143cf3;return db[_0xf09b('0x37')][_0xf09b('0x4e')]({'where':{'type':_0x3097e8['type']},'raw':!![]});}return null;})[_0xf09b('0x4d')](function(_0x213c8d){if(_0x3097e8[_0xf09b('0x48')][_0xf09b('0x58')]()==_0xf09b('0x59')){var _0x20572d=fs[_0xf09b('0x5a')](path[_0xf09b('0x64')](config[_0xf09b('0x5b')],_0xf09b('0x5c')),_0xf09b('0x5d'));var _0x4a44a7=ejs[_0xf09b('0x5e')](_0x20572d,{'networks':_0x213c8d||[]});fs[_0xf09b('0x5f')](_0xf09b('0x60'),_0x4a44a7);return respondWithRpcPromise(_0xf09b('0x61'),_0xf09b('0x31'),{'module':'res_stun_monitor.so'});}else if(_0x3097e8['type'][_0xf09b('0x58')]()==_0xf09b('0x63')){var _0x4061b9=fs['readFileSync'](path[_0xf09b('0x64')](config[_0xf09b('0x5b')],_0xf09b('0x65')),'utf8');var _0x23df87=ejs['render'](_0x4061b9,{'networks':_0x213c8d||[]});fs[_0xf09b('0x5f')](_0xf09b('0x6a'),_0x23df87);return respondWithRpcPromise(_0xf09b('0x61'),'update',{'module':'res_stun_monitor.so'});}else{var _0x28a312=fs[_0xf09b('0x5a')](path[_0xf09b('0x64')](config[_0xf09b('0x5b')],'server/files/templates/network.ejs'),'utf8');var _0x36e981=ejs[_0xf09b('0x5e')](_0x28a312,{'networks':_0x213c8d||[]});fs['writeFileSync'](util['format'](_0xf09b('0x67'),_0x366b96[_0xf09b('0x57')][_0xf09b('0x48')][_0xf09b('0x68')]()),_0x36e981);return respondWithRpcPromise(_0xf09b('0x61'),_0xf09b('0x31'),{'module':_0xf09b('0x69')});}return null;})['then'](function(_0x38e729){if(_0x38e729){return _0x3097e8;}return null;});})['then'](respondWithResult(_0x5eea32,null))[_0xf09b('0x28')](handleError(_0x5eea32,null));};exports[_0xf09b('0x6b')]=function(_0x538de6,_0x113e4d,_0x3daac5){var _0x284a1a;return db['Network'][_0xf09b('0x6c')]({'where':{'id':_0x538de6['params']['id']}})[_0xf09b('0x4d')](function(_0x50e5c4){_0x284a1a=_0x50e5c4;return _0x50e5c4;})[_0xf09b('0x4d')](handleEntityNotFound(_0x113e4d,null))[_0xf09b('0x4d')](removeEntity(_0x113e4d,null))['then'](function(){if(_0x284a1a){return db[_0xf09b('0x37')][_0xf09b('0x4e')]({'where':{'type':_0x284a1a[_0xf09b('0x48')]},'raw':!![]});}})[_0xf09b('0x4d')](function(_0x19b4e3){if(_0x284a1a[_0xf09b('0x48')][_0xf09b('0x58')]()=='STUN'){var _0x14ad5e=fs[_0xf09b('0x5a')](path[_0xf09b('0x64')](config[_0xf09b('0x5b')],_0xf09b('0x5c')),'utf8');var _0x16e1e2=ejs[_0xf09b('0x5e')](_0x14ad5e,{'networks':_0x19b4e3||[]});fs[_0xf09b('0x5f')]('/etc/asterisk/stun_xcally.conf',_0x16e1e2);return respondWithRpcPromise(_0xf09b('0x61'),_0xf09b('0x6b'),{'module':_0xf09b('0x62')});}else if(_0x284a1a[_0xf09b('0x48')]['toUpperCase']()==_0xf09b('0x63')){var _0x3f9745=fs[_0xf09b('0x5a')](path['join'](config[_0xf09b('0x5b')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x16846c=ejs[_0xf09b('0x5e')](_0x3f9745,{'networks':_0x19b4e3||[]});fs[_0xf09b('0x5f')](_0xf09b('0x6a'),_0x16846c);return respondWithRpcPromise(_0xf09b('0x61'),_0xf09b('0x6b'),{'module':_0xf09b('0x62')});}else{var _0x361c55=fs['readFileSync'](path[_0xf09b('0x64')](config[_0xf09b('0x5b')],_0xf09b('0x6d')),_0xf09b('0x5d'));var _0x3ef77f=ejs[_0xf09b('0x5e')](_0x361c55,{'networks':_0x19b4e3||[]});fs[_0xf09b('0x5f')](util[_0xf09b('0x66')](_0xf09b('0x67'),_0x538de6[_0xf09b('0x57')][_0xf09b('0x48')][_0xf09b('0x68')]()),_0x3ef77f);return respondWithRpcPromise(_0xf09b('0x61'),'destroy',{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x113e4d,null));}; \ No newline at end of file +var _0x3dbb=['toLowerCase','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','update','destroy','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','Network','includeAll','include','findAll','rows','params','length','options','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','chan_sip.so','find','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf'];(function(_0x3457f2,_0x202e0f){var _0x77569c=function(_0x2e543e){while(--_0x2e543e){_0x3457f2['push'](_0x3457f2['shift']());}};_0x77569c(++_0x202e0f);}(_0x3dbb,0x67));var _0xb3db=function(_0x2f2cb8,_0x417d38){_0x2f2cb8=_0x2f2cb8-0x0;var _0x5a7add=_0x3dbb[_0x2f2cb8];return _0x5a7add;};'use strict';var pdf=require(_0xb3db('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb3db('0x1'));var jsonpatch=require(_0xb3db('0x2'));var rp=require('request-promise');var moment=require(_0xb3db('0x3'));var BPromise=require(_0xb3db('0x4'));var Mustache=require(_0xb3db('0x5'));var util=require(_0xb3db('0x6'));var path=require('path');var sox=require(_0xb3db('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb3db('0x8'));var squel=require(_0xb3db('0x9'));var crypto=require(_0xb3db('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb3db('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb3db('0xc'));var Papa=require(_0xb3db('0xd'));var Redis=require('ioredis');var authService=require(_0xb3db('0xe'));var qs=require(_0xb3db('0xf'));var as=require(_0xb3db('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3db('0x11'))(_0xb3db('0x12'));var utils=require(_0xb3db('0x13'));var config=require(_0xb3db('0x14'));var db=require(_0xb3db('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb3db('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x368ee0,_0x25f688,_0x1be6e5){if(_0x1be6e5){var _0x57a579=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57a579[_0xb3db('0x17')](_0x25f688)){return _0x368ee0;}else{throw new db[(_0xb3db('0x18'))][(_0xb3db('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x368ee0;}}function respondWithRpcPromise(_0x3e43bd,_0x4666a9,_0x4de9a3,_0x23988c){return new BPromise(function(_0x140063,_0x20b31f){var _0x3cb72c=_0x23988c||client;return _0x3cb72c[_0xb3db('0x1a')](_0x3e43bd,_0x4de9a3)[_0xb3db('0x1b')](function(_0x4b411e){logger[_0xb3db('0x1c')](_0xb3db('0x1d'),_0x4666a9,_0xb3db('0x1e'));logger[_0xb3db('0x1f')](_0xb3db('0x20'),_0x4666a9,_0xb3db('0x1e'),JSON[_0xb3db('0x21')](_0x4b411e));if(_0x4b411e[_0xb3db('0x22')]){if(_0x4b411e['error'][_0xb3db('0x23')]===0x1f4){logger[_0xb3db('0x22')](_0xb3db('0x1d'),_0x4666a9,_0x4b411e[_0xb3db('0x22')]['message']);return _0x20b31f(_0x4b411e[_0xb3db('0x22')][_0xb3db('0x24')]);}logger[_0xb3db('0x22')](_0xb3db('0x1d'),_0x4666a9,_0x4b411e[_0xb3db('0x22')]['message']);return _0x140063(_0x4b411e[_0xb3db('0x22')]['message']);}else{logger[_0xb3db('0x1c')](_0xb3db('0x1d'),_0x4666a9,_0xb3db('0x1e'));_0x140063(_0x4b411e['result'][_0xb3db('0x24')]);}})[_0xb3db('0x25')](function(_0x46c69a){logger[_0xb3db('0x22')](_0xb3db('0x1d'),_0x4666a9,_0x46c69a);_0x20b31f(_0x46c69a);});});}function respondWithStatusCode(_0x4fe00f,_0x4a37c4){_0x4a37c4=_0x4a37c4||0xcc;return function(_0x3db9a5){if(_0x3db9a5){return _0x4fe00f[_0xb3db('0x26')](_0x4a37c4);}return _0x4fe00f[_0xb3db('0x27')](_0x4a37c4)[_0xb3db('0x28')]();};}function respondWithResult(_0x7dd147,_0x59b15a){_0x59b15a=_0x59b15a||0xc8;return function(_0x34bbb5){if(_0x34bbb5){return _0x7dd147[_0xb3db('0x27')](_0x59b15a)[_0xb3db('0x29')](_0x34bbb5);}};}function respondWithFilteredResult(_0x13697d,_0x3045fc){return function(_0x167bf6){if(_0x167bf6){var _0x10e761=_0x167bf6[_0xb3db('0x2a')],_0x146ece=_0x3045fc[_0xb3db('0x2b')],_0x53af5b=_0x3045fc[_0xb3db('0x2b')]+_0x3045fc[_0xb3db('0x2c')],_0x287774;if(_0x53af5b>=_0x10e761){_0x53af5b=_0x10e761;_0x287774=0xc8;}else{_0x287774=0xce;}_0x13697d[_0xb3db('0x27')](_0x287774);return _0x13697d[_0xb3db('0x2d')]('Content-Range',_0x146ece+'-'+_0x53af5b+'/'+_0x10e761)[_0xb3db('0x29')](_0x167bf6);}return null;};}function patchUpdates(_0x2bd16b){return function(_0x12d76e){try{jsonpatch[_0xb3db('0x2e')](_0x12d76e,_0x2bd16b,!![]);}catch(_0x4544ea){return BPromise['reject'](_0x4544ea);}return _0x12d76e['save']();};}function saveUpdates(_0x24aed6,_0xeed2ff){return function(_0x44d45f){if(_0x44d45f){return _0x44d45f[_0xb3db('0x2f')](_0x24aed6)[_0xb3db('0x1b')](function(_0x257e76){return _0x257e76;});}return null;};}function removeEntity(_0x5784e0,_0x1d04ce){return function(_0x6ef71d){if(_0x6ef71d){return _0x6ef71d[_0xb3db('0x30')]()['then'](function(){_0x5784e0[_0xb3db('0x27')](0xcc)[_0xb3db('0x28')]();});}};}function handleEntityNotFound(_0x372f83,_0xc2d90){return function(_0x480c89){if(!_0x480c89){_0x372f83['sendStatus'](0x194);}return _0x480c89;};}function handleError(_0x2115d6,_0x5a9a66){_0x5a9a66=_0x5a9a66||0x1f4;return function(_0x9796ac){logger[_0xb3db('0x22')](_0x9796ac['stack']);if(_0x9796ac['name']){delete _0x9796ac[_0xb3db('0x31')];}_0x2115d6['status'](_0x5a9a66)[_0xb3db('0x32')](_0x9796ac);};}exports['index']=function(_0x4ab9df,_0x32c237){var _0x5f56b5={},_0x555a20={},_0x5a1880={'count':0x0,'rows':[]};var _0x506f1e=_[_0xb3db('0x33')](db['Network'][_0xb3db('0x34')],function(_0x1b9343){return{'name':_0x1b9343['fieldName'],'type':_0x1b9343[_0xb3db('0x35')][_0xb3db('0x36')]};});_0x555a20[_0xb3db('0x37')]=_[_0xb3db('0x33')](_0x506f1e,_0xb3db('0x31'));_0x555a20['query']=_[_0xb3db('0x38')](_0x4ab9df[_0xb3db('0x39')]);_0x555a20[_0xb3db('0x3a')]=_[_0xb3db('0x3b')](_0x555a20['model'],_0x555a20[_0xb3db('0x39')]);_0x5f56b5[_0xb3db('0x3c')]=_['intersection'](_0x555a20[_0xb3db('0x37')],qs[_0xb3db('0x3d')](_0x4ab9df['query']['fields']));_0x5f56b5[_0xb3db('0x3c')]=_0x5f56b5[_0xb3db('0x3c')]['length']?_0x5f56b5['attributes']:_0x555a20['model'];if(!_0x4ab9df['query'][_0xb3db('0x3e')](_0xb3db('0x3f'))){_0x5f56b5[_0xb3db('0x2c')]=qs['limit'](_0x4ab9df[_0xb3db('0x39')][_0xb3db('0x2c')]);_0x5f56b5[_0xb3db('0x2b')]=qs['offset'](_0x4ab9df['query'][_0xb3db('0x2b')]);}_0x5f56b5['order']=qs[_0xb3db('0x40')](_0x4ab9df[_0xb3db('0x39')][_0xb3db('0x40')]);_0x5f56b5[_0xb3db('0x41')]=qs[_0xb3db('0x3a')](_['pick'](_0x4ab9df[_0xb3db('0x39')],_0x555a20[_0xb3db('0x3a')]),_0x506f1e);if(_0x4ab9df[_0xb3db('0x39')][_0xb3db('0x42')]){_0x5f56b5['where']=_[_0xb3db('0x43')](_0x5f56b5[_0xb3db('0x41')],{'$or':_[_0xb3db('0x33')](_0x506f1e,function(_0x33f892){if(_0x33f892[_0xb3db('0x35')]!==_0xb3db('0x44')){var _0x1d63ad={};_0x1d63ad[_0x33f892['name']]={'$like':'%'+_0x4ab9df['query']['filter']+'%'};return _0x1d63ad;}})});}_0x5f56b5=_[_0xb3db('0x43')]({},_0x5f56b5,_0x4ab9df['options']);var _0x3afb66={'where':_0x5f56b5[_0xb3db('0x41')]};return db[_0xb3db('0x45')][_0xb3db('0x2a')](_0x3afb66)[_0xb3db('0x1b')](function(_0x523fca){_0x5a1880[_0xb3db('0x2a')]=_0x523fca;if(_0x4ab9df[_0xb3db('0x39')][_0xb3db('0x46')]){_0x5f56b5[_0xb3db('0x47')]=[{'all':!![]}];}return db[_0xb3db('0x45')][_0xb3db('0x48')](_0x5f56b5);})[_0xb3db('0x1b')](function(_0x947229){_0x5a1880[_0xb3db('0x49')]=_0x947229;return _0x5a1880;})[_0xb3db('0x1b')](respondWithFilteredResult(_0x32c237,_0x5f56b5))[_0xb3db('0x25')](handleError(_0x32c237,null));};exports['show']=function(_0x2e9a22,_0x141886){var _0x34e9b2={'raw':!![],'where':{'id':_0x2e9a22[_0xb3db('0x4a')]['id']}},_0x1e71a1={};_0x1e71a1[_0xb3db('0x37')]=_[_0xb3db('0x38')](db[_0xb3db('0x45')][_0xb3db('0x34')]);_0x1e71a1[_0xb3db('0x39')]=_[_0xb3db('0x38')](_0x2e9a22[_0xb3db('0x39')]);_0x1e71a1['filters']=_['intersection'](_0x1e71a1[_0xb3db('0x37')],_0x1e71a1[_0xb3db('0x39')]);_0x34e9b2[_0xb3db('0x3c')]=_[_0xb3db('0x3b')](_0x1e71a1[_0xb3db('0x37')],qs[_0xb3db('0x3d')](_0x2e9a22[_0xb3db('0x39')][_0xb3db('0x3d')]));_0x34e9b2['attributes']=_0x34e9b2['attributes'][_0xb3db('0x4b')]?_0x34e9b2[_0xb3db('0x3c')]:_0x1e71a1['model'];if(_0x2e9a22[_0xb3db('0x39')][_0xb3db('0x46')]){_0x34e9b2[_0xb3db('0x47')]=[{'all':!![]}];}_0x34e9b2=_['merge']({},_0x34e9b2,_0x2e9a22[_0xb3db('0x4c')]);return db[_0xb3db('0x45')]['find'](_0x34e9b2)[_0xb3db('0x1b')](handleEntityNotFound(_0x141886,null))[_0xb3db('0x1b')](respondWithResult(_0x141886,null))[_0xb3db('0x25')](handleError(_0x141886,null));};exports[_0xb3db('0x4d')]=function(_0x44c1d1,_0x4ac831,_0x5bd068){var _0xaebaa1;return db[_0xb3db('0x4e')][_0xb3db('0x4f')](function(_0x4be0cd){return db[_0xb3db('0x45')]['create'](_0x44c1d1[_0xb3db('0x50')],{'raw':!![]})[_0xb3db('0x1b')](function(_0x272df0){_0xaebaa1=_0x272df0;return db[_0xb3db('0x45')]['findAll']({'where':{'type':_0x44c1d1[_0xb3db('0x50')][_0xb3db('0x35')]},'raw':!![]});})['then'](function(_0x2c8798){if(_0xaebaa1[_0xb3db('0x35')][_0xb3db('0x51')]()==_0xb3db('0x52')){var _0x21ab77=fs[_0xb3db('0x53')](path['join'](config[_0xb3db('0x54')],_0xb3db('0x55')),_0xb3db('0x56'));var _0x50f56f=ejs[_0xb3db('0x57')](_0x21ab77,{'networks':_0x2c8798||[]});fs[_0xb3db('0x58')](_0xb3db('0x59'),_0x50f56f);return respondWithRpcPromise(_0xb3db('0x5a'),'create',{'module':_0xb3db('0x5b')});}else if(_0xaebaa1[_0xb3db('0x35')][_0xb3db('0x51')]()==_0xb3db('0x5c')){var _0x3c3cbf=fs['readFileSync'](path[_0xb3db('0x5d')](config[_0xb3db('0x54')],_0xb3db('0x5e')),_0xb3db('0x56'));var _0x5cab34=ejs['render'](_0x3c3cbf,{'networks':_0x2c8798||[]});fs['writeFileSync'](_0xb3db('0x5f'),_0x5cab34);return respondWithRpcPromise(_0xb3db('0x5a'),_0xb3db('0x4d'),{'module':_0xb3db('0x5b')});}else{var _0x74b31d=fs[_0xb3db('0x53')](path[_0xb3db('0x5d')](config[_0xb3db('0x54')],'server/files/templates/network.ejs'),'utf8');var _0x8744c3=ejs[_0xb3db('0x57')](_0x74b31d,{'networks':_0x2c8798||[]});fs[_0xb3db('0x58')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x44c1d1['body'][_0xb3db('0x35')]['toLowerCase']()),_0x8744c3);return respondWithRpcPromise('Reload',_0xb3db('0x4d'),{'module':_0xb3db('0x60')});}return null;})[_0xb3db('0x1b')](function(){return _0xaebaa1;});})[_0xb3db('0x1b')](respondWithResult(_0x4ac831,0xc9))[_0xb3db('0x25')](handleError(_0x4ac831,null));};exports['update']=function(_0x4686dc,_0x31b0bc,_0x2c9b6a){var _0x322f70;return db[_0xb3db('0x4e')][_0xb3db('0x4f')](function(_0x2e1156){return db['Network'][_0xb3db('0x61')]({'where':{'id':_0x4686dc[_0xb3db('0x4a')]['id']}})[_0xb3db('0x1b')](handleEntityNotFound(_0x31b0bc,null))['then'](saveUpdates(_0x4686dc[_0xb3db('0x50')],null))['then'](function(_0x419f9c){if(_0x419f9c){_0x322f70=_0x419f9c;return db[_0xb3db('0x45')][_0xb3db('0x48')]({'where':{'type':_0x322f70[_0xb3db('0x35')]},'raw':!![]});}return null;})['then'](function(_0x305163){if(_0x322f70['type'][_0xb3db('0x51')]()=='STUN'){var _0x1d096b=fs[_0xb3db('0x53')](path[_0xb3db('0x5d')](config[_0xb3db('0x54')],_0xb3db('0x55')),_0xb3db('0x56'));var _0x6eb6fe=ejs[_0xb3db('0x57')](_0x1d096b,{'networks':_0x305163||[]});fs[_0xb3db('0x58')](_0xb3db('0x59'),_0x6eb6fe);return respondWithRpcPromise(_0xb3db('0x5a'),_0xb3db('0x2f'),{'module':_0xb3db('0x5b')});}else if(_0x322f70[_0xb3db('0x35')][_0xb3db('0x51')]()==_0xb3db('0x5c')){var _0x69134f=fs[_0xb3db('0x53')](path['join'](config[_0xb3db('0x54')],_0xb3db('0x5e')),_0xb3db('0x56'));var _0x785619=ejs[_0xb3db('0x57')](_0x69134f,{'networks':_0x305163||[]});fs[_0xb3db('0x58')](_0xb3db('0x5f'),_0x785619);return respondWithRpcPromise(_0xb3db('0x5a'),'update',{'module':_0xb3db('0x5b')});}else{var _0xf050=fs[_0xb3db('0x53')](path['join'](config['root'],_0xb3db('0x62')),_0xb3db('0x56'));var _0x42ecf4=ejs[_0xb3db('0x57')](_0xf050,{'networks':_0x305163||[]});fs[_0xb3db('0x58')](util[_0xb3db('0x63')](_0xb3db('0x64'),_0x4686dc[_0xb3db('0x50')][_0xb3db('0x35')][_0xb3db('0x65')]()),_0x42ecf4);return respondWithRpcPromise(_0xb3db('0x5a'),_0xb3db('0x2f'),{'module':_0xb3db('0x60')});}return null;})[_0xb3db('0x1b')](function(_0x5f5605){if(_0x5f5605){return _0x322f70;}return null;});})[_0xb3db('0x1b')](respondWithResult(_0x31b0bc,null))['catch'](handleError(_0x31b0bc,null));};exports[_0xb3db('0x30')]=function(_0x2bebdb,_0x12ad03,_0x4d5f2c){var _0x194b70;return db['Network']['find']({'where':{'id':_0x2bebdb[_0xb3db('0x4a')]['id']}})['then'](function(_0x2b2b95){_0x194b70=_0x2b2b95;return _0x2b2b95;})['then'](handleEntityNotFound(_0x12ad03,null))['then'](removeEntity(_0x12ad03,null))['then'](function(){if(_0x194b70){return db['Network']['findAll']({'where':{'type':_0x194b70['type']},'raw':!![]});}})[_0xb3db('0x1b')](function(_0x2c63a9){if(_0x194b70[_0xb3db('0x35')][_0xb3db('0x51')]()==_0xb3db('0x52')){var _0x379815=fs[_0xb3db('0x53')](path[_0xb3db('0x5d')](config[_0xb3db('0x54')],_0xb3db('0x55')),_0xb3db('0x56'));var _0xbc9d68=ejs[_0xb3db('0x57')](_0x379815,{'networks':_0x2c63a9||[]});fs['writeFileSync'](_0xb3db('0x59'),_0xbc9d68);return respondWithRpcPromise(_0xb3db('0x5a'),_0xb3db('0x30'),{'module':_0xb3db('0x5b')});}else if(_0x194b70[_0xb3db('0x35')][_0xb3db('0x51')]()=='TURN'){var _0x54c305=fs['readFileSync'](path[_0xb3db('0x5d')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xb3db('0x56'));var _0x4e2dab=ejs[_0xb3db('0x57')](_0x54c305,{'networks':_0x2c63a9||[]});fs['writeFileSync'](_0xb3db('0x5f'),_0x4e2dab);return respondWithRpcPromise(_0xb3db('0x5a'),_0xb3db('0x30'),{'module':'res_stun_monitor.so'});}else{var _0x244c0e=fs['readFileSync'](path[_0xb3db('0x5d')](config[_0xb3db('0x54')],_0xb3db('0x62')),'utf8');var _0x166746=ejs['render'](_0x244c0e,{'networks':_0x2c63a9||[]});fs[_0xb3db('0x58')](util['format'](_0xb3db('0x64'),_0x2bebdb[_0xb3db('0x50')][_0xb3db('0x35')]['toLowerCase']()),_0x166746);return respondWithRpcPromise(_0xb3db('0x5a'),_0xb3db('0x30'),{'module':_0xb3db('0x60')});}return null;})[_0xb3db('0x25')](handleError(_0x12ad03,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index db11070..3d1e529 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 _0xb15f=['moment','bluebird','rimraf','../../config/environment','exports','define','network','lodash','util','api'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xb15f,0xe3));var _0xfb15=function(_0x20d681,_0xd8eafb){_0x20d681=_0x20d681-0x0;var _0x181c72=_0xb15f[_0x20d681];return _0x181c72;};'use strict';var _=require(_0xfb15('0x0'));var util=require(_0xfb15('0x1'));var logger=require('../../config/logger')(_0xfb15('0x2'));var moment=require(_0xfb15('0x3'));var BPromise=require(_0xfb15('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfb15('0x5'));var config=require(_0xfb15('0x6'));var attributes=require('./network.attributes');module[_0xfb15('0x7')]=function(_0x3653cf,_0x19e4d4){return _0x3653cf[_0xfb15('0x8')]('Network',attributes,{'tableName':_0xfb15('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c4a=['Network','network','util','../../config/logger','rimraf','./network.attributes','exports','define'];(function(_0x456326,_0x317e76){var _0x1bf3e2=function(_0x2120d9){while(--_0x2120d9){_0x456326['push'](_0x456326['shift']());}};_0x1bf3e2(++_0x317e76);}(_0x6c4a,0x8a));var _0xa6c4=function(_0x2177e4,_0x47103a){_0x2177e4=_0x2177e4-0x0;var _0x2390f8=_0x6c4a[_0x2177e4];return _0x2390f8;};'use strict';var _=require('lodash');var util=require(_0xa6c4('0x0'));var logger=require(_0xa6c4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6c4('0x2'));var config=require('../../config/environment');var attributes=require(_0xa6c4('0x3'));module[_0xa6c4('0x4')]=function(_0xebc6d0,_0x3aa281){return _0xebc6d0[_0xa6c4('0x5')](_0xa6c4('0x6'),attributes,{'tableName':_0xa6c4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 230b121..1a97e93 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 _0xd82b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd82b,0x166));var _0xbd82=function(_0x59a27d,_0x5d340){_0x59a27d=_0x59a27d-0x0;var _0x61e02d=_0xd82b[_0x59a27d];return _0x61e02d;};'use strict';var _=require(_0xbd82('0x0'));var util=require(_0xbd82('0x1'));var moment=require(_0xbd82('0x2'));var BPromise=require(_0xbd82('0x3'));var rs=require(_0xbd82('0x4'));var fs=require('fs');var Redis=require(_0xbd82('0x5'));var db=require(_0xbd82('0x6'))['db'];var utils=require(_0xbd82('0x7'));var logger=require(_0xbd82('0x8'))('rpc');var config=require(_0xbd82('0x9'));var jayson=require(_0xbd82('0xa'));var client=jayson['client'][_0xbd82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x208a66,_0x6e8904,_0x1d6a91){return new BPromise(function(_0x43d2cb,_0x44319c){return client[_0xbd82('0xc')](_0x208a66,_0x1d6a91)[_0xbd82('0xd')](function(_0x2488dc){logger[_0xbd82('0xe')](_0xbd82('0xf'),_0x6e8904,_0xbd82('0x10'));logger[_0xbd82('0x11')](_0xbd82('0x12'),_0x6e8904,_0xbd82('0x10'),JSON[_0xbd82('0x13')](_0x2488dc));if(_0x2488dc[_0xbd82('0x14')]){if(_0x2488dc['error'][_0xbd82('0x15')]===0x1f4){logger['error'](_0xbd82('0xf'),_0x6e8904,_0x2488dc[_0xbd82('0x14')][_0xbd82('0x16')]);return _0x44319c(_0x2488dc[_0xbd82('0x14')][_0xbd82('0x16')]);}logger[_0xbd82('0x14')](_0xbd82('0xf'),_0x6e8904,_0x2488dc[_0xbd82('0x14')][_0xbd82('0x16')]);return _0x43d2cb(_0x2488dc[_0xbd82('0x14')][_0xbd82('0x16')]);}else{logger[_0xbd82('0xe')]('Network,\x20%s,\x20%s',_0x6e8904,_0xbd82('0x10'));_0x43d2cb(_0x2488dc[_0xbd82('0x17')]['message']);}})['catch'](function(_0x53172c){logger[_0xbd82('0x14')](_0xbd82('0xf'),_0x6e8904,_0x53172c);_0x44319c(_0x53172c);});});} \ No newline at end of file +var _0xdd48=['Network,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xdd48,0x116));var _0x8dd4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xdd48[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x8dd4('0x0'));var util=require(_0x8dd4('0x1'));var moment=require(_0x8dd4('0x2'));var BPromise=require(_0x8dd4('0x3'));var rs=require(_0x8dd4('0x4'));var fs=require('fs');var Redis=require(_0x8dd4('0x5'));var db=require(_0x8dd4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8dd4('0x7'))(_0x8dd4('0x8'));var config=require(_0x8dd4('0x9'));var jayson=require(_0x8dd4('0xa'));var client=jayson[_0x8dd4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55cbd9,_0x963d5,_0xc04ed8){return new BPromise(function(_0xac9d15,_0x464e10){return client[_0x8dd4('0xc')](_0x55cbd9,_0xc04ed8)[_0x8dd4('0xd')](function(_0x379bf6){logger[_0x8dd4('0xe')]('Network,\x20%s,\x20%s',_0x963d5,_0x8dd4('0xf'));logger[_0x8dd4('0x10')](_0x8dd4('0x11'),_0x963d5,_0x8dd4('0xf'),JSON[_0x8dd4('0x12')](_0x379bf6));if(_0x379bf6[_0x8dd4('0x13')]){if(_0x379bf6[_0x8dd4('0x13')][_0x8dd4('0x14')]===0x1f4){logger[_0x8dd4('0x13')]('Network,\x20%s,\x20%s',_0x963d5,_0x379bf6[_0x8dd4('0x13')][_0x8dd4('0x15')]);return _0x464e10(_0x379bf6[_0x8dd4('0x13')]['message']);}logger[_0x8dd4('0x13')](_0x8dd4('0x16'),_0x963d5,_0x379bf6[_0x8dd4('0x13')][_0x8dd4('0x15')]);return _0xac9d15(_0x379bf6['error'][_0x8dd4('0x15')]);}else{logger[_0x8dd4('0xe')]('Network,\x20%s,\x20%s',_0x963d5,_0x8dd4('0xf'));_0xac9d15(_0x379bf6[_0x8dd4('0x17')][_0x8dd4('0x15')]);}})[_0x8dd4('0x18')](function(_0x4d6f1c){logger[_0x8dd4('0x13')]('Network,\x20%s,\x20%s',_0x963d5,_0x4d6f1c);_0x464e10(_0x4d6f1c);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 6dbaeef..a6aab69 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf539=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated'];(function(_0x1c0398,_0x5f0f2b){var _0x2b0e6b=function(_0x3fc3ea){while(--_0x3fc3ea){_0x1c0398['push'](_0x1c0398['shift']());}};_0x2b0e6b(++_0x5f0f2b);}(_0xf539,0xdc));var _0x9f53=function(_0x3fbbbe,_0x14fd2c){_0x3fbbbe=_0x3fbbbe-0x0;var _0x1d43ce=_0xf539[_0x3fbbbe];return _0x1d43ce;};'use strict';var multer=require('multer');var util=require(_0x9f53('0x0'));var path=require(_0x9f53('0x1'));var timeout=require(_0x9f53('0x2'));var express=require('express');var router=express[_0x9f53('0x3')]();var auth=require(_0x9f53('0x4'));var interaction=require(_0x9f53('0x5'));var config=require(_0x9f53('0x6'));var controller=require(_0x9f53('0x7'));router[_0x9f53('0x8')]('/',auth[_0x9f53('0x9')](),controller['sendNotification']);module['exports']=router; \ No newline at end of file +var _0x0393=['sendNotification','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated'];(function(_0x3cf7e5,_0x23d424){var _0x70f5d3=function(_0x74c26d){while(--_0x74c26d){_0x3cf7e5['push'](_0x3cf7e5['shift']());}};_0x70f5d3(++_0x23d424);}(_0x0393,0x178));var _0x3039=function(_0x3ba3f5,_0x4d748b){_0x3ba3f5=_0x3ba3f5-0x0;var _0x32b5a2=_0x0393[_0x3ba3f5];return _0x32b5a2;};'use strict';var multer=require(_0x3039('0x0'));var util=require(_0x3039('0x1'));var path=require(_0x3039('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3039('0x3'));var interaction=require(_0x3039('0x4'));var config=require(_0x3039('0x5'));var controller=require(_0x3039('0x6'));router[_0x3039('0x7')]('/',auth[_0x3039('0x8')](),controller[_0x3039('0x9')]);module[_0x3039('0xa')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index dafd070..e2e924f 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4009=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x56544c,_0x4c2b03){var _0x48c51d=function(_0x441613){while(--_0x441613){_0x56544c['push'](_0x56544c['shift']());}};_0x48c51d(++_0x4c2b03);}(_0x4009,0x1a4));var _0x9400=function(_0x29ad7e,_0x635d47){_0x29ad7e=_0x29ad7e-0x0;var _0x2c0566=_0x4009[_0x29ad7e];return _0x2c0566;};'use strict';var Sequelize=require(_0x9400('0x0'));module[_0x9400('0x1')]={'body':{'type':Sequelize[_0x9400('0x2')]},'senderName':{'type':Sequelize[_0x9400('0x3')]},'recipientsId':{'type':Sequelize[_0x9400('0x2')]},'recipientsDescription':{'type':Sequelize[_0x9400('0x3')]},'beep':{'type':Sequelize[_0x9400('0x4')]}}; \ No newline at end of file +var _0x2cd2=['STRING','TEXT','BOOLEAN','sequelize','exports'];(function(_0xd7f8f7,_0x42785e){var _0x34b92c=function(_0x4833c9){while(--_0x4833c9){_0xd7f8f7['push'](_0xd7f8f7['shift']());}};_0x34b92c(++_0x42785e);}(_0x2cd2,0x120));var _0x22cd=function(_0x935b2a,_0x341bea){_0x935b2a=_0x935b2a-0x0;var _0x4227d6=_0x2cd2[_0x935b2a];return _0x4227d6;};'use strict';var Sequelize=require(_0x22cd('0x0'));module[_0x22cd('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x22cd('0x2')]},'recipientsId':{'type':Sequelize[_0x22cd('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x22cd('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 4f9e3c1..f05810a 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b06=['localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','error','stack','name','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','transaction','Notification','recipient','emit','notification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','replace','queue','forEach','all','flatten','findOne','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults'];(function(_0x261ddd,_0x2d711a){var _0x429085=function(_0x2e38b6){while(--_0x2e38b6){_0x261ddd['push'](_0x261ddd['shift']());}};_0x429085(++_0x2d711a);}(_0x2b06,0x10c));var _0x62b0=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x2b06[_0x23c6f2];return _0x4c270b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x62b0('0x0'));var rimraf=require(_0x62b0('0x1'));var zipdir=require(_0x62b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62b0('0x3'));var moment=require(_0x62b0('0x4'));var BPromise=require(_0x62b0('0x5'));var Mustache=require('mustache');var util=require(_0x62b0('0x6'));var path=require('path');var sox=require(_0x62b0('0x7'));var csv=require(_0x62b0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62b0('0x9'));var squel=require(_0x62b0('0xa'));var crypto=require(_0x62b0('0xb'));var jsforce=require(_0x62b0('0xc'));var deskjs=require(_0x62b0('0xd'));var toCsv=require(_0x62b0('0x8'));var querystring=require(_0x62b0('0xe'));var Papa=require(_0x62b0('0xf'));var Redis=require(_0x62b0('0x10'));var authService=require(_0x62b0('0x11'));var qs=require(_0x62b0('0x12'));var as=require(_0x62b0('0x13'));var hardwareService=require(_0x62b0('0x14'));var logger=require(_0x62b0('0x15'))('api');var utils=require(_0x62b0('0x16'));var config=require(_0x62b0('0x17'));var db=require('../../mysqldb')['db'];config[_0x62b0('0x18')]=_[_0x62b0('0x19')](config[_0x62b0('0x18')],{'host':_0x62b0('0x1a'),'port':0x18eb});var socket=require(_0x62b0('0x1b'))(new Redis(config[_0x62b0('0x18')]));require(_0x62b0('0x1c'))[_0x62b0('0x1d')](socket);function respondWithStatusCode(_0x558e01,_0x4dfc0e){_0x4dfc0e=_0x4dfc0e||0xcc;return function(_0x37af37){if(_0x37af37){return _0x558e01[_0x62b0('0x1e')](_0x4dfc0e);}return _0x558e01[_0x62b0('0x1f')](_0x4dfc0e)[_0x62b0('0x20')]();};}function respondWithResult(_0x502f98,_0x229d98){_0x229d98=_0x229d98||0xc8;return function(_0x84b53e){if(_0x84b53e){return _0x502f98['status'](_0x229d98)[_0x62b0('0x21')](_0x84b53e);}};}function respondWithFilteredResult(_0x433328,_0xf2a575){return function(_0x1d4ada){if(_0x1d4ada){var _0x413ee3=_0x1d4ada['count'],_0x5c3675=_0xf2a575[_0x62b0('0x22')],_0x1dc260=_0xf2a575['offset']+_0xf2a575['limit'],_0x4c146b;if(_0x1dc260>=_0x413ee3){_0x1dc260=_0x413ee3;_0x4c146b=0xc8;}else{_0x4c146b=0xce;}_0x433328[_0x62b0('0x1f')](_0x4c146b);return _0x433328[_0x62b0('0x23')](_0x62b0('0x24'),_0x5c3675+'-'+_0x1dc260+'/'+_0x413ee3)[_0x62b0('0x21')](_0x1d4ada);}return null;};}function patchUpdates(_0x1f3d9f){return function(_0x5561fe){try{jsonpatch['apply'](_0x5561fe,_0x1f3d9f,!![]);}catch(_0x2b1ef2){return BPromise[_0x62b0('0x25')](_0x2b1ef2);}return _0x5561fe[_0x62b0('0x26')]();};}function saveUpdates(_0x4159b9,_0x5271d0){return function(_0x14c6e8){if(_0x14c6e8){return _0x14c6e8[_0x62b0('0x27')](_0x4159b9)[_0x62b0('0x28')](function(_0x151078){return _0x151078;});}return null;};}function removeEntity(_0x5d1967,_0x90d72a){return function(_0x5518ce){if(_0x5518ce){return _0x5518ce['destroy']()[_0x62b0('0x28')](function(){_0x5d1967['status'](0xcc)[_0x62b0('0x20')]();});}};}function handleEntityNotFound(_0x393c3d,_0x2a5f77){return function(_0x30059f){if(!_0x30059f){_0x393c3d[_0x62b0('0x1e')](0x194);}return _0x30059f;};}function handleError(_0x53592a,_0x4ac2ec){_0x4ac2ec=_0x4ac2ec||0x1f4;return function(_0x1e1a79){logger[_0x62b0('0x29')](_0x1e1a79[_0x62b0('0x2a')]);if(_0x1e1a79[_0x62b0('0x2b')]){delete _0x1e1a79['name'];}_0x53592a[_0x62b0('0x1f')](_0x4ac2ec)['send'](_0x1e1a79);};}exports[_0x62b0('0x2c')]=function(_0x59f1a5,_0x4c96e0,_0x3fee2e){if(!_0x59f1a5[_0x62b0('0x2d')][_0x62b0('0x2e')](_0x62b0('0x2f'))&&!_0x59f1a5[_0x62b0('0x2d')][_0x62b0('0x2e')](_0x62b0('0x30'))){throw new db[(_0x62b0('0x31'))][(_0x62b0('0x32'))](_0x62b0('0x33'));}else{if(_0x59f1a5[_0x62b0('0x2d')][_0x62b0('0x2e')](_0x62b0('0x30'))&&!_0x59f1a5[_0x62b0('0x2d')][_0x62b0('0x2e')](_0x62b0('0x34'))){throw new db[(_0x62b0('0x31'))][(_0x62b0('0x32'))](_0x62b0('0x35'));}if(!_0x59f1a5['body'][_0x62b0('0x2e')](_0x62b0('0x36'))){throw new db[(_0x62b0('0x31'))][(_0x62b0('0x32'))](_0x62b0('0x37'));}else{try{var _0x40feaa=JSON[_0x62b0('0x38')](_0x59f1a5[_0x62b0('0x2d')][_0x62b0('0x36')]);}catch(_0x597027){logger['error'](_0x597027);throw new db[(_0x62b0('0x31'))][(_0x62b0('0x32'))](_0x62b0('0x39'));}var _0xb8dd99=[_0x62b0('0x3a'),_0x62b0('0x3b'),'mailqueue',_0x62b0('0x3c'),_0x62b0('0x3d'),_0x62b0('0x3e'),_0x62b0('0x3f'),_0x62b0('0x40'),_0x62b0('0x41')];if(_[_0x62b0('0x42')](_0x40feaa,function(_0x59a531){return!_[_0x62b0('0x43')](_0xb8dd99,_0x59a531['model'][_0x62b0('0x44')]());})){throw new db[(_0x62b0('0x31'))][(_0x62b0('0x32'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3d5c38={};_0x3d5c38[_0x62b0('0x45')]=_0x59f1a5['body'][_0x62b0('0x2e')]('senderName')?_0x59f1a5['body'][_0x62b0('0x45')]:_0x59f1a5['user'][_0x62b0('0x46')];_0x3d5c38['recipientsDescription']=_[_0x62b0('0x47')](_0x59f1a5[_0x62b0('0x2d')][_0x62b0('0x48')])?null:_0x59f1a5[_0x62b0('0x2d')][_0x62b0('0x48')];_0x3d5c38[_0x62b0('0x49')]=_0x59f1a5[_0x62b0('0x2d')]['beep']||![];_0x3d5c38[_0x62b0('0x4a')]=_0x59f1a5['user']['id'];return getContent(_0x59f1a5[_0x62b0('0x2d')])[_0x62b0('0x28')](function(_0xfb82ba){_0x3d5c38['body']=_0xfb82ba;return getRecipients(_0x40feaa);})['then'](function(_0x3dd3bf){_0x3d5c38['recipientsId']=_[_0x62b0('0x4b')](_0x3dd3bf)[_0x62b0('0x4c')](',');return db['sequelize'][_0x62b0('0x4d')](function(_0x1aa48){return db[_0x62b0('0x4e')]['create'](_0x3d5c38,{'raw':!![],'transaction':_0x1aa48})[_0x62b0('0x28')](function(_0x3b0d81){var _0x589eb2={'sender':_0x3d5c38[_0x62b0('0x45')],'description':_0x3d5c38[_0x62b0('0x48')],'content':_0x3d5c38[_0x62b0('0x2d')],'beep':_0x3d5c38[_0x62b0('0x49')]};_0x3dd3bf['forEach'](function(_0xbd95df){_0x589eb2[_0x62b0('0x4f')]=_0xbd95df;socket[_0x62b0('0x50')](_0x62b0('0x51'),_0x589eb2);});return _0x3b0d81;});});})[_0x62b0('0x28')](respondWithResult(_0x4c96e0,0xc9))[_0x62b0('0x52')](handleError(_0x4c96e0,null));};function getContent(_0x50f14c){return new BPromise(function(_0x4ab8c2,_0x32f89a){if(_0x50f14c[_0x62b0('0x2f')]){_0x4ab8c2(_0x50f14c[_0x62b0('0x2f')]);return;}return db[_0x62b0('0x53')]['findOne']({'attributes':[_0x62b0('0x54')],'where':{'id':_0x50f14c['TemplateId']},'raw':!![]})[_0x62b0('0x28')](function(_0x7c230e){if(!_0x7c230e)throw new db[(_0x62b0('0x31'))][(_0x62b0('0x32'))](_0x62b0('0x55'));var _0x2612ab=Mustache[_0x62b0('0x56')](_0x7c230e[_0x62b0('0x54')],_0x50f14c[_0x62b0('0x34')]);_0x4ab8c2(_0x2612ab);})[_0x62b0('0x52')](function(_0x2b8e26){_0x32f89a(_0x2b8e26);});});}function getRecipients(_0x11c285){return new BPromise(function(_0x25bdce,_0xcf794f){var _0x44c1db=[];var _0x1a1d4e=[];_0x11c285['forEach'](function(_0x1424e1){var _0x52fd53=_[_0x62b0('0x57')](_0x1424e1['model'][_0x62b0('0x44')]());if(_0x52fd53===_0x62b0('0x58')){_0x44c1db=_[_0x62b0('0x59')](_0x44c1db,_0x1424e1[_0x62b0('0x5a')]);}else{if(_['includes'](_0x52fd53,'queue'))_0x52fd53=_0x52fd53[_0x62b0('0x5b')](_0x62b0('0x5c'),'Queue');_0x1424e1['ids'][_0x62b0('0x5d')](function(_0x19b6b3){_0x1a1d4e['push'](getAgents(_0x52fd53,_0x19b6b3));});}});return BPromise[_0x62b0('0x5e')](_0x1a1d4e)[_0x62b0('0x28')](function(_0xb606c1){_0x44c1db=_[_0x62b0('0x59')](_0x44c1db,_[_0x62b0('0x5f')](_0xb606c1));_0x25bdce(_0x44c1db);})['catch'](function(_0x4eff56){_0xcf794f(_0x4eff56);});});}function getAgents(_0x392455,_0x4a0633){return new BPromise(function(_0x5422c8,_0x1c4314){return db[_0x392455][_0x62b0('0x60')]({'where':{'id':_0x4a0633}})[_0x62b0('0x28')](function(_0x166714){return _0x166714[_0x62b0('0x61')]({'attributes':['id'],'raw':!![]})[_0x62b0('0x28')](function(_0x27b311){var _0x37d424=_['map'](_0x27b311,'id');_0x5422c8(_0x37d424);});})[_0x62b0('0x52')](function(_0x4cfc6b){_0x1c4314(_0x4cfc6b);});});} \ No newline at end of file +var _0x9d86=['includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','create','forEach','recipient','emit','notification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','union','queue','replace','Queue','ids','push','flatten','getAgents','map','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','voicequeue','team','user','some'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x9d86,0x1f3));var _0x69d8=function(_0x41242c,_0x2c04ee){_0x41242c=_0x41242c-0x0;var _0x42b15d=_0x9d86[_0x41242c];return _0x42b15d;};'use strict';var pdf=require(_0x69d8('0x0'));var emlformat=require(_0x69d8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x69d8('0x2'));var rp=require(_0x69d8('0x3'));var moment=require(_0x69d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x69d8('0x5'));var util=require(_0x69d8('0x6'));var path=require(_0x69d8('0x7'));var sox=require(_0x69d8('0x8'));var csv=require(_0x69d8('0x9'));var ejs=require(_0x69d8('0xa'));var fs=require('fs');var _=require(_0x69d8('0xb'));var squel=require(_0x69d8('0xc'));var crypto=require('crypto');var jsforce=require(_0x69d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x69d8('0x9'));var querystring=require(_0x69d8('0xe'));var Papa=require(_0x69d8('0xf'));var Redis=require('ioredis');var authService=require(_0x69d8('0x10'));var qs=require(_0x69d8('0x11'));var as=require(_0x69d8('0x12'));var hardwareService=require(_0x69d8('0x13'));var logger=require('../../config/logger')(_0x69d8('0x14'));var utils=require(_0x69d8('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x69d8('0x16')]=_['defaults'](config[_0x69d8('0x16')],{'host':_0x69d8('0x17'),'port':0x18eb});var socket=require(_0x69d8('0x18'))(new Redis(config[_0x69d8('0x16')]));require(_0x69d8('0x19'))[_0x69d8('0x1a')](socket);function respondWithStatusCode(_0x1b6e4b,_0x1f0ae2){_0x1f0ae2=_0x1f0ae2||0xcc;return function(_0x5e2f38){if(_0x5e2f38){return _0x1b6e4b[_0x69d8('0x1b')](_0x1f0ae2);}return _0x1b6e4b[_0x69d8('0x1c')](_0x1f0ae2)[_0x69d8('0x1d')]();};}function respondWithResult(_0x576a7b,_0x3eb82a){_0x3eb82a=_0x3eb82a||0xc8;return function(_0x493be3){if(_0x493be3){return _0x576a7b[_0x69d8('0x1c')](_0x3eb82a)[_0x69d8('0x1e')](_0x493be3);}};}function respondWithFilteredResult(_0x560f4b,_0x2d9385){return function(_0x513f0d){if(_0x513f0d){var _0x54cd16=_0x513f0d[_0x69d8('0x1f')],_0x2fdd3b=_0x2d9385[_0x69d8('0x20')],_0x23af03=_0x2d9385[_0x69d8('0x20')]+_0x2d9385[_0x69d8('0x21')],_0x4107c1;if(_0x23af03>=_0x54cd16){_0x23af03=_0x54cd16;_0x4107c1=0xc8;}else{_0x4107c1=0xce;}_0x560f4b[_0x69d8('0x1c')](_0x4107c1);return _0x560f4b[_0x69d8('0x22')](_0x69d8('0x23'),_0x2fdd3b+'-'+_0x23af03+'/'+_0x54cd16)[_0x69d8('0x1e')](_0x513f0d);}return null;};}function patchUpdates(_0x135a43){return function(_0x21a9d0){try{jsonpatch[_0x69d8('0x24')](_0x21a9d0,_0x135a43,!![]);}catch(_0x2d602a){return BPromise['reject'](_0x2d602a);}return _0x21a9d0['save']();};}function saveUpdates(_0x16212a,_0x1cadfc){return function(_0xf4cef4){if(_0xf4cef4){return _0xf4cef4[_0x69d8('0x25')](_0x16212a)[_0x69d8('0x26')](function(_0x3a6d2c){return _0x3a6d2c;});}return null;};}function removeEntity(_0x190e7c,_0x102a3c){return function(_0x49b1ba){if(_0x49b1ba){return _0x49b1ba[_0x69d8('0x27')]()[_0x69d8('0x26')](function(){_0x190e7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53e0cc,_0x413c71){return function(_0x15f23f){if(!_0x15f23f){_0x53e0cc['sendStatus'](0x194);}return _0x15f23f;};}function handleError(_0x18a944,_0x45312d){_0x45312d=_0x45312d||0x1f4;return function(_0x2d8f08){logger[_0x69d8('0x28')](_0x2d8f08[_0x69d8('0x29')]);if(_0x2d8f08[_0x69d8('0x2a')]){delete _0x2d8f08[_0x69d8('0x2a')];}_0x18a944[_0x69d8('0x1c')](_0x45312d)['send'](_0x2d8f08);};}exports['sendNotification']=function(_0x50da4b,_0x19482c,_0x143c06){if(!_0x50da4b[_0x69d8('0x2b')][_0x69d8('0x2c')]('text')&&!_0x50da4b[_0x69d8('0x2b')][_0x69d8('0x2c')](_0x69d8('0x2d'))){throw new db[(_0x69d8('0x2e'))][(_0x69d8('0x2f'))](_0x69d8('0x30'));}else{if(_0x50da4b[_0x69d8('0x2b')][_0x69d8('0x2c')](_0x69d8('0x2d'))&&!_0x50da4b['body']['hasOwnProperty']('view')){throw new db[(_0x69d8('0x2e'))][(_0x69d8('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x50da4b['body'][_0x69d8('0x2c')](_0x69d8('0x31'))){throw new db[(_0x69d8('0x2e'))]['ValidationError'](_0x69d8('0x32'));}else{try{var _0x10e641=JSON['parse'](_0x50da4b[_0x69d8('0x2b')]['recipients']);}catch(_0x667fc4){logger[_0x69d8('0x28')](_0x667fc4);throw new db['Sequelize'][(_0x69d8('0x2f'))](_0x69d8('0x33'));}var _0x11ebf7=[_0x69d8('0x34'),_0x69d8('0x35'),_0x69d8('0x36'),'openchannelqueue','smsqueue',_0x69d8('0x37'),'whatsappqueue',_0x69d8('0x38'),_0x69d8('0x39')];if(_[_0x69d8('0x3a')](_0x10e641,function(_0x2abb32){return!_[_0x69d8('0x3b')](_0x11ebf7,_0x2abb32[_0x69d8('0x3c')]['toLowerCase']());})){throw new db[(_0x69d8('0x2e'))][(_0x69d8('0x2f'))](_0x69d8('0x3d'));}}}var _0x5e0602={};_0x5e0602[_0x69d8('0x3e')]=_0x50da4b[_0x69d8('0x2b')][_0x69d8('0x2c')](_0x69d8('0x3e'))?_0x50da4b[_0x69d8('0x2b')][_0x69d8('0x3e')]:_0x50da4b[_0x69d8('0x39')][_0x69d8('0x3f')];_0x5e0602['recipientsDescription']=_[_0x69d8('0x40')](_0x50da4b['body'][_0x69d8('0x41')])?null:_0x50da4b[_0x69d8('0x2b')][_0x69d8('0x41')];_0x5e0602[_0x69d8('0x42')]=_0x50da4b['body'][_0x69d8('0x42')]||![];_0x5e0602[_0x69d8('0x43')]=_0x50da4b[_0x69d8('0x39')]['id'];return getContent(_0x50da4b[_0x69d8('0x2b')])[_0x69d8('0x26')](function(_0x1945c1){_0x5e0602[_0x69d8('0x2b')]=_0x1945c1;return getRecipients(_0x10e641);})[_0x69d8('0x26')](function(_0x5ee975){_0x5e0602[_0x69d8('0x44')]=_[_0x69d8('0x45')](_0x5ee975)['join'](',');return db[_0x69d8('0x46')][_0x69d8('0x47')](function(_0x15f758){return db['Notification'][_0x69d8('0x48')](_0x5e0602,{'raw':!![],'transaction':_0x15f758})[_0x69d8('0x26')](function(_0x5b4a58){var _0x34fbf4={'sender':_0x5e0602[_0x69d8('0x3e')],'description':_0x5e0602[_0x69d8('0x41')],'content':_0x5e0602[_0x69d8('0x2b')],'beep':_0x5e0602['beep']};_0x5ee975[_0x69d8('0x49')](function(_0x412455){_0x34fbf4[_0x69d8('0x4a')]=_0x412455;socket[_0x69d8('0x4b')](_0x69d8('0x4c'),_0x34fbf4);});return _0x5b4a58;});});})[_0x69d8('0x26')](respondWithResult(_0x19482c,0xc9))[_0x69d8('0x4d')](handleError(_0x19482c,null));};function getContent(_0xcd8207){return new BPromise(function(_0x14f90c,_0x2e45da){if(_0xcd8207[_0x69d8('0x4e')]){_0x14f90c(_0xcd8207[_0x69d8('0x4e')]);return;}return db[_0x69d8('0x4f')][_0x69d8('0x50')]({'attributes':[_0x69d8('0x51')],'where':{'id':_0xcd8207[_0x69d8('0x2d')]},'raw':!![]})['then'](function(_0x50618d){if(!_0x50618d)throw new db[(_0x69d8('0x2e'))][(_0x69d8('0x2f'))](_0x69d8('0x52'));var _0x453fd8=Mustache['render'](_0x50618d['html'],_0xcd8207['view']);_0x14f90c(_0x453fd8);})[_0x69d8('0x4d')](function(_0x12e2da){_0x2e45da(_0x12e2da);});});}function getRecipients(_0x13ef63){return new BPromise(function(_0x3703ec,_0x4d7492){var _0x5392be=[];var _0x4b5614=[];_0x13ef63[_0x69d8('0x49')](function(_0x27fbab){var _0x28fa2b=_[_0x69d8('0x53')](_0x27fbab['model']['toLowerCase']());if(_0x28fa2b==='User'){_0x5392be=_[_0x69d8('0x54')](_0x5392be,_0x27fbab['ids']);}else{if(_[_0x69d8('0x3b')](_0x28fa2b,_0x69d8('0x55')))_0x28fa2b=_0x28fa2b[_0x69d8('0x56')](_0x69d8('0x55'),_0x69d8('0x57'));_0x27fbab[_0x69d8('0x58')][_0x69d8('0x49')](function(_0x40d123){_0x4b5614[_0x69d8('0x59')](getAgents(_0x28fa2b,_0x40d123));});}});return BPromise['all'](_0x4b5614)[_0x69d8('0x26')](function(_0x572bd2){_0x5392be=_[_0x69d8('0x54')](_0x5392be,_[_0x69d8('0x5a')](_0x572bd2));_0x3703ec(_0x5392be);})[_0x69d8('0x4d')](function(_0x30b778){_0x4d7492(_0x30b778);});});}function getAgents(_0x5c4713,_0x4ca9f7){return new BPromise(function(_0x1de9af,_0x231a99){return db[_0x5c4713]['findOne']({'where':{'id':_0x4ca9f7}})['then'](function(_0x28dba1){return _0x28dba1[_0x69d8('0x5b')]({'attributes':['id'],'raw':!![]})[_0x69d8('0x26')](function(_0x58cdad){var _0x5bf3f6=_[_0x69d8('0x5c')](_0x58cdad,'id');_0x1de9af(_0x5bf3f6);});})['catch'](function(_0x55b220){_0x231a99(_0x55b220);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index b31bdbd..6a2c8bb 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x2032,0xd9));var _0x2203=function(_0x4f155f,_0x450fae){_0x4f155f=_0x4f155f-0x0;var _0x2e2dd0=_0x2032[_0x4f155f];return _0x2e2dd0;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x2032,0xd9));var _0x2203=function(_0x12da62,_0xa0b7fe){_0x12da62=_0x12da62-0x0;var _0x3ff445=_0x2032[_0x12da62];return _0x3ff445;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index c62d787..71894e4 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab1b=['notifications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./notification.attributes','exports','Notification'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xab1b,0x1e3));var _0xbab1=function(_0x454ff3,_0x26d076){_0x454ff3=_0x454ff3-0x0;var _0x4d2510=_0xab1b[_0x454ff3];return _0x4d2510;};'use strict';var _=require(_0xbab1('0x0'));var util=require('util');var logger=require(_0xbab1('0x1'))(_0xbab1('0x2'));var moment=require(_0xbab1('0x3'));var BPromise=require(_0xbab1('0x4'));var rp=require(_0xbab1('0x5'));var fs=require('fs');var path=require(_0xbab1('0x6'));var rimraf=require('rimraf');var config=require(_0xbab1('0x7'));var attributes=require(_0xbab1('0x8'));module[_0xbab1('0x9')]=function(_0x1fd1ba,_0x57ffc8){return _0x1fd1ba['define'](_0xbab1('0xa'),attributes,{'tableName':_0xbab1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbab1('0xc')});}; \ No newline at end of file +var _0x0603=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','lodash'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x0603,0x8b));var _0x3060=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x0603[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x3060('0x0'));var util=require(_0x3060('0x1'));var logger=require(_0x3060('0x2'))(_0x3060('0x3'));var moment=require(_0x3060('0x4'));var BPromise=require('bluebird');var rp=require(_0x3060('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3060('0x6'));var config=require(_0x3060('0x7'));var attributes=require('./notification.attributes');module[_0x3060('0x8')]=function(_0x3e24a7,_0x14985f){return _0x3e24a7[_0x3060('0x9')]('Notification',attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 366afe4..1d8e704 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdaf=['info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./notification.socket','register','request','then'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0xcdaf,0x103));var _0xfcda=function(_0x4faeee,_0x20ae20){_0x4faeee=_0x4faeee-0x0;var _0x413857=_0xcdaf[_0x4faeee];return _0x413857;};'use strict';var _=require(_0xfcda('0x0'));var util=require(_0xfcda('0x1'));var moment=require(_0xfcda('0x2'));var BPromise=require(_0xfcda('0x3'));var rs=require(_0xfcda('0x4'));var fs=require('fs');var Redis=require(_0xfcda('0x5'));var db=require(_0xfcda('0x6'))['db'];var utils=require(_0xfcda('0x7'));var logger=require('../../config/logger')(_0xfcda('0x8'));var config=require(_0xfcda('0x9'));var jayson=require(_0xfcda('0xa'));var client=jayson[_0xfcda('0xb')][_0xfcda('0xc')]({'port':0x232a});config[_0xfcda('0xd')]=_[_0xfcda('0xe')](config['redis'],{'host':_0xfcda('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfcda('0x10'))[_0xfcda('0x11')](socket);function respondWithRpcPromise(_0x42cc45,_0x783df1,_0x23972b){return new BPromise(function(_0x275906,_0x39a689){return client[_0xfcda('0x12')](_0x42cc45,_0x23972b)[_0xfcda('0x13')](function(_0xa12604){logger[_0xfcda('0x14')](_0xfcda('0x15'),_0x783df1,'request\x20sent');logger[_0xfcda('0x16')](_0xfcda('0x17'),_0x783df1,_0xfcda('0x18'),JSON[_0xfcda('0x19')](_0xa12604));if(_0xa12604['error']){if(_0xa12604[_0xfcda('0x1a')][_0xfcda('0x1b')]===0x1f4){logger[_0xfcda('0x1a')]('Notification,\x20%s,\x20%s',_0x783df1,_0xa12604[_0xfcda('0x1a')]['message']);return _0x39a689(_0xa12604[_0xfcda('0x1a')][_0xfcda('0x1c')]);}logger[_0xfcda('0x1a')](_0xfcda('0x15'),_0x783df1,_0xa12604['error'][_0xfcda('0x1c')]);return _0x275906(_0xa12604[_0xfcda('0x1a')]['message']);}else{logger[_0xfcda('0x14')](_0xfcda('0x15'),_0x783df1,_0xfcda('0x18'));_0x275906(_0xa12604[_0xfcda('0x1d')][_0xfcda('0x1c')]);}})[_0xfcda('0x1e')](function(_0x1f6283){logger[_0xfcda('0x1a')](_0xfcda('0x15'),_0x783df1,_0x1f6283);_0x39a689(_0x1f6283);});});} \ No newline at end of file +var _0x4e98=['request\x20sent','stringify','error','code','Notification,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0x4e98,0x18e));var _0x84e9=function(_0x335373,_0x14159f){_0x335373=_0x335373-0x0;var _0x25d87c=_0x4e98[_0x335373];return _0x25d87c;};'use strict';var _=require(_0x84e9('0x0'));var util=require('util');var moment=require(_0x84e9('0x1'));var BPromise=require(_0x84e9('0x2'));var rs=require(_0x84e9('0x3'));var fs=require('fs');var Redis=require(_0x84e9('0x4'));var db=require(_0x84e9('0x5'))['db'];var utils=require(_0x84e9('0x6'));var logger=require(_0x84e9('0x7'))(_0x84e9('0x8'));var config=require('../../config/environment');var jayson=require(_0x84e9('0x9'));var client=jayson[_0x84e9('0xa')][_0x84e9('0xb')]({'port':0x232a});config[_0x84e9('0xc')]=_[_0x84e9('0xd')](config[_0x84e9('0xc')],{'host':_0x84e9('0xe'),'port':0x18eb});var socket=require(_0x84e9('0xf'))(new Redis(config[_0x84e9('0xc')]));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x175888,_0x1bc357,_0x4db842){return new BPromise(function(_0x1fa843,_0x340ce0){return client[_0x84e9('0x10')](_0x175888,_0x4db842)[_0x84e9('0x11')](function(_0x1ed8d8){logger['info']('Notification,\x20%s,\x20%s',_0x1bc357,_0x84e9('0x12'));logger['debug']('Notification,\x20%s,\x20%s,\x20%s',_0x1bc357,_0x84e9('0x12'),JSON[_0x84e9('0x13')](_0x1ed8d8));if(_0x1ed8d8[_0x84e9('0x14')]){if(_0x1ed8d8[_0x84e9('0x14')][_0x84e9('0x15')]===0x1f4){logger[_0x84e9('0x14')](_0x84e9('0x16'),_0x1bc357,_0x1ed8d8['error'][_0x84e9('0x17')]);return _0x340ce0(_0x1ed8d8['error']['message']);}logger[_0x84e9('0x14')](_0x84e9('0x16'),_0x1bc357,_0x1ed8d8[_0x84e9('0x14')]['message']);return _0x1fa843(_0x1ed8d8[_0x84e9('0x14')][_0x84e9('0x17')]);}else{logger[_0x84e9('0x18')](_0x84e9('0x16'),_0x1bc357,_0x84e9('0x12'));_0x1fa843(_0x1ed8d8['result'][_0x84e9('0x17')]);}})[_0x84e9('0x19')](function(_0x527a40){logger['error']('Notification,\x20%s,\x20%s',_0x1bc357,_0x527a40);_0x340ce0(_0x527a40);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 02bf09d..388c4eb 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2181=['notification:','./notification.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2181,0x169));var _0x1218=function(_0x36a2ee,_0x522a1){_0x36a2ee=_0x36a2ee-0x0;var _0x1dd165=_0x2181[_0x36a2ee];return _0x1dd165;};'use strict';var NotificationEvents=require(_0x1218('0x0'));var events=[_0x1218('0x1'),_0x1218('0x2'),_0x1218('0x3')];function createListener(_0x4f459e,_0x5b064e){return function(_0x5583df){_0x5b064e[_0x1218('0x4')](_0x4f459e,_0x5583df);};}function removeListener(_0x1dbc54,_0x221e2d){return function(){NotificationEvents[_0x1218('0x5')](_0x1dbc54,_0x221e2d);};}exports[_0x1218('0x6')]=function(_0x4058b0){for(var _0x5d2ba4=0x0,_0x3f8b75=events[_0x1218('0x7')];_0x5d2ba4<_0x3f8b75;_0x5d2ba4++){var _0x2b8a3a=events[_0x5d2ba4];var _0x435aae=createListener(_0x1218('0x8')+_0x2b8a3a,_0x4058b0);NotificationEvents['on'](_0x2b8a3a,_0x435aae);}}; \ No newline at end of file +var _0xfc85=['update','emit','removeListener','register','length','notification:','./notification.events','save','remove'];(function(_0x1909c6,_0xcf4e36){var _0x2942d2=function(_0x53b485){while(--_0x53b485){_0x1909c6['push'](_0x1909c6['shift']());}};_0x2942d2(++_0xcf4e36);}(_0xfc85,0x165));var _0x5fc8=function(_0x78e873,_0x4b38b0){_0x78e873=_0x78e873-0x0;var _0x45abe8=_0xfc85[_0x78e873];return _0x45abe8;};'use strict';var NotificationEvents=require(_0x5fc8('0x0'));var events=[_0x5fc8('0x1'),_0x5fc8('0x2'),_0x5fc8('0x3')];function createListener(_0x402382,_0x5bec49){return function(_0xc6e89f){_0x5bec49[_0x5fc8('0x4')](_0x402382,_0xc6e89f);};}function removeListener(_0x2a7f0e,_0x260609){return function(){NotificationEvents[_0x5fc8('0x5')](_0x2a7f0e,_0x260609);};}exports[_0x5fc8('0x6')]=function(_0x239928){for(var _0x1d992f=0x0,_0x42d0e3=events[_0x5fc8('0x7')];_0x1d992f<_0x42d0e3;_0x1d992f++){var _0x21cbbe=events[_0x1d992f];var _0x3e8366=createListener(_0x5fc8('0x8')+_0x21cbbe,_0x239928);NotificationEvents['on'](_0x21cbbe,_0x3e8366);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c8cda02..b37bea9 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 _0xbfcb=['getInteractions','getAgents','post','create','addDisposition','/:id/canned_answers','/:id/notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id/dispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x2a75eb,_0x30cdb7){var _0x4a9b70=function(_0x557663){while(--_0x557663){_0x2a75eb['push'](_0x2a75eb['shift']());}};_0x4a9b70(++_0x30cdb7);}(_0xbfcb,0x86));var _0xbbfc=function(_0x879c52,_0x4598bd){_0x879c52=_0x879c52-0x0;var _0x33eaac=_0xbfcb[_0x879c52];return _0x33eaac;};'use strict';var multer=require(_0xbbfc('0x0'));var util=require(_0xbbfc('0x1'));var path=require(_0xbbfc('0x2'));var timeout=require(_0xbbfc('0x3'));var express=require(_0xbbfc('0x4'));var router=express[_0xbbfc('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbbfc('0x6'));var config=require(_0xbbfc('0x7'));var controller=require(_0xbbfc('0x8'));router[_0xbbfc('0x9')]('/',auth[_0xbbfc('0xa')](),controller[_0xbbfc('0xb')]);router[_0xbbfc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xbbfc('0xc')]);router[_0xbbfc('0x9')]('/:id',auth[_0xbbfc('0xa')](),controller['show']);router['get'](_0xbbfc('0xd'),auth[_0xbbfc('0xa')](),controller['getDispositions']);router[_0xbbfc('0x9')]('/:id/canned_answers',auth[_0xbbfc('0xa')](),controller[_0xbbfc('0xe')]);router['get'](_0xbbfc('0xf'),auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x10')]);router['get'](_0xbbfc('0x11'),auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x12')]);router[_0xbbfc('0x9')]('/:id/users',auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x13')]);router[_0xbbfc('0x14')]('/',auth['isAuthenticated'](),controller[_0xbbfc('0x15')]);router[_0xbbfc('0x14')](_0xbbfc('0xd'),auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x16')]);router[_0xbbfc('0x14')](_0xbbfc('0x17'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xbbfc('0x18'),controller['notify']);router[_0xbbfc('0x14')](_0xbbfc('0xf'),auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x19')]);router[_0xbbfc('0x14')](_0xbbfc('0x1a'),auth['isAuthenticated'](),controller[_0xbbfc('0x1b')]);router[_0xbbfc('0x14')](_0xbbfc('0x1c'),auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x1d')]);router[_0xbbfc('0x1e')](_0xbbfc('0x1f'),auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x20')]);router[_0xbbfc('0x21')](_0xbbfc('0x1f'),auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x22')]);router[_0xbbfc('0x21')](_0xbbfc('0xd'),auth[_0xbbfc('0xa')](),controller[_0xbbfc('0x23')]);router[_0xbbfc('0x21')](_0xbbfc('0x17'),auth['isAuthenticated'](),controller[_0xbbfc('0x24')]);router[_0xbbfc('0x21')]('/:id/users',auth[_0xbbfc('0xa')](),controller['removeAgents']);module[_0xbbfc('0x25')]=router; \ No newline at end of file +var _0x04da=['create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post'];(function(_0x20e2e3,_0x3f07c4){var _0x4f1945=function(_0x37330a){while(--_0x37330a){_0x20e2e3['push'](_0x20e2e3['shift']());}};_0x4f1945(++_0x3f07c4);}(_0x04da,0xe2));var _0xa04d=function(_0x2f32c4,_0x531dc6){_0x2f32c4=_0x2f32c4-0x0;var _0x3f3018=_0x04da[_0x2f32c4];return _0x3f3018;};'use strict';var multer=require('multer');var util=require(_0xa04d('0x0'));var path=require('path');var timeout=require(_0xa04d('0x1'));var express=require(_0xa04d('0x2'));var router=express[_0xa04d('0x3')]();var auth=require(_0xa04d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa04d('0x5'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xa04d('0x6')](),controller[_0xa04d('0x7')]);router[_0xa04d('0x8')](_0xa04d('0x9'),auth[_0xa04d('0x6')](),controller['describe']);router['get']('/:id',auth[_0xa04d('0x6')](),controller[_0xa04d('0xa')]);router[_0xa04d('0x8')](_0xa04d('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xa04d('0x8')](_0xa04d('0xc'),auth[_0xa04d('0x6')](),controller[_0xa04d('0xd')]);router[_0xa04d('0x8')]('/:id/applications',auth[_0xa04d('0x6')](),controller[_0xa04d('0xe')]);router[_0xa04d('0x8')](_0xa04d('0xf'),auth['isAuthenticated'](),controller[_0xa04d('0x10')]);router[_0xa04d('0x8')](_0xa04d('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa04d('0x12')]('/',auth[_0xa04d('0x6')](),controller[_0xa04d('0x13')]);router[_0xa04d('0x12')](_0xa04d('0xb'),auth['isAuthenticated'](),controller[_0xa04d('0x14')]);router[_0xa04d('0x12')](_0xa04d('0xc'),auth[_0xa04d('0x6')](),controller[_0xa04d('0x15')]);router[_0xa04d('0x12')](_0xa04d('0x16'),controller[_0xa04d('0x17')]);router[_0xa04d('0x12')](_0xa04d('0x18'),auth[_0xa04d('0x6')](),controller[_0xa04d('0x19')]);router[_0xa04d('0x12')]('/:id/users',auth[_0xa04d('0x6')](),controller['addAgents']);router[_0xa04d('0x12')]('/:id/send',auth[_0xa04d('0x6')](),controller['send']);router[_0xa04d('0x1a')](_0xa04d('0x1b'),auth[_0xa04d('0x6')](),controller[_0xa04d('0x1c')]);router[_0xa04d('0x1d')](_0xa04d('0x1b'),auth[_0xa04d('0x6')](),controller[_0xa04d('0x1e')]);router['delete']('/:id/dispositions',auth[_0xa04d('0x6')](),controller[_0xa04d('0x1f')]);router[_0xa04d('0x1d')]('/:id/canned_answers',auth[_0xa04d('0x6')](),controller[_0xa04d('0x20')]);router[_0xa04d('0x1d')]('/:id/users',auth[_0xa04d('0x6')](),controller[_0xa04d('0x21')]);module[_0xa04d('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 8abfc66..ebad6ea 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 _0xf005=['sequelize','randomstring','exports','STRING','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x4007f2,_0x128ebe){var _0x3c0de0=function(_0x3851db){while(--_0x3851db){_0x4007f2['push'](_0x4007f2['shift']());}};_0x3c0de0(++_0x128ebe);}(_0xf005,0x198));var _0x5f00=function(_0x577fc7,_0x1ba618){_0x577fc7=_0x577fc7-0x0;var _0x54134d=_0xf005[_0x577fc7];return _0x54134d;};'use strict';var Sequelize=require(_0x5f00('0x0'));var rs=require(_0x5f00('0x1'));module[_0x5f00('0x2')]={'name':{'type':Sequelize[_0x5f00('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x5f00('0x3')]},'token':{'type':Sequelize[_0x5f00('0x3')],'defaultValue':function(){return rs[_0x5f00('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5f00('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5f00('0x5')],'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[_0x5f00('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5f00('0x3')]},'queueTransfer':{'type':Sequelize[_0x5f00('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5f00('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5f00('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5f00('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5f00('0x6')],'defaultValue':![],'comment':_0x5f00('0x8'),'set':function(_0x5383a7){if(!_0x5383a7)this['setDataValue'](_0x5f00('0x9'),null);this[_0x5f00('0xa')](_0x5f00('0xb'),_0x5383a7);}}}; \ No newline at end of file +var _0x3966=['exports','name','STRING','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0x3966,0x132));var _0x6396=function(_0x563f1e,_0x25fcba){_0x563f1e=_0x563f1e-0x0;var _0xa3627b=_0x3966[_0x563f1e];return _0xa3627b;};'use strict';var Sequelize=require(_0x6396('0x0'));var rs=require(_0x6396('0x1'));module[_0x6396('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x6396('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6396('0x4')]},'token':{'type':Sequelize[_0x6396('0x4')],'defaultValue':function(){return rs[_0x6396('0x5')]();}},'replyUri':{'type':Sequelize[_0x6396('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6396('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6396('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6396('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6396('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6396('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6396('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6396('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6396('0x9'),'set':function(_0x413b7a){if(!_0x413b7a)this[_0x6396('0xa')]('mandatoryDispositionPauseId',null);this[_0x6396('0xa')]('mandatoryDisposition',_0x413b7a);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 16beabd..12a677e 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 _0x6632=['priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','interaction','created','autoclose','close','OpenchannelMessage','AttachmentId','UserId','unshift','agent','forcedOwnership','startRouting','Start','EventManager','sequelize','bulkCreate','getApplications','Contact','User','fullname','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','length','removeAnswers','notify','CmContact','difference','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','OpenchannelApplication','Applications','account','list','applications','orderBy'];(function(_0x5f44c4,_0x5df001){var _0x12a0f8=function(_0x2a30e4){while(--_0x2a30e4){_0x5f44c4['push'](_0x5f44c4['shift']());}};_0x12a0f8(++_0x5df001);}(_0x6632,0x1a6));var _0x2663=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0x6632[_0xe1b5f6];return _0x44636e;};'use strict';var pdf=require(_0x2663('0x0'));var emlformat=require(_0x2663('0x1'));var rimraf=require(_0x2663('0x2'));var zipdir=require(_0x2663('0x3'));var jsonpatch=require(_0x2663('0x4'));var rp=require('request-promise');var moment=require(_0x2663('0x5'));var BPromise=require(_0x2663('0x6'));var Mustache=require(_0x2663('0x7'));var util=require(_0x2663('0x8'));var path=require(_0x2663('0x9'));var sox=require(_0x2663('0xa'));var csv=require('to-csv');var ejs=require(_0x2663('0xb'));var fs=require('fs');var _=require(_0x2663('0xc'));var squel=require(_0x2663('0xd'));var crypto=require(_0x2663('0xe'));var jsforce=require(_0x2663('0xf'));var deskjs=require(_0x2663('0x10'));var toCsv=require(_0x2663('0x11'));var querystring=require(_0x2663('0x12'));var Papa=require(_0x2663('0x13'));var Redis=require(_0x2663('0x14'));var authService=require(_0x2663('0x15'));var qs=require(_0x2663('0x16'));var as=require(_0x2663('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2663('0x18'))(_0x2663('0x19'));var utils=require(_0x2663('0x1a'));var config=require(_0x2663('0x1b'));var db=require(_0x2663('0x1c'))['db'];config['redis']=_[_0x2663('0x1d')](config[_0x2663('0x1e')],{'host':_0x2663('0x1f'),'port':0x18eb});var socket=require(_0x2663('0x20'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x2663('0x21')](socket);var jayson=require(_0x2663('0x22'));var client=jayson[_0x2663('0x23')][_0x2663('0x24')]({'port':0x232c});var client9002=jayson[_0x2663('0x23')][_0x2663('0x24')]({'port':0x232a});function checkPasswordPattern(_0x344873,_0x532735,_0xf91d4c){if(_0xf91d4c){var _0x32540b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32540b[_0x2663('0x25')](_0x532735)){return _0x344873;}else{throw new db[(_0x2663('0x26'))][(_0x2663('0x27'))](_0x2663('0x28'));}}else{return _0x344873;}}function respondWithRpcPromise(_0x60f0fb,_0x45f051,_0x26d909,_0x525cab){return new BPromise(function(_0x29b761,_0x569786){var _0x82857b=_0x525cab||client;return _0x82857b[_0x2663('0x29')](_0x60f0fb,_0x26d909)[_0x2663('0x2a')](function(_0x43789d){logger[_0x2663('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x45f051,_0x2663('0x2c'));logger[_0x2663('0x2d')](_0x2663('0x2e'),_0x45f051,_0x2663('0x2c'),JSON[_0x2663('0x2f')](_0x43789d));if(_0x43789d[_0x2663('0x30')]){if(_0x43789d[_0x2663('0x30')][_0x2663('0x31')]===0x1f4){logger[_0x2663('0x30')](_0x2663('0x32'),_0x45f051,_0x43789d[_0x2663('0x30')][_0x2663('0x33')]);return _0x569786(_0x43789d['error']['message']);}logger['error'](_0x2663('0x32'),_0x45f051,_0x43789d['error']['message']);return _0x29b761(_0x43789d[_0x2663('0x30')]['message']);}else{logger[_0x2663('0x2b')](_0x2663('0x32'),_0x45f051,_0x2663('0x2c'));_0x29b761(_0x43789d[_0x2663('0x34')]['message']);}})[_0x2663('0x35')](function(_0x38c92e){logger[_0x2663('0x30')]('OpenchannelAccount,\x20%s,\x20%s',_0x45f051,_0x38c92e);_0x569786(_0x38c92e);});});}function respondWithStatusCode(_0x24484c,_0x34302e){_0x34302e=_0x34302e||0xcc;return function(_0x37aea7){if(_0x37aea7){return _0x24484c['sendStatus'](_0x34302e);}return _0x24484c[_0x2663('0x36')](_0x34302e)[_0x2663('0x37')]();};}function respondWithResult(_0x3ca018,_0x2012a6){_0x2012a6=_0x2012a6||0xc8;return function(_0x1d6ed7){if(_0x1d6ed7){return _0x3ca018[_0x2663('0x36')](_0x2012a6)[_0x2663('0x38')](_0x1d6ed7);}};}function respondWithFilteredResult(_0x284d4f,_0x4cb62b){return function(_0x242390){if(_0x242390){var _0x162f13=_0x242390[_0x2663('0x39')],_0x2eb982=_0x4cb62b['offset'],_0x4b3e7d=_0x4cb62b[_0x2663('0x3a')]+_0x4cb62b[_0x2663('0x3b')],_0x52ee03;if(_0x4b3e7d>=_0x162f13){_0x4b3e7d=_0x162f13;_0x52ee03=0xc8;}else{_0x52ee03=0xce;}_0x284d4f[_0x2663('0x36')](_0x52ee03);return _0x284d4f[_0x2663('0x3c')](_0x2663('0x3d'),_0x2eb982+'-'+_0x4b3e7d+'/'+_0x162f13)[_0x2663('0x38')](_0x242390);}return null;};}function patchUpdates(_0x261999){return function(_0x4fa530){try{jsonpatch['apply'](_0x4fa530,_0x261999,!![]);}catch(_0x5beb4b){return BPromise[_0x2663('0x3e')](_0x5beb4b);}return _0x4fa530[_0x2663('0x3f')]();};}function saveUpdates(_0x12c954,_0x443e51){return function(_0x159264){if(_0x159264){return _0x159264[_0x2663('0x40')](_0x12c954)['then'](function(_0xf1deb4){return _0xf1deb4;});}return null;};}function removeEntity(_0x5585dd,_0x122a0a){return function(_0x50daa5){if(_0x50daa5){return _0x50daa5[_0x2663('0x41')]()[_0x2663('0x2a')](function(){var _0x2ba255=_0x50daa5[_0x2663('0x42')]({'plain':!![]});var _0xfa079f=_0x2663('0x43');return db[_0x2663('0x44')][_0x2663('0x41')]({'where':{'type':_0xfa079f,'resourceId':_0x2ba255['id']}})[_0x2663('0x2a')](function(){return _0x50daa5;});})[_0x2663('0x2a')](function(){_0x5585dd['status'](0xcc)[_0x2663('0x37')]();});}};}function handleEntityNotFound(_0x24d418,_0x3e4682){return function(_0x2bbeb2){if(!_0x2bbeb2){_0x24d418[_0x2663('0x45')](0x194);}return _0x2bbeb2;};}function handleError(_0x12235f,_0x2eb50f){_0x2eb50f=_0x2eb50f||0x1f4;return function(_0x2682e5){logger[_0x2663('0x30')](_0x2682e5[_0x2663('0x46')]);if(_0x2682e5[_0x2663('0x47')]){delete _0x2682e5[_0x2663('0x47')];}_0x12235f[_0x2663('0x36')](_0x2eb50f)[_0x2663('0x48')](_0x2682e5);};}exports[_0x2663('0x49')]=function(_0x20a873,_0xd4c3ab){var _0x288fef={'include':[{'model':db[_0x2663('0x4a')],'as':_0x2663('0x4b')}]},_0x3bebc3={},_0x44e04f={'count':0x0,'rows':[]};var _0x192112=_['map'](db[_0x2663('0x4c')][_0x2663('0x4d')],function(_0x3738e4){return{'name':_0x3738e4['fieldName'],'type':_0x3738e4[_0x2663('0x4e')][_0x2663('0x4f')]};});_0x3bebc3['model']=_[_0x2663('0x50')](_0x192112,'name');_0x3bebc3[_0x2663('0x51')]=_[_0x2663('0x52')](_0x20a873[_0x2663('0x51')]);_0x3bebc3[_0x2663('0x53')]=_[_0x2663('0x54')](_0x3bebc3['model'],_0x3bebc3[_0x2663('0x51')]);_0x288fef[_0x2663('0x55')]=_[_0x2663('0x54')](_0x3bebc3[_0x2663('0x56')],qs[_0x2663('0x57')](_0x20a873[_0x2663('0x51')][_0x2663('0x57')]));_0x288fef[_0x2663('0x55')]=_0x288fef['attributes']['length']?_0x288fef[_0x2663('0x55')]:_0x3bebc3[_0x2663('0x56')];if(!_0x20a873[_0x2663('0x51')][_0x2663('0x58')](_0x2663('0x59'))){_0x288fef[_0x2663('0x3b')]=qs[_0x2663('0x3b')](_0x20a873[_0x2663('0x51')][_0x2663('0x3b')]);_0x288fef[_0x2663('0x3a')]=qs[_0x2663('0x3a')](_0x20a873[_0x2663('0x51')][_0x2663('0x3a')]);}_0x288fef[_0x2663('0x5a')]=qs[_0x2663('0x5b')](_0x20a873[_0x2663('0x51')]['sort']);_0x288fef[_0x2663('0x5c')]=qs[_0x2663('0x53')](_[_0x2663('0x5d')](_0x20a873[_0x2663('0x51')],_0x3bebc3[_0x2663('0x53')]),_0x192112);if(_0x20a873[_0x2663('0x51')][_0x2663('0x5e')]){_0x288fef['where']=_[_0x2663('0x5f')](_0x288fef[_0x2663('0x5c')],{'$or':_[_0x2663('0x50')](_0x192112,function(_0x45f230){if(_0x45f230[_0x2663('0x4e')]!==_0x2663('0x60')){var _0x1dc702={};_0x1dc702[_0x45f230[_0x2663('0x47')]]={'$like':'%'+_0x20a873['query'][_0x2663('0x5e')]+'%'};return _0x1dc702;}})});}_0x288fef=_[_0x2663('0x5f')]({},_0x288fef,_0x20a873[_0x2663('0x61')]);var _0x108998={'where':_0x288fef[_0x2663('0x5c')]};return db[_0x2663('0x4c')][_0x2663('0x39')](_0x108998)[_0x2663('0x2a')](function(_0x261c7c){_0x44e04f['count']=_0x261c7c;if(_0x20a873[_0x2663('0x51')][_0x2663('0x62')]){_0x288fef['include']=[{'all':!![]}];}return db[_0x2663('0x4c')][_0x2663('0x63')](_0x288fef);})['then'](function(_0x4ed28f){_0x44e04f['rows']=_0x4ed28f;return _0x44e04f;})[_0x2663('0x2a')](respondWithFilteredResult(_0xd4c3ab,_0x288fef))[_0x2663('0x35')](handleError(_0xd4c3ab,null));};exports[_0x2663('0x64')]=function(_0x3912f0,_0xdc8ed2){var _0x3a0a5a={'raw':![],'where':{'id':_0x3912f0[_0x2663('0x65')]['id']},'include':[{'model':db[_0x2663('0x4a')],'as':_0x2663('0x4b')}]},_0x28b4bb={};_0x28b4bb['model']=_['keys'](db['OpenchannelAccount'][_0x2663('0x4d')]);_0x28b4bb[_0x2663('0x51')]=_['keys'](_0x3912f0[_0x2663('0x51')]);_0x28b4bb[_0x2663('0x53')]=_[_0x2663('0x54')](_0x28b4bb[_0x2663('0x56')],_0x28b4bb['query']);_0x3a0a5a['attributes']=_[_0x2663('0x54')](_0x28b4bb[_0x2663('0x56')],qs[_0x2663('0x57')](_0x3912f0[_0x2663('0x51')]['fields']));_0x3a0a5a[_0x2663('0x55')]=_0x3a0a5a[_0x2663('0x55')]['length']?_0x3a0a5a[_0x2663('0x55')]:_0x28b4bb[_0x2663('0x56')];if(_0x3912f0[_0x2663('0x51')]['includeAll']){_0x3a0a5a[_0x2663('0x66')]=[{'all':!![]}];}_0x3a0a5a=_[_0x2663('0x5f')]({},_0x3a0a5a,_0x3912f0['options']);return db['OpenchannelAccount'][_0x2663('0x67')](_0x3a0a5a)[_0x2663('0x2a')](handleEntityNotFound(_0xdc8ed2,null))['then'](respondWithResult(_0xdc8ed2,null))[_0x2663('0x35')](handleError(_0xdc8ed2,null));};exports[_0x2663('0x68')]=function(_0x8c4f18,_0x47460f){return db['OpenchannelAccount'][_0x2663('0x68')](_0x8c4f18[_0x2663('0x69')],{})[_0x2663('0x2a')](function(_0x300bff){var _0x3f22a7=_0x8c4f18[_0x2663('0x6a')][_0x2663('0x42')]({'plain':!![]});if(!_0x3f22a7)throw new Error(_0x2663('0x6b'));if(_0x3f22a7['role']==='user'){var _0x4c971e=_0x300bff[_0x2663('0x42')]({'plain':!![]});var _0x31e7f7=_0x2663('0x43');return db['UserProfileSection'][_0x2663('0x67')]({'where':{'name':_0x31e7f7,'userProfileId':_0x3f22a7[_0x2663('0x6c')]},'raw':!![]})['then'](function(_0x146316){if(_0x146316&&_0x146316['autoAssociation']===0x0){return db[_0x2663('0x44')][_0x2663('0x68')]({'name':_0x4c971e[_0x2663('0x47')],'resourceId':_0x4c971e['id'],'type':_0x146316['name'],'sectionId':_0x146316['id']},{})['then'](function(){return _0x300bff;});}else{return _0x300bff;}})['catch'](function(_0x514e29){logger[_0x2663('0x30')](_0x2663('0x6d'),_0x514e29);throw _0x514e29;});}return _0x300bff;})[_0x2663('0x2a')](respondWithResult(_0x47460f,0xc9))[_0x2663('0x35')](handleError(_0x47460f,null));};exports['update']=function(_0x66e4fb,_0x61ae92){if(_0x66e4fb[_0x2663('0x69')]['id']){delete _0x66e4fb['body']['id'];}return db[_0x2663('0x4c')][_0x2663('0x67')]({'where':{'id':_0x66e4fb[_0x2663('0x65')]['id']},'include':[{'model':db[_0x2663('0x4a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x61ae92,null))['then'](saveUpdates(_0x66e4fb[_0x2663('0x69')],null))['then'](respondWithResult(_0x61ae92,null))[_0x2663('0x35')](handleError(_0x61ae92,null));};exports[_0x2663('0x41')]=function(_0x4dc8f9,_0x40e752){return db[_0x2663('0x4c')][_0x2663('0x67')]({'where':{'id':_0x4dc8f9[_0x2663('0x65')]['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x40e752,null))[_0x2663('0x2a')](removeEntity(_0x40e752,null))[_0x2663('0x35')](handleError(_0x40e752,null));};exports[_0x2663('0x6e')]=function(_0x4d1b6f,_0x5cde89){return db[_0x2663('0x4c')][_0x2663('0x6e')]()[_0x2663('0x2a')](respondWithResult(_0x5cde89,null))['catch'](handleError(_0x5cde89,null));};exports[_0x2663('0x6f')]=function(_0x2298f6,_0x40c5f2,_0x32dc56){if(_0x2298f6[_0x2663('0x69')]['id']){delete _0x2298f6[_0x2663('0x69')]['id'];}return db[_0x2663('0x4c')][_0x2663('0x67')]({'where':{'id':_0x2298f6[_0x2663('0x65')]['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x40c5f2,null))[_0x2663('0x2a')](function(_0x250a5d){if(_0x250a5d){_0x2298f6['body'][_0x2663('0x70')]=_0x250a5d['id'];return db[_0x2663('0x71')]['create'](_0x2298f6['body']);}})[_0x2663('0x2a')](respondWithResult(_0x40c5f2,null))[_0x2663('0x35')](handleError(_0x40c5f2,null));};exports[_0x2663('0x72')]=function(_0x1ec76e,_0x260de4,_0x12db3f){var _0x42fe85={'raw':![],'where':{}};var _0x2d9a49={};var _0x39eaca={'count':0x0,'rows':[]};return db[_0x2663('0x4c')][_0x2663('0x73')]({'where':{'id':_0x1ec76e[_0x2663('0x65')]['id']}})['then'](handleEntityNotFound(_0x260de4,null))[_0x2663('0x2a')](function(_0xa2638a){if(_0xa2638a){_0x2d9a49[_0x2663('0x56')]=_[_0x2663('0x52')](db[_0x2663('0x71')][_0x2663('0x4d')]);_0x2d9a49['query']=_[_0x2663('0x52')](_0x1ec76e['query']);_0x2d9a49[_0x2663('0x53')]=_['intersection'](_0x2d9a49[_0x2663('0x56')],_0x2d9a49[_0x2663('0x51')]);_0x42fe85[_0x2663('0x55')]=_[_0x2663('0x54')](_0x2d9a49[_0x2663('0x56')],qs[_0x2663('0x57')](_0x1ec76e[_0x2663('0x51')][_0x2663('0x57')]));_0x42fe85[_0x2663('0x55')]=_0x42fe85[_0x2663('0x55')]['length']?_0x42fe85[_0x2663('0x55')]:_0x2d9a49['model'];if(!_0x1ec76e['query'][_0x2663('0x58')](_0x2663('0x59'))){_0x42fe85[_0x2663('0x3b')]=qs[_0x2663('0x3b')](_0x1ec76e['query'][_0x2663('0x3b')]);_0x42fe85[_0x2663('0x3a')]=qs[_0x2663('0x3a')](_0x1ec76e[_0x2663('0x51')][_0x2663('0x3a')]);}_0x42fe85[_0x2663('0x5a')]=qs['sort'](_0x1ec76e['query'][_0x2663('0x5b')]);_0x42fe85['where']=qs[_0x2663('0x53')](_[_0x2663('0x5d')](_0x1ec76e['query'],_0x2d9a49[_0x2663('0x53')]));_0x42fe85[_0x2663('0x5c')]['OpenchannelAccountId']=_0xa2638a['id'];if(_0x1ec76e['query'][_0x2663('0x5e')]){_0x42fe85[_0x2663('0x5c')]=_[_0x2663('0x5f')](_0x42fe85[_0x2663('0x5c')],{'$or':_[_0x2663('0x50')](_0x42fe85['attributes'],function(_0x5ca2d0){var _0xcf8a83={};_0xcf8a83[_0x5ca2d0]={'$like':'%'+_0x1ec76e[_0x2663('0x51')][_0x2663('0x5e')]+'%'};return _0xcf8a83;})});}_0x42fe85=_[_0x2663('0x5f')]({},_0x42fe85,_0x1ec76e[_0x2663('0x61')]);return db['Disposition'][_0x2663('0x39')]({'where':_0x42fe85[_0x2663('0x5c')]})['then'](function(_0x26154e){_0x39eaca[_0x2663('0x39')]=_0x26154e;if(_0x1ec76e[_0x2663('0x51')][_0x2663('0x62')]){_0x42fe85['include']=[{'all':!![]}];}return db[_0x2663('0x71')][_0x2663('0x63')](_0x42fe85);})[_0x2663('0x2a')](function(_0x33c102){_0x39eaca[_0x2663('0x74')]=_0x33c102;return _0x39eaca;});}})[_0x2663('0x2a')](respondWithFilteredResult(_0x260de4,_0x42fe85))[_0x2663('0x35')](handleError(_0x260de4,null));};exports[_0x2663('0x75')]=function(_0x24540c,_0x41df54,_0x44b7bb){return db[_0x2663('0x4c')][_0x2663('0x67')]({'where':{'id':_0x24540c['params']['id']}})['then'](handleEntityNotFound(_0x41df54,null))[_0x2663('0x2a')](function(_0x60f17d){if(_0x60f17d){return _0x60f17d['removeDispositions'](_0x24540c[_0x2663('0x51')][_0x2663('0x76')]);}})[_0x2663('0x2a')](respondWithStatusCode(_0x41df54,null))[_0x2663('0x35')](handleError(_0x41df54,null));};exports[_0x2663('0x77')]=function(_0xb3394b,_0xc272c4,_0x1b189e){if(_0xb3394b[_0x2663('0x69')]['id']){delete _0xb3394b[_0x2663('0x69')]['id'];}return db['OpenchannelAccount'][_0x2663('0x67')]({'where':{'id':_0xb3394b[_0x2663('0x65')]['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0xc272c4,null))[_0x2663('0x2a')](function(_0x10553a){if(_0x10553a){_0xb3394b[_0x2663('0x69')][_0x2663('0x78')]=_0x10553a['id'];return db['CannedAnswer'][_0x2663('0x68')](_0xb3394b[_0x2663('0x69')]);}})[_0x2663('0x2a')](respondWithResult(_0xc272c4,null))[_0x2663('0x35')](handleError(_0xc272c4,null));};exports['getAnswers']=function(_0x5aa5c3,_0x5f29e8,_0xcda10d){var _0x1ef9c={'raw':![],'where':{}};var _0x44f029={};var _0x318b16={'count':0x0,'rows':[]};return db[_0x2663('0x4c')]['findOne']({'where':{'id':_0x5aa5c3[_0x2663('0x65')]['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x5f29e8,null))[_0x2663('0x2a')](function(_0x5d287a){if(_0x5d287a){_0x44f029[_0x2663('0x56')]=_[_0x2663('0x52')](db[_0x2663('0x79')][_0x2663('0x4d')]);_0x44f029[_0x2663('0x51')]=_['keys'](_0x5aa5c3['query']);_0x44f029[_0x2663('0x53')]=_[_0x2663('0x54')](_0x44f029['model'],_0x44f029[_0x2663('0x51')]);_0x1ef9c[_0x2663('0x55')]=_['intersection'](_0x44f029['model'],qs[_0x2663('0x57')](_0x5aa5c3[_0x2663('0x51')]['fields']));_0x1ef9c[_0x2663('0x55')]=_0x1ef9c[_0x2663('0x55')][_0x2663('0x7a')]?_0x1ef9c[_0x2663('0x55')]:_0x44f029[_0x2663('0x56')];if(!_0x5aa5c3[_0x2663('0x51')]['hasOwnProperty'](_0x2663('0x59'))){_0x1ef9c[_0x2663('0x3b')]=qs['limit'](_0x5aa5c3[_0x2663('0x51')][_0x2663('0x3b')]);_0x1ef9c[_0x2663('0x3a')]=qs[_0x2663('0x3a')](_0x5aa5c3[_0x2663('0x51')][_0x2663('0x3a')]);}_0x1ef9c['order']=qs['sort'](_0x5aa5c3[_0x2663('0x51')]['sort']);_0x1ef9c['where']=qs[_0x2663('0x53')](_[_0x2663('0x5d')](_0x5aa5c3[_0x2663('0x51')],_0x44f029['filters']));_0x1ef9c['where'][_0x2663('0x78')]=_0x5d287a['id'];if(_0x5aa5c3['query'][_0x2663('0x5e')]){_0x1ef9c[_0x2663('0x5c')]=_['merge'](_0x1ef9c['where'],{'$or':_['map'](_0x1ef9c[_0x2663('0x55')],function(_0xabdb84){var _0x52fc3c={};_0x52fc3c[_0xabdb84]={'$like':'%'+_0x5aa5c3[_0x2663('0x51')][_0x2663('0x5e')]+'%'};return _0x52fc3c;})});}_0x1ef9c=_[_0x2663('0x5f')]({},_0x1ef9c,_0x5aa5c3[_0x2663('0x61')]);return db[_0x2663('0x79')][_0x2663('0x39')]({'where':_0x1ef9c[_0x2663('0x5c')]})[_0x2663('0x2a')](function(_0x68d7a8){_0x318b16[_0x2663('0x39')]=_0x68d7a8;if(_0x5aa5c3[_0x2663('0x51')][_0x2663('0x62')]){_0x1ef9c[_0x2663('0x66')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1ef9c);})[_0x2663('0x2a')](function(_0x1030f2){_0x318b16[_0x2663('0x74')]=_0x1030f2;return _0x318b16;});}})['then'](respondWithFilteredResult(_0x5f29e8,_0x1ef9c))[_0x2663('0x35')](handleError(_0x5f29e8,null));};exports[_0x2663('0x7b')]=function(_0x14f535,_0x37db43,_0x658f52){return db['OpenchannelAccount'][_0x2663('0x67')]({'where':{'id':_0x14f535['params']['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x37db43,null))[_0x2663('0x2a')](function(_0x4e75d5){if(_0x4e75d5){return _0x4e75d5[_0x2663('0x7b')](_0x14f535[_0x2663('0x51')][_0x2663('0x76')]);}})[_0x2663('0x2a')](respondWithStatusCode(_0x37db43,null))[_0x2663('0x35')](handleError(_0x37db43,null));};exports[_0x2663('0x7c')]=function(_0x16f6b6,_0x499f7b,_0x7fc2c9){var _0x402871={'body':_0x16f6b6[_0x2663('0x69')],'channel':'openchannel'};var _0x4cc0bc=[];var _0x2fd095=[];var _0x5a1a91={};var _0x51b36b=![];return db[_0x2663('0x7d')][_0x2663('0x6e')]()[_0x2663('0x2a')](function(_0x239a17){if(!_0x239a17){throw new db[(_0x2663('0x26'))][(_0x2663('0x27'))]('no\x20available\x20attributes');}_0x4cc0bc=_[_0x2663('0x7e')](_[_0x2663('0x52')](_0x239a17),[_0x2663('0x7f'),_0x2663('0x80')]);_0x2fd095=_[_0x2663('0x7e')](_['keys'](_0x239a17),[_0x2663('0x7f'),_0x2663('0x80'),_0x2663('0x81'),_0x2663('0x82')]);if(_0x16f6b6[_0x2663('0x69')]['id']){delete _0x16f6b6[_0x2663('0x69')]['id'];}if(_[_0x2663('0x83')](_0x16f6b6['body']['from'])){throw new db[(_0x2663('0x26'))][(_0x2663('0x27'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x16f6b6[_0x2663('0x69')][_0x2663('0x69')])||_0x16f6b6['body'][_0x2663('0x69')]===''){throw new db[(_0x2663('0x26'))]['ValidationError'](_0x2663('0x84'));}if(_['isNil'](_0x16f6b6[_0x2663('0x69')]['mapKey'])){throw new db[(_0x2663('0x26'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2fd095);}if(!_['includes'](_0x2fd095,_0x16f6b6[_0x2663('0x69')][_0x2663('0x85')])){throw new db[(_0x2663('0x26'))][(_0x2663('0x27'))](_0x2663('0x86')+_0x2fd095);}_0x5a1a91[_0x16f6b6[_0x2663('0x69')][_0x2663('0x85')]]=_0x16f6b6[_0x2663('0x69')][_0x2663('0x87')];})[_0x2663('0x2a')](function(){return db['OpenchannelAccount'][_0x2663('0x67')]({'where':{'id':_0x16f6b6[_0x2663('0x65')]['id']},'include':[{'model':db[_0x2663('0x88')],'as':_0x2663('0x89'),'include':[{'model':db['CmContact'],'as':_0x2663('0x8a'),'where':_0x5a1a91,'limit':0x1,'order':[[_0x2663('0x80'),'DESC']]}]},{'model':db[_0x2663('0x8b')],'as':_0x2663('0x8c')}]});})[_0x2663('0x2a')](handleEntityNotFound(_0x499f7b,null))[_0x2663('0x2a')](function(_0x5e8d21){if(_0x5e8d21&&_0x5e8d21[_0x2663('0x89')]){_0x402871[_0x2663('0x8d')]=_0x5e8d21;_0x402871['applications']=_0x5e8d21[_0x2663('0x8c')];_0x402871[_0x2663('0x8e')]=_0x5e8d21[_0x2663('0x89')];_0x402871[_0x2663('0x8f')]=_[_0x2663('0x90')](_0x402871[_0x2663('0x8f')],[_0x2663('0x91')],[_0x2663('0x92')]);if(_0x402871[_0x2663('0x8d')]['Applications']){delete _0x402871[_0x2663('0x8d')]['Applications'];}if(_0x402871[_0x2663('0x8d')][_0x2663('0x89')]&&_0x402871['account'][_0x2663('0x89')][_0x2663('0x8a')][_0x2663('0x7a')]){return _0x402871[_0x2663('0x8d')]['List'][_0x2663('0x8a')][0x0];}var _0x4805e4=_[_0x2663('0x1d')](_0x16f6b6[_0x2663('0x69')],{'firstName':_0x16f6b6[_0x2663('0x69')][_0x2663('0x87')],'ListId':_0x5e8d21['ListId']});_0x4805e4[_0x16f6b6[_0x2663('0x69')][_0x2663('0x85')]]=_0x16f6b6[_0x2663('0x69')][_0x2663('0x87')];return db['CmContact'][_0x2663('0x68')](_0x4805e4,{'fields':_0x4cc0bc,'raw':!![]});}})[_0x2663('0x2a')](handleEntityNotFound(_0x499f7b,null))[_0x2663('0x2a')](function(_0x33022d){_0x402871[_0x2663('0x93')]=_0x33022d;if(_0x33022d){var _0x5b5a93={'ContactId':_0x33022d['id'],'OpenchannelAccountId':_0x16f6b6[_0x2663('0x65')]['id'],'from':(_0x33022d[_0x2663('0x94')]||'')+'\x20'+(_0x33022d[_0x2663('0x95')]||'')};var _0x569439={'OpenchannelAccountId':_0x16f6b6[_0x2663('0x65')]['id'],'closed':![]};if(_0x16f6b6['body']['threadId']){_0x569439[_0x2663('0x96')]=_0x16f6b6[_0x2663('0x69')][_0x2663('0x96')];return db['OpenchannelInteraction'][_0x2663('0x67')]({'where':_0x569439})[_0x2663('0x2a')](function(_0x3bdba0){if(_0x3bdba0){return[_0x3bdba0,![]];}_0x5b5a93['threadId']=_0x16f6b6['body'][_0x2663('0x96')];_0x5b5a93[_0x2663('0x97')]=_0x16f6b6['body'][_0x2663('0x97')];return db[_0x2663('0x98')][_0x2663('0x68')](_0x5b5a93)['then'](function(_0x39ef30){return[_0x39ef30,!![]];});});}else{_0x569439[_0x2663('0x96')]=null;}_0x569439['ContactId']=_0x33022d['id'];return db[_0x2663('0x98')][_0x2663('0x67')]({'where':_0x569439})[_0x2663('0x2a')](function(_0xc9c340){if(_0xc9c340){return[_0xc9c340,![]];}return db[_0x2663('0x98')]['create'](_0x5b5a93)[_0x2663('0x2a')](function(_0x288c95){return[_0x288c95,!![]];});});}})[_0x2663('0x99')](function(_0x4af2df,_0x2bd9b9){if(_0x4af2df){_0x51b36b=_0x2bd9b9;if(!_0x2bd9b9){var _0x3844ee={'from':(_0x402871[_0x2663('0x93')]['firstName']||'')+'\x20'+(_0x402871[_0x2663('0x93')][_0x2663('0x95')]||'')};if(_0x16f6b6[_0x2663('0x69')]['threadId']&&_0x16f6b6[_0x2663('0x69')]['messageId']&&_0x16f6b6[_0x2663('0x69')]['threadId']!=_0x16f6b6[_0x2663('0x69')]['messageId']){_0x3844ee[_0x2663('0x96')]=_0x16f6b6[_0x2663('0x69')]['messageId'];}return _0x4af2df[_0x2663('0x40')](_0x3844ee);}else{return _0x4af2df;}}})[_0x2663('0x2a')](function(_0x19feb5){_0x402871[_0x2663('0x9a')]=_0x19feb5[_0x2663('0x42')]({'plain':!![]});_0x402871[_0x2663('0x9a')][_0x2663('0x9b')]=_0x51b36b;if(_0x402871[_0x2663('0x9a')][_0x2663('0x9b')]){if(_0x402871[_0x2663('0x8d')][_0x2663('0x9c')]){_0x402871[_0x2663('0x8f')]['push']({'id':0x0,'priority':_0x402871['applications'][_0x2663('0x7a')]+0x1,'app':_0x2663('0x9d'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x2663('0x9e')][_0x2663('0x68')]({'body':_0x16f6b6[_0x2663('0x69')][_0x2663('0x69')],'OpenchannelAccountId':_0x16f6b6[_0x2663('0x65')]['id'],'OpenchannelInteractionId':_0x19feb5['id'],'direction':'in','ContactId':_0x402871[_0x2663('0x93')]['id'],'AttachmentId':_0x16f6b6[_0x2663('0x69')][_0x2663('0x9f')]});})[_0x2663('0x2a')](function(_0x39b54d){_0x402871[_0x2663('0x33')]=_0x39b54d;if(_0x402871[_0x2663('0x9a')]['UserId']){return db['User']['find']({'attributes':['id',_0x2663('0x47')],'where':{'id':_0x402871[_0x2663('0x9a')][_0x2663('0xa0')]}})[_0x2663('0x2a')](function(_0x4bb144){if(_0x4bb144){_0x402871[_0x2663('0x8f')][_0x2663('0xa1')]({'id':0x0,'priority':0x0,'app':_0x2663('0xa2'),'appdata':_0x4bb144[_0x2663('0x47')]+','+(_0x402871[_0x2663('0x8d')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x402871[_0x2663('0xa3')]=![];}return respondWithRpcPromise('Start',_0x2663('0xa4'),_0x402871);});}return respondWithRpcPromise(_0x2663('0xa5'),_0x2663('0xa4'),_0x402871);})[_0x2663('0x2a')](function(_0x52c0e8){respondWithRpcPromise(_0x2663('0xa6'),_0x2663('0xa6'),{'event':_0x2663('0x7c'),'message':_0x52c0e8},client9002);return _0x52c0e8;})['then'](respondWithResult(_0x499f7b,null))[_0x2663('0x35')](handleError(_0x499f7b,null));};exports['addApplications']=function(_0x49355f,_0x9142fc,_0x221c7c){return db[_0x2663('0x4c')][_0x2663('0x73')]({'where':{'id':_0x49355f['params']['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x9142fc,null))[_0x2663('0x2a')](function(_0x2ed05a){if(_0x2ed05a){return db[_0x2663('0xa7')]['transaction'](function(_0x2b2ba1){return db[_0x2663('0x8b')][_0x2663('0x41')]({'where':{'OpenchannelAccountId':_0x49355f[_0x2663('0x65')]['id']},'transaction':_0x2b2ba1})[_0x2663('0x2a')](function(_0x3e0c52){var _0x1e32f2=_[_0x2663('0x50')](_0x49355f[_0x2663('0x69')],function(_0x5de84b){_0x5de84b[_0x2663('0x78')]=_0x49355f[_0x2663('0x65')]['id'];return _0x5de84b;});return db[_0x2663('0x8b')][_0x2663('0xa8')](_0x1e32f2,{'transaction':_0x2b2ba1});});})[_0x2663('0x2a')](function(){return db[_0x2663('0x8b')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x49355f[_0x2663('0x65')]['id']},'order':'priority'});});}})[_0x2663('0x2a')](respondWithResult(_0x9142fc,null))[_0x2663('0x35')](handleError(_0x9142fc,null));};exports['getApplications']=function(_0x1b2407,_0x19d599,_0x1be086){var _0x5e3cdd={};var _0x1228b7={};var _0x1ca7ff;var _0x410903;return db['OpenchannelAccount'][_0x2663('0x73')]({'where':{'id':_0x1b2407[_0x2663('0x65')]['id']}})['then'](handleEntityNotFound(_0x19d599,null))[_0x2663('0x2a')](function(_0x31ae93){if(_0x31ae93){_0x1ca7ff=_0x31ae93;_0x1228b7[_0x2663('0x56')]=_['keys'](db[_0x2663('0x8b')][_0x2663('0x4d')]);_0x1228b7['query']=_[_0x2663('0x52')](_0x1b2407[_0x2663('0x51')]);_0x1228b7[_0x2663('0x53')]=_['intersection'](_0x1228b7[_0x2663('0x56')],_0x1228b7['query']);_0x5e3cdd[_0x2663('0x55')]=_[_0x2663('0x54')](_0x1228b7[_0x2663('0x56')],qs['fields'](_0x1b2407[_0x2663('0x51')][_0x2663('0x57')]));_0x5e3cdd[_0x2663('0x55')]=_0x5e3cdd[_0x2663('0x55')][_0x2663('0x7a')]?_0x5e3cdd['attributes']:_0x1228b7[_0x2663('0x56')];_0x5e3cdd[_0x2663('0x5a')]=qs['sort'](_0x1b2407[_0x2663('0x51')][_0x2663('0x5b')]);_0x5e3cdd[_0x2663('0x5c')]=qs[_0x2663('0x53')](_[_0x2663('0x5d')](_0x1b2407['query'],_0x1228b7[_0x2663('0x53')]));if(_0x1b2407[_0x2663('0x51')][_0x2663('0x5e')]){_0x5e3cdd[_0x2663('0x5c')]=_[_0x2663('0x5f')](_0x5e3cdd[_0x2663('0x5c')],{'$or':_[_0x2663('0x50')](_0x5e3cdd[_0x2663('0x55')],function(_0x1cffc8){var _0x547293={};_0x547293[_0x1cffc8]={'$like':'%'+_0x1b2407[_0x2663('0x51')][_0x2663('0x5e')]+'%'};return _0x547293;})});}_0x5e3cdd=_['merge']({},_0x5e3cdd,_0x1b2407[_0x2663('0x61')]);return _0x1ca7ff[_0x2663('0xa9')](_0x5e3cdd);}})['then'](function(_0x5df283){if(_0x5df283){_0x410903=_0x5df283['length'];if(!_0x1b2407[_0x2663('0x51')][_0x2663('0x58')](_0x2663('0x59'))){_0x5e3cdd[_0x2663('0x3b')]=qs['limit'](_0x1b2407['query'][_0x2663('0x3b')]);_0x5e3cdd[_0x2663('0x3a')]=qs['offset'](_0x1b2407[_0x2663('0x51')][_0x2663('0x3a')]);}return _0x1ca7ff[_0x2663('0xa9')](_0x5e3cdd);}})['then'](function(_0xee4c45){if(_0xee4c45){return _0xee4c45?{'count':_0x410903,'rows':_0xee4c45}:null;}})['then'](respondWithResult(_0x19d599,null))[_0x2663('0x35')](handleError(_0x19d599,null));};exports['getInteractions']=function(_0x1070b8,_0x572a68,_0x265a8e){var _0x14967c={'raw':![],'where':{}};var _0x4ba7c5={};var _0x48e1d8={'count':0x0,'rows':[]};return db[_0x2663('0x4c')]['findOne']({'where':{'id':_0x1070b8['params']['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x572a68,null))['then'](function(_0x9126eb){if(_0x9126eb){_0x4ba7c5['model']=_['keys'](db['OpenchannelInteraction'][_0x2663('0x4d')]);_0x4ba7c5[_0x2663('0x51')]=_[_0x2663('0x52')](_0x1070b8[_0x2663('0x51')]);_0x4ba7c5[_0x2663('0x53')]=_[_0x2663('0x54')](_0x4ba7c5[_0x2663('0x56')],_0x4ba7c5[_0x2663('0x51')]);_0x14967c['attributes']=_[_0x2663('0x54')](_0x4ba7c5['model'],qs[_0x2663('0x57')](_0x1070b8['query']['fields']));_0x14967c[_0x2663('0x55')]=_0x14967c[_0x2663('0x55')][_0x2663('0x7a')]?_0x14967c['attributes']:_0x4ba7c5[_0x2663('0x56')];if(!_0x1070b8[_0x2663('0x51')][_0x2663('0x58')]('nolimit')){_0x14967c[_0x2663('0x3b')]=qs[_0x2663('0x3b')](_0x1070b8[_0x2663('0x51')][_0x2663('0x3b')]);_0x14967c[_0x2663('0x3a')]=qs[_0x2663('0x3a')](_0x1070b8[_0x2663('0x51')][_0x2663('0x3a')]);}_0x14967c[_0x2663('0x5a')]=qs[_0x2663('0x5b')](_0x1070b8[_0x2663('0x51')][_0x2663('0x5b')]);_0x14967c[_0x2663('0x5c')]=qs[_0x2663('0x53')](_[_0x2663('0x5d')](_0x1070b8[_0x2663('0x51')],_0x4ba7c5['filters']));_0x14967c['where'][_0x2663('0x78')]=_0x9126eb['id'];if(_0x1070b8[_0x2663('0x51')]['filter']){_0x14967c[_0x2663('0x5c')]=_[_0x2663('0x5f')](_0x14967c[_0x2663('0x5c')],{'$or':_[_0x2663('0x50')](_0x14967c[_0x2663('0x55')],function(_0x350204){var _0x245f88={};_0x245f88[_0x350204]={'$like':'%'+_0x1070b8[_0x2663('0x51')]['filter']+'%'};return _0x245f88;})});}_0x14967c=_[_0x2663('0x5f')]({},_0x14967c,_0x1070b8[_0x2663('0x61')]);return db['OpenchannelInteraction']['count']({'where':_0x14967c[_0x2663('0x5c')]})[_0x2663('0x2a')](function(_0x139e38){_0x48e1d8['count']=_0x139e38;if(_0x1070b8[_0x2663('0x51')][_0x2663('0x62')]){_0x14967c['include']=[{'model':db[_0x2663('0x7d')],'as':_0x2663('0xaa'),'required':![]},{'model':db[_0x2663('0xab')],'as':'Owner','attributes':[_0x2663('0x47'),_0x2663('0xac'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x2663('0xad'),'attributes':['id',_0x2663('0x47'),_0x2663('0xae')],'where':_0x1070b8[_0x2663('0x51')]['tag']?{'id':_0x1070b8[_0x2663('0x51')][_0x2663('0xaf')]}:undefined,'required':_0x1070b8[_0x2663('0x51')]['tag']?!![]:![]}];}return db[_0x2663('0x98')][_0x2663('0x63')](_0x14967c);})[_0x2663('0x2a')](function(_0x23b5e9){_0x48e1d8['rows']=_0x23b5e9;return _0x48e1d8;});}})['then'](respondWithFilteredResult(_0x572a68,_0x14967c))[_0x2663('0x35')](handleError(_0x572a68,null));};exports['addAgents']=function(_0xddb951,_0x2448e2,_0x13670d){return db[_0x2663('0x4c')][_0x2663('0x67')]({'where':{'id':_0xddb951[_0x2663('0x65')]['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x2448e2,null))[_0x2663('0x2a')](function(_0x31c131){if(_0x31c131){return _0x31c131[_0x2663('0xb0')](_0xddb951[_0x2663('0x69')][_0x2663('0x76')],_[_0x2663('0xb1')](_0xddb951[_0x2663('0x69')],['ids','id'])||{})[_0x2663('0x99')](function(_0x36afbf){for(var _0xb858f0=0x0;_0xb858f0<_0xddb951['body']['ids'][_0x2663('0x7a')];_0xb858f0+=0x1){socket['emit'](_0x2663('0xb2'),{'UserId':_0xddb951[_0x2663('0x69')][_0x2663('0x76')][_0xb858f0],'OpenchannelAccountId':_0xddb951['params']['id']});}return _0x36afbf;});}})[_0x2663('0x2a')](respondWithResult(_0x2448e2,null))[_0x2663('0x35')](handleError(_0x2448e2,null));};exports[_0x2663('0xb3')]=function(_0x3f9d48,_0x5684a5,_0x1940f6){return db[_0x2663('0x4c')][_0x2663('0x67')]({'where':{'id':_0x3f9d48['params']['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x5684a5,null))[_0x2663('0x2a')](function(_0x44b3b4){if(_0x44b3b4){return _0x44b3b4['removeAgents'](_0x3f9d48[_0x2663('0x51')][_0x2663('0x76')])[_0x2663('0x2a')](function(){if(_[_0x2663('0xb4')](_0x3f9d48[_0x2663('0x51')][_0x2663('0x76')])){for(var _0x3673c8=0x0;_0x3673c8<_0x3f9d48[_0x2663('0x51')][_0x2663('0x76')][_0x2663('0x7a')];_0x3673c8+=0x1){socket[_0x2663('0xb5')](_0x2663('0xb6'),{'UserId':Number(_0x3f9d48['query'][_0x2663('0x76')][_0x3673c8]),'OpenchannelAccountId':Number(_0x3f9d48[_0x2663('0x65')]['id'])});}}else{socket[_0x2663('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3f9d48[_0x2663('0x51')][_0x2663('0x76')]),'OpenchannelAccountId':Number(_0x3f9d48[_0x2663('0x65')]['id'])});}});}})[_0x2663('0x2a')](respondWithStatusCode(_0x5684a5,null))[_0x2663('0x35')](handleError(_0x5684a5,null));};exports['getAgents']=function(_0x119a70,_0x55ea3b,_0x266144){var _0x48b793={};var _0x461822={};var _0x2ffb6b;var _0x494e39;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x119a70['params']['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x55ea3b,null))[_0x2663('0x2a')](function(_0x1364c3){if(_0x1364c3){_0x2ffb6b=_0x1364c3;_0x461822[_0x2663('0x56')]=_['keys'](db[_0x2663('0xab')][_0x2663('0x4d')]);_0x461822[_0x2663('0x51')]=_[_0x2663('0x52')](_0x119a70[_0x2663('0x51')]);_0x461822[_0x2663('0x53')]=_[_0x2663('0x54')](_0x461822[_0x2663('0x56')],_0x461822[_0x2663('0x51')]);_0x48b793['attributes']=_[_0x2663('0x54')](_0x461822[_0x2663('0x56')],qs[_0x2663('0x57')](_0x119a70[_0x2663('0x51')]['fields']));_0x48b793[_0x2663('0x55')]=_0x48b793[_0x2663('0x55')][_0x2663('0x7a')]?_0x48b793[_0x2663('0x55')]:_0x461822[_0x2663('0x56')];_0x48b793[_0x2663('0x5a')]=qs[_0x2663('0x5b')](_0x119a70[_0x2663('0x51')][_0x2663('0x5b')]);_0x48b793[_0x2663('0x5c')]=qs[_0x2663('0x53')](_[_0x2663('0x5d')](_0x119a70[_0x2663('0x51')],_0x461822[_0x2663('0x53')]));if(_0x119a70[_0x2663('0x51')][_0x2663('0x5e')]){_0x48b793['where']=_[_0x2663('0x5f')](_0x48b793[_0x2663('0x5c')],{'$or':_[_0x2663('0x50')](_0x48b793[_0x2663('0x55')],function(_0xce94c9){var _0x230b1a={};_0x230b1a[_0xce94c9]={'$like':'%'+_0x119a70['query'][_0x2663('0x5e')]+'%'};return _0x230b1a;})});}_0x48b793=_[_0x2663('0x5f')]({},_0x48b793,_0x119a70[_0x2663('0x61')]);return _0x2ffb6b[_0x2663('0xb7')](_0x48b793);}})[_0x2663('0x2a')](function(_0x279d5a){if(_0x279d5a){_0x494e39=_0x279d5a[_0x2663('0x7a')];if(!_0x119a70[_0x2663('0x51')][_0x2663('0x58')]('nolimit')){_0x48b793[_0x2663('0x3b')]=qs[_0x2663('0x3b')](_0x119a70[_0x2663('0x51')][_0x2663('0x3b')]);_0x48b793['offset']=qs['offset'](_0x119a70[_0x2663('0x51')][_0x2663('0x3a')]);}return _0x2ffb6b[_0x2663('0xb7')](_0x48b793);}})['then'](function(_0x469e4f){if(_0x469e4f){return _0x469e4f?{'count':_0x494e39,'rows':_0x469e4f}:null;}})[_0x2663('0x2a')](respondWithResult(_0x55ea3b,null))[_0x2663('0x35')](handleError(_0x55ea3b,null));};exports['send']=function(_0x393aba,_0x289e46,_0x442f34){var _0x5b5cca,_0x260b8b,_0x370f74;if(_[_0x2663('0x83')](_0x393aba['body'][_0x2663('0x69')])||_0x393aba['body']['body']===''){throw new db[(_0x2663('0x26'))][(_0x2663('0x27'))](_0x2663('0x84'));}if(_[_0x2663('0x83')](_0x393aba['body']['to'])){}_0x5b5cca=_0x393aba[_0x2663('0x69')]['to'];return db[_0x2663('0x4c')][_0x2663('0x73')]({'where':{'id':_0x393aba['params']['id']}})[_0x2663('0x2a')](handleEntityNotFound(_0x289e46,null))[_0x2663('0x2a')](function(_0x4e6a6c){if(_0x4e6a6c){return db[_0x2663('0x4c')][_0x2663('0x67')]({'where':{'id':_0x4e6a6c['id']},'include':[{'model':db[_0x2663('0x88')],'as':_0x2663('0x89'),'include':[{'model':db[_0x2663('0x7d')],'as':_0x2663('0x8a'),'where':{[_0x4e6a6c[_0x2663('0x85')]]:_0x5b5cca},'limit':0x1,'order':[[_0x2663('0x80'),_0x2663('0xb8')]]}]}]})[_0x2663('0x2a')](handleEntityNotFound(_0x289e46,null))[_0x2663('0x2a')](function(_0x29fc55){if(_0x29fc55&&_0x29fc55[_0x2663('0x89')]){_0x260b8b=_0x29fc55[_0x2663('0x42')]({'plain':!![]});if(_0x260b8b[_0x2663('0x89')]&&_0x260b8b[_0x2663('0x89')][_0x2663('0x8a')][_0x2663('0x7a')]){return _0x260b8b['List'][_0x2663('0x8a')][0x0];}return db[_0x2663('0x7d')][_0x2663('0x68')](_[_0x2663('0x1d')](_0x393aba[_0x2663('0x69')],{'firstName':_0x5b5cca,[_0x29fc55['mapKey']]:_0x5b5cca,'phone':_0x5b5cca,'ListId':_0x260b8b['ListId']}));}})['then'](handleEntityNotFound(_0x289e46,null))[_0x2663('0x2a')](function(_0x11c8dc){if(_0x11c8dc){_0x370f74=_0x11c8dc;return db[_0x2663('0x98')][_0x2663('0x67')]({'where':{'ContactId':_0x370f74['id'],'closed':![],'OpenchannelAccountId':_0x260b8b['id']}})['then'](function(_0x2c2a44){if(_0x2c2a44){return[_0x2c2a44,![]];}return db[_0x2663('0x98')][_0x2663('0x68')]({'UserId':_0x393aba[_0x2663('0x6a')]['id'],'ContactId':_0x370f74['id'],'OpenchannelAccountId':_0x260b8b['id'],'lastMsgDirection':_0x2663('0xb9'),'Messages':[_[_0x2663('0x5f')](_0x393aba[_0x2663('0x69')],{'read':![],'body':_0x393aba['body']['body'],'OpenchannelAccountId':_0x260b8b['id'],'UserId':_0x393aba[_0x2663('0x6a')]['id'],'ContactId':_0x370f74['id']})]},{'include':[{'model':db[_0x2663('0x9e')],'as':_0x2663('0xba')}]})['then'](function(_0x48f6e3){return[_0x48f6e3,!![]];});});}})[_0x2663('0x99')](function(_0x2e8a97,_0x50c801){if(_0x50c801){return _0x2e8a97;}return db[_0x2663('0x9e')][_0x2663('0x68')](_[_0x2663('0x5f')](_0x393aba[_0x2663('0x69')],{'read':![],'body':_0x393aba[_0x2663('0x69')]['body'],'OpenchannelAccountId':_0x260b8b['id'],'OpenchannelInteractionId':_0x2e8a97['id'],'UserId':_0x393aba[_0x2663('0x6a')]['id'],'ContactId':_0x370f74['id']}))['then'](function(_0x36b856){_0x2e8a97['dataValues']['Messages']=[];_0x2e8a97[_0x2663('0xbb')][_0x2663('0xba')][_0x2663('0xbc')](_0x36b856[_0x2663('0xbb')]);return _0x2e8a97;});});}})[_0x2663('0x2a')](respondWithResult(_0x289e46,null))['catch'](handleError(_0x289e46,null));}; \ No newline at end of file +var _0x8693=['end','count','offset','limit','Content-Range','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','OpenchannelAccount','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','merge','find','create','body','user','role','OpenchannelAccounts','userProfileId','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','Contacts','DESC','OpenchannelApplication','List','account','applications','Applications','list','asc','from','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','bulkCreate','priority','getApplications','getInteractions','Contact','fullname','Tag','Tags','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','dataValues','Messages','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8693,0x1ef));var _0x3869=function(_0x1800e3,_0x4f8ce5){_0x1800e3=_0x1800e3-0x0;var _0x391445=_0x8693[_0x1800e3];return _0x391445;};'use strict';var pdf=require(_0x3869('0x0'));var emlformat=require(_0x3869('0x1'));var rimraf=require(_0x3869('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3869('0x3'));var rp=require(_0x3869('0x4'));var moment=require(_0x3869('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3869('0x6'));var util=require('util');var path=require(_0x3869('0x7'));var sox=require(_0x3869('0x8'));var csv=require(_0x3869('0x9'));var ejs=require(_0x3869('0xa'));var fs=require('fs');var _=require(_0x3869('0xb'));var squel=require('squel');var crypto=require(_0x3869('0xc'));var jsforce=require(_0x3869('0xd'));var deskjs=require(_0x3869('0xe'));var toCsv=require(_0x3869('0x9'));var querystring=require(_0x3869('0xf'));var Papa=require('papaparse');var Redis=require(_0x3869('0x10'));var authService=require(_0x3869('0x11'));var qs=require(_0x3869('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3869('0x13'));var config=require(_0x3869('0x14'));var db=require(_0x3869('0x15'))['db'];config[_0x3869('0x16')]=_[_0x3869('0x17')](config[_0x3869('0x16')],{'host':_0x3869('0x18'),'port':0x18eb});var socket=require(_0x3869('0x19'))(new Redis(config['redis']));require(_0x3869('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3869('0x1b')][_0x3869('0x1c')]({'port':0x232c});var client9002=jayson[_0x3869('0x1b')][_0x3869('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x585d37,_0x459f7d,_0xb9892b){if(_0xb9892b){var _0x21f540=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21f540[_0x3869('0x1d')](_0x459f7d)){return _0x585d37;}else{throw new db['Sequelize'][(_0x3869('0x1e'))](_0x3869('0x1f'));}}else{return _0x585d37;}}function respondWithRpcPromise(_0x385f26,_0x3dd896,_0x30d05f,_0x415424){return new BPromise(function(_0x16e403,_0x8421d8){var _0x252b86=_0x415424||client;return _0x252b86[_0x3869('0x20')](_0x385f26,_0x30d05f)['then'](function(_0x4eb7c7){logger['info'](_0x3869('0x21'),_0x3dd896,_0x3869('0x22'));logger[_0x3869('0x23')](_0x3869('0x24'),_0x3dd896,_0x3869('0x22'),JSON[_0x3869('0x25')](_0x4eb7c7));if(_0x4eb7c7['error']){if(_0x4eb7c7[_0x3869('0x26')]['code']===0x1f4){logger[_0x3869('0x26')](_0x3869('0x21'),_0x3dd896,_0x4eb7c7[_0x3869('0x26')]['message']);return _0x8421d8(_0x4eb7c7[_0x3869('0x26')]['message']);}logger[_0x3869('0x26')](_0x3869('0x21'),_0x3dd896,_0x4eb7c7[_0x3869('0x26')]['message']);return _0x16e403(_0x4eb7c7[_0x3869('0x26')][_0x3869('0x27')]);}else{logger[_0x3869('0x28')](_0x3869('0x21'),_0x3dd896,_0x3869('0x22'));_0x16e403(_0x4eb7c7[_0x3869('0x29')][_0x3869('0x27')]);}})[_0x3869('0x2a')](function(_0x1f819d){logger[_0x3869('0x26')](_0x3869('0x21'),_0x3dd896,_0x1f819d);_0x8421d8(_0x1f819d);});});}function respondWithStatusCode(_0x3d6993,_0x4ed60e){_0x4ed60e=_0x4ed60e||0xcc;return function(_0x43ac89){if(_0x43ac89){return _0x3d6993[_0x3869('0x2b')](_0x4ed60e);}return _0x3d6993[_0x3869('0x2c')](_0x4ed60e)[_0x3869('0x2d')]();};}function respondWithResult(_0x2032f7,_0x1922f9){_0x1922f9=_0x1922f9||0xc8;return function(_0x69a07e){if(_0x69a07e){return _0x2032f7[_0x3869('0x2c')](_0x1922f9)['json'](_0x69a07e);}};}function respondWithFilteredResult(_0x1ba52f,_0x3828c3){return function(_0x1e0157){if(_0x1e0157){var _0x31f4ec=_0x1e0157[_0x3869('0x2e')],_0x9ab20a=_0x3828c3['offset'],_0x6bdbe9=_0x3828c3[_0x3869('0x2f')]+_0x3828c3[_0x3869('0x30')],_0x389947;if(_0x6bdbe9>=_0x31f4ec){_0x6bdbe9=_0x31f4ec;_0x389947=0xc8;}else{_0x389947=0xce;}_0x1ba52f[_0x3869('0x2c')](_0x389947);return _0x1ba52f['set'](_0x3869('0x31'),_0x9ab20a+'-'+_0x6bdbe9+'/'+_0x31f4ec)['json'](_0x1e0157);}return null;};}function patchUpdates(_0x4fd11b){return function(_0x45196f){try{jsonpatch['apply'](_0x45196f,_0x4fd11b,!![]);}catch(_0x454e17){return BPromise['reject'](_0x454e17);}return _0x45196f[_0x3869('0x32')]();};}function saveUpdates(_0x1f0e20,_0x4bcc0f){return function(_0x1cd664){if(_0x1cd664){return _0x1cd664[_0x3869('0x33')](_0x1f0e20)[_0x3869('0x34')](function(_0x22fae3){return _0x22fae3;});}return null;};}function removeEntity(_0x2c722d,_0x2e13bc){return function(_0x5e6014){if(_0x5e6014){return _0x5e6014['destroy']()[_0x3869('0x34')](function(){var _0x4a5aa7=_0x5e6014[_0x3869('0x35')]({'plain':!![]});var _0x5800ef='OpenchannelAccounts';return db[_0x3869('0x36')][_0x3869('0x37')]({'where':{'type':_0x5800ef,'resourceId':_0x4a5aa7['id']}})[_0x3869('0x34')](function(){return _0x5e6014;});})[_0x3869('0x34')](function(){_0x2c722d[_0x3869('0x2c')](0xcc)[_0x3869('0x2d')]();});}};}function handleEntityNotFound(_0x426f9a,_0x62f554){return function(_0x8a8726){if(!_0x8a8726){_0x426f9a[_0x3869('0x2b')](0x194);}return _0x8a8726;};}function handleError(_0x35f6f5,_0x2f1056){_0x2f1056=_0x2f1056||0x1f4;return function(_0x3229ae){logger['error'](_0x3229ae[_0x3869('0x38')]);if(_0x3229ae['name']){delete _0x3229ae[_0x3869('0x39')];}_0x35f6f5[_0x3869('0x2c')](_0x2f1056)[_0x3869('0x3a')](_0x3229ae);};}exports[_0x3869('0x3b')]=function(_0x1e3e2a,_0x2112b2){var _0x48da4c={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4ed94={},_0x3db00b={'count':0x0,'rows':[]};var _0x4f31ff=_['map'](db[_0x3869('0x3c')][_0x3869('0x3d')],function(_0x5d3690){return{'name':_0x5d3690[_0x3869('0x3e')],'type':_0x5d3690['type']['key']};});_0x4ed94[_0x3869('0x3f')]=_[_0x3869('0x40')](_0x4f31ff,'name');_0x4ed94[_0x3869('0x41')]=_[_0x3869('0x42')](_0x1e3e2a[_0x3869('0x41')]);_0x4ed94[_0x3869('0x43')]=_[_0x3869('0x44')](_0x4ed94['model'],_0x4ed94[_0x3869('0x41')]);_0x48da4c[_0x3869('0x45')]=_['intersection'](_0x4ed94['model'],qs['fields'](_0x1e3e2a['query'][_0x3869('0x46')]));_0x48da4c[_0x3869('0x45')]=_0x48da4c[_0x3869('0x45')][_0x3869('0x47')]?_0x48da4c[_0x3869('0x45')]:_0x4ed94[_0x3869('0x3f')];if(!_0x1e3e2a[_0x3869('0x41')][_0x3869('0x48')](_0x3869('0x49'))){_0x48da4c[_0x3869('0x30')]=qs[_0x3869('0x30')](_0x1e3e2a['query'][_0x3869('0x30')]);_0x48da4c[_0x3869('0x2f')]=qs['offset'](_0x1e3e2a[_0x3869('0x41')][_0x3869('0x2f')]);}_0x48da4c[_0x3869('0x4a')]=qs[_0x3869('0x4b')](_0x1e3e2a[_0x3869('0x41')][_0x3869('0x4b')]);_0x48da4c['where']=qs[_0x3869('0x43')](_['pick'](_0x1e3e2a[_0x3869('0x41')],_0x4ed94[_0x3869('0x43')]),_0x4f31ff);if(_0x1e3e2a[_0x3869('0x41')][_0x3869('0x4c')]){_0x48da4c[_0x3869('0x4d')]=_['merge'](_0x48da4c[_0x3869('0x4d')],{'$or':_[_0x3869('0x40')](_0x4f31ff,function(_0x282cb5){if(_0x282cb5[_0x3869('0x4e')]!==_0x3869('0x4f')){var _0x17f969={};_0x17f969[_0x282cb5[_0x3869('0x39')]]={'$like':'%'+_0x1e3e2a[_0x3869('0x41')][_0x3869('0x4c')]+'%'};return _0x17f969;}})});}_0x48da4c=_['merge']({},_0x48da4c,_0x1e3e2a[_0x3869('0x50')]);var _0x2777a6={'where':_0x48da4c[_0x3869('0x4d')]};return db[_0x3869('0x3c')]['count'](_0x2777a6)[_0x3869('0x34')](function(_0xbf89bd){_0x3db00b['count']=_0xbf89bd;if(_0x1e3e2a[_0x3869('0x41')][_0x3869('0x51')]){_0x48da4c[_0x3869('0x52')]=[{'all':!![]}];}return db[_0x3869('0x3c')][_0x3869('0x53')](_0x48da4c);})[_0x3869('0x34')](function(_0x50fd46){_0x3db00b[_0x3869('0x54')]=_0x50fd46;return _0x3db00b;})[_0x3869('0x34')](respondWithFilteredResult(_0x2112b2,_0x48da4c))[_0x3869('0x2a')](handleError(_0x2112b2,null));};exports[_0x3869('0x55')]=function(_0xfc69aa,_0x12eef4){var _0x39926f={'raw':![],'where':{'id':_0xfc69aa[_0x3869('0x56')]['id']},'include':[{'model':db[_0x3869('0x57')],'as':_0x3869('0x58')}]},_0xcc185e={};_0xcc185e[_0x3869('0x3f')]=_[_0x3869('0x42')](db[_0x3869('0x3c')][_0x3869('0x3d')]);_0xcc185e['query']=_['keys'](_0xfc69aa[_0x3869('0x41')]);_0xcc185e['filters']=_[_0x3869('0x44')](_0xcc185e['model'],_0xcc185e[_0x3869('0x41')]);_0x39926f[_0x3869('0x45')]=_['intersection'](_0xcc185e['model'],qs[_0x3869('0x46')](_0xfc69aa[_0x3869('0x41')]['fields']));_0x39926f[_0x3869('0x45')]=_0x39926f['attributes'][_0x3869('0x47')]?_0x39926f[_0x3869('0x45')]:_0xcc185e[_0x3869('0x3f')];if(_0xfc69aa[_0x3869('0x41')][_0x3869('0x51')]){_0x39926f[_0x3869('0x52')]=[{'all':!![]}];}_0x39926f=_[_0x3869('0x59')]({},_0x39926f,_0xfc69aa[_0x3869('0x50')]);return db[_0x3869('0x3c')][_0x3869('0x5a')](_0x39926f)[_0x3869('0x34')](handleEntityNotFound(_0x12eef4,null))[_0x3869('0x34')](respondWithResult(_0x12eef4,null))[_0x3869('0x2a')](handleError(_0x12eef4,null));};exports[_0x3869('0x5b')]=function(_0x28f840,_0x464d86){return db[_0x3869('0x3c')][_0x3869('0x5b')](_0x28f840[_0x3869('0x5c')],{})[_0x3869('0x34')](function(_0x33c980){var _0x2c92ce=_0x28f840[_0x3869('0x5d')]['get']({'plain':!![]});if(!_0x2c92ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c92ce[_0x3869('0x5e')]===_0x3869('0x5d')){var _0x4dd7e2=_0x33c980[_0x3869('0x35')]({'plain':!![]});var _0x12229f=_0x3869('0x5f');return db['UserProfileSection']['find']({'where':{'name':_0x12229f,'userProfileId':_0x2c92ce[_0x3869('0x60')]},'raw':!![]})[_0x3869('0x34')](function(_0x350c7e){if(_0x350c7e&&_0x350c7e['autoAssociation']===0x0){return db[_0x3869('0x36')][_0x3869('0x5b')]({'name':_0x4dd7e2[_0x3869('0x39')],'resourceId':_0x4dd7e2['id'],'type':_0x350c7e[_0x3869('0x39')],'sectionId':_0x350c7e['id']},{})[_0x3869('0x34')](function(){return _0x33c980;});}else{return _0x33c980;}})[_0x3869('0x2a')](function(_0x1427b7){logger[_0x3869('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1427b7);throw _0x1427b7;});}return _0x33c980;})[_0x3869('0x34')](respondWithResult(_0x464d86,0xc9))[_0x3869('0x2a')](handleError(_0x464d86,null));};exports['update']=function(_0x2193b5,_0x46b1e1){if(_0x2193b5[_0x3869('0x5c')]['id']){delete _0x2193b5[_0x3869('0x5c')]['id'];}return db['OpenchannelAccount'][_0x3869('0x5a')]({'where':{'id':_0x2193b5['params']['id']},'include':[{'model':db[_0x3869('0x57')],'as':'mandatoryDispositionPause'}]})[_0x3869('0x34')](handleEntityNotFound(_0x46b1e1,null))[_0x3869('0x34')](saveUpdates(_0x2193b5[_0x3869('0x5c')],null))[_0x3869('0x34')](respondWithResult(_0x46b1e1,null))[_0x3869('0x2a')](handleError(_0x46b1e1,null));};exports['destroy']=function(_0x2180bb,_0x38a123){return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x2180bb['params']['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x38a123,null))['then'](removeEntity(_0x38a123,null))[_0x3869('0x2a')](handleError(_0x38a123,null));};exports[_0x3869('0x61')]=function(_0x229820,_0x434c31){return db['OpenchannelAccount'][_0x3869('0x61')]()[_0x3869('0x34')](respondWithResult(_0x434c31,null))[_0x3869('0x2a')](handleError(_0x434c31,null));};exports[_0x3869('0x62')]=function(_0x2fad3a,_0x22f110,_0x40d032){if(_0x2fad3a[_0x3869('0x5c')]['id']){delete _0x2fad3a['body']['id'];}return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x2fad3a[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x22f110,null))[_0x3869('0x34')](function(_0x132685){if(_0x132685){_0x2fad3a[_0x3869('0x5c')][_0x3869('0x63')]=_0x132685['id'];return db[_0x3869('0x64')][_0x3869('0x5b')](_0x2fad3a[_0x3869('0x5c')]);}})[_0x3869('0x34')](respondWithResult(_0x22f110,null))['catch'](handleError(_0x22f110,null));};exports[_0x3869('0x65')]=function(_0x5bc318,_0x498ab8,_0x421023){var _0x4c8987={'raw':![],'where':{}};var _0x2f5a7c={};var _0x3d3563={'count':0x0,'rows':[]};return db[_0x3869('0x3c')][_0x3869('0x66')]({'where':{'id':_0x5bc318[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x498ab8,null))[_0x3869('0x34')](function(_0x3ff8af){if(_0x3ff8af){_0x2f5a7c[_0x3869('0x3f')]=_[_0x3869('0x42')](db['Disposition']['rawAttributes']);_0x2f5a7c[_0x3869('0x41')]=_['keys'](_0x5bc318[_0x3869('0x41')]);_0x2f5a7c[_0x3869('0x43')]=_[_0x3869('0x44')](_0x2f5a7c[_0x3869('0x3f')],_0x2f5a7c[_0x3869('0x41')]);_0x4c8987[_0x3869('0x45')]=_[_0x3869('0x44')](_0x2f5a7c['model'],qs[_0x3869('0x46')](_0x5bc318[_0x3869('0x41')]['fields']));_0x4c8987[_0x3869('0x45')]=_0x4c8987[_0x3869('0x45')][_0x3869('0x47')]?_0x4c8987['attributes']:_0x2f5a7c[_0x3869('0x3f')];if(!_0x5bc318[_0x3869('0x41')][_0x3869('0x48')](_0x3869('0x49'))){_0x4c8987['limit']=qs[_0x3869('0x30')](_0x5bc318['query'][_0x3869('0x30')]);_0x4c8987[_0x3869('0x2f')]=qs['offset'](_0x5bc318[_0x3869('0x41')][_0x3869('0x2f')]);}_0x4c8987[_0x3869('0x4a')]=qs[_0x3869('0x4b')](_0x5bc318[_0x3869('0x41')]['sort']);_0x4c8987[_0x3869('0x4d')]=qs['filters'](_[_0x3869('0x67')](_0x5bc318[_0x3869('0x41')],_0x2f5a7c[_0x3869('0x43')]));_0x4c8987[_0x3869('0x4d')][_0x3869('0x68')]=_0x3ff8af['id'];if(_0x5bc318[_0x3869('0x41')][_0x3869('0x4c')]){_0x4c8987['where']=_[_0x3869('0x59')](_0x4c8987[_0x3869('0x4d')],{'$or':_['map'](_0x4c8987[_0x3869('0x45')],function(_0x5b542e){var _0xde93c3={};_0xde93c3[_0x5b542e]={'$like':'%'+_0x5bc318['query'][_0x3869('0x4c')]+'%'};return _0xde93c3;})});}_0x4c8987=_[_0x3869('0x59')]({},_0x4c8987,_0x5bc318[_0x3869('0x50')]);return db[_0x3869('0x64')][_0x3869('0x2e')]({'where':_0x4c8987[_0x3869('0x4d')]})[_0x3869('0x34')](function(_0x1b3e1c){_0x3d3563[_0x3869('0x2e')]=_0x1b3e1c;if(_0x5bc318[_0x3869('0x41')][_0x3869('0x51')]){_0x4c8987['include']=[{'all':!![]}];}return db[_0x3869('0x64')][_0x3869('0x53')](_0x4c8987);})['then'](function(_0x154439){_0x3d3563[_0x3869('0x54')]=_0x154439;return _0x3d3563;});}})[_0x3869('0x34')](respondWithFilteredResult(_0x498ab8,_0x4c8987))[_0x3869('0x2a')](handleError(_0x498ab8,null));};exports[_0x3869('0x69')]=function(_0x15fe4d,_0x58c1c4,_0x221f7a){return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x15fe4d['params']['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x58c1c4,null))[_0x3869('0x34')](function(_0x5ccbfe){if(_0x5ccbfe){return _0x5ccbfe[_0x3869('0x69')](_0x15fe4d[_0x3869('0x41')][_0x3869('0x6a')]);}})[_0x3869('0x34')](respondWithStatusCode(_0x58c1c4,null))[_0x3869('0x2a')](handleError(_0x58c1c4,null));};exports[_0x3869('0x6b')]=function(_0x115e7a,_0x5dc799,_0x7bbacc){if(_0x115e7a[_0x3869('0x5c')]['id']){delete _0x115e7a['body']['id'];}return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x115e7a[_0x3869('0x56')]['id']}})['then'](handleEntityNotFound(_0x5dc799,null))[_0x3869('0x34')](function(_0x1f8891){if(_0x1f8891){_0x115e7a[_0x3869('0x5c')][_0x3869('0x68')]=_0x1f8891['id'];return db[_0x3869('0x6c')][_0x3869('0x5b')](_0x115e7a[_0x3869('0x5c')]);}})['then'](respondWithResult(_0x5dc799,null))[_0x3869('0x2a')](handleError(_0x5dc799,null));};exports['getAnswers']=function(_0x54b77c,_0xb46896,_0x550cda){var _0x9bd96f={'raw':![],'where':{}};var _0x104731={};var _0x19bb9f={'count':0x0,'rows':[]};return db[_0x3869('0x3c')][_0x3869('0x66')]({'where':{'id':_0x54b77c[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0xb46896,null))[_0x3869('0x34')](function(_0x44e8d2){if(_0x44e8d2){_0x104731[_0x3869('0x3f')]=_[_0x3869('0x42')](db[_0x3869('0x6c')]['rawAttributes']);_0x104731[_0x3869('0x41')]=_[_0x3869('0x42')](_0x54b77c[_0x3869('0x41')]);_0x104731[_0x3869('0x43')]=_[_0x3869('0x44')](_0x104731['model'],_0x104731[_0x3869('0x41')]);_0x9bd96f[_0x3869('0x45')]=_[_0x3869('0x44')](_0x104731[_0x3869('0x3f')],qs[_0x3869('0x46')](_0x54b77c['query'][_0x3869('0x46')]));_0x9bd96f[_0x3869('0x45')]=_0x9bd96f[_0x3869('0x45')]['length']?_0x9bd96f['attributes']:_0x104731['model'];if(!_0x54b77c[_0x3869('0x41')][_0x3869('0x48')]('nolimit')){_0x9bd96f[_0x3869('0x30')]=qs[_0x3869('0x30')](_0x54b77c[_0x3869('0x41')][_0x3869('0x30')]);_0x9bd96f[_0x3869('0x2f')]=qs['offset'](_0x54b77c[_0x3869('0x41')][_0x3869('0x2f')]);}_0x9bd96f[_0x3869('0x4a')]=qs[_0x3869('0x4b')](_0x54b77c[_0x3869('0x41')][_0x3869('0x4b')]);_0x9bd96f[_0x3869('0x4d')]=qs['filters'](_[_0x3869('0x67')](_0x54b77c[_0x3869('0x41')],_0x104731['filters']));_0x9bd96f['where']['OpenchannelAccountId']=_0x44e8d2['id'];if(_0x54b77c['query'][_0x3869('0x4c')]){_0x9bd96f[_0x3869('0x4d')]=_[_0x3869('0x59')](_0x9bd96f['where'],{'$or':_[_0x3869('0x40')](_0x9bd96f[_0x3869('0x45')],function(_0x5e1f48){var _0x3ce4a1={};_0x3ce4a1[_0x5e1f48]={'$like':'%'+_0x54b77c['query'][_0x3869('0x4c')]+'%'};return _0x3ce4a1;})});}_0x9bd96f=_['merge']({},_0x9bd96f,_0x54b77c[_0x3869('0x50')]);return db['CannedAnswer'][_0x3869('0x2e')]({'where':_0x9bd96f[_0x3869('0x4d')]})[_0x3869('0x34')](function(_0x2a27f4){_0x19bb9f[_0x3869('0x2e')]=_0x2a27f4;if(_0x54b77c[_0x3869('0x41')][_0x3869('0x51')]){_0x9bd96f[_0x3869('0x52')]=[{'all':!![]}];}return db[_0x3869('0x6c')]['findAll'](_0x9bd96f);})[_0x3869('0x34')](function(_0x403187){_0x19bb9f[_0x3869('0x54')]=_0x403187;return _0x19bb9f;});}})['then'](respondWithFilteredResult(_0xb46896,_0x9bd96f))[_0x3869('0x2a')](handleError(_0xb46896,null));};exports[_0x3869('0x6d')]=function(_0x53ad7d,_0x55c804,_0x5d201b){return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x53ad7d[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x55c804,null))['then'](function(_0x4c9fba){if(_0x4c9fba){return _0x4c9fba[_0x3869('0x6d')](_0x53ad7d[_0x3869('0x41')][_0x3869('0x6a')]);}})[_0x3869('0x34')](respondWithStatusCode(_0x55c804,null))[_0x3869('0x2a')](handleError(_0x55c804,null));};exports[_0x3869('0x6e')]=function(_0x22077c,_0x203696,_0x143550){var _0x478496={'body':_0x22077c[_0x3869('0x5c')],'channel':_0x3869('0x6f')};var _0x22aa6d=[];var _0x4e349c=[];var _0x43cd33={};var _0x3088ff=![];return db[_0x3869('0x70')][_0x3869('0x61')]()[_0x3869('0x34')](function(_0x3bb189){if(!_0x3bb189){throw new db['Sequelize'][(_0x3869('0x1e'))](_0x3869('0x71'));}_0x22aa6d=_[_0x3869('0x72')](_[_0x3869('0x42')](_0x3bb189),[_0x3869('0x73'),'updatedAt']);_0x4e349c=_['difference'](_[_0x3869('0x42')](_0x3bb189),[_0x3869('0x73'),_0x3869('0x74'),_0x3869('0x75'),_0x3869('0x76')]);if(_0x22077c['body']['id']){delete _0x22077c[_0x3869('0x5c')]['id'];}if(_[_0x3869('0x77')](_0x22077c[_0x3869('0x5c')]['from'])){throw new db['Sequelize'][(_0x3869('0x1e'))](_0x3869('0x78'));}if(_[_0x3869('0x77')](_0x22077c['body'][_0x3869('0x5c')])||_0x22077c['body'][_0x3869('0x5c')]===''){throw new db[(_0x3869('0x79'))][(_0x3869('0x1e'))](_0x3869('0x7a'));}if(_['isNil'](_0x22077c[_0x3869('0x5c')]['mapKey'])){throw new db[(_0x3869('0x79'))][(_0x3869('0x1e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e349c);}if(!_[_0x3869('0x7b')](_0x4e349c,_0x22077c[_0x3869('0x5c')][_0x3869('0x7c')])){throw new db[(_0x3869('0x79'))][(_0x3869('0x1e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e349c);}_0x43cd33[_0x22077c['body']['mapKey']]=_0x22077c[_0x3869('0x5c')]['from'];})['then'](function(){return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x22077c[_0x3869('0x56')]['id']},'include':[{'model':db[_0x3869('0x7d')],'as':'List','include':[{'model':db[_0x3869('0x70')],'as':_0x3869('0x7e'),'where':_0x43cd33,'limit':0x1,'order':[['updatedAt',_0x3869('0x7f')]]}]},{'model':db[_0x3869('0x80')],'as':'Applications'}]});})[_0x3869('0x34')](handleEntityNotFound(_0x203696,null))[_0x3869('0x34')](function(_0x316974){if(_0x316974&&_0x316974[_0x3869('0x81')]){_0x478496[_0x3869('0x82')]=_0x316974;_0x478496[_0x3869('0x83')]=_0x316974[_0x3869('0x84')];_0x478496[_0x3869('0x85')]=_0x316974[_0x3869('0x81')];_0x478496[_0x3869('0x83')]=_['orderBy'](_0x478496[_0x3869('0x83')],['priority'],[_0x3869('0x86')]);if(_0x478496[_0x3869('0x82')][_0x3869('0x84')]){delete _0x478496[_0x3869('0x82')][_0x3869('0x84')];}if(_0x478496[_0x3869('0x82')][_0x3869('0x81')]&&_0x478496['account'][_0x3869('0x81')][_0x3869('0x7e')][_0x3869('0x47')]){return _0x478496[_0x3869('0x82')][_0x3869('0x81')][_0x3869('0x7e')][0x0];}var _0x590c93=_[_0x3869('0x17')](_0x22077c['body'],{'firstName':_0x22077c[_0x3869('0x5c')][_0x3869('0x87')],'ListId':_0x316974[_0x3869('0x76')]});_0x590c93[_0x22077c[_0x3869('0x5c')][_0x3869('0x7c')]]=_0x22077c['body'][_0x3869('0x87')];return db[_0x3869('0x70')]['create'](_0x590c93,{'fields':_0x22aa6d,'raw':!![]});}})['then'](handleEntityNotFound(_0x203696,null))[_0x3869('0x34')](function(_0xa5d8f7){_0x478496[_0x3869('0x88')]=_0xa5d8f7;if(_0xa5d8f7){var _0x21d79a={'ContactId':_0xa5d8f7['id'],'OpenchannelAccountId':_0x22077c[_0x3869('0x56')]['id'],'from':(_0xa5d8f7[_0x3869('0x89')]||'')+'\x20'+(_0xa5d8f7['lastName']||'')};var _0x300647={'OpenchannelAccountId':_0x22077c[_0x3869('0x56')]['id'],'closed':![]};if(_0x22077c[_0x3869('0x5c')]['threadId']){_0x300647[_0x3869('0x8a')]=_0x22077c[_0x3869('0x5c')][_0x3869('0x8a')];return db[_0x3869('0x8b')]['find']({'where':_0x300647})[_0x3869('0x34')](function(_0x1698b6){if(_0x1698b6){return[_0x1698b6,![]];}_0x21d79a[_0x3869('0x8a')]=_0x22077c[_0x3869('0x5c')][_0x3869('0x8a')];_0x21d79a['externalUrl']=_0x22077c[_0x3869('0x5c')][_0x3869('0x8c')];return db[_0x3869('0x8b')][_0x3869('0x5b')](_0x21d79a)[_0x3869('0x34')](function(_0x1b40dc){return[_0x1b40dc,!![]];});});}else{_0x300647[_0x3869('0x8a')]=null;}_0x300647[_0x3869('0x8d')]=_0xa5d8f7['id'];return db[_0x3869('0x8b')][_0x3869('0x5a')]({'where':_0x300647})[_0x3869('0x34')](function(_0x4cca69){if(_0x4cca69){return[_0x4cca69,![]];}return db[_0x3869('0x8b')][_0x3869('0x5b')](_0x21d79a)[_0x3869('0x34')](function(_0x1f7589){return[_0x1f7589,!![]];});});}})[_0x3869('0x8e')](function(_0x4dcc56,_0x21bf77){if(_0x4dcc56){_0x3088ff=_0x21bf77;if(!_0x21bf77){var _0x4c708b={'from':(_0x478496['contact'][_0x3869('0x89')]||'')+'\x20'+(_0x478496[_0x3869('0x88')][_0x3869('0x8f')]||'')};if(_0x22077c[_0x3869('0x5c')]['threadId']&&_0x22077c[_0x3869('0x5c')]['messageId']&&_0x22077c['body'][_0x3869('0x8a')]!=_0x22077c[_0x3869('0x5c')][_0x3869('0x90')]){_0x4c708b[_0x3869('0x8a')]=_0x22077c['body'][_0x3869('0x90')];}return _0x4dcc56[_0x3869('0x33')](_0x4c708b);}else{return _0x4dcc56;}}})['then'](function(_0x4c3ddc){_0x478496[_0x3869('0x91')]=_0x4c3ddc[_0x3869('0x35')]({'plain':!![]});_0x478496['interaction'][_0x3869('0x92')]=_0x3088ff;if(_0x478496[_0x3869('0x91')][_0x3869('0x92')]){if(_0x478496[_0x3869('0x82')][_0x3869('0x93')]){_0x478496[_0x3869('0x83')][_0x3869('0x94')]({'id':0x0,'priority':_0x478496[_0x3869('0x83')][_0x3869('0x47')]+0x1,'app':'close','appdata':_0x3869('0x95'),'interval':_0x3869('0x96')});}}return db[_0x3869('0x97')][_0x3869('0x5b')]({'body':_0x22077c['body']['body'],'OpenchannelAccountId':_0x22077c[_0x3869('0x56')]['id'],'OpenchannelInteractionId':_0x4c3ddc['id'],'direction':'in','ContactId':_0x478496[_0x3869('0x88')]['id'],'AttachmentId':_0x22077c[_0x3869('0x5c')]['AttachmentId']});})['then'](function(_0x40b426){_0x478496[_0x3869('0x27')]=_0x40b426;if(_0x478496[_0x3869('0x91')][_0x3869('0x98')]){return db[_0x3869('0x99')]['find']({'attributes':['id',_0x3869('0x39')],'where':{'id':_0x478496[_0x3869('0x91')][_0x3869('0x98')]}})[_0x3869('0x34')](function(_0x1c2971){if(_0x1c2971){_0x478496[_0x3869('0x83')][_0x3869('0x9a')]({'id':0x0,'priority':0x0,'app':_0x3869('0x9b'),'appdata':_0x1c2971[_0x3869('0x39')]+','+(_0x478496[_0x3869('0x82')][_0x3869('0x9c')]||0xa),'interval':'*,*,*,*'});_0x478496[_0x3869('0x9d')]=![];}return respondWithRpcPromise(_0x3869('0x9e'),_0x3869('0x9f'),_0x478496);});}return respondWithRpcPromise('Start','startRouting',_0x478496);})[_0x3869('0x34')](function(_0x24fecc){respondWithRpcPromise(_0x3869('0xa0'),_0x3869('0xa0'),{'event':_0x3869('0x6e'),'message':_0x24fecc},client9002);return _0x24fecc;})[_0x3869('0x34')](respondWithResult(_0x203696,null))[_0x3869('0x2a')](handleError(_0x203696,null));};exports['addApplications']=function(_0x241af2,_0x57d790,_0x34d323){return db['OpenchannelAccount'][_0x3869('0x66')]({'where':{'id':_0x241af2[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x57d790,null))['then'](function(_0x37ff30){if(_0x37ff30){return db[_0x3869('0xa1')]['transaction'](function(_0x1d50bb){return db['OpenchannelApplication'][_0x3869('0x37')]({'where':{'OpenchannelAccountId':_0x241af2[_0x3869('0x56')]['id']},'transaction':_0x1d50bb})['then'](function(_0x25f649){var _0x12fe43=_[_0x3869('0x40')](_0x241af2[_0x3869('0x5c')],function(_0x231252){_0x231252[_0x3869('0x68')]=_0x241af2[_0x3869('0x56')]['id'];return _0x231252;});return db[_0x3869('0x80')][_0x3869('0xa2')](_0x12fe43,{'transaction':_0x1d50bb});});})[_0x3869('0x34')](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x241af2[_0x3869('0x56')]['id']},'order':_0x3869('0xa3')});});}})[_0x3869('0x34')](respondWithResult(_0x57d790,null))[_0x3869('0x2a')](handleError(_0x57d790,null));};exports['getApplications']=function(_0x42722a,_0x76d922,_0x29bd24){var _0x399219={};var _0x379ca1={};var _0x4ebed0;var _0x3d50ee;return db[_0x3869('0x3c')][_0x3869('0x66')]({'where':{'id':_0x42722a[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x76d922,null))[_0x3869('0x34')](function(_0x4eb61c){if(_0x4eb61c){_0x4ebed0=_0x4eb61c;_0x379ca1[_0x3869('0x3f')]=_[_0x3869('0x42')](db[_0x3869('0x80')][_0x3869('0x3d')]);_0x379ca1[_0x3869('0x41')]=_[_0x3869('0x42')](_0x42722a[_0x3869('0x41')]);_0x379ca1[_0x3869('0x43')]=_['intersection'](_0x379ca1[_0x3869('0x3f')],_0x379ca1[_0x3869('0x41')]);_0x399219[_0x3869('0x45')]=_[_0x3869('0x44')](_0x379ca1['model'],qs[_0x3869('0x46')](_0x42722a[_0x3869('0x41')][_0x3869('0x46')]));_0x399219[_0x3869('0x45')]=_0x399219[_0x3869('0x45')][_0x3869('0x47')]?_0x399219[_0x3869('0x45')]:_0x379ca1[_0x3869('0x3f')];_0x399219[_0x3869('0x4a')]=qs['sort'](_0x42722a[_0x3869('0x41')][_0x3869('0x4b')]);_0x399219[_0x3869('0x4d')]=qs[_0x3869('0x43')](_[_0x3869('0x67')](_0x42722a[_0x3869('0x41')],_0x379ca1[_0x3869('0x43')]));if(_0x42722a[_0x3869('0x41')]['filter']){_0x399219[_0x3869('0x4d')]=_[_0x3869('0x59')](_0x399219[_0x3869('0x4d')],{'$or':_['map'](_0x399219[_0x3869('0x45')],function(_0x78645a){var _0x29780f={};_0x29780f[_0x78645a]={'$like':'%'+_0x42722a[_0x3869('0x41')][_0x3869('0x4c')]+'%'};return _0x29780f;})});}_0x399219=_[_0x3869('0x59')]({},_0x399219,_0x42722a[_0x3869('0x50')]);return _0x4ebed0['getApplications'](_0x399219);}})['then'](function(_0x441f81){if(_0x441f81){_0x3d50ee=_0x441f81[_0x3869('0x47')];if(!_0x42722a[_0x3869('0x41')][_0x3869('0x48')](_0x3869('0x49'))){_0x399219[_0x3869('0x30')]=qs[_0x3869('0x30')](_0x42722a[_0x3869('0x41')]['limit']);_0x399219['offset']=qs[_0x3869('0x2f')](_0x42722a['query'][_0x3869('0x2f')]);}return _0x4ebed0[_0x3869('0xa4')](_0x399219);}})[_0x3869('0x34')](function(_0x1496ec){if(_0x1496ec){return _0x1496ec?{'count':_0x3d50ee,'rows':_0x1496ec}:null;}})[_0x3869('0x34')](respondWithResult(_0x76d922,null))[_0x3869('0x2a')](handleError(_0x76d922,null));};exports[_0x3869('0xa5')]=function(_0x2fa23d,_0x2009cb,_0x2a12c3){var _0x5df6c8={'raw':![],'where':{}};var _0x4c46c4={};var _0x538aff={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x3869('0x66')]({'where':{'id':_0x2fa23d[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x2009cb,null))[_0x3869('0x34')](function(_0x122b9e){if(_0x122b9e){_0x4c46c4[_0x3869('0x3f')]=_[_0x3869('0x42')](db[_0x3869('0x8b')][_0x3869('0x3d')]);_0x4c46c4[_0x3869('0x41')]=_['keys'](_0x2fa23d[_0x3869('0x41')]);_0x4c46c4['filters']=_[_0x3869('0x44')](_0x4c46c4[_0x3869('0x3f')],_0x4c46c4[_0x3869('0x41')]);_0x5df6c8['attributes']=_[_0x3869('0x44')](_0x4c46c4[_0x3869('0x3f')],qs[_0x3869('0x46')](_0x2fa23d[_0x3869('0x41')][_0x3869('0x46')]));_0x5df6c8[_0x3869('0x45')]=_0x5df6c8[_0x3869('0x45')]['length']?_0x5df6c8['attributes']:_0x4c46c4[_0x3869('0x3f')];if(!_0x2fa23d[_0x3869('0x41')][_0x3869('0x48')]('nolimit')){_0x5df6c8[_0x3869('0x30')]=qs[_0x3869('0x30')](_0x2fa23d[_0x3869('0x41')][_0x3869('0x30')]);_0x5df6c8[_0x3869('0x2f')]=qs[_0x3869('0x2f')](_0x2fa23d[_0x3869('0x41')][_0x3869('0x2f')]);}_0x5df6c8['order']=qs[_0x3869('0x4b')](_0x2fa23d['query'][_0x3869('0x4b')]);_0x5df6c8[_0x3869('0x4d')]=qs['filters'](_[_0x3869('0x67')](_0x2fa23d['query'],_0x4c46c4[_0x3869('0x43')]));_0x5df6c8[_0x3869('0x4d')][_0x3869('0x68')]=_0x122b9e['id'];if(_0x2fa23d[_0x3869('0x41')][_0x3869('0x4c')]){_0x5df6c8[_0x3869('0x4d')]=_[_0x3869('0x59')](_0x5df6c8[_0x3869('0x4d')],{'$or':_[_0x3869('0x40')](_0x5df6c8[_0x3869('0x45')],function(_0x47d91a){var _0x31fcef={};_0x31fcef[_0x47d91a]={'$like':'%'+_0x2fa23d[_0x3869('0x41')][_0x3869('0x4c')]+'%'};return _0x31fcef;})});}_0x5df6c8=_[_0x3869('0x59')]({},_0x5df6c8,_0x2fa23d['options']);return db[_0x3869('0x8b')]['count']({'where':_0x5df6c8[_0x3869('0x4d')]})[_0x3869('0x34')](function(_0x53b341){_0x538aff[_0x3869('0x2e')]=_0x53b341;if(_0x2fa23d[_0x3869('0x41')][_0x3869('0x51')]){_0x5df6c8[_0x3869('0x52')]=[{'model':db[_0x3869('0x70')],'as':_0x3869('0xa6'),'required':![]},{'model':db[_0x3869('0x99')],'as':'Owner','attributes':[_0x3869('0x39'),_0x3869('0xa7'),'internal'],'required':![]},{'model':db[_0x3869('0xa8')],'as':_0x3869('0xa9'),'attributes':['id',_0x3869('0x39'),'color'],'where':_0x2fa23d['query']['tag']?{'id':_0x2fa23d[_0x3869('0x41')]['tag']}:undefined,'required':_0x2fa23d[_0x3869('0x41')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x3869('0x53')](_0x5df6c8);})[_0x3869('0x34')](function(_0x262541){_0x538aff[_0x3869('0x54')]=_0x262541;return _0x538aff;});}})['then'](respondWithFilteredResult(_0x2009cb,_0x5df6c8))['catch'](handleError(_0x2009cb,null));};exports[_0x3869('0xaa')]=function(_0x317197,_0x2e23bd,_0x505892){return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x317197[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x2e23bd,null))[_0x3869('0x34')](function(_0x39964b){if(_0x39964b){return _0x39964b['addAgents'](_0x317197[_0x3869('0x5c')][_0x3869('0x6a')],_[_0x3869('0xab')](_0x317197[_0x3869('0x5c')],[_0x3869('0x6a'),'id'])||{})[_0x3869('0x8e')](function(_0x27cb00){for(var _0x44ad18=0x0;_0x44ad18<_0x317197[_0x3869('0x5c')][_0x3869('0x6a')][_0x3869('0x47')];_0x44ad18+=0x1){socket['emit'](_0x3869('0xac'),{'UserId':_0x317197[_0x3869('0x5c')]['ids'][_0x44ad18],'OpenchannelAccountId':_0x317197[_0x3869('0x56')]['id']});}return _0x27cb00;});}})[_0x3869('0x34')](respondWithResult(_0x2e23bd,null))[_0x3869('0x2a')](handleError(_0x2e23bd,null));};exports['removeAgents']=function(_0x1c9c7e,_0x611efd,_0x3f3f1b){return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x1c9c7e[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x611efd,null))[_0x3869('0x34')](function(_0x2ae73c){if(_0x2ae73c){return _0x2ae73c[_0x3869('0xad')](_0x1c9c7e['query'][_0x3869('0x6a')])[_0x3869('0x34')](function(){if(_[_0x3869('0xae')](_0x1c9c7e[_0x3869('0x41')][_0x3869('0x6a')])){for(var _0x2cc4d8=0x0;_0x2cc4d8<_0x1c9c7e[_0x3869('0x41')][_0x3869('0x6a')]['length'];_0x2cc4d8+=0x1){socket[_0x3869('0xaf')](_0x3869('0xb0'),{'UserId':Number(_0x1c9c7e[_0x3869('0x41')]['ids'][_0x2cc4d8]),'OpenchannelAccountId':Number(_0x1c9c7e['params']['id'])});}}else{socket['emit'](_0x3869('0xb0'),{'UserId':Number(_0x1c9c7e['query'][_0x3869('0x6a')]),'OpenchannelAccountId':Number(_0x1c9c7e[_0x3869('0x56')]['id'])});}});}})[_0x3869('0x34')](respondWithStatusCode(_0x611efd,null))[_0x3869('0x2a')](handleError(_0x611efd,null));};exports[_0x3869('0xb1')]=function(_0x5a16f3,_0x46f252,_0x433485){var _0x252bf2={};var _0x1fe246={};var _0x23bc24;var _0x597fa1;return db[_0x3869('0x3c')][_0x3869('0x66')]({'where':{'id':_0x5a16f3[_0x3869('0x56')]['id']}})[_0x3869('0x34')](handleEntityNotFound(_0x46f252,null))[_0x3869('0x34')](function(_0x487a84){if(_0x487a84){_0x23bc24=_0x487a84;_0x1fe246[_0x3869('0x3f')]=_['keys'](db['User']['rawAttributes']);_0x1fe246[_0x3869('0x41')]=_[_0x3869('0x42')](_0x5a16f3[_0x3869('0x41')]);_0x1fe246[_0x3869('0x43')]=_[_0x3869('0x44')](_0x1fe246[_0x3869('0x3f')],_0x1fe246[_0x3869('0x41')]);_0x252bf2['attributes']=_[_0x3869('0x44')](_0x1fe246['model'],qs[_0x3869('0x46')](_0x5a16f3['query'][_0x3869('0x46')]));_0x252bf2['attributes']=_0x252bf2[_0x3869('0x45')][_0x3869('0x47')]?_0x252bf2[_0x3869('0x45')]:_0x1fe246[_0x3869('0x3f')];_0x252bf2[_0x3869('0x4a')]=qs['sort'](_0x5a16f3['query']['sort']);_0x252bf2['where']=qs[_0x3869('0x43')](_[_0x3869('0x67')](_0x5a16f3[_0x3869('0x41')],_0x1fe246[_0x3869('0x43')]));if(_0x5a16f3[_0x3869('0x41')][_0x3869('0x4c')]){_0x252bf2[_0x3869('0x4d')]=_[_0x3869('0x59')](_0x252bf2['where'],{'$or':_[_0x3869('0x40')](_0x252bf2[_0x3869('0x45')],function(_0x4a85ec){var _0x50b77d={};_0x50b77d[_0x4a85ec]={'$like':'%'+_0x5a16f3[_0x3869('0x41')][_0x3869('0x4c')]+'%'};return _0x50b77d;})});}_0x252bf2=_[_0x3869('0x59')]({},_0x252bf2,_0x5a16f3['options']);return _0x23bc24[_0x3869('0xb1')](_0x252bf2);}})['then'](function(_0x46fb0b){if(_0x46fb0b){_0x597fa1=_0x46fb0b['length'];if(!_0x5a16f3[_0x3869('0x41')][_0x3869('0x48')](_0x3869('0x49'))){_0x252bf2['limit']=qs[_0x3869('0x30')](_0x5a16f3['query'][_0x3869('0x30')]);_0x252bf2[_0x3869('0x2f')]=qs[_0x3869('0x2f')](_0x5a16f3[_0x3869('0x41')][_0x3869('0x2f')]);}return _0x23bc24[_0x3869('0xb1')](_0x252bf2);}})[_0x3869('0x34')](function(_0x19ca7f){if(_0x19ca7f){return _0x19ca7f?{'count':_0x597fa1,'rows':_0x19ca7f}:null;}})['then'](respondWithResult(_0x46f252,null))[_0x3869('0x2a')](handleError(_0x46f252,null));};exports['send']=function(_0x476767,_0x4c97a3,_0x553e80){var _0x56afdd,_0x559fd0,_0x38b387;if(_[_0x3869('0x77')](_0x476767[_0x3869('0x5c')][_0x3869('0x5c')])||_0x476767[_0x3869('0x5c')]['body']===''){throw new db['Sequelize'][(_0x3869('0x1e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3869('0x77')](_0x476767[_0x3869('0x5c')]['to'])){}_0x56afdd=_0x476767[_0x3869('0x5c')]['to'];return db[_0x3869('0x3c')][_0x3869('0x66')]({'where':{'id':_0x476767[_0x3869('0x56')]['id']}})['then'](handleEntityNotFound(_0x4c97a3,null))[_0x3869('0x34')](function(_0x779dd6){if(_0x779dd6){return db[_0x3869('0x3c')][_0x3869('0x5a')]({'where':{'id':_0x779dd6['id']},'include':[{'model':db[_0x3869('0x7d')],'as':_0x3869('0x81'),'include':[{'model':db[_0x3869('0x70')],'as':_0x3869('0x7e'),'where':{[_0x779dd6[_0x3869('0x7c')]]:_0x56afdd},'limit':0x1,'order':[[_0x3869('0x74'),_0x3869('0x7f')]]}]}]})['then'](handleEntityNotFound(_0x4c97a3,null))[_0x3869('0x34')](function(_0x2baaad){if(_0x2baaad&&_0x2baaad['List']){_0x559fd0=_0x2baaad['get']({'plain':!![]});if(_0x559fd0[_0x3869('0x81')]&&_0x559fd0[_0x3869('0x81')][_0x3869('0x7e')][_0x3869('0x47')]){return _0x559fd0[_0x3869('0x81')][_0x3869('0x7e')][0x0];}return db[_0x3869('0x70')]['create'](_[_0x3869('0x17')](_0x476767[_0x3869('0x5c')],{'firstName':_0x56afdd,[_0x2baaad['mapKey']]:_0x56afdd,'phone':_0x56afdd,'ListId':_0x559fd0[_0x3869('0x76')]}));}})[_0x3869('0x34')](handleEntityNotFound(_0x4c97a3,null))[_0x3869('0x34')](function(_0x3db23b){if(_0x3db23b){_0x38b387=_0x3db23b;return db[_0x3869('0x8b')][_0x3869('0x5a')]({'where':{'ContactId':_0x38b387['id'],'closed':![],'OpenchannelAccountId':_0x559fd0['id']}})[_0x3869('0x34')](function(_0x45a716){if(_0x45a716){return[_0x45a716,![]];}return db[_0x3869('0x8b')][_0x3869('0x5b')]({'UserId':_0x476767[_0x3869('0x5d')]['id'],'ContactId':_0x38b387['id'],'OpenchannelAccountId':_0x559fd0['id'],'lastMsgDirection':'out','Messages':[_[_0x3869('0x59')](_0x476767['body'],{'read':![],'body':_0x476767[_0x3869('0x5c')]['body'],'OpenchannelAccountId':_0x559fd0['id'],'UserId':_0x476767[_0x3869('0x5d')]['id'],'ContactId':_0x38b387['id']})]},{'include':[{'model':db[_0x3869('0x97')],'as':'Messages'}]})[_0x3869('0x34')](function(_0x3add2f){return[_0x3add2f,!![]];});});}})[_0x3869('0x8e')](function(_0x2dc085,_0x38294d){if(_0x38294d){return _0x2dc085;}return db[_0x3869('0x97')][_0x3869('0x5b')](_['merge'](_0x476767[_0x3869('0x5c')],{'read':![],'body':_0x476767[_0x3869('0x5c')]['body'],'OpenchannelAccountId':_0x559fd0['id'],'OpenchannelInteractionId':_0x2dc085['id'],'UserId':_0x476767[_0x3869('0x5d')]['id'],'ContactId':_0x38b387['id']}))[_0x3869('0x34')](function(_0x9fe859){_0x2dc085[_0x3869('0xb2')][_0x3869('0xb3')]=[];_0x2dc085[_0x3869('0xb2')]['Messages']['push'](_0x9fe859[_0x3869('0xb2')]);return _0x2dc085;});});}})['then'](respondWithResult(_0x4c97a3,null))[_0x3869('0x2a')](handleError(_0x4c97a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index c658b8c..52b00f1 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 _0x45b7=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x44a3bc,_0x333805){var _0x4cc5fb=function(_0x3c331e){while(--_0x3c331e){_0x44a3bc['push'](_0x44a3bc['shift']());}};_0x4cc5fb(++_0x333805);}(_0x45b7,0xd6));var _0x745b=function(_0x315f1c,_0x3dbd71){_0x315f1c=_0x315f1c-0x0;var _0x7fd26a=_0x45b7[_0x315f1c];return _0x7fd26a;};'use strict';var EventEmitter=require(_0x745b('0x0'));var OpenchannelAccount=require(_0x745b('0x1'))['db'][_0x745b('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x745b('0x3')](0x0);var events={'afterCreate':_0x745b('0x4'),'afterUpdate':_0x745b('0x5'),'afterDestroy':_0x745b('0x6')};function emitEvent(_0x351b08){return function(_0x295dce,_0x58bd46,_0x491f44){OpenchannelAccountEvents['emit'](_0x351b08+':'+_0x295dce['id'],_0x295dce);OpenchannelAccountEvents[_0x745b('0x7')](_0x351b08,_0x295dce);_0x491f44(null);};}for(var e in events){if(events[_0x745b('0x8')](e)){var event=events[e];OpenchannelAccount[_0x745b('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xd7bd=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x382982,_0x22b6af){var _0xb4200e=function(_0x3d7879){while(--_0x3d7879){_0x382982['push'](_0x382982['shift']());}};_0xb4200e(++_0x22b6af);}(_0xd7bd,0xc7));var _0xdd7b=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0xd7bd[_0x1fc4e2];return _0x2ba184;};'use strict';var EventEmitter=require(_0xdd7b('0x0'));var OpenchannelAccount=require(_0xdd7b('0x1'))['db'][_0xdd7b('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xdd7b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd7b('0x4'),'afterDestroy':_0xdd7b('0x5')};function emitEvent(_0x356ffb){return function(_0x3a9780,_0x4570b7,_0x1244c5){OpenchannelAccountEvents[_0xdd7b('0x6')](_0x356ffb+':'+_0x3a9780['id'],_0x3a9780);OpenchannelAccountEvents[_0xdd7b('0x6')](_0x356ffb,_0x3a9780);_0x1244c5(null);};}for(var e in events){if(events[_0xdd7b('0x7')](e)){var event=events[e];OpenchannelAccount[_0xdd7b('0x8')](e,emitEvent(event));}}module[_0xdd7b('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8e5f645..91f75c9 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 _0x6e65=['define','openchannel_accounts','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelAccount.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6e65,0x1c5));var _0x56e6=function(_0x2cde8a,_0x18949e){_0x2cde8a=_0x2cde8a-0x0;var _0x3e36c2=_0x6e65[_0x2cde8a];return _0x3e36c2;};'use strict';var _=require(_0x56e6('0x0'));var util=require('util');var logger=require(_0x56e6('0x1'))(_0x56e6('0x2'));var moment=require(_0x56e6('0x3'));var BPromise=require(_0x56e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x56e6('0x5'));var config=require(_0x56e6('0x6'));var attributes=require(_0x56e6('0x7'));module[_0x56e6('0x8')]=function(_0x5cc513,_0xf3a1c3){return _0x5cc513[_0x56e6('0x9')]('OpenchannelAccount',attributes,{'tableName':_0x56e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd22b=['lodash','util','../../config/logger','moment','request-promise','path','./openchannelAccount.attributes','exports','define','openchannel_accounts'];(function(_0x503f92,_0x2b1d10){var _0x2d4c4e=function(_0x268c00){while(--_0x268c00){_0x503f92['push'](_0x503f92['shift']());}};_0x2d4c4e(++_0x2b1d10);}(_0xd22b,0x1ea));var _0xbd22=function(_0x74e55f,_0x29c41b){_0x74e55f=_0x74e55f-0x0;var _0xcac26e=_0xd22b[_0x74e55f];return _0xcac26e;};'use strict';var _=require(_0xbd22('0x0'));var util=require(_0xbd22('0x1'));var logger=require(_0xbd22('0x2'))('api');var moment=require(_0xbd22('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd22('0x4'));var fs=require('fs');var path=require(_0xbd22('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbd22('0x6'));module[_0xbd22('0x7')]=function(_0x362387,_0x1130a5){return _0x362387[_0xbd22('0x8')]('OpenchannelAccount',attributes,{'tableName':_0xbd22('0x9'),'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 0819789..68509cb 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 _0x13a8=['request','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelAccount.socket'];(function(_0x2bd8a6,_0x5b9211){var _0x1e037a=function(_0x486e4b){while(--_0x486e4b){_0x2bd8a6['push'](_0x2bd8a6['shift']());}};_0x1e037a(++_0x5b9211);}(_0x13a8,0x79));var _0x813a=function(_0x2a9f4b,_0x33dbe7){_0x2a9f4b=_0x2a9f4b-0x0;var _0x29e923=_0x13a8[_0x2a9f4b];return _0x29e923;};'use strict';var _=require(_0x813a('0x0'));var util=require('util');var moment=require(_0x813a('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('../../config/utils');var logger=require(_0x813a('0x2'))(_0x813a('0x3'));var config=require(_0x813a('0x4'));var jayson=require(_0x813a('0x5'));var client=jayson[_0x813a('0x6')][_0x813a('0x7')]({'port':0x232a});config[_0x813a('0x8')]=_['defaults'](config[_0x813a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x813a('0x9'))(new Redis(config[_0x813a('0x8')]));require(_0x813a('0xa'))['register'](socket);function respondWithRpcPromise(_0x8b1609,_0x3633c2,_0x499f40){return new BPromise(function(_0x81f17a,_0x5730d2){return client[_0x813a('0xb')](_0x8b1609,_0x499f40)[_0x813a('0xc')](function(_0x35845e){logger[_0x813a('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x3633c2,'request\x20sent');logger['debug'](_0x813a('0xe'),_0x3633c2,_0x813a('0xf'),JSON[_0x813a('0x10')](_0x35845e));if(_0x35845e[_0x813a('0x11')]){if(_0x35845e[_0x813a('0x11')][_0x813a('0x12')]===0x1f4){logger[_0x813a('0x11')](_0x813a('0x13'),_0x3633c2,_0x35845e[_0x813a('0x11')][_0x813a('0x14')]);return _0x5730d2(_0x35845e['error'][_0x813a('0x14')]);}logger[_0x813a('0x11')](_0x813a('0x13'),_0x3633c2,_0x35845e[_0x813a('0x11')][_0x813a('0x14')]);return _0x81f17a(_0x35845e[_0x813a('0x11')][_0x813a('0x14')]);}else{logger[_0x813a('0xd')](_0x813a('0x13'),_0x3633c2,_0x813a('0xf'));_0x81f17a(_0x35845e[_0x813a('0x15')][_0x813a('0x14')]);}})['catch'](function(_0xa6d841){logger[_0x813a('0x11')](_0x813a('0x13'),_0x3633c2,_0xa6d841);_0x5730d2(_0xa6d841);});});} \ No newline at end of file +var _0x7111=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7111,0x1cd));var _0x1711=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x7111[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x1711('0x0'));var util=require(_0x1711('0x1'));var moment=require('moment');var BPromise=require(_0x1711('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1711('0x3'))['db'];var utils=require(_0x1711('0x4'));var logger=require(_0x1711('0x5'))(_0x1711('0x6'));var config=require('../../config/environment');var jayson=require(_0x1711('0x7'));var client=jayson[_0x1711('0x8')][_0x1711('0x9')]({'port':0x232a});config[_0x1711('0xa')]=_[_0x1711('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1711('0xc'))(new Redis(config[_0x1711('0xa')]));require(_0x1711('0xd'))[_0x1711('0xe')](socket);function respondWithRpcPromise(_0x4c2278,_0xf44d29,_0x375e4a){return new BPromise(function(_0x4e1e51,_0x20806b){return client[_0x1711('0xf')](_0x4c2278,_0x375e4a)[_0x1711('0x10')](function(_0x703e39){logger[_0x1711('0x11')](_0x1711('0x12'),_0xf44d29,'request\x20sent');logger['debug'](_0x1711('0x13'),_0xf44d29,_0x1711('0x14'),JSON[_0x1711('0x15')](_0x703e39));if(_0x703e39[_0x1711('0x16')]){if(_0x703e39['error'][_0x1711('0x17')]===0x1f4){logger[_0x1711('0x16')](_0x1711('0x12'),_0xf44d29,_0x703e39[_0x1711('0x16')][_0x1711('0x18')]);return _0x20806b(_0x703e39[_0x1711('0x16')][_0x1711('0x18')]);}logger[_0x1711('0x16')](_0x1711('0x12'),_0xf44d29,_0x703e39[_0x1711('0x16')][_0x1711('0x18')]);return _0x4e1e51(_0x703e39[_0x1711('0x16')][_0x1711('0x18')]);}else{logger[_0x1711('0x11')](_0x1711('0x12'),_0xf44d29,_0x1711('0x14'));_0x4e1e51(_0x703e39[_0x1711('0x19')][_0x1711('0x18')]);}})[_0x1711('0x1a')](function(_0x1c1844){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xf44d29,_0x1c1844);_0x20806b(_0x1c1844);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index b95085e..0d201dc 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 _0xeec5=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','register'];(function(_0x1f6193,_0x2de9ff){var _0x160297=function(_0x33df3b){while(--_0x33df3b){_0x1f6193['push'](_0x1f6193['shift']());}};_0x160297(++_0x2de9ff);}(_0xeec5,0xbf));var _0x5eec=function(_0x27dc6d,_0x142ab7){_0x27dc6d=_0x27dc6d-0x0;var _0x1693ac=_0xeec5[_0x27dc6d];return _0x1693ac;};'use strict';var OpenchannelAccountEvents=require(_0x5eec('0x0'));var events=[_0x5eec('0x1'),_0x5eec('0x2'),_0x5eec('0x3')];function createListener(_0x4f88f1,_0x28fa0f){return function(_0x22b8f7){_0x28fa0f['emit'](_0x4f88f1,_0x22b8f7);};}function removeListener(_0x24e4b0,_0x5613df){return function(){OpenchannelAccountEvents['removeListener'](_0x24e4b0,_0x5613df);};}exports[_0x5eec('0x4')]=function(_0x238b27){for(var _0x9eeeb9=0x0,_0x10a065=events[_0x5eec('0x5')];_0x9eeeb9<_0x10a065;_0x9eeeb9++){var _0x51bf9a=events[_0x9eeeb9];var _0x5c5fd1=createListener(_0x5eec('0x6')+_0x51bf9a,_0x238b27);OpenchannelAccountEvents['on'](_0x51bf9a,_0x5c5fd1);}}; \ No newline at end of file +var _0xf94e=['emit','removeListener','register','./openchannelAccount.events','save','remove','update'];(function(_0x24393c,_0x26655d){var _0x1ac638=function(_0x3e1152){while(--_0x3e1152){_0x24393c['push'](_0x24393c['shift']());}};_0x1ac638(++_0x26655d);}(_0xf94e,0x7a));var _0xef94=function(_0x364c9f,_0x368b51){_0x364c9f=_0x364c9f-0x0;var _0x5718a6=_0xf94e[_0x364c9f];return _0x5718a6;};'use strict';var OpenchannelAccountEvents=require(_0xef94('0x0'));var events=[_0xef94('0x1'),_0xef94('0x2'),_0xef94('0x3')];function createListener(_0x30be15,_0x57aef5){return function(_0x15add0){_0x57aef5[_0xef94('0x4')](_0x30be15,_0x15add0);};}function removeListener(_0x5a07ab,_0x1b380c){return function(){OpenchannelAccountEvents[_0xef94('0x5')](_0x5a07ab,_0x1b380c);};}exports[_0xef94('0x6')]=function(_0x484d98){for(var _0x104d05=0x0,_0x23c922=events['length'];_0x104d05<_0x23c922;_0x104d05++){var _0x64c296=events[_0x104d05];var _0xe209fb=createListener('openchannelAccount:'+_0x64c296,_0x484d98);OpenchannelAccountEvents['on'](_0x64c296,_0xe209fb);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index fd1feee..49df46c 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 _0x078a=['multer','util','path','express','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x078a,0x1ed));var _0xa078=function(_0x342421,_0x32ee0c){_0x342421=_0x342421-0x0;var _0x1c9f56=_0x078a[_0x342421];return _0x1c9f56;};'use strict';var multer=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var path=require(_0xa078('0x2'));var timeout=require('connect-timeout');var express=require(_0xa078('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa078('0x4'));var controller=require(_0xa078('0x5'));router[_0xa078('0x6')]('/',auth[_0xa078('0x7')](),controller[_0xa078('0x8')]);router[_0xa078('0x6')](_0xa078('0x9'),auth[_0xa078('0x7')](),controller[_0xa078('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa078('0xb')]);router[_0xa078('0xc')](_0xa078('0x9'),auth['isAuthenticated'](),controller[_0xa078('0xd')]);router[_0xa078('0xe')](_0xa078('0x9'),auth['isAuthenticated'](),controller[_0xa078('0xf')]);module[_0xa078('0x10')]=router; \ No newline at end of file +var _0xe6f6=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','show','isAuthenticated','create','update','delete','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x258cb2,_0x11e472){var _0x1a867f=function(_0x5a8843){while(--_0x5a8843){_0x258cb2['push'](_0x258cb2['shift']());}};_0x1a867f(++_0x11e472);}(_0xe6f6,0x13b));var _0x6e6f=function(_0x15b996,_0x4cc6c5){_0x15b996=_0x15b996-0x0;var _0x31868e=_0xe6f6[_0x15b996];return _0x31868e;};'use strict';var multer=require('multer');var util=require(_0x6e6f('0x0'));var path=require(_0x6e6f('0x1'));var timeout=require(_0x6e6f('0x2'));var express=require('express');var router=express[_0x6e6f('0x3')]();var auth=require(_0x6e6f('0x4'));var interaction=require(_0x6e6f('0x5'));var config=require(_0x6e6f('0x6'));var controller=require(_0x6e6f('0x7'));router[_0x6e6f('0x8')]('/',auth['isAuthenticated'](),controller[_0x6e6f('0x9')]);router[_0x6e6f('0x8')](_0x6e6f('0xa'),auth['isAuthenticated'](),controller[_0x6e6f('0xb')]);router['post']('/',auth[_0x6e6f('0xc')](),controller[_0x6e6f('0xd')]);router['put'](_0x6e6f('0xa'),auth[_0x6e6f('0xc')](),controller[_0x6e6f('0xe')]);router[_0x6e6f('0xf')](_0x6e6f('0xa'),auth[_0x6e6f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 79ff3ee..9839f6f 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 _0x97f9=['exports','INTEGER','noop','TEXT','STRING'];(function(_0x3300c0,_0x5873d9){var _0x4383be=function(_0x3cc96a){while(--_0x3cc96a){_0x3300c0['push'](_0x3300c0['shift']());}};_0x4383be(++_0x5873d9);}(_0x97f9,0x181));var _0x997f=function(_0x21acae,_0xacd83c){_0x21acae=_0x21acae-0x0;var _0x43d844=_0x97f9[_0x21acae];return _0x43d844;};'use strict';var Sequelize=require('sequelize');module[_0x997f('0x0')]={'priority':{'type':Sequelize[_0x997f('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x997f('0x2')},'appdata':{'type':Sequelize[_0x997f('0x3')]()},'description':{'type':Sequelize[_0x997f('0x4')]},'interval':{'type':Sequelize[_0x997f('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb314=['*,*,*,*','sequelize','exports','noop','STRING'];(function(_0x121886,_0x8cd8e5){var _0x20ca01=function(_0x15e144){while(--_0x15e144){_0x121886['push'](_0x121886['shift']());}};_0x20ca01(++_0x8cd8e5);}(_0xb314,0x191));var _0x4b31=function(_0x378f31,_0x505319){_0x378f31=_0x378f31-0x0;var _0x3056ac=_0xb314[_0x378f31];return _0x3056ac;};'use strict';var Sequelize=require(_0x4b31('0x0'));module[_0x4b31('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b31('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4b31('0x3')]},'interval':{'type':Sequelize[_0x4b31('0x3')],'defaultValue':_0x4b31('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7500bf4..a070099 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 _0x35c3=['eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','OpenchannelApplication','keys','length','includeAll','options','create','body','find','html-pdf'];(function(_0x70fb2c,_0x26fcea){var _0x4777bc=function(_0x1bbd3e){while(--_0x1bbd3e){_0x70fb2c['push'](_0x70fb2c['shift']());}};_0x4777bc(++_0x26fcea);}(_0x35c3,0x167));var _0x335c=function(_0x366ac0,_0x43006a){_0x366ac0=_0x366ac0-0x0;var _0xee6469=_0x35c3[_0x366ac0];return _0xee6469;};'use strict';var pdf=require(_0x335c('0x0'));var emlformat=require(_0x335c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x335c('0x2'));var moment=require(_0x335c('0x3'));var BPromise=require(_0x335c('0x4'));var Mustache=require(_0x335c('0x5'));var util=require(_0x335c('0x6'));var path=require('path');var sox=require(_0x335c('0x7'));var csv=require(_0x335c('0x8'));var ejs=require(_0x335c('0x9'));var fs=require('fs');var _=require(_0x335c('0xa'));var squel=require(_0x335c('0xb'));var crypto=require('crypto');var jsforce=require(_0x335c('0xc'));var deskjs=require(_0x335c('0xd'));var toCsv=require(_0x335c('0x8'));var querystring=require(_0x335c('0xe'));var Papa=require(_0x335c('0xf'));var Redis=require(_0x335c('0x10'));var authService=require(_0x335c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x335c('0x12'));var hardwareService=require(_0x335c('0x13'));var logger=require(_0x335c('0x14'))('api');var utils=require(_0x335c('0x15'));var config=require(_0x335c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ea0ff,_0x116f0b){_0x116f0b=_0x116f0b||0xcc;return function(_0x1c24f0){if(_0x1c24f0){return _0x1ea0ff[_0x335c('0x17')](_0x116f0b);}return _0x1ea0ff[_0x335c('0x18')](_0x116f0b)[_0x335c('0x19')]();};}function respondWithResult(_0x164050,_0x2bd42d){_0x2bd42d=_0x2bd42d||0xc8;return function(_0x15b4d5){if(_0x15b4d5){return _0x164050[_0x335c('0x18')](_0x2bd42d)[_0x335c('0x1a')](_0x15b4d5);}};}function respondWithFilteredResult(_0x49658a,_0x1a4d19){return function(_0x1ae2e2){if(_0x1ae2e2){var _0x176608=_0x1ae2e2[_0x335c('0x1b')],_0x28cc54=_0x1a4d19['offset'],_0x2de7e8=_0x1a4d19[_0x335c('0x1c')]+_0x1a4d19['limit'],_0x39bfae;if(_0x2de7e8>=_0x176608){_0x2de7e8=_0x176608;_0x39bfae=0xc8;}else{_0x39bfae=0xce;}_0x49658a[_0x335c('0x18')](_0x39bfae);return _0x49658a[_0x335c('0x1d')]('Content-Range',_0x28cc54+'-'+_0x2de7e8+'/'+_0x176608)[_0x335c('0x1a')](_0x1ae2e2);}return null;};}function patchUpdates(_0x21f591){return function(_0x34705b){try{jsonpatch[_0x335c('0x1e')](_0x34705b,_0x21f591,!![]);}catch(_0x825975){return BPromise[_0x335c('0x1f')](_0x825975);}return _0x34705b[_0x335c('0x20')]();};}function saveUpdates(_0x3c6256,_0x15bc53){return function(_0x23c01f){if(_0x23c01f){return _0x23c01f[_0x335c('0x21')](_0x3c6256)[_0x335c('0x22')](function(_0x1e9da7){return _0x1e9da7;});}return null;};}function removeEntity(_0x22aeeb,_0x564073){return function(_0x1b2b72){if(_0x1b2b72){return _0x1b2b72[_0x335c('0x23')]()[_0x335c('0x22')](function(){_0x22aeeb['status'](0xcc)[_0x335c('0x19')]();});}};}function handleEntityNotFound(_0xa24ee9,_0x431bb9){return function(_0x4fa1b3){if(!_0x4fa1b3){_0xa24ee9['sendStatus'](0x194);}return _0x4fa1b3;};}function handleError(_0x4b0c02,_0x52d5a0){_0x52d5a0=_0x52d5a0||0x1f4;return function(_0x457a69){logger[_0x335c('0x24')](_0x457a69[_0x335c('0x25')]);if(_0x457a69['name']){delete _0x457a69[_0x335c('0x26')];}_0x4b0c02[_0x335c('0x18')](_0x52d5a0)[_0x335c('0x27')](_0x457a69);};}exports[_0x335c('0x28')]=function(_0x44d1a1,_0x4c9566){var _0x2bc9b3={},_0x30945e={},_0x273048={'count':0x0,'rows':[]};var _0x27704a=_[_0x335c('0x29')](db['OpenchannelApplication'][_0x335c('0x2a')],function(_0x3085c5){return{'name':_0x3085c5['fieldName'],'type':_0x3085c5[_0x335c('0x2b')][_0x335c('0x2c')]};});_0x30945e[_0x335c('0x2d')]=_['map'](_0x27704a,_0x335c('0x26'));_0x30945e['query']=_['keys'](_0x44d1a1[_0x335c('0x2e')]);_0x30945e[_0x335c('0x2f')]=_[_0x335c('0x30')](_0x30945e[_0x335c('0x2d')],_0x30945e[_0x335c('0x2e')]);_0x2bc9b3[_0x335c('0x31')]=_[_0x335c('0x30')](_0x30945e['model'],qs[_0x335c('0x32')](_0x44d1a1[_0x335c('0x2e')]['fields']));_0x2bc9b3[_0x335c('0x31')]=_0x2bc9b3['attributes']['length']?_0x2bc9b3[_0x335c('0x31')]:_0x30945e[_0x335c('0x2d')];if(!_0x44d1a1[_0x335c('0x2e')]['hasOwnProperty'](_0x335c('0x33'))){_0x2bc9b3['limit']=qs[_0x335c('0x34')](_0x44d1a1[_0x335c('0x2e')]['limit']);_0x2bc9b3[_0x335c('0x1c')]=qs[_0x335c('0x1c')](_0x44d1a1[_0x335c('0x2e')]['offset']);}_0x2bc9b3['order']=qs[_0x335c('0x35')](_0x44d1a1[_0x335c('0x2e')][_0x335c('0x35')]);_0x2bc9b3[_0x335c('0x36')]=qs[_0x335c('0x2f')](_['pick'](_0x44d1a1[_0x335c('0x2e')],_0x30945e[_0x335c('0x2f')]),_0x27704a);if(_0x44d1a1[_0x335c('0x2e')][_0x335c('0x37')]){_0x2bc9b3[_0x335c('0x36')]=_[_0x335c('0x38')](_0x2bc9b3['where'],{'$or':_['map'](_0x27704a,function(_0x218e11){if(_0x218e11[_0x335c('0x2b')]!==_0x335c('0x39')){var _0x1fe9d2={};_0x1fe9d2[_0x218e11[_0x335c('0x26')]]={'$like':'%'+_0x44d1a1[_0x335c('0x2e')]['filter']+'%'};return _0x1fe9d2;}})});}_0x2bc9b3=_[_0x335c('0x38')]({},_0x2bc9b3,_0x44d1a1['options']);var _0x35c0e6={'where':_0x2bc9b3[_0x335c('0x36')]};return db['OpenchannelApplication'][_0x335c('0x1b')](_0x35c0e6)[_0x335c('0x22')](function(_0x57d470){_0x273048[_0x335c('0x1b')]=_0x57d470;if(_0x44d1a1[_0x335c('0x2e')]['includeAll']){_0x2bc9b3[_0x335c('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x335c('0x3b')](_0x2bc9b3);})[_0x335c('0x22')](function(_0x488542){_0x273048[_0x335c('0x3c')]=_0x488542;return _0x273048;})['then'](respondWithFilteredResult(_0x4c9566,_0x2bc9b3))[_0x335c('0x3d')](handleError(_0x4c9566,null));};exports[_0x335c('0x3e')]=function(_0x596bc2,_0x508e94){var _0x3b93e9={'raw':!![],'where':{'id':_0x596bc2[_0x335c('0x3f')]['id']}},_0x173433={};_0x173433[_0x335c('0x2d')]=_['keys'](db[_0x335c('0x40')]['rawAttributes']);_0x173433[_0x335c('0x2e')]=_[_0x335c('0x41')](_0x596bc2[_0x335c('0x2e')]);_0x173433[_0x335c('0x2f')]=_[_0x335c('0x30')](_0x173433[_0x335c('0x2d')],_0x173433[_0x335c('0x2e')]);_0x3b93e9[_0x335c('0x31')]=_['intersection'](_0x173433[_0x335c('0x2d')],qs[_0x335c('0x32')](_0x596bc2[_0x335c('0x2e')][_0x335c('0x32')]));_0x3b93e9[_0x335c('0x31')]=_0x3b93e9[_0x335c('0x31')][_0x335c('0x42')]?_0x3b93e9[_0x335c('0x31')]:_0x173433['model'];if(_0x596bc2[_0x335c('0x2e')][_0x335c('0x43')]){_0x3b93e9[_0x335c('0x3a')]=[{'all':!![]}];}_0x3b93e9=_[_0x335c('0x38')]({},_0x3b93e9,_0x596bc2[_0x335c('0x44')]);return db[_0x335c('0x40')]['find'](_0x3b93e9)[_0x335c('0x22')](handleEntityNotFound(_0x508e94,null))['then'](respondWithResult(_0x508e94,null))[_0x335c('0x3d')](handleError(_0x508e94,null));};exports[_0x335c('0x45')]=function(_0x384bd5,_0x4e3527){return db[_0x335c('0x40')][_0x335c('0x45')](_0x384bd5[_0x335c('0x46')],{})['then'](respondWithResult(_0x4e3527,0xc9))['catch'](handleError(_0x4e3527,null));};exports[_0x335c('0x21')]=function(_0x5c790e,_0x58e0ed){if(_0x5c790e['body']['id']){delete _0x5c790e['body']['id'];}return db[_0x335c('0x40')][_0x335c('0x47')]({'where':{'id':_0x5c790e[_0x335c('0x3f')]['id']}})[_0x335c('0x22')](handleEntityNotFound(_0x58e0ed,null))[_0x335c('0x22')](saveUpdates(_0x5c790e[_0x335c('0x46')],null))[_0x335c('0x22')](respondWithResult(_0x58e0ed,null))['catch'](handleError(_0x58e0ed,null));};exports[_0x335c('0x23')]=function(_0xc126c8,_0x1658fe){return db[_0x335c('0x40')][_0x335c('0x47')]({'where':{'id':_0xc126c8['params']['id']}})[_0x335c('0x22')](handleEntityNotFound(_0x1658fe,null))[_0x335c('0x22')](removeEntity(_0x1658fe,null))[_0x335c('0x3d')](handleError(_0x1658fe,null));}; \ No newline at end of file +var _0xa324=['limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','type','VIRTUAL','merge','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','html-pdf','eml-format','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset'];(function(_0x4dc1eb,_0x2cb24a){var _0x3c505c=function(_0x434cb0){while(--_0x434cb0){_0x4dc1eb['push'](_0x4dc1eb['shift']());}};_0x3c505c(++_0x2cb24a);}(_0xa324,0x6e));var _0x4a32=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xa324[_0x13b02f];return _0x12e9a6;};'use strict';var pdf=require(_0x4a32('0x0'));var emlformat=require(_0x4a32('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4a32('0x2'));var rp=require('request-promise');var moment=require(_0x4a32('0x3'));var BPromise=require(_0x4a32('0x4'));var Mustache=require('mustache');var util=require(_0x4a32('0x5'));var path=require(_0x4a32('0x6'));var sox=require('sox');var csv=require(_0x4a32('0x7'));var ejs=require(_0x4a32('0x8'));var fs=require('fs');var _=require(_0x4a32('0x9'));var squel=require(_0x4a32('0xa'));var crypto=require('crypto');var jsforce=require(_0x4a32('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4a32('0x7'));var querystring=require(_0x4a32('0xc'));var Papa=require(_0x4a32('0xd'));var Redis=require(_0x4a32('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4a32('0xf'));var as=require(_0x4a32('0x10'));var hardwareService=require(_0x4a32('0x11'));var logger=require('../../config/logger')(_0x4a32('0x12'));var utils=require(_0x4a32('0x13'));var config=require(_0x4a32('0x14'));var db=require(_0x4a32('0x15'))['db'];function respondWithStatusCode(_0x2d2d97,_0x329de3){_0x329de3=_0x329de3||0xcc;return function(_0x115104){if(_0x115104){return _0x2d2d97['sendStatus'](_0x329de3);}return _0x2d2d97[_0x4a32('0x16')](_0x329de3)[_0x4a32('0x17')]();};}function respondWithResult(_0x240adc,_0x4022d3){_0x4022d3=_0x4022d3||0xc8;return function(_0x3388da){if(_0x3388da){return _0x240adc[_0x4a32('0x16')](_0x4022d3)['json'](_0x3388da);}};}function respondWithFilteredResult(_0x38e0c3,_0x412a18){return function(_0x59a2cc){if(_0x59a2cc){var _0x1b0f5d=_0x59a2cc[_0x4a32('0x18')],_0x2ed227=_0x412a18[_0x4a32('0x19')],_0x518570=_0x412a18[_0x4a32('0x19')]+_0x412a18[_0x4a32('0x1a')],_0x27a606;if(_0x518570>=_0x1b0f5d){_0x518570=_0x1b0f5d;_0x27a606=0xc8;}else{_0x27a606=0xce;}_0x38e0c3[_0x4a32('0x16')](_0x27a606);return _0x38e0c3[_0x4a32('0x1b')](_0x4a32('0x1c'),_0x2ed227+'-'+_0x518570+'/'+_0x1b0f5d)['json'](_0x59a2cc);}return null;};}function patchUpdates(_0x585ce6){return function(_0x5330c8){try{jsonpatch['apply'](_0x5330c8,_0x585ce6,!![]);}catch(_0x18e20c){return BPromise['reject'](_0x18e20c);}return _0x5330c8[_0x4a32('0x1d')]();};}function saveUpdates(_0x2366b7,_0x1abc74){return function(_0x23bf41){if(_0x23bf41){return _0x23bf41[_0x4a32('0x1e')](_0x2366b7)[_0x4a32('0x1f')](function(_0x347a58){return _0x347a58;});}return null;};}function removeEntity(_0x35251e,_0x21e149){return function(_0x4eeb60){if(_0x4eeb60){return _0x4eeb60[_0x4a32('0x20')]()[_0x4a32('0x1f')](function(){_0x35251e['status'](0xcc)[_0x4a32('0x17')]();});}};}function handleEntityNotFound(_0x5a4e54,_0x316859){return function(_0x5d47b8){if(!_0x5d47b8){_0x5a4e54['sendStatus'](0x194);}return _0x5d47b8;};}function handleError(_0x2a9dc2,_0x2c09c0){_0x2c09c0=_0x2c09c0||0x1f4;return function(_0x547834){logger[_0x4a32('0x21')](_0x547834[_0x4a32('0x22')]);if(_0x547834[_0x4a32('0x23')]){delete _0x547834[_0x4a32('0x23')];}_0x2a9dc2[_0x4a32('0x16')](_0x2c09c0)[_0x4a32('0x24')](_0x547834);};}exports[_0x4a32('0x25')]=function(_0x63c2df,_0x158adc){var _0x223597={},_0x26e271={},_0x5d36e1={'count':0x0,'rows':[]};var _0x5ad576=_[_0x4a32('0x26')](db[_0x4a32('0x27')][_0x4a32('0x28')],function(_0x191864){return{'name':_0x191864['fieldName'],'type':_0x191864['type'][_0x4a32('0x29')]};});_0x26e271[_0x4a32('0x2a')]=_[_0x4a32('0x26')](_0x5ad576,_0x4a32('0x23'));_0x26e271[_0x4a32('0x2b')]=_[_0x4a32('0x2c')](_0x63c2df[_0x4a32('0x2b')]);_0x26e271[_0x4a32('0x2d')]=_[_0x4a32('0x2e')](_0x26e271[_0x4a32('0x2a')],_0x26e271[_0x4a32('0x2b')]);_0x223597[_0x4a32('0x2f')]=_['intersection'](_0x26e271[_0x4a32('0x2a')],qs['fields'](_0x63c2df[_0x4a32('0x2b')][_0x4a32('0x30')]));_0x223597[_0x4a32('0x2f')]=_0x223597['attributes']['length']?_0x223597[_0x4a32('0x2f')]:_0x26e271[_0x4a32('0x2a')];if(!_0x63c2df[_0x4a32('0x2b')][_0x4a32('0x31')]('nolimit')){_0x223597[_0x4a32('0x1a')]=qs[_0x4a32('0x1a')](_0x63c2df['query'][_0x4a32('0x1a')]);_0x223597['offset']=qs[_0x4a32('0x19')](_0x63c2df[_0x4a32('0x2b')][_0x4a32('0x19')]);}_0x223597['order']=qs[_0x4a32('0x32')](_0x63c2df['query'][_0x4a32('0x32')]);_0x223597['where']=qs[_0x4a32('0x2d')](_['pick'](_0x63c2df[_0x4a32('0x2b')],_0x26e271['filters']),_0x5ad576);if(_0x63c2df[_0x4a32('0x2b')][_0x4a32('0x33')]){_0x223597[_0x4a32('0x34')]=_['merge'](_0x223597[_0x4a32('0x34')],{'$or':_[_0x4a32('0x26')](_0x5ad576,function(_0x2a7450){if(_0x2a7450[_0x4a32('0x35')]!==_0x4a32('0x36')){var _0xbc39e4={};_0xbc39e4[_0x2a7450[_0x4a32('0x23')]]={'$like':'%'+_0x63c2df[_0x4a32('0x2b')][_0x4a32('0x33')]+'%'};return _0xbc39e4;}})});}_0x223597=_[_0x4a32('0x37')]({},_0x223597,_0x63c2df[_0x4a32('0x38')]);var _0x19d1e2={'where':_0x223597[_0x4a32('0x34')]};return db['OpenchannelApplication'][_0x4a32('0x18')](_0x19d1e2)[_0x4a32('0x1f')](function(_0x4009fb){_0x5d36e1[_0x4a32('0x18')]=_0x4009fb;if(_0x63c2df[_0x4a32('0x2b')]['includeAll']){_0x223597[_0x4a32('0x39')]=[{'all':!![]}];}return db[_0x4a32('0x27')][_0x4a32('0x3a')](_0x223597);})[_0x4a32('0x1f')](function(_0x69300d){_0x5d36e1[_0x4a32('0x3b')]=_0x69300d;return _0x5d36e1;})[_0x4a32('0x1f')](respondWithFilteredResult(_0x158adc,_0x223597))['catch'](handleError(_0x158adc,null));};exports[_0x4a32('0x3c')]=function(_0x4a5bbd,_0x22be06){var _0x471b20={'raw':!![],'where':{'id':_0x4a5bbd[_0x4a32('0x3d')]['id']}},_0x3427e1={};_0x3427e1[_0x4a32('0x2a')]=_['keys'](db[_0x4a32('0x27')][_0x4a32('0x28')]);_0x3427e1[_0x4a32('0x2b')]=_[_0x4a32('0x2c')](_0x4a5bbd[_0x4a32('0x2b')]);_0x3427e1['filters']=_[_0x4a32('0x2e')](_0x3427e1['model'],_0x3427e1['query']);_0x471b20[_0x4a32('0x2f')]=_[_0x4a32('0x2e')](_0x3427e1[_0x4a32('0x2a')],qs[_0x4a32('0x30')](_0x4a5bbd[_0x4a32('0x2b')]['fields']));_0x471b20['attributes']=_0x471b20['attributes'][_0x4a32('0x3e')]?_0x471b20[_0x4a32('0x2f')]:_0x3427e1[_0x4a32('0x2a')];if(_0x4a5bbd[_0x4a32('0x2b')][_0x4a32('0x3f')]){_0x471b20[_0x4a32('0x39')]=[{'all':!![]}];}_0x471b20=_[_0x4a32('0x37')]({},_0x471b20,_0x4a5bbd['options']);return db[_0x4a32('0x27')][_0x4a32('0x40')](_0x471b20)[_0x4a32('0x1f')](handleEntityNotFound(_0x22be06,null))['then'](respondWithResult(_0x22be06,null))[_0x4a32('0x41')](handleError(_0x22be06,null));};exports[_0x4a32('0x42')]=function(_0x24c99a,_0x201a0b){return db[_0x4a32('0x27')][_0x4a32('0x42')](_0x24c99a['body'],{})[_0x4a32('0x1f')](respondWithResult(_0x201a0b,0xc9))['catch'](handleError(_0x201a0b,null));};exports[_0x4a32('0x1e')]=function(_0x27dc67,_0x2c47d3){if(_0x27dc67[_0x4a32('0x43')]['id']){delete _0x27dc67['body']['id'];}return db['OpenchannelApplication'][_0x4a32('0x40')]({'where':{'id':_0x27dc67[_0x4a32('0x3d')]['id']}})[_0x4a32('0x1f')](handleEntityNotFound(_0x2c47d3,null))[_0x4a32('0x1f')](saveUpdates(_0x27dc67[_0x4a32('0x43')],null))[_0x4a32('0x1f')](respondWithResult(_0x2c47d3,null))[_0x4a32('0x41')](handleError(_0x2c47d3,null));};exports['destroy']=function(_0x1a4612,_0x151a58){return db['OpenchannelApplication'][_0x4a32('0x40')]({'where':{'id':_0x1a4612[_0x4a32('0x3d')]['id']}})[_0x4a32('0x1f')](handleEntityNotFound(_0x151a58,null))['then'](removeEntity(_0x151a58,null))['catch'](handleError(_0x151a58,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d08448b..9881913 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 _0x0458=['openchannel_applications','util','../../config/logger','moment','path','rimraf','./openchannelApplication.attributes','exports'];(function(_0x19cb89,_0x31af5f){var _0x53bba4=function(_0x40481c){while(--_0x40481c){_0x19cb89['push'](_0x19cb89['shift']());}};_0x53bba4(++_0x31af5f);}(_0x0458,0x109));var _0x8045=function(_0x37af28,_0x46becc){_0x37af28=_0x37af28-0x0;var _0x6a9af1=_0x0458[_0x37af28];return _0x6a9af1;};'use strict';var _=require('lodash');var util=require(_0x8045('0x0'));var logger=require(_0x8045('0x1'))('api');var moment=require(_0x8045('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8045('0x3'));var rimraf=require(_0x8045('0x4'));var config=require('../../config/environment');var attributes=require(_0x8045('0x5'));module[_0x8045('0x6')]=function(_0x30f738,_0x4a0710){return _0x30f738['define']('OpenchannelApplication',attributes,{'tableName':_0x8045('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x53a0=['../../config/environment','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1edfa4,_0x5537f9){var _0x3a510e=function(_0x49f38d){while(--_0x49f38d){_0x1edfa4['push'](_0x1edfa4['shift']());}};_0x3a510e(++_0x5537f9);}(_0x53a0,0x1df));var _0x053a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x53a0[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x053a('0x0'));var logger=require(_0x053a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x053a('0x2'));var rp=require(_0x053a('0x3'));var fs=require('fs');var path=require(_0x053a('0x4'));var rimraf=require('rimraf');var config=require(_0x053a('0x5'));var attributes=require('./openchannelApplication.attributes');module[_0x053a('0x6')]=function(_0xd2188c,_0x2f88b3){return _0xd2188c[_0x053a('0x7')](_0x053a('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x053a('0x9'),'collate':_0x053a('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1c09eb5..8af2666 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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_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});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x37a0ce,_0x28dc04){var _0x569f4e=function(_0x1671c0){while(--_0x1671c0){_0x37a0ce['push'](_0x37a0ce['shift']());}};_0x569f4e(++_0x28dc04);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a9162,_0xd81cf2){_0x4a9162=_0x4a9162-0x0;var _0x1b56f0=_0x5f2f[_0x4a9162];return _0x1b56f0;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3992d0f..5ca9f75 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 _0x987d=['openchannelinteraction:destroy','removeTags','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','openchannelinteraction:update','update','delete'];(function(_0x3f880e,_0x4a4c90){var _0x2d7fee=function(_0x5d6577){while(--_0x5d6577){_0x3f880e['push'](_0x3f880e['shift']());}};_0x2d7fee(++_0x4a4c90);}(_0x987d,0x1c5));var _0xd987=function(_0x1afed8,_0x5638ce){_0x1afed8=_0x1afed8-0x0;var _0x31ae4f=_0x987d[_0x1afed8];return _0x31ae4f;};'use strict';var multer=require(_0xd987('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd987('0x1'));var router=express[_0xd987('0x2')]();var auth=require(_0xd987('0x3'));var interaction=require(_0xd987('0x4'));var config=require(_0xd987('0x5'));var controller=require(_0xd987('0x6'));router[_0xd987('0x7')]('/',auth[_0xd987('0x8')](),controller['index']);router[_0xd987('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd987('0x9')]);router[_0xd987('0x7')]('/:id',auth[_0xd987('0x8')](),controller[_0xd987('0xa')]);router[_0xd987('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd987('0xb')]);router[_0xd987('0x7')]('/:id/download',auth[_0xd987('0x8')](),controller[_0xd987('0xc')]);router[_0xd987('0xd')]('/',auth['isAuthenticated'](),controller[_0xd987('0xe')]);router[_0xd987('0xd')](_0xd987('0xf'),auth[_0xd987('0x8')](),controller[_0xd987('0x10')]);router[_0xd987('0xd')](_0xd987('0x11'),auth['isAuthenticated'](),interaction[_0xd987('0x12')](_0xd987('0x13'),_0xd987('0x14')),controller[_0xd987('0x15')]);router[_0xd987('0x16')](_0xd987('0x17'),auth[_0xd987('0x8')](),interaction[_0xd987('0x12')](_0xd987('0x13'),_0xd987('0x18')),controller[_0xd987('0x19')]);router[_0xd987('0x1a')]('/:id',auth[_0xd987('0x8')](),interaction[_0xd987('0x12')](_0xd987('0x13'),_0xd987('0x1b')),controller['destroy']);router[_0xd987('0x1a')](_0xd987('0x11'),auth[_0xd987('0x8')](),controller[_0xd987('0x1c')]);module[_0xd987('0x1d')]=router; \ No newline at end of file +var _0x76fa=['index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','openchannelinteraction:destroy','destroy','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x76fa,0xde));var _0xa76f=function(_0x35749e,_0x61c01b){_0x35749e=_0x35749e-0x0;var _0x345ad0=_0x76fa[_0x35749e];return _0x345ad0;};'use strict';var multer=require('multer');var util=require(_0xa76f('0x0'));var path=require(_0xa76f('0x1'));var timeout=require(_0xa76f('0x2'));var express=require(_0xa76f('0x3'));var router=express['Router']();var auth=require(_0xa76f('0x4'));var interaction=require(_0xa76f('0x5'));var config=require(_0xa76f('0x6'));var controller=require(_0xa76f('0x7'));router[_0xa76f('0x8')]('/',auth['isAuthenticated'](),controller[_0xa76f('0x9')]);router['get'](_0xa76f('0xa'),auth[_0xa76f('0xb')](),controller[_0xa76f('0xc')]);router[_0xa76f('0x8')](_0xa76f('0xd'),auth[_0xa76f('0xb')](),controller[_0xa76f('0xe')]);router['get'](_0xa76f('0xf'),auth[_0xa76f('0xb')](),controller[_0xa76f('0x10')]);router[_0xa76f('0x8')](_0xa76f('0x11'),auth[_0xa76f('0xb')](),controller[_0xa76f('0x12')]);router[_0xa76f('0x13')]('/',auth['isAuthenticated'](),controller[_0xa76f('0x14')]);router[_0xa76f('0x13')](_0xa76f('0xf'),auth[_0xa76f('0xb')](),controller[_0xa76f('0x15')]);router[_0xa76f('0x13')](_0xa76f('0x16'),auth[_0xa76f('0xb')](),interaction[_0xa76f('0x17')](_0xa76f('0x18'),_0xa76f('0x19')),controller[_0xa76f('0x1a')]);router[_0xa76f('0x1b')](_0xa76f('0xd'),auth[_0xa76f('0xb')](),interaction[_0xa76f('0x17')]('openchannel','openchannelinteraction:update'),controller[_0xa76f('0x1c')]);router['delete'](_0xa76f('0xd'),auth[_0xa76f('0xb')](),interaction[_0xa76f('0x17')](_0xa76f('0x18'),_0xa76f('0x1d')),controller[_0xa76f('0x1e')]);router[_0xa76f('0x1f')]('/:id/tags',auth[_0xa76f('0xb')](),controller['removeTags']);module[_0xa76f('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 485f9ca..1677c2b 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 _0xd6d6=['ENUM','out','sequelize','DATE','STRING'];(function(_0x76fce8,_0x261034){var _0x41596e=function(_0x23f59d){while(--_0x23f59d){_0x76fce8['push'](_0x76fce8['shift']());}};_0x41596e(++_0x261034);}(_0xd6d6,0x188));var _0x6d6d=function(_0x486e35,_0x1f290e){_0x486e35=_0x486e35-0x0;var _0x3e64f5=_0xd6d6[_0x486e35];return _0x3e64f5;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d6d('0x1')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6d6d('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x6d6d('0x2')]},'externalUrl':{'type':Sequelize[_0x6d6d('0x2')]},'lastMsgAt':{'type':Sequelize[_0x6d6d('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x6d6d('0x3')]('in',_0x6d6d('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa43b=['exports','STRING','DATE','ENUM','out','sequelize'];(function(_0x4b2402,_0x570caa){var _0x2c78bd=function(_0x11ea53){while(--_0x11ea53){_0x4b2402['push'](_0x4b2402['shift']());}};_0x2c78bd(++_0x570caa);}(_0xa43b,0xa7));var _0xba43=function(_0x51c1e6,_0x399feb){_0x51c1e6=_0x51c1e6-0x0;var _0x459aa5=_0xa43b[_0x51c1e6];return _0x459aa5;};'use strict';var Sequelize=require(_0xba43('0x0'));module[_0xba43('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xba43('0x2')]},'note':{'type':Sequelize[_0xba43('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xba43('0x2')]},'externalUrl':{'type':Sequelize[_0xba43('0x2')]},'lastMsgAt':{'type':Sequelize[_0xba43('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xba43('0x4')]('in',_0xba43('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xba43('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 42fff30..4e4f60b 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 _0x41fc=['status','end','json','count','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','push','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','select','field','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','from','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','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','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','isEmpty','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','all','rows','show','params','include','merge','options','catch','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','server','tmp','join','root','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','N.A.','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register'];(function(_0x5411b6,_0x45356b){var _0x1a0ade=function(_0x9a3cb7){while(--_0x9a3cb7){_0x5411b6['push'](_0x5411b6['shift']());}};_0x1a0ade(++_0x45356b);}(_0x41fc,0x1c6));var _0xc41f=function(_0x463827,_0x26073c){_0x463827=_0x463827-0x0;var _0x22b743=_0x41fc[_0x463827];return _0x22b743;};'use strict';var pdf=require(_0xc41f('0x0'));var emlformat=require(_0xc41f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc41f('0x2'));var rp=require(_0xc41f('0x3'));var moment=require(_0xc41f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc41f('0x5'));var util=require(_0xc41f('0x6'));var path=require(_0xc41f('0x7'));var sox=require('sox');var csv=require(_0xc41f('0x8'));var ejs=require(_0xc41f('0x9'));var fs=require('fs');var _=require(_0xc41f('0xa'));var squel=require(_0xc41f('0xb'));var crypto=require(_0xc41f('0xc'));var jsforce=require(_0xc41f('0xd'));var deskjs=require(_0xc41f('0xe'));var toCsv=require(_0xc41f('0x8'));var querystring=require('querystring');var Papa=require(_0xc41f('0xf'));var Redis=require(_0xc41f('0x10'));var authService=require(_0xc41f('0x11'));var qs=require(_0xc41f('0x12'));var as=require(_0xc41f('0x13'));var hardwareService=require(_0xc41f('0x14'));var logger=require('../../config/logger')(_0xc41f('0x15'));var utils=require(_0xc41f('0x16'));var config=require(_0xc41f('0x17'));var db=require(_0xc41f('0x18'))['db'];config[_0xc41f('0x19')]=_['defaults'](config[_0xc41f('0x19')],{'host':_0xc41f('0x1a'),'port':0x18eb});var socket=require(_0xc41f('0x1b'))(new Redis(config[_0xc41f('0x19')]));require(_0xc41f('0x1c'))[_0xc41f('0x1d')](socket);function respondWithStatusCode(_0x726f0b,_0x533cbd){_0x533cbd=_0x533cbd||0xcc;return function(_0x4b7033){if(_0x4b7033){return _0x726f0b['sendStatus'](_0x533cbd);}return _0x726f0b[_0xc41f('0x1e')](_0x533cbd)[_0xc41f('0x1f')]();};}function respondWithResult(_0x5ba0f9,_0x2c7654){_0x2c7654=_0x2c7654||0xc8;return function(_0x3e911b){if(_0x3e911b){return _0x5ba0f9['status'](_0x2c7654)[_0xc41f('0x20')](_0x3e911b);}};}function respondWithFilteredResult(_0x587177,_0x3e0056){return function(_0x1a7d69){if(_0x1a7d69){var _0xdfc4d2=_0x1a7d69[_0xc41f('0x21')],_0x3f1b20=_0x3e0056['offset'],_0x2e585c=_0x3e0056['offset']+_0x3e0056[_0xc41f('0x22')],_0x5f2e8d;if(_0x2e585c>=_0xdfc4d2){_0x2e585c=_0xdfc4d2;_0x5f2e8d=0xc8;}else{_0x5f2e8d=0xce;}_0x587177[_0xc41f('0x1e')](_0x5f2e8d);return _0x587177[_0xc41f('0x23')]('Content-Range',_0x3f1b20+'-'+_0x2e585c+'/'+_0xdfc4d2)[_0xc41f('0x20')](_0x1a7d69);}return null;};}function patchUpdates(_0x31b852){return function(_0x563dff){try{jsonpatch[_0xc41f('0x24')](_0x563dff,_0x31b852,!![]);}catch(_0x259806){return BPromise['reject'](_0x259806);}return _0x563dff[_0xc41f('0x25')]();};}function saveUpdates(_0x2f63fe,_0x5a2dfb){return function(_0x6472bb){if(_0x6472bb){return _0x6472bb[_0xc41f('0x26')](_0x2f63fe)[_0xc41f('0x27')](function(_0x5dcfb5){return _0x5dcfb5;});}return null;};}function removeEntity(_0xce13e7,_0x44f349){return function(_0x1a3e26){if(_0x1a3e26){return _0x1a3e26[_0xc41f('0x28')]()[_0xc41f('0x27')](function(){_0xce13e7[_0xc41f('0x1e')](0xcc)[_0xc41f('0x1f')]();});}};}function handleEntityNotFound(_0x410c23,_0x39d919){return function(_0x345f95){if(!_0x345f95){_0x410c23[_0xc41f('0x29')](0x194);}return _0x345f95;};}function handleError(_0x23b0b1,_0x21ecff){_0x21ecff=_0x21ecff||0x1f4;return function(_0x5163d9){logger[_0xc41f('0x2a')](_0x5163d9[_0xc41f('0x2b')]);if(_0x5163d9[_0xc41f('0x2c')]){delete _0x5163d9[_0xc41f('0x2c')];}_0x23b0b1['status'](_0x21ecff)[_0xc41f('0x2d')](_0x5163d9);};}function getInteractionUsers(_0x303cd8,_0x32119c){return new BPromise(function(_0x5f5352,_0x3505c0){try{if(_0x32119c[_0x303cd8['id']]){_0x303cd8[_0xc41f('0x2e')]=_[_0xc41f('0x2f')](_0x32119c[_0x303cd8['id']],function(_0xd82afc){return{'id':_0xd82afc['id'],'fullname':_0xd82afc[_0xc41f('0x30')]};});}}catch(_0x3bb2e9){_0x3505c0(_0x3bb2e9);}_0x5f5352(_0x303cd8);});}function getInteractionTags(_0x3aab17,_0x2752c0){return new BPromise(function(_0x2afb71,_0x64b9f5){try{if(_0x3aab17[_0xc41f('0x31')]){_0x3aab17['Tags']=[];_0x3aab17['TagIds'][_0xc41f('0x32')](',')[_0xc41f('0x33')](function(_0x7b9beb){_0x3aab17['Tags'][_0xc41f('0x34')](_0x2752c0[_0x7b9beb]);});}delete _0x3aab17[_0xc41f('0x31')];}catch(_0xcf05e7){_0x64b9f5(_0xcf05e7);}_0x2afb71(_0x3aab17);});}function updateOpenchannelInteraction(_0x45d685,_0x238140,_0x4359bc){return new BPromise(function(_0x191fbb,_0x101e53){return getInteractionUsers(_0x45d685,_0x4359bc)[_0xc41f('0x27')](function(_0x19b7ab){return getInteractionTags(_0x19b7ab,_0x238140);})[_0xc41f('0x27')](function(_0x474dd5){_0x191fbb(_0x474dd5);})['catch'](function(_0x3ad7d3){_0x101e53(_0x3ad7d3);});});}exports[_0xc41f('0x35')]=function(_0x3923ca,_0x34ce9a){var _0x5dd0bc={},_0xaafe14={},_0x2bf8a6={'count':0x0,'rows':[]};var _0x27ec2c=_[_0xc41f('0x2f')](db[_0xc41f('0x36')][_0xc41f('0x37')],function(_0x2b61d2){return{'name':_0x2b61d2[_0xc41f('0x38')],'type':_0x2b61d2['type'][_0xc41f('0x39')]};});_0xaafe14[_0xc41f('0x3a')]=_[_0xc41f('0x2f')](_0x27ec2c,_0xc41f('0x2c'));_0xaafe14[_0xc41f('0x3b')]=_[_0xc41f('0x3c')](_0x3923ca['query']);_0xaafe14[_0xc41f('0x3d')]=_[_0xc41f('0x3e')](_0xaafe14['model'],_0xaafe14[_0xc41f('0x3b')]);_0x5dd0bc[_0xc41f('0x3f')]=_[_0xc41f('0x3e')](_0xaafe14[_0xc41f('0x3a')],qs[_0xc41f('0x40')](_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x40')]));_0x5dd0bc[_0xc41f('0x3f')]=_0x5dd0bc[_0xc41f('0x3f')][_0xc41f('0x41')]?_0x5dd0bc[_0xc41f('0x3f')]:_0xaafe14[_0xc41f('0x3a')];if(!_0x3923ca['query'][_0xc41f('0x42')](_0xc41f('0x43'))){_0x5dd0bc[_0xc41f('0x22')]=qs[_0xc41f('0x22')](_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x22')]);_0x5dd0bc['offset']=qs[_0xc41f('0x44')](_0x3923ca[_0xc41f('0x3b')]['offset']);}_0x5dd0bc[_0xc41f('0x45')]=qs[_0xc41f('0x46')](_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x46')]);_0x5dd0bc['where']=qs[_0xc41f('0x3d')](_[_0xc41f('0x47')](_0x3923ca[_0xc41f('0x3b')],_0xaafe14[_0xc41f('0x3d')]),_0x27ec2c);var _0x40589f=[];var _0x13e1ad=squel[_0xc41f('0x48')]()[_0xc41f('0x49')]('id')['field'](_0xc41f('0x2c'))[_0xc41f('0x49')]('color')['from'](_0xc41f('0x4a'));var _0x3a1221=squel[_0xc41f('0x48')]()[_0xc41f('0x49')](_0xc41f('0x4b'))[_0xc41f('0x49')]('u.fullname')[_0xc41f('0x49')](_0xc41f('0x4c'))['from'](_0xc41f('0x4d'),'ui')[_0xc41f('0x4e')](_0xc41f('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x413068=squel[_0xc41f('0x48')]()[_0xc41f('0x50')](_0xc41f('0x51'),'i')[_0xc41f('0x4e')](_0xc41f('0x52'),'c',_0xc41f('0x53'))['left_join']('users','o',_0xc41f('0x54'))[_0xc41f('0x4e')]('openchannel_accounts','a',_0xc41f('0x55'))['left_join'](_0xc41f('0x56'),'me',_0xc41f('0x57'))[_0xc41f('0x4e')](_0xc41f('0x58'),'it',_0xc41f('0x59'))[_0xc41f('0x4e')](_0xc41f('0x4a'),'t',_0xc41f('0x5a'));var _0x193d9f=squel['expr']();var _0x578f9c=[];var _0x48b815=squel['expr']();var _0x140572;if(_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x5b')]){_0x140572=as[_0xc41f('0x5c')](_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x5b')]);var _0x4d0aea=_0x140572[_0xc41f('0x5d')];for(var _0x5a42c3=0x0;_0x5a42c3<_0x140572[_0xc41f('0x5e')][_0xc41f('0x41')];_0x5a42c3++){var _0x39c274=_0x140572[_0xc41f('0x5e')][_0x5a42c3];var _0xfa14d4='i';var _0x5086c0=_[_0xc41f('0x5f')](_0x27ec2c,['name',_0x39c274['field']]);if(!_0x5086c0){switch(_0x39c274[_0xc41f('0x49')]){case _0xc41f('0x60'):if(_0x39c274[_0xc41f('0x61')]==0x1){_0x413068[_0xc41f('0x62')]('`'+_0x39c274['field']+_0xc41f('0x63'));}else{_0x413068['having']('`'+_0x39c274[_0xc41f('0x49')]+_0xc41f('0x64'));}break;case _0xc41f('0x65'):if(_0x39c274['operator']==='$substring'){if(_0x39c274[_0xc41f('0x61')][_0xc41f('0x32')]('\x20')[_0xc41f('0x41')]>0x1){_0x193d9f[_0x4d0aea]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x39c274[_0xc41f('0x61')]),null);}else{var _0x56fbec='%'+_0x39c274[_0xc41f('0x61')]+'%';_0x193d9f[_0x4d0aea](_0xc41f('0x66'),_0x56fbec,_0x56fbec,_0x56fbec);}}else{_0x5086c0=_[_0xc41f('0x5f')](_0x27ec2c,[_0xc41f('0x2c'),_0xc41f('0x67')]);_0x39c274['field']=_0xc41f('0x67');_0x5dc318=as[_0xc41f('0x68')](_0xfa14d4,_0x5086c0[_0xc41f('0x69')],_0x39c274);_0x193d9f[_0x4d0aea](_0x5dc318['text'],_0x5dc318['value']['start'],_0x5dc318[_0xc41f('0x61')][_0xc41f('0x1f')]);}break;case'Tag':var _0x215a52=_0x39c274[_0xc41f('0x61')][_0xc41f('0x32')](',')[_0xc41f('0x2f')](function(_0x357789){return Number(_0x357789);});_0x215a52[_0xc41f('0x33')](function(_0x3830e2){_0x48b815['or'](_0xc41f('0x6a'),'%,'+_0x3830e2+',%');});_0x578f9c=_[_0xc41f('0x6b')](_0x578f9c,_0x215a52);break;case _0xc41f('0x6c'):if(_0x39c274['operator']===_0xc41f('0x6d')){_0x193d9f[_0x4d0aea](_0xc41f('0x6e'),'%'+_0x39c274[_0xc41f('0x61')]+'%',null);}else{_0x5086c0=_['find'](_0x27ec2c,[_0xc41f('0x2c'),_0xc41f('0x6f')]);_0x39c274['field']=_0xc41f('0x6f');_0x5dc318=as['buildExpression'](_0xfa14d4,_0x5086c0[_0xc41f('0x69')],_0x39c274);_0x193d9f[_0x4d0aea](_0x5dc318[_0xc41f('0x70')],_0x5dc318[_0xc41f('0x61')][_0xc41f('0x71')],_0x5dc318['value'][_0xc41f('0x1f')]);}break;case'body':_0x5dc318=as[_0xc41f('0x68')]('me',null,_0x39c274);_0x193d9f[_0x4d0aea](_0x5dc318[_0xc41f('0x70')],_0x5dc318[_0xc41f('0x61')]['start'],_0x5dc318[_0xc41f('0x61')]['end']);break;}}else{var _0x5dc318=as[_0xc41f('0x68')](_0xfa14d4,_0x5086c0['type'],_0x39c274);_0x193d9f[_0x4d0aea](_0x5dc318[_0xc41f('0x70')],_0x5dc318[_0xc41f('0x61')][_0xc41f('0x71')],_0x5dc318['value'][_0xc41f('0x1f')]);}}}else{var _0x149f2c=_(_0x3923ca[_0xc41f('0x3b')])[_0xc41f('0x3c')]()['map'](function(_0x2129f5){return _['some'](_0x27ec2c,['name',_0x2129f5])?_0x2129f5:undefined;})['compact']()[_0xc41f('0x61')]();if(!_['isEmpty'](_0x149f2c)){_0x149f2c['forEach'](function(_0x1da473){if(_0x1da473==='OpenchannelAccountId'){_0x413068['where'](_0xc41f('0x72'),[][_0xc41f('0x73')](_0x3923ca[_0xc41f('0x3b')][_0x1da473]));}else if(_0x1da473===_0xc41f('0x74')){var _0x27b28a=JSON[_0xc41f('0x75')](_0x3923ca[_0xc41f('0x3b')][_0x1da473])[_0xc41f('0x76')];var _0x5e3f49=JSON[_0xc41f('0x75')](_0x3923ca['query'][_0x1da473])[_0xc41f('0x77')];_0x413068[_0xc41f('0x78')](_0xc41f('0x79'),_0x27b28a,_0x5e3f49);}else{if(_0x3923ca[_0xc41f('0x3b')][_0x1da473]===_0xc41f('0x7a')){_0x413068['where']('i.'+_0x1da473+_0xc41f('0x7b'));}else{_0x413068['where']('i.'+_0x1da473+_0xc41f('0x7c'),_0x3923ca['query'][_0x1da473]);}}});}if(_0x3923ca['query'][_0xc41f('0x7d')]){if(_0x3923ca[_0xc41f('0x3b')]['read']==0x1){_0x413068['having'](_0xc41f('0x7e'));}else{_0x413068[_0xc41f('0x62')](_0xc41f('0x7f'));}}if(_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x80')]){_0x578f9c=_[_0xc41f('0x81')](_0x3923ca[_0xc41f('0x3b')]['tag'])?_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x80')]:new Array(_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x80')]);_0x578f9c[_0xc41f('0x33')](function(_0x17bb30){_0x48b815['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x17bb30+',%');});}if(_0x3923ca[_0xc41f('0x3b')]['filter']){var _0x4fd2d1=_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x82')]['replace']('\x5c','\x5c\x5c')[_0xc41f('0x83')]('\x27\x27',_0xc41f('0x84'));if(qs[_0xc41f('0x85')](_0x4fd2d1)){_0x193d9f['or']('i.id\x20LIKE\x20?',_0x4fd2d1+'%');}else{_0x193d9f['or'](_0xc41f('0x86'),qs[_0xc41f('0x87')](_0x4fd2d1))['or'](_0xc41f('0x88'),_0x4fd2d1+'%')['or'](_0xc41f('0x89'),_0x4fd2d1+'%');}}}_0x413068[_0xc41f('0x78')](_0x193d9f);_0x413068[_0xc41f('0x8a')]('i.id');var _0x5e7c87={'type':db['Sequelize']['QueryTypes'][_0xc41f('0x8b')],'raw':!![]};var _0x1200f8=_0x413068['clone']();_0x1200f8[_0xc41f('0x49')](_0xc41f('0x8c'));_0x1200f8[_0xc41f('0x49')](_0xc41f('0x8d'),_0xc41f('0x60'));if(_0x5dd0bc['order']){_0x5dd0bc[_0xc41f('0x45')]['forEach'](function(_0x110667){_0x413068[_0xc41f('0x45')]('i.'+_0x110667[0x0],_0x110667[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x578f9c)){_0x413068['having'](_0x48b815);_0x1200f8[_0xc41f('0x78')]('t.id\x20IN\x20?',_0x578f9c);}BPromise[_0xc41f('0x8e')]()[_0xc41f('0x27')](function(){if(!_0x140572){if(_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x8f')]||_0x3923ca[_0xc41f('0x3b')][_0xc41f('0x90')])return;_0x1200f8[_0xc41f('0x78')](_0xc41f('0x91'));_0x413068[_0xc41f('0x78')](_0xc41f('0x91'));return;}return _0x3923ca[_0xc41f('0x92')][_0xc41f('0x93')]({'attributes':['id'],'raw':!![]})[_0xc41f('0x27')](function(_0x3f8258){if(_[_0xc41f('0x94')](_0x3f8258)){_0x1200f8[_0xc41f('0x78')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x413068[_0xc41f('0x78')](_0xc41f('0x95'));}else{_0x1200f8[_0xc41f('0x78')](_0xc41f('0x72'),_[_0xc41f('0x2f')](_0x3f8258,'id'));_0x413068[_0xc41f('0x78')](_0xc41f('0x72'),_[_0xc41f('0x2f')](_0x3f8258,'id'));}});})[_0xc41f('0x27')](function(){db['sequelize']['query'](_0x1200f8[_0xc41f('0x96')](),_0x5e7c87)[_0xc41f('0x27')](function(_0x28003f){_0x2bf8a6[_0xc41f('0x21')]=_0x28003f['length'];if(_0x2bf8a6[_0xc41f('0x21')]===0x0)return[];return db[_0xc41f('0x97')][_0xc41f('0x3b')](_0x13e1ad[_0xc41f('0x96')](),_0x5e7c87)[_0xc41f('0x27')](function(_0x5eecc4){_0x40589f=_[_0xc41f('0x98')](_0x5eecc4,'id');_0x5e7c87=_['merge'](_0x5e7c87,{'model':db[_0xc41f('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3923ca[_0xc41f('0x3b')]['fields']){_0x5dd0bc[_0xc41f('0x3f')]['forEach'](function(_0x3d8e3e){_0x413068[_0xc41f('0x49')]('i.'+_0x3d8e3e);});}else{_0x413068[_0xc41f('0x49')](_0xc41f('0x8d'),_0xc41f('0x60'));_0x413068['field'](_0xc41f('0x99'),'Account.key');_0x413068[_0xc41f('0x49')](_0xc41f('0x9a'),_0xc41f('0x9b'));_0x413068['field'](_0xc41f('0x9c'));_0x413068[_0xc41f('0x49')]('c.firstName',_0xc41f('0x9d'));_0x413068[_0xc41f('0x49')]('c.lastName',_0xc41f('0x9e'));_0x413068[_0xc41f('0x49')](_0xc41f('0x9f'),_0xc41f('0xa0'));_0x413068[_0xc41f('0x49')]('c.phone',_0xc41f('0xa1'));_0x413068[_0xc41f('0x49')](_0xc41f('0xa2'),_0xc41f('0xa3'));_0x413068[_0xc41f('0x49')](_0xc41f('0xa4'),'Contact.fax');_0x413068[_0xc41f('0x49')](_0xc41f('0xa5'),_0xc41f('0xa6'));_0x413068[_0xc41f('0x49')](_0xc41f('0xa7'),_0xc41f('0xa8'));_0x413068[_0xc41f('0x49')](_0xc41f('0xa9'),'TagIds');}if(_0x5dd0bc[_0xc41f('0x22')])_0x413068['limit'](_0x5dd0bc[_0xc41f('0x22')]);if(_0x5dd0bc[_0xc41f('0x44')])_0x413068[_0xc41f('0x44')](_0x5dd0bc[_0xc41f('0x44')]);return db[_0xc41f('0x97')]['query'](_0x413068[_0xc41f('0x96')](),_0x5e7c87);})['then'](function(_0x469f0a){_0x3a1221[_0xc41f('0x78')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x469f0a,'id'));return db[_0xc41f('0x97')][_0xc41f('0x3b')](_0x3a1221[_0xc41f('0x96')](),_0x5e7c87)[_0xc41f('0x27')](function(_0x27b7b2){var _0x233ad6=_['groupBy'](_0x27b7b2,'OpenchannelInteractionId');var _0x144a37=[];_0x469f0a[_0xc41f('0x33')](function(_0x4e27cd){_0x144a37[_0xc41f('0x34')](updateOpenchannelInteraction(_0x4e27cd,_0x40589f,_0x233ad6));});return BPromise[_0xc41f('0xaa')](_0x144a37);});});})[_0xc41f('0x27')](function(_0x69b8d){_0x2bf8a6[_0xc41f('0xab')]=_0x69b8d;return _0x2bf8a6;})['then'](respondWithFilteredResult(_0x34ce9a,_0x5dd0bc));})['catch'](handleError(_0x34ce9a,null));};exports[_0xc41f('0xac')]=function(_0x2d458e,_0x43b996){var _0x5cdd90={'raw':![],'where':{'id':_0x2d458e[_0xc41f('0xad')]['id']}},_0x391bd6={};_0x391bd6[_0xc41f('0x3a')]=_['keys'](db[_0xc41f('0x36')][_0xc41f('0x37')]);_0x391bd6[_0xc41f('0x3b')]=_[_0xc41f('0x3c')](_0x2d458e[_0xc41f('0x3b')]);_0x391bd6['filters']=_[_0xc41f('0x3e')](_0x391bd6[_0xc41f('0x3a')],_0x391bd6[_0xc41f('0x3b')]);_0x5cdd90[_0xc41f('0x3f')]=_['intersection'](_0x391bd6['model'],qs[_0xc41f('0x40')](_0x2d458e[_0xc41f('0x3b')][_0xc41f('0x40')]));_0x5cdd90[_0xc41f('0x3f')]=_0x5cdd90[_0xc41f('0x3f')][_0xc41f('0x41')]?_0x5cdd90[_0xc41f('0x3f')]:_0x391bd6[_0xc41f('0x3a')];if(_0x2d458e[_0xc41f('0x3b')]['includeAll']){_0x5cdd90[_0xc41f('0xae')]=[{'all':!![]}];}_0x5cdd90=_[_0xc41f('0xaf')]({},_0x5cdd90,_0x2d458e[_0xc41f('0xb0')]);return db['OpenchannelInteraction']['find'](_0x5cdd90)[_0xc41f('0x27')](handleEntityNotFound(_0x43b996,null))['then'](respondWithResult(_0x43b996,null))[_0xc41f('0xb1')](handleError(_0x43b996,null));};exports[_0xc41f('0xb2')]=function(_0x317318,_0x2bcd06){return db['OpenchannelInteraction'][_0xc41f('0xb2')](_0x317318[_0xc41f('0xb3')],{})[_0xc41f('0x27')](respondWithResult(_0x2bcd06,0xc9))[_0xc41f('0xb1')](handleError(_0x2bcd06,null));};exports['update']=function(_0x54975f,_0x28bcfe){if(_0x54975f[_0xc41f('0xb3')]['id']){delete _0x54975f[_0xc41f('0xb3')]['id'];}return db[_0xc41f('0x36')]['find']({'where':{'id':_0x54975f[_0xc41f('0xad')]['id']}})[_0xc41f('0x27')](handleEntityNotFound(_0x28bcfe,null))[_0xc41f('0x27')](saveUpdates(_0x54975f[_0xc41f('0xb3')],null))[_0xc41f('0x27')](respondWithResult(_0x28bcfe,null))[_0xc41f('0xb1')](handleError(_0x28bcfe,null));};exports[_0xc41f('0x28')]=function(_0x4ac0b8,_0x2f57ba){return db[_0xc41f('0x36')][_0xc41f('0x5f')]({'where':{'id':_0x4ac0b8[_0xc41f('0xad')]['id']}})[_0xc41f('0x27')](handleEntityNotFound(_0x2f57ba,null))[_0xc41f('0x27')](removeEntity(_0x2f57ba,null))['catch'](handleError(_0x2f57ba,null));};exports[_0xc41f('0xb4')]=function(_0x4910f2,_0x110c80){return db['OpenchannelInteraction']['describe']()[_0xc41f('0x27')](respondWithResult(_0x110c80,null))[_0xc41f('0xb1')](handleError(_0x110c80,null));};exports[_0xc41f('0xb5')]=function(_0x1b95e6,_0x1dc838,_0x12bbb9){return db[_0xc41f('0xb6')][_0xc41f('0x5f')]({'where':{'id':_0x1b95e6[_0xc41f('0xad')]['id']}})['then'](handleEntityNotFound(_0x1dc838,null))[_0xc41f('0x27')](function(_0x263a0b){if(_0x263a0b){return _0x263a0b[_0xc41f('0xb5')](_0x1b95e6['body'][_0xc41f('0xb7')],_[_0xc41f('0xb8')](_0x1b95e6[_0xc41f('0xb3')],[_0xc41f('0xb7'),'id'])||{});}})[_0xc41f('0x27')](respondWithResult(_0x1dc838,null))[_0xc41f('0xb1')](handleError(_0x1dc838,null));};exports[_0xc41f('0xb9')]=function(_0x4d0b42,_0x1da1ca,_0x42c073){var _0x3150a2={'raw':![],'where':{}};var _0x10b663={};var _0x3a3bfd={'count':0x0,'rows':[]};return db[_0xc41f('0x36')][_0xc41f('0xba')]({'where':{'id':_0x4d0b42['params']['id']}})[_0xc41f('0x27')](handleEntityNotFound(_0x1da1ca,null))[_0xc41f('0x27')](function(_0x2875c4){if(_0x2875c4){_0x10b663[_0xc41f('0x3a')]=_[_0xc41f('0x3c')](db[_0xc41f('0xb6')][_0xc41f('0x37')]);_0x10b663[_0xc41f('0x3b')]=_['keys'](_0x4d0b42['query']);_0x10b663[_0xc41f('0x3d')]=_['intersection'](_0x10b663[_0xc41f('0x3a')],_0x10b663['query']);_0x3150a2[_0xc41f('0x3f')]=_[_0xc41f('0x3e')](_0x10b663['model'],qs[_0xc41f('0x40')](_0x4d0b42[_0xc41f('0x3b')][_0xc41f('0x40')]));_0x3150a2[_0xc41f('0x3f')]=_0x3150a2[_0xc41f('0x3f')][_0xc41f('0x41')]?_0x3150a2[_0xc41f('0x3f')]:_0x10b663[_0xc41f('0x3a')];if(!_0x4d0b42[_0xc41f('0x3b')]['hasOwnProperty'](_0xc41f('0x43'))){_0x3150a2[_0xc41f('0x22')]=qs['limit'](_0x4d0b42[_0xc41f('0x3b')][_0xc41f('0x22')]);_0x3150a2[_0xc41f('0x44')]=qs['offset'](_0x4d0b42['query'][_0xc41f('0x44')]);}_0x3150a2[_0xc41f('0x45')]=qs[_0xc41f('0x46')](_0x4d0b42[_0xc41f('0x3b')]['sort']);_0x3150a2[_0xc41f('0x78')]=qs[_0xc41f('0x3d')](_['pick'](_0x4d0b42[_0xc41f('0x3b')],_0x10b663[_0xc41f('0x3d')]));_0x3150a2[_0xc41f('0x78')][_0xc41f('0xbb')]=_0x2875c4['id'];if(_0x4d0b42[_0xc41f('0x3b')][_0xc41f('0x82')]){_0x3150a2[_0xc41f('0x78')]=_[_0xc41f('0xaf')](_0x3150a2[_0xc41f('0x78')],{'$or':_[_0xc41f('0x2f')](_0x3150a2[_0xc41f('0x3f')],function(_0x284e80){var _0x15d263={};_0x15d263[_0x284e80]={'$like':'%'+_0x4d0b42[_0xc41f('0x3b')]['filter']+'%'};return _0x15d263;})});}if(_0x4d0b42[_0xc41f('0x3b')]['$gte']){var _0xadc607=_0x4d0b42[_0xc41f('0x3b')][_0xc41f('0x76')][_0xc41f('0x32')](',');var _0x3008da={};_0x3008da[_0xadc607[0x0]]={'$gte':moment(_0xadc607[0x1])[_0xc41f('0xbc')](_0xc41f('0xbd'))};_0x3150a2['where']=_[_0xc41f('0xaf')](_0x3150a2['where'],_0x3008da);}_0x3150a2=_[_0xc41f('0xaf')]({},_0x3150a2,_0x4d0b42[_0xc41f('0xb0')]);return db[_0xc41f('0xb6')][_0xc41f('0x21')]({'where':_0x3150a2[_0xc41f('0x78')]})['then'](function(_0x454c24){_0x3a3bfd[_0xc41f('0x21')]=_0x454c24;if(_0x4d0b42[_0xc41f('0x3b')][_0xc41f('0xbe')]){_0x3150a2[_0xc41f('0xae')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc41f('0xbf')](_0x3150a2);})[_0xc41f('0x27')](function(_0x41ff6f){_0x3a3bfd['rows']=_0x41ff6f;return _0x3a3bfd;});}})[_0xc41f('0x27')](respondWithFilteredResult(_0x1da1ca,_0x3150a2))[_0xc41f('0xb1')](handleError(_0x1da1ca,null));};exports[_0xc41f('0xc0')]=function(_0x7abeec,_0x2b5e65,_0x18f28a){return db[_0xc41f('0x36')][_0xc41f('0x5f')]({'where':{'id':_0x7abeec[_0xc41f('0xad')]['id']}})[_0xc41f('0x27')](handleEntityNotFound(_0x2b5e65,null))[_0xc41f('0x27')](function(_0x32ed85){if(_0x32ed85){return _0x32ed85[_0xc41f('0xc1')](_0x7abeec[_0xc41f('0xb3')][_0xc41f('0xb7')],_[_0xc41f('0xb8')](_0x7abeec['body'],['ids','id'])||{})[_0xc41f('0xc2')](function(){return db[_0xc41f('0xc3')][_0xc41f('0xbf')]({'attributes':['id',_0xc41f('0x2c'),'color'],'where':{'id':_0x7abeec[_0xc41f('0xb3')][_0xc41f('0xb7')]}});})['then'](function(_0x474a86){socket[_0xc41f('0xc4')](_0xc41f('0xc5'),{'id':Number(_0x7abeec['params']['id']),'tags':_0x474a86||[]});return{'id':Number(_0x7abeec[_0xc41f('0xad')]['id']),'tags':_0x474a86||[]};});}})[_0xc41f('0x27')](respondWithResult(_0x2b5e65,null))[_0xc41f('0xb1')](handleError(_0x2b5e65,null));};exports['removeTags']=function(_0x366f97,_0x233dda,_0x2c8180){return db[_0xc41f('0x36')][_0xc41f('0x5f')]({'where':{'id':_0x366f97[_0xc41f('0xad')]['id']}})[_0xc41f('0x27')](handleEntityNotFound(_0x233dda,null))[_0xc41f('0x27')](function(_0x348560){if(_0x348560){return _0x348560[_0xc41f('0xc6')](_0x366f97[_0xc41f('0x3b')]['ids']);}})[_0xc41f('0x27')](respondWithStatusCode(_0x233dda,null))[_0xc41f('0xb1')](handleError(_0x233dda,null));};exports[_0xc41f('0xc7')]=function(_0xd256f5,_0x40d6f0){var _0x5a5f98=moment()['unix']()[_0xc41f('0x96')]();var _0x27a87b=path['join'](config['root'],_0xc41f('0xc8'),'files',_0xc41f('0xc9'));var _0x12a711=path[_0xc41f('0xca')](config[_0xc41f('0xcb')],_0xc41f('0xc8'),'files',_0xc41f('0xcc'));var _0x5c0e48=path['join'](_0x27a87b,_0x5a5f98);var _0xadb874=util[_0xc41f('0xbc')](_0xc41f('0xcd'),_0xd256f5[_0xc41f('0xad')]['id'],_0x5a5f98);var _0x2f949e=path[_0xc41f('0xca')](_0x27a87b,_0xadb874);var _0x31aa05=[];_0x31aa05[_0xc41f('0x34')]({'model':db[_0xc41f('0x6c')],'as':_0xc41f('0x6c'),'attributes':['id','fullname'],'raw':!![]});_0x31aa05[_0xc41f('0x34')]({'model':db['CmContact'],'as':_0xc41f('0x65'),'attributes':['id',_0xc41f('0xce'),_0xc41f('0xcf')],'raw':!![]});if(_0xd256f5[_0xc41f('0x3b')][_0xc41f('0xcc')]){_0x31aa05[_0xc41f('0x34')]({'model':db[_0xc41f('0xd0')],'as':_0xc41f('0xd0'),'raw':!![]});}var _0x1aa55f=[{'model':db['OpenchannelMessage'],'as':_0xc41f('0xd1'),'attributes':['id',_0xc41f('0xb3'),'createdAt',_0xc41f('0xd2'),_0xc41f('0xd3'),_0xc41f('0x7d')],'include':_0x31aa05}];_0x1aa55f[_0xc41f('0x34')]({'model':db[_0xc41f('0xd4')],'as':_0xc41f('0xd5'),'attributes':['id','name']});_0x1aa55f[_0xc41f('0x34')]({'model':db[_0xc41f('0x6c')],'as':_0xc41f('0xd6'),'attributes':['id',_0xc41f('0x30')]});return db[_0xc41f('0x36')][_0xc41f('0x5f')]({'where':{'id':_0xd256f5['params']['id']},'include':_0x1aa55f})[_0xc41f('0x27')](handleEntityNotFound(_0x40d6f0,null))[_0xc41f('0x27')](function(_0x36607e){if(_0x36607e){var _0xff7fa6=_0x36607e[_0xc41f('0xd7')]({'plain':!![]});fs[_0xc41f('0xd8')](_0x5c0e48);var _0x41c508={'format':'A4','border':_0xc41f('0xd9'),'header':{'height':_0xc41f('0xda'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0xc41f('0xdb'),'contents':{'default':util['format'](_0xc41f('0xdc'),util[_0xc41f('0xbc')]('%s\x20#%d',_0xc41f('0xdd'),_0xff7fa6['id']),moment()[_0xc41f('0xbc')](_0xc41f('0xde'))[_0xc41f('0x96')]())}}};var _0x805a10={'channel':_0xc41f('0xdd'),'account':_0xff7fa6[_0xc41f('0xd5')]['name'],'agent':_0xff7fa6['Owner']?_0xff7fa6[_0xc41f('0xd6')]['fullname']:_0xc41f('0xdf'),'createdAt':moment(_0xff7fa6[_0xc41f('0x74')])[_0xc41f('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0xff7fa6['closed']?moment(_0xff7fa6[_0xc41f('0xe0')])['format'](_0xc41f('0xbd'))[_0xc41f('0x96')]():'','disposition':_0xff7fa6[_0xc41f('0xe1')],'visibility':_0xff7fa6[_0xc41f('0xe2')]?_0xc41f('0xe3'):_0xc41f('0xe4'),'messages':_(_0xff7fa6[_0xc41f('0xd1')])['filter']({'secret':![]})['map'](function(_0x26a0ea){if(_0x26a0ea[_0xc41f('0xd0')]){var _0x21907c=path[_0xc41f('0xca')](_0x12a711,_0x26a0ea[_0xc41f('0xd0')][_0xc41f('0xe5')]);if(fs[_0xc41f('0xe6')](_0x21907c)){fs[_0xc41f('0xe7')](_0x21907c)[_0xc41f('0xe8')](fs[_0xc41f('0xe9')](path[_0xc41f('0xca')](_0x5c0e48,_0x26a0ea[_0xc41f('0xd0')][_0xc41f('0xe5')])));}}return{'date':moment(_0x26a0ea[_0xc41f('0x74')])['format'](_0xc41f('0xbd'))['toString'](),'sender':_0x26a0ea[_0xc41f('0xd2')]==='out'?_0x26a0ea[_0xc41f('0x6c')]?_0x26a0ea[_0xc41f('0x6c')][_0xc41f('0x30')]:_0xc41f('0xea'):_0x26a0ea['Contact'][_0xc41f('0xce')]+(_0x26a0ea['Contact'][_0xc41f('0xcf')]?'\x20'+_0x26a0ea['Contact'][_0xc41f('0xcf')]:''),'body':_0x26a0ea['Attachment']?_0x26a0ea[_0xc41f('0xd0')][_0xc41f('0xe5')]:_0x26a0ea['body'],'direction':_0x26a0ea['direction']==='out'?'A':'C','secret':_0x26a0ea[_0xc41f('0xd3')],'read':_0x26a0ea[_0xc41f('0x7d')],'attachment':_0x26a0ea[_0xc41f('0xd0')]};})[_0xc41f('0x61')]()};return ejs[_0xc41f('0xeb')](path[_0xc41f('0xca')](config[_0xc41f('0xcb')],_0xc41f('0xc8'),'views',_0xc41f('0xec')),{'interaction':_0x805a10})[_0xc41f('0x27')](function(_0x11af4a){return new BPromise(function(_0x205859,_0x1a9391){pdf[_0xc41f('0xb2')](_0x11af4a,_0x41c508)[_0xc41f('0xed')](path[_0xc41f('0xca')](_0x5c0e48,_0xc41f('0xee')+_0xff7fa6['id']+'-'+_0x5a5f98+_0xc41f('0xef')),function(_0xc7d69a,_0x20d7fe){if(_0xc7d69a)return _0x1a9391(_0xc7d69a);_0x205859(_0x20d7fe);});});})[_0xc41f('0x27')](function(){return new BPromise(function(_0x1c70c6,_0x4c1e50){zipdir(_0x5c0e48,{'saveTo':_0x2f949e},function(_0x4f9fa2,_0x5c4a97){if(_0x4f9fa2)return _0x4c1e50(_0x4f9fa2);return _0x1c70c6(_0x5c4a97);});})[_0xc41f('0x27')](function(){return new BPromise(function(_0x1c1d0e,_0x495cee){rimraf(_0x5c0e48,function(_0x4df464){if(_0x4df464)_0x495cee(_0x4df464);return _0x1c1d0e();});});})[_0xc41f('0x27')](function(){return _0x40d6f0[_0xc41f('0xc7')](_0x2f949e,_0xadb874,function(_0x17c0f5){if(_0x17c0f5){console['log'](_0xc41f('0xf0'),_0x17c0f5);}else{fs[_0xc41f('0xf1')](_0x2f949e);}});});});}else{return _0x40d6f0[_0xc41f('0x29')](0xc8);}})['catch'](handleError(_0x40d6f0,null));}; \ No newline at end of file +var _0x0472=['TagIds','Tags','split','forEach','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','color','from','select','field','u.fullname','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','toString','ui.OpenchannelInteractionId\x20IN\x20?','push','all','rows','show','params','includeAll','include','create','destroy','describe','addMessage','omit','getMessages','findOne','OpenchannelMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','ids','spread','Tag','removeTags','download','join','files','tmp','root','User','fullname','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','toFile','transcript-','.pdf','log','err','unlinkSync','sendStatus','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','Users','map'];(function(_0x4cb44c,_0x3c6047){var _0x2b3e64=function(_0x5f5a23){while(--_0x5f5a23){_0x4cb44c['push'](_0x4cb44c['shift']());}};_0x2b3e64(++_0x3c6047);}(_0x0472,0x1ad));var _0x2047=function(_0x4c6e4f,_0x4b3339){_0x4c6e4f=_0x4c6e4f-0x0;var _0x455036=_0x0472[_0x4c6e4f];return _0x455036;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2047('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2047('0x1'));var rp=require(_0x2047('0x2'));var moment=require(_0x2047('0x3'));var BPromise=require(_0x2047('0x4'));var Mustache=require(_0x2047('0x5'));var util=require(_0x2047('0x6'));var path=require('path');var sox=require(_0x2047('0x7'));var csv=require('to-csv');var ejs=require(_0x2047('0x8'));var fs=require('fs');var _=require(_0x2047('0x9'));var squel=require(_0x2047('0xa'));var crypto=require(_0x2047('0xb'));var jsforce=require(_0x2047('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2047('0xd'));var querystring=require(_0x2047('0xe'));var Papa=require(_0x2047('0xf'));var Redis=require(_0x2047('0x10'));var authService=require(_0x2047('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2047('0x12'));var hardwareService=require(_0x2047('0x13'));var logger=require(_0x2047('0x14'))(_0x2047('0x15'));var utils=require(_0x2047('0x16'));var config=require(_0x2047('0x17'));var db=require('../../mysqldb')['db'];config[_0x2047('0x18')]=_[_0x2047('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2047('0x1a'))(new Redis(config[_0x2047('0x18')]));require(_0x2047('0x1b'))[_0x2047('0x1c')](socket);function respondWithStatusCode(_0x27dc58,_0xaa38d2){_0xaa38d2=_0xaa38d2||0xcc;return function(_0xb3bd38){if(_0xb3bd38){return _0x27dc58['sendStatus'](_0xaa38d2);}return _0x27dc58[_0x2047('0x1d')](_0xaa38d2)[_0x2047('0x1e')]();};}function respondWithResult(_0x12f937,_0x4b24c8){_0x4b24c8=_0x4b24c8||0xc8;return function(_0x628513){if(_0x628513){return _0x12f937[_0x2047('0x1d')](_0x4b24c8)['json'](_0x628513);}};}function respondWithFilteredResult(_0x5f0fec,_0x5f3d0b){return function(_0x426d6a){if(_0x426d6a){var _0x5e252b=_0x426d6a[_0x2047('0x1f')],_0x474744=_0x5f3d0b[_0x2047('0x20')],_0x80340e=_0x5f3d0b['offset']+_0x5f3d0b['limit'],_0x263bd6;if(_0x80340e>=_0x5e252b){_0x80340e=_0x5e252b;_0x263bd6=0xc8;}else{_0x263bd6=0xce;}_0x5f0fec[_0x2047('0x1d')](_0x263bd6);return _0x5f0fec[_0x2047('0x21')](_0x2047('0x22'),_0x474744+'-'+_0x80340e+'/'+_0x5e252b)['json'](_0x426d6a);}return null;};}function patchUpdates(_0x1db74d){return function(_0x2469de){try{jsonpatch[_0x2047('0x23')](_0x2469de,_0x1db74d,!![]);}catch(_0x4d028f){return BPromise[_0x2047('0x24')](_0x4d028f);}return _0x2469de[_0x2047('0x25')]();};}function saveUpdates(_0x27fb1c,_0x56a7e5){return function(_0x4a109f){if(_0x4a109f){return _0x4a109f[_0x2047('0x26')](_0x27fb1c)['then'](function(_0x171b0d){return _0x171b0d;});}return null;};}function removeEntity(_0x535db9,_0x4e533b){return function(_0x5ab4bd){if(_0x5ab4bd){return _0x5ab4bd['destroy']()[_0x2047('0x27')](function(){_0x535db9['status'](0xcc)[_0x2047('0x1e')]();});}};}function handleEntityNotFound(_0x1ffa45,_0x59e49e){return function(_0x45eb96){if(!_0x45eb96){_0x1ffa45['sendStatus'](0x194);}return _0x45eb96;};}function handleError(_0x25bebf,_0x4f6ac3){_0x4f6ac3=_0x4f6ac3||0x1f4;return function(_0x56e6a5){logger['error'](_0x56e6a5[_0x2047('0x28')]);if(_0x56e6a5[_0x2047('0x29')]){delete _0x56e6a5[_0x2047('0x29')];}_0x25bebf['status'](_0x4f6ac3)[_0x2047('0x2a')](_0x56e6a5);};}function getInteractionUsers(_0x12e538,_0x25a398){return new BPromise(function(_0x4163ca,_0x2851b4){try{if(_0x25a398[_0x12e538['id']]){_0x12e538[_0x2047('0x2b')]=_[_0x2047('0x2c')](_0x25a398[_0x12e538['id']],function(_0x94803b){return{'id':_0x94803b['id'],'fullname':_0x94803b['fullname']};});}}catch(_0x4311be){_0x2851b4(_0x4311be);}_0x4163ca(_0x12e538);});}function getInteractionTags(_0x190788,_0x4a6231){return new BPromise(function(_0x4bf3d9,_0x71217d){try{if(_0x190788[_0x2047('0x2d')]){_0x190788[_0x2047('0x2e')]=[];_0x190788[_0x2047('0x2d')][_0x2047('0x2f')](',')[_0x2047('0x30')](function(_0xf3acea){_0x190788['Tags']['push'](_0x4a6231[_0xf3acea]);});}delete _0x190788[_0x2047('0x2d')];}catch(_0x3a7f63){_0x71217d(_0x3a7f63);}_0x4bf3d9(_0x190788);});}function updateOpenchannelInteraction(_0x108941,_0x57b97f,_0x18230d){return new BPromise(function(_0x2c3964,_0x595419){return getInteractionUsers(_0x108941,_0x18230d)[_0x2047('0x27')](function(_0x42a647){return getInteractionTags(_0x42a647,_0x57b97f);})[_0x2047('0x27')](function(_0x43faa2){_0x2c3964(_0x43faa2);})[_0x2047('0x31')](function(_0x1c5244){_0x595419(_0x1c5244);});});}exports[_0x2047('0x32')]=function(_0x8e990d,_0x2ae68e){var _0x279414={},_0x305e3f={},_0x2a6db5={'count':0x0,'rows':[]};var _0x349b33=_[_0x2047('0x2c')](db[_0x2047('0x33')][_0x2047('0x34')],function(_0x47c194){return{'name':_0x47c194[_0x2047('0x35')],'type':_0x47c194[_0x2047('0x36')]['key']};});_0x305e3f[_0x2047('0x37')]=_[_0x2047('0x2c')](_0x349b33,_0x2047('0x29'));_0x305e3f[_0x2047('0x38')]=_[_0x2047('0x39')](_0x8e990d[_0x2047('0x38')]);_0x305e3f[_0x2047('0x3a')]=_[_0x2047('0x3b')](_0x305e3f[_0x2047('0x37')],_0x305e3f[_0x2047('0x38')]);_0x279414[_0x2047('0x3c')]=_['intersection'](_0x305e3f[_0x2047('0x37')],qs[_0x2047('0x3d')](_0x8e990d['query'][_0x2047('0x3d')]));_0x279414[_0x2047('0x3c')]=_0x279414[_0x2047('0x3c')][_0x2047('0x3e')]?_0x279414[_0x2047('0x3c')]:_0x305e3f[_0x2047('0x37')];if(!_0x8e990d[_0x2047('0x38')][_0x2047('0x3f')](_0x2047('0x40'))){_0x279414[_0x2047('0x41')]=qs['limit'](_0x8e990d['query']['limit']);_0x279414['offset']=qs[_0x2047('0x20')](_0x8e990d[_0x2047('0x38')][_0x2047('0x20')]);}_0x279414[_0x2047('0x42')]=qs['sort'](_0x8e990d[_0x2047('0x38')][_0x2047('0x43')]);_0x279414['where']=qs[_0x2047('0x3a')](_[_0x2047('0x44')](_0x8e990d[_0x2047('0x38')],_0x305e3f[_0x2047('0x3a')]),_0x349b33);var _0x8f4191=[];var _0x180436=squel['select']()['field']('id')['field'](_0x2047('0x29'))['field'](_0x2047('0x45'))[_0x2047('0x46')]('tools_tags');var _0x2f51e7=squel[_0x2047('0x47')]()[_0x2047('0x48')]('u.id')[_0x2047('0x48')](_0x2047('0x49'))['field'](_0x2047('0x4a'))['from']('user_has_openchannel_interactions','ui')[_0x2047('0x4b')]('users','u',_0x2047('0x4c'));var _0x7876e=squel[_0x2047('0x47')]()['from'](_0x2047('0x4d'),'i')[_0x2047('0x4b')](_0x2047('0x4e'),'c',_0x2047('0x4f'))[_0x2047('0x4b')](_0x2047('0x50'),'o',_0x2047('0x51'))[_0x2047('0x4b')](_0x2047('0x52'),'a',_0x2047('0x53'))[_0x2047('0x4b')]('openchannel_messages','me',_0x2047('0x54'))[_0x2047('0x4b')](_0x2047('0x55'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x2047('0x4b')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x36dc3d=squel['expr']();var _0x14edba=[];var _0x5cb090=squel['expr']();var _0x314404;if(_0x8e990d[_0x2047('0x38')][_0x2047('0x56')]){_0x314404=as['parseSearch'](_0x8e990d[_0x2047('0x38')][_0x2047('0x56')]);var _0x91c996=_0x314404[_0x2047('0x57')];for(var _0x5e7f66=0x0;_0x5e7f66<_0x314404['conditions']['length'];_0x5e7f66++){var _0x4f8b73=_0x314404[_0x2047('0x58')][_0x5e7f66];var _0x37f33a='i';var _0x4f1cdb=_[_0x2047('0x59')](_0x349b33,[_0x2047('0x29'),_0x4f8b73[_0x2047('0x48')]]);if(!_0x4f1cdb){switch(_0x4f8b73[_0x2047('0x48')]){case _0x2047('0x5a'):if(_0x4f8b73[_0x2047('0x5b')]==0x1){_0x7876e[_0x2047('0x5c')]('`'+_0x4f8b73[_0x2047('0x48')]+_0x2047('0x5d'));}else{_0x7876e[_0x2047('0x5c')]('`'+_0x4f8b73['field']+_0x2047('0x5e'));}break;case _0x2047('0x5f'):if(_0x4f8b73[_0x2047('0x60')]==='$substring'){if(_0x4f8b73[_0x2047('0x5b')][_0x2047('0x2f')]('\x20')[_0x2047('0x3e')]>0x1){_0x36dc3d[_0x91c996](_0x2047('0x61'),qs[_0x2047('0x62')](_0x4f8b73[_0x2047('0x5b')]),null);}else{var _0x118769='%'+_0x4f8b73[_0x2047('0x5b')]+'%';_0x36dc3d[_0x91c996](_0x2047('0x63'),_0x118769,_0x118769,_0x118769);}}else{_0x4f1cdb=_['find'](_0x349b33,[_0x2047('0x29'),_0x2047('0x64')]);_0x4f8b73[_0x2047('0x48')]=_0x2047('0x64');_0x162eb4=as['buildExpression'](_0x37f33a,_0x4f1cdb[_0x2047('0x36')],_0x4f8b73);_0x36dc3d[_0x91c996](_0x162eb4[_0x2047('0x65')],_0x162eb4[_0x2047('0x5b')][_0x2047('0x66')],_0x162eb4[_0x2047('0x5b')][_0x2047('0x1e')]);}break;case'Tag':var _0x5a3fbe=_0x4f8b73[_0x2047('0x5b')][_0x2047('0x2f')](',')[_0x2047('0x2c')](function(_0x28b6e3){return Number(_0x28b6e3);});_0x5a3fbe['forEach'](function(_0x24005f){_0x5cb090['or'](_0x2047('0x67'),'%,'+_0x24005f+',%');});_0x14edba=_['union'](_0x14edba,_0x5a3fbe);break;case'User':if(_0x4f8b73[_0x2047('0x60')]===_0x2047('0x68')){_0x36dc3d[_0x91c996](_0x2047('0x69'),'%'+_0x4f8b73[_0x2047('0x5b')]+'%',null);}else{_0x4f1cdb=_[_0x2047('0x59')](_0x349b33,['name',_0x2047('0x6a')]);_0x4f8b73[_0x2047('0x48')]=_0x2047('0x6a');_0x162eb4=as[_0x2047('0x6b')](_0x37f33a,_0x4f1cdb[_0x2047('0x36')],_0x4f8b73);_0x36dc3d[_0x91c996](_0x162eb4['text'],_0x162eb4[_0x2047('0x5b')][_0x2047('0x66')],_0x162eb4[_0x2047('0x5b')][_0x2047('0x1e')]);}break;case _0x2047('0x6c'):_0x162eb4=as[_0x2047('0x6b')]('me',null,_0x4f8b73);_0x36dc3d[_0x91c996](_0x162eb4[_0x2047('0x65')],_0x162eb4[_0x2047('0x5b')][_0x2047('0x66')],_0x162eb4['value']['end']);break;}}else{var _0x162eb4=as[_0x2047('0x6b')](_0x37f33a,_0x4f1cdb[_0x2047('0x36')],_0x4f8b73);_0x36dc3d[_0x91c996](_0x162eb4['text'],_0x162eb4[_0x2047('0x5b')][_0x2047('0x66')],_0x162eb4[_0x2047('0x5b')][_0x2047('0x1e')]);}}}else{var _0x4790a5=_(_0x8e990d[_0x2047('0x38')])[_0x2047('0x39')]()['map'](function(_0x139efd){return _[_0x2047('0x6d')](_0x349b33,[_0x2047('0x29'),_0x139efd])?_0x139efd:undefined;})[_0x2047('0x6e')]()[_0x2047('0x5b')]();if(!_[_0x2047('0x6f')](_0x4790a5)){_0x4790a5[_0x2047('0x30')](function(_0x529d9b){if(_0x529d9b==='OpenchannelAccountId'){_0x7876e['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x2047('0x70')](_0x8e990d['query'][_0x529d9b]));}else if(_0x529d9b==='createdAt'){var _0x392eff=JSON[_0x2047('0x71')](_0x8e990d[_0x2047('0x38')][_0x529d9b])['$gte'];var _0x50cc7f=JSON[_0x2047('0x71')](_0x8e990d[_0x2047('0x38')][_0x529d9b])[_0x2047('0x72')];_0x7876e['where'](_0x2047('0x73'),_0x392eff,_0x50cc7f);}else{if(_0x8e990d[_0x2047('0x38')][_0x529d9b]===_0x2047('0x74')){_0x7876e[_0x2047('0x75')]('i.'+_0x529d9b+'\x20IS\x20NULL');}else{_0x7876e[_0x2047('0x75')]('i.'+_0x529d9b+'\x20=\x20?',_0x8e990d['query'][_0x529d9b]);}}});}if(_0x8e990d[_0x2047('0x38')][_0x2047('0x76')]){if(_0x8e990d[_0x2047('0x38')][_0x2047('0x76')]==0x1){_0x7876e[_0x2047('0x5c')](_0x2047('0x77'));}else{_0x7876e['having'](_0x2047('0x78'));}}if(_0x8e990d[_0x2047('0x38')][_0x2047('0x79')]){_0x14edba=_[_0x2047('0x7a')](_0x8e990d[_0x2047('0x38')][_0x2047('0x79')])?_0x8e990d[_0x2047('0x38')]['tag']:new Array(_0x8e990d[_0x2047('0x38')][_0x2047('0x79')]);_0x14edba[_0x2047('0x30')](function(_0x16c856){_0x5cb090['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x16c856+',%');});}if(_0x8e990d['query'][_0x2047('0x7b')]){var _0x4cb718=_0x8e990d[_0x2047('0x38')][_0x2047('0x7b')][_0x2047('0x7c')]('\x5c','\x5c\x5c')[_0x2047('0x7c')]('\x27\x27',_0x2047('0x7d'));if(qs[_0x2047('0x7e')](_0x4cb718)){_0x36dc3d['or'](_0x2047('0x7f'),_0x4cb718+'%');}else{_0x36dc3d['or'](_0x2047('0x80'),qs[_0x2047('0x62')](_0x4cb718))['or']('i.from\x20LIKE\x20?',_0x4cb718+'%')['or'](_0x2047('0x81'),_0x4cb718+'%');}}}_0x7876e[_0x2047('0x75')](_0x36dc3d);_0x7876e[_0x2047('0x82')](_0x2047('0x83'));var _0x121646={'type':db['Sequelize'][_0x2047('0x84')][_0x2047('0x85')],'raw':!![]};var _0x215a39=_0x7876e[_0x2047('0x86')]();_0x215a39[_0x2047('0x48')]('i.id');_0x215a39['field'](_0x2047('0x87'),'unreadMessages');if(_0x279414[_0x2047('0x42')]){_0x279414[_0x2047('0x42')][_0x2047('0x30')](function(_0x8f2b12){_0x7876e[_0x2047('0x42')]('i.'+_0x8f2b12[0x0],_0x8f2b12[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2047('0x6f')](_0x14edba)){_0x7876e['having'](_0x5cb090);_0x215a39[_0x2047('0x75')]('t.id\x20IN\x20?',_0x14edba);}BPromise['resolve']()[_0x2047('0x27')](function(){if(!_0x314404){if(_0x8e990d[_0x2047('0x38')][_0x2047('0x88')]||_0x8e990d[_0x2047('0x38')]['journey'])return;_0x215a39[_0x2047('0x75')](_0x2047('0x89'));_0x7876e[_0x2047('0x75')](_0x2047('0x89'));return;}return _0x8e990d[_0x2047('0x8a')][_0x2047('0x8b')]({'attributes':['id'],'raw':!![]})[_0x2047('0x27')](function(_0x46dda5){if(_[_0x2047('0x6f')](_0x46dda5)){_0x215a39[_0x2047('0x75')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x7876e[_0x2047('0x75')](_0x2047('0x8c'));}else{_0x215a39['where'](_0x2047('0x8d'),_[_0x2047('0x2c')](_0x46dda5,'id'));_0x7876e['where'](_0x2047('0x8d'),_['map'](_0x46dda5,'id'));}});})[_0x2047('0x27')](function(){db[_0x2047('0x8e')][_0x2047('0x38')](_0x215a39['toString'](),_0x121646)['then'](function(_0x3659b8){_0x2a6db5[_0x2047('0x1f')]=_0x3659b8['length'];if(_0x2a6db5[_0x2047('0x1f')]===0x0)return[];return db[_0x2047('0x8e')][_0x2047('0x38')](_0x180436['toString'](),_0x121646)[_0x2047('0x27')](function(_0x49af49){_0x8f4191=_[_0x2047('0x8f')](_0x49af49,'id');_0x121646=_[_0x2047('0x90')](_0x121646,{'model':db[_0x2047('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8e990d['query']['fields']){_0x279414['attributes'][_0x2047('0x30')](function(_0x20f6f6){_0x7876e[_0x2047('0x48')]('i.'+_0x20f6f6);});}else{_0x7876e['field'](_0x2047('0x87'),_0x2047('0x5a'));_0x7876e[_0x2047('0x48')](_0x2047('0x91'),_0x2047('0x92'));_0x7876e['field'](_0x2047('0x93'),_0x2047('0x94'));_0x7876e['field'](_0x2047('0x95'));_0x7876e[_0x2047('0x48')](_0x2047('0x96'),_0x2047('0x97'));_0x7876e[_0x2047('0x48')](_0x2047('0x98'),_0x2047('0x99'));_0x7876e['field'](_0x2047('0x9a'),_0x2047('0x9b'));_0x7876e[_0x2047('0x48')](_0x2047('0x9c'),'Contact.phone');_0x7876e[_0x2047('0x48')](_0x2047('0x9d'),'Contact.mobile');_0x7876e['field'](_0x2047('0x9e'),_0x2047('0x9f'));_0x7876e[_0x2047('0x48')](_0x2047('0xa0'),'Owner.fullname');_0x7876e[_0x2047('0x48')]('o.internal',_0x2047('0xa1'));_0x7876e['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2047('0x2d'));}if(_0x279414[_0x2047('0x41')])_0x7876e[_0x2047('0x41')](_0x279414[_0x2047('0x41')]);if(_0x279414[_0x2047('0x20')])_0x7876e[_0x2047('0x20')](_0x279414[_0x2047('0x20')]);return db[_0x2047('0x8e')][_0x2047('0x38')](_0x7876e[_0x2047('0xa2')](),_0x121646);})['then'](function(_0x37885b){_0x2f51e7[_0x2047('0x75')](_0x2047('0xa3'),_['map'](_0x37885b,'id'));return db[_0x2047('0x8e')]['query'](_0x2f51e7[_0x2047('0xa2')](),_0x121646)[_0x2047('0x27')](function(_0x294f26){var _0x2dc9b6=_['groupBy'](_0x294f26,'OpenchannelInteractionId');var _0x57bf28=[];_0x37885b[_0x2047('0x30')](function(_0x371ce6){_0x57bf28[_0x2047('0xa4')](updateOpenchannelInteraction(_0x371ce6,_0x8f4191,_0x2dc9b6));});return BPromise[_0x2047('0xa5')](_0x57bf28);});});})[_0x2047('0x27')](function(_0x2a6531){_0x2a6db5[_0x2047('0xa6')]=_0x2a6531;return _0x2a6db5;})['then'](respondWithFilteredResult(_0x2ae68e,_0x279414));})['catch'](handleError(_0x2ae68e,null));};exports[_0x2047('0xa7')]=function(_0x5254e5,_0xb64e1){var _0x58b321={'raw':![],'where':{'id':_0x5254e5[_0x2047('0xa8')]['id']}},_0x4733f4={};_0x4733f4[_0x2047('0x37')]=_[_0x2047('0x39')](db[_0x2047('0x33')]['rawAttributes']);_0x4733f4[_0x2047('0x38')]=_[_0x2047('0x39')](_0x5254e5[_0x2047('0x38')]);_0x4733f4[_0x2047('0x3a')]=_[_0x2047('0x3b')](_0x4733f4[_0x2047('0x37')],_0x4733f4[_0x2047('0x38')]);_0x58b321[_0x2047('0x3c')]=_[_0x2047('0x3b')](_0x4733f4[_0x2047('0x37')],qs[_0x2047('0x3d')](_0x5254e5['query'][_0x2047('0x3d')]));_0x58b321[_0x2047('0x3c')]=_0x58b321['attributes'][_0x2047('0x3e')]?_0x58b321[_0x2047('0x3c')]:_0x4733f4[_0x2047('0x37')];if(_0x5254e5[_0x2047('0x38')][_0x2047('0xa9')]){_0x58b321[_0x2047('0xaa')]=[{'all':!![]}];}_0x58b321=_[_0x2047('0x90')]({},_0x58b321,_0x5254e5['options']);return db[_0x2047('0x33')]['find'](_0x58b321)[_0x2047('0x27')](handleEntityNotFound(_0xb64e1,null))[_0x2047('0x27')](respondWithResult(_0xb64e1,null))['catch'](handleError(_0xb64e1,null));};exports[_0x2047('0xab')]=function(_0x32e140,_0xef7cea){return db[_0x2047('0x33')][_0x2047('0xab')](_0x32e140[_0x2047('0x6c')],{})[_0x2047('0x27')](respondWithResult(_0xef7cea,0xc9))[_0x2047('0x31')](handleError(_0xef7cea,null));};exports['update']=function(_0x400176,_0x5f0bfa){if(_0x400176[_0x2047('0x6c')]['id']){delete _0x400176['body']['id'];}return db[_0x2047('0x33')][_0x2047('0x59')]({'where':{'id':_0x400176[_0x2047('0xa8')]['id']}})[_0x2047('0x27')](handleEntityNotFound(_0x5f0bfa,null))[_0x2047('0x27')](saveUpdates(_0x400176[_0x2047('0x6c')],null))[_0x2047('0x27')](respondWithResult(_0x5f0bfa,null))[_0x2047('0x31')](handleError(_0x5f0bfa,null));};exports[_0x2047('0xac')]=function(_0x48eaca,_0x1ba761){return db[_0x2047('0x33')][_0x2047('0x59')]({'where':{'id':_0x48eaca[_0x2047('0xa8')]['id']}})[_0x2047('0x27')](handleEntityNotFound(_0x1ba761,null))[_0x2047('0x27')](removeEntity(_0x1ba761,null))[_0x2047('0x31')](handleError(_0x1ba761,null));};exports[_0x2047('0xad')]=function(_0x566a7b,_0x9a8ad8){return db['OpenchannelInteraction']['describe']()[_0x2047('0x27')](respondWithResult(_0x9a8ad8,null))[_0x2047('0x31')](handleError(_0x9a8ad8,null));};exports[_0x2047('0xae')]=function(_0x333377,_0x532993,_0x23c736){return db['OpenchannelMessage']['find']({'where':{'id':_0x333377[_0x2047('0xa8')]['id']}})[_0x2047('0x27')](handleEntityNotFound(_0x532993,null))['then'](function(_0x174f71){if(_0x174f71){return _0x174f71['addMessage'](_0x333377[_0x2047('0x6c')]['ids'],_[_0x2047('0xaf')](_0x333377['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x532993,null))[_0x2047('0x31')](handleError(_0x532993,null));};exports[_0x2047('0xb0')]=function(_0x2e1a87,_0x4cf3af,_0x328328){var _0x54df9b={'raw':![],'where':{}};var _0x1b23fd={};var _0x145712={'count':0x0,'rows':[]};return db[_0x2047('0x33')][_0x2047('0xb1')]({'where':{'id':_0x2e1a87[_0x2047('0xa8')]['id']}})[_0x2047('0x27')](handleEntityNotFound(_0x4cf3af,null))[_0x2047('0x27')](function(_0x18c68b){if(_0x18c68b){_0x1b23fd[_0x2047('0x37')]=_[_0x2047('0x39')](db[_0x2047('0xb2')][_0x2047('0x34')]);_0x1b23fd[_0x2047('0x38')]=_['keys'](_0x2e1a87['query']);_0x1b23fd[_0x2047('0x3a')]=_[_0x2047('0x3b')](_0x1b23fd['model'],_0x1b23fd[_0x2047('0x38')]);_0x54df9b['attributes']=_[_0x2047('0x3b')](_0x1b23fd['model'],qs[_0x2047('0x3d')](_0x2e1a87['query']['fields']));_0x54df9b[_0x2047('0x3c')]=_0x54df9b[_0x2047('0x3c')][_0x2047('0x3e')]?_0x54df9b[_0x2047('0x3c')]:_0x1b23fd[_0x2047('0x37')];if(!_0x2e1a87[_0x2047('0x38')][_0x2047('0x3f')](_0x2047('0x40'))){_0x54df9b[_0x2047('0x41')]=qs[_0x2047('0x41')](_0x2e1a87['query'][_0x2047('0x41')]);_0x54df9b['offset']=qs[_0x2047('0x20')](_0x2e1a87[_0x2047('0x38')][_0x2047('0x20')]);}_0x54df9b[_0x2047('0x42')]=qs[_0x2047('0x43')](_0x2e1a87[_0x2047('0x38')]['sort']);_0x54df9b[_0x2047('0x75')]=qs['filters'](_[_0x2047('0x44')](_0x2e1a87[_0x2047('0x38')],_0x1b23fd[_0x2047('0x3a')]));_0x54df9b['where']['OpenchannelInteractionId']=_0x18c68b['id'];if(_0x2e1a87[_0x2047('0x38')][_0x2047('0x7b')]){_0x54df9b[_0x2047('0x75')]=_[_0x2047('0x90')](_0x54df9b[_0x2047('0x75')],{'$or':_[_0x2047('0x2c')](_0x54df9b[_0x2047('0x3c')],function(_0x559c33){var _0x5c8509={};_0x5c8509[_0x559c33]={'$like':'%'+_0x2e1a87[_0x2047('0x38')][_0x2047('0x7b')]+'%'};return _0x5c8509;})});}if(_0x2e1a87[_0x2047('0x38')][_0x2047('0xb3')]){var _0x4c2bc0=_0x2e1a87['query'][_0x2047('0xb3')]['split'](',');var _0x3d59c4={};_0x3d59c4[_0x4c2bc0[0x0]]={'$gte':moment(_0x4c2bc0[0x1])[_0x2047('0xb4')](_0x2047('0xb5'))};_0x54df9b[_0x2047('0x75')]=_[_0x2047('0x90')](_0x54df9b[_0x2047('0x75')],_0x3d59c4);}_0x54df9b=_[_0x2047('0x90')]({},_0x54df9b,_0x2e1a87[_0x2047('0xb6')]);return db[_0x2047('0xb2')]['count']({'where':_0x54df9b[_0x2047('0x75')]})[_0x2047('0x27')](function(_0x1e1248){_0x145712[_0x2047('0x1f')]=_0x1e1248;if(_0x2e1a87[_0x2047('0x38')]['includeAll']){_0x54df9b[_0x2047('0xaa')]=[{'all':!![]}];}return db[_0x2047('0xb2')][_0x2047('0xb7')](_0x54df9b);})[_0x2047('0x27')](function(_0x5f7dbc){_0x145712[_0x2047('0xa6')]=_0x5f7dbc;return _0x145712;});}})['then'](respondWithFilteredResult(_0x4cf3af,_0x54df9b))['catch'](handleError(_0x4cf3af,null));};exports[_0x2047('0xb8')]=function(_0x5c740c,_0x202e9f,_0x535c02){return db[_0x2047('0x33')][_0x2047('0x59')]({'where':{'id':_0x5c740c[_0x2047('0xa8')]['id']}})[_0x2047('0x27')](handleEntityNotFound(_0x202e9f,null))['then'](function(_0x31d7e5){if(_0x31d7e5){return _0x31d7e5[_0x2047('0xb9')](_0x5c740c[_0x2047('0x6c')][_0x2047('0xba')],_[_0x2047('0xaf')](_0x5c740c['body'],[_0x2047('0xba'),'id'])||{})[_0x2047('0xbb')](function(){return db[_0x2047('0xbc')][_0x2047('0xb7')]({'attributes':['id',_0x2047('0x29'),'color'],'where':{'id':_0x5c740c[_0x2047('0x6c')][_0x2047('0xba')]}});})[_0x2047('0x27')](function(_0x11e064){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x5c740c['params']['id']),'tags':_0x11e064||[]});return{'id':Number(_0x5c740c[_0x2047('0xa8')]['id']),'tags':_0x11e064||[]};});}})[_0x2047('0x27')](respondWithResult(_0x202e9f,null))['catch'](handleError(_0x202e9f,null));};exports[_0x2047('0xbd')]=function(_0x27c2d2,_0x5e11b9,_0x1217c0){return db['OpenchannelInteraction'][_0x2047('0x59')]({'where':{'id':_0x27c2d2[_0x2047('0xa8')]['id']}})[_0x2047('0x27')](handleEntityNotFound(_0x5e11b9,null))[_0x2047('0x27')](function(_0x371364){if(_0x371364){return _0x371364['removeTags'](_0x27c2d2['query'][_0x2047('0xba')]);}})[_0x2047('0x27')](respondWithStatusCode(_0x5e11b9,null))[_0x2047('0x31')](handleError(_0x5e11b9,null));};exports[_0x2047('0xbe')]=function(_0x396758,_0x3dd41b){var _0x58aa4a=moment()['unix']()[_0x2047('0xa2')]();var _0x536263=path[_0x2047('0xbf')](config['root'],'server',_0x2047('0xc0'),_0x2047('0xc1'));var _0x44327d=path[_0x2047('0xbf')](config[_0x2047('0xc2')],'server',_0x2047('0xc0'),'attachments');var _0x1ba210=path[_0x2047('0xbf')](_0x536263,_0x58aa4a);var _0x3d6eb2=util[_0x2047('0xb4')]('transcript-%d-%s.zip',_0x396758['params']['id'],_0x58aa4a);var _0x27890d=path[_0x2047('0xbf')](_0x536263,_0x3d6eb2);var _0x5c388d=[];_0x5c388d[_0x2047('0xa4')]({'model':db['User'],'as':_0x2047('0xc3'),'attributes':['id',_0x2047('0xc4')],'raw':!![]});_0x5c388d[_0x2047('0xa4')]({'model':db[_0x2047('0xc5')],'as':_0x2047('0x5f'),'attributes':['id',_0x2047('0xc6'),_0x2047('0xc7')],'raw':!![]});if(_0x396758[_0x2047('0x38')][_0x2047('0xc8')]){_0x5c388d[_0x2047('0xa4')]({'model':db[_0x2047('0xc9')],'as':_0x2047('0xc9'),'raw':!![]});}var _0x1a6d39=[{'model':db[_0x2047('0xb2')],'as':_0x2047('0xca'),'attributes':['id','body',_0x2047('0xcb'),_0x2047('0xcc'),'secret',_0x2047('0x76')],'include':_0x5c388d}];_0x1a6d39[_0x2047('0xa4')]({'model':db[_0x2047('0xcd')],'as':_0x2047('0xce'),'attributes':['id','name']});_0x1a6d39[_0x2047('0xa4')]({'model':db[_0x2047('0xc3')],'as':'Owner','attributes':['id',_0x2047('0xc4')]});return db[_0x2047('0x33')]['find']({'where':{'id':_0x396758['params']['id']},'include':_0x1a6d39})['then'](handleEntityNotFound(_0x3dd41b,null))['then'](function(_0x2dbe27){if(_0x2dbe27){var _0xe1863e=_0x2dbe27['get']({'plain':!![]});fs[_0x2047('0xcf')](_0x1ba210);var _0x382396={'format':'A4','border':_0x2047('0xd0'),'header':{'height':_0x2047('0xd1'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x2047('0xd2'),'contents':{'default':util[_0x2047('0xb4')](_0x2047('0xd3'),util[_0x2047('0xb4')](_0x2047('0xd4'),'Openchannel',_0xe1863e['id']),moment()[_0x2047('0xb4')](_0x2047('0xd5'))[_0x2047('0xa2')]())}}};var _0xe9e40c={'channel':_0x2047('0xd6'),'account':_0xe1863e[_0x2047('0xce')][_0x2047('0x29')],'agent':_0xe1863e[_0x2047('0xd7')]?_0xe1863e[_0x2047('0xd7')][_0x2047('0xc4')]:_0x2047('0xd8'),'createdAt':moment(_0xe1863e[_0x2047('0xcb')])['format'](_0x2047('0xb5'))['toString'](),'closedAt':_0xe1863e[_0x2047('0xd9')]?moment(_0xe1863e[_0x2047('0xda')])[_0x2047('0xb4')](_0x2047('0xb5'))['toString']():'','disposition':_0xe1863e[_0x2047('0xdb')],'visibility':_0xe1863e[_0x2047('0xdc')]?_0x2047('0xdd'):'Private','messages':_(_0xe1863e[_0x2047('0xca')])[_0x2047('0x7b')]({'secret':![]})[_0x2047('0x2c')](function(_0x32f597){if(_0x32f597[_0x2047('0xc9')]){var _0x183510=path['join'](_0x44327d,_0x32f597[_0x2047('0xc9')][_0x2047('0xde')]);if(fs[_0x2047('0xdf')](_0x183510)){fs[_0x2047('0xe0')](_0x183510)[_0x2047('0xe1')](fs[_0x2047('0xe2')](path['join'](_0x1ba210,_0x32f597[_0x2047('0xc9')][_0x2047('0xde')])));}}return{'date':moment(_0x32f597[_0x2047('0xcb')])[_0x2047('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2047('0xa2')](),'sender':_0x32f597[_0x2047('0xcc')]===_0x2047('0xe3')?_0x32f597[_0x2047('0xc3')]?_0x32f597[_0x2047('0xc3')][_0x2047('0xc4')]:'System':_0x32f597[_0x2047('0x5f')][_0x2047('0xc6')]+(_0x32f597[_0x2047('0x5f')][_0x2047('0xc7')]?'\x20'+_0x32f597[_0x2047('0x5f')][_0x2047('0xc7')]:''),'body':_0x32f597['Attachment']?_0x32f597[_0x2047('0xc9')][_0x2047('0xde')]:_0x32f597[_0x2047('0x6c')],'direction':_0x32f597['direction']===_0x2047('0xe3')?'A':'C','secret':_0x32f597['secret'],'read':_0x32f597['read'],'attachment':_0x32f597[_0x2047('0xc9')]};})[_0x2047('0x5b')]()};return ejs[_0x2047('0xe4')](path[_0x2047('0xbf')](config[_0x2047('0xc2')],'server',_0x2047('0xe5'),'downloadInteraction.html'),{'interaction':_0xe9e40c})[_0x2047('0x27')](function(_0x493133){return new BPromise(function(_0x54906f,_0x5e55b4){pdf['create'](_0x493133,_0x382396)[_0x2047('0xe6')](path[_0x2047('0xbf')](_0x1ba210,_0x2047('0xe7')+_0xe1863e['id']+'-'+_0x58aa4a+_0x2047('0xe8')),function(_0x3920b3,_0x22a633){if(_0x3920b3)return _0x5e55b4(_0x3920b3);_0x54906f(_0x22a633);});});})[_0x2047('0x27')](function(){return new BPromise(function(_0x1d5934,_0xf50941){zipdir(_0x1ba210,{'saveTo':_0x27890d},function(_0x592cb0,_0x525648){if(_0x592cb0)return _0xf50941(_0x592cb0);return _0x1d5934(_0x525648);});})['then'](function(){return new BPromise(function(_0x1a8a0e,_0x56d337){rimraf(_0x1ba210,function(_0x10598e){if(_0x10598e)_0x56d337(_0x10598e);return _0x1a8a0e();});});})['then'](function(){return _0x3dd41b[_0x2047('0xbe')](_0x27890d,_0x3d6eb2,function(_0x1f4bdd){if(_0x1f4bdd){console[_0x2047('0xe9')](_0x2047('0xea'),_0x1f4bdd);}else{fs[_0x2047('0xeb')](_0x27890d);}});});});}else{return _0x3dd41b[_0x2047('0xec')](0xc8);}})[_0x2047('0x31')](handleError(_0x3dd41b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8c62dfe..a117408 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 _0x18e7=['then','Users','map','findAll','setDataValue','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x551ed2,_0x197d2d){var _0x4bb9d1=function(_0x5b49f6){while(--_0x5b49f6){_0x551ed2['push'](_0x551ed2['shift']());}};_0x4bb9d1(++_0x197d2d);}(_0x18e7,0x1d5));var _0x718e=function(_0xff2d67,_0x5aea69){_0xff2d67=_0xff2d67-0x0;var _0x2580ad=_0x18e7[_0xff2d67];return _0x2580ad;};'use strict';var EventEmitter=require(_0x718e('0x0'));var OpenchannelInteraction=require(_0x718e('0x1'))['db'][_0x718e('0x2')];var OpenchannelMessage=require(_0x718e('0x1'))['db'][_0x718e('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x718e('0x4')](0x0);var events={'afterCreate':_0x718e('0x5'),'afterUpdate':_0x718e('0x6'),'afterDestroy':'remove'};function emitEvent(_0x39ac6c){return function(_0x4d87cc,_0x513fb2,_0x35ca88){_0x4d87cc['getUsers']({'attributes':['id'],'raw':!![]})[_0x718e('0x7')](function(_0x172cd2){_0x4d87cc['setDataValue'](_0x718e('0x8'),_0x172cd2[_0x718e('0x9')](function(_0x45a042){return{'id':_0x45a042['id']};}));return OpenchannelMessage[_0x718e('0xa')]({'where':{'OpenchannelInteractionId':_0x4d87cc['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x454ff7){_0x4d87cc[_0x718e('0xb')]('unreadMessages',_0x454ff7['length']);OpenchannelInteractionEvents[_0x718e('0xc')](_0x39ac6c+':'+_0x4d87cc['id'],_0x4d87cc);OpenchannelInteractionEvents['emit'](_0x39ac6c,_0x4d87cc);_0x35ca88(null);})[_0x718e('0xd')](_0x35ca88(null));};}for(var e in events){if(events[_0x718e('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x718e('0xf')](e,emitEvent(event));}}module[_0x718e('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2335=['setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2335,0x1ea));var _0x5233=function(_0x54cbd8,_0xf0862){_0x54cbd8=_0x54cbd8-0x0;var _0xd485c=_0x2335[_0x54cbd8];return _0xd485c;};'use strict';var EventEmitter=require(_0x5233('0x0'));var OpenchannelInteraction=require(_0x5233('0x1'))['db'][_0x5233('0x2')];var OpenchannelMessage=require(_0x5233('0x1'))['db'][_0x5233('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5233('0x4')](0x0);var events={'afterCreate':_0x5233('0x5'),'afterUpdate':_0x5233('0x6'),'afterDestroy':_0x5233('0x7')};function emitEvent(_0x2328eb){return function(_0xb9f12f,_0x8104d7,_0x2b9f27){_0xb9f12f['getUsers']({'attributes':['id'],'raw':!![]})[_0x5233('0x8')](function(_0x2d2aff){_0xb9f12f[_0x5233('0x9')](_0x5233('0xa'),_0x2d2aff[_0x5233('0xb')](function(_0x4bd81e){return{'id':_0x4bd81e['id']};}));return OpenchannelMessage[_0x5233('0xc')]({'where':{'OpenchannelInteractionId':_0xb9f12f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5233('0x8')](function(_0x648da2){_0xb9f12f['setDataValue'](_0x5233('0xd'),_0x648da2[_0x5233('0xe')]);OpenchannelInteractionEvents[_0x5233('0xf')](_0x2328eb+':'+_0xb9f12f['id'],_0xb9f12f);OpenchannelInteractionEvents[_0x5233('0xf')](_0x2328eb,_0xb9f12f);_0x2b9f27(null);})[_0x5233('0x10')](_0x2b9f27(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x5233('0x11')](e,emitEvent(event));}}module[_0x5233('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index b36e5e8..fab332e 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 _0xe015=['changed','closed','format','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','openchannel_interactions'];(function(_0x47677f,_0x28c987){var _0xde4698=function(_0x459d60){while(--_0x459d60){_0x47677f['push'](_0x47677f['shift']());}};_0xde4698(++_0x28c987);}(_0xe015,0x13b));var _0x5e01=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe015[_0x17d9e3];return _0x14192d;};'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'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('OpenchannelInteraction',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3aeaef,_0x1420c2,_0x40d31f){if(_0x3aeaef[_0x5e01('0x9')](_0x5e01('0xa'))){_0x3aeaef['closedAt']=moment()[_0x5e01('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x40d31f(null,_0x3aeaef);}}});}; \ No newline at end of file +var _0x3435=['../../config/logger','api','moment','bluebird','path','rimraf','exports','OpenchannelInteraction','openchannel_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x3d69d6,_0x287de4){var _0xb60e77=function(_0x2161e1){while(--_0x2161e1){_0x3d69d6['push'](_0x3d69d6['shift']());}};_0xb60e77(++_0x287de4);}(_0x3435,0xfa));var _0x5343=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x3435[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var logger=require(_0x5343('0x2'))(_0x5343('0x3'));var moment=require(_0x5343('0x4'));var BPromise=require(_0x5343('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5343('0x6'));var rimraf=require(_0x5343('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x5343('0x8')]=function(_0x28f0f3,_0x4d26b5){return _0x28f0f3['define'](_0x5343('0x9'),attributes,{'tableName':_0x5343('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9ea9b6,_0x245034,_0x41673f){if(_0x9ea9b6['changed'](_0x5343('0xb'))){_0x9ea9b6['closedAt']=moment()[_0x5343('0xc')](_0x5343('0xd'));}_0x41673f(null,_0x9ea9b6);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index eb805f7..21b5d58 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 _0x09c3=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','ids','spread'];(function(_0x7a92fc,_0x5de5df){var _0x21e8b8=function(_0x16bd63){while(--_0x16bd63){_0x7a92fc['push'](_0x7a92fc['shift']());}};_0x21e8b8(++_0x5de5df);}(_0x09c3,0x120));var _0x309c=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0x09c3[_0x2ae8ce];return _0x4bf686;};'use strict';var _=require(_0x309c('0x0'));var util=require(_0x309c('0x1'));var moment=require(_0x309c('0x2'));var BPromise=require(_0x309c('0x3'));var rs=require(_0x309c('0x4'));var fs=require('fs');var Redis=require(_0x309c('0x5'));var db=require(_0x309c('0x6'))['db'];var utils=require(_0x309c('0x7'));var logger=require(_0x309c('0x8'))(_0x309c('0x9'));var config=require(_0x309c('0xa'));var jayson=require(_0x309c('0xb'));var client=jayson[_0x309c('0xc')][_0x309c('0xd')]({'port':0x232a});config[_0x309c('0xe')]=_[_0x309c('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x309c('0x10'))(new Redis(config[_0x309c('0xe')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x535aab,_0x74109a,_0x5b658e){return new BPromise(function(_0x1d4b47,_0x38b770){return client[_0x309c('0x11')](_0x535aab,_0x5b658e)[_0x309c('0x12')](function(_0x31a4cc){logger['info'](_0x309c('0x13'),_0x74109a,'request\x20sent');logger[_0x309c('0x14')](_0x309c('0x15'),_0x74109a,_0x309c('0x16'),JSON['stringify'](_0x31a4cc));if(_0x31a4cc['error']){if(_0x31a4cc[_0x309c('0x17')][_0x309c('0x18')]===0x1f4){logger['error'](_0x309c('0x13'),_0x74109a,_0x31a4cc['error'][_0x309c('0x19')]);return _0x38b770(_0x31a4cc[_0x309c('0x17')]['message']);}logger[_0x309c('0x17')](_0x309c('0x13'),_0x74109a,_0x31a4cc['error'][_0x309c('0x19')]);return _0x1d4b47(_0x31a4cc[_0x309c('0x17')][_0x309c('0x19')]);}else{logger[_0x309c('0x1a')](_0x309c('0x13'),_0x74109a,_0x309c('0x16'));_0x1d4b47(_0x31a4cc[_0x309c('0x1b')][_0x309c('0x19')]);}})[_0x309c('0x1c')](function(_0x3cf2fa){logger[_0x309c('0x17')](_0x309c('0x13'),_0x74109a,_0x3cf2fa);_0x38b770(_0x3cf2fa);});});}exports[_0x309c('0x1d')]=function(_0xd88a94){var _0x31dac1=this;return new Promise(function(_0x295435,_0x4a2934){return db[_0x309c('0x1e')]['update'](_0xd88a94['body'],{'raw':_0xd88a94['options']?_0xd88a94[_0x309c('0x1f')][_0x309c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd88a94[_0x309c('0x1f')]?_0xd88a94['options'][_0x309c('0x21')]||null:null,'attributes':_0xd88a94[_0x309c('0x1f')]?_0xd88a94[_0x309c('0x1f')][_0x309c('0x22')]||null:null,'limit':_0xd88a94['options']?_0xd88a94[_0x309c('0x1f')][_0x309c('0x23')]||null:null})['then'](function(_0x5afaaf){logger[_0x309c('0x1a')]('UpdateOpenchannelInteraction',_0xd88a94);logger[_0x309c('0x14')](_0x309c('0x1d'),_0xd88a94,JSON['stringify'](_0x5afaaf));_0x295435(_0x5afaaf);})[_0x309c('0x1c')](function(_0x162a8c){logger[_0x309c('0x17')](_0x309c('0x1d'),_0x162a8c[_0x309c('0x19')],_0xd88a94);_0x4a2934(_0x31dac1[_0x309c('0x17')](0x1f4,_0x162a8c[_0x309c('0x19')]));});});};exports[_0x309c('0x24')]=function(_0x13b56c){return new Promise(function(_0x2f9cd9,_0x3827f3){return db[_0x309c('0x1e')][_0x309c('0x25')]({'where':_0x13b56c[_0x309c('0x1f')]?_0x13b56c[_0x309c('0x1f')][_0x309c('0x21')]||null:null})[_0x309c('0x12')](function(_0xb8b5ad){if(_0xb8b5ad){return _0xb8b5ad['addTags'](_0x13b56c['body'][_0x309c('0x26')],_['omit'](_0x13b56c['body'],['ids','id'])||{});}})[_0x309c('0x27')](function(_0x24fae4){logger[_0x309c('0x1a')]('AddTags',_0x13b56c);logger[_0x309c('0x14')]('AddTags',_0x13b56c,JSON['stringify'](_0x24fae4));_0x2f9cd9(_0x24fae4);})[_0x309c('0x1c')](function(_0x5b9e36){logger[_0x309c('0x17')](_0x309c('0x28'),_0x5b9e36[_0x309c('0x19')],_0x13b56c);_0x3827f3(_this[_0x309c('0x17')](0x1f4,_0x5b9e36[_0x309c('0x19')]));});});}; \ No newline at end of file +var _0x7415=['rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','debug','AddTagsToOpenchannelInteraction','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x595859,_0x3d4cec){var _0x229777=function(_0x15d48f){while(--_0x15d48f){_0x595859['push'](_0x595859['shift']());}};_0x229777(++_0x3d4cec);}(_0x7415,0x19b));var _0x5741=function(_0x5cf950,_0x565f59){_0x5cf950=_0x5cf950-0x0;var _0x4629f9=_0x7415[_0x5cf950];return _0x4629f9;};'use strict';var _=require(_0x5741('0x0'));var util=require(_0x5741('0x1'));var moment=require(_0x5741('0x2'));var BPromise=require(_0x5741('0x3'));var rs=require(_0x5741('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5741('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5741('0x6'))(_0x5741('0x7'));var config=require('../../config/environment');var jayson=require(_0x5741('0x8'));var client=jayson[_0x5741('0x9')]['http']({'port':0x232a});config[_0x5741('0xa')]=_[_0x5741('0xb')](config[_0x5741('0xa')],{'host':_0x5741('0xc'),'port':0x18eb});var socket=require(_0x5741('0xd'))(new Redis(config[_0x5741('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x39d8c4,_0x53eaf1,_0x2f39be){return new BPromise(function(_0x389e5e,_0xdcd659){return client['request'](_0x39d8c4,_0x2f39be)[_0x5741('0xe')](function(_0x572f2e){logger[_0x5741('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x53eaf1,_0x5741('0x10'));logger['debug'](_0x5741('0x11'),_0x53eaf1,_0x5741('0x10'),JSON[_0x5741('0x12')](_0x572f2e));if(_0x572f2e[_0x5741('0x13')]){if(_0x572f2e[_0x5741('0x13')][_0x5741('0x14')]===0x1f4){logger[_0x5741('0x13')](_0x5741('0x15'),_0x53eaf1,_0x572f2e[_0x5741('0x13')][_0x5741('0x16')]);return _0xdcd659(_0x572f2e[_0x5741('0x13')][_0x5741('0x16')]);}logger['error'](_0x5741('0x15'),_0x53eaf1,_0x572f2e[_0x5741('0x13')][_0x5741('0x16')]);return _0x389e5e(_0x572f2e[_0x5741('0x13')][_0x5741('0x16')]);}else{logger['info'](_0x5741('0x15'),_0x53eaf1,'request\x20sent');_0x389e5e(_0x572f2e['result'][_0x5741('0x16')]);}})[_0x5741('0x17')](function(_0x4d5c1b){logger[_0x5741('0x13')](_0x5741('0x15'),_0x53eaf1,_0x4d5c1b);_0xdcd659(_0x4d5c1b);});});}exports[_0x5741('0x18')]=function(_0x2b5720){var _0x20c2ba=this;return new Promise(function(_0x2a7398,_0x5c5bc7){return db[_0x5741('0x19')][_0x5741('0x1a')](_0x2b5720[_0x5741('0x1b')],{'raw':_0x2b5720[_0x5741('0x1c')]?_0x2b5720[_0x5741('0x1c')][_0x5741('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5720[_0x5741('0x1c')]?_0x2b5720[_0x5741('0x1c')]['where']||null:null,'attributes':_0x2b5720[_0x5741('0x1c')]?_0x2b5720[_0x5741('0x1c')]['attributes']||null:null,'limit':_0x2b5720[_0x5741('0x1c')]?_0x2b5720[_0x5741('0x1c')]['limit']||null:null})[_0x5741('0xe')](function(_0x335153){logger[_0x5741('0xf')](_0x5741('0x18'),_0x2b5720);logger[_0x5741('0x1e')]('UpdateOpenchannelInteraction',_0x2b5720,JSON[_0x5741('0x12')](_0x335153));_0x2a7398(_0x335153);})[_0x5741('0x17')](function(_0x2905e1){logger[_0x5741('0x13')]('UpdateOpenchannelInteraction',_0x2905e1[_0x5741('0x16')],_0x2b5720);_0x5c5bc7(_0x20c2ba[_0x5741('0x13')](0x1f4,_0x2905e1[_0x5741('0x16')]));});});};exports[_0x5741('0x1f')]=function(_0x349abf){return new Promise(function(_0x1160f1,_0x2364bb){return db[_0x5741('0x19')]['find']({'where':_0x349abf[_0x5741('0x1c')]?_0x349abf[_0x5741('0x1c')][_0x5741('0x20')]||null:null})['then'](function(_0x45d272){if(_0x45d272){return _0x45d272[_0x5741('0x21')](_0x349abf[_0x5741('0x1b')]['ids'],_[_0x5741('0x22')](_0x349abf[_0x5741('0x1b')],[_0x5741('0x23'),'id'])||{});}})[_0x5741('0x24')](function(_0x5bde76){logger['info']('AddTags',_0x349abf);logger[_0x5741('0x1e')](_0x5741('0x25'),_0x349abf,JSON['stringify'](_0x5bde76));_0x1160f1(_0x5bde76);})[_0x5741('0x17')](function(_0x394971){logger[_0x5741('0x13')](_0x5741('0x25'),_0x394971['message'],_0x349abf);_0x2364bb(_this[_0x5741('0x13')](0x1f4,_0x394971[_0x5741('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 082d3e7..72a93e6 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 _0x12a0=['removeListener','register','length','openchannelInteraction:','save','remove','update','emit'];(function(_0x5767a0,_0x43b96b){var _0x517589=function(_0xbd9f4a){while(--_0xbd9f4a){_0x5767a0['push'](_0x5767a0['shift']());}};_0x517589(++_0x43b96b);}(_0x12a0,0x74));var _0x012a=function(_0x59eea3,_0x305f44){_0x59eea3=_0x59eea3-0x0;var _0x2477b7=_0x12a0[_0x59eea3];return _0x2477b7;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x012a('0x0'),_0x012a('0x1'),_0x012a('0x2')];function createListener(_0x25fa15,_0x54e828){return function(_0x136634){_0x54e828[_0x012a('0x3')](_0x25fa15,_0x136634);};}function removeListener(_0x14ac22,_0x2c7126){return function(){OpenchannelInteractionEvents[_0x012a('0x4')](_0x14ac22,_0x2c7126);};}exports[_0x012a('0x5')]=function(_0x4a45bb){for(var _0x370d2e=0x0,_0x307d59=events[_0x012a('0x6')];_0x370d2e<_0x307d59;_0x370d2e++){var _0x43e925=events[_0x370d2e];var _0x291f02=createListener(_0x012a('0x7')+_0x43e925,_0x4a45bb);OpenchannelInteractionEvents['on'](_0x43e925,_0x291f02);}}; \ No newline at end of file +var _0x73e7=['./openchannelInteraction.events','save','remove','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x73e7,0xe8));var _0x773e=function(_0x305fcf,_0x57e95d){_0x305fcf=_0x305fcf-0x0;var _0x2db49a=_0x73e7[_0x305fcf];return _0x2db49a;};'use strict';var OpenchannelInteractionEvents=require(_0x773e('0x0'));var events=[_0x773e('0x1'),_0x773e('0x2'),'update'];function createListener(_0x323f7a,_0x53eac9){return function(_0x2662ec){_0x53eac9[_0x773e('0x3')](_0x323f7a,_0x2662ec);};}function removeListener(_0x25e51b,_0x5003b9){return function(){OpenchannelInteractionEvents[_0x773e('0x4')](_0x25e51b,_0x5003b9);};}exports[_0x773e('0x5')]=function(_0x22ca52){for(var _0x544b45=0x0,_0x3b4de5=events[_0x773e('0x6')];_0x544b45<_0x3b4de5;_0x544b45++){var _0x5de98f=events[_0x544b45];var _0x2ea558=createListener(_0x773e('0x7')+_0x5de98f,_0x22ca52);OpenchannelInteractionEvents['on'](_0x5de98f,_0x2ea558);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e13e935..c4747d5 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 _0x7e3a=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','show','post','tracked','create','put','/:id','update','accept','/:id/reject','reject'];(function(_0x4f50b1,_0x3f2449){var _0x4a6288=function(_0x262dff){while(--_0x262dff){_0x4f50b1['push'](_0x4f50b1['shift']());}};_0x4a6288(++_0x3f2449);}(_0x7e3a,0x16b));var _0xa7e3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7e3a[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0xa7e3('0x0'));var path=require(_0xa7e3('0x1'));var timeout=require(_0xa7e3('0x2'));var express=require(_0xa7e3('0x3'));var router=express[_0xa7e3('0x4')]();var auth=require(_0xa7e3('0x5'));var interaction=require(_0xa7e3('0x6'));var config=require(_0xa7e3('0x7'));var controller=require(_0xa7e3('0x8'));router[_0xa7e3('0x9')]('/',auth[_0xa7e3('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa7e3('0x9')]('/:id',auth[_0xa7e3('0xa')](),controller[_0xa7e3('0xb')]);router[_0xa7e3('0xc')]('/',auth[_0xa7e3('0xa')](),interaction[_0xa7e3('0xd')]('openchannel','openchannelmessage:create'),controller[_0xa7e3('0xe')]);router[_0xa7e3('0xf')](_0xa7e3('0x10'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0x11')]);router[_0xa7e3('0xf')]('/:id/accept',auth['isAuthenticated'](),controller[_0xa7e3('0x12')]);router[_0xa7e3('0xf')](_0xa7e3('0x13'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0x14')]);router[_0xa7e3('0x15')](_0xa7e3('0x10'),auth[_0xa7e3('0xa')](),controller[_0xa7e3('0x16')]);module[_0xa7e3('0x17')]=router; \ No newline at end of file +var _0x97c0=['path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','/:id','show','post','openchannel','openchannelmessage:create','create','put','update','/:id/accept','reject','delete','exports','multer','util'];(function(_0x33c2af,_0x163198){var _0x13c04a=function(_0x4de68e){while(--_0x4de68e){_0x33c2af['push'](_0x33c2af['shift']());}};_0x13c04a(++_0x163198);}(_0x97c0,0x7c));var _0x097c=function(_0x1f5755,_0xf7130f){_0x1f5755=_0x1f5755-0x0;var _0x5075fe=_0x97c0[_0x1f5755];return _0x5075fe;};'use strict';var multer=require(_0x097c('0x0'));var util=require(_0x097c('0x1'));var path=require(_0x097c('0x2'));var timeout=require(_0x097c('0x3'));var express=require(_0x097c('0x4'));var router=express[_0x097c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x097c('0x6'));var config=require('../../config/environment');var controller=require('./openchannelMessage.controller');router[_0x097c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x097c('0x7')]('/describe',auth[_0x097c('0x8')](),controller['describe']);router['get'](_0x097c('0x9'),auth[_0x097c('0x8')](),controller[_0x097c('0xa')]);router[_0x097c('0xb')]('/',auth[_0x097c('0x8')](),interaction['tracked'](_0x097c('0xc'),_0x097c('0xd')),controller[_0x097c('0xe')]);router[_0x097c('0xf')](_0x097c('0x9'),auth['isAuthenticated'](),controller[_0x097c('0x10')]);router[_0x097c('0xf')](_0x097c('0x11'),auth[_0x097c('0x8')](),controller['accept']);router[_0x097c('0xf')]('/:id/reject',auth['isAuthenticated'](),controller[_0x097c('0x12')]);router[_0x097c('0x13')](_0x097c('0x9'),auth[_0x097c('0x8')](),controller['destroy']);module[_0x097c('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 27e704a..d43b732 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 _0xf8a6=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x1e409d,_0x18908b){var _0x13b5ab=function(_0x490bf8){while(--_0x490bf8){_0x1e409d['push'](_0x1e409d['shift']());}};_0x13b5ab(++_0x18908b);}(_0xf8a6,0x1a2));var _0x6f8a=function(_0x3f2530,_0x4fede2){_0x3f2530=_0x3f2530-0x0;var _0x1cbc0e=_0xf8a6[_0x3f2530];return _0x1cbc0e;};'use strict';var Sequelize=require(_0x6f8a('0x0'));module['exports']={'body':{'type':Sequelize[_0x6f8a('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6f8a('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6f8a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6f8a('0x3')]('in','out'),'defaultValue':_0x6f8a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6f8a('0x5')]}}; \ No newline at end of file +var _0x28f9=['BOOLEAN','out','DATE','sequelize','exports','TEXT'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x28f9,0x195));var _0x928f=function(_0x3b75a2,_0x3e432f){_0x3b75a2=_0x3b75a2-0x0;var _0x27db1e=_0x28f9[_0x3b75a2];return _0x27db1e;};'use strict';var Sequelize=require(_0x928f('0x0'));module[_0x928f('0x1')]={'body':{'type':Sequelize[_0x928f('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x928f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x928f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x928f('0x4')),'defaultValue':_0x928f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x928f('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index de27e6d..4882a77 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 _0x1f2d=['user','role','null','AcceptMessage','acceptMessage','channel','event','EventManager','acceptmessage','reject','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','stack','name','send','index','map','OpenchannelMessage','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','rawAttributes','length','find','create','body','params','destroy','describe','openchannel-interactions','accept','openchannel','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteractionId','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x5b4d27,_0x4bc306){var _0x4588d2=function(_0x18589e){while(--_0x18589e){_0x5b4d27['push'](_0x5b4d27['shift']());}};_0x4588d2(++_0x4bc306);}(_0x1f2d,0x176));var _0xd1f2=function(_0x41f15f,_0x1a39ef){_0x41f15f=_0x41f15f-0x0;var _0x269a71=_0x1f2d[_0x41f15f];return _0x269a71;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd1f2('0x0'));var rimraf=require(_0xd1f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1f2('0x2'));var rp=require(_0xd1f2('0x3'));var moment=require(_0xd1f2('0x4'));var BPromise=require(_0xd1f2('0x5'));var Mustache=require(_0xd1f2('0x6'));var util=require(_0xd1f2('0x7'));var path=require('path');var sox=require(_0xd1f2('0x8'));var csv=require(_0xd1f2('0x9'));var ejs=require(_0xd1f2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd1f2('0xb'));var crypto=require(_0xd1f2('0xc'));var jsforce=require(_0xd1f2('0xd'));var deskjs=require(_0xd1f2('0xe'));var toCsv=require(_0xd1f2('0x9'));var querystring=require(_0xd1f2('0xf'));var Papa=require(_0xd1f2('0x10'));var Redis=require(_0xd1f2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd1f2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1f2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd1f2('0x14'));var db=require(_0xd1f2('0x15'))['db'];config[_0xd1f2('0x16')]=_[_0xd1f2('0x17')](config[_0xd1f2('0x16')],{'host':_0xd1f2('0x18'),'port':0x18eb});var socket=require(_0xd1f2('0x19'))(new Redis(config[_0xd1f2('0x16')]));require(_0xd1f2('0x1a'))[_0xd1f2('0x1b')](socket);var jayson=require(_0xd1f2('0x1c'));var client=jayson[_0xd1f2('0x1d')][_0xd1f2('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xd1f2('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1ea540,_0x394560,_0x4bc237){if(_0x4bc237){var _0x4e0b02=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e0b02['test'](_0x394560)){return _0x1ea540;}else{throw new db[(_0xd1f2('0x1f'))][(_0xd1f2('0x20'))](_0xd1f2('0x21'));}}else{return _0x1ea540;}}function respondWithRpcPromise(_0x5094d5,_0x4a16e8,_0x44075,_0xfc1994){return new BPromise(function(_0x46ea17,_0x2424bf){var _0x234f35=_0xfc1994||client;return _0x234f35[_0xd1f2('0x22')](_0x5094d5,_0x44075)[_0xd1f2('0x23')](function(_0x4e545b){logger[_0xd1f2('0x24')](_0xd1f2('0x25'),_0x4a16e8,_0xd1f2('0x26'));logger['debug'](_0xd1f2('0x27'),_0x4a16e8,_0xd1f2('0x26'),JSON['stringify'](_0x4e545b));if(_0x4e545b[_0xd1f2('0x28')]){if(_0x4e545b[_0xd1f2('0x28')][_0xd1f2('0x29')]===0x1f4){logger[_0xd1f2('0x28')](_0xd1f2('0x25'),_0x4a16e8,_0x4e545b[_0xd1f2('0x28')]['message']);return _0x2424bf(_0x4e545b[_0xd1f2('0x28')][_0xd1f2('0x2a')]);}logger['error'](_0xd1f2('0x25'),_0x4a16e8,_0x4e545b['error'][_0xd1f2('0x2a')]);return _0x46ea17(_0x4e545b[_0xd1f2('0x28')][_0xd1f2('0x2a')]);}else{logger[_0xd1f2('0x24')](_0xd1f2('0x25'),_0x4a16e8,_0xd1f2('0x26'));_0x46ea17(_0x4e545b['result']['message']);}})[_0xd1f2('0x2b')](function(_0x44a754){logger[_0xd1f2('0x28')](_0xd1f2('0x25'),_0x4a16e8,_0x44a754);_0x2424bf(_0x44a754);});});}function respondWithStatusCode(_0xac8cc3,_0x48911d){_0x48911d=_0x48911d||0xcc;return function(_0x488ffb){if(_0x488ffb){return _0xac8cc3[_0xd1f2('0x2c')](_0x48911d);}return _0xac8cc3['status'](_0x48911d)[_0xd1f2('0x2d')]();};}function respondWithResult(_0x4df5b1,_0xedfd01){_0xedfd01=_0xedfd01||0xc8;return function(_0xa9eb0c){if(_0xa9eb0c){return _0x4df5b1[_0xd1f2('0x2e')](_0xedfd01)[_0xd1f2('0x2f')](_0xa9eb0c);}};}function respondWithFilteredResult(_0x48ac73,_0x3dbd10){return function(_0x9abcbe){if(_0x9abcbe){var _0x302a22=_0x9abcbe[_0xd1f2('0x30')],_0x2d6f43=_0x3dbd10['offset'],_0x2ba574=_0x3dbd10[_0xd1f2('0x31')]+_0x3dbd10[_0xd1f2('0x32')],_0x12ac93;if(_0x2ba574>=_0x302a22){_0x2ba574=_0x302a22;_0x12ac93=0xc8;}else{_0x12ac93=0xce;}_0x48ac73['status'](_0x12ac93);return _0x48ac73[_0xd1f2('0x33')]('Content-Range',_0x2d6f43+'-'+_0x2ba574+'/'+_0x302a22)[_0xd1f2('0x2f')](_0x9abcbe);}return null;};}function patchUpdates(_0x3cdd12){return function(_0x26dbb2){try{jsonpatch[_0xd1f2('0x34')](_0x26dbb2,_0x3cdd12,!![]);}catch(_0x2f9e17){return BPromise['reject'](_0x2f9e17);}return _0x26dbb2[_0xd1f2('0x35')]();};}function saveUpdates(_0x44f3f5,_0x3cd8d1){return function(_0x5025be){if(_0x5025be){return _0x5025be[_0xd1f2('0x36')](_0x44f3f5)[_0xd1f2('0x23')](function(_0x1448c5){return _0x1448c5;});}return null;};}function removeEntity(_0x4489a4,_0x2456d9){return function(_0x5a801b){if(_0x5a801b){return _0x5a801b['destroy']()[_0xd1f2('0x23')](function(){_0x4489a4[_0xd1f2('0x2e')](0xcc)[_0xd1f2('0x2d')]();});}};}function handleEntityNotFound(_0x33bd71,_0x499a51){return function(_0x34ed61){if(!_0x34ed61){_0x33bd71['sendStatus'](0x194);}return _0x34ed61;};}function handleError(_0x4c8577,_0x179f2d){_0x179f2d=_0x179f2d||0x1f4;return function(_0x26a637){logger[_0xd1f2('0x28')](_0x26a637[_0xd1f2('0x37')]);if(_0x26a637[_0xd1f2('0x38')]){delete _0x26a637[_0xd1f2('0x38')];}_0x4c8577[_0xd1f2('0x2e')](_0x179f2d)[_0xd1f2('0x39')](_0x26a637);};}exports[_0xd1f2('0x3a')]=function(_0x352076,_0x54cc61){var _0x20d958={},_0xe964a3={},_0x503c1f={'count':0x0,'rows':[]};var _0x25a1be=_[_0xd1f2('0x3b')](db[_0xd1f2('0x3c')]['rawAttributes'],function(_0x55b0e5){return{'name':_0x55b0e5['fieldName'],'type':_0x55b0e5[_0xd1f2('0x3d')][_0xd1f2('0x3e')]};});_0xe964a3['model']=_[_0xd1f2('0x3b')](_0x25a1be,_0xd1f2('0x38'));_0xe964a3[_0xd1f2('0x3f')]=_[_0xd1f2('0x40')](_0x352076[_0xd1f2('0x3f')]);_0xe964a3[_0xd1f2('0x41')]=_['intersection'](_0xe964a3[_0xd1f2('0x42')],_0xe964a3[_0xd1f2('0x3f')]);_0x20d958[_0xd1f2('0x43')]=_[_0xd1f2('0x44')](_0xe964a3[_0xd1f2('0x42')],qs['fields'](_0x352076[_0xd1f2('0x3f')][_0xd1f2('0x45')]));_0x20d958[_0xd1f2('0x43')]=_0x20d958[_0xd1f2('0x43')]['length']?_0x20d958[_0xd1f2('0x43')]:_0xe964a3[_0xd1f2('0x42')];if(!_0x352076[_0xd1f2('0x3f')]['hasOwnProperty'](_0xd1f2('0x46'))){_0x20d958['limit']=qs['limit'](_0x352076[_0xd1f2('0x3f')][_0xd1f2('0x32')]);_0x20d958[_0xd1f2('0x31')]=qs[_0xd1f2('0x31')](_0x352076['query'][_0xd1f2('0x31')]);}_0x20d958[_0xd1f2('0x47')]=qs[_0xd1f2('0x48')](_0x352076[_0xd1f2('0x3f')][_0xd1f2('0x48')]);_0x20d958['where']=qs[_0xd1f2('0x41')](_[_0xd1f2('0x49')](_0x352076[_0xd1f2('0x3f')],_0xe964a3['filters']),_0x25a1be);if(_0x352076[_0xd1f2('0x3f')][_0xd1f2('0x4a')]){_0x20d958[_0xd1f2('0x4b')]=_['merge'](_0x20d958['where'],{'$or':_[_0xd1f2('0x3b')](_0x25a1be,function(_0x3ec15a){if(_0x3ec15a[_0xd1f2('0x3d')]!==_0xd1f2('0x4c')){var _0x3cef9c={};_0x3cef9c[_0x3ec15a['name']]={'$like':'%'+_0x352076[_0xd1f2('0x3f')][_0xd1f2('0x4a')]+'%'};return _0x3cef9c;}})});}_0x20d958=_[_0xd1f2('0x4d')]({},_0x20d958,_0x352076[_0xd1f2('0x4e')]);var _0x146b6f={'where':_0x20d958[_0xd1f2('0x4b')]};return db[_0xd1f2('0x3c')]['count'](_0x146b6f)[_0xd1f2('0x23')](function(_0x20c444){_0x503c1f[_0xd1f2('0x30')]=_0x20c444;if(_0x352076[_0xd1f2('0x3f')][_0xd1f2('0x4f')]){_0x20d958['include']=[{'all':!![]}];}return db[_0xd1f2('0x3c')]['findAll'](_0x20d958);})[_0xd1f2('0x23')](function(_0x3ff2b7){_0x503c1f[_0xd1f2('0x50')]=_0x3ff2b7;return _0x503c1f;})[_0xd1f2('0x23')](respondWithFilteredResult(_0x54cc61,_0x20d958))['catch'](handleError(_0x54cc61,null));};exports[_0xd1f2('0x51')]=function(_0x3e6039,_0x353de3){var _0x299728={'raw':!![],'where':{'id':_0x3e6039['params']['id']}},_0x292e66={};_0x292e66['model']=_[_0xd1f2('0x40')](db[_0xd1f2('0x3c')][_0xd1f2('0x52')]);_0x292e66['query']=_['keys'](_0x3e6039[_0xd1f2('0x3f')]);_0x292e66[_0xd1f2('0x41')]=_[_0xd1f2('0x44')](_0x292e66[_0xd1f2('0x42')],_0x292e66[_0xd1f2('0x3f')]);_0x299728[_0xd1f2('0x43')]=_[_0xd1f2('0x44')](_0x292e66['model'],qs[_0xd1f2('0x45')](_0x3e6039[_0xd1f2('0x3f')][_0xd1f2('0x45')]));_0x299728[_0xd1f2('0x43')]=_0x299728[_0xd1f2('0x43')][_0xd1f2('0x53')]?_0x299728[_0xd1f2('0x43')]:_0x292e66[_0xd1f2('0x42')];if(_0x3e6039['query'][_0xd1f2('0x4f')]){_0x299728['include']=[{'all':!![]}];}_0x299728=_[_0xd1f2('0x4d')]({},_0x299728,_0x3e6039[_0xd1f2('0x4e')]);return db['OpenchannelMessage'][_0xd1f2('0x54')](_0x299728)[_0xd1f2('0x23')](handleEntityNotFound(_0x353de3,null))['then'](respondWithResult(_0x353de3,null))['catch'](handleError(_0x353de3,null));};exports[_0xd1f2('0x55')]=function(_0x5714c9,_0x3b4e02){return db[_0xd1f2('0x3c')]['create'](_0x5714c9[_0xd1f2('0x56')],{})[_0xd1f2('0x23')](respondWithResult(_0x3b4e02,0xc9))[_0xd1f2('0x2b')](handleError(_0x3b4e02,null));};exports[_0xd1f2('0x36')]=function(_0x60f64a,_0x3cfaf3){if(_0x60f64a['body']['id']){delete _0x60f64a['body']['id'];}return db[_0xd1f2('0x3c')]['find']({'where':{'id':_0x60f64a[_0xd1f2('0x57')]['id']}})[_0xd1f2('0x23')](handleEntityNotFound(_0x3cfaf3,null))['then'](saveUpdates(_0x60f64a[_0xd1f2('0x56')],null))[_0xd1f2('0x23')](respondWithResult(_0x3cfaf3,null))[_0xd1f2('0x2b')](handleError(_0x3cfaf3,null));};exports[_0xd1f2('0x58')]=function(_0x35a7b6,_0x132bc0){return db[_0xd1f2('0x3c')][_0xd1f2('0x54')]({'where':{'id':_0x35a7b6['params']['id']}})[_0xd1f2('0x23')](handleEntityNotFound(_0x132bc0,null))[_0xd1f2('0x23')](removeEntity(_0x132bc0,null))[_0xd1f2('0x2b')](handleError(_0x132bc0,null));};exports[_0xd1f2('0x59')]=function(_0x461527,_0x27e655){return db[_0xd1f2('0x3c')]['describe']()[_0xd1f2('0x23')](respondWithResult(_0x27e655,null))[_0xd1f2('0x2b')](handleError(_0x27e655,null));};var interaction_log=require(_0xd1f2('0x13'))(_0xd1f2('0x5a'));exports[_0xd1f2('0x5b')]=function(_0x3e511b,_0xdf36db,_0xffc18c){var _0x4ffa4c={'channel':_0xd1f2('0x5c')};if(_0x3e511b[_0xd1f2('0x56')]['id']){delete _0x3e511b[_0xd1f2('0x56')]['id'];}_0x3e511b[_0xd1f2('0x56')]['read']=!![];_0x3e511b[_0xd1f2('0x56')]['readAt']=moment()['format'](_0xd1f2('0x5d'));_0x3e511b['body'][_0xd1f2('0x5e')]=_0x3e511b[_0xd1f2('0x56')][_0xd1f2('0x5e')]||_0x3e511b['user']['id'];return db[_0xd1f2('0x3c')][_0xd1f2('0x54')]({'where':{'id':_0x3e511b[_0xd1f2('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xd1f2('0x5f')],'as':_0xd1f2('0x60')}]})[_0xd1f2('0x23')](handleEntityNotFound(_0xdf36db,null))['then'](saveUpdates(_0x3e511b[_0xd1f2('0x56')],null))['then'](function(_0x5ce6ea){if(_0x5ce6ea){_0x4ffa4c[_0xd1f2('0x2a')]=_0x5ce6ea[_0xd1f2('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0xd1f2('0x54')]({'where':{'id':_0x5ce6ea[_0xd1f2('0x62')]}});}return null;})[_0xd1f2('0x23')](handleEntityNotFound(_0xdf36db,null))['then'](function(_0x157ee4){if(_0x157ee4){return _0x157ee4[_0xd1f2('0x36')]({'UserId':_0x3e511b['body'][_0xd1f2('0x5e')],'read1stAt':_['isNil'](_0x157ee4['read1stAt'])?moment()[_0xd1f2('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd1f2('0x23')](function(_0x2bbbd6){if(_0x2bbbd6){_0x4ffa4c[_0xd1f2('0x64')]=_0x2bbbd6['get']({'plain':!![]});interaction_log[_0xd1f2('0x24')](_0xd1f2('0x65'),_0x3e511b['user']['id'],_0x3e511b[_0xd1f2('0x66')]['name'],_0x3e511b[_0xd1f2('0x66')][_0xd1f2('0x67')],_0x4ffa4c[_0xd1f2('0x64')]['id'],_0x3e511b[_0xd1f2('0x56')]?JSON['stringify'](_0x3e511b[_0xd1f2('0x56')]):_0xd1f2('0x68'));return respondWithRpcPromise(_0xd1f2('0x69'),_0xd1f2('0x6a'),_0x4ffa4c);}return null;})[_0xd1f2('0x23')](function(_0x28f7a1){if(_0x28f7a1){if(_0x3e511b[_0xd1f2('0x56')]['manual']){_0x4ffa4c[_0xd1f2('0x2a')]['interface']=util[_0xd1f2('0x63')]('SIP/%s',_0x3e511b[_0xd1f2('0x66')][_0xd1f2('0x38')]);_0x4ffa4c[_0xd1f2('0x2a')][_0xd1f2('0x6b')]=_0x4ffa4c[_0xd1f2('0x6b')];_0x4ffa4c[_0xd1f2('0x2a')][_0xd1f2('0x6c')]=_0xd1f2('0x5b');return respondWithRpcPromise(_0xd1f2('0x6d'),_0xd1f2('0x6d'),{'event':_0xd1f2('0x6e'),'message':_0x4ffa4c[_0xd1f2('0x2a')]},client9002)[_0xd1f2('0x23')](function(){return _0x4ffa4c;});}return _0x4ffa4c;}return null;})[_0xd1f2('0x23')](respondWithResult(_0xdf36db,null))[_0xd1f2('0x2b')](handleError(_0xdf36db,null));};var interaction_log=require(_0xd1f2('0x13'))(_0xd1f2('0x5a'));exports[_0xd1f2('0x6f')]=function(_0x3e2fd3,_0x9e06c6,_0x1000fc){var _0x4d41da={'agent':{},'channel':_0xd1f2('0x5c')};if(_0x3e2fd3[_0xd1f2('0x56')]['id']){delete _0x3e2fd3['body']['id'];}_0x3e2fd3[_0xd1f2('0x56')][_0xd1f2('0x5e')]=_0x3e2fd3[_0xd1f2('0x56')][_0xd1f2('0x5e')]||_0x3e2fd3[_0xd1f2('0x66')]['id'];_0x4d41da[_0xd1f2('0x70')]['id']=_0x3e2fd3[_0xd1f2('0x56')]['UserId'];return db[_0xd1f2('0x3c')][_0xd1f2('0x54')]({'where':{'id':_0x3e2fd3[_0xd1f2('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x9e06c6,null))[_0xd1f2('0x23')](function(_0x4500eb){if(_0x4500eb){_0x4d41da[_0xd1f2('0x2a')]=_0x4500eb['get']({'plain':!![]});return db[_0xd1f2('0x71')][_0xd1f2('0x54')]({'where':{'id':_0x4500eb[_0xd1f2('0x62')]}});}return null;})[_0xd1f2('0x23')](handleEntityNotFound(_0x9e06c6,null))['then'](function(_0x4b69cc){if(_0x4b69cc){_0x4d41da[_0xd1f2('0x64')]=_0x4b69cc[_0xd1f2('0x61')]({'plain':!![]});interaction_log['info'](_0xd1f2('0x72'),_0x3e2fd3[_0xd1f2('0x66')]['id'],_0x3e2fd3[_0xd1f2('0x66')][_0xd1f2('0x38')],_0x3e2fd3['user'][_0xd1f2('0x67')],_0x4d41da[_0xd1f2('0x64')]['id'],_0x3e2fd3[_0xd1f2('0x56')]?JSON['stringify'](_0x3e2fd3[_0xd1f2('0x56')]):_0xd1f2('0x68'));return respondWithRpcPromise(_0xd1f2('0x73'),_0xd1f2('0x74'),_0x4d41da);}return null;})[_0xd1f2('0x23')](function(_0x3f9ede){if(_0x3f9ede){_0x3f9ede['message'][_0xd1f2('0x75')]=util['format'](_0xd1f2('0x76'),_0x3e2fd3['user'][_0xd1f2('0x38')]);_0x3f9ede[_0xd1f2('0x2a')][_0xd1f2('0x6b')]=_0x4d41da['channel'];_0x3f9ede[_0xd1f2('0x2a')][_0xd1f2('0x6c')]=_0xd1f2('0x6f');respondWithRpcPromise(_0xd1f2('0x6d'),_0xd1f2('0x6d'),{'event':'rejectmessage','message':_0x3f9ede['message']},client9002);return _0x4d41da;}return null;})['then'](respondWithResult(_0x9e06c6,null))[_0xd1f2('0x2b')](handleError(_0x9e06c6,null));}; \ No newline at end of file +var _0x9b64=['http','client','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~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','status','end','json','count','offset','set','Content-Range','apply','update','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','create','body','params','find','describe','../../config/logger','accept','openchannel','read','readAt','format','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelMessage.socket','register'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x9b64,0x149));var _0x49b6=function(_0x5e8965,_0x744744){_0x5e8965=_0x5e8965-0x0;var _0x5efd03=_0x9b64[_0x5e8965];return _0x5efd03;};'use strict';var pdf=require(_0x49b6('0x0'));var emlformat=require(_0x49b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x49b6('0x2'));var jsonpatch=require(_0x49b6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x49b6('0x4'));var util=require(_0x49b6('0x5'));var path=require(_0x49b6('0x6'));var sox=require(_0x49b6('0x7'));var csv=require(_0x49b6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x49b6('0x9'));var squel=require(_0x49b6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x49b6('0xb'));var toCsv=require(_0x49b6('0x8'));var querystring=require(_0x49b6('0xc'));var Papa=require(_0x49b6('0xd'));var Redis=require(_0x49b6('0xe'));var authService=require(_0x49b6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49b6('0x10'));var logger=require('../../config/logger')(_0x49b6('0x11'));var utils=require(_0x49b6('0x12'));var config=require(_0x49b6('0x13'));var db=require('../../mysqldb')['db'];config[_0x49b6('0x14')]=_[_0x49b6('0x15')](config[_0x49b6('0x14')],{'host':_0x49b6('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49b6('0x14')]));require(_0x49b6('0x17'))[_0x49b6('0x18')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x49b6('0x19')]({'port':0x232c});var client9002=jayson[_0x49b6('0x1a')][_0x49b6('0x19')]({'port':0x232a});function checkPasswordPattern(_0x54e75d,_0x21b74c,_0x3e29ee){if(_0x3e29ee){var _0x3b3045=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b3045['test'](_0x21b74c)){return _0x54e75d;}else{throw new db[(_0x49b6('0x1b'))]['ValidationError'](_0x49b6('0x1c'));}}else{return _0x54e75d;}}function respondWithRpcPromise(_0x767f77,_0x505a75,_0xad9378,_0x3114c7){return new BPromise(function(_0x430c3d,_0x3a95bd){var _0x48cacf=_0x3114c7||client;return _0x48cacf[_0x49b6('0x1d')](_0x767f77,_0xad9378)[_0x49b6('0x1e')](function(_0x18cb19){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x505a75,_0x49b6('0x1f'));logger[_0x49b6('0x20')](_0x49b6('0x21'),_0x505a75,_0x49b6('0x1f'),JSON[_0x49b6('0x22')](_0x18cb19));if(_0x18cb19[_0x49b6('0x23')]){if(_0x18cb19['error']['code']===0x1f4){logger['error'](_0x49b6('0x24'),_0x505a75,_0x18cb19[_0x49b6('0x23')][_0x49b6('0x25')]);return _0x3a95bd(_0x18cb19[_0x49b6('0x23')][_0x49b6('0x25')]);}logger[_0x49b6('0x23')](_0x49b6('0x24'),_0x505a75,_0x18cb19[_0x49b6('0x23')]['message']);return _0x430c3d(_0x18cb19[_0x49b6('0x23')]['message']);}else{logger[_0x49b6('0x26')](_0x49b6('0x24'),_0x505a75,_0x49b6('0x1f'));_0x430c3d(_0x18cb19[_0x49b6('0x27')][_0x49b6('0x25')]);}})[_0x49b6('0x28')](function(_0x49e342){logger[_0x49b6('0x23')](_0x49b6('0x24'),_0x505a75,_0x49e342);_0x3a95bd(_0x49e342);});});}function respondWithStatusCode(_0x2750e5,_0x4ef1ee){_0x4ef1ee=_0x4ef1ee||0xcc;return function(_0x2965c7){if(_0x2965c7){return _0x2750e5['sendStatus'](_0x4ef1ee);}return _0x2750e5[_0x49b6('0x29')](_0x4ef1ee)[_0x49b6('0x2a')]();};}function respondWithResult(_0x4b0d9f,_0x509985){_0x509985=_0x509985||0xc8;return function(_0xc74388){if(_0xc74388){return _0x4b0d9f['status'](_0x509985)[_0x49b6('0x2b')](_0xc74388);}};}function respondWithFilteredResult(_0x387f76,_0x5b945b){return function(_0x4c1523){if(_0x4c1523){var _0x52425a=_0x4c1523[_0x49b6('0x2c')],_0x49f4e2=_0x5b945b[_0x49b6('0x2d')],_0x12388a=_0x5b945b['offset']+_0x5b945b['limit'],_0x3fda53;if(_0x12388a>=_0x52425a){_0x12388a=_0x52425a;_0x3fda53=0xc8;}else{_0x3fda53=0xce;}_0x387f76[_0x49b6('0x29')](_0x3fda53);return _0x387f76[_0x49b6('0x2e')](_0x49b6('0x2f'),_0x49f4e2+'-'+_0x12388a+'/'+_0x52425a)['json'](_0x4c1523);}return null;};}function patchUpdates(_0x562977){return function(_0x1a7be7){try{jsonpatch[_0x49b6('0x30')](_0x1a7be7,_0x562977,!![]);}catch(_0x184695){return BPromise['reject'](_0x184695);}return _0x1a7be7['save']();};}function saveUpdates(_0x17fc28,_0x1b06f4){return function(_0x1f9b33){if(_0x1f9b33){return _0x1f9b33[_0x49b6('0x31')](_0x17fc28)['then'](function(_0x3e6272){return _0x3e6272;});}return null;};}function removeEntity(_0x1029ea,_0x25c18b){return function(_0x236d95){if(_0x236d95){return _0x236d95[_0x49b6('0x32')]()[_0x49b6('0x1e')](function(){_0x1029ea[_0x49b6('0x29')](0xcc)[_0x49b6('0x2a')]();});}};}function handleEntityNotFound(_0x3bf811,_0x5912aa){return function(_0x15b8ab){if(!_0x15b8ab){_0x3bf811[_0x49b6('0x33')](0x194);}return _0x15b8ab;};}function handleError(_0x49ca23,_0x247d42){_0x247d42=_0x247d42||0x1f4;return function(_0x4d63e6){logger[_0x49b6('0x23')](_0x4d63e6[_0x49b6('0x34')]);if(_0x4d63e6[_0x49b6('0x35')]){delete _0x4d63e6['name'];}_0x49ca23['status'](_0x247d42)[_0x49b6('0x36')](_0x4d63e6);};}exports[_0x49b6('0x37')]=function(_0x2e4d69,_0x12e1db){var _0x5e37e7={},_0x234764={},_0x384850={'count':0x0,'rows':[]};var _0x4d17d3=_[_0x49b6('0x38')](db[_0x49b6('0x39')][_0x49b6('0x3a')],function(_0x512a3c){return{'name':_0x512a3c[_0x49b6('0x3b')],'type':_0x512a3c[_0x49b6('0x3c')][_0x49b6('0x3d')]};});_0x234764[_0x49b6('0x3e')]=_[_0x49b6('0x38')](_0x4d17d3,_0x49b6('0x35'));_0x234764[_0x49b6('0x3f')]=_[_0x49b6('0x40')](_0x2e4d69[_0x49b6('0x3f')]);_0x234764['filters']=_[_0x49b6('0x41')](_0x234764[_0x49b6('0x3e')],_0x234764[_0x49b6('0x3f')]);_0x5e37e7[_0x49b6('0x42')]=_[_0x49b6('0x41')](_0x234764[_0x49b6('0x3e')],qs[_0x49b6('0x43')](_0x2e4d69[_0x49b6('0x3f')]['fields']));_0x5e37e7[_0x49b6('0x42')]=_0x5e37e7[_0x49b6('0x42')][_0x49b6('0x44')]?_0x5e37e7[_0x49b6('0x42')]:_0x234764[_0x49b6('0x3e')];if(!_0x2e4d69[_0x49b6('0x3f')]['hasOwnProperty'](_0x49b6('0x45'))){_0x5e37e7[_0x49b6('0x46')]=qs[_0x49b6('0x46')](_0x2e4d69[_0x49b6('0x3f')]['limit']);_0x5e37e7['offset']=qs[_0x49b6('0x2d')](_0x2e4d69[_0x49b6('0x3f')]['offset']);}_0x5e37e7[_0x49b6('0x47')]=qs[_0x49b6('0x48')](_0x2e4d69['query'][_0x49b6('0x48')]);_0x5e37e7[_0x49b6('0x49')]=qs[_0x49b6('0x4a')](_[_0x49b6('0x4b')](_0x2e4d69[_0x49b6('0x3f')],_0x234764[_0x49b6('0x4a')]),_0x4d17d3);if(_0x2e4d69['query'][_0x49b6('0x4c')]){_0x5e37e7[_0x49b6('0x49')]=_[_0x49b6('0x4d')](_0x5e37e7[_0x49b6('0x49')],{'$or':_[_0x49b6('0x38')](_0x4d17d3,function(_0x4d5842){if(_0x4d5842['type']!==_0x49b6('0x4e')){var _0x56c6fa={};_0x56c6fa[_0x4d5842['name']]={'$like':'%'+_0x2e4d69[_0x49b6('0x3f')]['filter']+'%'};return _0x56c6fa;}})});}_0x5e37e7=_['merge']({},_0x5e37e7,_0x2e4d69[_0x49b6('0x4f')]);var _0x35a3c7={'where':_0x5e37e7['where']};return db[_0x49b6('0x39')][_0x49b6('0x2c')](_0x35a3c7)[_0x49b6('0x1e')](function(_0x3b34f1){_0x384850[_0x49b6('0x2c')]=_0x3b34f1;if(_0x2e4d69[_0x49b6('0x3f')][_0x49b6('0x50')]){_0x5e37e7['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x5e37e7);})[_0x49b6('0x1e')](function(_0x162565){_0x384850[_0x49b6('0x51')]=_0x162565;return _0x384850;})[_0x49b6('0x1e')](respondWithFilteredResult(_0x12e1db,_0x5e37e7))['catch'](handleError(_0x12e1db,null));};exports[_0x49b6('0x52')]=function(_0x3eb8ad,_0x4d7316){var _0x59f7a5={'raw':!![],'where':{'id':_0x3eb8ad['params']['id']}},_0xd475ed={};_0xd475ed[_0x49b6('0x3e')]=_[_0x49b6('0x40')](db[_0x49b6('0x39')][_0x49b6('0x3a')]);_0xd475ed['query']=_[_0x49b6('0x40')](_0x3eb8ad[_0x49b6('0x3f')]);_0xd475ed[_0x49b6('0x4a')]=_['intersection'](_0xd475ed[_0x49b6('0x3e')],_0xd475ed[_0x49b6('0x3f')]);_0x59f7a5[_0x49b6('0x42')]=_[_0x49b6('0x41')](_0xd475ed['model'],qs[_0x49b6('0x43')](_0x3eb8ad[_0x49b6('0x3f')]['fields']));_0x59f7a5[_0x49b6('0x42')]=_0x59f7a5['attributes']['length']?_0x59f7a5[_0x49b6('0x42')]:_0xd475ed[_0x49b6('0x3e')];if(_0x3eb8ad['query'][_0x49b6('0x50')]){_0x59f7a5['include']=[{'all':!![]}];}_0x59f7a5=_[_0x49b6('0x4d')]({},_0x59f7a5,_0x3eb8ad[_0x49b6('0x4f')]);return db['OpenchannelMessage']['find'](_0x59f7a5)['then'](handleEntityNotFound(_0x4d7316,null))['then'](respondWithResult(_0x4d7316,null))[_0x49b6('0x28')](handleError(_0x4d7316,null));};exports[_0x49b6('0x53')]=function(_0x4b6072,_0x184ceb){return db[_0x49b6('0x39')][_0x49b6('0x53')](_0x4b6072[_0x49b6('0x54')],{})['then'](respondWithResult(_0x184ceb,0xc9))[_0x49b6('0x28')](handleError(_0x184ceb,null));};exports['update']=function(_0x1b3baa,_0x4de6d5){if(_0x1b3baa[_0x49b6('0x54')]['id']){delete _0x1b3baa['body']['id'];}return db[_0x49b6('0x39')]['find']({'where':{'id':_0x1b3baa[_0x49b6('0x55')]['id']}})[_0x49b6('0x1e')](handleEntityNotFound(_0x4de6d5,null))[_0x49b6('0x1e')](saveUpdates(_0x1b3baa[_0x49b6('0x54')],null))[_0x49b6('0x1e')](respondWithResult(_0x4de6d5,null))[_0x49b6('0x28')](handleError(_0x4de6d5,null));};exports['destroy']=function(_0x5a5ab8,_0x3a112c){return db[_0x49b6('0x39')][_0x49b6('0x56')]({'where':{'id':_0x5a5ab8[_0x49b6('0x55')]['id']}})[_0x49b6('0x1e')](handleEntityNotFound(_0x3a112c,null))[_0x49b6('0x1e')](removeEntity(_0x3a112c,null))['catch'](handleError(_0x3a112c,null));};exports[_0x49b6('0x57')]=function(_0x2b1dec,_0x5d2179){return db[_0x49b6('0x39')][_0x49b6('0x57')]()['then'](respondWithResult(_0x5d2179,null))['catch'](handleError(_0x5d2179,null));};var interaction_log=require(_0x49b6('0x58'))('openchannel-interactions');exports[_0x49b6('0x59')]=function(_0xa70707,_0x39b7bf,_0x4e9599){var _0x4e3f80={'channel':_0x49b6('0x5a')};if(_0xa70707[_0x49b6('0x54')]['id']){delete _0xa70707[_0x49b6('0x54')]['id'];}_0xa70707['body'][_0x49b6('0x5b')]=!![];_0xa70707[_0x49b6('0x54')][_0x49b6('0x5c')]=moment()[_0x49b6('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0xa70707['body'][_0x49b6('0x5e')]=_0xa70707['body']['UserId']||_0xa70707[_0x49b6('0x5f')]['id'];return db[_0x49b6('0x39')][_0x49b6('0x56')]({'where':{'id':_0xa70707[_0x49b6('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x49b6('0x60')],'as':_0x49b6('0x61')}]})[_0x49b6('0x1e')](handleEntityNotFound(_0x39b7bf,null))['then'](saveUpdates(_0xa70707['body'],null))[_0x49b6('0x1e')](function(_0x59021a){if(_0x59021a){_0x4e3f80[_0x49b6('0x25')]=_0x59021a[_0x49b6('0x62')]({'plain':!![]});return db[_0x49b6('0x63')][_0x49b6('0x56')]({'where':{'id':_0x59021a[_0x49b6('0x64')]}});}return null;})[_0x49b6('0x1e')](handleEntityNotFound(_0x39b7bf,null))[_0x49b6('0x1e')](function(_0xe77dae){if(_0xe77dae){return _0xe77dae[_0x49b6('0x31')]({'UserId':_0xa70707[_0x49b6('0x54')][_0x49b6('0x5e')],'read1stAt':_['isNil'](_0xe77dae[_0x49b6('0x65')])?moment()[_0x49b6('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x550a18){if(_0x550a18){_0x4e3f80[_0x49b6('0x66')]=_0x550a18[_0x49b6('0x62')]({'plain':!![]});interaction_log['info'](_0x49b6('0x67'),_0xa70707[_0x49b6('0x5f')]['id'],_0xa70707['user'][_0x49b6('0x35')],_0xa70707[_0x49b6('0x5f')]['role'],_0x4e3f80['interaction']['id'],_0xa70707[_0x49b6('0x54')]?JSON[_0x49b6('0x22')](_0xa70707[_0x49b6('0x54')]):_0x49b6('0x68'));return respondWithRpcPromise('AcceptMessage',_0x49b6('0x69'),_0x4e3f80);}return null;})[_0x49b6('0x1e')](function(_0x466be5){if(_0x466be5){if(_0xa70707[_0x49b6('0x54')][_0x49b6('0x6a')]){_0x4e3f80['message'][_0x49b6('0x6b')]=util['format'](_0x49b6('0x6c'),_0xa70707['user'][_0x49b6('0x35')]);_0x4e3f80[_0x49b6('0x25')][_0x49b6('0x6d')]=_0x4e3f80[_0x49b6('0x6d')];_0x4e3f80[_0x49b6('0x25')][_0x49b6('0x6e')]=_0x49b6('0x59');return respondWithRpcPromise(_0x49b6('0x6f'),_0x49b6('0x6f'),{'event':_0x49b6('0x70'),'message':_0x4e3f80[_0x49b6('0x25')]},client9002)[_0x49b6('0x1e')](function(){return _0x4e3f80;});}return _0x4e3f80;}return null;})[_0x49b6('0x1e')](respondWithResult(_0x39b7bf,null))[_0x49b6('0x28')](handleError(_0x39b7bf,null));};var interaction_log=require(_0x49b6('0x58'))('openchannel-interactions');exports['reject']=function(_0x53d0f2,_0x41ad61,_0x4935af){var _0x1d97c8={'agent':{},'channel':_0x49b6('0x5a')};if(_0x53d0f2[_0x49b6('0x54')]['id']){delete _0x53d0f2[_0x49b6('0x54')]['id'];}_0x53d0f2[_0x49b6('0x54')][_0x49b6('0x5e')]=_0x53d0f2[_0x49b6('0x54')][_0x49b6('0x5e')]||_0x53d0f2['user']['id'];_0x1d97c8[_0x49b6('0x71')]['id']=_0x53d0f2[_0x49b6('0x54')][_0x49b6('0x5e')];return db[_0x49b6('0x39')][_0x49b6('0x56')]({'where':{'id':_0x53d0f2['params']['id'],'UserId':null}})[_0x49b6('0x1e')](handleEntityNotFound(_0x41ad61,null))['then'](function(_0x10e256){if(_0x10e256){_0x1d97c8[_0x49b6('0x25')]=_0x10e256['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x10e256[_0x49b6('0x64')]}});}return null;})[_0x49b6('0x1e')](handleEntityNotFound(_0x41ad61,null))[_0x49b6('0x1e')](function(_0x131daf){if(_0x131daf){_0x1d97c8['interaction']=_0x131daf[_0x49b6('0x62')]({'plain':!![]});interaction_log['info'](_0x49b6('0x72'),_0x53d0f2[_0x49b6('0x5f')]['id'],_0x53d0f2[_0x49b6('0x5f')][_0x49b6('0x35')],_0x53d0f2[_0x49b6('0x5f')]['role'],_0x1d97c8[_0x49b6('0x66')]['id'],_0x53d0f2[_0x49b6('0x54')]?JSON[_0x49b6('0x22')](_0x53d0f2[_0x49b6('0x54')]):_0x49b6('0x68'));return respondWithRpcPromise(_0x49b6('0x73'),_0x49b6('0x74'),_0x1d97c8);}return null;})['then'](function(_0x3331ad){if(_0x3331ad){_0x3331ad[_0x49b6('0x25')][_0x49b6('0x6b')]=util[_0x49b6('0x5d')](_0x49b6('0x6c'),_0x53d0f2[_0x49b6('0x5f')][_0x49b6('0x35')]);_0x3331ad['message']['channel']=_0x1d97c8[_0x49b6('0x6d')];_0x3331ad[_0x49b6('0x25')][_0x49b6('0x6e')]='reject';respondWithRpcPromise(_0x49b6('0x6f'),_0x49b6('0x6f'),{'event':_0x49b6('0x75'),'message':_0x3331ad[_0x49b6('0x25')]},client9002);return _0x1d97c8;}return null;})[_0x49b6('0x1e')](respondWithResult(_0x41ad61,null))[_0x49b6('0x28')](handleError(_0x41ad61,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 924cf28..0ef79a4 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 _0x3d66=['hook','exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5ecbbc,_0x2541f5){var _0x219a19=function(_0x49d792){while(--_0x49d792){_0x5ecbbc['push'](_0x5ecbbc['shift']());}};_0x219a19(++_0x2541f5);}(_0x3d66,0x16a));var _0x63d6=function(_0x1be949,_0x3f3adc){_0x1be949=_0x1be949-0x0;var _0x44b1ab=_0x3d66[_0x1be949];return _0x44b1ab;};'use strict';var EventEmitter=require(_0x63d6('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x63d6('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x63d6('0x2')](0x0);var events={'afterCreate':_0x63d6('0x3'),'afterUpdate':_0x63d6('0x4'),'afterDestroy':_0x63d6('0x5')};function emitEvent(_0x567ba8){return function(_0x49075d,_0xf88913,_0x52a891){OpenchannelMessageEvents[_0x63d6('0x6')](_0x567ba8+':'+_0x49075d['id'],_0x49075d);OpenchannelMessageEvents[_0x63d6('0x6')](_0x567ba8,_0x49075d);_0x52a891(null);};}for(var e in events){if(events[_0x63d6('0x7')](e)){var event=events[e];OpenchannelMessage[_0x63d6('0x8')](e,emitEvent(event));}}module[_0x63d6('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb4ad=['remove','emit','hasOwnProperty','OpenchannelMessage','setMaxListeners','update'];(function(_0x3e8533,_0x58bfc9){var _0x571f53=function(_0x546626){while(--_0x546626){_0x3e8533['push'](_0x3e8533['shift']());}};_0x571f53(++_0x58bfc9);}(_0xb4ad,0x1ef));var _0xdb4a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb4ad[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0xdb4a('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xdb4a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb4a('0x2'),'afterDestroy':_0xdb4a('0x3')};function emitEvent(_0x18ac19){return function(_0xe4c50d,_0xbf2fc0,_0x413779){OpenchannelMessageEvents['emit'](_0x18ac19+':'+_0xe4c50d['id'],_0xe4c50d);OpenchannelMessageEvents[_0xdb4a('0x4')](_0x18ac19,_0xe4c50d);_0x413779(null);};}for(var e in events){if(events[_0xdb4a('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index cf11835..b25287a 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 _0x0272=['describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Interaction','omit','POST','replyUri','method','GET','format','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelMessage.attributes','exports','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0272,0xe7));var _0x2027=function(_0x17e6cd,_0x441d90){_0x17e6cd=_0x17e6cd-0x0;var _0x5c98cb=_0x0272[_0x17e6cd];return _0x5c98cb;};'use strict';var _=require(_0x2027('0x0'));var util=require(_0x2027('0x1'));var logger=require(_0x2027('0x2'))(_0x2027('0x3'));var moment=require(_0x2027('0x4'));var BPromise=require(_0x2027('0x5'));var rp=require(_0x2027('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2027('0x7'));var attributes=require(_0x2027('0x8'));module[_0x2027('0x9')]=function(_0x3c9ee2,_0x4e2693){return _0x3c9ee2['define']('OpenchannelMessage',attributes,{'tableName':_0x2027('0xa'),'paranoid':![],'indexes':[{'name':_0x2027('0xb'),'fields':[_0x2027('0xc')],'type':_0x2027('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2442b8,_0x9431e0,_0x53d401){var _0x413715=_0x3c9ee2[_0x2027('0xe')];var _0x2f9241=_0x2442b8[_0x2027('0xf')]({'plain':!![]});if(_0x2f9241[_0x2027('0x10')][_0x2027('0x11')]()==='in'||_0x2f9241[_0x2027('0x10')][_0x2027('0x11')]()==='out'&&!_0x2f9241[_0x2027('0x12')]&&!_[_0x2027('0x13')](_0x2f9241[_0x2027('0x14')])){_0x413715[_0x2027('0x15')][_0x2027('0x16')]({'where':{'id':_0x2f9241[_0x2027('0x17')]}})[_0x2027('0x18')](function(_0x87a86){if(_0x87a86){_0x87a86[_0x2027('0x19')]({'lastMsgAt':_0x2f9241['createdAt'],'lastMsgDirection':_0x2f9241[_0x2027('0x10')][_0x2027('0x11')]()});}})[_0x2027('0x1a')](function(_0xa0e159){console[_0x2027('0x1b')](_0xa0e159);});}if(_0x2f9241[_0x2027('0x10')]===_0x2027('0x1c')&&!_0x2f9241[_0x2027('0x12')]){var _0x3f02e2;_0x413715['CmContact'][_0x2027('0x1d')]()['then'](function(_0x2a05d0){return _0x413715[_0x2027('0x1e')][_0x2027('0x1f')]({'where':{'id':_0x2f9241[_0x2027('0x20')]},'include':[{'model':_0x413715[_0x2027('0x15')],'as':_0x2027('0x21'),'where':{'id':_0x2f9241[_0x2027('0x17')]},'limit':0x1,'include':[{'model':_0x413715[_0x2027('0x22')],'as':_0x2027('0x23'),'attributes':_[_0x2027('0x24')](_0x2a05d0)}]}]});})[_0x2027('0x18')](function(_0x332435){_0x3f02e2=_0x332435[_0x2027('0xf')]({'plain':!![]});if(_0x3f02e2&&_0x3f02e2['replyUri']){logger[_0x2027('0x25')](_0x2027('0x26'),_0x2027('0x27'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x2f9241['id'],_0x3f02e2['replyUri']));if(_0x3f02e2['Interactions']&&_0x3f02e2[_0x2027('0x21')]['length']){_0x2f9241[_0x2027('0x28')]=_[_0x2027('0x29')](_0x3f02e2[_0x2027('0x21')][0x0],'Contact');_0x2f9241['Contact']=_0x3f02e2[_0x2027('0x21')][0x0][_0x2027('0x23')];}var _0x9431e0={'method':_0x2027('0x2a'),'uri':encodeURI(_0x3f02e2[_0x2027('0x2b')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x9431e0[_0x2027('0x2c')]){case _0x2027('0x2d'):_0x9431e0['qs']=_0x2f9241;break;case _0x2027('0x2a'):_0x9431e0[_0x2027('0xc')]=_0x2f9241;break;}return rp(_0x9431e0)['then'](function(_0x30ff9b){logger[_0x2027('0x25')](_0x2027('0x26'),'afterCreate',util[_0x2027('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2f9241['id'],_0x3f02e2[_0x2027('0x2b')]));if(_0x30ff9b['body'][_0x2027('0x2f')]&&_0x30ff9b[_0x2027('0xc')][_0x2027('0x2f')]!=_0x2f9241[_0x2027('0x28')][_0x2027('0x2f')]){return _0x413715['OpenchannelInteraction'][_0x2027('0x19')]({'threadId':_0x30ff9b[_0x2027('0xc')][_0x2027('0x2f')]},{'logging':!![],'where':{'id':_0x2f9241[_0x2027('0x28')]['id']}});}else{return;}})['then'](function(){return _0x2442b8[_0x2027('0x19')]({'read':!![]});})[_0x2027('0x1a')](function(_0x71a4ba){logger[_0x2027('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0x2027('0x27'),util[_0x2027('0x30')](_0x71a4ba,{'showHidden':![],'depth':null}));_0x53d401();});}else{_0x53d401();}})[_0x2027('0x31')](function(){_0x53d401();});}else{_0x53d401();}}},'charset':_0x2027('0x32'),'collate':_0x2027('0x33')});}; \ No newline at end of file +var _0x1563=['fti_openchannel_messages','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','CmContact','describe','OpenchannelAccount','find','Interactions','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Interaction','omit','Contact','POST','method','GET','body','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','error','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage'];(function(_0x155b4f,_0x4d1d7d){var _0x1966ac=function(_0x40f24f){while(--_0x40f24f){_0x155b4f['push'](_0x155b4f['shift']());}};_0x1966ac(++_0x4d1d7d);}(_0x1563,0x120));var _0x3156=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x1563[_0x187d80];return _0x498a77;};'use strict';var _=require('lodash');var util=require(_0x3156('0x0'));var logger=require(_0x3156('0x1'))(_0x3156('0x2'));var moment=require(_0x3156('0x3'));var BPromise=require('bluebird');var rp=require(_0x3156('0x4'));var fs=require('fs');var path=require(_0x3156('0x5'));var rimraf=require(_0x3156('0x6'));var config=require(_0x3156('0x7'));var attributes=require(_0x3156('0x8'));module[_0x3156('0x9')]=function(_0x3d56ce,_0x2937a8){return _0x3d56ce[_0x3156('0xa')](_0x3156('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x3156('0xc'),'fields':['body'],'type':_0x3156('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36a4b5,_0x59623a,_0x3189e2){var _0x462e7f=_0x3d56ce['models'];var _0x24ee37=_0x36a4b5[_0x3156('0xe')]({'plain':!![]});if(_0x24ee37['direction'][_0x3156('0xf')]()==='in'||_0x24ee37[_0x3156('0x10')][_0x3156('0xf')]()===_0x3156('0x11')&&!_0x24ee37[_0x3156('0x12')]&&!_[_0x3156('0x13')](_0x24ee37[_0x3156('0x14')])){_0x462e7f[_0x3156('0x15')]['findOne']({'where':{'id':_0x24ee37['OpenchannelInteractionId']}})[_0x3156('0x16')](function(_0x175f6d){if(_0x175f6d){_0x175f6d[_0x3156('0x17')]({'lastMsgAt':_0x24ee37[_0x3156('0x18')],'lastMsgDirection':_0x24ee37['direction'][_0x3156('0xf')]()});}})['catch'](function(_0x2f8868){console['error'](_0x2f8868);});}if(_0x24ee37[_0x3156('0x10')]===_0x3156('0x11')&&!_0x24ee37[_0x3156('0x12')]){var _0x53ebb6;_0x462e7f[_0x3156('0x19')][_0x3156('0x1a')]()[_0x3156('0x16')](function(_0xb4b567){return _0x462e7f[_0x3156('0x1b')][_0x3156('0x1c')]({'where':{'id':_0x24ee37['OpenchannelAccountId']},'include':[{'model':_0x462e7f[_0x3156('0x15')],'as':_0x3156('0x1d'),'where':{'id':_0x24ee37['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x462e7f[_0x3156('0x19')],'as':'Contact','attributes':_[_0x3156('0x1e')](_0xb4b567)}]}]});})[_0x3156('0x16')](function(_0x477bf5){_0x53ebb6=_0x477bf5[_0x3156('0xe')]({'plain':!![]});if(_0x53ebb6&&_0x53ebb6[_0x3156('0x1f')]){logger['info'](_0x3156('0x20'),'afterCreate',util[_0x3156('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x24ee37['id'],_0x53ebb6[_0x3156('0x1f')]));if(_0x53ebb6[_0x3156('0x1d')]&&_0x53ebb6['Interactions']['length']){_0x24ee37[_0x3156('0x22')]=_[_0x3156('0x23')](_0x53ebb6['Interactions'][0x0],'Contact');_0x24ee37['Contact']=_0x53ebb6[_0x3156('0x1d')][0x0][_0x3156('0x24')];}var _0x59623a={'method':_0x3156('0x25'),'uri':encodeURI(_0x53ebb6['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x59623a[_0x3156('0x26')]){case _0x3156('0x27'):_0x59623a['qs']=_0x24ee37;break;case _0x3156('0x25'):_0x59623a[_0x3156('0x28')]=_0x24ee37;break;}return rp(_0x59623a)[_0x3156('0x16')](function(_0x575da){logger[_0x3156('0x29')](_0x3156('0x20'),_0x3156('0x2a'),util[_0x3156('0x21')](_0x3156('0x2b'),_0x24ee37['id'],_0x53ebb6['replyUri']));if(_0x575da[_0x3156('0x28')][_0x3156('0x2c')]&&_0x575da['body'][_0x3156('0x2c')]!=_0x24ee37[_0x3156('0x22')]['threadId']){return _0x462e7f[_0x3156('0x15')]['update']({'threadId':_0x575da[_0x3156('0x28')][_0x3156('0x2c')]},{'logging':!![],'where':{'id':_0x24ee37[_0x3156('0x22')]['id']}});}else{return;}})['then'](function(){return _0x36a4b5['update']({'read':!![]});})[_0x3156('0x2d')](function(_0x1ceb45){logger[_0x3156('0x2e')]('OpenchannelMessage,\x20%s,\x20%s',_0x3156('0x2a'),util[_0x3156('0x2f')](_0x1ceb45,{'showHidden':![],'depth':null}));_0x3189e2();});}else{_0x3189e2();}})[_0x3156('0x30')](function(){_0x3189e2();});}else{_0x3189e2();}}},'charset':'utf8mb4','collate':_0x3156('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 43226f4..0b55e53 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 _0x6a83=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelMessage','create','body','options','raw'];(function(_0x40a73e,_0x14e045){var _0x5814be=function(_0x235e86){while(--_0x235e86){_0x40a73e['push'](_0x40a73e['shift']());}};_0x5814be(++_0x14e045);}(_0x6a83,0xd2));var _0x36a8=function(_0x674bf7,_0x569321){_0x674bf7=_0x674bf7-0x0;var _0x26f323=_0x6a83[_0x674bf7];return _0x26f323;};'use strict';var _=require(_0x36a8('0x0'));var util=require(_0x36a8('0x1'));var moment=require(_0x36a8('0x2'));var BPromise=require(_0x36a8('0x3'));var rs=require(_0x36a8('0x4'));var fs=require('fs');var Redis=require(_0x36a8('0x5'));var db=require(_0x36a8('0x6'))['db'];var utils=require(_0x36a8('0x7'));var logger=require(_0x36a8('0x8'))(_0x36a8('0x9'));var config=require(_0x36a8('0xa'));var jayson=require(_0x36a8('0xb'));var client=jayson[_0x36a8('0xc')][_0x36a8('0xd')]({'port':0x232a});config[_0x36a8('0xe')]=_[_0x36a8('0xf')](config[_0x36a8('0xe')],{'host':_0x36a8('0x10'),'port':0x18eb});var socket=require(_0x36a8('0x11'))(new Redis(config['redis']));require(_0x36a8('0x12'))['register'](socket);function respondWithRpcPromise(_0x345fa4,_0x29923c,_0x48b0fc){return new BPromise(function(_0x23834f,_0x1e5a57){return client['request'](_0x345fa4,_0x48b0fc)[_0x36a8('0x13')](function(_0x3c8c08){logger[_0x36a8('0x14')](_0x36a8('0x15'),_0x29923c,_0x36a8('0x16'));logger[_0x36a8('0x17')](_0x36a8('0x18'),_0x29923c,_0x36a8('0x16'),JSON['stringify'](_0x3c8c08));if(_0x3c8c08[_0x36a8('0x19')]){if(_0x3c8c08[_0x36a8('0x19')][_0x36a8('0x1a')]===0x1f4){logger[_0x36a8('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x29923c,_0x3c8c08['error'][_0x36a8('0x1b')]);return _0x1e5a57(_0x3c8c08[_0x36a8('0x19')][_0x36a8('0x1b')]);}logger[_0x36a8('0x19')](_0x36a8('0x15'),_0x29923c,_0x3c8c08[_0x36a8('0x19')][_0x36a8('0x1b')]);return _0x23834f(_0x3c8c08['error'][_0x36a8('0x1b')]);}else{logger[_0x36a8('0x14')](_0x36a8('0x15'),_0x29923c,'request\x20sent');_0x23834f(_0x3c8c08[_0x36a8('0x1c')]['message']);}})[_0x36a8('0x1d')](function(_0x45889a){logger[_0x36a8('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x29923c,_0x45889a);_0x1e5a57(_0x45889a);});});}exports[_0x36a8('0x1e')]=function(_0x445400){var _0x49b9d8=this;return new Promise(function(_0x21690b,_0x218550){return db['OpenchannelMessage'][_0x36a8('0x1f')](_0x445400[_0x36a8('0x20')],{'raw':_0x445400[_0x36a8('0x21')]?_0x445400[_0x36a8('0x21')][_0x36a8('0x22')]===undefined?!![]:![]:!![]})[_0x36a8('0x13')](function(_0x50ab05){logger[_0x36a8('0x14')](_0x36a8('0x1e'),_0x445400);logger['debug']('CreateOpenchannelMessage',_0x445400,JSON['stringify'](_0x50ab05));_0x21690b(_0x50ab05);})[_0x36a8('0x1d')](function(_0x1cb753){logger[_0x36a8('0x19')](_0x36a8('0x1e'),_0x1cb753['message'],_0x445400);_0x218550(_0x49b9d8[_0x36a8('0x19')](0x1f4,_0x1cb753['message']));});});}; \ No newline at end of file +var _0xb145=['defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb145,0xa3));var _0x5b14=function(_0x5b305b,_0x38f785){_0x5b305b=_0x5b305b-0x0;var _0x29072a=_0xb145[_0x5b305b];return _0x29072a;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});config['redis']=_[_0x5b14('0xc')](config[_0x5b14('0xd')],{'host':_0x5b14('0xe'),'port':0x18eb});var socket=require(_0x5b14('0xf'))(new Redis(config[_0x5b14('0xd')]));require('./openchannelMessage.socket')[_0x5b14('0x10')](socket);function respondWithRpcPromise(_0x3bdb54,_0x4a4557,_0x1d8b5f){return new BPromise(function(_0x17047f,_0x1ecffb){return client[_0x5b14('0x11')](_0x3bdb54,_0x1d8b5f)[_0x5b14('0x12')](function(_0x4fb6da){logger[_0x5b14('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x4a4557,_0x5b14('0x14'));logger[_0x5b14('0x15')](_0x5b14('0x16'),_0x4a4557,_0x5b14('0x14'),JSON[_0x5b14('0x17')](_0x4fb6da));if(_0x4fb6da[_0x5b14('0x18')]){if(_0x4fb6da['error'][_0x5b14('0x19')]===0x1f4){logger[_0x5b14('0x18')](_0x5b14('0x1a'),_0x4a4557,_0x4fb6da[_0x5b14('0x18')][_0x5b14('0x1b')]);return _0x1ecffb(_0x4fb6da[_0x5b14('0x18')][_0x5b14('0x1b')]);}logger[_0x5b14('0x18')](_0x5b14('0x1a'),_0x4a4557,_0x4fb6da[_0x5b14('0x18')][_0x5b14('0x1b')]);return _0x17047f(_0x4fb6da[_0x5b14('0x18')]['message']);}else{logger[_0x5b14('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x4a4557,'request\x20sent');_0x17047f(_0x4fb6da['result'][_0x5b14('0x1b')]);}})[_0x5b14('0x1c')](function(_0x3662a7){logger[_0x5b14('0x18')](_0x5b14('0x1a'),_0x4a4557,_0x3662a7);_0x1ecffb(_0x3662a7);});});}exports[_0x5b14('0x1d')]=function(_0x19e6f8){var _0x4a4e60=this;return new Promise(function(_0x525176,_0x4fa079){return db[_0x5b14('0x1e')][_0x5b14('0x1f')](_0x19e6f8[_0x5b14('0x20')],{'raw':_0x19e6f8[_0x5b14('0x21')]?_0x19e6f8['options'][_0x5b14('0x22')]===undefined?!![]:![]:!![]})[_0x5b14('0x12')](function(_0x4857c7){logger[_0x5b14('0x13')](_0x5b14('0x1d'),_0x19e6f8);logger['debug'](_0x5b14('0x1d'),_0x19e6f8,JSON['stringify'](_0x4857c7));_0x525176(_0x4857c7);})['catch'](function(_0x5e0780){logger['error'](_0x5b14('0x1d'),_0x5e0780[_0x5b14('0x1b')],_0x19e6f8);_0x4fa079(_0x4a4e60[_0x5b14('0x18')](0x1f4,_0x5e0780['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index af0e519..a1635ac 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 _0xaa88=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x1e9b0c,_0xedcc28){var _0x300fdc=function(_0x30574d){while(--_0x30574d){_0x1e9b0c['push'](_0x1e9b0c['shift']());}};_0x300fdc(++_0xedcc28);}(_0xaa88,0x137));var _0x8aa8=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xaa88[_0xffa198];return _0x1e4b50;};'use strict';var OpenchannelMessageEvents=require(_0x8aa8('0x0'));var events=[_0x8aa8('0x1'),_0x8aa8('0x2'),_0x8aa8('0x3')];function createListener(_0x4aee38,_0x4ba9dd){return function(_0x3a5b12){_0x4ba9dd[_0x8aa8('0x4')](_0x4aee38,_0x3a5b12);};}function removeListener(_0x3b2c88,_0x3e3b70){return function(){OpenchannelMessageEvents[_0x8aa8('0x5')](_0x3b2c88,_0x3e3b70);};}exports['register']=function(_0x5bda0d){for(var _0x460042=0x0,_0x5264ff=events[_0x8aa8('0x6')];_0x460042<_0x5264ff;_0x460042++){var _0x1ed84d=events[_0x460042];var _0x27c08d=createListener(_0x8aa8('0x7')+_0x1ed84d,_0x5bda0d);OpenchannelMessageEvents['on'](_0x1ed84d,_0x27c08d);}}; \ No newline at end of file +var _0xaa88=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x4a1f32,_0x6ef1e4){var _0x5bc243=function(_0x59666f){while(--_0x59666f){_0x4a1f32['push'](_0x4a1f32['shift']());}};_0x5bc243(++_0x6ef1e4);}(_0xaa88,0x137));var _0x8aa8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaa88[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelMessageEvents=require(_0x8aa8('0x0'));var events=[_0x8aa8('0x1'),_0x8aa8('0x2'),_0x8aa8('0x3')];function createListener(_0x4aee38,_0x4ba9dd){return function(_0x3a5b12){_0x4ba9dd[_0x8aa8('0x4')](_0x4aee38,_0x3a5b12);};}function removeListener(_0x3b2c88,_0x3e3b70){return function(){OpenchannelMessageEvents[_0x8aa8('0x5')](_0x3b2c88,_0x3e3b70);};}exports['register']=function(_0x5bda0d){for(var _0x460042=0x0,_0x5264ff=events[_0x8aa8('0x6')];_0x460042<_0x5264ff;_0x460042++){var _0x1ed84d=events[_0x460042];var _0x27c08d=createListener(_0x8aa8('0x7')+_0x1ed84d,_0x5bda0d);OpenchannelMessageEvents['on'](_0x1ed84d,_0x27c08d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a920534..404bb38 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 _0xec46=['addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0xec46,0x19c));var _0x6ec4=function(_0x91ae05,_0x363e93){_0x91ae05=_0x91ae05-0x0;var _0x94c735=_0xec46[_0x91ae05];return _0x94c735;};'use strict';var multer=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var path=require(_0x6ec4('0x2'));var timeout=require(_0x6ec4('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6ec4('0x4'));var interaction=require(_0x6ec4('0x5'));var config=require(_0x6ec4('0x6'));var controller=require('./openchannelQueue.controller');router[_0x6ec4('0x7')]('/',auth[_0x6ec4('0x8')](),controller['index']);router[_0x6ec4('0x7')]('/describe',auth[_0x6ec4('0x8')](),controller[_0x6ec4('0x9')]);router[_0x6ec4('0x7')](_0x6ec4('0xa'),auth[_0x6ec4('0x8')](),controller[_0x6ec4('0xb')]);router[_0x6ec4('0x7')](_0x6ec4('0xc'),auth[_0x6ec4('0x8')](),controller[_0x6ec4('0xd')]);router[_0x6ec4('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6ec4('0xe')]);router[_0x6ec4('0x7')](_0x6ec4('0xf'),auth['isAuthenticated'](),controller[_0x6ec4('0x10')]);router['post']('/',auth[_0x6ec4('0x8')](),controller['create']);router[_0x6ec4('0x11')](_0x6ec4('0x12'),auth[_0x6ec4('0x8')](),controller[_0x6ec4('0x13')]);router[_0x6ec4('0x11')]('/:id/users',auth[_0x6ec4('0x8')](),controller[_0x6ec4('0x14')]);router[_0x6ec4('0x15')](_0x6ec4('0xa'),auth[_0x6ec4('0x8')](),controller[_0x6ec4('0x16')]);router[_0x6ec4('0x17')](_0x6ec4('0xa'),auth[_0x6ec4('0x8')](),controller[_0x6ec4('0x18')]);router[_0x6ec4('0x17')]('/:id/teams',auth[_0x6ec4('0x8')](),controller['removeTeams']);router['delete'](_0x6ec4('0xf'),auth['isAuthenticated'](),controller[_0x6ec4('0x19')]);module[_0x6ec4('0x1a')]=router; \ No newline at end of file +var _0xa7be=['removeAgents','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','delete','destroy','removeTeams'];(function(_0x14bf63,_0xdbd373){var _0x410d22=function(_0x2e5e3a){while(--_0x2e5e3a){_0x14bf63['push'](_0x14bf63['shift']());}};_0x410d22(++_0xdbd373);}(_0xa7be,0xfd));var _0xea7b=function(_0x1bd22c,_0x29d285){_0x1bd22c=_0x1bd22c-0x0;var _0x5a1524=_0xa7be[_0x1bd22c];return _0x5a1524;};'use strict';var multer=require(_0xea7b('0x0'));var util=require(_0xea7b('0x1'));var path=require(_0xea7b('0x2'));var timeout=require(_0xea7b('0x3'));var express=require(_0xea7b('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xea7b('0x5'));var config=require(_0xea7b('0x6'));var controller=require(_0xea7b('0x7'));router['get']('/',auth[_0xea7b('0x8')](),controller[_0xea7b('0x9')]);router[_0xea7b('0xa')](_0xea7b('0xb'),auth[_0xea7b('0x8')](),controller[_0xea7b('0xc')]);router[_0xea7b('0xa')](_0xea7b('0xd'),auth[_0xea7b('0x8')](),controller[_0xea7b('0xe')]);router['get'](_0xea7b('0xf'),auth[_0xea7b('0x8')](),controller[_0xea7b('0x10')]);router[_0xea7b('0xa')]('/:id/teams',auth[_0xea7b('0x8')](),controller[_0xea7b('0x11')]);router['get'](_0xea7b('0x12'),auth[_0xea7b('0x8')](),controller[_0xea7b('0x13')]);router[_0xea7b('0x14')]('/',auth[_0xea7b('0x8')](),controller[_0xea7b('0x15')]);router[_0xea7b('0x14')](_0xea7b('0x16'),auth['isAuthenticated'](),controller['addTeams']);router[_0xea7b('0x14')]('/:id/users',auth[_0xea7b('0x8')](),controller[_0xea7b('0x17')]);router['put']('/:id',auth[_0xea7b('0x8')](),controller['update']);router[_0xea7b('0x18')](_0xea7b('0xd'),auth[_0xea7b('0x8')](),controller[_0xea7b('0x19')]);router[_0xea7b('0x18')]('/:id/teams',auth[_0xea7b('0x8')](),controller[_0xea7b('0x1a')]);router[_0xea7b('0x18')]('/:id/users',auth[_0xea7b('0x8')](),controller[_0xea7b('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 86387a2..6cbf771 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 _0x4bfb=['INTEGER','ENUM','sequelize','STRING','name'];(function(_0x5055a3,_0x1cd521){var _0x491849=function(_0xbc019f){while(--_0xbc019f){_0x5055a3['push'](_0x5055a3['shift']());}};_0x491849(++_0x1cd521);}(_0x4bfb,0x98));var _0xb4bf=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0x4bfb[_0x42ca15];return _0x1c6ded;};'use strict';var Sequelize=require(_0xb4bf('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4bf('0x1')],'unique':_0xb4bf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb4bf('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb4bf('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0xe742=['rrmemory','STRING','name','INTEGER'];(function(_0x80bcce,_0x1b2298){var _0x2b4f58=function(_0x170fcd){while(--_0x170fcd){_0x80bcce['push'](_0x80bcce['shift']());}};_0x2b4f58(++_0x1b2298);}(_0xe742,0x14d));var _0x2e74=function(_0x44e8b0,_0x2458a8){_0x44e8b0=_0x44e8b0-0x0;var _0x1b2360=_0xe742[_0x44e8b0];return _0x1b2360;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2e74('0x0')],'unique':_0x2e74('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2e74('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2e74('0x3'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 16de11e..96ab9ac 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 _0x5c23=['OpenchannelQueues','UserProfileResource','destroy','then','error','stack','name','send','map','OpenchannelQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','includes','compact','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','get'];(function(_0xa36442,_0x54ff80){var _0x1b0c71=function(_0x8baf59){while(--_0x8baf59){_0xa36442['push'](_0xa36442['shift']());}};_0x1b0c71(++_0x54ff80);}(_0x5c23,0xe7));var _0x35c2=function(_0x258fc4,_0xe15a89){_0x258fc4=_0x258fc4-0x0;var _0xfcc81f=_0x5c23[_0x258fc4];return _0xfcc81f;};'use strict';var pdf=require(_0x35c2('0x0'));var emlformat=require(_0x35c2('0x1'));var rimraf=require(_0x35c2('0x2'));var zipdir=require(_0x35c2('0x3'));var jsonpatch=require(_0x35c2('0x4'));var rp=require('request-promise');var moment=require(_0x35c2('0x5'));var BPromise=require(_0x35c2('0x6'));var Mustache=require(_0x35c2('0x7'));var util=require(_0x35c2('0x8'));var path=require('path');var sox=require(_0x35c2('0x9'));var csv=require(_0x35c2('0xa'));var ejs=require(_0x35c2('0xb'));var fs=require('fs');var _=require(_0x35c2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x35c2('0xd'));var deskjs=require(_0x35c2('0xe'));var toCsv=require(_0x35c2('0xa'));var querystring=require(_0x35c2('0xf'));var Papa=require('papaparse');var Redis=require(_0x35c2('0x10'));var authService=require(_0x35c2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35c2('0x12'));var logger=require(_0x35c2('0x13'))(_0x35c2('0x14'));var utils=require(_0x35c2('0x15'));var config=require(_0x35c2('0x16'));var db=require(_0x35c2('0x17'))['db'];config[_0x35c2('0x18')]=_[_0x35c2('0x19')](config[_0x35c2('0x18')],{'host':_0x35c2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35c2('0x18')]));require(_0x35c2('0x1b'))[_0x35c2('0x1c')](socket);function respondWithStatusCode(_0x3db243,_0x57d21c){_0x57d21c=_0x57d21c||0xcc;return function(_0x4d8b5a){if(_0x4d8b5a){return _0x3db243[_0x35c2('0x1d')](_0x57d21c);}return _0x3db243[_0x35c2('0x1e')](_0x57d21c)[_0x35c2('0x1f')]();};}function respondWithResult(_0x562270,_0x380916){_0x380916=_0x380916||0xc8;return function(_0x5cf5c0){if(_0x5cf5c0){return _0x562270[_0x35c2('0x1e')](_0x380916)[_0x35c2('0x20')](_0x5cf5c0);}};}function respondWithFilteredResult(_0x4cdec1,_0x27940e){return function(_0x2a8327){if(_0x2a8327){var _0x2bfee8=_0x2a8327[_0x35c2('0x21')],_0x145dfa=_0x27940e[_0x35c2('0x22')],_0x1e8e1a=_0x27940e[_0x35c2('0x22')]+_0x27940e['limit'],_0x244ba1;if(_0x1e8e1a>=_0x2bfee8){_0x1e8e1a=_0x2bfee8;_0x244ba1=0xc8;}else{_0x244ba1=0xce;}_0x4cdec1['status'](_0x244ba1);return _0x4cdec1[_0x35c2('0x23')](_0x35c2('0x24'),_0x145dfa+'-'+_0x1e8e1a+'/'+_0x2bfee8)[_0x35c2('0x20')](_0x2a8327);}return null;};}function patchUpdates(_0x2bba68){return function(_0x153c2d){try{jsonpatch[_0x35c2('0x25')](_0x153c2d,_0x2bba68,!![]);}catch(_0xcf2e32){return BPromise[_0x35c2('0x26')](_0xcf2e32);}return _0x153c2d['save']();};}function saveUpdates(_0x3f13cc,_0xd61527){return function(_0x40ac14){if(_0x40ac14){return _0x40ac14[_0x35c2('0x27')](_0x3f13cc)['then'](function(_0xc2c424){return _0xc2c424;});}return null;};}function removeEntity(_0x283b50,_0x5d4e32){return function(_0x2b3428){if(_0x2b3428){return _0x2b3428['destroy']()['then'](function(){var _0x2f119a=_0x2b3428[_0x35c2('0x28')]({'plain':!![]});var _0x546e57=_0x35c2('0x29');return db[_0x35c2('0x2a')][_0x35c2('0x2b')]({'where':{'type':_0x546e57,'resourceId':_0x2f119a['id']}})[_0x35c2('0x2c')](function(){return _0x2b3428;});})[_0x35c2('0x2c')](function(){_0x283b50['status'](0xcc)[_0x35c2('0x1f')]();});}};}function handleEntityNotFound(_0x886800,_0x56ce90){return function(_0x19eb10){if(!_0x19eb10){_0x886800[_0x35c2('0x1d')](0x194);}return _0x19eb10;};}function handleError(_0x4008ad,_0x2886b4){_0x2886b4=_0x2886b4||0x1f4;return function(_0x4c5300){logger[_0x35c2('0x2d')](_0x4c5300[_0x35c2('0x2e')]);if(_0x4c5300[_0x35c2('0x2f')]){delete _0x4c5300[_0x35c2('0x2f')];}_0x4008ad[_0x35c2('0x1e')](_0x2886b4)[_0x35c2('0x30')](_0x4c5300);};}exports['index']=function(_0x377240,_0x5bf4ff){var _0x2fcf71={},_0x29a15b={},_0x2605f1={'count':0x0,'rows':[]};var _0x23ce4d=_[_0x35c2('0x31')](db[_0x35c2('0x32')]['rawAttributes'],function(_0x36cf77){return{'name':_0x36cf77[_0x35c2('0x33')],'type':_0x36cf77['type'][_0x35c2('0x34')]};});_0x29a15b[_0x35c2('0x35')]=_[_0x35c2('0x31')](_0x23ce4d,_0x35c2('0x2f'));_0x29a15b[_0x35c2('0x36')]=_[_0x35c2('0x37')](_0x377240[_0x35c2('0x36')]);_0x29a15b[_0x35c2('0x38')]=_[_0x35c2('0x39')](_0x29a15b[_0x35c2('0x35')],_0x29a15b[_0x35c2('0x36')]);_0x2fcf71[_0x35c2('0x3a')]=_[_0x35c2('0x39')](_0x29a15b[_0x35c2('0x35')],qs['fields'](_0x377240['query'][_0x35c2('0x3b')]));_0x2fcf71[_0x35c2('0x3a')]=_0x2fcf71[_0x35c2('0x3a')][_0x35c2('0x3c')]?_0x2fcf71['attributes']:_0x29a15b[_0x35c2('0x35')];if(!_0x377240['query'][_0x35c2('0x3d')](_0x35c2('0x3e'))){_0x2fcf71['limit']=qs['limit'](_0x377240[_0x35c2('0x36')][_0x35c2('0x3f')]);_0x2fcf71[_0x35c2('0x22')]=qs[_0x35c2('0x22')](_0x377240[_0x35c2('0x36')]['offset']);}_0x2fcf71[_0x35c2('0x40')]=qs[_0x35c2('0x41')](_0x377240[_0x35c2('0x36')][_0x35c2('0x41')]);_0x2fcf71[_0x35c2('0x42')]=qs[_0x35c2('0x38')](_['pick'](_0x377240[_0x35c2('0x36')],_0x29a15b[_0x35c2('0x38')]),_0x23ce4d);if(_0x377240[_0x35c2('0x36')][_0x35c2('0x43')]){_0x2fcf71[_0x35c2('0x42')]=_[_0x35c2('0x44')](_0x2fcf71[_0x35c2('0x42')],{'$or':_['map'](_0x23ce4d,function(_0x203998){if(_0x203998['type']!==_0x35c2('0x45')){var _0x1766fe={};_0x1766fe[_0x203998[_0x35c2('0x2f')]]={'$like':'%'+_0x377240[_0x35c2('0x36')][_0x35c2('0x43')]+'%'};return _0x1766fe;}})});}_0x2fcf71=_[_0x35c2('0x44')]({},_0x2fcf71,_0x377240[_0x35c2('0x46')]);var _0x107928={'where':_0x2fcf71[_0x35c2('0x42')]};return db['OpenchannelQueue'][_0x35c2('0x21')](_0x107928)[_0x35c2('0x2c')](function(_0x4a320b){_0x2605f1[_0x35c2('0x21')]=_0x4a320b;if(_0x377240[_0x35c2('0x36')][_0x35c2('0x47')]){_0x2fcf71['include']=[{'all':!![]}];}return db[_0x35c2('0x32')][_0x35c2('0x48')](_0x2fcf71);})['then'](function(_0x12c527){_0x2605f1[_0x35c2('0x49')]=_0x12c527;return _0x2605f1;})[_0x35c2('0x2c')](respondWithFilteredResult(_0x5bf4ff,_0x2fcf71))[_0x35c2('0x4a')](handleError(_0x5bf4ff,null));};exports['show']=function(_0xb55537,_0x1f5cab){var _0xdfc80={'raw':!![],'where':{'id':_0xb55537[_0x35c2('0x4b')]['id']}},_0x4239ee={};_0x4239ee[_0x35c2('0x35')]=_[_0x35c2('0x37')](db[_0x35c2('0x32')][_0x35c2('0x4c')]);_0x4239ee[_0x35c2('0x36')]=_[_0x35c2('0x37')](_0xb55537['query']);_0x4239ee[_0x35c2('0x38')]=_[_0x35c2('0x39')](_0x4239ee['model'],_0x4239ee['query']);_0xdfc80[_0x35c2('0x3a')]=_[_0x35c2('0x39')](_0x4239ee['model'],qs[_0x35c2('0x3b')](_0xb55537['query'][_0x35c2('0x3b')]));_0xdfc80['attributes']=_0xdfc80[_0x35c2('0x3a')]['length']?_0xdfc80[_0x35c2('0x3a')]:_0x4239ee['model'];if(_0xb55537['query'][_0x35c2('0x47')]){_0xdfc80[_0x35c2('0x4d')]=[{'all':!![]}];}_0xdfc80=_[_0x35c2('0x44')]({},_0xdfc80,_0xb55537['options']);return db[_0x35c2('0x32')][_0x35c2('0x4e')](_0xdfc80)[_0x35c2('0x2c')](handleEntityNotFound(_0x1f5cab,null))['then'](respondWithResult(_0x1f5cab,null))[_0x35c2('0x4a')](handleError(_0x1f5cab,null));};exports[_0x35c2('0x4f')]=function(_0x2ce91c,_0x510d5d){return db[_0x35c2('0x32')][_0x35c2('0x4f')](_0x2ce91c[_0x35c2('0x50')],{})[_0x35c2('0x2c')](function(_0x512667){var _0xadd1b4=_0x2ce91c['user'][_0x35c2('0x28')]({'plain':!![]});if(!_0xadd1b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadd1b4[_0x35c2('0x51')]===_0x35c2('0x52')){var _0x444f4b=_0x512667['get']({'plain':!![]});var _0x23e6ad=_0x35c2('0x29');return db[_0x35c2('0x53')][_0x35c2('0x4e')]({'where':{'name':_0x23e6ad,'userProfileId':_0xadd1b4[_0x35c2('0x54')]},'raw':!![]})[_0x35c2('0x2c')](function(_0x35599e){if(_0x35599e&&_0x35599e[_0x35c2('0x55')]===0x0){return db[_0x35c2('0x2a')]['create']({'name':_0x444f4b['name'],'resourceId':_0x444f4b['id'],'type':_0x35599e[_0x35c2('0x2f')],'sectionId':_0x35599e['id']},{})[_0x35c2('0x2c')](function(){return _0x512667;});}else{return _0x512667;}})[_0x35c2('0x4a')](function(_0x3470ba){logger[_0x35c2('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3470ba);throw _0x3470ba;});}return _0x512667;})[_0x35c2('0x2c')](respondWithResult(_0x510d5d,0xc9))[_0x35c2('0x4a')](handleError(_0x510d5d,null));};exports[_0x35c2('0x27')]=function(_0x442cd2,_0x41abc1){if(_0x442cd2[_0x35c2('0x50')]['id']){delete _0x442cd2['body']['id'];}return db[_0x35c2('0x32')][_0x35c2('0x4e')]({'where':{'id':_0x442cd2[_0x35c2('0x4b')]['id']}})[_0x35c2('0x2c')](handleEntityNotFound(_0x41abc1,null))[_0x35c2('0x2c')](saveUpdates(_0x442cd2['body'],null))[_0x35c2('0x2c')](respondWithResult(_0x41abc1,null))[_0x35c2('0x4a')](handleError(_0x41abc1,null));};exports['destroy']=function(_0x3a5169,_0x51bd18){return db[_0x35c2('0x32')][_0x35c2('0x4e')]({'where':{'id':_0x3a5169['params']['id']}})[_0x35c2('0x2c')](handleEntityNotFound(_0x51bd18,null))['then'](removeEntity(_0x51bd18,null))[_0x35c2('0x4a')](handleError(_0x51bd18,null));};exports['describe']=function(_0x2c64a6,_0x179c2a){return db[_0x35c2('0x32')][_0x35c2('0x56')]()[_0x35c2('0x2c')](respondWithResult(_0x179c2a,null))[_0x35c2('0x4a')](handleError(_0x179c2a,null));};exports[_0x35c2('0x57')]=function(_0x36f034,_0x48916b,_0x3d384d){var _0x371485={'raw':!![],'where':{}},_0x317a79={},_0xd03374;return db['OpenchannelQueue'][_0x35c2('0x58')]({'where':{'id':_0x36f034[_0x35c2('0x4b')]['id']}})[_0x35c2('0x2c')](handleEntityNotFound(_0x48916b,null))['then'](function(_0x13f9c4){if(_0x13f9c4){_0xd03374=_0x13f9c4[_0x35c2('0x28')]({'plain':!![]});_0x317a79['model']=_['keys'](db['UserOpenchannelQueue'][_0x35c2('0x4c')]);_0x317a79[_0x35c2('0x36')]=_[_0x35c2('0x37')](_0x36f034[_0x35c2('0x36')]);_0x317a79[_0x35c2('0x38')]=_['intersection'](_0x317a79[_0x35c2('0x35')],_0x317a79[_0x35c2('0x36')]);_0x371485[_0x35c2('0x3a')]=_[_0x35c2('0x39')](_0x317a79[_0x35c2('0x35')],qs['fields'](_0x36f034['query'][_0x35c2('0x3b')]));_0x371485[_0x35c2('0x3a')]=_0x371485[_0x35c2('0x3a')][_0x35c2('0x3c')]?_0x371485[_0x35c2('0x3a')]:_0x317a79[_0x35c2('0x35')];if(!_0x36f034[_0x35c2('0x36')][_0x35c2('0x3d')]('nolimit')){_0x371485['limit']=qs[_0x35c2('0x3f')](_0x36f034[_0x35c2('0x36')][_0x35c2('0x3f')]);_0x371485[_0x35c2('0x22')]=qs[_0x35c2('0x22')](_0x36f034[_0x35c2('0x36')][_0x35c2('0x22')]);}_0x371485[_0x35c2('0x40')]=qs[_0x35c2('0x41')](_0x36f034[_0x35c2('0x36')][_0x35c2('0x41')]);_0x371485[_0x35c2('0x42')]=qs['filters'](_[_0x35c2('0x59')](_0x36f034[_0x35c2('0x36')],_0x317a79[_0x35c2('0x38')]));_0x371485[_0x35c2('0x42')][_0x35c2('0x5a')]=_0x13f9c4['id'];if(_0x36f034[_0x35c2('0x36')][_0x35c2('0x43')]){_0x371485[_0x35c2('0x42')]=_['merge'](_0x371485[_0x35c2('0x42')],{'$or':_['map'](_0x371485[_0x35c2('0x3a')],function(_0x4ec116){var _0x41d94e={};_0x41d94e[_0x4ec116]={'$like':'%'+_0x36f034['query'][_0x35c2('0x43')]+'%'};return _0x41d94e;})});}_0x371485=_[_0x35c2('0x44')]({},_0x371485,_0x36f034[_0x35c2('0x46')]);return db['UserOpenchannelQueue'][_0x35c2('0x48')](_0x371485);}})['then'](function(_0x379bd0){if(_0x379bd0){return db[_0x35c2('0x5b')][_0x35c2('0x5c')]({'where':{'id':_[_0x35c2('0x31')](_0x379bd0,_0x35c2('0x5d')),'role':_0x35c2('0x5e')},'attributes':['id',_0x35c2('0x2f'),_0x35c2('0x5f'),_0x35c2('0x60'),_0x35c2('0x61')]});}})[_0x35c2('0x2c')](function(_0x181b6b){if(_0x181b6b){return{'count':_0x181b6b[_0x35c2('0x21')],'rows':_['map'](_0x181b6b[_0x35c2('0x49')],function(_0x3b7dfc){return{'membername':_0x3b7dfc[_0x35c2('0x2f')],'UserId':_0x3b7dfc['id'],'queue_name':_0xd03374[_0x35c2('0x2f')],'OpenchannelQueueId':_0xd03374['id'],'interface':util[_0x35c2('0x62')](_0x35c2('0x63'),'SIP',_0x3b7dfc[_0x35c2('0x2f')]),'penalty':0x0,'paused':_0x3b7dfc['openchannelPause'],'createdAt':_0x3b7dfc[_0x35c2('0x61')],'updatedAt':_0x3b7dfc[_0x35c2('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x35c2('0x2c')](respondWithFilteredResult(_0x48916b,_0x371485))['catch'](handleError(_0x48916b,null));};exports['getTeams']=function(_0x44692b,_0x497df8,_0x3c5228){var _0x445774={};var _0xe3ed0d={};var _0x386138;var _0x4c5164;return db[_0x35c2('0x32')][_0x35c2('0x58')]({'where':{'id':_0x44692b[_0x35c2('0x4b')]['id']}})[_0x35c2('0x2c')](handleEntityNotFound(_0x497df8,null))['then'](function(_0x1446ad){if(_0x1446ad){_0x386138=_0x1446ad;_0xe3ed0d[_0x35c2('0x35')]=_[_0x35c2('0x37')](db[_0x35c2('0x64')]['rawAttributes']);_0xe3ed0d[_0x35c2('0x36')]=_['keys'](_0x44692b[_0x35c2('0x36')]);_0xe3ed0d[_0x35c2('0x38')]=_[_0x35c2('0x39')](_0xe3ed0d['model'],_0xe3ed0d[_0x35c2('0x36')]);_0x445774['attributes']=_['intersection'](_0xe3ed0d[_0x35c2('0x35')],qs[_0x35c2('0x3b')](_0x44692b[_0x35c2('0x36')][_0x35c2('0x3b')]));_0x445774['attributes']=_0x445774[_0x35c2('0x3a')][_0x35c2('0x3c')]?_0x445774[_0x35c2('0x3a')]:_0xe3ed0d[_0x35c2('0x35')];_0x445774[_0x35c2('0x40')]=qs[_0x35c2('0x41')](_0x44692b[_0x35c2('0x36')][_0x35c2('0x41')]);_0x445774['where']=qs[_0x35c2('0x38')](_[_0x35c2('0x59')](_0x44692b['query'],_0xe3ed0d[_0x35c2('0x38')]));if(_0x44692b[_0x35c2('0x36')][_0x35c2('0x43')]){_0x445774[_0x35c2('0x42')]=_[_0x35c2('0x44')](_0x445774[_0x35c2('0x42')],{'$or':_[_0x35c2('0x31')](_0x445774[_0x35c2('0x3a')],function(_0x3e621e){var _0x1665ab={};_0x1665ab[_0x3e621e]={'$like':'%'+_0x44692b[_0x35c2('0x36')][_0x35c2('0x43')]+'%'};return _0x1665ab;})});}_0x445774=_[_0x35c2('0x44')]({},_0x445774,_0x44692b[_0x35c2('0x46')]);return _0x386138['getTeams'](_0x445774);}})[_0x35c2('0x2c')](function(_0x4152c6){if(_0x4152c6){_0x4c5164=_0x4152c6[_0x35c2('0x3c')];if(!_0x44692b[_0x35c2('0x36')]['hasOwnProperty'](_0x35c2('0x3e'))){_0x445774[_0x35c2('0x3f')]=qs['limit'](_0x44692b[_0x35c2('0x36')][_0x35c2('0x3f')]);_0x445774[_0x35c2('0x22')]=qs[_0x35c2('0x22')](_0x44692b[_0x35c2('0x36')][_0x35c2('0x22')]);}return _0x386138[_0x35c2('0x65')](_0x445774);}})[_0x35c2('0x2c')](function(_0x225897){if(_0x225897){return _0x225897?{'count':_0x4c5164,'rows':_0x225897}:null;}})[_0x35c2('0x2c')](respondWithResult(_0x497df8,null))[_0x35c2('0x4a')](handleError(_0x497df8,null));};exports[_0x35c2('0x66')]=function(_0x145c54,_0x7ef92b,_0x19cc9e){var _0x2164ea=_0x145c54[_0x35c2('0x50')][_0x35c2('0x67')];return db[_0x35c2('0x64')]['findAll']({'where':{'id':_0x2164ea},'attributes':['id'],'include':[{'model':db[_0x35c2('0x5b')],'as':_0x35c2('0x68'),'attributes':['id',_0x35c2('0x2f'),_0x35c2('0x69'),_0x35c2('0x6a'),_0x35c2('0x6b')],'raw':!![]}]})['then'](function(_0xb828be){if(_0xb828be){var _0x2f45eb=_[_0x35c2('0x6c')](_0xb828be,function(_0x10016e){var _0x2146fc=_0x10016e[_0x35c2('0x28')]({'plain':!![]});return _0x2146fc['Agents'];});return db[_0x35c2('0x32')]['find']({'where':{'id':_0x145c54[_0x35c2('0x4b')]['id']}})['then'](function(_0x1c9687){return db[_0x35c2('0x6d')][_0x35c2('0x6e')](function(_0x23a445){return _0x1c9687[_0x35c2('0x66')](_0x2164ea,{'transaction':_0x23a445})['then'](function(){return BPromise['each'](_0x2f45eb,function(_0x4b0b73){return db['UserOpenchannelQueue'][_0x35c2('0x6f')]({'where':{'UserId':_0x4b0b73['id'],'OpenchannelQueueId':_0x145c54[_0x35c2('0x4b')]['id']},'transaction':_0x23a445});});})['then'](function(){_0x2f45eb[_0x35c2('0x70')](function(_0x415a7b){socket[_0x35c2('0x71')](_0x35c2('0x72'),{'UserId':_0x415a7b['id'],'OpenchannelQueueId':_0x1c9687['id']});});});});});}})[_0x35c2('0x2c')](respondWithStatusCode(_0x7ef92b,null))['catch'](handleError(_0x7ef92b,null));};exports[_0x35c2('0x73')]=function(_0xccd461,_0x23dcf9,_0x451aba){return db[_0x35c2('0x64')][_0x35c2('0x48')]({'where':{'id':_0xccd461[_0x35c2('0x36')][_0x35c2('0x67')]},'attributes':['id'],'include':[{'model':db[_0x35c2('0x5b')],'as':_0x35c2('0x68'),'attributes':['id'],'raw':!![]}]})[_0x35c2('0x2c')](handleEntityNotFound(_0x23dcf9,null))[_0x35c2('0x2c')](function(_0x3158d5){var _0x8417d5=_[_0x35c2('0x31')](_0x3158d5,'id');var _0x5653c1=[];var _0x2a5a1b=[];var _0x347ede=squel[_0x35c2('0x74')]();_0x347ede['field']('tq.TeamId')[_0x35c2('0x75')](_0x35c2('0x76'),'tq')[_0x35c2('0x77')](_0x35c2('0x78'),'ut',_0x35c2('0x79'))[_0x35c2('0x42')](_0x35c2('0x7a'),_0xccd461['params']['id']);for(var _0x1eca6a=0x0;_0x1eca6a<_0x3158d5[_0x35c2('0x3c')];_0x1eca6a+=0x1){let _0x5c41d1=_0x3158d5[_0x1eca6a];for(var _0x1719a5=0x0;_0x1719a5<_0x5c41d1[_0x35c2('0x68')][_0x35c2('0x3c')];_0x1719a5+=0x1){let _0x490eba=_0x5c41d1['Agents'][_0x1719a5];var _0xff5c92=_0x347ede[_0x35c2('0x7b')]();_0xff5c92[_0x35c2('0x42')](_0x35c2('0x7c'),_0x490eba['id']);_0x2a5a1b[_0x35c2('0x7d')](db['sequelize'][_0x35c2('0x36')](_0xff5c92['toString'](),{'type':db[_0x35c2('0x6d')][_0x35c2('0x7e')]['SELECT']})['then'](function(_0x3579f5){if(_0x3579f5[_0x35c2('0x3c')]===0x1){return _0x490eba['id'];}else{var _0x420bd0=_['every'](_[_0x35c2('0x31')](_0x3579f5,'TeamId'),function(_0x215c6a){return _[_0x35c2('0x7f')](_0x8417d5,_0x215c6a);});if(_0x420bd0){return _0x490eba['id'];}}}));}}return BPromise['all'](_0x2a5a1b)[_0x35c2('0x2c')](function(_0xd4d830){_0x5653c1=_(_0x5653c1)['union'](_0xd4d830)[_0x35c2('0x80')]()['value']();return db[_0x35c2('0x32')][_0x35c2('0x4e')]({'where':{'id':_0xccd461['params']['id']}})[_0x35c2('0x2c')](function(_0x47d103){return db[_0x35c2('0x6d')][_0x35c2('0x6e')](function(_0x38f16e){return _0x47d103[_0x35c2('0x73')](_0xccd461['query'][_0x35c2('0x67')],{'transaction':_0x38f16e})[_0x35c2('0x2c')](function(){if(!_['isEmpty'](_0x5653c1)){return _0x47d103[_0x35c2('0x81')](_0x5653c1,{'transaction':_0x38f16e});}})['then'](function(){_0x5653c1['forEach'](function(_0x38abf0){socket[_0x35c2('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x38abf0,'OpenchannelQueueId':_0x47d103['id']});});});});});});})[_0x35c2('0x2c')](respondWithStatusCode(_0x23dcf9,null))[_0x35c2('0x4a')](handleError(_0x23dcf9,null));};exports[_0x35c2('0x82')]=function(_0x19bda4,_0x515f4f,_0x304fd0){return db[_0x35c2('0x32')][_0x35c2('0x4e')]({'where':{'id':_0x19bda4['params']['id']}})[_0x35c2('0x2c')](handleEntityNotFound(_0x515f4f,null))[_0x35c2('0x2c')](function(_0x4a8626){if(_0x4a8626){return _0x4a8626[_0x35c2('0x82')](_0x19bda4['body'][_0x35c2('0x67')],_[_0x35c2('0x83')](_0x19bda4[_0x35c2('0x50')],[_0x35c2('0x67'),'id'])||{})[_0x35c2('0x84')](function(_0x3ef7cd){for(var _0x57e3e2=0x0;_0x57e3e2<_0x19bda4[_0x35c2('0x50')][_0x35c2('0x67')][_0x35c2('0x3c')];_0x57e3e2+=0x1){socket[_0x35c2('0x71')]('userOpenchannelQueue:save',{'UserId':_0x19bda4[_0x35c2('0x50')][_0x35c2('0x67')][_0x57e3e2],'OpenchannelQueueId':_0x19bda4['params']['id']});}return _0x3ef7cd;});}})[_0x35c2('0x2c')](respondWithResult(_0x515f4f,null))[_0x35c2('0x4a')](handleError(_0x515f4f,null));};exports[_0x35c2('0x81')]=function(_0x4d4c83,_0x5d5b06,_0x2960e4){return db[_0x35c2('0x32')][_0x35c2('0x4e')]({'where':{'id':_0x4d4c83['params']['id']}})[_0x35c2('0x2c')](handleEntityNotFound(_0x5d5b06,null))[_0x35c2('0x2c')](function(_0x2fe2f2){if(_0x2fe2f2){return _0x2fe2f2[_0x35c2('0x81')](_0x4d4c83[_0x35c2('0x36')][_0x35c2('0x67')])[_0x35c2('0x2c')](function(){if(_[_0x35c2('0x85')](_0x4d4c83[_0x35c2('0x36')][_0x35c2('0x67')])){for(var _0x174917=0x0;_0x174917<_0x4d4c83[_0x35c2('0x36')]['ids'][_0x35c2('0x3c')];_0x174917+=0x1){socket[_0x35c2('0x71')](_0x35c2('0x86'),{'UserId':Number(_0x4d4c83['query']['ids'][_0x174917]),'OpenchannelQueueId':Number(_0x4d4c83[_0x35c2('0x4b')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x4d4c83['query'][_0x35c2('0x67')]),'OpenchannelQueueId':Number(_0x4d4c83[_0x35c2('0x4b')]['id'])});}});}})[_0x35c2('0x2c')](respondWithStatusCode(_0x5d5b06,null))[_0x35c2('0x4a')](handleError(_0x5d5b06,null));};exports[_0x35c2('0x87')]=function(_0x5a202c,_0x4d39ca,_0x41b070){var _0x4d6d0b={};var _0x150741={};var _0x338bb2;var _0x19a52;return db[_0x35c2('0x32')][_0x35c2('0x58')]({'where':{'id':_0x5a202c[_0x35c2('0x4b')]['id']}})[_0x35c2('0x2c')](handleEntityNotFound(_0x4d39ca,null))[_0x35c2('0x2c')](function(_0x528978){if(_0x528978){_0x338bb2=_0x528978;_0x150741[_0x35c2('0x35')]=_[_0x35c2('0x37')](db[_0x35c2('0x5b')]['rawAttributes']);_0x150741[_0x35c2('0x36')]=_['keys'](_0x5a202c[_0x35c2('0x36')]);_0x150741[_0x35c2('0x38')]=_[_0x35c2('0x39')](_0x150741[_0x35c2('0x35')],_0x150741[_0x35c2('0x36')]);_0x4d6d0b[_0x35c2('0x3a')]=_['intersection'](_0x150741[_0x35c2('0x35')],qs['fields'](_0x5a202c[_0x35c2('0x36')]['fields']));_0x4d6d0b[_0x35c2('0x3a')]=_0x4d6d0b[_0x35c2('0x3a')]['length']?_0x4d6d0b[_0x35c2('0x3a')]:_0x150741[_0x35c2('0x35')];_0x4d6d0b[_0x35c2('0x40')]=qs['sort'](_0x5a202c[_0x35c2('0x36')][_0x35c2('0x41')]);_0x4d6d0b[_0x35c2('0x42')]=qs[_0x35c2('0x38')](_[_0x35c2('0x59')](_0x5a202c[_0x35c2('0x36')],_0x150741[_0x35c2('0x38')]));if(_0x5a202c[_0x35c2('0x36')][_0x35c2('0x43')]){_0x4d6d0b[_0x35c2('0x42')]=_[_0x35c2('0x44')](_0x4d6d0b[_0x35c2('0x42')],{'$or':_['map'](_0x4d6d0b[_0x35c2('0x3a')],function(_0x3510e8){var _0x18e4a4={};_0x18e4a4[_0x3510e8]={'$like':'%'+_0x5a202c[_0x35c2('0x36')]['filter']+'%'};return _0x18e4a4;})});}_0x4d6d0b=_['merge']({},_0x4d6d0b,_0x5a202c[_0x35c2('0x46')]);return _0x338bb2[_0x35c2('0x87')](_0x4d6d0b);}})[_0x35c2('0x2c')](function(_0x4a5d8b){if(_0x4a5d8b){_0x19a52=_0x4a5d8b[_0x35c2('0x3c')];if(!_0x5a202c[_0x35c2('0x36')][_0x35c2('0x3d')](_0x35c2('0x3e'))){_0x4d6d0b[_0x35c2('0x3f')]=qs['limit'](_0x5a202c[_0x35c2('0x36')][_0x35c2('0x3f')]);_0x4d6d0b['offset']=qs['offset'](_0x5a202c[_0x35c2('0x36')][_0x35c2('0x22')]);}return _0x338bb2[_0x35c2('0x87')](_0x4d6d0b);}})[_0x35c2('0x2c')](function(_0x553908){if(_0x553908){return _0x553908?{'count':_0x19a52,'rows':_0x553908}:null;}})[_0x35c2('0x2c')](respondWithResult(_0x4d39ca,null))[_0x35c2('0x4a')](handleError(_0x4d39ca,null));}; \ No newline at end of file +var _0x876a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','map','OpenchannelQueue','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','hasOwnProperty','nolimit','ids','online','interface','flatMap','Agents','transaction','addTeams','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4f7c23,_0x2fd9bb){var _0x5bb5ad=function(_0x1426a5){while(--_0x1426a5){_0x4f7c23['push'](_0x4f7c23['shift']());}};_0x5bb5ad(++_0x2fd9bb);}(_0x876a,0x10b));var _0xa876=function(_0x39bdf7,_0x54b71e){_0x39bdf7=_0x39bdf7-0x0;var _0x418a3f=_0x876a[_0x39bdf7];return _0x418a3f;};'use strict';var pdf=require(_0xa876('0x0'));var emlformat=require(_0xa876('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa876('0x2'));var jsonpatch=require(_0xa876('0x3'));var rp=require(_0xa876('0x4'));var moment=require(_0xa876('0x5'));var BPromise=require(_0xa876('0x6'));var Mustache=require(_0xa876('0x7'));var util=require('util');var path=require(_0xa876('0x8'));var sox=require('sox');var csv=require(_0xa876('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa876('0xa'));var squel=require(_0xa876('0xb'));var crypto=require(_0xa876('0xc'));var jsforce=require(_0xa876('0xd'));var deskjs=require(_0xa876('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa876('0xf'));var Papa=require(_0xa876('0x10'));var Redis=require(_0xa876('0x11'));var authService=require(_0xa876('0x12'));var qs=require(_0xa876('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa876('0x14'));var logger=require(_0xa876('0x15'))(_0xa876('0x16'));var utils=require(_0xa876('0x17'));var config=require(_0xa876('0x18'));var db=require(_0xa876('0x19'))['db'];config['redis']=_[_0xa876('0x1a')](config[_0xa876('0x1b')],{'host':_0xa876('0x1c'),'port':0x18eb});var socket=require(_0xa876('0x1d'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x5ac8c2,_0x44aaab){_0x44aaab=_0x44aaab||0xcc;return function(_0x2487b){if(_0x2487b){return _0x5ac8c2[_0xa876('0x1e')](_0x44aaab);}return _0x5ac8c2[_0xa876('0x1f')](_0x44aaab)[_0xa876('0x20')]();};}function respondWithResult(_0x186f76,_0x3384e0){_0x3384e0=_0x3384e0||0xc8;return function(_0x29362f){if(_0x29362f){return _0x186f76[_0xa876('0x1f')](_0x3384e0)[_0xa876('0x21')](_0x29362f);}};}function respondWithFilteredResult(_0x29d997,_0x4fb36e){return function(_0xc2605){if(_0xc2605){var _0xe9fd8a=_0xc2605[_0xa876('0x22')],_0x580d61=_0x4fb36e[_0xa876('0x23')],_0x407224=_0x4fb36e[_0xa876('0x23')]+_0x4fb36e[_0xa876('0x24')],_0x464fe9;if(_0x407224>=_0xe9fd8a){_0x407224=_0xe9fd8a;_0x464fe9=0xc8;}else{_0x464fe9=0xce;}_0x29d997[_0xa876('0x1f')](_0x464fe9);return _0x29d997[_0xa876('0x25')](_0xa876('0x26'),_0x580d61+'-'+_0x407224+'/'+_0xe9fd8a)[_0xa876('0x21')](_0xc2605);}return null;};}function patchUpdates(_0x59e38b){return function(_0xfacb4d){try{jsonpatch[_0xa876('0x27')](_0xfacb4d,_0x59e38b,!![]);}catch(_0x3a5f58){return BPromise['reject'](_0x3a5f58);}return _0xfacb4d[_0xa876('0x28')]();};}function saveUpdates(_0x3dd3e8,_0x32af5f){return function(_0x399212){if(_0x399212){return _0x399212[_0xa876('0x29')](_0x3dd3e8)['then'](function(_0x2791e1){return _0x2791e1;});}return null;};}function removeEntity(_0x452bb0,_0xa52b87){return function(_0x5de4aa){if(_0x5de4aa){return _0x5de4aa['destroy']()[_0xa876('0x2a')](function(){var _0x14f954=_0x5de4aa[_0xa876('0x2b')]({'plain':!![]});var _0x4b6dca=_0xa876('0x2c');return db[_0xa876('0x2d')]['destroy']({'where':{'type':_0x4b6dca,'resourceId':_0x14f954['id']}})[_0xa876('0x2a')](function(){return _0x5de4aa;});})[_0xa876('0x2a')](function(){_0x452bb0['status'](0xcc)[_0xa876('0x20')]();});}};}function handleEntityNotFound(_0x46a946,_0x50536d){return function(_0x45df5e){if(!_0x45df5e){_0x46a946[_0xa876('0x1e')](0x194);}return _0x45df5e;};}function handleError(_0x1cb3d3,_0x131854){_0x131854=_0x131854||0x1f4;return function(_0x5b9626){logger[_0xa876('0x2e')](_0x5b9626[_0xa876('0x2f')]);if(_0x5b9626[_0xa876('0x30')]){delete _0x5b9626[_0xa876('0x30')];}_0x1cb3d3[_0xa876('0x1f')](_0x131854)['send'](_0x5b9626);};}exports['index']=function(_0x56d92e,_0x42dc50){var _0x215e5a={},_0x4a248f={},_0x5295f7={'count':0x0,'rows':[]};var _0x2edcfd=_[_0xa876('0x31')](db[_0xa876('0x32')]['rawAttributes'],function(_0x514338){return{'name':_0x514338['fieldName'],'type':_0x514338['type'][_0xa876('0x33')]};});_0x4a248f['model']=_[_0xa876('0x31')](_0x2edcfd,_0xa876('0x30'));_0x4a248f[_0xa876('0x34')]=_[_0xa876('0x35')](_0x56d92e[_0xa876('0x34')]);_0x4a248f[_0xa876('0x36')]=_[_0xa876('0x37')](_0x4a248f[_0xa876('0x38')],_0x4a248f[_0xa876('0x34')]);_0x215e5a[_0xa876('0x39')]=_[_0xa876('0x37')](_0x4a248f[_0xa876('0x38')],qs[_0xa876('0x3a')](_0x56d92e[_0xa876('0x34')][_0xa876('0x3a')]));_0x215e5a['attributes']=_0x215e5a[_0xa876('0x39')][_0xa876('0x3b')]?_0x215e5a[_0xa876('0x39')]:_0x4a248f[_0xa876('0x38')];if(!_0x56d92e[_0xa876('0x34')]['hasOwnProperty']('nolimit')){_0x215e5a[_0xa876('0x24')]=qs[_0xa876('0x24')](_0x56d92e[_0xa876('0x34')][_0xa876('0x24')]);_0x215e5a[_0xa876('0x23')]=qs[_0xa876('0x23')](_0x56d92e[_0xa876('0x34')][_0xa876('0x23')]);}_0x215e5a[_0xa876('0x3c')]=qs[_0xa876('0x3d')](_0x56d92e[_0xa876('0x34')][_0xa876('0x3d')]);_0x215e5a['where']=qs[_0xa876('0x36')](_['pick'](_0x56d92e[_0xa876('0x34')],_0x4a248f['filters']),_0x2edcfd);if(_0x56d92e[_0xa876('0x34')][_0xa876('0x3e')]){_0x215e5a[_0xa876('0x3f')]=_[_0xa876('0x40')](_0x215e5a[_0xa876('0x3f')],{'$or':_[_0xa876('0x31')](_0x2edcfd,function(_0x5542aa){if(_0x5542aa[_0xa876('0x41')]!==_0xa876('0x42')){var _0x214b7e={};_0x214b7e[_0x5542aa[_0xa876('0x30')]]={'$like':'%'+_0x56d92e[_0xa876('0x34')][_0xa876('0x3e')]+'%'};return _0x214b7e;}})});}_0x215e5a=_[_0xa876('0x40')]({},_0x215e5a,_0x56d92e[_0xa876('0x43')]);var _0x3745c2={'where':_0x215e5a[_0xa876('0x3f')]};return db[_0xa876('0x32')][_0xa876('0x22')](_0x3745c2)[_0xa876('0x2a')](function(_0x327f1a){_0x5295f7['count']=_0x327f1a;if(_0x56d92e[_0xa876('0x34')][_0xa876('0x44')]){_0x215e5a['include']=[{'all':!![]}];}return db[_0xa876('0x32')][_0xa876('0x45')](_0x215e5a);})[_0xa876('0x2a')](function(_0xd8bfaa){_0x5295f7[_0xa876('0x46')]=_0xd8bfaa;return _0x5295f7;})[_0xa876('0x2a')](respondWithFilteredResult(_0x42dc50,_0x215e5a))['catch'](handleError(_0x42dc50,null));};exports['show']=function(_0x59f805,_0x4f1e56){var _0x29c4ca={'raw':!![],'where':{'id':_0x59f805[_0xa876('0x47')]['id']}},_0x1fb849={};_0x1fb849[_0xa876('0x38')]=_[_0xa876('0x35')](db[_0xa876('0x32')][_0xa876('0x48')]);_0x1fb849['query']=_[_0xa876('0x35')](_0x59f805[_0xa876('0x34')]);_0x1fb849[_0xa876('0x36')]=_[_0xa876('0x37')](_0x1fb849[_0xa876('0x38')],_0x1fb849[_0xa876('0x34')]);_0x29c4ca['attributes']=_[_0xa876('0x37')](_0x1fb849[_0xa876('0x38')],qs[_0xa876('0x3a')](_0x59f805['query'][_0xa876('0x3a')]));_0x29c4ca['attributes']=_0x29c4ca['attributes']['length']?_0x29c4ca[_0xa876('0x39')]:_0x1fb849[_0xa876('0x38')];if(_0x59f805['query'][_0xa876('0x44')]){_0x29c4ca[_0xa876('0x49')]=[{'all':!![]}];}_0x29c4ca=_[_0xa876('0x40')]({},_0x29c4ca,_0x59f805['options']);return db[_0xa876('0x32')][_0xa876('0x4a')](_0x29c4ca)[_0xa876('0x2a')](handleEntityNotFound(_0x4f1e56,null))[_0xa876('0x2a')](respondWithResult(_0x4f1e56,null))[_0xa876('0x4b')](handleError(_0x4f1e56,null));};exports[_0xa876('0x4c')]=function(_0x527d72,_0x3afa5e){return db['OpenchannelQueue']['create'](_0x527d72[_0xa876('0x4d')],{})['then'](function(_0x32b2cd){var _0x38f4fa=_0x527d72[_0xa876('0x4e')][_0xa876('0x2b')]({'plain':!![]});if(!_0x38f4fa)throw new Error(_0xa876('0x4f'));if(_0x38f4fa[_0xa876('0x50')]===_0xa876('0x4e')){var _0x3eab89=_0x32b2cd[_0xa876('0x2b')]({'plain':!![]});var _0x240a8a='OpenchannelQueues';return db[_0xa876('0x51')]['find']({'where':{'name':_0x240a8a,'userProfileId':_0x38f4fa[_0xa876('0x52')]},'raw':!![]})[_0xa876('0x2a')](function(_0x22b123){if(_0x22b123&&_0x22b123[_0xa876('0x53')]===0x0){return db['UserProfileResource'][_0xa876('0x4c')]({'name':_0x3eab89[_0xa876('0x30')],'resourceId':_0x3eab89['id'],'type':_0x22b123['name'],'sectionId':_0x22b123['id']},{})[_0xa876('0x2a')](function(){return _0x32b2cd;});}else{return _0x32b2cd;}})[_0xa876('0x4b')](function(_0x50c27d){logger[_0xa876('0x2e')](_0xa876('0x54'),_0x50c27d);throw _0x50c27d;});}return _0x32b2cd;})[_0xa876('0x2a')](respondWithResult(_0x3afa5e,0xc9))[_0xa876('0x4b')](handleError(_0x3afa5e,null));};exports[_0xa876('0x29')]=function(_0x2b8e6d,_0x204e14){if(_0x2b8e6d[_0xa876('0x4d')]['id']){delete _0x2b8e6d['body']['id'];}return db[_0xa876('0x32')][_0xa876('0x4a')]({'where':{'id':_0x2b8e6d[_0xa876('0x47')]['id']}})[_0xa876('0x2a')](handleEntityNotFound(_0x204e14,null))[_0xa876('0x2a')](saveUpdates(_0x2b8e6d[_0xa876('0x4d')],null))['then'](respondWithResult(_0x204e14,null))['catch'](handleError(_0x204e14,null));};exports['destroy']=function(_0x363171,_0x464728){return db[_0xa876('0x32')][_0xa876('0x4a')]({'where':{'id':_0x363171[_0xa876('0x47')]['id']}})[_0xa876('0x2a')](handleEntityNotFound(_0x464728,null))[_0xa876('0x2a')](removeEntity(_0x464728,null))[_0xa876('0x4b')](handleError(_0x464728,null));};exports[_0xa876('0x55')]=function(_0x266498,_0xcfe4be){return db[_0xa876('0x32')]['describe']()[_0xa876('0x2a')](respondWithResult(_0xcfe4be,null))['catch'](handleError(_0xcfe4be,null));};exports[_0xa876('0x56')]=function(_0x5ad65b,_0x190dbb,_0x17f18b){var _0xb1eced={'raw':!![],'where':{}},_0x1cf236={},_0x43e36d;return db[_0xa876('0x32')][_0xa876('0x57')]({'where':{'id':_0x5ad65b[_0xa876('0x47')]['id']}})[_0xa876('0x2a')](handleEntityNotFound(_0x190dbb,null))[_0xa876('0x2a')](function(_0x256a6e){if(_0x256a6e){_0x43e36d=_0x256a6e[_0xa876('0x2b')]({'plain':!![]});_0x1cf236[_0xa876('0x38')]=_[_0xa876('0x35')](db['UserOpenchannelQueue']['rawAttributes']);_0x1cf236[_0xa876('0x34')]=_['keys'](_0x5ad65b[_0xa876('0x34')]);_0x1cf236['filters']=_[_0xa876('0x37')](_0x1cf236[_0xa876('0x38')],_0x1cf236[_0xa876('0x34')]);_0xb1eced[_0xa876('0x39')]=_['intersection'](_0x1cf236[_0xa876('0x38')],qs['fields'](_0x5ad65b[_0xa876('0x34')]['fields']));_0xb1eced[_0xa876('0x39')]=_0xb1eced[_0xa876('0x39')][_0xa876('0x3b')]?_0xb1eced[_0xa876('0x39')]:_0x1cf236['model'];if(!_0x5ad65b[_0xa876('0x34')]['hasOwnProperty']('nolimit')){_0xb1eced[_0xa876('0x24')]=qs[_0xa876('0x24')](_0x5ad65b[_0xa876('0x34')][_0xa876('0x24')]);_0xb1eced[_0xa876('0x23')]=qs['offset'](_0x5ad65b['query'][_0xa876('0x23')]);}_0xb1eced[_0xa876('0x3c')]=qs[_0xa876('0x3d')](_0x5ad65b[_0xa876('0x34')]['sort']);_0xb1eced['where']=qs[_0xa876('0x36')](_[_0xa876('0x58')](_0x5ad65b[_0xa876('0x34')],_0x1cf236[_0xa876('0x36')]));_0xb1eced[_0xa876('0x3f')][_0xa876('0x59')]=_0x256a6e['id'];if(_0x5ad65b[_0xa876('0x34')]['filter']){_0xb1eced[_0xa876('0x3f')]=_['merge'](_0xb1eced[_0xa876('0x3f')],{'$or':_[_0xa876('0x31')](_0xb1eced[_0xa876('0x39')],function(_0x29673e){var _0xcadcd={};_0xcadcd[_0x29673e]={'$like':'%'+_0x5ad65b[_0xa876('0x34')]['filter']+'%'};return _0xcadcd;})});}_0xb1eced=_[_0xa876('0x40')]({},_0xb1eced,_0x5ad65b[_0xa876('0x43')]);return db[_0xa876('0x5a')][_0xa876('0x45')](_0xb1eced);}})[_0xa876('0x2a')](function(_0x1bfd3e){if(_0x1bfd3e){return db[_0xa876('0x5b')][_0xa876('0x5c')]({'where':{'id':_[_0xa876('0x31')](_0x1bfd3e,_0xa876('0x5d')),'role':'agent'},'attributes':['id',_0xa876('0x30'),_0xa876('0x5e'),_0xa876('0x5f'),_0xa876('0x60')]});}})[_0xa876('0x2a')](function(_0xd4088e){if(_0xd4088e){return{'count':_0xd4088e['count'],'rows':_[_0xa876('0x31')](_0xd4088e[_0xa876('0x46')],function(_0x3c4f65){return{'membername':_0x3c4f65[_0xa876('0x30')],'UserId':_0x3c4f65['id'],'queue_name':_0x43e36d[_0xa876('0x30')],'OpenchannelQueueId':_0x43e36d['id'],'interface':util[_0xa876('0x61')](_0xa876('0x62'),_0xa876('0x63'),_0x3c4f65['name']),'penalty':0x0,'paused':_0x3c4f65[_0xa876('0x5e')],'createdAt':_0x3c4f65['createdAt'],'updatedAt':_0x3c4f65[_0xa876('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa876('0x2a')](respondWithFilteredResult(_0x190dbb,_0xb1eced))[_0xa876('0x4b')](handleError(_0x190dbb,null));};exports['getTeams']=function(_0x78bbd2,_0x14cfb9,_0x173801){var _0x790338={};var _0x195e72={};var _0x536d69;var _0x3eec6b;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x78bbd2['params']['id']}})[_0xa876('0x2a')](handleEntityNotFound(_0x14cfb9,null))['then'](function(_0x17b7b9){if(_0x17b7b9){_0x536d69=_0x17b7b9;_0x195e72[_0xa876('0x38')]=_[_0xa876('0x35')](db[_0xa876('0x64')]['rawAttributes']);_0x195e72[_0xa876('0x34')]=_[_0xa876('0x35')](_0x78bbd2[_0xa876('0x34')]);_0x195e72[_0xa876('0x36')]=_[_0xa876('0x37')](_0x195e72[_0xa876('0x38')],_0x195e72['query']);_0x790338[_0xa876('0x39')]=_[_0xa876('0x37')](_0x195e72[_0xa876('0x38')],qs[_0xa876('0x3a')](_0x78bbd2[_0xa876('0x34')][_0xa876('0x3a')]));_0x790338[_0xa876('0x39')]=_0x790338[_0xa876('0x39')][_0xa876('0x3b')]?_0x790338[_0xa876('0x39')]:_0x195e72[_0xa876('0x38')];_0x790338[_0xa876('0x3c')]=qs[_0xa876('0x3d')](_0x78bbd2['query'][_0xa876('0x3d')]);_0x790338['where']=qs[_0xa876('0x36')](_[_0xa876('0x58')](_0x78bbd2['query'],_0x195e72[_0xa876('0x36')]));if(_0x78bbd2[_0xa876('0x34')][_0xa876('0x3e')]){_0x790338['where']=_[_0xa876('0x40')](_0x790338['where'],{'$or':_['map'](_0x790338[_0xa876('0x39')],function(_0x3f5052){var _0x16e4a1={};_0x16e4a1[_0x3f5052]={'$like':'%'+_0x78bbd2[_0xa876('0x34')][_0xa876('0x3e')]+'%'};return _0x16e4a1;})});}_0x790338=_[_0xa876('0x40')]({},_0x790338,_0x78bbd2[_0xa876('0x43')]);return _0x536d69[_0xa876('0x65')](_0x790338);}})[_0xa876('0x2a')](function(_0x2ec6be){if(_0x2ec6be){_0x3eec6b=_0x2ec6be[_0xa876('0x3b')];if(!_0x78bbd2[_0xa876('0x34')][_0xa876('0x66')](_0xa876('0x67'))){_0x790338[_0xa876('0x24')]=qs[_0xa876('0x24')](_0x78bbd2['query'][_0xa876('0x24')]);_0x790338['offset']=qs['offset'](_0x78bbd2[_0xa876('0x34')][_0xa876('0x23')]);}return _0x536d69[_0xa876('0x65')](_0x790338);}})[_0xa876('0x2a')](function(_0x3070f5){if(_0x3070f5){return _0x3070f5?{'count':_0x3eec6b,'rows':_0x3070f5}:null;}})[_0xa876('0x2a')](respondWithResult(_0x14cfb9,null))[_0xa876('0x4b')](handleError(_0x14cfb9,null));};exports['addTeams']=function(_0x586744,_0x3ff632,_0x515029){var _0x197272=_0x586744[_0xa876('0x4d')][_0xa876('0x68')];return db[_0xa876('0x64')][_0xa876('0x45')]({'where':{'id':_0x197272},'attributes':['id'],'include':[{'model':db[_0xa876('0x5b')],'as':'Agents','attributes':['id',_0xa876('0x30'),_0xa876('0x69'),'voicePause',_0xa876('0x6a')],'raw':!![]}]})[_0xa876('0x2a')](function(_0x311237){if(_0x311237){var _0x497efd=_[_0xa876('0x6b')](_0x311237,function(_0x4d8ea7){var _0x5c72fc=_0x4d8ea7[_0xa876('0x2b')]({'plain':!![]});return _0x5c72fc[_0xa876('0x6c')];});return db[_0xa876('0x32')]['find']({'where':{'id':_0x586744[_0xa876('0x47')]['id']}})[_0xa876('0x2a')](function(_0x9f7b85){return db['sequelize'][_0xa876('0x6d')](function(_0x18ab3b){return _0x9f7b85[_0xa876('0x6e')](_0x197272,{'transaction':_0x18ab3b})[_0xa876('0x2a')](function(){return BPromise['each'](_0x497efd,function(_0x471bf9){return db[_0xa876('0x5a')]['findOrCreate']({'where':{'UserId':_0x471bf9['id'],'OpenchannelQueueId':_0x586744[_0xa876('0x47')]['id']},'transaction':_0x18ab3b});});})[_0xa876('0x2a')](function(){_0x497efd[_0xa876('0x6f')](function(_0x3aee8b){socket[_0xa876('0x70')](_0xa876('0x71'),{'UserId':_0x3aee8b['id'],'OpenchannelQueueId':_0x9f7b85['id']});});});});});}})[_0xa876('0x2a')](respondWithStatusCode(_0x3ff632,null))['catch'](handleError(_0x3ff632,null));};exports[_0xa876('0x72')]=function(_0xe35c71,_0x53d29d,_0xe7d64b){return db[_0xa876('0x64')][_0xa876('0x45')]({'where':{'id':_0xe35c71['query'][_0xa876('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa876('0x5b')],'as':_0xa876('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xa876('0x2a')](handleEntityNotFound(_0x53d29d,null))[_0xa876('0x2a')](function(_0x397ce4){var _0x22802c=_[_0xa876('0x31')](_0x397ce4,'id');var _0x3b863a=[];var _0x4638af=[];var _0x18ffa0=squel[_0xa876('0x73')]();_0x18ffa0['field'](_0xa876('0x74'))[_0xa876('0x75')](_0xa876('0x76'),'tq')[_0xa876('0x77')](_0xa876('0x78'),'ut',_0xa876('0x79'))['where'](_0xa876('0x7a'),_0xe35c71[_0xa876('0x47')]['id']);for(var _0xc28c69=0x0;_0xc28c69<_0x397ce4[_0xa876('0x3b')];_0xc28c69+=0x1){let _0x50e1c3=_0x397ce4[_0xc28c69];for(var _0x180fa6=0x0;_0x180fa6<_0x50e1c3['Agents']['length'];_0x180fa6+=0x1){let _0x46891e=_0x50e1c3['Agents'][_0x180fa6];var _0x5e90b8=_0x18ffa0[_0xa876('0x7b')]();_0x5e90b8['where'](_0xa876('0x7c'),_0x46891e['id']);_0x4638af[_0xa876('0x7d')](db['sequelize'][_0xa876('0x34')](_0x5e90b8[_0xa876('0x7e')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xa876('0x2a')](function(_0x3d02e4){if(_0x3d02e4[_0xa876('0x3b')]===0x1){return _0x46891e['id'];}else{var _0x376d9b=_[_0xa876('0x7f')](_['map'](_0x3d02e4,_0xa876('0x80')),function(_0x277247){return _[_0xa876('0x81')](_0x22802c,_0x277247);});if(_0x376d9b){return _0x46891e['id'];}}}));}}return BPromise[_0xa876('0x82')](_0x4638af)[_0xa876('0x2a')](function(_0x3bcb78){_0x3b863a=_(_0x3b863a)[_0xa876('0x83')](_0x3bcb78)[_0xa876('0x84')]()[_0xa876('0x85')]();return db[_0xa876('0x32')][_0xa876('0x4a')]({'where':{'id':_0xe35c71[_0xa876('0x47')]['id']}})[_0xa876('0x2a')](function(_0x1ddff7){return db['sequelize'][_0xa876('0x6d')](function(_0x5a8734){return _0x1ddff7[_0xa876('0x72')](_0xe35c71[_0xa876('0x34')][_0xa876('0x68')],{'transaction':_0x5a8734})['then'](function(){if(!_[_0xa876('0x86')](_0x3b863a)){return _0x1ddff7[_0xa876('0x87')](_0x3b863a,{'transaction':_0x5a8734});}})['then'](function(){_0x3b863a['forEach'](function(_0x2c756e){socket[_0xa876('0x70')](_0xa876('0x88'),{'UserId':_0x2c756e,'OpenchannelQueueId':_0x1ddff7['id']});});});});});});})[_0xa876('0x2a')](respondWithStatusCode(_0x53d29d,null))[_0xa876('0x4b')](handleError(_0x53d29d,null));};exports[_0xa876('0x89')]=function(_0x11a149,_0x3614a1,_0xd660b2){return db['OpenchannelQueue'][_0xa876('0x4a')]({'where':{'id':_0x11a149[_0xa876('0x47')]['id']}})[_0xa876('0x2a')](handleEntityNotFound(_0x3614a1,null))['then'](function(_0x2210ed){if(_0x2210ed){return _0x2210ed[_0xa876('0x89')](_0x11a149['body'][_0xa876('0x68')],_[_0xa876('0x8a')](_0x11a149[_0xa876('0x4d')],[_0xa876('0x68'),'id'])||{})[_0xa876('0x8b')](function(_0x6eb7b1){for(var _0x5ab8f8=0x0;_0x5ab8f8<_0x11a149[_0xa876('0x4d')][_0xa876('0x68')][_0xa876('0x3b')];_0x5ab8f8+=0x1){socket[_0xa876('0x70')]('userOpenchannelQueue:save',{'UserId':_0x11a149['body'][_0xa876('0x68')][_0x5ab8f8],'OpenchannelQueueId':_0x11a149[_0xa876('0x47')]['id']});}return _0x6eb7b1;});}})[_0xa876('0x2a')](respondWithResult(_0x3614a1,null))['catch'](handleError(_0x3614a1,null));};exports[_0xa876('0x87')]=function(_0x4b3b87,_0x103d83,_0x4e4917){return db[_0xa876('0x32')]['find']({'where':{'id':_0x4b3b87[_0xa876('0x47')]['id']}})[_0xa876('0x2a')](handleEntityNotFound(_0x103d83,null))['then'](function(_0x9e7b3b){if(_0x9e7b3b){return _0x9e7b3b[_0xa876('0x87')](_0x4b3b87[_0xa876('0x34')][_0xa876('0x68')])[_0xa876('0x2a')](function(){if(_[_0xa876('0x8c')](_0x4b3b87[_0xa876('0x34')][_0xa876('0x68')])){for(var _0x102fe5=0x0;_0x102fe5<_0x4b3b87[_0xa876('0x34')][_0xa876('0x68')][_0xa876('0x3b')];_0x102fe5+=0x1){socket[_0xa876('0x70')](_0xa876('0x88'),{'UserId':Number(_0x4b3b87[_0xa876('0x34')][_0xa876('0x68')][_0x102fe5]),'OpenchannelQueueId':Number(_0x4b3b87[_0xa876('0x47')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x4b3b87[_0xa876('0x34')]['ids']),'OpenchannelQueueId':Number(_0x4b3b87[_0xa876('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x103d83,null))[_0xa876('0x4b')](handleError(_0x103d83,null));};exports[_0xa876('0x8d')]=function(_0x4e36ea,_0x4afbc6,_0x371fed){var _0x4985a2={};var _0x35f941={};var _0x49822a;var _0x5de7bc;return db[_0xa876('0x32')][_0xa876('0x57')]({'where':{'id':_0x4e36ea[_0xa876('0x47')]['id']}})[_0xa876('0x2a')](handleEntityNotFound(_0x4afbc6,null))[_0xa876('0x2a')](function(_0x2def4d){if(_0x2def4d){_0x49822a=_0x2def4d;_0x35f941[_0xa876('0x38')]=_[_0xa876('0x35')](db[_0xa876('0x5b')]['rawAttributes']);_0x35f941[_0xa876('0x34')]=_[_0xa876('0x35')](_0x4e36ea[_0xa876('0x34')]);_0x35f941[_0xa876('0x36')]=_['intersection'](_0x35f941[_0xa876('0x38')],_0x35f941[_0xa876('0x34')]);_0x4985a2['attributes']=_[_0xa876('0x37')](_0x35f941[_0xa876('0x38')],qs[_0xa876('0x3a')](_0x4e36ea[_0xa876('0x34')][_0xa876('0x3a')]));_0x4985a2[_0xa876('0x39')]=_0x4985a2[_0xa876('0x39')][_0xa876('0x3b')]?_0x4985a2['attributes']:_0x35f941[_0xa876('0x38')];_0x4985a2[_0xa876('0x3c')]=qs['sort'](_0x4e36ea[_0xa876('0x34')][_0xa876('0x3d')]);_0x4985a2[_0xa876('0x3f')]=qs[_0xa876('0x36')](_['pick'](_0x4e36ea['query'],_0x35f941['filters']));if(_0x4e36ea[_0xa876('0x34')][_0xa876('0x3e')]){_0x4985a2[_0xa876('0x3f')]=_['merge'](_0x4985a2['where'],{'$or':_['map'](_0x4985a2[_0xa876('0x39')],function(_0x56e2b2){var _0x5eefef={};_0x5eefef[_0x56e2b2]={'$like':'%'+_0x4e36ea[_0xa876('0x34')][_0xa876('0x3e')]+'%'};return _0x5eefef;})});}_0x4985a2=_[_0xa876('0x40')]({},_0x4985a2,_0x4e36ea[_0xa876('0x43')]);return _0x49822a['getAgents'](_0x4985a2);}})['then'](function(_0x1b4aa){if(_0x1b4aa){_0x5de7bc=_0x1b4aa[_0xa876('0x3b')];if(!_0x4e36ea[_0xa876('0x34')]['hasOwnProperty'](_0xa876('0x67'))){_0x4985a2[_0xa876('0x24')]=qs[_0xa876('0x24')](_0x4e36ea[_0xa876('0x34')]['limit']);_0x4985a2[_0xa876('0x23')]=qs[_0xa876('0x23')](_0x4e36ea[_0xa876('0x34')][_0xa876('0x23')]);}return _0x49822a[_0xa876('0x8d')](_0x4985a2);}})['then'](function(_0x109de9){if(_0x109de9){return _0x109de9?{'count':_0x5de7bc,'rows':_0x109de9}:null;}})['then'](respondWithResult(_0x4afbc6,null))[_0xa876('0x4b')](handleError(_0x4afbc6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6b50220..a36b4f3 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 _0xacdf=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','OpenchannelQueue'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xacdf,0x180));var _0xfacd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xacdf[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0xfacd('0x0'));var OpenchannelQueue=require(_0xfacd('0x1'))['db'][_0xfacd('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xfacd('0x3')](0x0);var events={'afterCreate':_0xfacd('0x4'),'afterUpdate':_0xfacd('0x5'),'afterDestroy':_0xfacd('0x6')};function emitEvent(_0x50d73d){return function(_0x3dc194,_0x16c4e1,_0x16f570){OpenchannelQueueEvents[_0xfacd('0x7')](_0x50d73d+':'+_0x3dc194['id'],_0x3dc194);OpenchannelQueueEvents['emit'](_0x50d73d,_0x3dc194);_0x16f570(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xfacd('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x16fe=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x111fed,_0x4587d8){var _0x13037a=function(_0x486a6f){while(--_0x486a6f){_0x111fed['push'](_0x111fed['shift']());}};_0x13037a(++_0x4587d8);}(_0x16fe,0x1c7));var _0xe16f=function(_0x5dd1b9,_0x10552d){_0x5dd1b9=_0x5dd1b9-0x0;var _0x264ded=_0x16fe[_0x5dd1b9];return _0x264ded;};'use strict';var EventEmitter=require(_0xe16f('0x0'));var OpenchannelQueue=require(_0xe16f('0x1'))['db'][_0xe16f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe16f('0x3')](0x0);var events={'afterCreate':_0xe16f('0x4'),'afterUpdate':'update','afterDestroy':_0xe16f('0x5')};function emitEvent(_0x2954f5){return function(_0x43d94c,_0x57a334,_0x5ef0d7){OpenchannelQueueEvents['emit'](_0x2954f5+':'+_0x43d94c['id'],_0x43d94c);OpenchannelQueueEvents[_0xe16f('0x6')](_0x2954f5,_0x43d94c);_0x5ef0d7(null);};}for(var e in events){if(events[_0xe16f('0x7')](e)){var event=events[e];OpenchannelQueue[_0xe16f('0x8')](e,emitEvent(event));}}module[_0xe16f('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f59093e..8ea8243 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 _0xcfa3=['./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x157125,_0x11455d){var _0x4ffb8e=function(_0x33085d){while(--_0x33085d){_0x157125['push'](_0x157125['shift']());}};_0x4ffb8e(++_0x11455d);}(_0xcfa3,0x88));var _0x3cfa=function(_0x3581a2,_0x5d04e9){_0x3581a2=_0x3581a2-0x0;var _0x2bf01c=_0xcfa3[_0x3581a2];return _0x2bf01c;};'use strict';var _=require('lodash');var util=require(_0x3cfa('0x0'));var logger=require('../../config/logger')(_0x3cfa('0x1'));var moment=require(_0x3cfa('0x2'));var BPromise=require('bluebird');var rp=require(_0x3cfa('0x3'));var fs=require('fs');var path=require(_0x3cfa('0x4'));var rimraf=require(_0x3cfa('0x5'));var config=require(_0x3cfa('0x6'));var attributes=require(_0x3cfa('0x7'));module[_0x3cfa('0x8')]=function(_0x3adb1e,_0x454773){return _0x3adb1e['define'](_0x3cfa('0x9'),attributes,{'tableName':_0x3cfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39ca=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x39ca,0xb7));var _0xa39c=function(_0x2bdeef,_0x21f965){_0x2bdeef=_0x2bdeef-0x0;var _0x59664b=_0x39ca[_0x2bdeef];return _0x59664b;};'use strict';var _=require(_0xa39c('0x0'));var util=require(_0xa39c('0x1'));var logger=require(_0xa39c('0x2'))(_0xa39c('0x3'));var moment=require(_0xa39c('0x4'));var BPromise=require(_0xa39c('0x5'));var rp=require(_0xa39c('0x6'));var fs=require('fs');var path=require(_0xa39c('0x7'));var rimraf=require(_0xa39c('0x8'));var config=require(_0xa39c('0x9'));var attributes=require(_0xa39c('0xa'));module[_0xa39c('0xb')]=function(_0x26d6e5,_0x5e34cf){return _0x26d6e5[_0xa39c('0xc')](_0xa39c('0xd'),attributes,{'tableName':_0xa39c('0xe'),'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 fa6e40e..2c1118b 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 _0x0dc4=['catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','map','model','attributes','find','where','ShowOpenchannelQueue','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result'];(function(_0x2c0713,_0x36fea5){var _0x561f37=function(_0x17135d){while(--_0x17135d){_0x2c0713['push'](_0x2c0713['shift']());}};_0x561f37(++_0x36fea5);}(_0x0dc4,0xe0));var _0x40dc=function(_0x4d50a1,_0x188247){_0x4d50a1=_0x4d50a1-0x0;var _0x2d733f=_0x0dc4[_0x4d50a1];return _0x2d733f;};'use strict';var _=require(_0x40dc('0x0'));var util=require(_0x40dc('0x1'));var moment=require('moment');var BPromise=require(_0x40dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40dc('0x3'));var db=require(_0x40dc('0x4'))['db'];var utils=require(_0x40dc('0x5'));var logger=require(_0x40dc('0x6'))('rpc');var config=require(_0x40dc('0x7'));var jayson=require(_0x40dc('0x8'));var client=jayson[_0x40dc('0x9')][_0x40dc('0xa')]({'port':0x232a});config['redis']=_[_0x40dc('0xb')](config[_0x40dc('0xc')],{'host':_0x40dc('0xd'),'port':0x18eb});var socket=require(_0x40dc('0xe'))(new Redis(config['redis']));require(_0x40dc('0xf'))[_0x40dc('0x10')](socket);function respondWithRpcPromise(_0x8716b1,_0x508027,_0x16ca7a){return new BPromise(function(_0x23b84b,_0x41894a){return client[_0x40dc('0x11')](_0x8716b1,_0x16ca7a)[_0x40dc('0x12')](function(_0x3a9351){logger[_0x40dc('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x508027,_0x40dc('0x14'));logger[_0x40dc('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x508027,_0x40dc('0x14'),JSON[_0x40dc('0x16')](_0x3a9351));if(_0x3a9351[_0x40dc('0x17')]){if(_0x3a9351[_0x40dc('0x17')][_0x40dc('0x18')]===0x1f4){logger[_0x40dc('0x17')](_0x40dc('0x19'),_0x508027,_0x3a9351['error'][_0x40dc('0x1a')]);return _0x41894a(_0x3a9351[_0x40dc('0x17')]['message']);}logger[_0x40dc('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x508027,_0x3a9351[_0x40dc('0x17')][_0x40dc('0x1a')]);return _0x23b84b(_0x3a9351[_0x40dc('0x17')][_0x40dc('0x1a')]);}else{logger[_0x40dc('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x508027,'request\x20sent');_0x23b84b(_0x3a9351[_0x40dc('0x1b')][_0x40dc('0x1a')]);}})[_0x40dc('0x1c')](function(_0x409f92){logger[_0x40dc('0x17')](_0x40dc('0x19'),_0x508027,_0x409f92);_0x41894a(_0x409f92);});});}exports[_0x40dc('0x1d')]=function(_0x3e88e2){var _0x313eff=this;return new Promise(function(_0x300c2a,_0x5eb212){return db[_0x40dc('0x1e')][_0x40dc('0x1f')]({'raw':_0x3e88e2[_0x40dc('0x20')]?_0x3e88e2[_0x40dc('0x20')][_0x40dc('0x21')]===undefined?!![]:![]:!![],'where':_0x3e88e2['options']?_0x3e88e2[_0x40dc('0x20')]['where']||null:null,'attributes':_0x3e88e2[_0x40dc('0x20')]?_0x3e88e2[_0x40dc('0x20')]['attributes']||null:null,'limit':_0x3e88e2['options']?_0x3e88e2['options'][_0x40dc('0x22')]||null:null,'include':_0x3e88e2['options']?_0x3e88e2['options'][_0x40dc('0x23')]?_[_0x40dc('0x24')](_0x3e88e2[_0x40dc('0x20')]['include'],function(_0x47bd4a){return{'model':db[_0x47bd4a['model']],'as':_0x47bd4a['as'],'attributes':_0x47bd4a['attributes'],'include':_0x47bd4a['include']?_[_0x40dc('0x24')](_0x47bd4a['include'],function(_0x2de52d){return{'model':db[_0x2de52d[_0x40dc('0x25')]],'as':_0x2de52d['as'],'attributes':_0x2de52d[_0x40dc('0x26')],'include':_0x2de52d['include']?_[_0x40dc('0x24')](_0x2de52d[_0x40dc('0x23')],function(_0xa47a72){return{'model':db[_0xa47a72[_0x40dc('0x25')]],'as':_0xa47a72['as'],'attributes':_0xa47a72['attributes']};}):[]};}):[]};}):[]:[]})[_0x40dc('0x12')](function(_0x5ba06e){logger[_0x40dc('0x13')]('GetOpenchannelQueue',_0x3e88e2);logger['debug'](_0x40dc('0x1d'),_0x3e88e2,JSON[_0x40dc('0x16')](_0x5ba06e));_0x300c2a(_0x5ba06e);})['catch'](function(_0x5f2745){logger[_0x40dc('0x17')]('GetOpenchannelQueue',_0x5f2745['message'],_0x3e88e2);_0x5eb212(_0x313eff[_0x40dc('0x17')](0x1f4,_0x5f2745[_0x40dc('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x503bba){var _0x4699a5=this;return new Promise(function(_0x6fc878,_0x4820e4){return db[_0x40dc('0x1e')][_0x40dc('0x27')]({'raw':_0x503bba[_0x40dc('0x20')]?_0x503bba[_0x40dc('0x20')][_0x40dc('0x21')]===undefined?!![]:![]:!![],'where':_0x503bba[_0x40dc('0x20')]?_0x503bba['options'][_0x40dc('0x28')]||null:null,'attributes':_0x503bba['options']?_0x503bba[_0x40dc('0x20')][_0x40dc('0x26')]||null:null,'include':_0x503bba['options']?_0x503bba[_0x40dc('0x20')][_0x40dc('0x23')]?_[_0x40dc('0x24')](_0x503bba[_0x40dc('0x20')][_0x40dc('0x23')],function(_0x1f7167){return{'model':db[_0x1f7167['model']],'as':_0x1f7167['as'],'attributes':_0x1f7167['attributes'],'include':_0x1f7167['include']?_[_0x40dc('0x24')](_0x1f7167[_0x40dc('0x23')],function(_0x11b2cf){return{'model':db[_0x11b2cf[_0x40dc('0x25')]],'as':_0x11b2cf['as'],'attributes':_0x11b2cf[_0x40dc('0x26')],'include':_0x11b2cf['include']?_[_0x40dc('0x24')](_0x11b2cf[_0x40dc('0x23')],function(_0x279848){return{'model':db[_0x279848[_0x40dc('0x25')]],'as':_0x279848['as'],'attributes':_0x279848[_0x40dc('0x26')]};}):[]};}):[]};}):[]:[]})[_0x40dc('0x12')](function(_0x5b17b4){logger['info'](_0x40dc('0x29'),_0x503bba);logger[_0x40dc('0x15')]('ShowOpenchannelQueue',_0x503bba,JSON[_0x40dc('0x16')](_0x5b17b4));_0x6fc878(_0x5b17b4);})[_0x40dc('0x1c')](function(_0x262263){logger['error'](_0x40dc('0x29'),_0x262263[_0x40dc('0x1a')],_0x503bba);_0x4820e4(_0x4699a5[_0x40dc('0x17')](0x1f4,_0x262263[_0x40dc('0x1a')]));});});}; \ No newline at end of file +var _0xe1e4=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','options','raw','where','attributes','include','model','map','then','GetOpenchannelQueue','ShowOpenchannelQueue','find','lodash','moment','bluebird'];(function(_0x44a59b,_0x18f8a5){var _0x5382c5=function(_0x453223){while(--_0x453223){_0x44a59b['push'](_0x44a59b['shift']());}};_0x5382c5(++_0x18f8a5);}(_0xe1e4,0x6c));var _0x4e1e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe1e4[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x4e1e('0x0'));var util=require('util');var moment=require(_0x4e1e('0x1'));var BPromise=require(_0x4e1e('0x2'));var rs=require(_0x4e1e('0x3'));var fs=require('fs');var Redis=require(_0x4e1e('0x4'));var db=require(_0x4e1e('0x5'))['db'];var utils=require(_0x4e1e('0x6'));var logger=require('../../config/logger')(_0x4e1e('0x7'));var config=require(_0x4e1e('0x8'));var jayson=require(_0x4e1e('0x9'));var client=jayson[_0x4e1e('0xa')][_0x4e1e('0xb')]({'port':0x232a});config[_0x4e1e('0xc')]=_['defaults'](config['redis'],{'host':_0x4e1e('0xd'),'port':0x18eb});var socket=require(_0x4e1e('0xe'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x11ac63,_0x2d6307,_0x45631b){return new BPromise(function(_0x2078d5,_0x15bb77){return client['request'](_0x11ac63,_0x45631b)['then'](function(_0x22ab32){logger[_0x4e1e('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x2d6307,'request\x20sent');logger[_0x4e1e('0x10')](_0x4e1e('0x11'),_0x2d6307,'request\x20sent',JSON[_0x4e1e('0x12')](_0x22ab32));if(_0x22ab32[_0x4e1e('0x13')]){if(_0x22ab32[_0x4e1e('0x13')][_0x4e1e('0x14')]===0x1f4){logger[_0x4e1e('0x13')](_0x4e1e('0x15'),_0x2d6307,_0x22ab32[_0x4e1e('0x13')][_0x4e1e('0x16')]);return _0x15bb77(_0x22ab32[_0x4e1e('0x13')][_0x4e1e('0x16')]);}logger['error'](_0x4e1e('0x15'),_0x2d6307,_0x22ab32[_0x4e1e('0x13')][_0x4e1e('0x16')]);return _0x2078d5(_0x22ab32[_0x4e1e('0x13')][_0x4e1e('0x16')]);}else{logger[_0x4e1e('0xf')](_0x4e1e('0x15'),_0x2d6307,'request\x20sent');_0x2078d5(_0x22ab32[_0x4e1e('0x17')]['message']);}})[_0x4e1e('0x18')](function(_0x137264){logger[_0x4e1e('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x2d6307,_0x137264);_0x15bb77(_0x137264);});});}exports['GetOpenchannelQueue']=function(_0x13c415){var _0x1144ff=this;return new Promise(function(_0x5eb776,_0x3a7e28){return db[_0x4e1e('0x19')]['findAll']({'raw':_0x13c415['options']?_0x13c415[_0x4e1e('0x1a')][_0x4e1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x13c415[_0x4e1e('0x1a')]?_0x13c415[_0x4e1e('0x1a')][_0x4e1e('0x1c')]||null:null,'attributes':_0x13c415[_0x4e1e('0x1a')]?_0x13c415['options'][_0x4e1e('0x1d')]||null:null,'limit':_0x13c415['options']?_0x13c415[_0x4e1e('0x1a')]['limit']||null:null,'include':_0x13c415[_0x4e1e('0x1a')]?_0x13c415[_0x4e1e('0x1a')][_0x4e1e('0x1e')]?_['map'](_0x13c415[_0x4e1e('0x1a')][_0x4e1e('0x1e')],function(_0x5d9d45){return{'model':db[_0x5d9d45[_0x4e1e('0x1f')]],'as':_0x5d9d45['as'],'attributes':_0x5d9d45['attributes'],'include':_0x5d9d45[_0x4e1e('0x1e')]?_[_0x4e1e('0x20')](_0x5d9d45['include'],function(_0x5bdb39){return{'model':db[_0x5bdb39[_0x4e1e('0x1f')]],'as':_0x5bdb39['as'],'attributes':_0x5bdb39[_0x4e1e('0x1d')],'include':_0x5bdb39[_0x4e1e('0x1e')]?_[_0x4e1e('0x20')](_0x5bdb39['include'],function(_0x55982f){return{'model':db[_0x55982f[_0x4e1e('0x1f')]],'as':_0x55982f['as'],'attributes':_0x55982f[_0x4e1e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4e1e('0x21')](function(_0x2e0bab){logger['info']('GetOpenchannelQueue',_0x13c415);logger[_0x4e1e('0x10')](_0x4e1e('0x22'),_0x13c415,JSON[_0x4e1e('0x12')](_0x2e0bab));_0x5eb776(_0x2e0bab);})[_0x4e1e('0x18')](function(_0x38c07e){logger[_0x4e1e('0x13')](_0x4e1e('0x22'),_0x38c07e['message'],_0x13c415);_0x3a7e28(_0x1144ff[_0x4e1e('0x13')](0x1f4,_0x38c07e['message']));});});};exports[_0x4e1e('0x23')]=function(_0x3e6ba0){var _0x510744=this;return new Promise(function(_0x42f92c,_0x13fa31){return db[_0x4e1e('0x19')][_0x4e1e('0x24')]({'raw':_0x3e6ba0['options']?_0x3e6ba0[_0x4e1e('0x1a')][_0x4e1e('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e6ba0[_0x4e1e('0x1a')]?_0x3e6ba0[_0x4e1e('0x1a')][_0x4e1e('0x1c')]||null:null,'attributes':_0x3e6ba0[_0x4e1e('0x1a')]?_0x3e6ba0[_0x4e1e('0x1a')]['attributes']||null:null,'include':_0x3e6ba0[_0x4e1e('0x1a')]?_0x3e6ba0[_0x4e1e('0x1a')][_0x4e1e('0x1e')]?_[_0x4e1e('0x20')](_0x3e6ba0[_0x4e1e('0x1a')][_0x4e1e('0x1e')],function(_0x7a225c){return{'model':db[_0x7a225c[_0x4e1e('0x1f')]],'as':_0x7a225c['as'],'attributes':_0x7a225c['attributes'],'include':_0x7a225c[_0x4e1e('0x1e')]?_[_0x4e1e('0x20')](_0x7a225c['include'],function(_0x523e0e){return{'model':db[_0x523e0e[_0x4e1e('0x1f')]],'as':_0x523e0e['as'],'attributes':_0x523e0e['attributes'],'include':_0x523e0e[_0x4e1e('0x1e')]?_['map'](_0x523e0e['include'],function(_0x2e4e51){return{'model':db[_0x2e4e51[_0x4e1e('0x1f')]],'as':_0x2e4e51['as'],'attributes':_0x2e4e51[_0x4e1e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4e1e('0x21')](function(_0x256982){logger[_0x4e1e('0xf')](_0x4e1e('0x23'),_0x3e6ba0);logger[_0x4e1e('0x10')](_0x4e1e('0x23'),_0x3e6ba0,JSON[_0x4e1e('0x12')](_0x256982));_0x42f92c(_0x256982);})[_0x4e1e('0x18')](function(_0x398eec){logger['error'](_0x4e1e('0x23'),_0x398eec[_0x4e1e('0x16')],_0x3e6ba0);_0x13fa31(_0x510744['error'](0x1f4,_0x398eec[_0x4e1e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 542a06b..71cf3e3 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 _0x4499=['emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','remove','update'];(function(_0x589e0b,_0x5b2757){var _0x37cc38=function(_0x133be2){while(--_0x133be2){_0x589e0b['push'](_0x589e0b['shift']());}};_0x37cc38(++_0x5b2757);}(_0x4499,0x97));var _0x9449=function(_0x42c128,_0x3d1fcc){_0x42c128=_0x42c128-0x0;var _0x3661db=_0x4499[_0x42c128];return _0x3661db;};'use strict';var OpenchannelQueueEvents=require(_0x9449('0x0'));var events=['save',_0x9449('0x1'),_0x9449('0x2')];function createListener(_0x481956,_0x20ba63){return function(_0x599ae0){_0x20ba63[_0x9449('0x3')](_0x481956,_0x599ae0);};}function removeListener(_0x129634,_0x5689c5){return function(){OpenchannelQueueEvents[_0x9449('0x4')](_0x129634,_0x5689c5);};}exports['register']=function(_0x310454){for(var _0x357c94=0x0,_0x158521=events[_0x9449('0x5')];_0x357c94<_0x158521;_0x357c94++){var _0x428d36=events[_0x357c94];var _0x27ffb9=createListener(_0x9449('0x6')+_0x428d36,_0x310454);OpenchannelQueueEvents['on'](_0x428d36,_0x27ffb9);}}; \ No newline at end of file +var _0xa51c=['./openchannelQueue.events','save','remove','emit','removeListener','length','openchannelQueue:'];(function(_0x3b7c5d,_0x2d3b83){var _0xafc07e=function(_0x4008da){while(--_0x4008da){_0x3b7c5d['push'](_0x3b7c5d['shift']());}};_0xafc07e(++_0x2d3b83);}(_0xa51c,0x149));var _0xca51=function(_0x2894d7,_0x2efe69){_0x2894d7=_0x2894d7-0x0;var _0x54f58=_0xa51c[_0x2894d7];return _0x54f58;};'use strict';var OpenchannelQueueEvents=require(_0xca51('0x0'));var events=[_0xca51('0x1'),_0xca51('0x2'),'update'];function createListener(_0x1a839a,_0x874251){return function(_0xf586aa){_0x874251[_0xca51('0x3')](_0x1a839a,_0xf586aa);};}function removeListener(_0x1e1cae,_0x171e2c){return function(){OpenchannelQueueEvents[_0xca51('0x4')](_0x1e1cae,_0x171e2c);};}exports['register']=function(_0x3b8b48){for(var _0x49af05=0x0,_0x16c5d8=events[_0xca51('0x5')];_0x49af05<_0x16c5d8;_0x49af05++){var _0x48a07b=events[_0x49af05];var _0x12c004=createListener(_0xca51('0x6')+_0x48a07b,_0x3b8b48);OpenchannelQueueEvents['on'](_0x48a07b,_0x12c004);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ebe0cc6..3964178 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 _0x7f72=['path','connect-timeout','express','Router','../../components/interaction/service','./openchannelQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','exports'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x7f72,0x187));var _0x27f7=function(_0xf671c8,_0x275759){_0xf671c8=_0xf671c8-0x0;var _0x2a7d44=_0x7f72[_0xf671c8];return _0x2a7d44;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x27f7('0x0'));var timeout=require(_0x27f7('0x1'));var express=require(_0x27f7('0x2'));var router=express[_0x27f7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x27f7('0x4'));var config=require('../../config/environment');var controller=require(_0x27f7('0x5'));router[_0x27f7('0x6')]('/',auth['isAuthenticated'](),controller[_0x27f7('0x7')]);router['get']('/describe',auth[_0x27f7('0x8')](),controller[_0x27f7('0x9')]);router[_0x27f7('0x6')](_0x27f7('0xa'),auth[_0x27f7('0x8')](),controller[_0x27f7('0xb')]);router[_0x27f7('0xc')]('/',auth[_0x27f7('0x8')](),controller[_0x27f7('0xd')]);router[_0x27f7('0xe')]('/:id',auth[_0x27f7('0x8')](),controller[_0x27f7('0xf')]);router['delete'](_0x27f7('0xa'),auth[_0x27f7('0x8')](),controller['destroy']);module[_0x27f7('0x10')]=router; \ No newline at end of file +var _0x2f3c=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0x2f3c,0x1b0));var _0xc2f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f3c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc2f3('0x0'));var util=require(_0xc2f3('0x1'));var path=require(_0xc2f3('0x2'));var timeout=require(_0xc2f3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc2f3('0x4'));var interaction=require(_0xc2f3('0x5'));var config=require('../../config/environment');var controller=require(_0xc2f3('0x6'));router[_0xc2f3('0x7')]('/',auth[_0xc2f3('0x8')](),controller['index']);router[_0xc2f3('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xc2f3('0x9')]);router[_0xc2f3('0x7')](_0xc2f3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc2f3('0xb')]('/',auth[_0xc2f3('0x8')](),controller[_0xc2f3('0xc')]);router[_0xc2f3('0xd')](_0xc2f3('0xa'),auth['isAuthenticated'](),controller[_0xc2f3('0xe')]);router[_0xc2f3('0xf')](_0xc2f3('0xa'),auth['isAuthenticated'](),controller[_0xc2f3('0x10')]);module[_0xc2f3('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 7742159..0bee53b 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 _0x7d05=['sequelize','exports','STRING','DATE','moment'];(function(_0x253497,_0xac2d7e){var _0x53203c=function(_0x10aca5){while(--_0x10aca5){_0x253497['push'](_0x253497['shift']());}};_0x53203c(++_0xac2d7e);}(_0x7d05,0x90));var _0x57d0=function(_0x49d8e5,_0x7a3133){_0x49d8e5=_0x49d8e5-0x0;var _0x4943d7=_0x7d05[_0x49d8e5];return _0x4943d7;};'use strict';var moment=require(_0x57d0('0x0'));var Sequelize=require(_0x57d0('0x1'));module[_0x57d0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x57d0('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x57d0('0x4')]},'exitAt':{'type':Sequelize[_0x57d0('0x4')]},'reason':{'type':Sequelize[_0x57d0('0x3')]}}; \ No newline at end of file +var _0x4259=['exports','STRING','DATE','moment','sequelize'];(function(_0x2f485c,_0x4f0ab0){var _0x349c19=function(_0x5deefb){while(--_0x5deefb){_0x2f485c['push'](_0x2f485c['shift']());}};_0x349c19(++_0x4f0ab0);}(_0x4259,0x107));var _0x9425=function(_0x29c6f,_0x38d350){_0x29c6f=_0x29c6f-0x0;var _0x17394e=_0x4259[_0x29c6f];return _0x17394e;};'use strict';var moment=require(_0x9425('0x0'));var Sequelize=require(_0x9425('0x1'));module[_0x9425('0x2')]={'uniqueid':{'type':Sequelize[_0x9425('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9425('0x3')]},'joinAt':{'type':Sequelize[_0x9425('0x4')]},'leaveAt':{'type':Sequelize[_0x9425('0x4')]},'acceptAt':{'type':Sequelize[_0x9425('0x4')]},'exitAt':{'type':Sequelize[_0x9425('0x4')]},'reason':{'type':Sequelize[_0x9425('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index fc545fd..85e25c6 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 _0x0118=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','filter','options','OpenchannelQueueReport','includeAll','findAll','catch','show','keys','find','create','update','body','params','describe','html-pdf','eml-format','rimraf'];(function(_0x56b750,_0x40fc03){var _0x3e421a=function(_0x5378c4){while(--_0x5378c4){_0x56b750['push'](_0x56b750['shift']());}};_0x3e421a(++_0x40fc03);}(_0x0118,0x131));var _0x8011=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0118[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x8011('0x0'));var emlformat=require(_0x8011('0x1'));var rimraf=require(_0x8011('0x2'));var zipdir=require(_0x8011('0x3'));var jsonpatch=require(_0x8011('0x4'));var rp=require(_0x8011('0x5'));var moment=require(_0x8011('0x6'));var BPromise=require(_0x8011('0x7'));var Mustache=require(_0x8011('0x8'));var util=require(_0x8011('0x9'));var path=require(_0x8011('0xa'));var sox=require('sox');var csv=require(_0x8011('0xb'));var ejs=require(_0x8011('0xc'));var fs=require('fs');var _=require(_0x8011('0xd'));var squel=require(_0x8011('0xe'));var crypto=require('crypto');var jsforce=require(_0x8011('0xf'));var deskjs=require(_0x8011('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8011('0x11'));var Papa=require(_0x8011('0x12'));var Redis=require(_0x8011('0x13'));var authService=require(_0x8011('0x14'));var qs=require(_0x8011('0x15'));var as=require(_0x8011('0x16'));var hardwareService=require(_0x8011('0x17'));var logger=require(_0x8011('0x18'))(_0x8011('0x19'));var utils=require(_0x8011('0x1a'));var config=require(_0x8011('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36e6a6,_0x4bbc3d){_0x4bbc3d=_0x4bbc3d||0xcc;return function(_0x2a2cb0){if(_0x2a2cb0){return _0x36e6a6[_0x8011('0x1c')](_0x4bbc3d);}return _0x36e6a6['status'](_0x4bbc3d)[_0x8011('0x1d')]();};}function respondWithResult(_0x4c589c,_0x3f51c2){_0x3f51c2=_0x3f51c2||0xc8;return function(_0x496d93){if(_0x496d93){return _0x4c589c[_0x8011('0x1e')](_0x3f51c2)[_0x8011('0x1f')](_0x496d93);}};}function respondWithFilteredResult(_0x47285c,_0x479ed6){return function(_0x51c14e){if(_0x51c14e){var _0x3762b7=_0x51c14e[_0x8011('0x20')],_0x5bb039=_0x479ed6[_0x8011('0x21')],_0x32b3bc=_0x479ed6[_0x8011('0x21')]+_0x479ed6[_0x8011('0x22')],_0x4285ec;if(_0x32b3bc>=_0x3762b7){_0x32b3bc=_0x3762b7;_0x4285ec=0xc8;}else{_0x4285ec=0xce;}_0x47285c[_0x8011('0x1e')](_0x4285ec);return _0x47285c[_0x8011('0x23')](_0x8011('0x24'),_0x5bb039+'-'+_0x32b3bc+'/'+_0x3762b7)[_0x8011('0x1f')](_0x51c14e);}return null;};}function patchUpdates(_0x1f09db){return function(_0x2827fb){try{jsonpatch['apply'](_0x2827fb,_0x1f09db,!![]);}catch(_0x35445d){return BPromise[_0x8011('0x25')](_0x35445d);}return _0x2827fb[_0x8011('0x26')]();};}function saveUpdates(_0xbdaaa7,_0x3be361){return function(_0x5822d3){if(_0x5822d3){return _0x5822d3['update'](_0xbdaaa7)[_0x8011('0x27')](function(_0xb075eb){return _0xb075eb;});}return null;};}function removeEntity(_0x31e8e6,_0x5bfc02){return function(_0x252c90){if(_0x252c90){return _0x252c90[_0x8011('0x28')]()['then'](function(){_0x31e8e6[_0x8011('0x1e')](0xcc)[_0x8011('0x1d')]();});}};}function handleEntityNotFound(_0x9b8f62,_0x55369a){return function(_0xf3430f){if(!_0xf3430f){_0x9b8f62[_0x8011('0x1c')](0x194);}return _0xf3430f;};}function handleError(_0x48eb2a,_0x21ddc3){_0x21ddc3=_0x21ddc3||0x1f4;return function(_0x18aff2){logger[_0x8011('0x29')](_0x18aff2[_0x8011('0x2a')]);if(_0x18aff2[_0x8011('0x2b')]){delete _0x18aff2[_0x8011('0x2b')];}_0x48eb2a[_0x8011('0x1e')](_0x21ddc3)[_0x8011('0x2c')](_0x18aff2);};}exports[_0x8011('0x2d')]=function(_0x41a97a,_0x282d97){var _0x2985f8={},_0x2133d6={},_0x477525={'count':0x0,'rows':[]};var _0x2eca62=_[_0x8011('0x2e')](db['OpenchannelQueueReport'][_0x8011('0x2f')],function(_0x118479){return{'name':_0x118479[_0x8011('0x30')],'type':_0x118479[_0x8011('0x31')][_0x8011('0x32')]};});_0x2133d6[_0x8011('0x33')]=_[_0x8011('0x2e')](_0x2eca62,'name');_0x2133d6[_0x8011('0x34')]=_['keys'](_0x41a97a['query']);_0x2133d6[_0x8011('0x35')]=_[_0x8011('0x36')](_0x2133d6[_0x8011('0x33')],_0x2133d6['query']);_0x2985f8['attributes']=_['intersection'](_0x2133d6[_0x8011('0x33')],qs[_0x8011('0x37')](_0x41a97a['query'][_0x8011('0x37')]));_0x2985f8['attributes']=_0x2985f8[_0x8011('0x38')][_0x8011('0x39')]?_0x2985f8['attributes']:_0x2133d6[_0x8011('0x33')];if(!_0x41a97a[_0x8011('0x34')]['hasOwnProperty']('nolimit')){_0x2985f8[_0x8011('0x22')]=qs[_0x8011('0x22')](_0x41a97a[_0x8011('0x34')][_0x8011('0x22')]);_0x2985f8[_0x8011('0x21')]=qs[_0x8011('0x21')](_0x41a97a['query'][_0x8011('0x21')]);}_0x2985f8[_0x8011('0x3a')]=qs[_0x8011('0x3b')](_0x41a97a[_0x8011('0x34')][_0x8011('0x3b')]);_0x2985f8[_0x8011('0x3c')]=qs[_0x8011('0x35')](_[_0x8011('0x3d')](_0x41a97a['query'],_0x2133d6[_0x8011('0x35')]),_0x2eca62);if(_0x41a97a[_0x8011('0x34')]['filter']){_0x2985f8['where']=_[_0x8011('0x3e')](_0x2985f8['where'],{'$or':_[_0x8011('0x2e')](_0x2eca62,function(_0x19e600){if(_0x19e600[_0x8011('0x31')]!=='VIRTUAL'){var _0x3328a8={};_0x3328a8[_0x19e600[_0x8011('0x2b')]]={'$like':'%'+_0x41a97a[_0x8011('0x34')][_0x8011('0x3f')]+'%'};return _0x3328a8;}})});}_0x2985f8=_[_0x8011('0x3e')]({},_0x2985f8,_0x41a97a[_0x8011('0x40')]);var _0x23c0aa={'where':_0x2985f8[_0x8011('0x3c')]};return db[_0x8011('0x41')][_0x8011('0x20')](_0x23c0aa)[_0x8011('0x27')](function(_0x5d0d6f){_0x477525[_0x8011('0x20')]=_0x5d0d6f;if(_0x41a97a[_0x8011('0x34')][_0x8011('0x42')]){_0x2985f8['include']=[{'all':!![]}];}return db[_0x8011('0x41')][_0x8011('0x43')](_0x2985f8);})['then'](function(_0x374e94){_0x477525['rows']=_0x374e94;return _0x477525;})[_0x8011('0x27')](respondWithFilteredResult(_0x282d97,_0x2985f8))[_0x8011('0x44')](handleError(_0x282d97,null));};exports[_0x8011('0x45')]=function(_0x188c13,_0x3f5900){var _0x453ca1={'raw':!![],'where':{'id':_0x188c13['params']['id']}},_0x5afac8={};_0x5afac8[_0x8011('0x33')]=_[_0x8011('0x46')](db['OpenchannelQueueReport'][_0x8011('0x2f')]);_0x5afac8['query']=_[_0x8011('0x46')](_0x188c13[_0x8011('0x34')]);_0x5afac8['filters']=_[_0x8011('0x36')](_0x5afac8[_0x8011('0x33')],_0x5afac8['query']);_0x453ca1[_0x8011('0x38')]=_['intersection'](_0x5afac8['model'],qs[_0x8011('0x37')](_0x188c13['query'][_0x8011('0x37')]));_0x453ca1[_0x8011('0x38')]=_0x453ca1[_0x8011('0x38')][_0x8011('0x39')]?_0x453ca1['attributes']:_0x5afac8[_0x8011('0x33')];if(_0x188c13['query'][_0x8011('0x42')]){_0x453ca1['include']=[{'all':!![]}];}_0x453ca1=_[_0x8011('0x3e')]({},_0x453ca1,_0x188c13[_0x8011('0x40')]);return db[_0x8011('0x41')][_0x8011('0x47')](_0x453ca1)[_0x8011('0x27')](handleEntityNotFound(_0x3f5900,null))[_0x8011('0x27')](respondWithResult(_0x3f5900,null))['catch'](handleError(_0x3f5900,null));};exports[_0x8011('0x48')]=function(_0x4bfcfe,_0x1b06e4){return db[_0x8011('0x41')][_0x8011('0x48')](_0x4bfcfe['body'],{})['then'](respondWithResult(_0x1b06e4,0xc9))[_0x8011('0x44')](handleError(_0x1b06e4,null));};exports[_0x8011('0x49')]=function(_0x256d20,_0x258b6e){if(_0x256d20[_0x8011('0x4a')]['id']){delete _0x256d20[_0x8011('0x4a')]['id'];}return db[_0x8011('0x41')][_0x8011('0x47')]({'where':{'id':_0x256d20[_0x8011('0x4b')]['id']}})[_0x8011('0x27')](handleEntityNotFound(_0x258b6e,null))[_0x8011('0x27')](saveUpdates(_0x256d20[_0x8011('0x4a')],null))[_0x8011('0x27')](respondWithResult(_0x258b6e,null))['catch'](handleError(_0x258b6e,null));};exports['destroy']=function(_0x565096,_0x3ab8de){return db['OpenchannelQueueReport'][_0x8011('0x47')]({'where':{'id':_0x565096[_0x8011('0x4b')]['id']}})[_0x8011('0x27')](handleEntityNotFound(_0x3ab8de,null))[_0x8011('0x27')](removeEntity(_0x3ab8de,null))[_0x8011('0x44')](handleError(_0x3ab8de,null));};exports[_0x8011('0x4c')]=function(_0x25dc36,_0x54cc01){return db[_0x8011('0x41')][_0x8011('0x4c')]()[_0x8011('0x27')](respondWithResult(_0x54cc01,null))['catch'](handleError(_0x54cc01,null));}; \ No newline at end of file +var _0xf780=['fields','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','options','OpenchannelQueueReport','includeAll','include','rows','show','params','keys','find','catch','create','update','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','intersection','attributes'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xf780,0x17f));var _0x0f78=function(_0x19385e,_0x3c5a49){_0x19385e=_0x19385e-0x0;var _0x243a31=_0xf780[_0x19385e];return _0x243a31;};'use strict';var pdf=require(_0x0f78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0f78('0x1'));var zipdir=require(_0x0f78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f78('0x3'));var moment=require(_0x0f78('0x4'));var BPromise=require(_0x0f78('0x5'));var Mustache=require(_0x0f78('0x6'));var util=require(_0x0f78('0x7'));var path=require(_0x0f78('0x8'));var sox=require(_0x0f78('0x9'));var csv=require(_0x0f78('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f78('0xb'));var squel=require(_0x0f78('0xc'));var crypto=require(_0x0f78('0xd'));var jsforce=require(_0x0f78('0xe'));var deskjs=require(_0x0f78('0xf'));var toCsv=require(_0x0f78('0xa'));var querystring=require('querystring');var Papa=require(_0x0f78('0x10'));var Redis=require(_0x0f78('0x11'));var authService=require(_0x0f78('0x12'));var qs=require(_0x0f78('0x13'));var as=require(_0x0f78('0x14'));var hardwareService=require(_0x0f78('0x15'));var logger=require(_0x0f78('0x16'))(_0x0f78('0x17'));var utils=require('../../config/utils');var config=require(_0x0f78('0x18'));var db=require(_0x0f78('0x19'))['db'];function respondWithStatusCode(_0xc9b492,_0x3ff5dd){_0x3ff5dd=_0x3ff5dd||0xcc;return function(_0x5076c1){if(_0x5076c1){return _0xc9b492[_0x0f78('0x1a')](_0x3ff5dd);}return _0xc9b492['status'](_0x3ff5dd)[_0x0f78('0x1b')]();};}function respondWithResult(_0x324510,_0x549932){_0x549932=_0x549932||0xc8;return function(_0x2feadf){if(_0x2feadf){return _0x324510[_0x0f78('0x1c')](_0x549932)[_0x0f78('0x1d')](_0x2feadf);}};}function respondWithFilteredResult(_0x5e85c0,_0x262f40){return function(_0x30708d){if(_0x30708d){var _0x523d16=_0x30708d[_0x0f78('0x1e')],_0x58275b=_0x262f40['offset'],_0x2929a7=_0x262f40[_0x0f78('0x1f')]+_0x262f40[_0x0f78('0x20')],_0xac0548;if(_0x2929a7>=_0x523d16){_0x2929a7=_0x523d16;_0xac0548=0xc8;}else{_0xac0548=0xce;}_0x5e85c0[_0x0f78('0x1c')](_0xac0548);return _0x5e85c0['set']('Content-Range',_0x58275b+'-'+_0x2929a7+'/'+_0x523d16)[_0x0f78('0x1d')](_0x30708d);}return null;};}function patchUpdates(_0x4a43c1){return function(_0x33c63b){try{jsonpatch[_0x0f78('0x21')](_0x33c63b,_0x4a43c1,!![]);}catch(_0x6ad537){return BPromise[_0x0f78('0x22')](_0x6ad537);}return _0x33c63b[_0x0f78('0x23')]();};}function saveUpdates(_0x87e60b,_0xfb977c){return function(_0x6b4d7b){if(_0x6b4d7b){return _0x6b4d7b['update'](_0x87e60b)[_0x0f78('0x24')](function(_0xc3c11f){return _0xc3c11f;});}return null;};}function removeEntity(_0x2c21ce,_0x1c25d6){return function(_0x9142ca){if(_0x9142ca){return _0x9142ca[_0x0f78('0x25')]()[_0x0f78('0x24')](function(){_0x2c21ce[_0x0f78('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35ff63,_0x48f72e){return function(_0x18ed47){if(!_0x18ed47){_0x35ff63[_0x0f78('0x1a')](0x194);}return _0x18ed47;};}function handleError(_0x463719,_0x5ca8ee){_0x5ca8ee=_0x5ca8ee||0x1f4;return function(_0x26afd2){logger[_0x0f78('0x26')](_0x26afd2[_0x0f78('0x27')]);if(_0x26afd2['name']){delete _0x26afd2[_0x0f78('0x28')];}_0x463719[_0x0f78('0x1c')](_0x5ca8ee)['send'](_0x26afd2);};}exports['index']=function(_0x48aaec,_0x127e17){var _0x44d970={},_0x73f977={},_0x1b742c={'count':0x0,'rows':[]};var _0x28c295=_[_0x0f78('0x29')](db['OpenchannelQueueReport'][_0x0f78('0x2a')],function(_0x2695f6){return{'name':_0x2695f6[_0x0f78('0x2b')],'type':_0x2695f6[_0x0f78('0x2c')]['key']};});_0x73f977[_0x0f78('0x2d')]=_[_0x0f78('0x29')](_0x28c295,'name');_0x73f977[_0x0f78('0x2e')]=_['keys'](_0x48aaec['query']);_0x73f977['filters']=_[_0x0f78('0x2f')](_0x73f977[_0x0f78('0x2d')],_0x73f977['query']);_0x44d970[_0x0f78('0x30')]=_[_0x0f78('0x2f')](_0x73f977[_0x0f78('0x2d')],qs[_0x0f78('0x31')](_0x48aaec[_0x0f78('0x2e')][_0x0f78('0x31')]));_0x44d970[_0x0f78('0x30')]=_0x44d970[_0x0f78('0x30')][_0x0f78('0x32')]?_0x44d970[_0x0f78('0x30')]:_0x73f977['model'];if(!_0x48aaec['query'][_0x0f78('0x33')](_0x0f78('0x34'))){_0x44d970[_0x0f78('0x20')]=qs[_0x0f78('0x20')](_0x48aaec['query'][_0x0f78('0x20')]);_0x44d970['offset']=qs['offset'](_0x48aaec[_0x0f78('0x2e')][_0x0f78('0x1f')]);}_0x44d970[_0x0f78('0x35')]=qs['sort'](_0x48aaec[_0x0f78('0x2e')]['sort']);_0x44d970[_0x0f78('0x36')]=qs[_0x0f78('0x37')](_[_0x0f78('0x38')](_0x48aaec[_0x0f78('0x2e')],_0x73f977['filters']),_0x28c295);if(_0x48aaec[_0x0f78('0x2e')]['filter']){_0x44d970[_0x0f78('0x36')]=_[_0x0f78('0x39')](_0x44d970[_0x0f78('0x36')],{'$or':_[_0x0f78('0x29')](_0x28c295,function(_0x5daf73){if(_0x5daf73[_0x0f78('0x2c')]!=='VIRTUAL'){var _0x1a4528={};_0x1a4528[_0x5daf73[_0x0f78('0x28')]]={'$like':'%'+_0x48aaec[_0x0f78('0x2e')]['filter']+'%'};return _0x1a4528;}})});}_0x44d970=_[_0x0f78('0x39')]({},_0x44d970,_0x48aaec[_0x0f78('0x3a')]);var _0x2de233={'where':_0x44d970[_0x0f78('0x36')]};return db[_0x0f78('0x3b')][_0x0f78('0x1e')](_0x2de233)[_0x0f78('0x24')](function(_0x362264){_0x1b742c[_0x0f78('0x1e')]=_0x362264;if(_0x48aaec['query'][_0x0f78('0x3c')]){_0x44d970[_0x0f78('0x3d')]=[{'all':!![]}];}return db[_0x0f78('0x3b')]['findAll'](_0x44d970);})[_0x0f78('0x24')](function(_0x3a34cd){_0x1b742c[_0x0f78('0x3e')]=_0x3a34cd;return _0x1b742c;})[_0x0f78('0x24')](respondWithFilteredResult(_0x127e17,_0x44d970))['catch'](handleError(_0x127e17,null));};exports[_0x0f78('0x3f')]=function(_0x4c6944,_0x3d3a17){var _0x38fb59={'raw':!![],'where':{'id':_0x4c6944[_0x0f78('0x40')]['id']}},_0x215c66={};_0x215c66[_0x0f78('0x2d')]=_[_0x0f78('0x41')](db[_0x0f78('0x3b')][_0x0f78('0x2a')]);_0x215c66[_0x0f78('0x2e')]=_['keys'](_0x4c6944[_0x0f78('0x2e')]);_0x215c66[_0x0f78('0x37')]=_[_0x0f78('0x2f')](_0x215c66['model'],_0x215c66['query']);_0x38fb59['attributes']=_[_0x0f78('0x2f')](_0x215c66['model'],qs[_0x0f78('0x31')](_0x4c6944['query'][_0x0f78('0x31')]));_0x38fb59['attributes']=_0x38fb59['attributes'][_0x0f78('0x32')]?_0x38fb59['attributes']:_0x215c66['model'];if(_0x4c6944[_0x0f78('0x2e')]['includeAll']){_0x38fb59[_0x0f78('0x3d')]=[{'all':!![]}];}_0x38fb59=_[_0x0f78('0x39')]({},_0x38fb59,_0x4c6944[_0x0f78('0x3a')]);return db[_0x0f78('0x3b')][_0x0f78('0x42')](_0x38fb59)[_0x0f78('0x24')](handleEntityNotFound(_0x3d3a17,null))[_0x0f78('0x24')](respondWithResult(_0x3d3a17,null))[_0x0f78('0x43')](handleError(_0x3d3a17,null));};exports[_0x0f78('0x44')]=function(_0x57c2b9,_0x17af55){return db['OpenchannelQueueReport'][_0x0f78('0x44')](_0x57c2b9['body'],{})['then'](respondWithResult(_0x17af55,0xc9))[_0x0f78('0x43')](handleError(_0x17af55,null));};exports[_0x0f78('0x45')]=function(_0x2ab522,_0x291cf5){if(_0x2ab522[_0x0f78('0x46')]['id']){delete _0x2ab522[_0x0f78('0x46')]['id'];}return db[_0x0f78('0x3b')][_0x0f78('0x42')]({'where':{'id':_0x2ab522[_0x0f78('0x40')]['id']}})[_0x0f78('0x24')](handleEntityNotFound(_0x291cf5,null))[_0x0f78('0x24')](saveUpdates(_0x2ab522[_0x0f78('0x46')],null))[_0x0f78('0x24')](respondWithResult(_0x291cf5,null))[_0x0f78('0x43')](handleError(_0x291cf5,null));};exports[_0x0f78('0x25')]=function(_0x2fe85d,_0x41f428){return db[_0x0f78('0x3b')][_0x0f78('0x42')]({'where':{'id':_0x2fe85d[_0x0f78('0x40')]['id']}})[_0x0f78('0x24')](handleEntityNotFound(_0x41f428,null))[_0x0f78('0x24')](removeEntity(_0x41f428,null))[_0x0f78('0x43')](handleError(_0x41f428,null));};exports['describe']=function(_0x50014c,_0x5c29d1){return db[_0x0f78('0x3b')][_0x0f78('0x47')]()[_0x0f78('0x24')](respondWithResult(_0x5c29d1,null))['catch'](handleError(_0x5c29d1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8d7ed3a..829de5f 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 _0xf2c7=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0xf2c7[_0x5a27e8];return _0x4e38f7;};'use strict';var _=require(_0x7f2c('0x0'));var util=require(_0x7f2c('0x1'));var logger=require(_0x7f2c('0x2'))(_0x7f2c('0x3'));var moment=require('moment');var BPromise=require(_0x7f2c('0x4'));var rp=require(_0x7f2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7f2c('0x6'));var attributes=require('./openchannelQueueReport.attributes');module[_0x7f2c('0x7')]=function(_0x835eeb,_0x4e348c){return _0x835eeb[_0x7f2c('0x8')](_0x7f2c('0x9'),attributes,{'tableName':_0x7f2c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7f2c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf71=['api','moment','bluebird','request-promise','path','rimraf','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf71,0x1d2));var _0x1df7=function(_0x28d73e,_0x127d7b){_0x28d73e=_0x28d73e-0x0;var _0x646529=_0xdf71[_0x28d73e];return _0x646529;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var logger=require(_0x1df7('0x1'))(_0x1df7('0x2'));var moment=require(_0x1df7('0x3'));var BPromise=require(_0x1df7('0x4'));var rp=require(_0x1df7('0x5'));var fs=require('fs');var path=require(_0x1df7('0x6'));var rimraf=require(_0x1df7('0x7'));var config=require('../../config/environment');var attributes=require(_0x1df7('0x8'));module[_0x1df7('0x9')]=function(_0x4bc4a8,_0x508a68){return _0x4bc4a8[_0x1df7('0xa')](_0x1df7('0xb'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x1df7('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 24011bf..bc18ff6 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 _0xbbbc=['jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5796bf,_0x2c93ef){_0x5796bf=_0x5796bf-0x0;var _0x1aba5c=_0xbbbc[_0x5796bf];return _0x1aba5c;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['OpenchannelQueueReport'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![]})[_0xcbbb('0xd')](function(_0x45de5f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')]('CreateOpenchannelQueueReport',_0x3436af,JSON[_0xcbbb('0x1a')](_0x45de5f));_0x5052df(_0x45de5f);})[_0xcbbb('0x14')](function(_0x159c62){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x159c62[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x159c62[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x1b')]=function(_0x5e3970){var _0xf39ddd=this;return new Promise(function(_0x4490c1,_0x4c543a){return db[_0xcbbb('0x1c')]['update'](_0x5e3970['body'],{'raw':_0x5e3970[_0xcbbb('0x18')]?_0x5e3970[_0xcbbb('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3970['options']?_0x5e3970['options'][_0xcbbb('0x1d')]||null:null,'attributes':_0x5e3970['options']?_0x5e3970['options'][_0xcbbb('0x1e')]||null:null,'limit':_0x5e3970[_0xcbbb('0x18')]?_0x5e3970[_0xcbbb('0x18')][_0xcbbb('0x1f')]||null:null})[_0xcbbb('0xd')](function(_0x39ba8b){logger[_0xcbbb('0xe')](_0xcbbb('0x1b'),_0x5e3970);logger[_0xcbbb('0xf')](_0xcbbb('0x1b'),_0x5e3970,JSON[_0xcbbb('0x1a')](_0x39ba8b));_0x4490c1(_0x39ba8b);})[_0xcbbb('0x14')](function(_0xfa973b){logger[_0xcbbb('0x11')](_0xcbbb('0x1b'),_0xfa973b[_0xcbbb('0x12')],_0x5e3970);_0x4c543a(_0xf39ddd[_0xcbbb('0x11')](0x1f4,_0xfa973b[_0xcbbb('0x12')]));});});}; \ No newline at end of file +var _0x14a0=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent'];(function(_0xde9059,_0x750aab){var _0x23197d=function(_0x457724){while(--_0x457724){_0xde9059['push'](_0xde9059['shift']());}};_0x23197d(++_0x750aab);}(_0x14a0,0x8e));var _0x014a=function(_0x22d3c4,_0x3fdd4c){_0x22d3c4=_0x22d3c4-0x0;var _0x813ec2=_0x14a0[_0x22d3c4];return _0x813ec2;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};exports[_0x014a('0x1a')]=function(_0x36d52b){var _0x2b3c10=this;return new Promise(function(_0x113b12,_0x3fec9f){return db[_0x014a('0x16')][_0x014a('0x1b')](_0x36d52b['body'],{'raw':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options'][_0x014a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options']['where']||null:null,'attributes':_0x36d52b[_0x014a('0x19')]?_0x36d52b[_0x014a('0x19')][_0x014a('0x1d')]||null:null,'limit':_0x36d52b['options']?_0x36d52b[_0x014a('0x19')][_0x014a('0x1e')]||null:null})['then'](function(_0x31dc95){logger[_0x014a('0x12')]('UpdateOpenchannelQueueReport',_0x36d52b);logger['debug'](_0x014a('0x1a'),_0x36d52b,JSON[_0x014a('0xd')](_0x31dc95));_0x113b12(_0x31dc95);})[_0x014a('0x14')](function(_0x29fce5){logger['error'](_0x014a('0x1a'),_0x29fce5[_0x014a('0x11')],_0x36d52b);_0x3fec9f(_0x2b3c10[_0x014a('0xe')](0x1f4,_0x29fce5[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 43e188c..dd7a3c1 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1191cfa..0eb34bf 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 _0x2685=['agent','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x537dcb,_0x5b73e4){var _0x3f19ea=function(_0x1c91e7){while(--_0x1c91e7){_0x537dcb['push'](_0x537dcb['shift']());}};_0x3f19ea(++_0x5b73e4);}(_0x2685,0x162));var _0x5268=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x2685[_0xf51c06];return _0x1d5420;};'use strict';var moment=require(_0x5268('0x0'));var Sequelize=require(_0x5268('0x1'));module[_0x5268('0x2')]={'uniqueid':{'type':Sequelize[_0x5268('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5268('0x4')](_0x5268('0x5'),_0x5268('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x5268('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x5268('0x8')]}}; \ No newline at end of file +var _0xfd3c=['ENUM','account','agent','queue','NOW','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfd3c,0xa7));var _0xcfd3=function(_0x410417,_0x43b262){_0x410417=_0x410417-0x0;var _0x4f270a=_0xfd3c[_0x410417];return _0x4f270a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcfd3('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xcfd3('0x1')](_0xcfd3('0x2'),_0xcfd3('0x3'),_0xcfd3('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xcfd3('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f6c4009..0b68aad 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 _0x7f62=['intersection','model','length','attributes','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','fields','find','create','body','catch','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','OpenchannelTransferReport','rawAttributes','fieldName','keys','query','filters'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f62,0x1bd));var _0x27f6=function(_0x27c24e,_0x5db1c7){_0x27c24e=_0x27c24e-0x0;var _0x39004a=_0x7f62[_0x27c24e];return _0x39004a;};'use strict';var pdf=require(_0x27f6('0x0'));var emlformat=require(_0x27f6('0x1'));var rimraf=require(_0x27f6('0x2'));var zipdir=require(_0x27f6('0x3'));var jsonpatch=require(_0x27f6('0x4'));var rp=require(_0x27f6('0x5'));var moment=require(_0x27f6('0x6'));var BPromise=require(_0x27f6('0x7'));var Mustache=require(_0x27f6('0x8'));var util=require(_0x27f6('0x9'));var path=require('path');var sox=require(_0x27f6('0xa'));var csv=require(_0x27f6('0xb'));var ejs=require(_0x27f6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x27f6('0xd'));var jsforce=require(_0x27f6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x27f6('0xf'));var Papa=require('papaparse');var Redis=require(_0x27f6('0x10'));var authService=require(_0x27f6('0x11'));var qs=require(_0x27f6('0x12'));var as=require(_0x27f6('0x13'));var hardwareService=require(_0x27f6('0x14'));var logger=require('../../config/logger')(_0x27f6('0x15'));var utils=require('../../config/utils');var config=require(_0x27f6('0x16'));var db=require(_0x27f6('0x17'))['db'];function respondWithStatusCode(_0x4bbeac,_0x23f622){_0x23f622=_0x23f622||0xcc;return function(_0x1a9df9){if(_0x1a9df9){return _0x4bbeac['sendStatus'](_0x23f622);}return _0x4bbeac[_0x27f6('0x18')](_0x23f622)[_0x27f6('0x19')]();};}function respondWithResult(_0x3043c1,_0x57b50d){_0x57b50d=_0x57b50d||0xc8;return function(_0x845678){if(_0x845678){return _0x3043c1[_0x27f6('0x18')](_0x57b50d)['json'](_0x845678);}};}function respondWithFilteredResult(_0x467098,_0x3a5681){return function(_0x1904d6){if(_0x1904d6){var _0x33396d=_0x1904d6[_0x27f6('0x1a')],_0x83deae=_0x3a5681['offset'],_0x57c6e0=_0x3a5681[_0x27f6('0x1b')]+_0x3a5681[_0x27f6('0x1c')],_0x3cdca7;if(_0x57c6e0>=_0x33396d){_0x57c6e0=_0x33396d;_0x3cdca7=0xc8;}else{_0x3cdca7=0xce;}_0x467098[_0x27f6('0x18')](_0x3cdca7);return _0x467098[_0x27f6('0x1d')](_0x27f6('0x1e'),_0x83deae+'-'+_0x57c6e0+'/'+_0x33396d)['json'](_0x1904d6);}return null;};}function patchUpdates(_0x32aa74){return function(_0x578538){try{jsonpatch[_0x27f6('0x1f')](_0x578538,_0x32aa74,!![]);}catch(_0x237040){return BPromise[_0x27f6('0x20')](_0x237040);}return _0x578538[_0x27f6('0x21')]();};}function saveUpdates(_0x362eb4,_0x4e8c22){return function(_0x4ecaa7){if(_0x4ecaa7){return _0x4ecaa7[_0x27f6('0x22')](_0x362eb4)[_0x27f6('0x23')](function(_0x4638f2){return _0x4638f2;});}return null;};}function removeEntity(_0x3249c3,_0x390f67){return function(_0x7ad69c){if(_0x7ad69c){return _0x7ad69c['destroy']()[_0x27f6('0x23')](function(){_0x3249c3[_0x27f6('0x18')](0xcc)[_0x27f6('0x19')]();});}};}function handleEntityNotFound(_0x54fb3c,_0x437ad2){return function(_0x2eba7b){if(!_0x2eba7b){_0x54fb3c[_0x27f6('0x24')](0x194);}return _0x2eba7b;};}function handleError(_0x645bb8,_0x314b2d){_0x314b2d=_0x314b2d||0x1f4;return function(_0x2326ee){logger[_0x27f6('0x25')](_0x2326ee['stack']);if(_0x2326ee[_0x27f6('0x26')]){delete _0x2326ee['name'];}_0x645bb8[_0x27f6('0x18')](_0x314b2d)['send'](_0x2326ee);};}exports['index']=function(_0x347a52,_0x428621){var _0x4186b6={},_0x5af615={},_0x3a21d3={'count':0x0,'rows':[]};var _0x576ec0=_['map'](db[_0x27f6('0x27')][_0x27f6('0x28')],function(_0x101f91){return{'name':_0x101f91[_0x27f6('0x29')],'type':_0x101f91['type']['key']};});_0x5af615['model']=_['map'](_0x576ec0,_0x27f6('0x26'));_0x5af615['query']=_[_0x27f6('0x2a')](_0x347a52[_0x27f6('0x2b')]);_0x5af615[_0x27f6('0x2c')]=_[_0x27f6('0x2d')](_0x5af615[_0x27f6('0x2e')],_0x5af615['query']);_0x4186b6['attributes']=_[_0x27f6('0x2d')](_0x5af615['model'],qs['fields'](_0x347a52[_0x27f6('0x2b')]['fields']));_0x4186b6['attributes']=_0x4186b6['attributes'][_0x27f6('0x2f')]?_0x4186b6[_0x27f6('0x30')]:_0x5af615[_0x27f6('0x2e')];if(!_0x347a52[_0x27f6('0x2b')]['hasOwnProperty']('nolimit')){_0x4186b6[_0x27f6('0x1c')]=qs[_0x27f6('0x1c')](_0x347a52['query'][_0x27f6('0x1c')]);_0x4186b6[_0x27f6('0x1b')]=qs[_0x27f6('0x1b')](_0x347a52[_0x27f6('0x2b')][_0x27f6('0x1b')]);}_0x4186b6[_0x27f6('0x31')]=qs[_0x27f6('0x32')](_0x347a52[_0x27f6('0x2b')][_0x27f6('0x32')]);_0x4186b6[_0x27f6('0x33')]=qs[_0x27f6('0x2c')](_[_0x27f6('0x34')](_0x347a52[_0x27f6('0x2b')],_0x5af615[_0x27f6('0x2c')]),_0x576ec0);if(_0x347a52['query'][_0x27f6('0x35')]){_0x4186b6[_0x27f6('0x33')]=_[_0x27f6('0x36')](_0x4186b6[_0x27f6('0x33')],{'$or':_[_0x27f6('0x37')](_0x576ec0,function(_0x439566){if(_0x439566['type']!==_0x27f6('0x38')){var _0x316afe={};_0x316afe[_0x439566[_0x27f6('0x26')]]={'$like':'%'+_0x347a52[_0x27f6('0x2b')]['filter']+'%'};return _0x316afe;}})});}_0x4186b6=_[_0x27f6('0x36')]({},_0x4186b6,_0x347a52[_0x27f6('0x39')]);var _0x4a1235={'where':_0x4186b6['where']};return db[_0x27f6('0x27')][_0x27f6('0x1a')](_0x4a1235)['then'](function(_0xb8d96b){_0x3a21d3['count']=_0xb8d96b;if(_0x347a52[_0x27f6('0x2b')][_0x27f6('0x3a')]){_0x4186b6[_0x27f6('0x3b')]=[{'all':!![]}];}return db[_0x27f6('0x27')][_0x27f6('0x3c')](_0x4186b6);})[_0x27f6('0x23')](function(_0x3ae8d0){_0x3a21d3[_0x27f6('0x3d')]=_0x3ae8d0;return _0x3a21d3;})[_0x27f6('0x23')](respondWithFilteredResult(_0x428621,_0x4186b6))['catch'](handleError(_0x428621,null));};exports['show']=function(_0x115f46,_0x49a18a){var _0x7af160={'raw':!![],'where':{'id':_0x115f46['params']['id']}},_0x233ce5={};_0x233ce5[_0x27f6('0x2e')]=_[_0x27f6('0x2a')](db[_0x27f6('0x27')]['rawAttributes']);_0x233ce5[_0x27f6('0x2b')]=_[_0x27f6('0x2a')](_0x115f46['query']);_0x233ce5['filters']=_[_0x27f6('0x2d')](_0x233ce5[_0x27f6('0x2e')],_0x233ce5[_0x27f6('0x2b')]);_0x7af160['attributes']=_[_0x27f6('0x2d')](_0x233ce5[_0x27f6('0x2e')],qs[_0x27f6('0x3e')](_0x115f46[_0x27f6('0x2b')]['fields']));_0x7af160[_0x27f6('0x30')]=_0x7af160[_0x27f6('0x30')][_0x27f6('0x2f')]?_0x7af160[_0x27f6('0x30')]:_0x233ce5[_0x27f6('0x2e')];if(_0x115f46['query'][_0x27f6('0x3a')]){_0x7af160[_0x27f6('0x3b')]=[{'all':!![]}];}_0x7af160=_[_0x27f6('0x36')]({},_0x7af160,_0x115f46[_0x27f6('0x39')]);return db[_0x27f6('0x27')][_0x27f6('0x3f')](_0x7af160)[_0x27f6('0x23')](handleEntityNotFound(_0x49a18a,null))[_0x27f6('0x23')](respondWithResult(_0x49a18a,null))['catch'](handleError(_0x49a18a,null));};exports[_0x27f6('0x40')]=function(_0xadfca,_0x160aca){return db[_0x27f6('0x27')][_0x27f6('0x40')](_0xadfca[_0x27f6('0x41')],{})[_0x27f6('0x23')](respondWithResult(_0x160aca,0xc9))[_0x27f6('0x42')](handleError(_0x160aca,null));};exports['update']=function(_0x49daea,_0x278cc2){if(_0x49daea[_0x27f6('0x41')]['id']){delete _0x49daea['body']['id'];}return db[_0x27f6('0x27')]['find']({'where':{'id':_0x49daea[_0x27f6('0x43')]['id']}})[_0x27f6('0x23')](handleEntityNotFound(_0x278cc2,null))[_0x27f6('0x23')](saveUpdates(_0x49daea[_0x27f6('0x41')],null))['then'](respondWithResult(_0x278cc2,null))[_0x27f6('0x42')](handleError(_0x278cc2,null));};exports[_0x27f6('0x44')]=function(_0x364211,_0xa27925){return db[_0x27f6('0x27')][_0x27f6('0x3f')]({'where':{'id':_0x364211['params']['id']}})[_0x27f6('0x23')](handleEntityNotFound(_0xa27925,null))[_0x27f6('0x23')](removeEntity(_0xa27925,null))[_0x27f6('0x42')](handleError(_0xa27925,null));};exports[_0x27f6('0x45')]=function(_0x43ad7b,_0x46c5d8){return db[_0x27f6('0x27')][_0x27f6('0x45')]()[_0x27f6('0x23')](respondWithResult(_0x46c5d8,null))[_0x27f6('0x42')](handleError(_0x46c5d8,null));}; \ No newline at end of file +var _0x0051=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','body','find','describe','html-pdf'];(function(_0x384a9f,_0x10bc92){var _0x3c061a=function(_0x52aab4){while(--_0x52aab4){_0x384a9f['push'](_0x384a9f['shift']());}};_0x3c061a(++_0x10bc92);}(_0x0051,0xe0));var _0x1005=function(_0x25bbd6,_0x18f6d3){_0x25bbd6=_0x25bbd6-0x0;var _0x3a4c78=_0x0051[_0x25bbd6];return _0x3a4c78;};'use strict';var pdf=require(_0x1005('0x0'));var emlformat=require(_0x1005('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1005('0x2'));var jsonpatch=require(_0x1005('0x3'));var rp=require(_0x1005('0x4'));var moment=require(_0x1005('0x5'));var BPromise=require(_0x1005('0x6'));var Mustache=require(_0x1005('0x7'));var util=require(_0x1005('0x8'));var path=require(_0x1005('0x9'));var sox=require(_0x1005('0xa'));var csv=require(_0x1005('0xb'));var ejs=require(_0x1005('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1005('0xd'));var crypto=require('crypto');var jsforce=require(_0x1005('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1005('0xf'));var Papa=require(_0x1005('0x10'));var Redis=require(_0x1005('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1005('0x12'));var as=require(_0x1005('0x13'));var hardwareService=require(_0x1005('0x14'));var logger=require(_0x1005('0x15'))(_0x1005('0x16'));var utils=require(_0x1005('0x17'));var config=require(_0x1005('0x18'));var db=require(_0x1005('0x19'))['db'];function respondWithStatusCode(_0x287384,_0x263cb5){_0x263cb5=_0x263cb5||0xcc;return function(_0x35744a){if(_0x35744a){return _0x287384['sendStatus'](_0x263cb5);}return _0x287384[_0x1005('0x1a')](_0x263cb5)[_0x1005('0x1b')]();};}function respondWithResult(_0x553e4a,_0x322b24){_0x322b24=_0x322b24||0xc8;return function(_0x2806b5){if(_0x2806b5){return _0x553e4a['status'](_0x322b24)[_0x1005('0x1c')](_0x2806b5);}};}function respondWithFilteredResult(_0xfacc96,_0x14bde6){return function(_0xbce0e4){if(_0xbce0e4){var _0x2bd4b2=_0xbce0e4[_0x1005('0x1d')],_0x2d47a3=_0x14bde6[_0x1005('0x1e')],_0x52f5ac=_0x14bde6[_0x1005('0x1e')]+_0x14bde6[_0x1005('0x1f')],_0x52ae2f;if(_0x52f5ac>=_0x2bd4b2){_0x52f5ac=_0x2bd4b2;_0x52ae2f=0xc8;}else{_0x52ae2f=0xce;}_0xfacc96['status'](_0x52ae2f);return _0xfacc96[_0x1005('0x20')](_0x1005('0x21'),_0x2d47a3+'-'+_0x52f5ac+'/'+_0x2bd4b2)[_0x1005('0x1c')](_0xbce0e4);}return null;};}function patchUpdates(_0x55d0e7){return function(_0x1e5d0a){try{jsonpatch['apply'](_0x1e5d0a,_0x55d0e7,!![]);}catch(_0x266d25){return BPromise[_0x1005('0x22')](_0x266d25);}return _0x1e5d0a['save']();};}function saveUpdates(_0x583639,_0x5987f8){return function(_0x33a24a){if(_0x33a24a){return _0x33a24a[_0x1005('0x23')](_0x583639)[_0x1005('0x24')](function(_0x35c5d4){return _0x35c5d4;});}return null;};}function removeEntity(_0x1d6a1f,_0x48466c){return function(_0x1a876b){if(_0x1a876b){return _0x1a876b[_0x1005('0x25')]()['then'](function(){_0x1d6a1f[_0x1005('0x1a')](0xcc)[_0x1005('0x1b')]();});}};}function handleEntityNotFound(_0x1eeddf,_0x3dec9c){return function(_0x4f4f1a){if(!_0x4f4f1a){_0x1eeddf[_0x1005('0x26')](0x194);}return _0x4f4f1a;};}function handleError(_0x52cd5a,_0x150348){_0x150348=_0x150348||0x1f4;return function(_0x5eb0c3){logger[_0x1005('0x27')](_0x5eb0c3[_0x1005('0x28')]);if(_0x5eb0c3[_0x1005('0x29')]){delete _0x5eb0c3[_0x1005('0x29')];}_0x52cd5a['status'](_0x150348)[_0x1005('0x2a')](_0x5eb0c3);};}exports['index']=function(_0x56cf32,_0x37e447){var _0x46a570={},_0x2fac46={},_0x49f1a5={'count':0x0,'rows':[]};var _0x376e2a=_[_0x1005('0x2b')](db[_0x1005('0x2c')][_0x1005('0x2d')],function(_0x54665c){return{'name':_0x54665c[_0x1005('0x2e')],'type':_0x54665c[_0x1005('0x2f')][_0x1005('0x30')]};});_0x2fac46['model']=_[_0x1005('0x2b')](_0x376e2a,'name');_0x2fac46[_0x1005('0x31')]=_[_0x1005('0x32')](_0x56cf32[_0x1005('0x31')]);_0x2fac46[_0x1005('0x33')]=_[_0x1005('0x34')](_0x2fac46[_0x1005('0x35')],_0x2fac46[_0x1005('0x31')]);_0x46a570[_0x1005('0x36')]=_['intersection'](_0x2fac46[_0x1005('0x35')],qs[_0x1005('0x37')](_0x56cf32['query'][_0x1005('0x37')]));_0x46a570[_0x1005('0x36')]=_0x46a570[_0x1005('0x36')][_0x1005('0x38')]?_0x46a570['attributes']:_0x2fac46[_0x1005('0x35')];if(!_0x56cf32['query'][_0x1005('0x39')](_0x1005('0x3a'))){_0x46a570['limit']=qs['limit'](_0x56cf32[_0x1005('0x31')][_0x1005('0x1f')]);_0x46a570['offset']=qs[_0x1005('0x1e')](_0x56cf32[_0x1005('0x31')][_0x1005('0x1e')]);}_0x46a570[_0x1005('0x3b')]=qs[_0x1005('0x3c')](_0x56cf32[_0x1005('0x31')][_0x1005('0x3c')]);_0x46a570['where']=qs[_0x1005('0x33')](_[_0x1005('0x3d')](_0x56cf32[_0x1005('0x31')],_0x2fac46[_0x1005('0x33')]),_0x376e2a);if(_0x56cf32[_0x1005('0x31')][_0x1005('0x3e')]){_0x46a570['where']=_['merge'](_0x46a570[_0x1005('0x3f')],{'$or':_['map'](_0x376e2a,function(_0x4bdad2){if(_0x4bdad2[_0x1005('0x2f')]!=='VIRTUAL'){var _0x401722={};_0x401722[_0x4bdad2['name']]={'$like':'%'+_0x56cf32['query']['filter']+'%'};return _0x401722;}})});}_0x46a570=_[_0x1005('0x40')]({},_0x46a570,_0x56cf32[_0x1005('0x41')]);var _0x532913={'where':_0x46a570[_0x1005('0x3f')]};return db['OpenchannelTransferReport'][_0x1005('0x1d')](_0x532913)[_0x1005('0x24')](function(_0x63a2a3){_0x49f1a5['count']=_0x63a2a3;if(_0x56cf32[_0x1005('0x31')][_0x1005('0x42')]){_0x46a570[_0x1005('0x43')]=[{'all':!![]}];}return db[_0x1005('0x2c')][_0x1005('0x44')](_0x46a570);})['then'](function(_0x4e749d){_0x49f1a5['rows']=_0x4e749d;return _0x49f1a5;})['then'](respondWithFilteredResult(_0x37e447,_0x46a570))[_0x1005('0x45')](handleError(_0x37e447,null));};exports[_0x1005('0x46')]=function(_0x51a78f,_0x1c5867){var _0x35c54f={'raw':!![],'where':{'id':_0x51a78f[_0x1005('0x47')]['id']}},_0x3c3aa9={};_0x3c3aa9['model']=_[_0x1005('0x32')](db[_0x1005('0x2c')][_0x1005('0x2d')]);_0x3c3aa9[_0x1005('0x31')]=_['keys'](_0x51a78f[_0x1005('0x31')]);_0x3c3aa9[_0x1005('0x33')]=_[_0x1005('0x34')](_0x3c3aa9[_0x1005('0x35')],_0x3c3aa9[_0x1005('0x31')]);_0x35c54f[_0x1005('0x36')]=_[_0x1005('0x34')](_0x3c3aa9[_0x1005('0x35')],qs[_0x1005('0x37')](_0x51a78f[_0x1005('0x31')]['fields']));_0x35c54f['attributes']=_0x35c54f[_0x1005('0x36')][_0x1005('0x38')]?_0x35c54f[_0x1005('0x36')]:_0x3c3aa9['model'];if(_0x51a78f[_0x1005('0x31')][_0x1005('0x42')]){_0x35c54f['include']=[{'all':!![]}];}_0x35c54f=_[_0x1005('0x40')]({},_0x35c54f,_0x51a78f[_0x1005('0x41')]);return db[_0x1005('0x2c')]['find'](_0x35c54f)['then'](handleEntityNotFound(_0x1c5867,null))[_0x1005('0x24')](respondWithResult(_0x1c5867,null))[_0x1005('0x45')](handleError(_0x1c5867,null));};exports['create']=function(_0x31ec7e,_0x50d2be){return db['OpenchannelTransferReport']['create'](_0x31ec7e[_0x1005('0x48')],{})[_0x1005('0x24')](respondWithResult(_0x50d2be,0xc9))['catch'](handleError(_0x50d2be,null));};exports[_0x1005('0x23')]=function(_0x154e48,_0x215e95){if(_0x154e48[_0x1005('0x48')]['id']){delete _0x154e48[_0x1005('0x48')]['id'];}return db[_0x1005('0x2c')][_0x1005('0x49')]({'where':{'id':_0x154e48[_0x1005('0x47')]['id']}})['then'](handleEntityNotFound(_0x215e95,null))[_0x1005('0x24')](saveUpdates(_0x154e48['body'],null))['then'](respondWithResult(_0x215e95,null))[_0x1005('0x45')](handleError(_0x215e95,null));};exports['destroy']=function(_0x35c940,_0x3cf52b){return db[_0x1005('0x2c')]['find']({'where':{'id':_0x35c940[_0x1005('0x47')]['id']}})[_0x1005('0x24')](handleEntityNotFound(_0x3cf52b,null))[_0x1005('0x24')](removeEntity(_0x3cf52b,null))[_0x1005('0x45')](handleError(_0x3cf52b,null));};exports['describe']=function(_0x15526a,_0x156002){return db[_0x1005('0x2c')][_0x1005('0x4a')]()['then'](respondWithResult(_0x156002,null))[_0x1005('0x45')](handleError(_0x156002,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4818d27..9549d31 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 _0x4d13=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4d13,0x18b));var _0x34d1=function(_0x511cc7,_0x4b9935){_0x511cc7=_0x511cc7-0x0;var _0x3cd6d8=_0x4d13[_0x511cc7];return _0x3cd6d8;};'use strict';var _=require(_0x34d1('0x0'));var util=require(_0x34d1('0x1'));var logger=require('../../config/logger')(_0x34d1('0x2'));var moment=require(_0x34d1('0x3'));var BPromise=require(_0x34d1('0x4'));var rp=require(_0x34d1('0x5'));var fs=require('fs');var path=require(_0x34d1('0x6'));var rimraf=require('rimraf');var config=require(_0x34d1('0x7'));var attributes=require(_0x34d1('0x8'));module['exports']=function(_0x57732d,_0x3b90c1){return _0x57732d[_0x34d1('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0x34d1('0xa'),'paranoid':![],'indexes':[{'name':_0x34d1('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','uniqueid','util','../../config/logger','api'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xfd2d,0x15c));var _0xdfd2=function(_0xb17625,_0x5937f8){_0xb17625=_0xb17625-0x0;var _0x476a64=_0xfd2d[_0xb17625];return _0x476a64;};'use strict';var _=require('lodash');var util=require(_0xdfd2('0x0'));var logger=require(_0xdfd2('0x1'))(_0xdfd2('0x2'));var moment=require(_0xdfd2('0x3'));var BPromise=require(_0xdfd2('0x4'));var rp=require(_0xdfd2('0x5'));var fs=require('fs');var path=require(_0xdfd2('0x6'));var rimraf=require(_0xdfd2('0x7'));var config=require(_0xdfd2('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0xdfd2('0x9')]=function(_0x5cedfc,_0x5c6f97){return _0x5cedfc[_0xdfd2('0xa')](_0xdfd2('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xdfd2('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 43bd45d..226b1ca 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 _0xaa5c=['client','http','then','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','../../config/logger','jayson/promise'];(function(_0x53761d,_0x57434f){var _0x186e77=function(_0xd67b70){while(--_0xd67b70){_0x53761d['push'](_0x53761d['shift']());}};_0x186e77(++_0x57434f);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x2dbc3d,_0x348eb6){_0x2dbc3d=_0x2dbc3d-0x0;var _0x230486=_0xaa5c[_0x2dbc3d];return _0x230486;};'use strict';var _=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var moment=require(_0xcaa5('0x2'));var BPromise=require(_0xcaa5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcaa5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcaa5('0x5'));var client=jayson[_0xcaa5('0x6')][_0xcaa5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f56bc,_0x3d0a81,_0x24edf5){return new BPromise(function(_0xb27ac1,_0x1b8683){return client['request'](_0x5f56bc,_0x24edf5)[_0xcaa5('0x8')](function(_0x11b4d1){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3d0a81,_0xcaa5('0x9'));logger[_0xcaa5('0xa')](_0xcaa5('0xb'),_0x3d0a81,'request\x20sent',JSON[_0xcaa5('0xc')](_0x11b4d1));if(_0x11b4d1['error']){if(_0x11b4d1[_0xcaa5('0xd')][_0xcaa5('0xe')]===0x1f4){logger[_0xcaa5('0xd')](_0xcaa5('0xf'),_0x3d0a81,_0x11b4d1[_0xcaa5('0xd')][_0xcaa5('0x10')]);return _0x1b8683(_0x11b4d1[_0xcaa5('0xd')]['message']);}logger[_0xcaa5('0xd')](_0xcaa5('0xf'),_0x3d0a81,_0x11b4d1[_0xcaa5('0xd')][_0xcaa5('0x10')]);return _0xb27ac1(_0x11b4d1[_0xcaa5('0xd')][_0xcaa5('0x10')]);}else{logger[_0xcaa5('0x11')](_0xcaa5('0xf'),_0x3d0a81,_0xcaa5('0x9'));_0xb27ac1(_0x11b4d1['result'][_0xcaa5('0x10')]);}})['catch'](function(_0x17e3d2){logger[_0xcaa5('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3d0a81,_0x17e3d2);_0x1b8683(_0x17e3d2);});});} \ No newline at end of file +var _0x15cb=['request\x20sent','stringify','error','code','message','info','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x248242,_0x38d8bc){var _0x5caf7e=function(_0x195ee7){while(--_0x195ee7){_0x248242['push'](_0x248242['shift']());}};_0x5caf7e(++_0x38d8bc);}(_0x15cb,0x16f));var _0xb15c=function(_0x172159,_0x12241b){_0x172159=_0x172159-0x0;var _0x4176db=_0x15cb[_0x172159];return _0x4176db;};'use strict';var _=require('lodash');var util=require(_0xb15c('0x0'));var moment=require('moment');var BPromise=require(_0xb15c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb15c('0x2'));var db=require(_0xb15c('0x3'))['db'];var utils=require(_0xb15c('0x4'));var logger=require(_0xb15c('0x5'))('rpc');var config=require(_0xb15c('0x6'));var jayson=require(_0xb15c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x161c9c,_0x2c18ad,_0x1c75a8){return new BPromise(function(_0x3ad071,_0x157a90){return client[_0xb15c('0x8')](_0x161c9c,_0x1c75a8)[_0xb15c('0x9')](function(_0x12ebcd){logger['info'](_0xb15c('0xa'),_0x2c18ad,'request\x20sent');logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2c18ad,_0xb15c('0xb'),JSON[_0xb15c('0xc')](_0x12ebcd));if(_0x12ebcd[_0xb15c('0xd')]){if(_0x12ebcd[_0xb15c('0xd')][_0xb15c('0xe')]===0x1f4){logger[_0xb15c('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2c18ad,_0x12ebcd['error'][_0xb15c('0xf')]);return _0x157a90(_0x12ebcd['error'][_0xb15c('0xf')]);}logger[_0xb15c('0xd')](_0xb15c('0xa'),_0x2c18ad,_0x12ebcd[_0xb15c('0xd')][_0xb15c('0xf')]);return _0x3ad071(_0x12ebcd[_0xb15c('0xd')][_0xb15c('0xf')]);}else{logger[_0xb15c('0x10')](_0xb15c('0xa'),_0x2c18ad,_0xb15c('0xb'));_0x3ad071(_0x12ebcd['result'][_0xb15c('0xf')]);}})[_0xb15c('0x11')](function(_0x5d0d92){logger[_0xb15c('0xd')](_0xb15c('0xa'),_0x2c18ad,_0x5d0d92);_0x157a90(_0x5d0d92);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3b35af2..99aabf2 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 _0x93f2=['isAuthenticated','index','get','/:id','create','put','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x93f2,0xb9));var _0x293f=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x93f2[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require('multer');var util=require(_0x293f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x293f('0x1'));var router=express[_0x293f('0x2')]();var auth=require(_0x293f('0x3'));var interaction=require(_0x293f('0x4'));var config=require(_0x293f('0x5'));var controller=require(_0x293f('0x6'));router['get']('/',auth[_0x293f('0x7')](),controller[_0x293f('0x8')]);router[_0x293f('0x9')](_0x293f('0xa'),auth[_0x293f('0x7')](),controller['show']);router['post']('/',auth[_0x293f('0x7')](),controller[_0x293f('0xb')]);router[_0x293f('0xc')](_0x293f('0xa'),auth[_0x293f('0x7')](),controller['update']);router[_0x293f('0xd')]('/:id',auth[_0x293f('0x7')](),controller[_0x293f('0xe')]);module[_0x293f('0xf')]=router; \ No newline at end of file +var _0xc4af=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','isAuthenticated','index','show','post','create','put'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xc4af,0x77));var _0xfc4a=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xc4af[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0xfc4a('0x0'));var util=require('util');var path=require(_0xfc4a('0x1'));var timeout=require(_0xfc4a('0x2'));var express=require(_0xfc4a('0x3'));var router=express[_0xfc4a('0x4')]();var auth=require(_0xfc4a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfc4a('0x6'));var controller=require(_0xfc4a('0x7'));router['get']('/',auth[_0xfc4a('0x8')](),controller[_0xfc4a('0x9')]);router['get']('/:id',auth[_0xfc4a('0x8')](),controller[_0xfc4a('0xa')]);router[_0xfc4a('0xb')]('/',auth[_0xfc4a('0x8')](),controller[_0xfc4a('0xc')]);router[_0xfc4a('0xd')](_0xfc4a('0xe'),auth[_0xfc4a('0x8')](),controller[_0xfc4a('0xf')]);router[_0xfc4a('0x10')](_0xfc4a('0xe'),auth[_0xfc4a('0x8')](),controller[_0xfc4a('0x11')]);module[_0xfc4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 3e57fe8..3e76e0e 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 _0x4e41=['name','sequelize'];(function(_0xd1eb17,_0x2d5a15){var _0x53e129=function(_0x162c6b){while(--_0x162c6b){_0xd1eb17['push'](_0xd1eb17['shift']());}};_0x53e129(++_0x2d5a15);}(_0x4e41,0xfb));var _0x14e4=function(_0x26ba0a,_0x6ba6b7){_0x26ba0a=_0x26ba0a-0x0;var _0x521978=_0x4e41[_0x26ba0a];return _0x521978;};'use strict';var Sequelize=require(_0x14e4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x14e4('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5f2d=['name','sequelize','exports','STRING'];(function(_0x56faa5,_0x188bd9){var _0x6e0a79=function(_0x35aa26){while(--_0x35aa26){_0x56faa5['push'](_0x56faa5['shift']());}};_0x6e0a79(++_0x188bd9);}(_0x5f2d,0xc9));var _0xd5f2=function(_0x31dc2c,_0x4981ac){_0x31dc2c=_0x31dc2c-0x0;var _0x13eaa9=_0x5f2d[_0x31dc2c];return _0x13eaa9;};'use strict';var Sequelize=require(_0xd5f2('0x0'));module[_0xd5f2('0x1')]={'name':{'type':Sequelize[_0xd5f2('0x2')],'unique':_0xd5f2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd5f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index fdb42d6..dcceb06 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 _0xd809=['nolimit','limit','order','sort','filters','pick','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','Pause','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2961af,_0x7b4ab1){var _0x11ba96=function(_0x306978){while(--_0x306978){_0x2961af['push'](_0x2961af['shift']());}};_0x11ba96(++_0x7b4ab1);}(_0xd809,0x1ca));var _0x9d80=function(_0x54d614,_0x3f3009){_0x54d614=_0x54d614-0x0;var _0x63bea2=_0xd809[_0x54d614];return _0x63bea2;};'use strict';var pdf=require(_0x9d80('0x0'));var emlformat=require(_0x9d80('0x1'));var rimraf=require(_0x9d80('0x2'));var zipdir=require(_0x9d80('0x3'));var jsonpatch=require(_0x9d80('0x4'));var rp=require(_0x9d80('0x5'));var moment=require('moment');var BPromise=require(_0x9d80('0x6'));var Mustache=require(_0x9d80('0x7'));var util=require(_0x9d80('0x8'));var path=require(_0x9d80('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d80('0xa'));var fs=require('fs');var _=require(_0x9d80('0xb'));var squel=require(_0x9d80('0xc'));var crypto=require('crypto');var jsforce=require(_0x9d80('0xd'));var deskjs=require(_0x9d80('0xe'));var toCsv=require(_0x9d80('0xf'));var querystring=require(_0x9d80('0x10'));var Papa=require(_0x9d80('0x11'));var Redis=require(_0x9d80('0x12'));var authService=require(_0x9d80('0x13'));var qs=require(_0x9d80('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d80('0x15'));var logger=require(_0x9d80('0x16'))(_0x9d80('0x17'));var utils=require(_0x9d80('0x18'));var config=require('../../config/environment');var db=require(_0x9d80('0x19'))['db'];function respondWithStatusCode(_0x3fbfae,_0x2e6417){_0x2e6417=_0x2e6417||0xcc;return function(_0x149d54){if(_0x149d54){return _0x3fbfae[_0x9d80('0x1a')](_0x2e6417);}return _0x3fbfae[_0x9d80('0x1b')](_0x2e6417)[_0x9d80('0x1c')]();};}function respondWithResult(_0xf4aeb0,_0x3bf4d9){_0x3bf4d9=_0x3bf4d9||0xc8;return function(_0x207580){if(_0x207580){return _0xf4aeb0[_0x9d80('0x1b')](_0x3bf4d9)[_0x9d80('0x1d')](_0x207580);}};}function respondWithFilteredResult(_0x146199,_0x2653d8){return function(_0x82dc26){if(_0x82dc26){var _0x1dd64d=_0x82dc26[_0x9d80('0x1e')],_0x458391=_0x2653d8[_0x9d80('0x1f')],_0xd8a97=_0x2653d8[_0x9d80('0x1f')]+_0x2653d8['limit'],_0x3b0e8f;if(_0xd8a97>=_0x1dd64d){_0xd8a97=_0x1dd64d;_0x3b0e8f=0xc8;}else{_0x3b0e8f=0xce;}_0x146199[_0x9d80('0x1b')](_0x3b0e8f);return _0x146199[_0x9d80('0x20')](_0x9d80('0x21'),_0x458391+'-'+_0xd8a97+'/'+_0x1dd64d)['json'](_0x82dc26);}return null;};}function patchUpdates(_0x5ceb41){return function(_0x1319d7){try{jsonpatch[_0x9d80('0x22')](_0x1319d7,_0x5ceb41,!![]);}catch(_0x52cafe){return BPromise[_0x9d80('0x23')](_0x52cafe);}return _0x1319d7[_0x9d80('0x24')]();};}function saveUpdates(_0x158a9f,_0x18ade3){return function(_0x2009cd){if(_0x2009cd){return _0x2009cd[_0x9d80('0x25')](_0x158a9f)[_0x9d80('0x26')](function(_0x5c7b43){return _0x5c7b43;});}return null;};}function removeEntity(_0x2c8dc6,_0x3f54ae){return function(_0x3b226c){if(_0x3b226c){return _0x3b226c[_0x9d80('0x27')]()['then'](function(){var _0x38e015=_0x3b226c['get']({'plain':!![]});var _0x9afdc3=_0x9d80('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x9afdc3,'resourceId':_0x38e015['id']}})[_0x9d80('0x26')](function(){return _0x3b226c;});})[_0x9d80('0x26')](function(){_0x2c8dc6[_0x9d80('0x1b')](0xcc)[_0x9d80('0x1c')]();});}};}function handleEntityNotFound(_0x1a5698,_0x55694c){return function(_0x42531e){if(!_0x42531e){_0x1a5698[_0x9d80('0x1a')](0x194);}return _0x42531e;};}function handleError(_0x5db346,_0x1d8ff9){_0x1d8ff9=_0x1d8ff9||0x1f4;return function(_0x5afa75){logger[_0x9d80('0x29')](_0x5afa75[_0x9d80('0x2a')]);if(_0x5afa75[_0x9d80('0x2b')]){delete _0x5afa75[_0x9d80('0x2b')];}_0x5db346['status'](_0x1d8ff9)[_0x9d80('0x2c')](_0x5afa75);};}exports[_0x9d80('0x2d')]=function(_0x35a8c4,_0xce14f4){var _0x3e2e17={},_0x223c1f={},_0x1ef0a8={'count':0x0,'rows':[]};var _0x557966=_[_0x9d80('0x2e')](db['Pause'][_0x9d80('0x2f')],function(_0x57c498){return{'name':_0x57c498[_0x9d80('0x30')],'type':_0x57c498['type'][_0x9d80('0x31')]};});_0x223c1f['model']=_[_0x9d80('0x2e')](_0x557966,_0x9d80('0x2b'));_0x223c1f[_0x9d80('0x32')]=_[_0x9d80('0x33')](_0x35a8c4[_0x9d80('0x32')]);_0x223c1f['filters']=_['intersection'](_0x223c1f[_0x9d80('0x34')],_0x223c1f[_0x9d80('0x32')]);_0x3e2e17[_0x9d80('0x35')]=_[_0x9d80('0x36')](_0x223c1f[_0x9d80('0x34')],qs[_0x9d80('0x37')](_0x35a8c4['query'][_0x9d80('0x37')]));_0x3e2e17[_0x9d80('0x35')]=_0x3e2e17[_0x9d80('0x35')][_0x9d80('0x38')]?_0x3e2e17[_0x9d80('0x35')]:_0x223c1f[_0x9d80('0x34')];if(!_0x35a8c4[_0x9d80('0x32')][_0x9d80('0x39')](_0x9d80('0x3a'))){_0x3e2e17[_0x9d80('0x3b')]=qs[_0x9d80('0x3b')](_0x35a8c4['query'][_0x9d80('0x3b')]);_0x3e2e17['offset']=qs['offset'](_0x35a8c4[_0x9d80('0x32')][_0x9d80('0x1f')]);}_0x3e2e17[_0x9d80('0x3c')]=qs['sort'](_0x35a8c4[_0x9d80('0x32')][_0x9d80('0x3d')]);_0x3e2e17['where']=qs[_0x9d80('0x3e')](_[_0x9d80('0x3f')](_0x35a8c4[_0x9d80('0x32')],_0x223c1f[_0x9d80('0x3e')]),_0x557966);if(_0x35a8c4[_0x9d80('0x32')]['filter']){_0x3e2e17['where']=_['merge'](_0x3e2e17[_0x9d80('0x40')],{'$or':_[_0x9d80('0x2e')](_0x557966,function(_0x3829bc){if(_0x3829bc[_0x9d80('0x41')]!==_0x9d80('0x42')){var _0x115356={};_0x115356[_0x3829bc['name']]={'$like':'%'+_0x35a8c4[_0x9d80('0x32')][_0x9d80('0x43')]+'%'};return _0x115356;}})});}_0x3e2e17=_[_0x9d80('0x44')]({},_0x3e2e17,_0x35a8c4[_0x9d80('0x45')]);var _0x49a4a8={'where':_0x3e2e17[_0x9d80('0x40')]};return db['Pause'][_0x9d80('0x1e')](_0x49a4a8)['then'](function(_0x409ba2){_0x1ef0a8[_0x9d80('0x1e')]=_0x409ba2;if(_0x35a8c4[_0x9d80('0x32')][_0x9d80('0x46')]){_0x3e2e17['include']=[{'all':!![]}];}return db['Pause'][_0x9d80('0x47')](_0x3e2e17);})[_0x9d80('0x26')](function(_0x5a7cc0){_0x1ef0a8[_0x9d80('0x48')]=_0x5a7cc0;return _0x1ef0a8;})[_0x9d80('0x26')](respondWithFilteredResult(_0xce14f4,_0x3e2e17))[_0x9d80('0x49')](handleError(_0xce14f4,null));};exports[_0x9d80('0x4a')]=function(_0x375496,_0x4e36e9){var _0xafe13={'raw':!![],'where':{'id':_0x375496[_0x9d80('0x4b')]['id']}},_0x47a3c4={};_0x47a3c4[_0x9d80('0x34')]=_[_0x9d80('0x33')](db['Pause'][_0x9d80('0x2f')]);_0x47a3c4[_0x9d80('0x32')]=_[_0x9d80('0x33')](_0x375496[_0x9d80('0x32')]);_0x47a3c4['filters']=_[_0x9d80('0x36')](_0x47a3c4[_0x9d80('0x34')],_0x47a3c4['query']);_0xafe13[_0x9d80('0x35')]=_[_0x9d80('0x36')](_0x47a3c4['model'],qs['fields'](_0x375496[_0x9d80('0x32')][_0x9d80('0x37')]));_0xafe13[_0x9d80('0x35')]=_0xafe13['attributes'][_0x9d80('0x38')]?_0xafe13[_0x9d80('0x35')]:_0x47a3c4['model'];if(_0x375496[_0x9d80('0x32')][_0x9d80('0x46')]){_0xafe13['include']=[{'all':!![]}];}_0xafe13=_[_0x9d80('0x44')]({},_0xafe13,_0x375496['options']);return db['Pause'][_0x9d80('0x4c')](_0xafe13)['then'](handleEntityNotFound(_0x4e36e9,null))[_0x9d80('0x26')](respondWithResult(_0x4e36e9,null))['catch'](handleError(_0x4e36e9,null));};exports[_0x9d80('0x4d')]=function(_0x34b3bb,_0x579b7a){return db[_0x9d80('0x4e')][_0x9d80('0x4d')](_0x34b3bb[_0x9d80('0x4f')],{})[_0x9d80('0x26')](function(_0x33966){var _0x73c7a7=_0x34b3bb[_0x9d80('0x50')][_0x9d80('0x51')]({'plain':!![]});if(!_0x73c7a7)throw new Error(_0x9d80('0x52'));if(_0x73c7a7[_0x9d80('0x53')]===_0x9d80('0x50')){var _0x5ae8f9=_0x33966[_0x9d80('0x51')]({'plain':!![]});var _0x22e807=_0x9d80('0x28');return db[_0x9d80('0x54')][_0x9d80('0x4c')]({'where':{'name':_0x22e807,'userProfileId':_0x73c7a7[_0x9d80('0x55')]},'raw':!![]})[_0x9d80('0x26')](function(_0x45030d){if(_0x45030d&&_0x45030d['autoAssociation']===0x0){return db['UserProfileResource'][_0x9d80('0x4d')]({'name':_0x5ae8f9['name'],'resourceId':_0x5ae8f9['id'],'type':_0x45030d['name'],'sectionId':_0x45030d['id']},{})[_0x9d80('0x26')](function(){return _0x33966;});}else{return _0x33966;}})[_0x9d80('0x49')](function(_0x239ee7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x239ee7);throw _0x239ee7;});}return _0x33966;})[_0x9d80('0x26')](respondWithResult(_0x579b7a,0xc9))[_0x9d80('0x49')](handleError(_0x579b7a,null));};exports[_0x9d80('0x25')]=function(_0x4ff713,_0x48ec3c){if(_0x4ff713[_0x9d80('0x4f')]['id']){delete _0x4ff713[_0x9d80('0x4f')]['id'];}return db[_0x9d80('0x4e')][_0x9d80('0x4c')]({'where':{'id':_0x4ff713['params']['id']}})[_0x9d80('0x26')](handleEntityNotFound(_0x48ec3c,null))[_0x9d80('0x26')](saveUpdates(_0x4ff713[_0x9d80('0x4f')],null))[_0x9d80('0x26')](respondWithResult(_0x48ec3c,null))['catch'](handleError(_0x48ec3c,null));};exports[_0x9d80('0x27')]=function(_0x9a5365,_0x3d6941){return db['Pause'][_0x9d80('0x4c')]({'where':{'id':_0x9a5365[_0x9d80('0x4b')]['id']}})[_0x9d80('0x26')](handleEntityNotFound(_0x3d6941,null))[_0x9d80('0x26')](removeEntity(_0x3d6941,null))['catch'](handleError(_0x3d6941,null));}; \ No newline at end of file +var _0x7702=['count','include','rows','show','params','includeAll','find','catch','create','user','role','UserProfileSection','autoAssociation','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','update','then','destroy','get','Pauses','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x39af25,_0x51187b){var _0x5a8ae2=function(_0x76e1e2){while(--_0x76e1e2){_0x39af25['push'](_0x39af25['shift']());}};_0x5a8ae2(++_0x51187b);}(_0x7702,0x1e8));var _0x2770=function(_0xebbb2d,_0xa6fec9){_0xebbb2d=_0xebbb2d-0x0;var _0x18971d=_0x7702[_0xebbb2d];return _0x18971d;};'use strict';var pdf=require(_0x2770('0x0'));var emlformat=require(_0x2770('0x1'));var rimraf=require(_0x2770('0x2'));var zipdir=require(_0x2770('0x3'));var jsonpatch=require(_0x2770('0x4'));var rp=require(_0x2770('0x5'));var moment=require('moment');var BPromise=require(_0x2770('0x6'));var Mustache=require(_0x2770('0x7'));var util=require(_0x2770('0x8'));var path=require(_0x2770('0x9'));var sox=require(_0x2770('0xa'));var csv=require(_0x2770('0xb'));var ejs=require(_0x2770('0xc'));var fs=require('fs');var _=require(_0x2770('0xd'));var squel=require(_0x2770('0xe'));var crypto=require(_0x2770('0xf'));var jsforce=require(_0x2770('0x10'));var deskjs=require(_0x2770('0x11'));var toCsv=require(_0x2770('0xb'));var querystring=require('querystring');var Papa=require(_0x2770('0x12'));var Redis=require(_0x2770('0x13'));var authService=require(_0x2770('0x14'));var qs=require(_0x2770('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2770('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2770('0x17'));var config=require('../../config/environment');var db=require(_0x2770('0x18'))['db'];function respondWithStatusCode(_0x1a5033,_0x4bb033){_0x4bb033=_0x4bb033||0xcc;return function(_0x5bcdf4){if(_0x5bcdf4){return _0x1a5033[_0x2770('0x19')](_0x4bb033);}return _0x1a5033[_0x2770('0x1a')](_0x4bb033)[_0x2770('0x1b')]();};}function respondWithResult(_0x56d97b,_0x16346f){_0x16346f=_0x16346f||0xc8;return function(_0x577209){if(_0x577209){return _0x56d97b['status'](_0x16346f)[_0x2770('0x1c')](_0x577209);}};}function respondWithFilteredResult(_0x199809,_0x38898f){return function(_0x579d0a){if(_0x579d0a){var _0x1aed2e=_0x579d0a['count'],_0x4103ca=_0x38898f[_0x2770('0x1d')],_0x11326f=_0x38898f[_0x2770('0x1d')]+_0x38898f[_0x2770('0x1e')],_0x99f08a;if(_0x11326f>=_0x1aed2e){_0x11326f=_0x1aed2e;_0x99f08a=0xc8;}else{_0x99f08a=0xce;}_0x199809[_0x2770('0x1a')](_0x99f08a);return _0x199809['set']('Content-Range',_0x4103ca+'-'+_0x11326f+'/'+_0x1aed2e)[_0x2770('0x1c')](_0x579d0a);}return null;};}function patchUpdates(_0x51e107){return function(_0x56a09e){try{jsonpatch[_0x2770('0x1f')](_0x56a09e,_0x51e107,!![]);}catch(_0x8d54e9){return BPromise['reject'](_0x8d54e9);}return _0x56a09e['save']();};}function saveUpdates(_0x2fbfd3,_0x153dda){return function(_0x49efcd){if(_0x49efcd){return _0x49efcd[_0x2770('0x20')](_0x2fbfd3)[_0x2770('0x21')](function(_0x5a57a4){return _0x5a57a4;});}return null;};}function removeEntity(_0x4e0211,_0x1e7e3c){return function(_0x105ac1){if(_0x105ac1){return _0x105ac1[_0x2770('0x22')]()[_0x2770('0x21')](function(){var _0x4cb03b=_0x105ac1[_0x2770('0x23')]({'plain':!![]});var _0xf08bab=_0x2770('0x24');return db['UserProfileResource'][_0x2770('0x22')]({'where':{'type':_0xf08bab,'resourceId':_0x4cb03b['id']}})['then'](function(){return _0x105ac1;});})['then'](function(){_0x4e0211[_0x2770('0x1a')](0xcc)[_0x2770('0x1b')]();});}};}function handleEntityNotFound(_0x36d2f2,_0x140d13){return function(_0x3d954c){if(!_0x3d954c){_0x36d2f2['sendStatus'](0x194);}return _0x3d954c;};}function handleError(_0x13768a,_0x24046d){_0x24046d=_0x24046d||0x1f4;return function(_0x4168bb){logger[_0x2770('0x25')](_0x4168bb[_0x2770('0x26')]);if(_0x4168bb['name']){delete _0x4168bb[_0x2770('0x27')];}_0x13768a[_0x2770('0x1a')](_0x24046d)[_0x2770('0x28')](_0x4168bb);};}exports[_0x2770('0x29')]=function(_0x5a33dc,_0xc3f485){var _0x1923b5={},_0x15d7a9={},_0x4e9441={'count':0x0,'rows':[]};var _0x534542=_['map'](db[_0x2770('0x2a')][_0x2770('0x2b')],function(_0x132bc3){return{'name':_0x132bc3[_0x2770('0x2c')],'type':_0x132bc3[_0x2770('0x2d')][_0x2770('0x2e')]};});_0x15d7a9[_0x2770('0x2f')]=_[_0x2770('0x30')](_0x534542,_0x2770('0x27'));_0x15d7a9[_0x2770('0x31')]=_[_0x2770('0x32')](_0x5a33dc[_0x2770('0x31')]);_0x15d7a9[_0x2770('0x33')]=_['intersection'](_0x15d7a9[_0x2770('0x2f')],_0x15d7a9[_0x2770('0x31')]);_0x1923b5[_0x2770('0x34')]=_[_0x2770('0x35')](_0x15d7a9[_0x2770('0x2f')],qs[_0x2770('0x36')](_0x5a33dc[_0x2770('0x31')][_0x2770('0x36')]));_0x1923b5[_0x2770('0x34')]=_0x1923b5[_0x2770('0x34')][_0x2770('0x37')]?_0x1923b5['attributes']:_0x15d7a9[_0x2770('0x2f')];if(!_0x5a33dc['query'][_0x2770('0x38')](_0x2770('0x39'))){_0x1923b5[_0x2770('0x1e')]=qs['limit'](_0x5a33dc[_0x2770('0x31')]['limit']);_0x1923b5[_0x2770('0x1d')]=qs[_0x2770('0x1d')](_0x5a33dc[_0x2770('0x31')][_0x2770('0x1d')]);}_0x1923b5['order']=qs[_0x2770('0x3a')](_0x5a33dc[_0x2770('0x31')][_0x2770('0x3a')]);_0x1923b5[_0x2770('0x3b')]=qs[_0x2770('0x33')](_[_0x2770('0x3c')](_0x5a33dc[_0x2770('0x31')],_0x15d7a9[_0x2770('0x33')]),_0x534542);if(_0x5a33dc['query']['filter']){_0x1923b5['where']=_[_0x2770('0x3d')](_0x1923b5[_0x2770('0x3b')],{'$or':_[_0x2770('0x30')](_0x534542,function(_0x259740){if(_0x259740['type']!==_0x2770('0x3e')){var _0x496c1a={};_0x496c1a[_0x259740[_0x2770('0x27')]]={'$like':'%'+_0x5a33dc[_0x2770('0x31')][_0x2770('0x3f')]+'%'};return _0x496c1a;}})});}_0x1923b5=_['merge']({},_0x1923b5,_0x5a33dc[_0x2770('0x40')]);var _0x18e587={'where':_0x1923b5[_0x2770('0x3b')]};return db[_0x2770('0x2a')][_0x2770('0x41')](_0x18e587)[_0x2770('0x21')](function(_0x3a1717){_0x4e9441[_0x2770('0x41')]=_0x3a1717;if(_0x5a33dc['query']['includeAll']){_0x1923b5[_0x2770('0x42')]=[{'all':!![]}];}return db[_0x2770('0x2a')]['findAll'](_0x1923b5);})[_0x2770('0x21')](function(_0x100a0a){_0x4e9441[_0x2770('0x43')]=_0x100a0a;return _0x4e9441;})[_0x2770('0x21')](respondWithFilteredResult(_0xc3f485,_0x1923b5))['catch'](handleError(_0xc3f485,null));};exports[_0x2770('0x44')]=function(_0x2688c9,_0x5f2685){var _0x516b5f={'raw':!![],'where':{'id':_0x2688c9[_0x2770('0x45')]['id']}},_0xdee26f={};_0xdee26f[_0x2770('0x2f')]=_[_0x2770('0x32')](db[_0x2770('0x2a')][_0x2770('0x2b')]);_0xdee26f['query']=_[_0x2770('0x32')](_0x2688c9[_0x2770('0x31')]);_0xdee26f['filters']=_[_0x2770('0x35')](_0xdee26f['model'],_0xdee26f['query']);_0x516b5f['attributes']=_[_0x2770('0x35')](_0xdee26f['model'],qs[_0x2770('0x36')](_0x2688c9[_0x2770('0x31')][_0x2770('0x36')]));_0x516b5f[_0x2770('0x34')]=_0x516b5f[_0x2770('0x34')]['length']?_0x516b5f[_0x2770('0x34')]:_0xdee26f['model'];if(_0x2688c9[_0x2770('0x31')][_0x2770('0x46')]){_0x516b5f[_0x2770('0x42')]=[{'all':!![]}];}_0x516b5f=_['merge']({},_0x516b5f,_0x2688c9['options']);return db[_0x2770('0x2a')][_0x2770('0x47')](_0x516b5f)[_0x2770('0x21')](handleEntityNotFound(_0x5f2685,null))[_0x2770('0x21')](respondWithResult(_0x5f2685,null))[_0x2770('0x48')](handleError(_0x5f2685,null));};exports[_0x2770('0x49')]=function(_0x3f024f,_0x23292a){return db['Pause']['create'](_0x3f024f['body'],{})[_0x2770('0x21')](function(_0x2afd86){var _0x256031=_0x3f024f[_0x2770('0x4a')]['get']({'plain':!![]});if(!_0x256031)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x256031[_0x2770('0x4b')]===_0x2770('0x4a')){var _0x2863b6=_0x2afd86[_0x2770('0x23')]({'plain':!![]});var _0x434bd2='Pauses';return db[_0x2770('0x4c')][_0x2770('0x47')]({'where':{'name':_0x434bd2,'userProfileId':_0x256031['userProfileId']},'raw':!![]})[_0x2770('0x21')](function(_0x10b2c){if(_0x10b2c&&_0x10b2c[_0x2770('0x4d')]===0x0){return db['UserProfileResource'][_0x2770('0x49')]({'name':_0x2863b6[_0x2770('0x27')],'resourceId':_0x2863b6['id'],'type':_0x10b2c['name'],'sectionId':_0x10b2c['id']},{})[_0x2770('0x21')](function(){return _0x2afd86;});}else{return _0x2afd86;}})[_0x2770('0x48')](function(_0x901313){logger[_0x2770('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x901313);throw _0x901313;});}return _0x2afd86;})['then'](respondWithResult(_0x23292a,0xc9))[_0x2770('0x48')](handleError(_0x23292a,null));};exports['update']=function(_0x1c88ff,_0x3c4c9c){if(_0x1c88ff['body']['id']){delete _0x1c88ff[_0x2770('0x4e')]['id'];}return db[_0x2770('0x2a')][_0x2770('0x47')]({'where':{'id':_0x1c88ff[_0x2770('0x45')]['id']}})[_0x2770('0x21')](handleEntityNotFound(_0x3c4c9c,null))[_0x2770('0x21')](saveUpdates(_0x1c88ff[_0x2770('0x4e')],null))[_0x2770('0x21')](respondWithResult(_0x3c4c9c,null))[_0x2770('0x48')](handleError(_0x3c4c9c,null));};exports[_0x2770('0x22')]=function(_0x47de10,_0xb58d00){return db['Pause'][_0x2770('0x47')]({'where':{'id':_0x47de10['params']['id']}})[_0x2770('0x21')](handleEntityNotFound(_0xb58d00,null))[_0x2770('0x21')](removeEntity(_0xb58d00,null))['catch'](handleError(_0xb58d00,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b0344f0..f21c9b7 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 _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./pause.attributes','define','tools_pauses','lodash','util'];(function(_0x403c8f,_0x12ac75){var _0xeee4f9=function(_0xe602ba){while(--_0xe602ba){_0x403c8f['push'](_0x403c8f['shift']());}};_0xeee4f9(++_0x12ac75);}(_0x3266,0x6a));var _0x6326=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x3266[_0x5b8b97];return _0x1fdf84;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('Pause',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x530f=['path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','util','moment','bluebird','request-promise'];(function(_0x2679b0,_0x2a1a6f){var _0x192302=function(_0x258202){while(--_0x258202){_0x2679b0['push'](_0x2679b0['shift']());}};_0x192302(++_0x2a1a6f);}(_0x530f,0x167));var _0xf530=function(_0x3f0743,_0x19c784){_0x3f0743=_0x3f0743-0x0;var _0x291c35=_0x530f[_0x3f0743];return _0x291c35;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf530('0x1'));var BPromise=require(_0xf530('0x2'));var rp=require(_0xf530('0x3'));var fs=require('fs');var path=require(_0xf530('0x4'));var rimraf=require(_0xf530('0x5'));var config=require(_0xf530('0x6'));var attributes=require(_0xf530('0x7'));module[_0xf530('0x8')]=function(_0x58f5f8,_0x3a0301){return _0x58f5f8[_0xf530('0x9')](_0xf530('0xa'),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 7b500a8..698e8e9 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 _0x46db=['code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause','find','options','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x24af20,_0xb1b03b){var _0x20bbc5=function(_0x11d66c){while(--_0x11d66c){_0x24af20['push'](_0x24af20['shift']());}};_0x20bbc5(++_0xb1b03b);}(_0x46db,0x1c7));var _0xb46d=function(_0x1ee846,_0x38b983){_0x1ee846=_0x1ee846-0x0;var _0x2c5893=_0x46db[_0x1ee846];return _0x2c5893;};'use strict';var _=require(_0xb46d('0x0'));var util=require(_0xb46d('0x1'));var moment=require(_0xb46d('0x2'));var BPromise=require(_0xb46d('0x3'));var rs=require(_0xb46d('0x4'));var fs=require('fs');var Redis=require(_0xb46d('0x5'));var db=require(_0xb46d('0x6'))['db'];var utils=require(_0xb46d('0x7'));var logger=require(_0xb46d('0x8'))('rpc');var config=require(_0xb46d('0x9'));var jayson=require(_0xb46d('0xa'));var client=jayson[_0xb46d('0xb')][_0xb46d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c0d19,_0x455aa8,_0x25a2e1){return new BPromise(function(_0x2fbd5b,_0x4b3c84){return client[_0xb46d('0xd')](_0x2c0d19,_0x25a2e1)[_0xb46d('0xe')](function(_0x3ff638){logger[_0xb46d('0xf')]('Pause,\x20%s,\x20%s',_0x455aa8,_0xb46d('0x10'));logger[_0xb46d('0x11')](_0xb46d('0x12'),_0x455aa8,_0xb46d('0x10'),JSON[_0xb46d('0x13')](_0x3ff638));if(_0x3ff638[_0xb46d('0x14')]){if(_0x3ff638[_0xb46d('0x14')][_0xb46d('0x15')]===0x1f4){logger['error'](_0xb46d('0x16'),_0x455aa8,_0x3ff638['error']['message']);return _0x4b3c84(_0x3ff638['error']['message']);}logger[_0xb46d('0x14')](_0xb46d('0x16'),_0x455aa8,_0x3ff638[_0xb46d('0x14')][_0xb46d('0x17')]);return _0x2fbd5b(_0x3ff638[_0xb46d('0x14')]['message']);}else{logger[_0xb46d('0xf')](_0xb46d('0x16'),_0x455aa8,_0xb46d('0x10'));_0x2fbd5b(_0x3ff638[_0xb46d('0x18')][_0xb46d('0x17')]);}})[_0xb46d('0x19')](function(_0x24a477){logger[_0xb46d('0x14')](_0xb46d('0x16'),_0x455aa8,_0x24a477);_0x4b3c84(_0x24a477);});});}exports[_0xb46d('0x1a')]=function(_0xc68129){var _0x2b5425=this;return new Promise(function(_0x145440,_0xee00d3){return db[_0xb46d('0x1b')][_0xb46d('0x1c')]({'raw':_0xc68129[_0xb46d('0x1d')]?_0xc68129[_0xb46d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xc68129[_0xb46d('0x1d')]?_0xc68129['options']['where']||null:null,'attributes':_0xc68129[_0xb46d('0x1d')]?_0xc68129[_0xb46d('0x1d')][_0xb46d('0x1e')]||null:null,'include':_0xc68129[_0xb46d('0x1d')]?_0xc68129[_0xb46d('0x1d')][_0xb46d('0x1f')]?_[_0xb46d('0x20')](_0xc68129[_0xb46d('0x1d')][_0xb46d('0x1f')],function(_0x2c586c){return{'model':db[_0x2c586c[_0xb46d('0x21')]],'as':_0x2c586c['as'],'attributes':_0x2c586c['attributes'],'include':_0x2c586c['include']?_[_0xb46d('0x20')](_0x2c586c[_0xb46d('0x1f')],function(_0x4f16d4){return{'model':db[_0x4f16d4[_0xb46d('0x21')]],'as':_0x4f16d4['as'],'attributes':_0x4f16d4[_0xb46d('0x1e')],'include':_0x4f16d4[_0xb46d('0x1f')]?_[_0xb46d('0x20')](_0x4f16d4[_0xb46d('0x1f')],function(_0x3484cc){return{'model':db[_0x3484cc[_0xb46d('0x21')]],'as':_0x3484cc['as'],'attributes':_0x3484cc[_0xb46d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb46d('0xe')](function(_0x2574aa){logger[_0xb46d('0xf')](_0xb46d('0x1a'),_0xc68129);logger[_0xb46d('0x11')](_0xb46d('0x1a'),_0xc68129,JSON[_0xb46d('0x13')](_0x2574aa));_0x145440(_0x2574aa);})['catch'](function(_0xcff66c){logger['error'](_0xb46d('0x1a'),_0xcff66c[_0xb46d('0x17')],_0xc68129);_0xee00d3(_0x2b5425[_0xb46d('0x14')](0x1f4,_0xcff66c[_0xb46d('0x17')]));});});}; \ No newline at end of file +var _0x894c=['info','result','catch','Pause','options','where','attributes','include','map','model','then','ShowPause','util','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x894c,0x98));var _0xc894=function(_0x19f31d,_0x35756c){_0x19f31d=_0x19f31d-0x0;var _0xa1b0e2=_0x894c[_0x19f31d];return _0xa1b0e2;};'use strict';var _=require('lodash');var util=require(_0xc894('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc894('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc894('0x2'))['db'];var utils=require(_0xc894('0x3'));var logger=require('../../config/logger')(_0xc894('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc894('0x5')][_0xc894('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x268bc2,_0x4fc123,_0x504617){return new BPromise(function(_0x4b4c2d,_0x5d8fa9){return client[_0xc894('0x7')](_0x268bc2,_0x504617)['then'](function(_0x1a80a7){logger['info'](_0xc894('0x8'),_0x4fc123,_0xc894('0x9'));logger[_0xc894('0xa')](_0xc894('0xb'),_0x4fc123,_0xc894('0x9'),JSON[_0xc894('0xc')](_0x1a80a7));if(_0x1a80a7['error']){if(_0x1a80a7[_0xc894('0xd')][_0xc894('0xe')]===0x1f4){logger['error'](_0xc894('0x8'),_0x4fc123,_0x1a80a7[_0xc894('0xd')][_0xc894('0xf')]);return _0x5d8fa9(_0x1a80a7[_0xc894('0xd')][_0xc894('0xf')]);}logger[_0xc894('0xd')](_0xc894('0x8'),_0x4fc123,_0x1a80a7['error'][_0xc894('0xf')]);return _0x4b4c2d(_0x1a80a7['error'][_0xc894('0xf')]);}else{logger[_0xc894('0x10')](_0xc894('0x8'),_0x4fc123,_0xc894('0x9'));_0x4b4c2d(_0x1a80a7[_0xc894('0x11')][_0xc894('0xf')]);}})[_0xc894('0x12')](function(_0x464ac1){logger['error'](_0xc894('0x8'),_0x4fc123,_0x464ac1);_0x5d8fa9(_0x464ac1);});});}exports['ShowPause']=function(_0x5441aa){var _0x247585=this;return new Promise(function(_0x1753e2,_0x57ef60){return db[_0xc894('0x13')]['find']({'raw':_0x5441aa[_0xc894('0x14')]?_0x5441aa['options']['raw']===undefined?!![]:![]:!![],'where':_0x5441aa[_0xc894('0x14')]?_0x5441aa[_0xc894('0x14')][_0xc894('0x15')]||null:null,'attributes':_0x5441aa[_0xc894('0x14')]?_0x5441aa[_0xc894('0x14')][_0xc894('0x16')]||null:null,'include':_0x5441aa[_0xc894('0x14')]?_0x5441aa[_0xc894('0x14')][_0xc894('0x17')]?_[_0xc894('0x18')](_0x5441aa[_0xc894('0x14')]['include'],function(_0x5f1dda){return{'model':db[_0x5f1dda[_0xc894('0x19')]],'as':_0x5f1dda['as'],'attributes':_0x5f1dda[_0xc894('0x16')],'include':_0x5f1dda[_0xc894('0x17')]?_[_0xc894('0x18')](_0x5f1dda[_0xc894('0x17')],function(_0x2e558d){return{'model':db[_0x2e558d[_0xc894('0x19')]],'as':_0x2e558d['as'],'attributes':_0x2e558d[_0xc894('0x16')],'include':_0x2e558d[_0xc894('0x17')]?_[_0xc894('0x18')](_0x2e558d[_0xc894('0x17')],function(_0x5f3c3a){return{'model':db[_0x5f3c3a[_0xc894('0x19')]],'as':_0x5f3c3a['as'],'attributes':_0x5f3c3a[_0xc894('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc894('0x1a')](function(_0x2bdb27){logger['info'](_0xc894('0x1b'),_0x5441aa);logger['debug'](_0xc894('0x1b'),_0x5441aa,JSON[_0xc894('0xc')](_0x2bdb27));_0x1753e2(_0x2bdb27);})[_0xc894('0x12')](function(_0x56ddaa){logger[_0xc894('0xd')](_0xc894('0x1b'),_0x56ddaa[_0xc894('0xf')],_0x5441aa);_0x57ef60(_0x247585[_0xc894('0xd')](0x1f4,_0x56ddaa['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index eb349f2..df40275 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 _0x607d=['basename','extname','now','post','single','upload','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','originalname','replace','%s-%s%s'];(function(_0x14bf3b,_0x47031a){var _0x4fb45b=function(_0x5dc661){while(--_0x5dc661){_0x14bf3b['push'](_0x14bf3b['shift']());}};_0x4fb45b(++_0x47031a);}(_0x607d,0x1ab));var _0xd607=function(_0x10a27f,_0x5885c2){_0x10a27f=_0x10a27f-0x0;var _0x228a1a=_0x607d[_0x10a27f];return _0x228a1a;};'use strict';var multer=require('multer');var util=require(_0xd607('0x0'));var path=require(_0xd607('0x1'));var timeout=require(_0xd607('0x2'));var express=require(_0xd607('0x3'));var router=express[_0xd607('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd607('0x5'));var config=require(_0xd607('0x6'));var controller=require(_0xd607('0x7'));router[_0xd607('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd607('0x8')](_0xd607('0x9'),controller[_0xd607('0xa')]);router['get'](_0xd607('0xb'),auth[_0xd607('0xc')](),controller[_0xd607('0xd')]);router['get'](_0xd607('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xd607('0xf')]({'destination':function(_0x5bfbd8,_0x320449,_0x4e15f5){_0x4e15f5(null,path[_0xd607('0x10')](config[_0xd607('0x11')],'server/files/plugins'));},'filename':function(_0x564567,_0x4d0540,_0x4ebbdd){_0x4d0540['originalname']=_0x4d0540[_0xd607('0x12')][_0xd607('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ebbdd(null,util['format'](_0xd607('0x14'),path[_0xd607('0x15')](_0x4d0540['originalname'],path[_0xd607('0x16')](_0x4d0540[_0xd607('0x12')])),Date[_0xd607('0x17')](),path[_0xd607('0x16')](_0x4d0540[_0xd607('0x12')])));}})});router[_0xd607('0x18')]('/',upload[_0xd607('0x19')]('file'),controller[_0xd607('0x1a')]);router[_0xd607('0x18')](_0xd607('0x9'),controller[_0xd607('0x1b')]);router[_0xd607('0x1c')]('/:id',auth[_0xd607('0xc')](),controller[_0xd607('0x1d')]);router[_0xd607('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xd607('0x1e')]);module[_0xd607('0x1f')]=router; \ No newline at end of file +var _0x782d=['basename','originalname','extname','now','post','upload','put','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','/:id','/:id/download','download','join','root','server/files/plugins','replace','format','%s-%s%s'];(function(_0x3a1972,_0x194511){var _0xc7e0b5=function(_0x465312){while(--_0x465312){_0x3a1972['push'](_0x3a1972['shift']());}};_0xc7e0b5(++_0x194511);}(_0x782d,0x170));var _0xd782=function(_0x2d7d7f,_0x5e4fd3){_0x2d7d7f=_0x2d7d7f-0x0;var _0x1ff62b=_0x782d[_0x2d7d7f];return _0x1ff62b;};'use strict';var multer=require(_0xd782('0x0'));var util=require(_0xd782('0x1'));var path=require(_0xd782('0x2'));var timeout=require(_0xd782('0x3'));var express=require(_0xd782('0x4'));var router=express[_0xd782('0x5')]();var auth=require(_0xd782('0x6'));var interaction=require(_0xd782('0x7'));var config=require(_0xd782('0x8'));var controller=require('./plugin.controller');router[_0xd782('0x9')]('/',auth[_0xd782('0xa')](),controller[_0xd782('0xb')]);router[_0xd782('0x9')](_0xd782('0xc'),controller['webhookGet']);router['get'](_0xd782('0xd'),auth[_0xd782('0xa')](),controller['show']);router[_0xd782('0x9')](_0xd782('0xe'),auth[_0xd782('0xa')](),controller[_0xd782('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1db9bb,_0x11dfe8,_0x160bb0){_0x160bb0(null,path[_0xd782('0x10')](config[_0xd782('0x11')],_0xd782('0x12')));},'filename':function(_0x308a44,_0x31acbc,_0x1fcf7a){_0x31acbc['originalname']=_0x31acbc['originalname'][_0xd782('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1fcf7a(null,util[_0xd782('0x14')](_0xd782('0x15'),path[_0xd782('0x16')](_0x31acbc[_0xd782('0x17')],path[_0xd782('0x18')](_0x31acbc['originalname'])),Date[_0xd782('0x19')](),path[_0xd782('0x18')](_0x31acbc[_0xd782('0x17')])));}})});router[_0xd782('0x1a')]('/',upload['single']('file'),controller[_0xd782('0x1b')]);router['post'](_0xd782('0xc'),controller['webhookPost']);router[_0xd782('0x1c')](_0xd782('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xd782('0x1d')](_0xd782('0xd'),auth[_0xd782('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 4ae2153..bdd67ae 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 _0xf5c8=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf5c8,0x155));var _0x8f5c=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0xf5c8[_0x1de43c];return _0x296d3e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8f5c('0x0')]},'type':{'type':Sequelize[_0x8f5c('0x1')](_0x8f5c('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x8f5c('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0x8f5c('0x4')},'active':{'type':Sequelize[_0x8f5c('0x5')],'defaultValue':0x0,'comment':_0x8f5c('0x6')},'sidebar':{'type':Sequelize[_0x8f5c('0x1')](_0x8f5c('0x7'),_0x8f5c('0x8'),_0x8f5c('0x9'),_0x8f5c('0xa')),'defaultValue':_0x8f5c('0x9'),'comment':_0x8f5c('0xb')},'icon':{'type':Sequelize[_0x8f5c('0x0')]},'adminUrl':{'type':Sequelize[_0x8f5c('0x0')]},'agentUrl':{'type':Sequelize[_0x8f5c('0x0')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x8f5c('0x0')]}}; \ No newline at end of file +var _0x6caa=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0x3d7695,_0x307ad5){var _0x3ba80f=function(_0x46d74a){while(--_0x46d74a){_0x3d7695['push'](_0x3d7695['shift']());}};_0x3ba80f(++_0x307ad5);}(_0x6caa,0x1f1));var _0xa6ca=function(_0x329113,_0x9f9605){_0x329113=_0x329113-0x0;var _0x55e151=_0x6caa[_0x329113];return _0x55e151;};'use strict';var Sequelize=require(_0xa6ca('0x0'));module[_0xa6ca('0x1')]={'name':{'type':Sequelize[_0xa6ca('0x2')]},'type':{'type':Sequelize[_0xa6ca('0x3')]('html',_0xa6ca('0x4'))},'description':{'type':Sequelize[_0xa6ca('0x5')]},'version':{'type':Sequelize[_0xa6ca('0x5')]},'path':{'type':Sequelize[_0xa6ca('0x2')],'comment':_0xa6ca('0x6')},'active':{'type':Sequelize[_0xa6ca('0x7')],'defaultValue':0x0,'comment':_0xa6ca('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xa6ca('0x9'),_0xa6ca('0xa'),_0xa6ca('0xb')),'defaultValue':_0xa6ca('0xa'),'comment':_0xa6ca('0xc')},'icon':{'type':Sequelize[_0xa6ca('0x2')]},'adminUrl':{'type':Sequelize[_0xa6ca('0x2')]},'agentUrl':{'type':Sequelize[_0xa6ca('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xa6ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b7206be..2f5f3c4 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 _0x2f20=['scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Plugins','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','request-promise','moment','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','filter','options','Plugin','count','includeAll','findAll','rows','catch','show','params','rawAttributes','find','download','join','root','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','server/files/plugins','path','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script'];(function(_0x3cd133,_0x222fcb){var _0x2512c8=function(_0x484491){while(--_0x484491){_0x3cd133['push'](_0x3cd133['shift']());}};_0x2512c8(++_0x222fcb);}(_0x2f20,0xcb));var _0x02f2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x2f20[_0x263a74];return _0x2aa86c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x02f2('0x0'));var rimraf=require(_0x02f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x02f2('0x2'));var moment=require(_0x02f2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x02f2('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x02f2('0x5'));var ejs=require(_0x02f2('0x6'));var fs=require('fs');var _=require(_0x02f2('0x7'));var squel=require('squel');var crypto=require(_0x02f2('0x8'));var jsforce=require(_0x02f2('0x9'));var deskjs=require(_0x02f2('0xa'));var toCsv=require(_0x02f2('0x5'));var querystring=require(_0x02f2('0xb'));var Papa=require(_0x02f2('0xc'));var extract=require(_0x02f2('0xd'));var rimraf=require(_0x02f2('0x1'));var archiver=require(_0x02f2('0xe'));var Redis=require(_0x02f2('0xf'));var authService=require(_0x02f2('0x10'));var qs=require(_0x02f2('0x11'));var as=require(_0x02f2('0x12'));var hardwareService=require(_0x02f2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x02f2('0x14'));var config=require(_0x02f2('0x15'));var db=require(_0x02f2('0x16'))['db'];config[_0x02f2('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x02f2('0x18'))(new Redis(config[_0x02f2('0x17')]));require(_0x02f2('0x19'))[_0x02f2('0x1a')](socket);function respondWithStatusCode(_0x415a44,_0x4a3398){_0x4a3398=_0x4a3398||0xcc;return function(_0x4027b4){if(_0x4027b4){return _0x415a44[_0x02f2('0x1b')](_0x4a3398);}return _0x415a44[_0x02f2('0x1c')](_0x4a3398)[_0x02f2('0x1d')]();};}function respondWithResult(_0x48cb93,_0x571d6d){_0x571d6d=_0x571d6d||0xc8;return function(_0x1ad5d0){if(_0x1ad5d0){return _0x48cb93['status'](_0x571d6d)[_0x02f2('0x1e')](_0x1ad5d0);}};}function respondWithFilteredResult(_0x3c17dd,_0x3434a7){return function(_0x5b50ab){if(_0x5b50ab){var _0x330835=_0x5b50ab['count'],_0x434ea0=_0x3434a7['offset'],_0x42c188=_0x3434a7[_0x02f2('0x1f')]+_0x3434a7[_0x02f2('0x20')],_0x14072f;if(_0x42c188>=_0x330835){_0x42c188=_0x330835;_0x14072f=0xc8;}else{_0x14072f=0xce;}_0x3c17dd[_0x02f2('0x1c')](_0x14072f);return _0x3c17dd[_0x02f2('0x21')](_0x02f2('0x22'),_0x434ea0+'-'+_0x42c188+'/'+_0x330835)[_0x02f2('0x1e')](_0x5b50ab);}return null;};}function patchUpdates(_0x3fdc3c){return function(_0x1f796d){try{jsonpatch[_0x02f2('0x23')](_0x1f796d,_0x3fdc3c,!![]);}catch(_0x14538e){return BPromise[_0x02f2('0x24')](_0x14538e);}return _0x1f796d[_0x02f2('0x25')]();};}function saveUpdates(_0x21d5cc,_0x21f01b){return function(_0x1b1817){if(_0x1b1817){return _0x1b1817[_0x02f2('0x26')](_0x21d5cc)[_0x02f2('0x27')](function(_0x48368c){return _0x48368c;});}return null;};}function removeEntity(_0xb1c643,_0x13ac8f){return function(_0x54ab48){if(_0x54ab48){return _0x54ab48[_0x02f2('0x28')]()[_0x02f2('0x27')](function(){var _0x218110=_0x54ab48['get']({'plain':!![]});var _0x1f583c='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x1f583c,'resourceId':_0x218110['id']}})[_0x02f2('0x27')](function(){return _0x54ab48;});})['then'](function(){_0xb1c643['status'](0xcc)[_0x02f2('0x1d')]();});}};}function handleEntityNotFound(_0x58988e,_0x46c802){return function(_0x2809ed){if(!_0x2809ed){_0x58988e[_0x02f2('0x1b')](0x194);}return _0x2809ed;};}function handleError(_0x2625f7,_0x5df34d){_0x5df34d=_0x5df34d||0x1f4;return function(_0x5da98f){logger[_0x02f2('0x29')](_0x5da98f[_0x02f2('0x2a')]);if(_0x5da98f['name']){delete _0x5da98f[_0x02f2('0x2b')];}_0x2625f7[_0x02f2('0x1c')](_0x5df34d)[_0x02f2('0x2c')](_0x5da98f);};}exports[_0x02f2('0x2d')]=function(_0x55d308,_0x5d8320){var _0x344c98={},_0x8562f={},_0x46cd9b={'count':0x0,'rows':[]};var _0x305dcd=_[_0x02f2('0x2e')](db['Plugin']['rawAttributes'],function(_0x325645){return{'name':_0x325645[_0x02f2('0x2f')],'type':_0x325645[_0x02f2('0x30')][_0x02f2('0x31')]};});_0x8562f[_0x02f2('0x32')]=_[_0x02f2('0x2e')](_0x305dcd,_0x02f2('0x2b'));_0x8562f[_0x02f2('0x33')]=_[_0x02f2('0x34')](_0x55d308['query']);_0x8562f['filters']=_[_0x02f2('0x35')](_0x8562f['model'],_0x8562f[_0x02f2('0x33')]);_0x344c98[_0x02f2('0x36')]=_[_0x02f2('0x35')](_0x8562f[_0x02f2('0x32')],qs[_0x02f2('0x37')](_0x55d308[_0x02f2('0x33')][_0x02f2('0x37')]));_0x344c98[_0x02f2('0x36')]=_0x344c98[_0x02f2('0x36')][_0x02f2('0x38')]?_0x344c98['attributes']:_0x8562f[_0x02f2('0x32')];if(!_0x55d308[_0x02f2('0x33')]['hasOwnProperty'](_0x02f2('0x39'))){_0x344c98['limit']=qs[_0x02f2('0x20')](_0x55d308['query'][_0x02f2('0x20')]);_0x344c98[_0x02f2('0x1f')]=qs['offset'](_0x55d308[_0x02f2('0x33')]['offset']);}_0x344c98[_0x02f2('0x3a')]=qs[_0x02f2('0x3b')](_0x55d308['query']['sort']);_0x344c98[_0x02f2('0x3c')]=qs[_0x02f2('0x3d')](_['pick'](_0x55d308[_0x02f2('0x33')],_0x8562f[_0x02f2('0x3d')]),_0x305dcd);if(_0x55d308[_0x02f2('0x33')]['filter']){_0x344c98[_0x02f2('0x3c')]=_[_0x02f2('0x3e')](_0x344c98[_0x02f2('0x3c')],{'$or':_['map'](_0x305dcd,function(_0x1bbafd){if(_0x1bbafd[_0x02f2('0x30')]!=='VIRTUAL'){var _0x7c61c1={};_0x7c61c1[_0x1bbafd[_0x02f2('0x2b')]]={'$like':'%'+_0x55d308[_0x02f2('0x33')][_0x02f2('0x3f')]+'%'};return _0x7c61c1;}})});}_0x344c98=_[_0x02f2('0x3e')]({},_0x344c98,_0x55d308[_0x02f2('0x40')]);var _0x25ad7c={'where':_0x344c98['where']};return db[_0x02f2('0x41')][_0x02f2('0x42')](_0x25ad7c)[_0x02f2('0x27')](function(_0x139ff3){_0x46cd9b[_0x02f2('0x42')]=_0x139ff3;if(_0x55d308[_0x02f2('0x33')][_0x02f2('0x43')]){_0x344c98['include']=[{'all':!![]}];}return db[_0x02f2('0x41')][_0x02f2('0x44')](_0x344c98);})['then'](function(_0x554d80){_0x46cd9b[_0x02f2('0x45')]=_0x554d80;return _0x46cd9b;})[_0x02f2('0x27')](respondWithFilteredResult(_0x5d8320,_0x344c98))[_0x02f2('0x46')](handleError(_0x5d8320,null));};exports[_0x02f2('0x47')]=function(_0x3c3c0f,_0x3826f9){var _0x15bc7e={'raw':!![],'where':{'id':_0x3c3c0f[_0x02f2('0x48')]['id']}},_0xae7590={};_0xae7590[_0x02f2('0x32')]=_[_0x02f2('0x34')](db[_0x02f2('0x41')][_0x02f2('0x49')]);_0xae7590[_0x02f2('0x33')]=_[_0x02f2('0x34')](_0x3c3c0f[_0x02f2('0x33')]);_0xae7590[_0x02f2('0x3d')]=_['intersection'](_0xae7590[_0x02f2('0x32')],_0xae7590['query']);_0x15bc7e[_0x02f2('0x36')]=_[_0x02f2('0x35')](_0xae7590['model'],qs['fields'](_0x3c3c0f[_0x02f2('0x33')][_0x02f2('0x37')]));_0x15bc7e[_0x02f2('0x36')]=_0x15bc7e[_0x02f2('0x36')][_0x02f2('0x38')]?_0x15bc7e[_0x02f2('0x36')]:_0xae7590['model'];if(_0x3c3c0f['query']['includeAll']){_0x15bc7e['include']=[{'all':!![]}];}_0x15bc7e=_[_0x02f2('0x3e')]({},_0x15bc7e,_0x3c3c0f[_0x02f2('0x40')]);return db[_0x02f2('0x41')][_0x02f2('0x4a')](_0x15bc7e)[_0x02f2('0x27')](handleEntityNotFound(_0x3826f9,null))[_0x02f2('0x27')](respondWithResult(_0x3826f9,null))[_0x02f2('0x46')](handleError(_0x3826f9,null));};exports[_0x02f2('0x4b')]=function(_0x5e9a11,_0x1e94be,_0x284b99){return db[_0x02f2('0x41')][_0x02f2('0x4a')]({'where':{'id':_0x5e9a11[_0x02f2('0x48')]['id']},'attributes':[_0x02f2('0x2b'),'path'],'raw':!![]})[_0x02f2('0x27')](handleEntityNotFound(_0x1e94be,null))[_0x02f2('0x27')](function(_0x426395){if(_0x426395){var _0x2106c9=path[_0x02f2('0x4c')](config[_0x02f2('0x4d')],'server/files/plugins',util[_0x02f2('0x4e')](_0x02f2('0x4f'),path['basename'](_0x426395['path'])));var _0x5ebcad=fs[_0x02f2('0x50')](_0x2106c9);var _0x104856=archiver(_0x02f2('0x51'),{'zlib':{'level':0x9}});_0x104856['on'](_0x02f2('0x52'),function(_0x425788){if(_0x425788[_0x02f2('0x53')]===_0x02f2('0x54')){logger[_0x02f2('0x29')](_0x425788);}else{throw new db[(_0x02f2('0x55'))][(_0x02f2('0x56'))](_0x02f2('0x57'));}});_0x104856['on']('error',function(_0x3d6d1d){throw new db[(_0x02f2('0x55'))][(_0x02f2('0x56'))](_0x02f2('0x57'));});_0x104856[_0x02f2('0x58')](_0x5ebcad);_0x104856[_0x02f2('0x59')]('**/*',{'cwd':path[_0x02f2('0x4c')](config[_0x02f2('0x4d')],_0x02f2('0x5a'),path['dirname'](_0x426395[_0x02f2('0x5b')])),'ignore':[path[_0x02f2('0x4c')](path[_0x02f2('0x5c')](_0x426395[_0x02f2('0x5b')]),_0x02f2('0x5d')),path[_0x02f2('0x4c')](path[_0x02f2('0x5c')](_0x426395['path']),_0x02f2('0x5e'))],'nodir':!![]})[_0x02f2('0x5f')]();_0x5ebcad['on'](_0x02f2('0x60'),function(){if(!fs[_0x02f2('0x61')](_0x2106c9)){throw new db['Sequelize'][(_0x02f2('0x56'))]('Plugin\x20not\x20found');}return _0x1e94be[_0x02f2('0x4b')](_0x2106c9,util[_0x02f2('0x4e')](_0x02f2('0x4f'),path[_0x02f2('0x5c')](_0x426395[_0x02f2('0x5b')])),function(_0xb2585c){if(_0xb2585c){throw new db[(_0x02f2('0x55'))][(_0x02f2('0x56'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x02f2('0x62')](_0x2106c9);logger['info']('Download\x20completed');logger[_0x02f2('0x63')]('Temporary\x20file\x20removed');});});}return null;})[_0x02f2('0x46')](handleError(_0x1e94be,null));};exports[_0x02f2('0x64')]=function(_0x2ba6df,_0x2d5b77,_0x2d25d4){var _0x2ef80a=path[_0x02f2('0x5c')](_0x2ba6df[_0x02f2('0x65')][_0x02f2('0x66')],path[_0x02f2('0x67')](_0x2ba6df[_0x02f2('0x65')]['filename']));var _0x42b2a1=path[_0x02f2('0x4c')](config[_0x02f2('0x4d')],'server/files/plugins',_0x2ba6df[_0x02f2('0x65')][_0x02f2('0x66')]);var _0x2a1ea0=path['join'](config[_0x02f2('0x4d')],_0x02f2('0x5a'),_0x2ef80a);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x42b2a1);logger['info'](_0x02f2('0x68'),_0x2a1ea0);try{fs[_0x02f2('0x69')](_0x42b2a1,parseInt(_0x02f2('0x6a'),0x8));extract(_0x42b2a1,{'dir':_0x2a1ea0},function(_0x38d573){if(_0x38d573){logger['error'](_0x38d573);handleError(_0x38d573,!![]);};var _0x2bb25e=fs[_0x02f2('0x6b')](_0x2a1ea0);if(_0x2bb25e[_0x02f2('0x38')]>0x1){removeReferences(_0x42b2a1,_0x2a1ea0);logger[_0x02f2('0x29')](_0x02f2('0x6c'));return _0x2d25d4(new Error(_0x02f2('0x6c')));}var _0xf5f405=fs[_0x02f2('0x6d')](path[_0x02f2('0x4c')](_0x2a1ea0,_0x2bb25e[0x0]));if(_0xf5f405[_0x02f2('0x6e')]()){removeReferences(_0x42b2a1,_0x2a1ea0);logger[_0x02f2('0x29')]('Invalid\x20plugin\x20structure');return _0x2d25d4(new Error(_0x02f2('0x6c')));}if(_0xf5f405['isDirectory']()){var _0x8ea750=fs[_0x02f2('0x6b')](path[_0x02f2('0x4c')](_0x2a1ea0,_0x2bb25e[0x0]));if(_0x8ea750['length']===0x0){removeReferences(_0x42b2a1,_0x2a1ea0);logger[_0x02f2('0x29')](_0x02f2('0x6c'));return _0x2d25d4(new Error(_0x02f2('0x6c')));}var _0x2e82a4=_0x8ea750['some'](function(_0x510216){return _0x510216===_0x02f2('0x6f');});if(!_0x2e82a4){return _0x2d25d4(new Error(_0x02f2('0x70')));}var _0x2f1136=fs[_0x02f2('0x71')](path[_0x02f2('0x4c')](_0x2a1ea0,_0x2bb25e[0x0],'manifest.json'));var _0x339a91=JSON[_0x02f2('0x72')](_0x2f1136);if(_0x02f2('0x73')==typeof _0x339a91[_0x02f2('0x2b')]){return _0x2d25d4(new Error(_0x02f2('0x74')));}if('undefined'==typeof _0x339a91[_0x02f2('0x30')]){return _0x2d25d4(new Error(_0x02f2('0x75')));}if('undefined'==typeof _0x339a91[_0x02f2('0x76')]){return _0x2d25d4(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x02f2('0x73')==typeof _0x339a91[_0x02f2('0x77')]){return _0x2d25d4(new Error(_0x02f2('0x78')));}if(_0x339a91[_0x02f2('0x30')]===_0x02f2('0x79')){if(_0x02f2('0x73')==typeof _0x339a91[_0x02f2('0x77')][_0x02f2('0x7a')]){return _0x2d25d4(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x02f2('0x73')==typeof _0x339a91['parameters'][_0x02f2('0x7a')][_0x02f2('0x7b')]&&_0x02f2('0x73')==typeof _0x339a91[_0x02f2('0x77')][_0x02f2('0x7a')][_0x02f2('0x7c')]){return _0x2d25d4(new Error(_0x02f2('0x7d')));}}else if(_0x339a91[_0x02f2('0x30')]===_0x02f2('0x7e')){if(_0x02f2('0x73')==typeof _0x339a91[_0x02f2('0x77')][_0x02f2('0x7f')]){return _0x2d25d4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x02f2('0x73')==typeof _0x339a91['parameters']['scriptPath']){return _0x2d25d4(new Error(_0x02f2('0x80')));}}else{return _0x2d25d4(new Error(_0x02f2('0x81')));}var _0x3bac0e=_0x339a91['name'];var _0x40a9cd=_0x339a91[_0x02f2('0x82')];var _0x266882=_0x339a91['type'];var _0xcd8af0=_0x339a91[_0x02f2('0x83')]?_0x339a91[_0x02f2('0x83')]:'always';var _0xaa04ba=_0x339a91[_0x02f2('0x84')]?_0x339a91[_0x02f2('0x84')]:_0x02f2('0x85');var _0x17b62a='';var _0x46f913='';var _0x5e9c45='';var _0x1a6319='';var _0x19ab97=_0x339a91[_0x02f2('0x76')];if(_0x266882===_0x02f2('0x79')){if(_0x02f2('0x73')!=typeof _0x339a91[_0x02f2('0x77')][_0x02f2('0x7a')]['admin']){var _0x422b59=_0x339a91['parameters'][_0x02f2('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x02f2('0x86')](_0x422b59)){_0x17b62a=path['join'](_0x02f2('0x87'),_0x2ef80a,_0x2bb25e[0x0],_0x422b59);}else{_0x17b62a=_0x422b59;}}else{logger[_0x02f2('0x63')](_0x02f2('0x88'));}if(_0x02f2('0x73')!=typeof _0x339a91[_0x02f2('0x77')]['views'][_0x02f2('0x7c')]){var _0x5ec732=_0x339a91[_0x02f2('0x77')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x02f2('0x86')](_0x5ec732)){_0x46f913=path[_0x02f2('0x4c')]('plugins',_0x2ef80a,_0x2bb25e[0x0],_0x5ec732);}else{_0x46f913=_0x5ec732;}}else{logger[_0x02f2('0x63')](_0x02f2('0x89'));}}else if(_0x266882===_0x02f2('0x7e')){_0x5e9c45=_0x339a91['parameters'][_0x02f2('0x7f')];_0x1a6319=_0x339a91[_0x02f2('0x77')]['scriptPath'];if(_0x02f2('0x73')!=typeof _0x339a91[_0x02f2('0x77')][_0x02f2('0x7a')]){if(_0x02f2('0x73')!=typeof _0x339a91[_0x02f2('0x77')][_0x02f2('0x7a')][_0x02f2('0x7b')]){var _0x422b59=_0x339a91['parameters'][_0x02f2('0x7a')][_0x02f2('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x02f2('0x86')](_0x422b59)){_0x17b62a=path['join'](_0x02f2('0x87'),_0x2ef80a,_0x2bb25e[0x0],_0x422b59);}else{_0x17b62a=_0x422b59;}}if(_0x02f2('0x73')!=typeof _0x339a91['parameters'][_0x02f2('0x7a')]['agent']){var _0x5ec732=_0x339a91[_0x02f2('0x77')][_0x02f2('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x02f2('0x86')](_0x5ec732)){_0x46f913=path['join']('plugins',_0x2ef80a,_0x2bb25e[0x0],_0x5ec732);}else{_0x46f913=_0x5ec732;}}}}var _0x451faf={'name':_0x3bac0e,'description':_0x40a9cd,'path':path['join'](_0x2ef80a,_0x2bb25e[0x0]),'type':_0x266882,'sidebar':_0xcd8af0,'icon':_0xaa04ba,'adminUrl':_0x17b62a,'agentUrl':_0x46f913,'scriptName':_0x5e9c45,'scriptPath':_0x1a6319,'version':_0x19ab97};removeReferences(_0x42b2a1,null);return db[_0x02f2('0x41')]['create'](_0x451faf)[_0x02f2('0x27')](function(_0x55707f){var _0x533769={'role':_0x2ba6df[_0x02f2('0x8a')]['role'],'userProfileId':_0x2ba6df[_0x02f2('0x8a')][_0x02f2('0x8b')]};if(!_0x533769)throw new Error(_0x02f2('0x8c'));if(_0x533769['role']===_0x02f2('0x8d')){var _0x3b6ba3=_0x55707f[_0x02f2('0x8e')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x02f2('0x8f'),'userProfileId':_0x533769[_0x02f2('0x8b')]},'raw':!![]})[_0x02f2('0x27')](function(_0x2e9a13){if(_0x2e9a13&&_0x2e9a13[_0x02f2('0x90')]===0x0){return db[_0x02f2('0x91')]['create']({'name':_0x3b6ba3[_0x02f2('0x2b')],'resourceId':_0x3b6ba3['id'],'type':_0x2e9a13[_0x02f2('0x2b')],'sectionId':_0x2e9a13['id']},{})[_0x02f2('0x27')](function(){return _0x55707f;});}else{return _0x55707f;}})[_0x02f2('0x46')](function(_0x1cf4ee){logger[_0x02f2('0x29')](_0x02f2('0x92'),_0x1cf4ee);throw _0x1cf4ee;});}return _0x55707f;})['then'](respondWithResult(_0x2d5b77,null))[_0x02f2('0x46')](handleError(_0x2d5b77,null));}});}catch(_0x28d553){_0x2d5b77[_0x02f2('0x1c')](0x1f4)['send'](_0x28d553);}};function removeReferences(_0x3be27d,_0x181674){try{if(_0x3be27d){fs[_0x02f2('0x62')](_0x3be27d);logger['info'](_0x02f2('0x93'));}if(_0x181674){rimraf(_0x181674,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x5858db){logger[_0x02f2('0x29')](_0x5858db);}}exports['update']=function(_0x35ece0,_0x3d376c,_0x5e04db){return db[_0x02f2('0x41')][_0x02f2('0x4a')]({'where':{'id':_0x35ece0[_0x02f2('0x48')]['id']}})[_0x02f2('0x27')](handleEntityNotFound(_0x3d376c,null))[_0x02f2('0x27')](saveUpdates(_0x35ece0[_0x02f2('0x8a')],null))[_0x02f2('0x27')](respondWithResult(_0x3d376c,null))[_0x02f2('0x46')](handleError(_0x3d376c,null));};exports[_0x02f2('0x94')]=function(_0x595167,_0x3bd42f,_0x48fda2){return db[_0x02f2('0x41')][_0x02f2('0x4a')]({'where':{'id':_0x595167[_0x02f2('0x48')]['id']}})[_0x02f2('0x27')](function(_0x2897a5){if(_0x2897a5){return _0x2897a5[_0x02f2('0x28')]();}})[_0x02f2('0x27')](function(_0x35224a){rimraf(path[_0x02f2('0x4c')](config[_0x02f2('0x4d')],_0x02f2('0x5a'),path['dirname'](_0x35224a[_0x02f2('0x5b')])),function(){});return _0x35224a;})[_0x02f2('0x27')](handleEntityNotFound(_0x3bd42f,null))['then'](respondWithStatusCode(_0x3bd42f,null))[_0x02f2('0x46')](handleError(_0x3bd42f,null));};exports[_0x02f2('0x95')]=function(_0x51d956,_0x1c977e,_0xf64f8f){return BPromise[_0x02f2('0x96')]()[_0x02f2('0x27')](function(){if(!_0x51d956[_0x02f2('0x33')][_0x02f2('0x5b')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x51d956[_0x02f2('0x33')][_0x02f2('0x97')]){throw new Error(_0x02f2('0x98'));}var _0x2c5b86=_0x51d956[_0x02f2('0x33')][_0x02f2('0x99')]?_0x51d956[_0x02f2('0x33')][_0x02f2('0x99')]+':'+_0x51d956[_0x02f2('0x33')][_0x02f2('0x97')]:_0x02f2('0x9a')+_0x51d956[_0x02f2('0x33')][_0x02f2('0x97')];var _0x41a3ac=_0x51d956['query'][_0x02f2('0x1e')]?_0x51d956[_0x02f2('0x33')][_0x02f2('0x1e')]:!![];var _0x34df28=_0x51d956[_0x02f2('0x33')][_0x02f2('0x9b')]?_0x51d956['query']['encoding']:null;var _0x5d2053={'method':_0x51d956[_0x02f2('0x9c')],'uri':util[_0x02f2('0x4e')](_0x02f2('0x9d'),_0x2c5b86,_0x51d956['query'][_0x02f2('0x5b')]),'json':_0x41a3ac,'resolveWithFullResponse':!![],'encoding':_0x34df28,'qs':_0x51d956[_0x02f2('0x33')]};if(_0x51d956['headers']){_0x5d2053[_0x02f2('0x9e')]=_0x51d956[_0x02f2('0x9e')];if(_0x5d2053['headers'][_0x02f2('0x9f')]){delete _0x5d2053[_0x02f2('0x9e')][_0x02f2('0x9f')];}}if(_0x5d2053[_0x02f2('0x9e')][_0x02f2('0xa0')]){delete _0x5d2053[_0x02f2('0x9e')][_0x02f2('0xa0')];}return rp(_0x5d2053);})[_0x02f2('0x27')](function(_0x2abf85){if(_0x2abf85){_0x1c977e[_0x02f2('0x21')](_0x2abf85[_0x02f2('0x9e')]);logger[_0x02f2('0x63')](_0x2abf85[_0x02f2('0x8a')]);if(_[_0x02f2('0xa1')](_0x51d956['query'][_0x02f2('0x5b')],_0x02f2('0x4b'))&&_0x2abf85[_0x02f2('0xa2')]==0x1f4){return _0x1c977e['sendStatus'](_0x2abf85[_0x02f2('0xa2')]);}else{return _0x1c977e[_0x02f2('0x1c')](_0x2abf85['statusCode'])[_0x02f2('0x2c')](_0x2abf85[_0x02f2('0x8a')]);}}else{return _0x1c977e[_0x02f2('0x1b')](0xc8);}})[_0x02f2('0x46')](handleError(_0x1c977e,null));};exports[_0x02f2('0xa3')]=function(_0x39fa37,_0x339e54,_0x1d3c8b){return BPromise[_0x02f2('0x96')]()['then'](function(){if(!_0x39fa37[_0x02f2('0x33')][_0x02f2('0x5b')]){throw new Error(_0x02f2('0xa4'));}if(!_0x39fa37[_0x02f2('0x33')][_0x02f2('0x97')]){throw new Error(_0x02f2('0x98'));}var _0x2534d2=_0x39fa37[_0x02f2('0x33')][_0x02f2('0x99')]?_0x39fa37[_0x02f2('0x33')]['hostname']+':'+_0x39fa37[_0x02f2('0x33')][_0x02f2('0x97')]:_0x02f2('0x9a')+_0x39fa37[_0x02f2('0x33')][_0x02f2('0x97')];var _0x175d3e=_0x39fa37[_0x02f2('0x33')][_0x02f2('0x1e')]?_0x39fa37[_0x02f2('0x33')][_0x02f2('0x1e')]:!![];var _0x144425=_0x39fa37['query'][_0x02f2('0x9b')]?_0x39fa37[_0x02f2('0x33')][_0x02f2('0x9b')]:null;var _0x3f9224={'method':_0x39fa37['method'],'uri':util[_0x02f2('0x4e')]('%s%s',_0x2534d2,_0x39fa37[_0x02f2('0x33')]['path']),'json':_0x175d3e,'resolveWithFullResponse':!![],'encoding':_0x144425,'body':_0x39fa37[_0x02f2('0x8a')]};if(_0x39fa37[_0x02f2('0x9e')]){_0x3f9224['headers']=_0x39fa37[_0x02f2('0x9e')];if(_0x3f9224[_0x02f2('0x9e')][_0x02f2('0x9f')]){delete _0x3f9224[_0x02f2('0x9e')]['content-length'];}}if(_0x3f9224['headers'][_0x02f2('0xa0')]){delete _0x3f9224[_0x02f2('0x9e')][_0x02f2('0xa0')];}return rp(_0x3f9224);})[_0x02f2('0x27')](function(_0x36a078){if(_0x36a078){_0x339e54[_0x02f2('0x21')](_0x36a078[_0x02f2('0x9e')]);logger[_0x02f2('0x63')](_0x36a078['body']);return _0x339e54['status'](_0x36a078[_0x02f2('0xa2')])['send'](_0x36a078[_0x02f2('0x8a')]);}else{return _0x339e54[_0x02f2('0x1b')](0xc8);}})[_0x02f2('0x46')](handleError(_0x339e54,null));}; \ No newline at end of file +var _0x0a75=['UserProfileResource','error','stack','name','send','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','Plugin','count','includeAll','include','findAll','rows','catch','show','params','download','find','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','version','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-type','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','content-length','html-pdf','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Plugins'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0a75,0x80));var _0x50a7=function(_0x59b4da,_0x1af4ab){_0x59b4da=_0x59b4da-0x0;var _0x56b5e9=_0x0a75[_0x59b4da];return _0x56b5e9;};'use strict';var pdf=require(_0x50a7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50a7('0x1'));var moment=require(_0x50a7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x50a7('0x3'));var util=require(_0x50a7('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x50a7('0x5'));var ejs=require(_0x50a7('0x6'));var fs=require('fs');var _=require(_0x50a7('0x7'));var squel=require(_0x50a7('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x50a7('0x9'));var toCsv=require(_0x50a7('0x5'));var querystring=require('querystring');var Papa=require(_0x50a7('0xa'));var extract=require(_0x50a7('0xb'));var rimraf=require('rimraf');var archiver=require(_0x50a7('0xc'));var Redis=require(_0x50a7('0xd'));var authService=require(_0x50a7('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x50a7('0xf'));var utils=require(_0x50a7('0x10'));var config=require(_0x50a7('0x11'));var db=require(_0x50a7('0x12'))['db'];config[_0x50a7('0x13')]=_[_0x50a7('0x14')](config[_0x50a7('0x13')],{'host':_0x50a7('0x15'),'port':0x18eb});var socket=require(_0x50a7('0x16'))(new Redis(config['redis']));require(_0x50a7('0x17'))[_0x50a7('0x18')](socket);function respondWithStatusCode(_0x2cbc27,_0x1e3a69){_0x1e3a69=_0x1e3a69||0xcc;return function(_0x530eba){if(_0x530eba){return _0x2cbc27[_0x50a7('0x19')](_0x1e3a69);}return _0x2cbc27[_0x50a7('0x1a')](_0x1e3a69)[_0x50a7('0x1b')]();};}function respondWithResult(_0x3cea17,_0x5d3ddb){_0x5d3ddb=_0x5d3ddb||0xc8;return function(_0x177a5f){if(_0x177a5f){return _0x3cea17[_0x50a7('0x1a')](_0x5d3ddb)['json'](_0x177a5f);}};}function respondWithFilteredResult(_0x1335b5,_0x1a4fb7){return function(_0x27a04e){if(_0x27a04e){var _0x5e3d8c=_0x27a04e['count'],_0x165129=_0x1a4fb7['offset'],_0x41221d=_0x1a4fb7[_0x50a7('0x1c')]+_0x1a4fb7[_0x50a7('0x1d')],_0x58698c;if(_0x41221d>=_0x5e3d8c){_0x41221d=_0x5e3d8c;_0x58698c=0xc8;}else{_0x58698c=0xce;}_0x1335b5[_0x50a7('0x1a')](_0x58698c);return _0x1335b5['set'](_0x50a7('0x1e'),_0x165129+'-'+_0x41221d+'/'+_0x5e3d8c)[_0x50a7('0x1f')](_0x27a04e);}return null;};}function patchUpdates(_0x2795e7){return function(_0x3a11c7){try{jsonpatch[_0x50a7('0x20')](_0x3a11c7,_0x2795e7,!![]);}catch(_0x1146f2){return BPromise[_0x50a7('0x21')](_0x1146f2);}return _0x3a11c7[_0x50a7('0x22')]();};}function saveUpdates(_0x58c6f9,_0x162c71){return function(_0x313b11){if(_0x313b11){return _0x313b11[_0x50a7('0x23')](_0x58c6f9)[_0x50a7('0x24')](function(_0x51e3cf){return _0x51e3cf;});}return null;};}function removeEntity(_0x514b3d,_0x288b75){return function(_0x52a7fc){if(_0x52a7fc){return _0x52a7fc[_0x50a7('0x25')]()[_0x50a7('0x24')](function(){var _0x3e68c5=_0x52a7fc[_0x50a7('0x26')]({'plain':!![]});var _0x5aff8c=_0x50a7('0x27');return db[_0x50a7('0x28')][_0x50a7('0x25')]({'where':{'type':_0x5aff8c,'resourceId':_0x3e68c5['id']}})[_0x50a7('0x24')](function(){return _0x52a7fc;});})['then'](function(){_0x514b3d[_0x50a7('0x1a')](0xcc)[_0x50a7('0x1b')]();});}};}function handleEntityNotFound(_0x5ea7c5,_0x2d6e43){return function(_0x1b3a96){if(!_0x1b3a96){_0x5ea7c5[_0x50a7('0x19')](0x194);}return _0x1b3a96;};}function handleError(_0x2964ed,_0xc40e74){_0xc40e74=_0xc40e74||0x1f4;return function(_0x18d7ce){logger[_0x50a7('0x29')](_0x18d7ce[_0x50a7('0x2a')]);if(_0x18d7ce[_0x50a7('0x2b')]){delete _0x18d7ce[_0x50a7('0x2b')];}_0x2964ed[_0x50a7('0x1a')](_0xc40e74)[_0x50a7('0x2c')](_0x18d7ce);};}exports['index']=function(_0x5ae55d,_0x3c6dda){var _0x376906={},_0x39bdb2={},_0x5e2800={'count':0x0,'rows':[]};var _0x26fb2c=_['map'](db['Plugin'][_0x50a7('0x2d')],function(_0x5abbd4){return{'name':_0x5abbd4['fieldName'],'type':_0x5abbd4[_0x50a7('0x2e')]['key']};});_0x39bdb2[_0x50a7('0x2f')]=_[_0x50a7('0x30')](_0x26fb2c,_0x50a7('0x2b'));_0x39bdb2[_0x50a7('0x31')]=_[_0x50a7('0x32')](_0x5ae55d['query']);_0x39bdb2[_0x50a7('0x33')]=_[_0x50a7('0x34')](_0x39bdb2['model'],_0x39bdb2[_0x50a7('0x31')]);_0x376906['attributes']=_[_0x50a7('0x34')](_0x39bdb2[_0x50a7('0x2f')],qs['fields'](_0x5ae55d['query'][_0x50a7('0x35')]));_0x376906[_0x50a7('0x36')]=_0x376906[_0x50a7('0x36')][_0x50a7('0x37')]?_0x376906[_0x50a7('0x36')]:_0x39bdb2[_0x50a7('0x2f')];if(!_0x5ae55d[_0x50a7('0x31')][_0x50a7('0x38')](_0x50a7('0x39'))){_0x376906[_0x50a7('0x1d')]=qs[_0x50a7('0x1d')](_0x5ae55d[_0x50a7('0x31')][_0x50a7('0x1d')]);_0x376906['offset']=qs['offset'](_0x5ae55d['query'][_0x50a7('0x1c')]);}_0x376906[_0x50a7('0x3a')]=qs['sort'](_0x5ae55d[_0x50a7('0x31')]['sort']);_0x376906[_0x50a7('0x3b')]=qs[_0x50a7('0x33')](_[_0x50a7('0x3c')](_0x5ae55d['query'],_0x39bdb2[_0x50a7('0x33')]),_0x26fb2c);if(_0x5ae55d[_0x50a7('0x31')]['filter']){_0x376906[_0x50a7('0x3b')]=_[_0x50a7('0x3d')](_0x376906[_0x50a7('0x3b')],{'$or':_[_0x50a7('0x30')](_0x26fb2c,function(_0x2600d0){if(_0x2600d0['type']!==_0x50a7('0x3e')){var _0x207334={};_0x207334[_0x2600d0['name']]={'$like':'%'+_0x5ae55d[_0x50a7('0x31')]['filter']+'%'};return _0x207334;}})});}_0x376906=_[_0x50a7('0x3d')]({},_0x376906,_0x5ae55d[_0x50a7('0x3f')]);var _0x3cecdd={'where':_0x376906['where']};return db[_0x50a7('0x40')]['count'](_0x3cecdd)[_0x50a7('0x24')](function(_0x371ca8){_0x5e2800[_0x50a7('0x41')]=_0x371ca8;if(_0x5ae55d['query'][_0x50a7('0x42')]){_0x376906[_0x50a7('0x43')]=[{'all':!![]}];}return db[_0x50a7('0x40')][_0x50a7('0x44')](_0x376906);})[_0x50a7('0x24')](function(_0x5101c2){_0x5e2800[_0x50a7('0x45')]=_0x5101c2;return _0x5e2800;})[_0x50a7('0x24')](respondWithFilteredResult(_0x3c6dda,_0x376906))[_0x50a7('0x46')](handleError(_0x3c6dda,null));};exports[_0x50a7('0x47')]=function(_0x35a955,_0x8c789f){var _0x42bcca={'raw':!![],'where':{'id':_0x35a955[_0x50a7('0x48')]['id']}},_0x488ce6={};_0x488ce6[_0x50a7('0x2f')]=_[_0x50a7('0x32')](db[_0x50a7('0x40')][_0x50a7('0x2d')]);_0x488ce6['query']=_[_0x50a7('0x32')](_0x35a955[_0x50a7('0x31')]);_0x488ce6[_0x50a7('0x33')]=_[_0x50a7('0x34')](_0x488ce6['model'],_0x488ce6[_0x50a7('0x31')]);_0x42bcca[_0x50a7('0x36')]=_[_0x50a7('0x34')](_0x488ce6[_0x50a7('0x2f')],qs[_0x50a7('0x35')](_0x35a955[_0x50a7('0x31')][_0x50a7('0x35')]));_0x42bcca[_0x50a7('0x36')]=_0x42bcca[_0x50a7('0x36')][_0x50a7('0x37')]?_0x42bcca[_0x50a7('0x36')]:_0x488ce6[_0x50a7('0x2f')];if(_0x35a955[_0x50a7('0x31')][_0x50a7('0x42')]){_0x42bcca[_0x50a7('0x43')]=[{'all':!![]}];}_0x42bcca=_[_0x50a7('0x3d')]({},_0x42bcca,_0x35a955[_0x50a7('0x3f')]);return db['Plugin']['find'](_0x42bcca)[_0x50a7('0x24')](handleEntityNotFound(_0x8c789f,null))[_0x50a7('0x24')](respondWithResult(_0x8c789f,null))['catch'](handleError(_0x8c789f,null));};exports[_0x50a7('0x49')]=function(_0x3817da,_0x3a4907,_0x4e1ccf){return db[_0x50a7('0x40')][_0x50a7('0x4a')]({'where':{'id':_0x3817da[_0x50a7('0x48')]['id']},'attributes':[_0x50a7('0x2b'),_0x50a7('0x4b')],'raw':!![]})[_0x50a7('0x24')](handleEntityNotFound(_0x3a4907,null))['then'](function(_0x4e24fb){if(_0x4e24fb){var _0x199ec6=path[_0x50a7('0x4c')](config[_0x50a7('0x4d')],_0x50a7('0x4e'),util[_0x50a7('0x4f')](_0x50a7('0x50'),path[_0x50a7('0x51')](_0x4e24fb[_0x50a7('0x4b')])));var _0xeae4b9=fs[_0x50a7('0x52')](_0x199ec6);var _0x687bc0=archiver(_0x50a7('0x53'),{'zlib':{'level':0x9}});_0x687bc0['on']('warning',function(_0x2c02b5){if(_0x2c02b5[_0x50a7('0x54')]===_0x50a7('0x55')){logger[_0x50a7('0x29')](_0x2c02b5);}else{throw new db[(_0x50a7('0x56'))][(_0x50a7('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x687bc0['on'](_0x50a7('0x29'),function(_0x3928e7){throw new db[(_0x50a7('0x56'))][(_0x50a7('0x57'))](_0x50a7('0x58'));});_0x687bc0['pipe'](_0xeae4b9);_0x687bc0[_0x50a7('0x59')](_0x50a7('0x5a'),{'cwd':path[_0x50a7('0x4c')](config[_0x50a7('0x4d')],_0x50a7('0x4e'),path['dirname'](_0x4e24fb[_0x50a7('0x4b')])),'ignore':[path[_0x50a7('0x4c')](path[_0x50a7('0x51')](_0x4e24fb[_0x50a7('0x4b')]),_0x50a7('0x5b')),path[_0x50a7('0x4c')](path['basename'](_0x4e24fb['path']),_0x50a7('0x5c'))],'nodir':!![]})[_0x50a7('0x5d')]();_0xeae4b9['on']('close',function(){if(!fs[_0x50a7('0x5e')](_0x199ec6)){throw new db[(_0x50a7('0x56'))][(_0x50a7('0x57'))](_0x50a7('0x5f'));}return _0x3a4907['download'](_0x199ec6,util[_0x50a7('0x4f')](_0x50a7('0x50'),path[_0x50a7('0x51')](_0x4e24fb[_0x50a7('0x4b')])),function(_0x37b2c9){if(_0x37b2c9){throw new db['Sequelize'][(_0x50a7('0x57'))](_0x50a7('0x60'));}fs['unlinkSync'](_0x199ec6);logger[_0x50a7('0x61')](_0x50a7('0x62'));logger[_0x50a7('0x61')](_0x50a7('0x63'));});});}return null;})[_0x50a7('0x46')](handleError(_0x3a4907,null));};exports[_0x50a7('0x64')]=function(_0x3d5c10,_0x377b75,_0x1ed405){var _0x46229e=path[_0x50a7('0x51')](_0x3d5c10[_0x50a7('0x65')]['filename'],path['extname'](_0x3d5c10['file'][_0x50a7('0x66')]));var _0x41b46c=path[_0x50a7('0x4c')](config[_0x50a7('0x4d')],_0x50a7('0x4e'),_0x3d5c10[_0x50a7('0x65')][_0x50a7('0x66')]);var _0x3829a8=path[_0x50a7('0x4c')](config[_0x50a7('0x4d')],_0x50a7('0x4e'),_0x46229e);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x41b46c);logger[_0x50a7('0x61')]('Plugin\x20upload\x20destination:\x20%s',_0x3829a8);try{fs[_0x50a7('0x67')](_0x41b46c,parseInt(_0x50a7('0x68'),0x8));extract(_0x41b46c,{'dir':_0x3829a8},function(_0x1501d4){if(_0x1501d4){logger[_0x50a7('0x29')](_0x1501d4);handleError(_0x1501d4,!![]);};var _0x3b89d1=fs[_0x50a7('0x69')](_0x3829a8);if(_0x3b89d1[_0x50a7('0x37')]>0x1){removeReferences(_0x41b46c,_0x3829a8);logger[_0x50a7('0x29')]('Invalid\x20plugin\x20structure');return _0x1ed405(new Error(_0x50a7('0x6a')));}var _0x1d2a1c=fs[_0x50a7('0x6b')](path['join'](_0x3829a8,_0x3b89d1[0x0]));if(_0x1d2a1c[_0x50a7('0x6c')]()){removeReferences(_0x41b46c,_0x3829a8);logger[_0x50a7('0x29')](_0x50a7('0x6a'));return _0x1ed405(new Error(_0x50a7('0x6a')));}if(_0x1d2a1c['isDirectory']()){var _0x8146a9=fs['readdirSync'](path[_0x50a7('0x4c')](_0x3829a8,_0x3b89d1[0x0]));if(_0x8146a9[_0x50a7('0x37')]===0x0){removeReferences(_0x41b46c,_0x3829a8);logger[_0x50a7('0x29')](_0x50a7('0x6a'));return _0x1ed405(new Error(_0x50a7('0x6a')));}var _0x5675cf=_0x8146a9[_0x50a7('0x6d')](function(_0x330f1b){return _0x330f1b===_0x50a7('0x6e');});if(!_0x5675cf){return _0x1ed405(new Error(_0x50a7('0x6f')));}var _0x17669c=fs[_0x50a7('0x70')](path[_0x50a7('0x4c')](_0x3829a8,_0x3b89d1[0x0],'manifest.json'));var _0x10020c=JSON[_0x50a7('0x71')](_0x17669c);if(_0x50a7('0x72')==typeof _0x10020c[_0x50a7('0x2b')]){return _0x1ed405(new Error(_0x50a7('0x73')));}if(_0x50a7('0x72')==typeof _0x10020c[_0x50a7('0x2e')]){return _0x1ed405(new Error(_0x50a7('0x74')));}if(_0x50a7('0x72')==typeof _0x10020c['version']){return _0x1ed405(new Error(_0x50a7('0x75')));}if(_0x50a7('0x72')==typeof _0x10020c[_0x50a7('0x76')]){return _0x1ed405(new Error(_0x50a7('0x77')));}if(_0x10020c[_0x50a7('0x2e')]===_0x50a7('0x78')){if('undefined'==typeof _0x10020c[_0x50a7('0x76')][_0x50a7('0x79')]){return _0x1ed405(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x50a7('0x72')==typeof _0x10020c[_0x50a7('0x76')][_0x50a7('0x79')][_0x50a7('0x7a')]&&'undefined'==typeof _0x10020c['parameters'][_0x50a7('0x79')][_0x50a7('0x7b')]){return _0x1ed405(new Error(_0x50a7('0x7c')));}}else if(_0x10020c[_0x50a7('0x2e')]===_0x50a7('0x7d')){if(_0x50a7('0x72')==typeof _0x10020c['parameters']['scriptName']){return _0x1ed405(new Error(_0x50a7('0x7e')));}if(_0x50a7('0x72')==typeof _0x10020c['parameters'][_0x50a7('0x7f')]){return _0x1ed405(new Error(_0x50a7('0x80')));}}else{return _0x1ed405(new Error(_0x50a7('0x81')));}var _0x3b0871=_0x10020c[_0x50a7('0x2b')];var _0x2f4437=_0x10020c[_0x50a7('0x82')];var _0x3675d9=_0x10020c[_0x50a7('0x2e')];var _0x595eab=_0x10020c[_0x50a7('0x83')]?_0x10020c[_0x50a7('0x83')]:_0x50a7('0x84');var _0x165f64=_0x10020c[_0x50a7('0x85')]?_0x10020c[_0x50a7('0x85')]:'icon-apps';var _0x41fc77='';var _0x4a94da='';var _0x18af51='';var _0x33df7d='';var _0x1b94f1=_0x10020c[_0x50a7('0x86')];if(_0x3675d9==='html'){if(_0x50a7('0x72')!=typeof _0x10020c[_0x50a7('0x76')][_0x50a7('0x79')][_0x50a7('0x7a')]){var _0x1abf1e=_0x10020c[_0x50a7('0x76')][_0x50a7('0x79')][_0x50a7('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x50a7('0x87')](_0x1abf1e)){_0x41fc77=path[_0x50a7('0x4c')](_0x50a7('0x88'),_0x46229e,_0x3b89d1[0x0],_0x1abf1e);}else{_0x41fc77=_0x1abf1e;}}else{logger[_0x50a7('0x61')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x50a7('0x72')!=typeof _0x10020c[_0x50a7('0x76')]['views']['agent']){var _0x2a59d3=_0x10020c[_0x50a7('0x76')]['views'][_0x50a7('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x50a7('0x87')](_0x2a59d3)){_0x4a94da=path['join'](_0x50a7('0x88'),_0x46229e,_0x3b89d1[0x0],_0x2a59d3);}else{_0x4a94da=_0x2a59d3;}}else{logger[_0x50a7('0x61')](_0x50a7('0x89'));}}else if(_0x3675d9===_0x50a7('0x7d')){_0x18af51=_0x10020c[_0x50a7('0x76')][_0x50a7('0x8a')];_0x33df7d=_0x10020c[_0x50a7('0x76')][_0x50a7('0x7f')];if(_0x50a7('0x72')!=typeof _0x10020c[_0x50a7('0x76')][_0x50a7('0x79')]){if('undefined'!=typeof _0x10020c[_0x50a7('0x76')][_0x50a7('0x79')][_0x50a7('0x7a')]){var _0x1abf1e=_0x10020c[_0x50a7('0x76')][_0x50a7('0x79')][_0x50a7('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x50a7('0x87')](_0x1abf1e)){_0x41fc77=path[_0x50a7('0x4c')](_0x50a7('0x88'),_0x46229e,_0x3b89d1[0x0],_0x1abf1e);}else{_0x41fc77=_0x1abf1e;}}if(_0x50a7('0x72')!=typeof _0x10020c[_0x50a7('0x76')]['views']['agent']){var _0x2a59d3=_0x10020c[_0x50a7('0x76')][_0x50a7('0x79')][_0x50a7('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x50a7('0x87')](_0x2a59d3)){_0x4a94da=path[_0x50a7('0x4c')](_0x50a7('0x88'),_0x46229e,_0x3b89d1[0x0],_0x2a59d3);}else{_0x4a94da=_0x2a59d3;}}}}var _0x54727d={'name':_0x3b0871,'description':_0x2f4437,'path':path[_0x50a7('0x4c')](_0x46229e,_0x3b89d1[0x0]),'type':_0x3675d9,'sidebar':_0x595eab,'icon':_0x165f64,'adminUrl':_0x41fc77,'agentUrl':_0x4a94da,'scriptName':_0x18af51,'scriptPath':_0x33df7d,'version':_0x1b94f1};removeReferences(_0x41b46c,null);return db[_0x50a7('0x40')][_0x50a7('0x8b')](_0x54727d)[_0x50a7('0x24')](function(_0x2d34a8){var _0x28befb={'role':_0x3d5c10['body'][_0x50a7('0x8c')],'userProfileId':_0x3d5c10[_0x50a7('0x8d')]['userProfileId']};if(!_0x28befb)throw new Error(_0x50a7('0x8e'));if(_0x28befb['role']===_0x50a7('0x8f')){var _0x54c163=_0x2d34a8['get']({'plain':!![]});return db[_0x50a7('0x90')][_0x50a7('0x4a')]({'where':{'name':_0x50a7('0x27'),'userProfileId':_0x28befb[_0x50a7('0x91')]},'raw':!![]})[_0x50a7('0x24')](function(_0x431cfe){if(_0x431cfe&&_0x431cfe[_0x50a7('0x92')]===0x0){return db[_0x50a7('0x28')]['create']({'name':_0x54c163[_0x50a7('0x2b')],'resourceId':_0x54c163['id'],'type':_0x431cfe[_0x50a7('0x2b')],'sectionId':_0x431cfe['id']},{})['then'](function(){return _0x2d34a8;});}else{return _0x2d34a8;}})[_0x50a7('0x46')](function(_0xb329e4){logger['error'](_0x50a7('0x93'),_0xb329e4);throw _0xb329e4;});}return _0x2d34a8;})[_0x50a7('0x24')](respondWithResult(_0x377b75,null))[_0x50a7('0x46')](handleError(_0x377b75,null));}});}catch(_0x2fc37c){_0x377b75['status'](0x1f4)['send'](_0x2fc37c);}};function removeReferences(_0x452246,_0x2803c6){try{if(_0x452246){fs[_0x50a7('0x94')](_0x452246);logger[_0x50a7('0x61')](_0x50a7('0x95'));}if(_0x2803c6){rimraf(_0x2803c6,function(){});logger[_0x50a7('0x61')](_0x50a7('0x96'));}}catch(_0xa1e87e){logger[_0x50a7('0x29')](_0xa1e87e);}}exports[_0x50a7('0x23')]=function(_0x2c001c,_0x13d27a,_0x2837d4){return db['Plugin'][_0x50a7('0x4a')]({'where':{'id':_0x2c001c[_0x50a7('0x48')]['id']}})[_0x50a7('0x24')](handleEntityNotFound(_0x13d27a,null))[_0x50a7('0x24')](saveUpdates(_0x2c001c[_0x50a7('0x8d')],null))[_0x50a7('0x24')](respondWithResult(_0x13d27a,null))[_0x50a7('0x46')](handleError(_0x13d27a,null));};exports['delete']=function(_0xcd54b0,_0x15c6c5,_0x27271f){return db[_0x50a7('0x40')][_0x50a7('0x4a')]({'where':{'id':_0xcd54b0[_0x50a7('0x48')]['id']}})[_0x50a7('0x24')](function(_0x56d675){if(_0x56d675){return _0x56d675[_0x50a7('0x25')]();}})['then'](function(_0x56f876){rimraf(path[_0x50a7('0x4c')](config['root'],_0x50a7('0x4e'),path['dirname'](_0x56f876[_0x50a7('0x4b')])),function(){});return _0x56f876;})[_0x50a7('0x24')](handleEntityNotFound(_0x15c6c5,null))[_0x50a7('0x24')](respondWithStatusCode(_0x15c6c5,null))[_0x50a7('0x46')](handleError(_0x15c6c5,null));};exports[_0x50a7('0x97')]=function(_0x853a3f,_0x10f402,_0x376f75){return BPromise[_0x50a7('0x98')]()['then'](function(){if(!_0x853a3f['query'][_0x50a7('0x4b')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x853a3f['query'][_0x50a7('0x99')]){throw new Error(_0x50a7('0x9a'));}var _0x20bc6d=_0x853a3f[_0x50a7('0x31')][_0x50a7('0x9b')]?_0x853a3f['query'][_0x50a7('0x9b')]+':'+_0x853a3f['query'][_0x50a7('0x99')]:_0x50a7('0x9c')+_0x853a3f[_0x50a7('0x31')][_0x50a7('0x99')];var _0x51a609=_0x853a3f[_0x50a7('0x31')]['json']?_0x853a3f[_0x50a7('0x31')][_0x50a7('0x1f')]:!![];var _0x43f655=_0x853a3f[_0x50a7('0x31')]['encoding']?_0x853a3f[_0x50a7('0x31')][_0x50a7('0x9d')]:null;var _0x3bdf1d={'method':_0x853a3f['method'],'uri':util['format'](_0x50a7('0x9e'),_0x20bc6d,_0x853a3f[_0x50a7('0x31')][_0x50a7('0x4b')]),'json':_0x51a609,'resolveWithFullResponse':!![],'encoding':_0x43f655,'qs':_0x853a3f[_0x50a7('0x31')]};if(_0x853a3f[_0x50a7('0x9f')]){_0x3bdf1d[_0x50a7('0x9f')]=_0x853a3f[_0x50a7('0x9f')];if(_0x3bdf1d['headers']['content-length']){delete _0x3bdf1d[_0x50a7('0x9f')]['content-length'];}}if(_0x3bdf1d['headers']['content-type']){delete _0x3bdf1d['headers'][_0x50a7('0xa0')];}return rp(_0x3bdf1d);})[_0x50a7('0x24')](function(_0x47dcca){if(_0x47dcca){_0x10f402[_0x50a7('0xa1')](_0x47dcca[_0x50a7('0x9f')]);logger['info'](_0x47dcca[_0x50a7('0x8d')]);if(_[_0x50a7('0xa2')](_0x853a3f[_0x50a7('0x31')][_0x50a7('0x4b')],_0x50a7('0x49'))&&_0x47dcca[_0x50a7('0xa3')]==0x1f4){return _0x10f402[_0x50a7('0x19')](_0x47dcca[_0x50a7('0xa3')]);}else{return _0x10f402[_0x50a7('0x1a')](_0x47dcca['statusCode'])[_0x50a7('0x2c')](_0x47dcca['body']);}}else{return _0x10f402[_0x50a7('0x19')](0xc8);}})[_0x50a7('0x46')](handleError(_0x10f402,null));};exports[_0x50a7('0xa4')]=function(_0x11e0d0,_0x1f5645,_0x8260b9){return BPromise[_0x50a7('0x98')]()[_0x50a7('0x24')](function(){if(!_0x11e0d0[_0x50a7('0x31')][_0x50a7('0x4b')]){throw new Error(_0x50a7('0xa5'));}if(!_0x11e0d0[_0x50a7('0x31')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xde70f2=_0x11e0d0[_0x50a7('0x31')]['hostname']?_0x11e0d0[_0x50a7('0x31')][_0x50a7('0x9b')]+':'+_0x11e0d0['query'][_0x50a7('0x99')]:'http://localhost:'+_0x11e0d0[_0x50a7('0x31')][_0x50a7('0x99')];var _0x23c6bc=_0x11e0d0['query'][_0x50a7('0x1f')]?_0x11e0d0[_0x50a7('0x31')][_0x50a7('0x1f')]:!![];var _0x3a7b9e=_0x11e0d0[_0x50a7('0x31')][_0x50a7('0x9d')]?_0x11e0d0[_0x50a7('0x31')][_0x50a7('0x9d')]:null;var _0xd4058d={'method':_0x11e0d0[_0x50a7('0xa6')],'uri':util[_0x50a7('0x4f')](_0x50a7('0x9e'),_0xde70f2,_0x11e0d0[_0x50a7('0x31')][_0x50a7('0x4b')]),'json':_0x23c6bc,'resolveWithFullResponse':!![],'encoding':_0x3a7b9e,'body':_0x11e0d0[_0x50a7('0x8d')]};if(_0x11e0d0[_0x50a7('0x9f')]){_0xd4058d[_0x50a7('0x9f')]=_0x11e0d0[_0x50a7('0x9f')];if(_0xd4058d[_0x50a7('0x9f')][_0x50a7('0xa7')]){delete _0xd4058d[_0x50a7('0x9f')][_0x50a7('0xa7')];}}if(_0xd4058d[_0x50a7('0x9f')]['content-type']){delete _0xd4058d[_0x50a7('0x9f')][_0x50a7('0xa0')];}return rp(_0xd4058d);})[_0x50a7('0x24')](function(_0x102b23){if(_0x102b23){_0x1f5645[_0x50a7('0xa1')](_0x102b23[_0x50a7('0x9f')]);logger[_0x50a7('0x61')](_0x102b23['body']);return _0x1f5645[_0x50a7('0x1a')](_0x102b23[_0x50a7('0xa3')])[_0x50a7('0x2c')](_0x102b23[_0x50a7('0x8d')]);}else{return _0x1f5645[_0x50a7('0x19')](0xc8);}})[_0x50a7('0x46')](handleError(_0x1f5645,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5d19a3b..50f0c41 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 _0x4e2e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin'];(function(_0x14e64c,_0x42fda9){var _0x4720aa=function(_0x41a3a7){while(--_0x41a3a7){_0x14e64c['push'](_0x14e64c['shift']());}};_0x4720aa(++_0x42fda9);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2a7438,_0x13a636){_0x2a7438=_0x2a7438-0x0;var _0x4e17ce=_0x4e2e[_0x2a7438];return _0x4e17ce;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xe4e2('0x0'))['db'][_0xe4e2('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xe4e2('0x2')](0x0);var events={'afterCreate':_0xe4e2('0x3'),'afterUpdate':_0xe4e2('0x4'),'afterDestroy':_0xe4e2('0x5')};function emitEvent(_0x4cd23a){return function(_0xfd2203,_0x417dd4,_0x2fb128){PluginEvents[_0xe4e2('0x6')](_0x4cd23a+':'+_0xfd2203['id'],_0xfd2203);PluginEvents['emit'](_0x4cd23a,_0xfd2203);_0x2fb128(null);};}for(var e in events){if(events[_0xe4e2('0x7')](e)){var event=events[e];Plugin[_0xe4e2('0x8')](e,emitEvent(event));}}module[_0xe4e2('0x9')]=PluginEvents; \ No newline at end of file +var _0x4b17=['Plugin','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x10951c,_0x24e4ea){var _0x3c9f81=function(_0x47fbc6){while(--_0x47fbc6){_0x10951c['push'](_0x10951c['shift']());}};_0x3c9f81(++_0x24e4ea);}(_0x4b17,0x10f));var _0x74b1=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x4b17[_0x2605dc];return _0x4568c9;};'use strict';var EventEmitter=require(_0x74b1('0x0'));var Plugin=require('../../mysqldb')['db'][_0x74b1('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x74b1('0x2'),'afterUpdate':_0x74b1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x17689a){return function(_0x4f206f,_0x4fdea2,_0x7b3c36){PluginEvents[_0x74b1('0x4')](_0x17689a+':'+_0x4f206f['id'],_0x4f206f);PluginEvents[_0x74b1('0x4')](_0x17689a,_0x4f206f);_0x7b3c36(null);};}for(var e in events){if(events[_0x74b1('0x5')](e)){var event=events[e];Plugin[_0x74b1('0x6')](e,emitEvent(event));}}module[_0x74b1('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 8c09444..aa56daf 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 _0xb458=['path','rimraf','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x3efde9,_0x372b0a){var _0x355d29=function(_0x1da56c){while(--_0x1da56c){_0x3efde9['push'](_0x3efde9['shift']());}};_0x355d29(++_0x372b0a);}(_0xb458,0x103));var _0x8b45=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0xb458[_0x4b9dc9];return _0x57b302;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var fs=require('fs');var path=require(_0x8b45('0x5'));var rimraf=require(_0x8b45('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b45('0x7'));module['exports']=function(_0x5cc2d5,_0xe8d774){return _0x5cc2d5[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['plugins','util','../../config/logger','api','bluebird','path','rimraf','./plugin.attributes','exports','define','Plugin'];(function(_0x4e5e9c,_0x2f0cce){var _0x5e62de=function(_0x3c079a){while(--_0x3c079a){_0x4e5e9c['push'](_0x4e5e9c['shift']());}};_0x5e62de(++_0x2f0cce);}(_0x038b,0x114));var _0xb038=function(_0x33b0bb,_0x1d38ac){_0x33b0bb=_0x33b0bb-0x0;var _0x4d61e2=_0x038b[_0x33b0bb];return _0x4d61e2;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index ed3139c..fe370b0 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 _0x73d1=['http','redis','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x27d015,_0x40b348){var _0xddbce0=function(_0x110d79){while(--_0x110d79){_0x27d015['push'](_0x27d015['shift']());}};_0xddbce0(++_0x40b348);}(_0x73d1,0xb2));var _0x173d=function(_0x3c29f0,_0x3092ba){_0x3c29f0=_0x3c29f0-0x0;var _0x5d2809=_0x73d1[_0x3c29f0];return _0x5d2809;};'use strict';var _=require('lodash');var util=require(_0x173d('0x0'));var moment=require(_0x173d('0x1'));var BPromise=require(_0x173d('0x2'));var rs=require(_0x173d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x173d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x173d('0x5'));var config=require(_0x173d('0x6'));var jayson=require(_0x173d('0x7'));var client=jayson['client'][_0x173d('0x8')]({'port':0x232a});config[_0x173d('0x9')]=_['defaults'](config[_0x173d('0x9')],{'host':_0x173d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x173d('0x9')]));require('./plugin.socket')[_0x173d('0xb')](socket);function respondWithRpcPromise(_0x51e291,_0x5a1e96,_0x4727a9){return new BPromise(function(_0x4ca32b,_0x8f7cdc){return client[_0x173d('0xc')](_0x51e291,_0x4727a9)[_0x173d('0xd')](function(_0x5a8910){logger[_0x173d('0xe')](_0x173d('0xf'),_0x5a1e96,_0x173d('0x10'));logger[_0x173d('0x11')](_0x173d('0x12'),_0x5a1e96,_0x173d('0x10'),JSON[_0x173d('0x13')](_0x5a8910));if(_0x5a8910['error']){if(_0x5a8910[_0x173d('0x14')][_0x173d('0x15')]===0x1f4){logger[_0x173d('0x14')](_0x173d('0xf'),_0x5a1e96,_0x5a8910[_0x173d('0x14')][_0x173d('0x16')]);return _0x8f7cdc(_0x5a8910['error'][_0x173d('0x16')]);}logger[_0x173d('0x14')]('Plugin,\x20%s,\x20%s',_0x5a1e96,_0x5a8910[_0x173d('0x14')]['message']);return _0x4ca32b(_0x5a8910['error'][_0x173d('0x16')]);}else{logger[_0x173d('0xe')]('Plugin,\x20%s,\x20%s',_0x5a1e96,_0x173d('0x10'));_0x4ca32b(_0x5a8910[_0x173d('0x17')]['message']);}})[_0x173d('0x18')](function(_0x3cf400){logger[_0x173d('0x14')](_0x173d('0xf'),_0x5a1e96,_0x3cf400);_0x8f7cdc(_0x3cf400);});});}exports[_0x173d('0x19')]=function(_0x588de3){var _0x41ab4a=this;return new Promise(function(_0x2dd1f7,_0x29a57d){return db[_0x173d('0x1a')][_0x173d('0x1b')](_0x588de3[_0x173d('0x1c')],{'raw':_0x588de3[_0x173d('0x1d')]?_0x588de3['options'][_0x173d('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x402c53){logger[_0x173d('0xe')](_0x173d('0x19'),_0x588de3);logger[_0x173d('0x11')](_0x173d('0x19'),_0x588de3,JSON[_0x173d('0x13')](_0x402c53));_0x2dd1f7(_0x402c53);})[_0x173d('0x18')](function(_0x2a12b){logger[_0x173d('0x14')](_0x173d('0x19'),_0x2a12b['message'],_0x588de3);_0x29a57d(_0x41ab4a[_0x173d('0x14')](0x1f4,_0x2a12b['message']));});});}; \ No newline at end of file +var _0x6ad8=['Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Plugin','create','body','options','raw','then','CreatePlugin','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','./plugin.socket','register','request','info'];(function(_0x379e6b,_0x55a140){var _0x3caf30=function(_0x3d2391){while(--_0x3d2391){_0x379e6b['push'](_0x379e6b['shift']());}};_0x3caf30(++_0x55a140);}(_0x6ad8,0x1ef));var _0x86ad=function(_0x483d04,_0x2d064d){_0x483d04=_0x483d04-0x0;var _0x335bce=_0x6ad8[_0x483d04];return _0x335bce;};'use strict';var _=require(_0x86ad('0x0'));var util=require(_0x86ad('0x1'));var moment=require(_0x86ad('0x2'));var BPromise=require('bluebird');var rs=require(_0x86ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86ad('0x4'))['db'];var utils=require(_0x86ad('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x86ad('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86ad('0x7')][_0x86ad('0x8')]({'port':0x232a});config[_0x86ad('0x9')]=_[_0x86ad('0xa')](config[_0x86ad('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x86ad('0xb'))[_0x86ad('0xc')](socket);function respondWithRpcPromise(_0x53bca4,_0x33997b,_0x46208e){return new BPromise(function(_0xddb15e,_0x38896d){return client[_0x86ad('0xd')](_0x53bca4,_0x46208e)['then'](function(_0x598c50){logger[_0x86ad('0xe')](_0x86ad('0xf'),_0x33997b,_0x86ad('0x10'));logger['debug'](_0x86ad('0x11'),_0x33997b,_0x86ad('0x10'),JSON[_0x86ad('0x12')](_0x598c50));if(_0x598c50[_0x86ad('0x13')]){if(_0x598c50[_0x86ad('0x13')]['code']===0x1f4){logger['error'](_0x86ad('0xf'),_0x33997b,_0x598c50[_0x86ad('0x13')][_0x86ad('0x14')]);return _0x38896d(_0x598c50[_0x86ad('0x13')][_0x86ad('0x14')]);}logger[_0x86ad('0x13')](_0x86ad('0xf'),_0x33997b,_0x598c50['error'][_0x86ad('0x14')]);return _0xddb15e(_0x598c50[_0x86ad('0x13')]['message']);}else{logger[_0x86ad('0xe')](_0x86ad('0xf'),_0x33997b,_0x86ad('0x10'));_0xddb15e(_0x598c50[_0x86ad('0x15')][_0x86ad('0x14')]);}})[_0x86ad('0x16')](function(_0x5068ac){logger[_0x86ad('0x13')](_0x86ad('0xf'),_0x33997b,_0x5068ac);_0x38896d(_0x5068ac);});});}exports['CreatePlugin']=function(_0x2d7559){var _0x14c7b0=this;return new Promise(function(_0x2d080b,_0x3f8c71){return db[_0x86ad('0x17')][_0x86ad('0x18')](_0x2d7559[_0x86ad('0x19')],{'raw':_0x2d7559[_0x86ad('0x1a')]?_0x2d7559[_0x86ad('0x1a')][_0x86ad('0x1b')]===undefined?!![]:![]:!![]})[_0x86ad('0x1c')](function(_0x1eb23e){logger[_0x86ad('0xe')]('CreatePlugin',_0x2d7559);logger['debug'](_0x86ad('0x1d'),_0x2d7559,JSON['stringify'](_0x1eb23e));_0x2d080b(_0x1eb23e);})[_0x86ad('0x16')](function(_0x2402b3){logger['error'](_0x86ad('0x1d'),_0x2402b3['message'],_0x2d7559);_0x3f8c71(_0x14c7b0[_0x86ad('0x13')](0x1f4,_0x2402b3[_0x86ad('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 099e240..391cb1f 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 _0x4bde=['save','remove','emit','removeListener','register','plugin:','./plugin.events'];(function(_0x2a829f,_0x1b0c15){var _0x5737c3=function(_0x2376f9){while(--_0x2376f9){_0x2a829f['push'](_0x2a829f['shift']());}};_0x5737c3(++_0x1b0c15);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x5c3a42,_0x23ace6){_0x5c3a42=_0x5c3a42-0x0;var _0x283a0c=_0x4bde[_0x5c3a42];return _0x283a0c;};'use strict';var PluginEvents=require(_0xe4bd('0x0'));var events=[_0xe4bd('0x1'),_0xe4bd('0x2'),'update'];function createListener(_0x46f95a,_0x7af0af){return function(_0x416389){_0x7af0af[_0xe4bd('0x3')](_0x46f95a,_0x416389);};}function removeListener(_0x5741e5,_0x210d47){return function(){PluginEvents[_0xe4bd('0x4')](_0x5741e5,_0x210d47);};}exports[_0xe4bd('0x5')]=function(_0x226a63){for(var _0x1db6d2=0x0,_0x4008eb=events['length'];_0x1db6d2<_0x4008eb;_0x1db6d2++){var _0x2cf33d=events[_0x1db6d2];var _0xbd04ce=createListener(_0xe4bd('0x6')+_0x2cf33d,_0x226a63);PluginEvents['on'](_0x2cf33d,_0xbd04ce);}}; \ No newline at end of file +var _0x3c11=['remove','update','emit','register','length','plugin:','./plugin.events','save'];(function(_0x54f322,_0x24a660){var _0xb0a1d5=function(_0x523587){while(--_0x523587){_0x54f322['push'](_0x54f322['shift']());}};_0xb0a1d5(++_0x24a660);}(_0x3c11,0x196));var _0x13c1=function(_0x57555e,_0x767957){_0x57555e=_0x57555e-0x0;var _0x1696ca=_0x3c11[_0x57555e];return _0x1696ca;};'use strict';var PluginEvents=require(_0x13c1('0x0'));var events=[_0x13c1('0x1'),_0x13c1('0x2'),_0x13c1('0x3')];function createListener(_0x3a8989,_0x4d057a){return function(_0x28dc9f){_0x4d057a[_0x13c1('0x4')](_0x3a8989,_0x28dc9f);};}function removeListener(_0x35d589,_0x5e78fc){return function(){PluginEvents['removeListener'](_0x35d589,_0x5e78fc);};}exports[_0x13c1('0x5')]=function(_0x4b8ba7){for(var _0x4669d5=0x0,_0x2bde8b=events[_0x13c1('0x6')];_0x4669d5<_0x2bde8b;_0x4669d5++){var _0x270110=events[_0x4669d5];var _0x293a48=createListener(_0x13c1('0x7')+_0x270110,_0x4b8ba7);PluginEvents['on'](_0x270110,_0x293a48);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 59fce78..21b4236 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 _0xf6ae=['update','delete','exports','express','Router','get','isAuthenticated','index','/:id','show','put'];(function(_0x46c124,_0x136ec3){var _0x1baae0=function(_0x1c8424){while(--_0x1c8424){_0x46c124['push'](_0x46c124['shift']());}};_0x1baae0(++_0x136ec3);}(_0xf6ae,0xdf));var _0xef6a=function(_0xea0d8f,_0x5ce237){_0xea0d8f=_0xea0d8f-0x0;var _0x50a411=_0xf6ae[_0xea0d8f];return _0x50a411;};'use strict';var express=require(_0xef6a('0x0'));var router=express[_0xef6a('0x1')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0xef6a('0x2')]('/',auth[_0xef6a('0x3')](),controller[_0xef6a('0x4')]);router[_0xef6a('0x2')](_0xef6a('0x5'),auth[_0xef6a('0x3')](),controller[_0xef6a('0x6')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xef6a('0x7')](_0xef6a('0x5'),auth[_0xef6a('0x3')](),controller[_0xef6a('0x8')]);router[_0xef6a('0x9')](_0xef6a('0x5'),auth[_0xef6a('0x3')](),controller['destroy']);module[_0xef6a('0xa')]=router; \ No newline at end of file +var _0xf75e=['isAuthenticated','index','show','post','put','delete','/:id','destroy','exports','express','./pm2.controller','get'];(function(_0x832d83,_0x1f48e0){var _0xe505b6=function(_0x415c90){while(--_0x415c90){_0x832d83['push'](_0x832d83['shift']());}};_0xe505b6(++_0x1f48e0);}(_0xf75e,0xf9));var _0xef75=function(_0x50d507,_0xc89795){_0x50d507=_0x50d507-0x0;var _0x1470b6=_0xf75e[_0x50d507];return _0x1470b6;};'use strict';var express=require(_0xef75('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xef75('0x1'));router[_0xef75('0x2')]('/',auth[_0xef75('0x3')](),controller[_0xef75('0x4')]);router[_0xef75('0x2')]('/:id',auth[_0xef75('0x3')](),controller[_0xef75('0x5')]);router[_0xef75('0x6')]('/',auth[_0xef75('0x3')](),controller['create']);router[_0xef75('0x7')]('/:id',auth[_0xef75('0x3')](),controller['update']);router[_0xef75('0x8')](_0xef75('0x9'),auth['isAuthenticated'](),controller[_0xef75('0xa')]);module[_0xef75('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index d3c8480..ea3a0c5 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 _0xe970=['restart','hasOwnProperty','status','Unknown\x20status','destroy','delete','params','Unknown\x20id','lodash','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','send','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump'];(function(_0x41c822,_0x1db177){var _0xf2af4d=function(_0x190129){while(--_0x190129){_0x41c822['push'](_0x41c822['shift']());}};_0xf2af4d(++_0x1db177);}(_0xe970,0x120));var _0x0e97=function(_0x3b933c,_0x24fabb){_0x3b933c=_0x3b933c-0x0;var _0x34daa9=_0xe970[_0x3b933c];return _0x34daa9;};'use strict';var _=require(_0x0e97('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0e97('0x1'))(_0x0e97('0x2'));var path=require(_0x0e97('0x3'));var exec=require('child_process')[_0x0e97('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x30b884,_0x24f08c){return function(_0x13b993){if(!_0x13b993){_0x30b884[_0x0e97('0x5')](0x194);;}return _0x13b993;};}function respondWithResult(_0x4ddbf8,_0x50a10a){_0x50a10a=_0x50a10a||0xc8;return function(_0xe1ad5d){if(_0xe1ad5d){return _0x4ddbf8['status'](_0x50a10a)[_0x0e97('0x6')](_0xe1ad5d);}return null;};}function handleError(_0x4792e9,_0x2e8b15){_0x2e8b15=_0x2e8b15||0x1f4;return function(_0x3540ca){logger[_0x0e97('0x7')](_0x3540ca[_0x0e97('0x8')]);if(_0x3540ca['name']){delete _0x3540ca[_0x0e97('0x9')];}_0x4792e9['status'](_0x2e8b15)[_0x0e97('0xa')](_0x3540ca);};}function execChildProcess(){return new BPromise(function(_0x145c7a,_0x99beb3){exec(_0x0e97('0xb'),function(_0x39623f,_0x3bb0bf,_0x221232){logger[_0x0e97('0xc')](_0x3bb0bf);logger[_0x0e97('0xc')](_0x221232);if(_0x39623f){logger[_0x0e97('0x7')](_0x39623f);return _0x99beb3(_0x39623f);}return _0x145c7a(_0x3bb0bf);});});}exports[_0x0e97('0xd')]=function(_0x23dd3d,_0x50d53a){return pm2[_0x0e97('0xe')]()['then'](function(_0x58600c){if(_0x58600c){var _0x24f5eb=_[_0x0e97('0xf')](_0x58600c,function(_0x142d5a){return _0x142d5a[_0x0e97('0x9')]===_0x0e97('0x10')||_0x142d5a[_0x0e97('0x9')]===_0x0e97('0x11');});return{'rows':_0x24f5eb,'count':_0x24f5eb[_0x0e97('0x12')]};}return null;})[_0x0e97('0x13')](respondWithResult(_0x50d53a,null))[_0x0e97('0x14')](handleError(_0x50d53a,null));};exports['show']=function(_0x1249cb,_0x2138c3){return pm2[_0x0e97('0x15')](_0x1249cb['params']['id'])['then'](respondWithResult(_0x2138c3,null))[_0x0e97('0x13')](handleEntityNotFound(_0x2138c3,null))[_0x0e97('0x14')](handleError(_0x2138c3,null));};exports[_0x0e97('0x16')]=function(_0x7e7b9a,_0x5c65be){if(_0x7e7b9a['body'][_0x0e97('0x9')]&&_0x7e7b9a[_0x0e97('0x17')][_0x0e97('0x18')]){var _0x270401=path[_0x0e97('0x19')](__dirname,_0x0e97('0x1a'),_0x7e7b9a[_0x0e97('0x17')][_0x0e97('0x18')]);var _0x4f15e0=process[_0x0e97('0x1b')]();process[_0x0e97('0x1c')](path[_0x0e97('0x1d')](_0x270401));return execChildProcess()[_0x0e97('0x13')](function(_0x4eb1e0){process[_0x0e97('0x1c')](_0x4f15e0);return pm2[_0x0e97('0x1e')]({'name':_0x7e7b9a[_0x0e97('0x17')][_0x0e97('0x9')],'script':_0x270401});})[_0x0e97('0x13')](function(_0x5f16e3){pm2[_0x0e97('0x1f')]();return _0x5f16e3[0x0];})[_0x0e97('0x13')](respondWithResult(_0x5c65be,0xc9))[_0x0e97('0x14')](handleError(_0x5c65be,null));}else{return _0x5c65be['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x409522,_0x489b27){if(_0x409522['body']['id']){delete _0x409522['body']['id'];}var _0x241e5e={'online':_0x0e97('0x20'),'stopped':'stop'};if(_0x241e5e[_0x0e97('0x21')](_0x409522[_0x0e97('0x17')][_0x0e97('0x22')])){return pm2[_0x241e5e[_0x409522['body'][_0x0e97('0x22')]]](_0x409522['params']['id'])[_0x0e97('0x13')](respondWithResult(_0x489b27,0xc8))['catch'](handleError(_0x489b27,null));}else{return _0x489b27[_0x0e97('0x22')](0x1f4)[_0x0e97('0xa')]({'message':_0x0e97('0x23')});}};exports[_0x0e97('0x24')]=function(_0xc02707,_0x112592){if(_0xc02707[_0x0e97('0x17')]['id']){delete _0xc02707['body']['id'];}if(_0xc02707['params']['id']){return pm2[_0x0e97('0x25')](_0xc02707[_0x0e97('0x26')]['id'])[_0x0e97('0x13')](function(_0x4e0ccf){pm2[_0x0e97('0x1f')]();return _0x4e0ccf[0x0];})[_0x0e97('0x13')](respondWithResult(_0x112592,null))['catch'](handleError(_0x112592,null));}else{return _0x112592['status'](0x1f4)[_0x0e97('0xa')]({'message':_0x0e97('0x27')});}}; \ No newline at end of file +var _0x54d7=['lodash','../../config/pm2','../../config/logger','api','path','bluebird','status','json','name','send','info','error','index','list','then','reject','express','motion2','length','catch','show','params','body','script','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id'];(function(_0x356dcc,_0x51f8f7){var _0xe6c019=function(_0xc0710d){while(--_0xc0710d){_0x356dcc['push'](_0x356dcc['shift']());}};_0xe6c019(++_0x51f8f7);}(_0x54d7,0x186));var _0x754d=function(_0x642531,_0x47fcca){_0x642531=_0x642531-0x0;var _0x29bc8e=_0x54d7[_0x642531];return _0x29bc8e;};'use strict';var _=require(_0x754d('0x0'));var pm2=require(_0x754d('0x1'));var logger=require(_0x754d('0x2'))(_0x754d('0x3'));var path=require(_0x754d('0x4'));var exec=require('child_process')['exec'];var BPromise=require(_0x754d('0x5'));function handleEntityNotFound(_0x36a563,_0x1904c){return function(_0x525a80){if(!_0x525a80){_0x36a563['sendStatus'](0x194);;}return _0x525a80;};}function respondWithResult(_0x41a1e8,_0x547057){_0x547057=_0x547057||0xc8;return function(_0x216f3e){if(_0x216f3e){return _0x41a1e8[_0x754d('0x6')](_0x547057)[_0x754d('0x7')](_0x216f3e);}return null;};}function handleError(_0x146458,_0x42ccf5){_0x42ccf5=_0x42ccf5||0x1f4;return function(_0x40a70c){logger['error'](_0x40a70c['stack']);if(_0x40a70c[_0x754d('0x8')]){delete _0x40a70c['name'];}_0x146458[_0x754d('0x6')](_0x42ccf5)[_0x754d('0x9')](_0x40a70c);};}function execChildProcess(){return new BPromise(function(_0x3b916b,_0x3d73b8){exec('npm\x20install',function(_0xb86609,_0x216a4e,_0x19a807){logger[_0x754d('0xa')](_0x216a4e);logger[_0x754d('0xa')](_0x19a807);if(_0xb86609){logger[_0x754d('0xb')](_0xb86609);return _0x3d73b8(_0xb86609);}return _0x3b916b(_0x216a4e);});});}exports[_0x754d('0xc')]=function(_0x1258e6,_0x4fad22){return pm2[_0x754d('0xd')]()[_0x754d('0xe')](function(_0x1b915f){if(_0x1b915f){var _0x10df69=_[_0x754d('0xf')](_0x1b915f,function(_0x35ac3d){return _0x35ac3d[_0x754d('0x8')]===_0x754d('0x10')||_0x35ac3d[_0x754d('0x8')]===_0x754d('0x11');});return{'rows':_0x10df69,'count':_0x10df69[_0x754d('0x12')]};}return null;})[_0x754d('0xe')](respondWithResult(_0x4fad22,null))[_0x754d('0x13')](handleError(_0x4fad22,null));};exports[_0x754d('0x14')]=function(_0x179348,_0x525687){return pm2['describe'](_0x179348[_0x754d('0x15')]['id'])['then'](respondWithResult(_0x525687,null))['then'](handleEntityNotFound(_0x525687,null))['catch'](handleError(_0x525687,null));};exports['create']=function(_0x972f,_0x298546){if(_0x972f[_0x754d('0x16')][_0x754d('0x8')]&&_0x972f[_0x754d('0x16')][_0x754d('0x17')]){var _0x304684=path['join'](__dirname,_0x754d('0x18'),_0x972f['body']['script']);var _0x4929b1=process[_0x754d('0x19')]();process[_0x754d('0x1a')](path[_0x754d('0x1b')](_0x304684));return execChildProcess()[_0x754d('0xe')](function(_0xe03067){process['chdir'](_0x4929b1);return pm2[_0x754d('0x1c')]({'name':_0x972f[_0x754d('0x16')]['name'],'script':_0x304684});})['then'](function(_0x533ac5){pm2[_0x754d('0x1d')]();return _0x533ac5[0x0];})[_0x754d('0xe')](respondWithResult(_0x298546,0xc9))['catch'](handleError(_0x298546,null));}else{return _0x298546[_0x754d('0x6')](0x1f4)['send']({'message':_0x754d('0x1e')});}};exports[_0x754d('0x1f')]=function(_0x34b2ae,_0x1ec4c2){if(_0x34b2ae[_0x754d('0x16')]['id']){delete _0x34b2ae['body']['id'];}var _0x4beadc={'online':_0x754d('0x20'),'stopped':_0x754d('0x21')};if(_0x4beadc[_0x754d('0x22')](_0x34b2ae[_0x754d('0x16')]['status'])){return pm2[_0x4beadc[_0x34b2ae['body']['status']]](_0x34b2ae[_0x754d('0x15')]['id'])[_0x754d('0xe')](respondWithResult(_0x1ec4c2,0xc8))['catch'](handleError(_0x1ec4c2,null));}else{return _0x1ec4c2['status'](0x1f4)[_0x754d('0x9')]({'message':_0x754d('0x23')});}};exports[_0x754d('0x24')]=function(_0x2157ce,_0x2a9b13){if(_0x2157ce[_0x754d('0x16')]['id']){delete _0x2157ce[_0x754d('0x16')]['id'];}if(_0x2157ce['params']['id']){return pm2[_0x754d('0x25')](_0x2157ce[_0x754d('0x15')]['id'])[_0x754d('0xe')](function(_0x759b8a){pm2[_0x754d('0x1d')]();return _0x759b8a[0x0];})[_0x754d('0xe')](respondWithResult(_0x2a9b13,null))['catch'](handleError(_0x2a9b13,null));}else{return _0x2a9b13['status'](0x1f4)[_0x754d('0x9')]({'message':_0x754d('0x26')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 59afb95..ce2c1a0 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 _0xbecc=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xbecc,0xaf));var _0xcbec=function(_0x1125a2,_0x3ae8ba){_0x1125a2=_0x1125a2-0x0;var _0x39ccb6=_0xbecc[_0x1125a2];return _0x39ccb6;};'use strict';var multer=require(_0xcbec('0x0'));var util=require(_0xcbec('0x1'));var path=require('path');var timeout=require(_0xcbec('0x2'));var express=require(_0xcbec('0x3'));var router=express[_0xcbec('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcbec('0x5'));var config=require(_0xcbec('0x6'));module[_0xcbec('0x7')]=router; \ No newline at end of file +var _0xd651=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x48b5e7,_0x8b9553){var _0x58e96b=function(_0xb0e1e0){while(--_0xb0e1e0){_0x48b5e7['push'](_0x48b5e7['shift']());}};_0x58e96b(++_0x8b9553);}(_0xd651,0x136));var _0x1d65=function(_0x19ee73,_0x5793dd){_0x19ee73=_0x19ee73-0x0;var _0x38e19d=_0xd651[_0x19ee73];return _0x38e19d;};'use strict';var multer=require(_0x1d65('0x0'));var util=require(_0x1d65('0x1'));var path=require(_0x1d65('0x2'));var timeout=require(_0x1d65('0x3'));var express=require(_0x1d65('0x4'));var router=express[_0x1d65('0x5')]();var auth=require(_0x1d65('0x6'));var interaction=require(_0x1d65('0x7'));var config=require(_0x1d65('0x8'));module[_0x1d65('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5ccf5d8..c4c2d9b 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 _0x036c=['INTEGER','STRING','DATE'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x036c,0x1e6));var _0xc036=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x036c[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xc036('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xc036('0x1')]},'scheduledat':{'type':Sequelize[_0xc036('0x2')]},'uniqueid':{'type':Sequelize[_0xc036('0x1')]},'starttime':{'type':Sequelize[_0xc036('0x2')]},'responsetime':{'type':Sequelize[_0xc036('0x2')]},'ringtime':{'type':Sequelize[_0xc036('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc036('0x1')]},'campaigntype':{'type':Sequelize[_0xc036('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5fe5=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x148e1b,_0x1cd5a5){var _0xee8ecc=function(_0x39637f){while(--_0x39637f){_0x148e1b['push'](_0x148e1b['shift']());}};_0xee8ecc(++_0x1cd5a5);}(_0x5fe5,0x11a));var _0x55fe=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0x5fe5[_0x12e073];return _0x267748;};'use strict';var Sequelize=require(_0x55fe('0x0'));module[_0x55fe('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x55fe('0x2')]},'uniqueid':{'type':Sequelize[_0x55fe('0x3')]},'starttime':{'type':Sequelize[_0x55fe('0x2')]},'responsetime':{'type':Sequelize[_0x55fe('0x2')]},'ringtime':{'type':Sequelize[_0x55fe('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x55fe('0x3')]},'campaigntype':{'type':Sequelize[_0x55fe('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index fda490b..6d4f3c1 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 _0x4397=['define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','./reportAgentPreview.attributes'];(function(_0x4dabc2,_0x5aa934){var _0x506829=function(_0x5898fe){while(--_0x5898fe){_0x4dabc2['push'](_0x4dabc2['shift']());}};_0x506829(++_0x5aa934);}(_0x4397,0x1a7));var _0x7439=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x4397[_0x58c851];return _0x534d8a;};'use strict';var _=require(_0x7439('0x0'));var util=require('util');var logger=require(_0x7439('0x1'))(_0x7439('0x2'));var moment=require(_0x7439('0x3'));var BPromise=require(_0x7439('0x4'));var rp=require(_0x7439('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7439('0x6'));module['exports']=function(_0x50f34c,_0x2f54e0){return _0x50f34c[_0x7439('0x7')](_0x7439('0x8'),attributes,{'tableName':_0x7439('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x243b=['util','../../config/logger','api','moment','bluebird','path','rimraf','./reportAgentPreview.attributes','exports','report_agent_preview','lodash'];(function(_0x3ae24a,_0x7d32f9){var _0x18690f=function(_0x2c2389){while(--_0x2c2389){_0x3ae24a['push'](_0x3ae24a['shift']());}};_0x18690f(++_0x7d32f9);}(_0x243b,0x1d8));var _0xb243=function(_0x2801ac,_0x2a609c){_0x2801ac=_0x2801ac-0x0;var _0x411e57=_0x243b[_0x2801ac];return _0x411e57;};'use strict';var _=require(_0xb243('0x0'));var util=require(_0xb243('0x1'));var logger=require(_0xb243('0x2'))(_0xb243('0x3'));var moment=require(_0xb243('0x4'));var BPromise=require(_0xb243('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb243('0x6'));var rimraf=require(_0xb243('0x7'));var config=require('../../config/environment');var attributes=require(_0xb243('0x8'));module[_0xb243('0x9')]=function(_0x188198,_0x306ebd){return _0x188198['define']('ReportAgentPreview',attributes,{'tableName':_0xb243('0xa'),'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 baa5cb0..f70b7d4 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 _0x8b6c=['moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','body','options','lodash'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8b6c,0x11d));var _0xc8b6=function(_0x55cb31,_0x329767){_0x55cb31=_0x55cb31-0x0;var _0x47b0ba=_0x8b6c[_0x55cb31];return _0x47b0ba;};'use strict';var _=require(_0xc8b6('0x0'));var util=require('util');var moment=require(_0xc8b6('0x1'));var BPromise=require(_0xc8b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8b6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc8b6('0x4'));var config=require('../../config/environment');var jayson=require(_0xc8b6('0x5'));var client=jayson[_0xc8b6('0x6')][_0xc8b6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e28c3,_0x1f52f9,_0x76b9da){return new BPromise(function(_0x5ede96,_0x35de4b){return client['request'](_0x1e28c3,_0x76b9da)['then'](function(_0x29d991){logger[_0xc8b6('0x8')](_0xc8b6('0x9'),_0x1f52f9,_0xc8b6('0xa'));logger[_0xc8b6('0xb')](_0xc8b6('0xc'),_0x1f52f9,_0xc8b6('0xa'),JSON[_0xc8b6('0xd')](_0x29d991));if(_0x29d991['error']){if(_0x29d991[_0xc8b6('0xe')][_0xc8b6('0xf')]===0x1f4){logger[_0xc8b6('0xe')](_0xc8b6('0x9'),_0x1f52f9,_0x29d991['error'][_0xc8b6('0x10')]);return _0x35de4b(_0x29d991[_0xc8b6('0xe')]['message']);}logger['error'](_0xc8b6('0x9'),_0x1f52f9,_0x29d991[_0xc8b6('0xe')][_0xc8b6('0x10')]);return _0x5ede96(_0x29d991['error'][_0xc8b6('0x10')]);}else{logger[_0xc8b6('0x8')](_0xc8b6('0x9'),_0x1f52f9,_0xc8b6('0xa'));_0x5ede96(_0x29d991[_0xc8b6('0x11')][_0xc8b6('0x10')]);}})[_0xc8b6('0x12')](function(_0x4141f8){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1f52f9,_0x4141f8);_0x35de4b(_0x4141f8);});});}exports[_0xc8b6('0x13')]=function(_0x158ee5){var _0x28ccd9=this;return new Promise(function(_0xbdc44b,_0x4924b9){return db['ReportAgentPreview']['create'](_0x158ee5[_0xc8b6('0x14')],{'raw':_0x158ee5[_0xc8b6('0x15')]?_0x158ee5[_0xc8b6('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2beb3e){logger['info'](_0xc8b6('0x13'),_0x158ee5);logger[_0xc8b6('0xb')]('CreateReportAgentPreview',_0x158ee5,JSON[_0xc8b6('0xd')](_0x2beb3e));_0xbdc44b(_0x2beb3e);})[_0xc8b6('0x12')](function(_0x54c784){logger[_0xc8b6('0xe')](_0xc8b6('0x13'),_0x54c784[_0xc8b6('0x10')],_0x158ee5);_0x4924b9(_0x28ccd9[_0xc8b6('0xe')](0x1f4,_0x54c784[_0xc8b6('0x10')]));});});}; \ No newline at end of file +var _0x4400=['request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x71e091,_0x49100e){var _0x57435e=function(_0x3f3524){while(--_0x3f3524){_0x71e091['push'](_0x71e091['shift']());}};_0x57435e(++_0x49100e);}(_0x4400,0x15e));var _0x0440=function(_0xd01f0f,_0x13acc2){_0xd01f0f=_0xd01f0f-0x0;var _0x416d83=_0x4400[_0xd01f0f];return _0x416d83;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0440('0x0'));var BPromise=require(_0x0440('0x1'));var rs=require(_0x0440('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0440('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0440('0x4'));var jayson=require(_0x0440('0x5'));var client=jayson[_0x0440('0x6')][_0x0440('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26ae26,_0x549255,_0x54540c){return new BPromise(function(_0x5955ba,_0x536cfd){return client[_0x0440('0x8')](_0x26ae26,_0x54540c)[_0x0440('0x9')](function(_0x57bfe8){logger[_0x0440('0xa')](_0x0440('0xb'),_0x549255,'request\x20sent');logger[_0x0440('0xc')](_0x0440('0xd'),_0x549255,_0x0440('0xe'),JSON[_0x0440('0xf')](_0x57bfe8));if(_0x57bfe8['error']){if(_0x57bfe8[_0x0440('0x10')][_0x0440('0x11')]===0x1f4){logger[_0x0440('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x549255,_0x57bfe8[_0x0440('0x10')][_0x0440('0x12')]);return _0x536cfd(_0x57bfe8[_0x0440('0x10')][_0x0440('0x12')]);}logger['error'](_0x0440('0xb'),_0x549255,_0x57bfe8[_0x0440('0x10')]['message']);return _0x5955ba(_0x57bfe8['error'][_0x0440('0x12')]);}else{logger[_0x0440('0xa')](_0x0440('0xb'),_0x549255,_0x0440('0xe'));_0x5955ba(_0x57bfe8[_0x0440('0x13')]['message']);}})[_0x0440('0x14')](function(_0x56effc){logger['error'](_0x0440('0xb'),_0x549255,_0x56effc);_0x536cfd(_0x56effc);});});}exports[_0x0440('0x15')]=function(_0x4064bc){var _0x1ebc9f=this;return new Promise(function(_0x1ab85c,_0x31e66e){return db[_0x0440('0x16')][_0x0440('0x17')](_0x4064bc['body'],{'raw':_0x4064bc[_0x0440('0x18')]?_0x4064bc['options'][_0x0440('0x19')]===undefined?!![]:![]:!![]})[_0x0440('0x9')](function(_0x51ac30){logger[_0x0440('0xa')](_0x0440('0x15'),_0x4064bc);logger[_0x0440('0xc')](_0x0440('0x15'),_0x4064bc,JSON[_0x0440('0xf')](_0x51ac30));_0x1ab85c(_0x51ac30);})[_0x0440('0x14')](function(_0x493f76){logger[_0x0440('0x10')](_0x0440('0x15'),_0x493f76[_0x0440('0x12')],_0x4064bc);_0x31e66e(_0x1ebc9f['error'](0x1f4,_0x493f76[_0x0440('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ccc54d9..5efa4ac 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 _0xeab3=['mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','/sms/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','telephones','/trunks','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions'];(function(_0x494e0e,_0x191fc7){var _0x29b22f=function(_0x297c5c){while(--_0x297c5c){_0x494e0e['push'](_0x494e0e['shift']());}};_0x29b22f(++_0x191fc7);}(_0xeab3,0xc0));var _0x3eab=function(_0x5528ea,_0x4d95cf){_0x5528ea=_0x5528ea-0x0;var _0x1253b8=_0xeab3[_0x5528ea];return _0x1253b8;};'use strict';var multer=require(_0x3eab('0x0'));var util=require(_0x3eab('0x1'));var path=require(_0x3eab('0x2'));var express=require(_0x3eab('0x3'));var router=express[_0x3eab('0x4')]();var auth=require(_0x3eab('0x5'));var controller=require(_0x3eab('0x6'));router[_0x3eab('0x7')]('/voice/channels',auth[_0x3eab('0x8')](),controller[_0x3eab('0x9')]);router[_0x3eab('0x7')](_0x3eab('0xa'),auth[_0x3eab('0x8')](),controller[_0x3eab('0xb')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x3eab('0x8')](),controller[_0x3eab('0xc')]);router[_0x3eab('0x7')](_0x3eab('0xd'),auth[_0x3eab('0x8')](),controller[_0x3eab('0xe')]);router['get']('/chat/queues',auth[_0x3eab('0x8')](),controller[_0x3eab('0xf')]);router[_0x3eab('0x7')](_0x3eab('0x10'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x11')]);router[_0x3eab('0x7')]('/mail/accounts',auth[_0x3eab('0x8')](),controller['mailAccounts']);router[_0x3eab('0x7')](_0x3eab('0x12'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x13')]);router[_0x3eab('0x7')](_0x3eab('0x14'),auth[_0x3eab('0x8')](),controller['smsQueues']);router[_0x3eab('0x7')]('/whatsapp/queues',auth[_0x3eab('0x8')](),controller[_0x3eab('0x15')]);router[_0x3eab('0x7')]('/fax/queues',auth[_0x3eab('0x8')](),controller[_0x3eab('0x16')]);router['get'](_0x3eab('0x17'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x18')]);router[_0x3eab('0x7')](_0x3eab('0x19'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x1a')]);router[_0x3eab('0x7')](_0x3eab('0x1b'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x1c')]);router[_0x3eab('0x7')](_0x3eab('0x1d'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x1e')]);router[_0x3eab('0x7')](_0x3eab('0x1f'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x20')]);router[_0x3eab('0x7')](_0x3eab('0x21'),auth[_0x3eab('0x8')](),controller['showVoiceQueues']);router[_0x3eab('0x7')](_0x3eab('0x22'),auth['isAuthenticated'](),controller[_0x3eab('0x23')]);router['get'](_0x3eab('0x24'),auth['isAuthenticated'](),controller[_0x3eab('0x25')]);router[_0x3eab('0x7')](_0x3eab('0x26'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x27')]);router[_0x3eab('0x28')](_0x3eab('0x29'),auth[_0x3eab('0x8')](),controller['agentCapacity']);router[_0x3eab('0x7')]('/telephones',auth[_0x3eab('0x8')](),controller[_0x3eab('0x2a')]);router[_0x3eab('0x7')](_0x3eab('0x2b'),auth[_0x3eab('0x8')](),controller['trunks']);router[_0x3eab('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0x3eab('0x2c')]);router['get']('/fax/accounts',auth[_0x3eab('0x8')](),controller['faxAccounts']);router[_0x3eab('0x7')](_0x3eab('0x2d'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x2e')]);router[_0x3eab('0x7')](_0x3eab('0x2f'),auth['isAuthenticated'](),controller[_0x3eab('0x30')]);router['get'](_0x3eab('0x31'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x32')]);router[_0x3eab('0x7')](_0x3eab('0x33'),auth[_0x3eab('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x3eab('0x7')](_0x3eab('0x34'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x35')]);router['get'](_0x3eab('0x36'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x37')]);router[_0x3eab('0x38')]('/mail/queues/:id/notify',auth[_0x3eab('0x8')](),controller['queueNotify'](_0x3eab('0x39')));router[_0x3eab('0x7')](_0x3eab('0x3a'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x3b')]);router['post']('/chat/queues/:id/notify',auth[_0x3eab('0x8')](),controller[_0x3eab('0x3c')](_0x3eab('0x3d')));router[_0x3eab('0x7')](_0x3eab('0x3e'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x3f')]);router[_0x3eab('0x38')]('/fax/queues/:id/notify',auth[_0x3eab('0x8')](),controller['queueNotify'](_0x3eab('0x40')));router[_0x3eab('0x7')](_0x3eab('0x41'),auth['isAuthenticated'](),controller[_0x3eab('0x42')]);router[_0x3eab('0x38')](_0x3eab('0x43'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x3c')](_0x3eab('0x44')));router[_0x3eab('0x7')](_0x3eab('0x45'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x46')]);router[_0x3eab('0x38')](_0x3eab('0x47'),auth[_0x3eab('0x8')](),controller[_0x3eab('0x3c')]('sms'));router['post'](_0x3eab('0x48'),auth[_0x3eab('0x8')](),controller['queueNotify'](_0x3eab('0x49')));router['get'](_0x3eab('0x4a'),auth['isAuthenticated'](),controller[_0x3eab('0x4b')]);router[_0x3eab('0x7')](_0x3eab('0x4c'),auth['isAuthenticated'](),controller[_0x3eab('0x4d')]);router[_0x3eab('0x38')]('/agents/:id/notify',auth[_0x3eab('0x8')](),controller[_0x3eab('0x4e')]);module[_0x3eab('0x4f')]=router; \ No newline at end of file +var _0x2dd5=['/outbound/channels','agents','/agents/:id/capacity','agentCapacity','/trunks','trunks','/campaigns','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','queueNotify','fax','/fax/queues/:id','showFaxQueues','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','path','express','Router','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound'];(function(_0x4b725c,_0x234a80){var _0x2d599e=function(_0x124caa){while(--_0x124caa){_0x4b725c['push'](_0x4b725c['shift']());}};_0x2d599e(++_0x234a80);}(_0x2dd5,0x199));var _0x52dd=function(_0x26974b,_0x58489e){_0x26974b=_0x26974b-0x0;var _0x10a234=_0x2dd5[_0x26974b];return _0x10a234;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x52dd('0x0'));var express=require(_0x52dd('0x1'));var router=express[_0x52dd('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0x52dd('0x3'));router[_0x52dd('0x4')]('/voice/channels',auth['isAuthenticated'](),controller[_0x52dd('0x5')]);router[_0x52dd('0x4')](_0x52dd('0x6'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x8')]);router[_0x52dd('0x4')](_0x52dd('0x9'),auth[_0x52dd('0x7')](),controller[_0x52dd('0xa')]);router[_0x52dd('0x4')](_0x52dd('0xb'),auth[_0x52dd('0x7')](),controller[_0x52dd('0xc')]);router[_0x52dd('0x4')](_0x52dd('0xd'),auth[_0x52dd('0x7')](),controller[_0x52dd('0xe')]);router[_0x52dd('0x4')](_0x52dd('0xf'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x10')]);router[_0x52dd('0x4')](_0x52dd('0x11'),auth[_0x52dd('0x7')](),controller['mailAccounts']);router[_0x52dd('0x4')](_0x52dd('0x12'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x13')]);router[_0x52dd('0x4')]('/sms/queues',auth[_0x52dd('0x7')](),controller[_0x52dd('0x14')]);router[_0x52dd('0x4')](_0x52dd('0x15'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x16')]);router[_0x52dd('0x4')]('/fax/queues',auth[_0x52dd('0x7')](),controller['faxQueues']);router[_0x52dd('0x4')](_0x52dd('0x17'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x18')]);router[_0x52dd('0x4')](_0x52dd('0x19'),auth[_0x52dd('0x7')](),controller['voiceQueuesChannels']);router[_0x52dd('0x4')](_0x52dd('0x1a'),auth['isAuthenticated'](),controller[_0x52dd('0x1b')]);router[_0x52dd('0x4')](_0x52dd('0x1c'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x1d')]);router[_0x52dd('0x4')](_0x52dd('0x1e'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x1f')]);router[_0x52dd('0x4')]('/voice/queues/:id',auth[_0x52dd('0x7')](),controller[_0x52dd('0x20')]);router[_0x52dd('0x4')](_0x52dd('0x21'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x22')]);router[_0x52dd('0x4')](_0x52dd('0x23'),auth[_0x52dd('0x7')](),controller['outboundChannels']);router[_0x52dd('0x4')]('/agents',auth[_0x52dd('0x7')](),controller[_0x52dd('0x24')]);router['put'](_0x52dd('0x25'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x26')]);router[_0x52dd('0x4')]('/telephones',auth[_0x52dd('0x7')](),controller['telephones']);router[_0x52dd('0x4')](_0x52dd('0x27'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x28')]);router['get'](_0x52dd('0x29'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x2a')]);router[_0x52dd('0x4')](_0x52dd('0x2b'),auth[_0x52dd('0x7')](),controller['faxAccounts']);router[_0x52dd('0x4')]('/chat/queues/waitinginteractions',auth[_0x52dd('0x7')](),controller[_0x52dd('0x2c')]);router[_0x52dd('0x4')](_0x52dd('0x2d'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x2e')]);router[_0x52dd('0x4')]('/openchannel/queues/waitinginteractions',auth[_0x52dd('0x7')](),controller['openchannelQueuesWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0x52dd('0x7')](),controller[_0x52dd('0x2f')]);router[_0x52dd('0x4')](_0x52dd('0x30'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x31')]);router['get'](_0x52dd('0x32'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x33')]);router[_0x52dd('0x34')](_0x52dd('0x35'),auth[_0x52dd('0x7')](),controller['queueNotify'](_0x52dd('0x36')));router[_0x52dd('0x4')](_0x52dd('0x37'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x38')]);router['post'](_0x52dd('0x39'),auth[_0x52dd('0x7')](),controller['queueNotify'](_0x52dd('0x3a')));router[_0x52dd('0x4')](_0x52dd('0x3b'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x3c')]);router[_0x52dd('0x34')](_0x52dd('0x3d'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x3e')](_0x52dd('0x3f')));router['get'](_0x52dd('0x40'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x41')]);router['post']('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x52dd('0x3e')]('openchannel'));router[_0x52dd('0x4')]('/openchannel/queues/:id',auth[_0x52dd('0x7')](),controller[_0x52dd('0x42')]);router['post']('/sms/queues/:id/notify',auth[_0x52dd('0x7')](),controller[_0x52dd('0x3e')]('sms'));router[_0x52dd('0x34')](_0x52dd('0x43'),auth['isAuthenticated'](),controller['queueNotify'](_0x52dd('0x44')));router[_0x52dd('0x4')](_0x52dd('0x45'),auth[_0x52dd('0x7')](),controller['showSmsQueues']);router[_0x52dd('0x4')](_0x52dd('0x46'),auth[_0x52dd('0x7')](),controller[_0x52dd('0x47')]);router[_0x52dd('0x34')]('/agents/:id/notify',auth[_0x52dd('0x7')](),controller[_0x52dd('0x48')]);module[_0x52dd('0x49')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index fab3a4e..6eb4464 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 _0x593a=['bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','http','client','request','then','code','message','result','catch','sendStatus','error','stack','name','status','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','Telephones','trunks','campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','TransferReport','create','queueTransferTimeout','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','InteractionId','Start','agentTransferTimeout','*,*,*,*'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x593a,0x1e0));var _0xa593=function(_0x9baf1b,_0x1aa60e){_0x9baf1b=_0x9baf1b-0x0;var _0x2b160f=_0x593a[_0x9baf1b];return _0x2b160f;};'use strict';var BPromise=require(_0xa593('0x0'));var moment=require(_0xa593('0x1'));var _=require(_0xa593('0x2'));var util=require(_0xa593('0x3'));var db=require(_0xa593('0x4'))['db'];var logger=require(_0xa593('0x5'))('api');var jayson=require(_0xa593('0x6'));var amiClient=jayson['client'][_0xa593('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0xa593('0x8')][_0xa593('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x22ed96,_0x1cd1ea,_0x198935){return new BPromise(function(_0x17abad,_0x2375aa){var _0x1d9b3e=_0x198935?_0x198935:amiClient;return _0x1d9b3e[_0xa593('0x9')](_0x22ed96,_0x1cd1ea)[_0xa593('0xa')](function(_0x215f58){if(_0x215f58['error']){if(_0x215f58['error'][_0xa593('0xb')]===0x1f4){return _0x2375aa(_0x215f58['error'][_0xa593('0xc')]);}return _0x17abad(_0x215f58['error']['message']);}else{_0x17abad(_0x215f58[_0xa593('0xd')]);}})[_0xa593('0xe')](function(_0x4ce481){_0x2375aa(_0x4ce481);});});}function respondWithResult(_0x1f90de,_0x19278c){_0x19278c=_0x19278c||0xc8;return function(_0xac40d2){if(_0xac40d2){return _0x1f90de['status'](_0x19278c)['json'](_0xac40d2);}return _0x1f90de[_0xa593('0xf')](0x194);};}function handleError(_0xc1cdfe,_0xce0fc){_0xce0fc=_0xce0fc||0x1f4;return function(_0x1e3d74){logger[_0xa593('0x10')](_0x1e3d74[_0xa593('0x11')]);if(_0x1e3d74[_0xa593('0x12')]){delete _0x1e3d74[_0xa593('0x12')];}_0xc1cdfe[_0xa593('0x13')](_0xce0fc)[_0xa593('0x14')](_0x1e3d74);};}function findById(_0x19b0ab){return function(_0x44691d){if(!_[_0xa593('0x15')](_0x19b0ab)&&!_[_0xa593('0x15')](_0x44691d)&&!_['isNil'](_0x44691d[_0xa593('0x16')])){return _[_0xa593('0x17')](_0x44691d[_0xa593('0x16')],function(_0x2dc04e){return _0x2dc04e['id']==_0x19b0ab;});}return null;};}exports[_0xa593('0x18')]=function(_0x53183c,_0x23923f){return respondWithRpcPromise('VoiceChannels',_0x53183c[_0xa593('0x19')])[_0xa593('0xa')](respondWithResult(_0x23923f,null))[_0xa593('0xe')](handleError(_0x23923f,null));};exports[_0xa593('0x1a')]=function(_0x5b744d,_0x583262){return respondWithRpcPromise(_0xa593('0x1b'),_[_0xa593('0x1c')](_0x5b744d[_0xa593('0x19')],_0x5b744d[_0xa593('0x1d')]))[_0xa593('0xa')](respondWithResult(_0x583262,null))[_0xa593('0xe')](handleError(_0x583262,null));};exports[_0xa593('0x1e')]=function(_0x44b2f7,_0xebab3f){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa593('0x1c')](_0x44b2f7['query'],_0x44b2f7[_0xa593('0x1d')]))['then'](respondWithResult(_0xebab3f,null))[_0xa593('0xe')](handleError(_0xebab3f,null));};exports[_0xa593('0x1f')]=function(_0x46f824,_0x2654c7){return respondWithRpcPromise(_0xa593('0x20'),_0x46f824['query'])['then'](respondWithResult(_0x2654c7,null))[_0xa593('0xe')](handleError(_0x2654c7,null));};exports['showVoiceQueues']=function(_0x24347f,_0x1aa808){return respondWithRpcPromise(_0xa593('0x20'),_0x24347f['query'])['then'](findById(_0x24347f['params']['id']))['then'](respondWithResult(_0x1aa808,null))[_0xa593('0xe')](handleError(_0x1aa808,null));};exports[_0xa593('0x21')]=function(_0x263795,_0x28716a){return respondWithRpcPromise(_0xa593('0x22'),_[_0xa593('0x1c')](_0x263795[_0xa593('0x19')],_0x263795[_0xa593('0x1d')]))[_0xa593('0xa')](respondWithResult(_0x28716a,null))[_0xa593('0xe')](handleError(_0x28716a,null));};exports['voiceQueuesChannels']=function(_0x3f9549,_0x483c3d){return respondWithRpcPromise(_0xa593('0x23'),_0x3f9549['query'])[_0xa593('0xa')](respondWithResult(_0x483c3d,null))[_0xa593('0xe')](handleError(_0x483c3d,null));};exports[_0xa593('0x24')]=function(_0x12a99d,_0x4c6396){return respondWithRpcPromise(_0xa593('0x25'),_[_0xa593('0x1c')](_0x12a99d[_0xa593('0x19')],_0x12a99d[_0xa593('0x1d')]))[_0xa593('0xa')](respondWithResult(_0x4c6396,null))['catch'](handleError(_0x4c6396,null));};exports[_0xa593('0x26')]=function(_0x458c52,_0x47f5f8){return respondWithRpcPromise(_0xa593('0x27'),_['merge'](_0x458c52[_0xa593('0x19')],_0x458c52['params']))[_0xa593('0xa')](respondWithResult(_0x47f5f8,null))['catch'](handleError(_0x47f5f8,null));};exports[_0xa593('0x28')]=function(_0x212a1a,_0x4704d8){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x212a1a[_0xa593('0x19')],_0x212a1a[_0xa593('0x1d')]))[_0xa593('0xa')](respondWithResult(_0x4704d8,null))[_0xa593('0xe')](handleError(_0x4704d8,null));};exports[_0xa593('0x29')]=function(_0x5e4fbd,_0x33a6ef){return respondWithRpcPromise(_0xa593('0x2a'),_0x5e4fbd[_0xa593('0x19')])[_0xa593('0xa')](respondWithResult(_0x33a6ef,null))[_0xa593('0xe')](handleError(_0x33a6ef,null));};exports[_0xa593('0x2b')]=function(_0x116cff,_0x335a86){return respondWithRpcPromise(_0xa593('0x2c'),_0x116cff[_0xa593('0x19')])[_0xa593('0xa')](respondWithResult(_0x335a86,null))[_0xa593('0xe')](handleError(_0x335a86,null));};exports[_0xa593('0x2d')]=function(_0x39db5e,_0x534b6c){var _0x134853;return respondWithRpcPromise(_0xa593('0x2e'),_0x39db5e[_0xa593('0x19')])[_0xa593('0xa')](function(_0x914282){_0x134853=_0x914282;return respondWithRpcPromise(_0xa593('0x2e'),_0x39db5e[_0xa593('0x19')],routingClient);})['then'](function(_0x154c85){return _['merge']({},_0x154c85,_0x134853);})['then'](respondWithResult(_0x534b6c,null))[_0xa593('0xe')](handleError(_0x534b6c,null));};exports[_0xa593('0x2f')]=function(_0x298873,_0x27f326){if(_0x298873[_0xa593('0x30')]&&_0x298873['body'][_0xa593('0x31')]&&_0x298873[_0xa593('0x32')]&&_0x298873[_0xa593('0x32')][_0xa593('0x12')]){for(var _0x130276 in _0x298873[_0xa593('0x30')][_0xa593('0x31')]){if(_0x298873[_0xa593('0x30')][_0xa593('0x31')][_0xa593('0x33')](_0x130276)){db[_0xa593('0x34')][_0xa593('0x35')]({'where':{'channel':_0x130276,'membername':_0x298873[_0xa593('0x32')][_0xa593('0x12')],'type':_0xa593('0x36'),'exitAt':null,'uniqueid':_0x298873[_0xa593('0x30')]['interaction'][_0x130276]&&_0x298873[_0xa593('0x30')][_0xa593('0x31')][_0x130276][_0xa593('0x37')]?{'$notIn':_0x298873[_0xa593('0x30')][_0xa593('0x31')][_0x130276]}:{'$ne':null}}})[_0xa593('0xa')](function(_0x1f69fd){var _0x267b4b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x27a15a=0x0,_0x41d241=_0x1f69fd[_0xa593('0x37')];_0x27a15a<_0x41d241;_0x27a15a+=0x1){_0x1f69fd[_0x27a15a][_0xa593('0x38')]({'exitAt':_0x267b4b});}});for(var _0x357b50=0x0;_0x357b50<_0x298873[_0xa593('0x30')][_0xa593('0x31')][_0x130276][_0xa593('0x37')];_0x357b50+=0x1){db[_0xa593('0x34')][_0xa593('0x39')]({'where':{'channel':_0x130276,'membername':_0x298873[_0xa593('0x32')][_0xa593('0x12')],'type':_0xa593('0x36'),'uniqueid':_0x298873[_0xa593('0x30')][_0xa593('0x31')][_0x130276][_0x357b50],'exitAt':null},'defaults':{'channel':_0x130276,'membername':_0x298873[_0xa593('0x32')][_0xa593('0x12')],'interface':_[_0xa593('0x15')](_0x298873['user'][_0xa593('0x3a')])?util['format'](_0xa593('0x3b'),_0x298873[_0xa593('0x32')]['name']):_0x298873[_0xa593('0x32')][_0xa593('0x3a')],'type':_0xa593('0x36'),'enterAt':moment()['format'](_0xa593('0x3c')),'role':_0xa593('0x3d'),'internal':_0x298873[_0xa593('0x32')][_0xa593('0x3e')],'uniqueid':_0x298873[_0xa593('0x30')][_0xa593('0x31')][_0x130276][_0x357b50]}});}}}}return respondWithRpcPromise(_0xa593('0x3f'),{'id':_0x298873['params']['id'],'capacity':_0x298873['body']['capacity']},routingClient)[_0xa593('0xa')](respondWithResult(_0x27f326,null))['catch'](handleError(_0x27f326,null));};exports['telephones']=function(_0x1b638c,_0x1cfd0b){return respondWithRpcPromise(_0xa593('0x40'),_0x1b638c[_0xa593('0x19')])[_0xa593('0xa')](respondWithResult(_0x1cfd0b,null))['catch'](handleError(_0x1cfd0b,null));};exports[_0xa593('0x41')]=function(_0x45dee8,_0x30f8a3){return respondWithRpcPromise('Trunks',_0x45dee8['query'])['then'](respondWithResult(_0x30f8a3,null))[_0xa593('0xe')](handleError(_0x30f8a3,null));};exports[_0xa593('0x42')]=function(_0x565063,_0x4bd61b){return respondWithRpcPromise('Campaigns',_0x565063['query'])[_0xa593('0xa')](respondWithResult(_0x4bd61b,null))['catch'](handleError(_0x4bd61b,null));};exports['chatQueues']=function(_0x4801a9,_0xb7e6f){return respondWithRpcPromise(_0xa593('0x43'),_0x4801a9[_0xa593('0x19')],routingClient)[_0xa593('0xa')](respondWithResult(_0xb7e6f,null))['catch'](handleError(_0xb7e6f,null));};exports[_0xa593('0x44')]=function(_0x105c8c,_0x20bf98){return respondWithRpcPromise(_0xa593('0x43'),_0x105c8c[_0xa593('0x19')],routingClient)[_0xa593('0xa')](findById(_0x105c8c[_0xa593('0x1d')]['id']))[_0xa593('0xa')](respondWithResult(_0x20bf98,null))[_0xa593('0xe')](handleError(_0x20bf98,null));};exports[_0xa593('0x45')]=function(_0x25392c,_0x40e34f){return respondWithRpcPromise('MailQueues',_0x25392c[_0xa593('0x19')],routingClient)[_0xa593('0xa')](respondWithResult(_0x40e34f,null))[_0xa593('0xe')](handleError(_0x40e34f,null));};exports['showMailQueues']=function(_0x2289eb,_0x5a1be8){return respondWithRpcPromise(_0xa593('0x46'),_0x2289eb[_0xa593('0x19')],routingClient)['then'](findById(_0x2289eb['params']['id']))[_0xa593('0xa')](respondWithResult(_0x5a1be8,null))[_0xa593('0xe')](handleError(_0x5a1be8,null));};exports[_0xa593('0x47')]=function(_0x280dc0,_0x37f208){return respondWithRpcPromise(_0xa593('0x48'),_0x280dc0[_0xa593('0x19')],mailClient)[_0xa593('0xa')](respondWithResult(_0x37f208,null))[_0xa593('0xe')](handleError(_0x37f208,null));};exports[_0xa593('0x49')]=function(_0x48a711,_0x4c78b4){return respondWithRpcPromise(_0xa593('0x4a'),_0x48a711['query'],routingClient)[_0xa593('0xa')](respondWithResult(_0x4c78b4,null))[_0xa593('0xe')](handleError(_0x4c78b4,null));};exports['showOpenchannelQueues']=function(_0x1deb1f,_0x3b68d0){return respondWithRpcPromise(_0xa593('0x4a'),_0x1deb1f[_0xa593('0x19')],routingClient)['then'](findById(_0x1deb1f[_0xa593('0x1d')]['id']))['then'](respondWithResult(_0x3b68d0,null))['catch'](handleError(_0x3b68d0,null));};exports[_0xa593('0x4b')]=function(_0x43ea09,_0x3737b0){return respondWithRpcPromise(_0xa593('0x4c'),_0x43ea09[_0xa593('0x19')],routingClient)[_0xa593('0xa')](respondWithResult(_0x3737b0,null))['catch'](handleError(_0x3737b0,null));};exports[_0xa593('0x4d')]=function(_0x1905db,_0x16313b){return respondWithRpcPromise(_0xa593('0x4c'),_0x1905db[_0xa593('0x19')],routingClient)[_0xa593('0xa')](findById(_0x1905db[_0xa593('0x1d')]['id']))[_0xa593('0xa')](respondWithResult(_0x16313b,null))['catch'](handleError(_0x16313b,null));};exports[_0xa593('0x4e')]=function(_0x10c245,_0x17643b){return respondWithRpcPromise(_0xa593('0x4f'),_0x10c245[_0xa593('0x19')],routingClient)['then'](respondWithResult(_0x17643b,null))[_0xa593('0xe')](handleError(_0x17643b,null));};exports[_0xa593('0x50')]=function(_0x5c7996,_0x5d2d6f){return respondWithRpcPromise(_0xa593('0x4f'),_0x5c7996[_0xa593('0x19')],routingClient)[_0xa593('0xa')](findById(_0x5c7996[_0xa593('0x1d')]['id']))['then'](respondWithResult(_0x5d2d6f,null))[_0xa593('0xe')](handleError(_0x5d2d6f,null));};exports[_0xa593('0x51')]=function(_0x1db178,_0x33eec2){return respondWithRpcPromise('FaxQueues',_0x1db178[_0xa593('0x19')],routingClient)[_0xa593('0xa')](respondWithResult(_0x33eec2,null))[_0xa593('0xe')](handleError(_0x33eec2,null));};exports[_0xa593('0x52')]=function(_0xd8c824,_0x14f3e2){return respondWithRpcPromise(_0xa593('0x53'),_0xd8c824['query'],routingClient)[_0xa593('0xa')](findById(_0xd8c824['params']['id']))[_0xa593('0xa')](respondWithResult(_0x14f3e2,null))[_0xa593('0xe')](handleError(_0x14f3e2,null));};exports['faxAccounts']=function(_0x5505d9,_0x4f0184){return respondWithRpcPromise('FaxAccounts',_0x5505d9[_0xa593('0x19')])[_0xa593('0xa')](respondWithResult(_0x4f0184,null))[_0xa593('0xe')](handleError(_0x4f0184,null));};exports[_0xa593('0x54')]=function(_0x3894a1,_0x162bfe){return respondWithRpcPromise(_0xa593('0x55'),_0x3894a1[_0xa593('0x19')],routingClient)[_0xa593('0xa')](respondWithResult(_0x162bfe,null))[_0xa593('0xe')](handleError(_0x162bfe,null));};exports[_0xa593('0x56')]=function(_0x2f55b6,_0x45a126){return respondWithRpcPromise(_0xa593('0x57'),_0x2f55b6[_0xa593('0x19')],routingClient)[_0xa593('0xa')](respondWithResult(_0x45a126,null))[_0xa593('0xe')](handleError(_0x45a126,null));};exports[_0xa593('0x58')]=function(_0x3f47ee,_0x14a2c0){return respondWithRpcPromise(_0xa593('0x59'),_0x3f47ee[_0xa593('0x19')],routingClient)[_0xa593('0xa')](respondWithResult(_0x14a2c0,null))[_0xa593('0xe')](handleError(_0x14a2c0,null));};exports[_0xa593('0x5a')]=function(_0x36789b,_0x904098){return respondWithRpcPromise(_0xa593('0x5b'),_0x36789b[_0xa593('0x19')],routingClient)['then'](respondWithResult(_0x904098,null))[_0xa593('0xe')](handleError(_0x904098,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x368b1,_0xe351aa){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x368b1[_0xa593('0x19')],routingClient)[_0xa593('0xa')](respondWithResult(_0xe351aa,null))['catch'](handleError(_0xe351aa,null));};exports[_0xa593('0x5c')]=function(_0x5e910d,_0x2cfdc6){return respondWithRpcPromise(_0xa593('0x5d'),_0x5e910d[_0xa593('0x19')],routingClient)['then'](respondWithResult(_0x2cfdc6,null))[_0xa593('0xe')](handleError(_0x2cfdc6,null));};exports[_0xa593('0x5e')]=function(_0x180c5b){return function(_0x5dbe61,_0x3856ff){var _0x4c17fc,_0x310637;var _0x2c9b7d=_[_0xa593('0x5f')](_0x180c5b);var _0x4bfe49=_0x180c5b===_0xa593('0x60')?_0xa593('0x61'):_0xa593('0x62');return db[_0x2c9b7d+_0xa593('0x63')]['findOne']({'raw':!![],'where':{'id':_0x5dbe61[_0xa593('0x1d')]['id']}})[_0xa593('0xa')](function(_0x7f2ff5){if(_['isNil'](_0x7f2ff5)){throw new Error(_0x2c9b7d+_0xa593('0x64'));}_0x4c17fc=_0x7f2ff5;return db[_0x2c9b7d+_0xa593('0x65')]['findOne']({'where':{'id':_0x5dbe61[_0xa593('0x30')][_0xa593('0x66')]},'include':[{'model':db[_0x2c9b7d+_0xa593('0x67')],'as':_0xa593('0x67')},{'model':db[_0x2c9b7d+_0x4bfe49],'as':_0xa593('0x62')}]});})[_0xa593('0xa')](function(_0x36a908){if(_[_0xa593('0x15')](_0x36a908)){throw new Error(_0x2c9b7d+_0xa593('0x68'));}_0x310637=_0x36a908;return _0x36a908[_0xa593('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x149940={'uniqueid':_0x180c5b+'.'+_0x310637['id']+'.'+_0x310637[_0xa593('0x67')]['id'],'FromUserId':_0x5dbe61[_0xa593('0x32')]['id'],'type':_0xa593('0x6a')};_0x149940[_0x2c9b7d+_0xa593('0x6b')]=_0x310637['id'];_0x149940[_0x2c9b7d+'InteractionId']=_0x310637[_0xa593('0x67')]['id'];_0x149940[_0xa593('0x6c')+_0x2c9b7d+_0x4bfe49+'Id']=_0x310637['Account']['id'];_0x149940['To'+_0x2c9b7d+'QueueId']=_0x4c17fc['id'];return db[_0x2c9b7d+_0xa593('0x6d')][_0xa593('0x6e')](_0x149940);})[_0xa593('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x180c5b,'interaction':_0x310637[_0xa593('0x67')],'message':_0x310637,'account':_0x310637[_0xa593('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4c17fc[_0xa593('0x12')]+','+(_0x310637[_0xa593('0x62')][_0xa593('0x6f')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x3856ff,null))[_0xa593('0xe')](handleError(_0x3856ff,null));};};exports['agentNotify']=function(_0xabb4ec,_0x2d5187){var _0x412970,_0x34d63f;if(_[_0xa593('0x15')](_0xabb4ec['body'][_0xa593('0x70')])){throw new Error(_0xa593('0x71'));}var _0x3d6107=_0xabb4ec['body'][_0xa593('0x70')];var _0x2e0fe3=_['capitalize'](_0x3d6107);var _0x296ef9=_0x3d6107===_0xa593('0x60')?_0xa593('0x61'):_0xa593('0x62');return db[_0xa593('0x72')]['findOne']({'raw':!![],'where':{'id':_0xabb4ec['params']['id'],'role':_0xa593('0x3d')}})[_0xa593('0xa')](function(_0x575585){if(_[_0xa593('0x15')](_0x575585)){throw new Error(_0xa593('0x73'));}_0x412970=_0x575585;return db[_0x2e0fe3+_0xa593('0x65')]['findOne']({'where':{'id':_0xabb4ec[_0xa593('0x30')][_0xa593('0x66')]},'include':[{'model':db[_0x2e0fe3+_0xa593('0x67')],'as':_0xa593('0x67')},{'model':db[_0x2e0fe3+_0x296ef9],'as':_0xa593('0x62')}]});})[_0xa593('0xa')](function(_0x2d7c97){if(_[_0xa593('0x15')](_0x2d7c97)){throw new Error(_0x2e0fe3+_0xa593('0x68'));}_0x34d63f=_0x2d7c97;return _0x2d7c97['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xa593('0xa')](function(){var _0x2d6ce1={'uniqueid':_0x3d6107+'.'+_0x34d63f['id']+'.'+_0x34d63f['Interaction']['id'],'FromUserId':_0xabb4ec[_0xa593('0x32')]['id'],'type':'queue','ToUserId':_0x412970['id']};_0x2d6ce1[_0x2e0fe3+'MessageId']=_0x34d63f['id'];_0x2d6ce1[_0x2e0fe3+_0xa593('0x74')]=_0x34d63f['Interaction']['id'];_0x2d6ce1[_0xa593('0x6c')+_0x2e0fe3+_0x296ef9+'Id']=_0x34d63f[_0xa593('0x62')]['id'];return db[_0x2e0fe3+_0xa593('0x6d')]['create'](_0x2d6ce1);})['then'](function(){return respondWithRpcPromise(_0xa593('0x75'),{'channel':_0x3d6107,'interaction':_0x34d63f[_0xa593('0x67')],'message':_0x34d63f,'account':_0x34d63f[_0xa593('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa593('0x3d'),'appdata':_0x412970['name']+','+(_0x34d63f[_0xa593('0x62')][_0xa593('0x76')]||0x12c),'interval':_0xa593('0x77')}]},routingClient);})[_0xa593('0xa')](respondWithResult(_0x2d5187,null))[_0xa593('0xe')](handleError(_0x2d5187,null));}; \ No newline at end of file +var _0xc3af=['MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Message','findOne','Interaction','\x20Message\x20not\x20found','update','InteractionId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','messageId','queue','MessageId','From','TransferReport','agentTransferTimeout','bluebird','moment','util','../../config/logger','client','http','request','error','code','message','catch','json','sendStatus','stack','status','send','isNil','rows','find','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','name','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues'];(function(_0xeaa3bd,_0x166691){var _0x2e1174=function(_0x310580){while(--_0x310580){_0xeaa3bd['push'](_0xeaa3bd['shift']());}};_0x2e1174(++_0x166691);}(_0xc3af,0x112));var _0xfc3a=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xc3af[_0x2112d4];return _0x434972;};'use strict';var BPromise=require(_0xfc3a('0x0'));var moment=require(_0xfc3a('0x1'));var _=require('lodash');var util=require(_0xfc3a('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xfc3a('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0xfc3a('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0xfc3a('0x4')][_0xfc3a('0x5')]({'port':0x232b});var routingClient=jayson[_0xfc3a('0x4')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1333e6,_0x2b1858,_0x2704e9){return new BPromise(function(_0x20ec18,_0x27c443){var _0xac5d69=_0x2704e9?_0x2704e9:amiClient;return _0xac5d69[_0xfc3a('0x6')](_0x1333e6,_0x2b1858)['then'](function(_0x13a666){if(_0x13a666[_0xfc3a('0x7')]){if(_0x13a666[_0xfc3a('0x7')][_0xfc3a('0x8')]===0x1f4){return _0x27c443(_0x13a666[_0xfc3a('0x7')][_0xfc3a('0x9')]);}return _0x20ec18(_0x13a666[_0xfc3a('0x7')][_0xfc3a('0x9')]);}else{_0x20ec18(_0x13a666['result']);}})[_0xfc3a('0xa')](function(_0x6fa360){_0x27c443(_0x6fa360);});});}function respondWithResult(_0x2ffee1,_0x3381a7){_0x3381a7=_0x3381a7||0xc8;return function(_0x49a296){if(_0x49a296){return _0x2ffee1['status'](_0x3381a7)[_0xfc3a('0xb')](_0x49a296);}return _0x2ffee1[_0xfc3a('0xc')](0x194);};}function handleError(_0x20fe84,_0x3e7ce6){_0x3e7ce6=_0x3e7ce6||0x1f4;return function(_0x9c8b15){logger['error'](_0x9c8b15[_0xfc3a('0xd')]);if(_0x9c8b15['name']){delete _0x9c8b15['name'];}_0x20fe84[_0xfc3a('0xe')](_0x3e7ce6)[_0xfc3a('0xf')](_0x9c8b15);};}function findById(_0x4f0214){return function(_0x77b153){if(!_['isNil'](_0x4f0214)&&!_[_0xfc3a('0x10')](_0x77b153)&&!_[_0xfc3a('0x10')](_0x77b153[_0xfc3a('0x11')])){return _[_0xfc3a('0x12')](_0x77b153['rows'],function(_0x1c4bc5){return _0x1c4bc5['id']==_0x4f0214;});}return null;};}exports['voiceChannels']=function(_0x430d31,_0x20d85b){return respondWithRpcPromise(_0xfc3a('0x13'),_0x430d31[_0xfc3a('0x14')])[_0xfc3a('0x15')](respondWithResult(_0x20d85b,null))[_0xfc3a('0xa')](handleError(_0x20d85b,null));};exports[_0xfc3a('0x16')]=function(_0x360501,_0x4e40ec){return respondWithRpcPromise(_0xfc3a('0x17'),_[_0xfc3a('0x18')](_0x360501[_0xfc3a('0x14')],_0x360501[_0xfc3a('0x19')]))[_0xfc3a('0x15')](respondWithResult(_0x4e40ec,null))['catch'](handleError(_0x4e40ec,null));};exports[_0xfc3a('0x1a')]=function(_0x367d49,_0x35b42d){return respondWithRpcPromise(_0xfc3a('0x1b'),_[_0xfc3a('0x18')](_0x367d49['query'],_0x367d49[_0xfc3a('0x19')]))[_0xfc3a('0x15')](respondWithResult(_0x35b42d,null))['catch'](handleError(_0x35b42d,null));};exports[_0xfc3a('0x1c')]=function(_0x42f3a1,_0xaf4f9b){return respondWithRpcPromise(_0xfc3a('0x1d'),_0x42f3a1[_0xfc3a('0x14')])['then'](respondWithResult(_0xaf4f9b,null))[_0xfc3a('0xa')](handleError(_0xaf4f9b,null));};exports['showVoiceQueues']=function(_0x41c639,_0x4436f6){return respondWithRpcPromise(_0xfc3a('0x1d'),_0x41c639[_0xfc3a('0x14')])['then'](findById(_0x41c639['params']['id']))[_0xfc3a('0x15')](respondWithResult(_0x4436f6,null))[_0xfc3a('0xa')](handleError(_0x4436f6,null));};exports[_0xfc3a('0x1e')]=function(_0x40cafb,_0x12b826){return respondWithRpcPromise(_0xfc3a('0x1f'),_[_0xfc3a('0x18')](_0x40cafb[_0xfc3a('0x14')],_0x40cafb['params']))[_0xfc3a('0x15')](respondWithResult(_0x12b826,null))[_0xfc3a('0xa')](handleError(_0x12b826,null));};exports[_0xfc3a('0x20')]=function(_0xb38514,_0x392f53){return respondWithRpcPromise(_0xfc3a('0x21'),_0xb38514['query'])['then'](respondWithResult(_0x392f53,null))[_0xfc3a('0xa')](handleError(_0x392f53,null));};exports[_0xfc3a('0x22')]=function(_0x43b8f8,_0x2c7510){return respondWithRpcPromise(_0xfc3a('0x23'),_['merge'](_0x43b8f8[_0xfc3a('0x14')],_0x43b8f8[_0xfc3a('0x19')]))[_0xfc3a('0x15')](respondWithResult(_0x2c7510,null))[_0xfc3a('0xa')](handleError(_0x2c7510,null));};exports[_0xfc3a('0x24')]=function(_0x288d5e,_0x51fdcf){return respondWithRpcPromise(_0xfc3a('0x25'),_[_0xfc3a('0x18')](_0x288d5e['query'],_0x288d5e[_0xfc3a('0x19')]))['then'](respondWithResult(_0x51fdcf,null))[_0xfc3a('0xa')](handleError(_0x51fdcf,null));};exports[_0xfc3a('0x26')]=function(_0x54c28c,_0x121616){return respondWithRpcPromise(_0xfc3a('0x27'),_[_0xfc3a('0x18')](_0x54c28c[_0xfc3a('0x14')],_0x54c28c[_0xfc3a('0x19')]))['then'](respondWithResult(_0x121616,null))['catch'](handleError(_0x121616,null));};exports[_0xfc3a('0x28')]=function(_0x2b0409,_0x4739f9){return respondWithRpcPromise(_0xfc3a('0x29'),_0x2b0409['query'])[_0xfc3a('0x15')](respondWithResult(_0x4739f9,null))[_0xfc3a('0xa')](handleError(_0x4739f9,null));};exports[_0xfc3a('0x2a')]=function(_0x146c02,_0x31ae32){return respondWithRpcPromise(_0xfc3a('0x2b'),_0x146c02[_0xfc3a('0x14')])[_0xfc3a('0x15')](respondWithResult(_0x31ae32,null))[_0xfc3a('0xa')](handleError(_0x31ae32,null));};exports[_0xfc3a('0x2c')]=function(_0x3b77f4,_0x20e109){var _0x34c873;return respondWithRpcPromise(_0xfc3a('0x2d'),_0x3b77f4['query'])['then'](function(_0x3c51ae){_0x34c873=_0x3c51ae;return respondWithRpcPromise(_0xfc3a('0x2d'),_0x3b77f4[_0xfc3a('0x14')],routingClient);})[_0xfc3a('0x15')](function(_0x2eeaa1){return _[_0xfc3a('0x18')]({},_0x2eeaa1,_0x34c873);})[_0xfc3a('0x15')](respondWithResult(_0x20e109,null))['catch'](handleError(_0x20e109,null));};exports['agentCapacity']=function(_0x3ee211,_0x335fba){if(_0x3ee211[_0xfc3a('0x2e')]&&_0x3ee211[_0xfc3a('0x2e')]['interaction']&&_0x3ee211[_0xfc3a('0x2f')]&&_0x3ee211[_0xfc3a('0x2f')][_0xfc3a('0x30')]){for(var _0x44fc73 in _0x3ee211['body'][_0xfc3a('0x31')]){if(_0x3ee211[_0xfc3a('0x2e')]['interaction']['hasOwnProperty'](_0x44fc73)){db[_0xfc3a('0x32')][_0xfc3a('0x33')]({'where':{'channel':_0x44fc73,'membername':_0x3ee211[_0xfc3a('0x2f')][_0xfc3a('0x30')],'type':_0xfc3a('0x34'),'exitAt':null,'uniqueid':_0x3ee211[_0xfc3a('0x2e')][_0xfc3a('0x31')][_0x44fc73]&&_0x3ee211[_0xfc3a('0x2e')]['interaction'][_0x44fc73][_0xfc3a('0x35')]?{'$notIn':_0x3ee211['body']['interaction'][_0x44fc73]}:{'$ne':null}}})[_0xfc3a('0x15')](function(_0x39af6f){var _0x8caedf=moment()[_0xfc3a('0x36')](_0xfc3a('0x37'));for(var _0x4d85ea=0x0,_0x1d4f21=_0x39af6f[_0xfc3a('0x35')];_0x4d85ea<_0x1d4f21;_0x4d85ea+=0x1){_0x39af6f[_0x4d85ea]['updateAttributes']({'exitAt':_0x8caedf});}});for(var _0x50357a=0x0;_0x50357a<_0x3ee211['body'][_0xfc3a('0x31')][_0x44fc73]['length'];_0x50357a+=0x1){db[_0xfc3a('0x32')]['findOrCreate']({'where':{'channel':_0x44fc73,'membername':_0x3ee211[_0xfc3a('0x2f')]['name'],'type':_0xfc3a('0x34'),'uniqueid':_0x3ee211[_0xfc3a('0x2e')]['interaction'][_0x44fc73][_0x50357a],'exitAt':null},'defaults':{'channel':_0x44fc73,'membername':_0x3ee211[_0xfc3a('0x2f')]['name'],'interface':_[_0xfc3a('0x10')](_0x3ee211[_0xfc3a('0x2f')][_0xfc3a('0x38')])?util[_0xfc3a('0x36')]('SIP/%s',_0x3ee211[_0xfc3a('0x2f')]['name']):_0x3ee211['user'][_0xfc3a('0x38')],'type':_0xfc3a('0x34'),'enterAt':moment()[_0xfc3a('0x36')](_0xfc3a('0x37')),'role':_0xfc3a('0x39'),'internal':_0x3ee211[_0xfc3a('0x2f')][_0xfc3a('0x3a')],'uniqueid':_0x3ee211[_0xfc3a('0x2e')][_0xfc3a('0x31')][_0x44fc73][_0x50357a]}});}}}}return respondWithRpcPromise(_0xfc3a('0x3b'),{'id':_0x3ee211[_0xfc3a('0x19')]['id'],'capacity':_0x3ee211[_0xfc3a('0x2e')][_0xfc3a('0x3c')]},routingClient)[_0xfc3a('0x15')](respondWithResult(_0x335fba,null))[_0xfc3a('0xa')](handleError(_0x335fba,null));};exports[_0xfc3a('0x3d')]=function(_0x1b129a,_0x27c8b2){return respondWithRpcPromise(_0xfc3a('0x3e'),_0x1b129a[_0xfc3a('0x14')])[_0xfc3a('0x15')](respondWithResult(_0x27c8b2,null))[_0xfc3a('0xa')](handleError(_0x27c8b2,null));};exports['trunks']=function(_0x6b3d09,_0x5045c1){return respondWithRpcPromise(_0xfc3a('0x3f'),_0x6b3d09[_0xfc3a('0x14')])[_0xfc3a('0x15')](respondWithResult(_0x5045c1,null))[_0xfc3a('0xa')](handleError(_0x5045c1,null));};exports[_0xfc3a('0x40')]=function(_0x535f93,_0x56b666){return respondWithRpcPromise('Campaigns',_0x535f93[_0xfc3a('0x14')])[_0xfc3a('0x15')](respondWithResult(_0x56b666,null))['catch'](handleError(_0x56b666,null));};exports[_0xfc3a('0x41')]=function(_0x40b7b3,_0xcc9968){return respondWithRpcPromise(_0xfc3a('0x42'),_0x40b7b3['query'],routingClient)['then'](respondWithResult(_0xcc9968,null))[_0xfc3a('0xa')](handleError(_0xcc9968,null));};exports[_0xfc3a('0x43')]=function(_0x5ed964,_0xbc97b2){return respondWithRpcPromise(_0xfc3a('0x42'),_0x5ed964[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](findById(_0x5ed964[_0xfc3a('0x19')]['id']))['then'](respondWithResult(_0xbc97b2,null))[_0xfc3a('0xa')](handleError(_0xbc97b2,null));};exports['mailQueues']=function(_0x357842,_0x342b65){return respondWithRpcPromise(_0xfc3a('0x44'),_0x357842[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](respondWithResult(_0x342b65,null))[_0xfc3a('0xa')](handleError(_0x342b65,null));};exports[_0xfc3a('0x45')]=function(_0x58a4f8,_0x155320){return respondWithRpcPromise(_0xfc3a('0x44'),_0x58a4f8[_0xfc3a('0x14')],routingClient)['then'](findById(_0x58a4f8[_0xfc3a('0x19')]['id']))[_0xfc3a('0x15')](respondWithResult(_0x155320,null))[_0xfc3a('0xa')](handleError(_0x155320,null));};exports[_0xfc3a('0x46')]=function(_0x5cadb8,_0x13d424){return respondWithRpcPromise(_0xfc3a('0x47'),_0x5cadb8[_0xfc3a('0x14')],mailClient)[_0xfc3a('0x15')](respondWithResult(_0x13d424,null))[_0xfc3a('0xa')](handleError(_0x13d424,null));};exports[_0xfc3a('0x48')]=function(_0x5611e0,_0x561d89){return respondWithRpcPromise('OpenchannelQueues',_0x5611e0[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](respondWithResult(_0x561d89,null))[_0xfc3a('0xa')](handleError(_0x561d89,null));};exports[_0xfc3a('0x49')]=function(_0x49b89e,_0x23ddff){return respondWithRpcPromise(_0xfc3a('0x4a'),_0x49b89e[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](findById(_0x49b89e[_0xfc3a('0x19')]['id']))[_0xfc3a('0x15')](respondWithResult(_0x23ddff,null))['catch'](handleError(_0x23ddff,null));};exports[_0xfc3a('0x4b')]=function(_0xedc648,_0x365a9d){return respondWithRpcPromise('SmsQueues',_0xedc648['query'],routingClient)['then'](respondWithResult(_0x365a9d,null))[_0xfc3a('0xa')](handleError(_0x365a9d,null));};exports[_0xfc3a('0x4c')]=function(_0x16736b,_0x271d7c){return respondWithRpcPromise(_0xfc3a('0x4d'),_0x16736b[_0xfc3a('0x14')],routingClient)['then'](findById(_0x16736b[_0xfc3a('0x19')]['id']))[_0xfc3a('0x15')](respondWithResult(_0x271d7c,null))[_0xfc3a('0xa')](handleError(_0x271d7c,null));};exports[_0xfc3a('0x4e')]=function(_0x2909c4,_0x3c053b){return respondWithRpcPromise(_0xfc3a('0x4f'),_0x2909c4[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](respondWithResult(_0x3c053b,null))[_0xfc3a('0xa')](handleError(_0x3c053b,null));};exports['showWhatsappQueues']=function(_0x3ebf13,_0x3eb53d){return respondWithRpcPromise('WhatsappQueues',_0x3ebf13[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](findById(_0x3ebf13[_0xfc3a('0x19')]['id']))[_0xfc3a('0x15')](respondWithResult(_0x3eb53d,null))[_0xfc3a('0xa')](handleError(_0x3eb53d,null));};exports[_0xfc3a('0x50')]=function(_0x4b0b76,_0x33252b){return respondWithRpcPromise(_0xfc3a('0x51'),_0x4b0b76[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](respondWithResult(_0x33252b,null))['catch'](handleError(_0x33252b,null));};exports['showFaxQueues']=function(_0x228469,_0x3be370){return respondWithRpcPromise('FaxQueues',_0x228469[_0xfc3a('0x14')],routingClient)['then'](findById(_0x228469[_0xfc3a('0x19')]['id']))['then'](respondWithResult(_0x3be370,null))[_0xfc3a('0xa')](handleError(_0x3be370,null));};exports[_0xfc3a('0x52')]=function(_0x539c86,_0x2ed1f){return respondWithRpcPromise('FaxAccounts',_0x539c86['query'])[_0xfc3a('0x15')](respondWithResult(_0x2ed1f,null))['catch'](handleError(_0x2ed1f,null));};exports[_0xfc3a('0x53')]=function(_0x352448,_0x1a02d9){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x352448[_0xfc3a('0x14')],routingClient)['then'](respondWithResult(_0x1a02d9,null))[_0xfc3a('0xa')](handleError(_0x1a02d9,null));};exports['mailQueuesWaitingInteractions']=function(_0x63dc11,_0x484e0a){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x63dc11[_0xfc3a('0x14')],routingClient)['then'](respondWithResult(_0x484e0a,null))[_0xfc3a('0xa')](handleError(_0x484e0a,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x175d77,_0x837370){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x175d77[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](respondWithResult(_0x837370,null))[_0xfc3a('0xa')](handleError(_0x837370,null));};exports[_0xfc3a('0x54')]=function(_0x2fc65e,_0x17808d){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2fc65e['query'],routingClient)[_0xfc3a('0x15')](respondWithResult(_0x17808d,null))[_0xfc3a('0xa')](handleError(_0x17808d,null));};exports[_0xfc3a('0x55')]=function(_0x96ea95,_0x55547c){return respondWithRpcPromise(_0xfc3a('0x56'),_0x96ea95[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](respondWithResult(_0x55547c,null))[_0xfc3a('0xa')](handleError(_0x55547c,null));};exports[_0xfc3a('0x57')]=function(_0xce1b83,_0x142569){return respondWithRpcPromise(_0xfc3a('0x58'),_0xce1b83[_0xfc3a('0x14')],routingClient)[_0xfc3a('0x15')](respondWithResult(_0x142569,null))['catch'](handleError(_0x142569,null));};exports[_0xfc3a('0x59')]=function(_0x10a9de){return function(_0x18ea64,_0x7d10fd){var _0x317546,_0x221c8d;var _0x25c7e1=_[_0xfc3a('0x5a')](_0x10a9de);var _0x3f48ef=_0x10a9de===_0xfc3a('0x5b')?_0xfc3a('0x5c'):_0xfc3a('0x5d');return db[_0x25c7e1+'Queue']['findOne']({'raw':!![],'where':{'id':_0x18ea64['params']['id']}})[_0xfc3a('0x15')](function(_0x9a0e35){if(_[_0xfc3a('0x10')](_0x9a0e35)){throw new Error(_0x25c7e1+'\x20Queue\x20not\x20found');}_0x317546=_0x9a0e35;return db[_0x25c7e1+_0xfc3a('0x5e')][_0xfc3a('0x5f')]({'where':{'id':_0x18ea64[_0xfc3a('0x2e')]['messageId']},'include':[{'model':db[_0x25c7e1+_0xfc3a('0x60')],'as':'Interaction'},{'model':db[_0x25c7e1+_0x3f48ef],'as':_0xfc3a('0x5d')}]});})[_0xfc3a('0x15')](function(_0x4529cd){if(_[_0xfc3a('0x10')](_0x4529cd)){throw new Error(_0x25c7e1+_0xfc3a('0x61'));}_0x221c8d=_0x4529cd;return _0x4529cd[_0xfc3a('0x62')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfc3a('0x15')](function(){var _0x5d99a6={'uniqueid':_0x10a9de+'.'+_0x221c8d['id']+'.'+_0x221c8d[_0xfc3a('0x60')]['id'],'FromUserId':_0x18ea64[_0xfc3a('0x2f')]['id'],'type':'queue'};_0x5d99a6[_0x25c7e1+'MessageId']=_0x221c8d['id'];_0x5d99a6[_0x25c7e1+_0xfc3a('0x63')]=_0x221c8d[_0xfc3a('0x60')]['id'];_0x5d99a6['From'+_0x25c7e1+_0x3f48ef+'Id']=_0x221c8d[_0xfc3a('0x5d')]['id'];_0x5d99a6['To'+_0x25c7e1+'QueueId']=_0x317546['id'];return db[_0x25c7e1+'TransferReport'][_0xfc3a('0x64')](_0x5d99a6);})[_0xfc3a('0x15')](function(){return respondWithRpcPromise(_0xfc3a('0x65'),{'channel':_0x10a9de,'interaction':_0x221c8d['Interaction'],'message':_0x221c8d,'account':_0x221c8d[_0xfc3a('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x317546[_0xfc3a('0x30')]+','+(_0x221c8d[_0xfc3a('0x5d')][_0xfc3a('0x66')]||0x12c),'interval':_0xfc3a('0x67')}]},routingClient);})['then'](respondWithResult(_0x7d10fd,null))[_0xfc3a('0xa')](handleError(_0x7d10fd,null));};};exports[_0xfc3a('0x68')]=function(_0x19b1e2,_0x268b28){var _0x37472f,_0x5e470d;if(_[_0xfc3a('0x10')](_0x19b1e2['body'][_0xfc3a('0x69')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4f7f5c=_0x19b1e2[_0xfc3a('0x2e')]['channel'];var _0x22606a=_[_0xfc3a('0x5a')](_0x4f7f5c);var _0x431e4c=_0x4f7f5c===_0xfc3a('0x5b')?_0xfc3a('0x5c'):'Account';return db[_0xfc3a('0x6a')][_0xfc3a('0x5f')]({'raw':!![],'where':{'id':_0x19b1e2[_0xfc3a('0x19')]['id'],'role':_0xfc3a('0x39')}})['then'](function(_0xc0775c){if(_['isNil'](_0xc0775c)){throw new Error(_0xfc3a('0x6b'));}_0x37472f=_0xc0775c;return db[_0x22606a+_0xfc3a('0x5e')][_0xfc3a('0x5f')]({'where':{'id':_0x19b1e2['body'][_0xfc3a('0x6c')]},'include':[{'model':db[_0x22606a+_0xfc3a('0x60')],'as':_0xfc3a('0x60')},{'model':db[_0x22606a+_0x431e4c],'as':_0xfc3a('0x5d')}]});})[_0xfc3a('0x15')](function(_0x58107c){if(_['isNil'](_0x58107c)){throw new Error(_0x22606a+_0xfc3a('0x61'));}_0x5e470d=_0x58107c;return _0x58107c[_0xfc3a('0x62')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfc3a('0x15')](function(){var _0x5a2bbd={'uniqueid':_0x4f7f5c+'.'+_0x5e470d['id']+'.'+_0x5e470d[_0xfc3a('0x60')]['id'],'FromUserId':_0x19b1e2['user']['id'],'type':_0xfc3a('0x6d'),'ToUserId':_0x37472f['id']};_0x5a2bbd[_0x22606a+_0xfc3a('0x6e')]=_0x5e470d['id'];_0x5a2bbd[_0x22606a+_0xfc3a('0x63')]=_0x5e470d[_0xfc3a('0x60')]['id'];_0x5a2bbd[_0xfc3a('0x6f')+_0x22606a+_0x431e4c+'Id']=_0x5e470d[_0xfc3a('0x5d')]['id'];return db[_0x22606a+_0xfc3a('0x70')][_0xfc3a('0x64')](_0x5a2bbd);})[_0xfc3a('0x15')](function(){return respondWithRpcPromise(_0xfc3a('0x65'),{'channel':_0x4f7f5c,'interaction':_0x5e470d[_0xfc3a('0x60')],'message':_0x5e470d,'account':_0x5e470d[_0xfc3a('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfc3a('0x39'),'appdata':_0x37472f['name']+','+(_0x5e470d[_0xfc3a('0x5d')][_0xfc3a('0x71')]||0x12c),'interval':_0xfc3a('0x67')}]},routingClient);})[_0xfc3a('0x15')](respondWithResult(_0x268b28,null))['catch'](handleError(_0x268b28,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3a3599d..af6f0ce 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 _0x8431=['isAuthenticated','get','/:id/run','run','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','index'];(function(_0x420bf9,_0x47f00e){var _0x34b9d1=function(_0x2b489c){while(--_0x2b489c){_0x420bf9['push'](_0x420bf9['shift']());}};_0x34b9d1(++_0x47f00e);}(_0x8431,0x114));var _0x1843=function(_0x3e7529,_0x338890){_0x3e7529=_0x3e7529-0x0;var _0x1325eb=_0x8431[_0x3e7529];return _0x1325eb;};'use strict';var multer=require('multer');var util=require(_0x1843('0x0'));var path=require(_0x1843('0x1'));var timeout=require(_0x1843('0x2'));var express=require(_0x1843('0x3'));var router=express[_0x1843('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1843('0x5'));var config=require(_0x1843('0x6'));var controller=require(_0x1843('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1843('0x8')]);router['get']('/:id',auth[_0x1843('0x9')](),controller['show']);router[_0x1843('0xa')](_0x1843('0xb'),auth[_0x1843('0x9')](),controller[_0x1843('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1843('0xd')]);router[_0x1843('0xe')]('/:id',auth[_0x1843('0x9')](),controller[_0x1843('0xf')]);router[_0x1843('0x10')]('/:id',auth[_0x1843('0x9')](),controller[_0x1843('0x11')]);module[_0x1843('0x12')]=router; \ No newline at end of file +var _0x6f2a=['/:id','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','run','post','create','put'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x6f2a,0x180));var _0xa6f2=function(_0x4af4ad,_0x1f35e7){_0x4af4ad=_0x4af4ad-0x0;var _0x129d83=_0x6f2a[_0x4af4ad];return _0x129d83;};'use strict';var multer=require(_0xa6f2('0x0'));var util=require(_0xa6f2('0x1'));var path=require(_0xa6f2('0x2'));var timeout=require('connect-timeout');var express=require(_0xa6f2('0x3'));var router=express[_0xa6f2('0x4')]();var auth=require(_0xa6f2('0x5'));var interaction=require(_0xa6f2('0x6'));var config=require(_0xa6f2('0x7'));var controller=require(_0xa6f2('0x8'));router[_0xa6f2('0x9')]('/',auth[_0xa6f2('0xa')](),controller[_0xa6f2('0xb')]);router[_0xa6f2('0x9')]('/:id',auth[_0xa6f2('0xa')](),controller['show']);router['get']('/:id/run',auth[_0xa6f2('0xa')](),controller[_0xa6f2('0xc')]);router[_0xa6f2('0xd')]('/',auth[_0xa6f2('0xa')](),controller[_0xa6f2('0xe')]);router[_0xa6f2('0xf')](_0xa6f2('0x10'),auth[_0xa6f2('0xa')](),controller[_0xa6f2('0x11')]);router[_0xa6f2('0x12')](_0xa6f2('0x10'),auth[_0xa6f2('0xa')](),controller['destroy']);module[_0xa6f2('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 072a156..325e86a 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 _0xd101=['quarters','months','weeks','days','hours','minutes','ENUM','csv','pdf','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years'];(function(_0x4b7dc1,_0x1dfb7f){var _0xdc081a=function(_0x2b4d31){while(--_0x2b4d31){_0x4b7dc1['push'](_0x4b7dc1['shift']());}};_0xdc081a(++_0x1dfb7f);}(_0xd101,0xc1));var _0x1d10=function(_0x440298,_0x258648){_0x440298=_0x440298-0x0;var _0x503513=_0xd101[_0x440298];return _0x503513;};'use strict';var Sequelize=require(_0x1d10('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1d10('0x1')]},'active':{'type':Sequelize[_0x1d10('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![],'defaultValue':_0x1d10('0x3')},'startAt':{'type':Sequelize[_0x1d10('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x1d10('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1d10('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x1d10('0x6'),_0x1d10('0x7'),_0x1d10('0x8'),_0x1d10('0x9'),_0x1d10('0xa'),_0x1d10('0xb'),_0x1d10('0xc')),'allowNull':![],'defaultValue':_0x1d10('0xa')},'output':{'type':Sequelize[_0x1d10('0xd')](_0x1d10('0xe'),_0x1d10('0xf'),_0x1d10('0x10')),'allowNull':![],'defaultValue':_0x1d10('0xe')},'type':{'type':Sequelize[_0x1d10('0xd')](_0x1d10('0x11'),_0x1d10('0x12')),'allowNull':![],'defaultValue':_0x1d10('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x1d10('0x1')]},'cc':{'type':Sequelize[_0x1d10('0x13')]},'bcc':{'type':Sequelize[_0x1d10('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x1d10('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xae30=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','custom','TEXT'];(function(_0x28f0f7,_0x5e43cb){var _0x14eabb=function(_0x4ef470){while(--_0x4ef470){_0x28f0f7['push'](_0x28f0f7['shift']());}};_0x14eabb(++_0x5e43cb);}(_0xae30,0x10a));var _0x0ae3=function(_0x2e4b84,_0x2092ce){_0x2e4b84=_0x2e4b84-0x0;var _0x38af1e=_0xae30[_0x2e4b84];return _0x38af1e;};'use strict';var Sequelize=require(_0x0ae3('0x0'));module[_0x0ae3('0x1')]={'name':{'type':Sequelize[_0x0ae3('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0ae3('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0ae3('0x2')],'allowNull':![],'defaultValue':_0x0ae3('0x4')},'startAt':{'type':Sequelize[_0x0ae3('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0ae3('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0ae3('0x7')](_0x0ae3('0x8'),_0x0ae3('0x9'),_0x0ae3('0xa'),_0x0ae3('0xb'),_0x0ae3('0xc'),_0x0ae3('0xd'),_0x0ae3('0xe')),'allowNull':![],'defaultValue':_0x0ae3('0xc')},'output':{'type':Sequelize[_0x0ae3('0x7')](_0x0ae3('0xf'),_0x0ae3('0x10'),'xlsx'),'allowNull':![],'defaultValue':_0x0ae3('0xf')},'type':{'type':Sequelize[_0x0ae3('0x7')]('custom','default'),'allowNull':![],'defaultValue':_0x0ae3('0x11')},'sendMail':{'type':Sequelize[_0x0ae3('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0ae3('0x2')]},'cc':{'type':Sequelize[_0x0ae3('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 7cd9a93..47572a3 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 _0x021f=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs'];(function(_0x5defb7,_0x83bad4){var _0xd61214=function(_0x564689){while(--_0x564689){_0x5defb7['push'](_0x5defb7['shift']());}};_0xd61214(++_0x83bad4);}(_0x021f,0xa2));var _0xf021=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x021f[_0x4ae6ef];return _0x3cbb4e;};'use strict';var pdf=require(_0xf021('0x0'));var emlformat=require(_0xf021('0x1'));var rimraf=require(_0xf021('0x2'));var zipdir=require(_0xf021('0x3'));var jsonpatch=require(_0xf021('0x4'));var rp=require(_0xf021('0x5'));var moment=require(_0xf021('0x6'));var BPromise=require(_0xf021('0x7'));var Mustache=require('mustache');var util=require(_0xf021('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf021('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf021('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf021('0xb'));var Papa=require(_0xf021('0xc'));var Redis=require(_0xf021('0xd'));var authService=require(_0xf021('0xe'));var qs=require(_0xf021('0xf'));var as=require(_0xf021('0x10'));var hardwareService=require(_0xf021('0x11'));var logger=require(_0xf021('0x12'))(_0xf021('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf021('0x14'))['db'];function respondWithStatusCode(_0x16cd37,_0xe3ecd2){_0xe3ecd2=_0xe3ecd2||0xcc;return function(_0x14652c){if(_0x14652c){return _0x16cd37[_0xf021('0x15')](_0xe3ecd2);}return _0x16cd37[_0xf021('0x16')](_0xe3ecd2)[_0xf021('0x17')]();};}function respondWithResult(_0x56b174,_0x759b90){_0x759b90=_0x759b90||0xc8;return function(_0x2cec84){if(_0x2cec84){return _0x56b174[_0xf021('0x16')](_0x759b90)[_0xf021('0x18')](_0x2cec84);}};}function respondWithFilteredResult(_0x4c9fed,_0x1dd6f1){return function(_0x2a4f34){if(_0x2a4f34){var _0x638d71=_0x2a4f34[_0xf021('0x19')],_0x30347e=_0x1dd6f1[_0xf021('0x1a')],_0x2d3373=_0x1dd6f1[_0xf021('0x1a')]+_0x1dd6f1[_0xf021('0x1b')],_0x3eb330;if(_0x2d3373>=_0x638d71){_0x2d3373=_0x638d71;_0x3eb330=0xc8;}else{_0x3eb330=0xce;}_0x4c9fed[_0xf021('0x16')](_0x3eb330);return _0x4c9fed[_0xf021('0x1c')](_0xf021('0x1d'),_0x30347e+'-'+_0x2d3373+'/'+_0x638d71)['json'](_0x2a4f34);}return null;};}function patchUpdates(_0x3e7391){return function(_0x50fd42){try{jsonpatch[_0xf021('0x1e')](_0x50fd42,_0x3e7391,!![]);}catch(_0x4a51cf){return BPromise[_0xf021('0x1f')](_0x4a51cf);}return _0x50fd42[_0xf021('0x20')]();};}function saveUpdates(_0x3c0e29,_0x2857b8){return function(_0x8591ec){if(_0x8591ec){return _0x8591ec[_0xf021('0x21')](_0x3c0e29)[_0xf021('0x22')](function(_0x30c13c){return _0x30c13c;});}return null;};}function removeEntity(_0x2157d3,_0x223314){return function(_0x3fd912){if(_0x3fd912){return _0x3fd912['destroy']()[_0xf021('0x22')](function(){var _0x2d8f94=_0x3fd912['get']({'plain':!![]});var _0x1883d7=_0xf021('0x23');return db[_0xf021('0x24')][_0xf021('0x25')]({'where':{'type':_0x1883d7,'resourceId':_0x2d8f94['id']}})[_0xf021('0x22')](function(){return _0x3fd912;});})[_0xf021('0x22')](function(){_0x2157d3[_0xf021('0x16')](0xcc)[_0xf021('0x17')]();});}};}function handleEntityNotFound(_0x15a845,_0x2984d4){return function(_0x473a39){if(!_0x473a39){_0x15a845[_0xf021('0x15')](0x194);}return _0x473a39;};}function handleError(_0x397df6,_0x30d636){_0x30d636=_0x30d636||0x1f4;return function(_0x56173f){logger[_0xf021('0x26')](_0x56173f[_0xf021('0x27')]);if(_0x56173f[_0xf021('0x28')]){delete _0x56173f[_0xf021('0x28')];}_0x397df6[_0xf021('0x16')](_0x30d636)[_0xf021('0x29')](_0x56173f);};}exports[_0xf021('0x2a')]=function(_0x1168fc,_0x292f1d){var _0x1f529d={},_0x40ead7={},_0x36ffd2={'count':0x0,'rows':[]};var _0x4c9136=_[_0xf021('0x2b')](db[_0xf021('0x2c')][_0xf021('0x2d')],function(_0xf7e158){return{'name':_0xf7e158[_0xf021('0x2e')],'type':_0xf7e158[_0xf021('0x2f')][_0xf021('0x30')]};});_0x40ead7[_0xf021('0x31')]=_[_0xf021('0x2b')](_0x4c9136,_0xf021('0x28'));_0x40ead7['query']=_[_0xf021('0x32')](_0x1168fc['query']);_0x40ead7[_0xf021('0x33')]=_['intersection'](_0x40ead7[_0xf021('0x31')],_0x40ead7[_0xf021('0x34')]);_0x1f529d[_0xf021('0x35')]=_[_0xf021('0x36')](_0x40ead7[_0xf021('0x31')],qs['fields'](_0x1168fc['query'][_0xf021('0x37')]));_0x1f529d['attributes']=_0x1f529d['attributes'][_0xf021('0x38')]?_0x1f529d[_0xf021('0x35')]:_0x40ead7[_0xf021('0x31')];if(!_0x1168fc[_0xf021('0x34')][_0xf021('0x39')](_0xf021('0x3a'))){_0x1f529d[_0xf021('0x1b')]=qs[_0xf021('0x1b')](_0x1168fc[_0xf021('0x34')][_0xf021('0x1b')]);_0x1f529d[_0xf021('0x1a')]=qs[_0xf021('0x1a')](_0x1168fc[_0xf021('0x34')]['offset']);}_0x1f529d[_0xf021('0x3b')]=qs['sort'](_0x1168fc[_0xf021('0x34')][_0xf021('0x3c')]);_0x1f529d[_0xf021('0x3d')]=qs[_0xf021('0x33')](_[_0xf021('0x3e')](_0x1168fc[_0xf021('0x34')],_0x40ead7[_0xf021('0x33')]),_0x4c9136);if(_0x1168fc[_0xf021('0x34')][_0xf021('0x3f')]){_0x1f529d[_0xf021('0x3d')]=_[_0xf021('0x40')](_0x1f529d[_0xf021('0x3d')],{'$or':_[_0xf021('0x2b')](_0x4c9136,function(_0x478f41){if(_0x478f41[_0xf021('0x2f')]!==_0xf021('0x41')){var _0x27eb15={};_0x27eb15[_0x478f41[_0xf021('0x28')]]={'$like':'%'+_0x1168fc[_0xf021('0x34')][_0xf021('0x3f')]+'%'};return _0x27eb15;}})});}_0x1f529d=_[_0xf021('0x40')]({},_0x1f529d,_0x1168fc[_0xf021('0x42')]);var _0x58e6cc={'where':_0x1f529d[_0xf021('0x3d')]};return db[_0xf021('0x2c')][_0xf021('0x19')](_0x58e6cc)[_0xf021('0x22')](function(_0x3e7539){_0x36ffd2[_0xf021('0x19')]=_0x3e7539;if(_0x1168fc[_0xf021('0x34')]['includeAll']){_0x1f529d[_0xf021('0x43')]=[{'all':!![]}];}return db[_0xf021('0x2c')][_0xf021('0x44')](_0x1f529d);})[_0xf021('0x22')](function(_0x4b80be){_0x36ffd2[_0xf021('0x45')]=_0x4b80be;return _0x36ffd2;})[_0xf021('0x22')](respondWithFilteredResult(_0x292f1d,_0x1f529d))[_0xf021('0x46')](handleError(_0x292f1d,null));};exports['show']=function(_0x4c206d,_0x14f96e){var _0x20bf87={'raw':![],'where':{'id':_0x4c206d[_0xf021('0x47')]['id']}},_0x51c7e4={};_0x51c7e4[_0xf021('0x31')]=_[_0xf021('0x32')](db[_0xf021('0x2c')][_0xf021('0x2d')]);_0x51c7e4[_0xf021('0x34')]=_[_0xf021('0x32')](_0x4c206d['query']);_0x51c7e4[_0xf021('0x33')]=_[_0xf021('0x36')](_0x51c7e4[_0xf021('0x31')],_0x51c7e4[_0xf021('0x34')]);_0x20bf87[_0xf021('0x35')]=_[_0xf021('0x36')](_0x51c7e4[_0xf021('0x31')],qs[_0xf021('0x37')](_0x4c206d[_0xf021('0x34')]['fields']));_0x20bf87[_0xf021('0x35')]=_0x20bf87['attributes']['length']?_0x20bf87[_0xf021('0x35')]:_0x51c7e4[_0xf021('0x31')];if(_0x4c206d['query'][_0xf021('0x48')]){_0x20bf87['include']=[{'all':!![]}];}_0x20bf87=_[_0xf021('0x40')]({},_0x20bf87,_0x4c206d['options']);return db[_0xf021('0x2c')][_0xf021('0x49')](_0x20bf87)[_0xf021('0x22')](handleEntityNotFound(_0x14f96e,null))[_0xf021('0x22')](respondWithResult(_0x14f96e,null))[_0xf021('0x46')](handleError(_0x14f96e,null));};exports[_0xf021('0x4a')]=function(_0x5c02e2,_0x431f12){return db[_0xf021('0x2c')]['create'](_0x5c02e2[_0xf021('0x4b')],{})[_0xf021('0x22')](function(_0x57bd01){var _0x3b100a=_0x5c02e2[_0xf021('0x4c')][_0xf021('0x4d')]({'plain':!![]});if(!_0x3b100a)throw new Error(_0xf021('0x4e'));if(_0x3b100a[_0xf021('0x4f')]===_0xf021('0x4c')){var _0x314981=_0x57bd01[_0xf021('0x4d')]({'plain':!![]});var _0x3b159c='Scheduler';return db[_0xf021('0x50')][_0xf021('0x49')]({'where':{'name':_0x3b159c,'userProfileId':_0x3b100a[_0xf021('0x51')]},'raw':!![]})[_0xf021('0x22')](function(_0x6250cb){if(_0x6250cb&&_0x6250cb[_0xf021('0x52')]===0x0){return db[_0xf021('0x24')][_0xf021('0x4a')]({'name':_0x314981['name'],'resourceId':_0x314981['id'],'type':_0x6250cb[_0xf021('0x28')],'sectionId':_0x6250cb['id']},{})[_0xf021('0x22')](function(){return _0x57bd01;});}else{return _0x57bd01;}})['catch'](function(_0x53240d){logger['error'](_0xf021('0x53'),_0x53240d);throw _0x53240d;});}return _0x57bd01;})['then'](respondWithResult(_0x431f12,0xc9))['catch'](handleError(_0x431f12,null));};exports[_0xf021('0x21')]=function(_0x20092a,_0x5bacad){if(_0x20092a[_0xf021('0x4b')]['id']){delete _0x20092a[_0xf021('0x4b')]['id'];}return db[_0xf021('0x2c')][_0xf021('0x49')]({'where':{'id':_0x20092a[_0xf021('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bacad,null))['then'](saveUpdates(_0x20092a[_0xf021('0x4b')],null))[_0xf021('0x22')](respondWithResult(_0x5bacad,null))[_0xf021('0x46')](handleError(_0x5bacad,null));};exports['destroy']=function(_0x505da8,_0x4b9653){return db[_0xf021('0x2c')]['find']({'where':{'id':_0x505da8['params']['id']}})['then'](handleEntityNotFound(_0x4b9653,null))['then'](removeEntity(_0x4b9653,null))['catch'](handleError(_0x4b9653,null));};exports[_0xf021('0x54')]=function(_0x5396d7,_0x3ac921,_0x53b628){var _0x10610f=require(_0xf021('0x55'));return db['Schedule'][_0xf021('0x49')]({'where':{'id':_0x5396d7[_0xf021('0x47')]['id']},'raw':!![]})[_0xf021('0x22')](handleEntityNotFound(_0x3ac921,null))[_0xf021('0x22')](function(){_0x10610f[_0xf021('0x54')](_0x5396d7[_0xf021('0x47')]['id']);})[_0xf021('0x22')](respondWithStatusCode(_0x3ac921,null))['catch'](handleError(_0x3ac921,null));}; \ No newline at end of file +var _0x4554=['filter','merge','type','options','Schedule','include','rows','catch','show','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','params','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters'];(function(_0x3cfccb,_0x201cc2){var _0x5c6cd4=function(_0x5454cd){while(--_0x5454cd){_0x3cfccb['push'](_0x3cfccb['shift']());}};_0x5c6cd4(++_0x201cc2);}(_0x4554,0x160));var _0x4455=function(_0x5f0b13,_0x4ee2ea){_0x5f0b13=_0x5f0b13-0x0;var _0xebe8d8=_0x4554[_0x5f0b13];return _0xebe8d8;};'use strict';var pdf=require(_0x4455('0x0'));var emlformat=require(_0x4455('0x1'));var rimraf=require(_0x4455('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4455('0x3'));var rp=require(_0x4455('0x4'));var moment=require('moment');var BPromise=require(_0x4455('0x5'));var Mustache=require(_0x4455('0x6'));var util=require(_0x4455('0x7'));var path=require(_0x4455('0x8'));var sox=require(_0x4455('0x9'));var csv=require(_0x4455('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4455('0xb'));var squel=require(_0x4455('0xc'));var crypto=require('crypto');var jsforce=require(_0x4455('0xd'));var deskjs=require(_0x4455('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4455('0xf'));var Papa=require(_0x4455('0x10'));var Redis=require(_0x4455('0x11'));var authService=require(_0x4455('0x12'));var qs=require(_0x4455('0x13'));var as=require(_0x4455('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4455('0x15'))(_0x4455('0x16'));var utils=require('../../config/utils');var config=require(_0x4455('0x17'));var db=require(_0x4455('0x18'))['db'];function respondWithStatusCode(_0x53b9ab,_0x5e4298){_0x5e4298=_0x5e4298||0xcc;return function(_0x3a9f77){if(_0x3a9f77){return _0x53b9ab[_0x4455('0x19')](_0x5e4298);}return _0x53b9ab[_0x4455('0x1a')](_0x5e4298)[_0x4455('0x1b')]();};}function respondWithResult(_0x5915ff,_0x2c18db){_0x2c18db=_0x2c18db||0xc8;return function(_0x4d935e){if(_0x4d935e){return _0x5915ff['status'](_0x2c18db)[_0x4455('0x1c')](_0x4d935e);}};}function respondWithFilteredResult(_0x3655e1,_0x220b64){return function(_0x195d53){if(_0x195d53){var _0x5af4b5=_0x195d53[_0x4455('0x1d')],_0x5e3e59=_0x220b64['offset'],_0x5f24a7=_0x220b64['offset']+_0x220b64[_0x4455('0x1e')],_0x151b9d;if(_0x5f24a7>=_0x5af4b5){_0x5f24a7=_0x5af4b5;_0x151b9d=0xc8;}else{_0x151b9d=0xce;}_0x3655e1[_0x4455('0x1a')](_0x151b9d);return _0x3655e1[_0x4455('0x1f')](_0x4455('0x20'),_0x5e3e59+'-'+_0x5f24a7+'/'+_0x5af4b5)['json'](_0x195d53);}return null;};}function patchUpdates(_0x55d1ec){return function(_0x45e980){try{jsonpatch[_0x4455('0x21')](_0x45e980,_0x55d1ec,!![]);}catch(_0x1db12f){return BPromise[_0x4455('0x22')](_0x1db12f);}return _0x45e980[_0x4455('0x23')]();};}function saveUpdates(_0x13c5c2,_0x1fec34){return function(_0x1a0221){if(_0x1a0221){return _0x1a0221[_0x4455('0x24')](_0x13c5c2)[_0x4455('0x25')](function(_0x1a3d60){return _0x1a3d60;});}return null;};}function removeEntity(_0x333cdc,_0x51e3f9){return function(_0x6400b3){if(_0x6400b3){return _0x6400b3[_0x4455('0x26')]()[_0x4455('0x25')](function(){var _0x6d3e16=_0x6400b3[_0x4455('0x27')]({'plain':!![]});var _0x3cd098='Scheduler';return db[_0x4455('0x28')][_0x4455('0x26')]({'where':{'type':_0x3cd098,'resourceId':_0x6d3e16['id']}})['then'](function(){return _0x6400b3;});})['then'](function(){_0x333cdc[_0x4455('0x1a')](0xcc)[_0x4455('0x1b')]();});}};}function handleEntityNotFound(_0x35e936,_0x375552){return function(_0x19fbd7){if(!_0x19fbd7){_0x35e936[_0x4455('0x19')](0x194);}return _0x19fbd7;};}function handleError(_0x44cc8e,_0x211cec){_0x211cec=_0x211cec||0x1f4;return function(_0x13c95f){logger[_0x4455('0x29')](_0x13c95f['stack']);if(_0x13c95f[_0x4455('0x2a')]){delete _0x13c95f[_0x4455('0x2a')];}_0x44cc8e[_0x4455('0x1a')](_0x211cec)[_0x4455('0x2b')](_0x13c95f);};}exports[_0x4455('0x2c')]=function(_0x1362fe,_0x2e5bc4){var _0x598220={},_0xbb53a={},_0x188b17={'count':0x0,'rows':[]};var _0x64506=_['map'](db['Schedule'][_0x4455('0x2d')],function(_0x272fbf){return{'name':_0x272fbf['fieldName'],'type':_0x272fbf['type'][_0x4455('0x2e')]};});_0xbb53a[_0x4455('0x2f')]=_[_0x4455('0x30')](_0x64506,_0x4455('0x2a'));_0xbb53a[_0x4455('0x31')]=_[_0x4455('0x32')](_0x1362fe[_0x4455('0x31')]);_0xbb53a['filters']=_['intersection'](_0xbb53a[_0x4455('0x2f')],_0xbb53a[_0x4455('0x31')]);_0x598220['attributes']=_[_0x4455('0x33')](_0xbb53a[_0x4455('0x2f')],qs[_0x4455('0x34')](_0x1362fe[_0x4455('0x31')]['fields']));_0x598220['attributes']=_0x598220[_0x4455('0x35')][_0x4455('0x36')]?_0x598220['attributes']:_0xbb53a[_0x4455('0x2f')];if(!_0x1362fe[_0x4455('0x31')][_0x4455('0x37')](_0x4455('0x38'))){_0x598220['limit']=qs[_0x4455('0x1e')](_0x1362fe[_0x4455('0x31')][_0x4455('0x1e')]);_0x598220['offset']=qs[_0x4455('0x39')](_0x1362fe['query']['offset']);}_0x598220[_0x4455('0x3a')]=qs['sort'](_0x1362fe['query'][_0x4455('0x3b')]);_0x598220[_0x4455('0x3c')]=qs['filters'](_[_0x4455('0x3d')](_0x1362fe[_0x4455('0x31')],_0xbb53a[_0x4455('0x3e')]),_0x64506);if(_0x1362fe[_0x4455('0x31')][_0x4455('0x3f')]){_0x598220[_0x4455('0x3c')]=_[_0x4455('0x40')](_0x598220[_0x4455('0x3c')],{'$or':_[_0x4455('0x30')](_0x64506,function(_0x46c4a9){if(_0x46c4a9[_0x4455('0x41')]!=='VIRTUAL'){var _0x15e82a={};_0x15e82a[_0x46c4a9[_0x4455('0x2a')]]={'$like':'%'+_0x1362fe[_0x4455('0x31')][_0x4455('0x3f')]+'%'};return _0x15e82a;}})});}_0x598220=_[_0x4455('0x40')]({},_0x598220,_0x1362fe[_0x4455('0x42')]);var _0x269021={'where':_0x598220['where']};return db[_0x4455('0x43')]['count'](_0x269021)['then'](function(_0x13eea5){_0x188b17[_0x4455('0x1d')]=_0x13eea5;if(_0x1362fe[_0x4455('0x31')]['includeAll']){_0x598220[_0x4455('0x44')]=[{'all':!![]}];}return db[_0x4455('0x43')]['findAll'](_0x598220);})['then'](function(_0x23406e){_0x188b17[_0x4455('0x45')]=_0x23406e;return _0x188b17;})[_0x4455('0x25')](respondWithFilteredResult(_0x2e5bc4,_0x598220))[_0x4455('0x46')](handleError(_0x2e5bc4,null));};exports[_0x4455('0x47')]=function(_0xf6ab31,_0x5a1d21){var _0x474fa4={'raw':![],'where':{'id':_0xf6ab31['params']['id']}},_0x4f69aa={};_0x4f69aa[_0x4455('0x2f')]=_[_0x4455('0x32')](db['Schedule'][_0x4455('0x2d')]);_0x4f69aa[_0x4455('0x31')]=_[_0x4455('0x32')](_0xf6ab31['query']);_0x4f69aa[_0x4455('0x3e')]=_[_0x4455('0x33')](_0x4f69aa[_0x4455('0x2f')],_0x4f69aa[_0x4455('0x31')]);_0x474fa4[_0x4455('0x35')]=_[_0x4455('0x33')](_0x4f69aa[_0x4455('0x2f')],qs['fields'](_0xf6ab31[_0x4455('0x31')][_0x4455('0x34')]));_0x474fa4['attributes']=_0x474fa4[_0x4455('0x35')]['length']?_0x474fa4[_0x4455('0x35')]:_0x4f69aa[_0x4455('0x2f')];if(_0xf6ab31[_0x4455('0x31')][_0x4455('0x48')]){_0x474fa4['include']=[{'all':!![]}];}_0x474fa4=_[_0x4455('0x40')]({},_0x474fa4,_0xf6ab31[_0x4455('0x42')]);return db[_0x4455('0x43')][_0x4455('0x49')](_0x474fa4)[_0x4455('0x25')](handleEntityNotFound(_0x5a1d21,null))[_0x4455('0x25')](respondWithResult(_0x5a1d21,null))[_0x4455('0x46')](handleError(_0x5a1d21,null));};exports[_0x4455('0x4a')]=function(_0x4a82b8,_0x55dfdc){return db[_0x4455('0x43')][_0x4455('0x4a')](_0x4a82b8['body'],{})[_0x4455('0x25')](function(_0x3dbf11){var _0x12f70c=_0x4a82b8[_0x4455('0x4b')][_0x4455('0x27')]({'plain':!![]});if(!_0x12f70c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12f70c[_0x4455('0x4c')]===_0x4455('0x4b')){var _0x1e6bf3=_0x3dbf11['get']({'plain':!![]});var _0x245b38='Scheduler';return db[_0x4455('0x4d')][_0x4455('0x49')]({'where':{'name':_0x245b38,'userProfileId':_0x12f70c[_0x4455('0x4e')]},'raw':!![]})[_0x4455('0x25')](function(_0x176085){if(_0x176085&&_0x176085[_0x4455('0x4f')]===0x0){return db[_0x4455('0x28')][_0x4455('0x4a')]({'name':_0x1e6bf3[_0x4455('0x2a')],'resourceId':_0x1e6bf3['id'],'type':_0x176085[_0x4455('0x2a')],'sectionId':_0x176085['id']},{})['then'](function(){return _0x3dbf11;});}else{return _0x3dbf11;}})['catch'](function(_0x3ce4f9){logger[_0x4455('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ce4f9);throw _0x3ce4f9;});}return _0x3dbf11;})[_0x4455('0x25')](respondWithResult(_0x55dfdc,0xc9))[_0x4455('0x46')](handleError(_0x55dfdc,null));};exports[_0x4455('0x24')]=function(_0x1dc83f,_0x4dcfde){if(_0x1dc83f['body']['id']){delete _0x1dc83f['body']['id'];}return db[_0x4455('0x43')][_0x4455('0x49')]({'where':{'id':_0x1dc83f['params']['id']}})[_0x4455('0x25')](handleEntityNotFound(_0x4dcfde,null))[_0x4455('0x25')](saveUpdates(_0x1dc83f[_0x4455('0x50')],null))[_0x4455('0x25')](respondWithResult(_0x4dcfde,null))[_0x4455('0x46')](handleError(_0x4dcfde,null));};exports['destroy']=function(_0x3a7d44,_0x4020d3){return db['Schedule'][_0x4455('0x49')]({'where':{'id':_0x3a7d44[_0x4455('0x51')]['id']}})[_0x4455('0x25')](handleEntityNotFound(_0x4020d3,null))[_0x4455('0x25')](removeEntity(_0x4020d3,null))[_0x4455('0x46')](handleError(_0x4020d3,null));};exports[_0x4455('0x52')]=function(_0x1ef97c,_0x176fa6,_0x4f12bd){var _0x1948e8=require('../../config/schedule');return db[_0x4455('0x43')][_0x4455('0x49')]({'where':{'id':_0x1ef97c[_0x4455('0x51')]['id']},'raw':!![]})[_0x4455('0x25')](handleEntityNotFound(_0x176fa6,null))[_0x4455('0x25')](function(){_0x1948e8[_0x4455('0x52')](_0x1ef97c['params']['id']);})[_0x4455('0x25')](respondWithStatusCode(_0x176fa6,null))['catch'](handleError(_0x176fa6,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 2c93178..52d1429 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 _0x165a=['path','rimraf','exports','Schedule','tools_schedules','util','api','bluebird','request-promise'];(function(_0x4daf29,_0x2f6680){var _0x2bf1a9=function(_0x2277ec){while(--_0x2277ec){_0x4daf29['push'](_0x4daf29['shift']());}};_0x2bf1a9(++_0x2f6680);}(_0x165a,0xa7));var _0xa165=function(_0x4aaeea,_0xf1a7ae){_0x4aaeea=_0x4aaeea-0x0;var _0x447e0f=_0x165a[_0x4aaeea];return _0x447e0f;};'use strict';var _=require('lodash');var util=require(_0xa165('0x0'));var logger=require('../../config/logger')(_0xa165('0x1'));var moment=require('moment');var BPromise=require(_0xa165('0x2'));var rp=require(_0xa165('0x3'));var fs=require('fs');var path=require(_0xa165('0x4'));var rimraf=require(_0xa165('0x5'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xa165('0x6')]=function(_0x5224fd,_0x18dc63){return _0x5224fd['define'](_0xa165('0x7'),attributes,{'tableName':_0xa165('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4804=['request-promise','../../config/environment','./schedule.attributes','tools_schedules','lodash','util','../../config/logger','moment'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x4804,0xac));var _0x4480=function(_0xa42e21,_0x3f0bcb){_0xa42e21=_0xa42e21-0x0;var _0x17d113=_0x4804[_0xa42e21];return _0x17d113;};'use strict';var _=require(_0x4480('0x0'));var util=require(_0x4480('0x1'));var logger=require(_0x4480('0x2'))('api');var moment=require(_0x4480('0x3'));var BPromise=require('bluebird');var rp=require(_0x4480('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4480('0x5'));var attributes=require(_0x4480('0x6'));module['exports']=function(_0x4734ba,_0x5bdaae){return _0x4734ba['define']('Schedule',attributes,{'tableName':_0x4480('0x7'),'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 9c0bd12..9414448 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 _0xbf82=['Schedule,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d9751,_0x2e4521){var _0xda7320=function(_0x504282){while(--_0x504282){_0x4d9751['push'](_0x4d9751['shift']());}};_0xda7320(++_0x2e4521);}(_0xbf82,0xed));var _0x2bf8=function(_0x1b2e65,_0x41368){_0x1b2e65=_0x1b2e65-0x0;var _0x1525fd=_0xbf82[_0x1b2e65];return _0x1525fd;};'use strict';var _=require('lodash');var util=require(_0x2bf8('0x0'));var moment=require(_0x2bf8('0x1'));var BPromise=require('bluebird');var rs=require(_0x2bf8('0x2'));var fs=require('fs');var Redis=require(_0x2bf8('0x3'));var db=require(_0x2bf8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bf8('0x5'))(_0x2bf8('0x6'));var config=require(_0x2bf8('0x7'));var jayson=require(_0x2bf8('0x8'));var client=jayson[_0x2bf8('0x9')][_0x2bf8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x292e4c,_0x1489e4,_0x5da605){return new BPromise(function(_0x2fd73a,_0x57166b){return client[_0x2bf8('0xb')](_0x292e4c,_0x5da605)[_0x2bf8('0xc')](function(_0x43d783){logger['info'](_0x2bf8('0xd'),_0x1489e4,_0x2bf8('0xe'));logger[_0x2bf8('0xf')](_0x2bf8('0x10'),_0x1489e4,'request\x20sent',JSON['stringify'](_0x43d783));if(_0x43d783[_0x2bf8('0x11')]){if(_0x43d783['error'][_0x2bf8('0x12')]===0x1f4){logger[_0x2bf8('0x11')](_0x2bf8('0xd'),_0x1489e4,_0x43d783[_0x2bf8('0x11')]['message']);return _0x57166b(_0x43d783[_0x2bf8('0x11')]['message']);}logger[_0x2bf8('0x11')](_0x2bf8('0xd'),_0x1489e4,_0x43d783['error'][_0x2bf8('0x13')]);return _0x2fd73a(_0x43d783[_0x2bf8('0x11')]['message']);}else{logger[_0x2bf8('0x14')](_0x2bf8('0xd'),_0x1489e4,_0x2bf8('0xe'));_0x2fd73a(_0x43d783[_0x2bf8('0x15')]['message']);}})[_0x2bf8('0x16')](function(_0x4fe48f){logger[_0x2bf8('0x11')](_0x2bf8('0xd'),_0x1489e4,_0x4fe48f);_0x57166b(_0x4fe48f);});});} \ No newline at end of file +var _0x8370=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util'];(function(_0x142987,_0x3fba38){var _0x4e82e0=function(_0x9430c8){while(--_0x9430c8){_0x142987['push'](_0x142987['shift']());}};_0x4e82e0(++_0x3fba38);}(_0x8370,0xbc));var _0x0837=function(_0x51154b,_0x20242d){_0x51154b=_0x51154b-0x0;var _0x338ccf=_0x8370[_0x51154b];return _0x338ccf;};'use strict';var _=require('lodash');var util=require(_0x0837('0x0'));var moment=require(_0x0837('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0837('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0837('0x3'));var logger=require(_0x0837('0x4'))(_0x0837('0x5'));var config=require(_0x0837('0x6'));var jayson=require(_0x0837('0x7'));var client=jayson[_0x0837('0x8')][_0x0837('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x203a6c,_0x30b1e5,_0x1d899a){return new BPromise(function(_0x1b7cb3,_0x53c3bb){return client[_0x0837('0xa')](_0x203a6c,_0x1d899a)[_0x0837('0xb')](function(_0x23ee88){logger['info'](_0x0837('0xc'),_0x30b1e5,_0x0837('0xd'));logger['debug'](_0x0837('0xe'),_0x30b1e5,_0x0837('0xd'),JSON[_0x0837('0xf')](_0x23ee88));if(_0x23ee88[_0x0837('0x10')]){if(_0x23ee88[_0x0837('0x10')][_0x0837('0x11')]===0x1f4){logger[_0x0837('0x10')](_0x0837('0xc'),_0x30b1e5,_0x23ee88[_0x0837('0x10')][_0x0837('0x12')]);return _0x53c3bb(_0x23ee88['error'][_0x0837('0x12')]);}logger[_0x0837('0x10')](_0x0837('0xc'),_0x30b1e5,_0x23ee88[_0x0837('0x10')][_0x0837('0x12')]);return _0x1b7cb3(_0x23ee88[_0x0837('0x10')][_0x0837('0x12')]);}else{logger[_0x0837('0x13')](_0x0837('0xc'),_0x30b1e5,'request\x20sent');_0x1b7cb3(_0x23ee88['result'][_0x0837('0x12')]);}})[_0x0837('0x14')](function(_0x2e8fbf){logger[_0x0837('0x10')](_0x0837('0xc'),_0x30b1e5,_0x2e8fbf);_0x53c3bb(_0x2e8fbf);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 65fac76..ed158d9 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 _0x4a38=['/describe','isAuthenticated','describe','/:id','show','get','/:id/download','download','post','create','put','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./screenRecording.controller'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4a38,0x176));var _0x84a3=function(_0x1f8b68,_0x4c91a7){_0x1f8b68=_0x1f8b68-0x0;var _0xb497c8=_0x4a38[_0x1f8b68];return _0xb497c8;};'use strict';var multer=require('multer');var util=require(_0x84a3('0x0'));var path=require(_0x84a3('0x1'));var timeout=require(_0x84a3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x84a3('0x3'));var interaction=require(_0x84a3('0x4'));var config=require('../../config/environment');var controller=require(_0x84a3('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x84a3('0x6'),auth[_0x84a3('0x7')](),controller[_0x84a3('0x8')]);router['get'](_0x84a3('0x9'),auth[_0x84a3('0x7')](),controller[_0x84a3('0xa')]);router[_0x84a3('0xb')](_0x84a3('0xc'),auth[_0x84a3('0x7')](),controller[_0x84a3('0xd')]);router[_0x84a3('0xe')]('/',auth[_0x84a3('0x7')](),controller[_0x84a3('0xf')]);router[_0x84a3('0x10')](_0x84a3('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x84a3('0x11')](_0x84a3('0x9'),auth['isAuthenticated'](),controller[_0x84a3('0x12')]);module[_0x84a3('0x13')]=router; \ No newline at end of file +var _0xe165=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','download','post','put','update'];(function(_0x48234b,_0xa7d760){var _0x224daf=function(_0x3ae9be){while(--_0x3ae9be){_0x48234b['push'](_0x48234b['shift']());}};_0x224daf(++_0xa7d760);}(_0xe165,0x8d));var _0x5e16=function(_0x7873ac,_0x7320fa){_0x7873ac=_0x7873ac-0x0;var _0x5d1efd=_0xe165[_0x7873ac];return _0x5d1efd;};'use strict';var multer=require(_0x5e16('0x0'));var util=require(_0x5e16('0x1'));var path=require(_0x5e16('0x2'));var timeout=require(_0x5e16('0x3'));var express=require(_0x5e16('0x4'));var router=express[_0x5e16('0x5')]();var auth=require(_0x5e16('0x6'));var interaction=require(_0x5e16('0x7'));var config=require(_0x5e16('0x8'));var controller=require(_0x5e16('0x9'));router[_0x5e16('0xa')]('/',auth[_0x5e16('0xb')](),controller[_0x5e16('0xc')]);router['get']('/describe',auth[_0x5e16('0xb')](),controller[_0x5e16('0xd')]);router[_0x5e16('0xa')](_0x5e16('0xe'),auth[_0x5e16('0xb')](),controller[_0x5e16('0xf')]);router[_0x5e16('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x5e16('0x10')]);router[_0x5e16('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5e16('0x12')](_0x5e16('0xe'),auth[_0x5e16('0xb')](),controller[_0x5e16('0x13')]);router[_0x5e16('0x14')](_0x5e16('0xe'),auth[_0x5e16('0xb')](),controller[_0x5e16('0x15')]);module[_0x5e16('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index f15a2cf..8cff72b 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 _0x4c4e=['../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','toString','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','path'];(function(_0x4183d5,_0x1a1806){var _0x189737=function(_0xff90df){while(--_0xff90df){_0x4183d5['push'](_0x4183d5['shift']());}};_0x189737(++_0x1a1806);}(_0x4c4e,0x152));var _0xe4c4=function(_0x2bbba9,_0x3adbc0){_0x2bbba9=_0x2bbba9-0x0;var _0x26d97d=_0x4c4e[_0x2bbba9];return _0x26d97d;};'use strict';var Sequelize=require(_0xe4c4('0x0'));var moment=require('moment');var path=require(_0xe4c4('0x1'));var config=require(_0xe4c4('0x2'));module[_0xe4c4('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe4c4('0x4')](_0xe4c4('0x5'))?path[_0xe4c4('0x6')](this['getDataValue'](_0xe4c4('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe4c4('0x7')]},'value':{'type':Sequelize[_0xe4c4('0x7')],'set':function(_0x262b64){var _0xad105=_0x262b64[_0xe4c4('0x8')](/\\/g,'/');this[_0xe4c4('0x9')](_0xe4c4('0x5'),_0xad105);}},'rating':{'type':Sequelize[_0xe4c4('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x589b2e){this[_0xe4c4('0x9')](_0xe4c4('0xb'),moment()[_0xe4c4('0xc')](_0x589b2e,'ms'));this[_0xe4c4('0x9')](_0xe4c4('0xd'),moment());this[_0xe4c4('0x9')]('duration',_0x589b2e);}},'startedAt':{'type':Sequelize[_0xe4c4('0xe')],'get':function(){return moment(this[_0xe4c4('0x4')](_0xe4c4('0xb')))[_0xe4c4('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe4c4('0x10')]();}},'closedAt':{'type':Sequelize[_0xe4c4('0xe')],'get':function(){return moment(this['getDataValue'](_0xe4c4('0xd')))[_0xe4c4('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe4c4('0x10')]();}},'createdAt':{'type':Sequelize[_0xe4c4('0xe')],'get':function(){return moment(this['getDataValue'](_0xe4c4('0x11')))[_0xe4c4('0xf')](_0xe4c4('0x12'))[_0xe4c4('0x10')]();}},'updatedAt':{'type':Sequelize[_0xe4c4('0xe')],'get':function(){return moment(this[_0xe4c4('0x4')](_0xe4c4('0x13')))[_0xe4c4('0xf')](_0xe4c4('0x12'))[_0xe4c4('0x10')]();}}}; \ No newline at end of file +var _0x24ca=['format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE'];(function(_0x1aded3,_0x409346){var _0x1d6e5e=function(_0x26090f){while(--_0x26090f){_0x1aded3['push'](_0x1aded3['shift']());}};_0x1d6e5e(++_0x409346);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x24ca[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0xa24c('0x0'));var moment=require('moment');var path=require(_0xa24c('0x1'));var config=require(_0xa24c('0x2'));module[_0xa24c('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa24c('0x4')](_0xa24c('0x5'))?path[_0xa24c('0x6')](this[_0xa24c('0x4')](_0xa24c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xa24c('0x7')]},'channel':{'type':Sequelize[_0xa24c('0x7')]},'value':{'type':Sequelize[_0xa24c('0x7')],'set':function(_0x2dd348){var _0x257264=_0x2dd348[_0xa24c('0x8')](/\\/g,'/');this['setDataValue'](_0xa24c('0x5'),_0x257264);}},'rating':{'type':Sequelize[_0xa24c('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa24c('0x9')],'set':function(_0x5eac78){this[_0xa24c('0xa')](_0xa24c('0xb'),moment()[_0xa24c('0xc')](_0x5eac78,'ms'));this[_0xa24c('0xa')](_0xa24c('0xd'),moment());this[_0xa24c('0xa')](_0xa24c('0xe'),_0x5eac78);}},'startedAt':{'type':Sequelize[_0xa24c('0xf')],'get':function(){return moment(this[_0xa24c('0x4')]('startedAt'))[_0xa24c('0x10')](_0xa24c('0x11'))[_0xa24c('0x12')]();}},'closedAt':{'type':Sequelize[_0xa24c('0xf')],'get':function(){return moment(this['getDataValue'](_0xa24c('0xd')))[_0xa24c('0x10')](_0xa24c('0x11'))[_0xa24c('0x12')]();}},'createdAt':{'type':Sequelize[_0xa24c('0xf')],'get':function(){return moment(this[_0xa24c('0x4')](_0xa24c('0x13')))['format']('MM-DD-YYYY\x20HH:mm')[_0xa24c('0x12')]();}},'updatedAt':{'type':Sequelize[_0xa24c('0xf')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xa24c('0x10')](_0xa24c('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index b178586..bf7f72e 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 _0x15a0=['params','rawAttributes','includeAll','find','catch','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','Sequelize','ValidationError','filename','extname','unlink','ScreenRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','File:\x20\x22','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','ScreenRecording','type','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show'];(function(_0x19a7f1,_0x9433c6){var _0x24888e=function(_0x35779e){while(--_0x35779e){_0x19a7f1['push'](_0x19a7f1['shift']());}};_0x24888e(++_0x9433c6);}(_0x15a0,0x8d));var _0x015a=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x15a0[_0x5d4607];return _0x5e4a86;};'use strict';var pdf=require(_0x015a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x015a('0x1'));var zipdir=require(_0x015a('0x2'));var jsonpatch=require(_0x015a('0x3'));var rp=require('request-promise');var moment=require(_0x015a('0x4'));var BPromise=require(_0x015a('0x5'));var Mustache=require('mustache');var util=require(_0x015a('0x6'));var path=require(_0x015a('0x7'));var sox=require(_0x015a('0x8'));var csv=require(_0x015a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x015a('0xa'));var squel=require('squel');var crypto=require(_0x015a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x015a('0x9'));var querystring=require(_0x015a('0xc'));var Papa=require(_0x015a('0xd'));var Redis=require(_0x015a('0xe'));var authService=require(_0x015a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x015a('0x10'));var hardwareService=require(_0x015a('0x11'));var logger=require(_0x015a('0x12'))('api');var utils=require(_0x015a('0x13'));var config=require(_0x015a('0x14'));var db=require(_0x015a('0x15'))['db'];function respondWithStatusCode(_0x1e0477,_0x1b5a59){_0x1b5a59=_0x1b5a59||0xcc;return function(_0x39a5ec){if(_0x39a5ec){return _0x1e0477[_0x015a('0x16')](_0x1b5a59);}return _0x1e0477[_0x015a('0x17')](_0x1b5a59)['end']();};}function respondWithResult(_0x21157b,_0x7cbb8c){_0x7cbb8c=_0x7cbb8c||0xc8;return function(_0x2e4b73){if(_0x2e4b73){return _0x21157b[_0x015a('0x17')](_0x7cbb8c)[_0x015a('0x18')](_0x2e4b73);}};}function respondWithFilteredResult(_0x1c05ba,_0x55775c){return function(_0x19845b){if(_0x19845b){var _0x4865f8=_0x19845b[_0x015a('0x19')],_0x54bc2b=_0x55775c[_0x015a('0x1a')],_0xf696b8=_0x55775c['offset']+_0x55775c[_0x015a('0x1b')],_0x26ef24;if(_0xf696b8>=_0x4865f8){_0xf696b8=_0x4865f8;_0x26ef24=0xc8;}else{_0x26ef24=0xce;}_0x1c05ba['status'](_0x26ef24);return _0x1c05ba[_0x015a('0x1c')](_0x015a('0x1d'),_0x54bc2b+'-'+_0xf696b8+'/'+_0x4865f8)[_0x015a('0x18')](_0x19845b);}return null;};}function patchUpdates(_0x2a8887){return function(_0x8012c5){try{jsonpatch[_0x015a('0x1e')](_0x8012c5,_0x2a8887,!![]);}catch(_0x2def33){return BPromise[_0x015a('0x1f')](_0x2def33);}return _0x8012c5['save']();};}function saveUpdates(_0x2e88c0,_0x52c61b){return function(_0x196ba1){if(_0x196ba1){return _0x196ba1[_0x015a('0x20')](_0x2e88c0)[_0x015a('0x21')](function(_0x14648d){return _0x14648d;});}return null;};}function removeEntity(_0x2d5339,_0x29ed68){return function(_0x17512f){if(_0x17512f){return _0x17512f[_0x015a('0x22')]()[_0x015a('0x21')](function(){_0x2d5339[_0x015a('0x17')](0xcc)[_0x015a('0x23')]();});}};}function handleEntityNotFound(_0x4d410e,_0x226d90){return function(_0x5be988){if(!_0x5be988){_0x4d410e['sendStatus'](0x194);}return _0x5be988;};}function handleError(_0x12a9b8,_0x3da5cf){_0x3da5cf=_0x3da5cf||0x1f4;return function(_0x4950fb){logger['error'](_0x4950fb[_0x015a('0x24')]);if(_0x4950fb[_0x015a('0x25')]){delete _0x4950fb[_0x015a('0x25')];}_0x12a9b8[_0x015a('0x17')](_0x3da5cf)[_0x015a('0x26')](_0x4950fb);};}exports[_0x015a('0x27')]=function(_0x541051,_0x2ab6f5){var _0x3148fa={},_0x3a0bb9={},_0x106b40={'count':0x0,'rows':[]};var _0x55b147=_['map'](db[_0x015a('0x28')]['rawAttributes'],function(_0x288a1a){return{'name':_0x288a1a['fieldName'],'type':_0x288a1a[_0x015a('0x29')][_0x015a('0x2a')]};});_0x3a0bb9[_0x015a('0x2b')]=_[_0x015a('0x2c')](_[_0x015a('0x2d')](_0x55b147,_0x015a('0x25')),[_0x015a('0x2e')]);_0x3a0bb9[_0x015a('0x2f')]=_[_0x015a('0x30')](_0x541051[_0x015a('0x2f')]);_0x3a0bb9[_0x015a('0x31')]=_[_0x015a('0x32')](_0x3a0bb9[_0x015a('0x2b')],_0x3a0bb9['query']);_0x3148fa[_0x015a('0x33')]=_['intersection'](_0x3a0bb9[_0x015a('0x2b')],qs[_0x015a('0x34')](_0x541051['query']['fields']));_0x3148fa[_0x015a('0x33')]=_0x3148fa[_0x015a('0x33')][_0x015a('0x35')]?_0x3148fa[_0x015a('0x33')]:_0x3a0bb9[_0x015a('0x2b')];if(!_0x541051[_0x015a('0x2f')]['hasOwnProperty'](_0x015a('0x36'))){_0x3148fa[_0x015a('0x1b')]=qs['limit'](_0x541051[_0x015a('0x2f')][_0x015a('0x1b')]);_0x3148fa[_0x015a('0x1a')]=qs[_0x015a('0x1a')](_0x541051[_0x015a('0x2f')]['offset']);}_0x3148fa[_0x015a('0x37')]=qs['sort'](_0x541051['query'][_0x015a('0x38')]);_0x3148fa[_0x015a('0x39')]=qs['filters'](_[_0x015a('0x3a')](_0x541051[_0x015a('0x2f')],_0x3a0bb9[_0x015a('0x31')]),_0x55b147);if(_0x541051[_0x015a('0x2f')][_0x015a('0x3b')]){_0x3148fa['where']=_[_0x015a('0x3c')](_0x3148fa[_0x015a('0x39')],{'$or':_[_0x015a('0x2d')](_0x55b147,function(_0x48abd3){if(_0x48abd3[_0x015a('0x29')]!==_0x015a('0x3d')){var _0x5534ea={};_0x5534ea[_0x48abd3[_0x015a('0x25')]]={'$like':'%'+_0x541051[_0x015a('0x2f')][_0x015a('0x3b')]+'%'};return _0x5534ea;}})});}_0x3148fa=_[_0x015a('0x3c')]({},_0x3148fa,_0x541051[_0x015a('0x3e')]);var _0x8dbc9c={'where':_0x3148fa[_0x015a('0x39')]};return db[_0x015a('0x28')][_0x015a('0x19')](_0x8dbc9c)[_0x015a('0x21')](function(_0x122b10){_0x106b40[_0x015a('0x19')]=_0x122b10;if(_0x541051[_0x015a('0x2f')]['includeAll']){_0x3148fa[_0x015a('0x3f')]=[{'all':!![]}];}return db[_0x015a('0x28')][_0x015a('0x40')](_0x3148fa);})[_0x015a('0x21')](function(_0x42dc08){_0x106b40[_0x015a('0x41')]=_0x42dc08;return _0x106b40;})['then'](respondWithFilteredResult(_0x2ab6f5,_0x3148fa))['catch'](handleError(_0x2ab6f5,null));};exports[_0x015a('0x42')]=function(_0xd748d,_0x3af141){var _0x20dfc2={'raw':![],'where':{'id':_0xd748d[_0x015a('0x43')]['id']}},_0x35b359={};_0x35b359[_0x015a('0x2b')]=_[_0x015a('0x30')](db[_0x015a('0x28')][_0x015a('0x44')]);_0x35b359[_0x015a('0x2f')]=_[_0x015a('0x30')](_0xd748d[_0x015a('0x2f')]);_0x35b359['filters']=_[_0x015a('0x32')](_0x35b359[_0x015a('0x2b')],_0x35b359[_0x015a('0x2f')]);_0x20dfc2[_0x015a('0x33')]=_[_0x015a('0x32')](_0x35b359['model'],qs[_0x015a('0x34')](_0xd748d[_0x015a('0x2f')][_0x015a('0x34')]));_0x20dfc2[_0x015a('0x33')]=_0x20dfc2[_0x015a('0x33')][_0x015a('0x35')]?_0x20dfc2['attributes']:_0x35b359[_0x015a('0x2b')];if(_0xd748d[_0x015a('0x2f')][_0x015a('0x45')]){_0x20dfc2['include']=[{'all':!![]}];}_0x20dfc2=_['merge']({},_0x20dfc2,_0xd748d['options']);return db[_0x015a('0x28')][_0x015a('0x46')](_0x20dfc2)['then'](handleEntityNotFound(_0x3af141,null))[_0x015a('0x21')](respondWithResult(_0x3af141,null))[_0x015a('0x47')](handleError(_0x3af141,null));};exports[_0x015a('0x48')]=function(_0x5b8a4d,_0x57fdac){return db[_0x015a('0x28')][_0x015a('0x48')](_0x5b8a4d['body'],{})['then'](respondWithResult(_0x57fdac,0xc9))[_0x015a('0x47')](handleError(_0x57fdac,null));};exports[_0x015a('0x20')]=function(_0x41e119,_0x1786dc){if(_0x41e119[_0x015a('0x49')]['id']){delete _0x41e119[_0x015a('0x49')]['id'];}delete _0x41e119[_0x015a('0x49')][_0x015a('0x4a')];delete _0x41e119[_0x015a('0x49')][_0x015a('0x4b')];delete _0x41e119[_0x015a('0x49')]['closedAt'];delete _0x41e119[_0x015a('0x49')][_0x015a('0x4c')];return db[_0x015a('0x28')][_0x015a('0x46')]({'where':{'id':_0x41e119[_0x015a('0x43')]['id']}})[_0x015a('0x21')](handleEntityNotFound(_0x1786dc,null))[_0x015a('0x21')](saveUpdates(_0x41e119[_0x015a('0x49')],null))[_0x015a('0x21')](respondWithResult(_0x1786dc,null))[_0x015a('0x47')](handleError(_0x1786dc,null));};exports[_0x015a('0x4d')]=function(_0x4fcdfe,_0x32715d){return db[_0x015a('0x28')][_0x015a('0x4d')]()[_0x015a('0x21')](respondWithResult(_0x32715d,null))[_0x015a('0x47')](handleError(_0x32715d,null));};exports[_0x015a('0x4e')]=function(_0xd2bcb4,_0x5b7192,_0x3012b7){var _0x1c3bc8=require(_0x015a('0x4f'));var _0xb5f949=![];var _0x1c2d28={};if(_0xd2bcb4['query'][_0x015a('0x29')]&&_0xd2bcb4['query'][_0x015a('0x29')]===_0x015a('0x50')){_0x1c2d28[_0x015a('0x50')]=_0xd2bcb4[_0x015a('0x43')]['id'];}else{_0x1c2d28['id']=_0xd2bcb4['params']['id'];}return db[_0x015a('0x28')]['find']({'where':_0x1c2d28,'attributes':['id',_0x015a('0x4c')],'raw':!![]})[_0x015a('0x21')](handleEntityNotFound(_0x5b7192,null))[_0x015a('0x21')](function(_0xff5e5){if(_0xff5e5){var _0x3cd8fb=path['join'](config[_0x015a('0x51')],_0x015a('0x52'),_0xff5e5[_0x015a('0x4c')]);var _0x2a9f55=util[_0x015a('0x2e')](_0x015a('0x53'),_0x3cd8fb);if(fs[_0x015a('0x54')](_0x2a9f55)){_0xb5f949=!![];return _0x1c3bc8[_0x015a('0x55')](_0x2a9f55,_0x3cd8fb,config[_0x015a('0x56')][_0x015a('0x57')])[_0x015a('0x21')](function(){return _0xff5e5;});}return _0xff5e5;}})[_0x015a('0x21')](function(_0x4df150){if(_0x4df150){var _0x10af8f=path[_0x015a('0x58')](config[_0x015a('0x51')],_0x015a('0x52'),_0x4df150[_0x015a('0x4c')]);if(!fs['existsSync'](_0x10af8f)){throw new db[(_0x015a('0x59'))][(_0x015a('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x4df150[_0x015a('0x5b')]){return _0x5b7192[_0x015a('0x4e')](_0x10af8f,_0x4df150[_0x015a('0x5b')]+path[_0x015a('0x5c')](_0x10af8f),function(){if(_0xb5f949){fs[_0x015a('0x5d')](_0x10af8f);}});}else{return _0x5b7192[_0x015a('0x4e')](_0x10af8f,function(_0x42f0ca){if(_0xb5f949){fs['unlink'](_0x10af8f);}});}}})['catch'](function(_0x51b790){if(_0x51b790['message']===_0x015a('0x5e')){_0x5b7192['status'](0x194)[_0x015a('0x26')](_0x015a('0x5f'));}else{return handleError(_0x5b7192,null);}});};exports[_0x015a('0x22')]=function(_0x281d4b,_0x30a534){return db[_0x015a('0x28')]['find']({'where':{'id':_0x281d4b[_0x015a('0x43')]['id']}})['then'](function(_0x2dfb6a){if(!_0x2dfb6a)throw new ReferenceError(_0x015a('0x60'));return _0x2dfb6a;})[_0x015a('0x21')](function(_0x37a6d7){var _0x322299=path['join'](config[_0x015a('0x51')],_0x015a('0x52'),_0x37a6d7[_0x015a('0x4c')]);logger[_0x015a('0x61')](_0x015a('0x62'),_0x322299);if(!_['isNil'](_0x37a6d7[_0x015a('0x4c')])&&fs[_0x015a('0x54')](_0x322299)){logger[_0x015a('0x61')]('File:\x20\x22'+_0x322299+_0x015a('0x63'));fs['unlinkSync'](_0x322299);}_0x322299=_0x322299+_0x015a('0x64');if(!_[_0x015a('0x65')](_0x37a6d7[_0x015a('0x4c')])&&fs['existsSync'](_0x322299)){logger[_0x015a('0x61')](_0x015a('0x66')+_0x322299+_0x015a('0x63'));fs[_0x015a('0x67')](_0x322299);}return _0x37a6d7;})['then'](function(_0xf34466){if(!_0xf34466)throw new InternalError();return _0xf34466[_0x015a('0x22')]();})[_0x015a('0x21')](function(){_0x30a534[_0x015a('0x17')](0xcc)['end']();})['catch'](handleError(_0x30a534,null));}; \ No newline at end of file +var _0xd6a8=['length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','rows','catch','show','params','include','options','find','create','body','duration','createdAt','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','root','Sequelize','ValidationError','filename','extname','unlink','ScreenRecording\x20not\x20found','send','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','error','stack','name','map','ScreenRecording','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xd6a8,0x9b));var _0x8d6a=function(_0x1a0f63,_0x5f5205){_0x1a0f63=_0x1a0f63-0x0;var _0x4e70ae=_0xd6a8[_0x1a0f63];return _0x4e70ae;};'use strict';var pdf=require(_0x8d6a('0x0'));var emlformat=require(_0x8d6a('0x1'));var rimraf=require(_0x8d6a('0x2'));var zipdir=require(_0x8d6a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8d6a('0x4'));var BPromise=require(_0x8d6a('0x5'));var Mustache=require(_0x8d6a('0x6'));var util=require(_0x8d6a('0x7'));var path=require(_0x8d6a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8d6a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d6a('0xa'));var crypto=require('crypto');var jsforce=require(_0x8d6a('0xb'));var deskjs=require(_0x8d6a('0xc'));var toCsv=require(_0x8d6a('0xd'));var querystring=require(_0x8d6a('0xe'));var Papa=require(_0x8d6a('0xf'));var Redis=require('ioredis');var authService=require(_0x8d6a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8d6a('0x11'));var hardwareService=require(_0x8d6a('0x12'));var logger=require(_0x8d6a('0x13'))(_0x8d6a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8d6a('0x15'))['db'];function respondWithStatusCode(_0x1e2270,_0x273f12){_0x273f12=_0x273f12||0xcc;return function(_0x5c248e){if(_0x5c248e){return _0x1e2270[_0x8d6a('0x16')](_0x273f12);}return _0x1e2270[_0x8d6a('0x17')](_0x273f12)[_0x8d6a('0x18')]();};}function respondWithResult(_0x2d538e,_0x28e167){_0x28e167=_0x28e167||0xc8;return function(_0x106493){if(_0x106493){return _0x2d538e['status'](_0x28e167)[_0x8d6a('0x19')](_0x106493);}};}function respondWithFilteredResult(_0x5745fb,_0x411b92){return function(_0x5d2f00){if(_0x5d2f00){var _0x50adfa=_0x5d2f00[_0x8d6a('0x1a')],_0x5f1a0c=_0x411b92[_0x8d6a('0x1b')],_0x1b5ccc=_0x411b92[_0x8d6a('0x1b')]+_0x411b92['limit'],_0x544e70;if(_0x1b5ccc>=_0x50adfa){_0x1b5ccc=_0x50adfa;_0x544e70=0xc8;}else{_0x544e70=0xce;}_0x5745fb[_0x8d6a('0x17')](_0x544e70);return _0x5745fb[_0x8d6a('0x1c')]('Content-Range',_0x5f1a0c+'-'+_0x1b5ccc+'/'+_0x50adfa)[_0x8d6a('0x19')](_0x5d2f00);}return null;};}function patchUpdates(_0x30dafd){return function(_0x315841){try{jsonpatch[_0x8d6a('0x1d')](_0x315841,_0x30dafd,!![]);}catch(_0x56a340){return BPromise[_0x8d6a('0x1e')](_0x56a340);}return _0x315841[_0x8d6a('0x1f')]();};}function saveUpdates(_0xc4bca2,_0x3789f2){return function(_0x1c06b9){if(_0x1c06b9){return _0x1c06b9[_0x8d6a('0x20')](_0xc4bca2)['then'](function(_0x2f2efb){return _0x2f2efb;});}return null;};}function removeEntity(_0x19ca41,_0x59b4e4){return function(_0x607e64){if(_0x607e64){return _0x607e64['destroy']()['then'](function(){_0x19ca41[_0x8d6a('0x17')](0xcc)[_0x8d6a('0x18')]();});}};}function handleEntityNotFound(_0x17891f,_0x555a88){return function(_0x52ba84){if(!_0x52ba84){_0x17891f[_0x8d6a('0x16')](0x194);}return _0x52ba84;};}function handleError(_0x59e9d1,_0x12542a){_0x12542a=_0x12542a||0x1f4;return function(_0x4c8267){logger[_0x8d6a('0x21')](_0x4c8267[_0x8d6a('0x22')]);if(_0x4c8267[_0x8d6a('0x23')]){delete _0x4c8267[_0x8d6a('0x23')];}_0x59e9d1[_0x8d6a('0x17')](_0x12542a)['send'](_0x4c8267);};}exports['index']=function(_0x217f30,_0x29f7a){var _0x1831f7={},_0x3bf7e4={},_0x1320a1={'count':0x0,'rows':[]};var _0x41d5ed=_[_0x8d6a('0x24')](db[_0x8d6a('0x25')][_0x8d6a('0x26')],function(_0x38a4a9){return{'name':_0x38a4a9[_0x8d6a('0x27')],'type':_0x38a4a9[_0x8d6a('0x28')][_0x8d6a('0x29')]};});_0x3bf7e4['model']=_['differenceBy'](_['map'](_0x41d5ed,_0x8d6a('0x23')),['format']);_0x3bf7e4[_0x8d6a('0x2a')]=_[_0x8d6a('0x2b')](_0x217f30[_0x8d6a('0x2a')]);_0x3bf7e4[_0x8d6a('0x2c')]=_[_0x8d6a('0x2d')](_0x3bf7e4['model'],_0x3bf7e4[_0x8d6a('0x2a')]);_0x1831f7[_0x8d6a('0x2e')]=_[_0x8d6a('0x2d')](_0x3bf7e4[_0x8d6a('0x2f')],qs[_0x8d6a('0x30')](_0x217f30['query']['fields']));_0x1831f7[_0x8d6a('0x2e')]=_0x1831f7[_0x8d6a('0x2e')][_0x8d6a('0x31')]?_0x1831f7[_0x8d6a('0x2e')]:_0x3bf7e4[_0x8d6a('0x2f')];if(!_0x217f30[_0x8d6a('0x2a')][_0x8d6a('0x32')]('nolimit')){_0x1831f7[_0x8d6a('0x33')]=qs['limit'](_0x217f30[_0x8d6a('0x2a')]['limit']);_0x1831f7[_0x8d6a('0x1b')]=qs[_0x8d6a('0x1b')](_0x217f30[_0x8d6a('0x2a')][_0x8d6a('0x1b')]);}_0x1831f7[_0x8d6a('0x34')]=qs[_0x8d6a('0x35')](_0x217f30[_0x8d6a('0x2a')]['sort']);_0x1831f7[_0x8d6a('0x36')]=qs['filters'](_[_0x8d6a('0x37')](_0x217f30[_0x8d6a('0x2a')],_0x3bf7e4[_0x8d6a('0x2c')]),_0x41d5ed);if(_0x217f30[_0x8d6a('0x2a')][_0x8d6a('0x38')]){_0x1831f7[_0x8d6a('0x36')]=_[_0x8d6a('0x39')](_0x1831f7[_0x8d6a('0x36')],{'$or':_[_0x8d6a('0x24')](_0x41d5ed,function(_0x20a4f3){if(_0x20a4f3['type']!==_0x8d6a('0x3a')){var _0x5e08f3={};_0x5e08f3[_0x20a4f3[_0x8d6a('0x23')]]={'$like':'%'+_0x217f30[_0x8d6a('0x2a')]['filter']+'%'};return _0x5e08f3;}})});}_0x1831f7=_['merge']({},_0x1831f7,_0x217f30['options']);var _0x304143={'where':_0x1831f7[_0x8d6a('0x36')]};return db[_0x8d6a('0x25')]['count'](_0x304143)[_0x8d6a('0x3b')](function(_0x29b579){_0x1320a1['count']=_0x29b579;if(_0x217f30[_0x8d6a('0x2a')][_0x8d6a('0x3c')]){_0x1831f7['include']=[{'all':!![]}];}return db[_0x8d6a('0x25')]['findAll'](_0x1831f7);})[_0x8d6a('0x3b')](function(_0x5f4ac3){_0x1320a1[_0x8d6a('0x3d')]=_0x5f4ac3;return _0x1320a1;})[_0x8d6a('0x3b')](respondWithFilteredResult(_0x29f7a,_0x1831f7))[_0x8d6a('0x3e')](handleError(_0x29f7a,null));};exports[_0x8d6a('0x3f')]=function(_0x547c29,_0x1576a2){var _0x5018ec={'raw':![],'where':{'id':_0x547c29[_0x8d6a('0x40')]['id']}},_0x275b48={};_0x275b48[_0x8d6a('0x2f')]=_[_0x8d6a('0x2b')](db[_0x8d6a('0x25')][_0x8d6a('0x26')]);_0x275b48[_0x8d6a('0x2a')]=_['keys'](_0x547c29[_0x8d6a('0x2a')]);_0x275b48[_0x8d6a('0x2c')]=_['intersection'](_0x275b48[_0x8d6a('0x2f')],_0x275b48['query']);_0x5018ec['attributes']=_['intersection'](_0x275b48[_0x8d6a('0x2f')],qs[_0x8d6a('0x30')](_0x547c29['query'][_0x8d6a('0x30')]));_0x5018ec['attributes']=_0x5018ec[_0x8d6a('0x2e')][_0x8d6a('0x31')]?_0x5018ec[_0x8d6a('0x2e')]:_0x275b48['model'];if(_0x547c29[_0x8d6a('0x2a')][_0x8d6a('0x3c')]){_0x5018ec[_0x8d6a('0x41')]=[{'all':!![]}];}_0x5018ec=_[_0x8d6a('0x39')]({},_0x5018ec,_0x547c29[_0x8d6a('0x42')]);return db[_0x8d6a('0x25')][_0x8d6a('0x43')](_0x5018ec)['then'](handleEntityNotFound(_0x1576a2,null))['then'](respondWithResult(_0x1576a2,null))[_0x8d6a('0x3e')](handleError(_0x1576a2,null));};exports[_0x8d6a('0x44')]=function(_0x90a779,_0x3ab30a){return db[_0x8d6a('0x25')][_0x8d6a('0x44')](_0x90a779[_0x8d6a('0x45')],{})[_0x8d6a('0x3b')](respondWithResult(_0x3ab30a,0xc9))[_0x8d6a('0x3e')](handleError(_0x3ab30a,null));};exports[_0x8d6a('0x20')]=function(_0x143c9c,_0x529b06){if(_0x143c9c[_0x8d6a('0x45')]['id']){delete _0x143c9c[_0x8d6a('0x45')]['id'];}delete _0x143c9c['body'][_0x8d6a('0x46')];delete _0x143c9c[_0x8d6a('0x45')][_0x8d6a('0x47')];delete _0x143c9c[_0x8d6a('0x45')]['closedAt'];delete _0x143c9c[_0x8d6a('0x45')]['value'];return db[_0x8d6a('0x25')][_0x8d6a('0x43')]({'where':{'id':_0x143c9c[_0x8d6a('0x40')]['id']}})[_0x8d6a('0x3b')](handleEntityNotFound(_0x529b06,null))[_0x8d6a('0x3b')](saveUpdates(_0x143c9c[_0x8d6a('0x45')],null))[_0x8d6a('0x3b')](respondWithResult(_0x529b06,null))[_0x8d6a('0x3e')](handleError(_0x529b06,null));};exports['describe']=function(_0x22a5ed,_0xe46af){return db[_0x8d6a('0x25')][_0x8d6a('0x48')]()[_0x8d6a('0x3b')](respondWithResult(_0xe46af,null))['catch'](handleError(_0xe46af,null));};exports[_0x8d6a('0x49')]=function(_0x3088bd,_0x2a2488,_0x5b9c25){var _0x2d1fed=require(_0x8d6a('0x4a'));var _0x6b0224=![];var _0x267f47={};if(_0x3088bd['query'][_0x8d6a('0x28')]&&_0x3088bd[_0x8d6a('0x2a')][_0x8d6a('0x28')]==='uniqueid'){_0x267f47[_0x8d6a('0x4b')]=_0x3088bd[_0x8d6a('0x40')]['id'];}else{_0x267f47['id']=_0x3088bd[_0x8d6a('0x40')]['id'];}return db[_0x8d6a('0x25')][_0x8d6a('0x43')]({'where':_0x267f47,'attributes':['id',_0x8d6a('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x2a2488,null))['then'](function(_0x3fa78a){if(_0x3fa78a){var _0x1275e0=path[_0x8d6a('0x4d')](config['root'],_0x8d6a('0x4e'),_0x3fa78a[_0x8d6a('0x4c')]);var _0x3ccf6a=util[_0x8d6a('0x4f')](_0x8d6a('0x50'),_0x1275e0);if(fs[_0x8d6a('0x51')](_0x3ccf6a)){_0x6b0224=!![];return _0x2d1fed[_0x8d6a('0x52')](_0x3ccf6a,_0x1275e0,config[_0x8d6a('0x53')]['recording'])[_0x8d6a('0x3b')](function(){return _0x3fa78a;});}return _0x3fa78a;}})[_0x8d6a('0x3b')](function(_0xd12b2e){if(_0xd12b2e){var _0x3d1985=path[_0x8d6a('0x4d')](config[_0x8d6a('0x54')],'server/files/screen_recordings',_0xd12b2e['value']);if(!fs[_0x8d6a('0x51')](_0x3d1985)){throw new db[(_0x8d6a('0x55'))][(_0x8d6a('0x56'))]('ScreenRecording\x20not\x20found');}if(_0xd12b2e[_0x8d6a('0x57')]){return _0x2a2488['download'](_0x3d1985,_0xd12b2e[_0x8d6a('0x57')]+path[_0x8d6a('0x58')](_0x3d1985),function(){if(_0x6b0224){fs[_0x8d6a('0x59')](_0x3d1985);}});}else{return _0x2a2488['download'](_0x3d1985,function(_0x48107f){if(_0x6b0224){fs['unlink'](_0x3d1985);}});}}})['catch'](function(_0x18ab13){if(_0x18ab13['message']===_0x8d6a('0x5a')){_0x2a2488[_0x8d6a('0x17')](0x194)[_0x8d6a('0x5b')](_0x8d6a('0x5c'));}else{return handleError(_0x2a2488,null);}});};exports[_0x8d6a('0x5d')]=function(_0x16b865,_0x54effe){return db[_0x8d6a('0x25')]['find']({'where':{'id':_0x16b865[_0x8d6a('0x40')]['id']}})[_0x8d6a('0x3b')](function(_0x2b9d85){if(!_0x2b9d85)throw new ReferenceError(_0x8d6a('0x5e'));return _0x2b9d85;})[_0x8d6a('0x3b')](function(_0x278b3c){var _0x6b1348=path[_0x8d6a('0x4d')](config[_0x8d6a('0x54')],_0x8d6a('0x4e'),_0x278b3c[_0x8d6a('0x4c')]);logger[_0x8d6a('0x5f')](_0x8d6a('0x60'),_0x6b1348);if(!_[_0x8d6a('0x61')](_0x278b3c['value'])&&fs[_0x8d6a('0x51')](_0x6b1348)){logger['info'](_0x8d6a('0x62')+_0x6b1348+_0x8d6a('0x63'));fs['unlinkSync'](_0x6b1348);}_0x6b1348=_0x6b1348+_0x8d6a('0x64');if(!_[_0x8d6a('0x61')](_0x278b3c[_0x8d6a('0x4c')])&&fs[_0x8d6a('0x51')](_0x6b1348)){logger['info'](_0x8d6a('0x62')+_0x6b1348+_0x8d6a('0x63'));fs[_0x8d6a('0x65')](_0x6b1348);}return _0x278b3c;})[_0x8d6a('0x3b')](function(_0x49a967){if(!_0x49a967)throw new InternalError();return _0x49a967[_0x8d6a('0x5d')]();})[_0x8d6a('0x3b')](function(){_0x54effe[_0x8d6a('0x17')](0xcc)[_0x8d6a('0x18')]();})[_0x8d6a('0x3e')](handleError(_0x54effe,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f6c1f4b..8fd5aef 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 _0x8ea5=['interactionid','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','define','screen_recordings'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8ea5,0xab));var _0x58ea=function(_0xd91f42,_0x3596dc){_0xd91f42=_0xd91f42-0x0;var _0x3e96fe=_0x8ea5[_0xd91f42];return _0x3e96fe;};'use strict';var _=require(_0x58ea('0x0'));var util=require(_0x58ea('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x58ea('0x2'));var rp=require(_0x58ea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58ea('0x4'));var config=require(_0x58ea('0x5'));var attributes=require(_0x58ea('0x6'));module['exports']=function(_0xdd1941,_0x46aa67){return _0xdd1941[_0x58ea('0x7')]('ScreenRecording',attributes,{'tableName':_0x58ea('0x8'),'paranoid':![],'indexes':[{'name':_0x58ea('0x9'),'fields':[_0x58ea('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3bf=['exports','ScreenRecording','screen_recordings','interactionid','lodash','util','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3bf,0x1e4));var _0xfa3b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa3bf[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xfa3b('0x0'));var util=require(_0xfa3b('0x1'));var logger=require('../../config/logger')(_0xfa3b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa3b('0x3'));var fs=require('fs');var path=require(_0xfa3b('0x4'));var rimraf=require(_0xfa3b('0x5'));var config=require(_0xfa3b('0x6'));var attributes=require(_0xfa3b('0x7'));module[_0xfa3b('0x8')]=function(_0x4fcca,_0x32a1d7){return _0x4fcca['define'](_0xfa3b('0x9'),attributes,{'tableName':_0xfa3b('0xa'),'paranoid':![],'indexes':[{'name':_0xfa3b('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b77b4b4..4f191be 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(_0x5a6b9a,_0x20f91a){var _0x4c150d=function(_0x4392ed){while(--_0x4392ed){_0x5a6b9a['push'](_0x5a6b9a['shift']());}};_0x4c150d(++_0x20f91a);}(_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 +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(_0x14c302,_0x1791f5){var _0x4576d2=function(_0x28767f){while(--_0x28767f){_0x14c302['push'](_0x14c302['shift']());}};_0x4576d2(++_0x1791f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 54cb409..1a4a83e 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 _0x2e39=['diskStorage','format','%s%s','logo','post','single','addLogo','join','root','logologin','extname','originalname','/:id/logo_login','file','addLogoLogin','server/files/images/logos/','/:id/favicon','addFavicon','put','/:id','update','exports','multer','util','express','Router','../../components/auth/service','./setting.controller','isAuthenticated','index','get','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x2e39,0x8e));var _0x92e3=function(_0x28f81f,_0x29010b){_0x28f81f=_0x28f81f-0x0;var _0x10d34f=_0x2e39[_0x28f81f];return _0x10d34f;};'use strict';var multer=require(_0x92e3('0x0'));var util=require(_0x92e3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x92e3('0x2'));var router=express[_0x92e3('0x3')]();var auth=require(_0x92e3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x92e3('0x5'));router['get']('/',auth[_0x92e3('0x6')](),controller[_0x92e3('0x7')]);router[_0x92e3('0x8')]('/:id',controller[_0x92e3('0x9')]);router[_0x92e3('0x8')](_0x92e3('0xa'),controller[_0x92e3('0xb')]);router['get']('/:id/logo_login',controller[_0x92e3('0xc')]);router[_0x92e3('0x8')](_0x92e3('0xd'),controller[_0x92e3('0xe')]);router['get'](_0x92e3('0xf'),controller[_0x92e3('0x10')]);router[_0x92e3('0x8')]('/:id/favicon',controller[_0x92e3('0x11')]);var upload=multer({'storage':multer[_0x92e3('0x12')]({'destination':function(_0x5ace38,_0x5d05a1,_0x3d004f){_0x3d004f(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x44d84a,_0x104010,_0x5b1170){_0x5b1170(null,util[_0x92e3('0x13')](_0x92e3('0x14'),_0x92e3('0x15'),path['extname'](_0x104010['originalname'])));}})});router[_0x92e3('0x16')]('/:id/logo',upload[_0x92e3('0x17')]('file'),controller[_0x92e3('0x18')]);var upload=multer({'storage':multer[_0x92e3('0x12')]({'destination':function(_0x3015e1,_0x1451e4,_0x146409){_0x146409(null,path[_0x92e3('0x19')](config[_0x92e3('0x1a')],'server/files/images/logos/'));},'filename':function(_0x3a6ab0,_0x4969db,_0x2a2435){_0x2a2435(null,util[_0x92e3('0x13')]('%s%s',_0x92e3('0x1b'),path[_0x92e3('0x1c')](_0x4969db[_0x92e3('0x1d')])));}})});router[_0x92e3('0x16')](_0x92e3('0x1e'),upload[_0x92e3('0x17')](_0x92e3('0x1f')),controller[_0x92e3('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3aa4c7,_0xf7a753,_0xcda1b0){_0xcda1b0(null,path[_0x92e3('0x19')](config[_0x92e3('0x1a')],_0x92e3('0x21')));},'filename':function(_0x28e5da,_0x1b35a6,_0x424f9e){_0x424f9e(null,util[_0x92e3('0x13')]('%s%s','preferred',path[_0x92e3('0x1c')](_0x1b35a6['originalname'])));}})});router[_0x92e3('0x16')](_0x92e3('0xf'),upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x92e3('0x12')]({'destination':function(_0x4cfae2,_0x288e21,_0x1e0b9e){_0x1e0b9e(null,path[_0x92e3('0x19')](config[_0x92e3('0x1a')],_0x92e3('0x21')));},'filename':function(_0x5ecde6,_0x3196f7,_0x150b35){_0x150b35(null,util['format']('%s%s','favicon',path[_0x92e3('0x1c')](_0x3196f7['originalname'])));}})});router[_0x92e3('0x16')](_0x92e3('0x22'),upload[_0x92e3('0x17')](_0x92e3('0x1f')),controller[_0x92e3('0x23')]);router[_0x92e3('0x24')](_0x92e3('0x25'),auth[_0x92e3('0x6')](),controller[_0x92e3('0x26')]);module[_0x92e3('0x27')]=router; \ No newline at end of file +var _0x4ed0=['originalname','post','single','addLogo','addLogoLogin','file','addPreferred','favicon','addFavicon','put','isAuthenticated','exports','multer','path','express','get','index','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x4ed0,0x1b0));var _0x04ed=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4ed0[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x04ed('0x0'));var util=require('util');var path=require(_0x04ed('0x1'));var timeout=require('connect-timeout');var express=require(_0x04ed('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x04ed('0x3')]('/',auth['isAuthenticated'](),controller[_0x04ed('0x4')]);router[_0x04ed('0x3')](_0x04ed('0x5'),controller[_0x04ed('0x6')]);router[_0x04ed('0x3')]('/:id/logo',controller[_0x04ed('0x7')]);router['get'](_0x04ed('0x8'),controller[_0x04ed('0x9')]);router[_0x04ed('0x3')](_0x04ed('0xa'),controller['gdpr']);router[_0x04ed('0x3')](_0x04ed('0xb'),controller[_0x04ed('0xc')]);router[_0x04ed('0x3')](_0x04ed('0xd'),controller[_0x04ed('0xe')]);var upload=multer({'storage':multer[_0x04ed('0xf')]({'destination':function(_0x4c1b95,_0x6a9da5,_0x2f8695){_0x2f8695(null,path[_0x04ed('0x10')](config[_0x04ed('0x11')],_0x04ed('0x12')));},'filename':function(_0x15784b,_0x35ce2f,_0x3423ef){_0x3423ef(null,util[_0x04ed('0x13')](_0x04ed('0x14'),_0x04ed('0x15'),path[_0x04ed('0x16')](_0x35ce2f[_0x04ed('0x17')])));}})});router[_0x04ed('0x18')]('/:id/logo',upload[_0x04ed('0x19')]('file'),controller[_0x04ed('0x1a')]);var upload=multer({'storage':multer[_0x04ed('0xf')]({'destination':function(_0x380e0d,_0x32e230,_0x1d292e){_0x1d292e(null,path[_0x04ed('0x10')](config[_0x04ed('0x11')],_0x04ed('0x12')));},'filename':function(_0x301fc9,_0x59c4d3,_0x2d75cc){_0x2d75cc(null,util['format'](_0x04ed('0x14'),'logologin',path[_0x04ed('0x16')](_0x59c4d3[_0x04ed('0x17')])));}})});router[_0x04ed('0x18')](_0x04ed('0x8'),upload[_0x04ed('0x19')]('file'),controller[_0x04ed('0x1b')]);var upload=multer({'storage':multer[_0x04ed('0xf')]({'destination':function(_0x565a27,_0x3d468c,_0x55987a){_0x55987a(null,path[_0x04ed('0x10')](config['root'],'server/files/images/logos/'));},'filename':function(_0x37b961,_0x1765c8,_0xc361e0){_0xc361e0(null,util['format'](_0x04ed('0x14'),'preferred',path[_0x04ed('0x16')](_0x1765c8[_0x04ed('0x17')])));}})});router[_0x04ed('0x18')](_0x04ed('0xb'),upload[_0x04ed('0x19')](_0x04ed('0x1c')),controller[_0x04ed('0x1d')]);var upload=multer({'storage':multer[_0x04ed('0xf')]({'destination':function(_0x2ec9b1,_0xc611ef,_0x294989){_0x294989(null,path['join'](config[_0x04ed('0x11')],'server/files/images/logos/'));},'filename':function(_0x42929f,_0x3a7160,_0x2e19db){_0x2e19db(null,util['format'](_0x04ed('0x14'),_0x04ed('0x1e'),path[_0x04ed('0x16')](_0x3a7160[_0x04ed('0x17')])));}})});router[_0x04ed('0x18')](_0x04ed('0xd'),upload[_0x04ed('0x19')]('file'),controller[_0x04ed('0x1f')]);router[_0x04ed('0x20')](_0x04ed('0x5'),auth[_0x04ed('0x21')](),controller['update']);module[_0x04ed('0x22')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f98ba22..4407d03 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 _0x128a=['min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','INTEGER'];(function(_0x1fcc3c,_0xb14480){var _0x28c53a=function(_0x301785){while(--_0x301785){_0x1fcc3c['push'](_0x1fcc3c['shift']());}};_0x28c53a(++_0xb14480);}(_0x128a,0x8e));var _0xa128=function(_0x4ef1a9,_0x59a5fa){_0x4ef1a9=_0x4ef1a9-0x0;var _0x23f201=_0x128a[_0x4ef1a9];return _0x23f201;};'use strict';var Sequelize=require(_0xa128('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xa128('0x1')](0xb),'unique':_0xa128('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa128('0x1')](0xb),'unique':_0xa128('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa128('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa128('0x4')],'defaultValue':_0xa128('0x5')},'logo':{'type':Sequelize[_0xa128('0x4')]},'defaultLogo':{'type':Sequelize[_0xa128('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa128('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa128('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa128('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa128('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xa128('0x4')]},'turnaddr':{'type':Sequelize[_0xa128('0x4')]},'turnusername':{'type':Sequelize[_0xa128('0x4')]},'turnpassword':{'type':Sequelize[_0xa128('0x4')]},'pageTitle':{'type':Sequelize[_0xa128('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xa128('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa128('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa128('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa128('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xa128('0x7')},'enableEmailPreview':{'type':Sequelize[_0xa128('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xa128('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa128('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa128('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa128('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xa128('0x8')},'chatTimeout':{'type':Sequelize[_0xa128('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa128('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa128('0x4')]},'defaultPreferred':{'type':Sequelize[_0xa128('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xa128('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa128('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa128('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa128('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa128('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa128('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa128('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xa128('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa128('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa128('0x1')]},'sentimentRegion':{'type':Sequelize[_0xa128('0x4')]},'language':{'type':Sequelize[_0xa128('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xa128('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x8293=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0xc7044d,_0x2b029f){var _0x31f165=function(_0xbe6338){while(--_0xbe6338){_0xc7044d['push'](_0xc7044d['shift']());}};_0x31f165(++_0x2b029f);}(_0x8293,0xab));var _0x3829=function(_0x2f26e0,_0x3dba17){_0x2f26e0=_0x2f26e0-0x0;var _0x318bab=_0x8293[_0x2f26e0];return _0x318bab;};'use strict';var Sequelize=require(_0x3829('0x0'));module[_0x3829('0x1')]={'min_internal':{'type':Sequelize[_0x3829('0x2')](0xb),'unique':_0x3829('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x3829('0x2')](0xb),'unique':_0x3829('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x3829('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x3829('0x5')],'defaultValue':_0x3829('0x6')},'logo':{'type':Sequelize[_0x3829('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x3829('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x3829('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x3829('0x5')]},'turnaddr':{'type':Sequelize[_0x3829('0x5')]},'turnusername':{'type':Sequelize[_0x3829('0x5')]},'turnpassword':{'type':Sequelize[_0x3829('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x3829('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x3829('0x5')],'defaultValue':_0x3829('0x8')},'enableEmailPreview':{'type':Sequelize[_0x3829('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x3829('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x3829('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x3829('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x3829('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x3829('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x3829('0x5')]},'defaultPreferred':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x3829('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x3829('0x5')]},'defaultFavicon':{'type':Sequelize[_0x3829('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x3829('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x3829('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x3829('0x2')]},'transcribeRegion':{'type':Sequelize[_0x3829('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x3829('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3829('0x5')]},'bucket':{'type':Sequelize[_0x3829('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x3829('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c33d511..5f02164 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 _0xf205=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','Setting','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','show','params','keys','rawAttributes','includeAll','body','find','file','filename','logo','loginLogo','../../config/license/util','getLogo','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','custom','Sequelize','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','favicon','existsSync','default_loginLogo.svg','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf'];(function(_0x18a66c,_0x583b05){var _0x5afca3=function(_0x59af43){while(--_0x59af43){_0x18a66c['push'](_0x18a66c['shift']());}};_0x5afca3(++_0x583b05);}(_0xf205,0xeb));var _0x5f20=function(_0x1f3557,_0x1d031c){_0x1f3557=_0x1f3557-0x0;var _0x34a763=_0xf205[_0x1f3557];return _0x34a763;};'use strict';var pdf=require(_0x5f20('0x0'));var emlformat=require(_0x5f20('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f20('0x2'));var jsonpatch=require(_0x5f20('0x3'));var rp=require(_0x5f20('0x4'));var moment=require(_0x5f20('0x5'));var BPromise=require(_0x5f20('0x6'));var Mustache=require(_0x5f20('0x7'));var util=require(_0x5f20('0x8'));var path=require(_0x5f20('0x9'));var sox=require('sox');var csv=require(_0x5f20('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5f20('0xb'));var squel=require(_0x5f20('0xc'));var crypto=require(_0x5f20('0xd'));var jsforce=require(_0x5f20('0xe'));var deskjs=require(_0x5f20('0xf'));var toCsv=require(_0x5f20('0xa'));var querystring=require(_0x5f20('0x10'));var Papa=require(_0x5f20('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f20('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f20('0x13'));var utils=require('../../config/utils');var config=require(_0x5f20('0x14'));var db=require(_0x5f20('0x15'))['db'];var jayson=require(_0x5f20('0x16'));var client=jayson['client'][_0x5f20('0x17')]({'port':0x232a});function checkPasswordPattern(_0x315d8f,_0xe1b302,_0xfe081d){if(_0xfe081d){var _0x428be6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x428be6[_0x5f20('0x18')](_0xe1b302)){return _0x315d8f;}else{throw new db['Sequelize'][(_0x5f20('0x19'))](_0x5f20('0x1a'));}}else{return _0x315d8f;}}function respondWithRpcPromise(_0x72b433,_0x4edcb1,_0x2307f8,_0x41b8fc){return new BPromise(function(_0x48b0c6,_0x7584c8){var _0x1aa99e=_0x41b8fc||client;return _0x1aa99e['request'](_0x72b433,_0x2307f8)[_0x5f20('0x1b')](function(_0x338001){logger['info'](_0x5f20('0x1c'),_0x4edcb1,_0x5f20('0x1d'));logger[_0x5f20('0x1e')](_0x5f20('0x1f'),_0x4edcb1,'request\x20sent',JSON['stringify'](_0x338001));if(_0x338001[_0x5f20('0x20')]){if(_0x338001[_0x5f20('0x20')][_0x5f20('0x21')]===0x1f4){logger['error'](_0x5f20('0x1c'),_0x4edcb1,_0x338001[_0x5f20('0x20')]['message']);return _0x7584c8(_0x338001[_0x5f20('0x20')][_0x5f20('0x22')]);}logger[_0x5f20('0x20')]('Setting,\x20%s,\x20%s',_0x4edcb1,_0x338001[_0x5f20('0x20')][_0x5f20('0x22')]);return _0x48b0c6(_0x338001[_0x5f20('0x20')][_0x5f20('0x22')]);}else{logger[_0x5f20('0x23')]('Setting,\x20%s,\x20%s',_0x4edcb1,_0x5f20('0x1d'));_0x48b0c6(_0x338001[_0x5f20('0x24')][_0x5f20('0x22')]);}})[_0x5f20('0x25')](function(_0x1e8669){logger['error'](_0x5f20('0x1c'),_0x4edcb1,_0x1e8669);_0x7584c8(_0x1e8669);});});}function respondWithStatusCode(_0x50ffda,_0x1f555e){_0x1f555e=_0x1f555e||0xcc;return function(_0x45733d){if(_0x45733d){return _0x50ffda[_0x5f20('0x26')](_0x1f555e);}return _0x50ffda[_0x5f20('0x27')](_0x1f555e)[_0x5f20('0x28')]();};}function respondWithResult(_0x4d4aae,_0x1a73af){_0x1a73af=_0x1a73af||0xc8;return function(_0x45ece1){if(_0x45ece1){return _0x4d4aae[_0x5f20('0x27')](_0x1a73af)['json'](_0x45ece1);}};}function respondWithFilteredResult(_0x2a5227,_0x556856){return function(_0x408bd9){if(_0x408bd9){var _0x5848aa=_0x408bd9[_0x5f20('0x29')],_0x1ef542=_0x556856[_0x5f20('0x2a')],_0x56a026=_0x556856[_0x5f20('0x2a')]+_0x556856[_0x5f20('0x2b')],_0xf9a553;if(_0x56a026>=_0x5848aa){_0x56a026=_0x5848aa;_0xf9a553=0xc8;}else{_0xf9a553=0xce;}_0x2a5227[_0x5f20('0x27')](_0xf9a553);return _0x2a5227['set'](_0x5f20('0x2c'),_0x1ef542+'-'+_0x56a026+'/'+_0x5848aa)[_0x5f20('0x2d')](_0x408bd9);}return null;};}function patchUpdates(_0xec7344){return function(_0x7640d4){try{jsonpatch[_0x5f20('0x2e')](_0x7640d4,_0xec7344,!![]);}catch(_0x517d49){return BPromise[_0x5f20('0x2f')](_0x517d49);}return _0x7640d4['save']();};}function saveUpdates(_0xd6db15,_0x34fb16){return function(_0x126718){if(_0x126718){return _0x126718[_0x5f20('0x30')](_0xd6db15)[_0x5f20('0x1b')](function(_0x282917){return _0x282917;});}return null;};}function removeEntity(_0x742fdb,_0xa9ac15){return function(_0x471fb9){if(_0x471fb9){return _0x471fb9[_0x5f20('0x31')]()[_0x5f20('0x1b')](function(){_0x742fdb['status'](0xcc)[_0x5f20('0x28')]();});}};}function handleEntityNotFound(_0x1ee315,_0x3190ae){return function(_0x3f8310){if(!_0x3f8310){_0x1ee315[_0x5f20('0x26')](0x194);}return _0x3f8310;};}function handleError(_0x6e49de,_0x54f02e){_0x54f02e=_0x54f02e||0x1f4;return function(_0x141e19){logger[_0x5f20('0x20')](_0x141e19[_0x5f20('0x32')]);if(_0x141e19['name']){delete _0x141e19[_0x5f20('0x33')];}_0x6e49de['status'](_0x54f02e)[_0x5f20('0x34')](_0x141e19);};}exports[_0x5f20('0x35')]=function(_0x51df1c,_0x8caa1a){var _0x233381={},_0x2ebc52={},_0x2923c8={'count':0x0,'rows':[]};var _0x447d90=_[_0x5f20('0x36')](db[_0x5f20('0x37')]['rawAttributes'],function(_0x3c1223){return{'name':_0x3c1223[_0x5f20('0x38')],'type':_0x3c1223['type'][_0x5f20('0x39')]};});_0x2ebc52[_0x5f20('0x3a')]=_[_0x5f20('0x36')](_0x447d90,_0x5f20('0x33'));_0x2ebc52['query']=_['keys'](_0x51df1c[_0x5f20('0x3b')]);_0x2ebc52[_0x5f20('0x3c')]=_[_0x5f20('0x3d')](_0x2ebc52[_0x5f20('0x3a')],_0x2ebc52[_0x5f20('0x3b')]);_0x233381[_0x5f20('0x3e')]=_[_0x5f20('0x3d')](_0x2ebc52[_0x5f20('0x3a')],qs['fields'](_0x51df1c[_0x5f20('0x3b')][_0x5f20('0x3f')]));_0x233381[_0x5f20('0x3e')]=_0x233381[_0x5f20('0x3e')][_0x5f20('0x40')]?_0x233381[_0x5f20('0x3e')]:_0x2ebc52[_0x5f20('0x3a')];if(!_0x51df1c['query'][_0x5f20('0x41')](_0x5f20('0x42'))){_0x233381[_0x5f20('0x2b')]=qs[_0x5f20('0x2b')](_0x51df1c[_0x5f20('0x3b')][_0x5f20('0x2b')]);_0x233381['offset']=qs[_0x5f20('0x2a')](_0x51df1c[_0x5f20('0x3b')][_0x5f20('0x2a')]);}_0x233381[_0x5f20('0x43')]=qs[_0x5f20('0x44')](_0x51df1c[_0x5f20('0x3b')]['sort']);_0x233381[_0x5f20('0x45')]=qs[_0x5f20('0x3c')](_[_0x5f20('0x46')](_0x51df1c['query'],_0x2ebc52[_0x5f20('0x3c')]),_0x447d90);if(_0x51df1c[_0x5f20('0x3b')]['filter']){_0x233381[_0x5f20('0x45')]=_[_0x5f20('0x47')](_0x233381[_0x5f20('0x45')],{'$or':_[_0x5f20('0x36')](_0x447d90,function(_0x5d6557){if(_0x5d6557[_0x5f20('0x48')]!==_0x5f20('0x49')){var _0x4200c7={};_0x4200c7[_0x5d6557[_0x5f20('0x33')]]={'$like':'%'+_0x51df1c['query'][_0x5f20('0x4a')]+'%'};return _0x4200c7;}})});}_0x233381=_['merge']({},_0x233381,_0x51df1c[_0x5f20('0x4b')]);var _0x421891={'where':_0x233381[_0x5f20('0x45')]};return db['Setting']['count'](_0x421891)[_0x5f20('0x1b')](function(_0x5f3ab7){_0x2923c8[_0x5f20('0x29')]=_0x5f3ab7;if(_0x51df1c['query']['includeAll']){_0x233381[_0x5f20('0x4c')]=[{'all':!![]}];}return db[_0x5f20('0x37')][_0x5f20('0x4d')](_0x233381);})['then'](function(_0x3be02e){_0x2923c8['rows']=_0x3be02e;return _0x2923c8;})[_0x5f20('0x1b')](respondWithFilteredResult(_0x8caa1a,_0x233381))[_0x5f20('0x25')](handleError(_0x8caa1a,null));};exports[_0x5f20('0x4e')]=function(_0x6b760c,_0xf5427c){var _0x54a2c0={'raw':![],'where':{'id':_0x6b760c[_0x5f20('0x4f')]['id']}},_0x3e95d1={};_0x3e95d1[_0x5f20('0x3a')]=_[_0x5f20('0x50')](db['Setting'][_0x5f20('0x51')]);_0x3e95d1[_0x5f20('0x3b')]=_['keys'](_0x6b760c[_0x5f20('0x3b')]);_0x3e95d1['filters']=_[_0x5f20('0x3d')](_0x3e95d1[_0x5f20('0x3a')],_0x3e95d1[_0x5f20('0x3b')]);_0x54a2c0[_0x5f20('0x3e')]=_[_0x5f20('0x3d')](_0x3e95d1[_0x5f20('0x3a')],qs[_0x5f20('0x3f')](_0x6b760c['query'][_0x5f20('0x3f')]));_0x54a2c0[_0x5f20('0x3e')]=_0x54a2c0[_0x5f20('0x3e')]['length']?_0x54a2c0['attributes']:_0x3e95d1[_0x5f20('0x3a')];if(_0x6b760c[_0x5f20('0x3b')][_0x5f20('0x52')]){_0x54a2c0[_0x5f20('0x4c')]=[{'all':!![]}];}_0x54a2c0=_[_0x5f20('0x47')]({},_0x54a2c0,_0x6b760c[_0x5f20('0x4b')]);return db['Setting']['find'](_0x54a2c0)[_0x5f20('0x1b')](handleEntityNotFound(_0xf5427c,null))[_0x5f20('0x1b')](respondWithResult(_0xf5427c,null))['catch'](handleError(_0xf5427c,null));};exports[_0x5f20('0x30')]=function(_0x11fa71,_0x39db3f){if(_0x11fa71[_0x5f20('0x53')]['id']){delete _0x11fa71[_0x5f20('0x53')]['id'];}return db['Setting'][_0x5f20('0x54')]({'where':{'id':_0x11fa71[_0x5f20('0x4f')]['id']}})[_0x5f20('0x1b')](handleEntityNotFound(_0x39db3f,null))['then'](saveUpdates(_0x11fa71[_0x5f20('0x53')],null))[_0x5f20('0x1b')](respondWithResult(_0x39db3f,null))[_0x5f20('0x25')](handleError(_0x39db3f,null));};exports['addLogo']=function(_0x1acc46,_0x26c58b,_0x3d1555){if(_0x1acc46[_0x5f20('0x55')]&&_0x1acc46[_0x5f20('0x55')][_0x5f20('0x56')]){_0x1acc46[_0x5f20('0x53')][_0x5f20('0x57')]=_0x1acc46[_0x5f20('0x55')]['filename'];}return db['Setting'][_0x5f20('0x54')]({'where':{'id':_0x1acc46['params']['id']}})[_0x5f20('0x1b')](handleEntityNotFound(_0x26c58b,null))[_0x5f20('0x1b')](saveUpdates(_0x1acc46[_0x5f20('0x53')],null))[_0x5f20('0x1b')](respondWithResult(_0x26c58b,null))[_0x5f20('0x25')](handleError(_0x26c58b,null));};exports['addLogoLogin']=function(_0x3dd37a,_0x4f3376,_0x4af332){if(_0x3dd37a[_0x5f20('0x55')]&&_0x3dd37a[_0x5f20('0x55')][_0x5f20('0x56')]){_0x3dd37a[_0x5f20('0x53')][_0x5f20('0x58')]=_0x3dd37a[_0x5f20('0x55')][_0x5f20('0x56')];}return db['Setting'][_0x5f20('0x54')]({'where':{'id':_0x3dd37a[_0x5f20('0x4f')]['id']}})[_0x5f20('0x1b')](handleEntityNotFound(_0x4f3376,null))['then'](saveUpdates(_0x3dd37a[_0x5f20('0x53')],null))['then'](respondWithResult(_0x4f3376,null))[_0x5f20('0x25')](handleError(_0x4f3376,null));};var utilLicense=require(_0x5f20('0x59'));exports[_0x5f20('0x5a')]=function(_0x4cb243,_0x4de3a6,_0x7a017a){var _0xb8ea31='server/files/images/logos';var _0x534276={'custom':![]};return utilLicense[_0x5f20('0x5b')]()[_0x5f20('0x1b')](function(_0x32b45e){if(_0x32b45e){_0x534276=_0x32b45e;}return db[_0x5f20('0x37')][_0x5f20('0x54')]({'where':{'id':_0x4cb243[_0x5f20('0x4f')]['id']},'attributes':[_0x5f20('0x57'),_0x5f20('0x58'),_0x5f20('0x5c'),'favicon',_0x5f20('0x5d'),_0x5f20('0x5e'),_0x5f20('0x5f'),_0x5f20('0x60')],'raw':!![]});})[_0x5f20('0x1b')](handleEntityNotFound(_0x4de3a6,null))['then'](function(_0x2f30dc){if(_0x2f30dc){var _0x550341=_0x2f30dc['logo']&&fs['existsSync'](path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0xb8ea31,_[_0x5f20('0x63')](_0x2f30dc[_0x5f20('0x57')])))?path['join'](config[_0x5f20('0x62')],_0xb8ea31,_[_0x5f20('0x63')](_0x2f30dc[_0x5f20('0x57')])):path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0xb8ea31,_[_0x5f20('0x63')](_0x5f20('0x64')));var _0x9f373f=_0x5f20('0x65')+_['upperFirst'](_0x5f20('0x57'));if(_0x2f30dc[_0x9f373f]||!_0x534276[_0x5f20('0x66')]){_0x550341=path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0xb8ea31,_['toLower'](_0x5f20('0x64')));}if(!fs['existsSync'](_0x550341)){throw new db[(_0x5f20('0x67'))][(_0x5f20('0x19'))](_[_0x5f20('0x68')](_0x5f20('0x57'))+_0x5f20('0x69'));}return _0x4de3a6[_0x5f20('0x6a')](_0x550341);}})['catch'](handleError(_0x4de3a6,null));};var utilLicense=require(_0x5f20('0x59'));exports[_0x5f20('0x6b')]=function(_0x37758d,_0x362a13,_0x382787){var _0x32b18e=_0x5f20('0x6c');var _0x123e4c={'custom':![]};return utilLicense[_0x5f20('0x5b')]()['then'](function(_0x5b84da){if(_0x5b84da){_0x123e4c=_0x5b84da;}return db[_0x5f20('0x37')][_0x5f20('0x54')]({'where':{'id':_0x37758d[_0x5f20('0x4f')]['id']},'attributes':[_0x5f20('0x57'),_0x5f20('0x58'),_0x5f20('0x5c'),_0x5f20('0x6d'),_0x5f20('0x5d'),'defaultLoginLogo','defaultPreferred',_0x5f20('0x60')],'raw':!![]});})[_0x5f20('0x1b')](handleEntityNotFound(_0x362a13,null))[_0x5f20('0x1b')](function(_0x31a6f2){if(_0x31a6f2){var _0x2a1452=_0x31a6f2[_0x5f20('0x58')]&&fs[_0x5f20('0x6e')](path['join'](config[_0x5f20('0x62')],_0x32b18e,_['toLower'](_0x31a6f2[_0x5f20('0x58')])))?path[_0x5f20('0x61')](config['root'],_0x32b18e,_[_0x5f20('0x63')](_0x31a6f2[_0x5f20('0x58')])):path[_0x5f20('0x61')](config['root'],_0x32b18e,_['toLower'](_0x5f20('0x6f')));var _0x590329=_0x5f20('0x65')+_[_0x5f20('0x68')](_0x5f20('0x58'));if(_0x31a6f2[_0x590329]||!_0x123e4c[_0x5f20('0x66')]){_0x2a1452=path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0x32b18e,_[_0x5f20('0x63')](_0x5f20('0x6f')));}if(!fs[_0x5f20('0x6e')](_0x2a1452)){throw new db[(_0x5f20('0x67'))]['ValidationError'](_[_0x5f20('0x68')](_0x5f20('0x58'))+'\x20not\x20found');}return _0x362a13['download'](_0x2a1452);}})['catch'](handleError(_0x362a13,null));};exports[_0x5f20('0x70')]=function(_0x46a228,_0x53b8bf){return db[_0x5f20('0x37')][_0x5f20('0x54')]({'where':{'id':_0x46a228['params']['id']},'attributes':[_0x5f20('0x71')]})[_0x5f20('0x1b')](respondWithResult(_0x53b8bf,null))[_0x5f20('0x25')](handleError(_0x53b8bf,null));};exports['addPreferred']=function(_0xe5b8f2,_0x3d6a17,_0x3cf99a){if(_0xe5b8f2[_0x5f20('0x55')]&&_0xe5b8f2[_0x5f20('0x55')][_0x5f20('0x56')]){_0xe5b8f2['body'][_0x5f20('0x5c')]=_0xe5b8f2[_0x5f20('0x55')][_0x5f20('0x56')];}return db[_0x5f20('0x37')][_0x5f20('0x54')]({'where':{'id':_0xe5b8f2[_0x5f20('0x4f')]['id']}})[_0x5f20('0x1b')](handleEntityNotFound(_0x3d6a17,null))[_0x5f20('0x1b')](saveUpdates(_0xe5b8f2[_0x5f20('0x53')],null))[_0x5f20('0x1b')](respondWithResult(_0x3d6a17,null))[_0x5f20('0x25')](handleError(_0x3d6a17,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x2e86f7,_0x3004b2,_0x296ad9){var _0x4849b6=_0x5f20('0x6c');var _0x420d9d={'custom':![]};return utilLicense[_0x5f20('0x5b')]()['then'](function(_0x4e46f1){if(_0x4e46f1){_0x420d9d=_0x4e46f1;}return db[_0x5f20('0x37')][_0x5f20('0x54')]({'where':{'id':_0x2e86f7[_0x5f20('0x4f')]['id']},'attributes':[_0x5f20('0x57'),_0x5f20('0x58'),_0x5f20('0x5c'),_0x5f20('0x6d'),'defaultLogo','defaultLoginLogo',_0x5f20('0x5f'),'defaultFavicon'],'raw':!![]});})[_0x5f20('0x1b')](handleEntityNotFound(_0x3004b2,null))[_0x5f20('0x1b')](function(_0x7218de){if(_0x7218de){var _0x519a50=_0x7218de[_0x5f20('0x5c')]&&fs['existsSync'](path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0x4849b6,_[_0x5f20('0x63')](_0x7218de['preferred'])))?path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0x4849b6,_[_0x5f20('0x63')](_0x7218de[_0x5f20('0x5c')])):path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0x4849b6,_['toLower'](_0x5f20('0x72')));var _0xade1a8='default'+_[_0x5f20('0x68')](_0x5f20('0x5c'));if(_0x7218de[_0xade1a8]||!_0x420d9d['custom']||!_0x420d9d['preferred']){_0x519a50=path[_0x5f20('0x61')](config['root'],_0x4849b6,_['toLower'](_0x5f20('0x72')));}if(!fs[_0x5f20('0x6e')](_0x519a50)){throw new db[(_0x5f20('0x67'))][(_0x5f20('0x19'))](_[_0x5f20('0x68')](_0x5f20('0x5c'))+_0x5f20('0x69'));}return _0x3004b2[_0x5f20('0x6a')](_0x519a50);}})[_0x5f20('0x25')](handleError(_0x3004b2,null));};exports[_0x5f20('0x73')]=function(_0x59b1c0,_0x4630f8,_0x396e4f){if(_0x59b1c0[_0x5f20('0x55')]&&_0x59b1c0[_0x5f20('0x55')][_0x5f20('0x56')]){_0x59b1c0[_0x5f20('0x53')][_0x5f20('0x6d')]=_0x59b1c0['file'][_0x5f20('0x56')];}return db[_0x5f20('0x37')]['find']({'where':{'id':_0x59b1c0[_0x5f20('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4630f8,null))['then'](saveUpdates(_0x59b1c0[_0x5f20('0x53')],null))[_0x5f20('0x1b')](respondWithResult(_0x4630f8,null))[_0x5f20('0x25')](handleError(_0x4630f8,null));};var utilLicense=require(_0x5f20('0x59'));exports[_0x5f20('0x74')]=function(_0x225c2f,_0x14f6f7,_0xae4f32){var _0x4f6c5a=_0x5f20('0x6c');var _0xe6c3d0={'custom':![]};return utilLicense[_0x5f20('0x5b')]()['then'](function(_0x432e51){if(_0x432e51){_0xe6c3d0=_0x432e51;}return db['Setting'][_0x5f20('0x54')]({'where':{'id':_0x225c2f[_0x5f20('0x4f')]['id']},'attributes':['logo',_0x5f20('0x58'),_0x5f20('0x5c'),_0x5f20('0x6d'),_0x5f20('0x5d'),'defaultLoginLogo',_0x5f20('0x5f'),_0x5f20('0x60')],'raw':!![]});})[_0x5f20('0x1b')](handleEntityNotFound(_0x14f6f7,null))[_0x5f20('0x1b')](function(_0x5acb1a){if(_0x5acb1a){var _0x1d74dd=_0x5acb1a[_0x5f20('0x6d')]&&fs['existsSync'](path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0x4f6c5a,_['toLower'](_0x5acb1a[_0x5f20('0x6d')])))?path['join'](config['root'],_0x4f6c5a,_[_0x5f20('0x63')](_0x5acb1a['favicon'])):path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0x4f6c5a,_[_0x5f20('0x63')](_0x5f20('0x75')));var _0x31e9b7=_0x5f20('0x65')+_[_0x5f20('0x68')](_0x5f20('0x6d'));if(_0x5acb1a[_0x31e9b7]||!_0xe6c3d0[_0x5f20('0x66')]){_0x1d74dd=path[_0x5f20('0x61')](config[_0x5f20('0x62')],_0x4f6c5a,_[_0x5f20('0x63')](_0x5f20('0x75')));}if(!fs['existsSync'](_0x1d74dd)){throw new db[(_0x5f20('0x67'))]['ValidationError'](_[_0x5f20('0x68')](_0x5f20('0x6d'))+_0x5f20('0x69'));}return _0x14f6f7['download'](_0x1d74dd);}})['catch'](handleError(_0x14f6f7,null));}; \ No newline at end of file +var _0x5fea=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','count','offset','Content-Range','apply','update','end','sendStatus','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','limit','sort','where','filter','VIRTUAL','merge','then','include','show','includeAll','options','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','\x20not\x20found','download','../../config/license/util','getLogoLogin','server/files/images/logos','defaultLoginLogo','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','eml-format','rimraf','fast-json-patch','util','to-csv','ejs','crypto','jsforce'];(function(_0x21a383,_0x2456d3){var _0x5798a7=function(_0x4d1cfc){while(--_0x4d1cfc){_0x21a383['push'](_0x21a383['shift']());}};_0x5798a7(++_0x2456d3);}(_0x5fea,0x145));var _0xa5fe=function(_0xb6b285,_0x596e01){_0xb6b285=_0xb6b285-0x0;var _0x11393c=_0x5fea[_0xb6b285];return _0x11393c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa5fe('0x0'));var rimraf=require(_0xa5fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5fe('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa5fe('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xa5fe('0x4'));var ejs=require(_0xa5fe('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa5fe('0x6'));var jsforce=require(_0xa5fe('0x7'));var deskjs=require(_0xa5fe('0x8'));var toCsv=require(_0xa5fe('0x4'));var querystring=require(_0xa5fe('0x9'));var Papa=require(_0xa5fe('0xa'));var Redis=require(_0xa5fe('0xb'));var authService=require(_0xa5fe('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa5fe('0xd'));var hardwareService=require(_0xa5fe('0xe'));var logger=require(_0xa5fe('0xf'))('api');var utils=require(_0xa5fe('0x10'));var config=require('../../config/environment');var db=require(_0xa5fe('0x11'))['db'];var jayson=require(_0xa5fe('0x12'));var client=jayson[_0xa5fe('0x13')][_0xa5fe('0x14')]({'port':0x232a});function checkPasswordPattern(_0x1cfad2,_0x1a4b37,_0x3860e6){if(_0x3860e6){var _0x433525=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x433525[_0xa5fe('0x15')](_0x1a4b37)){return _0x1cfad2;}else{throw new db[(_0xa5fe('0x16'))][(_0xa5fe('0x17'))](_0xa5fe('0x18'));}}else{return _0x1cfad2;}}function respondWithRpcPromise(_0x588a18,_0x100a7f,_0x2474e4,_0x521779){return new BPromise(function(_0x248c38,_0x2ea46c){var _0x35dc54=_0x521779||client;return _0x35dc54[_0xa5fe('0x19')](_0x588a18,_0x2474e4)['then'](function(_0x3e658d){logger[_0xa5fe('0x1a')](_0xa5fe('0x1b'),_0x100a7f,_0xa5fe('0x1c'));logger[_0xa5fe('0x1d')](_0xa5fe('0x1e'),_0x100a7f,_0xa5fe('0x1c'),JSON[_0xa5fe('0x1f')](_0x3e658d));if(_0x3e658d[_0xa5fe('0x20')]){if(_0x3e658d['error']['code']===0x1f4){logger[_0xa5fe('0x20')](_0xa5fe('0x1b'),_0x100a7f,_0x3e658d[_0xa5fe('0x20')]['message']);return _0x2ea46c(_0x3e658d['error'][_0xa5fe('0x21')]);}logger[_0xa5fe('0x20')]('Setting,\x20%s,\x20%s',_0x100a7f,_0x3e658d[_0xa5fe('0x20')][_0xa5fe('0x21')]);return _0x248c38(_0x3e658d['error'][_0xa5fe('0x21')]);}else{logger[_0xa5fe('0x1a')](_0xa5fe('0x1b'),_0x100a7f,_0xa5fe('0x1c'));_0x248c38(_0x3e658d[_0xa5fe('0x22')][_0xa5fe('0x21')]);}})[_0xa5fe('0x23')](function(_0x27fa41){logger[_0xa5fe('0x20')](_0xa5fe('0x1b'),_0x100a7f,_0x27fa41);_0x2ea46c(_0x27fa41);});});}function respondWithStatusCode(_0x27b18f,_0xb3c232){_0xb3c232=_0xb3c232||0xcc;return function(_0x493291){if(_0x493291){return _0x27b18f['sendStatus'](_0xb3c232);}return _0x27b18f[_0xa5fe('0x24')](_0xb3c232)['end']();};}function respondWithResult(_0x23f5bf,_0x54ae7d){_0x54ae7d=_0x54ae7d||0xc8;return function(_0x432fa0){if(_0x432fa0){return _0x23f5bf[_0xa5fe('0x24')](_0x54ae7d)[_0xa5fe('0x25')](_0x432fa0);}};}function respondWithFilteredResult(_0x555132,_0x3cc8fa){return function(_0x896031){if(_0x896031){var _0x969ace=_0x896031[_0xa5fe('0x26')],_0x357aec=_0x3cc8fa[_0xa5fe('0x27')],_0x10555e=_0x3cc8fa[_0xa5fe('0x27')]+_0x3cc8fa['limit'],_0x4428d4;if(_0x10555e>=_0x969ace){_0x10555e=_0x969ace;_0x4428d4=0xc8;}else{_0x4428d4=0xce;}_0x555132[_0xa5fe('0x24')](_0x4428d4);return _0x555132['set'](_0xa5fe('0x28'),_0x357aec+'-'+_0x10555e+'/'+_0x969ace)['json'](_0x896031);}return null;};}function patchUpdates(_0x43b799){return function(_0xca1e87){try{jsonpatch[_0xa5fe('0x29')](_0xca1e87,_0x43b799,!![]);}catch(_0x521188){return BPromise['reject'](_0x521188);}return _0xca1e87['save']();};}function saveUpdates(_0x2c2b65,_0xb22e20){return function(_0x16736a){if(_0x16736a){return _0x16736a[_0xa5fe('0x2a')](_0x2c2b65)['then'](function(_0x1833b4){return _0x1833b4;});}return null;};}function removeEntity(_0xb2871c,_0x4bd7c6){return function(_0x5a2bc8){if(_0x5a2bc8){return _0x5a2bc8['destroy']()['then'](function(){_0xb2871c[_0xa5fe('0x24')](0xcc)[_0xa5fe('0x2b')]();});}};}function handleEntityNotFound(_0x524cb2,_0x10063f){return function(_0x318814){if(!_0x318814){_0x524cb2[_0xa5fe('0x2c')](0x194);}return _0x318814;};}function handleError(_0x12890b,_0x5236f2){_0x5236f2=_0x5236f2||0x1f4;return function(_0x124407){logger['error'](_0x124407[_0xa5fe('0x2d')]);if(_0x124407[_0xa5fe('0x2e')]){delete _0x124407['name'];}_0x12890b['status'](_0x5236f2)['send'](_0x124407);};}exports[_0xa5fe('0x2f')]=function(_0x45caac,_0x3568e6){var _0x2dbfc6={},_0x349564={},_0x9bec54={'count':0x0,'rows':[]};var _0x2e0284=_[_0xa5fe('0x30')](db[_0xa5fe('0x31')][_0xa5fe('0x32')],function(_0x1d478c){return{'name':_0x1d478c[_0xa5fe('0x33')],'type':_0x1d478c[_0xa5fe('0x34')][_0xa5fe('0x35')]};});_0x349564[_0xa5fe('0x36')]=_[_0xa5fe('0x30')](_0x2e0284,_0xa5fe('0x2e'));_0x349564[_0xa5fe('0x37')]=_[_0xa5fe('0x38')](_0x45caac['query']);_0x349564[_0xa5fe('0x39')]=_['intersection'](_0x349564[_0xa5fe('0x36')],_0x349564[_0xa5fe('0x37')]);_0x2dbfc6[_0xa5fe('0x3a')]=_[_0xa5fe('0x3b')](_0x349564[_0xa5fe('0x36')],qs[_0xa5fe('0x3c')](_0x45caac[_0xa5fe('0x37')][_0xa5fe('0x3c')]));_0x2dbfc6[_0xa5fe('0x3a')]=_0x2dbfc6[_0xa5fe('0x3a')][_0xa5fe('0x3d')]?_0x2dbfc6['attributes']:_0x349564[_0xa5fe('0x36')];if(!_0x45caac[_0xa5fe('0x37')]['hasOwnProperty']('nolimit')){_0x2dbfc6[_0xa5fe('0x3e')]=qs[_0xa5fe('0x3e')](_0x45caac[_0xa5fe('0x37')][_0xa5fe('0x3e')]);_0x2dbfc6[_0xa5fe('0x27')]=qs[_0xa5fe('0x27')](_0x45caac[_0xa5fe('0x37')][_0xa5fe('0x27')]);}_0x2dbfc6['order']=qs[_0xa5fe('0x3f')](_0x45caac[_0xa5fe('0x37')][_0xa5fe('0x3f')]);_0x2dbfc6[_0xa5fe('0x40')]=qs[_0xa5fe('0x39')](_['pick'](_0x45caac[_0xa5fe('0x37')],_0x349564[_0xa5fe('0x39')]),_0x2e0284);if(_0x45caac[_0xa5fe('0x37')][_0xa5fe('0x41')]){_0x2dbfc6['where']=_['merge'](_0x2dbfc6[_0xa5fe('0x40')],{'$or':_[_0xa5fe('0x30')](_0x2e0284,function(_0x3b2623){if(_0x3b2623[_0xa5fe('0x34')]!==_0xa5fe('0x42')){var _0x2b47f5={};_0x2b47f5[_0x3b2623[_0xa5fe('0x2e')]]={'$like':'%'+_0x45caac['query']['filter']+'%'};return _0x2b47f5;}})});}_0x2dbfc6=_[_0xa5fe('0x43')]({},_0x2dbfc6,_0x45caac['options']);var _0x385493={'where':_0x2dbfc6[_0xa5fe('0x40')]};return db[_0xa5fe('0x31')][_0xa5fe('0x26')](_0x385493)[_0xa5fe('0x44')](function(_0x4fe2a6){_0x9bec54[_0xa5fe('0x26')]=_0x4fe2a6;if(_0x45caac[_0xa5fe('0x37')]['includeAll']){_0x2dbfc6[_0xa5fe('0x45')]=[{'all':!![]}];}return db[_0xa5fe('0x31')]['findAll'](_0x2dbfc6);})[_0xa5fe('0x44')](function(_0xf4f3e2){_0x9bec54['rows']=_0xf4f3e2;return _0x9bec54;})[_0xa5fe('0x44')](respondWithFilteredResult(_0x3568e6,_0x2dbfc6))[_0xa5fe('0x23')](handleError(_0x3568e6,null));};exports[_0xa5fe('0x46')]=function(_0x152e3e,_0x28efc4){var _0x4bfced={'raw':![],'where':{'id':_0x152e3e['params']['id']}},_0x5986d9={};_0x5986d9[_0xa5fe('0x36')]=_[_0xa5fe('0x38')](db[_0xa5fe('0x31')][_0xa5fe('0x32')]);_0x5986d9[_0xa5fe('0x37')]=_[_0xa5fe('0x38')](_0x152e3e['query']);_0x5986d9[_0xa5fe('0x39')]=_[_0xa5fe('0x3b')](_0x5986d9['model'],_0x5986d9[_0xa5fe('0x37')]);_0x4bfced[_0xa5fe('0x3a')]=_['intersection'](_0x5986d9[_0xa5fe('0x36')],qs[_0xa5fe('0x3c')](_0x152e3e['query'][_0xa5fe('0x3c')]));_0x4bfced[_0xa5fe('0x3a')]=_0x4bfced['attributes'][_0xa5fe('0x3d')]?_0x4bfced[_0xa5fe('0x3a')]:_0x5986d9[_0xa5fe('0x36')];if(_0x152e3e[_0xa5fe('0x37')][_0xa5fe('0x47')]){_0x4bfced['include']=[{'all':!![]}];}_0x4bfced=_[_0xa5fe('0x43')]({},_0x4bfced,_0x152e3e[_0xa5fe('0x48')]);return db[_0xa5fe('0x31')][_0xa5fe('0x49')](_0x4bfced)[_0xa5fe('0x44')](handleEntityNotFound(_0x28efc4,null))[_0xa5fe('0x44')](respondWithResult(_0x28efc4,null))[_0xa5fe('0x23')](handleError(_0x28efc4,null));};exports[_0xa5fe('0x2a')]=function(_0x947e65,_0x139368){if(_0x947e65[_0xa5fe('0x4a')]['id']){delete _0x947e65[_0xa5fe('0x4a')]['id'];}return db[_0xa5fe('0x31')][_0xa5fe('0x49')]({'where':{'id':_0x947e65[_0xa5fe('0x4b')]['id']}})[_0xa5fe('0x44')](handleEntityNotFound(_0x139368,null))[_0xa5fe('0x44')](saveUpdates(_0x947e65[_0xa5fe('0x4a')],null))[_0xa5fe('0x44')](respondWithResult(_0x139368,null))[_0xa5fe('0x23')](handleError(_0x139368,null));};exports[_0xa5fe('0x4c')]=function(_0x15db1b,_0x4d86ed,_0x1c7a01){if(_0x15db1b[_0xa5fe('0x4d')]&&_0x15db1b[_0xa5fe('0x4d')][_0xa5fe('0x4e')]){_0x15db1b[_0xa5fe('0x4a')][_0xa5fe('0x4f')]=_0x15db1b[_0xa5fe('0x4d')][_0xa5fe('0x4e')];}return db[_0xa5fe('0x31')][_0xa5fe('0x49')]({'where':{'id':_0x15db1b[_0xa5fe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d86ed,null))[_0xa5fe('0x44')](saveUpdates(_0x15db1b[_0xa5fe('0x4a')],null))[_0xa5fe('0x44')](respondWithResult(_0x4d86ed,null))[_0xa5fe('0x23')](handleError(_0x4d86ed,null));};exports[_0xa5fe('0x50')]=function(_0x36cdb5,_0x3667dd,_0x2b2bf6){if(_0x36cdb5['file']&&_0x36cdb5[_0xa5fe('0x4d')][_0xa5fe('0x4e')]){_0x36cdb5[_0xa5fe('0x4a')][_0xa5fe('0x51')]=_0x36cdb5[_0xa5fe('0x4d')][_0xa5fe('0x4e')];}return db[_0xa5fe('0x31')]['find']({'where':{'id':_0x36cdb5[_0xa5fe('0x4b')]['id']}})[_0xa5fe('0x44')](handleEntityNotFound(_0x3667dd,null))['then'](saveUpdates(_0x36cdb5[_0xa5fe('0x4a')],null))[_0xa5fe('0x44')](respondWithResult(_0x3667dd,null))[_0xa5fe('0x23')](handleError(_0x3667dd,null));};var utilLicense=require('../../config/license/util');exports[_0xa5fe('0x52')]=function(_0x46e94f,_0x23a0d3,_0x29a7fb){var _0x118c43='server/files/images/logos';var _0x259f50={'custom':![]};return utilLicense[_0xa5fe('0x53')]()[_0xa5fe('0x44')](function(_0x2b9977){if(_0x2b9977){_0x259f50=_0x2b9977;}return db[_0xa5fe('0x31')][_0xa5fe('0x49')]({'where':{'id':_0x46e94f[_0xa5fe('0x4b')]['id']},'attributes':[_0xa5fe('0x4f'),_0xa5fe('0x51'),_0xa5fe('0x54'),_0xa5fe('0x55'),_0xa5fe('0x56'),'defaultLoginLogo',_0xa5fe('0x57'),_0xa5fe('0x58')],'raw':!![]});})[_0xa5fe('0x44')](handleEntityNotFound(_0x23a0d3,null))[_0xa5fe('0x44')](function(_0x2945f4){if(_0x2945f4){var _0x1d66aa=_0x2945f4['logo']&&fs[_0xa5fe('0x59')](path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x118c43,_[_0xa5fe('0x5c')](_0x2945f4[_0xa5fe('0x4f')])))?path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x118c43,_[_0xa5fe('0x5c')](_0x2945f4[_0xa5fe('0x4f')])):path['join'](config[_0xa5fe('0x5b')],_0x118c43,_[_0xa5fe('0x5c')]('default_logo.svg'));var _0x34d4a2=_0xa5fe('0x5d')+_[_0xa5fe('0x5e')](_0xa5fe('0x4f'));if(_0x2945f4[_0x34d4a2]||!_0x259f50[_0xa5fe('0x5f')]){_0x1d66aa=path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x118c43,_[_0xa5fe('0x5c')](_0xa5fe('0x60')));}if(!fs[_0xa5fe('0x59')](_0x1d66aa)){throw new db[(_0xa5fe('0x16'))][(_0xa5fe('0x17'))](_[_0xa5fe('0x5e')]('logo')+_0xa5fe('0x61'));}return _0x23a0d3[_0xa5fe('0x62')](_0x1d66aa);}})[_0xa5fe('0x23')](handleError(_0x23a0d3,null));};var utilLicense=require(_0xa5fe('0x63'));exports[_0xa5fe('0x64')]=function(_0x18bb73,_0x195e8b,_0x37c5dc){var _0x20c688=_0xa5fe('0x65');var _0x275976={'custom':![]};return utilLicense[_0xa5fe('0x53')]()[_0xa5fe('0x44')](function(_0x4e80ef){if(_0x4e80ef){_0x275976=_0x4e80ef;}return db[_0xa5fe('0x31')][_0xa5fe('0x49')]({'where':{'id':_0x18bb73[_0xa5fe('0x4b')]['id']},'attributes':[_0xa5fe('0x4f'),_0xa5fe('0x51'),_0xa5fe('0x54'),_0xa5fe('0x55'),'defaultLogo',_0xa5fe('0x66'),_0xa5fe('0x57'),_0xa5fe('0x58')],'raw':!![]});})[_0xa5fe('0x44')](handleEntityNotFound(_0x195e8b,null))[_0xa5fe('0x44')](function(_0x1023de){if(_0x1023de){var _0xb66ced=_0x1023de['loginLogo']&&fs[_0xa5fe('0x59')](path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x20c688,_[_0xa5fe('0x5c')](_0x1023de[_0xa5fe('0x51')])))?path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x20c688,_[_0xa5fe('0x5c')](_0x1023de[_0xa5fe('0x51')])):path['join'](config['root'],_0x20c688,_[_0xa5fe('0x5c')](_0xa5fe('0x67')));var _0x36d457=_0xa5fe('0x5d')+_[_0xa5fe('0x5e')]('loginLogo');if(_0x1023de[_0x36d457]||!_0x275976[_0xa5fe('0x5f')]){_0xb66ced=path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x20c688,_[_0xa5fe('0x5c')](_0xa5fe('0x67')));}if(!fs[_0xa5fe('0x59')](_0xb66ced)){throw new db[(_0xa5fe('0x16'))]['ValidationError'](_[_0xa5fe('0x5e')]('loginLogo')+_0xa5fe('0x61'));}return _0x195e8b[_0xa5fe('0x62')](_0xb66ced);}})[_0xa5fe('0x23')](handleError(_0x195e8b,null));};exports['gdpr']=function(_0x3dd055,_0x41407f){return db[_0xa5fe('0x31')][_0xa5fe('0x49')]({'where':{'id':_0x3dd055[_0xa5fe('0x4b')]['id']},'attributes':[_0xa5fe('0x68')]})[_0xa5fe('0x44')](respondWithResult(_0x41407f,null))['catch'](handleError(_0x41407f,null));};exports[_0xa5fe('0x69')]=function(_0x176a79,_0x130463,_0x4b5dbf){if(_0x176a79[_0xa5fe('0x4d')]&&_0x176a79['file'][_0xa5fe('0x4e')]){_0x176a79['body'][_0xa5fe('0x54')]=_0x176a79[_0xa5fe('0x4d')][_0xa5fe('0x4e')];}return db['Setting']['find']({'where':{'id':_0x176a79[_0xa5fe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x130463,null))[_0xa5fe('0x44')](saveUpdates(_0x176a79[_0xa5fe('0x4a')],null))[_0xa5fe('0x44')](respondWithResult(_0x130463,null))[_0xa5fe('0x23')](handleError(_0x130463,null));};var utilLicense=require(_0xa5fe('0x63'));exports[_0xa5fe('0x6a')]=function(_0x2865f4,_0x6ce305,_0x346bc0){var _0x373b78=_0xa5fe('0x65');var _0xd5a9d7={'custom':![]};return utilLicense[_0xa5fe('0x53')]()[_0xa5fe('0x44')](function(_0x53169f){if(_0x53169f){_0xd5a9d7=_0x53169f;}return db['Setting'][_0xa5fe('0x49')]({'where':{'id':_0x2865f4[_0xa5fe('0x4b')]['id']},'attributes':[_0xa5fe('0x4f'),_0xa5fe('0x51'),'preferred',_0xa5fe('0x55'),_0xa5fe('0x56'),_0xa5fe('0x66'),'defaultPreferred',_0xa5fe('0x58')],'raw':!![]});})[_0xa5fe('0x44')](handleEntityNotFound(_0x6ce305,null))[_0xa5fe('0x44')](function(_0x253382){if(_0x253382){var _0xeebdc6=_0x253382[_0xa5fe('0x54')]&&fs['existsSync'](path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x373b78,_[_0xa5fe('0x5c')](_0x253382[_0xa5fe('0x54')])))?path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x373b78,_[_0xa5fe('0x5c')](_0x253382[_0xa5fe('0x54')])):path['join'](config['root'],_0x373b78,_[_0xa5fe('0x5c')](_0xa5fe('0x6b')));var _0x20ff60=_0xa5fe('0x5d')+_[_0xa5fe('0x5e')]('preferred');if(_0x253382[_0x20ff60]||!_0xd5a9d7[_0xa5fe('0x5f')]||!_0xd5a9d7[_0xa5fe('0x54')]){_0xeebdc6=path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x373b78,_[_0xa5fe('0x5c')](_0xa5fe('0x6b')));}if(!fs[_0xa5fe('0x59')](_0xeebdc6)){throw new db[(_0xa5fe('0x16'))][(_0xa5fe('0x17'))](_[_0xa5fe('0x5e')](_0xa5fe('0x54'))+_0xa5fe('0x61'));}return _0x6ce305[_0xa5fe('0x62')](_0xeebdc6);}})[_0xa5fe('0x23')](handleError(_0x6ce305,null));};exports[_0xa5fe('0x6c')]=function(_0x273d82,_0x1ca966,_0x196dc1){if(_0x273d82[_0xa5fe('0x4d')]&&_0x273d82[_0xa5fe('0x4d')]['filename']){_0x273d82[_0xa5fe('0x4a')]['favicon']=_0x273d82[_0xa5fe('0x4d')][_0xa5fe('0x4e')];}return db[_0xa5fe('0x31')][_0xa5fe('0x49')]({'where':{'id':_0x273d82['params']['id']}})[_0xa5fe('0x44')](handleEntityNotFound(_0x1ca966,null))[_0xa5fe('0x44')](saveUpdates(_0x273d82['body'],null))[_0xa5fe('0x44')](respondWithResult(_0x1ca966,null))[_0xa5fe('0x23')](handleError(_0x1ca966,null));};var utilLicense=require(_0xa5fe('0x63'));exports[_0xa5fe('0x6d')]=function(_0x16fda6,_0x1af49f,_0x187bd3){var _0x1f93e8='server/files/images/logos';var _0x4e2b7d={'custom':![]};return utilLicense[_0xa5fe('0x53')]()['then'](function(_0x162f95){if(_0x162f95){_0x4e2b7d=_0x162f95;}return db['Setting'][_0xa5fe('0x49')]({'where':{'id':_0x16fda6['params']['id']},'attributes':[_0xa5fe('0x4f'),_0xa5fe('0x51'),_0xa5fe('0x54'),_0xa5fe('0x55'),_0xa5fe('0x56'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa5fe('0x44')](handleEntityNotFound(_0x1af49f,null))['then'](function(_0x4a5666){if(_0x4a5666){var _0x43a484=_0x4a5666[_0xa5fe('0x55')]&&fs['existsSync'](path[_0xa5fe('0x5a')](config['root'],_0x1f93e8,_['toLower'](_0x4a5666[_0xa5fe('0x55')])))?path[_0xa5fe('0x5a')](config[_0xa5fe('0x5b')],_0x1f93e8,_[_0xa5fe('0x5c')](_0x4a5666[_0xa5fe('0x55')])):path[_0xa5fe('0x5a')](config['root'],_0x1f93e8,_[_0xa5fe('0x5c')](_0xa5fe('0x6e')));var _0xb2d7e='default'+_[_0xa5fe('0x5e')](_0xa5fe('0x55'));if(_0x4a5666[_0xb2d7e]||!_0x4e2b7d[_0xa5fe('0x5f')]){_0x43a484=path[_0xa5fe('0x5a')](config['root'],_0x1f93e8,_['toLower'](_0xa5fe('0x6e')));}if(!fs['existsSync'](_0x43a484)){throw new db['Sequelize'][(_0xa5fe('0x17'))](_[_0xa5fe('0x5e')]('favicon')+'\x20not\x20found');}return _0x1af49f['download'](_0x43a484);}})['catch'](handleError(_0x1af49f,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 20593ae..d0cb1a2 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 _0xeb58=['../../config/environment','define','Setting','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x48fff1,_0x50c537){var _0x127a1d=function(_0x2abe66){while(--_0x2abe66){_0x48fff1['push'](_0x48fff1['shift']());}};_0x127a1d(++_0x50c537);}(_0xeb58,0x184));var _0x8eb5=function(_0xf590ec,_0x28a562){_0xf590ec=_0xf590ec-0x0;var _0x46ff04=_0xeb58[_0xf590ec];return _0x46ff04;};'use strict';var _=require(_0x8eb5('0x0'));var util=require(_0x8eb5('0x1'));var logger=require(_0x8eb5('0x2'))(_0x8eb5('0x3'));var moment=require(_0x8eb5('0x4'));var BPromise=require('bluebird');var rp=require(_0x8eb5('0x5'));var fs=require('fs');var path=require(_0x8eb5('0x6'));var rimraf=require(_0x8eb5('0x7'));var config=require(_0x8eb5('0x8'));var attributes=require('./setting.attributes');module['exports']=function(_0x59382d,_0x50730c){return _0x59382d[_0x8eb5('0x9')](_0x8eb5('0xa'),attributes,{'tableName':_0x8eb5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffb5=['define','Setting','settings','lodash','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x467739,_0x35e9dd){var _0x17e4df=function(_0x27dc4a){while(--_0x27dc4a){_0x467739['push'](_0x467739['shift']());}};_0x17e4df(++_0x35e9dd);}(_0xffb5,0x12c));var _0x5ffb=function(_0x38fa6d,_0x1aabc7){_0x38fa6d=_0x38fa6d-0x0;var _0x5a3b03=_0xffb5[_0x38fa6d];return _0x5a3b03;};'use strict';var _=require(_0x5ffb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5ffb('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ffb('0x2'));var rimraf=require(_0x5ffb('0x3'));var config=require(_0x5ffb('0x4'));var attributes=require('./setting.attributes');module[_0x5ffb('0x5')]=function(_0x271a70,_0x2cb34c){return _0x271a70[_0x5ffb('0x6')](_0x5ffb('0x7'),attributes,{'tableName':_0x5ffb('0x8'),'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 bd6f5de..8de122c 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 _0xf5fd=['debug','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf5fd,0x15c));var _0xdf5f=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xf5fd[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xdf5f('0x0'));var util=require('util');var moment=require(_0xdf5f('0x1'));var BPromise=require(_0xdf5f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf5f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf5f('0x4'));var logger=require(_0xdf5f('0x5'))('rpc');var config=require(_0xdf5f('0x6'));var jayson=require(_0xdf5f('0x7'));var client=jayson['client'][_0xdf5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c231d,_0x2fd69e,_0x4cc57b){return new BPromise(function(_0x830746,_0x478516){return client[_0xdf5f('0x9')](_0x4c231d,_0x4cc57b)['then'](function(_0x40eaa5){logger[_0xdf5f('0xa')](_0xdf5f('0xb'),_0x2fd69e,_0xdf5f('0xc'));logger[_0xdf5f('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x2fd69e,_0xdf5f('0xc'),JSON[_0xdf5f('0xe')](_0x40eaa5));if(_0x40eaa5[_0xdf5f('0xf')]){if(_0x40eaa5[_0xdf5f('0xf')]['code']===0x1f4){logger[_0xdf5f('0xf')]('Setting,\x20%s,\x20%s',_0x2fd69e,_0x40eaa5['error'][_0xdf5f('0x10')]);return _0x478516(_0x40eaa5[_0xdf5f('0xf')][_0xdf5f('0x10')]);}logger[_0xdf5f('0xf')](_0xdf5f('0xb'),_0x2fd69e,_0x40eaa5[_0xdf5f('0xf')][_0xdf5f('0x10')]);return _0x830746(_0x40eaa5[_0xdf5f('0xf')][_0xdf5f('0x10')]);}else{logger[_0xdf5f('0xa')](_0xdf5f('0xb'),_0x2fd69e,_0xdf5f('0xc'));_0x830746(_0x40eaa5[_0xdf5f('0x11')][_0xdf5f('0x10')]);}})[_0xdf5f('0x12')](function(_0x1c2fc4){logger[_0xdf5f('0xf')](_0xdf5f('0xb'),_0x2fd69e,_0x1c2fc4);_0x478516(_0x1c2fc4);});});} \ No newline at end of file +var _0x7c37=['request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','Setting,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c37,0x6c));var _0x77c3=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x7c37[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x77c3('0x0'));var util=require('util');var moment=require(_0x77c3('0x1'));var BPromise=require(_0x77c3('0x2'));var rs=require(_0x77c3('0x3'));var fs=require('fs');var Redis=require(_0x77c3('0x4'));var db=require(_0x77c3('0x5'))['db'];var utils=require(_0x77c3('0x6'));var logger=require(_0x77c3('0x7'))(_0x77c3('0x8'));var config=require('../../config/environment');var jayson=require(_0x77c3('0x9'));var client=jayson[_0x77c3('0xa')][_0x77c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4249f3,_0x3b665f,_0x58be68){return new BPromise(function(_0x396241,_0x755843){return client[_0x77c3('0xc')](_0x4249f3,_0x58be68)[_0x77c3('0xd')](function(_0x351a3e){logger[_0x77c3('0xe')]('Setting,\x20%s,\x20%s',_0x3b665f,_0x77c3('0xf'));logger['debug'](_0x77c3('0x10'),_0x3b665f,'request\x20sent',JSON['stringify'](_0x351a3e));if(_0x351a3e['error']){if(_0x351a3e[_0x77c3('0x11')]['code']===0x1f4){logger['error'](_0x77c3('0x12'),_0x3b665f,_0x351a3e[_0x77c3('0x11')][_0x77c3('0x13')]);return _0x755843(_0x351a3e[_0x77c3('0x11')][_0x77c3('0x13')]);}logger['error'](_0x77c3('0x12'),_0x3b665f,_0x351a3e[_0x77c3('0x11')][_0x77c3('0x13')]);return _0x396241(_0x351a3e[_0x77c3('0x11')][_0x77c3('0x13')]);}else{logger[_0x77c3('0xe')]('Setting,\x20%s,\x20%s',_0x3b665f,'request\x20sent');_0x396241(_0x351a3e['result'][_0x77c3('0x13')]);}})['catch'](function(_0x25641f){logger['error'](_0x77c3('0x12'),_0x3b665f,_0x25641f);_0x755843(_0x25641f);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7d91531..ce4a9ef 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 _0x3519=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','isAuthenticated','index','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','getAgents','post','addDisposition','/:id/notify','notify','/:id/send','send','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','/:id/users','removeAgents'];(function(_0x28aec7,_0x355e00){var _0x53df54=function(_0x3d4e37){while(--_0x3d4e37){_0x28aec7['push'](_0x28aec7['shift']());}};_0x53df54(++_0x355e00);}(_0x3519,0x99));var _0x9351=function(_0x2b1a36,_0x52eecd){_0x2b1a36=_0x2b1a36-0x0;var _0x2e03ca=_0x3519[_0x2b1a36];return _0x2e03ca;};'use strict';var multer=require(_0x9351('0x0'));var util=require(_0x9351('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9351('0x2'));var router=express[_0x9351('0x3')]();var auth=require(_0x9351('0x4'));var interaction=require(_0x9351('0x5'));var config=require(_0x9351('0x6'));var controller=require(_0x9351('0x7'));router['get']('/',auth[_0x9351('0x8')](),controller[_0x9351('0x9')]);router[_0x9351('0xa')](_0x9351('0xb'),auth[_0x9351('0x8')](),controller['describe']);router['get'](_0x9351('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9351('0xd'),auth['isAuthenticated'](),controller[_0x9351('0xe')]);router[_0x9351('0xa')](_0x9351('0xf'),auth[_0x9351('0x8')](),controller['getAnswers']);router['get'](_0x9351('0x10'),auth[_0x9351('0x8')](),controller[_0x9351('0x11')]);router[_0x9351('0xa')](_0x9351('0x12'),auth[_0x9351('0x8')](),controller['getInteractions']);router['get'](_0x9351('0x13'),controller[_0x9351('0x14')]);router[_0x9351('0xa')]('/:id/users',auth[_0x9351('0x8')](),controller[_0x9351('0x15')]);router[_0x9351('0x16')]('/',auth[_0x9351('0x8')](),controller['create']);router[_0x9351('0x16')](_0x9351('0xd'),auth[_0x9351('0x8')](),controller[_0x9351('0x17')]);router[_0x9351('0x16')]('/:id/canned_answers',auth[_0x9351('0x8')](),controller['addAnswer']);router['post'](_0x9351('0x18'),controller[_0x9351('0x19')]);router[_0x9351('0x16')](_0x9351('0x10'),auth[_0x9351('0x8')](),controller['addApplications']);router['post'](_0x9351('0x1a'),auth[_0x9351('0x8')](),controller[_0x9351('0x1b')]);router[_0x9351('0x16')](_0x9351('0x13'),controller['status']);router[_0x9351('0x16')]('/:id/users',auth[_0x9351('0x8')](),controller[_0x9351('0x1c')]);router[_0x9351('0x1d')](_0x9351('0xc'),auth['isAuthenticated'](),controller[_0x9351('0x1e')]);router['delete'](_0x9351('0xc'),auth[_0x9351('0x8')](),controller[_0x9351('0x1f')]);router[_0x9351('0x20')](_0x9351('0xd'),auth[_0x9351('0x8')](),controller[_0x9351('0x21')]);router['delete']('/:id/canned_answers',auth[_0x9351('0x8')](),controller[_0x9351('0x22')]);router[_0x9351('0x20')](_0x9351('0x23'),auth[_0x9351('0x8')](),controller[_0x9351('0x24')]);module[_0x9351('0x25')]=router; \ No newline at end of file +var _0xf872=['exports','multer','util','connect-timeout','express','../../components/auth/service','./smsAccount.controller','get','/describe','isAuthenticated','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','/:id/send','send','/:id/status','addAgents','/:id','delete','destroy','removeDispositions','removeAgents'];(function(_0x2a5fa1,_0x1752c5){var _0x134572=function(_0x5c507a){while(--_0x5c507a){_0x2a5fa1['push'](_0x2a5fa1['shift']());}};_0x134572(++_0x1752c5);}(_0xf872,0x1eb));var _0x2f87=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0xf872[_0x38fb0d];return _0x30a5d6;};'use strict';var multer=require(_0x2f87('0x0'));var util=require(_0x2f87('0x1'));var path=require('path');var timeout=require(_0x2f87('0x2'));var express=require(_0x2f87('0x3'));var router=express['Router']();var auth=require(_0x2f87('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2f87('0x5'));router[_0x2f87('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2f87('0x6')](_0x2f87('0x7'),auth[_0x2f87('0x8')](),controller[_0x2f87('0x9')]);router[_0x2f87('0x6')]('/:id',auth[_0x2f87('0x8')](),controller['show']);router[_0x2f87('0x6')](_0x2f87('0xa'),auth[_0x2f87('0x8')](),controller[_0x2f87('0xb')]);router[_0x2f87('0x6')](_0x2f87('0xc'),auth[_0x2f87('0x8')](),controller[_0x2f87('0xd')]);router[_0x2f87('0x6')](_0x2f87('0xe'),auth[_0x2f87('0x8')](),controller[_0x2f87('0xf')]);router['get']('/:id/interactions',auth[_0x2f87('0x8')](),controller[_0x2f87('0x10')]);router[_0x2f87('0x6')]('/:id/status',controller['statusGet']);router['get'](_0x2f87('0x11'),auth[_0x2f87('0x8')](),controller[_0x2f87('0x12')]);router[_0x2f87('0x13')]('/',auth['isAuthenticated'](),controller[_0x2f87('0x14')]);router[_0x2f87('0x13')]('/:id/dispositions',auth[_0x2f87('0x8')](),controller[_0x2f87('0x15')]);router['post'](_0x2f87('0xc'),auth[_0x2f87('0x8')](),controller[_0x2f87('0x16')]);router[_0x2f87('0x13')]('/:id/notify',controller[_0x2f87('0x17')]);router[_0x2f87('0x13')](_0x2f87('0xe'),auth[_0x2f87('0x8')](),controller[_0x2f87('0x18')]);router[_0x2f87('0x13')](_0x2f87('0x19'),auth[_0x2f87('0x8')](),controller[_0x2f87('0x1a')]);router[_0x2f87('0x13')](_0x2f87('0x1b'),controller['status']);router[_0x2f87('0x13')]('/:id/users',auth[_0x2f87('0x8')](),controller[_0x2f87('0x1c')]);router['put'](_0x2f87('0x1d'),auth['isAuthenticated'](),controller['update']);router[_0x2f87('0x1e')](_0x2f87('0x1d'),auth[_0x2f87('0x8')](),controller[_0x2f87('0x1f')]);router['delete'](_0x2f87('0xa'),auth[_0x2f87('0x8')](),controller[_0x2f87('0x20')]);router['delete'](_0x2f87('0xc'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x2f87('0x1e')](_0x2f87('0x11'),auth[_0x2f87('0x8')](),controller[_0x2f87('0x21')]);module[_0x2f87('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index fda056b..b194c26 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 _0xe5a0=['BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','ENUM'];(function(_0x471ed5,_0xab9864){var _0x258b66=function(_0x24d689){while(--_0x24d689){_0x471ed5['push'](_0x471ed5['shift']());}};_0x258b66(++_0xab9864);}(_0xe5a0,0x76));var _0x0e5a=function(_0x398ff2,_0x2aa0cd){_0x398ff2=_0x398ff2-0x0;var _0x47827f=_0xe5a0[_0x398ff2];return _0x47827f;};'use strict';var Sequelize=require(_0x0e5a('0x0'));var rs=require(_0x0e5a('0x1'));module[_0x0e5a('0x2')]={'name':{'type':Sequelize[_0x0e5a('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0e5a('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0e5a('0x3')],'defaultValue':function(){return rs[_0x0e5a('0x4')]();}},'phone':{'type':Sequelize[_0x0e5a('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x0e5a('0x5'),_0x0e5a('0x6'),_0x0e5a('0x7'),_0x0e5a('0x8'),_0x0e5a('0x9'),_0x0e5a('0xa'),_0x0e5a('0xb'),_0x0e5a('0xc'))},'accountSid':{'type':Sequelize[_0x0e5a('0x3')]},'authId':{'type':Sequelize[_0x0e5a('0x3')]},'authToken':{'type':Sequelize[_0x0e5a('0x3')]},'smsMethod':{'type':Sequelize[_0x0e5a('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0e5a('0x3')]},'password':{'type':Sequelize[_0x0e5a('0x3')]},'apiKey':{'type':Sequelize[_0x0e5a('0x3')]},'senderString':{'type':Sequelize[_0x0e5a('0x3')]},'deliveryReport':{'type':Sequelize[_0x0e5a('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x0e5a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0e5a('0xf')],'defaultValue':function(){return _0x0e5a('0x10');}},'notificationSound':{'type':Sequelize[_0x0e5a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0e5a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0e5a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0e5a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0e5a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0e5a('0x11')],'comment':_0x0e5a('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x0e5a('0xe')],'defaultValue':![],'comment':_0x0e5a('0x13'),'set':function(_0x16bad6){if(!_0x16bad6)this[_0x0e5a('0x14')]('mandatoryDispositionPauseId',null);this[_0x0e5a('0x14')](_0x0e5a('0x15'),_0x16bad6);}}}; \ No newline at end of file +var _0x7fe2=['skebby','connectel','clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x1b4688,_0x340a62){var _0x36c7ad=function(_0x1cdb15){while(--_0x1cdb15){_0x1b4688['push'](_0x1b4688['shift']());}};_0x36c7ad(++_0x340a62);}(_0x7fe2,0x82));var _0x27fe=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x7fe2[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0x27fe('0x0'));var rs=require(_0x27fe('0x1'));module[_0x27fe('0x2')]={'name':{'type':Sequelize[_0x27fe('0x3')],'unique':_0x27fe('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x27fe('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x27fe('0x5')]();}},'phone':{'type':Sequelize[_0x27fe('0x3')]},'type':{'type':Sequelize[_0x27fe('0x6')](_0x27fe('0x7'),_0x27fe('0x8'),_0x27fe('0x9'),_0x27fe('0xa'),_0x27fe('0xb'),_0x27fe('0xc'),_0x27fe('0xd'),_0x27fe('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0x27fe('0x3')]},'authId':{'type':Sequelize[_0x27fe('0x3')]},'authToken':{'type':Sequelize[_0x27fe('0x3')]},'smsMethod':{'type':Sequelize[_0x27fe('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x27fe('0x3')]},'password':{'type':Sequelize[_0x27fe('0x3')]},'apiKey':{'type':Sequelize[_0x27fe('0x3')]},'senderString':{'type':Sequelize[_0x27fe('0x3')]},'deliveryReport':{'type':Sequelize[_0x27fe('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x27fe('0x10')],'defaultValue':function(){return _0x27fe('0x11');}},'notificationSound':{'type':Sequelize[_0x27fe('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x27fe('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x27fe('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x27fe('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x27fe('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x27fe('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x27fe('0x12')],'comment':_0x27fe('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x27fe('0x14'),'set':function(_0x4b074d){if(!_0x4b074d)this[_0x27fe('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x27fe('0x16'),_0x4b074d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 64e264d..c40cd1a 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 _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x484bf4,_0x2b975c){var _0x31c683=function(_0x1cdda2){while(--_0x1cdda2){_0x484bf4['push'](_0x484bf4['shift']());}};_0x31c683(++_0x2b975c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b916b49..0e6ca01 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 _0x74a1=['hook','exports','events','../../mysqldb','SmsAccount','update','remove','emit','hasOwnProperty'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x74a1,0xe3));var _0x174a=function(_0x47bcee,_0x5c0311){_0x47bcee=_0x47bcee-0x0;var _0x4b88a8=_0x74a1[_0x47bcee];return _0x4b88a8;};'use strict';var EventEmitter=require(_0x174a('0x0'));var SmsAccount=require(_0x174a('0x1'))['db'][_0x174a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x174a('0x3'),'afterDestroy':_0x174a('0x4')};function emitEvent(_0x310a46){return function(_0x4b70c9,_0x312857,_0x809adb){SmsAccountEvents[_0x174a('0x5')](_0x310a46+':'+_0x4b70c9['id'],_0x4b70c9);SmsAccountEvents['emit'](_0x310a46,_0x4b70c9);_0x809adb(null);};}for(var e in events){if(events[_0x174a('0x6')](e)){var event=events[e];SmsAccount[_0x174a('0x7')](e,emitEvent(event));}}module[_0x174a('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x5df9=['../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x802234,_0x1ce298){var _0xaf1854=function(_0x36fb62){while(--_0x36fb62){_0x802234['push'](_0x802234['shift']());}};_0xaf1854(++_0x1ce298);}(_0x5df9,0x155));var _0x95df=function(_0x585298,_0x554e98){_0x585298=_0x585298-0x0;var _0x1c481c=_0x5df9[_0x585298];return _0x1c481c;};'use strict';var EventEmitter=require(_0x95df('0x0'));var SmsAccount=require(_0x95df('0x1'))['db'][_0x95df('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x95df('0x3')](0x0);var events={'afterCreate':_0x95df('0x4'),'afterUpdate':_0x95df('0x5'),'afterDestroy':'remove'};function emitEvent(_0x29fee2){return function(_0x2f78f3,_0x3ad484,_0x225888){SmsAccountEvents[_0x95df('0x6')](_0x29fee2+':'+_0x2f78f3['id'],_0x2f78f3);SmsAccountEvents[_0x95df('0x6')](_0x29fee2,_0x2f78f3);_0x225888(null);};}for(var e in events){if(events[_0x95df('0x7')](e)){var event=events[e];SmsAccount[_0x95df('0x8')](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 016ea04..cc9208d 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 _0xfa54=['./smsAccount.attributes','exports','define','SmsAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0xfa54,0xd4));var _0x4fa5=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xfa54[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x4fa5('0x0'));var logger=require(_0x4fa5('0x1'))(_0x4fa5('0x2'));var moment=require(_0x4fa5('0x3'));var BPromise=require(_0x4fa5('0x4'));var rp=require(_0x4fa5('0x5'));var fs=require('fs');var path=require(_0x4fa5('0x6'));var rimraf=require(_0x4fa5('0x7'));var config=require(_0x4fa5('0x8'));var attributes=require(_0x4fa5('0x9'));module[_0x4fa5('0xa')]=function(_0x3d30b8,_0x1aa158){return _0x3d30b8[_0x4fa5('0xb')](_0x4fa5('0xc'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd017=['path','rimraf','define','SmsAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0xd017,0x1e8));var _0x7d01=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xd017[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x7d01('0x0'));var util=require(_0x7d01('0x1'));var logger=require(_0x7d01('0x2'))(_0x7d01('0x3'));var moment=require(_0x7d01('0x4'));var BPromise=require(_0x7d01('0x5'));var rp=require(_0x7d01('0x6'));var fs=require('fs');var path=require(_0x7d01('0x7'));var rimraf=require(_0x7d01('0x8'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x400b15,_0xfe74b4){return _0x400b15[_0x7d01('0x9')](_0x7d01('0xa'),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 335b189..2801cb5 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 _0xe7df=['http','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include','model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x404223,_0x2d0a27){var _0x2a20f4=function(_0x45dd7e){while(--_0x45dd7e){_0x404223['push'](_0x404223['shift']());}};_0x2a20f4(++_0x2d0a27);}(_0xe7df,0xce));var _0xfe7d=function(_0x1883a2,_0x44ade5){_0x1883a2=_0x1883a2-0x0;var _0x803d90=_0xe7df[_0x1883a2];return _0x803d90;};'use strict';var _=require(_0xfe7d('0x0'));var util=require('util');var moment=require(_0xfe7d('0x1'));var BPromise=require(_0xfe7d('0x2'));var rs=require(_0xfe7d('0x3'));var fs=require('fs');var Redis=require(_0xfe7d('0x4'));var db=require(_0xfe7d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe7d('0x6'))(_0xfe7d('0x7'));var config=require(_0xfe7d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe7d('0x9')][_0xfe7d('0xa')]({'port':0x232a});config['redis']=_[_0xfe7d('0xb')](config['redis'],{'host':_0xfe7d('0xc'),'port':0x18eb});var socket=require(_0xfe7d('0xd'))(new Redis(config['redis']));require(_0xfe7d('0xe'))['register'](socket);function respondWithRpcPromise(_0x55fe36,_0x45b630,_0x16a265){return new BPromise(function(_0xa2ace5,_0x578e34){return client[_0xfe7d('0xf')](_0x55fe36,_0x16a265)['then'](function(_0xb54f14){logger[_0xfe7d('0x10')](_0xfe7d('0x11'),_0x45b630,_0xfe7d('0x12'));logger[_0xfe7d('0x13')](_0xfe7d('0x14'),_0x45b630,'request\x20sent',JSON[_0xfe7d('0x15')](_0xb54f14));if(_0xb54f14[_0xfe7d('0x16')]){if(_0xb54f14[_0xfe7d('0x16')][_0xfe7d('0x17')]===0x1f4){logger[_0xfe7d('0x16')]('SmsAccount,\x20%s,\x20%s',_0x45b630,_0xb54f14[_0xfe7d('0x16')][_0xfe7d('0x18')]);return _0x578e34(_0xb54f14[_0xfe7d('0x16')]['message']);}logger[_0xfe7d('0x16')](_0xfe7d('0x11'),_0x45b630,_0xb54f14['error'][_0xfe7d('0x18')]);return _0xa2ace5(_0xb54f14['error'][_0xfe7d('0x18')]);}else{logger[_0xfe7d('0x10')](_0xfe7d('0x11'),_0x45b630,_0xfe7d('0x12'));_0xa2ace5(_0xb54f14[_0xfe7d('0x19')][_0xfe7d('0x18')]);}})['catch'](function(_0x537b9b){logger['error']('SmsAccount,\x20%s,\x20%s',_0x45b630,_0x537b9b);_0x578e34(_0x537b9b);});});}exports[_0xfe7d('0x1a')]=function(_0x2c5247){var _0x462723=this;return new Promise(function(_0x2926b,_0x21732d){return db[_0xfe7d('0x1b')]['find']({'raw':_0x2c5247['options']?_0x2c5247[_0xfe7d('0x1c')][_0xfe7d('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c5247[_0xfe7d('0x1c')]?_0x2c5247[_0xfe7d('0x1c')][_0xfe7d('0x1e')]||null:null,'attributes':_0x2c5247[_0xfe7d('0x1c')]?_0x2c5247['options'][_0xfe7d('0x1f')]||null:null,'include':_0x2c5247[_0xfe7d('0x1c')]?_0x2c5247[_0xfe7d('0x1c')]['include']?_[_0xfe7d('0x20')](_0x2c5247[_0xfe7d('0x1c')][_0xfe7d('0x21')],function(_0x3c0c15){return{'model':db[_0x3c0c15[_0xfe7d('0x22')]],'as':_0x3c0c15['as'],'attributes':_0x3c0c15['attributes'],'include':_0x3c0c15[_0xfe7d('0x21')]?_['map'](_0x3c0c15[_0xfe7d('0x21')],function(_0x520387){return{'model':db[_0x520387[_0xfe7d('0x22')]],'as':_0x520387['as'],'attributes':_0x520387[_0xfe7d('0x1f')],'include':_0x520387[_0xfe7d('0x21')]?_[_0xfe7d('0x20')](_0x520387[_0xfe7d('0x21')],function(_0x142809){return{'model':db[_0x142809[_0xfe7d('0x22')]],'as':_0x142809['as'],'attributes':_0x142809['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe7d('0x23')](function(_0x662d84){logger[_0xfe7d('0x10')](_0xfe7d('0x1a'),_0x2c5247);logger[_0xfe7d('0x13')]('ShowSmsAccount',_0x2c5247,JSON[_0xfe7d('0x15')](_0x662d84));_0x2926b(_0x662d84);})['catch'](function(_0x4dd45d){logger[_0xfe7d('0x16')](_0xfe7d('0x1a'),_0x4dd45d[_0xfe7d('0x18')],_0x2c5247);_0x21732d(_0x462723[_0xfe7d('0x16')](0x1f4,_0x4dd45d[_0xfe7d('0x18')]));});});}; \ No newline at end of file +var _0x669b=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','then','stringify','util','moment','bluebird'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x669b,0xbb));var _0xb669=function(_0x1d335f,_0x81680b){_0x1d335f=_0x1d335f-0x0;var _0x338c02=_0x669b[_0x1d335f];return _0x338c02;};'use strict';var _=require('lodash');var util=require(_0xb669('0x0'));var moment=require(_0xb669('0x1'));var BPromise=require(_0xb669('0x2'));var rs=require(_0xb669('0x3'));var fs=require('fs');var Redis=require(_0xb669('0x4'));var db=require(_0xb669('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb669('0x6'));var config=require(_0xb669('0x7'));var jayson=require(_0xb669('0x8'));var client=jayson['client'][_0xb669('0x9')]({'port':0x232a});config[_0xb669('0xa')]=_[_0xb669('0xb')](config['redis'],{'host':_0xb669('0xc'),'port':0x18eb});var socket=require(_0xb669('0xd'))(new Redis(config[_0xb669('0xa')]));require(_0xb669('0xe'))[_0xb669('0xf')](socket);function respondWithRpcPromise(_0x55fb5b,_0x1c2676,_0xe34eee){return new BPromise(function(_0x530148,_0x146749){return client[_0xb669('0x10')](_0x55fb5b,_0xe34eee)['then'](function(_0x37153f){logger['info'](_0xb669('0x11'),_0x1c2676,_0xb669('0x12'));logger[_0xb669('0x13')](_0xb669('0x14'),_0x1c2676,_0xb669('0x12'),JSON['stringify'](_0x37153f));if(_0x37153f['error']){if(_0x37153f[_0xb669('0x15')][_0xb669('0x16')]===0x1f4){logger[_0xb669('0x15')](_0xb669('0x11'),_0x1c2676,_0x37153f['error'][_0xb669('0x17')]);return _0x146749(_0x37153f[_0xb669('0x15')][_0xb669('0x17')]);}logger['error'](_0xb669('0x11'),_0x1c2676,_0x37153f[_0xb669('0x15')][_0xb669('0x17')]);return _0x530148(_0x37153f['error'][_0xb669('0x17')]);}else{logger[_0xb669('0x18')](_0xb669('0x11'),_0x1c2676,_0xb669('0x12'));_0x530148(_0x37153f[_0xb669('0x19')][_0xb669('0x17')]);}})['catch'](function(_0x2c4086){logger[_0xb669('0x15')]('SmsAccount,\x20%s,\x20%s',_0x1c2676,_0x2c4086);_0x146749(_0x2c4086);});});}exports[_0xb669('0x1a')]=function(_0x437cb2){var _0x4fe540=this;return new Promise(function(_0x1daf44,_0x10e332){return db[_0xb669('0x1b')][_0xb669('0x1c')]({'raw':_0x437cb2[_0xb669('0x1d')]?_0x437cb2['options'][_0xb669('0x1e')]===undefined?!![]:![]:!![],'where':_0x437cb2[_0xb669('0x1d')]?_0x437cb2['options'][_0xb669('0x1f')]||null:null,'attributes':_0x437cb2['options']?_0x437cb2['options'][_0xb669('0x20')]||null:null,'include':_0x437cb2[_0xb669('0x1d')]?_0x437cb2[_0xb669('0x1d')][_0xb669('0x21')]?_['map'](_0x437cb2[_0xb669('0x1d')][_0xb669('0x21')],function(_0x1ce791){return{'model':db[_0x1ce791[_0xb669('0x22')]],'as':_0x1ce791['as'],'attributes':_0x1ce791[_0xb669('0x20')],'include':_0x1ce791[_0xb669('0x21')]?_[_0xb669('0x23')](_0x1ce791['include'],function(_0x410ac1){return{'model':db[_0x410ac1[_0xb669('0x22')]],'as':_0x410ac1['as'],'attributes':_0x410ac1[_0xb669('0x20')],'include':_0x410ac1[_0xb669('0x21')]?_['map'](_0x410ac1[_0xb669('0x21')],function(_0x5a4ab3){return{'model':db[_0x5a4ab3[_0xb669('0x22')]],'as':_0x5a4ab3['as'],'attributes':_0x5a4ab3[_0xb669('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb669('0x24')](function(_0x1e37c5){logger[_0xb669('0x18')]('ShowSmsAccount',_0x437cb2);logger[_0xb669('0x13')](_0xb669('0x1a'),_0x437cb2,JSON[_0xb669('0x25')](_0x1e37c5));_0x1daf44(_0x1e37c5);})['catch'](function(_0x51fcac){logger['error'](_0xb669('0x1a'),_0x51fcac[_0xb669('0x17')],_0x437cb2);_0x10e332(_0x4fe540[_0xb669('0x15')](0x1f4,_0x51fcac[_0xb669('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a2016a7..066ea7b 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 _0x038f=['remove','emit','removeListener','register','./smsAccount.events','save'];(function(_0x30a4d0,_0x42190f){var _0x24e6f3=function(_0x71d633){while(--_0x71d633){_0x30a4d0['push'](_0x30a4d0['shift']());}};_0x24e6f3(++_0x42190f);}(_0x038f,0x106));var _0xf038=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0x038f[_0x22bee0];return _0x2d295b;};'use strict';var SmsAccountEvents=require(_0xf038('0x0'));var events=[_0xf038('0x1'),_0xf038('0x2'),'update'];function createListener(_0x2a8f2c,_0x1765a1){return function(_0x2b5044){_0x1765a1[_0xf038('0x3')](_0x2a8f2c,_0x2b5044);};}function removeListener(_0x5758b0,_0x5ba6d9){return function(){SmsAccountEvents[_0xf038('0x4')](_0x5758b0,_0x5ba6d9);};}exports[_0xf038('0x5')]=function(_0x15077c){for(var _0x2b84c5=0x0,_0x139ac5=events['length'];_0x2b84c5<_0x139ac5;_0x2b84c5++){var _0x1b4f6c=events[_0x2b84c5];var _0x3c58d0=createListener('smsAccount:'+_0x1b4f6c,_0x15077c);SmsAccountEvents['on'](_0x1b4f6c,_0x3c58d0);}}; \ No newline at end of file +var _0x6f24=['save','update','emit','removeListener','register','length','./smsAccount.events'];(function(_0x484fc9,_0x4598aa){var _0x89aa01=function(_0x5256e1){while(--_0x5256e1){_0x484fc9['push'](_0x484fc9['shift']());}};_0x89aa01(++_0x4598aa);}(_0x6f24,0x76));var _0x46f2=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x6f24[_0x46a3ff];return _0x404bc2;};'use strict';var SmsAccountEvents=require(_0x46f2('0x0'));var events=[_0x46f2('0x1'),'remove',_0x46f2('0x2')];function createListener(_0x3c7dae,_0x37fd34){return function(_0x58afac){_0x37fd34[_0x46f2('0x3')](_0x3c7dae,_0x58afac);};}function removeListener(_0x5d4655,_0x5da2a8){return function(){SmsAccountEvents[_0x46f2('0x4')](_0x5d4655,_0x5da2a8);};}exports[_0x46f2('0x5')]=function(_0x47211e){for(var _0x20be4a=0x0,_0x51d8b6=events[_0x46f2('0x6')];_0x20be4a<_0x51d8b6;_0x20be4a++){var _0xd8ec3d=events[_0x20be4a];var _0x246924=createListener('smsAccount:'+_0xd8ec3d,_0x47211e);SmsAccountEvents['on'](_0xd8ec3d,_0x246924);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 9316366..ad34f61 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 _0x20a7=['../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x27a70d,_0x4ddcef){var _0x2ee25e=function(_0x19628d){while(--_0x19628d){_0x27a70d['push'](_0x27a70d['shift']());}};_0x2ee25e(++_0x4ddcef);}(_0x20a7,0x17a));var _0x720a=function(_0x278ef5,_0x18e3c6){_0x278ef5=_0x278ef5-0x0;var _0x47cb6f=_0x20a7[_0x278ef5];return _0x47cb6f;};'use strict';var multer=require(_0x720a('0x0'));var util=require(_0x720a('0x1'));var path=require(_0x720a('0x2'));var timeout=require('connect-timeout');var express=require(_0x720a('0x3'));var router=express[_0x720a('0x4')]();var auth=require(_0x720a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x720a('0x6'));var controller=require(_0x720a('0x7'));router[_0x720a('0x8')]('/',auth[_0x720a('0x9')](),controller[_0x720a('0xa')]);router[_0x720a('0x8')](_0x720a('0xb'),auth[_0x720a('0x9')](),controller['show']);router['post']('/',auth[_0x720a('0x9')](),controller['create']);router['put'](_0x720a('0xb'),auth['isAuthenticated'](),controller[_0x720a('0xc')]);router[_0x720a('0xd')](_0x720a('0xb'),auth['isAuthenticated'](),controller[_0x720a('0xe')]);module[_0x720a('0xf')]=router; \ No newline at end of file +var _0x2e4e=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./smsApplication.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e4e,0x66));var _0xe2e4=function(_0x57b904,_0x2ced2a){_0x57b904=_0x57b904-0x0;var _0x1103f5=_0x2e4e[_0x57b904];return _0x1103f5;};'use strict';var multer=require(_0xe2e4('0x0'));var util=require('util');var path=require(_0xe2e4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe2e4('0x2')]();var auth=require(_0xe2e4('0x3'));var interaction=require(_0xe2e4('0x4'));var config=require('../../config/environment');var controller=require(_0xe2e4('0x5'));router[_0xe2e4('0x6')]('/',auth[_0xe2e4('0x7')](),controller[_0xe2e4('0x8')]);router[_0xe2e4('0x6')]('/:id',auth[_0xe2e4('0x7')](),controller[_0xe2e4('0x9')]);router[_0xe2e4('0xa')]('/',auth[_0xe2e4('0x7')](),controller[_0xe2e4('0xb')]);router[_0xe2e4('0xc')](_0xe2e4('0xd'),auth[_0xe2e4('0x7')](),controller[_0xe2e4('0xe')]);router[_0xe2e4('0xf')]('/:id',auth[_0xe2e4('0x7')](),controller[_0xe2e4('0x10')]);module[_0xe2e4('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ecc0122..6d38337 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 _0xc34b=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x5ec6f6,_0x498db1){var _0x3beab7=function(_0xc842bb){while(--_0xc842bb){_0x5ec6f6['push'](_0x5ec6f6['shift']());}};_0x3beab7(++_0x498db1);}(_0xc34b,0xce));var _0xbc34=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xc34b[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require(_0xbc34('0x0'));module[_0xbc34('0x1')]={'priority':{'type':Sequelize[_0xbc34('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbc34('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbc34('0x4')]()},'description':{'type':Sequelize[_0xbc34('0x3')]},'interval':{'type':Sequelize[_0xbc34('0x3')],'defaultValue':_0xbc34('0x5')}}; \ No newline at end of file +var _0x27fb=['TEXT','sequelize','exports','STRING','noop'];(function(_0xc28c76,_0x1d2e26){var _0x2f0b2a=function(_0x2f2267){while(--_0x2f2267){_0xc28c76['push'](_0xc28c76['shift']());}};_0x2f0b2a(++_0x1d2e26);}(_0x27fb,0xec));var _0xb27f=function(_0x3f8e20,_0x1daf92){_0x3f8e20=_0x3f8e20-0x0;var _0x54b65e=_0x27fb[_0x3f8e20];return _0x54b65e;};'use strict';var Sequelize=require(_0xb27f('0x0'));module[_0xb27f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb27f('0x2')],'allowNull':![],'defaultValue':_0xb27f('0x3')},'appdata':{'type':Sequelize[_0xb27f('0x4')]()},'description':{'type':Sequelize[_0xb27f('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6b0bdc3..244a3a1 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 _0xfcbb=['../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','then','end','sendStatus','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x140479,_0x2bb4b4){_0x140479=_0x140479-0x0;var _0x1def3c=_0xfcbb[_0x140479];return _0x1def3c;};'use strict';var pdf=require(_0xbfcb('0x0'));var emlformat=require(_0xbfcb('0x1'));var rimraf=require(_0xbfcb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbfcb('0x3'));var moment=require(_0xbfcb('0x4'));var BPromise=require(_0xbfcb('0x5'));var Mustache=require(_0xbfcb('0x6'));var util=require(_0xbfcb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbfcb('0x8'));var ejs=require(_0xbfcb('0x9'));var fs=require('fs');var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var db=require(_0xbfcb('0x18'))['db'];function respondWithStatusCode(_0x583513,_0xb2f601){_0xb2f601=_0xb2f601||0xcc;return function(_0x2268da){if(_0x2268da){return _0x583513['sendStatus'](_0xb2f601);}return _0x583513[_0xbfcb('0x19')](_0xb2f601)['end']();};}function respondWithResult(_0x211a30,_0x1c52df){_0x1c52df=_0x1c52df||0xc8;return function(_0x44ad6c){if(_0x44ad6c){return _0x211a30[_0xbfcb('0x19')](_0x1c52df)[_0xbfcb('0x1a')](_0x44ad6c);}};}function respondWithFilteredResult(_0xe47707,_0x71304e){return function(_0x2d314a){if(_0x2d314a){var _0x90ed8c=_0x2d314a[_0xbfcb('0x1b')],_0x339347=_0x71304e[_0xbfcb('0x1c')],_0x2c4a85=_0x71304e[_0xbfcb('0x1c')]+_0x71304e[_0xbfcb('0x1d')],_0x3f847f;if(_0x2c4a85>=_0x90ed8c){_0x2c4a85=_0x90ed8c;_0x3f847f=0xc8;}else{_0x3f847f=0xce;}_0xe47707[_0xbfcb('0x19')](_0x3f847f);return _0xe47707[_0xbfcb('0x1e')](_0xbfcb('0x1f'),_0x339347+'-'+_0x2c4a85+'/'+_0x90ed8c)[_0xbfcb('0x1a')](_0x2d314a);}return null;};}function patchUpdates(_0xccd6ff){return function(_0x25afa3){try{jsonpatch['apply'](_0x25afa3,_0xccd6ff,!![]);}catch(_0x26451d){return BPromise[_0xbfcb('0x20')](_0x26451d);}return _0x25afa3['save']();};}function saveUpdates(_0xa3c089,_0x1a7225){return function(_0x48c3c8){if(_0x48c3c8){return _0x48c3c8['update'](_0xa3c089)[_0xbfcb('0x21')](function(_0x45f0a0){return _0x45f0a0;});}return null;};}function removeEntity(_0x2bd235,_0x45661a){return function(_0x1c5924){if(_0x1c5924){return _0x1c5924['destroy']()[_0xbfcb('0x21')](function(){_0x2bd235[_0xbfcb('0x19')](0xcc)[_0xbfcb('0x22')]();});}};}function handleEntityNotFound(_0xd4d29,_0x1651e5){return function(_0x19616c){if(!_0x19616c){_0xd4d29[_0xbfcb('0x23')](0x194);}return _0x19616c;};}function handleError(_0x14e43c,_0x11f6f7){_0x11f6f7=_0x11f6f7||0x1f4;return function(_0x13e101){logger[_0xbfcb('0x24')](_0x13e101[_0xbfcb('0x25')]);if(_0x13e101[_0xbfcb('0x26')]){delete _0x13e101[_0xbfcb('0x26')];}_0x14e43c[_0xbfcb('0x19')](_0x11f6f7)[_0xbfcb('0x27')](_0x13e101);};}exports['index']=function(_0x3465f5,_0x2881f8){var _0x4cf7ca={},_0x64a69={},_0x15197b={'count':0x0,'rows':[]};var _0x781773=_[_0xbfcb('0x28')](db[_0xbfcb('0x29')][_0xbfcb('0x2a')],function(_0x4069a7){return{'name':_0x4069a7[_0xbfcb('0x2b')],'type':_0x4069a7[_0xbfcb('0x2c')][_0xbfcb('0x2d')]};});_0x64a69['model']=_[_0xbfcb('0x28')](_0x781773,_0xbfcb('0x26'));_0x64a69[_0xbfcb('0x2e')]=_[_0xbfcb('0x2f')](_0x3465f5[_0xbfcb('0x2e')]);_0x64a69[_0xbfcb('0x30')]=_[_0xbfcb('0x31')](_0x64a69[_0xbfcb('0x32')],_0x64a69[_0xbfcb('0x2e')]);_0x4cf7ca['attributes']=_[_0xbfcb('0x31')](_0x64a69[_0xbfcb('0x32')],qs[_0xbfcb('0x33')](_0x3465f5[_0xbfcb('0x2e')]['fields']));_0x4cf7ca['attributes']=_0x4cf7ca[_0xbfcb('0x34')][_0xbfcb('0x35')]?_0x4cf7ca[_0xbfcb('0x34')]:_0x64a69[_0xbfcb('0x32')];if(!_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x36')](_0xbfcb('0x37'))){_0x4cf7ca['limit']=qs['limit'](_0x3465f5['query'][_0xbfcb('0x1d')]);_0x4cf7ca['offset']=qs[_0xbfcb('0x1c')](_0x3465f5[_0xbfcb('0x2e')]['offset']);}_0x4cf7ca['order']=qs[_0xbfcb('0x38')](_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x38')]);_0x4cf7ca[_0xbfcb('0x39')]=qs['filters'](_[_0xbfcb('0x3a')](_0x3465f5[_0xbfcb('0x2e')],_0x64a69['filters']),_0x781773);if(_0x3465f5['query'][_0xbfcb('0x3b')]){_0x4cf7ca['where']=_['merge'](_0x4cf7ca[_0xbfcb('0x39')],{'$or':_[_0xbfcb('0x28')](_0x781773,function(_0x43ec1b){if(_0x43ec1b[_0xbfcb('0x2c')]!=='VIRTUAL'){var _0x3b0a7a={};_0x3b0a7a[_0x43ec1b[_0xbfcb('0x26')]]={'$like':'%'+_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x3b')]+'%'};return _0x3b0a7a;}})});}_0x4cf7ca=_[_0xbfcb('0x3c')]({},_0x4cf7ca,_0x3465f5[_0xbfcb('0x3d')]);var _0x53111c={'where':_0x4cf7ca[_0xbfcb('0x39')]};return db['SmsApplication'][_0xbfcb('0x1b')](_0x53111c)['then'](function(_0x809fde){_0x15197b[_0xbfcb('0x1b')]=_0x809fde;if(_0x3465f5[_0xbfcb('0x2e')][_0xbfcb('0x3e')]){_0x4cf7ca[_0xbfcb('0x3f')]=[{'all':!![]}];}return db[_0xbfcb('0x29')][_0xbfcb('0x40')](_0x4cf7ca);})[_0xbfcb('0x21')](function(_0x3a98e0){_0x15197b[_0xbfcb('0x41')]=_0x3a98e0;return _0x15197b;})['then'](respondWithFilteredResult(_0x2881f8,_0x4cf7ca))[_0xbfcb('0x42')](handleError(_0x2881f8,null));};exports[_0xbfcb('0x43')]=function(_0x49685f,_0x2f6f54){var _0x306ea4={'raw':!![],'where':{'id':_0x49685f[_0xbfcb('0x44')]['id']}},_0x269102={};_0x269102[_0xbfcb('0x32')]=_[_0xbfcb('0x2f')](db['SmsApplication'][_0xbfcb('0x2a')]);_0x269102[_0xbfcb('0x2e')]=_[_0xbfcb('0x2f')](_0x49685f['query']);_0x269102[_0xbfcb('0x30')]=_[_0xbfcb('0x31')](_0x269102[_0xbfcb('0x32')],_0x269102['query']);_0x306ea4[_0xbfcb('0x34')]=_[_0xbfcb('0x31')](_0x269102['model'],qs['fields'](_0x49685f[_0xbfcb('0x2e')][_0xbfcb('0x33')]));_0x306ea4['attributes']=_0x306ea4[_0xbfcb('0x34')][_0xbfcb('0x35')]?_0x306ea4['attributes']:_0x269102[_0xbfcb('0x32')];if(_0x49685f[_0xbfcb('0x2e')][_0xbfcb('0x3e')]){_0x306ea4[_0xbfcb('0x3f')]=[{'all':!![]}];}_0x306ea4=_[_0xbfcb('0x3c')]({},_0x306ea4,_0x49685f[_0xbfcb('0x3d')]);return db[_0xbfcb('0x29')][_0xbfcb('0x45')](_0x306ea4)[_0xbfcb('0x21')](handleEntityNotFound(_0x2f6f54,null))[_0xbfcb('0x21')](respondWithResult(_0x2f6f54,null))[_0xbfcb('0x42')](handleError(_0x2f6f54,null));};exports[_0xbfcb('0x46')]=function(_0x5f307b,_0x12889b){return db[_0xbfcb('0x29')][_0xbfcb('0x46')](_0x5f307b['body'],{})[_0xbfcb('0x21')](respondWithResult(_0x12889b,0xc9))['catch'](handleError(_0x12889b,null));};exports['update']=function(_0x2dcfb3,_0x20918c){if(_0x2dcfb3[_0xbfcb('0x47')]['id']){delete _0x2dcfb3['body']['id'];}return db[_0xbfcb('0x29')]['find']({'where':{'id':_0x2dcfb3['params']['id']}})[_0xbfcb('0x21')](handleEntityNotFound(_0x20918c,null))['then'](saveUpdates(_0x2dcfb3[_0xbfcb('0x47')],null))[_0xbfcb('0x21')](respondWithResult(_0x20918c,null))['catch'](handleError(_0x20918c,null));};exports[_0xbfcb('0x48')]=function(_0x5d942f,_0x8347be){return db['SmsApplication'][_0xbfcb('0x45')]({'where':{'id':_0x5d942f['params']['id']}})[_0xbfcb('0x21')](handleEntityNotFound(_0x8347be,null))[_0xbfcb('0x21')](removeEntity(_0x8347be,null))['catch'](handleError(_0x8347be,null));}; \ No newline at end of file +var _0x69d3=['show','params','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x69d3,0xda));var _0x369d=function(_0x5ebb70,_0x1e366d){_0x5ebb70=_0x5ebb70-0x0;var _0xae2104=_0x69d3[_0x5ebb70];return _0xae2104;};'use strict';var pdf=require(_0x369d('0x0'));var emlformat=require(_0x369d('0x1'));var rimraf=require(_0x369d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x369d('0x3'));var rp=require(_0x369d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x369d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x369d('0x6'));var csv=require(_0x369d('0x7'));var ejs=require(_0x369d('0x8'));var fs=require('fs');var _=require(_0x369d('0x9'));var squel=require(_0x369d('0xa'));var crypto=require(_0x369d('0xb'));var jsforce=require(_0x369d('0xc'));var deskjs=require(_0x369d('0xd'));var toCsv=require(_0x369d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require(_0x369d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x369d('0x12'));var utils=require(_0x369d('0x13'));var config=require(_0x369d('0x14'));var db=require(_0x369d('0x15'))['db'];function respondWithStatusCode(_0x21ed6b,_0xee549e){_0xee549e=_0xee549e||0xcc;return function(_0x52c126){if(_0x52c126){return _0x21ed6b[_0x369d('0x16')](_0xee549e);}return _0x21ed6b[_0x369d('0x17')](_0xee549e)[_0x369d('0x18')]();};}function respondWithResult(_0x10d7a5,_0x121307){_0x121307=_0x121307||0xc8;return function(_0x539536){if(_0x539536){return _0x10d7a5['status'](_0x121307)['json'](_0x539536);}};}function respondWithFilteredResult(_0x2dcc39,_0xa126c1){return function(_0x389c43){if(_0x389c43){var _0x5b4f55=_0x389c43['count'],_0x2c1a4a=_0xa126c1[_0x369d('0x19')],_0x29c1fe=_0xa126c1[_0x369d('0x19')]+_0xa126c1['limit'],_0x435c2f;if(_0x29c1fe>=_0x5b4f55){_0x29c1fe=_0x5b4f55;_0x435c2f=0xc8;}else{_0x435c2f=0xce;}_0x2dcc39['status'](_0x435c2f);return _0x2dcc39['set'](_0x369d('0x1a'),_0x2c1a4a+'-'+_0x29c1fe+'/'+_0x5b4f55)[_0x369d('0x1b')](_0x389c43);}return null;};}function patchUpdates(_0x247a3b){return function(_0x4ddcb2){try{jsonpatch[_0x369d('0x1c')](_0x4ddcb2,_0x247a3b,!![]);}catch(_0x24dfff){return BPromise[_0x369d('0x1d')](_0x24dfff);}return _0x4ddcb2[_0x369d('0x1e')]();};}function saveUpdates(_0x2eb5d7,_0x538ca4){return function(_0x5c9fdd){if(_0x5c9fdd){return _0x5c9fdd[_0x369d('0x1f')](_0x2eb5d7)[_0x369d('0x20')](function(_0x11ac1d){return _0x11ac1d;});}return null;};}function removeEntity(_0x1ea66a,_0x84cc0f){return function(_0x15fbef){if(_0x15fbef){return _0x15fbef[_0x369d('0x21')]()['then'](function(){_0x1ea66a['status'](0xcc)[_0x369d('0x18')]();});}};}function handleEntityNotFound(_0xed16e,_0xf7bc3a){return function(_0xcae58){if(!_0xcae58){_0xed16e[_0x369d('0x16')](0x194);}return _0xcae58;};}function handleError(_0x38f0b8,_0x36cf04){_0x36cf04=_0x36cf04||0x1f4;return function(_0x566c96){logger['error'](_0x566c96[_0x369d('0x22')]);if(_0x566c96[_0x369d('0x23')]){delete _0x566c96[_0x369d('0x23')];}_0x38f0b8[_0x369d('0x17')](_0x36cf04)[_0x369d('0x24')](_0x566c96);};}exports[_0x369d('0x25')]=function(_0x8090b0,_0x570db4){var _0x23656b={},_0xe95742={},_0x357e94={'count':0x0,'rows':[]};var _0xf952a3=_[_0x369d('0x26')](db[_0x369d('0x27')][_0x369d('0x28')],function(_0x4d42ea){return{'name':_0x4d42ea[_0x369d('0x29')],'type':_0x4d42ea['type']['key']};});_0xe95742[_0x369d('0x2a')]=_[_0x369d('0x26')](_0xf952a3,'name');_0xe95742[_0x369d('0x2b')]=_['keys'](_0x8090b0[_0x369d('0x2b')]);_0xe95742[_0x369d('0x2c')]=_[_0x369d('0x2d')](_0xe95742[_0x369d('0x2a')],_0xe95742[_0x369d('0x2b')]);_0x23656b[_0x369d('0x2e')]=_[_0x369d('0x2d')](_0xe95742['model'],qs[_0x369d('0x2f')](_0x8090b0[_0x369d('0x2b')][_0x369d('0x2f')]));_0x23656b[_0x369d('0x2e')]=_0x23656b[_0x369d('0x2e')][_0x369d('0x30')]?_0x23656b[_0x369d('0x2e')]:_0xe95742[_0x369d('0x2a')];if(!_0x8090b0['query'][_0x369d('0x31')](_0x369d('0x32'))){_0x23656b[_0x369d('0x33')]=qs[_0x369d('0x33')](_0x8090b0[_0x369d('0x2b')]['limit']);_0x23656b[_0x369d('0x19')]=qs[_0x369d('0x19')](_0x8090b0[_0x369d('0x2b')][_0x369d('0x19')]);}_0x23656b[_0x369d('0x34')]=qs[_0x369d('0x35')](_0x8090b0['query'][_0x369d('0x35')]);_0x23656b[_0x369d('0x36')]=qs[_0x369d('0x2c')](_[_0x369d('0x37')](_0x8090b0[_0x369d('0x2b')],_0xe95742[_0x369d('0x2c')]),_0xf952a3);if(_0x8090b0[_0x369d('0x2b')][_0x369d('0x38')]){_0x23656b[_0x369d('0x36')]=_[_0x369d('0x39')](_0x23656b[_0x369d('0x36')],{'$or':_[_0x369d('0x26')](_0xf952a3,function(_0x2374b5){if(_0x2374b5[_0x369d('0x3a')]!==_0x369d('0x3b')){var _0x166944={};_0x166944[_0x2374b5[_0x369d('0x23')]]={'$like':'%'+_0x8090b0[_0x369d('0x2b')][_0x369d('0x38')]+'%'};return _0x166944;}})});}_0x23656b=_[_0x369d('0x39')]({},_0x23656b,_0x8090b0[_0x369d('0x3c')]);var _0x305dea={'where':_0x23656b[_0x369d('0x36')]};return db[_0x369d('0x27')]['count'](_0x305dea)['then'](function(_0x832a0d){_0x357e94[_0x369d('0x3d')]=_0x832a0d;if(_0x8090b0[_0x369d('0x2b')][_0x369d('0x3e')]){_0x23656b[_0x369d('0x3f')]=[{'all':!![]}];}return db[_0x369d('0x27')][_0x369d('0x40')](_0x23656b);})[_0x369d('0x20')](function(_0x46c940){_0x357e94['rows']=_0x46c940;return _0x357e94;})[_0x369d('0x20')](respondWithFilteredResult(_0x570db4,_0x23656b))[_0x369d('0x41')](handleError(_0x570db4,null));};exports[_0x369d('0x42')]=function(_0x10f5a0,_0xd88839){var _0x25cf4e={'raw':!![],'where':{'id':_0x10f5a0[_0x369d('0x43')]['id']}},_0x28803c={};_0x28803c['model']=_['keys'](db[_0x369d('0x27')][_0x369d('0x28')]);_0x28803c[_0x369d('0x2b')]=_['keys'](_0x10f5a0['query']);_0x28803c['filters']=_[_0x369d('0x2d')](_0x28803c[_0x369d('0x2a')],_0x28803c['query']);_0x25cf4e[_0x369d('0x2e')]=_[_0x369d('0x2d')](_0x28803c[_0x369d('0x2a')],qs[_0x369d('0x2f')](_0x10f5a0['query'][_0x369d('0x2f')]));_0x25cf4e['attributes']=_0x25cf4e[_0x369d('0x2e')]['length']?_0x25cf4e[_0x369d('0x2e')]:_0x28803c[_0x369d('0x2a')];if(_0x10f5a0[_0x369d('0x2b')]['includeAll']){_0x25cf4e['include']=[{'all':!![]}];}_0x25cf4e=_[_0x369d('0x39')]({},_0x25cf4e,_0x10f5a0[_0x369d('0x3c')]);return db[_0x369d('0x27')]['find'](_0x25cf4e)[_0x369d('0x20')](handleEntityNotFound(_0xd88839,null))[_0x369d('0x20')](respondWithResult(_0xd88839,null))[_0x369d('0x41')](handleError(_0xd88839,null));};exports[_0x369d('0x44')]=function(_0x34e2e4,_0x2d9b1c){return db[_0x369d('0x27')][_0x369d('0x44')](_0x34e2e4[_0x369d('0x45')],{})['then'](respondWithResult(_0x2d9b1c,0xc9))[_0x369d('0x41')](handleError(_0x2d9b1c,null));};exports[_0x369d('0x1f')]=function(_0xcc1465,_0x257c3d){if(_0xcc1465[_0x369d('0x45')]['id']){delete _0xcc1465[_0x369d('0x45')]['id'];}return db['SmsApplication'][_0x369d('0x46')]({'where':{'id':_0xcc1465[_0x369d('0x43')]['id']}})[_0x369d('0x20')](handleEntityNotFound(_0x257c3d,null))[_0x369d('0x20')](saveUpdates(_0xcc1465[_0x369d('0x45')],null))[_0x369d('0x20')](respondWithResult(_0x257c3d,null))[_0x369d('0x41')](handleError(_0x257c3d,null));};exports[_0x369d('0x21')]=function(_0x3f8a54,_0x3c15cb){return db[_0x369d('0x27')][_0x369d('0x46')]({'where':{'id':_0x3f8a54['params']['id']}})[_0x369d('0x20')](handleEntityNotFound(_0x3c15cb,null))[_0x369d('0x20')](removeEntity(_0x3c15cb,null))[_0x369d('0x41')](handleError(_0x3c15cb,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ee795bb..b3ec64c 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 _0x9ae5=['util','../../config/logger','moment','bluebird','path','rimraf','./smsApplication.attributes','define','SmsApplication','sms_applications','lodash'];(function(_0x1a56bc,_0x57db7c){var _0x520933=function(_0x355fff){while(--_0x355fff){_0x1a56bc['push'](_0x1a56bc['shift']());}};_0x520933(++_0x57db7c);}(_0x9ae5,0x15f));var _0x59ae=function(_0x207f02,_0xec9b84){_0x207f02=_0x207f02-0x0;var _0x3620db=_0x9ae5[_0x207f02];return _0x3620db;};'use strict';var _=require(_0x59ae('0x0'));var util=require(_0x59ae('0x1'));var logger=require(_0x59ae('0x2'))('api');var moment=require(_0x59ae('0x3'));var BPromise=require(_0x59ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59ae('0x5'));var rimraf=require(_0x59ae('0x6'));var config=require('../../config/environment');var attributes=require(_0x59ae('0x7'));module['exports']=function(_0x2e0c73,_0xecfa2d){return _0x2e0c73[_0x59ae('0x8')](_0x59ae('0x9'),attributes,{'tableName':_0x59ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa39c=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_applications','utf8mb4_unicode_ci'];(function(_0x497df4,_0x5d7574){var _0x1287b1=function(_0x150502){while(--_0x150502){_0x497df4['push'](_0x497df4['shift']());}};_0x1287b1(++_0x5d7574);}(_0xa39c,0x138));var _0xca39=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa39c[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xca39('0x0'));var logger=require(_0xca39('0x1'))(_0xca39('0x2'));var moment=require('moment');var BPromise=require(_0xca39('0x3'));var rp=require(_0xca39('0x4'));var fs=require('fs');var path=require(_0xca39('0x5'));var rimraf=require(_0xca39('0x6'));var config=require(_0xca39('0x7'));var attributes=require('./smsApplication.attributes');module[_0xca39('0x8')]=function(_0x596595,_0x222371){return _0x596595[_0xca39('0x9')]('SmsApplication',attributes,{'tableName':_0xca39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xca39('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 1cd2323..8f889ad 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 _0xa2c8=['jayson/promise','client','http','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1b63af,_0x363532){var _0x1c40e0=function(_0x4e44d0){while(--_0x4e44d0){_0x1b63af['push'](_0x1b63af['shift']());}};_0x1c40e0(++_0x363532);}(_0xa2c8,0x99));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var moment=require(_0x8a2c('0x2'));var BPromise=require(_0x8a2c('0x3'));var rs=require(_0x8a2c('0x4'));var fs=require('fs');var Redis=require(_0x8a2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a2c('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a2c('0x7'));var client=jayson[_0x8a2c('0x8')][_0x8a2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1031fb,_0x4e007c,_0xe1e335){return new BPromise(function(_0x1d2885,_0x43745f){return client['request'](_0x1031fb,_0xe1e335)['then'](function(_0x4c237a){logger[_0x8a2c('0xa')](_0x8a2c('0xb'),_0x4e007c,'request\x20sent');logger[_0x8a2c('0xc')](_0x8a2c('0xd'),_0x4e007c,_0x8a2c('0xe'),JSON[_0x8a2c('0xf')](_0x4c237a));if(_0x4c237a[_0x8a2c('0x10')]){if(_0x4c237a[_0x8a2c('0x10')]['code']===0x1f4){logger[_0x8a2c('0x10')](_0x8a2c('0xb'),_0x4e007c,_0x4c237a['error'][_0x8a2c('0x11')]);return _0x43745f(_0x4c237a[_0x8a2c('0x10')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x4e007c,_0x4c237a['error'][_0x8a2c('0x11')]);return _0x1d2885(_0x4c237a[_0x8a2c('0x10')][_0x8a2c('0x11')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x4e007c,_0x8a2c('0xe'));_0x1d2885(_0x4c237a[_0x8a2c('0x12')][_0x8a2c('0x11')]);}})[_0x8a2c('0x13')](function(_0x4388b0){logger[_0x8a2c('0x10')](_0x8a2c('0xb'),_0x4e007c,_0x4388b0);_0x43745f(_0x4388b0);});});} \ No newline at end of file +var _0x647c=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5098d3,_0x245091){var _0x285389=function(_0x2a32c9){while(--_0x2a32c9){_0x5098d3['push'](_0x5098d3['shift']());}};_0x285389(++_0x245091);}(_0x647c,0x1d3));var _0xc647=function(_0x31b88d,_0x32e9ef){_0x31b88d=_0x31b88d-0x0;var _0x1128c9=_0x647c[_0x31b88d];return _0x1128c9;};'use strict';var _=require(_0xc647('0x0'));var util=require('util');var moment=require(_0xc647('0x1'));var BPromise=require(_0xc647('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc647('0x3'));var db=require(_0xc647('0x4'))['db'];var utils=require(_0xc647('0x5'));var logger=require(_0xc647('0x6'))(_0xc647('0x7'));var config=require('../../config/environment');var jayson=require(_0xc647('0x8'));var client=jayson[_0xc647('0x9')][_0xc647('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22bcc1,_0x119c36,_0x2d63e8){return new BPromise(function(_0x59158c,_0x5b91af){return client[_0xc647('0xb')](_0x22bcc1,_0x2d63e8)[_0xc647('0xc')](function(_0x4494d1){logger['info'](_0xc647('0xd'),_0x119c36,_0xc647('0xe'));logger[_0xc647('0xf')](_0xc647('0x10'),_0x119c36,_0xc647('0xe'),JSON[_0xc647('0x11')](_0x4494d1));if(_0x4494d1[_0xc647('0x12')]){if(_0x4494d1['error'][_0xc647('0x13')]===0x1f4){logger[_0xc647('0x12')](_0xc647('0xd'),_0x119c36,_0x4494d1[_0xc647('0x12')][_0xc647('0x14')]);return _0x5b91af(_0x4494d1[_0xc647('0x12')][_0xc647('0x14')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x119c36,_0x4494d1[_0xc647('0x12')]['message']);return _0x59158c(_0x4494d1[_0xc647('0x12')]['message']);}else{logger[_0xc647('0x15')](_0xc647('0xd'),_0x119c36,_0xc647('0xe'));_0x59158c(_0x4494d1['result'][_0xc647('0x14')]);}})[_0xc647('0x16')](function(_0x564f2b){logger[_0xc647('0x12')](_0xc647('0xd'),_0x119c36,_0x564f2b);_0x5b91af(_0x564f2b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7bd6cda..050c956 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 _0xc936=['exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','sms','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x15c43b,_0x2c0fde){var _0x21f296=function(_0x31c34c){while(--_0x31c34c){_0x15c43b['push'](_0x15c43b['shift']());}};_0x21f296(++_0x2c0fde);}(_0xc936,0x153));var _0x6c93=function(_0x289f46,_0x415467){_0x289f46=_0x289f46-0x0;var _0x3b3e58=_0xc936[_0x289f46];return _0x3b3e58;};'use strict';var multer=require('multer');var util=require(_0x6c93('0x0'));var path=require('path');var timeout=require(_0x6c93('0x1'));var express=require(_0x6c93('0x2'));var router=express[_0x6c93('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6c93('0x4'));var config=require(_0x6c93('0x5'));var controller=require('./smsInteraction.controller');router[_0x6c93('0x6')]('/',auth[_0x6c93('0x7')](),controller['index']);router['get'](_0x6c93('0x8'),auth[_0x6c93('0x7')](),controller[_0x6c93('0x9')]);router[_0x6c93('0x6')](_0x6c93('0xa'),auth[_0x6c93('0x7')](),controller[_0x6c93('0xb')]);router['get'](_0x6c93('0xc'),auth[_0x6c93('0x7')](),controller['getMessages']);router['get'](_0x6c93('0xd'),auth[_0x6c93('0x7')](),controller['download']);router[_0x6c93('0xe')]('/',auth[_0x6c93('0x7')](),controller[_0x6c93('0xf')]);router['post']('/:id/messages',auth[_0x6c93('0x7')](),controller[_0x6c93('0x10')]);router[_0x6c93('0xe')]('/:id/tags',auth[_0x6c93('0x7')](),interaction['tracked'](_0x6c93('0x11'),'smsinteraction:addtags'),controller[_0x6c93('0x12')]);router[_0x6c93('0x13')](_0x6c93('0xa'),auth[_0x6c93('0x7')](),interaction['tracked']('sms',_0x6c93('0x14')),controller['update']);router[_0x6c93('0x15')](_0x6c93('0xa'),auth[_0x6c93('0x7')](),interaction['tracked'](_0x6c93('0x11'),_0x6c93('0x16')),controller[_0x6c93('0x17')]);router['delete']('/:id/tags',auth[_0x6c93('0x7')](),controller[_0x6c93('0x18')]);module[_0x6c93('0x19')]=router; \ No newline at end of file +var _0xf0f1=['destroy','removeTags','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','create','/:id/messages','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy'];(function(_0x19f137,_0x69a6c5){var _0x13021f=function(_0x53e2c5){while(--_0x53e2c5){_0x19f137['push'](_0x19f137['shift']());}};_0x13021f(++_0x69a6c5);}(_0xf0f1,0x110));var _0x1f0f=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xf0f1[_0x4a8bad];return _0x30cf32;};'use strict';var multer=require('multer');var util=require(_0x1f0f('0x0'));var path=require(_0x1f0f('0x1'));var timeout=require(_0x1f0f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1f0f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1f0f('0x4'));var controller=require('./smsInteraction.controller');router[_0x1f0f('0x5')]('/',auth[_0x1f0f('0x6')](),controller[_0x1f0f('0x7')]);router['get'](_0x1f0f('0x8'),auth[_0x1f0f('0x6')](),controller[_0x1f0f('0x9')]);router[_0x1f0f('0x5')](_0x1f0f('0xa'),auth[_0x1f0f('0x6')](),controller[_0x1f0f('0xb')]);router['get']('/:id/messages',auth[_0x1f0f('0x6')](),controller[_0x1f0f('0xc')]);router['get'](_0x1f0f('0xd'),auth[_0x1f0f('0x6')](),controller[_0x1f0f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1f0f('0xf')]);router['post'](_0x1f0f('0x10'),auth[_0x1f0f('0x6')](),controller[_0x1f0f('0x11')]);router[_0x1f0f('0x12')](_0x1f0f('0x13'),auth[_0x1f0f('0x6')](),interaction[_0x1f0f('0x14')](_0x1f0f('0x15'),_0x1f0f('0x16')),controller[_0x1f0f('0x17')]);router[_0x1f0f('0x18')](_0x1f0f('0xa'),auth[_0x1f0f('0x6')](),interaction[_0x1f0f('0x14')](_0x1f0f('0x15'),'smsinteraction:update'),controller[_0x1f0f('0x19')]);router[_0x1f0f('0x1a')](_0x1f0f('0xa'),auth[_0x1f0f('0x6')](),interaction[_0x1f0f('0x14')](_0x1f0f('0x15'),_0x1f0f('0x1b')),controller[_0x1f0f('0x1c')]);router['delete']('/:id/tags',auth[_0x1f0f('0x6')](),controller[_0x1f0f('0x1d')]);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 2945dac..2cd1059 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 _0xe706=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x3f2dbe,_0x355f3b){var _0x428606=function(_0x1f0d8c){while(--_0x1f0d8c){_0x3f2dbe['push'](_0x3f2dbe['shift']());}};_0x428606(++_0x355f3b);}(_0xe706,0xa3));var _0x6e70=function(_0x45ea78,_0x31678e){_0x45ea78=_0x45ea78-0x0;var _0xd722b7=_0xe706[_0x45ea78];return _0xd722b7;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize[_0x6e70('0x4')]},'note':{'type':Sequelize[_0x6e70('0x4')]},'phone':{'type':Sequelize[_0x6e70('0x4')]},'read1stAt':{'type':Sequelize[_0x6e70('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6e70('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbaf0=['DATE','STRING','ENUM','out','moment','exports','BOOLEAN'];(function(_0x1bc3ea,_0x40b483){var _0x2a505a=function(_0x2ba7e8){while(--_0x2ba7e8){_0x1bc3ea['push'](_0x1bc3ea['shift']());}};_0x2a505a(++_0x40b483);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'closed':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0baf('0x3')]},'disposition':{'type':Sequelize[_0x0baf('0x4')]},'note':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0baf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0baf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'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 c444e30..2d231eb 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 _0xeb74=['request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Users','TagIds','Tags','split','push','catch','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','u.id','ui.SmsInteractionId','user_has_sms_interactions','users','sms_interactions','left_join','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','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','text','start','forEach','union','User','operator','$substring','UserId','buildExpression','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','SmsInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','create','body','addMessage','ids','omit','getMessages','findOne','SmsMessage','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','lastName','createdAt','secret','SmsAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','fullname','closed','disposition','Messages','direction','out','renderFile','views','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0xeb74,0xe3));var _0x4eb7=function(_0x127fc1,_0x4ed500){_0x127fc1=_0x127fc1-0x0;var _0xd9c8a8=_0xeb74[_0x127fc1];return _0xd9c8a8;};'use strict';var pdf=require(_0x4eb7('0x0'));var emlformat=require(_0x4eb7('0x1'));var rimraf=require(_0x4eb7('0x2'));var zipdir=require(_0x4eb7('0x3'));var jsonpatch=require(_0x4eb7('0x4'));var rp=require(_0x4eb7('0x5'));var moment=require(_0x4eb7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4eb7('0x7'));var util=require(_0x4eb7('0x8'));var path=require(_0x4eb7('0x9'));var sox=require(_0x4eb7('0xa'));var csv=require(_0x4eb7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var db=require(_0x4eb7('0x17'))['db'];config[_0x4eb7('0x18')]=_[_0x4eb7('0x19')](config[_0x4eb7('0x18')],{'host':_0x4eb7('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0x4eb7('0x1b')](socket);function respondWithStatusCode(_0x51f09d,_0x84c68b){_0x84c68b=_0x84c68b||0xcc;return function(_0x119afa){if(_0x119afa){return _0x51f09d[_0x4eb7('0x1c')](_0x84c68b);}return _0x51f09d[_0x4eb7('0x1d')](_0x84c68b)[_0x4eb7('0x1e')]();};}function respondWithResult(_0x21433d,_0x11674f){_0x11674f=_0x11674f||0xc8;return function(_0x76988){if(_0x76988){return _0x21433d[_0x4eb7('0x1d')](_0x11674f)[_0x4eb7('0x1f')](_0x76988);}};}function respondWithFilteredResult(_0x5f1711,_0xb86bc9){return function(_0x11ac9f){if(_0x11ac9f){var _0x3b6d41=_0x11ac9f[_0x4eb7('0x20')],_0xf14478=_0xb86bc9[_0x4eb7('0x21')],_0x302e16=_0xb86bc9['offset']+_0xb86bc9[_0x4eb7('0x22')],_0x44f1b9;if(_0x302e16>=_0x3b6d41){_0x302e16=_0x3b6d41;_0x44f1b9=0xc8;}else{_0x44f1b9=0xce;}_0x5f1711[_0x4eb7('0x1d')](_0x44f1b9);return _0x5f1711[_0x4eb7('0x23')](_0x4eb7('0x24'),_0xf14478+'-'+_0x302e16+'/'+_0x3b6d41)[_0x4eb7('0x1f')](_0x11ac9f);}return null;};}function patchUpdates(_0x2efd67){return function(_0x11fb0a){try{jsonpatch['apply'](_0x11fb0a,_0x2efd67,!![]);}catch(_0x214a28){return BPromise[_0x4eb7('0x25')](_0x214a28);}return _0x11fb0a[_0x4eb7('0x26')]();};}function saveUpdates(_0x164515,_0x14a7be){return function(_0x1b4640){if(_0x1b4640){return _0x1b4640[_0x4eb7('0x27')](_0x164515)[_0x4eb7('0x28')](function(_0x1a2b8b){return _0x1a2b8b;});}return null;};}function removeEntity(_0x13e871,_0x4de2d9){return function(_0x3e72cd){if(_0x3e72cd){return _0x3e72cd[_0x4eb7('0x29')]()[_0x4eb7('0x28')](function(){_0x13e871[_0x4eb7('0x1d')](0xcc)[_0x4eb7('0x1e')]();});}};}function handleEntityNotFound(_0x25eb74,_0x365060){return function(_0xe9db8){if(!_0xe9db8){_0x25eb74[_0x4eb7('0x1c')](0x194);}return _0xe9db8;};}function handleError(_0x248759,_0xf83c11){_0xf83c11=_0xf83c11||0x1f4;return function(_0x2984b2){logger[_0x4eb7('0x2a')](_0x2984b2[_0x4eb7('0x2b')]);if(_0x2984b2[_0x4eb7('0x2c')]){delete _0x2984b2[_0x4eb7('0x2c')];}_0x248759[_0x4eb7('0x1d')](_0xf83c11)[_0x4eb7('0x2d')](_0x2984b2);};}function getInteractionUsers(_0x33a2c1,_0x28fda8){return new BPromise(function(_0x114c68,_0x17030a){try{if(_0x28fda8[_0x33a2c1['id']]){_0x33a2c1[_0x4eb7('0x2e')]=_['map'](_0x28fda8[_0x33a2c1['id']],function(_0x34515c){return{'id':_0x34515c['id'],'fullname':_0x34515c['fullname']};});}}catch(_0x446872){_0x17030a(_0x446872);}_0x114c68(_0x33a2c1);});}function getInteractionTags(_0x13f71a,_0xc5aa21){return new BPromise(function(_0x1fe298,_0x468195){try{if(_0x13f71a[_0x4eb7('0x2f')]){_0x13f71a[_0x4eb7('0x30')]=[];_0x13f71a[_0x4eb7('0x2f')][_0x4eb7('0x31')](',')['forEach'](function(_0x437964){_0x13f71a['Tags'][_0x4eb7('0x32')](_0xc5aa21[_0x437964]);});}delete _0x13f71a[_0x4eb7('0x2f')];}catch(_0x560b56){_0x468195(_0x560b56);}_0x1fe298(_0x13f71a);});}function updateSmsInteraction(_0x58a8f0,_0x19ec4e,_0x241c8d){return new BPromise(function(_0x2cc859,_0x7b2c4e){return getInteractionUsers(_0x58a8f0,_0x241c8d)['then'](function(_0x6d21e9){return getInteractionTags(_0x6d21e9,_0x19ec4e);})[_0x4eb7('0x28')](function(_0xcc9bb4){_0x2cc859(_0xcc9bb4);})[_0x4eb7('0x33')](function(_0xb9129f){_0x7b2c4e(_0xb9129f);});});}exports['index']=function(_0x2059ff,_0x8ee92c){var _0x31cc6d={},_0x59d70a={},_0x115642={'count':0x0,'rows':[]};var _0xe1cc8f=_[_0x4eb7('0x34')](db['SmsInteraction'][_0x4eb7('0x35')],function(_0x512125){return{'name':_0x512125[_0x4eb7('0x36')],'type':_0x512125[_0x4eb7('0x37')][_0x4eb7('0x38')]};});_0x59d70a[_0x4eb7('0x39')]=_['map'](_0xe1cc8f,_0x4eb7('0x2c'));_0x59d70a[_0x4eb7('0x3a')]=_[_0x4eb7('0x3b')](_0x2059ff[_0x4eb7('0x3a')]);_0x59d70a['filters']=_['intersection'](_0x59d70a['model'],_0x59d70a[_0x4eb7('0x3a')]);_0x31cc6d[_0x4eb7('0x3c')]=_[_0x4eb7('0x3d')](_0x59d70a[_0x4eb7('0x39')],qs[_0x4eb7('0x3e')](_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x3e')]));_0x31cc6d[_0x4eb7('0x3c')]=_0x31cc6d[_0x4eb7('0x3c')][_0x4eb7('0x3f')]?_0x31cc6d['attributes']:_0x59d70a[_0x4eb7('0x39')];if(!_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x40')](_0x4eb7('0x41'))){_0x31cc6d[_0x4eb7('0x22')]=qs[_0x4eb7('0x22')](_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x22')]);_0x31cc6d[_0x4eb7('0x21')]=qs[_0x4eb7('0x21')](_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x21')]);}_0x31cc6d[_0x4eb7('0x42')]=qs[_0x4eb7('0x43')](_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x43')]);_0x31cc6d[_0x4eb7('0x44')]=qs[_0x4eb7('0x45')](_[_0x4eb7('0x46')](_0x2059ff[_0x4eb7('0x3a')],_0x59d70a['filters']),_0xe1cc8f);var _0x2fd5c2=[];var _0x2df542=squel[_0x4eb7('0x47')]()[_0x4eb7('0x48')]('id')[_0x4eb7('0x48')](_0x4eb7('0x2c'))[_0x4eb7('0x48')](_0x4eb7('0x49'))[_0x4eb7('0x4a')]('tools_tags');var _0x1be63b=squel['select']()[_0x4eb7('0x48')](_0x4eb7('0x4b'))[_0x4eb7('0x48')]('u.fullname')[_0x4eb7('0x48')](_0x4eb7('0x4c'))[_0x4eb7('0x4a')](_0x4eb7('0x4d'),'ui')['left_join'](_0x4eb7('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x112eb8=squel[_0x4eb7('0x47')]()[_0x4eb7('0x4a')](_0x4eb7('0x4f'),'i')[_0x4eb7('0x50')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4eb7('0x50')](_0x4eb7('0x4e'),'o',_0x4eb7('0x51'))[_0x4eb7('0x50')](_0x4eb7('0x52'),'a','a.id\x20=\x20i.SmsAccountId')[_0x4eb7('0x50')](_0x4eb7('0x53'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x4eb7('0x50')](_0x4eb7('0x54'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x4eb7('0x50')](_0x4eb7('0x55'),'t',_0x4eb7('0x56'));var _0x5774d5=squel[_0x4eb7('0x57')]();var _0x5da55c=[];var _0x518ee0=squel[_0x4eb7('0x57')]();var _0x312e9b;if(_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x58')]){_0x312e9b=as[_0x4eb7('0x59')](_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x58')]);var _0x3e762d=_0x312e9b[_0x4eb7('0x5a')];for(var _0x23c0d5=0x0;_0x23c0d5<_0x312e9b[_0x4eb7('0x5b')][_0x4eb7('0x3f')];_0x23c0d5++){var _0x41e990=_0x312e9b[_0x4eb7('0x5b')][_0x23c0d5];var _0xcbc0d9='i';var _0x2e3105=_[_0x4eb7('0x5c')](_0xe1cc8f,[_0x4eb7('0x2c'),_0x41e990[_0x4eb7('0x48')]]);if(!_0x2e3105){switch(_0x41e990[_0x4eb7('0x48')]){case'unreadMessages':if(_0x41e990[_0x4eb7('0x5d')]==0x1){_0x112eb8['having']('`'+_0x41e990['field']+_0x4eb7('0x5e'));}else{_0x112eb8[_0x4eb7('0x5f')]('`'+_0x41e990[_0x4eb7('0x48')]+_0x4eb7('0x60'));}break;case _0x4eb7('0x61'):if(_0x41e990['operator']==='$substring'){if(_0x41e990[_0x4eb7('0x5d')]['split']('\x20')[_0x4eb7('0x3f')]>0x1){_0x5774d5[_0x3e762d](_0x4eb7('0x62'),qs[_0x4eb7('0x63')](_0x41e990[_0x4eb7('0x5d')]),null);}else{var _0x5304e5='%'+_0x41e990[_0x4eb7('0x5d')]+'%';_0x5774d5[_0x3e762d](_0x4eb7('0x64'),_0x5304e5,_0x5304e5,_0x5304e5);}}else{_0x2e3105=_[_0x4eb7('0x5c')](_0xe1cc8f,[_0x4eb7('0x2c'),'ContactId']);_0x41e990[_0x4eb7('0x48')]=_0x4eb7('0x65');_0xa67fe1=as['buildExpression'](_0xcbc0d9,_0x2e3105[_0x4eb7('0x37')],_0x41e990);_0x5774d5[_0x3e762d](_0xa67fe1[_0x4eb7('0x66')],_0xa67fe1['value'][_0x4eb7('0x67')],_0xa67fe1['value'][_0x4eb7('0x1e')]);}break;case'Tag':var _0x13847e=_0x41e990[_0x4eb7('0x5d')][_0x4eb7('0x31')](',')[_0x4eb7('0x34')](function(_0x123641){return Number(_0x123641);});_0x13847e[_0x4eb7('0x68')](function(_0x4e05ac){_0x518ee0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e05ac+',%');});_0x5da55c=_[_0x4eb7('0x69')](_0x5da55c,_0x13847e);break;case _0x4eb7('0x6a'):if(_0x41e990[_0x4eb7('0x6b')]===_0x4eb7('0x6c')){_0x5774d5[_0x3e762d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x41e990[_0x4eb7('0x5d')]+'%',null);}else{_0x2e3105=_[_0x4eb7('0x5c')](_0xe1cc8f,['name',_0x4eb7('0x6d')]);_0x41e990[_0x4eb7('0x48')]=_0x4eb7('0x6d');_0xa67fe1=as[_0x4eb7('0x6e')](_0xcbc0d9,_0x2e3105[_0x4eb7('0x37')],_0x41e990);_0x5774d5[_0x3e762d](_0xa67fe1[_0x4eb7('0x66')],_0xa67fe1[_0x4eb7('0x5d')]['start'],_0xa67fe1['value'][_0x4eb7('0x1e')]);}break;case'body':_0xa67fe1=as[_0x4eb7('0x6e')]('me',null,_0x41e990);_0x5774d5[_0x3e762d](_0xa67fe1['text'],_0xa67fe1[_0x4eb7('0x5d')]['start'],_0xa67fe1['value'][_0x4eb7('0x1e')]);break;}}else{var _0xa67fe1=as['buildExpression'](_0xcbc0d9,_0x2e3105[_0x4eb7('0x37')],_0x41e990);_0x5774d5[_0x3e762d](_0xa67fe1['text'],_0xa67fe1[_0x4eb7('0x5d')][_0x4eb7('0x67')],_0xa67fe1['value'][_0x4eb7('0x1e')]);}}}else{var _0x325ca3=_(_0x2059ff['query'])['keys']()['map'](function(_0x59e2f2){return _[_0x4eb7('0x6f')](_0xe1cc8f,['name',_0x59e2f2])?_0x59e2f2:undefined;})[_0x4eb7('0x70')]()[_0x4eb7('0x5d')]();if(!_['isEmpty'](_0x325ca3)){_0x325ca3[_0x4eb7('0x68')](function(_0x4172cc){if(_0x4172cc===_0x4eb7('0x71')){_0x112eb8[_0x4eb7('0x44')](_0x4eb7('0x72'),[][_0x4eb7('0x73')](_0x2059ff['query'][_0x4172cc]));}else if(_0x4172cc==='createdAt'){var _0x561aee=JSON[_0x4eb7('0x74')](_0x2059ff[_0x4eb7('0x3a')][_0x4172cc])[_0x4eb7('0x75')];var _0x30d2a7=JSON[_0x4eb7('0x74')](_0x2059ff['query'][_0x4172cc])['$lte'];_0x112eb8[_0x4eb7('0x44')](_0x4eb7('0x76'),_0x561aee,_0x30d2a7);}else{if(_0x2059ff[_0x4eb7('0x3a')][_0x4172cc]===_0x4eb7('0x77')){_0x112eb8[_0x4eb7('0x44')]('i.'+_0x4172cc+'\x20IS\x20NULL');}else{_0x112eb8[_0x4eb7('0x44')]('i.'+_0x4172cc+_0x4eb7('0x78'),_0x2059ff[_0x4eb7('0x3a')][_0x4172cc]);}}});}if(_0x2059ff[_0x4eb7('0x3a')]['read']){if(_0x2059ff['query'][_0x4eb7('0x79')]==0x1){_0x112eb8[_0x4eb7('0x5f')]('`unreadMessages`\x20=\x200');}else{_0x112eb8[_0x4eb7('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x7a')]){_0x5da55c=_[_0x4eb7('0x7b')](_0x2059ff[_0x4eb7('0x3a')]['tag'])?_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x7a')]:new Array(_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x7a')]);_0x5da55c[_0x4eb7('0x68')](function(_0x3271d0){_0x518ee0['or'](_0x4eb7('0x7c'),'%,'+_0x3271d0+',%');});}if(_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x7d')]){var _0x400f25=_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x7d')][_0x4eb7('0x7e')]('\x5c','\x5c\x5c')[_0x4eb7('0x7e')]('\x27\x27',_0x4eb7('0x7f'));if(qs[_0x4eb7('0x80')](_0x400f25)){_0x5774d5['or'](_0x4eb7('0x81'),_0x400f25+'%')['or'](_0x4eb7('0x82'),_0x400f25+'%');}else{_0x5774d5['or'](_0x4eb7('0x83'),qs['getFullTextValue'](_0x400f25))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x400f25+'%');}}}_0x112eb8[_0x4eb7('0x44')](_0x5774d5);_0x112eb8[_0x4eb7('0x84')](_0x4eb7('0x85'));var _0x10099a={'type':db[_0x4eb7('0x86')][_0x4eb7('0x87')][_0x4eb7('0x88')],'raw':!![]};var _0x2740e9=_0x112eb8['clone']();_0x2740e9[_0x4eb7('0x48')](_0x4eb7('0x85'));_0x2740e9[_0x4eb7('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x31cc6d[_0x4eb7('0x42')]){_0x31cc6d[_0x4eb7('0x42')][_0x4eb7('0x68')](function(_0x48dc6f){_0x112eb8['order']('i.'+_0x48dc6f[0x0],_0x48dc6f[0x1]===_0x4eb7('0x89')?![]:!![]);});}if(!_[_0x4eb7('0x8a')](_0x5da55c)){_0x112eb8[_0x4eb7('0x5f')](_0x518ee0);_0x2740e9[_0x4eb7('0x44')](_0x4eb7('0x8b'),_0x5da55c);}BPromise[_0x4eb7('0x8c')]()[_0x4eb7('0x28')](function(){if(!_0x312e9b){if(_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x71')]||_0x2059ff[_0x4eb7('0x3a')][_0x4eb7('0x8d')])return;_0x2740e9[_0x4eb7('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x112eb8['where'](_0x4eb7('0x8e'));return;}return _0x2059ff[_0x4eb7('0x8f')][_0x4eb7('0x90')]({'attributes':['id'],'raw':!![]})[_0x4eb7('0x28')](function(_0x400b45){if(_[_0x4eb7('0x8a')](_0x400b45)){_0x2740e9['where']('i.SmsAccountId\x20IS\x20NULL');_0x112eb8[_0x4eb7('0x44')](_0x4eb7('0x91'));}else{_0x2740e9[_0x4eb7('0x44')](_0x4eb7('0x72'),_[_0x4eb7('0x34')](_0x400b45,'id'));_0x112eb8[_0x4eb7('0x44')](_0x4eb7('0x72'),_[_0x4eb7('0x34')](_0x400b45,'id'));}});})[_0x4eb7('0x28')](function(){db[_0x4eb7('0x92')][_0x4eb7('0x3a')](_0x2740e9[_0x4eb7('0x93')](),_0x10099a)[_0x4eb7('0x28')](function(_0x186946){_0x115642['count']=_0x186946[_0x4eb7('0x3f')];if(_0x115642[_0x4eb7('0x20')]===0x0)return[];return db[_0x4eb7('0x92')][_0x4eb7('0x3a')](_0x2df542['toString'](),_0x10099a)[_0x4eb7('0x28')](function(_0xac2468){_0x2fd5c2=_['keyBy'](_0xac2468,'id');_0x10099a=_[_0x4eb7('0x94')](_0x10099a,{'model':db[_0x4eb7('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2059ff[_0x4eb7('0x3a')]['fields']){_0x31cc6d[_0x4eb7('0x3c')][_0x4eb7('0x68')](function(_0x3e3831){_0x112eb8['field']('i.'+_0x3e3831);});}else{_0x112eb8[_0x4eb7('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x112eb8[_0x4eb7('0x48')]('a.key',_0x4eb7('0x96'));_0x112eb8['field'](_0x4eb7('0x97'),_0x4eb7('0x98'));_0x112eb8[_0x4eb7('0x48')](_0x4eb7('0x99'));_0x112eb8[_0x4eb7('0x48')](_0x4eb7('0x9a'),'Contact.firstName');_0x112eb8[_0x4eb7('0x48')](_0x4eb7('0x9b'),_0x4eb7('0x9c'));_0x112eb8[_0x4eb7('0x48')](_0x4eb7('0x9d'),_0x4eb7('0x9e'));_0x112eb8[_0x4eb7('0x48')]('c.phone',_0x4eb7('0x9f'));_0x112eb8[_0x4eb7('0x48')](_0x4eb7('0xa0'),_0x4eb7('0xa1'));_0x112eb8[_0x4eb7('0x48')](_0x4eb7('0xa2'),_0x4eb7('0xa3'));_0x112eb8[_0x4eb7('0x48')](_0x4eb7('0xa4'),_0x4eb7('0xa5'));_0x112eb8[_0x4eb7('0x48')](_0x4eb7('0xa6'),_0x4eb7('0xa7'));_0x112eb8['field'](_0x4eb7('0xa8'),_0x4eb7('0x2f'));}if(_0x31cc6d[_0x4eb7('0x22')])_0x112eb8[_0x4eb7('0x22')](_0x31cc6d[_0x4eb7('0x22')]);if(_0x31cc6d[_0x4eb7('0x21')])_0x112eb8[_0x4eb7('0x21')](_0x31cc6d[_0x4eb7('0x21')]);return db['sequelize'][_0x4eb7('0x3a')](_0x112eb8[_0x4eb7('0x93')](),_0x10099a);})[_0x4eb7('0x28')](function(_0x419aaf){_0x1be63b['where'](_0x4eb7('0xa9'),_['map'](_0x419aaf,'id'));return db['sequelize']['query'](_0x1be63b['toString'](),_0x10099a)[_0x4eb7('0x28')](function(_0x3f6a1b){var _0x15b9a2=_[_0x4eb7('0xaa')](_0x3f6a1b,'SmsInteractionId');var _0x351f20=[];_0x419aaf[_0x4eb7('0x68')](function(_0x14591a){_0x351f20[_0x4eb7('0x32')](updateSmsInteraction(_0x14591a,_0x2fd5c2,_0x15b9a2));});return BPromise[_0x4eb7('0xab')](_0x351f20);});});})[_0x4eb7('0x28')](function(_0x105139){_0x115642[_0x4eb7('0xac')]=_0x105139;return _0x115642;})['then'](respondWithFilteredResult(_0x8ee92c,_0x31cc6d));})[_0x4eb7('0x33')](handleError(_0x8ee92c,null));};exports[_0x4eb7('0xad')]=function(_0x269e5a,_0x51c7ab){var _0x2c0792={'raw':![],'where':{'id':_0x269e5a[_0x4eb7('0xae')]['id']}},_0x4f14b3={};_0x4f14b3[_0x4eb7('0x39')]=_['keys'](db[_0x4eb7('0x95')]['rawAttributes']);_0x4f14b3[_0x4eb7('0x3a')]=_['keys'](_0x269e5a[_0x4eb7('0x3a')]);_0x4f14b3['filters']=_[_0x4eb7('0x3d')](_0x4f14b3['model'],_0x4f14b3['query']);_0x2c0792[_0x4eb7('0x3c')]=_[_0x4eb7('0x3d')](_0x4f14b3[_0x4eb7('0x39')],qs['fields'](_0x269e5a['query']['fields']));_0x2c0792['attributes']=_0x2c0792[_0x4eb7('0x3c')][_0x4eb7('0x3f')]?_0x2c0792[_0x4eb7('0x3c')]:_0x4f14b3[_0x4eb7('0x39')];if(_0x269e5a['query'][_0x4eb7('0xaf')]){_0x2c0792[_0x4eb7('0xb0')]=[{'all':!![]}];}_0x2c0792=_[_0x4eb7('0x94')]({},_0x2c0792,_0x269e5a['options']);return db[_0x4eb7('0x95')]['find'](_0x2c0792)[_0x4eb7('0x28')](handleEntityNotFound(_0x51c7ab,null))[_0x4eb7('0x28')](respondWithResult(_0x51c7ab,null))['catch'](handleError(_0x51c7ab,null));};exports[_0x4eb7('0xb1')]=function(_0x14e411,_0xe6c8b0){return db[_0x4eb7('0x95')][_0x4eb7('0xb1')](_0x14e411[_0x4eb7('0xb2')],{})[_0x4eb7('0x28')](respondWithResult(_0xe6c8b0,0xc9))['catch'](handleError(_0xe6c8b0,null));};exports[_0x4eb7('0x27')]=function(_0x2677d1,_0x4b2aac){if(_0x2677d1[_0x4eb7('0xb2')]['id']){delete _0x2677d1[_0x4eb7('0xb2')]['id'];}return db[_0x4eb7('0x95')][_0x4eb7('0x5c')]({'where':{'id':_0x2677d1[_0x4eb7('0xae')]['id']}})['then'](handleEntityNotFound(_0x4b2aac,null))['then'](saveUpdates(_0x2677d1['body'],null))[_0x4eb7('0x28')](respondWithResult(_0x4b2aac,null))['catch'](handleError(_0x4b2aac,null));};exports['destroy']=function(_0x5553c3,_0x5d1ee6){return db[_0x4eb7('0x95')]['find']({'where':{'id':_0x5553c3[_0x4eb7('0xae')]['id']}})[_0x4eb7('0x28')](handleEntityNotFound(_0x5d1ee6,null))[_0x4eb7('0x28')](removeEntity(_0x5d1ee6,null))[_0x4eb7('0x33')](handleError(_0x5d1ee6,null));};exports['describe']=function(_0x1aaf4f,_0x1ef8a6){return db[_0x4eb7('0x95')]['describe']()[_0x4eb7('0x28')](respondWithResult(_0x1ef8a6,null))[_0x4eb7('0x33')](handleError(_0x1ef8a6,null));};exports[_0x4eb7('0xb3')]=function(_0x16fdd4,_0x234703,_0x4f2a81){return db['SmsMessage'][_0x4eb7('0x5c')]({'where':{'id':_0x16fdd4['params']['id']}})[_0x4eb7('0x28')](handleEntityNotFound(_0x234703,null))['then'](function(_0x1e89e5){if(_0x1e89e5){return _0x1e89e5[_0x4eb7('0xb3')](_0x16fdd4['body'][_0x4eb7('0xb4')],_[_0x4eb7('0xb5')](_0x16fdd4[_0x4eb7('0xb2')],[_0x4eb7('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x234703,null))['catch'](handleError(_0x234703,null));};exports[_0x4eb7('0xb6')]=function(_0x72e865,_0x1b3a90,_0x283e9e){var _0x1fcb3d={'raw':![],'where':{}};var _0x307311={};var _0x10681e={'count':0x0,'rows':[]};return db[_0x4eb7('0x95')][_0x4eb7('0xb7')]({'where':{'id':_0x72e865[_0x4eb7('0xae')]['id']}})['then'](handleEntityNotFound(_0x1b3a90,null))[_0x4eb7('0x28')](function(_0x21b3fc){if(_0x21b3fc){_0x307311[_0x4eb7('0x39')]=_[_0x4eb7('0x3b')](db[_0x4eb7('0xb8')][_0x4eb7('0x35')]);_0x307311['query']=_[_0x4eb7('0x3b')](_0x72e865[_0x4eb7('0x3a')]);_0x307311[_0x4eb7('0x45')]=_['intersection'](_0x307311[_0x4eb7('0x39')],_0x307311[_0x4eb7('0x3a')]);_0x1fcb3d[_0x4eb7('0x3c')]=_['intersection'](_0x307311[_0x4eb7('0x39')],qs[_0x4eb7('0x3e')](_0x72e865[_0x4eb7('0x3a')][_0x4eb7('0x3e')]));_0x1fcb3d[_0x4eb7('0x3c')]=_0x1fcb3d[_0x4eb7('0x3c')][_0x4eb7('0x3f')]?_0x1fcb3d[_0x4eb7('0x3c')]:_0x307311[_0x4eb7('0x39')];if(!_0x72e865[_0x4eb7('0x3a')][_0x4eb7('0x40')](_0x4eb7('0x41'))){_0x1fcb3d['limit']=qs[_0x4eb7('0x22')](_0x72e865[_0x4eb7('0x3a')][_0x4eb7('0x22')]);_0x1fcb3d[_0x4eb7('0x21')]=qs['offset'](_0x72e865[_0x4eb7('0x3a')][_0x4eb7('0x21')]);}_0x1fcb3d[_0x4eb7('0x42')]=qs[_0x4eb7('0x43')](_0x72e865[_0x4eb7('0x3a')][_0x4eb7('0x43')]);_0x1fcb3d[_0x4eb7('0x44')]=qs['filters'](_['pick'](_0x72e865[_0x4eb7('0x3a')],_0x307311['filters']));_0x1fcb3d['where'][_0x4eb7('0xb9')]=_0x21b3fc['id'];if(_0x72e865[_0x4eb7('0x3a')][_0x4eb7('0x7d')]){_0x1fcb3d[_0x4eb7('0x44')]=_[_0x4eb7('0x94')](_0x1fcb3d['where'],{'$or':_[_0x4eb7('0x34')](_0x1fcb3d['attributes'],function(_0x19fa5e){var _0x10528b={};_0x10528b[_0x19fa5e]={'$like':'%'+_0x72e865[_0x4eb7('0x3a')][_0x4eb7('0x7d')]+'%'};return _0x10528b;})});}if(_0x72e865[_0x4eb7('0x3a')][_0x4eb7('0x75')]){var _0x59c892=_0x72e865['query'][_0x4eb7('0x75')][_0x4eb7('0x31')](',');var _0x52c84b={};_0x52c84b[_0x59c892[0x0]]={'$gte':moment(_0x59c892[0x1])[_0x4eb7('0xba')](_0x4eb7('0xbb'))};_0x1fcb3d[_0x4eb7('0x44')]=_['merge'](_0x1fcb3d['where'],_0x52c84b);}_0x1fcb3d=_['merge']({},_0x1fcb3d,_0x72e865[_0x4eb7('0xbc')]);return db[_0x4eb7('0xb8')][_0x4eb7('0x20')]({'where':_0x1fcb3d[_0x4eb7('0x44')]})[_0x4eb7('0x28')](function(_0x6efad6){_0x10681e[_0x4eb7('0x20')]=_0x6efad6;if(_0x72e865['query']['includeAll']){_0x1fcb3d[_0x4eb7('0xb0')]=[{'all':!![]}];}return db[_0x4eb7('0xb8')][_0x4eb7('0xbd')](_0x1fcb3d);})[_0x4eb7('0x28')](function(_0x4002a0){_0x10681e[_0x4eb7('0xac')]=_0x4002a0;return _0x10681e;});}})[_0x4eb7('0x28')](respondWithFilteredResult(_0x1b3a90,_0x1fcb3d))[_0x4eb7('0x33')](handleError(_0x1b3a90,null));};exports['addTags']=function(_0x14209c,_0x4d1541,_0x3a659e){return db[_0x4eb7('0x95')][_0x4eb7('0x5c')]({'where':{'id':_0x14209c[_0x4eb7('0xae')]['id']}})['then'](handleEntityNotFound(_0x4d1541,null))[_0x4eb7('0x28')](function(_0x21a87d){if(_0x21a87d){return _0x21a87d[_0x4eb7('0xbe')](_0x14209c[_0x4eb7('0xb2')][_0x4eb7('0xb4')],_[_0x4eb7('0xb5')](_0x14209c[_0x4eb7('0xb2')],[_0x4eb7('0xb4'),'id'])||{})[_0x4eb7('0xbf')](function(){return db[_0x4eb7('0xc0')][_0x4eb7('0xbd')]({'attributes':['id',_0x4eb7('0x2c'),_0x4eb7('0x49')],'where':{'id':_0x14209c[_0x4eb7('0xb2')][_0x4eb7('0xb4')]}});})['then'](function(_0x2319b9){socket[_0x4eb7('0xc1')](_0x4eb7('0xc2'),{'id':Number(_0x14209c[_0x4eb7('0xae')]['id']),'tags':_0x2319b9||[]});return{'id':Number(_0x14209c['params']['id']),'tags':_0x2319b9||[]};});}})[_0x4eb7('0x28')](respondWithResult(_0x4d1541,null))[_0x4eb7('0x33')](handleError(_0x4d1541,null));};exports['removeTags']=function(_0x4f11f6,_0x558141,_0x48475b){return db['SmsInteraction'][_0x4eb7('0x5c')]({'where':{'id':_0x4f11f6[_0x4eb7('0xae')]['id']}})[_0x4eb7('0x28')](handleEntityNotFound(_0x558141,null))[_0x4eb7('0x28')](function(_0x516205){if(_0x516205){return _0x516205[_0x4eb7('0xc3')](_0x4f11f6[_0x4eb7('0x3a')][_0x4eb7('0xb4')]);}})[_0x4eb7('0x28')](respondWithStatusCode(_0x558141,null))[_0x4eb7('0x33')](handleError(_0x558141,null));};exports[_0x4eb7('0xc4')]=function(_0x6f4497,_0x3285c8){var _0x134338=moment()[_0x4eb7('0xc5')]()[_0x4eb7('0x93')]();var _0x5cc8ab=path[_0x4eb7('0xc6')](config[_0x4eb7('0xc7')],_0x4eb7('0xc8'),_0x4eb7('0xc9'),_0x4eb7('0xca'));var _0x383931=path['join'](config[_0x4eb7('0xc7')],_0x4eb7('0xc8'),_0x4eb7('0xc9'),'attachments');var _0x27be55=path[_0x4eb7('0xc6')](_0x5cc8ab,_0x134338);var _0x1c6f00=util[_0x4eb7('0xba')](_0x4eb7('0xcb'),_0x6f4497[_0x4eb7('0xae')]['id'],_0x134338);var _0x136190=path[_0x4eb7('0xc6')](_0x5cc8ab,_0x1c6f00);var _0x1f77ad=[];_0x1f77ad[_0x4eb7('0x32')]({'model':db['User'],'as':_0x4eb7('0x6a'),'attributes':['id','fullname'],'raw':!![]});_0x1f77ad['push']({'model':db['CmContact'],'as':_0x4eb7('0x61'),'attributes':['id','firstName',_0x4eb7('0xcc')],'raw':!![]});var _0x33d92e=[{'model':db[_0x4eb7('0xb8')],'as':'Messages','attributes':['id',_0x4eb7('0xb2'),_0x4eb7('0xcd'),'direction',_0x4eb7('0xce'),_0x4eb7('0x79')],'include':_0x1f77ad}];_0x33d92e['push']({'model':db[_0x4eb7('0xcf')],'as':_0x4eb7('0xd0'),'attributes':['id','name']});_0x33d92e[_0x4eb7('0x32')]({'model':db['User'],'as':_0x4eb7('0xd1'),'attributes':['id','fullname']});return db[_0x4eb7('0x95')][_0x4eb7('0x5c')]({'where':{'id':_0x6f4497['params']['id']},'include':_0x33d92e})['then'](handleEntityNotFound(_0x3285c8,null))[_0x4eb7('0x28')](function(_0x3b3a1b){if(_0x3b3a1b){var _0x3cefee=_0x3b3a1b[_0x4eb7('0xd2')]({'plain':!![]});fs[_0x4eb7('0xd3')](_0x27be55);var _0x520f53={'format':'A4','border':_0x4eb7('0xd4'),'header':{'height':_0x4eb7('0xd5'),'contents':{'first':_0x4eb7('0xd6')}},'footer':{'height':_0x4eb7('0xd7'),'contents':{'default':util[_0x4eb7('0xba')](_0x4eb7('0xd8'),util[_0x4eb7('0xba')](_0x4eb7('0xd9'),_0x4eb7('0xda'),_0x3cefee['id']),moment()[_0x4eb7('0xba')]('YYYY-MM-DD')[_0x4eb7('0x93')]())}}};var _0x544c58={'channel':_0x4eb7('0xda'),'account':_0x3cefee['Account'][_0x4eb7('0x2c')],'agent':_0x3cefee[_0x4eb7('0xd1')]?_0x3cefee[_0x4eb7('0xd1')][_0x4eb7('0xdb')]:'N.A.','createdAt':moment(_0x3cefee[_0x4eb7('0xcd')])[_0x4eb7('0xba')](_0x4eb7('0xbb'))[_0x4eb7('0x93')](),'closedAt':_0x3cefee[_0x4eb7('0xdc')]?moment(_0x3cefee['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4eb7('0x93')]():'','disposition':_0x3cefee[_0x4eb7('0xdd')],'messages':_(_0x3cefee[_0x4eb7('0xde')])[_0x4eb7('0x7d')]({'secret':![]})['map'](function(_0x2b0045){return{'date':moment(_0x2b0045['createdAt'])[_0x4eb7('0xba')](_0x4eb7('0xbb'))['toString'](),'sender':_0x2b0045[_0x4eb7('0xdf')]===_0x4eb7('0xe0')?_0x2b0045[_0x4eb7('0x6a')]?_0x2b0045[_0x4eb7('0x6a')]['fullname']:'System':_0x2b0045[_0x4eb7('0x61')]['firstName']+(_0x2b0045[_0x4eb7('0x61')]['lastName']?'\x20'+_0x2b0045[_0x4eb7('0x61')][_0x4eb7('0xcc')]:''),'body':_0x2b0045[_0x4eb7('0xb2')],'direction':_0x2b0045[_0x4eb7('0xdf')]==='out'?'A':'C','secret':_0x2b0045['secret'],'read':_0x2b0045[_0x4eb7('0x79')]};})[_0x4eb7('0x5d')]()};return ejs[_0x4eb7('0xe1')](path[_0x4eb7('0xc6')](config[_0x4eb7('0xc7')],_0x4eb7('0xc8'),_0x4eb7('0xe2'),'downloadInteraction.html'),{'interaction':_0x544c58})['then'](function(_0xbc411e){return new BPromise(function(_0x347450,_0x588660){pdf[_0x4eb7('0xb1')](_0xbc411e,_0x520f53)[_0x4eb7('0xe3')](path[_0x4eb7('0xc6')](_0x27be55,_0x4eb7('0xe4')+_0x3cefee['id']+'-'+_0x134338+_0x4eb7('0xe5')),function(_0x3d684f,_0x46f611){if(_0x3d684f)return _0x588660(_0x3d684f);_0x347450(_0x46f611);});});})[_0x4eb7('0x28')](function(){return new BPromise(function(_0x5664e0,_0x452ed5){zipdir(_0x27be55,{'saveTo':_0x136190},function(_0x33d68c,_0x322a30){if(_0x33d68c)return _0x452ed5(_0x33d68c);return _0x5664e0(_0x322a30);});})[_0x4eb7('0x28')](function(){return new BPromise(function(_0xe966de,_0x28d13d){rimraf(_0x27be55,function(_0x4927fc){if(_0x4927fc)_0x28d13d(_0x4927fc);return _0xe966de();});});})[_0x4eb7('0x28')](function(){return _0x3285c8[_0x4eb7('0xc4')](_0x136190,_0x1c6f00,function(_0x499dc9){if(_0x499dc9){console[_0x4eb7('0xe6')](_0x4eb7('0xe7'),_0x499dc9);}else{fs['unlinkSync'](_0x136190);}});});});}else{return _0x3285c8[_0x4eb7('0x1c')](0xc8);}})[_0x4eb7('0x33')](handleError(_0x3285c8,null));}; \ No newline at end of file +var _0x6e6c=['limit','set','Content-Range','reject','save','update','then','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','SmsInteraction','rawAttributes','type','model','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','length','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','isEmpty','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','show','params','includeAll','options','create','body','destroy','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','User','CmContact','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','get','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','%s\x20#%d','Sms','YYYY-MM-DD','closed','closedAt','disposition','out','System','firstName','lastName','renderFile','downloadInteraction.html','toFile','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset'];(function(_0xe6027d,_0x230462){var _0x1f1ac8=function(_0x1983fc){while(--_0x1983fc){_0xe6027d['push'](_0xe6027d['shift']());}};_0x1f1ac8(++_0x230462);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0xc6e6('0x0'));var emlformat=require(_0xc6e6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc6e6('0x2'));var jsonpatch=require(_0xc6e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6e6('0x4'));var Mustache=require('mustache');var util=require(_0xc6e6('0x5'));var path=require('path');var sox=require(_0xc6e6('0x6'));var csv=require(_0xc6e6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var db=require('../../mysqldb')['db'];config[_0xc6e6('0x16')]=_['defaults'](config[_0xc6e6('0x16')],{'host':_0xc6e6('0x17'),'port':0x18eb});var socket=require(_0xc6e6('0x18'))(new Redis(config[_0xc6e6('0x16')]));require('./smsInteraction.socket')[_0xc6e6('0x19')](socket);function respondWithStatusCode(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xcc;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x1a')](_0x13be73);}return _0x2bfe7d['status'](_0x13be73)[_0xc6e6('0x1b')]();};}function respondWithResult(_0x178b34,_0x569474){_0x569474=_0x569474||0xc8;return function(_0x2f11b0){if(_0x2f11b0){return _0x178b34[_0xc6e6('0x1c')](_0x569474)[_0xc6e6('0x1d')](_0x2f11b0);}};}function respondWithFilteredResult(_0x4c978d,_0x51fd7c){return function(_0x5867bf){if(_0x5867bf){var _0x3a1ccc=_0x5867bf[_0xc6e6('0x1e')],_0x554262=_0x51fd7c[_0xc6e6('0x1f')],_0x46e58f=_0x51fd7c[_0xc6e6('0x1f')]+_0x51fd7c[_0xc6e6('0x20')],_0x2069e4;if(_0x46e58f>=_0x3a1ccc){_0x46e58f=_0x3a1ccc;_0x2069e4=0xc8;}else{_0x2069e4=0xce;}_0x4c978d[_0xc6e6('0x1c')](_0x2069e4);return _0x4c978d[_0xc6e6('0x21')](_0xc6e6('0x22'),_0x554262+'-'+_0x46e58f+'/'+_0x3a1ccc)[_0xc6e6('0x1d')](_0x5867bf);}return null;};}function patchUpdates(_0x4a36b6){return function(_0x428401){try{jsonpatch['apply'](_0x428401,_0x4a36b6,!![]);}catch(_0x1c34cc){return BPromise[_0xc6e6('0x23')](_0x1c34cc);}return _0x428401[_0xc6e6('0x24')]();};}function saveUpdates(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x25')](_0x2f69f1)[_0xc6e6('0x26')](function(_0x36ebfa){return _0x36ebfa;});}return null;};}function removeEntity(_0x107561,_0x4c35ae){return function(_0x41fe96){if(_0x41fe96){return _0x41fe96['destroy']()[_0xc6e6('0x26')](function(){_0x107561[_0xc6e6('0x1c')](0xcc)[_0xc6e6('0x1b')]();});}};}function handleEntityNotFound(_0x64e1dc,_0x53a1bf){return function(_0x3ff8a4){if(!_0x3ff8a4){_0x64e1dc['sendStatus'](0x194);}return _0x3ff8a4;};}function handleError(_0x28577b,_0x534745){_0x534745=_0x534745||0x1f4;return function(_0x267c6a){logger[_0xc6e6('0x27')](_0x267c6a[_0xc6e6('0x28')]);if(_0x267c6a[_0xc6e6('0x29')]){delete _0x267c6a[_0xc6e6('0x29')];}_0x28577b['status'](_0x534745)[_0xc6e6('0x2a')](_0x267c6a);};}function getInteractionUsers(_0x1501bd,_0x166313){return new BPromise(function(_0x1af05c,_0x4d1284){try{if(_0x166313[_0x1501bd['id']]){_0x1501bd[_0xc6e6('0x2b')]=_['map'](_0x166313[_0x1501bd['id']],function(_0x29411c){return{'id':_0x29411c['id'],'fullname':_0x29411c[_0xc6e6('0x2c')]};});}}catch(_0x12c616){_0x4d1284(_0x12c616);}_0x1af05c(_0x1501bd);});}function getInteractionTags(_0xc578b3,_0xd3b63){return new BPromise(function(_0x402598,_0x43ff9c){try{if(_0xc578b3[_0xc6e6('0x2d')]){_0xc578b3[_0xc6e6('0x2e')]=[];_0xc578b3[_0xc6e6('0x2d')][_0xc6e6('0x2f')](',')[_0xc6e6('0x30')](function(_0x101ee9){_0xc578b3[_0xc6e6('0x2e')][_0xc6e6('0x31')](_0xd3b63[_0x101ee9]);});}delete _0xc578b3[_0xc6e6('0x2d')];}catch(_0x1972da){_0x43ff9c(_0x1972da);}_0x402598(_0xc578b3);});}function updateSmsInteraction(_0x589dfb,_0x244daa,_0x457c1f){return new BPromise(function(_0x5c0dfa,_0x48f8dc){return getInteractionUsers(_0x589dfb,_0x457c1f)[_0xc6e6('0x26')](function(_0x1f4c50){return getInteractionTags(_0x1f4c50,_0x244daa);})[_0xc6e6('0x26')](function(_0x152e45){_0x5c0dfa(_0x152e45);})[_0xc6e6('0x32')](function(_0x243cea){_0x48f8dc(_0x243cea);});});}exports['index']=function(_0x290baf,_0x46098f){var _0x1fff39={},_0x595d8a={},_0x518d4f={'count':0x0,'rows':[]};var _0xa5138d=_[_0xc6e6('0x33')](db[_0xc6e6('0x34')][_0xc6e6('0x35')],function(_0x597ac4){return{'name':_0x597ac4['fieldName'],'type':_0x597ac4[_0xc6e6('0x36')]['key']};});_0x595d8a[_0xc6e6('0x37')]=_['map'](_0xa5138d,_0xc6e6('0x29'));_0x595d8a[_0xc6e6('0x38')]=_[_0xc6e6('0x39')](_0x290baf[_0xc6e6('0x38')]);_0x595d8a['filters']=_['intersection'](_0x595d8a[_0xc6e6('0x37')],_0x595d8a[_0xc6e6('0x38')]);_0x1fff39[_0xc6e6('0x3a')]=_[_0xc6e6('0x3b')](_0x595d8a['model'],qs['fields'](_0x290baf[_0xc6e6('0x38')][_0xc6e6('0x3c')]));_0x1fff39[_0xc6e6('0x3a')]=_0x1fff39[_0xc6e6('0x3a')]['length']?_0x1fff39[_0xc6e6('0x3a')]:_0x595d8a[_0xc6e6('0x37')];if(!_0x290baf['query']['hasOwnProperty'](_0xc6e6('0x3d'))){_0x1fff39['limit']=qs[_0xc6e6('0x20')](_0x290baf[_0xc6e6('0x38')]['limit']);_0x1fff39[_0xc6e6('0x1f')]=qs['offset'](_0x290baf[_0xc6e6('0x38')]['offset']);}_0x1fff39[_0xc6e6('0x3e')]=qs[_0xc6e6('0x3f')](_0x290baf[_0xc6e6('0x38')][_0xc6e6('0x3f')]);_0x1fff39[_0xc6e6('0x40')]=qs[_0xc6e6('0x41')](_[_0xc6e6('0x42')](_0x290baf[_0xc6e6('0x38')],_0x595d8a[_0xc6e6('0x41')]),_0xa5138d);var _0x5722db=[];var _0x3e3da6=squel[_0xc6e6('0x43')]()[_0xc6e6('0x44')]('id')[_0xc6e6('0x44')]('name')[_0xc6e6('0x44')](_0xc6e6('0x45'))[_0xc6e6('0x46')](_0xc6e6('0x47'));var _0x5ab058=squel[_0xc6e6('0x43')]()[_0xc6e6('0x44')](_0xc6e6('0x48'))[_0xc6e6('0x44')](_0xc6e6('0x49'))['field'](_0xc6e6('0x4a'))['from'](_0xc6e6('0x4b'),'ui')['left_join'](_0xc6e6('0x4c'),'u',_0xc6e6('0x4d'));var _0xd34c20=squel[_0xc6e6('0x43')]()[_0xc6e6('0x46')](_0xc6e6('0x4e'),'i')[_0xc6e6('0x4f')](_0xc6e6('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc6e6('0x4f')](_0xc6e6('0x4c'),'o',_0xc6e6('0x51'))['left_join'](_0xc6e6('0x52'),'a',_0xc6e6('0x53'))[_0xc6e6('0x4f')](_0xc6e6('0x54'),'me',_0xc6e6('0x55'))[_0xc6e6('0x4f')](_0xc6e6('0x56'),'it',_0xc6e6('0x57'))[_0xc6e6('0x4f')](_0xc6e6('0x47'),'t',_0xc6e6('0x58'));var _0x470167=squel[_0xc6e6('0x59')]();var _0x8095e6=[];var _0x4f361c=squel[_0xc6e6('0x59')]();var _0x5566df;if(_0x290baf[_0xc6e6('0x38')][_0xc6e6('0x5a')]){_0x5566df=as['parseSearch'](_0x290baf['query']['search']);var _0x5d3b3a=_0x5566df['sqlOperator'];for(var _0x3edc16=0x0;_0x3edc16<_0x5566df[_0xc6e6('0x5b')][_0xc6e6('0x5c')];_0x3edc16++){var _0x310195=_0x5566df[_0xc6e6('0x5b')][_0x3edc16];var _0x486325='i';var _0x5733a2=_[_0xc6e6('0x5d')](_0xa5138d,[_0xc6e6('0x29'),_0x310195[_0xc6e6('0x44')]]);if(!_0x5733a2){switch(_0x310195[_0xc6e6('0x44')]){case'unreadMessages':if(_0x310195[_0xc6e6('0x5e')]==0x1){_0xd34c20[_0xc6e6('0x5f')]('`'+_0x310195[_0xc6e6('0x44')]+_0xc6e6('0x60'));}else{_0xd34c20[_0xc6e6('0x5f')]('`'+_0x310195['field']+_0xc6e6('0x61'));}break;case _0xc6e6('0x62'):if(_0x310195[_0xc6e6('0x63')]==='$substring'){if(_0x310195[_0xc6e6('0x5e')][_0xc6e6('0x2f')]('\x20')[_0xc6e6('0x5c')]>0x1){_0x470167[_0x5d3b3a](_0xc6e6('0x64'),qs[_0xc6e6('0x65')](_0x310195['value']),null);}else{var _0x46e8b1='%'+_0x310195[_0xc6e6('0x5e')]+'%';_0x470167[_0x5d3b3a](_0xc6e6('0x66'),_0x46e8b1,_0x46e8b1,_0x46e8b1);}}else{_0x5733a2=_[_0xc6e6('0x5d')](_0xa5138d,[_0xc6e6('0x29'),'ContactId']);_0x310195['field']='ContactId';_0x5ddc81=as[_0xc6e6('0x67')](_0x486325,_0x5733a2[_0xc6e6('0x36')],_0x310195);_0x470167[_0x5d3b3a](_0x5ddc81[_0xc6e6('0x68')],_0x5ddc81[_0xc6e6('0x5e')][_0xc6e6('0x69')],_0x5ddc81[_0xc6e6('0x5e')]['end']);}break;case _0xc6e6('0x6a'):var _0x50f52a=_0x310195[_0xc6e6('0x5e')][_0xc6e6('0x2f')](',')[_0xc6e6('0x33')](function(_0x4f9f92){return Number(_0x4f9f92);});_0x50f52a[_0xc6e6('0x30')](function(_0x5c89ed){_0x4f361c['or'](_0xc6e6('0x6b'),'%,'+_0x5c89ed+',%');});_0x8095e6=_['union'](_0x8095e6,_0x50f52a);break;case'User':if(_0x310195[_0xc6e6('0x63')]==='$substring'){_0x470167[_0x5d3b3a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x310195[_0xc6e6('0x5e')]+'%',null);}else{_0x5733a2=_[_0xc6e6('0x5d')](_0xa5138d,[_0xc6e6('0x29'),_0xc6e6('0x6c')]);_0x310195[_0xc6e6('0x44')]=_0xc6e6('0x6c');_0x5ddc81=as[_0xc6e6('0x67')](_0x486325,_0x5733a2[_0xc6e6('0x36')],_0x310195);_0x470167[_0x5d3b3a](_0x5ddc81['text'],_0x5ddc81[_0xc6e6('0x5e')][_0xc6e6('0x69')],_0x5ddc81[_0xc6e6('0x5e')][_0xc6e6('0x1b')]);}break;case'body':_0x5ddc81=as[_0xc6e6('0x67')]('me',null,_0x310195);_0x470167[_0x5d3b3a](_0x5ddc81[_0xc6e6('0x68')],_0x5ddc81[_0xc6e6('0x5e')]['start'],_0x5ddc81['value'][_0xc6e6('0x1b')]);break;}}else{var _0x5ddc81=as['buildExpression'](_0x486325,_0x5733a2[_0xc6e6('0x36')],_0x310195);_0x470167[_0x5d3b3a](_0x5ddc81[_0xc6e6('0x68')],_0x5ddc81[_0xc6e6('0x5e')][_0xc6e6('0x69')],_0x5ddc81[_0xc6e6('0x5e')][_0xc6e6('0x1b')]);}}}else{var _0x38a636=_(_0x290baf[_0xc6e6('0x38')])[_0xc6e6('0x39')]()[_0xc6e6('0x33')](function(_0x15404a){return _['some'](_0xa5138d,['name',_0x15404a])?_0x15404a:undefined;})[_0xc6e6('0x6d')]()['value']();if(!_['isEmpty'](_0x38a636)){_0x38a636[_0xc6e6('0x30')](function(_0xf8e442){if(_0xf8e442===_0xc6e6('0x6e')){_0xd34c20['where'](_0xc6e6('0x6f'),[][_0xc6e6('0x70')](_0x290baf['query'][_0xf8e442]));}else if(_0xf8e442==='createdAt'){var _0x3267b4=JSON[_0xc6e6('0x71')](_0x290baf[_0xc6e6('0x38')][_0xf8e442])[_0xc6e6('0x72')];var _0xdc4e64=JSON[_0xc6e6('0x71')](_0x290baf['query'][_0xf8e442])[_0xc6e6('0x73')];_0xd34c20[_0xc6e6('0x40')](_0xc6e6('0x74'),_0x3267b4,_0xdc4e64);}else{if(_0x290baf[_0xc6e6('0x38')][_0xf8e442]===_0xc6e6('0x75')){_0xd34c20['where']('i.'+_0xf8e442+_0xc6e6('0x76'));}else{_0xd34c20[_0xc6e6('0x40')]('i.'+_0xf8e442+_0xc6e6('0x77'),_0x290baf[_0xc6e6('0x38')][_0xf8e442]);}}});}if(_0x290baf[_0xc6e6('0x38')][_0xc6e6('0x78')]){if(_0x290baf['query'][_0xc6e6('0x78')]==0x1){_0xd34c20['having'](_0xc6e6('0x79'));}else{_0xd34c20['having']('`unreadMessages`\x20>\x200');}}if(_0x290baf[_0xc6e6('0x38')]['tag']){_0x8095e6=_[_0xc6e6('0x7a')](_0x290baf[_0xc6e6('0x38')][_0xc6e6('0x7b')])?_0x290baf[_0xc6e6('0x38')][_0xc6e6('0x7b')]:new Array(_0x290baf['query'][_0xc6e6('0x7b')]);_0x8095e6['forEach'](function(_0x4bdac6){_0x4f361c['or'](_0xc6e6('0x6b'),'%,'+_0x4bdac6+',%');});}if(_0x290baf[_0xc6e6('0x38')][_0xc6e6('0x7c')]){var _0x5597ce=_0x290baf[_0xc6e6('0x38')]['filter']['replace']('\x5c','\x5c\x5c')[_0xc6e6('0x7d')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xc6e6('0x7e')](_0x5597ce)){_0x470167['or'](_0xc6e6('0x7f'),_0x5597ce+'%')['or'](_0xc6e6('0x80'),_0x5597ce+'%');}else{_0x470167['or'](_0xc6e6('0x81'),qs['getFullTextValue'](_0x5597ce))['or'](_0xc6e6('0x82'),_0x5597ce+'%');}}}_0xd34c20[_0xc6e6('0x40')](_0x470167);_0xd34c20[_0xc6e6('0x83')](_0xc6e6('0x84'));var _0x1ff194={'type':db['Sequelize'][_0xc6e6('0x85')][_0xc6e6('0x86')],'raw':!![]};var _0x16848b=_0xd34c20[_0xc6e6('0x87')]();_0x16848b['field']('i.id');_0x16848b[_0xc6e6('0x44')](_0xc6e6('0x88'),_0xc6e6('0x89'));if(_0x1fff39[_0xc6e6('0x3e')]){_0x1fff39[_0xc6e6('0x3e')][_0xc6e6('0x30')](function(_0x9c0b63){_0xd34c20[_0xc6e6('0x3e')]('i.'+_0x9c0b63[0x0],_0x9c0b63[0x1]===_0xc6e6('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x8095e6)){_0xd34c20['having'](_0x4f361c);_0x16848b[_0xc6e6('0x40')]('t.id\x20IN\x20?',_0x8095e6);}BPromise[_0xc6e6('0x8b')]()[_0xc6e6('0x26')](function(){if(!_0x5566df){if(_0x290baf[_0xc6e6('0x38')]['SmsAccountId']||_0x290baf['query'][_0xc6e6('0x8c')])return;_0x16848b['where'](_0xc6e6('0x8d'));_0xd34c20['where'](_0xc6e6('0x8d'));return;}return _0x290baf[_0xc6e6('0x8e')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xc6e6('0x26')](function(_0x270d27){if(_[_0xc6e6('0x8f')](_0x270d27)){_0x16848b['where'](_0xc6e6('0x90'));_0xd34c20[_0xc6e6('0x40')](_0xc6e6('0x90'));}else{_0x16848b['where'](_0xc6e6('0x6f'),_[_0xc6e6('0x33')](_0x270d27,'id'));_0xd34c20['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x270d27,'id'));}});})[_0xc6e6('0x26')](function(){db[_0xc6e6('0x91')][_0xc6e6('0x38')](_0x16848b[_0xc6e6('0x92')](),_0x1ff194)[_0xc6e6('0x26')](function(_0xcde47f){_0x518d4f['count']=_0xcde47f[_0xc6e6('0x5c')];if(_0x518d4f['count']===0x0)return[];return db[_0xc6e6('0x91')][_0xc6e6('0x38')](_0x3e3da6[_0xc6e6('0x92')](),_0x1ff194)['then'](function(_0x503cdb){_0x5722db=_[_0xc6e6('0x93')](_0x503cdb,'id');_0x1ff194=_[_0xc6e6('0x94')](_0x1ff194,{'model':db[_0xc6e6('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x290baf[_0xc6e6('0x38')][_0xc6e6('0x3c')]){_0x1fff39[_0xc6e6('0x3a')][_0xc6e6('0x30')](function(_0x33bad4){_0xd34c20['field']('i.'+_0x33bad4);});}else{_0xd34c20['field'](_0xc6e6('0x88'),_0xc6e6('0x89'));_0xd34c20[_0xc6e6('0x44')](_0xc6e6('0x95'),_0xc6e6('0x96'));_0xd34c20['field']('a.mandatoryDisposition',_0xc6e6('0x97'));_0xd34c20[_0xc6e6('0x44')]('i.*');_0xd34c20['field'](_0xc6e6('0x98'),_0xc6e6('0x99'));_0xd34c20[_0xc6e6('0x44')](_0xc6e6('0x9a'),'Contact.lastName');_0xd34c20[_0xc6e6('0x44')](_0xc6e6('0x9b'),_0xc6e6('0x9c'));_0xd34c20['field']('c.phone',_0xc6e6('0x9d'));_0xd34c20[_0xc6e6('0x44')]('c.mobile','Contact.mobile');_0xd34c20[_0xc6e6('0x44')](_0xc6e6('0x9e'),_0xc6e6('0x9f'));_0xd34c20['field'](_0xc6e6('0xa0'),_0xc6e6('0xa1'));_0xd34c20[_0xc6e6('0x44')](_0xc6e6('0xa2'),_0xc6e6('0xa3'));_0xd34c20[_0xc6e6('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc6e6('0x2d'));}if(_0x1fff39[_0xc6e6('0x20')])_0xd34c20[_0xc6e6('0x20')](_0x1fff39[_0xc6e6('0x20')]);if(_0x1fff39['offset'])_0xd34c20[_0xc6e6('0x1f')](_0x1fff39[_0xc6e6('0x1f')]);return db[_0xc6e6('0x91')]['query'](_0xd34c20[_0xc6e6('0x92')](),_0x1ff194);})[_0xc6e6('0x26')](function(_0x2eebae){_0x5ab058[_0xc6e6('0x40')](_0xc6e6('0xa4'),_['map'](_0x2eebae,'id'));return db[_0xc6e6('0x91')][_0xc6e6('0x38')](_0x5ab058[_0xc6e6('0x92')](),_0x1ff194)[_0xc6e6('0x26')](function(_0x295d9e){var _0x258072=_['groupBy'](_0x295d9e,_0xc6e6('0xa5'));var _0x4cd2af=[];_0x2eebae[_0xc6e6('0x30')](function(_0xc47330){_0x4cd2af[_0xc6e6('0x31')](updateSmsInteraction(_0xc47330,_0x5722db,_0x258072));});return BPromise[_0xc6e6('0xa6')](_0x4cd2af);});});})[_0xc6e6('0x26')](function(_0x34138a){_0x518d4f[_0xc6e6('0xa7')]=_0x34138a;return _0x518d4f;})[_0xc6e6('0x26')](respondWithFilteredResult(_0x46098f,_0x1fff39));})['catch'](handleError(_0x46098f,null));};exports[_0xc6e6('0xa8')]=function(_0x258d6d,_0x2f802a){var _0x11dbfb={'raw':![],'where':{'id':_0x258d6d[_0xc6e6('0xa9')]['id']}},_0x37d488={};_0x37d488[_0xc6e6('0x37')]=_['keys'](db['SmsInteraction'][_0xc6e6('0x35')]);_0x37d488[_0xc6e6('0x38')]=_['keys'](_0x258d6d[_0xc6e6('0x38')]);_0x37d488[_0xc6e6('0x41')]=_['intersection'](_0x37d488['model'],_0x37d488[_0xc6e6('0x38')]);_0x11dbfb[_0xc6e6('0x3a')]=_['intersection'](_0x37d488['model'],qs[_0xc6e6('0x3c')](_0x258d6d[_0xc6e6('0x38')][_0xc6e6('0x3c')]));_0x11dbfb['attributes']=_0x11dbfb[_0xc6e6('0x3a')][_0xc6e6('0x5c')]?_0x11dbfb[_0xc6e6('0x3a')]:_0x37d488[_0xc6e6('0x37')];if(_0x258d6d[_0xc6e6('0x38')][_0xc6e6('0xaa')]){_0x11dbfb['include']=[{'all':!![]}];}_0x11dbfb=_['merge']({},_0x11dbfb,_0x258d6d[_0xc6e6('0xab')]);return db[_0xc6e6('0x34')][_0xc6e6('0x5d')](_0x11dbfb)['then'](handleEntityNotFound(_0x2f802a,null))['then'](respondWithResult(_0x2f802a,null))[_0xc6e6('0x32')](handleError(_0x2f802a,null));};exports[_0xc6e6('0xac')]=function(_0x4078e1,_0x2d9ae3){return db[_0xc6e6('0x34')][_0xc6e6('0xac')](_0x4078e1[_0xc6e6('0xad')],{})[_0xc6e6('0x26')](respondWithResult(_0x2d9ae3,0xc9))[_0xc6e6('0x32')](handleError(_0x2d9ae3,null));};exports[_0xc6e6('0x25')]=function(_0x3558eb,_0x5bc665){if(_0x3558eb['body']['id']){delete _0x3558eb['body']['id'];}return db[_0xc6e6('0x34')]['find']({'where':{'id':_0x3558eb['params']['id']}})[_0xc6e6('0x26')](handleEntityNotFound(_0x5bc665,null))[_0xc6e6('0x26')](saveUpdates(_0x3558eb['body'],null))['then'](respondWithResult(_0x5bc665,null))[_0xc6e6('0x32')](handleError(_0x5bc665,null));};exports[_0xc6e6('0xae')]=function(_0x1d32b4,_0x5f1f6f){return db[_0xc6e6('0x34')][_0xc6e6('0x5d')]({'where':{'id':_0x1d32b4['params']['id']}})['then'](handleEntityNotFound(_0x5f1f6f,null))[_0xc6e6('0x26')](removeEntity(_0x5f1f6f,null))[_0xc6e6('0x32')](handleError(_0x5f1f6f,null));};exports[_0xc6e6('0xaf')]=function(_0x277b18,_0x16334f){return db['SmsInteraction']['describe']()[_0xc6e6('0x26')](respondWithResult(_0x16334f,null))[_0xc6e6('0x32')](handleError(_0x16334f,null));};exports['addMessage']=function(_0x4b7005,_0x327ae6,_0x4af1b0){return db[_0xc6e6('0xb0')][_0xc6e6('0x5d')]({'where':{'id':_0x4b7005[_0xc6e6('0xa9')]['id']}})[_0xc6e6('0x26')](handleEntityNotFound(_0x327ae6,null))[_0xc6e6('0x26')](function(_0x551cb7){if(_0x551cb7){return _0x551cb7[_0xc6e6('0xb1')](_0x4b7005['body'][_0xc6e6('0xb2')],_[_0xc6e6('0xb3')](_0x4b7005[_0xc6e6('0xad')],[_0xc6e6('0xb2'),'id'])||{});}})[_0xc6e6('0x26')](respondWithResult(_0x327ae6,null))[_0xc6e6('0x32')](handleError(_0x327ae6,null));};exports[_0xc6e6('0xb4')]=function(_0x3184c9,_0x446748,_0x189aa8){var _0x2e56c4={'raw':![],'where':{}};var _0x574207={};var _0x185faa={'count':0x0,'rows':[]};return db[_0xc6e6('0x34')][_0xc6e6('0xb5')]({'where':{'id':_0x3184c9[_0xc6e6('0xa9')]['id']}})[_0xc6e6('0x26')](handleEntityNotFound(_0x446748,null))[_0xc6e6('0x26')](function(_0x54ae7a){if(_0x54ae7a){_0x574207[_0xc6e6('0x37')]=_[_0xc6e6('0x39')](db[_0xc6e6('0xb0')][_0xc6e6('0x35')]);_0x574207[_0xc6e6('0x38')]=_[_0xc6e6('0x39')](_0x3184c9[_0xc6e6('0x38')]);_0x574207[_0xc6e6('0x41')]=_['intersection'](_0x574207[_0xc6e6('0x37')],_0x574207[_0xc6e6('0x38')]);_0x2e56c4[_0xc6e6('0x3a')]=_[_0xc6e6('0x3b')](_0x574207[_0xc6e6('0x37')],qs[_0xc6e6('0x3c')](_0x3184c9[_0xc6e6('0x38')][_0xc6e6('0x3c')]));_0x2e56c4['attributes']=_0x2e56c4[_0xc6e6('0x3a')][_0xc6e6('0x5c')]?_0x2e56c4['attributes']:_0x574207['model'];if(!_0x3184c9[_0xc6e6('0x38')][_0xc6e6('0xb6')](_0xc6e6('0x3d'))){_0x2e56c4['limit']=qs[_0xc6e6('0x20')](_0x3184c9[_0xc6e6('0x38')][_0xc6e6('0x20')]);_0x2e56c4[_0xc6e6('0x1f')]=qs[_0xc6e6('0x1f')](_0x3184c9[_0xc6e6('0x38')][_0xc6e6('0x1f')]);}_0x2e56c4[_0xc6e6('0x3e')]=qs['sort'](_0x3184c9[_0xc6e6('0x38')][_0xc6e6('0x3f')]);_0x2e56c4[_0xc6e6('0x40')]=qs[_0xc6e6('0x41')](_['pick'](_0x3184c9[_0xc6e6('0x38')],_0x574207[_0xc6e6('0x41')]));_0x2e56c4['where']['SmsInteractionId']=_0x54ae7a['id'];if(_0x3184c9[_0xc6e6('0x38')]['filter']){_0x2e56c4[_0xc6e6('0x40')]=_['merge'](_0x2e56c4[_0xc6e6('0x40')],{'$or':_['map'](_0x2e56c4['attributes'],function(_0x565a58){var _0x3fd0b5={};_0x3fd0b5[_0x565a58]={'$like':'%'+_0x3184c9['query']['filter']+'%'};return _0x3fd0b5;})});}if(_0x3184c9['query'][_0xc6e6('0x72')]){var _0x2e2674=_0x3184c9[_0xc6e6('0x38')]['$gte']['split'](',');var _0x2df128={};_0x2df128[_0x2e2674[0x0]]={'$gte':moment(_0x2e2674[0x1])[_0xc6e6('0xb7')](_0xc6e6('0xb8'))};_0x2e56c4[_0xc6e6('0x40')]=_[_0xc6e6('0x94')](_0x2e56c4[_0xc6e6('0x40')],_0x2df128);}_0x2e56c4=_[_0xc6e6('0x94')]({},_0x2e56c4,_0x3184c9[_0xc6e6('0xab')]);return db[_0xc6e6('0xb0')]['count']({'where':_0x2e56c4[_0xc6e6('0x40')]})[_0xc6e6('0x26')](function(_0x2426fb){_0x185faa[_0xc6e6('0x1e')]=_0x2426fb;if(_0x3184c9[_0xc6e6('0x38')][_0xc6e6('0xaa')]){_0x2e56c4['include']=[{'all':!![]}];}return db['SmsMessage'][_0xc6e6('0xb9')](_0x2e56c4);})[_0xc6e6('0x26')](function(_0x575530){_0x185faa[_0xc6e6('0xa7')]=_0x575530;return _0x185faa;});}})[_0xc6e6('0x26')](respondWithFilteredResult(_0x446748,_0x2e56c4))[_0xc6e6('0x32')](handleError(_0x446748,null));};exports['addTags']=function(_0x2bc2ca,_0x40d5c5,_0x33413c){return db[_0xc6e6('0x34')][_0xc6e6('0x5d')]({'where':{'id':_0x2bc2ca[_0xc6e6('0xa9')]['id']}})['then'](handleEntityNotFound(_0x40d5c5,null))['then'](function(_0x57604a){if(_0x57604a){return _0x57604a['setTags'](_0x2bc2ca[_0xc6e6('0xad')][_0xc6e6('0xb2')],_[_0xc6e6('0xb3')](_0x2bc2ca[_0xc6e6('0xad')],[_0xc6e6('0xb2'),'id'])||{})[_0xc6e6('0xba')](function(){return db[_0xc6e6('0x6a')]['findAll']({'attributes':['id',_0xc6e6('0x29'),_0xc6e6('0x45')],'where':{'id':_0x2bc2ca[_0xc6e6('0xad')]['ids']}});})[_0xc6e6('0x26')](function(_0x2c6de1){socket[_0xc6e6('0xbb')](_0xc6e6('0xbc'),{'id':Number(_0x2bc2ca['params']['id']),'tags':_0x2c6de1||[]});return{'id':Number(_0x2bc2ca[_0xc6e6('0xa9')]['id']),'tags':_0x2c6de1||[]};});}})['then'](respondWithResult(_0x40d5c5,null))[_0xc6e6('0x32')](handleError(_0x40d5c5,null));};exports[_0xc6e6('0xbd')]=function(_0x1d4243,_0x1d9a0f,_0xe1ebb4){return db['SmsInteraction'][_0xc6e6('0x5d')]({'where':{'id':_0x1d4243[_0xc6e6('0xa9')]['id']}})['then'](handleEntityNotFound(_0x1d9a0f,null))[_0xc6e6('0x26')](function(_0x158f59){if(_0x158f59){return _0x158f59['removeTags'](_0x1d4243[_0xc6e6('0x38')][_0xc6e6('0xb2')]);}})['then'](respondWithStatusCode(_0x1d9a0f,null))[_0xc6e6('0x32')](handleError(_0x1d9a0f,null));};exports[_0xc6e6('0xbe')]=function(_0x44b734,_0x129552){var _0xd4d55=moment()[_0xc6e6('0xbf')]()[_0xc6e6('0x92')]();var _0x441323=path[_0xc6e6('0xc0')](config[_0xc6e6('0xc1')],_0xc6e6('0xc2'),_0xc6e6('0xc3'),_0xc6e6('0xc4'));var _0x1cdf9d=path[_0xc6e6('0xc0')](config[_0xc6e6('0xc1')],_0xc6e6('0xc2'),_0xc6e6('0xc3'),_0xc6e6('0xc5'));var _0x3aad3a=path[_0xc6e6('0xc0')](_0x441323,_0xd4d55);var _0x128fbd=util[_0xc6e6('0xb7')]('transcript-%d-%s.zip',_0x44b734[_0xc6e6('0xa9')]['id'],_0xd4d55);var _0x390088=path[_0xc6e6('0xc0')](_0x441323,_0x128fbd);var _0x160425=[];_0x160425['push']({'model':db['User'],'as':_0xc6e6('0xc6'),'attributes':['id',_0xc6e6('0x2c')],'raw':!![]});_0x160425[_0xc6e6('0x31')]({'model':db[_0xc6e6('0xc7')],'as':_0xc6e6('0x62'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x41cb97=[{'model':db[_0xc6e6('0xb0')],'as':_0xc6e6('0xc8'),'attributes':['id',_0xc6e6('0xad'),_0xc6e6('0xc9'),_0xc6e6('0xca'),_0xc6e6('0xcb'),'read'],'include':_0x160425}];_0x41cb97[_0xc6e6('0x31')]({'model':db[_0xc6e6('0xcc')],'as':_0xc6e6('0xcd'),'attributes':['id','name']});_0x41cb97[_0xc6e6('0x31')]({'model':db[_0xc6e6('0xc6')],'as':_0xc6e6('0xce'),'attributes':['id',_0xc6e6('0x2c')]});return db['SmsInteraction'][_0xc6e6('0x5d')]({'where':{'id':_0x44b734['params']['id']},'include':_0x41cb97})[_0xc6e6('0x26')](handleEntityNotFound(_0x129552,null))[_0xc6e6('0x26')](function(_0x514f65){if(_0x514f65){var _0x5e598a=_0x514f65[_0xc6e6('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x3aad3a);var _0x216676={'format':'A4','border':_0xc6e6('0xd0'),'header':{'height':_0xc6e6('0xd1'),'contents':{'first':_0xc6e6('0xd2')}},'footer':{'height':_0xc6e6('0xd3'),'contents':{'default':util[_0xc6e6('0xb7')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0xc6e6('0xd4'),_0xc6e6('0xd5'),_0x5e598a['id']),moment()[_0xc6e6('0xb7')](_0xc6e6('0xd6'))[_0xc6e6('0x92')]())}}};var _0x32979a={'channel':_0xc6e6('0xd5'),'account':_0x5e598a[_0xc6e6('0xcd')][_0xc6e6('0x29')],'agent':_0x5e598a[_0xc6e6('0xce')]?_0x5e598a['Owner'][_0xc6e6('0x2c')]:'N.A.','createdAt':moment(_0x5e598a[_0xc6e6('0xc9')])[_0xc6e6('0xb7')](_0xc6e6('0xb8'))[_0xc6e6('0x92')](),'closedAt':_0x5e598a[_0xc6e6('0xd7')]?moment(_0x5e598a[_0xc6e6('0xd8')])[_0xc6e6('0xb7')](_0xc6e6('0xb8'))[_0xc6e6('0x92')]():'','disposition':_0x5e598a[_0xc6e6('0xd9')],'messages':_(_0x5e598a[_0xc6e6('0xc8')])[_0xc6e6('0x7c')]({'secret':![]})[_0xc6e6('0x33')](function(_0x3f9a81){return{'date':moment(_0x3f9a81[_0xc6e6('0xc9')])[_0xc6e6('0xb7')](_0xc6e6('0xb8'))[_0xc6e6('0x92')](),'sender':_0x3f9a81[_0xc6e6('0xca')]===_0xc6e6('0xda')?_0x3f9a81[_0xc6e6('0xc6')]?_0x3f9a81[_0xc6e6('0xc6')][_0xc6e6('0x2c')]:_0xc6e6('0xdb'):_0x3f9a81[_0xc6e6('0x62')][_0xc6e6('0xdc')]+(_0x3f9a81['Contact']['lastName']?'\x20'+_0x3f9a81['Contact'][_0xc6e6('0xdd')]:''),'body':_0x3f9a81[_0xc6e6('0xad')],'direction':_0x3f9a81[_0xc6e6('0xca')]===_0xc6e6('0xda')?'A':'C','secret':_0x3f9a81[_0xc6e6('0xcb')],'read':_0x3f9a81[_0xc6e6('0x78')]};})[_0xc6e6('0x5e')]()};return ejs[_0xc6e6('0xde')](path[_0xc6e6('0xc0')](config[_0xc6e6('0xc1')],'server','views',_0xc6e6('0xdf')),{'interaction':_0x32979a})[_0xc6e6('0x26')](function(_0x21ca1d){return new BPromise(function(_0x31534b,_0x80594e){pdf['create'](_0x21ca1d,_0x216676)[_0xc6e6('0xe0')](path['join'](_0x3aad3a,'transcript-'+_0x5e598a['id']+'-'+_0xd4d55+'.pdf'),function(_0x2746d8,_0xf82e99){if(_0x2746d8)return _0x80594e(_0x2746d8);_0x31534b(_0xf82e99);});});})[_0xc6e6('0x26')](function(){return new BPromise(function(_0xdd6d72,_0x3b2f45){zipdir(_0x3aad3a,{'saveTo':_0x390088},function(_0x240b0e,_0x3a5228){if(_0x240b0e)return _0x3b2f45(_0x240b0e);return _0xdd6d72(_0x3a5228);});})[_0xc6e6('0x26')](function(){return new BPromise(function(_0x3c8c8d,_0x55f519){rimraf(_0x3aad3a,function(_0x18394e){if(_0x18394e)_0x55f519(_0x18394e);return _0x3c8c8d();});});})[_0xc6e6('0x26')](function(){return _0x129552[_0xc6e6('0xbe')](_0x390088,_0x128fbd,function(_0x5c07ad){if(_0x5c07ad){console[_0xc6e6('0xe1')](_0xc6e6('0xe2'),_0x5c07ad);}else{fs['unlinkSync'](_0x390088);}});});});}else{return _0x129552[_0xc6e6('0x1a')](0xc8);}})[_0xc6e6('0x32')](handleError(_0x129552,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9bee3f7..b78e926 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 _0x7579=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll'];(function(_0x16142a,_0x4221bb){var _0x56782f=function(_0x5b9a29){while(--_0x5b9a29){_0x16142a['push'](_0x16142a['shift']());}};_0x56782f(++_0x4221bb);}(_0x7579,0x1e2));var _0x9757=function(_0x19bc8f,_0xb4e729){_0x19bc8f=_0x19bc8f-0x0;var _0x73c724=_0x7579[_0x19bc8f];return _0x73c724;};'use strict';var EventEmitter=require(_0x9757('0x0'));var SmsInteraction=require(_0x9757('0x1'))['db'][_0x9757('0x2')];var SmsMessage=require(_0x9757('0x1'))['db'][_0x9757('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9757('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9757('0x5'),'afterDestroy':_0x9757('0x6')};function emitEvent(_0xcffaa0){return function(_0x213a7a,_0x4c1a67,_0x2aede4){_0x213a7a[_0x9757('0x7')]({'attributes':['id'],'raw':!![]})[_0x9757('0x8')](function(_0x4b5446){_0x213a7a[_0x9757('0x9')]('Users',_0x4b5446[_0x9757('0xa')](function(_0x2f9867){return{'id':_0x2f9867['id']};}));return SmsMessage[_0x9757('0xb')]({'where':{'SmsInteractionId':_0x213a7a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x375d91){_0x213a7a[_0x9757('0x9')](_0x9757('0xc'),_0x375d91[_0x9757('0xd')]);SmsInteractionEvents[_0x9757('0xe')](_0xcffaa0+':'+_0x213a7a['id'],_0x213a7a);SmsInteractionEvents[_0x9757('0xe')](_0xcffaa0,_0x213a7a);_0x2aede4(null);})[_0x9757('0xf')](_0x2aede4(null));};}for(var e in events){if(events[_0x9757('0x10')](e)){var event=events[e];SmsInteraction[_0x9757('0x11')](e,emitEvent(event));}}module[_0x9757('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x723e=['hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','length','emit'];(function(_0x2687b6,_0x1d2d87){var _0x174fe4=function(_0x4d4d2c){while(--_0x4d4d2c){_0x2687b6['push'](_0x2687b6['shift']());}};_0x174fe4(++_0x1d2d87);}(_0x723e,0x179));var _0xe723=function(_0xdd74bb,_0x49e2b8){_0xdd74bb=_0xdd74bb-0x0;var _0x4d8939=_0x723e[_0xdd74bb];return _0x4d8939;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xe723('0x0'))['db'][_0xe723('0x1')];var SmsMessage=require(_0xe723('0x0'))['db'][_0xe723('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe723('0x3')](0x0);var events={'afterCreate':_0xe723('0x4'),'afterUpdate':_0xe723('0x5'),'afterDestroy':_0xe723('0x6')};function emitEvent(_0x8f78b2){return function(_0x10aa61,_0x4b1c43,_0x32d689){_0x10aa61[_0xe723('0x7')]({'attributes':['id'],'raw':!![]})[_0xe723('0x8')](function(_0x3bf082){_0x10aa61[_0xe723('0x9')](_0xe723('0xa'),_0x3bf082[_0xe723('0xb')](function(_0x1f07f3){return{'id':_0x1f07f3['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x10aa61['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe723('0x8')](function(_0x270346){_0x10aa61[_0xe723('0x9')]('unreadMessages',_0x270346[_0xe723('0xc')]);SmsInteractionEvents[_0xe723('0xd')](_0x8f78b2+':'+_0x10aa61['id'],_0x10aa61);SmsInteractionEvents[_0xe723('0xd')](_0x8f78b2,_0x10aa61);_0x32d689(null);})['catch'](_0x32d689(null));};}for(var e in events){if(events[_0xe723('0xe')](e)){var event=events[e];SmsInteraction[_0xe723('0xf')](e,emitEvent(event));}}module[_0xe723('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 1042500..2d8717b 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 _0x3e5a=['util','../../config/logger','moment','bluebird','path','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x3e5a,0x179));var _0xa3e5=function(_0x45708b,_0x401c8a){_0x45708b=_0x45708b-0x0;var _0x44e401=_0x3e5a[_0x45708b];return _0x44e401;};'use strict';var _=require('lodash');var util=require(_0xa3e5('0x0'));var logger=require(_0xa3e5('0x1'))('api');var moment=require(_0xa3e5('0x2'));var BPromise=require(_0xa3e5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3e5('0x4'));var rimraf=require('rimraf');var config=require(_0xa3e5('0x5'));var attributes=require(_0xa3e5('0x6'));module[_0xa3e5('0x7')]=function(_0x32f3fd,_0x35ea07){return _0x32f3fd[_0xa3e5('0x8')]('SmsInteraction',attributes,{'tableName':_0xa3e5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ba638,_0x5d6df8,_0x4bef66){if(_0x5ba638['changed'](_0xa3e5('0xa'))){_0x5ba638['closedAt']=moment()[_0xa3e5('0xb')](_0xa3e5('0xc'));}_0x4bef66(null,_0x5ba638);}}});}; \ No newline at end of file +var _0x7d01=['path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closedAt','format','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7d01,0x8a));var _0x17d0=function(_0x2da710,_0x1aba54){_0x2da710=_0x2da710-0x0;var _0xb0ed1e=_0x7d01[_0x2da710];return _0xb0ed1e;};'use strict';var _=require(_0x17d0('0x0'));var util=require(_0x17d0('0x1'));var logger=require(_0x17d0('0x2'))('api');var moment=require(_0x17d0('0x3'));var BPromise=require(_0x17d0('0x4'));var rp=require(_0x17d0('0x5'));var fs=require('fs');var path=require(_0x17d0('0x6'));var rimraf=require(_0x17d0('0x7'));var config=require(_0x17d0('0x8'));var attributes=require(_0x17d0('0x9'));module[_0x17d0('0xa')]=function(_0x53a86f,_0x55009a){return _0x53a86f[_0x17d0('0xb')]('SmsInteraction',attributes,{'tableName':_0x17d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2706c2,_0x1c8ddb,_0x319b01){if(_0x2706c2[_0x17d0('0xd')]('closed')){_0x2706c2[_0x17d0('0xe')]=moment()[_0x17d0('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x319b01(null,_0x2706c2);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index e8959fa..14d885b 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 _0x6122=['register','request','then','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','message','error','info','catch','SmsInteraction','body','options','raw','attributes','UpdateSmsInteraction','debug','stringify','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket'];(function(_0x6107b9,_0x46dca8){var _0x32364d=function(_0x3649f0){while(--_0x3649f0){_0x6107b9['push'](_0x6107b9['shift']());}};_0x32364d(++_0x46dca8);}(_0x6122,0x162));var _0x2612=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x6122[_0x3ccdf8];return _0x243dab;};'use strict';var _=require(_0x2612('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2612('0x1'));var rs=require(_0x2612('0x2'));var fs=require('fs');var Redis=require(_0x2612('0x3'));var db=require(_0x2612('0x4'))['db'];var utils=require(_0x2612('0x5'));var logger=require(_0x2612('0x6'))(_0x2612('0x7'));var config=require(_0x2612('0x8'));var jayson=require(_0x2612('0x9'));var client=jayson['client'][_0x2612('0xa')]({'port':0x232a});config[_0x2612('0xb')]=_['defaults'](config[_0x2612('0xb')],{'host':_0x2612('0xc'),'port':0x18eb});var socket=require(_0x2612('0xd'))(new Redis(config[_0x2612('0xb')]));require(_0x2612('0xe'))[_0x2612('0xf')](socket);function respondWithRpcPromise(_0x363c69,_0x17c3fe,_0x1e47b4){return new BPromise(function(_0x362d6f,_0x20b75a){return client[_0x2612('0x10')](_0x363c69,_0x1e47b4)[_0x2612('0x11')](function(_0x9d0b3f){logger['info'](_0x2612('0x12'),_0x17c3fe,'request\x20sent');logger['debug'](_0x2612('0x13'),_0x17c3fe,_0x2612('0x14'),JSON['stringify'](_0x9d0b3f));if(_0x9d0b3f['error']){if(_0x9d0b3f['error']['code']===0x1f4){logger['error'](_0x2612('0x12'),_0x17c3fe,_0x9d0b3f['error']['message']);return _0x20b75a(_0x9d0b3f['error'][_0x2612('0x15')]);}logger['error'](_0x2612('0x12'),_0x17c3fe,_0x9d0b3f[_0x2612('0x16')][_0x2612('0x15')]);return _0x362d6f(_0x9d0b3f[_0x2612('0x16')][_0x2612('0x15')]);}else{logger[_0x2612('0x17')](_0x2612('0x12'),_0x17c3fe,_0x2612('0x14'));_0x362d6f(_0x9d0b3f['result']['message']);}})[_0x2612('0x18')](function(_0x1077c9){logger[_0x2612('0x16')](_0x2612('0x12'),_0x17c3fe,_0x1077c9);_0x20b75a(_0x1077c9);});});}exports['UpdateSmsInteraction']=function(_0x316b2d){var _0x18ff89=this;return new Promise(function(_0x42f58e,_0x5bd68d){return db[_0x2612('0x19')]['update'](_0x316b2d[_0x2612('0x1a')],{'raw':_0x316b2d[_0x2612('0x1b')]?_0x316b2d[_0x2612('0x1b')][_0x2612('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316b2d[_0x2612('0x1b')]?_0x316b2d[_0x2612('0x1b')]['where']||null:null,'attributes':_0x316b2d[_0x2612('0x1b')]?_0x316b2d[_0x2612('0x1b')][_0x2612('0x1d')]||null:null,'limit':_0x316b2d[_0x2612('0x1b')]?_0x316b2d[_0x2612('0x1b')]['limit']||null:null})['then'](function(_0x2d9d0d){logger[_0x2612('0x17')](_0x2612('0x1e'),_0x316b2d);logger[_0x2612('0x1f')](_0x2612('0x1e'),_0x316b2d,JSON[_0x2612('0x20')](_0x2d9d0d));_0x42f58e(_0x2d9d0d);})[_0x2612('0x18')](function(_0x39e431){logger[_0x2612('0x16')](_0x2612('0x1e'),_0x39e431[_0x2612('0x15')],_0x316b2d);_0x5bd68d(_0x18ff89[_0x2612('0x16')](0x1f4,_0x39e431['message']));});});};exports[_0x2612('0x21')]=function(_0x855b24){return new Promise(function(_0x49199c,_0x23e606){return db[_0x2612('0x19')][_0x2612('0x22')]({'where':_0x855b24[_0x2612('0x1b')]?_0x855b24[_0x2612('0x1b')][_0x2612('0x23')]||null:null})['then'](function(_0x48fb6b){if(_0x48fb6b){return _0x48fb6b[_0x2612('0x24')](_0x855b24[_0x2612('0x1a')][_0x2612('0x25')],_[_0x2612('0x26')](_0x855b24['body'],[_0x2612('0x25'),'id'])||{});}})[_0x2612('0x27')](function(_0x3e3911){logger[_0x2612('0x17')]('AddTags',_0x855b24);logger['debug'](_0x2612('0x28'),_0x855b24,JSON[_0x2612('0x20')](_0x3e3911));_0x49199c(_0x3e3911);})[_0x2612('0x18')](function(_0x4d82ec){logger['error'](_0x2612('0x28'),_0x4d82ec['message'],_0x855b24);_0x23e606(_this[_0x2612('0x16')](0x1f4,_0x4d82ec[_0x2612('0x15')]));});});}; \ No newline at end of file +var _0x1746=['raw','attributes','UpdateSmsInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','SmsInteraction','update','body','options'];(function(_0x4a90ec,_0x43cbb5){var _0x48b522=function(_0x2a9071){while(--_0x2a9071){_0x4a90ec['push'](_0x4a90ec['shift']());}};_0x48b522(++_0x43cbb5);}(_0x1746,0x1ab));var _0x6174=function(_0x6e398a,_0x50a2b7){_0x6e398a=_0x6e398a-0x0;var _0x127a36=_0x1746[_0x6e398a];return _0x127a36;};'use strict';var _=require(_0x6174('0x0'));var util=require(_0x6174('0x1'));var moment=require(_0x6174('0x2'));var BPromise=require(_0x6174('0x3'));var rs=require(_0x6174('0x4'));var fs=require('fs');var Redis=require(_0x6174('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6174('0x6'));var config=require(_0x6174('0x7'));var jayson=require(_0x6174('0x8'));var client=jayson['client'][_0x6174('0x9')]({'port':0x232a});config[_0x6174('0xa')]=_[_0x6174('0xb')](config[_0x6174('0xa')],{'host':_0x6174('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6174('0xa')]));require('./smsInteraction.socket')[_0x6174('0xd')](socket);function respondWithRpcPromise(_0x33ccdd,_0x1767dd,_0x3f506c){return new BPromise(function(_0x2ed8c2,_0x560913){return client[_0x6174('0xe')](_0x33ccdd,_0x3f506c)[_0x6174('0xf')](function(_0x434e72){logger['info'](_0x6174('0x10'),_0x1767dd,_0x6174('0x11'));logger[_0x6174('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x1767dd,_0x6174('0x11'),JSON[_0x6174('0x13')](_0x434e72));if(_0x434e72[_0x6174('0x14')]){if(_0x434e72['error'][_0x6174('0x15')]===0x1f4){logger['error'](_0x6174('0x10'),_0x1767dd,_0x434e72['error'][_0x6174('0x16')]);return _0x560913(_0x434e72[_0x6174('0x14')][_0x6174('0x16')]);}logger[_0x6174('0x14')](_0x6174('0x10'),_0x1767dd,_0x434e72[_0x6174('0x14')][_0x6174('0x16')]);return _0x2ed8c2(_0x434e72[_0x6174('0x14')][_0x6174('0x16')]);}else{logger[_0x6174('0x17')](_0x6174('0x10'),_0x1767dd,_0x6174('0x11'));_0x2ed8c2(_0x434e72['result']['message']);}})[_0x6174('0x18')](function(_0x1e4f7b){logger[_0x6174('0x14')](_0x6174('0x10'),_0x1767dd,_0x1e4f7b);_0x560913(_0x1e4f7b);});});}exports['UpdateSmsInteraction']=function(_0x3c049c){var _0x46ddd9=this;return new Promise(function(_0x4eedb6,_0x26dfcb){return db[_0x6174('0x19')][_0x6174('0x1a')](_0x3c049c[_0x6174('0x1b')],{'raw':_0x3c049c[_0x6174('0x1c')]?_0x3c049c[_0x6174('0x1c')][_0x6174('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c049c[_0x6174('0x1c')]?_0x3c049c[_0x6174('0x1c')]['where']||null:null,'attributes':_0x3c049c[_0x6174('0x1c')]?_0x3c049c[_0x6174('0x1c')][_0x6174('0x1e')]||null:null,'limit':_0x3c049c[_0x6174('0x1c')]?_0x3c049c['options']['limit']||null:null})[_0x6174('0xf')](function(_0x50c648){logger[_0x6174('0x17')](_0x6174('0x1f'),_0x3c049c);logger[_0x6174('0x12')](_0x6174('0x1f'),_0x3c049c,JSON[_0x6174('0x13')](_0x50c648));_0x4eedb6(_0x50c648);})[_0x6174('0x18')](function(_0x1ee982){logger[_0x6174('0x14')](_0x6174('0x1f'),_0x1ee982[_0x6174('0x16')],_0x3c049c);_0x26dfcb(_0x46ddd9['error'](0x1f4,_0x1ee982[_0x6174('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x26416d){return new Promise(function(_0x321b0b,_0x55ed5f){return db[_0x6174('0x19')][_0x6174('0x20')]({'where':_0x26416d[_0x6174('0x1c')]?_0x26416d['options'][_0x6174('0x21')]||null:null})[_0x6174('0xf')](function(_0x33ab96){if(_0x33ab96){return _0x33ab96[_0x6174('0x22')](_0x26416d[_0x6174('0x1b')][_0x6174('0x23')],_[_0x6174('0x24')](_0x26416d[_0x6174('0x1b')],[_0x6174('0x23'),'id'])||{});}})['spread'](function(_0x38cd95){logger[_0x6174('0x17')](_0x6174('0x25'),_0x26416d);logger['debug']('AddTags',_0x26416d,JSON['stringify'](_0x38cd95));_0x321b0b(_0x38cd95);})[_0x6174('0x18')](function(_0x437841){logger['error'](_0x6174('0x25'),_0x437841['message'],_0x26416d);_0x55ed5f(_this[_0x6174('0x14')](0x1f4,_0x437841[_0x6174('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b531b2b..2537a64 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 _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0xb10b,0x12a));var _0xbb10=function(_0xf53937,_0x2bf512){_0xf53937=_0xf53937-0x0;var _0x33b67b=_0xb10b[_0xf53937];return _0x33b67b;};'use strict';var SmsInteractionEvents=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(){SmsInteractionEvents[_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);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x281905,_0x2e6b33){var _0x1f0247=function(_0x530c9b){while(--_0x530c9b){_0x281905['push'](_0x281905['shift']());}};_0x1f0247(++_0x2e6b33);}(_0x757a,0xde));var _0xa757=function(_0x46dbcc,_0x485069){_0x46dbcc=_0x46dbcc-0x0;var _0x3835cf=_0x757a[_0x46dbcc];return _0x3835cf;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 8e89550..4646bed 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 _0x64ea=['describe','post','tracked','sms','smsmessage:create','create','/:id','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x64ea,0x1c8));var _0xa64e=function(_0x335ef5,_0x1a74a9){_0x335ef5=_0x335ef5-0x0;var _0xc51af9=_0x64ea[_0x335ef5];return _0xc51af9;};'use strict';var multer=require(_0xa64e('0x0'));var util=require(_0xa64e('0x1'));var path=require('path');var timeout=require(_0xa64e('0x2'));var express=require(_0xa64e('0x3'));var router=express[_0xa64e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa64e('0x5'));var config=require(_0xa64e('0x6'));var controller=require(_0xa64e('0x7'));router[_0xa64e('0x8')]('/',auth[_0xa64e('0x9')](),controller[_0xa64e('0xa')]);router['get'](_0xa64e('0xb'),auth[_0xa64e('0x9')](),controller[_0xa64e('0xc')]);router[_0xa64e('0x8')]('/:id',auth[_0xa64e('0x9')](),controller['show']);router[_0xa64e('0xd')]('/',auth[_0xa64e('0x9')](),interaction[_0xa64e('0xe')](_0xa64e('0xf'),_0xa64e('0x10')),controller[_0xa64e('0x11')]);router[_0xa64e('0xd')]('/:id/status',controller['status']);router['put'](_0xa64e('0x12'),auth[_0xa64e('0x9')](),controller['update']);router[_0xa64e('0x13')](_0xa64e('0x14'),auth[_0xa64e('0x9')](),controller[_0xa64e('0x15')]);router[_0xa64e('0x13')]('/:id/reject',auth[_0xa64e('0x9')](),controller[_0xa64e('0x16')]);router[_0xa64e('0x17')](_0xa64e('0x12'),auth[_0xa64e('0x9')](),controller[_0xa64e('0x18')]);module[_0xa64e('0x19')]=router; \ No newline at end of file +var _0x8c80=['create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','sms','smsmessage:create'];(function(_0xbc87fc,_0xffc8c5){var _0x19fd2f=function(_0x4a22a3){while(--_0x4a22a3){_0xbc87fc['push'](_0xbc87fc['shift']());}};_0x19fd2f(++_0xffc8c5);}(_0x8c80,0x97));var _0x08c8=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x8c80[_0x2b9cf5];return _0xd0cf15;};'use strict';var multer=require(_0x08c8('0x0'));var util=require('util');var path=require(_0x08c8('0x1'));var timeout=require(_0x08c8('0x2'));var express=require(_0x08c8('0x3'));var router=express['Router']();var auth=require(_0x08c8('0x4'));var interaction=require(_0x08c8('0x5'));var config=require(_0x08c8('0x6'));var controller=require(_0x08c8('0x7'));router[_0x08c8('0x8')]('/',auth[_0x08c8('0x9')](),controller[_0x08c8('0xa')]);router[_0x08c8('0x8')](_0x08c8('0xb'),auth[_0x08c8('0x9')](),controller[_0x08c8('0xc')]);router[_0x08c8('0x8')](_0x08c8('0xd'),auth['isAuthenticated'](),controller[_0x08c8('0xe')]);router['post']('/',auth[_0x08c8('0x9')](),interaction['tracked'](_0x08c8('0xf'),_0x08c8('0x10')),controller[_0x08c8('0x11')]);router['post'](_0x08c8('0x12'),controller[_0x08c8('0x13')]);router[_0x08c8('0x14')](_0x08c8('0xd'),auth['isAuthenticated'](),controller[_0x08c8('0x15')]);router['put'](_0x08c8('0x16'),auth['isAuthenticated'](),controller[_0x08c8('0x17')]);router[_0x08c8('0x14')](_0x08c8('0x18'),auth[_0x08c8('0x9')](),controller[_0x08c8('0x19')]);router[_0x08c8('0x1a')](_0x08c8('0xd'),auth[_0x08c8('0x9')](),controller[_0x08c8('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e32ec27..4efd311 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 _0x3f38=['ENUM','out','STRING','DATE','sequelize','exports','medium','BOOLEAN'];(function(_0xa736fd,_0x3804de){var _0x241a9a=function(_0x399d86){while(--_0x399d86){_0xa736fd['push'](_0xa736fd['shift']());}};_0x241a9a(++_0x3804de);}(_0x3f38,0x1e4));var _0x83f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3f38[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x83f3('0x0'));module[_0x83f3('0x1')]={'body':{'type':Sequelize['TEXT'](_0x83f3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x83f3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x83f3('0x4')]('in',_0x83f3('0x5')),'defaultValue':_0x83f3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x83f3('0x6')](0xbe)},'phone':{'type':Sequelize[_0x83f3('0x6')]},'readAt':{'type':Sequelize[_0x83f3('0x7')]},'secret':{'type':Sequelize[_0x83f3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9792=['BOOLEAN','ENUM','out','STRING','sequelize','TEXT','medium'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9792,0x9e));var _0x2979=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9792[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x2979('0x0'));module['exports']={'body':{'type':Sequelize[_0x2979('0x1')](_0x2979('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2979('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2979('0x4')]('in',_0x2979('0x5')),'defaultValue':_0x2979('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2979('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x2979('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 335e0ad..3c38c80 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 _0x5c00=['client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','params','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','SmsInteractionId','isNil','interaction','stringify','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','get','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','inspect','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','DELIVERED','infobip','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0x5c00,0x17e));var _0x05c0=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x5c00[_0x54b283];return _0x2462b3;};'use strict';var pdf=require(_0x05c0('0x0'));var emlformat=require(_0x05c0('0x1'));var rimraf=require(_0x05c0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05c0('0x3'));var rp=require('request-promise');var moment=require(_0x05c0('0x4'));var BPromise=require(_0x05c0('0x5'));var Mustache=require(_0x05c0('0x6'));var util=require(_0x05c0('0x7'));var path=require('path');var sox=require(_0x05c0('0x8'));var csv=require(_0x05c0('0x9'));var ejs=require(_0x05c0('0xa'));var fs=require('fs');var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var db=require(_0x05c0('0x17'))['db'];config[_0x05c0('0x18')]=_['defaults'](config[_0x05c0('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x05c0('0x19'))(new Redis(config[_0x05c0('0x18')]));require(_0x05c0('0x1a'))[_0x05c0('0x1b')](socket);var jayson=require(_0x05c0('0x1c'));var client=jayson[_0x05c0('0x1d')][_0x05c0('0x1e')]({'port':0x232c});var client9002=jayson[_0x05c0('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x238e25,_0x161a5f,_0x4bb164){if(_0x4bb164){var _0x29e6b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29e6b0[_0x05c0('0x1f')](_0x161a5f)){return _0x238e25;}else{throw new db[(_0x05c0('0x20'))][(_0x05c0('0x21'))](_0x05c0('0x22'));}}else{return _0x238e25;}}function respondWithRpcPromise(_0x38f994,_0x521cbd,_0x422401,_0x1230e5){return new BPromise(function(_0x4613c0,_0x54fef0){var _0x40d905=_0x1230e5||client;return _0x40d905[_0x05c0('0x23')](_0x38f994,_0x422401)[_0x05c0('0x24')](function(_0x23164c){logger[_0x05c0('0x25')]('SmsMessage,\x20%s,\x20%s',_0x521cbd,_0x05c0('0x26'));logger[_0x05c0('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x521cbd,'request\x20sent',JSON['stringify'](_0x23164c));if(_0x23164c[_0x05c0('0x28')]){if(_0x23164c[_0x05c0('0x28')][_0x05c0('0x29')]===0x1f4){logger[_0x05c0('0x28')](_0x05c0('0x2a'),_0x521cbd,_0x23164c[_0x05c0('0x28')][_0x05c0('0x2b')]);return _0x54fef0(_0x23164c['error'][_0x05c0('0x2b')]);}logger[_0x05c0('0x28')]('SmsMessage,\x20%s,\x20%s',_0x521cbd,_0x23164c['error']['message']);return _0x4613c0(_0x23164c['error']['message']);}else{logger[_0x05c0('0x25')](_0x05c0('0x2a'),_0x521cbd,'request\x20sent');_0x4613c0(_0x23164c[_0x05c0('0x2c')][_0x05c0('0x2b')]);}})[_0x05c0('0x2d')](function(_0x889c75){logger['error'](_0x05c0('0x2a'),_0x521cbd,_0x889c75);_0x54fef0(_0x889c75);});});}function respondWithStatusCode(_0x1c14b1,_0x2ceaed){_0x2ceaed=_0x2ceaed||0xcc;return function(_0x200e80){if(_0x200e80){return _0x1c14b1[_0x05c0('0x2e')](_0x2ceaed);}return _0x1c14b1[_0x05c0('0x2f')](_0x2ceaed)['end']();};}function respondWithResult(_0x56ba64,_0x2df109){_0x2df109=_0x2df109||0xc8;return function(_0xbe7d9e){if(_0xbe7d9e){return _0x56ba64[_0x05c0('0x2f')](_0x2df109)[_0x05c0('0x30')](_0xbe7d9e);}};}function respondWithFilteredResult(_0xd3cef5,_0x1e00c5){return function(_0x1c4c8f){if(_0x1c4c8f){var _0x3c9eb1=_0x1c4c8f[_0x05c0('0x31')],_0x33eff3=_0x1e00c5['offset'],_0x87b07c=_0x1e00c5['offset']+_0x1e00c5[_0x05c0('0x32')],_0x3e38f0;if(_0x87b07c>=_0x3c9eb1){_0x87b07c=_0x3c9eb1;_0x3e38f0=0xc8;}else{_0x3e38f0=0xce;}_0xd3cef5[_0x05c0('0x2f')](_0x3e38f0);return _0xd3cef5[_0x05c0('0x33')]('Content-Range',_0x33eff3+'-'+_0x87b07c+'/'+_0x3c9eb1)[_0x05c0('0x30')](_0x1c4c8f);}return null;};}function patchUpdates(_0x30caf0){return function(_0x4b0ea1){try{jsonpatch[_0x05c0('0x34')](_0x4b0ea1,_0x30caf0,!![]);}catch(_0x4e923d){return BPromise[_0x05c0('0x35')](_0x4e923d);}return _0x4b0ea1[_0x05c0('0x36')]();};}function saveUpdates(_0x400cbe,_0x1d4d33){return function(_0x3d842e){if(_0x3d842e){return _0x3d842e[_0x05c0('0x37')](_0x400cbe)[_0x05c0('0x24')](function(_0x9da3fa){return _0x9da3fa;});}return null;};}function removeEntity(_0x3d8d76,_0x3a72c2){return function(_0x39d783){if(_0x39d783){return _0x39d783[_0x05c0('0x38')]()[_0x05c0('0x24')](function(){_0x3d8d76[_0x05c0('0x2f')](0xcc)[_0x05c0('0x39')]();});}};}function handleEntityNotFound(_0x3382f6,_0x19a19c){return function(_0x21c22){if(!_0x21c22){_0x3382f6[_0x05c0('0x2e')](0x194);}return _0x21c22;};}function handleError(_0x1faa63,_0x3d1bae){_0x3d1bae=_0x3d1bae||0x1f4;return function(_0x337847){logger[_0x05c0('0x28')](_0x337847[_0x05c0('0x3a')]);if(_0x337847[_0x05c0('0x3b')]){delete _0x337847[_0x05c0('0x3b')];}_0x1faa63[_0x05c0('0x2f')](_0x3d1bae)[_0x05c0('0x3c')](_0x337847);};}exports[_0x05c0('0x3d')]=function(_0xf2df25,_0x1f493c){var _0x251d56={},_0x303a29={},_0x5eece1={'count':0x0,'rows':[]};var _0x2a19b4=_[_0x05c0('0x3e')](db[_0x05c0('0x3f')][_0x05c0('0x40')],function(_0x49f829){return{'name':_0x49f829['fieldName'],'type':_0x49f829[_0x05c0('0x41')][_0x05c0('0x42')]};});_0x303a29[_0x05c0('0x43')]=_['map'](_0x2a19b4,_0x05c0('0x3b'));_0x303a29[_0x05c0('0x44')]=_[_0x05c0('0x45')](_0xf2df25[_0x05c0('0x44')]);_0x303a29['filters']=_[_0x05c0('0x46')](_0x303a29[_0x05c0('0x43')],_0x303a29['query']);_0x251d56[_0x05c0('0x47')]=_[_0x05c0('0x46')](_0x303a29[_0x05c0('0x43')],qs[_0x05c0('0x48')](_0xf2df25[_0x05c0('0x44')][_0x05c0('0x48')]));_0x251d56[_0x05c0('0x47')]=_0x251d56['attributes']['length']?_0x251d56[_0x05c0('0x47')]:_0x303a29[_0x05c0('0x43')];if(!_0xf2df25[_0x05c0('0x44')][_0x05c0('0x49')](_0x05c0('0x4a'))){_0x251d56['limit']=qs[_0x05c0('0x32')](_0xf2df25[_0x05c0('0x44')][_0x05c0('0x32')]);_0x251d56[_0x05c0('0x4b')]=qs[_0x05c0('0x4b')](_0xf2df25[_0x05c0('0x44')][_0x05c0('0x4b')]);}_0x251d56['order']=qs[_0x05c0('0x4c')](_0xf2df25[_0x05c0('0x44')][_0x05c0('0x4c')]);_0x251d56[_0x05c0('0x4d')]=qs[_0x05c0('0x4e')](_[_0x05c0('0x4f')](_0xf2df25[_0x05c0('0x44')],_0x303a29[_0x05c0('0x4e')]),_0x2a19b4);if(_0xf2df25[_0x05c0('0x44')][_0x05c0('0x50')]){_0x251d56[_0x05c0('0x4d')]=_['merge'](_0x251d56['where'],{'$or':_[_0x05c0('0x3e')](_0x2a19b4,function(_0x367fc6){if(_0x367fc6[_0x05c0('0x41')]!==_0x05c0('0x51')){var _0x2a1339={};_0x2a1339[_0x367fc6[_0x05c0('0x3b')]]={'$like':'%'+_0xf2df25['query'][_0x05c0('0x50')]+'%'};return _0x2a1339;}})});}_0x251d56=_[_0x05c0('0x52')]({},_0x251d56,_0xf2df25[_0x05c0('0x53')]);var _0x3e1be2={'where':_0x251d56['where']};return db[_0x05c0('0x3f')][_0x05c0('0x31')](_0x3e1be2)[_0x05c0('0x24')](function(_0x640e07){_0x5eece1['count']=_0x640e07;if(_0xf2df25[_0x05c0('0x44')][_0x05c0('0x54')]){_0x251d56[_0x05c0('0x55')]=[{'all':!![]}];}return db[_0x05c0('0x3f')]['findAll'](_0x251d56);})[_0x05c0('0x24')](function(_0x1f403c){_0x5eece1['rows']=_0x1f403c;return _0x5eece1;})[_0x05c0('0x24')](respondWithFilteredResult(_0x1f493c,_0x251d56))['catch'](handleError(_0x1f493c,null));};exports['show']=function(_0x1ea554,_0x5db63a){var _0x10d2d1={'raw':!![],'where':{'id':_0x1ea554[_0x05c0('0x56')]['id']}},_0x31b1cd={};_0x31b1cd[_0x05c0('0x43')]=_[_0x05c0('0x45')](db[_0x05c0('0x3f')]['rawAttributes']);_0x31b1cd[_0x05c0('0x44')]=_['keys'](_0x1ea554[_0x05c0('0x44')]);_0x31b1cd[_0x05c0('0x4e')]=_[_0x05c0('0x46')](_0x31b1cd[_0x05c0('0x43')],_0x31b1cd[_0x05c0('0x44')]);_0x10d2d1[_0x05c0('0x47')]=_[_0x05c0('0x46')](_0x31b1cd['model'],qs['fields'](_0x1ea554['query'][_0x05c0('0x48')]));_0x10d2d1[_0x05c0('0x47')]=_0x10d2d1['attributes']['length']?_0x10d2d1[_0x05c0('0x47')]:_0x31b1cd[_0x05c0('0x43')];if(_0x1ea554[_0x05c0('0x44')][_0x05c0('0x54')]){_0x10d2d1[_0x05c0('0x55')]=[{'all':!![]}];}_0x10d2d1=_[_0x05c0('0x52')]({},_0x10d2d1,_0x1ea554[_0x05c0('0x53')]);return db['SmsMessage'][_0x05c0('0x57')](_0x10d2d1)[_0x05c0('0x24')](handleEntityNotFound(_0x5db63a,null))[_0x05c0('0x24')](respondWithResult(_0x5db63a,null))[_0x05c0('0x2d')](handleError(_0x5db63a,null));};exports['create']=function(_0x1977b5,_0x4c47e5){return db[_0x05c0('0x3f')][_0x05c0('0x58')](_0x1977b5['body'],{})[_0x05c0('0x24')](respondWithResult(_0x4c47e5,0xc9))['catch'](handleError(_0x4c47e5,null));};exports[_0x05c0('0x37')]=function(_0xa0e36f,_0x118975){if(_0xa0e36f[_0x05c0('0x59')]['id']){delete _0xa0e36f[_0x05c0('0x59')]['id'];}return db[_0x05c0('0x3f')]['find']({'where':{'id':_0xa0e36f[_0x05c0('0x56')]['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x118975,null))[_0x05c0('0x24')](saveUpdates(_0xa0e36f[_0x05c0('0x59')],null))[_0x05c0('0x24')](respondWithResult(_0x118975,null))[_0x05c0('0x2d')](handleError(_0x118975,null));};exports['destroy']=function(_0x284650,_0x2dff63){return db[_0x05c0('0x3f')][_0x05c0('0x57')]({'where':{'id':_0x284650[_0x05c0('0x56')]['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x2dff63,null))[_0x05c0('0x24')](removeEntity(_0x2dff63,null))[_0x05c0('0x2d')](handleError(_0x2dff63,null));};exports[_0x05c0('0x5a')]=function(_0x17b803,_0x23cc3e){return db[_0x05c0('0x3f')]['describe']()['then'](respondWithResult(_0x23cc3e,null))['catch'](handleError(_0x23cc3e,null));};var interaction_log=require(_0x05c0('0x5b'))(_0x05c0('0x5c'));exports[_0x05c0('0x5d')]=function(_0x59dcc0,_0x45cda1,_0x20a309){var _0x192461={'channel':_0x05c0('0x5e')};if(_0x59dcc0[_0x05c0('0x59')]['id']){delete _0x59dcc0[_0x05c0('0x59')]['id'];}_0x59dcc0[_0x05c0('0x59')]['read']=!![];_0x59dcc0[_0x05c0('0x59')][_0x05c0('0x5f')]=moment()[_0x05c0('0x60')](_0x05c0('0x61'));_0x59dcc0['body']['UserId']=_0x59dcc0['body'][_0x05c0('0x62')]||_0x59dcc0[_0x05c0('0x63')]['id'];return db[_0x05c0('0x3f')][_0x05c0('0x57')]({'where':{'id':_0x59dcc0[_0x05c0('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x05c0('0x64')],'as':_0x05c0('0x65')}]})['then'](handleEntityNotFound(_0x45cda1,null))[_0x05c0('0x24')](saveUpdates(_0x59dcc0[_0x05c0('0x59')],null))[_0x05c0('0x24')](function(_0x1e39d3){if(_0x1e39d3){_0x192461[_0x05c0('0x2b')]=_0x1e39d3['get']({'plain':!![]});return db['SmsInteraction'][_0x05c0('0x57')]({'where':{'id':_0x1e39d3[_0x05c0('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x45cda1,null))[_0x05c0('0x24')](function(_0x5d0942){if(_0x5d0942){return _0x5d0942['update']({'UserId':_0x59dcc0[_0x05c0('0x59')][_0x05c0('0x62')],'read1stAt':_[_0x05c0('0x67')](_0x5d0942['read1stAt'])?moment()['format'](_0x05c0('0x61')):undefined});}return null;})[_0x05c0('0x24')](function(_0x21c968){if(_0x21c968){_0x192461['interaction']=_0x21c968['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x59dcc0['user']['id'],_0x59dcc0[_0x05c0('0x63')]['name'],_0x59dcc0['user']['role'],_0x192461[_0x05c0('0x68')]['id'],_0x59dcc0[_0x05c0('0x59')]?JSON[_0x05c0('0x69')](_0x59dcc0['body']):_0x05c0('0x6a'));return respondWithRpcPromise(_0x05c0('0x6b'),'acceptMessage',_0x192461);}return null;})[_0x05c0('0x24')](function(_0x1830dc){if(_0x1830dc){if(_0x59dcc0[_0x05c0('0x59')][_0x05c0('0x6c')]){_0x192461['message'][_0x05c0('0x6d')]=util[_0x05c0('0x60')](_0x05c0('0x6e'),_0x59dcc0[_0x05c0('0x63')][_0x05c0('0x3b')]);_0x192461['message']['channel']=_0x192461[_0x05c0('0x6f')];_0x192461['message'][_0x05c0('0x70')]=_0x05c0('0x5d');return respondWithRpcPromise('EventManager',_0x05c0('0x71'),{'event':'acceptmessage','message':_0x192461['message']},client9002)['then'](function(){return _0x192461;});}return _0x192461;}return null;})['then'](respondWithResult(_0x45cda1,null))[_0x05c0('0x2d')](handleError(_0x45cda1,null));};var interaction_log=require(_0x05c0('0x5b'))(_0x05c0('0x5c'));exports[_0x05c0('0x35')]=function(_0x4807e3,_0x2eedc0,_0x1ad855){var _0x37056d={'agent':{},'channel':_0x05c0('0x5e')};if(_0x4807e3[_0x05c0('0x59')]['id']){delete _0x4807e3['body']['id'];}_0x4807e3[_0x05c0('0x59')]['UserId']=_0x4807e3['body'][_0x05c0('0x62')]||_0x4807e3[_0x05c0('0x63')]['id'];_0x37056d[_0x05c0('0x72')]['id']=_0x4807e3[_0x05c0('0x59')][_0x05c0('0x62')];return db[_0x05c0('0x3f')]['find']({'where':{'id':_0x4807e3['params']['id'],'UserId':null}})[_0x05c0('0x24')](handleEntityNotFound(_0x2eedc0,null))[_0x05c0('0x24')](function(_0x3d7613){if(_0x3d7613){_0x37056d['message']=_0x3d7613[_0x05c0('0x73')]({'plain':!![]});return db[_0x05c0('0x74')][_0x05c0('0x57')]({'where':{'id':_0x3d7613[_0x05c0('0x66')]}});}return null;})[_0x05c0('0x24')](handleEntityNotFound(_0x2eedc0,null))[_0x05c0('0x24')](function(_0x5533a1){if(_0x5533a1){_0x37056d[_0x05c0('0x68')]=_0x5533a1[_0x05c0('0x73')]({'plain':!![]});interaction_log['info'](_0x05c0('0x75'),_0x4807e3[_0x05c0('0x63')]['id'],_0x4807e3['user'][_0x05c0('0x3b')],_0x4807e3[_0x05c0('0x63')][_0x05c0('0x76')],_0x37056d[_0x05c0('0x68')]['id'],_0x4807e3[_0x05c0('0x59')]?JSON[_0x05c0('0x69')](_0x4807e3['body']):_0x05c0('0x6a'));return respondWithRpcPromise('RejectMessage',_0x05c0('0x77'),_0x37056d);}return null;})[_0x05c0('0x24')](function(_0x12ddfb){if(_0x12ddfb){_0x12ddfb[_0x05c0('0x2b')][_0x05c0('0x6d')]=util[_0x05c0('0x60')](_0x05c0('0x6e'),_0x4807e3[_0x05c0('0x63')][_0x05c0('0x3b')]);_0x12ddfb[_0x05c0('0x2b')]['channel']=_0x37056d[_0x05c0('0x6f')];_0x12ddfb['message'][_0x05c0('0x70')]='reject';respondWithRpcPromise(_0x05c0('0x71'),_0x05c0('0x71'),{'event':_0x05c0('0x78'),'message':_0x12ddfb[_0x05c0('0x2b')]},client9002);return _0x37056d;}return null;})[_0x05c0('0x24')](respondWithResult(_0x2eedc0,null))[_0x05c0('0x2d')](handleError(_0x2eedc0,null));};exports[_0x05c0('0x2f')]=function(_0x6609de,_0x13be1a,_0x58a205){if(_0x6609de['body']['id']){delete _0x6609de[_0x05c0('0x59')]['id'];}var _0x2a2816;return db[_0x05c0('0x3f')][_0x05c0('0x57')]({'where':{'id':_0x6609de[_0x05c0('0x56')]['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x13be1a,null))[_0x05c0('0x24')](function(_0x50b1bb){if(_0x50b1bb){_0x2a2816=_0x50b1bb;return db[_0x05c0('0x79')]['find']({'where':{'id':_0x50b1bb[_0x05c0('0x7a')]}});}})['then'](handleEntityNotFound(_0x13be1a,null))[_0x05c0('0x24')](function(_0x59069a){if(_0x59069a){logger[_0x05c0('0x27')](_0x05c0('0x7b'),'status',_0x05c0('0x7c'),_0x59069a['type'],util['inspect'](_0x6609de[_0x05c0('0x59')],{'showHidden':![],'depth':null}));switch(_0x59069a[_0x05c0('0x41')]){case _0x05c0('0x7d'):if(_0x6609de[_0x05c0('0x59')][_0x05c0('0x7e')]&&_0x6609de[_0x05c0('0x59')][_0x05c0('0x7e')]===_0x2a2816['messageId']){return _0x2a2816['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x05c0('0x7d'),util[_0x05c0('0x7f')](_0x6609de[_0x05c0('0x59')],{'showHidden':![],'depth':null}));}break;case _0x05c0('0x80'):if(_0x6609de['body'][_0x05c0('0x81')]&&_0x6609de[_0x05c0('0x59')][_0x05c0('0x81')]===_0x2a2816[_0x05c0('0x82')]&&_[_0x05c0('0x83')]([_0x05c0('0x84'),_0x05c0('0x85')],_0x6609de[_0x05c0('0x59')][_0x05c0('0x86')])>=0x0){return _0x2a2816['update']({'read':!![]});}else{logger[_0x05c0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x05c0('0x2f'),'plivio',util[_0x05c0('0x7f')](_0x6609de[_0x05c0('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2273eb=_0x6609de[_0x05c0('0x59')]['results'][0x0];if(_0x2273eb[_0x05c0('0x2f')]['groupName']===_0x05c0('0x87')){return _0x2a2816[_0x05c0('0x37')]({'read':!![]});}else{logger[_0x05c0('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x05c0('0x88'),util[_0x05c0('0x7f')](_0x6609de[_0x05c0('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2a2816;}})[_0x05c0('0x24')](respondWithResult(_0x13be1a,null))[_0x05c0('0x2d')](handleError(_0x13be1a,null));}; \ No newline at end of file +var _0xb9be=['intersection','includeAll','find','create','body','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','SmsInteraction','isNil','format','interaction','get','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','acceptmessage','../../config/logger','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','./smsMessage.socket','register','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','name','send','index','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SmsMessage','count','include','findAll','rows','show','params','rawAttributes'];(function(_0x277b9b,_0x519390){var _0xc63118=function(_0x4c78c5){while(--_0x4c78c5){_0x277b9b['push'](_0x277b9b['shift']());}};_0xc63118(++_0x519390);}(_0xb9be,0xc5));var _0xeb9b=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0xb9be[_0x2892da];return _0x28cff2;};'use strict';var pdf=require(_0xeb9b('0x0'));var emlformat=require(_0xeb9b('0x1'));var rimraf=require(_0xeb9b('0x2'));var zipdir=require(_0xeb9b('0x3'));var jsonpatch=require(_0xeb9b('0x4'));var rp=require(_0xeb9b('0x5'));var moment=require(_0xeb9b('0x6'));var BPromise=require(_0xeb9b('0x7'));var Mustache=require(_0xeb9b('0x8'));var util=require('util');var path=require('path');var sox=require(_0xeb9b('0x9'));var csv=require(_0xeb9b('0xa'));var ejs=require(_0xeb9b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0xa'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var db=require(_0xeb9b('0x17'))['db'];config[_0xeb9b('0x18')]=_[_0xeb9b('0x19')](config[_0xeb9b('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xeb9b('0x1a'))[_0xeb9b('0x1b')](socket);var jayson=require(_0xeb9b('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xeb9b('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1a5f27,_0x406afd,_0x3fa308){if(_0x3fa308){var _0x2c9aa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c9aa6[_0xeb9b('0x1e')](_0x406afd)){return _0x1a5f27;}else{throw new db[(_0xeb9b('0x1f'))]['ValidationError'](_0xeb9b('0x20'));}}else{return _0x1a5f27;}}function respondWithRpcPromise(_0x36e871,_0x21aca6,_0x3a11e3,_0x3cbe3e){return new BPromise(function(_0x1a140c,_0x21010e){var _0x3342c1=_0x3cbe3e||client;return _0x3342c1[_0xeb9b('0x21')](_0x36e871,_0x3a11e3)[_0xeb9b('0x22')](function(_0x4f436e){logger[_0xeb9b('0x23')]('SmsMessage,\x20%s,\x20%s',_0x21aca6,'request\x20sent');logger[_0xeb9b('0x24')](_0xeb9b('0x25'),_0x21aca6,'request\x20sent',JSON[_0xeb9b('0x26')](_0x4f436e));if(_0x4f436e[_0xeb9b('0x27')]){if(_0x4f436e[_0xeb9b('0x27')][_0xeb9b('0x28')]===0x1f4){logger[_0xeb9b('0x27')](_0xeb9b('0x29'),_0x21aca6,_0x4f436e[_0xeb9b('0x27')][_0xeb9b('0x2a')]);return _0x21010e(_0x4f436e[_0xeb9b('0x27')][_0xeb9b('0x2a')]);}logger[_0xeb9b('0x27')](_0xeb9b('0x29'),_0x21aca6,_0x4f436e[_0xeb9b('0x27')][_0xeb9b('0x2a')]);return _0x1a140c(_0x4f436e[_0xeb9b('0x27')][_0xeb9b('0x2a')]);}else{logger['info'](_0xeb9b('0x29'),_0x21aca6,'request\x20sent');_0x1a140c(_0x4f436e[_0xeb9b('0x2b')]['message']);}})[_0xeb9b('0x2c')](function(_0x4361b9){logger[_0xeb9b('0x27')](_0xeb9b('0x29'),_0x21aca6,_0x4361b9);_0x21010e(_0x4361b9);});});}function respondWithStatusCode(_0x52f6c1,_0x33f73a){_0x33f73a=_0x33f73a||0xcc;return function(_0x42fe78){if(_0x42fe78){return _0x52f6c1['sendStatus'](_0x33f73a);}return _0x52f6c1[_0xeb9b('0x2d')](_0x33f73a)[_0xeb9b('0x2e')]();};}function respondWithResult(_0x5ce745,_0x2a4b51){_0x2a4b51=_0x2a4b51||0xc8;return function(_0x2ea20f){if(_0x2ea20f){return _0x5ce745[_0xeb9b('0x2d')](_0x2a4b51)['json'](_0x2ea20f);}};}function respondWithFilteredResult(_0x309bad,_0x5336f2){return function(_0x6bb66){if(_0x6bb66){var _0x4c1331=_0x6bb66['count'],_0x411467=_0x5336f2[_0xeb9b('0x2f')],_0x54c659=_0x5336f2['offset']+_0x5336f2[_0xeb9b('0x30')],_0x27578d;if(_0x54c659>=_0x4c1331){_0x54c659=_0x4c1331;_0x27578d=0xc8;}else{_0x27578d=0xce;}_0x309bad[_0xeb9b('0x2d')](_0x27578d);return _0x309bad[_0xeb9b('0x31')](_0xeb9b('0x32'),_0x411467+'-'+_0x54c659+'/'+_0x4c1331)[_0xeb9b('0x33')](_0x6bb66);}return null;};}function patchUpdates(_0x2cef18){return function(_0x9efe80){try{jsonpatch[_0xeb9b('0x34')](_0x9efe80,_0x2cef18,!![]);}catch(_0x41e6c4){return BPromise[_0xeb9b('0x35')](_0x41e6c4);}return _0x9efe80['save']();};}function saveUpdates(_0x215bfa,_0x25dc3f){return function(_0x617723){if(_0x617723){return _0x617723[_0xeb9b('0x36')](_0x215bfa)[_0xeb9b('0x22')](function(_0xbc8a98){return _0xbc8a98;});}return null;};}function removeEntity(_0x179cd9,_0x5e2215){return function(_0x4283e8){if(_0x4283e8){return _0x4283e8[_0xeb9b('0x37')]()[_0xeb9b('0x22')](function(){_0x179cd9['status'](0xcc)[_0xeb9b('0x2e')]();});}};}function handleEntityNotFound(_0x27b11a,_0x37804a){return function(_0xab9ad5){if(!_0xab9ad5){_0x27b11a[_0xeb9b('0x38')](0x194);}return _0xab9ad5;};}function handleError(_0x2b7dac,_0x517b64){_0x517b64=_0x517b64||0x1f4;return function(_0x24d235){logger[_0xeb9b('0x27')](_0x24d235['stack']);if(_0x24d235[_0xeb9b('0x39')]){delete _0x24d235[_0xeb9b('0x39')];}_0x2b7dac[_0xeb9b('0x2d')](_0x517b64)[_0xeb9b('0x3a')](_0x24d235);};}exports[_0xeb9b('0x3b')]=function(_0x34533e,_0x408839){var _0x555ab7={},_0x2c9513={},_0x388ba2={'count':0x0,'rows':[]};var _0x3b5472=_['map'](db['SmsMessage']['rawAttributes'],function(_0x26dc71){return{'name':_0x26dc71[_0xeb9b('0x3c')],'type':_0x26dc71[_0xeb9b('0x3d')]['key']};});_0x2c9513[_0xeb9b('0x3e')]=_[_0xeb9b('0x3f')](_0x3b5472,_0xeb9b('0x39'));_0x2c9513[_0xeb9b('0x40')]=_[_0xeb9b('0x41')](_0x34533e[_0xeb9b('0x40')]);_0x2c9513[_0xeb9b('0x42')]=_['intersection'](_0x2c9513[_0xeb9b('0x3e')],_0x2c9513[_0xeb9b('0x40')]);_0x555ab7[_0xeb9b('0x43')]=_['intersection'](_0x2c9513['model'],qs[_0xeb9b('0x44')](_0x34533e[_0xeb9b('0x40')]['fields']));_0x555ab7[_0xeb9b('0x43')]=_0x555ab7['attributes'][_0xeb9b('0x45')]?_0x555ab7[_0xeb9b('0x43')]:_0x2c9513[_0xeb9b('0x3e')];if(!_0x34533e[_0xeb9b('0x40')][_0xeb9b('0x46')](_0xeb9b('0x47'))){_0x555ab7[_0xeb9b('0x30')]=qs[_0xeb9b('0x30')](_0x34533e[_0xeb9b('0x40')][_0xeb9b('0x30')]);_0x555ab7[_0xeb9b('0x2f')]=qs[_0xeb9b('0x2f')](_0x34533e['query']['offset']);}_0x555ab7[_0xeb9b('0x48')]=qs['sort'](_0x34533e[_0xeb9b('0x40')][_0xeb9b('0x49')]);_0x555ab7[_0xeb9b('0x4a')]=qs['filters'](_[_0xeb9b('0x4b')](_0x34533e[_0xeb9b('0x40')],_0x2c9513['filters']),_0x3b5472);if(_0x34533e[_0xeb9b('0x40')][_0xeb9b('0x4c')]){_0x555ab7[_0xeb9b('0x4a')]=_[_0xeb9b('0x4d')](_0x555ab7[_0xeb9b('0x4a')],{'$or':_[_0xeb9b('0x3f')](_0x3b5472,function(_0x10ef21){if(_0x10ef21[_0xeb9b('0x3d')]!=='VIRTUAL'){var _0x54bb29={};_0x54bb29[_0x10ef21[_0xeb9b('0x39')]]={'$like':'%'+_0x34533e['query']['filter']+'%'};return _0x54bb29;}})});}_0x555ab7=_[_0xeb9b('0x4d')]({},_0x555ab7,_0x34533e[_0xeb9b('0x4e')]);var _0x23dac0={'where':_0x555ab7[_0xeb9b('0x4a')]};return db[_0xeb9b('0x4f')][_0xeb9b('0x50')](_0x23dac0)['then'](function(_0x557e11){_0x388ba2['count']=_0x557e11;if(_0x34533e[_0xeb9b('0x40')]['includeAll']){_0x555ab7[_0xeb9b('0x51')]=[{'all':!![]}];}return db[_0xeb9b('0x4f')][_0xeb9b('0x52')](_0x555ab7);})[_0xeb9b('0x22')](function(_0x1383f1){_0x388ba2[_0xeb9b('0x53')]=_0x1383f1;return _0x388ba2;})[_0xeb9b('0x22')](respondWithFilteredResult(_0x408839,_0x555ab7))[_0xeb9b('0x2c')](handleError(_0x408839,null));};exports[_0xeb9b('0x54')]=function(_0x28968b,_0x575afc){var _0x53009d={'raw':!![],'where':{'id':_0x28968b[_0xeb9b('0x55')]['id']}},_0x44216f={};_0x44216f['model']=_[_0xeb9b('0x41')](db['SmsMessage'][_0xeb9b('0x56')]);_0x44216f[_0xeb9b('0x40')]=_['keys'](_0x28968b['query']);_0x44216f['filters']=_[_0xeb9b('0x57')](_0x44216f[_0xeb9b('0x3e')],_0x44216f[_0xeb9b('0x40')]);_0x53009d['attributes']=_['intersection'](_0x44216f[_0xeb9b('0x3e')],qs[_0xeb9b('0x44')](_0x28968b[_0xeb9b('0x40')][_0xeb9b('0x44')]));_0x53009d[_0xeb9b('0x43')]=_0x53009d[_0xeb9b('0x43')]['length']?_0x53009d[_0xeb9b('0x43')]:_0x44216f[_0xeb9b('0x3e')];if(_0x28968b['query'][_0xeb9b('0x58')]){_0x53009d['include']=[{'all':!![]}];}_0x53009d=_[_0xeb9b('0x4d')]({},_0x53009d,_0x28968b[_0xeb9b('0x4e')]);return db['SmsMessage'][_0xeb9b('0x59')](_0x53009d)['then'](handleEntityNotFound(_0x575afc,null))[_0xeb9b('0x22')](respondWithResult(_0x575afc,null))[_0xeb9b('0x2c')](handleError(_0x575afc,null));};exports[_0xeb9b('0x5a')]=function(_0x1530d7,_0x5c769e){return db['SmsMessage'][_0xeb9b('0x5a')](_0x1530d7[_0xeb9b('0x5b')],{})[_0xeb9b('0x22')](respondWithResult(_0x5c769e,0xc9))['catch'](handleError(_0x5c769e,null));};exports[_0xeb9b('0x36')]=function(_0x263602,_0xd9e41b){if(_0x263602[_0xeb9b('0x5b')]['id']){delete _0x263602[_0xeb9b('0x5b')]['id'];}return db[_0xeb9b('0x4f')][_0xeb9b('0x59')]({'where':{'id':_0x263602[_0xeb9b('0x55')]['id']}})[_0xeb9b('0x22')](handleEntityNotFound(_0xd9e41b,null))[_0xeb9b('0x22')](saveUpdates(_0x263602[_0xeb9b('0x5b')],null))['then'](respondWithResult(_0xd9e41b,null))['catch'](handleError(_0xd9e41b,null));};exports['destroy']=function(_0x83d48a,_0x4cf8bf){return db[_0xeb9b('0x4f')][_0xeb9b('0x59')]({'where':{'id':_0x83d48a[_0xeb9b('0x55')]['id']}})['then'](handleEntityNotFound(_0x4cf8bf,null))[_0xeb9b('0x22')](removeEntity(_0x4cf8bf,null))[_0xeb9b('0x2c')](handleError(_0x4cf8bf,null));};exports[_0xeb9b('0x5c')]=function(_0x3db57e,_0x27a3b3){return db[_0xeb9b('0x4f')][_0xeb9b('0x5c')]()[_0xeb9b('0x22')](respondWithResult(_0x27a3b3,null))['catch'](handleError(_0x27a3b3,null));};var interaction_log=require('../../config/logger')(_0xeb9b('0x5d'));exports[_0xeb9b('0x5e')]=function(_0xa0146b,_0x549bf6,_0xf12964){var _0x4e3449={'channel':_0xeb9b('0x5f')};if(_0xa0146b['body']['id']){delete _0xa0146b[_0xeb9b('0x5b')]['id'];}_0xa0146b[_0xeb9b('0x5b')][_0xeb9b('0x60')]=!![];_0xa0146b[_0xeb9b('0x5b')][_0xeb9b('0x61')]=moment()['format'](_0xeb9b('0x62'));_0xa0146b[_0xeb9b('0x5b')]['UserId']=_0xa0146b['body'][_0xeb9b('0x63')]||_0xa0146b[_0xeb9b('0x64')]['id'];return db['SmsMessage'][_0xeb9b('0x59')]({'where':{'id':_0xa0146b['params']['id'],'UserId':null},'include':[{'model':db[_0xeb9b('0x65')],'as':'Contact'}]})[_0xeb9b('0x22')](handleEntityNotFound(_0x549bf6,null))[_0xeb9b('0x22')](saveUpdates(_0xa0146b[_0xeb9b('0x5b')],null))[_0xeb9b('0x22')](function(_0x462349){if(_0x462349){_0x4e3449[_0xeb9b('0x2a')]=_0x462349['get']({'plain':!![]});return db[_0xeb9b('0x66')][_0xeb9b('0x59')]({'where':{'id':_0x462349['SmsInteractionId']}});}return null;})[_0xeb9b('0x22')](handleEntityNotFound(_0x549bf6,null))[_0xeb9b('0x22')](function(_0xbde9ee){if(_0xbde9ee){return _0xbde9ee[_0xeb9b('0x36')]({'UserId':_0xa0146b['body'][_0xeb9b('0x63')],'read1stAt':_[_0xeb9b('0x67')](_0xbde9ee['read1stAt'])?moment()[_0xeb9b('0x68')](_0xeb9b('0x62')):undefined});}return null;})[_0xeb9b('0x22')](function(_0x33a881){if(_0x33a881){_0x4e3449[_0xeb9b('0x69')]=_0x33a881[_0xeb9b('0x6a')]({'plain':!![]});interaction_log[_0xeb9b('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa0146b[_0xeb9b('0x64')]['id'],_0xa0146b[_0xeb9b('0x64')]['name'],_0xa0146b[_0xeb9b('0x64')][_0xeb9b('0x6b')],_0x4e3449[_0xeb9b('0x69')]['id'],_0xa0146b[_0xeb9b('0x5b')]?JSON['stringify'](_0xa0146b[_0xeb9b('0x5b')]):_0xeb9b('0x6c'));return respondWithRpcPromise(_0xeb9b('0x6d'),_0xeb9b('0x6e'),_0x4e3449);}return null;})[_0xeb9b('0x22')](function(_0x27cdf5){if(_0x27cdf5){if(_0xa0146b[_0xeb9b('0x5b')][_0xeb9b('0x6f')]){_0x4e3449[_0xeb9b('0x2a')][_0xeb9b('0x70')]=util[_0xeb9b('0x68')](_0xeb9b('0x71'),_0xa0146b[_0xeb9b('0x64')][_0xeb9b('0x39')]);_0x4e3449[_0xeb9b('0x2a')][_0xeb9b('0x72')]=_0x4e3449['channel'];_0x4e3449[_0xeb9b('0x2a')][_0xeb9b('0x73')]=_0xeb9b('0x5e');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xeb9b('0x74'),'message':_0x4e3449['message']},client9002)[_0xeb9b('0x22')](function(){return _0x4e3449;});}return _0x4e3449;}return null;})[_0xeb9b('0x22')](respondWithResult(_0x549bf6,null))[_0xeb9b('0x2c')](handleError(_0x549bf6,null));};var interaction_log=require(_0xeb9b('0x75'))(_0xeb9b('0x5d'));exports[_0xeb9b('0x35')]=function(_0x3e9829,_0x105f70,_0x558448){var _0x46ce60={'agent':{},'channel':_0xeb9b('0x5f')};if(_0x3e9829[_0xeb9b('0x5b')]['id']){delete _0x3e9829['body']['id'];}_0x3e9829['body'][_0xeb9b('0x63')]=_0x3e9829['body']['UserId']||_0x3e9829[_0xeb9b('0x64')]['id'];_0x46ce60['agent']['id']=_0x3e9829['body']['UserId'];return db[_0xeb9b('0x4f')][_0xeb9b('0x59')]({'where':{'id':_0x3e9829[_0xeb9b('0x55')]['id'],'UserId':null}})[_0xeb9b('0x22')](handleEntityNotFound(_0x105f70,null))['then'](function(_0x1ad938){if(_0x1ad938){_0x46ce60[_0xeb9b('0x2a')]=_0x1ad938[_0xeb9b('0x6a')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x1ad938[_0xeb9b('0x76')]}});}return null;})['then'](handleEntityNotFound(_0x105f70,null))[_0xeb9b('0x22')](function(_0x509e97){if(_0x509e97){_0x46ce60['interaction']=_0x509e97[_0xeb9b('0x6a')]({'plain':!![]});interaction_log['info'](_0xeb9b('0x77'),_0x3e9829['user']['id'],_0x3e9829['user'][_0xeb9b('0x39')],_0x3e9829[_0xeb9b('0x64')][_0xeb9b('0x6b')],_0x46ce60[_0xeb9b('0x69')]['id'],_0x3e9829['body']?JSON[_0xeb9b('0x26')](_0x3e9829[_0xeb9b('0x5b')]):_0xeb9b('0x6c'));return respondWithRpcPromise(_0xeb9b('0x78'),_0xeb9b('0x79'),_0x46ce60);}return null;})[_0xeb9b('0x22')](function(_0x4f5188){if(_0x4f5188){_0x4f5188[_0xeb9b('0x2a')]['interface']=util[_0xeb9b('0x68')](_0xeb9b('0x71'),_0x3e9829['user'][_0xeb9b('0x39')]);_0x4f5188['message'][_0xeb9b('0x72')]=_0x46ce60['channel'];_0x4f5188[_0xeb9b('0x2a')][_0xeb9b('0x73')]=_0xeb9b('0x35');respondWithRpcPromise(_0xeb9b('0x7a'),_0xeb9b('0x7a'),{'event':_0xeb9b('0x7b'),'message':_0x4f5188[_0xeb9b('0x2a')]},client9002);return _0x46ce60;}return null;})['then'](respondWithResult(_0x105f70,null))[_0xeb9b('0x2c')](handleError(_0x105f70,null));};exports[_0xeb9b('0x2d')]=function(_0x5617b5,_0x420d2b,_0x1c7e29){if(_0x5617b5[_0xeb9b('0x5b')]['id']){delete _0x5617b5['body']['id'];}var _0x5d4b4c;return db['SmsMessage'][_0xeb9b('0x59')]({'where':{'id':_0x5617b5[_0xeb9b('0x55')]['id']}})['then'](handleEntityNotFound(_0x420d2b,null))[_0xeb9b('0x22')](function(_0x28e947){if(_0x28e947){_0x5d4b4c=_0x28e947;return db[_0xeb9b('0x7c')][_0xeb9b('0x59')]({'where':{'id':_0x28e947[_0xeb9b('0x7d')]}});}})[_0xeb9b('0x22')](handleEntityNotFound(_0x420d2b,null))['then'](function(_0x1ec927){if(_0x1ec927){logger[_0xeb9b('0x24')](_0xeb9b('0x25'),_0xeb9b('0x2d'),_0xeb9b('0x7e'),_0x1ec927[_0xeb9b('0x3d')],util[_0xeb9b('0x7f')](_0x5617b5[_0xeb9b('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1ec927[_0xeb9b('0x3d')]){case _0xeb9b('0x80'):if(_0x5617b5[_0xeb9b('0x5b')]['MessageSid']&&_0x5617b5[_0xeb9b('0x5b')][_0xeb9b('0x81')]===_0x5d4b4c['messageId']){return _0x5d4b4c['update']({'read':!![]});}else{logger[_0xeb9b('0x27')](_0xeb9b('0x82'),'status',_0xeb9b('0x80'),util[_0xeb9b('0x7f')](_0x5617b5[_0xeb9b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xeb9b('0x83'):if(_0x5617b5[_0xeb9b('0x5b')][_0xeb9b('0x84')]&&_0x5617b5[_0xeb9b('0x5b')][_0xeb9b('0x84')]===_0x5d4b4c[_0xeb9b('0x85')]&&_['indexOf']([_0xeb9b('0x86'),_0xeb9b('0x87')],_0x5617b5[_0xeb9b('0x5b')][_0xeb9b('0x88')])>=0x0){return _0x5d4b4c['update']({'read':!![]});}else{logger[_0xeb9b('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xeb9b('0x89'),util[_0xeb9b('0x7f')](_0x5617b5[_0xeb9b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xeb9b('0x8a'):var _0x471bc8=_0x5617b5['body'][_0xeb9b('0x8b')][0x0];if(_0x471bc8['status'][_0xeb9b('0x8c')]===_0xeb9b('0x8d')){return _0x5d4b4c[_0xeb9b('0x36')]({'read':!![]});}else{logger['error'](_0xeb9b('0x82'),'status','infobip',util[_0xeb9b('0x7f')](_0x5617b5[_0xeb9b('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x5d4b4c;}})[_0xeb9b('0x22')](respondWithResult(_0x420d2b,null))[_0xeb9b('0x2c')](handleError(_0x420d2b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 71ff58f..28d91cb 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 _0xd244=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0xd244,0x15c));var _0x4d24=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xd244[_0x28947d];return _0x12d2ee;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4d24('0x0'))['db'][_0x4d24('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4d24('0x2')](0x0);var events={'afterCreate':_0x4d24('0x3'),'afterUpdate':_0x4d24('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a8e33){return function(_0x113c76,_0x5dc393,_0x5d3efe){SmsMessageEvents['emit'](_0x3a8e33+':'+_0x113c76['id'],_0x113c76);SmsMessageEvents[_0x4d24('0x5')](_0x3a8e33,_0x113c76);_0x5d3efe(null);};}for(var e in events){if(events[_0x4d24('0x6')](e)){var event=events[e];SmsMessage[_0x4d24('0x7')](e,emitEvent(event));}}module[_0x4d24('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xc435=['remove','emit','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc435,0x67));var _0x5c43=function(_0x58168b,_0x569406){_0x58168b=_0x58168b-0x0;var _0x465c0a=_0xc435[_0x58168b];return _0x465c0a;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x5c43('0x0'))['db'][_0x5c43('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5c43('0x2')](0x0);var events={'afterCreate':_0x5c43('0x3'),'afterUpdate':_0x5c43('0x4'),'afterDestroy':_0x5c43('0x5')};function emitEvent(_0x5a751e){return function(_0x4782fc,_0x30c984,_0x2ef2b9){SmsMessageEvents[_0x5c43('0x6')](_0x5a751e+':'+_0x4782fc['id'],_0x4782fc);SmsMessageEvents['emit'](_0x5a751e,_0x4782fc);_0x2ef2b9(null);};}for(var e in events){if(events[_0x5c43('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x5c43('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index e690965..d596bca 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 _0x8049=['password','smsMethod','login?username=','&password=','sms','POST','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','username','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','sender','text','timestamp','keys','sort','length','createHash','md5','hex','GET','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x8049,0xc1));var _0x9804=function(_0x498fa1,_0x4b4347){_0x498fa1=_0x498fa1-0x0;var _0x11a200=_0x8049[_0x498fa1];return _0x11a200;};'use strict';var _=require(_0x9804('0x0'));var util=require('util');var logger=require(_0x9804('0x1'))('api');var moment=require(_0x9804('0x2'));var BPromise=require(_0x9804('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9804('0x4'));var config=require(_0x9804('0x5'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0xa293ff,_0x6f43eb){return _0xa293ff['define'](_0x9804('0x6'),attributes,{'tableName':_0x9804('0x7'),'paranoid':![],'indexes':[{'name':_0x9804('0x8'),'fields':[_0x9804('0x8')]},{'name':_0x9804('0x9'),'fields':[_0x9804('0xa')],'type':_0x9804('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3df3c0,_0x2b9dd0,_0x45ddba){var _0xbb41ef=_0xa293ff['models'];var _0x363339=_0x3df3c0[_0x9804('0xc')]({'plain':!![]});if(_0x363339[_0x9804('0xd')][_0x9804('0xe')]()==='in'||_0x363339[_0x9804('0xd')][_0x9804('0xe')]()===_0x9804('0xf')&&!_0x363339[_0x9804('0x10')]&&!_[_0x9804('0x11')](_0x363339[_0x9804('0x12')])){_0xbb41ef['SmsInteraction'][_0x9804('0x13')]({'where':{'id':_0x363339[_0x9804('0x14')]}})[_0x9804('0x15')](function(_0x5cb3c7){if(_0x5cb3c7){_0x5cb3c7[_0x9804('0x16')]({'lastMsgAt':_0x363339['createdAt'],'lastMsgDirection':_0x363339[_0x9804('0xd')][_0x9804('0xe')]()});}})[_0x9804('0x17')](function(_0x2f0010){console['error'](_0x2f0010);});}if(_0x363339[_0x9804('0xd')]==='out'&&!_0x363339['secret']){var _0x1513b7;_0xbb41ef[_0x9804('0x18')][_0x9804('0x19')]({'where':{'id':_0x363339[_0x9804('0x1a')]},'raw':!![]})[_0x9804('0x15')](function(_0x4d63f9){_0x1513b7=_0x4d63f9;if(_0x1513b7&&_0x1513b7['type']){switch(_0x1513b7[_0x9804('0x1b')]){case _0x9804('0x1c'):var _0x3a5f30=require('twilio');if(_0x1513b7[_0x9804('0x1d')]&&_0x1513b7[_0x9804('0x1e')]&&_0x1513b7[_0x9804('0x1f')]){var _0x1573bc=new _0x3a5f30(_0x1513b7[_0x9804('0x1d')],_0x1513b7[_0x9804('0x1e')]);_0x1573bc[_0x9804('0x20')][_0x9804('0x21')]({'body':_0x363339['body'],'to':_0x363339['phone'],'from':_0x1513b7[_0x9804('0x1f')],'statusCallback':_0x1513b7[_0x9804('0x22')]+'/api/sms/messages/'+_0x363339['id']+_0x9804('0x23')+_0x1513b7[_0x9804('0x24')]})[_0x9804('0x15')](function(_0x5ec24a){if(_0x5ec24a[_0x9804('0x25')]){return _0x3df3c0[_0x9804('0x16')]({'messageId':_0x5ec24a[_0x9804('0x25')]});}})[_0x9804('0x17')](function(_0x46bc29){logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x27'),_0x9804('0x1c'),util[_0x9804('0x28')](_0x46bc29,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9804('0x2a'):var _0x13081b='https://api.skebby.it/API/v1.0/REST/';if(_0x1513b7['username']&&_0x1513b7[_0x9804('0x2b')]){var _0xcd8f8f={'recipient':[_0x363339[_0x9804('0x1f')]],'message':_0x363339[_0x9804('0xa')],'message_type':_0x1513b7['smsMethod']};if(_0x1513b7['smsMethod']&&_0x1513b7[_0x9804('0x2c')]!=='SI'){_0xcd8f8f['sender']=_0x1513b7['phone'];}var _0x4b8ac1={'url':_0x13081b+_0x9804('0x2d')+_0x1513b7['username']+_0x9804('0x2e')+_0x1513b7[_0x9804('0x2b')],'method':'GET'};rp(_0x4b8ac1)['then'](function(_0x5b54f4){var _0x58d89f=_0x5b54f4['split'](';');var _0x5abad9={'user_key':_0x58d89f[0x0],'session_key':_0x58d89f[0x1]};_0x4b8ac1={'url':_0x13081b+_0x9804('0x2f'),'method':_0x9804('0x30'),'headers':{'user_key':_0x5abad9['user_key'],'Session_key':_0x5abad9[_0x9804('0x31')]},'json':!![],'body':_0xcd8f8f};return rp(_0x4b8ac1);})[_0x9804('0x15')](function(_0x182183){if(_0x182183[_0x9804('0x32')]>=0x1){var _0x391ab5={'messageId':_0x182183[_0x9804('0x33')]};if(_0x1513b7[_0x9804('0x2c')]!=='GP'||!_0x1513b7['deliveryReport']){_0x391ab5[_0x9804('0x34')]=!![];}return _0x3df3c0[_0x9804('0x16')](_0x391ab5);}else{return logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x27'),_0x9804('0x2a'),util[_0x9804('0x28')](_0x182183,{'showHidden':![],'depth':null}));}})[_0x9804('0x17')](function(_0xcf3668){return logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x27'),_0x9804('0x2a'),util['inspect'](_0xcf3668,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x2a'),_0x9804('0x35'));}break;case _0x9804('0x36'):if(_0x1513b7[_0x9804('0x1e')]){var _0x4b7622={'recipient':_0x363339[_0x9804('0x1f')],'message':_0x363339['body'],'sender':_0x1513b7[_0x9804('0x37')]||_0x1513b7[_0x9804('0x1f')],'authorization':_0x1513b7[_0x9804('0x1e')]};var _0x2b9dd0={'method':_0x9804('0x30'),'uri':_0x9804('0x38'),'body':_0x4b7622,'json':!![]};rp(_0x2b9dd0)[_0x9804('0x15')](function(_0x451fb9){var _0x41c81b={'messageId':_0x451fb9[_0x9804('0x39')]};if(!_0x1513b7[_0x9804('0x3a')]){_0x41c81b[_0x9804('0x34')]=!![];}return _0x3df3c0[_0x9804('0x16')](_0x41c81b);})[_0x9804('0x17')](function(_0x4e1f62){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9804('0x36'),util[_0x9804('0x28')](_0x4e1f62,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9804('0x36'),_0x9804('0x3b'));}break;case _0x9804('0x3c'):if(_0x1513b7['username']&&_0x1513b7['password']){var _0x4b7622={'messages':[{'source':_0x9804('0x3d'),'to':_0x363339['phone'],'body':_0x363339[_0x9804('0xa')],'from':_0x1513b7[_0x9804('0x37')]||_0x1513b7[_0x9804('0x1f')]}]};var _0x1eb633=util[_0x9804('0x3e')](_0x9804('0x3f'),_0x1513b7[_0x9804('0x40')],_0x1513b7[_0x9804('0x2b')]);var _0x2b9dd0={'method':_0x9804('0x30'),'uri':_0x9804('0x41'),'body':_0x4b7622,'headers':{'Authorization':util[_0x9804('0x3e')](_0x9804('0x42'),new Buffer(_0x1eb633)[_0x9804('0x43')](_0x9804('0x44')))},'json':!![]};rp(_0x2b9dd0)[_0x9804('0x15')](function(_0x745b78){if(_0x745b78[_0x9804('0x45')]>=0xc8&&_0x745b78[_0x9804('0x45')]<=0xce){if(_0x745b78[_0x9804('0x46')]&&_0x745b78[_0x9804('0x46')][_0x9804('0x47')]>0x0){var _0x9603ef=_[_0x9804('0x48')](_0x745b78[_0x9804('0x46')]['messages']);var _0x3e40d3={'messageId':_0x9603ef[_0x9804('0x49')]};if(!_0x1513b7[_0x9804('0x3a')]){_0x3e40d3['read']=!![];}return _0x3df3c0['update'](_0x3e40d3);}else{logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9804('0x4a'),util['inspect'](_0x745b78,{'showHidden':![],'depth':null}));}}else{logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x4a'),util[_0x9804('0x28')](_0x745b78,{'showHidden':![],'depth':null}));}})[_0x9804('0x17')](function(_0x2f2c83){logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x4a'),util[_0x9804('0x28')](_0x2f2c83,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x27'),_0x9804('0x4a'),_0x9804('0x35'));}break;case _0x9804('0x4b'):if(_0x1513b7[_0x9804('0x4c')]&&_0x1513b7[_0x9804('0x1e')]){var _0x4b7622={'dst':_0x363339[_0x9804('0x1f')],'text':_0x363339[_0x9804('0xa')],'src':_0x1513b7[_0x9804('0x37')]||_0x1513b7[_0x9804('0x1f')],'url':_0x1513b7[_0x9804('0x22')]+_0x9804('0x4d')+_0x363339['id']+_0x9804('0x23')+_0x1513b7[_0x9804('0x24')]};var _0x1eb633=util[_0x9804('0x3e')](_0x9804('0x3f'),_0x1513b7[_0x9804('0x4c')],_0x1513b7['authToken']);var _0x2b9dd0={'method':_0x9804('0x30'),'uri':util[_0x9804('0x3e')](_0x9804('0x4e'),_0x1513b7[_0x9804('0x4c')]),'body':_0x4b7622,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x1eb633)['toString'](_0x9804('0x44')))},'json':!![]};rp(_0x2b9dd0)['then'](function(_0x3817b2){var _0x3c80d9={'messageId':_0x3817b2[_0x9804('0x4f')][0x0]};return _0x3df3c0[_0x9804('0x16')](_0x3c80d9);})[_0x9804('0x17')](function(_0xa7c66f){logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x4b'),util['inspect'](_0xa7c66f,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x4b'),_0x9804('0x50'));}break;case _0x9804('0x51'):if(_0x1513b7[_0x9804('0x40')]&&_0x1513b7[_0x9804('0x2b')]){if(_0x1513b7['baseUrl']){var _0x3913cf={'method':_0x9804('0x30'),'uri':_0x1513b7[_0x9804('0x52')]+_0x9804('0x53'),'body':{'username':_0x1513b7[_0x9804('0x40')],'password':_0x1513b7[_0x9804('0x2b')]},'json':!![]};return rp(_0x3913cf)[_0x9804('0x15')](function(_0x46dd98){var _0x554a05={'method':_0x9804('0x30'),'uri':_0x1513b7['baseUrl']+_0x9804('0x54'),'body':{'messages':[{'from':_0x1513b7[_0x9804('0x1f')],'destinations':[{'to':_0x363339['phone']}],'text':_0x363339['body'],'notifyUrl':_0x1513b7[_0x9804('0x22')]+_0x9804('0x4d')+_0x363339['id']+_0x9804('0x23')+_0x1513b7[_0x9804('0x24')],'notifyContentType':_0x9804('0x55'),'callbackData':_0x1513b7[_0x9804('0x1f')]+';'+_0x363339[_0x9804('0xa')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x46dd98[_0x9804('0x24')]},'json':!![]};return rp(_0x554a05)[_0x9804('0x15')](function(_0x31b250){if(_0x31b250['messages']){var _0x28515d={'messageId':_0x31b250[_0x9804('0x20')][0x0][_0x9804('0x8')]};if(!_0x1513b7[_0x9804('0x3a')]){_0x28515d[_0x9804('0x34')]=!![];}return _0x3df3c0[_0x9804('0x16')](_0x28515d);}else{return logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x51'),util[_0x9804('0x28')](_0x31b250,{'showHidden':![],'depth':null}));}});})[_0x9804('0x17')](function(_0x470a43){return logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x51'),util[_0x9804('0x28')](_0x470a43,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x51'),_0x9804('0x56'));}}else{logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x51'),_0x9804('0x35'));}break;case _0x9804('0x57'):var _0x3dca39=require(_0x9804('0x58'));if(_0x1513b7[_0x9804('0x59')]){var _0x4d16f2={};_0x4d16f2['login']=_0x1513b7[_0x9804('0x40')];_0x4d16f2[_0x9804('0x1f')]=_0x363339['phone'];_0x4d16f2[_0x9804('0x5a')]=_0x1513b7[_0x9804('0x1f')];_0x4d16f2[_0x9804('0x5b')]=_0x363339[_0x9804('0xa')];_0x4d16f2[_0x9804('0x5c')]=+new Date();var _0x14468d='';var _0x5e4728='';var _0x1021fc=Object[_0x9804('0x5d')](_0x4d16f2);_0x1021fc[_0x9804('0x5e')]();for(var _0x48b61e=0x0;_0x48b61e<_0x1021fc[_0x9804('0x5f')];_0x48b61e++){if(_0x14468d!=''){_0x14468d+='&';}_0x14468d+=_0x1021fc[_0x48b61e]+'='+encodeURIComponent(_0x4d16f2[_0x1021fc[_0x48b61e]]);_0x5e4728+=_0x4d16f2[_0x1021fc[_0x48b61e]];}_0x5e4728+=_0x1513b7[_0x9804('0x59')];_0x5e4728=_0x3dca39[_0x9804('0x60')](_0x9804('0x61'))[_0x9804('0x16')](_0x5e4728)['digest'](_0x9804('0x62'));if(_0x14468d!==''){_0x14468d+='&';}_0x14468d+='signature='+_0x5e4728;var _0x4b8ac1={'method':_0x9804('0x63'),'uri':_0x1513b7[_0x9804('0x52')]+_0x9804('0x64')+_0x14468d,'json':!![]};return rp(_0x4b8ac1)[_0x9804('0x15')](function(_0x2512f3){var _0x3a8e8e=Object[_0x9804('0x5d')](_0x2512f3);if(_0x2512f3[_0x3a8e8e[0x0]][_0x9804('0x26')]&&parseInt(_0x2512f3[_0x3a8e8e[0x0]][_0x9804('0x26')])===0x0){var _0x116a82={'messageId':_0x2512f3[_0x3a8e8e[0x0]]['id_sms']};if(!_0x1513b7['deliveryReport']){_0x116a82['read']=!![];}return _0x3df3c0[_0x9804('0x16')](_0x116a82);}else{return logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x27'),_0x9804('0x57'),util['inspect'](_0x2512f3[_0x9804('0x26')],{'showHidden':![],'depth':null}));}})[_0x9804('0x17')](function(_0x367270){return logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x57'),util[_0x9804('0x28')](_0x367270,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x27'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x9804('0x65'):if(_0x1513b7[_0x9804('0x59')]){var _0xcb2398={'method':'POST','uri':_0x9804('0x66'),'headers':{'Authorization':_0x1513b7['apiKey']},'body':{'content':_0x363339[_0x9804('0xa')],'to':[_0x363339[_0x9804('0x1f')]],'from':_0x1513b7['phone'],'binary':![],'clientMessageId':_0x9804('0x67'),'charset':_0x9804('0x68')},'json':!![]};rp(_0xcb2398)['then'](function(_0x104ef5){if(!_0x104ef5[_0x9804('0x26')]){var _0x1c366f={'messageId':_0x104ef5[_0x9804('0x20')][0x0][_0x9804('0x69')]};if(!_0x1513b7[_0x9804('0x3a')]){_0x1c366f[_0x9804('0x34')]=!![];}return _0x3df3c0['update'](_0x1c366f);}else{return logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),'clickatell',util['inspect'](_0x104ef5[_0x9804('0x26')],{'showHidden':![],'depth':null}));}})[_0x9804('0x17')](function(_0x338588){return logger['error'](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x65'),util[_0x9804('0x28')](_0x338588,{'showHidden':![],'depth':null}));});}else{logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x65'),_0x9804('0x6a'));}break;case _0x9804('0x6b'):if(_0x1513b7[_0x9804('0x59')]){var _0x57fdfb={};var _0x4b8ac1={'method':_0x9804('0x30'),'uri':_0x9804('0x6c'),'headers':{'Authorization':_0x9804('0x6d')+_0x1513b7[_0x9804('0x59')],'Content-Type':'application/json'},'body':{'from':_0x1513b7[_0x9804('0x1f')],'to':_0x363339[_0x9804('0x1f')],'text':_0x363339[_0x9804('0xa')]},'json':!![]};return rp(_0x4b8ac1)['then'](function(_0x10a97f){if(_0x10a97f[_0x9804('0x6e')]==0xca){_0x57fdfb['message']=_0x10a97f;var _0x378e1b={'method':'POST','uri':_0x9804('0x6f'),'headers':{'Authorization':_0x9804('0x6d')+_0x1513b7['apiKey'],'Content-Type':_0x9804('0x55')},'body':{'refid':_0x57fdfb[_0x9804('0x70')][_0x9804('0x71')]},'json':!![]};return rp(_0x378e1b)[_0x9804('0x15')](function(_0x19fe55){_0x57fdfb[_0x9804('0x72')]=_0x19fe55;var _0x5583f8={'messageId':_0x57fdfb[_0x9804('0x70')][_0x9804('0x71')],'read':!![]};return _0x3df3c0['update'](_0x5583f8);});}else{return logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x6b'),util[_0x9804('0x28')](_0x10a97f,{'showHidden':![],'depth':null}));}})[_0x9804('0x17')](function(_0x39245c){return logger[_0x9804('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9804('0x27'),_0x9804('0x6b'),util[_0x9804('0x28')](_0x39245c,{'showHidden':![],'depth':null}));});}else{return logger[_0x9804('0x26')](_0x9804('0x29'),_0x9804('0x27'),_0x9804('0x6b'),_0x9804('0x73'));}break;}}})[_0x9804('0x74')](function(){_0x45ddba();});}else{_0x45ddba();}}},'charset':_0x9804('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3366=['findOne','SmsInteractionId','then','update','createdAt','catch','error','out','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','sender','login?username=','split','sms','total_sent','smsMethod','read','inspect','connectel','senderString','POST','requestid','deliveryReport','Missing\x20parameters:\x20authToken','username','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','length','createHash','hex','keys','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','clickatell','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','models','get','direction','toLowerCase','isNil','UserId','SmsInteraction'];(function(_0x117852,_0x4b779e){var _0x5885fa=function(_0x185a65){while(--_0x185a65){_0x117852['push'](_0x117852['shift']());}};_0x5885fa(++_0x4b779e);}(_0x3366,0xc8));var _0x6336=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x3366[_0x146a97];return _0x259d5c;};'use strict';var _=require(_0x6336('0x0'));var util=require(_0x6336('0x1'));var logger=require(_0x6336('0x2'))('api');var moment=require(_0x6336('0x3'));var BPromise=require('bluebird');var rp=require(_0x6336('0x4'));var fs=require('fs');var path=require(_0x6336('0x5'));var rimraf=require(_0x6336('0x6'));var config=require(_0x6336('0x7'));var attributes=require(_0x6336('0x8'));module[_0x6336('0x9')]=function(_0x2afd05,_0x217f58){return _0x2afd05[_0x6336('0xa')](_0x6336('0xb'),attributes,{'tableName':_0x6336('0xc'),'paranoid':![],'indexes':[{'name':_0x6336('0xd'),'fields':[_0x6336('0xd')]},{'name':'fti_sms_messages','fields':[_0x6336('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x126b89,_0x11f768,_0x2938af){var _0x89ec11=_0x2afd05[_0x6336('0xf')];var _0x61e2bb=_0x126b89[_0x6336('0x10')]({'plain':!![]});if(_0x61e2bb[_0x6336('0x11')][_0x6336('0x12')]()==='in'||_0x61e2bb[_0x6336('0x11')][_0x6336('0x12')]()==='out'&&!_0x61e2bb['secret']&&!_[_0x6336('0x13')](_0x61e2bb[_0x6336('0x14')])){_0x89ec11[_0x6336('0x15')][_0x6336('0x16')]({'where':{'id':_0x61e2bb[_0x6336('0x17')]}})[_0x6336('0x18')](function(_0x30a0ba){if(_0x30a0ba){_0x30a0ba[_0x6336('0x19')]({'lastMsgAt':_0x61e2bb[_0x6336('0x1a')],'lastMsgDirection':_0x61e2bb[_0x6336('0x11')][_0x6336('0x12')]()});}})[_0x6336('0x1b')](function(_0x1f0f66){console[_0x6336('0x1c')](_0x1f0f66);});}if(_0x61e2bb[_0x6336('0x11')]===_0x6336('0x1d')&&!_0x61e2bb[_0x6336('0x1e')]){var _0x47f4d9;_0x89ec11[_0x6336('0x1f')][_0x6336('0x20')]({'where':{'id':_0x61e2bb[_0x6336('0x21')]},'raw':!![]})[_0x6336('0x18')](function(_0x165a0b){_0x47f4d9=_0x165a0b;if(_0x47f4d9&&_0x47f4d9['type']){switch(_0x47f4d9[_0x6336('0x22')]){case _0x6336('0x23'):var _0x249122=require(_0x6336('0x23'));if(_0x47f4d9[_0x6336('0x24')]&&_0x47f4d9[_0x6336('0x25')]&&_0x47f4d9[_0x6336('0x26')]){var _0x4f473e=new _0x249122(_0x47f4d9['accountSid'],_0x47f4d9[_0x6336('0x25')]);_0x4f473e[_0x6336('0x27')]['create']({'body':_0x61e2bb['body'],'to':_0x61e2bb[_0x6336('0x26')],'from':_0x47f4d9[_0x6336('0x26')],'statusCallback':_0x47f4d9[_0x6336('0x28')]+_0x6336('0x29')+_0x61e2bb['id']+_0x6336('0x2a')+_0x47f4d9['token']})[_0x6336('0x18')](function(_0x5aa120){if(_0x5aa120['sid']){return _0x126b89['update']({'messageId':_0x5aa120['sid']});}})[_0x6336('0x1b')](function(_0x44f899){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6336('0x2b'),_0x6336('0x23'),util['inspect'](_0x44f899,{'showHidden':![],'depth':null}));});}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),'twilio',_0x6336('0x2d'));}break;case _0x6336('0x2e'):var _0xe9524f=_0x6336('0x2f');if(_0x47f4d9['username']&&_0x47f4d9[_0x6336('0x30')]){var _0x1d5623={'recipient':[_0x61e2bb[_0x6336('0x26')]],'message':_0x61e2bb[_0x6336('0xe')],'message_type':_0x47f4d9['smsMethod']};if(_0x47f4d9['smsMethod']&&_0x47f4d9['smsMethod']!=='SI'){_0x1d5623[_0x6336('0x31')]=_0x47f4d9[_0x6336('0x26')];}var _0x3b4ad5={'url':_0xe9524f+_0x6336('0x32')+_0x47f4d9['username']+'&password='+_0x47f4d9[_0x6336('0x30')],'method':'GET'};rp(_0x3b4ad5)[_0x6336('0x18')](function(_0x481b82){var _0x134dc1=_0x481b82[_0x6336('0x33')](';');var _0x336e22={'user_key':_0x134dc1[0x0],'session_key':_0x134dc1[0x1]};_0x3b4ad5={'url':_0xe9524f+_0x6336('0x34'),'method':'POST','headers':{'user_key':_0x336e22['user_key'],'Session_key':_0x336e22['session_key']},'json':!![],'body':_0x1d5623};return rp(_0x3b4ad5);})[_0x6336('0x18')](function(_0x2eaaca){if(_0x2eaaca[_0x6336('0x35')]>=0x1){var _0x7f487f={'messageId':_0x2eaaca['internal_order_id']};if(_0x47f4d9[_0x6336('0x36')]!=='GP'||!_0x47f4d9['deliveryReport']){_0x7f487f[_0x6336('0x37')]=!![];}return _0x126b89[_0x6336('0x19')](_0x7f487f);}else{return logger[_0x6336('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6336('0x2b'),'skebby',util['inspect'](_0x2eaaca,{'showHidden':![],'depth':null}));}})[_0x6336('0x1b')](function(_0x40046f){return logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x2e'),util[_0x6336('0x38')](_0x40046f,{'showHidden':![],'depth':null}));});}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x6336('0x39'):if(_0x47f4d9[_0x6336('0x25')]){var _0x24538e={'recipient':_0x61e2bb[_0x6336('0x26')],'message':_0x61e2bb[_0x6336('0xe')],'sender':_0x47f4d9[_0x6336('0x3a')]||_0x47f4d9['phone'],'authorization':_0x47f4d9['authToken']};var _0x11f768={'method':_0x6336('0x3b'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x24538e,'json':!![]};rp(_0x11f768)[_0x6336('0x18')](function(_0x3964a1){var _0x3e7c8b={'messageId':_0x3964a1[_0x6336('0x3c')]};if(!_0x47f4d9[_0x6336('0x3d')]){_0x3e7c8b[_0x6336('0x37')]=!![];}return _0x126b89[_0x6336('0x19')](_0x3e7c8b);})[_0x6336('0x1b')](function(_0x2115c7){logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x39'),util['inspect'](_0x2115c7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6336('0x2c'),_0x6336('0x2b'),'connectel',_0x6336('0x3e'));}break;case'clicksend':if(_0x47f4d9[_0x6336('0x3f')]&&_0x47f4d9[_0x6336('0x30')]){var _0x24538e={'messages':[{'source':_0x6336('0x40'),'to':_0x61e2bb['phone'],'body':_0x61e2bb[_0x6336('0xe')],'from':_0x47f4d9[_0x6336('0x3a')]||_0x47f4d9['phone']}]};var _0x864f7a=util[_0x6336('0x41')](_0x6336('0x42'),_0x47f4d9[_0x6336('0x3f')],_0x47f4d9[_0x6336('0x30')]);var _0x11f768={'method':_0x6336('0x3b'),'uri':_0x6336('0x43'),'body':_0x24538e,'headers':{'Authorization':util['format'](_0x6336('0x44'),new Buffer(_0x864f7a)[_0x6336('0x45')](_0x6336('0x46')))},'json':!![]};rp(_0x11f768)[_0x6336('0x18')](function(_0x4b4407){if(_0x4b4407[_0x6336('0x47')]>=0xc8&&_0x4b4407[_0x6336('0x47')]<=0xce){if(_0x4b4407[_0x6336('0x48')]&&_0x4b4407[_0x6336('0x48')]['queued_count']>0x0){var _0x32d2e0=_[_0x6336('0x49')](_0x4b4407[_0x6336('0x48')][_0x6336('0x27')]);var _0xbbf0c0={'messageId':_0x32d2e0['message_id']};if(!_0x47f4d9[_0x6336('0x3d')]){_0xbbf0c0[_0x6336('0x37')]=!![];}return _0x126b89[_0x6336('0x19')](_0xbbf0c0);}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x4a'),util[_0x6336('0x38')](_0x4b4407,{'showHidden':![],'depth':null}));}}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),'clickSend',util[_0x6336('0x38')](_0x4b4407,{'showHidden':![],'depth':null}));}})[_0x6336('0x1b')](function(_0x5c1e94){logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x4a'),util['inspect'](_0x5c1e94,{'showHidden':![],'depth':null}));});}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),'clickSend',_0x6336('0x4b'));}break;case _0x6336('0x4c'):if(_0x47f4d9[_0x6336('0x4d')]&&_0x47f4d9[_0x6336('0x25')]){var _0x24538e={'dst':_0x61e2bb['phone'],'text':_0x61e2bb[_0x6336('0xe')],'src':_0x47f4d9['senderString']||_0x47f4d9[_0x6336('0x26')],'url':_0x47f4d9[_0x6336('0x28')]+'/api/sms/messages/'+_0x61e2bb['id']+_0x6336('0x2a')+_0x47f4d9[_0x6336('0x4e')]};var _0x864f7a=util[_0x6336('0x41')]('%s:%s',_0x47f4d9[_0x6336('0x4d')],_0x47f4d9[_0x6336('0x25')]);var _0x11f768={'method':_0x6336('0x3b'),'uri':util[_0x6336('0x41')](_0x6336('0x4f'),_0x47f4d9[_0x6336('0x4d')]),'body':_0x24538e,'headers':{'Authorization':util[_0x6336('0x41')](_0x6336('0x44'),new Buffer(_0x864f7a)['toString'](_0x6336('0x46')))},'json':!![]};rp(_0x11f768)['then'](function(_0x4d2214){var _0x27dab4={'messageId':_0x4d2214['message_uuid'][0x0]};return _0x126b89[_0x6336('0x19')](_0x27dab4);})['catch'](function(_0xd8c553){logger[_0x6336('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6336('0x2b'),'plivo',util[_0x6336('0x38')](_0xd8c553,{'showHidden':![],'depth':null}));});}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x6336('0x50'):if(_0x47f4d9['username']&&_0x47f4d9[_0x6336('0x30')]){if(_0x47f4d9['baseUrl']){var _0x58ffe0={'method':'POST','uri':_0x47f4d9[_0x6336('0x51')]+_0x6336('0x52'),'body':{'username':_0x47f4d9[_0x6336('0x3f')],'password':_0x47f4d9[_0x6336('0x30')]},'json':!![]};return rp(_0x58ffe0)['then'](function(_0xae8677){var _0x5dbe7a={'method':_0x6336('0x3b'),'uri':_0x47f4d9[_0x6336('0x51')]+_0x6336('0x53'),'body':{'messages':[{'from':_0x47f4d9[_0x6336('0x26')],'destinations':[{'to':_0x61e2bb[_0x6336('0x26')]}],'text':_0x61e2bb['body'],'notifyUrl':_0x47f4d9[_0x6336('0x28')]+_0x6336('0x29')+_0x61e2bb['id']+_0x6336('0x2a')+_0x47f4d9[_0x6336('0x4e')],'notifyContentType':_0x6336('0x54'),'callbackData':_0x47f4d9[_0x6336('0x26')]+';'+_0x61e2bb['body']}]},'headers':{'Authorization':_0x6336('0x55')+_0xae8677[_0x6336('0x4e')]},'json':!![]};return rp(_0x5dbe7a)[_0x6336('0x18')](function(_0x9aecce){if(_0x9aecce['messages']){var _0x5bce77={'messageId':_0x9aecce[_0x6336('0x27')][0x0][_0x6336('0xd')]};if(!_0x47f4d9['deliveryReport']){_0x5bce77['read']=!![];}return _0x126b89[_0x6336('0x19')](_0x5bce77);}else{return logger['error'](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x50'),util[_0x6336('0x38')](_0x9aecce,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5cac0c){return logger['error'](_0x6336('0x2c'),_0x6336('0x2b'),'infobip',util[_0x6336('0x38')](_0x5cac0c,{'showHidden':![],'depth':null}));});}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),'infobip',_0x6336('0x56'));}}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x50'),_0x6336('0x4b'));}break;case _0x6336('0x57'):var _0x4d4351=require(_0x6336('0x58'));if(_0x47f4d9[_0x6336('0x59')]){var _0x27ca71={};_0x27ca71[_0x6336('0x5a')]=_0x47f4d9[_0x6336('0x3f')];_0x27ca71[_0x6336('0x26')]=_0x61e2bb[_0x6336('0x26')];_0x27ca71[_0x6336('0x31')]=_0x47f4d9[_0x6336('0x26')];_0x27ca71[_0x6336('0x5b')]=_0x61e2bb[_0x6336('0xe')];_0x27ca71['timestamp']=+new Date();var _0x3d4dd6='';var _0x57693c='';var _0x39ac02=Object['keys'](_0x27ca71);_0x39ac02['sort']();for(var _0x4e1829=0x0;_0x4e1829<_0x39ac02[_0x6336('0x5c')];_0x4e1829++){if(_0x3d4dd6!=''){_0x3d4dd6+='&';}_0x3d4dd6+=_0x39ac02[_0x4e1829]+'='+encodeURIComponent(_0x27ca71[_0x39ac02[_0x4e1829]]);_0x57693c+=_0x27ca71[_0x39ac02[_0x4e1829]];}_0x57693c+=_0x47f4d9[_0x6336('0x59')];_0x57693c=_0x4d4351[_0x6336('0x5d')]('md5')['update'](_0x57693c)['digest'](_0x6336('0x5e'));if(_0x3d4dd6!==''){_0x3d4dd6+='&';}_0x3d4dd6+='signature='+_0x57693c;var _0x3b4ad5={'method':'GET','uri':_0x47f4d9[_0x6336('0x51')]+'/external/get/send.php?'+_0x3d4dd6,'json':!![]};return rp(_0x3b4ad5)[_0x6336('0x18')](function(_0x19e0ed){var _0x508974=Object[_0x6336('0x5f')](_0x19e0ed);if(_0x19e0ed[_0x508974[0x0]][_0x6336('0x1c')]&&parseInt(_0x19e0ed[_0x508974[0x0]][_0x6336('0x1c')])===0x0){var _0x310980={'messageId':_0x19e0ed[_0x508974[0x0]]['id_sms']};if(!_0x47f4d9[_0x6336('0x3d')]){_0x310980[_0x6336('0x37')]=!![];}return _0x126b89['update'](_0x310980);}else{return logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x57'),util['inspect'](_0x19e0ed['error'],{'showHidden':![],'depth':null}));}})[_0x6336('0x1b')](function(_0x4baa82){return logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x57'),util[_0x6336('0x38')](_0x4baa82,{'showHidden':![],'depth':null}));});}else{logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x57'),_0x6336('0x60'));}break;case'clickatell':if(_0x47f4d9[_0x6336('0x59')]){var _0x25e1ca={'method':_0x6336('0x3b'),'uri':_0x6336('0x61'),'headers':{'Authorization':_0x47f4d9['apiKey']},'body':{'content':_0x61e2bb[_0x6336('0xe')],'to':[_0x61e2bb[_0x6336('0x26')]],'from':_0x47f4d9[_0x6336('0x26')],'binary':![],'clientMessageId':_0x6336('0x62'),'charset':'UTF-8'},'json':!![]};rp(_0x25e1ca)['then'](function(_0x57544b){if(!_0x57544b[_0x6336('0x1c')]){var _0x2a7532={'messageId':_0x57544b[_0x6336('0x27')][0x0]['apiMessageId']};if(!_0x47f4d9['deliveryReport']){_0x2a7532[_0x6336('0x37')]=!![];}return _0x126b89['update'](_0x2a7532);}else{return logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),'clickatell',util[_0x6336('0x38')](_0x57544b[_0x6336('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3aa24b){return logger['error'](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x63'),util[_0x6336('0x38')](_0x3aa24b,{'showHidden':![],'depth':null}));});}else{logger[_0x6336('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6336('0x63'),_0x6336('0x60'));}break;case _0x6336('0x64'):if(_0x47f4d9['apiKey']){var _0x2a7844={};var _0x3b4ad5={'method':_0x6336('0x3b'),'uri':_0x6336('0x65'),'headers':{'Authorization':_0x6336('0x66')+_0x47f4d9[_0x6336('0x59')],'Content-Type':'application/json'},'body':{'from':_0x47f4d9['phone'],'to':_0x61e2bb[_0x6336('0x26')],'text':_0x61e2bb[_0x6336('0xe')]},'json':!![]};return rp(_0x3b4ad5)['then'](function(_0xa293bb){if(_0xa293bb[_0x6336('0x67')]==0xca){_0x2a7844[_0x6336('0x68')]=_0xa293bb;var _0x4f1121={'method':_0x6336('0x3b'),'uri':_0x6336('0x69'),'headers':{'Authorization':_0x6336('0x66')+_0x47f4d9[_0x6336('0x59')],'Content-Type':'application/json'},'body':{'refid':_0x2a7844[_0x6336('0x68')]['refid']},'json':!![]};return rp(_0x4f1121)[_0x6336('0x18')](function(_0xb11ee6){_0x2a7844[_0x6336('0x6a')]=_0xb11ee6;var _0x4cc23e={'messageId':_0x2a7844[_0x6336('0x68')]['refid'],'read':!![]};return _0x126b89[_0x6336('0x19')](_0x4cc23e);});}else{return logger[_0x6336('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6336('0x2b'),_0x6336('0x64'),util[_0x6336('0x38')](_0xa293bb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x7d50dc){return logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x64'),util['inspect'](_0x7d50dc,{'showHidden':![],'depth':null}));});}else{return logger[_0x6336('0x1c')](_0x6336('0x2c'),_0x6336('0x2b'),_0x6336('0x64'),_0x6336('0x6b'));}break;}}})[_0x6336('0x6c')](function(){_0x2938af();});}else{_0x2938af();}}},'charset':_0x6336('0x6d'),'collate':_0x6336('0x6e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index a96c4a1..fffb522 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 _0x57ca=['jayson/promise','client','http','redis','defaults','localhost','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','body','options','raw','then','info','CreateSmsMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57ca,0x108));var _0xa57c=function(_0x556f49,_0x3c57e0){_0x556f49=_0x556f49-0x0;var _0x5e2ae6=_0x57ca[_0x556f49];return _0x5e2ae6;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});config[_0xa57c('0xb')]=_[_0xa57c('0xc')](config[_0xa57c('0xb')],{'host':_0xa57c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0xb')]));require('./smsMessage.socket')[_0xa57c('0xe')](socket);function respondWithRpcPromise(_0x932dcc,_0x4fa5ed,_0x156bca){return new BPromise(function(_0x51f287,_0x554101){return client[_0xa57c('0xf')](_0x932dcc,_0x156bca)['then'](function(_0x2ed4c6){logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));logger[_0xa57c('0x12')](_0xa57c('0x13'),_0x4fa5ed,_0xa57c('0x11'),JSON['stringify'](_0x2ed4c6));if(_0x2ed4c6[_0xa57c('0x14')]){if(_0x2ed4c6['error'][_0xa57c('0x15')]===0x1f4){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x554101(_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);}logger['error'](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x51f287(_0x2ed4c6['error'][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));_0x51f287(_0x2ed4c6[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0x4728f9){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x4728f9);_0x554101(_0x4728f9);});});}exports['CreateSmsMessage']=function(_0x8a8856){var _0x4a53ab=this;return new Promise(function(_0x4a35bb,_0x418415){return db[_0xa57c('0x19')][_0xa57c('0x1a')](_0x8a8856[_0xa57c('0x1b')],{'raw':_0x8a8856['options']?_0x8a8856[_0xa57c('0x1c')][_0xa57c('0x1d')]===undefined?!![]:![]:!![]})[_0xa57c('0x1e')](function(_0x2213b2){logger[_0xa57c('0x1f')](_0xa57c('0x20'),_0x8a8856);logger[_0xa57c('0x12')](_0xa57c('0x20'),_0x8a8856,JSON[_0xa57c('0x21')](_0x2213b2));_0x4a35bb(_0x2213b2);})[_0xa57c('0x18')](function(_0x382a26){logger[_0xa57c('0x14')](_0xa57c('0x20'),_0x382a26[_0xa57c('0x16')],_0x8a8856);_0x418415(_0x4a53ab[_0xa57c('0x14')](0x1f4,_0x382a26['message']));});});}; \ No newline at end of file +var _0x5f2f=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ac865,_0x35ed3c){var _0xb88304=function(_0x1f4a7b){while(--_0x1f4a7b){_0x2ac865['push'](_0x2ac865['shift']());}};_0xb88304(++_0x35ed3c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3a1d55,_0x3aae53){_0x3a1d55=_0x3a1d55-0x0;var _0x14b44f=_0x5f2f[_0x3a1d55];return _0x14b44f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./smsMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateSmsMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ec5c3c1..411a8d5 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 _0x5f52=['smsMessage:','./smsMessage.events','remove','emit','removeListener','register'];(function(_0x1c5383,_0x204245){var _0x5b0090=function(_0x8f9b71){while(--_0x8f9b71){_0x1c5383['push'](_0x1c5383['shift']());}};_0x5b0090(++_0x204245);}(_0x5f52,0x18d));var _0x25f5=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x5f52[_0x2160a9];return _0xa88cf7;};'use strict';var SmsMessageEvents=require(_0x25f5('0x0'));var events=['save',_0x25f5('0x1'),'update'];function createListener(_0x3f0917,_0x39c099){return function(_0x362a44){_0x39c099[_0x25f5('0x2')](_0x3f0917,_0x362a44);};}function removeListener(_0xb3bf40,_0x8efed1){return function(){SmsMessageEvents[_0x25f5('0x3')](_0xb3bf40,_0x8efed1);};}exports[_0x25f5('0x4')]=function(_0x3f37c7){for(var _0x2eed4c=0x0,_0x2c4156=events['length'];_0x2eed4c<_0x2c4156;_0x2eed4c++){var _0x1bd576=events[_0x2eed4c];var _0x5af865=createListener(_0x25f5('0x5')+_0x1bd576,_0x3f37c7);SmsMessageEvents['on'](_0x1bd576,_0x5af865);}}; \ No newline at end of file +var _0xa08b=['register','smsMessage:','save','remove','emit'];(function(_0x52fead,_0x35b04e){var _0x548106=function(_0x4edb43){while(--_0x4edb43){_0x52fead['push'](_0x52fead['shift']());}};_0x548106(++_0x35b04e);}(_0xa08b,0x7f));var _0xba08=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xa08b[_0x5a9c0c];return _0x53c77d;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xba08('0x0'),_0xba08('0x1'),'update'];function createListener(_0x274fe1,_0x4dce25){return function(_0x59947a){_0x4dce25[_0xba08('0x2')](_0x274fe1,_0x59947a);};}function removeListener(_0x7af24,_0x139240){return function(){SmsMessageEvents['removeListener'](_0x7af24,_0x139240);};}exports[_0xba08('0x3')]=function(_0x127eee){for(var _0x2c7b3a=0x0,_0x2dcafd=events['length'];_0x2c7b3a<_0x2dcafd;_0x2c7b3a++){var _0x5e04ac=events[_0x2c7b3a];var _0x1776ff=createListener(_0xba08('0x4')+_0x5e04ac,_0x127eee);SmsMessageEvents['on'](_0x5e04ac,_0x1776ff);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d08b7d3..4397f0b 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 _0x3914=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x379d1b,_0x9ce06e){var _0x154680=function(_0x3243bf){while(--_0x3243bf){_0x379d1b['push'](_0x379d1b['shift']());}};_0x154680(++_0x9ce06e);}(_0x3914,0xeb));var _0x4391=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x3914[_0x343090];return _0x3ff3e8;};'use strict';var multer=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var path=require('path');var timeout=require(_0x4391('0x2'));var express=require(_0x4391('0x3'));var router=express['Router']();var auth=require(_0x4391('0x4'));var interaction=require(_0x4391('0x5'));var config=require(_0x4391('0x6'));var controller=require('./smsQueue.controller');router[_0x4391('0x7')]('/',auth[_0x4391('0x8')](),controller['index']);router[_0x4391('0x7')]('/describe',auth[_0x4391('0x8')](),controller['describe']);router[_0x4391('0x7')](_0x4391('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4391('0x7')](_0x4391('0xa'),auth[_0x4391('0x8')](),controller['getMembers']);router[_0x4391('0x7')](_0x4391('0xb'),auth[_0x4391('0x8')](),controller[_0x4391('0xc')]);router['get'](_0x4391('0xd'),auth[_0x4391('0x8')](),controller[_0x4391('0xe')]);router[_0x4391('0xf')]('/',auth[_0x4391('0x8')](),controller[_0x4391('0x10')]);router[_0x4391('0xf')](_0x4391('0xb'),auth['isAuthenticated'](),controller[_0x4391('0x11')]);router[_0x4391('0xf')](_0x4391('0xd'),auth[_0x4391('0x8')](),controller['addAgents']);router[_0x4391('0x12')]('/:id',auth[_0x4391('0x8')](),controller[_0x4391('0x13')]);router[_0x4391('0x14')](_0x4391('0x9'),auth[_0x4391('0x8')](),controller[_0x4391('0x15')]);router[_0x4391('0x14')](_0x4391('0xb'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4391('0x14')]('/:id/users',auth[_0x4391('0x8')](),controller[_0x4391('0x16')]);module[_0x4391('0x17')]=router; \ No newline at end of file +var _0x0324=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','put','/:id','update','delete','destroy','removeTeams','removeAgents','util'];(function(_0x2d4f39,_0x304df7){var _0x288de5=function(_0x3558b3){while(--_0x3558b3){_0x2d4f39['push'](_0x2d4f39['shift']());}};_0x288de5(++_0x304df7);}(_0x0324,0x90));var _0x4032=function(_0x47a06e,_0x25bede){_0x47a06e=_0x47a06e-0x0;var _0x1e6282=_0x0324[_0x47a06e];return _0x1e6282;};'use strict';var multer=require('multer');var util=require(_0x4032('0x0'));var path=require(_0x4032('0x1'));var timeout=require(_0x4032('0x2'));var express=require(_0x4032('0x3'));var router=express[_0x4032('0x4')]();var auth=require(_0x4032('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4032('0x6'));var controller=require(_0x4032('0x7'));router[_0x4032('0x8')]('/',auth[_0x4032('0x9')](),controller[_0x4032('0xa')]);router[_0x4032('0x8')]('/describe',auth[_0x4032('0x9')](),controller[_0x4032('0xb')]);router['get']('/:id',auth[_0x4032('0x9')](),controller[_0x4032('0xc')]);router['get'](_0x4032('0xd'),auth[_0x4032('0x9')](),controller[_0x4032('0xe')]);router[_0x4032('0x8')]('/:id/teams',auth[_0x4032('0x9')](),controller[_0x4032('0xf')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x4032('0x10')]);router[_0x4032('0x11')]('/',auth[_0x4032('0x9')](),controller[_0x4032('0x12')]);router[_0x4032('0x11')](_0x4032('0x13'),auth[_0x4032('0x9')](),controller[_0x4032('0x14')]);router[_0x4032('0x11')](_0x4032('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0x4032('0x16')](_0x4032('0x17'),auth[_0x4032('0x9')](),controller[_0x4032('0x18')]);router[_0x4032('0x19')](_0x4032('0x17'),auth['isAuthenticated'](),controller[_0x4032('0x1a')]);router['delete']('/:id/teams',auth[_0x4032('0x9')](),controller[_0x4032('0x1b')]);router[_0x4032('0x19')](_0x4032('0x15'),auth[_0x4032('0x9')](),controller[_0x4032('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index ff78b4d..b48f089 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 _0xc50a=['INTEGER','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x314085,_0x4235c6){var _0x26190a=function(_0x2314a2){while(--_0x2314a2){_0x314085['push'](_0x314085['shift']());}};_0x26190a(++_0x4235c6);}(_0xc50a,0x122));var _0xac50=function(_0x52de99,_0x3e9a19){_0x52de99=_0x52de99-0x0;var _0x3940de=_0xc50a[_0x52de99];return _0x3940de;};'use strict';var Sequelize=require(_0xac50('0x0'));module[_0xac50('0x1')]={'name':{'type':Sequelize[_0xac50('0x2')],'unique':_0xac50('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xac50('0x2')]},'timeout':{'type':Sequelize[_0xac50('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xac50('0x5'),_0xac50('0x6'))}}; \ No newline at end of file +var _0xf5f5=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x3f44b8,_0x1c5461){var _0x2e715e=function(_0x2fd6cf){while(--_0x2fd6cf){_0x3f44b8['push'](_0x3f44b8['shift']());}};_0x2e715e(++_0x1c5461);}(_0xf5f5,0x101));var _0x5f5f=function(_0x52c9f7,_0x5e9d83){_0x52c9f7=_0x52c9f7-0x0;var _0x47140a=_0xf5f5[_0x52c9f7];return _0x47140a;};'use strict';var Sequelize=require(_0x5f5f('0x0'));module[_0x5f5f('0x1')]={'name':{'type':Sequelize[_0x5f5f('0x2')],'unique':_0x5f5f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5f5f('0x2')]},'timeout':{'type':Sequelize[_0x5f5f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5f5f('0x5')](_0x5f5f('0x6'),_0x5f5f('0x7'),_0x5f5f('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f5a5973..2ba5bf9 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 _0x35e3=['defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','SmsQueues','UserProfileResource','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','options','SmsQueue','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','pick','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','interface','sequelize','each','forEach','emit','userSmsQueue:save','removeTeams','select','field','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','zip-dir','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x51c0e6,_0x149647){var _0x2fb06e=function(_0x14c9f4){while(--_0x14c9f4){_0x51c0e6['push'](_0x51c0e6['shift']());}};_0x2fb06e(++_0x149647);}(_0x35e3,0x71));var _0x335e=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x35e3[_0x4b1032];return _0x5a1d55;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x335e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x335e('0x1'));var moment=require(_0x335e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x335e('0x3'));var path=require(_0x335e('0x4'));var sox=require(_0x335e('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x335e('0x6'));var squel=require(_0x335e('0x7'));var crypto=require(_0x335e('0x8'));var jsforce=require(_0x335e('0x9'));var deskjs=require(_0x335e('0xa'));var toCsv=require(_0x335e('0xb'));var querystring=require(_0x335e('0xc'));var Papa=require(_0x335e('0xd'));var Redis=require(_0x335e('0xe'));var authService=require(_0x335e('0xf'));var qs=require(_0x335e('0x10'));var as=require(_0x335e('0x11'));var hardwareService=require(_0x335e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x335e('0x13'));var config=require(_0x335e('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x335e('0x15')](config[_0x335e('0x16')],{'host':_0x335e('0x17'),'port':0x18eb});var socket=require(_0x335e('0x18'))(new Redis(config[_0x335e('0x16')]));require(_0x335e('0x19'))[_0x335e('0x1a')](socket);function respondWithStatusCode(_0x4dabd0,_0x33cc1e){_0x33cc1e=_0x33cc1e||0xcc;return function(_0x58ca60){if(_0x58ca60){return _0x4dabd0['sendStatus'](_0x33cc1e);}return _0x4dabd0[_0x335e('0x1b')](_0x33cc1e)[_0x335e('0x1c')]();};}function respondWithResult(_0x265562,_0x289de3){_0x289de3=_0x289de3||0xc8;return function(_0x16eeb7){if(_0x16eeb7){return _0x265562['status'](_0x289de3)[_0x335e('0x1d')](_0x16eeb7);}};}function respondWithFilteredResult(_0x4bf347,_0xa4a469){return function(_0x250fbd){if(_0x250fbd){var _0xaed1e2=_0x250fbd[_0x335e('0x1e')],_0x25715c=_0xa4a469[_0x335e('0x1f')],_0x45e3ae=_0xa4a469['offset']+_0xa4a469[_0x335e('0x20')],_0x5f5254;if(_0x45e3ae>=_0xaed1e2){_0x45e3ae=_0xaed1e2;_0x5f5254=0xc8;}else{_0x5f5254=0xce;}_0x4bf347['status'](_0x5f5254);return _0x4bf347['set'](_0x335e('0x21'),_0x25715c+'-'+_0x45e3ae+'/'+_0xaed1e2)[_0x335e('0x1d')](_0x250fbd);}return null;};}function patchUpdates(_0x539591){return function(_0x7bb69d){try{jsonpatch[_0x335e('0x22')](_0x7bb69d,_0x539591,!![]);}catch(_0x20d15e){return BPromise[_0x335e('0x23')](_0x20d15e);}return _0x7bb69d[_0x335e('0x24')]();};}function saveUpdates(_0x31df5e,_0x1383a9){return function(_0x27e548){if(_0x27e548){return _0x27e548[_0x335e('0x25')](_0x31df5e)['then'](function(_0x17641f){return _0x17641f;});}return null;};}function removeEntity(_0x48822a,_0x439ebd){return function(_0x41d39e){if(_0x41d39e){return _0x41d39e[_0x335e('0x26')]()[_0x335e('0x27')](function(){var _0x5d8ba1=_0x41d39e[_0x335e('0x28')]({'plain':!![]});var _0x9b7bf9=_0x335e('0x29');return db[_0x335e('0x2a')][_0x335e('0x26')]({'where':{'type':_0x9b7bf9,'resourceId':_0x5d8ba1['id']}})[_0x335e('0x27')](function(){return _0x41d39e;});})['then'](function(){_0x48822a[_0x335e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62005d,_0x1ea39){return function(_0x27b27b){if(!_0x27b27b){_0x62005d[_0x335e('0x2b')](0x194);}return _0x27b27b;};}function handleError(_0x53ad86,_0x333331){_0x333331=_0x333331||0x1f4;return function(_0x5a2428){logger['error'](_0x5a2428['stack']);if(_0x5a2428['name']){delete _0x5a2428[_0x335e('0x2c')];}_0x53ad86[_0x335e('0x1b')](_0x333331)[_0x335e('0x2d')](_0x5a2428);};}exports[_0x335e('0x2e')]=function(_0x247e0e,_0x4196c7){var _0x40dac2={},_0x759a02={},_0x19e861={'count':0x0,'rows':[]};var _0x156687=_[_0x335e('0x2f')](db['SmsQueue'][_0x335e('0x30')],function(_0x6003d){return{'name':_0x6003d[_0x335e('0x31')],'type':_0x6003d[_0x335e('0x32')][_0x335e('0x33')]};});_0x759a02[_0x335e('0x34')]=_[_0x335e('0x2f')](_0x156687,'name');_0x759a02[_0x335e('0x35')]=_[_0x335e('0x36')](_0x247e0e[_0x335e('0x35')]);_0x759a02[_0x335e('0x37')]=_[_0x335e('0x38')](_0x759a02[_0x335e('0x34')],_0x759a02[_0x335e('0x35')]);_0x40dac2[_0x335e('0x39')]=_['intersection'](_0x759a02[_0x335e('0x34')],qs[_0x335e('0x3a')](_0x247e0e[_0x335e('0x35')][_0x335e('0x3a')]));_0x40dac2[_0x335e('0x39')]=_0x40dac2[_0x335e('0x39')]['length']?_0x40dac2[_0x335e('0x39')]:_0x759a02['model'];if(!_0x247e0e[_0x335e('0x35')]['hasOwnProperty'](_0x335e('0x3b'))){_0x40dac2[_0x335e('0x20')]=qs[_0x335e('0x20')](_0x247e0e[_0x335e('0x35')][_0x335e('0x20')]);_0x40dac2[_0x335e('0x1f')]=qs[_0x335e('0x1f')](_0x247e0e[_0x335e('0x35')][_0x335e('0x1f')]);}_0x40dac2[_0x335e('0x3c')]=qs[_0x335e('0x3d')](_0x247e0e[_0x335e('0x35')][_0x335e('0x3d')]);_0x40dac2[_0x335e('0x3e')]=qs[_0x335e('0x37')](_['pick'](_0x247e0e[_0x335e('0x35')],_0x759a02[_0x335e('0x37')]),_0x156687);if(_0x247e0e[_0x335e('0x35')]['filter']){_0x40dac2[_0x335e('0x3e')]=_['merge'](_0x40dac2[_0x335e('0x3e')],{'$or':_[_0x335e('0x2f')](_0x156687,function(_0x324dab){if(_0x324dab[_0x335e('0x32')]!==_0x335e('0x3f')){var _0x503c98={};_0x503c98[_0x324dab[_0x335e('0x2c')]]={'$like':'%'+_0x247e0e[_0x335e('0x35')][_0x335e('0x40')]+'%'};return _0x503c98;}})});}_0x40dac2=_['merge']({},_0x40dac2,_0x247e0e[_0x335e('0x41')]);var _0x355ffc={'where':_0x40dac2['where']};return db[_0x335e('0x42')]['count'](_0x355ffc)[_0x335e('0x27')](function(_0x3a7c09){_0x19e861['count']=_0x3a7c09;if(_0x247e0e[_0x335e('0x35')][_0x335e('0x43')]){_0x40dac2[_0x335e('0x44')]=[{'all':!![]}];}return db['SmsQueue'][_0x335e('0x45')](_0x40dac2);})[_0x335e('0x27')](function(_0xf80f96){_0x19e861[_0x335e('0x46')]=_0xf80f96;return _0x19e861;})[_0x335e('0x27')](respondWithFilteredResult(_0x4196c7,_0x40dac2))[_0x335e('0x47')](handleError(_0x4196c7,null));};exports[_0x335e('0x48')]=function(_0x111875,_0x59a334){var _0x36ca1e={'raw':!![],'where':{'id':_0x111875[_0x335e('0x49')]['id']}},_0x53b2af={};_0x53b2af[_0x335e('0x34')]=_[_0x335e('0x36')](db[_0x335e('0x42')][_0x335e('0x30')]);_0x53b2af['query']=_[_0x335e('0x36')](_0x111875['query']);_0x53b2af['filters']=_['intersection'](_0x53b2af['model'],_0x53b2af['query']);_0x36ca1e['attributes']=_[_0x335e('0x38')](_0x53b2af[_0x335e('0x34')],qs[_0x335e('0x3a')](_0x111875[_0x335e('0x35')]['fields']));_0x36ca1e['attributes']=_0x36ca1e['attributes'][_0x335e('0x4a')]?_0x36ca1e[_0x335e('0x39')]:_0x53b2af['model'];if(_0x111875[_0x335e('0x35')]['includeAll']){_0x36ca1e['include']=[{'all':!![]}];}_0x36ca1e=_[_0x335e('0x4b')]({},_0x36ca1e,_0x111875['options']);return db[_0x335e('0x42')][_0x335e('0x4c')](_0x36ca1e)[_0x335e('0x27')](handleEntityNotFound(_0x59a334,null))[_0x335e('0x27')](respondWithResult(_0x59a334,null))[_0x335e('0x47')](handleError(_0x59a334,null));};exports[_0x335e('0x4d')]=function(_0x37c2fb,_0x54d322){return db['SmsQueue'][_0x335e('0x4d')](_0x37c2fb[_0x335e('0x4e')],{})[_0x335e('0x27')](function(_0x2c4ac2){var _0xfe5691=_0x37c2fb[_0x335e('0x4f')][_0x335e('0x28')]({'plain':!![]});if(!_0xfe5691)throw new Error(_0x335e('0x50'));if(_0xfe5691['role']===_0x335e('0x4f')){var _0x4fde7f=_0x2c4ac2[_0x335e('0x28')]({'plain':!![]});var _0xd5a0e4=_0x335e('0x29');return db['UserProfileSection'][_0x335e('0x4c')]({'where':{'name':_0xd5a0e4,'userProfileId':_0xfe5691[_0x335e('0x51')]},'raw':!![]})[_0x335e('0x27')](function(_0x4212ac){if(_0x4212ac&&_0x4212ac[_0x335e('0x52')]===0x0){return db[_0x335e('0x2a')]['create']({'name':_0x4fde7f[_0x335e('0x2c')],'resourceId':_0x4fde7f['id'],'type':_0x4212ac[_0x335e('0x2c')],'sectionId':_0x4212ac['id']},{})['then'](function(){return _0x2c4ac2;});}else{return _0x2c4ac2;}})[_0x335e('0x47')](function(_0x26f37e){logger[_0x335e('0x53')](_0x335e('0x54'),_0x26f37e);throw _0x26f37e;});}return _0x2c4ac2;})[_0x335e('0x27')](respondWithResult(_0x54d322,0xc9))['catch'](handleError(_0x54d322,null));};exports[_0x335e('0x25')]=function(_0x6ac4b5,_0x2d9522){if(_0x6ac4b5[_0x335e('0x4e')]['id']){delete _0x6ac4b5[_0x335e('0x4e')]['id'];}return db['SmsQueue'][_0x335e('0x4c')]({'where':{'id':_0x6ac4b5['params']['id']}})[_0x335e('0x27')](handleEntityNotFound(_0x2d9522,null))['then'](saveUpdates(_0x6ac4b5['body'],null))['then'](respondWithResult(_0x2d9522,null))[_0x335e('0x47')](handleError(_0x2d9522,null));};exports[_0x335e('0x26')]=function(_0x434167,_0x4965c){return db['SmsQueue'][_0x335e('0x4c')]({'where':{'id':_0x434167[_0x335e('0x49')]['id']}})[_0x335e('0x27')](handleEntityNotFound(_0x4965c,null))[_0x335e('0x27')](removeEntity(_0x4965c,null))['catch'](handleError(_0x4965c,null));};exports['describe']=function(_0x269736,_0x4959ce){return db[_0x335e('0x42')][_0x335e('0x55')]()[_0x335e('0x27')](respondWithResult(_0x4959ce,null))['catch'](handleError(_0x4959ce,null));};exports[_0x335e('0x56')]=function(_0x3826aa,_0x34211c,_0x2877d9){var _0x400fe2={'raw':!![],'where':{}},_0x552b4f={},_0x44abd7;return db['SmsQueue'][_0x335e('0x57')]({'where':{'id':_0x3826aa[_0x335e('0x49')]['id']}})[_0x335e('0x27')](handleEntityNotFound(_0x34211c,null))[_0x335e('0x27')](function(_0x8c418f){if(_0x8c418f){_0x44abd7=_0x8c418f[_0x335e('0x28')]({'plain':!![]});_0x552b4f[_0x335e('0x34')]=_[_0x335e('0x36')](db[_0x335e('0x58')][_0x335e('0x30')]);_0x552b4f[_0x335e('0x35')]=_['keys'](_0x3826aa[_0x335e('0x35')]);_0x552b4f[_0x335e('0x37')]=_[_0x335e('0x38')](_0x552b4f[_0x335e('0x34')],_0x552b4f[_0x335e('0x35')]);_0x400fe2[_0x335e('0x39')]=_[_0x335e('0x38')](_0x552b4f[_0x335e('0x34')],qs[_0x335e('0x3a')](_0x3826aa[_0x335e('0x35')][_0x335e('0x3a')]));_0x400fe2[_0x335e('0x39')]=_0x400fe2[_0x335e('0x39')][_0x335e('0x4a')]?_0x400fe2[_0x335e('0x39')]:_0x552b4f['model'];if(!_0x3826aa[_0x335e('0x35')][_0x335e('0x59')](_0x335e('0x3b'))){_0x400fe2[_0x335e('0x20')]=qs[_0x335e('0x20')](_0x3826aa['query'][_0x335e('0x20')]);_0x400fe2[_0x335e('0x1f')]=qs[_0x335e('0x1f')](_0x3826aa['query'][_0x335e('0x1f')]);}_0x400fe2['order']=qs[_0x335e('0x3d')](_0x3826aa[_0x335e('0x35')][_0x335e('0x3d')]);_0x400fe2[_0x335e('0x3e')]=qs[_0x335e('0x37')](_[_0x335e('0x5a')](_0x3826aa[_0x335e('0x35')],_0x552b4f[_0x335e('0x37')]));_0x400fe2[_0x335e('0x3e')]['SmsQueueId']=_0x8c418f['id'];if(_0x3826aa['query'][_0x335e('0x40')]){_0x400fe2[_0x335e('0x3e')]=_['merge'](_0x400fe2[_0x335e('0x3e')],{'$or':_['map'](_0x400fe2[_0x335e('0x39')],function(_0x582dc0){var _0x469036={};_0x469036[_0x582dc0]={'$like':'%'+_0x3826aa[_0x335e('0x35')][_0x335e('0x40')]+'%'};return _0x469036;})});}_0x400fe2=_['merge']({},_0x400fe2,_0x3826aa['options']);return db[_0x335e('0x58')][_0x335e('0x45')](_0x400fe2);}})[_0x335e('0x27')](function(_0x2f3bc5){if(_0x2f3bc5){return db[_0x335e('0x5b')][_0x335e('0x5c')]({'where':{'id':_[_0x335e('0x2f')](_0x2f3bc5,_0x335e('0x5d')),'role':'agent'},'attributes':['id',_0x335e('0x2c'),_0x335e('0x5e'),_0x335e('0x5f'),_0x335e('0x60')]});}})[_0x335e('0x27')](function(_0x3f7abd){if(_0x3f7abd){return{'count':_0x3f7abd[_0x335e('0x1e')],'rows':_[_0x335e('0x2f')](_0x3f7abd[_0x335e('0x46')],function(_0x4803fb){return{'membername':_0x4803fb[_0x335e('0x2c')],'UserId':_0x4803fb['id'],'queue_name':_0x44abd7[_0x335e('0x2c')],'SmsQueueId':_0x44abd7['id'],'interface':util[_0x335e('0x61')](_0x335e('0x62'),_0x335e('0x63'),_0x4803fb[_0x335e('0x2c')]),'penalty':0x0,'paused':_0x4803fb[_0x335e('0x5e')],'createdAt':_0x4803fb[_0x335e('0x60')],'updatedAt':_0x4803fb[_0x335e('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x34211c,_0x400fe2))[_0x335e('0x47')](handleError(_0x34211c,null));};exports[_0x335e('0x64')]=function(_0x680d20,_0x3e1569,_0x27f231){var _0x4e10f1={};var _0x456f5a={};var _0x2d4c06;var _0x1247a7;return db[_0x335e('0x42')][_0x335e('0x57')]({'where':{'id':_0x680d20['params']['id']}})['then'](handleEntityNotFound(_0x3e1569,null))['then'](function(_0x156e09){if(_0x156e09){_0x2d4c06=_0x156e09;_0x456f5a[_0x335e('0x34')]=_['keys'](db[_0x335e('0x65')]['rawAttributes']);_0x456f5a[_0x335e('0x35')]=_[_0x335e('0x36')](_0x680d20[_0x335e('0x35')]);_0x456f5a[_0x335e('0x37')]=_[_0x335e('0x38')](_0x456f5a[_0x335e('0x34')],_0x456f5a['query']);_0x4e10f1[_0x335e('0x39')]=_[_0x335e('0x38')](_0x456f5a[_0x335e('0x34')],qs[_0x335e('0x3a')](_0x680d20[_0x335e('0x35')][_0x335e('0x3a')]));_0x4e10f1[_0x335e('0x39')]=_0x4e10f1[_0x335e('0x39')][_0x335e('0x4a')]?_0x4e10f1[_0x335e('0x39')]:_0x456f5a[_0x335e('0x34')];_0x4e10f1[_0x335e('0x3c')]=qs[_0x335e('0x3d')](_0x680d20[_0x335e('0x35')][_0x335e('0x3d')]);_0x4e10f1[_0x335e('0x3e')]=qs[_0x335e('0x37')](_['pick'](_0x680d20[_0x335e('0x35')],_0x456f5a[_0x335e('0x37')]));if(_0x680d20[_0x335e('0x35')]['filter']){_0x4e10f1[_0x335e('0x3e')]=_[_0x335e('0x4b')](_0x4e10f1[_0x335e('0x3e')],{'$or':_[_0x335e('0x2f')](_0x4e10f1[_0x335e('0x39')],function(_0x53bfc4){var _0x69dac8={};_0x69dac8[_0x53bfc4]={'$like':'%'+_0x680d20[_0x335e('0x35')][_0x335e('0x40')]+'%'};return _0x69dac8;})});}_0x4e10f1=_[_0x335e('0x4b')]({},_0x4e10f1,_0x680d20[_0x335e('0x41')]);return _0x2d4c06['getTeams'](_0x4e10f1);}})[_0x335e('0x27')](function(_0x1857ec){if(_0x1857ec){_0x1247a7=_0x1857ec[_0x335e('0x4a')];if(!_0x680d20['query'][_0x335e('0x59')]('nolimit')){_0x4e10f1[_0x335e('0x20')]=qs[_0x335e('0x20')](_0x680d20[_0x335e('0x35')][_0x335e('0x20')]);_0x4e10f1[_0x335e('0x1f')]=qs['offset'](_0x680d20[_0x335e('0x35')]['offset']);}return _0x2d4c06[_0x335e('0x64')](_0x4e10f1);}})['then'](function(_0x47b2c4){if(_0x47b2c4){return _0x47b2c4?{'count':_0x1247a7,'rows':_0x47b2c4}:null;}})[_0x335e('0x27')](respondWithResult(_0x3e1569,null))[_0x335e('0x47')](handleError(_0x3e1569,null));};exports[_0x335e('0x66')]=function(_0x232831,_0x2d533e,_0x3492db){var _0xf64565=_0x232831[_0x335e('0x4e')][_0x335e('0x67')];return db['Team'][_0x335e('0x45')]({'where':{'id':_0xf64565},'attributes':['id'],'include':[{'model':db[_0x335e('0x5b')],'as':_0x335e('0x68'),'attributes':['id',_0x335e('0x2c'),'online','voicePause',_0x335e('0x69')],'raw':!![]}]})[_0x335e('0x27')](function(_0x32665c){if(_0x32665c){var _0xcee6ad=_['flatMap'](_0x32665c,function(_0x23521f){var _0x1c66f9=_0x23521f['get']({'plain':!![]});return _0x1c66f9['Agents'];});return db['SmsQueue'][_0x335e('0x4c')]({'where':{'id':_0x232831['params']['id']}})[_0x335e('0x27')](function(_0xe58a05){return db[_0x335e('0x6a')]['transaction'](function(_0x11b3e6){return _0xe58a05[_0x335e('0x66')](_0xf64565,{'transaction':_0x11b3e6})['then'](function(){return BPromise[_0x335e('0x6b')](_0xcee6ad,function(_0x980cb4){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x980cb4['id'],'SmsQueueId':_0x232831[_0x335e('0x49')]['id']},'transaction':_0x11b3e6});});})[_0x335e('0x27')](function(){_0xcee6ad[_0x335e('0x6c')](function(_0x1d7fb7){socket[_0x335e('0x6d')](_0x335e('0x6e'),{'UserId':_0x1d7fb7['id'],'SmsQueueId':_0xe58a05['id']});});});});});}})[_0x335e('0x27')](respondWithStatusCode(_0x2d533e,null))[_0x335e('0x47')](handleError(_0x2d533e,null));};exports[_0x335e('0x6f')]=function(_0x5735cc,_0x2956c0,_0x21f9a3){return db[_0x335e('0x65')][_0x335e('0x45')]({'where':{'id':_0x5735cc[_0x335e('0x35')][_0x335e('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x335e('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2956c0,null))[_0x335e('0x27')](function(_0x42738f){var _0x1a05f2=_['map'](_0x42738f,'id');var _0x54e566=[];var _0x365fe7=[];var _0x179508=squel[_0x335e('0x70')]();_0x179508[_0x335e('0x71')]('tq.TeamId')['from'](_0x335e('0x72'),'tq')[_0x335e('0x73')]('user_has_teams','ut',_0x335e('0x74'))['where']('SmsQueueId\x20=\x20?',_0x5735cc[_0x335e('0x49')]['id']);for(var _0x77a699=0x0;_0x77a699<_0x42738f['length'];_0x77a699+=0x1){let _0x40da79=_0x42738f[_0x77a699];for(var _0x7374=0x0;_0x7374<_0x40da79[_0x335e('0x68')][_0x335e('0x4a')];_0x7374+=0x1){let _0x5831f7=_0x40da79[_0x335e('0x68')][_0x7374];var _0x3cb3b5=_0x179508['clone']();_0x3cb3b5[_0x335e('0x3e')](_0x335e('0x75'),_0x5831f7['id']);_0x365fe7[_0x335e('0x76')](db[_0x335e('0x6a')]['query'](_0x3cb3b5[_0x335e('0x77')](),{'type':db[_0x335e('0x6a')][_0x335e('0x78')][_0x335e('0x79')]})['then'](function(_0xddb19b){if(_0xddb19b['length']===0x1){return _0x5831f7['id'];}else{var _0x18bdc3=_['every'](_[_0x335e('0x2f')](_0xddb19b,'TeamId'),function(_0x540df2){return _[_0x335e('0x7a')](_0x1a05f2,_0x540df2);});if(_0x18bdc3){return _0x5831f7['id'];}}}));}}return BPromise[_0x335e('0x7b')](_0x365fe7)[_0x335e('0x27')](function(_0x3c3a1b){_0x54e566=_(_0x54e566)[_0x335e('0x7c')](_0x3c3a1b)[_0x335e('0x7d')]()['value']();return db[_0x335e('0x42')][_0x335e('0x4c')]({'where':{'id':_0x5735cc['params']['id']}})[_0x335e('0x27')](function(_0x423b1c){return db[_0x335e('0x6a')][_0x335e('0x7e')](function(_0x3a0cf4){return _0x423b1c[_0x335e('0x6f')](_0x5735cc[_0x335e('0x35')][_0x335e('0x67')],{'transaction':_0x3a0cf4})['then'](function(){if(!_[_0x335e('0x7f')](_0x54e566)){return _0x423b1c[_0x335e('0x80')](_0x54e566,{'transaction':_0x3a0cf4});}})[_0x335e('0x27')](function(){_0x54e566['forEach'](function(_0x234a52){socket[_0x335e('0x6d')](_0x335e('0x81'),{'UserId':_0x234a52,'SmsQueueId':_0x423b1c['id']});});});});});});})[_0x335e('0x27')](respondWithStatusCode(_0x2956c0,null))[_0x335e('0x47')](handleError(_0x2956c0,null));};exports[_0x335e('0x82')]=function(_0x41f615,_0x2d1537,_0x1b86b9){return db['SmsQueue']['find']({'where':{'id':_0x41f615['params']['id']}})[_0x335e('0x27')](handleEntityNotFound(_0x2d1537,null))[_0x335e('0x27')](function(_0x20a9c2){if(_0x20a9c2){return _0x20a9c2['addAgents'](_0x41f615[_0x335e('0x4e')][_0x335e('0x67')],_[_0x335e('0x83')](_0x41f615[_0x335e('0x4e')],[_0x335e('0x67'),'id'])||{})[_0x335e('0x84')](function(_0x563f54){for(var _0x2e3147=0x0;_0x2e3147<_0x41f615[_0x335e('0x4e')]['ids'][_0x335e('0x4a')];_0x2e3147+=0x1){socket['emit']('userSmsQueue:save',{'UserId':_0x41f615[_0x335e('0x4e')][_0x335e('0x67')][_0x2e3147],'SmsQueueId':_0x41f615[_0x335e('0x49')]['id']});}return _0x563f54;});}})[_0x335e('0x27')](respondWithResult(_0x2d1537,null))[_0x335e('0x47')](handleError(_0x2d1537,null));};exports[_0x335e('0x80')]=function(_0x5c5dfd,_0x5a5589,_0x32bee5){return db['SmsQueue'][_0x335e('0x4c')]({'where':{'id':_0x5c5dfd['params']['id']}})[_0x335e('0x27')](handleEntityNotFound(_0x5a5589,null))[_0x335e('0x27')](function(_0x4cdb4e){if(_0x4cdb4e){return _0x4cdb4e[_0x335e('0x80')](_0x5c5dfd[_0x335e('0x35')][_0x335e('0x67')])['then'](function(){if(_['isArray'](_0x5c5dfd['query'][_0x335e('0x67')])){for(var _0x3669e7=0x0;_0x3669e7<_0x5c5dfd[_0x335e('0x35')]['ids'][_0x335e('0x4a')];_0x3669e7+=0x1){socket[_0x335e('0x6d')](_0x335e('0x81'),{'UserId':Number(_0x5c5dfd[_0x335e('0x35')]['ids'][_0x3669e7]),'SmsQueueId':Number(_0x5c5dfd[_0x335e('0x49')]['id'])});}}else{socket[_0x335e('0x6d')](_0x335e('0x81'),{'UserId':Number(_0x5c5dfd[_0x335e('0x35')][_0x335e('0x67')]),'SmsQueueId':Number(_0x5c5dfd[_0x335e('0x49')]['id'])});}});}})[_0x335e('0x27')](respondWithStatusCode(_0x5a5589,null))[_0x335e('0x47')](handleError(_0x5a5589,null));};exports[_0x335e('0x85')]=function(_0x3c10a6,_0x29d215,_0x140c38){var _0x3e83a2={};var _0x3e7616={};var _0x12a501;var _0x8b79e0;return db[_0x335e('0x42')][_0x335e('0x57')]({'where':{'id':_0x3c10a6[_0x335e('0x49')]['id']}})[_0x335e('0x27')](handleEntityNotFound(_0x29d215,null))[_0x335e('0x27')](function(_0x591dd3){if(_0x591dd3){_0x12a501=_0x591dd3;_0x3e7616[_0x335e('0x34')]=_[_0x335e('0x36')](db[_0x335e('0x5b')]['rawAttributes']);_0x3e7616[_0x335e('0x35')]=_[_0x335e('0x36')](_0x3c10a6[_0x335e('0x35')]);_0x3e7616['filters']=_[_0x335e('0x38')](_0x3e7616[_0x335e('0x34')],_0x3e7616[_0x335e('0x35')]);_0x3e83a2[_0x335e('0x39')]=_[_0x335e('0x38')](_0x3e7616[_0x335e('0x34')],qs[_0x335e('0x3a')](_0x3c10a6[_0x335e('0x35')][_0x335e('0x3a')]));_0x3e83a2[_0x335e('0x39')]=_0x3e83a2[_0x335e('0x39')][_0x335e('0x4a')]?_0x3e83a2[_0x335e('0x39')]:_0x3e7616[_0x335e('0x34')];_0x3e83a2[_0x335e('0x3c')]=qs[_0x335e('0x3d')](_0x3c10a6[_0x335e('0x35')][_0x335e('0x3d')]);_0x3e83a2['where']=qs[_0x335e('0x37')](_[_0x335e('0x5a')](_0x3c10a6[_0x335e('0x35')],_0x3e7616[_0x335e('0x37')]));if(_0x3c10a6[_0x335e('0x35')][_0x335e('0x40')]){_0x3e83a2['where']=_[_0x335e('0x4b')](_0x3e83a2[_0x335e('0x3e')],{'$or':_[_0x335e('0x2f')](_0x3e83a2[_0x335e('0x39')],function(_0x30d637){var _0x4dc751={};_0x4dc751[_0x30d637]={'$like':'%'+_0x3c10a6[_0x335e('0x35')][_0x335e('0x40')]+'%'};return _0x4dc751;})});}_0x3e83a2=_[_0x335e('0x4b')]({},_0x3e83a2,_0x3c10a6[_0x335e('0x41')]);return _0x12a501['getAgents'](_0x3e83a2);}})[_0x335e('0x27')](function(_0x5463aa){if(_0x5463aa){_0x8b79e0=_0x5463aa[_0x335e('0x4a')];if(!_0x3c10a6[_0x335e('0x35')][_0x335e('0x59')]('nolimit')){_0x3e83a2[_0x335e('0x20')]=qs[_0x335e('0x20')](_0x3c10a6[_0x335e('0x35')][_0x335e('0x20')]);_0x3e83a2[_0x335e('0x1f')]=qs[_0x335e('0x1f')](_0x3c10a6[_0x335e('0x35')][_0x335e('0x1f')]);}return _0x12a501[_0x335e('0x85')](_0x3e83a2);}})[_0x335e('0x27')](function(_0x1e9a4e){if(_0x1e9a4e){return _0x1e9a4e?{'count':_0x8b79e0,'rows':_0x1e9a4e}:null;}})[_0x335e('0x27')](respondWithResult(_0x29d215,null))['catch'](handleError(_0x29d215,null));}; \ No newline at end of file +var _0x1736=['params','keys','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','rawAttributes','ids','Agents','online','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','then','SmsQueues','error','stack','send','fieldName','type','key','map','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','options','SmsQueue','includeAll','include','findAll','catch'];(function(_0x96b17d,_0x4dcf0a){var _0x2f9426=function(_0x1fc1c2){while(--_0x1fc1c2){_0x96b17d['push'](_0x96b17d['shift']());}};_0x2f9426(++_0x4dcf0a);}(_0x1736,0x1d9));var _0x6173=function(_0x5155e9,_0x9b5255){_0x5155e9=_0x5155e9-0x0;var _0x6e0681=_0x1736[_0x5155e9];return _0x6e0681;};'use strict';var pdf=require(_0x6173('0x0'));var emlformat=require(_0x6173('0x1'));var rimraf=require(_0x6173('0x2'));var zipdir=require(_0x6173('0x3'));var jsonpatch=require(_0x6173('0x4'));var rp=require(_0x6173('0x5'));var moment=require(_0x6173('0x6'));var BPromise=require(_0x6173('0x7'));var Mustache=require(_0x6173('0x8'));var util=require(_0x6173('0x9'));var path=require('path');var sox=require(_0x6173('0xa'));var csv=require(_0x6173('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6173('0xc'));var squel=require(_0x6173('0xd'));var crypto=require(_0x6173('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6173('0xf'));var toCsv=require(_0x6173('0xb'));var querystring=require(_0x6173('0x10'));var Papa=require(_0x6173('0x11'));var Redis=require(_0x6173('0x12'));var authService=require(_0x6173('0x13'));var qs=require(_0x6173('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6173('0x15'));var logger=require('../../config/logger')(_0x6173('0x16'));var utils=require('../../config/utils');var config=require(_0x6173('0x17'));var db=require(_0x6173('0x18'))['db'];config[_0x6173('0x19')]=_[_0x6173('0x1a')](config[_0x6173('0x19')],{'host':_0x6173('0x1b'),'port':0x18eb});var socket=require(_0x6173('0x1c'))(new Redis(config[_0x6173('0x19')]));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x51b905,_0x2d6a32){_0x2d6a32=_0x2d6a32||0xcc;return function(_0x3bb14f){if(_0x3bb14f){return _0x51b905[_0x6173('0x1d')](_0x2d6a32);}return _0x51b905[_0x6173('0x1e')](_0x2d6a32)[_0x6173('0x1f')]();};}function respondWithResult(_0x2fdafe,_0x13b6e2){_0x13b6e2=_0x13b6e2||0xc8;return function(_0x2a4f8b){if(_0x2a4f8b){return _0x2fdafe['status'](_0x13b6e2)[_0x6173('0x20')](_0x2a4f8b);}};}function respondWithFilteredResult(_0x1cef1e,_0xb70aad){return function(_0x530387){if(_0x530387){var _0x43ba97=_0x530387[_0x6173('0x21')],_0x247121=_0xb70aad[_0x6173('0x22')],_0x18741e=_0xb70aad['offset']+_0xb70aad[_0x6173('0x23')],_0x261b17;if(_0x18741e>=_0x43ba97){_0x18741e=_0x43ba97;_0x261b17=0xc8;}else{_0x261b17=0xce;}_0x1cef1e[_0x6173('0x1e')](_0x261b17);return _0x1cef1e[_0x6173('0x24')]('Content-Range',_0x247121+'-'+_0x18741e+'/'+_0x43ba97)[_0x6173('0x20')](_0x530387);}return null;};}function patchUpdates(_0x3b37a8){return function(_0x5170e7){try{jsonpatch[_0x6173('0x25')](_0x5170e7,_0x3b37a8,!![]);}catch(_0x2021f1){return BPromise[_0x6173('0x26')](_0x2021f1);}return _0x5170e7['save']();};}function saveUpdates(_0x1f7f3c,_0x200288){return function(_0x882dfc){if(_0x882dfc){return _0x882dfc['update'](_0x1f7f3c)['then'](function(_0x4683c5){return _0x4683c5;});}return null;};}function removeEntity(_0x45e4bc,_0x56dc3b){return function(_0x4663ef){if(_0x4663ef){return _0x4663ef[_0x6173('0x27')]()[_0x6173('0x28')](function(){var _0x1b658f=_0x4663ef['get']({'plain':!![]});var _0x1e1f22=_0x6173('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e1f22,'resourceId':_0x1b658f['id']}})['then'](function(){return _0x4663ef;});})['then'](function(){_0x45e4bc[_0x6173('0x1e')](0xcc)[_0x6173('0x1f')]();});}};}function handleEntityNotFound(_0x52cd29,_0x436826){return function(_0x14e485){if(!_0x14e485){_0x52cd29[_0x6173('0x1d')](0x194);}return _0x14e485;};}function handleError(_0x579054,_0x1cf6ea){_0x1cf6ea=_0x1cf6ea||0x1f4;return function(_0x44b3a7){logger[_0x6173('0x2a')](_0x44b3a7[_0x6173('0x2b')]);if(_0x44b3a7['name']){delete _0x44b3a7['name'];}_0x579054[_0x6173('0x1e')](_0x1cf6ea)[_0x6173('0x2c')](_0x44b3a7);};}exports['index']=function(_0x3308a0,_0x3b5c23){var _0x31c0eb={},_0x5d3dcc={},_0x1422dd={'count':0x0,'rows':[]};var _0x5de994=_['map'](db['SmsQueue']['rawAttributes'],function(_0x402ab8){return{'name':_0x402ab8[_0x6173('0x2d')],'type':_0x402ab8[_0x6173('0x2e')][_0x6173('0x2f')]};});_0x5d3dcc['model']=_[_0x6173('0x30')](_0x5de994,'name');_0x5d3dcc[_0x6173('0x31')]=_['keys'](_0x3308a0[_0x6173('0x31')]);_0x5d3dcc[_0x6173('0x32')]=_[_0x6173('0x33')](_0x5d3dcc['model'],_0x5d3dcc[_0x6173('0x31')]);_0x31c0eb['attributes']=_[_0x6173('0x33')](_0x5d3dcc['model'],qs['fields'](_0x3308a0[_0x6173('0x31')][_0x6173('0x34')]));_0x31c0eb[_0x6173('0x35')]=_0x31c0eb['attributes'][_0x6173('0x36')]?_0x31c0eb[_0x6173('0x35')]:_0x5d3dcc[_0x6173('0x37')];if(!_0x3308a0[_0x6173('0x31')][_0x6173('0x38')](_0x6173('0x39'))){_0x31c0eb['limit']=qs[_0x6173('0x23')](_0x3308a0[_0x6173('0x31')][_0x6173('0x23')]);_0x31c0eb[_0x6173('0x22')]=qs['offset'](_0x3308a0['query'][_0x6173('0x22')]);}_0x31c0eb[_0x6173('0x3a')]=qs['sort'](_0x3308a0[_0x6173('0x31')][_0x6173('0x3b')]);_0x31c0eb[_0x6173('0x3c')]=qs[_0x6173('0x32')](_[_0x6173('0x3d')](_0x3308a0[_0x6173('0x31')],_0x5d3dcc[_0x6173('0x32')]),_0x5de994);if(_0x3308a0[_0x6173('0x31')][_0x6173('0x3e')]){_0x31c0eb['where']=_[_0x6173('0x3f')](_0x31c0eb[_0x6173('0x3c')],{'$or':_['map'](_0x5de994,function(_0x4dd98f){if(_0x4dd98f[_0x6173('0x2e')]!=='VIRTUAL'){var _0x4a5ec1={};_0x4a5ec1[_0x4dd98f[_0x6173('0x40')]]={'$like':'%'+_0x3308a0[_0x6173('0x31')][_0x6173('0x3e')]+'%'};return _0x4a5ec1;}})});}_0x31c0eb=_[_0x6173('0x3f')]({},_0x31c0eb,_0x3308a0[_0x6173('0x41')]);var _0x3d63b8={'where':_0x31c0eb[_0x6173('0x3c')]};return db[_0x6173('0x42')][_0x6173('0x21')](_0x3d63b8)[_0x6173('0x28')](function(_0x3a594b){_0x1422dd[_0x6173('0x21')]=_0x3a594b;if(_0x3308a0[_0x6173('0x31')][_0x6173('0x43')]){_0x31c0eb[_0x6173('0x44')]=[{'all':!![]}];}return db[_0x6173('0x42')][_0x6173('0x45')](_0x31c0eb);})[_0x6173('0x28')](function(_0x98ebf){_0x1422dd['rows']=_0x98ebf;return _0x1422dd;})[_0x6173('0x28')](respondWithFilteredResult(_0x3b5c23,_0x31c0eb))[_0x6173('0x46')](handleError(_0x3b5c23,null));};exports['show']=function(_0x205d44,_0xfb8703){var _0x5bdd17={'raw':!![],'where':{'id':_0x205d44[_0x6173('0x47')]['id']}},_0x58b9ea={};_0x58b9ea[_0x6173('0x37')]=_['keys'](db[_0x6173('0x42')]['rawAttributes']);_0x58b9ea[_0x6173('0x31')]=_[_0x6173('0x48')](_0x205d44['query']);_0x58b9ea['filters']=_[_0x6173('0x33')](_0x58b9ea[_0x6173('0x37')],_0x58b9ea[_0x6173('0x31')]);_0x5bdd17[_0x6173('0x35')]=_[_0x6173('0x33')](_0x58b9ea[_0x6173('0x37')],qs['fields'](_0x205d44['query']['fields']));_0x5bdd17[_0x6173('0x35')]=_0x5bdd17[_0x6173('0x35')][_0x6173('0x36')]?_0x5bdd17['attributes']:_0x58b9ea[_0x6173('0x37')];if(_0x205d44['query']['includeAll']){_0x5bdd17[_0x6173('0x44')]=[{'all':!![]}];}_0x5bdd17=_[_0x6173('0x3f')]({},_0x5bdd17,_0x205d44[_0x6173('0x41')]);return db[_0x6173('0x42')]['find'](_0x5bdd17)['then'](handleEntityNotFound(_0xfb8703,null))['then'](respondWithResult(_0xfb8703,null))[_0x6173('0x46')](handleError(_0xfb8703,null));};exports[_0x6173('0x49')]=function(_0x2fe882,_0x5da70b){return db[_0x6173('0x42')][_0x6173('0x49')](_0x2fe882['body'],{})[_0x6173('0x28')](function(_0x5b20fa){var _0x45db7c=_0x2fe882[_0x6173('0x4a')][_0x6173('0x4b')]({'plain':!![]});if(!_0x45db7c)throw new Error(_0x6173('0x4c'));if(_0x45db7c[_0x6173('0x4d')]===_0x6173('0x4a')){var _0x2ded84=_0x5b20fa['get']({'plain':!![]});var _0x3f0e85=_0x6173('0x29');return db[_0x6173('0x4e')][_0x6173('0x4f')]({'where':{'name':_0x3f0e85,'userProfileId':_0x45db7c['userProfileId']},'raw':!![]})[_0x6173('0x28')](function(_0x556b83){if(_0x556b83&&_0x556b83[_0x6173('0x50')]===0x0){return db['UserProfileResource'][_0x6173('0x49')]({'name':_0x2ded84[_0x6173('0x40')],'resourceId':_0x2ded84['id'],'type':_0x556b83['name'],'sectionId':_0x556b83['id']},{})[_0x6173('0x28')](function(){return _0x5b20fa;});}else{return _0x5b20fa;}})[_0x6173('0x46')](function(_0x122581){logger['error'](_0x6173('0x51'),_0x122581);throw _0x122581;});}return _0x5b20fa;})[_0x6173('0x28')](respondWithResult(_0x5da70b,0xc9))['catch'](handleError(_0x5da70b,null));};exports['update']=function(_0x51d177,_0x409c53){if(_0x51d177[_0x6173('0x52')]['id']){delete _0x51d177['body']['id'];}return db[_0x6173('0x42')]['find']({'where':{'id':_0x51d177[_0x6173('0x47')]['id']}})[_0x6173('0x28')](handleEntityNotFound(_0x409c53,null))[_0x6173('0x28')](saveUpdates(_0x51d177[_0x6173('0x52')],null))[_0x6173('0x28')](respondWithResult(_0x409c53,null))[_0x6173('0x46')](handleError(_0x409c53,null));};exports[_0x6173('0x27')]=function(_0x4a380e,_0x70bbe4){return db[_0x6173('0x42')]['find']({'where':{'id':_0x4a380e[_0x6173('0x47')]['id']}})['then'](handleEntityNotFound(_0x70bbe4,null))[_0x6173('0x28')](removeEntity(_0x70bbe4,null))[_0x6173('0x46')](handleError(_0x70bbe4,null));};exports[_0x6173('0x53')]=function(_0x1dd142,_0x3e34ea){return db['SmsQueue'][_0x6173('0x53')]()[_0x6173('0x28')](respondWithResult(_0x3e34ea,null))['catch'](handleError(_0x3e34ea,null));};exports[_0x6173('0x54')]=function(_0x2dac22,_0x42ad47,_0x32e128){var _0x2f442f={'raw':!![],'where':{}},_0x4b5843={},_0x4e80a4;return db['SmsQueue'][_0x6173('0x55')]({'where':{'id':_0x2dac22['params']['id']}})[_0x6173('0x28')](handleEntityNotFound(_0x42ad47,null))['then'](function(_0x5984cf){if(_0x5984cf){_0x4e80a4=_0x5984cf['get']({'plain':!![]});_0x4b5843[_0x6173('0x37')]=_[_0x6173('0x48')](db[_0x6173('0x56')]['rawAttributes']);_0x4b5843[_0x6173('0x31')]=_[_0x6173('0x48')](_0x2dac22[_0x6173('0x31')]);_0x4b5843['filters']=_[_0x6173('0x33')](_0x4b5843[_0x6173('0x37')],_0x4b5843[_0x6173('0x31')]);_0x2f442f[_0x6173('0x35')]=_[_0x6173('0x33')](_0x4b5843[_0x6173('0x37')],qs['fields'](_0x2dac22['query'][_0x6173('0x34')]));_0x2f442f[_0x6173('0x35')]=_0x2f442f[_0x6173('0x35')][_0x6173('0x36')]?_0x2f442f[_0x6173('0x35')]:_0x4b5843[_0x6173('0x37')];if(!_0x2dac22['query'][_0x6173('0x38')]('nolimit')){_0x2f442f['limit']=qs[_0x6173('0x23')](_0x2dac22[_0x6173('0x31')][_0x6173('0x23')]);_0x2f442f[_0x6173('0x22')]=qs[_0x6173('0x22')](_0x2dac22[_0x6173('0x31')][_0x6173('0x22')]);}_0x2f442f[_0x6173('0x3a')]=qs[_0x6173('0x3b')](_0x2dac22[_0x6173('0x31')][_0x6173('0x3b')]);_0x2f442f['where']=qs['filters'](_['pick'](_0x2dac22[_0x6173('0x31')],_0x4b5843['filters']));_0x2f442f[_0x6173('0x3c')]['SmsQueueId']=_0x5984cf['id'];if(_0x2dac22[_0x6173('0x31')][_0x6173('0x3e')]){_0x2f442f[_0x6173('0x3c')]=_[_0x6173('0x3f')](_0x2f442f[_0x6173('0x3c')],{'$or':_['map'](_0x2f442f['attributes'],function(_0x247b4d){var _0x189e5e={};_0x189e5e[_0x247b4d]={'$like':'%'+_0x2dac22[_0x6173('0x31')][_0x6173('0x3e')]+'%'};return _0x189e5e;})});}_0x2f442f=_[_0x6173('0x3f')]({},_0x2f442f,_0x2dac22[_0x6173('0x41')]);return db['UserSmsQueue'][_0x6173('0x45')](_0x2f442f);}})['then'](function(_0x3d3b9c){if(_0x3d3b9c){return db[_0x6173('0x57')][_0x6173('0x58')]({'where':{'id':_['map'](_0x3d3b9c,_0x6173('0x59')),'role':'agent'},'attributes':['id',_0x6173('0x40'),_0x6173('0x5a'),_0x6173('0x5b'),_0x6173('0x5c')]});}})[_0x6173('0x28')](function(_0x424831){if(_0x424831){return{'count':_0x424831['count'],'rows':_[_0x6173('0x30')](_0x424831[_0x6173('0x5d')],function(_0x4adeeb){return{'membername':_0x4adeeb[_0x6173('0x40')],'UserId':_0x4adeeb['id'],'queue_name':_0x4e80a4[_0x6173('0x40')],'SmsQueueId':_0x4e80a4['id'],'interface':util[_0x6173('0x5e')](_0x6173('0x5f'),'SIP',_0x4adeeb[_0x6173('0x40')]),'penalty':0x0,'paused':_0x4adeeb[_0x6173('0x5a')],'createdAt':_0x4adeeb[_0x6173('0x5c')],'updatedAt':_0x4adeeb[_0x6173('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x42ad47,_0x2f442f))[_0x6173('0x46')](handleError(_0x42ad47,null));};exports[_0x6173('0x60')]=function(_0x47ff3e,_0x280325,_0x13a3c9){var _0x14db22={};var _0x1679e7={};var _0x2f3a3f;var _0x354cd6;return db[_0x6173('0x42')][_0x6173('0x55')]({'where':{'id':_0x47ff3e[_0x6173('0x47')]['id']}})[_0x6173('0x28')](handleEntityNotFound(_0x280325,null))[_0x6173('0x28')](function(_0x5d2b6a){if(_0x5d2b6a){_0x2f3a3f=_0x5d2b6a;_0x1679e7[_0x6173('0x37')]=_[_0x6173('0x48')](db[_0x6173('0x61')][_0x6173('0x62')]);_0x1679e7[_0x6173('0x31')]=_[_0x6173('0x48')](_0x47ff3e[_0x6173('0x31')]);_0x1679e7[_0x6173('0x32')]=_[_0x6173('0x33')](_0x1679e7['model'],_0x1679e7[_0x6173('0x31')]);_0x14db22[_0x6173('0x35')]=_[_0x6173('0x33')](_0x1679e7['model'],qs[_0x6173('0x34')](_0x47ff3e[_0x6173('0x31')]['fields']));_0x14db22[_0x6173('0x35')]=_0x14db22[_0x6173('0x35')][_0x6173('0x36')]?_0x14db22[_0x6173('0x35')]:_0x1679e7[_0x6173('0x37')];_0x14db22[_0x6173('0x3a')]=qs[_0x6173('0x3b')](_0x47ff3e['query'][_0x6173('0x3b')]);_0x14db22[_0x6173('0x3c')]=qs[_0x6173('0x32')](_['pick'](_0x47ff3e['query'],_0x1679e7[_0x6173('0x32')]));if(_0x47ff3e[_0x6173('0x31')]['filter']){_0x14db22[_0x6173('0x3c')]=_[_0x6173('0x3f')](_0x14db22[_0x6173('0x3c')],{'$or':_[_0x6173('0x30')](_0x14db22['attributes'],function(_0x21cb62){var _0x5615f6={};_0x5615f6[_0x21cb62]={'$like':'%'+_0x47ff3e[_0x6173('0x31')][_0x6173('0x3e')]+'%'};return _0x5615f6;})});}_0x14db22=_[_0x6173('0x3f')]({},_0x14db22,_0x47ff3e[_0x6173('0x41')]);return _0x2f3a3f[_0x6173('0x60')](_0x14db22);}})[_0x6173('0x28')](function(_0x397dc7){if(_0x397dc7){_0x354cd6=_0x397dc7[_0x6173('0x36')];if(!_0x47ff3e[_0x6173('0x31')]['hasOwnProperty'](_0x6173('0x39'))){_0x14db22[_0x6173('0x23')]=qs[_0x6173('0x23')](_0x47ff3e[_0x6173('0x31')][_0x6173('0x23')]);_0x14db22['offset']=qs[_0x6173('0x22')](_0x47ff3e[_0x6173('0x31')][_0x6173('0x22')]);}return _0x2f3a3f[_0x6173('0x60')](_0x14db22);}})['then'](function(_0xbf69be){if(_0xbf69be){return _0xbf69be?{'count':_0x354cd6,'rows':_0xbf69be}:null;}})['then'](respondWithResult(_0x280325,null))[_0x6173('0x46')](handleError(_0x280325,null));};exports['addTeams']=function(_0x34929e,_0x1f7c10,_0x1393bc){var _0x4941ca=_0x34929e[_0x6173('0x52')][_0x6173('0x63')];return db[_0x6173('0x61')][_0x6173('0x45')]({'where':{'id':_0x4941ca},'attributes':['id'],'include':[{'model':db[_0x6173('0x57')],'as':_0x6173('0x64'),'attributes':['id','name',_0x6173('0x65'),'voicePause',_0x6173('0x66')],'raw':!![]}]})[_0x6173('0x28')](function(_0x1688f2){if(_0x1688f2){var _0xc6c83d=_[_0x6173('0x67')](_0x1688f2,function(_0x550bd2){var _0x400333=_0x550bd2['get']({'plain':!![]});return _0x400333[_0x6173('0x64')];});return db[_0x6173('0x42')]['find']({'where':{'id':_0x34929e[_0x6173('0x47')]['id']}})['then'](function(_0x3916a6){return db[_0x6173('0x68')]['transaction'](function(_0x5b2fb6){return _0x3916a6[_0x6173('0x69')](_0x4941ca,{'transaction':_0x5b2fb6})[_0x6173('0x28')](function(){return BPromise[_0x6173('0x6a')](_0xc6c83d,function(_0x580432){return db[_0x6173('0x56')][_0x6173('0x6b')]({'where':{'UserId':_0x580432['id'],'SmsQueueId':_0x34929e[_0x6173('0x47')]['id']},'transaction':_0x5b2fb6});});})['then'](function(){_0xc6c83d[_0x6173('0x6c')](function(_0x3d3a7f){socket['emit'](_0x6173('0x6d'),{'UserId':_0x3d3a7f['id'],'SmsQueueId':_0x3916a6['id']});});});});});}})[_0x6173('0x28')](respondWithStatusCode(_0x1f7c10,null))[_0x6173('0x46')](handleError(_0x1f7c10,null));};exports[_0x6173('0x6e')]=function(_0x187e8d,_0x12f499,_0x14f664){return db[_0x6173('0x61')][_0x6173('0x45')]({'where':{'id':_0x187e8d[_0x6173('0x31')][_0x6173('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6173('0x64'),'attributes':['id'],'raw':!![]}]})[_0x6173('0x28')](handleEntityNotFound(_0x12f499,null))[_0x6173('0x28')](function(_0xc7bc2a){var _0x2244e7=_[_0x6173('0x30')](_0xc7bc2a,'id');var _0x4643fb=[];var _0x5bf694=[];var _0x16b4c5=squel[_0x6173('0x6f')]();_0x16b4c5[_0x6173('0x70')]('tq.TeamId')[_0x6173('0x71')]('team_has_sms_queues','tq')[_0x6173('0x72')](_0x6173('0x73'),'ut',_0x6173('0x74'))['where']('SmsQueueId\x20=\x20?',_0x187e8d[_0x6173('0x47')]['id']);for(var _0x568b99=0x0;_0x568b99<_0xc7bc2a[_0x6173('0x36')];_0x568b99+=0x1){let _0x339d53=_0xc7bc2a[_0x568b99];for(var _0x3fc20c=0x0;_0x3fc20c<_0x339d53[_0x6173('0x64')]['length'];_0x3fc20c+=0x1){let _0x129676=_0x339d53[_0x6173('0x64')][_0x3fc20c];var _0x5ba948=_0x16b4c5[_0x6173('0x75')]();_0x5ba948[_0x6173('0x3c')](_0x6173('0x76'),_0x129676['id']);_0x5bf694['push'](db[_0x6173('0x68')][_0x6173('0x31')](_0x5ba948['toString'](),{'type':db[_0x6173('0x68')][_0x6173('0x77')]['SELECT']})['then'](function(_0x3edfc6){if(_0x3edfc6[_0x6173('0x36')]===0x1){return _0x129676['id'];}else{var _0x4aae31=_[_0x6173('0x78')](_[_0x6173('0x30')](_0x3edfc6,_0x6173('0x79')),function(_0x5c92e2){return _['includes'](_0x2244e7,_0x5c92e2);});if(_0x4aae31){return _0x129676['id'];}}}));}}return BPromise[_0x6173('0x7a')](_0x5bf694)['then'](function(_0x1d4acd){_0x4643fb=_(_0x4643fb)[_0x6173('0x7b')](_0x1d4acd)[_0x6173('0x7c')]()[_0x6173('0x7d')]();return db[_0x6173('0x42')]['find']({'where':{'id':_0x187e8d[_0x6173('0x47')]['id']}})[_0x6173('0x28')](function(_0x9a615c){return db[_0x6173('0x68')][_0x6173('0x7e')](function(_0x4fcdf2){return _0x9a615c[_0x6173('0x6e')](_0x187e8d[_0x6173('0x31')][_0x6173('0x63')],{'transaction':_0x4fcdf2})['then'](function(){if(!_[_0x6173('0x7f')](_0x4643fb)){return _0x9a615c[_0x6173('0x80')](_0x4643fb,{'transaction':_0x4fcdf2});}})['then'](function(){_0x4643fb[_0x6173('0x6c')](function(_0x1856e1){socket['emit']('userSmsQueue:remove',{'UserId':_0x1856e1,'SmsQueueId':_0x9a615c['id']});});});});});});})[_0x6173('0x28')](respondWithStatusCode(_0x12f499,null))['catch'](handleError(_0x12f499,null));};exports[_0x6173('0x81')]=function(_0x1f7e5e,_0x4ad241,_0x296a6b){return db[_0x6173('0x42')][_0x6173('0x4f')]({'where':{'id':_0x1f7e5e[_0x6173('0x47')]['id']}})[_0x6173('0x28')](handleEntityNotFound(_0x4ad241,null))[_0x6173('0x28')](function(_0x256c6f){if(_0x256c6f){return _0x256c6f[_0x6173('0x81')](_0x1f7e5e[_0x6173('0x52')]['ids'],_[_0x6173('0x82')](_0x1f7e5e[_0x6173('0x52')],[_0x6173('0x63'),'id'])||{})[_0x6173('0x83')](function(_0x562d71){for(var _0x2b832c=0x0;_0x2b832c<_0x1f7e5e[_0x6173('0x52')][_0x6173('0x63')][_0x6173('0x36')];_0x2b832c+=0x1){socket['emit'](_0x6173('0x6d'),{'UserId':_0x1f7e5e[_0x6173('0x52')][_0x6173('0x63')][_0x2b832c],'SmsQueueId':_0x1f7e5e[_0x6173('0x47')]['id']});}return _0x562d71;});}})['then'](respondWithResult(_0x4ad241,null))['catch'](handleError(_0x4ad241,null));};exports[_0x6173('0x80')]=function(_0x1aec56,_0x2b8e58,_0x3183ca){return db['SmsQueue'][_0x6173('0x4f')]({'where':{'id':_0x1aec56[_0x6173('0x47')]['id']}})[_0x6173('0x28')](handleEntityNotFound(_0x2b8e58,null))[_0x6173('0x28')](function(_0x56cb01){if(_0x56cb01){return _0x56cb01[_0x6173('0x80')](_0x1aec56[_0x6173('0x31')][_0x6173('0x63')])['then'](function(){if(_[_0x6173('0x84')](_0x1aec56[_0x6173('0x31')][_0x6173('0x63')])){for(var _0x3f37f2=0x0;_0x3f37f2<_0x1aec56[_0x6173('0x31')][_0x6173('0x63')][_0x6173('0x36')];_0x3f37f2+=0x1){socket['emit'](_0x6173('0x85'),{'UserId':Number(_0x1aec56[_0x6173('0x31')][_0x6173('0x63')][_0x3f37f2]),'SmsQueueId':Number(_0x1aec56[_0x6173('0x47')]['id'])});}}else{socket[_0x6173('0x86')]('userSmsQueue:remove',{'UserId':Number(_0x1aec56[_0x6173('0x31')]['ids']),'SmsQueueId':Number(_0x1aec56['params']['id'])});}});}})[_0x6173('0x28')](respondWithStatusCode(_0x2b8e58,null))[_0x6173('0x46')](handleError(_0x2b8e58,null));};exports[_0x6173('0x87')]=function(_0x33b455,_0x487c1c,_0x380e3b){var _0x432b02={};var _0x16cd77={};var _0x14204b;var _0x367145;return db['SmsQueue']['findOne']({'where':{'id':_0x33b455[_0x6173('0x47')]['id']}})[_0x6173('0x28')](handleEntityNotFound(_0x487c1c,null))[_0x6173('0x28')](function(_0x466c41){if(_0x466c41){_0x14204b=_0x466c41;_0x16cd77[_0x6173('0x37')]=_[_0x6173('0x48')](db[_0x6173('0x57')]['rawAttributes']);_0x16cd77[_0x6173('0x31')]=_[_0x6173('0x48')](_0x33b455['query']);_0x16cd77['filters']=_[_0x6173('0x33')](_0x16cd77[_0x6173('0x37')],_0x16cd77[_0x6173('0x31')]);_0x432b02[_0x6173('0x35')]=_[_0x6173('0x33')](_0x16cd77[_0x6173('0x37')],qs[_0x6173('0x34')](_0x33b455[_0x6173('0x31')]['fields']));_0x432b02[_0x6173('0x35')]=_0x432b02['attributes'][_0x6173('0x36')]?_0x432b02[_0x6173('0x35')]:_0x16cd77[_0x6173('0x37')];_0x432b02[_0x6173('0x3a')]=qs['sort'](_0x33b455[_0x6173('0x31')]['sort']);_0x432b02['where']=qs[_0x6173('0x32')](_[_0x6173('0x3d')](_0x33b455[_0x6173('0x31')],_0x16cd77['filters']));if(_0x33b455[_0x6173('0x31')][_0x6173('0x3e')]){_0x432b02[_0x6173('0x3c')]=_['merge'](_0x432b02[_0x6173('0x3c')],{'$or':_[_0x6173('0x30')](_0x432b02['attributes'],function(_0x1848a7){var _0x309f6d={};_0x309f6d[_0x1848a7]={'$like':'%'+_0x33b455[_0x6173('0x31')]['filter']+'%'};return _0x309f6d;})});}_0x432b02=_[_0x6173('0x3f')]({},_0x432b02,_0x33b455[_0x6173('0x41')]);return _0x14204b[_0x6173('0x87')](_0x432b02);}})[_0x6173('0x28')](function(_0x2d61fd){if(_0x2d61fd){_0x367145=_0x2d61fd[_0x6173('0x36')];if(!_0x33b455[_0x6173('0x31')]['hasOwnProperty'](_0x6173('0x39'))){_0x432b02[_0x6173('0x23')]=qs[_0x6173('0x23')](_0x33b455[_0x6173('0x31')][_0x6173('0x23')]);_0x432b02[_0x6173('0x22')]=qs['offset'](_0x33b455['query'][_0x6173('0x22')]);}return _0x14204b[_0x6173('0x87')](_0x432b02);}})[_0x6173('0x28')](function(_0x1a67ac){if(_0x1a67ac){return _0x1a67ac?{'count':_0x367145,'rows':_0x1a67ac}:null;}})[_0x6173('0x28')](respondWithResult(_0x487c1c,null))[_0x6173('0x46')](handleError(_0x487c1c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f7f0582..3af82b6 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 _0xa40c=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x11a3c3,_0x59acac){var _0x7afd2f=function(_0x14d853){while(--_0x14d853){_0x11a3c3['push'](_0x11a3c3['shift']());}};_0x7afd2f(++_0x59acac);}(_0xa40c,0x18a));var _0xca40=function(_0x128caf,_0x1eac2e){_0x128caf=_0x128caf-0x0;var _0x25a6e3=_0xa40c[_0x128caf];return _0x25a6e3;};'use strict';var EventEmitter=require(_0xca40('0x0'));var SmsQueue=require(_0xca40('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xca40('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xca40('0x3'),'afterDestroy':_0xca40('0x4')};function emitEvent(_0x2d54ff){return function(_0x43a9bf,_0x18cc63,_0x307374){SmsQueueEvents[_0xca40('0x5')](_0x2d54ff+':'+_0x43a9bf['id'],_0x43a9bf);SmsQueueEvents['emit'](_0x2d54ff,_0x43a9bf);_0x307374(null);};}for(var e in events){if(events[_0xca40('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xca40('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x9576=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x3804da,_0x4b1678){var _0x1038e3=function(_0x46dbaf){while(--_0x46dbaf){_0x3804da['push'](_0x3804da['shift']());}};_0x1038e3(++_0x4b1678);}(_0x9576,0x96));var _0x6957=function(_0x18b7b3,_0x5884d7){_0x18b7b3=_0x18b7b3-0x0;var _0x4f2cfe=_0x9576[_0x18b7b3];return _0x4f2cfe;};'use strict';var EventEmitter=require(_0x6957('0x0'));var SmsQueue=require(_0x6957('0x1'))['db'][_0x6957('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6957('0x3')](0x0);var events={'afterCreate':_0x6957('0x4'),'afterUpdate':_0x6957('0x5'),'afterDestroy':_0x6957('0x6')};function emitEvent(_0x365bb6){return function(_0x163f59,_0x2e21b5,_0xa1018f){SmsQueueEvents[_0x6957('0x7')](_0x365bb6+':'+_0x163f59['id'],_0x163f59);SmsQueueEvents['emit'](_0x365bb6,_0x163f59);_0xa1018f(null);};}for(var e in events){if(events[_0x6957('0x8')](e)){var event=events[e];SmsQueue[_0x6957('0x9')](e,emitEvent(event));}}module[_0x6957('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9bb01a9..7d81bc0 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 _0xda3a=['exports','SmsQueue','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x194329,_0xafa55a){var _0x21e277=function(_0x305e36){while(--_0x305e36){_0x194329['push'](_0x194329['shift']());}};_0x21e277(++_0xafa55a);}(_0xda3a,0xba));var _0xada3=function(_0x281c0e,_0x20c1d2){_0x281c0e=_0x281c0e-0x0;var _0x2c0d0d=_0xda3a[_0x281c0e];return _0x2c0d0d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xada3('0x0'));var rp=require(_0xada3('0x1'));var fs=require('fs');var path=require(_0xada3('0x2'));var rimraf=require(_0xada3('0x3'));var config=require(_0xada3('0x4'));var attributes=require(_0xada3('0x5'));module[_0xada3('0x6')]=function(_0x5db5f7,_0x1e8908){return _0x5db5f7['define'](_0xada3('0x7'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bf1=['../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xc1f465,_0x469e9e){var _0x2a092e=function(_0x123b1a){while(--_0x123b1a){_0xc1f465['push'](_0xc1f465['shift']());}};_0x2a092e(++_0x469e9e);}(_0x5bf1,0x15a));var _0x15bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x15bf('0x0'));var util=require(_0x15bf('0x1'));var logger=require(_0x15bf('0x2'))('api');var moment=require(_0x15bf('0x3'));var BPromise=require(_0x15bf('0x4'));var rp=require(_0x15bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15bf('0x6'));var attributes=require(_0x15bf('0x7'));module[_0x15bf('0x8')]=function(_0x397792,_0x33c0d8){return _0x397792['define'](_0x15bf('0x9'),attributes,{'tableName':_0x15bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 6d18ffb..532438c 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 _0x0f8d=['register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','debug','ShowSmsQueue','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket'];(function(_0x449127,_0x2db456){var _0x1d5e87=function(_0x3514bc){while(--_0x3514bc){_0x449127['push'](_0x449127['shift']());}};_0x1d5e87(++_0x2db456);}(_0x0f8d,0xdd));var _0xd0f8=function(_0x289c1e,_0x1b3421){_0x289c1e=_0x289c1e-0x0;var _0x58555c=_0x0f8d[_0x289c1e];return _0x58555c;};'use strict';var _=require(_0xd0f8('0x0'));var util=require(_0xd0f8('0x1'));var moment=require(_0xd0f8('0x2'));var BPromise=require(_0xd0f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd0f8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd0f8('0x5'));var jayson=require(_0xd0f8('0x6'));var client=jayson[_0xd0f8('0x7')][_0xd0f8('0x8')]({'port':0x232a});config[_0xd0f8('0x9')]=_[_0xd0f8('0xa')](config[_0xd0f8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0f8('0xb'))(new Redis(config['redis']));require(_0xd0f8('0xc'))[_0xd0f8('0xd')](socket);function respondWithRpcPromise(_0x3acea0,_0x4bc294,_0x450669){return new BPromise(function(_0x18a7ba,_0x9749e0){return client[_0xd0f8('0xe')](_0x3acea0,_0x450669)[_0xd0f8('0xf')](function(_0x440425){logger[_0xd0f8('0x10')]('SmsQueue,\x20%s,\x20%s',_0x4bc294,_0xd0f8('0x11'));logger['debug'](_0xd0f8('0x12'),_0x4bc294,_0xd0f8('0x11'),JSON[_0xd0f8('0x13')](_0x440425));if(_0x440425[_0xd0f8('0x14')]){if(_0x440425[_0xd0f8('0x14')][_0xd0f8('0x15')]===0x1f4){logger['error'](_0xd0f8('0x16'),_0x4bc294,_0x440425[_0xd0f8('0x14')]['message']);return _0x9749e0(_0x440425[_0xd0f8('0x14')][_0xd0f8('0x17')]);}logger[_0xd0f8('0x14')](_0xd0f8('0x16'),_0x4bc294,_0x440425[_0xd0f8('0x14')][_0xd0f8('0x17')]);return _0x18a7ba(_0x440425[_0xd0f8('0x14')][_0xd0f8('0x17')]);}else{logger['info'](_0xd0f8('0x16'),_0x4bc294,'request\x20sent');_0x18a7ba(_0x440425[_0xd0f8('0x18')]['message']);}})[_0xd0f8('0x19')](function(_0x4af41e){logger[_0xd0f8('0x14')](_0xd0f8('0x16'),_0x4bc294,_0x4af41e);_0x9749e0(_0x4af41e);});});}exports['GetSmsQueue']=function(_0x2e7b6d){var _0x278965=this;return new Promise(function(_0x16d5e8,_0x3de6c4){return db[_0xd0f8('0x1a')][_0xd0f8('0x1b')]({'raw':_0x2e7b6d[_0xd0f8('0x1c')]?_0x2e7b6d[_0xd0f8('0x1c')][_0xd0f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e7b6d[_0xd0f8('0x1c')]?_0x2e7b6d[_0xd0f8('0x1c')][_0xd0f8('0x1e')]||null:null,'attributes':_0x2e7b6d['options']?_0x2e7b6d['options'][_0xd0f8('0x1f')]||null:null,'limit':_0x2e7b6d[_0xd0f8('0x1c')]?_0x2e7b6d[_0xd0f8('0x1c')][_0xd0f8('0x20')]||null:null,'include':_0x2e7b6d['options']?_0x2e7b6d['options'][_0xd0f8('0x21')]?_[_0xd0f8('0x22')](_0x2e7b6d[_0xd0f8('0x1c')][_0xd0f8('0x21')],function(_0x362c2a){return{'model':db[_0x362c2a[_0xd0f8('0x23')]],'as':_0x362c2a['as'],'attributes':_0x362c2a[_0xd0f8('0x1f')],'include':_0x362c2a[_0xd0f8('0x21')]?_[_0xd0f8('0x22')](_0x362c2a[_0xd0f8('0x21')],function(_0x19b065){return{'model':db[_0x19b065['model']],'as':_0x19b065['as'],'attributes':_0x19b065[_0xd0f8('0x1f')],'include':_0x19b065[_0xd0f8('0x21')]?_[_0xd0f8('0x22')](_0x19b065['include'],function(_0x13bf3b){return{'model':db[_0x13bf3b[_0xd0f8('0x23')]],'as':_0x13bf3b['as'],'attributes':_0x13bf3b['attributes']};}):[]};}):[]};}):[]:[]})[_0xd0f8('0xf')](function(_0x4b05a2){logger[_0xd0f8('0x10')]('GetSmsQueue',_0x2e7b6d);logger['debug']('GetSmsQueue',_0x2e7b6d,JSON[_0xd0f8('0x13')](_0x4b05a2));_0x16d5e8(_0x4b05a2);})['catch'](function(_0x254333){logger['error'](_0xd0f8('0x24'),_0x254333[_0xd0f8('0x17')],_0x2e7b6d);_0x3de6c4(_0x278965[_0xd0f8('0x14')](0x1f4,_0x254333[_0xd0f8('0x17')]));});});};exports['ShowSmsQueue']=function(_0x1812cf){var _0x560104=this;return new Promise(function(_0x50ed7a,_0x1c4303){return db[_0xd0f8('0x1a')]['find']({'raw':_0x1812cf[_0xd0f8('0x1c')]?_0x1812cf[_0xd0f8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1812cf['options']?_0x1812cf[_0xd0f8('0x1c')][_0xd0f8('0x1e')]||null:null,'attributes':_0x1812cf['options']?_0x1812cf[_0xd0f8('0x1c')][_0xd0f8('0x1f')]||null:null,'include':_0x1812cf[_0xd0f8('0x1c')]?_0x1812cf[_0xd0f8('0x1c')]['include']?_['map'](_0x1812cf[_0xd0f8('0x1c')][_0xd0f8('0x21')],function(_0x396c88){return{'model':db[_0x396c88['model']],'as':_0x396c88['as'],'attributes':_0x396c88[_0xd0f8('0x1f')],'include':_0x396c88[_0xd0f8('0x21')]?_[_0xd0f8('0x22')](_0x396c88[_0xd0f8('0x21')],function(_0x13556f){return{'model':db[_0x13556f[_0xd0f8('0x23')]],'as':_0x13556f['as'],'attributes':_0x13556f[_0xd0f8('0x1f')],'include':_0x13556f[_0xd0f8('0x21')]?_['map'](_0x13556f[_0xd0f8('0x21')],function(_0x220899){return{'model':db[_0x220899[_0xd0f8('0x23')]],'as':_0x220899['as'],'attributes':_0x220899[_0xd0f8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd0f8('0xf')](function(_0x5a6088){logger['info']('ShowSmsQueue',_0x1812cf);logger[_0xd0f8('0x25')]('ShowSmsQueue',_0x1812cf,JSON['stringify'](_0x5a6088));_0x50ed7a(_0x5a6088);})[_0xd0f8('0x19')](function(_0x401266){logger[_0xd0f8('0x14')](_0xd0f8('0x26'),_0x401266[_0xd0f8('0x17')],_0x1812cf);_0x1c4303(_0x560104[_0xd0f8('0x14')](0x1f4,_0x401266[_0xd0f8('0x17')]));});});}; \ No newline at end of file +var _0x4d71=['error','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','findAll','options','raw','attributes','limit','include','model','map','then','ShowSmsQueue','SmsQueue','find','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3d9309,_0x18a445){var _0x4f3d1d=function(_0x3b12a3){while(--_0x3b12a3){_0x3d9309['push'](_0x3d9309['shift']());}};_0x4f3d1d(++_0x18a445);}(_0x4d71,0xf7));var _0x14d7=function(_0x3e8b50,_0x90bf8d){_0x3e8b50=_0x3e8b50-0x0;var _0x35c354=_0x4d71[_0x3e8b50];return _0x35c354;};'use strict';var _=require(_0x14d7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x14d7('0x1'));var rs=require(_0x14d7('0x2'));var fs=require('fs');var Redis=require(_0x14d7('0x3'));var db=require(_0x14d7('0x4'))['db'];var utils=require(_0x14d7('0x5'));var logger=require(_0x14d7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14d7('0x7')]['http']({'port':0x232a});config[_0x14d7('0x8')]=_[_0x14d7('0x9')](config['redis'],{'host':_0x14d7('0xa'),'port':0x18eb});var socket=require(_0x14d7('0xb'))(new Redis(config[_0x14d7('0x8')]));require(_0x14d7('0xc'))[_0x14d7('0xd')](socket);function respondWithRpcPromise(_0x43f181,_0x16cb2b,_0x446305){return new BPromise(function(_0x3c9d73,_0x27e033){return client['request'](_0x43f181,_0x446305)['then'](function(_0x263920){logger[_0x14d7('0xe')]('SmsQueue,\x20%s,\x20%s',_0x16cb2b,_0x14d7('0xf'));logger[_0x14d7('0x10')](_0x14d7('0x11'),_0x16cb2b,'request\x20sent',JSON[_0x14d7('0x12')](_0x263920));if(_0x263920[_0x14d7('0x13')]){if(_0x263920[_0x14d7('0x13')]['code']===0x1f4){logger[_0x14d7('0x13')](_0x14d7('0x14'),_0x16cb2b,_0x263920[_0x14d7('0x13')]['message']);return _0x27e033(_0x263920['error']['message']);}logger[_0x14d7('0x13')](_0x14d7('0x14'),_0x16cb2b,_0x263920[_0x14d7('0x13')][_0x14d7('0x15')]);return _0x3c9d73(_0x263920[_0x14d7('0x13')][_0x14d7('0x15')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x16cb2b,'request\x20sent');_0x3c9d73(_0x263920[_0x14d7('0x16')]['message']);}})[_0x14d7('0x17')](function(_0x2962a8){logger[_0x14d7('0x13')]('SmsQueue,\x20%s,\x20%s',_0x16cb2b,_0x2962a8);_0x27e033(_0x2962a8);});});}exports[_0x14d7('0x18')]=function(_0x19609b){var _0x376450=this;return new Promise(function(_0x1aeb7e,_0x5ec547){return db['SmsQueue'][_0x14d7('0x19')]({'raw':_0x19609b[_0x14d7('0x1a')]?_0x19609b['options'][_0x14d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x19609b[_0x14d7('0x1a')]?_0x19609b['options']['where']||null:null,'attributes':_0x19609b[_0x14d7('0x1a')]?_0x19609b[_0x14d7('0x1a')][_0x14d7('0x1c')]||null:null,'limit':_0x19609b[_0x14d7('0x1a')]?_0x19609b['options'][_0x14d7('0x1d')]||null:null,'include':_0x19609b[_0x14d7('0x1a')]?_0x19609b['options'][_0x14d7('0x1e')]?_['map'](_0x19609b[_0x14d7('0x1a')][_0x14d7('0x1e')],function(_0x16d179){return{'model':db[_0x16d179[_0x14d7('0x1f')]],'as':_0x16d179['as'],'attributes':_0x16d179[_0x14d7('0x1c')],'include':_0x16d179[_0x14d7('0x1e')]?_[_0x14d7('0x20')](_0x16d179[_0x14d7('0x1e')],function(_0x5eb9ad){return{'model':db[_0x5eb9ad[_0x14d7('0x1f')]],'as':_0x5eb9ad['as'],'attributes':_0x5eb9ad[_0x14d7('0x1c')],'include':_0x5eb9ad[_0x14d7('0x1e')]?_[_0x14d7('0x20')](_0x5eb9ad['include'],function(_0x5160e1){return{'model':db[_0x5160e1['model']],'as':_0x5160e1['as'],'attributes':_0x5160e1[_0x14d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14d7('0x21')](function(_0x506d2b){logger[_0x14d7('0xe')](_0x14d7('0x18'),_0x19609b);logger[_0x14d7('0x10')](_0x14d7('0x18'),_0x19609b,JSON[_0x14d7('0x12')](_0x506d2b));_0x1aeb7e(_0x506d2b);})[_0x14d7('0x17')](function(_0x13c2e9){logger['error']('GetSmsQueue',_0x13c2e9['message'],_0x19609b);_0x5ec547(_0x376450[_0x14d7('0x13')](0x1f4,_0x13c2e9['message']));});});};exports[_0x14d7('0x22')]=function(_0x5c5b2e){var _0x45e212=this;return new Promise(function(_0x59f3e5,_0x4c5dfd){return db[_0x14d7('0x23')][_0x14d7('0x24')]({'raw':_0x5c5b2e[_0x14d7('0x1a')]?_0x5c5b2e['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c5b2e['options']?_0x5c5b2e[_0x14d7('0x1a')][_0x14d7('0x25')]||null:null,'attributes':_0x5c5b2e[_0x14d7('0x1a')]?_0x5c5b2e[_0x14d7('0x1a')][_0x14d7('0x1c')]||null:null,'include':_0x5c5b2e[_0x14d7('0x1a')]?_0x5c5b2e[_0x14d7('0x1a')][_0x14d7('0x1e')]?_[_0x14d7('0x20')](_0x5c5b2e[_0x14d7('0x1a')]['include'],function(_0x2ef42e){return{'model':db[_0x2ef42e['model']],'as':_0x2ef42e['as'],'attributes':_0x2ef42e['attributes'],'include':_0x2ef42e['include']?_[_0x14d7('0x20')](_0x2ef42e[_0x14d7('0x1e')],function(_0x2bb829){return{'model':db[_0x2bb829['model']],'as':_0x2bb829['as'],'attributes':_0x2bb829[_0x14d7('0x1c')],'include':_0x2bb829['include']?_[_0x14d7('0x20')](_0x2bb829[_0x14d7('0x1e')],function(_0x456adb){return{'model':db[_0x456adb[_0x14d7('0x1f')]],'as':_0x456adb['as'],'attributes':_0x456adb[_0x14d7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14d7('0x21')](function(_0x2cd5db){logger[_0x14d7('0xe')](_0x14d7('0x22'),_0x5c5b2e);logger[_0x14d7('0x10')](_0x14d7('0x22'),_0x5c5b2e,JSON[_0x14d7('0x12')](_0x2cd5db));_0x59f3e5(_0x2cd5db);})['catch'](function(_0x1d81c9){logger['error']('ShowSmsQueue',_0x1d81c9['message'],_0x5c5b2e);_0x4c5dfd(_0x45e212[_0x14d7('0x13')](0x1f4,_0x1d81c9[_0x14d7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8310b43..a15edf1 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 _0x0dd6=['length','./smsQueue.events','save','update','emit','removeListener','register'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0dd6,0x13c));var _0x60dd=function(_0x1721a9,_0x119ace){_0x1721a9=_0x1721a9-0x0;var _0x13637f=_0x0dd6[_0x1721a9];return _0x13637f;};'use strict';var SmsQueueEvents=require(_0x60dd('0x0'));var events=[_0x60dd('0x1'),'remove',_0x60dd('0x2')];function createListener(_0x238a78,_0x14d2fc){return function(_0x5147c2){_0x14d2fc[_0x60dd('0x3')](_0x238a78,_0x5147c2);};}function removeListener(_0x434f55,_0x2df5a3){return function(){SmsQueueEvents[_0x60dd('0x4')](_0x434f55,_0x2df5a3);};}exports[_0x60dd('0x5')]=function(_0x1d6dff){for(var _0x24f20a=0x0,_0x2c84c5=events[_0x60dd('0x6')];_0x24f20a<_0x2c84c5;_0x24f20a++){var _0x1cb7a5=events[_0x24f20a];var _0x2f57ec=createListener('smsQueue:'+_0x1cb7a5,_0x1d6dff);SmsQueueEvents['on'](_0x1cb7a5,_0x2f57ec);}}; \ No newline at end of file +var _0x0c68=['register','length','./smsQueue.events','remove','update','emit','removeListener'];(function(_0x1c50e7,_0x311b3b){var _0x102603=function(_0x538223){while(--_0x538223){_0x1c50e7['push'](_0x1c50e7['shift']());}};_0x102603(++_0x311b3b);}(_0x0c68,0x198));var _0x80c6=function(_0x40f11d,_0x1b0e94){_0x40f11d=_0x40f11d-0x0;var _0x395d2b=_0x0c68[_0x40f11d];return _0x395d2b;};'use strict';var SmsQueueEvents=require(_0x80c6('0x0'));var events=['save',_0x80c6('0x1'),_0x80c6('0x2')];function createListener(_0xad69fc,_0x747bd2){return function(_0x3e1158){_0x747bd2[_0x80c6('0x3')](_0xad69fc,_0x3e1158);};}function removeListener(_0x15a4a5,_0x161d70){return function(){SmsQueueEvents[_0x80c6('0x4')](_0x15a4a5,_0x161d70);};}exports[_0x80c6('0x5')]=function(_0x23b5db){for(var _0x47f1a4=0x0,_0x323b65=events[_0x80c6('0x6')];_0x47f1a4<_0x323b65;_0x47f1a4++){var _0x3469bd=events[_0x47f1a4];var _0x142ee0=createListener('smsQueue:'+_0x3469bd,_0x23b5db);SmsQueueEvents['on'](_0x3469bd,_0x142ee0);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c1d9dd8..9575a74 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 _0x1605=['isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x533b49,_0x4aecc3){var _0x95be87=function(_0x212f23){while(--_0x212f23){_0x533b49['push'](_0x533b49['shift']());}};_0x95be87(++_0x4aecc3);}(_0x1605,0x19a));var _0x5160=function(_0x27a2b2,_0x5899ca){_0x27a2b2=_0x27a2b2-0x0;var _0x355329=_0x1605[_0x27a2b2];return _0x355329;};'use strict';var multer=require('multer');var util=require(_0x5160('0x0'));var path=require(_0x5160('0x1'));var timeout=require(_0x5160('0x2'));var express=require(_0x5160('0x3'));var router=express[_0x5160('0x4')]();var auth=require(_0x5160('0x5'));var interaction=require(_0x5160('0x6'));var config=require(_0x5160('0x7'));var controller=require(_0x5160('0x8'));router[_0x5160('0x9')]('/',auth[_0x5160('0xa')](),controller[_0x5160('0xb')]);router['get'](_0x5160('0xc'),auth[_0x5160('0xa')](),controller[_0x5160('0xd')]);router[_0x5160('0x9')]('/:id',auth[_0x5160('0xa')](),controller[_0x5160('0xe')]);router[_0x5160('0xf')]('/',auth[_0x5160('0xa')](),controller[_0x5160('0x10')]);router[_0x5160('0x11')]('/:id',auth[_0x5160('0xa')](),controller[_0x5160('0x12')]);router[_0x5160('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5160('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa1f6=['put','delete','destroy','multer','util','express','Router','../../components/auth/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0x1b1276,_0x22a49d){var _0x4c3ffd=function(_0x4ead07){while(--_0x4ead07){_0x1b1276['push'](_0x1b1276['shift']());}};_0x4c3ffd(++_0x22a49d);}(_0xa1f6,0x69));var _0x6a1f=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0xa1f6[_0x11deef];return _0xe9ba85;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a1f('0x2'));var router=express[_0x6a1f('0x3')]();var auth=require(_0x6a1f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6a1f('0x5'));router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6a1f('0x6')](_0x6a1f('0xa'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xb')]);router[_0x6a1f('0xc')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xd')]);router[_0x6a1f('0xe')](_0x6a1f('0xa'),auth[_0x6a1f('0x7')](),controller['update']);router[_0x6a1f('0xf')](_0x6a1f('0xa'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b3f0315..d654b78 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 _0x7c35=['sequelize','STRING','DATE'];(function(_0x50a778,_0x4fcbbd){var _0x4c92e3=function(_0x39a73a){while(--_0x39a73a){_0x50a778['push'](_0x50a778['shift']());}};_0x4c92e3(++_0x4fcbbd);}(_0x7c35,0x180));var _0x57c3=function(_0x42366e,_0x255ccc){_0x42366e=_0x42366e-0x0;var _0x164872=_0x7c35[_0x42366e];return _0x164872;};'use strict';var moment=require('moment');var Sequelize=require(_0x57c3('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x57c3('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x57c3('0x1')]},'joinAt':{'type':Sequelize[_0x57c3('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x57c3('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x68d5=['STRING','moment','sequelize','exports','DATE'];(function(_0x1eeeac,_0x1af529){var _0x113813=function(_0x117c56){while(--_0x117c56){_0x1eeeac['push'](_0x1eeeac['shift']());}};_0x113813(++_0x1af529);}(_0x68d5,0x1a5));var _0x568d=function(_0x34f1d0,_0x4bbbd0){_0x34f1d0=_0x34f1d0-0x0;var _0x433f24=_0x68d5[_0x34f1d0];return _0x433f24;};'use strict';var moment=require(_0x568d('0x0'));var Sequelize=require(_0x568d('0x1'));module[_0x568d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x568d('0x3')]},'leaveAt':{'type':Sequelize[_0x568d('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x568d('0x3')]},'reason':{'type':Sequelize[_0x568d('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index e046666..8ac2755 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 _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x2fa5ba,_0x4a70a1){var _0x38aa4b=function(_0xf2ab76){while(--_0xf2ab76){_0x2fa5ba['push'](_0x2fa5ba['shift']());}};_0x38aa4b(++_0x4a70a1);}(_0x814b,0x1a2));var _0xb814=function(_0x2abaae,_0x29fd8b){_0x2abaae=_0x2abaae-0x0;var _0x5b5745=_0x814b[_0x2abaae];return _0x5b5745;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');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('0xb'));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 db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x1da9bf,_0x10784f){var _0x4ddec7=function(_0x150f43){while(--_0x150f43){_0x1da9bf['push'](_0x1da9bf['shift']());}};_0x4ddec7(++_0x10784f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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 db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 745a185..46cdb92 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 _0xd863=['rimraf','../../config/environment','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xd863,0x1c7));var _0x3d86=function(_0x5539b9,_0x226b75){_0x5539b9=_0x5539b9-0x0;var _0x349aa0=_0xd863[_0x5539b9];return _0x349aa0;};'use strict';var _=require(_0x3d86('0x0'));var util=require(_0x3d86('0x1'));var logger=require(_0x3d86('0x2'))(_0x3d86('0x3'));var moment=require(_0x3d86('0x4'));var BPromise=require('bluebird');var rp=require(_0x3d86('0x5'));var fs=require('fs');var path=require(_0x3d86('0x6'));var rimraf=require(_0x3d86('0x7'));var config=require(_0x3d86('0x8'));var attributes=require('./smsQueueReport.attributes');module[_0x3d86('0x9')]=function(_0x38623f,_0x1bf4a4){return _0x38623f[_0x3d86('0xa')](_0x3d86('0xb'),attributes,{'tableName':_0x3d86('0xc'),'paranoid':![],'indexes':[{'name':_0x3d86('0xd'),'fields':[_0x3d86('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa53=['request-promise','rimraf','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x1c72b8,_0x104b7e){var _0x191114=function(_0x5d76da){while(--_0x5d76da){_0x1c72b8['push'](_0x1c72b8['shift']());}};_0x191114(++_0x104b7e);}(_0xaa53,0xb0));var _0x3aa5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaa53[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3aa5('0x0'));var util=require(_0x3aa5('0x1'));var logger=require(_0x3aa5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3aa5('0x3'));var rp=require(_0x3aa5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3aa5('0x5'));var config=require('../../config/environment');var attributes=require(_0x3aa5('0x6'));module[_0x3aa5('0x7')]=function(_0x2c0962,_0xe00d41){return _0x2c0962[_0x3aa5('0x8')](_0x3aa5('0x9'),attributes,{'tableName':_0x3aa5('0xa'),'paranoid':![],'indexes':[{'name':_0x3aa5('0xb'),'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 5e3ba0e..d0db536 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 _0xa640=['catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','debug','UpdateSmsQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x46306f,_0x5aef14){var _0x16a27f=function(_0x5526fd){while(--_0x5526fd){_0x46306f['push'](_0x46306f['shift']());}};_0x16a27f(++_0x5aef14);}(_0xa640,0x16b));var _0x0a64=function(_0x4b83f5,_0x5b3289){_0x4b83f5=_0x4b83f5-0x0;var _0x5917e6=_0xa640[_0x4b83f5];return _0x5917e6;};'use strict';var _=require(_0x0a64('0x0'));var util=require(_0x0a64('0x1'));var moment=require(_0x0a64('0x2'));var BPromise=require(_0x0a64('0x3'));var rs=require(_0x0a64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a64('0x5'));var logger=require(_0x0a64('0x6'))(_0x0a64('0x7'));var config=require(_0x0a64('0x8'));var jayson=require(_0x0a64('0x9'));var client=jayson[_0x0a64('0xa')][_0x0a64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bd383,_0x5b452c,_0x2569f9){return new BPromise(function(_0x2c850b,_0x736bce){return client[_0x0a64('0xc')](_0x3bd383,_0x2569f9)['then'](function(_0x344bcb){logger[_0x0a64('0xd')](_0x0a64('0xe'),_0x5b452c,'request\x20sent');logger['debug'](_0x0a64('0xf'),_0x5b452c,_0x0a64('0x10'),JSON[_0x0a64('0x11')](_0x344bcb));if(_0x344bcb[_0x0a64('0x12')]){if(_0x344bcb['error'][_0x0a64('0x13')]===0x1f4){logger[_0x0a64('0x12')](_0x0a64('0xe'),_0x5b452c,_0x344bcb['error']['message']);return _0x736bce(_0x344bcb[_0x0a64('0x12')][_0x0a64('0x14')]);}logger[_0x0a64('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x5b452c,_0x344bcb[_0x0a64('0x12')][_0x0a64('0x14')]);return _0x2c850b(_0x344bcb[_0x0a64('0x12')][_0x0a64('0x14')]);}else{logger['info'](_0x0a64('0xe'),_0x5b452c,_0x0a64('0x10'));_0x2c850b(_0x344bcb[_0x0a64('0x15')][_0x0a64('0x14')]);}})[_0x0a64('0x16')](function(_0x1b6d00){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5b452c,_0x1b6d00);_0x736bce(_0x1b6d00);});});}exports[_0x0a64('0x17')]=function(_0x4c803){var _0x1c647=this;return new Promise(function(_0x447f88,_0x124b8a){return db[_0x0a64('0x18')][_0x0a64('0x19')](_0x4c803[_0x0a64('0x1a')],{'raw':_0x4c803[_0x0a64('0x1b')]?_0x4c803[_0x0a64('0x1b')][_0x0a64('0x1c')]===undefined?!![]:![]:!![]})[_0x0a64('0x1d')](function(_0x582d1c){logger['info']('CreateSmsQueueReport',_0x4c803);logger[_0x0a64('0x1e')](_0x0a64('0x17'),_0x4c803,JSON['stringify'](_0x582d1c));_0x447f88(_0x582d1c);})[_0x0a64('0x16')](function(_0x595674){logger[_0x0a64('0x12')]('CreateSmsQueueReport',_0x595674['message'],_0x4c803);_0x124b8a(_0x1c647[_0x0a64('0x12')](0x1f4,_0x595674[_0x0a64('0x14')]));});});};exports[_0x0a64('0x1f')]=function(_0x3f5377){var _0x316f0a=this;return new Promise(function(_0x290ae7,_0x147279){return db[_0x0a64('0x18')][_0x0a64('0x20')](_0x3f5377['body'],{'raw':_0x3f5377[_0x0a64('0x1b')]?_0x3f5377[_0x0a64('0x1b')][_0x0a64('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f5377[_0x0a64('0x1b')]?_0x3f5377[_0x0a64('0x1b')]['where']||null:null,'attributes':_0x3f5377[_0x0a64('0x1b')]?_0x3f5377[_0x0a64('0x1b')][_0x0a64('0x21')]||null:null,'limit':_0x3f5377['options']?_0x3f5377['options'][_0x0a64('0x22')]||null:null})[_0x0a64('0x1d')](function(_0x39d843){logger[_0x0a64('0xd')](_0x0a64('0x1f'),_0x3f5377);logger[_0x0a64('0x1e')](_0x0a64('0x1f'),_0x3f5377,JSON[_0x0a64('0x11')](_0x39d843));_0x290ae7(_0x39d843);})[_0x0a64('0x16')](function(_0x53b80e){logger[_0x0a64('0x12')](_0x0a64('0x1f'),_0x53b80e[_0x0a64('0x14')],_0x3f5377);_0x147279(_0x316f0a[_0x0a64('0x12')](0x1f4,_0x53b80e[_0x0a64('0x14')]));});});}; \ No newline at end of file +var _0xa761=['raw','catch','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateSmsQueueReport','SmsQueueReport','create','body','options'];(function(_0x4bb39d,_0x5adc23){var _0x4da1eb=function(_0x8df9e1){while(--_0x8df9e1){_0x4bb39d['push'](_0x4bb39d['shift']());}};_0x4da1eb(++_0x5adc23);}(_0xa761,0x16f));var _0x1a76=function(_0x7e050b,_0x2fbd12){_0x7e050b=_0x7e050b-0x0;var _0x27345d=_0xa761[_0x7e050b];return _0x27345d;};'use strict';var _=require(_0x1a76('0x0'));var util=require(_0x1a76('0x1'));var moment=require(_0x1a76('0x2'));var BPromise=require(_0x1a76('0x3'));var rs=require(_0x1a76('0x4'));var fs=require('fs');var Redis=require(_0x1a76('0x5'));var db=require(_0x1a76('0x6'))['db'];var utils=require(_0x1a76('0x7'));var logger=require(_0x1a76('0x8'))(_0x1a76('0x9'));var config=require(_0x1a76('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1a76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18722e,_0x11ba18,_0x3e6efb){return new BPromise(function(_0x441154,_0xa9aa17){return client[_0x1a76('0xc')](_0x18722e,_0x3e6efb)[_0x1a76('0xd')](function(_0x18db55){logger['info'](_0x1a76('0xe'),_0x11ba18,'request\x20sent');logger[_0x1a76('0xf')](_0x1a76('0x10'),_0x11ba18,_0x1a76('0x11'),JSON[_0x1a76('0x12')](_0x18db55));if(_0x18db55[_0x1a76('0x13')]){if(_0x18db55[_0x1a76('0x13')][_0x1a76('0x14')]===0x1f4){logger['error'](_0x1a76('0xe'),_0x11ba18,_0x18db55[_0x1a76('0x13')][_0x1a76('0x15')]);return _0xa9aa17(_0x18db55[_0x1a76('0x13')][_0x1a76('0x15')]);}logger[_0x1a76('0x13')](_0x1a76('0xe'),_0x11ba18,_0x18db55[_0x1a76('0x13')][_0x1a76('0x15')]);return _0x441154(_0x18db55[_0x1a76('0x13')][_0x1a76('0x15')]);}else{logger[_0x1a76('0x16')]('SmsQueueReport,\x20%s,\x20%s',_0x11ba18,'request\x20sent');_0x441154(_0x18db55[_0x1a76('0x17')][_0x1a76('0x15')]);}})['catch'](function(_0x4fbf08){logger[_0x1a76('0x13')](_0x1a76('0xe'),_0x11ba18,_0x4fbf08);_0xa9aa17(_0x4fbf08);});});}exports[_0x1a76('0x18')]=function(_0x1c3240){var _0x51f97d=this;return new Promise(function(_0x4e693c,_0x25e0ad){return db[_0x1a76('0x19')][_0x1a76('0x1a')](_0x1c3240[_0x1a76('0x1b')],{'raw':_0x1c3240[_0x1a76('0x1c')]?_0x1c3240['options'][_0x1a76('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x133db){logger['info'](_0x1a76('0x18'),_0x1c3240);logger[_0x1a76('0xf')](_0x1a76('0x18'),_0x1c3240,JSON[_0x1a76('0x12')](_0x133db));_0x4e693c(_0x133db);})[_0x1a76('0x1e')](function(_0x59a3b2){logger[_0x1a76('0x13')](_0x1a76('0x18'),_0x59a3b2[_0x1a76('0x15')],_0x1c3240);_0x25e0ad(_0x51f97d[_0x1a76('0x13')](0x1f4,_0x59a3b2['message']));});});};exports[_0x1a76('0x1f')]=function(_0x2009a8){var _0x2604ea=this;return new Promise(function(_0x1e047c,_0x462ca3){return db[_0x1a76('0x19')][_0x1a76('0x20')](_0x2009a8[_0x1a76('0x1b')],{'raw':_0x2009a8[_0x1a76('0x1c')]?_0x2009a8[_0x1a76('0x1c')][_0x1a76('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2009a8[_0x1a76('0x1c')]?_0x2009a8['options'][_0x1a76('0x21')]||null:null,'attributes':_0x2009a8[_0x1a76('0x1c')]?_0x2009a8[_0x1a76('0x1c')][_0x1a76('0x22')]||null:null,'limit':_0x2009a8[_0x1a76('0x1c')]?_0x2009a8[_0x1a76('0x1c')][_0x1a76('0x23')]||null:null})[_0x1a76('0xd')](function(_0x27d9d1){logger[_0x1a76('0x16')](_0x1a76('0x1f'),_0x2009a8);logger[_0x1a76('0xf')](_0x1a76('0x1f'),_0x2009a8,JSON['stringify'](_0x27d9d1));_0x1e047c(_0x27d9d1);})['catch'](function(_0x80f2f){logger[_0x1a76('0x13')]('UpdateSmsQueueReport',_0x80f2f[_0x1a76('0x15')],_0x2009a8);_0x462ca3(_0x2604ea[_0x1a76('0x13')](0x1f4,_0x80f2f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5f7bfe6..9a1e829 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 _0x6e6c=['get','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x59f6be,_0x472a09){var _0x2aef59=function(_0x4d72d9){while(--_0x4d72d9){_0x59f6be['push'](_0x59f6be['shift']());}};_0x2aef59(++_0x472a09);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc6e6('0x4'));var config=require('../../config/environment');var controller=require(_0xc6e6('0x5'));router['get']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x7')]);router['get'](_0xc6e6('0x8'),auth[_0xc6e6('0x6')](),controller['describe']);router[_0xc6e6('0x9')](_0xc6e6('0xa'),auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['post']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0xa'),auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xe')]);router[_0xc6e6('0xf')](_0xc6e6('0xa'),auth[_0xc6e6('0x6')](),controller['destroy']);module[_0xc6e6('0x10')]=router; \ No newline at end of file +var _0xe605=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','multer'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe605,0x92));var _0x5e60=function(_0x39d407,_0x4388cf){_0x39d407=_0x39d407-0x0;var _0x1e8cc9=_0xe605[_0x39d407];return _0x1e8cc9;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var auth=require(_0x5e60('0x5'));var interaction=require(_0x5e60('0x6'));var config=require(_0x5e60('0x7'));var controller=require(_0x5e60('0x8'));router[_0x5e60('0x9')]('/',auth[_0x5e60('0xa')](),controller[_0x5e60('0xb')]);router[_0x5e60('0x9')](_0x5e60('0xc'),auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5e60('0xe')]);router[_0x5e60('0xf')]('/',auth[_0x5e60('0xa')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')](_0x5e60('0x12'),auth['isAuthenticated'](),controller[_0x5e60('0x13')]);router['delete'](_0x5e60('0x12'),auth[_0x5e60('0xa')](),controller[_0x5e60('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 76ca2de..030a5e8 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 _0x5dc7=['account','queue','DATE','NOW','moment','sequelize','exports','ENUM'];(function(_0x434f69,_0x9da9a7){var _0x5f40da=function(_0x33d63b){while(--_0x33d63b){_0x434f69['push'](_0x434f69['shift']());}};_0x5f40da(++_0x9da9a7);}(_0x5dc7,0x1a4));var _0x75dc=function(_0x44240b,_0x2b625a){_0x44240b=_0x44240b-0x0;var _0x28a677=_0x5dc7[_0x44240b];return _0x28a677;};'use strict';var moment=require(_0x75dc('0x0'));var Sequelize=require(_0x75dc('0x1'));module[_0x75dc('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x75dc('0x3')](_0x75dc('0x4'),'agent',_0x75dc('0x5')),'allowNull':![],'defaultValue':_0x75dc('0x5')},'transferredAt':{'type':Sequelize[_0x75dc('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x75dc('0x7')]}}; \ No newline at end of file +var _0xe009=['moment','sequelize','exports','STRING','account','agent','queue','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe009,0x68));var _0x9e00=function(_0x342b43,_0x3e67b4){_0x342b43=_0x342b43-0x0;var _0x3412fa=_0xe009[_0x342b43];return _0x3412fa;};'use strict';var moment=require(_0x9e00('0x0'));var Sequelize=require(_0x9e00('0x1'));module[_0x9e00('0x2')]={'uniqueid':{'type':Sequelize[_0x9e00('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9e00('0x4'),_0x9e00('0x5'),'queue'),'allowNull':![],'defaultValue':_0x9e00('0x6')},'transferredAt':{'type':Sequelize[_0x9e00('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 3815a76..3fd3405 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 _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0x5ce35e,_0x4d32df){var _0x3ac113=function(_0x1b422f){while(--_0x1b422f){_0x5ce35e['push'](_0x5ce35e['shift']());}};_0x3ac113(++_0x4d32df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['SmsTransferReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0x9c44=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0xe8732c,_0x4e821f){var _0x4dc059=function(_0x545ef5){while(--_0x545ef5){_0xe8732c['push'](_0xe8732c['shift']());}};_0x4dc059(++_0x4e821f);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');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('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['index']=function(_0x543ea2,_0x449960){var _0x53c199={},_0x3800b7={},_0x3852b2={'count':0x0,'rows':[]};var _0x3f1708=_[_0x49c4('0x24')](db['SmsTransferReport'][_0x49c4('0x25')],function(_0x2b2793){return{'name':_0x2b2793[_0x49c4('0x26')],'type':_0x2b2793[_0x49c4('0x27')][_0x49c4('0x28')]};});_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x24')](_0x3f1708,_0x49c4('0x22'));_0x3800b7[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x543ea2[_0x49c4('0x2a')]);_0x3800b7['filters']=_['intersection'](_0x3800b7['model'],_0x3800b7[_0x49c4('0x2a')]);_0x53c199[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x3800b7[_0x49c4('0x29')],qs[_0x49c4('0x2e')](_0x543ea2['query'][_0x49c4('0x2e')]));_0x53c199[_0x49c4('0x2c')]=_0x53c199[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0x53c199['attributes']:_0x3800b7['model'];if(!_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x30')](_0x49c4('0x31'))){_0x53c199[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x543ea2['query'][_0x49c4('0x1a')]);_0x53c199[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x543ea2['query']['offset']);}_0x53c199[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x33')]);_0x53c199[_0x49c4('0x34')]=qs[_0x49c4('0x35')](_[_0x49c4('0x36')](_0x543ea2[_0x49c4('0x2a')],_0x3800b7[_0x49c4('0x35')]),_0x3f1708);if(_0x543ea2['query'][_0x49c4('0x37')]){_0x53c199['where']=_[_0x49c4('0x38')](_0x53c199[_0x49c4('0x34')],{'$or':_[_0x49c4('0x24')](_0x3f1708,function(_0x1c2830){if(_0x1c2830['type']!==_0x49c4('0x39')){var _0x31f3ff={};_0x31f3ff[_0x1c2830[_0x49c4('0x22')]]={'$like':'%'+_0x543ea2['query'][_0x49c4('0x37')]+'%'};return _0x31f3ff;}})});}_0x53c199=_[_0x49c4('0x38')]({},_0x53c199,_0x543ea2[_0x49c4('0x3a')]);var _0x5e5366={'where':_0x53c199[_0x49c4('0x34')]};return db[_0x49c4('0x3b')][_0x49c4('0x18')](_0x5e5366)[_0x49c4('0x20')](function(_0x70e552){_0x3852b2[_0x49c4('0x18')]=_0x70e552;if(_0x543ea2[_0x49c4('0x2a')]['includeAll']){_0x53c199[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x3b')][_0x49c4('0x3d')](_0x53c199);})[_0x49c4('0x20')](function(_0x41ad28){_0x3852b2[_0x49c4('0x3e')]=_0x41ad28;return _0x3852b2;})[_0x49c4('0x20')](respondWithFilteredResult(_0x449960,_0x53c199))[_0x49c4('0x3f')](handleError(_0x449960,null));};exports[_0x49c4('0x40')]=function(_0x2668ed,_0x2dffb4){var _0xa3d59e={'raw':!![],'where':{'id':_0x2668ed['params']['id']}},_0x326142={};_0x326142[_0x49c4('0x29')]=_['keys'](db[_0x49c4('0x3b')][_0x49c4('0x25')]);_0x326142[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x2668ed[_0x49c4('0x2a')]);_0x326142[_0x49c4('0x35')]=_['intersection'](_0x326142['model'],_0x326142[_0x49c4('0x2a')]);_0xa3d59e[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x326142[_0x49c4('0x29')],qs['fields'](_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x2e')]));_0xa3d59e[_0x49c4('0x2c')]=_0xa3d59e[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0xa3d59e[_0x49c4('0x2c')]:_0x326142[_0x49c4('0x29')];if(_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x41')]){_0xa3d59e['include']=[{'all':!![]}];}_0xa3d59e=_[_0x49c4('0x38')]({},_0xa3d59e,_0x2668ed['options']);return db[_0x49c4('0x3b')][_0x49c4('0x42')](_0xa3d59e)[_0x49c4('0x20')](handleEntityNotFound(_0x2dffb4,null))[_0x49c4('0x20')](respondWithResult(_0x2dffb4,null))[_0x49c4('0x3f')](handleError(_0x2dffb4,null));};exports['create']=function(_0x592e8e,_0x15b674){return db[_0x49c4('0x3b')][_0x49c4('0x43')](_0x592e8e[_0x49c4('0x44')],{})[_0x49c4('0x20')](respondWithResult(_0x15b674,0xc9))[_0x49c4('0x3f')](handleError(_0x15b674,null));};exports['update']=function(_0x3bac1b,_0x5cfff9){if(_0x3bac1b[_0x49c4('0x44')]['id']){delete _0x3bac1b[_0x49c4('0x44')]['id'];}return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x3bac1b[_0x49c4('0x45')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x5cfff9,null))[_0x49c4('0x20')](saveUpdates(_0x3bac1b['body'],null))[_0x49c4('0x20')](respondWithResult(_0x5cfff9,null))[_0x49c4('0x3f')](handleError(_0x5cfff9,null));};exports['destroy']=function(_0x1e1ac4,_0xaece5f){return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x1e1ac4['params']['id']}})['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x20')](removeEntity(_0xaece5f,null))['catch'](handleError(_0xaece5f,null));};exports[_0x49c4('0x46')]=function(_0x1f941f,_0x3811b2){return db[_0x49c4('0x3b')][_0x49c4('0x46')]()[_0x49c4('0x20')](respondWithResult(_0x3811b2,null))[_0x49c4('0x3f')](handleError(_0x3811b2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 43bf842..d6425c8 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 _0x46ed=['bluebird','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment'];(function(_0x2e1632,_0x94a5dc){var _0x231322=function(_0x176efe){while(--_0x176efe){_0x2e1632['push'](_0x2e1632['shift']());}};_0x231322(++_0x94a5dc);}(_0x46ed,0x168));var _0xd46e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x46ed[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[{'name':_0xd46e('0xc'),'fields':[_0xd46e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','util'];(function(_0x42b424,_0x162cdf){var _0x308491=function(_0x1c0e6b){while(--_0x1c0e6b){_0x42b424['push'](_0x42b424['shift']());}};_0x308491(++_0x162cdf);}(_0x81c6,0x1d5));var _0x681c=function(_0x3b58e2,_0x4fbf5f){_0x3b58e2=_0x3b58e2-0x0;var _0x5a6677=_0x81c6[_0x3b58e2];return _0x5a6677;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x681c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 38d4150..cf1d341 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 _0xb568=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x468ef8,_0x4c8b5d){var _0x6bb40e=function(_0x4dc768){while(--_0x4dc768){_0x468ef8['push'](_0x468ef8['shift']());}};_0x6bb40e(++_0x4c8b5d);}(_0xb568,0xfe));var _0x8b56=function(_0x50e5b5,_0x5f29fe){_0x50e5b5=_0x50e5b5-0x0;var _0x1f3b00=_0xb568[_0x50e5b5];return _0x1f3b00;};'use strict';var _=require(_0x8b56('0x0'));var util=require(_0x8b56('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b56('0x2'));var fs=require('fs');var Redis=require(_0x8b56('0x3'));var db=require(_0x8b56('0x4'))['db'];var utils=require(_0x8b56('0x5'));var logger=require('../../config/logger')(_0x8b56('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8b56('0x7')][_0x8b56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x107609,_0x1293da,_0x47e303){return new BPromise(function(_0x2815a1,_0xaac95a){return client['request'](_0x107609,_0x47e303)['then'](function(_0x233f1e){logger['info'](_0x8b56('0x9'),_0x1293da,_0x8b56('0xa'));logger[_0x8b56('0xb')](_0x8b56('0xc'),_0x1293da,'request\x20sent',JSON[_0x8b56('0xd')](_0x233f1e));if(_0x233f1e[_0x8b56('0xe')]){if(_0x233f1e[_0x8b56('0xe')][_0x8b56('0xf')]===0x1f4){logger[_0x8b56('0xe')](_0x8b56('0x9'),_0x1293da,_0x233f1e[_0x8b56('0xe')][_0x8b56('0x10')]);return _0xaac95a(_0x233f1e[_0x8b56('0xe')]['message']);}logger[_0x8b56('0xe')](_0x8b56('0x9'),_0x1293da,_0x233f1e[_0x8b56('0xe')][_0x8b56('0x10')]);return _0x2815a1(_0x233f1e[_0x8b56('0xe')]['message']);}else{logger[_0x8b56('0x11')](_0x8b56('0x9'),_0x1293da,'request\x20sent');_0x2815a1(_0x233f1e['result']['message']);}})[_0x8b56('0x12')](function(_0x4fb14d){logger['error'](_0x8b56('0x9'),_0x1293da,_0x4fb14d);_0xaac95a(_0x4fb14d);});});} \ No newline at end of file +var _0x4d14=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x408c2d,_0x743a5){var _0x59137f=function(_0x5e47f0){while(--_0x5e47f0){_0x408c2d['push'](_0x408c2d['shift']());}};_0x59137f(++_0x743a5);}(_0x4d14,0x9b));var _0x44d1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4d14[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x44d1('0x0'));var util=require(_0x44d1('0x1'));var moment=require(_0x44d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x44d1('0x3'));var fs=require('fs');var Redis=require(_0x44d1('0x4'));var db=require(_0x44d1('0x5'))['db'];var utils=require(_0x44d1('0x6'));var logger=require(_0x44d1('0x7'))(_0x44d1('0x8'));var config=require(_0x44d1('0x9'));var jayson=require(_0x44d1('0xa'));var client=jayson[_0x44d1('0xb')][_0x44d1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21a3bb,_0x5eb402,_0x5c6179){return new BPromise(function(_0x28160c,_0x127250){return client[_0x44d1('0xd')](_0x21a3bb,_0x5c6179)['then'](function(_0x47b679){logger[_0x44d1('0xe')](_0x44d1('0xf'),_0x5eb402,_0x44d1('0x10'));logger[_0x44d1('0x11')](_0x44d1('0x12'),_0x5eb402,'request\x20sent',JSON[_0x44d1('0x13')](_0x47b679));if(_0x47b679[_0x44d1('0x14')]){if(_0x47b679[_0x44d1('0x14')][_0x44d1('0x15')]===0x1f4){logger[_0x44d1('0x14')](_0x44d1('0xf'),_0x5eb402,_0x47b679[_0x44d1('0x14')][_0x44d1('0x16')]);return _0x127250(_0x47b679[_0x44d1('0x14')][_0x44d1('0x16')]);}logger[_0x44d1('0x14')](_0x44d1('0xf'),_0x5eb402,_0x47b679[_0x44d1('0x14')]['message']);return _0x28160c(_0x47b679[_0x44d1('0x14')]['message']);}else{logger[_0x44d1('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x5eb402,'request\x20sent');_0x28160c(_0x47b679['result'][_0x44d1('0x16')]);}})['catch'](function(_0x7fb575){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x5eb402,_0x7fb575);_0x127250(_0x7fb575);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9f2c615..4ae2406 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 _0x5397=['multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get','/:id','show','diskStorage','join','root','originalname','replace','extname','now','post','single','file','create','put','update','delete'];(function(_0x43828c,_0x119bd2){var _0x5d0d46=function(_0x29a47f){while(--_0x29a47f){_0x43828c['push'](_0x43828c['shift']());}};_0x5d0d46(++_0x119bd2);}(_0x5397,0x177));var _0x7539=function(_0x2c7d03,_0x467e23){_0x2c7d03=_0x2c7d03-0x0;var _0x1892e1=_0x5397[_0x2c7d03];return _0x1892e1;};'use strict';var multer=require(_0x7539('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7539('0x1'));var express=require(_0x7539('0x2'));var router=express[_0x7539('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7539('0x4'));var config=require(_0x7539('0x5'));var controller=require(_0x7539('0x6'));router['get']('/',auth[_0x7539('0x7')](),controller['index']);router[_0x7539('0x8')](_0x7539('0x9'),auth[_0x7539('0x7')](),controller[_0x7539('0xa')]);router[_0x7539('0x8')]('/:id/download',auth[_0x7539('0x7')](),controller['download']);var upload=multer({'storage':multer[_0x7539('0xb')]({'destination':function(_0x3b509e,_0x400642,_0x56d282){_0x56d282(null,path[_0x7539('0xc')](config[_0x7539('0xd')],'server/files/sounds/original/'));},'filename':function(_0x3a051e,_0x53be53,_0x3e7b7e){_0x53be53[_0x7539('0xe')]=_0x53be53[_0x7539('0xe')][_0x7539('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e7b7e(null,util['format']('%s-%s%s',path['basename'](_0x53be53[_0x7539('0xe')],path[_0x7539('0x10')](_0x53be53['originalname'])),Date[_0x7539('0x11')](),path[_0x7539('0x10')](_0x53be53['originalname'])));}})});router[_0x7539('0x12')]('/',upload[_0x7539('0x13')](_0x7539('0x14')),controller[_0x7539('0x15')]);router[_0x7539('0x16')](_0x7539('0x9'),auth['isAuthenticated'](),controller[_0x7539('0x17')]);router[_0x7539('0x18')](_0x7539('0x9'),auth[_0x7539('0x7')](),controller[_0x7539('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9f12=['isAuthenticated','index','get','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','replace','%s-%s%s','basename','originalname','extname','post','single','file','create','put','update','delete','util','path','connect-timeout','express','Router','./sound.controller'];(function(_0xe53112,_0x3f61f0){var _0x92b754=function(_0x3d9b07){while(--_0x3d9b07){_0xe53112['push'](_0xe53112['shift']());}};_0x92b754(++_0x3f61f0);}(_0x9f12,0x1ba));var _0x29f1=function(_0x2f8d76,_0xff9644){_0x2f8d76=_0x2f8d76-0x0;var _0x46f5cd=_0x9f12[_0x2f8d76];return _0x46f5cd;};'use strict';var multer=require('multer');var util=require(_0x29f1('0x0'));var path=require(_0x29f1('0x1'));var timeout=require(_0x29f1('0x2'));var express=require(_0x29f1('0x3'));var router=express[_0x29f1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x29f1('0x5'));router['get']('/',auth[_0x29f1('0x6')](),controller[_0x29f1('0x7')]);router[_0x29f1('0x8')](_0x29f1('0x9'),auth[_0x29f1('0x6')](),controller['show']);router[_0x29f1('0x8')](_0x29f1('0xa'),auth[_0x29f1('0x6')](),controller[_0x29f1('0xb')]);var upload=multer({'storage':multer[_0x29f1('0xc')]({'destination':function(_0x2304da,_0x3c0433,_0x19c106){_0x19c106(null,path[_0x29f1('0xd')](config[_0x29f1('0xe')],_0x29f1('0xf')));},'filename':function(_0x492e7f,_0x5681cf,_0x1ff52e){_0x5681cf['originalname']=_0x5681cf['originalname'][_0x29f1('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ff52e(null,util['format'](_0x29f1('0x11'),path[_0x29f1('0x12')](_0x5681cf[_0x29f1('0x13')],path[_0x29f1('0x14')](_0x5681cf['originalname'])),Date['now'](),path[_0x29f1('0x14')](_0x5681cf[_0x29f1('0x13')])));}})});router[_0x29f1('0x15')]('/',upload[_0x29f1('0x16')](_0x29f1('0x17')),controller[_0x29f1('0x18')]);router[_0x29f1('0x19')](_0x29f1('0x9'),auth[_0x29f1('0x6')](),controller[_0x29f1('0x1a')]);router[_0x29f1('0x1b')](_0x29f1('0x9'),auth[_0x29f1('0x6')](),controller[_0x29f1('0x1b')]);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 46e7414..617851c 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 _0x422a=['exports','name','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x5482f4,_0x150cac){var _0x42d1ec=function(_0x2d3af5){while(--_0x2d3af5){_0x5482f4['push'](_0x5482f4['shift']());}};_0x42d1ec(++_0x150cac);}(_0x422a,0x1e2));var _0xa422=function(_0x47ebd9,_0x3dcef5){_0x47ebd9=_0x47ebd9-0x0;var _0xfa7b5a=_0x422a[_0x47ebd9];return _0xfa7b5a;};'use strict';var Sequelize=require(_0xa422('0x0'));module[_0xa422('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa422('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xa422('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa422('0x4')]},'original_sampleCount':{'type':Sequelize[_0xa422('0x5')]},'original_channelCount':{'type':Sequelize[_0xa422('0x6')]},'original_bitRate':{'type':Sequelize[_0xa422('0x5')]},'original_sampleRate':{'type':Sequelize[_0xa422('0x6')]},'converted_format':{'type':Sequelize[_0xa422('0x3')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa422('0x6')]},'converted_bitRate':{'type':Sequelize[_0xa422('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xa422('0x6')]}}; \ No newline at end of file +var _0xd7d8=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xd7d8,0x1d1));var _0x8d7d=function(_0x4e1d47,_0x40d4c8){_0x4e1d47=_0x4e1d47-0x0;var _0x1c5b56=_0xd7d8[_0x4e1d47];return _0x1c5b56;};'use strict';var Sequelize=require(_0x8d7d('0x0'));module[_0x8d7d('0x1')]={'name':{'type':Sequelize[_0x8d7d('0x2')],'unique':_0x8d7d('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8d7d('0x2')]},'display_name':{'type':Sequelize[_0x8d7d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x8d7d('0x2')]},'original_format':{'type':Sequelize[_0x8d7d('0x2')]},'original_duration':{'type':Sequelize[_0x8d7d('0x4')]},'original_sampleCount':{'type':Sequelize[_0x8d7d('0x5')]},'original_channelCount':{'type':Sequelize[_0x8d7d('0x6')]},'original_bitRate':{'type':Sequelize[_0x8d7d('0x5')]},'original_sampleRate':{'type':Sequelize[_0x8d7d('0x6')]},'converted_format':{'type':Sequelize[_0x8d7d('0x2')]},'converted_duration':{'type':Sequelize[_0x8d7d('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x8d7d('0x5')]},'converted_channelCount':{'type':Sequelize[_0x8d7d('0x6')]},'converted_bitRate':{'type':Sequelize[_0x8d7d('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x8d7d('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index dcb64c7..4040afd 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 _0xac31=['index','map','Sound','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','count','include','rows','catch','includeAll','download','save_name','converted_format','existsSync','join','ValidationError','root','server/files/sounds/converted','%s.%s','format','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','find','params','description','delete','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name'];(function(_0x1731a9,_0x4fb551){var _0x22b9a5=function(_0x3b62fd){while(--_0x3b62fd){_0x1731a9['push'](_0x1731a9['shift']());}};_0x22b9a5(++_0x4fb551);}(_0xac31,0x134));var _0x1ac3=function(_0x3dd8a3,_0x4486bf){_0x3dd8a3=_0x3dd8a3-0x0;var _0x5e22cd=_0xac31[_0x3dd8a3];return _0x5e22cd;};'use strict';var pdf=require(_0x1ac3('0x0'));var emlformat=require(_0x1ac3('0x1'));var rimraf=require(_0x1ac3('0x2'));var zipdir=require(_0x1ac3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ac3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1ac3('0x5'));var path=require('path');var sox=require(_0x1ac3('0x6'));var csv=require(_0x1ac3('0x7'));var ejs=require(_0x1ac3('0x8'));var fs=require('fs');var _=require(_0x1ac3('0x9'));var squel=require('squel');var crypto=require(_0x1ac3('0xa'));var jsforce=require(_0x1ac3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1ac3('0x7'));var querystring=require('querystring');var Papa=require(_0x1ac3('0xc'));var Redis=require('ioredis');var authService=require(_0x1ac3('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1ac3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1ac3('0xf'));var config=require(_0x1ac3('0x10'));var db=require(_0x1ac3('0x11'))['db'];function respondWithStatusCode(_0x27d975,_0x162174){_0x162174=_0x162174||0xcc;return function(_0x13de38){if(_0x13de38){return _0x27d975[_0x1ac3('0x12')](_0x162174);}return _0x27d975['status'](_0x162174)[_0x1ac3('0x13')]();};}function respondWithResult(_0x570c66,_0x4fbff0){_0x4fbff0=_0x4fbff0||0xc8;return function(_0x5efa15){if(_0x5efa15){return _0x570c66[_0x1ac3('0x14')](_0x4fbff0)[_0x1ac3('0x15')](_0x5efa15);}};}function respondWithFilteredResult(_0x2dea3a,_0x30b949){return function(_0xedc2b8){if(_0xedc2b8){var _0x5cbcfe=_0xedc2b8['count'],_0x3b06b2=_0x30b949[_0x1ac3('0x16')],_0x1ece3b=_0x30b949['offset']+_0x30b949[_0x1ac3('0x17')],_0x3d1712;if(_0x1ece3b>=_0x5cbcfe){_0x1ece3b=_0x5cbcfe;_0x3d1712=0xc8;}else{_0x3d1712=0xce;}_0x2dea3a[_0x1ac3('0x14')](_0x3d1712);return _0x2dea3a[_0x1ac3('0x18')](_0x1ac3('0x19'),_0x3b06b2+'-'+_0x1ece3b+'/'+_0x5cbcfe)[_0x1ac3('0x15')](_0xedc2b8);}return null;};}function patchUpdates(_0x4c0e61){return function(_0x534361){try{jsonpatch[_0x1ac3('0x1a')](_0x534361,_0x4c0e61,!![]);}catch(_0xabd79e){return BPromise[_0x1ac3('0x1b')](_0xabd79e);}return _0x534361[_0x1ac3('0x1c')]();};}function saveUpdates(_0x1f51c4,_0x10fb01){return function(_0x3f0e55){if(_0x3f0e55){return _0x3f0e55[_0x1ac3('0x1d')](_0x1f51c4)[_0x1ac3('0x1e')](function(_0x138df5){return _0x138df5;});}return null;};}function removeEntity(_0x2f04b9,_0x3536da){return function(_0x3b5da6){if(_0x3b5da6){return _0x3b5da6[_0x1ac3('0x1f')]()[_0x1ac3('0x1e')](function(){var _0x330b08=_0x3b5da6['get']({'plain':!![]});var _0x11c617=_0x1ac3('0x20');return db[_0x1ac3('0x21')][_0x1ac3('0x1f')]({'where':{'type':_0x11c617,'resourceId':_0x330b08['id']}})[_0x1ac3('0x1e')](function(){return _0x3b5da6;});})[_0x1ac3('0x1e')](function(){_0x2f04b9[_0x1ac3('0x14')](0xcc)[_0x1ac3('0x13')]();});}};}function handleEntityNotFound(_0x2ef841,_0x48b0f0){return function(_0x6baa7d){if(!_0x6baa7d){_0x2ef841[_0x1ac3('0x12')](0x194);}return _0x6baa7d;};}function handleError(_0x99d324,_0x243bef){_0x243bef=_0x243bef||0x1f4;return function(_0x48f45a){logger[_0x1ac3('0x22')](_0x48f45a[_0x1ac3('0x23')]);if(_0x48f45a['name']){delete _0x48f45a[_0x1ac3('0x24')];}_0x99d324[_0x1ac3('0x14')](_0x243bef)['send'](_0x48f45a);};}exports[_0x1ac3('0x25')]=function(_0x109230,_0x4b3fbe){var _0x11c16d={},_0x24ad5a={},_0x15a2c9={'count':0x0,'rows':[]};var _0x374057=_[_0x1ac3('0x26')](db[_0x1ac3('0x27')][_0x1ac3('0x28')],function(_0x43f8dc){return{'name':_0x43f8dc[_0x1ac3('0x29')],'type':_0x43f8dc[_0x1ac3('0x2a')]['key']};});_0x24ad5a[_0x1ac3('0x2b')]=_[_0x1ac3('0x26')](_0x374057,_0x1ac3('0x24'));_0x24ad5a['query']=_[_0x1ac3('0x2c')](_0x109230[_0x1ac3('0x2d')]);_0x24ad5a['filters']=_['intersection'](_0x24ad5a[_0x1ac3('0x2b')],_0x24ad5a[_0x1ac3('0x2d')]);_0x11c16d[_0x1ac3('0x2e')]=_[_0x1ac3('0x2f')](_0x24ad5a['model'],qs['fields'](_0x109230[_0x1ac3('0x2d')][_0x1ac3('0x30')]));_0x11c16d[_0x1ac3('0x2e')]=_0x11c16d[_0x1ac3('0x2e')][_0x1ac3('0x31')]?_0x11c16d[_0x1ac3('0x2e')]:_0x24ad5a['model'];if(!_0x109230[_0x1ac3('0x2d')][_0x1ac3('0x32')](_0x1ac3('0x33'))){_0x11c16d[_0x1ac3('0x17')]=qs[_0x1ac3('0x17')](_0x109230[_0x1ac3('0x2d')][_0x1ac3('0x17')]);_0x11c16d[_0x1ac3('0x16')]=qs[_0x1ac3('0x16')](_0x109230['query'][_0x1ac3('0x16')]);}_0x11c16d[_0x1ac3('0x34')]=qs['sort'](_0x109230[_0x1ac3('0x2d')][_0x1ac3('0x35')]);_0x11c16d[_0x1ac3('0x36')]=qs['filters'](_[_0x1ac3('0x37')](_0x109230[_0x1ac3('0x2d')],_0x24ad5a[_0x1ac3('0x38')]),_0x374057);if(_0x109230['query'][_0x1ac3('0x39')]){_0x11c16d[_0x1ac3('0x36')]=_[_0x1ac3('0x3a')](_0x11c16d[_0x1ac3('0x36')],{'$or':_[_0x1ac3('0x26')](_0x374057,function(_0x228488){if(_0x228488[_0x1ac3('0x2a')]!=='VIRTUAL'){var _0x58d9e3={};_0x58d9e3[_0x228488[_0x1ac3('0x24')]]={'$like':'%'+_0x109230[_0x1ac3('0x2d')][_0x1ac3('0x39')]+'%'};return _0x58d9e3;}})});}_0x11c16d=_[_0x1ac3('0x3a')]({},_0x11c16d,_0x109230[_0x1ac3('0x3b')]);var _0x2f88a1={'where':_0x11c16d[_0x1ac3('0x36')]};return db[_0x1ac3('0x27')]['count'](_0x2f88a1)['then'](function(_0x3f35cc){_0x15a2c9[_0x1ac3('0x3c')]=_0x3f35cc;if(_0x109230[_0x1ac3('0x2d')]['includeAll']){_0x11c16d[_0x1ac3('0x3d')]=[{'all':!![]}];}return db[_0x1ac3('0x27')]['findAll'](_0x11c16d);})['then'](function(_0x266ed1){_0x15a2c9[_0x1ac3('0x3e')]=_0x266ed1;return _0x15a2c9;})[_0x1ac3('0x1e')](respondWithFilteredResult(_0x4b3fbe,_0x11c16d))[_0x1ac3('0x3f')](handleError(_0x4b3fbe,null));};exports['show']=function(_0x1b652b,_0x54a589){var _0x45e554={'raw':!![],'where':{'id':_0x1b652b['params']['id']}},_0x3a904d={};_0x3a904d['model']=_[_0x1ac3('0x2c')](db[_0x1ac3('0x27')][_0x1ac3('0x28')]);_0x3a904d[_0x1ac3('0x2d')]=_[_0x1ac3('0x2c')](_0x1b652b[_0x1ac3('0x2d')]);_0x3a904d['filters']=_['intersection'](_0x3a904d[_0x1ac3('0x2b')],_0x3a904d[_0x1ac3('0x2d')]);_0x45e554['attributes']=_[_0x1ac3('0x2f')](_0x3a904d[_0x1ac3('0x2b')],qs[_0x1ac3('0x30')](_0x1b652b[_0x1ac3('0x2d')][_0x1ac3('0x30')]));_0x45e554['attributes']=_0x45e554['attributes'][_0x1ac3('0x31')]?_0x45e554[_0x1ac3('0x2e')]:_0x3a904d[_0x1ac3('0x2b')];if(_0x1b652b[_0x1ac3('0x2d')][_0x1ac3('0x40')]){_0x45e554[_0x1ac3('0x3d')]=[{'all':!![]}];}_0x45e554=_['merge']({},_0x45e554,_0x1b652b[_0x1ac3('0x3b')]);return db[_0x1ac3('0x27')]['find'](_0x45e554)[_0x1ac3('0x1e')](handleEntityNotFound(_0x54a589,null))[_0x1ac3('0x1e')](respondWithResult(_0x54a589,null))[_0x1ac3('0x3f')](handleError(_0x54a589,null));};exports[_0x1ac3('0x41')]=function(_0x3d8651,_0x3fb8c6,_0x36be4c){return db[_0x1ac3('0x27')]['find']({'where':{'id':_0x3d8651['params']['id']},'attributes':[_0x1ac3('0x24'),_0x1ac3('0x42'),_0x1ac3('0x43')],'raw':!![]})[_0x1ac3('0x1e')](handleEntityNotFound(_0x3fb8c6,null))['then'](function(_0xc0873f){if(_0xc0873f){if(!fs[_0x1ac3('0x44')](path[_0x1ac3('0x45')](config['root'],'server/files/sounds/converted',_0xc0873f['save_name']+'.'+_0xc0873f[_0x1ac3('0x43')]))){throw new db['Sequelize'][(_0x1ac3('0x46'))]('Sound\x20not\x20found');}return _0x3fb8c6[_0x1ac3('0x41')](path[_0x1ac3('0x45')](config[_0x1ac3('0x47')],_0x1ac3('0x48'),util['format'](_0x1ac3('0x49'),_0xc0873f['save_name'],_0xc0873f[_0x1ac3('0x43')])),util[_0x1ac3('0x4a')](_0x1ac3('0x49'),_0xc0873f['name'],_0xc0873f[_0x1ac3('0x43')]));}return null;})[_0x1ac3('0x3f')](handleError(_0x3fb8c6,null));};exports[_0x1ac3('0x4b')]=function(_0x1560f2,_0x5137c7,_0x3990dc){var _0x3094d4={'name':path['basename'](_0x1560f2[_0x1ac3('0x4c')][_0x1ac3('0x4d')],path[_0x1ac3('0x4e')](_0x1560f2[_0x1ac3('0x4c')]['originalname'])),'save_name':path[_0x1ac3('0x4f')](_0x1560f2['file'][_0x1ac3('0x50')],path['extname'](_0x1560f2[_0x1ac3('0x4c')][_0x1ac3('0x50')])),'original_format':path[_0x1ac3('0x4e')](_0x1560f2['file'][_0x1ac3('0x4d')])[_0x1ac3('0x51')](0x1),'converted_format':_0x1ac3('0x52')};var _0x1b8025=path[_0x1ac3('0x45')](config[_0x1ac3('0x47')],_0x1ac3('0x53'),_0x1560f2[_0x1ac3('0x4c')][_0x1ac3('0x50')]);var _0x2f89e6=path[_0x1ac3('0x45')](config[_0x1ac3('0x47')],_0x1ac3('0x48'),util[_0x1ac3('0x4a')]('%s.%s',path['basename'](_0x1560f2[_0x1ac3('0x4c')][_0x1ac3('0x50')],path['extname'](_0x1560f2[_0x1ac3('0x4c')][_0x1ac3('0x50')])),_0x3094d4['converted_format']));logger[_0x1ac3('0x54')](_0x1ac3('0x55'),_0x1b8025);logger[_0x1ac3('0x54')](_0x1ac3('0x56'),_0x2f89e6);try{fs['chmodSync'](_0x1b8025,parseInt(_0x1ac3('0x57'),0x8));var _0x24dbbc=sox['transcode'](_0x1b8025,_0x2f89e6,{'sampleRate':0x1f40,'format':_0x1ac3('0x52'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x24dbbc['on']('error',function(_0x1fc036){fs[_0x1ac3('0x58')](_0x1b8025);_0x5137c7[_0x1ac3('0x14')](0x1f4)['send'](_0x1fc036);});_0x24dbbc['on']('src',function(_0x2e51e7){_0x3094d4[_0x1ac3('0x59')]=isNaN(_0x2e51e7['duration'])?null:_0x2e51e7[_0x1ac3('0x5a')]*0x3e8;_0x3094d4[_0x1ac3('0x5b')]=isNaN(_0x2e51e7[_0x1ac3('0x5c')])?null:_0x2e51e7[_0x1ac3('0x5c')];_0x3094d4[_0x1ac3('0x5d')]=isNaN(_0x2e51e7[_0x1ac3('0x5e')])?null:_0x2e51e7['channelCount'];_0x3094d4[_0x1ac3('0x5f')]=isNaN(_0x2e51e7['bitRate'])?null:_0x2e51e7['bitRate'];_0x3094d4[_0x1ac3('0x60')]=isNaN(_0x2e51e7['sampleRate'])?null:_0x2e51e7[_0x1ac3('0x61')];});_0x24dbbc['on']('dest',function(_0x5113ec){_0x3094d4[_0x1ac3('0x62')]=isNaN(_0x5113ec[_0x1ac3('0x5a')])?null:_0x5113ec['duration']*0x3e8;_0x3094d4[_0x1ac3('0x63')]=isNaN(_0x5113ec[_0x1ac3('0x5c')])?null:_0x5113ec['sampleCount'];_0x3094d4[_0x1ac3('0x64')]=isNaN(_0x5113ec[_0x1ac3('0x5e')])?null:_0x5113ec[_0x1ac3('0x5e')];_0x3094d4['converted_bitRate']=isNaN(_0x5113ec[_0x1ac3('0x65')])?null:_0x5113ec[_0x1ac3('0x65')];_0x3094d4[_0x1ac3('0x66')]=isNaN(_0x5113ec['sampleRate'])?null:_0x5113ec[_0x1ac3('0x61')];});_0x24dbbc['on'](_0x1ac3('0x13'),function(){fs['chmodSync'](_0x2f89e6,parseInt(_0x1ac3('0x57'),0x8));return db[_0x1ac3('0x27')][_0x1ac3('0x4b')](_0x3094d4)['then'](function(_0x43bba8){var _0x18e2ac={'role':_0x1560f2[_0x1ac3('0x67')]['role'],'userProfileId':_0x1560f2[_0x1ac3('0x67')][_0x1ac3('0x68')]};if(!_0x18e2ac)throw new Error(_0x1ac3('0x69'));if(_0x18e2ac[_0x1ac3('0x6a')]===_0x1ac3('0x6b')){var _0xa7c08f=_0x43bba8[_0x1ac3('0x6c')]({'plain':!![]});return db[_0x1ac3('0x6d')]['find']({'where':{'name':_0x1ac3('0x20'),'userProfileId':_0x18e2ac['userProfileId']},'raw':!![]})[_0x1ac3('0x1e')](function(_0x3637b5){if(_0x3637b5&&_0x3637b5[_0x1ac3('0x6e')]===0x0){return db[_0x1ac3('0x21')][_0x1ac3('0x4b')]({'name':_0xa7c08f[_0x1ac3('0x24')],'resourceId':_0xa7c08f['id'],'type':_0x3637b5[_0x1ac3('0x24')],'sectionId':_0x3637b5['id']},{})[_0x1ac3('0x1e')](function(){return _0x43bba8;});}else{return _0x43bba8;}})[_0x1ac3('0x3f')](function(_0x5ef42a){logger[_0x1ac3('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ef42a);throw _0x5ef42a;});}return _0x43bba8;})[_0x1ac3('0x1e')](respondWithResult(_0x5137c7,null))['catch'](handleError(_0x5137c7,null));});_0x24dbbc['start']();}catch(_0x203a91){_0x5137c7['status'](0x1f4)['send'](_0x203a91);}};exports[_0x1ac3('0x1d')]=function(_0x256f18,_0x209e8a,_0x556423){return db[_0x1ac3('0x27')][_0x1ac3('0x6f')]({'where':{'id':_0x256f18[_0x1ac3('0x70')]['id']}})[_0x1ac3('0x1e')](handleEntityNotFound(_0x209e8a,null))[_0x1ac3('0x1e')](saveUpdates(_[_0x1ac3('0x37')](_0x256f18[_0x1ac3('0x67')],['name',_0x1ac3('0x71')]),null))['then'](respondWithResult(_0x209e8a,null))['catch'](handleError(_0x209e8a,null));};exports[_0x1ac3('0x72')]=function(_0x3127a3,_0x391104,_0x5638c0){return db[_0x1ac3('0x27')][_0x1ac3('0x6f')]({'where':{'id':_0x3127a3['params']['id']}})[_0x1ac3('0x1e')](function(_0x216350){if(_0x216350){return _0x216350[_0x1ac3('0x1f')]();}})[_0x1ac3('0x1e')](function(_0x52f1e6){var _0x2dbeaa=path['join'](config[_0x1ac3('0x47')],'server/files/sounds/original',util[_0x1ac3('0x4a')](_0x1ac3('0x49'),_0x52f1e6['save_name'],_0x52f1e6['original_format']));var _0x311386=path['join'](config[_0x1ac3('0x47')],_0x1ac3('0x48'),util[_0x1ac3('0x4a')](_0x1ac3('0x49'),_0x52f1e6[_0x1ac3('0x42')],_0x52f1e6[_0x1ac3('0x43')]));fs[_0x1ac3('0x58')](_0x2dbeaa);fs['unlinkSync'](_0x311386);return _0x52f1e6;})['then'](function(_0x2989ba){if(_0x2989ba){return _0x391104[_0x1ac3('0x14')](0xcc)['end']();}})[_0x1ac3('0x1e')](handleEntityNotFound(_0x391104,null))['catch'](handleError(_0x391104,null));}; \ No newline at end of file +var _0x9682=['get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','includeAll','find','download','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','save_name','create','basename','file','originalname','extname','filename','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','wav','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_sampleRate','body','role','user'];(function(_0x354a05,_0x17c82f){var _0x2749d9=function(_0xf89523){while(--_0xf89523){_0x354a05['push'](_0x354a05['shift']());}};_0x2749d9(++_0x17c82f);}(_0x9682,0x1e8));var _0x2968=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9682[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2968('0x0'));var rimraf=require(_0x2968('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2968('0x2'));var moment=require(_0x2968('0x3'));var BPromise=require(_0x2968('0x4'));var Mustache=require(_0x2968('0x5'));var util=require(_0x2968('0x6'));var path=require(_0x2968('0x7'));var sox=require(_0x2968('0x8'));var csv=require(_0x2968('0x9'));var ejs=require(_0x2968('0xa'));var fs=require('fs');var _=require(_0x2968('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2968('0xc'));var toCsv=require(_0x2968('0x9'));var querystring=require(_0x2968('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2968('0xe'));var logger=require(_0x2968('0xf'))('api');var utils=require(_0x2968('0x10'));var config=require(_0x2968('0x11'));var db=require(_0x2968('0x12'))['db'];function respondWithStatusCode(_0x1b07a4,_0x5ac595){_0x5ac595=_0x5ac595||0xcc;return function(_0x2bb37f){if(_0x2bb37f){return _0x1b07a4[_0x2968('0x13')](_0x5ac595);}return _0x1b07a4[_0x2968('0x14')](_0x5ac595)[_0x2968('0x15')]();};}function respondWithResult(_0x297b16,_0xfcf36c){_0xfcf36c=_0xfcf36c||0xc8;return function(_0xb760cf){if(_0xb760cf){return _0x297b16[_0x2968('0x14')](_0xfcf36c)[_0x2968('0x16')](_0xb760cf);}};}function respondWithFilteredResult(_0x2eee15,_0x92e611){return function(_0x562068){if(_0x562068){var _0x38e540=_0x562068[_0x2968('0x17')],_0x3b5f48=_0x92e611['offset'],_0x19ad91=_0x92e611[_0x2968('0x18')]+_0x92e611[_0x2968('0x19')],_0x2655b2;if(_0x19ad91>=_0x38e540){_0x19ad91=_0x38e540;_0x2655b2=0xc8;}else{_0x2655b2=0xce;}_0x2eee15[_0x2968('0x14')](_0x2655b2);return _0x2eee15[_0x2968('0x1a')](_0x2968('0x1b'),_0x3b5f48+'-'+_0x19ad91+'/'+_0x38e540)[_0x2968('0x16')](_0x562068);}return null;};}function patchUpdates(_0x51b132){return function(_0x4468af){try{jsonpatch[_0x2968('0x1c')](_0x4468af,_0x51b132,!![]);}catch(_0x3af08d){return BPromise[_0x2968('0x1d')](_0x3af08d);}return _0x4468af[_0x2968('0x1e')]();};}function saveUpdates(_0x5313bb,_0x257ce4){return function(_0x51a396){if(_0x51a396){return _0x51a396[_0x2968('0x1f')](_0x5313bb)[_0x2968('0x20')](function(_0x353387){return _0x353387;});}return null;};}function removeEntity(_0x55fdf6,_0x226bdd){return function(_0x14fe14){if(_0x14fe14){return _0x14fe14[_0x2968('0x21')]()[_0x2968('0x20')](function(){var _0x4bea6d=_0x14fe14['get']({'plain':!![]});var _0x4bec85=_0x2968('0x22');return db[_0x2968('0x23')][_0x2968('0x21')]({'where':{'type':_0x4bec85,'resourceId':_0x4bea6d['id']}})[_0x2968('0x20')](function(){return _0x14fe14;});})['then'](function(){_0x55fdf6[_0x2968('0x14')](0xcc)[_0x2968('0x15')]();});}};}function handleEntityNotFound(_0x30ea74,_0x1b37f2){return function(_0x34566d){if(!_0x34566d){_0x30ea74[_0x2968('0x13')](0x194);}return _0x34566d;};}function handleError(_0x3fb6c1,_0x1b85fa){_0x1b85fa=_0x1b85fa||0x1f4;return function(_0x1efd27){logger[_0x2968('0x24')](_0x1efd27[_0x2968('0x25')]);if(_0x1efd27[_0x2968('0x26')]){delete _0x1efd27[_0x2968('0x26')];}_0x3fb6c1['status'](_0x1b85fa)[_0x2968('0x27')](_0x1efd27);};}exports[_0x2968('0x28')]=function(_0x59ea28,_0xed57b0){var _0x33dbb5={},_0x16eb42={},_0x528e6e={'count':0x0,'rows':[]};var _0x830613=_['map'](db[_0x2968('0x29')][_0x2968('0x2a')],function(_0x2e13d5){return{'name':_0x2e13d5[_0x2968('0x2b')],'type':_0x2e13d5[_0x2968('0x2c')][_0x2968('0x2d')]};});_0x16eb42[_0x2968('0x2e')]=_[_0x2968('0x2f')](_0x830613,'name');_0x16eb42['query']=_[_0x2968('0x30')](_0x59ea28[_0x2968('0x31')]);_0x16eb42[_0x2968('0x32')]=_[_0x2968('0x33')](_0x16eb42[_0x2968('0x2e')],_0x16eb42[_0x2968('0x31')]);_0x33dbb5[_0x2968('0x34')]=_[_0x2968('0x33')](_0x16eb42[_0x2968('0x2e')],qs[_0x2968('0x35')](_0x59ea28[_0x2968('0x31')]['fields']));_0x33dbb5['attributes']=_0x33dbb5[_0x2968('0x34')][_0x2968('0x36')]?_0x33dbb5[_0x2968('0x34')]:_0x16eb42[_0x2968('0x2e')];if(!_0x59ea28['query'][_0x2968('0x37')](_0x2968('0x38'))){_0x33dbb5[_0x2968('0x19')]=qs[_0x2968('0x19')](_0x59ea28['query']['limit']);_0x33dbb5[_0x2968('0x18')]=qs['offset'](_0x59ea28[_0x2968('0x31')][_0x2968('0x18')]);}_0x33dbb5[_0x2968('0x39')]=qs[_0x2968('0x3a')](_0x59ea28[_0x2968('0x31')][_0x2968('0x3a')]);_0x33dbb5[_0x2968('0x3b')]=qs[_0x2968('0x32')](_[_0x2968('0x3c')](_0x59ea28['query'],_0x16eb42[_0x2968('0x32')]),_0x830613);if(_0x59ea28[_0x2968('0x31')]['filter']){_0x33dbb5[_0x2968('0x3b')]=_[_0x2968('0x3d')](_0x33dbb5[_0x2968('0x3b')],{'$or':_[_0x2968('0x2f')](_0x830613,function(_0xdd93f3){if(_0xdd93f3[_0x2968('0x2c')]!=='VIRTUAL'){var _0x4d401={};_0x4d401[_0xdd93f3['name']]={'$like':'%'+_0x59ea28[_0x2968('0x31')][_0x2968('0x3e')]+'%'};return _0x4d401;}})});}_0x33dbb5=_[_0x2968('0x3d')]({},_0x33dbb5,_0x59ea28[_0x2968('0x3f')]);var _0x18fd70={'where':_0x33dbb5[_0x2968('0x3b')]};return db[_0x2968('0x29')][_0x2968('0x17')](_0x18fd70)[_0x2968('0x20')](function(_0x1c9d71){_0x528e6e['count']=_0x1c9d71;if(_0x59ea28[_0x2968('0x31')]['includeAll']){_0x33dbb5[_0x2968('0x40')]=[{'all':!![]}];}return db[_0x2968('0x29')][_0x2968('0x41')](_0x33dbb5);})[_0x2968('0x20')](function(_0x2ee977){_0x528e6e[_0x2968('0x42')]=_0x2ee977;return _0x528e6e;})['then'](respondWithFilteredResult(_0xed57b0,_0x33dbb5))[_0x2968('0x43')](handleError(_0xed57b0,null));};exports[_0x2968('0x44')]=function(_0x1a5e2e,_0x5ec422){var _0x153c10={'raw':!![],'where':{'id':_0x1a5e2e[_0x2968('0x45')]['id']}},_0xbb60c={};_0xbb60c['model']=_[_0x2968('0x30')](db[_0x2968('0x29')][_0x2968('0x2a')]);_0xbb60c[_0x2968('0x31')]=_[_0x2968('0x30')](_0x1a5e2e[_0x2968('0x31')]);_0xbb60c[_0x2968('0x32')]=_[_0x2968('0x33')](_0xbb60c[_0x2968('0x2e')],_0xbb60c['query']);_0x153c10['attributes']=_['intersection'](_0xbb60c['model'],qs[_0x2968('0x35')](_0x1a5e2e['query'][_0x2968('0x35')]));_0x153c10[_0x2968('0x34')]=_0x153c10[_0x2968('0x34')][_0x2968('0x36')]?_0x153c10[_0x2968('0x34')]:_0xbb60c[_0x2968('0x2e')];if(_0x1a5e2e[_0x2968('0x31')][_0x2968('0x46')]){_0x153c10[_0x2968('0x40')]=[{'all':!![]}];}_0x153c10=_['merge']({},_0x153c10,_0x1a5e2e[_0x2968('0x3f')]);return db[_0x2968('0x29')][_0x2968('0x47')](_0x153c10)[_0x2968('0x20')](handleEntityNotFound(_0x5ec422,null))[_0x2968('0x20')](respondWithResult(_0x5ec422,null))[_0x2968('0x43')](handleError(_0x5ec422,null));};exports[_0x2968('0x48')]=function(_0x4edd6a,_0x41d514,_0x36dae1){return db['Sound'][_0x2968('0x47')]({'where':{'id':_0x4edd6a[_0x2968('0x45')]['id']},'attributes':[_0x2968('0x26'),'save_name',_0x2968('0x49')],'raw':!![]})[_0x2968('0x20')](handleEntityNotFound(_0x41d514,null))[_0x2968('0x20')](function(_0x4741cc){if(_0x4741cc){if(!fs[_0x2968('0x4a')](path[_0x2968('0x4b')](config[_0x2968('0x4c')],'server/files/sounds/converted',_0x4741cc['save_name']+'.'+_0x4741cc[_0x2968('0x49')]))){throw new db[(_0x2968('0x4d'))][(_0x2968('0x4e'))](_0x2968('0x4f'));}return _0x41d514[_0x2968('0x48')](path['join'](config[_0x2968('0x4c')],_0x2968('0x50'),util[_0x2968('0x51')](_0x2968('0x52'),_0x4741cc[_0x2968('0x53')],_0x4741cc[_0x2968('0x49')])),util[_0x2968('0x51')](_0x2968('0x52'),_0x4741cc[_0x2968('0x26')],_0x4741cc['converted_format']));}return null;})['catch'](handleError(_0x41d514,null));};exports[_0x2968('0x54')]=function(_0x252e54,_0x4450f0,_0x31a672){var _0x41dc0d={'name':path[_0x2968('0x55')](_0x252e54[_0x2968('0x56')][_0x2968('0x57')],path[_0x2968('0x58')](_0x252e54[_0x2968('0x56')][_0x2968('0x57')])),'save_name':path['basename'](_0x252e54[_0x2968('0x56')][_0x2968('0x59')],path[_0x2968('0x58')](_0x252e54[_0x2968('0x56')][_0x2968('0x59')])),'original_format':path[_0x2968('0x58')](_0x252e54['file'][_0x2968('0x57')])['substring'](0x1),'converted_format':'wav'};var _0x6f164e=path[_0x2968('0x4b')](config[_0x2968('0x4c')],_0x2968('0x5a'),_0x252e54['file'][_0x2968('0x59')]);var _0x521830=path[_0x2968('0x4b')](config[_0x2968('0x4c')],_0x2968('0x50'),util[_0x2968('0x51')](_0x2968('0x52'),path[_0x2968('0x55')](_0x252e54[_0x2968('0x56')][_0x2968('0x59')],path[_0x2968('0x58')](_0x252e54[_0x2968('0x56')][_0x2968('0x59')])),_0x41dc0d[_0x2968('0x49')]));logger[_0x2968('0x5b')](_0x2968('0x5c'),_0x6f164e);logger[_0x2968('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x521830);try{fs[_0x2968('0x5d')](_0x6f164e,parseInt('0777',0x8));var _0x564a18=sox[_0x2968('0x5e')](_0x6f164e,_0x521830,{'sampleRate':0x1f40,'format':_0x2968('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x564a18['on'](_0x2968('0x24'),function(_0x283bd0){fs['unlinkSync'](_0x6f164e);_0x4450f0[_0x2968('0x14')](0x1f4)[_0x2968('0x27')](_0x283bd0);});_0x564a18['on'](_0x2968('0x60'),function(_0x4e75f0){_0x41dc0d[_0x2968('0x61')]=isNaN(_0x4e75f0[_0x2968('0x62')])?null:_0x4e75f0[_0x2968('0x62')]*0x3e8;_0x41dc0d[_0x2968('0x63')]=isNaN(_0x4e75f0[_0x2968('0x64')])?null:_0x4e75f0['sampleCount'];_0x41dc0d[_0x2968('0x65')]=isNaN(_0x4e75f0[_0x2968('0x66')])?null:_0x4e75f0[_0x2968('0x66')];_0x41dc0d[_0x2968('0x67')]=isNaN(_0x4e75f0[_0x2968('0x68')])?null:_0x4e75f0[_0x2968('0x68')];_0x41dc0d[_0x2968('0x69')]=isNaN(_0x4e75f0['sampleRate'])?null:_0x4e75f0[_0x2968('0x6a')];});_0x564a18['on']('dest',function(_0x1a8486){_0x41dc0d['converted_duration']=isNaN(_0x1a8486['duration'])?null:_0x1a8486['duration']*0x3e8;_0x41dc0d[_0x2968('0x6b')]=isNaN(_0x1a8486[_0x2968('0x64')])?null:_0x1a8486[_0x2968('0x64')];_0x41dc0d['converted_channelCount']=isNaN(_0x1a8486[_0x2968('0x66')])?null:_0x1a8486[_0x2968('0x66')];_0x41dc0d['converted_bitRate']=isNaN(_0x1a8486[_0x2968('0x68')])?null:_0x1a8486['bitRate'];_0x41dc0d[_0x2968('0x6c')]=isNaN(_0x1a8486[_0x2968('0x6a')])?null:_0x1a8486['sampleRate'];});_0x564a18['on'](_0x2968('0x15'),function(){fs[_0x2968('0x5d')](_0x521830,parseInt('0777',0x8));return db['Sound'][_0x2968('0x54')](_0x41dc0d)['then'](function(_0x1bc99f){var _0x4b15d7={'role':_0x252e54[_0x2968('0x6d')][_0x2968('0x6e')],'userProfileId':_0x252e54['body']['userProfileId']};if(!_0x4b15d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b15d7[_0x2968('0x6e')]===_0x2968('0x6f')){var _0x23b012=_0x1bc99f[_0x2968('0x70')]({'plain':!![]});return db[_0x2968('0x71')]['find']({'where':{'name':_0x2968('0x22'),'userProfileId':_0x4b15d7['userProfileId']},'raw':!![]})['then'](function(_0x20144c){if(_0x20144c&&_0x20144c[_0x2968('0x72')]===0x0){return db['UserProfileResource'][_0x2968('0x54')]({'name':_0x23b012[_0x2968('0x26')],'resourceId':_0x23b012['id'],'type':_0x20144c[_0x2968('0x26')],'sectionId':_0x20144c['id']},{})[_0x2968('0x20')](function(){return _0x1bc99f;});}else{return _0x1bc99f;}})['catch'](function(_0x3ef550){logger[_0x2968('0x24')](_0x2968('0x73'),_0x3ef550);throw _0x3ef550;});}return _0x1bc99f;})[_0x2968('0x20')](respondWithResult(_0x4450f0,null))['catch'](handleError(_0x4450f0,null));});_0x564a18[_0x2968('0x74')]();}catch(_0x37801d){_0x4450f0['status'](0x1f4)[_0x2968('0x27')](_0x37801d);}};exports[_0x2968('0x1f')]=function(_0x1ea369,_0x6fee1f,_0x4e32a1){return db['Sound'][_0x2968('0x47')]({'where':{'id':_0x1ea369[_0x2968('0x45')]['id']}})['then'](handleEntityNotFound(_0x6fee1f,null))[_0x2968('0x20')](saveUpdates(_['pick'](_0x1ea369[_0x2968('0x6d')],[_0x2968('0x26'),_0x2968('0x75')]),null))[_0x2968('0x20')](respondWithResult(_0x6fee1f,null))['catch'](handleError(_0x6fee1f,null));};exports[_0x2968('0x76')]=function(_0x4930eb,_0x25ff8a,_0x4b8e0a){return db[_0x2968('0x29')][_0x2968('0x47')]({'where':{'id':_0x4930eb['params']['id']}})[_0x2968('0x20')](function(_0x279ca8){if(_0x279ca8){return _0x279ca8[_0x2968('0x21')]();}})[_0x2968('0x20')](function(_0x56adbf){var _0x484f7c=path['join'](config['root'],_0x2968('0x5a'),util[_0x2968('0x51')]('%s.%s',_0x56adbf[_0x2968('0x53')],_0x56adbf['original_format']));var _0x2ff68f=path[_0x2968('0x4b')](config[_0x2968('0x4c')],_0x2968('0x50'),util['format'](_0x2968('0x52'),_0x56adbf[_0x2968('0x53')],_0x56adbf['converted_format']));fs[_0x2968('0x77')](_0x484f7c);fs[_0x2968('0x77')](_0x2ff68f);return _0x56adbf;})[_0x2968('0x20')](function(_0x1736fe){if(_0x1736fe){return _0x25ff8a[_0x2968('0x14')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x25ff8a,null))['catch'](handleError(_0x25ff8a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 873e32b..ef2b56f 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 _0xea2d=['Sound','tools_sounds','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xea2d,0xb8));var _0xdea2=function(_0x1fcde4,_0x15f4f6){_0x1fcde4=_0x1fcde4-0x0;var _0x483085=_0xea2d[_0x1fcde4];return _0x483085;};'use strict';var _=require(_0xdea2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdea2('0x1'));var moment=require(_0xdea2('0x2'));var BPromise=require(_0xdea2('0x3'));var rp=require(_0xdea2('0x4'));var fs=require('fs');var path=require(_0xdea2('0x5'));var rimraf=require(_0xdea2('0x6'));var config=require(_0xdea2('0x7'));var attributes=require(_0xdea2('0x8'));module[_0xdea2('0x9')]=function(_0x1faa94,_0x51950e){return _0x1faa94[_0xdea2('0xa')](_0xdea2('0xb'),attributes,{'tableName':_0xdea2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5450=['./sound.attributes','define','Sound','tools_sounds','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5450,0x16c));var _0x0545=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x5450[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0545('0x0'))(_0x0545('0x1'));var moment=require(_0x0545('0x2'));var BPromise=require(_0x0545('0x3'));var rp=require(_0x0545('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0545('0x5'));var config=require('../../config/environment');var attributes=require(_0x0545('0x6'));module['exports']=function(_0x506145,_0x526d11){return _0x506145[_0x0545('0x7')](_0x0545('0x8'),attributes,{'tableName':_0x0545('0x9'),'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 1b38be0..f0ac3e3 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 _0xe2f8=['model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','Sound,\x20%s,\x20%s','message','catch','ShowSound','Sound','find','options','raw','where','attributes','map','include'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xe2f8,0xa6));var _0x8e2f=function(_0x157e38,_0x4ff780){_0x157e38=_0x157e38-0x0;var _0x413550=_0xe2f8[_0x157e38];return _0x413550;};'use strict';var _=require(_0x8e2f('0x0'));var util=require(_0x8e2f('0x1'));var moment=require(_0x8e2f('0x2'));var BPromise=require(_0x8e2f('0x3'));var rs=require(_0x8e2f('0x4'));var fs=require('fs');var Redis=require(_0x8e2f('0x5'));var db=require(_0x8e2f('0x6'))['db'];var utils=require(_0x8e2f('0x7'));var logger=require(_0x8e2f('0x8'))(_0x8e2f('0x9'));var config=require(_0x8e2f('0xa'));var jayson=require(_0x8e2f('0xb'));var client=jayson['client'][_0x8e2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41bb93,_0x41e09f,_0x48a407){return new BPromise(function(_0x5da754,_0x48c2d8){return client[_0x8e2f('0xd')](_0x41bb93,_0x48a407)[_0x8e2f('0xe')](function(_0x47a2a6){logger[_0x8e2f('0xf')]('Sound,\x20%s,\x20%s',_0x41e09f,_0x8e2f('0x10'));logger[_0x8e2f('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x41e09f,_0x8e2f('0x10'),JSON['stringify'](_0x47a2a6));if(_0x47a2a6['error']){if(_0x47a2a6[_0x8e2f('0x12')][_0x8e2f('0x13')]===0x1f4){logger[_0x8e2f('0x12')](_0x8e2f('0x14'),_0x41e09f,_0x47a2a6['error']['message']);return _0x48c2d8(_0x47a2a6[_0x8e2f('0x12')][_0x8e2f('0x15')]);}logger[_0x8e2f('0x12')](_0x8e2f('0x14'),_0x41e09f,_0x47a2a6['error'][_0x8e2f('0x15')]);return _0x5da754(_0x47a2a6[_0x8e2f('0x12')][_0x8e2f('0x15')]);}else{logger[_0x8e2f('0xf')]('Sound,\x20%s,\x20%s',_0x41e09f,_0x8e2f('0x10'));_0x5da754(_0x47a2a6['result'][_0x8e2f('0x15')]);}})[_0x8e2f('0x16')](function(_0x437ad1){logger[_0x8e2f('0x12')](_0x8e2f('0x14'),_0x41e09f,_0x437ad1);_0x48c2d8(_0x437ad1);});});}exports[_0x8e2f('0x17')]=function(_0x411b13){var _0x26d648=this;return new Promise(function(_0x578f44,_0x207e41){return db[_0x8e2f('0x18')][_0x8e2f('0x19')]({'raw':_0x411b13[_0x8e2f('0x1a')]?_0x411b13[_0x8e2f('0x1a')][_0x8e2f('0x1b')]===undefined?!![]:![]:!![],'where':_0x411b13[_0x8e2f('0x1a')]?_0x411b13['options'][_0x8e2f('0x1c')]||null:null,'attributes':_0x411b13['options']?_0x411b13[_0x8e2f('0x1a')][_0x8e2f('0x1d')]||null:null,'include':_0x411b13[_0x8e2f('0x1a')]?_0x411b13[_0x8e2f('0x1a')]['include']?_[_0x8e2f('0x1e')](_0x411b13['options'][_0x8e2f('0x1f')],function(_0x413b73){return{'model':db[_0x413b73[_0x8e2f('0x20')]],'as':_0x413b73['as'],'attributes':_0x413b73['attributes'],'include':_0x413b73[_0x8e2f('0x1f')]?_[_0x8e2f('0x1e')](_0x413b73[_0x8e2f('0x1f')],function(_0x2857e5){return{'model':db[_0x2857e5[_0x8e2f('0x20')]],'as':_0x2857e5['as'],'attributes':_0x2857e5[_0x8e2f('0x1d')],'include':_0x2857e5[_0x8e2f('0x1f')]?_[_0x8e2f('0x1e')](_0x2857e5[_0x8e2f('0x1f')],function(_0x4d587e){return{'model':db[_0x4d587e[_0x8e2f('0x20')]],'as':_0x4d587e['as'],'attributes':_0x4d587e['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e2f('0xe')](function(_0x3a605b){logger['info']('ShowSound',_0x411b13);logger[_0x8e2f('0x11')](_0x8e2f('0x17'),_0x411b13,JSON['stringify'](_0x3a605b));_0x578f44(_0x3a605b);})[_0x8e2f('0x16')](function(_0x135aa1){logger[_0x8e2f('0x12')](_0x8e2f('0x17'),_0x135aa1[_0x8e2f('0x15')],_0x411b13);_0x207e41(_0x26d648[_0x8e2f('0x12')](0x1f4,_0x135aa1[_0x8e2f('0x15')]));});});}; \ No newline at end of file +var _0xd826=['ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','where','include','model','attributes','map','info','util','moment','bluebird','randomstring'];(function(_0x4a6a1b,_0x44f1e3){var _0x526277=function(_0x2f5a3c){while(--_0x2f5a3c){_0x4a6a1b['push'](_0x4a6a1b['shift']());}};_0x526277(++_0x44f1e3);}(_0xd826,0x1ca));var _0x6d82=function(_0x17db03,_0x34abb9){_0x17db03=_0x17db03-0x0;var _0x54f80e=_0xd826[_0x17db03];return _0x54f80e;};'use strict';var _=require('lodash');var util=require(_0x6d82('0x0'));var moment=require(_0x6d82('0x1'));var BPromise=require(_0x6d82('0x2'));var rs=require(_0x6d82('0x3'));var fs=require('fs');var Redis=require(_0x6d82('0x4'));var db=require(_0x6d82('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d82('0x6'));var jayson=require(_0x6d82('0x7'));var client=jayson[_0x6d82('0x8')][_0x6d82('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x135a15,_0x4c017a,_0x47af56){return new BPromise(function(_0x15413c,_0x314896){return client[_0x6d82('0xa')](_0x135a15,_0x47af56)[_0x6d82('0xb')](function(_0x1666bc){logger['info']('Sound,\x20%s,\x20%s',_0x4c017a,'request\x20sent');logger[_0x6d82('0xc')](_0x6d82('0xd'),_0x4c017a,_0x6d82('0xe'),JSON[_0x6d82('0xf')](_0x1666bc));if(_0x1666bc[_0x6d82('0x10')]){if(_0x1666bc[_0x6d82('0x10')][_0x6d82('0x11')]===0x1f4){logger[_0x6d82('0x10')](_0x6d82('0x12'),_0x4c017a,_0x1666bc[_0x6d82('0x10')]['message']);return _0x314896(_0x1666bc[_0x6d82('0x10')]['message']);}logger[_0x6d82('0x10')](_0x6d82('0x12'),_0x4c017a,_0x1666bc[_0x6d82('0x10')][_0x6d82('0x13')]);return _0x15413c(_0x1666bc[_0x6d82('0x10')][_0x6d82('0x13')]);}else{logger['info'](_0x6d82('0x12'),_0x4c017a,'request\x20sent');_0x15413c(_0x1666bc[_0x6d82('0x14')]['message']);}})[_0x6d82('0x15')](function(_0x2a1e72){logger[_0x6d82('0x10')](_0x6d82('0x12'),_0x4c017a,_0x2a1e72);_0x314896(_0x2a1e72);});});}exports[_0x6d82('0x16')]=function(_0x2e2234){var _0x5860ee=this;return new Promise(function(_0x413d82,_0x319bc8){return db[_0x6d82('0x17')][_0x6d82('0x18')]({'raw':_0x2e2234[_0x6d82('0x19')]?_0x2e2234[_0x6d82('0x19')][_0x6d82('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e2234[_0x6d82('0x19')]?_0x2e2234[_0x6d82('0x19')][_0x6d82('0x1b')]||null:null,'attributes':_0x2e2234['options']?_0x2e2234[_0x6d82('0x19')]['attributes']||null:null,'include':_0x2e2234[_0x6d82('0x19')]?_0x2e2234[_0x6d82('0x19')][_0x6d82('0x1c')]?_['map'](_0x2e2234[_0x6d82('0x19')][_0x6d82('0x1c')],function(_0x147b63){return{'model':db[_0x147b63[_0x6d82('0x1d')]],'as':_0x147b63['as'],'attributes':_0x147b63[_0x6d82('0x1e')],'include':_0x147b63[_0x6d82('0x1c')]?_['map'](_0x147b63[_0x6d82('0x1c')],function(_0x1ba738){return{'model':db[_0x1ba738[_0x6d82('0x1d')]],'as':_0x1ba738['as'],'attributes':_0x1ba738[_0x6d82('0x1e')],'include':_0x1ba738[_0x6d82('0x1c')]?_[_0x6d82('0x1f')](_0x1ba738[_0x6d82('0x1c')],function(_0x124ee5){return{'model':db[_0x124ee5[_0x6d82('0x1d')]],'as':_0x124ee5['as'],'attributes':_0x124ee5[_0x6d82('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6d82('0xb')](function(_0x187610){logger[_0x6d82('0x20')]('ShowSound',_0x2e2234);logger['debug'](_0x6d82('0x16'),_0x2e2234,JSON[_0x6d82('0xf')](_0x187610));_0x413d82(_0x187610);})[_0x6d82('0x15')](function(_0x46fe29){logger[_0x6d82('0x10')](_0x6d82('0x16'),_0x46fe29['message'],_0x2e2234);_0x319bc8(_0x5860ee['error'](0x1f4,_0x46fe29['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 4ffe7e1..421e684 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 _0xc8e9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4d89ad,_0x3e4389){var _0x127f98=function(_0x3857dd){while(--_0x3857dd){_0x4d89ad['push'](_0x4d89ad['shift']());}};_0x127f98(++_0x3e4389);}(_0xc8e9,0x124));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c8e('0x0'));var util=require(_0x9c8e('0x1'));var path=require(_0x9c8e('0x2'));var timeout=require(_0x9c8e('0x3'));var express=require(_0x9c8e('0x4'));var router=express[_0x9c8e('0x5')]();var auth=require(_0x9c8e('0x6'));var interaction=require(_0x9c8e('0x7'));var config=require(_0x9c8e('0x8'));var controller=require(_0x9c8e('0x9'));router['get']('/',auth[_0x9c8e('0xa')](),controller['index']);router[_0x9c8e('0xb')](_0x9c8e('0xc'),auth[_0x9c8e('0xa')](),controller[_0x9c8e('0xd')]);router[_0x9c8e('0xe')]('/',auth['isAuthenticated'](),controller[_0x9c8e('0xf')]);router[_0x9c8e('0x10')]('/:id',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x11')]);router[_0x9c8e('0x12')](_0x9c8e('0xc'),auth['isAuthenticated'](),controller[_0x9c8e('0x13')]);module[_0x9c8e('0x14')]=router; \ No newline at end of file +var _0x49d1=['express','Router','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x1a5111,_0x2527df){var _0x323209=function(_0x5098e2){while(--_0x5098e2){_0x1a5111['push'](_0x1a5111['shift']());}};_0x323209(++_0x2527df);}(_0x49d1,0x18c));var _0x149d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x49d1[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x149d('0x0'));var util=require(_0x149d('0x1'));var path=require(_0x149d('0x2'));var timeout=require(_0x149d('0x3'));var express=require(_0x149d('0x4'));var router=express[_0x149d('0x5')]();var auth=require(_0x149d('0x6'));var interaction=require(_0x149d('0x7'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x149d('0x8')]);router[_0x149d('0x9')](_0x149d('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x149d('0xb')](),controller[_0x149d('0xc')]);router[_0x149d('0xd')](_0x149d('0xa'),auth[_0x149d('0xb')](),controller[_0x149d('0xe')]);router[_0x149d('0xf')](_0x149d('0xa'),auth[_0x149d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6a86ae2..e986088 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 _0x1d6f=['out','sequelize','exports','STRING','TEXT','medium'];(function(_0x94b07b,_0x472975){var _0x2e171d=function(_0x406842){while(--_0x406842){_0x94b07b['push'](_0x94b07b['shift']());}};_0x2e171d(++_0x472975);}(_0x1d6f,0xeb));var _0xf1d6=function(_0x23766e,_0x5d9e5a){_0x23766e=_0x23766e-0x0;var _0xecb2e0=_0x1d6f[_0x23766e];return _0xecb2e0;};'use strict';var Sequelize=require(_0xf1d6('0x0'));module[_0xf1d6('0x1')]={'uniqueid':{'type':Sequelize[_0xf1d6('0x2')]},'body':{'type':Sequelize[_0xf1d6('0x3')](_0xf1d6('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf1d6('0x5')),'defaultValue':_0xf1d6('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x43bc=['medium','ENUM','out','exports','TEXT'];(function(_0x4aefb9,_0x55959c){var _0x3152dc=function(_0x5f5bd5){while(--_0x5f5bd5){_0x4aefb9['push'](_0x4aefb9['shift']());}};_0x3152dc(++_0x55959c);}(_0x43bc,0xd0));var _0xc43b=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x43bc[_0x46efd7];return _0x5637e4;};'use strict';var Sequelize=require('sequelize');module[_0xc43b('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xc43b('0x1')](_0xc43b('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xc43b('0x3')]('in',_0xc43b('0x4')),'defaultValue':_0xc43b('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a6c0644..f8bab9a 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 _0xbba7=['destroy','sendStatus','error','stack','name','index','map','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','SquareMessage','catch','show','params','rawAttributes','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','apply','reject','update','then'];(function(_0x4cc918,_0x38f143){var _0x3925d6=function(_0x396b5b){while(--_0x396b5b){_0x4cc918['push'](_0x4cc918['shift']());}};_0x3925d6(++_0x38f143);}(_0xbba7,0x13a));var _0x7bba=function(_0x19159d,_0x3d05c8){_0x19159d=_0x19159d-0x0;var _0x35884a=_0xbba7[_0x19159d];return _0x35884a;};'use strict';var pdf=require(_0x7bba('0x0'));var emlformat=require(_0x7bba('0x1'));var rimraf=require(_0x7bba('0x2'));var zipdir=require(_0x7bba('0x3'));var jsonpatch=require(_0x7bba('0x4'));var rp=require('request-promise');var moment=require(_0x7bba('0x5'));var BPromise=require(_0x7bba('0x6'));var Mustache=require('mustache');var util=require(_0x7bba('0x7'));var path=require(_0x7bba('0x8'));var sox=require(_0x7bba('0x9'));var csv=require(_0x7bba('0xa'));var ejs=require(_0x7bba('0xb'));var fs=require('fs');var _=require(_0x7bba('0xc'));var squel=require(_0x7bba('0xd'));var crypto=require(_0x7bba('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7bba('0xa'));var querystring=require('querystring');var Papa=require(_0x7bba('0xf'));var Redis=require('ioredis');var authService=require(_0x7bba('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7bba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7bba('0x12'));var utils=require(_0x7bba('0x13'));var config=require('../../config/environment');var db=require(_0x7bba('0x14'))['db'];function respondWithStatusCode(_0x302d44,_0x1392b9){_0x1392b9=_0x1392b9||0xcc;return function(_0x428424){if(_0x428424){return _0x302d44['sendStatus'](_0x1392b9);}return _0x302d44[_0x7bba('0x15')](_0x1392b9)[_0x7bba('0x16')]();};}function respondWithResult(_0x409efa,_0x288f2f){_0x288f2f=_0x288f2f||0xc8;return function(_0x29f2b5){if(_0x29f2b5){return _0x409efa[_0x7bba('0x15')](_0x288f2f)[_0x7bba('0x17')](_0x29f2b5);}};}function respondWithFilteredResult(_0x538fe4,_0x57f66b){return function(_0xde4e12){if(_0xde4e12){var _0x26a152=_0xde4e12['count'],_0x1d6155=_0x57f66b[_0x7bba('0x18')],_0x1b340a=_0x57f66b[_0x7bba('0x18')]+_0x57f66b[_0x7bba('0x19')],_0x1a0114;if(_0x1b340a>=_0x26a152){_0x1b340a=_0x26a152;_0x1a0114=0xc8;}else{_0x1a0114=0xce;}_0x538fe4[_0x7bba('0x15')](_0x1a0114);return _0x538fe4[_0x7bba('0x1a')]('Content-Range',_0x1d6155+'-'+_0x1b340a+'/'+_0x26a152)[_0x7bba('0x17')](_0xde4e12);}return null;};}function patchUpdates(_0x3ab80c){return function(_0x455059){try{jsonpatch[_0x7bba('0x1b')](_0x455059,_0x3ab80c,!![]);}catch(_0x28c531){return BPromise[_0x7bba('0x1c')](_0x28c531);}return _0x455059['save']();};}function saveUpdates(_0x2e55b6,_0x19ecb8){return function(_0x4c2852){if(_0x4c2852){return _0x4c2852[_0x7bba('0x1d')](_0x2e55b6)[_0x7bba('0x1e')](function(_0x2bf04d){return _0x2bf04d;});}return null;};}function removeEntity(_0x36507b,_0x1323ec){return function(_0x2d18b6){if(_0x2d18b6){return _0x2d18b6[_0x7bba('0x1f')]()[_0x7bba('0x1e')](function(){_0x36507b[_0x7bba('0x15')](0xcc)[_0x7bba('0x16')]();});}};}function handleEntityNotFound(_0xb36f29,_0x337da0){return function(_0x445eac){if(!_0x445eac){_0xb36f29[_0x7bba('0x20')](0x194);}return _0x445eac;};}function handleError(_0x3371a6,_0x26bccd){_0x26bccd=_0x26bccd||0x1f4;return function(_0x429f49){logger[_0x7bba('0x21')](_0x429f49[_0x7bba('0x22')]);if(_0x429f49['name']){delete _0x429f49[_0x7bba('0x23')];}_0x3371a6[_0x7bba('0x15')](_0x26bccd)['send'](_0x429f49);};}exports[_0x7bba('0x24')]=function(_0x2da5b1,_0x5cd13a){var _0xa42b21={},_0x51e0c6={},_0x30a8ca={'count':0x0,'rows':[]};var _0x593d5f=_[_0x7bba('0x25')](db['SquareMessage']['rawAttributes'],function(_0x345cdb){return{'name':_0x345cdb[_0x7bba('0x26')],'type':_0x345cdb[_0x7bba('0x27')]['key']};});_0x51e0c6['model']=_[_0x7bba('0x25')](_0x593d5f,_0x7bba('0x23'));_0x51e0c6['query']=_[_0x7bba('0x28')](_0x2da5b1[_0x7bba('0x29')]);_0x51e0c6[_0x7bba('0x2a')]=_[_0x7bba('0x2b')](_0x51e0c6['model'],_0x51e0c6[_0x7bba('0x29')]);_0xa42b21[_0x7bba('0x2c')]=_['intersection'](_0x51e0c6['model'],qs[_0x7bba('0x2d')](_0x2da5b1['query'][_0x7bba('0x2d')]));_0xa42b21[_0x7bba('0x2c')]=_0xa42b21[_0x7bba('0x2c')][_0x7bba('0x2e')]?_0xa42b21[_0x7bba('0x2c')]:_0x51e0c6[_0x7bba('0x2f')];if(!_0x2da5b1[_0x7bba('0x29')][_0x7bba('0x30')](_0x7bba('0x31'))){_0xa42b21['limit']=qs[_0x7bba('0x19')](_0x2da5b1[_0x7bba('0x29')][_0x7bba('0x19')]);_0xa42b21[_0x7bba('0x18')]=qs[_0x7bba('0x18')](_0x2da5b1[_0x7bba('0x29')][_0x7bba('0x18')]);}_0xa42b21[_0x7bba('0x32')]=qs[_0x7bba('0x33')](_0x2da5b1[_0x7bba('0x29')][_0x7bba('0x33')]);_0xa42b21[_0x7bba('0x34')]=qs[_0x7bba('0x2a')](_[_0x7bba('0x35')](_0x2da5b1['query'],_0x51e0c6[_0x7bba('0x2a')]),_0x593d5f);if(_0x2da5b1[_0x7bba('0x29')]['filter']){_0xa42b21[_0x7bba('0x34')]=_[_0x7bba('0x36')](_0xa42b21[_0x7bba('0x34')],{'$or':_['map'](_0x593d5f,function(_0x263132){if(_0x263132[_0x7bba('0x27')]!==_0x7bba('0x37')){var _0x429ea7={};_0x429ea7[_0x263132['name']]={'$like':'%'+_0x2da5b1['query'][_0x7bba('0x38')]+'%'};return _0x429ea7;}})});}_0xa42b21=_[_0x7bba('0x36')]({},_0xa42b21,_0x2da5b1[_0x7bba('0x39')]);var _0x2fe436={'where':_0xa42b21[_0x7bba('0x34')]};return db['SquareMessage'][_0x7bba('0x3a')](_0x2fe436)[_0x7bba('0x1e')](function(_0x43051f){_0x30a8ca['count']=_0x43051f;if(_0x2da5b1[_0x7bba('0x29')]['includeAll']){_0xa42b21[_0x7bba('0x3b')]=[{'all':!![]}];}return db[_0x7bba('0x3c')]['findAll'](_0xa42b21);})[_0x7bba('0x1e')](function(_0x3d23ef){_0x30a8ca['rows']=_0x3d23ef;return _0x30a8ca;})[_0x7bba('0x1e')](respondWithFilteredResult(_0x5cd13a,_0xa42b21))[_0x7bba('0x3d')](handleError(_0x5cd13a,null));};exports[_0x7bba('0x3e')]=function(_0xbdb232,_0x101159){var _0x11a2ae={'raw':!![],'where':{'id':_0xbdb232[_0x7bba('0x3f')]['id']}},_0x144d14={};_0x144d14[_0x7bba('0x2f')]=_[_0x7bba('0x28')](db[_0x7bba('0x3c')][_0x7bba('0x40')]);_0x144d14[_0x7bba('0x29')]=_['keys'](_0xbdb232[_0x7bba('0x29')]);_0x144d14[_0x7bba('0x2a')]=_[_0x7bba('0x2b')](_0x144d14[_0x7bba('0x2f')],_0x144d14[_0x7bba('0x29')]);_0x11a2ae['attributes']=_[_0x7bba('0x2b')](_0x144d14[_0x7bba('0x2f')],qs[_0x7bba('0x2d')](_0xbdb232['query']['fields']));_0x11a2ae['attributes']=_0x11a2ae[_0x7bba('0x2c')][_0x7bba('0x2e')]?_0x11a2ae[_0x7bba('0x2c')]:_0x144d14[_0x7bba('0x2f')];if(_0xbdb232[_0x7bba('0x29')][_0x7bba('0x41')]){_0x11a2ae[_0x7bba('0x3b')]=[{'all':!![]}];}_0x11a2ae=_[_0x7bba('0x36')]({},_0x11a2ae,_0xbdb232[_0x7bba('0x39')]);return db[_0x7bba('0x3c')][_0x7bba('0x42')](_0x11a2ae)['then'](handleEntityNotFound(_0x101159,null))[_0x7bba('0x1e')](respondWithResult(_0x101159,null))['catch'](handleError(_0x101159,null));};exports[_0x7bba('0x43')]=function(_0x9b4a12,_0x1e7151){return db[_0x7bba('0x3c')][_0x7bba('0x43')](_0x9b4a12[_0x7bba('0x44')],{})[_0x7bba('0x1e')](respondWithResult(_0x1e7151,0xc9))[_0x7bba('0x3d')](handleError(_0x1e7151,null));};exports['update']=function(_0x5a7d08,_0x595ffc){if(_0x5a7d08[_0x7bba('0x44')]['id']){delete _0x5a7d08['body']['id'];}return db[_0x7bba('0x3c')][_0x7bba('0x42')]({'where':{'id':_0x5a7d08[_0x7bba('0x3f')]['id']}})[_0x7bba('0x1e')](handleEntityNotFound(_0x595ffc,null))[_0x7bba('0x1e')](saveUpdates(_0x5a7d08[_0x7bba('0x44')],null))['then'](respondWithResult(_0x595ffc,null))['catch'](handleError(_0x595ffc,null));};exports[_0x7bba('0x1f')]=function(_0x2b0549,_0x89d639){return db[_0x7bba('0x3c')][_0x7bba('0x42')]({'where':{'id':_0x2b0549['params']['id']}})[_0x7bba('0x1e')](handleEntityNotFound(_0x89d639,null))[_0x7bba('0x1e')](removeEntity(_0x89d639,null))[_0x7bba('0x3d')](handleError(_0x89d639,null));}; \ No newline at end of file +var _0xc0d1=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','length','include','find','create','body','catch','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xc0d1,0x16c));var _0x1c0d=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc0d1[_0x178e48];return _0x440d7e;};'use strict';var pdf=require(_0x1c0d('0x0'));var emlformat=require(_0x1c0d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1c0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c0d('0x3'));var moment=require(_0x1c0d('0x4'));var BPromise=require(_0x1c0d('0x5'));var Mustache=require(_0x1c0d('0x6'));var util=require(_0x1c0d('0x7'));var path=require(_0x1c0d('0x8'));var sox=require('sox');var csv=require(_0x1c0d('0x9'));var ejs=require(_0x1c0d('0xa'));var fs=require('fs');var _=require(_0x1c0d('0xb'));var squel=require(_0x1c0d('0xc'));var crypto=require(_0x1c0d('0xd'));var jsforce=require(_0x1c0d('0xe'));var deskjs=require(_0x1c0d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1c0d('0x10'));var Papa=require(_0x1c0d('0x11'));var Redis=require(_0x1c0d('0x12'));var authService=require(_0x1c0d('0x13'));var qs=require(_0x1c0d('0x14'));var as=require(_0x1c0d('0x15'));var hardwareService=require(_0x1c0d('0x16'));var logger=require('../../config/logger')(_0x1c0d('0x17'));var utils=require(_0x1c0d('0x18'));var config=require('../../config/environment');var db=require(_0x1c0d('0x19'))['db'];function respondWithStatusCode(_0x257dd1,_0x4d5c53){_0x4d5c53=_0x4d5c53||0xcc;return function(_0x4f218f){if(_0x4f218f){return _0x257dd1[_0x1c0d('0x1a')](_0x4d5c53);}return _0x257dd1['status'](_0x4d5c53)['end']();};}function respondWithResult(_0x1c4c57,_0x2ac4f1){_0x2ac4f1=_0x2ac4f1||0xc8;return function(_0x21f779){if(_0x21f779){return _0x1c4c57[_0x1c0d('0x1b')](_0x2ac4f1)[_0x1c0d('0x1c')](_0x21f779);}};}function respondWithFilteredResult(_0x3e9f19,_0x19da44){return function(_0x251376){if(_0x251376){var _0x52ab6e=_0x251376[_0x1c0d('0x1d')],_0x21940e=_0x19da44[_0x1c0d('0x1e')],_0x573f4a=_0x19da44['offset']+_0x19da44[_0x1c0d('0x1f')],_0x4e6b28;if(_0x573f4a>=_0x52ab6e){_0x573f4a=_0x52ab6e;_0x4e6b28=0xc8;}else{_0x4e6b28=0xce;}_0x3e9f19[_0x1c0d('0x1b')](_0x4e6b28);return _0x3e9f19['set'](_0x1c0d('0x20'),_0x21940e+'-'+_0x573f4a+'/'+_0x52ab6e)['json'](_0x251376);}return null;};}function patchUpdates(_0x34231f){return function(_0x411441){try{jsonpatch[_0x1c0d('0x21')](_0x411441,_0x34231f,!![]);}catch(_0x30af49){return BPromise[_0x1c0d('0x22')](_0x30af49);}return _0x411441[_0x1c0d('0x23')]();};}function saveUpdates(_0x1d0c92,_0x209c1c){return function(_0x2b0cbf){if(_0x2b0cbf){return _0x2b0cbf[_0x1c0d('0x24')](_0x1d0c92)[_0x1c0d('0x25')](function(_0x31951d){return _0x31951d;});}return null;};}function removeEntity(_0x4eaff3,_0x3dafd7){return function(_0x2b1a81){if(_0x2b1a81){return _0x2b1a81['destroy']()[_0x1c0d('0x25')](function(){_0x4eaff3[_0x1c0d('0x1b')](0xcc)[_0x1c0d('0x26')]();});}};}function handleEntityNotFound(_0x1d8047,_0x4d70a5){return function(_0x23793d){if(!_0x23793d){_0x1d8047[_0x1c0d('0x1a')](0x194);}return _0x23793d;};}function handleError(_0x223139,_0x1e0c10){_0x1e0c10=_0x1e0c10||0x1f4;return function(_0x3af498){logger[_0x1c0d('0x27')](_0x3af498[_0x1c0d('0x28')]);if(_0x3af498[_0x1c0d('0x29')]){delete _0x3af498[_0x1c0d('0x29')];}_0x223139['status'](_0x1e0c10)[_0x1c0d('0x2a')](_0x3af498);};}exports[_0x1c0d('0x2b')]=function(_0x50cef5,_0x4811df){var _0x5d3a60={},_0x2cad61={},_0x34ef5a={'count':0x0,'rows':[]};var _0x5449b1=_['map'](db[_0x1c0d('0x2c')][_0x1c0d('0x2d')],function(_0x4b62b1){return{'name':_0x4b62b1[_0x1c0d('0x2e')],'type':_0x4b62b1[_0x1c0d('0x2f')][_0x1c0d('0x30')]};});_0x2cad61[_0x1c0d('0x31')]=_[_0x1c0d('0x32')](_0x5449b1,_0x1c0d('0x29'));_0x2cad61[_0x1c0d('0x33')]=_[_0x1c0d('0x34')](_0x50cef5[_0x1c0d('0x33')]);_0x2cad61[_0x1c0d('0x35')]=_[_0x1c0d('0x36')](_0x2cad61[_0x1c0d('0x31')],_0x2cad61[_0x1c0d('0x33')]);_0x5d3a60['attributes']=_[_0x1c0d('0x36')](_0x2cad61[_0x1c0d('0x31')],qs[_0x1c0d('0x37')](_0x50cef5[_0x1c0d('0x33')][_0x1c0d('0x37')]));_0x5d3a60[_0x1c0d('0x38')]=_0x5d3a60[_0x1c0d('0x38')]['length']?_0x5d3a60[_0x1c0d('0x38')]:_0x2cad61[_0x1c0d('0x31')];if(!_0x50cef5[_0x1c0d('0x33')]['hasOwnProperty']('nolimit')){_0x5d3a60[_0x1c0d('0x1f')]=qs[_0x1c0d('0x1f')](_0x50cef5[_0x1c0d('0x33')][_0x1c0d('0x1f')]);_0x5d3a60[_0x1c0d('0x1e')]=qs['offset'](_0x50cef5[_0x1c0d('0x33')][_0x1c0d('0x1e')]);}_0x5d3a60[_0x1c0d('0x39')]=qs[_0x1c0d('0x3a')](_0x50cef5[_0x1c0d('0x33')][_0x1c0d('0x3a')]);_0x5d3a60[_0x1c0d('0x3b')]=qs['filters'](_[_0x1c0d('0x3c')](_0x50cef5[_0x1c0d('0x33')],_0x2cad61['filters']),_0x5449b1);if(_0x50cef5[_0x1c0d('0x33')]['filter']){_0x5d3a60[_0x1c0d('0x3b')]=_[_0x1c0d('0x3d')](_0x5d3a60[_0x1c0d('0x3b')],{'$or':_[_0x1c0d('0x32')](_0x5449b1,function(_0x381b4a){if(_0x381b4a[_0x1c0d('0x2f')]!==_0x1c0d('0x3e')){var _0x3aa430={};_0x3aa430[_0x381b4a[_0x1c0d('0x29')]]={'$like':'%'+_0x50cef5['query'][_0x1c0d('0x3f')]+'%'};return _0x3aa430;}})});}_0x5d3a60=_[_0x1c0d('0x3d')]({},_0x5d3a60,_0x50cef5[_0x1c0d('0x40')]);var _0x5592cf={'where':_0x5d3a60[_0x1c0d('0x3b')]};return db[_0x1c0d('0x2c')]['count'](_0x5592cf)['then'](function(_0x1e7a35){_0x34ef5a[_0x1c0d('0x1d')]=_0x1e7a35;if(_0x50cef5[_0x1c0d('0x33')][_0x1c0d('0x41')]){_0x5d3a60['include']=[{'all':!![]}];}return db[_0x1c0d('0x2c')]['findAll'](_0x5d3a60);})[_0x1c0d('0x25')](function(_0xfaa891){_0x34ef5a[_0x1c0d('0x42')]=_0xfaa891;return _0x34ef5a;})[_0x1c0d('0x25')](respondWithFilteredResult(_0x4811df,_0x5d3a60))['catch'](handleError(_0x4811df,null));};exports[_0x1c0d('0x43')]=function(_0x23a744,_0x2a8900){var _0x3e6611={'raw':!![],'where':{'id':_0x23a744['params']['id']}},_0x4af730={};_0x4af730[_0x1c0d('0x31')]=_[_0x1c0d('0x34')](db['SquareMessage'][_0x1c0d('0x2d')]);_0x4af730[_0x1c0d('0x33')]=_[_0x1c0d('0x34')](_0x23a744[_0x1c0d('0x33')]);_0x4af730[_0x1c0d('0x35')]=_[_0x1c0d('0x36')](_0x4af730[_0x1c0d('0x31')],_0x4af730[_0x1c0d('0x33')]);_0x3e6611[_0x1c0d('0x38')]=_[_0x1c0d('0x36')](_0x4af730['model'],qs[_0x1c0d('0x37')](_0x23a744['query']['fields']));_0x3e6611[_0x1c0d('0x38')]=_0x3e6611[_0x1c0d('0x38')][_0x1c0d('0x44')]?_0x3e6611[_0x1c0d('0x38')]:_0x4af730[_0x1c0d('0x31')];if(_0x23a744[_0x1c0d('0x33')][_0x1c0d('0x41')]){_0x3e6611[_0x1c0d('0x45')]=[{'all':!![]}];}_0x3e6611=_[_0x1c0d('0x3d')]({},_0x3e6611,_0x23a744[_0x1c0d('0x40')]);return db['SquareMessage'][_0x1c0d('0x46')](_0x3e6611)[_0x1c0d('0x25')](handleEntityNotFound(_0x2a8900,null))['then'](respondWithResult(_0x2a8900,null))['catch'](handleError(_0x2a8900,null));};exports[_0x1c0d('0x47')]=function(_0x3321c7,_0x226930){return db[_0x1c0d('0x2c')]['create'](_0x3321c7[_0x1c0d('0x48')],{})[_0x1c0d('0x25')](respondWithResult(_0x226930,0xc9))[_0x1c0d('0x49')](handleError(_0x226930,null));};exports['update']=function(_0x4b9b64,_0x31dfe3){if(_0x4b9b64[_0x1c0d('0x48')]['id']){delete _0x4b9b64['body']['id'];}return db[_0x1c0d('0x2c')][_0x1c0d('0x46')]({'where':{'id':_0x4b9b64[_0x1c0d('0x4a')]['id']}})[_0x1c0d('0x25')](handleEntityNotFound(_0x31dfe3,null))['then'](saveUpdates(_0x4b9b64[_0x1c0d('0x48')],null))[_0x1c0d('0x25')](respondWithResult(_0x31dfe3,null))[_0x1c0d('0x49')](handleError(_0x31dfe3,null));};exports['destroy']=function(_0x416f32,_0x34458c){return db[_0x1c0d('0x2c')][_0x1c0d('0x46')]({'where':{'id':_0x416f32['params']['id']}})[_0x1c0d('0x25')](handleEntityNotFound(_0x34458c,null))[_0x1c0d('0x25')](removeEntity(_0x34458c,null))[_0x1c0d('0x49')](handleError(_0x34458c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3d96bfa..d7b0f0a 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 _0x712f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','SquareMessage','util'];(function(_0x4524ad,_0x1d0da4){var _0x1e7a4c=function(_0x2c6679){while(--_0x2c6679){_0x4524ad['push'](_0x4524ad['shift']());}};_0x1e7a4c(++_0x1d0da4);}(_0x712f,0x1b7));var _0xf712=function(_0x48c9c7,_0x21cb13){_0x48c9c7=_0x48c9c7-0x0;var _0x45e966=_0x712f[_0x48c9c7];return _0x45e966;};'use strict';var _=require('lodash');var util=require(_0xf712('0x0'));var logger=require(_0xf712('0x1'))(_0xf712('0x2'));var moment=require(_0xf712('0x3'));var BPromise=require(_0xf712('0x4'));var rp=require(_0xf712('0x5'));var fs=require('fs');var path=require(_0xf712('0x6'));var rimraf=require(_0xf712('0x7'));var config=require('../../config/environment');var attributes=require(_0xf712('0x8'));module[_0xf712('0x9')]=function(_0x19a5bf,_0x10a8d7){return _0x19a5bf['define'](_0xf712('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x077a=['rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x077a,0x14b));var _0xa077=function(_0x493fc9,_0x597cf9){_0x493fc9=_0x493fc9-0x0;var _0x3a90c3=_0x077a[_0x493fc9];return _0x3a90c3;};'use strict';var _=require(_0xa077('0x0'));var util=require(_0xa077('0x1'));var logger=require(_0xa077('0x2'))(_0xa077('0x3'));var moment=require(_0xa077('0x4'));var BPromise=require(_0xa077('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa077('0x6'));var rimraf=require(_0xa077('0x7'));var config=require('../../config/environment');var attributes=require(_0xa077('0x8'));module[_0xa077('0x9')]=function(_0x2cf98d,_0x102b0d){return _0x2cf98d[_0xa077('0xa')](_0xa077('0xb'),attributes,{'tableName':_0xa077('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index fae8091..217362c 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 _0xef66=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','message','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x1865fe,_0x536d59){var _0x2dcb2a=function(_0x42413f){while(--_0x42413f){_0x1865fe['push'](_0x1865fe['shift']());}};_0x2dcb2a(++_0x536d59);}(_0xef66,0x1db));var _0x6ef6=function(_0x303412,_0x33b3f9){_0x303412=_0x303412-0x0;var _0x10e8c7=_0xef66[_0x303412];return _0x10e8c7;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ef6('0x5'));var logger=require(_0x6ef6('0x6'))(_0x6ef6('0x7'));var config=require(_0x6ef6('0x8'));var jayson=require(_0x6ef6('0x9'));var client=jayson[_0x6ef6('0xa')][_0x6ef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830aa,_0x3755b5,_0x4f06b9){return new BPromise(function(_0x5a7c74,_0xc0d555){return client[_0x6ef6('0xc')](_0x1830aa,_0x4f06b9)[_0x6ef6('0xd')](function(_0x391e0e){logger[_0x6ef6('0xe')]('SquareMessage,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'),JSON['stringify'](_0x391e0e));if(_0x391e0e[_0x6ef6('0x10')]){if(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x11')]===0x1f4){logger[_0x6ef6('0x10')]('SquareMessage,\x20%s,\x20%s',_0x3755b5,_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0xc0d555(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);}logger['error'](_0x6ef6('0x13'),_0x3755b5,_0x391e0e['error'][_0x6ef6('0x12')]);return _0x5a7c74(_0x391e0e[_0x6ef6('0x10')]['message']);}else{logger[_0x6ef6('0xe')](_0x6ef6('0x13'),_0x3755b5,_0x6ef6('0xf'));_0x5a7c74(_0x391e0e[_0x6ef6('0x14')][_0x6ef6('0x12')]);}})[_0x6ef6('0x15')](function(_0x4ea222){logger[_0x6ef6('0x10')](_0x6ef6('0x13'),_0x3755b5,_0x4ea222);_0xc0d555(_0x4ea222);});});}exports[_0x6ef6('0x16')]=function(_0x53586d){var _0x3fc3d1=this;return new Promise(function(_0x2510be,_0x292af9){return db[_0x6ef6('0x17')][_0x6ef6('0x18')](_0x53586d[_0x6ef6('0x19')],{'raw':_0x53586d[_0x6ef6('0x1a')]?_0x53586d['options'][_0x6ef6('0x1b')]===undefined?!![]:![]:!![]})[_0x6ef6('0xd')](function(_0x2903ea){logger[_0x6ef6('0xe')]('CreateSquareMessage',_0x53586d);logger[_0x6ef6('0x1c')](_0x6ef6('0x16'),_0x53586d,JSON[_0x6ef6('0x1d')](_0x2903ea));_0x2510be(_0x2903ea);})['catch'](function(_0x4257d8){logger[_0x6ef6('0x10')]('CreateSquareMessage',_0x4257d8[_0x6ef6('0x12')],_0x53586d);_0x292af9(_0x3fc3d1[_0x6ef6('0x10')](0x1f4,_0x4257d8['message']));});});}; \ No newline at end of file +var _0x3ca4=['request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','info','CreateSquareMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x58a69b,_0x4792a5){var _0x477b8d=function(_0x2b0bac){while(--_0x2b0bac){_0x58a69b['push'](_0x58a69b['shift']());}};_0x477b8d(++_0x4792a5);}(_0x3ca4,0x17d));var _0x43ca=function(_0x27bd6c,_0x3a2b10){_0x27bd6c=_0x27bd6c-0x0;var _0x147d6a=_0x3ca4[_0x27bd6c];return _0x147d6a;};'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']('SquareMessage,\x20%s,\x20%s',_0x2e6edf,_0x14f9af);_0x4669f5(_0x14f9af);});});}exports['CreateSquareMessage']=function(_0x5e50c9){var _0x2cb3e5=this;return new Promise(function(_0x268817,_0x1389ce){return db['SquareMessage'][_0x43ca('0x16')](_0x5e50c9[_0x43ca('0x17')],{'raw':_0x5e50c9[_0x43ca('0x18')]?_0x5e50c9['options'][_0x43ca('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x106d07){logger[_0x43ca('0x1a')](_0x43ca('0x1b'),_0x5e50c9);logger['debug'](_0x43ca('0x1b'),_0x5e50c9,JSON[_0x43ca('0x11')](_0x106d07));_0x268817(_0x106d07);})[_0x43ca('0x15')](function(_0x2ad8fa){logger[_0x43ca('0x12')]('CreateSquareMessage',_0x2ad8fa[_0x43ca('0x14')],_0x5e50c9);_0x1389ce(_0x2cb3e5[_0x43ca('0x12')](0x1f4,_0x2ad8fa['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9d68f4a..8f214ba 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 _0x1e00=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','index','/:id','isAuthenticated','15s','test','post','create','put'];(function(_0x266f28,_0x1f50cb){var _0x129e87=function(_0x3e8ad0){while(--_0x3e8ad0){_0x266f28['push'](_0x266f28['shift']());}};_0x129e87(++_0x1f50cb);}(_0x1e00,0x88));var _0x01e0=function(_0x102706,_0x496008){_0x102706=_0x102706-0x0;var _0x565bf1=_0x1e00[_0x102706];return _0x565bf1;};'use strict';var multer=require(_0x01e0('0x0'));var util=require(_0x01e0('0x1'));var path=require(_0x01e0('0x2'));var timeout=require(_0x01e0('0x3'));var express=require(_0x01e0('0x4'));var router=express[_0x01e0('0x5')]();var auth=require(_0x01e0('0x6'));var interaction=require(_0x01e0('0x7'));var config=require('../../config/environment');var controller=require(_0x01e0('0x8'));router[_0x01e0('0x9')]('/',auth['isAuthenticated'](),controller[_0x01e0('0xa')]);router[_0x01e0('0x9')](_0x01e0('0xb'),auth[_0x01e0('0xc')](),controller['show']);router['get']('/:id/test',auth['isAuthenticated'](),timeout(_0x01e0('0xd')),controller[_0x01e0('0xe')]);router[_0x01e0('0xf')]('/',auth[_0x01e0('0xc')](),controller[_0x01e0('0x10')]);router[_0x01e0('0x11')](_0x01e0('0xb'),auth['isAuthenticated'](),controller[_0x01e0('0x12')]);router[_0x01e0('0x13')](_0x01e0('0xb'),auth[_0x01e0('0xc')](),controller[_0x01e0('0x14')]);module[_0x01e0('0x15')]=router; \ No newline at end of file +var _0x707e=['/:id/test','15s','test','put','update','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x707e,0xfd));var _0xe707=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x707e[_0x2d2ca2];return _0x48489d;};'use strict';var multer=require('multer');var util=require(_0xe707('0x0'));var path=require(_0xe707('0x1'));var timeout=require(_0xe707('0x2'));var express=require(_0xe707('0x3'));var router=express['Router']();var auth=require(_0xe707('0x4'));var interaction=require(_0xe707('0x5'));var config=require(_0xe707('0x6'));var controller=require(_0xe707('0x7'));router[_0xe707('0x8')]('/',auth[_0xe707('0x9')](),controller[_0xe707('0xa')]);router['get'](_0xe707('0xb'),auth[_0xe707('0x9')](),controller[_0xe707('0xc')]);router[_0xe707('0x8')](_0xe707('0xd'),auth[_0xe707('0x9')](),timeout(_0xe707('0xe')),controller[_0xe707('0xf')]);router['post']('/',auth[_0xe707('0x9')](),controller['create']);router[_0xe707('0x10')](_0xe707('0xb'),auth['isAuthenticated'](),controller[_0xe707('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe707('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5931673..fd5d756 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 _0x4ba0=['STRING','sequelize','exports'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x4ba0,0x127));var _0x04ba=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4ba0[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x04ba('0x0'));module[_0x04ba('0x1')]={'name':{'type':Sequelize[_0x04ba('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x04ba('0x2')]},'description':{'type':Sequelize[_0x04ba('0x2')]}}; \ No newline at end of file +var _0xacf0=['STRING','sequelize','exports'];(function(_0x2a2b96,_0x3f5259){var _0x223572=function(_0x242d83){while(--_0x242d83){_0x2a2b96['push'](_0x2a2b96['shift']());}};_0x223572(++_0x3f5259);}(_0xacf0,0x157));var _0x0acf=function(_0x141b55,_0x957882){_0x141b55=_0x141b55-0x0;var _0x375591=_0xacf0[_0x141b55];return _0x375591;};'use strict';var Sequelize=require(_0x0acf('0x0'));module[_0x0acf('0x1')]={'name':{'type':Sequelize[_0x0acf('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0acf('0x2')]},'description':{'type':Sequelize[_0x0acf('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index c438a14..7202f8b 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 _0x205b=['name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','get','ODBC','UserProfileResource','error','stack','send','index','map','SquareOdbc','type','key','model','query','intersection','attributes','fields','nolimit','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x205b,0xb1));var _0xb205=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x205b[_0x22bdd3];return _0x44d9d9;};'use strict';var pdf=require(_0xb205('0x0'));var emlformat=require(_0xb205('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb205('0x2'));var jsonpatch=require(_0xb205('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb205('0x4'));var Mustache=require(_0xb205('0x5'));var util=require('util');var path=require(_0xb205('0x6'));var sox=require(_0xb205('0x7'));var csv=require('to-csv');var ejs=require(_0xb205('0x8'));var fs=require('fs');var _=require(_0xb205('0x9'));var squel=require(_0xb205('0xa'));var crypto=require(_0xb205('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb205('0xc'));var toCsv=require(_0xb205('0xd'));var querystring=require(_0xb205('0xe'));var Papa=require(_0xb205('0xf'));var Redis=require(_0xb205('0x10'));var authService=require(_0xb205('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb205('0x12'));var logger=require(_0xb205('0x13'))(_0xb205('0x14'));var utils=require(_0xb205('0x15'));var config=require(_0xb205('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x331351,_0x57a72e){_0x57a72e=_0x57a72e||0xcc;return function(_0x4efee0){if(_0x4efee0){return _0x331351[_0xb205('0x17')](_0x57a72e);}return _0x331351['status'](_0x57a72e)[_0xb205('0x18')]();};}function respondWithResult(_0x29317b,_0x515b4f){_0x515b4f=_0x515b4f||0xc8;return function(_0x11ade6){if(_0x11ade6){return _0x29317b[_0xb205('0x19')](_0x515b4f)['json'](_0x11ade6);}};}function respondWithFilteredResult(_0x358e6b,_0x59c963){return function(_0x512bad){if(_0x512bad){var _0x410baa=_0x512bad[_0xb205('0x1a')],_0x5e6a65=_0x59c963[_0xb205('0x1b')],_0x502293=_0x59c963[_0xb205('0x1b')]+_0x59c963[_0xb205('0x1c')],_0x27e5a4;if(_0x502293>=_0x410baa){_0x502293=_0x410baa;_0x27e5a4=0xc8;}else{_0x27e5a4=0xce;}_0x358e6b['status'](_0x27e5a4);return _0x358e6b[_0xb205('0x1d')](_0xb205('0x1e'),_0x5e6a65+'-'+_0x502293+'/'+_0x410baa)[_0xb205('0x1f')](_0x512bad);}return null;};}function patchUpdates(_0x49ce72){return function(_0x63f8f0){try{jsonpatch['apply'](_0x63f8f0,_0x49ce72,!![]);}catch(_0x2d9e09){return BPromise[_0xb205('0x20')](_0x2d9e09);}return _0x63f8f0[_0xb205('0x21')]();};}function saveUpdates(_0x14e5db,_0x424b07){return function(_0x3e66bd){if(_0x3e66bd){return _0x3e66bd['update'](_0x14e5db)['then'](function(_0x3be94e){return _0x3be94e;});}return null;};}function removeEntity(_0xc95aa9,_0x23bf9d){return function(_0x40fbd6){if(_0x40fbd6){return _0x40fbd6[_0xb205('0x22')]()[_0xb205('0x23')](function(){var _0x3d72ac=_0x40fbd6[_0xb205('0x24')]({'plain':!![]});var _0x2afa31=_0xb205('0x25');return db[_0xb205('0x26')]['destroy']({'where':{'type':_0x2afa31,'resourceId':_0x3d72ac['id']}})['then'](function(){return _0x40fbd6;});})[_0xb205('0x23')](function(){_0xc95aa9[_0xb205('0x19')](0xcc)[_0xb205('0x18')]();});}};}function handleEntityNotFound(_0x2d9d19,_0x8d932c){return function(_0x5f0191){if(!_0x5f0191){_0x2d9d19[_0xb205('0x17')](0x194);}return _0x5f0191;};}function handleError(_0x2ba50b,_0x5cc417){_0x5cc417=_0x5cc417||0x1f4;return function(_0x2ac6c5){logger[_0xb205('0x27')](_0x2ac6c5[_0xb205('0x28')]);if(_0x2ac6c5['name']){delete _0x2ac6c5['name'];}_0x2ba50b[_0xb205('0x19')](_0x5cc417)[_0xb205('0x29')](_0x2ac6c5);};}exports[_0xb205('0x2a')]=function(_0xf6d130,_0x418531){var _0x541196={},_0x42120a={},_0xcdaa08={'count':0x0,'rows':[]};var _0x1249fa=_[_0xb205('0x2b')](db[_0xb205('0x2c')]['rawAttributes'],function(_0x5b87f5){return{'name':_0x5b87f5['fieldName'],'type':_0x5b87f5[_0xb205('0x2d')][_0xb205('0x2e')]};});_0x42120a[_0xb205('0x2f')]=_[_0xb205('0x2b')](_0x1249fa,'name');_0x42120a[_0xb205('0x30')]=_['keys'](_0xf6d130[_0xb205('0x30')]);_0x42120a['filters']=_[_0xb205('0x31')](_0x42120a[_0xb205('0x2f')],_0x42120a[_0xb205('0x30')]);_0x541196[_0xb205('0x32')]=_[_0xb205('0x31')](_0x42120a['model'],qs['fields'](_0xf6d130[_0xb205('0x30')][_0xb205('0x33')]));_0x541196[_0xb205('0x32')]=_0x541196[_0xb205('0x32')]['length']?_0x541196[_0xb205('0x32')]:_0x42120a[_0xb205('0x2f')];if(!_0xf6d130[_0xb205('0x30')]['hasOwnProperty'](_0xb205('0x34'))){_0x541196[_0xb205('0x1c')]=qs[_0xb205('0x1c')](_0xf6d130[_0xb205('0x30')]['limit']);_0x541196[_0xb205('0x1b')]=qs[_0xb205('0x1b')](_0xf6d130[_0xb205('0x30')][_0xb205('0x1b')]);}_0x541196['order']=qs['sort'](_0xf6d130['query'][_0xb205('0x35')]);_0x541196[_0xb205('0x36')]=qs[_0xb205('0x37')](_['pick'](_0xf6d130['query'],_0x42120a['filters']),_0x1249fa);if(_0xf6d130[_0xb205('0x30')]['filter']){_0x541196['where']=_[_0xb205('0x38')](_0x541196['where'],{'$or':_['map'](_0x1249fa,function(_0x50b708){if(_0x50b708[_0xb205('0x2d')]!==_0xb205('0x39')){var _0x2183a9={};_0x2183a9[_0x50b708['name']]={'$like':'%'+_0xf6d130['query']['filter']+'%'};return _0x2183a9;}})});}_0x541196=_[_0xb205('0x38')]({},_0x541196,_0xf6d130[_0xb205('0x3a')]);var _0x208cf2={'where':_0x541196[_0xb205('0x36')]};return db['SquareOdbc'][_0xb205('0x1a')](_0x208cf2)[_0xb205('0x23')](function(_0x536c0b){_0xcdaa08[_0xb205('0x1a')]=_0x536c0b;if(_0xf6d130['query'][_0xb205('0x3b')]){_0x541196[_0xb205('0x3c')]=[{'all':!![]}];}return db[_0xb205('0x2c')][_0xb205('0x3d')](_0x541196);})['then'](function(_0xdb9658){_0xcdaa08[_0xb205('0x3e')]=_0xdb9658;return _0xcdaa08;})[_0xb205('0x23')](respondWithFilteredResult(_0x418531,_0x541196))[_0xb205('0x3f')](handleError(_0x418531,null));};exports[_0xb205('0x40')]=function(_0x59d307,_0x1496e8){var _0x8274d8={'raw':!![],'where':{'id':_0x59d307[_0xb205('0x41')]['id']}},_0x552432={};_0x552432[_0xb205('0x2f')]=_[_0xb205('0x42')](db[_0xb205('0x2c')][_0xb205('0x43')]);_0x552432[_0xb205('0x30')]=_['keys'](_0x59d307[_0xb205('0x30')]);_0x552432[_0xb205('0x37')]=_[_0xb205('0x31')](_0x552432[_0xb205('0x2f')],_0x552432[_0xb205('0x30')]);_0x8274d8[_0xb205('0x32')]=_[_0xb205('0x31')](_0x552432[_0xb205('0x2f')],qs[_0xb205('0x33')](_0x59d307[_0xb205('0x30')][_0xb205('0x33')]));_0x8274d8['attributes']=_0x8274d8['attributes'][_0xb205('0x44')]?_0x8274d8[_0xb205('0x32')]:_0x552432[_0xb205('0x2f')];if(_0x59d307[_0xb205('0x30')]['includeAll']){_0x8274d8[_0xb205('0x3c')]=[{'all':!![]}];}_0x8274d8=_[_0xb205('0x38')]({},_0x8274d8,_0x59d307['options']);return db[_0xb205('0x2c')][_0xb205('0x45')](_0x8274d8)[_0xb205('0x23')](handleEntityNotFound(_0x1496e8,null))['then'](respondWithResult(_0x1496e8,null))[_0xb205('0x3f')](handleError(_0x1496e8,null));};exports[_0xb205('0x46')]=function(_0x4f1046,_0xe7340){return db['SquareOdbc']['create'](_0x4f1046[_0xb205('0x47')],{})[_0xb205('0x23')](function(_0x18b23b){var _0x2e5559=_0x4f1046[_0xb205('0x48')][_0xb205('0x24')]({'plain':!![]});if(!_0x2e5559)throw new Error(_0xb205('0x49'));if(_0x2e5559[_0xb205('0x4a')]==='user'){var _0x3ae4a6=_0x18b23b[_0xb205('0x24')]({'plain':!![]});var _0x244e07=_0xb205('0x25');return db[_0xb205('0x4b')][_0xb205('0x45')]({'where':{'name':_0x244e07,'userProfileId':_0x2e5559[_0xb205('0x4c')]},'raw':!![]})[_0xb205('0x23')](function(_0x12a9c7){if(_0x12a9c7&&_0x12a9c7[_0xb205('0x4d')]===0x0){return db['UserProfileResource'][_0xb205('0x46')]({'name':_0x3ae4a6[_0xb205('0x4e')],'resourceId':_0x3ae4a6['id'],'type':_0x12a9c7['name'],'sectionId':_0x12a9c7['id']},{})[_0xb205('0x23')](function(){return _0x18b23b;});}else{return _0x18b23b;}})[_0xb205('0x3f')](function(_0x5f532d){logger[_0xb205('0x27')](_0xb205('0x4f'),_0x5f532d);throw _0x5f532d;});}return _0x18b23b;})['then'](respondWithResult(_0xe7340,0xc9))['catch'](handleError(_0xe7340,null));};exports[_0xb205('0x50')]=function(_0x4cec13,_0x59a038){if(_0x4cec13[_0xb205('0x47')]['id']){delete _0x4cec13[_0xb205('0x47')]['id'];}return db['SquareOdbc'][_0xb205('0x45')]({'where':{'id':_0x4cec13[_0xb205('0x41')]['id']}})[_0xb205('0x23')](handleEntityNotFound(_0x59a038,null))[_0xb205('0x23')](saveUpdates(_0x4cec13['body'],null))[_0xb205('0x23')](respondWithResult(_0x59a038,null))['catch'](handleError(_0x59a038,null));};exports['destroy']=function(_0x114518,_0xdca46e){return db[_0xb205('0x2c')][_0xb205('0x45')]({'where':{'id':_0x114518[_0xb205('0x41')]['id']}})[_0xb205('0x23')](handleEntityNotFound(_0xdca46e,null))[_0xb205('0x23')](removeEntity(_0xdca46e,null))[_0xb205('0x3f')](handleError(_0xdca46e,null));};exports['test']=function(_0x5e4a9c,_0x40c40c,_0x514e7a){var _0x5740bb;return db['SquareOdbc'][_0xb205('0x45')]({'where':{'id':_0x5e4a9c[_0xb205('0x41')]['id']},'attributes':['id',_0xb205('0x51')]})[_0xb205('0x23')](handleEntityNotFound(_0x40c40c,null))[_0xb205('0x23')](function(_0x15c25d){if(_0x15c25d){var _0x2a324d=require(_0xb205('0x52'))();_0x2a324d[_0xb205('0x53')](_0x15c25d[_0xb205('0x51')]);_0x2a324d[_0xb205('0x54')]();return _0x15c25d;}})[_0xb205('0x23')](respondWithResult(_0x40c40c,null))[_0xb205('0x3f')](handleError(_0x40c40c,null));}; \ No newline at end of file +var _0x6e87=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','ODBC','UserProfileResource','then','stack','name','index','map','SquareOdbc'];(function(_0x4692d7,_0x448d8e){var _0x26657a=function(_0x15ac86){while(--_0x15ac86){_0x4692d7['push'](_0x4692d7['shift']());}};_0x26657a(++_0x448d8e);}(_0x6e87,0x1dc));var _0x76e8=function(_0x35b26e,_0x1698f5){_0x35b26e=_0x35b26e-0x0;var _0x469eaf=_0x6e87[_0x35b26e];return _0x469eaf;};'use strict';var pdf=require(_0x76e8('0x0'));var emlformat=require(_0x76e8('0x1'));var rimraf=require(_0x76e8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76e8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x76e8('0x4'));var Mustache=require(_0x76e8('0x5'));var util=require('util');var path=require(_0x76e8('0x6'));var sox=require(_0x76e8('0x7'));var csv=require('to-csv');var ejs=require(_0x76e8('0x8'));var fs=require('fs');var _=require(_0x76e8('0x9'));var squel=require(_0x76e8('0xa'));var crypto=require(_0x76e8('0xb'));var jsforce=require(_0x76e8('0xc'));var deskjs=require(_0x76e8('0xd'));var toCsv=require(_0x76e8('0xe'));var querystring=require(_0x76e8('0xf'));var Papa=require(_0x76e8('0x10'));var Redis=require(_0x76e8('0x11'));var authService=require(_0x76e8('0x12'));var qs=require(_0x76e8('0x13'));var as=require(_0x76e8('0x14'));var hardwareService=require(_0x76e8('0x15'));var logger=require('../../config/logger')(_0x76e8('0x16'));var utils=require(_0x76e8('0x17'));var config=require(_0x76e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56beb5,_0x2e03aa){_0x2e03aa=_0x2e03aa||0xcc;return function(_0x2efb2c){if(_0x2efb2c){return _0x56beb5[_0x76e8('0x19')](_0x2e03aa);}return _0x56beb5[_0x76e8('0x1a')](_0x2e03aa)[_0x76e8('0x1b')]();};}function respondWithResult(_0x5af021,_0x264a90){_0x264a90=_0x264a90||0xc8;return function(_0x54d3bd){if(_0x54d3bd){return _0x5af021[_0x76e8('0x1a')](_0x264a90)[_0x76e8('0x1c')](_0x54d3bd);}};}function respondWithFilteredResult(_0x2e66ab,_0x1b21ea){return function(_0x3aa463){if(_0x3aa463){var _0x257cc3=_0x3aa463[_0x76e8('0x1d')],_0x1fbe42=_0x1b21ea[_0x76e8('0x1e')],_0x344e6d=_0x1b21ea[_0x76e8('0x1e')]+_0x1b21ea[_0x76e8('0x1f')],_0x430d3a;if(_0x344e6d>=_0x257cc3){_0x344e6d=_0x257cc3;_0x430d3a=0xc8;}else{_0x430d3a=0xce;}_0x2e66ab[_0x76e8('0x1a')](_0x430d3a);return _0x2e66ab['set'](_0x76e8('0x20'),_0x1fbe42+'-'+_0x344e6d+'/'+_0x257cc3)[_0x76e8('0x1c')](_0x3aa463);}return null;};}function patchUpdates(_0x1990e6){return function(_0x44424d){try{jsonpatch[_0x76e8('0x21')](_0x44424d,_0x1990e6,!![]);}catch(_0x19dc7c){return BPromise['reject'](_0x19dc7c);}return _0x44424d[_0x76e8('0x22')]();};}function saveUpdates(_0x144968,_0x36c966){return function(_0x959eb1){if(_0x959eb1){return _0x959eb1[_0x76e8('0x23')](_0x144968)['then'](function(_0x1d4de7){return _0x1d4de7;});}return null;};}function removeEntity(_0x426ece,_0xe1df7b){return function(_0x1db7ab){if(_0x1db7ab){return _0x1db7ab[_0x76e8('0x24')]()['then'](function(){var _0x18873f=_0x1db7ab[_0x76e8('0x25')]({'plain':!![]});var _0x46e97f=_0x76e8('0x26');return db[_0x76e8('0x27')][_0x76e8('0x24')]({'where':{'type':_0x46e97f,'resourceId':_0x18873f['id']}})[_0x76e8('0x28')](function(){return _0x1db7ab;});})['then'](function(){_0x426ece[_0x76e8('0x1a')](0xcc)[_0x76e8('0x1b')]();});}};}function handleEntityNotFound(_0x30d0b2,_0x35c044){return function(_0x39297c){if(!_0x39297c){_0x30d0b2['sendStatus'](0x194);}return _0x39297c;};}function handleError(_0x473e42,_0x1001b1){_0x1001b1=_0x1001b1||0x1f4;return function(_0x247cd1){logger['error'](_0x247cd1[_0x76e8('0x29')]);if(_0x247cd1['name']){delete _0x247cd1[_0x76e8('0x2a')];}_0x473e42['status'](_0x1001b1)['send'](_0x247cd1);};}exports[_0x76e8('0x2b')]=function(_0x45e268,_0x136091){var _0x3b009c={},_0x35e766={},_0x3ea477={'count':0x0,'rows':[]};var _0x5a7ebf=_[_0x76e8('0x2c')](db[_0x76e8('0x2d')][_0x76e8('0x2e')],function(_0xd0176){return{'name':_0xd0176[_0x76e8('0x2f')],'type':_0xd0176['type'][_0x76e8('0x30')]};});_0x35e766[_0x76e8('0x31')]=_[_0x76e8('0x2c')](_0x5a7ebf,_0x76e8('0x2a'));_0x35e766[_0x76e8('0x32')]=_[_0x76e8('0x33')](_0x45e268[_0x76e8('0x32')]);_0x35e766['filters']=_[_0x76e8('0x34')](_0x35e766[_0x76e8('0x31')],_0x35e766[_0x76e8('0x32')]);_0x3b009c['attributes']=_[_0x76e8('0x34')](_0x35e766[_0x76e8('0x31')],qs[_0x76e8('0x35')](_0x45e268['query'][_0x76e8('0x35')]));_0x3b009c['attributes']=_0x3b009c[_0x76e8('0x36')][_0x76e8('0x37')]?_0x3b009c['attributes']:_0x35e766[_0x76e8('0x31')];if(!_0x45e268[_0x76e8('0x32')][_0x76e8('0x38')](_0x76e8('0x39'))){_0x3b009c[_0x76e8('0x1f')]=qs[_0x76e8('0x1f')](_0x45e268[_0x76e8('0x32')][_0x76e8('0x1f')]);_0x3b009c[_0x76e8('0x1e')]=qs[_0x76e8('0x1e')](_0x45e268[_0x76e8('0x32')][_0x76e8('0x1e')]);}_0x3b009c[_0x76e8('0x3a')]=qs[_0x76e8('0x3b')](_0x45e268[_0x76e8('0x32')][_0x76e8('0x3b')]);_0x3b009c[_0x76e8('0x3c')]=qs[_0x76e8('0x3d')](_[_0x76e8('0x3e')](_0x45e268[_0x76e8('0x32')],_0x35e766['filters']),_0x5a7ebf);if(_0x45e268['query'][_0x76e8('0x3f')]){_0x3b009c[_0x76e8('0x3c')]=_['merge'](_0x3b009c['where'],{'$or':_['map'](_0x5a7ebf,function(_0x26d6b8){if(_0x26d6b8[_0x76e8('0x40')]!==_0x76e8('0x41')){var _0x506201={};_0x506201[_0x26d6b8['name']]={'$like':'%'+_0x45e268[_0x76e8('0x32')][_0x76e8('0x3f')]+'%'};return _0x506201;}})});}_0x3b009c=_[_0x76e8('0x42')]({},_0x3b009c,_0x45e268[_0x76e8('0x43')]);var _0x410177={'where':_0x3b009c[_0x76e8('0x3c')]};return db[_0x76e8('0x2d')][_0x76e8('0x1d')](_0x410177)['then'](function(_0x1aa0f8){_0x3ea477[_0x76e8('0x1d')]=_0x1aa0f8;if(_0x45e268['query'][_0x76e8('0x44')]){_0x3b009c['include']=[{'all':!![]}];}return db[_0x76e8('0x2d')][_0x76e8('0x45')](_0x3b009c);})['then'](function(_0x4e9e12){_0x3ea477[_0x76e8('0x46')]=_0x4e9e12;return _0x3ea477;})[_0x76e8('0x28')](respondWithFilteredResult(_0x136091,_0x3b009c))['catch'](handleError(_0x136091,null));};exports['show']=function(_0x19a82a,_0x1205f5){var _0x5937c0={'raw':!![],'where':{'id':_0x19a82a[_0x76e8('0x47')]['id']}},_0x3bc7c1={};_0x3bc7c1[_0x76e8('0x31')]=_['keys'](db[_0x76e8('0x2d')][_0x76e8('0x2e')]);_0x3bc7c1[_0x76e8('0x32')]=_['keys'](_0x19a82a[_0x76e8('0x32')]);_0x3bc7c1[_0x76e8('0x3d')]=_['intersection'](_0x3bc7c1[_0x76e8('0x31')],_0x3bc7c1['query']);_0x5937c0[_0x76e8('0x36')]=_[_0x76e8('0x34')](_0x3bc7c1['model'],qs[_0x76e8('0x35')](_0x19a82a['query'][_0x76e8('0x35')]));_0x5937c0[_0x76e8('0x36')]=_0x5937c0[_0x76e8('0x36')][_0x76e8('0x37')]?_0x5937c0[_0x76e8('0x36')]:_0x3bc7c1[_0x76e8('0x31')];if(_0x19a82a[_0x76e8('0x32')]['includeAll']){_0x5937c0['include']=[{'all':!![]}];}_0x5937c0=_[_0x76e8('0x42')]({},_0x5937c0,_0x19a82a['options']);return db['SquareOdbc'][_0x76e8('0x48')](_0x5937c0)[_0x76e8('0x28')](handleEntityNotFound(_0x1205f5,null))[_0x76e8('0x28')](respondWithResult(_0x1205f5,null))['catch'](handleError(_0x1205f5,null));};exports[_0x76e8('0x49')]=function(_0x570dd9,_0x1238c2){return db['SquareOdbc'][_0x76e8('0x49')](_0x570dd9['body'],{})[_0x76e8('0x28')](function(_0xe8e4a){var _0x592173=_0x570dd9['user'][_0x76e8('0x25')]({'plain':!![]});if(!_0x592173)throw new Error(_0x76e8('0x4a'));if(_0x592173[_0x76e8('0x4b')]===_0x76e8('0x4c')){var _0x3d6100=_0xe8e4a[_0x76e8('0x25')]({'plain':!![]});var _0x2baa25=_0x76e8('0x26');return db[_0x76e8('0x4d')][_0x76e8('0x48')]({'where':{'name':_0x2baa25,'userProfileId':_0x592173[_0x76e8('0x4e')]},'raw':!![]})[_0x76e8('0x28')](function(_0x9fa1a){if(_0x9fa1a&&_0x9fa1a['autoAssociation']===0x0){return db[_0x76e8('0x27')][_0x76e8('0x49')]({'name':_0x3d6100[_0x76e8('0x2a')],'resourceId':_0x3d6100['id'],'type':_0x9fa1a[_0x76e8('0x2a')],'sectionId':_0x9fa1a['id']},{})[_0x76e8('0x28')](function(){return _0xe8e4a;});}else{return _0xe8e4a;}})[_0x76e8('0x4f')](function(_0x566e4b){logger[_0x76e8('0x50')](_0x76e8('0x51'),_0x566e4b);throw _0x566e4b;});}return _0xe8e4a;})[_0x76e8('0x28')](respondWithResult(_0x1238c2,0xc9))[_0x76e8('0x4f')](handleError(_0x1238c2,null));};exports['update']=function(_0xd63a89,_0x5ad128){if(_0xd63a89['body']['id']){delete _0xd63a89[_0x76e8('0x52')]['id'];}return db[_0x76e8('0x2d')][_0x76e8('0x48')]({'where':{'id':_0xd63a89[_0x76e8('0x47')]['id']}})[_0x76e8('0x28')](handleEntityNotFound(_0x5ad128,null))[_0x76e8('0x28')](saveUpdates(_0xd63a89[_0x76e8('0x52')],null))[_0x76e8('0x28')](respondWithResult(_0x5ad128,null))['catch'](handleError(_0x5ad128,null));};exports[_0x76e8('0x24')]=function(_0x42740b,_0x5c1a8c){return db[_0x76e8('0x2d')]['find']({'where':{'id':_0x42740b['params']['id']}})[_0x76e8('0x28')](handleEntityNotFound(_0x5c1a8c,null))['then'](removeEntity(_0x5c1a8c,null))[_0x76e8('0x4f')](handleError(_0x5c1a8c,null));};exports[_0x76e8('0x53')]=function(_0xbbd5c2,_0x1abc3c,_0xa02a9c){var _0x27d82a;return db[_0x76e8('0x2d')][_0x76e8('0x48')]({'where':{'id':_0xbbd5c2['params']['id']},'attributes':['id',_0x76e8('0x54')]})['then'](handleEntityNotFound(_0x1abc3c,null))[_0x76e8('0x28')](function(_0x898061){if(_0x898061){var _0x5603e0=require('odbc')();_0x5603e0[_0x76e8('0x55')](_0x898061[_0x76e8('0x54')]);_0x5603e0[_0x76e8('0x56')]();return _0x898061;}})['then'](respondWithResult(_0x1abc3c,null))['catch'](handleError(_0x1abc3c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index cff7e21..c23fcdf 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 _0x3192=['./squareOdbc.attributes','define','SquareOdbc','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x49fe01,_0x377402){var _0x3d790f=function(_0x36dcfd){while(--_0x36dcfd){_0x49fe01['push'](_0x49fe01['shift']());}};_0x3d790f(++_0x377402);}(_0x3192,0x147));var _0x2319=function(_0x3f2824,_0x1fe64d){_0x3f2824=_0x3f2824-0x0;var _0x25abf0=_0x3192[_0x3f2824];return _0x25abf0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2319('0x0'))(_0x2319('0x1'));var moment=require(_0x2319('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2319('0x3'));var rimraf=require(_0x2319('0x4'));var config=require(_0x2319('0x5'));var attributes=require(_0x2319('0x6'));module['exports']=function(_0x51d4d5,_0x5c2133){return _0x51d4d5[_0x2319('0x7')](_0x2319('0x8'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04e4=['moment','request-promise','path','rimraf','./squareOdbc.attributes','define','SquareOdbc','lodash','util','../../config/logger','api'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x04e4,0x17d));var _0x404e=function(_0x3ba6e9,_0x3f9de5){_0x3ba6e9=_0x3ba6e9-0x0;var _0xea694e=_0x04e4[_0x3ba6e9];return _0xea694e;};'use strict';var _=require(_0x404e('0x0'));var util=require(_0x404e('0x1'));var logger=require(_0x404e('0x2'))(_0x404e('0x3'));var moment=require(_0x404e('0x4'));var BPromise=require('bluebird');var rp=require(_0x404e('0x5'));var fs=require('fs');var path=require(_0x404e('0x6'));var rimraf=require(_0x404e('0x7'));var config=require('../../config/environment');var attributes=require(_0x404e('0x8'));module['exports']=function(_0x248fbf,_0x4faff1){return _0x248fbf[_0x404e('0x9')](_0x404e('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 8b93870..3e14d06 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0xf8a7f,_0x19433f){var _0x51ecff=function(_0x5cf57d){while(--_0x5cf57d){_0xf8a7f['push'](_0xf8a7f['shift']());}};_0x51ecff(++_0x19433f);}(_0x55ca,0x126));var _0xa55c=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0x55ca[_0x5162ed];return _0x4c579b;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','options','where','include','map','attributes'];(function(_0x17f7eb,_0x206d45){var _0x1f006d=function(_0x44bf4f){while(--_0x44bf4f){_0x17f7eb['push'](_0x17f7eb['shift']());}};_0x1f006d(++_0x206d45);}(_0x814b,0x1a2));var _0xb814=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x814b[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['SquareOdbc']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowSquareOdbc',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b0050e0..5fd05b0 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 _0xae60=['../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xae60,0x1c7));var _0x0ae6=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xae60[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var auth=require(_0x0ae6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0ae6('0x6'));var controller=require(_0x0ae6('0x7'));router['get']('/',auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x9')]);router[_0x0ae6('0xa')](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0xa')](_0x0ae6('0xd'),auth['isAuthenticated'](),controller[_0x0ae6('0xe')]);router[_0x0ae6('0xf')]('/',auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x10')]);router['post'](_0x0ae6('0xd'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x11')]);router[_0x0ae6('0x12')](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x13')]);router[_0x0ae6('0x14')](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x15')]);router[_0x0ae6('0x14')](_0x0ae6('0xd'),auth[_0x0ae6('0x8')](),controller['removeUsers']);module[_0x0ae6('0x16')]=router; \ No newline at end of file +var _0x80ed=['create','addUsers','put','/:id','update','delete','removeUsers','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','show','/:id/users','getUsers','post'];(function(_0x331b2b,_0xfc4d1b){var _0x39a6d4=function(_0x482ef7){while(--_0x482ef7){_0x331b2b['push'](_0x331b2b['shift']());}};_0x39a6d4(++_0xfc4d1b);}(_0x80ed,0x11c));var _0xd80e=function(_0x4ae636,_0x189be7){_0x4ae636=_0x4ae636-0x0;var _0x4fc3ae=_0x80ed[_0x4ae636];return _0x4fc3ae;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var auth=require(_0xd80e('0x4'));var interaction=require(_0xd80e('0x5'));var config=require(_0xd80e('0x6'));var controller=require(_0xd80e('0x7'));router['get']('/',auth[_0xd80e('0x8')](),controller[_0xd80e('0x9')]);router[_0xd80e('0xa')]('/:id',auth[_0xd80e('0x8')](),controller[_0xd80e('0xb')]);router[_0xd80e('0xa')](_0xd80e('0xc'),auth[_0xd80e('0x8')](),controller[_0xd80e('0xd')]);router[_0xd80e('0xe')]('/',auth[_0xd80e('0x8')](),controller[_0xd80e('0xf')]);router[_0xd80e('0xe')]('/:id/users',auth[_0xd80e('0x8')](),controller[_0xd80e('0x10')]);router[_0xd80e('0x11')](_0xd80e('0x12'),auth[_0xd80e('0x8')](),controller[_0xd80e('0x13')]);router[_0xd80e('0x14')](_0xd80e('0x12'),auth[_0xd80e('0x8')](),controller['destroy']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xd80e('0x15')]);module[_0xd80e('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9faf9e6..79ea6f0 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 _0x629c=['BLOB','long','getDataValue','preproduction','utf8','production','toString','sequelize','exports','name','STRING','TEXT'];(function(_0x38ff2b,_0x3a0316){var _0x341f5e=function(_0x346368){while(--_0x346368){_0x38ff2b['push'](_0x38ff2b['shift']());}};_0x341f5e(++_0x3a0316);}(_0x629c,0x97));var _0xc629=function(_0x419f38,_0xdf9dac){_0x419f38=_0x419f38-0x0;var _0x7fa41e=_0x629c[_0x419f38];return _0x7fa41e;};'use strict';var Sequelize=require(_0xc629('0x0'));module[_0xc629('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc629('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc629('0x3')]},'notes':{'type':Sequelize[_0xc629('0x4')]},'preproduction':{'type':Sequelize[_0xc629('0x5')](_0xc629('0x6')),'get':function(){if(this[_0xc629('0x7')](_0xc629('0x8'))){return this[_0xc629('0x7')](_0xc629('0x8'))['toString'](_0xc629('0x9'));}}},'production':{'type':Sequelize[_0xc629('0x5')](_0xc629('0x6')),'get':function(){if(this[_0xc629('0x7')](_0xc629('0xa'))){return this['getDataValue'](_0xc629('0xa'))[_0xc629('0xb')](_0xc629('0x9'));}}}}; \ No newline at end of file +var _0xb91c=['TEXT','BLOB','long','preproduction','getDataValue','toString','utf8','production','sequelize','exports','STRING','name'];(function(_0xe7c5b7,_0x27691d){var _0x1a1b70=function(_0xdb334){while(--_0xdb334){_0xe7c5b7['push'](_0xe7c5b7['shift']());}};_0x1a1b70(++_0x27691d);}(_0xb91c,0xbc));var _0xcb91=function(_0x95be10,_0x5c03f9){_0x95be10=_0x95be10-0x0;var _0x198f9e=_0xb91c[_0x95be10];return _0x198f9e;};'use strict';var Sequelize=require(_0xcb91('0x0'));module[_0xcb91('0x1')]={'name':{'type':Sequelize[_0xcb91('0x2')],'unique':_0xcb91('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xcb91('0x2')]},'notes':{'type':Sequelize[_0xcb91('0x4')]},'preproduction':{'type':Sequelize[_0xcb91('0x5')](_0xcb91('0x6')),'get':function(){if(this['getDataValue'](_0xcb91('0x7'))){return this[_0xcb91('0x8')](_0xcb91('0x7'))[_0xcb91('0x9')](_0xcb91('0xa'));}}},'production':{'type':Sequelize[_0xcb91('0x5')](_0xcb91('0x6')),'get':function(){if(this[_0xcb91('0x8')]('production')){return this['getDataValue'](_0xcb91('0xb'))[_0xcb91('0x9')]('utf8');}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index bcbc2e3..6f4aa23 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 _0x5004=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','autoAssociation','error','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','order','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','then','destroy','SquareProjects','UserProfileResource','stack','name','send','index','map','SquareProject','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x51bdd5,_0x24fceb){var _0x2a138b=function(_0x27691e){while(--_0x27691e){_0x51bdd5['push'](_0x51bdd5['shift']());}};_0x2a138b(++_0x24fceb);}(_0x5004,0x84));var _0x4500=function(_0x3a3d0c,_0x464c73){_0x3a3d0c=_0x3a3d0c-0x0;var _0x4653a4=_0x5004[_0x3a3d0c];return _0x4653a4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4500('0x0'));var rimraf=require(_0x4500('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4500('0x2'));var rp=require(_0x4500('0x3'));var moment=require('moment');var BPromise=require(_0x4500('0x4'));var Mustache=require(_0x4500('0x5'));var util=require(_0x4500('0x6'));var path=require(_0x4500('0x7'));var sox=require(_0x4500('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4500('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4500('0xa'));var deskjs=require(_0x4500('0xb'));var toCsv=require(_0x4500('0xc'));var querystring=require(_0x4500('0xd'));var Papa=require(_0x4500('0xe'));var Redis=require(_0x4500('0xf'));var authService=require(_0x4500('0x10'));var qs=require(_0x4500('0x11'));var as=require(_0x4500('0x12'));var hardwareService=require(_0x4500('0x13'));var logger=require(_0x4500('0x14'))('api');var utils=require(_0x4500('0x15'));var config=require(_0x4500('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4500('0x17')](config[_0x4500('0x18')],{'host':_0x4500('0x19'),'port':0x18eb});var socket=require(_0x4500('0x1a'))(new Redis(config[_0x4500('0x18')]));require(_0x4500('0x1b'))[_0x4500('0x1c')](socket);function respondWithStatusCode(_0x5dd954,_0x5c9019){_0x5c9019=_0x5c9019||0xcc;return function(_0x2b1881){if(_0x2b1881){return _0x5dd954[_0x4500('0x1d')](_0x5c9019);}return _0x5dd954['status'](_0x5c9019)[_0x4500('0x1e')]();};}function respondWithResult(_0x26aa42,_0x4ad7db){_0x4ad7db=_0x4ad7db||0xc8;return function(_0x3dc567){if(_0x3dc567){return _0x26aa42[_0x4500('0x1f')](_0x4ad7db)['json'](_0x3dc567);}};}function respondWithFilteredResult(_0x124ffa,_0x7257c2){return function(_0x50ed57){if(_0x50ed57){var _0x46030d=_0x50ed57[_0x4500('0x20')],_0x19e601=_0x7257c2['offset'],_0x20f3ae=_0x7257c2[_0x4500('0x21')]+_0x7257c2[_0x4500('0x22')],_0x15ef4b;if(_0x20f3ae>=_0x46030d){_0x20f3ae=_0x46030d;_0x15ef4b=0xc8;}else{_0x15ef4b=0xce;}_0x124ffa[_0x4500('0x1f')](_0x15ef4b);return _0x124ffa[_0x4500('0x23')]('Content-Range',_0x19e601+'-'+_0x20f3ae+'/'+_0x46030d)[_0x4500('0x24')](_0x50ed57);}return null;};}function patchUpdates(_0x2d9f52){return function(_0x4d4d63){try{jsonpatch[_0x4500('0x25')](_0x4d4d63,_0x2d9f52,!![]);}catch(_0x3c9583){return BPromise[_0x4500('0x26')](_0x3c9583);}return _0x4d4d63['save']();};}function saveUpdates(_0x566859,_0x1dfb28){return function(_0x3ee1d2){if(_0x3ee1d2){return _0x3ee1d2[_0x4500('0x27')](_0x566859)[_0x4500('0x28')](function(_0x1eb0f5){return _0x1eb0f5;});}return null;};}function removeEntity(_0x3f97f6,_0x406b1c){return function(_0x3f3dad){if(_0x3f3dad){return _0x3f3dad[_0x4500('0x29')]()['then'](function(){var _0x48bb40=_0x3f3dad['get']({'plain':!![]});var _0x279cb8=_0x4500('0x2a');return db[_0x4500('0x2b')][_0x4500('0x29')]({'where':{'type':_0x279cb8,'resourceId':_0x48bb40['id']}})['then'](function(){return _0x3f3dad;});})[_0x4500('0x28')](function(){_0x3f97f6[_0x4500('0x1f')](0xcc)[_0x4500('0x1e')]();});}};}function handleEntityNotFound(_0x15c8a9,_0x31dab2){return function(_0x2cd2e4){if(!_0x2cd2e4){_0x15c8a9[_0x4500('0x1d')](0x194);}return _0x2cd2e4;};}function handleError(_0x2ee88d,_0x1dcde0){_0x1dcde0=_0x1dcde0||0x1f4;return function(_0x4a8f0b){logger['error'](_0x4a8f0b[_0x4500('0x2c')]);if(_0x4a8f0b[_0x4500('0x2d')]){delete _0x4a8f0b[_0x4500('0x2d')];}_0x2ee88d[_0x4500('0x1f')](_0x1dcde0)[_0x4500('0x2e')](_0x4a8f0b);};}exports[_0x4500('0x2f')]=function(_0x4bc1eb,_0x5e26b9){var _0x8a1b4e={},_0x3746ad={},_0x290804={'count':0x0,'rows':[]};var _0x28eb3a=_[_0x4500('0x30')](db[_0x4500('0x31')][_0x4500('0x32')],function(_0xe9bc9){return{'name':_0xe9bc9['fieldName'],'type':_0xe9bc9[_0x4500('0x33')][_0x4500('0x34')]};});_0x3746ad['model']=_[_0x4500('0x30')](_0x28eb3a,_0x4500('0x2d'));_0x3746ad[_0x4500('0x35')]=_[_0x4500('0x36')](_0x4bc1eb['query']);_0x3746ad[_0x4500('0x37')]=_[_0x4500('0x38')](_0x3746ad['model'],_0x3746ad[_0x4500('0x35')]);_0x8a1b4e[_0x4500('0x39')]=_['intersection'](_0x3746ad[_0x4500('0x3a')],qs[_0x4500('0x3b')](_0x4bc1eb['query'][_0x4500('0x3b')]));_0x8a1b4e[_0x4500('0x39')]=_0x8a1b4e[_0x4500('0x39')][_0x4500('0x3c')]?_0x8a1b4e[_0x4500('0x39')]:_0x3746ad[_0x4500('0x3a')];if(!_0x4bc1eb[_0x4500('0x35')][_0x4500('0x3d')](_0x4500('0x3e'))){_0x8a1b4e[_0x4500('0x22')]=qs[_0x4500('0x22')](_0x4bc1eb[_0x4500('0x35')][_0x4500('0x22')]);_0x8a1b4e[_0x4500('0x21')]=qs[_0x4500('0x21')](_0x4bc1eb[_0x4500('0x35')][_0x4500('0x21')]);}_0x8a1b4e['order']=qs[_0x4500('0x3f')](_0x4bc1eb[_0x4500('0x35')][_0x4500('0x3f')]);_0x8a1b4e[_0x4500('0x40')]=qs[_0x4500('0x37')](_[_0x4500('0x41')](_0x4bc1eb[_0x4500('0x35')],_0x3746ad['filters']),_0x28eb3a);if(_0x4bc1eb[_0x4500('0x35')][_0x4500('0x42')]){_0x8a1b4e[_0x4500('0x40')]=_[_0x4500('0x43')](_0x8a1b4e[_0x4500('0x40')],{'$or':_[_0x4500('0x30')](_0x28eb3a,function(_0x34dc22){if(_0x34dc22['type']!==_0x4500('0x44')){var _0x20d8da={};_0x20d8da[_0x34dc22['name']]={'$like':'%'+_0x4bc1eb[_0x4500('0x35')][_0x4500('0x42')]+'%'};return _0x20d8da;}})});}_0x8a1b4e=_['merge']({},_0x8a1b4e,_0x4bc1eb[_0x4500('0x45')]);var _0x426a21={'where':_0x8a1b4e[_0x4500('0x40')]};return db[_0x4500('0x31')]['count'](_0x426a21)[_0x4500('0x28')](function(_0x2395c8){_0x290804[_0x4500('0x20')]=_0x2395c8;if(_0x4bc1eb[_0x4500('0x35')][_0x4500('0x46')]){_0x8a1b4e[_0x4500('0x47')]=[{'all':!![]}];}return db[_0x4500('0x31')][_0x4500('0x48')](_0x8a1b4e);})['then'](function(_0x3e13c9){_0x290804[_0x4500('0x49')]=_0x3e13c9;return _0x290804;})[_0x4500('0x28')](respondWithFilteredResult(_0x5e26b9,_0x8a1b4e))[_0x4500('0x4a')](handleError(_0x5e26b9,null));};exports[_0x4500('0x4b')]=function(_0x4b9f68,_0x347793){var _0x503740={'raw':![],'where':{'id':_0x4b9f68[_0x4500('0x4c')]['id']}},_0x4c1bef={};_0x4c1bef[_0x4500('0x3a')]=_['keys'](db[_0x4500('0x31')][_0x4500('0x32')]);_0x4c1bef[_0x4500('0x35')]=_[_0x4500('0x36')](_0x4b9f68[_0x4500('0x35')]);_0x4c1bef[_0x4500('0x37')]=_[_0x4500('0x38')](_0x4c1bef[_0x4500('0x3a')],_0x4c1bef[_0x4500('0x35')]);_0x503740[_0x4500('0x39')]=_['intersection'](_0x4c1bef[_0x4500('0x3a')],qs['fields'](_0x4b9f68[_0x4500('0x35')][_0x4500('0x3b')]));_0x503740[_0x4500('0x39')]=_0x503740['attributes'][_0x4500('0x3c')]?_0x503740['attributes']:_0x4c1bef[_0x4500('0x3a')];if(_0x4b9f68[_0x4500('0x35')][_0x4500('0x46')]){_0x503740[_0x4500('0x47')]=[{'all':!![]}];}_0x503740=_[_0x4500('0x43')]({},_0x503740,_0x4b9f68[_0x4500('0x45')]);return db[_0x4500('0x31')]['find'](_0x503740)[_0x4500('0x28')](handleEntityNotFound(_0x347793,null))['then'](respondWithResult(_0x347793,null))[_0x4500('0x4a')](handleError(_0x347793,null));};exports[_0x4500('0x4d')]=function(_0x4e616a,_0x15ef9f){return db[_0x4500('0x31')][_0x4500('0x4d')](_0x4e616a[_0x4500('0x4e')],{})[_0x4500('0x28')](function(_0x5e0eae){var _0xf87ac2=_0x4e616a[_0x4500('0x4f')]['get']({'plain':!![]});if(!_0xf87ac2)throw new Error(_0x4500('0x50'));if(_0xf87ac2[_0x4500('0x51')]===_0x4500('0x4f')){var _0x30b259=_0x5e0eae[_0x4500('0x52')]({'plain':!![]});var _0x40cfd8='SquareProjects';return db['UserProfileSection'][_0x4500('0x53')]({'where':{'name':_0x40cfd8,'userProfileId':_0xf87ac2['userProfileId']},'raw':!![]})['then'](function(_0x264e00){if(_0x264e00&&_0x264e00[_0x4500('0x54')]===0x0){return db['UserProfileResource'][_0x4500('0x4d')]({'name':_0x30b259[_0x4500('0x2d')],'resourceId':_0x30b259['id'],'type':_0x264e00['name'],'sectionId':_0x264e00['id']},{})['then'](function(){return _0x5e0eae;});}else{return _0x5e0eae;}})['catch'](function(_0x513885){logger[_0x4500('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x513885);throw _0x513885;});}return _0x5e0eae;})[_0x4500('0x28')](respondWithResult(_0x15ef9f,0xc9))[_0x4500('0x4a')](handleError(_0x15ef9f,null));};exports[_0x4500('0x27')]=function(_0x5cab67,_0x4ba008){if(_0x5cab67['body']['id']){delete _0x5cab67[_0x4500('0x4e')]['id'];}return db['SquareProject'][_0x4500('0x53')]({'where':{'id':_0x5cab67[_0x4500('0x4c')]['id']}})[_0x4500('0x28')](handleEntityNotFound(_0x4ba008,null))[_0x4500('0x28')](saveUpdates(_0x5cab67[_0x4500('0x4e')],null))['then'](respondWithResult(_0x4ba008,null))[_0x4500('0x4a')](handleError(_0x4ba008,null));};exports[_0x4500('0x29')]=function(_0x3f6b18,_0x76bbf6){return db[_0x4500('0x31')]['find']({'where':{'id':_0x3f6b18[_0x4500('0x4c')]['id']}})['then'](handleEntityNotFound(_0x76bbf6,null))[_0x4500('0x28')](removeEntity(_0x76bbf6,null))['catch'](handleError(_0x76bbf6,null));};exports['addUsers']=function(_0x158ee9,_0x321849,_0x14386e){return db[_0x4500('0x31')][_0x4500('0x53')]({'where':{'id':_0x158ee9[_0x4500('0x4c')]['id']}})[_0x4500('0x28')](handleEntityNotFound(_0x321849,null))[_0x4500('0x28')](function(_0x49e9fd){if(_0x49e9fd){return _0x49e9fd[_0x4500('0x56')](_0x158ee9[_0x4500('0x4e')][_0x4500('0x57')],_[_0x4500('0x58')](_0x158ee9['body'],[_0x4500('0x57'),'id'])||{});}})[_0x4500('0x28')](respondWithResult(_0x321849,null))[_0x4500('0x4a')](handleError(_0x321849,null));};exports[_0x4500('0x59')]=function(_0x3d6d7e,_0x955f76,_0x1f3ff1){return db['SquareProject'][_0x4500('0x53')]({'where':{'id':_0x3d6d7e[_0x4500('0x4c')]['id']}})[_0x4500('0x28')](handleEntityNotFound(_0x955f76,null))['then'](function(_0x1cef5d){if(_0x1cef5d){return _0x1cef5d[_0x4500('0x59')](_0x3d6d7e[_0x4500('0x35')][_0x4500('0x57')])[_0x4500('0x28')](function(){if(_['isArray'](_0x3d6d7e[_0x4500('0x35')][_0x4500('0x57')])){for(var _0x387e50=0x0;_0x387e50<_0x3d6d7e[_0x4500('0x35')][_0x4500('0x57')]['length'];_0x387e50+=0x1){socket[_0x4500('0x5a')](_0x4500('0x5b'),{'UserId':Number(_0x3d6d7e[_0x4500('0x35')][_0x4500('0x57')][_0x387e50]),'SquareProjectId':Number(_0x3d6d7e[_0x4500('0x4c')]['id'])});}}else{socket['emit'](_0x4500('0x5b'),{'UserId':Number(_0x3d6d7e[_0x4500('0x35')][_0x4500('0x57')]),'SquareProjectId':Number(_0x3d6d7e[_0x4500('0x4c')]['id'])});}});}})[_0x4500('0x28')](respondWithStatusCode(_0x955f76,null))['catch'](handleError(_0x955f76,null));};exports[_0x4500('0x5c')]=function(_0x558452,_0x997fc3,_0x490cc3){var _0x131c14={};var _0x44bfb0={};var _0x1d4e9f;var _0x2c8280;return db[_0x4500('0x31')][_0x4500('0x5d')]({'where':{'id':_0x558452[_0x4500('0x4c')]['id']}})['then'](handleEntityNotFound(_0x997fc3,null))[_0x4500('0x28')](function(_0x37a093){if(_0x37a093){_0x1d4e9f=_0x37a093;_0x44bfb0[_0x4500('0x3a')]=_[_0x4500('0x36')](db[_0x4500('0x5e')]['rawAttributes']);_0x44bfb0[_0x4500('0x35')]=_[_0x4500('0x36')](_0x558452['query']);_0x44bfb0[_0x4500('0x37')]=_[_0x4500('0x38')](_0x44bfb0[_0x4500('0x3a')],_0x44bfb0[_0x4500('0x35')]);_0x131c14[_0x4500('0x39')]=_['intersection'](_0x44bfb0[_0x4500('0x3a')],qs['fields'](_0x558452['query']['fields']));_0x131c14[_0x4500('0x39')]=_0x131c14[_0x4500('0x39')][_0x4500('0x3c')]?_0x131c14[_0x4500('0x39')]:_0x44bfb0[_0x4500('0x3a')];_0x131c14[_0x4500('0x5f')]=qs[_0x4500('0x3f')](_0x558452[_0x4500('0x35')]['sort']);_0x131c14['where']=qs[_0x4500('0x37')](_[_0x4500('0x41')](_0x558452[_0x4500('0x35')],_0x44bfb0[_0x4500('0x37')]));if(_0x558452[_0x4500('0x35')][_0x4500('0x42')]){_0x131c14[_0x4500('0x40')]=_[_0x4500('0x43')](_0x131c14[_0x4500('0x40')],{'$or':_[_0x4500('0x30')](_0x131c14[_0x4500('0x39')],function(_0x489d38){var _0x545dbf={};_0x545dbf[_0x489d38]={'$like':'%'+_0x558452['query']['filter']+'%'};return _0x545dbf;})});}_0x131c14=_['merge']({},_0x131c14,_0x558452[_0x4500('0x45')]);return _0x1d4e9f[_0x4500('0x5c')](_0x131c14);}})[_0x4500('0x28')](function(_0x134bac){if(_0x134bac){_0x2c8280=_0x134bac['length'];if(!_0x558452[_0x4500('0x35')][_0x4500('0x3d')](_0x4500('0x3e'))){_0x131c14[_0x4500('0x22')]=qs[_0x4500('0x22')](_0x558452[_0x4500('0x35')][_0x4500('0x22')]);_0x131c14[_0x4500('0x21')]=qs[_0x4500('0x21')](_0x558452[_0x4500('0x35')][_0x4500('0x21')]);}return _0x1d4e9f[_0x4500('0x5c')](_0x131c14);}})['then'](function(_0x18ae6f){if(_0x18ae6f){return _0x18ae6f?{'count':_0x2c8280,'rows':_0x18ae6f}:null;}})[_0x4500('0x28')](respondWithResult(_0x997fc3,null))[_0x4500('0x4a')](handleError(_0x997fc3,null));}; \ No newline at end of file +var _0xcc8d=['UserProfileResource','error','stack','name','send','rawAttributes','fieldName','key','map','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SquareProject','findAll','rows','catch','show','params','keys','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','userProfileId','addUsers','ids','omit','removeUsers','emit','getUsers','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get'];(function(_0x2b25d2,_0xdf635d){var _0x9c0526=function(_0x5ed786){while(--_0x5ed786){_0x2b25d2['push'](_0x2b25d2['shift']());}};_0x9c0526(++_0xdf635d);}(_0xcc8d,0x143));var _0xdcc8=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0xcc8d[_0x5e8c7c];return _0x48f7bd;};'use strict';var pdf=require(_0xdcc8('0x0'));var emlformat=require(_0xdcc8('0x1'));var rimraf=require(_0xdcc8('0x2'));var zipdir=require(_0xdcc8('0x3'));var jsonpatch=require(_0xdcc8('0x4'));var rp=require('request-promise');var moment=require(_0xdcc8('0x5'));var BPromise=require(_0xdcc8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdcc8('0x7'));var csv=require('to-csv');var ejs=require(_0xdcc8('0x8'));var fs=require('fs');var _=require(_0xdcc8('0x9'));var squel=require(_0xdcc8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdcc8('0xb'));var toCsv=require(_0xdcc8('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdcc8('0xd'));var authService=require(_0xdcc8('0xe'));var qs=require(_0xdcc8('0xf'));var as=require(_0xdcc8('0x10'));var hardwareService=require(_0xdcc8('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdcc8('0x12'));var db=require(_0xdcc8('0x13'))['db'];config['redis']=_[_0xdcc8('0x14')](config['redis'],{'host':_0xdcc8('0x15'),'port':0x18eb});var socket=require(_0xdcc8('0x16'))(new Redis(config['redis']));require(_0xdcc8('0x17'))[_0xdcc8('0x18')](socket);function respondWithStatusCode(_0x421e5b,_0x3c16e4){_0x3c16e4=_0x3c16e4||0xcc;return function(_0x2184bd){if(_0x2184bd){return _0x421e5b[_0xdcc8('0x19')](_0x3c16e4);}return _0x421e5b[_0xdcc8('0x1a')](_0x3c16e4)[_0xdcc8('0x1b')]();};}function respondWithResult(_0x2f845f,_0x1c336a){_0x1c336a=_0x1c336a||0xc8;return function(_0x350fca){if(_0x350fca){return _0x2f845f[_0xdcc8('0x1a')](_0x1c336a)['json'](_0x350fca);}};}function respondWithFilteredResult(_0x44fc43,_0x3ed5b3){return function(_0x5c61b7){if(_0x5c61b7){var _0x1b1951=_0x5c61b7[_0xdcc8('0x1c')],_0x46db03=_0x3ed5b3[_0xdcc8('0x1d')],_0x3ab9c3=_0x3ed5b3[_0xdcc8('0x1d')]+_0x3ed5b3[_0xdcc8('0x1e')],_0x1cd5fc;if(_0x3ab9c3>=_0x1b1951){_0x3ab9c3=_0x1b1951;_0x1cd5fc=0xc8;}else{_0x1cd5fc=0xce;}_0x44fc43[_0xdcc8('0x1a')](_0x1cd5fc);return _0x44fc43[_0xdcc8('0x1f')](_0xdcc8('0x20'),_0x46db03+'-'+_0x3ab9c3+'/'+_0x1b1951)[_0xdcc8('0x21')](_0x5c61b7);}return null;};}function patchUpdates(_0x2f4d54){return function(_0x4ea972){try{jsonpatch[_0xdcc8('0x22')](_0x4ea972,_0x2f4d54,!![]);}catch(_0x4c4cda){return BPromise[_0xdcc8('0x23')](_0x4c4cda);}return _0x4ea972[_0xdcc8('0x24')]();};}function saveUpdates(_0xcb903c,_0x3f43a9){return function(_0x1a7448){if(_0x1a7448){return _0x1a7448[_0xdcc8('0x25')](_0xcb903c)[_0xdcc8('0x26')](function(_0x31c2f3){return _0x31c2f3;});}return null;};}function removeEntity(_0x227339,_0x3010f2){return function(_0x56d1c4){if(_0x56d1c4){return _0x56d1c4[_0xdcc8('0x27')]()[_0xdcc8('0x26')](function(){var _0x43f349=_0x56d1c4[_0xdcc8('0x28')]({'plain':!![]});var _0x10aa29='SquareProjects';return db[_0xdcc8('0x29')][_0xdcc8('0x27')]({'where':{'type':_0x10aa29,'resourceId':_0x43f349['id']}})[_0xdcc8('0x26')](function(){return _0x56d1c4;});})[_0xdcc8('0x26')](function(){_0x227339[_0xdcc8('0x1a')](0xcc)[_0xdcc8('0x1b')]();});}};}function handleEntityNotFound(_0x364f06,_0x2babd4){return function(_0x18f2bd){if(!_0x18f2bd){_0x364f06[_0xdcc8('0x19')](0x194);}return _0x18f2bd;};}function handleError(_0x242c6b,_0x5ed214){_0x5ed214=_0x5ed214||0x1f4;return function(_0x5bdec6){logger[_0xdcc8('0x2a')](_0x5bdec6[_0xdcc8('0x2b')]);if(_0x5bdec6[_0xdcc8('0x2c')]){delete _0x5bdec6[_0xdcc8('0x2c')];}_0x242c6b[_0xdcc8('0x1a')](_0x5ed214)[_0xdcc8('0x2d')](_0x5bdec6);};}exports['index']=function(_0x33c3d1,_0x4ba36){var _0x14f48a={},_0x489074={},_0x3ed363={'count':0x0,'rows':[]};var _0x508cc0=_['map'](db['SquareProject'][_0xdcc8('0x2e')],function(_0x36f7eb){return{'name':_0x36f7eb[_0xdcc8('0x2f')],'type':_0x36f7eb['type'][_0xdcc8('0x30')]};});_0x489074['model']=_[_0xdcc8('0x31')](_0x508cc0,_0xdcc8('0x2c'));_0x489074[_0xdcc8('0x32')]=_['keys'](_0x33c3d1['query']);_0x489074[_0xdcc8('0x33')]=_['intersection'](_0x489074[_0xdcc8('0x34')],_0x489074['query']);_0x14f48a['attributes']=_[_0xdcc8('0x35')](_0x489074[_0xdcc8('0x34')],qs[_0xdcc8('0x36')](_0x33c3d1[_0xdcc8('0x32')][_0xdcc8('0x36')]));_0x14f48a[_0xdcc8('0x37')]=_0x14f48a[_0xdcc8('0x37')][_0xdcc8('0x38')]?_0x14f48a[_0xdcc8('0x37')]:_0x489074['model'];if(!_0x33c3d1[_0xdcc8('0x32')][_0xdcc8('0x39')](_0xdcc8('0x3a'))){_0x14f48a[_0xdcc8('0x1e')]=qs[_0xdcc8('0x1e')](_0x33c3d1['query'][_0xdcc8('0x1e')]);_0x14f48a['offset']=qs[_0xdcc8('0x1d')](_0x33c3d1['query'][_0xdcc8('0x1d')]);}_0x14f48a[_0xdcc8('0x3b')]=qs[_0xdcc8('0x3c')](_0x33c3d1[_0xdcc8('0x32')][_0xdcc8('0x3c')]);_0x14f48a[_0xdcc8('0x3d')]=qs[_0xdcc8('0x33')](_[_0xdcc8('0x3e')](_0x33c3d1[_0xdcc8('0x32')],_0x489074['filters']),_0x508cc0);if(_0x33c3d1[_0xdcc8('0x32')][_0xdcc8('0x3f')]){_0x14f48a[_0xdcc8('0x3d')]=_[_0xdcc8('0x40')](_0x14f48a[_0xdcc8('0x3d')],{'$or':_[_0xdcc8('0x31')](_0x508cc0,function(_0x21f952){if(_0x21f952[_0xdcc8('0x41')]!==_0xdcc8('0x42')){var _0x1be56a={};_0x1be56a[_0x21f952[_0xdcc8('0x2c')]]={'$like':'%'+_0x33c3d1[_0xdcc8('0x32')][_0xdcc8('0x3f')]+'%'};return _0x1be56a;}})});}_0x14f48a=_['merge']({},_0x14f48a,_0x33c3d1['options']);var _0x3f9f44={'where':_0x14f48a[_0xdcc8('0x3d')]};return db['SquareProject'][_0xdcc8('0x1c')](_0x3f9f44)[_0xdcc8('0x26')](function(_0x4bf0de){_0x3ed363[_0xdcc8('0x1c')]=_0x4bf0de;if(_0x33c3d1[_0xdcc8('0x32')]['includeAll']){_0x14f48a['include']=[{'all':!![]}];}return db[_0xdcc8('0x43')][_0xdcc8('0x44')](_0x14f48a);})[_0xdcc8('0x26')](function(_0x5cc81f){_0x3ed363[_0xdcc8('0x45')]=_0x5cc81f;return _0x3ed363;})[_0xdcc8('0x26')](respondWithFilteredResult(_0x4ba36,_0x14f48a))[_0xdcc8('0x46')](handleError(_0x4ba36,null));};exports[_0xdcc8('0x47')]=function(_0xf87b9f,_0x3f4d89){var _0x395776={'raw':![],'where':{'id':_0xf87b9f[_0xdcc8('0x48')]['id']}},_0x286de1={};_0x286de1[_0xdcc8('0x34')]=_[_0xdcc8('0x49')](db[_0xdcc8('0x43')][_0xdcc8('0x2e')]);_0x286de1[_0xdcc8('0x32')]=_['keys'](_0xf87b9f[_0xdcc8('0x32')]);_0x286de1[_0xdcc8('0x33')]=_[_0xdcc8('0x35')](_0x286de1[_0xdcc8('0x34')],_0x286de1[_0xdcc8('0x32')]);_0x395776[_0xdcc8('0x37')]=_['intersection'](_0x286de1[_0xdcc8('0x34')],qs[_0xdcc8('0x36')](_0xf87b9f[_0xdcc8('0x32')][_0xdcc8('0x36')]));_0x395776[_0xdcc8('0x37')]=_0x395776[_0xdcc8('0x37')][_0xdcc8('0x38')]?_0x395776[_0xdcc8('0x37')]:_0x286de1[_0xdcc8('0x34')];if(_0xf87b9f[_0xdcc8('0x32')][_0xdcc8('0x4a')]){_0x395776[_0xdcc8('0x4b')]=[{'all':!![]}];}_0x395776=_[_0xdcc8('0x40')]({},_0x395776,_0xf87b9f[_0xdcc8('0x4c')]);return db[_0xdcc8('0x43')][_0xdcc8('0x4d')](_0x395776)[_0xdcc8('0x26')](handleEntityNotFound(_0x3f4d89,null))[_0xdcc8('0x26')](respondWithResult(_0x3f4d89,null))[_0xdcc8('0x46')](handleError(_0x3f4d89,null));};exports[_0xdcc8('0x4e')]=function(_0x413a2b,_0x367cff){return db['SquareProject'][_0xdcc8('0x4e')](_0x413a2b[_0xdcc8('0x4f')],{})[_0xdcc8('0x26')](function(_0x524547){var _0x15fdcb=_0x413a2b[_0xdcc8('0x50')][_0xdcc8('0x28')]({'plain':!![]});if(!_0x15fdcb)throw new Error(_0xdcc8('0x51'));if(_0x15fdcb['role']==='user'){var _0xc9619b=_0x524547['get']({'plain':!![]});var _0x420ea2=_0xdcc8('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x420ea2,'userProfileId':_0x15fdcb[_0xdcc8('0x53')]},'raw':!![]})[_0xdcc8('0x26')](function(_0x1ba05f){if(_0x1ba05f&&_0x1ba05f['autoAssociation']===0x0){return db[_0xdcc8('0x29')]['create']({'name':_0xc9619b[_0xdcc8('0x2c')],'resourceId':_0xc9619b['id'],'type':_0x1ba05f[_0xdcc8('0x2c')],'sectionId':_0x1ba05f['id']},{})['then'](function(){return _0x524547;});}else{return _0x524547;}})[_0xdcc8('0x46')](function(_0x138246){logger[_0xdcc8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x138246);throw _0x138246;});}return _0x524547;})['then'](respondWithResult(_0x367cff,0xc9))['catch'](handleError(_0x367cff,null));};exports['update']=function(_0x496373,_0x3c4c50){if(_0x496373['body']['id']){delete _0x496373[_0xdcc8('0x4f')]['id'];}return db[_0xdcc8('0x43')]['find']({'where':{'id':_0x496373[_0xdcc8('0x48')]['id']}})[_0xdcc8('0x26')](handleEntityNotFound(_0x3c4c50,null))[_0xdcc8('0x26')](saveUpdates(_0x496373[_0xdcc8('0x4f')],null))[_0xdcc8('0x26')](respondWithResult(_0x3c4c50,null))[_0xdcc8('0x46')](handleError(_0x3c4c50,null));};exports[_0xdcc8('0x27')]=function(_0x16f3f5,_0x55e145){return db[_0xdcc8('0x43')][_0xdcc8('0x4d')]({'where':{'id':_0x16f3f5[_0xdcc8('0x48')]['id']}})[_0xdcc8('0x26')](handleEntityNotFound(_0x55e145,null))[_0xdcc8('0x26')](removeEntity(_0x55e145,null))[_0xdcc8('0x46')](handleError(_0x55e145,null));};exports[_0xdcc8('0x54')]=function(_0x57c369,_0x3e4b4f,_0x152d31){return db[_0xdcc8('0x43')][_0xdcc8('0x4d')]({'where':{'id':_0x57c369[_0xdcc8('0x48')]['id']}})[_0xdcc8('0x26')](handleEntityNotFound(_0x3e4b4f,null))[_0xdcc8('0x26')](function(_0x1d39c1){if(_0x1d39c1){return _0x1d39c1[_0xdcc8('0x54')](_0x57c369[_0xdcc8('0x4f')][_0xdcc8('0x55')],_[_0xdcc8('0x56')](_0x57c369[_0xdcc8('0x4f')],[_0xdcc8('0x55'),'id'])||{});}})[_0xdcc8('0x26')](respondWithResult(_0x3e4b4f,null))[_0xdcc8('0x46')](handleError(_0x3e4b4f,null));};exports['removeUsers']=function(_0x2b36ac,_0xa9c67e,_0x178502){return db[_0xdcc8('0x43')][_0xdcc8('0x4d')]({'where':{'id':_0x2b36ac[_0xdcc8('0x48')]['id']}})[_0xdcc8('0x26')](handleEntityNotFound(_0xa9c67e,null))[_0xdcc8('0x26')](function(_0x43f6eb){if(_0x43f6eb){return _0x43f6eb[_0xdcc8('0x57')](_0x2b36ac[_0xdcc8('0x32')]['ids'])[_0xdcc8('0x26')](function(){if(_['isArray'](_0x2b36ac[_0xdcc8('0x32')][_0xdcc8('0x55')])){for(var _0xcfa2fa=0x0;_0xcfa2fa<_0x2b36ac[_0xdcc8('0x32')][_0xdcc8('0x55')][_0xdcc8('0x38')];_0xcfa2fa+=0x1){socket[_0xdcc8('0x58')]('userSquareProject:remove',{'UserId':Number(_0x2b36ac[_0xdcc8('0x32')][_0xdcc8('0x55')][_0xcfa2fa]),'SquareProjectId':Number(_0x2b36ac['params']['id'])});}}else{socket[_0xdcc8('0x58')]('userSquareProject:remove',{'UserId':Number(_0x2b36ac[_0xdcc8('0x32')][_0xdcc8('0x55')]),'SquareProjectId':Number(_0x2b36ac['params']['id'])});}});}})[_0xdcc8('0x26')](respondWithStatusCode(_0xa9c67e,null))['catch'](handleError(_0xa9c67e,null));};exports[_0xdcc8('0x59')]=function(_0x22d533,_0x3cc978,_0x3692d8){var _0x31b3d3={};var _0x3b0724={};var _0x555c5a;var _0x3a0f46;return db['SquareProject'][_0xdcc8('0x5a')]({'where':{'id':_0x22d533['params']['id']}})[_0xdcc8('0x26')](handleEntityNotFound(_0x3cc978,null))['then'](function(_0x55b939){if(_0x55b939){_0x555c5a=_0x55b939;_0x3b0724[_0xdcc8('0x34')]=_['keys'](db['User'][_0xdcc8('0x2e')]);_0x3b0724[_0xdcc8('0x32')]=_[_0xdcc8('0x49')](_0x22d533[_0xdcc8('0x32')]);_0x3b0724[_0xdcc8('0x33')]=_[_0xdcc8('0x35')](_0x3b0724[_0xdcc8('0x34')],_0x3b0724[_0xdcc8('0x32')]);_0x31b3d3['attributes']=_[_0xdcc8('0x35')](_0x3b0724['model'],qs['fields'](_0x22d533[_0xdcc8('0x32')][_0xdcc8('0x36')]));_0x31b3d3[_0xdcc8('0x37')]=_0x31b3d3[_0xdcc8('0x37')]['length']?_0x31b3d3[_0xdcc8('0x37')]:_0x3b0724['model'];_0x31b3d3[_0xdcc8('0x3b')]=qs['sort'](_0x22d533[_0xdcc8('0x32')][_0xdcc8('0x3c')]);_0x31b3d3[_0xdcc8('0x3d')]=qs['filters'](_['pick'](_0x22d533[_0xdcc8('0x32')],_0x3b0724[_0xdcc8('0x33')]));if(_0x22d533[_0xdcc8('0x32')][_0xdcc8('0x3f')]){_0x31b3d3['where']=_[_0xdcc8('0x40')](_0x31b3d3['where'],{'$or':_[_0xdcc8('0x31')](_0x31b3d3[_0xdcc8('0x37')],function(_0x1b94ce){var _0x3ae174={};_0x3ae174[_0x1b94ce]={'$like':'%'+_0x22d533[_0xdcc8('0x32')][_0xdcc8('0x3f')]+'%'};return _0x3ae174;})});}_0x31b3d3=_[_0xdcc8('0x40')]({},_0x31b3d3,_0x22d533[_0xdcc8('0x4c')]);return _0x555c5a[_0xdcc8('0x59')](_0x31b3d3);}})[_0xdcc8('0x26')](function(_0x4d07c3){if(_0x4d07c3){_0x3a0f46=_0x4d07c3['length'];if(!_0x22d533['query'][_0xdcc8('0x39')](_0xdcc8('0x3a'))){_0x31b3d3['limit']=qs[_0xdcc8('0x1e')](_0x22d533[_0xdcc8('0x32')]['limit']);_0x31b3d3[_0xdcc8('0x1d')]=qs[_0xdcc8('0x1d')](_0x22d533[_0xdcc8('0x32')][_0xdcc8('0x1d')]);}return _0x555c5a[_0xdcc8('0x59')](_0x31b3d3);}})[_0xdcc8('0x26')](function(_0x3cf83a){if(_0x3cf83a){return _0x3cf83a?{'count':_0x3a0f46,'rows':_0x3cf83a}:null;}})['then'](respondWithResult(_0x3cc978,null))[_0xdcc8('0x46')](handleError(_0x3cc978,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 72dbf15..4392897 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 _0xd245=['hook','exports','events','../../mysqldb','SquareProject','update','remove','emit','hasOwnProperty'];(function(_0xc731d8,_0x6776dd){var _0x5c1594=function(_0x26beb3){while(--_0x26beb3){_0xc731d8['push'](_0xc731d8['shift']());}};_0x5c1594(++_0x6776dd);}(_0xd245,0x1e8));var _0x5d24=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xd245[_0x44f974];return _0x805dbd;};'use strict';var EventEmitter=require(_0x5d24('0x0'));var SquareProject=require(_0x5d24('0x1'))['db'][_0x5d24('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d24('0x3'),'afterDestroy':_0x5d24('0x4')};function emitEvent(_0x160558){return function(_0x2027b4,_0x289b1c,_0x56dfbf){SquareProjectEvents[_0x5d24('0x5')](_0x160558+':'+_0x2027b4['id'],_0x2027b4);SquareProjectEvents[_0x5d24('0x5')](_0x160558,_0x2027b4);_0x56dfbf(null);};}for(var e in events){if(events[_0x5d24('0x6')](e)){var event=events[e];SquareProject[_0x5d24('0x7')](e,emitEvent(event));}}module[_0x5d24('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x3ab0=['../../mysqldb','SquareProject','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x3ab0,0xa9));var _0x03ab=function(_0x14a3aa,_0x5bf99e){_0x14a3aa=_0x14a3aa-0x0;var _0x17a455=_0x3ab0[_0x14a3aa];return _0x17a455;};'use strict';var EventEmitter=require(_0x03ab('0x0'));var SquareProject=require(_0x03ab('0x1'))['db'][_0x03ab('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03ab('0x3'),'afterUpdate':_0x03ab('0x4'),'afterDestroy':_0x03ab('0x5')};function emitEvent(_0x479e54){return function(_0x41ebb9,_0x3e75b0,_0x168b76){SquareProjectEvents[_0x03ab('0x6')](_0x479e54+':'+_0x41ebb9['id'],_0x41ebb9);SquareProjectEvents[_0x03ab('0x6')](_0x479e54,_0x41ebb9);_0x168b76(null);};}for(var e in events){if(events[_0x03ab('0x7')](e)){var event=events[e];SquareProject[_0x03ab('0x8')](e,emitEvent(event));}}module[_0x03ab('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 4e25320..4a9060c 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 _0x2315=['../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','lodash','api','moment','bluebird','rimraf'];(function(_0x3600f7,_0xb0aed1){var _0x285253=function(_0x1d9942){while(--_0x1d9942){_0x3600f7['push'](_0x3600f7['shift']());}};_0x285253(++_0xb0aed1);}(_0x2315,0x1ea));var _0x5231=function(_0x3483fc,_0x329f99){_0x3483fc=_0x3483fc-0x0;var _0x28c637=_0x2315[_0x3483fc];return _0x28c637;};'use strict';var _=require(_0x5231('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5231('0x1'));var moment=require(_0x5231('0x2'));var BPromise=require(_0x5231('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5231('0x4'));var config=require(_0x5231('0x5'));var attributes=require(_0x5231('0x6'));module[_0x5231('0x7')]=function(_0x2c5f6f,_0x167904){return _0x2c5f6f[_0x5231('0x8')](_0x5231('0x9'),attributes,{'tableName':_0x5231('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee13=['define','SquareProject','square_projects','lodash','util','api','moment','path','rimraf','./squareProject.attributes','exports'];(function(_0x529752,_0x8fc979){var _0x225252=function(_0x5f046a){while(--_0x5f046a){_0x529752['push'](_0x529752['shift']());}};_0x225252(++_0x8fc979);}(_0xee13,0x1d1));var _0x3ee1=function(_0xef76cb,_0x423ded){_0xef76cb=_0xef76cb-0x0;var _0x104575=_0xee13[_0xef76cb];return _0x104575;};'use strict';var _=require(_0x3ee1('0x0'));var util=require(_0x3ee1('0x1'));var logger=require('../../config/logger')(_0x3ee1('0x2'));var moment=require(_0x3ee1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ee1('0x4'));var rimraf=require(_0x3ee1('0x5'));var config=require('../../config/environment');var attributes=require(_0x3ee1('0x6'));module[_0x3ee1('0x7')]=function(_0x1f1c8e,_0x263673){return _0x1f1c8e[_0x3ee1('0x8')](_0x3ee1('0x9'),attributes,{'tableName':_0x3ee1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 25ab101..f5dce57 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 _0x8942=['SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','SquareProject','options','where','include','model','attributes','map','ShowSquareProject','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8942,0x179));var _0x2894=function(_0x15caa6,_0x35ff56){_0x15caa6=_0x15caa6-0x0;var _0x4d8a61=_0x8942[_0x15caa6];return _0x4d8a61;};'use strict';var _=require('lodash');var util=require(_0x2894('0x0'));var moment=require('moment');var BPromise=require(_0x2894('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2894('0x2'));var db=require(_0x2894('0x3'))['db'];var utils=require(_0x2894('0x4'));var logger=require(_0x2894('0x5'))(_0x2894('0x6'));var config=require(_0x2894('0x7'));var jayson=require(_0x2894('0x8'));var client=jayson[_0x2894('0x9')]['http']({'port':0x232a});config[_0x2894('0xa')]=_[_0x2894('0xb')](config[_0x2894('0xa')],{'host':_0x2894('0xc'),'port':0x18eb});var socket=require(_0x2894('0xd'))(new Redis(config[_0x2894('0xa')]));require(_0x2894('0xe'))[_0x2894('0xf')](socket);function respondWithRpcPromise(_0x813ca8,_0x2fa979,_0x25291c){return new BPromise(function(_0x5a348d,_0x3a00f0){return client[_0x2894('0x10')](_0x813ca8,_0x25291c)[_0x2894('0x11')](function(_0x4a98af){logger[_0x2894('0x12')](_0x2894('0x13'),_0x2fa979,'request\x20sent');logger['debug'](_0x2894('0x14'),_0x2fa979,_0x2894('0x15'),JSON[_0x2894('0x16')](_0x4a98af));if(_0x4a98af['error']){if(_0x4a98af['error'][_0x2894('0x17')]===0x1f4){logger['error'](_0x2894('0x13'),_0x2fa979,_0x4a98af['error'][_0x2894('0x18')]);return _0x3a00f0(_0x4a98af[_0x2894('0x19')][_0x2894('0x18')]);}logger[_0x2894('0x19')](_0x2894('0x13'),_0x2fa979,_0x4a98af['error'][_0x2894('0x18')]);return _0x5a348d(_0x4a98af[_0x2894('0x19')][_0x2894('0x18')]);}else{logger['info'](_0x2894('0x13'),_0x2fa979,_0x2894('0x15'));_0x5a348d(_0x4a98af[_0x2894('0x1a')][_0x2894('0x18')]);}})[_0x2894('0x1b')](function(_0x320878){logger[_0x2894('0x19')](_0x2894('0x13'),_0x2fa979,_0x320878);_0x3a00f0(_0x320878);});});}exports['ShowSquareProject']=function(_0x1eb3a7){var _0x3e87cd=this;return new Promise(function(_0x5034ed,_0xe2b503){return db[_0x2894('0x1c')]['find']({'raw':_0x1eb3a7['options']?_0x1eb3a7[_0x2894('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1eb3a7[_0x2894('0x1d')]?_0x1eb3a7['options'][_0x2894('0x1e')]||null:null,'attributes':_0x1eb3a7['options']?_0x1eb3a7[_0x2894('0x1d')]['attributes']||null:null,'include':_0x1eb3a7[_0x2894('0x1d')]?_0x1eb3a7[_0x2894('0x1d')][_0x2894('0x1f')]?_['map'](_0x1eb3a7['options'][_0x2894('0x1f')],function(_0x302068){return{'model':db[_0x302068[_0x2894('0x20')]],'as':_0x302068['as'],'attributes':_0x302068[_0x2894('0x21')],'include':_0x302068[_0x2894('0x1f')]?_[_0x2894('0x22')](_0x302068[_0x2894('0x1f')],function(_0x794f26){return{'model':db[_0x794f26['model']],'as':_0x794f26['as'],'attributes':_0x794f26[_0x2894('0x21')],'include':_0x794f26[_0x2894('0x1f')]?_[_0x2894('0x22')](_0x794f26[_0x2894('0x1f')],function(_0x5ea035){return{'model':db[_0x5ea035['model']],'as':_0x5ea035['as'],'attributes':_0x5ea035[_0x2894('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2894('0x11')](function(_0x3dbe81){logger[_0x2894('0x12')](_0x2894('0x23'),_0x1eb3a7);logger['debug'](_0x2894('0x23'),_0x1eb3a7,JSON[_0x2894('0x16')](_0x3dbe81));_0x5034ed(_0x3dbe81);})['catch'](function(_0x3cd11e){logger[_0x2894('0x19')](_0x2894('0x23'),_0x3cd11e[_0x2894('0x18')],_0x1eb3a7);_0xe2b503(_0x3e87cd[_0x2894('0x19')](0x1f4,_0x3cd11e[_0x2894('0x18')]));});});}; \ No newline at end of file +var _0xbbbd=['../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','include','map','model','attributes','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbbbd,0x121));var _0xdbbb=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xbbbd[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var moment=require(_0xdbbb('0x2'));var BPromise=require(_0xdbbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbbb('0x4'));var db=require(_0xdbbb('0x5'))['db'];var utils=require(_0xdbbb('0x6'));var logger=require(_0xdbbb('0x7'))(_0xdbbb('0x8'));var config=require('../../config/environment');var jayson=require(_0xdbbb('0x9'));var client=jayson[_0xdbbb('0xa')][_0xdbbb('0xb')]({'port':0x232a});config[_0xdbbb('0xc')]=_['defaults'](config[_0xdbbb('0xc')],{'host':_0xdbbb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdbbb('0xe'))[_0xdbbb('0xf')](socket);function respondWithRpcPromise(_0x5181dd,_0x3810e8,_0x1a88fa){return new BPromise(function(_0x48933a,_0x153211){return client[_0xdbbb('0x10')](_0x5181dd,_0x1a88fa)[_0xdbbb('0x11')](function(_0x3abe61){logger[_0xdbbb('0x12')](_0xdbbb('0x13'),_0x3810e8,_0xdbbb('0x14'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x3810e8,'request\x20sent',JSON[_0xdbbb('0x15')](_0x3abe61));if(_0x3abe61[_0xdbbb('0x16')]){if(_0x3abe61[_0xdbbb('0x16')]['code']===0x1f4){logger[_0xdbbb('0x16')]('SquareProject,\x20%s,\x20%s',_0x3810e8,_0x3abe61[_0xdbbb('0x16')][_0xdbbb('0x17')]);return _0x153211(_0x3abe61[_0xdbbb('0x16')]['message']);}logger[_0xdbbb('0x16')](_0xdbbb('0x13'),_0x3810e8,_0x3abe61[_0xdbbb('0x16')]['message']);return _0x48933a(_0x3abe61[_0xdbbb('0x16')][_0xdbbb('0x17')]);}else{logger[_0xdbbb('0x12')](_0xdbbb('0x13'),_0x3810e8,_0xdbbb('0x14'));_0x48933a(_0x3abe61[_0xdbbb('0x18')][_0xdbbb('0x17')]);}})[_0xdbbb('0x19')](function(_0x11c80f){logger[_0xdbbb('0x16')](_0xdbbb('0x13'),_0x3810e8,_0x11c80f);_0x153211(_0x11c80f);});});}exports[_0xdbbb('0x1a')]=function(_0x7f3b20){var _0x4e6c2f=this;return new Promise(function(_0x5856f1,_0x237dfd){return db[_0xdbbb('0x1b')][_0xdbbb('0x1c')]({'raw':_0x7f3b20[_0xdbbb('0x1d')]?_0x7f3b20[_0xdbbb('0x1d')][_0xdbbb('0x1e')]===undefined?!![]:![]:!![],'where':_0x7f3b20[_0xdbbb('0x1d')]?_0x7f3b20[_0xdbbb('0x1d')][_0xdbbb('0x1f')]||null:null,'attributes':_0x7f3b20[_0xdbbb('0x1d')]?_0x7f3b20['options']['attributes']||null:null,'include':_0x7f3b20['options']?_0x7f3b20[_0xdbbb('0x1d')][_0xdbbb('0x20')]?_[_0xdbbb('0x21')](_0x7f3b20[_0xdbbb('0x1d')]['include'],function(_0x144fb5){return{'model':db[_0x144fb5[_0xdbbb('0x22')]],'as':_0x144fb5['as'],'attributes':_0x144fb5[_0xdbbb('0x23')],'include':_0x144fb5[_0xdbbb('0x20')]?_[_0xdbbb('0x21')](_0x144fb5[_0xdbbb('0x20')],function(_0x68c7a4){return{'model':db[_0x68c7a4['model']],'as':_0x68c7a4['as'],'attributes':_0x68c7a4[_0xdbbb('0x23')],'include':_0x68c7a4['include']?_[_0xdbbb('0x21')](_0x68c7a4[_0xdbbb('0x20')],function(_0x164d5d){return{'model':db[_0x164d5d['model']],'as':_0x164d5d['as'],'attributes':_0x164d5d[_0xdbbb('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe1d742){logger['info'](_0xdbbb('0x1a'),_0x7f3b20);logger[_0xdbbb('0x24')](_0xdbbb('0x1a'),_0x7f3b20,JSON['stringify'](_0xe1d742));_0x5856f1(_0xe1d742);})[_0xdbbb('0x19')](function(_0x16c72a){logger['error'](_0xdbbb('0x1a'),_0x16c72a['message'],_0x7f3b20);_0x237dfd(_0x4e6c2f['error'](0x1f4,_0x16c72a[_0xdbbb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 2130cea..87c150f 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 _0x31f0=['emit','removeListener','squareProject:','./squareProject.events','remove'];(function(_0x281852,_0x1a707b){var _0x1e00e9=function(_0x1cd816){while(--_0x1cd816){_0x281852['push'](_0x281852['shift']());}};_0x1e00e9(++_0x1a707b);}(_0x31f0,0xb7));var _0x031f=function(_0x239f16,_0x4b7c4d){_0x239f16=_0x239f16-0x0;var _0x2d1b24=_0x31f0[_0x239f16];return _0x2d1b24;};'use strict';var SquareProjectEvents=require(_0x031f('0x0'));var events=['save',_0x031f('0x1'),'update'];function createListener(_0x3747a5,_0x2021ea){return function(_0x2b04d4){_0x2021ea[_0x031f('0x2')](_0x3747a5,_0x2b04d4);};}function removeListener(_0x526a45,_0x3c0612){return function(){SquareProjectEvents[_0x031f('0x3')](_0x526a45,_0x3c0612);};}exports['register']=function(_0x4c0f94){for(var _0x56328c=0x0,_0x3dc98e=events['length'];_0x56328c<_0x3dc98e;_0x56328c++){var _0x365f59=events[_0x56328c];var _0x4300b4=createListener(_0x031f('0x4')+_0x365f59,_0x4c0f94);SquareProjectEvents['on'](_0x365f59,_0x4300b4);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','squareProject:','./squareProject.events'];(function(_0x1af492,_0x2628bc){var _0x24085d=function(_0x4f4a69){while(--_0x4f4a69){_0x1af492['push'](_0x1af492['shift']());}};_0x24085d(++_0x2628bc);}(_0xf494,0x1c6));var _0x4f49=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xf494[_0x3b150c];return _0x5cd414;};'use strict';var SquareProjectEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){SquareProjectEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);SquareProjectEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9d7ef78..e256419 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 _0x99cd=['post','create','put','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x99cd,0x158));var _0xd99c=function(_0x5e9b2d,_0x40933e){_0x5e9b2d=_0x5e9b2d-0x0;var _0xb2a3c9=_0x99cd[_0x5e9b2d];return _0xb2a3c9;};'use strict';var multer=require(_0xd99c('0x0'));var util=require(_0xd99c('0x1'));var path=require(_0xd99c('0x2'));var timeout=require(_0xd99c('0x3'));var express=require(_0xd99c('0x4'));var router=express[_0xd99c('0x5')]();var auth=require(_0xd99c('0x6'));var interaction=require(_0xd99c('0x7'));var config=require('../../config/environment');var controller=require(_0xd99c('0x8'));router[_0xd99c('0x9')]('/',auth[_0xd99c('0xa')](),controller[_0xd99c('0xb')]);router[_0xd99c('0x9')](_0xd99c('0xc'),auth['isAuthenticated'](),controller[_0xd99c('0xd')]);router['get'](_0xd99c('0xe'),auth['isAuthenticated'](),controller[_0xd99c('0xf')]);router[_0xd99c('0x10')]('/',auth[_0xd99c('0xa')](),controller[_0xd99c('0x11')]);router[_0xd99c('0x12')]('/:id',auth[_0xd99c('0xa')](),controller[_0xd99c('0x13')]);router[_0xd99c('0x14')](_0xd99c('0x15'),auth[_0xd99c('0xa')](),controller[_0xd99c('0x16')]);module[_0xd99c('0x17')]=router; \ No newline at end of file +var _0xf71e=['/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','/:id','show','get','/:id/download','download','post','create','put','delete'];(function(_0x580450,_0x3a782e){var _0x350958=function(_0x56e40){while(--_0x56e40){_0x580450['push'](_0x580450['shift']());}};_0x350958(++_0x3a782e);}(_0xf71e,0x137));var _0xef71=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xf71e[_0x59c301];return _0x3866b9;};'use strict';var multer=require(_0xef71('0x0'));var util=require(_0xef71('0x1'));var path=require(_0xef71('0x2'));var timeout=require(_0xef71('0x3'));var express=require(_0xef71('0x4'));var router=express[_0xef71('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xef71('0x6'));var config=require(_0xef71('0x7'));var controller=require(_0xef71('0x8'));router['get']('/',auth[_0xef71('0x9')](),controller['index']);router['get'](_0xef71('0xa'),auth[_0xef71('0x9')](),controller[_0xef71('0xb')]);router[_0xef71('0xc')](_0xef71('0xd'),auth[_0xef71('0x9')](),controller[_0xef71('0xe')]);router[_0xef71('0xf')]('/',auth[_0xef71('0x9')](),controller[_0xef71('0x10')]);router[_0xef71('0x11')](_0xef71('0xa'),auth[_0xef71('0x9')](),controller['update']);router[_0xef71('0x12')](_0xef71('0x13'),auth['isAuthenticated'](),controller[_0xef71('0x14')]);module[_0xef71('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 4fb54bf..28d55e0 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 _0x3172=['STRING','VIRTUAL','getDataValue'];(function(_0x439fea,_0x156479){var _0x30deb5=function(_0x37ceda){while(--_0x37ceda){_0x439fea['push'](_0x439fea['shift']());}};_0x30deb5(++_0x156479);}(_0x3172,0x1da));var _0x2317=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x3172[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2317('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2317('0x0')]},'accountcode':{'type':Sequelize[_0x2317('0x0')]},'dnid':{'type':Sequelize[_0x2317('0x0')]},'projectName':{'type':Sequelize[_0x2317('0x0')]},'saveName':{'type':Sequelize[_0x2317('0x0')]},'filename':{'type':Sequelize[_0x2317('0x0')]},'savePath':{'type':Sequelize[_0x2317('0x0')]},'format':{'type':Sequelize[_0x2317('0x1')],'get':function(){var _0x178998='';var _0x1a0e6c=this[_0x2317('0x2')]('savePath');if(_0x1a0e6c){_0x178998=_0x1a0e6c['substring'](_0x1a0e6c['lastIndexOf']('.'));}return _0x178998;}}}; \ No newline at end of file +var _0x8512=['savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x5720d9,_0x3fd163){var _0x60b18=function(_0x1dc87b){while(--_0x1dc87b){_0x5720d9['push'](_0x5720d9['shift']());}};_0x60b18(++_0x3fd163);}(_0x8512,0x170));var _0x2851=function(_0x4b3f28,_0x56f899){_0x4b3f28=_0x4b3f28-0x0;var _0x16c381=_0x8512[_0x4b3f28];return _0x16c381;};'use strict';var Sequelize=require(_0x2851('0x0'));module[_0x2851('0x1')]={'uniqueid':{'type':Sequelize[_0x2851('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2851('0x2')]},'context':{'type':Sequelize[_0x2851('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2851('0x2')]},'accountcode':{'type':Sequelize[_0x2851('0x2')]},'dnid':{'type':Sequelize[_0x2851('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x2851('0x2')]},'filename':{'type':Sequelize[_0x2851('0x2')]},'savePath':{'type':Sequelize[_0x2851('0x2')]},'format':{'type':Sequelize[_0x2851('0x3')],'get':function(){var _0x4c76eb='';var _0x1a4f22=this['getDataValue'](_0x2851('0x4'));if(_0x1a4f22){_0x4c76eb=_0x1a4f22['substring'](_0x1a4f22[_0x2851('0x5')]('.'));}return _0x4c76eb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 411b7f4..f636fa4 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 _0xf58c=['rows','show','params','rawAttributes','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','.cypher','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','SquareRecording','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll'];(function(_0x3e2648,_0x560a44){var _0x54c629=function(_0x51f588){while(--_0x51f588){_0x3e2648['push'](_0x3e2648['shift']());}};_0x54c629(++_0x560a44);}(_0xf58c,0x191));var _0xcf58=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0xf58c[_0x35ef6b];return _0x3ad145;};'use strict';var pdf=require(_0xcf58('0x0'));var emlformat=require(_0xcf58('0x1'));var rimraf=require(_0xcf58('0x2'));var zipdir=require(_0xcf58('0x3'));var jsonpatch=require(_0xcf58('0x4'));var rp=require(_0xcf58('0x5'));var moment=require('moment');var BPromise=require(_0xcf58('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcf58('0x7'));var sox=require(_0xcf58('0x8'));var csv=require(_0xcf58('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf58('0xa'));var squel=require(_0xcf58('0xb'));var crypto=require(_0xcf58('0xc'));var jsforce=require(_0xcf58('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcf58('0x9'));var querystring=require(_0xcf58('0xe'));var Papa=require(_0xcf58('0xf'));var Redis=require(_0xcf58('0x10'));var authService=require(_0xcf58('0x11'));var qs=require(_0xcf58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf58('0x13'));var logger=require('../../config/logger')(_0xcf58('0x14'));var utils=require(_0xcf58('0x15'));var config=require(_0xcf58('0x16'));var db=require(_0xcf58('0x17'))['db'];function respondWithStatusCode(_0x3b7fb0,_0x4b9fc2){_0x4b9fc2=_0x4b9fc2||0xcc;return function(_0x1da622){if(_0x1da622){return _0x3b7fb0['sendStatus'](_0x4b9fc2);}return _0x3b7fb0[_0xcf58('0x18')](_0x4b9fc2)[_0xcf58('0x19')]();};}function respondWithResult(_0x4ae0ff,_0x5735fa){_0x5735fa=_0x5735fa||0xc8;return function(_0x10171a){if(_0x10171a){return _0x4ae0ff[_0xcf58('0x18')](_0x5735fa)['json'](_0x10171a);}};}function respondWithFilteredResult(_0x5b330d,_0x3bc12d){return function(_0xcd8be9){if(_0xcd8be9){var _0x1ad2ba=_0xcd8be9['count'],_0x35c8cd=_0x3bc12d[_0xcf58('0x1a')],_0x252887=_0x3bc12d[_0xcf58('0x1a')]+_0x3bc12d[_0xcf58('0x1b')],_0x535945;if(_0x252887>=_0x1ad2ba){_0x252887=_0x1ad2ba;_0x535945=0xc8;}else{_0x535945=0xce;}_0x5b330d['status'](_0x535945);return _0x5b330d[_0xcf58('0x1c')](_0xcf58('0x1d'),_0x35c8cd+'-'+_0x252887+'/'+_0x1ad2ba)[_0xcf58('0x1e')](_0xcd8be9);}return null;};}function patchUpdates(_0x5a265d){return function(_0x55fa23){try{jsonpatch[_0xcf58('0x1f')](_0x55fa23,_0x5a265d,!![]);}catch(_0x123f7f){return BPromise['reject'](_0x123f7f);}return _0x55fa23[_0xcf58('0x20')]();};}function saveUpdates(_0x4bd4d4,_0x4e90a3){return function(_0x14dbe5){if(_0x14dbe5){return _0x14dbe5[_0xcf58('0x21')](_0x4bd4d4)[_0xcf58('0x22')](function(_0x25ef9a){return _0x25ef9a;});}return null;};}function removeEntity(_0xd6c054,_0x110e5e){return function(_0x40612b){if(_0x40612b){return _0x40612b[_0xcf58('0x23')]()[_0xcf58('0x22')](function(){_0xd6c054[_0xcf58('0x18')](0xcc)[_0xcf58('0x19')]();});}};}function handleEntityNotFound(_0x15309a,_0x16fea8){return function(_0x392744){if(!_0x392744){_0x15309a['sendStatus'](0x194);}return _0x392744;};}function handleError(_0x2bd7f4,_0x55a17a){_0x55a17a=_0x55a17a||0x1f4;return function(_0x290840){logger[_0xcf58('0x24')](_0x290840[_0xcf58('0x25')]);if(_0x290840[_0xcf58('0x26')]){delete _0x290840['name'];}_0x2bd7f4['status'](_0x55a17a)[_0xcf58('0x27')](_0x290840);};}exports['index']=function(_0x5d862d,_0x42fe17){var _0x4a7315={},_0x44b3c8={},_0x13ae3a={'count':0x0,'rows':[]};var _0x56df3a=_['map'](db[_0xcf58('0x28')]['rawAttributes'],function(_0x326d3b){return{'name':_0x326d3b['fieldName'],'type':_0x326d3b[_0xcf58('0x29')][_0xcf58('0x2a')]};});_0x44b3c8[_0xcf58('0x2b')]=_[_0xcf58('0x2c')](_0x56df3a,_0xcf58('0x26'));_0x44b3c8[_0xcf58('0x2d')]=_[_0xcf58('0x2e')](_0x5d862d[_0xcf58('0x2d')]);_0x44b3c8[_0xcf58('0x2f')]=_[_0xcf58('0x30')](_0x44b3c8[_0xcf58('0x2b')],_0x44b3c8['query']);_0x4a7315[_0xcf58('0x31')]=_[_0xcf58('0x30')](_0x44b3c8[_0xcf58('0x2b')],qs['fields'](_0x5d862d['query'][_0xcf58('0x32')]));_0x4a7315['attributes']=_0x4a7315[_0xcf58('0x31')][_0xcf58('0x33')]?_0x4a7315['attributes']:_0x44b3c8[_0xcf58('0x2b')];if(!_0x5d862d[_0xcf58('0x2d')]['hasOwnProperty'](_0xcf58('0x34'))){_0x4a7315[_0xcf58('0x1b')]=qs[_0xcf58('0x1b')](_0x5d862d[_0xcf58('0x2d')][_0xcf58('0x1b')]);_0x4a7315[_0xcf58('0x1a')]=qs['offset'](_0x5d862d[_0xcf58('0x2d')][_0xcf58('0x1a')]);}_0x4a7315[_0xcf58('0x35')]=qs['sort'](_0x5d862d[_0xcf58('0x2d')][_0xcf58('0x36')]);_0x4a7315[_0xcf58('0x37')]=qs[_0xcf58('0x2f')](_['pick'](_0x5d862d['query'],_0x44b3c8['filters']),_0x56df3a);if(_0x5d862d['query'][_0xcf58('0x38')]){_0x4a7315[_0xcf58('0x37')]=_['merge'](_0x4a7315[_0xcf58('0x37')],{'$or':_[_0xcf58('0x2c')](_0x56df3a,function(_0x407daf){if(_0x407daf['type']!==_0xcf58('0x39')){var _0x305a81={};_0x305a81[_0x407daf[_0xcf58('0x26')]]={'$like':'%'+_0x5d862d[_0xcf58('0x2d')][_0xcf58('0x38')]+'%'};return _0x305a81;}})});}_0x4a7315=_[_0xcf58('0x3a')]({},_0x4a7315,_0x5d862d[_0xcf58('0x3b')]);var _0x3f22d6={'where':_0x4a7315[_0xcf58('0x37')]};return db[_0xcf58('0x28')][_0xcf58('0x3c')](_0x3f22d6)[_0xcf58('0x22')](function(_0x2f0f76){_0x13ae3a[_0xcf58('0x3c')]=_0x2f0f76;if(_0x5d862d[_0xcf58('0x2d')][_0xcf58('0x3d')]){_0x4a7315[_0xcf58('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0xcf58('0x3f')](_0x4a7315);})['then'](function(_0x17cb64){_0x13ae3a[_0xcf58('0x40')]=_0x17cb64;return _0x13ae3a;})[_0xcf58('0x22')](respondWithFilteredResult(_0x42fe17,_0x4a7315))['catch'](handleError(_0x42fe17,null));};exports[_0xcf58('0x41')]=function(_0x48397b,_0x5409fd){var _0x14197e={'raw':!![],'where':{'id':_0x48397b[_0xcf58('0x42')]['id']}},_0x582179={};_0x582179[_0xcf58('0x2b')]=_['keys'](db[_0xcf58('0x28')][_0xcf58('0x43')]);_0x582179[_0xcf58('0x2d')]=_['keys'](_0x48397b[_0xcf58('0x2d')]);_0x582179[_0xcf58('0x2f')]=_[_0xcf58('0x30')](_0x582179[_0xcf58('0x2b')],_0x582179[_0xcf58('0x2d')]);_0x14197e[_0xcf58('0x31')]=_[_0xcf58('0x30')](_0x582179[_0xcf58('0x2b')],qs[_0xcf58('0x32')](_0x48397b[_0xcf58('0x2d')][_0xcf58('0x32')]));_0x14197e[_0xcf58('0x31')]=_0x14197e[_0xcf58('0x31')][_0xcf58('0x33')]?_0x14197e['attributes']:_0x582179[_0xcf58('0x2b')];if(_0x48397b[_0xcf58('0x2d')]['includeAll']){_0x14197e[_0xcf58('0x3e')]=[{'all':!![]}];}_0x14197e=_[_0xcf58('0x3a')]({},_0x14197e,_0x48397b['options']);return db['SquareRecording'][_0xcf58('0x44')](_0x14197e)[_0xcf58('0x22')](handleEntityNotFound(_0x5409fd,null))['then'](respondWithResult(_0x5409fd,null))[_0xcf58('0x45')](handleError(_0x5409fd,null));};exports['create']=function(_0x3ff157,_0x1744b2){return db['SquareRecording'][_0xcf58('0x46')](_0x3ff157['body'],{})[_0xcf58('0x22')](respondWithResult(_0x1744b2,0xc9))[_0xcf58('0x45')](handleError(_0x1744b2,null));};exports[_0xcf58('0x21')]=function(_0x3aa998,_0x11635a){if(_0x3aa998[_0xcf58('0x47')]['id']){delete _0x3aa998[_0xcf58('0x47')]['id'];}return db['SquareRecording'][_0xcf58('0x44')]({'where':{'id':_0x3aa998[_0xcf58('0x42')]['id']}})['then'](handleEntityNotFound(_0x11635a,null))[_0xcf58('0x22')](saveUpdates(_0x3aa998[_0xcf58('0x47')],null))[_0xcf58('0x22')](respondWithResult(_0x11635a,null))['catch'](handleError(_0x11635a,null));};exports[_0xcf58('0x48')]=function(_0x4c503c,_0x1a8913,_0x16098c){var _0x2756b7=require(_0xcf58('0x49'));var _0x275d23=![];var _0x3280fe={};if(_0x4c503c[_0xcf58('0x2d')][_0xcf58('0x29')]&&_0x4c503c[_0xcf58('0x2d')][_0xcf58('0x29')]==='uniqueid'){_0x3280fe[_0xcf58('0x4a')]=_0x4c503c[_0xcf58('0x42')]['id'];}else{_0x3280fe['id']=_0x4c503c[_0xcf58('0x42')]['id'];}return db['SquareRecording'][_0xcf58('0x44')]({'where':_0x3280fe,'attributes':['id',_0xcf58('0x4b'),_0xcf58('0x4c')],'raw':!![]})[_0xcf58('0x22')](handleEntityNotFound(_0x1a8913,null))[_0xcf58('0x22')](function(_0x3a0881){if(_0x3a0881){var _0x367e49=_0x3a0881[_0xcf58('0x4b')];var _0x3bee0d=util['format']('%s.cypher',_0x367e49);if(fs[_0xcf58('0x4d')](_0x3bee0d)){_0x275d23=!![];return _0x2756b7['decryptFile'](_0x3bee0d,_0x367e49,config[_0xcf58('0x4e')][_0xcf58('0x4f')])[_0xcf58('0x22')](function(){return _0x3a0881;});}return _0x3a0881;}})[_0xcf58('0x22')](function(_0x565508){if(_0x565508){var _0x468e53=_0x565508['savePath'];if(!fs['existsSync'](_0x468e53)){throw new db[(_0xcf58('0x50'))][(_0xcf58('0x51'))](_0xcf58('0x52'));}if(_0x565508[_0xcf58('0x4c')]){return _0x1a8913[_0xcf58('0x48')](_0x468e53,_0x565508[_0xcf58('0x4c')]+path[_0xcf58('0x53')](_0x468e53),function(){if(_0x275d23){fs['unlink'](_0x468e53);}});}else{return _0x1a8913[_0xcf58('0x48')](_0x468e53,function(_0x5e143d){if(_0x275d23){fs[_0xcf58('0x54')](_0x468e53);}});}}})[_0xcf58('0x45')](function(_0x2371ee){if(_0x2371ee['message']===_0xcf58('0x52')){_0x1a8913[_0xcf58('0x18')](0x194)[_0xcf58('0x27')](_0xcf58('0x55'));}else{return handleError(_0x1a8913,null);}});};exports[_0xcf58('0x23')]=function(_0x18db96,_0x161af0){return db[_0xcf58('0x28')]['find']({'where':{'id':_0x18db96['params']['id']}})[_0xcf58('0x22')](function(_0x362dee){if(!_0x362dee)throw new ReferenceError(_0xcf58('0x56'));return _0x362dee;})[_0xcf58('0x22')](function(_0x985241){var _0x2e563c=_0x985241[_0xcf58('0x4b')];logger[_0xcf58('0x57')](_0xcf58('0x58'),_0x2e563c);if(!_['isNil'](_0x985241[_0xcf58('0x4b')])&&fs['existsSync'](_0x2e563c)){logger['info']('File:\x20\x22'+_0x2e563c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2e563c);}_0x2e563c=_0x2e563c+_0xcf58('0x59');if(!_[_0xcf58('0x5a')](_0x985241['savePath'])&&fs[_0xcf58('0x4d')](_0x2e563c)){logger[_0xcf58('0x57')]('File:\x20\x22'+_0x2e563c+_0xcf58('0x5b'));fs[_0xcf58('0x5c')](_0x2e563c);}return _0x985241;})[_0xcf58('0x22')](function(_0x19e1ad){if(!_0x19e1ad)throw new InternalError();return _0x19e1ad[_0xcf58('0x23')]();})[_0xcf58('0x22')](function(){_0x161af0['status'](0xcc)[_0xcf58('0x19')]();})[_0xcf58('0x45')](handleError(_0x161af0,null));}; \ No newline at end of file +var _0xc959=['Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','options','count','include','findAll','rows','show','params','includeAll','find','catch','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xc959,0xd5));var _0x9c95=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc959[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0x9c95('0x0'));var emlformat=require(_0x9c95('0x1'));var rimraf=require(_0x9c95('0x2'));var zipdir=require(_0x9c95('0x3'));var jsonpatch=require(_0x9c95('0x4'));var rp=require(_0x9c95('0x5'));var moment=require(_0x9c95('0x6'));var BPromise=require(_0x9c95('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9c95('0x8'));var csv=require('to-csv');var ejs=require(_0x9c95('0x9'));var fs=require('fs');var _=require(_0x9c95('0xa'));var squel=require(_0x9c95('0xb'));var crypto=require('crypto');var jsforce=require(_0x9c95('0xc'));var deskjs=require(_0x9c95('0xd'));var toCsv=require(_0x9c95('0xe'));var querystring=require(_0x9c95('0xf'));var Papa=require(_0x9c95('0x10'));var Redis=require('ioredis');var authService=require(_0x9c95('0x11'));var qs=require(_0x9c95('0x12'));var as=require(_0x9c95('0x13'));var hardwareService=require(_0x9c95('0x14'));var logger=require(_0x9c95('0x15'))(_0x9c95('0x16'));var utils=require(_0x9c95('0x17'));var config=require(_0x9c95('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x309ed2,_0x42c4b0){_0x42c4b0=_0x42c4b0||0xcc;return function(_0x182a0f){if(_0x182a0f){return _0x309ed2[_0x9c95('0x19')](_0x42c4b0);}return _0x309ed2[_0x9c95('0x1a')](_0x42c4b0)[_0x9c95('0x1b')]();};}function respondWithResult(_0xb210e9,_0x382b25){_0x382b25=_0x382b25||0xc8;return function(_0x226418){if(_0x226418){return _0xb210e9[_0x9c95('0x1a')](_0x382b25)['json'](_0x226418);}};}function respondWithFilteredResult(_0x51b6be,_0x4bbd04){return function(_0x51eb6c){if(_0x51eb6c){var _0x102a54=_0x51eb6c['count'],_0x1f68b4=_0x4bbd04[_0x9c95('0x1c')],_0x934e0=_0x4bbd04[_0x9c95('0x1c')]+_0x4bbd04['limit'],_0x19e3bd;if(_0x934e0>=_0x102a54){_0x934e0=_0x102a54;_0x19e3bd=0xc8;}else{_0x19e3bd=0xce;}_0x51b6be['status'](_0x19e3bd);return _0x51b6be[_0x9c95('0x1d')](_0x9c95('0x1e'),_0x1f68b4+'-'+_0x934e0+'/'+_0x102a54)[_0x9c95('0x1f')](_0x51eb6c);}return null;};}function patchUpdates(_0x4a6546){return function(_0x45c75f){try{jsonpatch[_0x9c95('0x20')](_0x45c75f,_0x4a6546,!![]);}catch(_0xaefa0a){return BPromise['reject'](_0xaefa0a);}return _0x45c75f[_0x9c95('0x21')]();};}function saveUpdates(_0x869b0c,_0x443a42){return function(_0x24e41d){if(_0x24e41d){return _0x24e41d[_0x9c95('0x22')](_0x869b0c)[_0x9c95('0x23')](function(_0x415678){return _0x415678;});}return null;};}function removeEntity(_0x44e208,_0x1647b0){return function(_0x17e84c){if(_0x17e84c){return _0x17e84c[_0x9c95('0x24')]()['then'](function(){_0x44e208[_0x9c95('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3229c7,_0x4ae3c6){return function(_0x2d4be4){if(!_0x2d4be4){_0x3229c7['sendStatus'](0x194);}return _0x2d4be4;};}function handleError(_0x59446e,_0x29ff28){_0x29ff28=_0x29ff28||0x1f4;return function(_0x1ff09b){logger['error'](_0x1ff09b[_0x9c95('0x25')]);if(_0x1ff09b[_0x9c95('0x26')]){delete _0x1ff09b[_0x9c95('0x26')];}_0x59446e[_0x9c95('0x1a')](_0x29ff28)[_0x9c95('0x27')](_0x1ff09b);};}exports[_0x9c95('0x28')]=function(_0x471c62,_0x329a09){var _0x3ad34c={},_0x43f352={},_0x2fa1be={'count':0x0,'rows':[]};var _0x56fde3=_[_0x9c95('0x29')](db[_0x9c95('0x2a')][_0x9c95('0x2b')],function(_0x16175a){return{'name':_0x16175a[_0x9c95('0x2c')],'type':_0x16175a[_0x9c95('0x2d')]['key']};});_0x43f352[_0x9c95('0x2e')]=_[_0x9c95('0x29')](_0x56fde3,_0x9c95('0x26'));_0x43f352[_0x9c95('0x2f')]=_[_0x9c95('0x30')](_0x471c62['query']);_0x43f352['filters']=_[_0x9c95('0x31')](_0x43f352[_0x9c95('0x2e')],_0x43f352[_0x9c95('0x2f')]);_0x3ad34c[_0x9c95('0x32')]=_[_0x9c95('0x31')](_0x43f352[_0x9c95('0x2e')],qs[_0x9c95('0x33')](_0x471c62[_0x9c95('0x2f')][_0x9c95('0x33')]));_0x3ad34c[_0x9c95('0x32')]=_0x3ad34c['attributes'][_0x9c95('0x34')]?_0x3ad34c[_0x9c95('0x32')]:_0x43f352[_0x9c95('0x2e')];if(!_0x471c62[_0x9c95('0x2f')][_0x9c95('0x35')](_0x9c95('0x36'))){_0x3ad34c[_0x9c95('0x37')]=qs[_0x9c95('0x37')](_0x471c62[_0x9c95('0x2f')][_0x9c95('0x37')]);_0x3ad34c['offset']=qs[_0x9c95('0x1c')](_0x471c62[_0x9c95('0x2f')][_0x9c95('0x1c')]);}_0x3ad34c['order']=qs[_0x9c95('0x38')](_0x471c62[_0x9c95('0x2f')][_0x9c95('0x38')]);_0x3ad34c['where']=qs[_0x9c95('0x39')](_[_0x9c95('0x3a')](_0x471c62[_0x9c95('0x2f')],_0x43f352[_0x9c95('0x39')]),_0x56fde3);if(_0x471c62['query'][_0x9c95('0x3b')]){_0x3ad34c[_0x9c95('0x3c')]=_[_0x9c95('0x3d')](_0x3ad34c['where'],{'$or':_[_0x9c95('0x29')](_0x56fde3,function(_0x4862c3){if(_0x4862c3[_0x9c95('0x2d')]!=='VIRTUAL'){var _0x3b23a0={};_0x3b23a0[_0x4862c3['name']]={'$like':'%'+_0x471c62[_0x9c95('0x2f')][_0x9c95('0x3b')]+'%'};return _0x3b23a0;}})});}_0x3ad34c=_['merge']({},_0x3ad34c,_0x471c62[_0x9c95('0x3e')]);var _0x276dec={'where':_0x3ad34c[_0x9c95('0x3c')]};return db[_0x9c95('0x2a')][_0x9c95('0x3f')](_0x276dec)[_0x9c95('0x23')](function(_0x45bed7){_0x2fa1be[_0x9c95('0x3f')]=_0x45bed7;if(_0x471c62['query']['includeAll']){_0x3ad34c[_0x9c95('0x40')]=[{'all':!![]}];}return db[_0x9c95('0x2a')][_0x9c95('0x41')](_0x3ad34c);})['then'](function(_0x5ca4b1){_0x2fa1be[_0x9c95('0x42')]=_0x5ca4b1;return _0x2fa1be;})[_0x9c95('0x23')](respondWithFilteredResult(_0x329a09,_0x3ad34c))['catch'](handleError(_0x329a09,null));};exports[_0x9c95('0x43')]=function(_0x45a977,_0x402604){var _0x319249={'raw':!![],'where':{'id':_0x45a977[_0x9c95('0x44')]['id']}},_0x5728e4={};_0x5728e4[_0x9c95('0x2e')]=_[_0x9c95('0x30')](db[_0x9c95('0x2a')]['rawAttributes']);_0x5728e4['query']=_[_0x9c95('0x30')](_0x45a977[_0x9c95('0x2f')]);_0x5728e4['filters']=_[_0x9c95('0x31')](_0x5728e4[_0x9c95('0x2e')],_0x5728e4[_0x9c95('0x2f')]);_0x319249[_0x9c95('0x32')]=_[_0x9c95('0x31')](_0x5728e4[_0x9c95('0x2e')],qs[_0x9c95('0x33')](_0x45a977[_0x9c95('0x2f')][_0x9c95('0x33')]));_0x319249[_0x9c95('0x32')]=_0x319249[_0x9c95('0x32')][_0x9c95('0x34')]?_0x319249[_0x9c95('0x32')]:_0x5728e4[_0x9c95('0x2e')];if(_0x45a977[_0x9c95('0x2f')][_0x9c95('0x45')]){_0x319249[_0x9c95('0x40')]=[{'all':!![]}];}_0x319249=_[_0x9c95('0x3d')]({},_0x319249,_0x45a977[_0x9c95('0x3e')]);return db[_0x9c95('0x2a')][_0x9c95('0x46')](_0x319249)[_0x9c95('0x23')](handleEntityNotFound(_0x402604,null))['then'](respondWithResult(_0x402604,null))[_0x9c95('0x47')](handleError(_0x402604,null));};exports[_0x9c95('0x48')]=function(_0x4f58b6,_0x269213){return db['SquareRecording'][_0x9c95('0x48')](_0x4f58b6[_0x9c95('0x49')],{})[_0x9c95('0x23')](respondWithResult(_0x269213,0xc9))['catch'](handleError(_0x269213,null));};exports[_0x9c95('0x22')]=function(_0x569fd7,_0x5114e6){if(_0x569fd7['body']['id']){delete _0x569fd7[_0x9c95('0x49')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x569fd7[_0x9c95('0x44')]['id']}})[_0x9c95('0x23')](handleEntityNotFound(_0x5114e6,null))[_0x9c95('0x23')](saveUpdates(_0x569fd7[_0x9c95('0x49')],null))[_0x9c95('0x23')](respondWithResult(_0x5114e6,null))[_0x9c95('0x47')](handleError(_0x5114e6,null));};exports[_0x9c95('0x4a')]=function(_0x2fd214,_0x5aa09e,_0x2ea395){var _0xb56347=require('../../components/encryptor');var _0x1de721=![];var _0x50f2b8={};if(_0x2fd214[_0x9c95('0x2f')][_0x9c95('0x2d')]&&_0x2fd214[_0x9c95('0x2f')][_0x9c95('0x2d')]===_0x9c95('0x4b')){_0x50f2b8[_0x9c95('0x4b')]=_0x2fd214[_0x9c95('0x44')]['id'];}else{_0x50f2b8['id']=_0x2fd214[_0x9c95('0x44')]['id'];}return db['SquareRecording'][_0x9c95('0x46')]({'where':_0x50f2b8,'attributes':['id',_0x9c95('0x4c'),_0x9c95('0x4d')],'raw':!![]})[_0x9c95('0x23')](handleEntityNotFound(_0x5aa09e,null))[_0x9c95('0x23')](function(_0x4e9fb0){if(_0x4e9fb0){var _0x13c064=_0x4e9fb0[_0x9c95('0x4c')];var _0x533d12=util[_0x9c95('0x4e')](_0x9c95('0x4f'),_0x13c064);if(fs[_0x9c95('0x50')](_0x533d12)){_0x1de721=!![];return _0xb56347[_0x9c95('0x51')](_0x533d12,_0x13c064,config[_0x9c95('0x52')][_0x9c95('0x53')])['then'](function(){return _0x4e9fb0;});}return _0x4e9fb0;}})[_0x9c95('0x23')](function(_0x333d36){if(_0x333d36){var _0x10cec7=_0x333d36[_0x9c95('0x4c')];if(!fs[_0x9c95('0x50')](_0x10cec7)){throw new db[(_0x9c95('0x54'))][(_0x9c95('0x55'))](_0x9c95('0x56'));}if(_0x333d36['filename']){return _0x5aa09e[_0x9c95('0x4a')](_0x10cec7,_0x333d36[_0x9c95('0x4d')]+path[_0x9c95('0x57')](_0x10cec7),function(){if(_0x1de721){fs[_0x9c95('0x58')](_0x10cec7);}});}else{return _0x5aa09e['download'](_0x10cec7,function(_0x16145a){if(_0x1de721){fs[_0x9c95('0x58')](_0x10cec7);}});}}})[_0x9c95('0x47')](function(_0x7c2440){if(_0x7c2440[_0x9c95('0x59')]==='SquareRecording\x20not\x20found'){_0x5aa09e['status'](0x194)[_0x9c95('0x27')](_0x9c95('0x5a'));}else{return handleError(_0x5aa09e,null);}});};exports[_0x9c95('0x24')]=function(_0x21abc4,_0x15e834){return db['SquareRecording'][_0x9c95('0x46')]({'where':{'id':_0x21abc4[_0x9c95('0x44')]['id']}})[_0x9c95('0x23')](function(_0x25e64b){if(!_0x25e64b)throw new ReferenceError(_0x9c95('0x5b'));return _0x25e64b;})[_0x9c95('0x23')](function(_0x3baa62){var _0x5614e7=_0x3baa62[_0x9c95('0x4c')];logger[_0x9c95('0x5c')](_0x9c95('0x5d'),_0x5614e7);if(!_['isNil'](_0x3baa62[_0x9c95('0x4c')])&&fs[_0x9c95('0x50')](_0x5614e7)){logger[_0x9c95('0x5c')](_0x9c95('0x5e')+_0x5614e7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9c95('0x5f')](_0x5614e7);}_0x5614e7=_0x5614e7+_0x9c95('0x60');if(!_[_0x9c95('0x61')](_0x3baa62['savePath'])&&fs[_0x9c95('0x50')](_0x5614e7)){logger['info'](_0x9c95('0x5e')+_0x5614e7+_0x9c95('0x62'));fs[_0x9c95('0x5f')](_0x5614e7);}return _0x3baa62;})[_0x9c95('0x23')](function(_0x14e4e0){if(!_0x14e4e0)throw new InternalError();return _0x14e4e0[_0x9c95('0x24')]();})[_0x9c95('0x23')](function(){_0x15e834[_0x9c95('0x1a')](0xcc)[_0x9c95('0x1b')]();})[_0x9c95('0x47')](handleError(_0x15e834,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e47bcc7..f253177 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 _0x61d0=['rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','bluebird','path'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x61d0,0x187));var _0x061d=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x61d0[_0x43576f];return _0x4d2466;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var logger=require(_0x061d('0x1'))(_0x061d('0x2'));var moment=require('moment');var BPromise=require(_0x061d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x061d('0x4'));var rimraf=require(_0x061d('0x5'));var config=require('../../config/environment');var attributes=require(_0x061d('0x6'));module[_0x061d('0x7')]=function(_0x14e976,_0x255478){return _0x14e976[_0x061d('0x8')](_0x061d('0x9'),attributes,{'tableName':_0x061d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb1=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','define','square_recordings'];(function(_0x38b3cb,_0x4ad7b3){var _0x5a9a84=function(_0x237634){while(--_0x237634){_0x38b3cb['push'](_0x38b3cb['shift']());}};_0x5a9a84(++_0x4ad7b3);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x51e1ee,_0x4452a4){_0x51e1ee=_0x51e1ee-0x0;var _0x38c847=_0xdfb1[_0x51e1ee];return _0x38c847;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var fs=require('fs');var path=require(_0x1dfb('0x6'));var rimraf=require(_0x1dfb('0x7'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module['exports']=function(_0x31f0ff,_0x36bf77){return _0x31f0ff[_0x1dfb('0x8')]('SquareRecording',attributes,{'tableName':_0x1dfb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index ced7dda..61aff45 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 _0xa1e3=['../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','SquareRecording,\x20%s,\x20%s','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa1e3,0x158));var _0x3a1e=function(_0x1c07c8,_0x41fc36){_0x1c07c8=_0x1c07c8-0x0;var _0x1421ef=_0xa1e3[_0x1c07c8];return _0x1421ef;};'use strict';var _=require(_0x3a1e('0x0'));var util=require(_0x3a1e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a1e('0x2'));var fs=require('fs');var Redis=require(_0x3a1e('0x3'));var db=require(_0x3a1e('0x4'))['db'];var utils=require(_0x3a1e('0x5'));var logger=require('../../config/logger')(_0x3a1e('0x6'));var config=require(_0x3a1e('0x7'));var jayson=require(_0x3a1e('0x8'));var client=jayson[_0x3a1e('0x9')][_0x3a1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4db5b5,_0x59579,_0xf509f9){return new BPromise(function(_0x5cb396,_0x350a2c){return client['request'](_0x4db5b5,_0xf509f9)['then'](function(_0x46f0a7){logger[_0x3a1e('0xb')]('SquareRecording,\x20%s,\x20%s',_0x59579,_0x3a1e('0xc'));logger[_0x3a1e('0xd')](_0x3a1e('0xe'),_0x59579,_0x3a1e('0xc'),JSON[_0x3a1e('0xf')](_0x46f0a7));if(_0x46f0a7[_0x3a1e('0x10')]){if(_0x46f0a7[_0x3a1e('0x10')]['code']===0x1f4){logger[_0x3a1e('0x10')](_0x3a1e('0x11'),_0x59579,_0x46f0a7['error'][_0x3a1e('0x12')]);return _0x350a2c(_0x46f0a7[_0x3a1e('0x10')]['message']);}logger[_0x3a1e('0x10')](_0x3a1e('0x11'),_0x59579,_0x46f0a7['error'][_0x3a1e('0x12')]);return _0x5cb396(_0x46f0a7[_0x3a1e('0x10')]['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x59579,_0x3a1e('0xc'));_0x5cb396(_0x46f0a7[_0x3a1e('0x13')][_0x3a1e('0x12')]);}})['catch'](function(_0x13c580){logger[_0x3a1e('0x10')](_0x3a1e('0x11'),_0x59579,_0x13c580);_0x350a2c(_0x13c580);});});}exports[_0x3a1e('0x14')]=function(_0x3c757c){var _0x1cdf26=this;return new Promise(function(_0x16879e,_0x33d52d){return db[_0x3a1e('0x15')][_0x3a1e('0x16')](_0x3c757c[_0x3a1e('0x17')],{'raw':_0x3c757c['options']?_0x3c757c[_0x3a1e('0x18')][_0x3a1e('0x19')]===undefined?!![]:![]:!![]})[_0x3a1e('0x1a')](function(_0x48237f){logger[_0x3a1e('0xb')](_0x3a1e('0x14'),_0x3c757c);logger['debug']('CreateSquareRecording',_0x3c757c,JSON[_0x3a1e('0xf')](_0x48237f));_0x16879e(_0x48237f);})['catch'](function(_0x2b1668){logger['error'](_0x3a1e('0x14'),_0x2b1668[_0x3a1e('0x12')],_0x3c757c);_0x33d52d(_0x1cdf26['error'](0x1f4,_0x2b1668['message']));});});}; \ No newline at end of file +var _0x748b=['body','options','raw','stringify','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareRecording','create'];(function(_0x29ff63,_0x57e707){var _0x3db471=function(_0x477d21){while(--_0x477d21){_0x29ff63['push'](_0x29ff63['shift']());}};_0x3db471(++_0x57e707);}(_0x748b,0xee));var _0xb748=function(_0x21c883,_0x2348d1){_0x21c883=_0x21c883-0x0;var _0xbc22ab=_0x748b[_0x21c883];return _0xbc22ab;};'use strict';var _=require(_0xb748('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb748('0x1'));var fs=require('fs');var Redis=require(_0xb748('0x2'));var db=require(_0xb748('0x3'))['db'];var utils=require(_0xb748('0x4'));var logger=require(_0xb748('0x5'))(_0xb748('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb748('0x7')][_0xb748('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59bceb,_0x26fc0f,_0x28ea8b){return new BPromise(function(_0x949e1a,_0x21a537){return client['request'](_0x59bceb,_0x28ea8b)[_0xb748('0x9')](function(_0x1a1658){logger[_0xb748('0xa')](_0xb748('0xb'),_0x26fc0f,'request\x20sent');logger[_0xb748('0xc')](_0xb748('0xd'),_0x26fc0f,_0xb748('0xe'),JSON['stringify'](_0x1a1658));if(_0x1a1658['error']){if(_0x1a1658[_0xb748('0xf')][_0xb748('0x10')]===0x1f4){logger[_0xb748('0xf')](_0xb748('0xb'),_0x26fc0f,_0x1a1658[_0xb748('0xf')][_0xb748('0x11')]);return _0x21a537(_0x1a1658['error']['message']);}logger['error'](_0xb748('0xb'),_0x26fc0f,_0x1a1658[_0xb748('0xf')][_0xb748('0x11')]);return _0x949e1a(_0x1a1658['error'][_0xb748('0x11')]);}else{logger[_0xb748('0xa')]('SquareRecording,\x20%s,\x20%s',_0x26fc0f,_0xb748('0xe'));_0x949e1a(_0x1a1658[_0xb748('0x12')][_0xb748('0x11')]);}})[_0xb748('0x13')](function(_0x96b67b){logger[_0xb748('0xf')](_0xb748('0xb'),_0x26fc0f,_0x96b67b);_0x21a537(_0x96b67b);});});}exports[_0xb748('0x14')]=function(_0x36ace4){var _0xa72516=this;return new Promise(function(_0x61914a,_0x573dc2){return db['SquareRecording'][_0xb748('0x15')](_0x36ace4[_0xb748('0x16')],{'raw':_0x36ace4[_0xb748('0x17')]?_0x36ace4[_0xb748('0x17')][_0xb748('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x52843d){logger[_0xb748('0xa')]('CreateSquareRecording',_0x36ace4);logger[_0xb748('0xc')](_0xb748('0x14'),_0x36ace4,JSON[_0xb748('0x19')](_0x52843d));_0x61914a(_0x52843d);})[_0xb748('0x13')](function(_0x211e34){logger['error'](_0xb748('0x14'),_0x211e34[_0xb748('0x11')],_0x36ace4);_0x573dc2(_0xa72516['error'](0x1f4,_0x211e34['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 5b6f5c8..b979237 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 _0x8110=['create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post'];(function(_0x51f5b9,_0x57dd1a){var _0x572f4e=function(_0xed7790){while(--_0xed7790){_0x51f5b9['push'](_0x51f5b9['shift']());}};_0x572f4e(++_0x57dd1a);}(_0x8110,0x11f));var _0x0811=function(_0x558c48,_0x21545e){_0x558c48=_0x558c48-0x0;var _0x4c11aa=_0x8110[_0x558c48];return _0x4c11aa;};'use strict';var multer=require(_0x0811('0x0'));var util=require('util');var path=require(_0x0811('0x1'));var timeout=require(_0x0811('0x2'));var express=require('express');var router=express[_0x0811('0x3')]();var auth=require(_0x0811('0x4'));var interaction=require(_0x0811('0x5'));var config=require(_0x0811('0x6'));var controller=require('./squareReport.controller');router[_0x0811('0x7')]('/',auth[_0x0811('0x8')](),controller[_0x0811('0x9')]);router[_0x0811('0x7')](_0x0811('0xa'),auth[_0x0811('0x8')](),controller['describe']);router[_0x0811('0x7')]('/:id',auth[_0x0811('0x8')](),controller[_0x0811('0xb')]);router[_0x0811('0xc')]('/',auth['isAuthenticated'](),controller[_0x0811('0xd')]);router[_0x0811('0xe')]('/:id',auth[_0x0811('0x8')](),controller[_0x0811('0xf')]);router[_0x0811('0x10')](_0x0811('0x11'),auth['isAuthenticated'](),controller[_0x0811('0x12')]);module[_0x0811('0x13')]=router; \ No newline at end of file +var _0xa135=['isAuthenticated','index','get','/:id','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller'];(function(_0x595291,_0x30ed1a){var _0x3161c4=function(_0x2ad8ee){while(--_0x2ad8ee){_0x595291['push'](_0x595291['shift']());}};_0x3161c4(++_0x30ed1a);}(_0xa135,0x160));var _0x5a13=function(_0x2d421b,_0x39ccc3){_0x2d421b=_0x2d421b-0x0;var _0x3de717=_0xa135[_0x2d421b];return _0x3de717;};'use strict';var multer=require(_0x5a13('0x0'));var util=require(_0x5a13('0x1'));var path=require(_0x5a13('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a13('0x3'));var router=express[_0x5a13('0x4')]();var auth=require(_0x5a13('0x5'));var interaction=require(_0x5a13('0x6'));var config=require(_0x5a13('0x7'));var controller=require(_0x5a13('0x8'));router['get']('/',auth[_0x5a13('0x9')](),controller[_0x5a13('0xa')]);router['get']('/describe',auth[_0x5a13('0x9')](),controller['describe']);router[_0x5a13('0xb')](_0x5a13('0xc'),auth[_0x5a13('0x9')](),controller['show']);router[_0x5a13('0xd')]('/',auth[_0x5a13('0x9')](),controller[_0x5a13('0xe')]);router[_0x5a13('0xf')](_0x5a13('0xc'),auth['isAuthenticated'](),controller[_0x5a13('0x10')]);router[_0x5a13('0x11')](_0x5a13('0xc'),auth[_0x5a13('0x9')](),controller['destroy']);module[_0x5a13('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 f727a58..7ac14a2 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 _0x159c=['DATE','exports','STRING'];(function(_0x4264bf,_0x39db0f){var _0x515e5f=function(_0x130168){while(--_0x130168){_0x4264bf['push'](_0x4264bf['shift']());}};_0x515e5f(++_0x39db0f);}(_0x159c,0x1c6));var _0xc159=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x159c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xc159('0x0')]={'network':{'type':Sequelize[_0xc159('0x1')]},'network_script':{'type':Sequelize[_0xc159('0x1')]},'request':{'type':Sequelize[_0xc159('0x1')]},'channel':{'type':Sequelize[_0xc159('0x1')]},'language':{'type':Sequelize[_0xc159('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc159('0x1')]},'calleridname':{'type':Sequelize[_0xc159('0x1')]},'callingpres':{'type':Sequelize[_0xc159('0x1')]},'callingani2':{'type':Sequelize[_0xc159('0x1')]},'callington':{'type':Sequelize[_0xc159('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc159('0x1')]},'rdnis':{'type':Sequelize[_0xc159('0x1')]},'context':{'type':Sequelize[_0xc159('0x1')]},'extension':{'type':Sequelize[_0xc159('0x1')]},'priority':{'type':Sequelize[_0xc159('0x1')]},'enhanced':{'type':Sequelize[_0xc159('0x1')]},'accountcode':{'type':Sequelize[_0xc159('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xc159('0x1')]},'joinAt':{'type':Sequelize[_0xc159('0x2')]},'leaveAt':{'type':Sequelize[_0xc159('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa5fd=['DATE','BOOLEAN','STRING'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa5fd,0x113));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0xda5f('0x0')]},'network_script':{'type':Sequelize[_0xda5f('0x0')]},'request':{'type':Sequelize[_0xda5f('0x0')]},'channel':{'type':Sequelize[_0xda5f('0x0')]},'language':{'type':Sequelize[_0xda5f('0x0')]},'type':{'type':Sequelize[_0xda5f('0x0')]},'uniqueid':{'type':Sequelize[_0xda5f('0x0')]},'version':{'type':Sequelize[_0xda5f('0x0')]},'callerid':{'type':Sequelize[_0xda5f('0x0')]},'calleridname':{'type':Sequelize[_0xda5f('0x0')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xda5f('0x0')]},'callingtns':{'type':Sequelize[_0xda5f('0x0')]},'dnid':{'type':Sequelize[_0xda5f('0x0')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xda5f('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xda5f('0x0')]},'enhanced':{'type':Sequelize[_0xda5f('0x0')]},'accountcode':{'type':Sequelize[_0xda5f('0x0')]},'threadid':{'type':Sequelize[_0xda5f('0x0')]},'project_name':{'type':Sequelize[_0xda5f('0x0')]},'joinAt':{'type':Sequelize[_0xda5f('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xda5f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index c55866d..cee133f 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 _0x9cc2=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareReport','count','include','findAll','rows','show','params','includeAll','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','set','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes'];(function(_0x78499d,_0x5d6566){var _0x541b9d=function(_0x25a4ce){while(--_0x25a4ce){_0x78499d['push'](_0x78499d['shift']());}};_0x541b9d(++_0x5d6566);}(_0x9cc2,0x6d));var _0x29cc=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x9cc2[_0x5f0089];return _0x193892;};'use strict';var pdf=require(_0x29cc('0x0'));var emlformat=require(_0x29cc('0x1'));var rimraf=require(_0x29cc('0x2'));var zipdir=require(_0x29cc('0x3'));var jsonpatch=require(_0x29cc('0x4'));var rp=require('request-promise');var moment=require(_0x29cc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x29cc('0x6'));var util=require('util');var path=require(_0x29cc('0x7'));var sox=require(_0x29cc('0x8'));var csv=require(_0x29cc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x29cc('0xa'));var jsforce=require(_0x29cc('0xb'));var deskjs=require(_0x29cc('0xc'));var toCsv=require(_0x29cc('0x9'));var querystring=require(_0x29cc('0xd'));var Papa=require(_0x29cc('0xe'));var Redis=require(_0x29cc('0xf'));var authService=require(_0x29cc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x29cc('0x11'));var hardwareService=require(_0x29cc('0x12'));var logger=require(_0x29cc('0x13'))('api');var utils=require(_0x29cc('0x14'));var config=require(_0x29cc('0x15'));var db=require(_0x29cc('0x16'))['db'];function respondWithStatusCode(_0x23c928,_0x517212){_0x517212=_0x517212||0xcc;return function(_0x1cff49){if(_0x1cff49){return _0x23c928['sendStatus'](_0x517212);}return _0x23c928[_0x29cc('0x17')](_0x517212)['end']();};}function respondWithResult(_0x4ffee1,_0x161327){_0x161327=_0x161327||0xc8;return function(_0x397f9d){if(_0x397f9d){return _0x4ffee1['status'](_0x161327)[_0x29cc('0x18')](_0x397f9d);}};}function respondWithFilteredResult(_0x3df90c,_0x1d7111){return function(_0x11dacd){if(_0x11dacd){var _0x38eed0=_0x11dacd['count'],_0x14a382=_0x1d7111['offset'],_0x327c9f=_0x1d7111['offset']+_0x1d7111['limit'],_0x44e931;if(_0x327c9f>=_0x38eed0){_0x327c9f=_0x38eed0;_0x44e931=0xc8;}else{_0x44e931=0xce;}_0x3df90c[_0x29cc('0x17')](_0x44e931);return _0x3df90c[_0x29cc('0x19')]('Content-Range',_0x14a382+'-'+_0x327c9f+'/'+_0x38eed0)[_0x29cc('0x18')](_0x11dacd);}return null;};}function patchUpdates(_0x47697e){return function(_0x48e453){try{jsonpatch[_0x29cc('0x1a')](_0x48e453,_0x47697e,!![]);}catch(_0x383df2){return BPromise[_0x29cc('0x1b')](_0x383df2);}return _0x48e453[_0x29cc('0x1c')]();};}function saveUpdates(_0x57299c,_0x51f92c){return function(_0x379de3){if(_0x379de3){return _0x379de3[_0x29cc('0x1d')](_0x57299c)[_0x29cc('0x1e')](function(_0xde853a){return _0xde853a;});}return null;};}function removeEntity(_0x35dcf4,_0x2227ec){return function(_0x53d1a4){if(_0x53d1a4){return _0x53d1a4[_0x29cc('0x1f')]()['then'](function(){_0x35dcf4[_0x29cc('0x17')](0xcc)[_0x29cc('0x20')]();});}};}function handleEntityNotFound(_0x391fca,_0x42ae10){return function(_0x23a4bd){if(!_0x23a4bd){_0x391fca['sendStatus'](0x194);}return _0x23a4bd;};}function handleError(_0x1e27e5,_0x5745ea){_0x5745ea=_0x5745ea||0x1f4;return function(_0x5b44b3){logger[_0x29cc('0x21')](_0x5b44b3[_0x29cc('0x22')]);if(_0x5b44b3[_0x29cc('0x23')]){delete _0x5b44b3[_0x29cc('0x23')];}_0x1e27e5[_0x29cc('0x17')](_0x5745ea)['send'](_0x5b44b3);};}exports[_0x29cc('0x24')]=function(_0x56b46a,_0x5528ca){var _0xa455ab={},_0x1f72d3={},_0x3db010={'count':0x0,'rows':[]};var _0x6de31c=_[_0x29cc('0x25')](db['SquareReport'][_0x29cc('0x26')],function(_0x5d4aec){return{'name':_0x5d4aec[_0x29cc('0x27')],'type':_0x5d4aec[_0x29cc('0x28')][_0x29cc('0x29')]};});_0x1f72d3[_0x29cc('0x2a')]=_[_0x29cc('0x25')](_0x6de31c,_0x29cc('0x23'));_0x1f72d3[_0x29cc('0x2b')]=_[_0x29cc('0x2c')](_0x56b46a[_0x29cc('0x2b')]);_0x1f72d3[_0x29cc('0x2d')]=_[_0x29cc('0x2e')](_0x1f72d3[_0x29cc('0x2a')],_0x1f72d3[_0x29cc('0x2b')]);_0xa455ab[_0x29cc('0x2f')]=_['intersection'](_0x1f72d3['model'],qs[_0x29cc('0x30')](_0x56b46a[_0x29cc('0x2b')][_0x29cc('0x30')]));_0xa455ab[_0x29cc('0x2f')]=_0xa455ab[_0x29cc('0x2f')][_0x29cc('0x31')]?_0xa455ab[_0x29cc('0x2f')]:_0x1f72d3[_0x29cc('0x2a')];if(!_0x56b46a[_0x29cc('0x2b')][_0x29cc('0x32')](_0x29cc('0x33'))){_0xa455ab[_0x29cc('0x34')]=qs[_0x29cc('0x34')](_0x56b46a['query'][_0x29cc('0x34')]);_0xa455ab['offset']=qs[_0x29cc('0x35')](_0x56b46a[_0x29cc('0x2b')][_0x29cc('0x35')]);}_0xa455ab[_0x29cc('0x36')]=qs[_0x29cc('0x37')](_0x56b46a[_0x29cc('0x2b')][_0x29cc('0x37')]);_0xa455ab[_0x29cc('0x38')]=qs[_0x29cc('0x2d')](_[_0x29cc('0x39')](_0x56b46a['query'],_0x1f72d3['filters']),_0x6de31c);if(_0x56b46a[_0x29cc('0x2b')][_0x29cc('0x3a')]){_0xa455ab['where']=_['merge'](_0xa455ab[_0x29cc('0x38')],{'$or':_[_0x29cc('0x25')](_0x6de31c,function(_0x1140a1){if(_0x1140a1[_0x29cc('0x28')]!==_0x29cc('0x3b')){var _0x4ca801={};_0x4ca801[_0x1140a1[_0x29cc('0x23')]]={'$like':'%'+_0x56b46a[_0x29cc('0x2b')][_0x29cc('0x3a')]+'%'};return _0x4ca801;}})});}_0xa455ab=_[_0x29cc('0x3c')]({},_0xa455ab,_0x56b46a[_0x29cc('0x3d')]);var _0x236a1f={'where':_0xa455ab[_0x29cc('0x38')]};return db[_0x29cc('0x3e')][_0x29cc('0x3f')](_0x236a1f)[_0x29cc('0x1e')](function(_0x45b1fe){_0x3db010[_0x29cc('0x3f')]=_0x45b1fe;if(_0x56b46a[_0x29cc('0x2b')]['includeAll']){_0xa455ab[_0x29cc('0x40')]=[{'all':!![]}];}return db[_0x29cc('0x3e')][_0x29cc('0x41')](_0xa455ab);})[_0x29cc('0x1e')](function(_0x49f72d){_0x3db010[_0x29cc('0x42')]=_0x49f72d;return _0x3db010;})[_0x29cc('0x1e')](respondWithFilteredResult(_0x5528ca,_0xa455ab))['catch'](handleError(_0x5528ca,null));};exports[_0x29cc('0x43')]=function(_0x2c7f20,_0xaa24a0){var _0xd6e842={'raw':!![],'where':{'id':_0x2c7f20[_0x29cc('0x44')]['id']}},_0x4537b6={};_0x4537b6[_0x29cc('0x2a')]=_[_0x29cc('0x2c')](db['SquareReport'][_0x29cc('0x26')]);_0x4537b6[_0x29cc('0x2b')]=_[_0x29cc('0x2c')](_0x2c7f20['query']);_0x4537b6[_0x29cc('0x2d')]=_[_0x29cc('0x2e')](_0x4537b6[_0x29cc('0x2a')],_0x4537b6[_0x29cc('0x2b')]);_0xd6e842['attributes']=_['intersection'](_0x4537b6[_0x29cc('0x2a')],qs[_0x29cc('0x30')](_0x2c7f20[_0x29cc('0x2b')][_0x29cc('0x30')]));_0xd6e842[_0x29cc('0x2f')]=_0xd6e842[_0x29cc('0x2f')][_0x29cc('0x31')]?_0xd6e842[_0x29cc('0x2f')]:_0x4537b6[_0x29cc('0x2a')];if(_0x2c7f20[_0x29cc('0x2b')][_0x29cc('0x45')]){_0xd6e842[_0x29cc('0x40')]=[{'all':!![]}];}_0xd6e842=_[_0x29cc('0x3c')]({},_0xd6e842,_0x2c7f20['options']);return db[_0x29cc('0x3e')]['find'](_0xd6e842)[_0x29cc('0x1e')](handleEntityNotFound(_0xaa24a0,null))[_0x29cc('0x1e')](respondWithResult(_0xaa24a0,null))[_0x29cc('0x46')](handleError(_0xaa24a0,null));};exports[_0x29cc('0x47')]=function(_0x3e07c1,_0x2234fd){return db[_0x29cc('0x3e')][_0x29cc('0x47')](_0x3e07c1['body'],{})[_0x29cc('0x1e')](respondWithResult(_0x2234fd,0xc9))[_0x29cc('0x46')](handleError(_0x2234fd,null));};exports[_0x29cc('0x1d')]=function(_0xf249c6,_0xf8d77c){if(_0xf249c6['body']['id']){delete _0xf249c6[_0x29cc('0x48')]['id'];}return db[_0x29cc('0x3e')]['find']({'where':{'id':_0xf249c6['params']['id']}})[_0x29cc('0x1e')](handleEntityNotFound(_0xf8d77c,null))['then'](saveUpdates(_0xf249c6[_0x29cc('0x48')],null))[_0x29cc('0x1e')](respondWithResult(_0xf8d77c,null))[_0x29cc('0x46')](handleError(_0xf8d77c,null));};exports['destroy']=function(_0x2c1d29,_0x4f5479){return db[_0x29cc('0x3e')]['find']({'where':{'id':_0x2c1d29[_0x29cc('0x44')]['id']}})[_0x29cc('0x1e')](handleEntityNotFound(_0x4f5479,null))[_0x29cc('0x1e')](removeEntity(_0x4f5479,null))[_0x29cc('0x46')](handleError(_0x4f5479,null));};exports[_0x29cc('0x49')]=function(_0x4f3aae,_0x39149c){return db[_0x29cc('0x3e')][_0x29cc('0x49')]()[_0x29cc('0x1e')](respondWithResult(_0x39149c,null))[_0x29cc('0x46')](handleError(_0x39149c,null));}; \ No newline at end of file +var _0xbfa7=['catch','show','params','merge','options','find','create','body','update','describe','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','count','includeAll','findAll','rows'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xbfa7,0x1c0));var _0x7bfa=function(_0x591f64,_0x39fd27){_0x591f64=_0x591f64-0x0;var _0xa75540=_0xbfa7[_0x591f64];return _0xa75540;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7bfa('0x0'));var rimraf=require(_0x7bfa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7bfa('0x2'));var moment=require('moment');var BPromise=require(_0x7bfa('0x3'));var Mustache=require(_0x7bfa('0x4'));var util=require('util');var path=require(_0x7bfa('0x5'));var sox=require(_0x7bfa('0x6'));var csv=require(_0x7bfa('0x7'));var ejs=require(_0x7bfa('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7bfa('0x9'));var crypto=require(_0x7bfa('0xa'));var jsforce=require(_0x7bfa('0xb'));var deskjs=require(_0x7bfa('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7bfa('0xd'));var Papa=require('papaparse');var Redis=require(_0x7bfa('0xe'));var authService=require(_0x7bfa('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bfa('0x10'));var logger=require('../../config/logger')(_0x7bfa('0x11'));var utils=require(_0x7bfa('0x12'));var config=require(_0x7bfa('0x13'));var db=require(_0x7bfa('0x14'))['db'];function respondWithStatusCode(_0x5699e6,_0x478c03){_0x478c03=_0x478c03||0xcc;return function(_0x5a2827){if(_0x5a2827){return _0x5699e6[_0x7bfa('0x15')](_0x478c03);}return _0x5699e6[_0x7bfa('0x16')](_0x478c03)[_0x7bfa('0x17')]();};}function respondWithResult(_0x3b3896,_0x5b46c5){_0x5b46c5=_0x5b46c5||0xc8;return function(_0x29591d){if(_0x29591d){return _0x3b3896['status'](_0x5b46c5)[_0x7bfa('0x18')](_0x29591d);}};}function respondWithFilteredResult(_0x269877,_0x4e00f1){return function(_0x4304ea){if(_0x4304ea){var _0x1f87cc=_0x4304ea['count'],_0x596c11=_0x4e00f1[_0x7bfa('0x19')],_0x258b45=_0x4e00f1['offset']+_0x4e00f1[_0x7bfa('0x1a')],_0x1e7aa7;if(_0x258b45>=_0x1f87cc){_0x258b45=_0x1f87cc;_0x1e7aa7=0xc8;}else{_0x1e7aa7=0xce;}_0x269877[_0x7bfa('0x16')](_0x1e7aa7);return _0x269877[_0x7bfa('0x1b')](_0x7bfa('0x1c'),_0x596c11+'-'+_0x258b45+'/'+_0x1f87cc)[_0x7bfa('0x18')](_0x4304ea);}return null;};}function patchUpdates(_0x1ea9fe){return function(_0x534d26){try{jsonpatch[_0x7bfa('0x1d')](_0x534d26,_0x1ea9fe,!![]);}catch(_0x4bd151){return BPromise[_0x7bfa('0x1e')](_0x4bd151);}return _0x534d26[_0x7bfa('0x1f')]();};}function saveUpdates(_0x5975df,_0xf1e089){return function(_0x233a73){if(_0x233a73){return _0x233a73['update'](_0x5975df)[_0x7bfa('0x20')](function(_0x10a61b){return _0x10a61b;});}return null;};}function removeEntity(_0x4016a8,_0xda0e3f){return function(_0x856589){if(_0x856589){return _0x856589[_0x7bfa('0x21')]()['then'](function(){_0x4016a8[_0x7bfa('0x16')](0xcc)[_0x7bfa('0x17')]();});}};}function handleEntityNotFound(_0x31cd08,_0x4e2187){return function(_0x4d6d96){if(!_0x4d6d96){_0x31cd08[_0x7bfa('0x15')](0x194);}return _0x4d6d96;};}function handleError(_0x2e2501,_0x5b5fd1){_0x5b5fd1=_0x5b5fd1||0x1f4;return function(_0x1ad021){logger[_0x7bfa('0x22')](_0x1ad021[_0x7bfa('0x23')]);if(_0x1ad021[_0x7bfa('0x24')]){delete _0x1ad021[_0x7bfa('0x24')];}_0x2e2501[_0x7bfa('0x16')](_0x5b5fd1)[_0x7bfa('0x25')](_0x1ad021);};}exports[_0x7bfa('0x26')]=function(_0x11be6b,_0x2a4530){var _0x35dc47={},_0x386781={},_0x3435d1={'count':0x0,'rows':[]};var _0x3101ed=_[_0x7bfa('0x27')](db[_0x7bfa('0x28')][_0x7bfa('0x29')],function(_0x3dcb21){return{'name':_0x3dcb21[_0x7bfa('0x2a')],'type':_0x3dcb21[_0x7bfa('0x2b')][_0x7bfa('0x2c')]};});_0x386781[_0x7bfa('0x2d')]=_[_0x7bfa('0x27')](_0x3101ed,_0x7bfa('0x24'));_0x386781[_0x7bfa('0x2e')]=_[_0x7bfa('0x2f')](_0x11be6b[_0x7bfa('0x2e')]);_0x386781[_0x7bfa('0x30')]=_[_0x7bfa('0x31')](_0x386781[_0x7bfa('0x2d')],_0x386781[_0x7bfa('0x2e')]);_0x35dc47[_0x7bfa('0x32')]=_[_0x7bfa('0x31')](_0x386781[_0x7bfa('0x2d')],qs['fields'](_0x11be6b[_0x7bfa('0x2e')][_0x7bfa('0x33')]));_0x35dc47[_0x7bfa('0x32')]=_0x35dc47['attributes'][_0x7bfa('0x34')]?_0x35dc47[_0x7bfa('0x32')]:_0x386781[_0x7bfa('0x2d')];if(!_0x11be6b[_0x7bfa('0x2e')]['hasOwnProperty'](_0x7bfa('0x35'))){_0x35dc47['limit']=qs['limit'](_0x11be6b['query']['limit']);_0x35dc47[_0x7bfa('0x19')]=qs[_0x7bfa('0x19')](_0x11be6b[_0x7bfa('0x2e')]['offset']);}_0x35dc47[_0x7bfa('0x36')]=qs[_0x7bfa('0x37')](_0x11be6b[_0x7bfa('0x2e')][_0x7bfa('0x37')]);_0x35dc47['where']=qs[_0x7bfa('0x30')](_[_0x7bfa('0x38')](_0x11be6b[_0x7bfa('0x2e')],_0x386781[_0x7bfa('0x30')]),_0x3101ed);if(_0x11be6b['query']['filter']){_0x35dc47['where']=_['merge'](_0x35dc47[_0x7bfa('0x39')],{'$or':_['map'](_0x3101ed,function(_0x2705ba){if(_0x2705ba[_0x7bfa('0x2b')]!==_0x7bfa('0x3a')){var _0x13f328={};_0x13f328[_0x2705ba['name']]={'$like':'%'+_0x11be6b[_0x7bfa('0x2e')]['filter']+'%'};return _0x13f328;}})});}_0x35dc47=_['merge']({},_0x35dc47,_0x11be6b['options']);var _0xa76287={'where':_0x35dc47[_0x7bfa('0x39')]};return db[_0x7bfa('0x28')]['count'](_0xa76287)[_0x7bfa('0x20')](function(_0x188587){_0x3435d1[_0x7bfa('0x3b')]=_0x188587;if(_0x11be6b[_0x7bfa('0x2e')][_0x7bfa('0x3c')]){_0x35dc47['include']=[{'all':!![]}];}return db['SquareReport'][_0x7bfa('0x3d')](_0x35dc47);})[_0x7bfa('0x20')](function(_0x453ef2){_0x3435d1[_0x7bfa('0x3e')]=_0x453ef2;return _0x3435d1;})[_0x7bfa('0x20')](respondWithFilteredResult(_0x2a4530,_0x35dc47))[_0x7bfa('0x3f')](handleError(_0x2a4530,null));};exports[_0x7bfa('0x40')]=function(_0x146e19,_0x5c8cf7){var _0x28fdb4={'raw':!![],'where':{'id':_0x146e19[_0x7bfa('0x41')]['id']}},_0x460d2a={};_0x460d2a[_0x7bfa('0x2d')]=_[_0x7bfa('0x2f')](db['SquareReport'][_0x7bfa('0x29')]);_0x460d2a[_0x7bfa('0x2e')]=_['keys'](_0x146e19[_0x7bfa('0x2e')]);_0x460d2a[_0x7bfa('0x30')]=_[_0x7bfa('0x31')](_0x460d2a[_0x7bfa('0x2d')],_0x460d2a[_0x7bfa('0x2e')]);_0x28fdb4[_0x7bfa('0x32')]=_[_0x7bfa('0x31')](_0x460d2a[_0x7bfa('0x2d')],qs['fields'](_0x146e19['query']['fields']));_0x28fdb4[_0x7bfa('0x32')]=_0x28fdb4[_0x7bfa('0x32')][_0x7bfa('0x34')]?_0x28fdb4['attributes']:_0x460d2a['model'];if(_0x146e19[_0x7bfa('0x2e')][_0x7bfa('0x3c')]){_0x28fdb4['include']=[{'all':!![]}];}_0x28fdb4=_[_0x7bfa('0x42')]({},_0x28fdb4,_0x146e19[_0x7bfa('0x43')]);return db[_0x7bfa('0x28')][_0x7bfa('0x44')](_0x28fdb4)[_0x7bfa('0x20')](handleEntityNotFound(_0x5c8cf7,null))[_0x7bfa('0x20')](respondWithResult(_0x5c8cf7,null))[_0x7bfa('0x3f')](handleError(_0x5c8cf7,null));};exports['create']=function(_0x25ebf7,_0x419d34){return db[_0x7bfa('0x28')][_0x7bfa('0x45')](_0x25ebf7[_0x7bfa('0x46')],{})[_0x7bfa('0x20')](respondWithResult(_0x419d34,0xc9))[_0x7bfa('0x3f')](handleError(_0x419d34,null));};exports[_0x7bfa('0x47')]=function(_0x439c24,_0x31e4ea){if(_0x439c24[_0x7bfa('0x46')]['id']){delete _0x439c24[_0x7bfa('0x46')]['id'];}return db['SquareReport'][_0x7bfa('0x44')]({'where':{'id':_0x439c24[_0x7bfa('0x41')]['id']}})['then'](handleEntityNotFound(_0x31e4ea,null))[_0x7bfa('0x20')](saveUpdates(_0x439c24[_0x7bfa('0x46')],null))[_0x7bfa('0x20')](respondWithResult(_0x31e4ea,null))[_0x7bfa('0x3f')](handleError(_0x31e4ea,null));};exports['destroy']=function(_0x30fbd6,_0x3a4a4a){return db[_0x7bfa('0x28')][_0x7bfa('0x44')]({'where':{'id':_0x30fbd6[_0x7bfa('0x41')]['id']}})[_0x7bfa('0x20')](handleEntityNotFound(_0x3a4a4a,null))[_0x7bfa('0x20')](removeEntity(_0x3a4a4a,null))[_0x7bfa('0x3f')](handleError(_0x3a4a4a,null));};exports[_0x7bfa('0x48')]=function(_0x477f12,_0x3a9dff){return db[_0x7bfa('0x28')][_0x7bfa('0x48')]()[_0x7bfa('0x20')](respondWithResult(_0x3a9dff,null))[_0x7bfa('0x3f')](handleError(_0x3a9dff,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0211c4c..4cf6735 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 _0xed70=['uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./squareReport.attributes','exports','report_square'];(function(_0x290673,_0x2df137){var _0x554105=function(_0x524324){while(--_0x524324){_0x290673['push'](_0x290673['shift']());}};_0x554105(++_0x2df137);}(_0xed70,0x1bd));var _0x0ed7=function(_0x4f8b61,_0x525808){_0x4f8b61=_0x4f8b61-0x0;var _0x5afbca=_0xed70[_0x4f8b61];return _0x5afbca;};'use strict';var _=require(_0x0ed7('0x0'));var util=require(_0x0ed7('0x1'));var logger=require(_0x0ed7('0x2'))('api');var moment=require(_0x0ed7('0x3'));var BPromise=require(_0x0ed7('0x4'));var rp=require(_0x0ed7('0x5'));var fs=require('fs');var path=require(_0x0ed7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ed7('0x7'));module[_0x0ed7('0x8')]=function(_0x21f5bf,_0x377b62){return _0x21f5bf['define']('SquareReport',attributes,{'tableName':_0x0ed7('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x0ed7('0xa'),_0x0ed7('0xb')]},{'name':_0x0ed7('0xc'),'fields':[_0x0ed7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x768e=['./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2356b8,_0x4c0aca){var _0x1a1dd2=function(_0x16fef2){while(--_0x16fef2){_0x2356b8['push'](_0x2356b8['shift']());}};_0x1a1dd2(++_0x4c0aca);}(_0x768e,0x133));var _0xe768=function(_0x143ed7,_0x37014e){_0x143ed7=_0x143ed7-0x0;var _0x4f6f21=_0x768e[_0x143ed7];return _0x4f6f21;};'use strict';var _=require(_0xe768('0x0'));var util=require(_0xe768('0x1'));var logger=require(_0xe768('0x2'))(_0xe768('0x3'));var moment=require(_0xe768('0x4'));var BPromise=require(_0xe768('0x5'));var rp=require(_0xe768('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe768('0x7'));var config=require('../../config/environment');var attributes=require(_0xe768('0x8'));module[_0xe768('0x9')]=function(_0x56257d,_0xaa4f79){return _0x56257d[_0xe768('0xa')]('SquareReport',attributes,{'tableName':_0xe768('0xb'),'paranoid':![],'indexes':[{'name':_0xe768('0xc'),'fields':[_0xe768('0xd'),'project_name']},{'name':_0xe768('0xe'),'fields':[_0xe768('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 7baf6ec..c13bb8e 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 _0xc768=['create','body','options','raw','catch','UpdateSquareReport','update','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','SquareReport'];(function(_0x4913a8,_0x5a8cbd){var _0x50a4de=function(_0x31892e){while(--_0x31892e){_0x4913a8['push'](_0x4913a8['shift']());}};_0x50a4de(++_0x5a8cbd);}(_0xc768,0x18f));var _0x8c76=function(_0x43dd07,_0x24cf3d){_0x43dd07=_0x43dd07-0x0;var _0x54a93d=_0xc768[_0x43dd07];return _0x54a93d;};'use strict';var _=require(_0x8c76('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c76('0x1'));var fs=require('fs');var Redis=require(_0x8c76('0x2'));var db=require(_0x8c76('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c76('0x4'))(_0x8c76('0x5'));var config=require(_0x8c76('0x6'));var jayson=require(_0x8c76('0x7'));var client=jayson[_0x8c76('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44f3df,_0xdeb3e2,_0x5b0b13){return new BPromise(function(_0x237cbd,_0x2d8ba9){return client['request'](_0x44f3df,_0x5b0b13)[_0x8c76('0x9')](function(_0x5afc6d){logger[_0x8c76('0xa')]('SquareReport,\x20%s,\x20%s',_0xdeb3e2,_0x8c76('0xb'));logger[_0x8c76('0xc')](_0x8c76('0xd'),_0xdeb3e2,_0x8c76('0xb'),JSON[_0x8c76('0xe')](_0x5afc6d));if(_0x5afc6d['error']){if(_0x5afc6d['error']['code']===0x1f4){logger[_0x8c76('0xf')](_0x8c76('0x10'),_0xdeb3e2,_0x5afc6d[_0x8c76('0xf')][_0x8c76('0x11')]);return _0x2d8ba9(_0x5afc6d[_0x8c76('0xf')][_0x8c76('0x11')]);}logger[_0x8c76('0xf')](_0x8c76('0x10'),_0xdeb3e2,_0x5afc6d[_0x8c76('0xf')]['message']);return _0x237cbd(_0x5afc6d['error']['message']);}else{logger[_0x8c76('0xa')](_0x8c76('0x10'),_0xdeb3e2,_0x8c76('0xb'));_0x237cbd(_0x5afc6d[_0x8c76('0x12')]['message']);}})['catch'](function(_0x508b21){logger[_0x8c76('0xf')](_0x8c76('0x10'),_0xdeb3e2,_0x508b21);_0x2d8ba9(_0x508b21);});});}exports[_0x8c76('0x13')]=function(_0x4aaaca){var _0x8e3ea3=this;return new Promise(function(_0x508668,_0x45b0f7){return db[_0x8c76('0x14')][_0x8c76('0x15')](_0x4aaaca[_0x8c76('0x16')],{'raw':_0x4aaaca[_0x8c76('0x17')]?_0x4aaaca[_0x8c76('0x17')][_0x8c76('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2b803e){logger[_0x8c76('0xa')](_0x8c76('0x13'),_0x4aaaca);logger[_0x8c76('0xc')](_0x8c76('0x13'),_0x4aaaca,JSON['stringify'](_0x2b803e));_0x508668(_0x2b803e);})[_0x8c76('0x19')](function(_0x3b319f){logger[_0x8c76('0xf')](_0x8c76('0x13'),_0x3b319f[_0x8c76('0x11')],_0x4aaaca);_0x45b0f7(_0x8e3ea3[_0x8c76('0xf')](0x1f4,_0x3b319f[_0x8c76('0x11')]));});});};exports[_0x8c76('0x1a')]=function(_0x3e3c03){var _0x23ba15=this;return new Promise(function(_0x82487e,_0x540e1d){return db[_0x8c76('0x14')][_0x8c76('0x1b')](_0x3e3c03[_0x8c76('0x16')],{'raw':_0x3e3c03[_0x8c76('0x17')]?_0x3e3c03[_0x8c76('0x17')][_0x8c76('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e3c03[_0x8c76('0x17')]?_0x3e3c03[_0x8c76('0x17')]['where']||null:null,'attributes':_0x3e3c03[_0x8c76('0x17')]?_0x3e3c03['options'][_0x8c76('0x1c')]||null:null,'limit':_0x3e3c03[_0x8c76('0x17')]?_0x3e3c03['options'][_0x8c76('0x1d')]||null:null})['then'](function(_0x50e255){logger[_0x8c76('0xa')](_0x8c76('0x1a'),_0x3e3c03);logger['debug'](_0x8c76('0x1a'),_0x3e3c03,JSON['stringify'](_0x50e255));_0x82487e(_0x50e255);})[_0x8c76('0x19')](function(_0xb2a14a){logger[_0x8c76('0xf')](_0x8c76('0x1a'),_0xb2a14a[_0x8c76('0x11')],_0x3e3c03);_0x540e1d(_0x23ba15['error'](0x1f4,_0xb2a14a[_0x8c76('0x11')]));});});}; \ No newline at end of file +var _0x292f=['info','request\x20sent','debug','error','code','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','SquareReport','create','body','options','stringify','catch','UpdateSquareReport','update','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then'];(function(_0x42e9fc,_0x3f0664){var _0x581ac9=function(_0x111077){while(--_0x111077){_0x42e9fc['push'](_0x42e9fc['shift']());}};_0x581ac9(++_0x3f0664);}(_0x292f,0x174));var _0xf292=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x292f[_0x1057a3];return _0x131cdb;};'use strict';var _=require(_0xf292('0x0'));var util=require(_0xf292('0x1'));var moment=require(_0xf292('0x2'));var BPromise=require(_0xf292('0x3'));var rs=require(_0xf292('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf292('0x5'))['db'];var utils=require(_0xf292('0x6'));var logger=require(_0xf292('0x7'))(_0xf292('0x8'));var config=require('../../config/environment');var jayson=require(_0xf292('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ad54a,_0x5e5e52,_0x2734e4){return new BPromise(function(_0x4d4aca,_0x575037){return client[_0xf292('0xa')](_0x4ad54a,_0x2734e4)[_0xf292('0xb')](function(_0x39819a){logger[_0xf292('0xc')]('SquareReport,\x20%s,\x20%s',_0x5e5e52,_0xf292('0xd'));logger[_0xf292('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5e5e52,_0xf292('0xd'),JSON['stringify'](_0x39819a));if(_0x39819a[_0xf292('0xf')]){if(_0x39819a[_0xf292('0xf')][_0xf292('0x10')]===0x1f4){logger[_0xf292('0xf')](_0xf292('0x11'),_0x5e5e52,_0x39819a[_0xf292('0xf')][_0xf292('0x12')]);return _0x575037(_0x39819a[_0xf292('0xf')]['message']);}logger[_0xf292('0xf')](_0xf292('0x11'),_0x5e5e52,_0x39819a[_0xf292('0xf')][_0xf292('0x12')]);return _0x4d4aca(_0x39819a[_0xf292('0xf')]['message']);}else{logger['info'](_0xf292('0x11'),_0x5e5e52,_0xf292('0xd'));_0x4d4aca(_0x39819a[_0xf292('0x13')][_0xf292('0x12')]);}})['catch'](function(_0x126274){logger[_0xf292('0xf')](_0xf292('0x11'),_0x5e5e52,_0x126274);_0x575037(_0x126274);});});}exports[_0xf292('0x14')]=function(_0x15cf2d){var _0x3a42c=this;return new Promise(function(_0x540dfe,_0x1f7adf){return db[_0xf292('0x15')][_0xf292('0x16')](_0x15cf2d[_0xf292('0x17')],{'raw':_0x15cf2d[_0xf292('0x18')]?_0x15cf2d[_0xf292('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf292('0xb')](function(_0x1c55ae){logger['info'](_0xf292('0x14'),_0x15cf2d);logger[_0xf292('0xe')](_0xf292('0x14'),_0x15cf2d,JSON[_0xf292('0x19')](_0x1c55ae));_0x540dfe(_0x1c55ae);})[_0xf292('0x1a')](function(_0x5377d3){logger[_0xf292('0xf')](_0xf292('0x14'),_0x5377d3[_0xf292('0x12')],_0x15cf2d);_0x1f7adf(_0x3a42c[_0xf292('0xf')](0x1f4,_0x5377d3[_0xf292('0x12')]));});});};exports[_0xf292('0x1b')]=function(_0x2d0a3f){var _0x46af50=this;return new Promise(function(_0x3bef6e,_0x440967){return db[_0xf292('0x15')][_0xf292('0x1c')](_0x2d0a3f[_0xf292('0x17')],{'raw':_0x2d0a3f['options']?_0x2d0a3f['options'][_0xf292('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0a3f[_0xf292('0x18')]?_0x2d0a3f[_0xf292('0x18')]['where']||null:null,'attributes':_0x2d0a3f[_0xf292('0x18')]?_0x2d0a3f[_0xf292('0x18')][_0xf292('0x1e')]||null:null,'limit':_0x2d0a3f[_0xf292('0x18')]?_0x2d0a3f['options'][_0xf292('0x1f')]||null:null})[_0xf292('0xb')](function(_0x2305d1){logger[_0xf292('0xc')](_0xf292('0x1b'),_0x2d0a3f);logger['debug']('UpdateSquareReport',_0x2d0a3f,JSON[_0xf292('0x19')](_0x2305d1));_0x3bef6e(_0x2305d1);})[_0xf292('0x1a')](function(_0xebfc2b){logger['error'](_0xf292('0x1b'),_0xebfc2b[_0xf292('0x12')],_0x2d0a3f);_0x440967(_0x46af50[_0xf292('0xf')](0x1f4,_0xebfc2b[_0xf292('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f51cd74..4aa84b2 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x4aa388,_0xa7d9b1){var _0xb673a2=function(_0x25d34d){while(--_0x25d34d){_0x4aa388['push'](_0x4aa388['shift']());}};_0xb673a2(++_0xa7d9b1);}(_0x7a54,0x106));var _0x47a5=function(_0x24b11f,_0x1a2321){_0x24b11f=_0x24b11f-0x0;var _0x55ad19=_0x7a54[_0x24b11f];return _0x55ad19;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0xe70f6c,_0x3b734d){var _0x29d959=function(_0x37c8d9){while(--_0x37c8d9){_0xe70f6c['push'](_0xe70f6c['shift']());}};_0x29d959(++_0x3b734d);}(_0x7a54,0x106));var _0x47a5=function(_0x3f46fa,_0x45e59c){_0x3f46fa=_0x3f46fa-0x0;var _0x5e8155=_0x7a54[_0x3f46fa];return _0x5e8155;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 027638c..51847ba 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 _0xb485=['exports','STRING','TEXT','sequelize'];(function(_0x1eda21,_0x1354d1){var _0x3d4604=function(_0x2266b2){while(--_0x2266b2){_0x1eda21['push'](_0x1eda21['shift']());}};_0x3d4604(++_0x1354d1);}(_0xb485,0x10b));var _0x5b48=function(_0x54b17b,_0xcac443){_0x54b17b=_0x54b17b-0x0;var _0x587335=_0xb485[_0x54b17b];return _0x587335;};'use strict';var Sequelize=require(_0x5b48('0x0'));module[_0x5b48('0x1')]={'uniqueid':{'type':Sequelize[_0x5b48('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x5b48('0x2')]},'data':{'type':Sequelize[_0x5b48('0x3')]},'project_name':{'type':Sequelize[_0x5b48('0x2')]},'callerid':{'type':Sequelize[_0x5b48('0x2')]}}; \ No newline at end of file +var _0x78d0=['exports','STRING','TEXT','sequelize'];(function(_0x5715e1,_0x5a5317){var _0x5d444a=function(_0x5901eb){while(--_0x5901eb){_0x5715e1['push'](_0x5715e1['shift']());}};_0x5d444a(++_0x5a5317);}(_0x78d0,0xf3));var _0x078d=function(_0x38d327,_0x171b0a){_0x38d327=_0x38d327-0x0;var _0xe600a1=_0x78d0[_0x38d327];return _0xe600a1;};'use strict';var Sequelize=require(_0x078d('0x0'));module[_0x078d('0x1')]={'uniqueid':{'type':Sequelize[_0x078d('0x2')]},'node':{'type':Sequelize[_0x078d('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x078d('0x3')]},'project_name':{'type':Sequelize[_0x078d('0x2')]},'callerid':{'type':Sequelize[_0x078d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 6bf7ec6..8b489c3 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 _0x0368=['keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','status','count','offset','limit','set','json','apply','reject','then','destroy','end','sendStatus','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query'];(function(_0xd80d70,_0x458ecd){var _0x3f44a0=function(_0x1c2bd3){while(--_0x1c2bd3){_0xd80d70['push'](_0xd80d70['shift']());}};_0x3f44a0(++_0x458ecd);}(_0x0368,0x192));var _0x8036=function(_0x3f9024,_0x48d0e5){_0x3f9024=_0x3f9024-0x0;var _0x3c931c=_0x0368[_0x3f9024];return _0x3c931c;};'use strict';var pdf=require(_0x8036('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8036('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8036('0x2'));var rp=require(_0x8036('0x3'));var moment=require(_0x8036('0x4'));var BPromise=require(_0x8036('0x5'));var Mustache=require(_0x8036('0x6'));var util=require(_0x8036('0x7'));var path=require('path');var sox=require(_0x8036('0x8'));var csv=require(_0x8036('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8036('0xa'));var squel=require(_0x8036('0xb'));var crypto=require('crypto');var jsforce=require(_0x8036('0xc'));var deskjs=require(_0x8036('0xd'));var toCsv=require(_0x8036('0x9'));var querystring=require(_0x8036('0xe'));var Papa=require(_0x8036('0xf'));var Redis=require(_0x8036('0x10'));var authService=require(_0x8036('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8036('0x12'));var hardwareService=require(_0x8036('0x13'));var logger=require(_0x8036('0x14'))(_0x8036('0x15'));var utils=require(_0x8036('0x16'));var config=require(_0x8036('0x17'));var db=require(_0x8036('0x18'))['db'];function respondWithStatusCode(_0x3dc44a,_0x521db5){_0x521db5=_0x521db5||0xcc;return function(_0x33ddf1){if(_0x33ddf1){return _0x3dc44a['sendStatus'](_0x521db5);}return _0x3dc44a[_0x8036('0x19')](_0x521db5)['end']();};}function respondWithResult(_0x28db40,_0x51be68){_0x51be68=_0x51be68||0xc8;return function(_0x671035){if(_0x671035){return _0x28db40['status'](_0x51be68)['json'](_0x671035);}};}function respondWithFilteredResult(_0x38e70e,_0x950cae){return function(_0x31f389){if(_0x31f389){var _0x1b617a=_0x31f389[_0x8036('0x1a')],_0x258d98=_0x950cae[_0x8036('0x1b')],_0x32e736=_0x950cae[_0x8036('0x1b')]+_0x950cae[_0x8036('0x1c')],_0x2bcaf5;if(_0x32e736>=_0x1b617a){_0x32e736=_0x1b617a;_0x2bcaf5=0xc8;}else{_0x2bcaf5=0xce;}_0x38e70e[_0x8036('0x19')](_0x2bcaf5);return _0x38e70e[_0x8036('0x1d')]('Content-Range',_0x258d98+'-'+_0x32e736+'/'+_0x1b617a)[_0x8036('0x1e')](_0x31f389);}return null;};}function patchUpdates(_0x3b1043){return function(_0x1da412){try{jsonpatch[_0x8036('0x1f')](_0x1da412,_0x3b1043,!![]);}catch(_0x3cfe5e){return BPromise[_0x8036('0x20')](_0x3cfe5e);}return _0x1da412['save']();};}function saveUpdates(_0x12199f,_0x103f39){return function(_0x5b674e){if(_0x5b674e){return _0x5b674e['update'](_0x12199f)[_0x8036('0x21')](function(_0x362949){return _0x362949;});}return null;};}function removeEntity(_0x59805b,_0x171b39){return function(_0x356248){if(_0x356248){return _0x356248[_0x8036('0x22')]()[_0x8036('0x21')](function(){_0x59805b[_0x8036('0x19')](0xcc)[_0x8036('0x23')]();});}};}function handleEntityNotFound(_0xf55b62,_0x8151f1){return function(_0x1f0e13){if(!_0x1f0e13){_0xf55b62[_0x8036('0x24')](0x194);}return _0x1f0e13;};}function handleError(_0x691729,_0x230af4){_0x230af4=_0x230af4||0x1f4;return function(_0x14e2b6){logger[_0x8036('0x25')](_0x14e2b6[_0x8036('0x26')]);if(_0x14e2b6[_0x8036('0x27')]){delete _0x14e2b6['name'];}_0x691729[_0x8036('0x19')](_0x230af4)['send'](_0x14e2b6);};}exports[_0x8036('0x28')]=function(_0x5d7e95,_0x292e85){var _0x43518f={},_0x52fff7={},_0x43e60d={'count':0x0,'rows':[]};var _0x25b348=_[_0x8036('0x29')](db[_0x8036('0x2a')][_0x8036('0x2b')],function(_0xdcf0d3){return{'name':_0xdcf0d3[_0x8036('0x2c')],'type':_0xdcf0d3[_0x8036('0x2d')][_0x8036('0x2e')]};});_0x52fff7['model']=_[_0x8036('0x29')](_0x25b348,_0x8036('0x27'));_0x52fff7[_0x8036('0x2f')]=_[_0x8036('0x30')](_0x5d7e95[_0x8036('0x2f')]);_0x52fff7['filters']=_[_0x8036('0x31')](_0x52fff7[_0x8036('0x32')],_0x52fff7[_0x8036('0x2f')]);_0x43518f[_0x8036('0x33')]=_[_0x8036('0x31')](_0x52fff7[_0x8036('0x32')],qs[_0x8036('0x34')](_0x5d7e95['query']['fields']));_0x43518f['attributes']=_0x43518f[_0x8036('0x33')][_0x8036('0x35')]?_0x43518f['attributes']:_0x52fff7[_0x8036('0x32')];if(!_0x5d7e95[_0x8036('0x2f')][_0x8036('0x36')]('nolimit')){_0x43518f[_0x8036('0x1c')]=qs[_0x8036('0x1c')](_0x5d7e95[_0x8036('0x2f')][_0x8036('0x1c')]);_0x43518f[_0x8036('0x1b')]=qs[_0x8036('0x1b')](_0x5d7e95[_0x8036('0x2f')][_0x8036('0x1b')]);}_0x43518f[_0x8036('0x37')]=qs[_0x8036('0x38')](_0x5d7e95[_0x8036('0x2f')]['sort']);_0x43518f['where']=qs[_0x8036('0x39')](_[_0x8036('0x3a')](_0x5d7e95[_0x8036('0x2f')],_0x52fff7[_0x8036('0x39')]),_0x25b348);if(_0x5d7e95[_0x8036('0x2f')][_0x8036('0x3b')]){_0x43518f[_0x8036('0x3c')]=_[_0x8036('0x3d')](_0x43518f[_0x8036('0x3c')],{'$or':_[_0x8036('0x29')](_0x25b348,function(_0x1c3366){if(_0x1c3366[_0x8036('0x2d')]!=='VIRTUAL'){var _0xc54ee3={};_0xc54ee3[_0x1c3366[_0x8036('0x27')]]={'$like':'%'+_0x5d7e95['query']['filter']+'%'};return _0xc54ee3;}})});}_0x43518f=_[_0x8036('0x3d')]({},_0x43518f,_0x5d7e95[_0x8036('0x3e')]);var _0x55db8a={'where':_0x43518f[_0x8036('0x3c')]};return db[_0x8036('0x2a')][_0x8036('0x1a')](_0x55db8a)[_0x8036('0x21')](function(_0x6e1b9b){_0x43e60d[_0x8036('0x1a')]=_0x6e1b9b;if(_0x5d7e95[_0x8036('0x2f')][_0x8036('0x3f')]){_0x43518f[_0x8036('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x8036('0x41')](_0x43518f);})[_0x8036('0x21')](function(_0x514c67){_0x43e60d[_0x8036('0x42')]=_0x514c67;return _0x43e60d;})['then'](respondWithFilteredResult(_0x292e85,_0x43518f))[_0x8036('0x43')](handleError(_0x292e85,null));};exports[_0x8036('0x44')]=function(_0x228e90,_0x452163){var _0xa59ef0={'raw':!![],'where':{'id':_0x228e90[_0x8036('0x45')]['id']}},_0x3d0719={};_0x3d0719[_0x8036('0x32')]=_[_0x8036('0x30')](db[_0x8036('0x2a')]['rawAttributes']);_0x3d0719['query']=_[_0x8036('0x30')](_0x228e90[_0x8036('0x2f')]);_0x3d0719['filters']=_[_0x8036('0x31')](_0x3d0719[_0x8036('0x32')],_0x3d0719['query']);_0xa59ef0[_0x8036('0x33')]=_[_0x8036('0x31')](_0x3d0719[_0x8036('0x32')],qs['fields'](_0x228e90[_0x8036('0x2f')][_0x8036('0x34')]));_0xa59ef0[_0x8036('0x33')]=_0xa59ef0['attributes'][_0x8036('0x35')]?_0xa59ef0[_0x8036('0x33')]:_0x3d0719[_0x8036('0x32')];if(_0x228e90['query'][_0x8036('0x3f')]){_0xa59ef0[_0x8036('0x40')]=[{'all':!![]}];}_0xa59ef0=_['merge']({},_0xa59ef0,_0x228e90[_0x8036('0x3e')]);return db[_0x8036('0x2a')][_0x8036('0x46')](_0xa59ef0)[_0x8036('0x21')](handleEntityNotFound(_0x452163,null))[_0x8036('0x21')](respondWithResult(_0x452163,null))[_0x8036('0x43')](handleError(_0x452163,null));};exports[_0x8036('0x47')]=function(_0x304537,_0x539e83){return db[_0x8036('0x2a')][_0x8036('0x47')](_0x304537['body'],{})[_0x8036('0x21')](respondWithResult(_0x539e83,0xc9))[_0x8036('0x43')](handleError(_0x539e83,null));};exports[_0x8036('0x48')]=function(_0x3f85be,_0x52c6eb){if(_0x3f85be['body']['id']){delete _0x3f85be[_0x8036('0x49')]['id'];}return db[_0x8036('0x2a')][_0x8036('0x46')]({'where':{'id':_0x3f85be[_0x8036('0x45')]['id']}})[_0x8036('0x21')](handleEntityNotFound(_0x52c6eb,null))[_0x8036('0x21')](saveUpdates(_0x3f85be[_0x8036('0x49')],null))[_0x8036('0x21')](respondWithResult(_0x52c6eb,null))['catch'](handleError(_0x52c6eb,null));};exports[_0x8036('0x22')]=function(_0x4afdc1,_0x1677fe){return db[_0x8036('0x2a')][_0x8036('0x46')]({'where':{'id':_0x4afdc1[_0x8036('0x45')]['id']}})[_0x8036('0x21')](handleEntityNotFound(_0x1677fe,null))[_0x8036('0x21')](removeEntity(_0x1677fe,null))[_0x8036('0x43')](handleError(_0x1677fe,null));};exports[_0x8036('0x4a')]=function(_0x4512a4,_0x466046){return db[_0x8036('0x2a')]['describe']()[_0x8036('0x21')](respondWithResult(_0x466046,null))['catch'](handleError(_0x466046,null));}; \ No newline at end of file +var _0x1aa1=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','SquareDetailsReport','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x440964,_0x56c481){var _0x4b5276=function(_0x467f3e){while(--_0x467f3e){_0x440964['push'](_0x440964['shift']());}};_0x4b5276(++_0x56c481);}(_0x1aa1,0x1aa));var _0x11aa=function(_0xfb08b5,_0x55c4ec){_0xfb08b5=_0xfb08b5-0x0;var _0x11f5a4=_0x1aa1[_0xfb08b5];return _0x11f5a4;};'use strict';var pdf=require(_0x11aa('0x0'));var emlformat=require(_0x11aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x11aa('0x2'));var jsonpatch=require(_0x11aa('0x3'));var rp=require(_0x11aa('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x11aa('0x5'));var util=require('util');var path=require('path');var sox=require(_0x11aa('0x6'));var csv=require(_0x11aa('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11aa('0x8'));var squel=require(_0x11aa('0x9'));var crypto=require(_0x11aa('0xa'));var jsforce=require(_0x11aa('0xb'));var deskjs=require(_0x11aa('0xc'));var toCsv=require(_0x11aa('0x7'));var querystring=require(_0x11aa('0xd'));var Papa=require(_0x11aa('0xe'));var Redis=require(_0x11aa('0xf'));var authService=require(_0x11aa('0x10'));var qs=require(_0x11aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11aa('0x12'));var logger=require(_0x11aa('0x13'))(_0x11aa('0x14'));var utils=require(_0x11aa('0x15'));var config=require(_0x11aa('0x16'));var db=require(_0x11aa('0x17'))['db'];function respondWithStatusCode(_0x1df424,_0x82fe8b){_0x82fe8b=_0x82fe8b||0xcc;return function(_0x22e23c){if(_0x22e23c){return _0x1df424[_0x11aa('0x18')](_0x82fe8b);}return _0x1df424[_0x11aa('0x19')](_0x82fe8b)[_0x11aa('0x1a')]();};}function respondWithResult(_0x28a929,_0x43641e){_0x43641e=_0x43641e||0xc8;return function(_0x3d3ef6){if(_0x3d3ef6){return _0x28a929[_0x11aa('0x19')](_0x43641e)[_0x11aa('0x1b')](_0x3d3ef6);}};}function respondWithFilteredResult(_0x50ba7e,_0x21020c){return function(_0x40a281){if(_0x40a281){var _0x4722e3=_0x40a281[_0x11aa('0x1c')],_0x1e18ce=_0x21020c[_0x11aa('0x1d')],_0x131b39=_0x21020c['offset']+_0x21020c[_0x11aa('0x1e')],_0x11013e;if(_0x131b39>=_0x4722e3){_0x131b39=_0x4722e3;_0x11013e=0xc8;}else{_0x11013e=0xce;}_0x50ba7e['status'](_0x11013e);return _0x50ba7e[_0x11aa('0x1f')](_0x11aa('0x20'),_0x1e18ce+'-'+_0x131b39+'/'+_0x4722e3)[_0x11aa('0x1b')](_0x40a281);}return null;};}function patchUpdates(_0x254e02){return function(_0x397869){try{jsonpatch['apply'](_0x397869,_0x254e02,!![]);}catch(_0x5ebfd9){return BPromise[_0x11aa('0x21')](_0x5ebfd9);}return _0x397869[_0x11aa('0x22')]();};}function saveUpdates(_0x32fdbc,_0x1001a9){return function(_0x3e2cd3){if(_0x3e2cd3){return _0x3e2cd3[_0x11aa('0x23')](_0x32fdbc)[_0x11aa('0x24')](function(_0x371806){return _0x371806;});}return null;};}function removeEntity(_0x1a71be,_0x52be92){return function(_0x55c56b){if(_0x55c56b){return _0x55c56b[_0x11aa('0x25')]()[_0x11aa('0x24')](function(){_0x1a71be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c960,_0x2609a9){return function(_0x343cbe){if(!_0x343cbe){_0x48c960[_0x11aa('0x18')](0x194);}return _0x343cbe;};}function handleError(_0x1681cd,_0x157972){_0x157972=_0x157972||0x1f4;return function(_0x6d63e3){logger[_0x11aa('0x26')](_0x6d63e3['stack']);if(_0x6d63e3[_0x11aa('0x27')]){delete _0x6d63e3[_0x11aa('0x27')];}_0x1681cd['status'](_0x157972)[_0x11aa('0x28')](_0x6d63e3);};}exports[_0x11aa('0x29')]=function(_0x424276,_0x13585a){var _0x12a04e={},_0x442273={},_0x1b8272={'count':0x0,'rows':[]};var _0x3d5608=_[_0x11aa('0x2a')](db['SquareDetailsReport']['rawAttributes'],function(_0x1fceb8){return{'name':_0x1fceb8[_0x11aa('0x2b')],'type':_0x1fceb8['type'][_0x11aa('0x2c')]};});_0x442273[_0x11aa('0x2d')]=_['map'](_0x3d5608,_0x11aa('0x27'));_0x442273[_0x11aa('0x2e')]=_[_0x11aa('0x2f')](_0x424276[_0x11aa('0x2e')]);_0x442273[_0x11aa('0x30')]=_[_0x11aa('0x31')](_0x442273[_0x11aa('0x2d')],_0x442273[_0x11aa('0x2e')]);_0x12a04e[_0x11aa('0x32')]=_[_0x11aa('0x31')](_0x442273[_0x11aa('0x2d')],qs[_0x11aa('0x33')](_0x424276[_0x11aa('0x2e')]['fields']));_0x12a04e[_0x11aa('0x32')]=_0x12a04e['attributes'][_0x11aa('0x34')]?_0x12a04e[_0x11aa('0x32')]:_0x442273[_0x11aa('0x2d')];if(!_0x424276[_0x11aa('0x2e')][_0x11aa('0x35')](_0x11aa('0x36'))){_0x12a04e[_0x11aa('0x1e')]=qs[_0x11aa('0x1e')](_0x424276[_0x11aa('0x2e')][_0x11aa('0x1e')]);_0x12a04e['offset']=qs[_0x11aa('0x1d')](_0x424276['query'][_0x11aa('0x1d')]);}_0x12a04e['order']=qs['sort'](_0x424276['query'][_0x11aa('0x37')]);_0x12a04e['where']=qs[_0x11aa('0x30')](_[_0x11aa('0x38')](_0x424276['query'],_0x442273['filters']),_0x3d5608);if(_0x424276['query']['filter']){_0x12a04e[_0x11aa('0x39')]=_[_0x11aa('0x3a')](_0x12a04e['where'],{'$or':_[_0x11aa('0x2a')](_0x3d5608,function(_0x539180){if(_0x539180[_0x11aa('0x3b')]!==_0x11aa('0x3c')){var _0x559896={};_0x559896[_0x539180[_0x11aa('0x27')]]={'$like':'%'+_0x424276[_0x11aa('0x2e')][_0x11aa('0x3d')]+'%'};return _0x559896;}})});}_0x12a04e=_[_0x11aa('0x3a')]({},_0x12a04e,_0x424276[_0x11aa('0x3e')]);var _0x1a13a1={'where':_0x12a04e[_0x11aa('0x39')]};return db[_0x11aa('0x3f')][_0x11aa('0x1c')](_0x1a13a1)['then'](function(_0x482aa3){_0x1b8272[_0x11aa('0x1c')]=_0x482aa3;if(_0x424276[_0x11aa('0x2e')]['includeAll']){_0x12a04e[_0x11aa('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x11aa('0x41')](_0x12a04e);})[_0x11aa('0x24')](function(_0x2dbb4e){_0x1b8272[_0x11aa('0x42')]=_0x2dbb4e;return _0x1b8272;})['then'](respondWithFilteredResult(_0x13585a,_0x12a04e))[_0x11aa('0x43')](handleError(_0x13585a,null));};exports['show']=function(_0x324c96,_0x596ad3){var _0x2c4baa={'raw':!![],'where':{'id':_0x324c96[_0x11aa('0x44')]['id']}},_0x3cded1={};_0x3cded1['model']=_[_0x11aa('0x2f')](db[_0x11aa('0x3f')][_0x11aa('0x45')]);_0x3cded1[_0x11aa('0x2e')]=_[_0x11aa('0x2f')](_0x324c96[_0x11aa('0x2e')]);_0x3cded1[_0x11aa('0x30')]=_[_0x11aa('0x31')](_0x3cded1[_0x11aa('0x2d')],_0x3cded1[_0x11aa('0x2e')]);_0x2c4baa[_0x11aa('0x32')]=_[_0x11aa('0x31')](_0x3cded1[_0x11aa('0x2d')],qs[_0x11aa('0x33')](_0x324c96['query'][_0x11aa('0x33')]));_0x2c4baa[_0x11aa('0x32')]=_0x2c4baa['attributes'][_0x11aa('0x34')]?_0x2c4baa[_0x11aa('0x32')]:_0x3cded1['model'];if(_0x324c96[_0x11aa('0x2e')]['includeAll']){_0x2c4baa['include']=[{'all':!![]}];}_0x2c4baa=_['merge']({},_0x2c4baa,_0x324c96[_0x11aa('0x3e')]);return db[_0x11aa('0x3f')][_0x11aa('0x46')](_0x2c4baa)[_0x11aa('0x24')](handleEntityNotFound(_0x596ad3,null))[_0x11aa('0x24')](respondWithResult(_0x596ad3,null))[_0x11aa('0x43')](handleError(_0x596ad3,null));};exports[_0x11aa('0x47')]=function(_0x5a506b,_0x593fbb){return db[_0x11aa('0x3f')][_0x11aa('0x47')](_0x5a506b['body'],{})[_0x11aa('0x24')](respondWithResult(_0x593fbb,0xc9))[_0x11aa('0x43')](handleError(_0x593fbb,null));};exports[_0x11aa('0x23')]=function(_0x277bf8,_0x53ff10){if(_0x277bf8[_0x11aa('0x48')]['id']){delete _0x277bf8[_0x11aa('0x48')]['id'];}return db[_0x11aa('0x3f')][_0x11aa('0x46')]({'where':{'id':_0x277bf8[_0x11aa('0x44')]['id']}})[_0x11aa('0x24')](handleEntityNotFound(_0x53ff10,null))[_0x11aa('0x24')](saveUpdates(_0x277bf8[_0x11aa('0x48')],null))['then'](respondWithResult(_0x53ff10,null))['catch'](handleError(_0x53ff10,null));};exports[_0x11aa('0x25')]=function(_0x2ca5dc,_0x28fee6){return db[_0x11aa('0x3f')][_0x11aa('0x46')]({'where':{'id':_0x2ca5dc[_0x11aa('0x44')]['id']}})[_0x11aa('0x24')](handleEntityNotFound(_0x28fee6,null))[_0x11aa('0x24')](removeEntity(_0x28fee6,null))[_0x11aa('0x43')](handleError(_0x28fee6,null));};exports[_0x11aa('0x49')]=function(_0x2d7d8e,_0x248d87){return db[_0x11aa('0x3f')]['describe']()['then'](respondWithResult(_0x248d87,null))[_0x11aa('0x43')](handleError(_0x248d87,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ad6b8ce..c457a75 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 _0x3930=['SquareDetailsReport','report_square_details','util','api','bluebird','path','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x22f27d,_0x6da65){var _0xdf5414=function(_0x423c3a){while(--_0x423c3a){_0x22f27d['push'](_0x22f27d['shift']());}};_0xdf5414(++_0x6da65);}(_0x3930,0x12e));var _0x0393=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0x3930[_0x2e2104];return _0x1280c5;};'use strict';var _=require('lodash');var util=require(_0x0393('0x0'));var logger=require('../../config/logger')(_0x0393('0x1'));var moment=require('moment');var BPromise=require(_0x0393('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0393('0x3'));var rimraf=require('rimraf');var config=require(_0x0393('0x4'));var attributes=require(_0x0393('0x5'));module[_0x0393('0x6')]=function(_0x1f7355,_0x5ec92d){return _0x1f7355[_0x0393('0x7')](_0x0393('0x8'),attributes,{'tableName':_0x0393('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63ea=['../../config/logger','api','moment','bluebird','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x63ea,0x113));var _0xa63e=function(_0x4c7878,_0x58d515){_0x4c7878=_0x4c7878-0x0;var _0x249c40=_0x63ea[_0x4c7878];return _0x249c40;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa63e('0x0'))(_0xa63e('0x1'));var moment=require(_0xa63e('0x2'));var BPromise=require(_0xa63e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa63e('0x4'));var rimraf=require('rimraf');var config=require(_0xa63e('0x5'));var attributes=require(_0xa63e('0x6'));module[_0xa63e('0x7')]=function(_0x579e39,_0x1457fc){return _0x579e39[_0xa63e('0x8')](_0xa63e('0x9'),attributes,{'tableName':_0xa63e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index b483b0a..e8c0f6c 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 _0x1e64=['debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x336979,_0x391d4c){var _0x18c16d=function(_0x6884b){while(--_0x6884b){_0x336979['push'](_0x336979['shift']());}};_0x18c16d(++_0x391d4c);}(_0x1e64,0x10a));var _0x41e6=function(_0x39b601,_0x2abb42){_0x39b601=_0x39b601-0x0;var _0x214a01=_0x1e64[_0x39b601];return _0x214a01;};'use strict';var _=require(_0x41e6('0x0'));var util=require(_0x41e6('0x1'));var moment=require('moment');var BPromise=require(_0x41e6('0x2'));var rs=require(_0x41e6('0x3'));var fs=require('fs');var Redis=require(_0x41e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x41e6('0x5'))(_0x41e6('0x6'));var config=require(_0x41e6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x41e6('0x8')][_0x41e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38e823,_0x2a6495,_0x55a5ff){return new BPromise(function(_0x445547,_0x42beaf){return client[_0x41e6('0xa')](_0x38e823,_0x55a5ff)[_0x41e6('0xb')](function(_0x1b5c9d){logger[_0x41e6('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a6495,_0x41e6('0xd'));logger[_0x41e6('0xe')](_0x41e6('0xf'),_0x2a6495,'request\x20sent',JSON[_0x41e6('0x10')](_0x1b5c9d));if(_0x1b5c9d['error']){if(_0x1b5c9d[_0x41e6('0x11')][_0x41e6('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2a6495,_0x1b5c9d[_0x41e6('0x11')]['message']);return _0x42beaf(_0x1b5c9d[_0x41e6('0x11')][_0x41e6('0x13')]);}logger[_0x41e6('0x11')](_0x41e6('0x14'),_0x2a6495,_0x1b5c9d[_0x41e6('0x11')][_0x41e6('0x13')]);return _0x445547(_0x1b5c9d[_0x41e6('0x11')][_0x41e6('0x13')]);}else{logger[_0x41e6('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a6495,'request\x20sent');_0x445547(_0x1b5c9d[_0x41e6('0x15')]['message']);}})[_0x41e6('0x16')](function(_0x2542d8){logger[_0x41e6('0x11')](_0x41e6('0x14'),_0x2a6495,_0x2542d8);_0x42beaf(_0x2542d8);});});}exports[_0x41e6('0x17')]=function(_0x35cd48){var _0x22f87a=this;return new Promise(function(_0x10ab1c,_0x163510){return db['SquareDetailsReport'][_0x41e6('0x18')](_0x35cd48[_0x41e6('0x19')],{'raw':_0x35cd48[_0x41e6('0x1a')]?_0x35cd48[_0x41e6('0x1a')][_0x41e6('0x1b')]===undefined?!![]:![]:!![]})[_0x41e6('0xb')](function(_0x3beffa){logger['info']('CreateSquareDetailsReport',_0x35cd48);logger['debug'](_0x41e6('0x17'),_0x35cd48,JSON[_0x41e6('0x10')](_0x3beffa));_0x10ab1c(_0x3beffa);})[_0x41e6('0x16')](function(_0x387c77){logger[_0x41e6('0x11')]('CreateSquareDetailsReport',_0x387c77['message'],_0x35cd48);_0x163510(_0x22f87a['error'](0x1f4,_0x387c77[_0x41e6('0x13')]));});});}; \ No newline at end of file +var _0xabf6=['options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0x3bcb2c,_0x3f3595){var _0x2d2b5f=function(_0xec8a29){while(--_0xec8a29){_0x3bcb2c['push'](_0x3bcb2c['shift']());}};_0x2d2b5f(++_0x3f3595);}(_0xabf6,0x1aa));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6abf('0x0'));var util=require('util');var moment=require(_0x6abf('0x1'));var BPromise=require(_0x6abf('0x2'));var rs=require(_0x6abf('0x3'));var fs=require('fs');var Redis=require(_0x6abf('0x4'));var db=require(_0x6abf('0x5'))['db'];var utils=require(_0x6abf('0x6'));var logger=require(_0x6abf('0x7'))('rpc');var config=require(_0x6abf('0x8'));var jayson=require(_0x6abf('0x9'));var client=jayson[_0x6abf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c5143,_0xc3fea1,_0x327b22){return new BPromise(function(_0x285ca2,_0x3848b7){return client[_0x6abf('0xb')](_0x2c5143,_0x327b22)[_0x6abf('0xc')](function(_0x19db38){logger[_0x6abf('0xd')](_0x6abf('0xe'),_0xc3fea1,'request\x20sent');logger[_0x6abf('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xc3fea1,'request\x20sent',JSON[_0x6abf('0x10')](_0x19db38));if(_0x19db38[_0x6abf('0x11')]){if(_0x19db38['error']['code']===0x1f4){logger[_0x6abf('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0xc3fea1,_0x19db38[_0x6abf('0x11')][_0x6abf('0x12')]);return _0x3848b7(_0x19db38[_0x6abf('0x11')]['message']);}logger[_0x6abf('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0xc3fea1,_0x19db38['error'][_0x6abf('0x12')]);return _0x285ca2(_0x19db38[_0x6abf('0x11')][_0x6abf('0x12')]);}else{logger[_0x6abf('0xd')](_0x6abf('0xe'),_0xc3fea1,'request\x20sent');_0x285ca2(_0x19db38[_0x6abf('0x13')][_0x6abf('0x12')]);}})['catch'](function(_0x2473f2){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xc3fea1,_0x2473f2);_0x3848b7(_0x2473f2);});});}exports[_0x6abf('0x14')]=function(_0x5396ee){var _0x4eb922=this;return new Promise(function(_0x19c5ff,_0x8f5762){return db[_0x6abf('0x15')][_0x6abf('0x16')](_0x5396ee[_0x6abf('0x17')],{'raw':_0x5396ee[_0x6abf('0x18')]?_0x5396ee[_0x6abf('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6abf('0xc')](function(_0x4b3049){logger[_0x6abf('0xd')](_0x6abf('0x14'),_0x5396ee);logger[_0x6abf('0xf')]('CreateSquareDetailsReport',_0x5396ee,JSON[_0x6abf('0x10')](_0x4b3049));_0x19c5ff(_0x4b3049);})['catch'](function(_0x111039){logger[_0x6abf('0x11')](_0x6abf('0x14'),_0x111039[_0x6abf('0x12')],_0x5396ee);_0x8f5762(_0x4eb922[_0x6abf('0x11')](0x1f4,_0x111039[_0x6abf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 6cdf00a..0369d08 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 _0xd13e=['../../components/auth/service','./system.controller','isAuthenticated','get','killProcess','exports','express','Router'];(function(_0x53004e,_0x2b8afa){var _0x53b4f6=function(_0x4d5555){while(--_0x4d5555){_0x53004e['push'](_0x53004e['shift']());}};_0x53b4f6(++_0x2b8afa);}(_0xd13e,0x15e));var _0xed13=function(_0x408ec7,_0x56efdd){_0x408ec7=_0x408ec7-0x0;var _0x3815fd=_0xd13e[_0x408ec7];return _0x3815fd;};'use strict';var express=require(_0xed13('0x0'));var router=express[_0xed13('0x1')]();var auth=require(_0xed13('0x2'));var controller=require(_0xed13('0x3'));router['get']('/',auth[_0xed13('0x4')](),controller['index']);router[_0xed13('0x5')]('/process/:pid/kill',auth[_0xed13('0x4')](),controller[_0xed13('0x6')]);module[_0xed13('0x7')]=router; \ No newline at end of file +var _0x0bc6=['isAuthenticated','/process/:pid/kill','killProcess','exports','Router','./system.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0bc6,0x138));var _0x60bc=function(_0x280f81,_0x471370){_0x280f81=_0x280f81-0x0;var _0x336c8d=_0x0bc6[_0x280f81];return _0x336c8d;};'use strict';var express=require('express');var router=express[_0x60bc('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x60bc('0x1'));router[_0x60bc('0x2')]('/',auth[_0x60bc('0x3')](),controller['index']);router[_0x60bc('0x2')](_0x60bc('0x4'),auth[_0x60bc('0x3')](),controller[_0x60bc('0x5')]);module[_0x60bc('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index e1756dd..90e8a03 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 _0xdd45=['then','json','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xdd45,0x16b));var _0x5dd4=function(_0x5efa0d,_0x23e8e5){_0x5efa0d=_0x5efa0d-0x0;var _0x197353=_0xdd45[_0x5efa0d];return _0x197353;};'use strict';var info=require('systeminformation');var exec=require(_0x5dd4('0x0'))[_0x5dd4('0x1')];var logger=require('../../config/logger')(_0x5dd4('0x2'));var util=require(_0x5dd4('0x3'));var BPromise=require(_0x5dd4('0x4'));var _=require('lodash');function handleError(_0xde91d2,_0x1eed4e,_0x465f80){_0x1eed4e=_0x1eed4e||0x1f4;return function(_0x4f5a0c){logger[_0x5dd4('0x5')](_0x5dd4('0x6'),_0x465f80,_0x1eed4e,util[_0x5dd4('0x7')](_0x4f5a0c,{'showHidden':![],'depth':null}));delete _0x4f5a0c[_0x5dd4('0x8')];_0xde91d2[_0x5dd4('0x9')](_0x1eed4e)[_0x5dd4('0xa')](_0x4f5a0c);};}exports['index']=function(_0x190120,_0x402c32){return info[_0x5dd4('0xb')]()[_0x5dd4('0xc')](function(_0x33cef3){return _0x402c32[_0x5dd4('0x9')](0xc8)[_0x5dd4('0xd')](_0x33cef3);})['catch'](function(_0x1ee608){return _0x402c32[_0x5dd4('0x9')](0x1f4)[_0x5dd4('0xd')](_0x1ee608);});};exports[_0x5dd4('0xe')]=function(_0x4cf528,_0x2815e3){var _0x4797ca=['components/import/cm'];return new BPromise(function(_0x42ede2,_0xc77da3){return exec(util['format'](_0x5dd4('0xf'),_0x4cf528[_0x5dd4('0x10')][_0x5dd4('0x11')]),function(_0x1cc7f3,_0x35fba9,_0x3a021f){if(_0x1cc7f3){return _0xc77da3(_0x1cc7f3);}return _0x42ede2(_0x35fba9);});})[_0x5dd4('0xc')](function(_0x359e77){var _0xa78efb=![];var _0x5e1c32=_0x359e77[_0x5dd4('0x12')](/\n/);for(var _0x43aeb9=0x0,_0x31d0d6=_0x4797ca['length'];_0x43aeb9<_0x31d0d6,_0xa78efb===![];_0x43aeb9+=0x1){if(_0x359e77[_0x5dd4('0x13')](_0x4797ca[_0x43aeb9])>=0x0){_0xa78efb=!![];}}if(!_0xa78efb){throw new Error(util[_0x5dd4('0x14')](_0x5dd4('0x15'),_0x4cf528[_0x5dd4('0x10')][_0x5dd4('0x11')]));}process[_0x5dd4('0x16')](_0x4cf528[_0x5dd4('0x10')][_0x5dd4('0x11')],_0x5dd4('0x17'));return _0x2815e3[_0x5dd4('0x9')](0xc8)['json']({'message':util[_0x5dd4('0x14')](_0x5dd4('0x18'),_0x4cf528[_0x5dd4('0x10')][_0x5dd4('0x11')])});})['catch'](handleError(_0x2815e3,null,_0x5dd4('0xe')));}; \ No newline at end of file +var _0x4a38=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format'];(function(_0x2374d7,_0x27d30e){var _0x37775d=function(_0x575fa6){while(--_0x575fa6){_0x2374d7['push'](_0x2374d7['shift']());}};_0x37775d(++_0x27d30e);}(_0x4a38,0x1de));var _0x84a3=function(_0x20c3e6,_0x4d93e0){_0x20c3e6=_0x20c3e6-0x0;var _0x4bc81a=_0x4a38[_0x20c3e6];return _0x4bc81a;};'use strict';var info=require(_0x84a3('0x0'));var exec=require(_0x84a3('0x1'))['exec'];var logger=require(_0x84a3('0x2'))('api');var util=require(_0x84a3('0x3'));var BPromise=require('bluebird');var _=require(_0x84a3('0x4'));function handleError(_0x34b981,_0x4d4b98,_0x383779){_0x4d4b98=_0x4d4b98||0x1f4;return function(_0x2e1489){logger['error'](_0x84a3('0x5'),_0x383779,_0x4d4b98,util[_0x84a3('0x6')](_0x2e1489,{'showHidden':![],'depth':null}));delete _0x2e1489['name'];_0x34b981[_0x84a3('0x7')](_0x4d4b98)[_0x84a3('0x8')](_0x2e1489);};}exports[_0x84a3('0x9')]=function(_0x428ae6,_0x31807f){return info[_0x84a3('0xa')]()['then'](function(_0x2f3bda){return _0x31807f[_0x84a3('0x7')](0xc8)[_0x84a3('0xb')](_0x2f3bda);})[_0x84a3('0xc')](function(_0x11afac){return _0x31807f[_0x84a3('0x7')](0x1f4)[_0x84a3('0xb')](_0x11afac);});};exports[_0x84a3('0xd')]=function(_0x57d7a1,_0x5abf62){var _0x23c61a=[_0x84a3('0xe')];return new BPromise(function(_0x50c247,_0x3b8863){return exec(util[_0x84a3('0xf')](_0x84a3('0x10'),_0x57d7a1[_0x84a3('0x11')]['pid']),function(_0x10fcf0,_0x503ff6,_0x5158b4){if(_0x10fcf0){return _0x3b8863(_0x10fcf0);}return _0x50c247(_0x503ff6);});})[_0x84a3('0x12')](function(_0x2ae2d8){var _0x57cf7a=![];var _0x48ba3d=_0x2ae2d8[_0x84a3('0x13')](/\n/);for(var _0x48e73d=0x0,_0xda995e=_0x23c61a[_0x84a3('0x14')];_0x48e73d<_0xda995e,_0x57cf7a===![];_0x48e73d+=0x1){if(_0x2ae2d8[_0x84a3('0x15')](_0x23c61a[_0x48e73d])>=0x0){_0x57cf7a=!![];}}if(!_0x57cf7a){throw new Error(util['format'](_0x84a3('0x16'),_0x57d7a1[_0x84a3('0x11')][_0x84a3('0x17')]));}process['kill'](_0x57d7a1['params'][_0x84a3('0x17')],_0x84a3('0x18'));return _0x5abf62[_0x84a3('0x7')](0xc8)[_0x84a3('0xb')]({'message':util[_0x84a3('0xf')](_0x84a3('0x19'),_0x57d7a1[_0x84a3('0x11')][_0x84a3('0x17')])});})['catch'](handleError(_0x5abf62,null,_0x84a3('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d7e9b08..66da645 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 _0x54ef=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','/:id'];(function(_0x3f099c,_0x35350e){var _0x2df824=function(_0x25ee78){while(--_0x25ee78){_0x3f099c['push'](_0x3f099c['shift']());}};_0x2df824(++_0x35350e);}(_0x54ef,0x112));var _0xf54e=function(_0x2b5a22,_0x5659fd){_0x2b5a22=_0x2b5a22-0x0;var _0x35b8d1=_0x54ef[_0x2b5a22];return _0x35b8d1;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var auth=require(_0xf54e('0x5'));var interaction=require(_0xf54e('0x6'));var config=require(_0xf54e('0x7'));var controller=require(_0xf54e('0x8'));router[_0xf54e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf54e('0x9')](_0xf54e('0xa'),auth[_0xf54e('0xb')](),controller['show']);router[_0xf54e('0xc')]('/',auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router[_0xf54e('0xe')]('/:id',auth[_0xf54e('0xb')](),controller[_0xf54e('0xf')]);router[_0xf54e('0x10')](_0xf54e('0xa'),auth['isAuthenticated'](),controller[_0xf54e('0x11')]);module[_0xf54e('0x12')]=router; \ No newline at end of file +var _0x702d=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get','/:id','post','create','put'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x702d,0x147));var _0xd702=function(_0x287810,_0xc519d){_0x287810=_0x287810-0x0;var _0x480e27=_0x702d[_0x287810];return _0x480e27;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var auth=require(_0xd702('0x5'));var interaction=require(_0xd702('0x6'));var config=require(_0xd702('0x7'));var controller=require(_0xd702('0x8'));router['get']('/',auth[_0xd702('0x9')](),controller['index']);router[_0xd702('0xa')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller['show']);router[_0xd702('0xc')]('/',auth['isAuthenticated'](),controller[_0xd702('0xd')]);router[_0xd702('0xe')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller[_0xd702('0x11')]);module[_0xd702('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index df2c859..bd99fe7 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 _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0x54603a,_0x199824){var _0x467b1d=function(_0x567ba3){while(--_0x567ba3){_0x54603a['push'](_0x54603a['shift']());}};_0x467b1d(++_0x199824);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file +var _0x5eb8=['name','#0091EA','STRING'];(function(_0xdf0b8,_0x15bda2){var _0x130c5a=function(_0x2b8acc){while(--_0x2b8acc){_0xdf0b8['push'](_0xdf0b8['shift']());}};_0x130c5a(++_0x15bda2);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x5eb8[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 57db955..0061e51 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 _0xc548=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','show','params','include','options','find','catch','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','Content-Range','apply','reject','then','destroy','get','Tags','UserProfileResource','end','error','stack','name','send','index','Tag','rawAttributes','type','key','model','map'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xc548,0x16d));var _0x8c54=function(_0x27a33f,_0x2745ae){_0x27a33f=_0x27a33f-0x0;var _0x3bf351=_0xc548[_0x27a33f];return _0x3bf351;};'use strict';var pdf=require(_0x8c54('0x0'));var emlformat=require(_0x8c54('0x1'));var rimraf=require(_0x8c54('0x2'));var zipdir=require(_0x8c54('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c54('0x4'));var moment=require('moment');var BPromise=require(_0x8c54('0x5'));var Mustache=require(_0x8c54('0x6'));var util=require('util');var path=require(_0x8c54('0x7'));var sox=require(_0x8c54('0x8'));var csv=require(_0x8c54('0x9'));var ejs=require(_0x8c54('0xa'));var fs=require('fs');var _=require(_0x8c54('0xb'));var squel=require(_0x8c54('0xc'));var crypto=require(_0x8c54('0xd'));var jsforce=require(_0x8c54('0xe'));var deskjs=require(_0x8c54('0xf'));var toCsv=require(_0x8c54('0x9'));var querystring=require(_0x8c54('0x10'));var Papa=require(_0x8c54('0x11'));var Redis=require(_0x8c54('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8c54('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c54('0x14'));var logger=require(_0x8c54('0x15'))(_0x8c54('0x16'));var utils=require(_0x8c54('0x17'));var config=require(_0x8c54('0x18'));var db=require(_0x8c54('0x19'))['db'];function respondWithStatusCode(_0x14d9ae,_0x466546){_0x466546=_0x466546||0xcc;return function(_0x2efdc6){if(_0x2efdc6){return _0x14d9ae[_0x8c54('0x1a')](_0x466546);}return _0x14d9ae[_0x8c54('0x1b')](_0x466546)['end']();};}function respondWithResult(_0xb52e5,_0x1c79ec){_0x1c79ec=_0x1c79ec||0xc8;return function(_0x3b21cd){if(_0x3b21cd){return _0xb52e5[_0x8c54('0x1b')](_0x1c79ec)[_0x8c54('0x1c')](_0x3b21cd);}};}function respondWithFilteredResult(_0x62a028,_0x231953){return function(_0x3d3036){if(_0x3d3036){var _0x3d0c61=_0x3d3036['count'],_0x54fa98=_0x231953[_0x8c54('0x1d')],_0x43b474=_0x231953['offset']+_0x231953['limit'],_0x124817;if(_0x43b474>=_0x3d0c61){_0x43b474=_0x3d0c61;_0x124817=0xc8;}else{_0x124817=0xce;}_0x62a028[_0x8c54('0x1b')](_0x124817);return _0x62a028['set'](_0x8c54('0x1e'),_0x54fa98+'-'+_0x43b474+'/'+_0x3d0c61)['json'](_0x3d3036);}return null;};}function patchUpdates(_0x32e6c1){return function(_0x5658c4){try{jsonpatch[_0x8c54('0x1f')](_0x5658c4,_0x32e6c1,!![]);}catch(_0x4062f7){return BPromise[_0x8c54('0x20')](_0x4062f7);}return _0x5658c4['save']();};}function saveUpdates(_0x3b2f9e,_0x13b18c){return function(_0x5173b4){if(_0x5173b4){return _0x5173b4['update'](_0x3b2f9e)[_0x8c54('0x21')](function(_0x4de59f){return _0x4de59f;});}return null;};}function removeEntity(_0x122abf,_0x5ae47c){return function(_0x26f72){if(_0x26f72){return _0x26f72[_0x8c54('0x22')]()['then'](function(){var _0x56b552=_0x26f72[_0x8c54('0x23')]({'plain':!![]});var _0x30f30b=_0x8c54('0x24');return db[_0x8c54('0x25')][_0x8c54('0x22')]({'where':{'type':_0x30f30b,'resourceId':_0x56b552['id']}})[_0x8c54('0x21')](function(){return _0x26f72;});})[_0x8c54('0x21')](function(){_0x122abf[_0x8c54('0x1b')](0xcc)[_0x8c54('0x26')]();});}};}function handleEntityNotFound(_0x4de5db,_0x1b95ad){return function(_0x1f3606){if(!_0x1f3606){_0x4de5db[_0x8c54('0x1a')](0x194);}return _0x1f3606;};}function handleError(_0x10a847,_0xf40a99){_0xf40a99=_0xf40a99||0x1f4;return function(_0x1d8a1d){logger[_0x8c54('0x27')](_0x1d8a1d[_0x8c54('0x28')]);if(_0x1d8a1d[_0x8c54('0x29')]){delete _0x1d8a1d[_0x8c54('0x29')];}_0x10a847['status'](_0xf40a99)[_0x8c54('0x2a')](_0x1d8a1d);};}exports[_0x8c54('0x2b')]=function(_0x530425,_0x2122fe){var _0x40b7ea={},_0x2f0307={},_0x5b67a0={'count':0x0,'rows':[]};var _0x56bc9b=_['map'](db[_0x8c54('0x2c')][_0x8c54('0x2d')],function(_0x547d75){return{'name':_0x547d75['fieldName'],'type':_0x547d75[_0x8c54('0x2e')][_0x8c54('0x2f')]};});_0x2f0307[_0x8c54('0x30')]=_[_0x8c54('0x31')](_0x56bc9b,_0x8c54('0x29'));_0x2f0307['query']=_[_0x8c54('0x32')](_0x530425[_0x8c54('0x33')]);_0x2f0307[_0x8c54('0x34')]=_[_0x8c54('0x35')](_0x2f0307[_0x8c54('0x30')],_0x2f0307[_0x8c54('0x33')]);_0x40b7ea[_0x8c54('0x36')]=_[_0x8c54('0x35')](_0x2f0307[_0x8c54('0x30')],qs['fields'](_0x530425[_0x8c54('0x33')][_0x8c54('0x37')]));_0x40b7ea[_0x8c54('0x36')]=_0x40b7ea[_0x8c54('0x36')][_0x8c54('0x38')]?_0x40b7ea[_0x8c54('0x36')]:_0x2f0307['model'];if(!_0x530425[_0x8c54('0x33')][_0x8c54('0x39')]('nolimit')){_0x40b7ea[_0x8c54('0x3a')]=qs[_0x8c54('0x3a')](_0x530425[_0x8c54('0x33')][_0x8c54('0x3a')]);_0x40b7ea[_0x8c54('0x1d')]=qs['offset'](_0x530425['query'][_0x8c54('0x1d')]);}_0x40b7ea[_0x8c54('0x3b')]=qs[_0x8c54('0x3c')](_0x530425['query'][_0x8c54('0x3c')]);_0x40b7ea[_0x8c54('0x3d')]=qs[_0x8c54('0x34')](_[_0x8c54('0x3e')](_0x530425[_0x8c54('0x33')],_0x2f0307[_0x8c54('0x34')]),_0x56bc9b);if(_0x530425[_0x8c54('0x33')][_0x8c54('0x3f')]){_0x40b7ea[_0x8c54('0x3d')]=_[_0x8c54('0x40')](_0x40b7ea[_0x8c54('0x3d')],{'$or':_[_0x8c54('0x31')](_0x56bc9b,function(_0x1925c3){if(_0x1925c3[_0x8c54('0x2e')]!==_0x8c54('0x41')){var _0x1abfc7={};_0x1abfc7[_0x1925c3[_0x8c54('0x29')]]={'$like':'%'+_0x530425[_0x8c54('0x33')][_0x8c54('0x3f')]+'%'};return _0x1abfc7;}})});}_0x40b7ea=_[_0x8c54('0x40')]({},_0x40b7ea,_0x530425['options']);var _0x5daf2b={'where':_0x40b7ea[_0x8c54('0x3d')]};return db[_0x8c54('0x2c')][_0x8c54('0x42')](_0x5daf2b)['then'](function(_0x49978f){_0x5b67a0[_0x8c54('0x42')]=_0x49978f;if(_0x530425[_0x8c54('0x33')][_0x8c54('0x43')]){_0x40b7ea['include']=[{'all':!![]}];}return db[_0x8c54('0x2c')][_0x8c54('0x44')](_0x40b7ea);})[_0x8c54('0x21')](function(_0x7b4bbc){_0x5b67a0['rows']=_0x7b4bbc;return _0x5b67a0;})['then'](respondWithFilteredResult(_0x2122fe,_0x40b7ea))['catch'](handleError(_0x2122fe,null));};exports[_0x8c54('0x45')]=function(_0x49f3d7,_0x200d5e){var _0x351bae={'raw':!![],'where':{'id':_0x49f3d7[_0x8c54('0x46')]['id']}},_0x91c32c={};_0x91c32c[_0x8c54('0x30')]=_[_0x8c54('0x32')](db[_0x8c54('0x2c')][_0x8c54('0x2d')]);_0x91c32c['query']=_[_0x8c54('0x32')](_0x49f3d7[_0x8c54('0x33')]);_0x91c32c[_0x8c54('0x34')]=_[_0x8c54('0x35')](_0x91c32c['model'],_0x91c32c[_0x8c54('0x33')]);_0x351bae[_0x8c54('0x36')]=_['intersection'](_0x91c32c[_0x8c54('0x30')],qs[_0x8c54('0x37')](_0x49f3d7[_0x8c54('0x33')][_0x8c54('0x37')]));_0x351bae[_0x8c54('0x36')]=_0x351bae[_0x8c54('0x36')][_0x8c54('0x38')]?_0x351bae[_0x8c54('0x36')]:_0x91c32c['model'];if(_0x49f3d7[_0x8c54('0x33')][_0x8c54('0x43')]){_0x351bae[_0x8c54('0x47')]=[{'all':!![]}];}_0x351bae=_[_0x8c54('0x40')]({},_0x351bae,_0x49f3d7[_0x8c54('0x48')]);return db[_0x8c54('0x2c')][_0x8c54('0x49')](_0x351bae)[_0x8c54('0x21')](handleEntityNotFound(_0x200d5e,null))[_0x8c54('0x21')](respondWithResult(_0x200d5e,null))[_0x8c54('0x4a')](handleError(_0x200d5e,null));};exports[_0x8c54('0x4b')]=function(_0x1014f6,_0x51fb0a){return db[_0x8c54('0x2c')][_0x8c54('0x4b')](_0x1014f6['body'],{})[_0x8c54('0x21')](function(_0x1e1dda){var _0x2daf80=_0x1014f6[_0x8c54('0x4c')]['get']({'plain':!![]});if(!_0x2daf80)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2daf80[_0x8c54('0x4d')]===_0x8c54('0x4c')){var _0x28fc88=_0x1e1dda[_0x8c54('0x23')]({'plain':!![]});var _0x3740d4=_0x8c54('0x24');return db[_0x8c54('0x4e')][_0x8c54('0x49')]({'where':{'name':_0x3740d4,'userProfileId':_0x2daf80['userProfileId']},'raw':!![]})['then'](function(_0x117168){if(_0x117168&&_0x117168[_0x8c54('0x4f')]===0x0){return db[_0x8c54('0x25')][_0x8c54('0x4b')]({'name':_0x28fc88['name'],'resourceId':_0x28fc88['id'],'type':_0x117168[_0x8c54('0x29')],'sectionId':_0x117168['id']},{})[_0x8c54('0x21')](function(){return _0x1e1dda;});}else{return _0x1e1dda;}})[_0x8c54('0x4a')](function(_0x10a38e){logger['error'](_0x8c54('0x50'),_0x10a38e);throw _0x10a38e;});}return _0x1e1dda;})['then'](respondWithResult(_0x51fb0a,0xc9))[_0x8c54('0x4a')](handleError(_0x51fb0a,null));};exports[_0x8c54('0x51')]=function(_0xf8026e,_0x82a029){if(_0xf8026e[_0x8c54('0x52')]['id']){delete _0xf8026e['body']['id'];}return db[_0x8c54('0x2c')][_0x8c54('0x49')]({'where':{'id':_0xf8026e[_0x8c54('0x46')]['id']}})[_0x8c54('0x21')](handleEntityNotFound(_0x82a029,null))[_0x8c54('0x21')](saveUpdates(_0xf8026e[_0x8c54('0x52')],null))['then'](respondWithResult(_0x82a029,null))['catch'](handleError(_0x82a029,null));};exports[_0x8c54('0x22')]=function(_0x55771f,_0x2900ad){return db[_0x8c54('0x2c')][_0x8c54('0x49')]({'where':{'id':_0x55771f[_0x8c54('0x46')]['id']}})[_0x8c54('0x21')](handleEntityNotFound(_0x2900ad,null))['then'](removeEntity(_0x2900ad,null))[_0x8c54('0x4a')](handleError(_0x2900ad,null));}; \ No newline at end of file +var _0x08d9=['sendStatus','status','count','offset','limit','set','Content-Range','json','then','get','Tags','UserProfileResource','destroy','end','error','stack','send','index','Tag','fieldName','type','key','model','map','name','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','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','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0xef8fab,_0x13938e){var _0x1fc438=function(_0x49f6b9){while(--_0x49f6b9){_0xef8fab['push'](_0xef8fab['shift']());}};_0x1fc438(++_0x13938e);}(_0x08d9,0x12b));var _0x908d=function(_0x3692da,_0x279d7e){_0x3692da=_0x3692da-0x0;var _0x4e6648=_0x08d9[_0x3692da];return _0x4e6648;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x908d('0x0'));var rimraf=require(_0x908d('0x1'));var zipdir=require(_0x908d('0x2'));var jsonpatch=require(_0x908d('0x3'));var rp=require(_0x908d('0x4'));var moment=require(_0x908d('0x5'));var BPromise=require(_0x908d('0x6'));var Mustache=require(_0x908d('0x7'));var util=require(_0x908d('0x8'));var path=require(_0x908d('0x9'));var sox=require(_0x908d('0xa'));var csv=require(_0x908d('0xb'));var ejs=require(_0x908d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x908d('0xd'));var crypto=require('crypto');var jsforce=require(_0x908d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x908d('0xb'));var querystring=require('querystring');var Papa=require(_0x908d('0xf'));var Redis=require('ioredis');var authService=require(_0x908d('0x10'));var qs=require(_0x908d('0x11'));var as=require(_0x908d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x908d('0x13'));var utils=require(_0x908d('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a09a2,_0x52ee6e){_0x52ee6e=_0x52ee6e||0xcc;return function(_0x8c1c17){if(_0x8c1c17){return _0x5a09a2[_0x908d('0x15')](_0x52ee6e);}return _0x5a09a2[_0x908d('0x16')](_0x52ee6e)['end']();};}function respondWithResult(_0x57150d,_0x4fdb56){_0x4fdb56=_0x4fdb56||0xc8;return function(_0x49bd90){if(_0x49bd90){return _0x57150d[_0x908d('0x16')](_0x4fdb56)['json'](_0x49bd90);}};}function respondWithFilteredResult(_0x327ff9,_0x2b5c45){return function(_0x220b07){if(_0x220b07){var _0x1166b2=_0x220b07[_0x908d('0x17')],_0x3ac480=_0x2b5c45[_0x908d('0x18')],_0x344c2b=_0x2b5c45[_0x908d('0x18')]+_0x2b5c45[_0x908d('0x19')],_0xc60087;if(_0x344c2b>=_0x1166b2){_0x344c2b=_0x1166b2;_0xc60087=0xc8;}else{_0xc60087=0xce;}_0x327ff9['status'](_0xc60087);return _0x327ff9[_0x908d('0x1a')](_0x908d('0x1b'),_0x3ac480+'-'+_0x344c2b+'/'+_0x1166b2)[_0x908d('0x1c')](_0x220b07);}return null;};}function patchUpdates(_0x5aaa34){return function(_0x1f28e4){try{jsonpatch['apply'](_0x1f28e4,_0x5aaa34,!![]);}catch(_0x442f0b){return BPromise['reject'](_0x442f0b);}return _0x1f28e4['save']();};}function saveUpdates(_0x27f39b,_0x4cc73f){return function(_0x3e769b){if(_0x3e769b){return _0x3e769b['update'](_0x27f39b)[_0x908d('0x1d')](function(_0x5494fb){return _0x5494fb;});}return null;};}function removeEntity(_0x538001,_0x37a51c){return function(_0x13adbd){if(_0x13adbd){return _0x13adbd['destroy']()['then'](function(){var _0x35b9d0=_0x13adbd[_0x908d('0x1e')]({'plain':!![]});var _0x55641a=_0x908d('0x1f');return db[_0x908d('0x20')][_0x908d('0x21')]({'where':{'type':_0x55641a,'resourceId':_0x35b9d0['id']}})[_0x908d('0x1d')](function(){return _0x13adbd;});})[_0x908d('0x1d')](function(){_0x538001[_0x908d('0x16')](0xcc)[_0x908d('0x22')]();});}};}function handleEntityNotFound(_0x4e5528,_0x29a044){return function(_0x311088){if(!_0x311088){_0x4e5528['sendStatus'](0x194);}return _0x311088;};}function handleError(_0xeb16b6,_0x5881e3){_0x5881e3=_0x5881e3||0x1f4;return function(_0x521453){logger[_0x908d('0x23')](_0x521453[_0x908d('0x24')]);if(_0x521453['name']){delete _0x521453['name'];}_0xeb16b6['status'](_0x5881e3)[_0x908d('0x25')](_0x521453);};}exports[_0x908d('0x26')]=function(_0x214ac4,_0x4babce){var _0x196574={},_0x271591={},_0x67ec48={'count':0x0,'rows':[]};var _0x34748d=_['map'](db[_0x908d('0x27')]['rawAttributes'],function(_0x3e4010){return{'name':_0x3e4010[_0x908d('0x28')],'type':_0x3e4010[_0x908d('0x29')][_0x908d('0x2a')]};});_0x271591[_0x908d('0x2b')]=_[_0x908d('0x2c')](_0x34748d,_0x908d('0x2d'));_0x271591[_0x908d('0x2e')]=_[_0x908d('0x2f')](_0x214ac4[_0x908d('0x2e')]);_0x271591['filters']=_[_0x908d('0x30')](_0x271591[_0x908d('0x2b')],_0x271591['query']);_0x196574['attributes']=_[_0x908d('0x30')](_0x271591['model'],qs[_0x908d('0x31')](_0x214ac4[_0x908d('0x2e')]['fields']));_0x196574[_0x908d('0x32')]=_0x196574['attributes']['length']?_0x196574[_0x908d('0x32')]:_0x271591['model'];if(!_0x214ac4[_0x908d('0x2e')][_0x908d('0x33')](_0x908d('0x34'))){_0x196574['limit']=qs[_0x908d('0x19')](_0x214ac4[_0x908d('0x2e')]['limit']);_0x196574[_0x908d('0x18')]=qs[_0x908d('0x18')](_0x214ac4[_0x908d('0x2e')][_0x908d('0x18')]);}_0x196574[_0x908d('0x35')]=qs[_0x908d('0x36')](_0x214ac4[_0x908d('0x2e')][_0x908d('0x36')]);_0x196574[_0x908d('0x37')]=qs[_0x908d('0x38')](_[_0x908d('0x39')](_0x214ac4[_0x908d('0x2e')],_0x271591['filters']),_0x34748d);if(_0x214ac4[_0x908d('0x2e')][_0x908d('0x3a')]){_0x196574[_0x908d('0x37')]=_[_0x908d('0x3b')](_0x196574[_0x908d('0x37')],{'$or':_['map'](_0x34748d,function(_0xeeae90){if(_0xeeae90[_0x908d('0x29')]!==_0x908d('0x3c')){var _0x18d2f8={};_0x18d2f8[_0xeeae90['name']]={'$like':'%'+_0x214ac4[_0x908d('0x2e')][_0x908d('0x3a')]+'%'};return _0x18d2f8;}})});}_0x196574=_[_0x908d('0x3b')]({},_0x196574,_0x214ac4[_0x908d('0x3d')]);var _0x3c2f7c={'where':_0x196574[_0x908d('0x37')]};return db[_0x908d('0x27')]['count'](_0x3c2f7c)[_0x908d('0x1d')](function(_0x2c7a67){_0x67ec48[_0x908d('0x17')]=_0x2c7a67;if(_0x214ac4[_0x908d('0x2e')][_0x908d('0x3e')]){_0x196574[_0x908d('0x3f')]=[{'all':!![]}];}return db[_0x908d('0x27')][_0x908d('0x40')](_0x196574);})[_0x908d('0x1d')](function(_0x14d5f3){_0x67ec48[_0x908d('0x41')]=_0x14d5f3;return _0x67ec48;})[_0x908d('0x1d')](respondWithFilteredResult(_0x4babce,_0x196574))[_0x908d('0x42')](handleError(_0x4babce,null));};exports[_0x908d('0x43')]=function(_0x1494db,_0x1427ec){var _0x22aff2={'raw':!![],'where':{'id':_0x1494db[_0x908d('0x44')]['id']}},_0x3fa898={};_0x3fa898['model']=_[_0x908d('0x2f')](db[_0x908d('0x27')][_0x908d('0x45')]);_0x3fa898['query']=_[_0x908d('0x2f')](_0x1494db['query']);_0x3fa898[_0x908d('0x38')]=_[_0x908d('0x30')](_0x3fa898[_0x908d('0x2b')],_0x3fa898[_0x908d('0x2e')]);_0x22aff2[_0x908d('0x32')]=_[_0x908d('0x30')](_0x3fa898[_0x908d('0x2b')],qs['fields'](_0x1494db[_0x908d('0x2e')][_0x908d('0x31')]));_0x22aff2[_0x908d('0x32')]=_0x22aff2[_0x908d('0x32')]['length']?_0x22aff2[_0x908d('0x32')]:_0x3fa898['model'];if(_0x1494db[_0x908d('0x2e')][_0x908d('0x3e')]){_0x22aff2[_0x908d('0x3f')]=[{'all':!![]}];}_0x22aff2=_[_0x908d('0x3b')]({},_0x22aff2,_0x1494db['options']);return db[_0x908d('0x27')][_0x908d('0x46')](_0x22aff2)[_0x908d('0x1d')](handleEntityNotFound(_0x1427ec,null))[_0x908d('0x1d')](respondWithResult(_0x1427ec,null))[_0x908d('0x42')](handleError(_0x1427ec,null));};exports[_0x908d('0x47')]=function(_0x41da2f,_0x42cd27){return db[_0x908d('0x27')]['create'](_0x41da2f[_0x908d('0x48')],{})['then'](function(_0x541ab5){var _0x2b7961=_0x41da2f[_0x908d('0x49')][_0x908d('0x1e')]({'plain':!![]});if(!_0x2b7961)throw new Error(_0x908d('0x4a'));if(_0x2b7961['role']===_0x908d('0x49')){var _0x42b885=_0x541ab5[_0x908d('0x1e')]({'plain':!![]});var _0x198dcf=_0x908d('0x1f');return db[_0x908d('0x4b')]['find']({'where':{'name':_0x198dcf,'userProfileId':_0x2b7961[_0x908d('0x4c')]},'raw':!![]})['then'](function(_0x29d2a5){if(_0x29d2a5&&_0x29d2a5[_0x908d('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x42b885[_0x908d('0x2d')],'resourceId':_0x42b885['id'],'type':_0x29d2a5[_0x908d('0x2d')],'sectionId':_0x29d2a5['id']},{})[_0x908d('0x1d')](function(){return _0x541ab5;});}else{return _0x541ab5;}})['catch'](function(_0x23f281){logger[_0x908d('0x23')](_0x908d('0x4e'),_0x23f281);throw _0x23f281;});}return _0x541ab5;})[_0x908d('0x1d')](respondWithResult(_0x42cd27,0xc9))[_0x908d('0x42')](handleError(_0x42cd27,null));};exports[_0x908d('0x4f')]=function(_0x3b3a93,_0xdae231){if(_0x3b3a93[_0x908d('0x48')]['id']){delete _0x3b3a93[_0x908d('0x48')]['id'];}return db[_0x908d('0x27')][_0x908d('0x46')]({'where':{'id':_0x3b3a93[_0x908d('0x44')]['id']}})[_0x908d('0x1d')](handleEntityNotFound(_0xdae231,null))['then'](saveUpdates(_0x3b3a93[_0x908d('0x48')],null))['then'](respondWithResult(_0xdae231,null))[_0x908d('0x42')](handleError(_0xdae231,null));};exports[_0x908d('0x21')]=function(_0x2eaa36,_0x2547e7){return db['Tag'][_0x908d('0x46')]({'where':{'id':_0x2eaa36[_0x908d('0x44')]['id']}})[_0x908d('0x1d')](handleEntityNotFound(_0x2547e7,null))['then'](removeEntity(_0x2547e7,null))['catch'](handleError(_0x2547e7,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1a134d5..978a086 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 _0x9338=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','util','../../config/logger','api','moment'];(function(_0x22382f,_0x5c2e54){var _0x35213b=function(_0x50898d){while(--_0x50898d){_0x22382f['push'](_0x22382f['shift']());}};_0x35213b(++_0x5c2e54);}(_0x9338,0x1b6));var _0x8933=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x9338[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require('lodash');var util=require(_0x8933('0x0'));var logger=require(_0x8933('0x1'))(_0x8933('0x2'));var moment=require(_0x8933('0x3'));var BPromise=require(_0x8933('0x4'));var rp=require(_0x8933('0x5'));var fs=require('fs');var path=require(_0x8933('0x6'));var rimraf=require(_0x8933('0x7'));var config=require(_0x8933('0x8'));var attributes=require(_0x8933('0x9'));module[_0x8933('0xa')]=function(_0x1de0cf,_0x4e2587){return _0x1de0cf[_0x8933('0xb')](_0x8933('0xc'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x552c=['path','rimraf','../../config/environment','exports','define','Tag','tools_tags','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x552c,0x6f));var _0xc552=function(_0x247144,_0x44f6db){_0x247144=_0x247144-0x0;var _0x26788f=_0x552c[_0x247144];return _0x26788f;};'use strict';var _=require(_0xc552('0x0'));var util=require(_0xc552('0x1'));var logger=require('../../config/logger')(_0xc552('0x2'));var moment=require(_0xc552('0x3'));var BPromise=require(_0xc552('0x4'));var rp=require(_0xc552('0x5'));var fs=require('fs');var path=require(_0xc552('0x6'));var rimraf=require(_0xc552('0x7'));var config=require(_0xc552('0x8'));var attributes=require('./tag.attributes');module[_0xc552('0x9')]=function(_0x539535,_0x5ee408){return _0x539535[_0xc552('0xa')](_0xc552('0xb'),attributes,{'tableName':_0xc552('0xc'),'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 826a7a3..00be33e 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 _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x0fd9,0xa3));var _0x90fd=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x0fd9[_0x40be86];return _0xda3c3b;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('Tag,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('Tag,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x5b1aed,_0x322c17){var _0x26add8=function(_0x58a9d7){while(--_0x58a9d7){_0x5b1aed['push'](_0x5b1aed['shift']());}};_0x26add8(++_0x322c17);}(_0x99e9,0xb4));var _0x999e=function(_0xfbe06e,_0x2fb7ab){_0xfbe06e=_0xfbe06e-0x0;var _0x24e5b6=_0x99e9[_0xfbe06e];return _0x24e5b6;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('Tag,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 415f358..085704d 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 _0xf216=['removeQueues','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','getAgents','post','/:id/queues','/:id/users','put','/:id','update','delete'];(function(_0x196ad7,_0x32daf2){var _0xab52eb=function(_0xff054){while(--_0xff054){_0x196ad7['push'](_0x196ad7['shift']());}};_0xab52eb(++_0x32daf2);}(_0xf216,0x1e6));var _0x6f21=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xf216[_0x3ec1da];return _0x472358;};'use strict';var multer=require('multer');var util=require(_0x6f21('0x0'));var path=require(_0x6f21('0x1'));var timeout=require(_0x6f21('0x2'));var express=require(_0x6f21('0x3'));var router=express[_0x6f21('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6f21('0x5'));var config=require(_0x6f21('0x6'));var controller=require(_0x6f21('0x7'));router[_0x6f21('0x8')]('/',auth[_0x6f21('0x9')](),controller[_0x6f21('0xa')]);router[_0x6f21('0x8')]('/:id',auth[_0x6f21('0x9')](),controller[_0x6f21('0xb')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router[_0x6f21('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x6f21('0xc')]);router[_0x6f21('0xd')]('/',auth[_0x6f21('0x9')](),controller['create']);router[_0x6f21('0xd')](_0x6f21('0xe'),auth['isAuthenticated'](),controller['addQueues']);router[_0x6f21('0xd')](_0x6f21('0xf'),auth[_0x6f21('0x9')](),controller['addAgents']);router[_0x6f21('0x10')](_0x6f21('0x11'),auth[_0x6f21('0x9')](),controller[_0x6f21('0x12')]);router[_0x6f21('0x13')]('/:id',auth[_0x6f21('0x9')](),controller['destroy']);router[_0x6f21('0x13')](_0x6f21('0xe'),auth[_0x6f21('0x9')](),controller[_0x6f21('0x14')]);router[_0x6f21('0x13')](_0x6f21('0xf'),auth[_0x6f21('0x9')](),controller[_0x6f21('0x15')]);module[_0x6f21('0x16')]=router; \ No newline at end of file +var _0x2f4f=['addQueues','addAgents','put','/:id','update','delete','destroy','removeQueues','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','/:id/queues','/:id/users','post','create'];(function(_0x8a380f,_0x84554a){var _0x1fa6e3=function(_0x520c6e){while(--_0x520c6e){_0x8a380f['push'](_0x8a380f['shift']());}};_0x1fa6e3(++_0x84554a);}(_0x2f4f,0xa6));var _0xf2f4=function(_0x20fb56,_0x315362){_0x20fb56=_0x20fb56-0x0;var _0x3ca29e=_0x2f4f[_0x20fb56];return _0x3ca29e;};'use strict';var multer=require('multer');var util=require(_0xf2f4('0x0'));var path=require(_0xf2f4('0x1'));var timeout=require(_0xf2f4('0x2'));var express=require(_0xf2f4('0x3'));var router=express[_0xf2f4('0x4')]();var auth=require(_0xf2f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2f4('0x6'));var controller=require(_0xf2f4('0x7'));router[_0xf2f4('0x8')]('/',auth[_0xf2f4('0x9')](),controller[_0xf2f4('0xa')]);router[_0xf2f4('0x8')]('/:id',auth[_0xf2f4('0x9')](),controller[_0xf2f4('0xb')]);router[_0xf2f4('0x8')](_0xf2f4('0xc'),auth[_0xf2f4('0x9')](),controller['getQueues']);router[_0xf2f4('0x8')](_0xf2f4('0xd'),auth[_0xf2f4('0x9')](),controller['getAgents']);router[_0xf2f4('0xe')]('/',auth['isAuthenticated'](),controller[_0xf2f4('0xf')]);router[_0xf2f4('0xe')]('/:id/queues',auth[_0xf2f4('0x9')](),controller[_0xf2f4('0x10')]);router[_0xf2f4('0xe')](_0xf2f4('0xd'),auth[_0xf2f4('0x9')](),controller[_0xf2f4('0x11')]);router[_0xf2f4('0x12')](_0xf2f4('0x13'),auth[_0xf2f4('0x9')](),controller[_0xf2f4('0x14')]);router[_0xf2f4('0x15')](_0xf2f4('0x13'),auth['isAuthenticated'](),controller[_0xf2f4('0x16')]);router['delete']('/:id/queues',auth[_0xf2f4('0x9')](),controller[_0xf2f4('0x17')]);router[_0xf2f4('0x15')](_0xf2f4('0xd'),auth[_0xf2f4('0x9')](),controller[_0xf2f4('0x18')]);module[_0xf2f4('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 0366f1f..84265f6 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 _0x03bc=['name','sequelize','exports','STRING'];(function(_0x564317,_0x380f2d){var _0x25c11f=function(_0x4d75c5){while(--_0x4d75c5){_0x564317['push'](_0x564317['shift']());}};_0x25c11f(++_0x380f2d);}(_0x03bc,0xd9));var _0xc03b=function(_0x235a26,_0x19b391){_0x235a26=_0x235a26-0x0;var _0x2de83c=_0x03bc[_0x235a26];return _0x2de83c;};'use strict';var Sequelize=require(_0xc03b('0x0'));module[_0xc03b('0x1')]={'name':{'type':Sequelize[_0xc03b('0x2')],'allowNull':![],'unique':_0xc03b('0x3')},'description':{'type':Sequelize[_0xc03b('0x2')]}}; \ No newline at end of file +var _0xac2c=['STRING','name'];(function(_0x25bded,_0x3fb9bf){var _0xca48eb=function(_0x52fb28){while(--_0x52fb28){_0x25bded['push'](_0x25bded['shift']());}};_0xca48eb(++_0x3fb9bf);}(_0xac2c,0x99));var _0xcac2=function(_0xbc550a,_0x2bb605){_0xbc550a=_0xbc550a-0x0;var _0xd16ba4=_0xac2c[_0xbc550a];return _0xd16ba4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcac2('0x0')},'description':{'type':Sequelize[_0xcac2('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b5424cb..4a05d73 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 _0x927c=['Voice','Chat','Mail','Fax','Whatsapp','each','findAll','online','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','addAgents','omit','spread','emit','userTeam:save','removeAgents','voice','chat','whatsapp','isArray','userTeam:remove','getAgents','User','nolimit','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','Team','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','includeAll','include','rows','catch','show','rawAttributes','filters','merge','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','params','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','addQueues','findOne','add','toLowerCase','Queues','ids'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x927c,0x190));var _0xc927=function(_0x5012d1,_0x79b3da){_0x5012d1=_0x5012d1-0x0;var _0x18927c=_0x927c[_0x5012d1];return _0x18927c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc927('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc927('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc927('0x2'));var util=require(_0xc927('0x3'));var path=require(_0xc927('0x4'));var sox=require(_0xc927('0x5'));var csv=require(_0xc927('0x6'));var ejs=require(_0xc927('0x7'));var fs=require('fs');var _=require(_0xc927('0x8'));var squel=require(_0xc927('0x9'));var crypto=require('crypto');var jsforce=require(_0xc927('0xa'));var deskjs=require(_0xc927('0xb'));var toCsv=require(_0xc927('0x6'));var querystring=require(_0xc927('0xc'));var Papa=require(_0xc927('0xd'));var Redis=require(_0xc927('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc927('0xf'));var as=require(_0xc927('0x10'));var hardwareService=require(_0xc927('0x11'));var logger=require('../../config/logger')(_0xc927('0x12'));var utils=require('../../config/utils');var config=require(_0xc927('0x13'));var db=require(_0xc927('0x14'))['db'];config['redis']=_[_0xc927('0x15')](config[_0xc927('0x16')],{'host':_0xc927('0x17'),'port':0x18eb});var socket=require(_0xc927('0x18'))(new Redis(config[_0xc927('0x16')]));require(_0xc927('0x19'))['register'](socket);function respondWithStatusCode(_0x4389c1,_0x21b212){_0x21b212=_0x21b212||0xcc;return function(_0x109920){if(_0x109920){return _0x4389c1[_0xc927('0x1a')](_0x21b212);}return _0x4389c1[_0xc927('0x1b')](_0x21b212)[_0xc927('0x1c')]();};}function respondWithResult(_0x3a7349,_0x1a929a){_0x1a929a=_0x1a929a||0xc8;return function(_0x5078a6){if(_0x5078a6){return _0x3a7349[_0xc927('0x1b')](_0x1a929a)[_0xc927('0x1d')](_0x5078a6);}};}function respondWithFilteredResult(_0x2f751c,_0x5130c9){return function(_0x4e3e96){if(_0x4e3e96){var _0x52cfc0=_0x4e3e96[_0xc927('0x1e')],_0x3b3df3=_0x5130c9['offset'],_0x2caaec=_0x5130c9[_0xc927('0x1f')]+_0x5130c9[_0xc927('0x20')],_0x58d6dd;if(_0x2caaec>=_0x52cfc0){_0x2caaec=_0x52cfc0;_0x58d6dd=0xc8;}else{_0x58d6dd=0xce;}_0x2f751c[_0xc927('0x1b')](_0x58d6dd);return _0x2f751c[_0xc927('0x21')](_0xc927('0x22'),_0x3b3df3+'-'+_0x2caaec+'/'+_0x52cfc0)[_0xc927('0x1d')](_0x4e3e96);}return null;};}function patchUpdates(_0x102441){return function(_0x360080){try{jsonpatch[_0xc927('0x23')](_0x360080,_0x102441,!![]);}catch(_0x54595d){return BPromise[_0xc927('0x24')](_0x54595d);}return _0x360080['save']();};}function saveUpdates(_0x2608f5,_0x59390c){return function(_0x1361cb){if(_0x1361cb){return _0x1361cb[_0xc927('0x25')](_0x2608f5)['then'](function(_0x3c20b4){return _0x3c20b4;});}return null;};}function removeEntity(_0x305853,_0x3bafdd){return function(_0x958ac6){if(_0x958ac6){return _0x958ac6['destroy']()[_0xc927('0x26')](function(){var _0x3196d8=_0x958ac6['get']({'plain':!![]});var _0x4297e7='Teams';return db['UserProfileResource'][_0xc927('0x27')]({'where':{'type':_0x4297e7,'resourceId':_0x3196d8['id']}})[_0xc927('0x26')](function(){return _0x958ac6;});})['then'](function(){_0x305853[_0xc927('0x1b')](0xcc)[_0xc927('0x1c')]();});}};}function handleEntityNotFound(_0x157b7a,_0x4d16bb){return function(_0x104135){if(!_0x104135){_0x157b7a[_0xc927('0x1a')](0x194);}return _0x104135;};}function handleError(_0x17d221,_0x365dd4){_0x365dd4=_0x365dd4||0x1f4;return function(_0x14637e){logger[_0xc927('0x28')](_0x14637e['stack']);if(_0x14637e[_0xc927('0x29')]){delete _0x14637e[_0xc927('0x29')];}_0x17d221[_0xc927('0x1b')](_0x365dd4)[_0xc927('0x2a')](_0x14637e);};}exports[_0xc927('0x2b')]=function(_0x15e848,_0x29996a){var _0x54cdfe={},_0x1ad2ff={},_0x5a507b={'count':0x0,'rows':[]};var _0x370bdd=_[_0xc927('0x2c')](db[_0xc927('0x2d')]['rawAttributes'],function(_0x21f721){return{'name':_0x21f721[_0xc927('0x2e')],'type':_0x21f721[_0xc927('0x2f')][_0xc927('0x30')]};});_0x1ad2ff[_0xc927('0x31')]=_[_0xc927('0x2c')](_0x370bdd,_0xc927('0x29'));_0x1ad2ff[_0xc927('0x32')]=_[_0xc927('0x33')](_0x15e848['query']);_0x1ad2ff['filters']=_['intersection'](_0x1ad2ff[_0xc927('0x31')],_0x1ad2ff[_0xc927('0x32')]);_0x54cdfe[_0xc927('0x34')]=_[_0xc927('0x35')](_0x1ad2ff[_0xc927('0x31')],qs[_0xc927('0x36')](_0x15e848[_0xc927('0x32')]['fields']));_0x54cdfe['attributes']=_0x54cdfe[_0xc927('0x34')][_0xc927('0x37')]?_0x54cdfe[_0xc927('0x34')]:_0x1ad2ff[_0xc927('0x31')];if(!_0x15e848[_0xc927('0x32')][_0xc927('0x38')]('nolimit')){_0x54cdfe[_0xc927('0x20')]=qs[_0xc927('0x20')](_0x15e848[_0xc927('0x32')][_0xc927('0x20')]);_0x54cdfe[_0xc927('0x1f')]=qs[_0xc927('0x1f')](_0x15e848[_0xc927('0x32')][_0xc927('0x1f')]);}_0x54cdfe[_0xc927('0x39')]=qs['sort'](_0x15e848[_0xc927('0x32')][_0xc927('0x3a')]);_0x54cdfe[_0xc927('0x3b')]=qs['filters'](_[_0xc927('0x3c')](_0x15e848[_0xc927('0x32')],_0x1ad2ff['filters']),_0x370bdd);if(_0x15e848['query']['filter']){_0x54cdfe[_0xc927('0x3b')]=_['merge'](_0x54cdfe[_0xc927('0x3b')],{'$or':_[_0xc927('0x2c')](_0x370bdd,function(_0xfbe84b){if(_0xfbe84b[_0xc927('0x2f')]!=='VIRTUAL'){var _0xd43264={};_0xd43264[_0xfbe84b['name']]={'$like':'%'+_0x15e848['query'][_0xc927('0x3d')]+'%'};return _0xd43264;}})});}_0x54cdfe=_['merge']({},_0x54cdfe,_0x15e848['options']);var _0x506ecd={'where':_0x54cdfe[_0xc927('0x3b')]};return db[_0xc927('0x2d')][_0xc927('0x1e')](_0x506ecd)[_0xc927('0x26')](function(_0x27920c){_0x5a507b['count']=_0x27920c;if(_0x15e848['query'][_0xc927('0x3e')]){_0x54cdfe[_0xc927('0x3f')]=[{'all':!![]}];}return db['Team']['findAll'](_0x54cdfe);})[_0xc927('0x26')](function(_0x364409){_0x5a507b[_0xc927('0x40')]=_0x364409;return _0x5a507b;})[_0xc927('0x26')](respondWithFilteredResult(_0x29996a,_0x54cdfe))[_0xc927('0x41')](handleError(_0x29996a,null));};exports[_0xc927('0x42')]=function(_0x291790,_0x285d8c){var _0x14a5fc={'raw':![],'where':{'id':_0x291790['params']['id']}},_0x2badc1={};_0x2badc1[_0xc927('0x31')]=_[_0xc927('0x33')](db['Team'][_0xc927('0x43')]);_0x2badc1[_0xc927('0x32')]=_[_0xc927('0x33')](_0x291790[_0xc927('0x32')]);_0x2badc1[_0xc927('0x44')]=_[_0xc927('0x35')](_0x2badc1[_0xc927('0x31')],_0x2badc1[_0xc927('0x32')]);_0x14a5fc[_0xc927('0x34')]=_[_0xc927('0x35')](_0x2badc1[_0xc927('0x31')],qs[_0xc927('0x36')](_0x291790[_0xc927('0x32')][_0xc927('0x36')]));_0x14a5fc[_0xc927('0x34')]=_0x14a5fc[_0xc927('0x34')][_0xc927('0x37')]?_0x14a5fc[_0xc927('0x34')]:_0x2badc1['model'];if(_0x291790[_0xc927('0x32')][_0xc927('0x3e')]){_0x14a5fc[_0xc927('0x3f')]=[{'all':!![]}];}_0x14a5fc=_[_0xc927('0x45')]({},_0x14a5fc,_0x291790[_0xc927('0x46')]);return db['Team'][_0xc927('0x47')](_0x14a5fc)[_0xc927('0x26')](handleEntityNotFound(_0x285d8c,null))[_0xc927('0x26')](respondWithResult(_0x285d8c,null))['catch'](handleError(_0x285d8c,null));};exports['create']=function(_0x2cbd66,_0x1517f2){return db['Team'][_0xc927('0x48')](_0x2cbd66['body'],{})[_0xc927('0x26')](function(_0x234b05){var _0x1ad204=_0x2cbd66['user'][_0xc927('0x49')]({'plain':!![]});if(!_0x1ad204)throw new Error(_0xc927('0x4a'));if(_0x1ad204[_0xc927('0x4b')]===_0xc927('0x4c')){var _0x5b3004=_0x234b05[_0xc927('0x49')]({'plain':!![]});var _0x217adf=_0xc927('0x4d');return db[_0xc927('0x4e')][_0xc927('0x47')]({'where':{'name':_0x217adf,'userProfileId':_0x1ad204[_0xc927('0x4f')]},'raw':!![]})['then'](function(_0x359f0c){if(_0x359f0c&&_0x359f0c[_0xc927('0x50')]===0x0){return db[_0xc927('0x51')][_0xc927('0x48')]({'name':_0x5b3004[_0xc927('0x29')],'resourceId':_0x5b3004['id'],'type':_0x359f0c[_0xc927('0x29')],'sectionId':_0x359f0c['id']},{})['then'](function(){return _0x234b05;});}else{return _0x234b05;}})[_0xc927('0x41')](function(_0x2f1473){logger[_0xc927('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f1473);throw _0x2f1473;});}return _0x234b05;})[_0xc927('0x26')](respondWithResult(_0x1517f2,0xc9))[_0xc927('0x41')](handleError(_0x1517f2,null));};exports[_0xc927('0x25')]=function(_0x2d3a28,_0x417cbb){if(_0x2d3a28[_0xc927('0x52')]['id']){delete _0x2d3a28[_0xc927('0x52')]['id'];}return db[_0xc927('0x2d')][_0xc927('0x47')]({'where':{'id':_0x2d3a28[_0xc927('0x53')]['id']}})[_0xc927('0x26')](handleEntityNotFound(_0x417cbb,null))['then'](saveUpdates(_0x2d3a28[_0xc927('0x52')],null))[_0xc927('0x26')](respondWithResult(_0x417cbb,null))[_0xc927('0x41')](handleError(_0x417cbb,null));};exports[_0xc927('0x27')]=function(_0x4fbc31,_0x79b42f){return db[_0xc927('0x2d')][_0xc927('0x47')]({'where':{'id':_0x4fbc31[_0xc927('0x53')]['id']}})[_0xc927('0x26')](handleEntityNotFound(_0x79b42f,null))[_0xc927('0x26')](removeEntity(_0x79b42f,null))[_0xc927('0x41')](handleError(_0x79b42f,null));};exports[_0xc927('0x54')]=function(_0x1b2d17,_0x4d41c9,_0x12beaf){return db[_0xc927('0x2d')]['findOne']({'where':{'id':_0x1b2d17[_0xc927('0x53')]['id']}})[_0xc927('0x26')](handleEntityNotFound(_0x4d41c9,null))[_0xc927('0x26')](function(_0x406a59){if(!_0x1b2d17[_0xc927('0x32')][_0xc927('0x55')]||!utils[_0xc927('0x56')](_0x1b2d17[_0xc927('0x32')]['channel'])){throw new db['Sequelize'][(_0xc927('0x57'))](_0xc927('0x58'));}var _0x132681={};var _0x418f2c={};_0x418f2c['model']=_[_0xc927('0x33')](db[_[_0xc927('0x59')](_0x1b2d17[_0xc927('0x32')][_0xc927('0x55')]['toLowerCase']())+'Queue'][_0xc927('0x43')]);_0x418f2c['query']=_[_0xc927('0x33')](_0x1b2d17[_0xc927('0x32')]);_0x418f2c[_0xc927('0x44')]=_[_0xc927('0x35')](_0x418f2c[_0xc927('0x31')],_0x418f2c[_0xc927('0x32')]);_0x132681[_0xc927('0x34')]=_[_0xc927('0x35')](_0x418f2c[_0xc927('0x31')],qs['fields'](_0x1b2d17[_0xc927('0x32')][_0xc927('0x36')]));_0x132681[_0xc927('0x34')]=_0x132681[_0xc927('0x34')][_0xc927('0x37')]?_0x132681[_0xc927('0x34')]:_0x418f2c[_0xc927('0x31')];_0x132681[_0xc927('0x20')]=qs[_0xc927('0x20')](_0x1b2d17[_0xc927('0x32')][_0xc927('0x20')]);_0x132681[_0xc927('0x1f')]=qs[_0xc927('0x1f')](_0x1b2d17['query'][_0xc927('0x1f')]);_0x132681['order']=qs[_0xc927('0x3a')](_0x1b2d17[_0xc927('0x32')][_0xc927('0x3a')]);_0x132681[_0xc927('0x3b')]=qs[_0xc927('0x44')](_[_0xc927('0x3c')](_0x1b2d17[_0xc927('0x32')],_0x418f2c['filters']));_0x132681=_[_0xc927('0x45')]({},_0x132681,_0x1b2d17['options']);return _0x406a59[_0xc927('0x49')+_[_0xc927('0x59')](_0x1b2d17['query']['channel']['toLowerCase']())+'Queues'](_0x132681);})['then'](respondWithResult(_0x4d41c9,null))[_0xc927('0x41')](handleError(_0x4d41c9,null));};exports[_0xc927('0x5a')]=function(_0x5baaa8,_0x3f559d,_0x2f8af7){return db['Team'][_0xc927('0x5b')]({'where':{'id':_0x5baaa8[_0xc927('0x53')]['id']}})[_0xc927('0x26')](function(_0x489a48){if(_0x489a48){if(!_0x5baaa8[_0xc927('0x52')][_0xc927('0x55')]||!utils[_0xc927('0x56')](_0x5baaa8['body'][_0xc927('0x55')])){throw new db['Sequelize'][(_0xc927('0x57'))](_0xc927('0x58'));}return _0x489a48[_0xc927('0x5c')+_[_0xc927('0x59')](_0x5baaa8[_0xc927('0x52')][_0xc927('0x55')][_0xc927('0x5d')]())+_0xc927('0x5e')](_0x5baaa8[_0xc927('0x52')]['ids']);}return null;})[_0xc927('0x26')](handleEntityNotFound(_0x3f559d,null))[_0xc927('0x26')](respondWithStatusCode(_0x3f559d,null))[_0xc927('0x41')](handleError(_0x3f559d,null));};exports['removeQueues']=function(_0x4af815,_0x21e31e,_0x501e16){return db[_0xc927('0x2d')][_0xc927('0x5b')]({'where':{'id':_0x4af815[_0xc927('0x53')]['id']}})['then'](function(_0x3c3290){if(_0x3c3290){if(!_0x4af815[_0xc927('0x32')][_0xc927('0x55')]||!utils[_0xc927('0x56')](_0x4af815[_0xc927('0x32')][_0xc927('0x55')])){throw new db['Sequelize']['ValidationError'](_0xc927('0x58'));}return _0x3c3290['remove'+_['capitalize'](_0x4af815[_0xc927('0x32')][_0xc927('0x55')][_0xc927('0x5d')]())+'Queues'](_0x4af815['query'][_0xc927('0x5f')]);}return null;})[_0xc927('0x26')](handleEntityNotFound(_0x21e31e,null))[_0xc927('0x26')](respondWithStatusCode(_0x21e31e,null))['catch'](handleError(_0x21e31e,null));};exports['addAgents']=function(_0x25c4b3,_0x5c9a7f,_0x49766e){return db[_0xc927('0x2d')][_0xc927('0x47')]({'where':{'id':_0x25c4b3[_0xc927('0x53')]['id']}})[_0xc927('0x26')](handleEntityNotFound(_0x5c9a7f,null))[_0xc927('0x26')](function(_0x132d96){if(_0x132d96){var _0x454b82=[_0xc927('0x60'),_0xc927('0x61'),_0xc927('0x62'),'Sms',_0xc927('0x63'),'Openchannel',_0xc927('0x64')];return BPromise[_0xc927('0x65')](_0x454b82,function(_0x2e3b6d){return _0x132d96['get'+_0x2e3b6d+'Queues']({'attributes':['id',_0xc927('0x29')]})[_0xc927('0x26')](function(_0x2127e1){return BPromise[_0xc927('0x65')](_0x2127e1,function(_0x3e8164){return _0x3e8164['addAgents'](_0x25c4b3[_0xc927('0x52')][_0xc927('0x5f')])[_0xc927('0x26')](function(){if(_0x2e3b6d===_0xc927('0x60')){return db['User'][_0xc927('0x66')]({'where':{'id':_0x25c4b3[_0xc927('0x52')][_0xc927('0x5f')]},'attributes':['id',_0xc927('0x29'),_0xc927('0x67'),'voicePause','interface'],'raw':!![]})['then'](function(_0x1a6c8f){return BPromise[_0xc927('0x65')](_[_0xc927('0x3d')](_0x1a6c8f,{'online':0x1}),function(_0x1980b2){return db[_0xc927('0x68')][_0xc927('0x69')]({'membername':_0x1980b2[_0xc927('0x29')],'UserId':_0x1980b2['id'],'queue_name':_0x3e8164[_0xc927('0x29')],'VoiceQueueId':_0x3e8164['id'],'interface':_[_0xc927('0x6a')](_0x1980b2[_0xc927('0x6b')])?util['format'](_0xc927('0x6c'),_0x1980b2['name']):_0x1980b2[_0xc927('0x6b')],'paused':_0x1980b2[_0xc927('0x6d')]||![],'penalty':0x0});});});}});});})[_0xc927('0x26')](function(){return _0x132d96;});})[_0xc927('0x26')](function(){return _0x132d96;});}})[_0xc927('0x26')](function(_0x169413){if(_0x169413){return _0x169413[_0xc927('0x6e')](_0x25c4b3[_0xc927('0x52')][_0xc927('0x5f')],_[_0xc927('0x6f')](_0x25c4b3[_0xc927('0x52')],[_0xc927('0x5f'),'id'])||{})[_0xc927('0x70')](function(_0x3a6740){for(var _0x566097=0x0;_0x566097<_0x25c4b3['body']['ids']['length'];_0x566097+=0x1){socket[_0xc927('0x71')](_0xc927('0x72'),{'UserId':_0x25c4b3[_0xc927('0x52')]['ids'][_0x566097],'TeamId':_0x25c4b3[_0xc927('0x53')]['id']});}return _0x3a6740;});}})['then'](respondWithResult(_0x5c9a7f,null))['catch'](handleError(_0x5c9a7f,null));};exports[_0xc927('0x73')]=function(_0x1d7674,_0x520230,_0x37fc7b){return db[_0xc927('0x2d')][_0xc927('0x47')]({'where':{'id':_0x1d7674[_0xc927('0x53')]['id']}})[_0xc927('0x26')](handleEntityNotFound(_0x520230,null))['then'](function(_0x26db68){if(_0x26db68){return BPromise['each']([_0xc927('0x74'),_0xc927('0x75'),'mail','sms','fax','openchannel',_0xc927('0x76')],function(_0x4fd122){return _0x26db68[_0xc927('0x49')+_[_0xc927('0x59')](_0x4fd122)+_0xc927('0x5e')]({'attributes':['id',_0xc927('0x29')]})[_0xc927('0x26')](function(_0x20c101){return BPromise[_0xc927('0x65')](_0x20c101,function(_0x3a5b35){return _0x3a5b35[_0xc927('0x73')](_0x1d7674[_0xc927('0x32')]['ids'])[_0xc927('0x26')](function(){if(_0x4fd122===_0xc927('0x74')){return db[_0xc927('0x68')]['destroy']({'where':{'VoiceQueueId':_0x3a5b35['id'],'UserId':_0x1d7674['query']['ids']}});}});});})['then'](function(){return _0x26db68;});})[_0xc927('0x26')](function(){return _0x26db68;});}})[_0xc927('0x26')](function(_0x171e55){if(_0x171e55){return _0x171e55[_0xc927('0x73')](_0x1d7674['query'][_0xc927('0x5f')])[_0xc927('0x26')](function(){if(_[_0xc927('0x77')](_0x1d7674['query'][_0xc927('0x5f')])){for(var _0xa3aa62=0x0;_0xa3aa62<_0x1d7674['query'][_0xc927('0x5f')][_0xc927('0x37')];_0xa3aa62+=0x1){socket[_0xc927('0x71')](_0xc927('0x78'),{'UserId':Number(_0x1d7674[_0xc927('0x32')][_0xc927('0x5f')][_0xa3aa62]),'TeamId':Number(_0x1d7674[_0xc927('0x53')]['id'])});}}else{socket[_0xc927('0x71')]('userTeam:remove',{'UserId':Number(_0x1d7674[_0xc927('0x32')]['ids']),'TeamId':Number(_0x1d7674[_0xc927('0x53')]['id'])});}});}})[_0xc927('0x26')](respondWithStatusCode(_0x520230,null))[_0xc927('0x41')](handleError(_0x520230,null));};exports[_0xc927('0x79')]=function(_0x426a2a,_0x33bd20,_0x3ac315){var _0x40dba0={};var _0x167cd7={};var _0x4ce261;var _0x1d642c;return db[_0xc927('0x2d')][_0xc927('0x5b')]({'where':{'id':_0x426a2a[_0xc927('0x53')]['id']}})[_0xc927('0x26')](handleEntityNotFound(_0x33bd20,null))['then'](function(_0x9c993f){if(_0x9c993f){_0x4ce261=_0x9c993f;_0x167cd7[_0xc927('0x31')]=_[_0xc927('0x33')](db[_0xc927('0x7a')][_0xc927('0x43')]);_0x167cd7['query']=_[_0xc927('0x33')](_0x426a2a[_0xc927('0x32')]);_0x167cd7[_0xc927('0x44')]=_[_0xc927('0x35')](_0x167cd7[_0xc927('0x31')],_0x167cd7['query']);_0x40dba0['attributes']=_['intersection'](_0x167cd7[_0xc927('0x31')],qs[_0xc927('0x36')](_0x426a2a[_0xc927('0x32')][_0xc927('0x36')]));_0x40dba0[_0xc927('0x34')]=_0x40dba0[_0xc927('0x34')]['length']?_0x40dba0[_0xc927('0x34')]:_0x167cd7['model'];_0x40dba0[_0xc927('0x39')]=qs['sort'](_0x426a2a['query'][_0xc927('0x3a')]);_0x40dba0[_0xc927('0x3b')]=qs[_0xc927('0x44')](_['pick'](_0x426a2a[_0xc927('0x32')],_0x167cd7[_0xc927('0x44')]));if(_0x426a2a[_0xc927('0x32')][_0xc927('0x3d')]){_0x40dba0[_0xc927('0x3b')]=_[_0xc927('0x45')](_0x40dba0[_0xc927('0x3b')],{'$or':_[_0xc927('0x2c')](_0x40dba0['attributes'],function(_0x319da6){var _0x344211={};_0x344211[_0x319da6]={'$like':'%'+_0x426a2a['query'][_0xc927('0x3d')]+'%'};return _0x344211;})});}_0x40dba0=_[_0xc927('0x45')]({},_0x40dba0,_0x426a2a[_0xc927('0x46')]);return _0x4ce261[_0xc927('0x79')](_0x40dba0);}})[_0xc927('0x26')](function(_0x4ff654){if(_0x4ff654){_0x1d642c=_0x4ff654[_0xc927('0x37')];if(!_0x426a2a['query'][_0xc927('0x38')](_0xc927('0x7b'))){_0x40dba0[_0xc927('0x20')]=qs[_0xc927('0x20')](_0x426a2a[_0xc927('0x32')][_0xc927('0x20')]);_0x40dba0[_0xc927('0x1f')]=qs[_0xc927('0x1f')](_0x426a2a[_0xc927('0x32')]['offset']);}return _0x4ce261[_0xc927('0x79')](_0x40dba0);}})[_0xc927('0x26')](function(_0xe4093e){if(_0xe4093e){return _0xe4093e?{'count':_0x1d642c,'rows':_0xe4093e}:null;}})[_0xc927('0x26')](respondWithResult(_0x33bd20,null))[_0xc927('0x41')](handleError(_0x33bd20,null));}; \ No newline at end of file +var _0x9269=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','Teams','UserProfileResource','error','stack','name','send','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','toLowerCase','capitalize','Queues','addQueues','Sequelize','ids','removeQueues','remove','Voice','Chat','Sms','Fax','Whatsapp','each','addAgents','User','findAll','voicePause','interface','upsert','isNil','format','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','fax','openchannel','whatsapp','UserVoiceQueueRt','userTeam:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x383432,_0x16b684){var _0x58929c=function(_0x24b245){while(--_0x24b245){_0x383432['push'](_0x383432['shift']());}};_0x58929c(++_0x16b684);}(_0x9269,0x1e9));var _0x9926=function(_0x2509f1,_0x5c9f8c){_0x2509f1=_0x2509f1-0x0;var _0x410842=_0x9269[_0x2509f1];return _0x410842;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9926('0x0'));var rimraf=require(_0x9926('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9926('0x2'));var rp=require('request-promise');var moment=require(_0x9926('0x3'));var BPromise=require(_0x9926('0x4'));var Mustache=require(_0x9926('0x5'));var util=require(_0x9926('0x6'));var path=require(_0x9926('0x7'));var sox=require(_0x9926('0x8'));var csv=require(_0x9926('0x9'));var ejs=require(_0x9926('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9926('0xb'));var crypto=require(_0x9926('0xc'));var jsforce=require(_0x9926('0xd'));var deskjs=require(_0x9926('0xe'));var toCsv=require(_0x9926('0x9'));var querystring=require('querystring');var Papa=require(_0x9926('0xf'));var Redis=require('ioredis');var authService=require(_0x9926('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9926('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x9926('0x12'));var config=require(_0x9926('0x13'));var db=require(_0x9926('0x14'))['db'];config[_0x9926('0x15')]=_[_0x9926('0x16')](config[_0x9926('0x15')],{'host':_0x9926('0x17'),'port':0x18eb});var socket=require(_0x9926('0x18'))(new Redis(config['redis']));require(_0x9926('0x19'))[_0x9926('0x1a')](socket);function respondWithStatusCode(_0x592036,_0x438b0a){_0x438b0a=_0x438b0a||0xcc;return function(_0x112935){if(_0x112935){return _0x592036['sendStatus'](_0x438b0a);}return _0x592036[_0x9926('0x1b')](_0x438b0a)[_0x9926('0x1c')]();};}function respondWithResult(_0x10449b,_0x7d134f){_0x7d134f=_0x7d134f||0xc8;return function(_0x16c7b3){if(_0x16c7b3){return _0x10449b['status'](_0x7d134f)[_0x9926('0x1d')](_0x16c7b3);}};}function respondWithFilteredResult(_0x5a9119,_0x29118d){return function(_0x1db120){if(_0x1db120){var _0x4a1de3=_0x1db120['count'],_0x1f34b9=_0x29118d[_0x9926('0x1e')],_0x5c742f=_0x29118d[_0x9926('0x1e')]+_0x29118d[_0x9926('0x1f')],_0x458568;if(_0x5c742f>=_0x4a1de3){_0x5c742f=_0x4a1de3;_0x458568=0xc8;}else{_0x458568=0xce;}_0x5a9119['status'](_0x458568);return _0x5a9119[_0x9926('0x20')]('Content-Range',_0x1f34b9+'-'+_0x5c742f+'/'+_0x4a1de3)[_0x9926('0x1d')](_0x1db120);}return null;};}function patchUpdates(_0xe9a374){return function(_0x401ce3){try{jsonpatch[_0x9926('0x21')](_0x401ce3,_0xe9a374,!![]);}catch(_0x9c756f){return BPromise[_0x9926('0x22')](_0x9c756f);}return _0x401ce3[_0x9926('0x23')]();};}function saveUpdates(_0x3a825b,_0x146de1){return function(_0xf99881){if(_0xf99881){return _0xf99881[_0x9926('0x24')](_0x3a825b)[_0x9926('0x25')](function(_0x5cd507){return _0x5cd507;});}return null;};}function removeEntity(_0x53ea10,_0x172f9b){return function(_0x3a90f9){if(_0x3a90f9){return _0x3a90f9[_0x9926('0x26')]()['then'](function(){var _0x56e86e=_0x3a90f9['get']({'plain':!![]});var _0x2938a0=_0x9926('0x27');return db[_0x9926('0x28')]['destroy']({'where':{'type':_0x2938a0,'resourceId':_0x56e86e['id']}})[_0x9926('0x25')](function(){return _0x3a90f9;});})['then'](function(){_0x53ea10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d7890,_0x5f533f){return function(_0x431326){if(!_0x431326){_0x5d7890['sendStatus'](0x194);}return _0x431326;};}function handleError(_0x405372,_0x310b5c){_0x310b5c=_0x310b5c||0x1f4;return function(_0x3db76f){logger[_0x9926('0x29')](_0x3db76f[_0x9926('0x2a')]);if(_0x3db76f[_0x9926('0x2b')]){delete _0x3db76f[_0x9926('0x2b')];}_0x405372['status'](_0x310b5c)[_0x9926('0x2c')](_0x3db76f);};}exports[_0x9926('0x2d')]=function(_0x1b7d8c,_0x13f723){var _0x46f070={},_0xa7955d={},_0x3c1417={'count':0x0,'rows':[]};var _0x5f3244=_['map'](db[_0x9926('0x2e')][_0x9926('0x2f')],function(_0x3992c7){return{'name':_0x3992c7[_0x9926('0x30')],'type':_0x3992c7[_0x9926('0x31')][_0x9926('0x32')]};});_0xa7955d[_0x9926('0x33')]=_[_0x9926('0x34')](_0x5f3244,_0x9926('0x2b'));_0xa7955d[_0x9926('0x35')]=_[_0x9926('0x36')](_0x1b7d8c[_0x9926('0x35')]);_0xa7955d[_0x9926('0x37')]=_[_0x9926('0x38')](_0xa7955d[_0x9926('0x33')],_0xa7955d['query']);_0x46f070[_0x9926('0x39')]=_[_0x9926('0x38')](_0xa7955d[_0x9926('0x33')],qs[_0x9926('0x3a')](_0x1b7d8c[_0x9926('0x35')][_0x9926('0x3a')]));_0x46f070[_0x9926('0x39')]=_0x46f070[_0x9926('0x39')][_0x9926('0x3b')]?_0x46f070[_0x9926('0x39')]:_0xa7955d[_0x9926('0x33')];if(!_0x1b7d8c['query'][_0x9926('0x3c')](_0x9926('0x3d'))){_0x46f070[_0x9926('0x1f')]=qs[_0x9926('0x1f')](_0x1b7d8c[_0x9926('0x35')][_0x9926('0x1f')]);_0x46f070[_0x9926('0x1e')]=qs[_0x9926('0x1e')](_0x1b7d8c[_0x9926('0x35')][_0x9926('0x1e')]);}_0x46f070[_0x9926('0x3e')]=qs[_0x9926('0x3f')](_0x1b7d8c['query'][_0x9926('0x3f')]);_0x46f070[_0x9926('0x40')]=qs[_0x9926('0x37')](_[_0x9926('0x41')](_0x1b7d8c[_0x9926('0x35')],_0xa7955d[_0x9926('0x37')]),_0x5f3244);if(_0x1b7d8c['query']['filter']){_0x46f070['where']=_[_0x9926('0x42')](_0x46f070[_0x9926('0x40')],{'$or':_[_0x9926('0x34')](_0x5f3244,function(_0x59c24d){if(_0x59c24d[_0x9926('0x31')]!=='VIRTUAL'){var _0x200ce1={};_0x200ce1[_0x59c24d['name']]={'$like':'%'+_0x1b7d8c[_0x9926('0x35')][_0x9926('0x43')]+'%'};return _0x200ce1;}})});}_0x46f070=_[_0x9926('0x42')]({},_0x46f070,_0x1b7d8c['options']);var _0x3efaea={'where':_0x46f070[_0x9926('0x40')]};return db['Team']['count'](_0x3efaea)[_0x9926('0x25')](function(_0x49fa0f){_0x3c1417['count']=_0x49fa0f;if(_0x1b7d8c['query'][_0x9926('0x44')]){_0x46f070[_0x9926('0x45')]=[{'all':!![]}];}return db[_0x9926('0x2e')]['findAll'](_0x46f070);})[_0x9926('0x25')](function(_0x2ee41b){_0x3c1417[_0x9926('0x46')]=_0x2ee41b;return _0x3c1417;})[_0x9926('0x25')](respondWithFilteredResult(_0x13f723,_0x46f070))[_0x9926('0x47')](handleError(_0x13f723,null));};exports[_0x9926('0x48')]=function(_0x14d159,_0x5d7d6c){var _0x1479fc={'raw':![],'where':{'id':_0x14d159[_0x9926('0x49')]['id']}},_0x1f82ec={};_0x1f82ec['model']=_[_0x9926('0x36')](db[_0x9926('0x2e')][_0x9926('0x2f')]);_0x1f82ec['query']=_['keys'](_0x14d159[_0x9926('0x35')]);_0x1f82ec[_0x9926('0x37')]=_[_0x9926('0x38')](_0x1f82ec['model'],_0x1f82ec[_0x9926('0x35')]);_0x1479fc[_0x9926('0x39')]=_[_0x9926('0x38')](_0x1f82ec[_0x9926('0x33')],qs[_0x9926('0x3a')](_0x14d159[_0x9926('0x35')][_0x9926('0x3a')]));_0x1479fc[_0x9926('0x39')]=_0x1479fc[_0x9926('0x39')]['length']?_0x1479fc['attributes']:_0x1f82ec[_0x9926('0x33')];if(_0x14d159[_0x9926('0x35')][_0x9926('0x44')]){_0x1479fc[_0x9926('0x45')]=[{'all':!![]}];}_0x1479fc=_[_0x9926('0x42')]({},_0x1479fc,_0x14d159[_0x9926('0x4a')]);return db[_0x9926('0x2e')][_0x9926('0x4b')](_0x1479fc)[_0x9926('0x25')](handleEntityNotFound(_0x5d7d6c,null))[_0x9926('0x25')](respondWithResult(_0x5d7d6c,null))[_0x9926('0x47')](handleError(_0x5d7d6c,null));};exports['create']=function(_0x3466fa,_0x3c1c33){return db[_0x9926('0x2e')][_0x9926('0x4c')](_0x3466fa[_0x9926('0x4d')],{})[_0x9926('0x25')](function(_0x2ac71c){var _0x17b62e=_0x3466fa[_0x9926('0x4e')][_0x9926('0x4f')]({'plain':!![]});if(!_0x17b62e)throw new Error(_0x9926('0x50'));if(_0x17b62e[_0x9926('0x51')]===_0x9926('0x4e')){var _0x1411b3=_0x2ac71c[_0x9926('0x4f')]({'plain':!![]});var _0xb216e7=_0x9926('0x27');return db[_0x9926('0x52')]['find']({'where':{'name':_0xb216e7,'userProfileId':_0x17b62e[_0x9926('0x53')]},'raw':!![]})[_0x9926('0x25')](function(_0x58143b){if(_0x58143b&&_0x58143b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1411b3[_0x9926('0x2b')],'resourceId':_0x1411b3['id'],'type':_0x58143b['name'],'sectionId':_0x58143b['id']},{})[_0x9926('0x25')](function(){return _0x2ac71c;});}else{return _0x2ac71c;}})[_0x9926('0x47')](function(_0x11e543){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11e543);throw _0x11e543;});}return _0x2ac71c;})['then'](respondWithResult(_0x3c1c33,0xc9))['catch'](handleError(_0x3c1c33,null));};exports['update']=function(_0x279cc4,_0x4505b9){if(_0x279cc4[_0x9926('0x4d')]['id']){delete _0x279cc4[_0x9926('0x4d')]['id'];}return db[_0x9926('0x2e')][_0x9926('0x4b')]({'where':{'id':_0x279cc4[_0x9926('0x49')]['id']}})['then'](handleEntityNotFound(_0x4505b9,null))['then'](saveUpdates(_0x279cc4['body'],null))[_0x9926('0x25')](respondWithResult(_0x4505b9,null))['catch'](handleError(_0x4505b9,null));};exports[_0x9926('0x26')]=function(_0x29a7e1,_0x40d008){return db[_0x9926('0x2e')][_0x9926('0x4b')]({'where':{'id':_0x29a7e1[_0x9926('0x49')]['id']}})[_0x9926('0x25')](handleEntityNotFound(_0x40d008,null))[_0x9926('0x25')](removeEntity(_0x40d008,null))[_0x9926('0x47')](handleError(_0x40d008,null));};exports['getQueues']=function(_0x4aa18a,_0x43a2be,_0x4d82ee){return db[_0x9926('0x2e')][_0x9926('0x54')]({'where':{'id':_0x4aa18a[_0x9926('0x49')]['id']}})[_0x9926('0x25')](handleEntityNotFound(_0x43a2be,null))[_0x9926('0x25')](function(_0x1657b5){if(!_0x4aa18a['query']['channel']||!utils[_0x9926('0x55')](_0x4aa18a[_0x9926('0x35')][_0x9926('0x56')])){throw new db['Sequelize'][(_0x9926('0x57'))](_0x9926('0x58'));}var _0x1042a9={};var _0x21dcce={};_0x21dcce[_0x9926('0x33')]=_[_0x9926('0x36')](db[_['capitalize'](_0x4aa18a['query'][_0x9926('0x56')][_0x9926('0x59')]())+'Queue'][_0x9926('0x2f')]);_0x21dcce[_0x9926('0x35')]=_['keys'](_0x4aa18a[_0x9926('0x35')]);_0x21dcce[_0x9926('0x37')]=_[_0x9926('0x38')](_0x21dcce[_0x9926('0x33')],_0x21dcce[_0x9926('0x35')]);_0x1042a9['attributes']=_[_0x9926('0x38')](_0x21dcce[_0x9926('0x33')],qs[_0x9926('0x3a')](_0x4aa18a['query'][_0x9926('0x3a')]));_0x1042a9['attributes']=_0x1042a9[_0x9926('0x39')][_0x9926('0x3b')]?_0x1042a9[_0x9926('0x39')]:_0x21dcce[_0x9926('0x33')];_0x1042a9[_0x9926('0x1f')]=qs['limit'](_0x4aa18a[_0x9926('0x35')][_0x9926('0x1f')]);_0x1042a9[_0x9926('0x1e')]=qs[_0x9926('0x1e')](_0x4aa18a[_0x9926('0x35')][_0x9926('0x1e')]);_0x1042a9[_0x9926('0x3e')]=qs[_0x9926('0x3f')](_0x4aa18a[_0x9926('0x35')][_0x9926('0x3f')]);_0x1042a9[_0x9926('0x40')]=qs[_0x9926('0x37')](_[_0x9926('0x41')](_0x4aa18a[_0x9926('0x35')],_0x21dcce['filters']));_0x1042a9=_[_0x9926('0x42')]({},_0x1042a9,_0x4aa18a[_0x9926('0x4a')]);return _0x1657b5[_0x9926('0x4f')+_[_0x9926('0x5a')](_0x4aa18a[_0x9926('0x35')][_0x9926('0x56')][_0x9926('0x59')]())+_0x9926('0x5b')](_0x1042a9);})[_0x9926('0x25')](respondWithResult(_0x43a2be,null))[_0x9926('0x47')](handleError(_0x43a2be,null));};exports[_0x9926('0x5c')]=function(_0x475a29,_0x3c0cc9,_0x2eb55d){return db[_0x9926('0x2e')][_0x9926('0x54')]({'where':{'id':_0x475a29[_0x9926('0x49')]['id']}})['then'](function(_0x1c8319){if(_0x1c8319){if(!_0x475a29['body'][_0x9926('0x56')]||!utils[_0x9926('0x55')](_0x475a29['body'][_0x9926('0x56')])){throw new db[(_0x9926('0x5d'))][(_0x9926('0x57'))]('Unknown\x20channel');}return _0x1c8319['add'+_[_0x9926('0x5a')](_0x475a29[_0x9926('0x4d')]['channel']['toLowerCase']())+'Queues'](_0x475a29[_0x9926('0x4d')][_0x9926('0x5e')]);}return null;})[_0x9926('0x25')](handleEntityNotFound(_0x3c0cc9,null))['then'](respondWithStatusCode(_0x3c0cc9,null))[_0x9926('0x47')](handleError(_0x3c0cc9,null));};exports[_0x9926('0x5f')]=function(_0x2d6089,_0x3ffb96,_0x2b1c4e){return db[_0x9926('0x2e')]['findOne']({'where':{'id':_0x2d6089[_0x9926('0x49')]['id']}})[_0x9926('0x25')](function(_0x533d22){if(_0x533d22){if(!_0x2d6089[_0x9926('0x35')]['channel']||!utils[_0x9926('0x55')](_0x2d6089[_0x9926('0x35')][_0x9926('0x56')])){throw new db[(_0x9926('0x5d'))][(_0x9926('0x57'))]('Unknown\x20channel');}return _0x533d22[_0x9926('0x60')+_[_0x9926('0x5a')](_0x2d6089[_0x9926('0x35')]['channel'][_0x9926('0x59')]())+_0x9926('0x5b')](_0x2d6089[_0x9926('0x35')][_0x9926('0x5e')]);}return null;})[_0x9926('0x25')](handleEntityNotFound(_0x3ffb96,null))[_0x9926('0x25')](respondWithStatusCode(_0x3ffb96,null))[_0x9926('0x47')](handleError(_0x3ffb96,null));};exports['addAgents']=function(_0x5e111f,_0x128130,_0x58df23){return db[_0x9926('0x2e')][_0x9926('0x4b')]({'where':{'id':_0x5e111f[_0x9926('0x49')]['id']}})[_0x9926('0x25')](handleEntityNotFound(_0x128130,null))['then'](function(_0x28ae5c){if(_0x28ae5c){var _0x1e67da=[_0x9926('0x61'),_0x9926('0x62'),'Mail',_0x9926('0x63'),_0x9926('0x64'),'Openchannel',_0x9926('0x65')];return BPromise['each'](_0x1e67da,function(_0xdce74d){return _0x28ae5c['get'+_0xdce74d+_0x9926('0x5b')]({'attributes':['id','name']})['then'](function(_0x54ed4a){return BPromise[_0x9926('0x66')](_0x54ed4a,function(_0xfabb39){return _0xfabb39[_0x9926('0x67')](_0x5e111f[_0x9926('0x4d')]['ids'])[_0x9926('0x25')](function(){if(_0xdce74d===_0x9926('0x61')){return db[_0x9926('0x68')][_0x9926('0x69')]({'where':{'id':_0x5e111f[_0x9926('0x4d')][_0x9926('0x5e')]},'attributes':['id',_0x9926('0x2b'),'online',_0x9926('0x6a'),_0x9926('0x6b')],'raw':!![]})['then'](function(_0x11f950){return BPromise[_0x9926('0x66')](_[_0x9926('0x43')](_0x11f950,{'online':0x1}),function(_0x5aee79){return db['UserVoiceQueueRt'][_0x9926('0x6c')]({'membername':_0x5aee79[_0x9926('0x2b')],'UserId':_0x5aee79['id'],'queue_name':_0xfabb39[_0x9926('0x2b')],'VoiceQueueId':_0xfabb39['id'],'interface':_[_0x9926('0x6d')](_0x5aee79[_0x9926('0x6b')])?util[_0x9926('0x6e')]('SIP/%s',_0x5aee79['name']):_0x5aee79[_0x9926('0x6b')],'paused':_0x5aee79[_0x9926('0x6a')]||![],'penalty':0x0});});});}});});})[_0x9926('0x25')](function(){return _0x28ae5c;});})[_0x9926('0x25')](function(){return _0x28ae5c;});}})[_0x9926('0x25')](function(_0x368b1d){if(_0x368b1d){return _0x368b1d[_0x9926('0x67')](_0x5e111f[_0x9926('0x4d')][_0x9926('0x5e')],_[_0x9926('0x6f')](_0x5e111f[_0x9926('0x4d')],[_0x9926('0x5e'),'id'])||{})[_0x9926('0x70')](function(_0x501dbe){for(var _0x401a5f=0x0;_0x401a5f<_0x5e111f[_0x9926('0x4d')][_0x9926('0x5e')][_0x9926('0x3b')];_0x401a5f+=0x1){socket[_0x9926('0x71')](_0x9926('0x72'),{'UserId':_0x5e111f['body'][_0x9926('0x5e')][_0x401a5f],'TeamId':_0x5e111f[_0x9926('0x49')]['id']});}return _0x501dbe;});}})[_0x9926('0x25')](respondWithResult(_0x128130,null))['catch'](handleError(_0x128130,null));};exports[_0x9926('0x73')]=function(_0x3f23a6,_0xfe0bc3,_0x69eee0){return db[_0x9926('0x2e')][_0x9926('0x4b')]({'where':{'id':_0x3f23a6[_0x9926('0x49')]['id']}})[_0x9926('0x25')](handleEntityNotFound(_0xfe0bc3,null))[_0x9926('0x25')](function(_0x130080){if(_0x130080){return BPromise['each']([_0x9926('0x74'),_0x9926('0x75'),_0x9926('0x76'),'sms',_0x9926('0x77'),_0x9926('0x78'),_0x9926('0x79')],function(_0x33b486){return _0x130080[_0x9926('0x4f')+_[_0x9926('0x5a')](_0x33b486)+_0x9926('0x5b')]({'attributes':['id',_0x9926('0x2b')]})[_0x9926('0x25')](function(_0x5d40c7){return BPromise[_0x9926('0x66')](_0x5d40c7,function(_0x114e57){return _0x114e57[_0x9926('0x73')](_0x3f23a6['query'][_0x9926('0x5e')])[_0x9926('0x25')](function(){if(_0x33b486===_0x9926('0x74')){return db[_0x9926('0x7a')][_0x9926('0x26')]({'where':{'VoiceQueueId':_0x114e57['id'],'UserId':_0x3f23a6[_0x9926('0x35')][_0x9926('0x5e')]}});}});});})['then'](function(){return _0x130080;});})['then'](function(){return _0x130080;});}})['then'](function(_0x47a9bc){if(_0x47a9bc){return _0x47a9bc['removeAgents'](_0x3f23a6[_0x9926('0x35')][_0x9926('0x5e')])['then'](function(){if(_['isArray'](_0x3f23a6['query'][_0x9926('0x5e')])){for(var _0x21a0f7=0x0;_0x21a0f7<_0x3f23a6[_0x9926('0x35')][_0x9926('0x5e')][_0x9926('0x3b')];_0x21a0f7+=0x1){socket['emit']('userTeam:remove',{'UserId':Number(_0x3f23a6[_0x9926('0x35')][_0x9926('0x5e')][_0x21a0f7]),'TeamId':Number(_0x3f23a6[_0x9926('0x49')]['id'])});}}else{socket[_0x9926('0x71')](_0x9926('0x7b'),{'UserId':Number(_0x3f23a6[_0x9926('0x35')]['ids']),'TeamId':Number(_0x3f23a6[_0x9926('0x49')]['id'])});}});}})[_0x9926('0x25')](respondWithStatusCode(_0xfe0bc3,null))[_0x9926('0x47')](handleError(_0xfe0bc3,null));};exports[_0x9926('0x7c')]=function(_0x3db59a,_0x261c13,_0x47f4f4){var _0x4a67e7={};var _0x6d43d7={};var _0x419276;var _0x178400;return db[_0x9926('0x2e')]['findOne']({'where':{'id':_0x3db59a[_0x9926('0x49')]['id']}})[_0x9926('0x25')](handleEntityNotFound(_0x261c13,null))[_0x9926('0x25')](function(_0x503b31){if(_0x503b31){_0x419276=_0x503b31;_0x6d43d7['model']=_[_0x9926('0x36')](db[_0x9926('0x68')][_0x9926('0x2f')]);_0x6d43d7[_0x9926('0x35')]=_[_0x9926('0x36')](_0x3db59a['query']);_0x6d43d7[_0x9926('0x37')]=_[_0x9926('0x38')](_0x6d43d7[_0x9926('0x33')],_0x6d43d7[_0x9926('0x35')]);_0x4a67e7[_0x9926('0x39')]=_['intersection'](_0x6d43d7[_0x9926('0x33')],qs[_0x9926('0x3a')](_0x3db59a['query'][_0x9926('0x3a')]));_0x4a67e7[_0x9926('0x39')]=_0x4a67e7[_0x9926('0x39')][_0x9926('0x3b')]?_0x4a67e7[_0x9926('0x39')]:_0x6d43d7[_0x9926('0x33')];_0x4a67e7['order']=qs[_0x9926('0x3f')](_0x3db59a[_0x9926('0x35')][_0x9926('0x3f')]);_0x4a67e7[_0x9926('0x40')]=qs[_0x9926('0x37')](_['pick'](_0x3db59a[_0x9926('0x35')],_0x6d43d7[_0x9926('0x37')]));if(_0x3db59a[_0x9926('0x35')][_0x9926('0x43')]){_0x4a67e7[_0x9926('0x40')]=_[_0x9926('0x42')](_0x4a67e7[_0x9926('0x40')],{'$or':_[_0x9926('0x34')](_0x4a67e7[_0x9926('0x39')],function(_0x48af0d){var _0x155cf2={};_0x155cf2[_0x48af0d]={'$like':'%'+_0x3db59a[_0x9926('0x35')]['filter']+'%'};return _0x155cf2;})});}_0x4a67e7=_[_0x9926('0x42')]({},_0x4a67e7,_0x3db59a['options']);return _0x419276['getAgents'](_0x4a67e7);}})[_0x9926('0x25')](function(_0x9643ae){if(_0x9643ae){_0x178400=_0x9643ae[_0x9926('0x3b')];if(!_0x3db59a[_0x9926('0x35')][_0x9926('0x3c')](_0x9926('0x3d'))){_0x4a67e7['limit']=qs[_0x9926('0x1f')](_0x3db59a[_0x9926('0x35')][_0x9926('0x1f')]);_0x4a67e7[_0x9926('0x1e')]=qs[_0x9926('0x1e')](_0x3db59a['query']['offset']);}return _0x419276[_0x9926('0x7c')](_0x4a67e7);}})[_0x9926('0x25')](function(_0x1067bd){if(_0x1067bd){return _0x1067bd?{'count':_0x178400,'rows':_0x1067bd}:null;}})[_0x9926('0x25')](respondWithResult(_0x261c13,null))['catch'](handleError(_0x261c13,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d3b0bbe..5c0e19a 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 _0xbc93=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3b642c,_0x5443cf){var _0x2f6afe=function(_0x5e0388){while(--_0x5e0388){_0x3b642c['push'](_0x3b642c['shift']());}};_0x2f6afe(++_0x5443cf);}(_0xbc93,0x84));var _0x3bc9=function(_0x529139,_0x45d5eb){_0x529139=_0x529139-0x0;var _0x4daddf=_0xbc93[_0x529139];return _0x4daddf;};'use strict';var EventEmitter=require(_0x3bc9('0x0'));var Team=require(_0x3bc9('0x1'))['db'][_0x3bc9('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x3bc9('0x3')](0x0);var events={'afterCreate':_0x3bc9('0x4'),'afterUpdate':_0x3bc9('0x5'),'afterDestroy':_0x3bc9('0x6')};function emitEvent(_0x39ec5e){return function(_0x3bbc4b,_0x333ef5,_0x30c50b){TeamEvents['emit'](_0x39ec5e+':'+_0x3bbc4b['id'],_0x3bbc4b);TeamEvents[_0x3bc9('0x7')](_0x39ec5e,_0x3bbc4b);_0x30c50b(null);};}for(var e in events){if(events[_0x3bc9('0x8')](e)){var event=events[e];Team[_0x3bc9('0x9')](e,emitEvent(event));}}module[_0x3bc9('0xa')]=TeamEvents; \ No newline at end of file +var _0xe050=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5d0920,_0x21acfd){var _0x228d53=function(_0x153792){while(--_0x153792){_0x5d0920['push'](_0x5d0920['shift']());}};_0x228d53(++_0x21acfd);}(_0xe050,0x11d));var _0x0e05=function(_0x21ea97,_0x5bb5b1){_0x21ea97=_0x21ea97-0x0;var _0x1f5400=_0xe050[_0x21ea97];return _0x1f5400;};'use strict';var EventEmitter=require(_0x0e05('0x0'));var Team=require(_0x0e05('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x0e05('0x2')](0x0);var events={'afterCreate':_0x0e05('0x3'),'afterUpdate':'update','afterDestroy':_0x0e05('0x4')};function emitEvent(_0x1d34df){return function(_0x3ff9fe,_0x1eefb6,_0x5b9356){TeamEvents[_0x0e05('0x5')](_0x1d34df+':'+_0x3ff9fe['id'],_0x3ff9fe);TeamEvents[_0x0e05('0x5')](_0x1d34df,_0x3ff9fe);_0x5b9356(null);};}for(var e in events){if(events[_0x0e05('0x6')](e)){var event=events[e];Team[_0x0e05('0x7')](e,emitEvent(event));}}module[_0x0e05('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c44959b..249e67b 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 _0x8b8d=['define','Team','teams','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./team.attributes'];(function(_0x213ed5,_0x26712a){var _0x191514=function(_0x2d9305){while(--_0x2d9305){_0x213ed5['push'](_0x213ed5['shift']());}};_0x191514(++_0x26712a);}(_0x8b8d,0xb7));var _0xd8b8=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x8b8d[_0x32d457];return _0x338386;};'use strict';var _=require(_0xd8b8('0x0'));var util=require(_0xd8b8('0x1'));var logger=require('../../config/logger')(_0xd8b8('0x2'));var moment=require(_0xd8b8('0x3'));var BPromise=require(_0xd8b8('0x4'));var rp=require(_0xd8b8('0x5'));var fs=require('fs');var path=require(_0xd8b8('0x6'));var rimraf=require(_0xd8b8('0x7'));var config=require('../../config/environment');var attributes=require(_0xd8b8('0x8'));module['exports']=function(_0x646abc,_0x7c62b8){return _0x646abc[_0xd8b8('0x9')](_0xd8b8('0xa'),attributes,{'tableName':_0xd8b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x953f=['bluebird','request-promise','rimraf','../../config/environment','exports','Team','teams','util','api','moment'];(function(_0x15057d,_0x2e0816){var _0x195a14=function(_0x26e6d5){while(--_0x26e6d5){_0x15057d['push'](_0x15057d['shift']());}};_0x195a14(++_0x2e0816);}(_0x953f,0x6b));var _0xf953=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x953f[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0xf953('0x0'));var logger=require('../../config/logger')(_0xf953('0x1'));var moment=require(_0xf953('0x2'));var BPromise=require(_0xf953('0x3'));var rp=require(_0xf953('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf953('0x5'));var config=require(_0xf953('0x6'));var attributes=require('./team.attributes');module[_0xf953('0x7')]=function(_0x275d55,_0x4fc864){return _0x275d55['define'](_0xf953('0x8'),attributes,{'tableName':_0xf953('0x9'),'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 69f4f48..1057b81 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 _0xba80=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2be7c4,_0x1ea460){var _0x15ec92=function(_0x515948){while(--_0x515948){_0x2be7c4['push'](_0x2be7c4['shift']());}};_0x15ec92(++_0x1ea460);}(_0xba80,0x127));var _0x0ba8=function(_0x469ed5,_0x168429){_0x469ed5=_0x469ed5-0x0;var _0x398c14=_0xba80[_0x469ed5];return _0x398c14;};'use strict';var _=require(_0x0ba8('0x0'));var util=require(_0x0ba8('0x1'));var moment=require(_0x0ba8('0x2'));var BPromise=require(_0x0ba8('0x3'));var rs=require(_0x0ba8('0x4'));var fs=require('fs');var Redis=require(_0x0ba8('0x5'));var db=require(_0x0ba8('0x6'))['db'];var utils=require(_0x0ba8('0x7'));var logger=require(_0x0ba8('0x8'))(_0x0ba8('0x9'));var config=require(_0x0ba8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0ba8('0xb')][_0x0ba8('0xc')]({'port':0x232a});config[_0x0ba8('0xd')]=_['defaults'](config[_0x0ba8('0xd')],{'host':_0x0ba8('0xe'),'port':0x18eb});var socket=require(_0x0ba8('0xf'))(new Redis(config['redis']));require(_0x0ba8('0x10'))['register'](socket);function respondWithRpcPromise(_0x47d46e,_0x2999ca,_0x41b45c){return new BPromise(function(_0x5d75c8,_0x100272){return client[_0x0ba8('0x11')](_0x47d46e,_0x41b45c)[_0x0ba8('0x12')](function(_0xffb1cb){logger[_0x0ba8('0x13')](_0x0ba8('0x14'),_0x2999ca,_0x0ba8('0x15'));logger[_0x0ba8('0x16')](_0x0ba8('0x17'),_0x2999ca,_0x0ba8('0x15'),JSON[_0x0ba8('0x18')](_0xffb1cb));if(_0xffb1cb['error']){if(_0xffb1cb[_0x0ba8('0x19')][_0x0ba8('0x1a')]===0x1f4){logger[_0x0ba8('0x19')](_0x0ba8('0x14'),_0x2999ca,_0xffb1cb[_0x0ba8('0x19')][_0x0ba8('0x1b')]);return _0x100272(_0xffb1cb[_0x0ba8('0x19')]['message']);}logger['error'](_0x0ba8('0x14'),_0x2999ca,_0xffb1cb[_0x0ba8('0x19')][_0x0ba8('0x1b')]);return _0x5d75c8(_0xffb1cb[_0x0ba8('0x19')]['message']);}else{logger[_0x0ba8('0x13')](_0x0ba8('0x14'),_0x2999ca,_0x0ba8('0x15'));_0x5d75c8(_0xffb1cb[_0x0ba8('0x1c')][_0x0ba8('0x1b')]);}})[_0x0ba8('0x1d')](function(_0x242d9f){logger['error'](_0x0ba8('0x14'),_0x2999ca,_0x242d9f);_0x100272(_0x242d9f);});});} \ No newline at end of file +var _0x1e06=['Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','socket.io-emitter','redis','register','request','then','info'];(function(_0x5b2f14,_0x28fbb7){var _0x2a7b29=function(_0x1b7a08){while(--_0x1b7a08){_0x5b2f14['push'](_0x5b2f14['shift']());}};_0x2a7b29(++_0x28fbb7);}(_0x1e06,0xd0));var _0x61e0=function(_0x29b9b4,_0x4fdf69){_0x29b9b4=_0x29b9b4-0x0;var _0x47c064=_0x1e06[_0x29b9b4];return _0x47c064;};'use strict';var _=require(_0x61e0('0x0'));var util=require(_0x61e0('0x1'));var moment=require(_0x61e0('0x2'));var BPromise=require(_0x61e0('0x3'));var rs=require(_0x61e0('0x4'));var fs=require('fs');var Redis=require(_0x61e0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61e0('0x6'))(_0x61e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x61e0('0x8'));var client=jayson[_0x61e0('0x9')][_0x61e0('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x61e0('0xb'))(new Redis(config[_0x61e0('0xc')]));require('./team.socket')[_0x61e0('0xd')](socket);function respondWithRpcPromise(_0x27063b,_0x42c6cf,_0x1b0593){return new BPromise(function(_0x5638e9,_0x3cb5a0){return client[_0x61e0('0xe')](_0x27063b,_0x1b0593)[_0x61e0('0xf')](function(_0x356abf){logger[_0x61e0('0x10')](_0x61e0('0x11'),_0x42c6cf,_0x61e0('0x12'));logger['debug'](_0x61e0('0x13'),_0x42c6cf,_0x61e0('0x12'),JSON[_0x61e0('0x14')](_0x356abf));if(_0x356abf[_0x61e0('0x15')]){if(_0x356abf[_0x61e0('0x15')][_0x61e0('0x16')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x42c6cf,_0x356abf[_0x61e0('0x15')]['message']);return _0x3cb5a0(_0x356abf[_0x61e0('0x15')][_0x61e0('0x17')]);}logger[_0x61e0('0x15')](_0x61e0('0x11'),_0x42c6cf,_0x356abf[_0x61e0('0x15')][_0x61e0('0x17')]);return _0x5638e9(_0x356abf[_0x61e0('0x15')]['message']);}else{logger[_0x61e0('0x10')](_0x61e0('0x11'),_0x42c6cf,'request\x20sent');_0x5638e9(_0x356abf[_0x61e0('0x18')][_0x61e0('0x17')]);}})['catch'](function(_0x596dc2){logger[_0x61e0('0x15')](_0x61e0('0x11'),_0x42c6cf,_0x596dc2);_0x3cb5a0(_0x596dc2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d2c8ef5..91f248a 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 _0xc1fc=['save','remove','emit','removeListener','register','length','team:'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc1fc,0x93));var _0xcc1f=function(_0x5443f1,_0x1af620){_0x5443f1=_0x5443f1-0x0;var _0x52d334=_0xc1fc[_0x5443f1];return _0x52d334;};'use strict';var TeamEvents=require('./team.events');var events=[_0xcc1f('0x0'),_0xcc1f('0x1'),'update'];function createListener(_0xe9fa4f,_0xcb1f19){return function(_0x35ef51){_0xcb1f19[_0xcc1f('0x2')](_0xe9fa4f,_0x35ef51);};}function removeListener(_0x26d3b2,_0x52703d){return function(){TeamEvents[_0xcc1f('0x3')](_0x26d3b2,_0x52703d);};}exports[_0xcc1f('0x4')]=function(_0x493a97){for(var _0x5f448b=0x0,_0x376348=events[_0xcc1f('0x5')];_0x5f448b<_0x376348;_0x5f448b++){var _0x431ca8=events[_0x5f448b];var _0x123b7d=createListener(_0xcc1f('0x6')+_0x431ca8,_0x493a97);TeamEvents['on'](_0x431ca8,_0x123b7d);}}; \ No newline at end of file +var _0xf970=['team:','./team.events','remove','update','emit','removeListener','register','length'];(function(_0x1af322,_0x16d095){var _0x28ac48=function(_0x32a921){while(--_0x32a921){_0x1af322['push'](_0x1af322['shift']());}};_0x28ac48(++_0x16d095);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var TeamEvents=require(_0x0f97('0x0'));var events=['save',_0x0f97('0x1'),_0x0f97('0x2')];function createListener(_0x435e89,_0x1144ca){return function(_0x1b1ab7){_0x1144ca[_0x0f97('0x3')](_0x435e89,_0x1b1ab7);};}function removeListener(_0x439149,_0x4ab74d){return function(){TeamEvents[_0x0f97('0x4')](_0x439149,_0x4ab74d);};}exports[_0x0f97('0x5')]=function(_0x290200){for(var _0xac501=0x0,_0x2e3515=events[_0x0f97('0x6')];_0xac501<_0x2e3515;_0xac501++){var _0x12fbb3=events[_0xac501];var _0x374083=createListener(_0x0f97('0x7')+_0x12fbb3,_0x290200);TeamEvents['on'](_0x12fbb3,_0x374083);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b708bcd..d6ecbc6 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 _0x799e=['create','put','update','delete','destroy','util','path','connect-timeout','../../components/interaction/service','./template.controller','get','isAuthenticated','/:id','show','post'];(function(_0x13a125,_0x17b337){var _0x20f5d6=function(_0x384e42){while(--_0x384e42){_0x13a125['push'](_0x13a125['shift']());}};_0x20f5d6(++_0x17b337);}(_0x799e,0xb9));var _0xe799=function(_0x3627ca,_0x2b15db){_0x3627ca=_0x3627ca-0x0;var _0x11c329=_0x799e[_0x3627ca];return _0x11c329;};'use strict';var multer=require('multer');var util=require(_0xe799('0x0'));var path=require(_0xe799('0x1'));var timeout=require(_0xe799('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe799('0x3'));var config=require('../../config/environment');var controller=require(_0xe799('0x4'));router[_0xe799('0x5')]('/',auth[_0xe799('0x6')](),controller['index']);router['get'](_0xe799('0x7'),auth[_0xe799('0x6')](),controller[_0xe799('0x8')]);router[_0xe799('0x9')]('/',auth['isAuthenticated'](),controller[_0xe799('0xa')]);router[_0xe799('0xb')](_0xe799('0x7'),auth['isAuthenticated'](),controller[_0xe799('0xc')]);router[_0xe799('0xd')](_0xe799('0x7'),auth[_0xe799('0x6')](),controller[_0xe799('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4eb7=['delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./template.controller','get','index','show','post','isAuthenticated','create','put','/:id','update'];(function(_0x926950,_0x47cd22){var _0x130009=function(_0xaf4287){while(--_0xaf4287){_0x926950['push'](_0x926950['shift']());}};_0x130009(++_0x47cd22);}(_0x4eb7,0x1ca));var _0x74eb=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x4eb7[_0x381589];return _0x2a075d;};'use strict';var multer=require(_0x74eb('0x0'));var util=require(_0x74eb('0x1'));var path=require(_0x74eb('0x2'));var timeout=require(_0x74eb('0x3'));var express=require(_0x74eb('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x74eb('0x5'));var config=require(_0x74eb('0x6'));var controller=require(_0x74eb('0x7'));router[_0x74eb('0x8')]('/',auth['isAuthenticated'](),controller[_0x74eb('0x9')]);router[_0x74eb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x74eb('0xa')]);router[_0x74eb('0xb')]('/',auth[_0x74eb('0xc')](),controller[_0x74eb('0xd')]);router[_0x74eb('0xe')](_0x74eb('0xf'),auth[_0x74eb('0xc')](),controller[_0x74eb('0x10')]);router[_0x74eb('0x11')]('/:id',auth[_0x74eb('0xc')](),controller[_0x74eb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index eed4965..fbd5c33 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 _0x9f6d=['sequelize','exports','STRING','TEXT'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9f6d,0x140));var _0xd9f6=function(_0xc5f619,_0x4484ab){_0xc5f619=_0xc5f619-0x0;var _0x423984=_0x9f6d[_0xc5f619];return _0x423984;};'use strict';var Sequelize=require(_0xd9f6('0x0'));module[_0xd9f6('0x1')]={'name':{'type':Sequelize[_0xd9f6('0x2')]},'description':{'type':Sequelize[_0xd9f6('0x2')]},'html':{'type':Sequelize[_0xd9f6('0x3')]}}; \ No newline at end of file +var _0x28a5=['TEXT','sequelize','exports','STRING'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x28a5,0x6d));var _0x528a=function(_0x300b26,_0x3a9b67){_0x300b26=_0x300b26-0x0;var _0x5cb1ae=_0x28a5[_0x300b26];return _0x5cb1ae;};'use strict';var Sequelize=require(_0x528a('0x0'));module[_0x528a('0x1')]={'name':{'type':Sequelize[_0x528a('0x2')]},'description':{'type':Sequelize[_0x528a('0x2')]},'html':{'type':Sequelize[_0x528a('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b08c4de..7ff45d9 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 _0xaaae=['update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','rawAttributes','intersection','Template','find','create','body','role','user','Templates','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xaaae,0x86));var _0xeaaa=function(_0x444067,_0x5d8a51){_0x444067=_0x444067-0x0;var _0x1162be=_0xaaae[_0x444067];return _0x1162be;};'use strict';var pdf=require(_0xeaaa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeaaa('0x1'));var zipdir=require(_0xeaaa('0x2'));var jsonpatch=require(_0xeaaa('0x3'));var rp=require(_0xeaaa('0x4'));var moment=require(_0xeaaa('0x5'));var BPromise=require(_0xeaaa('0x6'));var Mustache=require(_0xeaaa('0x7'));var util=require(_0xeaaa('0x8'));var path=require('path');var sox=require(_0xeaaa('0x9'));var csv=require(_0xeaaa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeaaa('0xb'));var squel=require('squel');var crypto=require(_0xeaaa('0xc'));var jsforce=require(_0xeaaa('0xd'));var deskjs=require(_0xeaaa('0xe'));var toCsv=require(_0xeaaa('0xa'));var querystring=require(_0xeaaa('0xf'));var Papa=require(_0xeaaa('0x10'));var Redis=require(_0xeaaa('0x11'));var authService=require(_0xeaaa('0x12'));var qs=require(_0xeaaa('0x13'));var as=require(_0xeaaa('0x14'));var hardwareService=require(_0xeaaa('0x15'));var logger=require(_0xeaaa('0x16'))(_0xeaaa('0x17'));var utils=require(_0xeaaa('0x18'));var config=require(_0xeaaa('0x19'));var db=require(_0xeaaa('0x1a'))['db'];function respondWithStatusCode(_0x1c7c48,_0x414a87){_0x414a87=_0x414a87||0xcc;return function(_0x1a7d16){if(_0x1a7d16){return _0x1c7c48[_0xeaaa('0x1b')](_0x414a87);}return _0x1c7c48[_0xeaaa('0x1c')](_0x414a87)[_0xeaaa('0x1d')]();};}function respondWithResult(_0x6672ba,_0xb177b2){_0xb177b2=_0xb177b2||0xc8;return function(_0x1c7598){if(_0x1c7598){return _0x6672ba['status'](_0xb177b2)[_0xeaaa('0x1e')](_0x1c7598);}};}function respondWithFilteredResult(_0xb8416a,_0x1ae871){return function(_0x544818){if(_0x544818){var _0x12b29d=_0x544818['count'],_0x41e7f7=_0x1ae871[_0xeaaa('0x1f')],_0x4429f4=_0x1ae871['offset']+_0x1ae871[_0xeaaa('0x20')],_0x12ca87;if(_0x4429f4>=_0x12b29d){_0x4429f4=_0x12b29d;_0x12ca87=0xc8;}else{_0x12ca87=0xce;}_0xb8416a[_0xeaaa('0x1c')](_0x12ca87);return _0xb8416a[_0xeaaa('0x21')](_0xeaaa('0x22'),_0x41e7f7+'-'+_0x4429f4+'/'+_0x12b29d)[_0xeaaa('0x1e')](_0x544818);}return null;};}function patchUpdates(_0x5840d8){return function(_0x227882){try{jsonpatch[_0xeaaa('0x23')](_0x227882,_0x5840d8,!![]);}catch(_0x23442d){return BPromise[_0xeaaa('0x24')](_0x23442d);}return _0x227882[_0xeaaa('0x25')]();};}function saveUpdates(_0x3eb767,_0x433315){return function(_0x107b4e){if(_0x107b4e){return _0x107b4e[_0xeaaa('0x26')](_0x3eb767)[_0xeaaa('0x27')](function(_0x478df8){return _0x478df8;});}return null;};}function removeEntity(_0x103b1d,_0xbc20d3){return function(_0x3b7179){if(_0x3b7179){return _0x3b7179[_0xeaaa('0x28')]()[_0xeaaa('0x27')](function(){var _0x3de221=_0x3b7179[_0xeaaa('0x29')]({'plain':!![]});var _0x25165f='Templates';return db[_0xeaaa('0x2a')][_0xeaaa('0x28')]({'where':{'type':_0x25165f,'resourceId':_0x3de221['id']}})[_0xeaaa('0x27')](function(){return _0x3b7179;});})[_0xeaaa('0x27')](function(){_0x103b1d[_0xeaaa('0x1c')](0xcc)[_0xeaaa('0x1d')]();});}};}function handleEntityNotFound(_0x3d0f79,_0x3eda59){return function(_0x51fcf1){if(!_0x51fcf1){_0x3d0f79[_0xeaaa('0x1b')](0x194);}return _0x51fcf1;};}function handleError(_0x548a62,_0x52441b){_0x52441b=_0x52441b||0x1f4;return function(_0x25bc99){logger[_0xeaaa('0x2b')](_0x25bc99[_0xeaaa('0x2c')]);if(_0x25bc99[_0xeaaa('0x2d')]){delete _0x25bc99[_0xeaaa('0x2d')];}_0x548a62[_0xeaaa('0x1c')](_0x52441b)[_0xeaaa('0x2e')](_0x25bc99);};}exports[_0xeaaa('0x2f')]=function(_0x13a674,_0x525f3a){var _0x75403d={},_0x39fd77={},_0x47d4c4={'count':0x0,'rows':[]};var _0x10f95d=_[_0xeaaa('0x30')](db['Template']['rawAttributes'],function(_0x249b07){return{'name':_0x249b07[_0xeaaa('0x31')],'type':_0x249b07['type'][_0xeaaa('0x32')]};});_0x39fd77[_0xeaaa('0x33')]=_['map'](_0x10f95d,_0xeaaa('0x2d'));_0x39fd77[_0xeaaa('0x34')]=_[_0xeaaa('0x35')](_0x13a674[_0xeaaa('0x34')]);_0x39fd77[_0xeaaa('0x36')]=_['intersection'](_0x39fd77['model'],_0x39fd77[_0xeaaa('0x34')]);_0x75403d[_0xeaaa('0x37')]=_['intersection'](_0x39fd77[_0xeaaa('0x33')],qs[_0xeaaa('0x38')](_0x13a674['query'][_0xeaaa('0x38')]));_0x75403d[_0xeaaa('0x37')]=_0x75403d[_0xeaaa('0x37')][_0xeaaa('0x39')]?_0x75403d['attributes']:_0x39fd77[_0xeaaa('0x33')];if(!_0x13a674[_0xeaaa('0x34')][_0xeaaa('0x3a')](_0xeaaa('0x3b'))){_0x75403d[_0xeaaa('0x20')]=qs[_0xeaaa('0x20')](_0x13a674[_0xeaaa('0x34')][_0xeaaa('0x20')]);_0x75403d[_0xeaaa('0x1f')]=qs[_0xeaaa('0x1f')](_0x13a674[_0xeaaa('0x34')]['offset']);}_0x75403d['order']=qs[_0xeaaa('0x3c')](_0x13a674[_0xeaaa('0x34')][_0xeaaa('0x3c')]);_0x75403d[_0xeaaa('0x3d')]=qs[_0xeaaa('0x36')](_[_0xeaaa('0x3e')](_0x13a674[_0xeaaa('0x34')],_0x39fd77['filters']),_0x10f95d);if(_0x13a674[_0xeaaa('0x34')][_0xeaaa('0x3f')]){_0x75403d[_0xeaaa('0x3d')]=_[_0xeaaa('0x40')](_0x75403d['where'],{'$or':_[_0xeaaa('0x30')](_0x10f95d,function(_0x545d2c){if(_0x545d2c['type']!==_0xeaaa('0x41')){var _0x436d65={};_0x436d65[_0x545d2c[_0xeaaa('0x2d')]]={'$like':'%'+_0x13a674[_0xeaaa('0x34')][_0xeaaa('0x3f')]+'%'};return _0x436d65;}})});}_0x75403d=_['merge']({},_0x75403d,_0x13a674[_0xeaaa('0x42')]);var _0x587950={'where':_0x75403d[_0xeaaa('0x3d')]};return db['Template']['count'](_0x587950)[_0xeaaa('0x27')](function(_0x3bfdb1){_0x47d4c4[_0xeaaa('0x43')]=_0x3bfdb1;if(_0x13a674['query'][_0xeaaa('0x44')]){_0x75403d[_0xeaaa('0x45')]=[{'all':!![]}];}return db['Template'][_0xeaaa('0x46')](_0x75403d);})[_0xeaaa('0x27')](function(_0x1a362b){_0x47d4c4['rows']=_0x1a362b;return _0x47d4c4;})['then'](respondWithFilteredResult(_0x525f3a,_0x75403d))[_0xeaaa('0x47')](handleError(_0x525f3a,null));};exports[_0xeaaa('0x48')]=function(_0x5e3bca,_0x96ac39){var _0x122bcd={'raw':!![],'where':{'id':_0x5e3bca['params']['id']}},_0x272f77={};_0x272f77[_0xeaaa('0x33')]=_['keys'](db['Template'][_0xeaaa('0x49')]);_0x272f77['query']=_[_0xeaaa('0x35')](_0x5e3bca[_0xeaaa('0x34')]);_0x272f77['filters']=_[_0xeaaa('0x4a')](_0x272f77[_0xeaaa('0x33')],_0x272f77[_0xeaaa('0x34')]);_0x122bcd[_0xeaaa('0x37')]=_[_0xeaaa('0x4a')](_0x272f77[_0xeaaa('0x33')],qs['fields'](_0x5e3bca['query']['fields']));_0x122bcd[_0xeaaa('0x37')]=_0x122bcd[_0xeaaa('0x37')][_0xeaaa('0x39')]?_0x122bcd[_0xeaaa('0x37')]:_0x272f77[_0xeaaa('0x33')];if(_0x5e3bca[_0xeaaa('0x34')]['includeAll']){_0x122bcd[_0xeaaa('0x45')]=[{'all':!![]}];}_0x122bcd=_[_0xeaaa('0x40')]({},_0x122bcd,_0x5e3bca[_0xeaaa('0x42')]);return db[_0xeaaa('0x4b')][_0xeaaa('0x4c')](_0x122bcd)['then'](handleEntityNotFound(_0x96ac39,null))[_0xeaaa('0x27')](respondWithResult(_0x96ac39,null))[_0xeaaa('0x47')](handleError(_0x96ac39,null));};exports[_0xeaaa('0x4d')]=function(_0x2d69f3,_0x242d93){return db[_0xeaaa('0x4b')][_0xeaaa('0x4d')](_0x2d69f3[_0xeaaa('0x4e')],{})[_0xeaaa('0x27')](function(_0x20ce42){var _0x4603a4=_0x2d69f3['user'][_0xeaaa('0x29')]({'plain':!![]});if(!_0x4603a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4603a4[_0xeaaa('0x4f')]===_0xeaaa('0x50')){var _0x4820e6=_0x20ce42[_0xeaaa('0x29')]({'plain':!![]});var _0x1fbbe2=_0xeaaa('0x51');return db[_0xeaaa('0x52')][_0xeaaa('0x4c')]({'where':{'name':_0x1fbbe2,'userProfileId':_0x4603a4[_0xeaaa('0x53')]},'raw':!![]})[_0xeaaa('0x27')](function(_0x2ab849){if(_0x2ab849&&_0x2ab849['autoAssociation']===0x0){return db[_0xeaaa('0x2a')]['create']({'name':_0x4820e6[_0xeaaa('0x2d')],'resourceId':_0x4820e6['id'],'type':_0x2ab849[_0xeaaa('0x2d')],'sectionId':_0x2ab849['id']},{})[_0xeaaa('0x27')](function(){return _0x20ce42;});}else{return _0x20ce42;}})[_0xeaaa('0x47')](function(_0x3f5edb){logger['error'](_0xeaaa('0x54'),_0x3f5edb);throw _0x3f5edb;});}return _0x20ce42;})[_0xeaaa('0x27')](respondWithResult(_0x242d93,0xc9))['catch'](handleError(_0x242d93,null));};exports['update']=function(_0x4400c1,_0x1f6822){if(_0x4400c1[_0xeaaa('0x4e')]['id']){delete _0x4400c1[_0xeaaa('0x4e')]['id'];}return db[_0xeaaa('0x4b')][_0xeaaa('0x4c')]({'where':{'id':_0x4400c1[_0xeaaa('0x55')]['id']}})[_0xeaaa('0x27')](handleEntityNotFound(_0x1f6822,null))[_0xeaaa('0x27')](saveUpdates(_0x4400c1[_0xeaaa('0x4e')],null))[_0xeaaa('0x27')](respondWithResult(_0x1f6822,null))[_0xeaaa('0x47')](handleError(_0x1f6822,null));};exports[_0xeaaa('0x28')]=function(_0x2932ae,_0x54c701){return db[_0xeaaa('0x4b')]['find']({'where':{'id':_0x2932ae[_0xeaaa('0x55')]['id']}})[_0xeaaa('0x27')](handleEntityNotFound(_0x54c701,null))[_0xeaaa('0x27')](removeEntity(_0x54c701,null))[_0xeaaa('0x47')](handleError(_0x54c701,null));}; \ No newline at end of file +var _0xe4ec=['fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','send','map','Template','rawAttributes','fieldName','type','model','query','intersection','attributes'];(function(_0x3961dd,_0x715109){var _0x360bfa=function(_0x22f099){while(--_0x22f099){_0x3961dd['push'](_0x3961dd['shift']());}};_0x360bfa(++_0x715109);}(_0xe4ec,0x1b6));var _0xce4e=function(_0x4f5cf6,_0x2ac549){_0x4f5cf6=_0x4f5cf6-0x0;var _0x2b6cbc=_0xe4ec[_0x4f5cf6];return _0x2b6cbc;};'use strict';var pdf=require(_0xce4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xce4e('0x1'));var rp=require(_0xce4e('0x2'));var moment=require(_0xce4e('0x3'));var BPromise=require(_0xce4e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xce4e('0x5'));var csv=require(_0xce4e('0x6'));var ejs=require(_0xce4e('0x7'));var fs=require('fs');var _=require(_0xce4e('0x8'));var squel=require(_0xce4e('0x9'));var crypto=require('crypto');var jsforce=require(_0xce4e('0xa'));var deskjs=require(_0xce4e('0xb'));var toCsv=require(_0xce4e('0x6'));var querystring=require(_0xce4e('0xc'));var Papa=require(_0xce4e('0xd'));var Redis=require(_0xce4e('0xe'));var authService=require(_0xce4e('0xf'));var qs=require(_0xce4e('0x10'));var as=require(_0xce4e('0x11'));var hardwareService=require(_0xce4e('0x12'));var logger=require('../../config/logger')(_0xce4e('0x13'));var utils=require(_0xce4e('0x14'));var config=require(_0xce4e('0x15'));var db=require(_0xce4e('0x16'))['db'];function respondWithStatusCode(_0x213cad,_0x538f17){_0x538f17=_0x538f17||0xcc;return function(_0x4e5b5e){if(_0x4e5b5e){return _0x213cad[_0xce4e('0x17')](_0x538f17);}return _0x213cad[_0xce4e('0x18')](_0x538f17)[_0xce4e('0x19')]();};}function respondWithResult(_0x582676,_0xbc5daa){_0xbc5daa=_0xbc5daa||0xc8;return function(_0x3e459e){if(_0x3e459e){return _0x582676[_0xce4e('0x18')](_0xbc5daa)['json'](_0x3e459e);}};}function respondWithFilteredResult(_0x1d2b60,_0x4f1672){return function(_0x3053ea){if(_0x3053ea){var _0x552ca3=_0x3053ea[_0xce4e('0x1a')],_0x2ae44e=_0x4f1672[_0xce4e('0x1b')],_0x425acc=_0x4f1672[_0xce4e('0x1b')]+_0x4f1672[_0xce4e('0x1c')],_0x121864;if(_0x425acc>=_0x552ca3){_0x425acc=_0x552ca3;_0x121864=0xc8;}else{_0x121864=0xce;}_0x1d2b60['status'](_0x121864);return _0x1d2b60[_0xce4e('0x1d')](_0xce4e('0x1e'),_0x2ae44e+'-'+_0x425acc+'/'+_0x552ca3)[_0xce4e('0x1f')](_0x3053ea);}return null;};}function patchUpdates(_0x1fb5eb){return function(_0x253a81){try{jsonpatch[_0xce4e('0x20')](_0x253a81,_0x1fb5eb,!![]);}catch(_0x1bbd6f){return BPromise[_0xce4e('0x21')](_0x1bbd6f);}return _0x253a81[_0xce4e('0x22')]();};}function saveUpdates(_0x265bbf,_0x41d98e){return function(_0x21dc99){if(_0x21dc99){return _0x21dc99[_0xce4e('0x23')](_0x265bbf)[_0xce4e('0x24')](function(_0x3b9e6e){return _0x3b9e6e;});}return null;};}function removeEntity(_0x1430af,_0x463f8c){return function(_0x109954){if(_0x109954){return _0x109954['destroy']()['then'](function(){var _0x256bdd=_0x109954[_0xce4e('0x25')]({'plain':!![]});var _0xf8bb3=_0xce4e('0x26');return db[_0xce4e('0x27')][_0xce4e('0x28')]({'where':{'type':_0xf8bb3,'resourceId':_0x256bdd['id']}})[_0xce4e('0x24')](function(){return _0x109954;});})[_0xce4e('0x24')](function(){_0x1430af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4207e2,_0x54e00c){return function(_0x382776){if(!_0x382776){_0x4207e2[_0xce4e('0x17')](0x194);}return _0x382776;};}function handleError(_0x352d2f,_0x11b630){_0x11b630=_0x11b630||0x1f4;return function(_0x5c60a9){logger[_0xce4e('0x29')](_0x5c60a9[_0xce4e('0x2a')]);if(_0x5c60a9['name']){delete _0x5c60a9[_0xce4e('0x2b')];}_0x352d2f[_0xce4e('0x18')](_0x11b630)[_0xce4e('0x2c')](_0x5c60a9);};}exports['index']=function(_0x1f7e75,_0x3b2c6a){var _0x3f42d4={},_0x5926c3={},_0x55c7e0={'count':0x0,'rows':[]};var _0x323b99=_[_0xce4e('0x2d')](db[_0xce4e('0x2e')][_0xce4e('0x2f')],function(_0x7aed48){return{'name':_0x7aed48[_0xce4e('0x30')],'type':_0x7aed48[_0xce4e('0x31')]['key']};});_0x5926c3[_0xce4e('0x32')]=_['map'](_0x323b99,_0xce4e('0x2b'));_0x5926c3[_0xce4e('0x33')]=_['keys'](_0x1f7e75['query']);_0x5926c3['filters']=_[_0xce4e('0x34')](_0x5926c3[_0xce4e('0x32')],_0x5926c3['query']);_0x3f42d4[_0xce4e('0x35')]=_[_0xce4e('0x34')](_0x5926c3[_0xce4e('0x32')],qs[_0xce4e('0x36')](_0x1f7e75['query'][_0xce4e('0x36')]));_0x3f42d4['attributes']=_0x3f42d4[_0xce4e('0x35')][_0xce4e('0x37')]?_0x3f42d4[_0xce4e('0x35')]:_0x5926c3[_0xce4e('0x32')];if(!_0x1f7e75[_0xce4e('0x33')]['hasOwnProperty']('nolimit')){_0x3f42d4[_0xce4e('0x1c')]=qs[_0xce4e('0x1c')](_0x1f7e75[_0xce4e('0x33')][_0xce4e('0x1c')]);_0x3f42d4[_0xce4e('0x1b')]=qs[_0xce4e('0x1b')](_0x1f7e75['query'][_0xce4e('0x1b')]);}_0x3f42d4[_0xce4e('0x38')]=qs[_0xce4e('0x39')](_0x1f7e75[_0xce4e('0x33')][_0xce4e('0x39')]);_0x3f42d4[_0xce4e('0x3a')]=qs[_0xce4e('0x3b')](_['pick'](_0x1f7e75['query'],_0x5926c3[_0xce4e('0x3b')]),_0x323b99);if(_0x1f7e75[_0xce4e('0x33')][_0xce4e('0x3c')]){_0x3f42d4[_0xce4e('0x3a')]=_[_0xce4e('0x3d')](_0x3f42d4[_0xce4e('0x3a')],{'$or':_[_0xce4e('0x2d')](_0x323b99,function(_0x43dff2){if(_0x43dff2[_0xce4e('0x31')]!==_0xce4e('0x3e')){var _0x4ff347={};_0x4ff347[_0x43dff2[_0xce4e('0x2b')]]={'$like':'%'+_0x1f7e75[_0xce4e('0x33')][_0xce4e('0x3c')]+'%'};return _0x4ff347;}})});}_0x3f42d4=_[_0xce4e('0x3d')]({},_0x3f42d4,_0x1f7e75[_0xce4e('0x3f')]);var _0xc21635={'where':_0x3f42d4[_0xce4e('0x3a')]};return db[_0xce4e('0x2e')]['count'](_0xc21635)[_0xce4e('0x24')](function(_0xb143aa){_0x55c7e0[_0xce4e('0x1a')]=_0xb143aa;if(_0x1f7e75[_0xce4e('0x33')][_0xce4e('0x40')]){_0x3f42d4[_0xce4e('0x41')]=[{'all':!![]}];}return db[_0xce4e('0x2e')][_0xce4e('0x42')](_0x3f42d4);})[_0xce4e('0x24')](function(_0x1893f6){_0x55c7e0[_0xce4e('0x43')]=_0x1893f6;return _0x55c7e0;})[_0xce4e('0x24')](respondWithFilteredResult(_0x3b2c6a,_0x3f42d4))[_0xce4e('0x44')](handleError(_0x3b2c6a,null));};exports[_0xce4e('0x45')]=function(_0x3a974e,_0x467373){var _0x1a5779={'raw':!![],'where':{'id':_0x3a974e[_0xce4e('0x46')]['id']}},_0x3d9ae2={};_0x3d9ae2[_0xce4e('0x32')]=_[_0xce4e('0x47')](db['Template'][_0xce4e('0x2f')]);_0x3d9ae2[_0xce4e('0x33')]=_[_0xce4e('0x47')](_0x3a974e[_0xce4e('0x33')]);_0x3d9ae2[_0xce4e('0x3b')]=_[_0xce4e('0x34')](_0x3d9ae2[_0xce4e('0x32')],_0x3d9ae2[_0xce4e('0x33')]);_0x1a5779[_0xce4e('0x35')]=_[_0xce4e('0x34')](_0x3d9ae2[_0xce4e('0x32')],qs['fields'](_0x3a974e[_0xce4e('0x33')]['fields']));_0x1a5779[_0xce4e('0x35')]=_0x1a5779[_0xce4e('0x35')][_0xce4e('0x37')]?_0x1a5779[_0xce4e('0x35')]:_0x3d9ae2[_0xce4e('0x32')];if(_0x3a974e[_0xce4e('0x33')][_0xce4e('0x40')]){_0x1a5779[_0xce4e('0x41')]=[{'all':!![]}];}_0x1a5779=_[_0xce4e('0x3d')]({},_0x1a5779,_0x3a974e[_0xce4e('0x3f')]);return db['Template'][_0xce4e('0x48')](_0x1a5779)[_0xce4e('0x24')](handleEntityNotFound(_0x467373,null))['then'](respondWithResult(_0x467373,null))[_0xce4e('0x44')](handleError(_0x467373,null));};exports['create']=function(_0x25a460,_0x40f40f){return db[_0xce4e('0x2e')][_0xce4e('0x49')](_0x25a460[_0xce4e('0x4a')],{})['then'](function(_0x1a0950){var _0x369729=_0x25a460[_0xce4e('0x4b')][_0xce4e('0x25')]({'plain':!![]});if(!_0x369729)throw new Error(_0xce4e('0x4c'));if(_0x369729[_0xce4e('0x4d')]===_0xce4e('0x4b')){var _0x55c5b1=_0x1a0950[_0xce4e('0x25')]({'plain':!![]});var _0x21c09e=_0xce4e('0x26');return db[_0xce4e('0x4e')]['find']({'where':{'name':_0x21c09e,'userProfileId':_0x369729[_0xce4e('0x4f')]},'raw':!![]})[_0xce4e('0x24')](function(_0x12c43d){if(_0x12c43d&&_0x12c43d[_0xce4e('0x50')]===0x0){return db[_0xce4e('0x27')][_0xce4e('0x49')]({'name':_0x55c5b1[_0xce4e('0x2b')],'resourceId':_0x55c5b1['id'],'type':_0x12c43d[_0xce4e('0x2b')],'sectionId':_0x12c43d['id']},{})[_0xce4e('0x24')](function(){return _0x1a0950;});}else{return _0x1a0950;}})[_0xce4e('0x44')](function(_0x2a34ed){logger[_0xce4e('0x29')](_0xce4e('0x51'),_0x2a34ed);throw _0x2a34ed;});}return _0x1a0950;})['then'](respondWithResult(_0x40f40f,0xc9))[_0xce4e('0x44')](handleError(_0x40f40f,null));};exports['update']=function(_0x3c0457,_0x3034e7){if(_0x3c0457['body']['id']){delete _0x3c0457['body']['id'];}return db[_0xce4e('0x2e')][_0xce4e('0x48')]({'where':{'id':_0x3c0457[_0xce4e('0x46')]['id']}})[_0xce4e('0x24')](handleEntityNotFound(_0x3034e7,null))[_0xce4e('0x24')](saveUpdates(_0x3c0457['body'],null))[_0xce4e('0x24')](respondWithResult(_0x3034e7,null))['catch'](handleError(_0x3034e7,null));};exports['destroy']=function(_0xe899bd,_0x128d5b){return db[_0xce4e('0x2e')]['find']({'where':{'id':_0xe899bd[_0xce4e('0x46')]['id']}})[_0xce4e('0x24')](handleEntityNotFound(_0x128d5b,null))[_0xce4e('0x24')](removeEntity(_0x128d5b,null))[_0xce4e('0x44')](handleError(_0x128d5b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index fe32e4d..4df4199 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 _0xf245=['tools_templates','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template'];(function(_0xe50e1,_0x30bf72){var _0x441f9a=function(_0x40ac92){while(--_0x40ac92){_0xe50e1['push'](_0xe50e1['shift']());}};_0x441f9a(++_0x30bf72);}(_0xf245,0x16d));var _0x5f24=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0xf245[_0x4b2b03];return _0x1bf0ed;};'use strict';var _=require('lodash');var util=require(_0x5f24('0x0'));var logger=require(_0x5f24('0x1'))('api');var moment=require(_0x5f24('0x2'));var BPromise=require(_0x5f24('0x3'));var rp=require(_0x5f24('0x4'));var fs=require('fs');var path=require(_0x5f24('0x5'));var rimraf=require(_0x5f24('0x6'));var config=require(_0x5f24('0x7'));var attributes=require(_0x5f24('0x8'));module[_0x5f24('0x9')]=function(_0x11627a,_0x7ad80d){return _0x11627a[_0x5f24('0xa')](_0x5f24('0xb'),attributes,{'tableName':_0x5f24('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x779b=['../../config/environment','./template.attributes','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x779b,0xc7));var _0xb779=function(_0x147aa5,_0x44d876){_0x147aa5=_0x147aa5-0x0;var _0x3ad6d6=_0x779b[_0x147aa5];return _0x3ad6d6;};'use strict';var _=require(_0xb779('0x0'));var util=require(_0xb779('0x1'));var logger=require(_0xb779('0x2'))(_0xb779('0x3'));var moment=require(_0xb779('0x4'));var BPromise=require(_0xb779('0x5'));var rp=require(_0xb779('0x6'));var fs=require('fs');var path=require(_0xb779('0x7'));var rimraf=require(_0xb779('0x8'));var config=require(_0xb779('0x9'));var attributes=require(_0xb779('0xa'));module['exports']=function(_0x1aa3e8,_0x25899a){return _0x1aa3e8['define'](_0xb779('0xb'),attributes,{'tableName':_0xb779('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 67af59a..babd49f 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 _0x7ace=['then','info','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTemplate','Template','findAll','raw','options','where','attributes','include','map','model'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x7ace,0x11a));var _0xe7ac=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7ace[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xe7ac('0x0'));var util=require('util');var moment=require(_0xe7ac('0x1'));var BPromise=require(_0xe7ac('0x2'));var rs=require(_0xe7ac('0x3'));var fs=require('fs');var Redis=require(_0xe7ac('0x4'));var db=require(_0xe7ac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7ac('0x6'))(_0xe7ac('0x7'));var config=require(_0xe7ac('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1eb954,_0x55473d,_0x1f21bd){return new BPromise(function(_0x17b138,_0x340155){return client['request'](_0x1eb954,_0x1f21bd)['then'](function(_0x519ea9){logger['info'](_0xe7ac('0x9'),_0x55473d,_0xe7ac('0xa'));logger[_0xe7ac('0xb')](_0xe7ac('0xc'),_0x55473d,_0xe7ac('0xa'),JSON['stringify'](_0x519ea9));if(_0x519ea9[_0xe7ac('0xd')]){if(_0x519ea9[_0xe7ac('0xd')][_0xe7ac('0xe')]===0x1f4){logger[_0xe7ac('0xd')](_0xe7ac('0x9'),_0x55473d,_0x519ea9[_0xe7ac('0xd')][_0xe7ac('0xf')]);return _0x340155(_0x519ea9[_0xe7ac('0xd')][_0xe7ac('0xf')]);}logger[_0xe7ac('0xd')](_0xe7ac('0x9'),_0x55473d,_0x519ea9[_0xe7ac('0xd')]['message']);return _0x17b138(_0x519ea9[_0xe7ac('0xd')][_0xe7ac('0xf')]);}else{logger['info'](_0xe7ac('0x9'),_0x55473d,_0xe7ac('0xa'));_0x17b138(_0x519ea9[_0xe7ac('0x10')][_0xe7ac('0xf')]);}})[_0xe7ac('0x11')](function(_0x19a5e8){logger['error'](_0xe7ac('0x9'),_0x55473d,_0x19a5e8);_0x340155(_0x19a5e8);});});}exports[_0xe7ac('0x12')]=function(_0x51e243){var _0x2d9707=this;return new Promise(function(_0x2d3e17,_0xb8f170){return db[_0xe7ac('0x13')][_0xe7ac('0x14')]({'raw':_0x51e243['options']?_0x51e243['options'][_0xe7ac('0x15')]===undefined?!![]:![]:!![],'where':_0x51e243[_0xe7ac('0x16')]?_0x51e243[_0xe7ac('0x16')][_0xe7ac('0x17')]||null:null,'attributes':_0x51e243[_0xe7ac('0x16')]?_0x51e243[_0xe7ac('0x16')][_0xe7ac('0x18')]||null:null,'limit':_0x51e243[_0xe7ac('0x16')]?_0x51e243[_0xe7ac('0x16')]['limit']||null:null,'include':_0x51e243[_0xe7ac('0x16')]?_0x51e243[_0xe7ac('0x16')][_0xe7ac('0x19')]?_[_0xe7ac('0x1a')](_0x51e243[_0xe7ac('0x16')]['include'],function(_0x56173e){return{'model':db[_0x56173e[_0xe7ac('0x1b')]],'as':_0x56173e['as'],'attributes':_0x56173e[_0xe7ac('0x18')],'include':_0x56173e[_0xe7ac('0x19')]?_[_0xe7ac('0x1a')](_0x56173e[_0xe7ac('0x19')],function(_0x1e907e){return{'model':db[_0x1e907e[_0xe7ac('0x1b')]],'as':_0x1e907e['as'],'attributes':_0x1e907e[_0xe7ac('0x18')],'include':_0x1e907e[_0xe7ac('0x19')]?_['map'](_0x1e907e[_0xe7ac('0x19')],function(_0x2d84a1){return{'model':db[_0x2d84a1[_0xe7ac('0x1b')]],'as':_0x2d84a1['as'],'attributes':_0x2d84a1[_0xe7ac('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe7ac('0x1c')](function(_0x2cd944){logger[_0xe7ac('0x1d')](_0xe7ac('0x12'),_0x51e243);logger['debug'](_0xe7ac('0x12'),_0x51e243,JSON[_0xe7ac('0x1e')](_0x2cd944));_0x2d3e17(_0x2cd944);})[_0xe7ac('0x11')](function(_0x4ce08b){logger[_0xe7ac('0xd')]('GetTemplate',_0x4ce08b['message'],_0x51e243);_0xb8f170(_0x2d9707[_0xe7ac('0xd')](0x1f4,_0x4ce08b[_0xe7ac('0xf')]));});});}; \ No newline at end of file +var _0x3cd1=['GetTemplate','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','Template','options','raw','where','limit','include','map','model','attributes'];(function(_0xf1a516,_0x4b7594){var _0x6792d2=function(_0x2bbdf1){while(--_0x2bbdf1){_0xf1a516['push'](_0xf1a516['shift']());}};_0x6792d2(++_0x4b7594);}(_0x3cd1,0x141));var _0x13cd=function(_0xcc4e57,_0x4ea4ab){_0xcc4e57=_0xcc4e57-0x0;var _0x1e56a1=_0x3cd1[_0xcc4e57];return _0x1e56a1;};'use strict';var _=require('lodash');var util=require(_0x13cd('0x0'));var moment=require(_0x13cd('0x1'));var BPromise=require(_0x13cd('0x2'));var rs=require(_0x13cd('0x3'));var fs=require('fs');var Redis=require(_0x13cd('0x4'));var db=require(_0x13cd('0x5'))['db'];var utils=require(_0x13cd('0x6'));var logger=require(_0x13cd('0x7'))('rpc');var config=require(_0x13cd('0x8'));var jayson=require(_0x13cd('0x9'));var client=jayson[_0x13cd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x358d3b,_0x4c464c,_0x3c6870){return new BPromise(function(_0x4ec010,_0x236a76){return client['request'](_0x358d3b,_0x3c6870)[_0x13cd('0xb')](function(_0x39a9b4){logger[_0x13cd('0xc')]('Template,\x20%s,\x20%s',_0x4c464c,_0x13cd('0xd'));logger[_0x13cd('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x4c464c,_0x13cd('0xd'),JSON[_0x13cd('0xf')](_0x39a9b4));if(_0x39a9b4[_0x13cd('0x10')]){if(_0x39a9b4[_0x13cd('0x10')][_0x13cd('0x11')]===0x1f4){logger[_0x13cd('0x10')](_0x13cd('0x12'),_0x4c464c,_0x39a9b4['error'][_0x13cd('0x13')]);return _0x236a76(_0x39a9b4[_0x13cd('0x10')][_0x13cd('0x13')]);}logger[_0x13cd('0x10')](_0x13cd('0x12'),_0x4c464c,_0x39a9b4[_0x13cd('0x10')][_0x13cd('0x13')]);return _0x4ec010(_0x39a9b4[_0x13cd('0x10')][_0x13cd('0x13')]);}else{logger[_0x13cd('0xc')](_0x13cd('0x12'),_0x4c464c,'request\x20sent');_0x4ec010(_0x39a9b4[_0x13cd('0x14')][_0x13cd('0x13')]);}})[_0x13cd('0x15')](function(_0xf9924){logger[_0x13cd('0x10')](_0x13cd('0x12'),_0x4c464c,_0xf9924);_0x236a76(_0xf9924);});});}exports['GetTemplate']=function(_0x1b5d6c){var _0x3187a4=this;return new Promise(function(_0xb59cb8,_0xb1a07b){return db[_0x13cd('0x16')]['findAll']({'raw':_0x1b5d6c[_0x13cd('0x17')]?_0x1b5d6c[_0x13cd('0x17')][_0x13cd('0x18')]===undefined?!![]:![]:!![],'where':_0x1b5d6c[_0x13cd('0x17')]?_0x1b5d6c[_0x13cd('0x17')][_0x13cd('0x19')]||null:null,'attributes':_0x1b5d6c['options']?_0x1b5d6c[_0x13cd('0x17')]['attributes']||null:null,'limit':_0x1b5d6c[_0x13cd('0x17')]?_0x1b5d6c[_0x13cd('0x17')][_0x13cd('0x1a')]||null:null,'include':_0x1b5d6c[_0x13cd('0x17')]?_0x1b5d6c['options'][_0x13cd('0x1b')]?_[_0x13cd('0x1c')](_0x1b5d6c[_0x13cd('0x17')]['include'],function(_0xe8d6cb){return{'model':db[_0xe8d6cb[_0x13cd('0x1d')]],'as':_0xe8d6cb['as'],'attributes':_0xe8d6cb['attributes'],'include':_0xe8d6cb[_0x13cd('0x1b')]?_[_0x13cd('0x1c')](_0xe8d6cb[_0x13cd('0x1b')],function(_0xf9186a){return{'model':db[_0xf9186a[_0x13cd('0x1d')]],'as':_0xf9186a['as'],'attributes':_0xf9186a[_0x13cd('0x1e')],'include':_0xf9186a[_0x13cd('0x1b')]?_[_0x13cd('0x1c')](_0xf9186a[_0x13cd('0x1b')],function(_0x31b006){return{'model':db[_0x31b006[_0x13cd('0x1d')]],'as':_0x31b006['as'],'attributes':_0x31b006[_0x13cd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3097b1){logger[_0x13cd('0xc')](_0x13cd('0x1f'),_0x1b5d6c);logger[_0x13cd('0xe')](_0x13cd('0x1f'),_0x1b5d6c,JSON[_0x13cd('0xf')](_0x3097b1));_0xb59cb8(_0x3097b1);})[_0x13cd('0x15')](function(_0x2ca931){logger[_0x13cd('0x10')]('GetTemplate',_0x2ca931[_0x13cd('0x13')],_0x1b5d6c);_0xb1a07b(_0x3187a4[_0x13cd('0x10')](0x1f4,_0x2ca931[_0x13cd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6d4382c..bb7562c 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 _0x9be9=['getAllConditions','getAnyConditions','post','create','/:id/any_conditions','addAnyCondition','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9be9,0x107));var _0x99be=function(_0x270ec9,_0x7559d9){_0x270ec9=_0x270ec9-0x0;var _0xf37f72=_0x9be9[_0x270ec9];return _0xf37f72;};'use strict';var multer=require(_0x99be('0x0'));var util=require(_0x99be('0x1'));var path=require(_0x99be('0x2'));var timeout=require(_0x99be('0x3'));var express=require(_0x99be('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x99be('0x5'));var config=require(_0x99be('0x6'));var controller=require(_0x99be('0x7'));router[_0x99be('0x8')]('/',auth[_0x99be('0x9')](),controller[_0x99be('0xa')]);router[_0x99be('0x8')](_0x99be('0xb'),auth[_0x99be('0x9')](),controller['show']);router[_0x99be('0x8')](_0x99be('0xc'),auth[_0x99be('0x9')](),controller[_0x99be('0xd')]);router[_0x99be('0x8')]('/:id/any_conditions',auth[_0x99be('0x9')](),controller[_0x99be('0xe')]);router['get']('/:id/actions',auth[_0x99be('0x9')](),controller['getActions']);router[_0x99be('0xf')]('/',auth['isAuthenticated'](),controller[_0x99be('0x10')]);router['post'](_0x99be('0xc'),auth[_0x99be('0x9')](),controller['addAllCondition']);router[_0x99be('0xf')](_0x99be('0x11'),auth[_0x99be('0x9')](),controller[_0x99be('0x12')]);router[_0x99be('0xf')]('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0x99be('0x13')](_0x99be('0xb'),auth[_0x99be('0x9')](),controller[_0x99be('0x14')]);router[_0x99be('0x15')](_0x99be('0xb'),auth['isAuthenticated'](),controller[_0x99be('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3a27=['post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions'];(function(_0x47d76d,_0x15ff33){var _0x29f433=function(_0x51a4f3){while(--_0x51a4f3){_0x47d76d['push'](_0x47d76d['shift']());}};_0x29f433(++_0x15ff33);}(_0x3a27,0xb1));var _0x73a2=function(_0x1e325c,_0x335cfa){_0x1e325c=_0x1e325c-0x0;var _0x4cdc06=_0x3a27[_0x1e325c];return _0x4cdc06;};'use strict';var multer=require(_0x73a2('0x0'));var util=require(_0x73a2('0x1'));var path=require('path');var timeout=require(_0x73a2('0x2'));var express=require(_0x73a2('0x3'));var router=express[_0x73a2('0x4')]();var auth=require(_0x73a2('0x5'));var interaction=require(_0x73a2('0x6'));var config=require(_0x73a2('0x7'));var controller=require(_0x73a2('0x8'));router[_0x73a2('0x9')]('/',auth['isAuthenticated'](),controller[_0x73a2('0xa')]);router['get'](_0x73a2('0xb'),auth[_0x73a2('0xc')](),controller[_0x73a2('0xd')]);router[_0x73a2('0x9')](_0x73a2('0xe'),auth[_0x73a2('0xc')](),controller['getAllConditions']);router['get'](_0x73a2('0xf'),auth['isAuthenticated'](),controller[_0x73a2('0x10')]);router[_0x73a2('0x9')](_0x73a2('0x11'),auth[_0x73a2('0xc')](),controller[_0x73a2('0x12')]);router[_0x73a2('0x13')]('/',auth[_0x73a2('0xc')](),controller['create']);router[_0x73a2('0x13')]('/:id/all_conditions',auth[_0x73a2('0xc')](),controller[_0x73a2('0x14')]);router[_0x73a2('0x13')]('/:id/any_conditions',auth[_0x73a2('0xc')](),controller[_0x73a2('0x15')]);router[_0x73a2('0x13')](_0x73a2('0x11'),auth[_0x73a2('0xc')](),controller[_0x73a2('0x16')]);router[_0x73a2('0x17')](_0x73a2('0xb'),auth['isAuthenticated'](),controller[_0x73a2('0x18')]);router[_0x73a2('0x19')](_0x73a2('0xb'),auth['isAuthenticated'](),controller[_0x73a2('0x1a')]);module[_0x73a2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0a91f44..921dd42 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 _0xb218=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb218,0x1a7));var _0x8b21=function(_0x5d6456,_0x5e6dab){_0x5d6456=_0x5d6456-0x0;var _0x28d0ee=_0xb218[_0x5d6456];return _0x28d0ee;};'use strict';var Sequelize=require(_0x8b21('0x0'));module[_0x8b21('0x1')]={'name':{'type':Sequelize[_0x8b21('0x2')]},'channel':{'type':Sequelize[_0x8b21('0x2')]},'description':{'type':Sequelize[_0x8b21('0x2')]},'status':{'type':Sequelize[_0x8b21('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6c79=['STRING','sequelize','exports'];(function(_0xfa9288,_0x3249e4){var _0x340a5f=function(_0x5bfb77){while(--_0x5bfb77){_0xfa9288['push'](_0xfa9288['shift']());}};_0x340a5f(++_0x3249e4);}(_0x6c79,0x172));var _0x96c7=function(_0x48a509,_0x30df45){_0x48a509=_0x48a509-0x0;var _0x4155e9=_0x6c79[_0x48a509];return _0x4155e9;};'use strict';var Sequelize=require(_0x96c7('0x0'));module[_0x96c7('0x1')]={'name':{'type':Sequelize[_0x96c7('0x2')]},'channel':{'type':Sequelize[_0x96c7('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index b60c4b7..b925409 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 _0xd40d=['pick','filters','filter','merge','VIRTUAL','options','count','includeAll','Trigger','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','TriggerAllId','Condition','addAnyCondition','getAllConditions','order','nolimit','getAnyConditions','addAction','getActions','findOne','Action','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','set','Content-Range','apply','reject','destroy','get','UserProfileResource','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','limit','offset','sort','where'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd40d,0x176));var _0xdd40=function(_0x3c0669,_0x258ac0){_0x3c0669=_0x3c0669-0x0;var _0x4ae290=_0xd40d[_0x3c0669];return _0x4ae290;};'use strict';var pdf=require(_0xdd40('0x0'));var emlformat=require(_0xdd40('0x1'));var rimraf=require(_0xdd40('0x2'));var zipdir=require(_0xdd40('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd40('0x4'));var moment=require(_0xdd40('0x5'));var BPromise=require(_0xdd40('0x6'));var Mustache=require(_0xdd40('0x7'));var util=require(_0xdd40('0x8'));var path=require('path');var sox=require(_0xdd40('0x9'));var csv=require(_0xdd40('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd40('0xb'));var squel=require(_0xdd40('0xc'));var crypto=require(_0xdd40('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdd40('0xe'));var toCsv=require(_0xdd40('0xa'));var querystring=require('querystring');var Papa=require(_0xdd40('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd40('0x10'));var logger=require('../../config/logger')(_0xdd40('0x11'));var utils=require(_0xdd40('0x12'));var config=require('../../config/environment');var db=require(_0xdd40('0x13'))['db'];function respondWithStatusCode(_0x24cdf2,_0x523398){_0x523398=_0x523398||0xcc;return function(_0x3c9a6d){if(_0x3c9a6d){return _0x24cdf2[_0xdd40('0x14')](_0x523398);}return _0x24cdf2[_0xdd40('0x15')](_0x523398)['end']();};}function respondWithResult(_0x8f792c,_0x509f2d){_0x509f2d=_0x509f2d||0xc8;return function(_0x3a4fb6){if(_0x3a4fb6){return _0x8f792c[_0xdd40('0x15')](_0x509f2d)['json'](_0x3a4fb6);}};}function respondWithFilteredResult(_0x1d4584,_0x4e736b){return function(_0x224dab){if(_0x224dab){var _0x559392=_0x224dab['count'],_0x475b88=_0x4e736b['offset'],_0x587deb=_0x4e736b['offset']+_0x4e736b['limit'],_0x49c99e;if(_0x587deb>=_0x559392){_0x587deb=_0x559392;_0x49c99e=0xc8;}else{_0x49c99e=0xce;}_0x1d4584[_0xdd40('0x15')](_0x49c99e);return _0x1d4584[_0xdd40('0x16')](_0xdd40('0x17'),_0x475b88+'-'+_0x587deb+'/'+_0x559392)['json'](_0x224dab);}return null;};}function patchUpdates(_0xb0b00f){return function(_0x16b9e4){try{jsonpatch[_0xdd40('0x18')](_0x16b9e4,_0xb0b00f,!![]);}catch(_0x6a25a9){return BPromise[_0xdd40('0x19')](_0x6a25a9);}return _0x16b9e4['save']();};}function saveUpdates(_0x461f93,_0x47a88a){return function(_0x1cf19c){if(_0x1cf19c){return _0x1cf19c['update'](_0x461f93)['then'](function(_0x2f4979){return _0x2f4979;});}return null;};}function removeEntity(_0x2bc3e1,_0x375e04){return function(_0x35d7d5){if(_0x35d7d5){return _0x35d7d5[_0xdd40('0x1a')]()['then'](function(){var _0x242965=_0x35d7d5[_0xdd40('0x1b')]({'plain':!![]});var _0x4d5369='Triggers';return db[_0xdd40('0x1c')][_0xdd40('0x1a')]({'where':{'type':_0x4d5369,'resourceId':_0x242965['id']}})['then'](function(){return _0x35d7d5;});})[_0xdd40('0x1d')](function(){_0x2bc3e1[_0xdd40('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7fa78c,_0x21e53a){return function(_0x4da025){if(!_0x4da025){_0x7fa78c[_0xdd40('0x14')](0x194);}return _0x4da025;};}function handleError(_0x4d72aa,_0x531e72){_0x531e72=_0x531e72||0x1f4;return function(_0x3af0cb){logger[_0xdd40('0x1e')](_0x3af0cb[_0xdd40('0x1f')]);if(_0x3af0cb[_0xdd40('0x20')]){delete _0x3af0cb[_0xdd40('0x20')];}_0x4d72aa[_0xdd40('0x15')](_0x531e72)['send'](_0x3af0cb);};}exports[_0xdd40('0x21')]=function(_0xaff36,_0x3ff94f){var _0x10a311={},_0x368b40={},_0x27d5e8={'count':0x0,'rows':[]};var _0x3da734=_[_0xdd40('0x22')](db['Trigger'][_0xdd40('0x23')],function(_0x320a5e){return{'name':_0x320a5e[_0xdd40('0x24')],'type':_0x320a5e[_0xdd40('0x25')][_0xdd40('0x26')]};});_0x368b40['model']=_['map'](_0x3da734,_0xdd40('0x20'));_0x368b40[_0xdd40('0x27')]=_[_0xdd40('0x28')](_0xaff36['query']);_0x368b40['filters']=_['intersection'](_0x368b40[_0xdd40('0x29')],_0x368b40[_0xdd40('0x27')]);_0x10a311['attributes']=_[_0xdd40('0x2a')](_0x368b40[_0xdd40('0x29')],qs[_0xdd40('0x2b')](_0xaff36['query'][_0xdd40('0x2b')]));_0x10a311[_0xdd40('0x2c')]=_0x10a311[_0xdd40('0x2c')][_0xdd40('0x2d')]?_0x10a311[_0xdd40('0x2c')]:_0x368b40[_0xdd40('0x29')];if(!_0xaff36['query'][_0xdd40('0x2e')]('nolimit')){_0x10a311[_0xdd40('0x2f')]=qs[_0xdd40('0x2f')](_0xaff36[_0xdd40('0x27')][_0xdd40('0x2f')]);_0x10a311['offset']=qs[_0xdd40('0x30')](_0xaff36[_0xdd40('0x27')][_0xdd40('0x30')]);}_0x10a311['order']=qs['sort'](_0xaff36[_0xdd40('0x27')][_0xdd40('0x31')]);_0x10a311[_0xdd40('0x32')]=qs['filters'](_[_0xdd40('0x33')](_0xaff36[_0xdd40('0x27')],_0x368b40[_0xdd40('0x34')]),_0x3da734);if(_0xaff36[_0xdd40('0x27')][_0xdd40('0x35')]){_0x10a311['where']=_[_0xdd40('0x36')](_0x10a311['where'],{'$or':_[_0xdd40('0x22')](_0x3da734,function(_0x186626){if(_0x186626['type']!==_0xdd40('0x37')){var _0x21a84c={};_0x21a84c[_0x186626['name']]={'$like':'%'+_0xaff36['query'][_0xdd40('0x35')]+'%'};return _0x21a84c;}})});}_0x10a311=_[_0xdd40('0x36')]({},_0x10a311,_0xaff36[_0xdd40('0x38')]);var _0x4fe4c1={'where':_0x10a311['where']};return db['Trigger'][_0xdd40('0x39')](_0x4fe4c1)[_0xdd40('0x1d')](function(_0xe9e75e){_0x27d5e8['count']=_0xe9e75e;if(_0xaff36[_0xdd40('0x27')][_0xdd40('0x3a')]){_0x10a311['include']=[{'all':!![]}];}return db[_0xdd40('0x3b')][_0xdd40('0x3c')](_0x10a311);})['then'](function(_0x4db562){_0x27d5e8[_0xdd40('0x3d')]=_0x4db562;return _0x27d5e8;})[_0xdd40('0x1d')](respondWithFilteredResult(_0x3ff94f,_0x10a311))[_0xdd40('0x3e')](handleError(_0x3ff94f,null));};exports[_0xdd40('0x3f')]=function(_0x476543,_0x55818a){var _0x207951={'raw':![],'where':{'id':_0x476543[_0xdd40('0x40')]['id']}},_0xe512c5={};_0xe512c5['model']=_[_0xdd40('0x28')](db['Trigger'][_0xdd40('0x23')]);_0xe512c5['query']=_[_0xdd40('0x28')](_0x476543['query']);_0xe512c5[_0xdd40('0x34')]=_[_0xdd40('0x2a')](_0xe512c5[_0xdd40('0x29')],_0xe512c5['query']);_0x207951[_0xdd40('0x2c')]=_[_0xdd40('0x2a')](_0xe512c5[_0xdd40('0x29')],qs[_0xdd40('0x2b')](_0x476543['query']['fields']));_0x207951['attributes']=_0x207951[_0xdd40('0x2c')]['length']?_0x207951['attributes']:_0xe512c5[_0xdd40('0x29')];if(_0x476543['query'][_0xdd40('0x3a')]){_0x207951['include']=[{'all':!![]}];}_0x207951=_['merge']({},_0x207951,_0x476543['options']);return db['Trigger'][_0xdd40('0x41')](_0x207951)[_0xdd40('0x1d')](handleEntityNotFound(_0x55818a,null))[_0xdd40('0x1d')](respondWithResult(_0x55818a,null))[_0xdd40('0x3e')](handleError(_0x55818a,null));};exports[_0xdd40('0x42')]=function(_0x530745,_0x193266){return db[_0xdd40('0x3b')][_0xdd40('0x42')](_0x530745[_0xdd40('0x43')],{})['then'](function(_0xb04c84){var _0x2105a3=_0x530745[_0xdd40('0x44')][_0xdd40('0x1b')]({'plain':!![]});if(!_0x2105a3)throw new Error(_0xdd40('0x45'));if(_0x2105a3[_0xdd40('0x46')]===_0xdd40('0x44')){var _0x2288ac=_0xb04c84['get']({'plain':!![]});var _0xa3a3b5=_0xdd40('0x47');return db['UserProfileSection'][_0xdd40('0x41')]({'where':{'name':_0xa3a3b5,'userProfileId':_0x2105a3[_0xdd40('0x48')]},'raw':!![]})[_0xdd40('0x1d')](function(_0x4e4e14){if(_0x4e4e14&&_0x4e4e14[_0xdd40('0x49')]===0x0){return db[_0xdd40('0x1c')][_0xdd40('0x42')]({'name':_0x2288ac[_0xdd40('0x20')],'resourceId':_0x2288ac['id'],'type':_0x4e4e14[_0xdd40('0x20')],'sectionId':_0x4e4e14['id']},{})[_0xdd40('0x1d')](function(){return _0xb04c84;});}else{return _0xb04c84;}})[_0xdd40('0x3e')](function(_0x1b10b2){logger[_0xdd40('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b10b2);throw _0x1b10b2;});}return _0xb04c84;})[_0xdd40('0x1d')](respondWithResult(_0x193266,0xc9))[_0xdd40('0x3e')](handleError(_0x193266,null));};exports['update']=function(_0x4f9d47,_0x589a2c){if(_0x4f9d47[_0xdd40('0x43')]['id']){delete _0x4f9d47[_0xdd40('0x43')]['id'];}return db[_0xdd40('0x3b')][_0xdd40('0x41')]({'where':{'id':_0x4f9d47[_0xdd40('0x40')]['id']}})[_0xdd40('0x1d')](handleEntityNotFound(_0x589a2c,null))[_0xdd40('0x1d')](saveUpdates(_0x4f9d47[_0xdd40('0x43')],null))[_0xdd40('0x1d')](respondWithResult(_0x589a2c,null))[_0xdd40('0x3e')](handleError(_0x589a2c,null));};exports['destroy']=function(_0x2a7cf6,_0x540843){return db[_0xdd40('0x3b')][_0xdd40('0x41')]({'where':{'id':_0x2a7cf6['params']['id']}})[_0xdd40('0x1d')](handleEntityNotFound(_0x540843,null))['then'](removeEntity(_0x540843,null))[_0xdd40('0x3e')](handleError(_0x540843,null));};exports['addAllCondition']=function(_0x56d1c2,_0x262174,_0x4767b5){if(_0x56d1c2['body']['id']){delete _0x56d1c2[_0xdd40('0x43')]['id'];}return db[_0xdd40('0x3b')]['find']({'where':{'id':_0x56d1c2[_0xdd40('0x40')]['id']}})[_0xdd40('0x1d')](handleEntityNotFound(_0x262174,null))['then'](function(_0x48165e){if(_0x48165e){_0x56d1c2['body'][_0xdd40('0x4a')]=_0x48165e['id'];return db[_0xdd40('0x4b')][_0xdd40('0x42')](_0x56d1c2['body']);}})[_0xdd40('0x1d')](respondWithResult(_0x262174,null))[_0xdd40('0x3e')](handleError(_0x262174,null));};exports[_0xdd40('0x4c')]=function(_0x1756c9,_0x1190ad,_0x5d7bbf){if(_0x1756c9['body']['id']){delete _0x1756c9[_0xdd40('0x43')]['id'];}return db[_0xdd40('0x3b')]['find']({'where':{'id':_0x1756c9[_0xdd40('0x40')]['id']}})[_0xdd40('0x1d')](handleEntityNotFound(_0x1190ad,null))[_0xdd40('0x1d')](function(_0x8ffc3){if(_0x8ffc3){_0x1756c9[_0xdd40('0x43')]['TriggerAnyId']=_0x8ffc3['id'];return db[_0xdd40('0x4b')][_0xdd40('0x42')](_0x1756c9[_0xdd40('0x43')]);}})['then'](respondWithResult(_0x1190ad,null))[_0xdd40('0x3e')](handleError(_0x1190ad,null));};exports[_0xdd40('0x4d')]=function(_0x3388a0,_0x2f70c3,_0x505fe7){var _0x54d267={};var _0x24bcde={};var _0x40105c;var _0x33182b;return db[_0xdd40('0x3b')]['findOne']({'where':{'id':_0x3388a0['params']['id']}})[_0xdd40('0x1d')](handleEntityNotFound(_0x2f70c3,null))[_0xdd40('0x1d')](function(_0x43cb71){if(_0x43cb71){_0x40105c=_0x43cb71;_0x24bcde[_0xdd40('0x29')]=_[_0xdd40('0x28')](db[_0xdd40('0x4b')][_0xdd40('0x23')]);_0x24bcde['query']=_[_0xdd40('0x28')](_0x3388a0[_0xdd40('0x27')]);_0x24bcde[_0xdd40('0x34')]=_[_0xdd40('0x2a')](_0x24bcde[_0xdd40('0x29')],_0x24bcde['query']);_0x54d267['attributes']=_[_0xdd40('0x2a')](_0x24bcde[_0xdd40('0x29')],qs[_0xdd40('0x2b')](_0x3388a0[_0xdd40('0x27')]['fields']));_0x54d267['attributes']=_0x54d267['attributes']['length']?_0x54d267[_0xdd40('0x2c')]:_0x24bcde['model'];_0x54d267[_0xdd40('0x4e')]=qs[_0xdd40('0x31')](_0x3388a0[_0xdd40('0x27')]['sort']);_0x54d267[_0xdd40('0x32')]=qs['filters'](_[_0xdd40('0x33')](_0x3388a0[_0xdd40('0x27')],_0x24bcde[_0xdd40('0x34')]));if(_0x3388a0[_0xdd40('0x27')][_0xdd40('0x35')]){_0x54d267[_0xdd40('0x32')]=_[_0xdd40('0x36')](_0x54d267[_0xdd40('0x32')],{'$or':_['map'](_0x54d267[_0xdd40('0x2c')],function(_0x1c49c9){var _0x1c0717={};_0x1c0717[_0x1c49c9]={'$like':'%'+_0x3388a0[_0xdd40('0x27')][_0xdd40('0x35')]+'%'};return _0x1c0717;})});}_0x54d267=_[_0xdd40('0x36')]({},_0x54d267,_0x3388a0[_0xdd40('0x38')]);return _0x40105c[_0xdd40('0x4d')](_0x54d267);}})[_0xdd40('0x1d')](function(_0x21ca5f){if(_0x21ca5f){_0x33182b=_0x21ca5f[_0xdd40('0x2d')];if(!_0x3388a0[_0xdd40('0x27')][_0xdd40('0x2e')](_0xdd40('0x4f'))){_0x54d267[_0xdd40('0x2f')]=qs[_0xdd40('0x2f')](_0x3388a0[_0xdd40('0x27')][_0xdd40('0x2f')]);_0x54d267['offset']=qs[_0xdd40('0x30')](_0x3388a0[_0xdd40('0x27')][_0xdd40('0x30')]);}return _0x40105c[_0xdd40('0x4d')](_0x54d267);}})[_0xdd40('0x1d')](function(_0x34d791){if(_0x34d791){return _0x34d791?{'count':_0x33182b,'rows':_0x34d791}:null;}})['then'](respondWithResult(_0x2f70c3,null))['catch'](handleError(_0x2f70c3,null));};exports[_0xdd40('0x50')]=function(_0x2c6fbd,_0x418ac0,_0x54c4a4){var _0x5b3133={};var _0x42423a={};var _0x3050dd;var _0x591d08;return db[_0xdd40('0x3b')]['findOne']({'where':{'id':_0x2c6fbd[_0xdd40('0x40')]['id']}})[_0xdd40('0x1d')](handleEntityNotFound(_0x418ac0,null))[_0xdd40('0x1d')](function(_0x3ba194){if(_0x3ba194){_0x3050dd=_0x3ba194;_0x42423a[_0xdd40('0x29')]=_[_0xdd40('0x28')](db[_0xdd40('0x4b')][_0xdd40('0x23')]);_0x42423a[_0xdd40('0x27')]=_['keys'](_0x2c6fbd[_0xdd40('0x27')]);_0x42423a[_0xdd40('0x34')]=_[_0xdd40('0x2a')](_0x42423a[_0xdd40('0x29')],_0x42423a[_0xdd40('0x27')]);_0x5b3133['attributes']=_['intersection'](_0x42423a[_0xdd40('0x29')],qs[_0xdd40('0x2b')](_0x2c6fbd[_0xdd40('0x27')]['fields']));_0x5b3133[_0xdd40('0x2c')]=_0x5b3133[_0xdd40('0x2c')]['length']?_0x5b3133['attributes']:_0x42423a[_0xdd40('0x29')];_0x5b3133[_0xdd40('0x4e')]=qs[_0xdd40('0x31')](_0x2c6fbd['query']['sort']);_0x5b3133[_0xdd40('0x32')]=qs['filters'](_['pick'](_0x2c6fbd[_0xdd40('0x27')],_0x42423a['filters']));if(_0x2c6fbd[_0xdd40('0x27')][_0xdd40('0x35')]){_0x5b3133['where']=_[_0xdd40('0x36')](_0x5b3133[_0xdd40('0x32')],{'$or':_[_0xdd40('0x22')](_0x5b3133[_0xdd40('0x2c')],function(_0x218d7a){var _0x483bf4={};_0x483bf4[_0x218d7a]={'$like':'%'+_0x2c6fbd['query'][_0xdd40('0x35')]+'%'};return _0x483bf4;})});}_0x5b3133=_['merge']({},_0x5b3133,_0x2c6fbd[_0xdd40('0x38')]);return _0x3050dd[_0xdd40('0x50')](_0x5b3133);}})['then'](function(_0x5d2585){if(_0x5d2585){_0x591d08=_0x5d2585[_0xdd40('0x2d')];if(!_0x2c6fbd[_0xdd40('0x27')][_0xdd40('0x2e')](_0xdd40('0x4f'))){_0x5b3133[_0xdd40('0x2f')]=qs[_0xdd40('0x2f')](_0x2c6fbd[_0xdd40('0x27')][_0xdd40('0x2f')]);_0x5b3133[_0xdd40('0x30')]=qs[_0xdd40('0x30')](_0x2c6fbd[_0xdd40('0x27')][_0xdd40('0x30')]);}return _0x3050dd['getAnyConditions'](_0x5b3133);}})['then'](function(_0x575b26){if(_0x575b26){return _0x575b26?{'count':_0x591d08,'rows':_0x575b26}:null;}})['then'](respondWithResult(_0x418ac0,null))[_0xdd40('0x3e')](handleError(_0x418ac0,null));};exports[_0xdd40('0x51')]=function(_0x185ef4,_0x5abec6,_0xc468d4){if(_0x185ef4[_0xdd40('0x43')]['id']){delete _0x185ef4['body']['id'];}return db['Trigger'][_0xdd40('0x41')]({'where':{'id':_0x185ef4['params']['id']}})[_0xdd40('0x1d')](handleEntityNotFound(_0x5abec6,null))[_0xdd40('0x1d')](function(_0x19488e){if(_0x19488e){_0x185ef4[_0xdd40('0x43')]['TriggerId']=_0x19488e['id'];return db['Action'][_0xdd40('0x42')](_0x185ef4[_0xdd40('0x43')]);}})[_0xdd40('0x1d')](respondWithResult(_0x5abec6,null))[_0xdd40('0x3e')](handleError(_0x5abec6,null));};exports[_0xdd40('0x52')]=function(_0x59fe74,_0x583a6e,_0x308694){var _0x10a0cb={};var _0x1d1f49={};var _0x237c35;var _0x3cf217;return db[_0xdd40('0x3b')][_0xdd40('0x53')]({'where':{'id':_0x59fe74[_0xdd40('0x40')]['id']}})['then'](handleEntityNotFound(_0x583a6e,null))[_0xdd40('0x1d')](function(_0x13af55){if(_0x13af55){_0x237c35=_0x13af55;_0x1d1f49['model']=_[_0xdd40('0x28')](db[_0xdd40('0x54')][_0xdd40('0x23')]);_0x1d1f49['query']=_[_0xdd40('0x28')](_0x59fe74[_0xdd40('0x27')]);_0x1d1f49[_0xdd40('0x34')]=_[_0xdd40('0x2a')](_0x1d1f49['model'],_0x1d1f49[_0xdd40('0x27')]);_0x10a0cb[_0xdd40('0x2c')]=_['intersection'](_0x1d1f49[_0xdd40('0x29')],qs[_0xdd40('0x2b')](_0x59fe74[_0xdd40('0x27')][_0xdd40('0x2b')]));_0x10a0cb[_0xdd40('0x2c')]=_0x10a0cb[_0xdd40('0x2c')][_0xdd40('0x2d')]?_0x10a0cb[_0xdd40('0x2c')]:_0x1d1f49['model'];_0x10a0cb[_0xdd40('0x4e')]=qs[_0xdd40('0x31')](_0x59fe74['query'][_0xdd40('0x31')]);_0x10a0cb['where']=qs[_0xdd40('0x34')](_[_0xdd40('0x33')](_0x59fe74[_0xdd40('0x27')],_0x1d1f49[_0xdd40('0x34')]));if(_0x59fe74['query'][_0xdd40('0x35')]){_0x10a0cb[_0xdd40('0x32')]=_[_0xdd40('0x36')](_0x10a0cb[_0xdd40('0x32')],{'$or':_['map'](_0x10a0cb[_0xdd40('0x2c')],function(_0x19942f){var _0x1793a1={};_0x1793a1[_0x19942f]={'$like':'%'+_0x59fe74['query'][_0xdd40('0x35')]+'%'};return _0x1793a1;})});}_0x10a0cb=_[_0xdd40('0x36')]({},_0x10a0cb,_0x59fe74[_0xdd40('0x38')]);return _0x237c35[_0xdd40('0x52')](_0x10a0cb);}})['then'](function(_0x3ec839){if(_0x3ec839){_0x3cf217=_0x3ec839[_0xdd40('0x2d')];if(!_0x59fe74[_0xdd40('0x27')]['hasOwnProperty'](_0xdd40('0x4f'))){_0x10a0cb[_0xdd40('0x2f')]=qs[_0xdd40('0x2f')](_0x59fe74[_0xdd40('0x27')][_0xdd40('0x2f')]);_0x10a0cb[_0xdd40('0x30')]=qs[_0xdd40('0x30')](_0x59fe74['query']['offset']);}return _0x237c35['getActions'](_0x10a0cb);}})[_0xdd40('0x1d')](function(_0x459ce4){if(_0x459ce4){return _0x459ce4?{'count':_0x3cf217,'rows':_0x459ce4}:null;}})[_0xdd40('0x1d')](respondWithResult(_0x583a6e,null))[_0xdd40('0x3e')](handleError(_0x583a6e,null));}; \ No newline at end of file +var _0xbf66=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','Condition','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Trigger','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection'];(function(_0x1d826f,_0x4f5bae){var _0x4e829f=function(_0x368a0f){while(--_0x368a0f){_0x1d826f['push'](_0x1d826f['shift']());}};_0x4e829f(++_0x4f5bae);}(_0xbf66,0x1de));var _0x6bf6=function(_0x1e9c4b,_0xf515b3){_0x1e9c4b=_0x1e9c4b-0x0;var _0x3abddb=_0xbf66[_0x1e9c4b];return _0x3abddb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6bf6('0x0'));var rimraf=require(_0x6bf6('0x1'));var zipdir=require(_0x6bf6('0x2'));var jsonpatch=require(_0x6bf6('0x3'));var rp=require(_0x6bf6('0x4'));var moment=require(_0x6bf6('0x5'));var BPromise=require(_0x6bf6('0x6'));var Mustache=require('mustache');var util=require(_0x6bf6('0x7'));var path=require(_0x6bf6('0x8'));var sox=require(_0x6bf6('0x9'));var csv=require(_0x6bf6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6bf6('0xb'));var squel=require(_0x6bf6('0xc'));var crypto=require('crypto');var jsforce=require(_0x6bf6('0xd'));var deskjs=require(_0x6bf6('0xe'));var toCsv=require(_0x6bf6('0xa'));var querystring=require(_0x6bf6('0xf'));var Papa=require(_0x6bf6('0x10'));var Redis=require(_0x6bf6('0x11'));var authService=require(_0x6bf6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6bf6('0x13'));var hardwareService=require(_0x6bf6('0x14'));var logger=require('../../config/logger')(_0x6bf6('0x15'));var utils=require(_0x6bf6('0x16'));var config=require(_0x6bf6('0x17'));var db=require(_0x6bf6('0x18'))['db'];function respondWithStatusCode(_0x2b5442,_0x1d7771){_0x1d7771=_0x1d7771||0xcc;return function(_0x5abcb2){if(_0x5abcb2){return _0x2b5442[_0x6bf6('0x19')](_0x1d7771);}return _0x2b5442[_0x6bf6('0x1a')](_0x1d7771)[_0x6bf6('0x1b')]();};}function respondWithResult(_0x4526ef,_0x4910af){_0x4910af=_0x4910af||0xc8;return function(_0x45a570){if(_0x45a570){return _0x4526ef['status'](_0x4910af)['json'](_0x45a570);}};}function respondWithFilteredResult(_0x4d9b0c,_0x19f0f4){return function(_0x4a0ba3){if(_0x4a0ba3){var _0x20c756=_0x4a0ba3['count'],_0x21f471=_0x19f0f4[_0x6bf6('0x1c')],_0x273e54=_0x19f0f4['offset']+_0x19f0f4[_0x6bf6('0x1d')],_0x3709a5;if(_0x273e54>=_0x20c756){_0x273e54=_0x20c756;_0x3709a5=0xc8;}else{_0x3709a5=0xce;}_0x4d9b0c[_0x6bf6('0x1a')](_0x3709a5);return _0x4d9b0c['set'](_0x6bf6('0x1e'),_0x21f471+'-'+_0x273e54+'/'+_0x20c756)['json'](_0x4a0ba3);}return null;};}function patchUpdates(_0x2039ab){return function(_0x11ef8d){try{jsonpatch[_0x6bf6('0x1f')](_0x11ef8d,_0x2039ab,!![]);}catch(_0x22e01a){return BPromise[_0x6bf6('0x20')](_0x22e01a);}return _0x11ef8d[_0x6bf6('0x21')]();};}function saveUpdates(_0x5068fb,_0x37ab66){return function(_0x53fe73){if(_0x53fe73){return _0x53fe73[_0x6bf6('0x22')](_0x5068fb)[_0x6bf6('0x23')](function(_0x4e05bd){return _0x4e05bd;});}return null;};}function removeEntity(_0x37dacf,_0x29f981){return function(_0x27419f){if(_0x27419f){return _0x27419f[_0x6bf6('0x24')]()['then'](function(){var _0x57a8a9=_0x27419f[_0x6bf6('0x25')]({'plain':!![]});var _0x5bfbcf='Triggers';return db['UserProfileResource'][_0x6bf6('0x24')]({'where':{'type':_0x5bfbcf,'resourceId':_0x57a8a9['id']}})[_0x6bf6('0x23')](function(){return _0x27419f;});})[_0x6bf6('0x23')](function(){_0x37dacf[_0x6bf6('0x1a')](0xcc)[_0x6bf6('0x1b')]();});}};}function handleEntityNotFound(_0x2a0590,_0x27170e){return function(_0x45bfc3){if(!_0x45bfc3){_0x2a0590[_0x6bf6('0x19')](0x194);}return _0x45bfc3;};}function handleError(_0x230f3d,_0x232d82){_0x232d82=_0x232d82||0x1f4;return function(_0x5b507c){logger['error'](_0x5b507c[_0x6bf6('0x26')]);if(_0x5b507c[_0x6bf6('0x27')]){delete _0x5b507c[_0x6bf6('0x27')];}_0x230f3d[_0x6bf6('0x1a')](_0x232d82)['send'](_0x5b507c);};}exports[_0x6bf6('0x28')]=function(_0x25d7b8,_0x2b67a1){var _0x4a384b={},_0x115a4e={},_0x4c21e9={'count':0x0,'rows':[]};var _0x221f1b=_['map'](db['Trigger'][_0x6bf6('0x29')],function(_0x1bcc79){return{'name':_0x1bcc79[_0x6bf6('0x2a')],'type':_0x1bcc79[_0x6bf6('0x2b')][_0x6bf6('0x2c')]};});_0x115a4e[_0x6bf6('0x2d')]=_[_0x6bf6('0x2e')](_0x221f1b,_0x6bf6('0x27'));_0x115a4e[_0x6bf6('0x2f')]=_['keys'](_0x25d7b8['query']);_0x115a4e[_0x6bf6('0x30')]=_[_0x6bf6('0x31')](_0x115a4e[_0x6bf6('0x2d')],_0x115a4e['query']);_0x4a384b[_0x6bf6('0x32')]=_[_0x6bf6('0x31')](_0x115a4e[_0x6bf6('0x2d')],qs[_0x6bf6('0x33')](_0x25d7b8[_0x6bf6('0x2f')][_0x6bf6('0x33')]));_0x4a384b[_0x6bf6('0x32')]=_0x4a384b[_0x6bf6('0x32')][_0x6bf6('0x34')]?_0x4a384b[_0x6bf6('0x32')]:_0x115a4e['model'];if(!_0x25d7b8['query'][_0x6bf6('0x35')](_0x6bf6('0x36'))){_0x4a384b[_0x6bf6('0x1d')]=qs[_0x6bf6('0x1d')](_0x25d7b8[_0x6bf6('0x2f')]['limit']);_0x4a384b['offset']=qs[_0x6bf6('0x1c')](_0x25d7b8[_0x6bf6('0x2f')][_0x6bf6('0x1c')]);}_0x4a384b[_0x6bf6('0x37')]=qs['sort'](_0x25d7b8[_0x6bf6('0x2f')][_0x6bf6('0x38')]);_0x4a384b['where']=qs['filters'](_[_0x6bf6('0x39')](_0x25d7b8[_0x6bf6('0x2f')],_0x115a4e[_0x6bf6('0x30')]),_0x221f1b);if(_0x25d7b8[_0x6bf6('0x2f')][_0x6bf6('0x3a')]){_0x4a384b[_0x6bf6('0x3b')]=_[_0x6bf6('0x3c')](_0x4a384b[_0x6bf6('0x3b')],{'$or':_[_0x6bf6('0x2e')](_0x221f1b,function(_0x12f124){if(_0x12f124[_0x6bf6('0x2b')]!==_0x6bf6('0x3d')){var _0x1ed545={};_0x1ed545[_0x12f124[_0x6bf6('0x27')]]={'$like':'%'+_0x25d7b8[_0x6bf6('0x2f')][_0x6bf6('0x3a')]+'%'};return _0x1ed545;}})});}_0x4a384b=_['merge']({},_0x4a384b,_0x25d7b8[_0x6bf6('0x3e')]);var _0x3653b5={'where':_0x4a384b[_0x6bf6('0x3b')]};return db[_0x6bf6('0x3f')][_0x6bf6('0x40')](_0x3653b5)['then'](function(_0x11dcf2){_0x4c21e9[_0x6bf6('0x40')]=_0x11dcf2;if(_0x25d7b8[_0x6bf6('0x2f')][_0x6bf6('0x41')]){_0x4a384b['include']=[{'all':!![]}];}return db[_0x6bf6('0x3f')][_0x6bf6('0x42')](_0x4a384b);})[_0x6bf6('0x23')](function(_0x1762fa){_0x4c21e9[_0x6bf6('0x43')]=_0x1762fa;return _0x4c21e9;})[_0x6bf6('0x23')](respondWithFilteredResult(_0x2b67a1,_0x4a384b))[_0x6bf6('0x44')](handleError(_0x2b67a1,null));};exports[_0x6bf6('0x45')]=function(_0x5a5397,_0x527eb0){var _0x26273f={'raw':![],'where':{'id':_0x5a5397[_0x6bf6('0x46')]['id']}},_0x187df5={};_0x187df5[_0x6bf6('0x2d')]=_[_0x6bf6('0x47')](db[_0x6bf6('0x3f')][_0x6bf6('0x29')]);_0x187df5[_0x6bf6('0x2f')]=_[_0x6bf6('0x47')](_0x5a5397['query']);_0x187df5['filters']=_[_0x6bf6('0x31')](_0x187df5[_0x6bf6('0x2d')],_0x187df5[_0x6bf6('0x2f')]);_0x26273f[_0x6bf6('0x32')]=_[_0x6bf6('0x31')](_0x187df5['model'],qs[_0x6bf6('0x33')](_0x5a5397[_0x6bf6('0x2f')][_0x6bf6('0x33')]));_0x26273f['attributes']=_0x26273f['attributes'][_0x6bf6('0x34')]?_0x26273f[_0x6bf6('0x32')]:_0x187df5['model'];if(_0x5a5397['query'][_0x6bf6('0x41')]){_0x26273f[_0x6bf6('0x48')]=[{'all':!![]}];}_0x26273f=_['merge']({},_0x26273f,_0x5a5397[_0x6bf6('0x3e')]);return db[_0x6bf6('0x3f')][_0x6bf6('0x49')](_0x26273f)[_0x6bf6('0x23')](handleEntityNotFound(_0x527eb0,null))[_0x6bf6('0x23')](respondWithResult(_0x527eb0,null))[_0x6bf6('0x44')](handleError(_0x527eb0,null));};exports[_0x6bf6('0x4a')]=function(_0x2a39e7,_0x95fbe7){return db['Trigger'][_0x6bf6('0x4a')](_0x2a39e7[_0x6bf6('0x4b')],{})[_0x6bf6('0x23')](function(_0x52204d){var _0x543c61=_0x2a39e7[_0x6bf6('0x4c')][_0x6bf6('0x25')]({'plain':!![]});if(!_0x543c61)throw new Error(_0x6bf6('0x4d'));if(_0x543c61['role']==='user'){var _0xa65884=_0x52204d[_0x6bf6('0x25')]({'plain':!![]});var _0x40d0bd=_0x6bf6('0x4e');return db[_0x6bf6('0x4f')][_0x6bf6('0x49')]({'where':{'name':_0x40d0bd,'userProfileId':_0x543c61['userProfileId']},'raw':!![]})[_0x6bf6('0x23')](function(_0x45fc46){if(_0x45fc46&&_0x45fc46[_0x6bf6('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0xa65884[_0x6bf6('0x27')],'resourceId':_0xa65884['id'],'type':_0x45fc46[_0x6bf6('0x27')],'sectionId':_0x45fc46['id']},{})[_0x6bf6('0x23')](function(){return _0x52204d;});}else{return _0x52204d;}})[_0x6bf6('0x44')](function(_0x2c1f77){logger['error'](_0x6bf6('0x51'),_0x2c1f77);throw _0x2c1f77;});}return _0x52204d;})[_0x6bf6('0x23')](respondWithResult(_0x95fbe7,0xc9))[_0x6bf6('0x44')](handleError(_0x95fbe7,null));};exports[_0x6bf6('0x22')]=function(_0x36aed5,_0xfbd382){if(_0x36aed5[_0x6bf6('0x4b')]['id']){delete _0x36aed5[_0x6bf6('0x4b')]['id'];}return db[_0x6bf6('0x3f')][_0x6bf6('0x49')]({'where':{'id':_0x36aed5[_0x6bf6('0x46')]['id']}})[_0x6bf6('0x23')](handleEntityNotFound(_0xfbd382,null))['then'](saveUpdates(_0x36aed5[_0x6bf6('0x4b')],null))['then'](respondWithResult(_0xfbd382,null))[_0x6bf6('0x44')](handleError(_0xfbd382,null));};exports[_0x6bf6('0x24')]=function(_0x523759,_0xa08f6a){return db[_0x6bf6('0x3f')][_0x6bf6('0x49')]({'where':{'id':_0x523759['params']['id']}})['then'](handleEntityNotFound(_0xa08f6a,null))[_0x6bf6('0x23')](removeEntity(_0xa08f6a,null))['catch'](handleError(_0xa08f6a,null));};exports[_0x6bf6('0x52')]=function(_0xe551fb,_0x3e0bab,_0x56a25c){if(_0xe551fb[_0x6bf6('0x4b')]['id']){delete _0xe551fb[_0x6bf6('0x4b')]['id'];}return db[_0x6bf6('0x3f')][_0x6bf6('0x49')]({'where':{'id':_0xe551fb[_0x6bf6('0x46')]['id']}})[_0x6bf6('0x23')](handleEntityNotFound(_0x3e0bab,null))[_0x6bf6('0x23')](function(_0x430f66){if(_0x430f66){_0xe551fb[_0x6bf6('0x4b')][_0x6bf6('0x53')]=_0x430f66['id'];return db['Condition']['create'](_0xe551fb[_0x6bf6('0x4b')]);}})[_0x6bf6('0x23')](respondWithResult(_0x3e0bab,null))[_0x6bf6('0x44')](handleError(_0x3e0bab,null));};exports[_0x6bf6('0x54')]=function(_0x4c17a1,_0x42072e,_0x1d741f){if(_0x4c17a1[_0x6bf6('0x4b')]['id']){delete _0x4c17a1[_0x6bf6('0x4b')]['id'];}return db[_0x6bf6('0x3f')][_0x6bf6('0x49')]({'where':{'id':_0x4c17a1[_0x6bf6('0x46')]['id']}})['then'](handleEntityNotFound(_0x42072e,null))[_0x6bf6('0x23')](function(_0x2754d5){if(_0x2754d5){_0x4c17a1['body'][_0x6bf6('0x55')]=_0x2754d5['id'];return db['Condition'][_0x6bf6('0x4a')](_0x4c17a1['body']);}})[_0x6bf6('0x23')](respondWithResult(_0x42072e,null))[_0x6bf6('0x44')](handleError(_0x42072e,null));};exports['getAllConditions']=function(_0x506d5f,_0x54887d,_0x3aa167){var _0x3d93f4={};var _0x27de5c={};var _0x306a86;var _0x20a72f;return db[_0x6bf6('0x3f')][_0x6bf6('0x56')]({'where':{'id':_0x506d5f['params']['id']}})['then'](handleEntityNotFound(_0x54887d,null))[_0x6bf6('0x23')](function(_0x473ade){if(_0x473ade){_0x306a86=_0x473ade;_0x27de5c[_0x6bf6('0x2d')]=_[_0x6bf6('0x47')](db['Condition'][_0x6bf6('0x29')]);_0x27de5c[_0x6bf6('0x2f')]=_[_0x6bf6('0x47')](_0x506d5f[_0x6bf6('0x2f')]);_0x27de5c[_0x6bf6('0x30')]=_[_0x6bf6('0x31')](_0x27de5c[_0x6bf6('0x2d')],_0x27de5c[_0x6bf6('0x2f')]);_0x3d93f4[_0x6bf6('0x32')]=_[_0x6bf6('0x31')](_0x27de5c[_0x6bf6('0x2d')],qs[_0x6bf6('0x33')](_0x506d5f['query'][_0x6bf6('0x33')]));_0x3d93f4[_0x6bf6('0x32')]=_0x3d93f4[_0x6bf6('0x32')][_0x6bf6('0x34')]?_0x3d93f4[_0x6bf6('0x32')]:_0x27de5c[_0x6bf6('0x2d')];_0x3d93f4[_0x6bf6('0x37')]=qs[_0x6bf6('0x38')](_0x506d5f[_0x6bf6('0x2f')][_0x6bf6('0x38')]);_0x3d93f4[_0x6bf6('0x3b')]=qs[_0x6bf6('0x30')](_['pick'](_0x506d5f['query'],_0x27de5c[_0x6bf6('0x30')]));if(_0x506d5f[_0x6bf6('0x2f')][_0x6bf6('0x3a')]){_0x3d93f4[_0x6bf6('0x3b')]=_[_0x6bf6('0x3c')](_0x3d93f4[_0x6bf6('0x3b')],{'$or':_[_0x6bf6('0x2e')](_0x3d93f4[_0x6bf6('0x32')],function(_0x43f78b){var _0x30cc1a={};_0x30cc1a[_0x43f78b]={'$like':'%'+_0x506d5f[_0x6bf6('0x2f')]['filter']+'%'};return _0x30cc1a;})});}_0x3d93f4=_[_0x6bf6('0x3c')]({},_0x3d93f4,_0x506d5f[_0x6bf6('0x3e')]);return _0x306a86[_0x6bf6('0x57')](_0x3d93f4);}})[_0x6bf6('0x23')](function(_0x407a90){if(_0x407a90){_0x20a72f=_0x407a90[_0x6bf6('0x34')];if(!_0x506d5f[_0x6bf6('0x2f')][_0x6bf6('0x35')](_0x6bf6('0x36'))){_0x3d93f4[_0x6bf6('0x1d')]=qs[_0x6bf6('0x1d')](_0x506d5f[_0x6bf6('0x2f')]['limit']);_0x3d93f4['offset']=qs[_0x6bf6('0x1c')](_0x506d5f['query']['offset']);}return _0x306a86[_0x6bf6('0x57')](_0x3d93f4);}})[_0x6bf6('0x23')](function(_0x5b5b27){if(_0x5b5b27){return _0x5b5b27?{'count':_0x20a72f,'rows':_0x5b5b27}:null;}})[_0x6bf6('0x23')](respondWithResult(_0x54887d,null))[_0x6bf6('0x44')](handleError(_0x54887d,null));};exports[_0x6bf6('0x58')]=function(_0x1ea780,_0xd0d835,_0x4b4ec9){var _0x2b7535={};var _0x1566cf={};var _0x10c707;var _0x40ccea;return db['Trigger'][_0x6bf6('0x56')]({'where':{'id':_0x1ea780[_0x6bf6('0x46')]['id']}})['then'](handleEntityNotFound(_0xd0d835,null))[_0x6bf6('0x23')](function(_0x28c839){if(_0x28c839){_0x10c707=_0x28c839;_0x1566cf[_0x6bf6('0x2d')]=_[_0x6bf6('0x47')](db[_0x6bf6('0x59')][_0x6bf6('0x29')]);_0x1566cf[_0x6bf6('0x2f')]=_[_0x6bf6('0x47')](_0x1ea780[_0x6bf6('0x2f')]);_0x1566cf[_0x6bf6('0x30')]=_[_0x6bf6('0x31')](_0x1566cf[_0x6bf6('0x2d')],_0x1566cf[_0x6bf6('0x2f')]);_0x2b7535[_0x6bf6('0x32')]=_[_0x6bf6('0x31')](_0x1566cf[_0x6bf6('0x2d')],qs[_0x6bf6('0x33')](_0x1ea780[_0x6bf6('0x2f')][_0x6bf6('0x33')]));_0x2b7535[_0x6bf6('0x32')]=_0x2b7535[_0x6bf6('0x32')]['length']?_0x2b7535['attributes']:_0x1566cf[_0x6bf6('0x2d')];_0x2b7535['order']=qs[_0x6bf6('0x38')](_0x1ea780[_0x6bf6('0x2f')][_0x6bf6('0x38')]);_0x2b7535[_0x6bf6('0x3b')]=qs[_0x6bf6('0x30')](_[_0x6bf6('0x39')](_0x1ea780['query'],_0x1566cf[_0x6bf6('0x30')]));if(_0x1ea780[_0x6bf6('0x2f')][_0x6bf6('0x3a')]){_0x2b7535[_0x6bf6('0x3b')]=_['merge'](_0x2b7535[_0x6bf6('0x3b')],{'$or':_[_0x6bf6('0x2e')](_0x2b7535[_0x6bf6('0x32')],function(_0x4a5606){var _0x42c900={};_0x42c900[_0x4a5606]={'$like':'%'+_0x1ea780[_0x6bf6('0x2f')]['filter']+'%'};return _0x42c900;})});}_0x2b7535=_[_0x6bf6('0x3c')]({},_0x2b7535,_0x1ea780[_0x6bf6('0x3e')]);return _0x10c707['getAnyConditions'](_0x2b7535);}})[_0x6bf6('0x23')](function(_0x24659f){if(_0x24659f){_0x40ccea=_0x24659f[_0x6bf6('0x34')];if(!_0x1ea780[_0x6bf6('0x2f')][_0x6bf6('0x35')]('nolimit')){_0x2b7535[_0x6bf6('0x1d')]=qs[_0x6bf6('0x1d')](_0x1ea780[_0x6bf6('0x2f')][_0x6bf6('0x1d')]);_0x2b7535['offset']=qs[_0x6bf6('0x1c')](_0x1ea780[_0x6bf6('0x2f')]['offset']);}return _0x10c707[_0x6bf6('0x58')](_0x2b7535);}})[_0x6bf6('0x23')](function(_0x5892f3){if(_0x5892f3){return _0x5892f3?{'count':_0x40ccea,'rows':_0x5892f3}:null;}})[_0x6bf6('0x23')](respondWithResult(_0xd0d835,null))['catch'](handleError(_0xd0d835,null));};exports['addAction']=function(_0x2757ce,_0x558d70,_0x1a3d23){if(_0x2757ce[_0x6bf6('0x4b')]['id']){delete _0x2757ce[_0x6bf6('0x4b')]['id'];}return db[_0x6bf6('0x3f')]['find']({'where':{'id':_0x2757ce[_0x6bf6('0x46')]['id']}})[_0x6bf6('0x23')](handleEntityNotFound(_0x558d70,null))[_0x6bf6('0x23')](function(_0x21a05b){if(_0x21a05b){_0x2757ce['body'][_0x6bf6('0x5a')]=_0x21a05b['id'];return db[_0x6bf6('0x5b')][_0x6bf6('0x4a')](_0x2757ce[_0x6bf6('0x4b')]);}})[_0x6bf6('0x23')](respondWithResult(_0x558d70,null))[_0x6bf6('0x44')](handleError(_0x558d70,null));};exports[_0x6bf6('0x5c')]=function(_0x327b60,_0x17f7ef,_0x4bf04f){var _0x49f27c={};var _0x5e9799={};var _0x3bbb99;var _0x7aa167;return db[_0x6bf6('0x3f')][_0x6bf6('0x56')]({'where':{'id':_0x327b60[_0x6bf6('0x46')]['id']}})[_0x6bf6('0x23')](handleEntityNotFound(_0x17f7ef,null))[_0x6bf6('0x23')](function(_0x530c32){if(_0x530c32){_0x3bbb99=_0x530c32;_0x5e9799[_0x6bf6('0x2d')]=_[_0x6bf6('0x47')](db['Action'][_0x6bf6('0x29')]);_0x5e9799[_0x6bf6('0x2f')]=_[_0x6bf6('0x47')](_0x327b60[_0x6bf6('0x2f')]);_0x5e9799['filters']=_[_0x6bf6('0x31')](_0x5e9799[_0x6bf6('0x2d')],_0x5e9799[_0x6bf6('0x2f')]);_0x49f27c[_0x6bf6('0x32')]=_['intersection'](_0x5e9799[_0x6bf6('0x2d')],qs[_0x6bf6('0x33')](_0x327b60[_0x6bf6('0x2f')][_0x6bf6('0x33')]));_0x49f27c[_0x6bf6('0x32')]=_0x49f27c['attributes'][_0x6bf6('0x34')]?_0x49f27c['attributes']:_0x5e9799[_0x6bf6('0x2d')];_0x49f27c[_0x6bf6('0x37')]=qs['sort'](_0x327b60[_0x6bf6('0x2f')][_0x6bf6('0x38')]);_0x49f27c[_0x6bf6('0x3b')]=qs[_0x6bf6('0x30')](_['pick'](_0x327b60[_0x6bf6('0x2f')],_0x5e9799[_0x6bf6('0x30')]));if(_0x327b60[_0x6bf6('0x2f')][_0x6bf6('0x3a')]){_0x49f27c[_0x6bf6('0x3b')]=_[_0x6bf6('0x3c')](_0x49f27c[_0x6bf6('0x3b')],{'$or':_[_0x6bf6('0x2e')](_0x49f27c[_0x6bf6('0x32')],function(_0x5cb8bb){var _0x3b612c={};_0x3b612c[_0x5cb8bb]={'$like':'%'+_0x327b60[_0x6bf6('0x2f')]['filter']+'%'};return _0x3b612c;})});}_0x49f27c=_['merge']({},_0x49f27c,_0x327b60[_0x6bf6('0x3e')]);return _0x3bbb99[_0x6bf6('0x5c')](_0x49f27c);}})[_0x6bf6('0x23')](function(_0x3c80b8){if(_0x3c80b8){_0x7aa167=_0x3c80b8[_0x6bf6('0x34')];if(!_0x327b60[_0x6bf6('0x2f')][_0x6bf6('0x35')]('nolimit')){_0x49f27c[_0x6bf6('0x1d')]=qs[_0x6bf6('0x1d')](_0x327b60['query'][_0x6bf6('0x1d')]);_0x49f27c[_0x6bf6('0x1c')]=qs['offset'](_0x327b60['query']['offset']);}return _0x3bbb99[_0x6bf6('0x5c')](_0x49f27c);}})[_0x6bf6('0x23')](function(_0x2b3256){if(_0x2b3256){return _0x2b3256?{'count':_0x7aa167,'rows':_0x2b3256}:null;}})['then'](respondWithResult(_0x17f7ef,null))[_0x6bf6('0x44')](handleError(_0x17f7ef,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f9383c4..fe121ca 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 _0x0429=['bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','api','moment'];(function(_0x4bd189,_0x1dd991){var _0x43e248=function(_0x4c2623){while(--_0x4c2623){_0x4bd189['push'](_0x4bd189['shift']());}};_0x43e248(++_0x1dd991);}(_0x0429,0x17d));var _0x9042=function(_0x344a15,_0xac579c){_0x344a15=_0x344a15-0x0;var _0x11bb03=_0x0429[_0x344a15];return _0x11bb03;};'use strict';var _=require(_0x9042('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9042('0x1'));var moment=require(_0x9042('0x2'));var BPromise=require(_0x9042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9042('0x4'));var rimraf=require(_0x9042('0x5'));var config=require(_0x9042('0x6'));var attributes=require(_0x9042('0x7'));module[_0x9042('0x8')]=function(_0x231915,_0x37471a){return _0x231915[_0x9042('0x9')](_0x9042('0xa'),attributes,{'tableName':_0x9042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','util','api','moment'];(function(_0x1c0801,_0xfab5af){var _0x508247=function(_0x43383a){while(--_0x43383a){_0x1c0801['push'](_0x1c0801['shift']());}};_0x508247(++_0xfab5af);}(_0xadb5,0xad));var _0x5adb=function(_0x5c4953,_0x5132c1){_0x5c4953=_0x5c4953-0x0;var _0x371d7f=_0xadb5[_0x5c4953];return _0x371d7f;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./trigger.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('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 5625768..b790090 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 _0xeffd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','GetTrigger','find','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeffd,0x6b));var _0xdeff=function(_0x3f4acb,_0xbfa955){_0x3f4acb=_0x3f4acb-0x0;var _0x2b288d=_0xeffd[_0x3f4acb];return _0x2b288d;};'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});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('Trigger,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});}exports['GetTrigger']=function(_0x5c9837){var _0x35635f=this;return new Promise(function(_0x369e13,_0x4b14b6){return db[_0xdeff('0x19')][_0xdeff('0x1a')]({'raw':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837[_0xdeff('0x1b')][_0xdeff('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837[_0xdeff('0x1b')][_0xdeff('0x1d')]||null:null,'attributes':_0x5c9837['options']?_0x5c9837['options']['attributes']||null:null,'limit':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837['options'][_0xdeff('0x1e')]||null:null,'include':_0x5c9837[_0xdeff('0x1b')]?_0x5c9837['options'][_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x5c9837['options']['include'],function(_0x3b2554){return{'model':db[_0x3b2554[_0xdeff('0x21')]],'as':_0x3b2554['as'],'attributes':_0x3b2554[_0xdeff('0x22')],'include':_0x3b2554[_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x3b2554['include'],function(_0xb08f19){return{'model':db[_0xb08f19[_0xdeff('0x21')]],'as':_0xb08f19['as'],'attributes':_0xb08f19[_0xdeff('0x22')],'include':_0xb08f19[_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0xb08f19[_0xdeff('0x1f')],function(_0x3d0111){return{'model':db[_0x3d0111['model']],'as':_0x3d0111['as'],'attributes':_0x3d0111[_0xdeff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x53b168){logger['info'](_0xdeff('0x23'),_0x5c9837);logger[_0xdeff('0x10')](_0xdeff('0x23'),_0x5c9837,JSON[_0xdeff('0x12')](_0x53b168));_0x369e13(_0x53b168);})[_0xdeff('0x18')](function(_0xf9b278){logger[_0xdeff('0x13')]('GetTrigger',_0xf9b278[_0xdeff('0x16')],_0x5c9837);_0x4b14b6(_0x35635f[_0xdeff('0x13')](0x1f4,_0xf9b278[_0xdeff('0x16')]));});});};exports['ShowTrigger']=function(_0x59f7a0){var _0x346743=this;return new Promise(function(_0x505e3f,_0x69842a){return db[_0xdeff('0x19')][_0xdeff('0x24')]({'raw':_0x59f7a0['options']?_0x59f7a0[_0xdeff('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x59f7a0['options']?_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1d')]||null:null,'attributes':_0x59f7a0[_0xdeff('0x1b')]?_0x59f7a0[_0xdeff('0x1b')]['attributes']||null:null,'include':_0x59f7a0[_0xdeff('0x1b')]?_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1f')]?_[_0xdeff('0x20')](_0x59f7a0[_0xdeff('0x1b')][_0xdeff('0x1f')],function(_0x321ef0){return{'model':db[_0x321ef0['model']],'as':_0x321ef0['as'],'attributes':_0x321ef0[_0xdeff('0x22')],'include':_0x321ef0['include']?_[_0xdeff('0x20')](_0x321ef0[_0xdeff('0x1f')],function(_0x2e1736){return{'model':db[_0x2e1736[_0xdeff('0x21')]],'as':_0x2e1736['as'],'attributes':_0x2e1736[_0xdeff('0x22')],'include':_0x2e1736[_0xdeff('0x1f')]?_['map'](_0x2e1736[_0xdeff('0x1f')],function(_0x3bf462){return{'model':db[_0x3bf462['model']],'as':_0x3bf462['as'],'attributes':_0x3bf462[_0xdeff('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdeff('0xd')](function(_0x1c6d4c){logger[_0xdeff('0xe')](_0xdeff('0x25'),_0x59f7a0);logger[_0xdeff('0x10')](_0xdeff('0x25'),_0x59f7a0,JSON[_0xdeff('0x12')](_0x1c6d4c));_0x505e3f(_0x1c6d4c);})['catch'](function(_0x118752){logger['error'](_0xdeff('0x25'),_0x118752[_0xdeff('0x16')],_0x59f7a0);_0x69842a(_0x346743[_0xdeff('0x13')](0x1f4,_0x118752['message']));});});}; \ No newline at end of file +var _0x5ec6=['util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','ShowTrigger','find','lodash'];(function(_0x4163bc,_0x5d3dcf){var _0x548b63=function(_0x19cc3c){while(--_0x19cc3c){_0x4163bc['push'](_0x4163bc['shift']());}};_0x548b63(++_0x5d3dcf);}(_0x5ec6,0x7f));var _0x65ec=function(_0xe4fdc,_0x341664){_0xe4fdc=_0xe4fdc-0x0;var _0x14ec00=_0x5ec6[_0xe4fdc];return _0x14ec00;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('Trigger,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')]({'raw':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x19')]||null:null,'attributes':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'limit':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')]['limit']||null:null,'include':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0x47288d){return{'model':db[_0x47288d['model']],'as':_0x47288d['as'],'attributes':_0x47288d[_0x65ec('0x1a')],'include':_0x47288d[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x47288d[_0x65ec('0x1b')],function(_0x288e66){return{'model':db[_0x288e66[_0x65ec('0x1d')]],'as':_0x288e66['as'],'attributes':_0x288e66[_0x65ec('0x1a')],'include':_0x288e66[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x288e66['include'],function(_0x10baef){return{'model':db[_0x10baef[_0x65ec('0x1d')]],'as':_0x10baef['as'],'attributes':_0x10baef[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x4de451){logger[_0x65ec('0x12')]('GetTrigger',_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x4de451));_0x29ebc4(_0x4de451);})[_0x65ec('0x13')](function(_0x14431d){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x14431d[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x14431d[_0x65ec('0x11')]));});});};exports[_0x65ec('0x1e')]=function(_0x4b435c){var _0x50d81f=this;return new Promise(function(_0x1d2e24,_0x5084af){return db[_0x65ec('0x15')][_0x65ec('0x1f')]({'raw':_0x4b435c['options']?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')]['where']||null:null,'attributes':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'include':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0xff3f3c){return{'model':db[_0xff3f3c['model']],'as':_0xff3f3c['as'],'attributes':_0xff3f3c[_0x65ec('0x1a')],'include':_0xff3f3c[_0x65ec('0x1b')]?_['map'](_0xff3f3c[_0x65ec('0x1b')],function(_0x24a242){return{'model':db[_0x24a242[_0x65ec('0x1d')]],'as':_0x24a242['as'],'attributes':_0x24a242[_0x65ec('0x1a')],'include':_0x24a242[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x24a242[_0x65ec('0x1b')],function(_0x5afcfc){return{'model':db[_0x5afcfc[_0x65ec('0x1d')]],'as':_0x5afcfc['as'],'attributes':_0x5afcfc[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x185447){logger['info'](_0x65ec('0x1e'),_0x4b435c);logger[_0x65ec('0xc')](_0x65ec('0x1e'),_0x4b435c,JSON[_0x65ec('0xe')](_0x185447));_0x1d2e24(_0x185447);})['catch'](function(_0x59a1c2){logger[_0x65ec('0xf')]('ShowTrigger',_0x59a1c2[_0x65ec('0x11')],_0x4b435c);_0x5084af(_0x50d81f[_0x65ec('0xf')](0x1f4,_0x59a1c2['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 228951a..f980e3c 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 _0x00bb=['../../components/auth/service','../../components/interaction/service','./trunk.controller','get','/:id','isAuthenticated','show','post','/:id/clone','create','put','delete','exports','multer','util','path','express'];(function(_0x130e07,_0x5ee64e){var _0x3fd7c9=function(_0xbcefd1){while(--_0xbcefd1){_0x130e07['push'](_0x130e07['shift']());}};_0x3fd7c9(++_0x5ee64e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0xb')](_0xb00b('0xc'),auth[_0xb00b('0x9')](),controller['clone']);router['post']('/',auth[_0xb00b('0x9')](),controller[_0xb00b('0xd')]);router[_0xb00b('0xe')](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller['update']);router[_0xb00b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb00b('0x10')]=router; \ No newline at end of file +var _0x5c12=['./trunk.controller','get','index','/:id','post','/:id/clone','isAuthenticated','clone','create','put','update','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x596edc,_0x5690c3){var _0x14886b=function(_0x263a02){while(--_0x263a02){_0x596edc['push'](_0x596edc['shift']());}};_0x14886b(++_0x5690c3);}(_0x5c12,0x188));var _0x25c1=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x5c12[_0x819464];return _0x49dcc0;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var auth=require(_0x25c1('0x4'));var interaction=require(_0x25c1('0x5'));var config=require(_0x25c1('0x6'));var controller=require(_0x25c1('0x7'));router[_0x25c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x25c1('0x9')]);router[_0x25c1('0x8')](_0x25c1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x25c1('0xb')](_0x25c1('0xc'),auth[_0x25c1('0xd')](),controller[_0x25c1('0xe')]);router[_0x25c1('0xb')]('/',auth['isAuthenticated'](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xa'),auth[_0x25c1('0xd')](),controller[_0x25c1('0x11')]);router['delete'](_0x25c1('0xa'),auth[_0x25c1('0xd')](),controller['destroy']);module[_0x25c1('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 2dfee6c..e478d2c 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 _0xdf93=['from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','rfc2833','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]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING'];(function(_0x15d354,_0x54a472){var _0x5c7e53=function(_0x5da09e){while(--_0x5da09e){_0x15d354['push'](_0x15d354['shift']());}};_0x5c7e53(++_0x54a472);}(_0xdf93,0x101));var _0x3df9=function(_0x5c5613,_0x1d277f){_0x5c5613=_0x5c5613-0x0;var _0xcab7bd=_0xdf93[_0x5c5613];return _0xcab7bd;};'use strict';var Sequelize=require(_0x3df9('0x0'));module[_0x3df9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3df9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x4'),_0x3df9('0x5'),_0x3df9('0x6')),'allowNull':![],'defaultValue':_0x3df9('0x4')},'context':{'type':Sequelize[_0x3df9('0x7')],'allowNull':![],'defaultValue':_0x3df9('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0x3df9('0x9'),_0x3df9('0xa'),_0x3df9('0xb'),'ALLOWED',_0x3df9('0xc'),_0x3df9('0xd'),'PROHIB_FAILED_SCREEN',_0x3df9('0xe'))},'deny':{'type':Sequelize[_0x3df9('0x7')]},'permit':{'type':Sequelize[_0x3df9('0x7')]},'secret':{'type':Sequelize[_0x3df9('0x7')]},'md5secret':{'type':Sequelize[_0x3df9('0x7')]},'remotesecret':{'type':Sequelize[_0x3df9('0x7')]},'transport':{'type':Sequelize[_0x3df9('0x7')],'defaultValue':_0x3df9('0xf'),'set':function(_0x4bfa84){this[_0x3df9('0x10')](_0x3df9('0x11'),_0x4bfa84?_0x4bfa84[_0x3df9('0x12')](','):null);},'get':function(){return this[_0x3df9('0x13')]('transport')?this[_0x3df9('0x13')](_0x3df9('0x11'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x3df9('0x14'),'info','shortinfo',_0x3df9('0x15'),_0x3df9('0x16')),'defaultValue':_0x3df9('0x14')},'directmedia':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no','nonat',_0x3df9('0x18'),_0x3df9('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3df9('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3df9('0x7')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3df9('0x7')],'defaultValue':_0x3df9('0x1a'),'set':function(_0x13bf04){this[_0x3df9('0x10')](_0x3df9('0x1b'),_0x13bf04?_0x13bf04[_0x3df9('0x12')](','):null);},'get':function(){return this[_0x3df9('0x13')](_0x3df9('0x1b'))?this['getDataValue'](_0x3df9('0x1b'))[_0x3df9('0x1c')](','):null;},'comment':_0x3df9('0x1d')},'callgroup':{'type':Sequelize[_0x3df9('0x7')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3df9('0x7')]},'language':{'type':Sequelize[_0x3df9('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3df9('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3df9('0x7')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3df9('0x7')],'allowNull':![],'defaultValue':_0x3df9('0x1e'),'set':function(_0x47b135){this[_0x3df9('0x10')](_0x3df9('0x1f'),_0x47b135?_0x47b135[_0x3df9('0x12')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3df9('0x13')](_0x3df9('0x1f'))?this[_0x3df9('0x13')](_0x3df9('0x1f'))['split'](';'):null;},'comment':_0x3df9('0x20')},'autoframing':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no')},'insecure':{'type':Sequelize[_0x3df9('0x7')],'defaultValue':_0x3df9('0x21'),'set':function(_0x36a237){this['setDataValue'](_0x3df9('0x22'),_0x36a237?_0x36a237[_0x3df9('0x12')](','):null);},'get':function(){return this['getDataValue'](_0x3df9('0x22'))?this[_0x3df9('0x13')]('insecure')[_0x3df9('0x1c')](','):null;},'comment':_0x3df9('0x23')},'trustrpid':{'type':Sequelize[_0x3df9('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x3df9('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3df9('0x3')]('yes','no',_0x3df9('0x24'))},'promiscredir':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x3df9('0x7')]},'callerid':{'type':Sequelize[_0x3df9('0x7')],'defaultValue':_0x3df9('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x3df9('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3df9('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x3df9('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x3df9('0x7')]},'template':{'type':Sequelize[_0x3df9('0x7')]},'videosupport':{'type':Sequelize[_0x3df9('0x3')]('yes','no',_0x3df9('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3df9('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x28'),_0x3df9('0x29'),_0x3df9('0x2a'))},'session_expires':{'type':Sequelize[_0x3df9('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x3df9('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x2b'),'uas'),'defaultValue':_0x3df9('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x3df9('0x7')]},'regexten':{'type':Sequelize[_0x3df9('0x7')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x3df9('0x7')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no'),'defaultValue':_0x3df9('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3df9('0x7')]},'defaultuser':{'type':Sequelize[_0x3df9('0x7')]},'rtptimeout':{'type':Sequelize[_0x3df9('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3df9('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3df9('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x3df9('0x3')]('yes','no',_0x3df9('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3df9('0x7')]},'callbackextension':{'type':Sequelize[_0x3df9('0x7')]},'timert1':{'type':Sequelize[_0x3df9('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x3df9('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x3df9('0x7')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x3df9('0x7')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x3df9('0x7')]},'maxforwards':{'type':Sequelize[_0x3df9('0x26')](0xb)},'encryption':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3df9('0x17'),'no')},'force_avp':{'type':Sequelize[_0x3df9('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no','fingerprint',_0x3df9('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x3df9('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3df9('0x7')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x3df9('0x7')]},'dtlscafile':{'type':Sequelize[_0x3df9('0x7')]},'dtlscapath':{'type':Sequelize[_0x3df9('0x7')]},'dtlssetup':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x2f'),_0x3df9('0x30'),_0x3df9('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3df9('0x7')]},'usereqphone':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3df9('0x7')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x3df9('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x3df9('0x7')]},'mohsuggest':{'type':Sequelize[_0x3df9('0x7')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3df9('0x7')],'defaultValue':_0x3df9('0x32')},'canreinvite':{'type':Sequelize[_0x3df9('0x3')](_0x3df9('0x17'),'no','nonat',_0x3df9('0x18'),_0x3df9('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x3df9('0x7')]},'active':{'type':Sequelize[_0x3df9('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3df9('0x7')],'defaultValue':'no'}}; \ No newline at end of file +var _0x45e2=['passive','actpass','update,nonat','BOOLEAN','sequelize','exports','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','pai','certificate'];(function(_0x5ee6c2,_0x5b2020){var _0x5b280d=function(_0x281b56){while(--_0x281b56){_0x5ee6c2['push'](_0x5ee6c2['shift']());}};_0x5b280d(++_0x5b2020);}(_0x45e2,0x1cf));var _0x245e=function(_0x947537,_0x15f698){_0x947537=_0x947537-0x0;var _0x2b3f2c=_0x45e2[_0x947537];return _0x2b3f2c;};'use strict';var Sequelize=require(_0x245e('0x0'));module[_0x245e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x3'),_0x245e('0x4'),_0x245e('0x5')),'allowNull':![],'defaultValue':_0x245e('0x3')},'context':{'type':Sequelize[_0x245e('0x6')],'allowNull':![],'defaultValue':_0x245e('0x7')},'callingpres':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x8'),_0x245e('0x9'),_0x245e('0xa'),_0x245e('0xb'),_0x245e('0xc'),_0x245e('0xd'),_0x245e('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0x245e('0x6')]},'permit':{'type':Sequelize[_0x245e('0x6')]},'secret':{'type':Sequelize[_0x245e('0x6')]},'md5secret':{'type':Sequelize[_0x245e('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x245e('0x6')],'defaultValue':_0x245e('0xf'),'set':function(_0x28bfcb){this[_0x245e('0x10')](_0x245e('0x11'),_0x28bfcb?_0x28bfcb[_0x245e('0x12')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x245e('0x13')](_0x245e('0x11'))[_0x245e('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x245e('0x15'),_0x245e('0x16'),_0x245e('0x17'),_0x245e('0x18')),'defaultValue':_0x245e('0x19')},'directmedia':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no',_0x245e('0x1b'),_0x245e('0x1c'),_0x245e('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x245e('0x6')]},'directmediadeny':{'type':Sequelize[_0x245e('0x6')]},'nat':{'type':Sequelize[_0x245e('0x6')],'defaultValue':_0x245e('0x1e'),'set':function(_0xe16052){this[_0x245e('0x10')](_0x245e('0x1f'),_0xe16052?_0xe16052[_0x245e('0x12')](','):null);},'get':function(){return this[_0x245e('0x13')](_0x245e('0x1f'))?this[_0x245e('0x13')](_0x245e('0x1f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x245e('0x6')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x245e('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x245e('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x245e('0x6')],'defaultValue':_0x245e('0x20')},'allow':{'type':Sequelize[_0x245e('0x6')],'allowNull':![],'defaultValue':_0x245e('0x21'),'set':function(_0x1aa997){this[_0x245e('0x10')](_0x245e('0x22'),_0x1aa997?_0x1aa997[_0x245e('0x12')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x245e('0x13')](_0x245e('0x22'))?this['getDataValue']('allow')[_0x245e('0x14')](';'):null;},'comment':_0x245e('0x23')},'autoframing':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'insecure':{'type':Sequelize[_0x245e('0x6')],'defaultValue':_0x245e('0x24'),'set':function(_0x30e8d2){this[_0x245e('0x10')](_0x245e('0x25'),_0x30e8d2?_0x30e8d2['join'](','):null);},'get':function(){return this[_0x245e('0x13')](_0x245e('0x25'))?this['getDataValue'](_0x245e('0x25'))[_0x245e('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x245e('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no',_0x245e('0x26'))},'promiscredir':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x245e('0x6')]},'callerid':{'type':Sequelize[_0x245e('0x6')],'defaultValue':_0x245e('0x27')},'amaflags':{'type':Sequelize[_0x245e('0x6')]},'callcounter':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x245e('0x28')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x245e('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x245e('0x6')]},'videosupport':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no',_0x245e('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x245e('0x6')]},'session_timers':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x2a'),_0x245e('0x2b'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x245e('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x2c'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x245e('0x6')]},'regexten':{'type':Sequelize[_0x245e('0x6')]},'fromdomain':{'type':Sequelize[_0x245e('0x6')]},'fromuser':{'type':Sequelize[_0x245e('0x6')]},'port':{'type':Sequelize[_0x245e('0x28')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x245e('0x6')]},'defaultuser':{'type':Sequelize[_0x245e('0x6')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x245e('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x245e('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no',_0x245e('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x245e('0x6')]},'callbackextension':{'type':Sequelize[_0x245e('0x6')]},'timert1':{'type':Sequelize[_0x245e('0x28')](0xb)},'timerb':{'type':Sequelize[_0x245e('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x245e('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0x245e('0x6')]},'contactdeny':{'type':Sequelize[_0x245e('0x6')]},'contactacl':{'type':Sequelize[_0x245e('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x245e('0x6')]},'use_q850_reason':{'type':Sequelize[_0x245e('0x6')]},'maxforwards':{'type':Sequelize[_0x245e('0x28')](0xb)},'encryption':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x245e('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x245e('0x2')]('yes','no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no','fingerprint',_0x245e('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x245e('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x245e('0x6')]},'dtlscipher':{'type':Sequelize[_0x245e('0x6')]},'dtlscafile':{'type':Sequelize[_0x245e('0x6')]},'dtlscapath':{'type':Sequelize[_0x245e('0x6')]},'dtlssetup':{'type':Sequelize[_0x245e('0x2')]('active',_0x245e('0x2f'),_0x245e('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x245e('0x6')]},'usereqphone':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x245e('0x6')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x245e('0x2')](_0x245e('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x245e('0x6')]},'mohinterpret':{'type':Sequelize[_0x245e('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x245e('0x6')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x245e('0x2')]('yes','no',_0x245e('0x1b'),_0x245e('0x1c'),_0x245e('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x245e('0x6')]},'otherFields':{'type':Sequelize[_0x245e('0x6')]},'active':{'type':Sequelize[_0x245e('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x245e('0x6')],'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 a1fd18d..c5830bc 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 _0x8b29=['../../mysqldb','client','http','Sequelize','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','status','json','offset','limit','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','end','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','Trunk','findAll','rows','catch','show','params','find','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','join','root','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','Reload','html-pdf','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x8b29,0xbe));var _0x98b2=function(_0x5904e8,_0x2fb9f6){_0x5904e8=_0x5904e8-0x0;var _0xccfc8a=_0x8b29[_0x5904e8];return _0xccfc8a;};'use strict';var pdf=require(_0x98b2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x98b2('0x1'));var zipdir=require(_0x98b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x98b2('0x3'));var BPromise=require(_0x98b2('0x4'));var Mustache=require('mustache');var util=require(_0x98b2('0x5'));var path=require('path');var sox=require(_0x98b2('0x6'));var csv=require(_0x98b2('0x7'));var ejs=require(_0x98b2('0x8'));var fs=require('fs');var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require(_0x98b2('0xb'));var jsforce=require(_0x98b2('0xc'));var deskjs=require(_0x98b2('0xd'));var toCsv=require(_0x98b2('0x7'));var querystring=require(_0x98b2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require(_0x98b2('0x11'));var hardwareService=require(_0x98b2('0x12'));var logger=require(_0x98b2('0x13'))(_0x98b2('0x14'));var utils=require('../../config/utils');var config=require(_0x98b2('0x15'));var db=require(_0x98b2('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x98b2('0x17')][_0x98b2('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2a6337,_0x4b869a,_0x525889){if(_0x525889){var _0x2d19ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d19ee['test'](_0x4b869a)){return _0x2a6337;}else{throw new db[(_0x98b2('0x19'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x2a6337;}}function respondWithRpcPromise(_0x544e3c,_0x831ee8,_0x413464,_0xe49e9a){return new BPromise(function(_0x5ecea1,_0x5bb60d){var _0x5dd057=_0xe49e9a||client;return _0x5dd057[_0x98b2('0x1a')](_0x544e3c,_0x413464)[_0x98b2('0x1b')](function(_0x145d65){logger[_0x98b2('0x1c')]('Trunk,\x20%s,\x20%s',_0x831ee8,_0x98b2('0x1d'));logger['debug'](_0x98b2('0x1e'),_0x831ee8,'request\x20sent',JSON[_0x98b2('0x1f')](_0x145d65));if(_0x145d65[_0x98b2('0x20')]){if(_0x145d65[_0x98b2('0x20')][_0x98b2('0x21')]===0x1f4){logger['error'](_0x98b2('0x22'),_0x831ee8,_0x145d65[_0x98b2('0x20')]['message']);return _0x5bb60d(_0x145d65['error'][_0x98b2('0x23')]);}logger[_0x98b2('0x20')]('Trunk,\x20%s,\x20%s',_0x831ee8,_0x145d65['error'][_0x98b2('0x23')]);return _0x5ecea1(_0x145d65[_0x98b2('0x20')]['message']);}else{logger[_0x98b2('0x1c')](_0x98b2('0x22'),_0x831ee8,_0x98b2('0x1d'));_0x5ecea1(_0x145d65['result'][_0x98b2('0x23')]);}})['catch'](function(_0x1d6e33){logger['error']('Trunk,\x20%s,\x20%s',_0x831ee8,_0x1d6e33);_0x5bb60d(_0x1d6e33);});});}function respondWithStatusCode(_0x7b6ebc,_0xe99d27){_0xe99d27=_0xe99d27||0xcc;return function(_0x5fcd00){if(_0x5fcd00){return _0x7b6ebc['sendStatus'](_0xe99d27);}return _0x7b6ebc['status'](_0xe99d27)['end']();};}function respondWithResult(_0x11c6aa,_0xdedd6c){_0xdedd6c=_0xdedd6c||0xc8;return function(_0x50aafb){if(_0x50aafb){return _0x11c6aa[_0x98b2('0x24')](_0xdedd6c)[_0x98b2('0x25')](_0x50aafb);}};}function respondWithFilteredResult(_0x26625b,_0x56efb6){return function(_0x2e1ea4){if(_0x2e1ea4){var _0x1dee11=_0x2e1ea4['count'],_0x1f1c55=_0x56efb6[_0x98b2('0x26')],_0xb4c6c4=_0x56efb6['offset']+_0x56efb6[_0x98b2('0x27')],_0x25393d;if(_0xb4c6c4>=_0x1dee11){_0xb4c6c4=_0x1dee11;_0x25393d=0xc8;}else{_0x25393d=0xce;}_0x26625b[_0x98b2('0x24')](_0x25393d);return _0x26625b['set'](_0x98b2('0x28'),_0x1f1c55+'-'+_0xb4c6c4+'/'+_0x1dee11)[_0x98b2('0x25')](_0x2e1ea4);}return null;};}function patchUpdates(_0x526637){return function(_0x1a676e){try{jsonpatch[_0x98b2('0x29')](_0x1a676e,_0x526637,!![]);}catch(_0xa0ed9){return BPromise[_0x98b2('0x2a')](_0xa0ed9);}return _0x1a676e['save']();};}function saveUpdates(_0x5ed399,_0x264656){return function(_0x2c40b4){if(_0x2c40b4){return _0x2c40b4[_0x98b2('0x2b')](_0x5ed399)[_0x98b2('0x1b')](function(_0x244135){return _0x244135;});}return null;};}function removeEntity(_0x26662d,_0x5e8eed){return function(_0x448c8b){if(_0x448c8b){return _0x448c8b[_0x98b2('0x2c')]()[_0x98b2('0x1b')](function(){var _0x3a86f5=_0x448c8b[_0x98b2('0x2d')]({'plain':!![]});var _0x1cfe89=_0x98b2('0x2e');return db[_0x98b2('0x2f')][_0x98b2('0x2c')]({'where':{'type':_0x1cfe89,'resourceId':_0x3a86f5['id']}})[_0x98b2('0x1b')](function(){return _0x448c8b;});})[_0x98b2('0x1b')](function(){_0x26662d[_0x98b2('0x24')](0xcc)[_0x98b2('0x30')]();});}};}function handleEntityNotFound(_0x568381,_0x50532e){return function(_0x3ef9fb){if(!_0x3ef9fb){_0x568381[_0x98b2('0x31')](0x194);}return _0x3ef9fb;};}function handleError(_0x4763b9,_0x363553){_0x363553=_0x363553||0x1f4;return function(_0x30827c){logger[_0x98b2('0x20')](_0x30827c['stack']);if(_0x30827c[_0x98b2('0x32')]){delete _0x30827c[_0x98b2('0x32')];}_0x4763b9[_0x98b2('0x24')](_0x363553)[_0x98b2('0x33')](_0x30827c);};}exports['index']=function(_0x13fe8b,_0x193d40){var _0x3b5d34={},_0x178ad1={},_0x2cadb7={'count':0x0,'rows':[]};var _0x3eea54=_[_0x98b2('0x34')](db['Trunk'][_0x98b2('0x35')],function(_0x4e327b){return{'name':_0x4e327b[_0x98b2('0x36')],'type':_0x4e327b[_0x98b2('0x37')][_0x98b2('0x38')]};});_0x178ad1[_0x98b2('0x39')]=_['map'](_0x3eea54,'name');_0x178ad1[_0x98b2('0x3a')]=_[_0x98b2('0x3b')](_0x13fe8b[_0x98b2('0x3a')]);_0x178ad1['filters']=_[_0x98b2('0x3c')](_0x178ad1[_0x98b2('0x39')],_0x178ad1[_0x98b2('0x3a')]);_0x3b5d34[_0x98b2('0x3d')]=_[_0x98b2('0x3c')](_0x178ad1[_0x98b2('0x39')],qs['fields'](_0x13fe8b[_0x98b2('0x3a')][_0x98b2('0x3e')]));_0x3b5d34[_0x98b2('0x3d')]=_0x3b5d34['attributes'][_0x98b2('0x3f')]?_0x3b5d34[_0x98b2('0x3d')]:_0x178ad1[_0x98b2('0x39')];if(!_0x13fe8b[_0x98b2('0x3a')][_0x98b2('0x40')](_0x98b2('0x41'))){_0x3b5d34['limit']=qs[_0x98b2('0x27')](_0x13fe8b['query'][_0x98b2('0x27')]);_0x3b5d34[_0x98b2('0x26')]=qs[_0x98b2('0x26')](_0x13fe8b[_0x98b2('0x3a')][_0x98b2('0x26')]);}_0x3b5d34[_0x98b2('0x42')]=qs[_0x98b2('0x43')](_0x13fe8b[_0x98b2('0x3a')][_0x98b2('0x43')]);_0x3b5d34['where']=qs[_0x98b2('0x44')](_['pick'](_0x13fe8b[_0x98b2('0x3a')],_0x178ad1[_0x98b2('0x44')]),_0x3eea54);if(_0x13fe8b[_0x98b2('0x3a')][_0x98b2('0x45')]){_0x3b5d34[_0x98b2('0x46')]=_[_0x98b2('0x47')](_0x3b5d34['where'],{'$or':_[_0x98b2('0x34')](_0x3eea54,function(_0x44633c){if(_0x44633c[_0x98b2('0x37')]!==_0x98b2('0x48')){var _0xc8b7d7={};_0xc8b7d7[_0x44633c['name']]={'$like':'%'+_0x13fe8b['query'][_0x98b2('0x45')]+'%'};return _0xc8b7d7;}})});}_0x3b5d34=_[_0x98b2('0x47')]({},_0x3b5d34,_0x13fe8b[_0x98b2('0x49')]);var _0x389581={'where':_0x3b5d34['where']};return db['Trunk']['count'](_0x389581)[_0x98b2('0x1b')](function(_0x1819fd){_0x2cadb7[_0x98b2('0x4a')]=_0x1819fd;if(_0x13fe8b[_0x98b2('0x3a')][_0x98b2('0x4b')]){_0x3b5d34[_0x98b2('0x4c')]=[{'all':!![]}];}return db[_0x98b2('0x4d')][_0x98b2('0x4e')](_0x3b5d34);})[_0x98b2('0x1b')](function(_0x5c04b9){_0x2cadb7[_0x98b2('0x4f')]=_0x5c04b9;return _0x2cadb7;})['then'](respondWithFilteredResult(_0x193d40,_0x3b5d34))[_0x98b2('0x50')](handleError(_0x193d40,null));};exports[_0x98b2('0x51')]=function(_0x3c3c64,_0x4073ac){var _0x4be667={'raw':![],'where':{'id':_0x3c3c64[_0x98b2('0x52')]['id']}},_0x40cc81={};_0x40cc81[_0x98b2('0x39')]=_[_0x98b2('0x3b')](db[_0x98b2('0x4d')]['rawAttributes']);_0x40cc81[_0x98b2('0x3a')]=_[_0x98b2('0x3b')](_0x3c3c64[_0x98b2('0x3a')]);_0x40cc81[_0x98b2('0x44')]=_[_0x98b2('0x3c')](_0x40cc81[_0x98b2('0x39')],_0x40cc81[_0x98b2('0x3a')]);_0x4be667[_0x98b2('0x3d')]=_[_0x98b2('0x3c')](_0x40cc81[_0x98b2('0x39')],qs[_0x98b2('0x3e')](_0x3c3c64[_0x98b2('0x3a')]['fields']));_0x4be667[_0x98b2('0x3d')]=_0x4be667[_0x98b2('0x3d')]['length']?_0x4be667['attributes']:_0x40cc81[_0x98b2('0x39')];if(_0x3c3c64['query'][_0x98b2('0x4b')]){_0x4be667[_0x98b2('0x4c')]=[{'all':!![]}];}_0x4be667=_[_0x98b2('0x47')]({},_0x4be667,_0x3c3c64[_0x98b2('0x49')]);return db[_0x98b2('0x4d')][_0x98b2('0x53')](_0x4be667)['then'](handleEntityNotFound(_0x4073ac,null))[_0x98b2('0x1b')](respondWithResult(_0x4073ac,null))['catch'](handleError(_0x4073ac,null));};exports['clone']=function(_0xf9da91,_0x27da73){var _0x5217e0={'where':{'id':_0xf9da91[_0x98b2('0x52')]['id']}},_0x12a72e={};_0x12a72e['model']=_[_0x98b2('0x3b')](db[_0x98b2('0x4d')][_0x98b2('0x35')]);_0x5217e0[_0x98b2('0x3d')]=_['intersection'](_0x12a72e['model'],qs[_0x98b2('0x3e')](_0xf9da91[_0x98b2('0x3a')][_0x98b2('0x3e')]));_0x5217e0[_0x98b2('0x3d')]=_0x5217e0[_0x98b2('0x3d')]['length']?_0x5217e0['attributes']:_0x12a72e[_0x98b2('0x39')];if(_0xf9da91['query'][_0x98b2('0x4b')]){_0x5217e0[_0x98b2('0x4c')]=[{'all':!![]}];}_0x5217e0=_[_0x98b2('0x47')]({},_0x5217e0,_0xf9da91[_0x98b2('0x49')]);return db[_0x98b2('0x4d')][_0x98b2('0x53')](_0x5217e0)['then'](handleEntityNotFound(_0x27da73,null))[_0x98b2('0x1b')](function(_0x2663be){if(_0x2663be){var _0x2984ba=_0x2663be[_0x98b2('0x2d')]({'plain':!![]});_0x2984ba=qs[_0x98b2('0x54')](_0x2984ba,['id',_0x98b2('0x55'),'updatedAt']);_0xf9da91['body']=_[_0x98b2('0x54')](_0xf9da91[_0x98b2('0x56')],['id',_0x98b2('0x55'),_0x98b2('0x57')]);return db[_0x98b2('0x4d')][_0x98b2('0x58')](_[_0x98b2('0x47')](_0x2984ba,_0xf9da91[_0x98b2('0x56')]),{'include':_0xf9da91['query'][_0x98b2('0x4b')]?[{'all':!![]}]:undefined})[_0x98b2('0x1b')](function(_0x830740){var _0x48c4f4=_0xf9da91[_0x98b2('0x59')][_0x98b2('0x2d')]({'plain':!![]});if(!_0x48c4f4)throw new Error(_0x98b2('0x5a'));if(_0x48c4f4['role']===_0x98b2('0x59')){var _0x1d108b=_0x830740['get']({'plain':!![]});var _0x3dc906='Trunks';return db['UserProfileSection']['find']({'where':{'name':_0x3dc906,'userProfileId':_0x48c4f4['userProfileId']},'raw':!![]})[_0x98b2('0x1b')](function(_0x157178){if(_0x157178&&_0x157178[_0x98b2('0x5b')]===0x0){return db['UserProfileResource'][_0x98b2('0x58')]({'name':_0x1d108b[_0x98b2('0x32')],'resourceId':_0x1d108b['id'],'type':_0x157178[_0x98b2('0x32')],'sectionId':_0x157178['id']},{})[_0x98b2('0x1b')](function(){return _0x830740;});}else{return _0x830740;}})[_0x98b2('0x50')](function(_0x15cbb3){logger[_0x98b2('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15cbb3);throw _0x15cbb3;});}return _0x830740;});}})[_0x98b2('0x1b')](respondWithResult(_0x27da73,0xc9))['catch'](handleError(_0x27da73,null));};exports[_0x98b2('0x58')]=function(_0x3877ae,_0x2fea4f,_0x30db52){var _0x122e76;return db[_0x98b2('0x4d')][_0x98b2('0x58')](_0x3877ae['body'],{'raw':!![]})['then'](function(_0xc89b4b){_0x122e76=_0xc89b4b;return db[_0x98b2('0x4d')][_0x98b2('0x4e')]({'raw':!![]});})[_0x98b2('0x1b')](function(_0x513fec){var _0x2cbf7d=fs['readFileSync'](path[_0x98b2('0x5c')](config[_0x98b2('0x5d')],'server/files/templates/trunk.ejs'),_0x98b2('0x5e'));var _0x157abf=fs[_0x98b2('0x5f')](path[_0x98b2('0x5c')](config[_0x98b2('0x5d')],_0x98b2('0x60')),_0x98b2('0x5e'));var _0x4103cb=ejs[_0x98b2('0x61')](_0x2cbf7d,{'trunks':_0x513fec||[]});fs['writeFileSync'](_0x98b2('0x62'),_0x4103cb);if(_0x122e76[_0x98b2('0x63')]){var _0x1a9efa=ejs[_0x98b2('0x61')](_0x157abf,{'trunks':_0x513fec||[]});fs[_0x98b2('0x64')](_0x98b2('0x65'),_0x1a9efa);}})[_0x98b2('0x1b')](function(){return respondWithRpcPromise('Reload',_0x98b2('0x58'),{'module':_0x98b2('0x66')});})[_0x98b2('0x1b')](function(){var _0x351204=_0x3877ae[_0x98b2('0x59')]['get']({'plain':!![]});if(!_0x351204)throw new Error(_0x98b2('0x5a'));if(_0x351204['role']===_0x98b2('0x59')){var _0x3a3170=_0x122e76[_0x98b2('0x2d')]({'plain':!![]});return db['UserProfileSection'][_0x98b2('0x53')]({'where':{'name':_0x98b2('0x2e'),'userProfileId':_0x351204['userProfileId']},'raw':!![]})[_0x98b2('0x1b')](function(_0x5b7446){if(_0x5b7446&&_0x5b7446[_0x98b2('0x5b')]===0x0){return db['UserProfileResource'][_0x98b2('0x58')]({'name':_0x3a3170[_0x98b2('0x32')],'resourceId':_0x3a3170['id'],'type':_0x5b7446[_0x98b2('0x32')],'sectionId':_0x5b7446['id']},{})[_0x98b2('0x1b')](function(){return _0x122e76;});}else{return _0x122e76;}})[_0x98b2('0x50')](function(_0x471194){logger['error'](_0x98b2('0x67'),_0x471194);throw _0x471194;});}return _0x122e76;})['then'](respondWithResult(_0x2fea4f,0xc9))[_0x98b2('0x50')](handleError(_0x2fea4f,null));};exports[_0x98b2('0x2b')]=function(_0x32eb51,_0x2791f9,_0x482a79){var _0x27307b;return db[_0x98b2('0x4d')][_0x98b2('0x53')]({'where':{'id':_0x32eb51[_0x98b2('0x52')]['id']}})[_0x98b2('0x1b')](handleEntityNotFound(_0x2791f9,null))[_0x98b2('0x1b')](saveUpdates(_0x32eb51[_0x98b2('0x56')],null))[_0x98b2('0x1b')](function(_0x5eb52c){if(_0x5eb52c){_0x27307b=_0x5eb52c;return db[_0x98b2('0x4d')]['findAll']({'raw':!![]});}})[_0x98b2('0x1b')](function(_0x8049b8){if(_0x8049b8){var _0x2ccd08=fs['readFileSync'](path['join'](config[_0x98b2('0x5d')],_0x98b2('0x68')),'utf8');var _0x5d2fb4=fs[_0x98b2('0x5f')](path[_0x98b2('0x5c')](config[_0x98b2('0x5d')],_0x98b2('0x60')),_0x98b2('0x5e'));var _0x41c35e=ejs['render'](_0x2ccd08,{'trunks':_0x8049b8||[]});fs[_0x98b2('0x64')](_0x98b2('0x62'),_0x41c35e);var _0x2747ed=ejs[_0x98b2('0x61')](_0x5d2fb4,{'trunks':_0x8049b8||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2747ed);return respondWithRpcPromise(_0x98b2('0x69'),_0x98b2('0x2b'),{'module':_0x98b2('0x66')});}return null;})[_0x98b2('0x1b')](function(_0x47705d){if(_0x47705d){return _0x27307b;}})[_0x98b2('0x1b')](respondWithResult(_0x2791f9,null))[_0x98b2('0x50')](handleError(_0x2791f9,null));};exports[_0x98b2('0x2c')]=function(_0x1444f7,_0x27d9e5,_0x1104ac){var _0x3a2590;return db[_0x98b2('0x4d')][_0x98b2('0x53')]({'where':{'id':_0x1444f7[_0x98b2('0x52')]['id']}})[_0x98b2('0x1b')](handleEntityNotFound(_0x27d9e5,null))[_0x98b2('0x1b')](removeEntity(_0x27d9e5,null))[_0x98b2('0x1b')](function(){return db['Trunk'][_0x98b2('0x4e')]({'raw':!![]});})[_0x98b2('0x1b')](function(_0x241322){var _0x5ec0cf=fs['readFileSync'](path['join'](config[_0x98b2('0x5d')],_0x98b2('0x68')),_0x98b2('0x5e'));var _0x177286=fs[_0x98b2('0x5f')](path[_0x98b2('0x5c')](config['root'],_0x98b2('0x60')),'utf8');var _0x280e19=ejs[_0x98b2('0x61')](_0x5ec0cf,{'trunks':_0x241322});var _0x5403af=ejs[_0x98b2('0x61')](_0x177286,{'trunks':_0x241322});fs[_0x98b2('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x280e19);fs[_0x98b2('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5403af);return respondWithRpcPromise(_0x98b2('0x69'),_0x98b2('0x2c'),{'module':_0x98b2('0x66')});})['catch'](handleError(_0x27d9e5,null));}; \ No newline at end of file +var _0x688a=['Trunk,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','get','name','send','Trunk','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','createdAt','create','body','user','role','Trunks','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','http','test','Sequelize','request','then','request\x20sent','debug','stringify','error','code','message'];(function(_0x4f559d,_0x50b8b7){var _0x2ab52f=function(_0x2d3d9f){while(--_0x2d3d9f){_0x4f559d['push'](_0x4f559d['shift']());}};_0x2ab52f(++_0x50b8b7);}(_0x688a,0x124));var _0xa688=function(_0x19e6f9,_0x27cb49){_0x19e6f9=_0x19e6f9-0x0;var _0x368a9e=_0x688a[_0x19e6f9];return _0x368a9e;};'use strict';var pdf=require(_0xa688('0x0'));var emlformat=require(_0xa688('0x1'));var rimraf=require(_0xa688('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa688('0x3'));var rp=require('request-promise');var moment=require(_0xa688('0x4'));var BPromise=require(_0xa688('0x5'));var Mustache=require('mustache');var util=require(_0xa688('0x6'));var path=require(_0xa688('0x7'));var sox=require(_0xa688('0x8'));var csv=require(_0xa688('0x9'));var ejs=require(_0xa688('0xa'));var fs=require('fs');var _=require(_0xa688('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa688('0xc'));var deskjs=require(_0xa688('0xd'));var toCsv=require(_0xa688('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa688('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa688('0xf'));var hardwareService=require(_0xa688('0x10'));var logger=require(_0xa688('0x11'))(_0xa688('0x12'));var utils=require(_0xa688('0x13'));var config=require(_0xa688('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa688('0x15')]({'port':0x232a});function checkPasswordPattern(_0x33eed4,_0x4cb55d,_0x2a4ecc){if(_0x2a4ecc){var _0x5044c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5044c7[_0xa688('0x16')](_0x4cb55d)){return _0x33eed4;}else{throw new db[(_0xa688('0x17'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x33eed4;}}function respondWithRpcPromise(_0x2d4871,_0x4c7442,_0x1a55c2,_0x5b8b1f){return new BPromise(function(_0xe776d6,_0x1e7ad3){var _0x41082d=_0x5b8b1f||client;return _0x41082d[_0xa688('0x18')](_0x2d4871,_0x1a55c2)[_0xa688('0x19')](function(_0x10fc2d){logger['info']('Trunk,\x20%s,\x20%s',_0x4c7442,_0xa688('0x1a'));logger[_0xa688('0x1b')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4c7442,'request\x20sent',JSON[_0xa688('0x1c')](_0x10fc2d));if(_0x10fc2d[_0xa688('0x1d')]){if(_0x10fc2d['error'][_0xa688('0x1e')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x4c7442,_0x10fc2d[_0xa688('0x1d')][_0xa688('0x1f')]);return _0x1e7ad3(_0x10fc2d[_0xa688('0x1d')][_0xa688('0x1f')]);}logger[_0xa688('0x1d')](_0xa688('0x20'),_0x4c7442,_0x10fc2d[_0xa688('0x1d')][_0xa688('0x1f')]);return _0xe776d6(_0x10fc2d[_0xa688('0x1d')][_0xa688('0x1f')]);}else{logger[_0xa688('0x21')](_0xa688('0x20'),_0x4c7442,_0xa688('0x1a'));_0xe776d6(_0x10fc2d[_0xa688('0x22')]['message']);}})[_0xa688('0x23')](function(_0x32a682){logger['error'](_0xa688('0x20'),_0x4c7442,_0x32a682);_0x1e7ad3(_0x32a682);});});}function respondWithStatusCode(_0x1e3106,_0x53eec6){_0x53eec6=_0x53eec6||0xcc;return function(_0x2898cb){if(_0x2898cb){return _0x1e3106[_0xa688('0x24')](_0x53eec6);}return _0x1e3106[_0xa688('0x25')](_0x53eec6)[_0xa688('0x26')]();};}function respondWithResult(_0x153a86,_0x4072e4){_0x4072e4=_0x4072e4||0xc8;return function(_0x337779){if(_0x337779){return _0x153a86[_0xa688('0x25')](_0x4072e4)[_0xa688('0x27')](_0x337779);}};}function respondWithFilteredResult(_0x100f14,_0x3ab038){return function(_0x161741){if(_0x161741){var _0x3c7245=_0x161741[_0xa688('0x28')],_0x12a35a=_0x3ab038[_0xa688('0x29')],_0x1d4cfa=_0x3ab038[_0xa688('0x29')]+_0x3ab038[_0xa688('0x2a')],_0x5d1657;if(_0x1d4cfa>=_0x3c7245){_0x1d4cfa=_0x3c7245;_0x5d1657=0xc8;}else{_0x5d1657=0xce;}_0x100f14[_0xa688('0x25')](_0x5d1657);return _0x100f14[_0xa688('0x2b')]('Content-Range',_0x12a35a+'-'+_0x1d4cfa+'/'+_0x3c7245)['json'](_0x161741);}return null;};}function patchUpdates(_0x5291ac){return function(_0x1824d1){try{jsonpatch['apply'](_0x1824d1,_0x5291ac,!![]);}catch(_0x5d8753){return BPromise[_0xa688('0x2c')](_0x5d8753);}return _0x1824d1[_0xa688('0x2d')]();};}function saveUpdates(_0x29e83c,_0x40bf1f){return function(_0x197854){if(_0x197854){return _0x197854[_0xa688('0x2e')](_0x29e83c)['then'](function(_0x50d7f1){return _0x50d7f1;});}return null;};}function removeEntity(_0x501c00,_0x58d820){return function(_0x18a64f){if(_0x18a64f){return _0x18a64f[_0xa688('0x2f')]()[_0xa688('0x19')](function(){var _0x489c32=_0x18a64f[_0xa688('0x30')]({'plain':!![]});var _0x5764c5='Trunks';return db['UserProfileResource'][_0xa688('0x2f')]({'where':{'type':_0x5764c5,'resourceId':_0x489c32['id']}})[_0xa688('0x19')](function(){return _0x18a64f;});})[_0xa688('0x19')](function(){_0x501c00['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x69182b,_0x42c27a){return function(_0x2ba000){if(!_0x2ba000){_0x69182b[_0xa688('0x24')](0x194);}return _0x2ba000;};}function handleError(_0x325f74,_0x4eb92e){_0x4eb92e=_0x4eb92e||0x1f4;return function(_0x57c9b8){logger[_0xa688('0x1d')](_0x57c9b8['stack']);if(_0x57c9b8[_0xa688('0x31')]){delete _0x57c9b8[_0xa688('0x31')];}_0x325f74[_0xa688('0x25')](_0x4eb92e)[_0xa688('0x32')](_0x57c9b8);};}exports['index']=function(_0x1a17ab,_0x5cf64d){var _0x5578b9={},_0x423918={},_0x571f2b={'count':0x0,'rows':[]};var _0xb4a6f5=_['map'](db[_0xa688('0x33')][_0xa688('0x34')],function(_0x271813){return{'name':_0x271813['fieldName'],'type':_0x271813[_0xa688('0x35')][_0xa688('0x36')]};});_0x423918[_0xa688('0x37')]=_[_0xa688('0x38')](_0xb4a6f5,_0xa688('0x31'));_0x423918[_0xa688('0x39')]=_[_0xa688('0x3a')](_0x1a17ab[_0xa688('0x39')]);_0x423918[_0xa688('0x3b')]=_[_0xa688('0x3c')](_0x423918[_0xa688('0x37')],_0x423918['query']);_0x5578b9[_0xa688('0x3d')]=_['intersection'](_0x423918[_0xa688('0x37')],qs[_0xa688('0x3e')](_0x1a17ab[_0xa688('0x39')][_0xa688('0x3e')]));_0x5578b9['attributes']=_0x5578b9[_0xa688('0x3d')][_0xa688('0x3f')]?_0x5578b9['attributes']:_0x423918[_0xa688('0x37')];if(!_0x1a17ab[_0xa688('0x39')][_0xa688('0x40')](_0xa688('0x41'))){_0x5578b9[_0xa688('0x2a')]=qs[_0xa688('0x2a')](_0x1a17ab[_0xa688('0x39')][_0xa688('0x2a')]);_0x5578b9[_0xa688('0x29')]=qs['offset'](_0x1a17ab[_0xa688('0x39')][_0xa688('0x29')]);}_0x5578b9[_0xa688('0x42')]=qs[_0xa688('0x43')](_0x1a17ab[_0xa688('0x39')][_0xa688('0x43')]);_0x5578b9[_0xa688('0x44')]=qs[_0xa688('0x3b')](_['pick'](_0x1a17ab[_0xa688('0x39')],_0x423918[_0xa688('0x3b')]),_0xb4a6f5);if(_0x1a17ab[_0xa688('0x39')][_0xa688('0x45')]){_0x5578b9['where']=_[_0xa688('0x46')](_0x5578b9[_0xa688('0x44')],{'$or':_['map'](_0xb4a6f5,function(_0x872708){if(_0x872708[_0xa688('0x35')]!==_0xa688('0x47')){var _0x9f6193={};_0x9f6193[_0x872708[_0xa688('0x31')]]={'$like':'%'+_0x1a17ab[_0xa688('0x39')]['filter']+'%'};return _0x9f6193;}})});}_0x5578b9=_[_0xa688('0x46')]({},_0x5578b9,_0x1a17ab[_0xa688('0x48')]);var _0x2f4621={'where':_0x5578b9[_0xa688('0x44')]};return db[_0xa688('0x33')]['count'](_0x2f4621)[_0xa688('0x19')](function(_0x34d0c7){_0x571f2b[_0xa688('0x28')]=_0x34d0c7;if(_0x1a17ab[_0xa688('0x39')][_0xa688('0x49')]){_0x5578b9[_0xa688('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa688('0x4b')](_0x5578b9);})[_0xa688('0x19')](function(_0x249265){_0x571f2b[_0xa688('0x4c')]=_0x249265;return _0x571f2b;})[_0xa688('0x19')](respondWithFilteredResult(_0x5cf64d,_0x5578b9))[_0xa688('0x23')](handleError(_0x5cf64d,null));};exports[_0xa688('0x4d')]=function(_0x497ec3,_0x1e1d1d){var _0x1e8758={'raw':![],'where':{'id':_0x497ec3[_0xa688('0x4e')]['id']}},_0x296a7d={};_0x296a7d['model']=_[_0xa688('0x3a')](db[_0xa688('0x33')][_0xa688('0x34')]);_0x296a7d[_0xa688('0x39')]=_[_0xa688('0x3a')](_0x497ec3[_0xa688('0x39')]);_0x296a7d['filters']=_[_0xa688('0x3c')](_0x296a7d['model'],_0x296a7d[_0xa688('0x39')]);_0x1e8758['attributes']=_['intersection'](_0x296a7d[_0xa688('0x37')],qs[_0xa688('0x3e')](_0x497ec3[_0xa688('0x39')]['fields']));_0x1e8758[_0xa688('0x3d')]=_0x1e8758['attributes']['length']?_0x1e8758['attributes']:_0x296a7d['model'];if(_0x497ec3['query'][_0xa688('0x49')]){_0x1e8758[_0xa688('0x4a')]=[{'all':!![]}];}_0x1e8758=_[_0xa688('0x46')]({},_0x1e8758,_0x497ec3['options']);return db[_0xa688('0x33')]['find'](_0x1e8758)[_0xa688('0x19')](handleEntityNotFound(_0x1e1d1d,null))[_0xa688('0x19')](respondWithResult(_0x1e1d1d,null))[_0xa688('0x23')](handleError(_0x1e1d1d,null));};exports[_0xa688('0x4f')]=function(_0x25c618,_0x409b63){var _0x27cd8c={'where':{'id':_0x25c618[_0xa688('0x4e')]['id']}},_0x449094={};_0x449094[_0xa688('0x37')]=_['keys'](db['Trunk']['rawAttributes']);_0x27cd8c[_0xa688('0x3d')]=_[_0xa688('0x3c')](_0x449094[_0xa688('0x37')],qs[_0xa688('0x3e')](_0x25c618[_0xa688('0x39')][_0xa688('0x3e')]));_0x27cd8c[_0xa688('0x3d')]=_0x27cd8c[_0xa688('0x3d')][_0xa688('0x3f')]?_0x27cd8c[_0xa688('0x3d')]:_0x449094[_0xa688('0x37')];if(_0x25c618[_0xa688('0x39')][_0xa688('0x49')]){_0x27cd8c[_0xa688('0x4a')]=[{'all':!![]}];}_0x27cd8c=_[_0xa688('0x46')]({},_0x27cd8c,_0x25c618['options']);return db['Trunk'][_0xa688('0x50')](_0x27cd8c)['then'](handleEntityNotFound(_0x409b63,null))['then'](function(_0x10bd5f){if(_0x10bd5f){var _0xe3bb0c=_0x10bd5f['get']({'plain':!![]});_0xe3bb0c=qs[_0xa688('0x51')](_0xe3bb0c,['id','createdAt',_0xa688('0x52')]);_0x25c618['body']=_[_0xa688('0x51')](_0x25c618['body'],['id',_0xa688('0x53'),_0xa688('0x52')]);return db[_0xa688('0x33')][_0xa688('0x54')](_['merge'](_0xe3bb0c,_0x25c618[_0xa688('0x55')]),{'include':_0x25c618[_0xa688('0x39')][_0xa688('0x49')]?[{'all':!![]}]:undefined})[_0xa688('0x19')](function(_0x47dd33){var _0x1d5160=_0x25c618[_0xa688('0x56')]['get']({'plain':!![]});if(!_0x1d5160)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d5160[_0xa688('0x57')]===_0xa688('0x56')){var _0x20ac65=_0x47dd33[_0xa688('0x30')]({'plain':!![]});var _0x2e82e0=_0xa688('0x58');return db[_0xa688('0x59')][_0xa688('0x50')]({'where':{'name':_0x2e82e0,'userProfileId':_0x1d5160['userProfileId']},'raw':!![]})[_0xa688('0x19')](function(_0x20565f){if(_0x20565f&&_0x20565f[_0xa688('0x5a')]===0x0){return db['UserProfileResource'][_0xa688('0x54')]({'name':_0x20ac65[_0xa688('0x31')],'resourceId':_0x20ac65['id'],'type':_0x20565f[_0xa688('0x31')],'sectionId':_0x20565f['id']},{})[_0xa688('0x19')](function(){return _0x47dd33;});}else{return _0x47dd33;}})[_0xa688('0x23')](function(_0x771a57){logger['error'](_0xa688('0x5b'),_0x771a57);throw _0x771a57;});}return _0x47dd33;});}})['then'](respondWithResult(_0x409b63,0xc9))[_0xa688('0x23')](handleError(_0x409b63,null));};exports[_0xa688('0x54')]=function(_0x4028dc,_0x25a74f,_0x514f47){var _0x242639;return db[_0xa688('0x33')][_0xa688('0x54')](_0x4028dc['body'],{'raw':!![]})[_0xa688('0x19')](function(_0x49ce51){_0x242639=_0x49ce51;return db[_0xa688('0x33')][_0xa688('0x4b')]({'raw':!![]});})[_0xa688('0x19')](function(_0x486210){var _0x396bbd=fs[_0xa688('0x5c')](path[_0xa688('0x5d')](config[_0xa688('0x5e')],_0xa688('0x5f')),_0xa688('0x60'));var _0x1cdde3=fs['readFileSync'](path['join'](config['root'],_0xa688('0x61')),'utf8');var _0x3fd862=ejs['render'](_0x396bbd,{'trunks':_0x486210||[]});fs[_0xa688('0x62')](_0xa688('0x63'),_0x3fd862);if(_0x242639[_0xa688('0x64')]){var _0x111e92=ejs[_0xa688('0x65')](_0x1cdde3,{'trunks':_0x486210||[]});fs[_0xa688('0x62')](_0xa688('0x66'),_0x111e92);}})[_0xa688('0x19')](function(){return respondWithRpcPromise(_0xa688('0x67'),'create',{'module':_0xa688('0x68')});})[_0xa688('0x19')](function(){var _0x4957f6=_0x4028dc['user'][_0xa688('0x30')]({'plain':!![]});if(!_0x4957f6)throw new Error(_0xa688('0x69'));if(_0x4957f6['role']===_0xa688('0x56')){var _0x3afdbe=_0x242639[_0xa688('0x30')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xa688('0x58'),'userProfileId':_0x4957f6[_0xa688('0x6a')]},'raw':!![]})[_0xa688('0x19')](function(_0x34551c){if(_0x34551c&&_0x34551c[_0xa688('0x5a')]===0x0){return db[_0xa688('0x6b')][_0xa688('0x54')]({'name':_0x3afdbe['name'],'resourceId':_0x3afdbe['id'],'type':_0x34551c['name'],'sectionId':_0x34551c['id']},{})[_0xa688('0x19')](function(){return _0x242639;});}else{return _0x242639;}})['catch'](function(_0x18bf56){logger['error'](_0xa688('0x5b'),_0x18bf56);throw _0x18bf56;});}return _0x242639;})[_0xa688('0x19')](respondWithResult(_0x25a74f,0xc9))[_0xa688('0x23')](handleError(_0x25a74f,null));};exports['update']=function(_0x3ca50a,_0x30f031,_0x192691){var _0x2ff186;return db[_0xa688('0x33')]['find']({'where':{'id':_0x3ca50a[_0xa688('0x4e')]['id']}})[_0xa688('0x19')](handleEntityNotFound(_0x30f031,null))[_0xa688('0x19')](saveUpdates(_0x3ca50a[_0xa688('0x55')],null))['then'](function(_0x328b7f){if(_0x328b7f){_0x2ff186=_0x328b7f;return db[_0xa688('0x33')][_0xa688('0x4b')]({'raw':!![]});}})[_0xa688('0x19')](function(_0x179e26){if(_0x179e26){var _0x21be2c=fs[_0xa688('0x5c')](path[_0xa688('0x5d')](config[_0xa688('0x5e')],_0xa688('0x5f')),_0xa688('0x60'));var _0xf2f5cb=fs['readFileSync'](path[_0xa688('0x5d')](config[_0xa688('0x5e')],_0xa688('0x61')),_0xa688('0x60'));var _0x32dab6=ejs['render'](_0x21be2c,{'trunks':_0x179e26||[]});fs[_0xa688('0x62')](_0xa688('0x63'),_0x32dab6);var _0x102c8a=ejs[_0xa688('0x65')](_0xf2f5cb,{'trunks':_0x179e26||[]});fs[_0xa688('0x62')]('/etc/asterisk/sip_xcally_registers.conf',_0x102c8a);return respondWithRpcPromise(_0xa688('0x67'),'update',{'module':'chan_sip.so'});}return null;})[_0xa688('0x19')](function(_0x1dcddf){if(_0x1dcddf){return _0x2ff186;}})[_0xa688('0x19')](respondWithResult(_0x30f031,null))[_0xa688('0x23')](handleError(_0x30f031,null));};exports[_0xa688('0x2f')]=function(_0xf38db7,_0x507779,_0xd0d9c8){var _0xf25402;return db[_0xa688('0x33')][_0xa688('0x50')]({'where':{'id':_0xf38db7['params']['id']}})[_0xa688('0x19')](handleEntityNotFound(_0x507779,null))['then'](removeEntity(_0x507779,null))[_0xa688('0x19')](function(){return db[_0xa688('0x33')][_0xa688('0x4b')]({'raw':!![]});})[_0xa688('0x19')](function(_0x14bebb){var _0x21ac80=fs[_0xa688('0x5c')](path['join'](config[_0xa688('0x5e')],_0xa688('0x5f')),'utf8');var _0x4d3261=fs[_0xa688('0x5c')](path[_0xa688('0x5d')](config['root'],_0xa688('0x61')),_0xa688('0x60'));var _0x55b4f2=ejs[_0xa688('0x65')](_0x21ac80,{'trunks':_0x14bebb});var _0x14f04a=ejs['render'](_0x4d3261,{'trunks':_0x14bebb});fs['writeFileSync'](_0xa688('0x63'),_0x55b4f2);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x14f04a);return respondWithRpcPromise('Reload',_0xa688('0x2f'),{'module':_0xa688('0x68')});})['catch'](handleError(_0x507779,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1445089..f028ad2 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 _0xdaaf=['rimraf','./trunk.attributes','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4097d5,_0x495798){var _0x264f3b=function(_0x4d2f6c){while(--_0x4d2f6c){_0x4097d5['push'](_0x4097d5['shift']());}};_0x264f3b(++_0x495798);}(_0xdaaf,0xf3));var _0xfdaa=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdaaf[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xfdaa('0x0'));var util=require(_0xfdaa('0x1'));var logger=require(_0xfdaa('0x2'))(_0xfdaa('0x3'));var moment=require(_0xfdaa('0x4'));var BPromise=require(_0xfdaa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdaa('0x6'));var rimraf=require(_0xfdaa('0x7'));var config=require('../../config/environment');var attributes=require(_0xfdaa('0x8'));module['exports']=function(_0x18a2aa,_0x423d0c){return _0x18a2aa['define']('Trunk',attributes,{'tableName':_0xfdaa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabc1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','lodash','util','../../config/logger','api'];(function(_0x4d0f0e,_0x21b7e0){var _0x654fad=function(_0x2b15e7){while(--_0x2b15e7){_0x4d0f0e['push'](_0x4d0f0e['shift']());}};_0x654fad(++_0x21b7e0);}(_0xabc1,0x140));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1abc('0x0'));var util=require(_0x1abc('0x1'));var logger=require(_0x1abc('0x2'))(_0x1abc('0x3'));var moment=require(_0x1abc('0x4'));var BPromise=require(_0x1abc('0x5'));var rp=require(_0x1abc('0x6'));var fs=require('fs');var path=require(_0x1abc('0x7'));var rimraf=require(_0x1abc('0x8'));var config=require(_0x1abc('0x9'));var attributes=require(_0x1abc('0xa'));module['exports']=function(_0x3b9636,_0x41639d){return _0x3b9636[_0x1abc('0xb')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 968b05b..d8bbb9c 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 _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','Trunk','findAll','options','raw','limit','include','model','attributes','map','then','GetTrunk','stringify','ShowTrunk'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x5eb8[_0x425716];return _0x2d39af;};'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')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrunk']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrunk',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrunk',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x841d54,_0x592eb4){var _0x48c098=function(_0x31c2f){while(--_0x31c2f){_0x841d54['push'](_0x841d54['shift']());}};_0x48c098(++_0x592eb4);}(_0x757a,0xde));var _0xa757=function(_0x3833c3,_0x276d71){_0x3833c3=_0x3833c3-0x0;var _0x287443=_0x757a[_0x3833c3];return _0x287443;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a78dec6..54a7172 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 _0xb5e2=['put','update','/:id/password','changePassword','delete','removeTeams','destroy','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','bulkCreate','/:id/contacts','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey'];(function(_0x16f265,_0x2ff1ff){var _0x403855=function(_0x8873b4){while(--_0x8873b4){_0x16f265['push'](_0x16f265['shift']());}};_0x403855(++_0x2ff1ff);}(_0xb5e2,0x1d6));var _0x2b5e=function(_0x3fd672,_0x622fb){_0x3fd672=_0x3fd672-0x0;var _0xd72aaf=_0xb5e2[_0x3fd672];return _0xd72aaf;};'use strict';var multer=require('multer');var util=require(_0x2b5e('0x0'));var path=require('path');var timeout=require(_0x2b5e('0x1'));var express=require(_0x2b5e('0x2'));var router=express[_0x2b5e('0x3')]();var auth=require(_0x2b5e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b5e('0x5'));var controller=require('./user.controller');router[_0x2b5e('0x6')]('/',auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x8')]);router[_0x2b5e('0x6')](_0x2b5e('0x9'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0xa')]);router['get'](_0x2b5e('0xb'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0xc')]);router[_0x2b5e('0x6')](_0x2b5e('0xd'),auth[_0x2b5e('0x7')](),controller['show']);router[_0x2b5e('0x6')](_0x2b5e('0xe'),controller[_0x2b5e('0xf')]);router[_0x2b5e('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x2b5e('0x10')]);router[_0x2b5e('0x6')](_0x2b5e('0x11'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x12')]);router[_0x2b5e('0x6')](_0x2b5e('0x13'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x2b5e('0x6')]('/:id/groups',auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x14')]);router[_0x2b5e('0x6')]('/:id/recordings',auth[_0x2b5e('0x7')](),controller['getRecordings']);router[_0x2b5e('0x6')](_0x2b5e('0x15'),auth[_0x2b5e('0x7')](),controller['getScreenRecordings']);router[_0x2b5e('0x6')](_0x2b5e('0x16'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x17')]);router[_0x2b5e('0x6')](_0x2b5e('0x18'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0x2b5e('0x19'),auth['isAuthenticated'](),controller[_0x2b5e('0x1a')]);router[_0x2b5e('0x6')](_0x2b5e('0x1b'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x1c')]);router[_0x2b5e('0x6')](_0x2b5e('0x1d'),auth['isAuthenticated'](),controller[_0x2b5e('0x1e')]);router[_0x2b5e('0x6')]('/:id/whatsapp/interactions',auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x1f')]);router[_0x2b5e('0x6')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x2b5e('0x6')](_0x2b5e('0x20'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x21')]);router['get'](_0x2b5e('0x22'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x23')]);router[_0x2b5e('0x6')](_0x2b5e('0x24'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x25')]);router[_0x2b5e('0x6')](_0x2b5e('0x26'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x27')]);router[_0x2b5e('0x6')](_0x2b5e('0x28'),auth['isAuthenticated'](),controller[_0x2b5e('0x29')]);router[_0x2b5e('0x6')](_0x2b5e('0x2a'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x2b')]);router['get']('/:id/sms_accounts',auth[_0x2b5e('0x7')](),controller['getSmsAccounts']);router['get'](_0x2b5e('0x2c'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x2d')]);router[_0x2b5e('0x6')](_0x2b5e('0x2e'),auth['isAuthenticated'](),controller[_0x2b5e('0x2f')]);router[_0x2b5e('0x6')](_0x2b5e('0x30'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x31')]);router['get'](_0x2b5e('0x32'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x33')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller[_0x2b5e('0x34')]);router[_0x2b5e('0x35')]('/create_many',auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x36')]);router[_0x2b5e('0x35')](_0x2b5e('0x37'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x38')]);router[_0x2b5e('0x35')]('/',auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x39')]);router['post'](_0x2b5e('0x11'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x3a')]);var upload=multer({'storage':multer[_0x2b5e('0x3b')]({'destination':function(_0x5708a4,_0x595c2f,_0xb3c17){_0xb3c17(null,path[_0x2b5e('0x3c')](config[_0x2b5e('0x3d')],_0x2b5e('0x3e')));},'filename':function(_0xc98ab2,_0x5bf63e,_0x2c0462){_0x2c0462(null,util[_0x2b5e('0x3f')](_0x2b5e('0x40'),Date[_0x2b5e('0x41')](),_0x5bf63e[_0x2b5e('0x42')]));}})});router['post'](_0x2b5e('0xe'),upload[_0x2b5e('0x43')](_0x2b5e('0x44')),controller['addAvatar']);router['post'](_0x2b5e('0x45'),auth[_0x2b5e('0x7')](),controller['login']);router[_0x2b5e('0x35')](_0x2b5e('0x46'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x47')]);router[_0x2b5e('0x35')](_0x2b5e('0x48'),auth[_0x2b5e('0x7')](),controller['pause']);router[_0x2b5e('0x35')](_0x2b5e('0x49'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x4a')]);router['post'](_0x2b5e('0x4b'),auth['isAuthenticated'](),controller[_0x2b5e('0x4c')]);router[_0x2b5e('0x35')](_0x2b5e('0x4d'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x4e')]);router[_0x2b5e('0x35')](_0x2b5e('0x4f'),auth[_0x2b5e('0x7')](),controller['addMailInteractions']);router[_0x2b5e('0x35')](_0x2b5e('0x50'),auth['isAuthenticated'](),controller[_0x2b5e('0x51')]);router[_0x2b5e('0x35')](_0x2b5e('0x52'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x53')]);router[_0x2b5e('0x35')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x2b5e('0x54')]);router['post'](_0x2b5e('0x55'),auth['isAuthenticated'](),controller[_0x2b5e('0x56')]);router[_0x2b5e('0x35')](_0x2b5e('0x26'),auth['isAuthenticated'](),controller[_0x2b5e('0x57')]);router[_0x2b5e('0x35')]('/:id/mail_accounts',auth[_0x2b5e('0x7')](),controller['addMailAccounts']);router[_0x2b5e('0x35')](_0x2b5e('0x2a'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x2b5e('0x35')](_0x2b5e('0x58'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x59')]);router[_0x2b5e('0x35')](_0x2b5e('0x2c'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x5a')]);router[_0x2b5e('0x35')]('/:id/whatsapp_accounts',auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x5b')]);router['post'](_0x2b5e('0x30'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x5c')]);router[_0x2b5e('0x35')](_0x2b5e('0x5d'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x5e')]);router[_0x2b5e('0x5f')](_0x2b5e('0xd'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x60')]);router['put'](_0x2b5e('0x61'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x62')]);router['delete']('/:id/queues',auth[_0x2b5e('0x7')](),controller['removeQueues']);router[_0x2b5e('0x63')](_0x2b5e('0x4b'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x64')]);router[_0x2b5e('0x63')](_0x2b5e('0xd'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x65')]);router[_0x2b5e('0x63')](_0x2b5e('0x4d'),auth[_0x2b5e('0x7')](),controller['removeChatInteractions']);router[_0x2b5e('0x63')](_0x2b5e('0x4f'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x66')]);router[_0x2b5e('0x63')](_0x2b5e('0x50'),auth[_0x2b5e('0x7')](),controller['removeFaxInteractions']);router[_0x2b5e('0x63')]('/:id/sms_interactions',auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x67')]);router['delete'](_0x2b5e('0x68'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x2b5e('0x63')](_0x2b5e('0x55'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x69')]);router[_0x2b5e('0x63')]('/:id/fax_accounts',auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x6a')]);router['delete'](_0x2b5e('0x28'),auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0x2b5e('0x2a'),auth['isAuthenticated'](),controller[_0x2b5e('0x6b')]);router[_0x2b5e('0x63')](_0x2b5e('0x58'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x6c')]);router[_0x2b5e('0x63')](_0x2b5e('0x2c'),auth[_0x2b5e('0x7')](),controller['removeChatWebsites']);router[_0x2b5e('0x63')](_0x2b5e('0x2e'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x6d')]);router[_0x2b5e('0x63')](_0x2b5e('0x30'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x6e')]);router[_0x2b5e('0x63')](_0x2b5e('0x5d'),auth[_0x2b5e('0x7')](),controller[_0x2b5e('0x6f')]);module[_0x2b5e('0x70')]=router; \ No newline at end of file +var _0x7a87=['removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/:id','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','addContacts','create','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','changePassword','/:id/queues','removeQueues','delete','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions'];(function(_0x44162f,_0x854cb1){var _0x2f7f57=function(_0x2520ea){while(--_0x2520ea){_0x44162f['push'](_0x44162f['shift']());}};_0x2f7f57(++_0x854cb1);}(_0x7a87,0x75));var _0x77a8=function(_0x226084,_0x16f976){_0x226084=_0x226084-0x0;var _0x507cb2=_0x7a87[_0x226084];return _0x507cb2;};'use strict';var multer=require('multer');var util=require(_0x77a8('0x0'));var path=require('path');var timeout=require(_0x77a8('0x1'));var express=require('express');var router=express[_0x77a8('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x77a8('0x3'));var config=require(_0x77a8('0x4'));var controller=require(_0x77a8('0x5'));router[_0x77a8('0x6')]('/',auth[_0x77a8('0x7')](),controller[_0x77a8('0x8')]);router['get'](_0x77a8('0x9'),auth['isAuthenticated'](),controller[_0x77a8('0xa')]);router['get']('/whoami',auth[_0x77a8('0x7')](),controller[_0x77a8('0xb')]);router[_0x77a8('0x6')](_0x77a8('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x77a8('0x6')]('/:id/avatar',controller['getAvatar']);router[_0x77a8('0x6')](_0x77a8('0xd'),auth[_0x77a8('0x7')](),controller[_0x77a8('0xe')]);router[_0x77a8('0x6')]('/:id/queues',auth[_0x77a8('0x7')](),controller[_0x77a8('0xf')]);router[_0x77a8('0x6')](_0x77a8('0x10'),auth[_0x77a8('0x7')](),controller['getVoiceQueuesRt']);router[_0x77a8('0x6')]('/:id/groups',auth[_0x77a8('0x7')](),controller[_0x77a8('0x11')]);router[_0x77a8('0x6')](_0x77a8('0x12'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x13')]);router[_0x77a8('0x6')]('/:id/screen_recordings',auth[_0x77a8('0x7')](),controller[_0x77a8('0x14')]);router['get']('/:id/chat/interactions',auth[_0x77a8('0x7')](),controller['getChatInteractions']);router[_0x77a8('0x6')](_0x77a8('0x15'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x16')]);router[_0x77a8('0x6')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x77a8('0x17')]);router[_0x77a8('0x6')](_0x77a8('0x18'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x19')]);router[_0x77a8('0x6')](_0x77a8('0x1a'),auth[_0x77a8('0x7')](),controller['getFaxInteractions']);router[_0x77a8('0x6')](_0x77a8('0x1b'),auth[_0x77a8('0x7')](),controller['getWhatsappInteractions']);router[_0x77a8('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x77a8('0x1c')]);router[_0x77a8('0x6')](_0x77a8('0x1d'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x1e')]);router[_0x77a8('0x6')](_0x77a8('0x1f'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x20')]);router[_0x77a8('0x6')](_0x77a8('0x21'),auth[_0x77a8('0x7')](),controller['getVoicePrefixes']);router['get'](_0x77a8('0x22'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x23')]);router[_0x77a8('0x6')](_0x77a8('0x24'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x77a8('0x6')](_0x77a8('0x25'),auth[_0x77a8('0x7')](),controller['getOpenchannelAccounts']);router['get'](_0x77a8('0x26'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x27')]);router['get'](_0x77a8('0x28'),auth['isAuthenticated'](),controller[_0x77a8('0x29')]);router['get'](_0x77a8('0x2a'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router['get'](_0x77a8('0x2b'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x2c')]);router[_0x77a8('0x6')]('/:id/scheduled_calls',auth[_0x77a8('0x7')](),controller[_0x77a8('0x2d')]);router[_0x77a8('0x6')](_0x77a8('0x2e'),auth[_0x77a8('0x7')](),controller['getApiKey']);router[_0x77a8('0x2f')](_0x77a8('0x30'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x31')]);router['post'](_0x77a8('0xd'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x32')]);router[_0x77a8('0x2f')]('/',auth[_0x77a8('0x7')](),controller[_0x77a8('0x33')]);router[_0x77a8('0x2f')]('/:id/queues',auth[_0x77a8('0x7')](),controller[_0x77a8('0x34')]);var upload=multer({'storage':multer[_0x77a8('0x35')]({'destination':function(_0x59ac98,_0x3cf110,_0x4dc41d){_0x4dc41d(null,path['join'](config[_0x77a8('0x36')],_0x77a8('0x37')));},'filename':function(_0x4f8d62,_0x1fd5cb,_0x7bd07){_0x7bd07(null,util[_0x77a8('0x38')](_0x77a8('0x39'),Date[_0x77a8('0x3a')](),_0x1fd5cb['originalname']));}})});router[_0x77a8('0x2f')]('/:id/avatar',upload[_0x77a8('0x3b')]('file'),controller[_0x77a8('0x3c')]);router['post'](_0x77a8('0x3d'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x3e')]);router[_0x77a8('0x2f')](_0x77a8('0x3f'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x40')]);router['post'](_0x77a8('0x41'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x42')]);router['post'](_0x77a8('0x43'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x44')]);router[_0x77a8('0x2f')](_0x77a8('0x45'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x46')]);router[_0x77a8('0x2f')]('/:id/chat_interactions',auth[_0x77a8('0x7')](),controller['addChatInteractions']);router[_0x77a8('0x2f')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x77a8('0x47')]);router[_0x77a8('0x2f')](_0x77a8('0x48'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x49')]);router[_0x77a8('0x2f')]('/:id/sms_interactions',auth[_0x77a8('0x7')](),controller[_0x77a8('0x4a')]);router[_0x77a8('0x2f')](_0x77a8('0x4b'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x4c')]);router[_0x77a8('0x2f')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x77a8('0x4d')]);router['post'](_0x77a8('0x22'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x4e')]);router['post'](_0x77a8('0x24'),auth[_0x77a8('0x7')](),controller['addMailAccounts']);router[_0x77a8('0x2f')]('/:id/openchannel_accounts',auth[_0x77a8('0x7')](),controller['addOpenchannelAccounts']);router[_0x77a8('0x2f')](_0x77a8('0x26'),auth[_0x77a8('0x7')](),controller['addSmsAccounts']);router[_0x77a8('0x2f')](_0x77a8('0x28'),auth[_0x77a8('0x7')](),controller['addChatWebsites']);router[_0x77a8('0x2f')](_0x77a8('0x2a'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x4f')]);router[_0x77a8('0x2f')](_0x77a8('0x2b'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x50')]);router[_0x77a8('0x2f')](_0x77a8('0x2e'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x51')]);router[_0x77a8('0x52')]('/:id',auth[_0x77a8('0x7')](),controller['update']);router[_0x77a8('0x52')]('/:id/password',auth['isAuthenticated'](),controller[_0x77a8('0x53')]);router['delete'](_0x77a8('0x54'),auth['isAuthenticated'](),controller[_0x77a8('0x55')]);router[_0x77a8('0x56')](_0x77a8('0x45'),auth['isAuthenticated'](),controller[_0x77a8('0x57')]);router[_0x77a8('0x56')](_0x77a8('0xc'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x58')]);router[_0x77a8('0x56')]('/:id/chat_interactions',auth[_0x77a8('0x7')](),controller[_0x77a8('0x59')]);router[_0x77a8('0x56')](_0x77a8('0x5a'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x77a8('0x56')](_0x77a8('0x48'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x5b')]);router[_0x77a8('0x56')](_0x77a8('0x5c'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x5d')]);router[_0x77a8('0x56')](_0x77a8('0x4b'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x5e')]);router[_0x77a8('0x56')](_0x77a8('0x5f'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x60')]);router[_0x77a8('0x56')](_0x77a8('0x22'),auth['isAuthenticated'](),controller[_0x77a8('0x61')]);router[_0x77a8('0x56')](_0x77a8('0x24'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x62')]);router[_0x77a8('0x56')](_0x77a8('0x25'),auth['isAuthenticated'](),controller[_0x77a8('0x63')]);router[_0x77a8('0x56')](_0x77a8('0x26'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x64')]);router[_0x77a8('0x56')](_0x77a8('0x28'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x65')]);router[_0x77a8('0x56')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x77a8('0x66')]);router[_0x77a8('0x56')](_0x77a8('0x2b'),auth[_0x77a8('0x7')](),controller['removeSquareProjects']);router['delete'](_0x77a8('0x2e'),auth[_0x77a8('0x7')](),controller[_0x77a8('0x67')]);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 60ba289..99964a8 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 _0xb754=['nat','join','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','split','never','\x22\x22\x20<>','accept','refuse','originate','uac','certificate','active','actpass','update,nonat','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','dtlssetup','/etc/pki/tls/private/motion.key','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','sequelize','moment','util','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','ENUM','admin','user','telephone','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','nonat'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xb754,0x12e));var _0x4b75=function(_0x5f31b0,_0x5d6223){_0x5f31b0=_0x5f31b0-0x0;var _0x5eb946=_0xb754[_0x5f31b0];return _0x5eb946;};'use strict';var Sequelize=require(_0x4b75('0x0'));var moment=require(_0x4b75('0x1'));var util=require(_0x4b75('0x2'));var _=require('lodash');module[_0x4b75('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4b75('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2398e0){this[_0x4b75('0x5')]('name',_0x2398e0);this[_0x4b75('0x5')](_0x4b75('0x6'),_0x2398e0);},'comment':_0x4b75('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x18db5a){this['setDataValue'](_0x4b75('0x8'),_0x18db5a);this[_0x4b75('0x5')](_0x4b75('0x9'),util[_0x4b75('0xa')](_0x4b75('0xb'),_0x18db5a,this[_0x4b75('0xc')](_0x4b75('0xd'))));}},'alias':{'type':Sequelize[_0x4b75('0xe')]},'email':{'type':Sequelize[_0x4b75('0xe')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x2be237){if(_0x2be237){this['setDataValue'](_0x4b75('0xf'),_0x2be237['toLowerCase']());}}},'role':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x11'),_0x4b75('0x12'),'agent',_0x4b75('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':![],'unique':_0x4b75('0xd'),'set':function(_0x2744d9){this[_0x4b75('0x5')](_0x4b75('0xd'),_0x2744d9);this['setDataValue'](_0x4b75('0x15'),_0x2744d9);this['setDataValue'](_0x4b75('0x9'),util[_0x4b75('0xa')](_0x4b75('0xb'),this[_0x4b75('0xc')](_0x4b75('0x8')),_0x2744d9));}},'salt':{'type':Sequelize[_0x4b75('0xe')]},'phone':{'type':Sequelize[_0x4b75('0xe')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x4b75('0xe')]},'userpic':{'type':Sequelize[_0x4b75('0xe')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4b75('0xe')]},'online':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4b75('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4b75('0xe')],'defaultValue':_0x4b75('0x18')},'lastPauseAt':{'type':Sequelize[_0x4b75('0x17')]},'chatCapacity':{'type':Sequelize[_0x4b75('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x4b75('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4b75('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x4b75('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x4b75('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x4b75('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4b75('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x4b75('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'host':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![],'defaultValue':_0x4b75('0x19')},'ipaddr':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x1a'),_0x4b75('0x12'),_0x4b75('0x1b')),'allowNull':!![],'defaultValue':_0x4b75('0x1a')},'context':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![],'defaultValue':_0x4b75('0x1c')},'callingpres':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x1d'),_0x4b75('0x1e'),_0x4b75('0x1f'),_0x4b75('0x20'),_0x4b75('0x21'),_0x4b75('0x22'),_0x4b75('0x23'),_0x4b75('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'secret':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'transport':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![],'defaultValue':_0x4b75('0x25'),'set':function(_0x37cf3f){this['setDataValue']('transport',_0x37cf3f?_0x37cf3f['join'](','):null);},'get':function(){return this[_0x4b75('0xc')](_0x4b75('0x26'))?this['getDataValue'](_0x4b75('0x26'))['split'](','):null;},'comment':_0x4b75('0x27')},'dtmfmode':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x28'),_0x4b75('0x29'),'shortinfo',_0x4b75('0x2a'),_0x4b75('0x2b')),'allowNull':!![],'defaultValue':_0x4b75('0x28')},'directmedia':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no',_0x4b75('0x2d'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'nat':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x8c27ed){this['setDataValue'](_0x4b75('0x2e'),_0x8c27ed?_0x8c27ed[_0x4b75('0x2f')](','):null);},'get':function(){return this[_0x4b75('0xc')]('nat')?this[_0x4b75('0xc')](_0x4b75('0x2e'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4b75('0xe')]},'namedcallgroup':{'type':Sequelize[_0x4b75('0xe')]},'pickupgroup':{'type':Sequelize[_0x4b75('0xe')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4b75('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4b75('0xe')]},'disallow':{'type':Sequelize[_0x4b75('0xe')],'allowNull':![],'defaultValue':_0x4b75('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b75('0x31'),'set':function(_0x583480){this[_0x4b75('0x5')](_0x4b75('0x32'),_0x583480?_0x583480[_0x4b75('0x2f')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x4b75('0x32'))?this[_0x4b75('0xc')](_0x4b75('0x32'))['split'](';'):null;},'comment':_0x4b75('0x33')},'autoframing':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![],'set':function(_0xb3848f){this['setDataValue'](_0x4b75('0x34'),_0xb3848f?_0xb3848f[_0x4b75('0x2f')](','):null);},'get':function(){return this[_0x4b75('0xc')]('insecure')?this[_0x4b75('0xc')]('insecure')[_0x4b75('0x35')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x4b75('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4b75('0x2c'),'no',_0x4b75('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x4b75('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![],'defaultValue':_0x4b75('0x37')},'amaflags':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x4b75('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4b75('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x4b75('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4b75('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'template':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x38'),_0x4b75('0x39'),_0x4b75('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x3b'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4b75('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x4b75('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x4b75('0x10')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no','fingerprint',_0x4b75('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x3d'),'passive',_0x4b75('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4b75('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x4b75('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no',_0x4b75('0x2d'),'update',_0x4b75('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4b75('0xe')]},'resetPasswordExpires':{'type':Sequelize[_0x4b75('0x17')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x54dfa0){this[_0x4b75('0x5')](_0x4b75('0x40'),_0x54dfa0);var _0x205c82=this[_0x4b75('0x41')]({'plain':!![]});switch(_0x54dfa0){case 0x0:case 0x1:var _0x27de85=_0x205c82['transport']?_[_0x4b75('0x42')](_0x205c82[_0x4b75('0x26')])?_0x205c82[_0x4b75('0x26')][_0x4b75('0x2f')]():_0x205c82[_0x4b75('0x26')]:'udp';if(_0x27de85==='wss'){_0x27de85='udp';}this[_0x4b75('0x5')](_0x4b75('0x26'),_0x27de85);this['setDataValue'](_0x4b75('0x43'),'no');this[_0x4b75('0x5')](_0x4b75('0x44'),null);this[_0x4b75('0x5')](_0x4b75('0x45'),null);this['setDataValue'](_0x4b75('0x46'),null);this[_0x4b75('0x5')](_0x4b75('0x47'),null);this[_0x4b75('0x5')](_0x4b75('0x48'),null);this[_0x4b75('0x5')]('dtlssetup',null);this[_0x4b75('0x5')](_0x4b75('0x49'),null);this[_0x4b75('0x5')](_0x4b75('0x4a'),null);this['setDataValue'](_0x4b75('0x4b'),'no');break;case 0x2:this['setDataValue'](_0x4b75('0x26'),_0x4b75('0x4c'));this[_0x4b75('0x5')]('encryption','yes');this['setDataValue'](_0x4b75('0x44'),_0x4b75('0x2c'));this[_0x4b75('0x5')](_0x4b75('0x45'),_0x4b75('0x2c'));this[_0x4b75('0x5')](_0x4b75('0x46'),_0x4b75('0x2c'));this[_0x4b75('0x5')](_0x4b75('0x47'),_0x4b75('0x2c'));this[_0x4b75('0x5')](_0x4b75('0x48'),'no');this['setDataValue'](_0x4b75('0x4d'),_0x4b75('0x3e'));this[_0x4b75('0x5')]('dtlscertfile',_0x205c82[_0x4b75('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0x4b75('0x5')](_0x4b75('0x4a'),_0x205c82['dtlsprivatekey']||_0x4b75('0x4e'));this[_0x4b75('0x5')]('rtcp_mux',_0x4b75('0x2c'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x53181a){this[_0x4b75('0x5')]('permissions',_0x53181a?_0x53181a[_0x4b75('0x2f')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0x4b75('0x4f')](this[_0x4b75('0xc')]('permissions')[_0x4b75('0x35')](','),function(_0x2a2280){return parseInt(_0x2a2280,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x4b75('0xe')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x4b75('0xe')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4b75('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x4b75('0xe')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4b75('0x10')](_0x4b75('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4b75('0xe')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x4b75('0x50')],'get':function(){return this['getDataValue'](_0x4b75('0x51'))?this[_0x4b75('0xc')](_0x4b75('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x4b75('0xe')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4b75('0xe')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![],'set':function(_0x20a940){if(typeof _0x20a940===_0x4b75('0x52')){var _0x372eef=_0x20a940==='1'?!![]:_0x20a940==='0'?![]:_0x20a940===_0x4b75('0x53')?!![]:_0x20a940==='false'?![]:![];this[_0x4b75('0x5')](_0x4b75('0x54'),_0x372eef);}else{this[_0x4b75('0x5')](_0x4b75('0x54'),_0x20a940);}}},'blocked':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![],'set':function(_0x29ca38){this[_0x4b75('0x5')](_0x4b75('0x55'),_0x29ca38);if(_0x29ca38===!![]){this['setDataValue'](_0x4b75('0x56'),moment());this[_0x4b75('0x5')]('loginAttempts',0x0);}else{this[_0x4b75('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x4b75('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x4b75('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4b75('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x3dd7=['nonat','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','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','showWebBar','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x3dd7,0xe9));var _0x73dd=function(_0x6925fa,_0x4e6100){_0x6925fa=_0x6925fa-0x0;var _0x56d211=_0x3dd7[_0x6925fa];return _0x56d211;};'use strict';var Sequelize=require(_0x73dd('0x0'));var moment=require(_0x73dd('0x1'));var util=require(_0x73dd('0x2'));var _=require(_0x73dd('0x3'));module['exports']={'name':{'type':Sequelize[_0x73dd('0x4')],'allowNull':![],'unique':_0x73dd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x317422){this['setDataValue'](_0x73dd('0x5'),_0x317422);this[_0x73dd('0x6')](_0x73dd('0x7'),_0x317422);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x73dd('0x4')],'allowNull':![],'set':function(_0x2d3c2a){this[_0x73dd('0x6')](_0x73dd('0x8'),_0x2d3c2a);this[_0x73dd('0x6')](_0x73dd('0x9'),util[_0x73dd('0xa')](_0x73dd('0xb'),_0x2d3c2a,this[_0x73dd('0xc')](_0x73dd('0xd'))));}},'alias':{'type':Sequelize[_0x73dd('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x73dd('0xe'),'validate':{'isEmail':!![]},'set':function(_0x482be0){if(_0x482be0){this[_0x73dd('0x6')]('email',_0x482be0[_0x73dd('0xf')]());}}},'role':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x11'),_0x73dd('0x12'),_0x73dd('0x13'),_0x73dd('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x73dd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x73dd('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x648e0b){this['setDataValue'](_0x73dd('0xd'),_0x648e0b);this[_0x73dd('0x6')](_0x73dd('0x15'),_0x648e0b);this['setDataValue'](_0x73dd('0x9'),util[_0x73dd('0xa')](_0x73dd('0xb'),this[_0x73dd('0xc')](_0x73dd('0x8')),_0x648e0b));}},'salt':{'type':Sequelize[_0x73dd('0x4')]},'phone':{'type':Sequelize[_0x73dd('0x4')]},'mobile':{'type':Sequelize[_0x73dd('0x4')]},'address':{'type':Sequelize[_0x73dd('0x4')]},'zipcode':{'type':Sequelize[_0x73dd('0x4')]},'userpic':{'type':Sequelize[_0x73dd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x73dd('0x4')],'defaultValue':_0x73dd('0x17')},'lastPauseAt':{'type':Sequelize[_0x73dd('0x18')]},'chatCapacity':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x73dd('0x19')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x73dd('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![],'defaultValue':_0x73dd('0x1a')},'ipaddr':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x73dd('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x1b'),_0x73dd('0x12'),'peer'),'allowNull':!![],'defaultValue':_0x73dd('0x1b')},'context':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x73dd('0x1c'),_0x73dd('0x1d'),_0x73dd('0x1e'),_0x73dd('0x1f'),'PROHIB_NOT_SCREENED',_0x73dd('0x20'),_0x73dd('0x21'),_0x73dd('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x73dd('0x23'),'set':function(_0x1de888){this[_0x73dd('0x6')](_0x73dd('0x24'),_0x1de888?_0x1de888[_0x73dd('0x25')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x73dd('0xc')](_0x73dd('0x24'))['split'](','):null;},'comment':_0x73dd('0x26')},'dtmfmode':{'type':Sequelize['ENUM'](_0x73dd('0x27'),_0x73dd('0x28'),_0x73dd('0x29'),'inband',_0x73dd('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x73dd('0x10')]('yes','no',_0x73dd('0x2b'),_0x73dd('0x2c'),_0x73dd('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x73dd('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x73dd('0x2e'),'set':function(_0x40a77b){this['setDataValue'](_0x73dd('0x2f'),_0x40a77b?_0x40a77b[_0x73dd('0x25')](','):null);},'get':function(){return this[_0x73dd('0xc')](_0x73dd('0x2f'))?this['getDataValue'](_0x73dd('0x2f'))[_0x73dd('0x30')](','):null;},'comment':_0x73dd('0x31')},'callgroup':{'type':Sequelize[_0x73dd('0x4')]},'namedcallgroup':{'type':Sequelize[_0x73dd('0x4')]},'pickupgroup':{'type':Sequelize[_0x73dd('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x73dd('0x4')]},'disallow':{'type':Sequelize[_0x73dd('0x4')],'allowNull':![],'defaultValue':_0x73dd('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x73dd('0x33'),'set':function(_0x3520b0){this[_0x73dd('0x6')](_0x73dd('0x34'),_0x3520b0?_0x3520b0[_0x73dd('0x25')](';'):_0x73dd('0x33'));},'get':function(){return this[_0x73dd('0xc')](_0x73dd('0x34'))?this['getDataValue']('allow')[_0x73dd('0x30')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x226308){this['setDataValue'](_0x73dd('0x36'),_0x226308?_0x226308[_0x73dd('0x25')](','):null);},'get':function(){return this[_0x73dd('0xc')](_0x73dd('0x36'))?this[_0x73dd('0xc')](_0x73dd('0x36'))[_0x73dd('0x30')](','):null;},'comment':_0x73dd('0x37')},'trustrpid':{'type':Sequelize[_0x73dd('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no',_0x73dd('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x73dd('0x35'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![],'defaultValue':_0x73dd('0x35')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x73dd('0x35'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x73dd('0x35'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x73dd('0x35'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x39'),_0x73dd('0x3a'),_0x73dd('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x73dd('0x3c'),'uas'),'allowNull':!![],'defaultValue':_0x73dd('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x73dd('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x73dd('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no',_0x73dd('0x3e'),_0x73dd('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x73dd('0x40'),_0x73dd('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x73dd('0x35'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x73dd('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x73dd('0x10')](_0x73dd('0x35'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x73dd('0x35'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x73dd('0x10')]('yes','no',_0x73dd('0x2b'),_0x73dd('0x2c'),_0x73dd('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x73dd('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x73dd('0x18')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x18d143){this[_0x73dd('0x6')](_0x73dd('0x43'),_0x18d143);var _0x4ae074=this[_0x73dd('0x44')]({'plain':!![]});switch(_0x18d143){case 0x0:case 0x1:var _0x384804=_0x4ae074[_0x73dd('0x24')]?_['isArray'](_0x4ae074[_0x73dd('0x24')])?_0x4ae074['transport'][_0x73dd('0x25')]():_0x4ae074[_0x73dd('0x24')]:_0x73dd('0x23');if(_0x384804===_0x73dd('0x45')){_0x384804=_0x73dd('0x23');}this[_0x73dd('0x6')](_0x73dd('0x24'),_0x384804);this[_0x73dd('0x6')](_0x73dd('0x46'),'no');this[_0x73dd('0x6')](_0x73dd('0x47'),null);this[_0x73dd('0x6')](_0x73dd('0x48'),null);this[_0x73dd('0x6')](_0x73dd('0x49'),null);this[_0x73dd('0x6')](_0x73dd('0x4a'),null);this['setDataValue'](_0x73dd('0x4b'),null);this['setDataValue']('dtlssetup',null);this[_0x73dd('0x6')]('dtlscertfile',null);this[_0x73dd('0x6')](_0x73dd('0x4c'),null);this[_0x73dd('0x6')](_0x73dd('0x4d'),'no');break;case 0x2:this[_0x73dd('0x6')](_0x73dd('0x24'),_0x73dd('0x45'));this['setDataValue']('encryption',_0x73dd('0x35'));this[_0x73dd('0x6')](_0x73dd('0x47'),'yes');this[_0x73dd('0x6')](_0x73dd('0x48'),_0x73dd('0x35'));this[_0x73dd('0x6')](_0x73dd('0x49'),_0x73dd('0x35'));this[_0x73dd('0x6')]('dtlsenable',_0x73dd('0x35'));this[_0x73dd('0x6')](_0x73dd('0x4b'),'no');this[_0x73dd('0x6')](_0x73dd('0x4e'),'actpass');this[_0x73dd('0x6')](_0x73dd('0x4f'),_0x4ae074[_0x73dd('0x4f')]||_0x73dd('0x50'));this[_0x73dd('0x6')]('dtlsprivatekey',_0x4ae074[_0x73dd('0x4c')]||_0x73dd('0x51'));this[_0x73dd('0x6')](_0x73dd('0x4d'),_0x73dd('0x35'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x232583){this['setDataValue'](_0x73dd('0x52'),_0x232583?_0x232583[_0x73dd('0x25')](','):[]);},'get':function(){return this[_0x73dd('0xc')](_0x73dd('0x52'))?_[_0x73dd('0x53')](this[_0x73dd('0xc')]('permissions')[_0x73dd('0x30')](','),function(_0x5f2d0c){return parseInt(_0x5f2d0c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x73dd('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x73dd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x73dd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x73dd('0x10')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x73dd('0x4')]},'passwordResetAt':{'type':Sequelize[_0x73dd('0x18')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x73dd('0x54')],'get':function(){return this[_0x73dd('0xc')](_0x73dd('0x55'))?this[_0x73dd('0xc')](_0x73dd('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x73dd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x73dd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![],'set':function(_0x13a190){if(typeof _0x13a190===_0x73dd('0x56')){var _0x35ea19=_0x13a190==='1'?!![]:_0x13a190==='0'?![]:_0x13a190===_0x73dd('0x57')?!![]:_0x13a190===_0x73dd('0x58')?![]:![];this['setDataValue']('screenrecording',_0x35ea19);}else{this[_0x73dd('0x6')](_0x73dd('0x59'),_0x13a190);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x477b6f){this[_0x73dd('0x6')]('blocked',_0x477b6f);if(_0x477b6f===!![]){this[_0x73dd('0x6')](_0x73dd('0x5a'),moment());this[_0x73dd('0x6')](_0x73dd('0x5b'),0x0);}else{this[_0x73dd('0x6')](_0x73dd('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x73dd('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x73dd('0x19')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x73dd('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 85e193b..f320319 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 _0x286a=['manual','mail','fax','sms','openchannel','%s%s','Team','getTeams','addTeams','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','Voice','QueueId','removeTeams','getWhatsappQueues','Queue:remove','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','isArray','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','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$any','CmHopper','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','send','html-pdf','eml-format','rimraf','zip-dir','bluebird','path','ejs','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./user.socket','register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','end','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','Users','user','Agents','agent','telephone','filter','value','includes','role','name','UserProfileResource','sendStatus','stack','index','map','User','rawAttributes','key','model','differenceBy','password','salt','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','sequelize','col','options','includeAll','include','findAll','rows','catch','params','length','find','bulkCreate','body','describe','addContacts','ids','omit','admin','../../config/license/util','getLicense','telephones','isNil','create','internal','findById','securePassword','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','VoiceMail','fullname','email','permissions','101','102','103','113','104','105','106','107','109','100','114','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Telephones','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','oldPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','online','loginInPause','voicePause','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','voice','VoiceQueue','push','interface','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','channel','emit','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','existsSync','server/files/images/','CmContact','pick','getContacts','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:forcelogout','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','each','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','device','LOGININPAUSE','MemberReport','concat','isMiddleware','resolve','update','QueuePause','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','pauseType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x286a,0x76));var _0xa286=function(_0x2270f7,_0x5cab14){_0x2270f7=_0x2270f7-0x0;var _0x269a22=_0x286a[_0x2270f7];return _0x269a22;};'use strict';var pdf=require(_0xa286('0x0'));var emlformat=require(_0xa286('0x1'));var rimraf=require(_0xa286('0x2'));var zipdir=require(_0xa286('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa286('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa286('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa286('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa286('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xa286('0x8'));var querystring=require(_0xa286('0x9'));var Papa=require(_0xa286('0xa'));var Redis=require(_0xa286('0xb'));var authService=require(_0xa286('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa286('0xd'));var hardwareService=require(_0xa286('0xe'));var logger=require(_0xa286('0xf'))(_0xa286('0x10'));var utils=require(_0xa286('0x11'));var config=require(_0xa286('0x12'));var db=require(_0xa286('0x13'))['db'];config[_0xa286('0x14')]=_[_0xa286('0x15')](config[_0xa286('0x14')],{'host':_0xa286('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa286('0x14')]));require(_0xa286('0x17'))[_0xa286('0x18')](socket);var jayson=require(_0xa286('0x19'));var client=jayson[_0xa286('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x690334,_0x1fef2,_0x3dab71){if(_0x3dab71){var _0x319781=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x319781[_0xa286('0x1b')](_0x1fef2)){return _0x690334;}else{throw new db[(_0xa286('0x1c'))][(_0xa286('0x1d'))](_0xa286('0x1e'));}}else{return _0x690334;}}function respondWithRpcPromise(_0x35d618,_0x14e206,_0xf6755b,_0x4c57af){return new BPromise(function(_0x2b85af,_0x2a1d7c){var _0x56d418=_0x4c57af||client;return _0x56d418[_0xa286('0x1f')](_0x35d618,_0xf6755b)[_0xa286('0x20')](function(_0x2c224f){logger[_0xa286('0x21')](_0xa286('0x22'),_0x14e206,_0xa286('0x23'));logger[_0xa286('0x24')](_0xa286('0x25'),_0x14e206,_0xa286('0x23'),JSON[_0xa286('0x26')](_0x2c224f));if(_0x2c224f[_0xa286('0x27')]){if(_0x2c224f[_0xa286('0x27')]['code']===0x1f4){logger[_0xa286('0x27')](_0xa286('0x22'),_0x14e206,_0x2c224f[_0xa286('0x27')][_0xa286('0x28')]);return _0x2a1d7c(_0x2c224f[_0xa286('0x27')][_0xa286('0x28')]);}logger[_0xa286('0x27')](_0xa286('0x22'),_0x14e206,_0x2c224f['error'][_0xa286('0x28')]);return _0x2b85af(_0x2c224f[_0xa286('0x27')][_0xa286('0x28')]);}else{logger[_0xa286('0x21')](_0xa286('0x22'),_0x14e206,'request\x20sent');_0x2b85af(_0x2c224f['result']['message']);}})['catch'](function(_0x209a8d){logger[_0xa286('0x27')](_0xa286('0x22'),_0x14e206,_0x209a8d);_0x2a1d7c(_0x209a8d);});});}function respondWithStatusCode(_0x41feeb,_0x24e592){_0x24e592=_0x24e592||0xcc;return function(_0x474f52){if(_0x474f52){return _0x41feeb['sendStatus'](_0x24e592);}return _0x41feeb['status'](_0x24e592)[_0xa286('0x29')]();};}function respondWithResult(_0xabe082,_0x6d39fc){_0x6d39fc=_0x6d39fc||0xc8;return function(_0x1af4cf){if(_0x1af4cf){return _0xabe082[_0xa286('0x2a')](_0x6d39fc)[_0xa286('0x2b')](_0x1af4cf);}};}function respondWithFilteredResult(_0x47e789,_0x2ba3b2){return function(_0x47ef7b){if(_0x47ef7b){var _0x46edad=_0x47ef7b[_0xa286('0x2c')],_0x5aba5e=_0x2ba3b2['offset'],_0xb8bc2f=_0x2ba3b2[_0xa286('0x2d')]+_0x2ba3b2['limit'],_0x59d3fe;if(_0xb8bc2f>=_0x46edad){_0xb8bc2f=_0x46edad;_0x59d3fe=0xc8;}else{_0x59d3fe=0xce;}_0x47e789[_0xa286('0x2a')](_0x59d3fe);return _0x47e789[_0xa286('0x2e')](_0xa286('0x2f'),_0x5aba5e+'-'+_0xb8bc2f+'/'+_0x46edad)[_0xa286('0x2b')](_0x47ef7b);}return null;};}function patchUpdates(_0x570b23){return function(_0x5cdc6f){try{jsonpatch[_0xa286('0x30')](_0x5cdc6f,_0x570b23,!![]);}catch(_0x9c662e){return BPromise[_0xa286('0x31')](_0x9c662e);}return _0x5cdc6f[_0xa286('0x32')]();};}function saveUpdates(_0x963154,_0x18a7fb){return function(_0x4d9b6c){if(_0x4d9b6c){return _0x4d9b6c['update'](_0x963154)[_0xa286('0x20')](function(_0x180ecb){return _0x180ecb;});}return null;};}function removeEntity(_0x1cf82c,_0x4b3556){return function(_0xbc8ff1){if(_0xbc8ff1){return _0xbc8ff1[_0xa286('0x33')]()['then'](function(){var _0x47492=_0xbc8ff1['get']({'plain':!![]});var _0x2feab0=[{'name':_0xa286('0x34'),'value':_0xa286('0x35'),'ignore':!![]},{'name':_0xa286('0x36'),'value':_0xa286('0x37'),'ignore':![]},{'name':'Telephones','value':_0xa286('0x38'),'ignore':![]}];var _0x7cf9be=_(_0x2feab0)[_0xa286('0x39')]('ignore')['map'](_0xa286('0x3a'))[_0xa286('0x3a')]();if(_[_0xa286('0x3b')](_0x7cf9be,_0x47492[_0xa286('0x3c')])){return;}var _0x540811=_['find'](_0x2feab0,['value',_0x47492[_0xa286('0x3c')]])[_0xa286('0x3d')];return db[_0xa286('0x3e')][_0xa286('0x33')]({'where':{'type':_0x540811,'resourceId':_0x47492['id']}})[_0xa286('0x20')](function(){return _0xbc8ff1;});})[_0xa286('0x20')](function(){_0x1cf82c[_0xa286('0x2a')](0xcc)[_0xa286('0x29')]();});}};}function handleEntityNotFound(_0x297fa1,_0x318cb6){return function(_0x5946c2){if(!_0x5946c2){_0x297fa1[_0xa286('0x3f')](0x194);}return _0x5946c2;};}function handleError(_0x308060,_0x5c3c7c){_0x5c3c7c=_0x5c3c7c||0x1f4;return function(_0x41eb6){logger[_0xa286('0x27')](_0x41eb6[_0xa286('0x40')]);if(_0x41eb6[_0xa286('0x3d')]){delete _0x41eb6['name'];}_0x308060[_0xa286('0x2a')](_0x5c3c7c)['send'](_0x41eb6);};}exports[_0xa286('0x41')]=function(_0x2a33f9,_0x3d296e){var _0x3280b5={},_0x5e6c31={},_0x3b043d={'count':0x0,'rows':[]};var _0x57a477=_[_0xa286('0x42')](db[_0xa286('0x43')][_0xa286('0x44')],function(_0x823968){return{'name':_0x823968['fieldName'],'type':_0x823968['type'][_0xa286('0x45')]};});_0x5e6c31[_0xa286('0x46')]=_[_0xa286('0x47')](_[_0xa286('0x42')](_0x57a477,'name'),[_0xa286('0x48'),_0xa286('0x49')]);_0x5e6c31[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x2a33f9[_0xa286('0x4a')]);_0x5e6c31[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x5e6c31[_0xa286('0x46')],_0x5e6c31[_0xa286('0x4a')]);_0x3280b5['attributes']=_[_0xa286('0x4d')](_0x5e6c31[_0xa286('0x46')],qs['fields'](_0x2a33f9[_0xa286('0x4a')][_0xa286('0x4e')]));_0x3280b5[_0xa286('0x4f')]=_0x3280b5[_0xa286('0x4f')]['length']?_0x3280b5[_0xa286('0x4f')]:_0x5e6c31['model'];if(!_0x2a33f9['query'][_0xa286('0x50')](_0xa286('0x51'))){_0x3280b5[_0xa286('0x52')]=qs['limit'](_0x2a33f9[_0xa286('0x4a')]['limit']);_0x3280b5['offset']=qs['offset'](_0x2a33f9[_0xa286('0x4a')][_0xa286('0x2d')]);}_0x3280b5[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x2a33f9[_0xa286('0x4a')]['sort']);_0x3280b5[_0xa286('0x55')]=qs[_0xa286('0x4c')](_['pick'](_0x2a33f9[_0xa286('0x4a')],_0x5e6c31[_0xa286('0x4c')]),_0x57a477);if(_0x2a33f9[_0xa286('0x4a')][_0xa286('0x39')]){_0x3280b5['where']=_[_0xa286('0x56')](_0x3280b5['where'],{'$or':_[_0xa286('0x42')](_0x57a477,function(_0x2af8c6){if(_0x2af8c6[_0xa286('0x57')]!==_0xa286('0x58')){return db[_0xa286('0x59')]['where'](db[_0xa286('0x59')]['fn']('lower',db['sequelize'][_0xa286('0x5a')](_0x2af8c6[_0xa286('0x3d')])),{'$like':db[_0xa286('0x59')]['fn']('lower','%'+_0x2a33f9[_0xa286('0x4a')][_0xa286('0x39')]+'%')});}})});}_0x3280b5=_[_0xa286('0x56')]({},_0x3280b5,_0x2a33f9[_0xa286('0x5b')]);var _0x20d078={'where':_0x3280b5[_0xa286('0x55')]};return db['User'][_0xa286('0x2c')](_0x20d078)[_0xa286('0x20')](function(_0xafaf24){_0x3b043d['count']=_0xafaf24;if(_0x2a33f9[_0xa286('0x4a')][_0xa286('0x5c')]){_0x3280b5[_0xa286('0x5d')]=[{'all':!![]}];}return db[_0xa286('0x43')][_0xa286('0x5e')](_0x3280b5);})[_0xa286('0x20')](function(_0x54f730){_0x3b043d[_0xa286('0x5f')]=_0x54f730;return _0x3b043d;})['then'](respondWithFilteredResult(_0x3d296e,_0x3280b5))[_0xa286('0x60')](handleError(_0x3d296e,null));};exports['show']=function(_0x5761b4,_0x3ac857){var _0x1636d5={'raw':![],'where':{'id':_0x5761b4[_0xa286('0x61')]['id']}},_0x1bca8f={};_0x1bca8f['model']=_[_0xa286('0x47')](_['keys'](db[_0xa286('0x43')][_0xa286('0x44')]),[_0xa286('0x48'),_0xa286('0x49')]);_0x1bca8f[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x5761b4[_0xa286('0x4a')]);_0x1bca8f[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x1bca8f[_0xa286('0x46')],_0x1bca8f['query']);_0x1636d5[_0xa286('0x4f')]=_[_0xa286('0x4d')](_0x1bca8f['model'],qs[_0xa286('0x4e')](_0x5761b4[_0xa286('0x4a')][_0xa286('0x4e')]));_0x1636d5['attributes']=_0x1636d5[_0xa286('0x4f')][_0xa286('0x62')]?_0x1636d5[_0xa286('0x4f')]:_0x1bca8f[_0xa286('0x46')];if(_0x5761b4[_0xa286('0x4a')]['includeAll']){_0x1636d5[_0xa286('0x5d')]=[{'all':!![]}];}_0x1636d5=_[_0xa286('0x56')]({},_0x1636d5,_0x5761b4[_0xa286('0x5b')]);return db[_0xa286('0x43')][_0xa286('0x63')](_0x1636d5)[_0xa286('0x20')](handleEntityNotFound(_0x3ac857,null))[_0xa286('0x20')](respondWithResult(_0x3ac857,null))['catch'](handleError(_0x3ac857,null));};exports[_0xa286('0x64')]=function(_0x37a45d,_0x4c2213){return db[_0xa286('0x43')][_0xa286('0x64')](_0x37a45d[_0xa286('0x65')],{'raw':![],'individualHooks':!![]})[_0xa286('0x20')](respondWithResult(_0x4c2213,0xc9))[_0xa286('0x60')](handleError(_0x4c2213,null));};exports['update']=function(_0x5168bc,_0x14fb23){if(_0x5168bc[_0xa286('0x65')]['id']){delete _0x5168bc[_0xa286('0x65')]['id'];}delete _0x5168bc[_0xa286('0x65')]['role'];return db['User'][_0xa286('0x63')]({'where':{'id':_0x5168bc[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x14fb23,null))[_0xa286('0x20')](saveUpdates(_0x5168bc['body'],null))[_0xa286('0x20')](respondWithResult(_0x14fb23,null))[_0xa286('0x60')](handleError(_0x14fb23,null));};exports['describe']=function(_0x18666e,_0x3df741){return db['User'][_0xa286('0x66')]()[_0xa286('0x20')](respondWithResult(_0x3df741,null))[_0xa286('0x60')](handleError(_0x3df741,null));};exports[_0xa286('0x67')]=function(_0x53b824,_0x2d5fbb,_0x29bc68){return db[_0xa286('0x43')][_0xa286('0x63')]({'where':{'id':_0x53b824[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x2d5fbb,null))[_0xa286('0x20')](function(_0x3fa00d){if(_0x3fa00d){return _0x3fa00d[_0xa286('0x67')](_0x53b824[_0xa286('0x65')][_0xa286('0x68')],_[_0xa286('0x69')](_0x53b824[_0xa286('0x65')],[_0xa286('0x68'),'id'])||{});}})[_0xa286('0x20')](respondWithResult(_0x2d5fbb,null))[_0xa286('0x60')](handleError(_0x2d5fbb,null));};var getLicense=function(_0x32854f){return new BPromise(function(_0x47d151,_0x1484c1){var _0x2eb920=0x0;_0x32854f['body'][_0xa286('0x3c')]==='agent'&&_0x47d151('agent\x20role');return db['User'][_0xa286('0x2c')]({'where':{'$or':[{'role':_0x32854f[_0xa286('0x65')]['role']===_0xa286('0x38')?_0xa286('0x38'):[_0xa286('0x6a'),_0xa286('0x35')]}]}})[_0xa286('0x20')](function(_0x53acb1){_0x2eb920=_0x53acb1;return require(_0xa286('0x6b'))[_0xa286('0x6c')]();})[_0xa286('0x20')](function(_0x45f644){var _0x47c460=_0x32854f['body'][_0xa286('0x3c')]===_0xa286('0x38')?_0xa286('0x6d'):'users';if(!_[_0xa286('0x6e')](_0x45f644[_0x47c460])&&_0x2eb920>=_0x45f644[_0x47c460]){return _0x1484c1({'message':'License\x20limit\x20reached'});}return _0x47d151(util['format']('count\x20%s:\x20%s',_0x47c460,_0x2eb920));})[_0xa286('0x60')](function(_0x4ac245){return _0x1484c1(_0x4ac245);});});};exports[_0xa286('0x6f')]=function(_0x2f64a9,_0xe77c10){return getLicense(_0x2f64a9)[_0xa286('0x20')](function(_0x2ca21b){if(!_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')]){var _0x326aca;return db['Setting'][_0xa286('0x71')](0x1)[_0xa286('0x20')](function(_0x193f77){return checkPasswordPattern(_0x193f77,_0x2f64a9[_0xa286('0x65')][_0xa286('0x48')],_0x193f77[_0xa286('0x72')]);})[_0xa286('0x20')](function(_0x1d176d){_0x326aca=_0x1d176d[_0xa286('0x73')];return db[_0xa286('0x43')]['max'](_0xa286('0x70'));})[_0xa286('0x20')](function(_0x226dc5){if(_[_0xa286('0x6e')](_0x226dc5)){if(_0x326aca){_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')]=_0x326aca;}else{_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')]=0x1;}}else{if(_[_0xa286('0x6e')](_0x326aca)||_0x326aca==_0x226dc5){_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')]=_0x226dc5+0x1;}else if(_0x326aca>_0x226dc5){_0x2f64a9['body'][_0xa286('0x70')]=_0x326aca;}else{return db['sequelize'][_0xa286('0x4a')](_0xa286('0x74'),{'type':db[_0xa286('0x59')]['QueryTypes'][_0xa286('0x75')]})[_0xa286('0x20')](function(_0x40d637){if(_0x40d637&&_0x40d637[_0xa286('0x62')]){for(var _0x5ac091=0x0,_0x58298e=_0x40d637[_0xa286('0x62')];_0x5ac091<_0x58298e&&_['isNil'](_0x2f64a9['body']['internal']);_0x5ac091++){if(_0x326aca<=_0x40d637[_0x5ac091]['from']){_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')]=_0x40d637[_0x5ac091][_0xa286('0x76')];}else if(_0x326aca>_0x40d637[_0x5ac091]['from']&&_0x326aca<=_0x40d637[_0x5ac091]['to']){_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')]=_0x326aca;}}}if(_['isNil'](_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')])){_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')]=_0x226dc5+0x1;}});}}});}})[_0xa286('0x20')](function(){if(_0x2f64a9['body']['voicemail']){_0x2f64a9[_0xa286('0x65')]['mailbox']=_0x2f64a9[_0xa286('0x65')]['internal'];_0x2f64a9[_0xa286('0x65')][_0xa286('0x77')]={'mailbox':_0x2f64a9[_0xa286('0x65')][_0xa286('0x70')],'password':_0x2f64a9['body'][_0xa286('0x48')],'fullname':_0x2f64a9['body'][_0xa286('0x78')],'email':_0x2f64a9['body'][_0xa286('0x79')]};}if(_0x2f64a9['body']&&_0x2f64a9[_0xa286('0x65')][_0xa286('0x3c')]===_0xa286('0x37')){if(!_0x2f64a9[_0xa286('0x65')]['permissions']){_0x2f64a9[_0xa286('0x65')][_0xa286('0x7a')]=[_0xa286('0x7b'),_0xa286('0x7c'),_0xa286('0x7d'),_0xa286('0x7e'),'110',_0xa286('0x7f'),_0xa286('0x80'),_0xa286('0x81'),_0xa286('0x82'),'108',_0xa286('0x83'),_0xa286('0x84'),'111',_0xa286('0x85')];}}return db[_0xa286('0x43')][_0xa286('0x6f')](_0x2f64a9[_0xa286('0x65')],{'include':[{'model':db[_0xa286('0x77')],'as':_0xa286('0x77')}]});})[_0xa286('0x20')](function(_0x286e19){if(_0x2f64a9[_0xa286('0x65')]['role']==='user')return _0x286e19;var _0x53ca5a=_0x2f64a9[_0xa286('0x35')][_0xa286('0x86')]({'plain':!![]});if(!_0x53ca5a)throw new Error(_0xa286('0x87'));if(_0x53ca5a['role']===_0xa286('0x35')){var _0x3d8cf8=_0x286e19[_0xa286('0x86')]({'plain':!![]});var _0x5d1cdd=[{'name':_0xa286('0x36'),'value':_0xa286('0x37')},{'name':_0xa286('0x88'),'value':_0xa286('0x38')}];var _0x3e0a74=_['find'](_0x5d1cdd,[_0xa286('0x3a'),_0x3d8cf8[_0xa286('0x3c')]])[_0xa286('0x3d')];return db[_0xa286('0x89')][_0xa286('0x63')]({'where':{'name':_0x3e0a74,'userProfileId':_0x53ca5a[_0xa286('0x8a')]},'raw':!![]})[_0xa286('0x20')](function(_0x3f2862){if(_0x3f2862&&_0x3f2862['autoAssociation']===0x0){return db[_0xa286('0x3e')][_0xa286('0x6f')]({'name':_0x3d8cf8[_0xa286('0x3d')],'resourceId':_0x3d8cf8['id'],'type':_0x3f2862[_0xa286('0x3d')],'sectionId':_0x3f2862['id']},{})[_0xa286('0x20')](function(){return _0x286e19;});}else{return _0x286e19;}})['catch'](function(_0x1c5318){logger[_0xa286('0x27')](_0xa286('0x8b'),_0x1c5318);throw _0x1c5318;});}return _0x286e19;})[_0xa286('0x20')](respondWithResult(_0xe77c10,0xc9))[_0xa286('0x60')](handleError(_0xe77c10,null));};exports[_0xa286('0x8c')]=function(_0x3f8e4c,_0x352893,_0x1d7970){var _0x26f95b=![];if(_0x3f8e4c[_0xa286('0x65')]['id']){delete _0x3f8e4c[_0xa286('0x65')]['id'];}return db['Setting'][_0xa286('0x8d')]({'attributes':['id','securePassword']})[_0xa286('0x20')](function(_0x3185e4){_0x26f95b=_0x3185e4[_0xa286('0x72')];return db[_0xa286('0x43')][_0xa286('0x63')]({'where':{'id':_0x3f8e4c['params']['id']}});})['then'](function(_0x509543){if(_0x509543){if(_0x509543['id']==_0x3f8e4c['user']['id']){if(!_0x3f8e4c[_0xa286('0x65')][_0xa286('0x8e')]||!_0x3f8e4c[_0xa286('0x65')]['newPassword']){throw new db['Sequelize'][(_0xa286('0x1d'))](_0xa286('0x8f'));}if(!_0x509543[_0xa286('0x90')](_0x3f8e4c[_0xa286('0x65')][_0xa286('0x8e')])){throw new db['Sequelize'][(_0xa286('0x1d'))](_0xa286('0x91'));}if(_0x3f8e4c[_0xa286('0x65')][_0xa286('0x8e')]==_0x3f8e4c[_0xa286('0x65')][_0xa286('0x92')]){throw new db[(_0xa286('0x1c'))][(_0xa286('0x1d'))](_0xa286('0x93'));}return _0x509543;}else if(_0x3f8e4c[_0xa286('0x35')][_0xa286('0x3c')]==_0xa286('0x6a')){if(!_0x3f8e4c[_0xa286('0x65')][_0xa286('0x92')]){throw new db[(_0xa286('0x1c'))][(_0xa286('0x1d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x509543;}else if(_0x3f8e4c[_0xa286('0x35')][_0xa286('0x3c')]==_0xa286('0x35')){if(!_0x3f8e4c[_0xa286('0x65')][_0xa286('0x92')]){throw new db[(_0xa286('0x1c'))][(_0xa286('0x1d'))](_0xa286('0x94'));}if(_0x509543['role']!='agent'){throw new db[(_0xa286('0x1c'))][(_0xa286('0x1d'))](_0xa286('0x95'));}return _0x509543;}else{throw new db[(_0xa286('0x1c'))][(_0xa286('0x1d'))](_0xa286('0x95'));}}return null;})[_0xa286('0x20')](handleEntityNotFound(_0x352893,null))['then'](function(_0x172ee1){return checkPasswordPattern(_0x172ee1,_0x3f8e4c[_0xa286('0x65')][_0xa286('0x92')],_0x26f95b);})['then'](saveUpdates({'password':_0x3f8e4c[_0xa286('0x65')][_0xa286('0x92')],'passwordResetAt':_0x3f8e4c['user']['id']==_0x3f8e4c[_0xa286('0x61')]['id']?moment():null},null))[_0xa286('0x20')](respondWithResult(_0x352893,null))[_0xa286('0x60')](handleError(_0x352893,null));};exports[_0xa286('0x96')]=function(_0x22f094,_0x18bbed,_0x474cca){var _0x41c871=_0x22f094['body']['channel'];return db[_0xa286('0x43')][_0xa286('0x63')]({'where':{'id':_0x22f094[_0xa286('0x61')]['id']},'attributes':['id',_0xa286('0x3d'),_0xa286('0x3c'),_0xa286('0x97'),_0xa286('0x98'),_0xa286('0x99'),'interface']})[_0xa286('0x20')](handleEntityNotFound(_0x18bbed,null))[_0xa286('0x20')](function(_0x488269){if(_0x488269){if(!utils['isValidChannel'](_0x41c871)){throw new db['Sequelize'][(_0xa286('0x1d'))](_0xa286('0x9a'));}return _0x488269[_0xa286('0x9b')+_['capitalize'](_0x41c871[_0xa286('0x9c')]())+_0xa286('0x9d')](_0x22f094['body'][_0xa286('0x68')],{'penalty':_0x22f094['body'][_0xa286('0x9e')]||0x0})[_0xa286('0x9f')](function(_0x57359c){for(var _0x39824a=0x0;_0x39824a<_0x22f094[_0xa286('0x65')][_0xa286('0x68')][_0xa286('0x62')];_0x39824a+=0x1){var _0x1f5ea1={'UserId':_0x22f094[_0xa286('0x61')]['id']};_0x1f5ea1[_['capitalize'](_0x41c871[_0xa286('0x9c')]())+'QueueId']=_0x22f094[_0xa286('0x65')][_0xa286('0x68')][_0x39824a];socket['emit'](_0xa286('0x35')+_[_0xa286('0xa0')](_0x41c871[_0xa286('0x9c')]())+'Queue:save',_0x1f5ea1);}return _0x57359c;})[_0xa286('0x20')](function(){if(_0x41c871===_0xa286('0xa1')){return db[_0xa286('0xa2')][_0xa286('0x5e')]({'where':{'id':_0x22f094[_0xa286('0x65')][_0xa286('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x20eeb4){var _0x6c3af3=_0x488269[_0xa286('0x86')]({'plain':!![]});var _0x474bb1=[];if(_0x41c871===_0xa286('0xa1')&&_0x6c3af3[_0xa286('0x3c')]===_0xa286('0x37')&&_0x6c3af3[_0xa286('0x97')]){for(var _0x2ca009=0x0;_0x2ca009<_0x20eeb4[_0xa286('0x62')];_0x2ca009+=0x1){_0x474bb1[_0xa286('0xa3')]({'membername':_0x6c3af3[_0xa286('0x3d')],'UserId':_0x6c3af3['id'],'queue_name':_0x20eeb4[_0x2ca009][_0xa286('0x3d')],'VoiceQueueId':_0x20eeb4[_0x2ca009]['id'],'interface':_[_0xa286('0x6e')](_0x6c3af3[_0xa286('0xa4')])?util[_0xa286('0xa5')](_0xa286('0xa6'),_0x6c3af3[_0xa286('0x3d')]):_0x6c3af3['interface'],'paused':_0x6c3af3[_0xa286('0x99')]||![],'penalty':_0x22f094[_0xa286('0x65')][_0xa286('0x9e')]||0x0});}return BPromise['each'](_0x474bb1,function(_0x4bd837){return db[_0xa286('0xa7')][_0xa286('0xa8')](_0x4bd837);});}return _0x488269;});}})[_0xa286('0x20')](respondWithStatusCode(_0x18bbed,null))[_0xa286('0x60')](handleError(_0x18bbed,null));};exports[_0xa286('0xa9')]=function(_0x1d3e65,_0x53d9b7,_0x94d66f){var _0x3886d0;return db[_0xa286('0x43')][_0xa286('0x63')]({'where':{'id':_0x1d3e65[_0xa286('0x61')]['id']},'attributes':['id',_0xa286('0x3d'),_0xa286('0x3c')]})[_0xa286('0x20')](handleEntityNotFound(_0x53d9b7,null))[_0xa286('0x20')](function(_0x11c60e){if(_0x11c60e){_0x3886d0=_0x11c60e;if(!_0x1d3e65[_0xa286('0x4a')]['channel']||!utils[_0xa286('0xaa')](_0x1d3e65[_0xa286('0x4a')]['channel'])){throw new db[(_0xa286('0x1c'))][(_0xa286('0x1d'))](_0xa286('0x9a'));}return _0x11c60e[_0xa286('0xab')+_[_0xa286('0xa0')](_0x1d3e65['query'][_0xa286('0xac')][_0xa286('0x9c')]())+_0xa286('0x9d')](_0x1d3e65[_0xa286('0x4a')][_0xa286('0x68')]);}})[_0xa286('0x20')](function(_0x1bb1f0){for(var _0x450262=0x0;_0x450262<_0x1d3e65['query'][_0xa286('0x68')][_0xa286('0x62')];_0x450262+=0x1){var _0x5479ec={'UserId':_0x1d3e65[_0xa286('0x61')]['id']};_0x5479ec[_['capitalize'](_0x1d3e65[_0xa286('0x4a')][_0xa286('0xac')][_0xa286('0x9c')]())+'QueueId']=_0x1d3e65['query'][_0xa286('0x68')][_0x450262];socket[_0xa286('0xad')](_0xa286('0x35')+_[_0xa286('0xa0')](_0x1d3e65[_0xa286('0x4a')]['channel'][_0xa286('0x9c')]())+'Queue:remove',_0x5479ec);}return _0x1bb1f0;})[_0xa286('0x20')](function(){if(_0x1d3e65[_0xa286('0x4a')][_0xa286('0xac')]==='voice'){return db['UserVoiceQueueRt'][_0xa286('0x33')]({'where':{'UserId':_0x1d3e65[_0xa286('0x61')]['id'],'VoiceQueueId':_0x1d3e65['query'][_0xa286('0x68')]},'individualHooks':!![]})['then'](function(){return _0x3886d0;});}return _0x3886d0;})[_0xa286('0x20')](respondWithStatusCode(_0x53d9b7,null))[_0xa286('0x60')](handleError(_0x53d9b7,null));};exports[_0xa286('0xae')]=function(_0x3b60f1,_0x5a8b7a,_0x19f14b){_0x3b60f1[_0xa286('0x65')]['userpic']=_0x3b60f1[_0xa286('0xaf')][_0xa286('0xb0')];return db['User']['find']({'where':{'id':_0x3b60f1[_0xa286('0x61')]['id']}})['then'](handleEntityNotFound(_0x5a8b7a,null))[_0xa286('0x20')](saveUpdates(_0x3b60f1['body'],null))[_0xa286('0x20')](respondWithResult(_0x5a8b7a,null))[_0xa286('0x60')](handleError(_0x5a8b7a,null));};exports[_0xa286('0xb1')]=function(_0x9ecdb5,_0x2c1384,_0x5ca315){var _0x3080c3=path[_0xa286('0xb2')](config[_0xa286('0xb3')],_0xa286('0xb4'));return db[_0xa286('0x43')][_0xa286('0x63')]({'where':{'id':_0x9ecdb5[_0xa286('0x61')]['id']},'attributes':['id',_0xa286('0xb5')],'raw':!![]})[_0xa286('0x20')](handleEntityNotFound(_0x2c1384,null))[_0xa286('0x20')](function(_0x312307){if(_0x312307){if(_[_0xa286('0x6e')](_0x312307[_0xa286('0xb5')])){return _0x2c1384['download'](_0x3080c3);}else{if(!fs[_0xa286('0xb6')](path[_0xa286('0xb2')](config[_0xa286('0xb3')],_0xa286('0xb7'),_0x312307[_0xa286('0xb5')]))){return _0x2c1384['download'](_0x3080c3);}return _0x2c1384['download'](path['join'](config[_0xa286('0xb3')],_0xa286('0xb7'),_0x312307[_0xa286('0xb5')]));}}})[_0xa286('0x60')](handleError(_0x2c1384,null));};exports['getContacts']=function(_0x1d5539,_0x5b1850,_0xe3cdb1){var _0x273046={};var _0x283eb3={};var _0x706b07;var _0x3089cc;return db[_0xa286('0x43')]['findOne']({'where':{'id':_0x1d5539[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x5b1850,null))[_0xa286('0x20')](function(_0x412b91){if(_0x412b91){_0x706b07=_0x412b91;_0x283eb3['model']=_[_0xa286('0x4b')](db[_0xa286('0xb8')][_0xa286('0x44')]);_0x283eb3[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x1d5539[_0xa286('0x4a')]);_0x283eb3[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x283eb3[_0xa286('0x46')],_0x283eb3[_0xa286('0x4a')]);_0x273046[_0xa286('0x4f')]=_[_0xa286('0x4d')](_0x283eb3[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x1d5539['query']['fields']));_0x273046[_0xa286('0x4f')]=_0x273046[_0xa286('0x4f')][_0xa286('0x62')]?_0x273046[_0xa286('0x4f')]:_0x283eb3[_0xa286('0x46')];_0x273046[_0xa286('0x53')]=qs['sort'](_0x1d5539[_0xa286('0x4a')]['sort']);_0x273046[_0xa286('0x55')]=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x1d5539['query'],_0x283eb3[_0xa286('0x4c')]));if(_0x1d5539[_0xa286('0x4a')]['filter']){_0x273046['where']=_['merge'](_0x273046[_0xa286('0x55')],{'$or':_[_0xa286('0x42')](_0x273046[_0xa286('0x4f')],function(_0x1ddb1f){var _0x506091={};_0x506091[_0x1ddb1f]={'$like':'%'+_0x1d5539[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x506091;})});}_0x273046=_['merge']({},_0x273046,_0x1d5539[_0xa286('0x5b')]);return _0x706b07[_0xa286('0xba')](_0x273046);}})[_0xa286('0x20')](function(_0x5cab6e){if(_0x5cab6e){_0x3089cc=_0x5cab6e[_0xa286('0x62')];if(_0x1d5539[_0xa286('0x4a')][_0xa286('0x50')]('includeAll')){_0x273046[_0xa286('0x5d')]=[{'model':db['CmList'],'as':_0xa286('0xbb'),'required':![]},{'model':db[_0xa286('0xbc')],'as':_0xa286('0xbd'),'attributes':['id',_0xa286('0x3d'),_0xa286('0xbe')],'where':_0x1d5539['query'][_0xa286('0xbf')]?{'id':_0x1d5539['query'][_0xa286('0xbf')]}:undefined,'required':_0x1d5539[_0xa286('0x4a')]['tag']?!![]:![]}];}if(!_0x1d5539['query'][_0xa286('0x50')](_0xa286('0x51'))){_0x273046[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x1d5539[_0xa286('0x4a')][_0xa286('0x52')]);_0x273046[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x1d5539[_0xa286('0x4a')][_0xa286('0x2d')]);}return _0x706b07[_0xa286('0xba')](_0x273046);}})['then'](function(_0x49f360){if(_0x49f360){return _0x49f360?{'count':_0x3089cc,'rows':_0x49f360}:null;}})['then'](respondWithResult(_0x5b1850,null))['catch'](handleError(_0x5b1850,null));};exports[_0xa286('0xc0')]=function(_0x19f80d,_0x3b2013,_0x1f1192){var _0x30934f;var _0x876e0c;var _0x9737a5={};var _0x198763;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x19f80d[_0xa286('0x61')]['id']},'attributes':['id',_0xa286('0x3d'),_0xa286('0x3c')]})['then'](handleEntityNotFound(_0x3b2013,null))[_0xa286('0x20')](function(_0x391354){if(!utils[_0xa286('0xaa')](_0x19f80d['query'][_0xa286('0xac')])){throw new db['Sequelize'][(_0xa286('0x1d'))](_0xa286('0x9a'));}_0x30934f=_0x391354;var _0x543c5e={};_0x543c5e[_0xa286('0x46')]=_[_0xa286('0x4b')](db[_[_0xa286('0xa0')](_0x19f80d['query'][_0xa286('0xac')])+'Queue']['rawAttributes']);_0x543c5e['query']=_[_0xa286('0x4b')](_0x19f80d[_0xa286('0x4a')]);_0x543c5e[_0xa286('0x4c')]=_['intersection'](_0x543c5e[_0xa286('0x46')],_0x543c5e[_0xa286('0x4a')]);_0x9737a5['attributes']=_['intersection'](_0x543c5e[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x19f80d[_0xa286('0x4a')][_0xa286('0x4e')]));_0x9737a5[_0xa286('0x4f')]=_0x9737a5['attributes'][_0xa286('0x62')]?_0x9737a5[_0xa286('0x4f')]:_0x543c5e[_0xa286('0x46')];_0x9737a5[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x19f80d[_0xa286('0x4a')]['sort']);_0x9737a5['where']=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x19f80d[_0xa286('0x4a')],_0x543c5e[_0xa286('0x4c')]));if(_0x19f80d[_0xa286('0x4a')][_0xa286('0x39')]){_0x9737a5[_0xa286('0x55')]=_[_0xa286('0x56')](_0x9737a5['where'],{'$or':_[_0xa286('0x42')](_0x9737a5['attributes'],function(_0x4dffef){var _0x10de03={};_0x10de03[_0x4dffef]={'$like':'%'+_0x19f80d[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x10de03;})});}_0x9737a5=_[_0xa286('0x56')]({},_0x9737a5,_0x19f80d[_0xa286('0x5b')]);switch(_0x30934f[_0xa286('0x3c')]){case _0xa286('0x6a'):return db[_[_0xa286('0xa0')](_0x19f80d[_0xa286('0x4a')]['channel'])+_0xa286('0xc1')]['findAll'](_0x9737a5);case _0xa286('0x35'):case _0xa286('0x37'):return _0x30934f[_0xa286('0x86')+_[_0xa286('0xa0')](_0x19f80d[_0xa286('0x4a')][_0xa286('0xac')])+_0xa286('0x9d')](_0x9737a5);default:throw new db[(_0xa286('0x1c'))]['ValidationError'](_0xa286('0xc2'));}})[_0xa286('0x20')](function(_0x521426){_0x198763=_0x521426['length'];if(!_0x19f80d['query'][_0xa286('0x50')]('nolimit')){_0x9737a5[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x19f80d[_0xa286('0x4a')][_0xa286('0x52')]);_0x9737a5[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x19f80d[_0xa286('0x4a')][_0xa286('0x2d')]);}switch(_0x30934f[_0xa286('0x3c')]){case _0xa286('0x6a'):return db[_[_0xa286('0xa0')](_0x19f80d[_0xa286('0x4a')][_0xa286('0xac')])+'Queue'][_0xa286('0x5e')](_0x9737a5);case'user':case _0xa286('0x37'):return _0x30934f[_0xa286('0x86')+_[_0xa286('0xa0')](_0x19f80d[_0xa286('0x4a')]['channel'])+'Queues'](_0x9737a5);}})[_0xa286('0x20')](function(_0x43683d){return{'count':_0x198763,'rows':_0x43683d};})['then'](respondWithResult(_0x3b2013,null))[_0xa286('0x60')](handleError(_0x3b2013,null));};exports[_0xa286('0xc3')]=function(_0x564122,_0x16c7aa,_0x2bf1ad){var _0x453757={};var _0x33efb8={};var _0x20ad49;var _0x1a0b8b;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x564122[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x16c7aa,null))[_0xa286('0x20')](function(_0x16f228){if(_0x16f228){_0x20ad49=_0x16f228;_0x33efb8[_0xa286('0x46')]=_[_0xa286('0x4b')](db[_0xa286('0xa7')][_0xa286('0x44')]);_0x33efb8['query']=_[_0xa286('0x4b')](_0x564122[_0xa286('0x4a')]);_0x33efb8[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x33efb8[_0xa286('0x46')],_0x33efb8[_0xa286('0x4a')]);_0x453757['attributes']=_[_0xa286('0x4d')](_0x33efb8[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x564122[_0xa286('0x4a')][_0xa286('0x4e')]));_0x453757['attributes']=_0x453757[_0xa286('0x4f')][_0xa286('0x62')]?_0x453757[_0xa286('0x4f')]:_0x33efb8['model'];_0x453757['order']=qs[_0xa286('0x54')](_0x564122[_0xa286('0x4a')][_0xa286('0x54')]);_0x453757[_0xa286('0x55')]=qs[_0xa286('0x4c')](_['pick'](_0x564122[_0xa286('0x4a')],_0x33efb8['filters']));if(_0x564122[_0xa286('0x4a')]['filter']){_0x453757[_0xa286('0x55')]=_[_0xa286('0x56')](_0x453757['where'],{'$or':_[_0xa286('0x42')](_0x453757[_0xa286('0x4f')],function(_0x503310){var _0x563ec1={};_0x563ec1[_0x503310]={'$like':'%'+_0x564122[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x563ec1;})});}_0x453757=_[_0xa286('0x56')]({},_0x453757,_0x564122[_0xa286('0x5b')]);return _0x20ad49[_0xa286('0xc3')](_0x453757);}})['then'](function(_0x2cda1f){if(_0x2cda1f){_0x1a0b8b=_0x2cda1f[_0xa286('0x62')];if(!_0x564122[_0xa286('0x4a')][_0xa286('0x50')]('nolimit')){_0x453757[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x564122['query'][_0xa286('0x52')]);_0x453757[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x564122['query']['offset']);}return _0x20ad49['getVoiceQueuesRt'](_0x453757);}})['then'](function(_0x4057f0){if(_0x4057f0){return _0x4057f0?{'count':_0x1a0b8b,'rows':_0x4057f0}:null;}})[_0xa286('0x20')](respondWithResult(_0x16c7aa,null))[_0xa286('0x60')](handleError(_0x16c7aa,null));};exports[_0xa286('0xc4')]=function(_0x19c2cc,_0x412216,_0xfcf49a){var _0x5afb00={};var _0x5b5e56={};var _0x2747d8;var _0x1944bf;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x19c2cc[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x412216,null))[_0xa286('0x20')](function(_0x2fd474){if(_0x2fd474){_0x2747d8=_0x2fd474;_0x5b5e56[_0xa286('0x46')]=_[_0xa286('0x4b')](db['ChatGroup']['rawAttributes']);_0x5b5e56[_0xa286('0x4a')]=_['keys'](_0x19c2cc['query']);_0x5b5e56[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x5b5e56[_0xa286('0x46')],_0x5b5e56[_0xa286('0x4a')]);_0x5afb00[_0xa286('0x4f')]=_['intersection'](_0x5b5e56[_0xa286('0x46')],qs['fields'](_0x19c2cc[_0xa286('0x4a')][_0xa286('0x4e')]));_0x5afb00[_0xa286('0x4f')]=_0x5afb00[_0xa286('0x4f')][_0xa286('0x62')]?_0x5afb00[_0xa286('0x4f')]:_0x5b5e56[_0xa286('0x46')];_0x5afb00['order']=qs[_0xa286('0x54')](_0x19c2cc['query'][_0xa286('0x54')]);_0x5afb00[_0xa286('0x55')]=qs['filters'](_[_0xa286('0xb9')](_0x19c2cc[_0xa286('0x4a')],_0x5b5e56[_0xa286('0x4c')]));if(_0x19c2cc[_0xa286('0x4a')][_0xa286('0x39')]){_0x5afb00[_0xa286('0x55')]=_[_0xa286('0x56')](_0x5afb00['where'],{'$or':_['map'](_0x5afb00[_0xa286('0x4f')],function(_0x24681c){var _0x579472={};_0x579472[_0x24681c]={'$like':'%'+_0x19c2cc[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x579472;})});}_0x5afb00=_[_0xa286('0x56')]({},_0x5afb00,_0x19c2cc['options']);return _0x2747d8[_0xa286('0xc4')](_0x5afb00);}})['then'](function(_0x2c85cc){if(_0x2c85cc){_0x1944bf=_0x2c85cc[_0xa286('0x62')];if(!_0x19c2cc['query'][_0xa286('0x50')]('nolimit')){_0x5afb00[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x19c2cc[_0xa286('0x4a')][_0xa286('0x52')]);_0x5afb00[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x19c2cc[_0xa286('0x4a')]['offset']);}return _0x2747d8['getGroups'](_0x5afb00);}})[_0xa286('0x20')](function(_0x21ffdd){if(_0x21ffdd){return _0x21ffdd?{'count':_0x1944bf,'rows':_0x21ffdd}:null;}})[_0xa286('0x20')](respondWithResult(_0x412216,null))['catch'](handleError(_0x412216,null));};exports[_0xa286('0xc5')]=function(_0x335773,_0x5e695f,_0x336f59){var _0xb483f9={'raw':!![],'where':{}};var _0x25fbc0={};var _0x579c78={'count':0x0,'rows':[]};return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x335773[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x5e695f,null))[_0xa286('0x20')](function(_0x54e9e9){if(_0x54e9e9){_0x25fbc0[_0xa286('0x46')]=_['keys'](db[_0xa286('0xc6')][_0xa286('0x44')]);_0x25fbc0[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x335773[_0xa286('0x4a')]);_0x25fbc0[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x25fbc0[_0xa286('0x46')],_0x25fbc0[_0xa286('0x4a')]);_0xb483f9['attributes']=_[_0xa286('0x4d')](_0x25fbc0[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x335773[_0xa286('0x4a')][_0xa286('0x4e')]));_0xb483f9[_0xa286('0x4f')]=_0xb483f9[_0xa286('0x4f')][_0xa286('0x62')]?_0xb483f9[_0xa286('0x4f')]:_0x25fbc0['model'];if(!_0x335773['query']['hasOwnProperty']('nolimit')){_0xb483f9[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x335773['query'][_0xa286('0x52')]);_0xb483f9[_0xa286('0x2d')]=qs['offset'](_0x335773[_0xa286('0x4a')]['offset']);}_0xb483f9[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x335773[_0xa286('0x4a')][_0xa286('0x54')]);_0xb483f9[_0xa286('0x55')]=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x335773[_0xa286('0x4a')],_0x25fbc0[_0xa286('0x4c')]));_0xb483f9[_0xa286('0x55')][_0xa286('0xc7')]=_0x54e9e9['id'];if(_0x335773[_0xa286('0x4a')][_0xa286('0x39')]){_0xb483f9[_0xa286('0x55')]=_['merge'](_0xb483f9[_0xa286('0x55')],{'$or':_[_0xa286('0x42')](_0xb483f9['attributes'],function(_0x29086c){var _0x12490c={};_0x12490c[_0x29086c]={'$like':'%'+_0x335773[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x12490c;})});}_0xb483f9=_[_0xa286('0x56')]({},_0xb483f9,_0x335773['options']);return db['VoiceRecording'][_0xa286('0x2c')]({'where':_0xb483f9[_0xa286('0x55')]})[_0xa286('0x20')](function(_0x1a5899){_0x579c78['count']=_0x1a5899;if(_0x335773[_0xa286('0x4a')][_0xa286('0x5c')]){_0xb483f9[_0xa286('0x5d')]=[{'all':!![]}];}return db[_0xa286('0xc6')][_0xa286('0x5e')](_0xb483f9);})[_0xa286('0x20')](function(_0x43ac90){_0x579c78[_0xa286('0x5f')]=_0x43ac90;return _0x579c78;});}})[_0xa286('0x20')](respondWithFilteredResult(_0x5e695f,_0xb483f9))[_0xa286('0x60')](handleError(_0x5e695f,null));};exports[_0xa286('0xc8')]=function(_0x502d54,_0x466bae,_0x42312d){var _0x5679de={'raw':!![],'where':{}};var _0x2f9646={};var _0xf2ade={'count':0x0,'rows':[]};return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x502d54[_0xa286('0x61')]['id']}})['then'](handleEntityNotFound(_0x466bae,null))[_0xa286('0x20')](function(_0x20aebe){if(_0x20aebe){_0x2f9646[_0xa286('0x46')]=_['keys'](db[_0xa286('0xc9')]['rawAttributes']);_0x2f9646['query']=_[_0xa286('0x4b')](_0x502d54[_0xa286('0x4a')]);_0x2f9646['filters']=_['intersection'](_0x2f9646[_0xa286('0x46')],_0x2f9646[_0xa286('0x4a')]);_0x5679de['attributes']=_['intersection'](_0x2f9646['model'],qs[_0xa286('0x4e')](_0x502d54['query'][_0xa286('0x4e')]));_0x5679de[_0xa286('0x4f')]=_0x5679de[_0xa286('0x4f')][_0xa286('0x62')]?_0x5679de[_0xa286('0x4f')]:_0x2f9646['model'];if(!_0x502d54[_0xa286('0x4a')][_0xa286('0x50')]('nolimit')){_0x5679de[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x502d54['query'][_0xa286('0x52')]);_0x5679de[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x502d54[_0xa286('0x4a')][_0xa286('0x2d')]);}_0x5679de['order']=qs[_0xa286('0x54')](_0x502d54[_0xa286('0x4a')][_0xa286('0x54')]);_0x5679de['where']=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x502d54[_0xa286('0x4a')],_0x2f9646[_0xa286('0x4c')]));_0x5679de[_0xa286('0x55')][_0xa286('0xc7')]=_0x20aebe['id'];if(_0x502d54[_0xa286('0x4a')][_0xa286('0x39')]){_0x5679de[_0xa286('0x55')]=_[_0xa286('0x56')](_0x5679de[_0xa286('0x55')],{'$or':_['map'](_0x5679de['attributes'],function(_0x83bf77){var _0x5a513b={};_0x5a513b[_0x83bf77]={'$like':'%'+_0x502d54[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x5a513b;})});}_0x5679de=_[_0xa286('0x56')]({},_0x5679de,_0x502d54[_0xa286('0x5b')]);return db[_0xa286('0xc9')]['count']({'where':_0x5679de[_0xa286('0x55')]})[_0xa286('0x20')](function(_0x42a5cd){_0xf2ade['count']=_0x42a5cd;if(_0x502d54[_0xa286('0x4a')][_0xa286('0x5c')]){_0x5679de[_0xa286('0x5d')]=[{'all':!![]}];}return db[_0xa286('0xc9')]['findAll'](_0x5679de);})['then'](function(_0x43eb4c){_0xf2ade[_0xa286('0x5f')]=_0x43eb4c;return _0xf2ade;});}})[_0xa286('0x20')](respondWithFilteredResult(_0x466bae,_0x5679de))[_0xa286('0x60')](handleError(_0x466bae,null));};exports[_0xa286('0xca')]=function(_0x35d95c,_0x31c086,_0x4551af){var _0x391f91={};var _0x450ab4={};var _0x5e091f;var _0x49a9fb;return db[_0xa286('0x43')]['findOne']({'where':{'id':_0x35d95c[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x31c086,null))[_0xa286('0x20')](function(_0x582902){if(_0x582902){_0x5e091f=_0x582902;_0x450ab4['model']=_[_0xa286('0x4b')](db['ChatInteraction'][_0xa286('0x44')]);_0x450ab4[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x35d95c[_0xa286('0x4a')]);_0x450ab4[_0xa286('0x4c')]=_['intersection'](_0x450ab4[_0xa286('0x46')],_0x450ab4[_0xa286('0x4a')]);_0x391f91['attributes']=_['intersection'](_0x450ab4[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x35d95c['query'][_0xa286('0x4e')]));_0x391f91[_0xa286('0x4f')]=_0x391f91[_0xa286('0x4f')][_0xa286('0x62')]?_0x391f91[_0xa286('0x4f')]:_0x450ab4[_0xa286('0x46')];_0x391f91[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x35d95c[_0xa286('0x4a')][_0xa286('0x54')]);_0x391f91[_0xa286('0x55')]=qs['filters'](_[_0xa286('0xb9')](_0x35d95c[_0xa286('0x4a')],_0x450ab4[_0xa286('0x4c')]));if(_0x35d95c[_0xa286('0x4a')]['filter']){_0x391f91[_0xa286('0x55')]=_[_0xa286('0x56')](_0x391f91['where'],{'$or':_[_0xa286('0x42')](_0x391f91[_0xa286('0x4f')],function(_0x13b943){var _0x5b6125={};_0x5b6125[_0x13b943]={'$like':'%'+_0x35d95c[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x5b6125;})});}_0x391f91=_[_0xa286('0x56')]({},_0x391f91,_0x35d95c['options']);return _0x5e091f[_0xa286('0xca')](_0x391f91);}})[_0xa286('0x20')](function(_0x5714eb){if(_0x5714eb){_0x49a9fb=_0x5714eb[_0xa286('0x62')];if(!_0x35d95c[_0xa286('0x4a')][_0xa286('0x50')](_0xa286('0x51'))){_0x391f91[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x35d95c['query'][_0xa286('0x52')]);_0x391f91[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x35d95c[_0xa286('0x4a')][_0xa286('0x2d')]);}return _0x5e091f[_0xa286('0xca')](_0x391f91);}})[_0xa286('0x20')](function(_0x15de65){if(_0x15de65){return _0x15de65?{'count':_0x49a9fb,'rows':_0x15de65}:null;}})[_0xa286('0x20')](respondWithResult(_0x31c086,null))['catch'](handleError(_0x31c086,null));};exports[_0xa286('0xcb')]=function(_0x5752c3,_0x18a1df,_0xba8d32){var _0x2f30b7={};var _0x2d58e8={};var _0x58054a;var _0x1141c4;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x5752c3[_0xa286('0x61')]['id']}})['then'](handleEntityNotFound(_0x18a1df,null))[_0xa286('0x20')](function(_0xe6bd8){if(_0xe6bd8){_0x58054a=_0xe6bd8;_0x2d58e8['model']=_[_0xa286('0x4b')](db['OpenchannelInteraction'][_0xa286('0x44')]);_0x2d58e8[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x5752c3[_0xa286('0x4a')]);_0x2d58e8[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x2d58e8[_0xa286('0x46')],_0x2d58e8[_0xa286('0x4a')]);_0x2f30b7[_0xa286('0x4f')]=_[_0xa286('0x4d')](_0x2d58e8[_0xa286('0x46')],qs['fields'](_0x5752c3[_0xa286('0x4a')]['fields']));_0x2f30b7[_0xa286('0x4f')]=_0x2f30b7[_0xa286('0x4f')][_0xa286('0x62')]?_0x2f30b7['attributes']:_0x2d58e8[_0xa286('0x46')];_0x2f30b7[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x5752c3[_0xa286('0x4a')][_0xa286('0x54')]);_0x2f30b7[_0xa286('0x55')]=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x5752c3[_0xa286('0x4a')],_0x2d58e8[_0xa286('0x4c')]));if(_0x5752c3[_0xa286('0x4a')][_0xa286('0x39')]){_0x2f30b7['where']=_[_0xa286('0x56')](_0x2f30b7['where'],{'$or':_['map'](_0x2f30b7[_0xa286('0x4f')],function(_0xd6834){var _0xd531e0={};_0xd531e0[_0xd6834]={'$like':'%'+_0x5752c3[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0xd531e0;})});}_0x2f30b7=_[_0xa286('0x56')]({},_0x2f30b7,_0x5752c3['options']);return _0x58054a[_0xa286('0xcb')](_0x2f30b7);}})['then'](function(_0x432db5){if(_0x432db5){_0x1141c4=_0x432db5[_0xa286('0x62')];if(!_0x5752c3[_0xa286('0x4a')][_0xa286('0x50')]('nolimit')){_0x2f30b7[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x5752c3[_0xa286('0x4a')][_0xa286('0x52')]);_0x2f30b7[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x5752c3[_0xa286('0x4a')]['offset']);}return _0x58054a[_0xa286('0xcb')](_0x2f30b7);}})[_0xa286('0x20')](function(_0xe58dfa){if(_0xe58dfa){return _0xe58dfa?{'count':_0x1141c4,'rows':_0xe58dfa}:null;}})[_0xa286('0x20')](respondWithResult(_0x18a1df,null))['catch'](handleError(_0x18a1df,null));};exports[_0xa286('0xcc')]=function(_0x5b1c9a,_0x449261,_0x109535){var _0x47dea1={'raw':!![],'where':{}};var _0x14084c={};var _0x309748={'count':0x0,'rows':[]};return db[_0xa286('0x43')]['findOne']({'where':{'id':_0x5b1c9a[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x449261,null))[_0xa286('0x20')](function(_0x599760){if(_0x599760){_0x14084c['model']=_[_0xa286('0x4b')](db[_0xa286('0xcd')][_0xa286('0x44')]);_0x14084c[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x5b1c9a[_0xa286('0x4a')]);_0x14084c[_0xa286('0x4c')]=_['intersection'](_0x14084c['model'],_0x14084c[_0xa286('0x4a')]);_0x47dea1[_0xa286('0x4f')]=_[_0xa286('0x4d')](_0x14084c['model'],qs['fields'](_0x5b1c9a['query'][_0xa286('0x4e')]));_0x47dea1[_0xa286('0x4f')]=_0x47dea1[_0xa286('0x4f')][_0xa286('0x62')]?_0x47dea1['attributes']:_0x14084c[_0xa286('0x46')];if(!_0x5b1c9a['query'][_0xa286('0x50')]('nolimit')){_0x47dea1[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x5b1c9a[_0xa286('0x4a')]['limit']);_0x47dea1[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x5b1c9a[_0xa286('0x4a')]['offset']);}_0x47dea1[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x5b1c9a[_0xa286('0x4a')][_0xa286('0x54')]);_0x47dea1['where']=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x5b1c9a[_0xa286('0x4a')],_0x14084c['filters']));_0x47dea1[_0xa286('0x55')]['UserId']=_0x599760['id'];if(_0x5b1c9a['query'][_0xa286('0x39')]){_0x47dea1[_0xa286('0x55')]=_[_0xa286('0x56')](_0x47dea1[_0xa286('0x55')],{'$or':_[_0xa286('0x42')](_0x47dea1[_0xa286('0x4f')],function(_0x57ea64){var _0x20892c={};_0x20892c[_0x57ea64]={'$like':'%'+_0x5b1c9a[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x20892c;})});}_0x47dea1=_[_0xa286('0x56')]({},_0x47dea1,_0x5b1c9a[_0xa286('0x5b')]);return db['MailInteraction']['count']({'where':_0x47dea1[_0xa286('0x55')]})['then'](function(_0x3aeeb0){_0x309748[_0xa286('0x2c')]=_0x3aeeb0;if(_0x5b1c9a[_0xa286('0x4a')][_0xa286('0x5c')]){_0x47dea1[_0xa286('0x5d')]=[{'all':!![]}];}return db[_0xa286('0xcd')][_0xa286('0x5e')](_0x47dea1);})[_0xa286('0x20')](function(_0x4d5b33){_0x309748[_0xa286('0x5f')]=_0x4d5b33;return _0x309748;});}})[_0xa286('0x20')](respondWithFilteredResult(_0x449261,_0x47dea1))['catch'](handleError(_0x449261,null));};exports['getSmsInteractions']=function(_0x5dd4bd,_0x106db7,_0xe1a188){var _0x1f4424={};var _0x14144c={};var _0x262833;var _0x4edf69;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x5dd4bd[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x106db7,null))['then'](function(_0x3489c2){if(_0x3489c2){_0x262833=_0x3489c2;_0x14144c[_0xa286('0x46')]=_[_0xa286('0x4b')](db[_0xa286('0xce')]['rawAttributes']);_0x14144c['query']=_[_0xa286('0x4b')](_0x5dd4bd[_0xa286('0x4a')]);_0x14144c[_0xa286('0x4c')]=_['intersection'](_0x14144c['model'],_0x14144c[_0xa286('0x4a')]);_0x1f4424[_0xa286('0x4f')]=_[_0xa286('0x4d')](_0x14144c[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x5dd4bd[_0xa286('0x4a')][_0xa286('0x4e')]));_0x1f4424['attributes']=_0x1f4424[_0xa286('0x4f')][_0xa286('0x62')]?_0x1f4424[_0xa286('0x4f')]:_0x14144c[_0xa286('0x46')];_0x1f4424[_0xa286('0x53')]=qs['sort'](_0x5dd4bd[_0xa286('0x4a')][_0xa286('0x54')]);_0x1f4424['where']=qs[_0xa286('0x4c')](_['pick'](_0x5dd4bd[_0xa286('0x4a')],_0x14144c[_0xa286('0x4c')]));if(_0x5dd4bd[_0xa286('0x4a')]['filter']){_0x1f4424[_0xa286('0x55')]=_[_0xa286('0x56')](_0x1f4424[_0xa286('0x55')],{'$or':_['map'](_0x1f4424[_0xa286('0x4f')],function(_0x14b554){var _0x2b1c0c={};_0x2b1c0c[_0x14b554]={'$like':'%'+_0x5dd4bd[_0xa286('0x4a')]['filter']+'%'};return _0x2b1c0c;})});}_0x1f4424=_[_0xa286('0x56')]({},_0x1f4424,_0x5dd4bd[_0xa286('0x5b')]);return _0x262833[_0xa286('0xcf')](_0x1f4424);}})[_0xa286('0x20')](function(_0x4f984e){if(_0x4f984e){_0x4edf69=_0x4f984e['length'];if(!_0x5dd4bd['query'][_0xa286('0x50')]('nolimit')){_0x1f4424[_0xa286('0x52')]=qs['limit'](_0x5dd4bd[_0xa286('0x4a')]['limit']);_0x1f4424[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x5dd4bd['query'][_0xa286('0x2d')]);}return _0x262833[_0xa286('0xcf')](_0x1f4424);}})['then'](function(_0x5aa9e4){if(_0x5aa9e4){return _0x5aa9e4?{'count':_0x4edf69,'rows':_0x5aa9e4}:null;}})[_0xa286('0x20')](respondWithResult(_0x106db7,null))[_0xa286('0x60')](handleError(_0x106db7,null));};exports[_0xa286('0xd0')]=function(_0x382fdc,_0x270f6f,_0x115134){var _0x499975={};var _0x582456={};var _0x1c0b6d;var _0x1b3dfc;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x382fdc[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x270f6f,null))[_0xa286('0x20')](function(_0x5039e6){if(_0x5039e6){_0x1c0b6d=_0x5039e6;_0x582456[_0xa286('0x46')]=_[_0xa286('0x4b')](db[_0xa286('0xd1')][_0xa286('0x44')]);_0x582456[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x382fdc[_0xa286('0x4a')]);_0x582456[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x582456[_0xa286('0x46')],_0x582456[_0xa286('0x4a')]);_0x499975[_0xa286('0x4f')]=_[_0xa286('0x4d')](_0x582456['model'],qs[_0xa286('0x4e')](_0x382fdc[_0xa286('0x4a')][_0xa286('0x4e')]));_0x499975[_0xa286('0x4f')]=_0x499975[_0xa286('0x4f')]['length']?_0x499975[_0xa286('0x4f')]:_0x582456[_0xa286('0x46')];_0x499975[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x382fdc[_0xa286('0x4a')][_0xa286('0x54')]);_0x499975['where']=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x382fdc[_0xa286('0x4a')],_0x582456[_0xa286('0x4c')]));if(_0x382fdc['query'][_0xa286('0x39')]){_0x499975[_0xa286('0x55')]=_['merge'](_0x499975['where'],{'$or':_[_0xa286('0x42')](_0x499975[_0xa286('0x4f')],function(_0x36c00d){var _0x43441f={};_0x43441f[_0x36c00d]={'$like':'%'+_0x382fdc['query'][_0xa286('0x39')]+'%'};return _0x43441f;})});}_0x499975=_[_0xa286('0x56')]({},_0x499975,_0x382fdc[_0xa286('0x5b')]);return _0x1c0b6d[_0xa286('0xd0')](_0x499975);}})[_0xa286('0x20')](function(_0xc1056e){if(_0xc1056e){_0x1b3dfc=_0xc1056e[_0xa286('0x62')];if(!_0x382fdc[_0xa286('0x4a')][_0xa286('0x50')]('nolimit')){_0x499975['limit']=qs[_0xa286('0x52')](_0x382fdc['query']['limit']);_0x499975[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x382fdc[_0xa286('0x4a')][_0xa286('0x2d')]);}return _0x1c0b6d['getFaxInteractions'](_0x499975);}})['then'](function(_0x3b8096){if(_0x3b8096){return _0x3b8096?{'count':_0x1b3dfc,'rows':_0x3b8096}:null;}})['then'](respondWithResult(_0x270f6f,null))['catch'](handleError(_0x270f6f,null));};exports[_0xa286('0xd2')]=function(_0x292906,_0xe84bb4,_0x3428e9){var _0x308ad9={};var _0x4f258d={};var _0x1eb8c1;var _0x5b15ab;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x292906[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0xe84bb4,null))[_0xa286('0x20')](function(_0x4d37f5){if(_0x4d37f5){_0x1eb8c1=_0x4d37f5;_0x4f258d['model']=_[_0xa286('0x4b')](db[_0xa286('0xd3')][_0xa286('0x44')]);_0x4f258d[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x292906['query']);_0x4f258d['filters']=_[_0xa286('0x4d')](_0x4f258d[_0xa286('0x46')],_0x4f258d[_0xa286('0x4a')]);_0x308ad9[_0xa286('0x4f')]=_['intersection'](_0x4f258d[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x292906[_0xa286('0x4a')]['fields']));_0x308ad9[_0xa286('0x4f')]=_0x308ad9['attributes'][_0xa286('0x62')]?_0x308ad9[_0xa286('0x4f')]:_0x4f258d[_0xa286('0x46')];_0x308ad9[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x292906[_0xa286('0x4a')]['sort']);_0x308ad9[_0xa286('0x55')]=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x292906[_0xa286('0x4a')],_0x4f258d[_0xa286('0x4c')]));if(_0x292906[_0xa286('0x4a')][_0xa286('0x39')]){_0x308ad9[_0xa286('0x55')]=_['merge'](_0x308ad9[_0xa286('0x55')],{'$or':_['map'](_0x308ad9[_0xa286('0x4f')],function(_0xe1b88){var _0x4ddf44={};_0x4ddf44[_0xe1b88]={'$like':'%'+_0x292906[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x4ddf44;})});}_0x308ad9=_[_0xa286('0x56')]({},_0x308ad9,_0x292906[_0xa286('0x5b')]);return _0x1eb8c1[_0xa286('0xd2')](_0x308ad9);}})[_0xa286('0x20')](function(_0x2886ae){if(_0x2886ae){_0x5b15ab=_0x2886ae[_0xa286('0x62')];if(!_0x292906[_0xa286('0x4a')]['hasOwnProperty']('nolimit')){_0x308ad9[_0xa286('0x52')]=qs[_0xa286('0x52')](_0x292906[_0xa286('0x4a')]['limit']);_0x308ad9['offset']=qs[_0xa286('0x2d')](_0x292906[_0xa286('0x4a')][_0xa286('0x2d')]);}return _0x1eb8c1[_0xa286('0xd2')](_0x308ad9);}})[_0xa286('0x20')](function(_0x5bd6b6){if(_0x5bd6b6){return _0x5bd6b6?{'count':_0x5b15ab,'rows':_0x5bd6b6}:null;}})[_0xa286('0x20')](respondWithResult(_0xe84bb4,null))[_0xa286('0x60')](handleError(_0xe84bb4,null));};exports[_0xa286('0xd4')]=function(_0x253ac9,_0x28074d,_0x5d7205){var _0x14ab07;var _0x5d4daa;var _0x1c5111;var _0x2377b7=!_['isNil'](_0x253ac9[_0xa286('0x61')]['id'])?_0x253ac9[_0xa286('0x61')]['id']:!_['isNil'](_0x253ac9[_0xa286('0x35')]['id'])?_0x253ac9[_0xa286('0x35')]['id']:null;return db[_0xa286('0x43')][_0xa286('0x63')]({'where':{'id':_0x2377b7,'role':{'$or':[_0xa286('0x6a'),_0xa286('0x35'),_0xa286('0x37')]}},'attributes':['id',_0xa286('0x3d'),_0xa286('0xd5'),'mobile',_0xa286('0x3c'),_0xa286('0x70'),_0xa286('0x98')]})[_0xa286('0x20')](function(_0x5aab9b){if(_0x5aab9b){if(_0x5aab9b[_0xa286('0x3c')]===_0xa286('0x37')){_0x14ab07=_0x5aab9b;if(_0x253ac9[_0xa286('0x65')][_0xa286('0xa4')]){_0x1c5111=util['format'](_0xa286('0xd6'),_0x14ab07[_0x253ac9['body']['interface']]);}else if(_0x253ac9[_0xa286('0x65')][_0xa286('0xd7')]){_0x1c5111=util[_0xa286('0xa5')]('SIP/%s',_0x253ac9[_0xa286('0x65')][_0xa286('0xd7')]);}else{_0x1c5111=util[_0xa286('0xa5')](_0xa286('0xa6'),_0x14ab07[_0xa286('0x3d')]);}socket['to'](util[_0xa286('0xa5')]('user:%s',_0x14ab07[_0xa286('0x3d')]))[_0xa286('0xad')](_0xa286('0xd8'),{'ip':_0x253ac9['headers']['x-forwarded-for']||_0x253ac9[_0xa286('0xd9')][_0xa286('0xda')]||_0x253ac9[_0xa286('0xdb')][_0xa286('0xda')]||_0x253ac9[_0xa286('0xd9')][_0xa286('0xdb')][_0xa286('0xda')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x14ab07[_0xa286('0x3d')]},'individualHooks':!![]});}}else{throw new db[(_0xa286('0x1c'))][(_0xa286('0x1d'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xa286('0x20')](function(){if(_0x14ab07){return _0x14ab07[_0xa286('0xdc')]({'raw':!![]});}})[_0xa286('0x20')](function(_0x1106af){if(_0x14ab07){var _0x271177=[];if(_0x1106af){_0x5d4daa=_0x1106af;if(_0x5d4daa[_0xa286('0x62')]){for(var _0x421950=0x0;_0x421950<_0x5d4daa['length'];_0x421950++){_0x271177[_0xa286('0xa3')]({'membername':_0x14ab07['name'],'UserId':_0x14ab07['id'],'queue_name':_0x5d4daa[_0x421950][_0xa286('0x3d')],'VoiceQueueId':_0x5d4daa[_0x421950]['id'],'interface':_0x1c5111,'paused':_0x14ab07[_0xa286('0x98')]||![],'penalty':_0x5d4daa[_0x421950][_0xa286('0xdd')]||0x0});}return BPromise[_0xa286('0xde')](_0x271177,function(_0x5cc266){return db['UserVoiceQueueRt'][_0xa286('0xa8')](_0x5cc266);});}}}})[_0xa286('0x20')](function(){if(_0x14ab07){return db['MemberReport'][_0xa286('0x5e')]({'where':{'membername':_0x14ab07[_0xa286('0x3d')],'exitAt':null}});}})['then'](function(_0x3132a6){if(_0x14ab07){var _0x1f9c12=[];_0x3132a6[_0xa286('0xdf')](function(_0x4f68c0){_0x1f9c12[_0xa286('0xa3')](_0x4f68c0['update']({'exitAt':moment()[_0xa286('0xa5')](_0xa286('0xe0'))}));});return BPromise[_0xa286('0xe1')](_0x1f9c12);}})['then'](function(){if(_0x14ab07){var _0xe42dd9=[];var _0x51539f=[];var _0x14de24=utils[_0xa286('0xe2')]();var _0x4bce29={'membername':_0x14ab07[_0xa286('0x3d')],'interface':_0x1c5111,'enterAt':moment()[_0xa286('0xa5')](_0xa286('0xe0')),'role':_0x14ab07['role'],'internal':_0x14ab07['internal']};_0x14de24[_0xa286('0xdf')](function(_0x1d45b5){_0xe42dd9[_0xa286('0xa3')](_['merge']({'channel':_0x1d45b5,'type':'LOGIN','data1':_0x253ac9['body'][_0xa286('0xe3')],'data2':_0x1c5111},_0x4bce29));if(_0x14ab07['loginInPause']){_0x51539f[_0xa286('0xa3')](_['merge']({'channel':_0x1d45b5,'type':'PAUSE','data1':_0xa286('0xe4')},_0x4bce29));}});return db[_0xa286('0xe5')][_0xa286('0x64')](_0xe42dd9[_0xa286('0xe6')](_0x51539f),{'individualHooks':!![]});}})[_0xa286('0x20')](function(){if(_0x14ab07){return _0x14ab07['update']({'online':!![],'lastLoginAt':moment()['format'](_0xa286('0xe0')),'voicePause':_0x14ab07[_0xa286('0x98')]||![],'mailPause':_0x14ab07[_0xa286('0x98')]||![],'chatPause':_0x14ab07[_0xa286('0x98')]||![],'faxPause':_0x14ab07['loginInPause']||![],'smsPause':_0x14ab07[_0xa286('0x98')]||![],'openchannelPause':_0x14ab07[_0xa286('0x98')]||![],'whatsappPause':_0x14ab07['loginInPause']||![],'pauseType':_0x14ab07['loginInPause']?_0xa286('0xe4'):null,'interface':_0x1c5111,'lastPauseAt':moment()[_0xa286('0xa5')](_0xa286('0xe0'))});}})['then'](function(_0x4008e6){if(_0x253ac9[_0xa286('0xe7')]){return _0x5d7205();}else{return BPromise[_0xa286('0xe8')](_0x4008e6)[_0xa286('0x20')](respondWithResult(_0x28074d,null));}})[_0xa286('0x60')](handleError(_0x28074d,null));};exports['logout']=function(_0x42348d,_0x9c7233,_0x5ee446){var _0x23b64e;return db['User'][_0xa286('0x63')]({'where':{'id':_0x42348d['params']['id'],'role':_0xa286('0x37')},'attributes':['id',_0xa286('0x3d'),'role']})['then'](handleEntityNotFound(_0x9c7233,null))[_0xa286('0x20')](function(_0x487190){if(_0x487190){_0x23b64e=_0x487190;return db[_0xa286('0xa7')][_0xa286('0x33')]({'where':{'membername':_0x23b64e[_0xa286('0x3d')]},'individualHooks':!![]});}})[_0xa286('0x20')](function(){return db[_0xa286('0xe5')][_0xa286('0x5e')]({'where':{'membername':_0x23b64e[_0xa286('0x3d')],'exitAt':null}});})[_0xa286('0x20')](function(_0x41ff75){var _0x11e644=[];_0x41ff75['forEach'](function(_0x48c358){_0x11e644['push'](_0x48c358[_0xa286('0xe9')]({'exitAt':moment()['format'](_0xa286('0xe0'))}));});return BPromise[_0xa286('0xe1')](_0x11e644);})['then'](function(){return _0x23b64e[_0xa286('0xe9')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa286('0x20')](respondWithResult(_0x9c7233,null))['catch'](handleError(_0x9c7233,null));};exports['pause']=function(_0x79aa20,_0x2299a4,_0x3cce3a){var _0x168184;return db[_0xa286('0xa7')][_0xa286('0xe9')]({'paused':0x1},{'where':{'UserId':_0x79aa20['params']['id']},'individualHooks':!![]})[_0xa286('0x20')](function(){return db[_0xa286('0x43')]['find']({'where':{'id':_0x79aa20[_0xa286('0x61')]['id'],'role':'agent'},'attributes':['id',_0xa286('0x3d'),_0xa286('0x3c'),_0xa286('0x70'),_0xa286('0xa4')]});})[_0xa286('0x20')](handleEntityNotFound(_0x2299a4,null))['then'](function(_0x21407b){if(_0x21407b){_0x168184=_0x21407b;return respondWithRpcPromise(_0xa286('0xea'),_0xa286('0xeb'),{'id':_0x168184['id'],'name':_0x168184[_0xa286('0x3d')],'pause':!![]});}})[_0xa286('0x20')](function(){if(_0x168184){return db[_0xa286('0xe5')]['findAll']({'where':{'membername':_0x168184[_0xa286('0x3d')],'type':_0xa286('0xec'),'exitAt':null}});}})['then'](function(_0x1fe06e){if(_0x1fe06e[_0xa286('0x62')]){var _0x5e22f4=moment()[_0xa286('0xa5')](_0xa286('0xe0'));for(var _0x17af1e=0x0,_0x3d90b1=_0x1fe06e[_0xa286('0x62')];_0x17af1e<_0x3d90b1;_0x17af1e++){_0x1fe06e[_0x17af1e][_0xa286('0xed')]({'exitAt':_0x5e22f4});}}})[_0xa286('0x20')](function(){var _0x16aa4b=[];var _0x41dce0=utils['getChannels']();_0x41dce0[_0xa286('0xdf')](function(_0x1cd6ea){_0x16aa4b[_0xa286('0xa3')]({'channel':_0x1cd6ea,'membername':_0x168184[_0xa286('0x3d')],'interface':_[_0xa286('0x6e')](_0x168184[_0xa286('0xa4')])?util[_0xa286('0xa5')](_0xa286('0xa6'),_0x168184[_0xa286('0x3d')]):_0x168184['interface'],'type':_0xa286('0xec'),'enterAt':moment()[_0xa286('0xa5')](_0xa286('0xe0')),'data1':_0x79aa20['body'][_0xa286('0x57')]||_0xa286('0xee'),'role':_0x168184[_0xa286('0x3c')],'internal':_0x168184[_0xa286('0x70')]});});return db[_0xa286('0xe5')]['bulkCreate'](_0x16aa4b,{'individualHooks':!![]});})['then'](function(){return _0x168184['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x79aa20['body'][_0xa286('0x57')]||_0xa286('0xee'),'lastPauseAt':moment()[_0xa286('0xa5')](_0xa286('0xe0'))});})['then'](respondWithResult(_0x2299a4,null))[_0xa286('0x60')](handleError(_0x2299a4,null));};exports[_0xa286('0xef')]=function(_0x2c5004,_0x2941cc,_0x3d8529){var _0x32a038;return db[_0xa286('0x43')]['find']({'where':{'id':_0x2c5004['params']['id']},'attributes':['id',_0xa286('0x3d'),_0xa286('0x3c'),_0xa286('0x99'),_0xa286('0xf0'),_0xa286('0xf1'),_0xa286('0xf2'),'openchannelPause',_0xa286('0xf3'),'whatsapppause',_0xa286('0xf4'),'lastPauseAt']})[_0xa286('0x20')](handleEntityNotFound(_0x2941cc,null))[_0xa286('0x20')](function(_0x5c6180){if(_0x5c6180){_0x32a038=_0x5c6180;if(_0x2c5004[_0xa286('0x65')][_0xa286('0xac')]&&!utils['isValidChannel'](_0x2c5004[_0xa286('0x65')][_0xa286('0xac')])){throw new db['Sequelize'][(_0xa286('0x1d'))](_0xa286('0x9a'));}switch(_0x2c5004[_0xa286('0x65')]['channel']){case _0xa286('0xa1'):return respondWithRpcPromise(_0xa286('0xea'),_0xa286('0xef'),{'id':_0x32a038['id'],'name':_0x32a038[_0xa286('0x3d')],'pause':![]})[_0xa286('0x20')](function(){return db[_0xa286('0xa7')][_0xa286('0xe9')]({'paused':0x0},{'where':{'UserId':_0x32a038['id']},'individualHooks':!![]});})[_0xa286('0x20')](function(){return db['MemberReport'][_0xa286('0x63')]({'where':{'channel':_0x2c5004[_0xa286('0x65')]['channel'],'membername':_0x32a038[_0xa286('0x3d')],'type':_0xa286('0xec'),'exitAt':null}});})[_0xa286('0x20')](function(_0x1bf7e2){if(_0x1bf7e2){return _0x1bf7e2[_0xa286('0xe9')]({'exitAt':moment()[_0xa286('0xa5')](_0xa286('0xe0')),'data2':_0xa286('0xf5')},{'individualHooks':!![]});}return null;})[_0xa286('0x20')](function(){return _0x32a038[_0xa286('0xe9')]({'voicePause':![]});});case _0xa286('0xf6'):case'chat':case _0xa286('0xf7'):case _0xa286('0xf8'):case'whatsapp':case _0xa286('0xf9'):return db['MemberReport'][_0xa286('0x63')]({'where':{'channel':_0x2c5004['body'][_0xa286('0xac')],'membername':_0x32a038[_0xa286('0x3d')],'type':_0xa286('0xec'),'exitAt':null}})[_0xa286('0x20')](function(_0x2aba22){if(_0x2aba22){return _0x2aba22[_0xa286('0xe9')]({'exitAt':moment()[_0xa286('0xa5')](_0xa286('0xe0')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xa286('0x20')](function(){var _0x4809d4={};_['set'](_0x4809d4,util[_0xa286('0xa5')](_0xa286('0xfa'),_0x2c5004[_0xa286('0x65')][_0xa286('0xac')],'Pause'),![]);return _0x32a038[_0xa286('0xe9')](_0x4809d4);});default:return respondWithRpcPromise(_0xa286('0xea'),_0xa286('0xef'),{'id':_0x32a038['id'],'name':_0x32a038[_0xa286('0x3d')],'pause':![]})[_0xa286('0x20')](function(){return db[_0xa286('0xa7')][_0xa286('0xe9')]({'paused':0x0},{'where':{'UserId':_0x32a038['id']}});})[_0xa286('0x20')](function(){return db['MemberReport'][_0xa286('0x5e')]({'where':{'membername':_0x32a038[_0xa286('0x3d')],'type':_0xa286('0xec'),'exitAt':null}});})['then'](function(_0x350705){var _0x595dbd=[];_0x350705[_0xa286('0xdf')](function(_0x80a429){_0x595dbd[_0xa286('0xa3')](_0x80a429['update']({'exitAt':moment()[_0xa286('0xa5')](_0xa286('0xe0')),'data2':_0xa286('0xf5')}));});return BPromise[_0xa286('0xe1')](_0x595dbd);})[_0xa286('0x20')](function(){return _0x32a038['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xa286('0x20')](respondWithResult(_0x2941cc,null))['catch'](handleError(_0x2941cc,null));};exports['getTeams']=function(_0x215d38,_0x3a1957,_0x1df0fa){var _0x5cf55e={};var _0x29eb01={};var _0x2d4d18;var _0x17567d;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x215d38[_0xa286('0x61')]['id']}})['then'](handleEntityNotFound(_0x3a1957,null))[_0xa286('0x20')](function(_0x45d2cd){if(_0x45d2cd){_0x2d4d18=_0x45d2cd;_0x29eb01['model']=_[_0xa286('0x4b')](db[_0xa286('0xfb')][_0xa286('0x44')]);_0x29eb01[_0xa286('0x4a')]=_[_0xa286('0x4b')](_0x215d38['query']);_0x29eb01[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x29eb01[_0xa286('0x46')],_0x29eb01[_0xa286('0x4a')]);_0x5cf55e[_0xa286('0x4f')]=_[_0xa286('0x4d')](_0x29eb01[_0xa286('0x46')],qs['fields'](_0x215d38[_0xa286('0x4a')][_0xa286('0x4e')]));_0x5cf55e[_0xa286('0x4f')]=_0x5cf55e[_0xa286('0x4f')][_0xa286('0x62')]?_0x5cf55e['attributes']:_0x29eb01[_0xa286('0x46')];_0x5cf55e[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x215d38['query']['sort']);_0x5cf55e['where']=qs['filters'](_[_0xa286('0xb9')](_0x215d38['query'],_0x29eb01[_0xa286('0x4c')]));if(_0x215d38[_0xa286('0x4a')][_0xa286('0x39')]){_0x5cf55e[_0xa286('0x55')]=_[_0xa286('0x56')](_0x5cf55e[_0xa286('0x55')],{'$or':_[_0xa286('0x42')](_0x5cf55e[_0xa286('0x4f')],function(_0x18b62d){var _0x563913={};_0x563913[_0x18b62d]={'$like':'%'+_0x215d38[_0xa286('0x4a')][_0xa286('0x39')]+'%'};return _0x563913;})});}_0x5cf55e=_[_0xa286('0x56')]({},_0x5cf55e,_0x215d38[_0xa286('0x5b')]);return _0x2d4d18[_0xa286('0xfc')](_0x5cf55e);}})['then'](function(_0x5012ca){if(_0x5012ca){_0x17567d=_0x5012ca[_0xa286('0x62')];if(!_0x215d38[_0xa286('0x4a')][_0xa286('0x50')](_0xa286('0x51'))){_0x5cf55e['limit']=qs[_0xa286('0x52')](_0x215d38[_0xa286('0x4a')][_0xa286('0x52')]);_0x5cf55e[_0xa286('0x2d')]=qs['offset'](_0x215d38[_0xa286('0x4a')][_0xa286('0x2d')]);}return _0x2d4d18['getTeams'](_0x5cf55e);}})[_0xa286('0x20')](function(_0x391c56){if(_0x391c56){return _0x391c56?{'count':_0x17567d,'rows':_0x391c56}:null;}})[_0xa286('0x20')](respondWithResult(_0x3a1957,null))['catch'](handleError(_0x3a1957,null));};exports[_0xa286('0xfd')]=function(_0x553c74,_0x3d143e){return db[_0xa286('0x43')][_0xa286('0x63')]({'where':{'id':_0x553c74[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x3d143e,null))[_0xa286('0x20')](function(_0x115db2){if(_0x115db2){var _0x4c138f=_0x115db2[_0xa286('0x86')]({'plain':!![]});return _0x115db2[_0xa286('0xfd')](_0x553c74[_0xa286('0x65')][_0xa286('0x68')],_['omit'](_0x553c74[_0xa286('0x65')],[_0xa286('0x68'),'id'])||{})['then'](function(){for(var _0x961bef=0x0;_0x961bef<_0x553c74['body'][_0xa286('0x68')]['length'];_0x961bef++){var _0x3c77cf=[];db[_0xa286('0xfb')]['findOne']({'where':{'id':_0x553c74[_0xa286('0x65')]['ids'][_0x961bef]}})['then'](function(_0x26eb24){_0x3c77cf[_0xa286('0xa3')](_0x26eb24[_0xa286('0xdc')]()[_0xa286('0x20')](function(_0x57b141){for(var _0x3db274=0x0;_0x3db274<_0x57b141[_0xa286('0x62')];_0x3db274++){_0x57b141[_0x3db274][_0xa286('0xfe')](_0xa286('0xac'),'Voice');}return _0x57b141;}));_0x3c77cf[_0xa286('0xa3')](_0x26eb24[_0xa286('0xff')]()['then'](function(_0x2dc5bc){for(var _0x448301=0x0;_0x448301<_0x2dc5bc[_0xa286('0x62')];_0x448301++){_0x2dc5bc[_0x448301]['setDataValue'](_0xa286('0xac'),_0xa286('0x100'));}return _0x2dc5bc;}));_0x3c77cf[_0xa286('0xa3')](_0x26eb24[_0xa286('0x101')]()[_0xa286('0x20')](function(_0x4031e9){for(var _0x145d99=0x0;_0x145d99<_0x4031e9[_0xa286('0x62')];_0x145d99++){_0x4031e9[_0x145d99]['setDataValue']('channel',_0xa286('0x102'));}return _0x4031e9;}));_0x3c77cf[_0xa286('0xa3')](_0x26eb24[_0xa286('0x103')]()[_0xa286('0x20')](function(_0x5b6995){for(var _0x2f15e9=0x0;_0x2f15e9<_0x5b6995[_0xa286('0x62')];_0x2f15e9++){_0x5b6995[_0x2f15e9][_0xa286('0xfe')]('channel',_0xa286('0x104'));}return _0x5b6995;}));_0x3c77cf[_0xa286('0xa3')](_0x26eb24['getWhatsappQueues']()[_0xa286('0x20')](function(_0x30a832){for(var _0x281c09=0x0;_0x281c09<_0x30a832[_0xa286('0x62')];_0x281c09++){_0x30a832[_0x281c09][_0xa286('0xfe')](_0xa286('0xac'),_0xa286('0x105'));}return _0x30a832;}));_0x3c77cf[_0xa286('0xa3')](_0x26eb24[_0xa286('0x106')]()['then'](function(_0x30a2b6){for(var _0x2fe299=0x0;_0x2fe299<_0x30a2b6[_0xa286('0x62')];_0x2fe299++){_0x30a2b6[_0x2fe299][_0xa286('0xfe')](_0xa286('0xac'),_0xa286('0x107'));}return _0x30a2b6;}));_0x3c77cf[_0xa286('0xa3')](_0x26eb24[_0xa286('0x108')]()[_0xa286('0x20')](function(_0x40f648){for(var _0x4115fe=0x0;_0x4115fe<_0x40f648[_0xa286('0x62')];_0x4115fe++){_0x40f648[_0x4115fe]['setDataValue'](_0xa286('0xac'),_0xa286('0x109'));}return _0x40f648;}));return BPromise['all'](_0x3c77cf);})['then'](function(_0x3b916f){var _0xa728af=_[_0xa286('0x10a')](_0x3b916f);_0x3c77cf=[];return db[_0xa286('0x59')][_0xa286('0x10b')](function(_0x411576){for(var _0x1ace30=0x0;_0x1ace30<_0xa728af[_0xa286('0x62')];_0x1ace30++){_0x3c77cf[_0xa286('0xa3')](_0xa728af[_0x1ace30][_0xa286('0x10c')](_0x4c138f['id']),{'transaction':_0x411576});}return BPromise['all'](_0x3c77cf)[_0xa286('0x20')](function(){if(_0x4c138f['online']){return BPromise['each'](_['filter'](_0xa728af,function(_0x472a4a){return _0x472a4a[_0xa286('0x10d')]('channel')===_0xa286('0x10e');}),function(_0x36a667){return db[_0xa286('0xa7')]['upsert']({'membername':_0x4c138f[_0xa286('0x3d')],'UserId':_0x4c138f['id'],'queue_name':_0x36a667[_0xa286('0x3d')],'VoiceQueueId':_0x36a667['id'],'interface':_[_0xa286('0x6e')](_0x4c138f[_0xa286('0xa4')])?util[_0xa286('0xa5')](_0xa286('0xa6'),_0x4c138f['name']):_0x4c138f[_0xa286('0xa4')],'paused':_0x4c138f[_0xa286('0x99')]||![],'penalty':_0x4c138f['penalty']},{'transaction':_0x411576});});}else{return;}})[_0xa286('0x20')](function(){for(var _0x1198f9=0x0;_0x1198f9<_0xa728af[_0xa286('0x62')];_0x1198f9++){var _0x869907=_0xa728af[_0x1198f9][_0xa286('0x10d')]('channel');var _0x16fb0f=_0x869907+_0xa286('0x10f');socket[_0xa286('0xad')](_0xa286('0x35')+_0x869907+'Queue:save',{'UserId':_0x4c138f['id'],['queueField']:_0xa728af[_0x1198f9]['id']});}});});});}});}})[_0xa286('0x20')](respondWithStatusCode(_0x3d143e,null))['catch'](handleError(_0x3d143e,null));};exports['removeTeams']=function(_0x11c379,_0x22cd3f){return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x11c379['params']['id']}})['then'](handleEntityNotFound(_0x22cd3f,null))['then'](function(_0x679445){if(_0x679445){var _0x3fbab7=_0x679445[_0xa286('0x86')]({'plain':!![]});var _0x5c37e8=_0x11c379[_0xa286('0x4a')][_0xa286('0x68')];return _0x679445[_0xa286('0x110')](_0x5c37e8)[_0xa286('0x20')](function(){for(var _0x5d86d2=0x0;_0x5d86d2<_0x5c37e8[_0xa286('0x62')];_0x5d86d2++){var _0x458db8=[];db[_0xa286('0xfb')][_0xa286('0x8d')]({'where':{'id':_0x5c37e8[_0x5d86d2]}})[_0xa286('0x20')](function(_0x1159df){_0x458db8[_0xa286('0xa3')](_0x1159df[_0xa286('0xdc')]()['then'](function(_0x4af11f){for(var _0x24612b=0x0;_0x24612b<_0x4af11f['length'];_0x24612b++){_0x4af11f[_0x24612b]['setDataValue'](_0xa286('0xac'),_0xa286('0x10e'));}return _0x4af11f;}));_0x458db8['push'](_0x1159df['getChatQueues']()[_0xa286('0x20')](function(_0x415d5e){for(var _0x350ab3=0x0;_0x350ab3<_0x415d5e[_0xa286('0x62')];_0x350ab3++){_0x415d5e[_0x350ab3]['setDataValue']('channel',_0xa286('0x100'));}return _0x415d5e;}));_0x458db8[_0xa286('0xa3')](_0x1159df[_0xa286('0x101')]()[_0xa286('0x20')](function(_0x489144){for(var _0x820d47=0x0;_0x820d47<_0x489144['length'];_0x820d47++){_0x489144[_0x820d47][_0xa286('0xfe')](_0xa286('0xac'),_0xa286('0x102'));}return _0x489144;}));_0x458db8[_0xa286('0xa3')](_0x1159df[_0xa286('0x103')]()[_0xa286('0x20')](function(_0x48d9cc){for(var _0x3a0209=0x0;_0x3a0209<_0x48d9cc[_0xa286('0x62')];_0x3a0209++){_0x48d9cc[_0x3a0209][_0xa286('0xfe')](_0xa286('0xac'),_0xa286('0x104'));}return _0x48d9cc;}));_0x458db8[_0xa286('0xa3')](_0x1159df[_0xa286('0x111')]()[_0xa286('0x20')](function(_0x226645){for(var _0x23dabd=0x0;_0x23dabd<_0x226645['length'];_0x23dabd++){_0x226645[_0x23dabd]['setDataValue']('channel','Whatsapp');}return _0x226645;}));_0x458db8[_0xa286('0xa3')](_0x1159df['getFaxQueues']()[_0xa286('0x20')](function(_0x4ca76b){for(var _0x468ca0=0x0;_0x468ca0<_0x4ca76b[_0xa286('0x62')];_0x468ca0++){_0x4ca76b[_0x468ca0][_0xa286('0xfe')](_0xa286('0xac'),_0xa286('0x107'));}return _0x4ca76b;}));_0x458db8[_0xa286('0xa3')](_0x1159df['getOpenchannelQueues']()['then'](function(_0x4eb73e){for(var _0x3630cf=0x0;_0x3630cf<_0x4eb73e[_0xa286('0x62')];_0x3630cf++){_0x4eb73e[_0x3630cf]['setDataValue'](_0xa286('0xac'),'Openchannel');}return _0x4eb73e;}));return BPromise[_0xa286('0xe1')](_0x458db8);})[_0xa286('0x20')](function(_0x452278){var _0x2ed181=_[_0xa286('0x10a')](_0x452278);_0x458db8=[];return db[_0xa286('0x59')]['transaction'](function(_0x150521){for(var _0x3bc3b7=0x0;_0x3bc3b7<_0x2ed181[_0xa286('0x62')];_0x3bc3b7++){_0x458db8[_0xa286('0xa3')](_0x2ed181[_0x3bc3b7]['removeAgent'](_0x3fbab7['id']),{'transaction':_0x150521});}return BPromise[_0xa286('0xe1')](_0x458db8)['then'](function(){if(_0x3fbab7[_0xa286('0x97')]){return BPromise['each'](_['filter'](_0x2ed181,function(_0x100b61){return _0x100b61[_0xa286('0x10d')](_0xa286('0xac'))===_0xa286('0x10e');}),function(_0x1ce40f){return db[_0xa286('0xa7')]['destroy']({'where':{'VoiceQueueId':_0x1ce40f['id'],'UserId':_0x3fbab7['id']},'transaction':_0x150521});});}else{return;}})[_0xa286('0x20')](function(){for(var _0x3fe5aa=0x0;_0x3fe5aa<_0x2ed181[_0xa286('0x62')];_0x3fe5aa++){var _0x16c30e=_0x2ed181[_0x3fe5aa][_0xa286('0x10d')]('channel');var _0x10c13e=_0x16c30e+_0xa286('0x10f');socket[_0xa286('0xad')](_0xa286('0x35')+_0x16c30e+_0xa286('0x112'),{'UserId':_0x3fbab7['id'],['queueField']:_0x2ed181[_0x3fe5aa]['id']});}});});});}});}})[_0xa286('0x20')](respondWithStatusCode(_0x22cd3f,null))[_0xa286('0x60')](handleError(_0x22cd3f,null));};exports['getLists']=function(_0x43a21b,_0x3f59ac,_0x7fbcb8){var _0x331d60={};var _0x5d07c2={};var _0xbe2164;var _0x430836;return db[_0xa286('0x43')][_0xa286('0x8d')]({'where':{'id':_0x43a21b[_0xa286('0x61')]['id']}})['then'](handleEntityNotFound(_0x3f59ac,null))['then'](function(_0x1ac142){if(_0x1ac142){_0xbe2164=_0x1ac142;_0x5d07c2[_0xa286('0x46')]=_[_0xa286('0x4b')](db['CmList'][_0xa286('0x44')]);_0x5d07c2[_0xa286('0x4a')]=_['keys'](_0x43a21b[_0xa286('0x4a')]);_0x5d07c2['filters']=_['intersection'](_0x5d07c2[_0xa286('0x46')],_0x5d07c2[_0xa286('0x4a')]);_0x331d60['attributes']=_[_0xa286('0x4d')](_0x5d07c2[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x43a21b[_0xa286('0x4a')]['fields']));_0x331d60[_0xa286('0x4f')]=_0x331d60['attributes']['length']?_0x331d60[_0xa286('0x4f')]:_0x5d07c2[_0xa286('0x46')];_0x331d60[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x43a21b[_0xa286('0x4a')][_0xa286('0x54')]);_0x331d60[_0xa286('0x55')]=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x43a21b[_0xa286('0x4a')],_0x5d07c2['filters']));if(_0x43a21b[_0xa286('0x4a')][_0xa286('0x39')]){_0x331d60[_0xa286('0x55')]=_[_0xa286('0x56')](_0x331d60[_0xa286('0x55')],{'$or':_[_0xa286('0x42')](_0x331d60['attributes'],function(_0x2d71c6){var _0x2b7f1a={};_0x2b7f1a[_0x2d71c6]={'$like':'%'+_0x43a21b['query']['filter']+'%'};return _0x2b7f1a;})});}_0x331d60=_[_0xa286('0x56')]({},_0x331d60,_0x43a21b['options']);return _0xbe2164[_0xa286('0x113')](_0x331d60);}})[_0xa286('0x20')](function(_0x23dae1){if(_0x23dae1){_0x430836=_0x23dae1['length'];if(!_0x43a21b[_0xa286('0x4a')][_0xa286('0x50')](_0xa286('0x51'))){_0x331d60[_0xa286('0x52')]=qs['limit'](_0x43a21b[_0xa286('0x4a')][_0xa286('0x52')]);_0x331d60[_0xa286('0x2d')]=qs[_0xa286('0x2d')](_0x43a21b[_0xa286('0x4a')][_0xa286('0x2d')]);}return _0xbe2164['getLists'](_0x331d60);}})[_0xa286('0x20')](function(_0x86048f){if(_0x86048f){return _0x86048f?{'count':_0x430836,'rows':_0x86048f}:null;}})['then'](respondWithResult(_0x3f59ac,null))[_0xa286('0x60')](handleError(_0x3f59ac,null));};exports[_0xa286('0x114')]=function(_0x5b8a92,_0x571374,_0x40e82a){var _0x2c9160={};var _0x1942e2={};var _0x10b178;var _0x2a8f4e;return db['User']['findOne']({'where':{'id':_0x5b8a92[_0xa286('0x61')]['id']}})[_0xa286('0x20')](handleEntityNotFound(_0x571374,null))[_0xa286('0x20')](function(_0x2bd08b){if(_0x2bd08b){_0x10b178=_0x2bd08b;_0x1942e2['model']=_[_0xa286('0x4b')](db[_0xa286('0x43')][_0xa286('0x44')]);_0x1942e2[_0xa286('0x4a')]=_['keys'](_0x5b8a92[_0xa286('0x4a')]);_0x1942e2[_0xa286('0x4c')]=_[_0xa286('0x4d')](_0x1942e2[_0xa286('0x46')],_0x1942e2['query']);_0x2c9160['attributes']=_[_0xa286('0x4d')](_0x1942e2[_0xa286('0x46')],qs[_0xa286('0x4e')](_0x5b8a92[_0xa286('0x4a')][_0xa286('0x4e')]));_0x2c9160[_0xa286('0x4f')]=_0x2c9160[_0xa286('0x4f')][_0xa286('0x62')]?_0x2c9160[_0xa286('0x4f')]:_0x1942e2[_0xa286('0x46')];_0x2c9160[_0xa286('0x53')]=qs[_0xa286('0x54')](_0x5b8a92['query']['sort']);_0x2c9160['where']=qs[_0xa286('0x4c')](_[_0xa286('0xb9')](_0x5b8a92[_0xa286('0x4a')],_0x1942e2['filters']));if(_0x5b8a92[_0xa286('0x4a')][_0xa286('0x39')]){_0x2c9160[_0xa286('0x55')]=_[_0xa286('0x56')](_0x2c9160[_0xa286('0x55')],{'$or':_[_0xa286('0x42')](_0x2c9160['attributes'],function(_0x21d973){var _0x3e5788={};_0x3e5788[_0x21d973]={'$like':'%'+_0x5b8a92['query']['filter']+'%'};return _0x3e5788;})});}_0x2c9160[_0xa286('0x46')]=db[_0xa286('0x43')];_0x2c9160['as']=_0xa286('0x36');_0x2c9160=_[_0xa286('0x56')]({},_0x2c9160,_0x5b8a92['options']);return _0x10b178[_0xa286('0xdc')]({'include':[_0x2c9160]});}})[_0xa286('0x20')](function(_0x5c9b26){if(_0x5c9b26){var _0xe13197={},_0x1b7aba=[],_0x1deab9=0x0;for(var _0x5e6a68=0x0;_0x5e6a68<_0x5c9b26[_0xa286('0x62')];_0x5e6a68+=0x1){for(var _0x374ed4=0x0,_0x3c16da;_0x374ed4<_0x5c9b26[_0x5e6a68][_0xa286('0x36')]['length'];_0x374ed4+=0x1){_0x3c16da=_0x5c9b26[_0x5e6a68][_0xa286('0x36')][_0x374ed4][_0xa286('0x86')]({'plain':!![]});_0xe13197[_0x3c16da['id']]=_0x3c16da;}}_0xe13197=_[_0xa286('0x115')](_0xe13197);for(var _0x49edca=qs['offset'](_0x5b8a92['query'][_0xa286('0x2d')]);_0x49edca<_0xe13197[_0xa286('0x62')]&&_0x1b7aba['length']=_0x5dba41){_0x2fd8fc=_0x5dba41;_0x12faea=0xc8;}else{_0x12faea=0xce;}_0x2b81b9[_0xfa7e('0x2f')](_0x12faea);return _0x2b81b9['set'](_0xfa7e('0x33'),_0x109f40+'-'+_0x2fd8fc+'/'+_0x5dba41)[_0xfa7e('0x34')](_0x869a85);}return null;};}function patchUpdates(_0x1578b7){return function(_0x135011){try{jsonpatch['apply'](_0x135011,_0x1578b7,!![]);}catch(_0x22b325){return BPromise[_0xfa7e('0x35')](_0x22b325);}return _0x135011['save']();};}function saveUpdates(_0xaaa0a4,_0x58691c){return function(_0x3bac25){if(_0x3bac25){return _0x3bac25['update'](_0xaaa0a4)[_0xfa7e('0x23')](function(_0x536c2e){return _0x536c2e;});}return null;};}function removeEntity(_0x22212f,_0x383193){return function(_0x1b98d8){if(_0x1b98d8){return _0x1b98d8['destroy']()[_0xfa7e('0x23')](function(){var _0x25c49c=_0x1b98d8[_0xfa7e('0x36')]({'plain':!![]});var _0x1f388f=[{'name':_0xfa7e('0x37'),'value':_0xfa7e('0x38'),'ignore':!![]},{'name':_0xfa7e('0x39'),'value':_0xfa7e('0x3a'),'ignore':![]},{'name':_0xfa7e('0x3b'),'value':_0xfa7e('0x3c'),'ignore':![]}];var _0x31a013=_(_0x1f388f)[_0xfa7e('0x3d')](_0xfa7e('0x3e'))[_0xfa7e('0x3f')](_0xfa7e('0x40'))['value']();if(_[_0xfa7e('0x41')](_0x31a013,_0x25c49c[_0xfa7e('0x42')])){return;}var _0x1c8bce=_['find'](_0x1f388f,[_0xfa7e('0x40'),_0x25c49c[_0xfa7e('0x42')]])[_0xfa7e('0x43')];return db['UserProfileResource'][_0xfa7e('0x44')]({'where':{'type':_0x1c8bce,'resourceId':_0x25c49c['id']}})[_0xfa7e('0x23')](function(){return _0x1b98d8;});})[_0xfa7e('0x23')](function(){_0x22212f['status'](0xcc)[_0xfa7e('0x30')]();});}};}function handleEntityNotFound(_0x584416,_0x11526a){return function(_0x44d732){if(!_0x44d732){_0x584416[_0xfa7e('0x45')](0x194);}return _0x44d732;};}function handleError(_0x3b43b5,_0x3e58c7){_0x3e58c7=_0x3e58c7||0x1f4;return function(_0x46934d){logger[_0xfa7e('0x2a')](_0x46934d[_0xfa7e('0x46')]);if(_0x46934d[_0xfa7e('0x43')]){delete _0x46934d[_0xfa7e('0x43')];}_0x3b43b5[_0xfa7e('0x2f')](_0x3e58c7)[_0xfa7e('0x47')](_0x46934d);};}exports[_0xfa7e('0x48')]=function(_0x48794e,_0x238479){var _0x444c72={},_0x5d9568={},_0x405676={'count':0x0,'rows':[]};var _0x1922bd=_[_0xfa7e('0x3f')](db['User'][_0xfa7e('0x49')],function(_0x3ad693){return{'name':_0x3ad693[_0xfa7e('0x4a')],'type':_0x3ad693[_0xfa7e('0x4b')]['key']};});_0x5d9568[_0xfa7e('0x4c')]=_[_0xfa7e('0x4d')](_[_0xfa7e('0x3f')](_0x1922bd,_0xfa7e('0x43')),[_0xfa7e('0x4e'),_0xfa7e('0x4f')]);_0x5d9568[_0xfa7e('0x50')]=_[_0xfa7e('0x51')](_0x48794e[_0xfa7e('0x50')]);_0x5d9568['filters']=_[_0xfa7e('0x52')](_0x5d9568[_0xfa7e('0x4c')],_0x5d9568[_0xfa7e('0x50')]);_0x444c72[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x5d9568['model'],qs[_0xfa7e('0x54')](_0x48794e[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x444c72[_0xfa7e('0x53')]=_0x444c72[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x444c72['attributes']:_0x5d9568['model'];if(!_0x48794e[_0xfa7e('0x50')][_0xfa7e('0x56')](_0xfa7e('0x57'))){_0x444c72[_0xfa7e('0x58')]=qs['limit'](_0x48794e['query'][_0xfa7e('0x58')]);_0x444c72[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x48794e['query'][_0xfa7e('0x32')]);}_0x444c72[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x48794e['query']['sort']);_0x444c72[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_[_0xfa7e('0x5d')](_0x48794e[_0xfa7e('0x50')],_0x5d9568[_0xfa7e('0x5c')]),_0x1922bd);if(_0x48794e[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x444c72['where']=_[_0xfa7e('0x5e')](_0x444c72[_0xfa7e('0x5b')],{'$or':_[_0xfa7e('0x3f')](_0x1922bd,function(_0x1de8c8){if(_0x1de8c8[_0xfa7e('0x4b')]!==_0xfa7e('0x5f')){return db[_0xfa7e('0x60')][_0xfa7e('0x5b')](db['sequelize']['fn']('lower',db['sequelize']['col'](_0x1de8c8[_0xfa7e('0x43')])),{'$like':db[_0xfa7e('0x60')]['fn']('lower','%'+_0x48794e[_0xfa7e('0x50')]['filter']+'%')});}})});}_0x444c72=_[_0xfa7e('0x5e')]({},_0x444c72,_0x48794e[_0xfa7e('0x61')]);var _0x5088f6={'where':_0x444c72[_0xfa7e('0x5b')]};return db[_0xfa7e('0x62')][_0xfa7e('0x31')](_0x5088f6)[_0xfa7e('0x23')](function(_0x10347d){_0x405676['count']=_0x10347d;if(_0x48794e[_0xfa7e('0x50')]['includeAll']){_0x444c72['include']=[{'all':!![]}];}return db[_0xfa7e('0x62')]['findAll'](_0x444c72);})[_0xfa7e('0x23')](function(_0x6fe27a){_0x405676['rows']=_0x6fe27a;return _0x405676;})[_0xfa7e('0x23')](respondWithFilteredResult(_0x238479,_0x444c72))[_0xfa7e('0x2e')](handleError(_0x238479,null));};exports[_0xfa7e('0x63')]=function(_0x531010,_0x2d60ed){var _0x3ec3d3={'raw':![],'where':{'id':_0x531010[_0xfa7e('0x64')]['id']}},_0x34ce7a={};_0x34ce7a[_0xfa7e('0x4c')]=_[_0xfa7e('0x4d')](_[_0xfa7e('0x51')](db[_0xfa7e('0x62')][_0xfa7e('0x49')]),['password',_0xfa7e('0x4f')]);_0x34ce7a['query']=_[_0xfa7e('0x51')](_0x531010[_0xfa7e('0x50')]);_0x34ce7a[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x34ce7a['model'],_0x34ce7a[_0xfa7e('0x50')]);_0x3ec3d3[_0xfa7e('0x53')]=_['intersection'](_0x34ce7a['model'],qs['fields'](_0x531010[_0xfa7e('0x50')]['fields']));_0x3ec3d3[_0xfa7e('0x53')]=_0x3ec3d3[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x3ec3d3[_0xfa7e('0x53')]:_0x34ce7a['model'];if(_0x531010[_0xfa7e('0x50')][_0xfa7e('0x65')]){_0x3ec3d3['include']=[{'all':!![]}];}_0x3ec3d3=_['merge']({},_0x3ec3d3,_0x531010['options']);return db[_0xfa7e('0x62')][_0xfa7e('0x66')](_0x3ec3d3)[_0xfa7e('0x23')](handleEntityNotFound(_0x2d60ed,null))[_0xfa7e('0x23')](respondWithResult(_0x2d60ed,null))[_0xfa7e('0x2e')](handleError(_0x2d60ed,null));};exports['bulkCreate']=function(_0x1bf33c,_0x16fbea){return db[_0xfa7e('0x62')]['bulkCreate'](_0x1bf33c['body'],{'raw':![],'individualHooks':!![]})[_0xfa7e('0x23')](respondWithResult(_0x16fbea,0xc9))[_0xfa7e('0x2e')](handleError(_0x16fbea,null));};exports[_0xfa7e('0x67')]=function(_0x23c2b0,_0x4f5a48){if(_0x23c2b0['body']['id']){delete _0x23c2b0['body']['id'];}delete _0x23c2b0[_0xfa7e('0x68')][_0xfa7e('0x42')];return db['User'][_0xfa7e('0x66')]({'where':{'id':_0x23c2b0['params']['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x4f5a48,null))['then'](saveUpdates(_0x23c2b0[_0xfa7e('0x68')],null))[_0xfa7e('0x23')](respondWithResult(_0x4f5a48,null))[_0xfa7e('0x2e')](handleError(_0x4f5a48,null));};exports['describe']=function(_0xc80d9b,_0x75bf27){return db['User'][_0xfa7e('0x69')]()[_0xfa7e('0x23')](respondWithResult(_0x75bf27,null))[_0xfa7e('0x2e')](handleError(_0x75bf27,null));};exports[_0xfa7e('0x6a')]=function(_0xf15f97,_0x1ac492,_0x552450){return db[_0xfa7e('0x62')]['find']({'where':{'id':_0xf15f97['params']['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x1ac492,null))[_0xfa7e('0x23')](function(_0x5e20e9){if(_0x5e20e9){return _0x5e20e9[_0xfa7e('0x6a')](_0xf15f97[_0xfa7e('0x68')][_0xfa7e('0x6b')],_[_0xfa7e('0x6c')](_0xf15f97[_0xfa7e('0x68')],[_0xfa7e('0x6b'),'id'])||{});}})[_0xfa7e('0x23')](respondWithResult(_0x1ac492,null))[_0xfa7e('0x2e')](handleError(_0x1ac492,null));};var getLicense=function(_0xef452d){return new BPromise(function(_0xc55d75,_0x794a0f){var _0x18c26d=0x0;_0xef452d[_0xfa7e('0x68')][_0xfa7e('0x42')]===_0xfa7e('0x3a')&&_0xc55d75(_0xfa7e('0x6d'));return db[_0xfa7e('0x62')]['count']({'where':{'$or':[{'role':_0xef452d[_0xfa7e('0x68')][_0xfa7e('0x42')]===_0xfa7e('0x3c')?'telephone':['admin','user']}]}})[_0xfa7e('0x23')](function(_0x29ed68){_0x18c26d=_0x29ed68;return require('../../config/license/util')['getLicense']();})[_0xfa7e('0x23')](function(_0x49accc){var _0x3c970f=_0xef452d['body'][_0xfa7e('0x42')]==='telephone'?_0xfa7e('0x6e'):_0xfa7e('0x6f');if(!_[_0xfa7e('0x70')](_0x49accc[_0x3c970f])&&_0x18c26d>=_0x49accc[_0x3c970f]){return _0x794a0f({'message':'License\x20limit\x20reached'});}return _0xc55d75(util['format']('count\x20%s:\x20%s',_0x3c970f,_0x18c26d));})[_0xfa7e('0x2e')](function(_0x1a47ec){return _0x794a0f(_0x1a47ec);});});};exports[_0xfa7e('0x71')]=function(_0x1e29ff,_0x2128fd){return getLicense(_0x1e29ff)[_0xfa7e('0x23')](function(_0x52417d){if(!_0x1e29ff['body'][_0xfa7e('0x72')]){var _0x358b38;return db[_0xfa7e('0x73')]['findById'](0x1)['then'](function(_0xac61d7){return checkPasswordPattern(_0xac61d7,_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x4e')],_0xac61d7[_0xfa7e('0x74')]);})[_0xfa7e('0x23')](function(_0x19fed0){_0x358b38=_0x19fed0[_0xfa7e('0x75')];return db['User'][_0xfa7e('0x76')](_0xfa7e('0x72'));})['then'](function(_0x26fac1){if(_[_0xfa7e('0x70')](_0x26fac1)){if(_0x358b38){_0x1e29ff[_0xfa7e('0x68')]['internal']=_0x358b38;}else{_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x72')]=0x1;}}else{if(_[_0xfa7e('0x70')](_0x358b38)||_0x358b38==_0x26fac1){_0x1e29ff[_0xfa7e('0x68')]['internal']=_0x26fac1+0x1;}else if(_0x358b38>_0x26fac1){_0x1e29ff['body'][_0xfa7e('0x72')]=_0x358b38;}else{return db[_0xfa7e('0x60')][_0xfa7e('0x50')](_0xfa7e('0x77'),{'type':db[_0xfa7e('0x60')][_0xfa7e('0x78')][_0xfa7e('0x79')]})[_0xfa7e('0x23')](function(_0x48ee47){if(_0x48ee47&&_0x48ee47[_0xfa7e('0x55')]){for(var _0x27d70f=0x0,_0x1f1ab9=_0x48ee47[_0xfa7e('0x55')];_0x27d70f<_0x1f1ab9&&_[_0xfa7e('0x70')](_0x1e29ff['body'][_0xfa7e('0x72')]);_0x27d70f++){if(_0x358b38<=_0x48ee47[_0x27d70f]['from']){_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x72')]=_0x48ee47[_0x27d70f][_0xfa7e('0x7a')];}else if(_0x358b38>_0x48ee47[_0x27d70f][_0xfa7e('0x7a')]&&_0x358b38<=_0x48ee47[_0x27d70f]['to']){_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x72')]=_0x358b38;}}}if(_[_0xfa7e('0x70')](_0x1e29ff[_0xfa7e('0x68')]['internal'])){_0x1e29ff[_0xfa7e('0x68')]['internal']=_0x26fac1+0x1;}});}}});}})['then'](function(){if(_0x1e29ff[_0xfa7e('0x68')]['voicemail']){_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x7b')]=_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x72')];_0x1e29ff['body'][_0xfa7e('0x7c')]={'mailbox':_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x72')],'password':_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x4e')],'fullname':_0x1e29ff['body'][_0xfa7e('0x7d')],'email':_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x7e')]};}if(_0x1e29ff[_0xfa7e('0x68')]&&_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x42')]===_0xfa7e('0x3a')){if(!_0x1e29ff['body']['permissions']){_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x7f')]=[_0xfa7e('0x80'),'102',_0xfa7e('0x81'),_0xfa7e('0x82'),_0xfa7e('0x83'),'104',_0xfa7e('0x84'),_0xfa7e('0x85'),_0xfa7e('0x86'),'108',_0xfa7e('0x87'),_0xfa7e('0x88'),_0xfa7e('0x89'),_0xfa7e('0x8a')];}}return db[_0xfa7e('0x62')][_0xfa7e('0x71')](_0x1e29ff[_0xfa7e('0x68')],{'include':[{'model':db[_0xfa7e('0x7c')],'as':_0xfa7e('0x7c')}]});})[_0xfa7e('0x23')](function(_0x21d116){if(_0x1e29ff[_0xfa7e('0x68')][_0xfa7e('0x42')]===_0xfa7e('0x38'))return _0x21d116;var _0x2ef8d6=_0x1e29ff[_0xfa7e('0x38')]['get']({'plain':!![]});if(!_0x2ef8d6)throw new Error(_0xfa7e('0x8b'));if(_0x2ef8d6[_0xfa7e('0x42')]==='user'){var _0x5edcbe=_0x21d116[_0xfa7e('0x36')]({'plain':!![]});var _0x54b841=[{'name':'Agents','value':_0xfa7e('0x3a')},{'name':_0xfa7e('0x3b'),'value':_0xfa7e('0x3c')}];var _0x48db87=_[_0xfa7e('0x66')](_0x54b841,[_0xfa7e('0x40'),_0x5edcbe[_0xfa7e('0x42')]])['name'];return db[_0xfa7e('0x8c')][_0xfa7e('0x66')]({'where':{'name':_0x48db87,'userProfileId':_0x2ef8d6[_0xfa7e('0x8d')]},'raw':!![]})['then'](function(_0x451bbf){if(_0x451bbf&&_0x451bbf[_0xfa7e('0x8e')]===0x0){return db[_0xfa7e('0x8f')]['create']({'name':_0x5edcbe['name'],'resourceId':_0x5edcbe['id'],'type':_0x451bbf[_0xfa7e('0x43')],'sectionId':_0x451bbf['id']},{})[_0xfa7e('0x23')](function(){return _0x21d116;});}else{return _0x21d116;}})['catch'](function(_0x1bc6e6){logger[_0xfa7e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bc6e6);throw _0x1bc6e6;});}return _0x21d116;})[_0xfa7e('0x23')](respondWithResult(_0x2128fd,0xc9))[_0xfa7e('0x2e')](handleError(_0x2128fd,null));};exports['changePassword']=function(_0x53ecac,_0x27f9f4,_0x1a1e51){var _0x242839=![];if(_0x53ecac[_0xfa7e('0x68')]['id']){delete _0x53ecac[_0xfa7e('0x68')]['id'];}return db[_0xfa7e('0x73')][_0xfa7e('0x90')]({'attributes':['id',_0xfa7e('0x74')]})[_0xfa7e('0x23')](function(_0x574906){_0x242839=_0x574906['securePassword'];return db[_0xfa7e('0x62')]['find']({'where':{'id':_0x53ecac[_0xfa7e('0x64')]['id']}});})['then'](function(_0x21ed19){if(_0x21ed19){if(_0x21ed19['id']==_0x53ecac[_0xfa7e('0x38')]['id']){if(!_0x53ecac[_0xfa7e('0x68')][_0xfa7e('0x91')]||!_0x53ecac[_0xfa7e('0x68')][_0xfa7e('0x92')]){throw new db[(_0xfa7e('0x93'))][(_0xfa7e('0x94'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x21ed19[_0xfa7e('0x95')](_0x53ecac[_0xfa7e('0x68')][_0xfa7e('0x91')])){throw new db['Sequelize']['ValidationError'](_0xfa7e('0x96'));}if(_0x53ecac[_0xfa7e('0x68')][_0xfa7e('0x91')]==_0x53ecac['body'][_0xfa7e('0x92')]){throw new db['Sequelize'][(_0xfa7e('0x94'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x21ed19;}else if(_0x53ecac['user'][_0xfa7e('0x42')]==_0xfa7e('0x97')){if(!_0x53ecac[_0xfa7e('0x68')][_0xfa7e('0x92')]){throw new db[(_0xfa7e('0x93'))][(_0xfa7e('0x94'))](_0xfa7e('0x98'));}return _0x21ed19;}else if(_0x53ecac[_0xfa7e('0x38')][_0xfa7e('0x42')]==_0xfa7e('0x38')){if(!_0x53ecac[_0xfa7e('0x68')][_0xfa7e('0x92')]){throw new db['Sequelize']['ValidationError'](_0xfa7e('0x98'));}if(_0x21ed19[_0xfa7e('0x42')]!=_0xfa7e('0x3a')){throw new db[(_0xfa7e('0x93'))][(_0xfa7e('0x94'))](_0xfa7e('0x99'));}return _0x21ed19;}else{throw new db[(_0xfa7e('0x93'))]['ValidationError'](_0xfa7e('0x99'));}}return null;})[_0xfa7e('0x23')](handleEntityNotFound(_0x27f9f4,null))[_0xfa7e('0x23')](function(_0x5361c4){return checkPasswordPattern(_0x5361c4,_0x53ecac['body'][_0xfa7e('0x92')],_0x242839);})[_0xfa7e('0x23')](saveUpdates({'password':_0x53ecac['body'][_0xfa7e('0x92')],'passwordResetAt':_0x53ecac[_0xfa7e('0x38')]['id']==_0x53ecac[_0xfa7e('0x64')]['id']?moment():null},null))[_0xfa7e('0x23')](respondWithResult(_0x27f9f4,null))['catch'](handleError(_0x27f9f4,null));};exports[_0xfa7e('0x9a')]=function(_0x453b23,_0x367728,_0x333692){var _0x16c48c=_0x453b23[_0xfa7e('0x68')]['channel'];return db['User'][_0xfa7e('0x66')]({'where':{'id':_0x453b23[_0xfa7e('0x64')]['id']},'attributes':['id','name',_0xfa7e('0x42'),'online',_0xfa7e('0x9b'),_0xfa7e('0x9c'),'interface']})[_0xfa7e('0x23')](handleEntityNotFound(_0x367728,null))[_0xfa7e('0x23')](function(_0x3653f0){if(_0x3653f0){if(!utils['isValidChannel'](_0x16c48c)){throw new db[(_0xfa7e('0x93'))][(_0xfa7e('0x94'))](_0xfa7e('0x9d'));}return _0x3653f0[_0xfa7e('0x9e')+_['capitalize'](_0x16c48c[_0xfa7e('0x9f')]())+'Queues'](_0x453b23[_0xfa7e('0x68')][_0xfa7e('0x6b')],{'penalty':_0x453b23['body'][_0xfa7e('0xa0')]||0x0})[_0xfa7e('0xa1')](function(_0x124e9d){for(var _0x38f9c8=0x0;_0x38f9c8<_0x453b23[_0xfa7e('0x68')][_0xfa7e('0x6b')][_0xfa7e('0x55')];_0x38f9c8+=0x1){var _0x3d93c6={'UserId':_0x453b23[_0xfa7e('0x64')]['id']};_0x3d93c6[_[_0xfa7e('0xa2')](_0x16c48c[_0xfa7e('0x9f')]())+_0xfa7e('0xa3')]=_0x453b23['body'][_0xfa7e('0x6b')][_0x38f9c8];socket['emit'](_0xfa7e('0x38')+_['capitalize'](_0x16c48c[_0xfa7e('0x9f')]())+'Queue:save',_0x3d93c6);}return _0x124e9d;})[_0xfa7e('0x23')](function(){if(_0x16c48c===_0xfa7e('0xa4')){return db['VoiceQueue'][_0xfa7e('0xa5')]({'where':{'id':_0x453b23[_0xfa7e('0x68')][_0xfa7e('0x6b')]||[]},'raw':!![],'attributes':['id',_0xfa7e('0x43')]});}})[_0xfa7e('0x23')](function(_0x115bc5){var _0x4814f3=_0x3653f0[_0xfa7e('0x36')]({'plain':!![]});var _0x15c9a0=[];if(_0x16c48c===_0xfa7e('0xa4')&&_0x4814f3['role']===_0xfa7e('0x3a')&&_0x4814f3[_0xfa7e('0xa6')]){for(var _0x2b4e26=0x0;_0x2b4e26<_0x115bc5['length'];_0x2b4e26+=0x1){_0x15c9a0[_0xfa7e('0xa7')]({'membername':_0x4814f3[_0xfa7e('0x43')],'UserId':_0x4814f3['id'],'queue_name':_0x115bc5[_0x2b4e26][_0xfa7e('0x43')],'VoiceQueueId':_0x115bc5[_0x2b4e26]['id'],'interface':_[_0xfa7e('0x70')](_0x4814f3['interface'])?util[_0xfa7e('0xa8')](_0xfa7e('0xa9'),_0x4814f3[_0xfa7e('0x43')]):_0x4814f3[_0xfa7e('0xaa')],'paused':_0x4814f3['voicePause']||![],'penalty':_0x453b23[_0xfa7e('0x68')]['penalty']||0x0});}return BPromise[_0xfa7e('0xab')](_0x15c9a0,function(_0xd5f96c){return db['UserVoiceQueueRt']['upsert'](_0xd5f96c);});}return _0x3653f0;});}})['then'](respondWithStatusCode(_0x367728,null))[_0xfa7e('0x2e')](handleError(_0x367728,null));};exports[_0xfa7e('0xac')]=function(_0x397e49,_0x5e3fd5,_0x555b2e){var _0x33a58b;return db['User'][_0xfa7e('0x66')]({'where':{'id':_0x397e49[_0xfa7e('0x64')]['id']},'attributes':['id',_0xfa7e('0x43'),'role']})[_0xfa7e('0x23')](handleEntityNotFound(_0x5e3fd5,null))[_0xfa7e('0x23')](function(_0xfb7596){if(_0xfb7596){_0x33a58b=_0xfb7596;if(!_0x397e49[_0xfa7e('0x50')][_0xfa7e('0xad')]||!utils[_0xfa7e('0xae')](_0x397e49[_0xfa7e('0x50')]['channel'])){throw new db[(_0xfa7e('0x93'))][(_0xfa7e('0x94'))](_0xfa7e('0x9d'));}return _0xfb7596['remove'+_[_0xfa7e('0xa2')](_0x397e49[_0xfa7e('0x50')]['channel'][_0xfa7e('0x9f')]())+_0xfa7e('0xaf')](_0x397e49[_0xfa7e('0x50')][_0xfa7e('0x6b')]);}})[_0xfa7e('0x23')](function(_0x443b69){for(var _0x5a8f2a=0x0;_0x5a8f2a<_0x397e49[_0xfa7e('0x50')]['ids'][_0xfa7e('0x55')];_0x5a8f2a+=0x1){var _0x1689a6={'UserId':_0x397e49[_0xfa7e('0x64')]['id']};_0x1689a6[_[_0xfa7e('0xa2')](_0x397e49['query'][_0xfa7e('0xad')][_0xfa7e('0x9f')]())+'QueueId']=_0x397e49[_0xfa7e('0x50')]['ids'][_0x5a8f2a];socket['emit'](_0xfa7e('0x38')+_[_0xfa7e('0xa2')](_0x397e49[_0xfa7e('0x50')][_0xfa7e('0xad')][_0xfa7e('0x9f')]())+_0xfa7e('0xb0'),_0x1689a6);}return _0x443b69;})[_0xfa7e('0x23')](function(){if(_0x397e49[_0xfa7e('0x50')][_0xfa7e('0xad')]==='voice'){return db[_0xfa7e('0xb1')]['destroy']({'where':{'UserId':_0x397e49[_0xfa7e('0x64')]['id'],'VoiceQueueId':_0x397e49[_0xfa7e('0x50')][_0xfa7e('0x6b')]},'individualHooks':!![]})[_0xfa7e('0x23')](function(){return _0x33a58b;});}return _0x33a58b;})[_0xfa7e('0x23')](respondWithStatusCode(_0x5e3fd5,null))[_0xfa7e('0x2e')](handleError(_0x5e3fd5,null));};exports['addAvatar']=function(_0x44b7c1,_0x4fea56,_0x220d25){_0x44b7c1['body'][_0xfa7e('0xb2')]=_0x44b7c1[_0xfa7e('0xb3')]['filename'];return db['User'][_0xfa7e('0x66')]({'where':{'id':_0x44b7c1['params']['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x4fea56,null))[_0xfa7e('0x23')](saveUpdates(_0x44b7c1[_0xfa7e('0x68')],null))[_0xfa7e('0x23')](respondWithResult(_0x4fea56,null))[_0xfa7e('0x2e')](handleError(_0x4fea56,null));};exports[_0xfa7e('0xb4')]=function(_0x8898db,_0x141a7d,_0xc6b318){var _0x1ae9ae=path[_0xfa7e('0xb5')](config[_0xfa7e('0xb6')],_0xfa7e('0xb7'));return db[_0xfa7e('0x62')][_0xfa7e('0x66')]({'where':{'id':_0x8898db[_0xfa7e('0x64')]['id']},'attributes':['id',_0xfa7e('0xb2')],'raw':!![]})[_0xfa7e('0x23')](handleEntityNotFound(_0x141a7d,null))[_0xfa7e('0x23')](function(_0x5927aa){if(_0x5927aa){if(_[_0xfa7e('0x70')](_0x5927aa[_0xfa7e('0xb2')])){return _0x141a7d['download'](_0x1ae9ae);}else{if(!fs[_0xfa7e('0xb8')](path[_0xfa7e('0xb5')](config[_0xfa7e('0xb6')],_0xfa7e('0xb9'),_0x5927aa[_0xfa7e('0xb2')]))){return _0x141a7d[_0xfa7e('0xba')](_0x1ae9ae);}return _0x141a7d[_0xfa7e('0xba')](path[_0xfa7e('0xb5')](config[_0xfa7e('0xb6')],'server/files/images/',_0x5927aa[_0xfa7e('0xb2')]));}}})['catch'](handleError(_0x141a7d,null));};exports[_0xfa7e('0xbb')]=function(_0x50f54e,_0x9d0150,_0x5ae901){var _0x498b59={};var _0x211305={};var _0x2cff88;var _0x111587;return db[_0xfa7e('0x62')]['findOne']({'where':{'id':_0x50f54e[_0xfa7e('0x64')]['id']}})['then'](handleEntityNotFound(_0x9d0150,null))[_0xfa7e('0x23')](function(_0x4a2ce0){if(_0x4a2ce0){_0x2cff88=_0x4a2ce0;_0x211305[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db[_0xfa7e('0xbc')][_0xfa7e('0x49')]);_0x211305['query']=_[_0xfa7e('0x51')](_0x50f54e[_0xfa7e('0x50')]);_0x211305[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x211305[_0xfa7e('0x4c')],_0x211305[_0xfa7e('0x50')]);_0x498b59[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x211305['model'],qs[_0xfa7e('0x54')](_0x50f54e[_0xfa7e('0x50')]['fields']));_0x498b59['attributes']=_0x498b59[_0xfa7e('0x53')]['length']?_0x498b59[_0xfa7e('0x53')]:_0x211305[_0xfa7e('0x4c')];_0x498b59[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x50f54e['query'][_0xfa7e('0x5a')]);_0x498b59['where']=qs[_0xfa7e('0x5c')](_[_0xfa7e('0x5d')](_0x50f54e[_0xfa7e('0x50')],_0x211305[_0xfa7e('0x5c')]));if(_0x50f54e['query']['filter']){_0x498b59[_0xfa7e('0x5b')]=_[_0xfa7e('0x5e')](_0x498b59[_0xfa7e('0x5b')],{'$or':_[_0xfa7e('0x3f')](_0x498b59[_0xfa7e('0x53')],function(_0x4abe28){var _0x1705ad={};_0x1705ad[_0x4abe28]={'$like':'%'+_0x50f54e['query'][_0xfa7e('0x3d')]+'%'};return _0x1705ad;})});}_0x498b59=_[_0xfa7e('0x5e')]({},_0x498b59,_0x50f54e['options']);return _0x2cff88[_0xfa7e('0xbb')](_0x498b59);}})['then'](function(_0x53edf7){if(_0x53edf7){_0x111587=_0x53edf7[_0xfa7e('0x55')];if(_0x50f54e['query'][_0xfa7e('0x56')](_0xfa7e('0x65'))){_0x498b59[_0xfa7e('0xbd')]=[{'model':db['CmList'],'as':_0xfa7e('0xbe'),'required':![]},{'model':db[_0xfa7e('0xbf')],'as':_0xfa7e('0xc0'),'attributes':['id',_0xfa7e('0x43'),_0xfa7e('0xc1')],'where':_0x50f54e[_0xfa7e('0x50')][_0xfa7e('0xc2')]?{'id':_0x50f54e[_0xfa7e('0x50')]['tag']}:undefined,'required':_0x50f54e['query'][_0xfa7e('0xc2')]?!![]:![]}];}if(!_0x50f54e[_0xfa7e('0x50')]['hasOwnProperty'](_0xfa7e('0x57'))){_0x498b59[_0xfa7e('0x58')]=qs[_0xfa7e('0x58')](_0x50f54e[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x498b59[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x50f54e[_0xfa7e('0x50')][_0xfa7e('0x32')]);}return _0x2cff88[_0xfa7e('0xbb')](_0x498b59);}})['then'](function(_0x182c18){if(_0x182c18){return _0x182c18?{'count':_0x111587,'rows':_0x182c18}:null;}})[_0xfa7e('0x23')](respondWithResult(_0x9d0150,null))[_0xfa7e('0x2e')](handleError(_0x9d0150,null));};exports[_0xfa7e('0xc3')]=function(_0x7a133a,_0x27637d,_0x5d736f){var _0x1258ba;var _0x4f6969;var _0x16e3f5={};var _0x31a392;return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x7a133a['params']['id']},'attributes':['id','name',_0xfa7e('0x42')]})[_0xfa7e('0x23')](handleEntityNotFound(_0x27637d,null))[_0xfa7e('0x23')](function(_0x3f4b35){if(!utils[_0xfa7e('0xae')](_0x7a133a[_0xfa7e('0x50')][_0xfa7e('0xad')])){throw new db[(_0xfa7e('0x93'))][(_0xfa7e('0x94'))]('Unknown\x20channel');}_0x1258ba=_0x3f4b35;var _0x24bd9d={};_0x24bd9d[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db[_['capitalize'](_0x7a133a[_0xfa7e('0x50')]['channel'])+_0xfa7e('0xc4')][_0xfa7e('0x49')]);_0x24bd9d['query']=_[_0xfa7e('0x51')](_0x7a133a[_0xfa7e('0x50')]);_0x24bd9d[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x24bd9d[_0xfa7e('0x4c')],_0x24bd9d['query']);_0x16e3f5[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x24bd9d['model'],qs[_0xfa7e('0x54')](_0x7a133a[_0xfa7e('0x50')]['fields']));_0x16e3f5[_0xfa7e('0x53')]=_0x16e3f5[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x16e3f5[_0xfa7e('0x53')]:_0x24bd9d[_0xfa7e('0x4c')];_0x16e3f5[_0xfa7e('0x59')]=qs['sort'](_0x7a133a['query'][_0xfa7e('0x5a')]);_0x16e3f5['where']=qs[_0xfa7e('0x5c')](_['pick'](_0x7a133a[_0xfa7e('0x50')],_0x24bd9d[_0xfa7e('0x5c')]));if(_0x7a133a[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x16e3f5[_0xfa7e('0x5b')]=_['merge'](_0x16e3f5[_0xfa7e('0x5b')],{'$or':_['map'](_0x16e3f5[_0xfa7e('0x53')],function(_0x5172ff){var _0x1c0c6e={};_0x1c0c6e[_0x5172ff]={'$like':'%'+_0x7a133a['query'][_0xfa7e('0x3d')]+'%'};return _0x1c0c6e;})});}_0x16e3f5=_[_0xfa7e('0x5e')]({},_0x16e3f5,_0x7a133a[_0xfa7e('0x61')]);switch(_0x1258ba['role']){case _0xfa7e('0x97'):return db[_[_0xfa7e('0xa2')](_0x7a133a[_0xfa7e('0x50')]['channel'])+_0xfa7e('0xc4')][_0xfa7e('0xa5')](_0x16e3f5);case'user':case _0xfa7e('0x3a'):return _0x1258ba[_0xfa7e('0x36')+_[_0xfa7e('0xa2')](_0x7a133a[_0xfa7e('0x50')][_0xfa7e('0xad')])+_0xfa7e('0xaf')](_0x16e3f5);default:throw new db[(_0xfa7e('0x93'))][(_0xfa7e('0x94'))](_0xfa7e('0xc5'));}})[_0xfa7e('0x23')](function(_0x46f39c){_0x31a392=_0x46f39c['length'];if(!_0x7a133a[_0xfa7e('0x50')][_0xfa7e('0x56')]('nolimit')){_0x16e3f5[_0xfa7e('0x58')]=qs[_0xfa7e('0x58')](_0x7a133a[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x16e3f5['offset']=qs[_0xfa7e('0x32')](_0x7a133a[_0xfa7e('0x50')]['offset']);}switch(_0x1258ba[_0xfa7e('0x42')]){case'admin':return db[_[_0xfa7e('0xa2')](_0x7a133a[_0xfa7e('0x50')][_0xfa7e('0xad')])+'Queue'][_0xfa7e('0xa5')](_0x16e3f5);case _0xfa7e('0x38'):case'agent':return _0x1258ba[_0xfa7e('0x36')+_[_0xfa7e('0xa2')](_0x7a133a[_0xfa7e('0x50')][_0xfa7e('0xad')])+_0xfa7e('0xaf')](_0x16e3f5);}})[_0xfa7e('0x23')](function(_0x1fff56){return{'count':_0x31a392,'rows':_0x1fff56};})[_0xfa7e('0x23')](respondWithResult(_0x27637d,null))['catch'](handleError(_0x27637d,null));};exports[_0xfa7e('0xc6')]=function(_0x22f184,_0x2cc586,_0x3a0786){var _0x1f71d1={};var _0x56cf57={};var _0x5dabfd;var _0x32c441;return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x22f184[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x2cc586,null))[_0xfa7e('0x23')](function(_0x1dbae0){if(_0x1dbae0){_0x5dabfd=_0x1dbae0;_0x56cf57[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db[_0xfa7e('0xb1')]['rawAttributes']);_0x56cf57[_0xfa7e('0x50')]=_[_0xfa7e('0x51')](_0x22f184[_0xfa7e('0x50')]);_0x56cf57['filters']=_[_0xfa7e('0x52')](_0x56cf57[_0xfa7e('0x4c')],_0x56cf57['query']);_0x1f71d1[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x56cf57['model'],qs['fields'](_0x22f184[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x1f71d1[_0xfa7e('0x53')]=_0x1f71d1[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x1f71d1[_0xfa7e('0x53')]:_0x56cf57[_0xfa7e('0x4c')];_0x1f71d1['order']=qs[_0xfa7e('0x5a')](_0x22f184[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x1f71d1['where']=qs[_0xfa7e('0x5c')](_[_0xfa7e('0x5d')](_0x22f184[_0xfa7e('0x50')],_0x56cf57[_0xfa7e('0x5c')]));if(_0x22f184['query']['filter']){_0x1f71d1['where']=_[_0xfa7e('0x5e')](_0x1f71d1['where'],{'$or':_['map'](_0x1f71d1[_0xfa7e('0x53')],function(_0x59b6d3){var _0xd5bc10={};_0xd5bc10[_0x59b6d3]={'$like':'%'+_0x22f184[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0xd5bc10;})});}_0x1f71d1=_['merge']({},_0x1f71d1,_0x22f184[_0xfa7e('0x61')]);return _0x5dabfd[_0xfa7e('0xc6')](_0x1f71d1);}})[_0xfa7e('0x23')](function(_0x8e94e2){if(_0x8e94e2){_0x32c441=_0x8e94e2['length'];if(!_0x22f184[_0xfa7e('0x50')][_0xfa7e('0x56')](_0xfa7e('0x57'))){_0x1f71d1[_0xfa7e('0x58')]=qs[_0xfa7e('0x58')](_0x22f184[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x1f71d1['offset']=qs[_0xfa7e('0x32')](_0x22f184[_0xfa7e('0x50')][_0xfa7e('0x32')]);}return _0x5dabfd[_0xfa7e('0xc6')](_0x1f71d1);}})[_0xfa7e('0x23')](function(_0xcaea77){if(_0xcaea77){return _0xcaea77?{'count':_0x32c441,'rows':_0xcaea77}:null;}})[_0xfa7e('0x23')](respondWithResult(_0x2cc586,null))['catch'](handleError(_0x2cc586,null));};exports['getGroups']=function(_0x457b50,_0x58bf07,_0x559e96){var _0x428a98={};var _0x2477e4={};var _0x404eea;var _0x58a912;return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x457b50[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x58bf07,null))[_0xfa7e('0x23')](function(_0xb7785a){if(_0xb7785a){_0x404eea=_0xb7785a;_0x2477e4['model']=_['keys'](db['ChatGroup'][_0xfa7e('0x49')]);_0x2477e4['query']=_[_0xfa7e('0x51')](_0x457b50[_0xfa7e('0x50')]);_0x2477e4['filters']=_['intersection'](_0x2477e4['model'],_0x2477e4['query']);_0x428a98[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x2477e4[_0xfa7e('0x4c')],qs[_0xfa7e('0x54')](_0x457b50[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x428a98[_0xfa7e('0x53')]=_0x428a98[_0xfa7e('0x53')]['length']?_0x428a98[_0xfa7e('0x53')]:_0x2477e4[_0xfa7e('0x4c')];_0x428a98[_0xfa7e('0x59')]=qs['sort'](_0x457b50['query'][_0xfa7e('0x5a')]);_0x428a98['where']=qs[_0xfa7e('0x5c')](_['pick'](_0x457b50[_0xfa7e('0x50')],_0x2477e4[_0xfa7e('0x5c')]));if(_0x457b50[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x428a98[_0xfa7e('0x5b')]=_['merge'](_0x428a98[_0xfa7e('0x5b')],{'$or':_[_0xfa7e('0x3f')](_0x428a98[_0xfa7e('0x53')],function(_0x27cf3b){var _0x2b8e2f={};_0x2b8e2f[_0x27cf3b]={'$like':'%'+_0x457b50[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0x2b8e2f;})});}_0x428a98=_['merge']({},_0x428a98,_0x457b50[_0xfa7e('0x61')]);return _0x404eea[_0xfa7e('0xc7')](_0x428a98);}})['then'](function(_0x3d077b){if(_0x3d077b){_0x58a912=_0x3d077b[_0xfa7e('0x55')];if(!_0x457b50['query'][_0xfa7e('0x56')](_0xfa7e('0x57'))){_0x428a98['limit']=qs[_0xfa7e('0x58')](_0x457b50['query'][_0xfa7e('0x58')]);_0x428a98[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x457b50[_0xfa7e('0x50')]['offset']);}return _0x404eea['getGroups'](_0x428a98);}})[_0xfa7e('0x23')](function(_0x35a689){if(_0x35a689){return _0x35a689?{'count':_0x58a912,'rows':_0x35a689}:null;}})[_0xfa7e('0x23')](respondWithResult(_0x58bf07,null))[_0xfa7e('0x2e')](handleError(_0x58bf07,null));};exports[_0xfa7e('0xc8')]=function(_0x3a094b,_0x8616f2,_0x3fdc57){var _0x318636={'raw':!![],'where':{}};var _0x97b840={};var _0x40db13={'count':0x0,'rows':[]};return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x3a094b['params']['id']}})['then'](handleEntityNotFound(_0x8616f2,null))['then'](function(_0x2b661c){if(_0x2b661c){_0x97b840[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db[_0xfa7e('0xc9')]['rawAttributes']);_0x97b840['query']=_[_0xfa7e('0x51')](_0x3a094b[_0xfa7e('0x50')]);_0x97b840['filters']=_[_0xfa7e('0x52')](_0x97b840[_0xfa7e('0x4c')],_0x97b840['query']);_0x318636['attributes']=_['intersection'](_0x97b840[_0xfa7e('0x4c')],qs[_0xfa7e('0x54')](_0x3a094b['query']['fields']));_0x318636[_0xfa7e('0x53')]=_0x318636[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x318636[_0xfa7e('0x53')]:_0x97b840[_0xfa7e('0x4c')];if(!_0x3a094b['query'][_0xfa7e('0x56')]('nolimit')){_0x318636['limit']=qs['limit'](_0x3a094b[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x318636[_0xfa7e('0x32')]=qs['offset'](_0x3a094b[_0xfa7e('0x50')][_0xfa7e('0x32')]);}_0x318636[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x3a094b[_0xfa7e('0x50')]['sort']);_0x318636[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_[_0xfa7e('0x5d')](_0x3a094b[_0xfa7e('0x50')],_0x97b840[_0xfa7e('0x5c')]));_0x318636[_0xfa7e('0x5b')][_0xfa7e('0xca')]=_0x2b661c['id'];if(_0x3a094b['query'][_0xfa7e('0x3d')]){_0x318636[_0xfa7e('0x5b')]=_[_0xfa7e('0x5e')](_0x318636['where'],{'$or':_[_0xfa7e('0x3f')](_0x318636[_0xfa7e('0x53')],function(_0x4300e6){var _0x1260bf={};_0x1260bf[_0x4300e6]={'$like':'%'+_0x3a094b['query'][_0xfa7e('0x3d')]+'%'};return _0x1260bf;})});}_0x318636=_['merge']({},_0x318636,_0x3a094b[_0xfa7e('0x61')]);return db[_0xfa7e('0xc9')][_0xfa7e('0x31')]({'where':_0x318636['where']})['then'](function(_0x198789){_0x40db13[_0xfa7e('0x31')]=_0x198789;if(_0x3a094b[_0xfa7e('0x50')][_0xfa7e('0x65')]){_0x318636[_0xfa7e('0xbd')]=[{'all':!![]}];}return db[_0xfa7e('0xc9')]['findAll'](_0x318636);})[_0xfa7e('0x23')](function(_0x3d3b61){_0x40db13[_0xfa7e('0xcb')]=_0x3d3b61;return _0x40db13;});}})[_0xfa7e('0x23')](respondWithFilteredResult(_0x8616f2,_0x318636))[_0xfa7e('0x2e')](handleError(_0x8616f2,null));};exports[_0xfa7e('0xcc')]=function(_0x1eb883,_0x1e6275,_0x38b088){var _0x208b60={'raw':!![],'where':{}};var _0x4f3388={};var _0x86f10a={'count':0x0,'rows':[]};return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x1eb883[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x1e6275,null))[_0xfa7e('0x23')](function(_0x1d3d6f){if(_0x1d3d6f){_0x4f3388[_0xfa7e('0x4c')]=_['keys'](db[_0xfa7e('0xcd')][_0xfa7e('0x49')]);_0x4f3388['query']=_[_0xfa7e('0x51')](_0x1eb883[_0xfa7e('0x50')]);_0x4f3388[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x4f3388[_0xfa7e('0x4c')],_0x4f3388[_0xfa7e('0x50')]);_0x208b60['attributes']=_['intersection'](_0x4f3388[_0xfa7e('0x4c')],qs[_0xfa7e('0x54')](_0x1eb883[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x208b60[_0xfa7e('0x53')]=_0x208b60[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x208b60[_0xfa7e('0x53')]:_0x4f3388[_0xfa7e('0x4c')];if(!_0x1eb883[_0xfa7e('0x50')]['hasOwnProperty']('nolimit')){_0x208b60[_0xfa7e('0x58')]=qs['limit'](_0x1eb883[_0xfa7e('0x50')]['limit']);_0x208b60[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x1eb883[_0xfa7e('0x50')][_0xfa7e('0x32')]);}_0x208b60[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x1eb883[_0xfa7e('0x50')]['sort']);_0x208b60[_0xfa7e('0x5b')]=qs['filters'](_[_0xfa7e('0x5d')](_0x1eb883[_0xfa7e('0x50')],_0x4f3388[_0xfa7e('0x5c')]));_0x208b60[_0xfa7e('0x5b')][_0xfa7e('0xca')]=_0x1d3d6f['id'];if(_0x1eb883[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x208b60[_0xfa7e('0x5b')]=_['merge'](_0x208b60['where'],{'$or':_[_0xfa7e('0x3f')](_0x208b60[_0xfa7e('0x53')],function(_0x1ad5f8){var _0x5d713a={};_0x5d713a[_0x1ad5f8]={'$like':'%'+_0x1eb883[_0xfa7e('0x50')]['filter']+'%'};return _0x5d713a;})});}_0x208b60=_['merge']({},_0x208b60,_0x1eb883[_0xfa7e('0x61')]);return db[_0xfa7e('0xcd')][_0xfa7e('0x31')]({'where':_0x208b60[_0xfa7e('0x5b')]})[_0xfa7e('0x23')](function(_0x3e28d6){_0x86f10a[_0xfa7e('0x31')]=_0x3e28d6;if(_0x1eb883[_0xfa7e('0x50')][_0xfa7e('0x65')]){_0x208b60[_0xfa7e('0xbd')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfa7e('0xa5')](_0x208b60);})[_0xfa7e('0x23')](function(_0x360ea8){_0x86f10a[_0xfa7e('0xcb')]=_0x360ea8;return _0x86f10a;});}})[_0xfa7e('0x23')](respondWithFilteredResult(_0x1e6275,_0x208b60))['catch'](handleError(_0x1e6275,null));};exports[_0xfa7e('0xce')]=function(_0x4c946f,_0x3df558,_0x306e3e){var _0x1097a1={};var _0x51f0e2={};var _0x5751d7;var _0x304fda;return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x4c946f[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x3df558,null))['then'](function(_0x1d9008){if(_0x1d9008){_0x5751d7=_0x1d9008;_0x51f0e2[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db[_0xfa7e('0xcf')][_0xfa7e('0x49')]);_0x51f0e2['query']=_[_0xfa7e('0x51')](_0x4c946f[_0xfa7e('0x50')]);_0x51f0e2[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x51f0e2['model'],_0x51f0e2['query']);_0x1097a1[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x51f0e2[_0xfa7e('0x4c')],qs['fields'](_0x4c946f[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x1097a1[_0xfa7e('0x53')]=_0x1097a1[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x1097a1[_0xfa7e('0x53')]:_0x51f0e2[_0xfa7e('0x4c')];_0x1097a1[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x4c946f[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x1097a1[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_['pick'](_0x4c946f[_0xfa7e('0x50')],_0x51f0e2['filters']));if(_0x4c946f[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x1097a1[_0xfa7e('0x5b')]=_[_0xfa7e('0x5e')](_0x1097a1['where'],{'$or':_[_0xfa7e('0x3f')](_0x1097a1[_0xfa7e('0x53')],function(_0x427267){var _0x1e5ea9={};_0x1e5ea9[_0x427267]={'$like':'%'+_0x4c946f[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0x1e5ea9;})});}_0x1097a1=_[_0xfa7e('0x5e')]({},_0x1097a1,_0x4c946f['options']);return _0x5751d7[_0xfa7e('0xce')](_0x1097a1);}})[_0xfa7e('0x23')](function(_0x1f272b){if(_0x1f272b){_0x304fda=_0x1f272b[_0xfa7e('0x55')];if(!_0x4c946f['query']['hasOwnProperty']('nolimit')){_0x1097a1[_0xfa7e('0x58')]=qs['limit'](_0x4c946f[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x1097a1[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x4c946f[_0xfa7e('0x50')]['offset']);}return _0x5751d7[_0xfa7e('0xce')](_0x1097a1);}})[_0xfa7e('0x23')](function(_0x1004f8){if(_0x1004f8){return _0x1004f8?{'count':_0x304fda,'rows':_0x1004f8}:null;}})[_0xfa7e('0x23')](respondWithResult(_0x3df558,null))['catch'](handleError(_0x3df558,null));};exports['getOpenchannelInteractions']=function(_0x1e8e82,_0xd2ba13,_0x1832ca){var _0x317d2c={};var _0x2adb84={};var _0x4ded2f;var _0x2672cf;return db['User'][_0xfa7e('0x90')]({'where':{'id':_0x1e8e82['params']['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0xd2ba13,null))[_0xfa7e('0x23')](function(_0x248add){if(_0x248add){_0x4ded2f=_0x248add;_0x2adb84['model']=_[_0xfa7e('0x51')](db[_0xfa7e('0xd0')][_0xfa7e('0x49')]);_0x2adb84[_0xfa7e('0x50')]=_['keys'](_0x1e8e82['query']);_0x2adb84[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x2adb84[_0xfa7e('0x4c')],_0x2adb84['query']);_0x317d2c[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x2adb84['model'],qs[_0xfa7e('0x54')](_0x1e8e82['query']['fields']));_0x317d2c[_0xfa7e('0x53')]=_0x317d2c[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x317d2c[_0xfa7e('0x53')]:_0x2adb84['model'];_0x317d2c['order']=qs[_0xfa7e('0x5a')](_0x1e8e82[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x317d2c[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_[_0xfa7e('0x5d')](_0x1e8e82[_0xfa7e('0x50')],_0x2adb84[_0xfa7e('0x5c')]));if(_0x1e8e82[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x317d2c[_0xfa7e('0x5b')]=_['merge'](_0x317d2c[_0xfa7e('0x5b')],{'$or':_[_0xfa7e('0x3f')](_0x317d2c[_0xfa7e('0x53')],function(_0x1a2ab1){var _0x4496ac={};_0x4496ac[_0x1a2ab1]={'$like':'%'+_0x1e8e82[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0x4496ac;})});}_0x317d2c=_[_0xfa7e('0x5e')]({},_0x317d2c,_0x1e8e82['options']);return _0x4ded2f[_0xfa7e('0xd1')](_0x317d2c);}})[_0xfa7e('0x23')](function(_0x4299c6){if(_0x4299c6){_0x2672cf=_0x4299c6[_0xfa7e('0x55')];if(!_0x1e8e82['query'][_0xfa7e('0x56')](_0xfa7e('0x57'))){_0x317d2c[_0xfa7e('0x58')]=qs['limit'](_0x1e8e82[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x317d2c[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x1e8e82[_0xfa7e('0x50')][_0xfa7e('0x32')]);}return _0x4ded2f[_0xfa7e('0xd1')](_0x317d2c);}})[_0xfa7e('0x23')](function(_0x374ce5){if(_0x374ce5){return _0x374ce5?{'count':_0x2672cf,'rows':_0x374ce5}:null;}})['then'](respondWithResult(_0xd2ba13,null))[_0xfa7e('0x2e')](handleError(_0xd2ba13,null));};exports['getMailInteractions']=function(_0x1aa7fd,_0x2d142e,_0x23e479){var _0x95c7a5={'raw':!![],'where':{}};var _0x10751c={};var _0x5f2006={'count':0x0,'rows':[]};return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x1aa7fd[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x2d142e,null))[_0xfa7e('0x23')](function(_0x458eab){if(_0x458eab){_0x10751c[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db['MailInteraction']['rawAttributes']);_0x10751c[_0xfa7e('0x50')]=_[_0xfa7e('0x51')](_0x1aa7fd[_0xfa7e('0x50')]);_0x10751c[_0xfa7e('0x5c')]=_['intersection'](_0x10751c[_0xfa7e('0x4c')],_0x10751c['query']);_0x95c7a5['attributes']=_[_0xfa7e('0x52')](_0x10751c[_0xfa7e('0x4c')],qs['fields'](_0x1aa7fd[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x95c7a5[_0xfa7e('0x53')]=_0x95c7a5[_0xfa7e('0x53')]['length']?_0x95c7a5[_0xfa7e('0x53')]:_0x10751c['model'];if(!_0x1aa7fd[_0xfa7e('0x50')]['hasOwnProperty'](_0xfa7e('0x57'))){_0x95c7a5[_0xfa7e('0x58')]=qs[_0xfa7e('0x58')](_0x1aa7fd[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x95c7a5[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x1aa7fd[_0xfa7e('0x50')][_0xfa7e('0x32')]);}_0x95c7a5[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x1aa7fd[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x95c7a5[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_['pick'](_0x1aa7fd['query'],_0x10751c[_0xfa7e('0x5c')]));_0x95c7a5['where']['UserId']=_0x458eab['id'];if(_0x1aa7fd[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x95c7a5[_0xfa7e('0x5b')]=_[_0xfa7e('0x5e')](_0x95c7a5[_0xfa7e('0x5b')],{'$or':_[_0xfa7e('0x3f')](_0x95c7a5[_0xfa7e('0x53')],function(_0x401c50){var _0x675493={};_0x675493[_0x401c50]={'$like':'%'+_0x1aa7fd[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0x675493;})});}_0x95c7a5=_[_0xfa7e('0x5e')]({},_0x95c7a5,_0x1aa7fd['options']);return db[_0xfa7e('0xd2')][_0xfa7e('0x31')]({'where':_0x95c7a5[_0xfa7e('0x5b')]})[_0xfa7e('0x23')](function(_0x25b8e1){_0x5f2006[_0xfa7e('0x31')]=_0x25b8e1;if(_0x1aa7fd[_0xfa7e('0x50')][_0xfa7e('0x65')]){_0x95c7a5[_0xfa7e('0xbd')]=[{'all':!![]}];}return db[_0xfa7e('0xd2')][_0xfa7e('0xa5')](_0x95c7a5);})[_0xfa7e('0x23')](function(_0x303895){_0x5f2006[_0xfa7e('0xcb')]=_0x303895;return _0x5f2006;});}})[_0xfa7e('0x23')](respondWithFilteredResult(_0x2d142e,_0x95c7a5))[_0xfa7e('0x2e')](handleError(_0x2d142e,null));};exports[_0xfa7e('0xd3')]=function(_0x1e2793,_0x1f9f37,_0x3668e3){var _0x131956={};var _0x56057b={};var _0x30c15f;var _0x90f701;return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x1e2793[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x1f9f37,null))[_0xfa7e('0x23')](function(_0x1ba352){if(_0x1ba352){_0x30c15f=_0x1ba352;_0x56057b[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db[_0xfa7e('0xd4')]['rawAttributes']);_0x56057b['query']=_[_0xfa7e('0x51')](_0x1e2793[_0xfa7e('0x50')]);_0x56057b[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x56057b['model'],_0x56057b[_0xfa7e('0x50')]);_0x131956['attributes']=_[_0xfa7e('0x52')](_0x56057b[_0xfa7e('0x4c')],qs[_0xfa7e('0x54')](_0x1e2793['query'][_0xfa7e('0x54')]));_0x131956[_0xfa7e('0x53')]=_0x131956['attributes'][_0xfa7e('0x55')]?_0x131956[_0xfa7e('0x53')]:_0x56057b['model'];_0x131956[_0xfa7e('0x59')]=qs['sort'](_0x1e2793[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x131956[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_['pick'](_0x1e2793[_0xfa7e('0x50')],_0x56057b[_0xfa7e('0x5c')]));if(_0x1e2793['query']['filter']){_0x131956[_0xfa7e('0x5b')]=_['merge'](_0x131956['where'],{'$or':_[_0xfa7e('0x3f')](_0x131956[_0xfa7e('0x53')],function(_0x381d46){var _0x3cfd3e={};_0x3cfd3e[_0x381d46]={'$like':'%'+_0x1e2793[_0xfa7e('0x50')]['filter']+'%'};return _0x3cfd3e;})});}_0x131956=_[_0xfa7e('0x5e')]({},_0x131956,_0x1e2793[_0xfa7e('0x61')]);return _0x30c15f['getSmsInteractions'](_0x131956);}})['then'](function(_0x289e33){if(_0x289e33){_0x90f701=_0x289e33[_0xfa7e('0x55')];if(!_0x1e2793[_0xfa7e('0x50')][_0xfa7e('0x56')]('nolimit')){_0x131956[_0xfa7e('0x58')]=qs[_0xfa7e('0x58')](_0x1e2793[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x131956['offset']=qs[_0xfa7e('0x32')](_0x1e2793[_0xfa7e('0x50')][_0xfa7e('0x32')]);}return _0x30c15f['getSmsInteractions'](_0x131956);}})[_0xfa7e('0x23')](function(_0x15961e){if(_0x15961e){return _0x15961e?{'count':_0x90f701,'rows':_0x15961e}:null;}})['then'](respondWithResult(_0x1f9f37,null))[_0xfa7e('0x2e')](handleError(_0x1f9f37,null));};exports[_0xfa7e('0xd5')]=function(_0x3815ab,_0x2f81cc,_0x524617){var _0x249dbb={};var _0x1a595b={};var _0x5ba952;var _0x12f059;return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x3815ab['params']['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x2f81cc,null))[_0xfa7e('0x23')](function(_0x23a999){if(_0x23a999){_0x5ba952=_0x23a999;_0x1a595b['model']=_[_0xfa7e('0x51')](db[_0xfa7e('0xd6')][_0xfa7e('0x49')]);_0x1a595b['query']=_[_0xfa7e('0x51')](_0x3815ab['query']);_0x1a595b[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x1a595b[_0xfa7e('0x4c')],_0x1a595b['query']);_0x249dbb[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x1a595b['model'],qs[_0xfa7e('0x54')](_0x3815ab[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x249dbb[_0xfa7e('0x53')]=_0x249dbb[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x249dbb[_0xfa7e('0x53')]:_0x1a595b['model'];_0x249dbb['order']=qs[_0xfa7e('0x5a')](_0x3815ab[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x249dbb['where']=qs[_0xfa7e('0x5c')](_['pick'](_0x3815ab['query'],_0x1a595b[_0xfa7e('0x5c')]));if(_0x3815ab['query']['filter']){_0x249dbb[_0xfa7e('0x5b')]=_[_0xfa7e('0x5e')](_0x249dbb[_0xfa7e('0x5b')],{'$or':_[_0xfa7e('0x3f')](_0x249dbb[_0xfa7e('0x53')],function(_0x30acd4){var _0x2d39cc={};_0x2d39cc[_0x30acd4]={'$like':'%'+_0x3815ab[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0x2d39cc;})});}_0x249dbb=_[_0xfa7e('0x5e')]({},_0x249dbb,_0x3815ab['options']);return _0x5ba952['getFaxInteractions'](_0x249dbb);}})[_0xfa7e('0x23')](function(_0x25aa30){if(_0x25aa30){_0x12f059=_0x25aa30[_0xfa7e('0x55')];if(!_0x3815ab[_0xfa7e('0x50')]['hasOwnProperty'](_0xfa7e('0x57'))){_0x249dbb[_0xfa7e('0x58')]=qs[_0xfa7e('0x58')](_0x3815ab[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x249dbb['offset']=qs['offset'](_0x3815ab['query'][_0xfa7e('0x32')]);}return _0x5ba952[_0xfa7e('0xd5')](_0x249dbb);}})['then'](function(_0x338ed7){if(_0x338ed7){return _0x338ed7?{'count':_0x12f059,'rows':_0x338ed7}:null;}})[_0xfa7e('0x23')](respondWithResult(_0x2f81cc,null))[_0xfa7e('0x2e')](handleError(_0x2f81cc,null));};exports[_0xfa7e('0xd7')]=function(_0x1f70b2,_0x1043f0,_0x1d5279){var _0x2101c1={};var _0x813bd={};var _0x55115f;var _0x43d4d6;return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x1f70b2[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x1043f0,null))[_0xfa7e('0x23')](function(_0x29b201){if(_0x29b201){_0x55115f=_0x29b201;_0x813bd[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db[_0xfa7e('0xd8')][_0xfa7e('0x49')]);_0x813bd[_0xfa7e('0x50')]=_[_0xfa7e('0x51')](_0x1f70b2[_0xfa7e('0x50')]);_0x813bd[_0xfa7e('0x5c')]=_['intersection'](_0x813bd[_0xfa7e('0x4c')],_0x813bd[_0xfa7e('0x50')]);_0x2101c1[_0xfa7e('0x53')]=_['intersection'](_0x813bd[_0xfa7e('0x4c')],qs['fields'](_0x1f70b2[_0xfa7e('0x50')]['fields']));_0x2101c1[_0xfa7e('0x53')]=_0x2101c1[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x2101c1[_0xfa7e('0x53')]:_0x813bd[_0xfa7e('0x4c')];_0x2101c1[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x1f70b2[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x2101c1[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_[_0xfa7e('0x5d')](_0x1f70b2[_0xfa7e('0x50')],_0x813bd[_0xfa7e('0x5c')]));if(_0x1f70b2[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x2101c1[_0xfa7e('0x5b')]=_[_0xfa7e('0x5e')](_0x2101c1[_0xfa7e('0x5b')],{'$or':_[_0xfa7e('0x3f')](_0x2101c1[_0xfa7e('0x53')],function(_0x110466){var _0x3e51a6={};_0x3e51a6[_0x110466]={'$like':'%'+_0x1f70b2[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0x3e51a6;})});}_0x2101c1=_[_0xfa7e('0x5e')]({},_0x2101c1,_0x1f70b2[_0xfa7e('0x61')]);return _0x55115f['getWhatsappInteractions'](_0x2101c1);}})['then'](function(_0x3eb2c4){if(_0x3eb2c4){_0x43d4d6=_0x3eb2c4[_0xfa7e('0x55')];if(!_0x1f70b2[_0xfa7e('0x50')][_0xfa7e('0x56')](_0xfa7e('0x57'))){_0x2101c1['limit']=qs['limit'](_0x1f70b2[_0xfa7e('0x50')]['limit']);_0x2101c1[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x1f70b2[_0xfa7e('0x50')]['offset']);}return _0x55115f[_0xfa7e('0xd7')](_0x2101c1);}})[_0xfa7e('0x23')](function(_0x1e01a3){if(_0x1e01a3){return _0x1e01a3?{'count':_0x43d4d6,'rows':_0x1e01a3}:null;}})[_0xfa7e('0x23')](respondWithResult(_0x1043f0,null))[_0xfa7e('0x2e')](handleError(_0x1043f0,null));};exports['login']=function(_0x460bab,_0x5aaf4f,_0x389d68){var _0x40a1db;var _0x35e194;var _0x2d55c9;var _0xf52b00=!_[_0xfa7e('0x70')](_0x460bab[_0xfa7e('0x64')]['id'])?_0x460bab['params']['id']:!_['isNil'](_0x460bab[_0xfa7e('0x38')]['id'])?_0x460bab[_0xfa7e('0x38')]['id']:null;return db[_0xfa7e('0x62')][_0xfa7e('0x66')]({'where':{'id':_0xf52b00,'role':{'$or':[_0xfa7e('0x97'),_0xfa7e('0x38'),_0xfa7e('0x3a')]}},'attributes':['id',_0xfa7e('0x43'),_0xfa7e('0xd9'),_0xfa7e('0xda'),'role','internal',_0xfa7e('0x9b')]})[_0xfa7e('0x23')](function(_0x2ef654){if(_0x2ef654){if(_0x2ef654[_0xfa7e('0x42')]===_0xfa7e('0x3a')){_0x40a1db=_0x2ef654;if(_0x460bab[_0xfa7e('0x68')][_0xfa7e('0xaa')]){_0x2d55c9=util[_0xfa7e('0xa8')](_0xfa7e('0xdb'),_0x40a1db[_0x460bab[_0xfa7e('0x68')][_0xfa7e('0xaa')]]);}else if(_0x460bab['body'][_0xfa7e('0xdc')]){_0x2d55c9=util['format'](_0xfa7e('0xa9'),_0x460bab['body'][_0xfa7e('0xdc')]);}else{_0x2d55c9=util[_0xfa7e('0xa8')]('SIP/%s',_0x40a1db['name']);}socket['to'](util[_0xfa7e('0xa8')](_0xfa7e('0xdd'),_0x40a1db[_0xfa7e('0x43')]))[_0xfa7e('0xde')](_0xfa7e('0xdf'),{'ip':_0x460bab[_0xfa7e('0xe0')][_0xfa7e('0xe1')]||_0x460bab['connection']['remoteAddress']||_0x460bab[_0xfa7e('0xe2')]['remoteAddress']||_0x460bab['connection'][_0xfa7e('0xe2')][_0xfa7e('0xe3')]});return db['UserVoiceQueueRt'][_0xfa7e('0x44')]({'where':{'membername':_0x40a1db[_0xfa7e('0x43')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xfa7e('0x94'))](_0xfa7e('0xe4'));}})[_0xfa7e('0x23')](function(){if(_0x40a1db){return _0x40a1db[_0xfa7e('0xe5')]({'raw':!![]});}})[_0xfa7e('0x23')](function(_0xe46d79){if(_0x40a1db){var _0x3a9b6d=[];if(_0xe46d79){_0x35e194=_0xe46d79;if(_0x35e194[_0xfa7e('0x55')]){for(var _0x47df8a=0x0;_0x47df8a<_0x35e194[_0xfa7e('0x55')];_0x47df8a++){_0x3a9b6d[_0xfa7e('0xa7')]({'membername':_0x40a1db[_0xfa7e('0x43')],'UserId':_0x40a1db['id'],'queue_name':_0x35e194[_0x47df8a][_0xfa7e('0x43')],'VoiceQueueId':_0x35e194[_0x47df8a]['id'],'interface':_0x2d55c9,'paused':_0x40a1db[_0xfa7e('0x9b')]||![],'penalty':_0x35e194[_0x47df8a]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x3a9b6d,function(_0x1de1da){return db[_0xfa7e('0xb1')][_0xfa7e('0xe6')](_0x1de1da);});}}}})[_0xfa7e('0x23')](function(){if(_0x40a1db){return db['MemberReport'][_0xfa7e('0xa5')]({'where':{'membername':_0x40a1db[_0xfa7e('0x43')],'exitAt':null}});}})[_0xfa7e('0x23')](function(_0x4c7075){if(_0x40a1db){var _0x1299a0=[];_0x4c7075[_0xfa7e('0xe7')](function(_0x3d5d99){_0x1299a0[_0xfa7e('0xa7')](_0x3d5d99[_0xfa7e('0x67')]({'exitAt':moment()['format'](_0xfa7e('0xe8'))}));});return BPromise[_0xfa7e('0xe9')](_0x1299a0);}})[_0xfa7e('0x23')](function(){if(_0x40a1db){var _0x2dd24c=[];var _0x121e9a=[];var _0x2742c6=utils[_0xfa7e('0xea')]();var _0x52204b={'membername':_0x40a1db[_0xfa7e('0x43')],'interface':_0x2d55c9,'enterAt':moment()['format'](_0xfa7e('0xe8')),'role':_0x40a1db['role'],'internal':_0x40a1db['internal']};_0x2742c6[_0xfa7e('0xe7')](function(_0x2466da){_0x2dd24c[_0xfa7e('0xa7')](_['merge']({'channel':_0x2466da,'type':_0xfa7e('0xeb'),'data1':_0x460bab[_0xfa7e('0x68')][_0xfa7e('0xec')],'data2':_0x2d55c9},_0x52204b));if(_0x40a1db[_0xfa7e('0x9b')]){_0x121e9a['push'](_[_0xfa7e('0x5e')]({'channel':_0x2466da,'type':_0xfa7e('0xed'),'data1':_0xfa7e('0xee')},_0x52204b));}});return db[_0xfa7e('0xef')][_0xfa7e('0xf0')](_0x2dd24c[_0xfa7e('0xf1')](_0x121e9a),{'individualHooks':!![]});}})[_0xfa7e('0x23')](function(){if(_0x40a1db){return _0x40a1db[_0xfa7e('0x67')]({'online':!![],'lastLoginAt':moment()[_0xfa7e('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x40a1db[_0xfa7e('0x9b')]||![],'mailPause':_0x40a1db[_0xfa7e('0x9b')]||![],'chatPause':_0x40a1db[_0xfa7e('0x9b')]||![],'faxPause':_0x40a1db[_0xfa7e('0x9b')]||![],'smsPause':_0x40a1db[_0xfa7e('0x9b')]||![],'openchannelPause':_0x40a1db[_0xfa7e('0x9b')]||![],'whatsappPause':_0x40a1db['loginInPause']||![],'pauseType':_0x40a1db[_0xfa7e('0x9b')]?'LOGININPAUSE':null,'interface':_0x2d55c9,'lastPauseAt':moment()[_0xfa7e('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xfa7e('0x23')](function(_0x44ddd7){if(_0x460bab[_0xfa7e('0xf2')]){return _0x389d68();}else{return BPromise[_0xfa7e('0xf3')](_0x44ddd7)[_0xfa7e('0x23')](respondWithResult(_0x5aaf4f,null));}})[_0xfa7e('0x2e')](handleError(_0x5aaf4f,null));};exports[_0xfa7e('0xf4')]=function(_0x130bc0,_0x56d4da,_0xa2f454){var _0x474bc8;return db[_0xfa7e('0x62')][_0xfa7e('0x66')]({'where':{'id':_0x130bc0['params']['id'],'role':'agent'},'attributes':['id','name',_0xfa7e('0x42')]})[_0xfa7e('0x23')](handleEntityNotFound(_0x56d4da,null))[_0xfa7e('0x23')](function(_0x36c29e){if(_0x36c29e){_0x474bc8=_0x36c29e;return db[_0xfa7e('0xb1')]['destroy']({'where':{'membername':_0x474bc8['name']},'individualHooks':!![]});}})[_0xfa7e('0x23')](function(){return db[_0xfa7e('0xef')][_0xfa7e('0xa5')]({'where':{'membername':_0x474bc8[_0xfa7e('0x43')],'exitAt':null}});})['then'](function(_0x29e3f6){var _0xe3613d=[];_0x29e3f6[_0xfa7e('0xe7')](function(_0x2e67a5){_0xe3613d[_0xfa7e('0xa7')](_0x2e67a5[_0xfa7e('0x67')]({'exitAt':moment()[_0xfa7e('0xa8')](_0xfa7e('0xe8'))}));});return BPromise['all'](_0xe3613d);})[_0xfa7e('0x23')](function(){return _0x474bc8[_0xfa7e('0x67')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xfa7e('0x23')](respondWithResult(_0x56d4da,null))['catch'](handleError(_0x56d4da,null));};exports[_0xfa7e('0xf5')]=function(_0x247f82,_0x154e22,_0x1cc89d){var _0x19a671;return db[_0xfa7e('0xb1')][_0xfa7e('0x67')]({'paused':0x1},{'where':{'UserId':_0x247f82['params']['id']},'individualHooks':!![]})[_0xfa7e('0x23')](function(){return db[_0xfa7e('0x62')][_0xfa7e('0x66')]({'where':{'id':_0x247f82[_0xfa7e('0x64')]['id'],'role':_0xfa7e('0x3a')},'attributes':['id',_0xfa7e('0x43'),_0xfa7e('0x42'),'internal',_0xfa7e('0xaa')]});})[_0xfa7e('0x23')](handleEntityNotFound(_0x154e22,null))[_0xfa7e('0x23')](function(_0x8d6cf6){if(_0x8d6cf6){_0x19a671=_0x8d6cf6;return respondWithRpcPromise(_0xfa7e('0xf6'),'pause',{'id':_0x19a671['id'],'name':_0x19a671[_0xfa7e('0x43')],'pause':!![]});}})['then'](function(){if(_0x19a671){return db[_0xfa7e('0xef')][_0xfa7e('0xa5')]({'where':{'membername':_0x19a671[_0xfa7e('0x43')],'type':_0xfa7e('0xed'),'exitAt':null}});}})[_0xfa7e('0x23')](function(_0x1ca829){if(_0x1ca829['length']){var _0x1a94ed=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3b1440=0x0,_0x5a06a8=_0x1ca829[_0xfa7e('0x55')];_0x3b1440<_0x5a06a8;_0x3b1440++){_0x1ca829[_0x3b1440][_0xfa7e('0xf7')]({'exitAt':_0x1a94ed});}}})[_0xfa7e('0x23')](function(){var _0x3bd57d=[];var _0x2a6e15=utils[_0xfa7e('0xea')]();_0x2a6e15[_0xfa7e('0xe7')](function(_0x2a085b){_0x3bd57d['push']({'channel':_0x2a085b,'membername':_0x19a671['name'],'interface':_[_0xfa7e('0x70')](_0x19a671[_0xfa7e('0xaa')])?util[_0xfa7e('0xa8')](_0xfa7e('0xa9'),_0x19a671[_0xfa7e('0x43')]):_0x19a671[_0xfa7e('0xaa')],'type':_0xfa7e('0xed'),'enterAt':moment()['format'](_0xfa7e('0xe8')),'data1':_0x247f82['body'][_0xfa7e('0x4b')]||'DEFAULT\x20PAUSE','role':_0x19a671[_0xfa7e('0x42')],'internal':_0x19a671[_0xfa7e('0x72')]});});return db[_0xfa7e('0xef')][_0xfa7e('0xf0')](_0x3bd57d,{'individualHooks':!![]});})['then'](function(){return _0x19a671[_0xfa7e('0x67')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x247f82[_0xfa7e('0x68')]['type']||_0xfa7e('0xf8'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xfa7e('0x23')](respondWithResult(_0x154e22,null))[_0xfa7e('0x2e')](handleError(_0x154e22,null));};exports[_0xfa7e('0xf9')]=function(_0x216d8c,_0x486b27,_0x71d63){var _0xe88280;return db[_0xfa7e('0x62')][_0xfa7e('0x66')]({'where':{'id':_0x216d8c[_0xfa7e('0x64')]['id']},'attributes':['id',_0xfa7e('0x43'),_0xfa7e('0x42'),_0xfa7e('0x9c'),_0xfa7e('0xfa'),_0xfa7e('0xfb'),'faxPause',_0xfa7e('0xfc'),_0xfa7e('0xfd'),'whatsapppause',_0xfa7e('0xfe'),_0xfa7e('0xff')]})[_0xfa7e('0x23')](handleEntityNotFound(_0x486b27,null))[_0xfa7e('0x23')](function(_0x16be2c){if(_0x16be2c){_0xe88280=_0x16be2c;if(_0x216d8c['body'][_0xfa7e('0xad')]&&!utils[_0xfa7e('0xae')](_0x216d8c['body'][_0xfa7e('0xad')])){throw new db['Sequelize'][(_0xfa7e('0x94'))](_0xfa7e('0x9d'));}switch(_0x216d8c['body'][_0xfa7e('0xad')]){case _0xfa7e('0xa4'):return respondWithRpcPromise(_0xfa7e('0xf6'),_0xfa7e('0xf9'),{'id':_0xe88280['id'],'name':_0xe88280[_0xfa7e('0x43')],'pause':![]})['then'](function(){return db[_0xfa7e('0xb1')][_0xfa7e('0x67')]({'paused':0x0},{'where':{'UserId':_0xe88280['id']},'individualHooks':!![]});})[_0xfa7e('0x23')](function(){return db[_0xfa7e('0xef')][_0xfa7e('0x66')]({'where':{'channel':_0x216d8c[_0xfa7e('0x68')][_0xfa7e('0xad')],'membername':_0xe88280[_0xfa7e('0x43')],'type':_0xfa7e('0xed'),'exitAt':null}});})['then'](function(_0x3b3252){if(_0x3b3252){return _0x3b3252[_0xfa7e('0x67')]({'exitAt':moment()[_0xfa7e('0xa8')](_0xfa7e('0xe8')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xfa7e('0x23')](function(){return _0xe88280[_0xfa7e('0x67')]({'voicePause':![]});});case _0xfa7e('0x100'):case'chat':case'fax':case _0xfa7e('0x101'):case'whatsapp':case _0xfa7e('0x102'):return db[_0xfa7e('0xef')]['find']({'where':{'channel':_0x216d8c[_0xfa7e('0x68')][_0xfa7e('0xad')],'membername':_0xe88280[_0xfa7e('0x43')],'type':'PAUSE','exitAt':null}})[_0xfa7e('0x23')](function(_0x3d864d){if(_0x3d864d){return _0x3d864d[_0xfa7e('0x67')]({'exitAt':moment()[_0xfa7e('0xa8')](_0xfa7e('0xe8')),'data2':_0xfa7e('0x103')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x11142d={};_['set'](_0x11142d,util[_0xfa7e('0xa8')](_0xfa7e('0x104'),_0x216d8c[_0xfa7e('0x68')][_0xfa7e('0xad')],_0xfa7e('0x105')),![]);return _0xe88280[_0xfa7e('0x67')](_0x11142d);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0xe88280['id'],'name':_0xe88280[_0xfa7e('0x43')],'pause':![]})[_0xfa7e('0x23')](function(){return db[_0xfa7e('0xb1')][_0xfa7e('0x67')]({'paused':0x0},{'where':{'UserId':_0xe88280['id']}});})['then'](function(){return db[_0xfa7e('0xef')][_0xfa7e('0xa5')]({'where':{'membername':_0xe88280['name'],'type':_0xfa7e('0xed'),'exitAt':null}});})[_0xfa7e('0x23')](function(_0x1eb1d0){var _0x28d1c6=[];_0x1eb1d0[_0xfa7e('0xe7')](function(_0x44ecdd){_0x28d1c6['push'](_0x44ecdd['update']({'exitAt':moment()[_0xfa7e('0xa8')](_0xfa7e('0xe8')),'data2':_0xfa7e('0x103')}));});return BPromise[_0xfa7e('0xe9')](_0x28d1c6);})['then'](function(){return _0xe88280[_0xfa7e('0x67')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x486b27,null))[_0xfa7e('0x2e')](handleError(_0x486b27,null));};exports[_0xfa7e('0x106')]=function(_0x27e812,_0x2064dc,_0x4e97e7){var _0x2a162c={};var _0x1dce3b={};var _0x16ba58;var _0x3faa99;return db['User'][_0xfa7e('0x90')]({'where':{'id':_0x27e812[_0xfa7e('0x64')]['id']}})['then'](handleEntityNotFound(_0x2064dc,null))['then'](function(_0x399147){if(_0x399147){_0x16ba58=_0x399147;_0x1dce3b[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db['Team'][_0xfa7e('0x49')]);_0x1dce3b[_0xfa7e('0x50')]=_['keys'](_0x27e812[_0xfa7e('0x50')]);_0x1dce3b[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x1dce3b['model'],_0x1dce3b[_0xfa7e('0x50')]);_0x2a162c[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x1dce3b[_0xfa7e('0x4c')],qs[_0xfa7e('0x54')](_0x27e812[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x2a162c[_0xfa7e('0x53')]=_0x2a162c[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x2a162c[_0xfa7e('0x53')]:_0x1dce3b['model'];_0x2a162c[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x27e812[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x2a162c[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_[_0xfa7e('0x5d')](_0x27e812[_0xfa7e('0x50')],_0x1dce3b[_0xfa7e('0x5c')]));if(_0x27e812[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x2a162c['where']=_[_0xfa7e('0x5e')](_0x2a162c[_0xfa7e('0x5b')],{'$or':_['map'](_0x2a162c['attributes'],function(_0x502001){var _0x4b32b8={};_0x4b32b8[_0x502001]={'$like':'%'+_0x27e812[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0x4b32b8;})});}_0x2a162c=_[_0xfa7e('0x5e')]({},_0x2a162c,_0x27e812[_0xfa7e('0x61')]);return _0x16ba58[_0xfa7e('0x106')](_0x2a162c);}})['then'](function(_0x34e193){if(_0x34e193){_0x3faa99=_0x34e193[_0xfa7e('0x55')];if(!_0x27e812[_0xfa7e('0x50')]['hasOwnProperty'](_0xfa7e('0x57'))){_0x2a162c[_0xfa7e('0x58')]=qs['limit'](_0x27e812['query'][_0xfa7e('0x58')]);_0x2a162c[_0xfa7e('0x32')]=qs['offset'](_0x27e812[_0xfa7e('0x50')]['offset']);}return _0x16ba58[_0xfa7e('0x106')](_0x2a162c);}})[_0xfa7e('0x23')](function(_0x28b3b7){if(_0x28b3b7){return _0x28b3b7?{'count':_0x3faa99,'rows':_0x28b3b7}:null;}})[_0xfa7e('0x23')](respondWithResult(_0x2064dc,null))[_0xfa7e('0x2e')](handleError(_0x2064dc,null));};exports[_0xfa7e('0x107')]=function(_0x597865,_0x532a9e){return db[_0xfa7e('0x62')][_0xfa7e('0x66')]({'where':{'id':_0x597865['params']['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x532a9e,null))[_0xfa7e('0x23')](function(_0x520216){if(_0x520216){var _0x1ac0d6=_0x520216[_0xfa7e('0x36')]({'plain':!![]});return _0x520216['addTeams'](_0x597865[_0xfa7e('0x68')][_0xfa7e('0x6b')],_[_0xfa7e('0x6c')](_0x597865[_0xfa7e('0x68')],[_0xfa7e('0x6b'),'id'])||{})['then'](function(){for(var _0x1a6463=0x0;_0x1a6463<_0x597865[_0xfa7e('0x68')][_0xfa7e('0x6b')][_0xfa7e('0x55')];_0x1a6463++){var _0x38dd92=[];db[_0xfa7e('0x108')][_0xfa7e('0x90')]({'where':{'id':_0x597865[_0xfa7e('0x68')][_0xfa7e('0x6b')][_0x1a6463]}})[_0xfa7e('0x23')](function(_0x3fd815){_0x38dd92[_0xfa7e('0xa7')](_0x3fd815[_0xfa7e('0xe5')]()[_0xfa7e('0x23')](function(_0x5a93d1){for(var _0x15b4a3=0x0;_0x15b4a3<_0x5a93d1[_0xfa7e('0x55')];_0x15b4a3++){_0x5a93d1[_0x15b4a3][_0xfa7e('0x109')](_0xfa7e('0xad'),_0xfa7e('0x10a'));}return _0x5a93d1;}));_0x38dd92[_0xfa7e('0xa7')](_0x3fd815[_0xfa7e('0x10b')]()[_0xfa7e('0x23')](function(_0x57ffbc){for(var _0x506f5c=0x0;_0x506f5c<_0x57ffbc[_0xfa7e('0x55')];_0x506f5c++){_0x57ffbc[_0x506f5c][_0xfa7e('0x109')](_0xfa7e('0xad'),'Chat');}return _0x57ffbc;}));_0x38dd92[_0xfa7e('0xa7')](_0x3fd815[_0xfa7e('0x10c')]()[_0xfa7e('0x23')](function(_0x5a2ec5){for(var _0x47e784=0x0;_0x47e784<_0x5a2ec5[_0xfa7e('0x55')];_0x47e784++){_0x5a2ec5[_0x47e784][_0xfa7e('0x109')](_0xfa7e('0xad'),_0xfa7e('0x10d'));}return _0x5a2ec5;}));_0x38dd92[_0xfa7e('0xa7')](_0x3fd815[_0xfa7e('0x10e')]()['then'](function(_0x43886c){for(var _0x4023c2=0x0;_0x4023c2<_0x43886c[_0xfa7e('0x55')];_0x4023c2++){_0x43886c[_0x4023c2][_0xfa7e('0x109')]('channel',_0xfa7e('0x10f'));}return _0x43886c;}));_0x38dd92['push'](_0x3fd815['getWhatsappQueues']()['then'](function(_0x4f0d24){for(var _0x1b8340=0x0;_0x1b8340<_0x4f0d24[_0xfa7e('0x55')];_0x1b8340++){_0x4f0d24[_0x1b8340][_0xfa7e('0x109')](_0xfa7e('0xad'),_0xfa7e('0x110'));}return _0x4f0d24;}));_0x38dd92[_0xfa7e('0xa7')](_0x3fd815[_0xfa7e('0x111')]()[_0xfa7e('0x23')](function(_0x22bf4c){for(var _0x45b166=0x0;_0x45b166<_0x22bf4c['length'];_0x45b166++){_0x22bf4c[_0x45b166][_0xfa7e('0x109')](_0xfa7e('0xad'),_0xfa7e('0x112'));}return _0x22bf4c;}));_0x38dd92[_0xfa7e('0xa7')](_0x3fd815[_0xfa7e('0x113')]()['then'](function(_0x544c33){for(var _0x1b5c48=0x0;_0x1b5c48<_0x544c33[_0xfa7e('0x55')];_0x1b5c48++){_0x544c33[_0x1b5c48]['setDataValue'](_0xfa7e('0xad'),_0xfa7e('0x114'));}return _0x544c33;}));return BPromise[_0xfa7e('0xe9')](_0x38dd92);})[_0xfa7e('0x23')](function(_0x4e6e5e){var _0x61af89=_[_0xfa7e('0x115')](_0x4e6e5e);_0x38dd92=[];return db[_0xfa7e('0x60')][_0xfa7e('0x116')](function(_0x54aee4){for(var _0x5459d9=0x0;_0x5459d9<_0x61af89[_0xfa7e('0x55')];_0x5459d9++){_0x38dd92[_0xfa7e('0xa7')](_0x61af89[_0x5459d9][_0xfa7e('0x117')](_0x1ac0d6['id']),{'transaction':_0x54aee4});}return BPromise['all'](_0x38dd92)[_0xfa7e('0x23')](function(){if(_0x1ac0d6[_0xfa7e('0xa6')]){return BPromise[_0xfa7e('0xab')](_[_0xfa7e('0x3d')](_0x61af89,function(_0x3962a6){return _0x3962a6[_0xfa7e('0x118')](_0xfa7e('0xad'))===_0xfa7e('0x10a');}),function(_0xb80a1e){return db[_0xfa7e('0xb1')][_0xfa7e('0xe6')]({'membername':_0x1ac0d6[_0xfa7e('0x43')],'UserId':_0x1ac0d6['id'],'queue_name':_0xb80a1e[_0xfa7e('0x43')],'VoiceQueueId':_0xb80a1e['id'],'interface':_[_0xfa7e('0x70')](_0x1ac0d6[_0xfa7e('0xaa')])?util['format'](_0xfa7e('0xa9'),_0x1ac0d6[_0xfa7e('0x43')]):_0x1ac0d6[_0xfa7e('0xaa')],'paused':_0x1ac0d6[_0xfa7e('0x9c')]||![],'penalty':_0x1ac0d6[_0xfa7e('0xa0')]},{'transaction':_0x54aee4});});}else{return;}})[_0xfa7e('0x23')](function(){for(var _0x575339=0x0;_0x575339<_0x61af89[_0xfa7e('0x55')];_0x575339++){var _0x502064=_0x61af89[_0x575339][_0xfa7e('0x118')](_0xfa7e('0xad'));var _0x44638c=_0x502064+_0xfa7e('0xa3');socket[_0xfa7e('0xde')](_0xfa7e('0x38')+_0x502064+_0xfa7e('0x119'),{'UserId':_0x1ac0d6['id'],['queueField']:_0x61af89[_0x575339]['id']});}});});});}});}})[_0xfa7e('0x23')](respondWithStatusCode(_0x532a9e,null))[_0xfa7e('0x2e')](handleError(_0x532a9e,null));};exports[_0xfa7e('0x11a')]=function(_0x4f7075,_0x589465){return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0x4f7075[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x589465,null))[_0xfa7e('0x23')](function(_0x36ec7b){if(_0x36ec7b){var _0x7c59fb=_0x36ec7b[_0xfa7e('0x36')]({'plain':!![]});var _0x1cbf0e=_0x4f7075[_0xfa7e('0x50')][_0xfa7e('0x6b')];return _0x36ec7b[_0xfa7e('0x11a')](_0x1cbf0e)[_0xfa7e('0x23')](function(){for(var _0x3217a0=0x0;_0x3217a0<_0x1cbf0e['length'];_0x3217a0++){var _0x4e3c34=[];db[_0xfa7e('0x108')][_0xfa7e('0x90')]({'where':{'id':_0x1cbf0e[_0x3217a0]}})[_0xfa7e('0x23')](function(_0x258aed){_0x4e3c34['push'](_0x258aed[_0xfa7e('0xe5')]()[_0xfa7e('0x23')](function(_0x442ad9){for(var _0x29fad1=0x0;_0x29fad1<_0x442ad9[_0xfa7e('0x55')];_0x29fad1++){_0x442ad9[_0x29fad1][_0xfa7e('0x109')]('channel',_0xfa7e('0x10a'));}return _0x442ad9;}));_0x4e3c34[_0xfa7e('0xa7')](_0x258aed[_0xfa7e('0x10b')]()[_0xfa7e('0x23')](function(_0x5748e4){for(var _0x770ec1=0x0;_0x770ec1<_0x5748e4[_0xfa7e('0x55')];_0x770ec1++){_0x5748e4[_0x770ec1]['setDataValue'](_0xfa7e('0xad'),'Chat');}return _0x5748e4;}));_0x4e3c34['push'](_0x258aed[_0xfa7e('0x10c')]()[_0xfa7e('0x23')](function(_0x4c93b1){for(var _0x538933=0x0;_0x538933<_0x4c93b1[_0xfa7e('0x55')];_0x538933++){_0x4c93b1[_0x538933][_0xfa7e('0x109')](_0xfa7e('0xad'),_0xfa7e('0x10d'));}return _0x4c93b1;}));_0x4e3c34[_0xfa7e('0xa7')](_0x258aed[_0xfa7e('0x10e')]()[_0xfa7e('0x23')](function(_0x915e2b){for(var _0x3eeae3=0x0;_0x3eeae3<_0x915e2b[_0xfa7e('0x55')];_0x3eeae3++){_0x915e2b[_0x3eeae3]['setDataValue'](_0xfa7e('0xad'),_0xfa7e('0x10f'));}return _0x915e2b;}));_0x4e3c34[_0xfa7e('0xa7')](_0x258aed[_0xfa7e('0x11b')]()[_0xfa7e('0x23')](function(_0x1a0cfc){for(var _0x4b1ba6=0x0;_0x4b1ba6<_0x1a0cfc[_0xfa7e('0x55')];_0x4b1ba6++){_0x1a0cfc[_0x4b1ba6][_0xfa7e('0x109')](_0xfa7e('0xad'),_0xfa7e('0x110'));}return _0x1a0cfc;}));_0x4e3c34[_0xfa7e('0xa7')](_0x258aed[_0xfa7e('0x111')]()['then'](function(_0x104da3){for(var _0x14ece2=0x0;_0x14ece2<_0x104da3[_0xfa7e('0x55')];_0x14ece2++){_0x104da3[_0x14ece2][_0xfa7e('0x109')]('channel',_0xfa7e('0x112'));}return _0x104da3;}));_0x4e3c34[_0xfa7e('0xa7')](_0x258aed[_0xfa7e('0x113')]()[_0xfa7e('0x23')](function(_0x24005b){for(var _0x2b2ab8=0x0;_0x2b2ab8<_0x24005b['length'];_0x2b2ab8++){_0x24005b[_0x2b2ab8][_0xfa7e('0x109')](_0xfa7e('0xad'),_0xfa7e('0x114'));}return _0x24005b;}));return BPromise[_0xfa7e('0xe9')](_0x4e3c34);})[_0xfa7e('0x23')](function(_0x4122b7){var _0x1a90f0=_[_0xfa7e('0x115')](_0x4122b7);_0x4e3c34=[];return db[_0xfa7e('0x60')][_0xfa7e('0x116')](function(_0x15b584){for(var _0xcffac1=0x0;_0xcffac1<_0x1a90f0['length'];_0xcffac1++){_0x4e3c34[_0xfa7e('0xa7')](_0x1a90f0[_0xcffac1][_0xfa7e('0x11c')](_0x7c59fb['id']),{'transaction':_0x15b584});}return BPromise[_0xfa7e('0xe9')](_0x4e3c34)[_0xfa7e('0x23')](function(){if(_0x7c59fb['online']){return BPromise[_0xfa7e('0xab')](_['filter'](_0x1a90f0,function(_0x485ca4){return _0x485ca4['getDataValue']('channel')==='Voice';}),function(_0x1e9729){return db[_0xfa7e('0xb1')][_0xfa7e('0x44')]({'where':{'VoiceQueueId':_0x1e9729['id'],'UserId':_0x7c59fb['id']},'transaction':_0x15b584});});}else{return;}})[_0xfa7e('0x23')](function(){for(var _0x5a58a9=0x0;_0x5a58a9<_0x1a90f0[_0xfa7e('0x55')];_0x5a58a9++){var _0x5c8163=_0x1a90f0[_0x5a58a9][_0xfa7e('0x118')](_0xfa7e('0xad'));var _0x3eba4e=_0x5c8163+_0xfa7e('0xa3');socket[_0xfa7e('0xde')](_0xfa7e('0x38')+_0x5c8163+_0xfa7e('0xb0'),{'UserId':_0x7c59fb['id'],['queueField']:_0x1a90f0[_0x5a58a9]['id']});}});});});}});}})[_0xfa7e('0x23')](respondWithStatusCode(_0x589465,null))[_0xfa7e('0x2e')](handleError(_0x589465,null));};exports[_0xfa7e('0x11d')]=function(_0x3c56b1,_0x2e4cc9,_0x21adb4){var _0x6bb40d={};var _0x1b680c={};var _0x376652;var _0x1f739;return db['User'][_0xfa7e('0x90')]({'where':{'id':_0x3c56b1['params']['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x2e4cc9,null))[_0xfa7e('0x23')](function(_0x381552){if(_0x381552){_0x376652=_0x381552;_0x1b680c[_0xfa7e('0x4c')]=_['keys'](db[_0xfa7e('0x11e')][_0xfa7e('0x49')]);_0x1b680c[_0xfa7e('0x50')]=_[_0xfa7e('0x51')](_0x3c56b1['query']);_0x1b680c['filters']=_[_0xfa7e('0x52')](_0x1b680c[_0xfa7e('0x4c')],_0x1b680c[_0xfa7e('0x50')]);_0x6bb40d[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x1b680c[_0xfa7e('0x4c')],qs[_0xfa7e('0x54')](_0x3c56b1[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x6bb40d[_0xfa7e('0x53')]=_0x6bb40d['attributes'][_0xfa7e('0x55')]?_0x6bb40d['attributes']:_0x1b680c[_0xfa7e('0x4c')];_0x6bb40d[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0x3c56b1[_0xfa7e('0x50')][_0xfa7e('0x5a')]);_0x6bb40d[_0xfa7e('0x5b')]=qs['filters'](_[_0xfa7e('0x5d')](_0x3c56b1[_0xfa7e('0x50')],_0x1b680c[_0xfa7e('0x5c')]));if(_0x3c56b1[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x6bb40d[_0xfa7e('0x5b')]=_[_0xfa7e('0x5e')](_0x6bb40d['where'],{'$or':_['map'](_0x6bb40d['attributes'],function(_0x4083f1){var _0x328d1d={};_0x328d1d[_0x4083f1]={'$like':'%'+_0x3c56b1[_0xfa7e('0x50')][_0xfa7e('0x3d')]+'%'};return _0x328d1d;})});}_0x6bb40d=_['merge']({},_0x6bb40d,_0x3c56b1[_0xfa7e('0x61')]);return _0x376652[_0xfa7e('0x11d')](_0x6bb40d);}})[_0xfa7e('0x23')](function(_0x5b26a1){if(_0x5b26a1){_0x1f739=_0x5b26a1[_0xfa7e('0x55')];if(!_0x3c56b1['query'][_0xfa7e('0x56')]('nolimit')){_0x6bb40d[_0xfa7e('0x58')]=qs[_0xfa7e('0x58')](_0x3c56b1[_0xfa7e('0x50')][_0xfa7e('0x58')]);_0x6bb40d[_0xfa7e('0x32')]=qs[_0xfa7e('0x32')](_0x3c56b1['query'][_0xfa7e('0x32')]);}return _0x376652['getLists'](_0x6bb40d);}})[_0xfa7e('0x23')](function(_0x24368e){if(_0x24368e){return _0x24368e?{'count':_0x1f739,'rows':_0x24368e}:null;}})[_0xfa7e('0x23')](respondWithResult(_0x2e4cc9,null))[_0xfa7e('0x2e')](handleError(_0x2e4cc9,null));};exports[_0xfa7e('0x11f')]=function(_0xb97898,_0x1277fc,_0x1e5612){var _0x355335={};var _0x21c8b4={};var _0x1d2ea2;var _0x97532c;return db[_0xfa7e('0x62')][_0xfa7e('0x90')]({'where':{'id':_0xb97898[_0xfa7e('0x64')]['id']}})[_0xfa7e('0x23')](handleEntityNotFound(_0x1277fc,null))[_0xfa7e('0x23')](function(_0x43c155){if(_0x43c155){_0x1d2ea2=_0x43c155;_0x21c8b4[_0xfa7e('0x4c')]=_[_0xfa7e('0x51')](db[_0xfa7e('0x62')][_0xfa7e('0x49')]);_0x21c8b4['query']=_[_0xfa7e('0x51')](_0xb97898[_0xfa7e('0x50')]);_0x21c8b4[_0xfa7e('0x5c')]=_[_0xfa7e('0x52')](_0x21c8b4[_0xfa7e('0x4c')],_0x21c8b4[_0xfa7e('0x50')]);_0x355335[_0xfa7e('0x53')]=_[_0xfa7e('0x52')](_0x21c8b4[_0xfa7e('0x4c')],qs[_0xfa7e('0x54')](_0xb97898[_0xfa7e('0x50')][_0xfa7e('0x54')]));_0x355335['attributes']=_0x355335[_0xfa7e('0x53')][_0xfa7e('0x55')]?_0x355335['attributes']:_0x21c8b4[_0xfa7e('0x4c')];_0x355335[_0xfa7e('0x59')]=qs[_0xfa7e('0x5a')](_0xb97898['query'][_0xfa7e('0x5a')]);_0x355335[_0xfa7e('0x5b')]=qs[_0xfa7e('0x5c')](_['pick'](_0xb97898[_0xfa7e('0x50')],_0x21c8b4['filters']));if(_0xb97898[_0xfa7e('0x50')][_0xfa7e('0x3d')]){_0x355335['where']=_[_0xfa7e('0x5e')](_0x355335[_0xfa7e('0x5b')],{'$or':_[_0xfa7e('0x3f')](_0x355335[_0xfa7e('0x53')],function(_0x135f2f){var _0x484dad={};_0x484dad[_0x135f2f]={'$like':'%'+_0xb97898['query'][_0xfa7e('0x3d')]+'%'};return _0x484dad;})});}_0x355335[_0xfa7e('0x4c')]=db[_0xfa7e('0x62')];_0x355335['as']=_0xfa7e('0x39');_0x355335=_[_0xfa7e('0x5e')]({},_0x355335,_0xb97898[_0xfa7e('0x61')]);return _0x1d2ea2['getVoiceQueues']({'include':[_0x355335]});}})[_0xfa7e('0x23')](function(_0x217738){if(_0x217738){var _0x2c13d0={},_0x3ee1ed=[],_0x5a4bec=0x0;for(var _0x45296a=0x0;_0x45296a<_0x217738[_0xfa7e('0x55')];_0x45296a+=0x1){for(var _0x573013=0x0,_0x169767;_0x573013<_0x217738[_0x45296a][_0xfa7e('0x39')][_0xfa7e('0x55')];_0x573013+=0x1){_0x169767=_0x217738[_0x45296a][_0xfa7e('0x39')][_0x573013][_0xfa7e('0x36')]({'plain':!![]});_0x2c13d0[_0x169767['id']]=_0x169767;}}_0x2c13d0=_[_0xfa7e('0x120')](_0x2c13d0);for(var _0x1db051=qs[_0xfa7e('0x32')](_0xb97898['query'][_0xfa7e('0x32')]);_0x1db051<_0x2c13d0[_0xfa7e('0x55')]&&_0x3ee1ed[_0xfa7e('0x55')]=_0x4f0428['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xdd06('0xe')](function(){if(_0x26d3db){return db[_0xdd06('0x2a')][_0xdd06('0x4e')]({'where':{'membername':_0x26d3db[_0xdd06('0x2d')]},'individualHooks':!![]});}})[_0xdd06('0xe')](function(){if(_0x26d3db){return _0x26d3db[_0xdd06('0x56')]({'raw':!![]});}})[_0xdd06('0xe')](function(_0x11bc9f){if(_0x26d3db){if(_0x11bc9f){var _0x56a598=[];_0x18139d=_0x11bc9f;if(_0x18139d[_0xdd06('0x2f')]){for(var _0x253d86=0x0;_0x253d86<_0x18139d['length'];_0x253d86++){_0x56a598[_0xdd06('0x4b')](db[_0xdd06('0x2a')][_0xdd06('0x57')]({'membername':_0x26d3db[_0xdd06('0x2d')],'UserId':_0x26d3db['id'],'queue_name':_0x18139d[_0x253d86]['name'],'VoiceQueueId':_0x18139d[_0x253d86]['id'],'interface':_0x3509e8,'paused':_0x26d3db[_0xdd06('0x52')]||![],'penalty':_0x18139d[_0x253d86][_0xdd06('0x58')]||0x0}));}return BPromise[_0xdd06('0x4c')](_0x56a598);}}}})['then'](function(){if(_0x26d3db){return db[_0xdd06('0x2c')][_0xdd06('0x19')]({'where':{'membername':_0x26d3db[_0xdd06('0x2d')],'exitAt':null}});}})[_0xdd06('0xe')](function(_0x5330b6){if(_0x26d3db){if(_0x5330b6&&_0x5330b6[_0xdd06('0x2f')]){var _0x2db2ad=[];_0x5330b6[_0xdd06('0x33')](function(_0x1e5d41){_0x2db2ad['push'](_0x1e5d41[_0xdd06('0x2b')]({'exitAt':moment()[_0xdd06('0x30')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2db2ad);}}})[_0xdd06('0xe')](function(_0x323d1e){if(_0x26d3db){var _0x42f123=[];var _0x8bd35e=[];var _0x572cea=utils[_0xdd06('0x32')]();var _0x5356c6={'membername':_0x26d3db[_0xdd06('0x2d')],'interface':_0x3509e8,'enterAt':moment()[_0xdd06('0x30')](_0xdd06('0x37')),'role':_0x26d3db[_0xdd06('0x28')],'internal':_0x26d3db[_0xdd06('0x29')]};_0x572cea[_0xdd06('0x33')](function(_0x38fa01){_0x42f123[_0xdd06('0x4b')](_[_0xdd06('0x59')]({'channel':_0x38fa01,'type':_0xdd06('0x5a'),'data1':_0xdd06('0x5b'),'data2':_0x3509e8},_0x5356c6));if(_0x26d3db['loginInPause']){_0x8bd35e[_0xdd06('0x4b')](_[_0xdd06('0x59')]({'channel':_0x38fa01,'type':_0xdd06('0x2e'),'data1':'LOGININPAUSE'},_0x5356c6));}});return db['MemberReport']['bulkCreate'](_0x42f123[_0xdd06('0x5c')](_0x8bd35e),{'individualHooks':!![]});}})[_0xdd06('0xe')](function(){if(_0x26d3db){return _0x26d3db['update']({'online':!![],'lastLoginAt':moment()[_0xdd06('0x30')](_0xdd06('0x37')),'voicePause':_0x26d3db[_0xdd06('0x52')]||![],'mailPause':_0x26d3db[_0xdd06('0x52')]||![],'chatPause':_0x26d3db['loginInPause']||![],'faxPause':_0x26d3db['loginInPause']||![],'smsPause':_0x26d3db[_0xdd06('0x52')]||![],'openchannelPause':_0x26d3db['loginInPause']||![],'pauseType':_0x26d3db[_0xdd06('0x52')]?_0xdd06('0x5d'):null,'lastPauseAt':moment()[_0xdd06('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3509e8});}})[_0xdd06('0xe')](function(_0x13be6a){_0x374a5f(_0x13be6a);})[_0xdd06('0x23')](function(_0x3e8834){_0x5b7eb6(_0x3c4ba0[_0xdd06('0x14')](0x1f4,_0x3e8834['message']));});});}; \ No newline at end of file +var _0xd425=['bulkCreate','update','UnpauseUser','findOne','channel','Unknown\x20channel','mail','chat','openchannel','Pause','MemberReport','push','system','all','LogoutUser','destroy','mobile','phone','loginInPause','count','agent','../../config/license/util','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','concat','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','defaults','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetUser','User','findAll','options','raw','include','model','attributes','map','ShowUser','find','where','role','internal','interface','UserVoiceQueueRt','PAUSE','length','format','updateAttributes','getChannels','forEach','isNil','SIP/%s','name','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','uniqueid'];(function(_0xf8547b,_0x397506){var _0x58762e=function(_0x3154a3){while(--_0x3154a3){_0xf8547b['push'](_0xf8547b['shift']());}};_0x58762e(++_0x397506);}(_0xd425,0x72));var _0x5d42=function(_0x4944f1,_0x919f76){_0x4944f1=_0x4944f1-0x0;var _0x20f1fa=_0xd425[_0x4944f1];return _0x20f1fa;};'use strict';var _=require('lodash');var util=require(_0x5d42('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d42('0x1'));var fs=require('fs');var Redis=require(_0x5d42('0x2'));var db=require(_0x5d42('0x3'))['db'];var utils=require(_0x5d42('0x4'));var logger=require(_0x5d42('0x5'))(_0x5d42('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x5d42('0x7')](config[_0x5d42('0x8')],{'host':_0x5d42('0x9'),'port':0x18eb});var socket=require(_0x5d42('0xa'))(new Redis(config[_0x5d42('0x8')]));require(_0x5d42('0xb'))[_0x5d42('0xc')](socket);function respondWithRpcPromise(_0x4b1671,_0x492e79,_0x46e499){return new BPromise(function(_0xbd43e8,_0x1edf0b){return client[_0x5d42('0xd')](_0x4b1671,_0x46e499)[_0x5d42('0xe')](function(_0xb2edd1){logger[_0x5d42('0xf')](_0x5d42('0x10'),_0x492e79,'request\x20sent');logger[_0x5d42('0x11')](_0x5d42('0x12'),_0x492e79,_0x5d42('0x13'),JSON[_0x5d42('0x14')](_0xb2edd1));if(_0xb2edd1['error']){if(_0xb2edd1['error'][_0x5d42('0x15')]===0x1f4){logger[_0x5d42('0x16')](_0x5d42('0x10'),_0x492e79,_0xb2edd1[_0x5d42('0x16')][_0x5d42('0x17')]);return _0x1edf0b(_0xb2edd1[_0x5d42('0x16')][_0x5d42('0x17')]);}logger[_0x5d42('0x16')](_0x5d42('0x10'),_0x492e79,_0xb2edd1[_0x5d42('0x16')][_0x5d42('0x17')]);return _0xbd43e8(_0xb2edd1['error'][_0x5d42('0x17')]);}else{logger['info'](_0x5d42('0x10'),_0x492e79,_0x5d42('0x13'));_0xbd43e8(_0xb2edd1[_0x5d42('0x18')][_0x5d42('0x17')]);}})[_0x5d42('0x19')](function(_0x46b99f){logger[_0x5d42('0x16')](_0x5d42('0x10'),_0x492e79,_0x46b99f);_0x1edf0b(_0x46b99f);});});}exports[_0x5d42('0x1a')]=function(_0x287441){var _0x520e65=this;return new Promise(function(_0x3ebd63,_0x327910){return db[_0x5d42('0x1b')][_0x5d42('0x1c')]({'raw':_0x287441[_0x5d42('0x1d')]?_0x287441[_0x5d42('0x1d')][_0x5d42('0x1e')]===undefined?!![]:![]:!![],'where':_0x287441['options']?_0x287441[_0x5d42('0x1d')]['where']||null:null,'attributes':_0x287441[_0x5d42('0x1d')]?_0x287441[_0x5d42('0x1d')]['attributes']||null:null,'limit':_0x287441['options']?_0x287441[_0x5d42('0x1d')]['limit']||null:null,'include':_0x287441[_0x5d42('0x1d')]?_0x287441[_0x5d42('0x1d')]['include']?_['map'](_0x287441['options'][_0x5d42('0x1f')],function(_0x574c35){return{'model':db[_0x574c35[_0x5d42('0x20')]],'as':_0x574c35['as'],'attributes':_0x574c35[_0x5d42('0x21')],'include':_0x574c35['include']?_[_0x5d42('0x22')](_0x574c35['include'],function(_0x1d16d9){return{'model':db[_0x1d16d9[_0x5d42('0x20')]],'as':_0x1d16d9['as'],'attributes':_0x1d16d9[_0x5d42('0x21')],'include':_0x1d16d9[_0x5d42('0x1f')]?_[_0x5d42('0x22')](_0x1d16d9[_0x5d42('0x1f')],function(_0x324841){return{'model':db[_0x324841[_0x5d42('0x20')]],'as':_0x324841['as'],'attributes':_0x324841[_0x5d42('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5d42('0xe')](function(_0x50d21b){logger[_0x5d42('0xf')]('GetUser',_0x287441);logger['debug'](_0x5d42('0x1a'),_0x287441,JSON[_0x5d42('0x14')](_0x50d21b));_0x3ebd63(_0x50d21b);})[_0x5d42('0x19')](function(_0xbf1090){logger[_0x5d42('0x16')](_0x5d42('0x1a'),_0xbf1090[_0x5d42('0x17')],_0x287441);_0x327910(_0x520e65['error'](0x1f4,_0xbf1090[_0x5d42('0x17')]));});});};exports[_0x5d42('0x23')]=function(_0x482575){var _0x278201=this;return new Promise(function(_0x4b28b1,_0x3ff3eb){return db[_0x5d42('0x1b')][_0x5d42('0x24')]({'raw':_0x482575[_0x5d42('0x1d')]?_0x482575[_0x5d42('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x482575[_0x5d42('0x1d')]?_0x482575['options'][_0x5d42('0x25')]||null:null,'attributes':_0x482575[_0x5d42('0x1d')]?_0x482575['options'][_0x5d42('0x21')]||null:null,'include':_0x482575[_0x5d42('0x1d')]?_0x482575[_0x5d42('0x1d')]['include']?_[_0x5d42('0x22')](_0x482575[_0x5d42('0x1d')][_0x5d42('0x1f')],function(_0x4e134e){return{'model':db[_0x4e134e['model']],'as':_0x4e134e['as'],'attributes':_0x4e134e[_0x5d42('0x21')],'include':_0x4e134e[_0x5d42('0x1f')]?_['map'](_0x4e134e[_0x5d42('0x1f')],function(_0x397f7b){return{'model':db[_0x397f7b[_0x5d42('0x20')]],'as':_0x397f7b['as'],'attributes':_0x397f7b[_0x5d42('0x21')],'include':_0x397f7b[_0x5d42('0x1f')]?_[_0x5d42('0x22')](_0x397f7b['include'],function(_0x40b6d5){return{'model':db[_0x40b6d5[_0x5d42('0x20')]],'as':_0x40b6d5['as'],'attributes':_0x40b6d5[_0x5d42('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5d42('0xe')](function(_0x5773f5){logger[_0x5d42('0xf')](_0x5d42('0x23'),_0x482575);logger[_0x5d42('0x11')](_0x5d42('0x23'),_0x482575,JSON[_0x5d42('0x14')](_0x5773f5));_0x4b28b1(_0x5773f5);})[_0x5d42('0x19')](function(_0x35a8c9){logger[_0x5d42('0x16')](_0x5d42('0x23'),_0x35a8c9[_0x5d42('0x17')],_0x482575);_0x3ff3eb(_0x278201[_0x5d42('0x16')](0x1f4,_0x35a8c9['message']));});});};exports['PauseUser']=function(_0xc3f2c8){var _0x259461=this;return new Promise(function(_0x541e3a,_0x44fa10){var _0x42fb4f;return db[_0x5d42('0x1b')][_0x5d42('0x24')]({'where':_0xc3f2c8[_0x5d42('0x1d')][_0x5d42('0x25')]||{},'attributes':['id','name',_0x5d42('0x26'),_0x5d42('0x27'),_0x5d42('0x28')]})[_0x5d42('0xe')](function(_0x144505){if(_0x144505){_0x42fb4f=_0x144505;return db[_0x5d42('0x29')]['update']({'paused':0x1},{'where':{'UserId':_0x42fb4f['id']},'individualHooks':!![]});}})['then'](function(){if(_0x42fb4f){return db['MemberReport'][_0x5d42('0x1c')]({'where':{'membername':_0x42fb4f['name'],'type':_0x5d42('0x2a'),'exitAt':null}});}})[_0x5d42('0xe')](function(_0x513a3f){if(_0x42fb4f){if(_0x513a3f&&_0x513a3f[_0x5d42('0x2b')]){var _0xc557c5=moment()[_0x5d42('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x465213=0x0,_0x1041e5=_0x513a3f[_0x5d42('0x2b')];_0x465213<_0x1041e5;_0x465213++){_0x513a3f[_0x465213][_0x5d42('0x2d')]({'exitAt':_0xc557c5});}}}})[_0x5d42('0xe')](function(){if(_0x42fb4f){var _0x30f263=[];var _0x3c8678=utils[_0x5d42('0x2e')]();_0x3c8678[_0x5d42('0x2f')](function(_0x566513){_0x30f263['push']({'channel':_0x566513,'membername':_0x42fb4f['name'],'interface':_[_0x5d42('0x30')](_0x42fb4f['interface'])?util[_0x5d42('0x2c')](_0x5d42('0x31'),_0x42fb4f[_0x5d42('0x32')]):_0x42fb4f['interface'],'type':_0x5d42('0x2a'),'enterAt':moment()['format'](_0x5d42('0x33')),'data1':_0xc3f2c8[_0x5d42('0x34')][_0x5d42('0x35')]||_0x5d42('0x36'),'role':_0x42fb4f[_0x5d42('0x26')],'internal':_0x42fb4f[_0x5d42('0x27')],'uniqueid':_0xc3f2c8[_0x5d42('0x34')][_0x5d42('0x37')]||null});});return db['MemberReport'][_0x5d42('0x38')](_0x30f263,{'individualHooks':!![]});}})[_0x5d42('0xe')](function(){if(_0x42fb4f){return _0x42fb4f[_0x5d42('0x39')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0xc3f2c8['body'][_0x5d42('0x35')]||_0x5d42('0x36'),'lastPauseAt':moment()[_0x5d42('0x2c')](_0x5d42('0x33'))});}})[_0x5d42('0xe')](function(_0x212b4c){_0x541e3a(_0x212b4c);})[_0x5d42('0x19')](function(_0x2705cd){_0x44fa10(_0x259461[_0x5d42('0x16')](0x1f4,_0x2705cd['message']));});});};exports[_0x5d42('0x3a')]=function(_0x3d765f){var _0x35d229=this;return new Promise(function(_0x5ea36d,_0x46925d){var _0x5640ad;return db['User'][_0x5d42('0x3b')]({'where':_0x3d765f['options'][_0x5d42('0x25')]||{},'attributes':['id','name']})[_0x5d42('0xe')](function(_0x44a6cb){if(_0x44a6cb){_0x5640ad=_0x44a6cb;if(_0x3d765f['body'][_0x5d42('0x3c')]&&!utils['isValidChannel'](_0x3d765f[_0x5d42('0x34')][_0x5d42('0x3c')])){throw new Error(_0x5d42('0x3d'));}switch(_0x3d765f['body'][_0x5d42('0x3c')]){case'voice':return db[_0x5d42('0x29')][_0x5d42('0x39')]({'paused':0x0},{'where':{'UserId':_0x5640ad['id']}})[_0x5d42('0xe')](function(){return db['MemberReport'][_0x5d42('0x24')]({'where':{'channel':_0x3d765f[_0x5d42('0x34')][_0x5d42('0x3c')],'membername':_0x5640ad[_0x5d42('0x32')],'type':'PAUSE','exitAt':null}});})[_0x5d42('0xe')](function(_0x4c852b){if(_0x4c852b){return _0x4c852b[_0x5d42('0x39')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x5d42('0xe')](function(){return _0x5640ad['update']({'voicePause':![]});});case _0x5d42('0x3e'):case _0x5d42('0x3f'):case'fax':case'sms':case _0x5d42('0x40'):return db['MemberReport'][_0x5d42('0x24')]({'where':{'channel':_0x3d765f[_0x5d42('0x34')]['channel'],'membername':_0x5640ad['name'],'type':_0x5d42('0x2a'),'exitAt':null}})[_0x5d42('0xe')](function(_0x392cab){return _0x392cab['update']({'exitAt':moment()[_0x5d42('0x2c')](_0x5d42('0x33')),'data2':'system'},{'individualHooks':!![]});})[_0x5d42('0xe')](function(){var _0xfc7cc1={};_['set'](_0xfc7cc1,util['format']('%s%s',_0x3d765f[_0x5d42('0x34')][_0x5d42('0x3c')],_0x5d42('0x41')),![]);return _0x5640ad[_0x5d42('0x39')](_0xfc7cc1);});default:return db[_0x5d42('0x29')]['update']({'paused':0x0},{'where':{'UserId':_0x5640ad['id']}})[_0x5d42('0xe')](function(){return db[_0x5d42('0x42')][_0x5d42('0x1c')]({'where':{'membername':_0x5640ad[_0x5d42('0x32')],'type':_0x5d42('0x2a'),'exitAt':null}});})[_0x5d42('0xe')](function(_0x5043a0){var _0x1aece7=[];_0x5043a0[_0x5d42('0x2f')](function(_0x1cea53){_0x1aece7[_0x5d42('0x43')](_0x1cea53[_0x5d42('0x39')]({'exitAt':moment()['format'](_0x5d42('0x33')),'data2':_0x5d42('0x44')}));});return BPromise[_0x5d42('0x45')](_0x1aece7);})[_0x5d42('0xe')](function(){return _0x5640ad[_0x5d42('0x39')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x5d42('0xe')](function(_0x25fe67){_0x5ea36d(_0x25fe67);})[_0x5d42('0x19')](function(_0x517907){_0x46925d(_0x35d229['error'](0x1f4,_0x517907['message']));});});};exports[_0x5d42('0x46')]=function(_0x4cc54a){var _0x4775d2=this;return new Promise(function(_0x2570db,_0x10fc9a){var _0x580799;return db[_0x5d42('0x1b')][_0x5d42('0x3b')]({'where':_0x4cc54a[_0x5d42('0x1d')][_0x5d42('0x25')]||{},'attributes':['id',_0x5d42('0x32')]})['then'](function(_0xadfa07){if(_0xadfa07){_0x580799=_0xadfa07;return db[_0x5d42('0x29')][_0x5d42('0x47')]({'where':{'membername':_0x580799['name']},'individualHooks':!![]});}})[_0x5d42('0xe')](function(){if(_0x580799){return db[_0x5d42('0x42')][_0x5d42('0x1c')]({'where':{'membername':_0x580799[_0x5d42('0x32')],'exitAt':null}});}})[_0x5d42('0xe')](function(_0x1908d1){if(_0x580799){if(_0x1908d1&&_0x1908d1['length']){var _0x105905=[];_0x1908d1[_0x5d42('0x2f')](function(_0x406f9f){_0x105905[_0x5d42('0x43')](_0x406f9f[_0x5d42('0x39')]({'exitAt':moment()[_0x5d42('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x105905);}}})['then'](function(){if(_0x580799){return _0x580799[_0x5d42('0x39')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x18d6be){_0x2570db(_0x18d6be);})[_0x5d42('0x19')](function(_0x4bd059){_0x10fc9a(_0x4775d2[_0x5d42('0x16')](0x1f4,_0x4bd059[_0x5d42('0x17')]));});});};exports['LoginUser']=function(_0xf0848e){var _0x765a3e=this;return new Promise(function(_0x5c987e,_0x54f0fa){var _0x54527d;var _0x382155;var _0x403b30;var _0x3fb908;return db[_0x5d42('0x1b')][_0x5d42('0x3b')]({'where':_0xf0848e[_0x5d42('0x1d')][_0x5d42('0x25')]||{},'attributes':['id',_0x5d42('0x32'),_0x5d42('0x26'),_0x5d42('0x48'),_0x5d42('0x49'),_0x5d42('0x27'),_0x5d42('0x4a'),'interface']})[_0x5d42('0xe')](function(_0x5751b0){if(_0x5751b0){_0x54527d=_0x5751b0;_0x3fb908=_0xf0848e[_0x5d42('0x34')]['interface']?_0xf0848e[_0x5d42('0x34')]['interface']:util[_0x5d42('0x2c')]('SIP/%s',_0x54527d['name']);return db[_0x5d42('0x1b')][_0x5d42('0x4b')]({'where':{'role':_0x5d42('0x4c'),'online':!![],'id':{'$ne':_0x54527d['id']}}});}})[_0x5d42('0xe')](function(_0x13a4c5){if(_0x13a4c5){_0x403b30=_0x13a4c5;return require(_0x5d42('0x4d'))['getLicense']();}})[_0x5d42('0xe')](function(_0x10cc6b){if(_0x10cc6b&&_0x10cc6b[_0x5d42('0x4e')]&&_0x403b30>=_0x10cc6b[_0x5d42('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5d42('0xe')](function(){if(_0x54527d){return db[_0x5d42('0x29')][_0x5d42('0x47')]({'where':{'membername':_0x54527d['name']},'individualHooks':!![]});}})['then'](function(){if(_0x54527d){return _0x54527d[_0x5d42('0x4f')]({'raw':!![]});}})['then'](function(_0x323b46){if(_0x54527d){if(_0x323b46){var _0x42e651=[];_0x382155=_0x323b46;if(_0x382155[_0x5d42('0x2b')]){for(var _0x302411=0x0;_0x302411<_0x382155[_0x5d42('0x2b')];_0x302411++){_0x42e651[_0x5d42('0x43')](db[_0x5d42('0x29')][_0x5d42('0x50')]({'membername':_0x54527d[_0x5d42('0x32')],'UserId':_0x54527d['id'],'queue_name':_0x382155[_0x302411][_0x5d42('0x32')],'VoiceQueueId':_0x382155[_0x302411]['id'],'interface':_0x3fb908,'paused':_0x54527d[_0x5d42('0x4a')]||![],'penalty':_0x382155[_0x302411][_0x5d42('0x51')]||0x0}));}return BPromise[_0x5d42('0x45')](_0x42e651);}}}})['then'](function(){if(_0x54527d){return db[_0x5d42('0x42')]['findAll']({'where':{'membername':_0x54527d[_0x5d42('0x32')],'exitAt':null}});}})[_0x5d42('0xe')](function(_0x2eca9c){if(_0x54527d){if(_0x2eca9c&&_0x2eca9c[_0x5d42('0x2b')]){var _0x21f2b1=[];_0x2eca9c['forEach'](function(_0x4b1b4c){_0x21f2b1[_0x5d42('0x43')](_0x4b1b4c[_0x5d42('0x39')]({'exitAt':moment()[_0x5d42('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x5d42('0x45')](_0x21f2b1);}}})[_0x5d42('0xe')](function(_0x552b79){if(_0x54527d){var _0x5c8c05=[];var _0x1a2c00=[];var _0x4a7059=utils[_0x5d42('0x2e')]();var _0x29c98d={'membername':_0x54527d[_0x5d42('0x32')],'interface':_0x3fb908,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x54527d[_0x5d42('0x26')],'internal':_0x54527d[_0x5d42('0x27')]};_0x4a7059['forEach'](function(_0x3da9d2){_0x5c8c05[_0x5d42('0x43')](_[_0x5d42('0x52')]({'channel':_0x3da9d2,'type':_0x5d42('0x53'),'data1':'callysquare','data2':_0x3fb908},_0x29c98d));if(_0x54527d[_0x5d42('0x4a')]){_0x1a2c00['push'](_[_0x5d42('0x52')]({'channel':_0x3da9d2,'type':_0x5d42('0x2a'),'data1':'LOGININPAUSE'},_0x29c98d));}});return db['MemberReport'][_0x5d42('0x38')](_0x5c8c05[_0x5d42('0x54')](_0x1a2c00),{'individualHooks':!![]});}})[_0x5d42('0xe')](function(){if(_0x54527d){return _0x54527d[_0x5d42('0x39')]({'online':!![],'lastLoginAt':moment()[_0x5d42('0x2c')](_0x5d42('0x33')),'voicePause':_0x54527d['loginInPause']||![],'mailPause':_0x54527d['loginInPause']||![],'chatPause':_0x54527d[_0x5d42('0x4a')]||![],'faxPause':_0x54527d[_0x5d42('0x4a')]||![],'smsPause':_0x54527d[_0x5d42('0x4a')]||![],'openchannelPause':_0x54527d[_0x5d42('0x4a')]||![],'pauseType':_0x54527d[_0x5d42('0x4a')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x5d42('0x33')),'interface':_0x3fb908});}})['then'](function(_0x2e8ec7){_0x5c987e(_0x2e8ec7);})['catch'](function(_0x46a72a){_0x54f0fa(_0x765a3e['error'](0x1f4,_0x46a72a[_0x5d42('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 646fe02..abc75e7 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 _0x83e2=['user:','save','remove','update','emit','removeListener','length'];(function(_0x417b09,_0x8ec5ec){var _0x25edc8=function(_0x5f440d){while(--_0x5f440d){_0x417b09['push'](_0x417b09['shift']());}};_0x25edc8(++_0x8ec5ec);}(_0x83e2,0xa2));var _0x283e=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x83e2[_0x4d45c1];return _0x244478;};'use strict';var UserEvents=require('./user.events');var events=[_0x283e('0x0'),_0x283e('0x1'),_0x283e('0x2')];function createListener(_0x54947d,_0x181622){return function(_0x39ec88){_0x181622[_0x283e('0x3')](_0x54947d,_0x39ec88);};}function removeListener(_0x39416b,_0x45a641){return function(){UserEvents[_0x283e('0x4')](_0x39416b,_0x45a641);};}exports['register']=function(_0x1df136){for(var _0x1ccad8=0x0,_0x50ee1f=events[_0x283e('0x5')];_0x1ccad8<_0x50ee1f;_0x1ccad8++){var _0x428352=events[_0x1ccad8];var _0x325f4c=createListener(_0x283e('0x6')+_0x428352,_0x1df136);UserEvents['on'](_0x428352,_0x325f4c);}}; \ No newline at end of file +var _0x0242=['removeListener','register','length','user:','./user.events','save','remove','emit'];(function(_0x43d824,_0x1e8f6e){var _0x5d83df=function(_0x3a2a5a){while(--_0x3a2a5a){_0x43d824['push'](_0x43d824['shift']());}};_0x5d83df(++_0x1e8f6e);}(_0x0242,0x9c));var _0x2024=function(_0x550aed,_0x1ba6cb){_0x550aed=_0x550aed-0x0;var _0x1c43a5=_0x0242[_0x550aed];return _0x1c43a5;};'use strict';var UserEvents=require(_0x2024('0x0'));var events=[_0x2024('0x1'),_0x2024('0x2'),'update'];function createListener(_0x7f45ca,_0x446701){return function(_0x4ab580){_0x446701[_0x2024('0x3')](_0x7f45ca,_0x4ab580);};}function removeListener(_0x560def,_0x40c851){return function(){UserEvents[_0x2024('0x4')](_0x560def,_0x40c851);};}exports[_0x2024('0x5')]=function(_0x4a9920){for(var _0x29d226=0x0,_0x59ac90=events[_0x2024('0x6')];_0x29d226<_0x59ac90;_0x29d226++){var _0x330b36=events[_0x29d226];var _0x289529=createListener(_0x2024('0x7')+_0x330b36,_0x4a9920);UserEvents['on'](_0x330b36,_0x289529);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c4deb2c..b14dfb7 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 _0x7814=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x52370f,_0x16faf0){var _0x229e25=function(_0x576b9f){while(--_0x576b9f){_0x52370f['push'](_0x52370f['shift']());}};_0x229e25(++_0x16faf0);}(_0x7814,0x1a1));var _0x4781=function(_0x26a174,_0x3efb4f){_0x26a174=_0x26a174-0x0;var _0x889bcf=_0x7814[_0x26a174];return _0x889bcf;};'use strict';var multer=require(_0x4781('0x0'));var util=require(_0x4781('0x1'));var path=require(_0x4781('0x2'));var timeout=require(_0x4781('0x3'));var express=require('express');var router=express[_0x4781('0x4')]();var auth=require(_0x4781('0x5'));var interaction=require(_0x4781('0x6'));var config=require(_0x4781('0x7'));module[_0x4781('0x8')]=router; \ No newline at end of file +var _0xaf20=['../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express','Router'];(function(_0x19ebdf,_0x40db7e){var _0x917741=function(_0x22051b){while(--_0x22051b){_0x19ebdf['push'](_0x19ebdf['shift']());}};_0x917741(++_0x40db7e);}(_0xaf20,0xd3));var _0x0af2=function(_0x1c10eb,_0x2ae184){_0x1c10eb=_0x1c10eb-0x0;var _0x72048d=_0xaf20[_0x1c10eb];return _0x72048d;};'use strict';var multer=require('multer');var util=require(_0x0af2('0x0'));var path=require(_0x0af2('0x1'));var timeout=require(_0x0af2('0x2'));var express=require(_0x0af2('0x3'));var router=express[_0x0af2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0af2('0x5'));var config=require(_0x0af2('0x6'));module[_0x0af2('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 51bbf76..91fa002 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(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_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 _0xbaf0=['exports','INTEGER'];(function(_0x52e040,_0x583d2f){var _0x4cd278=function(_0xa844b5){while(--_0xa844b5){_0x52e040['push'](_0x52e040['shift']());}};_0x4cd278(++_0x583d2f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 33cfea1..a65b0f9 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 _0x8921=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','../../config/logger'];(function(_0x417947,_0x51b197){var _0x4f705c=function(_0x392e49){while(--_0x392e49){_0x417947['push'](_0x417947['shift']());}};_0x4f705c(++_0x51b197);}(_0x8921,0x9a));var _0x1892=function(_0x2c87db,_0x2a1c1f){_0x2c87db=_0x2c87db-0x0;var _0x541937=_0x8921[_0x2c87db];return _0x541937;};'use strict';var _=require(_0x1892('0x0'));var util=require('util');var logger=require(_0x1892('0x1'))(_0x1892('0x2'));var moment=require(_0x1892('0x3'));var BPromise=require(_0x1892('0x4'));var rp=require(_0x1892('0x5'));var fs=require('fs');var path=require(_0x1892('0x6'));var rimraf=require(_0x1892('0x7'));var config=require(_0x1892('0x8'));var attributes=require(_0x1892('0x9'));module[_0x1892('0xa')]=function(_0x40e2e5,_0x238d31){return _0x40e2e5['define'](_0x1892('0xb'),attributes,{'tableName':_0x1892('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5d4=['request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19654a,_0x2ac2e3){var _0x484fc0=function(_0x52e27c){while(--_0x52e27c){_0x19654a['push'](_0x19654a['shift']());}};_0x484fc0(++_0x2ac2e3);}(_0xb5d4,0xcc));var _0x4b5d=function(_0x1d923d,_0x2d6c62){_0x1d923d=_0x1d923d-0x0;var _0x1d1493=_0xb5d4[_0x1d923d];return _0x1d1493;};'use strict';var _=require(_0x4b5d('0x0'));var util=require(_0x4b5d('0x1'));var logger=require(_0x4b5d('0x2'))(_0x4b5d('0x3'));var moment=require(_0x4b5d('0x4'));var BPromise=require(_0x4b5d('0x5'));var rp=require(_0x4b5d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b5d('0x7'));var config=require(_0x4b5d('0x8'));var attributes=require(_0x4b5d('0x9'));module[_0x4b5d('0xa')]=function(_0x2aa5a7,_0x431e9d){return _0x2aa5a7[_0x4b5d('0xb')](_0x4b5d('0xc'),attributes,{'tableName':_0x4b5d('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 7f1f1c4..5fe58d6 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 _0xf122=['UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','then'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xf122,0xb4));var _0x2f12=function(_0x448a11,_0x44c515){_0x448a11=_0x448a11-0x0;var _0x597a96=_0xf122[_0x448a11];return _0x597a96;};'use strict';var _=require(_0x2f12('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f12('0x1'));var fs=require('fs');var Redis=require(_0x2f12('0x2'));var db=require(_0x2f12('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f12('0x4'));var config=require(_0x2f12('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f8e99,_0x279d05,_0x5c2631){return new BPromise(function(_0x385613,_0x48f79d){return client['request'](_0x4f8e99,_0x5c2631)[_0x2f12('0x6')](function(_0x3585d3){logger['info'](_0x2f12('0x7'),_0x279d05,_0x2f12('0x8'));logger['debug'](_0x2f12('0x9'),_0x279d05,_0x2f12('0x8'),JSON[_0x2f12('0xa')](_0x3585d3));if(_0x3585d3[_0x2f12('0xb')]){if(_0x3585d3[_0x2f12('0xb')][_0x2f12('0xc')]===0x1f4){logger[_0x2f12('0xb')](_0x2f12('0x7'),_0x279d05,_0x3585d3[_0x2f12('0xb')][_0x2f12('0xd')]);return _0x48f79d(_0x3585d3[_0x2f12('0xb')][_0x2f12('0xd')]);}logger[_0x2f12('0xb')](_0x2f12('0x7'),_0x279d05,_0x3585d3[_0x2f12('0xb')][_0x2f12('0xd')]);return _0x385613(_0x3585d3[_0x2f12('0xb')][_0x2f12('0xd')]);}else{logger[_0x2f12('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x279d05,_0x2f12('0x8'));_0x385613(_0x3585d3[_0x2f12('0xf')][_0x2f12('0xd')]);}})[_0x2f12('0x10')](function(_0x51da82){logger[_0x2f12('0xb')](_0x2f12('0x7'),_0x279d05,_0x51da82);_0x48f79d(_0x51da82);});});} \ No newline at end of file +var _0xfbc5=['message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x30750d,_0x4a4ede){var _0x4d6878=function(_0x55ec69){while(--_0x55ec69){_0x30750d['push'](_0x30750d['shift']());}};_0x4d6878(++_0x4a4ede);}(_0xfbc5,0x152));var _0x5fbc=function(_0x26ec2b,_0x50a9c8){_0x26ec2b=_0x26ec2b-0x0;var _0x2a220e=_0xfbc5[_0x26ec2b];return _0x2a220e;};'use strict';var _=require(_0x5fbc('0x0'));var util=require(_0x5fbc('0x1'));var moment=require(_0x5fbc('0x2'));var BPromise=require('bluebird');var rs=require(_0x5fbc('0x3'));var fs=require('fs');var Redis=require(_0x5fbc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fbc('0x5'));var logger=require('../../config/logger')(_0x5fbc('0x6'));var config=require(_0x5fbc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5fbc('0x8')][_0x5fbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf083c,_0x5706a9,_0x31fe19){return new BPromise(function(_0x35f6ff,_0x241322){return client[_0x5fbc('0xa')](_0xbf083c,_0x31fe19)[_0x5fbc('0xb')](function(_0x52c88c){logger[_0x5fbc('0xc')](_0x5fbc('0xd'),_0x5706a9,'request\x20sent');logger['debug'](_0x5fbc('0xe'),_0x5706a9,_0x5fbc('0xf'),JSON[_0x5fbc('0x10')](_0x52c88c));if(_0x52c88c[_0x5fbc('0x11')]){if(_0x52c88c[_0x5fbc('0x11')][_0x5fbc('0x12')]===0x1f4){logger[_0x5fbc('0x11')](_0x5fbc('0xd'),_0x5706a9,_0x52c88c[_0x5fbc('0x11')]['message']);return _0x241322(_0x52c88c[_0x5fbc('0x11')][_0x5fbc('0x13')]);}logger[_0x5fbc('0x11')](_0x5fbc('0xd'),_0x5706a9,_0x52c88c[_0x5fbc('0x11')][_0x5fbc('0x13')]);return _0x35f6ff(_0x52c88c['error'][_0x5fbc('0x13')]);}else{logger[_0x5fbc('0xc')](_0x5fbc('0xd'),_0x5706a9,'request\x20sent');_0x35f6ff(_0x52c88c['result'][_0x5fbc('0x13')]);}})[_0x5fbc('0x14')](function(_0xf908c2){logger[_0x5fbc('0x11')](_0x5fbc('0xd'),_0x5706a9,_0xf908c2);_0x241322(_0xf908c2);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index e77a284..2cd951f 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 _0xb8a5=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xb8a5,0x1ce));var _0x5b8a=function(_0x19d87b,_0x1a54e7){_0x19d87b=_0x19d87b-0x0;var _0x298c7f=_0xb8a5[_0x19d87b];return _0x298c7f;};'use strict';var multer=require('multer');var util=require(_0x5b8a('0x0'));var path=require(_0x5b8a('0x1'));var timeout=require(_0x5b8a('0x2'));var express=require(_0x5b8a('0x3'));var router=express[_0x5b8a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5b8a('0x5'));var config=require(_0x5b8a('0x6'));module[_0x5b8a('0x7')]=router; \ No newline at end of file +var _0xa04a=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4c627b,_0x2d588d){var _0x5c8a98=function(_0x3bfaa8){while(--_0x3bfaa8){_0x4c627b['push'](_0x4c627b['shift']());}};_0x5c8a98(++_0x2d588d);}(_0xa04a,0x7c));var _0xaa04=function(_0x3475f4,_0x7b1a5c){_0x3475f4=_0x3475f4-0x0;var _0x5521e0=_0xa04a[_0x3475f4];return _0x5521e0;};'use strict';var multer=require(_0xaa04('0x0'));var util=require(_0xaa04('0x1'));var path=require(_0xaa04('0x2'));var timeout=require(_0xaa04('0x3'));var express=require(_0xaa04('0x4'));var router=express[_0xaa04('0x5')]();var auth=require(_0xaa04('0x6'));var interaction=require(_0xaa04('0x7'));var config=require(_0xaa04('0x8'));module[_0xaa04('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 154d4e0..f339dac 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 _0x93e9=['sequelize','exports','INTEGER','STRING'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x93e9,0xcc));var _0x993e=function(_0x93a0da,_0x584f89){_0x93a0da=_0x93a0da-0x0;var _0x407b3f=_0x93e9[_0x93a0da];return _0x407b3f;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'penalty':{'type':Sequelize[_0x993e('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x993e('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x993e('0x3')]}}; \ No newline at end of file +var _0xed3c=['exports','INTEGER','sequelize'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0xed3c,0x1a6));var _0xced3=function(_0x529b9a,_0x3ddafe){_0x529b9a=_0x529b9a-0x0;var _0x15b1f2=_0xed3c[_0x529b9a];return _0x15b1f2;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'penalty':{'type':Sequelize[_0xced3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xced3('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 2f14c72..a5bd46f 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 _0x0895=['api','moment','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x0895,0x1a0));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var util=require(_0x5089('0x1'));var logger=require('../../config/logger')(_0x5089('0x2'));var moment=require(_0x5089('0x3'));var BPromise=require('bluebird');var rp=require(_0x5089('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5089('0x5'));var config=require(_0x5089('0x6'));var attributes=require(_0x5089('0x7'));module['exports']=function(_0x44bf76,_0x188ab9){return _0x44bf76[_0x5089('0x8')](_0x5089('0x9'),attributes,{'tableName':_0x5089('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43e4=['path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x22e412,_0x38c317){var _0x2635f2=function(_0x44b801){while(--_0x44b801){_0x22e412['push'](_0x22e412['shift']());}};_0x2635f2(++_0x38c317);}(_0x43e4,0x1cf));var _0x443e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x43e4[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x443e('0x0'));var util=require(_0x443e('0x1'));var logger=require(_0x443e('0x2'))('api');var moment=require(_0x443e('0x3'));var BPromise=require(_0x443e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x443e('0x5'));var rimraf=require(_0x443e('0x6'));var config=require(_0x443e('0x7'));var attributes=require(_0x443e('0x8'));module[_0x443e('0x9')]=function(_0x33fd55,_0x801049){return _0x33fd55[_0x443e('0xa')](_0x443e('0xb'),attributes,{'tableName':_0x443e('0xc'),'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 4d6367e..f3cbbfc 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 _0x2bda=['stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','client','http','request','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1fdb0f,_0x48e8b4){var _0x291e61=function(_0x552a1e){while(--_0x552a1e){_0x1fdb0f['push'](_0x1fdb0f['shift']());}};_0x291e61(++_0x48e8b4);}(_0x2bda,0x137));var _0xa2bd=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x2bda[_0x3b96cf];return _0x2e315a;};'use strict';var _=require(_0xa2bd('0x0'));var util=require(_0xa2bd('0x1'));var moment=require(_0xa2bd('0x2'));var BPromise=require(_0xa2bd('0x3'));var rs=require(_0xa2bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2bd('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa2bd('0x6')][_0xa2bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5243af,_0x595255,_0x252072){return new BPromise(function(_0x3581a6,_0x45f2de){return client[_0xa2bd('0x8')](_0x5243af,_0x252072)['then'](function(_0x102e28){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x595255,_0xa2bd('0x9'));logger[_0xa2bd('0xa')](_0xa2bd('0xb'),_0x595255,_0xa2bd('0x9'),JSON[_0xa2bd('0xc')](_0x102e28));if(_0x102e28[_0xa2bd('0xd')]){if(_0x102e28[_0xa2bd('0xd')][_0xa2bd('0xe')]===0x1f4){logger[_0xa2bd('0xd')](_0xa2bd('0xf'),_0x595255,_0x102e28[_0xa2bd('0xd')]['message']);return _0x45f2de(_0x102e28[_0xa2bd('0xd')][_0xa2bd('0x10')]);}logger[_0xa2bd('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x595255,_0x102e28[_0xa2bd('0xd')][_0xa2bd('0x10')]);return _0x3581a6(_0x102e28['error']['message']);}else{logger[_0xa2bd('0x11')](_0xa2bd('0xf'),_0x595255,'request\x20sent');_0x3581a6(_0x102e28[_0xa2bd('0x12')][_0xa2bd('0x10')]);}})['catch'](function(_0x396405){logger[_0xa2bd('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x595255,_0x396405);_0x45f2de(_0x396405);});});} \ No newline at end of file +var _0xeaec=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0xeaec,0xde));var _0xceae=function(_0x4db03f,_0x168883){_0x4db03f=_0x4db03f-0x0;var _0x15c667=_0xeaec[_0x4db03f];return _0x15c667;};'use strict';var _=require(_0xceae('0x0'));var util=require(_0xceae('0x1'));var moment=require(_0xceae('0x2'));var BPromise=require(_0xceae('0x3'));var rs=require(_0xceae('0x4'));var fs=require('fs');var Redis=require(_0xceae('0x5'));var db=require(_0xceae('0x6'))['db'];var utils=require(_0xceae('0x7'));var logger=require(_0xceae('0x8'))('rpc');var config=require(_0xceae('0x9'));var jayson=require(_0xceae('0xa'));var client=jayson[_0xceae('0xb')][_0xceae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6d92ca,_0x3097f4,_0x5ed846){return new BPromise(function(_0x3379f5,_0x4773d0){return client['request'](_0x6d92ca,_0x5ed846)[_0xceae('0xd')](function(_0x475819){logger[_0xceae('0xe')](_0xceae('0xf'),_0x3097f4,'request\x20sent');logger['debug'](_0xceae('0x10'),_0x3097f4,_0xceae('0x11'),JSON[_0xceae('0x12')](_0x475819));if(_0x475819[_0xceae('0x13')]){if(_0x475819['error'][_0xceae('0x14')]===0x1f4){logger[_0xceae('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x3097f4,_0x475819[_0xceae('0x13')][_0xceae('0x15')]);return _0x4773d0(_0x475819[_0xceae('0x13')][_0xceae('0x15')]);}logger[_0xceae('0x13')](_0xceae('0xf'),_0x3097f4,_0x475819[_0xceae('0x13')][_0xceae('0x15')]);return _0x3379f5(_0x475819[_0xceae('0x13')][_0xceae('0x15')]);}else{logger[_0xceae('0xe')](_0xceae('0xf'),_0x3097f4,'request\x20sent');_0x3379f5(_0x475819[_0xceae('0x16')][_0xceae('0x15')]);}})[_0xceae('0x17')](function(_0x4d6d4a){logger['error'](_0xceae('0xf'),_0x3097f4,_0x4d6d4a);_0x4773d0(_0x4d6d4a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ed21c98..4c8e486 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 _0x3d2c=['../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x543610,_0x29e476){var _0x45a365=function(_0x45de39){while(--_0x45de39){_0x543610['push'](_0x543610['shift']());}};_0x45a365(++_0x29e476);}(_0x3d2c,0x9c));var _0xc3d2=function(_0x1d9dc0,_0x459c7a){_0x1d9dc0=_0x1d9dc0-0x0;var _0x217734=_0x3d2c[_0x1d9dc0];return _0x217734;};'use strict';var multer=require(_0xc3d2('0x0'));var util=require('util');var path=require(_0xc3d2('0x1'));var timeout=require(_0xc3d2('0x2'));var express=require(_0xc3d2('0x3'));var router=express[_0xc3d2('0x4')]();var auth=require(_0xc3d2('0x5'));var interaction=require(_0xc3d2('0x6'));var config=require(_0xc3d2('0x7'));module[_0xc3d2('0x8')]=router; \ No newline at end of file +var _0x811c=['../../components/interaction/service','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x246676,_0x5ecfa8){var _0x588507=function(_0x360469){while(--_0x360469){_0x246676['push'](_0x246676['shift']());}};_0x588507(++_0x5ecfa8);}(_0x811c,0x175));var _0xc811=function(_0x2ab368,_0x2d3dc6){_0x2ab368=_0x2ab368-0x0;var _0x1c8231=_0x811c[_0x2ab368];return _0x1c8231;};'use strict';var multer=require(_0xc811('0x0'));var util=require(_0xc811('0x1'));var path=require(_0xc811('0x2'));var timeout=require(_0xc811('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc811('0x4'));var interaction=require(_0xc811('0x5'));var config=require('../../config/environment');module[_0xc811('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6363b08..9d9f54e 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(_0x23e337,_0x1e3c57){var _0x45facf=function(_0x2abfa3){while(--_0x2abfa3){_0x23e337['push'](_0x23e337['shift']());}};_0x45facf(++_0x1e3c57);}(_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(_0xbab594,_0x54da50){var _0x5803b8=function(_0x781562){while(--_0x781562){_0xbab594['push'](_0xbab594['shift']());}};_0x5803b8(++_0x54da50);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f8e20,_0x1daf92){_0x3f8e20=_0x3f8e20-0x0;var _0x54b65e=_0xb10b[_0x3f8e20];return _0x54b65e;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 7f3f6a9..4a2e4a9 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(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0xb10b,0x12a));var _0xbb10=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xb10b[_0xc0d9bc];return _0x32ff73;};'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(_0x188e68,_0x2e4659){var _0x65b5dc=function(_0x590191){while(--_0x590191){_0x188e68['push'](_0x188e68['shift']());}};_0x65b5dc(++_0x2e4659);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'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 4db6f0a..3d61b19 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 _0x3d4b=['jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x33a45a,_0x1a1ebc){_0x33a45a=_0x33a45a-0x0;var _0x25ec62=_0x3d4b[_0x33a45a];return _0x25ec62;};'use strict';var _=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var moment=require('moment');var BPromise=require(_0xb3d4('0x2'));var rs=require(_0xb3d4('0x3'));var fs=require('fs');var Redis=require(_0xb3d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3d4('0x5'));var logger=require(_0xb3d4('0x6'))(_0xb3d4('0x7'));var config=require(_0xb3d4('0x8'));var jayson=require(_0xb3d4('0x9'));var client=jayson[_0xb3d4('0xa')][_0xb3d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448c49,_0x43bc45,_0x35e0b3){return new BPromise(function(_0xd1d4c4,_0x2eb3b3){return client['request'](_0x448c49,_0x35e0b3)['then'](function(_0x343c8d){logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,_0xb3d4('0xe'));logger['debug'](_0xb3d4('0xf'),_0x43bc45,_0xb3d4('0xe'),JSON[_0xb3d4('0x10')](_0x343c8d));if(_0x343c8d[_0xb3d4('0x11')]){if(_0x343c8d[_0xb3d4('0x11')][_0xb3d4('0x12')]===0x1f4){logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d[_0xb3d4('0x11')]['message']);return _0x2eb3b3(_0x343c8d['error'][_0xb3d4('0x13')]);}logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d['error'][_0xb3d4('0x13')]);return _0xd1d4c4(_0x343c8d[_0xb3d4('0x11')]['message']);}else{logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,'request\x20sent');_0xd1d4c4(_0x343c8d[_0xb3d4('0x14')]['message']);}})['catch'](function(_0x539d5){logger['error'](_0xb3d4('0xd'),_0x43bc45,_0x539d5);_0x2eb3b3(_0x539d5);});});} \ No newline at end of file +var _0xc4ab=['UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x426b27,_0x5918de){var _0xbf309b=function(_0x2df979){while(--_0x2df979){_0x426b27['push'](_0x426b27['shift']());}};_0xbf309b(++_0x5918de);}(_0xc4ab,0xef));var _0xbc4a=function(_0x40b81c,_0x1ca8c5){_0x40b81c=_0x40b81c-0x0;var _0x20a0f0=_0xc4ab[_0x40b81c];return _0x20a0f0;};'use strict';var _=require(_0xbc4a('0x0'));var util=require('util');var moment=require(_0xbc4a('0x1'));var BPromise=require(_0xbc4a('0x2'));var rs=require(_0xbc4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc4a('0x4'))['db'];var utils=require(_0xbc4a('0x5'));var logger=require('../../config/logger')(_0xbc4a('0x6'));var config=require(_0xbc4a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbc4a('0x8')][_0xbc4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cb20a,_0x3c1fc8,_0x1dedd6){return new BPromise(function(_0x54a169,_0x174022){return client[_0xbc4a('0xa')](_0x1cb20a,_0x1dedd6)[_0xbc4a('0xb')](function(_0x2b9fef){logger[_0xbc4a('0xc')](_0xbc4a('0xd'),_0x3c1fc8,_0xbc4a('0xe'));logger[_0xbc4a('0xf')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x3c1fc8,'request\x20sent',JSON['stringify'](_0x2b9fef));if(_0x2b9fef[_0xbc4a('0x10')]){if(_0x2b9fef[_0xbc4a('0x10')][_0xbc4a('0x11')]===0x1f4){logger[_0xbc4a('0x10')](_0xbc4a('0xd'),_0x3c1fc8,_0x2b9fef[_0xbc4a('0x10')]['message']);return _0x174022(_0x2b9fef[_0xbc4a('0x10')][_0xbc4a('0x12')]);}logger[_0xbc4a('0x10')](_0xbc4a('0xd'),_0x3c1fc8,_0x2b9fef['error']['message']);return _0x54a169(_0x2b9fef[_0xbc4a('0x10')][_0xbc4a('0x12')]);}else{logger['info'](_0xbc4a('0xd'),_0x3c1fc8,'request\x20sent');_0x54a169(_0x2b9fef[_0xbc4a('0x13')][_0xbc4a('0x12')]);}})[_0xbc4a('0x14')](function(_0x4dff6c){logger[_0xbc4a('0x10')](_0xbc4a('0xd'),_0x3c1fc8,_0x4dff6c);_0x174022(_0x4dff6c);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9fcdb96..3b02560 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 _0xe656=['../../components/interaction/service','../../config/environment','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4ce459,_0x51459c){var _0x254ad1=function(_0x46a258){while(--_0x46a258){_0x4ce459['push'](_0x4ce459['shift']());}};_0x254ad1(++_0x51459c);}(_0xe656,0xf0));var _0x6e65=function(_0x4577bd,_0x31f1ea){_0x4577bd=_0x4577bd-0x0;var _0x4500aa=_0xe656[_0x4577bd];return _0x4500aa;};'use strict';var multer=require('multer');var util=require(_0x6e65('0x0'));var path=require(_0x6e65('0x1'));var timeout=require(_0x6e65('0x2'));var express=require('express');var router=express[_0x6e65('0x3')]();var auth=require(_0x6e65('0x4'));var interaction=require(_0x6e65('0x5'));var config=require(_0x6e65('0x6'));module['exports']=router; \ No newline at end of file +var _0xbd2a=['util','path','express','Router','../../config/environment','exports'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xbd2a,0x7e));var _0xabd2=function(_0x3bbddb,_0x21554b){_0x3bbddb=_0x3bbddb-0x0;var _0x49d47f=_0xbd2a[_0x3bbddb];return _0x49d47f;};'use strict';var multer=require('multer');var util=require(_0xabd2('0x0'));var path=require(_0xabd2('0x1'));var timeout=require('connect-timeout');var express=require(_0xabd2('0x2'));var router=express[_0xabd2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xabd2('0x4'));module[_0xabd2('0x5')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 69e8941..1b63682 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 _0xd8b0=['exports','sequelize'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x37f212,_0x9bf1b2){var _0x57ba32=function(_0xb71a58){while(--_0xb71a58){_0x37f212['push'](_0x37f212['shift']());}};_0x57ba32(++_0x9bf1b2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 310ec1d..c5baaa0 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 _0x2ed6=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','api','moment','bluebird','path'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x2ed6,0x12f));var _0x62ed=function(_0x388d56,_0x1c811d){_0x388d56=_0x388d56-0x0;var _0x1ae4c1=_0x2ed6[_0x388d56];return _0x1ae4c1;};'use strict';var _=require(_0x62ed('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x62ed('0x1'));var moment=require(_0x62ed('0x2'));var BPromise=require(_0x62ed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62ed('0x4'));var rimraf=require(_0x62ed('0x5'));var config=require(_0x62ed('0x6'));var attributes=require(_0x62ed('0x7'));module[_0x62ed('0x8')]=function(_0x5de607,_0x2d630c){return _0x5de607[_0x62ed('0x9')](_0x62ed('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x328f=['bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','moment'];(function(_0x59d06e,_0x5d7bfc){var _0x98ef6c=function(_0x369736){while(--_0x369736){_0x59d06e['push'](_0x59d06e['shift']());}};_0x98ef6c(++_0x5d7bfc);}(_0x328f,0x1a2));var _0xf328=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x328f[_0x5eaa0b];return _0x28b295;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf328('0x0'))('api');var moment=require(_0xf328('0x1'));var BPromise=require(_0xf328('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf328('0x3'));var rimraf=require(_0xf328('0x4'));var config=require(_0xf328('0x5'));var attributes=require(_0xf328('0x6'));module['exports']=function(_0x35d1b8,_0x4085bf){return _0x35d1b8[_0xf328('0x7')](_0xf328('0x8'),attributes,{'tableName':_0xf328('0x9'),'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 1c7e9cf..be3250e 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 _0xaa7c=['request','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x41b936,_0xe0c54c){var _0x4c7181=function(_0x94eafe){while(--_0x94eafe){_0x41b936['push'](_0x41b936['shift']());}};_0x4c7181(++_0xe0c54c);}(_0xaa7c,0x90));var _0xcaa7=function(_0xa9e64,_0x42dead){_0xa9e64=_0xa9e64-0x0;var _0x3ff542=_0xaa7c[_0xa9e64];return _0x3ff542;};'use strict';var _=require(_0xcaa7('0x0'));var util=require('util');var moment=require(_0xcaa7('0x1'));var BPromise=require(_0xcaa7('0x2'));var rs=require(_0xcaa7('0x3'));var fs=require('fs');var Redis=require(_0xcaa7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcaa7('0x5'));var logger=require('../../config/logger')(_0xcaa7('0x6'));var config=require(_0xcaa7('0x7'));var jayson=require(_0xcaa7('0x8'));var client=jayson['client'][_0xcaa7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d6de5,_0x51498a,_0xbc5511){return new BPromise(function(_0x3de6c0,_0xbad933){return client[_0xcaa7('0xa')](_0x1d6de5,_0xbc5511)['then'](function(_0x392233){logger['info'](_0xcaa7('0xb'),_0x51498a,_0xcaa7('0xc'));logger[_0xcaa7('0xd')](_0xcaa7('0xe'),_0x51498a,_0xcaa7('0xc'),JSON[_0xcaa7('0xf')](_0x392233));if(_0x392233[_0xcaa7('0x10')]){if(_0x392233[_0xcaa7('0x10')][_0xcaa7('0x11')]===0x1f4){logger[_0xcaa7('0x10')](_0xcaa7('0xb'),_0x51498a,_0x392233[_0xcaa7('0x10')][_0xcaa7('0x12')]);return _0xbad933(_0x392233[_0xcaa7('0x10')][_0xcaa7('0x12')]);}logger[_0xcaa7('0x10')](_0xcaa7('0xb'),_0x51498a,_0x392233[_0xcaa7('0x10')][_0xcaa7('0x12')]);return _0x3de6c0(_0x392233[_0xcaa7('0x10')][_0xcaa7('0x12')]);}else{logger[_0xcaa7('0x13')](_0xcaa7('0xb'),_0x51498a,_0xcaa7('0xc'));_0x3de6c0(_0x392233[_0xcaa7('0x14')][_0xcaa7('0x12')]);}})[_0xcaa7('0x15')](function(_0x49d77c){logger['error'](_0xcaa7('0xb'),_0x51498a,_0x49d77c);_0xbad933(_0x49d77c);});});} \ No newline at end of file +var _0xd58e=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0xd58e,0xf2));var _0xed58=function(_0x3daa29,_0x2301c8){_0x3daa29=_0x3daa29-0x0;var _0x204b71=_0xd58e[_0x3daa29];return _0x204b71;};'use strict';var _=require('lodash');var util=require(_0xed58('0x0'));var moment=require(_0xed58('0x1'));var BPromise=require(_0xed58('0x2'));var rs=require(_0xed58('0x3'));var fs=require('fs');var Redis=require(_0xed58('0x4'));var db=require(_0xed58('0x5'))['db'];var utils=require(_0xed58('0x6'));var logger=require(_0xed58('0x7'))(_0xed58('0x8'));var config=require(_0xed58('0x9'));var jayson=require(_0xed58('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20ab9c,_0x492edd,_0x34aad3){return new BPromise(function(_0x13181b,_0x34e9d2){return client[_0xed58('0xb')](_0x20ab9c,_0x34aad3)[_0xed58('0xc')](function(_0x217960){logger[_0xed58('0xd')](_0xed58('0xe'),_0x492edd,_0xed58('0xf'));logger[_0xed58('0x10')](_0xed58('0x11'),_0x492edd,_0xed58('0xf'),JSON[_0xed58('0x12')](_0x217960));if(_0x217960[_0xed58('0x13')]){if(_0x217960[_0xed58('0x13')][_0xed58('0x14')]===0x1f4){logger[_0xed58('0x13')](_0xed58('0xe'),_0x492edd,_0x217960[_0xed58('0x13')][_0xed58('0x15')]);return _0x34e9d2(_0x217960[_0xed58('0x13')][_0xed58('0x15')]);}logger['error'](_0xed58('0xe'),_0x492edd,_0x217960[_0xed58('0x13')][_0xed58('0x15')]);return _0x13181b(_0x217960[_0xed58('0x13')][_0xed58('0x15')]);}else{logger['info'](_0xed58('0xe'),_0x492edd,_0xed58('0xf'));_0x13181b(_0x217960[_0xed58('0x16')][_0xed58('0x15')]);}})[_0xed58('0x17')](function(_0x382a11){logger['error'](_0xed58('0xe'),_0x492edd,_0x382a11);_0x34e9d2(_0x382a11);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e1e7d28..47dcd58 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 _0x7980=['/:id/resources','create','post','/:id/clone','clone','/:id/sections','addSections','addResources','update','delete','destroy','removeResources','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getSections'];(function(_0x21b010,_0x22f887){var _0x4084f8=function(_0x1219b4){while(--_0x1219b4){_0x21b010['push'](_0x21b010['shift']());}};_0x4084f8(++_0x22f887);}(_0x7980,0xec));var _0x0798=function(_0x238d8b,_0x3da701){_0x238d8b=_0x238d8b-0x0;var _0x5680bb=_0x7980[_0x238d8b];return _0x5680bb;};'use strict';var multer=require(_0x0798('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0798('0x1'));var express=require(_0x0798('0x2'));var router=express[_0x0798('0x3')]();var auth=require(_0x0798('0x4'));var interaction=require(_0x0798('0x5'));var config=require(_0x0798('0x6'));var controller=require(_0x0798('0x7'));router[_0x0798('0x8')]('/',auth['isAuthenticated'](),controller[_0x0798('0x9')]);router[_0x0798('0x8')](_0x0798('0xa'),auth[_0x0798('0xb')](),controller[_0x0798('0xc')]);router[_0x0798('0x8')](_0x0798('0xd'),auth[_0x0798('0xb')](),controller[_0x0798('0xe')]);router[_0x0798('0x8')]('/:id/sections',auth[_0x0798('0xb')](),controller[_0x0798('0xf')]);router['get'](_0x0798('0x10'),auth[_0x0798('0xb')](),controller['getResources']);router['post']('/',auth[_0x0798('0xb')](),controller[_0x0798('0x11')]);router[_0x0798('0x12')](_0x0798('0x13'),auth[_0x0798('0xb')](),controller[_0x0798('0x14')]);router[_0x0798('0x12')](_0x0798('0x15'),auth['isAuthenticated'](),controller[_0x0798('0x16')]);router[_0x0798('0x12')](_0x0798('0x10'),auth['isAuthenticated'](),controller[_0x0798('0x17')]);router['put']('/:id',auth[_0x0798('0xb')](),controller[_0x0798('0x18')]);router[_0x0798('0x19')](_0x0798('0xd'),auth['isAuthenticated'](),controller[_0x0798('0x1a')]);router[_0x0798('0x19')](_0x0798('0x15'),auth[_0x0798('0xb')](),controller['removeSections']);router[_0x0798('0x19')](_0x0798('0x10'),auth[_0x0798('0xb')](),controller[_0x0798('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x3c48=['index','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','update','delete','removeSections','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated'];(function(_0x444045,_0x4334fc){var _0x3c5813=function(_0x17ff5d){while(--_0x17ff5d){_0x444045['push'](_0x444045['shift']());}};_0x3c5813(++_0x4334fc);}(_0x3c48,0x118));var _0x83c4=function(_0x540f98,_0x2914e8){_0x540f98=_0x540f98-0x0;var _0x24d309=_0x3c48[_0x540f98];return _0x24d309;};'use strict';var multer=require(_0x83c4('0x0'));var util=require('util');var path=require(_0x83c4('0x1'));var timeout=require(_0x83c4('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x83c4('0x3'));var config=require(_0x83c4('0x4'));var controller=require(_0x83c4('0x5'));router[_0x83c4('0x6')]('/',auth[_0x83c4('0x7')](),controller[_0x83c4('0x8')]);router['get']('/describe',auth[_0x83c4('0x7')](),controller[_0x83c4('0x9')]);router[_0x83c4('0x6')](_0x83c4('0xa'),auth[_0x83c4('0x7')](),controller[_0x83c4('0xb')]);router[_0x83c4('0x6')](_0x83c4('0xc'),auth[_0x83c4('0x7')](),controller[_0x83c4('0xd')]);router[_0x83c4('0x6')](_0x83c4('0xe'),auth[_0x83c4('0x7')](),controller[_0x83c4('0xf')]);router[_0x83c4('0x10')]('/',auth[_0x83c4('0x7')](),controller['create']);router[_0x83c4('0x10')](_0x83c4('0x11'),auth[_0x83c4('0x7')](),controller[_0x83c4('0x12')]);router[_0x83c4('0x10')](_0x83c4('0xc'),auth[_0x83c4('0x7')](),controller[_0x83c4('0x13')]);router[_0x83c4('0x10')](_0x83c4('0xe'),auth['isAuthenticated'](),controller['addResources']);router['put'](_0x83c4('0xa'),auth[_0x83c4('0x7')](),controller[_0x83c4('0x14')]);router[_0x83c4('0x15')](_0x83c4('0xa'),auth[_0x83c4('0x7')](),controller['destroy']);router['delete'](_0x83c4('0xc'),auth[_0x83c4('0x7')](),controller[_0x83c4('0x16')]);router[_0x83c4('0x15')](_0x83c4('0xe'),auth[_0x83c4('0x7')](),controller['removeResources']);module[_0x83c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4f9f314..8eb9b24 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 _0x1681=['STRING','name','setDataValue','crudPermissions','getDataValue','split'];(function(_0x251582,_0x5a7ad1){var _0x3d574b=function(_0x1f46d1){while(--_0x1f46d1){_0x251582['push'](_0x251582['shift']());}};_0x3d574b(++_0x5a7ad1);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1168('0x0')],'allowNull':![],'unique':_0x1168('0x1')},'crudPermissions':{'type':Sequelize[_0x1168('0x0')],'set':function(_0x3f21a4){this[_0x1168('0x2')](_0x1168('0x3'),_0x3f21a4?_0x3f21a4['join'](''):[]);},'get':function(){return this['getDataValue'](_0x1168('0x3'))?this[_0x1168('0x4')]('crudPermissions')[_0x1168('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1168('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x2fb3=['join','getDataValue','sequelize','name','STRING','setDataValue','crudPermissions'];(function(_0x344872,_0x483951){var _0x2374c9=function(_0x393eba){while(--_0x393eba){_0x344872['push'](_0x344872['shift']());}};_0x2374c9(++_0x483951);}(_0x2fb3,0x1a6));var _0x32fb=function(_0x11167c,_0x1721b6){_0x11167c=_0x11167c-0x0;var _0x2dbaf0=_0x2fb3[_0x11167c];return _0x2dbaf0;};'use strict';var Sequelize=require(_0x32fb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x32fb('0x1')},'crudPermissions':{'type':Sequelize[_0x32fb('0x2')],'set':function(_0x419315){this[_0x32fb('0x3')](_0x32fb('0x4'),_0x419315?_0x419315[_0x32fb('0x5')](''):[]);},'get':function(){return this[_0x32fb('0x6')](_0x32fb('0x4'))?this[_0x32fb('0x6')](_0x32fb('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 15eb60c..eb8e4de 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 _0xfd68=['ThroughTags','value','toLowerCase','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','internalroutes','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','User','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','variables','Variable','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','count','offset','limit','set','apply','save','update','destroy','then','error','stack','name','send','index','map','UserProfile','fieldName','type','key','query','filters','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','include','findAll','catch','params','keys','intersection','options','find','create','body','clone','rawAttributes','includeAll','get','createdAt','updatedAt','crudPermissions','omit','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','push','removeSections','ids','getSections','includes','subsections','enabled','Dashboard','forEach','resourceId','addResources','sequelize','bulkCreate','getResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','findOne','ignore','isEmpty','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','rows','Tag','color','tag'];(function(_0x13ba84,_0x86b36d){var _0x557e20=function(_0x2808e5){while(--_0x2808e5){_0x13ba84['push'](_0x13ba84['shift']());}};_0x557e20(++_0x86b36d);}(_0xfd68,0x67));var _0x8fd6=function(_0x346eb4,_0x4cdb00){_0x346eb4=_0x346eb4-0x0;var _0x4ce241=_0xfd68[_0x346eb4];return _0x4ce241;};'use strict';var pdf=require(_0x8fd6('0x0'));var emlformat=require(_0x8fd6('0x1'));var rimraf=require(_0x8fd6('0x2'));var zipdir=require(_0x8fd6('0x3'));var jsonpatch=require(_0x8fd6('0x4'));var rp=require(_0x8fd6('0x5'));var moment=require(_0x8fd6('0x6'));var BPromise=require(_0x8fd6('0x7'));var Mustache=require(_0x8fd6('0x8'));var util=require('util');var path=require(_0x8fd6('0x9'));var sox=require(_0x8fd6('0xa'));var csv=require(_0x8fd6('0xb'));var ejs=require(_0x8fd6('0xc'));var fs=require('fs');var _=require(_0x8fd6('0xd'));var squel=require(_0x8fd6('0xe'));var crypto=require(_0x8fd6('0xf'));var jsforce=require(_0x8fd6('0x10'));var deskjs=require(_0x8fd6('0x11'));var toCsv=require(_0x8fd6('0xb'));var querystring=require('querystring');var Papa=require(_0x8fd6('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8fd6('0x13'));var as=require(_0x8fd6('0x14'));var hardwareService=require(_0x8fd6('0x15'));var logger=require(_0x8fd6('0x16'))(_0x8fd6('0x17'));var utils=require(_0x8fd6('0x18'));var config=require('../../config/environment');var db=require(_0x8fd6('0x19'))['db'];config['redis']=_[_0x8fd6('0x1a')](config[_0x8fd6('0x1b')],{'host':_0x8fd6('0x1c'),'port':0x18eb});var socket=require(_0x8fd6('0x1d'))(new Redis(config[_0x8fd6('0x1b')]));require(_0x8fd6('0x1e'))[_0x8fd6('0x1f')](socket);function respondWithStatusCode(_0x4c3aae,_0x50e488){_0x50e488=_0x50e488||0xcc;return function(_0xc7d61f){if(_0xc7d61f){return _0x4c3aae[_0x8fd6('0x20')](_0x50e488);}return _0x4c3aae[_0x8fd6('0x21')](_0x50e488)[_0x8fd6('0x22')]();};}function respondWithResult(_0x1629ad,_0x5dc198){_0x5dc198=_0x5dc198||0xc8;return function(_0x75a892){if(_0x75a892){return _0x1629ad[_0x8fd6('0x21')](_0x5dc198)['json'](_0x75a892);}};}function respondWithFilteredResult(_0x3ea811,_0x308113){return function(_0x3925be){if(_0x3925be){var _0x33f9b4=_0x3925be[_0x8fd6('0x23')],_0x33a4af=_0x308113['offset'],_0x45036e=_0x308113[_0x8fd6('0x24')]+_0x308113[_0x8fd6('0x25')],_0x5a701a;if(_0x45036e>=_0x33f9b4){_0x45036e=_0x33f9b4;_0x5a701a=0xc8;}else{_0x5a701a=0xce;}_0x3ea811[_0x8fd6('0x21')](_0x5a701a);return _0x3ea811[_0x8fd6('0x26')]('Content-Range',_0x33a4af+'-'+_0x45036e+'/'+_0x33f9b4)['json'](_0x3925be);}return null;};}function patchUpdates(_0x4d2276){return function(_0x176c26){try{jsonpatch[_0x8fd6('0x27')](_0x176c26,_0x4d2276,!![]);}catch(_0x1574d3){return BPromise['reject'](_0x1574d3);}return _0x176c26[_0x8fd6('0x28')]();};}function saveUpdates(_0x5821ce,_0xba6240){return function(_0x5df426){if(_0x5df426){return _0x5df426[_0x8fd6('0x29')](_0x5821ce)['then'](function(_0xaa198d){return _0xaa198d;});}return null;};}function removeEntity(_0x15be7f,_0x370389){return function(_0x35bcb1){if(_0x35bcb1){return _0x35bcb1[_0x8fd6('0x2a')]()[_0x8fd6('0x2b')](function(){_0x15be7f[_0x8fd6('0x21')](0xcc)[_0x8fd6('0x22')]();});}};}function handleEntityNotFound(_0x4d27b0,_0x415eda){return function(_0x1c6025){if(!_0x1c6025){_0x4d27b0[_0x8fd6('0x20')](0x194);}return _0x1c6025;};}function handleError(_0x52fee6,_0x42ae0d){_0x42ae0d=_0x42ae0d||0x1f4;return function(_0x4e4c4d){logger[_0x8fd6('0x2c')](_0x4e4c4d[_0x8fd6('0x2d')]);if(_0x4e4c4d[_0x8fd6('0x2e')]){delete _0x4e4c4d[_0x8fd6('0x2e')];}_0x52fee6[_0x8fd6('0x21')](_0x42ae0d)[_0x8fd6('0x2f')](_0x4e4c4d);};}exports[_0x8fd6('0x30')]=function(_0x12f690,_0x20a3fe){var _0x54af10={},_0x307b47={},_0x21c293={'count':0x0,'rows':[]};var _0x21a2c6=_[_0x8fd6('0x31')](db[_0x8fd6('0x32')]['rawAttributes'],function(_0x3328f6){return{'name':_0x3328f6[_0x8fd6('0x33')],'type':_0x3328f6[_0x8fd6('0x34')][_0x8fd6('0x35')]};});_0x307b47['model']=_[_0x8fd6('0x31')](_0x21a2c6,'name');_0x307b47[_0x8fd6('0x36')]=_['keys'](_0x12f690['query']);_0x307b47[_0x8fd6('0x37')]=_['intersection'](_0x307b47['model'],_0x307b47[_0x8fd6('0x36')]);_0x54af10[_0x8fd6('0x38')]=_['intersection'](_0x307b47['model'],qs[_0x8fd6('0x39')](_0x12f690[_0x8fd6('0x36')]['fields']));_0x54af10[_0x8fd6('0x38')]=_0x54af10['attributes'][_0x8fd6('0x3a')]?_0x54af10[_0x8fd6('0x38')]:_0x307b47[_0x8fd6('0x3b')];if(!_0x12f690[_0x8fd6('0x36')][_0x8fd6('0x3c')](_0x8fd6('0x3d'))){_0x54af10[_0x8fd6('0x25')]=qs[_0x8fd6('0x25')](_0x12f690['query'][_0x8fd6('0x25')]);_0x54af10['offset']=qs[_0x8fd6('0x24')](_0x12f690[_0x8fd6('0x36')][_0x8fd6('0x24')]);}_0x54af10['order']=qs[_0x8fd6('0x3e')](_0x12f690[_0x8fd6('0x36')][_0x8fd6('0x3e')]);_0x54af10[_0x8fd6('0x3f')]=qs[_0x8fd6('0x37')](_[_0x8fd6('0x40')](_0x12f690[_0x8fd6('0x36')],_0x307b47[_0x8fd6('0x37')]),_0x21a2c6);if(_0x12f690[_0x8fd6('0x36')][_0x8fd6('0x41')]){_0x54af10[_0x8fd6('0x3f')]=_[_0x8fd6('0x42')](_0x54af10[_0x8fd6('0x3f')],{'$or':_['map'](_0x21a2c6,function(_0x472c04){if(_0x472c04[_0x8fd6('0x34')]!=='VIRTUAL'){var _0xa68163={};_0xa68163[_0x472c04[_0x8fd6('0x2e')]]={'$like':'%'+_0x12f690[_0x8fd6('0x36')][_0x8fd6('0x41')]+'%'};return _0xa68163;}})});}_0x54af10=_[_0x8fd6('0x42')]({},_0x54af10,_0x12f690['options']);var _0x5a268a={'where':_0x54af10['where']};return db[_0x8fd6('0x32')][_0x8fd6('0x23')](_0x5a268a)[_0x8fd6('0x2b')](function(_0xab19d1){_0x21c293['count']=_0xab19d1;if(_0x12f690['query']['includeAll']){_0x54af10[_0x8fd6('0x43')]=[{'all':!![]}];}return db['UserProfile'][_0x8fd6('0x44')](_0x54af10);})['then'](function(_0xe5e973){_0x21c293['rows']=_0xe5e973;return _0x21c293;})[_0x8fd6('0x2b')](respondWithFilteredResult(_0x20a3fe,_0x54af10))[_0x8fd6('0x45')](handleError(_0x20a3fe,null));};exports['show']=function(_0x335b39,_0x1aaab1){var _0x4e5708={'raw':![],'where':{'id':_0x335b39[_0x8fd6('0x46')]['id']}},_0x5536f7={};_0x5536f7[_0x8fd6('0x3b')]=_[_0x8fd6('0x47')](db['UserProfile']['rawAttributes']);_0x5536f7[_0x8fd6('0x36')]=_['keys'](_0x335b39[_0x8fd6('0x36')]);_0x5536f7[_0x8fd6('0x37')]=_[_0x8fd6('0x48')](_0x5536f7['model'],_0x5536f7[_0x8fd6('0x36')]);_0x4e5708[_0x8fd6('0x38')]=_['intersection'](_0x5536f7['model'],qs[_0x8fd6('0x39')](_0x335b39[_0x8fd6('0x36')][_0x8fd6('0x39')]));_0x4e5708[_0x8fd6('0x38')]=_0x4e5708['attributes'][_0x8fd6('0x3a')]?_0x4e5708[_0x8fd6('0x38')]:_0x5536f7[_0x8fd6('0x3b')];if(_0x335b39[_0x8fd6('0x36')]['includeAll']){_0x4e5708[_0x8fd6('0x43')]=[{'all':!![]}];}_0x4e5708=_[_0x8fd6('0x42')]({},_0x4e5708,_0x335b39[_0x8fd6('0x49')]);return db[_0x8fd6('0x32')][_0x8fd6('0x4a')](_0x4e5708)[_0x8fd6('0x2b')](handleEntityNotFound(_0x1aaab1,null))[_0x8fd6('0x2b')](respondWithResult(_0x1aaab1,null))[_0x8fd6('0x45')](handleError(_0x1aaab1,null));};exports[_0x8fd6('0x4b')]=function(_0x1710f5,_0x270a7e){return db['UserProfile'][_0x8fd6('0x4b')](_0x1710f5[_0x8fd6('0x4c')],{})[_0x8fd6('0x2b')](respondWithResult(_0x270a7e,0xc9))['catch'](handleError(_0x270a7e,null));};exports[_0x8fd6('0x4d')]=function(_0x55fe97,_0xc7d732){var _0x6c19cd={'where':{'id':_0x55fe97[_0x8fd6('0x46')]['id']}},_0x42b27e={};_0x42b27e[_0x8fd6('0x3b')]=_[_0x8fd6('0x47')](db[_0x8fd6('0x32')][_0x8fd6('0x4e')]);_0x6c19cd[_0x8fd6('0x38')]=_[_0x8fd6('0x48')](_0x42b27e[_0x8fd6('0x3b')],qs[_0x8fd6('0x39')](_0x55fe97[_0x8fd6('0x36')][_0x8fd6('0x39')]));_0x6c19cd[_0x8fd6('0x38')]=_0x6c19cd[_0x8fd6('0x38')]['length']?_0x6c19cd[_0x8fd6('0x38')]:_0x42b27e[_0x8fd6('0x3b')];if(_0x55fe97['query'][_0x8fd6('0x4f')]){_0x6c19cd[_0x8fd6('0x43')]=[{'all':!![]}];}_0x6c19cd=_[_0x8fd6('0x42')]({},_0x6c19cd,_0x55fe97['options']);return db[_0x8fd6('0x32')][_0x8fd6('0x4a')](_0x6c19cd)[_0x8fd6('0x2b')](handleEntityNotFound(_0xc7d732,null))[_0x8fd6('0x2b')](function(_0x31cdfb){if(_0x31cdfb){var _0x62fab0=_0x31cdfb[_0x8fd6('0x50')]({'plain':!![]});_0x62fab0=qs['omit'](_0x62fab0,['id',_0x8fd6('0x51'),_0x8fd6('0x52'),_0x8fd6('0x53')]);_0x55fe97[_0x8fd6('0x4c')]=_[_0x8fd6('0x54')](_0x55fe97['body'],['id',_0x8fd6('0x51'),'updatedAt']);return db['sequelize'][_0x8fd6('0x55')](function(_0x5d649b){return db[_0x8fd6('0x32')][_0x8fd6('0x4b')](_['merge'](_0x62fab0,_0x55fe97[_0x8fd6('0x4c')]),{'include':_0x55fe97[_0x8fd6('0x36')][_0x8fd6('0x4f')]?[{'all':!![]}]:undefined,'transaction':_0x5d649b})[_0x8fd6('0x2b')](function(_0x2d188f){var _0x171fdb=_0x2d188f[_0x8fd6('0x50')]({'plain':!![]});return db[_0x8fd6('0x56')][_0x8fd6('0x44')]({'where':{'userProfileId':_0x55fe97['params']['id']},'raw':!![]})[_0x8fd6('0x2b')](function(_0x3e2d0a){if(_0x3e2d0a){return BPromise[_0x8fd6('0x57')](_0x3e2d0a,function(_0x2ae33f){return new BPromise(function(_0x4de726,_0xc099b3){if(_0x2ae33f['autoAssociation']===null||_0x2ae33f[_0x8fd6('0x58')]===0x1)_0x4de726(null);return db[_0x8fd6('0x59')][_0x8fd6('0x44')]({'where':{'sectionId':_0x2ae33f['id']},'raw':!![]})['then'](function(_0x28e32d){var _0x116eee=_[_0x8fd6('0x31')](_0x28e32d,function(_0xaefd8e){return qs['omit'](_0xaefd8e,['id',_0x8fd6('0x51'),'updatedAt',_0x8fd6('0x5a')]);});_0x4de726(_0x116eee);})['catch'](function(_0x57dcf1){_0xc099b3(_0x57dcf1);});})['then'](function(_0x3ce845){var _0xa586c7=qs[_0x8fd6('0x54')](_0x2ae33f,['id',_0x8fd6('0x51'),_0x8fd6('0x52')]);_0xa586c7['userProfileId']=_0x171fdb['id'];if(_0x3ce845)_0xa586c7[_0x8fd6('0x5b')]=_0x3ce845;return _0xa586c7;})[_0x8fd6('0x2b')](function(_0xb82d4c){return db[_0x8fd6('0x56')][_0x8fd6('0x4b')](_0xb82d4c,{'include':[{'model':db['UserProfileResource'],'as':_0x8fd6('0x5b')}],'raw':!![],'transaction':_0x5d649b});});})[_0x8fd6('0x2b')](function(){return _0x171fdb;});}});});});}})[_0x8fd6('0x2b')](respondWithResult(_0xc7d732,0xc9))[_0x8fd6('0x45')](handleError(_0xc7d732,null));};exports[_0x8fd6('0x29')]=function(_0x882221,_0x1dca2c){if(_0x882221[_0x8fd6('0x4c')]['id']){delete _0x882221[_0x8fd6('0x4c')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x882221[_0x8fd6('0x46')]['id']}})[_0x8fd6('0x2b')](handleEntityNotFound(_0x1dca2c,null))[_0x8fd6('0x2b')](saveUpdates(_0x882221['body'],null))[_0x8fd6('0x2b')](respondWithResult(_0x1dca2c,null))[_0x8fd6('0x45')](handleError(_0x1dca2c,null));};exports[_0x8fd6('0x2a')]=function(_0x11c955,_0x507e33){return db[_0x8fd6('0x32')]['find']({'where':{'id':_0x11c955[_0x8fd6('0x46')]['id']}})[_0x8fd6('0x2b')](handleEntityNotFound(_0x507e33,null))[_0x8fd6('0x2b')](removeEntity(_0x507e33,null))[_0x8fd6('0x45')](handleError(_0x507e33,null));};exports[_0x8fd6('0x5c')]=function(_0x323e19,_0x166d3d){return db[_0x8fd6('0x32')][_0x8fd6('0x5c')]()[_0x8fd6('0x2b')](respondWithResult(_0x166d3d,null))['catch'](handleError(_0x166d3d,null));};exports[_0x8fd6('0x5d')]=function(_0x3060f8,_0x1ca5e5){var _0x11aa7d=_0x3060f8[_0x8fd6('0x4c')];return db[_0x8fd6('0x32')]['find']({'where':{'id':_0x3060f8[_0x8fd6('0x46')]['id']}})[_0x8fd6('0x2b')](handleEntityNotFound(_0x1ca5e5,null))['then'](function(_0x42a8a2){if(_0x42a8a2){return db['sequelize'][_0x8fd6('0x55')](function(_0x5dba78){return db[_0x8fd6('0x56')][_0x8fd6('0x2a')]({'where':{'userProfileId':_0x3060f8[_0x8fd6('0x46')]['id'],'sectionId':_[_0x8fd6('0x31')](_0x11aa7d,function(_0x296121){return _0x296121[_0x8fd6('0x5a')];})},'transaction':_0x5dba78})[_0x8fd6('0x2b')](function(){var _0x3f3f2a=_['map'](_0x11aa7d,function(_0x3ff00b){_0x3ff00b[_0x8fd6('0x5e')]=_0x3060f8[_0x8fd6('0x46')]['id'];return _0x3ff00b;});var _0x2f9f7e=[];return BPromise['each'](_0x3f3f2a,function(_0x4d0ed0){return db[_0x8fd6('0x56')][_0x8fd6('0x4b')](_0x4d0ed0,{'include':[{'model':db[_0x8fd6('0x59')],'as':_0x8fd6('0x5b')}],'raw':!![],'transaction':_0x5dba78})['then'](function(_0x27a4ef){_0x2f9f7e[_0x8fd6('0x5f')](_0x27a4ef[_0x8fd6('0x50')]({'plain':!![]}));});})[_0x8fd6('0x2b')](function(){return _0x2f9f7e;});});});}})['then'](function(_0x5dd964){return _0x5dd964;})[_0x8fd6('0x2b')](respondWithResult(_0x1ca5e5,null))[_0x8fd6('0x45')](handleError(_0x1ca5e5,null));};exports[_0x8fd6('0x60')]=function(_0x4984be,_0x28bd92){var _0x4062c9;return db[_0x8fd6('0x32')][_0x8fd6('0x4a')]({'where':{'id':_0x4984be[_0x8fd6('0x46')]['id']},'attributes':['id','name']})[_0x8fd6('0x2b')](handleEntityNotFound(_0x28bd92,null))[_0x8fd6('0x2b')](function(_0x595800){if(_0x595800){_0x4062c9=_0x595800;return db[_0x8fd6('0x56')][_0x8fd6('0x2a')]({'where':{'userProfileId':_0x4984be['params']['id'],'sectionId':_0x4984be[_0x8fd6('0x36')][_0x8fd6('0x61')]}});}})[_0x8fd6('0x2b')](function(){return _0x4062c9;})['then'](respondWithStatusCode(_0x28bd92,null))['catch'](handleError(_0x28bd92,null));};exports[_0x8fd6('0x62')]=function(_0x354b87,_0x5b88c6){var _0x1c8e1d=[];var _0xfe6418=[];return db[_0x8fd6('0x56')][_0x8fd6('0x44')]({'where':{'userProfileId':_0x354b87[_0x8fd6('0x46')]['id']},'raw':!![]})[_0x8fd6('0x2b')](function(_0x156932){_0x1c8e1d=_[_0x8fd6('0x41')](_0x156932,function(_0x6f525d){return _0x6f525d['enabled']===0x1||_[_0x8fd6('0x63')]([0x3eb,0x709],_0x6f525d[_0x8fd6('0x5a')]);});if(!_['isEmpty'](_0x1c8e1d)){return _[_0x8fd6('0x31')](_0x1c8e1d,function(_0xcf1c79){return _0xcf1c79[_0x8fd6('0x5a')];});}else{return;}})[_0x8fd6('0x2b')](function(_0x2ee5a0){if(_0x2ee5a0)_0xfe6418=_0x2ee5a0;if(_['includes'](_0xfe6418,0x64)){var _0x41753c=_[_0x8fd6('0x4a')](_0x1c8e1d,{'sectionId':0x64});return hasDefaultDashboard(_0x41753c)[_0x8fd6('0x2b')](function(_0xec4276){return _[_0x8fd6('0x31')](_0x1c8e1d,function(_0x57a220){if(_0x57a220[_0x8fd6('0x5a')]===0x64){_0x57a220[_0x8fd6('0x64')]=_0xec4276;}return _0x57a220;});});}else{return;}})[_0x8fd6('0x2b')](function(_0x2b0908){if(_0x2b0908)_0x1c8e1d=_0x2b0908;if(_[_0x8fd6('0x63')](_0xfe6418,0x3eb)){var _0x1aeded=_['find'](_0x1c8e1d,{'sectionId':0x3eb});return getCustomDashboards(_0x1aeded)['then'](function(_0x11aa47){return _['map'](_0x1c8e1d,function(_0x300dc3){if(_0x1aeded[_0x8fd6('0x65')]){if(_0x300dc3['sectionId']===0x3eb){_0x300dc3[_0x8fd6('0x64')]=_0x11aa47;}}else{if(_0x300dc3['sectionId']===0x64){_0x300dc3[_0x8fd6('0x64')]=_0x11aa47;}}return _0x300dc3;});});}else{return;}})[_0x8fd6('0x2b')](function(_0x441847){if(_0x441847)_0x1c8e1d=_0x441847;if(_[_0x8fd6('0x63')](_0xfe6418,0x709)){var _0xb5b5a0=_['find'](_0x1c8e1d,{'sectionId':0x709});return getPlugins(_0xb5b5a0)['then'](function(_0x5cc2d0){if(_0xb5b5a0[_0x8fd6('0x65')]){return _[_0x8fd6('0x31')](_0x1c8e1d,function(_0x1da23a){if(_0x1da23a[_0x8fd6('0x5a')]===0x709){_0x1da23a[_0x8fd6('0x64')]=_0x5cc2d0;}return _0x1da23a;});}else{var _0x15c75c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5cc2d0};var _0x620206=_[_0x8fd6('0x31')](_0x1c8e1d);_0x620206[_0x8fd6('0x5f')](_0x15c75c);return _0x620206;}});}else{return;}})[_0x8fd6('0x2b')](function(_0x23b95e){if(_0x23b95e)_0x1c8e1d=_0x23b95e;return _[_0x8fd6('0x41')](_0x1c8e1d,[_0x8fd6('0x65'),0x1]);})['then'](respondWithResult(_0x5b88c6,null))[_0x8fd6('0x45')](handleError(_0x5b88c6,null));};function hasDefaultDashboard(_0x451457){var _0x14dfbb=[0x65];return new BPromise(function(_0x16270c,_0x7dbfd7){try{if(_0x451457[_0x8fd6('0x58')]){_0x16270c(_0x14dfbb);}else{return db[_0x8fd6('0x59')]['findOne']({'where':{'sectionId':_0x451457['id']},'raw':!![]})[_0x8fd6('0x2b')](function(_0x247752){_0x247752?_0x16270c(_0x14dfbb):_0x16270c();});}}catch(_0x1bc21c){_0x7dbfd7(_0x1bc21c);}});}function getCustomDashboards(_0x2ea2fc){var _0xb36ed0=[];return new BPromise(function(_0x4b7efd,_0x455b43){try{if(_0x2ea2fc[_0x8fd6('0x58')]){return db[_0x8fd6('0x66')][_0x8fd6('0x44')]({'raw':!![]})[_0x8fd6('0x2b')](function(_0x91f45){_0x91f45[_0x8fd6('0x67')](function(_0x1be8b7){_0xb36ed0[_0x8fd6('0x5f')](_0x1be8b7['id']+0x1869f);});_0x4b7efd(_0xb36ed0);});}else{return db[_0x8fd6('0x59')][_0x8fd6('0x44')]({'where':{'sectionId':_0x2ea2fc['id']},'raw':!![]})[_0x8fd6('0x2b')](function(_0x48b6d3){_0x48b6d3[_0x8fd6('0x67')](function(_0x134c20){_0xb36ed0[_0x8fd6('0x5f')](_0x134c20[_0x8fd6('0x68')]+0x1869f);});_0x4b7efd(_0xb36ed0);});}}catch(_0x10ba16){_0x455b43(_0x10ba16);}});}function getPlugins(_0x5df837){var _0x305f9d=[];return new BPromise(function(_0xee6e9f,_0x4f4d84){try{if(_0x5df837[_0x8fd6('0x58')]){return db['Plugin'][_0x8fd6('0x44')]({'raw':!![]})['then'](function(_0xeb8512){_0xeb8512['forEach'](function(_0x2e33c9){_0x305f9d['push'](_0x2e33c9['id']+0x15b38);});_0xee6e9f(_0x305f9d);});}else{return db[_0x8fd6('0x59')][_0x8fd6('0x44')]({'where':{'sectionId':_0x5df837['id']},'raw':!![]})[_0x8fd6('0x2b')](function(_0x3d263c){_0x3d263c[_0x8fd6('0x67')](function(_0x530aad){_0x305f9d[_0x8fd6('0x5f')](_0x530aad['resourceId']+0x15b38);});_0xee6e9f(_0x305f9d);});}}catch(_0x18fc17){_0x4f4d84(_0x18fc17);}});}exports[_0x8fd6('0x69')]=function(_0x3ade44,_0x190703){return db[_0x8fd6('0x32')][_0x8fd6('0x4a')]({'where':{'id':_0x3ade44['params']['id']}})['then'](handleEntityNotFound(_0x190703,null))['then'](function(_0x81028b){if(_0x81028b){return db[_0x8fd6('0x6a')][_0x8fd6('0x55')](function(_0x303253){return db['UserProfileSection'][_0x8fd6('0x44')]({'where':{'userProfileId':_0x3ade44[_0x8fd6('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x8fd6('0x2b')](function(_0x1fd74a){if(_0x1fd74a){return db[_0x8fd6('0x56')][_0x8fd6('0x2a')]({'where':{'userProfileId':_0x3ade44['params']['id'],'id':_[_0x8fd6('0x31')](_0x1fd74a,function(_0x3a80ff){return _0x3a80ff['id'];})},'transaction':_0x303253});}})[_0x8fd6('0x2b')](function(_0x2ae953){var _0xc5d91b=_[_0x8fd6('0x31')](_0x3ade44[_0x8fd6('0x4c')],function(_0x2c1ee7){_0x2c1ee7[_0x8fd6('0x5e')]=_0x3ade44[_0x8fd6('0x46')]['id'];return _0x2c1ee7;});return db[_0x8fd6('0x56')][_0x8fd6('0x6b')](_0xc5d91b,{'raw':!![],'transaction':_0x303253});})['then'](function(_0x409bfb){var _0x2e6713=_[_0x8fd6('0x41')](_[_0x8fd6('0x31')](_0x409bfb,function(_0x504b28){return _0x504b28[_0x8fd6('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x2e6713){return db[_0x8fd6('0x56')][_0x8fd6('0x44')]({'where':{'userProfileId':_0x3ade44[_0x8fd6('0x46')]['id'],'sectionId':_[_0x8fd6('0x31')](_0x2e6713,function(_0x3f7cae){return _0x3f7cae['sectionId'];})},'attributes':['id',_0x8fd6('0x5a')],'raw':!![]})['then'](function(_0x4b384b){var _0x3ed29a=_[_0x8fd6('0x31')](_0x3ade44[_0x8fd6('0x4c')],function(_0x156c61){_0x156c61[_0x8fd6('0x5e')]=_0x3ade44[_0x8fd6('0x46')]['id'];return _0x156c61;});return db[_0x8fd6('0x59')][_0x8fd6('0x6b')](_0x3ed29a,{'raw':!![],'transaction':_0x303253});});}})[_0x8fd6('0x45')](handleError(_0x190703,null));});}})[_0x8fd6('0x2b')](function(_0x7e2ccf){var _0x2eeb3d=_[_0x8fd6('0x31')](_0x7e2ccf,function(_0x28f946){return _0x28f946[_0x8fd6('0x50')]({'plain':!![]});});})[_0x8fd6('0x2b')](respondWithResult(_0x190703,null))[_0x8fd6('0x45')](handleError(_0x190703,null));};exports['removeResources']=function(_0x2b0262,_0x2e9b55,_0x57cc43){return db[_0x8fd6('0x32')][_0x8fd6('0x4a')]({'where':{'id':_0x2b0262[_0x8fd6('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e9b55,null))[_0x8fd6('0x2b')](function(_0x5963f2){if(_0x5963f2){return _0x5963f2['removeResources'](_0x2b0262[_0x8fd6('0x36')][_0x8fd6('0x61')]);}})[_0x8fd6('0x2b')](respondWithStatusCode(_0x2e9b55,null))[_0x8fd6('0x45')](handleError(_0x2e9b55,null));};exports[_0x8fd6('0x6c')]=function(_0x9b7e2d,_0x143eb5){var _0xa94fae={'raw':![],'where':{}};var _0x14a120={};var _0x3ce920={'count':0x0,'rows':[]};var _0x25158c=_0x9b7e2d['query'][_0x8fd6('0x6d')];if(typeof _0x25158c===_0x8fd6('0x6e')){throw new db[(_0x8fd6('0x6f'))]['ValidationError'](_0x8fd6('0x70'));}var _0x532c2e=_0x9b7e2d['query'][_0x8fd6('0x71')]||![];var _0x2ad060=getQueryModels(_0x25158c,_0x532c2e);if(typeof _0x2ad060[_0x8fd6('0x72')]===_0x8fd6('0x6e')){throw new db['Sequelize']['ValidationError'](_0x8fd6('0x73')+_0x25158c+'\x27');}var _0x2c84cb=[];if(!_['isEmpty'](_0x2ad060['parentSections'])){_0x2c84cb=_0x2ad060[_0x8fd6('0x74')];}else{_0x2c84cb=[{'name':_0x25158c}];}return db['UserProfile']['findOne']({'where':{'id':_0x9b7e2d['params']['id']}})['then'](handleEntityNotFound(_0x143eb5,null))[_0x8fd6('0x2b')](function(_0x5f0e73){if(_0x5f0e73){var _0x23ee08=[];for(var _0x4d478f=0x0;_0x4d478f<_0x2c84cb[_0x8fd6('0x3a')];_0x4d478f++){_0x23ee08['push'](db[_0x8fd6('0x56')][_0x8fd6('0x75')]({'where':{'userProfileId':_0x5f0e73['id'],'name':_0x2c84cb[_0x4d478f][_0x8fd6('0x2e')]},'raw':!![]}));}return BPromise['all'](_0x23ee08);}})[_0x8fd6('0x2b')](function(_0x5ce9d3){var _0x2be30f=_[_0x8fd6('0x41')](_0x5ce9d3,function(_0x1564ff){return _0x1564ff?_0x1564ff:undefined;});var _0x4d5a01=_['filter'](_0x2c84cb,[_0x8fd6('0x76'),!![]]);var _0xfff8f0=_[_0x8fd6('0x77')](_0x2be30f)&&_[_0x8fd6('0x77')](_0x4d5a01)?null:_['union'](_0x4d5a01,_0x2be30f);if(_0xfff8f0){var _0x2f8a58=[];for(var _0x4adc29=0x0;_0x4adc29<_0xfff8f0[_0x8fd6('0x3a')];_0x4adc29++){var _0x534b35=_['find'](_0x2c84cb,function(_0x510363){return _0xfff8f0[_0x4adc29]?_0x510363['name']===_0xfff8f0[_0x4adc29][_0x8fd6('0x2e')]:null;});if(_0x534b35){if(_0xfff8f0[_0x4adc29][_0x8fd6('0x76')]){_0x2f8a58[_0x8fd6('0x5f')](getAllResources(_0x2ad060[_0x8fd6('0x72')],_0xfff8f0[_0x4adc29]));}else{if(!_0xfff8f0[_0x4adc29][_0x8fd6('0x58')]){_0x2f8a58['push'](getAllowedResources(_0x534b35,_0xfff8f0[_0x4adc29],_0x2ad060['childModel']));}else{if(_0x534b35[_0x8fd6('0x3b')]){_0x2f8a58[_0x8fd6('0x5f')](getAllFilteredResources(_0x534b35,_0xfff8f0[_0x4adc29]));}}}}}return BPromise['all'](_0x2f8a58);}else{return null;}})[_0x8fd6('0x2b')](function(_0x28d9f8){var _0x30ae3f=_0x28d9f8;var _0x365e86=null;if(_0x30ae3f){_0x365e86=_0x30ae3f[_0x8fd6('0x3a')]===0x1?_0x30ae3f[0x0]:null;}if(_0x365e86||_0x30ae3f){var _0x35671a=db[_0x2ad060[_0x8fd6('0x72')]][_0x8fd6('0x4e')];_0x14a120[_0x8fd6('0x3b')]=_[_0x8fd6('0x47')](_0x35671a);_0x14a120[_0x8fd6('0x36')]=_[_0x8fd6('0x47')](_0x9b7e2d[_0x8fd6('0x36')]);_0x14a120[_0x8fd6('0x37')]=_[_0x8fd6('0x48')](_0x14a120[_0x8fd6('0x3b')],_0x14a120[_0x8fd6('0x36')]);_0xa94fae[_0x8fd6('0x38')]=_[_0x8fd6('0x48')](_0x14a120['model'],qs[_0x8fd6('0x39')](_0x9b7e2d['query']['fields']));_0xa94fae[_0x8fd6('0x38')]=_0xa94fae[_0x8fd6('0x38')][_0x8fd6('0x3a')]?_0xa94fae[_0x8fd6('0x38')]:_0x14a120['model'];if(!_0x9b7e2d['query']['hasOwnProperty'](_0x8fd6('0x3d'))){_0xa94fae[_0x8fd6('0x25')]=qs[_0x8fd6('0x25')](_0x9b7e2d[_0x8fd6('0x36')][_0x8fd6('0x25')]);_0xa94fae['offset']=qs['offset'](_0x9b7e2d[_0x8fd6('0x36')][_0x8fd6('0x24')]);}_0xa94fae['order']=qs[_0x8fd6('0x3e')](_0x9b7e2d[_0x8fd6('0x36')][_0x8fd6('0x3e')]);_0xa94fae[_0x8fd6('0x3f')]=qs[_0x8fd6('0x37')](_['pick'](_0x9b7e2d['query'],_0x14a120[_0x8fd6('0x37')]));if(_0x9b7e2d[_0x8fd6('0x36')]['filter']){_0xa94fae[_0x8fd6('0x3f')]=_[_0x8fd6('0x42')](_0xa94fae['where'],{'$or':_[_0x8fd6('0x31')](_0x35671a,function(_0x426ad3){if(_0x426ad3[_0x8fd6('0x34')][_0x8fd6('0x35')]!==_0x8fd6('0x78')){var _0x2c4a49={};_0x2c4a49[_0x426ad3['field']]={'$like':'%'+_0x9b7e2d[_0x8fd6('0x36')][_0x8fd6('0x41')]+'%'};return _0x2c4a49;}})});}var _0x310410=[];if(_0x365e86){var _0x40dc1b=_[_0x8fd6('0x4a')](_0x2c84cb,['name',_0x365e86[_0x8fd6('0x2e')]]);if(_0x40dc1b[_0x8fd6('0x79')]){var _0x1434f6={};if(_0x2ad060[_0x8fd6('0x72')]===_0x8fd6('0x7a')){_0x1434f6[_0x40dc1b[_0x8fd6('0x7b')]]=_[_0x8fd6('0x31')](_0x365e86[_0x8fd6('0x7c')],'id');}else{_0x1434f6[_0x40dc1b[_0x8fd6('0x7b')]]=_0x365e86[_0x8fd6('0x7c')];}_0x310410['push'](_0x1434f6);}else{_0xa94fae[_0x8fd6('0x3f')]['id']=_0x365e86[_0x8fd6('0x7c')];}}else{for(var _0x3b5495=0x0;_0x3b5495<_0x30ae3f[_0x8fd6('0x3a')];_0x3b5495++){var _0x40dc1b=_[_0x8fd6('0x4a')](_0x2c84cb,[_0x8fd6('0x2e'),_0x30ae3f[_0x3b5495][_0x8fd6('0x2e')]]);if(_0x40dc1b[_0x8fd6('0x79')]){var _0x1434f6={};_0x1434f6[_0x40dc1b[_0x8fd6('0x7b')]]=_0x30ae3f[_0x3b5495][_0x8fd6('0x7c')];_0x310410[_0x8fd6('0x5f')](_0x1434f6);}else{if(!_0xa94fae['where']['id'])_0xa94fae[_0x8fd6('0x3f')]['id']=[];_0x30ae3f[_0x3b5495][_0x8fd6('0x7c')][_0x8fd6('0x67')](function(_0x42e118){_0xa94fae['where']['id'][_0x8fd6('0x5f')](_0x42e118);});}}}if(!_['isEmpty'](_0x310410)){_0xa94fae[_0x8fd6('0x3f')]=_['merge'](_0xa94fae[_0x8fd6('0x3f')],{'$and':{'$or':_0x310410}});}_0xa94fae=_[_0x8fd6('0x42')]({},_0xa94fae,_0x9b7e2d[_0x8fd6('0x49')]);if(_0x365e86&&!_0x365e86[_0x8fd6('0x58')]&&_0x2ad060[_0x8fd6('0x72')]===_0x8fd6('0x7a')){if(_0x9b7e2d[_0x8fd6('0x36')][_0x8fd6('0x4f')]){_0xa94fae[_0x8fd6('0x43')]=[{'all':!![]}];}return db[_0x2ad060[_0x8fd6('0x72')]][_0x8fd6('0x44')](_0xa94fae)[_0x8fd6('0x2b')](function(_0x34f94b){var _0x155165=[];_0x34f94b[_0x8fd6('0x67')](function(_0x436efa){var _0x24768f;switch(_0x436efa[_0x8fd6('0x7d')]){case _0x8fd6('0x7e'):_0x24768f=_[_0x8fd6('0x4a')](_0x365e86[_0x8fd6('0x7c')],function(_0x558f2c){return _0x558f2c['id']===_0x436efa[_0x8fd6('0x7f')]&&_0x558f2c['type']===_0x8fd6('0x80');});break;case _0x8fd6('0x81'):_0x24768f=_[_0x8fd6('0x4a')](_0x365e86[_0x8fd6('0x7c')],function(_0x37dacf){return _0x37dacf['id']===_0x436efa[_0x8fd6('0x7f')]&&_0x37dacf['type']==='CustomReports';});break;}if(_0x24768f)_0x155165[_0x8fd6('0x5f')](_0x436efa);});_0x3ce920[_0x8fd6('0x23')]=_0x155165[_0x8fd6('0x3a')];_0x3ce920[_0x8fd6('0x82')]=_0x155165;return _0x3ce920;});}else{return db[_0x2ad060['childModel']][_0x8fd6('0x23')]({'where':_0xa94fae['where']})[_0x8fd6('0x2b')](function(_0x22fd33){_0x3ce920[_0x8fd6('0x23')]=_0x22fd33;if(_0x9b7e2d[_0x8fd6('0x36')][_0x8fd6('0x4f')]){if(_0x2ad060['childModel']==='CmContact'){_0xa94fae[_0x8fd6('0x43')]=[{'model':db[_0x8fd6('0x83')],'as':'Tags','attributes':['id',_0x8fd6('0x2e'),_0x8fd6('0x84')],'required':_0x9b7e2d[_0x8fd6('0x36')][_0x8fd6('0x85')]?!![]:![]},{'model':db[_0x8fd6('0x83')],'as':_0x8fd6('0x86'),'attributes':['id',_0x8fd6('0x2e'),'color'],'through':_0x9b7e2d[_0x8fd6('0x36')][_0x8fd6('0x85')]?{'attributes':[],'where':{'TagId':_0x9b7e2d['query'][_0x8fd6('0x85')]||undefined}}:{},'required':_0x9b7e2d[_0x8fd6('0x36')]['tag']?!![]:![]}];}else{_0xa94fae[_0x8fd6('0x43')]=[{'all':!![]}];}}return db[_0x2ad060['childModel']]['findAll'](_0xa94fae);})[_0x8fd6('0x2b')](function(_0x5188e8){_0x3ce920[_0x8fd6('0x82')]=_0x5188e8;return _0x3ce920;});}}else{return _0x3ce920;}})[_0x8fd6('0x2b')](respondWithFilteredResult(_0x143eb5,_0xa94fae))['catch'](handleError(_0x143eb5,null));};function getAllResources(_0x500a71,_0xc744fa){return new BPromise(function(_0x353265,_0x1fb2cc){if(_0xc744fa){var _0x218cff=_0xc744fa[_0x8fd6('0x41')]?{[_0xc744fa[_0x8fd6('0x41')][_0x8fd6('0x79')]]:_0xc744fa[_0x8fd6('0x41')][_0x8fd6('0x87')]}:undefined;return db[_0x500a71][_0x8fd6('0x44')]({'where':_0x218cff,'raw':!![]})[_0x8fd6('0x2b')](function(_0xd2d5e){_0xc744fa[_0x8fd6('0x7c')]=_['map'](_0xd2d5e,'id');_0x353265(_0xc744fa);})['catch'](function(_0x31d675){_0x1fb2cc(_0x31d675);});}else{_0x353265(null);}});}function getAllFilteredResources(_0x549cbe,_0xcad56c){return new BPromise(function(_0x567060,_0x24d52a){var _0x4be275=_0x549cbe[_0x8fd6('0x41')]?{[_0x549cbe['filter'][_0x8fd6('0x79')]]:_0x549cbe[_0x8fd6('0x41')][_0x8fd6('0x87')]}:undefined;return db[_0x549cbe[_0x8fd6('0x3b')]]['findAll']({'where':_0x4be275,'raw':!![]})[_0x8fd6('0x2b')](function(_0x189310){_0xcad56c[_0x8fd6('0x7c')]=_['map'](_0x189310,function(_0x2824bc){return _0x2824bc['name'];});_0x567060(_0xcad56c);})[_0x8fd6('0x45')](function(_0x297708){_0x24d52a(_0x297708);});});}function getAllowedResources(_0x448cb6,_0x11f4d9,_0x19bd85){return new BPromise(function(_0x34a477,_0x5827be){if(_0x11f4d9){return db[_0x8fd6('0x59')][_0x8fd6('0x44')]({'where':{'sectionId':_0x11f4d9['id']},'raw':!![]})[_0x8fd6('0x2b')](function(_0x1c052e){if(_0x448cb6['field']&&_0x448cb6[_0x8fd6('0x79')]!=='id'){_0x11f4d9[_0x8fd6('0x7c')]=_[_0x8fd6('0x31')](_0x1c052e,function(_0x5d92bd){return _0x5d92bd[_0x448cb6[_0x8fd6('0x79')]];});}else{if(_0x19bd85===_0x8fd6('0x7a')){_0x11f4d9['associatedResources']=_[_0x8fd6('0x31')](_0x1c052e,function(_0x3d3d3a){return{'id':_0x3d3d3a['resourceId'],'type':_0x3d3d3a['type']};});}else{_0x11f4d9['associatedResources']=_['map'](_0x1c052e,function(_0x2c9ba0){return _0x2c9ba0[_0x8fd6('0x68')];});}}_0x34a477(_0x11f4d9);})[_0x8fd6('0x45')](function(_0x5bf37f){_0x5827be(_0x5bf37f);});}else{_0x34a477(null);}});}function getQueryModels(_0x3e69d7,_0x3ec735){var _0x462547=_0x3e69d7[_0x8fd6('0x88')]();var _0x406d99={'childModel':undefined,'parentSections':[]};switch(_0x462547){case'squareprojects':_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x89');break;case'odbc':_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x8a');break;case _0x8fd6('0x8b'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x8c');_0x406d99['parentSections']=[{'name':_0x8fd6('0x8d'),'field':_0x8fd6('0x2e'),'foreignKey':'projectName'}];break;case'projects':_0x406d99[_0x8fd6('0x72')]='JscriptyProject';break;case'contacts':_0x406d99[_0x8fd6('0x72')]='CmContact';_0x406d99[_0x8fd6('0x74')]=[{'name':'Lists','field':'id','foreignKey':_0x8fd6('0x8e')}];break;case _0x8fd6('0x8f'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x90');break;case _0x8fd6('0x91'):_0x406d99[_0x8fd6('0x72')]='CmCompany';break;case _0x8fd6('0x92'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x93');break;case'chatqueues':_0x406d99['childModel']='ChatQueue';break;case _0x8fd6('0x94'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x95');break;case'faxqueues':_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x96');break;case _0x8fd6('0x97'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x98');break;case'inboundroutes':case _0x8fd6('0x99'):case'outboundroutes':_0x406d99['childModel']='VoiceExtension';break;case _0x8fd6('0x9a'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x9b');break;case'voicemails':_0x406d99['childModel']=_0x8fd6('0x9c');break;case _0x8fd6('0x9d'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x9e');_0x406d99['parentSections']=[{'name':_0x8fd6('0x9f'),'field':_0x8fd6('0x2e'),'foreignKey':_0x8fd6('0xa0'),'model':'User','filter':{'field':_0x8fd6('0xa1'),'value':['agent']}},{'name':'Telephones','field':_0x8fd6('0x2e'),'foreignKey':_0x8fd6('0xa0'),'model':_0x8fd6('0xa2'),'filter':{'field':_0x8fd6('0xa1'),'value':[_0x8fd6('0xa3')]}},{'name':_0x8fd6('0xa4'),'field':_0x8fd6('0x2e'),'foreignKey':'queue','model':_0x8fd6('0xa5'),'filter':{'field':_0x8fd6('0x34'),'value':[_0x8fd6('0xa6')]}},{'name':_0x8fd6('0xa7'),'field':_0x8fd6('0x2e'),'foreignKey':_0x8fd6('0xa8'),'model':_0x8fd6('0xa5'),'filter':{'field':_0x8fd6('0x34'),'value':[_0x8fd6('0xa9')]}}];break;case _0x8fd6('0xaa'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xab');break;case _0x8fd6('0xac'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xad');break;case _0x8fd6('0xae'):_0x406d99['childModel']=_0x8fd6('0xaf');break;case _0x8fd6('0xb0'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xb1');break;case _0x8fd6('0xb2'):_0x406d99['childModel']='MailQueue';break;case _0x8fd6('0xb3'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xb4');break;case _0x8fd6('0xb5'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xb6');break;case _0x8fd6('0xb7'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xb8');break;case _0x8fd6('0xb9'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xba');break;case _0x8fd6('0xbb'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xbc');break;case _0x8fd6('0xbd'):_0x406d99[_0x8fd6('0x72')]='SmsAccount';break;case _0x8fd6('0xbe'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xbf');break;case _0x8fd6('0xc0'):_0x406d99['childModel']=_0x8fd6('0xc1');break;case _0x8fd6('0xc2'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xc3');break;case _0x8fd6('0xc4'):case _0x8fd6('0xc5'):_0x406d99[_0x8fd6('0x72')]='VoiceQueue';if(_0x3ec735){_0x406d99['parentSections']=[{'name':_0x8fd6('0xa4')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case _0x8fd6('0xc6'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xa2');if(_0x3ec735){_0x406d99[_0x8fd6('0x74')]=[{'name':_0x8fd6('0xc7'),'filter':{'field':_0x8fd6('0xa1'),'value':[_0x8fd6('0xc8'),_0x8fd6('0xc9')]},'ignore':!![]},{'name':'Agents'},{'name':_0x8fd6('0xca')}];}break;case _0x8fd6('0xcb'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xcc');break;case _0x8fd6('0xcd'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xce');break;case _0x8fd6('0xcf'):_0x406d99['childModel']=_0x8fd6('0xd0');break;case _0x8fd6('0xd1'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xd2');break;case _0x8fd6('0xd3'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xd4');break;case _0x8fd6('0xd5'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xd6');break;case'vtigeraccounts':_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xa2');break;case _0x8fd6('0xd7'):_0x406d99['childModel']=_0x8fd6('0xd8');break;case _0x8fd6('0xd9'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xda');break;case _0x8fd6('0xdb'):_0x406d99['childModel']=_0x8fd6('0x66');break;case _0x8fd6('0xdc'):_0x406d99['childModel']=_0x8fd6('0xdd');break;case _0x8fd6('0xde'):_0x406d99[_0x8fd6('0x72')]='Pause';break;case'scheduler':_0x406d99[_0x8fd6('0x72')]='Schedule';break;case _0x8fd6('0xdf'):_0x406d99['childModel']=_0x8fd6('0xe0');break;case _0x8fd6('0xe1'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0x83');break;case _0x8fd6('0xe2'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xe3');break;case _0x8fd6('0xe4'):_0x406d99[_0x8fd6('0x72')]='Trigger';break;case _0x8fd6('0xe5'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xe6');break;case _0x8fd6('0xe7'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xe8');break;case'plugins':_0x406d99[_0x8fd6('0x72')]='Plugin';break;case _0x8fd6('0xe9'):_0x406d99['childModel']=_0x8fd6('0x7a');_0x406d99[_0x8fd6('0x74')]=[{'name':_0x8fd6('0xea'),'field':'id','foreignKey':_0x8fd6('0x7f')}];break;case _0x8fd6('0xeb'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xec');break;case _0x8fd6('0xc0'):_0x406d99[_0x8fd6('0x72')]=_0x8fd6('0xc1');break;default:return _0x406d99;}return _0x406d99;} \ No newline at end of file +var _0x80f4=['merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','clone','createdAt','updatedAt','crudPermissions','sequelize','create','get','UserProfileSection','autoAssociation','omit','Resources','UserProfileResource','describe','addSections','userProfileId','each','push','removeSections','getSections','enabled','includes','sectionId','isEmpty','subsections','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','ids','getResources','section','undefined','mergeResources','childModel','Sequelize','ValidationError','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','union','hasOwnProperty','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','stack','name','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','pick','where','VIRTUAL','filter'];(function(_0x5febf1,_0x43cc6e){var _0x1797e1=function(_0x4f52ad){while(--_0x4f52ad){_0x5febf1['push'](_0x5febf1['shift']());}};_0x1797e1(++_0x43cc6e);}(_0x80f4,0xb3));var _0x480f=function(_0x485539,_0x5491b7){_0x485539=_0x485539-0x0;var _0x2d3d75=_0x80f4[_0x485539];return _0x2d3d75;};'use strict';var pdf=require(_0x480f('0x0'));var emlformat=require(_0x480f('0x1'));var rimraf=require(_0x480f('0x2'));var zipdir=require(_0x480f('0x3'));var jsonpatch=require(_0x480f('0x4'));var rp=require('request-promise');var moment=require(_0x480f('0x5'));var BPromise=require(_0x480f('0x6'));var Mustache=require('mustache');var util=require(_0x480f('0x7'));var path=require(_0x480f('0x8'));var sox=require('sox');var csv=require(_0x480f('0x9'));var ejs=require(_0x480f('0xa'));var fs=require('fs');var _=require(_0x480f('0xb'));var squel=require(_0x480f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x480f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x480f('0xe'));var Redis=require(_0x480f('0xf'));var authService=require(_0x480f('0x10'));var qs=require(_0x480f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x480f('0x12'));var logger=require(_0x480f('0x13'))(_0x480f('0x14'));var utils=require(_0x480f('0x15'));var config=require(_0x480f('0x16'));var db=require(_0x480f('0x17'))['db'];config[_0x480f('0x18')]=_[_0x480f('0x19')](config[_0x480f('0x18')],{'host':_0x480f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x480f('0x18')]));require(_0x480f('0x1b'))[_0x480f('0x1c')](socket);function respondWithStatusCode(_0x500211,_0x195768){_0x195768=_0x195768||0xcc;return function(_0x403ed0){if(_0x403ed0){return _0x500211[_0x480f('0x1d')](_0x195768);}return _0x500211[_0x480f('0x1e')](_0x195768)[_0x480f('0x1f')]();};}function respondWithResult(_0x51eb84,_0x142387){_0x142387=_0x142387||0xc8;return function(_0x595ffe){if(_0x595ffe){return _0x51eb84['status'](_0x142387)[_0x480f('0x20')](_0x595ffe);}};}function respondWithFilteredResult(_0xb60f79,_0xbdf9fc){return function(_0x1fa13a){if(_0x1fa13a){var _0x1e3404=_0x1fa13a[_0x480f('0x21')],_0x962ed8=_0xbdf9fc[_0x480f('0x22')],_0x37cac4=_0xbdf9fc[_0x480f('0x22')]+_0xbdf9fc['limit'],_0x4db591;if(_0x37cac4>=_0x1e3404){_0x37cac4=_0x1e3404;_0x4db591=0xc8;}else{_0x4db591=0xce;}_0xb60f79['status'](_0x4db591);return _0xb60f79[_0x480f('0x23')]('Content-Range',_0x962ed8+'-'+_0x37cac4+'/'+_0x1e3404)[_0x480f('0x20')](_0x1fa13a);}return null;};}function patchUpdates(_0x1d28cf){return function(_0x13503b){try{jsonpatch[_0x480f('0x24')](_0x13503b,_0x1d28cf,!![]);}catch(_0x4ca1aa){return BPromise['reject'](_0x4ca1aa);}return _0x13503b[_0x480f('0x25')]();};}function saveUpdates(_0x51fff2,_0x468677){return function(_0x445d1d){if(_0x445d1d){return _0x445d1d[_0x480f('0x26')](_0x51fff2)[_0x480f('0x27')](function(_0xf61ac4){return _0xf61ac4;});}return null;};}function removeEntity(_0x3ca417,_0x1377c4){return function(_0x53ae62){if(_0x53ae62){return _0x53ae62[_0x480f('0x28')]()[_0x480f('0x27')](function(){_0x3ca417[_0x480f('0x1e')](0xcc)[_0x480f('0x1f')]();});}};}function handleEntityNotFound(_0x5a0950,_0x524ab){return function(_0x5ec334){if(!_0x5ec334){_0x5a0950[_0x480f('0x1d')](0x194);}return _0x5ec334;};}function handleError(_0x3c26fc,_0x57163b){_0x57163b=_0x57163b||0x1f4;return function(_0x5c3bdb){logger['error'](_0x5c3bdb[_0x480f('0x29')]);if(_0x5c3bdb[_0x480f('0x2a')]){delete _0x5c3bdb[_0x480f('0x2a')];}_0x3c26fc[_0x480f('0x1e')](_0x57163b)['send'](_0x5c3bdb);};}exports['index']=function(_0x1c4b54,_0x1bc521){var _0x34c471={},_0x259198={},_0x4b46a9={'count':0x0,'rows':[]};var _0x2989fb=_[_0x480f('0x2b')](db[_0x480f('0x2c')][_0x480f('0x2d')],function(_0x1c1d42){return{'name':_0x1c1d42[_0x480f('0x2e')],'type':_0x1c1d42[_0x480f('0x2f')][_0x480f('0x30')]};});_0x259198[_0x480f('0x31')]=_[_0x480f('0x2b')](_0x2989fb,_0x480f('0x2a'));_0x259198[_0x480f('0x32')]=_[_0x480f('0x33')](_0x1c4b54['query']);_0x259198['filters']=_[_0x480f('0x34')](_0x259198[_0x480f('0x31')],_0x259198[_0x480f('0x32')]);_0x34c471[_0x480f('0x35')]=_[_0x480f('0x34')](_0x259198[_0x480f('0x31')],qs[_0x480f('0x36')](_0x1c4b54[_0x480f('0x32')][_0x480f('0x36')]));_0x34c471['attributes']=_0x34c471[_0x480f('0x35')][_0x480f('0x37')]?_0x34c471[_0x480f('0x35')]:_0x259198['model'];if(!_0x1c4b54['query']['hasOwnProperty'](_0x480f('0x38'))){_0x34c471['limit']=qs[_0x480f('0x39')](_0x1c4b54[_0x480f('0x32')][_0x480f('0x39')]);_0x34c471[_0x480f('0x22')]=qs['offset'](_0x1c4b54[_0x480f('0x32')][_0x480f('0x22')]);}_0x34c471[_0x480f('0x3a')]=qs['sort'](_0x1c4b54[_0x480f('0x32')][_0x480f('0x3b')]);_0x34c471['where']=qs[_0x480f('0x3c')](_[_0x480f('0x3d')](_0x1c4b54[_0x480f('0x32')],_0x259198['filters']),_0x2989fb);if(_0x1c4b54['query']['filter']){_0x34c471['where']=_['merge'](_0x34c471[_0x480f('0x3e')],{'$or':_[_0x480f('0x2b')](_0x2989fb,function(_0x3e6cbb){if(_0x3e6cbb[_0x480f('0x2f')]!==_0x480f('0x3f')){var _0x593c20={};_0x593c20[_0x3e6cbb['name']]={'$like':'%'+_0x1c4b54['query'][_0x480f('0x40')]+'%'};return _0x593c20;}})});}_0x34c471=_[_0x480f('0x41')]({},_0x34c471,_0x1c4b54[_0x480f('0x42')]);var _0x1d7784={'where':_0x34c471[_0x480f('0x3e')]};return db[_0x480f('0x2c')][_0x480f('0x21')](_0x1d7784)['then'](function(_0x504fc8){_0x4b46a9[_0x480f('0x21')]=_0x504fc8;if(_0x1c4b54[_0x480f('0x32')][_0x480f('0x43')]){_0x34c471[_0x480f('0x44')]=[{'all':!![]}];}return db[_0x480f('0x2c')][_0x480f('0x45')](_0x34c471);})[_0x480f('0x27')](function(_0x4840fd){_0x4b46a9[_0x480f('0x46')]=_0x4840fd;return _0x4b46a9;})[_0x480f('0x27')](respondWithFilteredResult(_0x1bc521,_0x34c471))[_0x480f('0x47')](handleError(_0x1bc521,null));};exports[_0x480f('0x48')]=function(_0x1fd4d5,_0x213e06){var _0x55d976={'raw':![],'where':{'id':_0x1fd4d5[_0x480f('0x49')]['id']}},_0x180168={};_0x180168[_0x480f('0x31')]=_[_0x480f('0x33')](db[_0x480f('0x2c')][_0x480f('0x2d')]);_0x180168[_0x480f('0x32')]=_[_0x480f('0x33')](_0x1fd4d5[_0x480f('0x32')]);_0x180168[_0x480f('0x3c')]=_[_0x480f('0x34')](_0x180168['model'],_0x180168[_0x480f('0x32')]);_0x55d976[_0x480f('0x35')]=_[_0x480f('0x34')](_0x180168[_0x480f('0x31')],qs[_0x480f('0x36')](_0x1fd4d5[_0x480f('0x32')][_0x480f('0x36')]));_0x55d976[_0x480f('0x35')]=_0x55d976[_0x480f('0x35')]['length']?_0x55d976[_0x480f('0x35')]:_0x180168[_0x480f('0x31')];if(_0x1fd4d5['query'][_0x480f('0x43')]){_0x55d976[_0x480f('0x44')]=[{'all':!![]}];}_0x55d976=_[_0x480f('0x41')]({},_0x55d976,_0x1fd4d5[_0x480f('0x42')]);return db['UserProfile'][_0x480f('0x4a')](_0x55d976)[_0x480f('0x27')](handleEntityNotFound(_0x213e06,null))[_0x480f('0x27')](respondWithResult(_0x213e06,null))[_0x480f('0x47')](handleError(_0x213e06,null));};exports['create']=function(_0xae6b97,_0x274377){return db['UserProfile']['create'](_0xae6b97[_0x480f('0x4b')],{})['then'](respondWithResult(_0x274377,0xc9))['catch'](handleError(_0x274377,null));};exports[_0x480f('0x4c')]=function(_0x57ceac,_0x141e2b){var _0xe0a324={'where':{'id':_0x57ceac[_0x480f('0x49')]['id']}},_0x23bcbe={};_0x23bcbe[_0x480f('0x31')]=_['keys'](db[_0x480f('0x2c')][_0x480f('0x2d')]);_0xe0a324[_0x480f('0x35')]=_[_0x480f('0x34')](_0x23bcbe[_0x480f('0x31')],qs['fields'](_0x57ceac[_0x480f('0x32')][_0x480f('0x36')]));_0xe0a324[_0x480f('0x35')]=_0xe0a324[_0x480f('0x35')][_0x480f('0x37')]?_0xe0a324[_0x480f('0x35')]:_0x23bcbe[_0x480f('0x31')];if(_0x57ceac[_0x480f('0x32')][_0x480f('0x43')]){_0xe0a324[_0x480f('0x44')]=[{'all':!![]}];}_0xe0a324=_[_0x480f('0x41')]({},_0xe0a324,_0x57ceac['options']);return db[_0x480f('0x2c')][_0x480f('0x4a')](_0xe0a324)['then'](handleEntityNotFound(_0x141e2b,null))[_0x480f('0x27')](function(_0x5146c0){if(_0x5146c0){var _0x49fb65=_0x5146c0['get']({'plain':!![]});_0x49fb65=qs['omit'](_0x49fb65,['id',_0x480f('0x4d'),_0x480f('0x4e'),_0x480f('0x4f')]);_0x57ceac[_0x480f('0x4b')]=_['omit'](_0x57ceac['body'],['id','createdAt',_0x480f('0x4e')]);return db[_0x480f('0x50')]['transaction'](function(_0x2caf15){return db[_0x480f('0x2c')][_0x480f('0x51')](_[_0x480f('0x41')](_0x49fb65,_0x57ceac[_0x480f('0x4b')]),{'include':_0x57ceac[_0x480f('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2caf15})[_0x480f('0x27')](function(_0x4a51de){var _0x3f91b3=_0x4a51de[_0x480f('0x52')]({'plain':!![]});return db[_0x480f('0x53')][_0x480f('0x45')]({'where':{'userProfileId':_0x57ceac[_0x480f('0x49')]['id']},'raw':!![]})[_0x480f('0x27')](function(_0x1e94a9){if(_0x1e94a9){return BPromise['each'](_0x1e94a9,function(_0x40c3ee){return new BPromise(function(_0x54e242,_0x447c1c){if(_0x40c3ee['autoAssociation']===null||_0x40c3ee[_0x480f('0x54')]===0x1)_0x54e242(null);return db['UserProfileResource'][_0x480f('0x45')]({'where':{'sectionId':_0x40c3ee['id']},'raw':!![]})[_0x480f('0x27')](function(_0x574e30){var _0x1d23ba=_[_0x480f('0x2b')](_0x574e30,function(_0x3789d2){return qs[_0x480f('0x55')](_0x3789d2,['id',_0x480f('0x4d'),'updatedAt','sectionId']);});_0x54e242(_0x1d23ba);})[_0x480f('0x47')](function(_0x15f774){_0x447c1c(_0x15f774);});})[_0x480f('0x27')](function(_0x1a290c){var _0x3f3eb4=qs['omit'](_0x40c3ee,['id','createdAt',_0x480f('0x4e')]);_0x3f3eb4['userProfileId']=_0x3f91b3['id'];if(_0x1a290c)_0x3f3eb4[_0x480f('0x56')]=_0x1a290c;return _0x3f3eb4;})[_0x480f('0x27')](function(_0x3dab11){return db['UserProfileSection']['create'](_0x3dab11,{'include':[{'model':db[_0x480f('0x57')],'as':_0x480f('0x56')}],'raw':!![],'transaction':_0x2caf15});});})[_0x480f('0x27')](function(){return _0x3f91b3;});}});});});}})[_0x480f('0x27')](respondWithResult(_0x141e2b,0xc9))[_0x480f('0x47')](handleError(_0x141e2b,null));};exports[_0x480f('0x26')]=function(_0x47403e,_0x51614c){if(_0x47403e[_0x480f('0x4b')]['id']){delete _0x47403e[_0x480f('0x4b')]['id'];}return db[_0x480f('0x2c')][_0x480f('0x4a')]({'where':{'id':_0x47403e[_0x480f('0x49')]['id']}})[_0x480f('0x27')](handleEntityNotFound(_0x51614c,null))[_0x480f('0x27')](saveUpdates(_0x47403e[_0x480f('0x4b')],null))[_0x480f('0x27')](respondWithResult(_0x51614c,null))[_0x480f('0x47')](handleError(_0x51614c,null));};exports['destroy']=function(_0x5ebd1b,_0x444009){return db['UserProfile'][_0x480f('0x4a')]({'where':{'id':_0x5ebd1b[_0x480f('0x49')]['id']}})[_0x480f('0x27')](handleEntityNotFound(_0x444009,null))[_0x480f('0x27')](removeEntity(_0x444009,null))[_0x480f('0x47')](handleError(_0x444009,null));};exports['describe']=function(_0x4039a0,_0x4aca7a){return db[_0x480f('0x2c')][_0x480f('0x58')]()[_0x480f('0x27')](respondWithResult(_0x4aca7a,null))['catch'](handleError(_0x4aca7a,null));};exports[_0x480f('0x59')]=function(_0xf6efca,_0x5ae23f){var _0x6b592=_0xf6efca[_0x480f('0x4b')];return db[_0x480f('0x2c')][_0x480f('0x4a')]({'where':{'id':_0xf6efca[_0x480f('0x49')]['id']}})[_0x480f('0x27')](handleEntityNotFound(_0x5ae23f,null))[_0x480f('0x27')](function(_0x46d384){if(_0x46d384){return db[_0x480f('0x50')]['transaction'](function(_0x32cc13){return db[_0x480f('0x53')][_0x480f('0x28')]({'where':{'userProfileId':_0xf6efca[_0x480f('0x49')]['id'],'sectionId':_['map'](_0x6b592,function(_0x4cb2f1){return _0x4cb2f1['sectionId'];})},'transaction':_0x32cc13})[_0x480f('0x27')](function(){var _0x1ea37a=_[_0x480f('0x2b')](_0x6b592,function(_0x4afb37){_0x4afb37[_0x480f('0x5a')]=_0xf6efca['params']['id'];return _0x4afb37;});var _0x386df5=[];return BPromise[_0x480f('0x5b')](_0x1ea37a,function(_0x3f40cc){return db['UserProfileSection'][_0x480f('0x51')](_0x3f40cc,{'include':[{'model':db[_0x480f('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x32cc13})[_0x480f('0x27')](function(_0x2c60e0){_0x386df5[_0x480f('0x5c')](_0x2c60e0['get']({'plain':!![]}));});})['then'](function(){return _0x386df5;});});});}})['then'](function(_0x29644c){return _0x29644c;})['then'](respondWithResult(_0x5ae23f,null))['catch'](handleError(_0x5ae23f,null));};exports[_0x480f('0x5d')]=function(_0x134e04,_0x2fe8f8){var _0x36dfaa;return db[_0x480f('0x2c')][_0x480f('0x4a')]({'where':{'id':_0x134e04[_0x480f('0x49')]['id']},'attributes':['id','name']})[_0x480f('0x27')](handleEntityNotFound(_0x2fe8f8,null))[_0x480f('0x27')](function(_0x5a9bec){if(_0x5a9bec){_0x36dfaa=_0x5a9bec;return db['UserProfileSection'][_0x480f('0x28')]({'where':{'userProfileId':_0x134e04[_0x480f('0x49')]['id'],'sectionId':_0x134e04[_0x480f('0x32')]['ids']}});}})[_0x480f('0x27')](function(){return _0x36dfaa;})[_0x480f('0x27')](respondWithStatusCode(_0x2fe8f8,null))[_0x480f('0x47')](handleError(_0x2fe8f8,null));};exports[_0x480f('0x5e')]=function(_0xd1f730,_0x21790c){var _0x505ef3=[];var _0x39e0ee=[];return db['UserProfileSection'][_0x480f('0x45')]({'where':{'userProfileId':_0xd1f730[_0x480f('0x49')]['id']},'raw':!![]})[_0x480f('0x27')](function(_0x506b44){_0x505ef3=_[_0x480f('0x40')](_0x506b44,function(_0x543db9){return _0x543db9[_0x480f('0x5f')]===0x1||_[_0x480f('0x60')]([0x3eb,0x709],_0x543db9[_0x480f('0x61')]);});if(!_[_0x480f('0x62')](_0x505ef3)){return _[_0x480f('0x2b')](_0x505ef3,function(_0x555fbc){return _0x555fbc[_0x480f('0x61')];});}else{return;}})['then'](function(_0x3d8187){if(_0x3d8187)_0x39e0ee=_0x3d8187;if(_[_0x480f('0x60')](_0x39e0ee,0x64)){var _0x4443a2=_[_0x480f('0x4a')](_0x505ef3,{'sectionId':0x64});return hasDefaultDashboard(_0x4443a2)['then'](function(_0x370877){return _[_0x480f('0x2b')](_0x505ef3,function(_0x45131f){if(_0x45131f[_0x480f('0x61')]===0x64){_0x45131f[_0x480f('0x63')]=_0x370877;}return _0x45131f;});});}else{return;}})[_0x480f('0x27')](function(_0x263152){if(_0x263152)_0x505ef3=_0x263152;if(_[_0x480f('0x60')](_0x39e0ee,0x3eb)){var _0x231ccb=_['find'](_0x505ef3,{'sectionId':0x3eb});return getCustomDashboards(_0x231ccb)['then'](function(_0x8759dd){return _[_0x480f('0x2b')](_0x505ef3,function(_0x309997){if(_0x231ccb['enabled']){if(_0x309997[_0x480f('0x61')]===0x3eb){_0x309997['subsections']=_0x8759dd;}}else{if(_0x309997[_0x480f('0x61')]===0x64){_0x309997[_0x480f('0x63')]=_0x8759dd;}}return _0x309997;});});}else{return;}})[_0x480f('0x27')](function(_0x5a6ff1){if(_0x5a6ff1)_0x505ef3=_0x5a6ff1;if(_[_0x480f('0x60')](_0x39e0ee,0x709)){var _0x56460a=_[_0x480f('0x4a')](_0x505ef3,{'sectionId':0x709});return getPlugins(_0x56460a)['then'](function(_0x2a92cc){if(_0x56460a['enabled']){return _[_0x480f('0x2b')](_0x505ef3,function(_0x202afd){if(_0x202afd[_0x480f('0x61')]===0x709){_0x202afd[_0x480f('0x63')]=_0x2a92cc;}return _0x202afd;});}else{var _0x561fed={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2a92cc};var _0x16d1ca=_[_0x480f('0x2b')](_0x505ef3);_0x16d1ca[_0x480f('0x5c')](_0x561fed);return _0x16d1ca;}});}else{return;}})[_0x480f('0x27')](function(_0x35c46a){if(_0x35c46a)_0x505ef3=_0x35c46a;return _[_0x480f('0x40')](_0x505ef3,[_0x480f('0x5f'),0x1]);})[_0x480f('0x27')](respondWithResult(_0x21790c,null))[_0x480f('0x47')](handleError(_0x21790c,null));};function hasDefaultDashboard(_0x107c04){var _0x34bbde=[0x65];return new BPromise(function(_0x21ed9f,_0x1ed579){try{if(_0x107c04['autoAssociation']){_0x21ed9f(_0x34bbde);}else{return db[_0x480f('0x57')]['findOne']({'where':{'sectionId':_0x107c04['id']},'raw':!![]})[_0x480f('0x27')](function(_0x3c7648){_0x3c7648?_0x21ed9f(_0x34bbde):_0x21ed9f();});}}catch(_0x81496a){_0x1ed579(_0x81496a);}});}function getCustomDashboards(_0x1ced05){var _0x58e064=[];return new BPromise(function(_0x157380,_0x11c9a0){try{if(_0x1ced05['autoAssociation']){return db['Dashboard'][_0x480f('0x45')]({'raw':!![]})['then'](function(_0xd72075){_0xd72075[_0x480f('0x64')](function(_0x38a24c){_0x58e064[_0x480f('0x5c')](_0x38a24c['id']+0x1869f);});_0x157380(_0x58e064);});}else{return db[_0x480f('0x57')][_0x480f('0x45')]({'where':{'sectionId':_0x1ced05['id']},'raw':!![]})['then'](function(_0x36a9a4){_0x36a9a4['forEach'](function(_0x5bed01){_0x58e064[_0x480f('0x5c')](_0x5bed01[_0x480f('0x65')]+0x1869f);});_0x157380(_0x58e064);});}}catch(_0x2c3355){_0x11c9a0(_0x2c3355);}});}function getPlugins(_0x467e9d){var _0x8540f0=[];return new BPromise(function(_0xb119cd,_0x40a0dc){try{if(_0x467e9d[_0x480f('0x54')]){return db[_0x480f('0x66')][_0x480f('0x45')]({'raw':!![]})['then'](function(_0x5ec290){_0x5ec290[_0x480f('0x64')](function(_0x25ab2c){_0x8540f0['push'](_0x25ab2c['id']+0x15b38);});_0xb119cd(_0x8540f0);});}else{return db[_0x480f('0x57')][_0x480f('0x45')]({'where':{'sectionId':_0x467e9d['id']},'raw':!![]})[_0x480f('0x27')](function(_0x2cfeba){_0x2cfeba[_0x480f('0x64')](function(_0xc907f7){_0x8540f0[_0x480f('0x5c')](_0xc907f7[_0x480f('0x65')]+0x15b38);});_0xb119cd(_0x8540f0);});}}catch(_0x588aa8){_0x40a0dc(_0x588aa8);}});}exports[_0x480f('0x67')]=function(_0x481ade,_0xa9a81c){return db[_0x480f('0x2c')][_0x480f('0x4a')]({'where':{'id':_0x481ade[_0x480f('0x49')]['id']}})[_0x480f('0x27')](handleEntityNotFound(_0xa9a81c,null))['then'](function(_0x17107a){if(_0x17107a){return db[_0x480f('0x50')][_0x480f('0x68')](function(_0x5388de){return db[_0x480f('0x53')][_0x480f('0x45')]({'where':{'userProfileId':_0x481ade[_0x480f('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x480f('0x27')](function(_0x33e251){if(_0x33e251){return db['UserProfileSection'][_0x480f('0x28')]({'where':{'userProfileId':_0x481ade[_0x480f('0x49')]['id'],'id':_['map'](_0x33e251,function(_0x4724ee){return _0x4724ee['id'];})},'transaction':_0x5388de});}})[_0x480f('0x27')](function(_0x36f58b){var _0x41be3e=_[_0x480f('0x2b')](_0x481ade[_0x480f('0x4b')],function(_0x2e8215){_0x2e8215['userProfileId']=_0x481ade[_0x480f('0x49')]['id'];return _0x2e8215;});return db[_0x480f('0x53')][_0x480f('0x69')](_0x41be3e,{'raw':!![],'transaction':_0x5388de});})[_0x480f('0x27')](function(_0x424f9f){var _0x33193f=_[_0x480f('0x40')](_[_0x480f('0x2b')](_0x424f9f,function(_0x488c60){return _0x488c60[_0x480f('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x33193f){return db[_0x480f('0x53')][_0x480f('0x45')]({'where':{'userProfileId':_0x481ade[_0x480f('0x49')]['id'],'sectionId':_['map'](_0x33193f,function(_0x440716){return _0x440716['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x480f('0x27')](function(_0x18ee62){var _0x5bdc01=_[_0x480f('0x2b')](_0x481ade[_0x480f('0x4b')],function(_0x2df6da){_0x2df6da['userProfileId']=_0x481ade[_0x480f('0x49')]['id'];return _0x2df6da;});return db[_0x480f('0x57')]['bulkCreate'](_0x5bdc01,{'raw':!![],'transaction':_0x5388de});});}})['catch'](handleError(_0xa9a81c,null));});}})['then'](function(_0x290f11){var _0x3a8437=_[_0x480f('0x2b')](_0x290f11,function(_0x4360b7){return _0x4360b7[_0x480f('0x52')]({'plain':!![]});});})[_0x480f('0x27')](respondWithResult(_0xa9a81c,null))[_0x480f('0x47')](handleError(_0xa9a81c,null));};exports[_0x480f('0x6a')]=function(_0x5a5cbc,_0x13c71d,_0x145a4d){return db[_0x480f('0x2c')]['find']({'where':{'id':_0x5a5cbc['params']['id']}})[_0x480f('0x27')](handleEntityNotFound(_0x13c71d,null))[_0x480f('0x27')](function(_0x380c96){if(_0x380c96){return _0x380c96[_0x480f('0x6a')](_0x5a5cbc[_0x480f('0x32')][_0x480f('0x6b')]);}})[_0x480f('0x27')](respondWithStatusCode(_0x13c71d,null))[_0x480f('0x47')](handleError(_0x13c71d,null));};exports[_0x480f('0x6c')]=function(_0x394346,_0x3d29ed){var _0x35d117={'raw':![],'where':{}};var _0x4892f3={};var _0x311012={'count':0x0,'rows':[]};var _0x3fee9c=_0x394346[_0x480f('0x32')][_0x480f('0x6d')];if(typeof _0x3fee9c===_0x480f('0x6e')){throw new db['Sequelize']['ValidationError']('Unknown\x20section');}var _0x3ea5c9=_0x394346['query'][_0x480f('0x6f')]||![];var _0x1c601e=getQueryModels(_0x3fee9c,_0x3ea5c9);if(typeof _0x1c601e[_0x480f('0x70')]===_0x480f('0x6e')){throw new db[(_0x480f('0x71'))][(_0x480f('0x72'))](_0x480f('0x73')+_0x3fee9c+'\x27');}var _0x13b09a=[];if(!_[_0x480f('0x62')](_0x1c601e['parentSections'])){_0x13b09a=_0x1c601e[_0x480f('0x74')];}else{_0x13b09a=[{'name':_0x3fee9c}];}return db[_0x480f('0x2c')][_0x480f('0x75')]({'where':{'id':_0x394346['params']['id']}})[_0x480f('0x27')](handleEntityNotFound(_0x3d29ed,null))[_0x480f('0x27')](function(_0x45a1ca){if(_0x45a1ca){var _0x577c3b=[];for(var _0x566c5d=0x0;_0x566c5d<_0x13b09a[_0x480f('0x37')];_0x566c5d++){_0x577c3b[_0x480f('0x5c')](db[_0x480f('0x53')]['findOne']({'where':{'userProfileId':_0x45a1ca['id'],'name':_0x13b09a[_0x566c5d][_0x480f('0x2a')]},'raw':!![]}));}return BPromise[_0x480f('0x76')](_0x577c3b);}})[_0x480f('0x27')](function(_0x5e2c58){var _0x4593bc=_[_0x480f('0x40')](_0x5e2c58,function(_0x2ab31c){return _0x2ab31c?_0x2ab31c:undefined;});var _0x22df09=_[_0x480f('0x40')](_0x13b09a,[_0x480f('0x77'),!![]]);var _0x251a35=_['isEmpty'](_0x4593bc)&&_[_0x480f('0x62')](_0x22df09)?null:_[_0x480f('0x78')](_0x22df09,_0x4593bc);if(_0x251a35){var _0x48ad8f=[];for(var _0x31169e=0x0;_0x31169e<_0x251a35[_0x480f('0x37')];_0x31169e++){var _0x377be9=_['find'](_0x13b09a,function(_0x28e489){return _0x251a35[_0x31169e]?_0x28e489['name']===_0x251a35[_0x31169e][_0x480f('0x2a')]:null;});if(_0x377be9){if(_0x251a35[_0x31169e]['ignore']){_0x48ad8f[_0x480f('0x5c')](getAllResources(_0x1c601e[_0x480f('0x70')],_0x251a35[_0x31169e]));}else{if(!_0x251a35[_0x31169e]['autoAssociation']){_0x48ad8f[_0x480f('0x5c')](getAllowedResources(_0x377be9,_0x251a35[_0x31169e],_0x1c601e['childModel']));}else{if(_0x377be9['model']){_0x48ad8f[_0x480f('0x5c')](getAllFilteredResources(_0x377be9,_0x251a35[_0x31169e]));}}}}}return BPromise[_0x480f('0x76')](_0x48ad8f);}else{return null;}})[_0x480f('0x27')](function(_0x47ec0a){var _0x5ade1a=_0x47ec0a;var _0x527a2a=null;if(_0x5ade1a){_0x527a2a=_0x5ade1a[_0x480f('0x37')]===0x1?_0x5ade1a[0x0]:null;}if(_0x527a2a||_0x5ade1a){var _0x59ce47=db[_0x1c601e['childModel']][_0x480f('0x2d')];_0x4892f3[_0x480f('0x31')]=_['keys'](_0x59ce47);_0x4892f3['query']=_[_0x480f('0x33')](_0x394346[_0x480f('0x32')]);_0x4892f3[_0x480f('0x3c')]=_[_0x480f('0x34')](_0x4892f3[_0x480f('0x31')],_0x4892f3[_0x480f('0x32')]);_0x35d117[_0x480f('0x35')]=_[_0x480f('0x34')](_0x4892f3[_0x480f('0x31')],qs[_0x480f('0x36')](_0x394346[_0x480f('0x32')][_0x480f('0x36')]));_0x35d117[_0x480f('0x35')]=_0x35d117[_0x480f('0x35')][_0x480f('0x37')]?_0x35d117['attributes']:_0x4892f3[_0x480f('0x31')];if(!_0x394346[_0x480f('0x32')][_0x480f('0x79')](_0x480f('0x38'))){_0x35d117['limit']=qs[_0x480f('0x39')](_0x394346[_0x480f('0x32')][_0x480f('0x39')]);_0x35d117[_0x480f('0x22')]=qs['offset'](_0x394346[_0x480f('0x32')]['offset']);}_0x35d117[_0x480f('0x3a')]=qs[_0x480f('0x3b')](_0x394346[_0x480f('0x32')][_0x480f('0x3b')]);_0x35d117[_0x480f('0x3e')]=qs[_0x480f('0x3c')](_[_0x480f('0x3d')](_0x394346[_0x480f('0x32')],_0x4892f3['filters']));if(_0x394346[_0x480f('0x32')]['filter']){_0x35d117[_0x480f('0x3e')]=_['merge'](_0x35d117[_0x480f('0x3e')],{'$or':_[_0x480f('0x2b')](_0x59ce47,function(_0x37f736){if(_0x37f736[_0x480f('0x2f')][_0x480f('0x30')]!==_0x480f('0x3f')){var _0x292abb={};_0x292abb[_0x37f736['field']]={'$like':'%'+_0x394346[_0x480f('0x32')][_0x480f('0x40')]+'%'};return _0x292abb;}})});}var _0x1dc6ee=[];if(_0x527a2a){var _0x332ea1=_[_0x480f('0x4a')](_0x13b09a,['name',_0x527a2a['name']]);if(_0x332ea1[_0x480f('0x7a')]){var _0x17752a={};if(_0x1c601e[_0x480f('0x70')]===_0x480f('0x7b')){_0x17752a[_0x332ea1[_0x480f('0x7c')]]=_['map'](_0x527a2a[_0x480f('0x7d')],'id');}else{_0x17752a[_0x332ea1['foreignKey']]=_0x527a2a[_0x480f('0x7d')];}_0x1dc6ee[_0x480f('0x5c')](_0x17752a);}else{_0x35d117['where']['id']=_0x527a2a[_0x480f('0x7d')];}}else{for(var _0xbc71aa=0x0;_0xbc71aa<_0x5ade1a[_0x480f('0x37')];_0xbc71aa++){var _0x332ea1=_[_0x480f('0x4a')](_0x13b09a,['name',_0x5ade1a[_0xbc71aa]['name']]);if(_0x332ea1[_0x480f('0x7a')]){var _0x17752a={};_0x17752a[_0x332ea1[_0x480f('0x7c')]]=_0x5ade1a[_0xbc71aa][_0x480f('0x7d')];_0x1dc6ee[_0x480f('0x5c')](_0x17752a);}else{if(!_0x35d117[_0x480f('0x3e')]['id'])_0x35d117[_0x480f('0x3e')]['id']=[];_0x5ade1a[_0xbc71aa][_0x480f('0x7d')][_0x480f('0x64')](function(_0x39ad61){_0x35d117[_0x480f('0x3e')]['id']['push'](_0x39ad61);});}}}if(!_[_0x480f('0x62')](_0x1dc6ee)){_0x35d117[_0x480f('0x3e')]=_[_0x480f('0x41')](_0x35d117[_0x480f('0x3e')],{'$and':{'$or':_0x1dc6ee}});}_0x35d117=_[_0x480f('0x41')]({},_0x35d117,_0x394346[_0x480f('0x42')]);if(_0x527a2a&&!_0x527a2a[_0x480f('0x54')]&&_0x1c601e[_0x480f('0x70')]===_0x480f('0x7b')){if(_0x394346[_0x480f('0x32')][_0x480f('0x43')]){_0x35d117['include']=[{'all':!![]}];}return db[_0x1c601e['childModel']][_0x480f('0x45')](_0x35d117)[_0x480f('0x27')](function(_0x42b79a){var _0x4cfb6e=[];_0x42b79a[_0x480f('0x64')](function(_0x405cc0){var _0xa08d55;switch(_0x405cc0[_0x480f('0x7e')]){case _0x480f('0x7f'):_0xa08d55=_[_0x480f('0x4a')](_0x527a2a['associatedResources'],function(_0xacec4){return _0xacec4['id']===_0x405cc0[_0x480f('0x80')]&&_0xacec4[_0x480f('0x2f')]==='DefaultReports';});break;case _0x480f('0x81'):_0xa08d55=_[_0x480f('0x4a')](_0x527a2a[_0x480f('0x7d')],function(_0x1cd442){return _0x1cd442['id']===_0x405cc0['reportId']&&_0x1cd442['type']===_0x480f('0x82');});break;}if(_0xa08d55)_0x4cfb6e[_0x480f('0x5c')](_0x405cc0);});_0x311012[_0x480f('0x21')]=_0x4cfb6e['length'];_0x311012[_0x480f('0x46')]=_0x4cfb6e;return _0x311012;});}else{return db[_0x1c601e[_0x480f('0x70')]][_0x480f('0x21')]({'where':_0x35d117[_0x480f('0x3e')]})[_0x480f('0x27')](function(_0x74bae4){_0x311012['count']=_0x74bae4;if(_0x394346[_0x480f('0x32')][_0x480f('0x43')]){if(_0x1c601e['childModel']===_0x480f('0x83')){_0x35d117[_0x480f('0x44')]=[{'model':db[_0x480f('0x84')],'as':_0x480f('0x85'),'attributes':['id',_0x480f('0x2a'),_0x480f('0x86')],'required':_0x394346[_0x480f('0x32')][_0x480f('0x87')]?!![]:![]},{'model':db[_0x480f('0x84')],'as':_0x480f('0x88'),'attributes':['id',_0x480f('0x2a'),_0x480f('0x86')],'through':_0x394346['query'][_0x480f('0x87')]?{'attributes':[],'where':{'TagId':_0x394346[_0x480f('0x32')]['tag']||undefined}}:{},'required':_0x394346[_0x480f('0x32')][_0x480f('0x87')]?!![]:![]}];}else{_0x35d117[_0x480f('0x44')]=[{'all':!![]}];}}return db[_0x1c601e[_0x480f('0x70')]][_0x480f('0x45')](_0x35d117);})[_0x480f('0x27')](function(_0x57d886){_0x311012[_0x480f('0x46')]=_0x57d886;return _0x311012;});}}else{return _0x311012;}})[_0x480f('0x27')](respondWithFilteredResult(_0x3d29ed,_0x35d117))[_0x480f('0x47')](handleError(_0x3d29ed,null));};function getAllResources(_0x327d42,_0x3c77e6){return new BPromise(function(_0x2b60a6,_0x115a20){if(_0x3c77e6){var _0x384f06=_0x3c77e6[_0x480f('0x40')]?{[_0x3c77e6['filter']['field']]:_0x3c77e6[_0x480f('0x40')][_0x480f('0x89')]}:undefined;return db[_0x327d42][_0x480f('0x45')]({'where':_0x384f06,'raw':!![]})['then'](function(_0x42807d){_0x3c77e6[_0x480f('0x7d')]=_[_0x480f('0x2b')](_0x42807d,'id');_0x2b60a6(_0x3c77e6);})['catch'](function(_0x2c81d5){_0x115a20(_0x2c81d5);});}else{_0x2b60a6(null);}});}function getAllFilteredResources(_0x4fb709,_0xf07581){return new BPromise(function(_0x10c866,_0x2c43eb){var _0xa4e3d5=_0x4fb709[_0x480f('0x40')]?{[_0x4fb709[_0x480f('0x40')][_0x480f('0x7a')]]:_0x4fb709[_0x480f('0x40')][_0x480f('0x89')]}:undefined;return db[_0x4fb709[_0x480f('0x31')]][_0x480f('0x45')]({'where':_0xa4e3d5,'raw':!![]})[_0x480f('0x27')](function(_0x21ccd3){_0xf07581['associatedResources']=_[_0x480f('0x2b')](_0x21ccd3,function(_0x53f71f){return _0x53f71f['name'];});_0x10c866(_0xf07581);})[_0x480f('0x47')](function(_0x12580){_0x2c43eb(_0x12580);});});}function getAllowedResources(_0x97fa95,_0x582eed,_0x4b4200){return new BPromise(function(_0x1c7558,_0x5a4425){if(_0x582eed){return db[_0x480f('0x57')][_0x480f('0x45')]({'where':{'sectionId':_0x582eed['id']},'raw':!![]})[_0x480f('0x27')](function(_0x72e11b){if(_0x97fa95[_0x480f('0x7a')]&&_0x97fa95['field']!=='id'){_0x582eed['associatedResources']=_['map'](_0x72e11b,function(_0x5cb433){return _0x5cb433[_0x97fa95[_0x480f('0x7a')]];});}else{if(_0x4b4200==='AnalyticExtractedReport'){_0x582eed[_0x480f('0x7d')]=_['map'](_0x72e11b,function(_0x4ab655){return{'id':_0x4ab655[_0x480f('0x65')],'type':_0x4ab655[_0x480f('0x2f')]};});}else{_0x582eed[_0x480f('0x7d')]=_[_0x480f('0x2b')](_0x72e11b,function(_0x3a6b32){return _0x3a6b32['resourceId'];});}}_0x1c7558(_0x582eed);})[_0x480f('0x47')](function(_0x32e4db){_0x5a4425(_0x32e4db);});}else{_0x1c7558(null);}});}function getQueryModels(_0x349b5f,_0x26458e){var _0x328ab7=_0x349b5f[_0x480f('0x8a')]();var _0x153cce={'childModel':undefined,'parentSections':[]};switch(_0x328ab7){case _0x480f('0x8b'):_0x153cce['childModel']=_0x480f('0x8c');break;case _0x480f('0x8d'):_0x153cce[_0x480f('0x70')]=_0x480f('0x8e');break;case _0x480f('0x8f'):_0x153cce[_0x480f('0x70')]=_0x480f('0x90');_0x153cce[_0x480f('0x74')]=[{'name':_0x480f('0x91'),'field':_0x480f('0x2a'),'foreignKey':_0x480f('0x92')}];break;case _0x480f('0x93'):_0x153cce[_0x480f('0x70')]=_0x480f('0x94');break;case _0x480f('0x95'):_0x153cce['childModel']=_0x480f('0x83');_0x153cce[_0x480f('0x74')]=[{'name':_0x480f('0x96'),'field':'id','foreignKey':_0x480f('0x97')}];break;case'lists':_0x153cce[_0x480f('0x70')]=_0x480f('0x98');break;case _0x480f('0x99'):_0x153cce[_0x480f('0x70')]=_0x480f('0x9a');break;case _0x480f('0x9b'):_0x153cce[_0x480f('0x70')]=_0x480f('0x9c');break;case _0x480f('0x9d'):_0x153cce[_0x480f('0x70')]=_0x480f('0x9e');break;case _0x480f('0x9f'):_0x153cce['childModel']=_0x480f('0xa0');break;case _0x480f('0xa1'):_0x153cce[_0x480f('0x70')]=_0x480f('0xa2');break;case _0x480f('0xa3'):_0x153cce[_0x480f('0x70')]=_0x480f('0xa4');break;case'inboundroutes':case _0x480f('0xa5'):case _0x480f('0xa6'):_0x153cce[_0x480f('0x70')]=_0x480f('0xa7');break;case _0x480f('0xa8'):_0x153cce[_0x480f('0x70')]=_0x480f('0xa9');break;case _0x480f('0xaa'):_0x153cce[_0x480f('0x70')]=_0x480f('0xab');break;case _0x480f('0xac'):_0x153cce[_0x480f('0x70')]=_0x480f('0xad');_0x153cce[_0x480f('0x74')]=[{'name':_0x480f('0xae'),'field':_0x480f('0x2a'),'foreignKey':_0x480f('0xaf'),'model':_0x480f('0xb0'),'filter':{'field':_0x480f('0xb1'),'value':[_0x480f('0xb2')]}},{'name':_0x480f('0xb3'),'field':_0x480f('0x2a'),'foreignKey':'membername','model':_0x480f('0xb0'),'filter':{'field':'role','value':['telephone']}},{'name':_0x480f('0xb4'),'field':_0x480f('0x2a'),'foreignKey':_0x480f('0xb5'),'model':_0x480f('0xb6'),'filter':{'field':_0x480f('0x2f'),'value':['inbound']}},{'name':_0x480f('0xb7'),'field':_0x480f('0x2a'),'foreignKey':'queue','model':_0x480f('0xb6'),'filter':{'field':_0x480f('0x2f'),'value':[_0x480f('0xb8')]}}];break;case _0x480f('0xb9'):_0x153cce[_0x480f('0x70')]=_0x480f('0xba');break;case _0x480f('0xbb'):_0x153cce[_0x480f('0x70')]=_0x480f('0xbc');break;case _0x480f('0xbd'):_0x153cce['childModel']=_0x480f('0xbe');break;case _0x480f('0xbf'):_0x153cce[_0x480f('0x70')]=_0x480f('0xc0');break;case _0x480f('0xc1'):_0x153cce[_0x480f('0x70')]=_0x480f('0xc2');break;case _0x480f('0xc3'):_0x153cce[_0x480f('0x70')]=_0x480f('0xc4');break;case'mailsubstatuses':_0x153cce[_0x480f('0x70')]=_0x480f('0xc5');break;case'openchannelqueues':_0x153cce[_0x480f('0x70')]=_0x480f('0xc6');break;case _0x480f('0xc7'):_0x153cce[_0x480f('0x70')]=_0x480f('0xc8');break;case'smsqueues':_0x153cce[_0x480f('0x70')]=_0x480f('0xc9');break;case'smsaccounts':_0x153cce[_0x480f('0x70')]=_0x480f('0xca');break;case _0x480f('0xcb'):_0x153cce[_0x480f('0x70')]=_0x480f('0xcc');break;case _0x480f('0xcd'):_0x153cce[_0x480f('0x70')]=_0x480f('0xce');break;case'teams':_0x153cce[_0x480f('0x70')]='Team';break;case _0x480f('0xcf'):case _0x480f('0xd0'):_0x153cce['childModel']=_0x480f('0xb6');if(_0x26458e){_0x153cce[_0x480f('0x74')]=[{'name':'VoiceQueues'},{'name':_0x480f('0xb7')}];}break;case'users':case'agents':case'telephones':_0x153cce[_0x480f('0x70')]='User';if(_0x26458e){_0x153cce[_0x480f('0x74')]=[{'name':_0x480f('0xd1'),'filter':{'field':_0x480f('0xb1'),'value':[_0x480f('0xd2'),_0x480f('0xd3')]},'ignore':!![]},{'name':'Agents'},{'name':_0x480f('0xb3')}];}break;case _0x480f('0xd4'):_0x153cce['childModel']='ZendeskAccount';break;case _0x480f('0xd5'):_0x153cce[_0x480f('0x70')]=_0x480f('0xd6');break;case _0x480f('0xd7'):_0x153cce[_0x480f('0x70')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x153cce[_0x480f('0x70')]=_0x480f('0xd8');break;case _0x480f('0xd9'):_0x153cce['childModel']=_0x480f('0xda');break;case _0x480f('0xdb'):_0x153cce[_0x480f('0x70')]='ZohoAccount';break;case'vtigeraccounts':_0x153cce[_0x480f('0x70')]=_0x480f('0xb0');break;case _0x480f('0xdc'):_0x153cce[_0x480f('0x70')]=_0x480f('0xdd');break;case _0x480f('0xde'):_0x153cce[_0x480f('0x70')]=_0x480f('0xdf');break;case _0x480f('0xe0'):_0x153cce[_0x480f('0x70')]='Dashboard';break;case _0x480f('0xe1'):_0x153cce[_0x480f('0x70')]=_0x480f('0xe2');break;case _0x480f('0xe3'):_0x153cce[_0x480f('0x70')]=_0x480f('0xe4');break;case _0x480f('0xe5'):_0x153cce[_0x480f('0x70')]=_0x480f('0xe6');break;case'sounds':_0x153cce[_0x480f('0x70')]=_0x480f('0xe7');break;case'tags':_0x153cce[_0x480f('0x70')]=_0x480f('0x84');break;case _0x480f('0xe8'):_0x153cce[_0x480f('0x70')]=_0x480f('0xe9');break;case _0x480f('0xea'):_0x153cce[_0x480f('0x70')]=_0x480f('0xeb');break;case _0x480f('0xec'):_0x153cce[_0x480f('0x70')]=_0x480f('0xed');break;case _0x480f('0xee'):_0x153cce[_0x480f('0x70')]=_0x480f('0xef');break;case'plugins':_0x153cce[_0x480f('0x70')]=_0x480f('0x66');break;case _0x480f('0xf0'):_0x153cce[_0x480f('0x70')]='AnalyticExtractedReport';_0x153cce[_0x480f('0x74')]=[{'name':_0x480f('0xf1'),'field':'id','foreignKey':_0x480f('0x80')}];break;case _0x480f('0xf2'):_0x153cce[_0x480f('0x70')]=_0x480f('0xf3');break;case _0x480f('0xcd'):_0x153cce[_0x480f('0x70')]='WhatsappAccount';break;default:return _0x153cce;}return _0x153cce;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5ab622d..3de388b 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 _0xee46=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile'];(function(_0x5c4063,_0x4a5b8f){var _0x3354e4=function(_0x3c8826){while(--_0x3c8826){_0x5c4063['push'](_0x5c4063['shift']());}};_0x3354e4(++_0x4a5b8f);}(_0xee46,0x11f));var _0x6ee4=function(_0xc10fc9,_0x2e00c5){_0xc10fc9=_0xc10fc9-0x0;var _0x3607ef=_0xee46[_0xc10fc9];return _0x3607ef;};'use strict';var EventEmitter=require(_0x6ee4('0x0'));var UserProfile=require(_0x6ee4('0x1'))['db'][_0x6ee4('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6ee4('0x3')](0x0);var events={'afterCreate':_0x6ee4('0x4'),'afterUpdate':'update','afterDestroy':_0x6ee4('0x5')};function emitEvent(_0x63fab6){return function(_0x4c5ce0,_0x1a2cf8,_0xd979ce){UserProfileEvents['emit'](_0x63fab6+':'+_0x4c5ce0['id'],_0x4c5ce0);UserProfileEvents[_0x6ee4('0x6')](_0x63fab6,_0x4c5ce0);_0xd979ce(null);};}for(var e in events){if(events[_0x6ee4('0x7')](e)){var event=events[e];UserProfile[_0x6ee4('0x8')](e,emitEvent(event));}}module[_0x6ee4('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xcf6d=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xcf6d,0x13d));var _0xdcf6=function(_0x1b18b3,_0x5700f8){_0x1b18b3=_0x1b18b3-0x0;var _0x57dd72=_0xcf6d[_0x1b18b3];return _0x57dd72;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xdcf6('0x0'))['db'][_0xdcf6('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xdcf6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdcf6('0x3'),'afterDestroy':_0xdcf6('0x4')};function emitEvent(_0x4129a3){return function(_0x3df18f,_0x3f7234,_0xc16840){UserProfileEvents[_0xdcf6('0x5')](_0x4129a3+':'+_0x3df18f['id'],_0x3df18f);UserProfileEvents['emit'](_0x4129a3,_0x3df18f);_0xc16840(null);};}for(var e in events){if(events[_0xdcf6('0x6')](e)){var event=events[e];UserProfile[_0xdcf6('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index fd86cdc..2da2f08 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 _0x98a5=['rimraf','../../config/environment','exports','define','user_profiles','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x145f2a,_0x4ada83){var _0x592b89=function(_0x3ad8bf){while(--_0x3ad8bf){_0x145f2a['push'](_0x145f2a['shift']());}};_0x592b89(++_0x4ada83);}(_0x98a5,0x118));var _0x598a=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x98a5[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var util=require(_0x598a('0x0'));var logger=require(_0x598a('0x1'))(_0x598a('0x2'));var moment=require(_0x598a('0x3'));var BPromise=require(_0x598a('0x4'));var rp=require(_0x598a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x598a('0x6'));var config=require(_0x598a('0x7'));var attributes=require('./userProfile.attributes');module[_0x598a('0x8')]=function(_0x1157b2,_0x4ce3e9){return _0x1157b2[_0x598a('0x9')]('UserProfile',attributes,{'tableName':_0x598a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29ab=['./userProfile.attributes','exports','UserProfile','user_profiles','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x8a45d,_0x210fd3){var _0x1f9483=function(_0x3d240f){while(--_0x3d240f){_0x8a45d['push'](_0x8a45d['shift']());}};_0x1f9483(++_0x210fd3);}(_0x29ab,0x126));var _0xb29a=function(_0x49c3b1,_0x15b955){_0x49c3b1=_0x49c3b1-0x0;var _0x5e2760=_0x29ab[_0x49c3b1];return _0x5e2760;};'use strict';var _=require(_0xb29a('0x0'));var util=require(_0xb29a('0x1'));var logger=require('../../config/logger')(_0xb29a('0x2'));var moment=require('moment');var BPromise=require(_0xb29a('0x3'));var rp=require(_0xb29a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb29a('0x5'));var config=require('../../config/environment');var attributes=require(_0xb29a('0x6'));module[_0xb29a('0x7')]=function(_0x119f59,_0x44994e){return _0x119f59['define'](_0xb29a('0x8'),attributes,{'tableName':_0xb29a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index cb59a98..d74af9a 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 _0x7dfd=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});config[_0xd7df('0xe')]=_[_0xd7df('0xf')](config[_0xd7df('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7df('0x10'))(new Redis(config[_0xd7df('0xe')]));require(_0xd7df('0x11'))[_0xd7df('0x12')](socket);function respondWithRpcPromise(_0x5e59c3,_0x32c5b5,_0x532c14){return new BPromise(function(_0x183ace,_0x567e83){return client[_0xd7df('0x13')](_0x5e59c3,_0x532c14)[_0xd7df('0x14')](function(_0x28d358){logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,_0xd7df('0x17'));logger[_0xd7df('0x18')](_0xd7df('0x19'),_0x32c5b5,_0xd7df('0x17'),JSON[_0xd7df('0x1a')](_0x28d358));if(_0x28d358[_0xd7df('0x1b')]){if(_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1c')]===0x1f4){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x567e83(_0x28d358['error'][_0xd7df('0x1d')]);}logger[_0xd7df('0x1b')]('UserProfile,\x20%s,\x20%s',_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x183ace(_0x28d358['error'][_0xd7df('0x1d')]);}else{logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,'request\x20sent');_0x183ace(_0x28d358[_0xd7df('0x1e')][_0xd7df('0x1d')]);}})[_0xd7df('0x1f')](function(_0x5ba653){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x5ba653);_0x567e83(_0x5ba653);});});} \ No newline at end of file +var _0x46ed=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','stringify','code','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x3e67cd,_0x44df0b){var _0x10d0c9=function(_0x476c83){while(--_0x476c83){_0x3e67cd['push'](_0x3e67cd['shift']());}};_0x10d0c9(++_0x44df0b);}(_0x46ed,0x168));var _0xd46e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46ed[_0x51020b];return _0x371e47;};'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});config[_0xd46e('0xb')]=_[_0xd46e('0xc')](config[_0xd46e('0xb')],{'host':_0xd46e('0xd'),'port':0x18eb});var socket=require(_0xd46e('0xe'))(new Redis(config[_0xd46e('0xb')]));require(_0xd46e('0xf'))['register'](socket);function respondWithRpcPromise(_0x7b2d69,_0x81235b,_0x50ccd3){return new BPromise(function(_0x3585e7,_0x15b5cb){return client[_0xd46e('0x10')](_0x7b2d69,_0x50ccd3)[_0xd46e('0x11')](function(_0x1ad723){logger[_0xd46e('0x12')]('UserProfile,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'),JSON[_0xd46e('0x14')](_0x1ad723));if(_0x1ad723['error']){if(_0x1ad723['error'][_0xd46e('0x15')]===0x1f4){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x15b5cb(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x3585e7(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}else{logger[_0xd46e('0x12')]('UserProfile,\x20%s,\x20%s',_0x81235b,'request\x20sent');_0x3585e7(_0x1ad723[_0xd46e('0x19')][_0xd46e('0x18')]);}})['catch'](function(_0x4fd1f2){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x4fd1f2);_0x15b5cb(_0x4fd1f2);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6e16513..289ac91 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 _0x4329=['remove','update','removeListener','register','length','userProfile:','./userProfile.events','save'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x4329,0x13e));var _0x9432=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x4329[_0x2763f2];return _0x3ef471;};'use strict';var UserProfileEvents=require(_0x9432('0x0'));var events=[_0x9432('0x1'),_0x9432('0x2'),_0x9432('0x3')];function createListener(_0x4bd93a,_0x2d6a08){return function(_0x52366f){_0x2d6a08['emit'](_0x4bd93a,_0x52366f);};}function removeListener(_0x4b58b5,_0x427a16){return function(){UserProfileEvents[_0x9432('0x4')](_0x4b58b5,_0x427a16);};}exports[_0x9432('0x5')]=function(_0x3e5056){for(var _0x505d1e=0x0,_0x5254f9=events[_0x9432('0x6')];_0x505d1e<_0x5254f9;_0x505d1e++){var _0x2dd907=events[_0x505d1e];var _0x2387b1=createListener(_0x9432('0x7')+_0x2dd907,_0x3e5056);UserProfileEvents['on'](_0x2dd907,_0x2387b1);}}; \ No newline at end of file +var _0x83b9=['length','userProfile:','save','remove','update','emit','removeListener'];(function(_0x4a311e,_0x44d94a){var _0x151446=function(_0x505d32){while(--_0x505d32){_0x4a311e['push'](_0x4a311e['shift']());}};_0x151446(++_0x44d94a);}(_0x83b9,0xe9));var _0x983b=function(_0x53de4a,_0xca4fdc){_0x53de4a=_0x53de4a-0x0;var _0x38c7da=_0x83b9[_0x53de4a];return _0x38c7da;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x983b('0x0'),_0x983b('0x1'),_0x983b('0x2')];function createListener(_0xdb84b2,_0x2ce10e){return function(_0x45fbc9){_0x2ce10e[_0x983b('0x3')](_0xdb84b2,_0x45fbc9);};}function removeListener(_0x25cc57,_0x41e2af){return function(){UserProfileEvents[_0x983b('0x4')](_0x25cc57,_0x41e2af);};}exports['register']=function(_0x5d4c35){for(var _0x28b676=0x0,_0x56eca8=events[_0x983b('0x5')];_0x28b676<_0x56eca8;_0x28b676++){var _0xb80324=events[_0x28b676];var _0x56ec27=createListener(_0x983b('0x6')+_0xb80324,_0x5d4c35);UserProfileEvents['on'](_0xb80324,_0x56ec27);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 2a6d380..34b4d11 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 _0x4838=['/:id','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4838,0x111));var _0x8483=function(_0x477e93,_0x348a62){_0x477e93=_0x477e93-0x0;var _0x2cdbbe=_0x4838[_0x477e93];return _0x2cdbbe;};'use strict';var multer=require('multer');var util=require(_0x8483('0x0'));var path=require('path');var timeout=require(_0x8483('0x1'));var express=require(_0x8483('0x2'));var router=express[_0x8483('0x3')]();var auth=require(_0x8483('0x4'));var interaction=require(_0x8483('0x5'));var config=require(_0x8483('0x6'));var controller=require(_0x8483('0x7'));router[_0x8483('0x8')]('/',auth[_0x8483('0x9')](),controller[_0x8483('0xa')]);router[_0x8483('0x8')](_0x8483('0xb'),auth[_0x8483('0x9')](),controller['describe']);router['get']('/:id',auth[_0x8483('0x9')](),controller[_0x8483('0xc')]);router[_0x8483('0xd')]('/',auth[_0x8483('0x9')](),controller[_0x8483('0xe')]);router['put'](_0x8483('0xf'),auth[_0x8483('0x9')](),controller['update']);router[_0x8483('0x10')](_0x8483('0xf'),auth['isAuthenticated'](),controller[_0x8483('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4333=['index','/describe','describe','get','/:id','show','post','create','put','update','destroy','util','path','express','../../components/interaction/service','isAuthenticated'];(function(_0x17f1d9,_0x1183cc){var _0x2cd8ac=function(_0x53dc17){while(--_0x53dc17){_0x17f1d9['push'](_0x17f1d9['shift']());}};_0x2cd8ac(++_0x1183cc);}(_0x4333,0x1eb));var _0x3433=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x4333[_0x5627e1];return _0x2f013f;};'use strict';var multer=require('multer');var util=require(_0x3433('0x0'));var path=require(_0x3433('0x1'));var timeout=require('connect-timeout');var express=require(_0x3433('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3433('0x3'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router['get']('/',auth[_0x3433('0x4')](),controller[_0x3433('0x5')]);router['get'](_0x3433('0x6'),auth[_0x3433('0x4')](),controller[_0x3433('0x7')]);router[_0x3433('0x8')](_0x3433('0x9'),auth[_0x3433('0x4')](),controller[_0x3433('0xa')]);router[_0x3433('0xb')]('/',auth['isAuthenticated'](),controller[_0x3433('0xc')]);router[_0x3433('0xd')]('/:id',auth[_0x3433('0x4')](),controller[_0x3433('0xe')]);router['delete'](_0x3433('0x9'),auth['isAuthenticated'](),controller[_0x3433('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e40adaf..22ea41a 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 _0x0263=['STRING','INTEGER','sequelize','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0263,0xf2));var _0x3026=function(_0x3abd23,_0x42fa6e){_0x3abd23=_0x3abd23-0x0;var _0x4f0c0b=_0x0263[_0x3abd23];return _0x4f0c0b;};'use strict';var Sequelize=require(_0x3026('0x0'));module[_0x3026('0x1')]={'name':{'type':Sequelize[_0x3026('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3026('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x87b5=['STRING','INTEGER','sequelize'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x87b5,0x10a));var _0x587b=function(_0x28c5c2,_0x4b744e){_0x28c5c2=_0x28c5c2-0x0;var _0x11e884=_0x87b5[_0x28c5c2];return _0x11e884;};'use strict';var Sequelize=require(_0x587b('0x0'));module['exports']={'name':{'type':Sequelize[_0x587b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x587b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x587b('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 61da6d6..8b7c8ad 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 _0x3435=['../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','end','error','stack','index','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','where','filter','merge','name','options','UserProfileResource','includeAll','include','rows','catch','show','params','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x402695,_0x2d09e2){var _0x46bf2d=function(_0x1a160d){while(--_0x1a160d){_0x402695['push'](_0x402695['shift']());}};_0x46bf2d(++_0x2d09e2);}(_0x3435,0xfa));var _0x5343=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x3435[_0x17406a];return _0x1501ff;};'use strict';var pdf=require(_0x5343('0x0'));var emlformat=require(_0x5343('0x1'));var rimraf=require(_0x5343('0x2'));var zipdir=require(_0x5343('0x3'));var jsonpatch=require(_0x5343('0x4'));var rp=require(_0x5343('0x5'));var moment=require('moment');var BPromise=require(_0x5343('0x6'));var Mustache=require(_0x5343('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5343('0x8'));var csv=require(_0x5343('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5343('0xa'));var crypto=require(_0x5343('0xb'));var jsforce=require(_0x5343('0xc'));var deskjs=require(_0x5343('0xd'));var toCsv=require(_0x5343('0x9'));var querystring=require('querystring');var Papa=require(_0x5343('0xe'));var Redis=require('ioredis');var authService=require(_0x5343('0xf'));var qs=require(_0x5343('0x10'));var as=require(_0x5343('0x11'));var hardwareService=require(_0x5343('0x12'));var logger=require(_0x5343('0x13'))('api');var utils=require(_0x5343('0x14'));var config=require(_0x5343('0x15'));var db=require(_0x5343('0x16'))['db'];function respondWithStatusCode(_0x5f1724,_0x2ddeb7){_0x2ddeb7=_0x2ddeb7||0xcc;return function(_0x5f473f){if(_0x5f473f){return _0x5f1724[_0x5343('0x17')](_0x2ddeb7);}return _0x5f1724[_0x5343('0x18')](_0x2ddeb7)['end']();};}function respondWithResult(_0x392797,_0x4cdfae){_0x4cdfae=_0x4cdfae||0xc8;return function(_0x13066f){if(_0x13066f){return _0x392797[_0x5343('0x18')](_0x4cdfae)[_0x5343('0x19')](_0x13066f);}};}function respondWithFilteredResult(_0x65e827,_0x4dbff1){return function(_0x446e90){if(_0x446e90){var _0x588a96=_0x446e90[_0x5343('0x1a')],_0x1df724=_0x4dbff1[_0x5343('0x1b')],_0x3f27fb=_0x4dbff1[_0x5343('0x1b')]+_0x4dbff1['limit'],_0x45cade;if(_0x3f27fb>=_0x588a96){_0x3f27fb=_0x588a96;_0x45cade=0xc8;}else{_0x45cade=0xce;}_0x65e827[_0x5343('0x18')](_0x45cade);return _0x65e827[_0x5343('0x1c')](_0x5343('0x1d'),_0x1df724+'-'+_0x3f27fb+'/'+_0x588a96)['json'](_0x446e90);}return null;};}function patchUpdates(_0x1eb3bd){return function(_0x399eec){try{jsonpatch[_0x5343('0x1e')](_0x399eec,_0x1eb3bd,!![]);}catch(_0x2f1b48){return BPromise[_0x5343('0x1f')](_0x2f1b48);}return _0x399eec[_0x5343('0x20')]();};}function saveUpdates(_0x132505,_0x40ba38){return function(_0x35d41d){if(_0x35d41d){return _0x35d41d['update'](_0x132505)[_0x5343('0x21')](function(_0x3da777){return _0x3da777;});}return null;};}function removeEntity(_0x5c2d6f,_0x42f92d){return function(_0xd95a5b){if(_0xd95a5b){return _0xd95a5b['destroy']()[_0x5343('0x21')](function(){_0x5c2d6f[_0x5343('0x18')](0xcc)[_0x5343('0x22')]();});}};}function handleEntityNotFound(_0x380aae,_0x290ce8){return function(_0x486597){if(!_0x486597){_0x380aae[_0x5343('0x17')](0x194);}return _0x486597;};}function handleError(_0x17b88a,_0x584034){_0x584034=_0x584034||0x1f4;return function(_0x3072ad){logger[_0x5343('0x23')](_0x3072ad[_0x5343('0x24')]);if(_0x3072ad['name']){delete _0x3072ad['name'];}_0x17b88a[_0x5343('0x18')](_0x584034)['send'](_0x3072ad);};}exports[_0x5343('0x25')]=function(_0x5e4b38,_0x1bf35f){var _0x55ab94={},_0x50c584={},_0xd6c267={'count':0x0,'rows':[]};var _0x4cb858=_['map'](db['UserProfileResource'][_0x5343('0x26')],function(_0x5d0853){return{'name':_0x5d0853[_0x5343('0x27')],'type':_0x5d0853['type']['key']};});_0x50c584[_0x5343('0x28')]=_['map'](_0x4cb858,'name');_0x50c584[_0x5343('0x29')]=_[_0x5343('0x2a')](_0x5e4b38[_0x5343('0x29')]);_0x50c584[_0x5343('0x2b')]=_['intersection'](_0x50c584['model'],_0x50c584[_0x5343('0x29')]);_0x55ab94[_0x5343('0x2c')]=_[_0x5343('0x2d')](_0x50c584[_0x5343('0x28')],qs[_0x5343('0x2e')](_0x5e4b38[_0x5343('0x29')][_0x5343('0x2e')]));_0x55ab94[_0x5343('0x2c')]=_0x55ab94[_0x5343('0x2c')][_0x5343('0x2f')]?_0x55ab94[_0x5343('0x2c')]:_0x50c584[_0x5343('0x28')];if(!_0x5e4b38['query']['hasOwnProperty'](_0x5343('0x30'))){_0x55ab94[_0x5343('0x31')]=qs['limit'](_0x5e4b38[_0x5343('0x29')]['limit']);_0x55ab94[_0x5343('0x1b')]=qs[_0x5343('0x1b')](_0x5e4b38[_0x5343('0x29')][_0x5343('0x1b')]);}_0x55ab94['order']=qs['sort'](_0x5e4b38[_0x5343('0x29')]['sort']);_0x55ab94[_0x5343('0x32')]=qs[_0x5343('0x2b')](_['pick'](_0x5e4b38[_0x5343('0x29')],_0x50c584['filters']),_0x4cb858);if(_0x5e4b38['query'][_0x5343('0x33')]){_0x55ab94[_0x5343('0x32')]=_[_0x5343('0x34')](_0x55ab94[_0x5343('0x32')],{'$or':_['map'](_0x4cb858,function(_0x549996){if(_0x549996['type']!=='VIRTUAL'){var _0x34f5a9={};_0x34f5a9[_0x549996[_0x5343('0x35')]]={'$like':'%'+_0x5e4b38[_0x5343('0x29')][_0x5343('0x33')]+'%'};return _0x34f5a9;}})});}_0x55ab94=_[_0x5343('0x34')]({},_0x55ab94,_0x5e4b38[_0x5343('0x36')]);var _0x3c112a={'where':_0x55ab94['where']};return db[_0x5343('0x37')]['count'](_0x3c112a)[_0x5343('0x21')](function(_0x3c6d7b){_0xd6c267[_0x5343('0x1a')]=_0x3c6d7b;if(_0x5e4b38[_0x5343('0x29')][_0x5343('0x38')]){_0x55ab94[_0x5343('0x39')]=[{'all':!![]}];}return db[_0x5343('0x37')]['findAll'](_0x55ab94);})[_0x5343('0x21')](function(_0x52c521){_0xd6c267[_0x5343('0x3a')]=_0x52c521;return _0xd6c267;})[_0x5343('0x21')](respondWithFilteredResult(_0x1bf35f,_0x55ab94))[_0x5343('0x3b')](handleError(_0x1bf35f,null));};exports[_0x5343('0x3c')]=function(_0x1603f9,_0xfed8aa){var _0x2c75bd={'raw':![],'where':{'id':_0x1603f9[_0x5343('0x3d')]['id']}},_0x4fcbd8={};_0x4fcbd8[_0x5343('0x28')]=_['keys'](db[_0x5343('0x37')][_0x5343('0x26')]);_0x4fcbd8['query']=_['keys'](_0x1603f9[_0x5343('0x29')]);_0x4fcbd8[_0x5343('0x2b')]=_[_0x5343('0x2d')](_0x4fcbd8['model'],_0x4fcbd8[_0x5343('0x29')]);_0x2c75bd[_0x5343('0x2c')]=_[_0x5343('0x2d')](_0x4fcbd8[_0x5343('0x28')],qs[_0x5343('0x2e')](_0x1603f9[_0x5343('0x29')][_0x5343('0x2e')]));_0x2c75bd['attributes']=_0x2c75bd[_0x5343('0x2c')][_0x5343('0x2f')]?_0x2c75bd[_0x5343('0x2c')]:_0x4fcbd8[_0x5343('0x28')];if(_0x1603f9[_0x5343('0x29')][_0x5343('0x38')]){_0x2c75bd[_0x5343('0x39')]=[{'all':!![]}];}_0x2c75bd=_[_0x5343('0x34')]({},_0x2c75bd,_0x1603f9[_0x5343('0x36')]);return db[_0x5343('0x37')][_0x5343('0x3e')](_0x2c75bd)[_0x5343('0x21')](handleEntityNotFound(_0xfed8aa,null))[_0x5343('0x21')](respondWithResult(_0xfed8aa,null))[_0x5343('0x3b')](handleError(_0xfed8aa,null));};exports[_0x5343('0x3f')]=function(_0x48f9ce,_0x2595a1){return db[_0x5343('0x37')]['create'](_0x48f9ce[_0x5343('0x40')],{})[_0x5343('0x21')](respondWithResult(_0x2595a1,0xc9))[_0x5343('0x3b')](handleError(_0x2595a1,null));};exports[_0x5343('0x41')]=function(_0x194316,_0x5bf69c){if(_0x194316[_0x5343('0x40')]['id']){delete _0x194316['body']['id'];}return db['UserProfileResource'][_0x5343('0x3e')]({'where':{'id':_0x194316[_0x5343('0x3d')]['id']}})[_0x5343('0x21')](handleEntityNotFound(_0x5bf69c,null))[_0x5343('0x21')](saveUpdates(_0x194316['body'],null))[_0x5343('0x21')](respondWithResult(_0x5bf69c,null))[_0x5343('0x3b')](handleError(_0x5bf69c,null));};exports[_0x5343('0x42')]=function(_0xb2cc07,_0xad241){return db[_0x5343('0x37')][_0x5343('0x3e')]({'where':{'id':_0xb2cc07[_0x5343('0x3d')]['id']}})[_0x5343('0x21')](handleEntityNotFound(_0xad241,null))[_0x5343('0x21')](removeEntity(_0xad241,null))['catch'](handleError(_0xad241,null));};exports[_0x5343('0x43')]=function(_0x2184e9,_0x414e50){return db[_0x5343('0x37')][_0x5343('0x43')]()[_0x5343('0x21')](respondWithResult(_0x414e50,null))[_0x5343('0x3b')](handleError(_0x414e50,null));}; \ No newline at end of file +var _0x826a=['../../mysqldb','sendStatus','end','offset','limit','status','set','json','reject','save','then','destroy','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x78f0aa,_0x2b013a){var _0x319a60=function(_0x27a546){while(--_0x27a546){_0x78f0aa['push'](_0x78f0aa['shift']());}};_0x319a60(++_0x2b013a);}(_0x826a,0x1aa));var _0xa826=function(_0x1cfcdf,_0x295f84){_0x1cfcdf=_0x1cfcdf-0x0;var _0x33c80b=_0x826a[_0x1cfcdf];return _0x33c80b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa826('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa826('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa826('0x2'));var moment=require(_0xa826('0x3'));var BPromise=require(_0xa826('0x4'));var Mustache=require(_0xa826('0x5'));var util=require('util');var path=require(_0xa826('0x6'));var sox=require(_0xa826('0x7'));var csv=require(_0xa826('0x8'));var ejs=require(_0xa826('0x9'));var fs=require('fs');var _=require(_0xa826('0xa'));var squel=require(_0xa826('0xb'));var crypto=require(_0xa826('0xc'));var jsforce=require(_0xa826('0xd'));var deskjs=require(_0xa826('0xe'));var toCsv=require(_0xa826('0x8'));var querystring=require(_0xa826('0xf'));var Papa=require(_0xa826('0x10'));var Redis=require(_0xa826('0x11'));var authService=require(_0xa826('0x12'));var qs=require(_0xa826('0x13'));var as=require(_0xa826('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa826('0x15'))('api');var utils=require(_0xa826('0x16'));var config=require(_0xa826('0x17'));var db=require(_0xa826('0x18'))['db'];function respondWithStatusCode(_0xa55bd7,_0x212fac){_0x212fac=_0x212fac||0xcc;return function(_0x40838f){if(_0x40838f){return _0xa55bd7[_0xa826('0x19')](_0x212fac);}return _0xa55bd7['status'](_0x212fac)[_0xa826('0x1a')]();};}function respondWithResult(_0x5c6cee,_0x3e99b0){_0x3e99b0=_0x3e99b0||0xc8;return function(_0x41c0c2){if(_0x41c0c2){return _0x5c6cee['status'](_0x3e99b0)['json'](_0x41c0c2);}};}function respondWithFilteredResult(_0x49c91e,_0x1b6d16){return function(_0x4f25bd){if(_0x4f25bd){var _0x4c546b=_0x4f25bd['count'],_0x9a3788=_0x1b6d16[_0xa826('0x1b')],_0x142474=_0x1b6d16[_0xa826('0x1b')]+_0x1b6d16[_0xa826('0x1c')],_0x2e15e2;if(_0x142474>=_0x4c546b){_0x142474=_0x4c546b;_0x2e15e2=0xc8;}else{_0x2e15e2=0xce;}_0x49c91e[_0xa826('0x1d')](_0x2e15e2);return _0x49c91e[_0xa826('0x1e')]('Content-Range',_0x9a3788+'-'+_0x142474+'/'+_0x4c546b)[_0xa826('0x1f')](_0x4f25bd);}return null;};}function patchUpdates(_0x2938ba){return function(_0x229b90){try{jsonpatch['apply'](_0x229b90,_0x2938ba,!![]);}catch(_0x5d8161){return BPromise[_0xa826('0x20')](_0x5d8161);}return _0x229b90[_0xa826('0x21')]();};}function saveUpdates(_0xd8ca56,_0x8d1650){return function(_0x124564){if(_0x124564){return _0x124564['update'](_0xd8ca56)[_0xa826('0x22')](function(_0x2e7e90){return _0x2e7e90;});}return null;};}function removeEntity(_0x3272fb,_0x5d410f){return function(_0x5ddeef){if(_0x5ddeef){return _0x5ddeef[_0xa826('0x23')]()[_0xa826('0x22')](function(){_0x3272fb[_0xa826('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7adf,_0x26ef25){return function(_0x1d4ade){if(!_0x1d4ade){_0x1d7adf[_0xa826('0x19')](0x194);}return _0x1d4ade;};}function handleError(_0x1ec8a8,_0x4d6909){_0x4d6909=_0x4d6909||0x1f4;return function(_0x13329a){logger['error'](_0x13329a[_0xa826('0x24')]);if(_0x13329a[_0xa826('0x25')]){delete _0x13329a['name'];}_0x1ec8a8[_0xa826('0x1d')](_0x4d6909)[_0xa826('0x26')](_0x13329a);};}exports[_0xa826('0x27')]=function(_0xf132e0,_0x1107a4){var _0x3c6307={},_0x14e836={},_0x3b9c6d={'count':0x0,'rows':[]};var _0x36ded2=_[_0xa826('0x28')](db[_0xa826('0x29')][_0xa826('0x2a')],function(_0x1f2749){return{'name':_0x1f2749[_0xa826('0x2b')],'type':_0x1f2749[_0xa826('0x2c')][_0xa826('0x2d')]};});_0x14e836['model']=_[_0xa826('0x28')](_0x36ded2,'name');_0x14e836[_0xa826('0x2e')]=_[_0xa826('0x2f')](_0xf132e0[_0xa826('0x2e')]);_0x14e836[_0xa826('0x30')]=_[_0xa826('0x31')](_0x14e836['model'],_0x14e836['query']);_0x3c6307[_0xa826('0x32')]=_[_0xa826('0x31')](_0x14e836[_0xa826('0x33')],qs[_0xa826('0x34')](_0xf132e0['query'][_0xa826('0x34')]));_0x3c6307[_0xa826('0x32')]=_0x3c6307['attributes'][_0xa826('0x35')]?_0x3c6307['attributes']:_0x14e836[_0xa826('0x33')];if(!_0xf132e0[_0xa826('0x2e')][_0xa826('0x36')](_0xa826('0x37'))){_0x3c6307[_0xa826('0x1c')]=qs['limit'](_0xf132e0[_0xa826('0x2e')][_0xa826('0x1c')]);_0x3c6307[_0xa826('0x1b')]=qs[_0xa826('0x1b')](_0xf132e0[_0xa826('0x2e')][_0xa826('0x1b')]);}_0x3c6307[_0xa826('0x38')]=qs[_0xa826('0x39')](_0xf132e0[_0xa826('0x2e')][_0xa826('0x39')]);_0x3c6307[_0xa826('0x3a')]=qs['filters'](_[_0xa826('0x3b')](_0xf132e0['query'],_0x14e836[_0xa826('0x30')]),_0x36ded2);if(_0xf132e0['query'][_0xa826('0x3c')]){_0x3c6307[_0xa826('0x3a')]=_[_0xa826('0x3d')](_0x3c6307[_0xa826('0x3a')],{'$or':_[_0xa826('0x28')](_0x36ded2,function(_0x75f59){if(_0x75f59[_0xa826('0x2c')]!==_0xa826('0x3e')){var _0x22a45e={};_0x22a45e[_0x75f59[_0xa826('0x25')]]={'$like':'%'+_0xf132e0[_0xa826('0x2e')][_0xa826('0x3c')]+'%'};return _0x22a45e;}})});}_0x3c6307=_['merge']({},_0x3c6307,_0xf132e0[_0xa826('0x3f')]);var _0x2f7be4={'where':_0x3c6307[_0xa826('0x3a')]};return db['UserProfileResource'][_0xa826('0x40')](_0x2f7be4)[_0xa826('0x22')](function(_0x520e10){_0x3b9c6d[_0xa826('0x40')]=_0x520e10;if(_0xf132e0['query']['includeAll']){_0x3c6307[_0xa826('0x41')]=[{'all':!![]}];}return db[_0xa826('0x29')][_0xa826('0x42')](_0x3c6307);})[_0xa826('0x22')](function(_0x451814){_0x3b9c6d[_0xa826('0x43')]=_0x451814;return _0x3b9c6d;})['then'](respondWithFilteredResult(_0x1107a4,_0x3c6307))[_0xa826('0x44')](handleError(_0x1107a4,null));};exports[_0xa826('0x45')]=function(_0x2be07c,_0x14fc0d){var _0x244fd3={'raw':![],'where':{'id':_0x2be07c['params']['id']}},_0x19292e={};_0x19292e[_0xa826('0x33')]=_[_0xa826('0x2f')](db[_0xa826('0x29')][_0xa826('0x2a')]);_0x19292e[_0xa826('0x2e')]=_['keys'](_0x2be07c[_0xa826('0x2e')]);_0x19292e[_0xa826('0x30')]=_[_0xa826('0x31')](_0x19292e[_0xa826('0x33')],_0x19292e[_0xa826('0x2e')]);_0x244fd3[_0xa826('0x32')]=_[_0xa826('0x31')](_0x19292e[_0xa826('0x33')],qs[_0xa826('0x34')](_0x2be07c[_0xa826('0x2e')][_0xa826('0x34')]));_0x244fd3[_0xa826('0x32')]=_0x244fd3['attributes'][_0xa826('0x35')]?_0x244fd3[_0xa826('0x32')]:_0x19292e[_0xa826('0x33')];if(_0x2be07c['query'][_0xa826('0x46')]){_0x244fd3[_0xa826('0x41')]=[{'all':!![]}];}_0x244fd3=_[_0xa826('0x3d')]({},_0x244fd3,_0x2be07c[_0xa826('0x3f')]);return db[_0xa826('0x29')]['find'](_0x244fd3)[_0xa826('0x22')](handleEntityNotFound(_0x14fc0d,null))[_0xa826('0x22')](respondWithResult(_0x14fc0d,null))[_0xa826('0x44')](handleError(_0x14fc0d,null));};exports[_0xa826('0x47')]=function(_0xec6ccf,_0x30aac0){return db[_0xa826('0x29')]['create'](_0xec6ccf[_0xa826('0x48')],{})['then'](respondWithResult(_0x30aac0,0xc9))['catch'](handleError(_0x30aac0,null));};exports['update']=function(_0x26a858,_0x35d118){if(_0x26a858[_0xa826('0x48')]['id']){delete _0x26a858[_0xa826('0x48')]['id'];}return db['UserProfileResource'][_0xa826('0x49')]({'where':{'id':_0x26a858['params']['id']}})['then'](handleEntityNotFound(_0x35d118,null))[_0xa826('0x22')](saveUpdates(_0x26a858[_0xa826('0x48')],null))['then'](respondWithResult(_0x35d118,null))[_0xa826('0x44')](handleError(_0x35d118,null));};exports[_0xa826('0x23')]=function(_0x57f237,_0x5a87bf){return db['UserProfileResource']['find']({'where':{'id':_0x57f237['params']['id']}})['then'](handleEntityNotFound(_0x5a87bf,null))['then'](removeEntity(_0x5a87bf,null))[_0xa826('0x44')](handleError(_0x5a87bf,null));};exports['describe']=function(_0x2de265,_0x486b6c){return db[_0xa826('0x29')][_0xa826('0x4a')]()[_0xa826('0x22')](respondWithResult(_0x486b6c,null))[_0xa826('0x44')](handleError(_0x486b6c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 06fd069..95d06a5 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 _0x1618=['bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger'];(function(_0x481107,_0x53c8af){var _0x59e55a=function(_0x1f8d94){while(--_0x1f8d94){_0x481107['push'](_0x481107['shift']());}};_0x59e55a(++_0x53c8af);}(_0x1618,0x12a));var _0x8161=function(_0x4aa070,_0x5de04f){_0x4aa070=_0x4aa070-0x0;var _0x127c9c=_0x1618[_0x4aa070];return _0x127c9c;};'use strict';var _=require('lodash');var util=require(_0x8161('0x0'));var logger=require(_0x8161('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8161('0x2'));var rp=require(_0x8161('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8161('0x4'));var config=require(_0x8161('0x5'));var attributes=require(_0x8161('0x6'));module[_0x8161('0x7')]=function(_0x4eee48,_0x5d3d62){return _0x4eee48['define']('UserProfileResource',attributes,{'tableName':_0x8161('0x8'),'paranoid':![],'indexes':[{'name':_0x8161('0x9'),'fields':[_0x8161('0xa'),_0x8161('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfceb=['./userProfileResource.attributes','define','UserProfileResource','compositeIndex','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xfceb,0x14e));var _0xbfce=function(_0x423419,_0x4152bf){_0x423419=_0x423419-0x0;var _0x5ee13a=_0xfceb[_0x423419];return _0x5ee13a;};'use strict';var _=require(_0xbfce('0x0'));var util=require('util');var logger=require(_0xbfce('0x1'))(_0xbfce('0x2'));var moment=require(_0xbfce('0x3'));var BPromise=require(_0xbfce('0x4'));var rp=require(_0xbfce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbfce('0x6'));var attributes=require(_0xbfce('0x7'));module['exports']=function(_0x5b0de4,_0x5532e7){return _0x5b0de4[_0xbfce('0x8')](_0xbfce('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xbfce('0xa'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b137e08..803931a 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 _0xfd76=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x5692e1,_0x372ecf){var _0x66bdab=function(_0x18b294){while(--_0x18b294){_0x5692e1['push'](_0x5692e1['shift']());}};_0x66bdab(++_0x372ecf);}(_0xfd76,0xdd));var _0x6fd7=function(_0x32a2e4,_0x387807){_0x32a2e4=_0x32a2e4-0x0;var _0x5eb8fd=_0xfd76[_0x32a2e4];return _0x5eb8fd;};'use strict';var _=require(_0x6fd7('0x0'));var util=require('util');var moment=require(_0x6fd7('0x1'));var BPromise=require(_0x6fd7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6fd7('0x3'));var db=require(_0x6fd7('0x4'))['db'];var utils=require(_0x6fd7('0x5'));var logger=require(_0x6fd7('0x6'))(_0x6fd7('0x7'));var config=require('../../config/environment');var jayson=require(_0x6fd7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34edcf,_0x32b4b8,_0x5c6a53){return new BPromise(function(_0xd8316a,_0xe1b72e){return client['request'](_0x34edcf,_0x5c6a53)['then'](function(_0x2109fa){logger[_0x6fd7('0x9')](_0x6fd7('0xa'),_0x32b4b8,_0x6fd7('0xb'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x32b4b8,_0x6fd7('0xb'),JSON[_0x6fd7('0xc')](_0x2109fa));if(_0x2109fa[_0x6fd7('0xd')]){if(_0x2109fa[_0x6fd7('0xd')][_0x6fd7('0xe')]===0x1f4){logger[_0x6fd7('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x32b4b8,_0x2109fa[_0x6fd7('0xd')][_0x6fd7('0xf')]);return _0xe1b72e(_0x2109fa[_0x6fd7('0xd')][_0x6fd7('0xf')]);}logger[_0x6fd7('0xd')](_0x6fd7('0xa'),_0x32b4b8,_0x2109fa[_0x6fd7('0xd')][_0x6fd7('0xf')]);return _0xd8316a(_0x2109fa['error'][_0x6fd7('0xf')]);}else{logger[_0x6fd7('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x32b4b8,_0x6fd7('0xb'));_0xd8316a(_0x2109fa['result'][_0x6fd7('0xf')]);}})[_0x6fd7('0x10')](function(_0x5b9319){logger[_0x6fd7('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x32b4b8,_0x5b9319);_0xe1b72e(_0x5b9319);});});} \ No newline at end of file +var _0xd2ee=['UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xd2ee,0x1d7));var _0xed2e=function(_0x2b982a,_0x3623c8){_0x2b982a=_0x2b982a-0x0;var _0x42dfea=_0xd2ee[_0x2b982a];return _0x42dfea;};'use strict';var _=require('lodash');var util=require(_0xed2e('0x0'));var moment=require(_0xed2e('0x1'));var BPromise=require(_0xed2e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed2e('0x3'))['db'];var utils=require(_0xed2e('0x4'));var logger=require(_0xed2e('0x5'))(_0xed2e('0x6'));var config=require(_0xed2e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed2e('0x8')][_0xed2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ba085,_0x76d9fa,_0x43b6f3){return new BPromise(function(_0x204644,_0x194a3a){return client[_0xed2e('0xa')](_0x5ba085,_0x43b6f3)[_0xed2e('0xb')](function(_0x16ae51){logger[_0xed2e('0xc')](_0xed2e('0xd'),_0x76d9fa,'request\x20sent');logger[_0xed2e('0xe')](_0xed2e('0xf'),_0x76d9fa,'request\x20sent',JSON['stringify'](_0x16ae51));if(_0x16ae51[_0xed2e('0x10')]){if(_0x16ae51['error'][_0xed2e('0x11')]===0x1f4){logger[_0xed2e('0x10')](_0xed2e('0xd'),_0x76d9fa,_0x16ae51[_0xed2e('0x10')][_0xed2e('0x12')]);return _0x194a3a(_0x16ae51[_0xed2e('0x10')][_0xed2e('0x12')]);}logger[_0xed2e('0x10')](_0xed2e('0xd'),_0x76d9fa,_0x16ae51['error'][_0xed2e('0x12')]);return _0x204644(_0x16ae51[_0xed2e('0x10')][_0xed2e('0x12')]);}else{logger['info'](_0xed2e('0xd'),_0x76d9fa,_0xed2e('0x13'));_0x204644(_0x16ae51[_0xed2e('0x14')][_0xed2e('0x12')]);}})[_0xed2e('0x15')](function(_0x5ba9d7){logger[_0xed2e('0x10')](_0xed2e('0xd'),_0x76d9fa,_0x5ba9d7);_0x194a3a(_0x5ba9d7);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 1e2e235..5eb6791 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 _0xbce8=['../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x55837b,_0x16fba6){var _0x5ca193=function(_0x208c4a){while(--_0x208c4a){_0x55837b['push'](_0x55837b['shift']());}};_0x5ca193(++_0x16fba6);}(_0xbce8,0x1ee));var _0x8bce=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0xbce8[_0x2f54b6];return _0x169f21;};'use strict';var multer=require(_0x8bce('0x0'));var util=require(_0x8bce('0x1'));var path=require(_0x8bce('0x2'));var timeout=require('connect-timeout');var express=require(_0x8bce('0x3'));var router=express[_0x8bce('0x4')]();var auth=require(_0x8bce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8bce('0x6'));var controller=require(_0x8bce('0x7'));router[_0x8bce('0x8')]('/',auth['isAuthenticated'](),controller[_0x8bce('0x9')]);router[_0x8bce('0x8')](_0x8bce('0xa'),auth[_0x8bce('0xb')](),controller[_0x8bce('0xc')]);router[_0x8bce('0x8')](_0x8bce('0xd'),auth[_0x8bce('0xb')](),controller[_0x8bce('0xe')]);router[_0x8bce('0xf')]('/',auth[_0x8bce('0xb')](),controller[_0x8bce('0x10')]);router[_0x8bce('0x11')](_0x8bce('0xd'),auth[_0x8bce('0xb')](),controller['update']);router['delete'](_0x8bce('0xd'),auth[_0x8bce('0xb')](),controller[_0x8bce('0x12')]);module[_0x8bce('0x13')]=router; \ No newline at end of file +var _0xcd00=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','isAuthenticated','post','create','/:id','update','destroy'];(function(_0x53822c,_0x47c7a3){var _0x2a6a98=function(_0x956635){while(--_0x956635){_0x53822c['push'](_0x53822c['shift']());}};_0x2a6a98(++_0x47c7a3);}(_0xcd00,0xbf));var _0x0cd0=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xcd00[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0x0cd0('0x0'));var util=require(_0x0cd0('0x1'));var path=require(_0x0cd0('0x2'));var timeout=require(_0x0cd0('0x3'));var express=require(_0x0cd0('0x4'));var router=express[_0x0cd0('0x5')]();var auth=require(_0x0cd0('0x6'));var interaction=require(_0x0cd0('0x7'));var config=require(_0x0cd0('0x8'));var controller=require('./userProfileSection.controller');router[_0x0cd0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0cd0('0xa'),auth['isAuthenticated'](),controller[_0x0cd0('0xb')]);router[_0x0cd0('0x9')]('/:id',auth[_0x0cd0('0xc')](),controller['show']);router[_0x0cd0('0xd')]('/',auth['isAuthenticated'](),controller[_0x0cd0('0xe')]);router['put'](_0x0cd0('0xf'),auth[_0x0cd0('0xc')](),controller[_0x0cd0('0x10')]);router['delete'](_0x0cd0('0xf'),auth['isAuthenticated'](),controller[_0x0cd0('0x11')]);module[_0x0cd0('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d13494e..8eb142e 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 _0xc5b1=['split','sequelize','exports','STRING','BOOLEAN','setDataValue','join','crudPermissions','getDataValue'];(function(_0xa73f10,_0x36740c){var _0x5ee006=function(_0x1cc8df){while(--_0x1cc8df){_0xa73f10['push'](_0xa73f10['shift']());}};_0x5ee006(++_0x36740c);}(_0xc5b1,0x106));var _0x1c5b=function(_0x22c347,_0x1c7477){_0x22c347=_0x22c347-0x0;var _0x5d2336=_0xc5b1[_0x22c347];return _0x5d2336;};'use strict';var Sequelize=require(_0x1c5b('0x0'));module[_0x1c5b('0x1')]={'name':{'type':Sequelize[_0x1c5b('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x1c5b('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x42d03a){this[_0x1c5b('0x4')]('crudPermissions',_0x42d03a?_0x42d03a[_0x1c5b('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x1c5b('0x6'))?this[_0x1c5b('0x7')](_0x1c5b('0x6'))[_0x1c5b('0x8')](''):[];}}}; \ No newline at end of file +var _0x7314=['BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x7314,0x100));var _0x4731=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7314[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4731('0x0'));module[_0x4731('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4731('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4731('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4731('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4731('0x2')],'set':function(_0x46b6c3){this[_0x4731('0x5')]('crudPermissions',_0x46b6c3?_0x46b6c3[_0x4731('0x6')](''):[]);},'get':function(){return this[_0x4731('0x7')]('crudPermissions')?this[_0x4731('0x7')](_0x4731('0x8'))[_0x4731('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 149c921..42db637 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 _0xb2f4=['filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0xaa21fc,_0x5b8f08){var _0x6f6253=function(_0x47220c){while(--_0x47220c){_0xaa21fc['push'](_0xaa21fc['shift']());}};_0x6f6253(++_0x5b8f08);}(_0xb2f4,0x14f));var _0x4b2f=function(_0x503d00,_0x323df1){_0x503d00=_0x503d00-0x0;var _0x2263d8=_0xb2f4[_0x503d00];return _0x2263d8;};'use strict';var pdf=require(_0x4b2f('0x0'));var emlformat=require(_0x4b2f('0x1'));var rimraf=require(_0x4b2f('0x2'));var zipdir=require(_0x4b2f('0x3'));var jsonpatch=require(_0x4b2f('0x4'));var rp=require(_0x4b2f('0x5'));var moment=require(_0x4b2f('0x6'));var BPromise=require(_0x4b2f('0x7'));var Mustache=require(_0x4b2f('0x8'));var util=require(_0x4b2f('0x9'));var path=require(_0x4b2f('0xa'));var sox=require(_0x4b2f('0xb'));var csv=require(_0x4b2f('0xc'));var ejs=require(_0x4b2f('0xd'));var fs=require('fs');var _=require(_0x4b2f('0xe'));var squel=require('squel');var crypto=require(_0x4b2f('0xf'));var jsforce=require(_0x4b2f('0x10'));var deskjs=require(_0x4b2f('0x11'));var toCsv=require(_0x4b2f('0xc'));var querystring=require(_0x4b2f('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b2f('0x13'));var as=require(_0x4b2f('0x14'));var hardwareService=require(_0x4b2f('0x15'));var logger=require(_0x4b2f('0x16'))(_0x4b2f('0x17'));var utils=require(_0x4b2f('0x18'));var config=require(_0x4b2f('0x19'));var db=require(_0x4b2f('0x1a'))['db'];function respondWithStatusCode(_0x5765eb,_0x5612d7){_0x5612d7=_0x5612d7||0xcc;return function(_0x5f050c){if(_0x5f050c){return _0x5765eb[_0x4b2f('0x1b')](_0x5612d7);}return _0x5765eb['status'](_0x5612d7)[_0x4b2f('0x1c')]();};}function respondWithResult(_0x1bd547,_0x39a542){_0x39a542=_0x39a542||0xc8;return function(_0x3ead98){if(_0x3ead98){return _0x1bd547[_0x4b2f('0x1d')](_0x39a542)['json'](_0x3ead98);}};}function respondWithFilteredResult(_0x9a0788,_0x24cfd0){return function(_0x58c05e){if(_0x58c05e){var _0x138131=_0x58c05e[_0x4b2f('0x1e')],_0x551a8b=_0x24cfd0['offset'],_0xf18a48=_0x24cfd0[_0x4b2f('0x1f')]+_0x24cfd0[_0x4b2f('0x20')],_0x547b7d;if(_0xf18a48>=_0x138131){_0xf18a48=_0x138131;_0x547b7d=0xc8;}else{_0x547b7d=0xce;}_0x9a0788[_0x4b2f('0x1d')](_0x547b7d);return _0x9a0788[_0x4b2f('0x21')](_0x4b2f('0x22'),_0x551a8b+'-'+_0xf18a48+'/'+_0x138131)[_0x4b2f('0x23')](_0x58c05e);}return null;};}function patchUpdates(_0x54a692){return function(_0x2e9981){try{jsonpatch[_0x4b2f('0x24')](_0x2e9981,_0x54a692,!![]);}catch(_0x453052){return BPromise[_0x4b2f('0x25')](_0x453052);}return _0x2e9981[_0x4b2f('0x26')]();};}function saveUpdates(_0x35c91d,_0x4b158e){return function(_0x11b6c5){if(_0x11b6c5){return _0x11b6c5[_0x4b2f('0x27')](_0x35c91d)[_0x4b2f('0x28')](function(_0x3ffcd4){return _0x3ffcd4;});}return null;};}function removeEntity(_0x170661,_0x5e172f){return function(_0x13c42f){if(_0x13c42f){return _0x13c42f[_0x4b2f('0x29')]()[_0x4b2f('0x28')](function(){_0x170661['status'](0xcc)[_0x4b2f('0x1c')]();});}};}function handleEntityNotFound(_0x1a3b0e,_0x188465){return function(_0x18b9a4){if(!_0x18b9a4){_0x1a3b0e[_0x4b2f('0x1b')](0x194);}return _0x18b9a4;};}function handleError(_0x4d7ce5,_0x31250d){_0x31250d=_0x31250d||0x1f4;return function(_0x48ae92){logger[_0x4b2f('0x2a')](_0x48ae92[_0x4b2f('0x2b')]);if(_0x48ae92[_0x4b2f('0x2c')]){delete _0x48ae92[_0x4b2f('0x2c')];}_0x4d7ce5['status'](_0x31250d)[_0x4b2f('0x2d')](_0x48ae92);};}exports[_0x4b2f('0x2e')]=function(_0x378d83,_0x3da5ea){var _0x329150={},_0xa31ba5={},_0x10039e={'count':0x0,'rows':[]};var _0x40228=_[_0x4b2f('0x2f')](db[_0x4b2f('0x30')]['rawAttributes'],function(_0x96bc2e){return{'name':_0x96bc2e[_0x4b2f('0x31')],'type':_0x96bc2e[_0x4b2f('0x32')][_0x4b2f('0x33')]};});_0xa31ba5[_0x4b2f('0x34')]=_[_0x4b2f('0x2f')](_0x40228,_0x4b2f('0x2c'));_0xa31ba5[_0x4b2f('0x35')]=_[_0x4b2f('0x36')](_0x378d83[_0x4b2f('0x35')]);_0xa31ba5[_0x4b2f('0x37')]=_[_0x4b2f('0x38')](_0xa31ba5['model'],_0xa31ba5['query']);_0x329150[_0x4b2f('0x39')]=_[_0x4b2f('0x38')](_0xa31ba5['model'],qs[_0x4b2f('0x3a')](_0x378d83[_0x4b2f('0x35')][_0x4b2f('0x3a')]));_0x329150[_0x4b2f('0x39')]=_0x329150['attributes'][_0x4b2f('0x3b')]?_0x329150[_0x4b2f('0x39')]:_0xa31ba5['model'];if(!_0x378d83[_0x4b2f('0x35')][_0x4b2f('0x3c')]('nolimit')){_0x329150['limit']=qs[_0x4b2f('0x20')](_0x378d83[_0x4b2f('0x35')][_0x4b2f('0x20')]);_0x329150[_0x4b2f('0x1f')]=qs['offset'](_0x378d83['query'][_0x4b2f('0x1f')]);}_0x329150[_0x4b2f('0x3d')]=qs[_0x4b2f('0x3e')](_0x378d83[_0x4b2f('0x35')][_0x4b2f('0x3e')]);_0x329150[_0x4b2f('0x3f')]=qs[_0x4b2f('0x37')](_[_0x4b2f('0x40')](_0x378d83[_0x4b2f('0x35')],_0xa31ba5[_0x4b2f('0x37')]),_0x40228);if(_0x378d83[_0x4b2f('0x35')][_0x4b2f('0x41')]){_0x329150[_0x4b2f('0x3f')]=_[_0x4b2f('0x42')](_0x329150['where'],{'$or':_[_0x4b2f('0x2f')](_0x40228,function(_0x13fcf7){if(_0x13fcf7[_0x4b2f('0x32')]!==_0x4b2f('0x43')){var _0x3b1a61={};_0x3b1a61[_0x13fcf7[_0x4b2f('0x2c')]]={'$like':'%'+_0x378d83['query']['filter']+'%'};return _0x3b1a61;}})});}_0x329150=_['merge']({},_0x329150,_0x378d83[_0x4b2f('0x44')]);var _0x1975eb={'where':_0x329150[_0x4b2f('0x3f')]};return db[_0x4b2f('0x30')][_0x4b2f('0x1e')](_0x1975eb)[_0x4b2f('0x28')](function(_0x219330){_0x10039e[_0x4b2f('0x1e')]=_0x219330;if(_0x378d83[_0x4b2f('0x35')]['includeAll']){_0x329150[_0x4b2f('0x45')]=[{'all':!![]}];}return db[_0x4b2f('0x30')][_0x4b2f('0x46')](_0x329150);})[_0x4b2f('0x28')](function(_0x514c98){_0x10039e[_0x4b2f('0x47')]=_0x514c98;return _0x10039e;})[_0x4b2f('0x28')](respondWithFilteredResult(_0x3da5ea,_0x329150))['catch'](handleError(_0x3da5ea,null));};exports['show']=function(_0x5905aa,_0x4af64f){var _0x235aa3={'raw':![],'where':{'id':_0x5905aa[_0x4b2f('0x48')]['id']}},_0x80ad0b={};_0x80ad0b['model']=_['keys'](db[_0x4b2f('0x30')][_0x4b2f('0x49')]);_0x80ad0b[_0x4b2f('0x35')]=_[_0x4b2f('0x36')](_0x5905aa[_0x4b2f('0x35')]);_0x80ad0b['filters']=_[_0x4b2f('0x38')](_0x80ad0b[_0x4b2f('0x34')],_0x80ad0b['query']);_0x235aa3['attributes']=_[_0x4b2f('0x38')](_0x80ad0b['model'],qs[_0x4b2f('0x3a')](_0x5905aa['query'][_0x4b2f('0x3a')]));_0x235aa3[_0x4b2f('0x39')]=_0x235aa3['attributes'][_0x4b2f('0x3b')]?_0x235aa3[_0x4b2f('0x39')]:_0x80ad0b['model'];if(_0x5905aa['query'][_0x4b2f('0x4a')]){_0x235aa3['include']=[{'all':!![]}];}_0x235aa3=_[_0x4b2f('0x42')]({},_0x235aa3,_0x5905aa[_0x4b2f('0x44')]);return db['UserProfileSection'][_0x4b2f('0x4b')](_0x235aa3)[_0x4b2f('0x28')](handleEntityNotFound(_0x4af64f,null))['then'](respondWithResult(_0x4af64f,null))[_0x4b2f('0x4c')](handleError(_0x4af64f,null));};exports[_0x4b2f('0x4d')]=function(_0x8f7dcf,_0x4bea16){return db[_0x4b2f('0x30')]['create'](_0x8f7dcf[_0x4b2f('0x4e')],{})[_0x4b2f('0x28')](respondWithResult(_0x4bea16,0xc9))['catch'](handleError(_0x4bea16,null));};exports[_0x4b2f('0x27')]=function(_0x392eba,_0x2abf07){if(_0x392eba[_0x4b2f('0x4e')]['id']){delete _0x392eba[_0x4b2f('0x4e')]['id'];}return db['UserProfileSection'][_0x4b2f('0x4b')]({'where':{'id':_0x392eba[_0x4b2f('0x48')]['id']}})[_0x4b2f('0x28')](handleEntityNotFound(_0x2abf07,null))[_0x4b2f('0x28')](saveUpdates(_0x392eba[_0x4b2f('0x4e')],null))['then'](respondWithResult(_0x2abf07,null))['catch'](handleError(_0x2abf07,null));};exports[_0x4b2f('0x29')]=function(_0x402bde,_0x253396){return db[_0x4b2f('0x30')]['find']({'where':{'id':_0x402bde[_0x4b2f('0x48')]['id']}})[_0x4b2f('0x28')](handleEntityNotFound(_0x253396,null))[_0x4b2f('0x28')](removeEntity(_0x253396,null))[_0x4b2f('0x4c')](handleError(_0x253396,null));};exports[_0x4b2f('0x4f')]=function(_0x5bac5e,_0x1a21db){return db[_0x4b2f('0x30')][_0x4b2f('0x4f')]()[_0x4b2f('0x28')](respondWithResult(_0x1a21db,null))[_0x4b2f('0x4c')](handleError(_0x1a21db,null));}; \ No newline at end of file +var _0xac4a=['type','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','rawAttributes','catch','create','body','find','destroy','params','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','status','json','count','offset','limit','Content-Range','save','update','end','error','name','send','index','UserProfileSection','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xac4a,0xa0));var _0xaac4=function(_0x46753e,_0x176e02){_0x46753e=_0x46753e-0x0;var _0x4981e4=_0xac4a[_0x46753e];return _0x4981e4;};'use strict';var pdf=require(_0xaac4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaac4('0x1'));var jsonpatch=require(_0xaac4('0x2'));var rp=require(_0xaac4('0x3'));var moment=require('moment');var BPromise=require(_0xaac4('0x4'));var Mustache=require('mustache');var util=require(_0xaac4('0x5'));var path=require(_0xaac4('0x6'));var sox=require(_0xaac4('0x7'));var csv=require(_0xaac4('0x8'));var ejs=require(_0xaac4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaac4('0xa'));var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require(_0xaac4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaac4('0xe'));var Papa=require(_0xaac4('0xf'));var Redis=require(_0xaac4('0x10'));var authService=require(_0xaac4('0x11'));var qs=require(_0xaac4('0x12'));var as=require(_0xaac4('0x13'));var hardwareService=require(_0xaac4('0x14'));var logger=require(_0xaac4('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21170e,_0x409e3b){_0x409e3b=_0x409e3b||0xcc;return function(_0x1209ce){if(_0x1209ce){return _0x21170e[_0xaac4('0x16')](_0x409e3b);}return _0x21170e[_0xaac4('0x17')](_0x409e3b)['end']();};}function respondWithResult(_0x569f29,_0xf8ba08){_0xf8ba08=_0xf8ba08||0xc8;return function(_0x1b9e9e){if(_0x1b9e9e){return _0x569f29[_0xaac4('0x17')](_0xf8ba08)[_0xaac4('0x18')](_0x1b9e9e);}};}function respondWithFilteredResult(_0x27c976,_0x38f8dc){return function(_0x1d872d){if(_0x1d872d){var _0x18b797=_0x1d872d[_0xaac4('0x19')],_0x2f662c=_0x38f8dc[_0xaac4('0x1a')],_0x17de2e=_0x38f8dc['offset']+_0x38f8dc[_0xaac4('0x1b')],_0x2be9a8;if(_0x17de2e>=_0x18b797){_0x17de2e=_0x18b797;_0x2be9a8=0xc8;}else{_0x2be9a8=0xce;}_0x27c976[_0xaac4('0x17')](_0x2be9a8);return _0x27c976['set'](_0xaac4('0x1c'),_0x2f662c+'-'+_0x17de2e+'/'+_0x18b797)[_0xaac4('0x18')](_0x1d872d);}return null;};}function patchUpdates(_0x5d8dc5){return function(_0x4d7097){try{jsonpatch['apply'](_0x4d7097,_0x5d8dc5,!![]);}catch(_0x1d78d3){return BPromise['reject'](_0x1d78d3);}return _0x4d7097[_0xaac4('0x1d')]();};}function saveUpdates(_0x8b5c0b,_0x267e9e){return function(_0x3bf2de){if(_0x3bf2de){return _0x3bf2de[_0xaac4('0x1e')](_0x8b5c0b)['then'](function(_0x408181){return _0x408181;});}return null;};}function removeEntity(_0x3c2508,_0x44f6ee){return function(_0x316bd2){if(_0x316bd2){return _0x316bd2['destroy']()['then'](function(){_0x3c2508[_0xaac4('0x17')](0xcc)[_0xaac4('0x1f')]();});}};}function handleEntityNotFound(_0x4eaee3,_0x447131){return function(_0x3158cd){if(!_0x3158cd){_0x4eaee3[_0xaac4('0x16')](0x194);}return _0x3158cd;};}function handleError(_0x1b681,_0x498346){_0x498346=_0x498346||0x1f4;return function(_0x44fd4d){logger[_0xaac4('0x20')](_0x44fd4d['stack']);if(_0x44fd4d[_0xaac4('0x21')]){delete _0x44fd4d[_0xaac4('0x21')];}_0x1b681[_0xaac4('0x17')](_0x498346)[_0xaac4('0x22')](_0x44fd4d);};}exports[_0xaac4('0x23')]=function(_0x379fd6,_0xbe9fc3){var _0x34dd14={},_0x58e736={},_0x22bc24={'count':0x0,'rows':[]};var _0x217452=_['map'](db[_0xaac4('0x24')]['rawAttributes'],function(_0x19f637){return{'name':_0x19f637['fieldName'],'type':_0x19f637['type'][_0xaac4('0x25')]};});_0x58e736[_0xaac4('0x26')]=_[_0xaac4('0x27')](_0x217452,'name');_0x58e736[_0xaac4('0x28')]=_[_0xaac4('0x29')](_0x379fd6[_0xaac4('0x28')]);_0x58e736[_0xaac4('0x2a')]=_['intersection'](_0x58e736['model'],_0x58e736[_0xaac4('0x28')]);_0x34dd14['attributes']=_[_0xaac4('0x2b')](_0x58e736[_0xaac4('0x26')],qs[_0xaac4('0x2c')](_0x379fd6['query'][_0xaac4('0x2c')]));_0x34dd14[_0xaac4('0x2d')]=_0x34dd14[_0xaac4('0x2d')][_0xaac4('0x2e')]?_0x34dd14[_0xaac4('0x2d')]:_0x58e736[_0xaac4('0x26')];if(!_0x379fd6[_0xaac4('0x28')]['hasOwnProperty'](_0xaac4('0x2f'))){_0x34dd14[_0xaac4('0x1b')]=qs[_0xaac4('0x1b')](_0x379fd6[_0xaac4('0x28')][_0xaac4('0x1b')]);_0x34dd14['offset']=qs[_0xaac4('0x1a')](_0x379fd6[_0xaac4('0x28')][_0xaac4('0x1a')]);}_0x34dd14[_0xaac4('0x30')]=qs[_0xaac4('0x31')](_0x379fd6[_0xaac4('0x28')][_0xaac4('0x31')]);_0x34dd14[_0xaac4('0x32')]=qs[_0xaac4('0x2a')](_[_0xaac4('0x33')](_0x379fd6['query'],_0x58e736[_0xaac4('0x2a')]),_0x217452);if(_0x379fd6['query'][_0xaac4('0x34')]){_0x34dd14['where']=_['merge'](_0x34dd14[_0xaac4('0x32')],{'$or':_[_0xaac4('0x27')](_0x217452,function(_0x39f11c){if(_0x39f11c[_0xaac4('0x35')]!==_0xaac4('0x36')){var _0x5f132d={};_0x5f132d[_0x39f11c[_0xaac4('0x21')]]={'$like':'%'+_0x379fd6[_0xaac4('0x28')][_0xaac4('0x34')]+'%'};return _0x5f132d;}})});}_0x34dd14=_[_0xaac4('0x37')]({},_0x34dd14,_0x379fd6[_0xaac4('0x38')]);var _0xffd897={'where':_0x34dd14[_0xaac4('0x32')]};return db[_0xaac4('0x24')][_0xaac4('0x19')](_0xffd897)[_0xaac4('0x39')](function(_0x3a35f4){_0x22bc24[_0xaac4('0x19')]=_0x3a35f4;if(_0x379fd6[_0xaac4('0x28')][_0xaac4('0x3a')]){_0x34dd14[_0xaac4('0x3b')]=[{'all':!![]}];}return db['UserProfileSection'][_0xaac4('0x3c')](_0x34dd14);})[_0xaac4('0x39')](function(_0x2d91a0){_0x22bc24[_0xaac4('0x3d')]=_0x2d91a0;return _0x22bc24;})[_0xaac4('0x39')](respondWithFilteredResult(_0xbe9fc3,_0x34dd14))['catch'](handleError(_0xbe9fc3,null));};exports[_0xaac4('0x3e')]=function(_0x2a50c0,_0x481ea7){var _0x573dc6={'raw':![],'where':{'id':_0x2a50c0['params']['id']}},_0xfd385d={};_0xfd385d[_0xaac4('0x26')]=_['keys'](db[_0xaac4('0x24')][_0xaac4('0x3f')]);_0xfd385d['query']=_['keys'](_0x2a50c0[_0xaac4('0x28')]);_0xfd385d[_0xaac4('0x2a')]=_['intersection'](_0xfd385d[_0xaac4('0x26')],_0xfd385d[_0xaac4('0x28')]);_0x573dc6[_0xaac4('0x2d')]=_[_0xaac4('0x2b')](_0xfd385d[_0xaac4('0x26')],qs[_0xaac4('0x2c')](_0x2a50c0[_0xaac4('0x28')]['fields']));_0x573dc6[_0xaac4('0x2d')]=_0x573dc6[_0xaac4('0x2d')][_0xaac4('0x2e')]?_0x573dc6[_0xaac4('0x2d')]:_0xfd385d[_0xaac4('0x26')];if(_0x2a50c0['query'][_0xaac4('0x3a')]){_0x573dc6[_0xaac4('0x3b')]=[{'all':!![]}];}_0x573dc6=_[_0xaac4('0x37')]({},_0x573dc6,_0x2a50c0[_0xaac4('0x38')]);return db['UserProfileSection']['find'](_0x573dc6)['then'](handleEntityNotFound(_0x481ea7,null))[_0xaac4('0x39')](respondWithResult(_0x481ea7,null))[_0xaac4('0x40')](handleError(_0x481ea7,null));};exports['create']=function(_0xea4d59,_0x49b919){return db['UserProfileSection'][_0xaac4('0x41')](_0xea4d59['body'],{})['then'](respondWithResult(_0x49b919,0xc9))[_0xaac4('0x40')](handleError(_0x49b919,null));};exports[_0xaac4('0x1e')]=function(_0x39f21b,_0x4d5ca8){if(_0x39f21b[_0xaac4('0x42')]['id']){delete _0x39f21b['body']['id'];}return db[_0xaac4('0x24')][_0xaac4('0x43')]({'where':{'id':_0x39f21b['params']['id']}})['then'](handleEntityNotFound(_0x4d5ca8,null))[_0xaac4('0x39')](saveUpdates(_0x39f21b['body'],null))[_0xaac4('0x39')](respondWithResult(_0x4d5ca8,null))[_0xaac4('0x40')](handleError(_0x4d5ca8,null));};exports[_0xaac4('0x44')]=function(_0x601ba8,_0x5bbb52){return db['UserProfileSection'][_0xaac4('0x43')]({'where':{'id':_0x601ba8[_0xaac4('0x45')]['id']}})[_0xaac4('0x39')](handleEntityNotFound(_0x5bbb52,null))[_0xaac4('0x39')](removeEntity(_0x5bbb52,null))[_0xaac4('0x40')](handleError(_0x5bbb52,null));};exports[_0xaac4('0x46')]=function(_0x23345b,_0x534b28){return db[_0xaac4('0x24')][_0xaac4('0x46')]()[_0xaac4('0x39')](respondWithResult(_0x534b28,null))[_0xaac4('0x40')](handleError(_0x534b28,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index abf5cab..f705a39 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 _0xeadc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','../../config/logger'];(function(_0x28320d,_0xc2975d){var _0x189ee3=function(_0x5b50fa){while(--_0x5b50fa){_0x28320d['push'](_0x28320d['shift']());}};_0x189ee3(++_0xc2975d);}(_0xeadc,0xdf));var _0xcead=function(_0x22d549,_0x27f742){_0x22d549=_0x22d549-0x0;var _0x4266c5=_0xeadc[_0x22d549];return _0x4266c5;};'use strict';var _=require(_0xcead('0x0'));var util=require('util');var logger=require(_0xcead('0x1'))('api');var moment=require(_0xcead('0x2'));var BPromise=require(_0xcead('0x3'));var rp=require(_0xcead('0x4'));var fs=require('fs');var path=require(_0xcead('0x5'));var rimraf=require(_0xcead('0x6'));var config=require(_0xcead('0x7'));var attributes=require(_0xcead('0x8'));module[_0xcead('0x9')]=function(_0xa3a632,_0x502229){return _0xa3a632[_0xcead('0xa')](_0xcead('0xb'),attributes,{'tableName':_0xcead('0xc'),'paranoid':![],'indexes':[{'name':_0xcead('0xd'),'fields':['sectionId',_0xcead('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf226=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x50bb18,_0x5129d0){var _0x4438b8=function(_0x1ba001){while(--_0x1ba001){_0x50bb18['push'](_0x50bb18['shift']());}};_0x4438b8(++_0x5129d0);}(_0xf226,0x141));var _0x6f22=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf226[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6f22('0x0'));var util=require(_0x6f22('0x1'));var logger=require(_0x6f22('0x2'))(_0x6f22('0x3'));var moment=require(_0x6f22('0x4'));var BPromise=require(_0x6f22('0x5'));var rp=require(_0x6f22('0x6'));var fs=require('fs');var path=require(_0x6f22('0x7'));var rimraf=require(_0x6f22('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x6f22('0x9')]=function(_0x460d11,_0x51625d){return _0x460d11['define']('UserProfileSection',attributes,{'tableName':_0x6f22('0xa'),'paranoid':![],'indexes':[{'name':_0x6f22('0xb'),'fields':[_0x6f22('0xc'),_0x6f22('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1ca3855..46dbd03 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 _0x1332=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util'];(function(_0x3dae91,_0x80df00){var _0x430ac5=function(_0x415eac){while(--_0x415eac){_0x3dae91['push'](_0x3dae91['shift']());}};_0x430ac5(++_0x80df00);}(_0x1332,0x157));var _0x2133=function(_0x59fa3b,_0x3f7920){_0x59fa3b=_0x59fa3b-0x0;var _0x495bd1=_0x1332[_0x59fa3b];return _0x495bd1;};'use strict';var _=require(_0x2133('0x0'));var util=require(_0x2133('0x1'));var moment=require(_0x2133('0x2'));var BPromise=require('bluebird');var rs=require(_0x2133('0x3'));var fs=require('fs');var Redis=require(_0x2133('0x4'));var db=require(_0x2133('0x5'))['db'];var utils=require(_0x2133('0x6'));var logger=require(_0x2133('0x7'))(_0x2133('0x8'));var config=require('../../config/environment');var jayson=require(_0x2133('0x9'));var client=jayson[_0x2133('0xa')][_0x2133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x73a4dd,_0x2d6743,_0xad86b9){return new BPromise(function(_0x26cc25,_0x520fe2){return client[_0x2133('0xc')](_0x73a4dd,_0xad86b9)[_0x2133('0xd')](function(_0x4d3645){logger[_0x2133('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2d6743,'request\x20sent');logger['debug'](_0x2133('0xf'),_0x2d6743,'request\x20sent',JSON[_0x2133('0x10')](_0x4d3645));if(_0x4d3645[_0x2133('0x11')]){if(_0x4d3645[_0x2133('0x11')]['code']===0x1f4){logger['error'](_0x2133('0x12'),_0x2d6743,_0x4d3645['error'][_0x2133('0x13')]);return _0x520fe2(_0x4d3645[_0x2133('0x11')][_0x2133('0x13')]);}logger[_0x2133('0x11')](_0x2133('0x12'),_0x2d6743,_0x4d3645[_0x2133('0x11')]['message']);return _0x26cc25(_0x4d3645[_0x2133('0x11')][_0x2133('0x13')]);}else{logger['info'](_0x2133('0x12'),_0x2d6743,_0x2133('0x14'));_0x26cc25(_0x4d3645[_0x2133('0x15')][_0x2133('0x13')]);}})[_0x2133('0x16')](function(_0x1efdf9){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2d6743,_0x1efdf9);_0x520fe2(_0x1efdf9);});});} \ No newline at end of file +var _0x08b4=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','error'];(function(_0xa2dcab,_0x2369c0){var _0x4551b3=function(_0x51bb9d){while(--_0x51bb9d){_0xa2dcab['push'](_0xa2dcab['shift']());}};_0x4551b3(++_0x2369c0);}(_0x08b4,0x67));var _0x408b=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x08b4[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x408b('0x0'));var util=require(_0x408b('0x1'));var moment=require(_0x408b('0x2'));var BPromise=require(_0x408b('0x3'));var rs=require(_0x408b('0x4'));var fs=require('fs');var Redis=require(_0x408b('0x5'));var db=require(_0x408b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x408b('0x7'));var config=require(_0x408b('0x8'));var jayson=require(_0x408b('0x9'));var client=jayson['client'][_0x408b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xec8c99,_0x1a2564,_0x9a98bc){return new BPromise(function(_0x341ce3,_0x254c04){return client[_0x408b('0xb')](_0xec8c99,_0x9a98bc)[_0x408b('0xc')](function(_0x58c68b){logger[_0x408b('0xd')](_0x408b('0xe'),_0x1a2564,'request\x20sent');logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1a2564,_0x408b('0xf'),JSON['stringify'](_0x58c68b));if(_0x58c68b[_0x408b('0x10')]){if(_0x58c68b[_0x408b('0x10')][_0x408b('0x11')]===0x1f4){logger[_0x408b('0x10')](_0x408b('0xe'),_0x1a2564,_0x58c68b['error'][_0x408b('0x12')]);return _0x254c04(_0x58c68b['error'][_0x408b('0x12')]);}logger[_0x408b('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x1a2564,_0x58c68b[_0x408b('0x10')]['message']);return _0x341ce3(_0x58c68b[_0x408b('0x10')][_0x408b('0x12')]);}else{logger[_0x408b('0xd')](_0x408b('0xe'),_0x1a2564,_0x408b('0xf'));_0x341ce3(_0x58c68b['result'][_0x408b('0x12')]);}})[_0x408b('0x13')](function(_0x4b0a1c){logger[_0x408b('0x10')](_0x408b('0xe'),_0x1a2564,_0x4b0a1c);_0x254c04(_0x4b0a1c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 198e7f8..7929029 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 _0x6e3c=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x362a9c,_0x434fd5){var _0x159079=function(_0x4e5a3c){while(--_0x4e5a3c){_0x362a9c['push'](_0x362a9c['shift']());}};_0x159079(++_0x434fd5);}(_0x6e3c,0xe7));var _0xc6e3=function(_0x10bf5d,_0x10a3a9){_0x10bf5d=_0x10bf5d-0x0;var _0x27f511=_0x6e3c[_0x10bf5d];return _0x27f511;};'use strict';var multer=require(_0xc6e3('0x0'));var util=require(_0xc6e3('0x1'));var path=require(_0xc6e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6e3('0x3'));var router=express[_0xc6e3('0x4')]();var auth=require(_0xc6e3('0x5'));var interaction=require(_0xc6e3('0x6'));var config=require(_0xc6e3('0x7'));module['exports']=router; \ No newline at end of file +var _0xbfcf=['../../components/auth/service','exports','multer','util','path','express'];(function(_0x50ac43,_0x3d4770){var _0x56c722=function(_0x3c5e0f){while(--_0x3c5e0f){_0x50ac43['push'](_0x50ac43['shift']());}};_0x56c722(++_0x3d4770);}(_0xbfcf,0x6e));var _0xfbfc=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xbfcf[_0x595013];return _0x2a29e3;};'use strict';var multer=require(_0xfbfc('0x0'));var util=require(_0xfbfc('0x1'));var path=require(_0xfbfc('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbfc('0x3'));var router=express['Router']();var auth=require(_0xfbfc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xfbfc('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 642a50f..70d1760 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 _0xd8b0=['exports','sequelize'];(function(_0x140e7f,_0x5f50a7){var _0x39656b=function(_0xd5f5d7){while(--_0xd5f5d7){_0x140e7f['push'](_0x140e7f['shift']());}};_0x39656b(++_0x5f50a7);}(_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 _0xbaf0=['exports','INTEGER'];(function(_0x3b7fb0,_0x553e21){var _0x3b7fc5=function(_0x286bdc){while(--_0x286bdc){_0x3b7fb0['push'](_0x3b7fb0['shift']());}};_0x3b7fc5(++_0x553e21);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 55def31..c882e07 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 _0x1b39=['../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1894e6,_0x11b6da){var _0x425c32=function(_0x920fce){while(--_0x920fce){_0x1894e6['push'](_0x1894e6['shift']());}};_0x425c32(++_0x11b6da);}(_0x1b39,0x116));var _0x91b3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1b39[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x91b3('0x0'));var util=require(_0x91b3('0x1'));var logger=require(_0x91b3('0x2'))('api');var moment=require(_0x91b3('0x3'));var BPromise=require(_0x91b3('0x4'));var rp=require(_0x91b3('0x5'));var fs=require('fs');var path=require(_0x91b3('0x6'));var rimraf=require(_0x91b3('0x7'));var config=require(_0x91b3('0x8'));var attributes=require(_0x91b3('0x9'));module['exports']=function(_0x6485c8,_0x26ad02){return _0x6485c8[_0x91b3('0xa')](_0x91b3('0xb'),attributes,{'tableName':_0x91b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c9a=['rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4d282c,_0x696b98){var _0x874f70=function(_0x343703){while(--_0x343703){_0x4d282c['push'](_0x4d282c['shift']());}};_0x874f70(++_0x696b98);}(_0x6c9a,0xa1));var _0xa6c9=function(_0x3bb528,_0x49f65d){_0x3bb528=_0x3bb528-0x0;var _0x3ba8ac=_0x6c9a[_0x3bb528];return _0x3ba8ac;};'use strict';var _=require('lodash');var util=require(_0xa6c9('0x0'));var logger=require(_0xa6c9('0x1'))(_0xa6c9('0x2'));var moment=require(_0xa6c9('0x3'));var BPromise=require(_0xa6c9('0x4'));var rp=require(_0xa6c9('0x5'));var fs=require('fs');var path=require(_0xa6c9('0x6'));var rimraf=require(_0xa6c9('0x7'));var config=require(_0xa6c9('0x8'));var attributes=require(_0xa6c9('0x9'));module[_0xa6c9('0xa')]=function(_0x3b861d,_0x191726){return _0x3b861d[_0xa6c9('0xb')]('UserSmsQueue',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 c9b377c..89a6fe8 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 _0x3abc=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1d4233,_0xceb176){var _0x56c776=function(_0x4dc15f){while(--_0x4dc15f){_0x1d4233['push'](_0x1d4233['shift']());}};_0x56c776(++_0xceb176);}(_0x3abc,0x1df));var _0xc3ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3abc[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xc3ab('0x0'));var util=require(_0xc3ab('0x1'));var moment=require(_0xc3ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3ab('0x3'));var fs=require('fs');var Redis=require(_0xc3ab('0x4'));var db=require(_0xc3ab('0x5'))['db'];var utils=require(_0xc3ab('0x6'));var logger=require(_0xc3ab('0x7'))('rpc');var config=require(_0xc3ab('0x8'));var jayson=require(_0xc3ab('0x9'));var client=jayson[_0xc3ab('0xa')][_0xc3ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x541219,_0x1d6efd,_0x841d20){return new BPromise(function(_0x4e6b97,_0x55b4ad){return client[_0xc3ab('0xc')](_0x541219,_0x841d20)[_0xc3ab('0xd')](function(_0x33a2b8){logger[_0xc3ab('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x1d6efd,'request\x20sent');logger[_0xc3ab('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x1d6efd,_0xc3ab('0x10'),JSON[_0xc3ab('0x11')](_0x33a2b8));if(_0x33a2b8[_0xc3ab('0x12')]){if(_0x33a2b8[_0xc3ab('0x12')][_0xc3ab('0x13')]===0x1f4){logger[_0xc3ab('0x12')](_0xc3ab('0x14'),_0x1d6efd,_0x33a2b8[_0xc3ab('0x12')][_0xc3ab('0x15')]);return _0x55b4ad(_0x33a2b8[_0xc3ab('0x12')][_0xc3ab('0x15')]);}logger[_0xc3ab('0x12')](_0xc3ab('0x14'),_0x1d6efd,_0x33a2b8[_0xc3ab('0x12')][_0xc3ab('0x15')]);return _0x4e6b97(_0x33a2b8['error'][_0xc3ab('0x15')]);}else{logger['info'](_0xc3ab('0x14'),_0x1d6efd,_0xc3ab('0x10'));_0x4e6b97(_0x33a2b8[_0xc3ab('0x16')][_0xc3ab('0x15')]);}})[_0xc3ab('0x17')](function(_0x2added){logger[_0xc3ab('0x12')](_0xc3ab('0x14'),_0x1d6efd,_0x2added);_0x55b4ad(_0x2added);});});} \ No newline at end of file +var _0x137d=['code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2c0035,_0x1b0094){var _0x285c53=function(_0x36df6a){while(--_0x36df6a){_0x2c0035['push'](_0x2c0035['shift']());}};_0x285c53(++_0x1b0094);}(_0x137d,0x1d1));var _0xd137=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x137d[_0x2053ea];return _0x2232c4;};'use strict';var _=require(_0xd137('0x0'));var util=require(_0xd137('0x1'));var moment=require(_0xd137('0x2'));var BPromise=require(_0xd137('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd137('0x4'));var db=require(_0xd137('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd137('0x6'));var config=require(_0xd137('0x7'));var jayson=require(_0xd137('0x8'));var client=jayson[_0xd137('0x9')][_0xd137('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d798d,_0x5f5a4e,_0x20c293){return new BPromise(function(_0x31d06c,_0x2dcadc){return client[_0xd137('0xb')](_0x1d798d,_0x20c293)[_0xd137('0xc')](function(_0x284a07){logger[_0xd137('0xd')](_0xd137('0xe'),_0x5f5a4e,'request\x20sent');logger['debug'](_0xd137('0xf'),_0x5f5a4e,_0xd137('0x10'),JSON[_0xd137('0x11')](_0x284a07));if(_0x284a07['error']){if(_0x284a07['error'][_0xd137('0x12')]===0x1f4){logger['error'](_0xd137('0xe'),_0x5f5a4e,_0x284a07['error']['message']);return _0x2dcadc(_0x284a07[_0xd137('0x13')]['message']);}logger['error'](_0xd137('0xe'),_0x5f5a4e,_0x284a07[_0xd137('0x13')][_0xd137('0x14')]);return _0x31d06c(_0x284a07[_0xd137('0x13')]['message']);}else{logger[_0xd137('0xd')](_0xd137('0xe'),_0x5f5a4e,_0xd137('0x10'));_0x31d06c(_0x284a07[_0xd137('0x15')][_0xd137('0x14')]);}})[_0xd137('0x16')](function(_0x17413d){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x5f5a4e,_0x17413d);_0x2dcadc(_0x17413d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index a9c309c..dd7c802 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 _0xb0bf=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','multer'];(function(_0x2cff95,_0x590734){var _0x30b01b=function(_0x349e6f){while(--_0x349e6f){_0x2cff95['push'](_0x2cff95['shift']());}};_0x30b01b(++_0x590734);}(_0xb0bf,0x125));var _0xfb0b=function(_0x545312,_0x563053){_0x545312=_0x545312-0x0;var _0x52bc56=_0xb0bf[_0x545312];return _0x52bc56;};'use strict';var multer=require(_0xfb0b('0x0'));var util=require('util');var path=require(_0xfb0b('0x1'));var timeout=require(_0xfb0b('0x2'));var express=require(_0xfb0b('0x3'));var router=express[_0xfb0b('0x4')]();var auth=require(_0xfb0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfb0b('0x6'));module['exports']=router; \ No newline at end of file +var _0xdec6=['../../config/environment','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x11405c,_0x1dd503){var _0x90ca92=function(_0x70d5c1){while(--_0x70d5c1){_0x11405c['push'](_0x11405c['shift']());}};_0x90ca92(++_0x1dd503);}(_0xdec6,0x95));var _0x6dec=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xdec6[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x6dec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6dec('0x1'));var express=require('express');var router=express[_0x6dec('0x2')]();var auth=require(_0x6dec('0x3'));var interaction=require(_0x6dec('0x4'));var config=require(_0x6dec('0x5'));module[_0x6dec('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 acc97c7..9600f2a 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x16816a,_0x4ef7c7){var _0x25780f=function(_0x4cc9ee){while(--_0x4cc9ee){_0x16816a['push'](_0x16816a['shift']());}};_0x25780f(++_0x4ef7c7);}(_0xe706,0xa3));var _0x6e70=function(_0x643b2,_0x14e495){_0x643b2=_0x643b2-0x0;var _0x2e5346=_0xe706[_0x643b2];return _0x2e5346;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x270477,_0x42578c){var _0x9c760b=function(_0x33402d){while(--_0x33402d){_0x270477['push'](_0x270477['shift']());}};_0x9c760b(++_0x42578c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index b4e76c5..0b08b4e 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 _0x008c=['define','user_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x008c,0x188));var _0xc008=function(_0x2df13f,_0x3a3921){_0x2df13f=_0x2df13f-0x0;var _0x5c8a3f=_0x008c[_0x2df13f];return _0x5c8a3f;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('UserVoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72b1=['./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xb0105,_0x550ac6){var _0x1cff67=function(_0x1ebd38){while(--_0x1ebd38){_0xb0105['push'](_0xb0105['shift']());}};_0x1cff67(++_0x550ac6);}(_0x72b1,0x16e));var _0x172b=function(_0x4a69ad,_0x4754ca){_0x4a69ad=_0x4a69ad-0x0;var _0x2712ea=_0x72b1[_0x4a69ad];return _0x2712ea;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var logger=require(_0x172b('0x1'))(_0x172b('0x2'));var moment=require(_0x172b('0x3'));var BPromise=require(_0x172b('0x4'));var rp=require(_0x172b('0x5'));var fs=require('fs');var path=require(_0x172b('0x6'));var rimraf=require(_0x172b('0x7'));var config=require('../../config/environment');var attributes=require(_0x172b('0x8'));module[_0x172b('0x9')]=function(_0x475fd6,_0x222624){return _0x475fd6['define'](_0x172b('0xa'),attributes,{'tableName':'user_has_voice_queues','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 0f2a884..04ece1a 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 _0x8f3a=['result','catch','UserVoiceQueue,\x20%s,\x20%s','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x40aeed,_0x2e90d3){var _0x35304e=function(_0x3ce508){while(--_0x3ce508){_0x40aeed['push'](_0x40aeed['shift']());}};_0x35304e(++_0x2e90d3);}(_0x8f3a,0xdf));var _0xa8f3=function(_0x5a99af,_0x54c437){_0x5a99af=_0x5a99af-0x0;var _0xb42267=_0x8f3a[_0x5a99af];return _0xb42267;};'use strict';var _=require('lodash');var util=require(_0xa8f3('0x0'));var moment=require(_0xa8f3('0x1'));var BPromise=require(_0xa8f3('0x2'));var rs=require(_0xa8f3('0x3'));var fs=require('fs');var Redis=require(_0xa8f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8f3('0x5'));var logger=require(_0xa8f3('0x6'))(_0xa8f3('0x7'));var config=require('../../config/environment');var jayson=require(_0xa8f3('0x8'));var client=jayson[_0xa8f3('0x9')][_0xa8f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x558655,_0x5bd9b3,_0x26e3bd){return new BPromise(function(_0x3a2b85,_0x16a404){return client[_0xa8f3('0xb')](_0x558655,_0x26e3bd)['then'](function(_0x4a6783){logger[_0xa8f3('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x5bd9b3,_0xa8f3('0xd'));logger['debug'](_0xa8f3('0xe'),_0x5bd9b3,_0xa8f3('0xd'),JSON[_0xa8f3('0xf')](_0x4a6783));if(_0x4a6783['error']){if(_0x4a6783['error'][_0xa8f3('0x10')]===0x1f4){logger[_0xa8f3('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5bd9b3,_0x4a6783[_0xa8f3('0x11')]['message']);return _0x16a404(_0x4a6783[_0xa8f3('0x11')][_0xa8f3('0x12')]);}logger[_0xa8f3('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x5bd9b3,_0x4a6783[_0xa8f3('0x11')][_0xa8f3('0x12')]);return _0x3a2b85(_0x4a6783[_0xa8f3('0x11')][_0xa8f3('0x12')]);}else{logger[_0xa8f3('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x5bd9b3,_0xa8f3('0xd'));_0x3a2b85(_0x4a6783[_0xa8f3('0x13')][_0xa8f3('0x12')]);}})[_0xa8f3('0x14')](function(_0x2c5e10){logger[_0xa8f3('0x11')](_0xa8f3('0x15'),_0x5bd9b3,_0x2c5e10);_0x16a404(_0x2c5e10);});});} \ No newline at end of file +var _0x9ab3=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x9ab3,0x8d));var _0x39ab=function(_0x56da28,_0x1522ea){_0x56da28=_0x56da28-0x0;var _0x3c11fb=_0x9ab3[_0x56da28];return _0x3c11fb;};'use strict';var _=require(_0x39ab('0x0'));var util=require(_0x39ab('0x1'));var moment=require(_0x39ab('0x2'));var BPromise=require(_0x39ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39ab('0x4'));var db=require(_0x39ab('0x5'))['db'];var utils=require(_0x39ab('0x6'));var logger=require(_0x39ab('0x7'))(_0x39ab('0x8'));var config=require(_0x39ab('0x9'));var jayson=require(_0x39ab('0xa'));var client=jayson[_0x39ab('0xb')][_0x39ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x109dd4,_0x280f42,_0x4b6be3){return new BPromise(function(_0x3d003b,_0x36b3ab){return client[_0x39ab('0xd')](_0x109dd4,_0x4b6be3)[_0x39ab('0xe')](function(_0x4be578){logger[_0x39ab('0xf')](_0x39ab('0x10'),_0x280f42,_0x39ab('0x11'));logger[_0x39ab('0x12')](_0x39ab('0x13'),_0x280f42,_0x39ab('0x11'),JSON[_0x39ab('0x14')](_0x4be578));if(_0x4be578[_0x39ab('0x15')]){if(_0x4be578['error']['code']===0x1f4){logger[_0x39ab('0x15')](_0x39ab('0x10'),_0x280f42,_0x4be578[_0x39ab('0x15')][_0x39ab('0x16')]);return _0x36b3ab(_0x4be578[_0x39ab('0x15')][_0x39ab('0x16')]);}logger[_0x39ab('0x15')](_0x39ab('0x10'),_0x280f42,_0x4be578[_0x39ab('0x15')]['message']);return _0x3d003b(_0x4be578[_0x39ab('0x15')][_0x39ab('0x16')]);}else{logger[_0x39ab('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x280f42,'request\x20sent');_0x3d003b(_0x4be578[_0x39ab('0x17')][_0x39ab('0x16')]);}})['catch'](function(_0x3decaa){logger[_0x39ab('0x15')](_0x39ab('0x10'),_0x280f42,_0x3decaa);_0x36b3ab(_0x3decaa);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a11a734..a4044cc 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 _0x4ad5=['multer','util','path','../../components/interaction/service','../../config/environment','exports'];(function(_0x36dd33,_0x24bc83){var _0x573813=function(_0x3082c3){while(--_0x3082c3){_0x36dd33['push'](_0x36dd33['shift']());}};_0x573813(++_0x24bc83);}(_0x4ad5,0x174));var _0x54ad=function(_0x411fed,_0x13c84a){_0x411fed=_0x411fed-0x0;var _0x1941c5=_0x4ad5[_0x411fed];return _0x1941c5;};'use strict';var multer=require(_0x54ad('0x0'));var util=require(_0x54ad('0x1'));var path=require(_0x54ad('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x54ad('0x3'));var config=require(_0x54ad('0x4'));module[_0x54ad('0x5')]=router; \ No newline at end of file +var _0x6036=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6036,0x1c8));var _0x6603=function(_0x21e995,_0x4fef83){_0x21e995=_0x21e995-0x0;var _0x535ae8=_0x6036[_0x21e995];return _0x535ae8;};'use strict';var multer=require(_0x6603('0x0'));var util=require(_0x6603('0x1'));var path=require(_0x6603('0x2'));var timeout=require(_0x6603('0x3'));var express=require(_0x6603('0x4'));var router=express[_0x6603('0x5')]();var auth=require(_0x6603('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6603('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index bc59463..6dbc183 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 _0x548a=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x49dda7,_0x401bf2){var _0xac94f6=function(_0x34140e){while(--_0x34140e){_0x49dda7['push'](_0x49dda7['shift']());}};_0xac94f6(++_0x401bf2);}(_0x548a,0x1a1));var _0xa548=function(_0x4e5774,_0x3bba92){_0x4e5774=_0x4e5774-0x0;var _0x4d0569=_0x548a[_0x4e5774];return _0x4d0569;};'use strict';var Sequelize=require(_0xa548('0x0'));module[_0xa548('0x1')]={'uniqueid':{'type':Sequelize[_0xa548('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa548('0x3')},'membername':{'type':Sequelize[_0xa548('0x4')],'allowNull':![],'comment':_0xa548('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa548('0x4')],'allowNull':![],'unique':_0xa548('0x5'),'comment':_0xa548('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa548('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xa548('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xa548('0x3')},'penalty':{'type':Sequelize[_0xa548('0x2')](0xb),'defaultValue':0x0,'comment':_0xa548('0x3')},'paused':{'type':Sequelize[_0xa548('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xa673=['queue_interface','INTEGER','sequelize','exports','STRING','Required\x20by\x20Asterisk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa673,0x158));var _0x3a67=function(_0x6cf756,_0x3daec7){_0x6cf756=_0x6cf756-0x0;var _0x552797=_0xa673[_0x6cf756];return _0x552797;};'use strict';var Sequelize=require(_0x3a67('0x0'));module[_0x3a67('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x3a67('0x2')],'allowNull':![],'comment':_0x3a67('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3a67('0x4'),'comment':_0x3a67('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3a67('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0x3a67('0x2')],'allowNull':![],'unique':_0x3a67('0x4'),'comment':_0x3a67('0x3')},'penalty':{'type':Sequelize[_0x3a67('0x5')](0xb),'defaultValue':0x0,'comment':_0x3a67('0x3')},'paused':{'type':Sequelize[_0x3a67('0x5')](0xb),'defaultValue':0x0,'comment':_0x3a67('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index aa3fa1f..4414ef4 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 _0x6cb1=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1814a5,_0x46c721){var _0x3c6af2=function(_0x4f237f){while(--_0x4f237f){_0x1814a5['push'](_0x1814a5['shift']());}};_0x3c6af2(++_0x46c721);}(_0x6cb1,0x17b));var _0x16cb=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6cb1[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x16cb('0x0'));var UserVoiceQueueRt=require(_0x16cb('0x1'))['db'][_0x16cb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x16cb('0x3')](0x0);var events={'afterCreate':_0x16cb('0x4'),'afterUpdate':'update','afterDestroy':_0x16cb('0x5')};function emitEvent(_0x24109d){return function(_0x4841c3,_0x10099b,_0x237519){UserVoiceQueueRtEvents[_0x16cb('0x6')](_0x24109d+':'+_0x4841c3['id'],_0x4841c3);UserVoiceQueueRtEvents[_0x16cb('0x6')](_0x24109d,_0x4841c3);_0x237519(null);};}for(var e in events){if(events[_0x16cb('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x16cb('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0fc0=['../../mysqldb','save','emit','hasOwnProperty','hook','events'];(function(_0xd92e0f,_0x4c28de){var _0x408a33=function(_0x35be94){while(--_0x35be94){_0xd92e0f['push'](_0xd92e0f['shift']());}};_0x408a33(++_0x4c28de);}(_0x0fc0,0x191));var _0x00fc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0fc0[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x00fc('0x0'));var UserVoiceQueueRt=require(_0x00fc('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x00fc('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x33c826){return function(_0x2fdcf4,_0x54b9c7,_0x35e980){UserVoiceQueueRtEvents['emit'](_0x33c826+':'+_0x2fdcf4['id'],_0x2fdcf4);UserVoiceQueueRtEvents[_0x00fc('0x3')](_0x33c826,_0x2fdcf4);_0x35e980(null);};}for(var e in events){if(events[_0x00fc('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x00fc('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4eafa55..9ddb428 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 _0xb6ad=['../../config/environment','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5bf35e,_0x4ccc17){var _0x35b3d7=function(_0xefa9e4){while(--_0xefa9e4){_0x5bf35e['push'](_0x5bf35e['shift']());}};_0x35b3d7(++_0x4ccc17);}(_0xb6ad,0x1d8));var _0xdb6a=function(_0x266529,_0x1c87e0){_0x266529=_0x266529-0x0;var _0x218205=_0xb6ad[_0x266529];return _0x218205;};'use strict';var _=require(_0xdb6a('0x0'));var util=require(_0xdb6a('0x1'));var logger=require(_0xdb6a('0x2'))(_0xdb6a('0x3'));var moment=require(_0xdb6a('0x4'));var BPromise=require(_0xdb6a('0x5'));var rp=require(_0xdb6a('0x6'));var fs=require('fs');var path=require(_0xdb6a('0x7'));var rimraf=require(_0xdb6a('0x8'));var config=require(_0xdb6a('0x9'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x348c45,_0x52e9d4){return _0x348c45[_0xdb6a('0xa')](_0xdb6a('0xb'),attributes,{'tableName':_0xdb6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8886=['user_has_voice_queues_rt','util','../../config/logger','api','moment','path','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt'];(function(_0x5bcac4,_0x2b4935){var _0x289065=function(_0x164366){while(--_0x164366){_0x5bcac4['push'](_0x5bcac4['shift']());}};_0x289065(++_0x2b4935);}(_0x8886,0x97));var _0x6888=function(_0x4a03f1,_0x3f3d61){_0x4a03f1=_0x4a03f1-0x0;var _0x5e84d5=_0x8886[_0x4a03f1];return _0x5e84d5;};'use strict';var _=require('lodash');var util=require(_0x6888('0x0'));var logger=require(_0x6888('0x1'))(_0x6888('0x2'));var moment=require(_0x6888('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6888('0x4'));var rimraf=require(_0x6888('0x5'));var config=require('../../config/environment');var attributes=require(_0x6888('0x6'));module['exports']=function(_0xb3292e,_0x298d24){return _0xb3292e[_0x6888('0x7')](_0x6888('0x8'),attributes,{'tableName':_0x6888('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 4d1166b..920a0fb 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 _0xb520=['options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x480369,_0x53b43d){var _0x122892=function(_0x41b81){while(--_0x41b81){_0x480369['push'](_0x480369['shift']());}};_0x122892(++_0x53b43d);}(_0xb520,0xf9));var _0x0b52=function(_0x121ce9,_0x3ac965){_0x121ce9=_0x121ce9-0x0;var _0x49efd7=_0xb520[_0x121ce9];return _0x49efd7;};'use strict';var _=require('lodash');var util=require(_0x0b52('0x0'));var moment=require(_0x0b52('0x1'));var BPromise=require(_0x0b52('0x2'));var rs=require(_0x0b52('0x3'));var fs=require('fs');var Redis=require(_0x0b52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b52('0x5'));var logger=require(_0x0b52('0x6'))(_0x0b52('0x7'));var config=require(_0x0b52('0x8'));var jayson=require(_0x0b52('0x9'));var client=jayson[_0x0b52('0xa')][_0x0b52('0xb')]({'port':0x232a});config[_0x0b52('0xc')]=_[_0x0b52('0xd')](config['redis'],{'host':_0x0b52('0xe'),'port':0x18eb});var socket=require(_0x0b52('0xf'))(new Redis(config['redis']));require(_0x0b52('0x10'))[_0x0b52('0x11')](socket);function respondWithRpcPromise(_0x45daf1,_0x8ab44c,_0x5b1546){return new BPromise(function(_0x27d6fb,_0x46cf0f){return client[_0x0b52('0x12')](_0x45daf1,_0x5b1546)[_0x0b52('0x13')](function(_0x5b1ae9){logger['info'](_0x0b52('0x14'),_0x8ab44c,_0x0b52('0x15'));logger[_0x0b52('0x16')](_0x0b52('0x17'),_0x8ab44c,_0x0b52('0x15'),JSON[_0x0b52('0x18')](_0x5b1ae9));if(_0x5b1ae9[_0x0b52('0x19')]){if(_0x5b1ae9[_0x0b52('0x19')][_0x0b52('0x1a')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x8ab44c,_0x5b1ae9[_0x0b52('0x19')][_0x0b52('0x1b')]);return _0x46cf0f(_0x5b1ae9[_0x0b52('0x19')][_0x0b52('0x1b')]);}logger['error'](_0x0b52('0x14'),_0x8ab44c,_0x5b1ae9[_0x0b52('0x19')]['message']);return _0x27d6fb(_0x5b1ae9['error'][_0x0b52('0x1b')]);}else{logger['info'](_0x0b52('0x14'),_0x8ab44c,_0x0b52('0x15'));_0x27d6fb(_0x5b1ae9['result'][_0x0b52('0x1b')]);}})['catch'](function(_0x3ef72d){logger[_0x0b52('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x8ab44c,_0x3ef72d);_0x46cf0f(_0x3ef72d);});});}exports[_0x0b52('0x1c')]=function(_0x3acfa9){var _0x55e2af=this;return new Promise(function(_0x347b45,_0x1c0d13){return db[_0x0b52('0x1d')][_0x0b52('0x1e')]({'raw':_0x3acfa9[_0x0b52('0x1f')]?_0x3acfa9['options'][_0x0b52('0x20')]===undefined?!![]:![]:!![],'where':_0x3acfa9['options']?_0x3acfa9[_0x0b52('0x1f')][_0x0b52('0x21')]||null:null,'attributes':[[db[_0x0b52('0x22')]['fn'](_0x0b52('0x23'),db[_0x0b52('0x22')]['fn']('IF',db[_0x0b52('0x22')][_0x0b52('0x24')](_0x0b52('0x25')))),_0x0b52('0x26')]]})['then'](function(_0x50c101){logger[_0x0b52('0x27')](_0x0b52('0x1c'),_0x3acfa9);logger[_0x0b52('0x16')](_0x0b52('0x1c'),_0x3acfa9,JSON[_0x0b52('0x18')](_0x50c101));_0x347b45(_0x50c101);})['catch'](function(_0x179677){logger[_0x0b52('0x19')]('GetVoiceQueueRtPauses',_0x179677[_0x0b52('0x1b')],_0x3acfa9);_0x1c0d13(_0x55e2af[_0x0b52('0x19')](0x1f4,_0x179677[_0x0b52('0x1b')]));});});}; \ No newline at end of file +var _0x352c=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize'];(function(_0x42f1cf,_0x3bf474){var _0xb37631=function(_0xfff57c){while(--_0xfff57c){_0x42f1cf['push'](_0x42f1cf['shift']());}};_0xb37631(++_0x3bf474);}(_0x352c,0x11c));var _0xc352=function(_0xa86f0e,_0x48f50b){_0xa86f0e=_0xa86f0e-0x0;var _0x31815f=_0x352c[_0xa86f0e];return _0x31815f;};'use strict';var _=require(_0xc352('0x0'));var util=require(_0xc352('0x1'));var moment=require('moment');var BPromise=require(_0xc352('0x2'));var rs=require(_0xc352('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc352('0x4'))['db'];var utils=require(_0xc352('0x5'));var logger=require(_0xc352('0x6'))(_0xc352('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc352('0x8')][_0xc352('0x9')]({'port':0x232a});config[_0xc352('0xa')]=_['defaults'](config[_0xc352('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc352('0xa')]));require(_0xc352('0xb'))[_0xc352('0xc')](socket);function respondWithRpcPromise(_0x407dd8,_0x1c9942,_0x933cbd){return new BPromise(function(_0x39d3ab,_0x586f7f){return client[_0xc352('0xd')](_0x407dd8,_0x933cbd)['then'](function(_0xcaabbe){logger[_0xc352('0xe')](_0xc352('0xf'),_0x1c9942,'request\x20sent');logger[_0xc352('0x10')](_0xc352('0x11'),_0x1c9942,_0xc352('0x12'),JSON[_0xc352('0x13')](_0xcaabbe));if(_0xcaabbe[_0xc352('0x14')]){if(_0xcaabbe[_0xc352('0x14')][_0xc352('0x15')]===0x1f4){logger[_0xc352('0x14')](_0xc352('0xf'),_0x1c9942,_0xcaabbe[_0xc352('0x14')][_0xc352('0x16')]);return _0x586f7f(_0xcaabbe[_0xc352('0x14')][_0xc352('0x16')]);}logger[_0xc352('0x14')](_0xc352('0xf'),_0x1c9942,_0xcaabbe[_0xc352('0x14')][_0xc352('0x16')]);return _0x39d3ab(_0xcaabbe['error'][_0xc352('0x16')]);}else{logger[_0xc352('0xe')](_0xc352('0xf'),_0x1c9942,_0xc352('0x12'));_0x39d3ab(_0xcaabbe['result']['message']);}})[_0xc352('0x17')](function(_0x10ba1f){logger[_0xc352('0x14')](_0xc352('0xf'),_0x1c9942,_0x10ba1f);_0x586f7f(_0x10ba1f);});});}exports[_0xc352('0x18')]=function(_0x426b5c){var _0xebf153=this;return new Promise(function(_0x19545d,_0x20f3b4){return db[_0xc352('0x19')][_0xc352('0x1a')]({'raw':_0x426b5c['options']?_0x426b5c[_0xc352('0x1b')][_0xc352('0x1c')]===undefined?!![]:![]:!![],'where':_0x426b5c[_0xc352('0x1b')]?_0x426b5c['options'][_0xc352('0x1d')]||null:null,'attributes':[[db[_0xc352('0x1e')]['fn'](_0xc352('0x1f'),db['sequelize']['fn']('IF',db[_0xc352('0x1e')][_0xc352('0x20')](_0xc352('0x21')))),_0xc352('0x22')]]})['then'](function(_0x2ab383){logger[_0xc352('0xe')]('GetVoiceQueueRtPauses',_0x426b5c);logger[_0xc352('0x10')](_0xc352('0x18'),_0x426b5c,JSON[_0xc352('0x13')](_0x2ab383));_0x19545d(_0x2ab383);})[_0xc352('0x17')](function(_0x1602f1){logger['error'](_0xc352('0x18'),_0x1602f1[_0xc352('0x16')],_0x426b5c);_0x20f3b4(_0xebf153[_0xc352('0x14')](0x1f4,_0x1602f1['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 51f3b31..ad61b5c 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 _0xfd25=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xfd25,0xd6));var _0x5fd2=function(_0x582a41,_0x42b8b3){_0x582a41=_0x582a41-0x0;var _0xae9f8d=_0xfd25[_0x582a41];return _0xae9f8d;};'use strict';var UserVoiceQueueRtEvents=require(_0x5fd2('0x0'));var events=[_0x5fd2('0x1'),_0x5fd2('0x2'),'update'];function createListener(_0x2251f0,_0x2c42b7){return function(_0x13d2f1){_0x2c42b7['emit'](_0x2251f0,_0x13d2f1);};}function removeListener(_0x8292e3,_0x44e72f){return function(){UserVoiceQueueRtEvents[_0x5fd2('0x3')](_0x8292e3,_0x44e72f);};}exports[_0x5fd2('0x4')]=function(_0x10b7ba){for(var _0x19893d=0x0,_0xb27d73=events[_0x5fd2('0x5')];_0x19893d<_0xb27d73;_0x19893d++){var _0x2084f4=events[_0x19893d];var _0x4259b0=createListener(_0x5fd2('0x6')+_0x2084f4,_0x10b7ba);UserVoiceQueueRtEvents['on'](_0x2084f4,_0x4259b0);}}; \ No newline at end of file +var _0x3a41=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','emit'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3a41,0x165));var _0x13a4=function(_0x307c57,_0x2ff9e5){_0x307c57=_0x307c57-0x0;var _0x232faa=_0x3a41[_0x307c57];return _0x232faa;};'use strict';var UserVoiceQueueRtEvents=require(_0x13a4('0x0'));var events=[_0x13a4('0x1'),'remove','update'];function createListener(_0x536724,_0x2bd52d){return function(_0x1a30de){_0x2bd52d[_0x13a4('0x2')](_0x536724,_0x1a30de);};}function removeListener(_0x345e47,_0xc200c5){return function(){UserVoiceQueueRtEvents[_0x13a4('0x3')](_0x345e47,_0xc200c5);};}exports[_0x13a4('0x4')]=function(_0x253dc2){for(var _0x386d15=0x0,_0x351fda=events['length'];_0x386d15<_0x351fda;_0x386d15++){var _0x493e09=events[_0x386d15];var _0x27d9f2=createListener(_0x13a4('0x5')+_0x493e09,_0x253dc2);UserVoiceQueueRtEvents['on'](_0x493e09,_0x27d9f2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 56e457b..468257f 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 _0x72a4=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util','path'];(function(_0x1a774d,_0x1d0d19){var _0x3168cd=function(_0x52921b){while(--_0x52921b){_0x1a774d['push'](_0x1a774d['shift']());}};_0x3168cd(++_0x1d0d19);}(_0x72a4,0x1c5));var _0x472a=function(_0x211de7,_0x2e6f69){_0x211de7=_0x211de7-0x0;var _0x2b29e0=_0x72a4[_0x211de7];return _0x2b29e0;};'use strict';var multer=require('multer');var util=require(_0x472a('0x0'));var path=require(_0x472a('0x1'));var timeout=require(_0x472a('0x2'));var express=require('express');var router=express[_0x472a('0x3')]();var auth=require(_0x472a('0x4'));var interaction=require(_0x472a('0x5'));var config=require(_0x472a('0x6'));module['exports']=router; \ No newline at end of file +var _0x4a9b=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x381b5e,_0x3a5a5f){var _0x506b54=function(_0xb5b2f0){while(--_0xb5b2f0){_0x381b5e['push'](_0x381b5e['shift']());}};_0x506b54(++_0x3a5a5f);}(_0x4a9b,0x1f0));var _0xb4a9=function(_0xcd06c7,_0x8edcb3){_0xcd06c7=_0xcd06c7-0x0;var _0x53eced=_0x4a9b[_0xcd06c7];return _0x53eced;};'use strict';var multer=require(_0xb4a9('0x0'));var util=require('util');var path=require(_0xb4a9('0x1'));var timeout=require(_0xb4a9('0x2'));var express=require(_0xb4a9('0x3'));var router=express[_0xb4a9('0x4')]();var auth=require(_0xb4a9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb4a9('0x6'));module[_0xb4a9('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c151a1b..31a14ed 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0xea1f72,_0x46e436){var _0x436b1b=function(_0x3b1274){while(--_0x3b1274){_0xea1f72['push'](_0xea1f72['shift']());}};_0x436b1b(++_0x46e436);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x13de39,_0x156503){var _0x16d886=function(_0x5af5ca){while(--_0x5af5ca){_0x13de39['push'](_0x13de39['shift']());}};_0x16d886(++_0x156503);}(_0xe706,0xa3));var _0x6e70=function(_0x527228,_0x2bf9d1){_0x527228=_0x527228-0x0;var _0x18fc82=_0xe706[_0x527228];return _0x18fc82;};'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 8d4c2a3..17740ba 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 _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x22ba61,_0x392996){_0x22ba61=_0x22ba61-0x0;var _0xa94fd2=_0xf4f4[_0x22ba61];return _0xa94fd2;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0abf=['define','user_has_whatsapp_queues','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x59409d,_0x5b7eaa){var _0x4174bf=function(_0x5906b2){while(--_0x5906b2){_0x59409d['push'](_0x59409d['shift']());}};_0x4174bf(++_0x5b7eaa);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf0ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var attributes=require(_0xf0ab('0x6'));module[_0xf0ab('0x7')]=function(_0x2ab7d6,_0x4d2ea8){return _0x2ab7d6[_0xf0ab('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0xf0ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 7ddc0e5..bf58394 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(_0x3b0cd0,_0x4d439c){var _0x5baa21=function(_0x4a3055){while(--_0x4a3055){_0x3b0cd0['push'](_0x3b0cd0['shift']());}};_0x5baa21(++_0x4d439c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x17d6c6,_0x413758){var _0x5cc6e2=function(_0x246bfd){while(--_0x246bfd){_0x17d6c6['push'](_0x17d6c6['shift']());}};_0x5cc6e2(++_0x413758);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 9f0b39d..50aa2b3 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 _0x6761=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0xcb19e1,_0x465489){var _0x121872=function(_0x5c9cd1){while(--_0x5c9cd1){_0xcb19e1['push'](_0xcb19e1['shift']());}};_0x121872(++_0x465489);}(_0x6761,0x141));var _0x1676=function(_0x1dd74a,_0x1e0dd6){_0x1dd74a=_0x1dd74a-0x0;var _0x1710af=_0x6761[_0x1dd74a];return _0x1710af;};'use strict';var multer=require(_0x1676('0x0'));var util=require(_0x1676('0x1'));var path=require(_0x1676('0x2'));var timeout=require(_0x1676('0x3'));var express=require(_0x1676('0x4'));var router=express[_0x1676('0x5')]();var auth=require(_0x1676('0x6'));var interaction=require(_0x1676('0x7'));var config=require('../../config/environment');var controller=require(_0x1676('0x8'));router[_0x1676('0x9')]('/',auth[_0x1676('0xa')](),controller['index']);router[_0x1676('0x9')](_0x1676('0xb'),auth[_0x1676('0xa')](),controller['show']);router[_0x1676('0xc')]('/',auth['isAuthenticated'](),controller[_0x1676('0xd')]);router[_0x1676('0xe')](_0x1676('0xb'),auth[_0x1676('0xa')](),controller[_0x1676('0xf')]);router[_0x1676('0x10')](_0x1676('0xb'),auth[_0x1676('0xa')](),controller[_0x1676('0x11')]);module[_0x1676('0x12')]=router; \ No newline at end of file +var _0x5521=['exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','destroy'];(function(_0x157a99,_0x2095eb){var _0xd57723=function(_0x1b81a3){while(--_0x1b81a3){_0x157a99['push'](_0x157a99['shift']());}};_0xd57723(++_0x2095eb);}(_0x5521,0xa9));var _0x1552=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5521[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x1552('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1552('0x1'));var router=express[_0x1552('0x2')]();var auth=require(_0x1552('0x3'));var interaction=require(_0x1552('0x4'));var config=require(_0x1552('0x5'));var controller=require('./variable.controller');router['get']('/',auth[_0x1552('0x6')](),controller[_0x1552('0x7')]);router[_0x1552('0x8')]('/:id',auth[_0x1552('0x6')](),controller[_0x1552('0x9')]);router['post']('/',auth[_0x1552('0x6')](),controller[_0x1552('0xa')]);router[_0x1552('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x1552('0x6')](),controller[_0x1552('0xc')]);module[_0x1552('0xd')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 68a4aaf..fedee66 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 _0x11c4=['sequelize','exports','STRING','name'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x11c4,0xf4));var _0x411c=function(_0x6e1404,_0x188610){_0x6e1404=_0x6e1404-0x0;var _0x464eb0=_0x11c4[_0x6e1404];return _0x464eb0;};'use strict';var Sequelize=require(_0x411c('0x0'));module[_0x411c('0x1')]={'name':{'type':Sequelize[_0x411c('0x2')],'unique':_0x411c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2466=['exports','STRING','name','sequelize'];(function(_0x1e0e03,_0x4cbd2d){var _0x5b038f=function(_0x5f4edd){while(--_0x5f4edd){_0x1e0e03['push'](_0x1e0e03['shift']());}};_0x5b038f(++_0x4cbd2d);}(_0x2466,0xe3));var _0x6246=function(_0x15b694,_0x56fa0a){_0x15b694=_0x15b694-0x0;var _0x35c1a4=_0x2466[_0x15b694];return _0x35c1a4;};'use strict';var Sequelize=require(_0x6246('0x0'));module[_0x6246('0x1')]={'name':{'type':Sequelize[_0x6246('0x2')],'unique':_0x6246('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6246('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 773ac1b..ae085ac 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 _0xe6a1=['sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','length','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order'];(function(_0x180184,_0x2339a0){var _0x387188=function(_0x4acefe){while(--_0x4acefe){_0x180184['push'](_0x180184['shift']());}};_0x387188(++_0x2339a0);}(_0xe6a1,0x111));var _0x1e6a=function(_0xc83298,_0x5725ad){_0xc83298=_0xc83298-0x0;var _0x2cb344=_0xe6a1[_0xc83298];return _0x2cb344;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1e6a('0x0'));var rimraf=require(_0x1e6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e6a('0x2'));var rp=require(_0x1e6a('0x3'));var moment=require(_0x1e6a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1e6a('0x5'));var path=require(_0x1e6a('0x6'));var sox=require(_0x1e6a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1e6a('0x8'));var squel=require(_0x1e6a('0x9'));var crypto=require(_0x1e6a('0xa'));var jsforce=require(_0x1e6a('0xb'));var deskjs=require(_0x1e6a('0xc'));var toCsv=require(_0x1e6a('0xd'));var querystring=require(_0x1e6a('0xe'));var Papa=require(_0x1e6a('0xf'));var Redis=require(_0x1e6a('0x10'));var authService=require(_0x1e6a('0x11'));var qs=require(_0x1e6a('0x12'));var as=require(_0x1e6a('0x13'));var hardwareService=require(_0x1e6a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1e6a('0x15'));var config=require(_0x1e6a('0x16'));var db=require(_0x1e6a('0x17'))['db'];function respondWithStatusCode(_0x7e009c,_0x40d56f){_0x40d56f=_0x40d56f||0xcc;return function(_0x426271){if(_0x426271){return _0x7e009c[_0x1e6a('0x18')](_0x40d56f);}return _0x7e009c[_0x1e6a('0x19')](_0x40d56f)[_0x1e6a('0x1a')]();};}function respondWithResult(_0x4f007d,_0x264e36){_0x264e36=_0x264e36||0xc8;return function(_0x165d80){if(_0x165d80){return _0x4f007d[_0x1e6a('0x19')](_0x264e36)[_0x1e6a('0x1b')](_0x165d80);}};}function respondWithFilteredResult(_0x34113e,_0x1686ed){return function(_0x2a0752){if(_0x2a0752){var _0x114ede=_0x2a0752[_0x1e6a('0x1c')],_0x4b9644=_0x1686ed['offset'],_0x3475ba=_0x1686ed[_0x1e6a('0x1d')]+_0x1686ed['limit'],_0x4c9fff;if(_0x3475ba>=_0x114ede){_0x3475ba=_0x114ede;_0x4c9fff=0xc8;}else{_0x4c9fff=0xce;}_0x34113e['status'](_0x4c9fff);return _0x34113e[_0x1e6a('0x1e')]('Content-Range',_0x4b9644+'-'+_0x3475ba+'/'+_0x114ede)[_0x1e6a('0x1b')](_0x2a0752);}return null;};}function patchUpdates(_0x257d80){return function(_0x4492ab){try{jsonpatch[_0x1e6a('0x1f')](_0x4492ab,_0x257d80,!![]);}catch(_0xda6c67){return BPromise[_0x1e6a('0x20')](_0xda6c67);}return _0x4492ab[_0x1e6a('0x21')]();};}function saveUpdates(_0x2dec19,_0x1b871d){return function(_0x14a95b){if(_0x14a95b){return _0x14a95b[_0x1e6a('0x22')](_0x2dec19)[_0x1e6a('0x23')](function(_0x79de8d){return _0x79de8d;});}return null;};}function removeEntity(_0x30d319,_0x48427a){return function(_0x5aa0e4){if(_0x5aa0e4){return _0x5aa0e4['destroy']()[_0x1e6a('0x23')](function(){var _0x700abc=_0x5aa0e4[_0x1e6a('0x24')]({'plain':!![]});var _0x1510ca=_0x1e6a('0x25');return db[_0x1e6a('0x26')][_0x1e6a('0x27')]({'where':{'type':_0x1510ca,'resourceId':_0x700abc['id']}})['then'](function(){return _0x5aa0e4;});})[_0x1e6a('0x23')](function(){_0x30d319[_0x1e6a('0x19')](0xcc)[_0x1e6a('0x1a')]();});}};}function handleEntityNotFound(_0x55bbe3,_0x5b4dca){return function(_0x25ffca){if(!_0x25ffca){_0x55bbe3[_0x1e6a('0x18')](0x194);}return _0x25ffca;};}function handleError(_0x9f944e,_0x169347){_0x169347=_0x169347||0x1f4;return function(_0x5efc8e){logger[_0x1e6a('0x28')](_0x5efc8e[_0x1e6a('0x29')]);if(_0x5efc8e[_0x1e6a('0x2a')]){delete _0x5efc8e[_0x1e6a('0x2a')];}_0x9f944e[_0x1e6a('0x19')](_0x169347)[_0x1e6a('0x2b')](_0x5efc8e);};}exports[_0x1e6a('0x2c')]=function(_0xc5fe0e,_0x5d3c86){var _0x5ee2cf={},_0x2bfc28={},_0x2f1003={'count':0x0,'rows':[]};var _0x4a5b8b=_[_0x1e6a('0x2d')](db[_0x1e6a('0x2e')]['rawAttributes'],function(_0x4abc80){return{'name':_0x4abc80[_0x1e6a('0x2f')],'type':_0x4abc80['type'][_0x1e6a('0x30')]};});_0x2bfc28[_0x1e6a('0x31')]=_['map'](_0x4a5b8b,'name');_0x2bfc28[_0x1e6a('0x32')]=_[_0x1e6a('0x33')](_0xc5fe0e[_0x1e6a('0x32')]);_0x2bfc28[_0x1e6a('0x34')]=_[_0x1e6a('0x35')](_0x2bfc28['model'],_0x2bfc28[_0x1e6a('0x32')]);_0x5ee2cf[_0x1e6a('0x36')]=_[_0x1e6a('0x35')](_0x2bfc28[_0x1e6a('0x31')],qs['fields'](_0xc5fe0e[_0x1e6a('0x32')][_0x1e6a('0x37')]));_0x5ee2cf[_0x1e6a('0x36')]=_0x5ee2cf[_0x1e6a('0x36')]['length']?_0x5ee2cf[_0x1e6a('0x36')]:_0x2bfc28[_0x1e6a('0x31')];if(!_0xc5fe0e['query']['hasOwnProperty'](_0x1e6a('0x38'))){_0x5ee2cf[_0x1e6a('0x39')]=qs[_0x1e6a('0x39')](_0xc5fe0e['query']['limit']);_0x5ee2cf[_0x1e6a('0x1d')]=qs[_0x1e6a('0x1d')](_0xc5fe0e['query'][_0x1e6a('0x1d')]);}_0x5ee2cf[_0x1e6a('0x3a')]=qs['sort'](_0xc5fe0e[_0x1e6a('0x32')][_0x1e6a('0x3b')]);_0x5ee2cf[_0x1e6a('0x3c')]=qs[_0x1e6a('0x34')](_['pick'](_0xc5fe0e[_0x1e6a('0x32')],_0x2bfc28[_0x1e6a('0x34')]),_0x4a5b8b);if(_0xc5fe0e[_0x1e6a('0x32')][_0x1e6a('0x3d')]){_0x5ee2cf[_0x1e6a('0x3c')]=_['merge'](_0x5ee2cf[_0x1e6a('0x3c')],{'$or':_['map'](_0x4a5b8b,function(_0x49d06b){if(_0x49d06b[_0x1e6a('0x3e')]!==_0x1e6a('0x3f')){var _0x30cbab={};_0x30cbab[_0x49d06b['name']]={'$like':'%'+_0xc5fe0e[_0x1e6a('0x32')][_0x1e6a('0x3d')]+'%'};return _0x30cbab;}})});}_0x5ee2cf=_[_0x1e6a('0x40')]({},_0x5ee2cf,_0xc5fe0e[_0x1e6a('0x41')]);var _0x4defa0={'where':_0x5ee2cf[_0x1e6a('0x3c')]};return db[_0x1e6a('0x2e')][_0x1e6a('0x1c')](_0x4defa0)[_0x1e6a('0x23')](function(_0x4cb272){_0x2f1003[_0x1e6a('0x1c')]=_0x4cb272;if(_0xc5fe0e[_0x1e6a('0x32')][_0x1e6a('0x42')]){_0x5ee2cf[_0x1e6a('0x43')]=[{'all':!![]}];}return db[_0x1e6a('0x2e')]['findAll'](_0x5ee2cf);})['then'](function(_0x2d7c16){_0x2f1003[_0x1e6a('0x44')]=_0x2d7c16;return _0x2f1003;})[_0x1e6a('0x23')](respondWithFilteredResult(_0x5d3c86,_0x5ee2cf))[_0x1e6a('0x45')](handleError(_0x5d3c86,null));};exports[_0x1e6a('0x46')]=function(_0x3b2254,_0x2b93e9){var _0x238744={'raw':!![],'where':{'id':_0x3b2254[_0x1e6a('0x47')]['id']}},_0x2816e2={};_0x2816e2[_0x1e6a('0x31')]=_[_0x1e6a('0x33')](db['Variable'][_0x1e6a('0x48')]);_0x2816e2[_0x1e6a('0x32')]=_[_0x1e6a('0x33')](_0x3b2254[_0x1e6a('0x32')]);_0x2816e2[_0x1e6a('0x34')]=_[_0x1e6a('0x35')](_0x2816e2[_0x1e6a('0x31')],_0x2816e2['query']);_0x238744[_0x1e6a('0x36')]=_[_0x1e6a('0x35')](_0x2816e2['model'],qs[_0x1e6a('0x37')](_0x3b2254[_0x1e6a('0x32')][_0x1e6a('0x37')]));_0x238744[_0x1e6a('0x36')]=_0x238744[_0x1e6a('0x36')][_0x1e6a('0x49')]?_0x238744[_0x1e6a('0x36')]:_0x2816e2[_0x1e6a('0x31')];if(_0x3b2254[_0x1e6a('0x32')][_0x1e6a('0x42')]){_0x238744[_0x1e6a('0x43')]=[{'all':!![]}];}_0x238744=_['merge']({},_0x238744,_0x3b2254[_0x1e6a('0x41')]);return db[_0x1e6a('0x2e')]['find'](_0x238744)['then'](handleEntityNotFound(_0x2b93e9,null))[_0x1e6a('0x23')](respondWithResult(_0x2b93e9,null))[_0x1e6a('0x45')](handleError(_0x2b93e9,null));};exports[_0x1e6a('0x4a')]=function(_0x4f3ade,_0x568fb7){return db[_0x1e6a('0x2e')]['create'](_0x4f3ade[_0x1e6a('0x4b')],{})[_0x1e6a('0x23')](function(_0x3a4145){var _0x2ce56b=_0x4f3ade[_0x1e6a('0x4c')][_0x1e6a('0x24')]({'plain':!![]});if(!_0x2ce56b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ce56b[_0x1e6a('0x4d')]==='user'){var _0x53a310=_0x3a4145[_0x1e6a('0x24')]({'plain':!![]});var _0x4b3728=_0x1e6a('0x25');return db[_0x1e6a('0x4e')][_0x1e6a('0x4f')]({'where':{'name':_0x4b3728,'userProfileId':_0x2ce56b[_0x1e6a('0x50')]},'raw':!![]})[_0x1e6a('0x23')](function(_0xd8b1c4){if(_0xd8b1c4&&_0xd8b1c4[_0x1e6a('0x51')]===0x0){return db[_0x1e6a('0x26')][_0x1e6a('0x4a')]({'name':_0x53a310[_0x1e6a('0x2a')],'resourceId':_0x53a310['id'],'type':_0xd8b1c4[_0x1e6a('0x2a')],'sectionId':_0xd8b1c4['id']},{})['then'](function(){return _0x3a4145;});}else{return _0x3a4145;}})[_0x1e6a('0x45')](function(_0xa5bd2a){logger['error'](_0x1e6a('0x52'),_0xa5bd2a);throw _0xa5bd2a;});}return _0x3a4145;})['then'](respondWithResult(_0x568fb7,0xc9))['catch'](handleError(_0x568fb7,null));};exports[_0x1e6a('0x22')]=function(_0x371c36,_0x383de8){if(_0x371c36['body']['id']){delete _0x371c36[_0x1e6a('0x4b')]['id'];}return db[_0x1e6a('0x2e')][_0x1e6a('0x4f')]({'where':{'id':_0x371c36[_0x1e6a('0x47')]['id']}})[_0x1e6a('0x23')](handleEntityNotFound(_0x383de8,null))['then'](saveUpdates(_0x371c36['body'],null))[_0x1e6a('0x23')](respondWithResult(_0x383de8,null))[_0x1e6a('0x45')](handleError(_0x383de8,null));};exports[_0x1e6a('0x27')]=function(_0x5c458c,_0x56fa80){return db[_0x1e6a('0x2e')][_0x1e6a('0x4f')]({'where':{'id':_0x5c458c[_0x1e6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x56fa80,null))[_0x1e6a('0x23')](removeEntity(_0x56fa80,null))['catch'](handleError(_0x56fa80,null));}; \ No newline at end of file +var _0x2e33=['offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','count'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x2e33,0x1d2));var _0x32e3=function(_0x5c29aa,_0x24e2c7){_0x5c29aa=_0x5c29aa-0x0;var _0x32b0ff=_0x2e33[_0x5c29aa];return _0x32b0ff;};'use strict';var pdf=require(_0x32e3('0x0'));var emlformat=require(_0x32e3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x32e3('0x2'));var jsonpatch=require(_0x32e3('0x3'));var rp=require('request-promise');var moment=require(_0x32e3('0x4'));var BPromise=require(_0x32e3('0x5'));var Mustache=require(_0x32e3('0x6'));var util=require('util');var path=require(_0x32e3('0x7'));var sox=require(_0x32e3('0x8'));var csv=require(_0x32e3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x32e3('0xa'));var crypto=require('crypto');var jsforce=require(_0x32e3('0xb'));var deskjs=require(_0x32e3('0xc'));var toCsv=require(_0x32e3('0x9'));var querystring=require(_0x32e3('0xd'));var Papa=require(_0x32e3('0xe'));var Redis=require(_0x32e3('0xf'));var authService=require(_0x32e3('0x10'));var qs=require(_0x32e3('0x11'));var as=require(_0x32e3('0x12'));var hardwareService=require(_0x32e3('0x13'));var logger=require('../../config/logger')(_0x32e3('0x14'));var utils=require('../../config/utils');var config=require(_0x32e3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381dbb,_0x3e41ac){_0x3e41ac=_0x3e41ac||0xcc;return function(_0x4781a9){if(_0x4781a9){return _0x381dbb[_0x32e3('0x16')](_0x3e41ac);}return _0x381dbb[_0x32e3('0x17')](_0x3e41ac)[_0x32e3('0x18')]();};}function respondWithResult(_0x3b072a,_0x3e1c71){_0x3e1c71=_0x3e1c71||0xc8;return function(_0x10a261){if(_0x10a261){return _0x3b072a[_0x32e3('0x17')](_0x3e1c71)['json'](_0x10a261);}};}function respondWithFilteredResult(_0x37cca8,_0x862d3){return function(_0x56d1f5){if(_0x56d1f5){var _0x1a4933=_0x56d1f5[_0x32e3('0x19')],_0x2705cf=_0x862d3[_0x32e3('0x1a')],_0x411055=_0x862d3[_0x32e3('0x1a')]+_0x862d3[_0x32e3('0x1b')],_0xea5469;if(_0x411055>=_0x1a4933){_0x411055=_0x1a4933;_0xea5469=0xc8;}else{_0xea5469=0xce;}_0x37cca8['status'](_0xea5469);return _0x37cca8[_0x32e3('0x1c')](_0x32e3('0x1d'),_0x2705cf+'-'+_0x411055+'/'+_0x1a4933)['json'](_0x56d1f5);}return null;};}function patchUpdates(_0x4eab69){return function(_0x3a9ea4){try{jsonpatch[_0x32e3('0x1e')](_0x3a9ea4,_0x4eab69,!![]);}catch(_0x3b54d9){return BPromise[_0x32e3('0x1f')](_0x3b54d9);}return _0x3a9ea4[_0x32e3('0x20')]();};}function saveUpdates(_0x3294cb,_0x460eab){return function(_0x2dfa04){if(_0x2dfa04){return _0x2dfa04['update'](_0x3294cb)[_0x32e3('0x21')](function(_0xb1b2bc){return _0xb1b2bc;});}return null;};}function removeEntity(_0x5ca677,_0x311c59){return function(_0x3fef2b){if(_0x3fef2b){return _0x3fef2b[_0x32e3('0x22')]()[_0x32e3('0x21')](function(){var _0x4d5557=_0x3fef2b[_0x32e3('0x23')]({'plain':!![]});var _0x8ad6a=_0x32e3('0x24');return db[_0x32e3('0x25')]['destroy']({'where':{'type':_0x8ad6a,'resourceId':_0x4d5557['id']}})['then'](function(){return _0x3fef2b;});})[_0x32e3('0x21')](function(){_0x5ca677[_0x32e3('0x17')](0xcc)[_0x32e3('0x18')]();});}};}function handleEntityNotFound(_0x5314cd,_0x2a3de5){return function(_0x4cea9f){if(!_0x4cea9f){_0x5314cd[_0x32e3('0x16')](0x194);}return _0x4cea9f;};}function handleError(_0x1bd005,_0x2c0ba8){_0x2c0ba8=_0x2c0ba8||0x1f4;return function(_0xe9e20d){logger[_0x32e3('0x26')](_0xe9e20d[_0x32e3('0x27')]);if(_0xe9e20d[_0x32e3('0x28')]){delete _0xe9e20d['name'];}_0x1bd005['status'](_0x2c0ba8)[_0x32e3('0x29')](_0xe9e20d);};}exports[_0x32e3('0x2a')]=function(_0x3dabfd,_0x124729){var _0x10ad97={},_0x54dffc={},_0x684da5={'count':0x0,'rows':[]};var _0x1d6813=_[_0x32e3('0x2b')](db[_0x32e3('0x2c')][_0x32e3('0x2d')],function(_0x5ea8eb){return{'name':_0x5ea8eb[_0x32e3('0x2e')],'type':_0x5ea8eb[_0x32e3('0x2f')]['key']};});_0x54dffc[_0x32e3('0x30')]=_['map'](_0x1d6813,_0x32e3('0x28'));_0x54dffc[_0x32e3('0x31')]=_[_0x32e3('0x32')](_0x3dabfd[_0x32e3('0x31')]);_0x54dffc['filters']=_[_0x32e3('0x33')](_0x54dffc['model'],_0x54dffc[_0x32e3('0x31')]);_0x10ad97[_0x32e3('0x34')]=_['intersection'](_0x54dffc[_0x32e3('0x30')],qs[_0x32e3('0x35')](_0x3dabfd[_0x32e3('0x31')]['fields']));_0x10ad97[_0x32e3('0x34')]=_0x10ad97[_0x32e3('0x34')][_0x32e3('0x36')]?_0x10ad97[_0x32e3('0x34')]:_0x54dffc[_0x32e3('0x30')];if(!_0x3dabfd[_0x32e3('0x31')]['hasOwnProperty'](_0x32e3('0x37'))){_0x10ad97['limit']=qs[_0x32e3('0x1b')](_0x3dabfd[_0x32e3('0x31')]['limit']);_0x10ad97[_0x32e3('0x1a')]=qs['offset'](_0x3dabfd['query'][_0x32e3('0x1a')]);}_0x10ad97[_0x32e3('0x38')]=qs[_0x32e3('0x39')](_0x3dabfd[_0x32e3('0x31')][_0x32e3('0x39')]);_0x10ad97[_0x32e3('0x3a')]=qs[_0x32e3('0x3b')](_[_0x32e3('0x3c')](_0x3dabfd[_0x32e3('0x31')],_0x54dffc['filters']),_0x1d6813);if(_0x3dabfd[_0x32e3('0x31')]['filter']){_0x10ad97['where']=_[_0x32e3('0x3d')](_0x10ad97[_0x32e3('0x3a')],{'$or':_['map'](_0x1d6813,function(_0x18dec8){if(_0x18dec8[_0x32e3('0x2f')]!==_0x32e3('0x3e')){var _0x4bbc04={};_0x4bbc04[_0x18dec8[_0x32e3('0x28')]]={'$like':'%'+_0x3dabfd[_0x32e3('0x31')][_0x32e3('0x3f')]+'%'};return _0x4bbc04;}})});}_0x10ad97=_[_0x32e3('0x3d')]({},_0x10ad97,_0x3dabfd[_0x32e3('0x40')]);var _0x16e8dd={'where':_0x10ad97[_0x32e3('0x3a')]};return db[_0x32e3('0x2c')][_0x32e3('0x19')](_0x16e8dd)[_0x32e3('0x21')](function(_0x41f113){_0x684da5[_0x32e3('0x19')]=_0x41f113;if(_0x3dabfd[_0x32e3('0x31')]['includeAll']){_0x10ad97[_0x32e3('0x41')]=[{'all':!![]}];}return db['Variable'][_0x32e3('0x42')](_0x10ad97);})[_0x32e3('0x21')](function(_0x4cc92f){_0x684da5[_0x32e3('0x43')]=_0x4cc92f;return _0x684da5;})['then'](respondWithFilteredResult(_0x124729,_0x10ad97))[_0x32e3('0x44')](handleError(_0x124729,null));};exports[_0x32e3('0x45')]=function(_0x3d9b97,_0x3a39d5){var _0x4467b5={'raw':!![],'where':{'id':_0x3d9b97[_0x32e3('0x46')]['id']}},_0x8cacde={};_0x8cacde[_0x32e3('0x30')]=_[_0x32e3('0x32')](db[_0x32e3('0x2c')][_0x32e3('0x2d')]);_0x8cacde[_0x32e3('0x31')]=_[_0x32e3('0x32')](_0x3d9b97[_0x32e3('0x31')]);_0x8cacde[_0x32e3('0x3b')]=_[_0x32e3('0x33')](_0x8cacde[_0x32e3('0x30')],_0x8cacde['query']);_0x4467b5[_0x32e3('0x34')]=_[_0x32e3('0x33')](_0x8cacde['model'],qs['fields'](_0x3d9b97[_0x32e3('0x31')][_0x32e3('0x35')]));_0x4467b5['attributes']=_0x4467b5[_0x32e3('0x34')][_0x32e3('0x36')]?_0x4467b5[_0x32e3('0x34')]:_0x8cacde[_0x32e3('0x30')];if(_0x3d9b97[_0x32e3('0x31')][_0x32e3('0x47')]){_0x4467b5[_0x32e3('0x41')]=[{'all':!![]}];}_0x4467b5=_[_0x32e3('0x3d')]({},_0x4467b5,_0x3d9b97[_0x32e3('0x40')]);return db[_0x32e3('0x2c')]['find'](_0x4467b5)[_0x32e3('0x21')](handleEntityNotFound(_0x3a39d5,null))[_0x32e3('0x21')](respondWithResult(_0x3a39d5,null))[_0x32e3('0x44')](handleError(_0x3a39d5,null));};exports[_0x32e3('0x48')]=function(_0x171cec,_0x4ed42e){return db[_0x32e3('0x2c')][_0x32e3('0x48')](_0x171cec[_0x32e3('0x49')],{})[_0x32e3('0x21')](function(_0x28de72){var _0x4120ef=_0x171cec['user'][_0x32e3('0x23')]({'plain':!![]});if(!_0x4120ef)throw new Error(_0x32e3('0x4a'));if(_0x4120ef[_0x32e3('0x4b')]===_0x32e3('0x4c')){var _0x17b958=_0x28de72[_0x32e3('0x23')]({'plain':!![]});var _0x3838b0=_0x32e3('0x24');return db[_0x32e3('0x4d')][_0x32e3('0x4e')]({'where':{'name':_0x3838b0,'userProfileId':_0x4120ef['userProfileId']},'raw':!![]})[_0x32e3('0x21')](function(_0x4f7959){if(_0x4f7959&&_0x4f7959[_0x32e3('0x4f')]===0x0){return db['UserProfileResource'][_0x32e3('0x48')]({'name':_0x17b958[_0x32e3('0x28')],'resourceId':_0x17b958['id'],'type':_0x4f7959[_0x32e3('0x28')],'sectionId':_0x4f7959['id']},{})['then'](function(){return _0x28de72;});}else{return _0x28de72;}})['catch'](function(_0x267164){logger[_0x32e3('0x26')](_0x32e3('0x50'),_0x267164);throw _0x267164;});}return _0x28de72;})['then'](respondWithResult(_0x4ed42e,0xc9))[_0x32e3('0x44')](handleError(_0x4ed42e,null));};exports[_0x32e3('0x51')]=function(_0x24f84c,_0x1db0d2){if(_0x24f84c['body']['id']){delete _0x24f84c[_0x32e3('0x49')]['id'];}return db[_0x32e3('0x2c')][_0x32e3('0x4e')]({'where':{'id':_0x24f84c[_0x32e3('0x46')]['id']}})[_0x32e3('0x21')](handleEntityNotFound(_0x1db0d2,null))[_0x32e3('0x21')](saveUpdates(_0x24f84c['body'],null))[_0x32e3('0x21')](respondWithResult(_0x1db0d2,null))[_0x32e3('0x44')](handleError(_0x1db0d2,null));};exports[_0x32e3('0x22')]=function(_0x3cc282,_0x58e1fc){return db[_0x32e3('0x2c')]['find']({'where':{'id':_0x3cc282[_0x32e3('0x46')]['id']}})[_0x32e3('0x21')](handleEntityNotFound(_0x58e1fc,null))[_0x32e3('0x21')](removeEntity(_0x58e1fc,null))[_0x32e3('0x44')](handleError(_0x58e1fc,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 9f6efb2..7ac2164 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 _0xc9c3=['api','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','util','../../config/logger'];(function(_0xcb43b6,_0x5ef98e){var _0x551b5e=function(_0x556fab){while(--_0x556fab){_0xcb43b6['push'](_0xcb43b6['shift']());}};_0x551b5e(++_0x5ef98e);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x3ad07c,_0x41f2a7){_0x3ad07c=_0x3ad07c-0x0;var _0xc4c8a9=_0xc9c3[_0x3ad07c];return _0xc4c8a9;};'use strict';var _=require('lodash');var util=require(_0x3c9c('0x0'));var logger=require(_0x3c9c('0x1'))(_0x3c9c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3c9c('0x3'));var fs=require('fs');var path=require(_0x3c9c('0x4'));var rimraf=require('rimraf');var config=require(_0x3c9c('0x5'));var attributes=require(_0x3c9c('0x6'));module[_0x3c9c('0x7')]=function(_0xfb5046,_0x40811c){return _0xfb5046[_0x3c9c('0x8')](_0x3c9c('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9a=['bluebird','request-promise','rimraf','../../config/environment','exports','define','tools_variables','util','api','moment'];(function(_0x3f5639,_0x2861c5){var _0x226cad=function(_0x1b3397){while(--_0x1b3397){_0x3f5639['push'](_0x3f5639['shift']());}};_0x226cad(++_0x2861c5);}(_0x0a9a,0x183));var _0xa0a9=function(_0x2460e0,_0x21a7e4){_0x2460e0=_0x2460e0-0x0;var _0x51c744=_0x0a9a[_0x2460e0];return _0x51c744;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var logger=require('../../config/logger')(_0xa0a9('0x1'));var moment=require(_0xa0a9('0x2'));var BPromise=require(_0xa0a9('0x3'));var rp=require(_0xa0a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var attributes=require('./variable.attributes');module[_0xa0a9('0x7')]=function(_0xc65bbb,_0x1aa717){return _0xc65bbb[_0xa0a9('0x8')]('Variable',attributes,{'tableName':_0xa0a9('0x9'),'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 3ea4072..6992ebf 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 _0xcead=['where','attributes','map','include','model','then','info','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','Variable,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowVariable','Variable','find','options','raw'];(function(_0x35883c,_0x40b1ee){var _0x41bb8d=function(_0x1fa74d){while(--_0x1fa74d){_0x35883c['push'](_0x35883c['shift']());}};_0x41bb8d(++_0x40b1ee);}(_0xcead,0x170));var _0xdcea=function(_0x5b7ccf,_0x2f1b30){_0x5b7ccf=_0x5b7ccf-0x0;var _0x1db839=_0xcead[_0x5b7ccf];return _0x1db839;};'use strict';var _=require(_0xdcea('0x0'));var util=require(_0xdcea('0x1'));var moment=require('moment');var BPromise=require(_0xdcea('0x2'));var rs=require(_0xdcea('0x3'));var fs=require('fs');var Redis=require(_0xdcea('0x4'));var db=require(_0xdcea('0x5'))['db'];var utils=require(_0xdcea('0x6'));var logger=require('../../config/logger')(_0xdcea('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdcea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2886b9,_0x5a2908,_0x23b110){return new BPromise(function(_0x1e7857,_0x1fbd94){return client[_0xdcea('0x9')](_0x2886b9,_0x23b110)['then'](function(_0x2b2fb3){logger['info'](_0xdcea('0xa'),_0x5a2908,_0xdcea('0xb'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x5a2908,_0xdcea('0xb'),JSON[_0xdcea('0xc')](_0x2b2fb3));if(_0x2b2fb3['error']){if(_0x2b2fb3['error']['code']===0x1f4){logger[_0xdcea('0xd')]('Variable,\x20%s,\x20%s',_0x5a2908,_0x2b2fb3[_0xdcea('0xd')][_0xdcea('0xe')]);return _0x1fbd94(_0x2b2fb3['error'][_0xdcea('0xe')]);}logger['error'](_0xdcea('0xa'),_0x5a2908,_0x2b2fb3[_0xdcea('0xd')]['message']);return _0x1e7857(_0x2b2fb3[_0xdcea('0xd')][_0xdcea('0xe')]);}else{logger['info'](_0xdcea('0xa'),_0x5a2908,_0xdcea('0xb'));_0x1e7857(_0x2b2fb3[_0xdcea('0xf')][_0xdcea('0xe')]);}})[_0xdcea('0x10')](function(_0x3a7802){logger[_0xdcea('0xd')](_0xdcea('0xa'),_0x5a2908,_0x3a7802);_0x1fbd94(_0x3a7802);});});}exports[_0xdcea('0x11')]=function(_0x2f0bb5){var _0x4611c5=this;return new Promise(function(_0x5e97ce,_0x4a8ee2){return db[_0xdcea('0x12')][_0xdcea('0x13')]({'raw':_0x2f0bb5[_0xdcea('0x14')]?_0x2f0bb5[_0xdcea('0x14')][_0xdcea('0x15')]===undefined?!![]:![]:!![],'where':_0x2f0bb5[_0xdcea('0x14')]?_0x2f0bb5[_0xdcea('0x14')][_0xdcea('0x16')]||null:null,'attributes':_0x2f0bb5[_0xdcea('0x14')]?_0x2f0bb5[_0xdcea('0x14')][_0xdcea('0x17')]||null:null,'include':_0x2f0bb5[_0xdcea('0x14')]?_0x2f0bb5['options']['include']?_[_0xdcea('0x18')](_0x2f0bb5[_0xdcea('0x14')][_0xdcea('0x19')],function(_0x29c859){return{'model':db[_0x29c859[_0xdcea('0x1a')]],'as':_0x29c859['as'],'attributes':_0x29c859[_0xdcea('0x17')],'include':_0x29c859[_0xdcea('0x19')]?_[_0xdcea('0x18')](_0x29c859[_0xdcea('0x19')],function(_0x381244){return{'model':db[_0x381244[_0xdcea('0x1a')]],'as':_0x381244['as'],'attributes':_0x381244[_0xdcea('0x17')],'include':_0x381244[_0xdcea('0x19')]?_[_0xdcea('0x18')](_0x381244[_0xdcea('0x19')],function(_0x571d36){return{'model':db[_0x571d36['model']],'as':_0x571d36['as'],'attributes':_0x571d36[_0xdcea('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdcea('0x1b')](function(_0x47ea7d){logger[_0xdcea('0x1c')](_0xdcea('0x11'),_0x2f0bb5);logger[_0xdcea('0x1d')](_0xdcea('0x11'),_0x2f0bb5,JSON['stringify'](_0x47ea7d));_0x5e97ce(_0x47ea7d);})[_0xdcea('0x10')](function(_0xd399cd){logger[_0xdcea('0xd')](_0xdcea('0x11'),_0xd399cd[_0xdcea('0xe')],_0x2f0bb5);_0x4a8ee2(_0x4611c5[_0xdcea('0xd')](0x1f4,_0xd399cd[_0xdcea('0xe')]));});});}; \ No newline at end of file +var _0x2295=['request','then','info','Variable,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ShowVariable','find','options','raw','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x2295,0x15d));var _0x5229=function(_0x6b8c5e,_0x3ab61f){_0x6b8c5e=_0x6b8c5e-0x0;var _0x2aa7bb=_0x2295[_0x6b8c5e];return _0x2aa7bb;};'use strict';var _=require(_0x5229('0x0'));var util=require('util');var moment=require(_0x5229('0x1'));var BPromise=require(_0x5229('0x2'));var rs=require(_0x5229('0x3'));var fs=require('fs');var Redis=require(_0x5229('0x4'));var db=require(_0x5229('0x5'))['db'];var utils=require(_0x5229('0x6'));var logger=require(_0x5229('0x7'))(_0x5229('0x8'));var config=require('../../config/environment');var jayson=require(_0x5229('0x9'));var client=jayson[_0x5229('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19a132,_0x5d7870,_0x53023b){return new BPromise(function(_0x1b6de1,_0x1fc4cd){return client[_0x5229('0xb')](_0x19a132,_0x53023b)[_0x5229('0xc')](function(_0x1c6f13){logger[_0x5229('0xd')](_0x5229('0xe'),_0x5d7870,'request\x20sent');logger[_0x5229('0xf')]('Variable,\x20%s,\x20%s,\x20%s',_0x5d7870,_0x5229('0x10'),JSON[_0x5229('0x11')](_0x1c6f13));if(_0x1c6f13['error']){if(_0x1c6f13[_0x5229('0x12')][_0x5229('0x13')]===0x1f4){logger[_0x5229('0x12')]('Variable,\x20%s,\x20%s',_0x5d7870,_0x1c6f13[_0x5229('0x12')][_0x5229('0x14')]);return _0x1fc4cd(_0x1c6f13[_0x5229('0x12')][_0x5229('0x14')]);}logger[_0x5229('0x12')](_0x5229('0xe'),_0x5d7870,_0x1c6f13[_0x5229('0x12')][_0x5229('0x14')]);return _0x1b6de1(_0x1c6f13[_0x5229('0x12')][_0x5229('0x14')]);}else{logger[_0x5229('0xd')](_0x5229('0xe'),_0x5d7870,'request\x20sent');_0x1b6de1(_0x1c6f13['result'][_0x5229('0x14')]);}})[_0x5229('0x15')](function(_0x3d683c){logger['error'](_0x5229('0xe'),_0x5d7870,_0x3d683c);_0x1fc4cd(_0x3d683c);});});}exports[_0x5229('0x16')]=function(_0x21d747){var _0x4960eb=this;return new Promise(function(_0x418180,_0x36726b){return db['Variable'][_0x5229('0x17')]({'raw':_0x21d747[_0x5229('0x18')]?_0x21d747[_0x5229('0x18')][_0x5229('0x19')]===undefined?!![]:![]:!![],'where':_0x21d747['options']?_0x21d747[_0x5229('0x18')]['where']||null:null,'attributes':_0x21d747[_0x5229('0x18')]?_0x21d747[_0x5229('0x18')]['attributes']||null:null,'include':_0x21d747[_0x5229('0x18')]?_0x21d747[_0x5229('0x18')][_0x5229('0x1a')]?_[_0x5229('0x1b')](_0x21d747['options'][_0x5229('0x1a')],function(_0x1e0b22){return{'model':db[_0x1e0b22[_0x5229('0x1c')]],'as':_0x1e0b22['as'],'attributes':_0x1e0b22['attributes'],'include':_0x1e0b22[_0x5229('0x1a')]?_['map'](_0x1e0b22[_0x5229('0x1a')],function(_0x5773e9){return{'model':db[_0x5773e9[_0x5229('0x1c')]],'as':_0x5773e9['as'],'attributes':_0x5773e9[_0x5229('0x1d')],'include':_0x5773e9[_0x5229('0x1a')]?_['map'](_0x5773e9[_0x5229('0x1a')],function(_0x575e54){return{'model':db[_0x575e54[_0x5229('0x1c')]],'as':_0x575e54['as'],'attributes':_0x575e54['attributes']};}):[]};}):[]};}):[]:[]})[_0x5229('0xc')](function(_0x341b77){logger[_0x5229('0xd')](_0x5229('0x16'),_0x21d747);logger[_0x5229('0xf')](_0x5229('0x16'),_0x21d747,JSON['stringify'](_0x341b77));_0x418180(_0x341b77);})[_0x5229('0x15')](function(_0x4532e1){logger[_0x5229('0x12')]('ShowVariable',_0x4532e1['message'],_0x21d747);_0x36726b(_0x4960eb[_0x5229('0x12')](0x1f4,_0x4532e1[_0x5229('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 88864e4..bb418fb 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 _0xb7b4=['exports','express','Router','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations'];(function(_0x45aac6,_0x13dafe){var _0x535760=function(_0x3dfb4d){while(--_0x3dfb4d){_0x45aac6['push'](_0x45aac6['shift']());}};_0x535760(++_0x13dafe);}(_0xb7b4,0x122));var _0x4b7b=function(_0x433de7,_0x211c7c){_0x433de7=_0x433de7-0x0;var _0x513873=_0xb7b4[_0x433de7];return _0x513873;};'use strict';var express=require(_0x4b7b('0x0'));var router=express[_0x4b7b('0x1')]();var auth=require(_0x4b7b('0x2'));var controller=require(_0x4b7b('0x3'));router[_0x4b7b('0x4')]('/',controller['index']);router[_0x4b7b('0x4')]('/fetch',auth[_0x4b7b('0x5')](),auth[_0x4b7b('0x6')](),controller[_0x4b7b('0x7')]);router['get'](_0x4b7b('0x8'),auth[_0x4b7b('0x5')](),auth[_0x4b7b('0x6')](),controller[_0x4b7b('0x9')]);router[_0x4b7b('0x4')](_0x4b7b('0xa'),auth[_0x4b7b('0x5')](),auth[_0x4b7b('0x6')](),controller[_0x4b7b('0xb')]);router['get'](_0x4b7b('0xc'),auth[_0x4b7b('0x5')](),controller[_0x4b7b('0xd')]);router[_0x4b7b('0x4')](_0x4b7b('0xe'),controller[_0x4b7b('0xf')]);module[_0x4b7b('0x10')]=router; \ No newline at end of file +var _0x0189=['./version.controller','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x0189,0xdd));var _0x9018=function(_0x1d309d,_0x349ddb){_0x1d309d=_0x1d309d-0x0;var _0x3ce655=_0x0189[_0x1d309d];return _0x3ce655;};'use strict';var express=require(_0x9018('0x0'));var router=express[_0x9018('0x1')]();var auth=require(_0x9018('0x2'));var controller=require(_0x9018('0x3'));router[_0x9018('0x4')]('/',controller[_0x9018('0x5')]);router[_0x9018('0x4')](_0x9018('0x6'),auth['isAuthenticated'](),auth[_0x9018('0x7')](),controller[_0x9018('0x8')]);router[_0x9018('0x4')](_0x9018('0x9'),auth[_0x9018('0xa')](),auth[_0x9018('0x7')](),controller['reset']);router[_0x9018('0x4')]('/pull',auth['isAuthenticated'](),auth[_0x9018('0x7')](),controller[_0x9018('0xb')]);router[_0x9018('0x4')](_0x9018('0xc'),auth[_0x9018('0xa')](),controller[_0x9018('0xd')]);router[_0x9018('0x4')]('/migrations',controller[_0x9018('0xe')]);module[_0x9018('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 73459f2..75b19fd 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 _0x90ec=['umzug','path','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','simple-git','index','exports','query','latest','fetch','tags','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','root','server','migrations','length','.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','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','Database\x20already\x20up-to-date'];(function(_0x1b82aa,_0x541f04){var _0x511ef6=function(_0x14addc){while(--_0x14addc){_0x1b82aa['push'](_0x1b82aa['shift']());}};_0x511ef6(++_0x541f04);}(_0x90ec,0x1d4));var _0xc90e=function(_0x1ada39,_0x3cd2a6){_0x1ada39=_0x1ada39-0x0;var _0x476c8e=_0x90ec[_0x1ada39];return _0x476c8e;};'use strict';var Umzug=require(_0xc90e('0x0'));var path=require(_0xc90e('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xc90e('0x2'))(module,_0xc90e('0x3'));var compareVersions=require(_0xc90e('0x4'));var exec=require(_0xc90e('0x5'))[_0xc90e('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0xc90e('0x7'));var pm2=require(_0xc90e('0x8'));var logger=require(_0xc90e('0x9'))('update');var git=require(_0xc90e('0xa'))(config['root']);exports[_0xc90e('0xb')]=function(_0x14311a,_0x48253c){var _0x3bc98f={'current':module[_0xc90e('0xc')][_0xc90e('0x3')],'phonebar':0x2};if(_0x14311a[_0xc90e('0xd')]&&_0x14311a[_0xc90e('0xd')][_0xc90e('0xe')]){return git[_0xc90e('0xf')]()[_0xc90e('0x10')](function(_0xc4cba,_0x574156){_0x3bc98f[_0xc90e('0xe')]=(_0xc4cba?module['exports']['version']:_0x574156['latest'])||'2.0.0';return _0x48253c[_0xc90e('0x11')](0xc8)[_0xc90e('0x12')](_0x3bc98f);});}else{return _0x48253c['status'](0xc8)[_0xc90e('0x12')](_0x3bc98f);}};exports[_0xc90e('0xf')]=function(_0x52beef,_0x1ab6fb){return git[_0xc90e('0xf')]([_0xc90e('0x13'),_0xc90e('0x14')],function(_0x1de265){if(_0x1de265){logger[_0xc90e('0x15')](_0x1de265);return _0x1ab6fb['status'](0x1f4)[_0xc90e('0x12')](_0x1de265);}logger[_0xc90e('0x16')]('git\x20fetch');return _0x1ab6fb[_0xc90e('0x11')](0xc8)['json']({'output':_0xc90e('0x17')});});};exports[_0xc90e('0x18')]=function(_0x558b22,_0x934f8b){return git[_0xc90e('0x18')]([_0xc90e('0x19'),'FETCH_HEAD'],function(_0x5cf3f5){if(_0x5cf3f5){logger['error'](_0x5cf3f5);return _0x934f8b[_0xc90e('0x11')](0x1f4)[_0xc90e('0x12')](_0x5cf3f5);}logger[_0xc90e('0x16')](_0xc90e('0x1a'));return _0x934f8b[_0xc90e('0x11')](0xc8)['json']({'output':_0xc90e('0x1b')});});};exports['pull']=function(_0x3ae806,_0x3cf47c){exec('npm\x20install\x20--production',function(_0x20b839,_0x134760,_0x957d1e){logger[_0xc90e('0x16')](_0x134760);logger[_0xc90e('0x16')](_0x957d1e);if(_0x20b839){logger[_0xc90e('0x15')](_0x20b839);return _0x3cf47c[_0xc90e('0x11')](0x1f4)[_0xc90e('0x12')](_0x20b839);}return _0x3cf47c[_0xc90e('0x11')](0xc8)['json']({'output':_0x134760});});};exports[_0xc90e('0x1c')]=function(_0x41deea,_0x25223e){return pm2[_0xc90e('0x1c')](_0xc90e('0x1d'))['then'](function(_0x2e4d0c){logger[_0xc90e('0x16')](_0xc90e('0x1e'),_0x2e4d0c);return _0x25223e['status'](0xc8)[_0xc90e('0x12')]({'output':_0xc90e('0x1f')});})[_0xc90e('0x20')](function(_0x136da6){logger[_0xc90e('0x15')](_0x136da6);return _0x25223e[_0xc90e('0x11')](0x1f4)['json'](_0x136da6);});};exports['migrations']=function(_0x31e405,_0x550e8f){var _0xe8bae9=fs[_0xc90e('0x21')](path[_0xc90e('0x22')](config[_0xc90e('0x23')],_0xc90e('0x24'),_0xc90e('0x25')));var _0x42b79b=[];for(var _0x50e0d7=0x0;_0x50e0d7<_0xe8bae9[_0xc90e('0x26')];_0x50e0d7++){var _0xb2df9d=_0xe8bae9[_0x50e0d7]['replace'](_0xc90e('0x27'),'');if(compareVersions(module['exports'][_0xc90e('0x3')],_0xb2df9d)===-0x1){_0x42b79b[_0xc90e('0x28')](_0xb2df9d);}}if(_0x42b79b[_0xc90e('0x26')]){var _0x3ecbc1=_0x42b79b[_0xc90e('0x29')](compareVersions);var _0x2ecf6f=new Umzug({'storage':_0xc90e('0x2a'),'storageOptions':{'model':db[_0xc90e('0x2b')],'modelName':_0xc90e('0x2b'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0xc90e('0x2c')](),db[_0xc90e('0x2a')][_0xc90e('0x2d')],function(){throw new Error(_0xc90e('0x2e'));}],'path':path[_0xc90e('0x22')](config[_0xc90e('0x23')],_0xc90e('0x24'),_0xc90e('0x25')),'pattern':/\.js$/}});_0x2ecf6f['up']({'migrations':_[_0xc90e('0x2f')](_0x3ecbc1,function(_0x186db4){return _0x186db4+'.js';})})[_0xc90e('0x30')](function(){return _0x550e8f[_0xc90e('0x11')](0xc8)[_0xc90e('0x12')]({'output':_0xc90e('0x31')+module['exports']['version']+'\x20to\x20'+_[_0xc90e('0x32')](_0x3ecbc1),'migrations':_[_0xc90e('0x22')](_0x3ecbc1)});})[_0xc90e('0x20')](function(_0x2027f0){if(_0x2027f0 instanceof db[_0xc90e('0x2a')]['UniqueConstraintError']){return _0x550e8f[_0xc90e('0x11')](0xc8)[_0xc90e('0x12')]({'output':_0xc90e('0x33')});}else{return _0x550e8f[_0xc90e('0x11')](0x1f4)[_0xc90e('0x12')](_0x2027f0);}});}else{return _0x550e8f[_0xc90e('0x11')](0xc8)[_0xc90e('0x12')]({'output':_0xc90e('0x33')});}}; \ No newline at end of file +var _0x1751=['push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','.js'];(function(_0x29ad0f,_0x4b6c47){var _0x307a00=function(_0x8ecafb){while(--_0x8ecafb){_0x29ad0f['push'](_0x29ad0f['shift']());}};_0x307a00(++_0x4b6c47);}(_0x1751,0x76));var _0x1175=function(_0x1b30bb,_0x240504){_0x1b30bb=_0x1b30bb-0x0;var _0xf43838=_0x1751[_0x1b30bb];return _0xf43838;};'use strict';var Umzug=require(_0x1175('0x0'));var path=require(_0x1175('0x1'));var fs=require('fs');var _=require(_0x1175('0x2'));var pkginfo=require(_0x1175('0x3'))(module,'version');var compareVersions=require(_0x1175('0x4'));var exec=require(_0x1175('0x5'))[_0x1175('0x6')];var db=require(_0x1175('0x7'))['db'];var config=require(_0x1175('0x8'));var pm2=require(_0x1175('0x9'));var logger=require(_0x1175('0xa'))(_0x1175('0xb'));var git=require(_0x1175('0xc'))(config[_0x1175('0xd')]);exports[_0x1175('0xe')]=function(_0x37c744,_0x434f79){var _0xf4d43d={'current':module[_0x1175('0xf')][_0x1175('0x10')],'phonebar':0x2};if(_0x37c744[_0x1175('0x11')]&&_0x37c744[_0x1175('0x11')][_0x1175('0x12')]){return git[_0x1175('0x13')]()[_0x1175('0x14')](function(_0x34955e,_0x1b146f){_0xf4d43d[_0x1175('0x12')]=(_0x34955e?module[_0x1175('0xf')][_0x1175('0x10')]:_0x1b146f['latest'])||'2.0.0';return _0x434f79[_0x1175('0x15')](0xc8)[_0x1175('0x16')](_0xf4d43d);});}else{return _0x434f79['status'](0xc8)[_0x1175('0x16')](_0xf4d43d);}};exports[_0x1175('0x13')]=function(_0x18c21b,_0x5068d9){return git[_0x1175('0x13')]([_0x1175('0x17'),_0x1175('0x18')],function(_0x57cea4){if(_0x57cea4){logger[_0x1175('0x19')](_0x57cea4);return _0x5068d9['status'](0x1f4)[_0x1175('0x16')](_0x57cea4);}logger[_0x1175('0x1a')](_0x1175('0x1b'));return _0x5068d9[_0x1175('0x15')](0xc8)['json']({'output':_0x1175('0x1c')});});};exports[_0x1175('0x1d')]=function(_0x5e64c5,_0x50e563){return git[_0x1175('0x1d')]([_0x1175('0x1e'),_0x1175('0x1f')],function(_0xe64550){if(_0xe64550){logger[_0x1175('0x19')](_0xe64550);return _0x50e563['status'](0x1f4)[_0x1175('0x16')](_0xe64550);}logger[_0x1175('0x1a')](_0x1175('0x20'));return _0x50e563[_0x1175('0x15')](0xc8)[_0x1175('0x16')]({'output':_0x1175('0x21')});});};exports['pull']=function(_0x5e2334,_0x202e80){exec(_0x1175('0x22'),function(_0x25b59f,_0x451ff0,_0x4542c7){logger[_0x1175('0x1a')](_0x451ff0);logger[_0x1175('0x1a')](_0x4542c7);if(_0x25b59f){logger['error'](_0x25b59f);return _0x202e80[_0x1175('0x15')](0x1f4)[_0x1175('0x16')](_0x25b59f);}return _0x202e80[_0x1175('0x15')](0xc8)[_0x1175('0x16')]({'output':_0x451ff0});});};exports[_0x1175('0x23')]=function(_0x24f13d,_0x1110f2){return pm2[_0x1175('0x23')](_0x1175('0x24'))[_0x1175('0x25')](function(_0x38cf17){logger['info']('pm2\x20restart\x20motion\x20%s',_0x38cf17);return _0x1110f2['status'](0xc8)[_0x1175('0x16')]({'output':_0x1175('0x26')});})[_0x1175('0x27')](function(_0x5e4ac6){logger['error'](_0x5e4ac6);return _0x1110f2['status'](0x1f4)['json'](_0x5e4ac6);});};exports[_0x1175('0x28')]=function(_0x3db0f7,_0x1fabfb){var _0x1e29d0=fs['readdirSync'](path['join'](config[_0x1175('0xd')],_0x1175('0x29'),'migrations'));var _0x565c20=[];for(var _0x5b6bfb=0x0;_0x5b6bfb<_0x1e29d0[_0x1175('0x2a')];_0x5b6bfb++){var _0x305939=_0x1e29d0[_0x5b6bfb]['replace'](_0x1175('0x2b'),'');if(compareVersions(module[_0x1175('0xf')][_0x1175('0x10')],_0x305939)===-0x1){_0x565c20[_0x1175('0x2c')](_0x305939);}}if(_0x565c20[_0x1175('0x2a')]){var _0x2be16d=_0x565c20['sort'](compareVersions);var _0x3a32ec=new Umzug({'storage':_0x1175('0x2d'),'storageOptions':{'model':db[_0x1175('0x2e')],'modelName':_0x1175('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0x1175('0x2d')]['getQueryInterface'](),db[_0x1175('0x2d')][_0x1175('0x2f')],function(){throw new Error(_0x1175('0x30'));}],'path':path[_0x1175('0x31')](config[_0x1175('0xd')],_0x1175('0x29'),'migrations'),'pattern':/\.js$/}});_0x3a32ec['up']({'migrations':_['map'](_0x2be16d,function(_0x4cbb61){return _0x4cbb61+_0x1175('0x2b');})})[_0x1175('0x25')](function(){return _0x1fabfb[_0x1175('0x15')](0xc8)[_0x1175('0x16')]({'output':_0x1175('0x32')+module[_0x1175('0xf')]['version']+'\x20to\x20'+_[_0x1175('0x33')](_0x2be16d),'migrations':_[_0x1175('0x31')](_0x2be16d)});})[_0x1175('0x27')](function(_0x5ab64d){if(_0x5ab64d instanceof db[_0x1175('0x2d')][_0x1175('0x34')]){return _0x1fabfb[_0x1175('0x15')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1fabfb[_0x1175('0x15')](0x1f4)[_0x1175('0x16')](_0x5ab64d);}});}else{return _0x1fabfb['status'](0xc8)[_0x1175('0x16')]({'output':_0x1175('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 211d6d3..5fa8631 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 _0x3796=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x5d871a,_0x5b4079){var _0xf9c577=function(_0x42e8a0){while(--_0x42e8a0){_0x5d871a['push'](_0x5d871a['shift']());}};_0xf9c577(++_0x5b4079);}(_0x3796,0xbd));var _0x6379=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x3796[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x6379('0x0'));var util=require(_0x6379('0x1'));var path=require('path');var timeout=require(_0x6379('0x2'));var express=require(_0x6379('0x3'));var router=express[_0x6379('0x4')]();var auth=require(_0x6379('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6379('0x6'));router[_0x6379('0x7')]('/',auth[_0x6379('0x8')](),controller['index']);router['get'](_0x6379('0x9'),auth[_0x6379('0x8')](),controller[_0x6379('0xa')]);router[_0x6379('0x7')](_0x6379('0xb'),auth['isAuthenticated'](),controller[_0x6379('0xc')]);router[_0x6379('0xd')]('/',auth['isAuthenticated'](),controller[_0x6379('0xe')]);router[_0x6379('0xf')](_0x6379('0xb'),auth[_0x6379('0x8')](),controller[_0x6379('0x10')]);router[_0x6379('0x11')](_0x6379('0xb'),auth[_0x6379('0x8')](),controller[_0x6379('0x12')]);module[_0x6379('0x13')]=router; \ No newline at end of file +var _0x5ecb=['index','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ecb,0x1cd));var _0xb5ec=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0x5ecb[_0x532112];return _0x23e5fb;};'use strict';var multer=require(_0xb5ec('0x0'));var util=require(_0xb5ec('0x1'));var path=require(_0xb5ec('0x2'));var timeout=require(_0xb5ec('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb5ec('0x4'));var config=require(_0xb5ec('0x5'));var controller=require('./voiceAgentReport.controller');router[_0xb5ec('0x6')]('/',auth['isAuthenticated'](),controller[_0xb5ec('0x7')]);router[_0xb5ec('0x6')](_0xb5ec('0x8'),auth[_0xb5ec('0x9')](),controller[_0xb5ec('0xa')]);router['get'](_0xb5ec('0xb'),auth[_0xb5ec('0x9')](),controller[_0xb5ec('0xc')]);router[_0xb5ec('0xd')]('/',auth[_0xb5ec('0x9')](),controller[_0xb5ec('0xe')]);router['put']('/:id',auth[_0xb5ec('0x9')](),controller['update']);router[_0xb5ec('0xf')](_0xb5ec('0xb'),auth[_0xb5ec('0x9')](),controller[_0xb5ec('0x10')]);module[_0xb5ec('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 2716ef2..53883ee 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 _0x1cb9=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x5a7d6d,_0xd9f4c6){var _0x830b1f=function(_0x47510f){while(--_0x47510f){_0x5a7d6d['push'](_0x5a7d6d['shift']());}};_0x830b1f(++_0xd9f4c6);}(_0x1cb9,0x14e));var _0x91cb=function(_0x51b91a,_0x59953e){_0x51b91a=_0x51b91a-0x0;var _0x3a0f0f=_0x1cb9[_0x51b91a];return _0x3a0f0f;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'type':{'type':Sequelize[_0x91cb('0x1')]},'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'calleridnum':{'type':Sequelize[_0x91cb('0x1')]},'calleridname':{'type':Sequelize[_0x91cb('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x91cb('0x1')]},'membername':{'type':Sequelize[_0x91cb('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x91cb('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x91cb('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x91cb('0x2')]},'agentdumpAt':{'type':Sequelize[_0x91cb('0x2')]},'holdtime':{'type':Sequelize[_0x91cb('0x3')]},'agentcomplete':{'type':Sequelize[_0x91cb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x91cb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x91cb('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x91cb('0x1')]},'lastevent':{'type':Sequelize[_0x91cb('0x1')]},'channel':{'type':Sequelize[_0x91cb('0x1')]},'channelstate':{'type':Sequelize[_0x91cb('0x3')]},'channelstatedesc':{'type':Sequelize[_0x91cb('0x1')]},'connectedlinenum':{'type':Sequelize[_0x91cb('0x1')]},'connectedlinename':{'type':Sequelize[_0x91cb('0x1')]},'language':{'type':Sequelize[_0x91cb('0x1')]},'accountcode':{'type':Sequelize[_0x91cb('0x1')]},'context':{'type':Sequelize[_0x91cb('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x91cb('0x1')]},'destchannel':{'type':Sequelize[_0x91cb('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x91cb('0x1')]},'destcalleridnum':{'type':Sequelize[_0x91cb('0x1')]},'destcalleridname':{'type':Sequelize[_0x91cb('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x91cb('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x91cb('0x1')]},'destcontext':{'type':Sequelize[_0x91cb('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x91cb('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x91cb('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x91cb('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x91cb('0x1')],'comment':_0x91cb('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x91cb('0x1')]},'agententerreason':{'type':Sequelize[_0x91cb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f8a=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x3f8a[_0x6ca7f4];return _0x494fa6;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'type':{'type':Sequelize[_0xa3f8('0x2')]},'uniqueid':{'type':Sequelize[_0xa3f8('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa3f8('0x2')]},'queue':{'type':Sequelize[_0xa3f8('0x2')]},'interface':{'type':Sequelize[_0xa3f8('0x2')]},'membername':{'type':Sequelize[_0xa3f8('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa3f8('0x3')]},'agentconnectAt':{'type':Sequelize[_0xa3f8('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xa3f8('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xa3f8('0x3')]},'agentdumpAt':{'type':Sequelize[_0xa3f8('0x3')]},'holdtime':{'type':Sequelize[_0xa3f8('0x4')]},'agentcomplete':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa3f8('0x4')]},'agentacw':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa3f8('0x4')]},'reason':{'type':Sequelize[_0xa3f8('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa3f8('0x2')]},'channelstate':{'type':Sequelize[_0xa3f8('0x4')]},'channelstatedesc':{'type':Sequelize[_0xa3f8('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa3f8('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa3f8('0x2')]},'accountcode':{'type':Sequelize[_0xa3f8('0x2')]},'context':{'type':Sequelize[_0xa3f8('0x2')]},'exten':{'type':Sequelize[_0xa3f8('0x2')]},'priority':{'type':Sequelize[_0xa3f8('0x2')]},'destchannel':{'type':Sequelize[_0xa3f8('0x2')]},'destchannelstate':{'type':Sequelize[_0xa3f8('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xa3f8('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa3f8('0x2')]},'destcalleridname':{'type':Sequelize[_0xa3f8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa3f8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa3f8('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa3f8('0x2')]},'destcontext':{'type':Sequelize[_0xa3f8('0x2')]},'destexten':{'type':Sequelize[_0xa3f8('0x2')]},'destpriority':{'type':Sequelize[_0xa3f8('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa3f8('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa3f8('0x2')]},'transfer':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa3f8('0x2')],'comment':_0xa3f8('0x6')},'transferexten':{'type':Sequelize[_0xa3f8('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa3f8('0x2')]},'agententerreason':{'type':Sequelize[_0xa3f8('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index d2c509f..59c3493 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 _0xa9a4=['destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','error','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','VoiceAgentReport','length','create','update','body','find'];(function(_0x5538b3,_0x402023){var _0x43ddfe=function(_0x4e7870){while(--_0x4e7870){_0x5538b3['push'](_0x5538b3['shift']());}};_0x43ddfe(++_0x402023);}(_0xa9a4,0xce));var _0x4a9a=function(_0x56ee07,_0x2e402e){_0x56ee07=_0x56ee07-0x0;var _0xb71971=_0xa9a4[_0x56ee07];return _0xb71971;};'use strict';var pdf=require(_0x4a9a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4a9a('0x1'));var zipdir=require(_0x4a9a('0x2'));var jsonpatch=require(_0x4a9a('0x3'));var rp=require(_0x4a9a('0x4'));var moment=require('moment');var BPromise=require(_0x4a9a('0x5'));var Mustache=require(_0x4a9a('0x6'));var util=require('util');var path=require(_0x4a9a('0x7'));var sox=require(_0x4a9a('0x8'));var csv=require(_0x4a9a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a9a('0xa'));var squel=require('squel');var crypto=require(_0x4a9a('0xb'));var jsforce=require(_0x4a9a('0xc'));var deskjs=require(_0x4a9a('0xd'));var toCsv=require(_0x4a9a('0x9'));var querystring=require('querystring');var Papa=require(_0x4a9a('0xe'));var Redis=require(_0x4a9a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4a9a('0x10'));var as=require(_0x4a9a('0x11'));var hardwareService=require(_0x4a9a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4a9a('0x13'));var db=require(_0x4a9a('0x14'))['db'];function respondWithStatusCode(_0x2fbe7e,_0x4fde3d){_0x4fde3d=_0x4fde3d||0xcc;return function(_0x9ea96f){if(_0x9ea96f){return _0x2fbe7e[_0x4a9a('0x15')](_0x4fde3d);}return _0x2fbe7e[_0x4a9a('0x16')](_0x4fde3d)['end']();};}function respondWithResult(_0xcbd2b3,_0x451fc8){_0x451fc8=_0x451fc8||0xc8;return function(_0x5c8a9c){if(_0x5c8a9c){return _0xcbd2b3[_0x4a9a('0x16')](_0x451fc8)[_0x4a9a('0x17')](_0x5c8a9c);}};}function respondWithFilteredResult(_0x9ce2da,_0x11954c){return function(_0x2b6889){if(_0x2b6889){var _0x40e7b1=_0x2b6889[_0x4a9a('0x18')],_0x152d29=_0x11954c[_0x4a9a('0x19')],_0xb633a7=_0x11954c['offset']+_0x11954c[_0x4a9a('0x1a')],_0x1aee64;if(_0xb633a7>=_0x40e7b1){_0xb633a7=_0x40e7b1;_0x1aee64=0xc8;}else{_0x1aee64=0xce;}_0x9ce2da[_0x4a9a('0x16')](_0x1aee64);return _0x9ce2da['set'](_0x4a9a('0x1b'),_0x152d29+'-'+_0xb633a7+'/'+_0x40e7b1)[_0x4a9a('0x17')](_0x2b6889);}return null;};}function patchUpdates(_0xa8625a){return function(_0x917a30){try{jsonpatch[_0x4a9a('0x1c')](_0x917a30,_0xa8625a,!![]);}catch(_0x476b0d){return BPromise[_0x4a9a('0x1d')](_0x476b0d);}return _0x917a30[_0x4a9a('0x1e')]();};}function saveUpdates(_0x1afc3d,_0x970db4){return function(_0x50d2fb){if(_0x50d2fb){return _0x50d2fb['update'](_0x1afc3d)[_0x4a9a('0x1f')](function(_0x501024){return _0x501024;});}return null;};}function removeEntity(_0x4d153a,_0xf5fe40){return function(_0x5ea85c){if(_0x5ea85c){return _0x5ea85c['destroy']()[_0x4a9a('0x1f')](function(){_0x4d153a[_0x4a9a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19cc50,_0x53d138){return function(_0x54f037){if(!_0x54f037){_0x19cc50[_0x4a9a('0x15')](0x194);}return _0x54f037;};}function handleError(_0x1ea5f7,_0x3a3972){_0x3a3972=_0x3a3972||0x1f4;return function(_0xc2702f){logger[_0x4a9a('0x20')](_0xc2702f['stack']);if(_0xc2702f[_0x4a9a('0x21')]){delete _0xc2702f['name'];}_0x1ea5f7[_0x4a9a('0x16')](_0x3a3972)[_0x4a9a('0x22')](_0xc2702f);};}exports['index']=function(_0x57b5c6,_0x3fbd1d){var _0x45cb52={},_0x2278f3={},_0x413eea={'count':0x0,'rows':[]};var _0x3892f9=_[_0x4a9a('0x23')](db['VoiceAgentReport'][_0x4a9a('0x24')],function(_0x2c021a){return{'name':_0x2c021a[_0x4a9a('0x25')],'type':_0x2c021a[_0x4a9a('0x26')]['key']};});_0x2278f3[_0x4a9a('0x27')]=_[_0x4a9a('0x23')](_0x3892f9,_0x4a9a('0x21'));_0x2278f3['query']=_[_0x4a9a('0x28')](_0x57b5c6[_0x4a9a('0x29')]);_0x2278f3[_0x4a9a('0x2a')]=_[_0x4a9a('0x2b')](_0x2278f3['model'],_0x2278f3[_0x4a9a('0x29')]);_0x45cb52[_0x4a9a('0x2c')]=_[_0x4a9a('0x2b')](_0x2278f3[_0x4a9a('0x27')],qs[_0x4a9a('0x2d')](_0x57b5c6['query'][_0x4a9a('0x2d')]));_0x45cb52[_0x4a9a('0x2c')]=_0x45cb52[_0x4a9a('0x2c')]['length']?_0x45cb52[_0x4a9a('0x2c')]:_0x2278f3['model'];if(!_0x57b5c6[_0x4a9a('0x29')]['hasOwnProperty']('nolimit')){_0x45cb52['limit']=qs[_0x4a9a('0x1a')](_0x57b5c6[_0x4a9a('0x29')][_0x4a9a('0x1a')]);_0x45cb52['offset']=qs['offset'](_0x57b5c6[_0x4a9a('0x29')]['offset']);}_0x45cb52[_0x4a9a('0x2e')]=qs[_0x4a9a('0x2f')](_0x57b5c6[_0x4a9a('0x29')][_0x4a9a('0x2f')]);_0x45cb52['where']=qs[_0x4a9a('0x2a')](_[_0x4a9a('0x30')](_0x57b5c6[_0x4a9a('0x29')],_0x2278f3['filters']),_0x3892f9);if(_0x57b5c6['query'][_0x4a9a('0x31')]){_0x45cb52[_0x4a9a('0x32')]=_[_0x4a9a('0x33')](_0x45cb52[_0x4a9a('0x32')],{'$or':_[_0x4a9a('0x23')](_0x3892f9,function(_0x4c6ead){if(_0x4c6ead[_0x4a9a('0x26')]!==_0x4a9a('0x34')){var _0x186f92={};_0x186f92[_0x4c6ead[_0x4a9a('0x21')]]={'$like':'%'+_0x57b5c6['query'][_0x4a9a('0x31')]+'%'};return _0x186f92;}})});}_0x45cb52=_[_0x4a9a('0x33')]({},_0x45cb52,_0x57b5c6[_0x4a9a('0x35')]);var _0x516b02={'where':_0x45cb52[_0x4a9a('0x32')]};return db['VoiceAgentReport'][_0x4a9a('0x18')](_0x516b02)[_0x4a9a('0x1f')](function(_0xf995f9){_0x413eea[_0x4a9a('0x18')]=_0xf995f9;if(_0x57b5c6[_0x4a9a('0x29')][_0x4a9a('0x36')]){_0x45cb52[_0x4a9a('0x37')]=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x45cb52);})[_0x4a9a('0x1f')](function(_0x445804){_0x413eea[_0x4a9a('0x38')]=_0x445804;return _0x413eea;})[_0x4a9a('0x1f')](respondWithFilteredResult(_0x3fbd1d,_0x45cb52))[_0x4a9a('0x39')](handleError(_0x3fbd1d,null));};exports[_0x4a9a('0x3a')]=function(_0x3dc57d,_0x527077){var _0x37f891={'raw':![],'where':{'id':_0x3dc57d[_0x4a9a('0x3b')]['id']}},_0x3337d1={};_0x3337d1[_0x4a9a('0x27')]=_[_0x4a9a('0x28')](db[_0x4a9a('0x3c')][_0x4a9a('0x24')]);_0x3337d1['query']=_[_0x4a9a('0x28')](_0x3dc57d['query']);_0x3337d1[_0x4a9a('0x2a')]=_[_0x4a9a('0x2b')](_0x3337d1[_0x4a9a('0x27')],_0x3337d1[_0x4a9a('0x29')]);_0x37f891[_0x4a9a('0x2c')]=_['intersection'](_0x3337d1['model'],qs[_0x4a9a('0x2d')](_0x3dc57d[_0x4a9a('0x29')][_0x4a9a('0x2d')]));_0x37f891[_0x4a9a('0x2c')]=_0x37f891[_0x4a9a('0x2c')][_0x4a9a('0x3d')]?_0x37f891['attributes']:_0x3337d1['model'];if(_0x3dc57d[_0x4a9a('0x29')]['includeAll']){_0x37f891['include']=[{'all':!![]}];}_0x37f891=_[_0x4a9a('0x33')]({},_0x37f891,_0x3dc57d[_0x4a9a('0x35')]);return db['VoiceAgentReport']['find'](_0x37f891)[_0x4a9a('0x1f')](handleEntityNotFound(_0x527077,null))[_0x4a9a('0x1f')](respondWithResult(_0x527077,null))[_0x4a9a('0x39')](handleError(_0x527077,null));};exports['create']=function(_0x591df0,_0x328046){return db[_0x4a9a('0x3c')][_0x4a9a('0x3e')](_0x591df0['body'],{})[_0x4a9a('0x1f')](respondWithResult(_0x328046,0xc9))[_0x4a9a('0x39')](handleError(_0x328046,null));};exports[_0x4a9a('0x3f')]=function(_0x316841,_0x276612){if(_0x316841[_0x4a9a('0x40')]['id']){delete _0x316841[_0x4a9a('0x40')]['id'];}return db[_0x4a9a('0x3c')][_0x4a9a('0x41')]({'where':{'id':_0x316841[_0x4a9a('0x3b')]['id']}})[_0x4a9a('0x1f')](handleEntityNotFound(_0x276612,null))[_0x4a9a('0x1f')](saveUpdates(_0x316841[_0x4a9a('0x40')],null))[_0x4a9a('0x1f')](respondWithResult(_0x276612,null))['catch'](handleError(_0x276612,null));};exports[_0x4a9a('0x42')]=function(_0x4374be,_0x2255c1){return db[_0x4a9a('0x3c')][_0x4a9a('0x41')]({'where':{'id':_0x4374be[_0x4a9a('0x3b')]['id']}})[_0x4a9a('0x1f')](handleEntityNotFound(_0x2255c1,null))[_0x4a9a('0x1f')](removeEntity(_0x2255c1,null))[_0x4a9a('0x39')](handleError(_0x2255c1,null));};exports[_0x4a9a('0x43')]=function(_0x29c06b,_0x202c79){return db[_0x4a9a('0x3c')][_0x4a9a('0x43')]()['then'](respondWithResult(_0x202c79,null))[_0x4a9a('0x39')](handleError(_0x202c79,null));}; \ No newline at end of file +var _0xb985=['options','count','includeAll','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceAgentReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','name'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0xb985,0xe6));var _0x5b98=function(_0x3ad7ad,_0x291a8d){_0x3ad7ad=_0x3ad7ad-0x0;var _0x225a60=_0xb985[_0x3ad7ad];return _0x225a60;};'use strict';var pdf=require(_0x5b98('0x0'));var emlformat=require(_0x5b98('0x1'));var rimraf=require(_0x5b98('0x2'));var zipdir=require(_0x5b98('0x3'));var jsonpatch=require(_0x5b98('0x4'));var rp=require(_0x5b98('0x5'));var moment=require(_0x5b98('0x6'));var BPromise=require(_0x5b98('0x7'));var Mustache=require(_0x5b98('0x8'));var util=require(_0x5b98('0x9'));var path=require(_0x5b98('0xa'));var sox=require('sox');var csv=require(_0x5b98('0xb'));var ejs=require(_0x5b98('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5b98('0xd'));var crypto=require('crypto');var jsforce=require(_0x5b98('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b98('0xf'));var Papa=require('papaparse');var Redis=require(_0x5b98('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5b98('0x11'));var as=require(_0x5b98('0x12'));var hardwareService=require(_0x5b98('0x13'));var logger=require(_0x5b98('0x14'))(_0x5b98('0x15'));var utils=require(_0x5b98('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147ecd,_0x54f198){_0x54f198=_0x54f198||0xcc;return function(_0x4aa237){if(_0x4aa237){return _0x147ecd[_0x5b98('0x17')](_0x54f198);}return _0x147ecd[_0x5b98('0x18')](_0x54f198)[_0x5b98('0x19')]();};}function respondWithResult(_0x264055,_0x17a521){_0x17a521=_0x17a521||0xc8;return function(_0x41604c){if(_0x41604c){return _0x264055[_0x5b98('0x18')](_0x17a521)[_0x5b98('0x1a')](_0x41604c);}};}function respondWithFilteredResult(_0x58c4f6,_0x141aa3){return function(_0x88f735){if(_0x88f735){var _0x461a58=_0x88f735['count'],_0x3d16d8=_0x141aa3['offset'],_0x12b04b=_0x141aa3['offset']+_0x141aa3[_0x5b98('0x1b')],_0x374efa;if(_0x12b04b>=_0x461a58){_0x12b04b=_0x461a58;_0x374efa=0xc8;}else{_0x374efa=0xce;}_0x58c4f6['status'](_0x374efa);return _0x58c4f6['set'](_0x5b98('0x1c'),_0x3d16d8+'-'+_0x12b04b+'/'+_0x461a58)[_0x5b98('0x1a')](_0x88f735);}return null;};}function patchUpdates(_0x2170cf){return function(_0x1bcb25){try{jsonpatch[_0x5b98('0x1d')](_0x1bcb25,_0x2170cf,!![]);}catch(_0x1b1e98){return BPromise[_0x5b98('0x1e')](_0x1b1e98);}return _0x1bcb25[_0x5b98('0x1f')]();};}function saveUpdates(_0x53cd6d,_0x3a9a36){return function(_0x3761ef){if(_0x3761ef){return _0x3761ef[_0x5b98('0x20')](_0x53cd6d)[_0x5b98('0x21')](function(_0x5170a0){return _0x5170a0;});}return null;};}function removeEntity(_0x38a71f,_0x28ac03){return function(_0x4953b2){if(_0x4953b2){return _0x4953b2[_0x5b98('0x22')]()[_0x5b98('0x21')](function(){_0x38a71f['status'](0xcc)[_0x5b98('0x19')]();});}};}function handleEntityNotFound(_0x116beb,_0x59633f){return function(_0x209368){if(!_0x209368){_0x116beb[_0x5b98('0x17')](0x194);}return _0x209368;};}function handleError(_0x3575df,_0x3ba363){_0x3ba363=_0x3ba363||0x1f4;return function(_0x21dfe4){logger[_0x5b98('0x23')](_0x21dfe4[_0x5b98('0x24')]);if(_0x21dfe4['name']){delete _0x21dfe4['name'];}_0x3575df[_0x5b98('0x18')](_0x3ba363)[_0x5b98('0x25')](_0x21dfe4);};}exports[_0x5b98('0x26')]=function(_0x434dd3,_0x512ee5){var _0x391cf8={},_0x17a738={},_0x16f307={'count':0x0,'rows':[]};var _0x1fa317=_[_0x5b98('0x27')](db[_0x5b98('0x28')][_0x5b98('0x29')],function(_0x3df813){return{'name':_0x3df813['fieldName'],'type':_0x3df813[_0x5b98('0x2a')][_0x5b98('0x2b')]};});_0x17a738['model']=_[_0x5b98('0x27')](_0x1fa317,'name');_0x17a738[_0x5b98('0x2c')]=_[_0x5b98('0x2d')](_0x434dd3[_0x5b98('0x2c')]);_0x17a738[_0x5b98('0x2e')]=_[_0x5b98('0x2f')](_0x17a738[_0x5b98('0x30')],_0x17a738[_0x5b98('0x2c')]);_0x391cf8[_0x5b98('0x31')]=_['intersection'](_0x17a738[_0x5b98('0x30')],qs[_0x5b98('0x32')](_0x434dd3[_0x5b98('0x2c')][_0x5b98('0x32')]));_0x391cf8[_0x5b98('0x31')]=_0x391cf8[_0x5b98('0x31')][_0x5b98('0x33')]?_0x391cf8[_0x5b98('0x31')]:_0x17a738[_0x5b98('0x30')];if(!_0x434dd3[_0x5b98('0x2c')][_0x5b98('0x34')](_0x5b98('0x35'))){_0x391cf8[_0x5b98('0x1b')]=qs[_0x5b98('0x1b')](_0x434dd3[_0x5b98('0x2c')]['limit']);_0x391cf8[_0x5b98('0x36')]=qs['offset'](_0x434dd3[_0x5b98('0x2c')][_0x5b98('0x36')]);}_0x391cf8[_0x5b98('0x37')]=qs[_0x5b98('0x38')](_0x434dd3['query'][_0x5b98('0x38')]);_0x391cf8[_0x5b98('0x39')]=qs[_0x5b98('0x2e')](_['pick'](_0x434dd3[_0x5b98('0x2c')],_0x17a738[_0x5b98('0x2e')]),_0x1fa317);if(_0x434dd3[_0x5b98('0x2c')][_0x5b98('0x3a')]){_0x391cf8[_0x5b98('0x39')]=_[_0x5b98('0x3b')](_0x391cf8[_0x5b98('0x39')],{'$or':_[_0x5b98('0x27')](_0x1fa317,function(_0x183e69){if(_0x183e69['type']!==_0x5b98('0x3c')){var _0x23d6c8={};_0x23d6c8[_0x183e69[_0x5b98('0x3d')]]={'$like':'%'+_0x434dd3[_0x5b98('0x2c')][_0x5b98('0x3a')]+'%'};return _0x23d6c8;}})});}_0x391cf8=_[_0x5b98('0x3b')]({},_0x391cf8,_0x434dd3[_0x5b98('0x3e')]);var _0x14e030={'where':_0x391cf8[_0x5b98('0x39')]};return db[_0x5b98('0x28')][_0x5b98('0x3f')](_0x14e030)[_0x5b98('0x21')](function(_0x47b012){_0x16f307[_0x5b98('0x3f')]=_0x47b012;if(_0x434dd3[_0x5b98('0x2c')][_0x5b98('0x40')]){_0x391cf8['include']=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x391cf8);})[_0x5b98('0x21')](function(_0x4749cc){_0x16f307['rows']=_0x4749cc;return _0x16f307;})[_0x5b98('0x21')](respondWithFilteredResult(_0x512ee5,_0x391cf8))[_0x5b98('0x41')](handleError(_0x512ee5,null));};exports[_0x5b98('0x42')]=function(_0x27f6ae,_0x258fde){var _0x482cc6={'raw':![],'where':{'id':_0x27f6ae[_0x5b98('0x43')]['id']}},_0x5688bd={};_0x5688bd['model']=_[_0x5b98('0x2d')](db['VoiceAgentReport'][_0x5b98('0x29')]);_0x5688bd['query']=_[_0x5b98('0x2d')](_0x27f6ae[_0x5b98('0x2c')]);_0x5688bd[_0x5b98('0x2e')]=_[_0x5b98('0x2f')](_0x5688bd[_0x5b98('0x30')],_0x5688bd['query']);_0x482cc6[_0x5b98('0x31')]=_[_0x5b98('0x2f')](_0x5688bd[_0x5b98('0x30')],qs[_0x5b98('0x32')](_0x27f6ae[_0x5b98('0x2c')][_0x5b98('0x32')]));_0x482cc6[_0x5b98('0x31')]=_0x482cc6[_0x5b98('0x31')][_0x5b98('0x33')]?_0x482cc6[_0x5b98('0x31')]:_0x5688bd[_0x5b98('0x30')];if(_0x27f6ae[_0x5b98('0x2c')]['includeAll']){_0x482cc6[_0x5b98('0x44')]=[{'all':!![]}];}_0x482cc6=_['merge']({},_0x482cc6,_0x27f6ae[_0x5b98('0x3e')]);return db[_0x5b98('0x28')][_0x5b98('0x45')](_0x482cc6)[_0x5b98('0x21')](handleEntityNotFound(_0x258fde,null))['then'](respondWithResult(_0x258fde,null))[_0x5b98('0x41')](handleError(_0x258fde,null));};exports[_0x5b98('0x46')]=function(_0xc61c0c,_0x4c0f4b){return db[_0x5b98('0x28')][_0x5b98('0x46')](_0xc61c0c[_0x5b98('0x47')],{})[_0x5b98('0x21')](respondWithResult(_0x4c0f4b,0xc9))[_0x5b98('0x41')](handleError(_0x4c0f4b,null));};exports[_0x5b98('0x20')]=function(_0x19ba55,_0x3d6e4d){if(_0x19ba55[_0x5b98('0x47')]['id']){delete _0x19ba55['body']['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x19ba55['params']['id']}})[_0x5b98('0x21')](handleEntityNotFound(_0x3d6e4d,null))[_0x5b98('0x21')](saveUpdates(_0x19ba55['body'],null))[_0x5b98('0x21')](respondWithResult(_0x3d6e4d,null))[_0x5b98('0x41')](handleError(_0x3d6e4d,null));};exports[_0x5b98('0x22')]=function(_0x101046,_0x22d2db){return db[_0x5b98('0x28')][_0x5b98('0x45')]({'where':{'id':_0x101046[_0x5b98('0x43')]['id']}})['then'](handleEntityNotFound(_0x22d2db,null))['then'](removeEntity(_0x22d2db,null))[_0x5b98('0x41')](handleError(_0x22d2db,null));};exports[_0x5b98('0x48')]=function(_0x2697cd,_0x586793){return db[_0x5b98('0x28')][_0x5b98('0x48')]()[_0x5b98('0x21')](respondWithResult(_0x586793,null))['catch'](handleError(_0x586793,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index e1f3456..cffa312 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 _0xdcc5=['api','bluebird','request-promise','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger'];(function(_0xbf1133,_0x2e5436){var _0x1762c7=function(_0x38e7b1){while(--_0x38e7b1){_0xbf1133['push'](_0xbf1133['shift']());}};_0x1762c7(++_0x2e5436);}(_0xdcc5,0x189));var _0x5dcc=function(_0x198479,_0x62a12c){_0x198479=_0x198479-0x0;var _0x1b5450=_0xdcc5[_0x198479];return _0x1b5450;};'use strict';var _=require(_0x5dcc('0x0'));var util=require(_0x5dcc('0x1'));var logger=require(_0x5dcc('0x2'))(_0x5dcc('0x3'));var moment=require('moment');var BPromise=require(_0x5dcc('0x4'));var rp=require(_0x5dcc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5dcc('0x6'));module['exports']=function(_0xb4e17d,_0x922b51){return _0xb4e17d['define'](_0x5dcc('0x7'),attributes,{'tableName':_0x5dcc('0x8'),'paranoid':![],'indexes':[{'fields':[_0x5dcc('0x9'),_0x5dcc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe513=['exports','define','report_agent','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xe513,0x18b));var _0x3e51=function(_0x2ee941,_0x11094f){_0x2ee941=_0x2ee941-0x0;var _0x5b63fa=_0xe513[_0x2ee941];return _0x5b63fa;};'use strict';var _=require('lodash');var util=require(_0x3e51('0x0'));var logger=require(_0x3e51('0x1'))(_0x3e51('0x2'));var moment=require(_0x3e51('0x3'));var BPromise=require(_0x3e51('0x4'));var rp=require(_0x3e51('0x5'));var fs=require('fs');var path=require(_0x3e51('0x6'));var rimraf=require(_0x3e51('0x7'));var config=require(_0x3e51('0x8'));var attributes=require(_0x3e51('0x9'));module[_0x3e51('0xa')]=function(_0x139199,_0x1f3d8a){return _0x139199[_0x3e51('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x3e51('0xc'),'paranoid':![],'indexes':[{'fields':[_0x3e51('0xd'),_0x3e51('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 42b13ba..5e6c366 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 _0x271b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','catch','update','where','limit','UpdateVoiceAgentReport','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x271b,0x116));var _0xb271=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x271b[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xb271('0x0'));var util=require(_0xb271('0x1'));var moment=require(_0xb271('0x2'));var BPromise=require('bluebird');var rs=require(_0xb271('0x3'));var fs=require('fs');var Redis=require(_0xb271('0x4'));var db=require(_0xb271('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb271('0x6'));var jayson=require(_0xb271('0x7'));var client=jayson[_0xb271('0x8')][_0xb271('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55258d,_0x2a308a,_0x53946c){return new BPromise(function(_0x4a1dcb,_0x5a3f8c){return client[_0xb271('0xa')](_0x55258d,_0x53946c)[_0xb271('0xb')](function(_0x4d6896){logger[_0xb271('0xc')](_0xb271('0xd'),_0x2a308a,_0xb271('0xe'));logger[_0xb271('0xf')](_0xb271('0x10'),_0x2a308a,_0xb271('0xe'),JSON['stringify'](_0x4d6896));if(_0x4d6896[_0xb271('0x11')]){if(_0x4d6896[_0xb271('0x11')]['code']===0x1f4){logger[_0xb271('0x11')](_0xb271('0xd'),_0x2a308a,_0x4d6896[_0xb271('0x11')][_0xb271('0x12')]);return _0x5a3f8c(_0x4d6896['error'][_0xb271('0x12')]);}logger[_0xb271('0x11')](_0xb271('0xd'),_0x2a308a,_0x4d6896[_0xb271('0x11')]['message']);return _0x4a1dcb(_0x4d6896['error']['message']);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x2a308a,'request\x20sent');_0x4a1dcb(_0x4d6896[_0xb271('0x13')][_0xb271('0x12')]);}})['catch'](function(_0x4bdff3){logger[_0xb271('0x11')](_0xb271('0xd'),_0x2a308a,_0x4bdff3);_0x5a3f8c(_0x4bdff3);});});}exports['CreateVoiceAgentReport']=function(_0x48dc10){var _0x1d8f21=this;return new Promise(function(_0x58ee32,_0x1f24a5){return db[_0xb271('0x14')][_0xb271('0x15')](_0x48dc10[_0xb271('0x16')],{'raw':_0x48dc10[_0xb271('0x17')]?_0x48dc10['options'][_0xb271('0x18')]===undefined?!![]:![]:!![]})[_0xb271('0xb')](function(_0x554a06){logger[_0xb271('0xc')](_0xb271('0x19'),_0x48dc10);logger[_0xb271('0xf')](_0xb271('0x19'),_0x48dc10,JSON['stringify'](_0x554a06));_0x58ee32(_0x554a06);})[_0xb271('0x1a')](function(_0x196108){logger['error'](_0xb271('0x19'),_0x196108[_0xb271('0x12')],_0x48dc10);_0x1f24a5(_0x1d8f21[_0xb271('0x11')](0x1f4,_0x196108[_0xb271('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x34d531){var _0x168847=this;return new Promise(function(_0x259867,_0xf2fd84){return db[_0xb271('0x14')][_0xb271('0x1b')](_0x34d531[_0xb271('0x16')],{'raw':_0x34d531[_0xb271('0x17')]?_0x34d531['options'][_0xb271('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d531[_0xb271('0x17')]?_0x34d531[_0xb271('0x17')][_0xb271('0x1c')]||null:null,'attributes':_0x34d531['options']?_0x34d531['options']['attributes']||null:null,'limit':_0x34d531['options']?_0x34d531[_0xb271('0x17')][_0xb271('0x1d')]||null:null})['then'](function(_0x39009b){logger[_0xb271('0xc')](_0xb271('0x1e'),_0x34d531);logger[_0xb271('0xf')](_0xb271('0x1e'),_0x34d531,JSON['stringify'](_0x39009b));_0x259867(_0x39009b);})['catch'](function(_0x56512d){logger[_0xb271('0x11')](_0xb271('0x1e'),_0x56512d[_0xb271('0x12')],_0x34d531);_0xf2fd84(_0x168847[_0xb271('0x11')](0x1f4,_0x56512d[_0xb271('0x12')]));});});}; \ No newline at end of file +var _0xc971=['UpdateVoiceAgentReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug','stringify','where','attributes'];(function(_0x3a10e3,_0x3cdb35){var _0xf067c8=function(_0x184beb){while(--_0x184beb){_0x3a10e3['push'](_0x3a10e3['shift']());}};_0xf067c8(++_0x3cdb35);}(_0xc971,0x101));var _0x1c97=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xc971[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x1c97('0x0'));var util=require('util');var moment=require(_0x1c97('0x1'));var BPromise=require(_0x1c97('0x2'));var rs=require(_0x1c97('0x3'));var fs=require('fs');var Redis=require(_0x1c97('0x4'));var db=require(_0x1c97('0x5'))['db'];var utils=require(_0x1c97('0x6'));var logger=require(_0x1c97('0x7'))(_0x1c97('0x8'));var config=require(_0x1c97('0x9'));var jayson=require(_0x1c97('0xa'));var client=jayson[_0x1c97('0xb')][_0x1c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33e42c,_0x6b115f,_0x494fdc){return new BPromise(function(_0x2f5588,_0x113b30){return client['request'](_0x33e42c,_0x494fdc)[_0x1c97('0xd')](function(_0x37cc62){logger[_0x1c97('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x6b115f,_0x1c97('0xf'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x6b115f,_0x1c97('0xf'),JSON['stringify'](_0x37cc62));if(_0x37cc62[_0x1c97('0x10')]){if(_0x37cc62['error'][_0x1c97('0x11')]===0x1f4){logger[_0x1c97('0x10')](_0x1c97('0x12'),_0x6b115f,_0x37cc62[_0x1c97('0x10')][_0x1c97('0x13')]);return _0x113b30(_0x37cc62[_0x1c97('0x10')][_0x1c97('0x13')]);}logger[_0x1c97('0x10')](_0x1c97('0x12'),_0x6b115f,_0x37cc62[_0x1c97('0x10')]['message']);return _0x2f5588(_0x37cc62[_0x1c97('0x10')][_0x1c97('0x13')]);}else{logger[_0x1c97('0xe')](_0x1c97('0x12'),_0x6b115f,_0x1c97('0xf'));_0x2f5588(_0x37cc62['result'][_0x1c97('0x13')]);}})[_0x1c97('0x14')](function(_0xabddf8){logger[_0x1c97('0x10')](_0x1c97('0x12'),_0x6b115f,_0xabddf8);_0x113b30(_0xabddf8);});});}exports[_0x1c97('0x15')]=function(_0x20840c){var _0x3ab18d=this;return new Promise(function(_0x317ccf,_0xba6b39){return db[_0x1c97('0x16')][_0x1c97('0x17')](_0x20840c[_0x1c97('0x18')],{'raw':_0x20840c[_0x1c97('0x19')]?_0x20840c[_0x1c97('0x19')][_0x1c97('0x1a')]===undefined?!![]:![]:!![]})[_0x1c97('0xd')](function(_0x540443){logger['info'](_0x1c97('0x15'),_0x20840c);logger[_0x1c97('0x1b')]('CreateVoiceAgentReport',_0x20840c,JSON[_0x1c97('0x1c')](_0x540443));_0x317ccf(_0x540443);})[_0x1c97('0x14')](function(_0xd89c50){logger['error']('CreateVoiceAgentReport',_0xd89c50['message'],_0x20840c);_0xba6b39(_0x3ab18d[_0x1c97('0x10')](0x1f4,_0xd89c50[_0x1c97('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3901ae){var _0x53de77=this;return new Promise(function(_0x2ce3b2,_0x57fcad){return db[_0x1c97('0x16')]['update'](_0x3901ae[_0x1c97('0x18')],{'raw':_0x3901ae[_0x1c97('0x19')]?_0x3901ae[_0x1c97('0x19')][_0x1c97('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3901ae['options']?_0x3901ae[_0x1c97('0x19')][_0x1c97('0x1d')]||null:null,'attributes':_0x3901ae['options']?_0x3901ae[_0x1c97('0x19')][_0x1c97('0x1e')]||null:null,'limit':_0x3901ae['options']?_0x3901ae[_0x1c97('0x19')]['limit']||null:null})['then'](function(_0x2d826b){logger[_0x1c97('0xe')](_0x1c97('0x1f'),_0x3901ae);logger[_0x1c97('0x1b')](_0x1c97('0x1f'),_0x3901ae,JSON[_0x1c97('0x1c')](_0x2d826b));_0x2ce3b2(_0x2d826b);})[_0x1c97('0x14')](function(_0x3b8d12){logger[_0x1c97('0x10')](_0x1c97('0x1f'),_0x3b8d12[_0x1c97('0x13')],_0x3901ae);_0x57fcad(_0x53de77[_0x1c97('0x10')](0x1f4,_0x3b8d12['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 033cf26..14e6f68 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 _0xcec2=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0xcec2,0x150));var _0x2cec=function(_0x3c67c1,_0x232d89){_0x3c67c1=_0x3c67c1-0x0;var _0x3f006a=_0xcec2[_0x3c67c1];return _0x3f006a;};'use strict';var multer=require('multer');var util=require(_0x2cec('0x0'));var path=require(_0x2cec('0x1'));var timeout=require(_0x2cec('0x2'));var express=require(_0x2cec('0x3'));var router=express[_0x2cec('0x4')]();var auth=require(_0x2cec('0x5'));var interaction=require(_0x2cec('0x6'));var config=require(_0x2cec('0x7'));var controller=require(_0x2cec('0x8'));router[_0x2cec('0x9')]('/',auth[_0x2cec('0xa')](),controller['index']);router[_0x2cec('0x9')](_0x2cec('0xb'),auth[_0x2cec('0xa')](),controller['describe']);router[_0x2cec('0x9')](_0x2cec('0xc'),auth[_0x2cec('0xa')](),controller[_0x2cec('0xd')]);router[_0x2cec('0xe')]('/',auth[_0x2cec('0xa')](),controller['create']);router[_0x2cec('0xf')](_0x2cec('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2cec('0x10')](_0x2cec('0xc'),auth[_0x2cec('0xa')](),controller[_0x2cec('0x11')]);module[_0x2cec('0x12')]=router; \ No newline at end of file +var _0x85b1=['./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x85b1,0x1e0));var _0x185b=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x85b1[_0x4c445a];return _0x2f611c;};'use strict';var multer=require(_0x185b('0x0'));var util=require(_0x185b('0x1'));var path=require(_0x185b('0x2'));var timeout=require(_0x185b('0x3'));var express=require(_0x185b('0x4'));var router=express['Router']();var auth=require(_0x185b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x185b('0x6'));router[_0x185b('0x7')]('/',auth[_0x185b('0x8')](),controller['index']);router[_0x185b('0x7')](_0x185b('0x9'),auth[_0x185b('0x8')](),controller[_0x185b('0xa')]);router[_0x185b('0x7')](_0x185b('0xb'),auth[_0x185b('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x185b('0xc')]);router[_0x185b('0xd')](_0x185b('0xb'),auth[_0x185b('0x8')](),controller[_0x185b('0xe')]);router[_0x185b('0xf')]('/:id',auth[_0x185b('0x8')](),controller[_0x185b('0x10')]);module[_0x185b('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 214d6f7..232fdbf 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 _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x1f0ca7,_0x403fe9){var _0x107ec2=function(_0x12f7af){while(--_0x12f7af){_0x1f0ca7['push'](_0x1f0ca7['shift']());}};_0x107ec2(++_0x403fe9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x3072e2,_0x648a09){var _0x42c45b=function(_0x2ddff5){while(--_0x2ddff5){_0x3072e2['push'](_0x3072e2['shift']());}};_0x42c45b(++_0x648a09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7f4698b..57e12e5 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 _0xc117=['key','model','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','fullname','alias','User','rows','catch','params','find','create','describe','uniqueid','body','user','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','querystring','../../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','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type'];(function(_0x275cad,_0x21ea86){var _0x37b7d3=function(_0x4ca9c0){while(--_0x4ca9c0){_0x275cad['push'](_0x275cad['shift']());}};_0x37b7d3(++_0x21ea86);}(_0xc117,0x1e2));var _0x7c11=function(_0x5e6950,_0x306656){_0x5e6950=_0x5e6950-0x0;var _0x2308f2=_0xc117[_0x5e6950];return _0x2308f2;};'use strict';var pdf=require(_0x7c11('0x0'));var emlformat=require(_0x7c11('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7c11('0x2'));var jsonpatch=require(_0x7c11('0x3'));var rp=require('request-promise');var moment=require(_0x7c11('0x4'));var BPromise=require(_0x7c11('0x5'));var Mustache=require(_0x7c11('0x6'));var util=require('util');var path=require(_0x7c11('0x7'));var sox=require(_0x7c11('0x8'));var csv=require(_0x7c11('0x9'));var ejs=require(_0x7c11('0xa'));var fs=require('fs');var _=require(_0x7c11('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c11('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7c11('0x9'));var querystring=require(_0x7c11('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7c11('0xe'));var qs=require(_0x7c11('0xf'));var as=require(_0x7c11('0x10'));var hardwareService=require(_0x7c11('0x11'));var logger=require(_0x7c11('0x12'))(_0x7c11('0x13'));var utils=require(_0x7c11('0x14'));var config=require(_0x7c11('0x15'));var db=require(_0x7c11('0x16'))['db'];function respondWithStatusCode(_0x5d6c5f,_0x1d691a){_0x1d691a=_0x1d691a||0xcc;return function(_0x585cce){if(_0x585cce){return _0x5d6c5f[_0x7c11('0x17')](_0x1d691a);}return _0x5d6c5f[_0x7c11('0x18')](_0x1d691a)[_0x7c11('0x19')]();};}function respondWithResult(_0x55cca0,_0x1d850f){_0x1d850f=_0x1d850f||0xc8;return function(_0x48b450){if(_0x48b450){return _0x55cca0['status'](_0x1d850f)[_0x7c11('0x1a')](_0x48b450);}};}function respondWithFilteredResult(_0xc9a624,_0x363c0a){return function(_0x215233){if(_0x215233){var _0x29b0f9=_0x215233['count'],_0x4febcf=_0x363c0a[_0x7c11('0x1b')],_0x30a91d=_0x363c0a[_0x7c11('0x1b')]+_0x363c0a['limit'],_0x7ec3;if(_0x30a91d>=_0x29b0f9){_0x30a91d=_0x29b0f9;_0x7ec3=0xc8;}else{_0x7ec3=0xce;}_0xc9a624['status'](_0x7ec3);return _0xc9a624[_0x7c11('0x1c')](_0x7c11('0x1d'),_0x4febcf+'-'+_0x30a91d+'/'+_0x29b0f9)[_0x7c11('0x1a')](_0x215233);}return null;};}function patchUpdates(_0x37c2de){return function(_0x257e26){try{jsonpatch['apply'](_0x257e26,_0x37c2de,!![]);}catch(_0x258382){return BPromise[_0x7c11('0x1e')](_0x258382);}return _0x257e26['save']();};}function saveUpdates(_0x15c1cb,_0x294fd1){return function(_0x47ad62){if(_0x47ad62){return _0x47ad62[_0x7c11('0x1f')](_0x15c1cb)[_0x7c11('0x20')](function(_0x2dbec9){return _0x2dbec9;});}return null;};}function removeEntity(_0x300667,_0x45d60b){return function(_0x2efb6f){if(_0x2efb6f){return _0x2efb6f[_0x7c11('0x21')]()['then'](function(){_0x300667[_0x7c11('0x18')](0xcc)[_0x7c11('0x19')]();});}};}function handleEntityNotFound(_0x3248dd,_0x1d442d){return function(_0x113e79){if(!_0x113e79){_0x3248dd[_0x7c11('0x17')](0x194);}return _0x113e79;};}function handleError(_0x164b24,_0x4e6606){_0x4e6606=_0x4e6606||0x1f4;return function(_0x137cc9){logger['error'](_0x137cc9[_0x7c11('0x22')]);if(_0x137cc9[_0x7c11('0x23')]){delete _0x137cc9[_0x7c11('0x23')];}_0x164b24[_0x7c11('0x18')](_0x4e6606)[_0x7c11('0x24')](_0x137cc9);};}exports[_0x7c11('0x25')]=function(_0x37590e,_0xdfa439){var _0x4118df={},_0x349fd7={},_0x45c9c1={'count':0x0,'rows':[]};var _0x232874=_[_0x7c11('0x26')](db[_0x7c11('0x27')][_0x7c11('0x28')],function(_0x1dccfb){return{'name':_0x1dccfb[_0x7c11('0x29')],'type':_0x1dccfb[_0x7c11('0x2a')][_0x7c11('0x2b')]};});_0x349fd7[_0x7c11('0x2c')]=_['map'](_0x232874,_0x7c11('0x23'));_0x349fd7['query']=_[_0x7c11('0x2d')](_0x37590e['query']);_0x349fd7[_0x7c11('0x2e')]=_[_0x7c11('0x2f')](_0x349fd7['model'],_0x349fd7['query']);_0x4118df['attributes']=_[_0x7c11('0x2f')](_0x349fd7[_0x7c11('0x2c')],qs['fields'](_0x37590e['query'][_0x7c11('0x30')]));_0x4118df[_0x7c11('0x31')]=_0x4118df['attributes'][_0x7c11('0x32')]?_0x4118df[_0x7c11('0x31')]:_0x349fd7[_0x7c11('0x2c')];if(!_0x37590e[_0x7c11('0x33')][_0x7c11('0x34')]('nolimit')){_0x4118df[_0x7c11('0x35')]=qs[_0x7c11('0x35')](_0x37590e[_0x7c11('0x33')][_0x7c11('0x35')]);_0x4118df[_0x7c11('0x1b')]=qs[_0x7c11('0x1b')](_0x37590e[_0x7c11('0x33')][_0x7c11('0x1b')]);}_0x4118df[_0x7c11('0x36')]=qs[_0x7c11('0x37')](_0x37590e[_0x7c11('0x33')]['sort']);_0x4118df[_0x7c11('0x38')]=qs[_0x7c11('0x2e')](_[_0x7c11('0x39')](_0x37590e[_0x7c11('0x33')],_0x349fd7['filters']),_0x232874);if(_0x37590e[_0x7c11('0x33')]['filter']){_0x4118df[_0x7c11('0x38')]=_[_0x7c11('0x3a')](_0x4118df['where'],{'$or':_[_0x7c11('0x26')](_0x232874,function(_0xc5fa3a){if(_0xc5fa3a[_0x7c11('0x2a')]!==_0x7c11('0x3b')){var _0x368bfb={};_0x368bfb[_0xc5fa3a[_0x7c11('0x23')]]={'$like':'%'+_0x37590e[_0x7c11('0x33')]['filter']+'%'};return _0x368bfb;}})});}_0x4118df=_[_0x7c11('0x3a')]({},_0x4118df,_0x37590e[_0x7c11('0x3c')]);var _0x1a22e0={'where':_0x4118df['where']};return db[_0x7c11('0x27')]['count'](_0x1a22e0)[_0x7c11('0x20')](function(_0xe5eabf){_0x45c9c1['count']=_0xe5eabf;if(_0x37590e[_0x7c11('0x33')][_0x7c11('0x3d')]){_0x4118df[_0x7c11('0x3e')]=[{'attributes':['id',_0x7c11('0x23'),_0x7c11('0x3f'),_0x7c11('0x40')],'model':db['User'],'as':_0x7c11('0x41')}];}return db['VoiceCallReport']['findAll'](_0x4118df);})['then'](function(_0x3a9e32){_0x45c9c1[_0x7c11('0x42')]=_0x3a9e32;return _0x45c9c1;})[_0x7c11('0x20')](respondWithFilteredResult(_0xdfa439,_0x4118df))[_0x7c11('0x43')](handleError(_0xdfa439,null));};exports['show']=function(_0x57f120,_0x51567c){var _0x2285b2={'raw':!![],'where':{'id':_0x57f120[_0x7c11('0x44')]['id']}},_0x14dfd4={};_0x14dfd4['model']=_[_0x7c11('0x2d')](db[_0x7c11('0x27')][_0x7c11('0x28')]);_0x14dfd4['query']=_[_0x7c11('0x2d')](_0x57f120[_0x7c11('0x33')]);_0x14dfd4[_0x7c11('0x2e')]=_[_0x7c11('0x2f')](_0x14dfd4[_0x7c11('0x2c')],_0x14dfd4[_0x7c11('0x33')]);_0x2285b2['attributes']=_[_0x7c11('0x2f')](_0x14dfd4[_0x7c11('0x2c')],qs[_0x7c11('0x30')](_0x57f120[_0x7c11('0x33')][_0x7c11('0x30')]));_0x2285b2[_0x7c11('0x31')]=_0x2285b2[_0x7c11('0x31')][_0x7c11('0x32')]?_0x2285b2[_0x7c11('0x31')]:_0x14dfd4['model'];if(_0x57f120[_0x7c11('0x33')]['includeAll']){_0x2285b2[_0x7c11('0x3e')]=[{'all':!![]}];}_0x2285b2=_[_0x7c11('0x3a')]({},_0x2285b2,_0x57f120[_0x7c11('0x3c')]);return db[_0x7c11('0x27')][_0x7c11('0x45')](_0x2285b2)[_0x7c11('0x20')](handleEntityNotFound(_0x51567c,null))['then'](respondWithResult(_0x51567c,null))[_0x7c11('0x43')](handleError(_0x51567c,null));};exports[_0x7c11('0x46')]=function(_0x482d75,_0xa22aaa){return db[_0x7c11('0x27')]['create'](_0x482d75['body'],{})[_0x7c11('0x20')](respondWithResult(_0xa22aaa,0xc9))[_0x7c11('0x43')](handleError(_0xa22aaa,null));};exports['destroy']=function(_0x246132,_0x3e79dd){return db[_0x7c11('0x27')][_0x7c11('0x45')]({'where':{'id':_0x246132[_0x7c11('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e79dd,null))[_0x7c11('0x20')](removeEntity(_0x3e79dd,null))[_0x7c11('0x43')](handleError(_0x3e79dd,null));};exports[_0x7c11('0x47')]=function(_0x3479cd,_0xf0721b){return db[_0x7c11('0x27')][_0x7c11('0x47')]()[_0x7c11('0x20')](respondWithResult(_0xf0721b,null))['catch'](handleError(_0xf0721b,null));};exports[_0x7c11('0x1f')]=function(_0x4e7558,_0x49b254){if(_0x4e7558['body'][_0x7c11('0x48')]){delete _0x4e7558[_0x7c11('0x49')][_0x7c11('0x48')];}return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x4e7558['params']['id'],'UserId':{'$or':[null,_0x4e7558[_0x7c11('0x4a')]['id']]}}})['then'](handleEntityNotFound(_0x49b254,null))[_0x7c11('0x20')](saveUpdates(_0x4e7558[_0x7c11('0x49')],null))[_0x7c11('0x20')](respondWithResult(_0x49b254,null))[_0x7c11('0x43')](handleError(_0x49b254,null));}; \ No newline at end of file +var _0xdf0c=['update','destroy','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','then','include','alias','User','findAll','rows','catch','show','params','keys','includeAll','merge','find','create','body','describe','uniqueid','user','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x3a2097,_0x41db24){var _0x20a867=function(_0x1d3b17){while(--_0x1d3b17){_0x3a2097['push'](_0x3a2097['shift']());}};_0x20a867(++_0x41db24);}(_0xdf0c,0xcb));var _0xcdf0=function(_0x352713,_0x737610){_0x352713=_0x352713-0x0;var _0x46a4ea=_0xdf0c[_0x352713];return _0x46a4ea;};'use strict';var pdf=require(_0xcdf0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcdf0('0x1'));var zipdir=require(_0xcdf0('0x2'));var jsonpatch=require(_0xcdf0('0x3'));var rp=require(_0xcdf0('0x4'));var moment=require('moment');var BPromise=require(_0xcdf0('0x5'));var Mustache=require('mustache');var util=require(_0xcdf0('0x6'));var path=require(_0xcdf0('0x7'));var sox=require(_0xcdf0('0x8'));var csv=require(_0xcdf0('0x9'));var ejs=require(_0xcdf0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcdf0('0xb'));var jsforce=require(_0xcdf0('0xc'));var deskjs=require(_0xcdf0('0xd'));var toCsv=require(_0xcdf0('0x9'));var querystring=require(_0xcdf0('0xe'));var Papa=require(_0xcdf0('0xf'));var Redis=require(_0xcdf0('0x10'));var authService=require(_0xcdf0('0x11'));var qs=require(_0xcdf0('0x12'));var as=require(_0xcdf0('0x13'));var hardwareService=require(_0xcdf0('0x14'));var logger=require(_0xcdf0('0x15'))(_0xcdf0('0x16'));var utils=require('../../config/utils');var config=require(_0xcdf0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f99c5,_0x278036){_0x278036=_0x278036||0xcc;return function(_0x131d83){if(_0x131d83){return _0x4f99c5[_0xcdf0('0x18')](_0x278036);}return _0x4f99c5[_0xcdf0('0x19')](_0x278036)[_0xcdf0('0x1a')]();};}function respondWithResult(_0x2aa0d8,_0x191ea6){_0x191ea6=_0x191ea6||0xc8;return function(_0xa2aea){if(_0xa2aea){return _0x2aa0d8[_0xcdf0('0x19')](_0x191ea6)[_0xcdf0('0x1b')](_0xa2aea);}};}function respondWithFilteredResult(_0x3fb18f,_0xc46825){return function(_0x2ad35c){if(_0x2ad35c){var _0x1ed6d3=_0x2ad35c[_0xcdf0('0x1c')],_0x15cbdc=_0xc46825['offset'],_0x3ba13c=_0xc46825[_0xcdf0('0x1d')]+_0xc46825[_0xcdf0('0x1e')],_0x4e97d3;if(_0x3ba13c>=_0x1ed6d3){_0x3ba13c=_0x1ed6d3;_0x4e97d3=0xc8;}else{_0x4e97d3=0xce;}_0x3fb18f['status'](_0x4e97d3);return _0x3fb18f[_0xcdf0('0x1f')](_0xcdf0('0x20'),_0x15cbdc+'-'+_0x3ba13c+'/'+_0x1ed6d3)['json'](_0x2ad35c);}return null;};}function patchUpdates(_0x152d8f){return function(_0x112329){try{jsonpatch[_0xcdf0('0x21')](_0x112329,_0x152d8f,!![]);}catch(_0x29d917){return BPromise['reject'](_0x29d917);}return _0x112329['save']();};}function saveUpdates(_0x223307,_0x236868){return function(_0x3fca2e){if(_0x3fca2e){return _0x3fca2e[_0xcdf0('0x22')](_0x223307)['then'](function(_0x2700ba){return _0x2700ba;});}return null;};}function removeEntity(_0x5b0519,_0x25abc1){return function(_0xd3884e){if(_0xd3884e){return _0xd3884e[_0xcdf0('0x23')]()['then'](function(){_0x5b0519[_0xcdf0('0x19')](0xcc)[_0xcdf0('0x1a')]();});}};}function handleEntityNotFound(_0x1f2d09,_0x578188){return function(_0x4c1c1b){if(!_0x4c1c1b){_0x1f2d09[_0xcdf0('0x18')](0x194);}return _0x4c1c1b;};}function handleError(_0x2026dd,_0x440cf5){_0x440cf5=_0x440cf5||0x1f4;return function(_0x814cd6){logger[_0xcdf0('0x24')](_0x814cd6[_0xcdf0('0x25')]);if(_0x814cd6[_0xcdf0('0x26')]){delete _0x814cd6[_0xcdf0('0x26')];}_0x2026dd[_0xcdf0('0x19')](_0x440cf5)[_0xcdf0('0x27')](_0x814cd6);};}exports[_0xcdf0('0x28')]=function(_0x49f15f,_0x2c9275){var _0x3be088={},_0x4bccba={},_0x497e20={'count':0x0,'rows':[]};var _0xbc29dc=_[_0xcdf0('0x29')](db[_0xcdf0('0x2a')][_0xcdf0('0x2b')],function(_0x1096d2){return{'name':_0x1096d2['fieldName'],'type':_0x1096d2[_0xcdf0('0x2c')][_0xcdf0('0x2d')]};});_0x4bccba[_0xcdf0('0x2e')]=_['map'](_0xbc29dc,_0xcdf0('0x26'));_0x4bccba[_0xcdf0('0x2f')]=_['keys'](_0x49f15f[_0xcdf0('0x2f')]);_0x4bccba[_0xcdf0('0x30')]=_[_0xcdf0('0x31')](_0x4bccba[_0xcdf0('0x2e')],_0x4bccba[_0xcdf0('0x2f')]);_0x3be088[_0xcdf0('0x32')]=_[_0xcdf0('0x31')](_0x4bccba[_0xcdf0('0x2e')],qs[_0xcdf0('0x33')](_0x49f15f[_0xcdf0('0x2f')]['fields']));_0x3be088['attributes']=_0x3be088[_0xcdf0('0x32')][_0xcdf0('0x34')]?_0x3be088['attributes']:_0x4bccba[_0xcdf0('0x2e')];if(!_0x49f15f[_0xcdf0('0x2f')][_0xcdf0('0x35')](_0xcdf0('0x36'))){_0x3be088['limit']=qs['limit'](_0x49f15f[_0xcdf0('0x2f')][_0xcdf0('0x1e')]);_0x3be088['offset']=qs['offset'](_0x49f15f[_0xcdf0('0x2f')][_0xcdf0('0x1d')]);}_0x3be088[_0xcdf0('0x37')]=qs['sort'](_0x49f15f[_0xcdf0('0x2f')]['sort']);_0x3be088[_0xcdf0('0x38')]=qs['filters'](_[_0xcdf0('0x39')](_0x49f15f[_0xcdf0('0x2f')],_0x4bccba[_0xcdf0('0x30')]),_0xbc29dc);if(_0x49f15f['query'][_0xcdf0('0x3a')]){_0x3be088[_0xcdf0('0x38')]=_['merge'](_0x3be088[_0xcdf0('0x38')],{'$or':_['map'](_0xbc29dc,function(_0x53fb21){if(_0x53fb21[_0xcdf0('0x2c')]!==_0xcdf0('0x3b')){var _0x5a175c={};_0x5a175c[_0x53fb21['name']]={'$like':'%'+_0x49f15f['query'][_0xcdf0('0x3a')]+'%'};return _0x5a175c;}})});}_0x3be088=_['merge']({},_0x3be088,_0x49f15f[_0xcdf0('0x3c')]);var _0xe64d21={'where':_0x3be088[_0xcdf0('0x38')]};return db['VoiceCallReport']['count'](_0xe64d21)[_0xcdf0('0x3d')](function(_0x43a523){_0x497e20[_0xcdf0('0x1c')]=_0x43a523;if(_0x49f15f[_0xcdf0('0x2f')]['includeAll']){_0x3be088[_0xcdf0('0x3e')]=[{'attributes':['id',_0xcdf0('0x26'),'fullname',_0xcdf0('0x3f')],'model':db[_0xcdf0('0x40')],'as':_0xcdf0('0x40')}];}return db['VoiceCallReport'][_0xcdf0('0x41')](_0x3be088);})['then'](function(_0x1b5e05){_0x497e20[_0xcdf0('0x42')]=_0x1b5e05;return _0x497e20;})[_0xcdf0('0x3d')](respondWithFilteredResult(_0x2c9275,_0x3be088))[_0xcdf0('0x43')](handleError(_0x2c9275,null));};exports[_0xcdf0('0x44')]=function(_0x1074ea,_0xdda0e){var _0x2d838d={'raw':!![],'where':{'id':_0x1074ea[_0xcdf0('0x45')]['id']}},_0x32f856={};_0x32f856[_0xcdf0('0x2e')]=_['keys'](db['VoiceCallReport']['rawAttributes']);_0x32f856[_0xcdf0('0x2f')]=_[_0xcdf0('0x46')](_0x1074ea[_0xcdf0('0x2f')]);_0x32f856[_0xcdf0('0x30')]=_[_0xcdf0('0x31')](_0x32f856[_0xcdf0('0x2e')],_0x32f856['query']);_0x2d838d[_0xcdf0('0x32')]=_[_0xcdf0('0x31')](_0x32f856[_0xcdf0('0x2e')],qs[_0xcdf0('0x33')](_0x1074ea['query']['fields']));_0x2d838d[_0xcdf0('0x32')]=_0x2d838d['attributes'][_0xcdf0('0x34')]?_0x2d838d[_0xcdf0('0x32')]:_0x32f856[_0xcdf0('0x2e')];if(_0x1074ea['query'][_0xcdf0('0x47')]){_0x2d838d['include']=[{'all':!![]}];}_0x2d838d=_[_0xcdf0('0x48')]({},_0x2d838d,_0x1074ea['options']);return db[_0xcdf0('0x2a')][_0xcdf0('0x49')](_0x2d838d)[_0xcdf0('0x3d')](handleEntityNotFound(_0xdda0e,null))[_0xcdf0('0x3d')](respondWithResult(_0xdda0e,null))[_0xcdf0('0x43')](handleError(_0xdda0e,null));};exports['create']=function(_0x357216,_0x3627ad){return db[_0xcdf0('0x2a')][_0xcdf0('0x4a')](_0x357216[_0xcdf0('0x4b')],{})[_0xcdf0('0x3d')](respondWithResult(_0x3627ad,0xc9))[_0xcdf0('0x43')](handleError(_0x3627ad,null));};exports[_0xcdf0('0x23')]=function(_0x4d5268,_0x3564ce){return db[_0xcdf0('0x2a')][_0xcdf0('0x49')]({'where':{'id':_0x4d5268[_0xcdf0('0x45')]['id']}})[_0xcdf0('0x3d')](handleEntityNotFound(_0x3564ce,null))['then'](removeEntity(_0x3564ce,null))[_0xcdf0('0x43')](handleError(_0x3564ce,null));};exports[_0xcdf0('0x4c')]=function(_0x552484,_0x292600){return db[_0xcdf0('0x2a')][_0xcdf0('0x4c')]()[_0xcdf0('0x3d')](respondWithResult(_0x292600,null))['catch'](handleError(_0x292600,null));};exports['update']=function(_0x21e380,_0x5f369a){if(_0x21e380[_0xcdf0('0x4b')][_0xcdf0('0x4d')]){delete _0x21e380[_0xcdf0('0x4b')]['uniqueid'];}return db[_0xcdf0('0x2a')][_0xcdf0('0x49')]({'where':{'uniqueid':_0x21e380['params']['id'],'UserId':{'$or':[null,_0x21e380[_0xcdf0('0x4e')]['id']]}}})[_0xcdf0('0x3d')](handleEntityNotFound(_0x5f369a,null))[_0xcdf0('0x3d')](saveUpdates(_0x21e380['body'],null))['then'](respondWithResult(_0x5f369a,null))[_0xcdf0('0x43')](handleError(_0x5f369a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 18e7f84..7e0af34 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 _0xd719=['request-promise','path','rimraf','exports','report_call','uniqueid','util','api','bluebird'];(function(_0x2b461e,_0x583d16){var _0x43978a=function(_0x596a7d){while(--_0x596a7d){_0x2b461e['push'](_0x2b461e['shift']());}};_0x43978a(++_0x583d16);}(_0xd719,0x12f));var _0x9d71=function(_0x104683,_0x2f6816){_0x104683=_0x104683-0x0;var _0x5064f2=_0xd719[_0x104683];return _0x5064f2;};'use strict';var _=require('lodash');var util=require(_0x9d71('0x0'));var logger=require('../../config/logger')(_0x9d71('0x1'));var moment=require('moment');var BPromise=require(_0x9d71('0x2'));var rp=require(_0x9d71('0x3'));var fs=require('fs');var path=require(_0x9d71('0x4'));var rimraf=require(_0x9d71('0x5'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x9d71('0x6')]=function(_0x34a525,_0x146ce7){return _0x34a525['define']('VoiceCallReport',attributes,{'tableName':_0x9d71('0x7'),'paranoid':![],'indexes':[{'fields':[_0x9d71('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ffc=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x17e11a,_0x1f071c){var _0x2ab122=function(_0x2e8b2d){while(--_0x2e8b2d){_0x17e11a['push'](_0x17e11a['shift']());}};_0x2ab122(++_0x1f071c);}(_0x2ffc,0xf3));var _0xc2ff=function(_0x37f3b3,_0x1c33ea){_0x37f3b3=_0x37f3b3-0x0;var _0x310b96=_0x2ffc[_0x37f3b3];return _0x310b96;};'use strict';var _=require(_0xc2ff('0x0'));var util=require(_0xc2ff('0x1'));var logger=require(_0xc2ff('0x2'))(_0xc2ff('0x3'));var moment=require(_0xc2ff('0x4'));var BPromise=require(_0xc2ff('0x5'));var rp=require(_0xc2ff('0x6'));var fs=require('fs');var path=require(_0xc2ff('0x7'));var rimraf=require('rimraf');var config=require(_0xc2ff('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x27f35c,_0x201115){return _0x27f35c['define'](_0xc2ff('0x9'),attributes,{'tableName':_0xc2ff('0xa'),'paranoid':![],'indexes':[{'fields':[_0xc2ff('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 229f26c..3189f20 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 _0x4a7f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','then','catch','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a7f,0xd1));var _0xf4a7=function(_0x342433,_0x1c7091){_0x342433=_0x342433-0x0;var _0x2a5cd6=_0x4a7f[_0x342433];return _0x2a5cd6;};'use strict';var _=require(_0xf4a7('0x0'));var util=require(_0xf4a7('0x1'));var moment=require(_0xf4a7('0x2'));var BPromise=require(_0xf4a7('0x3'));var rs=require(_0xf4a7('0x4'));var fs=require('fs');var Redis=require(_0xf4a7('0x5'));var db=require(_0xf4a7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4a7('0x7'));var config=require(_0xf4a7('0x8'));var jayson=require(_0xf4a7('0x9'));var client=jayson[_0xf4a7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c40d,_0x217b7c,_0xc87e11){return new BPromise(function(_0x247493,_0x3c1699){return client['request'](_0x42c40d,_0xc87e11)['then'](function(_0x39744a){logger[_0xf4a7('0xb')](_0xf4a7('0xc'),_0x217b7c,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x217b7c,_0xf4a7('0xd'),JSON[_0xf4a7('0xe')](_0x39744a));if(_0x39744a[_0xf4a7('0xf')]){if(_0x39744a['error'][_0xf4a7('0x10')]===0x1f4){logger[_0xf4a7('0xf')](_0xf4a7('0xc'),_0x217b7c,_0x39744a[_0xf4a7('0xf')][_0xf4a7('0x11')]);return _0x3c1699(_0x39744a[_0xf4a7('0xf')][_0xf4a7('0x11')]);}logger[_0xf4a7('0xf')](_0xf4a7('0xc'),_0x217b7c,_0x39744a[_0xf4a7('0xf')][_0xf4a7('0x11')]);return _0x247493(_0x39744a[_0xf4a7('0xf')][_0xf4a7('0x11')]);}else{logger[_0xf4a7('0xb')](_0xf4a7('0xc'),_0x217b7c,_0xf4a7('0xd'));_0x247493(_0x39744a['result'][_0xf4a7('0x11')]);}})['catch'](function(_0xb2728d){logger[_0xf4a7('0xf')](_0xf4a7('0xc'),_0x217b7c,_0xb2728d);_0x3c1699(_0xb2728d);});});}exports[_0xf4a7('0x12')]=function(_0xb60e9b){var _0x5eff30=this;return new Promise(function(_0x3741eb,_0x28897a){return db[_0xf4a7('0x13')][_0xf4a7('0x14')]({'raw':_0xb60e9b['options']?_0xb60e9b[_0xf4a7('0x15')][_0xf4a7('0x16')]===undefined?!![]:![]:!![],'where':_0xb60e9b[_0xf4a7('0x15')]?_0xb60e9b[_0xf4a7('0x15')]['where']||null:null,'attributes':_0xb60e9b[_0xf4a7('0x15')]?_0xb60e9b[_0xf4a7('0x15')][_0xf4a7('0x17')]||null:null,'limit':_0xb60e9b[_0xf4a7('0x15')]?_0xb60e9b[_0xf4a7('0x15')][_0xf4a7('0x18')]||null:null,'include':_0xb60e9b[_0xf4a7('0x15')]?_0xb60e9b[_0xf4a7('0x15')][_0xf4a7('0x19')]?_['map'](_0xb60e9b[_0xf4a7('0x15')][_0xf4a7('0x19')],function(_0x4eb4a1){return{'model':db[_0x4eb4a1['model']],'as':_0x4eb4a1['as'],'attributes':_0x4eb4a1['attributes'],'include':_0x4eb4a1[_0xf4a7('0x19')]?_[_0xf4a7('0x1a')](_0x4eb4a1[_0xf4a7('0x19')],function(_0x1d08a5){return{'model':db[_0x1d08a5[_0xf4a7('0x1b')]],'as':_0x1d08a5['as'],'attributes':_0x1d08a5[_0xf4a7('0x17')],'include':_0x1d08a5[_0xf4a7('0x19')]?_['map'](_0x1d08a5['include'],function(_0x1ec984){return{'model':db[_0x1ec984['model']],'as':_0x1ec984['as'],'attributes':_0x1ec984[_0xf4a7('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf4a7('0x1c')](function(_0x5551e7){logger[_0xf4a7('0xb')](_0xf4a7('0x12'),_0xb60e9b);logger['debug'](_0xf4a7('0x12'),_0xb60e9b,JSON[_0xf4a7('0xe')](_0x5551e7));_0x3741eb(_0x5551e7);})[_0xf4a7('0x1d')](function(_0x446e93){logger[_0xf4a7('0xf')](_0xf4a7('0x12'),_0x446e93[_0xf4a7('0x11')],_0xb60e9b);_0x28897a(_0x5eff30['error'](0x1f4,_0x446e93[_0xf4a7('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x443fff){var _0x2711ef=this;return new Promise(function(_0x41eb7c,_0x314824){return db[_0xf4a7('0x13')][_0xf4a7('0x1e')](_0x443fff[_0xf4a7('0x1f')],{'raw':_0x443fff[_0xf4a7('0x15')]?_0x443fff['options']['raw']===undefined?!![]:![]:!![]})[_0xf4a7('0x1c')](function(_0x3264ef){logger['info'](_0xf4a7('0x20'),_0x443fff);logger['debug'](_0xf4a7('0x20'),_0x443fff,JSON[_0xf4a7('0xe')](_0x3264ef));_0x41eb7c(_0x3264ef);})[_0xf4a7('0x1d')](function(_0x394e0d){logger[_0xf4a7('0xf')]('CreateVoiceCallReport',_0x394e0d[_0xf4a7('0x11')],_0x443fff);_0x314824(_0x2711ef[_0xf4a7('0xf')](0x1f4,_0x394e0d['message']));});});};exports[_0xf4a7('0x21')]=function(_0x2694ec){var _0x3a4008=this;return new Promise(function(_0x53d192,_0x1deebf){return db['VoiceCallReport'][_0xf4a7('0x22')](_0x2694ec[_0xf4a7('0x1f')],{'raw':_0x2694ec['options']?_0x2694ec[_0xf4a7('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2694ec['options']?_0x2694ec['options']['where']||null:null,'attributes':_0x2694ec[_0xf4a7('0x15')]?_0x2694ec[_0xf4a7('0x15')][_0xf4a7('0x17')]||null:null,'limit':_0x2694ec[_0xf4a7('0x15')]?_0x2694ec[_0xf4a7('0x15')][_0xf4a7('0x18')]||null:null})[_0xf4a7('0x1c')](function(_0x53fcff){logger[_0xf4a7('0xb')](_0xf4a7('0x21'),_0x2694ec);logger['debug'](_0xf4a7('0x21'),_0x2694ec,JSON[_0xf4a7('0xe')](_0x53fcff));_0x53d192(_0x53fcff);})[_0xf4a7('0x1d')](function(_0x4f0b76){logger[_0xf4a7('0xf')](_0xf4a7('0x21'),_0x4f0b76[_0xf4a7('0x11')],_0x2694ec);_0x1deebf(_0x3a4008[_0xf4a7('0xf')](0x1f4,_0x4f0b76[_0xf4a7('0x11')]));});});}; \ No newline at end of file +var _0x21d4=['model','GetVoiceCallReport','CreateVoiceCallReport','create','raw','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceCallReport','findAll','options','where','attributes','limit','include','map'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x21d4,0xa3));var _0x421d=function(_0x4311f3,_0x2400c9){_0x4311f3=_0x4311f3-0x0;var _0xad37a7=_0x21d4[_0x4311f3];return _0xad37a7;};'use strict';var _=require(_0x421d('0x0'));var util=require(_0x421d('0x1'));var moment=require(_0x421d('0x2'));var BPromise=require(_0x421d('0x3'));var rs=require(_0x421d('0x4'));var fs=require('fs');var Redis=require(_0x421d('0x5'));var db=require(_0x421d('0x6'))['db'];var utils=require(_0x421d('0x7'));var logger=require(_0x421d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x421d('0x9'));var client=jayson[_0x421d('0xa')][_0x421d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x342ea5,_0x39a252,_0x233625){return new BPromise(function(_0x9a07ff,_0x29110f){return client['request'](_0x342ea5,_0x233625)[_0x421d('0xc')](function(_0x57480a){logger[_0x421d('0xd')](_0x421d('0xe'),_0x39a252,'request\x20sent');logger[_0x421d('0xf')](_0x421d('0x10'),_0x39a252,_0x421d('0x11'),JSON[_0x421d('0x12')](_0x57480a));if(_0x57480a[_0x421d('0x13')]){if(_0x57480a['error'][_0x421d('0x14')]===0x1f4){logger['error'](_0x421d('0xe'),_0x39a252,_0x57480a[_0x421d('0x13')][_0x421d('0x15')]);return _0x29110f(_0x57480a[_0x421d('0x13')][_0x421d('0x15')]);}logger['error'](_0x421d('0xe'),_0x39a252,_0x57480a['error'][_0x421d('0x15')]);return _0x9a07ff(_0x57480a['error']['message']);}else{logger[_0x421d('0xd')](_0x421d('0xe'),_0x39a252,_0x421d('0x11'));_0x9a07ff(_0x57480a[_0x421d('0x16')][_0x421d('0x15')]);}})[_0x421d('0x17')](function(_0xc179fe){logger['error'](_0x421d('0xe'),_0x39a252,_0xc179fe);_0x29110f(_0xc179fe);});});}exports['GetVoiceCallReport']=function(_0x2b12f2){var _0x373bae=this;return new Promise(function(_0x2be8db,_0x3d7226){return db[_0x421d('0x18')][_0x421d('0x19')]({'raw':_0x2b12f2[_0x421d('0x1a')]?_0x2b12f2[_0x421d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2b12f2[_0x421d('0x1a')]?_0x2b12f2[_0x421d('0x1a')][_0x421d('0x1b')]||null:null,'attributes':_0x2b12f2[_0x421d('0x1a')]?_0x2b12f2['options'][_0x421d('0x1c')]||null:null,'limit':_0x2b12f2[_0x421d('0x1a')]?_0x2b12f2[_0x421d('0x1a')][_0x421d('0x1d')]||null:null,'include':_0x2b12f2[_0x421d('0x1a')]?_0x2b12f2[_0x421d('0x1a')][_0x421d('0x1e')]?_[_0x421d('0x1f')](_0x2b12f2[_0x421d('0x1a')]['include'],function(_0xb6affe){return{'model':db[_0xb6affe[_0x421d('0x20')]],'as':_0xb6affe['as'],'attributes':_0xb6affe['attributes'],'include':_0xb6affe['include']?_[_0x421d('0x1f')](_0xb6affe['include'],function(_0x41970b){return{'model':db[_0x41970b['model']],'as':_0x41970b['as'],'attributes':_0x41970b[_0x421d('0x1c')],'include':_0x41970b[_0x421d('0x1e')]?_[_0x421d('0x1f')](_0x41970b[_0x421d('0x1e')],function(_0x4538be){return{'model':db[_0x4538be[_0x421d('0x20')]],'as':_0x4538be['as'],'attributes':_0x4538be[_0x421d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x421d('0xc')](function(_0x484818){logger[_0x421d('0xd')]('GetVoiceCallReport',_0x2b12f2);logger[_0x421d('0xf')]('GetVoiceCallReport',_0x2b12f2,JSON[_0x421d('0x12')](_0x484818));_0x2be8db(_0x484818);})['catch'](function(_0x50e94b){logger['error'](_0x421d('0x21'),_0x50e94b[_0x421d('0x15')],_0x2b12f2);_0x3d7226(_0x373bae['error'](0x1f4,_0x50e94b['message']));});});};exports[_0x421d('0x22')]=function(_0x4fb182){var _0x127551=this;return new Promise(function(_0x57e13e,_0x55a2ae){return db[_0x421d('0x18')][_0x421d('0x23')](_0x4fb182['body'],{'raw':_0x4fb182['options']?_0x4fb182[_0x421d('0x1a')][_0x421d('0x24')]===undefined?!![]:![]:!![]})[_0x421d('0xc')](function(_0x525ee1){logger[_0x421d('0xd')](_0x421d('0x22'),_0x4fb182);logger[_0x421d('0xf')]('CreateVoiceCallReport',_0x4fb182,JSON[_0x421d('0x12')](_0x525ee1));_0x57e13e(_0x525ee1);})[_0x421d('0x17')](function(_0xe70291){logger[_0x421d('0x13')](_0x421d('0x22'),_0xe70291[_0x421d('0x15')],_0x4fb182);_0x55a2ae(_0x127551[_0x421d('0x13')](0x1f4,_0xe70291['message']));});});};exports['UpdateVoiceCallReport']=function(_0x27300e){var _0x5ddb42=this;return new Promise(function(_0x47ac53,_0x40c6c8){return db[_0x421d('0x18')]['update'](_0x27300e[_0x421d('0x25')],{'raw':_0x27300e[_0x421d('0x1a')]?_0x27300e['options'][_0x421d('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27300e[_0x421d('0x1a')]?_0x27300e[_0x421d('0x1a')][_0x421d('0x1b')]||null:null,'attributes':_0x27300e[_0x421d('0x1a')]?_0x27300e['options']['attributes']||null:null,'limit':_0x27300e['options']?_0x27300e[_0x421d('0x1a')][_0x421d('0x1d')]||null:null})[_0x421d('0xc')](function(_0x41e3ae){logger[_0x421d('0xd')]('UpdateVoiceCallReport',_0x27300e);logger[_0x421d('0xf')](_0x421d('0x26'),_0x27300e,JSON[_0x421d('0x12')](_0x41e3ae));_0x47ac53(_0x41e3ae);})[_0x421d('0x17')](function(_0xa346f2){logger[_0x421d('0x13')]('UpdateVoiceCallReport',_0xa346f2[_0x421d('0x15')],_0x27300e);_0x40c6c8(_0x5ddb42['error'](0x1f4,_0xa346f2[_0x421d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5462921..2caa4fc 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 _0x5f2b=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports'];(function(_0x1ad32d,_0x2b47cb){var _0x354a5b=function(_0x2621c1){while(--_0x2621c1){_0x1ad32d['push'](_0x1ad32d['shift']());}};_0x354a5b(++_0x2b47cb);}(_0x5f2b,0x17a));var _0xb5f2=function(_0x238faf,_0x3efba4){_0x238faf=_0x238faf-0x0;var _0x4d3a56=_0x5f2b[_0x238faf];return _0x4d3a56;};'use strict';var multer=require(_0xb5f2('0x0'));var util=require(_0xb5f2('0x1'));var path=require(_0xb5f2('0x2'));var timeout=require(_0xb5f2('0x3'));var express=require(_0xb5f2('0x4'));var router=express['Router']();var auth=require(_0xb5f2('0x5'));var interaction=require(_0xb5f2('0x6'));var config=require(_0xb5f2('0x7'));var controller=require(_0xb5f2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb5f2('0x9')]);router['get'](_0xb5f2('0xa'),auth[_0xb5f2('0xb')](),controller[_0xb5f2('0xc')]);router[_0xb5f2('0xd')]('/',auth[_0xb5f2('0xb')](),controller['create']);router[_0xb5f2('0xe')](_0xb5f2('0xa'),auth[_0xb5f2('0xb')](),controller['update']);router[_0xb5f2('0xf')](_0xb5f2('0xa'),auth[_0xb5f2('0xb')](),controller[_0xb5f2('0x10')]);module[_0xb5f2('0x11')]=router; \ No newline at end of file +var _0x2427=['Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','/:id','show','create','update','destroy','exports','multer','util','connect-timeout'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2427,0x165));var _0x7242=function(_0x4af85e,_0x28e2fe){_0x4af85e=_0x4af85e-0x0;var _0x4ece73=_0x2427[_0x4af85e];return _0x4ece73;};'use strict';var multer=require(_0x7242('0x0'));var util=require(_0x7242('0x1'));var path=require('path');var timeout=require(_0x7242('0x2'));var express=require('express');var router=express[_0x7242('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7242('0x4'));var config=require(_0x7242('0x5'));var controller=require(_0x7242('0x6'));router['get']('/',auth[_0x7242('0x7')](),controller['index']);router[_0x7242('0x8')](_0x7242('0x9'),auth[_0x7242('0x7')](),controller[_0x7242('0xa')]);router['post']('/',auth[_0x7242('0x7')](),controller[_0x7242('0xb')]);router['put'](_0x7242('0x9'),auth[_0x7242('0x7')](),controller[_0x7242('0xc')]);router['delete'](_0x7242('0x9'),auth[_0x7242('0x7')](),controller[_0x7242('0xd')]);module[_0x7242('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 907526f..1db71a3 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 _0xf5b1=['exports','STRING','name','options','join','getDataValue','split','sequelize'];(function(_0x1d23e4,_0x23222d){var _0x32c84a=function(_0x1fe6c4){while(--_0x1fe6c4){_0x1d23e4['push'](_0x1d23e4['shift']());}};_0x32c84a(++_0x23222d);}(_0xf5b1,0xb7));var _0x1f5b=function(_0x1619ea,_0x2596f6){_0x1619ea=_0x1619ea-0x0;var _0x3d59a8=_0xf5b1[_0x1619ea];return _0x3d59a8;};'use strict';var Sequelize=require(_0x1f5b('0x0'));module[_0x1f5b('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x1f5b('0x2')],'unique':_0x1f5b('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x1f5b('0x2')],'set':function(_0x747e6c){this['setDataValue'](_0x1f5b('0x4'),_0x747e6c?_0x747e6c[_0x1f5b('0x5')](''):[]);},'get':function(){return this[_0x1f5b('0x6')](_0x1f5b('0x4'))?this[_0x1f5b('0x6')](_0x1f5b('0x4'))[_0x1f5b('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1f5b('0x2')]},'description':{'type':Sequelize[_0x1f5b('0x2')]}}; \ No newline at end of file +var _0x7aaa=['exports','STRING','setDataValue','options','getDataValue','split','BOOLEAN'];(function(_0x51cca7,_0x3afee8){var _0x4b163f=function(_0x2350e8){while(--_0x2350e8){_0x51cca7['push'](_0x51cca7['shift']());}};_0x4b163f(++_0x3afee8);}(_0x7aaa,0x1f1));var _0xa7aa=function(_0x1effc9,_0x4496d1){_0x1effc9=_0x1effc9-0x0;var _0x1cb7e5=_0x7aaa[_0x1effc9];return _0x1cb7e5;};'use strict';var Sequelize=require('sequelize');module[_0xa7aa('0x0')]={'name':{'type':Sequelize[_0xa7aa('0x1')]},'prefix':{'type':Sequelize[_0xa7aa('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xa7aa('0x1')],'set':function(_0x403feb){this[_0xa7aa('0x2')](_0xa7aa('0x3'),_0x403feb?_0x403feb['join'](''):[]);},'get':function(){return this['getDataValue'](_0xa7aa('0x3'))?this[_0xa7aa('0x4')](_0xa7aa('0x3'))[_0xa7aa('0x5')](''):[];}},'auth':{'type':Sequelize[_0xa7aa('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xa7aa('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa7aa('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 77b952c..ebf6294 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 _0xcd8c=['nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2de1a1,_0x5dd78d){var _0x541cfd=function(_0x11e761){while(--_0x11e761){_0x2de1a1['push'](_0x2de1a1['shift']());}};_0x541cfd(++_0x5dd78d);}(_0xcd8c,0x17f));var _0xccd8=function(_0x3c95a3,_0x1159f1){_0x3c95a3=_0x3c95a3-0x0;var _0x57b25b=_0xcd8c[_0x3c95a3];return _0x57b25b;};'use strict';var pdf=require(_0xccd8('0x0'));var emlformat=require(_0xccd8('0x1'));var rimraf=require(_0xccd8('0x2'));var zipdir=require(_0xccd8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccd8('0x4'));var moment=require(_0xccd8('0x5'));var BPromise=require(_0xccd8('0x6'));var Mustache=require(_0xccd8('0x7'));var util=require(_0xccd8('0x8'));var path=require(_0xccd8('0x9'));var sox=require(_0xccd8('0xa'));var csv=require('to-csv');var ejs=require(_0xccd8('0xb'));var fs=require('fs');var _=require(_0xccd8('0xc'));var squel=require(_0xccd8('0xd'));var crypto=require(_0xccd8('0xe'));var jsforce=require(_0xccd8('0xf'));var deskjs=require(_0xccd8('0x10'));var toCsv=require(_0xccd8('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xccd8('0x12'));var authService=require(_0xccd8('0x13'));var qs=require(_0xccd8('0x14'));var as=require(_0xccd8('0x15'));var hardwareService=require(_0xccd8('0x16'));var logger=require(_0xccd8('0x17'))(_0xccd8('0x18'));var utils=require('../../config/utils');var config=require(_0xccd8('0x19'));var db=require(_0xccd8('0x1a'))['db'];function respondWithStatusCode(_0x5ea5cb,_0x3c6088){_0x3c6088=_0x3c6088||0xcc;return function(_0x5033fb){if(_0x5033fb){return _0x5ea5cb['sendStatus'](_0x3c6088);}return _0x5ea5cb[_0xccd8('0x1b')](_0x3c6088)[_0xccd8('0x1c')]();};}function respondWithResult(_0x18424e,_0xea4326){_0xea4326=_0xea4326||0xc8;return function(_0x397634){if(_0x397634){return _0x18424e['status'](_0xea4326)[_0xccd8('0x1d')](_0x397634);}};}function respondWithFilteredResult(_0x178b8f,_0x433959){return function(_0x460788){if(_0x460788){var _0x5422bb=_0x460788[_0xccd8('0x1e')],_0x3a5053=_0x433959[_0xccd8('0x1f')],_0xad6a3a=_0x433959[_0xccd8('0x1f')]+_0x433959['limit'],_0x3e229c;if(_0xad6a3a>=_0x5422bb){_0xad6a3a=_0x5422bb;_0x3e229c=0xc8;}else{_0x3e229c=0xce;}_0x178b8f[_0xccd8('0x1b')](_0x3e229c);return _0x178b8f['set'](_0xccd8('0x20'),_0x3a5053+'-'+_0xad6a3a+'/'+_0x5422bb)[_0xccd8('0x1d')](_0x460788);}return null;};}function patchUpdates(_0x1d9abc){return function(_0x37acfb){try{jsonpatch[_0xccd8('0x21')](_0x37acfb,_0x1d9abc,!![]);}catch(_0x2d539c){return BPromise[_0xccd8('0x22')](_0x2d539c);}return _0x37acfb[_0xccd8('0x23')]();};}function saveUpdates(_0x35cd3e,_0x34c6c5){return function(_0x3329f8){if(_0x3329f8){return _0x3329f8[_0xccd8('0x24')](_0x35cd3e)[_0xccd8('0x25')](function(_0x1f6d45){return _0x1f6d45;});}return null;};}function removeEntity(_0x9ce8ce,_0x5a5951){return function(_0x109a47){if(_0x109a47){return _0x109a47[_0xccd8('0x26')]()[_0xccd8('0x25')](function(){var _0x1a1d27=_0x109a47[_0xccd8('0x27')]({'plain':!![]});var _0xdeaab9=_0xccd8('0x28');return db['UserProfileResource'][_0xccd8('0x26')]({'where':{'type':_0xdeaab9,'resourceId':_0x1a1d27['id']}})[_0xccd8('0x25')](function(){return _0x109a47;});})[_0xccd8('0x25')](function(){_0x9ce8ce[_0xccd8('0x1b')](0xcc)[_0xccd8('0x1c')]();});}};}function handleEntityNotFound(_0x38b75a,_0x42d136){return function(_0x4bcfdd){if(!_0x4bcfdd){_0x38b75a[_0xccd8('0x29')](0x194);}return _0x4bcfdd;};}function handleError(_0x59bc3b,_0x4466e4){_0x4466e4=_0x4466e4||0x1f4;return function(_0x51b539){logger[_0xccd8('0x2a')](_0x51b539[_0xccd8('0x2b')]);if(_0x51b539['name']){delete _0x51b539[_0xccd8('0x2c')];}_0x59bc3b[_0xccd8('0x1b')](_0x4466e4)[_0xccd8('0x2d')](_0x51b539);};}exports[_0xccd8('0x2e')]=function(_0x20796e,_0x232b22){var _0xc50ed1={},_0x4c0a76={},_0x378729={'count':0x0,'rows':[]};var _0x5c1554=_['map'](db[_0xccd8('0x2f')][_0xccd8('0x30')],function(_0x509bbc){return{'name':_0x509bbc[_0xccd8('0x31')],'type':_0x509bbc[_0xccd8('0x32')][_0xccd8('0x33')]};});_0x4c0a76[_0xccd8('0x34')]=_[_0xccd8('0x35')](_0x5c1554,_0xccd8('0x2c'));_0x4c0a76['query']=_[_0xccd8('0x36')](_0x20796e[_0xccd8('0x37')]);_0x4c0a76[_0xccd8('0x38')]=_[_0xccd8('0x39')](_0x4c0a76[_0xccd8('0x34')],_0x4c0a76[_0xccd8('0x37')]);_0xc50ed1[_0xccd8('0x3a')]=_[_0xccd8('0x39')](_0x4c0a76['model'],qs['fields'](_0x20796e[_0xccd8('0x37')][_0xccd8('0x3b')]));_0xc50ed1[_0xccd8('0x3a')]=_0xc50ed1[_0xccd8('0x3a')][_0xccd8('0x3c')]?_0xc50ed1[_0xccd8('0x3a')]:_0x4c0a76[_0xccd8('0x34')];if(!_0x20796e['query'][_0xccd8('0x3d')](_0xccd8('0x3e'))){_0xc50ed1[_0xccd8('0x3f')]=qs[_0xccd8('0x3f')](_0x20796e[_0xccd8('0x37')][_0xccd8('0x3f')]);_0xc50ed1['offset']=qs['offset'](_0x20796e[_0xccd8('0x37')][_0xccd8('0x1f')]);}_0xc50ed1['order']=qs[_0xccd8('0x40')](_0x20796e[_0xccd8('0x37')]['sort']);_0xc50ed1['where']=qs['filters'](_[_0xccd8('0x41')](_0x20796e[_0xccd8('0x37')],_0x4c0a76['filters']),_0x5c1554);if(_0x20796e['query'][_0xccd8('0x42')]){_0xc50ed1[_0xccd8('0x43')]=_[_0xccd8('0x44')](_0xc50ed1[_0xccd8('0x43')],{'$or':_[_0xccd8('0x35')](_0x5c1554,function(_0x365760){if(_0x365760[_0xccd8('0x32')]!==_0xccd8('0x45')){var _0x18927e={};_0x18927e[_0x365760[_0xccd8('0x2c')]]={'$like':'%'+_0x20796e[_0xccd8('0x37')][_0xccd8('0x42')]+'%'};return _0x18927e;}})});}_0xc50ed1=_[_0xccd8('0x44')]({},_0xc50ed1,_0x20796e[_0xccd8('0x46')]);var _0x484d8a={'where':_0xc50ed1['where']};return db[_0xccd8('0x2f')][_0xccd8('0x1e')](_0x484d8a)['then'](function(_0x5479ef){_0x378729[_0xccd8('0x1e')]=_0x5479ef;if(_0x20796e['query']['includeAll']){_0xc50ed1[_0xccd8('0x47')]=[{'all':!![]}];}return db[_0xccd8('0x2f')][_0xccd8('0x48')](_0xc50ed1);})[_0xccd8('0x25')](function(_0x50ac7e){_0x378729[_0xccd8('0x49')]=_0x50ac7e;return _0x378729;})[_0xccd8('0x25')](respondWithFilteredResult(_0x232b22,_0xc50ed1))[_0xccd8('0x4a')](handleError(_0x232b22,null));};exports[_0xccd8('0x4b')]=function(_0x18a000,_0x4b4bc9){var _0x4ab676={'raw':![],'where':{'id':_0x18a000['params']['id']}},_0x40c7ff={};_0x40c7ff[_0xccd8('0x34')]=_[_0xccd8('0x36')](db[_0xccd8('0x2f')][_0xccd8('0x30')]);_0x40c7ff[_0xccd8('0x37')]=_[_0xccd8('0x36')](_0x18a000[_0xccd8('0x37')]);_0x40c7ff[_0xccd8('0x38')]=_['intersection'](_0x40c7ff[_0xccd8('0x34')],_0x40c7ff['query']);_0x4ab676['attributes']=_['intersection'](_0x40c7ff['model'],qs['fields'](_0x18a000[_0xccd8('0x37')][_0xccd8('0x3b')]));_0x4ab676[_0xccd8('0x3a')]=_0x4ab676[_0xccd8('0x3a')][_0xccd8('0x3c')]?_0x4ab676[_0xccd8('0x3a')]:_0x40c7ff['model'];if(_0x18a000[_0xccd8('0x37')][_0xccd8('0x4c')]){_0x4ab676[_0xccd8('0x47')]=[{'all':!![]}];}_0x4ab676=_[_0xccd8('0x44')]({},_0x4ab676,_0x18a000[_0xccd8('0x46')]);return db[_0xccd8('0x2f')][_0xccd8('0x4d')](_0x4ab676)[_0xccd8('0x25')](handleEntityNotFound(_0x4b4bc9,null))[_0xccd8('0x25')](respondWithResult(_0x4b4bc9,null))['catch'](handleError(_0x4b4bc9,null));};exports['create']=function(_0x1cfed2,_0x206472){return db[_0xccd8('0x2f')][_0xccd8('0x4e')](_0x1cfed2[_0xccd8('0x4f')],{})['then'](function(_0x45d992){var _0x28407e=_0x1cfed2[_0xccd8('0x50')][_0xccd8('0x27')]({'plain':!![]});if(!_0x28407e)throw new Error(_0xccd8('0x51'));if(_0x28407e[_0xccd8('0x52')]===_0xccd8('0x50')){var _0x5ef47c=_0x45d992['get']({'plain':!![]});var _0x2c3214=_0xccd8('0x28');return db[_0xccd8('0x53')][_0xccd8('0x4d')]({'where':{'name':_0x2c3214,'userProfileId':_0x28407e[_0xccd8('0x54')]},'raw':!![]})['then'](function(_0x1324a1){if(_0x1324a1&&_0x1324a1[_0xccd8('0x55')]===0x0){return db[_0xccd8('0x56')]['create']({'name':_0x5ef47c['name'],'resourceId':_0x5ef47c['id'],'type':_0x1324a1[_0xccd8('0x2c')],'sectionId':_0x1324a1['id']},{})[_0xccd8('0x25')](function(){return _0x45d992;});}else{return _0x45d992;}})[_0xccd8('0x4a')](function(_0x2c6cbc){logger[_0xccd8('0x2a')](_0xccd8('0x57'),_0x2c6cbc);throw _0x2c6cbc;});}return _0x45d992;})['then'](respondWithResult(_0x206472,0xc9))[_0xccd8('0x4a')](handleError(_0x206472,null));};exports[_0xccd8('0x24')]=function(_0xd6fa9,_0x11c607){if(_0xd6fa9[_0xccd8('0x4f')]['id']){delete _0xd6fa9['body']['id'];}return db[_0xccd8('0x2f')][_0xccd8('0x4d')]({'where':{'id':_0xd6fa9[_0xccd8('0x58')]['id']}})[_0xccd8('0x25')](handleEntityNotFound(_0x11c607,null))['then'](saveUpdates(_0xd6fa9['body'],null))[_0xccd8('0x25')](respondWithResult(_0x11c607,null))['catch'](handleError(_0x11c607,null));};exports[_0xccd8('0x26')]=function(_0x171e7d,_0x3e9087){return db['VoiceChanSpy'][_0xccd8('0x4d')]({'where':{'id':_0x171e7d[_0xccd8('0x58')]['id']}})['then'](handleEntityNotFound(_0x3e9087,null))[_0xccd8('0x25')](removeEntity(_0x3e9087,null))[_0xccd8('0x4a')](handleError(_0x3e9087,null));}; \ No newline at end of file +var _0xb060=['index','map','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','merge','options','VoiceChanSpy','count','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','end','error','stack','name','send'];(function(_0x58f505,_0x1b9824){var _0x26f56f=function(_0x20c4b2){while(--_0x20c4b2){_0x58f505['push'](_0x58f505['shift']());}};_0x26f56f(++_0x1b9824);}(_0xb060,0x7d));var _0x0b06=function(_0x4facb9,_0x5181a0){_0x4facb9=_0x4facb9-0x0;var _0x2d93c9=_0xb060[_0x4facb9];return _0x2d93c9;};'use strict';var pdf=require(_0x0b06('0x0'));var emlformat=require(_0x0b06('0x1'));var rimraf=require(_0x0b06('0x2'));var zipdir=require(_0x0b06('0x3'));var jsonpatch=require(_0x0b06('0x4'));var rp=require(_0x0b06('0x5'));var moment=require(_0x0b06('0x6'));var BPromise=require(_0x0b06('0x7'));var Mustache=require(_0x0b06('0x8'));var util=require(_0x0b06('0x9'));var path=require(_0x0b06('0xa'));var sox=require(_0x0b06('0xb'));var csv=require(_0x0b06('0xc'));var ejs=require(_0x0b06('0xd'));var fs=require('fs');var _=require(_0x0b06('0xe'));var squel=require(_0x0b06('0xf'));var crypto=require(_0x0b06('0x10'));var jsforce=require(_0x0b06('0x11'));var deskjs=require(_0x0b06('0x12'));var toCsv=require(_0x0b06('0xc'));var querystring=require(_0x0b06('0x13'));var Papa=require(_0x0b06('0x14'));var Redis=require('ioredis');var authService=require(_0x0b06('0x15'));var qs=require(_0x0b06('0x16'));var as=require(_0x0b06('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b06('0x18'))(_0x0b06('0x19'));var utils=require('../../config/utils');var config=require(_0x0b06('0x1a'));var db=require(_0x0b06('0x1b'))['db'];function respondWithStatusCode(_0x255a6c,_0x43f9e3){_0x43f9e3=_0x43f9e3||0xcc;return function(_0x2a0389){if(_0x2a0389){return _0x255a6c[_0x0b06('0x1c')](_0x43f9e3);}return _0x255a6c['status'](_0x43f9e3)['end']();};}function respondWithResult(_0x35a3d4,_0x20585e){_0x20585e=_0x20585e||0xc8;return function(_0x155f7c){if(_0x155f7c){return _0x35a3d4[_0x0b06('0x1d')](_0x20585e)[_0x0b06('0x1e')](_0x155f7c);}};}function respondWithFilteredResult(_0x3c09d0,_0x180d22){return function(_0x5ec0b1){if(_0x5ec0b1){var _0x2f0eef=_0x5ec0b1['count'],_0x327275=_0x180d22[_0x0b06('0x1f')],_0x55f73f=_0x180d22[_0x0b06('0x1f')]+_0x180d22['limit'],_0x34f975;if(_0x55f73f>=_0x2f0eef){_0x55f73f=_0x2f0eef;_0x34f975=0xc8;}else{_0x34f975=0xce;}_0x3c09d0[_0x0b06('0x1d')](_0x34f975);return _0x3c09d0[_0x0b06('0x20')](_0x0b06('0x21'),_0x327275+'-'+_0x55f73f+'/'+_0x2f0eef)[_0x0b06('0x1e')](_0x5ec0b1);}return null;};}function patchUpdates(_0x12a2e9){return function(_0x4fba6e){try{jsonpatch[_0x0b06('0x22')](_0x4fba6e,_0x12a2e9,!![]);}catch(_0x4f6f76){return BPromise[_0x0b06('0x23')](_0x4f6f76);}return _0x4fba6e[_0x0b06('0x24')]();};}function saveUpdates(_0x1915ff,_0x421930){return function(_0x377de8){if(_0x377de8){return _0x377de8[_0x0b06('0x25')](_0x1915ff)[_0x0b06('0x26')](function(_0x3eb4aa){return _0x3eb4aa;});}return null;};}function removeEntity(_0x539748,_0x5c0d9a){return function(_0xaa310f){if(_0xaa310f){return _0xaa310f[_0x0b06('0x27')]()[_0x0b06('0x26')](function(){var _0x1c22a6=_0xaa310f['get']({'plain':!![]});var _0x555ff1=_0x0b06('0x28');return db[_0x0b06('0x29')][_0x0b06('0x27')]({'where':{'type':_0x555ff1,'resourceId':_0x1c22a6['id']}})['then'](function(){return _0xaa310f;});})[_0x0b06('0x26')](function(){_0x539748['status'](0xcc)[_0x0b06('0x2a')]();});}};}function handleEntityNotFound(_0x4b8dfa,_0x22070f){return function(_0x3b90b2){if(!_0x3b90b2){_0x4b8dfa['sendStatus'](0x194);}return _0x3b90b2;};}function handleError(_0x35ab10,_0x44fe34){_0x44fe34=_0x44fe34||0x1f4;return function(_0x1576c4){logger[_0x0b06('0x2b')](_0x1576c4[_0x0b06('0x2c')]);if(_0x1576c4[_0x0b06('0x2d')]){delete _0x1576c4[_0x0b06('0x2d')];}_0x35ab10[_0x0b06('0x1d')](_0x44fe34)[_0x0b06('0x2e')](_0x1576c4);};}exports[_0x0b06('0x2f')]=function(_0x57d84a,_0x11161c){var _0x53ee04={},_0x3ab54b={},_0x3610c6={'count':0x0,'rows':[]};var _0x9ce9f7=_[_0x0b06('0x30')](db['VoiceChanSpy']['rawAttributes'],function(_0x3b4a9f){return{'name':_0x3b4a9f[_0x0b06('0x31')],'type':_0x3b4a9f[_0x0b06('0x32')][_0x0b06('0x33')]};});_0x3ab54b[_0x0b06('0x34')]=_[_0x0b06('0x30')](_0x9ce9f7,_0x0b06('0x2d'));_0x3ab54b[_0x0b06('0x35')]=_[_0x0b06('0x36')](_0x57d84a[_0x0b06('0x35')]);_0x3ab54b[_0x0b06('0x37')]=_['intersection'](_0x3ab54b[_0x0b06('0x34')],_0x3ab54b['query']);_0x53ee04[_0x0b06('0x38')]=_['intersection'](_0x3ab54b[_0x0b06('0x34')],qs[_0x0b06('0x39')](_0x57d84a[_0x0b06('0x35')]['fields']));_0x53ee04[_0x0b06('0x38')]=_0x53ee04[_0x0b06('0x38')]['length']?_0x53ee04[_0x0b06('0x38')]:_0x3ab54b[_0x0b06('0x34')];if(!_0x57d84a['query'][_0x0b06('0x3a')](_0x0b06('0x3b'))){_0x53ee04[_0x0b06('0x3c')]=qs[_0x0b06('0x3c')](_0x57d84a['query'][_0x0b06('0x3c')]);_0x53ee04['offset']=qs[_0x0b06('0x1f')](_0x57d84a[_0x0b06('0x35')]['offset']);}_0x53ee04['order']=qs[_0x0b06('0x3d')](_0x57d84a[_0x0b06('0x35')][_0x0b06('0x3d')]);_0x53ee04[_0x0b06('0x3e')]=qs['filters'](_[_0x0b06('0x3f')](_0x57d84a['query'],_0x3ab54b[_0x0b06('0x37')]),_0x9ce9f7);if(_0x57d84a[_0x0b06('0x35')]['filter']){_0x53ee04[_0x0b06('0x3e')]=_[_0x0b06('0x40')](_0x53ee04[_0x0b06('0x3e')],{'$or':_[_0x0b06('0x30')](_0x9ce9f7,function(_0xe1c44a){if(_0xe1c44a[_0x0b06('0x32')]!=='VIRTUAL'){var _0x7583dd={};_0x7583dd[_0xe1c44a['name']]={'$like':'%'+_0x57d84a['query']['filter']+'%'};return _0x7583dd;}})});}_0x53ee04=_[_0x0b06('0x40')]({},_0x53ee04,_0x57d84a[_0x0b06('0x41')]);var _0x3a975e={'where':_0x53ee04[_0x0b06('0x3e')]};return db[_0x0b06('0x42')][_0x0b06('0x43')](_0x3a975e)[_0x0b06('0x26')](function(_0x267500){_0x3610c6[_0x0b06('0x43')]=_0x267500;if(_0x57d84a[_0x0b06('0x35')]['includeAll']){_0x53ee04[_0x0b06('0x44')]=[{'all':!![]}];}return db[_0x0b06('0x42')][_0x0b06('0x45')](_0x53ee04);})['then'](function(_0x21920f){_0x3610c6[_0x0b06('0x46')]=_0x21920f;return _0x3610c6;})['then'](respondWithFilteredResult(_0x11161c,_0x53ee04))[_0x0b06('0x47')](handleError(_0x11161c,null));};exports[_0x0b06('0x48')]=function(_0x59dcb7,_0xe97afc){var _0x190b2e={'raw':![],'where':{'id':_0x59dcb7[_0x0b06('0x49')]['id']}},_0x49de96={};_0x49de96[_0x0b06('0x34')]=_['keys'](db[_0x0b06('0x42')][_0x0b06('0x4a')]);_0x49de96[_0x0b06('0x35')]=_['keys'](_0x59dcb7[_0x0b06('0x35')]);_0x49de96[_0x0b06('0x37')]=_[_0x0b06('0x4b')](_0x49de96['model'],_0x49de96[_0x0b06('0x35')]);_0x190b2e['attributes']=_[_0x0b06('0x4b')](_0x49de96[_0x0b06('0x34')],qs['fields'](_0x59dcb7['query']['fields']));_0x190b2e[_0x0b06('0x38')]=_0x190b2e['attributes'][_0x0b06('0x4c')]?_0x190b2e[_0x0b06('0x38')]:_0x49de96[_0x0b06('0x34')];if(_0x59dcb7['query'][_0x0b06('0x4d')]){_0x190b2e[_0x0b06('0x44')]=[{'all':!![]}];}_0x190b2e=_[_0x0b06('0x40')]({},_0x190b2e,_0x59dcb7['options']);return db['VoiceChanSpy'][_0x0b06('0x4e')](_0x190b2e)[_0x0b06('0x26')](handleEntityNotFound(_0xe97afc,null))[_0x0b06('0x26')](respondWithResult(_0xe97afc,null))[_0x0b06('0x47')](handleError(_0xe97afc,null));};exports[_0x0b06('0x4f')]=function(_0x9d9ebc,_0x2b8445){return db[_0x0b06('0x42')][_0x0b06('0x4f')](_0x9d9ebc['body'],{})[_0x0b06('0x26')](function(_0x31d4fe){var _0x4841b0=_0x9d9ebc[_0x0b06('0x50')]['get']({'plain':!![]});if(!_0x4841b0)throw new Error(_0x0b06('0x51'));if(_0x4841b0['role']===_0x0b06('0x50')){var _0x5d0981=_0x31d4fe[_0x0b06('0x52')]({'plain':!![]});var _0x5ea50a=_0x0b06('0x28');return db[_0x0b06('0x53')][_0x0b06('0x4e')]({'where':{'name':_0x5ea50a,'userProfileId':_0x4841b0['userProfileId']},'raw':!![]})['then'](function(_0x530c50){if(_0x530c50&&_0x530c50['autoAssociation']===0x0){return db[_0x0b06('0x29')]['create']({'name':_0x5d0981['name'],'resourceId':_0x5d0981['id'],'type':_0x530c50[_0x0b06('0x2d')],'sectionId':_0x530c50['id']},{})[_0x0b06('0x26')](function(){return _0x31d4fe;});}else{return _0x31d4fe;}})[_0x0b06('0x47')](function(_0x29902b){logger[_0x0b06('0x2b')](_0x0b06('0x54'),_0x29902b);throw _0x29902b;});}return _0x31d4fe;})[_0x0b06('0x26')](respondWithResult(_0x2b8445,0xc9))[_0x0b06('0x47')](handleError(_0x2b8445,null));};exports['update']=function(_0x247b36,_0x4632a5){if(_0x247b36[_0x0b06('0x55')]['id']){delete _0x247b36[_0x0b06('0x55')]['id'];}return db[_0x0b06('0x42')][_0x0b06('0x4e')]({'where':{'id':_0x247b36[_0x0b06('0x49')]['id']}})['then'](handleEntityNotFound(_0x4632a5,null))[_0x0b06('0x26')](saveUpdates(_0x247b36['body'],null))['then'](respondWithResult(_0x4632a5,null))['catch'](handleError(_0x4632a5,null));};exports[_0x0b06('0x27')]=function(_0x398284,_0x3ca2fd){return db[_0x0b06('0x42')]['find']({'where':{'id':_0x398284['params']['id']}})[_0x0b06('0x26')](handleEntityNotFound(_0x3ca2fd,null))['then'](removeEntity(_0x3ca2fd,null))[_0x0b06('0x47')](handleError(_0x3ca2fd,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c91065c..b17d0b1 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 _0x225c=['ChanSpy','SIP/%s,%s','StopMixMonitor','concat','internal','name','findAll','agent','then','length','VoiceExtension','bulkCreate','catch','destroy','lodash','util','context','from-sip','format','prefix','system','push','merge','Set','CDR(type)=%s','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc225('0x0'));var util=require(_0xc225('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x258ead,_0x4f2fa0,_0xa2ac1d){var _0xc96c33=0x1;var _0x4778ea=[];var _0x41eccd={'context':_0x4f2fa0[_0xc225('0x2')]||_0xc225('0x3'),'exten':util[_0xc225('0x4')]('%s%s',_0x258ead[_0xc225('0x5')],_0xa2ac1d),'type':_0xc225('0x6'),'isApp':![],'ChanSpyId':_0x258ead['id'],'UserId':_0x4f2fa0['id']};_0x4778ea[_0xc225('0x7')](_[_0xc225('0x8')]({'app':_0xc225('0x9'),'appdata':util['format'](_0xc225('0xa'),'chanspy'),'priority':_0xc96c33++},_0x41eccd));if(_0x258ead[_0xc225('0xb')]){_0x4778ea[_0xc225('0x7')](_[_0xc225('0x8')]({'app':'MixMonitor','appdata':util[_0xc225('0x4')](_0xc225('0xc'),_0x258ead[_0xc225('0xd')]),'priority':_0xc96c33++},_0x41eccd));}if(_0x258ead[_0xc225('0xe')]){_0x4778ea[_0xc225('0x7')](_['merge']({'app':_0xc225('0xf'),'appdata':_0x258ead[_0xc225('0x10')],'priority':_0xc96c33++},_0x41eccd));}_0x4778ea['push'](_['merge']({'app':_0xc225('0x11'),'appdata':util[_0xc225('0x4')](_0xc225('0x12'),_0x4f2fa0['name'],_0x258ead['options']?_0x258ead['options']['join'](''):''),'priority':_0xc96c33++},_0x41eccd));if(_0x258ead['record']){_0x4778ea[_0xc225('0x7')](_[_0xc225('0x8')]({'app':_0xc225('0x13'),'priority':_0xc96c33++},_0x41eccd));}return _0x4778ea;};var getChanSpyApplications=function(_0x520049,_0x1bc1ef){var _0x51751d=[];for(var _0x5798e1=0x0,_0x419580=0x1;_0x5798e1<_0x1bc1ef['length'];_0x5798e1++,_0x419580=0x1){_0x51751d=_0x51751d[_0xc225('0x14')](getUserApplications(_0x520049,_0x1bc1ef[_0x5798e1],_0x1bc1ef[_0x5798e1][_0xc225('0x15')]));if(_0x1bc1ef[_0x5798e1]['internal']!=_0x1bc1ef[_0x5798e1][_0xc225('0x16')]){_0x51751d=_0x51751d[_0xc225('0x14')](getUserApplications(_0x520049,_0x1bc1ef[_0x5798e1],_0x1bc1ef[_0x5798e1][_0xc225('0x16')]));}}return _0x51751d;};var getChanSpyPromise=function(_0x336229,_0x14e2a0){return new BPromise(function(_0x45ff56,_0x42dbdb){return _0x336229['User'][_0xc225('0x17')]({'attributes':['id',_0xc225('0x16'),_0xc225('0x15')],'where':{'role':_0xc225('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2de910){if(_0x2de910){return _0x45ff56(getChanSpyApplications(_0x14e2a0,_0x2de910));}return _0x45ff56([]);})['catch'](function(_0x45a276){_0x42dbdb(_0x45a276);});});};module['exports']=function(_0x515632,_0x130d27){var _0xcfd38=_0x515632['models'];return _0x515632['define']('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b5d5b,_0x563732,_0x347247){return getChanSpyPromise(_0xcfd38,_0x1b5d5b)[_0xc225('0x19')](function(_0x3c9452){if(_0x3c9452&&_0x3c9452[_0xc225('0x1a')]){return _0xcfd38[_0xc225('0x1b')][_0xc225('0x1c')](_0x3c9452);}})[_0xc225('0x19')](function(){_0x347247();})[_0xc225('0x1d')](function(_0x3c121f){_0x347247(_0x3c121f);});},'afterUpdate':function(_0x5d54f8,_0x76b9,_0x4e9cee){return _0xcfd38[_0xc225('0x1b')][_0xc225('0x1e')]({'where':{'ChanSpyId':_0x5d54f8['id']}})[_0xc225('0x19')](function(){return getChanSpyPromise(_0xcfd38,_0x5d54f8);})[_0xc225('0x19')](function(_0xa59278){if(_0xa59278&&_0xa59278[_0xc225('0x1a')]){return _0xcfd38[_0xc225('0x1b')][_0xc225('0x1c')](_0xa59278);}})['then'](function(){_0x4e9cee();})[_0xc225('0x1d')](function(_0x20e0b3){_0x4e9cee(_0x20e0b3);});},'afterDestroy':function(_0x59dec5,_0x46c7f5,_0x2f95cb){return _0xcfd38['VoiceExtension'][_0xc225('0x1e')]({'where':{'ChanSpyId':_0x59dec5['id']}})[_0xc225('0x19')](function(){_0x2f95cb();})[_0xc225('0x1d')](function(_0x53c7fd){_0x2f95cb(_0x53c7fd);});}}});}; \ No newline at end of file +var _0x3d0a=['destroy','lodash','bluebird','./voiceChanSpy.attributes','format','%s%s','prefix','merge','CDR(type)=%s','record','push','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate'];(function(_0x31905e,_0x4f921e){var _0x42ddf2=function(_0xbdb476){while(--_0xbdb476){_0x31905e['push'](_0x31905e['shift']());}};_0x42ddf2(++_0x4f921e);}(_0x3d0a,0xa9));var _0xa3d0=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3d0a[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xa3d0('0x0'));var util=require('util');var BPromise=require(_0xa3d0('0x1'));var attributes=require(_0xa3d0('0x2'));var getUserApplications=function(_0x12c1da,_0x1f5899,_0x418d6f){var _0x3cea29=0x1;var _0x5a1f59=[];var _0x4efa4c={'context':_0x1f5899['context']||'from-sip','exten':util[_0xa3d0('0x3')](_0xa3d0('0x4'),_0x12c1da[_0xa3d0('0x5')],_0x418d6f),'type':'system','isApp':![],'ChanSpyId':_0x12c1da['id'],'UserId':_0x1f5899['id']};_0x5a1f59['push'](_[_0xa3d0('0x6')]({'app':'Set','appdata':util['format'](_0xa3d0('0x7'),'chanspy'),'priority':_0x3cea29++},_0x4efa4c));if(_0x12c1da[_0xa3d0('0x8')]){_0x5a1f59['push'](_[_0xa3d0('0x6')]({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,a',_0x12c1da['recordingFormat']),'priority':_0x3cea29++},_0x4efa4c));}if(_0x12c1da['auth']){_0x5a1f59[_0xa3d0('0x9')](_[_0xa3d0('0x6')]({'app':'Authenticate','appdata':_0x12c1da['password'],'priority':_0x3cea29++},_0x4efa4c));}_0x5a1f59[_0xa3d0('0x9')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0xa3d0('0xa'),_0x1f5899[_0xa3d0('0xb')],_0x12c1da[_0xa3d0('0xc')]?_0x12c1da[_0xa3d0('0xc')][_0xa3d0('0xd')](''):''),'priority':_0x3cea29++},_0x4efa4c));if(_0x12c1da[_0xa3d0('0x8')]){_0x5a1f59[_0xa3d0('0x9')](_['merge']({'app':_0xa3d0('0xe'),'priority':_0x3cea29++},_0x4efa4c));}return _0x5a1f59;};var getChanSpyApplications=function(_0xa7d703,_0xdebfab){var _0x5885d7=[];for(var _0x26e231=0x0,_0x3ec7a1=0x1;_0x26e231<_0xdebfab[_0xa3d0('0xf')];_0x26e231++,_0x3ec7a1=0x1){_0x5885d7=_0x5885d7[_0xa3d0('0x10')](getUserApplications(_0xa7d703,_0xdebfab[_0x26e231],_0xdebfab[_0x26e231][_0xa3d0('0x11')]));if(_0xdebfab[_0x26e231][_0xa3d0('0x11')]!=_0xdebfab[_0x26e231][_0xa3d0('0xb')]){_0x5885d7=_0x5885d7[_0xa3d0('0x10')](getUserApplications(_0xa7d703,_0xdebfab[_0x26e231],_0xdebfab[_0x26e231][_0xa3d0('0xb')]));}}return _0x5885d7;};var getChanSpyPromise=function(_0x3339a4,_0x872f91){return new BPromise(function(_0x439b1c,_0x5cb0e8){return _0x3339a4[_0xa3d0('0x12')][_0xa3d0('0x13')]({'attributes':['id',_0xa3d0('0xb'),_0xa3d0('0x11')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xa3d0('0x14')](function(_0x20156f){if(_0x20156f){return _0x439b1c(getChanSpyApplications(_0x872f91,_0x20156f));}return _0x439b1c([]);})['catch'](function(_0x3ee373){_0x5cb0e8(_0x3ee373);});});};module[_0xa3d0('0x15')]=function(_0x322a17,_0x7f4a7b){var _0x139d68=_0x322a17[_0xa3d0('0x16')];return _0x322a17['define'](_0xa3d0('0x17'),attributes,{'tableName':_0xa3d0('0x18'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x33e0da,_0x8a729e,_0x195fe2){return getChanSpyPromise(_0x139d68,_0x33e0da)[_0xa3d0('0x14')](function(_0x52b62e){if(_0x52b62e&&_0x52b62e[_0xa3d0('0xf')]){return _0x139d68[_0xa3d0('0x19')][_0xa3d0('0x1a')](_0x52b62e);}})['then'](function(){_0x195fe2();})['catch'](function(_0x4e52d9){_0x195fe2(_0x4e52d9);});},'afterUpdate':function(_0x518e81,_0x30d8b5,_0x1de6b2){return _0x139d68['VoiceExtension'][_0xa3d0('0x1b')]({'where':{'ChanSpyId':_0x518e81['id']}})[_0xa3d0('0x14')](function(){return getChanSpyPromise(_0x139d68,_0x518e81);})[_0xa3d0('0x14')](function(_0x168677){if(_0x168677&&_0x168677['length']){return _0x139d68[_0xa3d0('0x19')][_0xa3d0('0x1a')](_0x168677);}})[_0xa3d0('0x14')](function(){_0x1de6b2();})['catch'](function(_0x2852b4){_0x1de6b2(_0x2852b4);});},'afterDestroy':function(_0x441590,_0x20fda2,_0x56953b){return _0x139d68[_0xa3d0('0x19')]['destroy']({'where':{'ChanSpyId':_0x441590['id']}})[_0xa3d0('0x14')](function(){_0x56953b();})['catch'](function(_0x11b86d){_0x56953b(_0x11b86d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 12eb26f..2d581ad 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 _0x20ca=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0x20ca,0xa1));var _0xa20c=function(_0x56db95,_0xe956e3){_0x56db95=_0x56db95-0x0;var _0xf62c91=_0x20ca[_0x56db95];return _0xf62c91;};'use strict';var _=require('lodash');var util=require(_0xa20c('0x0'));var moment=require(_0xa20c('0x1'));var BPromise=require(_0xa20c('0x2'));var rs=require(_0xa20c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa20c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa20c('0x5'))(_0xa20c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa20c('0x7')][_0xa20c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b00fb,_0x21680b,_0x53e7e1){return new BPromise(function(_0x545b1d,_0x1bef3e){return client[_0xa20c('0x9')](_0x2b00fb,_0x53e7e1)[_0xa20c('0xa')](function(_0x242dd3){logger[_0xa20c('0xb')](_0xa20c('0xc'),_0x21680b,_0xa20c('0xd'));logger['debug'](_0xa20c('0xe'),_0x21680b,_0xa20c('0xd'),JSON[_0xa20c('0xf')](_0x242dd3));if(_0x242dd3[_0xa20c('0x10')]){if(_0x242dd3[_0xa20c('0x10')][_0xa20c('0x11')]===0x1f4){logger[_0xa20c('0x10')](_0xa20c('0xc'),_0x21680b,_0x242dd3['error'][_0xa20c('0x12')]);return _0x1bef3e(_0x242dd3['error']['message']);}logger[_0xa20c('0x10')](_0xa20c('0xc'),_0x21680b,_0x242dd3['error'][_0xa20c('0x12')]);return _0x545b1d(_0x242dd3[_0xa20c('0x10')][_0xa20c('0x12')]);}else{logger[_0xa20c('0xb')](_0xa20c('0xc'),_0x21680b,_0xa20c('0xd'));_0x545b1d(_0x242dd3['result'][_0xa20c('0x12')]);}})[_0xa20c('0x13')](function(_0x52191b){logger[_0xa20c('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x21680b,_0x52191b);_0x1bef3e(_0x52191b);});});} \ No newline at end of file +var _0x55c5=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x4636c3,_0x4ebaba){var _0x44811c=function(_0x35bb69){while(--_0x35bb69){_0x4636c3['push'](_0x4636c3['shift']());}};_0x44811c(++_0x4ebaba);}(_0x55c5,0x1f1));var _0x555c=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0x55c5[_0x414ff1];return _0x29c53f;};'use strict';var _=require(_0x555c('0x0'));var util=require(_0x555c('0x1'));var moment=require(_0x555c('0x2'));var BPromise=require(_0x555c('0x3'));var rs=require(_0x555c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x555c('0x5'))['db'];var utils=require(_0x555c('0x6'));var logger=require(_0x555c('0x7'))(_0x555c('0x8'));var config=require(_0x555c('0x9'));var jayson=require(_0x555c('0xa'));var client=jayson[_0x555c('0xb')][_0x555c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x266573,_0x319d20,_0xffde1f){return new BPromise(function(_0x1734f5,_0x103e8d){return client[_0x555c('0xd')](_0x266573,_0xffde1f)['then'](function(_0x16b04f){logger['info'](_0x555c('0xe'),_0x319d20,'request\x20sent');logger[_0x555c('0xf')](_0x555c('0x10'),_0x319d20,_0x555c('0x11'),JSON[_0x555c('0x12')](_0x16b04f));if(_0x16b04f[_0x555c('0x13')]){if(_0x16b04f[_0x555c('0x13')][_0x555c('0x14')]===0x1f4){logger[_0x555c('0x13')](_0x555c('0xe'),_0x319d20,_0x16b04f[_0x555c('0x13')][_0x555c('0x15')]);return _0x103e8d(_0x16b04f['error'][_0x555c('0x15')]);}logger[_0x555c('0x13')](_0x555c('0xe'),_0x319d20,_0x16b04f[_0x555c('0x13')][_0x555c('0x15')]);return _0x1734f5(_0x16b04f[_0x555c('0x13')][_0x555c('0x15')]);}else{logger[_0x555c('0x16')](_0x555c('0xe'),_0x319d20,_0x555c('0x11'));_0x1734f5(_0x16b04f[_0x555c('0x17')][_0x555c('0x15')]);}})[_0x555c('0x18')](function(_0x3be94a){logger[_0x555c('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x319d20,_0x3be94a);_0x103e8d(_0x3be94a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f8651d6..7825e5f 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 _0xdc9d=['put','update','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5cf203,_0x35fdde){var _0x537f54=function(_0x5b880e){while(--_0x5b880e){_0x5cf203['push'](_0x5cf203['shift']());}};_0x537f54(++_0x35fdde);}(_0xdc9d,0x9d));var _0xddc9=function(_0x21a2ca,_0x3ae951){_0x21a2ca=_0x21a2ca-0x0;var _0x4a42f6=_0xdc9d[_0x21a2ca];return _0x4a42f6;};'use strict';var multer=require(_0xddc9('0x0'));var util=require(_0xddc9('0x1'));var path=require('path');var timeout=require(_0xddc9('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xddc9('0x3'));var interaction=require(_0xddc9('0x4'));var config=require('../../config/environment');var controller=require(_0xddc9('0x5'));router[_0xddc9('0x6')]('/',auth[_0xddc9('0x7')](),controller[_0xddc9('0x8')]);router['get'](_0xddc9('0x9'),auth[_0xddc9('0x7')](),controller[_0xddc9('0xa')]);router[_0xddc9('0xb')]('/',auth[_0xddc9('0x7')](),controller[_0xddc9('0xc')]);router[_0xddc9('0xd')](_0xddc9('0x9'),auth[_0xddc9('0x7')](),controller[_0xddc9('0xe')]);router['delete'](_0xddc9('0x9'),auth[_0xddc9('0x7')](),controller[_0xddc9('0xf')]);module[_0xddc9('0x10')]=router; \ No newline at end of file +var _0x2191=['post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2191,0x1cd));var _0x1219=function(_0x349b8a,_0x52414f){_0x349b8a=_0x349b8a-0x0;var _0x37b055=_0x2191[_0x349b8a];return _0x37b055;};'use strict';var multer=require(_0x1219('0x0'));var util=require(_0x1219('0x1'));var path=require(_0x1219('0x2'));var timeout=require(_0x1219('0x3'));var express=require(_0x1219('0x4'));var router=express[_0x1219('0x5')]();var auth=require(_0x1219('0x6'));var interaction=require(_0x1219('0x7'));var config=require('../../config/environment');var controller=require(_0x1219('0x8'));router[_0x1219('0x9')]('/',auth['isAuthenticated'](),controller[_0x1219('0xa')]);router[_0x1219('0x9')](_0x1219('0xb'),auth[_0x1219('0xc')](),controller[_0x1219('0xd')]);router[_0x1219('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1219('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1219('0x10')]);router['delete'](_0x1219('0xb'),auth[_0x1219('0xc')](),controller[_0x1219('0x11')]);module[_0x1219('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6b16759..c9b71a6 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 _0x3e74=['name','sequelize','STRING'];(function(_0x4b05f6,_0x57dd81){var _0xbb1a44=function(_0x1dd695){while(--_0x1dd695){_0x4b05f6['push'](_0x4b05f6['shift']());}};_0xbb1a44(++_0x57dd81);}(_0x3e74,0x175));var _0x43e7=function(_0x3cf14a,_0x2489d8){_0x3cf14a=_0x3cf14a-0x0;var _0x4da25a=_0x3e74[_0x3cf14a];return _0x4da25a;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x14776e,_0x378224){var _0x3301b5=function(_0x28c846){while(--_0x28c846){_0x14776e['push'](_0x14776e['shift']());}};_0x3301b5(++_0x378224);}(_0x3e74,0x175));var _0x43e7=function(_0x3de9c1,_0x4567fe){_0x3de9c1=_0x3de9c1-0x0;var _0x57ec58=_0x3e74[_0x3de9c1];return _0x57ec58;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index c502f87..747d06f 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 _0x008c=['../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','VoiceContext,\x20%s,\x20%s','error','message','info','request\x20sent','catch','sendStatus','status','end','count','offset','limit','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','/etc/asterisk/extensions_xcally_contexts.conf','readFileSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger'];(function(_0x46c2e0,_0x10f029){var _0x2e4682=function(_0x2d4ee3){while(--_0x2d4ee3){_0x46c2e0['push'](_0x46c2e0['shift']());}};_0x2e4682(++_0x10f029);}(_0x008c,0x188));var _0xc008=function(_0x2ad3fd,_0x24c202){_0x2ad3fd=_0x2ad3fd-0x0;var _0x30fe82=_0x008c[_0x2ad3fd];return _0x30fe82;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var jayson=require(_0xc008('0x17'));var client=jayson[_0xc008('0x18')][_0xc008('0x19')]({'port':0x232a});function checkPasswordPattern(_0x69726e,_0x593f7a,_0x560e28){if(_0x560e28){var _0x33f44c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33f44c['test'](_0x593f7a)){return _0x69726e;}else{throw new db[(_0xc008('0x1a'))][(_0xc008('0x1b'))](_0xc008('0x1c'));}}else{return _0x69726e;}}function respondWithRpcPromise(_0x339ffc,_0x3f0ecf,_0x5ee00b,_0x5e894e){return new BPromise(function(_0x4bd0f4,_0x11ef38){var _0x15a6ad=_0x5e894e||client;return _0x15a6ad[_0xc008('0x1d')](_0x339ffc,_0x5ee00b)[_0xc008('0x1e')](function(_0x4fe771){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,'request\x20sent');logger[_0xc008('0x1f')](_0xc008('0x20'),_0x3f0ecf,'request\x20sent',JSON[_0xc008('0x21')](_0x4fe771));if(_0x4fe771['error']){if(_0x4fe771['error']['code']===0x1f4){logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771['error']['message']);return _0x11ef38(_0x4fe771['error']['message']);}logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);return _0x4bd0f4(_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);}else{logger[_0xc008('0x25')]('VoiceContext,\x20%s,\x20%s',_0x3f0ecf,_0xc008('0x26'));_0x4bd0f4(_0x4fe771['result']['message']);}})[_0xc008('0x27')](function(_0x36f358){logger[_0xc008('0x23')](_0xc008('0x22'),_0x3f0ecf,_0x36f358);_0x11ef38(_0x36f358);});});}function respondWithStatusCode(_0x5410f5,_0x48582b){_0x48582b=_0x48582b||0xcc;return function(_0x5de1e9){if(_0x5de1e9){return _0x5410f5[_0xc008('0x28')](_0x48582b);}return _0x5410f5[_0xc008('0x29')](_0x48582b)[_0xc008('0x2a')]();};}function respondWithResult(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0xc8;return function(_0x5e2aca){if(_0x5e2aca){return _0x2e31c2['status'](_0x5bebd9)['json'](_0x5e2aca);}};}function respondWithFilteredResult(_0x4caaf4,_0x3865c0){return function(_0x29ba43){if(_0x29ba43){var _0x25eae4=_0x29ba43[_0xc008('0x2b')],_0x529961=_0x3865c0[_0xc008('0x2c')],_0x24c14c=_0x3865c0['offset']+_0x3865c0[_0xc008('0x2d')],_0x32390d;if(_0x24c14c>=_0x25eae4){_0x24c14c=_0x25eae4;_0x32390d=0xc8;}else{_0x32390d=0xce;}_0x4caaf4[_0xc008('0x29')](_0x32390d);return _0x4caaf4['set']('Content-Range',_0x529961+'-'+_0x24c14c+'/'+_0x25eae4)['json'](_0x29ba43);}return null;};}function patchUpdates(_0x1032b2){return function(_0x267abd){try{jsonpatch[_0xc008('0x2e')](_0x267abd,_0x1032b2,!![]);}catch(_0x10889f){return BPromise[_0xc008('0x2f')](_0x10889f);}return _0x267abd[_0xc008('0x30')]();};}function saveUpdates(_0x294f97,_0x22d8e8){return function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0xc008('0x31')](_0x294f97)[_0xc008('0x1e')](function(_0x1ac7c8){return _0x1ac7c8;});}return null;};}function removeEntity(_0x596ee8,_0x334a09){return function(_0x4b7fd4){if(_0x4b7fd4){return _0x4b7fd4['destroy']()[_0xc008('0x1e')](function(){var _0x165a7b=_0x4b7fd4[_0xc008('0x32')]({'plain':!![]});var _0xca0520=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x35')]({'where':{'type':_0xca0520,'resourceId':_0x165a7b['id']}})[_0xc008('0x1e')](function(){return _0x4b7fd4;});})[_0xc008('0x1e')](function(){_0x596ee8['status'](0xcc)[_0xc008('0x2a')]();});}};}function handleEntityNotFound(_0x389a40,_0x459df4){return function(_0x344bad){if(!_0x344bad){_0x389a40[_0xc008('0x28')](0x194);}return _0x344bad;};}function handleError(_0x315562,_0x1667a0){_0x1667a0=_0x1667a0||0x1f4;return function(_0x5d0e06){logger[_0xc008('0x23')](_0x5d0e06[_0xc008('0x36')]);if(_0x5d0e06['name']){delete _0x5d0e06[_0xc008('0x37')];}_0x315562[_0xc008('0x29')](_0x1667a0)['send'](_0x5d0e06);};}exports[_0xc008('0x38')]=function(_0x2e4ae1,_0x280e9b){var _0x55ff48={},_0x53b353={},_0x478810={'count':0x0,'rows':[]};var _0x234f2a=_['map'](db[_0xc008('0x39')][_0xc008('0x3a')],function(_0x6a4ccb){return{'name':_0x6a4ccb[_0xc008('0x3b')],'type':_0x6a4ccb[_0xc008('0x3c')][_0xc008('0x3d')]};});_0x53b353[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x234f2a,_0xc008('0x37'));_0x53b353[_0xc008('0x40')]=_[_0xc008('0x41')](_0x2e4ae1[_0xc008('0x40')]);_0x53b353[_0xc008('0x42')]=_[_0xc008('0x43')](_0x53b353['model'],_0x53b353[_0xc008('0x40')]);_0x55ff48[_0xc008('0x44')]=_[_0xc008('0x43')](_0x53b353[_0xc008('0x3e')],qs['fields'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x45')]));_0x55ff48[_0xc008('0x44')]=_0x55ff48[_0xc008('0x44')][_0xc008('0x46')]?_0x55ff48['attributes']:_0x53b353[_0xc008('0x3e')];if(!_0x2e4ae1[_0xc008('0x40')][_0xc008('0x47')](_0xc008('0x48'))){_0x55ff48[_0xc008('0x2d')]=qs['limit'](_0x2e4ae1[_0xc008('0x40')][_0xc008('0x2d')]);_0x55ff48[_0xc008('0x2c')]=qs[_0xc008('0x2c')](_0x2e4ae1['query'][_0xc008('0x2c')]);}_0x55ff48[_0xc008('0x49')]=qs[_0xc008('0x4a')](_0x2e4ae1['query'][_0xc008('0x4a')]);_0x55ff48['where']=qs[_0xc008('0x42')](_['pick'](_0x2e4ae1[_0xc008('0x40')],_0x53b353[_0xc008('0x42')]),_0x234f2a);if(_0x2e4ae1['query'][_0xc008('0x4b')]){_0x55ff48[_0xc008('0x4c')]=_[_0xc008('0x4d')](_0x55ff48['where'],{'$or':_[_0xc008('0x3f')](_0x234f2a,function(_0x2a9b5c){if(_0x2a9b5c[_0xc008('0x3c')]!==_0xc008('0x4e')){var _0x347629={};_0x347629[_0x2a9b5c[_0xc008('0x37')]]={'$like':'%'+_0x2e4ae1['query']['filter']+'%'};return _0x347629;}})});}_0x55ff48=_['merge']({},_0x55ff48,_0x2e4ae1[_0xc008('0x4f')]);var _0x36417a={'where':_0x55ff48[_0xc008('0x4c')]};return db[_0xc008('0x39')][_0xc008('0x2b')](_0x36417a)[_0xc008('0x1e')](function(_0x2cf641){_0x478810[_0xc008('0x2b')]=_0x2cf641;if(_0x2e4ae1['query']['includeAll']){_0x55ff48['include']=[{'all':!![]}];}return db[_0xc008('0x39')][_0xc008('0x50')](_0x55ff48);})[_0xc008('0x1e')](function(_0x511383){_0x478810[_0xc008('0x51')]=_0x511383;return _0x478810;})[_0xc008('0x1e')](respondWithFilteredResult(_0x280e9b,_0x55ff48))[_0xc008('0x27')](handleError(_0x280e9b,null));};exports[_0xc008('0x52')]=function(_0x4981b4,_0x56e4ac){var _0x17ec90={'raw':![],'where':{'id':_0x4981b4[_0xc008('0x53')]['id']}},_0x405e87={};_0x405e87[_0xc008('0x3e')]=_['keys'](db['VoiceContext'][_0xc008('0x3a')]);_0x405e87['query']=_[_0xc008('0x41')](_0x4981b4[_0xc008('0x40')]);_0x405e87[_0xc008('0x42')]=_['intersection'](_0x405e87[_0xc008('0x3e')],_0x405e87[_0xc008('0x40')]);_0x17ec90[_0xc008('0x44')]=_[_0xc008('0x43')](_0x405e87[_0xc008('0x3e')],qs['fields'](_0x4981b4[_0xc008('0x40')][_0xc008('0x45')]));_0x17ec90['attributes']=_0x17ec90[_0xc008('0x44')][_0xc008('0x46')]?_0x17ec90['attributes']:_0x405e87['model'];if(_0x4981b4[_0xc008('0x40')][_0xc008('0x54')]){_0x17ec90[_0xc008('0x55')]=[{'all':!![]}];}_0x17ec90=_[_0xc008('0x4d')]({},_0x17ec90,_0x4981b4[_0xc008('0x4f')]);return db['VoiceContext']['find'](_0x17ec90)[_0xc008('0x1e')](handleEntityNotFound(_0x56e4ac,null))['then'](respondWithResult(_0x56e4ac,null))[_0xc008('0x27')](handleError(_0x56e4ac,null));};exports[_0xc008('0x56')]=function(_0xf94fcb,_0x2f1105,_0x44f42d){var _0x27a167;return db['VoiceContext'][_0xc008('0x56')](_0xf94fcb[_0xc008('0x57')],{'raw':!![]})[_0xc008('0x1e')](function(_0x2b350c){_0x27a167=_0x2b350c;return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x4fdab4){var _0x535e6e=fs['readFileSync'](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3aeeab=ejs[_0xc008('0x5b')](_0x535e6e,{'contexts':_0x4fdab4||[]});fs[_0xc008('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3aeeab);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x56'),{'module':_0xc008('0x5e')});})['then'](function(){var _0x4022dd=_0xf94fcb['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x4022dd)throw new Error(_0xc008('0x5f'));if(_0x4022dd[_0xc008('0x60')]===_0xc008('0x61')){var _0x192c87=_0x27a167[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x62')]({'where':{'name':'Contexts','userProfileId':_0x4022dd['userProfileId']},'raw':!![]})[_0xc008('0x1e')](function(_0x30aa1e){if(_0x30aa1e&&_0x30aa1e['autoAssociation']===0x0){return db[_0xc008('0x34')][_0xc008('0x56')]({'name':_0x192c87[_0xc008('0x37')],'resourceId':_0x192c87['id'],'type':_0x30aa1e[_0xc008('0x37')],'sectionId':_0x30aa1e['id']},{})[_0xc008('0x1e')](function(){return _0x27a167;});}else{return _0x27a167;}})[_0xc008('0x27')](function(_0x12973b){logger['error'](_0xc008('0x63'),_0x12973b);throw _0x12973b;});}return _0x27a167;})[_0xc008('0x1e')](respondWithResult(_0x2f1105,0xc9))[_0xc008('0x27')](handleError(_0x2f1105,null));};exports[_0xc008('0x31')]=function(_0xb3ca0f,_0x167425,_0x249898){var _0x280249;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0xb3ca0f[_0xc008('0x53')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x167425,null))[_0xc008('0x1e')](saveUpdates(_0xb3ca0f[_0xc008('0x57')],null))['then'](function(_0x36a08e){if(_0x36a08e){_0x280249=_0x36a08e;return db[_0xc008('0x39')][_0xc008('0x50')]({'raw':!![]});}})['then'](function(_0xd7d020){var _0x3214df=fs['readFileSync'](path['join'](config[_0xc008('0x59')],_0xc008('0x5a')),_0xc008('0x64'));var _0x39083c=ejs[_0xc008('0x5b')](_0x3214df,{'contexts':_0xd7d020||[]});fs[_0xc008('0x5c')](_0xc008('0x65'),_0x39083c);})[_0xc008('0x1e')](function(){return respondWithRpcPromise(_0xc008('0x5d'),_0xc008('0x31'),{'module':_0xc008('0x5e')});})['then'](function(){return _0x280249;})[_0xc008('0x1e')](respondWithResult(_0x167425,null))[_0xc008('0x27')](handleError(_0x167425,null));};exports[_0xc008('0x35')]=function(_0x27dc80,_0x521e67,_0x17ffb1){var _0x5975de;return db[_0xc008('0x39')][_0xc008('0x62')]({'where':{'id':_0x27dc80[_0xc008('0x53')]['id']}})['then'](handleEntityNotFound(_0x521e67,null))[_0xc008('0x1e')](removeEntity(_0x521e67,null))[_0xc008('0x1e')](function(){return db[_0xc008('0x39')]['findAll']({'raw':!![]});})[_0xc008('0x1e')](function(_0x539fc8){var _0x50ee03=fs[_0xc008('0x66')](path[_0xc008('0x58')](config[_0xc008('0x59')],_0xc008('0x5a')),'utf8');var _0x3c30db=ejs[_0xc008('0x5b')](_0x50ee03,{'contexts':_0x539fc8});fs['writeFileSync'](_0xc008('0x65'),_0x3c30db);return respondWithRpcPromise('Reload',_0xc008('0x35'),{'module':'chan_sip.so'});})[_0xc008('0x27')](handleError(_0x521e67,null));}; \ No newline at end of file +var _0xedd9=['VoiceContext','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','readFileSync','join','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','update','params','root','utf8','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Contexts','UserProfileResource','stack','name','send','index'];(function(_0x39dc30,_0x25816c){var _0x516ef9=function(_0x37d189){while(--_0x37d189){_0x39dc30['push'](_0x39dc30['shift']());}};_0x516ef9(++_0x25816c);}(_0xedd9,0xfc));var _0x9edd=function(_0x538493,_0x3c5710){_0x538493=_0x538493-0x0;var _0x44563f=_0xedd9[_0x538493];return _0x44563f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];var jayson=require(_0x9edd('0x17'));var client=jayson[_0x9edd('0x18')][_0x9edd('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3a7b84,_0xfca576,_0xef5498){if(_0xef5498){var _0x47eb64=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47eb64[_0x9edd('0x1a')](_0xfca576)){return _0x3a7b84;}else{throw new db[(_0x9edd('0x1b'))][(_0x9edd('0x1c'))](_0x9edd('0x1d'));}}else{return _0x3a7b84;}}function respondWithRpcPromise(_0x13b6b6,_0x338f3c,_0x1042aa,_0x75a4ab){return new BPromise(function(_0x4ea60f,_0x5f5bf4){var _0x448996=_0x75a4ab||client;return _0x448996[_0x9edd('0x1e')](_0x13b6b6,_0x1042aa)['then'](function(_0x1b54c0){logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,'request\x20sent');logger[_0x9edd('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x338f3c,_0x9edd('0x22'),JSON[_0x9edd('0x23')](_0x1b54c0));if(_0x1b54c0['error']){if(_0x1b54c0['error'][_0x9edd('0x24')]===0x1f4){logger['error'](_0x9edd('0x20'),_0x338f3c,_0x1b54c0['error']['message']);return _0x5f5bf4(_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x338f3c,_0x1b54c0[_0x9edd('0x25')][_0x9edd('0x26')]);return _0x4ea60f(_0x1b54c0[_0x9edd('0x25')]['message']);}else{logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0x338f3c,_0x9edd('0x22'));_0x4ea60f(_0x1b54c0[_0x9edd('0x27')][_0x9edd('0x26')]);}})['catch'](function(_0x46c383){logger[_0x9edd('0x25')](_0x9edd('0x20'),_0x338f3c,_0x46c383);_0x5f5bf4(_0x46c383);});});}function respondWithStatusCode(_0x2f9f86,_0x310a4d){_0x310a4d=_0x310a4d||0xcc;return function(_0x4d507f){if(_0x4d507f){return _0x2f9f86['sendStatus'](_0x310a4d);}return _0x2f9f86[_0x9edd('0x28')](_0x310a4d)[_0x9edd('0x29')]();};}function respondWithResult(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0xc8;return function(_0x3c2227){if(_0x3c2227){return _0x8d67aa['status'](_0x25e135)['json'](_0x3c2227);}};}function respondWithFilteredResult(_0x214d0a,_0x257a26){return function(_0x1c762c){if(_0x1c762c){var _0x52746a=_0x1c762c[_0x9edd('0x2a')],_0x238b22=_0x257a26['offset'],_0x28cfae=_0x257a26[_0x9edd('0x2b')]+_0x257a26[_0x9edd('0x2c')],_0x2ae8dd;if(_0x28cfae>=_0x52746a){_0x28cfae=_0x52746a;_0x2ae8dd=0xc8;}else{_0x2ae8dd=0xce;}_0x214d0a[_0x9edd('0x28')](_0x2ae8dd);return _0x214d0a[_0x9edd('0x2d')](_0x9edd('0x2e'),_0x238b22+'-'+_0x28cfae+'/'+_0x52746a)[_0x9edd('0x2f')](_0x1c762c);}return null;};}function patchUpdates(_0x209aba){return function(_0x1fba7b){try{jsonpatch[_0x9edd('0x30')](_0x1fba7b,_0x209aba,!![]);}catch(_0x1c2e2b){return BPromise[_0x9edd('0x31')](_0x1c2e2b);}return _0x1fba7b[_0x9edd('0x32')]();};}function saveUpdates(_0x6907a5,_0xa55906){return function(_0x1a6c23){if(_0x1a6c23){return _0x1a6c23['update'](_0x6907a5)[_0x9edd('0x33')](function(_0x259259){return _0x259259;});}return null;};}function removeEntity(_0x267c74,_0x5d1707){return function(_0x2d2f88){if(_0x2d2f88){return _0x2d2f88[_0x9edd('0x34')]()[_0x9edd('0x33')](function(){var _0x38a7be=_0x2d2f88[_0x9edd('0x35')]({'plain':!![]});var _0x2bc4ed=_0x9edd('0x36');return db[_0x9edd('0x37')][_0x9edd('0x34')]({'where':{'type':_0x2bc4ed,'resourceId':_0x38a7be['id']}})[_0x9edd('0x33')](function(){return _0x2d2f88;});})[_0x9edd('0x33')](function(){_0x267c74[_0x9edd('0x28')](0xcc)[_0x9edd('0x29')]();});}};}function handleEntityNotFound(_0x14f780,_0x5757fc){return function(_0x37fcb2){if(!_0x37fcb2){_0x14f780['sendStatus'](0x194);}return _0x37fcb2;};}function handleError(_0x968303,_0x148630){_0x148630=_0x148630||0x1f4;return function(_0x10d6fd){logger[_0x9edd('0x25')](_0x10d6fd[_0x9edd('0x38')]);if(_0x10d6fd['name']){delete _0x10d6fd[_0x9edd('0x39')];}_0x968303[_0x9edd('0x28')](_0x148630)[_0x9edd('0x3a')](_0x10d6fd);};}exports[_0x9edd('0x3b')]=function(_0x1be77f,_0x337e6c){var _0x5c0627={},_0x1cbbac={},_0x1ccee8={'count':0x0,'rows':[]};var _0x35c16f=_['map'](db[_0x9edd('0x3c')]['rawAttributes'],function(_0x3ef1d5){return{'name':_0x3ef1d5['fieldName'],'type':_0x3ef1d5[_0x9edd('0x3d')][_0x9edd('0x3e')]};});_0x1cbbac[_0x9edd('0x3f')]=_['map'](_0x35c16f,_0x9edd('0x39'));_0x1cbbac[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x1be77f['query']);_0x1cbbac[_0x9edd('0x42')]=_['intersection'](_0x1cbbac[_0x9edd('0x3f')],_0x1cbbac[_0x9edd('0x40')]);_0x5c0627['attributes']=_[_0x9edd('0x43')](_0x1cbbac[_0x9edd('0x3f')],qs[_0x9edd('0x44')](_0x1be77f[_0x9edd('0x40')]['fields']));_0x5c0627[_0x9edd('0x45')]=_0x5c0627['attributes'][_0x9edd('0x46')]?_0x5c0627[_0x9edd('0x45')]:_0x1cbbac['model'];if(!_0x1be77f[_0x9edd('0x40')]['hasOwnProperty']('nolimit')){_0x5c0627[_0x9edd('0x2c')]=qs[_0x9edd('0x2c')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2c')]);_0x5c0627[_0x9edd('0x2b')]=qs[_0x9edd('0x2b')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x2b')]);}_0x5c0627[_0x9edd('0x47')]=qs[_0x9edd('0x48')](_0x1be77f[_0x9edd('0x40')][_0x9edd('0x48')]);_0x5c0627[_0x9edd('0x49')]=qs[_0x9edd('0x42')](_[_0x9edd('0x4a')](_0x1be77f['query'],_0x1cbbac[_0x9edd('0x42')]),_0x35c16f);if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]){_0x5c0627[_0x9edd('0x49')]=_[_0x9edd('0x4c')](_0x5c0627[_0x9edd('0x49')],{'$or':_[_0x9edd('0x4d')](_0x35c16f,function(_0x4e9ad1){if(_0x4e9ad1['type']!=='VIRTUAL'){var _0x4a7dc9={};_0x4a7dc9[_0x4e9ad1['name']]={'$like':'%'+_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4b')]+'%'};return _0x4a7dc9;}})});}_0x5c0627=_[_0x9edd('0x4c')]({},_0x5c0627,_0x1be77f[_0x9edd('0x4e')]);var _0x367791={'where':_0x5c0627['where']};return db[_0x9edd('0x3c')][_0x9edd('0x2a')](_0x367791)[_0x9edd('0x33')](function(_0x4a89ae){_0x1ccee8[_0x9edd('0x2a')]=_0x4a89ae;if(_0x1be77f[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x5c0627[_0x9edd('0x50')]=[{'all':!![]}];}return db[_0x9edd('0x3c')][_0x9edd('0x51')](_0x5c0627);})['then'](function(_0x441e4a){_0x1ccee8[_0x9edd('0x52')]=_0x441e4a;return _0x1ccee8;})['then'](respondWithFilteredResult(_0x337e6c,_0x5c0627))[_0x9edd('0x53')](handleError(_0x337e6c,null));};exports[_0x9edd('0x54')]=function(_0x4bb324,_0x2bd089){var _0x8134cd={'raw':![],'where':{'id':_0x4bb324['params']['id']}},_0x468239={};_0x468239[_0x9edd('0x3f')]=_[_0x9edd('0x41')](db[_0x9edd('0x3c')][_0x9edd('0x55')]);_0x468239['query']=_[_0x9edd('0x41')](_0x4bb324[_0x9edd('0x40')]);_0x468239[_0x9edd('0x42')]=_['intersection'](_0x468239[_0x9edd('0x3f')],_0x468239[_0x9edd('0x40')]);_0x8134cd['attributes']=_[_0x9edd('0x43')](_0x468239['model'],qs[_0x9edd('0x44')](_0x4bb324[_0x9edd('0x40')][_0x9edd('0x44')]));_0x8134cd[_0x9edd('0x45')]=_0x8134cd[_0x9edd('0x45')][_0x9edd('0x46')]?_0x8134cd[_0x9edd('0x45')]:_0x468239[_0x9edd('0x3f')];if(_0x4bb324[_0x9edd('0x40')][_0x9edd('0x4f')]){_0x8134cd[_0x9edd('0x50')]=[{'all':!![]}];}_0x8134cd=_['merge']({},_0x8134cd,_0x4bb324[_0x9edd('0x4e')]);return db[_0x9edd('0x3c')][_0x9edd('0x56')](_0x8134cd)['then'](handleEntityNotFound(_0x2bd089,null))[_0x9edd('0x33')](respondWithResult(_0x2bd089,null))['catch'](handleError(_0x2bd089,null));};exports['create']=function(_0x54ecfa,_0x1348a7,_0x45f47c){var _0x366316;return db[_0x9edd('0x3c')]['create'](_0x54ecfa['body'],{'raw':!![]})['then'](function(_0x71820f){_0x366316=_0x71820f;return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x2e2920){var _0x41ec97=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],_0x9edd('0x59')),'utf8');var _0x421e82=ejs[_0x9edd('0x5a')](_0x41ec97,{'contexts':_0x2e2920||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x421e82);})[_0x9edd('0x33')](function(){return respondWithRpcPromise(_0x9edd('0x5c'),'create',{'module':_0x9edd('0x5d')});})[_0x9edd('0x33')](function(){var _0x430eb4=_0x54ecfa[_0x9edd('0x5e')][_0x9edd('0x35')]({'plain':!![]});if(!_0x430eb4)throw new Error(_0x9edd('0x5f'));if(_0x430eb4['role']==='user'){var _0x452ca5=_0x366316['get']({'plain':!![]});return db[_0x9edd('0x60')][_0x9edd('0x56')]({'where':{'name':_0x9edd('0x36'),'userProfileId':_0x430eb4[_0x9edd('0x61')]},'raw':!![]})['then'](function(_0x21ead2){if(_0x21ead2&&_0x21ead2['autoAssociation']===0x0){return db[_0x9edd('0x37')][_0x9edd('0x62')]({'name':_0x452ca5[_0x9edd('0x39')],'resourceId':_0x452ca5['id'],'type':_0x21ead2['name'],'sectionId':_0x21ead2['id']},{})[_0x9edd('0x33')](function(){return _0x366316;});}else{return _0x366316;}})['catch'](function(_0x37e603){logger[_0x9edd('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e603);throw _0x37e603;});}return _0x366316;})[_0x9edd('0x33')](respondWithResult(_0x1348a7,0xc9))['catch'](handleError(_0x1348a7,null));};exports[_0x9edd('0x63')]=function(_0x134c9c,_0x307a61,_0x50f4fc){var _0x4181b9;return db[_0x9edd('0x3c')][_0x9edd('0x56')]({'where':{'id':_0x134c9c[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x307a61,null))['then'](saveUpdates(_0x134c9c['body'],null))[_0x9edd('0x33')](function(_0x211526){if(_0x211526){_0x4181b9=_0x211526;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x1bc89b){var _0x4e003a=fs['readFileSync'](path[_0x9edd('0x58')](config[_0x9edd('0x65')],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x11e082=ejs[_0x9edd('0x5a')](_0x4e003a,{'contexts':_0x1bc89b||[]});fs['writeFileSync'](_0x9edd('0x5b'),_0x11e082);})['then'](function(){return respondWithRpcPromise(_0x9edd('0x5c'),_0x9edd('0x63'),{'module':'chan_sip.so'});})[_0x9edd('0x33')](function(){return _0x4181b9;})[_0x9edd('0x33')](respondWithResult(_0x307a61,null))['catch'](handleError(_0x307a61,null));};exports[_0x9edd('0x34')]=function(_0x475dc3,_0x460a92,_0x1d9536){var _0x5ce70b;return db[_0x9edd('0x3c')]['find']({'where':{'id':_0x475dc3[_0x9edd('0x64')]['id']}})[_0x9edd('0x33')](handleEntityNotFound(_0x460a92,null))[_0x9edd('0x33')](removeEntity(_0x460a92,null))['then'](function(){return db[_0x9edd('0x3c')][_0x9edd('0x51')]({'raw':!![]});})[_0x9edd('0x33')](function(_0x383cb9){var _0x25626a=fs[_0x9edd('0x57')](path[_0x9edd('0x58')](config['root'],'server/files/templates/context.ejs'),_0x9edd('0x66'));var _0x3c7874=ejs[_0x9edd('0x5a')](_0x25626a,{'contexts':_0x383cb9});fs[_0x9edd('0x67')](_0x9edd('0x5b'),_0x3c7874);return respondWithRpcPromise('Reload',_0x9edd('0x34'),{'module':_0x9edd('0x5d')});})[_0x9edd('0x53')](handleError(_0x460a92,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 2c6e11c..c25c127 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 _0xeae0=['rimraf','../../config/environment','define','VoiceContext','voice_contexts','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3a31a4,_0x5977b3){var _0x5e04c7=function(_0x460ab7){while(--_0x460ab7){_0x3a31a4['push'](_0x3a31a4['shift']());}};_0x5e04c7(++_0x5977b3);}(_0xeae0,0x1a7));var _0x0eae=function(_0x305c8f,_0xc5f7fb){_0x305c8f=_0x305c8f-0x0;var _0x5ddc30=_0xeae0[_0x305c8f];return _0x5ddc30;};'use strict';var _=require('lodash');var util=require(_0x0eae('0x0'));var logger=require(_0x0eae('0x1'))(_0x0eae('0x2'));var moment=require('moment');var BPromise=require(_0x0eae('0x3'));var rp=require(_0x0eae('0x4'));var fs=require('fs');var path=require(_0x0eae('0x5'));var rimraf=require(_0x0eae('0x6'));var config=require(_0x0eae('0x7'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x596c17,_0x20bbfb){return _0x596c17[_0x0eae('0x8')](_0x0eae('0x9'),attributes,{'tableName':_0x0eae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x231f=['path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57e212,_0xb2da96){var _0x1e9cf7=function(_0xd06dd5){while(--_0xd06dd5){_0x57e212['push'](_0x57e212['shift']());}};_0x1e9cf7(++_0xb2da96);}(_0x231f,0x66));var _0xf231=function(_0x20450b,_0x544f63){_0x20450b=_0x20450b-0x0;var _0x521034=_0x231f[_0x20450b];return _0x521034;};'use strict';var _=require(_0xf231('0x0'));var util=require('util');var logger=require(_0xf231('0x1'))(_0xf231('0x2'));var moment=require(_0xf231('0x3'));var BPromise=require(_0xf231('0x4'));var rp=require(_0xf231('0x5'));var fs=require('fs');var path=require(_0xf231('0x6'));var rimraf=require(_0xf231('0x7'));var config=require(_0xf231('0x8'));var attributes=require(_0xf231('0x9'));module['exports']=function(_0x3eafb6,_0x50b47e){return _0x3eafb6[_0xf231('0xa')](_0xf231('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 73dc2da..d9363dc 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 _0x162d=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1bd80b,_0x5a1d71){var _0x31f9ab=function(_0x413dcc){while(--_0x413dcc){_0x1bd80b['push'](_0x1bd80b['shift']());}};_0x31f9ab(++_0x5a1d71);}(_0x162d,0x1f0));var _0xd162=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x162d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xd162('0x0'));var util=require('util');var moment=require(_0xd162('0x1'));var BPromise=require(_0xd162('0x2'));var rs=require(_0xd162('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd162('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd162('0x5'))(_0xd162('0x6'));var config=require(_0xd162('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd162('0x8')][_0xd162('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fd7c3,_0xf6c7ee,_0x289ba7){return new BPromise(function(_0x1a730e,_0x2ce62b){return client['request'](_0x3fd7c3,_0x289ba7)[_0xd162('0xa')](function(_0x36695c){logger[_0xd162('0xb')]('VoiceContext,\x20%s,\x20%s',_0xf6c7ee,_0xd162('0xc'));logger['debug'](_0xd162('0xd'),_0xf6c7ee,'request\x20sent',JSON[_0xd162('0xe')](_0x36695c));if(_0x36695c[_0xd162('0xf')]){if(_0x36695c['error']['code']===0x1f4){logger[_0xd162('0xf')]('VoiceContext,\x20%s,\x20%s',_0xf6c7ee,_0x36695c['error'][_0xd162('0x10')]);return _0x2ce62b(_0x36695c[_0xd162('0xf')][_0xd162('0x10')]);}logger[_0xd162('0xf')](_0xd162('0x11'),_0xf6c7ee,_0x36695c[_0xd162('0xf')]['message']);return _0x1a730e(_0x36695c[_0xd162('0xf')][_0xd162('0x10')]);}else{logger[_0xd162('0xb')](_0xd162('0x11'),_0xf6c7ee,_0xd162('0xc'));_0x1a730e(_0x36695c[_0xd162('0x12')][_0xd162('0x10')]);}})[_0xd162('0x13')](function(_0x33dc63){logger[_0xd162('0xf')](_0xd162('0x11'),_0xf6c7ee,_0x33dc63);_0x2ce62b(_0x33dc63);});});} \ No newline at end of file +var _0x2a8a=['../../config/environment','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x42505a,_0x7ede7){var _0x43cab1=function(_0x5d2574){while(--_0x5d2574){_0x42505a['push'](_0x42505a['shift']());}};_0x43cab1(++_0x7ede7);}(_0x2a8a,0xaf));var _0xa2a8=function(_0x1b394a,_0x437051){_0x1b394a=_0x1b394a-0x0;var _0xa69dbf=_0x2a8a[_0x1b394a];return _0xa69dbf;};'use strict';var _=require(_0xa2a8('0x0'));var util=require(_0xa2a8('0x1'));var moment=require(_0xa2a8('0x2'));var BPromise=require('bluebird');var rs=require(_0xa2a8('0x3'));var fs=require('fs');var Redis=require(_0xa2a8('0x4'));var db=require(_0xa2a8('0x5'))['db'];var utils=require(_0xa2a8('0x6'));var logger=require(_0xa2a8('0x7'))(_0xa2a8('0x8'));var config=require(_0xa2a8('0x9'));var jayson=require(_0xa2a8('0xa'));var client=jayson[_0xa2a8('0xb')][_0xa2a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cf8a0,_0xbab4e6,_0x530cdb){return new BPromise(function(_0xa9e684,_0x1baa08){return client['request'](_0x2cf8a0,_0x530cdb)[_0xa2a8('0xd')](function(_0x25d4d3){logger['info'](_0xa2a8('0xe'),_0xbab4e6,_0xa2a8('0xf'));logger[_0xa2a8('0x10')](_0xa2a8('0x11'),_0xbab4e6,'request\x20sent',JSON[_0xa2a8('0x12')](_0x25d4d3));if(_0x25d4d3['error']){if(_0x25d4d3[_0xa2a8('0x13')]['code']===0x1f4){logger[_0xa2a8('0x13')]('VoiceContext,\x20%s,\x20%s',_0xbab4e6,_0x25d4d3[_0xa2a8('0x13')][_0xa2a8('0x14')]);return _0x1baa08(_0x25d4d3[_0xa2a8('0x13')][_0xa2a8('0x14')]);}logger[_0xa2a8('0x13')](_0xa2a8('0xe'),_0xbab4e6,_0x25d4d3[_0xa2a8('0x13')][_0xa2a8('0x14')]);return _0xa9e684(_0x25d4d3[_0xa2a8('0x13')][_0xa2a8('0x14')]);}else{logger['info'](_0xa2a8('0xe'),_0xbab4e6,_0xa2a8('0xf'));_0xa9e684(_0x25d4d3[_0xa2a8('0x15')][_0xa2a8('0x14')]);}})[_0xa2a8('0x16')](function(_0x595920){logger[_0xa2a8('0x13')](_0xa2a8('0xe'),_0xbab4e6,_0x595920);_0x1baa08(_0x595920);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6d08326..472d9bb 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 _0x6588=['get','isAuthenticated','index','describe','/:id','show','post','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x3ce7b2,_0x3c4f70){var _0x4828e9=function(_0x3a8df8){while(--_0x3a8df8){_0x3ce7b2['push'](_0x3ce7b2['shift']());}};_0x4828e9(++_0x3c4f70);}(_0x6588,0xcf));var _0x8658=function(_0x349b00,_0x5b58c3){_0x349b00=_0x349b00-0x0;var _0x45744f=_0x6588[_0x349b00];return _0x45744f;};'use strict';var multer=require(_0x8658('0x0'));var util=require(_0x8658('0x1'));var path=require(_0x8658('0x2'));var timeout=require(_0x8658('0x3'));var express=require(_0x8658('0x4'));var router=express['Router']();var auth=require(_0x8658('0x5'));var interaction=require(_0x8658('0x6'));var config=require(_0x8658('0x7'));var controller=require(_0x8658('0x8'));router[_0x8658('0x9')]('/',auth[_0x8658('0xa')](),controller[_0x8658('0xb')]);router[_0x8658('0x9')]('/describe',auth[_0x8658('0xa')](),controller[_0x8658('0xc')]);router[_0x8658('0x9')](_0x8658('0xd'),auth['isAuthenticated'](),controller[_0x8658('0xe')]);router[_0x8658('0xf')]('/',auth[_0x8658('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8658('0x10')]);router[_0x8658('0x11')](_0x8658('0xd'),auth[_0x8658('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfd13=['./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','util','../../components/auth/service','../../config/environment'];(function(_0x5e0807,_0x1f4b1f){var _0xb3a94a=function(_0x388ed1){while(--_0x388ed1){_0x5e0807['push'](_0x5e0807['shift']());}};_0xb3a94a(++_0x1f4b1f);}(_0xfd13,0xcf));var _0x3fd1=function(_0x2f4ac4,_0x1a14e3){_0x2f4ac4=_0x2f4ac4-0x0;var _0x26cf81=_0xfd13[_0x2f4ac4];return _0x26cf81;};'use strict';var multer=require('multer');var util=require(_0x3fd1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3fd1('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x3fd1('0x2'));var controller=require(_0x3fd1('0x3'));router[_0x3fd1('0x4')]('/',auth[_0x3fd1('0x5')](),controller['index']);router[_0x3fd1('0x4')](_0x3fd1('0x6'),auth[_0x3fd1('0x5')](),controller[_0x3fd1('0x7')]);router['get'](_0x3fd1('0x8'),auth[_0x3fd1('0x5')](),controller[_0x3fd1('0x9')]);router['post']('/',auth[_0x3fd1('0x5')](),controller['create']);router[_0x3fd1('0xa')]('/:id',auth[_0x3fd1('0x5')](),controller[_0x3fd1('0xb')]);router[_0x3fd1('0xc')](_0x3fd1('0x8'),auth[_0x3fd1('0x5')](),controller[_0x3fd1('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 85f8912..536480e 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 _0x682d=['INTEGER','DATE','called,connect,complete','exports','STRING'];(function(_0x4d7ca7,_0x41f1a5){var _0x772bbb=function(_0x35908b){while(--_0x35908b){_0x4d7ca7['push'](_0x4d7ca7['shift']());}};_0x772bbb(++_0x41f1a5);}(_0x682d,0x9e));var _0xd682=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x682d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xd682('0x0')]={'privilege':{'type':Sequelize[_0xd682('0x1')]},'channel':{'type':Sequelize[_0xd682('0x1')]},'channelstate':{'type':Sequelize[_0xd682('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd682('0x1')]},'calleridnum':{'type':Sequelize[_0xd682('0x1')]},'calleridname':{'type':Sequelize[_0xd682('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd682('0x1')]},'connectedlinename':{'type':Sequelize[_0xd682('0x1')]},'language':{'type':Sequelize[_0xd682('0x1')]},'accountcode':{'type':Sequelize[_0xd682('0x1')]},'context':{'type':Sequelize[_0xd682('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd682('0x2')]},'uniqueid':{'type':Sequelize[_0xd682('0x1')]},'linkedid':{'type':Sequelize[_0xd682('0x1')]},'destchannel':{'type':Sequelize[_0xd682('0x1')]},'destchannelstate':{'type':Sequelize[_0xd682('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd682('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xd682('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd682('0x1')]},'destcontext':{'type':Sequelize[_0xd682('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd682('0x2')]},'destuniqueid':{'type':Sequelize[_0xd682('0x1')]},'destlinkedid':{'type':Sequelize[_0xd682('0x1')]},'dialstring':{'type':Sequelize[_0xd682('0x1')]},'dialstatus':{'type':Sequelize[_0xd682('0x1')]},'starttime':{'type':Sequelize[_0xd682('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd682('0x3')]},'lastevent':{'type':Sequelize[_0xd682('0x1')],'comment':_0xd682('0x4')},'routeId':{'type':Sequelize[_0xd682('0x2')]},'duration':{'type':Sequelize[_0xd682('0x2')]},'holdtime':{'type':Sequelize[_0xd682('0x2')]},'billableseconds':{'type':Sequelize[_0xd682('0x2')]}}; \ No newline at end of file +var _0xe218=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe218,0x154));var _0x8e21=function(_0x312c87,_0x336076){_0x312c87=_0x312c87-0x0;var _0x3f4a1a=_0xe218[_0x312c87];return _0x3f4a1a;};'use strict';var Sequelize=require(_0x8e21('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x8e21('0x1')]},'channel':{'type':Sequelize[_0x8e21('0x1')]},'channelstate':{'type':Sequelize[_0x8e21('0x2')]},'channelstatedesc':{'type':Sequelize[_0x8e21('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8e21('0x1')]},'connectedlinenum':{'type':Sequelize[_0x8e21('0x1')]},'connectedlinename':{'type':Sequelize[_0x8e21('0x1')]},'language':{'type':Sequelize[_0x8e21('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8e21('0x1')]},'exten':{'type':Sequelize[_0x8e21('0x1')]},'priority':{'type':Sequelize[_0x8e21('0x2')]},'uniqueid':{'type':Sequelize[_0x8e21('0x1')]},'linkedid':{'type':Sequelize[_0x8e21('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x8e21('0x1')]},'destcalleridnum':{'type':Sequelize[_0x8e21('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x8e21('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x8e21('0x1')]},'destlanguage':{'type':Sequelize[_0x8e21('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x8e21('0x1')]},'destexten':{'type':Sequelize[_0x8e21('0x1')]},'destpriority':{'type':Sequelize[_0x8e21('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x8e21('0x1')]},'dialstring':{'type':Sequelize[_0x8e21('0x1')]},'dialstatus':{'type':Sequelize[_0x8e21('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8e21('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0x8e21('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x8e21('0x2')]},'billableseconds':{'type':Sequelize[_0x8e21('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 07a6601..1082809 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 _0xf4e6=['type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName'];(function(_0x37e1aa,_0x4f03cb){var _0x5f4184=function(_0x3eefb3){while(--_0x3eefb3){_0x37e1aa['push'](_0x37e1aa['shift']());}};_0x5f4184(++_0x4f03cb);}(_0xf4e6,0x1e1));var _0x6f4e=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xf4e6[_0x318410];return _0x2898a3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f4e('0x0'));var jsonpatch=require(_0x6f4e('0x1'));var rp=require(_0x6f4e('0x2'));var moment=require('moment');var BPromise=require(_0x6f4e('0x3'));var Mustache=require(_0x6f4e('0x4'));var util=require(_0x6f4e('0x5'));var path=require('path');var sox=require(_0x6f4e('0x6'));var csv=require('to-csv');var ejs=require(_0x6f4e('0x7'));var fs=require('fs');var _=require(_0x6f4e('0x8'));var squel=require(_0x6f4e('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f4e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6f4e('0xb'));var querystring=require(_0x6f4e('0xc'));var Papa=require(_0x6f4e('0xd'));var Redis=require(_0x6f4e('0xe'));var authService=require(_0x6f4e('0xf'));var qs=require(_0x6f4e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f4e('0x11'));var logger=require('../../config/logger')(_0x6f4e('0x12'));var utils=require(_0x6f4e('0x13'));var config=require(_0x6f4e('0x14'));var db=require(_0x6f4e('0x15'))['db'];function respondWithStatusCode(_0xdc2ef4,_0x2069b2){_0x2069b2=_0x2069b2||0xcc;return function(_0x2dd6c5){if(_0x2dd6c5){return _0xdc2ef4[_0x6f4e('0x16')](_0x2069b2);}return _0xdc2ef4['status'](_0x2069b2)[_0x6f4e('0x17')]();};}function respondWithResult(_0x390ef0,_0x3e54de){_0x3e54de=_0x3e54de||0xc8;return function(_0x4dcec3){if(_0x4dcec3){return _0x390ef0[_0x6f4e('0x18')](_0x3e54de)[_0x6f4e('0x19')](_0x4dcec3);}};}function respondWithFilteredResult(_0x5b1460,_0x1bb785){return function(_0x448d00){if(_0x448d00){var _0x1c2175=_0x448d00[_0x6f4e('0x1a')],_0x134967=_0x1bb785[_0x6f4e('0x1b')],_0x55a404=_0x1bb785[_0x6f4e('0x1b')]+_0x1bb785[_0x6f4e('0x1c')],_0x4a7dd3;if(_0x55a404>=_0x1c2175){_0x55a404=_0x1c2175;_0x4a7dd3=0xc8;}else{_0x4a7dd3=0xce;}_0x5b1460['status'](_0x4a7dd3);return _0x5b1460[_0x6f4e('0x1d')]('Content-Range',_0x134967+'-'+_0x55a404+'/'+_0x1c2175)['json'](_0x448d00);}return null;};}function patchUpdates(_0x58f790){return function(_0x524f06){try{jsonpatch[_0x6f4e('0x1e')](_0x524f06,_0x58f790,!![]);}catch(_0x27a649){return BPromise[_0x6f4e('0x1f')](_0x27a649);}return _0x524f06[_0x6f4e('0x20')]();};}function saveUpdates(_0x454fbe,_0x2d08bd){return function(_0x3b44a7){if(_0x3b44a7){return _0x3b44a7[_0x6f4e('0x21')](_0x454fbe)[_0x6f4e('0x22')](function(_0x2bda29){return _0x2bda29;});}return null;};}function removeEntity(_0x1418db,_0x3a8f6e){return function(_0x10b2b4){if(_0x10b2b4){return _0x10b2b4[_0x6f4e('0x23')]()[_0x6f4e('0x22')](function(){_0x1418db['status'](0xcc)[_0x6f4e('0x17')]();});}};}function handleEntityNotFound(_0x586006,_0x490ec0){return function(_0x1f28fd){if(!_0x1f28fd){_0x586006[_0x6f4e('0x16')](0x194);}return _0x1f28fd;};}function handleError(_0x5606fa,_0x396c78){_0x396c78=_0x396c78||0x1f4;return function(_0x3f3b6c){logger[_0x6f4e('0x24')](_0x3f3b6c[_0x6f4e('0x25')]);if(_0x3f3b6c[_0x6f4e('0x26')]){delete _0x3f3b6c[_0x6f4e('0x26')];}_0x5606fa['status'](_0x396c78)[_0x6f4e('0x27')](_0x3f3b6c);};}exports['index']=function(_0x2aa57e,_0x14e68a){var _0x5b918e={},_0x23066b={},_0x158461={'count':0x0,'rows':[]};var _0x1a6a02=_[_0x6f4e('0x28')](db[_0x6f4e('0x29')][_0x6f4e('0x2a')],function(_0x22dd0e){return{'name':_0x22dd0e[_0x6f4e('0x2b')],'type':_0x22dd0e[_0x6f4e('0x2c')][_0x6f4e('0x2d')]};});_0x23066b[_0x6f4e('0x2e')]=_[_0x6f4e('0x28')](_0x1a6a02,'name');_0x23066b['query']=_[_0x6f4e('0x2f')](_0x2aa57e[_0x6f4e('0x30')]);_0x23066b[_0x6f4e('0x31')]=_[_0x6f4e('0x32')](_0x23066b[_0x6f4e('0x2e')],_0x23066b[_0x6f4e('0x30')]);_0x5b918e[_0x6f4e('0x33')]=_['intersection'](_0x23066b['model'],qs[_0x6f4e('0x34')](_0x2aa57e[_0x6f4e('0x30')][_0x6f4e('0x34')]));_0x5b918e[_0x6f4e('0x33')]=_0x5b918e['attributes'][_0x6f4e('0x35')]?_0x5b918e[_0x6f4e('0x33')]:_0x23066b[_0x6f4e('0x2e')];if(!_0x2aa57e[_0x6f4e('0x30')][_0x6f4e('0x36')](_0x6f4e('0x37'))){_0x5b918e['limit']=qs[_0x6f4e('0x1c')](_0x2aa57e[_0x6f4e('0x30')][_0x6f4e('0x1c')]);_0x5b918e[_0x6f4e('0x1b')]=qs[_0x6f4e('0x1b')](_0x2aa57e[_0x6f4e('0x30')]['offset']);}_0x5b918e[_0x6f4e('0x38')]=qs[_0x6f4e('0x39')](_0x2aa57e[_0x6f4e('0x30')][_0x6f4e('0x39')]);_0x5b918e[_0x6f4e('0x3a')]=qs['filters'](_[_0x6f4e('0x3b')](_0x2aa57e[_0x6f4e('0x30')],_0x23066b[_0x6f4e('0x31')]),_0x1a6a02);if(_0x2aa57e[_0x6f4e('0x30')][_0x6f4e('0x3c')]){_0x5b918e[_0x6f4e('0x3a')]=_[_0x6f4e('0x3d')](_0x5b918e['where'],{'$or':_[_0x6f4e('0x28')](_0x1a6a02,function(_0x59c111){if(_0x59c111[_0x6f4e('0x2c')]!==_0x6f4e('0x3e')){var _0x34f967={};_0x34f967[_0x59c111['name']]={'$like':'%'+_0x2aa57e[_0x6f4e('0x30')][_0x6f4e('0x3c')]+'%'};return _0x34f967;}})});}_0x5b918e=_[_0x6f4e('0x3d')]({},_0x5b918e,_0x2aa57e[_0x6f4e('0x3f')]);var _0x25af10={'where':_0x5b918e[_0x6f4e('0x3a')]};return db[_0x6f4e('0x29')][_0x6f4e('0x1a')](_0x25af10)[_0x6f4e('0x22')](function(_0x2e1cae){_0x158461[_0x6f4e('0x1a')]=_0x2e1cae;if(_0x2aa57e[_0x6f4e('0x30')][_0x6f4e('0x40')]){_0x5b918e[_0x6f4e('0x41')]=[{'all':!![]}];}return db[_0x6f4e('0x29')][_0x6f4e('0x42')](_0x5b918e);})['then'](function(_0x472a88){_0x158461[_0x6f4e('0x43')]=_0x472a88;return _0x158461;})[_0x6f4e('0x22')](respondWithFilteredResult(_0x14e68a,_0x5b918e))[_0x6f4e('0x44')](handleError(_0x14e68a,null));};exports[_0x6f4e('0x45')]=function(_0x21935b,_0x5e078c){var _0x4e8811={'raw':!![],'where':{'id':_0x21935b['params']['id']}},_0x37965b={};_0x37965b[_0x6f4e('0x2e')]=_[_0x6f4e('0x2f')](db['VoiceDialReport'][_0x6f4e('0x2a')]);_0x37965b[_0x6f4e('0x30')]=_[_0x6f4e('0x2f')](_0x21935b[_0x6f4e('0x30')]);_0x37965b['filters']=_[_0x6f4e('0x32')](_0x37965b[_0x6f4e('0x2e')],_0x37965b[_0x6f4e('0x30')]);_0x4e8811[_0x6f4e('0x33')]=_[_0x6f4e('0x32')](_0x37965b[_0x6f4e('0x2e')],qs[_0x6f4e('0x34')](_0x21935b['query'][_0x6f4e('0x34')]));_0x4e8811[_0x6f4e('0x33')]=_0x4e8811[_0x6f4e('0x33')]['length']?_0x4e8811['attributes']:_0x37965b[_0x6f4e('0x2e')];if(_0x21935b[_0x6f4e('0x30')][_0x6f4e('0x40')]){_0x4e8811[_0x6f4e('0x41')]=[{'all':!![]}];}_0x4e8811=_[_0x6f4e('0x3d')]({},_0x4e8811,_0x21935b['options']);return db[_0x6f4e('0x29')]['find'](_0x4e8811)[_0x6f4e('0x22')](handleEntityNotFound(_0x5e078c,null))['then'](respondWithResult(_0x5e078c,null))[_0x6f4e('0x44')](handleError(_0x5e078c,null));};exports[_0x6f4e('0x46')]=function(_0x121b5c,_0x2d2060){return db[_0x6f4e('0x29')][_0x6f4e('0x46')](_0x121b5c['body'],{})[_0x6f4e('0x22')](respondWithResult(_0x2d2060,0xc9))[_0x6f4e('0x44')](handleError(_0x2d2060,null));};exports[_0x6f4e('0x21')]=function(_0x21efc9,_0x5ab766){if(_0x21efc9['body']['id']){delete _0x21efc9[_0x6f4e('0x47')]['id'];}return db[_0x6f4e('0x29')][_0x6f4e('0x48')]({'where':{'id':_0x21efc9[_0x6f4e('0x49')]['id']}})[_0x6f4e('0x22')](handleEntityNotFound(_0x5ab766,null))[_0x6f4e('0x22')](saveUpdates(_0x21efc9[_0x6f4e('0x47')],null))[_0x6f4e('0x22')](respondWithResult(_0x5ab766,null))[_0x6f4e('0x44')](handleError(_0x5ab766,null));};exports[_0x6f4e('0x23')]=function(_0x141b4c,_0x20b5f6){return db[_0x6f4e('0x29')]['find']({'where':{'id':_0x141b4c[_0x6f4e('0x49')]['id']}})[_0x6f4e('0x22')](handleEntityNotFound(_0x20b5f6,null))['then'](removeEntity(_0x20b5f6,null))[_0x6f4e('0x44')](handleError(_0x20b5f6,null));};exports['describe']=function(_0x3572cf,_0xdb8d89){return db[_0x6f4e('0x29')][_0x6f4e('0x4a')]()[_0x6f4e('0x22')](respondWithResult(_0xdb8d89,null))[_0x6f4e('0x44')](handleError(_0xdb8d89,null));}; \ No newline at end of file +var _0x3e8e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','VoiceDialReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','include','rows','catch','params','fields','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x55257d,_0x3998ec){var _0x4d296d=function(_0x522f05){while(--_0x522f05){_0x55257d['push'](_0x55257d['shift']());}};_0x4d296d(++_0x3998ec);}(_0x3e8e,0x106));var _0xe3e8=function(_0x575ae6,_0x385cfa){_0x575ae6=_0x575ae6-0x0;var _0x29d626=_0x3e8e[_0x575ae6];return _0x29d626;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3e8('0x0'));var rimraf=require(_0xe3e8('0x1'));var zipdir=require(_0xe3e8('0x2'));var jsonpatch=require(_0xe3e8('0x3'));var rp=require(_0xe3e8('0x4'));var moment=require(_0xe3e8('0x5'));var BPromise=require(_0xe3e8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe3e8('0x7'));var sox=require(_0xe3e8('0x8'));var csv=require(_0xe3e8('0x9'));var ejs=require(_0xe3e8('0xa'));var fs=require('fs');var _=require(_0xe3e8('0xb'));var squel=require(_0xe3e8('0xc'));var crypto=require('crypto');var jsforce=require(_0xe3e8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3e8('0xe'));var Papa=require(_0xe3e8('0xf'));var Redis=require('ioredis');var authService=require(_0xe3e8('0x10'));var qs=require(_0xe3e8('0x11'));var as=require(_0xe3e8('0x12'));var hardwareService=require(_0xe3e8('0x13'));var logger=require(_0xe3e8('0x14'))(_0xe3e8('0x15'));var utils=require(_0xe3e8('0x16'));var config=require('../../config/environment');var db=require(_0xe3e8('0x17'))['db'];function respondWithStatusCode(_0x5d369e,_0x3ff52b){_0x3ff52b=_0x3ff52b||0xcc;return function(_0xffb82e){if(_0xffb82e){return _0x5d369e['sendStatus'](_0x3ff52b);}return _0x5d369e[_0xe3e8('0x18')](_0x3ff52b)['end']();};}function respondWithResult(_0x58b19b,_0x488929){_0x488929=_0x488929||0xc8;return function(_0x3a3c17){if(_0x3a3c17){return _0x58b19b[_0xe3e8('0x18')](_0x488929)[_0xe3e8('0x19')](_0x3a3c17);}};}function respondWithFilteredResult(_0x1602bc,_0x4324f1){return function(_0x5ded97){if(_0x5ded97){var _0x536fc3=_0x5ded97['count'],_0x4f95c6=_0x4324f1[_0xe3e8('0x1a')],_0xb8d16f=_0x4324f1[_0xe3e8('0x1a')]+_0x4324f1[_0xe3e8('0x1b')],_0x468523;if(_0xb8d16f>=_0x536fc3){_0xb8d16f=_0x536fc3;_0x468523=0xc8;}else{_0x468523=0xce;}_0x1602bc[_0xe3e8('0x18')](_0x468523);return _0x1602bc[_0xe3e8('0x1c')](_0xe3e8('0x1d'),_0x4f95c6+'-'+_0xb8d16f+'/'+_0x536fc3)[_0xe3e8('0x19')](_0x5ded97);}return null;};}function patchUpdates(_0x1217fb){return function(_0x353d6d){try{jsonpatch[_0xe3e8('0x1e')](_0x353d6d,_0x1217fb,!![]);}catch(_0xffe449){return BPromise[_0xe3e8('0x1f')](_0xffe449);}return _0x353d6d[_0xe3e8('0x20')]();};}function saveUpdates(_0x188707,_0x29d182){return function(_0xd332d2){if(_0xd332d2){return _0xd332d2[_0xe3e8('0x21')](_0x188707)['then'](function(_0x428817){return _0x428817;});}return null;};}function removeEntity(_0x28821e,_0x30085b){return function(_0x348412){if(_0x348412){return _0x348412[_0xe3e8('0x22')]()[_0xe3e8('0x23')](function(){_0x28821e['status'](0xcc)[_0xe3e8('0x24')]();});}};}function handleEntityNotFound(_0x30abf4,_0x321229){return function(_0x58ad4c){if(!_0x58ad4c){_0x30abf4['sendStatus'](0x194);}return _0x58ad4c;};}function handleError(_0x38b23e,_0x383335){_0x383335=_0x383335||0x1f4;return function(_0x51b9eb){logger[_0xe3e8('0x25')](_0x51b9eb[_0xe3e8('0x26')]);if(_0x51b9eb[_0xe3e8('0x27')]){delete _0x51b9eb[_0xe3e8('0x27')];}_0x38b23e['status'](_0x383335)['send'](_0x51b9eb);};}exports['index']=function(_0x55bc12,_0x3daf47){var _0x14a093={},_0x1ff3e8={},_0x5b38d9={'count':0x0,'rows':[]};var _0x5f4617=_['map'](db[_0xe3e8('0x28')][_0xe3e8('0x29')],function(_0x3858dd){return{'name':_0x3858dd[_0xe3e8('0x2a')],'type':_0x3858dd[_0xe3e8('0x2b')]['key']};});_0x1ff3e8[_0xe3e8('0x2c')]=_[_0xe3e8('0x2d')](_0x5f4617,'name');_0x1ff3e8[_0xe3e8('0x2e')]=_[_0xe3e8('0x2f')](_0x55bc12['query']);_0x1ff3e8[_0xe3e8('0x30')]=_[_0xe3e8('0x31')](_0x1ff3e8[_0xe3e8('0x2c')],_0x1ff3e8['query']);_0x14a093[_0xe3e8('0x32')]=_[_0xe3e8('0x31')](_0x1ff3e8[_0xe3e8('0x2c')],qs['fields'](_0x55bc12[_0xe3e8('0x2e')]['fields']));_0x14a093[_0xe3e8('0x32')]=_0x14a093[_0xe3e8('0x32')][_0xe3e8('0x33')]?_0x14a093[_0xe3e8('0x32')]:_0x1ff3e8[_0xe3e8('0x2c')];if(!_0x55bc12[_0xe3e8('0x2e')][_0xe3e8('0x34')](_0xe3e8('0x35'))){_0x14a093['limit']=qs[_0xe3e8('0x1b')](_0x55bc12[_0xe3e8('0x2e')]['limit']);_0x14a093['offset']=qs[_0xe3e8('0x1a')](_0x55bc12[_0xe3e8('0x2e')][_0xe3e8('0x1a')]);}_0x14a093['order']=qs['sort'](_0x55bc12[_0xe3e8('0x2e')][_0xe3e8('0x36')]);_0x14a093[_0xe3e8('0x37')]=qs[_0xe3e8('0x30')](_['pick'](_0x55bc12[_0xe3e8('0x2e')],_0x1ff3e8[_0xe3e8('0x30')]),_0x5f4617);if(_0x55bc12[_0xe3e8('0x2e')][_0xe3e8('0x38')]){_0x14a093['where']=_[_0xe3e8('0x39')](_0x14a093[_0xe3e8('0x37')],{'$or':_['map'](_0x5f4617,function(_0x6f7418){if(_0x6f7418[_0xe3e8('0x2b')]!==_0xe3e8('0x3a')){var _0x30049f={};_0x30049f[_0x6f7418['name']]={'$like':'%'+_0x55bc12['query'][_0xe3e8('0x38')]+'%'};return _0x30049f;}})});}_0x14a093=_[_0xe3e8('0x39')]({},_0x14a093,_0x55bc12[_0xe3e8('0x3b')]);var _0x142ebc={'where':_0x14a093[_0xe3e8('0x37')]};return db[_0xe3e8('0x28')][_0xe3e8('0x3c')](_0x142ebc)[_0xe3e8('0x23')](function(_0x357fea){_0x5b38d9['count']=_0x357fea;if(_0x55bc12['query']['includeAll']){_0x14a093[_0xe3e8('0x3d')]=[{'all':!![]}];}return db[_0xe3e8('0x28')]['findAll'](_0x14a093);})[_0xe3e8('0x23')](function(_0x48208b){_0x5b38d9[_0xe3e8('0x3e')]=_0x48208b;return _0x5b38d9;})['then'](respondWithFilteredResult(_0x3daf47,_0x14a093))[_0xe3e8('0x3f')](handleError(_0x3daf47,null));};exports['show']=function(_0x4c260a,_0x1aea02){var _0x26b95d={'raw':!![],'where':{'id':_0x4c260a[_0xe3e8('0x40')]['id']}},_0x296505={};_0x296505['model']=_[_0xe3e8('0x2f')](db[_0xe3e8('0x28')][_0xe3e8('0x29')]);_0x296505[_0xe3e8('0x2e')]=_[_0xe3e8('0x2f')](_0x4c260a[_0xe3e8('0x2e')]);_0x296505['filters']=_[_0xe3e8('0x31')](_0x296505[_0xe3e8('0x2c')],_0x296505[_0xe3e8('0x2e')]);_0x26b95d[_0xe3e8('0x32')]=_[_0xe3e8('0x31')](_0x296505[_0xe3e8('0x2c')],qs['fields'](_0x4c260a[_0xe3e8('0x2e')][_0xe3e8('0x41')]));_0x26b95d['attributes']=_0x26b95d[_0xe3e8('0x32')]['length']?_0x26b95d[_0xe3e8('0x32')]:_0x296505[_0xe3e8('0x2c')];if(_0x4c260a['query'][_0xe3e8('0x42')]){_0x26b95d[_0xe3e8('0x3d')]=[{'all':!![]}];}_0x26b95d=_[_0xe3e8('0x39')]({},_0x26b95d,_0x4c260a[_0xe3e8('0x3b')]);return db['VoiceDialReport'][_0xe3e8('0x43')](_0x26b95d)['then'](handleEntityNotFound(_0x1aea02,null))['then'](respondWithResult(_0x1aea02,null))['catch'](handleError(_0x1aea02,null));};exports['create']=function(_0x16464b,_0xabf613){return db[_0xe3e8('0x28')][_0xe3e8('0x44')](_0x16464b[_0xe3e8('0x45')],{})[_0xe3e8('0x23')](respondWithResult(_0xabf613,0xc9))[_0xe3e8('0x3f')](handleError(_0xabf613,null));};exports[_0xe3e8('0x21')]=function(_0x2cacc5,_0x4c64ad){if(_0x2cacc5[_0xe3e8('0x45')]['id']){delete _0x2cacc5['body']['id'];}return db['VoiceDialReport'][_0xe3e8('0x43')]({'where':{'id':_0x2cacc5[_0xe3e8('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c64ad,null))[_0xe3e8('0x23')](saveUpdates(_0x2cacc5[_0xe3e8('0x45')],null))[_0xe3e8('0x23')](respondWithResult(_0x4c64ad,null))[_0xe3e8('0x3f')](handleError(_0x4c64ad,null));};exports[_0xe3e8('0x22')]=function(_0x5b16eb,_0x5b0ac0){return db[_0xe3e8('0x28')][_0xe3e8('0x43')]({'where':{'id':_0x5b16eb['params']['id']}})[_0xe3e8('0x23')](handleEntityNotFound(_0x5b0ac0,null))[_0xe3e8('0x23')](removeEntity(_0x5b0ac0,null))[_0xe3e8('0x3f')](handleError(_0x5b0ac0,null));};exports['describe']=function(_0x4677f1,_0x5e193d){return db[_0xe3e8('0x28')]['describe']()[_0xe3e8('0x23')](respondWithResult(_0x5e193d,null))['catch'](handleError(_0x5e193d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7594895..457fb27 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 _0x87c9=['moment','bluebird','request-promise','rimraf','util','../../config/logger'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x87c9,0xdc));var _0x987c=function(_0x26b9c6,_0x4e866e){_0x26b9c6=_0x26b9c6-0x0;var _0xaea2b5=_0x87c9[_0x26b9c6];return _0xaea2b5;};'use strict';var _=require('lodash');var util=require(_0x987c('0x0'));var logger=require(_0x987c('0x1'))('api');var moment=require(_0x987c('0x2'));var BPromise=require(_0x987c('0x3'));var rp=require(_0x987c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x987c('0x5'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x32c542,_0x3d89a7){return _0x32c542['define']('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6fc4=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x43e879,_0x3aeaa7){var _0x6fcaf=function(_0x2679a8){while(--_0x2679a8){_0x43e879['push'](_0x43e879['shift']());}};_0x6fcaf(++_0x3aeaa7);}(_0x6fc4,0x19a));var _0x46fc=function(_0x21cda3,_0x17b90a){_0x21cda3=_0x21cda3-0x0;var _0x558dc3=_0x6fc4[_0x21cda3];return _0x558dc3;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var logger=require(_0x46fc('0x2'))(_0x46fc('0x3'));var moment=require('moment');var BPromise=require(_0x46fc('0x4'));var rp=require(_0x46fc('0x5'));var fs=require('fs');var path=require(_0x46fc('0x6'));var rimraf=require('rimraf');var config=require(_0x46fc('0x7'));var attributes=require(_0x46fc('0x8'));module[_0x46fc('0x9')]=function(_0x5452e9,_0x3c8cb8){return _0x5452e9[_0x46fc('0xa')](_0x46fc('0xb'),attributes,{'tableName':_0x46fc('0xc'),'paranoid':![],'indexes':[{'fields':[_0x46fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9bb5fdb..c2616f8 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 _0x3cd1=['create','options','raw','catch','VoiceDialReport','update','body','attributes','limit','UpdateVoiceDialReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport'];(function(_0x1eb2f7,_0x293a4b){var _0x2a11ad=function(_0x588698){while(--_0x588698){_0x1eb2f7['push'](_0x1eb2f7['shift']());}};_0x2a11ad(++_0x293a4b);}(_0x3cd1,0x112));var _0x13cd=function(_0x7a7e58,_0x316889){_0x7a7e58=_0x7a7e58-0x0;var _0x379d68=_0x3cd1[_0x7a7e58];return _0x379d68;};'use strict';var _=require('lodash');var util=require(_0x13cd('0x0'));var moment=require(_0x13cd('0x1'));var BPromise=require(_0x13cd('0x2'));var rs=require(_0x13cd('0x3'));var fs=require('fs');var Redis=require(_0x13cd('0x4'));var db=require(_0x13cd('0x5'))['db'];var utils=require(_0x13cd('0x6'));var logger=require(_0x13cd('0x7'))('rpc');var config=require(_0x13cd('0x8'));var jayson=require(_0x13cd('0x9'));var client=jayson[_0x13cd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55cac0,_0x461fe5,_0x427fb0){return new BPromise(function(_0x258008,_0x64751a){return client['request'](_0x55cac0,_0x427fb0)[_0x13cd('0xb')](function(_0x334e06){logger[_0x13cd('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x461fe5,'request\x20sent');logger[_0x13cd('0xd')](_0x13cd('0xe'),_0x461fe5,_0x13cd('0xf'),JSON[_0x13cd('0x10')](_0x334e06));if(_0x334e06[_0x13cd('0x11')]){if(_0x334e06[_0x13cd('0x11')][_0x13cd('0x12')]===0x1f4){logger['error'](_0x13cd('0x13'),_0x461fe5,_0x334e06[_0x13cd('0x11')]['message']);return _0x64751a(_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);}logger[_0x13cd('0x11')](_0x13cd('0x13'),_0x461fe5,_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);return _0x258008(_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);}else{logger['info'](_0x13cd('0x13'),_0x461fe5,'request\x20sent');_0x258008(_0x334e06[_0x13cd('0x15')][_0x13cd('0x14')]);}})['catch'](function(_0x1bd779){logger[_0x13cd('0x11')](_0x13cd('0x13'),_0x461fe5,_0x1bd779);_0x64751a(_0x1bd779);});});}exports[_0x13cd('0x16')]=function(_0x1442eb){var _0x50557f=this;return new Promise(function(_0x45b9de,_0x446a31){return db['VoiceDialReport'][_0x13cd('0x17')](_0x1442eb['body'],{'raw':_0x1442eb[_0x13cd('0x18')]?_0x1442eb[_0x13cd('0x18')][_0x13cd('0x19')]===undefined?!![]:![]:!![]})[_0x13cd('0xb')](function(_0x5d12b8){logger[_0x13cd('0xc')]('CreateVoiceDialReport',_0x1442eb);logger[_0x13cd('0xd')](_0x13cd('0x16'),_0x1442eb,JSON[_0x13cd('0x10')](_0x5d12b8));_0x45b9de(_0x5d12b8);})[_0x13cd('0x1a')](function(_0x439ba1){logger[_0x13cd('0x11')]('CreateVoiceDialReport',_0x439ba1['message'],_0x1442eb);_0x446a31(_0x50557f[_0x13cd('0x11')](0x1f4,_0x439ba1['message']));});});};exports['UpdateVoiceDialReport']=function(_0xc0503f){var _0x299b9a=this;return new Promise(function(_0x1b84c8,_0x4882ae){return db[_0x13cd('0x1b')][_0x13cd('0x1c')](_0xc0503f[_0x13cd('0x1d')],{'raw':_0xc0503f[_0x13cd('0x18')]?_0xc0503f[_0x13cd('0x18')][_0x13cd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0503f[_0x13cd('0x18')]?_0xc0503f[_0x13cd('0x18')]['where']||null:null,'attributes':_0xc0503f[_0x13cd('0x18')]?_0xc0503f['options'][_0x13cd('0x1e')]||null:null,'limit':_0xc0503f[_0x13cd('0x18')]?_0xc0503f['options'][_0x13cd('0x1f')]||null:null})[_0x13cd('0xb')](function(_0x256628){logger[_0x13cd('0xc')](_0x13cd('0x20'),_0xc0503f);logger[_0x13cd('0xd')](_0x13cd('0x20'),_0xc0503f,JSON['stringify'](_0x256628));_0x1b84c8(_0x256628);})[_0x13cd('0x1a')](function(_0x4a674b){logger['error'](_0x13cd('0x20'),_0x4a674b['message'],_0xc0503f);_0x4882ae(_0x299b9a['error'](0x1f4,_0x4a674b[_0x13cd('0x14')]));});});}; \ No newline at end of file +var _0x7868=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','error','code','message','catch','VoiceDialReport','create','body','options','then','CreateVoiceDialReport','debug','stringify','update','where','attributes','limit','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x7fa37e,_0xaa7bd4){var _0x33a8ab=function(_0x19d8d7){while(--_0x19d8d7){_0x7fa37e['push'](_0x7fa37e['shift']());}};_0x33a8ab(++_0xaa7bd4);}(_0x7868,0x1c0));var _0x8786=function(_0x46ed25,_0xa65ea8){_0x46ed25=_0x46ed25-0x0;var _0x491c83=_0x7868[_0x46ed25];return _0x491c83;};'use strict';var _=require(_0x8786('0x0'));var util=require('util');var moment=require(_0x8786('0x1'));var BPromise=require(_0x8786('0x2'));var rs=require(_0x8786('0x3'));var fs=require('fs');var Redis=require(_0x8786('0x4'));var db=require(_0x8786('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8786('0x6'))(_0x8786('0x7'));var config=require(_0x8786('0x8'));var jayson=require(_0x8786('0x9'));var client=jayson[_0x8786('0xa')][_0x8786('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x251045,_0x3b65c3,_0xe4d300){return new BPromise(function(_0xe9a88d,_0x20b3ed){return client[_0x8786('0xc')](_0x251045,_0xe4d300)['then'](function(_0x5b241a){logger[_0x8786('0xd')](_0x8786('0xe'),_0x3b65c3,_0x8786('0xf'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3b65c3,_0x8786('0xf'),JSON['stringify'](_0x5b241a));if(_0x5b241a[_0x8786('0x10')]){if(_0x5b241a[_0x8786('0x10')][_0x8786('0x11')]===0x1f4){logger[_0x8786('0x10')](_0x8786('0xe'),_0x3b65c3,_0x5b241a[_0x8786('0x10')]['message']);return _0x20b3ed(_0x5b241a[_0x8786('0x10')][_0x8786('0x12')]);}logger['error'](_0x8786('0xe'),_0x3b65c3,_0x5b241a[_0x8786('0x10')]['message']);return _0xe9a88d(_0x5b241a[_0x8786('0x10')][_0x8786('0x12')]);}else{logger[_0x8786('0xd')](_0x8786('0xe'),_0x3b65c3,'request\x20sent');_0xe9a88d(_0x5b241a['result']['message']);}})[_0x8786('0x13')](function(_0x450606){logger[_0x8786('0x10')](_0x8786('0xe'),_0x3b65c3,_0x450606);_0x20b3ed(_0x450606);});});}exports['CreateVoiceDialReport']=function(_0x1b410a){var _0x3b9ff1=this;return new Promise(function(_0x316bf7,_0x359f68){return db[_0x8786('0x14')][_0x8786('0x15')](_0x1b410a[_0x8786('0x16')],{'raw':_0x1b410a[_0x8786('0x17')]?_0x1b410a[_0x8786('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x8786('0x18')](function(_0x790c9a){logger[_0x8786('0xd')](_0x8786('0x19'),_0x1b410a);logger[_0x8786('0x1a')]('CreateVoiceDialReport',_0x1b410a,JSON[_0x8786('0x1b')](_0x790c9a));_0x316bf7(_0x790c9a);})[_0x8786('0x13')](function(_0x5de3ef){logger[_0x8786('0x10')](_0x8786('0x19'),_0x5de3ef[_0x8786('0x12')],_0x1b410a);_0x359f68(_0x3b9ff1['error'](0x1f4,_0x5de3ef['message']));});});};exports['UpdateVoiceDialReport']=function(_0x27f85e){var _0x33346d=this;return new Promise(function(_0x1bb259,_0x53c884){return db[_0x8786('0x14')][_0x8786('0x1c')](_0x27f85e[_0x8786('0x16')],{'raw':_0x27f85e[_0x8786('0x17')]?_0x27f85e[_0x8786('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f85e['options']?_0x27f85e[_0x8786('0x17')][_0x8786('0x1d')]||null:null,'attributes':_0x27f85e[_0x8786('0x17')]?_0x27f85e[_0x8786('0x17')][_0x8786('0x1e')]||null:null,'limit':_0x27f85e[_0x8786('0x17')]?_0x27f85e[_0x8786('0x17')][_0x8786('0x1f')]||null:null})[_0x8786('0x18')](function(_0xd796e7){logger['info']('UpdateVoiceDialReport',_0x27f85e);logger['debug'](_0x8786('0x20'),_0x27f85e,JSON['stringify'](_0xd796e7));_0x1bb259(_0xd796e7);})[_0x8786('0x13')](function(_0xdf4c00){logger['error'](_0x8786('0x20'),_0xdf4c00['message'],_0x27f85e);_0x53c884(_0x33346d[_0x8786('0x10')](0x1f4,_0xdf4c00[_0x8786('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index b8429f5..ec2316b 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 _0xf3eb=['isAuthenticated','get','show','create','post','/:id/applications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e004d,_0x38776d){var _0x5aa3cb=function(_0x3f7a73){while(--_0x3f7a73){_0x5e004d['push'](_0x5e004d['shift']());}};_0x5aa3cb(++_0x38776d);}(_0xf3eb,0x1af));var _0xbf3e=function(_0x573c3e,_0x3a7ec6){_0x573c3e=_0x573c3e-0x0;var _0x299d2a=_0xf3eb[_0x573c3e];return _0x299d2a;};'use strict';var multer=require(_0xbf3e('0x0'));var util=require(_0xbf3e('0x1'));var path=require(_0xbf3e('0x2'));var timeout=require(_0xbf3e('0x3'));var express=require(_0xbf3e('0x4'));var router=express[_0xbf3e('0x5')]();var auth=require(_0xbf3e('0x6'));var interaction=require(_0xbf3e('0x7'));var config=require(_0xbf3e('0x8'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xbf3e('0x9')](),controller['index']);router[_0xbf3e('0xa')]('/:id',auth[_0xbf3e('0x9')](),controller[_0xbf3e('0xb')]);router['post']('/',auth[_0xbf3e('0x9')](),controller[_0xbf3e('0xc')]);router[_0xbf3e('0xd')](_0xbf3e('0xe'),auth['isAuthenticated'](),controller['addApplications']);router[_0xbf3e('0xf')]('/:id',auth[_0xbf3e('0x9')](),controller[_0xbf3e('0x10')]);router[_0xbf3e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf3e('0x12')]);module[_0xbf3e('0x13')]=router; \ No newline at end of file +var _0xc801=['/:id','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0xc801,0x195));var _0x1c80=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc801[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x1c80('0x0'));var util=require(_0x1c80('0x1'));var path=require('path');var timeout=require(_0x1c80('0x2'));var express=require('express');var router=express[_0x1c80('0x3')]();var auth=require(_0x1c80('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1c80('0x5'));var controller=require(_0x1c80('0x6'));router['get']('/',auth[_0x1c80('0x7')](),controller[_0x1c80('0x8')]);router['get'](_0x1c80('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1c80('0xa')]('/',auth[_0x1c80('0x7')](),controller['create']);router['post'](_0x1c80('0xb'),auth['isAuthenticated'](),controller[_0x1c80('0xc')]);router[_0x1c80('0xd')]('/:id',auth[_0x1c80('0x7')](),controller[_0x1c80('0xe')]);router[_0x1c80('0xf')]('/:id',auth[_0x1c80('0x7')](),controller[_0x1c80('0x10')]);module[_0x1c80('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 35bdb6e..0d221a0 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(_0x41e514,_0x2b709d){var _0x49f00a=function(_0x500aac){while(--_0x500aac){_0x41e514['push'](_0x41e514['shift']());}};_0x49f00a(++_0x2b709d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x577d50,_0x5ca637){var _0x4eade3=function(_0x25ee51){while(--_0x25ee51){_0x577d50['push'](_0x577d50['shift']());}};_0x4eade3(++_0x5ca637);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 e7aad61..d51b961 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 _0x7880=['OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','find','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceExtension','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','length','catch','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','status','end','offset','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x4c9f2f,_0x5c92f6){var _0x265424=function(_0x29caa8){while(--_0x29caa8){_0x4c9f2f['push'](_0x4c9f2f['shift']());}};_0x265424(++_0x5c92f6);}(_0x7880,0x1f4));var _0x0788=function(_0x32905d,_0x2ed18c){_0x32905d=_0x32905d-0x0;var _0x2c3f12=_0x7880[_0x32905d];return _0x2c3f12;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var db=require(_0x0788('0x18'))['db'];config[_0x0788('0x19')]=_[_0x0788('0x1a')](config[_0x0788('0x19')],{'host':_0x0788('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0x19')]));require(_0x0788('0x1c'))[_0x0788('0x1d')](socket);function respondWithStatusCode(_0x13cf07,_0x51e5d3){_0x51e5d3=_0x51e5d3||0xcc;return function(_0x43ca01){if(_0x43ca01){return _0x13cf07['sendStatus'](_0x51e5d3);}return _0x13cf07[_0x0788('0x1e')](_0x51e5d3)[_0x0788('0x1f')]();};}function respondWithResult(_0x3fd1e4,_0xb406fb){_0xb406fb=_0xb406fb||0xc8;return function(_0x2ddd1a){if(_0x2ddd1a){return _0x3fd1e4[_0x0788('0x1e')](_0xb406fb)['json'](_0x2ddd1a);}};}function respondWithFilteredResult(_0x573822,_0x17d805){return function(_0x461d9d){if(_0x461d9d){var _0x5b2bdc=_0x461d9d['count'],_0x654e4b=_0x17d805[_0x0788('0x20')],_0x415f19=_0x17d805[_0x0788('0x20')]+_0x17d805['limit'],_0x17ae59;if(_0x415f19>=_0x5b2bdc){_0x415f19=_0x5b2bdc;_0x17ae59=0xc8;}else{_0x17ae59=0xce;}_0x573822[_0x0788('0x1e')](_0x17ae59);return _0x573822['set'](_0x0788('0x21'),_0x654e4b+'-'+_0x415f19+'/'+_0x5b2bdc)['json'](_0x461d9d);}return null;};}function patchUpdates(_0x17cca3){return function(_0x3c37ca){try{jsonpatch[_0x0788('0x22')](_0x3c37ca,_0x17cca3,!![]);}catch(_0x3cd197){return BPromise[_0x0788('0x23')](_0x3cd197);}return _0x3c37ca['save']();};}function saveUpdates(_0x48ec43,_0x2270d4){return function(_0x2a1460){if(_0x2a1460){return _0x2a1460[_0x0788('0x24')](_0x48ec43)[_0x0788('0x25')](function(_0x5ba1da){return _0x5ba1da;});}return null;};}function removeEntity(_0x4d5c93,_0x79204e){return function(_0x18cc33){if(_0x18cc33){return _0x18cc33[_0x0788('0x26')]()['then'](function(){var _0x4b2693=_0x18cc33[_0x0788('0x27')]({'plain':!![]});var _0xa1f7dc=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x0788('0x28'),'value':_0x0788('0x29'),'ignore':![]},{'name':'InternalRoutes','value':_0x0788('0x2a'),'ignore':![]}];var _0x40e7a6=_(_0xa1f7dc)[_0x0788('0x2b')](_0x0788('0x2c'))[_0x0788('0x2d')](_0x0788('0x2e'))[_0x0788('0x2e')]();if(_[_0x0788('0x2f')](_0x40e7a6,_0x4b2693['type'])){return;}var _0x5a5178=_[_0x0788('0x30')](_0xa1f7dc,[_0x0788('0x2e'),_0x4b2693['type']])['name'];return db[_0x0788('0x31')][_0x0788('0x26')]({'where':{'type':_0x5a5178,'resourceId':_0x4b2693['id']}})[_0x0788('0x25')](function(){return _0x18cc33;});})[_0x0788('0x25')](function(){_0x4d5c93[_0x0788('0x1e')](0xcc)[_0x0788('0x1f')]();});}};}function handleEntityNotFound(_0x327d67,_0x36e077){return function(_0x28a50a){if(!_0x28a50a){_0x327d67[_0x0788('0x32')](0x194);}return _0x28a50a;};}function handleError(_0x5ec0ed,_0x2a08b7){_0x2a08b7=_0x2a08b7||0x1f4;return function(_0x1aab6a){logger[_0x0788('0x33')](_0x1aab6a[_0x0788('0x34')]);if(_0x1aab6a[_0x0788('0x35')]){delete _0x1aab6a[_0x0788('0x35')];}_0x5ec0ed[_0x0788('0x1e')](_0x2a08b7)[_0x0788('0x36')](_0x1aab6a);};}exports[_0x0788('0x37')]=function(_0xaed27e,_0x4fa055){var _0x4ae132={},_0x5947d3={},_0x5633da={'count':0x0,'rows':[]};var _0x516cce=_['map'](db[_0x0788('0x38')][_0x0788('0x39')],function(_0x2130e3){return{'name':_0x2130e3['fieldName'],'type':_0x2130e3[_0x0788('0x3a')][_0x0788('0x3b')]};});_0x5947d3[_0x0788('0x3c')]=_[_0x0788('0x2d')](_0x516cce,'name');_0x5947d3[_0x0788('0x3d')]=_['keys'](_0xaed27e[_0x0788('0x3d')]);_0x5947d3['filters']=_[_0x0788('0x3e')](_0x5947d3[_0x0788('0x3c')],_0x5947d3['query']);_0x4ae132[_0x0788('0x3f')]=_[_0x0788('0x3e')](_0x5947d3['model'],qs[_0x0788('0x40')](_0xaed27e['query'][_0x0788('0x40')]));_0x4ae132['attributes']=_0x4ae132[_0x0788('0x3f')]['length']?_0x4ae132[_0x0788('0x3f')]:_0x5947d3['model'];if(!_0xaed27e['query'][_0x0788('0x41')](_0x0788('0x42'))){_0x4ae132[_0x0788('0x43')]=qs[_0x0788('0x43')](_0xaed27e[_0x0788('0x3d')]['limit']);_0x4ae132['offset']=qs['offset'](_0xaed27e['query'][_0x0788('0x20')]);}_0x4ae132[_0x0788('0x44')]=qs[_0x0788('0x45')](_0xaed27e[_0x0788('0x3d')][_0x0788('0x45')]);_0x4ae132['where']=qs['filters'](_[_0x0788('0x46')](_0xaed27e[_0x0788('0x3d')],_0x5947d3[_0x0788('0x47')]),_0x516cce);if(_0xaed27e[_0x0788('0x3d')][_0x0788('0x2b')]){_0x4ae132[_0x0788('0x48')]=_[_0x0788('0x49')](_0x4ae132[_0x0788('0x48')],{'$or':_[_0x0788('0x2d')](_0x516cce,function(_0x50e8f5){if(_0x50e8f5['type']!==_0x0788('0x4a')){var _0x1d579d={};_0x1d579d[_0x50e8f5[_0x0788('0x35')]]={'$like':'%'+_0xaed27e['query']['filter']+'%'};return _0x1d579d;}})});}_0x4ae132=_['merge']({},_0x4ae132,_0xaed27e[_0x0788('0x4b')]);var _0x150c1e={'where':_0x4ae132[_0x0788('0x48')]};return db[_0x0788('0x38')][_0x0788('0x4c')](_0x150c1e)[_0x0788('0x25')](function(_0x1ab634){_0x5633da[_0x0788('0x4c')]=_0x1ab634;if(_0xaed27e['query'][_0x0788('0x4d')]){_0x4ae132[_0x0788('0x4e')]=[{'all':!![]}];}return db[_0x0788('0x38')][_0x0788('0x4f')](_0x4ae132);})['then'](function(_0x6aa745){_0x5633da[_0x0788('0x50')]=_0x6aa745;return _0x5633da;})['then'](respondWithFilteredResult(_0x4fa055,_0x4ae132))['catch'](handleError(_0x4fa055,null));};exports['show']=function(_0xad94dc,_0x5e010a){var _0x474027={'raw':![],'where':{'id':_0xad94dc[_0x0788('0x51')]['id']}},_0x2c5e0a={};_0x2c5e0a[_0x0788('0x3c')]=_[_0x0788('0x52')](db[_0x0788('0x38')][_0x0788('0x39')]);_0x2c5e0a[_0x0788('0x3d')]=_['keys'](_0xad94dc['query']);_0x2c5e0a[_0x0788('0x47')]=_[_0x0788('0x3e')](_0x2c5e0a[_0x0788('0x3c')],_0x2c5e0a['query']);_0x474027[_0x0788('0x3f')]=_[_0x0788('0x3e')](_0x2c5e0a[_0x0788('0x3c')],qs[_0x0788('0x40')](_0xad94dc[_0x0788('0x3d')]['fields']));_0x474027['attributes']=_0x474027[_0x0788('0x3f')][_0x0788('0x53')]?_0x474027['attributes']:_0x2c5e0a[_0x0788('0x3c')];if(_0xad94dc['query'][_0x0788('0x4d')]){_0x474027[_0x0788('0x4e')]=[{'all':!![]}];}_0x474027=_[_0x0788('0x49')]({},_0x474027,_0xad94dc[_0x0788('0x4b')]);return db[_0x0788('0x38')][_0x0788('0x30')](_0x474027)[_0x0788('0x25')](handleEntityNotFound(_0x5e010a,null))[_0x0788('0x25')](respondWithResult(_0x5e010a,null))['catch'](handleError(_0x5e010a,null));};exports[_0x0788('0x26')]=function(_0x363ab9,_0x3f2f1b){return db['VoiceExtension'][_0x0788('0x30')]({'where':{'id':_0x363ab9[_0x0788('0x51')]['id']}})['then'](handleEntityNotFound(_0x3f2f1b,null))[_0x0788('0x25')](removeEntity(_0x3f2f1b,null))[_0x0788('0x54')](handleError(_0x3f2f1b,null));};exports[_0x0788('0x55')]=function(_0x1192b4,_0x137e24){if(_0x1192b4[_0x0788('0x56')]['type']==='outbound'&&!_[_0x0788('0x57')](_0x1192b4[_0x0788('0x56')]['exten'],'_')){_0x1192b4[_0x0788('0x56')][_0x0788('0x58')]='_'[_0x0788('0x59')](_0x1192b4[_0x0788('0x56')][_0x0788('0x58')]);}return db[_0x0788('0x38')][_0x0788('0x55')](_0x1192b4[_0x0788('0x56')],{'raw':![]})[_0x0788('0x25')](function(_0x395398){var _0x25b44a=_0x1192b4[_0x0788('0x5a')]['get']({'plain':!![]});if(!_0x25b44a)throw new Error(_0x0788('0x5b'));if(_0x25b44a[_0x0788('0x5c')]===_0x0788('0x5a')){var _0x5ba197=_0x395398[_0x0788('0x27')]({'plain':!![]});var _0x329d44=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x0788('0x28'),'value':_0x0788('0x29')},{'name':_0x0788('0x5d'),'value':_0x0788('0x2a')}];var _0x2c0bcc=_[_0x0788('0x30')](_0x329d44,['value',_0x5ba197[_0x0788('0x3a')]])[_0x0788('0x35')];return db[_0x0788('0x5e')]['find']({'where':{'name':_0x2c0bcc,'userProfileId':_0x25b44a['userProfileId']},'raw':!![]})[_0x0788('0x25')](function(_0x5419d9){if(_0x5419d9&&_0x5419d9[_0x0788('0x5f')]===0x0){return db[_0x0788('0x31')][_0x0788('0x55')]({'name':_0x5ba197[_0x0788('0x35')],'resourceId':_0x5ba197['id'],'type':_0x5419d9[_0x0788('0x35')],'sectionId':_0x5419d9['id']},{})[_0x0788('0x25')](function(){return _0x395398;});}else{return _0x395398;}})[_0x0788('0x54')](function(_0x29c912){logger[_0x0788('0x33')](_0x0788('0x60'),_0x29c912);throw _0x29c912;});}return _0x395398;})['then'](respondWithResult(_0x137e24,0xc9))[_0x0788('0x54')](handleError(_0x137e24,null));};exports[_0x0788('0x24')]=function(_0x602e3b,_0x2822aa){if(_0x602e3b['body']['id']){delete _0x602e3b[_0x0788('0x56')]['id'];}return db[_0x0788('0x38')][_0x0788('0x30')]({'where':{'id':_0x602e3b[_0x0788('0x51')]['id']}})[_0x0788('0x25')](handleEntityNotFound(_0x2822aa,null))['then'](function(_0xf2031){if(_0xf2031){return db['VoiceExtension'][_0x0788('0x24')](_[_0x0788('0x46')](_0x602e3b[_0x0788('0x56')],[_0x0788('0x58'),_0x0788('0x61'),_0x0788('0x62'),_0x0788('0x63'),_0x0788('0x64'),_0x0788('0x65')]),{'where':{'context':_0xf2031['context'],'exten':_0xf2031[_0x0788('0x58')]},'individualHooks':!![]})[_0x0788('0x25')](function(_0x60e880){return _0x60e880;});}return null;})['then'](respondWithStatusCode(_0x2822aa,null))['catch'](handleError(_0x2822aa,null));};exports[_0x0788('0x66')]=function(_0x1bb234,_0x31ed44,_0x51baa4){return db[_0x0788('0x38')][_0x0788('0x67')]({'where':{'id':_0x1bb234[_0x0788('0x51')]['id']}})[_0x0788('0x25')](handleEntityNotFound(_0x31ed44,null))['then'](function(_0x5c2feb){if(_0x5c2feb){return db['sequelize'][_0x0788('0x68')](function(_0x2a55f2){return db[_0x0788('0x38')]['destroy']({'where':{'VoiceExtensionId':_0x1bb234['params']['id']},'transaction':_0x2a55f2})[_0x0788('0x25')](function(_0x56c4bc){var _0x955bfa=_[_0x0788('0x2d')](_0x1bb234[_0x0788('0x56')],function(_0x12ed24){_0x12ed24[_0x0788('0x69')]=_0x1bb234[_0x0788('0x51')]['id'];return _0x12ed24;});return db[_0x0788('0x38')][_0x0788('0x6a')](_0x955bfa,{'transaction':_0x2a55f2});});})[_0x0788('0x25')](function(){return db[_0x0788('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1bb234[_0x0788('0x51')]['id']},'order':_0x0788('0x6b')});});}})['then'](respondWithResult(_0x31ed44,null))['catch'](handleError(_0x31ed44,null));}; \ No newline at end of file +var _0xc4aa=['request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','name','UserProfileResource','error','stack','send','index','map','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','VoiceExtension','findAll','rows','catch','show','params','find','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x43cf9e,_0x4d264a){var _0x4e2e68=function(_0x3c16fe){while(--_0x3c16fe){_0x43cf9e['push'](_0x43cf9e['shift']());}};_0x4e2e68(++_0x4d264a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){var _0x594f36=_0x2503d8[_0xac4a('0x29')]({'plain':!![]});var _0x222507=[{'name':_0xac4a('0x2a'),'value':_0xac4a('0x2b'),'ignore':![]},{'name':_0xac4a('0x2c'),'value':_0xac4a('0x2d'),'ignore':![]},{'name':_0xac4a('0x2e'),'value':_0xac4a('0x2f'),'ignore':![]}];var _0x472c57=_(_0x222507)[_0xac4a('0x30')](_0xac4a('0x31'))['map'](_0xac4a('0x32'))[_0xac4a('0x32')]();if(_[_0xac4a('0x33')](_0x472c57,_0x594f36[_0xac4a('0x34')])){return;}var _0x116700=_['find'](_0x222507,['value',_0x594f36[_0xac4a('0x34')]])[_0xac4a('0x35')];return db[_0xac4a('0x36')]['destroy']({'where':{'type':_0x116700,'resourceId':_0x594f36['id']}})['then'](function(){return _0x2503d8;});})[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x432066,_0x17118e){return function(_0x53d3a5){if(!_0x53d3a5){_0x432066[_0xac4a('0x1c')](0x194);}return _0x53d3a5;};}function handleError(_0x482afc,_0x30364b){_0x30364b=_0x30364b||0x1f4;return function(_0x57adcf){logger[_0xac4a('0x37')](_0x57adcf[_0xac4a('0x38')]);if(_0x57adcf[_0xac4a('0x35')]){delete _0x57adcf[_0xac4a('0x35')];}_0x482afc[_0xac4a('0x1d')](_0x30364b)[_0xac4a('0x39')](_0x57adcf);};}exports[_0xac4a('0x3a')]=function(_0x1f13f3,_0x29fb3b){var _0xfd7c16={},_0x36ab49={},_0x1634df={'count':0x0,'rows':[]};var _0x1a9be2=_[_0xac4a('0x3b')](db['VoiceExtension'][_0xac4a('0x3c')],function(_0x1c41fb){return{'name':_0x1c41fb['fieldName'],'type':_0x1c41fb[_0xac4a('0x34')][_0xac4a('0x3d')]};});_0x36ab49['model']=_['map'](_0x1a9be2,_0xac4a('0x35'));_0x36ab49[_0xac4a('0x3e')]=_[_0xac4a('0x3f')](_0x1f13f3[_0xac4a('0x3e')]);_0x36ab49['filters']=_[_0xac4a('0x40')](_0x36ab49[_0xac4a('0x41')],_0x36ab49['query']);_0xfd7c16[_0xac4a('0x42')]=_[_0xac4a('0x40')](_0x36ab49[_0xac4a('0x41')],qs['fields'](_0x1f13f3[_0xac4a('0x3e')][_0xac4a('0x43')]));_0xfd7c16[_0xac4a('0x42')]=_0xfd7c16['attributes'][_0xac4a('0x44')]?_0xfd7c16[_0xac4a('0x42')]:_0x36ab49['model'];if(!_0x1f13f3['query'][_0xac4a('0x45')]('nolimit')){_0xfd7c16['limit']=qs['limit'](_0x1f13f3['query'][_0xac4a('0x46')]);_0xfd7c16[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x1f13f3[_0xac4a('0x3e')][_0xac4a('0x21')]);}_0xfd7c16[_0xac4a('0x47')]=qs[_0xac4a('0x48')](_0x1f13f3[_0xac4a('0x3e')][_0xac4a('0x48')]);_0xfd7c16[_0xac4a('0x49')]=qs[_0xac4a('0x4a')](_[_0xac4a('0x4b')](_0x1f13f3['query'],_0x36ab49['filters']),_0x1a9be2);if(_0x1f13f3['query'][_0xac4a('0x30')]){_0xfd7c16[_0xac4a('0x49')]=_[_0xac4a('0x4c')](_0xfd7c16[_0xac4a('0x49')],{'$or':_[_0xac4a('0x3b')](_0x1a9be2,function(_0x411543){if(_0x411543[_0xac4a('0x34')]!==_0xac4a('0x4d')){var _0x3e9973={};_0x3e9973[_0x411543[_0xac4a('0x35')]]={'$like':'%'+_0x1f13f3['query'][_0xac4a('0x30')]+'%'};return _0x3e9973;}})});}_0xfd7c16=_[_0xac4a('0x4c')]({},_0xfd7c16,_0x1f13f3[_0xac4a('0x4e')]);var _0x3f24a1={'where':_0xfd7c16[_0xac4a('0x49')]};return db['VoiceExtension'][_0xac4a('0x20')](_0x3f24a1)[_0xac4a('0x27')](function(_0x547ba2){_0x1634df[_0xac4a('0x20')]=_0x547ba2;if(_0x1f13f3['query'][_0xac4a('0x4f')]){_0xfd7c16[_0xac4a('0x50')]=[{'all':!![]}];}return db[_0xac4a('0x51')][_0xac4a('0x52')](_0xfd7c16);})[_0xac4a('0x27')](function(_0x463f01){_0x1634df[_0xac4a('0x53')]=_0x463f01;return _0x1634df;})[_0xac4a('0x27')](respondWithFilteredResult(_0x29fb3b,_0xfd7c16))[_0xac4a('0x54')](handleError(_0x29fb3b,null));};exports[_0xac4a('0x55')]=function(_0x4fa9eb,_0x3b68b3){var _0x569812={'raw':![],'where':{'id':_0x4fa9eb[_0xac4a('0x56')]['id']}},_0x1646ea={};_0x1646ea[_0xac4a('0x41')]=_['keys'](db[_0xac4a('0x51')][_0xac4a('0x3c')]);_0x1646ea['query']=_[_0xac4a('0x3f')](_0x4fa9eb['query']);_0x1646ea[_0xac4a('0x4a')]=_[_0xac4a('0x40')](_0x1646ea[_0xac4a('0x41')],_0x1646ea['query']);_0x569812['attributes']=_[_0xac4a('0x40')](_0x1646ea['model'],qs[_0xac4a('0x43')](_0x4fa9eb['query'][_0xac4a('0x43')]));_0x569812['attributes']=_0x569812[_0xac4a('0x42')][_0xac4a('0x44')]?_0x569812[_0xac4a('0x42')]:_0x1646ea[_0xac4a('0x41')];if(_0x4fa9eb['query'][_0xac4a('0x4f')]){_0x569812[_0xac4a('0x50')]=[{'all':!![]}];}_0x569812=_[_0xac4a('0x4c')]({},_0x569812,_0x4fa9eb[_0xac4a('0x4e')]);return db[_0xac4a('0x51')][_0xac4a('0x57')](_0x569812)[_0xac4a('0x27')](handleEntityNotFound(_0x3b68b3,null))['then'](respondWithResult(_0x3b68b3,null))[_0xac4a('0x54')](handleError(_0x3b68b3,null));};exports[_0xac4a('0x28')]=function(_0x4828e3,_0x16afbe){return db[_0xac4a('0x51')][_0xac4a('0x57')]({'where':{'id':_0x4828e3[_0xac4a('0x56')]['id']}})['then'](handleEntityNotFound(_0x16afbe,null))[_0xac4a('0x27')](removeEntity(_0x16afbe,null))[_0xac4a('0x54')](handleError(_0x16afbe,null));};exports[_0xac4a('0x58')]=function(_0x129d58,_0x890910){if(_0x129d58['body'][_0xac4a('0x34')]==='outbound'&&!_[_0xac4a('0x59')](_0x129d58[_0xac4a('0x5a')]['exten'],'_')){_0x129d58['body'][_0xac4a('0x5b')]='_'[_0xac4a('0x5c')](_0x129d58['body'][_0xac4a('0x5b')]);}return db[_0xac4a('0x51')][_0xac4a('0x58')](_0x129d58[_0xac4a('0x5a')],{'raw':![]})['then'](function(_0x3057d6){var _0x108f7c=_0x129d58[_0xac4a('0x5d')][_0xac4a('0x29')]({'plain':!![]});if(!_0x108f7c)throw new Error(_0xac4a('0x5e'));if(_0x108f7c[_0xac4a('0x5f')]===_0xac4a('0x5d')){var _0x487a44=_0x3057d6[_0xac4a('0x29')]({'plain':!![]});var _0xef51d0=[{'name':_0xac4a('0x2a'),'value':_0xac4a('0x2b')},{'name':_0xac4a('0x2c'),'value':_0xac4a('0x2d')},{'name':_0xac4a('0x2e'),'value':_0xac4a('0x2f')}];var _0x159e43=_[_0xac4a('0x57')](_0xef51d0,[_0xac4a('0x32'),_0x487a44[_0xac4a('0x34')]])[_0xac4a('0x35')];return db[_0xac4a('0x60')][_0xac4a('0x57')]({'where':{'name':_0x159e43,'userProfileId':_0x108f7c[_0xac4a('0x61')]},'raw':!![]})['then'](function(_0x13a577){if(_0x13a577&&_0x13a577['autoAssociation']===0x0){return db[_0xac4a('0x36')]['create']({'name':_0x487a44[_0xac4a('0x35')],'resourceId':_0x487a44['id'],'type':_0x13a577['name'],'sectionId':_0x13a577['id']},{})[_0xac4a('0x27')](function(){return _0x3057d6;});}else{return _0x3057d6;}})['catch'](function(_0x4d1b39){logger[_0xac4a('0x37')](_0xac4a('0x62'),_0x4d1b39);throw _0x4d1b39;});}return _0x3057d6;})[_0xac4a('0x27')](respondWithResult(_0x890910,0xc9))[_0xac4a('0x54')](handleError(_0x890910,null));};exports[_0xac4a('0x26')]=function(_0xb7b884,_0x592a4b){if(_0xb7b884[_0xac4a('0x5a')]['id']){delete _0xb7b884['body']['id'];}return db[_0xac4a('0x51')]['find']({'where':{'id':_0xb7b884[_0xac4a('0x56')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x592a4b,null))[_0xac4a('0x27')](function(_0x1306c5){if(_0x1306c5){return db[_0xac4a('0x51')][_0xac4a('0x26')](_[_0xac4a('0x4b')](_0xb7b884[_0xac4a('0x5a')],[_0xac4a('0x5b'),_0xac4a('0x63'),_0xac4a('0x64'),_0xac4a('0x65'),_0xac4a('0x66'),_0xac4a('0x67')]),{'where':{'context':_0x1306c5[_0xac4a('0x63')],'exten':_0x1306c5[_0xac4a('0x5b')]},'individualHooks':!![]})[_0xac4a('0x27')](function(_0x4a0156){return _0x4a0156;});}return null;})[_0xac4a('0x27')](respondWithStatusCode(_0x592a4b,null))[_0xac4a('0x54')](handleError(_0x592a4b,null));};exports['addApplications']=function(_0x3c3576,_0x34bd1c,_0x2d24c7){return db[_0xac4a('0x51')][_0xac4a('0x68')]({'where':{'id':_0x3c3576['params']['id']}})['then'](handleEntityNotFound(_0x34bd1c,null))[_0xac4a('0x27')](function(_0x11bb54){if(_0x11bb54){return db[_0xac4a('0x69')][_0xac4a('0x6a')](function(_0x1db1be){return db[_0xac4a('0x51')][_0xac4a('0x28')]({'where':{'VoiceExtensionId':_0x3c3576[_0xac4a('0x56')]['id']},'transaction':_0x1db1be})[_0xac4a('0x27')](function(_0x295f21){var _0x278c09=_['map'](_0x3c3576['body'],function(_0x1ee825){_0x1ee825[_0xac4a('0x6b')]=_0x3c3576[_0xac4a('0x56')]['id'];return _0x1ee825;});return db[_0xac4a('0x51')][_0xac4a('0x6c')](_0x278c09,{'transaction':_0x1db1be});});})[_0xac4a('0x27')](function(){return db[_0xac4a('0x51')][_0xac4a('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3c3576[_0xac4a('0x56')]['id']},'order':_0xac4a('0x6e')});});}})[_0xac4a('0x27')](respondWithResult(_0x34bd1c,null))[_0xac4a('0x54')](handleError(_0x34bd1c,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7e85415..ed14062 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 _0xb234=['setMaxListeners','save','update','emit','exports','VoiceExtension'];(function(_0x3b45d7,_0xbc2848){var _0x4690e8=function(_0x209c3b){while(--_0x209c3b){_0x3b45d7['push'](_0x3b45d7['shift']());}};_0x4690e8(++_0xbc2848);}(_0xb234,0xd1));var _0x4b23=function(_0xff859c,_0x332ca4){_0xff859c=_0xff859c-0x0;var _0x1a475c=_0xb234[_0xff859c];return _0x1a475c;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x4b23('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4b23('0x1')](0x0);var events={'afterCreate':_0x4b23('0x2'),'afterUpdate':_0x4b23('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b379e){return function(_0x577cec,_0x4635d3,_0x3a2fa){VoiceExtensionEvents[_0x4b23('0x4')](_0x2b379e+':'+_0x577cec['id'],_0x577cec);VoiceExtensionEvents['emit'](_0x2b379e,_0x577cec);_0x3a2fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x4b23('0x5')]=VoiceExtensionEvents; \ No newline at end of file +var _0x68d9=['setMaxListeners','save','update','remove','../../mysqldb'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x68d9,0x1c6));var _0x968d=function(_0x5a0b5f,_0x148687){_0x5a0b5f=_0x5a0b5f-0x0;var _0x1514fb=_0x68d9[_0x5a0b5f];return _0x1514fb;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x968d('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x968d('0x1')](0x0);var events={'afterCreate':_0x968d('0x2'),'afterUpdate':_0x968d('0x3'),'afterDestroy':_0x968d('0x4')};function emitEvent(_0x1f0e79){return function(_0x178ecf,_0x275875,_0x39db02){VoiceExtensionEvents['emit'](_0x1f0e79+':'+_0x178ecf['id'],_0x178ecf);VoiceExtensionEvents['emit'](_0x1f0e79,_0x178ecf);_0x39db02(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 386de5f..9f2a35d 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 _0x9367=['lodash','util','../../config/logger','moment','bluebird','rimraf','exports','VoiceExtension'];(function(_0x1fd482,_0x501b87){var _0x2cba07=function(_0x2c62b8){while(--_0x2c62b8){_0x1fd482['push'](_0x1fd482['shift']());}};_0x2cba07(++_0x501b87);}(_0x9367,0xf0));var _0x7936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9367[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7936('0x0'));var util=require(_0x7936('0x1'));var logger=require(_0x7936('0x2'))('api');var moment=require(_0x7936('0x3'));var BPromise=require(_0x7936('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7936('0x5'));var config=require('../../config/environment');var attributes=require('./voiceExtension.attributes');module[_0x7936('0x6')]=function(_0x39a8f3,_0x180020){return _0x39a8f3['define'](_0x7936('0x7'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5f0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','VoiceExtension','voice_extensions','lodash'];(function(_0x55bd28,_0x38e24c){var _0x4e3815=function(_0x16da92){while(--_0x16da92){_0x55bd28['push'](_0x55bd28['shift']());}};_0x4e3815(++_0x38e24c);}(_0xa5f0,0xd0));var _0x0a5f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa5f0[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x0a5f('0x0'));var util=require('util');var logger=require(_0x0a5f('0x1'))(_0x0a5f('0x2'));var moment=require(_0x0a5f('0x3'));var BPromise=require(_0x0a5f('0x4'));var rp=require(_0x0a5f('0x5'));var fs=require('fs');var path=require(_0x0a5f('0x6'));var rimraf=require(_0x0a5f('0x7'));var config=require('../../config/environment');var attributes=require('./voiceExtension.attributes');module[_0x0a5f('0x8')]=function(_0x43571b,_0x2029be){return _0x43571b['define'](_0x0a5f('0x9'),attributes,{'tableName':_0x0a5f('0xa'),'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 83f3213..96d8706 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 _0xc56d=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','then','debug','stringify','catch','lodash'];(function(_0x32939f,_0x3e5234){var _0x33ebcd=function(_0x4ba1c6){while(--_0x4ba1c6){_0x32939f['push'](_0x32939f['shift']());}};_0x33ebcd(++_0x3e5234);}(_0xc56d,0x8b));var _0xdc56=function(_0x1f5f0d,_0x1d5da6){_0x1f5f0d=_0x1f5f0d-0x0;var _0x407342=_0xc56d[_0x1f5f0d];return _0x407342;};'use strict';var _=require(_0xdc56('0x0'));var util=require(_0xdc56('0x1'));var moment=require(_0xdc56('0x2'));var BPromise=require(_0xdc56('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc56('0x5'));var logger=require(_0xdc56('0x6'))(_0xdc56('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdc56('0x8')]['http']({'port':0x232a});config[_0xdc56('0x9')]=_[_0xdc56('0xa')](config[_0xdc56('0x9')],{'host':_0xdc56('0xb'),'port':0x18eb});var socket=require(_0xdc56('0xc'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xdc56('0xd')](socket);function respondWithRpcPromise(_0x41213c,_0x81b6f9,_0x317167){return new BPromise(function(_0x4c80fa,_0x3f3ccc){return client['request'](_0x41213c,_0x317167)['then'](function(_0x34b057){logger[_0xdc56('0xe')](_0xdc56('0xf'),_0x81b6f9,_0xdc56('0x10'));logger['debug'](_0xdc56('0x11'),_0x81b6f9,_0xdc56('0x10'),JSON['stringify'](_0x34b057));if(_0x34b057[_0xdc56('0x12')]){if(_0x34b057[_0xdc56('0x12')][_0xdc56('0x13')]===0x1f4){logger[_0xdc56('0x12')](_0xdc56('0xf'),_0x81b6f9,_0x34b057['error']['message']);return _0x3f3ccc(_0x34b057[_0xdc56('0x12')][_0xdc56('0x14')]);}logger[_0xdc56('0x12')](_0xdc56('0xf'),_0x81b6f9,_0x34b057[_0xdc56('0x12')][_0xdc56('0x14')]);return _0x4c80fa(_0x34b057[_0xdc56('0x12')][_0xdc56('0x14')]);}else{logger['info'](_0xdc56('0xf'),_0x81b6f9,_0xdc56('0x10'));_0x4c80fa(_0x34b057['result'][_0xdc56('0x14')]);}})['catch'](function(_0x262007){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x81b6f9,_0x262007);_0x3f3ccc(_0x262007);});});}exports[_0xdc56('0x15')]=function(_0x262bf4){var _0x1017f3=this;return new Promise(function(_0x503272,_0x14d23a){return db[_0xdc56('0x16')][_0xdc56('0x17')]({'raw':_0x262bf4[_0xdc56('0x18')]?_0x262bf4[_0xdc56('0x18')][_0xdc56('0x19')]===undefined?!![]:![]:!![],'where':_0x262bf4[_0xdc56('0x18')]?_0x262bf4[_0xdc56('0x18')][_0xdc56('0x1a')]||null:null,'attributes':_0x262bf4['options']?_0x262bf4[_0xdc56('0x18')][_0xdc56('0x1b')]||null:null,'limit':_0x262bf4[_0xdc56('0x18')]?_0x262bf4[_0xdc56('0x18')]['limit']||null:null,'include':_0x262bf4['options']?_0x262bf4[_0xdc56('0x18')][_0xdc56('0x1c')]?_[_0xdc56('0x1d')](_0x262bf4[_0xdc56('0x18')]['include'],function(_0x5ed4b9){return{'model':db[_0x5ed4b9[_0xdc56('0x1e')]],'as':_0x5ed4b9['as'],'attributes':_0x5ed4b9[_0xdc56('0x1b')],'include':_0x5ed4b9['include']?_[_0xdc56('0x1d')](_0x5ed4b9[_0xdc56('0x1c')],function(_0x4a2506){return{'model':db[_0x4a2506[_0xdc56('0x1e')]],'as':_0x4a2506['as'],'attributes':_0x4a2506['attributes'],'include':_0x4a2506[_0xdc56('0x1c')]?_[_0xdc56('0x1d')](_0x4a2506[_0xdc56('0x1c')],function(_0x2e4037){return{'model':db[_0x2e4037[_0xdc56('0x1e')]],'as':_0x2e4037['as'],'attributes':_0x2e4037[_0xdc56('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdc56('0x1f')](function(_0x41f9f0){logger['info'](_0xdc56('0x15'),_0x262bf4);logger[_0xdc56('0x20')](_0xdc56('0x15'),_0x262bf4,JSON[_0xdc56('0x21')](_0x41f9f0));_0x503272(_0x41f9f0);})[_0xdc56('0x22')](function(_0x523f44){logger[_0xdc56('0x12')](_0xdc56('0x15'),_0x523f44['message'],_0x262bf4);_0x14d23a(_0x1017f3[_0xdc56('0x12')](0x1f4,_0x523f44['message']));});});}; \ No newline at end of file +var _0xa657=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','stringify','moment','bluebird','randomstring','ioredis'];(function(_0x210572,_0x121936){var _0x3a8ff3=function(_0x7f05e){while(--_0x7f05e){_0x210572['push'](_0x210572['shift']());}};_0x3a8ff3(++_0x121936);}(_0xa657,0x1dd));var _0x7a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa657[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7a65('0x0'));var BPromise=require(_0x7a65('0x1'));var rs=require(_0x7a65('0x2'));var fs=require('fs');var Redis=require(_0x7a65('0x3'));var db=require(_0x7a65('0x4'))['db'];var utils=require(_0x7a65('0x5'));var logger=require(_0x7a65('0x6'))('rpc');var config=require(_0x7a65('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a65('0x8')][_0x7a65('0x9')]({'port':0x232a});config[_0x7a65('0xa')]=_['defaults'](config[_0x7a65('0xa')],{'host':_0x7a65('0xb'),'port':0x18eb});var socket=require(_0x7a65('0xc'))(new Redis(config[_0x7a65('0xa')]));require(_0x7a65('0xd'))[_0x7a65('0xe')](socket);function respondWithRpcPromise(_0x4c40e5,_0x484784,_0x405b69){return new BPromise(function(_0x342fed,_0x593e84){return client['request'](_0x4c40e5,_0x405b69)[_0x7a65('0xf')](function(_0x4faff6){logger[_0x7a65('0x10')](_0x7a65('0x11'),_0x484784,'request\x20sent');logger[_0x7a65('0x12')](_0x7a65('0x13'),_0x484784,_0x7a65('0x14'),JSON['stringify'](_0x4faff6));if(_0x4faff6[_0x7a65('0x15')]){if(_0x4faff6[_0x7a65('0x15')][_0x7a65('0x16')]===0x1f4){logger[_0x7a65('0x15')](_0x7a65('0x11'),_0x484784,_0x4faff6[_0x7a65('0x15')][_0x7a65('0x17')]);return _0x593e84(_0x4faff6[_0x7a65('0x15')][_0x7a65('0x17')]);}logger[_0x7a65('0x15')](_0x7a65('0x11'),_0x484784,_0x4faff6[_0x7a65('0x15')]['message']);return _0x342fed(_0x4faff6[_0x7a65('0x15')][_0x7a65('0x17')]);}else{logger['info'](_0x7a65('0x11'),_0x484784,_0x7a65('0x14'));_0x342fed(_0x4faff6['result'][_0x7a65('0x17')]);}})[_0x7a65('0x18')](function(_0x4f4cb2){logger[_0x7a65('0x15')](_0x7a65('0x11'),_0x484784,_0x4f4cb2);_0x593e84(_0x4f4cb2);});});}exports[_0x7a65('0x19')]=function(_0x2384e2){var _0xba1c48=this;return new Promise(function(_0x5f4519,_0xbc1e41){return db[_0x7a65('0x1a')][_0x7a65('0x1b')]({'raw':_0x2384e2[_0x7a65('0x1c')]?_0x2384e2['options'][_0x7a65('0x1d')]===undefined?!![]:![]:!![],'where':_0x2384e2['options']?_0x2384e2['options'][_0x7a65('0x1e')]||null:null,'attributes':_0x2384e2[_0x7a65('0x1c')]?_0x2384e2[_0x7a65('0x1c')][_0x7a65('0x1f')]||null:null,'limit':_0x2384e2[_0x7a65('0x1c')]?_0x2384e2[_0x7a65('0x1c')][_0x7a65('0x20')]||null:null,'include':_0x2384e2['options']?_0x2384e2[_0x7a65('0x1c')][_0x7a65('0x21')]?_[_0x7a65('0x22')](_0x2384e2[_0x7a65('0x1c')]['include'],function(_0x3f202a){return{'model':db[_0x3f202a[_0x7a65('0x23')]],'as':_0x3f202a['as'],'attributes':_0x3f202a[_0x7a65('0x1f')],'include':_0x3f202a[_0x7a65('0x21')]?_[_0x7a65('0x22')](_0x3f202a[_0x7a65('0x21')],function(_0x59769c){return{'model':db[_0x59769c[_0x7a65('0x23')]],'as':_0x59769c['as'],'attributes':_0x59769c[_0x7a65('0x1f')],'include':_0x59769c[_0x7a65('0x21')]?_[_0x7a65('0x22')](_0x59769c['include'],function(_0x1ef4f7){return{'model':db[_0x1ef4f7[_0x7a65('0x23')]],'as':_0x1ef4f7['as'],'attributes':_0x1ef4f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a65('0xf')](function(_0x151e02){logger[_0x7a65('0x10')]('GetVoiceExtension',_0x2384e2);logger[_0x7a65('0x12')](_0x7a65('0x19'),_0x2384e2,JSON[_0x7a65('0x24')](_0x151e02));_0x5f4519(_0x151e02);})[_0x7a65('0x18')](function(_0x48b298){logger[_0x7a65('0x15')](_0x7a65('0x19'),_0x48b298[_0x7a65('0x17')],_0x2384e2);_0xbc1e41(_0xba1c48[_0x7a65('0x15')](0x1f4,_0x48b298[_0x7a65('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c5467e0..5a85a92 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 _0x60fe=['emit','removeListener','register','voiceExtension:','save','remove','update'];(function(_0x2e76e7,_0x199692){var _0x3131c6=function(_0x225e4e){while(--_0x225e4e){_0x2e76e7['push'](_0x2e76e7['shift']());}};_0x3131c6(++_0x199692);}(_0x60fe,0x170));var _0xe60f=function(_0x3e40b8,_0x27358a){_0x3e40b8=_0x3e40b8-0x0;var _0x456430=_0x60fe[_0x3e40b8];return _0x456430;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0xe60f('0x0'),_0xe60f('0x1'),_0xe60f('0x2')];function createListener(_0x142ccf,_0x5b0c6d){return function(_0x5d16d1){_0x5b0c6d[_0xe60f('0x3')](_0x142ccf,_0x5d16d1);};}function removeListener(_0x2dc681,_0x354d8b){return function(){VoiceExtensionEvents[_0xe60f('0x4')](_0x2dc681,_0x354d8b);};}exports[_0xe60f('0x5')]=function(_0xa82c94){for(var _0x56ce05=0x0,_0x427e45=events['length'];_0x56ce05<_0x427e45;_0x56ce05++){var _0x702b20=events[_0x56ce05];var _0x34e67a=createListener(_0xe60f('0x6')+_0x702b20,_0xa82c94);VoiceExtensionEvents['on'](_0x702b20,_0x34e67a);}}; \ No newline at end of file +var _0x7a3a=['save','emit','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x1395a6,_0x1038f6){var _0x2fe209=function(_0x1c3788){while(--_0x1c3788){_0x1395a6['push'](_0x1395a6['shift']());}};_0x2fe209(++_0x1038f6);}(_0x7a3a,0x1cd));var _0xa7a3=function(_0x3848cf,_0x38d178){_0x3848cf=_0x3848cf-0x0;var _0x4ba819=_0x7a3a[_0x3848cf];return _0x4ba819;};'use strict';var VoiceExtensionEvents=require(_0xa7a3('0x0'));var events=[_0xa7a3('0x1'),'remove','update'];function createListener(_0x9139cf,_0x13a3df){return function(_0x3bf546){_0x13a3df[_0xa7a3('0x2')](_0x9139cf,_0x3bf546);};}function removeListener(_0xbb0dd2,_0x43dc1d){return function(){VoiceExtensionEvents['removeListener'](_0xbb0dd2,_0x43dc1d);};}exports[_0xa7a3('0x3')]=function(_0x213921){for(var _0x1eda32=0x0,_0x54b630=events[_0xa7a3('0x4')];_0x1eda32<_0x54b630;_0x1eda32++){var _0x4658ab=events[_0x1eda32];var _0xe921dc=createListener(_0xa7a3('0x5')+_0x4658ab,_0x213921);VoiceExtensionEvents['on'](_0x4658ab,_0xe921dc);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8bc89d2..dee5768 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 _0x8760=['post','create','update','delete','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages'];(function(_0x4c759b,_0x362b18){var _0x51c26a=function(_0x59d962){while(--_0x59d962){_0x4c759b['push'](_0x4c759b['shift']());}};_0x51c26a(++_0x362b18);}(_0x8760,0x83));var _0x0876=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x8760[_0x56fe98];return _0x212f4f;};'use strict';var multer=require(_0x0876('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0876('0x1'));var express=require(_0x0876('0x2'));var router=express['Router']();var auth=require(_0x0876('0x3'));var interaction=require(_0x0876('0x4'));var config=require(_0x0876('0x5'));var controller=require('./voiceMail.controller');router[_0x0876('0x6')]('/',auth[_0x0876('0x7')](),controller[_0x0876('0x8')]);router[_0x0876('0x6')](_0x0876('0x9'),auth['isAuthenticated'](),controller[_0x0876('0xa')]);router[_0x0876('0x6')](_0x0876('0xb'),auth[_0x0876('0x7')](),controller[_0x0876('0xc')]);router[_0x0876('0xd')]('/',auth['isAuthenticated'](),controller[_0x0876('0xe')]);router['put']('/:id',auth[_0x0876('0x7')](),controller[_0x0876('0xf')]);router[_0x0876('0x10')](_0x0876('0x9'),auth[_0x0876('0x7')](),controller['destroy']);module[_0x0876('0x11')]=router; \ No newline at end of file +var _0x5df8=['isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x5df8,0xa3));var _0x85df=function(_0x4cf992,_0xbce686){_0x4cf992=_0x4cf992-0x0;var _0x44d172=_0x5df8[_0x4cf992];return _0x44d172;};'use strict';var multer=require(_0x85df('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x85df('0x1'));var express=require(_0x85df('0x2'));var router=express[_0x85df('0x3')]();var auth=require(_0x85df('0x4'));var interaction=require(_0x85df('0x5'));var config=require('../../config/environment');var controller=require(_0x85df('0x6'));router[_0x85df('0x7')]('/',auth[_0x85df('0x8')](),controller[_0x85df('0x9')]);router['get'](_0x85df('0xa'),auth[_0x85df('0x8')](),controller[_0x85df('0xb')]);router[_0x85df('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x85df('0xc')]);router[_0x85df('0xd')]('/',auth['isAuthenticated'](),controller[_0x85df('0xe')]);router[_0x85df('0xf')]('/:id',auth[_0x85df('0x8')](),controller[_0x85df('0x10')]);router[_0x85df('0x11')](_0x85df('0xa'),auth[_0x85df('0x8')](),controller['destroy']);module[_0x85df('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 79906cb..e0bc5b5 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 _0xb58b=['mailbox','exports','STRING','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue'];(function(_0x20463f,_0x4cc37a){var _0x143ee4=function(_0x30bc31){while(--_0x30bc31){_0x20463f['push'](_0x20463f['shift']());}};_0x143ee4(++_0x4cc37a);}(_0xb58b,0x1f1));var _0xbb58=function(_0xee9f49,_0x471222){_0xee9f49=_0xee9f49-0x0;var _0x5b0bf5=_0xb58b[_0xee9f49];return _0x5b0bf5;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'customer_id':{'type':Sequelize[_0xbb58('0x1')]},'context':{'type':Sequelize[_0xbb58('0x1')],'defaultValue':'from-voicemail','unique':_0xbb58('0x2')},'mailbox':{'type':Sequelize[_0xbb58('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xbb58('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbb58('0x1')],'validate':{'isEmail':!![]},'set':function(_0x367b4f){this[_0xbb58('0x3')]('email',typeof _0x367b4f===_0xbb58('0x4')&&_0x367b4f[_0xbb58('0x5')]()?_0x367b4f[_0xbb58('0x5')]():null);}},'pager':{'type':Sequelize[_0xbb58('0x1')]},'tz':{'type':Sequelize[_0xbb58('0x1')],'defaultValue':_0xbb58('0x6')},'attach':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':_0xbb58('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xbb58('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbb58('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbb58('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xbb58('0x8'),'no'),'defaultValue':_0xbb58('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbb58('0x7')](_0xbb58('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbb58('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xbb58('0x1')]},'maxsecs':{'type':Sequelize[_0xbb58('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbb58('0xb')],'get':function(){return this['getDataValue'](_0xbb58('0xc'))+_0xbb58('0xd')+this[_0xbb58('0xe')](_0xbb58('0xf'));}}}; \ No newline at end of file +var _0x8603=['exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x8603,0x190));var _0x3860=function(_0x5a98d6,_0x40a968){_0x5a98d6=_0x5a98d6-0x0;var _0x2043ef=_0x8603[_0x5a98d6];return _0x2043ef;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'customer_id':{'type':Sequelize[_0x3860('0x1')]},'context':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3860('0x2')},'password':{'type':Sequelize[_0x3860('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3860('0x1')],'validate':{'isEmail':!![]},'set':function(_0x56f8c5){this[_0x3860('0x3')](_0x3860('0x4'),typeof _0x56f8c5===_0x3860('0x5')&&_0x56f8c5[_0x3860('0x6')]()?_0x56f8c5[_0x3860('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3860('0x1')]},'callback':{'type':Sequelize[_0x3860('0x1')]},'review':{'type':Sequelize['ENUM'](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3860('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'stamp':{'type':_0x3860('0xa')},'emailsubject':{'type':Sequelize[_0x3860('0x1')]},'emailbody':{'type':Sequelize[_0x3860('0x1')]},'maxsecs':{'type':Sequelize[_0x3860('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3860('0xc')](_0x3860('0xd'))+_0x3860('0xe')+this['getDataValue'](_0x3860('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d486886..3dc52a0 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 _0xc9d0=['../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','Voicemails','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','VoiceMail','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','UserProfileResource','catch','getMessages','findOne','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xc9d0,0xf4));var _0x0c9d=function(_0x46e036,_0x4a77ad){_0x46e036=_0x46e036-0x0;var _0x1e94a7=_0xc9d0[_0x46e036];return _0x1e94a7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0c9d('0x0'));var rimraf=require(_0x0c9d('0x1'));var zipdir=require(_0x0c9d('0x2'));var jsonpatch=require(_0x0c9d('0x3'));var rp=require(_0x0c9d('0x4'));var moment=require(_0x0c9d('0x5'));var BPromise=require(_0x0c9d('0x6'));var Mustache=require(_0x0c9d('0x7'));var util=require('util');var path=require(_0x0c9d('0x8'));var sox=require('sox');var csv=require(_0x0c9d('0x9'));var ejs=require(_0x0c9d('0xa'));var fs=require('fs');var _=require(_0x0c9d('0xb'));var squel=require(_0x0c9d('0xc'));var crypto=require(_0x0c9d('0xd'));var jsforce=require(_0x0c9d('0xe'));var deskjs=require(_0x0c9d('0xf'));var toCsv=require(_0x0c9d('0x9'));var querystring=require('querystring');var Papa=require(_0x0c9d('0x10'));var Redis=require(_0x0c9d('0x11'));var authService=require(_0x0c9d('0x12'));var qs=require(_0x0c9d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c9d('0x14'));var logger=require(_0x0c9d('0x15'))(_0x0c9d('0x16'));var utils=require(_0x0c9d('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x209dde,_0x3e1bc9){_0x3e1bc9=_0x3e1bc9||0xcc;return function(_0x40b0d0){if(_0x40b0d0){return _0x209dde[_0x0c9d('0x18')](_0x3e1bc9);}return _0x209dde[_0x0c9d('0x19')](_0x3e1bc9)['end']();};}function respondWithResult(_0x3dabea,_0x447b42){_0x447b42=_0x447b42||0xc8;return function(_0xe700bb){if(_0xe700bb){return _0x3dabea[_0x0c9d('0x19')](_0x447b42)[_0x0c9d('0x1a')](_0xe700bb);}};}function respondWithFilteredResult(_0x12c4e5,_0x3aebf7){return function(_0x48b24f){if(_0x48b24f){var _0x2cebfb=_0x48b24f[_0x0c9d('0x1b')],_0x138519=_0x3aebf7[_0x0c9d('0x1c')],_0x4f4bb0=_0x3aebf7[_0x0c9d('0x1c')]+_0x3aebf7[_0x0c9d('0x1d')],_0x1ce9f;if(_0x4f4bb0>=_0x2cebfb){_0x4f4bb0=_0x2cebfb;_0x1ce9f=0xc8;}else{_0x1ce9f=0xce;}_0x12c4e5[_0x0c9d('0x19')](_0x1ce9f);return _0x12c4e5[_0x0c9d('0x1e')]('Content-Range',_0x138519+'-'+_0x4f4bb0+'/'+_0x2cebfb)['json'](_0x48b24f);}return null;};}function patchUpdates(_0x45ec5f){return function(_0x56d7fd){try{jsonpatch[_0x0c9d('0x1f')](_0x56d7fd,_0x45ec5f,!![]);}catch(_0x111a65){return BPromise[_0x0c9d('0x20')](_0x111a65);}return _0x56d7fd[_0x0c9d('0x21')]();};}function saveUpdates(_0x53b5b4,_0x31d206){return function(_0x1d9741){if(_0x1d9741){return _0x1d9741[_0x0c9d('0x22')](_0x53b5b4)[_0x0c9d('0x23')](function(_0x1033d4){return _0x1033d4;});}return null;};}function removeEntity(_0x191475,_0x282133){return function(_0x5332c0){if(_0x5332c0){return _0x5332c0[_0x0c9d('0x24')]()[_0x0c9d('0x23')](function(){var _0x3a443d=_0x5332c0['get']({'plain':!![]});var _0x7cfc62=_0x0c9d('0x25');return db['UserProfileResource'][_0x0c9d('0x24')]({'where':{'type':_0x7cfc62,'resourceId':_0x3a443d['id']}})[_0x0c9d('0x23')](function(){return _0x5332c0;});})[_0x0c9d('0x23')](function(){_0x191475[_0x0c9d('0x19')](0xcc)[_0x0c9d('0x26')]();});}};}function handleEntityNotFound(_0x87639,_0x5ccef1){return function(_0x1b99e3){if(!_0x1b99e3){_0x87639['sendStatus'](0x194);}return _0x1b99e3;};}function handleError(_0x1f3791,_0xc62778){_0xc62778=_0xc62778||0x1f4;return function(_0x3e0687){logger[_0x0c9d('0x27')](_0x3e0687[_0x0c9d('0x28')]);if(_0x3e0687[_0x0c9d('0x29')]){delete _0x3e0687[_0x0c9d('0x29')];}_0x1f3791[_0x0c9d('0x19')](_0xc62778)[_0x0c9d('0x2a')](_0x3e0687);};}exports[_0x0c9d('0x2b')]=function(_0x66abf,_0x173006){var _0x3ffc66={},_0x144258={},_0xbc1221={'count':0x0,'rows':[]};var _0x15d911=_[_0x0c9d('0x2c')](db['VoiceMail'][_0x0c9d('0x2d')],function(_0x55476e){return{'name':_0x55476e[_0x0c9d('0x2e')],'type':_0x55476e[_0x0c9d('0x2f')][_0x0c9d('0x30')]};});_0x144258[_0x0c9d('0x31')]=_[_0x0c9d('0x2c')](_0x15d911,'name');_0x144258[_0x0c9d('0x32')]=_[_0x0c9d('0x33')](_0x66abf[_0x0c9d('0x32')]);_0x144258[_0x0c9d('0x34')]=_[_0x0c9d('0x35')](_0x144258[_0x0c9d('0x31')],_0x144258[_0x0c9d('0x32')]);_0x3ffc66[_0x0c9d('0x36')]=_[_0x0c9d('0x35')](_0x144258[_0x0c9d('0x31')],qs[_0x0c9d('0x37')](_0x66abf[_0x0c9d('0x32')][_0x0c9d('0x37')]));_0x3ffc66[_0x0c9d('0x36')]=_0x3ffc66[_0x0c9d('0x36')]['length']?_0x3ffc66['attributes']:_0x144258['model'];if(!_0x66abf['query'][_0x0c9d('0x38')](_0x0c9d('0x39'))){_0x3ffc66['limit']=qs[_0x0c9d('0x1d')](_0x66abf[_0x0c9d('0x32')][_0x0c9d('0x1d')]);_0x3ffc66[_0x0c9d('0x1c')]=qs[_0x0c9d('0x1c')](_0x66abf['query']['offset']);}_0x3ffc66[_0x0c9d('0x3a')]=qs[_0x0c9d('0x3b')](_0x66abf[_0x0c9d('0x32')][_0x0c9d('0x3b')]);_0x3ffc66[_0x0c9d('0x3c')]=qs[_0x0c9d('0x34')](_[_0x0c9d('0x3d')](_0x66abf['query'],_0x144258[_0x0c9d('0x34')]),_0x15d911);if(_0x66abf['query'][_0x0c9d('0x3e')]){_0x3ffc66[_0x0c9d('0x3c')]=_['merge'](_0x3ffc66[_0x0c9d('0x3c')],{'$or':_['map'](_0x15d911,function(_0x4d8c3b){if(_0x4d8c3b[_0x0c9d('0x2f')]!=='VIRTUAL'){var _0x2ed627={};_0x2ed627[_0x4d8c3b['name']]={'$like':'%'+_0x66abf[_0x0c9d('0x32')][_0x0c9d('0x3e')]+'%'};return _0x2ed627;}})});}_0x3ffc66=_[_0x0c9d('0x3f')]({},_0x3ffc66,_0x66abf[_0x0c9d('0x40')]);var _0x36f942={'where':_0x3ffc66['where']};return db['VoiceMail']['count'](_0x36f942)[_0x0c9d('0x23')](function(_0x409281){_0xbc1221[_0x0c9d('0x1b')]=_0x409281;if(_0x66abf[_0x0c9d('0x32')][_0x0c9d('0x41')]){_0x3ffc66[_0x0c9d('0x42')]=[{'all':!![]}];}return db[_0x0c9d('0x43')]['findAll'](_0x3ffc66);})[_0x0c9d('0x23')](function(_0x1ba2e9){_0xbc1221[_0x0c9d('0x44')]=_0x1ba2e9;return _0xbc1221;})[_0x0c9d('0x23')](respondWithFilteredResult(_0x173006,_0x3ffc66))['catch'](handleError(_0x173006,null));};exports[_0x0c9d('0x45')]=function(_0x32b60d,_0x5ddf9e){var _0x115d64={'raw':!![],'where':{'id':_0x32b60d[_0x0c9d('0x46')]['id']}},_0x25ce10={};_0x25ce10['model']=_['keys'](db[_0x0c9d('0x43')][_0x0c9d('0x2d')]);_0x25ce10['query']=_['keys'](_0x32b60d['query']);_0x25ce10['filters']=_[_0x0c9d('0x35')](_0x25ce10['model'],_0x25ce10[_0x0c9d('0x32')]);_0x115d64[_0x0c9d('0x36')]=_[_0x0c9d('0x35')](_0x25ce10[_0x0c9d('0x31')],qs[_0x0c9d('0x37')](_0x32b60d[_0x0c9d('0x32')][_0x0c9d('0x37')]));_0x115d64[_0x0c9d('0x36')]=_0x115d64[_0x0c9d('0x36')][_0x0c9d('0x47')]?_0x115d64['attributes']:_0x25ce10['model'];if(_0x32b60d[_0x0c9d('0x32')][_0x0c9d('0x41')]){_0x115d64['include']=[{'all':!![]}];}_0x115d64=_['merge']({},_0x115d64,_0x32b60d['options']);return db[_0x0c9d('0x43')][_0x0c9d('0x48')](_0x115d64)[_0x0c9d('0x23')](handleEntityNotFound(_0x5ddf9e,null))['then'](respondWithResult(_0x5ddf9e,null))['catch'](handleError(_0x5ddf9e,null));};exports['create']=function(_0x316310,_0x3fb27e){return db[_0x0c9d('0x43')][_0x0c9d('0x49')](_0x316310[_0x0c9d('0x4a')],{})['then'](function(_0x42e987){var _0x45f420=_0x316310[_0x0c9d('0x4b')]['get']({'plain':!![]});if(!_0x45f420)throw new Error(_0x0c9d('0x4c'));if(_0x45f420[_0x0c9d('0x4d')]===_0x0c9d('0x4b')){var _0x8e9e3e=_0x42e987[_0x0c9d('0x4e')]({'plain':!![]});var _0x4c382d=_0x0c9d('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x4c382d,'userProfileId':_0x45f420[_0x0c9d('0x4f')]},'raw':!![]})[_0x0c9d('0x23')](function(_0x59bc2e){if(_0x59bc2e&&_0x59bc2e[_0x0c9d('0x50')]===0x0){return db[_0x0c9d('0x51')]['create']({'name':_0x8e9e3e[_0x0c9d('0x29')],'resourceId':_0x8e9e3e['id'],'type':_0x59bc2e['name'],'sectionId':_0x59bc2e['id']},{})[_0x0c9d('0x23')](function(){return _0x42e987;});}else{return _0x42e987;}})[_0x0c9d('0x52')](function(_0x1fe966){logger[_0x0c9d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fe966);throw _0x1fe966;});}return _0x42e987;})['then'](respondWithResult(_0x3fb27e,0xc9))[_0x0c9d('0x52')](handleError(_0x3fb27e,null));};exports[_0x0c9d('0x22')]=function(_0x2b21b9,_0x5159c5){if(_0x2b21b9[_0x0c9d('0x4a')]['id']){delete _0x2b21b9[_0x0c9d('0x4a')]['id'];}return db[_0x0c9d('0x43')][_0x0c9d('0x48')]({'where':{'id':_0x2b21b9[_0x0c9d('0x46')]['id']}})['then'](handleEntityNotFound(_0x5159c5,null))[_0x0c9d('0x23')](saveUpdates(_0x2b21b9[_0x0c9d('0x4a')],null))['then'](respondWithResult(_0x5159c5,null))[_0x0c9d('0x52')](handleError(_0x5159c5,null));};exports[_0x0c9d('0x24')]=function(_0x4849f4,_0x515e51){return db[_0x0c9d('0x43')][_0x0c9d('0x48')]({'where':{'id':_0x4849f4['params']['id']}})[_0x0c9d('0x23')](handleEntityNotFound(_0x515e51,null))[_0x0c9d('0x23')](removeEntity(_0x515e51,null))[_0x0c9d('0x52')](handleError(_0x515e51,null));};exports[_0x0c9d('0x53')]=function(_0x205083,_0x5afab0,_0x50a72e){return db[_0x0c9d('0x43')][_0x0c9d('0x54')]({'where':{'id':_0x205083[_0x0c9d('0x46')]['id']}})['then'](handleEntityNotFound(_0x5afab0,null))[_0x0c9d('0x23')](function(_0x538755){var _0x4affa1;var _0x1cee22={},_0x45896b={};_0x45896b[_0x0c9d('0x31')]=_[_0x0c9d('0x33')](db['VoiceMailMessage'][_0x0c9d('0x2d')]);_0x45896b[_0x0c9d('0x32')]=_[_0x0c9d('0x33')](_0x205083[_0x0c9d('0x32')]);_0x45896b['filters']=_[_0x0c9d('0x35')](_0x45896b['model'],_0x45896b[_0x0c9d('0x32')]);_0x1cee22[_0x0c9d('0x36')]=_[_0x0c9d('0x35')](_0x45896b[_0x0c9d('0x31')],qs[_0x0c9d('0x37')](_0x205083[_0x0c9d('0x32')][_0x0c9d('0x37')]));_0x1cee22[_0x0c9d('0x36')]=_0x1cee22['attributes'][_0x0c9d('0x47')]?_0x1cee22[_0x0c9d('0x36')]:_0x45896b[_0x0c9d('0x31')];if(!_0x205083[_0x0c9d('0x32')][_0x0c9d('0x38')](_0x0c9d('0x39'))){_0x1cee22[_0x0c9d('0x1d')]=qs[_0x0c9d('0x1d')](_0x205083[_0x0c9d('0x32')]['limit']);_0x1cee22[_0x0c9d('0x1c')]=qs[_0x0c9d('0x1c')](_0x205083[_0x0c9d('0x32')][_0x0c9d('0x1c')]);}_0x1cee22[_0x0c9d('0x3a')]=qs[_0x0c9d('0x3b')](_0x205083[_0x0c9d('0x32')][_0x0c9d('0x3b')]);_0x1cee22['where']=qs[_0x0c9d('0x34')](_['pick'](_0x205083[_0x0c9d('0x32')],_0x45896b[_0x0c9d('0x34')]));if(_0x205083[_0x0c9d('0x32')][_0x0c9d('0x3e')]){_0x1cee22['where']=_[_0x0c9d('0x3f')](_0x1cee22[_0x0c9d('0x3c')],{'$or':_[_0x0c9d('0x2c')](_0x1cee22[_0x0c9d('0x36')],function(_0x3092ae){var _0x15beb0={};_0x15beb0[_0x3092ae]={'$like':'%'+_0x205083[_0x0c9d('0x32')][_0x0c9d('0x3e')]+'%'};return _0x15beb0;})});}_0x1cee22[_0x0c9d('0x3c')]=_[_0x0c9d('0x3f')](_0x1cee22[_0x0c9d('0x3c')],{'mailboxuser':_0x538755[_0x0c9d('0x55')]});_0x1cee22=_['merge']({},_0x1cee22,_0x205083[_0x0c9d('0x40')]);return db[_0x0c9d('0x56')][_0x0c9d('0x57')](_0x1cee22)[_0x0c9d('0x23')](respondWithFilteredResult(_0x5afab0,_0x1cee22));})['catch'](handleError(_0x5afab0,null));}; \ No newline at end of file +var _0x5d08=['moment','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','offset','limit','Content-Range','reject','update','then','destroy','get','Voicemails','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','findAndCountAll','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x5d75ff,_0x5bc7ac){var _0x1c1894=function(_0x1fcade){while(--_0x1fcade){_0x5d75ff['push'](_0x5d75ff['shift']());}};_0x1c1894(++_0x5bc7ac);}(_0x5d08,0x1dc));var _0x85d0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5d08[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x85d0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85d0('0x1'));var jsonpatch=require(_0x85d0('0x2'));var rp=require(_0x85d0('0x3'));var moment=require(_0x85d0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x85d0('0x5'));var sox=require(_0x85d0('0x6'));var csv=require('to-csv');var ejs=require(_0x85d0('0x7'));var fs=require('fs');var _=require(_0x85d0('0x8'));var squel=require('squel');var crypto=require(_0x85d0('0x9'));var jsforce=require(_0x85d0('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x85d0('0xb'));var Papa=require(_0x85d0('0xc'));var Redis=require(_0x85d0('0xd'));var authService=require(_0x85d0('0xe'));var qs=require(_0x85d0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85d0('0x10'));var logger=require(_0x85d0('0x11'))(_0x85d0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x85d0('0x13'))['db'];function respondWithStatusCode(_0x1264b9,_0x45c501){_0x45c501=_0x45c501||0xcc;return function(_0x46e07e){if(_0x46e07e){return _0x1264b9['sendStatus'](_0x45c501);}return _0x1264b9[_0x85d0('0x14')](_0x45c501)[_0x85d0('0x15')]();};}function respondWithResult(_0x39a7b3,_0x47aac6){_0x47aac6=_0x47aac6||0xc8;return function(_0x39c52b){if(_0x39c52b){return _0x39a7b3[_0x85d0('0x14')](_0x47aac6)['json'](_0x39c52b);}};}function respondWithFilteredResult(_0x523f54,_0x532ada){return function(_0x5ad82c){if(_0x5ad82c){var _0x10a1cc=_0x5ad82c['count'],_0x2c6684=_0x532ada[_0x85d0('0x16')],_0x34e24a=_0x532ada[_0x85d0('0x16')]+_0x532ada[_0x85d0('0x17')],_0x2e8c5c;if(_0x34e24a>=_0x10a1cc){_0x34e24a=_0x10a1cc;_0x2e8c5c=0xc8;}else{_0x2e8c5c=0xce;}_0x523f54[_0x85d0('0x14')](_0x2e8c5c);return _0x523f54['set'](_0x85d0('0x18'),_0x2c6684+'-'+_0x34e24a+'/'+_0x10a1cc)['json'](_0x5ad82c);}return null;};}function patchUpdates(_0x4e5891){return function(_0x1a5a00){try{jsonpatch['apply'](_0x1a5a00,_0x4e5891,!![]);}catch(_0x4361aa){return BPromise[_0x85d0('0x19')](_0x4361aa);}return _0x1a5a00['save']();};}function saveUpdates(_0x9db565,_0x289bbb){return function(_0x35210d){if(_0x35210d){return _0x35210d[_0x85d0('0x1a')](_0x9db565)[_0x85d0('0x1b')](function(_0x1f7c3e){return _0x1f7c3e;});}return null;};}function removeEntity(_0x11f0dd,_0x3e0720){return function(_0x476f21){if(_0x476f21){return _0x476f21[_0x85d0('0x1c')]()['then'](function(){var _0x20f662=_0x476f21[_0x85d0('0x1d')]({'plain':!![]});var _0x1c7a03=_0x85d0('0x1e');return db['UserProfileResource']['destroy']({'where':{'type':_0x1c7a03,'resourceId':_0x20f662['id']}})[_0x85d0('0x1b')](function(){return _0x476f21;});})['then'](function(){_0x11f0dd[_0x85d0('0x14')](0xcc)[_0x85d0('0x15')]();});}};}function handleEntityNotFound(_0x492759,_0x39a1e1){return function(_0x46847b){if(!_0x46847b){_0x492759[_0x85d0('0x1f')](0x194);}return _0x46847b;};}function handleError(_0x1ec832,_0x5d5f8d){_0x5d5f8d=_0x5d5f8d||0x1f4;return function(_0x34ed92){logger[_0x85d0('0x20')](_0x34ed92[_0x85d0('0x21')]);if(_0x34ed92[_0x85d0('0x22')]){delete _0x34ed92[_0x85d0('0x22')];}_0x1ec832[_0x85d0('0x14')](_0x5d5f8d)[_0x85d0('0x23')](_0x34ed92);};}exports[_0x85d0('0x24')]=function(_0x7d47,_0x5c92c6){var _0x3a7276={},_0x4c2dd0={},_0x463c68={'count':0x0,'rows':[]};var _0x5ddd48=_[_0x85d0('0x25')](db[_0x85d0('0x26')][_0x85d0('0x27')],function(_0x22daa4){return{'name':_0x22daa4[_0x85d0('0x28')],'type':_0x22daa4[_0x85d0('0x29')][_0x85d0('0x2a')]};});_0x4c2dd0[_0x85d0('0x2b')]=_[_0x85d0('0x25')](_0x5ddd48,_0x85d0('0x22'));_0x4c2dd0[_0x85d0('0x2c')]=_['keys'](_0x7d47[_0x85d0('0x2c')]);_0x4c2dd0['filters']=_[_0x85d0('0x2d')](_0x4c2dd0[_0x85d0('0x2b')],_0x4c2dd0[_0x85d0('0x2c')]);_0x3a7276[_0x85d0('0x2e')]=_[_0x85d0('0x2d')](_0x4c2dd0['model'],qs[_0x85d0('0x2f')](_0x7d47[_0x85d0('0x2c')][_0x85d0('0x2f')]));_0x3a7276['attributes']=_0x3a7276[_0x85d0('0x2e')][_0x85d0('0x30')]?_0x3a7276['attributes']:_0x4c2dd0[_0x85d0('0x2b')];if(!_0x7d47['query'][_0x85d0('0x31')](_0x85d0('0x32'))){_0x3a7276[_0x85d0('0x17')]=qs['limit'](_0x7d47['query'][_0x85d0('0x17')]);_0x3a7276['offset']=qs[_0x85d0('0x16')](_0x7d47[_0x85d0('0x2c')][_0x85d0('0x16')]);}_0x3a7276[_0x85d0('0x33')]=qs[_0x85d0('0x34')](_0x7d47[_0x85d0('0x2c')][_0x85d0('0x34')]);_0x3a7276[_0x85d0('0x35')]=qs['filters'](_['pick'](_0x7d47[_0x85d0('0x2c')],_0x4c2dd0[_0x85d0('0x36')]),_0x5ddd48);if(_0x7d47[_0x85d0('0x2c')][_0x85d0('0x37')]){_0x3a7276[_0x85d0('0x35')]=_[_0x85d0('0x38')](_0x3a7276[_0x85d0('0x35')],{'$or':_[_0x85d0('0x25')](_0x5ddd48,function(_0x2a19ff){if(_0x2a19ff[_0x85d0('0x29')]!==_0x85d0('0x39')){var _0xb05c45={};_0xb05c45[_0x2a19ff[_0x85d0('0x22')]]={'$like':'%'+_0x7d47['query']['filter']+'%'};return _0xb05c45;}})});}_0x3a7276=_[_0x85d0('0x38')]({},_0x3a7276,_0x7d47[_0x85d0('0x3a')]);var _0x8481fe={'where':_0x3a7276['where']};return db[_0x85d0('0x26')][_0x85d0('0x3b')](_0x8481fe)[_0x85d0('0x1b')](function(_0x27a50c){_0x463c68[_0x85d0('0x3b')]=_0x27a50c;if(_0x7d47['query'][_0x85d0('0x3c')]){_0x3a7276[_0x85d0('0x3d')]=[{'all':!![]}];}return db[_0x85d0('0x26')][_0x85d0('0x3e')](_0x3a7276);})[_0x85d0('0x1b')](function(_0x39a318){_0x463c68['rows']=_0x39a318;return _0x463c68;})[_0x85d0('0x1b')](respondWithFilteredResult(_0x5c92c6,_0x3a7276))[_0x85d0('0x3f')](handleError(_0x5c92c6,null));};exports['show']=function(_0x61a6d3,_0x1698cd){var _0x566a33={'raw':!![],'where':{'id':_0x61a6d3['params']['id']}},_0x4064b8={};_0x4064b8[_0x85d0('0x2b')]=_[_0x85d0('0x40')](db['VoiceMail'][_0x85d0('0x27')]);_0x4064b8[_0x85d0('0x2c')]=_[_0x85d0('0x40')](_0x61a6d3[_0x85d0('0x2c')]);_0x4064b8['filters']=_['intersection'](_0x4064b8[_0x85d0('0x2b')],_0x4064b8['query']);_0x566a33['attributes']=_[_0x85d0('0x2d')](_0x4064b8[_0x85d0('0x2b')],qs[_0x85d0('0x2f')](_0x61a6d3[_0x85d0('0x2c')][_0x85d0('0x2f')]));_0x566a33[_0x85d0('0x2e')]=_0x566a33[_0x85d0('0x2e')][_0x85d0('0x30')]?_0x566a33[_0x85d0('0x2e')]:_0x4064b8['model'];if(_0x61a6d3[_0x85d0('0x2c')][_0x85d0('0x3c')]){_0x566a33[_0x85d0('0x3d')]=[{'all':!![]}];}_0x566a33=_[_0x85d0('0x38')]({},_0x566a33,_0x61a6d3[_0x85d0('0x3a')]);return db['VoiceMail'][_0x85d0('0x41')](_0x566a33)[_0x85d0('0x1b')](handleEntityNotFound(_0x1698cd,null))[_0x85d0('0x1b')](respondWithResult(_0x1698cd,null))['catch'](handleError(_0x1698cd,null));};exports[_0x85d0('0x42')]=function(_0x2a9cd9,_0x31bdf4){return db[_0x85d0('0x26')][_0x85d0('0x42')](_0x2a9cd9['body'],{})[_0x85d0('0x1b')](function(_0x17941a){var _0x5b17b0=_0x2a9cd9['user'][_0x85d0('0x1d')]({'plain':!![]});if(!_0x5b17b0)throw new Error(_0x85d0('0x43'));if(_0x5b17b0[_0x85d0('0x44')]===_0x85d0('0x45')){var _0x4acb07=_0x17941a[_0x85d0('0x1d')]({'plain':!![]});var _0x6e6334=_0x85d0('0x1e');return db[_0x85d0('0x46')][_0x85d0('0x41')]({'where':{'name':_0x6e6334,'userProfileId':_0x5b17b0[_0x85d0('0x47')]},'raw':!![]})[_0x85d0('0x1b')](function(_0x151afc){if(_0x151afc&&_0x151afc[_0x85d0('0x48')]===0x0){return db[_0x85d0('0x49')][_0x85d0('0x42')]({'name':_0x4acb07[_0x85d0('0x22')],'resourceId':_0x4acb07['id'],'type':_0x151afc[_0x85d0('0x22')],'sectionId':_0x151afc['id']},{})[_0x85d0('0x1b')](function(){return _0x17941a;});}else{return _0x17941a;}})['catch'](function(_0xa04358){logger[_0x85d0('0x20')](_0x85d0('0x4a'),_0xa04358);throw _0xa04358;});}return _0x17941a;})['then'](respondWithResult(_0x31bdf4,0xc9))[_0x85d0('0x3f')](handleError(_0x31bdf4,null));};exports['update']=function(_0x56fc2e,_0x58de80){if(_0x56fc2e[_0x85d0('0x4b')]['id']){delete _0x56fc2e[_0x85d0('0x4b')]['id'];}return db[_0x85d0('0x26')][_0x85d0('0x41')]({'where':{'id':_0x56fc2e[_0x85d0('0x4c')]['id']}})[_0x85d0('0x1b')](handleEntityNotFound(_0x58de80,null))[_0x85d0('0x1b')](saveUpdates(_0x56fc2e[_0x85d0('0x4b')],null))[_0x85d0('0x1b')](respondWithResult(_0x58de80,null))[_0x85d0('0x3f')](handleError(_0x58de80,null));};exports['destroy']=function(_0x5ee220,_0x3e8243){return db[_0x85d0('0x26')]['find']({'where':{'id':_0x5ee220[_0x85d0('0x4c')]['id']}})[_0x85d0('0x1b')](handleEntityNotFound(_0x3e8243,null))[_0x85d0('0x1b')](removeEntity(_0x3e8243,null))[_0x85d0('0x3f')](handleError(_0x3e8243,null));};exports['getMessages']=function(_0x27452b,_0x5db4aa,_0x1a8e7b){return db[_0x85d0('0x26')][_0x85d0('0x4d')]({'where':{'id':_0x27452b['params']['id']}})[_0x85d0('0x1b')](handleEntityNotFound(_0x5db4aa,null))[_0x85d0('0x1b')](function(_0xdadc0b){var _0x2a3771;var _0x50e936={},_0x519525={};_0x519525[_0x85d0('0x2b')]=_[_0x85d0('0x40')](db[_0x85d0('0x4e')][_0x85d0('0x27')]);_0x519525[_0x85d0('0x2c')]=_[_0x85d0('0x40')](_0x27452b[_0x85d0('0x2c')]);_0x519525[_0x85d0('0x36')]=_[_0x85d0('0x2d')](_0x519525[_0x85d0('0x2b')],_0x519525[_0x85d0('0x2c')]);_0x50e936[_0x85d0('0x2e')]=_[_0x85d0('0x2d')](_0x519525[_0x85d0('0x2b')],qs[_0x85d0('0x2f')](_0x27452b['query']['fields']));_0x50e936[_0x85d0('0x2e')]=_0x50e936[_0x85d0('0x2e')]['length']?_0x50e936[_0x85d0('0x2e')]:_0x519525[_0x85d0('0x2b')];if(!_0x27452b[_0x85d0('0x2c')][_0x85d0('0x31')](_0x85d0('0x32'))){_0x50e936[_0x85d0('0x17')]=qs[_0x85d0('0x17')](_0x27452b[_0x85d0('0x2c')][_0x85d0('0x17')]);_0x50e936[_0x85d0('0x16')]=qs['offset'](_0x27452b['query'][_0x85d0('0x16')]);}_0x50e936[_0x85d0('0x33')]=qs[_0x85d0('0x34')](_0x27452b[_0x85d0('0x2c')][_0x85d0('0x34')]);_0x50e936['where']=qs['filters'](_['pick'](_0x27452b[_0x85d0('0x2c')],_0x519525[_0x85d0('0x36')]));if(_0x27452b['query'][_0x85d0('0x37')]){_0x50e936[_0x85d0('0x35')]=_[_0x85d0('0x38')](_0x50e936[_0x85d0('0x35')],{'$or':_[_0x85d0('0x25')](_0x50e936[_0x85d0('0x2e')],function(_0x4a35d3){var _0x523db5={};_0x523db5[_0x4a35d3]={'$like':'%'+_0x27452b[_0x85d0('0x2c')][_0x85d0('0x37')]+'%'};return _0x523db5;})});}_0x50e936[_0x85d0('0x35')]=_[_0x85d0('0x38')](_0x50e936['where'],{'mailboxuser':_0xdadc0b['mailbox']});_0x50e936=_[_0x85d0('0x38')]({},_0x50e936,_0x27452b[_0x85d0('0x3a')]);return db[_0x85d0('0x4e')][_0x85d0('0x4f')](_0x50e936)[_0x85d0('0x1b')](respondWithFilteredResult(_0x5db4aa,_0x50e936));})['catch'](handleError(_0x5db4aa,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 675e35e..920d4eb 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 _0x7b37=['exports','VoiceMail','mailbox','context','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x2e3646,_0x412055){var _0x2b1dc1=function(_0x4e723a){while(--_0x4e723a){_0x2e3646['push'](_0x2e3646['shift']());}};_0x2b1dc1(++_0x412055);}(_0x7b37,0xf6));var _0x77b3=function(_0x534380,_0x4c3a1d){_0x534380=_0x534380-0x0;var _0x18f1c0=_0x7b37[_0x534380];return _0x18f1c0;};'use strict';var _=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var logger=require(_0x77b3('0x2'))('api');var moment=require(_0x77b3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x77b3('0x4'));var config=require(_0x77b3('0x5'));var attributes=require(_0x77b3('0x6'));module[_0x77b3('0x7')]=function(_0x2a1c2f,_0x3c5b07){return _0x2a1c2f['define'](_0x77b3('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x77b3('0x9'),_0x77b3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a3e=['define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x45cea1,_0x45db40){var _0xda8ddd=function(_0x43062d){while(--_0x43062d){_0x45cea1['push'](_0x45cea1['shift']());}};_0xda8ddd(++_0x45db40);}(_0x1a3e,0xad));var _0xe1a3=function(_0x268f24,_0x27099a){_0x268f24=_0x268f24-0x0;var _0x17deca=_0x1a3e[_0x268f24];return _0x17deca;};'use strict';var _=require(_0xe1a3('0x0'));var util=require(_0xe1a3('0x1'));var logger=require(_0xe1a3('0x2'))(_0xe1a3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe1a3('0x4'));var fs=require('fs');var path=require(_0xe1a3('0x5'));var rimraf=require(_0xe1a3('0x6'));var config=require(_0xe1a3('0x7'));var attributes=require('./voiceMail.attributes');module[_0xe1a3('0x8')]=function(_0x399c17,_0x3d706f){return _0x399c17[_0xe1a3('0x9')](_0xe1a3('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xe1a3('0xb'),'fields':[_0xe1a3('0xc'),_0xe1a3('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 8eabcf0..b9add13 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 _0x746f=['request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x366d1a,_0xc40dc5){var _0x47e192=function(_0x3bf911){while(--_0x3bf911){_0x366d1a['push'](_0x366d1a['shift']());}};_0x47e192(++_0xc40dc5);}(_0x746f,0x17d));var _0xf746=function(_0x1c7cf0,_0x2e897f){_0x1c7cf0=_0x1c7cf0-0x0;var _0x92073b=_0x746f[_0x1c7cf0];return _0x92073b;};'use strict';var _=require(_0xf746('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf746('0x1'));var rs=require(_0xf746('0x2'));var fs=require('fs');var Redis=require(_0xf746('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf746('0x4'));var logger=require(_0xf746('0x5'))(_0xf746('0x6'));var config=require('../../config/environment');var jayson=require(_0xf746('0x7'));var client=jayson[_0xf746('0x8')][_0xf746('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a8d91,_0x4932cd,_0x286ade){return new BPromise(function(_0x1cc2e8,_0x511398){return client[_0xf746('0xa')](_0x5a8d91,_0x286ade)[_0xf746('0xb')](function(_0x1d2ab9){logger[_0xf746('0xc')](_0xf746('0xd'),_0x4932cd,'request\x20sent');logger[_0xf746('0xe')](_0xf746('0xf'),_0x4932cd,_0xf746('0x10'),JSON[_0xf746('0x11')](_0x1d2ab9));if(_0x1d2ab9[_0xf746('0x12')]){if(_0x1d2ab9[_0xf746('0x12')][_0xf746('0x13')]===0x1f4){logger['error'](_0xf746('0xd'),_0x4932cd,_0x1d2ab9[_0xf746('0x12')][_0xf746('0x14')]);return _0x511398(_0x1d2ab9['error']['message']);}logger[_0xf746('0x12')](_0xf746('0xd'),_0x4932cd,_0x1d2ab9[_0xf746('0x12')][_0xf746('0x14')]);return _0x1cc2e8(_0x1d2ab9[_0xf746('0x12')][_0xf746('0x14')]);}else{logger[_0xf746('0xc')](_0xf746('0xd'),_0x4932cd,_0xf746('0x10'));_0x1cc2e8(_0x1d2ab9[_0xf746('0x15')]['message']);}})[_0xf746('0x16')](function(_0x2750ea){logger['error']('VoiceMail,\x20%s,\x20%s',_0x4932cd,_0x2750ea);_0x511398(_0x2750ea);});});} \ No newline at end of file +var _0xb1c8=['code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xb1c8,0x164));var _0x8b1c=function(_0x401609,_0x5eb61d){_0x401609=_0x401609-0x0;var _0x35fd57=_0xb1c8[_0x401609];return _0x35fd57;};'use strict';var _=require('lodash');var util=require(_0x8b1c('0x0'));var moment=require(_0x8b1c('0x1'));var BPromise=require(_0x8b1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b1c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b1c('0x4'))(_0x8b1c('0x5'));var config=require(_0x8b1c('0x6'));var jayson=require(_0x8b1c('0x7'));var client=jayson[_0x8b1c('0x8')][_0x8b1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b10e1,_0x73623f,_0x1cbde4){return new BPromise(function(_0x28d8db,_0x292c49){return client[_0x8b1c('0xa')](_0x3b10e1,_0x1cbde4)['then'](function(_0x16e4c5){logger[_0x8b1c('0xb')](_0x8b1c('0xc'),_0x73623f,'request\x20sent');logger[_0x8b1c('0xd')](_0x8b1c('0xe'),_0x73623f,_0x8b1c('0xf'),JSON[_0x8b1c('0x10')](_0x16e4c5));if(_0x16e4c5[_0x8b1c('0x11')]){if(_0x16e4c5[_0x8b1c('0x11')][_0x8b1c('0x12')]===0x1f4){logger[_0x8b1c('0x11')](_0x8b1c('0xc'),_0x73623f,_0x16e4c5['error']['message']);return _0x292c49(_0x16e4c5[_0x8b1c('0x11')]['message']);}logger['error'](_0x8b1c('0xc'),_0x73623f,_0x16e4c5[_0x8b1c('0x11')][_0x8b1c('0x13')]);return _0x28d8db(_0x16e4c5['error'][_0x8b1c('0x13')]);}else{logger[_0x8b1c('0xb')](_0x8b1c('0xc'),_0x73623f,_0x8b1c('0xf'));_0x28d8db(_0x16e4c5[_0x8b1c('0x14')]['message']);}})[_0x8b1c('0x15')](function(_0x244a6c){logger[_0x8b1c('0x11')](_0x8b1c('0xc'),_0x73623f,_0x244a6c);_0x292c49(_0x244a6c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 303f4c7..072fac6 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 _0x31f0=['get','/:id','show','/:id/download','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller'];(function(_0x351c8e,_0x52178c){var _0x1c5e78=function(_0x364d3c){while(--_0x364d3c){_0x351c8e['push'](_0x351c8e['shift']());}};_0x1c5e78(++_0x52178c);}(_0x31f0,0xb7));var _0x031f=function(_0x337256,_0x12c999){_0x337256=_0x337256-0x0;var _0x4b0386=_0x31f0[_0x337256];return _0x4b0386;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0x7')](_0x031f('0xa'),auth[_0x031f('0xb')](),controller['download']);router[_0x031f('0xc')]('/',auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);router[_0x031f('0x10')]('/:id',auth[_0x031f('0xb')](),controller[_0x031f('0x11')]);module[_0x031f('0x12')]=router; \ No newline at end of file +var _0x53ec=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','/:id/download','download','post','create','put','delete'];(function(_0x38db8c,_0x5bc9a1){var _0x29d61f=function(_0x1bb1ec){while(--_0x1bb1ec){_0x38db8c['push'](_0x38db8c['shift']());}};_0x29d61f(++_0x5bc9a1);}(_0x53ec,0x192));var _0xc53e=function(_0x5ce7e2,_0x8dd5de){_0x5ce7e2=_0x5ce7e2-0x0;var _0x5224d1=_0x53ec[_0x5ce7e2];return _0x5224d1;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0x8')](_0xc53e('0xc'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);module[_0xc53e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 2384250..c87b465 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 _0xd991=['exports','INTEGER','STRING','long','sequelize'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xd991,0xa4));var _0x1d99=function(_0x4522f5,_0xe7b271){_0x4522f5=_0x4522f5-0x0;var _0x5e2179=_0xd991[_0x4522f5];return _0x5e2179;};'use strict';var Sequelize=require(_0x1d99('0x0'));module[_0x1d99('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x8c7b58){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x1d99('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1d99('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x1d99('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1d99('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x1d99('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x1d99('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1d99('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x1d99('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x1d99('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1d99('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x2ffd=['STRING','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x226abd,_0x5f3012){var _0x52760c=function(_0x42926b){while(--_0x42926b){_0x226abd['push'](_0x226abd['shift']());}};_0x52760c(++_0x5f3012);}(_0x2ffd,0xeb));var _0xd2ff=function(_0x57e407,_0x5a2739){_0x57e407=_0x57e407-0x0;var _0x17b0be=_0x2ffd[_0x57e407];return _0x17b0be;};'use strict';var Sequelize=require(_0xd2ff('0x0'));module[_0xd2ff('0x1')]={'name':{'type':Sequelize[_0xd2ff('0x2')],'get':function(_0x283c29){return this[_0xd2ff('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xd2ff('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd2ff('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd2ff('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xd2ff('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xd2ff('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd2ff('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd2ff('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xd2ff('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xd2ff('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd2ff('0x5')],'defaultValue':''},'stamp':{'type':_0xd2ff('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4bc7d22..7a2890a 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 _0xc901=['moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','fields','find','catch','create','body','params','download','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','recording','html-pdf','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc901,0x142));var _0x1c90=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc901[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x1c90('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1c90('0x1'));var moment=require(_0x1c90('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1c90('0x3'));var util=require(_0x1c90('0x4'));var path=require(_0x1c90('0x5'));var sox=require(_0x1c90('0x6'));var csv=require(_0x1c90('0x7'));var ejs=require(_0x1c90('0x8'));var fs=require('fs');var _=require(_0x1c90('0x9'));var squel=require(_0x1c90('0xa'));var crypto=require(_0x1c90('0xb'));var jsforce=require(_0x1c90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1c90('0x7'));var querystring=require(_0x1c90('0xd'));var Papa=require(_0x1c90('0xe'));var Redis=require(_0x1c90('0xf'));var authService=require(_0x1c90('0x10'));var qs=require(_0x1c90('0x11'));var as=require(_0x1c90('0x12'));var hardwareService=require(_0x1c90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1c90('0x14'));var config=require(_0x1c90('0x15'));var db=require(_0x1c90('0x16'))['db'];function respondWithStatusCode(_0x4addeb,_0x4da158){_0x4da158=_0x4da158||0xcc;return function(_0x3a38ed){if(_0x3a38ed){return _0x4addeb[_0x1c90('0x17')](_0x4da158);}return _0x4addeb['status'](_0x4da158)[_0x1c90('0x18')]();};}function respondWithResult(_0x128969,_0xf72b98){_0xf72b98=_0xf72b98||0xc8;return function(_0x589c97){if(_0x589c97){return _0x128969[_0x1c90('0x19')](_0xf72b98)['json'](_0x589c97);}};}function respondWithFilteredResult(_0x1174b6,_0x210ef4){return function(_0x7a88dc){if(_0x7a88dc){var _0x42d8a4=_0x7a88dc[_0x1c90('0x1a')],_0x48bd5e=_0x210ef4[_0x1c90('0x1b')],_0x296c5d=_0x210ef4['offset']+_0x210ef4[_0x1c90('0x1c')],_0x526f4e;if(_0x296c5d>=_0x42d8a4){_0x296c5d=_0x42d8a4;_0x526f4e=0xc8;}else{_0x526f4e=0xce;}_0x1174b6['status'](_0x526f4e);return _0x1174b6['set'](_0x1c90('0x1d'),_0x48bd5e+'-'+_0x296c5d+'/'+_0x42d8a4)['json'](_0x7a88dc);}return null;};}function patchUpdates(_0x341228){return function(_0x677a96){try{jsonpatch[_0x1c90('0x1e')](_0x677a96,_0x341228,!![]);}catch(_0x13626b){return BPromise['reject'](_0x13626b);}return _0x677a96[_0x1c90('0x1f')]();};}function saveUpdates(_0x5a9cc0,_0x525997){return function(_0x38f997){if(_0x38f997){return _0x38f997[_0x1c90('0x20')](_0x5a9cc0)['then'](function(_0x27765a){return _0x27765a;});}return null;};}function removeEntity(_0x1af08e,_0x445664){return function(_0x4074fd){if(_0x4074fd){return _0x4074fd[_0x1c90('0x21')]()[_0x1c90('0x22')](function(){_0x1af08e['status'](0xcc)[_0x1c90('0x18')]();});}};}function handleEntityNotFound(_0x46baa1,_0xab232a){return function(_0x33c88b){if(!_0x33c88b){_0x46baa1[_0x1c90('0x17')](0x194);}return _0x33c88b;};}function handleError(_0x26d55a,_0x4c3bb0){_0x4c3bb0=_0x4c3bb0||0x1f4;return function(_0x56a62b){logger[_0x1c90('0x23')](_0x56a62b[_0x1c90('0x24')]);if(_0x56a62b[_0x1c90('0x25')]){delete _0x56a62b['name'];}_0x26d55a[_0x1c90('0x19')](_0x4c3bb0)[_0x1c90('0x26')](_0x56a62b);};}exports['index']=function(_0x10a9bd,_0x7e9044){var _0x488d52={},_0x3f3d0f={},_0x372a2b={'count':0x0,'rows':[]};var _0x28801d=_[_0x1c90('0x27')](db[_0x1c90('0x28')][_0x1c90('0x29')],function(_0xd0a607){return{'name':_0xd0a607[_0x1c90('0x2a')],'type':_0xd0a607['type'][_0x1c90('0x2b')]};});_0x3f3d0f[_0x1c90('0x2c')]=_[_0x1c90('0x2d')](_[_0x1c90('0x27')](_0x28801d,_0x1c90('0x25')),[_0x1c90('0x25')]);_0x3f3d0f[_0x1c90('0x2e')]=_[_0x1c90('0x2f')](_0x10a9bd[_0x1c90('0x2e')]);_0x3f3d0f[_0x1c90('0x30')]=_[_0x1c90('0x31')](_0x3f3d0f['model'],_0x3f3d0f[_0x1c90('0x2e')]);_0x488d52[_0x1c90('0x32')]=_['intersection'](_0x3f3d0f[_0x1c90('0x2c')],qs['fields'](_0x10a9bd[_0x1c90('0x2e')]['fields']));_0x488d52[_0x1c90('0x32')]=_0x488d52['attributes'][_0x1c90('0x33')]?_0x488d52[_0x1c90('0x32')]:_0x3f3d0f['model'];if(!_0x10a9bd[_0x1c90('0x2e')][_0x1c90('0x34')]('nolimit')){_0x488d52[_0x1c90('0x1c')]=qs[_0x1c90('0x1c')](_0x10a9bd[_0x1c90('0x2e')][_0x1c90('0x1c')]);_0x488d52[_0x1c90('0x1b')]=qs['offset'](_0x10a9bd['query']['offset']);}_0x488d52['order']=qs['sort'](_0x10a9bd[_0x1c90('0x2e')][_0x1c90('0x35')]);_0x488d52[_0x1c90('0x36')]=qs['filters'](_[_0x1c90('0x37')](_0x10a9bd['query'],_0x3f3d0f[_0x1c90('0x30')]),_0x28801d);if(_0x10a9bd[_0x1c90('0x2e')]['filter']){_0x488d52['where']=_[_0x1c90('0x38')](_0x488d52[_0x1c90('0x36')],{'$or':_[_0x1c90('0x27')](_0x28801d,function(_0x42a730){if(_0x42a730[_0x1c90('0x39')]!==_0x1c90('0x3a')){var _0x1645b0={};_0x1645b0[_0x42a730['name']]={'$like':'%'+_0x10a9bd['query'][_0x1c90('0x3b')]+'%'};return _0x1645b0;}})});}_0x488d52=_[_0x1c90('0x38')]({},_0x488d52,_0x10a9bd[_0x1c90('0x3c')]);var _0x2bb1f9={'where':_0x488d52[_0x1c90('0x36')]};return db[_0x1c90('0x28')][_0x1c90('0x1a')](_0x2bb1f9)[_0x1c90('0x22')](function(_0x398ee9){_0x372a2b[_0x1c90('0x1a')]=_0x398ee9;if(_0x10a9bd['query'][_0x1c90('0x3d')]){_0x488d52['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x1c90('0x3e')](_0x488d52);})['then'](function(_0x4bd8be){_0x372a2b[_0x1c90('0x3f')]=_0x4bd8be;return _0x372a2b;})[_0x1c90('0x22')](respondWithFilteredResult(_0x7e9044,_0x488d52))['catch'](handleError(_0x7e9044,null));};exports[_0x1c90('0x40')]=function(_0x3271ea,_0x19fa9c){var _0x244748={'raw':!![],'where':{'id':_0x3271ea['params']['id']}},_0x59ca45={};_0x59ca45[_0x1c90('0x2c')]=_[_0x1c90('0x2f')](db['VoiceMailMessage'][_0x1c90('0x29')]);_0x59ca45['query']=_[_0x1c90('0x2f')](_0x3271ea[_0x1c90('0x2e')]);_0x59ca45['filters']=_[_0x1c90('0x31')](_0x59ca45[_0x1c90('0x2c')],_0x59ca45[_0x1c90('0x2e')]);_0x244748[_0x1c90('0x32')]=_[_0x1c90('0x31')](_0x59ca45[_0x1c90('0x2c')],qs[_0x1c90('0x41')](_0x3271ea[_0x1c90('0x2e')][_0x1c90('0x41')]));_0x244748[_0x1c90('0x32')]=_0x244748[_0x1c90('0x32')]['length']?_0x244748[_0x1c90('0x32')]:_0x59ca45['model'];if(_0x3271ea[_0x1c90('0x2e')]['includeAll']){_0x244748['include']=[{'all':!![]}];}_0x244748=_[_0x1c90('0x38')]({},_0x244748,_0x3271ea[_0x1c90('0x3c')]);return db[_0x1c90('0x28')][_0x1c90('0x42')](_0x244748)[_0x1c90('0x22')](handleEntityNotFound(_0x19fa9c,null))[_0x1c90('0x22')](respondWithResult(_0x19fa9c,null))[_0x1c90('0x43')](handleError(_0x19fa9c,null));};exports[_0x1c90('0x44')]=function(_0x3d6e92,_0x5f1fbc){return db['VoiceMailMessage'][_0x1c90('0x44')](_0x3d6e92[_0x1c90('0x45')],{})[_0x1c90('0x22')](respondWithResult(_0x5f1fbc,0xc9))[_0x1c90('0x43')](handleError(_0x5f1fbc,null));};exports[_0x1c90('0x20')]=function(_0x435378,_0x357ee4){if(_0x435378[_0x1c90('0x45')]['id']){delete _0x435378['body']['id'];}return db[_0x1c90('0x28')][_0x1c90('0x42')]({'where':{'id':_0x435378[_0x1c90('0x46')]['id']}})['then'](handleEntityNotFound(_0x357ee4,null))['then'](saveUpdates(_0x435378[_0x1c90('0x45')],null))['then'](respondWithResult(_0x357ee4,null))[_0x1c90('0x43')](handleError(_0x357ee4,null));};exports['destroy']=function(_0x550436,_0x2ae157){return db[_0x1c90('0x28')]['find']({'where':{'id':_0x550436['params']['id']}})[_0x1c90('0x22')](handleEntityNotFound(_0x2ae157,null))['then'](removeEntity(_0x2ae157,null))[_0x1c90('0x43')](handleError(_0x2ae157,null));};exports[_0x1c90('0x47')]=function(_0xc38b75,_0x3d89e2,_0x4f7076){return db['VoiceMailMessage']['find']({'where':{'id':_0xc38b75[_0x1c90('0x46')]['id']},'attributes':['id','recording',_0x1c90('0x48')]})[_0x1c90('0x22')](handleEntityNotFound(_0x3d89e2,null))['then'](function(_0x221db6){if(_0x221db6){if(!_0x221db6['recording']){throw new db[(_0x1c90('0x49'))]['ValidationError'](_0x1c90('0x4a'));}var _0x211697={'Content-Type':_0x1c90('0x4b'),'Content-Disposition':_0x1c90('0x4c')};if(_0x221db6['msg_id']){_0x211697[_0x1c90('0x4d')]=_0x1c90('0x4e')+_0x221db6[_0x1c90('0x48')]+_0x1c90('0x4f');}_0x3d89e2['set'](_0x211697);return _0x3d89e2[_0x1c90('0x26')](new Buffer(_0x221db6[_0x1c90('0x50')]));}})[_0x1c90('0x43')](handleError(_0x3d89e2,null));}; \ No newline at end of file +var _0x6b20=['stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','then','catch','show','params','create','body','find','destroy','download','recording','msg_id','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','send','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','error'];(function(_0x203140,_0x12e454){var _0x33a597=function(_0x14a0f0){while(--_0x14a0f0){_0x203140['push'](_0x203140['shift']());}};_0x33a597(++_0x12e454);}(_0x6b20,0xd1));var _0x06b2=function(_0x280b16,_0xf9d983){_0x280b16=_0x280b16-0x0;var _0x31e8ec=_0x6b20[_0x280b16];return _0x31e8ec;};'use strict';var pdf=require(_0x06b2('0x0'));var emlformat=require(_0x06b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x06b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06b2('0x3'));var moment=require(_0x06b2('0x4'));var BPromise=require(_0x06b2('0x5'));var Mustache=require('mustache');var util=require(_0x06b2('0x6'));var path=require(_0x06b2('0x7'));var sox=require(_0x06b2('0x8'));var csv=require(_0x06b2('0x9'));var ejs=require(_0x06b2('0xa'));var fs=require('fs');var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x9'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var db=require(_0x06b2('0x15'))['db'];function respondWithStatusCode(_0x368889,_0x44a9b4){_0x44a9b4=_0x44a9b4||0xcc;return function(_0x810a12){if(_0x810a12){return _0x368889[_0x06b2('0x16')](_0x44a9b4);}return _0x368889[_0x06b2('0x17')](_0x44a9b4)[_0x06b2('0x18')]();};}function respondWithResult(_0x28f9f3,_0xa81f11){_0xa81f11=_0xa81f11||0xc8;return function(_0x2822e9){if(_0x2822e9){return _0x28f9f3[_0x06b2('0x17')](_0xa81f11)['json'](_0x2822e9);}};}function respondWithFilteredResult(_0x325cde,_0xaee98c){return function(_0x47496c){if(_0x47496c){var _0x3830e9=_0x47496c[_0x06b2('0x19')],_0xef0466=_0xaee98c[_0x06b2('0x1a')],_0x45d5c5=_0xaee98c['offset']+_0xaee98c[_0x06b2('0x1b')],_0x4b148c;if(_0x45d5c5>=_0x3830e9){_0x45d5c5=_0x3830e9;_0x4b148c=0xc8;}else{_0x4b148c=0xce;}_0x325cde['status'](_0x4b148c);return _0x325cde['set'](_0x06b2('0x1c'),_0xef0466+'-'+_0x45d5c5+'/'+_0x3830e9)[_0x06b2('0x1d')](_0x47496c);}return null;};}function patchUpdates(_0x27852e){return function(_0x2182f3){try{jsonpatch['apply'](_0x2182f3,_0x27852e,!![]);}catch(_0x288801){return BPromise[_0x06b2('0x1e')](_0x288801);}return _0x2182f3[_0x06b2('0x1f')]();};}function saveUpdates(_0x465325,_0xe28985){return function(_0x368ad8){if(_0x368ad8){return _0x368ad8[_0x06b2('0x20')](_0x465325)['then'](function(_0x18c9a9){return _0x18c9a9;});}return null;};}function removeEntity(_0x290840,_0xb05f65){return function(_0x208384){if(_0x208384){return _0x208384['destroy']()['then'](function(){_0x290840[_0x06b2('0x17')](0xcc)[_0x06b2('0x18')]();});}};}function handleEntityNotFound(_0x4fc95f,_0x39659f){return function(_0x5e40f2){if(!_0x5e40f2){_0x4fc95f[_0x06b2('0x16')](0x194);}return _0x5e40f2;};}function handleError(_0x38987b,_0x2a0645){_0x2a0645=_0x2a0645||0x1f4;return function(_0x593d3a){logger[_0x06b2('0x21')](_0x593d3a[_0x06b2('0x22')]);if(_0x593d3a[_0x06b2('0x23')]){delete _0x593d3a[_0x06b2('0x23')];}_0x38987b[_0x06b2('0x17')](_0x2a0645)['send'](_0x593d3a);};}exports[_0x06b2('0x24')]=function(_0x34370b,_0x40a73f){var _0x1a99c1={},_0x1976ac={},_0x3e7cd4={'count':0x0,'rows':[]};var _0x5ba3c4=_[_0x06b2('0x25')](db[_0x06b2('0x26')][_0x06b2('0x27')],function(_0x13c0eb){return{'name':_0x13c0eb[_0x06b2('0x28')],'type':_0x13c0eb[_0x06b2('0x29')][_0x06b2('0x2a')]};});_0x1976ac['model']=_[_0x06b2('0x2b')](_[_0x06b2('0x25')](_0x5ba3c4,_0x06b2('0x23')),[_0x06b2('0x23')]);_0x1976ac[_0x06b2('0x2c')]=_[_0x06b2('0x2d')](_0x34370b[_0x06b2('0x2c')]);_0x1976ac[_0x06b2('0x2e')]=_['intersection'](_0x1976ac[_0x06b2('0x2f')],_0x1976ac[_0x06b2('0x2c')]);_0x1a99c1[_0x06b2('0x30')]=_[_0x06b2('0x31')](_0x1976ac[_0x06b2('0x2f')],qs[_0x06b2('0x32')](_0x34370b[_0x06b2('0x2c')]['fields']));_0x1a99c1['attributes']=_0x1a99c1[_0x06b2('0x30')][_0x06b2('0x33')]?_0x1a99c1[_0x06b2('0x30')]:_0x1976ac['model'];if(!_0x34370b[_0x06b2('0x2c')][_0x06b2('0x34')](_0x06b2('0x35'))){_0x1a99c1[_0x06b2('0x1b')]=qs[_0x06b2('0x1b')](_0x34370b[_0x06b2('0x2c')]['limit']);_0x1a99c1[_0x06b2('0x1a')]=qs[_0x06b2('0x1a')](_0x34370b[_0x06b2('0x2c')]['offset']);}_0x1a99c1[_0x06b2('0x36')]=qs[_0x06b2('0x37')](_0x34370b['query'][_0x06b2('0x37')]);_0x1a99c1[_0x06b2('0x38')]=qs[_0x06b2('0x2e')](_[_0x06b2('0x39')](_0x34370b[_0x06b2('0x2c')],_0x1976ac[_0x06b2('0x2e')]),_0x5ba3c4);if(_0x34370b[_0x06b2('0x2c')][_0x06b2('0x3a')]){_0x1a99c1[_0x06b2('0x38')]=_[_0x06b2('0x3b')](_0x1a99c1[_0x06b2('0x38')],{'$or':_[_0x06b2('0x25')](_0x5ba3c4,function(_0x5ec05d){if(_0x5ec05d[_0x06b2('0x29')]!=='VIRTUAL'){var _0x4a4146={};_0x4a4146[_0x5ec05d[_0x06b2('0x23')]]={'$like':'%'+_0x34370b['query'][_0x06b2('0x3a')]+'%'};return _0x4a4146;}})});}_0x1a99c1=_['merge']({},_0x1a99c1,_0x34370b[_0x06b2('0x3c')]);var _0x369673={'where':_0x1a99c1[_0x06b2('0x38')]};return db[_0x06b2('0x26')][_0x06b2('0x19')](_0x369673)['then'](function(_0x404eab){_0x3e7cd4[_0x06b2('0x19')]=_0x404eab;if(_0x34370b[_0x06b2('0x2c')][_0x06b2('0x3d')]){_0x1a99c1[_0x06b2('0x3e')]=[{'all':!![]}];}return db[_0x06b2('0x26')]['findAll'](_0x1a99c1);})[_0x06b2('0x3f')](function(_0x41e74e){_0x3e7cd4['rows']=_0x41e74e;return _0x3e7cd4;})['then'](respondWithFilteredResult(_0x40a73f,_0x1a99c1))[_0x06b2('0x40')](handleError(_0x40a73f,null));};exports[_0x06b2('0x41')]=function(_0x286c9b,_0x3a8452){var _0x3b5edc={'raw':!![],'where':{'id':_0x286c9b[_0x06b2('0x42')]['id']}},_0x1d174d={};_0x1d174d[_0x06b2('0x2f')]=_[_0x06b2('0x2d')](db[_0x06b2('0x26')][_0x06b2('0x27')]);_0x1d174d[_0x06b2('0x2c')]=_[_0x06b2('0x2d')](_0x286c9b[_0x06b2('0x2c')]);_0x1d174d[_0x06b2('0x2e')]=_[_0x06b2('0x31')](_0x1d174d[_0x06b2('0x2f')],_0x1d174d[_0x06b2('0x2c')]);_0x3b5edc[_0x06b2('0x30')]=_['intersection'](_0x1d174d[_0x06b2('0x2f')],qs[_0x06b2('0x32')](_0x286c9b[_0x06b2('0x2c')][_0x06b2('0x32')]));_0x3b5edc['attributes']=_0x3b5edc[_0x06b2('0x30')][_0x06b2('0x33')]?_0x3b5edc['attributes']:_0x1d174d[_0x06b2('0x2f')];if(_0x286c9b[_0x06b2('0x2c')]['includeAll']){_0x3b5edc[_0x06b2('0x3e')]=[{'all':!![]}];}_0x3b5edc=_[_0x06b2('0x3b')]({},_0x3b5edc,_0x286c9b['options']);return db['VoiceMailMessage']['find'](_0x3b5edc)[_0x06b2('0x3f')](handleEntityNotFound(_0x3a8452,null))[_0x06b2('0x3f')](respondWithResult(_0x3a8452,null))[_0x06b2('0x40')](handleError(_0x3a8452,null));};exports[_0x06b2('0x43')]=function(_0x1cbb02,_0x559c5a){return db['VoiceMailMessage'][_0x06b2('0x43')](_0x1cbb02[_0x06b2('0x44')],{})[_0x06b2('0x3f')](respondWithResult(_0x559c5a,0xc9))[_0x06b2('0x40')](handleError(_0x559c5a,null));};exports[_0x06b2('0x20')]=function(_0xc18216,_0x530b41){if(_0xc18216[_0x06b2('0x44')]['id']){delete _0xc18216[_0x06b2('0x44')]['id'];}return db[_0x06b2('0x26')][_0x06b2('0x45')]({'where':{'id':_0xc18216[_0x06b2('0x42')]['id']}})[_0x06b2('0x3f')](handleEntityNotFound(_0x530b41,null))['then'](saveUpdates(_0xc18216[_0x06b2('0x44')],null))[_0x06b2('0x3f')](respondWithResult(_0x530b41,null))[_0x06b2('0x40')](handleError(_0x530b41,null));};exports[_0x06b2('0x46')]=function(_0x487341,_0x281acc){return db[_0x06b2('0x26')][_0x06b2('0x45')]({'where':{'id':_0x487341[_0x06b2('0x42')]['id']}})['then'](handleEntityNotFound(_0x281acc,null))[_0x06b2('0x3f')](removeEntity(_0x281acc,null))[_0x06b2('0x40')](handleError(_0x281acc,null));};exports[_0x06b2('0x47')]=function(_0x26478c,_0x4618d8,_0x37c9cd){return db[_0x06b2('0x26')][_0x06b2('0x45')]({'where':{'id':_0x26478c['params']['id']},'attributes':['id',_0x06b2('0x48'),_0x06b2('0x49')]})[_0x06b2('0x3f')](handleEntityNotFound(_0x4618d8,null))[_0x06b2('0x3f')](function(_0x2857d5){if(_0x2857d5){if(!_0x2857d5[_0x06b2('0x48')]){throw new db['Sequelize']['ValidationError'](_0x06b2('0x4a'));}var _0x590b64={'Content-Type':'audio/wav','Content-Disposition':_0x06b2('0x4b')};if(_0x2857d5['msg_id']){_0x590b64[_0x06b2('0x4c')]=_0x06b2('0x4d')+_0x2857d5[_0x06b2('0x49')]+_0x06b2('0x4e');}_0x4618d8[_0x06b2('0x4f')](_0x590b64);return _0x4618d8[_0x06b2('0x50')](new Buffer(_0x2857d5[_0x06b2('0x48')]));}})[_0x06b2('0x40')](handleError(_0x4618d8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e7e64df..ba4cff8 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 _0xc836=['dir','util','../../config/logger','api','path','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage'];(function(_0x3e8186,_0x5932d0){var _0x3374ef=function(_0x468ab8){while(--_0x468ab8){_0x3e8186['push'](_0x3e8186['shift']());}};_0x3374ef(++_0x5932d0);}(_0xc836,0x133));var _0x6c83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc836[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6c83('0x0'));var logger=require(_0x6c83('0x1'))(_0x6c83('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c83('0x3'));var rimraf=require('rimraf');var config=require(_0x6c83('0x4'));var attributes=require(_0x6c83('0x5'));module[_0x6c83('0x6')]=function(_0x14f044,_0x2caafe){return _0x14f044['define'](_0x6c83('0x7'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x6c83('0x8'),'fields':[_0x6c83('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb1ae=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x210a3a,_0x1f5265){var _0x328725=function(_0x21de5f){while(--_0x21de5f){_0x210a3a['push'](_0x210a3a['shift']());}};_0x328725(++_0x1f5265);}(_0xb1ae,0x14f));var _0xeb1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ae[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeb1a('0x0'));var util=require('util');var logger=require(_0xeb1a('0x1'))(_0xeb1a('0x2'));var moment=require(_0xeb1a('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb1a('0x4'));var fs=require('fs');var path=require(_0xeb1a('0x5'));var rimraf=require(_0xeb1a('0x6'));var config=require(_0xeb1a('0x7'));var attributes=require(_0xeb1a('0x8'));module[_0xeb1a('0x9')]=function(_0xf6c6b8,_0x14898a){return _0xf6c6b8[_0xeb1a('0xa')](_0xeb1a('0xb'),attributes,{'tableName':_0xeb1a('0xc'),'paranoid':![],'indexes':[{'name':_0xeb1a('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2274fee..c8f9323 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a1b35,_0x43f746){var _0x27fd53=function(_0x398150){while(--_0x398150){_0x3a1b35['push'](_0x3a1b35['shift']());}};_0x27fd53(++_0x43f746);}(_0xadb5,0xad));var _0x5adb=function(_0x3867fb,_0x387c37){_0x3867fb=_0x3867fb-0x0;var _0x155be5=_0xadb5[_0x3867fb];return _0x155be5;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _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(_0x2b716b,_0x9001ae){var _0x4b4499=function(_0x3faaea){while(--_0x3faaea){_0x2b716b['push'](_0x2b716b['shift']());}};_0x4b4499(++_0x9001ae);}(_0x2ef3,0xba));var _0x32ef=function(_0x5007aa,_0x7d8ff6){_0x5007aa=_0x5007aa-0x0;var _0x1c8313=_0x2ef3[_0x5007aa];return _0x1c8313;};'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 diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a78b522..cafab03 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 _0x4579=['create','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post'];(function(_0x400e2d,_0x21740a){var _0x57bd5a=function(_0x2d0f55){while(--_0x2d0f55){_0x400e2d['push'](_0x400e2d['shift']());}};_0x57bd5a(++_0x21740a);}(_0x4579,0x126));var _0x9457=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4579[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x9457('0x0'));var path=require(_0x9457('0x1'));var timeout=require(_0x9457('0x2'));var express=require(_0x9457('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9457('0x4'));var config=require('../../config/environment');var controller=require(_0x9457('0x5'));router[_0x9457('0x6')]('/',auth[_0x9457('0x7')](),controller[_0x9457('0x8')]);router[_0x9457('0x6')](_0x9457('0x9'),auth[_0x9457('0x7')](),controller[_0x9457('0xa')]);router[_0x9457('0x6')](_0x9457('0xb'),auth[_0x9457('0x7')](),controller[_0x9457('0xc')]);router[_0x9457('0xd')]('/',auth[_0x9457('0x7')](),controller[_0x9457('0xe')]);router['post'](_0x9457('0xb'),auth[_0x9457('0x7')](),controller[_0x9457('0xf')]);router[_0x9457('0x10')]('/:id',auth[_0x9457('0x7')](),controller['update']);router[_0x9457('0x11')]('/:id',auth[_0x9457('0x7')](),controller[_0x9457('0x12')]);router[_0x9457('0x11')](_0x9457('0x13'),auth[_0x9457('0x7')](),controller[_0x9457('0x14')]);module[_0x9457('0x15')]=router; \ No newline at end of file +var _0x1179=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/sounds','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0x1179,0x7e));var _0x9117=function(_0x4b84ae,_0x26f981){_0x4b84ae=_0x4b84ae-0x0;var _0x3325f8=_0x1179[_0x4b84ae];return _0x3325f8;};'use strict';var multer=require(_0x9117('0x0'));var util=require(_0x9117('0x1'));var path=require(_0x9117('0x2'));var timeout=require('connect-timeout');var express=require(_0x9117('0x3'));var router=express[_0x9117('0x4')]();var auth=require(_0x9117('0x5'));var interaction=require(_0x9117('0x6'));var config=require(_0x9117('0x7'));var controller=require(_0x9117('0x8'));router[_0x9117('0x9')]('/',auth[_0x9117('0xa')](),controller[_0x9117('0xb')]);router[_0x9117('0x9')](_0x9117('0xc'),auth['isAuthenticated'](),controller[_0x9117('0xd')]);router[_0x9117('0x9')]('/:id/sounds',auth['isAuthenticated'](),controller['getSounds']);router[_0x9117('0xe')]('/',auth['isAuthenticated'](),controller[_0x9117('0xf')]);router[_0x9117('0xe')](_0x9117('0x10'),auth[_0x9117('0xa')](),controller['addSound']);router['put'](_0x9117('0xc'),auth[_0x9117('0xa')](),controller['update']);router[_0x9117('0x11')](_0x9117('0xc'),auth[_0x9117('0xa')](),controller[_0x9117('0x12')]);router['delete'](_0x9117('0x13'),auth['isAuthenticated'](),controller[_0x9117('0x14')]);module[_0x9117('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 68b95b8..495ed74 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 _0x41b8=['mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','quietmp3nb','quietmp3'];(function(_0x298d1a,_0x5ebcd1){var _0x16b7f4=function(_0x903e13){while(--_0x903e13){_0x298d1a['push'](_0x298d1a['shift']());}};_0x16b7f4(++_0x5ebcd1);}(_0x41b8,0x94));var _0x841b=function(_0x2d7836,_0x5a5412){_0x2d7836=_0x2d7836-0x0;var _0x491179=_0x41b8[_0x2d7836];return _0x491179;};'use strict';var Sequelize=require(_0x841b('0x0'));module[_0x841b('0x1')]={'name':{'type':Sequelize[_0x841b('0x2')],'allowNull':![],'unique':_0x841b('0x3')},'mode':{'type':Sequelize[_0x841b('0x4')](_0x841b('0x5'),'files','mp3nb',_0x841b('0x6'),_0x841b('0x7'),_0x841b('0x8')),'allowNull':!![],'defaultValue':_0x841b('0x9')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x841b('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x841b('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x841b('0x2')],'allowNull':!![],'defaultValue':_0x841b('0xa')},'format':{'type':Sequelize[_0x841b('0x2')],'allowNull':!![]},'stamp':{'type':_0x841b('0xb')},'defaultEntry':{'type':Sequelize[_0x841b('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b4a=['name','ENUM','files','mp3nb','quietmp3','mp3','alpha','sequelize','exports','STRING'];(function(_0x42601a,_0x3e3392){var _0x4cb326=function(_0x5d8063){while(--_0x5d8063){_0x42601a['push'](_0x42601a['shift']());}};_0x4cb326(++_0x3e3392);}(_0x6b4a,0x147));var _0xa6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa6b4('0x0'));module[_0xa6b4('0x1')]={'name':{'type':Sequelize[_0xa6b4('0x2')],'allowNull':![],'unique':_0xa6b4('0x3')},'mode':{'type':Sequelize[_0xa6b4('0x4')]('custom',_0xa6b4('0x5'),_0xa6b4('0x6'),'quietmp3nb',_0xa6b4('0x7'),_0xa6b4('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xa6b4('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xa6b4('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa6b4('0x2')],'allowNull':!![],'defaultValue':_0xa6b4('0x9')},'format':{'type':Sequelize[_0xa6b4('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 2bcce22..dbdafb1 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 _0x5f2f=['getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','catch','transaction','mode','directory','server/files/moh','create','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound'];(function(_0x53f5e1,_0x5edc73){var _0x46b143=function(_0x17dd84){while(--_0x17dd84){_0x53f5e1['push'](_0x53f5e1['shift']());}};_0x46b143(++_0x5edc73);}(_0x5f2f,0x73));var _0xf5f2=function(_0x534455,_0x3b9e7c){_0x534455=_0x534455-0x0;var _0x2e1f36=_0x5f2f[_0x534455];return _0x2e1f36;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');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('0xa'));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 db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){var _0x21cd91=_0x39c024[_0xf5f2('0x24')]({'plain':!![]});var _0x4e8bda=_0xf5f2('0x25');return db[_0xf5f2('0x26')]['destroy']({'where':{'type':_0x4e8bda,'resourceId':_0x21cd91['id']}})['then'](function(){return _0x39c024;});})[_0xf5f2('0x27')](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x28')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x17')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x29')](_0x4ab014[_0xf5f2('0x2a')]);if(_0x4ab014[_0xf5f2('0x2b')]){delete _0x4ab014[_0xf5f2('0x2b')];}_0x281ec8[_0xf5f2('0x18')](_0x294414)[_0xf5f2('0x2c')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2d')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x30')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x31')]=_['map'](_0x5a2c7e,_0xf5f2('0x2b'));_0x11c771['query']=_[_0xf5f2('0x32')](_0x53cb96[_0xf5f2('0x33')]);_0x11c771[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x11c771[_0xf5f2('0x31')],_0x11c771[_0xf5f2('0x33')]);_0x14c829[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x11c771['model'],qs[_0xf5f2('0x37')](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x37')]));_0x14c829[_0xf5f2('0x36')]=_0x14c829[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x14c829[_0xf5f2('0x36')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x39')]('nolimit')){_0x14c829[_0xf5f2('0x1c')]=qs['limit'](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x14c829[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x33')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x34')]),_0x5a2c7e);if(_0x53cb96[_0xf5f2('0x33')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2d')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2b')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2e')]['count'](_0x4c0ac7)[_0xf5f2('0x27')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x1a')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x27')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x59eb00[_0xf5f2('0x33')]);_0x4c8d8e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x4c8d8e[_0xf5f2('0x31')],_0x4c8d8e[_0xf5f2('0x33')]);_0x2ad13c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x4c8d8e['model'],qs[_0xf5f2('0x37')](_0x59eb00['query'][_0xf5f2('0x37')]));_0x2ad13c[_0xf5f2('0x36')]=_0x2ad13c[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x2ad13c[_0xf5f2('0x36')]:_0x4c8d8e[_0xf5f2('0x31')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2e')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x27')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x27')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x48')]['id'];}return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x27')](saveUpdates(_0x33ec29[_0xf5f2('0x48')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x49')](handleError(_0x45db9a,null));};exports['create']=function(_0x740321,_0x497eb8,_0x2cbd9d){return db['sequelize'][_0xf5f2('0x4a')](function(_0xb8ea3a){if(_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4b')]==='files'){_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4c')]=path['join'](config['root'],_0xf5f2('0x4d'),_0x740321[_0xf5f2('0x48')]['name']);}return db[_0xf5f2('0x2e')][_0xf5f2('0x4e')](_0x740321[_0xf5f2('0x48')],{'transaction':_0xb8ea3a})[_0xf5f2('0x27')](function(_0x5d0db0){if(_0x740321['body'][_0xf5f2('0x4b')]===_0xf5f2('0x4f')){fs['mkdirSync'](_0x5d0db0[_0xf5f2('0x4c')],parseInt(_0xf5f2('0x50'),0x8));}var _0x255125=_0x740321[_0xf5f2('0x51')][_0xf5f2('0x24')]({'plain':!![]});if(!_0x255125)throw new Error(_0xf5f2('0x52'));if(_0x255125[_0xf5f2('0x53')]==='user'){var _0x59e8ef=_0x5d0db0[_0xf5f2('0x24')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x47')]({'where':{'name':_0xf5f2('0x25'),'userProfileId':_0x255125[_0xf5f2('0x55')]},'raw':!![]})['then'](function(_0xdb1106){if(_0xdb1106&&_0xdb1106[_0xf5f2('0x56')]===0x0){return db[_0xf5f2('0x26')]['create']({'name':_0x59e8ef[_0xf5f2('0x2b')],'resourceId':_0x59e8ef['id'],'type':_0xdb1106['name'],'sectionId':_0xdb1106['id']},{})[_0xf5f2('0x27')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x49')](function(_0x28cce5){logger[_0xf5f2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28cce5);});}return _0x5d0db0;});})['then'](respondWithResult(_0x497eb8,0xc9))[_0xf5f2('0x49')](handleError(_0x497eb8,null));};exports['destroy']=function(_0xa39c65,_0x1f1916,_0x572ec1){var _0x3f0579;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0xa39c65['params']['id']}})[_0xf5f2('0x27')](function(_0xcf7a50){if(_0xcf7a50){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x51fa7e){return _0xcf7a50[_0xf5f2('0x23')]({'transaction':_0x51fa7e,'raw':!![]})['then'](function(_0x2cbe1e){if(_0x2cbe1e[_0xf5f2('0x4c')]){fs[_0xf5f2('0x58')](_0x2cbe1e[_0xf5f2('0x4c')])[_0xf5f2('0x59')](function(_0x5583c2){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x2cbe1e[_0xf5f2('0x4c')],_0x5583c2));});fs[_0xf5f2('0x5c')](_0x2cbe1e[_0xf5f2('0x4c')]);}return _0x2cbe1e;});})['catch'](function(_0x31e16b){throw new db['Sequelize']['ValidationError'](_0x31e16b[_0xf5f2('0x5d')]);});}})['then'](handleEntityNotFound(_0x1f1916,null))[_0xf5f2('0x27')](removeEntity(_0x1f1916,null))[_0xf5f2('0x49')](handleError(_0x1f1916,null));};exports[_0xf5f2('0x5e')]=function(_0x123b93,_0x5767fc,_0x15d0c2){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x18c41f){var _0x15b680;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x123b93['params']['id']}})[_0xf5f2('0x27')](function(_0x2d171d){if(_0x2d171d){_0x15b680=_0x2d171d;return _0x2d171d[_0xf5f2('0x5e')](_0x123b93[_0xf5f2('0x48')]['id'],{'transaction':_0x18c41f});}})['then'](function(_0x1de396){if(_0x1de396){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x123b93[_0xf5f2('0x48')]['id']},'attributes':['id','name',_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})[_0xf5f2('0x27')](function(_0x146462){if(_0x146462){var _0x4bd113=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],_0xf5f2('0x64'),util[_0xf5f2('0x65')](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x146462['save_name'],path[_0xf5f2('0x68')](_0x146462[_0xf5f2('0x60')])),_0x146462['converted_format']));var _0x3f677e=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],'server/files/moh',_0x15b680['name'],util['format'](_0xf5f2('0x66'),_0x146462[_0xf5f2('0x2b')],_0x146462[_0xf5f2('0x61')]));fs[_0xf5f2('0x69')](_0x4bd113,_0x3f677e);return _0x146462;}})[_0xf5f2('0x49')](function(_0x4d878e){throw new db[(_0xf5f2('0x6a'))][(_0xf5f2('0x6b'))](_0x4d878e[_0xf5f2('0x5d')]);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x5767fc,null))[_0xf5f2('0x27')](respondWithResult(_0x5767fc,0xc9))[_0xf5f2('0x49')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x6c')]=function(_0x3cce11,_0x155f45,_0x1f35ef){return db[_0xf5f2('0x57')]['transaction'](function(_0x5e4e07){var _0x5a143f;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))[_0xf5f2('0x27')](function(_0x5c6959){if(_0x5c6959){_0x5a143f=_0x5c6959;return _0x5c6959[_0xf5f2('0x6c')](_0x3cce11[_0xf5f2('0x46')][_0xf5f2('0x6d')]);}})[_0xf5f2('0x27')](function(_0x44d119){if(_0x44d119){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id2']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})['then'](function(_0x40b36e){if(_0x40b36e){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x5a143f[_0xf5f2('0x4c')],util[_0xf5f2('0x65')]('%s.%s',_0x40b36e['name'],_0x40b36e[_0xf5f2('0x61')])));return _0x40b36e;}})[_0xf5f2('0x49')](function(_0x17eb69){throw new db[(_0xf5f2('0x6a'))]['ValidationError'](_0x17eb69['message']);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))['then'](respondWithStatusCode(_0x155f45,0xcc))['catch'](handleError(_0x155f45,null));};exports['getSounds']=function(_0x57cb18,_0xad4554,_0x543434){var _0x18eb83={};var _0x168092={};var _0x3de508;var _0x9f941e;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x57cb18[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xad4554,null))[_0xf5f2('0x27')](function(_0x2afeac){if(_0x2afeac){_0x3de508=_0x2afeac;_0x168092[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x6e')][_0xf5f2('0x2f')]);_0x168092[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x57cb18['query']);_0x168092[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],_0x168092[_0xf5f2('0x33')]);_0x18eb83[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x57cb18['query'][_0xf5f2('0x37')]));_0x18eb83['attributes']=_0x18eb83['attributes']['length']?_0x18eb83['attributes']:_0x168092['model'];_0x18eb83['order']=qs[_0xf5f2('0x3b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x3b')]);_0x18eb83[_0xf5f2('0x3c')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3d')](_0x57cb18['query'],_0x168092['filters']));if(_0x57cb18[_0xf5f2('0x33')]['filter']){_0x18eb83[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x18eb83['where'],{'$or':_['map'](_0x18eb83[_0xf5f2('0x36')],function(_0x274aa3){var _0x5a23c7={};_0x5a23c7[_0x274aa3]={'$like':'%'+_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x5a23c7;})});}_0x18eb83=_['merge']({},_0x18eb83,_0x57cb18[_0xf5f2('0x41')]);return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0x4c1678){if(_0x4c1678){_0x9f941e=_0x4c1678[_0xf5f2('0x38')];if(!_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x39')](_0xf5f2('0x70'))){_0x18eb83[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x18eb83[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1b')]);}return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0xe900ea){if(_0xe900ea){return _0xe900ea?{'count':_0x9f941e,'rows':_0xe900ea}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xad4554,null))[_0xf5f2('0x49')](handleError(_0xad4554,null));}; \ No newline at end of file +var _0x5f2f=['getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','body','catch','transaction','mode','directory','server/files/moh','create','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','ValidationError','removeSound','id2','Sound'];(function(_0x65f751,_0xe2c64d){var _0x27606d=function(_0x2d4d53){while(--_0x2d4d53){_0x65f751['push'](_0x65f751['shift']());}};_0x27606d(++_0xe2c64d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a9d8e,_0x749261){_0x4a9d8e=_0x4a9d8e-0x0;var _0x499a67=_0x5f2f[_0x4a9d8e];return _0x499a67;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');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('0xa'));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 db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){var _0x21cd91=_0x39c024[_0xf5f2('0x24')]({'plain':!![]});var _0x4e8bda=_0xf5f2('0x25');return db[_0xf5f2('0x26')]['destroy']({'where':{'type':_0x4e8bda,'resourceId':_0x21cd91['id']}})['then'](function(){return _0x39c024;});})[_0xf5f2('0x27')](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x28')]();});}};}function handleEntityNotFound(_0x1a5bb3,_0xf6c58d){return function(_0x788a8d){if(!_0x788a8d){_0x1a5bb3[_0xf5f2('0x17')](0x194);}return _0x788a8d;};}function handleError(_0x281ec8,_0x294414){_0x294414=_0x294414||0x1f4;return function(_0x4ab014){logger[_0xf5f2('0x29')](_0x4ab014[_0xf5f2('0x2a')]);if(_0x4ab014[_0xf5f2('0x2b')]){delete _0x4ab014[_0xf5f2('0x2b')];}_0x281ec8[_0xf5f2('0x18')](_0x294414)[_0xf5f2('0x2c')](_0x4ab014);};}exports['index']=function(_0x53cb96,_0x22c826){var _0x14c829={},_0x11c771={},_0x5027ab={'count':0x0,'rows':[]};var _0x5a2c7e=_[_0xf5f2('0x2d')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')],function(_0x153924){return{'name':_0x153924[_0xf5f2('0x30')],'type':_0x153924['type']['key']};});_0x11c771[_0xf5f2('0x31')]=_['map'](_0x5a2c7e,_0xf5f2('0x2b'));_0x11c771['query']=_[_0xf5f2('0x32')](_0x53cb96[_0xf5f2('0x33')]);_0x11c771[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x11c771[_0xf5f2('0x31')],_0x11c771[_0xf5f2('0x33')]);_0x14c829[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x11c771['model'],qs[_0xf5f2('0x37')](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x37')]));_0x14c829[_0xf5f2('0x36')]=_0x14c829[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x14c829[_0xf5f2('0x36')]:_0x11c771['model'];if(!_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x39')]('nolimit')){_0x14c829[_0xf5f2('0x1c')]=qs['limit'](_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x14c829[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x53cb96['query']['offset']);}_0x14c829[_0xf5f2('0x3a')]=qs[_0xf5f2('0x3b')](_0x53cb96[_0xf5f2('0x33')]['sort']);_0x14c829[_0xf5f2('0x3c')]=qs['filters'](_[_0xf5f2('0x3d')](_0x53cb96['query'],_0x11c771[_0xf5f2('0x34')]),_0x5a2c7e);if(_0x53cb96[_0xf5f2('0x33')]['filter']){_0x14c829[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x14c829[_0xf5f2('0x3c')],{'$or':_[_0xf5f2('0x2d')](_0x5a2c7e,function(_0x542cd6){if(_0x542cd6['type']!==_0xf5f2('0x3f')){var _0x140a11={};_0x140a11[_0x542cd6[_0xf5f2('0x2b')]]={'$like':'%'+_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x140a11;}})});}_0x14c829=_[_0xf5f2('0x3e')]({},_0x14c829,_0x53cb96[_0xf5f2('0x41')]);var _0x4c0ac7={'where':_0x14c829[_0xf5f2('0x3c')]};return db[_0xf5f2('0x2e')]['count'](_0x4c0ac7)[_0xf5f2('0x27')](function(_0x3f3895){_0x5027ab[_0xf5f2('0x1a')]=_0x3f3895;if(_0x53cb96[_0xf5f2('0x33')][_0xf5f2('0x42')]){_0x14c829[_0xf5f2('0x43')]=[{'all':!![]}];}return db[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0x14c829);})['then'](function(_0x31c3c){_0x5027ab[_0xf5f2('0x45')]=_0x31c3c;return _0x5027ab;})[_0xf5f2('0x27')](respondWithFilteredResult(_0x22c826,_0x14c829))['catch'](handleError(_0x22c826,null));};exports['show']=function(_0x59eb00,_0x76d21b){var _0x2ad13c={'raw':![],'where':{'id':_0x59eb00[_0xf5f2('0x46')]['id']}},_0x4c8d8e={};_0x4c8d8e[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x2e')][_0xf5f2('0x2f')]);_0x4c8d8e[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x59eb00[_0xf5f2('0x33')]);_0x4c8d8e[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x4c8d8e[_0xf5f2('0x31')],_0x4c8d8e[_0xf5f2('0x33')]);_0x2ad13c[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x4c8d8e['model'],qs[_0xf5f2('0x37')](_0x59eb00['query'][_0xf5f2('0x37')]));_0x2ad13c[_0xf5f2('0x36')]=_0x2ad13c[_0xf5f2('0x36')][_0xf5f2('0x38')]?_0x2ad13c[_0xf5f2('0x36')]:_0x4c8d8e[_0xf5f2('0x31')];if(_0x59eb00['query'][_0xf5f2('0x42')]){_0x2ad13c[_0xf5f2('0x43')]=[{'all':!![]}];}_0x2ad13c=_[_0xf5f2('0x3e')]({},_0x2ad13c,_0x59eb00[_0xf5f2('0x41')]);return db[_0xf5f2('0x2e')][_0xf5f2('0x47')](_0x2ad13c)[_0xf5f2('0x27')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x27')](respondWithResult(_0x76d21b,null))['catch'](handleError(_0x76d21b,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x48')]['id'];}return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x27')](saveUpdates(_0x33ec29[_0xf5f2('0x48')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x49')](handleError(_0x45db9a,null));};exports['create']=function(_0x740321,_0x497eb8,_0x2cbd9d){return db['sequelize'][_0xf5f2('0x4a')](function(_0xb8ea3a){if(_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4b')]==='files'){_0x740321[_0xf5f2('0x48')][_0xf5f2('0x4c')]=path['join'](config['root'],_0xf5f2('0x4d'),_0x740321[_0xf5f2('0x48')]['name']);}return db[_0xf5f2('0x2e')][_0xf5f2('0x4e')](_0x740321[_0xf5f2('0x48')],{'transaction':_0xb8ea3a})[_0xf5f2('0x27')](function(_0x5d0db0){if(_0x740321['body'][_0xf5f2('0x4b')]===_0xf5f2('0x4f')){fs['mkdirSync'](_0x5d0db0[_0xf5f2('0x4c')],parseInt(_0xf5f2('0x50'),0x8));}var _0x255125=_0x740321[_0xf5f2('0x51')][_0xf5f2('0x24')]({'plain':!![]});if(!_0x255125)throw new Error(_0xf5f2('0x52'));if(_0x255125[_0xf5f2('0x53')]==='user'){var _0x59e8ef=_0x5d0db0[_0xf5f2('0x24')]({'plain':!![]});return db[_0xf5f2('0x54')][_0xf5f2('0x47')]({'where':{'name':_0xf5f2('0x25'),'userProfileId':_0x255125[_0xf5f2('0x55')]},'raw':!![]})['then'](function(_0xdb1106){if(_0xdb1106&&_0xdb1106[_0xf5f2('0x56')]===0x0){return db[_0xf5f2('0x26')]['create']({'name':_0x59e8ef[_0xf5f2('0x2b')],'resourceId':_0x59e8ef['id'],'type':_0xdb1106['name'],'sectionId':_0xdb1106['id']},{})[_0xf5f2('0x27')](function(){return _0x5d0db0;});}else{return _0x5d0db0;}})[_0xf5f2('0x49')](function(_0x28cce5){logger[_0xf5f2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28cce5);});}return _0x5d0db0;});})['then'](respondWithResult(_0x497eb8,0xc9))[_0xf5f2('0x49')](handleError(_0x497eb8,null));};exports['destroy']=function(_0xa39c65,_0x1f1916,_0x572ec1){var _0x3f0579;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0xa39c65['params']['id']}})[_0xf5f2('0x27')](function(_0xcf7a50){if(_0xcf7a50){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x51fa7e){return _0xcf7a50[_0xf5f2('0x23')]({'transaction':_0x51fa7e,'raw':!![]})['then'](function(_0x2cbe1e){if(_0x2cbe1e[_0xf5f2('0x4c')]){fs[_0xf5f2('0x58')](_0x2cbe1e[_0xf5f2('0x4c')])[_0xf5f2('0x59')](function(_0x5583c2){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x2cbe1e[_0xf5f2('0x4c')],_0x5583c2));});fs[_0xf5f2('0x5c')](_0x2cbe1e[_0xf5f2('0x4c')]);}return _0x2cbe1e;});})['catch'](function(_0x31e16b){throw new db['Sequelize']['ValidationError'](_0x31e16b[_0xf5f2('0x5d')]);});}})['then'](handleEntityNotFound(_0x1f1916,null))[_0xf5f2('0x27')](removeEntity(_0x1f1916,null))[_0xf5f2('0x49')](handleError(_0x1f1916,null));};exports[_0xf5f2('0x5e')]=function(_0x123b93,_0x5767fc,_0x15d0c2){return db[_0xf5f2('0x57')][_0xf5f2('0x4a')](function(_0x18c41f){var _0x15b680;return db[_0xf5f2('0x2e')][_0xf5f2('0x47')]({'where':{'id':_0x123b93['params']['id']}})[_0xf5f2('0x27')](function(_0x2d171d){if(_0x2d171d){_0x15b680=_0x2d171d;return _0x2d171d[_0xf5f2('0x5e')](_0x123b93[_0xf5f2('0x48')]['id'],{'transaction':_0x18c41f});}})['then'](function(_0x1de396){if(_0x1de396){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x123b93[_0xf5f2('0x48')]['id']},'attributes':['id','name',_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})[_0xf5f2('0x27')](function(_0x146462){if(_0x146462){var _0x4bd113=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],_0xf5f2('0x64'),util[_0xf5f2('0x65')](_0xf5f2('0x66'),path[_0xf5f2('0x67')](_0x146462['save_name'],path[_0xf5f2('0x68')](_0x146462[_0xf5f2('0x60')])),_0x146462['converted_format']));var _0x3f677e=path[_0xf5f2('0x5b')](config[_0xf5f2('0x63')],'server/files/moh',_0x15b680['name'],util['format'](_0xf5f2('0x66'),_0x146462[_0xf5f2('0x2b')],_0x146462[_0xf5f2('0x61')]));fs[_0xf5f2('0x69')](_0x4bd113,_0x3f677e);return _0x146462;}})[_0xf5f2('0x49')](function(_0x4d878e){throw new db[(_0xf5f2('0x6a'))][(_0xf5f2('0x6b'))](_0x4d878e[_0xf5f2('0x5d')]);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x5767fc,null))[_0xf5f2('0x27')](respondWithResult(_0x5767fc,0xc9))[_0xf5f2('0x49')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x6c')]=function(_0x3cce11,_0x155f45,_0x1f35ef){return db[_0xf5f2('0x57')]['transaction'](function(_0x5e4e07){var _0x5a143f;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))[_0xf5f2('0x27')](function(_0x5c6959){if(_0x5c6959){_0x5a143f=_0x5c6959;return _0x5c6959[_0xf5f2('0x6c')](_0x3cce11[_0xf5f2('0x46')][_0xf5f2('0x6d')]);}})[_0xf5f2('0x27')](function(_0x44d119){if(_0x44d119){return db['Sound'][_0xf5f2('0x5f')]({'where':{'id':_0x3cce11[_0xf5f2('0x46')]['id2']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x60'),_0xf5f2('0x61'),_0xf5f2('0x62')],'raw':!![]});}})['then'](function(_0x40b36e){if(_0x40b36e){fs[_0xf5f2('0x5a')](path[_0xf5f2('0x5b')](_0x5a143f[_0xf5f2('0x4c')],util[_0xf5f2('0x65')]('%s.%s',_0x40b36e['name'],_0x40b36e[_0xf5f2('0x61')])));return _0x40b36e;}})[_0xf5f2('0x49')](function(_0x17eb69){throw new db[(_0xf5f2('0x6a'))]['ValidationError'](_0x17eb69['message']);});})[_0xf5f2('0x27')](handleEntityNotFound(_0x155f45,null))['then'](respondWithStatusCode(_0x155f45,0xcc))['catch'](handleError(_0x155f45,null));};exports['getSounds']=function(_0x57cb18,_0xad4554,_0x543434){var _0x18eb83={};var _0x168092={};var _0x3de508;var _0x9f941e;return db[_0xf5f2('0x2e')][_0xf5f2('0x5f')]({'where':{'id':_0x57cb18[_0xf5f2('0x46')]['id']}})[_0xf5f2('0x27')](handleEntityNotFound(_0xad4554,null))[_0xf5f2('0x27')](function(_0x2afeac){if(_0x2afeac){_0x3de508=_0x2afeac;_0x168092[_0xf5f2('0x31')]=_[_0xf5f2('0x32')](db[_0xf5f2('0x6e')][_0xf5f2('0x2f')]);_0x168092[_0xf5f2('0x33')]=_[_0xf5f2('0x32')](_0x57cb18['query']);_0x168092[_0xf5f2('0x34')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],_0x168092[_0xf5f2('0x33')]);_0x18eb83[_0xf5f2('0x36')]=_[_0xf5f2('0x35')](_0x168092[_0xf5f2('0x31')],qs[_0xf5f2('0x37')](_0x57cb18['query'][_0xf5f2('0x37')]));_0x18eb83['attributes']=_0x18eb83['attributes']['length']?_0x18eb83['attributes']:_0x168092['model'];_0x18eb83['order']=qs[_0xf5f2('0x3b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x3b')]);_0x18eb83[_0xf5f2('0x3c')]=qs[_0xf5f2('0x34')](_[_0xf5f2('0x3d')](_0x57cb18['query'],_0x168092['filters']));if(_0x57cb18[_0xf5f2('0x33')]['filter']){_0x18eb83[_0xf5f2('0x3c')]=_[_0xf5f2('0x3e')](_0x18eb83['where'],{'$or':_['map'](_0x18eb83[_0xf5f2('0x36')],function(_0x274aa3){var _0x5a23c7={};_0x5a23c7[_0x274aa3]={'$like':'%'+_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x40')]+'%'};return _0x5a23c7;})});}_0x18eb83=_['merge']({},_0x18eb83,_0x57cb18[_0xf5f2('0x41')]);return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0x4c1678){if(_0x4c1678){_0x9f941e=_0x4c1678[_0xf5f2('0x38')];if(!_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x39')](_0xf5f2('0x70'))){_0x18eb83[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1c')]);_0x18eb83[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x57cb18[_0xf5f2('0x33')][_0xf5f2('0x1b')]);}return _0x3de508[_0xf5f2('0x6f')](_0x18eb83);}})[_0xf5f2('0x27')](function(_0xe900ea){if(_0xe900ea){return _0xe900ea?{'count':_0x9f941e,'rows':_0xe900ea}:null;}})[_0xf5f2('0x27')](respondWithResult(_0xad4554,null))[_0xf5f2('0x49')](handleError(_0xad4554,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b78b154..a15734b 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 _0x98ba=['voice_musiconhold','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold'];(function(_0x2016d2,_0x420bf5){var _0x1e2dd9=function(_0x2d3dde){while(--_0x2d3dde){_0x2016d2['push'](_0x2016d2['shift']());}};_0x1e2dd9(++_0x420bf5);}(_0x98ba,0xb5));var _0xa98b=function(_0x56f6c4,_0xdc043c){_0x56f6c4=_0x56f6c4-0x0;var _0x2c8006=_0x98ba[_0x56f6c4];return _0x2c8006;};'use strict';var _=require(_0xa98b('0x0'));var util=require(_0xa98b('0x1'));var logger=require(_0xa98b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa98b('0x3'));var rp=require(_0xa98b('0x4'));var fs=require('fs');var path=require(_0xa98b('0x5'));var rimraf=require(_0xa98b('0x6'));var config=require(_0xa98b('0x7'));var attributes=require(_0xa98b('0x8'));module['exports']=function(_0x384567,_0x118841){return _0x384567[_0xa98b('0x9')](_0xa98b('0xa'),attributes,{'tableName':_0xa98b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9629=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold'];(function(_0x534a1b,_0x476f8a){var _0x2d797a=function(_0x22b1f1){while(--_0x22b1f1){_0x534a1b['push'](_0x534a1b['shift']());}};_0x2d797a(++_0x476f8a);}(_0x9629,0x1e0));var _0x9962=function(_0x28d34a,_0x5e9cc6){_0x28d34a=_0x28d34a-0x0;var _0x29986d=_0x9629[_0x28d34a];return _0x29986d;};'use strict';var _=require(_0x9962('0x0'));var util=require('util');var logger=require(_0x9962('0x1'))(_0x9962('0x2'));var moment=require('moment');var BPromise=require(_0x9962('0x3'));var rp=require(_0x9962('0x4'));var fs=require('fs');var path=require(_0x9962('0x5'));var rimraf=require(_0x9962('0x6'));var config=require(_0x9962('0x7'));var attributes=require(_0x9962('0x8'));module[_0x9962('0x9')]=function(_0x53e1c8,_0xf8d3fe){return _0x53e1c8[_0x9962('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0x9962('0xb'),'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 c314385..60ea63d 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 _0x0359=['../../config/environment','jayson/promise','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3a80de,_0x2369fc){var _0x430cb7=function(_0x570cae){while(--_0x570cae){_0x3a80de['push'](_0x3a80de['shift']());}};_0x430cb7(++_0x2369fc);}(_0x0359,0x176));var _0x9035=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0359[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x9035('0x0'));var util=require('util');var moment=require(_0x9035('0x1'));var BPromise=require(_0x9035('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9035('0x3'));var db=require(_0x9035('0x4'))['db'];var utils=require(_0x9035('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9035('0x6'));var jayson=require(_0x9035('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18a4a1,_0x1bb53e,_0x2eb7bf){return new BPromise(function(_0x1b7daa,_0x3ed601){return client[_0x9035('0x8')](_0x18a4a1,_0x2eb7bf)[_0x9035('0x9')](function(_0xd20d2e){logger[_0x9035('0xa')](_0x9035('0xb'),_0x1bb53e,_0x9035('0xc'));logger[_0x9035('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x1bb53e,_0x9035('0xc'),JSON[_0x9035('0xe')](_0xd20d2e));if(_0xd20d2e[_0x9035('0xf')]){if(_0xd20d2e['error'][_0x9035('0x10')]===0x1f4){logger['error'](_0x9035('0xb'),_0x1bb53e,_0xd20d2e[_0x9035('0xf')][_0x9035('0x11')]);return _0x3ed601(_0xd20d2e[_0x9035('0xf')][_0x9035('0x11')]);}logger[_0x9035('0xf')](_0x9035('0xb'),_0x1bb53e,_0xd20d2e[_0x9035('0xf')][_0x9035('0x11')]);return _0x1b7daa(_0xd20d2e[_0x9035('0xf')][_0x9035('0x11')]);}else{logger['info'](_0x9035('0xb'),_0x1bb53e,_0x9035('0xc'));_0x1b7daa(_0xd20d2e[_0x9035('0x12')][_0x9035('0x11')]);}})['catch'](function(_0x449972){logger[_0x9035('0xf')](_0x9035('0xb'),_0x1bb53e,_0x449972);_0x3ed601(_0x449972);});});} \ No newline at end of file +var _0x4116=['message','catch','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','error','code','VoiceMusicOnHold,\x20%s,\x20%s'];(function(_0x46d134,_0x209701){var _0x430d2c=function(_0x13f3c6){while(--_0x13f3c6){_0x46d134['push'](_0x46d134['shift']());}};_0x430d2c(++_0x209701);}(_0x4116,0x1cd));var _0x6411=function(_0x1121c6,_0x4b400d){_0x1121c6=_0x1121c6-0x0;var _0x207280=_0x4116[_0x1121c6];return _0x207280;};'use strict';var _=require('lodash');var util=require(_0x6411('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6411('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6411('0x2'));var logger=require(_0x6411('0x3'))(_0x6411('0x4'));var config=require(_0x6411('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6411('0x6')][_0x6411('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4622ce,_0x416247,_0x1a1743){return new BPromise(function(_0x30fa5e,_0x8de4f7){return client['request'](_0x4622ce,_0x1a1743)[_0x6411('0x8')](function(_0x1d3c2f){logger[_0x6411('0x9')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x416247,_0x6411('0xa'));logger[_0x6411('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x416247,_0x6411('0xa'),JSON['stringify'](_0x1d3c2f));if(_0x1d3c2f[_0x6411('0xc')]){if(_0x1d3c2f[_0x6411('0xc')][_0x6411('0xd')]===0x1f4){logger[_0x6411('0xc')](_0x6411('0xe'),_0x416247,_0x1d3c2f[_0x6411('0xc')][_0x6411('0xf')]);return _0x8de4f7(_0x1d3c2f[_0x6411('0xc')][_0x6411('0xf')]);}logger[_0x6411('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x416247,_0x1d3c2f['error']['message']);return _0x30fa5e(_0x1d3c2f[_0x6411('0xc')][_0x6411('0xf')]);}else{logger[_0x6411('0x9')](_0x6411('0xe'),_0x416247,'request\x20sent');_0x30fa5e(_0x1d3c2f['result']['message']);}})[_0x6411('0x10')](function(_0x2046ed){logger[_0x6411('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x416247,_0x2046ed);_0x8de4f7(_0x2046ed);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 2ef2fcf..995d341 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 _0xc42d=['./voicePrefix.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x10e0e6,_0x221f85){var _0x4764b4=function(_0x2edeae){while(--_0x2edeae){_0x10e0e6['push'](_0x10e0e6['shift']());}};_0x4764b4(++_0x221f85);}(_0xc42d,0x1dc));var _0xdc42=function(_0x1c072d,_0xa83ddf){_0x1c072d=_0x1c072d-0x0;var _0x4ad414=_0xc42d[_0x1c072d];return _0x4ad414;};'use strict';var multer=require(_0xdc42('0x0'));var util=require(_0xdc42('0x1'));var path=require(_0xdc42('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc42('0x3'));var router=express[_0xdc42('0x4')]();var auth=require(_0xdc42('0x5'));var interaction=require(_0xdc42('0x6'));var config=require('../../config/environment');var controller=require(_0xdc42('0x7'));router[_0xdc42('0x8')]('/',auth['isAuthenticated'](),controller[_0xdc42('0x9')]);router[_0xdc42('0x8')](_0xdc42('0xa'),auth['isAuthenticated'](),controller[_0xdc42('0xb')]);router['get'](_0xdc42('0xc'),auth[_0xdc42('0xd')](),controller['show']);router[_0xdc42('0x8')]('/:id/users',auth[_0xdc42('0xd')](),controller['getAgents']);router[_0xdc42('0xe')]('/',auth[_0xdc42('0xd')](),controller[_0xdc42('0xf')]);router[_0xdc42('0xe')](_0xdc42('0x10'),auth[_0xdc42('0xd')](),controller[_0xdc42('0x11')]);router[_0xdc42('0x12')](_0xdc42('0xc'),auth['isAuthenticated'](),controller[_0xdc42('0x13')]);router[_0xdc42('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xdc42('0x14')](_0xdc42('0x10'),auth[_0xdc42('0xd')](),controller[_0xdc42('0x15')]);module[_0xdc42('0x16')]=router; \ No newline at end of file +var _0x3fc6=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','index','get','/describe','describe','isAuthenticated','show','/:id/users','getAgents','post','create','addAgents','put','update','delete','/:id','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x2a62d6,_0x147991){var _0x485217=function(_0x48fea4){while(--_0x48fea4){_0x2a62d6['push'](_0x2a62d6['shift']());}};_0x485217(++_0x147991);}(_0x3fc6,0x159));var _0x63fc=function(_0x5db6ad,_0x48b71f){_0x5db6ad=_0x5db6ad-0x0;var _0x5d1265=_0x3fc6[_0x5db6ad];return _0x5d1265;};'use strict';var multer=require(_0x63fc('0x0'));var util=require(_0x63fc('0x1'));var path=require(_0x63fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x63fc('0x3'));var router=express[_0x63fc('0x4')]();var auth=require(_0x63fc('0x5'));var interaction=require(_0x63fc('0x6'));var config=require(_0x63fc('0x7'));var controller=require(_0x63fc('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x63fc('0x9')]);router[_0x63fc('0xa')](_0x63fc('0xb'),auth['isAuthenticated'](),controller[_0x63fc('0xc')]);router[_0x63fc('0xa')]('/:id',auth[_0x63fc('0xd')](),controller[_0x63fc('0xe')]);router[_0x63fc('0xa')](_0x63fc('0xf'),auth[_0x63fc('0xd')](),controller[_0x63fc('0x10')]);router[_0x63fc('0x11')]('/',auth[_0x63fc('0xd')](),controller[_0x63fc('0x12')]);router[_0x63fc('0x11')]('/:id/users',auth[_0x63fc('0xd')](),controller[_0x63fc('0x13')]);router[_0x63fc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x63fc('0x15')]);router[_0x63fc('0x16')](_0x63fc('0x17'),auth[_0x63fc('0xd')](),controller[_0x63fc('0x18')]);router[_0x63fc('0x16')]('/:id/users',auth[_0x63fc('0xd')](),controller[_0x63fc('0x19')]);module[_0x63fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 5abc330..b3e3800 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 _0x0627=['VIRTUAL','system-','getDataValue','sequelize','exports','STRING','name'];(function(_0x15f438,_0x23405b){var _0x3d7898=function(_0x32921b){while(--_0x32921b){_0x15f438['push'](_0x15f438['shift']());}};_0x3d7898(++_0x23405b);}(_0x0627,0x1d8));var _0x7062=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0627[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x7062('0x0'));module[_0x7062('0x1')]={'name':{'type':Sequelize[_0x7062('0x2')],'allowNull':![],'unique':_0x7062('0x3')},'prefix':{'type':Sequelize[_0x7062('0x4')],'get':function(_0x998438){return _0x7062('0x5')+this[_0x7062('0x6')](_0x7062('0x3'))+'-';}},'description':{'type':Sequelize[_0x7062('0x2')]},'callerIdAll':{'type':Sequelize[_0x7062('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x53d4=['VIRTUAL','system-','name','INTEGER','sequelize','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x53d4,0x178));var _0x453d=function(_0x2cc08d,_0x17ef40){_0x2cc08d=_0x2cc08d-0x0;var _0x21efe3=_0x53d4[_0x2cc08d];return _0x21efe3;};'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 diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5ed0f11..385edfd 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 _0x77fa=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','VoicePrefixes','UserProfileResource','destroy','error','stack','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','keys','filters','options','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','get','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','context','${EXTEN:','length','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','eml-format','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x77fa,0x1d4));var _0xa77f=function(_0x1b1714,_0xc45b22){_0x1b1714=_0x1b1714-0x0;var _0x376b8c=_0x77fa[_0x1b1714];return _0x376b8c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa77f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa77f('0x1'));var moment=require(_0xa77f('0x2'));var BPromise=require(_0xa77f('0x3'));var Mustache=require(_0xa77f('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa77f('0x5'));var ejs=require(_0xa77f('0x6'));var fs=require('fs');var _=require(_0xa77f('0x7'));var squel=require(_0xa77f('0x8'));var crypto=require(_0xa77f('0x9'));var jsforce=require(_0xa77f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa77f('0x5'));var querystring=require(_0xa77f('0xb'));var Papa=require('papaparse');var Redis=require(_0xa77f('0xc'));var authService=require(_0xa77f('0xd'));var qs=require(_0xa77f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa77f('0xf'));var logger=require(_0xa77f('0x10'))('api');var utils=require(_0xa77f('0x11'));var config=require(_0xa77f('0x12'));var db=require(_0xa77f('0x13'))['db'];config[_0xa77f('0x14')]=_['defaults'](config[_0xa77f('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xa77f('0x15'))(new Redis(config[_0xa77f('0x14')]));require(_0xa77f('0x16'))[_0xa77f('0x17')](socket);function respondWithStatusCode(_0x7e05f6,_0x39a64e){_0x39a64e=_0x39a64e||0xcc;return function(_0x32f4b9){if(_0x32f4b9){return _0x7e05f6[_0xa77f('0x18')](_0x39a64e);}return _0x7e05f6[_0xa77f('0x19')](_0x39a64e)[_0xa77f('0x1a')]();};}function respondWithResult(_0x124641,_0x1c062e){_0x1c062e=_0x1c062e||0xc8;return function(_0x526a9d){if(_0x526a9d){return _0x124641[_0xa77f('0x19')](_0x1c062e)['json'](_0x526a9d);}};}function respondWithFilteredResult(_0xf77d74,_0x45a2e9){return function(_0x43abe1){if(_0x43abe1){var _0x812eb1=_0x43abe1[_0xa77f('0x1b')],_0x2e6802=_0x45a2e9['offset'],_0xe3c1c3=_0x45a2e9[_0xa77f('0x1c')]+_0x45a2e9[_0xa77f('0x1d')],_0x28dd28;if(_0xe3c1c3>=_0x812eb1){_0xe3c1c3=_0x812eb1;_0x28dd28=0xc8;}else{_0x28dd28=0xce;}_0xf77d74[_0xa77f('0x19')](_0x28dd28);return _0xf77d74[_0xa77f('0x1e')](_0xa77f('0x1f'),_0x2e6802+'-'+_0xe3c1c3+'/'+_0x812eb1)[_0xa77f('0x20')](_0x43abe1);}return null;};}function patchUpdates(_0xd7a1ae){return function(_0x4a6465){try{jsonpatch[_0xa77f('0x21')](_0x4a6465,_0xd7a1ae,!![]);}catch(_0x2cee04){return BPromise['reject'](_0x2cee04);}return _0x4a6465[_0xa77f('0x22')]();};}function saveUpdates(_0xacbe5f,_0x588fa5){return function(_0x56275b){if(_0x56275b){return _0x56275b[_0xa77f('0x23')](_0xacbe5f)['then'](function(_0xe3a45){return _0xe3a45;});}return null;};}function removeEntity(_0x3f3c50,_0x59d2d3){return function(_0x5283b7){if(_0x5283b7){return _0x5283b7['destroy']()[_0xa77f('0x24')](function(){var _0x1fc94f=_0x5283b7['get']({'plain':!![]});var _0x14cb4b=_0xa77f('0x25');return db[_0xa77f('0x26')][_0xa77f('0x27')]({'where':{'type':_0x14cb4b,'resourceId':_0x1fc94f['id']}})['then'](function(){return _0x5283b7;});})[_0xa77f('0x24')](function(){_0x3f3c50['status'](0xcc)[_0xa77f('0x1a')]();});}};}function handleEntityNotFound(_0x3429cb,_0x49c9a7){return function(_0x1f9584){if(!_0x1f9584){_0x3429cb['sendStatus'](0x194);}return _0x1f9584;};}function handleError(_0x5c994c,_0x27219a){_0x27219a=_0x27219a||0x1f4;return function(_0x2c77a0){logger[_0xa77f('0x28')](_0x2c77a0[_0xa77f('0x29')]);if(_0x2c77a0['name']){delete _0x2c77a0['name'];}_0x5c994c[_0xa77f('0x19')](_0x27219a)['send'](_0x2c77a0);};}exports[_0xa77f('0x2a')]=function(_0x3a2700,_0x90fa78){var _0x3cabf6={},_0x2c6af5={},_0x580c00={'count':0x0,'rows':[]};var _0x1af0c4=_[_0xa77f('0x2b')](db[_0xa77f('0x2c')][_0xa77f('0x2d')],function(_0x20900e){return{'name':_0x20900e[_0xa77f('0x2e')],'type':_0x20900e[_0xa77f('0x2f')]['key']};});_0x2c6af5[_0xa77f('0x30')]=_[_0xa77f('0x2b')](_0x1af0c4,_0xa77f('0x31'));_0x2c6af5[_0xa77f('0x32')]=_['keys'](_0x3a2700[_0xa77f('0x32')]);_0x2c6af5['filters']=_[_0xa77f('0x33')](_0x2c6af5[_0xa77f('0x30')],_0x2c6af5[_0xa77f('0x32')]);_0x3cabf6['attributes']=_['intersection'](_0x2c6af5[_0xa77f('0x30')],qs[_0xa77f('0x34')](_0x3a2700[_0xa77f('0x32')][_0xa77f('0x34')]));_0x3cabf6[_0xa77f('0x35')]=_0x3cabf6[_0xa77f('0x35')]['length']?_0x3cabf6['attributes']:_0x2c6af5[_0xa77f('0x30')];if(!_0x3a2700['query'][_0xa77f('0x36')](_0xa77f('0x37'))){_0x3cabf6[_0xa77f('0x1d')]=qs[_0xa77f('0x1d')](_0x3a2700['query']['limit']);_0x3cabf6[_0xa77f('0x1c')]=qs[_0xa77f('0x1c')](_0x3a2700[_0xa77f('0x32')]['offset']);}_0x3cabf6[_0xa77f('0x38')]=qs[_0xa77f('0x39')](_0x3a2700[_0xa77f('0x32')][_0xa77f('0x39')]);_0x3cabf6[_0xa77f('0x3a')]=qs['filters'](_[_0xa77f('0x3b')](_0x3a2700['query'],_0x2c6af5['filters']),_0x1af0c4);if(_0x3a2700['query'][_0xa77f('0x3c')]){_0x3cabf6[_0xa77f('0x3a')]=_[_0xa77f('0x3d')](_0x3cabf6['where'],{'$or':_['map'](_0x1af0c4,function(_0x3b2ca9){if(_0x3b2ca9['type']!=='VIRTUAL'){var _0x46bb21={};_0x46bb21[_0x3b2ca9['name']]={'$like':'%'+_0x3a2700[_0xa77f('0x32')][_0xa77f('0x3c')]+'%'};return _0x46bb21;}})});}_0x3cabf6=_[_0xa77f('0x3d')]({},_0x3cabf6,_0x3a2700['options']);var _0x3fc629={'where':_0x3cabf6[_0xa77f('0x3a')]};return db[_0xa77f('0x2c')][_0xa77f('0x1b')](_0x3fc629)['then'](function(_0x51571b){_0x580c00[_0xa77f('0x1b')]=_0x51571b;if(_0x3a2700[_0xa77f('0x32')][_0xa77f('0x3e')]){_0x3cabf6[_0xa77f('0x3f')]=[{'all':!![]}];}return db[_0xa77f('0x2c')]['findAll'](_0x3cabf6);})[_0xa77f('0x24')](function(_0x1fb80b){_0x580c00[_0xa77f('0x40')]=_0x1fb80b;return _0x580c00;})[_0xa77f('0x24')](respondWithFilteredResult(_0x90fa78,_0x3cabf6))[_0xa77f('0x41')](handleError(_0x90fa78,null));};exports[_0xa77f('0x42')]=function(_0x3afb7d,_0x51c122){var _0x8fea2={'raw':![],'where':{'id':_0x3afb7d['params']['id']}},_0x2e1bfe={};_0x2e1bfe[_0xa77f('0x30')]=_[_0xa77f('0x43')](db[_0xa77f('0x2c')][_0xa77f('0x2d')]);_0x2e1bfe['query']=_[_0xa77f('0x43')](_0x3afb7d[_0xa77f('0x32')]);_0x2e1bfe[_0xa77f('0x44')]=_['intersection'](_0x2e1bfe[_0xa77f('0x30')],_0x2e1bfe['query']);_0x8fea2[_0xa77f('0x35')]=_['intersection'](_0x2e1bfe[_0xa77f('0x30')],qs[_0xa77f('0x34')](_0x3afb7d[_0xa77f('0x32')][_0xa77f('0x34')]));_0x8fea2['attributes']=_0x8fea2[_0xa77f('0x35')]['length']?_0x8fea2['attributes']:_0x2e1bfe[_0xa77f('0x30')];if(_0x3afb7d[_0xa77f('0x32')][_0xa77f('0x3e')]){_0x8fea2[_0xa77f('0x3f')]=[{'all':!![]}];}_0x8fea2=_['merge']({},_0x8fea2,_0x3afb7d[_0xa77f('0x45')]);return db[_0xa77f('0x2c')][_0xa77f('0x46')](_0x8fea2)[_0xa77f('0x24')](handleEntityNotFound(_0x51c122,null))[_0xa77f('0x24')](respondWithResult(_0x51c122,null))[_0xa77f('0x41')](handleError(_0x51c122,null));};exports[_0xa77f('0x27')]=function(_0x2cbef8,_0xfef990){return db[_0xa77f('0x2c')]['find']({'where':{'id':_0x2cbef8[_0xa77f('0x47')]['id']}})[_0xa77f('0x24')](handleEntityNotFound(_0xfef990,null))['then'](removeEntity(_0xfef990,null))['catch'](handleError(_0xfef990,null));};exports['describe']=function(_0x2aa997,_0x549c3f){return db[_0xa77f('0x2c')][_0xa77f('0x48')]()['then'](respondWithResult(_0x549c3f,null))[_0xa77f('0x41')](handleError(_0x549c3f,null));};exports[_0xa77f('0x49')]=function(_0x368837,_0x145d8c){var _0x1d84d1;return db[_0xa77f('0x4a')][_0xa77f('0x4b')](function(_0x443397){return db[_0xa77f('0x2c')][_0xa77f('0x49')](_0x368837[_0xa77f('0x4c')],{'transaction':_0x443397})[_0xa77f('0x24')](function(_0x57eeb3){_0x1d84d1=_0x57eeb3['get']({'plain':!![]});return db[_0xa77f('0x4d')]['find']({'where':{'id':_0x1d84d1[_0xa77f('0x4e')]},'raw':!![]})[_0xa77f('0x24')](function(_0x1d04e1){return createVoicePrefixExtensions(_0x1d84d1,_0x1d04e1,_0x443397);});});})[_0xa77f('0x24')](function(){var _0x386b1e=_0x368837[_0xa77f('0x4f')]['get']({'plain':!![]});if(!_0x386b1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x386b1e[_0xa77f('0x50')]==='user'){var _0x2066ca=_0x1d84d1;return db[_0xa77f('0x51')][_0xa77f('0x46')]({'where':{'name':'VoicePrefixes','userProfileId':_0x386b1e[_0xa77f('0x52')]},'raw':!![]})[_0xa77f('0x24')](function(_0x1bffbd){if(_0x1bffbd&&_0x1bffbd['autoAssociation']===0x0){return db[_0xa77f('0x26')][_0xa77f('0x49')]({'name':_0x2066ca[_0xa77f('0x31')],'resourceId':_0x2066ca['id'],'type':_0x1bffbd[_0xa77f('0x31')],'sectionId':_0x1bffbd['id']},{})[_0xa77f('0x24')](function(){return _0x1d84d1;});}else{return _0x1d84d1;}})[_0xa77f('0x41')](function(_0x18936d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18936d);throw _0x18936d;});}return _0x1d84d1;})['then'](respondWithResult(_0x145d8c,null))[_0xa77f('0x41')](handleError(_0x145d8c,null));};function Extension(_0x118590,_0x18766c,_0xa9d48b,_0x59f05b){this['context']=_0xa77f('0x53');this[_0xa77f('0x54')]=_0x118590;this[_0xa77f('0x55')]=_0xa9d48b;this[_0xa77f('0x2f')]=_0xa77f('0x56');this[_0xa77f('0x57')]=_0xa77f('0x58');this[_0xa77f('0x59')]=_0x18766c;this[_0xa77f('0x5a')]=_0x59f05b;}function createVoicePrefixExtensions(_0x3e3fce,_0x30b952,_0x229a15){return new BPromise(function(_0x2c04a6,_0x173fdc){var _0x38e85d=new Extension(formatPrefixName(_0x3e3fce[_0xa77f('0x5b')]),0x1,_0xa77f('0x5c'),_0xa77f('0x5d'));_0x38e85d[_0xa77f('0x5e')]=_0x3e3fce['id'];return db['VoiceExtension']['create'](_0x38e85d,{'transaction':_0x229a15})[_0xa77f('0x24')](function(_0x5849cb){var _0x4088f=_0x5849cb[_0xa77f('0x5f')]({'plain':!![]});var _0x2811d1=_['map'](addVoicePrefixExtensions(_0x3e3fce,_0x30b952),function(_0x3d597b){_0x3d597b[_0xa77f('0x4e')]=_0x4088f['id'];_0x3d597b['VoicePrefixId']=_0x3e3fce['id'];return _0x3d597b;});return db[_0xa77f('0x4d')][_0xa77f('0x60')](_0x2811d1,{'transaction':_0x229a15})[_0xa77f('0x24')](function(_0x34e659){if(!_0x34e659){return _0x173fdc(_0xa77f('0x61'));}else{return _0x2c04a6(_0x34e659);}})['catch'](function(_0x218022){return _0x173fdc(_0x218022);});});;});};function addVoicePrefixExtensions(_0x34049b,_0x539c8e){var _0x5f5b77=[];var _0x397e66=formatPrefixName(_0x34049b[_0xa77f('0x5b')]);_0x5f5b77[_0xa77f('0x62')](new Extension(_0x397e66,0x2,_0xa77f('0x63'),_0xa77f('0x64')+_0x34049b['name']));if(_0x34049b[_0xa77f('0x65')]){_0x5f5b77[_0xa77f('0x62')](new Extension(_0x397e66,0x3,_0xa77f('0x63'),'PREFIX-CALLERIDALL='+_0x34049b[_0xa77f('0x65')]));}else{_0x5f5b77[_0xa77f('0x62')](new Extension(_0x397e66,0x3,_0xa77f('0x5c'),_0xa77f('0x66')));}_0x5f5b77[_0xa77f('0x62')](new Extension(_0x397e66,0x4,_0xa77f('0x67'),_0x539c8e[_0xa77f('0x68')]+','+_0xa77f('0x69')+(0x8+_0x34049b[_0xa77f('0x31')][_0xa77f('0x6a')])+'}'+','+0x1));return _0x5f5b77;}function formatPrefixName(_0x30ccc4){var _0x4e3095='_';for(var _0x169c1b=0x0;_0x169c1b<_0x30ccc4[_0xa77f('0x6a')];_0x169c1b++){if(_0x30ccc4[_0xa77f('0x6b')](_0x169c1b)=='-'){_0x4e3095+=_0x30ccc4['charAt'](_0x169c1b);}else{_0x4e3095+='['+_0x30ccc4[_0xa77f('0x6b')](_0x169c1b)+']';}}_0x4e3095+='.';return _0x4e3095;}exports[_0xa77f('0x23')]=function(_0x434a8d,_0xbeb739,_0x5f4aa3){var _0x21654b=_0x434a8d[_0xa77f('0x4c')];_0x21654b[_0xa77f('0x5b')]=_0xa77f('0x6c')+_0x21654b[_0xa77f('0x31')]+'-';return db['sequelize'][_0xa77f('0x4b')](function(_0x5a9faa){return db[_0xa77f('0x2c')][_0xa77f('0x23')](_0x21654b,{'where':{'id':_0x21654b['id']},'transaction':_0x5a9faa})['then'](function(){return db[_0xa77f('0x4d')][_0xa77f('0x27')]({'where':{'VoicePrefixId':_0x21654b['id']},'transaction':_0x5a9faa})[_0xa77f('0x24')](function(){return db[_0xa77f('0x4d')][_0xa77f('0x46')]({'where':{'id':_0x21654b[_0xa77f('0x4e')]},'raw':!![]})['then'](function(_0x5684ad){return createVoicePrefixExtensions(_0x21654b,_0x5684ad,_0x5a9faa);});});});})['then'](function(){return db[_0xa77f('0x2c')][_0xa77f('0x6d')](_0x21654b['id']);})[_0xa77f('0x24')](respondWithResult(_0xbeb739,null))[_0xa77f('0x41')](handleError(_0xbeb739,null));};exports[_0xa77f('0x6e')]=function(_0x1ea145,_0x2d43fe,_0x5700c6){return db[_0xa77f('0x2c')]['find']({'where':{'id':_0x1ea145[_0xa77f('0x47')]['id']}})[_0xa77f('0x24')](handleEntityNotFound(_0x2d43fe,null))['then'](function(_0x312922){if(_0x312922){return _0x312922[_0xa77f('0x6e')](_0x1ea145['body']['ids'],_[_0xa77f('0x6f')](_0x1ea145[_0xa77f('0x4c')],[_0xa77f('0x70'),'id'])||{})[_0xa77f('0x71')](function(_0x4a8e0b){for(var _0xf5dd3b=0x0;_0xf5dd3b<_0x1ea145[_0xa77f('0x4c')][_0xa77f('0x70')][_0xa77f('0x6a')];_0xf5dd3b+=0x1){socket[_0xa77f('0x72')](_0xa77f('0x73'),{'UserId':_0x1ea145[_0xa77f('0x4c')][_0xa77f('0x70')][_0xf5dd3b],'VoicePrefixId':_0x1ea145[_0xa77f('0x47')]['id']});}return _0x4a8e0b;});}})[_0xa77f('0x24')](respondWithResult(_0x2d43fe,null))['catch'](handleError(_0x2d43fe,null));};exports['removeAgents']=function(_0xe62760,_0x20b506,_0x55b558){return db[_0xa77f('0x2c')]['find']({'where':{'id':_0xe62760[_0xa77f('0x47')]['id']}})[_0xa77f('0x24')](handleEntityNotFound(_0x20b506,null))[_0xa77f('0x24')](function(_0x566d34){if(_0x566d34){return _0x566d34[_0xa77f('0x74')](_0xe62760[_0xa77f('0x32')][_0xa77f('0x70')])[_0xa77f('0x24')](function(){if(_[_0xa77f('0x75')](_0xe62760[_0xa77f('0x32')]['ids'])){for(var _0x40763c=0x0;_0x40763c<_0xe62760[_0xa77f('0x32')]['ids'][_0xa77f('0x6a')];_0x40763c+=0x1){socket[_0xa77f('0x72')](_0xa77f('0x76'),{'UserId':Number(_0xe62760[_0xa77f('0x32')][_0xa77f('0x70')][_0x40763c]),'VoicePrefixId':Number(_0xe62760[_0xa77f('0x47')]['id'])});}}else{socket[_0xa77f('0x72')](_0xa77f('0x76'),{'UserId':Number(_0xe62760[_0xa77f('0x32')][_0xa77f('0x70')]),'VoicePrefixId':Number(_0xe62760[_0xa77f('0x47')]['id'])});}});}})[_0xa77f('0x24')](respondWithStatusCode(_0x20b506,null))[_0xa77f('0x41')](handleError(_0x20b506,null));};exports[_0xa77f('0x77')]=function(_0x3069f1,_0x2b7651,_0xfe5bf9){var _0x371289={};var _0x35fa91={};var _0x44cf17;var _0x19c62a;return db[_0xa77f('0x2c')]['findOne']({'where':{'id':_0x3069f1['params']['id']}})[_0xa77f('0x24')](handleEntityNotFound(_0x2b7651,null))[_0xa77f('0x24')](function(_0x2f4d17){if(_0x2f4d17){_0x44cf17=_0x2f4d17;_0x35fa91[_0xa77f('0x30')]=_[_0xa77f('0x43')](db['User'][_0xa77f('0x2d')]);_0x35fa91['query']=_[_0xa77f('0x43')](_0x3069f1[_0xa77f('0x32')]);_0x35fa91['filters']=_['intersection'](_0x35fa91[_0xa77f('0x30')],_0x35fa91[_0xa77f('0x32')]);_0x371289[_0xa77f('0x35')]=_[_0xa77f('0x33')](_0x35fa91[_0xa77f('0x30')],qs[_0xa77f('0x34')](_0x3069f1[_0xa77f('0x32')]['fields']));_0x371289[_0xa77f('0x35')]=_0x371289[_0xa77f('0x35')][_0xa77f('0x6a')]?_0x371289[_0xa77f('0x35')]:_0x35fa91[_0xa77f('0x30')];_0x371289[_0xa77f('0x38')]=qs[_0xa77f('0x39')](_0x3069f1[_0xa77f('0x32')][_0xa77f('0x39')]);_0x371289[_0xa77f('0x3a')]=qs[_0xa77f('0x44')](_[_0xa77f('0x3b')](_0x3069f1[_0xa77f('0x32')],_0x35fa91[_0xa77f('0x44')]));if(_0x3069f1[_0xa77f('0x32')]['filter']){_0x371289[_0xa77f('0x3a')]=_[_0xa77f('0x3d')](_0x371289[_0xa77f('0x3a')],{'$or':_[_0xa77f('0x2b')](_0x371289['attributes'],function(_0x5e0e86){var _0x28b5bc={};_0x28b5bc[_0x5e0e86]={'$like':'%'+_0x3069f1[_0xa77f('0x32')]['filter']+'%'};return _0x28b5bc;})});}_0x371289=_['merge']({},_0x371289,_0x3069f1[_0xa77f('0x45')]);return _0x44cf17[_0xa77f('0x77')](_0x371289);}})[_0xa77f('0x24')](function(_0x553178){if(_0x553178){_0x19c62a=_0x553178[_0xa77f('0x6a')];if(!_0x3069f1['query'][_0xa77f('0x36')](_0xa77f('0x37'))){_0x371289['limit']=qs[_0xa77f('0x1d')](_0x3069f1[_0xa77f('0x32')][_0xa77f('0x1d')]);_0x371289[_0xa77f('0x1c')]=qs[_0xa77f('0x1c')](_0x3069f1[_0xa77f('0x32')]['offset']);}return _0x44cf17[_0xa77f('0x77')](_0x371289);}})[_0xa77f('0x24')](function(_0x36f151){if(_0x36f151){return _0x36f151?{'count':_0x19c62a,'rows':_0x36f151}:null;}})[_0xa77f('0x24')](respondWithResult(_0x2b7651,null))['catch'](handleError(_0x2b7651,null));}; \ No newline at end of file +var _0x1ef6=['Voice\x20Prefix\x20Extension','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','charAt','system-','update','findById','addAgents','ids','omit','userVoicePrefix:save','emit','userVoicePrefix:remove','pick','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','end','json','offset','limit','status','Content-Range','apply','save','destroy','get','VoicePrefixes','then','error','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','length','include','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description'];(function(_0x242390,_0x78394b){var _0x40f7e6=function(_0x43f742){while(--_0x43f742){_0x242390['push'](_0x242390['shift']());}};_0x40f7e6(++_0x78394b);}(_0x1ef6,0x94));var _0x61ef=function(_0x3e6f1e,_0x305234){_0x3e6f1e=_0x3e6f1e-0x0;var _0x941ad1=_0x1ef6[_0x3e6f1e];return _0x941ad1;};'use strict';var pdf=require(_0x61ef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x61ef('0x1'));var zipdir=require(_0x61ef('0x2'));var jsonpatch=require(_0x61ef('0x3'));var rp=require(_0x61ef('0x4'));var moment=require(_0x61ef('0x5'));var BPromise=require(_0x61ef('0x6'));var Mustache=require(_0x61ef('0x7'));var util=require(_0x61ef('0x8'));var path=require('path');var sox=require(_0x61ef('0x9'));var csv=require(_0x61ef('0xa'));var ejs=require(_0x61ef('0xb'));var fs=require('fs');var _=require(_0x61ef('0xc'));var squel=require(_0x61ef('0xd'));var crypto=require(_0x61ef('0xe'));var jsforce=require(_0x61ef('0xf'));var deskjs=require(_0x61ef('0x10'));var toCsv=require('to-csv');var querystring=require(_0x61ef('0x11'));var Papa=require('papaparse');var Redis=require(_0x61ef('0x12'));var authService=require(_0x61ef('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x61ef('0x14'));var hardwareService=require(_0x61ef('0x15'));var logger=require(_0x61ef('0x16'))('api');var utils=require(_0x61ef('0x17'));var config=require('../../config/environment');var db=require(_0x61ef('0x18'))['db'];config[_0x61ef('0x19')]=_[_0x61ef('0x1a')](config[_0x61ef('0x19')],{'host':_0x61ef('0x1b'),'port':0x18eb});var socket=require(_0x61ef('0x1c'))(new Redis(config[_0x61ef('0x19')]));require(_0x61ef('0x1d'))['register'](socket);function respondWithStatusCode(_0x529552,_0x54868e){_0x54868e=_0x54868e||0xcc;return function(_0x59a9b6){if(_0x59a9b6){return _0x529552[_0x61ef('0x1e')](_0x54868e);}return _0x529552['status'](_0x54868e)[_0x61ef('0x1f')]();};}function respondWithResult(_0x413078,_0x51e22f){_0x51e22f=_0x51e22f||0xc8;return function(_0x739bf9){if(_0x739bf9){return _0x413078['status'](_0x51e22f)[_0x61ef('0x20')](_0x739bf9);}};}function respondWithFilteredResult(_0x5e1c42,_0x58242f){return function(_0x1e4fc5){if(_0x1e4fc5){var _0x43e824=_0x1e4fc5['count'],_0x3458ce=_0x58242f['offset'],_0x251efc=_0x58242f[_0x61ef('0x21')]+_0x58242f[_0x61ef('0x22')],_0x142c3b;if(_0x251efc>=_0x43e824){_0x251efc=_0x43e824;_0x142c3b=0xc8;}else{_0x142c3b=0xce;}_0x5e1c42[_0x61ef('0x23')](_0x142c3b);return _0x5e1c42['set'](_0x61ef('0x24'),_0x3458ce+'-'+_0x251efc+'/'+_0x43e824)[_0x61ef('0x20')](_0x1e4fc5);}return null;};}function patchUpdates(_0x471d3c){return function(_0x170e8a){try{jsonpatch[_0x61ef('0x25')](_0x170e8a,_0x471d3c,!![]);}catch(_0x236ef5){return BPromise['reject'](_0x236ef5);}return _0x170e8a[_0x61ef('0x26')]();};}function saveUpdates(_0x4ea22f,_0x29fe4f){return function(_0x2b39f3){if(_0x2b39f3){return _0x2b39f3['update'](_0x4ea22f)['then'](function(_0xd9bdab){return _0xd9bdab;});}return null;};}function removeEntity(_0x3e08b0,_0x1ef543){return function(_0x596155){if(_0x596155){return _0x596155[_0x61ef('0x27')]()['then'](function(){var _0x457625=_0x596155[_0x61ef('0x28')]({'plain':!![]});var _0x526914=_0x61ef('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x526914,'resourceId':_0x457625['id']}})[_0x61ef('0x2a')](function(){return _0x596155;});})[_0x61ef('0x2a')](function(){_0x3e08b0[_0x61ef('0x23')](0xcc)[_0x61ef('0x1f')]();});}};}function handleEntityNotFound(_0x2385a7,_0x998f95){return function(_0x5af30e){if(!_0x5af30e){_0x2385a7['sendStatus'](0x194);}return _0x5af30e;};}function handleError(_0x2c54d1,_0x5a1a49){_0x5a1a49=_0x5a1a49||0x1f4;return function(_0x3cc982){logger[_0x61ef('0x2b')](_0x3cc982['stack']);if(_0x3cc982[_0x61ef('0x2c')]){delete _0x3cc982[_0x61ef('0x2c')];}_0x2c54d1[_0x61ef('0x23')](_0x5a1a49)['send'](_0x3cc982);};}exports[_0x61ef('0x2d')]=function(_0x8b8659,_0xe5d43d){var _0x19bfa2={},_0x263981={},_0x14e895={'count':0x0,'rows':[]};var _0x2767cb=_[_0x61ef('0x2e')](db[_0x61ef('0x2f')][_0x61ef('0x30')],function(_0xebf8f){return{'name':_0xebf8f[_0x61ef('0x31')],'type':_0xebf8f[_0x61ef('0x32')][_0x61ef('0x33')]};});_0x263981[_0x61ef('0x34')]=_['map'](_0x2767cb,_0x61ef('0x2c'));_0x263981[_0x61ef('0x35')]=_[_0x61ef('0x36')](_0x8b8659[_0x61ef('0x35')]);_0x263981[_0x61ef('0x37')]=_[_0x61ef('0x38')](_0x263981[_0x61ef('0x34')],_0x263981['query']);_0x19bfa2[_0x61ef('0x39')]=_[_0x61ef('0x38')](_0x263981[_0x61ef('0x34')],qs[_0x61ef('0x3a')](_0x8b8659['query']['fields']));_0x19bfa2[_0x61ef('0x39')]=_0x19bfa2[_0x61ef('0x39')]['length']?_0x19bfa2[_0x61ef('0x39')]:_0x263981[_0x61ef('0x34')];if(!_0x8b8659[_0x61ef('0x35')][_0x61ef('0x3b')](_0x61ef('0x3c'))){_0x19bfa2[_0x61ef('0x22')]=qs['limit'](_0x8b8659[_0x61ef('0x35')]['limit']);_0x19bfa2[_0x61ef('0x21')]=qs['offset'](_0x8b8659['query'][_0x61ef('0x21')]);}_0x19bfa2['order']=qs[_0x61ef('0x3d')](_0x8b8659[_0x61ef('0x35')]['sort']);_0x19bfa2[_0x61ef('0x3e')]=qs[_0x61ef('0x37')](_['pick'](_0x8b8659['query'],_0x263981[_0x61ef('0x37')]),_0x2767cb);if(_0x8b8659[_0x61ef('0x35')][_0x61ef('0x3f')]){_0x19bfa2[_0x61ef('0x3e')]=_['merge'](_0x19bfa2['where'],{'$or':_[_0x61ef('0x2e')](_0x2767cb,function(_0x78e97d){if(_0x78e97d[_0x61ef('0x32')]!==_0x61ef('0x40')){var _0x133e98={};_0x133e98[_0x78e97d[_0x61ef('0x2c')]]={'$like':'%'+_0x8b8659[_0x61ef('0x35')][_0x61ef('0x3f')]+'%'};return _0x133e98;}})});}_0x19bfa2=_[_0x61ef('0x41')]({},_0x19bfa2,_0x8b8659[_0x61ef('0x42')]);var _0x1c9903={'where':_0x19bfa2[_0x61ef('0x3e')]};return db['VoicePrefix'][_0x61ef('0x43')](_0x1c9903)[_0x61ef('0x2a')](function(_0x5295c2){_0x14e895['count']=_0x5295c2;if(_0x8b8659['query'][_0x61ef('0x44')]){_0x19bfa2['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x61ef('0x45')](_0x19bfa2);})[_0x61ef('0x2a')](function(_0x2dd63b){_0x14e895[_0x61ef('0x46')]=_0x2dd63b;return _0x14e895;})[_0x61ef('0x2a')](respondWithFilteredResult(_0xe5d43d,_0x19bfa2))[_0x61ef('0x47')](handleError(_0xe5d43d,null));};exports[_0x61ef('0x48')]=function(_0x200568,_0x7b682b){var _0x566add={'raw':![],'where':{'id':_0x200568[_0x61ef('0x49')]['id']}},_0x548611={};_0x548611[_0x61ef('0x34')]=_[_0x61ef('0x36')](db['VoicePrefix'][_0x61ef('0x30')]);_0x548611[_0x61ef('0x35')]=_[_0x61ef('0x36')](_0x200568[_0x61ef('0x35')]);_0x548611[_0x61ef('0x37')]=_['intersection'](_0x548611[_0x61ef('0x34')],_0x548611[_0x61ef('0x35')]);_0x566add['attributes']=_['intersection'](_0x548611[_0x61ef('0x34')],qs[_0x61ef('0x3a')](_0x200568[_0x61ef('0x35')]['fields']));_0x566add[_0x61ef('0x39')]=_0x566add[_0x61ef('0x39')][_0x61ef('0x4a')]?_0x566add[_0x61ef('0x39')]:_0x548611['model'];if(_0x200568[_0x61ef('0x35')]['includeAll']){_0x566add[_0x61ef('0x4b')]=[{'all':!![]}];}_0x566add=_[_0x61ef('0x41')]({},_0x566add,_0x200568['options']);return db['VoicePrefix'][_0x61ef('0x4c')](_0x566add)[_0x61ef('0x2a')](handleEntityNotFound(_0x7b682b,null))[_0x61ef('0x2a')](respondWithResult(_0x7b682b,null))[_0x61ef('0x47')](handleError(_0x7b682b,null));};exports[_0x61ef('0x27')]=function(_0x5639d8,_0x327b92){return db[_0x61ef('0x2f')][_0x61ef('0x4c')]({'where':{'id':_0x5639d8['params']['id']}})['then'](handleEntityNotFound(_0x327b92,null))[_0x61ef('0x2a')](removeEntity(_0x327b92,null))['catch'](handleError(_0x327b92,null));};exports[_0x61ef('0x4d')]=function(_0x577a83,_0x1e23af){return db['VoicePrefix'][_0x61ef('0x4d')]()[_0x61ef('0x2a')](respondWithResult(_0x1e23af,null))[_0x61ef('0x47')](handleError(_0x1e23af,null));};exports[_0x61ef('0x4e')]=function(_0x4ff6da,_0x13a5c4){var _0x43f961;return db[_0x61ef('0x4f')][_0x61ef('0x50')](function(_0x566b23){return db[_0x61ef('0x2f')]['create'](_0x4ff6da[_0x61ef('0x51')],{'transaction':_0x566b23})['then'](function(_0x270659){_0x43f961=_0x270659[_0x61ef('0x28')]({'plain':!![]});return db[_0x61ef('0x52')]['find']({'where':{'id':_0x43f961[_0x61ef('0x53')]},'raw':!![]})['then'](function(_0x409bac){return createVoicePrefixExtensions(_0x43f961,_0x409bac,_0x566b23);});});})[_0x61ef('0x2a')](function(){var _0xd7332c=_0x4ff6da[_0x61ef('0x54')]['get']({'plain':!![]});if(!_0xd7332c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd7332c[_0x61ef('0x55')]===_0x61ef('0x54')){var _0x48d2fa=_0x43f961;return db[_0x61ef('0x56')][_0x61ef('0x4c')]({'where':{'name':'VoicePrefixes','userProfileId':_0xd7332c[_0x61ef('0x57')]},'raw':!![]})[_0x61ef('0x2a')](function(_0x2433e4){if(_0x2433e4&&_0x2433e4[_0x61ef('0x58')]===0x0){return db['UserProfileResource'][_0x61ef('0x4e')]({'name':_0x48d2fa[_0x61ef('0x2c')],'resourceId':_0x48d2fa['id'],'type':_0x2433e4['name'],'sectionId':_0x2433e4['id']},{})[_0x61ef('0x2a')](function(){return _0x43f961;});}else{return _0x43f961;}})[_0x61ef('0x47')](function(_0x29e355){logger[_0x61ef('0x2b')](_0x61ef('0x59'),_0x29e355);throw _0x29e355;});}return _0x43f961;})[_0x61ef('0x2a')](respondWithResult(_0x13a5c4,null))[_0x61ef('0x47')](handleError(_0x13a5c4,null));};function Extension(_0x154b92,_0x2e55d7,_0x5ad8c9,_0x2158f2){this[_0x61ef('0x5a')]='from-sip';this[_0x61ef('0x5b')]=_0x154b92;this[_0x61ef('0x5c')]=_0x5ad8c9;this['type']='system';this[_0x61ef('0x5d')]=_0x61ef('0x5e');this['priority']=_0x2e55d7;this[_0x61ef('0x5f')]=_0x2158f2;}function createVoicePrefixExtensions(_0x392bf6,_0x328ad9,_0x4f3f44){return new BPromise(function(_0x1ce293,_0x4d7cf9){var _0x1b10ea=new Extension(formatPrefixName(_0x392bf6[_0x61ef('0x60')]),0x1,'NoOp',_0x61ef('0x61'));_0x1b10ea[_0x61ef('0x62')]=_0x392bf6['id'];return db[_0x61ef('0x52')][_0x61ef('0x4e')](_0x1b10ea,{'transaction':_0x4f3f44})[_0x61ef('0x2a')](function(_0x17a157){var _0x5827b=_0x17a157['get']({'plain':!![]});var _0x8b3775=_['map'](addVoicePrefixExtensions(_0x392bf6,_0x328ad9),function(_0x340339){_0x340339[_0x61ef('0x53')]=_0x5827b['id'];_0x340339[_0x61ef('0x62')]=_0x392bf6['id'];return _0x340339;});return db[_0x61ef('0x52')][_0x61ef('0x63')](_0x8b3775,{'transaction':_0x4f3f44})[_0x61ef('0x2a')](function(_0x4db9e7){if(!_0x4db9e7){return _0x4d7cf9(_0x61ef('0x64'));}else{return _0x1ce293(_0x4db9e7);}})[_0x61ef('0x47')](function(_0x189140){return _0x4d7cf9(_0x189140);});});;});};function addVoicePrefixExtensions(_0x482dbe,_0x503e28){var _0x332ec6=[];var _0x4e448a=formatPrefixName(_0x482dbe[_0x61ef('0x60')]);_0x332ec6[_0x61ef('0x65')](new Extension(_0x4e448a,0x2,_0x61ef('0x66'),_0x61ef('0x67')+_0x482dbe['name']));if(_0x482dbe[_0x61ef('0x68')]){_0x332ec6[_0x61ef('0x65')](new Extension(_0x4e448a,0x3,_0x61ef('0x66'),_0x61ef('0x69')+_0x482dbe[_0x61ef('0x68')]));}else{_0x332ec6[_0x61ef('0x65')](new Extension(_0x4e448a,0x3,_0x61ef('0x6a'),_0x61ef('0x6b')));}_0x332ec6[_0x61ef('0x65')](new Extension(_0x4e448a,0x4,_0x61ef('0x6c'),_0x503e28[_0x61ef('0x5a')]+','+'${EXTEN:'+(0x8+_0x482dbe[_0x61ef('0x2c')][_0x61ef('0x4a')])+'}'+','+0x1));return _0x332ec6;}function formatPrefixName(_0x184524){var _0xd8ecdb='_';for(var _0x41dfeb=0x0;_0x41dfeb<_0x184524[_0x61ef('0x4a')];_0x41dfeb++){if(_0x184524[_0x61ef('0x6d')](_0x41dfeb)=='-'){_0xd8ecdb+=_0x184524[_0x61ef('0x6d')](_0x41dfeb);}else{_0xd8ecdb+='['+_0x184524['charAt'](_0x41dfeb)+']';}}_0xd8ecdb+='.';return _0xd8ecdb;}exports['update']=function(_0x37a74b,_0x3256b4,_0x27a33a){var _0x3c91f5=_0x37a74b[_0x61ef('0x51')];_0x3c91f5[_0x61ef('0x60')]=_0x61ef('0x6e')+_0x3c91f5[_0x61ef('0x2c')]+'-';return db[_0x61ef('0x4f')][_0x61ef('0x50')](function(_0x1ea71b){return db[_0x61ef('0x2f')][_0x61ef('0x6f')](_0x3c91f5,{'where':{'id':_0x3c91f5['id']},'transaction':_0x1ea71b})[_0x61ef('0x2a')](function(){return db[_0x61ef('0x52')]['destroy']({'where':{'VoicePrefixId':_0x3c91f5['id']},'transaction':_0x1ea71b})[_0x61ef('0x2a')](function(){return db[_0x61ef('0x52')]['find']({'where':{'id':_0x3c91f5[_0x61ef('0x53')]},'raw':!![]})['then'](function(_0x2c0f57){return createVoicePrefixExtensions(_0x3c91f5,_0x2c0f57,_0x1ea71b);});});});})[_0x61ef('0x2a')](function(){return db['VoicePrefix'][_0x61ef('0x70')](_0x3c91f5['id']);})[_0x61ef('0x2a')](respondWithResult(_0x3256b4,null))[_0x61ef('0x47')](handleError(_0x3256b4,null));};exports[_0x61ef('0x71')]=function(_0x234010,_0x1f0d8a,_0x346060){return db[_0x61ef('0x2f')][_0x61ef('0x4c')]({'where':{'id':_0x234010[_0x61ef('0x49')]['id']}})[_0x61ef('0x2a')](handleEntityNotFound(_0x1f0d8a,null))[_0x61ef('0x2a')](function(_0x34827b){if(_0x34827b){return _0x34827b[_0x61ef('0x71')](_0x234010[_0x61ef('0x51')][_0x61ef('0x72')],_[_0x61ef('0x73')](_0x234010[_0x61ef('0x51')],[_0x61ef('0x72'),'id'])||{})['spread'](function(_0x3b67b0){for(var _0x529638=0x0;_0x529638<_0x234010[_0x61ef('0x51')]['ids'][_0x61ef('0x4a')];_0x529638+=0x1){socket['emit'](_0x61ef('0x74'),{'UserId':_0x234010['body'][_0x61ef('0x72')][_0x529638],'VoicePrefixId':_0x234010[_0x61ef('0x49')]['id']});}return _0x3b67b0;});}})[_0x61ef('0x2a')](respondWithResult(_0x1f0d8a,null))[_0x61ef('0x47')](handleError(_0x1f0d8a,null));};exports['removeAgents']=function(_0x22532e,_0x8b9d5c,_0x460a72){return db[_0x61ef('0x2f')]['find']({'where':{'id':_0x22532e[_0x61ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x8b9d5c,null))[_0x61ef('0x2a')](function(_0x193187){if(_0x193187){return _0x193187['removeAgents'](_0x22532e[_0x61ef('0x35')][_0x61ef('0x72')])[_0x61ef('0x2a')](function(){if(_['isArray'](_0x22532e[_0x61ef('0x35')]['ids'])){for(var _0x38cac2=0x0;_0x38cac2<_0x22532e[_0x61ef('0x35')][_0x61ef('0x72')][_0x61ef('0x4a')];_0x38cac2+=0x1){socket[_0x61ef('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x22532e[_0x61ef('0x35')][_0x61ef('0x72')][_0x38cac2]),'VoicePrefixId':Number(_0x22532e[_0x61ef('0x49')]['id'])});}}else{socket['emit'](_0x61ef('0x76'),{'UserId':Number(_0x22532e[_0x61ef('0x35')]['ids']),'VoicePrefixId':Number(_0x22532e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x8b9d5c,null))[_0x61ef('0x47')](handleError(_0x8b9d5c,null));};exports['getAgents']=function(_0x2143a8,_0x4df56d,_0x40f9bf){var _0x567890={};var _0x1b09bc={};var _0xcf8b8;var _0x324943;return db[_0x61ef('0x2f')]['findOne']({'where':{'id':_0x2143a8[_0x61ef('0x49')]['id']}})[_0x61ef('0x2a')](handleEntityNotFound(_0x4df56d,null))[_0x61ef('0x2a')](function(_0x22e3d1){if(_0x22e3d1){_0xcf8b8=_0x22e3d1;_0x1b09bc[_0x61ef('0x34')]=_[_0x61ef('0x36')](db['User'][_0x61ef('0x30')]);_0x1b09bc['query']=_[_0x61ef('0x36')](_0x2143a8[_0x61ef('0x35')]);_0x1b09bc[_0x61ef('0x37')]=_[_0x61ef('0x38')](_0x1b09bc[_0x61ef('0x34')],_0x1b09bc[_0x61ef('0x35')]);_0x567890[_0x61ef('0x39')]=_['intersection'](_0x1b09bc[_0x61ef('0x34')],qs[_0x61ef('0x3a')](_0x2143a8['query']['fields']));_0x567890[_0x61ef('0x39')]=_0x567890[_0x61ef('0x39')][_0x61ef('0x4a')]?_0x567890[_0x61ef('0x39')]:_0x1b09bc[_0x61ef('0x34')];_0x567890['order']=qs[_0x61ef('0x3d')](_0x2143a8['query'][_0x61ef('0x3d')]);_0x567890[_0x61ef('0x3e')]=qs[_0x61ef('0x37')](_[_0x61ef('0x77')](_0x2143a8[_0x61ef('0x35')],_0x1b09bc[_0x61ef('0x37')]));if(_0x2143a8['query'][_0x61ef('0x3f')]){_0x567890['where']=_['merge'](_0x567890[_0x61ef('0x3e')],{'$or':_[_0x61ef('0x2e')](_0x567890[_0x61ef('0x39')],function(_0x41c2ae){var _0x302bc4={};_0x302bc4[_0x41c2ae]={'$like':'%'+_0x2143a8[_0x61ef('0x35')][_0x61ef('0x3f')]+'%'};return _0x302bc4;})});}_0x567890=_[_0x61ef('0x41')]({},_0x567890,_0x2143a8[_0x61ef('0x42')]);return _0xcf8b8['getAgents'](_0x567890);}})[_0x61ef('0x2a')](function(_0x286820){if(_0x286820){_0x324943=_0x286820['length'];if(!_0x2143a8[_0x61ef('0x35')]['hasOwnProperty']('nolimit')){_0x567890[_0x61ef('0x22')]=qs['limit'](_0x2143a8['query'][_0x61ef('0x22')]);_0x567890[_0x61ef('0x21')]=qs[_0x61ef('0x21')](_0x2143a8[_0x61ef('0x35')][_0x61ef('0x21')]);}return _0xcf8b8[_0x61ef('0x78')](_0x567890);}})[_0x61ef('0x2a')](function(_0x235a0a){if(_0x235a0a){return _0x235a0a?{'count':_0x324943,'rows':_0x235a0a}:null;}})[_0x61ef('0x2a')](respondWithResult(_0x4df56d,null))[_0x61ef('0x47')](handleError(_0x4df56d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7603b60..2fef58a 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x851805,_0x4e412a){var _0x42c031=function(_0x5dc17c){while(--_0x5dc17c){_0x851805['push'](_0x851805['shift']());}};_0x42c031(++_0x4e412a);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x12af8d,_0x3b774c){var _0x5185bf=function(_0x54e677){while(--_0x54e677){_0x12af8d['push'](_0x12af8d['shift']());}};_0x5185bf(++_0x3b774c);}(_0x70e0,0x17b));var _0x070e=function(_0x46c27e,_0x5c7fdb){_0x46c27e=_0x46c27e-0x0;var _0x40ac26=_0x70e0[_0x46c27e];return _0x40ac26;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 5a97fbb..4dbd112 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 _0xb72e=['../../config/logger','api','moment','bluebird','path','../../config/environment','./voicePrefix.attributes','lodash','util'];(function(_0x4cae46,_0x3c9f37){var _0x4f6195=function(_0x2ae661){while(--_0x2ae661){_0x4cae46['push'](_0x4cae46['shift']());}};_0x4f6195(++_0x3c9f37);}(_0xb72e,0x15d));var _0xeb72=function(_0x302adf,_0x20c325){_0x302adf=_0x302adf-0x0;var _0x1ce93c=_0xb72e[_0x302adf];return _0x1ce93c;};'use strict';var _=require(_0xeb72('0x0'));var util=require(_0xeb72('0x1'));var logger=require(_0xeb72('0x2'))(_0xeb72('0x3'));var moment=require(_0xeb72('0x4'));var BPromise=require(_0xeb72('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb72('0x6'));var rimraf=require('rimraf');var config=require(_0xeb72('0x7'));var attributes=require(_0xeb72('0x8'));module['exports']=function(_0x4ad683,_0xda76aa){return _0x4ad683['define']('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0400=['exports','voice_prefixes','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1346f2,_0x38f203){var _0x1769d2=function(_0x47a9f6){while(--_0x47a9f6){_0x1346f2['push'](_0x1346f2['shift']());}};_0x1769d2(++_0x38f203);}(_0x0400,0xd1));var _0x0040=function(_0x4dc8c6,_0x3fba52){_0x4dc8c6=_0x4dc8c6-0x0;var _0x69ce1d=_0x0400[_0x4dc8c6];return _0x69ce1d;};'use strict';var _=require(_0x0040('0x0'));var util=require('util');var logger=require(_0x0040('0x1'))('api');var moment=require(_0x0040('0x2'));var BPromise=require(_0x0040('0x3'));var rp=require(_0x0040('0x4'));var fs=require('fs');var path=require(_0x0040('0x5'));var rimraf=require('rimraf');var config=require(_0x0040('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x0040('0x7')]=function(_0x429800,_0x2f26f1){return _0x429800['define']('VoicePrefix',attributes,{'tableName':_0x0040('0x8'),'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 018099a..1863524 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 _0xb198=['client','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x2e069d,_0x2044b2){var _0x58f48c=function(_0x548e76){while(--_0x548e76){_0x2e069d['push'](_0x2e069d['shift']());}};_0x58f48c(++_0x2044b2);}(_0xb198,0x14a));var _0x8b19=function(_0x1ade82,_0x2d5424){_0x1ade82=_0x1ade82-0x0;var _0x4c60d5=_0xb198[_0x1ade82];return _0x4c60d5;};'use strict';var _=require(_0x8b19('0x0'));var util=require('util');var moment=require(_0x8b19('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b19('0x2'));var db=require(_0x8b19('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b19('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b19('0x5'));var client=jayson[_0x8b19('0x6')]['http']({'port':0x232a});config[_0x8b19('0x7')]=_['defaults'](config[_0x8b19('0x7')],{'host':_0x8b19('0x8'),'port':0x18eb});var socket=require(_0x8b19('0x9'))(new Redis(config[_0x8b19('0x7')]));require(_0x8b19('0xa'))[_0x8b19('0xb')](socket);function respondWithRpcPromise(_0x29956a,_0x2a5628,_0x40546e){return new BPromise(function(_0x67cf0e,_0xfb7deb){return client['request'](_0x29956a,_0x40546e)[_0x8b19('0xc')](function(_0x63caa1){logger[_0x8b19('0xd')](_0x8b19('0xe'),_0x2a5628,_0x8b19('0xf'));logger[_0x8b19('0x10')](_0x8b19('0x11'),_0x2a5628,_0x8b19('0xf'),JSON[_0x8b19('0x12')](_0x63caa1));if(_0x63caa1[_0x8b19('0x13')]){if(_0x63caa1[_0x8b19('0x13')][_0x8b19('0x14')]===0x1f4){logger[_0x8b19('0x13')](_0x8b19('0xe'),_0x2a5628,_0x63caa1[_0x8b19('0x13')][_0x8b19('0x15')]);return _0xfb7deb(_0x63caa1[_0x8b19('0x13')][_0x8b19('0x15')]);}logger[_0x8b19('0x13')](_0x8b19('0xe'),_0x2a5628,_0x63caa1['error'][_0x8b19('0x15')]);return _0x67cf0e(_0x63caa1[_0x8b19('0x13')][_0x8b19('0x15')]);}else{logger[_0x8b19('0xd')]('VoicePrefix,\x20%s,\x20%s',_0x2a5628,_0x8b19('0xf'));_0x67cf0e(_0x63caa1[_0x8b19('0x16')][_0x8b19('0x15')]);}})[_0x8b19('0x17')](function(_0xbd2780){logger['error'](_0x8b19('0xe'),_0x2a5628,_0xbd2780);_0xfb7deb(_0xbd2780);});});} \ No newline at end of file +var _0x0442=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','redis','defaults','localhost','./voicePrefix.socket','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s'];(function(_0x3de8d5,_0x305d33){var _0x42a663=function(_0x40dab3){while(--_0x40dab3){_0x3de8d5['push'](_0x3de8d5['shift']());}};_0x42a663(++_0x305d33);}(_0x0442,0x1a0));var _0x2044=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x0442[_0x307086];return _0x699043;};'use strict';var _=require(_0x2044('0x0'));var util=require(_0x2044('0x1'));var moment=require('moment');var BPromise=require(_0x2044('0x2'));var rs=require(_0x2044('0x3'));var fs=require('fs');var Redis=require(_0x2044('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2044('0x5'))('rpc');var config=require(_0x2044('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2044('0x7')]['http']({'port':0x232a});config[_0x2044('0x8')]=_[_0x2044('0x9')](config[_0x2044('0x8')],{'host':_0x2044('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2044('0x8')]));require(_0x2044('0xb'))['register'](socket);function respondWithRpcPromise(_0x39ffb2,_0x49df09,_0x54ad9d){return new BPromise(function(_0x2a8c1e,_0x19efd7){return client[_0x2044('0xc')](_0x39ffb2,_0x54ad9d)[_0x2044('0xd')](function(_0x1f32cf){logger[_0x2044('0xe')]('VoicePrefix,\x20%s,\x20%s',_0x49df09,_0x2044('0xf'));logger[_0x2044('0x10')](_0x2044('0x11'),_0x49df09,_0x2044('0xf'),JSON[_0x2044('0x12')](_0x1f32cf));if(_0x1f32cf['error']){if(_0x1f32cf[_0x2044('0x13')]['code']===0x1f4){logger[_0x2044('0x13')](_0x2044('0x14'),_0x49df09,_0x1f32cf['error'][_0x2044('0x15')]);return _0x19efd7(_0x1f32cf['error']['message']);}logger['error'](_0x2044('0x14'),_0x49df09,_0x1f32cf[_0x2044('0x13')][_0x2044('0x15')]);return _0x2a8c1e(_0x1f32cf[_0x2044('0x13')][_0x2044('0x15')]);}else{logger[_0x2044('0xe')]('VoicePrefix,\x20%s,\x20%s',_0x49df09,_0x2044('0xf'));_0x2a8c1e(_0x1f32cf['result'][_0x2044('0x15')]);}})[_0x2044('0x16')](function(_0x2cf28d){logger[_0x2044('0x13')](_0x2044('0x14'),_0x49df09,_0x2cf28d);_0x19efd7(_0x2cf28d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f8728bd..5988360 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 _0x4cd5=['removeListener','register','length','voicePrefix:','save','update','emit'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4cd5,0x146));var _0x54cd=function(_0x577298,_0x351f89){_0x577298=_0x577298-0x0;var _0x42c0b0=_0x4cd5[_0x577298];return _0x42c0b0;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x54cd('0x0'),'remove',_0x54cd('0x1')];function createListener(_0x3fd4a7,_0x41e334){return function(_0x729d27){_0x41e334[_0x54cd('0x2')](_0x3fd4a7,_0x729d27);};}function removeListener(_0x5a0f9a,_0x3b4938){return function(){VoicePrefixEvents[_0x54cd('0x3')](_0x5a0f9a,_0x3b4938);};}exports[_0x54cd('0x4')]=function(_0x527acf){for(var _0x333e9a=0x0,_0x3c58e1=events[_0x54cd('0x5')];_0x333e9a<_0x3c58e1;_0x333e9a++){var _0xaaa8de=events[_0x333e9a];var _0x504ec2=createListener(_0x54cd('0x6')+_0xaaa8de,_0x527acf);VoicePrefixEvents['on'](_0xaaa8de,_0x504ec2);}}; \ No newline at end of file +var _0xcb96=['save','remove','emit','removeListener','length','./voicePrefix.events'];(function(_0x1ef2af,_0x1b42a5){var _0x14dc93=function(_0x853bdc){while(--_0x853bdc){_0x1ef2af['push'](_0x1ef2af['shift']());}};_0x14dc93(++_0x1b42a5);}(_0xcb96,0xb9));var _0x6cb9=function(_0xca21f7,_0x58a059){_0xca21f7=_0xca21f7-0x0;var _0x4ac678=_0xcb96[_0xca21f7];return _0x4ac678;};'use strict';var VoicePrefixEvents=require(_0x6cb9('0x0'));var events=[_0x6cb9('0x1'),_0x6cb9('0x2'),'update'];function createListener(_0x2db808,_0xe81f23){return function(_0xabdc9e){_0xe81f23[_0x6cb9('0x3')](_0x2db808,_0xabdc9e);};}function removeListener(_0x4073ea,_0x3927a7){return function(){VoicePrefixEvents[_0x6cb9('0x4')](_0x4073ea,_0x3927a7);};}exports['register']=function(_0x1fe52e){for(var _0x258a1e=0x0,_0x4de597=events[_0x6cb9('0x5')];_0x258a1e<_0x4de597;_0x258a1e++){var _0x56e020=events[_0x258a1e];var _0xf5efc=createListener('voicePrefix:'+_0x56e020,_0x1fe52e);VoicePrefixEvents['on'](_0x56e020,_0xf5efc);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 0cc377f..72c7113 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 _0x9b7a=['getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','/:id/lists','put','update','delete','destroy','removeTeams','removeAgents','removeBlackLists','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','/:id','show','get','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/teams','/:id/users','getAgents'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0x9b7a,0xcb));var _0xa9b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9b7a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa9b7('0x0'));var util=require('util');var path=require(_0xa9b7('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9b7('0x2'));var router=express['Router']();var auth=require(_0xa9b7('0x3'));var interaction=require(_0xa9b7('0x4'));var config=require(_0xa9b7('0x5'));var controller=require(_0xa9b7('0x6'));router['get']('/',auth[_0xa9b7('0x7')](),controller['index']);router['get'](_0xa9b7('0x8'),auth['isAuthenticated'](),controller[_0xa9b7('0x9')]);router[_0xa9b7('0xa')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xa9b7('0xb')]);router[_0xa9b7('0xa')]('/:id/hopper_histories',auth[_0xa9b7('0x7')](),controller[_0xa9b7('0xc')]);router['get'](_0xa9b7('0xd'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0xe')]);router[_0xa9b7('0xa')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xa9b7('0xf')]);router[_0xa9b7('0xa')](_0xa9b7('0x10'),auth[_0xa9b7('0x7')](),controller['getTeams']);router[_0xa9b7('0xa')](_0xa9b7('0x11'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x12')]);router[_0xa9b7('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xa9b7('0xa')]('/:id/lists',auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x13')]);router[_0xa9b7('0xa')](_0xa9b7('0x14'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x15')]);router[_0xa9b7('0x16')]('/',auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x17')]);router[_0xa9b7('0x16')](_0xa9b7('0x18'),auth['isAuthenticated'](),controller[_0xa9b7('0x19')]);router['post'](_0xa9b7('0x10'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x1a')]);router['post'](_0xa9b7('0x11'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x1b')]);router[_0xa9b7('0x16')](_0xa9b7('0x1c'),auth[_0xa9b7('0x7')](),controller['addLists']);router[_0xa9b7('0x16')]('/:id/blacklists',auth[_0xa9b7('0x7')](),controller['addBlackLists']);router[_0xa9b7('0x1d')](_0xa9b7('0x8'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x1e')]);router[_0xa9b7('0x1f')](_0xa9b7('0x8'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x20')]);router[_0xa9b7('0x1f')](_0xa9b7('0x10'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x21')]);router[_0xa9b7('0x1f')](_0xa9b7('0x11'),auth[_0xa9b7('0x7')](),controller[_0xa9b7('0x22')]);router['delete']('/:id/lists',auth[_0xa9b7('0x7')](),controller['removeLists']);router['delete'](_0xa9b7('0x14'),auth['isAuthenticated'](),controller[_0xa9b7('0x23')]);module[_0xa9b7('0x24')]=router; \ No newline at end of file +var _0x07b0=['removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists','post','create','clone','/:id/users','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents'];(function(_0xe8ddff,_0x1b3f99){var _0x1bae15=function(_0x8263a2){while(--_0x8263a2){_0xe8ddff['push'](_0xe8ddff['shift']());}};_0x1bae15(++_0x1b3f99);}(_0x07b0,0x8c));var _0x007b=function(_0x55eb16,_0x5960f8){_0x55eb16=_0x55eb16-0x0;var _0xaca526=_0x07b0[_0x55eb16];return _0xaca526;};'use strict';var multer=require(_0x007b('0x0'));var util=require(_0x007b('0x1'));var path=require(_0x007b('0x2'));var timeout=require(_0x007b('0x3'));var express=require(_0x007b('0x4'));var router=express[_0x007b('0x5')]();var auth=require(_0x007b('0x6'));var interaction=require(_0x007b('0x7'));var config=require(_0x007b('0x8'));var controller=require(_0x007b('0x9'));router[_0x007b('0xa')]('/',auth['isAuthenticated'](),controller[_0x007b('0xb')]);router[_0x007b('0xa')](_0x007b('0xc'),auth[_0x007b('0xd')](),controller[_0x007b('0xe')]);router[_0x007b('0xa')](_0x007b('0xf'),auth['isAuthenticated'](),controller[_0x007b('0x10')]);router['get'](_0x007b('0x11'),auth[_0x007b('0xd')](),controller[_0x007b('0x12')]);router[_0x007b('0xa')](_0x007b('0x13'),auth[_0x007b('0xd')](),controller[_0x007b('0x14')]);router['get'](_0x007b('0x15'),auth[_0x007b('0xd')](),controller['getHopperBlacks']);router[_0x007b('0xa')](_0x007b('0x16'),auth[_0x007b('0xd')](),controller[_0x007b('0x17')]);router[_0x007b('0xa')]('/:id/users',auth[_0x007b('0xd')](),controller[_0x007b('0x18')]);router[_0x007b('0xa')](_0x007b('0x19'),auth['isAuthenticated'](),controller[_0x007b('0x1a')]);router['get']('/:id/lists',auth[_0x007b('0xd')](),controller[_0x007b('0x1b')]);router[_0x007b('0xa')](_0x007b('0x1c'),auth['isAuthenticated'](),controller[_0x007b('0x1d')]);router[_0x007b('0x1e')]('/',auth[_0x007b('0xd')](),controller[_0x007b('0x1f')]);router[_0x007b('0x1e')]('/:id/clone',auth['isAuthenticated'](),controller[_0x007b('0x20')]);router[_0x007b('0x1e')](_0x007b('0x16'),auth['isAuthenticated'](),controller['addTeams']);router[_0x007b('0x1e')](_0x007b('0x21'),auth[_0x007b('0xd')](),controller[_0x007b('0x22')]);router[_0x007b('0x1e')](_0x007b('0x23'),auth[_0x007b('0xd')](),controller[_0x007b('0x24')]);router['post'](_0x007b('0x1c'),auth[_0x007b('0xd')](),controller[_0x007b('0x25')]);router[_0x007b('0x26')](_0x007b('0xc'),auth[_0x007b('0xd')](),controller[_0x007b('0x27')]);router[_0x007b('0x28')](_0x007b('0xc'),auth[_0x007b('0xd')](),controller[_0x007b('0x29')]);router[_0x007b('0x28')]('/:id/teams',auth[_0x007b('0xd')](),controller[_0x007b('0x2a')]);router[_0x007b('0x28')](_0x007b('0x21'),auth['isAuthenticated'](),controller[_0x007b('0x2b')]);router[_0x007b('0x28')]('/:id/lists',auth['isAuthenticated'](),controller[_0x007b('0x2c')]);router[_0x007b('0x28')](_0x007b('0x1c'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x007b('0x2d')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 5c39b49..ce7d836 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(_0x2e5c0a,_0x1f96b6){var _0x2e6fbb=function(_0x54d6f4){while(--_0x54d6f4){_0x2e5c0a['push'](_0x2e5c0a['shift']());}};_0x2e6fbb(++_0x1f96b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x2bebb2,_0x321313){var _0x277503=function(_0x15c37e){while(--_0x15c37e){_0x2bebb2['push'](_0x2bebb2['shift']());}};_0x277503(++_0x321313);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 3cd4137..b69ef12 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 _0x3a79=['role','user','UserProfileSection','userProfileId','autoAssociation','clone','updatedAt','omit','body','createdAt','inbound','QueueCampaigns','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','phone','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','then','destroy','get','VoiceQueues','outbound','filter','ignore','map','value','type','UserProfileResource','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','count','includeAll','findAll','catch','show','params','length','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x3a79,0x69));var _0x93a7=function(_0x5569d5,_0x19a957){_0x5569d5=_0x5569d5-0x0;var _0x5d1a59=_0x3a79[_0x5569d5];return _0x5d1a59;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x93a7('0x0'));var zipdir=require(_0x93a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x93a7('0x2'));var BPromise=require(_0x93a7('0x3'));var Mustache=require(_0x93a7('0x4'));var util=require(_0x93a7('0x5'));var path=require(_0x93a7('0x6'));var sox=require(_0x93a7('0x7'));var csv=require('to-csv');var ejs=require(_0x93a7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x93a7('0x9'));var crypto=require(_0x93a7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x93a7('0xb'));var toCsv=require(_0x93a7('0xc'));var querystring=require('querystring');var Papa=require(_0x93a7('0xd'));var Redis=require('ioredis');var authService=require(_0x93a7('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x93a7('0xf'))(_0x93a7('0x10'));var utils=require(_0x93a7('0x11'));var config=require('../../config/environment');var db=require(_0x93a7('0x12'))['db'];config[_0x93a7('0x13')]=_['defaults'](config['redis'],{'host':_0x93a7('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93a7('0x13')]));require('./voiceQueue.socket')[_0x93a7('0x15')](socket);function respondWithStatusCode(_0x2fbf94,_0x39d65a){_0x39d65a=_0x39d65a||0xcc;return function(_0x4ebf7d){if(_0x4ebf7d){return _0x2fbf94[_0x93a7('0x16')](_0x39d65a);}return _0x2fbf94['status'](_0x39d65a)[_0x93a7('0x17')]();};}function respondWithResult(_0x105ef0,_0x5620dc){_0x5620dc=_0x5620dc||0xc8;return function(_0xbdeb2e){if(_0xbdeb2e){return _0x105ef0[_0x93a7('0x18')](_0x5620dc)[_0x93a7('0x19')](_0xbdeb2e);}};}function respondWithFilteredResult(_0x205c0d,_0x31e3e4){return function(_0x301f8d){if(_0x301f8d){var _0x1d5dca=_0x301f8d['count'],_0x1342f0=_0x31e3e4['offset'],_0x5b4e5a=_0x31e3e4[_0x93a7('0x1a')]+_0x31e3e4[_0x93a7('0x1b')],_0x205633;if(_0x5b4e5a>=_0x1d5dca){_0x5b4e5a=_0x1d5dca;_0x205633=0xc8;}else{_0x205633=0xce;}_0x205c0d[_0x93a7('0x18')](_0x205633);return _0x205c0d[_0x93a7('0x1c')](_0x93a7('0x1d'),_0x1342f0+'-'+_0x5b4e5a+'/'+_0x1d5dca)[_0x93a7('0x19')](_0x301f8d);}return null;};}function patchUpdates(_0x5d48f8){return function(_0xfcc4bb){try{jsonpatch[_0x93a7('0x1e')](_0xfcc4bb,_0x5d48f8,!![]);}catch(_0x7c1184){return BPromise['reject'](_0x7c1184);}return _0xfcc4bb['save']();};}function saveUpdates(_0xcd7925,_0x2cc9e2){return function(_0x55f3e4){if(_0x55f3e4){return _0x55f3e4['update'](_0xcd7925)[_0x93a7('0x1f')](function(_0x4bcb4a){return _0x4bcb4a;});}return null;};}function removeEntity(_0x28dbd7,_0x29d247){return function(_0x17e960){if(_0x17e960){return _0x17e960[_0x93a7('0x20')]()[_0x93a7('0x1f')](function(){var _0x47179f=_0x17e960[_0x93a7('0x21')]({'plain':!![]});var _0x2843ab=[{'name':_0x93a7('0x22'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x93a7('0x23'),'ignore':![]}];var _0x41aeb0=_(_0x2843ab)[_0x93a7('0x24')](_0x93a7('0x25'))[_0x93a7('0x26')](_0x93a7('0x27'))[_0x93a7('0x27')]();if(_['includes'](_0x41aeb0,_0x47179f[_0x93a7('0x28')])){return;}var _0x9db761=_['find'](_0x2843ab,[_0x93a7('0x27'),_0x47179f['type']])['name'];return db[_0x93a7('0x29')][_0x93a7('0x20')]({'where':{'type':_0x9db761,'resourceId':_0x47179f['id']}})[_0x93a7('0x1f')](function(){return _0x17e960;});})[_0x93a7('0x1f')](function(){_0x28dbd7[_0x93a7('0x18')](0xcc)[_0x93a7('0x17')]();});}};}function handleEntityNotFound(_0x131cfa,_0x423646){return function(_0x2f4253){if(!_0x2f4253){_0x131cfa[_0x93a7('0x16')](0x194);}return _0x2f4253;};}function handleError(_0x48d7c5,_0x49fbf4){_0x49fbf4=_0x49fbf4||0x1f4;return function(_0x14bf33){logger[_0x93a7('0x2a')](_0x14bf33[_0x93a7('0x2b')]);if(_0x14bf33['name']){delete _0x14bf33[_0x93a7('0x2c')];}_0x48d7c5[_0x93a7('0x18')](_0x49fbf4)[_0x93a7('0x2d')](_0x14bf33);};}exports[_0x93a7('0x2e')]=function(_0x374119,_0x2c6b18){var _0x3b6a01={},_0x3355a9={},_0x37f7f0={'count':0x0,'rows':[]};var _0x9d6e29=_[_0x93a7('0x26')](db[_0x93a7('0x2f')][_0x93a7('0x30')],function(_0x126228){return{'name':_0x126228[_0x93a7('0x31')],'type':_0x126228[_0x93a7('0x28')]['key']};});_0x3355a9[_0x93a7('0x32')]=_['map'](_0x9d6e29,_0x93a7('0x2c'));_0x3355a9['query']=_[_0x93a7('0x33')](_0x374119[_0x93a7('0x34')]);_0x3355a9[_0x93a7('0x35')]=_[_0x93a7('0x36')](_0x3355a9[_0x93a7('0x32')],_0x3355a9['query']);_0x3b6a01[_0x93a7('0x37')]=_['intersection'](_0x3355a9[_0x93a7('0x32')],qs['fields'](_0x374119[_0x93a7('0x34')][_0x93a7('0x38')]));_0x3b6a01['attributes']=_0x3b6a01[_0x93a7('0x37')]['length']?_0x3b6a01[_0x93a7('0x37')]:_0x3355a9[_0x93a7('0x32')];if(!_0x374119[_0x93a7('0x34')][_0x93a7('0x39')](_0x93a7('0x3a'))){_0x3b6a01['limit']=qs[_0x93a7('0x1b')](_0x374119[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x3b6a01['offset']=qs[_0x93a7('0x1a')](_0x374119[_0x93a7('0x34')]['offset']);}_0x3b6a01[_0x93a7('0x3b')]=qs[_0x93a7('0x3c')](_0x374119[_0x93a7('0x34')][_0x93a7('0x3c')]);_0x3b6a01[_0x93a7('0x3d')]=qs[_0x93a7('0x35')](_['pick'](_0x374119[_0x93a7('0x34')],_0x3355a9[_0x93a7('0x35')]),_0x9d6e29);if(_0x374119[_0x93a7('0x34')]['filter']){_0x3b6a01[_0x93a7('0x3d')]=_['merge'](_0x3b6a01[_0x93a7('0x3d')],{'$or':_[_0x93a7('0x26')](_0x9d6e29,function(_0x2a6b9c){if(_0x2a6b9c[_0x93a7('0x28')]!=='VIRTUAL'){var _0x23478e={};_0x23478e[_0x2a6b9c[_0x93a7('0x2c')]]={'$like':'%'+_0x374119[_0x93a7('0x34')][_0x93a7('0x24')]+'%'};return _0x23478e;}})});}_0x3b6a01=_[_0x93a7('0x3e')]({},_0x3b6a01,_0x374119['options']);var _0x17f56f={'where':_0x3b6a01[_0x93a7('0x3d')]};return db[_0x93a7('0x2f')]['count'](_0x17f56f)['then'](function(_0x52803d){_0x37f7f0[_0x93a7('0x3f')]=_0x52803d;if(_0x374119[_0x93a7('0x34')][_0x93a7('0x40')]){_0x3b6a01['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x93a7('0x41')](_0x3b6a01);})['then'](function(_0x5142bb){_0x37f7f0['rows']=_0x5142bb;return _0x37f7f0;})['then'](respondWithFilteredResult(_0x2c6b18,_0x3b6a01))[_0x93a7('0x42')](handleError(_0x2c6b18,null));};exports[_0x93a7('0x43')]=function(_0x557739,_0x43e660){var _0x117bb7={'raw':![],'where':{'id':_0x557739[_0x93a7('0x44')]['id']}},_0x10382e={};_0x10382e[_0x93a7('0x32')]=_['keys'](db[_0x93a7('0x2f')]['rawAttributes']);_0x10382e[_0x93a7('0x34')]=_[_0x93a7('0x33')](_0x557739[_0x93a7('0x34')]);_0x10382e[_0x93a7('0x35')]=_[_0x93a7('0x36')](_0x10382e[_0x93a7('0x32')],_0x10382e['query']);_0x117bb7[_0x93a7('0x37')]=_['intersection'](_0x10382e['model'],qs[_0x93a7('0x38')](_0x557739['query'][_0x93a7('0x38')]));_0x117bb7[_0x93a7('0x37')]=_0x117bb7['attributes'][_0x93a7('0x45')]?_0x117bb7['attributes']:_0x10382e[_0x93a7('0x32')];if(_0x557739['query']['includeAll']){_0x117bb7[_0x93a7('0x46')]=[{'all':!![]}];}_0x117bb7=_[_0x93a7('0x3e')]({},_0x117bb7,_0x557739[_0x93a7('0x47')]);return db['VoiceQueue'][_0x93a7('0x48')](_0x117bb7)['then'](handleEntityNotFound(_0x43e660,null))[_0x93a7('0x1f')](respondWithResult(_0x43e660,null))[_0x93a7('0x42')](handleError(_0x43e660,null));};exports['create']=function(_0x5ae6cf,_0x1d75bb){return db[_0x93a7('0x2f')][_0x93a7('0x49')](_0x5ae6cf['body'],{})[_0x93a7('0x1f')](function(_0x4b7652){var _0x173257=_0x5ae6cf['user']['get']({'plain':!![]});if(!_0x173257)throw new Error(_0x93a7('0x4a'));if(_0x173257[_0x93a7('0x4b')]===_0x93a7('0x4c')){var _0x5c5af6=_0x4b7652[_0x93a7('0x21')]({'plain':!![]});var _0x28948e=[{'name':_0x93a7('0x22'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x5c5a43=_[_0x93a7('0x48')](_0x28948e,[_0x93a7('0x27'),_0x5c5af6['type']])['name'];return db[_0x93a7('0x4d')][_0x93a7('0x48')]({'where':{'name':_0x5c5a43,'userProfileId':_0x173257[_0x93a7('0x4e')]},'raw':!![]})['then'](function(_0x34b0e7){if(_0x34b0e7&&_0x34b0e7[_0x93a7('0x4f')]===0x0){return db[_0x93a7('0x29')][_0x93a7('0x49')]({'name':_0x5c5af6['name'],'resourceId':_0x5c5af6['id'],'type':_0x34b0e7[_0x93a7('0x2c')],'sectionId':_0x34b0e7['id']},{})[_0x93a7('0x1f')](function(){return _0x4b7652;});}else{return _0x4b7652;}})['catch'](function(_0x4403fc){logger[_0x93a7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4403fc);throw _0x4403fc;});}return _0x4b7652;})['then'](respondWithResult(_0x1d75bb,0xc9))[_0x93a7('0x42')](handleError(_0x1d75bb,null));};exports[_0x93a7('0x50')]=function(_0x121e45,_0x2cca10){var _0x5b1c26={'where':{'id':_0x121e45['params']['id']}},_0x23b012={};_0x23b012['model']=_['keys'](db['VoiceQueue'][_0x93a7('0x30')]);_0x5b1c26['attributes']=_[_0x93a7('0x36')](_0x23b012[_0x93a7('0x32')],qs['fields'](_0x121e45[_0x93a7('0x34')][_0x93a7('0x38')]));_0x5b1c26[_0x93a7('0x37')]=_0x5b1c26[_0x93a7('0x37')][_0x93a7('0x45')]?_0x5b1c26[_0x93a7('0x37')]:_0x23b012['model'];if(_0x121e45['query'][_0x93a7('0x40')]){_0x5b1c26[_0x93a7('0x46')]=[{'all':!![]}];}_0x5b1c26=_['merge']({},_0x5b1c26,_0x121e45[_0x93a7('0x47')]);return db['VoiceQueue'][_0x93a7('0x48')](_0x5b1c26)[_0x93a7('0x1f')](handleEntityNotFound(_0x2cca10,null))['then'](function(_0x527dff){if(_0x527dff){var _0x4631d6=_0x527dff[_0x93a7('0x21')]({'plain':!![]});_0x4631d6=qs['omit'](_0x4631d6,['id','createdAt',_0x93a7('0x51')]);_0x121e45['body']=_[_0x93a7('0x52')](_0x121e45[_0x93a7('0x53')],['id',_0x93a7('0x54'),_0x93a7('0x51')]);return db[_0x93a7('0x2f')][_0x93a7('0x49')](_[_0x93a7('0x3e')](_0x4631d6,_0x121e45[_0x93a7('0x53')]),{'include':_0x121e45[_0x93a7('0x34')][_0x93a7('0x40')]?[{'all':!![]}]:undefined})[_0x93a7('0x1f')](function(_0x5d61fc){var _0x3dc2c4=_0x121e45[_0x93a7('0x4c')][_0x93a7('0x21')]({'plain':!![]});if(!_0x3dc2c4)throw new Error(_0x93a7('0x4a'));if(_0x3dc2c4[_0x93a7('0x4b')]===_0x93a7('0x4c')){var _0x489121=_0x5d61fc[_0x93a7('0x21')]({'plain':!![]});var _0x499931=[{'name':_0x93a7('0x22'),'value':_0x93a7('0x55')},{'name':_0x93a7('0x56'),'value':'outbound'}];var _0x634b7a=_[_0x93a7('0x48')](_0x499931,['value',_0x489121['type']])[_0x93a7('0x2c')];return db[_0x93a7('0x4d')][_0x93a7('0x48')]({'where':{'name':_0x634b7a,'userProfileId':_0x3dc2c4[_0x93a7('0x4e')]},'raw':!![]})['then'](function(_0x5880a6){if(_0x5880a6&&_0x5880a6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x489121[_0x93a7('0x2c')],'resourceId':_0x489121['id'],'type':_0x5880a6[_0x93a7('0x2c')],'sectionId':_0x5880a6['id']},{})['then'](function(){return _0x5d61fc;});}else{return _0x5d61fc;}})[_0x93a7('0x42')](function(_0x166995){logger[_0x93a7('0x2a')](_0x93a7('0x57'),_0x166995);throw _0x166995;});}return _0x5d61fc;});}})[_0x93a7('0x1f')](respondWithResult(_0x2cca10,0xc9))[_0x93a7('0x42')](handleError(_0x2cca10,null));};exports[_0x93a7('0x58')]=function(_0x4abd0f,_0x89d02c){if(_0x4abd0f['body']['id']){delete _0x4abd0f[_0x93a7('0x53')]['id'];}return db['VoiceQueue'][_0x93a7('0x48')]({'where':{'id':_0x4abd0f[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x89d02c,null))[_0x93a7('0x1f')](saveUpdates(_0x4abd0f['body'],null))[_0x93a7('0x1f')](respondWithResult(_0x89d02c,null))['catch'](handleError(_0x89d02c,null));};exports['destroy']=function(_0x2926c8,_0x2c9462){return db[_0x93a7('0x2f')][_0x93a7('0x48')]({'where':{'id':_0x2926c8['params']['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x2c9462,null))['then'](removeEntity(_0x2c9462,null))['catch'](handleError(_0x2c9462,null));};exports[_0x93a7('0x59')]=function(_0x29b2ba,_0x469264,_0x39ba5e){var _0x436b30={'raw':![],'where':{}};var _0x65679f={};var _0x3cc59c={'count':0x0,'rows':[]};return db[_0x93a7('0x2f')][_0x93a7('0x5a')]({'where':{'id':_0x29b2ba[_0x93a7('0x44')]['id']}})['then'](handleEntityNotFound(_0x469264,null))[_0x93a7('0x1f')](function(_0x29ed3f){if(_0x29ed3f){_0x65679f[_0x93a7('0x32')]=_[_0x93a7('0x33')](db['CmHopper'][_0x93a7('0x30')]);_0x65679f[_0x93a7('0x34')]=_['keys'](_0x29b2ba['query']);_0x65679f[_0x93a7('0x35')]=_[_0x93a7('0x36')](_0x65679f[_0x93a7('0x32')],_0x65679f[_0x93a7('0x34')]);_0x436b30['attributes']=_[_0x93a7('0x36')](_0x65679f['model'],qs[_0x93a7('0x38')](_0x29b2ba['query'][_0x93a7('0x38')]));_0x436b30[_0x93a7('0x37')]=_0x436b30[_0x93a7('0x37')][_0x93a7('0x45')]?_0x436b30['attributes']:_0x65679f[_0x93a7('0x32')];if(!_0x29b2ba[_0x93a7('0x34')][_0x93a7('0x39')](_0x93a7('0x3a'))){_0x436b30[_0x93a7('0x1b')]=qs[_0x93a7('0x1b')](_0x29b2ba[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x436b30[_0x93a7('0x1a')]=qs[_0x93a7('0x1a')](_0x29b2ba[_0x93a7('0x34')]['offset']);}_0x436b30[_0x93a7('0x3b')]=qs[_0x93a7('0x3c')](_0x29b2ba[_0x93a7('0x34')][_0x93a7('0x3c')]);_0x436b30[_0x93a7('0x3d')]=qs['filters'](_[_0x93a7('0x5b')](_0x29b2ba[_0x93a7('0x34')],_0x65679f[_0x93a7('0x35')]));_0x436b30[_0x93a7('0x3d')]['VoiceQueueId']=_0x29ed3f['id'];if(_0x29b2ba[_0x93a7('0x34')]['filter']){_0x436b30[_0x93a7('0x3d')]=_['merge'](_0x436b30[_0x93a7('0x3d')],{'$or':_[_0x93a7('0x26')](_0x436b30[_0x93a7('0x37')],function(_0x56660b){var _0x5c496d={};_0x5c496d[_0x56660b]={'$like':'%'+_0x29b2ba[_0x93a7('0x34')][_0x93a7('0x24')]+'%'};return _0x5c496d;})});}_0x436b30=_[_0x93a7('0x3e')]({},_0x436b30,_0x29b2ba[_0x93a7('0x47')]);return db[_0x93a7('0x5c')]['count']({'where':_0x436b30[_0x93a7('0x3d')]})[_0x93a7('0x1f')](function(_0xaf9d3e){_0x3cc59c[_0x93a7('0x3f')]=_0xaf9d3e;if(_0x29b2ba[_0x93a7('0x34')][_0x93a7('0x40')]){_0x436b30[_0x93a7('0x46')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x436b30);})[_0x93a7('0x1f')](function(_0x59f9f4){_0x3cc59c[_0x93a7('0x5d')]=_0x59f9f4;return _0x3cc59c;});}})[_0x93a7('0x1f')](respondWithFilteredResult(_0x469264,_0x436b30))[_0x93a7('0x42')](handleError(_0x469264,null));};exports[_0x93a7('0x5e')]=function(_0x40799e,_0x11d103,_0x29865c){var _0x33de90={'raw':!![],'where':{}};var _0x17c678={};var _0x13af3b={'count':0x0,'rows':[]};return db[_0x93a7('0x2f')][_0x93a7('0x5a')]({'where':{'id':_0x40799e[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x11d103,null))[_0x93a7('0x1f')](function(_0x5842d6){if(_0x5842d6){_0x17c678[_0x93a7('0x32')]=_[_0x93a7('0x33')](db[_0x93a7('0x5f')][_0x93a7('0x30')]);_0x17c678[_0x93a7('0x34')]=_[_0x93a7('0x33')](_0x40799e['query']);_0x17c678['filters']=_[_0x93a7('0x36')](_0x17c678[_0x93a7('0x32')],_0x17c678['query']);_0x33de90[_0x93a7('0x37')]=_[_0x93a7('0x36')](_0x17c678[_0x93a7('0x32')],qs[_0x93a7('0x38')](_0x40799e[_0x93a7('0x34')]['fields']));_0x33de90[_0x93a7('0x37')]=_0x33de90[_0x93a7('0x37')][_0x93a7('0x45')]?_0x33de90[_0x93a7('0x37')]:_0x17c678[_0x93a7('0x32')];if(!_0x40799e[_0x93a7('0x34')][_0x93a7('0x39')](_0x93a7('0x3a'))){_0x33de90['limit']=qs['limit'](_0x40799e[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x33de90['offset']=qs[_0x93a7('0x1a')](_0x40799e['query'][_0x93a7('0x1a')]);}_0x33de90[_0x93a7('0x3b')]=qs['sort'](_0x40799e['query'][_0x93a7('0x3c')]);_0x33de90[_0x93a7('0x3d')]=qs[_0x93a7('0x35')](_[_0x93a7('0x5b')](_0x40799e[_0x93a7('0x34')],_0x17c678['filters']));_0x33de90[_0x93a7('0x3d')]['VoiceQueueId']=_0x5842d6['id'];if(_0x40799e[_0x93a7('0x34')][_0x93a7('0x24')]){_0x33de90[_0x93a7('0x3d')]=_['merge'](_0x33de90[_0x93a7('0x3d')],{'$or':_['map'](_0x33de90[_0x93a7('0x37')],function(_0x5861f9){var _0xedc93c={};_0xedc93c[_0x5861f9]={'$like':'%'+_0x40799e[_0x93a7('0x34')][_0x93a7('0x24')]+'%'};return _0xedc93c;})});}_0x33de90=_[_0x93a7('0x3e')]({},_0x33de90,_0x40799e[_0x93a7('0x47')]);return db[_0x93a7('0x5f')][_0x93a7('0x3f')]({'where':_0x33de90[_0x93a7('0x3d')]})['then'](function(_0x1f2797){_0x13af3b[_0x93a7('0x3f')]=_0x1f2797;if(_0x40799e[_0x93a7('0x34')][_0x93a7('0x40')]){_0x33de90['include']=[{'all':!![]}];}return db[_0x93a7('0x5f')][_0x93a7('0x41')](_0x33de90);})[_0x93a7('0x1f')](function(_0x5d19d6){_0x13af3b[_0x93a7('0x5d')]=_0x5d19d6;return _0x13af3b;});}})[_0x93a7('0x1f')](respondWithFilteredResult(_0x11d103,_0x33de90))[_0x93a7('0x42')](handleError(_0x11d103,null));};exports[_0x93a7('0x60')]=function(_0x46e513,_0x8af4c9,_0x2f5f54){var _0xaf539b={'raw':!![],'where':{}};var _0x530969={};var _0x220bbc={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x93a7('0x5a')]({'where':{'id':_0x46e513[_0x93a7('0x44')]['id']}})['then'](handleEntityNotFound(_0x8af4c9,null))['then'](function(_0x1eeb59){if(_0x1eeb59){_0x530969[_0x93a7('0x32')]=_['keys'](db[_0x93a7('0x61')]['rawAttributes']);_0x530969[_0x93a7('0x34')]=_[_0x93a7('0x33')](_0x46e513[_0x93a7('0x34')]);_0x530969['filters']=_[_0x93a7('0x36')](_0x530969['model'],_0x530969[_0x93a7('0x34')]);_0xaf539b[_0x93a7('0x37')]=_[_0x93a7('0x36')](_0x530969[_0x93a7('0x32')],qs['fields'](_0x46e513[_0x93a7('0x34')]['fields']));_0xaf539b['attributes']=_0xaf539b[_0x93a7('0x37')]['length']?_0xaf539b[_0x93a7('0x37')]:_0x530969[_0x93a7('0x32')];if(!_0x46e513[_0x93a7('0x34')]['hasOwnProperty'](_0x93a7('0x3a'))){_0xaf539b[_0x93a7('0x1b')]=qs[_0x93a7('0x1b')](_0x46e513[_0x93a7('0x34')][_0x93a7('0x1b')]);_0xaf539b[_0x93a7('0x1a')]=qs[_0x93a7('0x1a')](_0x46e513[_0x93a7('0x34')][_0x93a7('0x1a')]);}_0xaf539b[_0x93a7('0x3b')]=qs[_0x93a7('0x3c')](_0x46e513[_0x93a7('0x34')][_0x93a7('0x3c')]);_0xaf539b['where']=qs[_0x93a7('0x35')](_['pick'](_0x46e513['query'],_0x530969[_0x93a7('0x35')]));_0xaf539b['where'][_0x93a7('0x62')]=_0x1eeb59['id'];if(_0x46e513[_0x93a7('0x34')][_0x93a7('0x24')]){_0xaf539b[_0x93a7('0x3d')]=_[_0x93a7('0x3e')](_0xaf539b[_0x93a7('0x3d')],{'$or':_['map'](_0xaf539b[_0x93a7('0x37')],function(_0x1172a1){var _0x184be7={};_0x184be7[_0x1172a1]={'$like':'%'+_0x46e513['query']['filter']+'%'};return _0x184be7;})});}_0xaf539b=_[_0x93a7('0x3e')]({},_0xaf539b,_0x46e513[_0x93a7('0x47')]);return db['CmHopperFinal'][_0x93a7('0x3f')]({'where':_0xaf539b[_0x93a7('0x3d')]})[_0x93a7('0x1f')](function(_0x416443){_0x220bbc[_0x93a7('0x3f')]=_0x416443;if(_0x46e513[_0x93a7('0x34')][_0x93a7('0x40')]){_0xaf539b['include']=[{'all':!![]}];}return db[_0x93a7('0x61')]['findAll'](_0xaf539b);})[_0x93a7('0x1f')](function(_0x39b2db){_0x220bbc[_0x93a7('0x5d')]=_0x39b2db;return _0x220bbc;});}})[_0x93a7('0x1f')](respondWithFilteredResult(_0x8af4c9,_0xaf539b))[_0x93a7('0x42')](handleError(_0x8af4c9,null));};exports[_0x93a7('0x63')]=function(_0x55c9dd,_0x23fec0,_0x281e3f){var _0x2bd711={'raw':!![],'where':{}};var _0x424485={};var _0x885572={'count':0x0,'rows':[]};return db[_0x93a7('0x2f')][_0x93a7('0x5a')]({'where':{'id':_0x55c9dd[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x23fec0,null))['then'](function(_0x1f74b1){if(_0x1f74b1){_0x424485['model']=_['keys'](db[_0x93a7('0x64')][_0x93a7('0x30')]);_0x424485[_0x93a7('0x34')]=_[_0x93a7('0x33')](_0x55c9dd[_0x93a7('0x34')]);_0x424485[_0x93a7('0x35')]=_[_0x93a7('0x36')](_0x424485[_0x93a7('0x32')],_0x424485['query']);_0x2bd711[_0x93a7('0x37')]=_[_0x93a7('0x36')](_0x424485[_0x93a7('0x32')],qs[_0x93a7('0x38')](_0x55c9dd[_0x93a7('0x34')]['fields']));_0x2bd711[_0x93a7('0x37')]=_0x2bd711['attributes']['length']?_0x2bd711[_0x93a7('0x37')]:_0x424485[_0x93a7('0x32')];if(!_0x55c9dd['query'][_0x93a7('0x39')](_0x93a7('0x3a'))){_0x2bd711['limit']=qs[_0x93a7('0x1b')](_0x55c9dd[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x2bd711['offset']=qs[_0x93a7('0x1a')](_0x55c9dd[_0x93a7('0x34')]['offset']);}_0x2bd711['order']=qs['sort'](_0x55c9dd['query'][_0x93a7('0x3c')]);_0x2bd711[_0x93a7('0x3d')]=qs[_0x93a7('0x35')](_['pick'](_0x55c9dd[_0x93a7('0x34')],_0x424485[_0x93a7('0x35')]));_0x2bd711[_0x93a7('0x3d')][_0x93a7('0x62')]=_0x1f74b1['id'];if(_0x55c9dd[_0x93a7('0x34')][_0x93a7('0x24')]){_0x2bd711[_0x93a7('0x3d')]=_[_0x93a7('0x3e')](_0x2bd711[_0x93a7('0x3d')],{'$or':_[_0x93a7('0x26')](_0x2bd711['attributes'],function(_0x5af57a){var _0x505eb0={};_0x505eb0[_0x5af57a]={'$like':'%'+_0x55c9dd[_0x93a7('0x34')][_0x93a7('0x24')]+'%'};return _0x505eb0;})});}_0x2bd711=_[_0x93a7('0x3e')]({},_0x2bd711,_0x55c9dd[_0x93a7('0x47')]);return db[_0x93a7('0x64')][_0x93a7('0x3f')]({'where':_0x2bd711['where']})[_0x93a7('0x1f')](function(_0x204a6c){_0x885572['count']=_0x204a6c;if(_0x55c9dd[_0x93a7('0x34')][_0x93a7('0x40')]){_0x2bd711[_0x93a7('0x46')]=[{'all':!![]}];}return db[_0x93a7('0x64')][_0x93a7('0x41')](_0x2bd711);})[_0x93a7('0x1f')](function(_0x229353){_0x885572['rows']=_0x229353;return _0x885572;});}})[_0x93a7('0x1f')](respondWithFilteredResult(_0x23fec0,_0x2bd711))[_0x93a7('0x42')](handleError(_0x23fec0,null));};exports[_0x93a7('0x65')]=function(_0x5b1c5d,_0x2a47e2,_0x5dc5d2){var _0x3107a6={};var _0xaf94d8={};var _0x159df4;var _0x1c2526;return db[_0x93a7('0x2f')][_0x93a7('0x5a')]({'where':{'id':_0x5b1c5d['params']['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x2a47e2,null))[_0x93a7('0x1f')](function(_0x2a001a){if(_0x2a001a){_0x159df4=_0x2a001a;_0xaf94d8[_0x93a7('0x32')]=_[_0x93a7('0x33')](db[_0x93a7('0x66')][_0x93a7('0x30')]);_0xaf94d8['query']=_[_0x93a7('0x33')](_0x5b1c5d['query']);_0xaf94d8[_0x93a7('0x35')]=_['intersection'](_0xaf94d8[_0x93a7('0x32')],_0xaf94d8['query']);_0x3107a6[_0x93a7('0x37')]=_['intersection'](_0xaf94d8[_0x93a7('0x32')],qs[_0x93a7('0x38')](_0x5b1c5d['query'][_0x93a7('0x38')]));_0x3107a6[_0x93a7('0x37')]=_0x3107a6[_0x93a7('0x37')]['length']?_0x3107a6[_0x93a7('0x37')]:_0xaf94d8[_0x93a7('0x32')];_0x3107a6[_0x93a7('0x3b')]=qs[_0x93a7('0x3c')](_0x5b1c5d[_0x93a7('0x34')][_0x93a7('0x3c')]);_0x3107a6[_0x93a7('0x3d')]=qs[_0x93a7('0x35')](_['pick'](_0x5b1c5d[_0x93a7('0x34')],_0xaf94d8['filters']));if(_0x5b1c5d['query'][_0x93a7('0x24')]){_0x3107a6[_0x93a7('0x3d')]=_[_0x93a7('0x3e')](_0x3107a6['where'],{'$or':_[_0x93a7('0x26')](_0x3107a6[_0x93a7('0x37')],function(_0x2fbf74){var _0x2a6d6e={};_0x2a6d6e[_0x2fbf74]={'$like':'%'+_0x5b1c5d[_0x93a7('0x34')]['filter']+'%'};return _0x2a6d6e;})});}_0x3107a6=_['merge']({},_0x3107a6,_0x5b1c5d[_0x93a7('0x47')]);return _0x159df4[_0x93a7('0x65')](_0x3107a6);}})[_0x93a7('0x1f')](function(_0x51ad6e){if(_0x51ad6e){_0x1c2526=_0x51ad6e[_0x93a7('0x45')];if(!_0x5b1c5d[_0x93a7('0x34')]['hasOwnProperty'](_0x93a7('0x3a'))){_0x3107a6['limit']=qs[_0x93a7('0x1b')](_0x5b1c5d[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x3107a6[_0x93a7('0x1a')]=qs[_0x93a7('0x1a')](_0x5b1c5d[_0x93a7('0x34')][_0x93a7('0x1a')]);}return _0x159df4[_0x93a7('0x65')](_0x3107a6);}})['then'](function(_0xeb07a3){if(_0xeb07a3){return _0xeb07a3?{'count':_0x1c2526,'rows':_0xeb07a3}:null;}})[_0x93a7('0x1f')](respondWithResult(_0x2a47e2,null))['catch'](handleError(_0x2a47e2,null));};exports['addTeams']=function(_0x403246,_0x5bb716,_0x30bb19){var _0x4fe32b=_0x403246[_0x93a7('0x53')][_0x93a7('0x67')];var _0xcbb655=_[_0x93a7('0x26')](_0x4fe32b,'id');return db[_0x93a7('0x66')][_0x93a7('0x41')]({'where':{'id':_0xcbb655},'attributes':['id'],'include':[{'model':db[_0x93a7('0x68')],'as':_0x93a7('0x69'),'attributes':['id',_0x93a7('0x2c'),_0x93a7('0x6a'),_0x93a7('0x6b'),_0x93a7('0x6c')],'raw':!![]}]})[_0x93a7('0x1f')](function(_0x30d06a){if(_0x30d06a){var _0x45f9e8=_[_0x93a7('0x6d')](_0x30d06a,function(_0x43b47b){var _0x33c422=_0x43b47b[_0x93a7('0x21')]({'plain':!![]});_0x33c422[_0x93a7('0x69')][_0x93a7('0x6e')](function(_0x44254c){_0x44254c[_0x93a7('0x6f')]=_[_0x93a7('0x48')](_0x4fe32b,{'id':_0x33c422['id']})['penalty'];});return _0x33c422['Agents'];});return db[_0x93a7('0x2f')][_0x93a7('0x48')]({'where':{'id':_0x403246['params']['id']}})['then'](function(_0x9ee51e){return db[_0x93a7('0x70')][_0x93a7('0x71')](function(_0x3214f8){return _0x9ee51e[_0x93a7('0x72')](_0xcbb655,{'transaction':_0x3214f8})[_0x93a7('0x1f')](function(){return BPromise[_0x93a7('0x73')](_0x45f9e8,function(_0x4b84f5){return db[_0x93a7('0x74')][_0x93a7('0x75')]({'where':{'UserId':_0x4b84f5['id'],'VoiceQueueId':_0x403246[_0x93a7('0x44')]['id']},'defaults':{'penalty':_0x4b84f5['penalty']},'transaction':_0x3214f8});});})[_0x93a7('0x1f')](function(){return BPromise['each'](_[_0x93a7('0x24')](_0x45f9e8,{'online':!![]}),function(_0x1998aa){return db[_0x93a7('0x76')][_0x93a7('0x77')]({'membername':_0x1998aa['name'],'UserId':_0x1998aa['id'],'queue_name':_0x9ee51e[_0x93a7('0x2c')],'VoiceQueueId':_0x9ee51e['id'],'interface':_['isNil'](_0x1998aa[_0x93a7('0x6c')])?util[_0x93a7('0x78')](_0x93a7('0x79'),_0x1998aa[_0x93a7('0x2c')]):_0x1998aa[_0x93a7('0x6c')],'paused':_0x1998aa['voicePause']||![],'penalty':_0x1998aa['penalty']},{'transaction':_0x3214f8});});})[_0x93a7('0x1f')](function(){_0x45f9e8['forEach'](function(_0x4dca36){socket[_0x93a7('0x7a')](_0x93a7('0x7b'),{'UserId':_0x4dca36['id'],'VoiceQueueId':_0x9ee51e['id']});});});});});}})['then'](respondWithStatusCode(_0x5bb716,null))[_0x93a7('0x42')](handleError(_0x5bb716,null));};exports[_0x93a7('0x7c')]=function(_0x8bb50e,_0x4e766f,_0xc1140e){return db['Team'][_0x93a7('0x41')]({'where':{'id':_0x8bb50e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x93a7('0x68')],'as':_0x93a7('0x69'),'attributes':['id'],'raw':!![]}]})[_0x93a7('0x1f')](handleEntityNotFound(_0x4e766f,null))[_0x93a7('0x1f')](function(_0xc5f9b3){var _0x457e38=_['map'](_0xc5f9b3,'id');var _0x5cd5ee=[];var _0x205dc3=[];var _0x223887=squel[_0x93a7('0x7d')]();_0x223887[_0x93a7('0x7e')](_0x93a7('0x7f'))[_0x93a7('0x80')]('team_has_voice_queues','tq')[_0x93a7('0x81')](_0x93a7('0x82'),'ut',_0x93a7('0x83'))['where'](_0x93a7('0x84'),_0x8bb50e[_0x93a7('0x44')]['id']);for(var _0x86b461=0x0;_0x86b461<_0xc5f9b3[_0x93a7('0x45')];_0x86b461+=0x1){let _0x20d10c=_0xc5f9b3[_0x86b461];for(var _0x2e5b94=0x0;_0x2e5b94<_0x20d10c[_0x93a7('0x69')][_0x93a7('0x45')];_0x2e5b94+=0x1){let _0x18e4c9=_0x20d10c[_0x93a7('0x69')][_0x2e5b94];var _0x4b737d=_0x223887[_0x93a7('0x50')]();_0x4b737d[_0x93a7('0x3d')](_0x93a7('0x85'),_0x18e4c9['id']);_0x205dc3[_0x93a7('0x86')](db[_0x93a7('0x70')][_0x93a7('0x34')](_0x4b737d[_0x93a7('0x87')](),{'type':db[_0x93a7('0x70')][_0x93a7('0x88')]['SELECT']})[_0x93a7('0x1f')](function(_0x40902f){if(_0x40902f[_0x93a7('0x45')]===0x1){return _0x18e4c9['id'];}else{var _0x2a4e0a=_[_0x93a7('0x89')](_[_0x93a7('0x26')](_0x40902f,_0x93a7('0x8a')),function(_0x41607c){return _[_0x93a7('0x8b')](_0x457e38,_0x41607c);});if(_0x2a4e0a){return _0x18e4c9['id'];}}}));}}return BPromise[_0x93a7('0x8c')](_0x205dc3)[_0x93a7('0x1f')](function(_0x3c2946){_0x5cd5ee=_(_0x5cd5ee)[_0x93a7('0x8d')](_0x3c2946)[_0x93a7('0x8e')]()[_0x93a7('0x27')]();return db[_0x93a7('0x2f')][_0x93a7('0x48')]({'where':{'id':_0x8bb50e['params']['id']}})[_0x93a7('0x1f')](function(_0x56742b){return db[_0x93a7('0x70')][_0x93a7('0x71')](function(_0x16e8d9){return _0x56742b[_0x93a7('0x7c')](_0x8bb50e[_0x93a7('0x34')][_0x93a7('0x8f')],{'transaction':_0x16e8d9})[_0x93a7('0x1f')](function(){if(!_[_0x93a7('0x90')](_0x5cd5ee)){return _0x56742b[_0x93a7('0x91')](_0x5cd5ee,{'transaction':_0x16e8d9})['then'](function(){return db[_0x93a7('0x76')]['destroy']({'where':{'VoiceQueueId':_0x8bb50e['params']['id'],'UserId':_0x5cd5ee},'transaction':_0x16e8d9});});}})[_0x93a7('0x1f')](function(){_0x5cd5ee[_0x93a7('0x6e')](function(_0xd66e3){socket['emit'](_0x93a7('0x92'),{'UserId':_0xd66e3,'VoiceQueueId':_0x56742b['id']});});});});});});})['then'](respondWithStatusCode(_0x4e766f,null))[_0x93a7('0x42')](handleError(_0x4e766f,null));};exports[_0x93a7('0x93')]=function(_0x11c137,_0x4ce27c,_0x4a8e97){var _0x117005,_0x4e06ec;return db[_0x93a7('0x2f')][_0x93a7('0x48')]({'where':{'id':_0x11c137[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x4ce27c,null))['then'](function(_0x7c94ba){if(_0x7c94ba){_0x4e06ec=_0x7c94ba;return _0x7c94ba[_0x93a7('0x93')](_0x11c137[_0x93a7('0x53')]['ids'],_['omit'](_0x11c137[_0x93a7('0x53')],[_0x93a7('0x8f'),'id'])||{})[_0x93a7('0x94')](function(_0x58ab80){for(var _0x1e4336=0x0;_0x1e4336<_0x11c137[_0x93a7('0x53')][_0x93a7('0x8f')]['length'];_0x1e4336+=0x1){socket[_0x93a7('0x7a')]('userVoiceQueue:save',{'UserId':_0x11c137[_0x93a7('0x53')][_0x93a7('0x8f')][_0x1e4336],'VoiceQueueId':_0x11c137['params']['id']});}return _0x58ab80;});}})[_0x93a7('0x1f')](function(_0x38975e){_0x117005=_0x38975e||[];if(_0x4e06ec){return db[_0x93a7('0x68')][_0x93a7('0x41')]({'where':{'id':_0x11c137[_0x93a7('0x53')][_0x93a7('0x8f')]},'attributes':['id',_0x93a7('0x2c'),'online','voicePause','interface'],'raw':!![]});}})[_0x93a7('0x1f')](function(_0x3d40fb){if(!_[_0x93a7('0x90')](_0x3d40fb)){var _0x40af5b=[];for(var _0x349af4=0x0;_0x349af4<_0x3d40fb['length'];_0x349af4++){if(_0x3d40fb[_0x349af4][_0x93a7('0x6a')]){_0x40af5b[_0x93a7('0x86')](db[_0x93a7('0x76')][_0x93a7('0x77')]({'membername':_0x3d40fb[_0x349af4][_0x93a7('0x2c')],'UserId':_0x3d40fb[_0x349af4]['id'],'queue_name':_0x4e06ec[_0x93a7('0x2c')],'VoiceQueueId':_0x4e06ec['id'],'interface':_['isNil'](_0x3d40fb[_0x349af4][_0x93a7('0x6c')])?util[_0x93a7('0x78')](_0x93a7('0x79'),_0x3d40fb[_0x349af4]['name']):_0x3d40fb[_0x349af4][_0x93a7('0x6c')],'paused':_0x3d40fb[_0x349af4][_0x93a7('0x6b')]||![],'penalty':_0x11c137[_0x93a7('0x53')][_0x93a7('0x6f')]||0x0}));}}return BPromise[_0x93a7('0x8c')](_0x40af5b);}})['then'](function(){return _0x117005;})['then'](respondWithResult(_0x4ce27c,null))[_0x93a7('0x42')](handleError(_0x4ce27c,null));};exports[_0x93a7('0x91')]=function(_0x617948,_0x5ec0e4,_0xb0beda){return db['VoiceQueue'][_0x93a7('0x48')]({'where':{'id':_0x617948['params']['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x5ec0e4,null))[_0x93a7('0x1f')](function(_0x14c66a){if(_0x14c66a){return _0x14c66a['removeAgents'](_0x617948[_0x93a7('0x34')][_0x93a7('0x8f')])[_0x93a7('0x1f')](function(){if(_[_0x93a7('0x95')](_0x617948[_0x93a7('0x34')][_0x93a7('0x8f')])){for(var _0x50aaa0=0x0;_0x50aaa0<_0x617948[_0x93a7('0x34')]['ids'][_0x93a7('0x45')];_0x50aaa0+=0x1){socket['emit'](_0x93a7('0x92'),{'UserId':Number(_0x617948['query'][_0x93a7('0x8f')][_0x50aaa0]),'VoiceQueueId':Number(_0x617948['params']['id'])});}}else{socket[_0x93a7('0x7a')](_0x93a7('0x92'),{'UserId':Number(_0x617948[_0x93a7('0x34')][_0x93a7('0x8f')]),'VoiceQueueId':Number(_0x617948[_0x93a7('0x44')]['id'])});}});}})[_0x93a7('0x1f')](function(_0x140f1e){return db[_0x93a7('0x76')][_0x93a7('0x20')]({'where':{'VoiceQueueId':_0x617948[_0x93a7('0x44')]['id'],'UserId':_0x617948['query']['ids']}})[_0x93a7('0x1f')](function(){return _0x140f1e;});})[_0x93a7('0x1f')](respondWithStatusCode(_0x5ec0e4,null))[_0x93a7('0x42')](handleError(_0x5ec0e4,null));};exports[_0x93a7('0x96')]=function(_0x37820a,_0x58d60d,_0x1a86c0){var _0x49b6ec={};var _0x433601={};var _0x32eaa3;var _0x5069ad;return db[_0x93a7('0x2f')][_0x93a7('0x5a')]({'where':{'id':_0x37820a[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x58d60d,null))[_0x93a7('0x1f')](function(_0x3ec897){if(_0x3ec897){_0x32eaa3=_0x3ec897;_0x433601['model']=_[_0x93a7('0x33')](db[_0x93a7('0x68')][_0x93a7('0x30')]);_0x433601[_0x93a7('0x34')]=_[_0x93a7('0x33')](_0x37820a[_0x93a7('0x34')]);_0x433601[_0x93a7('0x35')]=_[_0x93a7('0x36')](_0x433601[_0x93a7('0x32')],_0x433601[_0x93a7('0x34')]);_0x49b6ec[_0x93a7('0x37')]=_[_0x93a7('0x36')](_0x433601[_0x93a7('0x32')],qs[_0x93a7('0x38')](_0x37820a[_0x93a7('0x34')][_0x93a7('0x38')]));_0x49b6ec[_0x93a7('0x37')]=_0x49b6ec[_0x93a7('0x37')][_0x93a7('0x45')]?_0x49b6ec[_0x93a7('0x37')]:_0x433601[_0x93a7('0x32')];_0x49b6ec[_0x93a7('0x3b')]=qs[_0x93a7('0x3c')](_0x37820a['query'][_0x93a7('0x3c')]);_0x49b6ec[_0x93a7('0x3d')]=qs[_0x93a7('0x35')](_['pick'](_0x37820a[_0x93a7('0x34')],_0x433601[_0x93a7('0x35')]));if(_0x37820a['query'][_0x93a7('0x24')]){_0x49b6ec[_0x93a7('0x3d')]=_[_0x93a7('0x3e')](_0x49b6ec[_0x93a7('0x3d')],{'$or':_[_0x93a7('0x26')](_0x49b6ec[_0x93a7('0x37')],function(_0x4f917f){var _0x400848={};_0x400848[_0x4f917f]={'$like':'%'+_0x37820a[_0x93a7('0x34')][_0x93a7('0x24')]+'%'};return _0x400848;})});}_0x49b6ec=_[_0x93a7('0x3e')]({},_0x49b6ec,_0x37820a[_0x93a7('0x47')]);return _0x32eaa3[_0x93a7('0x96')](_0x49b6ec);}})[_0x93a7('0x1f')](function(_0xc6cc67){if(_0xc6cc67){_0x5069ad=_0xc6cc67[_0x93a7('0x45')];if(!_0x37820a[_0x93a7('0x34')][_0x93a7('0x39')](_0x93a7('0x3a'))){_0x49b6ec[_0x93a7('0x1b')]=qs[_0x93a7('0x1b')](_0x37820a[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x49b6ec[_0x93a7('0x1a')]=qs[_0x93a7('0x1a')](_0x37820a[_0x93a7('0x34')]['offset']);}return _0x32eaa3['getAgents'](_0x49b6ec);}})['then'](function(_0x42fc6d){if(_0x42fc6d){return _0x42fc6d?{'count':_0x5069ad,'rows':_0x42fc6d}:null;}})[_0x93a7('0x1f')](respondWithResult(_0x58d60d,null))[_0x93a7('0x42')](handleError(_0x58d60d,null));};exports[_0x93a7('0x97')]=function(_0xe530b3,_0x2ee5b3,_0x579618){var _0x538a4d={};var _0x27ea5c={};var _0x319564;var _0x5591d8;return db[_0x93a7('0x2f')][_0x93a7('0x5a')]({'where':{'id':_0xe530b3[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x2ee5b3,null))['then'](function(_0x5db959){if(_0x5db959){_0x319564=_0x5db959;_0x27ea5c[_0x93a7('0x32')]=_[_0x93a7('0x33')](db[_0x93a7('0x76')][_0x93a7('0x30')]);_0x27ea5c[_0x93a7('0x34')]=_[_0x93a7('0x33')](_0xe530b3['query']);_0x27ea5c[_0x93a7('0x35')]=_['intersection'](_0x27ea5c['model'],_0x27ea5c[_0x93a7('0x34')]);_0x538a4d[_0x93a7('0x37')]=_[_0x93a7('0x36')](_0x27ea5c[_0x93a7('0x32')],qs['fields'](_0xe530b3[_0x93a7('0x34')][_0x93a7('0x38')]));_0x538a4d[_0x93a7('0x37')]=_0x538a4d[_0x93a7('0x37')][_0x93a7('0x45')]?_0x538a4d['attributes']:_0x27ea5c[_0x93a7('0x32')];_0x538a4d[_0x93a7('0x3b')]=qs[_0x93a7('0x3c')](_0xe530b3[_0x93a7('0x34')][_0x93a7('0x3c')]);_0x538a4d[_0x93a7('0x3d')]=qs[_0x93a7('0x35')](_[_0x93a7('0x5b')](_0xe530b3[_0x93a7('0x34')],_0x27ea5c['filters']));if(_0xe530b3[_0x93a7('0x34')][_0x93a7('0x24')]){_0x538a4d['where']=_[_0x93a7('0x3e')](_0x538a4d[_0x93a7('0x3d')],{'$or':_['map'](_0x538a4d[_0x93a7('0x37')],function(_0x55ed60){var _0x4f99fe={};_0x4f99fe[_0x55ed60]={'$like':'%'+_0xe530b3[_0x93a7('0x34')][_0x93a7('0x24')]+'%'};return _0x4f99fe;})});}_0x538a4d=_['merge']({},_0x538a4d,_0xe530b3[_0x93a7('0x47')]);return _0x319564[_0x93a7('0x97')](_0x538a4d);}})[_0x93a7('0x1f')](function(_0xfd150b){if(_0xfd150b){_0x5591d8=_0xfd150b[_0x93a7('0x45')];if(!_0xe530b3[_0x93a7('0x34')]['hasOwnProperty'](_0x93a7('0x3a'))){_0x538a4d['limit']=qs[_0x93a7('0x1b')](_0xe530b3[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x538a4d[_0x93a7('0x1a')]=qs[_0x93a7('0x1a')](_0xe530b3[_0x93a7('0x34')][_0x93a7('0x1a')]);}return _0x319564[_0x93a7('0x97')](_0x538a4d);}})[_0x93a7('0x1f')](function(_0x1cd3e0){return _0x1cd3e0?{'count':_0x5591d8,'rows':_0x1cd3e0}:null;})[_0x93a7('0x1f')](respondWithResult(_0x2ee5b3,null))['catch'](handleError(_0x2ee5b3,null));};exports[_0x93a7('0x98')]=function(_0x1446b0,_0x358a3f,_0x15cfe0){var _0x249e88={};var _0x55f14c={};var _0x2af96f;var _0x2f0255;return db['VoiceQueue'][_0x93a7('0x5a')]({'where':{'id':_0x1446b0['params']['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x358a3f,null))[_0x93a7('0x1f')](function(_0x41b73f){if(_0x41b73f){_0x2af96f=_0x41b73f;_0x55f14c[_0x93a7('0x32')]=_[_0x93a7('0x33')](db['CmList'][_0x93a7('0x30')]);_0x55f14c[_0x93a7('0x34')]=_[_0x93a7('0x33')](_0x1446b0[_0x93a7('0x34')]);_0x55f14c[_0x93a7('0x35')]=_[_0x93a7('0x36')](_0x55f14c[_0x93a7('0x32')],_0x55f14c['query']);_0x249e88['attributes']=_[_0x93a7('0x36')](_0x55f14c[_0x93a7('0x32')],qs[_0x93a7('0x38')](_0x1446b0[_0x93a7('0x34')][_0x93a7('0x38')]));_0x249e88['attributes']=_0x249e88[_0x93a7('0x37')][_0x93a7('0x45')]?_0x249e88[_0x93a7('0x37')]:_0x55f14c['model'];_0x249e88['order']=qs[_0x93a7('0x3c')](_0x1446b0[_0x93a7('0x34')][_0x93a7('0x3c')]);_0x249e88[_0x93a7('0x3d')]=qs[_0x93a7('0x35')](_[_0x93a7('0x5b')](_0x1446b0[_0x93a7('0x34')],_0x55f14c[_0x93a7('0x35')]));if(_0x1446b0[_0x93a7('0x34')]['filter']){_0x249e88[_0x93a7('0x3d')]=_[_0x93a7('0x3e')](_0x249e88['where'],{'$or':_[_0x93a7('0x26')](_0x249e88[_0x93a7('0x37')],function(_0x3e6ec3){var _0x581ee8={};_0x581ee8[_0x3e6ec3]={'$like':'%'+_0x1446b0[_0x93a7('0x34')][_0x93a7('0x24')]+'%'};return _0x581ee8;})});}_0x249e88=_[_0x93a7('0x3e')]({},_0x249e88,_0x1446b0['options']);return _0x2af96f[_0x93a7('0x98')](_0x249e88);}})[_0x93a7('0x1f')](function(_0x4cb3e7){if(_0x4cb3e7){_0x2f0255=_0x4cb3e7[_0x93a7('0x45')];if(!_0x1446b0[_0x93a7('0x34')][_0x93a7('0x39')](_0x93a7('0x3a'))){_0x249e88['limit']=qs[_0x93a7('0x1b')](_0x1446b0[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x249e88['offset']=qs[_0x93a7('0x1a')](_0x1446b0[_0x93a7('0x34')]['offset']);}return _0x2af96f[_0x93a7('0x98')](_0x249e88);}})['then'](function(_0x21ca7b){if(_0x21ca7b){return _0x21ca7b?{'count':_0x2f0255,'rows':_0x21ca7b}:null;}})['then'](respondWithResult(_0x358a3f,null))['catch'](handleError(_0x358a3f,null));};exports[_0x93a7('0x99')]=function(_0x5b04e8,_0x25cae4,_0x349469){var _0x5ee515,_0x48b2f5;return db['VoiceQueue'][_0x93a7('0x48')]({'where':{'id':_0x5b04e8[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x25cae4,null))[_0x93a7('0x1f')](function(_0x351acf){if(_0x351acf){_0x48b2f5=_0x351acf;return _0x351acf[_0x93a7('0x99')](_0x5b04e8[_0x93a7('0x53')][_0x93a7('0x8f')],_['omit'](_0x5b04e8[_0x93a7('0x53')],[_0x93a7('0x8f'),'id'])||{});}return null;})[_0x93a7('0x94')](function(_0x227903){var _0x24488d;_0x5ee515=_0x227903||[];var _0x12b7dc=[];if(_0x227903){for(var _0x180735=0x0;_0x180735<_0x227903[_0x93a7('0x45')];_0x180735+=0x1){var _0x23d629=_0x227903[_0x180735][_0x93a7('0x21')]({'plain':!![]});_0x48b2f5[_0x93a7('0x9a')]=_0x5b04e8[_0x93a7('0x53')][_0x93a7('0x9a')]?_0x5b04e8[_0x93a7('0x53')][_0x93a7('0x9a')]:_0x48b2f5[_0x93a7('0x9a')];switch(_0x48b2f5[_0x93a7('0x9a')]){case _0x93a7('0x9b'):_0x24488d=squel[_0x93a7('0x9c')]()['into'](_0x93a7('0x9d'))[_0x93a7('0x9e')](['phone',_0x93a7('0x9f'),_0x93a7('0xa0'),'ListId','VoiceQueueId',_0x93a7('0x54'),_0x93a7('0x51')],squel[_0x93a7('0x7d')]()['field'](_0x93a7('0xa1'),'phone')['field']('NOW()','scheduledAt')[_0x93a7('0x7e')]('id','ContactId')[_0x93a7('0x7e')](_0x23d629['CmListId']['toString'](),_0x93a7('0xa2'))[_0x93a7('0x7e')](_0x5b04e8[_0x93a7('0x44')]['id'][_0x93a7('0x87')](),_0x93a7('0x62'))[_0x93a7('0x7e')]('NOW()',_0x93a7('0x54'))['field'](_0x93a7('0xa3'),_0x93a7('0x51'))[_0x93a7('0x80')](_0x93a7('0xa4'))['where'](_0x93a7('0xa5'))[_0x93a7('0x3d')](_0x93a7('0xa6'),_0x23d629[_0x93a7('0xa7')][_0x93a7('0x87')]())[_0x93a7('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x93a7('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x93a7('0x7d')]()[_0x93a7('0x7e')](_0x93a7('0xa8'))['from']('cm_hopper_final')[_0x93a7('0x3d')](_0x93a7('0x84'),_0x5b04e8[_0x93a7('0x44')]['id'][_0x93a7('0x87')]()))[_0x93a7('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x93a7('0x7d')]()[_0x93a7('0x7e')](_0x93a7('0xa9'))[_0x93a7('0x80')]('cm_hopper')[_0x93a7('0x3d')](_0x93a7('0x84'),_0x5b04e8['params']['id'][_0x93a7('0x87')]())))['toString']();break;case _0x93a7('0xaa'):_0x24488d=squel['insert']()[_0x93a7('0xab')](_0x93a7('0x9d'))[_0x93a7('0x9e')]([_0x93a7('0xa1'),_0x93a7('0x9f'),_0x93a7('0xa0'),_0x93a7('0xa2'),'VoiceQueueId',_0x93a7('0x54'),_0x93a7('0x51')],squel[_0x93a7('0x7d')]()['field'](_0x93a7('0xa1'),'phone')[_0x93a7('0x7e')](_0x93a7('0xa3'),_0x93a7('0x9f'))[_0x93a7('0x7e')]('id','ContactId')[_0x93a7('0x7e')](_0x23d629[_0x93a7('0xa7')][_0x93a7('0x87')](),_0x93a7('0xa2'))[_0x93a7('0x7e')](_0x5b04e8['params']['id'][_0x93a7('0x87')](),_0x93a7('0x62'))[_0x93a7('0x7e')](_0x93a7('0xa3'),'createdAt')['field'](_0x93a7('0xa3'),'updatedAt')['from']('cm_contacts')[_0x93a7('0x3d')](_0x93a7('0xa5'))[_0x93a7('0x3d')](_0x93a7('0xa6'),_0x23d629[_0x93a7('0xa7')][_0x93a7('0x87')]())['where'](_0x93a7('0xac'))['where'](_0x93a7('0xad'),squel[_0x93a7('0x7d')]()[_0x93a7('0x7e')](_0x93a7('0xa9'))[_0x93a7('0x80')](_0x93a7('0x9d'))[_0x93a7('0x3d')](_0x93a7('0x84'),_0x5b04e8[_0x93a7('0x44')]['id'][_0x93a7('0x87')]())))['toString']();break;default:_0x24488d=squel['insert']()[_0x93a7('0xab')](_0x93a7('0x9d'))[_0x93a7('0x9e')]([_0x93a7('0xa1'),_0x93a7('0x9f'),_0x93a7('0xa0'),_0x93a7('0xa2'),_0x93a7('0x62'),_0x93a7('0x54'),_0x93a7('0x51')],squel['select']()[_0x93a7('0x7e')](_0x93a7('0xa1'),'phone')[_0x93a7('0x7e')]('NOW()',_0x93a7('0x9f'))[_0x93a7('0x7e')]('id',_0x93a7('0xa0'))['field'](_0x23d629[_0x93a7('0xa7')][_0x93a7('0x87')](),_0x93a7('0xa2'))[_0x93a7('0x7e')](_0x5b04e8['params']['id'][_0x93a7('0x87')](),_0x93a7('0x62'))[_0x93a7('0x7e')](_0x93a7('0xa3'),_0x93a7('0x54'))[_0x93a7('0x7e')](_0x93a7('0xa3'),_0x93a7('0x51'))[_0x93a7('0x80')](_0x93a7('0xa4'))[_0x93a7('0x3d')](_0x93a7('0xa5'))[_0x93a7('0x3d')]('ListId\x20=\x20?',_0x23d629[_0x93a7('0xa7')][_0x93a7('0x87')]())[_0x93a7('0x3d')](_0x93a7('0xac')))[_0x93a7('0x87')]();}_0x12b7dc[_0x93a7('0x86')](db[_0x93a7('0x70')]['query'](_0x24488d));}return BPromise['all'](_0x12b7dc);}})[_0x93a7('0x1f')](function(){return _0x5ee515;})[_0x93a7('0x1f')](respondWithResult(_0x25cae4,null))[_0x93a7('0x42')](handleError(_0x25cae4,null));};exports[_0x93a7('0xae')]=function(_0x591854,_0x10a4d0,_0x1a9936){return db['VoiceQueue'][_0x93a7('0x48')]({'where':{'id':_0x591854['params']['id']}})['then'](handleEntityNotFound(_0x10a4d0,null))[_0x93a7('0x1f')](function(_0x1aa29f){if(_0x1aa29f){return _0x1aa29f['removeLists'](_0x591854[_0x93a7('0x34')][_0x93a7('0x8f')]);}})[_0x93a7('0x1f')](function(_0x3dd08c){if(_0x3dd08c){return db['CmHopper']['destroy']({'where':{'ListId':_0x591854[_0x93a7('0x34')]['ids'],'VoiceQueueId':_0x591854[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](function(){return _0x3dd08c;});}})[_0x93a7('0x1f')](respondWithStatusCode(_0x10a4d0,null))[_0x93a7('0x42')](handleError(_0x10a4d0,null));};exports[_0x93a7('0xaf')]=function(_0x202bae,_0x1eb348,_0x46c70d){var _0x3e5d1b={};var _0x18233e={};var _0x2602d7;var _0x1ce141;return db['VoiceQueue'][_0x93a7('0x5a')]({'where':{'id':_0x202bae['params']['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x1eb348,null))[_0x93a7('0x1f')](function(_0xb35b3e){if(_0xb35b3e){_0x2602d7=_0xb35b3e;_0x18233e[_0x93a7('0x32')]=_['keys'](db[_0x93a7('0xb0')][_0x93a7('0x30')]);_0x18233e[_0x93a7('0x34')]=_[_0x93a7('0x33')](_0x202bae[_0x93a7('0x34')]);_0x18233e[_0x93a7('0x35')]=_['intersection'](_0x18233e[_0x93a7('0x32')],_0x18233e[_0x93a7('0x34')]);_0x3e5d1b[_0x93a7('0x37')]=_[_0x93a7('0x36')](_0x18233e[_0x93a7('0x32')],qs[_0x93a7('0x38')](_0x202bae[_0x93a7('0x34')][_0x93a7('0x38')]));_0x3e5d1b[_0x93a7('0x37')]=_0x3e5d1b['attributes']['length']?_0x3e5d1b[_0x93a7('0x37')]:_0x18233e[_0x93a7('0x32')];_0x3e5d1b[_0x93a7('0x3b')]=qs[_0x93a7('0x3c')](_0x202bae[_0x93a7('0x34')][_0x93a7('0x3c')]);_0x3e5d1b['where']=qs[_0x93a7('0x35')](_[_0x93a7('0x5b')](_0x202bae[_0x93a7('0x34')],_0x18233e[_0x93a7('0x35')]));if(_0x202bae[_0x93a7('0x34')][_0x93a7('0x24')]){_0x3e5d1b['where']=_[_0x93a7('0x3e')](_0x3e5d1b['where'],{'$or':_[_0x93a7('0x26')](_0x3e5d1b['attributes'],function(_0x447ccd){var _0x3ba547={};_0x3ba547[_0x447ccd]={'$like':'%'+_0x202bae[_0x93a7('0x34')][_0x93a7('0x24')]+'%'};return _0x3ba547;})});}_0x3e5d1b=_['merge']({},_0x3e5d1b,_0x202bae[_0x93a7('0x47')]);return _0x2602d7['getBlackLists'](_0x3e5d1b);}})[_0x93a7('0x1f')](function(_0x1df5d8){if(_0x1df5d8){_0x1ce141=_0x1df5d8[_0x93a7('0x45')];if(!_0x202bae[_0x93a7('0x34')][_0x93a7('0x39')](_0x93a7('0x3a'))){_0x3e5d1b[_0x93a7('0x1b')]=qs[_0x93a7('0x1b')](_0x202bae[_0x93a7('0x34')][_0x93a7('0x1b')]);_0x3e5d1b[_0x93a7('0x1a')]=qs[_0x93a7('0x1a')](_0x202bae[_0x93a7('0x34')][_0x93a7('0x1a')]);}return _0x2602d7[_0x93a7('0xaf')](_0x3e5d1b);}})[_0x93a7('0x1f')](function(_0x518038){if(_0x518038){return _0x518038?{'count':_0x1ce141,'rows':_0x518038}:null;}})['then'](respondWithResult(_0x1eb348,null))['catch'](handleError(_0x1eb348,null));};exports['addBlackLists']=function(_0x2b4509,_0x85ef29,_0x32289f){var _0x5f32cf,_0x5901a8;return db[_0x93a7('0x2f')][_0x93a7('0x48')]({'where':{'id':_0x2b4509['params']['id']}})['then'](handleEntityNotFound(_0x85ef29,null))[_0x93a7('0x1f')](function(_0x50cdad){if(_0x50cdad){_0x5901a8=_0x50cdad;return _0x50cdad[_0x93a7('0xb1')](_0x2b4509[_0x93a7('0x53')][_0x93a7('0x8f')],_[_0x93a7('0x52')](_0x2b4509[_0x93a7('0x53')],['ids','id'])||{});}return null;})[_0x93a7('0x94')](function(_0x4d057a){var _0x52cb63;_0x5f32cf=_0x4d057a||[];var _0x3dcf0d=[];if(_0x4d057a){for(var _0x47c1b4=0x0;_0x47c1b4<_0x4d057a[_0x93a7('0x45')];_0x47c1b4+=0x1){var _0x274a60=_0x4d057a[_0x47c1b4][_0x93a7('0x21')]({'plain':!![]});_0x52cb63=squel['insert']()[_0x93a7('0xab')](_0x93a7('0xb2'))['fromQuery']([_0x93a7('0xa1'),_0x93a7('0xa0'),_0x93a7('0xa2'),'VoiceQueueId','createdAt',_0x93a7('0x51')],squel[_0x93a7('0x7d')]()['field']('phone',_0x93a7('0xa1'))['field']('id',_0x93a7('0xa0'))[_0x93a7('0x7e')](_0x274a60[_0x93a7('0xa7')]['toString'](),_0x93a7('0xa2'))[_0x93a7('0x7e')](_0x2b4509[_0x93a7('0x44')]['id'][_0x93a7('0x87')](),_0x93a7('0x62'))[_0x93a7('0x7e')]('NOW()',_0x93a7('0x54'))[_0x93a7('0x7e')]('NOW()',_0x93a7('0x51'))['from'](_0x93a7('0xa4'))[_0x93a7('0x3d')]('deletedAt\x20IS\x20NULL')[_0x93a7('0x3d')](_0x93a7('0xa6'),_0x274a60[_0x93a7('0xa7')]['toString']())[_0x93a7('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x93a7('0x87')]();_0x3dcf0d[_0x93a7('0x86')](db[_0x93a7('0x70')][_0x93a7('0x34')](_0x52cb63));}return BPromise[_0x93a7('0x8c')](_0x3dcf0d);}})[_0x93a7('0x1f')](function(){return _0x5f32cf;})[_0x93a7('0x1f')](respondWithResult(_0x85ef29,null))[_0x93a7('0x42')](handleError(_0x85ef29,null));};exports[_0x93a7('0xb3')]=function(_0x159a19,_0x26e0f8,_0x3bc8bd){return db[_0x93a7('0x2f')]['find']({'where':{'id':_0x159a19[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](handleEntityNotFound(_0x26e0f8,null))[_0x93a7('0x1f')](function(_0x57af80){if(_0x57af80){return _0x57af80[_0x93a7('0xb3')](_0x159a19[_0x93a7('0x34')][_0x93a7('0x8f')]);}})[_0x93a7('0x1f')](function(_0x3a783d){if(_0x3a783d){return db[_0x93a7('0x64')][_0x93a7('0x20')]({'where':{'ListId':_0x159a19['query'][_0x93a7('0x8f')],'VoiceQueueId':_0x159a19[_0x93a7('0x44')]['id']}})[_0x93a7('0x1f')](function(){return _0x3a783d;});}})[_0x93a7('0x1f')](respondWithStatusCode(_0x26e0f8,null))[_0x93a7('0x42')](handleError(_0x26e0f8,null));}; \ No newline at end of file +var _0x801f=['toString','QueryTypes','SELECT','TeamId','all','union','compact','ids','removeAgents','userVoiceQueue:remove','isEmpty','push','upsert','isArray','getAgents','getMembers','getLists','CmList','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','limit','set','Content-Range','save','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','key','keys','query','intersection','attributes','model','fields','nolimit','offset','order','sort','where','filters','pick','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','update','getHoppers','hasOwnProperty','CmHopper','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','select','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x801f,0x19e));var _0xf801=function(_0x26ce6f,_0x1ce3ca){_0x26ce6f=_0x26ce6f-0x0;var _0x18368d=_0x801f[_0x26ce6f];return _0x18368d;};'use strict';var pdf=require(_0xf801('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf801('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf801('0x2'));var rp=require(_0xf801('0x3'));var moment=require(_0xf801('0x4'));var BPromise=require(_0xf801('0x5'));var Mustache=require('mustache');var util=require(_0xf801('0x6'));var path=require(_0xf801('0x7'));var sox=require('sox');var csv=require(_0xf801('0x8'));var ejs=require(_0xf801('0x9'));var fs=require('fs');var _=require(_0xf801('0xa'));var squel=require(_0xf801('0xb'));var crypto=require(_0xf801('0xc'));var jsforce=require(_0xf801('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf801('0x8'));var querystring=require(_0xf801('0xe'));var Papa=require('papaparse');var Redis=require(_0xf801('0xf'));var authService=require(_0xf801('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf801('0x11'));var logger=require(_0xf801('0x12'))('api');var utils=require(_0xf801('0x13'));var config=require('../../config/environment');var db=require(_0xf801('0x14'))['db'];config['redis']=_[_0xf801('0x15')](config[_0xf801('0x16')],{'host':_0xf801('0x17'),'port':0x18eb});var socket=require(_0xf801('0x18'))(new Redis(config['redis']));require(_0xf801('0x19'))[_0xf801('0x1a')](socket);function respondWithStatusCode(_0x53c6e3,_0x5a770e){_0x5a770e=_0x5a770e||0xcc;return function(_0x18ef14){if(_0x18ef14){return _0x53c6e3[_0xf801('0x1b')](_0x5a770e);}return _0x53c6e3[_0xf801('0x1c')](_0x5a770e)[_0xf801('0x1d')]();};}function respondWithResult(_0x2bb8e8,_0x432391){_0x432391=_0x432391||0xc8;return function(_0x1157ae){if(_0x1157ae){return _0x2bb8e8[_0xf801('0x1c')](_0x432391)[_0xf801('0x1e')](_0x1157ae);}};}function respondWithFilteredResult(_0x339106,_0x272e66){return function(_0x494f19){if(_0x494f19){var _0xdbe47a=_0x494f19[_0xf801('0x1f')],_0xcbd157=_0x272e66['offset'],_0x10b90c=_0x272e66['offset']+_0x272e66[_0xf801('0x20')],_0xe8109e;if(_0x10b90c>=_0xdbe47a){_0x10b90c=_0xdbe47a;_0xe8109e=0xc8;}else{_0xe8109e=0xce;}_0x339106['status'](_0xe8109e);return _0x339106[_0xf801('0x21')](_0xf801('0x22'),_0xcbd157+'-'+_0x10b90c+'/'+_0xdbe47a)[_0xf801('0x1e')](_0x494f19);}return null;};}function patchUpdates(_0x123795){return function(_0x377100){try{jsonpatch['apply'](_0x377100,_0x123795,!![]);}catch(_0x2dd9f3){return BPromise['reject'](_0x2dd9f3);}return _0x377100[_0xf801('0x23')]();};}function saveUpdates(_0x9df6ed,_0x3521a1){return function(_0x4845e2){if(_0x4845e2){return _0x4845e2['update'](_0x9df6ed)[_0xf801('0x24')](function(_0x401885){return _0x401885;});}return null;};}function removeEntity(_0x47bec8,_0x55d500){return function(_0x31e2c1){if(_0x31e2c1){return _0x31e2c1[_0xf801('0x25')]()[_0xf801('0x24')](function(){var _0x3ff7c2=_0x31e2c1[_0xf801('0x26')]({'plain':!![]});var _0x5ce111=[{'name':'VoiceQueues','value':_0xf801('0x27'),'ignore':![]},{'name':_0xf801('0x28'),'value':_0xf801('0x29'),'ignore':![]}];var _0x1e90d8=_(_0x5ce111)[_0xf801('0x2a')](_0xf801('0x2b'))[_0xf801('0x2c')](_0xf801('0x2d'))[_0xf801('0x2d')]();if(_[_0xf801('0x2e')](_0x1e90d8,_0x3ff7c2[_0xf801('0x2f')])){return;}var _0x3f6052=_[_0xf801('0x30')](_0x5ce111,[_0xf801('0x2d'),_0x3ff7c2['type']])[_0xf801('0x31')];return db[_0xf801('0x32')][_0xf801('0x25')]({'where':{'type':_0x3f6052,'resourceId':_0x3ff7c2['id']}})[_0xf801('0x24')](function(){return _0x31e2c1;});})[_0xf801('0x24')](function(){_0x47bec8[_0xf801('0x1c')](0xcc)[_0xf801('0x1d')]();});}};}function handleEntityNotFound(_0x317a80,_0x38f8ba){return function(_0x6702fc){if(!_0x6702fc){_0x317a80[_0xf801('0x1b')](0x194);}return _0x6702fc;};}function handleError(_0x52f8c4,_0x1e9375){_0x1e9375=_0x1e9375||0x1f4;return function(_0x4eef40){logger[_0xf801('0x33')](_0x4eef40[_0xf801('0x34')]);if(_0x4eef40[_0xf801('0x31')]){delete _0x4eef40[_0xf801('0x31')];}_0x52f8c4['status'](_0x1e9375)[_0xf801('0x35')](_0x4eef40);};}exports[_0xf801('0x36')]=function(_0x910455,_0x4d4321){var _0x2c3c4a={},_0x38abc7={},_0x4ae9f7={'count':0x0,'rows':[]};var _0x6ec416=_[_0xf801('0x2c')](db[_0xf801('0x37')][_0xf801('0x38')],function(_0x1d684b){return{'name':_0x1d684b['fieldName'],'type':_0x1d684b[_0xf801('0x2f')][_0xf801('0x39')]};});_0x38abc7['model']=_[_0xf801('0x2c')](_0x6ec416,_0xf801('0x31'));_0x38abc7['query']=_[_0xf801('0x3a')](_0x910455[_0xf801('0x3b')]);_0x38abc7['filters']=_[_0xf801('0x3c')](_0x38abc7['model'],_0x38abc7['query']);_0x2c3c4a[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x38abc7[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0x910455[_0xf801('0x3b')][_0xf801('0x3f')]));_0x2c3c4a[_0xf801('0x3d')]=_0x2c3c4a[_0xf801('0x3d')]['length']?_0x2c3c4a[_0xf801('0x3d')]:_0x38abc7['model'];if(!_0x910455['query']['hasOwnProperty'](_0xf801('0x40'))){_0x2c3c4a[_0xf801('0x20')]=qs[_0xf801('0x20')](_0x910455[_0xf801('0x3b')][_0xf801('0x20')]);_0x2c3c4a['offset']=qs[_0xf801('0x41')](_0x910455['query']['offset']);}_0x2c3c4a[_0xf801('0x42')]=qs[_0xf801('0x43')](_0x910455[_0xf801('0x3b')][_0xf801('0x43')]);_0x2c3c4a[_0xf801('0x44')]=qs[_0xf801('0x45')](_[_0xf801('0x46')](_0x910455[_0xf801('0x3b')],_0x38abc7[_0xf801('0x45')]),_0x6ec416);if(_0x910455[_0xf801('0x3b')]['filter']){_0x2c3c4a[_0xf801('0x44')]=_[_0xf801('0x47')](_0x2c3c4a[_0xf801('0x44')],{'$or':_['map'](_0x6ec416,function(_0x381d01){if(_0x381d01[_0xf801('0x2f')]!==_0xf801('0x48')){var _0x4e7123={};_0x4e7123[_0x381d01[_0xf801('0x31')]]={'$like':'%'+_0x910455[_0xf801('0x3b')][_0xf801('0x2a')]+'%'};return _0x4e7123;}})});}_0x2c3c4a=_[_0xf801('0x47')]({},_0x2c3c4a,_0x910455[_0xf801('0x49')]);var _0x249483={'where':_0x2c3c4a[_0xf801('0x44')]};return db[_0xf801('0x37')][_0xf801('0x1f')](_0x249483)[_0xf801('0x24')](function(_0x451e56){_0x4ae9f7[_0xf801('0x1f')]=_0x451e56;if(_0x910455['query']['includeAll']){_0x2c3c4a['include']=[{'all':!![]}];}return db[_0xf801('0x37')][_0xf801('0x4a')](_0x2c3c4a);})[_0xf801('0x24')](function(_0x42083f){_0x4ae9f7[_0xf801('0x4b')]=_0x42083f;return _0x4ae9f7;})['then'](respondWithFilteredResult(_0x4d4321,_0x2c3c4a))[_0xf801('0x4c')](handleError(_0x4d4321,null));};exports[_0xf801('0x4d')]=function(_0x5b8921,_0x4aaf0e){var _0x27bf6e={'raw':![],'where':{'id':_0x5b8921[_0xf801('0x4e')]['id']}},_0x5adb09={};_0x5adb09[_0xf801('0x3e')]=_[_0xf801('0x3a')](db[_0xf801('0x37')]['rawAttributes']);_0x5adb09[_0xf801('0x3b')]=_['keys'](_0x5b8921[_0xf801('0x3b')]);_0x5adb09['filters']=_['intersection'](_0x5adb09['model'],_0x5adb09[_0xf801('0x3b')]);_0x27bf6e['attributes']=_[_0xf801('0x3c')](_0x5adb09[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0x5b8921['query'][_0xf801('0x3f')]));_0x27bf6e[_0xf801('0x3d')]=_0x27bf6e[_0xf801('0x3d')][_0xf801('0x4f')]?_0x27bf6e['attributes']:_0x5adb09[_0xf801('0x3e')];if(_0x5b8921[_0xf801('0x3b')][_0xf801('0x50')]){_0x27bf6e['include']=[{'all':!![]}];}_0x27bf6e=_[_0xf801('0x47')]({},_0x27bf6e,_0x5b8921[_0xf801('0x49')]);return db[_0xf801('0x37')]['find'](_0x27bf6e)['then'](handleEntityNotFound(_0x4aaf0e,null))[_0xf801('0x24')](respondWithResult(_0x4aaf0e,null))[_0xf801('0x4c')](handleError(_0x4aaf0e,null));};exports[_0xf801('0x51')]=function(_0x26137f,_0xb56b4b){return db[_0xf801('0x37')]['create'](_0x26137f[_0xf801('0x52')],{})[_0xf801('0x24')](function(_0x41a420){var _0x163190=_0x26137f[_0xf801('0x53')]['get']({'plain':!![]});if(!_0x163190)throw new Error(_0xf801('0x54'));if(_0x163190[_0xf801('0x55')]===_0xf801('0x53')){var _0x579804=_0x41a420[_0xf801('0x26')]({'plain':!![]});var _0x26e220=[{'name':_0xf801('0x56'),'value':_0xf801('0x27')},{'name':_0xf801('0x28'),'value':_0xf801('0x29')}];var _0x4abbe4=_[_0xf801('0x30')](_0x26e220,['value',_0x579804[_0xf801('0x2f')]])[_0xf801('0x31')];return db[_0xf801('0x57')][_0xf801('0x30')]({'where':{'name':_0x4abbe4,'userProfileId':_0x163190[_0xf801('0x58')]},'raw':!![]})[_0xf801('0x24')](function(_0x25c10b){if(_0x25c10b&&_0x25c10b[_0xf801('0x59')]===0x0){return db[_0xf801('0x32')][_0xf801('0x51')]({'name':_0x579804[_0xf801('0x31')],'resourceId':_0x579804['id'],'type':_0x25c10b[_0xf801('0x31')],'sectionId':_0x25c10b['id']},{})['then'](function(){return _0x41a420;});}else{return _0x41a420;}})['catch'](function(_0x565bd7){logger[_0xf801('0x33')](_0xf801('0x5a'),_0x565bd7);throw _0x565bd7;});}return _0x41a420;})[_0xf801('0x24')](respondWithResult(_0xb56b4b,0xc9))[_0xf801('0x4c')](handleError(_0xb56b4b,null));};exports[_0xf801('0x5b')]=function(_0x4fc0b5,_0x57d749){var _0x3fb040={'where':{'id':_0x4fc0b5['params']['id']}},_0x1eb4bd={};_0x1eb4bd[_0xf801('0x3e')]=_[_0xf801('0x3a')](db[_0xf801('0x37')][_0xf801('0x38')]);_0x3fb040[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x1eb4bd[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0x4fc0b5[_0xf801('0x3b')][_0xf801('0x3f')]));_0x3fb040[_0xf801('0x3d')]=_0x3fb040[_0xf801('0x3d')][_0xf801('0x4f')]?_0x3fb040[_0xf801('0x3d')]:_0x1eb4bd[_0xf801('0x3e')];if(_0x4fc0b5['query'][_0xf801('0x50')]){_0x3fb040[_0xf801('0x5c')]=[{'all':!![]}];}_0x3fb040=_[_0xf801('0x47')]({},_0x3fb040,_0x4fc0b5[_0xf801('0x49')]);return db['VoiceQueue'][_0xf801('0x30')](_0x3fb040)[_0xf801('0x24')](handleEntityNotFound(_0x57d749,null))[_0xf801('0x24')](function(_0x31c724){if(_0x31c724){var _0xd12f0d=_0x31c724['get']({'plain':!![]});_0xd12f0d=qs[_0xf801('0x5d')](_0xd12f0d,['id',_0xf801('0x5e'),_0xf801('0x5f')]);_0x4fc0b5[_0xf801('0x52')]=_['omit'](_0x4fc0b5['body'],['id',_0xf801('0x5e'),_0xf801('0x5f')]);return db[_0xf801('0x37')][_0xf801('0x51')](_[_0xf801('0x47')](_0xd12f0d,_0x4fc0b5[_0xf801('0x52')]),{'include':_0x4fc0b5[_0xf801('0x3b')][_0xf801('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x108351){var _0x50ff3b=_0x4fc0b5[_0xf801('0x53')][_0xf801('0x26')]({'plain':!![]});if(!_0x50ff3b)throw new Error(_0xf801('0x54'));if(_0x50ff3b['role']===_0xf801('0x53')){var _0x50e197=_0x108351[_0xf801('0x26')]({'plain':!![]});var _0x146918=[{'name':_0xf801('0x56'),'value':'inbound'},{'name':_0xf801('0x28'),'value':_0xf801('0x29')}];var _0x17f62c=_['find'](_0x146918,['value',_0x50e197['type']])[_0xf801('0x31')];return db[_0xf801('0x57')][_0xf801('0x30')]({'where':{'name':_0x17f62c,'userProfileId':_0x50ff3b['userProfileId']},'raw':!![]})[_0xf801('0x24')](function(_0x7f9c45){if(_0x7f9c45&&_0x7f9c45[_0xf801('0x59')]===0x0){return db[_0xf801('0x32')][_0xf801('0x51')]({'name':_0x50e197[_0xf801('0x31')],'resourceId':_0x50e197['id'],'type':_0x7f9c45[_0xf801('0x31')],'sectionId':_0x7f9c45['id']},{})[_0xf801('0x24')](function(){return _0x108351;});}else{return _0x108351;}})[_0xf801('0x4c')](function(_0x36a1bf){logger['error'](_0xf801('0x5a'),_0x36a1bf);throw _0x36a1bf;});}return _0x108351;});}})['then'](respondWithResult(_0x57d749,0xc9))[_0xf801('0x4c')](handleError(_0x57d749,null));};exports[_0xf801('0x60')]=function(_0x38485b,_0x6d56c7){if(_0x38485b['body']['id']){delete _0x38485b['body']['id'];}return db[_0xf801('0x37')][_0xf801('0x30')]({'where':{'id':_0x38485b[_0xf801('0x4e')]['id']}})['then'](handleEntityNotFound(_0x6d56c7,null))[_0xf801('0x24')](saveUpdates(_0x38485b[_0xf801('0x52')],null))[_0xf801('0x24')](respondWithResult(_0x6d56c7,null))[_0xf801('0x4c')](handleError(_0x6d56c7,null));};exports['destroy']=function(_0x442831,_0x2db82b){return db[_0xf801('0x37')][_0xf801('0x30')]({'where':{'id':_0x442831[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x2db82b,null))[_0xf801('0x24')](removeEntity(_0x2db82b,null))[_0xf801('0x4c')](handleError(_0x2db82b,null));};exports[_0xf801('0x61')]=function(_0x2e5e4c,_0x2df10,_0x176f19){var _0x136aa0={'raw':![],'where':{}};var _0x23addd={};var _0x5d34c8={'count':0x0,'rows':[]};return db[_0xf801('0x37')]['findOne']({'where':{'id':_0x2e5e4c[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x2df10,null))[_0xf801('0x24')](function(_0x3bd1da){if(_0x3bd1da){_0x23addd[_0xf801('0x3e')]=_[_0xf801('0x3a')](db['CmHopper']['rawAttributes']);_0x23addd['query']=_[_0xf801('0x3a')](_0x2e5e4c['query']);_0x23addd[_0xf801('0x45')]=_['intersection'](_0x23addd[_0xf801('0x3e')],_0x23addd[_0xf801('0x3b')]);_0x136aa0[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x23addd[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0x2e5e4c[_0xf801('0x3b')][_0xf801('0x3f')]));_0x136aa0[_0xf801('0x3d')]=_0x136aa0[_0xf801('0x3d')][_0xf801('0x4f')]?_0x136aa0[_0xf801('0x3d')]:_0x23addd[_0xf801('0x3e')];if(!_0x2e5e4c[_0xf801('0x3b')][_0xf801('0x62')](_0xf801('0x40'))){_0x136aa0[_0xf801('0x20')]=qs[_0xf801('0x20')](_0x2e5e4c['query'][_0xf801('0x20')]);_0x136aa0['offset']=qs['offset'](_0x2e5e4c[_0xf801('0x3b')]['offset']);}_0x136aa0[_0xf801('0x42')]=qs['sort'](_0x2e5e4c[_0xf801('0x3b')]['sort']);_0x136aa0['where']=qs['filters'](_[_0xf801('0x46')](_0x2e5e4c[_0xf801('0x3b')],_0x23addd[_0xf801('0x45')]));_0x136aa0[_0xf801('0x44')]['VoiceQueueId']=_0x3bd1da['id'];if(_0x2e5e4c['query']['filter']){_0x136aa0[_0xf801('0x44')]=_[_0xf801('0x47')](_0x136aa0[_0xf801('0x44')],{'$or':_[_0xf801('0x2c')](_0x136aa0[_0xf801('0x3d')],function(_0x13ca94){var _0xac0a8f={};_0xac0a8f[_0x13ca94]={'$like':'%'+_0x2e5e4c[_0xf801('0x3b')][_0xf801('0x2a')]+'%'};return _0xac0a8f;})});}_0x136aa0=_[_0xf801('0x47')]({},_0x136aa0,_0x2e5e4c['options']);return db['CmHopper'][_0xf801('0x1f')]({'where':_0x136aa0['where']})[_0xf801('0x24')](function(_0x1dcc1f){_0x5d34c8[_0xf801('0x1f')]=_0x1dcc1f;if(_0x2e5e4c[_0xf801('0x3b')][_0xf801('0x50')]){_0x136aa0[_0xf801('0x5c')]=[{'all':!![]}];}return db[_0xf801('0x63')][_0xf801('0x4a')](_0x136aa0);})['then'](function(_0x3d0120){_0x5d34c8[_0xf801('0x4b')]=_0x3d0120;return _0x5d34c8;});}})['then'](respondWithFilteredResult(_0x2df10,_0x136aa0))[_0xf801('0x4c')](handleError(_0x2df10,null));};exports[_0xf801('0x64')]=function(_0x4701bb,_0x14f66e,_0x58ee68){var _0x4f390f={'raw':!![],'where':{}};var _0x58b826={};var _0x1df8fa={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf801('0x65')]({'where':{'id':_0x4701bb[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x14f66e,null))['then'](function(_0x3279b0){if(_0x3279b0){_0x58b826[_0xf801('0x3e')]=_[_0xf801('0x3a')](db['CmHopperHistory'][_0xf801('0x38')]);_0x58b826['query']=_[_0xf801('0x3a')](_0x4701bb[_0xf801('0x3b')]);_0x58b826['filters']=_['intersection'](_0x58b826[_0xf801('0x3e')],_0x58b826[_0xf801('0x3b')]);_0x4f390f[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x58b826[_0xf801('0x3e')],qs['fields'](_0x4701bb['query']['fields']));_0x4f390f[_0xf801('0x3d')]=_0x4f390f['attributes'][_0xf801('0x4f')]?_0x4f390f[_0xf801('0x3d')]:_0x58b826['model'];if(!_0x4701bb[_0xf801('0x3b')][_0xf801('0x62')]('nolimit')){_0x4f390f['limit']=qs['limit'](_0x4701bb[_0xf801('0x3b')][_0xf801('0x20')]);_0x4f390f[_0xf801('0x41')]=qs[_0xf801('0x41')](_0x4701bb[_0xf801('0x3b')]['offset']);}_0x4f390f[_0xf801('0x42')]=qs['sort'](_0x4701bb[_0xf801('0x3b')][_0xf801('0x43')]);_0x4f390f[_0xf801('0x44')]=qs[_0xf801('0x45')](_[_0xf801('0x46')](_0x4701bb['query'],_0x58b826[_0xf801('0x45')]));_0x4f390f['where']['VoiceQueueId']=_0x3279b0['id'];if(_0x4701bb[_0xf801('0x3b')]['filter']){_0x4f390f[_0xf801('0x44')]=_[_0xf801('0x47')](_0x4f390f[_0xf801('0x44')],{'$or':_['map'](_0x4f390f['attributes'],function(_0x35798e){var _0x2cbb6d={};_0x2cbb6d[_0x35798e]={'$like':'%'+_0x4701bb[_0xf801('0x3b')][_0xf801('0x2a')]+'%'};return _0x2cbb6d;})});}_0x4f390f=_[_0xf801('0x47')]({},_0x4f390f,_0x4701bb['options']);return db['CmHopperHistory'][_0xf801('0x1f')]({'where':_0x4f390f[_0xf801('0x44')]})[_0xf801('0x24')](function(_0x4818cd){_0x1df8fa['count']=_0x4818cd;if(_0x4701bb[_0xf801('0x3b')][_0xf801('0x50')]){_0x4f390f[_0xf801('0x5c')]=[{'all':!![]}];}return db[_0xf801('0x66')][_0xf801('0x4a')](_0x4f390f);})[_0xf801('0x24')](function(_0x169c80){_0x1df8fa[_0xf801('0x4b')]=_0x169c80;return _0x1df8fa;});}})[_0xf801('0x24')](respondWithFilteredResult(_0x14f66e,_0x4f390f))[_0xf801('0x4c')](handleError(_0x14f66e,null));};exports[_0xf801('0x67')]=function(_0x212081,_0x58670d,_0x72d6c4){var _0x1663b3={'raw':!![],'where':{}};var _0x426430={};var _0x4d4ef6={'count':0x0,'rows':[]};return db[_0xf801('0x37')][_0xf801('0x65')]({'where':{'id':_0x212081[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x58670d,null))[_0xf801('0x24')](function(_0x26105a){if(_0x26105a){_0x426430[_0xf801('0x3e')]=_['keys'](db[_0xf801('0x68')][_0xf801('0x38')]);_0x426430['query']=_[_0xf801('0x3a')](_0x212081[_0xf801('0x3b')]);_0x426430[_0xf801('0x45')]=_[_0xf801('0x3c')](_0x426430[_0xf801('0x3e')],_0x426430['query']);_0x1663b3[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x426430[_0xf801('0x3e')],qs['fields'](_0x212081['query'][_0xf801('0x3f')]));_0x1663b3['attributes']=_0x1663b3['attributes']['length']?_0x1663b3[_0xf801('0x3d')]:_0x426430[_0xf801('0x3e')];if(!_0x212081[_0xf801('0x3b')]['hasOwnProperty']('nolimit')){_0x1663b3[_0xf801('0x20')]=qs['limit'](_0x212081[_0xf801('0x3b')][_0xf801('0x20')]);_0x1663b3[_0xf801('0x41')]=qs['offset'](_0x212081[_0xf801('0x3b')]['offset']);}_0x1663b3['order']=qs[_0xf801('0x43')](_0x212081['query'][_0xf801('0x43')]);_0x1663b3[_0xf801('0x44')]=qs[_0xf801('0x45')](_[_0xf801('0x46')](_0x212081[_0xf801('0x3b')],_0x426430[_0xf801('0x45')]));_0x1663b3[_0xf801('0x44')][_0xf801('0x69')]=_0x26105a['id'];if(_0x212081['query'][_0xf801('0x2a')]){_0x1663b3[_0xf801('0x44')]=_[_0xf801('0x47')](_0x1663b3[_0xf801('0x44')],{'$or':_['map'](_0x1663b3[_0xf801('0x3d')],function(_0x743b96){var _0x20a8ae={};_0x20a8ae[_0x743b96]={'$like':'%'+_0x212081['query']['filter']+'%'};return _0x20a8ae;})});}_0x1663b3=_['merge']({},_0x1663b3,_0x212081[_0xf801('0x49')]);return db['CmHopperFinal'][_0xf801('0x1f')]({'where':_0x1663b3['where']})['then'](function(_0x58016d){_0x4d4ef6[_0xf801('0x1f')]=_0x58016d;if(_0x212081[_0xf801('0x3b')][_0xf801('0x50')]){_0x1663b3[_0xf801('0x5c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xf801('0x4a')](_0x1663b3);})[_0xf801('0x24')](function(_0x1bd2e5){_0x4d4ef6[_0xf801('0x4b')]=_0x1bd2e5;return _0x4d4ef6;});}})['then'](respondWithFilteredResult(_0x58670d,_0x1663b3))['catch'](handleError(_0x58670d,null));};exports[_0xf801('0x6a')]=function(_0xf22519,_0x20eb65,_0x29df30){var _0x30fc85={'raw':!![],'where':{}};var _0x274fd8={};var _0x2e0070={'count':0x0,'rows':[]};return db[_0xf801('0x37')]['findOne']({'where':{'id':_0xf22519[_0xf801('0x4e')]['id']}})['then'](handleEntityNotFound(_0x20eb65,null))['then'](function(_0xc0e2f3){if(_0xc0e2f3){_0x274fd8['model']=_['keys'](db[_0xf801('0x6b')][_0xf801('0x38')]);_0x274fd8['query']=_[_0xf801('0x3a')](_0xf22519[_0xf801('0x3b')]);_0x274fd8[_0xf801('0x45')]=_['intersection'](_0x274fd8['model'],_0x274fd8[_0xf801('0x3b')]);_0x30fc85[_0xf801('0x3d')]=_['intersection'](_0x274fd8[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0xf22519['query'][_0xf801('0x3f')]));_0x30fc85[_0xf801('0x3d')]=_0x30fc85[_0xf801('0x3d')][_0xf801('0x4f')]?_0x30fc85['attributes']:_0x274fd8[_0xf801('0x3e')];if(!_0xf22519[_0xf801('0x3b')][_0xf801('0x62')](_0xf801('0x40'))){_0x30fc85[_0xf801('0x20')]=qs['limit'](_0xf22519[_0xf801('0x3b')][_0xf801('0x20')]);_0x30fc85[_0xf801('0x41')]=qs[_0xf801('0x41')](_0xf22519[_0xf801('0x3b')][_0xf801('0x41')]);}_0x30fc85[_0xf801('0x42')]=qs[_0xf801('0x43')](_0xf22519['query']['sort']);_0x30fc85['where']=qs[_0xf801('0x45')](_[_0xf801('0x46')](_0xf22519['query'],_0x274fd8['filters']));_0x30fc85[_0xf801('0x44')][_0xf801('0x69')]=_0xc0e2f3['id'];if(_0xf22519[_0xf801('0x3b')]['filter']){_0x30fc85['where']=_[_0xf801('0x47')](_0x30fc85[_0xf801('0x44')],{'$or':_['map'](_0x30fc85[_0xf801('0x3d')],function(_0x14f1bd){var _0x5e2f74={};_0x5e2f74[_0x14f1bd]={'$like':'%'+_0xf22519[_0xf801('0x3b')][_0xf801('0x2a')]+'%'};return _0x5e2f74;})});}_0x30fc85=_['merge']({},_0x30fc85,_0xf22519['options']);return db[_0xf801('0x6b')][_0xf801('0x1f')]({'where':_0x30fc85[_0xf801('0x44')]})['then'](function(_0x29bd70){_0x2e0070[_0xf801('0x1f')]=_0x29bd70;if(_0xf22519[_0xf801('0x3b')]['includeAll']){_0x30fc85[_0xf801('0x5c')]=[{'all':!![]}];}return db[_0xf801('0x6b')][_0xf801('0x4a')](_0x30fc85);})[_0xf801('0x24')](function(_0x2b7057){_0x2e0070['rows']=_0x2b7057;return _0x2e0070;});}})[_0xf801('0x24')](respondWithFilteredResult(_0x20eb65,_0x30fc85))['catch'](handleError(_0x20eb65,null));};exports[_0xf801('0x6c')]=function(_0x31127e,_0x1b2313,_0x72709a){var _0x3b3c9b={};var _0x49c390={};var _0x44f619;var _0x26c45e;return db[_0xf801('0x37')][_0xf801('0x65')]({'where':{'id':_0x31127e['params']['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x1b2313,null))[_0xf801('0x24')](function(_0x44865c){if(_0x44865c){_0x44f619=_0x44865c;_0x49c390[_0xf801('0x3e')]=_[_0xf801('0x3a')](db[_0xf801('0x6d')]['rawAttributes']);_0x49c390[_0xf801('0x3b')]=_[_0xf801('0x3a')](_0x31127e['query']);_0x49c390[_0xf801('0x45')]=_[_0xf801('0x3c')](_0x49c390[_0xf801('0x3e')],_0x49c390[_0xf801('0x3b')]);_0x3b3c9b[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x49c390[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0x31127e[_0xf801('0x3b')][_0xf801('0x3f')]));_0x3b3c9b[_0xf801('0x3d')]=_0x3b3c9b[_0xf801('0x3d')]['length']?_0x3b3c9b['attributes']:_0x49c390[_0xf801('0x3e')];_0x3b3c9b['order']=qs['sort'](_0x31127e[_0xf801('0x3b')]['sort']);_0x3b3c9b[_0xf801('0x44')]=qs[_0xf801('0x45')](_[_0xf801('0x46')](_0x31127e[_0xf801('0x3b')],_0x49c390[_0xf801('0x45')]));if(_0x31127e[_0xf801('0x3b')][_0xf801('0x2a')]){_0x3b3c9b[_0xf801('0x44')]=_['merge'](_0x3b3c9b[_0xf801('0x44')],{'$or':_[_0xf801('0x2c')](_0x3b3c9b[_0xf801('0x3d')],function(_0x3336a3){var _0x50ec09={};_0x50ec09[_0x3336a3]={'$like':'%'+_0x31127e['query'][_0xf801('0x2a')]+'%'};return _0x50ec09;})});}_0x3b3c9b=_[_0xf801('0x47')]({},_0x3b3c9b,_0x31127e[_0xf801('0x49')]);return _0x44f619[_0xf801('0x6c')](_0x3b3c9b);}})[_0xf801('0x24')](function(_0x1ea7b7){if(_0x1ea7b7){_0x26c45e=_0x1ea7b7[_0xf801('0x4f')];if(!_0x31127e[_0xf801('0x3b')]['hasOwnProperty']('nolimit')){_0x3b3c9b[_0xf801('0x20')]=qs[_0xf801('0x20')](_0x31127e[_0xf801('0x3b')][_0xf801('0x20')]);_0x3b3c9b[_0xf801('0x41')]=qs[_0xf801('0x41')](_0x31127e[_0xf801('0x3b')]['offset']);}return _0x44f619[_0xf801('0x6c')](_0x3b3c9b);}})[_0xf801('0x24')](function(_0x1dd821){if(_0x1dd821){return _0x1dd821?{'count':_0x26c45e,'rows':_0x1dd821}:null;}})['then'](respondWithResult(_0x1b2313,null))[_0xf801('0x4c')](handleError(_0x1b2313,null));};exports[_0xf801('0x6e')]=function(_0x1b44b7,_0xebd396,_0x3e9e41){var _0x3e0346=_0x1b44b7[_0xf801('0x52')][_0xf801('0x6f')];var _0x25c81d=_[_0xf801('0x2c')](_0x3e0346,'id');return db[_0xf801('0x6d')]['findAll']({'where':{'id':_0x25c81d},'attributes':['id'],'include':[{'model':db[_0xf801('0x70')],'as':_0xf801('0x71'),'attributes':['id',_0xf801('0x31'),_0xf801('0x72'),_0xf801('0x73'),_0xf801('0x74')],'raw':!![]}]})[_0xf801('0x24')](function(_0x3425d2){if(_0x3425d2){var _0x45e1ad=_[_0xf801('0x75')](_0x3425d2,function(_0x2c0a3a){var _0x14eed5=_0x2c0a3a[_0xf801('0x26')]({'plain':!![]});_0x14eed5['Agents'][_0xf801('0x76')](function(_0x1429c5){_0x1429c5[_0xf801('0x77')]=_['find'](_0x3e0346,{'id':_0x14eed5['id']})[_0xf801('0x77')];});return _0x14eed5['Agents'];});return db[_0xf801('0x37')][_0xf801('0x30')]({'where':{'id':_0x1b44b7[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](function(_0x3dd8af){return db[_0xf801('0x78')][_0xf801('0x79')](function(_0x591402){return _0x3dd8af['addTeams'](_0x25c81d,{'transaction':_0x591402})['then'](function(){return BPromise[_0xf801('0x7a')](_0x45e1ad,function(_0x46718b){return db[_0xf801('0x7b')][_0xf801('0x7c')]({'where':{'UserId':_0x46718b['id'],'VoiceQueueId':_0x1b44b7[_0xf801('0x4e')]['id']},'defaults':{'penalty':_0x46718b[_0xf801('0x77')]},'transaction':_0x591402});});})['then'](function(){return BPromise['each'](_[_0xf801('0x2a')](_0x45e1ad,{'online':!![]}),function(_0x27d252){return db[_0xf801('0x7d')]['upsert']({'membername':_0x27d252[_0xf801('0x31')],'UserId':_0x27d252['id'],'queue_name':_0x3dd8af['name'],'VoiceQueueId':_0x3dd8af['id'],'interface':_[_0xf801('0x7e')](_0x27d252['interface'])?util[_0xf801('0x7f')](_0xf801('0x80'),_0x27d252[_0xf801('0x31')]):_0x27d252[_0xf801('0x74')],'paused':_0x27d252[_0xf801('0x73')]||![],'penalty':_0x27d252[_0xf801('0x77')]},{'transaction':_0x591402});});})[_0xf801('0x24')](function(){_0x45e1ad[_0xf801('0x76')](function(_0x4254bf){socket[_0xf801('0x81')](_0xf801('0x82'),{'UserId':_0x4254bf['id'],'VoiceQueueId':_0x3dd8af['id']});});});});});}})[_0xf801('0x24')](respondWithStatusCode(_0xebd396,null))[_0xf801('0x4c')](handleError(_0xebd396,null));};exports[_0xf801('0x83')]=function(_0x83f20f,_0x58dff5,_0x18c784){return db[_0xf801('0x6d')][_0xf801('0x4a')]({'where':{'id':_0x83f20f[_0xf801('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf801('0x70')],'as':_0xf801('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x58dff5,null))['then'](function(_0x18c5ac){var _0x41670f=_[_0xf801('0x2c')](_0x18c5ac,'id');var _0x631971=[];var _0x1e7228=[];var _0x46f9b5=squel[_0xf801('0x84')]();_0x46f9b5['field']('tq.TeamId')['from'](_0xf801('0x85'),'tq')[_0xf801('0x86')]('user_has_teams','ut',_0xf801('0x87'))[_0xf801('0x44')](_0xf801('0x88'),_0x83f20f[_0xf801('0x4e')]['id']);for(var _0x3182d9=0x0;_0x3182d9<_0x18c5ac[_0xf801('0x4f')];_0x3182d9+=0x1){let _0x549361=_0x18c5ac[_0x3182d9];for(var _0x157545=0x0;_0x157545<_0x549361['Agents'][_0xf801('0x4f')];_0x157545+=0x1){let _0x5814c7=_0x549361[_0xf801('0x71')][_0x157545];var _0x26cb5d=_0x46f9b5[_0xf801('0x5b')]();_0x26cb5d['where'](_0xf801('0x89'),_0x5814c7['id']);_0x1e7228['push'](db['sequelize'][_0xf801('0x3b')](_0x26cb5d[_0xf801('0x8a')](),{'type':db[_0xf801('0x78')][_0xf801('0x8b')][_0xf801('0x8c')]})[_0xf801('0x24')](function(_0x44f80f){if(_0x44f80f[_0xf801('0x4f')]===0x1){return _0x5814c7['id'];}else{var _0x440b4b=_['every'](_[_0xf801('0x2c')](_0x44f80f,_0xf801('0x8d')),function(_0x502297){return _[_0xf801('0x2e')](_0x41670f,_0x502297);});if(_0x440b4b){return _0x5814c7['id'];}}}));}}return BPromise[_0xf801('0x8e')](_0x1e7228)[_0xf801('0x24')](function(_0x30ae90){_0x631971=_(_0x631971)[_0xf801('0x8f')](_0x30ae90)[_0xf801('0x90')]()[_0xf801('0x2d')]();return db[_0xf801('0x37')]['find']({'where':{'id':_0x83f20f[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](function(_0x1d4823){return db[_0xf801('0x78')]['transaction'](function(_0x5c775d){return _0x1d4823[_0xf801('0x83')](_0x83f20f[_0xf801('0x3b')][_0xf801('0x91')],{'transaction':_0x5c775d})[_0xf801('0x24')](function(){if(!_['isEmpty'](_0x631971)){return _0x1d4823[_0xf801('0x92')](_0x631971,{'transaction':_0x5c775d})[_0xf801('0x24')](function(){return db[_0xf801('0x7d')][_0xf801('0x25')]({'where':{'VoiceQueueId':_0x83f20f[_0xf801('0x4e')]['id'],'UserId':_0x631971},'transaction':_0x5c775d});});}})[_0xf801('0x24')](function(){_0x631971[_0xf801('0x76')](function(_0x2558a7){socket[_0xf801('0x81')](_0xf801('0x93'),{'UserId':_0x2558a7,'VoiceQueueId':_0x1d4823['id']});});});});});});})[_0xf801('0x24')](respondWithStatusCode(_0x58dff5,null))[_0xf801('0x4c')](handleError(_0x58dff5,null));};exports['addAgents']=function(_0x5b9884,_0x18e313,_0x2bcdb5){var _0x3466e1,_0x13c76f;return db['VoiceQueue'][_0xf801('0x30')]({'where':{'id':_0x5b9884['params']['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x18e313,null))['then'](function(_0x467b43){if(_0x467b43){_0x13c76f=_0x467b43;return _0x467b43['addAgents'](_0x5b9884[_0xf801('0x52')]['ids'],_['omit'](_0x5b9884[_0xf801('0x52')],[_0xf801('0x91'),'id'])||{})['spread'](function(_0x341d81){for(var _0x5519a5=0x0;_0x5519a5<_0x5b9884[_0xf801('0x52')][_0xf801('0x91')][_0xf801('0x4f')];_0x5519a5+=0x1){socket[_0xf801('0x81')](_0xf801('0x82'),{'UserId':_0x5b9884[_0xf801('0x52')][_0xf801('0x91')][_0x5519a5],'VoiceQueueId':_0x5b9884[_0xf801('0x4e')]['id']});}return _0x341d81;});}})[_0xf801('0x24')](function(_0x24bf71){_0x3466e1=_0x24bf71||[];if(_0x13c76f){return db[_0xf801('0x70')][_0xf801('0x4a')]({'where':{'id':_0x5b9884['body'][_0xf801('0x91')]},'attributes':['id',_0xf801('0x31'),'online',_0xf801('0x73'),_0xf801('0x74')],'raw':!![]});}})[_0xf801('0x24')](function(_0x3e81e8){if(!_[_0xf801('0x94')](_0x3e81e8)){var _0x141143=[];for(var _0x117b7e=0x0;_0x117b7e<_0x3e81e8[_0xf801('0x4f')];_0x117b7e++){if(_0x3e81e8[_0x117b7e][_0xf801('0x72')]){_0x141143[_0xf801('0x95')](db['UserVoiceQueueRt'][_0xf801('0x96')]({'membername':_0x3e81e8[_0x117b7e][_0xf801('0x31')],'UserId':_0x3e81e8[_0x117b7e]['id'],'queue_name':_0x13c76f['name'],'VoiceQueueId':_0x13c76f['id'],'interface':_[_0xf801('0x7e')](_0x3e81e8[_0x117b7e][_0xf801('0x74')])?util[_0xf801('0x7f')](_0xf801('0x80'),_0x3e81e8[_0x117b7e][_0xf801('0x31')]):_0x3e81e8[_0x117b7e]['interface'],'paused':_0x3e81e8[_0x117b7e]['voicePause']||![],'penalty':_0x5b9884[_0xf801('0x52')][_0xf801('0x77')]||0x0}));}}return BPromise[_0xf801('0x8e')](_0x141143);}})[_0xf801('0x24')](function(){return _0x3466e1;})['then'](respondWithResult(_0x18e313,null))[_0xf801('0x4c')](handleError(_0x18e313,null));};exports['removeAgents']=function(_0x4dc78c,_0x42744d,_0x112dcc){return db[_0xf801('0x37')][_0xf801('0x30')]({'where':{'id':_0x4dc78c[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x42744d,null))[_0xf801('0x24')](function(_0x551098){if(_0x551098){return _0x551098[_0xf801('0x92')](_0x4dc78c[_0xf801('0x3b')][_0xf801('0x91')])[_0xf801('0x24')](function(){if(_[_0xf801('0x97')](_0x4dc78c['query']['ids'])){for(var _0x32b1a8=0x0;_0x32b1a8<_0x4dc78c['query'][_0xf801('0x91')][_0xf801('0x4f')];_0x32b1a8+=0x1){socket[_0xf801('0x81')](_0xf801('0x93'),{'UserId':Number(_0x4dc78c[_0xf801('0x3b')][_0xf801('0x91')][_0x32b1a8]),'VoiceQueueId':Number(_0x4dc78c['params']['id'])});}}else{socket[_0xf801('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x4dc78c[_0xf801('0x3b')][_0xf801('0x91')]),'VoiceQueueId':Number(_0x4dc78c[_0xf801('0x4e')]['id'])});}});}})[_0xf801('0x24')](function(_0x35ad1d){return db[_0xf801('0x7d')][_0xf801('0x25')]({'where':{'VoiceQueueId':_0x4dc78c[_0xf801('0x4e')]['id'],'UserId':_0x4dc78c[_0xf801('0x3b')][_0xf801('0x91')]}})[_0xf801('0x24')](function(){return _0x35ad1d;});})[_0xf801('0x24')](respondWithStatusCode(_0x42744d,null))[_0xf801('0x4c')](handleError(_0x42744d,null));};exports[_0xf801('0x98')]=function(_0x16af23,_0xaa5b6f,_0x1facd1){var _0x308fe5={};var _0x4f7687={};var _0xd8488c;var _0x176843;return db[_0xf801('0x37')][_0xf801('0x65')]({'where':{'id':_0x16af23[_0xf801('0x4e')]['id']}})['then'](handleEntityNotFound(_0xaa5b6f,null))['then'](function(_0x3bc9c8){if(_0x3bc9c8){_0xd8488c=_0x3bc9c8;_0x4f7687[_0xf801('0x3e')]=_[_0xf801('0x3a')](db['User']['rawAttributes']);_0x4f7687[_0xf801('0x3b')]=_[_0xf801('0x3a')](_0x16af23[_0xf801('0x3b')]);_0x4f7687['filters']=_[_0xf801('0x3c')](_0x4f7687['model'],_0x4f7687['query']);_0x308fe5[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x4f7687[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0x16af23[_0xf801('0x3b')][_0xf801('0x3f')]));_0x308fe5[_0xf801('0x3d')]=_0x308fe5[_0xf801('0x3d')][_0xf801('0x4f')]?_0x308fe5[_0xf801('0x3d')]:_0x4f7687[_0xf801('0x3e')];_0x308fe5[_0xf801('0x42')]=qs[_0xf801('0x43')](_0x16af23[_0xf801('0x3b')][_0xf801('0x43')]);_0x308fe5[_0xf801('0x44')]=qs['filters'](_['pick'](_0x16af23['query'],_0x4f7687[_0xf801('0x45')]));if(_0x16af23[_0xf801('0x3b')][_0xf801('0x2a')]){_0x308fe5['where']=_['merge'](_0x308fe5[_0xf801('0x44')],{'$or':_[_0xf801('0x2c')](_0x308fe5[_0xf801('0x3d')],function(_0x372aa9){var _0x502000={};_0x502000[_0x372aa9]={'$like':'%'+_0x16af23['query']['filter']+'%'};return _0x502000;})});}_0x308fe5=_['merge']({},_0x308fe5,_0x16af23[_0xf801('0x49')]);return _0xd8488c['getAgents'](_0x308fe5);}})[_0xf801('0x24')](function(_0x505ea8){if(_0x505ea8){_0x176843=_0x505ea8[_0xf801('0x4f')];if(!_0x16af23[_0xf801('0x3b')]['hasOwnProperty'](_0xf801('0x40'))){_0x308fe5['limit']=qs['limit'](_0x16af23[_0xf801('0x3b')][_0xf801('0x20')]);_0x308fe5[_0xf801('0x41')]=qs[_0xf801('0x41')](_0x16af23[_0xf801('0x3b')][_0xf801('0x41')]);}return _0xd8488c['getAgents'](_0x308fe5);}})[_0xf801('0x24')](function(_0x5ce992){if(_0x5ce992){return _0x5ce992?{'count':_0x176843,'rows':_0x5ce992}:null;}})['then'](respondWithResult(_0xaa5b6f,null))[_0xf801('0x4c')](handleError(_0xaa5b6f,null));};exports[_0xf801('0x99')]=function(_0xaf527a,_0x1878a7,_0x1e7708){var _0x41a430={};var _0x4b2e36={};var _0x1a1904;var _0x506cc7;return db[_0xf801('0x37')][_0xf801('0x65')]({'where':{'id':_0xaf527a[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x1878a7,null))[_0xf801('0x24')](function(_0xd9e100){if(_0xd9e100){_0x1a1904=_0xd9e100;_0x4b2e36[_0xf801('0x3e')]=_['keys'](db[_0xf801('0x7d')]['rawAttributes']);_0x4b2e36['query']=_[_0xf801('0x3a')](_0xaf527a[_0xf801('0x3b')]);_0x4b2e36[_0xf801('0x45')]=_[_0xf801('0x3c')](_0x4b2e36['model'],_0x4b2e36['query']);_0x41a430[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x4b2e36[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0xaf527a['query'][_0xf801('0x3f')]));_0x41a430['attributes']=_0x41a430[_0xf801('0x3d')][_0xf801('0x4f')]?_0x41a430['attributes']:_0x4b2e36['model'];_0x41a430[_0xf801('0x42')]=qs[_0xf801('0x43')](_0xaf527a['query'][_0xf801('0x43')]);_0x41a430[_0xf801('0x44')]=qs[_0xf801('0x45')](_[_0xf801('0x46')](_0xaf527a[_0xf801('0x3b')],_0x4b2e36[_0xf801('0x45')]));if(_0xaf527a[_0xf801('0x3b')][_0xf801('0x2a')]){_0x41a430['where']=_[_0xf801('0x47')](_0x41a430[_0xf801('0x44')],{'$or':_['map'](_0x41a430[_0xf801('0x3d')],function(_0x4cef45){var _0x57b5e3={};_0x57b5e3[_0x4cef45]={'$like':'%'+_0xaf527a[_0xf801('0x3b')][_0xf801('0x2a')]+'%'};return _0x57b5e3;})});}_0x41a430=_[_0xf801('0x47')]({},_0x41a430,_0xaf527a['options']);return _0x1a1904[_0xf801('0x99')](_0x41a430);}})[_0xf801('0x24')](function(_0x124ef7){if(_0x124ef7){_0x506cc7=_0x124ef7[_0xf801('0x4f')];if(!_0xaf527a[_0xf801('0x3b')][_0xf801('0x62')](_0xf801('0x40'))){_0x41a430[_0xf801('0x20')]=qs[_0xf801('0x20')](_0xaf527a['query'][_0xf801('0x20')]);_0x41a430['offset']=qs[_0xf801('0x41')](_0xaf527a['query'][_0xf801('0x41')]);}return _0x1a1904['getMembers'](_0x41a430);}})[_0xf801('0x24')](function(_0x1a9689){return _0x1a9689?{'count':_0x506cc7,'rows':_0x1a9689}:null;})[_0xf801('0x24')](respondWithResult(_0x1878a7,null))['catch'](handleError(_0x1878a7,null));};exports[_0xf801('0x9a')]=function(_0x209bb3,_0x3902e7,_0x49a9f8){var _0x1b7008={};var _0x515f50={};var _0x38d91b;var _0x3d066a;return db['VoiceQueue'][_0xf801('0x65')]({'where':{'id':_0x209bb3[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x3902e7,null))[_0xf801('0x24')](function(_0x223d73){if(_0x223d73){_0x38d91b=_0x223d73;_0x515f50['model']=_[_0xf801('0x3a')](db[_0xf801('0x9b')][_0xf801('0x38')]);_0x515f50['query']=_[_0xf801('0x3a')](_0x209bb3[_0xf801('0x3b')]);_0x515f50[_0xf801('0x45')]=_[_0xf801('0x3c')](_0x515f50['model'],_0x515f50[_0xf801('0x3b')]);_0x1b7008[_0xf801('0x3d')]=_[_0xf801('0x3c')](_0x515f50[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0x209bb3[_0xf801('0x3b')][_0xf801('0x3f')]));_0x1b7008['attributes']=_0x1b7008[_0xf801('0x3d')][_0xf801('0x4f')]?_0x1b7008[_0xf801('0x3d')]:_0x515f50[_0xf801('0x3e')];_0x1b7008['order']=qs[_0xf801('0x43')](_0x209bb3['query'][_0xf801('0x43')]);_0x1b7008['where']=qs[_0xf801('0x45')](_[_0xf801('0x46')](_0x209bb3['query'],_0x515f50[_0xf801('0x45')]));if(_0x209bb3[_0xf801('0x3b')][_0xf801('0x2a')]){_0x1b7008[_0xf801('0x44')]=_[_0xf801('0x47')](_0x1b7008[_0xf801('0x44')],{'$or':_[_0xf801('0x2c')](_0x1b7008[_0xf801('0x3d')],function(_0x456120){var _0x1747ce={};_0x1747ce[_0x456120]={'$like':'%'+_0x209bb3[_0xf801('0x3b')][_0xf801('0x2a')]+'%'};return _0x1747ce;})});}_0x1b7008=_['merge']({},_0x1b7008,_0x209bb3['options']);return _0x38d91b[_0xf801('0x9a')](_0x1b7008);}})[_0xf801('0x24')](function(_0x405e03){if(_0x405e03){_0x3d066a=_0x405e03[_0xf801('0x4f')];if(!_0x209bb3[_0xf801('0x3b')][_0xf801('0x62')]('nolimit')){_0x1b7008[_0xf801('0x20')]=qs[_0xf801('0x20')](_0x209bb3[_0xf801('0x3b')][_0xf801('0x20')]);_0x1b7008[_0xf801('0x41')]=qs['offset'](_0x209bb3[_0xf801('0x3b')][_0xf801('0x41')]);}return _0x38d91b[_0xf801('0x9a')](_0x1b7008);}})[_0xf801('0x24')](function(_0x592e4b){if(_0x592e4b){return _0x592e4b?{'count':_0x3d066a,'rows':_0x592e4b}:null;}})[_0xf801('0x24')](respondWithResult(_0x3902e7,null))[_0xf801('0x4c')](handleError(_0x3902e7,null));};exports['addLists']=function(_0x14e3c9,_0x446eba,_0xe902e0){var _0xada8c4,_0x4b716c;return db[_0xf801('0x37')][_0xf801('0x30')]({'where':{'id':_0x14e3c9[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x446eba,null))[_0xf801('0x24')](function(_0x3dbc2c){if(_0x3dbc2c){_0x4b716c=_0x3dbc2c;return _0x3dbc2c['addLists'](_0x14e3c9[_0xf801('0x52')][_0xf801('0x91')],_[_0xf801('0x5d')](_0x14e3c9[_0xf801('0x52')],[_0xf801('0x91'),'id'])||{});}return null;})[_0xf801('0x9c')](function(_0xd99ad4){var _0x104727;_0xada8c4=_0xd99ad4||[];var _0x3f72b4=[];if(_0xd99ad4){for(var _0x2e5481=0x0;_0x2e5481<_0xd99ad4[_0xf801('0x4f')];_0x2e5481+=0x1){var _0x1d9646=_0xd99ad4[_0x2e5481][_0xf801('0x26')]({'plain':!![]});_0x4b716c[_0xf801('0x9d')]=_0x14e3c9[_0xf801('0x52')][_0xf801('0x9d')]?_0x14e3c9[_0xf801('0x52')][_0xf801('0x9d')]:_0x4b716c[_0xf801('0x9d')];switch(_0x4b716c[_0xf801('0x9d')]){case _0xf801('0x9e'):_0x104727=squel[_0xf801('0x9f')]()[_0xf801('0xa0')]('cm_hopper')[_0xf801('0xa1')]([_0xf801('0xa2'),_0xf801('0xa3'),_0xf801('0xa4'),_0xf801('0xa5'),_0xf801('0x69'),_0xf801('0x5e'),_0xf801('0x5f')],squel[_0xf801('0x84')]()['field'](_0xf801('0xa2'),_0xf801('0xa2'))[_0xf801('0xa6')](_0xf801('0xa7'),_0xf801('0xa3'))[_0xf801('0xa6')]('id','ContactId')['field'](_0x1d9646[_0xf801('0xa8')]['toString'](),_0xf801('0xa5'))[_0xf801('0xa6')](_0x14e3c9[_0xf801('0x4e')]['id'][_0xf801('0x8a')](),_0xf801('0x69'))[_0xf801('0xa6')](_0xf801('0xa7'),_0xf801('0x5e'))['field'](_0xf801('0xa7'),_0xf801('0x5f'))['from'](_0xf801('0xa9'))[_0xf801('0x44')](_0xf801('0xaa'))[_0xf801('0x44')](_0xf801('0xab'),_0x1d9646[_0xf801('0xa8')]['toString']())['where'](_0xf801('0xac'))[_0xf801('0x44')](_0xf801('0xad'),squel[_0xf801('0x84')]()[_0xf801('0xa6')](_0xf801('0xae'))[_0xf801('0xaf')](_0xf801('0xb0'))[_0xf801('0x44')](_0xf801('0x88'),_0x14e3c9['params']['id'][_0xf801('0x8a')]()))['where'](_0xf801('0xad'),squel[_0xf801('0x84')]()[_0xf801('0xa6')](_0xf801('0xb1'))[_0xf801('0xaf')](_0xf801('0xb2'))[_0xf801('0x44')](_0xf801('0x88'),_0x14e3c9[_0xf801('0x4e')]['id'][_0xf801('0x8a')]())))[_0xf801('0x8a')]();break;case _0xf801('0xb3'):_0x104727=squel['insert']()[_0xf801('0xa0')](_0xf801('0xb2'))[_0xf801('0xa1')]([_0xf801('0xa2'),_0xf801('0xa3'),_0xf801('0xa4'),_0xf801('0xa5'),_0xf801('0x69'),_0xf801('0x5e'),_0xf801('0x5f')],squel[_0xf801('0x84')]()['field'](_0xf801('0xa2'),_0xf801('0xa2'))[_0xf801('0xa6')](_0xf801('0xa7'),_0xf801('0xa3'))[_0xf801('0xa6')]('id','ContactId')['field'](_0x1d9646['CmListId'][_0xf801('0x8a')](),_0xf801('0xa5'))['field'](_0x14e3c9[_0xf801('0x4e')]['id'][_0xf801('0x8a')](),'VoiceQueueId')[_0xf801('0xa6')]('NOW()',_0xf801('0x5e'))[_0xf801('0xa6')]('NOW()',_0xf801('0x5f'))[_0xf801('0xaf')](_0xf801('0xa9'))[_0xf801('0x44')](_0xf801('0xaa'))[_0xf801('0x44')]('ListId\x20=\x20?',_0x1d9646[_0xf801('0xa8')][_0xf801('0x8a')]())[_0xf801('0x44')](_0xf801('0xac'))[_0xf801('0x44')](_0xf801('0xad'),squel[_0xf801('0x84')]()[_0xf801('0xa6')]('COALESCE(phone,\x27\x27)')['from'](_0xf801('0xb2'))[_0xf801('0x44')]('VoiceQueueId\x20=\x20?',_0x14e3c9[_0xf801('0x4e')]['id'][_0xf801('0x8a')]())))['toString']();break;default:_0x104727=squel[_0xf801('0x9f')]()[_0xf801('0xa0')]('cm_hopper')['fromQuery']([_0xf801('0xa2'),_0xf801('0xa3'),'ContactId','ListId',_0xf801('0x69'),_0xf801('0x5e'),_0xf801('0x5f')],squel['select']()['field'](_0xf801('0xa2'),_0xf801('0xa2'))['field'](_0xf801('0xa7'),'scheduledAt')[_0xf801('0xa6')]('id','ContactId')['field'](_0x1d9646[_0xf801('0xa8')][_0xf801('0x8a')](),'ListId')[_0xf801('0xa6')](_0x14e3c9[_0xf801('0x4e')]['id']['toString'](),_0xf801('0x69'))[_0xf801('0xa6')](_0xf801('0xa7'),_0xf801('0x5e'))[_0xf801('0xa6')](_0xf801('0xa7'),_0xf801('0x5f'))[_0xf801('0xaf')](_0xf801('0xa9'))[_0xf801('0x44')](_0xf801('0xaa'))['where'](_0xf801('0xab'),_0x1d9646[_0xf801('0xa8')][_0xf801('0x8a')]())[_0xf801('0x44')](_0xf801('0xac')))['toString']();}_0x3f72b4[_0xf801('0x95')](db[_0xf801('0x78')][_0xf801('0x3b')](_0x104727));}return BPromise[_0xf801('0x8e')](_0x3f72b4);}})[_0xf801('0x24')](function(){return _0xada8c4;})[_0xf801('0x24')](respondWithResult(_0x446eba,null))[_0xf801('0x4c')](handleError(_0x446eba,null));};exports[_0xf801('0xb4')]=function(_0x2d8b86,_0xb1b9ac,_0x21fb17){return db[_0xf801('0x37')][_0xf801('0x30')]({'where':{'id':_0x2d8b86[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0xb1b9ac,null))[_0xf801('0x24')](function(_0x2ef76e){if(_0x2ef76e){return _0x2ef76e[_0xf801('0xb4')](_0x2d8b86[_0xf801('0x3b')]['ids']);}})[_0xf801('0x24')](function(_0x17538f){if(_0x17538f){return db[_0xf801('0x63')][_0xf801('0x25')]({'where':{'ListId':_0x2d8b86[_0xf801('0x3b')]['ids'],'VoiceQueueId':_0x2d8b86['params']['id']}})[_0xf801('0x24')](function(){return _0x17538f;});}})['then'](respondWithStatusCode(_0xb1b9ac,null))[_0xf801('0x4c')](handleError(_0xb1b9ac,null));};exports[_0xf801('0xb5')]=function(_0x487955,_0x1a37a2,_0x224bfd){var _0x291b8a={};var _0x15df6f={};var _0x59710a;var _0x124c43;return db[_0xf801('0x37')][_0xf801('0x65')]({'where':{'id':_0x487955[_0xf801('0x4e')]['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x1a37a2,null))[_0xf801('0x24')](function(_0x257d85){if(_0x257d85){_0x59710a=_0x257d85;_0x15df6f[_0xf801('0x3e')]=_[_0xf801('0x3a')](db[_0xf801('0x9b')][_0xf801('0x38')]);_0x15df6f[_0xf801('0x3b')]=_[_0xf801('0x3a')](_0x487955[_0xf801('0x3b')]);_0x15df6f[_0xf801('0x45')]=_[_0xf801('0x3c')](_0x15df6f[_0xf801('0x3e')],_0x15df6f[_0xf801('0x3b')]);_0x291b8a['attributes']=_[_0xf801('0x3c')](_0x15df6f[_0xf801('0x3e')],qs[_0xf801('0x3f')](_0x487955['query'][_0xf801('0x3f')]));_0x291b8a[_0xf801('0x3d')]=_0x291b8a[_0xf801('0x3d')]['length']?_0x291b8a[_0xf801('0x3d')]:_0x15df6f['model'];_0x291b8a[_0xf801('0x42')]=qs[_0xf801('0x43')](_0x487955['query'][_0xf801('0x43')]);_0x291b8a[_0xf801('0x44')]=qs[_0xf801('0x45')](_[_0xf801('0x46')](_0x487955[_0xf801('0x3b')],_0x15df6f['filters']));if(_0x487955['query']['filter']){_0x291b8a[_0xf801('0x44')]=_[_0xf801('0x47')](_0x291b8a[_0xf801('0x44')],{'$or':_[_0xf801('0x2c')](_0x291b8a['attributes'],function(_0x114873){var _0x4709a0={};_0x4709a0[_0x114873]={'$like':'%'+_0x487955[_0xf801('0x3b')][_0xf801('0x2a')]+'%'};return _0x4709a0;})});}_0x291b8a=_[_0xf801('0x47')]({},_0x291b8a,_0x487955[_0xf801('0x49')]);return _0x59710a[_0xf801('0xb5')](_0x291b8a);}})['then'](function(_0x14471b){if(_0x14471b){_0x124c43=_0x14471b[_0xf801('0x4f')];if(!_0x487955[_0xf801('0x3b')][_0xf801('0x62')](_0xf801('0x40'))){_0x291b8a[_0xf801('0x20')]=qs[_0xf801('0x20')](_0x487955[_0xf801('0x3b')][_0xf801('0x20')]);_0x291b8a[_0xf801('0x41')]=qs[_0xf801('0x41')](_0x487955[_0xf801('0x3b')]['offset']);}return _0x59710a[_0xf801('0xb5')](_0x291b8a);}})[_0xf801('0x24')](function(_0x134b8e){if(_0x134b8e){return _0x134b8e?{'count':_0x124c43,'rows':_0x134b8e}:null;}})[_0xf801('0x24')](respondWithResult(_0x1a37a2,null))[_0xf801('0x4c')](handleError(_0x1a37a2,null));};exports[_0xf801('0xb6')]=function(_0x892e5e,_0x48c4be,_0x5535b3){var _0x177346,_0x1b3ee6;return db[_0xf801('0x37')]['find']({'where':{'id':_0x892e5e['params']['id']}})[_0xf801('0x24')](handleEntityNotFound(_0x48c4be,null))[_0xf801('0x24')](function(_0x5a20e0){if(_0x5a20e0){_0x1b3ee6=_0x5a20e0;return _0x5a20e0[_0xf801('0xb6')](_0x892e5e['body'][_0xf801('0x91')],_[_0xf801('0x5d')](_0x892e5e[_0xf801('0x52')],[_0xf801('0x91'),'id'])||{});}return null;})['spread'](function(_0x8a0268){var _0x1b1a25;_0x177346=_0x8a0268||[];var _0x2bc330=[];if(_0x8a0268){for(var _0x37e6ed=0x0;_0x37e6ed<_0x8a0268[_0xf801('0x4f')];_0x37e6ed+=0x1){var _0xe5fc2a=_0x8a0268[_0x37e6ed][_0xf801('0x26')]({'plain':!![]});_0x1b1a25=squel[_0xf801('0x9f')]()[_0xf801('0xa0')](_0xf801('0xb7'))[_0xf801('0xa1')](['phone',_0xf801('0xa4'),_0xf801('0xa5'),'VoiceQueueId',_0xf801('0x5e'),_0xf801('0x5f')],squel[_0xf801('0x84')]()[_0xf801('0xa6')]('phone',_0xf801('0xa2'))[_0xf801('0xa6')]('id',_0xf801('0xa4'))[_0xf801('0xa6')](_0xe5fc2a[_0xf801('0xa8')][_0xf801('0x8a')](),_0xf801('0xa5'))[_0xf801('0xa6')](_0x892e5e['params']['id']['toString'](),_0xf801('0x69'))[_0xf801('0xa6')](_0xf801('0xa7'),_0xf801('0x5e'))[_0xf801('0xa6')](_0xf801('0xa7'),'updatedAt')['from']('cm_contacts')['where'](_0xf801('0xaa'))[_0xf801('0x44')](_0xf801('0xab'),_0xe5fc2a[_0xf801('0xa8')][_0xf801('0x8a')]())[_0xf801('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x2bc330[_0xf801('0x95')](db[_0xf801('0x78')][_0xf801('0x3b')](_0x1b1a25));}return BPromise[_0xf801('0x8e')](_0x2bc330);}})['then'](function(){return _0x177346;})['then'](respondWithResult(_0x48c4be,null))['catch'](handleError(_0x48c4be,null));};exports['removeBlackLists']=function(_0x370a83,_0x47b50d,_0x537e6f){return db['VoiceQueue'][_0xf801('0x30')]({'where':{'id':_0x370a83['params']['id']}})['then'](handleEntityNotFound(_0x47b50d,null))[_0xf801('0x24')](function(_0x20e613){if(_0x20e613){return _0x20e613['removeBlackLists'](_0x370a83['query'][_0xf801('0x91')]);}})[_0xf801('0x24')](function(_0x1eeab6){if(_0x1eeab6){return db[_0xf801('0x6b')][_0xf801('0x25')]({'where':{'ListId':_0x370a83[_0xf801('0x3b')][_0xf801('0x91')],'VoiceQueueId':_0x370a83['params']['id']}})[_0xf801('0x24')](function(){return _0x1eeab6;});}})[_0xf801('0x24')](respondWithStatusCode(_0x47b50d,null))['catch'](handleError(_0x47b50d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index d95070b..22a370d 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 _0xeb48=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x383d04,_0x5d2472){var _0x58d003=function(_0x56f935){while(--_0x56f935){_0x383d04['push'](_0x383d04['shift']());}};_0x58d003(++_0x5d2472);}(_0xeb48,0x111));var _0x8eb4=function(_0x37272e,_0x393951){_0x37272e=_0x37272e-0x0;var _0x24ed60=_0xeb48[_0x37272e];return _0x24ed60;};'use strict';var EventEmitter=require(_0x8eb4('0x0'));var VoiceQueue=require(_0x8eb4('0x1'))['db'][_0x8eb4('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8eb4('0x3')](0x0);var events={'afterCreate':_0x8eb4('0x4'),'afterUpdate':_0x8eb4('0x5'),'afterDestroy':_0x8eb4('0x6')};function emitEvent(_0x3f9391){return function(_0x2cb4eb,_0x28b414,_0x2014fb){VoiceQueueEvents[_0x8eb4('0x7')](_0x3f9391+':'+_0x2cb4eb['id'],_0x2cb4eb);VoiceQueueEvents[_0x8eb4('0x7')](_0x3f9391,_0x2cb4eb);_0x2014fb(null);};}for(var e in events){if(events[_0x8eb4('0x8')](e)){var event=events[e];VoiceQueue[_0x8eb4('0x9')](e,emitEvent(event));}}module[_0x8eb4('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x49d9=['remove','emit','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x1097ab,_0x37fce2){var _0x416667=function(_0x3ff972){while(--_0x3ff972){_0x1097ab['push'](_0x1097ab['shift']());}};_0x416667(++_0x37fce2);}(_0x49d9,0x10c));var _0x949d=function(_0x36b2e1,_0x1e5a46){_0x36b2e1=_0x36b2e1-0x0;var _0x20c428=_0x49d9[_0x36b2e1];return _0x20c428;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x949d('0x0'))['db'][_0x949d('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x949d('0x2')](0x0);var events={'afterCreate':_0x949d('0x3'),'afterUpdate':'update','afterDestroy':_0x949d('0x4')};function emitEvent(_0x4d5dfa){return function(_0x79fcb6,_0x1cf0bd,_0x510a70){VoiceQueueEvents[_0x949d('0x5')](_0x4d5dfa+':'+_0x79fcb6['id'],_0x79fcb6);VoiceQueueEvents['emit'](_0x4d5dfa,_0x79fcb6);_0x510a70(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x949d('0x6')](e,emitEvent(event));}}module[_0x949d('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 7c52a15..42da047 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 _0xf72f=['../../config/environment','./voiceQueue.attributes','exports','voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2290b0,_0x37e5ed){var _0x4b0002=function(_0x1366b4){while(--_0x1366b4){_0x2290b0['push'](_0x2290b0['shift']());}};_0x4b0002(++_0x37e5ed);}(_0xf72f,0x122));var _0xff72=function(_0x3a8811,_0x2ac931){_0x3a8811=_0x3a8811-0x0;var _0x5aa84=_0xf72f[_0x3a8811];return _0x5aa84;};'use strict';var _=require(_0xff72('0x0'));var util=require('util');var logger=require(_0xff72('0x1'))(_0xff72('0x2'));var moment=require(_0xff72('0x3'));var BPromise=require(_0xff72('0x4'));var rp=require(_0xff72('0x5'));var fs=require('fs');var path=require(_0xff72('0x6'));var rimraf=require('rimraf');var config=require(_0xff72('0x7'));var attributes=require(_0xff72('0x8'));module[_0xff72('0x9')]=function(_0x2b0ed3,_0x148598){return _0x2b0ed3['define']('VoiceQueue',attributes,{'tableName':_0xff72('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2573=['../../config/environment','define','VoiceQueue','voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2a0fda,_0x2dcb3c){var _0xb36396=function(_0x22b7da){while(--_0x22b7da){_0x2a0fda['push'](_0x2a0fda['shift']());}};_0xb36396(++_0x2dcb3c);}(_0x2573,0xd0));var _0x3257=function(_0x423e75,_0x46e7e5){_0x423e75=_0x423e75-0x0;var _0x5f4711=_0x2573[_0x423e75];return _0x5f4711;};'use strict';var _=require(_0x3257('0x0'));var util=require(_0x3257('0x1'));var logger=require('../../config/logger')(_0x3257('0x2'));var moment=require(_0x3257('0x3'));var BPromise=require(_0x3257('0x4'));var rp=require(_0x3257('0x5'));var fs=require('fs');var path=require(_0x3257('0x6'));var rimraf=require(_0x3257('0x7'));var config=require(_0x3257('0x8'));var attributes=require('./voiceQueue.attributes');module['exports']=function(_0x42c19a,_0x16347a){return _0x42c19a[_0x3257('0x9')](_0x3257('0xa'),attributes,{'tableName':_0x3257('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 7f15cf9..72d5463 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 _0x1104=['ShowVoiceQueue','attributes','info','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','VoiceQueue','options','raw','where','limit','map','include','model','GetVoiceQueue'];(function(_0x4f91d9,_0x3fba2f){var _0x4e3492=function(_0x2224c9){while(--_0x2224c9){_0x4f91d9['push'](_0x4f91d9['shift']());}};_0x4e3492(++_0x3fba2f);}(_0x1104,0xbd));var _0x4110=function(_0x4c4b5e,_0x59224b){_0x4c4b5e=_0x4c4b5e-0x0;var _0x3732ab=_0x1104[_0x4c4b5e];return _0x3732ab;};'use strict';var _=require(_0x4110('0x0'));var util=require('util');var moment=require(_0x4110('0x1'));var BPromise=require(_0x4110('0x2'));var rs=require(_0x4110('0x3'));var fs=require('fs');var Redis=require(_0x4110('0x4'));var db=require(_0x4110('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4110('0x6'))('rpc');var config=require(_0x4110('0x7'));var jayson=require(_0x4110('0x8'));var client=jayson[_0x4110('0x9')]['http']({'port':0x232a});config[_0x4110('0xa')]=_['defaults'](config[_0x4110('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4110('0xb'))(new Redis(config[_0x4110('0xa')]));require(_0x4110('0xc'))[_0x4110('0xd')](socket);function respondWithRpcPromise(_0x16e88e,_0x29045b,_0x2f82a1){return new BPromise(function(_0x25b989,_0x1c446d){return client[_0x4110('0xe')](_0x16e88e,_0x2f82a1)[_0x4110('0xf')](function(_0x14108d){logger['info'](_0x4110('0x10'),_0x29045b,'request\x20sent');logger[_0x4110('0x11')](_0x4110('0x12'),_0x29045b,_0x4110('0x13'),JSON['stringify'](_0x14108d));if(_0x14108d['error']){if(_0x14108d['error'][_0x4110('0x14')]===0x1f4){logger[_0x4110('0x15')](_0x4110('0x10'),_0x29045b,_0x14108d[_0x4110('0x15')][_0x4110('0x16')]);return _0x1c446d(_0x14108d[_0x4110('0x15')]['message']);}logger[_0x4110('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x29045b,_0x14108d[_0x4110('0x15')]['message']);return _0x25b989(_0x14108d[_0x4110('0x15')][_0x4110('0x16')]);}else{logger['info'](_0x4110('0x10'),_0x29045b,_0x4110('0x13'));_0x25b989(_0x14108d['result'][_0x4110('0x16')]);}})[_0x4110('0x17')](function(_0x2c3ea4){logger[_0x4110('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x29045b,_0x2c3ea4);_0x1c446d(_0x2c3ea4);});});}exports['GetVoiceQueue']=function(_0x3c0bc5){var _0x37665d=this;return new Promise(function(_0x3ee66b,_0x12daf5){return db[_0x4110('0x18')]['findAll']({'raw':_0x3c0bc5[_0x4110('0x19')]?_0x3c0bc5[_0x4110('0x19')][_0x4110('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c0bc5[_0x4110('0x19')]?_0x3c0bc5[_0x4110('0x19')][_0x4110('0x1b')]||null:null,'attributes':_0x3c0bc5[_0x4110('0x19')]?_0x3c0bc5[_0x4110('0x19')]['attributes']||null:null,'limit':_0x3c0bc5['options']?_0x3c0bc5[_0x4110('0x19')][_0x4110('0x1c')]||null:null,'include':_0x3c0bc5[_0x4110('0x19')]?_0x3c0bc5[_0x4110('0x19')]['include']?_[_0x4110('0x1d')](_0x3c0bc5['options'][_0x4110('0x1e')],function(_0x2e3d8b){return{'model':db[_0x2e3d8b[_0x4110('0x1f')]],'as':_0x2e3d8b['as'],'attributes':_0x2e3d8b['attributes'],'include':_0x2e3d8b[_0x4110('0x1e')]?_[_0x4110('0x1d')](_0x2e3d8b[_0x4110('0x1e')],function(_0x3e7428){return{'model':db[_0x3e7428[_0x4110('0x1f')]],'as':_0x3e7428['as'],'attributes':_0x3e7428['attributes'],'include':_0x3e7428[_0x4110('0x1e')]?_[_0x4110('0x1d')](_0x3e7428[_0x4110('0x1e')],function(_0x80ab2b){return{'model':db[_0x80ab2b[_0x4110('0x1f')]],'as':_0x80ab2b['as'],'attributes':_0x80ab2b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4110('0xf')](function(_0x4e09df){logger['info']('GetVoiceQueue',_0x3c0bc5);logger['debug'](_0x4110('0x20'),_0x3c0bc5,JSON['stringify'](_0x4e09df));_0x3ee66b(_0x4e09df);})[_0x4110('0x17')](function(_0x2569a4){logger['error']('GetVoiceQueue',_0x2569a4['message'],_0x3c0bc5);_0x12daf5(_0x37665d[_0x4110('0x15')](0x1f4,_0x2569a4[_0x4110('0x16')]));});});};exports[_0x4110('0x21')]=function(_0x310b5e){var _0x526a0f=this;return new Promise(function(_0x3402d8,_0x379731){return db[_0x4110('0x18')]['find']({'raw':_0x310b5e[_0x4110('0x19')]?_0x310b5e['options'][_0x4110('0x1a')]===undefined?!![]:![]:!![],'where':_0x310b5e[_0x4110('0x19')]?_0x310b5e[_0x4110('0x19')]['where']||null:null,'attributes':_0x310b5e[_0x4110('0x19')]?_0x310b5e[_0x4110('0x19')]['attributes']||null:null,'include':_0x310b5e[_0x4110('0x19')]?_0x310b5e[_0x4110('0x19')][_0x4110('0x1e')]?_[_0x4110('0x1d')](_0x310b5e[_0x4110('0x19')][_0x4110('0x1e')],function(_0x261706){return{'model':db[_0x261706[_0x4110('0x1f')]],'as':_0x261706['as'],'attributes':_0x261706['attributes'],'include':_0x261706[_0x4110('0x1e')]?_['map'](_0x261706[_0x4110('0x1e')],function(_0x2c0c8e){return{'model':db[_0x2c0c8e[_0x4110('0x1f')]],'as':_0x2c0c8e['as'],'attributes':_0x2c0c8e[_0x4110('0x22')],'include':_0x2c0c8e[_0x4110('0x1e')]?_[_0x4110('0x1d')](_0x2c0c8e[_0x4110('0x1e')],function(_0x25083e){return{'model':db[_0x25083e['model']],'as':_0x25083e['as'],'attributes':_0x25083e[_0x4110('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4110('0xf')](function(_0x4f7185){logger[_0x4110('0x23')](_0x4110('0x21'),_0x310b5e);logger['debug'](_0x4110('0x21'),_0x310b5e,JSON[_0x4110('0x24')](_0x4f7185));_0x3402d8(_0x4f7185);})[_0x4110('0x17')](function(_0x4950fd){logger[_0x4110('0x15')](_0x4110('0x21'),_0x4950fd[_0x4110('0x16')],_0x310b5e);_0x379731(_0x526a0f[_0x4110('0x15')](0x1f4,_0x4950fd[_0x4110('0x16')]));});});}; \ No newline at end of file +var _0xd013=['ShowVoiceQueue','find','debug','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x16faa5,_0x99272){var _0x923017=function(_0x71e731){while(--_0x71e731){_0x16faa5['push'](_0x16faa5['shift']());}};_0x923017(++_0x99272);}(_0xd013,0xab));var _0x3d01=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xd013[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0x3d01('0x0'));var util=require(_0x3d01('0x1'));var moment=require(_0x3d01('0x2'));var BPromise=require(_0x3d01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d01('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d01('0x5'))(_0x3d01('0x6'));var config=require(_0x3d01('0x7'));var jayson=require(_0x3d01('0x8'));var client=jayson[_0x3d01('0x9')][_0x3d01('0xa')]({'port':0x232a});config[_0x3d01('0xb')]=_[_0x3d01('0xc')](config['redis'],{'host':_0x3d01('0xd'),'port':0x18eb});var socket=require(_0x3d01('0xe'))(new Redis(config[_0x3d01('0xb')]));require(_0x3d01('0xf'))[_0x3d01('0x10')](socket);function respondWithRpcPromise(_0xb8532,_0x5b13c0,_0xdbf732){return new BPromise(function(_0x144701,_0x12d808){return client[_0x3d01('0x11')](_0xb8532,_0xdbf732)[_0x3d01('0x12')](function(_0x1730b6){logger['info'](_0x3d01('0x13'),_0x5b13c0,_0x3d01('0x14'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5b13c0,_0x3d01('0x14'),JSON[_0x3d01('0x15')](_0x1730b6));if(_0x1730b6[_0x3d01('0x16')]){if(_0x1730b6[_0x3d01('0x16')][_0x3d01('0x17')]===0x1f4){logger[_0x3d01('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x5b13c0,_0x1730b6[_0x3d01('0x16')][_0x3d01('0x18')]);return _0x12d808(_0x1730b6[_0x3d01('0x16')][_0x3d01('0x18')]);}logger[_0x3d01('0x16')](_0x3d01('0x13'),_0x5b13c0,_0x1730b6[_0x3d01('0x16')][_0x3d01('0x18')]);return _0x144701(_0x1730b6['error']['message']);}else{logger[_0x3d01('0x19')](_0x3d01('0x13'),_0x5b13c0,'request\x20sent');_0x144701(_0x1730b6[_0x3d01('0x1a')]['message']);}})[_0x3d01('0x1b')](function(_0xb079cc){logger[_0x3d01('0x16')](_0x3d01('0x13'),_0x5b13c0,_0xb079cc);_0x12d808(_0xb079cc);});});}exports[_0x3d01('0x1c')]=function(_0x53615c){var _0x5b9f0f=this;return new Promise(function(_0x4efc3e,_0x3ce103){return db[_0x3d01('0x1d')][_0x3d01('0x1e')]({'raw':_0x53615c[_0x3d01('0x1f')]?_0x53615c[_0x3d01('0x1f')][_0x3d01('0x20')]===undefined?!![]:![]:!![],'where':_0x53615c[_0x3d01('0x1f')]?_0x53615c[_0x3d01('0x1f')][_0x3d01('0x21')]||null:null,'attributes':_0x53615c[_0x3d01('0x1f')]?_0x53615c['options'][_0x3d01('0x22')]||null:null,'limit':_0x53615c[_0x3d01('0x1f')]?_0x53615c[_0x3d01('0x1f')][_0x3d01('0x23')]||null:null,'include':_0x53615c[_0x3d01('0x1f')]?_0x53615c[_0x3d01('0x1f')][_0x3d01('0x24')]?_[_0x3d01('0x25')](_0x53615c[_0x3d01('0x1f')][_0x3d01('0x24')],function(_0x1679db){return{'model':db[_0x1679db[_0x3d01('0x26')]],'as':_0x1679db['as'],'attributes':_0x1679db['attributes'],'include':_0x1679db[_0x3d01('0x24')]?_['map'](_0x1679db[_0x3d01('0x24')],function(_0x2ac6b9){return{'model':db[_0x2ac6b9[_0x3d01('0x26')]],'as':_0x2ac6b9['as'],'attributes':_0x2ac6b9[_0x3d01('0x22')],'include':_0x2ac6b9[_0x3d01('0x24')]?_['map'](_0x2ac6b9[_0x3d01('0x24')],function(_0x11088c){return{'model':db[_0x11088c[_0x3d01('0x26')]],'as':_0x11088c['as'],'attributes':_0x11088c[_0x3d01('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34e633){logger[_0x3d01('0x19')](_0x3d01('0x1c'),_0x53615c);logger['debug']('GetVoiceQueue',_0x53615c,JSON[_0x3d01('0x15')](_0x34e633));_0x4efc3e(_0x34e633);})[_0x3d01('0x1b')](function(_0x2f57aa){logger[_0x3d01('0x16')]('GetVoiceQueue',_0x2f57aa[_0x3d01('0x18')],_0x53615c);_0x3ce103(_0x5b9f0f['error'](0x1f4,_0x2f57aa[_0x3d01('0x18')]));});});};exports[_0x3d01('0x27')]=function(_0x198885){var _0x4f7ba8=this;return new Promise(function(_0x4ffb17,_0x4ba30b){return db[_0x3d01('0x1d')][_0x3d01('0x28')]({'raw':_0x198885['options']?_0x198885['options'][_0x3d01('0x20')]===undefined?!![]:![]:!![],'where':_0x198885[_0x3d01('0x1f')]?_0x198885[_0x3d01('0x1f')][_0x3d01('0x21')]||null:null,'attributes':_0x198885[_0x3d01('0x1f')]?_0x198885[_0x3d01('0x1f')][_0x3d01('0x22')]||null:null,'include':_0x198885[_0x3d01('0x1f')]?_0x198885[_0x3d01('0x1f')][_0x3d01('0x24')]?_[_0x3d01('0x25')](_0x198885[_0x3d01('0x1f')][_0x3d01('0x24')],function(_0x4ff338){return{'model':db[_0x4ff338[_0x3d01('0x26')]],'as':_0x4ff338['as'],'attributes':_0x4ff338[_0x3d01('0x22')],'include':_0x4ff338['include']?_['map'](_0x4ff338[_0x3d01('0x24')],function(_0x140f7c){return{'model':db[_0x140f7c['model']],'as':_0x140f7c['as'],'attributes':_0x140f7c['attributes'],'include':_0x140f7c[_0x3d01('0x24')]?_[_0x3d01('0x25')](_0x140f7c['include'],function(_0x5b49e7){return{'model':db[_0x5b49e7[_0x3d01('0x26')]],'as':_0x5b49e7['as'],'attributes':_0x5b49e7[_0x3d01('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2276d0){logger[_0x3d01('0x19')](_0x3d01('0x27'),_0x198885);logger[_0x3d01('0x29')]('ShowVoiceQueue',_0x198885,JSON[_0x3d01('0x15')](_0x2276d0));_0x4ffb17(_0x2276d0);})[_0x3d01('0x1b')](function(_0x44ef35){logger[_0x3d01('0x16')]('ShowVoiceQueue',_0x44ef35[_0x3d01('0x18')],_0x198885);_0x4ba30b(_0x4f7ba8['error'](0x1f4,_0x44ef35[_0x3d01('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 67de7f1..2c8cead 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 _0x59c5=['length','voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','register'];(function(_0x5124d2,_0x3400cb){var _0x361478=function(_0x21915a){while(--_0x21915a){_0x5124d2['push'](_0x5124d2['shift']());}};_0x361478(++_0x3400cb);}(_0x59c5,0x132));var _0x559c=function(_0x3534a6,_0x200da2){_0x3534a6=_0x3534a6-0x0;var _0x3ae6f9=_0x59c5[_0x3534a6];return _0x3ae6f9;};'use strict';var VoiceQueueEvents=require(_0x559c('0x0'));var events=[_0x559c('0x1'),_0x559c('0x2'),'update'];function createListener(_0x8638fc,_0x7c3265){return function(_0x34d868){_0x7c3265[_0x559c('0x3')](_0x8638fc,_0x34d868);};}function removeListener(_0x1aaa58,_0x5e9904){return function(){VoiceQueueEvents[_0x559c('0x4')](_0x1aaa58,_0x5e9904);};}exports[_0x559c('0x5')]=function(_0x30afc4){for(var _0x3a6013=0x0,_0x24c6b7=events[_0x559c('0x6')];_0x3a6013<_0x24c6b7;_0x3a6013++){var _0x3f0636=events[_0x3a6013];var _0x35f300=createListener(_0x559c('0x7')+_0x3f0636,_0x30afc4);VoiceQueueEvents['on'](_0x3f0636,_0x35f300);}}; \ No newline at end of file +var _0xc682=['update','register','length','./voiceQueue.events','save','remove'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc682,0xed));var _0x2c68=function(_0x210a21,_0x39864f){_0x210a21=_0x210a21-0x0;var _0x433f12=_0xc682[_0x210a21];return _0x433f12;};'use strict';var VoiceQueueEvents=require(_0x2c68('0x0'));var events=[_0x2c68('0x1'),_0x2c68('0x2'),_0x2c68('0x3')];function createListener(_0x19818b,_0x414884){return function(_0x19f62a){_0x414884['emit'](_0x19818b,_0x19f62a);};}function removeListener(_0x1b67c0,_0xfaec2b){return function(){VoiceQueueEvents['removeListener'](_0x1b67c0,_0xfaec2b);};}exports[_0x2c68('0x4')]=function(_0x4a63a8){for(var _0x327b5b=0x0,_0x24e024=events[_0x2c68('0x5')];_0x327b5b<_0x24e024;_0x327b5b++){var _0xb026cc=events[_0x327b5b];var _0x1b27c7=createListener('voiceQueue:'+_0xb026cc,_0x4a63a8);VoiceQueueEvents['on'](_0xb026cc,_0x1b27c7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8c984d7..9d9d506 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 _0x57ca=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1db2be,_0x6153f9){var _0x15d481=function(_0x213c70){while(--_0x213c70){_0x1db2be['push'](_0x1db2be['shift']());}};_0x15d481(++_0x6153f9);}(_0x57ca,0x108));var _0xa57c=function(_0x3e91c8,_0x5a9396){_0x3e91c8=_0x3e91c8-0x0;var _0x1300e7=_0x57ca[_0x3e91c8];return _0x1300e7;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0x7')]('/index',auth[_0xa57c('0x8')](),controller['getVoiceQueuesReport']);router[_0xa57c('0x7')](_0xa57c('0xc'),auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['post']('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0xe')]);router['put'](_0xa57c('0xc'),auth['isAuthenticated'](),controller[_0xa57c('0xf')]);router[_0xa57c('0x10')](_0xa57c('0xc'),auth[_0xa57c('0x8')](),controller[_0xa57c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5f6f=['describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x136156,_0x22250c){var _0x4414ac=function(_0x28dea9){while(--_0x28dea9){_0x136156['push'](_0x136156['shift']());}};_0x4414ac(++_0x22250c);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x2f4311,_0xd2d511){_0x2f4311=_0x2f4311-0x0;var _0x309ccb=_0x5f6f[_0x2f4311];return _0x309ccb;};'use strict';var multer=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var path=require(_0xf5f6('0x2'));var timeout=require(_0xf5f6('0x3'));var express=require(_0xf5f6('0x4'));var router=express['Router']();var auth=require(_0xf5f6('0x5'));var interaction=require(_0xf5f6('0x6'));var config=require(_0xf5f6('0x7'));var controller=require('./voiceQueueReport.controller');router[_0xf5f6('0x8')]('/',auth[_0xf5f6('0x9')](),controller[_0xf5f6('0xa')]);router[_0xf5f6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf5f6('0xb')]);router[_0xf5f6('0x8')](_0xf5f6('0xc'),auth[_0xf5f6('0x9')](),controller[_0xf5f6('0xd')]);router[_0xf5f6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf5f6('0xe')]);router[_0xf5f6('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f6('0x10')]);router[_0xf5f6('0x11')](_0xf5f6('0x12'),auth[_0xf5f6('0x9')](),controller[_0xf5f6('0x13')]);router['delete'](_0xf5f6('0x12'),auth['isAuthenticated'](),controller[_0xf5f6('0x14')]);module[_0xf5f6('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 41a4612..41ac32b 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 _0xe174=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0xe174,0x64));var _0x4e17=function(_0x16d501,_0x7fe1ec){_0x16d501=_0x16d501-0x0;var _0x22ae69=_0xe174[_0x16d501];return _0x22ae69;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4e17('0x0'));module[_0x4e17('0x1')]={'type':{'type':Sequelize[_0x4e17('0x2')]},'uniqueid':{'type':Sequelize[_0x4e17('0x2')]},'calleridnum':{'type':Sequelize[_0x4e17('0x2')]},'calleridname':{'type':Sequelize[_0x4e17('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x4e17('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x4e17('0x3')],'set':function(_0x137e40){var _0x2f6217=moment(_0x137e40);var _0x468c42=moment(this[_0x4e17('0x4')]('queuecallerjoinAt'))[_0x4e17('0x5')](_0x4e17('0x6'));var _0x1aed7f=_0x2f6217[_0x4e17('0x7')](_0x468c42,_0x4e17('0x8'));this[_0x4e17('0x9')](_0x4e17('0xa'),_0x137e40);this[_0x4e17('0x9')]('holdtime',_0x1aed7f||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x4e17('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x4e17('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4e17('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x4e17('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4e17('0x3')]},'queuecallerexit':{'type':Sequelize[_0x4e17('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x4e17('0x2')],'comment':_0x4e17('0xd')},'originalposition':{'type':Sequelize[_0x4e17('0xb')]},'channel':{'type':Sequelize[_0x4e17('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4e17('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4e17('0x2')]},'context':{'type':Sequelize[_0x4e17('0x2')]},'exten':{'type':Sequelize[_0x4e17('0x2')]},'priority':{'type':Sequelize[_0x4e17('0x2')]},'holdtime':{'type':Sequelize[_0x4e17('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4e17('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4e17('0x2')]},'transfer':{'type':Sequelize[_0x4e17('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4e17('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4e17('0x2')]},'disposition':{'type':Sequelize[_0x4e17('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x4e17('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5464=['holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x2c967a,_0x34839c){var _0x184c22=function(_0x40116e){while(--_0x40116e){_0x2c967a['push'](_0x2c967a['shift']());}};_0x184c22(++_0x34839c);}(_0x5464,0x15d));var _0x4546=function(_0x1fdaf7,_0x3416fc){_0x1fdaf7=_0x1fdaf7-0x0;var _0x25d5e9=_0x5464[_0x1fdaf7];return _0x25d5e9;};'use strict';var Sequelize=require(_0x4546('0x0'));var moment=require(_0x4546('0x1'));module[_0x4546('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4546('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4546('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x4546('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x4546('0x4')],'set':function(_0xcc9def){var _0x2b1a9b=moment(_0xcc9def);var _0x54228a=moment(this['getDataValue']('queuecallerjoinAt'))[_0x4546('0x5')](_0x4546('0x6'));var _0x1a76c1=_0x2b1a9b[_0x4546('0x7')](_0x54228a,_0x4546('0x8'));this[_0x4546('0x9')](_0x4546('0xa'),_0xcc9def);this[_0x4546('0x9')](_0x4546('0xb'),_0x1a76c1||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x4546('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x4546('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4546('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4546('0x4')]},'queuecallerexit':{'type':Sequelize[_0x4546('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4546('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4546('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x4546('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x4546('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4546('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4546('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x4546('0xe')},'transferexten':{'type':Sequelize[_0x4546('0x3')]},'transferuniqueid':{'type':Sequelize[_0x4546('0x3')]},'disposition':{'type':Sequelize[_0x4546('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x4546('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 7caae59..2264369 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 _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x7a54,0x106));var _0x47a5=function(_0x35380d,_0x4e4dca){_0x35380d=_0x35380d-0x0;var _0x46aa4d=_0x7a54[_0x35380d];return _0x46aa4d;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x24aaea,_0x5eaa80){_0x24aaea=_0x24aaea-0x0;var _0x2fab4a=_0x7a54[_0x24aaea];return _0x2fab4a;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6870f6a..39e2bbd 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 _0xfc26=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x246161,_0x27425c){var _0xcd44d2=function(_0x5ad202){while(--_0x5ad202){_0x246161['push'](_0x246161['shift']());}};_0xcd44d2(++_0x27425c);}(_0xfc26,0xbe));var _0x6fc2=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xfc26[_0x4c6d6f];return _0x2d4478;};'use strict';var EventEmitter=require(_0x6fc2('0x0'));var VoiceQueueReport=require(_0x6fc2('0x1'))['db'][_0x6fc2('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6fc2('0x3')](0x0);var events={'afterCreate':_0x6fc2('0x4'),'afterUpdate':_0x6fc2('0x5'),'afterDestroy':_0x6fc2('0x6')};function emitEvent(_0x3e1deb){return function(_0x5c02f1,_0x2fc4c5,_0x82cda){VoiceQueueReportEvents[_0x6fc2('0x7')](_0x3e1deb+':'+_0x5c02f1['id'],_0x5c02f1);VoiceQueueReportEvents[_0x6fc2('0x7')](_0x3e1deb,_0x5c02f1);_0x82cda(null);};}for(var e in events){if(events[_0x6fc2('0x8')](e)){var event=events[e];VoiceQueueReport[_0x6fc2('0x9')](e,emitEvent(event));}}module[_0x6fc2('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x271d=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x45ccf1,_0x2fedc0){var _0x10c224=function(_0x39b32a){while(--_0x39b32a){_0x45ccf1['push'](_0x45ccf1['shift']());}};_0x10c224(++_0x2fedc0);}(_0x271d,0x15e));var _0xd271=function(_0x2ac662,_0x1c4eb3){_0x2ac662=_0x2ac662-0x0;var _0xb817e6=_0x271d[_0x2ac662];return _0xb817e6;};'use strict';var EventEmitter=require(_0xd271('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xd271('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd271('0x2')](0x0);var events={'afterCreate':_0xd271('0x3'),'afterUpdate':_0xd271('0x4'),'afterDestroy':_0xd271('0x5')};function emitEvent(_0xa8f2ff){return function(_0x6cf974,_0x1136c0,_0x2c7862){VoiceQueueReportEvents[_0xd271('0x6')](_0xa8f2ff+':'+_0x6cf974['id'],_0x6cf974);VoiceQueueReportEvents['emit'](_0xa8f2ff,_0x6cf974);_0x2c7862(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xd271('0x7')](e,emitEvent(event));}}module[_0xd271('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 372d761..3b9e53b 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 _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0x2032,0xd9));var _0x2203=function(_0x5351f2,_0x462d3d){_0x5351f2=_0x5351f2-0x0;var _0x71a35c=_0x2032[_0x5351f2];return _0x71a35c;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38cec7,_0x2358b2){_0x38cec7=_0x38cec7-0x0;var _0x3e89d7=_0x5f2f[_0x38cec7];return _0x3e89d7;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index b627289..f659f6d 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 _0x4042=['model','map','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include'];(function(_0x802ebb,_0xfcb40d){var _0x20614e=function(_0x2b097c){while(--_0x2b097c){_0x802ebb['push'](_0x802ebb['shift']());}};_0x20614e(++_0xfcb40d);}(_0x4042,0x1aa));var _0x2404=function(_0x595926,_0x45498b){_0x595926=_0x595926-0x0;var _0x2e38d8=_0x4042[_0x595926];return _0x2e38d8;};'use strict';var _=require(_0x2404('0x0'));var util=require(_0x2404('0x1'));var moment=require(_0x2404('0x2'));var BPromise=require(_0x2404('0x3'));var rs=require(_0x2404('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2404('0x5'))(_0x2404('0x6'));var config=require(_0x2404('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2404('0x8')]['http']({'port':0x232a});config[_0x2404('0x9')]=_[_0x2404('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2404('0xb'))(new Redis(config[_0x2404('0x9')]));require(_0x2404('0xc'))[_0x2404('0xd')](socket);function respondWithRpcPromise(_0x450047,_0x5bb4de,_0x406636){return new BPromise(function(_0xa0de32,_0x2ca923){return client[_0x2404('0xe')](_0x450047,_0x406636)[_0x2404('0xf')](function(_0x3e9ed3){logger[_0x2404('0x10')](_0x2404('0x11'),_0x5bb4de,_0x2404('0x12'));logger[_0x2404('0x13')](_0x2404('0x14'),_0x5bb4de,_0x2404('0x12'),JSON[_0x2404('0x15')](_0x3e9ed3));if(_0x3e9ed3[_0x2404('0x16')]){if(_0x3e9ed3[_0x2404('0x16')][_0x2404('0x17')]===0x1f4){logger[_0x2404('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x5bb4de,_0x3e9ed3['error']['message']);return _0x2ca923(_0x3e9ed3['error'][_0x2404('0x18')]);}logger[_0x2404('0x16')](_0x2404('0x11'),_0x5bb4de,_0x3e9ed3['error'][_0x2404('0x18')]);return _0xa0de32(_0x3e9ed3[_0x2404('0x16')][_0x2404('0x18')]);}else{logger['info'](_0x2404('0x11'),_0x5bb4de,'request\x20sent');_0xa0de32(_0x3e9ed3[_0x2404('0x19')][_0x2404('0x18')]);}})[_0x2404('0x1a')](function(_0x2435c0){logger[_0x2404('0x16')](_0x2404('0x11'),_0x5bb4de,_0x2435c0);_0x2ca923(_0x2435c0);});});}exports[_0x2404('0x1b')]=function(_0x57f12a){var _0x4dc283=this;return new Promise(function(_0x5e9477,_0x5820d1){return db[_0x2404('0x1c')][_0x2404('0x1d')]({'raw':_0x57f12a[_0x2404('0x1e')]?_0x57f12a[_0x2404('0x1e')][_0x2404('0x1f')]===undefined?!![]:![]:!![],'where':_0x57f12a[_0x2404('0x1e')]?_0x57f12a[_0x2404('0x1e')][_0x2404('0x20')]||null:null,'attributes':_0x57f12a[_0x2404('0x1e')]?_0x57f12a['options'][_0x2404('0x21')]||null:null,'limit':_0x57f12a['options']?_0x57f12a['options'][_0x2404('0x22')]||null:null,'include':_0x57f12a[_0x2404('0x1e')]?_0x57f12a['options'][_0x2404('0x23')]?_['map'](_0x57f12a['options'][_0x2404('0x23')],function(_0x19dccb){return{'model':db[_0x19dccb[_0x2404('0x24')]],'as':_0x19dccb['as'],'attributes':_0x19dccb[_0x2404('0x21')],'include':_0x19dccb[_0x2404('0x23')]?_[_0x2404('0x25')](_0x19dccb[_0x2404('0x23')],function(_0x420d7d){return{'model':db[_0x420d7d[_0x2404('0x24')]],'as':_0x420d7d['as'],'attributes':_0x420d7d[_0x2404('0x21')],'include':_0x420d7d['include']?_[_0x2404('0x25')](_0x420d7d[_0x2404('0x23')],function(_0x47cf4d){return{'model':db[_0x47cf4d['model']],'as':_0x47cf4d['as'],'attributes':_0x47cf4d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2404('0xf')](function(_0x3c00d1){logger[_0x2404('0x10')](_0x2404('0x1b'),_0x57f12a);logger[_0x2404('0x13')](_0x2404('0x1b'),_0x57f12a,JSON[_0x2404('0x15')](_0x3c00d1));_0x5e9477(_0x3c00d1);})[_0x2404('0x1a')](function(_0x4c65cb){logger[_0x2404('0x16')]('GetVoiceQueueReport',_0x4c65cb[_0x2404('0x18')],_0x57f12a);_0x5820d1(_0x4dc283[_0x2404('0x16')](0x1f4,_0x4c65cb[_0x2404('0x18')]));});});};exports[_0x2404('0x26')]=function(_0x2626fb){var _0x1cc143=this;return new Promise(function(_0x3cdf73,_0x3797a1){return db[_0x2404('0x1c')]['create'](_0x2626fb[_0x2404('0x27')],{'raw':_0x2626fb['options']?_0x2626fb['options'][_0x2404('0x1f')]===undefined?!![]:![]:!![]})[_0x2404('0xf')](function(_0x14799c){logger[_0x2404('0x10')](_0x2404('0x26'),_0x2626fb);logger[_0x2404('0x13')](_0x2404('0x26'),_0x2626fb,JSON[_0x2404('0x15')](_0x14799c));_0x3cdf73(_0x14799c);})[_0x2404('0x1a')](function(_0x27987d){logger['error'](_0x2404('0x26'),_0x27987d['message'],_0x2626fb);_0x3797a1(_0x1cc143[_0x2404('0x16')](0x1f4,_0x27987d['message']));});});};exports[_0x2404('0x28')]=function(_0x3bf791){var _0x5c7424=this;return new Promise(function(_0x55dcca,_0x17f8b6){return db[_0x2404('0x1c')][_0x2404('0x29')](_0x3bf791['body'],{'raw':_0x3bf791[_0x2404('0x1e')]?_0x3bf791[_0x2404('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bf791[_0x2404('0x1e')]?_0x3bf791[_0x2404('0x1e')][_0x2404('0x20')]||null:null,'attributes':_0x3bf791['options']?_0x3bf791[_0x2404('0x1e')][_0x2404('0x21')]||null:null,'limit':_0x3bf791[_0x2404('0x1e')]?_0x3bf791['options'][_0x2404('0x22')]||null:null})[_0x2404('0xf')](function(_0x974a81){logger[_0x2404('0x10')](_0x2404('0x28'),_0x3bf791);logger['debug'](_0x2404('0x28'),_0x3bf791,JSON[_0x2404('0x15')](_0x974a81));_0x55dcca(_0x974a81);})['catch'](function(_0x48ecec){logger[_0x2404('0x16')](_0x2404('0x28'),_0x48ecec['message'],_0x3bf791);_0x17f8b6(_0x5c7424[_0x2404('0x16')](0x1f4,_0x48ecec[_0x2404('0x18')]));});});}; \ No newline at end of file +var _0xf7a8=['map','model','debug','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include'];(function(_0x2533cd,_0x5dd3ae){var _0x4a0cd4=function(_0x262431){while(--_0x262431){_0x2533cd['push'](_0x2533cd['shift']());}};_0x4a0cd4(++_0x5dd3ae);}(_0xf7a8,0x105));var _0x8f7a=function(_0x1f7124,_0x165f9f){_0x1f7124=_0x1f7124-0x0;var _0x568c71=_0xf7a8[_0x1f7124];return _0x568c71;};'use strict';var _=require(_0x8f7a('0x0'));var util=require(_0x8f7a('0x1'));var moment=require('moment');var BPromise=require(_0x8f7a('0x2'));var rs=require(_0x8f7a('0x3'));var fs=require('fs');var Redis=require(_0x8f7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8f7a('0x5'));var config=require(_0x8f7a('0x6'));var jayson=require(_0x8f7a('0x7'));var client=jayson[_0x8f7a('0x8')][_0x8f7a('0x9')]({'port':0x232a});config[_0x8f7a('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8f7a('0xb'))(new Redis(config[_0x8f7a('0xa')]));require(_0x8f7a('0xc'))[_0x8f7a('0xd')](socket);function respondWithRpcPromise(_0x2838d8,_0x44d7fb,_0x35ef05){return new BPromise(function(_0x40682a,_0x5d6be2){return client['request'](_0x2838d8,_0x35ef05)[_0x8f7a('0xe')](function(_0xa7b467){logger[_0x8f7a('0xf')](_0x8f7a('0x10'),_0x44d7fb,_0x8f7a('0x11'));logger['debug'](_0x8f7a('0x12'),_0x44d7fb,_0x8f7a('0x11'),JSON[_0x8f7a('0x13')](_0xa7b467));if(_0xa7b467[_0x8f7a('0x14')]){if(_0xa7b467[_0x8f7a('0x14')][_0x8f7a('0x15')]===0x1f4){logger['error'](_0x8f7a('0x10'),_0x44d7fb,_0xa7b467[_0x8f7a('0x14')][_0x8f7a('0x16')]);return _0x5d6be2(_0xa7b467[_0x8f7a('0x14')][_0x8f7a('0x16')]);}logger[_0x8f7a('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x44d7fb,_0xa7b467[_0x8f7a('0x14')][_0x8f7a('0x16')]);return _0x40682a(_0xa7b467[_0x8f7a('0x14')][_0x8f7a('0x16')]);}else{logger[_0x8f7a('0xf')](_0x8f7a('0x10'),_0x44d7fb,'request\x20sent');_0x40682a(_0xa7b467[_0x8f7a('0x17')][_0x8f7a('0x16')]);}})[_0x8f7a('0x18')](function(_0x2b0eb1){logger[_0x8f7a('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x44d7fb,_0x2b0eb1);_0x5d6be2(_0x2b0eb1);});});}exports[_0x8f7a('0x19')]=function(_0x2c9919){var _0x3e5bfe=this;return new Promise(function(_0x59df9a,_0x151ac9){return db[_0x8f7a('0x1a')][_0x8f7a('0x1b')]({'raw':_0x2c9919[_0x8f7a('0x1c')]?_0x2c9919['options'][_0x8f7a('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c9919[_0x8f7a('0x1c')]?_0x2c9919['options'][_0x8f7a('0x1e')]||null:null,'attributes':_0x2c9919[_0x8f7a('0x1c')]?_0x2c9919[_0x8f7a('0x1c')][_0x8f7a('0x1f')]||null:null,'limit':_0x2c9919[_0x8f7a('0x1c')]?_0x2c9919['options']['limit']||null:null,'include':_0x2c9919[_0x8f7a('0x1c')]?_0x2c9919[_0x8f7a('0x1c')][_0x8f7a('0x20')]?_[_0x8f7a('0x21')](_0x2c9919[_0x8f7a('0x1c')][_0x8f7a('0x20')],function(_0x5d55ec){return{'model':db[_0x5d55ec[_0x8f7a('0x22')]],'as':_0x5d55ec['as'],'attributes':_0x5d55ec[_0x8f7a('0x1f')],'include':_0x5d55ec[_0x8f7a('0x20')]?_[_0x8f7a('0x21')](_0x5d55ec[_0x8f7a('0x20')],function(_0x102d8f){return{'model':db[_0x102d8f[_0x8f7a('0x22')]],'as':_0x102d8f['as'],'attributes':_0x102d8f['attributes'],'include':_0x102d8f[_0x8f7a('0x20')]?_[_0x8f7a('0x21')](_0x102d8f['include'],function(_0x4695b4){return{'model':db[_0x4695b4['model']],'as':_0x4695b4['as'],'attributes':_0x4695b4[_0x8f7a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8f7a('0xe')](function(_0x2c1ba1){logger[_0x8f7a('0xf')](_0x8f7a('0x19'),_0x2c9919);logger[_0x8f7a('0x23')](_0x8f7a('0x19'),_0x2c9919,JSON[_0x8f7a('0x13')](_0x2c1ba1));_0x59df9a(_0x2c1ba1);})['catch'](function(_0x5e6282){logger[_0x8f7a('0x14')](_0x8f7a('0x19'),_0x5e6282[_0x8f7a('0x16')],_0x2c9919);_0x151ac9(_0x3e5bfe[_0x8f7a('0x14')](0x1f4,_0x5e6282[_0x8f7a('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x12d12d){var _0x2368e5=this;return new Promise(function(_0xf434f,_0x5b609b){return db[_0x8f7a('0x1a')][_0x8f7a('0x24')](_0x12d12d[_0x8f7a('0x25')],{'raw':_0x12d12d[_0x8f7a('0x1c')]?_0x12d12d['options'][_0x8f7a('0x1d')]===undefined?!![]:![]:!![]})[_0x8f7a('0xe')](function(_0x56822f){logger[_0x8f7a('0xf')]('CreateVoiceQueueReport',_0x12d12d);logger['debug'](_0x8f7a('0x26'),_0x12d12d,JSON[_0x8f7a('0x13')](_0x56822f));_0xf434f(_0x56822f);})['catch'](function(_0x10661e){logger[_0x8f7a('0x14')]('CreateVoiceQueueReport',_0x10661e[_0x8f7a('0x16')],_0x12d12d);_0x5b609b(_0x2368e5[_0x8f7a('0x14')](0x1f4,_0x10661e[_0x8f7a('0x16')]));});});};exports[_0x8f7a('0x27')]=function(_0x2ccb44){var _0x354d68=this;return new Promise(function(_0x1ccdc8,_0x2f449a){return db[_0x8f7a('0x1a')][_0x8f7a('0x28')](_0x2ccb44['body'],{'raw':_0x2ccb44[_0x8f7a('0x1c')]?_0x2ccb44[_0x8f7a('0x1c')][_0x8f7a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ccb44[_0x8f7a('0x1c')]?_0x2ccb44[_0x8f7a('0x1c')]['where']||null:null,'attributes':_0x2ccb44[_0x8f7a('0x1c')]?_0x2ccb44[_0x8f7a('0x1c')][_0x8f7a('0x1f')]||null:null,'limit':_0x2ccb44[_0x8f7a('0x1c')]?_0x2ccb44[_0x8f7a('0x1c')][_0x8f7a('0x29')]||null:null})[_0x8f7a('0xe')](function(_0x12bb0d){logger[_0x8f7a('0xf')](_0x8f7a('0x27'),_0x2ccb44);logger[_0x8f7a('0x23')](_0x8f7a('0x27'),_0x2ccb44,JSON[_0x8f7a('0x13')](_0x12bb0d));_0x1ccdc8(_0x12bb0d);})[_0x8f7a('0x18')](function(_0x47b928){logger[_0x8f7a('0x14')](_0x8f7a('0x27'),_0x47b928[_0x8f7a('0x16')],_0x2ccb44);_0x2f449a(_0x354d68[_0x8f7a('0x14')](0x1f4,_0x47b928[_0x8f7a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6b71e53..c312878 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 _0xe1e6=['voiceQueueReport:','./voiceQueueReport.events','update','removeListener','register','length'];(function(_0x47f942,_0x4f7601){var _0x51cb0e=function(_0x24ebdf){while(--_0x24ebdf){_0x47f942['push'](_0x47f942['shift']());}};_0x51cb0e(++_0x4f7601);}(_0xe1e6,0x67));var _0x6e1e=function(_0x3387f8,_0x366acf){_0x3387f8=_0x3387f8-0x0;var _0x10ebe3=_0xe1e6[_0x3387f8];return _0x10ebe3;};'use strict';var VoiceQueueReportEvents=require(_0x6e1e('0x0'));var events=['save','remove',_0x6e1e('0x1')];function createListener(_0x4372f1,_0x5485f1){return function(_0x4313b5){_0x5485f1['emit'](_0x4372f1,_0x4313b5);};}function removeListener(_0x3b2ba2,_0x5f0abf){return function(){VoiceQueueReportEvents[_0x6e1e('0x2')](_0x3b2ba2,_0x5f0abf);};}exports[_0x6e1e('0x3')]=function(_0x418d25){for(var _0x78014e=0x0,_0x50e059=events[_0x6e1e('0x4')];_0x78014e<_0x50e059;_0x78014e++){var _0x494037=events[_0x78014e];var _0x13fd5a=createListener(_0x6e1e('0x5')+_0x494037,_0x418d25);VoiceQueueReportEvents['on'](_0x494037,_0x13fd5a);}}; \ No newline at end of file +var _0x6969=['register','length','voiceQueueReport:','update','emit','removeListener'];(function(_0x40712b,_0x2848d0){var _0x4d004f=function(_0x202770){while(--_0x202770){_0x40712b['push'](_0x40712b['shift']());}};_0x4d004f(++_0x2848d0);}(_0x6969,0x171));var _0x9696=function(_0x5390bc,_0x2e4c9e){_0x5390bc=_0x5390bc-0x0;var _0x700e6a=_0x6969[_0x5390bc];return _0x700e6a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save','remove',_0x9696('0x0')];function createListener(_0x1ee4cd,_0x1f8430){return function(_0x5d7307){_0x1f8430[_0x9696('0x1')](_0x1ee4cd,_0x5d7307);};}function removeListener(_0x54b328,_0x5e622e){return function(){VoiceQueueReportEvents[_0x9696('0x2')](_0x54b328,_0x5e622e);};}exports[_0x9696('0x3')]=function(_0x2d7677){for(var _0x18ff08=0x0,_0x23d708=events[_0x9696('0x4')];_0x18ff08<_0x23d708;_0x18ff08++){var _0x24bcd3=events[_0x18ff08];var _0x20b620=createListener(_0x9696('0x5')+_0x24bcd3,_0x2d7677);VoiceQueueReportEvents['on'](_0x24bcd3,_0x20b620);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index dcbc6ca..53e2b03 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 _0x6714=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','/:id','isAuthenticated','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6714,0x18e));var _0x4671=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0x6714[_0x1d930e];return _0x5bbd66;};'use strict';var multer=require(_0x4671('0x0'));var util=require(_0x4671('0x1'));var path=require(_0x4671('0x2'));var timeout=require(_0x4671('0x3'));var express=require(_0x4671('0x4'));var router=express[_0x4671('0x5')]();var auth=require(_0x4671('0x6'));var interaction=require(_0x4671('0x7'));var config=require(_0x4671('0x8'));var controller=require(_0x4671('0x9'));router[_0x4671('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4671('0xa')](_0x4671('0xb'),auth[_0x4671('0xc')](),controller['show']);router[_0x4671('0xd')]('/',auth[_0x4671('0xc')](),controller[_0x4671('0xe')]);router[_0x4671('0xf')]('/:id',auth[_0x4671('0xc')](),controller['update']);router[_0x4671('0x10')](_0x4671('0xb'),auth[_0x4671('0xc')](),controller[_0x4671('0x11')]);module['exports']=router; \ No newline at end of file +var _0x644e=['/:id','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index'];(function(_0x1ca4be,_0x115169){var _0x1ab081=function(_0x6446d9){while(--_0x6446d9){_0x1ca4be['push'](_0x1ca4be['shift']());}};_0x1ab081(++_0x115169);}(_0x644e,0x103));var _0xe644=function(_0x3a39fc,_0x574759){_0x3a39fc=_0x3a39fc-0x0;var _0x417c27=_0x644e[_0x3a39fc];return _0x417c27;};'use strict';var multer=require('multer');var util=require(_0xe644('0x0'));var path=require(_0xe644('0x1'));var timeout=require(_0xe644('0x2'));var express=require(_0xe644('0x3'));var router=express[_0xe644('0x4')]();var auth=require(_0xe644('0x5'));var interaction=require(_0xe644('0x6'));var config=require(_0xe644('0x7'));var controller=require(_0xe644('0x8'));router[_0xe644('0x9')]('/',auth['isAuthenticated'](),controller[_0xe644('0xa')]);router[_0xe644('0x9')](_0xe644('0xb'),auth[_0xe644('0xc')](),controller['show']);router['post']('/',auth[_0xe644('0xc')](),controller[_0xe644('0xd')]);router[_0xe644('0xe')](_0xe644('0xb'),auth[_0xe644('0xc')](),controller[_0xe644('0xf')]);router['delete'](_0xe644('0xb'),auth[_0xe644('0xc')](),controller[_0xe644('0x10')]);module[_0xe644('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e1f012a..c2cbc27 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 _0x1361=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1361,0xfc));var _0x1136=function(_0x1cff86,_0x372714){_0x1cff86=_0x1cff86-0x0;var _0x1ce7dc=_0x1361[_0x1cff86];return _0x1ce7dc;};'use strict';var Sequelize=require(_0x1136('0x0'));var moment=require('moment');module[_0x1136('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1136('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1136('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1136('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x1136('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1136('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1136('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1136('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1136('0x3')],'allowNull':![],'defaultValue':moment()[_0x1136('0x4')](_0x1136('0x5'))}}; \ No newline at end of file +var _0x877a=['format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','DATE'];(function(_0x226e08,_0x2733dd){var _0x2d51fd=function(_0x2dc6d5){while(--_0x2dc6d5){_0x226e08['push'](_0x226e08['shift']());}};_0x2d51fd(++_0x2733dd);}(_0x877a,0x17c));var _0xa877=function(_0x57fe0c,_0x14fbeb){_0x57fe0c=_0x57fe0c-0x0;var _0x26e487=_0x877a[_0x57fe0c];return _0x26e487;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa877('0x0'));module[_0xa877('0x1')]={'time':{'type':Sequelize[_0xa877('0x2')]},'callid':{'type':Sequelize[_0xa877('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa877('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa877('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa877('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa877('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa877('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa877('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa877('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa877('0x3')],'allowNull':![],'defaultValue':moment()[_0xa877('0x4')](_0xa877('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 5135613..b80da9c 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 _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x35067a,_0x32e841){var _0x38d280=function(_0x53b383){while(--_0x53b383){_0x35067a['push'](_0x35067a['shift']());}};_0x38d280(++_0x32e841);}(_0xb10b,0x12a));var _0xbb10=function(_0x33be9d,_0x41618e){_0x33be9d=_0x33be9d-0x0;var _0x4a9267=_0xb10b[_0x33be9d];return _0x4a9267;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');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('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x24f2bf,_0x234ad5){var _0x91c3ba=function(_0x22d5ad){while(--_0x22d5ad){_0x24f2bf['push'](_0x24f2bf['shift']());}};_0x91c3ba(++_0x234ad5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index bedefdd..95ace16 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 _0x07a4=['exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','api','moment','bluebird','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x439649,_0x366523){var _0x2726da=function(_0x51a536){while(--_0x51a536){_0x439649['push'](_0x439649['shift']());}};_0x2726da(++_0x366523);}(_0x07a4,0x88));var _0x407a=function(_0x2e62d4,_0x29771c){_0x2e62d4=_0x2e62d4-0x0;var _0x2aadea=_0x07a4[_0x2e62d4];return _0x2aadea;};'use strict';var _=require('lodash');var util=require(_0x407a('0x0'));var logger=require('../../config/logger')(_0x407a('0x1'));var moment=require(_0x407a('0x2'));var BPromise=require(_0x407a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x407a('0x4'));var config=require(_0x407a('0x5'));var attributes=require(_0x407a('0x6'));module[_0x407a('0x7')]=function(_0x1ffaa2,_0x2f0fb5){return _0x1ffaa2[_0x407a('0x8')](_0x407a('0x9'),attributes,{'tableName':_0x407a('0xa'),'paranoid':![],'indexes':[{'name':_0x407a('0xb'),'fields':['event',_0x407a('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9b10=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x20faf8,_0x36bbb6){var _0xb84522=function(_0x2f04eb){while(--_0x2f04eb){_0x20faf8['push'](_0x20faf8['shift']());}};_0xb84522(++_0x36bbb6);}(_0x9b10,0xe8));var _0x09b1=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9b10[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x09b1('0x0'));var util=require(_0x09b1('0x1'));var logger=require(_0x09b1('0x2'))(_0x09b1('0x3'));var moment=require(_0x09b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x09b1('0x5'));var fs=require('fs');var path=require(_0x09b1('0x6'));var rimraf=require(_0x09b1('0x7'));var config=require('../../config/environment');var attributes=require(_0x09b1('0x8'));module[_0x09b1('0x9')]=function(_0x2bb348,_0x3d71c8){return _0x2bb348[_0x09b1('0xa')](_0x09b1('0xb'),attributes,{'tableName':_0x09b1('0xc'),'paranoid':![],'indexes':[{'name':_0x09b1('0xd'),'fields':[_0x09b1('0xe'),_0x09b1('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9c5fc6e..77b5fe3 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 _0x80ed=['request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x1f824e,_0x4b0eb4){var _0x45a2e7=function(_0xc65389){while(--_0xc65389){_0x1f824e['push'](_0x1f824e['shift']());}};_0x45a2e7(++_0x4b0eb4);}(_0x80ed,0x11c));var _0xd80e=function(_0x149f38,_0x5847bc){_0x149f38=_0x149f38-0x0;var _0x116da8=_0x80ed[_0x149f38];return _0x116da8;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});} \ No newline at end of file +var _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x4e7dea,_0x564506){var _0x9e1c80=function(_0x5bdd28){while(--_0x5bdd28){_0x4e7dea['push'](_0x4e7dea['shift']());}};_0x9e1c80(++_0x564506);}(_0x96cc,0x16c));var _0xc96c=function(_0x48bab2,_0x4f3b53){_0x48bab2=_0x48bab2-0x0;var _0xf41d3c=_0x96cc[_0x48bab2];return _0xf41d3c;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 45ae46e..d284125 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 _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x59c99c,_0x48b424){var _0xc03138=function(_0x55a131){while(--_0x55a131){_0x59c99c['push'](_0x59c99c['shift']());}};_0xc03138(++_0x48b424);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x5e7913,_0x3d4099){var _0x1d50a2=function(_0x749a9b){while(--_0x749a9b){_0x5e7913['push'](_0x5e7913['shift']());}};_0x1d50a2(++_0x3d4099);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9e1848d..eaafddc 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 _0x1181=['STRING','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','setDataValue','membername','split'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x1181,0xd2));var _0x1118=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x1181[_0x9a3e0f];return _0x3d2a9a;};'use strict';var Sequelize=require(_0x1118('0x0'));var moment=require(_0x1118('0x1'));var path=require(_0x1118('0x2'));module[_0x1118('0x3')]={'format':{'type':Sequelize[_0x1118('0x4')],'get':function(){return this[_0x1118('0x5')](_0x1118('0x6'))?path['extname'](this['getDataValue'](_0x1118('0x6'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING'],'set':function(_0x56a3a9){if(_0x56a3a9){this[_0x1118('0x7')]('channel',_0x56a3a9);this[_0x1118('0x7')](_0x1118('0x8'),_0x56a3a9[_0x1118('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x1118('0xa')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1118('0xa')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x1118('0xa')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1118('0xa')]},'exten':{'type':Sequelize[_0x1118('0xa')]},'value':{'type':Sequelize[_0x1118('0xa')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x1118('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x1118('0xa')]},'userDisposition':{'type':Sequelize[_0x1118('0xa')]},'location':{'type':Sequelize[_0x1118('0xc')]},'transcribeName':{'type':Sequelize[_0x1118('0xa')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x1118('0xc')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x1118('0xc')]},'sentiment':{'type':Sequelize[_0x1118('0xa')]},'sPositive':{'type':Sequelize[_0x1118('0xd')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x1118('0xd')]},'sMixed':{'type':Sequelize[_0x1118('0xd')]},'tempSentiment':{'type':Sequelize[_0x1118('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x1118('0xf')],'get':function(){return moment(this[_0x1118('0x5')]('createdAt'))[_0x1118('0x10')](_0x1118('0x11'))[_0x1118('0x12')]();}},'updatedAt':{'type':Sequelize[_0x1118('0xf')],'get':function(){return moment(this[_0x1118('0x5')](_0x1118('0x13')))[_0x1118('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x1118('0x12')]();}}}; \ No newline at end of file +var _0x4edb=['format','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','channel','setDataValue','split','INTEGER','TEXT','FLOAT','createdAt','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt'];(function(_0xaa0140,_0xd6c719){var _0x11ac88=function(_0x563a95){while(--_0x563a95){_0xaa0140['push'](_0xaa0140['shift']());}};_0x11ac88(++_0xd6c719);}(_0x4edb,0xf1));var _0xb4ed=function(_0x1c212f,_0x59d13f){_0x1c212f=_0x1c212f-0x0;var _0x212fee=_0x4edb[_0x1c212f];return _0x212fee;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb4ed('0x0'));var path=require(_0xb4ed('0x1'));module[_0xb4ed('0x2')]={'format':{'type':Sequelize[_0xb4ed('0x3')],'get':function(){return this[_0xb4ed('0x4')](_0xb4ed('0x5'))?path[_0xb4ed('0x6')](this[_0xb4ed('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xb4ed('0x7')]},'channel':{'type':Sequelize[_0xb4ed('0x7')],'set':function(_0x478265){if(_0x478265){this['setDataValue'](_0xb4ed('0x8'),_0x478265);this[_0xb4ed('0x9')]('membername',_0x478265[_0xb4ed('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb4ed('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb4ed('0x7')]},'accountcode':{'type':Sequelize[_0xb4ed('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb4ed('0x7')]},'value':{'type':Sequelize[_0xb4ed('0x7')]},'type':{'type':Sequelize[_0xb4ed('0x7')]},'rating':{'type':Sequelize[_0xb4ed('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xb4ed('0x7')]},'location':{'type':Sequelize[_0xb4ed('0xc')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0xb4ed('0xc')]},'fileText':{'type':Sequelize[_0xb4ed('0xc')]},'failureReason':{'type':Sequelize[_0xb4ed('0xc')]},'sentiment':{'type':Sequelize[_0xb4ed('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0xb4ed('0xd')]},'sMixed':{'type':Sequelize[_0xb4ed('0xd')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb4ed('0xe')))['format'](_0xb4ed('0xf'))[_0xb4ed('0x10')]();}},'updatedAt':{'type':Sequelize[_0xb4ed('0x11')],'get':function(){return moment(this[_0xb4ed('0x4')](_0xb4ed('0x12')))[_0xb4ed('0x13')]('MM-DD-YYYY\x20HH:mm')[_0xb4ed('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 635e914..23994e0 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 _0x815f=['transcribe','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','map','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','catch','show','params','find','create','body','describe','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','send','downloads','sequelize','token','$and','push','%s.cypher','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting'];(function(_0x2f8d56,_0x376c64){var _0x36081d=function(_0x86d523){while(--_0x86d523){_0x2f8d56['push'](_0x2f8d56['shift']());}};_0x36081d(++_0x376c64);}(_0x815f,0x149));var _0xf815=function(_0x5ebfae,_0x5b5708){_0x5ebfae=_0x5ebfae-0x0;var _0x56fcff=_0x815f[_0x5ebfae];return _0x56fcff;};'use strict';var pdf=require(_0xf815('0x0'));var emlformat=require(_0xf815('0x1'));var rimraf=require(_0xf815('0x2'));var zipdir=require(_0xf815('0x3'));var jsonpatch=require(_0xf815('0x4'));var rp=require(_0xf815('0x5'));var moment=require('moment');var BPromise=require(_0xf815('0x6'));var Mustache=require(_0xf815('0x7'));var util=require(_0xf815('0x8'));var path=require(_0xf815('0x9'));var sox=require(_0xf815('0xa'));var csv=require('to-csv');var ejs=require(_0xf815('0xb'));var fs=require('fs');var _=require(_0xf815('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf815('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf815('0xe'));var querystring=require(_0xf815('0xf'));var Papa=require(_0xf815('0x10'));var AWS=require(_0xf815('0x11'));var uuidv4=require(_0xf815('0x12'));var Redis=require(_0xf815('0x13'));var authService=require(_0xf815('0x14'));var qs=require(_0xf815('0x15'));var as=require(_0xf815('0x16'));var hardwareService=require(_0xf815('0x17'));var logger=require('../../config/logger')(_0xf815('0x18'));var utils=require(_0xf815('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e9d70,_0x25a90c){_0x25a90c=_0x25a90c||0xcc;return function(_0x9f3490){if(_0x9f3490){return _0x3e9d70['sendStatus'](_0x25a90c);}return _0x3e9d70[_0xf815('0x1a')](_0x25a90c)[_0xf815('0x1b')]();};}function respondWithResult(_0x697fb6,_0x28a5cd){_0x28a5cd=_0x28a5cd||0xc8;return function(_0x5d761f){if(_0x5d761f){return _0x697fb6[_0xf815('0x1a')](_0x28a5cd)['json'](_0x5d761f);}};}function respondWithFilteredResult(_0x517bee,_0x11bb1f){return function(_0x23468b){if(_0x23468b){var _0x46d855=_0x23468b[_0xf815('0x1c')],_0x43b843=_0x11bb1f['offset'],_0x532015=_0x11bb1f[_0xf815('0x1d')]+_0x11bb1f[_0xf815('0x1e')],_0x23eec7;if(_0x532015>=_0x46d855){_0x532015=_0x46d855;_0x23eec7=0xc8;}else{_0x23eec7=0xce;}_0x517bee['status'](_0x23eec7);return _0x517bee[_0xf815('0x1f')](_0xf815('0x20'),_0x43b843+'-'+_0x532015+'/'+_0x46d855)[_0xf815('0x21')](_0x23468b);}return null;};}function patchUpdates(_0x2c4b23){return function(_0x564a4a){try{jsonpatch[_0xf815('0x22')](_0x564a4a,_0x2c4b23,!![]);}catch(_0x56d2c6){return BPromise['reject'](_0x56d2c6);}return _0x564a4a[_0xf815('0x23')]();};}function saveUpdates(_0x580719,_0x44107b){return function(_0x299132){if(_0x299132){return _0x299132[_0xf815('0x24')](_0x580719)[_0xf815('0x25')](function(_0x1e9872){return _0x1e9872;});}return null;};}function removeEntity(_0x887a56,_0x18a2b0){return function(_0x28971e){if(_0x28971e){return _0x28971e[_0xf815('0x26')]()[_0xf815('0x25')](function(){_0x887a56['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d808,_0x1db581){return function(_0x533503){if(!_0x533503){_0x45d808[_0xf815('0x27')](0x194);}return _0x533503;};}function handleError(_0x122695,_0x5d8dd5){_0x5d8dd5=_0x5d8dd5||0x1f4;return function(_0x4bb615){logger[_0xf815('0x28')](_0x4bb615[_0xf815('0x29')]);if(_0x4bb615['name']){delete _0x4bb615[_0xf815('0x2a')];}_0x122695[_0xf815('0x1a')](_0x5d8dd5)['send'](_0x4bb615);};}exports['index']=function(_0x5e081c,_0x92b973){var _0x59b250={},_0x535e82={},_0xc37305={'count':0x0,'rows':[]};var _0x56e8d7=_[_0xf815('0x2b')](db['VoiceRecording']['rawAttributes'],function(_0x2448fb){return{'name':_0x2448fb[_0xf815('0x2c')],'type':_0x2448fb[_0xf815('0x2d')][_0xf815('0x2e')]};});_0x535e82[_0xf815('0x2f')]=_[_0xf815('0x30')](_[_0xf815('0x2b')](_0x56e8d7,'name'),[_0xf815('0x31')]);_0x535e82[_0xf815('0x32')]=_[_0xf815('0x33')](_0x5e081c[_0xf815('0x32')]);_0x535e82['filters']=_[_0xf815('0x34')](_0x535e82['model'],_0x535e82[_0xf815('0x32')]);_0x59b250[_0xf815('0x35')]=_[_0xf815('0x34')](_0x535e82[_0xf815('0x2f')],qs[_0xf815('0x36')](_0x5e081c[_0xf815('0x32')][_0xf815('0x36')]));_0x59b250[_0xf815('0x35')]=_0x59b250[_0xf815('0x35')][_0xf815('0x37')]?_0x59b250[_0xf815('0x35')]:_0x535e82['model'];if(!_0x5e081c[_0xf815('0x32')][_0xf815('0x38')](_0xf815('0x39'))){_0x59b250[_0xf815('0x1e')]=qs[_0xf815('0x1e')](_0x5e081c[_0xf815('0x32')][_0xf815('0x1e')]);_0x59b250[_0xf815('0x1d')]=qs[_0xf815('0x1d')](_0x5e081c[_0xf815('0x32')][_0xf815('0x1d')]);}_0x59b250[_0xf815('0x3a')]=qs['sort'](_0x5e081c['query'][_0xf815('0x3b')]);_0x59b250[_0xf815('0x3c')]=qs[_0xf815('0x3d')](_[_0xf815('0x3e')](_0x5e081c['query'],_0x535e82[_0xf815('0x3d')]),_0x56e8d7);if(_0x5e081c[_0xf815('0x32')][_0xf815('0x3f')]){_0x59b250['where']=_[_0xf815('0x40')](_0x59b250[_0xf815('0x3c')],{'$or':_[_0xf815('0x2b')](_0x56e8d7,function(_0x38ad0f){if(_0x38ad0f[_0xf815('0x2d')]!==_0xf815('0x41')){var _0x495b97={};_0x495b97[_0x38ad0f[_0xf815('0x2a')]]={'$like':'%'+_0x5e081c[_0xf815('0x32')][_0xf815('0x3f')]+'%'};return _0x495b97;}})});}_0x59b250=_['merge']({},_0x59b250,_0x5e081c[_0xf815('0x42')]);var _0x45e23e={'where':_0x59b250[_0xf815('0x3c')]};return db[_0xf815('0x43')]['count'](_0x45e23e)[_0xf815('0x25')](function(_0x4508df){_0xc37305[_0xf815('0x1c')]=_0x4508df;if(_0x5e081c['query'][_0xf815('0x44')]){_0x59b250[_0xf815('0x45')]=[{'all':!![]}];}return db[_0xf815('0x43')][_0xf815('0x46')](_0x59b250);})['then'](function(_0x565baf){_0xc37305['rows']=_0x565baf;return _0xc37305;})[_0xf815('0x25')](respondWithFilteredResult(_0x92b973,_0x59b250))[_0xf815('0x47')](handleError(_0x92b973,null));};exports[_0xf815('0x48')]=function(_0x1b292d,_0xf11bc7){var _0x42c5b7={'raw':![],'where':{'id':_0x1b292d[_0xf815('0x49')]['id']}},_0x1dae42={};_0x1dae42[_0xf815('0x2f')]=_['keys'](db[_0xf815('0x43')]['rawAttributes']);_0x1dae42['query']=_[_0xf815('0x33')](_0x1b292d['query']);_0x1dae42['filters']=_['intersection'](_0x1dae42[_0xf815('0x2f')],_0x1dae42[_0xf815('0x32')]);_0x42c5b7['attributes']=_[_0xf815('0x34')](_0x1dae42[_0xf815('0x2f')],qs[_0xf815('0x36')](_0x1b292d[_0xf815('0x32')][_0xf815('0x36')]));_0x42c5b7[_0xf815('0x35')]=_0x42c5b7['attributes'][_0xf815('0x37')]?_0x42c5b7[_0xf815('0x35')]:_0x1dae42[_0xf815('0x2f')];if(_0x1b292d[_0xf815('0x32')]['includeAll']){_0x42c5b7['include']=[{'all':!![]}];}_0x42c5b7=_['merge']({},_0x42c5b7,_0x1b292d['options']);return db['VoiceRecording'][_0xf815('0x4a')](_0x42c5b7)[_0xf815('0x25')](handleEntityNotFound(_0xf11bc7,null))['then'](respondWithResult(_0xf11bc7,null))[_0xf815('0x47')](handleError(_0xf11bc7,null));};exports[_0xf815('0x4b')]=function(_0x201718,_0x50fd8e){return db[_0xf815('0x43')][_0xf815('0x4b')](_0x201718[_0xf815('0x4c')],{})[_0xf815('0x25')](respondWithResult(_0x50fd8e,0xc9))[_0xf815('0x47')](handleError(_0x50fd8e,null));};exports['update']=function(_0x22b6a6,_0x124e7d){if(_0x22b6a6['body']['id']){delete _0x22b6a6[_0xf815('0x4c')]['id'];}return db[_0xf815('0x43')][_0xf815('0x4a')]({'where':{'id':_0x22b6a6[_0xf815('0x49')]['id']}})[_0xf815('0x25')](handleEntityNotFound(_0x124e7d,null))[_0xf815('0x25')](saveUpdates(_0x22b6a6[_0xf815('0x4c')],null))[_0xf815('0x25')](respondWithResult(_0x124e7d,null))[_0xf815('0x47')](handleError(_0x124e7d,null));};exports[_0xf815('0x4d')]=function(_0x42509f,_0x414864){return db[_0xf815('0x43')]['describe']()[_0xf815('0x25')](respondWithResult(_0x414864,null))[_0xf815('0x47')](handleError(_0x414864,null));};exports['download']=function(_0x52ad47,_0x37a9c8,_0xf2f4fc){var _0x3bbb21=require(_0xf815('0x4e'));var _0x4dc22d=![];var _0xaed0cd={};if(_0x52ad47[_0xf815('0x32')]['type']&&_0x52ad47[_0xf815('0x32')][_0xf815('0x2d')]==='uniqueid'){_0xaed0cd[_0xf815('0x4f')]=_0x52ad47['params']['id'];}else{_0xaed0cd['id']=_0x52ad47[_0xf815('0x49')]['id'];}return db[_0xf815('0x43')]['find']({'where':_0xaed0cd,'attributes':['id',_0xf815('0x50')],'raw':!![]})[_0xf815('0x25')](handleEntityNotFound(_0x37a9c8,null))['then'](function(_0x37127d){if(_0x37127d){var _0x2bc328=_0x37127d['value'];var _0x5cd77d=util['format']('%s.cypher',_0x2bc328);if(fs[_0xf815('0x51')](_0x5cd77d)){_0x4dc22d=!![];return _0x3bbb21[_0xf815('0x52')](_0x5cd77d,_0x2bc328,config[_0xf815('0x53')][_0xf815('0x54')])[_0xf815('0x25')](function(){return _0x37127d;});}return _0x37127d;}})['then'](function(_0x80b74f){if(_0x80b74f){var _0x4c5093=_0x80b74f[_0xf815('0x50')];if(!fs[_0xf815('0x51')](_0x4c5093)){throw new db['Sequelize'][(_0xf815('0x55'))](_0xf815('0x56'));}if(_0x80b74f[_0xf815('0x57')]){return _0x37a9c8[_0xf815('0x58')](_0x4c5093,_0x80b74f['filename']+path[_0xf815('0x59')](_0x4c5093),function(){if(_0x4dc22d){fs[_0xf815('0x5a')](_0x4c5093);}});}else{return _0x37a9c8[_0xf815('0x58')](_0x4c5093,function(_0x5ce420){if(_0x4dc22d){fs[_0xf815('0x5a')](_0x4c5093);}});}}})['catch'](function(_0x3eca29){if(_0x3eca29['message']==='VoiceRecording\x20not\x20found'){_0x37a9c8[_0xf815('0x1a')](0x194)[_0xf815('0x5b')]('Not\x20found');}else{return handleError(_0x37a9c8,null);}});};exports[_0xf815('0x5c')]=function(_0x5f0c51,_0x2e6c52,_0x20aa49){var _0x3d7bf2=require(_0xf815('0x4e'));var _0x3737b2=![];var _0x26aaad={'$and':[db[_0xf815('0x5d')]['where'](db[_0xf815('0x5d')]['fn']('MD5',db[_0xf815('0x5d')]['col'](_0xf815('0x4f'))),_0x5f0c51[_0xf815('0x32')][_0xf815('0x5e')])]};if(_0x5f0c51[_0xf815('0x32')]['type']&&_0x5f0c51[_0xf815('0x32')][_0xf815('0x2d')]===_0xf815('0x4f')){_0x26aaad['$and']['push']({'uniqueid':_0x5f0c51[_0xf815('0x49')]['id']});}else{_0x26aaad[_0xf815('0x5f')][_0xf815('0x60')]({'id':_0x5f0c51['params']['id']});}return db['VoiceRecording'][_0xf815('0x4a')]({'where':_0x26aaad,'attributes':['id',_0xf815('0x50')],'raw':!![]})[_0xf815('0x25')](handleEntityNotFound(_0x2e6c52,null))[_0xf815('0x25')](function(_0x41a2f9){if(_0x41a2f9){var _0x19f586=util['format'](_0xf815('0x61'),_0x41a2f9[_0xf815('0x50')]);if(fs['existsSync'](_0x19f586)){_0x3737b2=!![];return _0x3d7bf2[_0xf815('0x52')](_0x19f586,_0x41a2f9[_0xf815('0x50')],config['secrets']['recording'])[_0xf815('0x25')](function(){return _0x41a2f9;});}return _0x41a2f9;}})['then'](function(_0x179c21){if(_0x179c21){if(!fs[_0xf815('0x51')](_0x179c21[_0xf815('0x50')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x179c21[_0xf815('0x57')]){return _0x2e6c52[_0xf815('0x58')](_0x179c21[_0xf815('0x50')],_0x179c21[_0xf815('0x57')]+path['extname'](_0x179c21[_0xf815('0x50')]),function(){if(_0x3737b2){fs['unlink'](_0x179c21[_0xf815('0x50')]);}});}else{return _0x2e6c52[_0xf815('0x58')](_0x179c21[_0xf815('0x50')],function(_0x1dddc7){if(_0x3737b2){fs[_0xf815('0x5a')](_0x179c21['value']);}});}}})['catch'](handleError(_0x2e6c52,null));};exports[_0xf815('0x26')]=function(_0x5a3693,_0x11222a){return db[_0xf815('0x43')]['find']({'where':{'id':_0x5a3693['params']['id']}})[_0xf815('0x25')](function(_0x1a0e79){if(!_0x1a0e79)throw new ReferenceError(_0xf815('0x62'));return _0x1a0e79;})['then'](function(_0xf8f3bc){var _0x4f6872=_0xf8f3bc[_0xf815('0x50')];logger[_0xf815('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x4f6872);if(!_[_0xf815('0x64')](_0xf8f3bc[_0xf815('0x50')])&&fs[_0xf815('0x51')](_0x4f6872)){logger[_0xf815('0x63')](_0xf815('0x65')+_0x4f6872+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf815('0x66')](_0x4f6872);}_0x4f6872=_0x4f6872+_0xf815('0x67');if(!_[_0xf815('0x64')](_0xf8f3bc[_0xf815('0x50')])&&fs[_0xf815('0x51')](_0x4f6872)){logger[_0xf815('0x63')](_0xf815('0x65')+_0x4f6872+_0xf815('0x68'));fs[_0xf815('0x66')](_0x4f6872);}return _0xf8f3bc;})[_0xf815('0x25')](function(_0x5552d5){if(!_0x5552d5)throw new InternalError();return _0x5552d5[_0xf815('0x26')]();})['then'](function(){_0x11222a[_0xf815('0x1a')](0xcc)[_0xf815('0x1b')]();})[_0xf815('0x47')](handleError(_0x11222a,null));};function getBucketslist(_0x5887da,_0x3d55f6,_0x384f68){return new Promise(function(_0x505c75,_0x471d9e){var _0xc53a14=new AWS['S3']({'accessKeyId':_0x3d55f6,'secretAccessKey':_0x5887da,'region':_0x384f68});_0xc53a14[_0xf815('0x69')]({},function(_0x7720b0,_0x32375d){if(_0x7720b0){return _0x471d9e(_0x7720b0);}else{return _0x505c75(_0x32375d);}});});}function createBucket(_0x444fb0,_0x2a6932,_0x268df7,_0x314906){return new Promise(function(_0x1d441c,_0x3d9a6a){var _0x263c9c=new AWS['S3']({'accessKeyId':_0x2a6932,'secretAccessKey':_0x444fb0,'region':_0x268df7});_0x263c9c[_0xf815('0x6a')]({'Bucket':_0x314906},function(_0x4339c7,_0x69e00){if(_0x4339c7){return _0x3d9a6a(_0x4339c7);}else{return _0x1d441c(_0x69e00);}});});}function uploadFile(_0x51e7ef,_0x31d9ca,_0x5a1e67,_0x592f5b,_0x4d0eab,_0xe597a7){return new Promise(function(_0x263ee6,_0x4ce8c2){var _0x1c97c7=new AWS['S3']({'accessKeyId':_0x31d9ca,'secretAccessKey':_0x51e7ef,'region':_0x5a1e67});_0x1c97c7['upload']({'Bucket':_0x592f5b,'Key':_0x4d0eab,'Body':_0xe597a7},function(_0x296810,_0x27eb45){if(_0x296810){return _0x4ce8c2(_0x296810);}else{return _0x263ee6(_0x27eb45);}});});}function startTranscribe(_0xc398a0,_0x5761b1,_0x5ea7ae,_0x521715,_0x1f8e55,_0x1a4f12){return new Promise(function(_0x3a07c5,_0x3915d2){var _0x94dd07=new AWS['TranscribeService']({'accessKeyId':_0x5761b1,'secretAccessKey':_0xc398a0,'region':_0x5ea7ae});_0x94dd07['startTranscriptionJob']({'TranscriptionJobName':_0x521715,'LanguageCode':_0x1f8e55,'Media':{'MediaFileUri':_0x1a4f12}},function(_0x2f5f53,_0xc6f47a){if(_0x2f5f53){return _0x3915d2(_0x2f5f53);}else{return _0x3a07c5(_0xc6f47a);}});});}function transcribe(_0x47da87,_0x30d529,_0x406926,_0x238312,_0xdf232a,_0x41c1e8,_0x139bcb){return new Promise(function(_0x36ff34,_0x3f0005){var _0x2f0c3b={};logger[_0xf815('0x63')](util[_0xf815('0x31')](_0xf815('0x6b'),_0x47da87,_0xdf232a));return uploadFile(_0x30d529,_0x406926,_0x238312,_0xdf232a,path['basename'](_0x41c1e8),fs[_0xf815('0x6c')](_0x41c1e8))['then'](function(_0x48d724){logger[_0xf815('0x63')](util[_0xf815('0x31')](_0xf815('0x6d'),_0x47da87,_0xdf232a,_0x48d724[_0xf815('0x6e')]));_0x2f0c3b['bucket']=_0x48d724[_0xf815('0x6f')];_0x2f0c3b[_0xf815('0x70')]=_0x48d724[_0xf815('0x6e')];logger['info'](util[_0xf815('0x31')](_0xf815('0x71'),_0x47da87));return startTranscribe(_0x30d529,_0x406926,_0x238312,uuidv4(),_0x139bcb,_0x48d724[_0xf815('0x6e')]);})[_0xf815('0x25')](function(_0x484d34){logger[_0xf815('0x63')](util['format'](_0xf815('0x72'),_0x47da87,_0x484d34[_0xf815('0x73')][_0xf815('0x74')]));_0x2f0c3b[_0xf815('0x75')]=_0x484d34[_0xf815('0x73')]['TranscriptionJobName'];_0x2f0c3b[_0xf815('0x76')]=_0x484d34[_0xf815('0x73')]['TranscriptionJobStatus'];return _0x36ff34(_0x2f0c3b);})[_0xf815('0x47')](function(_0x58f1f1){return _0x3f0005(_0x58f1f1);});});}exports[_0xf815('0x77')]=function(_0x51eeb2,_0x277781,_0x3c7039){var _0x2e96a6;var _0x4e379b;var _0x58fb3b;var _0x883217=require(_0xf815('0x4e'));return db[_0xf815('0x43')][_0xf815('0x78')]({'where':{'id':_0x51eeb2[_0xf815('0x49')]['id']}})[_0xf815('0x25')](function(_0x5500ff){if(_0x5500ff){var _0xe87f9=util[_0xf815('0x31')]('%s.cypher',_0x5500ff[_0xf815('0x50')]);if(fs[_0xf815('0x51')](_0xe87f9)){cypher=!![];return _0x883217[_0xf815('0x52')](_0xe87f9,_0x5500ff[_0xf815('0x50')],config[_0xf815('0x53')][_0xf815('0x54')])[_0xf815('0x25')](function(){return _0x5500ff;});}return _0x5500ff;}})['then'](function(_0x13b646){if(!_0x13b646){throw new db[(_0xf815('0x79'))][(_0xf815('0x55'))](_0xf815('0x7a'));}_0x4e379b=_0x13b646;return db[_0xf815('0x7b')]['findOne']({'where':{'id':0x1}});})[_0xf815('0x25')](handleEntityNotFound(_0x277781,null))[_0xf815('0x25')](function(_0x4c8031){if(_0x4c8031){_0x2e96a6=_0x4c8031;if(!_0x2e96a6[_0xf815('0x7c')]||!_0x2e96a6['transcribeAccountId']||!_0x2e96a6['transcribeRegion']||!_0x2e96a6[_0xf815('0x7d')]||!_0x2e96a6[_0xf815('0x7e')]){throw new db[(_0xf815('0x79'))][(_0xf815('0x55'))](_0xf815('0x7f'));}if(_0x51eeb2[_0xf815('0x4c')][_0xf815('0x80')]&&(!_0x2e96a6[_0xf815('0x81')]||!_0x2e96a6['sentimentAccountId']||!_0x2e96a6[_0xf815('0x82')]||!_0x2e96a6['language']||!_0x2e96a6[_0xf815('0x7e')])){throw new db['Sequelize'][(_0xf815('0x55'))](_0xf815('0x83'));}return db['CloudProvider'][_0xf815('0x78')]({'where':{'id':_0x2e96a6['transcribeAccountId']}});}})['then'](function(_0x39ef1d){if(!_0x39ef1d){throw new db[(_0xf815('0x79'))][(_0xf815('0x55'))](_0xf815('0x84'));}if(!_0x39ef1d[_0xf815('0x85')]||!_0x39ef1d[_0xf815('0x86')]){throw new db['Sequelize'][(_0xf815('0x55'))](_0xf815('0x87'));}_0x58fb3b=_0x39ef1d;return getBucketslist(_0x58fb3b[_0xf815('0x85')],_0x58fb3b['data2'],_0x2e96a6[_0xf815('0x88')]);})[_0xf815('0x25')](function(_0x5bebf0){if(_0x5bebf0&&_0x5bebf0[_0xf815('0x89')]){var _0x365d14=_['find'](_0x5bebf0[_0xf815('0x89')],function(_0x5dcd9a){return _0x5dcd9a[_0xf815('0x8a')]===_0x2e96a6[_0xf815('0x7e')];});if(!_0x365d14){logger['info'](util[_0xf815('0x31')](_0xf815('0x8b'),_0x51eeb2[_0xf815('0x49')]['id'],_0x2e96a6[_0xf815('0x7e')]));return createBucket(_0x58fb3b['data1'],_0x58fb3b['data2'],_0x2e96a6['transcribeRegion'],_0x2e96a6[_0xf815('0x7e')]);}logger[_0xf815('0x63')](util[_0xf815('0x31')](_0xf815('0x8c'),_0x51eeb2[_0xf815('0x49')]['id'],_0x2e96a6[_0xf815('0x7e')]));return;}})[_0xf815('0x25')](function(_0x5c1067){if(_0x4e379b['transcribeStatus']===_0xf815('0x8d')){return transcribe(_0x51eeb2[_0xf815('0x49')]['id'],_0x58fb3b['data1'],_0x58fb3b[_0xf815('0x86')],_0x2e96a6[_0xf815('0x88')],_0x2e96a6[_0xf815('0x7e')],_0x4e379b[_0xf815('0x50')],_0x2e96a6[_0xf815('0x7d')]);}else{logger[_0xf815('0x63')](util[_0xf815('0x31')](_0xf815('0x8e'),_0x51eeb2['params']['id']));return{'transcribeStatus':_0xf815('0x8f')};}})['then'](function(_0x1515a4){if(_0x1515a4){_0x1515a4[_0xf815('0x90')]=_0x51eeb2[_0xf815('0x4c')][_0xf815('0x80')];return _0x4e379b[_0xf815('0x91')](_0x1515a4);}})[_0xf815('0x25')](respondWithResult(_0x277781,null))[_0xf815('0x47')](handleError(_0x277781,null));};function writeFile(_0x356bbc,_0x250a6a){return new Promise(function(_0x534ee0,_0x95c831){fs['writeFile'](_0x250a6a,_0x356bbc,function(_0xdba5e4,_0x2bc904){if(_0xdba5e4){return _0x95c831(_0xdba5e4);}else{return _0x534ee0(_0x2bc904);}});});}exports[_0xf815('0x92')]=function(_0x46bc49,_0x21e1da,_0x4d6e60){return db[_0xf815('0x43')][_0xf815('0x78')]({'where':{'id':_0x46bc49['params']['id']}})[_0xf815('0x25')](handleEntityNotFound(_0x21e1da))['then'](function(_0x230096){if(_0x230096&&_0x230096[_0xf815('0x93')]){var _0x21496b=_0x230096[_0xf815('0x93')];var _0x5dfa42=config['root']+_0xf815('0x94')+_0x230096['id']+_0xf815('0x95');if(fs[_0xf815('0x51')](_0x5dfa42)){return _0x5dfa42;}return writeFile(_0x21496b,_0x5dfa42)[_0xf815('0x25')](function(){return _0x5dfa42;});}else{throw new db['Sequelize'][(_0xf815('0x55'))](_0xf815('0x96'));}})[_0xf815('0x25')](function(_0x35ccab){return _0x21e1da['download'](_0x35ccab);})['catch'](handleError(_0x21e1da));}; \ No newline at end of file +var _0x5f70=['/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','reject','save','then','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','filename','extname','unlink','message','downloads','MD5','col','token','$and','push','Sequelize','ValidationError','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','downloadTranscribe','fileText','root'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0x5f70,0x9b));var _0x05f7=function(_0x57badd,_0x33bf97){_0x57badd=_0x57badd-0x0;var _0x440464=_0x5f70[_0x57badd];return _0x440464;};'use strict';var pdf=require(_0x05f7('0x0'));var emlformat=require(_0x05f7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x05f7('0x2'));var rp=require(_0x05f7('0x3'));var moment=require(_0x05f7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x05f7('0x5'));var path=require(_0x05f7('0x6'));var sox=require(_0x05f7('0x7'));var csv=require(_0x05f7('0x8'));var ejs=require(_0x05f7('0x9'));var fs=require('fs');var _=require(_0x05f7('0xa'));var squel=require(_0x05f7('0xb'));var crypto=require(_0x05f7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x05f7('0xd'));var toCsv=require(_0x05f7('0x8'));var querystring=require(_0x05f7('0xe'));var Papa=require('papaparse');var AWS=require(_0x05f7('0xf'));var uuidv4=require('uuid/v4');var Redis=require(_0x05f7('0x10'));var authService=require(_0x05f7('0x11'));var qs=require(_0x05f7('0x12'));var as=require(_0x05f7('0x13'));var hardwareService=require(_0x05f7('0x14'));var logger=require(_0x05f7('0x15'))(_0x05f7('0x16'));var utils=require(_0x05f7('0x17'));var config=require(_0x05f7('0x18'));var db=require(_0x05f7('0x19'))['db'];function respondWithStatusCode(_0x3eea97,_0x3cef12){_0x3cef12=_0x3cef12||0xcc;return function(_0x26e249){if(_0x26e249){return _0x3eea97['sendStatus'](_0x3cef12);}return _0x3eea97[_0x05f7('0x1a')](_0x3cef12)['end']();};}function respondWithResult(_0x4f8ff0,_0x5bdd92){_0x5bdd92=_0x5bdd92||0xc8;return function(_0x90bbca){if(_0x90bbca){return _0x4f8ff0[_0x05f7('0x1a')](_0x5bdd92)[_0x05f7('0x1b')](_0x90bbca);}};}function respondWithFilteredResult(_0x69a252,_0x41b08e){return function(_0x3592dc){if(_0x3592dc){var _0x49e6c6=_0x3592dc['count'],_0x29d222=_0x41b08e[_0x05f7('0x1c')],_0x1296f7=_0x41b08e[_0x05f7('0x1c')]+_0x41b08e['limit'],_0x2777c6;if(_0x1296f7>=_0x49e6c6){_0x1296f7=_0x49e6c6;_0x2777c6=0xc8;}else{_0x2777c6=0xce;}_0x69a252[_0x05f7('0x1a')](_0x2777c6);return _0x69a252[_0x05f7('0x1d')](_0x05f7('0x1e'),_0x29d222+'-'+_0x1296f7+'/'+_0x49e6c6)[_0x05f7('0x1b')](_0x3592dc);}return null;};}function patchUpdates(_0x26e640){return function(_0x24b040){try{jsonpatch['apply'](_0x24b040,_0x26e640,!![]);}catch(_0x403fa1){return BPromise[_0x05f7('0x1f')](_0x403fa1);}return _0x24b040[_0x05f7('0x20')]();};}function saveUpdates(_0x2a1b7a,_0x1c99f8){return function(_0x2caa8f){if(_0x2caa8f){return _0x2caa8f['update'](_0x2a1b7a)['then'](function(_0x2a17b3){return _0x2a17b3;});}return null;};}function removeEntity(_0x263ea2,_0x3b31e9){return function(_0x1bd2d0){if(_0x1bd2d0){return _0x1bd2d0['destroy']()[_0x05f7('0x21')](function(){_0x263ea2['status'](0xcc)[_0x05f7('0x22')]();});}};}function handleEntityNotFound(_0x5cdca2,_0x421aac){return function(_0x1b4141){if(!_0x1b4141){_0x5cdca2['sendStatus'](0x194);}return _0x1b4141;};}function handleError(_0x1486ee,_0x10bcb8){_0x10bcb8=_0x10bcb8||0x1f4;return function(_0x3580dd){logger[_0x05f7('0x23')](_0x3580dd[_0x05f7('0x24')]);if(_0x3580dd[_0x05f7('0x25')]){delete _0x3580dd[_0x05f7('0x25')];}_0x1486ee['status'](_0x10bcb8)[_0x05f7('0x26')](_0x3580dd);};}exports[_0x05f7('0x27')]=function(_0xdaed9,_0x456f56){var _0x540550={},_0x21ecbd={},_0x54dc8b={'count':0x0,'rows':[]};var _0x542126=_[_0x05f7('0x28')](db[_0x05f7('0x29')][_0x05f7('0x2a')],function(_0x36b039){return{'name':_0x36b039[_0x05f7('0x2b')],'type':_0x36b039[_0x05f7('0x2c')][_0x05f7('0x2d')]};});_0x21ecbd[_0x05f7('0x2e')]=_['differenceBy'](_[_0x05f7('0x28')](_0x542126,_0x05f7('0x25')),[_0x05f7('0x2f')]);_0x21ecbd[_0x05f7('0x30')]=_[_0x05f7('0x31')](_0xdaed9['query']);_0x21ecbd['filters']=_['intersection'](_0x21ecbd[_0x05f7('0x2e')],_0x21ecbd[_0x05f7('0x30')]);_0x540550['attributes']=_[_0x05f7('0x32')](_0x21ecbd[_0x05f7('0x2e')],qs[_0x05f7('0x33')](_0xdaed9[_0x05f7('0x30')][_0x05f7('0x33')]));_0x540550['attributes']=_0x540550[_0x05f7('0x34')][_0x05f7('0x35')]?_0x540550[_0x05f7('0x34')]:_0x21ecbd[_0x05f7('0x2e')];if(!_0xdaed9[_0x05f7('0x30')][_0x05f7('0x36')](_0x05f7('0x37'))){_0x540550[_0x05f7('0x38')]=qs[_0x05f7('0x38')](_0xdaed9[_0x05f7('0x30')]['limit']);_0x540550[_0x05f7('0x1c')]=qs[_0x05f7('0x1c')](_0xdaed9[_0x05f7('0x30')]['offset']);}_0x540550['order']=qs[_0x05f7('0x39')](_0xdaed9[_0x05f7('0x30')][_0x05f7('0x39')]);_0x540550[_0x05f7('0x3a')]=qs[_0x05f7('0x3b')](_[_0x05f7('0x3c')](_0xdaed9['query'],_0x21ecbd[_0x05f7('0x3b')]),_0x542126);if(_0xdaed9[_0x05f7('0x30')][_0x05f7('0x3d')]){_0x540550[_0x05f7('0x3a')]=_[_0x05f7('0x3e')](_0x540550[_0x05f7('0x3a')],{'$or':_[_0x05f7('0x28')](_0x542126,function(_0x484997){if(_0x484997[_0x05f7('0x2c')]!==_0x05f7('0x3f')){var _0x34cd13={};_0x34cd13[_0x484997[_0x05f7('0x25')]]={'$like':'%'+_0xdaed9[_0x05f7('0x30')][_0x05f7('0x3d')]+'%'};return _0x34cd13;}})});}_0x540550=_['merge']({},_0x540550,_0xdaed9[_0x05f7('0x40')]);var _0x267e43={'where':_0x540550['where']};return db[_0x05f7('0x29')]['count'](_0x267e43)['then'](function(_0x5da6dd){_0x54dc8b[_0x05f7('0x41')]=_0x5da6dd;if(_0xdaed9[_0x05f7('0x30')]['includeAll']){_0x540550[_0x05f7('0x42')]=[{'all':!![]}];}return db[_0x05f7('0x29')][_0x05f7('0x43')](_0x540550);})[_0x05f7('0x21')](function(_0x4e1773){_0x54dc8b[_0x05f7('0x44')]=_0x4e1773;return _0x54dc8b;})[_0x05f7('0x21')](respondWithFilteredResult(_0x456f56,_0x540550))[_0x05f7('0x45')](handleError(_0x456f56,null));};exports[_0x05f7('0x46')]=function(_0x5e0718,_0x4ba473){var _0x1def42={'raw':![],'where':{'id':_0x5e0718[_0x05f7('0x47')]['id']}},_0x1bc064={};_0x1bc064['model']=_[_0x05f7('0x31')](db[_0x05f7('0x29')][_0x05f7('0x2a')]);_0x1bc064['query']=_[_0x05f7('0x31')](_0x5e0718['query']);_0x1bc064[_0x05f7('0x3b')]=_[_0x05f7('0x32')](_0x1bc064[_0x05f7('0x2e')],_0x1bc064[_0x05f7('0x30')]);_0x1def42['attributes']=_[_0x05f7('0x32')](_0x1bc064[_0x05f7('0x2e')],qs[_0x05f7('0x33')](_0x5e0718[_0x05f7('0x30')][_0x05f7('0x33')]));_0x1def42[_0x05f7('0x34')]=_0x1def42[_0x05f7('0x34')][_0x05f7('0x35')]?_0x1def42['attributes']:_0x1bc064[_0x05f7('0x2e')];if(_0x5e0718['query'][_0x05f7('0x48')]){_0x1def42[_0x05f7('0x42')]=[{'all':!![]}];}_0x1def42=_[_0x05f7('0x3e')]({},_0x1def42,_0x5e0718[_0x05f7('0x40')]);return db[_0x05f7('0x29')][_0x05f7('0x49')](_0x1def42)[_0x05f7('0x21')](handleEntityNotFound(_0x4ba473,null))['then'](respondWithResult(_0x4ba473,null))['catch'](handleError(_0x4ba473,null));};exports[_0x05f7('0x4a')]=function(_0x4d6f2b,_0xb1224){return db[_0x05f7('0x29')][_0x05f7('0x4a')](_0x4d6f2b['body'],{})[_0x05f7('0x21')](respondWithResult(_0xb1224,0xc9))[_0x05f7('0x45')](handleError(_0xb1224,null));};exports[_0x05f7('0x4b')]=function(_0x58f15a,_0x1a2b31){if(_0x58f15a[_0x05f7('0x4c')]['id']){delete _0x58f15a['body']['id'];}return db['VoiceRecording'][_0x05f7('0x49')]({'where':{'id':_0x58f15a[_0x05f7('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a2b31,null))[_0x05f7('0x21')](saveUpdates(_0x58f15a['body'],null))[_0x05f7('0x21')](respondWithResult(_0x1a2b31,null))[_0x05f7('0x45')](handleError(_0x1a2b31,null));};exports[_0x05f7('0x4d')]=function(_0x267004,_0x365208){return db[_0x05f7('0x29')][_0x05f7('0x4d')]()[_0x05f7('0x21')](respondWithResult(_0x365208,null))['catch'](handleError(_0x365208,null));};exports[_0x05f7('0x4e')]=function(_0x3d7895,_0x406ebe,_0x57fdbe){var _0x20a5c7=require(_0x05f7('0x4f'));var _0x18a23d=![];var _0x5a70b2={};if(_0x3d7895[_0x05f7('0x30')]['type']&&_0x3d7895[_0x05f7('0x30')][_0x05f7('0x2c')]==='uniqueid'){_0x5a70b2[_0x05f7('0x50')]=_0x3d7895[_0x05f7('0x47')]['id'];}else{_0x5a70b2['id']=_0x3d7895[_0x05f7('0x47')]['id'];}return db[_0x05f7('0x29')][_0x05f7('0x49')]({'where':_0x5a70b2,'attributes':['id',_0x05f7('0x51')],'raw':!![]})[_0x05f7('0x21')](handleEntityNotFound(_0x406ebe,null))[_0x05f7('0x21')](function(_0x2f3adf){if(_0x2f3adf){var _0x28b37c=_0x2f3adf[_0x05f7('0x51')];var _0x200821=util[_0x05f7('0x2f')](_0x05f7('0x52'),_0x28b37c);if(fs['existsSync'](_0x200821)){_0x18a23d=!![];return _0x20a5c7[_0x05f7('0x53')](_0x200821,_0x28b37c,config[_0x05f7('0x54')][_0x05f7('0x55')])[_0x05f7('0x21')](function(){return _0x2f3adf;});}return _0x2f3adf;}})[_0x05f7('0x21')](function(_0x2d26ac){if(_0x2d26ac){var _0x1bc68d=_0x2d26ac['value'];if(!fs[_0x05f7('0x56')](_0x1bc68d)){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2d26ac[_0x05f7('0x57')]){return _0x406ebe['download'](_0x1bc68d,_0x2d26ac['filename']+path[_0x05f7('0x58')](_0x1bc68d),function(){if(_0x18a23d){fs[_0x05f7('0x59')](_0x1bc68d);}});}else{return _0x406ebe[_0x05f7('0x4e')](_0x1bc68d,function(_0x256d44){if(_0x18a23d){fs[_0x05f7('0x59')](_0x1bc68d);}});}}})[_0x05f7('0x45')](function(_0x55ca59){if(_0x55ca59[_0x05f7('0x5a')]==='VoiceRecording\x20not\x20found'){_0x406ebe[_0x05f7('0x1a')](0x194)[_0x05f7('0x26')]('Not\x20found');}else{return handleError(_0x406ebe,null);}});};exports[_0x05f7('0x5b')]=function(_0x207d55,_0x538aed,_0x40f91d){var _0x6dfba7=require(_0x05f7('0x4f'));var _0x207b5c=![];var _0x5ed72c={'$and':[db['sequelize'][_0x05f7('0x3a')](db['sequelize']['fn'](_0x05f7('0x5c'),db['sequelize'][_0x05f7('0x5d')](_0x05f7('0x50'))),_0x207d55[_0x05f7('0x30')][_0x05f7('0x5e')])]};if(_0x207d55[_0x05f7('0x30')][_0x05f7('0x2c')]&&_0x207d55[_0x05f7('0x30')][_0x05f7('0x2c')]===_0x05f7('0x50')){_0x5ed72c[_0x05f7('0x5f')][_0x05f7('0x60')]({'uniqueid':_0x207d55[_0x05f7('0x47')]['id']});}else{_0x5ed72c[_0x05f7('0x5f')][_0x05f7('0x60')]({'id':_0x207d55[_0x05f7('0x47')]['id']});}return db[_0x05f7('0x29')][_0x05f7('0x49')]({'where':_0x5ed72c,'attributes':['id',_0x05f7('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x538aed,null))[_0x05f7('0x21')](function(_0x1c242f){if(_0x1c242f){var _0x6c058b=util[_0x05f7('0x2f')]('%s.cypher',_0x1c242f[_0x05f7('0x51')]);if(fs['existsSync'](_0x6c058b)){_0x207b5c=!![];return _0x6dfba7[_0x05f7('0x53')](_0x6c058b,_0x1c242f[_0x05f7('0x51')],config[_0x05f7('0x54')][_0x05f7('0x55')])[_0x05f7('0x21')](function(){return _0x1c242f;});}return _0x1c242f;}})[_0x05f7('0x21')](function(_0x106907){if(_0x106907){if(!fs[_0x05f7('0x56')](_0x106907['value'])){throw new db[(_0x05f7('0x61'))][(_0x05f7('0x62'))]('VoiceRecording\x20not\x20found');}if(_0x106907[_0x05f7('0x57')]){return _0x538aed[_0x05f7('0x4e')](_0x106907[_0x05f7('0x51')],_0x106907[_0x05f7('0x57')]+path['extname'](_0x106907[_0x05f7('0x51')]),function(){if(_0x207b5c){fs[_0x05f7('0x59')](_0x106907[_0x05f7('0x51')]);}});}else{return _0x538aed[_0x05f7('0x4e')](_0x106907['value'],function(_0x17238b){if(_0x207b5c){fs[_0x05f7('0x59')](_0x106907['value']);}});}}})[_0x05f7('0x45')](handleError(_0x538aed,null));};exports[_0x05f7('0x63')]=function(_0x34f52d,_0x234926){return db[_0x05f7('0x29')][_0x05f7('0x49')]({'where':{'id':_0x34f52d[_0x05f7('0x47')]['id']}})[_0x05f7('0x21')](function(_0x1acd55){if(!_0x1acd55)throw new ReferenceError(_0x05f7('0x64'));return _0x1acd55;})[_0x05f7('0x21')](function(_0x5f51f5){var _0x47b400=_0x5f51f5[_0x05f7('0x51')];logger['info'](_0x05f7('0x65'),_0x47b400);if(!_[_0x05f7('0x66')](_0x5f51f5[_0x05f7('0x51')])&&fs['existsSync'](_0x47b400)){logger[_0x05f7('0x67')]('File:\x20\x22'+_0x47b400+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x05f7('0x68')](_0x47b400);}_0x47b400=_0x47b400+_0x05f7('0x69');if(!_[_0x05f7('0x66')](_0x5f51f5[_0x05f7('0x51')])&&fs['existsSync'](_0x47b400)){logger[_0x05f7('0x67')]('File:\x20\x22'+_0x47b400+_0x05f7('0x6a'));fs[_0x05f7('0x68')](_0x47b400);}return _0x5f51f5;})[_0x05f7('0x21')](function(_0x558c50){if(!_0x558c50)throw new InternalError();return _0x558c50['destroy']();})[_0x05f7('0x21')](function(){_0x234926[_0x05f7('0x1a')](0xcc)['end']();})[_0x05f7('0x45')](handleError(_0x234926,null));};function getBucketslist(_0x2549e3,_0x384385,_0x1af13f){return new Promise(function(_0x204c15,_0x2c874b){var _0x1e72e3=new AWS['S3']({'accessKeyId':_0x384385,'secretAccessKey':_0x2549e3,'region':_0x1af13f});_0x1e72e3[_0x05f7('0x6b')]({},function(_0x2b1031,_0x28244b){if(_0x2b1031){return _0x2c874b(_0x2b1031);}else{return _0x204c15(_0x28244b);}});});}function createBucket(_0x173d73,_0x5a9951,_0x29f5b8,_0x1f6c46){return new Promise(function(_0x36d515,_0x37eae7){var _0x4f3a85=new AWS['S3']({'accessKeyId':_0x5a9951,'secretAccessKey':_0x173d73,'region':_0x29f5b8});_0x4f3a85[_0x05f7('0x6c')]({'Bucket':_0x1f6c46},function(_0x2ddfa5,_0x5b69d0){if(_0x2ddfa5){return _0x37eae7(_0x2ddfa5);}else{return _0x36d515(_0x5b69d0);}});});}function uploadFile(_0x2a2f8e,_0x4465b0,_0x25423e,_0x57422b,_0x4b11f2,_0x488822){return new Promise(function(_0x27326a,_0x144fa1){var _0x3caa92=new AWS['S3']({'accessKeyId':_0x4465b0,'secretAccessKey':_0x2a2f8e,'region':_0x25423e});_0x3caa92[_0x05f7('0x6d')]({'Bucket':_0x57422b,'Key':_0x4b11f2,'Body':_0x488822},function(_0x211fd2,_0x4dd693){if(_0x211fd2){return _0x144fa1(_0x211fd2);}else{return _0x27326a(_0x4dd693);}});});}function startTranscribe(_0x3246ba,_0x1c760e,_0x38a201,_0x2095b8,_0x1dac4e,_0x2a530c){return new Promise(function(_0x1b3fd2,_0x411099){var _0x9762d8=new AWS[(_0x05f7('0x6e'))]({'accessKeyId':_0x1c760e,'secretAccessKey':_0x3246ba,'region':_0x38a201});_0x9762d8['startTranscriptionJob']({'TranscriptionJobName':_0x2095b8,'LanguageCode':_0x1dac4e,'Media':{'MediaFileUri':_0x2a530c}},function(_0x1af422,_0x162fdd){if(_0x1af422){return _0x411099(_0x1af422);}else{return _0x1b3fd2(_0x162fdd);}});});}function transcribe(_0x202feb,_0x387ab0,_0x430bf1,_0x3b9fd5,_0x2a9bf5,_0x3e00d6,_0x41c123){return new Promise(function(_0x3e14d5,_0x4c8d0d){var _0x3a3391={};logger['info'](util[_0x05f7('0x2f')](_0x05f7('0x6f'),_0x202feb,_0x2a9bf5));return uploadFile(_0x387ab0,_0x430bf1,_0x3b9fd5,_0x2a9bf5,path[_0x05f7('0x70')](_0x3e00d6),fs[_0x05f7('0x71')](_0x3e00d6))['then'](function(_0x256c5a){logger[_0x05f7('0x67')](util['format'](_0x05f7('0x72'),_0x202feb,_0x2a9bf5,_0x256c5a['Location']));_0x3a3391[_0x05f7('0x73')]=_0x256c5a[_0x05f7('0x74')];_0x3a3391['location']=_0x256c5a['Location'];logger['info'](util[_0x05f7('0x2f')](_0x05f7('0x75'),_0x202feb));return startTranscribe(_0x387ab0,_0x430bf1,_0x3b9fd5,uuidv4(),_0x41c123,_0x256c5a['Location']);})[_0x05f7('0x21')](function(_0x2e72fc){logger[_0x05f7('0x67')](util[_0x05f7('0x2f')](_0x05f7('0x76'),_0x202feb,_0x2e72fc['TranscriptionJob'][_0x05f7('0x77')]));_0x3a3391[_0x05f7('0x78')]=_0x2e72fc[_0x05f7('0x79')][_0x05f7('0x77')];_0x3a3391['transcribeStatus']=_0x2e72fc[_0x05f7('0x79')][_0x05f7('0x7a')];return _0x3e14d5(_0x3a3391);})[_0x05f7('0x45')](function(_0x452f3a){return _0x4c8d0d(_0x452f3a);});});}exports[_0x05f7('0x7b')]=function(_0x46617f,_0x2d067d,_0x57013b){var _0x1c39f9;var _0x9ab529;var _0x5bbfc9;var _0x11c8bc=require(_0x05f7('0x4f'));return db['VoiceRecording'][_0x05f7('0x7c')]({'where':{'id':_0x46617f['params']['id']}})[_0x05f7('0x21')](function(_0x521378){if(_0x521378){var _0x5e2f05=util[_0x05f7('0x2f')](_0x05f7('0x52'),_0x521378[_0x05f7('0x51')]);if(fs[_0x05f7('0x56')](_0x5e2f05)){cypher=!![];return _0x11c8bc['decryptFile'](_0x5e2f05,_0x521378[_0x05f7('0x51')],config['secrets'][_0x05f7('0x55')])['then'](function(){return _0x521378;});}return _0x521378;}})[_0x05f7('0x21')](function(_0x174deb){if(!_0x174deb){throw new db[(_0x05f7('0x61'))][(_0x05f7('0x62'))](_0x05f7('0x7d'));}_0x9ab529=_0x174deb;return db[_0x05f7('0x7e')]['findOne']({'where':{'id':0x1}});})[_0x05f7('0x21')](handleEntityNotFound(_0x2d067d,null))[_0x05f7('0x21')](function(_0x5992bc){if(_0x5992bc){_0x1c39f9=_0x5992bc;if(!_0x1c39f9[_0x05f7('0x7f')]||!_0x1c39f9[_0x05f7('0x80')]||!_0x1c39f9['transcribeRegion']||!_0x1c39f9['language']||!_0x1c39f9[_0x05f7('0x73')]){throw new db['Sequelize']['ValidationError'](_0x05f7('0x81'));}if(_0x46617f[_0x05f7('0x4c')][_0x05f7('0x82')]&&(!_0x1c39f9[_0x05f7('0x83')]||!_0x1c39f9['sentimentAccountId']||!_0x1c39f9[_0x05f7('0x84')]||!_0x1c39f9[_0x05f7('0x85')]||!_0x1c39f9[_0x05f7('0x73')])){throw new db['Sequelize'][(_0x05f7('0x62'))](_0x05f7('0x86'));}return db['CloudProvider'][_0x05f7('0x7c')]({'where':{'id':_0x1c39f9[_0x05f7('0x80')]}});}})['then'](function(_0xa6d234){if(!_0xa6d234){throw new db[(_0x05f7('0x61'))][(_0x05f7('0x62'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xa6d234[_0x05f7('0x87')]||!_0xa6d234[_0x05f7('0x88')]){throw new db[(_0x05f7('0x61'))][(_0x05f7('0x62'))](_0x05f7('0x89'));}_0x5bbfc9=_0xa6d234;return getBucketslist(_0x5bbfc9['data1'],_0x5bbfc9[_0x05f7('0x88')],_0x1c39f9['transcribeRegion']);})[_0x05f7('0x21')](function(_0x446ba9){if(_0x446ba9&&_0x446ba9['Buckets']){var _0x337e1a=_[_0x05f7('0x49')](_0x446ba9[_0x05f7('0x8a')],function(_0x22d085){return _0x22d085[_0x05f7('0x8b')]===_0x1c39f9['bucket'];});if(!_0x337e1a){logger[_0x05f7('0x67')](util['format'](_0x05f7('0x8c'),_0x46617f[_0x05f7('0x47')]['id'],_0x1c39f9[_0x05f7('0x73')]));return createBucket(_0x5bbfc9[_0x05f7('0x87')],_0x5bbfc9['data2'],_0x1c39f9['transcribeRegion'],_0x1c39f9['bucket']);}logger['info'](util['format'](_0x05f7('0x8d'),_0x46617f[_0x05f7('0x47')]['id'],_0x1c39f9[_0x05f7('0x73')]));return;}})[_0x05f7('0x21')](function(_0x324c81){if(_0x9ab529[_0x05f7('0x8e')]===_0x05f7('0x8f')){return transcribe(_0x46617f[_0x05f7('0x47')]['id'],_0x5bbfc9[_0x05f7('0x87')],_0x5bbfc9['data2'],_0x1c39f9['transcribeRegion'],_0x1c39f9[_0x05f7('0x73')],_0x9ab529[_0x05f7('0x51')],_0x1c39f9['language']);}else{logger[_0x05f7('0x67')](util['format'](_0x05f7('0x90'),_0x46617f[_0x05f7('0x47')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x05f7('0x21')](function(_0x57b14c){if(_0x57b14c){_0x57b14c['tempSentiment']=_0x46617f[_0x05f7('0x4c')]['runSentiment'];return _0x9ab529[_0x05f7('0x91')](_0x57b14c);}})[_0x05f7('0x21')](respondWithResult(_0x2d067d,null))[_0x05f7('0x45')](handleError(_0x2d067d,null));};function writeFile(_0x634d3e,_0x4c054e){return new Promise(function(_0x5e2c5d,_0x3aa5c1){fs['writeFile'](_0x4c054e,_0x634d3e,function(_0x12db15,_0x167d41){if(_0x12db15){return _0x3aa5c1(_0x12db15);}else{return _0x5e2c5d(_0x167d41);}});});}exports[_0x05f7('0x92')]=function(_0x41b3f5,_0x5c9a35,_0x521323){return db[_0x05f7('0x29')][_0x05f7('0x7c')]({'where':{'id':_0x41b3f5[_0x05f7('0x47')]['id']}})[_0x05f7('0x21')](handleEntityNotFound(_0x5c9a35))[_0x05f7('0x21')](function(_0x1bd0d5){if(_0x1bd0d5&&_0x1bd0d5[_0x05f7('0x93')]){var _0x5d99ef=_0x1bd0d5[_0x05f7('0x93')];var _0x46dcf4=config[_0x05f7('0x94')]+_0x05f7('0x95')+_0x1bd0d5['id']+_0x05f7('0x96');if(fs['existsSync'](_0x46dcf4)){return _0x46dcf4;}return writeFile(_0x5d99ef,_0x46dcf4)[_0x05f7('0x21')](function(){return _0x46dcf4;});}else{throw new db[(_0x05f7('0x61'))][(_0x05f7('0x62'))](_0x05f7('0x97'));}})[_0x05f7('0x21')](function(_0x2a6e6d){return _0x5c9a35[_0x05f7('0x4e')](_0x2a6e6d);})[_0x05f7('0x45')](handleError(_0x5c9a35));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 9659b5a..47f1fea 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 _0x9171=['define','VoiceRecording','voice_recordings','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','./voiceRecording.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9171,0x1cb));var _0x1917=function(_0x56648b,_0x5626db){_0x56648b=_0x56648b-0x0;var _0x7d1b74=_0x9171[_0x56648b];return _0x7d1b74;};'use strict';var _=require(_0x1917('0x0'));var util=require(_0x1917('0x1'));var logger=require('../../config/logger')(_0x1917('0x2'));var moment=require(_0x1917('0x3'));var BPromise=require(_0x1917('0x4'));var rp=require(_0x1917('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1917('0x6'));var config=require('../../config/environment');var attributes=require(_0x1917('0x7'));module[_0x1917('0x8')]=function(_0x3e3260,_0x3ce29e){return _0x3e3260[_0x1917('0x9')](_0x1917('0xa'),attributes,{'tableName':_0x1917('0xb'),'paranoid':![],'indexes':[{'name':_0x1917('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1281=['moment','bluebird','request-promise','./voiceRecording.attributes','exports','uniqueid','lodash','util','api'];(function(_0x38a243,_0x479c4b){var _0x32bd7d=function(_0xb2a306){while(--_0xb2a306){_0x38a243['push'](_0x38a243['shift']());}};_0x32bd7d(++_0x479c4b);}(_0x1281,0x177));var _0x1128=function(_0x2e534a,_0x77a43a){_0x2e534a=_0x2e534a-0x0;var _0x46bb9f=_0x1281[_0x2e534a];return _0x46bb9f;};'use strict';var _=require(_0x1128('0x0'));var util=require(_0x1128('0x1'));var logger=require('../../config/logger')(_0x1128('0x2'));var moment=require(_0x1128('0x3'));var BPromise=require(_0x1128('0x4'));var rp=require(_0x1128('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1128('0x6'));module[_0x1128('0x7')]=function(_0x458444,_0x5a0b25){return _0x458444['define']('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x1128('0x8'),'fields':[_0x1128('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c6d79be..efa8b51 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(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_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);});});}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(_0x4057ec,_0x425f09){var _0xe062c=function(_0x4a9644){while(--_0x4a9644){_0x4057ec['push'](_0x4057ec['shift']());}};_0xe062c(++_0x425f09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 43d7928..5a9ebf7 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 _0xdbf5=['index','/:id','show','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x501ea9,_0x26337f){var _0x3d49fd=function(_0x5e627e){while(--_0x5e627e){_0x501ea9['push'](_0x501ea9['shift']());}};_0x3d49fd(++_0x26337f);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5949c8,_0x1a3784){_0x5949c8=_0x5949c8-0x0;var _0x499e3d=_0xdbf5[_0x5949c8];return _0x499e3d;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['post']('/',auth[_0x5dbf('0x8')](),controller['create']);router[_0x5dbf('0xc')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xd')]);router['delete'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5dbf('0xe')]=router; \ No newline at end of file +var _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x3cecdb,_0x1043f9){var _0x1dbc2c=function(_0x46a85a){while(--_0x46a85a){_0x3cecdb['push'](_0x3cecdb['shift']());}};_0x1dbc2c(++_0x1043f9);}(_0x1967,0x173));var _0x7196=function(_0x598cc8,_0x5c4d96){_0x598cc8=_0x598cc8-0x0;var _0x4296ff=_0x1967[_0x598cc8];return _0x4296ff;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('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 b9737bc..582f748 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 _0x9021=['ENUM','blind','attended','STRING'];(function(_0x260073,_0xbe6af9){var _0x4ff033=function(_0x4a7c64){while(--_0x4a7c64){_0x260073['push'](_0x260073['shift']());}};_0x4ff033(++_0xbe6af9);}(_0x9021,0x1b1));var _0x1902=function(_0x6b942a,_0x311643){_0x6b942a=_0x6b942a-0x0;var _0x22129d=_0x9021[_0x6b942a];return _0x22129d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0x1902('0x0'),_0x1902('0x1'))},'result':{'type':Sequelize[_0x1902('0x2')]},'transfererchannel':{'type':Sequelize[_0x1902('0x2')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x1902('0x2')]},'transfereraccountcode':{'type':Sequelize[_0x1902('0x2')]},'transferercontext':{'type':Sequelize[_0x1902('0x2')]},'transfererexten':{'type':Sequelize[_0x1902('0x2')]},'transfererlinkedid':{'type':Sequelize[_0x1902('0x2')]},'transfereechannel':{'type':Sequelize[_0x1902('0x2')]},'transfereecalleridnum':{'type':Sequelize[_0x1902('0x2')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x1902('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1902('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x1902('0x2')]},'transfereecontext':{'type':Sequelize[_0x1902('0x2')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1902('0x2')]},'isexternal':{'type':Sequelize[_0x1902('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x1902('0x2')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a1b=['blind','attended','STRING','Yes','moment','exports','ENUM'];(function(_0x38d266,_0x7047bf){var _0x15ed7f=function(_0x1efd19){while(--_0x1efd19){_0x38d266['push'](_0x38d266['shift']());}};_0x15ed7f(++_0x7047bf);}(_0x2a1b,0xdd));var _0xb2a1=function(_0x3df2fb,_0x2d0233){_0x3df2fb=_0x3df2fb-0x0;var _0x3d3eb9=_0x2a1b[_0x3df2fb];return _0x3d3eb9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb2a1('0x0'));module[_0xb2a1('0x1')]={'type':{'type':Sequelize[_0xb2a1('0x2')](_0xb2a1('0x3'),_0xb2a1('0x4'))},'result':{'type':Sequelize[_0xb2a1('0x5')]},'transfererchannel':{'type':Sequelize[_0xb2a1('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xb2a1('0x5')]},'transferercalleridname':{'type':Sequelize[_0xb2a1('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb2a1('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb2a1('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xb2a1('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb2a1('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb2a1('0x5')]},'transfereechannel':{'type':Sequelize[_0xb2a1('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xb2a1('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb2a1('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xb2a1('0x5')]},'transfereecontext':{'type':Sequelize[_0xb2a1('0x5')]},'transfereeexten':{'type':Sequelize[_0xb2a1('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb2a1('0x5')]},'isexternal':{'type':Sequelize[_0xb2a1('0x2')](_0xb2a1('0x6'),'No')},'context':{'type':Sequelize[_0xb2a1('0x5')]},'extension':{'type':Sequelize[_0xb2a1('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 7e2b5e4..a0d78a0 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 _0x1a69=['count','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','index','VoiceTransferReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x1a69,0x1f1));var _0x91a6=function(_0x19862c,_0x86a00e){_0x19862c=_0x19862c-0x0;var _0x18123f=_0x1a69[_0x19862c];return _0x18123f;};'use strict';var pdf=require(_0x91a6('0x0'));var emlformat=require(_0x91a6('0x1'));var rimraf=require(_0x91a6('0x2'));var zipdir=require(_0x91a6('0x3'));var jsonpatch=require(_0x91a6('0x4'));var rp=require(_0x91a6('0x5'));var moment=require(_0x91a6('0x6'));var BPromise=require(_0x91a6('0x7'));var Mustache=require(_0x91a6('0x8'));var util=require(_0x91a6('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x91a6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x91a6('0xb'));var squel=require(_0x91a6('0xc'));var crypto=require(_0x91a6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x91a6('0xe'));var toCsv=require(_0x91a6('0xa'));var querystring=require(_0x91a6('0xf'));var Papa=require(_0x91a6('0x10'));var Redis=require('ioredis');var authService=require(_0x91a6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x91a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91a6('0x13'))(_0x91a6('0x14'));var utils=require(_0x91a6('0x15'));var config=require(_0x91a6('0x16'));var db=require(_0x91a6('0x17'))['db'];function respondWithStatusCode(_0x4febba,_0x18e378){_0x18e378=_0x18e378||0xcc;return function(_0x558b79){if(_0x558b79){return _0x4febba[_0x91a6('0x18')](_0x18e378);}return _0x4febba[_0x91a6('0x19')](_0x18e378)[_0x91a6('0x1a')]();};}function respondWithResult(_0x2f7378,_0x27cbd2){_0x27cbd2=_0x27cbd2||0xc8;return function(_0xa511d0){if(_0xa511d0){return _0x2f7378['status'](_0x27cbd2)[_0x91a6('0x1b')](_0xa511d0);}};}function respondWithFilteredResult(_0x1766fc,_0x1a07ec){return function(_0x25db67){if(_0x25db67){var _0x2b0c9c=_0x25db67[_0x91a6('0x1c')],_0xeda56=_0x1a07ec['offset'],_0x14b9d3=_0x1a07ec[_0x91a6('0x1d')]+_0x1a07ec[_0x91a6('0x1e')],_0x2b4421;if(_0x14b9d3>=_0x2b0c9c){_0x14b9d3=_0x2b0c9c;_0x2b4421=0xc8;}else{_0x2b4421=0xce;}_0x1766fc[_0x91a6('0x19')](_0x2b4421);return _0x1766fc[_0x91a6('0x1f')](_0x91a6('0x20'),_0xeda56+'-'+_0x14b9d3+'/'+_0x2b0c9c)['json'](_0x25db67);}return null;};}function patchUpdates(_0x4b24aa){return function(_0x1e022b){try{jsonpatch['apply'](_0x1e022b,_0x4b24aa,!![]);}catch(_0x1eb06f){return BPromise[_0x91a6('0x21')](_0x1eb06f);}return _0x1e022b['save']();};}function saveUpdates(_0x20e1fe,_0x247352){return function(_0xa86edd){if(_0xa86edd){return _0xa86edd[_0x91a6('0x22')](_0x20e1fe)['then'](function(_0x504626){return _0x504626;});}return null;};}function removeEntity(_0x3303e9,_0x212ec9){return function(_0x2f5f0c){if(_0x2f5f0c){return _0x2f5f0c[_0x91a6('0x23')]()[_0x91a6('0x24')](function(){_0x3303e9['status'](0xcc)[_0x91a6('0x1a')]();});}};}function handleEntityNotFound(_0x5719d2,_0x25885e){return function(_0x21607b){if(!_0x21607b){_0x5719d2[_0x91a6('0x18')](0x194);}return _0x21607b;};}function handleError(_0x45b016,_0x19b8ae){_0x19b8ae=_0x19b8ae||0x1f4;return function(_0x6dc284){logger[_0x91a6('0x25')](_0x6dc284[_0x91a6('0x26')]);if(_0x6dc284[_0x91a6('0x27')]){delete _0x6dc284[_0x91a6('0x27')];}_0x45b016['status'](_0x19b8ae)['send'](_0x6dc284);};}exports[_0x91a6('0x28')]=function(_0x16285e,_0x12a09b){var _0x4955ea={},_0x52bb54={},_0x2d8f47={'count':0x0,'rows':[]};var _0x3d62d7=_['map'](db[_0x91a6('0x29')]['rawAttributes'],function(_0x284f62){return{'name':_0x284f62[_0x91a6('0x2a')],'type':_0x284f62[_0x91a6('0x2b')][_0x91a6('0x2c')]};});_0x52bb54[_0x91a6('0x2d')]=_['map'](_0x3d62d7,_0x91a6('0x27'));_0x52bb54[_0x91a6('0x2e')]=_[_0x91a6('0x2f')](_0x16285e['query']);_0x52bb54['filters']=_['intersection'](_0x52bb54['model'],_0x52bb54['query']);_0x4955ea[_0x91a6('0x30')]=_[_0x91a6('0x31')](_0x52bb54[_0x91a6('0x2d')],qs[_0x91a6('0x32')](_0x16285e[_0x91a6('0x2e')][_0x91a6('0x32')]));_0x4955ea[_0x91a6('0x30')]=_0x4955ea[_0x91a6('0x30')][_0x91a6('0x33')]?_0x4955ea[_0x91a6('0x30')]:_0x52bb54['model'];if(!_0x16285e[_0x91a6('0x2e')][_0x91a6('0x34')](_0x91a6('0x35'))){_0x4955ea['limit']=qs['limit'](_0x16285e[_0x91a6('0x2e')][_0x91a6('0x1e')]);_0x4955ea['offset']=qs[_0x91a6('0x1d')](_0x16285e['query'][_0x91a6('0x1d')]);}_0x4955ea[_0x91a6('0x36')]=qs[_0x91a6('0x37')](_0x16285e[_0x91a6('0x2e')][_0x91a6('0x37')]);_0x4955ea[_0x91a6('0x38')]=qs[_0x91a6('0x39')](_[_0x91a6('0x3a')](_0x16285e[_0x91a6('0x2e')],_0x52bb54['filters']),_0x3d62d7);if(_0x16285e['query'][_0x91a6('0x3b')]){_0x4955ea[_0x91a6('0x38')]=_[_0x91a6('0x3c')](_0x4955ea['where'],{'$or':_[_0x91a6('0x3d')](_0x3d62d7,function(_0x2f79da){if(_0x2f79da[_0x91a6('0x2b')]!==_0x91a6('0x3e')){var _0x59ba59={};_0x59ba59[_0x2f79da[_0x91a6('0x27')]]={'$like':'%'+_0x16285e['query'][_0x91a6('0x3b')]+'%'};return _0x59ba59;}})});}_0x4955ea=_[_0x91a6('0x3c')]({},_0x4955ea,_0x16285e['options']);var _0xab5c23={'where':_0x4955ea[_0x91a6('0x38')]};return db[_0x91a6('0x29')][_0x91a6('0x1c')](_0xab5c23)[_0x91a6('0x24')](function(_0x5366d9){_0x2d8f47['count']=_0x5366d9;if(_0x16285e[_0x91a6('0x2e')][_0x91a6('0x3f')]){_0x4955ea[_0x91a6('0x40')]=[{'all':!![]}];}return db[_0x91a6('0x29')][_0x91a6('0x41')](_0x4955ea);})['then'](function(_0x228d8a){_0x2d8f47[_0x91a6('0x42')]=_0x228d8a;return _0x2d8f47;})[_0x91a6('0x24')](respondWithFilteredResult(_0x12a09b,_0x4955ea))[_0x91a6('0x43')](handleError(_0x12a09b,null));};exports[_0x91a6('0x44')]=function(_0x1354b2,_0x3bb04c){var _0x6318a7={'raw':!![],'where':{'id':_0x1354b2[_0x91a6('0x45')]['id']}},_0x16d779={};_0x16d779['model']=_[_0x91a6('0x2f')](db[_0x91a6('0x29')][_0x91a6('0x46')]);_0x16d779[_0x91a6('0x2e')]=_[_0x91a6('0x2f')](_0x1354b2[_0x91a6('0x2e')]);_0x16d779['filters']=_[_0x91a6('0x31')](_0x16d779[_0x91a6('0x2d')],_0x16d779['query']);_0x6318a7[_0x91a6('0x30')]=_[_0x91a6('0x31')](_0x16d779[_0x91a6('0x2d')],qs[_0x91a6('0x32')](_0x1354b2[_0x91a6('0x2e')][_0x91a6('0x32')]));_0x6318a7[_0x91a6('0x30')]=_0x6318a7['attributes'][_0x91a6('0x33')]?_0x6318a7['attributes']:_0x16d779['model'];if(_0x1354b2[_0x91a6('0x2e')][_0x91a6('0x3f')]){_0x6318a7['include']=[{'all':!![]}];}_0x6318a7=_[_0x91a6('0x3c')]({},_0x6318a7,_0x1354b2[_0x91a6('0x47')]);return db[_0x91a6('0x29')][_0x91a6('0x48')](_0x6318a7)[_0x91a6('0x24')](handleEntityNotFound(_0x3bb04c,null))[_0x91a6('0x24')](respondWithResult(_0x3bb04c,null))['catch'](handleError(_0x3bb04c,null));};exports[_0x91a6('0x49')]=function(_0x36b1cf,_0x3bad57){return db[_0x91a6('0x29')][_0x91a6('0x49')](_0x36b1cf[_0x91a6('0x4a')],{})['then'](respondWithResult(_0x3bad57,0xc9))['catch'](handleError(_0x3bad57,null));};exports[_0x91a6('0x22')]=function(_0x19298e,_0x481fd6){if(_0x19298e[_0x91a6('0x4a')]['id']){delete _0x19298e[_0x91a6('0x4a')]['id'];}return db['VoiceTransferReport'][_0x91a6('0x48')]({'where':{'id':_0x19298e['params']['id']}})['then'](handleEntityNotFound(_0x481fd6,null))['then'](saveUpdates(_0x19298e[_0x91a6('0x4a')],null))[_0x91a6('0x24')](respondWithResult(_0x481fd6,null))[_0x91a6('0x43')](handleError(_0x481fd6,null));};exports['destroy']=function(_0x54b7a8,_0x2c4096){return db['VoiceTransferReport']['find']({'where':{'id':_0x54b7a8[_0x91a6('0x45')]['id']}})[_0x91a6('0x24')](handleEntityNotFound(_0x2c4096,null))['then'](removeEntity(_0x2c4096,null))['catch'](handleError(_0x2c4096,null));}; \ No newline at end of file +var _0x0732=['then','destroy','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','body','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save'];(function(_0x294acc,_0x3c7df0){var _0x3dc9e6=function(_0x2ae885){while(--_0x2ae885){_0x294acc['push'](_0x294acc['shift']());}};_0x3dc9e6(++_0x3c7df0);}(_0x0732,0x143));var _0x2073=function(_0x517db2,_0x22e5f6){_0x517db2=_0x517db2-0x0;var _0x636271=_0x0732[_0x517db2];return _0x636271;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2073('0x0'));var rimraf=require(_0x2073('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2073('0x2'));var moment=require(_0x2073('0x3'));var BPromise=require(_0x2073('0x4'));var Mustache=require(_0x2073('0x5'));var util=require(_0x2073('0x6'));var path=require(_0x2073('0x7'));var sox=require('sox');var csv=require(_0x2073('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2073('0x9'));var jsforce=require(_0x2073('0xa'));var deskjs=require(_0x2073('0xb'));var toCsv=require(_0x2073('0x8'));var querystring=require(_0x2073('0xc'));var Papa=require('papaparse');var Redis=require(_0x2073('0xd'));var authService=require(_0x2073('0xe'));var qs=require(_0x2073('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2073('0x10'))(_0x2073('0x11'));var utils=require(_0x2073('0x12'));var config=require(_0x2073('0x13'));var db=require(_0x2073('0x14'))['db'];function respondWithStatusCode(_0x41f30a,_0x4cb7a9){_0x4cb7a9=_0x4cb7a9||0xcc;return function(_0x2801a0){if(_0x2801a0){return _0x41f30a[_0x2073('0x15')](_0x4cb7a9);}return _0x41f30a['status'](_0x4cb7a9)[_0x2073('0x16')]();};}function respondWithResult(_0x3e13dc,_0x5325ee){_0x5325ee=_0x5325ee||0xc8;return function(_0x272e8c){if(_0x272e8c){return _0x3e13dc[_0x2073('0x17')](_0x5325ee)['json'](_0x272e8c);}};}function respondWithFilteredResult(_0x623fd1,_0x284e9a){return function(_0x3d8a72){if(_0x3d8a72){var _0x3fdbc5=_0x3d8a72[_0x2073('0x18')],_0x4553e7=_0x284e9a['offset'],_0x204c3=_0x284e9a[_0x2073('0x19')]+_0x284e9a[_0x2073('0x1a')],_0x1bc787;if(_0x204c3>=_0x3fdbc5){_0x204c3=_0x3fdbc5;_0x1bc787=0xc8;}else{_0x1bc787=0xce;}_0x623fd1[_0x2073('0x17')](_0x1bc787);return _0x623fd1[_0x2073('0x1b')](_0x2073('0x1c'),_0x4553e7+'-'+_0x204c3+'/'+_0x3fdbc5)[_0x2073('0x1d')](_0x3d8a72);}return null;};}function patchUpdates(_0x384648){return function(_0x4d67b6){try{jsonpatch['apply'](_0x4d67b6,_0x384648,!![]);}catch(_0x31487f){return BPromise[_0x2073('0x1e')](_0x31487f);}return _0x4d67b6[_0x2073('0x1f')]();};}function saveUpdates(_0x494241,_0x133c92){return function(_0xc46ac1){if(_0xc46ac1){return _0xc46ac1['update'](_0x494241)[_0x2073('0x20')](function(_0x5a21a9){return _0x5a21a9;});}return null;};}function removeEntity(_0x846cb5,_0x418d46){return function(_0xaf9a3d){if(_0xaf9a3d){return _0xaf9a3d[_0x2073('0x21')]()[_0x2073('0x20')](function(){_0x846cb5[_0x2073('0x17')](0xcc)[_0x2073('0x16')]();});}};}function handleEntityNotFound(_0x205af2,_0x48f902){return function(_0x32a9d3){if(!_0x32a9d3){_0x205af2[_0x2073('0x15')](0x194);}return _0x32a9d3;};}function handleError(_0x207d29,_0x1bc032){_0x1bc032=_0x1bc032||0x1f4;return function(_0x4bf986){logger[_0x2073('0x22')](_0x4bf986[_0x2073('0x23')]);if(_0x4bf986[_0x2073('0x24')]){delete _0x4bf986['name'];}_0x207d29['status'](_0x1bc032)[_0x2073('0x25')](_0x4bf986);};}exports[_0x2073('0x26')]=function(_0x498ea2,_0x1b9c27){var _0xb5ea4a={},_0x2e886d={},_0xc03d77={'count':0x0,'rows':[]};var _0x34bed9=_[_0x2073('0x27')](db[_0x2073('0x28')]['rawAttributes'],function(_0x3a8f08){return{'name':_0x3a8f08[_0x2073('0x29')],'type':_0x3a8f08[_0x2073('0x2a')][_0x2073('0x2b')]};});_0x2e886d['model']=_[_0x2073('0x27')](_0x34bed9,_0x2073('0x24'));_0x2e886d[_0x2073('0x2c')]=_[_0x2073('0x2d')](_0x498ea2[_0x2073('0x2c')]);_0x2e886d[_0x2073('0x2e')]=_[_0x2073('0x2f')](_0x2e886d[_0x2073('0x30')],_0x2e886d[_0x2073('0x2c')]);_0xb5ea4a[_0x2073('0x31')]=_['intersection'](_0x2e886d[_0x2073('0x30')],qs[_0x2073('0x32')](_0x498ea2[_0x2073('0x2c')]['fields']));_0xb5ea4a['attributes']=_0xb5ea4a['attributes']['length']?_0xb5ea4a[_0x2073('0x31')]:_0x2e886d[_0x2073('0x30')];if(!_0x498ea2[_0x2073('0x2c')][_0x2073('0x33')](_0x2073('0x34'))){_0xb5ea4a[_0x2073('0x1a')]=qs[_0x2073('0x1a')](_0x498ea2[_0x2073('0x2c')][_0x2073('0x1a')]);_0xb5ea4a[_0x2073('0x19')]=qs['offset'](_0x498ea2[_0x2073('0x2c')]['offset']);}_0xb5ea4a[_0x2073('0x35')]=qs['sort'](_0x498ea2[_0x2073('0x2c')][_0x2073('0x36')]);_0xb5ea4a[_0x2073('0x37')]=qs[_0x2073('0x2e')](_[_0x2073('0x38')](_0x498ea2[_0x2073('0x2c')],_0x2e886d['filters']),_0x34bed9);if(_0x498ea2[_0x2073('0x2c')][_0x2073('0x39')]){_0xb5ea4a[_0x2073('0x37')]=_[_0x2073('0x3a')](_0xb5ea4a[_0x2073('0x37')],{'$or':_[_0x2073('0x27')](_0x34bed9,function(_0x1db337){if(_0x1db337[_0x2073('0x2a')]!==_0x2073('0x3b')){var _0x51c9b6={};_0x51c9b6[_0x1db337[_0x2073('0x24')]]={'$like':'%'+_0x498ea2['query']['filter']+'%'};return _0x51c9b6;}})});}_0xb5ea4a=_[_0x2073('0x3a')]({},_0xb5ea4a,_0x498ea2[_0x2073('0x3c')]);var _0x4f2279={'where':_0xb5ea4a['where']};return db[_0x2073('0x28')][_0x2073('0x18')](_0x4f2279)['then'](function(_0x28cab6){_0xc03d77[_0x2073('0x18')]=_0x28cab6;if(_0x498ea2['query'][_0x2073('0x3d')]){_0xb5ea4a[_0x2073('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0xb5ea4a);})[_0x2073('0x20')](function(_0x2f2509){_0xc03d77[_0x2073('0x3f')]=_0x2f2509;return _0xc03d77;})[_0x2073('0x20')](respondWithFilteredResult(_0x1b9c27,_0xb5ea4a))[_0x2073('0x40')](handleError(_0x1b9c27,null));};exports[_0x2073('0x41')]=function(_0x1c7b92,_0x28c040){var _0x1c218e={'raw':!![],'where':{'id':_0x1c7b92[_0x2073('0x42')]['id']}},_0x3e6ca6={};_0x3e6ca6[_0x2073('0x30')]=_['keys'](db[_0x2073('0x28')]['rawAttributes']);_0x3e6ca6[_0x2073('0x2c')]=_['keys'](_0x1c7b92[_0x2073('0x2c')]);_0x3e6ca6[_0x2073('0x2e')]=_['intersection'](_0x3e6ca6[_0x2073('0x30')],_0x3e6ca6[_0x2073('0x2c')]);_0x1c218e[_0x2073('0x31')]=_['intersection'](_0x3e6ca6[_0x2073('0x30')],qs['fields'](_0x1c7b92[_0x2073('0x2c')]['fields']));_0x1c218e[_0x2073('0x31')]=_0x1c218e['attributes'][_0x2073('0x43')]?_0x1c218e[_0x2073('0x31')]:_0x3e6ca6['model'];if(_0x1c7b92['query'][_0x2073('0x3d')]){_0x1c218e[_0x2073('0x3e')]=[{'all':!![]}];}_0x1c218e=_['merge']({},_0x1c218e,_0x1c7b92['options']);return db[_0x2073('0x28')][_0x2073('0x44')](_0x1c218e)[_0x2073('0x20')](handleEntityNotFound(_0x28c040,null))[_0x2073('0x20')](respondWithResult(_0x28c040,null))[_0x2073('0x40')](handleError(_0x28c040,null));};exports['create']=function(_0x16299d,_0x22ec34){return db['VoiceTransferReport']['create'](_0x16299d[_0x2073('0x45')],{})[_0x2073('0x20')](respondWithResult(_0x22ec34,0xc9))[_0x2073('0x40')](handleError(_0x22ec34,null));};exports[_0x2073('0x46')]=function(_0x512d5e,_0xa307d3){if(_0x512d5e[_0x2073('0x45')]['id']){delete _0x512d5e['body']['id'];}return db[_0x2073('0x28')]['find']({'where':{'id':_0x512d5e[_0x2073('0x42')]['id']}})['then'](handleEntityNotFound(_0xa307d3,null))[_0x2073('0x20')](saveUpdates(_0x512d5e[_0x2073('0x45')],null))['then'](respondWithResult(_0xa307d3,null))[_0x2073('0x40')](handleError(_0xa307d3,null));};exports[_0x2073('0x21')]=function(_0x1f6466,_0x29a08f){return db[_0x2073('0x28')][_0x2073('0x44')]({'where':{'id':_0x1f6466[_0x2073('0x42')]['id']}})[_0x2073('0x20')](handleEntityNotFound(_0x29a08f,null))[_0x2073('0x20')](removeEntity(_0x29a08f,null))[_0x2073('0x40')](handleError(_0x29a08f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b77ee15..14360a8 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 _0x4708=['VoiceTransferReport','report_call_transfer','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x12cc09,_0x3525ae){var _0x2b3852=function(_0x37defb){while(--_0x37defb){_0x12cc09['push'](_0x12cc09['shift']());}};_0x2b3852(++_0x3525ae);}(_0x4708,0xa7));var _0x8470=function(_0x2a76fb,_0x28a1dd){_0x2a76fb=_0x2a76fb-0x0;var _0x53883c=_0x4708[_0x2a76fb];return _0x53883c;};'use strict';var _=require(_0x8470('0x0'));var util=require(_0x8470('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8470('0x2'));var rp=require(_0x8470('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8470('0x4'));var config=require(_0x8470('0x5'));var attributes=require(_0x8470('0x6'));module[_0x8470('0x7')]=function(_0x310710,_0x45206e){return _0x310710[_0x8470('0x8')](_0x8470('0x9'),attributes,{'tableName':_0x8470('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bed=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x3bed,0x11e));var _0xd3be=function(_0x1021f4,_0x17b954){_0x1021f4=_0x1021f4-0x0;var _0x124ed9=_0x3bed[_0x1021f4];return _0x124ed9;};'use strict';var _=require(_0xd3be('0x0'));var util=require(_0xd3be('0x1'));var logger=require(_0xd3be('0x2'))(_0xd3be('0x3'));var moment=require('moment');var BPromise=require(_0xd3be('0x4'));var rp=require(_0xd3be('0x5'));var fs=require('fs');var path=require(_0xd3be('0x6'));var rimraf=require(_0xd3be('0x7'));var config=require('../../config/environment');var attributes=require(_0xd3be('0x8'));module[_0xd3be('0x9')]=function(_0x15d4ed,_0x2916cd){return _0x15d4ed[_0xd3be('0xa')](_0xd3be('0xb'),attributes,{'tableName':_0xd3be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index f737eba..b400af4 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 _0x4196=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xf0ed2c,_0x2064a8){var _0x2440a7=function(_0x5a11de){while(--_0x5a11de){_0xf0ed2c['push'](_0xf0ed2c['shift']());}};_0x2440a7(++_0x2064a8);}(_0x4196,0xc0));var _0x6419=function(_0x2fd9ef,_0x322d3c){_0x2fd9ef=_0x2fd9ef-0x0;var _0x1c041c=_0x4196[_0x2fd9ef];return _0x1c041c;};'use strict';var _=require(_0x6419('0x0'));var util=require(_0x6419('0x1'));var moment=require(_0x6419('0x2'));var BPromise=require(_0x6419('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6419('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6419('0x5'));var logger=require(_0x6419('0x6'))(_0x6419('0x7'));var config=require(_0x6419('0x8'));var jayson=require(_0x6419('0x9'));var client=jayson['client'][_0x6419('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f3adf,_0x4bdc68,_0x32dcb0){return new BPromise(function(_0x5464d6,_0x1a948e){return client[_0x6419('0xb')](_0x1f3adf,_0x32dcb0)[_0x6419('0xc')](function(_0x446897){logger[_0x6419('0xd')](_0x6419('0xe'),_0x4bdc68,_0x6419('0xf'));logger[_0x6419('0x10')](_0x6419('0x11'),_0x4bdc68,_0x6419('0xf'),JSON[_0x6419('0x12')](_0x446897));if(_0x446897['error']){if(_0x446897[_0x6419('0x13')][_0x6419('0x14')]===0x1f4){logger['error'](_0x6419('0xe'),_0x4bdc68,_0x446897[_0x6419('0x13')]['message']);return _0x1a948e(_0x446897['error'][_0x6419('0x15')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4bdc68,_0x446897['error']['message']);return _0x5464d6(_0x446897[_0x6419('0x13')][_0x6419('0x15')]);}else{logger[_0x6419('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x4bdc68,_0x6419('0xf'));_0x5464d6(_0x446897['result'][_0x6419('0x15')]);}})[_0x6419('0x16')](function(_0x35af6e){logger[_0x6419('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x4bdc68,_0x35af6e);_0x1a948e(_0x35af6e);});});}exports[_0x6419('0x17')]=function(_0x249d1e){var _0x76988b=this;return new Promise(function(_0x295299,_0x53be89){return db[_0x6419('0x18')][_0x6419('0x19')](_0x249d1e[_0x6419('0x1a')],{'raw':_0x249d1e[_0x6419('0x1b')]?_0x249d1e['options'][_0x6419('0x1c')]===undefined?!![]:![]:!![]})[_0x6419('0xc')](function(_0x37062b){logger[_0x6419('0xd')](_0x6419('0x17'),_0x249d1e);logger['debug'](_0x6419('0x17'),_0x249d1e,JSON[_0x6419('0x12')](_0x37062b));_0x295299(_0x37062b);})['catch'](function(_0x133027){logger[_0x6419('0x13')]('CreateVoiceTransferReport',_0x133027[_0x6419('0x15')],_0x249d1e);_0x53be89(_0x76988b[_0x6419('0x13')](0x1f4,_0x133027[_0x6419('0x15')]));});});}; \ No newline at end of file +var _0x75b1=['message','info','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x592df2,_0x56e9a5){var _0x2ac3db=function(_0x41efa8){while(--_0x41efa8){_0x592df2['push'](_0x592df2['shift']());}};_0x2ac3db(++_0x56e9a5);}(_0x75b1,0x1a8));var _0x175b=function(_0x1be099,_0x20364){_0x1be099=_0x1be099-0x0;var _0x29e104=_0x75b1[_0x1be099];return _0x29e104;};'use strict';var _=require(_0x175b('0x0'));var util=require(_0x175b('0x1'));var moment=require(_0x175b('0x2'));var BPromise=require('bluebird');var rs=require(_0x175b('0x3'));var fs=require('fs');var Redis=require(_0x175b('0x4'));var db=require(_0x175b('0x5'))['db'];var utils=require(_0x175b('0x6'));var logger=require(_0x175b('0x7'))(_0x175b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x175b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53c21e,_0x43598b,_0x12c61c){return new BPromise(function(_0x3decdc,_0x4147eb){return client[_0x175b('0xa')](_0x53c21e,_0x12c61c)[_0x175b('0xb')](function(_0x1195f3){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x43598b,_0x175b('0xc'));logger[_0x175b('0xd')](_0x175b('0xe'),_0x43598b,_0x175b('0xc'),JSON['stringify'](_0x1195f3));if(_0x1195f3[_0x175b('0xf')]){if(_0x1195f3[_0x175b('0xf')][_0x175b('0x10')]===0x1f4){logger[_0x175b('0xf')](_0x175b('0x11'),_0x43598b,_0x1195f3[_0x175b('0xf')]['message']);return _0x4147eb(_0x1195f3[_0x175b('0xf')]['message']);}logger['error'](_0x175b('0x11'),_0x43598b,_0x1195f3[_0x175b('0xf')][_0x175b('0x12')]);return _0x3decdc(_0x1195f3[_0x175b('0xf')][_0x175b('0x12')]);}else{logger[_0x175b('0x13')](_0x175b('0x11'),_0x43598b,'request\x20sent');_0x3decdc(_0x1195f3['result'][_0x175b('0x12')]);}})[_0x175b('0x14')](function(_0x4b1343){logger['error'](_0x175b('0x11'),_0x43598b,_0x4b1343);_0x4147eb(_0x4b1343);});});}exports[_0x175b('0x15')]=function(_0x1362c6){var _0x5a0c8f=this;return new Promise(function(_0x2bb4bc,_0x40e593){return db['VoiceTransferReport'][_0x175b('0x16')](_0x1362c6[_0x175b('0x17')],{'raw':_0x1362c6[_0x175b('0x18')]?_0x1362c6[_0x175b('0x18')][_0x175b('0x19')]===undefined?!![]:![]:!![]})[_0x175b('0xb')](function(_0x558549){logger[_0x175b('0x13')]('CreateVoiceTransferReport',_0x1362c6);logger['debug'](_0x175b('0x15'),_0x1362c6,JSON['stringify'](_0x558549));_0x2bb4bc(_0x558549);})[_0x175b('0x14')](function(_0x4c81f2){logger[_0x175b('0xf')](_0x175b('0x15'),_0x4c81f2[_0x175b('0x12')],_0x1362c6);_0x40e593(_0x5a0c8f[_0x175b('0xf')](0x1f4,_0x4c81f2[_0x175b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a4d1edb..79569e3 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 _0x1542=['/answer','answer','/hold','/unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup'];(function(_0x208c3b,_0x3481c0){var _0x1ea841=function(_0x532b41){while(--_0x532b41){_0x208c3b['push'](_0x208c3b['shift']());}};_0x1ea841(++_0x3481c0);}(_0x1542,0x116));var _0x2154=function(_0x125ac2,_0x25a762){_0x125ac2=_0x125ac2-0x0;var _0x43d53f=_0x1542[_0x125ac2];return _0x43d53f;};'use strict';var express=require(_0x2154('0x0'));var router=express[_0x2154('0x1')]();var auth=require(_0x2154('0x2'));var controller=require(_0x2154('0x3'));router[_0x2154('0x4')]('/originate',auth[_0x2154('0x5')](),auth[_0x2154('0x6')](),controller[_0x2154('0x7')]);router['post'](_0x2154('0x8'),auth[_0x2154('0x5')](),auth['canUpdate'](),controller[_0x2154('0x9')]);router[_0x2154('0x4')](_0x2154('0xa'),auth[_0x2154('0x5')](),auth[_0x2154('0x6')](),controller[_0x2154('0xb')]);router[_0x2154('0x4')](_0x2154('0xc'),auth[_0x2154('0x5')](),auth[_0x2154('0x6')](),controller['hold']);router[_0x2154('0x4')](_0x2154('0xd'),auth[_0x2154('0x5')](),auth[_0x2154('0x6')](),controller['unhold']);router[_0x2154('0x4')](_0x2154('0xe'),auth['isAuthenticated'](),auth[_0x2154('0x6')](),controller[_0x2154('0xf')]);router[_0x2154('0x4')](_0x2154('0x10'),auth[_0x2154('0x5')](),auth[_0x2154('0x6')](),controller[_0x2154('0x11')]);module['exports']=router; \ No newline at end of file +var _0x342e=['../../components/auth/service','/originate','isAuthenticated','post','/hangup','canUpdate','hangup','/hold','hold','/unhold','unhold','/calls','/transfer','exports','express','Router'];(function(_0x4bc6bc,_0x4519bd){var _0x54bf9e=function(_0x203ae4){while(--_0x203ae4){_0x4bc6bc['push'](_0x4bc6bc['shift']());}};_0x54bf9e(++_0x4519bd);}(_0x342e,0xde));var _0xe342=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x342e[_0x3da832];return _0xe602f2;};'use strict';var express=require(_0xe342('0x0'));var router=express[_0xe342('0x1')]();var auth=require(_0xe342('0x2'));var controller=require('./webbar.controller');router['post'](_0xe342('0x3'),auth[_0xe342('0x4')](),auth['canUpdate'](),controller['originate']);router[_0xe342('0x5')](_0xe342('0x6'),auth[_0xe342('0x4')](),auth[_0xe342('0x7')](),controller[_0xe342('0x8')]);router['post']('/answer',auth[_0xe342('0x4')](),auth[_0xe342('0x7')](),controller['answer']);router['post'](_0xe342('0x9'),auth[_0xe342('0x4')](),auth[_0xe342('0x7')](),controller[_0xe342('0xa')]);router[_0xe342('0x5')](_0xe342('0xb'),auth['isAuthenticated'](),auth[_0xe342('0x7')](),controller[_0xe342('0xc')]);router[_0xe342('0x5')](_0xe342('0xd'),auth['isAuthenticated'](),auth[_0xe342('0x7')](),controller['calls']);router[_0xe342('0x5')](_0xe342('0xe'),auth[_0xe342('0x4')](),auth[_0xe342('0x7')](),controller['transfer']);module[_0xe342('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a5c63d4..8e47d45 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 _0xff96=['entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','stringify','emit','log','handleError:','name','status','send','NotFound','request','error','message','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xff96,0x179));var _0x6ff9=function(_0x787d44,_0x36fea9){_0x787d44=_0x787d44-0x0;var _0x1c1430=_0xff96[_0x787d44];return _0x1c1430;};'use strict';var path=require(_0x6ff9('0x0'));var fs=require('fs');var _=require(_0x6ff9('0x1'));var db=require(_0x6ff9('0x2'))['db'];var config=require(_0x6ff9('0x3'));var util=require(_0x6ff9('0x4'));var BPromise=require(_0x6ff9('0x5'));var jayson=require(_0x6ff9('0x6'));var amiClient=jayson[_0x6ff9('0x7')][_0x6ff9('0x8')]({'port':0x232a});var logger=require(_0x6ff9('0x9'))(_0x6ff9('0xa'));var Redis=require(_0x6ff9('0xb'));config['redis']=_[_0x6ff9('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6ff9('0xd')]));var Schema=require(_0x6ff9('0xe'));var originateValidation=new Schema({'userId':{'type':_0x6ff9('0xf'),'required':[!![],_0x6ff9('0x10')]},'callNumber':{'type':_0x6ff9('0x11'),'required':[!![],_0x6ff9('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x6ff9('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x6ff9('0xf'),'required':[!![],_0x6ff9('0x10')]},'sessionId':{'type':_0x6ff9('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6ff9('0xf'),'required':[!![],_0x6ff9('0x10')]},'sessionId':{'type':_0x6ff9('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6ff9('0xf'),'required':[!![],_0x6ff9('0x10')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x6ff9('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x6ff9('0xf'),'required':[!![],_0x6ff9('0x10')]},'sessionId':{'type':_0x6ff9('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6ff9('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6ff9('0xf'),'required':[!![],_0x6ff9('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x6ff9('0xf'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x5a9a52,_0x17b0c7,_0x16772){logger[_0x6ff9('0x13')](_0x5a9a52,_0x17b0c7,JSON[_0x6ff9('0x14')](_0x16772));io['to'](_0x5a9a52)[_0x6ff9('0x15')](_0x17b0c7,_0x16772);}function handleError(_0x54d5ff){return function(_0xc00da6){console[_0x6ff9('0x16')](_0x6ff9('0x17'),_0xc00da6,_0xc00da6 instanceof RangeError);logger['error'](_0xc00da6['stack']);if(_0xc00da6 instanceof RangeError){if(_0xc00da6['name']){delete _0xc00da6[_0x6ff9('0x18')];}_0x54d5ff[_0x6ff9('0x19')](0x194)[_0x6ff9('0x1a')](_0xc00da6);}else{if(_0xc00da6[_0x6ff9('0x18')]){delete _0xc00da6[_0x6ff9('0x18')];}_0x54d5ff['status'](0x1f4)[_0x6ff9('0x1a')](_0xc00da6);}};}function checkError(){return function(_0x40e8a9){if(!_0x40e8a9){throw new RangeError(_0x6ff9('0x1b'));}return _0x40e8a9;};}function respondWithRpcPromise(_0x3ead33,_0x33b553){return new BPromise(function(_0x85835a,_0x50f207){var _0x647ce3=amiClient;return _0x647ce3[_0x6ff9('0x1c')](_0x3ead33,_0x33b553)['then'](function(_0x19fd1d){if(_0x19fd1d[_0x6ff9('0x1d')]){if(_0x19fd1d[_0x6ff9('0x1d')]['code']===0x1f4){return _0x50f207(_0x19fd1d['error']['message']);}return _0x85835a(_0x19fd1d[_0x6ff9('0x1d')][_0x6ff9('0x1e')]);}else{_0x85835a(_0x19fd1d['result']);}})['catch'](function(_0x12cbd8){_0x50f207(_0x12cbd8);});});}function getAgent(_0x5c84a9){return db['User'][_0x6ff9('0x1f')]({'where':{'id':_0x5c84a9,'role':_0x6ff9('0x20')}})[_0x6ff9('0x21')](checkError());}function getAgentCheckSession(_0x2f016f,_0x187a01){return new BPromise(function(_0x3a8236,_0x1bbbdd){var _0x1a6826=respondWithRpcPromise(_0x6ff9('0x22'));var _0x154a2e=getAgent(_0x2f016f);Promise[_0x6ff9('0x23')]([_0x1a6826,_0x154a2e])[_0x6ff9('0x21')](function(_0x41a281){var _0x861a5f=_0x41a281[0x0];var _0x1fc695=_0x41a281[0x1];var _0x148e10=_[_0x6ff9('0x24')](_0x861a5f[_0x6ff9('0x25')],function(_0x1d7fc0){return _0x1d7fc0[_0x6ff9('0x26')]==_0x1fc695['id']&&_0x1d7fc0[_0x6ff9('0x27')]==_0x187a01;});if(_0x148e10[_0x6ff9('0x28')]==0x1){_0x3a8236(_0x1fc695);}else{_0x1bbbdd(new RangeError('sessionId\x20'+_0x187a01+_0x6ff9('0x29')));}});});}exports[_0x6ff9('0x2a')]=function(_0x2a404b,_0x2fac0){logger['info'](_0x6ff9('0x2b'),_0x2a404b[_0x6ff9('0x2c')]);var _0x19a635=originateValidation[_0x6ff9('0xe')](_0x2a404b[_0x6ff9('0x2c')]);if(_0x19a635[_0x6ff9('0x28')]>0x0){return _0x2fac0[_0x6ff9('0x19')](0x190)[_0x6ff9('0x2d')](_0x19a635);}var _0x595e80=_0x2a404b['body'][_0x6ff9('0x2e')];var _0x382c43=_0x2a404b[_0x6ff9('0x2c')][_0x6ff9('0x2f')];var _0x768613=_0x2a404b[_0x6ff9('0x2c')]['callerId'];var _0x9e1f61=_0x2a404b['body'][_0x6ff9('0x30')];return getAgent(_0x595e80)['then'](function(_0x2cdced){logger[_0x6ff9('0x13')](_0x6ff9('0x31'),_0x2cdced[_0x6ff9('0x18')]);emit(util[_0x6ff9('0x32')](_0x6ff9('0x33'),_0x2cdced['name']),_0x6ff9('0x34'),{'callNumber':_0x382c43,'callerId':_0x768613,'callbackUrl':_0x9e1f61});return _0x2fac0[_0x6ff9('0x19')](0xc8)[_0x6ff9('0x2d')]({'error':![],'message':_0x6ff9('0x35')});})[_0x6ff9('0x36')](handleError(_0x2fac0));};exports['hangup']=function(_0x11f08a,_0x406bf8){logger['info']('hangup\x20fired:',_0x11f08a['body']);var _0x4eef8f=hangupValidation['validate'](_0x11f08a[_0x6ff9('0x2c')]);if(_0x4eef8f['length']>0x0){return _0x406bf8['status'](0x190)['json'](_0x4eef8f);}var _0x2f02ab=_0x11f08a[_0x6ff9('0x2c')][_0x6ff9('0x2e')];var _0x409761=_0x11f08a[_0x6ff9('0x2c')]['sessionId'];return getAgent(_0x2f02ab)[_0x6ff9('0x21')](function(_0x49f3dc){logger['info'](_0x6ff9('0x31'),_0x49f3dc['name']);emit(util['format'](_0x6ff9('0x33'),_0x49f3dc['name']),_0x6ff9('0x37'),{'sessionId':_0x409761});return _0x406bf8[_0x6ff9('0x19')](0xc8)[_0x6ff9('0x2d')]({'error':![],'message':_0x6ff9('0x38')});})['catch'](handleError(_0x406bf8));};exports[_0x6ff9('0x39')]=function(_0x7a3a99,_0x11aea6){logger[_0x6ff9('0x13')]('answer\x20fired:',_0x7a3a99[_0x6ff9('0x2c')]);var _0x4a4222=answerValidation[_0x6ff9('0xe')](_0x7a3a99[_0x6ff9('0x2c')]);if(_0x4a4222[_0x6ff9('0x28')]>0x0){return _0x11aea6[_0x6ff9('0x19')](0x190)[_0x6ff9('0x2d')](_0x4a4222);}var _0x51c90a=_0x7a3a99[_0x6ff9('0x2c')][_0x6ff9('0x2e')];var _0x5d3169=_0x7a3a99[_0x6ff9('0x2c')][_0x6ff9('0x27')];return getAgent(_0x51c90a)[_0x6ff9('0x21')](function(_0x30da67){logger[_0x6ff9('0x13')](_0x6ff9('0x31'),_0x30da67[_0x6ff9('0x18')]);emit(util[_0x6ff9('0x32')](_0x6ff9('0x33'),_0x30da67[_0x6ff9('0x18')]),_0x6ff9('0x3a'),{'sessionId':_0x5d3169});return _0x11aea6[_0x6ff9('0x19')](0xc8)[_0x6ff9('0x2d')]({'error':![],'message':_0x6ff9('0x3b')});})[_0x6ff9('0x36')](handleError(_0x11aea6));};exports['hold']=function(_0x27fa5e,_0x12689e){logger[_0x6ff9('0x13')]('hold\x20fired:',_0x27fa5e[_0x6ff9('0x2c')]);var _0x11a587=holdValidation['validate'](_0x27fa5e[_0x6ff9('0x2c')]);if(_0x11a587['length']>0x0){return _0x12689e[_0x6ff9('0x19')](0x190)[_0x6ff9('0x2d')](_0x11a587);}var _0x3c80b6=_0x27fa5e[_0x6ff9('0x2c')][_0x6ff9('0x2e')];var _0x3e4709=_0x27fa5e[_0x6ff9('0x2c')][_0x6ff9('0x27')];return getAgent(_0x3c80b6)['then'](function(_0x34ffe9){logger[_0x6ff9('0x13')](_0x6ff9('0x31'),_0x34ffe9[_0x6ff9('0x18')]);emit(util[_0x6ff9('0x32')](_0x6ff9('0x33'),_0x34ffe9[_0x6ff9('0x18')]),_0x6ff9('0x3c'),{'sessionId':_0x3e4709});return _0x12689e[_0x6ff9('0x19')](0xc8)[_0x6ff9('0x2d')]({'error':![],'message':_0x6ff9('0x3d')});})[_0x6ff9('0x36')](handleError(_0x12689e));};exports[_0x6ff9('0x3e')]=function(_0x7d4251,_0x213c77){logger['info']('unhold\x20fired:',_0x7d4251[_0x6ff9('0x2c')]);var _0x455d88=unholdValidation[_0x6ff9('0xe')](_0x7d4251[_0x6ff9('0x2c')]);if(_0x455d88[_0x6ff9('0x28')]>0x0){return _0x213c77['status'](0x190)[_0x6ff9('0x2d')](_0x455d88);}var _0x54e50e=_0x7d4251[_0x6ff9('0x2c')][_0x6ff9('0x2e')];var _0x553f27=_0x7d4251[_0x6ff9('0x2c')][_0x6ff9('0x27')];return getAgent(_0x54e50e)[_0x6ff9('0x21')](function(_0x32023c){logger[_0x6ff9('0x13')](_0x6ff9('0x31'),_0x32023c[_0x6ff9('0x18')]);emit(util[_0x6ff9('0x32')](_0x6ff9('0x33'),_0x32023c[_0x6ff9('0x18')]),_0x6ff9('0x3f'),{'sessionId':_0x553f27});return _0x213c77['status'](0xc8)['json']({'error':![],'message':_0x6ff9('0x40')});})[_0x6ff9('0x36')](handleError(_0x213c77));};exports['calls']=function(_0x5ca560,_0x4b6197){logger[_0x6ff9('0x13')]('calls\x20fired:',_0x4b6197[_0x6ff9('0x2c')]);var _0x16b0d6=callsValidation[_0x6ff9('0xe')](_0x5ca560['body']);if(_0x16b0d6['length']>0x0){return _0x4b6197[_0x6ff9('0x19')](0x190)[_0x6ff9('0x2d')](_0x16b0d6);}var _0x311411=_0x5ca560[_0x6ff9('0x2c')][_0x6ff9('0x2e')];var _0x3e5295=respondWithRpcPromise(_0x6ff9('0x22'));var _0x165a6d=getAgent(_0x311411);return Promise[_0x6ff9('0x23')]([_0x3e5295,_0x165a6d])[_0x6ff9('0x21')](function(_0x3da8ef){var _0xf8da1b=_0x3da8ef[0x0];var _0x296a77=_0x3da8ef[0x1];var _0x1b8989=_[_0x6ff9('0x24')](_0xf8da1b['rows'],function(_0x1c502d){return _0x1c502d[_0x6ff9('0x26')]==_0x296a77['id'];});return _0x4b6197[_0x6ff9('0x19')](0xc8)['json']({'count':_0x1b8989[_0x6ff9('0x28')],'rows':_0x1b8989});})[_0x6ff9('0x36')](handleError(_0x4b6197));};exports['conference']=function(_0xa18bb5,_0x2a600d){logger[_0x6ff9('0x13')](_0x6ff9('0x41'),_0xa18bb5[_0x6ff9('0x2c')]);var _0xae649b=conferenceValidation[_0x6ff9('0xe')](_0xa18bb5[_0x6ff9('0x2c')]);if(_0xae649b[_0x6ff9('0x28')]>0x0){return _0x2a600d['status'](0x190)[_0x6ff9('0x2d')](_0xae649b);}var _0x392c41=_0xa18bb5[_0x6ff9('0x2c')][_0x6ff9('0x2e')];return getAgent(_0x392c41)[_0x6ff9('0x21')](function(_0x2e3333){logger[_0x6ff9('0x13')](_0x6ff9('0x31'),_0x2e3333[_0x6ff9('0x18')]);emit(util['format'](_0x6ff9('0x33'),_0x2e3333[_0x6ff9('0x18')]),_0x6ff9('0x42'));return _0x2a600d[_0x6ff9('0x19')](0xc8)['json']({'error':![],'message':_0x6ff9('0x43')});})[_0x6ff9('0x36')](handleError(_0x2a600d));};exports['transfer']=function(_0x2be6fd,_0x423fb8){logger[_0x6ff9('0x13')](_0x6ff9('0x44'),_0x2be6fd[_0x6ff9('0x2c')]);var _0x2807c5=transferValidation['validate'](_0x2be6fd[_0x6ff9('0x2c')]);if(_0x2807c5['length']>0x0){return _0x423fb8[_0x6ff9('0x19')](0x190)[_0x6ff9('0x2d')](_0x2807c5);}var _0xab1ece=_0x2be6fd[_0x6ff9('0x2c')][_0x6ff9('0x2e')];var _0xcbfa4f=_0x2be6fd['body'][_0x6ff9('0x27')];var _0x115f12=_0x2be6fd[_0x6ff9('0x2c')][_0x6ff9('0x45')];return getAgent(_0xab1ece)['then'](function(_0x66ceab){logger['info'](_0x6ff9('0x31'),_0x66ceab[_0x6ff9('0x18')]);emit(util[_0x6ff9('0x32')](_0x6ff9('0x33'),_0x66ceab[_0x6ff9('0x18')]),_0x6ff9('0x46'),{'sessionId':_0xcbfa4f,'transferNumber':_0x115f12});return _0x423fb8[_0x6ff9('0x19')](0xc8)[_0x6ff9('0x2d')]({'error':![],'message':'transfer\x20executed!'});})[_0x6ff9('0x36')](handleError(_0x423fb8));}; \ No newline at end of file +var _0xa5ca=['error','code','message','catch','User','agent','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','length','userId','callNumber','callbackUrl','entityFound:','format','user:%s','json','originate\x20executed!','hangup','hangup\x20fired:','validate','webbar:hangup','answer','answer\x20executed!','hold','hold\x20fired:','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','all','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','log','handleError:','status','send','name','NotFound','then'];(function(_0x900650,_0x4341b4){var _0x86fb45=function(_0x2b7c78){while(--_0x2b7c78){_0x900650['push'](_0x900650['shift']());}};_0x86fb45(++_0x4341b4);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xa5ca[_0x50e593];return _0x3821d0;};'use strict';var path=require(_0xaa5c('0x0'));var fs=require('fs');var _=require(_0xaa5c('0x1'));var db=require(_0xaa5c('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xaa5c('0x3'));var jayson=require(_0xaa5c('0x4'));var amiClient=jayson[_0xaa5c('0x5')][_0xaa5c('0x6')]({'port':0x232a});var logger=require(_0xaa5c('0x7'))(_0xaa5c('0x8'));var Redis=require('ioredis');config['redis']=_['defaults'](config[_0xaa5c('0x9')],{'host':_0xaa5c('0xa'),'port':0x18eb});var io=require(_0xaa5c('0xb'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xaa5c('0xc'),'required':[!![],_0xaa5c('0xd')]},'callNumber':{'type':_0xaa5c('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xaa5c('0xe')},'callbackUrl':{'type':_0xaa5c('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xaa5c('0xc'),'required':[!![],_0xaa5c('0xd')]},'sessionId':{'type':_0xaa5c('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xaa5c('0xc'),'required':[!![],_0xaa5c('0xd')]},'sessionId':{'type':_0xaa5c('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xaa5c('0xc'),'required':[!![],_0xaa5c('0xd')]},'sessionId':{'type':_0xaa5c('0xe'),'required':[!![],_0xaa5c('0xf')]},'transferNumber':{'type':_0xaa5c('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xaa5c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaa5c('0xd')]},'sessionId':{'type':_0xaa5c('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xaa5c('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xaa5c('0xc'),'required':[!![],_0xaa5c('0xd')]}});function emit(_0x32aea8,_0x2aa102,_0x13fe08){logger[_0xaa5c('0x10')](_0x32aea8,_0x2aa102,JSON['stringify'](_0x13fe08));io['to'](_0x32aea8)['emit'](_0x2aa102,_0x13fe08);}function handleError(_0x133f42){return function(_0x5ebbf0){console[_0xaa5c('0x11')](_0xaa5c('0x12'),_0x5ebbf0,_0x5ebbf0 instanceof RangeError);logger['error'](_0x5ebbf0['stack']);if(_0x5ebbf0 instanceof RangeError){if(_0x5ebbf0['name']){delete _0x5ebbf0['name'];}_0x133f42[_0xaa5c('0x13')](0x194)[_0xaa5c('0x14')](_0x5ebbf0);}else{if(_0x5ebbf0['name']){delete _0x5ebbf0[_0xaa5c('0x15')];}_0x133f42[_0xaa5c('0x13')](0x1f4)['send'](_0x5ebbf0);}};}function checkError(){return function(_0x5e57b1){if(!_0x5e57b1){throw new RangeError(_0xaa5c('0x16'));}return _0x5e57b1;};}function respondWithRpcPromise(_0x1cc302,_0xa62209){return new BPromise(function(_0x3658fc,_0xa280bc){var _0x3ee5d9=amiClient;return _0x3ee5d9['request'](_0x1cc302,_0xa62209)[_0xaa5c('0x17')](function(_0xf27d4a){if(_0xf27d4a['error']){if(_0xf27d4a[_0xaa5c('0x18')][_0xaa5c('0x19')]===0x1f4){return _0xa280bc(_0xf27d4a[_0xaa5c('0x18')][_0xaa5c('0x1a')]);}return _0x3658fc(_0xf27d4a[_0xaa5c('0x18')][_0xaa5c('0x1a')]);}else{_0x3658fc(_0xf27d4a['result']);}})[_0xaa5c('0x1b')](function(_0x5af28f){_0xa280bc(_0x5af28f);});});}function getAgent(_0x5450c5){return db[_0xaa5c('0x1c')]['findOne']({'where':{'id':_0x5450c5,'role':_0xaa5c('0x1d')}})['then'](checkError());}function getAgentCheckSession(_0xcf71e9,_0x44f227){return new BPromise(function(_0x3fc42c,_0x369f3e){var _0x57e613=respondWithRpcPromise('VoiceChannels');var _0x4e744f=getAgent(_0xcf71e9);Promise['all']([_0x57e613,_0x4e744f])[_0xaa5c('0x17')](function(_0x5d898c){var _0x52f09a=_0x5d898c[0x0];var _0xb4f2ff=_0x5d898c[0x1];var _0x4f13fa=_[_0xaa5c('0x1e')](_0x52f09a['rows'],function(_0x7affe8){return _0x7affe8[_0xaa5c('0x1f')]==_0xb4f2ff['id']&&_0x7affe8[_0xaa5c('0x20')]==_0x44f227;});if(_0x4f13fa['length']==0x1){_0x3fc42c(_0xb4f2ff);}else{_0x369f3e(new RangeError(_0xaa5c('0x21')+_0x44f227+_0xaa5c('0x22')));}});});}exports['originate']=function(_0x33c56d,_0x3e8f95){logger[_0xaa5c('0x10')](_0xaa5c('0x23'),_0x33c56d[_0xaa5c('0x24')]);var _0x307c31=originateValidation['validate'](_0x33c56d['body']);if(_0x307c31[_0xaa5c('0x25')]>0x0){return _0x3e8f95[_0xaa5c('0x13')](0x190)['json'](_0x307c31);}var _0x5a7465=_0x33c56d[_0xaa5c('0x24')][_0xaa5c('0x26')];var _0x466141=_0x33c56d[_0xaa5c('0x24')][_0xaa5c('0x27')];var _0x1b8915=_0x33c56d[_0xaa5c('0x24')]['callerId'];var _0x50c236=_0x33c56d[_0xaa5c('0x24')][_0xaa5c('0x28')];return getAgent(_0x5a7465)[_0xaa5c('0x17')](function(_0x5ab257){logger[_0xaa5c('0x10')](_0xaa5c('0x29'),_0x5ab257[_0xaa5c('0x15')]);emit(util[_0xaa5c('0x2a')](_0xaa5c('0x2b'),_0x5ab257['name']),'webbar:originate',{'callNumber':_0x466141,'callerId':_0x1b8915,'callbackUrl':_0x50c236});return _0x3e8f95[_0xaa5c('0x13')](0xc8)[_0xaa5c('0x2c')]({'error':![],'message':_0xaa5c('0x2d')});})[_0xaa5c('0x1b')](handleError(_0x3e8f95));};exports[_0xaa5c('0x2e')]=function(_0x57efe8,_0x382b9e){logger[_0xaa5c('0x10')](_0xaa5c('0x2f'),_0x57efe8['body']);var _0x4e6780=hangupValidation[_0xaa5c('0x30')](_0x57efe8[_0xaa5c('0x24')]);if(_0x4e6780[_0xaa5c('0x25')]>0x0){return _0x382b9e['status'](0x190)[_0xaa5c('0x2c')](_0x4e6780);}var _0x374a2c=_0x57efe8[_0xaa5c('0x24')][_0xaa5c('0x26')];var _0x6e9e60=_0x57efe8['body'][_0xaa5c('0x20')];return getAgent(_0x374a2c)[_0xaa5c('0x17')](function(_0x403368){logger[_0xaa5c('0x10')](_0xaa5c('0x29'),_0x403368['name']);emit(util[_0xaa5c('0x2a')](_0xaa5c('0x2b'),_0x403368[_0xaa5c('0x15')]),_0xaa5c('0x31'),{'sessionId':_0x6e9e60});return _0x382b9e[_0xaa5c('0x13')](0xc8)[_0xaa5c('0x2c')]({'error':![],'message':'hangup\x20executed!'});})[_0xaa5c('0x1b')](handleError(_0x382b9e));};exports[_0xaa5c('0x32')]=function(_0x48385f,_0x513c8b){logger['info']('answer\x20fired:',_0x48385f[_0xaa5c('0x24')]);var _0x5e4a9b=answerValidation[_0xaa5c('0x30')](_0x48385f['body']);if(_0x5e4a9b['length']>0x0){return _0x513c8b[_0xaa5c('0x13')](0x190)['json'](_0x5e4a9b);}var _0x3fd25b=_0x48385f[_0xaa5c('0x24')][_0xaa5c('0x26')];var _0x3be483=_0x48385f[_0xaa5c('0x24')]['sessionId'];return getAgent(_0x3fd25b)['then'](function(_0x391c7b){logger['info'](_0xaa5c('0x29'),_0x391c7b[_0xaa5c('0x15')]);emit(util[_0xaa5c('0x2a')]('user:%s',_0x391c7b[_0xaa5c('0x15')]),'webbar:answer',{'sessionId':_0x3be483});return _0x513c8b[_0xaa5c('0x13')](0xc8)[_0xaa5c('0x2c')]({'error':![],'message':_0xaa5c('0x33')});})[_0xaa5c('0x1b')](handleError(_0x513c8b));};exports[_0xaa5c('0x34')]=function(_0x47be10,_0x1233e2){logger['info'](_0xaa5c('0x35'),_0x47be10[_0xaa5c('0x24')]);var _0x2d5362=holdValidation[_0xaa5c('0x30')](_0x47be10[_0xaa5c('0x24')]);if(_0x2d5362[_0xaa5c('0x25')]>0x0){return _0x1233e2['status'](0x190)[_0xaa5c('0x2c')](_0x2d5362);}var _0x248c0e=_0x47be10[_0xaa5c('0x24')][_0xaa5c('0x26')];var _0xad3f2e=_0x47be10[_0xaa5c('0x24')][_0xaa5c('0x20')];return getAgent(_0x248c0e)[_0xaa5c('0x17')](function(_0x2d1436){logger[_0xaa5c('0x10')](_0xaa5c('0x29'),_0x2d1436[_0xaa5c('0x15')]);emit(util[_0xaa5c('0x2a')](_0xaa5c('0x2b'),_0x2d1436[_0xaa5c('0x15')]),'webbar:hold',{'sessionId':_0xad3f2e});return _0x1233e2['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0xaa5c('0x1b')](handleError(_0x1233e2));};exports['unhold']=function(_0x2324da,_0x23dbc4){logger['info'](_0xaa5c('0x36'),_0x2324da['body']);var _0x5bf7bd=unholdValidation[_0xaa5c('0x30')](_0x2324da[_0xaa5c('0x24')]);if(_0x5bf7bd['length']>0x0){return _0x23dbc4[_0xaa5c('0x13')](0x190)[_0xaa5c('0x2c')](_0x5bf7bd);}var _0x18463d=_0x2324da[_0xaa5c('0x24')][_0xaa5c('0x26')];var _0x4b767e=_0x2324da[_0xaa5c('0x24')][_0xaa5c('0x20')];return getAgent(_0x18463d)[_0xaa5c('0x17')](function(_0x45303c){logger[_0xaa5c('0x10')](_0xaa5c('0x29'),_0x45303c[_0xaa5c('0x15')]);emit(util['format'](_0xaa5c('0x2b'),_0x45303c[_0xaa5c('0x15')]),'webbar:unhold',{'sessionId':_0x4b767e});return _0x23dbc4[_0xaa5c('0x13')](0xc8)[_0xaa5c('0x2c')]({'error':![],'message':_0xaa5c('0x37')});})['catch'](handleError(_0x23dbc4));};exports[_0xaa5c('0x38')]=function(_0x5a4718,_0x114e7d){logger[_0xaa5c('0x10')](_0xaa5c('0x39'),_0x114e7d[_0xaa5c('0x24')]);var _0x4dd5d8=callsValidation[_0xaa5c('0x30')](_0x5a4718[_0xaa5c('0x24')]);if(_0x4dd5d8['length']>0x0){return _0x114e7d[_0xaa5c('0x13')](0x190)[_0xaa5c('0x2c')](_0x4dd5d8);}var _0x522304=_0x5a4718['body'][_0xaa5c('0x26')];var _0x3d57ff=respondWithRpcPromise(_0xaa5c('0x3a'));var _0x1bfb4a=getAgent(_0x522304);return Promise[_0xaa5c('0x3b')]([_0x3d57ff,_0x1bfb4a])[_0xaa5c('0x17')](function(_0x362ec2){var _0x509345=_0x362ec2[0x0];var _0x414747=_0x362ec2[0x1];var _0x242675=_[_0xaa5c('0x1e')](_0x509345['rows'],function(_0x597260){return _0x597260['UserId']==_0x414747['id'];});return _0x114e7d['status'](0xc8)['json']({'count':_0x242675[_0xaa5c('0x25')],'rows':_0x242675});})[_0xaa5c('0x1b')](handleError(_0x114e7d));};exports[_0xaa5c('0x3c')]=function(_0x18ac3f,_0x17c7b8){logger[_0xaa5c('0x10')]('conference\x20fired:',_0x18ac3f[_0xaa5c('0x24')]);var _0x5d48ed=conferenceValidation['validate'](_0x18ac3f['body']);if(_0x5d48ed[_0xaa5c('0x25')]>0x0){return _0x17c7b8[_0xaa5c('0x13')](0x190)[_0xaa5c('0x2c')](_0x5d48ed);}var _0x3487a7=_0x18ac3f[_0xaa5c('0x24')]['userId'];return getAgent(_0x3487a7)[_0xaa5c('0x17')](function(_0x5dd4f){logger[_0xaa5c('0x10')]('entityFound:',_0x5dd4f[_0xaa5c('0x15')]);emit(util[_0xaa5c('0x2a')](_0xaa5c('0x2b'),_0x5dd4f[_0xaa5c('0x15')]),_0xaa5c('0x3d'));return _0x17c7b8['status'](0xc8)['json']({'error':![],'message':_0xaa5c('0x3e')});})['catch'](handleError(_0x17c7b8));};exports[_0xaa5c('0x3f')]=function(_0x3378ef,_0xd87e9d){logger[_0xaa5c('0x10')](_0xaa5c('0x40'),_0x3378ef[_0xaa5c('0x24')]);var _0x46009f=transferValidation[_0xaa5c('0x30')](_0x3378ef['body']);if(_0x46009f[_0xaa5c('0x25')]>0x0){return _0xd87e9d['status'](0x190)['json'](_0x46009f);}var _0x12445c=_0x3378ef[_0xaa5c('0x24')][_0xaa5c('0x26')];var _0xb8e5b8=_0x3378ef[_0xaa5c('0x24')][_0xaa5c('0x20')];var _0x1c8974=_0x3378ef[_0xaa5c('0x24')][_0xaa5c('0x41')];return getAgent(_0x12445c)['then'](function(_0x2a3345){logger[_0xaa5c('0x10')](_0xaa5c('0x29'),_0x2a3345[_0xaa5c('0x15')]);emit(util[_0xaa5c('0x2a')]('user:%s',_0x2a3345[_0xaa5c('0x15')]),_0xaa5c('0x42'),{'sessionId':_0xb8e5b8,'transferNumber':_0x1c8974});return _0xd87e9d['status'](0xc8)[_0xaa5c('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0xaa5c('0x1b')](handleError(_0xd87e9d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5d54bc9..9253a62 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 _0x1aa4=['./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addApplications','/:id/notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x1aa4,0xb2));var _0x41aa=function(_0x379c0b,_0x34733a){_0x379c0b=_0x379c0b-0x0;var _0x5e8326=_0x1aa4[_0x379c0b];return _0x5e8326;};'use strict';var multer=require(_0x41aa('0x0'));var util=require('util');var path=require(_0x41aa('0x1'));var timeout=require(_0x41aa('0x2'));var express=require(_0x41aa('0x3'));var router=express[_0x41aa('0x4')]();var auth=require(_0x41aa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x41aa('0x6'));var controller=require(_0x41aa('0x7'));router[_0x41aa('0x8')]('/',auth[_0x41aa('0x9')](),controller[_0x41aa('0xa')]);router['get'](_0x41aa('0xb'),auth['isAuthenticated'](),controller[_0x41aa('0xc')]);router[_0x41aa('0x8')](_0x41aa('0xd'),auth[_0x41aa('0x9')](),controller[_0x41aa('0xe')]);router[_0x41aa('0x8')](_0x41aa('0xf'),auth['isAuthenticated'](),controller[_0x41aa('0x10')]);router[_0x41aa('0x8')]('/:id/canned_answers',auth[_0x41aa('0x9')](),controller[_0x41aa('0x11')]);router[_0x41aa('0x8')]('/:id/users',auth[_0x41aa('0x9')](),controller[_0x41aa('0x12')]);router[_0x41aa('0x8')](_0x41aa('0x13'),auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth[_0x41aa('0x9')](),controller[_0x41aa('0x14')]);router[_0x41aa('0x15')]('/:id/dispositions',auth[_0x41aa('0x9')](),controller[_0x41aa('0x16')]);router['post'](_0x41aa('0x17'),auth[_0x41aa('0x9')](),controller[_0x41aa('0x18')]);router['post'](_0x41aa('0x19'),auth[_0x41aa('0x9')](),controller['addAgents']);router['post'](_0x41aa('0x13'),auth[_0x41aa('0x9')](),controller[_0x41aa('0x1a')]);router[_0x41aa('0x15')](_0x41aa('0x1b'),controller['notify']);router['post'](_0x41aa('0x1c'),auth[_0x41aa('0x9')](),controller[_0x41aa('0x1d')]);router[_0x41aa('0x1e')](_0x41aa('0xd'),auth[_0x41aa('0x9')](),controller[_0x41aa('0x1f')]);router[_0x41aa('0x20')](_0x41aa('0xd'),auth['isAuthenticated'](),controller[_0x41aa('0x21')]);router[_0x41aa('0x20')](_0x41aa('0xf'),auth[_0x41aa('0x9')](),controller[_0x41aa('0x22')]);router['delete'](_0x41aa('0x17'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x41aa('0x20')]('/:id/users',auth[_0x41aa('0x9')](),controller[_0x41aa('0x23')]);module[_0x41aa('0x24')]=router; \ No newline at end of file +var _0xa673=['./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','post','/:id/dispositions','addDisposition','/:id/canned_answers','/:id/users','addAgents','/:id/notify','notify','/:id/send','send','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2e4e63,_0xaba330){var _0xe2ca9b=function(_0x36098d){while(--_0x36098d){_0x2e4e63['push'](_0x2e4e63['shift']());}};_0xe2ca9b(++_0xaba330);}(_0xa673,0x17a));var _0x3a67=function(_0x51b286,_0x294401){_0x51b286=_0x51b286-0x0;var _0x217f13=_0xa673[_0x51b286];return _0x217f13;};'use strict';var multer=require(_0x3a67('0x0'));var util=require(_0x3a67('0x1'));var path=require(_0x3a67('0x2'));var timeout=require(_0x3a67('0x3'));var express=require('express');var router=express[_0x3a67('0x4')]();var auth=require(_0x3a67('0x5'));var interaction=require(_0x3a67('0x6'));var config=require('../../config/environment');var controller=require(_0x3a67('0x7'));router[_0x3a67('0x8')]('/',auth[_0x3a67('0x9')](),controller[_0x3a67('0xa')]);router[_0x3a67('0x8')](_0x3a67('0xb'),auth[_0x3a67('0x9')](),controller[_0x3a67('0xc')]);router[_0x3a67('0x8')](_0x3a67('0xd'),auth[_0x3a67('0x9')](),controller[_0x3a67('0xe')]);router[_0x3a67('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3a67('0xf')]);router[_0x3a67('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3a67('0x10')]);router[_0x3a67('0x8')]('/:id/users',auth[_0x3a67('0x9')](),controller[_0x3a67('0x11')]);router['get'](_0x3a67('0x12'),auth[_0x3a67('0x9')](),controller[_0x3a67('0x13')]);router['post']('/',auth[_0x3a67('0x9')](),controller['create']);router[_0x3a67('0x14')](_0x3a67('0x15'),auth[_0x3a67('0x9')](),controller[_0x3a67('0x16')]);router['post'](_0x3a67('0x17'),auth[_0x3a67('0x9')](),controller['addAnswer']);router[_0x3a67('0x14')](_0x3a67('0x18'),auth[_0x3a67('0x9')](),controller[_0x3a67('0x19')]);router[_0x3a67('0x14')](_0x3a67('0x12'),auth[_0x3a67('0x9')](),controller['addApplications']);router['post'](_0x3a67('0x1a'),controller[_0x3a67('0x1b')]);router['post'](_0x3a67('0x1c'),auth['isAuthenticated'](),controller[_0x3a67('0x1d')]);router['put']('/:id',auth[_0x3a67('0x9')](),controller[_0x3a67('0x1e')]);router[_0x3a67('0x1f')](_0x3a67('0xd'),auth[_0x3a67('0x9')](),controller[_0x3a67('0x20')]);router[_0x3a67('0x1f')](_0x3a67('0x15'),auth[_0x3a67('0x9')](),controller['removeDispositions']);router[_0x3a67('0x1f')](_0x3a67('0x17'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x3a67('0x1f')](_0x3a67('0x18'),auth[_0x3a67('0x9')](),controller[_0x3a67('0x21')]);module[_0x3a67('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5ed1861..12988b0 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 _0xf930=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x3e3bed,_0x28cdc0){var _0x30595b=function(_0xa67c7d){while(--_0xa67c7d){_0x3e3bed['push'](_0x3e3bed['shift']());}};_0x30595b(++_0x28cdc0);}(_0xf930,0x1e0));var _0x0f93=function(_0x5ea1f3,_0x57fb4d){_0x5ea1f3=_0x5ea1f3-0x0;var _0x5868c6=_0xf930[_0x5ea1f3];return _0x5868c6;};'use strict';var Sequelize=require(_0x0f93('0x0'));var rs=require(_0x0f93('0x1'));module['exports']={'name':{'type':Sequelize[_0x0f93('0x2')],'unique':_0x0f93('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0f93('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0f93('0x2')],'defaultValue':function(){return rs[_0x0f93('0x4')]();}},'phone':{'type':Sequelize[_0x0f93('0x2')]},'type':{'type':Sequelize[_0x0f93('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0x0f93('0x2')]},'authToken':{'type':Sequelize[_0x0f93('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0f93('0x6')],'defaultValue':function(){return _0x0f93('0x7');}},'notificationSound':{'type':Sequelize[_0x0f93('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0f93('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0f93('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0f93('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0f93('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0f93('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0f93('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x0f93('0x8')],'defaultValue':![],'comment':_0x0f93('0xb'),'set':function(_0x2fdf65){if(!_0x2fdf65){this[_0x0f93('0xc')](_0x0f93('0xd'),null);}this[_0x0f93('0xc')]('mandatoryDisposition',_0x2fdf65);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x37a9=['sequelize','randomstring','exports','STRING','name','generate','ENUM','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x3d5b52,_0x34712f){var _0x4f43ea=function(_0x181949){while(--_0x181949){_0x3d5b52['push'](_0x3d5b52['shift']());}};_0x4f43ea(++_0x34712f);}(_0x37a9,0xc4));var _0x937a=function(_0x31cb32,_0x3cce60){_0x31cb32=_0x31cb32-0x0;var _0x8ded43=_0x37a9[_0x31cb32];return _0x8ded43;};'use strict';var Sequelize=require(_0x937a('0x0'));var rs=require(_0x937a('0x1'));module[_0x937a('0x2')]={'name':{'type':Sequelize[_0x937a('0x3')],'unique':_0x937a('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x937a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x937a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x937a('0x3')],'defaultValue':function(){return rs[_0x937a('0x5')]();}},'phone':{'type':Sequelize[_0x937a('0x3')]},'type':{'type':Sequelize[_0x937a('0x6')]('twilio')},'accountSid':{'type':Sequelize[_0x937a('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x937a('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x937a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x937a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x937a('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x937a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x937a('0x8')],'comment':_0x937a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x937a('0x7')],'defaultValue':![],'comment':_0x937a('0xa'),'set':function(_0x1c4684){if(!_0x1c4684){this[_0x937a('0xb')](_0x937a('0xc'),null);}this[_0x937a('0xb')](_0x937a('0xd'),_0x1c4684);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index e8ba774..4678955 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 _0x1d2d=['createdAt','updatedAt','CompanyId','ListId','mobile','twilio','MessageSid','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','applications','close','unmanaged','messageId','ContactId','AttachmentId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','CmList','List','out','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','name','includeAll','findAll','rows','show','params','intersection','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','Disposition','getDispositions','pick','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','account','priority','difference'];(function(_0x3c58ba,_0x504cd6){var _0x3d9636=function(_0x3c08d8){while(--_0x3c08d8){_0x3c58ba['push'](_0x3c58ba['shift']());}};_0x3d9636(++_0x504cd6);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x12ac8b,_0x58c18e){_0x12ac8b=_0x12ac8b-0x0;var _0x359b1e=_0x1d2d[_0x12ac8b];return _0x359b1e;};'use strict';var pdf=require(_0xd1d2('0x0'));var emlformat=require(_0xd1d2('0x1'));var rimraf=require(_0xd1d2('0x2'));var zipdir=require(_0xd1d2('0x3'));var jsonpatch=require(_0xd1d2('0x4'));var rp=require('request-promise');var moment=require(_0xd1d2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1d2('0x6'));var path=require(_0xd1d2('0x7'));var sox=require(_0xd1d2('0x8'));var csv=require(_0xd1d2('0x9'));var ejs=require(_0xd1d2('0xa'));var fs=require('fs');var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x9'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var db=require(_0xd1d2('0x19'))['db'];config[_0xd1d2('0x1a')]=_[_0xd1d2('0x1b')](config[_0xd1d2('0x1a')],{'host':_0xd1d2('0x1c'),'port':0x18eb});var socket=require(_0xd1d2('0x1d'))(new Redis(config[_0xd1d2('0x1a')]));require(_0xd1d2('0x1e'))[_0xd1d2('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd1d2('0x20')][_0xd1d2('0x21')]({'port':0x232c});function checkPasswordPattern(_0x3476f8,_0x56de25,_0x35381b){if(_0x35381b){var _0xc36ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc36ce[_0xd1d2('0x22')](_0x56de25)){return _0x3476f8;}else{throw new db[(_0xd1d2('0x23'))][(_0xd1d2('0x24'))](_0xd1d2('0x25'));}}else{return _0x3476f8;}}function respondWithRpcPromise(_0x275996,_0x57f2f9,_0x539d5a,_0x3be186){return new BPromise(function(_0x55320b,_0x247b3a){var _0x42565b=_0x3be186||client;return _0x42565b[_0xd1d2('0x26')](_0x275996,_0x539d5a)[_0xd1d2('0x27')](function(_0x4ab386){logger['info'](_0xd1d2('0x28'),_0x57f2f9,'request\x20sent');logger['debug'](_0xd1d2('0x29'),_0x57f2f9,_0xd1d2('0x2a'),JSON[_0xd1d2('0x2b')](_0x4ab386));if(_0x4ab386[_0xd1d2('0x2c')]){if(_0x4ab386['error'][_0xd1d2('0x2d')]===0x1f4){logger[_0xd1d2('0x2c')](_0xd1d2('0x28'),_0x57f2f9,_0x4ab386['error']['message']);return _0x247b3a(_0x4ab386[_0xd1d2('0x2c')][_0xd1d2('0x2e')]);}logger[_0xd1d2('0x2c')](_0xd1d2('0x28'),_0x57f2f9,_0x4ab386[_0xd1d2('0x2c')][_0xd1d2('0x2e')]);return _0x55320b(_0x4ab386[_0xd1d2('0x2c')]['message']);}else{logger[_0xd1d2('0x2f')](_0xd1d2('0x28'),_0x57f2f9,_0xd1d2('0x2a'));_0x55320b(_0x4ab386[_0xd1d2('0x30')][_0xd1d2('0x2e')]);}})[_0xd1d2('0x31')](function(_0x28b8be){logger[_0xd1d2('0x2c')](_0xd1d2('0x28'),_0x57f2f9,_0x28b8be);_0x247b3a(_0x28b8be);});});}function respondWithStatusCode(_0x384460,_0x3645e9){_0x3645e9=_0x3645e9||0xcc;return function(_0x4e1bc2){if(_0x4e1bc2){return _0x384460['sendStatus'](_0x3645e9);}return _0x384460[_0xd1d2('0x32')](_0x3645e9)[_0xd1d2('0x33')]();};}function respondWithResult(_0x1e6072,_0x2b4c1f){_0x2b4c1f=_0x2b4c1f||0xc8;return function(_0xc815ea){if(_0xc815ea){return _0x1e6072['status'](_0x2b4c1f)[_0xd1d2('0x34')](_0xc815ea);}};}function respondWithFilteredResult(_0x41171c,_0x383947){return function(_0x4b4134){if(_0x4b4134){var _0x19db00=_0x4b4134[_0xd1d2('0x35')],_0x1db17f=_0x383947[_0xd1d2('0x36')],_0xbd855a=_0x383947[_0xd1d2('0x36')]+_0x383947[_0xd1d2('0x37')],_0x56557d;if(_0xbd855a>=_0x19db00){_0xbd855a=_0x19db00;_0x56557d=0xc8;}else{_0x56557d=0xce;}_0x41171c[_0xd1d2('0x32')](_0x56557d);return _0x41171c[_0xd1d2('0x38')](_0xd1d2('0x39'),_0x1db17f+'-'+_0xbd855a+'/'+_0x19db00)[_0xd1d2('0x34')](_0x4b4134);}return null;};}function patchUpdates(_0x1f3682){return function(_0x4501b6){try{jsonpatch[_0xd1d2('0x3a')](_0x4501b6,_0x1f3682,!![]);}catch(_0x1246d3){return BPromise[_0xd1d2('0x3b')](_0x1246d3);}return _0x4501b6[_0xd1d2('0x3c')]();};}function saveUpdates(_0x372481,_0xb6ad51){return function(_0x2ac217){if(_0x2ac217){return _0x2ac217[_0xd1d2('0x3d')](_0x372481)['then'](function(_0x1541ff){return _0x1541ff;});}return null;};}function removeEntity(_0x384fe1,_0xb4369a){return function(_0x573d27){if(_0x573d27){return _0x573d27[_0xd1d2('0x3e')]()['then'](function(){var _0x57a7fb=_0x573d27[_0xd1d2('0x3f')]({'plain':!![]});var _0x103c5f=_0xd1d2('0x40');return db[_0xd1d2('0x41')][_0xd1d2('0x3e')]({'where':{'type':_0x103c5f,'resourceId':_0x57a7fb['id']}})[_0xd1d2('0x27')](function(){return _0x573d27;});})['then'](function(){_0x384fe1[_0xd1d2('0x32')](0xcc)[_0xd1d2('0x33')]();});}};}function handleEntityNotFound(_0x5bdf40,_0x296bab){return function(_0x20a0ef){if(!_0x20a0ef){_0x5bdf40[_0xd1d2('0x42')](0x194);}return _0x20a0ef;};}function handleError(_0x2f55a1,_0x4adb17){_0x4adb17=_0x4adb17||0x1f4;return function(_0x5441ac){logger[_0xd1d2('0x2c')](_0x5441ac['stack']);if(_0x5441ac['name']){delete _0x5441ac['name'];}_0x2f55a1[_0xd1d2('0x32')](_0x4adb17)['send'](_0x5441ac);};}exports[_0xd1d2('0x43')]=function(_0x4e7640,_0x47996a){var _0x4bcea4={'include':[{'model':db[_0xd1d2('0x44')],'as':_0xd1d2('0x45')}]},_0x2dabfa={},_0x3bf13c={'count':0x0,'rows':[]};var _0x33ba30=_[_0xd1d2('0x46')](db[_0xd1d2('0x47')][_0xd1d2('0x48')],function(_0x2d930d){return{'name':_0x2d930d[_0xd1d2('0x49')],'type':_0x2d930d[_0xd1d2('0x4a')][_0xd1d2('0x4b')]};});_0x2dabfa[_0xd1d2('0x4c')]=_[_0xd1d2('0x46')](_0x33ba30,'name');_0x2dabfa['query']=_[_0xd1d2('0x4d')](_0x4e7640[_0xd1d2('0x4e')]);_0x2dabfa[_0xd1d2('0x4f')]=_['intersection'](_0x2dabfa['model'],_0x2dabfa[_0xd1d2('0x4e')]);_0x4bcea4[_0xd1d2('0x50')]=_['intersection'](_0x2dabfa[_0xd1d2('0x4c')],qs['fields'](_0x4e7640['query'][_0xd1d2('0x51')]));_0x4bcea4['attributes']=_0x4bcea4['attributes'][_0xd1d2('0x52')]?_0x4bcea4[_0xd1d2('0x50')]:_0x2dabfa[_0xd1d2('0x4c')];if(!_0x4e7640['query'][_0xd1d2('0x53')](_0xd1d2('0x54'))){_0x4bcea4[_0xd1d2('0x37')]=qs[_0xd1d2('0x37')](_0x4e7640['query'][_0xd1d2('0x37')]);_0x4bcea4[_0xd1d2('0x36')]=qs['offset'](_0x4e7640[_0xd1d2('0x4e')]['offset']);}_0x4bcea4[_0xd1d2('0x55')]=qs[_0xd1d2('0x56')](_0x4e7640[_0xd1d2('0x4e')][_0xd1d2('0x56')]);_0x4bcea4[_0xd1d2('0x57')]=qs['filters'](_['pick'](_0x4e7640[_0xd1d2('0x4e')],_0x2dabfa[_0xd1d2('0x4f')]),_0x33ba30);if(_0x4e7640['query'][_0xd1d2('0x58')]){_0x4bcea4[_0xd1d2('0x57')]=_[_0xd1d2('0x59')](_0x4bcea4[_0xd1d2('0x57')],{'$or':_[_0xd1d2('0x46')](_0x33ba30,function(_0x392626){if(_0x392626[_0xd1d2('0x4a')]!=='VIRTUAL'){var _0xed9e9={};_0xed9e9[_0x392626[_0xd1d2('0x5a')]]={'$like':'%'+_0x4e7640['query'][_0xd1d2('0x58')]+'%'};return _0xed9e9;}})});}_0x4bcea4=_[_0xd1d2('0x59')]({},_0x4bcea4,_0x4e7640['options']);var _0x5d1a47={'where':_0x4bcea4[_0xd1d2('0x57')]};return db[_0xd1d2('0x47')]['count'](_0x5d1a47)[_0xd1d2('0x27')](function(_0x11bfa6){_0x3bf13c[_0xd1d2('0x35')]=_0x11bfa6;if(_0x4e7640[_0xd1d2('0x4e')][_0xd1d2('0x5b')]){_0x4bcea4['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0xd1d2('0x5c')](_0x4bcea4);})['then'](function(_0x32f0e1){_0x3bf13c[_0xd1d2('0x5d')]=_0x32f0e1;return _0x3bf13c;})['then'](respondWithFilteredResult(_0x47996a,_0x4bcea4))[_0xd1d2('0x31')](handleError(_0x47996a,null));};exports[_0xd1d2('0x5e')]=function(_0x4e780c,_0x56069f){var _0x10cd2e={'raw':![],'where':{'id':_0x4e780c[_0xd1d2('0x5f')]['id']},'include':[{'model':db[_0xd1d2('0x44')],'as':_0xd1d2('0x45')}]},_0x20ab8b={};_0x20ab8b[_0xd1d2('0x4c')]=_[_0xd1d2('0x4d')](db[_0xd1d2('0x47')][_0xd1d2('0x48')]);_0x20ab8b['query']=_[_0xd1d2('0x4d')](_0x4e780c['query']);_0x20ab8b['filters']=_[_0xd1d2('0x60')](_0x20ab8b[_0xd1d2('0x4c')],_0x20ab8b[_0xd1d2('0x4e')]);_0x10cd2e[_0xd1d2('0x50')]=_[_0xd1d2('0x60')](_0x20ab8b[_0xd1d2('0x4c')],qs[_0xd1d2('0x51')](_0x4e780c[_0xd1d2('0x4e')][_0xd1d2('0x51')]));_0x10cd2e[_0xd1d2('0x50')]=_0x10cd2e[_0xd1d2('0x50')][_0xd1d2('0x52')]?_0x10cd2e[_0xd1d2('0x50')]:_0x20ab8b['model'];if(_0x4e780c['query'][_0xd1d2('0x5b')]){_0x10cd2e[_0xd1d2('0x61')]=[{'all':!![]}];}_0x10cd2e=_[_0xd1d2('0x59')]({},_0x10cd2e,_0x4e780c[_0xd1d2('0x62')]);return db[_0xd1d2('0x47')][_0xd1d2('0x63')](_0x10cd2e)[_0xd1d2('0x27')](handleEntityNotFound(_0x56069f,null))[_0xd1d2('0x27')](respondWithResult(_0x56069f,null))[_0xd1d2('0x31')](handleError(_0x56069f,null));};exports[_0xd1d2('0x64')]=function(_0x1788cd,_0x54406e){return db['WhatsappAccount'][_0xd1d2('0x64')](_0x1788cd[_0xd1d2('0x65')],{})[_0xd1d2('0x27')](function(_0x1c6a46){var _0x544870=_0x1788cd[_0xd1d2('0x66')][_0xd1d2('0x3f')]({'plain':!![]});if(!_0x544870)throw new Error(_0xd1d2('0x67'));if(_0x544870[_0xd1d2('0x68')]===_0xd1d2('0x66')){var _0x478225=_0x1c6a46[_0xd1d2('0x3f')]({'plain':!![]});var _0x4a7375=_0xd1d2('0x40');return db[_0xd1d2('0x69')][_0xd1d2('0x63')]({'where':{'name':_0x4a7375,'userProfileId':_0x544870['userProfileId']},'raw':!![]})['then'](function(_0x365792){if(_0x365792&&_0x365792[_0xd1d2('0x6a')]===0x0){return db[_0xd1d2('0x41')][_0xd1d2('0x64')]({'name':_0x478225['name'],'resourceId':_0x478225['id'],'type':_0x365792[_0xd1d2('0x5a')],'sectionId':_0x365792['id']},{})[_0xd1d2('0x27')](function(){return _0x1c6a46;});}else{return _0x1c6a46;}})[_0xd1d2('0x31')](function(_0x5358ec){logger[_0xd1d2('0x2c')](_0xd1d2('0x6b'),_0x5358ec);throw _0x5358ec;});}return _0x1c6a46;})['then'](respondWithResult(_0x54406e,0xc9))[_0xd1d2('0x31')](handleError(_0x54406e,null));};exports[_0xd1d2('0x3d')]=function(_0x12201f,_0x1becd5){if(_0x12201f['body']['id']){delete _0x12201f[_0xd1d2('0x65')]['id'];}return db[_0xd1d2('0x47')][_0xd1d2('0x63')]({'where':{'id':_0x12201f[_0xd1d2('0x5f')]['id']},'include':[{'model':db[_0xd1d2('0x44')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1becd5,null))['then'](saveUpdates(_0x12201f['body'],null))['then'](respondWithResult(_0x1becd5,null))[_0xd1d2('0x31')](handleError(_0x1becd5,null));};exports[_0xd1d2('0x3e')]=function(_0x386b51,_0x5f5043){return db[_0xd1d2('0x47')][_0xd1d2('0x63')]({'where':{'id':_0x386b51[_0xd1d2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5f5043,null))[_0xd1d2('0x27')](removeEntity(_0x5f5043,null))[_0xd1d2('0x31')](handleError(_0x5f5043,null));};exports[_0xd1d2('0x6c')]=function(_0x4a42d9,_0x43b43c){return db[_0xd1d2('0x47')]['describe']()[_0xd1d2('0x27')](respondWithResult(_0x43b43c,null))[_0xd1d2('0x31')](handleError(_0x43b43c,null));};exports['addDisposition']=function(_0x530335,_0x21bfd4,_0x1ea57a){if(_0x530335[_0xd1d2('0x65')]['id']){delete _0x530335[_0xd1d2('0x65')]['id'];}return db['WhatsappAccount'][_0xd1d2('0x63')]({'where':{'id':_0x530335[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x21bfd4,null))[_0xd1d2('0x27')](function(_0x5d537e){if(_0x5d537e){_0x530335[_0xd1d2('0x65')][_0xd1d2('0x6d')]=_0x5d537e['id'];return db[_0xd1d2('0x6e')]['create'](_0x530335[_0xd1d2('0x65')]);}})[_0xd1d2('0x27')](respondWithResult(_0x21bfd4,null))['catch'](handleError(_0x21bfd4,null));};exports[_0xd1d2('0x6f')]=function(_0x32ae30,_0x12e6e0,_0x55c0b5){var _0x394bab={'raw':![],'where':{}};var _0x4e60b6={};var _0x2c488f={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x32ae30['params']['id']}})['then'](handleEntityNotFound(_0x12e6e0,null))[_0xd1d2('0x27')](function(_0x5ed30b){if(_0x5ed30b){_0x4e60b6[_0xd1d2('0x4c')]=_['keys'](db[_0xd1d2('0x6e')][_0xd1d2('0x48')]);_0x4e60b6[_0xd1d2('0x4e')]=_[_0xd1d2('0x4d')](_0x32ae30[_0xd1d2('0x4e')]);_0x4e60b6[_0xd1d2('0x4f')]=_['intersection'](_0x4e60b6[_0xd1d2('0x4c')],_0x4e60b6[_0xd1d2('0x4e')]);_0x394bab[_0xd1d2('0x50')]=_[_0xd1d2('0x60')](_0x4e60b6[_0xd1d2('0x4c')],qs[_0xd1d2('0x51')](_0x32ae30[_0xd1d2('0x4e')][_0xd1d2('0x51')]));_0x394bab[_0xd1d2('0x50')]=_0x394bab[_0xd1d2('0x50')]['length']?_0x394bab[_0xd1d2('0x50')]:_0x4e60b6[_0xd1d2('0x4c')];if(!_0x32ae30[_0xd1d2('0x4e')][_0xd1d2('0x53')]('nolimit')){_0x394bab[_0xd1d2('0x37')]=qs[_0xd1d2('0x37')](_0x32ae30[_0xd1d2('0x4e')]['limit']);_0x394bab[_0xd1d2('0x36')]=qs[_0xd1d2('0x36')](_0x32ae30['query']['offset']);}_0x394bab[_0xd1d2('0x55')]=qs[_0xd1d2('0x56')](_0x32ae30[_0xd1d2('0x4e')][_0xd1d2('0x56')]);_0x394bab[_0xd1d2('0x57')]=qs[_0xd1d2('0x4f')](_[_0xd1d2('0x70')](_0x32ae30['query'],_0x4e60b6[_0xd1d2('0x4f')]));_0x394bab[_0xd1d2('0x57')][_0xd1d2('0x6d')]=_0x5ed30b['id'];if(_0x32ae30[_0xd1d2('0x4e')][_0xd1d2('0x58')]){_0x394bab[_0xd1d2('0x57')]=_[_0xd1d2('0x59')](_0x394bab[_0xd1d2('0x57')],{'$or':_[_0xd1d2('0x46')](_0x394bab[_0xd1d2('0x50')],function(_0x2c3650){var _0x162249={};_0x162249[_0x2c3650]={'$like':'%'+_0x32ae30[_0xd1d2('0x4e')][_0xd1d2('0x58')]+'%'};return _0x162249;})});}_0x394bab=_['merge']({},_0x394bab,_0x32ae30[_0xd1d2('0x62')]);return db[_0xd1d2('0x6e')][_0xd1d2('0x35')]({'where':_0x394bab[_0xd1d2('0x57')]})[_0xd1d2('0x27')](function(_0x32c294){_0x2c488f[_0xd1d2('0x35')]=_0x32c294;if(_0x32ae30[_0xd1d2('0x4e')][_0xd1d2('0x5b')]){_0x394bab[_0xd1d2('0x61')]=[{'all':!![]}];}return db[_0xd1d2('0x6e')][_0xd1d2('0x5c')](_0x394bab);})[_0xd1d2('0x27')](function(_0x548b9d){_0x2c488f[_0xd1d2('0x5d')]=_0x548b9d;return _0x2c488f;});}})[_0xd1d2('0x27')](respondWithFilteredResult(_0x12e6e0,_0x394bab))[_0xd1d2('0x31')](handleError(_0x12e6e0,null));};exports[_0xd1d2('0x71')]=function(_0x6cb1cc,_0x43e70e,_0x4c8f82){return db[_0xd1d2('0x47')][_0xd1d2('0x63')]({'where':{'id':_0x6cb1cc[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x43e70e,null))[_0xd1d2('0x27')](function(_0x48c4fa){if(_0x48c4fa){return _0x48c4fa[_0xd1d2('0x71')](_0x6cb1cc[_0xd1d2('0x4e')][_0xd1d2('0x72')]);}})[_0xd1d2('0x27')](respondWithStatusCode(_0x43e70e,null))[_0xd1d2('0x31')](handleError(_0x43e70e,null));};exports['addAnswer']=function(_0xdd57fb,_0x3d816c,_0x2b4bb8){if(_0xdd57fb[_0xd1d2('0x65')]['id']){delete _0xdd57fb['body']['id'];}return db[_0xd1d2('0x47')][_0xd1d2('0x63')]({'where':{'id':_0xdd57fb[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x3d816c,null))[_0xd1d2('0x27')](function(_0x18bd6d){if(_0x18bd6d){_0xdd57fb[_0xd1d2('0x65')]['WhatsappAccountId']=_0x18bd6d['id'];return db[_0xd1d2('0x73')][_0xd1d2('0x64')](_0xdd57fb[_0xd1d2('0x65')]);}})[_0xd1d2('0x27')](respondWithResult(_0x3d816c,null))[_0xd1d2('0x31')](handleError(_0x3d816c,null));};exports[_0xd1d2('0x74')]=function(_0x44e501,_0x3fdc2e,_0x4202dc){var _0x191d60={'raw':![],'where':{}};var _0x1cad85={};var _0x38f0c1={'count':0x0,'rows':[]};return db[_0xd1d2('0x47')][_0xd1d2('0x75')]({'where':{'id':_0x44e501[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x3fdc2e,null))[_0xd1d2('0x27')](function(_0x5b7dbb){if(_0x5b7dbb){_0x1cad85[_0xd1d2('0x4c')]=_['keys'](db[_0xd1d2('0x73')][_0xd1d2('0x48')]);_0x1cad85[_0xd1d2('0x4e')]=_[_0xd1d2('0x4d')](_0x44e501[_0xd1d2('0x4e')]);_0x1cad85[_0xd1d2('0x4f')]=_[_0xd1d2('0x60')](_0x1cad85[_0xd1d2('0x4c')],_0x1cad85['query']);_0x191d60['attributes']=_[_0xd1d2('0x60')](_0x1cad85['model'],qs['fields'](_0x44e501[_0xd1d2('0x4e')][_0xd1d2('0x51')]));_0x191d60['attributes']=_0x191d60[_0xd1d2('0x50')][_0xd1d2('0x52')]?_0x191d60[_0xd1d2('0x50')]:_0x1cad85[_0xd1d2('0x4c')];if(!_0x44e501[_0xd1d2('0x4e')][_0xd1d2('0x53')](_0xd1d2('0x54'))){_0x191d60['limit']=qs[_0xd1d2('0x37')](_0x44e501['query'][_0xd1d2('0x37')]);_0x191d60['offset']=qs[_0xd1d2('0x36')](_0x44e501[_0xd1d2('0x4e')][_0xd1d2('0x36')]);}_0x191d60[_0xd1d2('0x55')]=qs[_0xd1d2('0x56')](_0x44e501[_0xd1d2('0x4e')][_0xd1d2('0x56')]);_0x191d60['where']=qs[_0xd1d2('0x4f')](_[_0xd1d2('0x70')](_0x44e501[_0xd1d2('0x4e')],_0x1cad85[_0xd1d2('0x4f')]));_0x191d60['where'][_0xd1d2('0x6d')]=_0x5b7dbb['id'];if(_0x44e501[_0xd1d2('0x4e')][_0xd1d2('0x58')]){_0x191d60['where']=_[_0xd1d2('0x59')](_0x191d60[_0xd1d2('0x57')],{'$or':_[_0xd1d2('0x46')](_0x191d60[_0xd1d2('0x50')],function(_0x30aede){var _0x4c50f5={};_0x4c50f5[_0x30aede]={'$like':'%'+_0x44e501[_0xd1d2('0x4e')][_0xd1d2('0x58')]+'%'};return _0x4c50f5;})});}_0x191d60=_['merge']({},_0x191d60,_0x44e501[_0xd1d2('0x62')]);return db[_0xd1d2('0x73')][_0xd1d2('0x35')]({'where':_0x191d60[_0xd1d2('0x57')]})[_0xd1d2('0x27')](function(_0x4e0e8c){_0x38f0c1[_0xd1d2('0x35')]=_0x4e0e8c;if(_0x44e501[_0xd1d2('0x4e')][_0xd1d2('0x5b')]){_0x191d60[_0xd1d2('0x61')]=[{'all':!![]}];}return db[_0xd1d2('0x73')][_0xd1d2('0x5c')](_0x191d60);})[_0xd1d2('0x27')](function(_0x51056c){_0x38f0c1[_0xd1d2('0x5d')]=_0x51056c;return _0x38f0c1;});}})[_0xd1d2('0x27')](respondWithFilteredResult(_0x3fdc2e,_0x191d60))[_0xd1d2('0x31')](handleError(_0x3fdc2e,null));};exports['removeAnswers']=function(_0x27a3a1,_0x21094a,_0x41729c){return db[_0xd1d2('0x47')]['find']({'where':{'id':_0x27a3a1[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x21094a,null))['then'](function(_0x5c8644){if(_0x5c8644){return _0x5c8644[_0xd1d2('0x76')](_0x27a3a1['query'][_0xd1d2('0x72')]);}})[_0xd1d2('0x27')](respondWithStatusCode(_0x21094a,null))['catch'](handleError(_0x21094a,null));};exports['addAgents']=function(_0x199808,_0x53d200,_0x22c9b1){return db['WhatsappAccount']['find']({'where':{'id':_0x199808[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x53d200,null))[_0xd1d2('0x27')](function(_0x76d340){if(_0x76d340){return _0x76d340[_0xd1d2('0x77')](_0x199808[_0xd1d2('0x65')]['ids'],_['omit'](_0x199808[_0xd1d2('0x65')],[_0xd1d2('0x72'),'id'])||{})[_0xd1d2('0x78')](function(_0x3d4880){for(var _0x39ab07=0x0;_0x39ab07<_0x199808[_0xd1d2('0x65')][_0xd1d2('0x72')]['length'];_0x39ab07+=0x1){socket[_0xd1d2('0x79')]('userWhatsappAccount:save',{'UserId':_0x199808[_0xd1d2('0x65')][_0xd1d2('0x72')][_0x39ab07],'WhatsappAccountId':_0x199808['params']['id']});}return _0x3d4880;});}})[_0xd1d2('0x27')](respondWithResult(_0x53d200,null))[_0xd1d2('0x31')](handleError(_0x53d200,null));};exports[_0xd1d2('0x7a')]=function(_0xdebec0,_0x2075a4,_0x29664a){return db[_0xd1d2('0x47')][_0xd1d2('0x63')]({'where':{'id':_0xdebec0[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x2075a4,null))[_0xd1d2('0x27')](function(_0x1a85f2){if(_0x1a85f2){return _0x1a85f2['removeAgents'](_0xdebec0[_0xd1d2('0x4e')][_0xd1d2('0x72')])[_0xd1d2('0x27')](function(){if(_[_0xd1d2('0x7b')](_0xdebec0[_0xd1d2('0x4e')][_0xd1d2('0x72')])){for(var _0x32eaa8=0x0;_0x32eaa8<_0xdebec0[_0xd1d2('0x4e')][_0xd1d2('0x72')][_0xd1d2('0x52')];_0x32eaa8+=0x1){socket[_0xd1d2('0x79')](_0xd1d2('0x7c'),{'UserId':Number(_0xdebec0[_0xd1d2('0x4e')][_0xd1d2('0x72')][_0x32eaa8]),'WhatsappAccountId':Number(_0xdebec0[_0xd1d2('0x5f')]['id'])});}}else{socket[_0xd1d2('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0xdebec0[_0xd1d2('0x4e')]['ids']),'WhatsappAccountId':Number(_0xdebec0[_0xd1d2('0x5f')]['id'])});}});}})[_0xd1d2('0x27')](respondWithStatusCode(_0x2075a4,null))[_0xd1d2('0x31')](handleError(_0x2075a4,null));};exports[_0xd1d2('0x7d')]=function(_0x3e27ac,_0x3f83d8,_0x1dae99){var _0x3fc132={};var _0x3d3514={};var _0x5c21da;var _0x5d1ff6;return db['WhatsappAccount'][_0xd1d2('0x75')]({'where':{'id':_0x3e27ac[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x3f83d8,null))['then'](function(_0x524597){if(_0x524597){_0x5c21da=_0x524597;_0x3d3514[_0xd1d2('0x4c')]=_[_0xd1d2('0x4d')](db[_0xd1d2('0x7e')]['rawAttributes']);_0x3d3514[_0xd1d2('0x4e')]=_['keys'](_0x3e27ac[_0xd1d2('0x4e')]);_0x3d3514['filters']=_[_0xd1d2('0x60')](_0x3d3514[_0xd1d2('0x4c')],_0x3d3514[_0xd1d2('0x4e')]);_0x3fc132[_0xd1d2('0x50')]=_[_0xd1d2('0x60')](_0x3d3514['model'],qs[_0xd1d2('0x51')](_0x3e27ac['query']['fields']));_0x3fc132[_0xd1d2('0x50')]=_0x3fc132[_0xd1d2('0x50')]['length']?_0x3fc132['attributes']:_0x3d3514[_0xd1d2('0x4c')];_0x3fc132[_0xd1d2('0x55')]=qs[_0xd1d2('0x56')](_0x3e27ac['query']['sort']);_0x3fc132[_0xd1d2('0x57')]=qs[_0xd1d2('0x4f')](_[_0xd1d2('0x70')](_0x3e27ac[_0xd1d2('0x4e')],_0x3d3514[_0xd1d2('0x4f')]));if(_0x3e27ac[_0xd1d2('0x4e')][_0xd1d2('0x58')]){_0x3fc132[_0xd1d2('0x57')]=_['merge'](_0x3fc132[_0xd1d2('0x57')],{'$or':_[_0xd1d2('0x46')](_0x3fc132['attributes'],function(_0x9d53c8){var _0x32f50e={};_0x32f50e[_0x9d53c8]={'$like':'%'+_0x3e27ac[_0xd1d2('0x4e')][_0xd1d2('0x58')]+'%'};return _0x32f50e;})});}_0x3fc132=_['merge']({},_0x3fc132,_0x3e27ac[_0xd1d2('0x62')]);return _0x5c21da['getAgents'](_0x3fc132);}})[_0xd1d2('0x27')](function(_0x17b8d0){if(_0x17b8d0){_0x5d1ff6=_0x17b8d0['length'];if(!_0x3e27ac[_0xd1d2('0x4e')][_0xd1d2('0x53')]('nolimit')){_0x3fc132[_0xd1d2('0x37')]=qs['limit'](_0x3e27ac[_0xd1d2('0x4e')][_0xd1d2('0x37')]);_0x3fc132['offset']=qs[_0xd1d2('0x36')](_0x3e27ac[_0xd1d2('0x4e')][_0xd1d2('0x36')]);}return _0x5c21da[_0xd1d2('0x7d')](_0x3fc132);}})['then'](function(_0x4a00fa){if(_0x4a00fa){return _0x4a00fa?{'count':_0x5d1ff6,'rows':_0x4a00fa}:null;}})['then'](respondWithResult(_0x3f83d8,null))['catch'](handleError(_0x3f83d8,null));};exports[_0xd1d2('0x7f')]=function(_0x212182,_0x3d3d7f,_0x168bff){return db['WhatsappAccount'][_0xd1d2('0x75')]({'where':{'id':_0x212182['params']['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x3d3d7f,null))[_0xd1d2('0x27')](function(_0x40ece5){if(_0x40ece5){return db[_0xd1d2('0x80')][_0xd1d2('0x81')](function(_0x58889d){return db[_0xd1d2('0x82')]['destroy']({'where':{'WhatsappAccountId':_0x212182['params']['id']},'transaction':_0x58889d})[_0xd1d2('0x27')](function(_0x527b17){var _0x4ef02c=_['map'](_0x212182[_0xd1d2('0x65')],function(_0x5ba582){_0x5ba582['WhatsappAccountId']=_0x212182[_0xd1d2('0x5f')]['id'];return _0x5ba582;});return db[_0xd1d2('0x82')][_0xd1d2('0x83')](_0x4ef02c,{'transaction':_0x58889d});});})[_0xd1d2('0x27')](function(){return db[_0xd1d2('0x82')][_0xd1d2('0x84')]({'where':{'WhatsappAccountId':_0x212182['params']['id']},'order':'priority'});});}})[_0xd1d2('0x27')](respondWithResult(_0x3d3d7f,null))[_0xd1d2('0x31')](handleError(_0x3d3d7f,null));};exports[_0xd1d2('0x85')]=function(_0xf326c8,_0x7bb1bd,_0x2871c6){var _0x4bb2da={};var _0x3c332d={};var _0x588a6a;var _0x298163;return db[_0xd1d2('0x47')][_0xd1d2('0x75')]({'where':{'id':_0xf326c8[_0xd1d2('0x5f')]['id']}})[_0xd1d2('0x27')](handleEntityNotFound(_0x7bb1bd,null))['then'](function(_0x10face){if(_0x10face){_0x588a6a=_0x10face;_0x3c332d[_0xd1d2('0x4c')]=_['keys'](db[_0xd1d2('0x82')][_0xd1d2('0x48')]);_0x3c332d[_0xd1d2('0x4e')]=_[_0xd1d2('0x4d')](_0xf326c8[_0xd1d2('0x4e')]);_0x3c332d[_0xd1d2('0x4f')]=_['intersection'](_0x3c332d[_0xd1d2('0x4c')],_0x3c332d[_0xd1d2('0x4e')]);_0x4bb2da[_0xd1d2('0x50')]=_['intersection'](_0x3c332d[_0xd1d2('0x4c')],qs[_0xd1d2('0x51')](_0xf326c8[_0xd1d2('0x4e')][_0xd1d2('0x51')]));_0x4bb2da[_0xd1d2('0x50')]=_0x4bb2da['attributes'][_0xd1d2('0x52')]?_0x4bb2da[_0xd1d2('0x50')]:_0x3c332d[_0xd1d2('0x4c')];_0x4bb2da['order']=qs[_0xd1d2('0x56')](_0xf326c8['query'][_0xd1d2('0x56')]);_0x4bb2da[_0xd1d2('0x57')]=qs[_0xd1d2('0x4f')](_[_0xd1d2('0x70')](_0xf326c8[_0xd1d2('0x4e')],_0x3c332d[_0xd1d2('0x4f')]));if(_0xf326c8[_0xd1d2('0x4e')][_0xd1d2('0x58')]){_0x4bb2da['where']=_[_0xd1d2('0x59')](_0x4bb2da[_0xd1d2('0x57')],{'$or':_['map'](_0x4bb2da['attributes'],function(_0x4ef53e){var _0x397174={};_0x397174[_0x4ef53e]={'$like':'%'+_0xf326c8[_0xd1d2('0x4e')]['filter']+'%'};return _0x397174;})});}_0x4bb2da=_[_0xd1d2('0x59')]({},_0x4bb2da,_0xf326c8[_0xd1d2('0x62')]);return _0x588a6a['getApplications'](_0x4bb2da);}})[_0xd1d2('0x27')](function(_0x27e0c8){if(_0x27e0c8){_0x298163=_0x27e0c8['length'];if(!_0xf326c8[_0xd1d2('0x4e')]['hasOwnProperty']('nolimit')){_0x4bb2da[_0xd1d2('0x37')]=qs[_0xd1d2('0x37')](_0xf326c8[_0xd1d2('0x4e')][_0xd1d2('0x37')]);_0x4bb2da[_0xd1d2('0x36')]=qs[_0xd1d2('0x36')](_0xf326c8[_0xd1d2('0x4e')][_0xd1d2('0x36')]);}return _0x588a6a[_0xd1d2('0x85')](_0x4bb2da);}})[_0xd1d2('0x27')](function(_0x16ecd5){if(_0x16ecd5){return _0x16ecd5?{'count':_0x298163,'rows':_0x16ecd5}:null;}})[_0xd1d2('0x27')](respondWithResult(_0x7bb1bd,null))[_0xd1d2('0x31')](handleError(_0x7bb1bd,null));};exports[_0xd1d2('0x86')]=function(_0x579a99,_0x3310d1,_0x1c0fce){var _0x6c23cc={'channel':_0xd1d2('0x87')};var _0x30e8ad=[];var _0x37a7de=[];var _0x5cbaed={};return db[_0xd1d2('0x47')][_0xd1d2('0x63')]({'where':{'id':_0x579a99[_0xd1d2('0x5f')]['id']},'include':[{'model':db[_0xd1d2('0x82')],'as':_0xd1d2('0x88')}]})[_0xd1d2('0x27')](handleEntityNotFound(_0x3310d1,null))[_0xd1d2('0x27')](function(_0x11594d){_0x6c23cc[_0xd1d2('0x89')]=_0x11594d;_0x6c23cc['applications']=_['orderBy'](_0x11594d[_0xd1d2('0x88')],[_0xd1d2('0x8a')],['asc']);if(_0x6c23cc[_0xd1d2('0x89')][_0xd1d2('0x88')]){delete _0x6c23cc[_0xd1d2('0x89')][_0xd1d2('0x88')];}return db['CmContact'][_0xd1d2('0x6c')]();})[_0xd1d2('0x27')](function(_0x4590d5){if(!_0x4590d5){throw new db['Sequelize'][(_0xd1d2('0x24'))]('no\x20available\x20attributes');}_0x30e8ad=_[_0xd1d2('0x8b')](_[_0xd1d2('0x4d')](_0x4590d5),[_0xd1d2('0x8c'),_0xd1d2('0x8d')]);_0x37a7de=_['difference'](_[_0xd1d2('0x4d')](_0x4590d5),[_0xd1d2('0x8c'),'updatedAt',_0xd1d2('0x8e'),_0xd1d2('0x8f')]);_0x6c23cc['body']={'mapKey':_0xd1d2('0x90')};if(_0x6c23cc['account'][_0xd1d2('0x4a')]&&_0x6c23cc['account']['type']===_0xd1d2('0x91')){_0x6c23cc[_0xd1d2('0x65')]['from']=_0x579a99[_0xd1d2('0x65')]['From']['replace']('whatsapp:','');_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0x65')]=_0x579a99[_0xd1d2('0x65')]['Body'];_0x6c23cc[_0xd1d2('0x65')]['messageId']=_0x579a99[_0xd1d2('0x65')][_0xd1d2('0x92')];}if(_0x6c23cc[_0xd1d2('0x65')]['id']){delete _0x6c23cc['body']['id'];}if(_[_0xd1d2('0x93')](_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0x94')])){throw new db[(_0xd1d2('0x23'))][(_0xd1d2('0x24'))](_0xd1d2('0x95'));}if(_['isNil'](_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0x65')])||_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0x65')]===''){throw new db['Sequelize'][(_0xd1d2('0x24'))](_0xd1d2('0x96'));}if(_[_0xd1d2('0x93')](_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0x97')])){throw new db[(_0xd1d2('0x23'))][(_0xd1d2('0x24'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37a7de);}if(!_[_0xd1d2('0x98')](_0x37a7de,_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0x97')])){throw new db[(_0xd1d2('0x23'))]['ValidationError'](_0xd1d2('0x99')+_0x37a7de);}_0x5cbaed[_0x6c23cc['body'][_0xd1d2('0x97')]]=_0x6c23cc['body']['from'];return db['CmList'][_0xd1d2('0x63')]({'where':{'id':_0x6c23cc['account'][_0xd1d2('0x8f')]},'include':[{'model':db[_0xd1d2('0x9a')],'as':_0xd1d2('0x9b'),'where':_0x5cbaed,'limit':0x1,'order':[[_0xd1d2('0x8d'),_0xd1d2('0x9c')]]}]});})[_0xd1d2('0x27')](handleEntityNotFound(_0x3310d1,null))['then'](function(_0x463df5){if(_0x463df5){_0x6c23cc[_0xd1d2('0x9d')]=_[_0xd1d2('0x9e')](_0x463df5,['Contacts']);if(_0x463df5[_0xd1d2('0x9b')][_0xd1d2('0x52')]){return _0x463df5[_0xd1d2('0x9b')][0x0];}var _0x1d03b6=_[_0xd1d2('0x1b')](_0x6c23cc[_0xd1d2('0x65')],{'firstName':_0x6c23cc[_0xd1d2('0x65')]['from'],'ListId':_0x463df5['id']});_0x1d03b6[_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0x97')]]=_0x6c23cc['body'][_0xd1d2('0x94')];return db[_0xd1d2('0x9a')][_0xd1d2('0x64')](_0x1d03b6,{'fields':_0x30e8ad,'raw':!![]});}})[_0xd1d2('0x27')](handleEntityNotFound(_0x3310d1,null))[_0xd1d2('0x27')](function(_0x1d2a74){if(_0x1d2a74){_0x6c23cc[_0xd1d2('0x9f')]=_0x1d2a74;var _0x4717c2={'ContactId':_0x1d2a74['id'],'phone':_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0x94')],'WhatsappAccountId':_0x579a99['params']['id']};var _0x534a69={'ContactId':_0x1d2a74['id'],'WhatsappAccountId':_0x579a99[_0xd1d2('0x5f')]['id'],'closed':![]};return db[_0xd1d2('0xa0')][_0xd1d2('0x63')]({'where':_0x534a69})[_0xd1d2('0x27')](function(_0x477966){if(_0x477966){return[_0x477966,![]];}return db[_0xd1d2('0xa0')][_0xd1d2('0x64')](_0x4717c2)[_0xd1d2('0x27')](function(_0x55f93f){return[_0x55f93f,!![]];});});}})['spread'](function(_0x2b82cd,_0x5d9431){_0x6c23cc[_0xd1d2('0xa1')]=_0x2b82cd[_0xd1d2('0x3f')]({'plain':!![]});_0x6c23cc[_0xd1d2('0xa1')][_0xd1d2('0xa2')]=![];if(_0x5d9431){if(_0x6c23cc['account'][_0xd1d2('0xa3')]){_0x6c23cc['applications'][_0xd1d2('0xa4')]({'id':0x0,'priority':_0x6c23cc[_0xd1d2('0xa5')][_0xd1d2('0x52')]+0x1,'app':_0xd1d2('0xa6'),'appdata':_0xd1d2('0xa7'),'interval':'*,*,*,*'});}_0x6c23cc[_0xd1d2('0xa1')][_0xd1d2('0xa2')]=!![];}return db['WhatsappMessage'][_0xd1d2('0x64')]({'phone':_0x6c23cc[_0xd1d2('0x65')]['from'],'messageId':_0x6c23cc['body'][_0xd1d2('0xa8')],'body':_0x6c23cc[_0xd1d2('0x65')]['body'],'WhatsappAccountId':_0x579a99[_0xd1d2('0x5f')]['id'],'WhatsappInteractionId':_0x2b82cd['id'],'direction':'in','ContactId':_0x2b82cd[_0xd1d2('0xa9')],'AttachmentId':_0x6c23cc[_0xd1d2('0x65')][_0xd1d2('0xaa')]});})[_0xd1d2('0x27')](function(_0x215f37){_0x6c23cc[_0xd1d2('0x2e')]=_0x215f37;if(_0x6c23cc['interaction']['UserId']){return db[_0xd1d2('0x7e')][_0xd1d2('0x63')]({'attributes':['id',_0xd1d2('0x5a')],'where':{'id':_0x6c23cc[_0xd1d2('0xa1')]['UserId']}})[_0xd1d2('0x27')](function(_0x507968){if(_0x507968){_0x6c23cc[_0xd1d2('0xa5')][_0xd1d2('0xab')]({'id':0x0,'priority':0x0,'app':_0xd1d2('0xac'),'appdata':_0x507968[_0xd1d2('0x5a')]+','+(_0x6c23cc[_0xd1d2('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0xd1d2('0xad')});}return respondWithRpcPromise(_0xd1d2('0xae'),_0xd1d2('0xaf'),_0x6c23cc);});}return respondWithRpcPromise(_0xd1d2('0xae'),_0xd1d2('0xaf'),_0x6c23cc);})['then'](function(_0x2e774b){if(_0x2e774b){var _0x2dfaa2=0xc8;var _0x315cae=_0xd1d2('0xb0');logger[_0xd1d2('0x2f')](_0xd1d2('0x29'),_0x315cae,_0x2dfaa2,'entity\x20found');logger['debug'](_0xd1d2('0xb1'),_0x315cae,_0x2dfaa2,_0xd1d2('0xb2'),JSON[_0xd1d2('0x2b')](_0x2e774b));if(_0x6c23cc[_0xd1d2('0x89')][_0xd1d2('0x4a')]==='twilio'){return _0x3310d1[_0xd1d2('0x32')](_0x2dfaa2)[_0xd1d2('0x38')](_0xd1d2('0xb3'),_0xd1d2('0xb4'))[_0xd1d2('0xb5')](_0xd1d2('0xb6'));}else{return _0x3310d1[_0xd1d2('0x32')](_0x2dfaa2)[_0xd1d2('0x34')](_0x2e774b);}}})[_0xd1d2('0x31')](handleError(_0x3310d1,null));};exports[_0xd1d2('0xb5')]=function(_0xf0dfea,_0x592f12,_0x5bedcf){var _0x3cdee5,_0x127335,_0x4ab5ef;if(_[_0xd1d2('0x93')](_0xf0dfea[_0xd1d2('0x65')][_0xd1d2('0x65')])||_0xf0dfea[_0xd1d2('0x65')][_0xd1d2('0x65')]===''){throw new db[(_0xd1d2('0x23'))][(_0xd1d2('0x24'))](_0xd1d2('0x96'));}if(_['isNil'](_0xf0dfea[_0xd1d2('0x65')]['to'])){throw new db[(_0xd1d2('0x23'))]['ValidationError'](_0xd1d2('0xb7'));}_0x3cdee5=_0xf0dfea['body']['to'];return db[_0xd1d2('0x47')][_0xd1d2('0x63')]({'where':{'id':_0xf0dfea['params']['id']},'include':[{'model':db[_0xd1d2('0xb8')],'as':_0xd1d2('0xb9'),'include':[{'model':db[_0xd1d2('0x9a')],'as':_0xd1d2('0x9b'),'where':{'mobile':_0x3cdee5},'limit':0x1,'order':[[_0xd1d2('0x8d'),_0xd1d2('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x592f12,null))[_0xd1d2('0x27')](function(_0x34767d){if(_0x34767d&&_0x34767d['List']){_0x127335=_0x34767d[_0xd1d2('0x3f')]({'plain':!![]});if(_0x127335[_0xd1d2('0xb9')]&&_0x127335[_0xd1d2('0xb9')]['Contacts'][_0xd1d2('0x52')]){return _0x127335[_0xd1d2('0xb9')][_0xd1d2('0x9b')][0x0];}return db[_0xd1d2('0x9a')]['create'](_[_0xd1d2('0x1b')](_0xf0dfea[_0xd1d2('0x65')],{'firstName':_0x3cdee5,'mobile':_0x3cdee5,'phone':_0x3cdee5,'ListId':_0x127335['ListId']}));}})[_0xd1d2('0x27')](handleEntityNotFound(_0x592f12,null))[_0xd1d2('0x27')](function(_0x844251){if(_0x844251){_0x4ab5ef=_0x844251;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x4ab5ef['id'],'closed':![],'WhatsappAccountId':_0x127335['id']}})[_0xd1d2('0x27')](function(_0x8f790c){if(_0x8f790c){return[_0x8f790c,![]];}return db[_0xd1d2('0xa0')][_0xd1d2('0x64')]({'UserId':_0xf0dfea[_0xd1d2('0x66')]['id'],'ContactId':_0x4ab5ef['id'],'WhatsappAccountId':_0x127335['id'],'phone':_0x3cdee5,'firstMsgDirection':_0xd1d2('0xba'),'Messages':[_[_0xd1d2('0x59')](_0xf0dfea[_0xd1d2('0x65')],{'read':![],'body':_0xf0dfea[_0xd1d2('0x65')][_0xd1d2('0x65')],'phone':_0x3cdee5,'WhatsappAccountId':_0x127335['id'],'UserId':_0xf0dfea['user']['id'],'ContactId':_0x4ab5ef['id']})]},{'include':[{'model':db[_0xd1d2('0xbb')],'as':_0xd1d2('0xbc')}]})[_0xd1d2('0x27')](function(_0x498893){return[_0x498893,!![]];});});}})['spread'](function(_0x133b9a,_0x248cf2){if(_0x248cf2){return _0x133b9a;}return db[_0xd1d2('0xbb')][_0xd1d2('0x64')](_['merge'](_0xf0dfea['body'],{'read':![],'body':_0xf0dfea[_0xd1d2('0x65')]['body'],'phone':_0x3cdee5,'WhatsappAccountId':_0x127335['id'],'WhatsappInteractionId':_0x133b9a['id'],'UserId':_0xf0dfea[_0xd1d2('0x66')]['id'],'ContactId':_0x4ab5ef['id']}))[_0xd1d2('0x27')](function(_0x28e680){_0x133b9a[_0xd1d2('0xbd')][_0xd1d2('0xbc')]=[];_0x133b9a['dataValues'][_0xd1d2('0xbc')][_0xd1d2('0xa4')](_0x28e680[_0xd1d2('0xbd')]);return _0x133b9a;});})[_0xd1d2('0x27')](respondWithResult(_0x592f12,null))[_0xd1d2('0x31')](handleError(_0x592f12,null));}; \ No newline at end of file +var _0x13f6=['where','pick','filter','VIRTUAL','merge','options','WhatsappAccount','include','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','applications','orderBy','Applications','priority','account','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','replace','whatsapp:','messageId','isNil','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','DESC','list','omit','Contacts','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','agent','startRouting','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','get','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0x13f6,0x124));var _0x613f=function(_0x4a59dd,_0x3a7d4e){_0x4a59dd=_0x4a59dd-0x0;var _0x486ee5=_0x13f6[_0x4a59dd];return _0x486ee5;};'use strict';var pdf=require(_0x613f('0x0'));var emlformat=require(_0x613f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x613f('0x2'));var rp=require(_0x613f('0x3'));var moment=require(_0x613f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613f('0x5'));var util=require(_0x613f('0x6'));var path=require(_0x613f('0x7'));var sox=require('sox');var csv=require(_0x613f('0x8'));var ejs=require(_0x613f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0x8'));var querystring=require(_0x613f('0xb'));var Papa=require(_0x613f('0xc'));var Redis=require('ioredis');var authService=require(_0x613f('0xd'));var qs=require(_0x613f('0xe'));var as=require(_0x613f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x10'))(_0x613f('0x11'));var utils=require(_0x613f('0x12'));var config=require('../../config/environment');var db=require(_0x613f('0x13'))['db'];config[_0x613f('0x14')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x613f('0x15'))(new Redis(config[_0x613f('0x14')]));require(_0x613f('0x16'))[_0x613f('0x17')](socket);var jayson=require(_0x613f('0x18'));var client=jayson[_0x613f('0x19')][_0x613f('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x291268,_0x2eee4d,_0x1d68fd){if(_0x1d68fd){var _0x548218=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x548218[_0x613f('0x1b')](_0x2eee4d)){return _0x291268;}else{throw new db['Sequelize']['ValidationError'](_0x613f('0x1c'));}}else{return _0x291268;}}function respondWithRpcPromise(_0x2f244d,_0x544eca,_0x39e417,_0x4f9dae){return new BPromise(function(_0x62ebfe,_0x1e5a11){var _0x431266=_0x4f9dae||client;return _0x431266[_0x613f('0x1d')](_0x2f244d,_0x39e417)[_0x613f('0x1e')](function(_0x1ba35f){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x544eca,_0x613f('0x1f'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x544eca,_0x613f('0x1f'),JSON[_0x613f('0x20')](_0x1ba35f));if(_0x1ba35f['error']){if(_0x1ba35f[_0x613f('0x21')][_0x613f('0x22')]===0x1f4){logger[_0x613f('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x544eca,_0x1ba35f['error'][_0x613f('0x23')]);return _0x1e5a11(_0x1ba35f[_0x613f('0x21')][_0x613f('0x23')]);}logger['error'](_0x613f('0x24'),_0x544eca,_0x1ba35f[_0x613f('0x21')][_0x613f('0x23')]);return _0x62ebfe(_0x1ba35f[_0x613f('0x21')][_0x613f('0x23')]);}else{logger['info'](_0x613f('0x24'),_0x544eca,_0x613f('0x1f'));_0x62ebfe(_0x1ba35f['result'][_0x613f('0x23')]);}})[_0x613f('0x25')](function(_0x32e747){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x544eca,_0x32e747);_0x1e5a11(_0x32e747);});});}function respondWithStatusCode(_0x5a4a8b,_0x379920){_0x379920=_0x379920||0xcc;return function(_0x594c28){if(_0x594c28){return _0x5a4a8b[_0x613f('0x26')](_0x379920);}return _0x5a4a8b[_0x613f('0x27')](_0x379920)['end']();};}function respondWithResult(_0x121241,_0x2551c1){_0x2551c1=_0x2551c1||0xc8;return function(_0x4c8aa1){if(_0x4c8aa1){return _0x121241['status'](_0x2551c1)['json'](_0x4c8aa1);}};}function respondWithFilteredResult(_0x24be7c,_0x7c1a94){return function(_0xcad8d6){if(_0xcad8d6){var _0x47f4af=_0xcad8d6[_0x613f('0x28')],_0x23eda8=_0x7c1a94['offset'],_0x439478=_0x7c1a94[_0x613f('0x29')]+_0x7c1a94[_0x613f('0x2a')],_0xd335a6;if(_0x439478>=_0x47f4af){_0x439478=_0x47f4af;_0xd335a6=0xc8;}else{_0xd335a6=0xce;}_0x24be7c[_0x613f('0x27')](_0xd335a6);return _0x24be7c[_0x613f('0x2b')](_0x613f('0x2c'),_0x23eda8+'-'+_0x439478+'/'+_0x47f4af)[_0x613f('0x2d')](_0xcad8d6);}return null;};}function patchUpdates(_0x5d7e9a){return function(_0x2ab751){try{jsonpatch[_0x613f('0x2e')](_0x2ab751,_0x5d7e9a,!![]);}catch(_0x314819){return BPromise['reject'](_0x314819);}return _0x2ab751[_0x613f('0x2f')]();};}function saveUpdates(_0x4af0de,_0x3df7bf){return function(_0x11e7c2){if(_0x11e7c2){return _0x11e7c2[_0x613f('0x30')](_0x4af0de)[_0x613f('0x1e')](function(_0x2bceaa){return _0x2bceaa;});}return null;};}function removeEntity(_0x2e5590,_0x589157){return function(_0x1a18ce){if(_0x1a18ce){return _0x1a18ce[_0x613f('0x31')]()[_0x613f('0x1e')](function(){var _0x25b2e4=_0x1a18ce[_0x613f('0x32')]({'plain':!![]});var _0x47a9f6='WhatsappAccounts';return db['UserProfileResource'][_0x613f('0x31')]({'where':{'type':_0x47a9f6,'resourceId':_0x25b2e4['id']}})[_0x613f('0x1e')](function(){return _0x1a18ce;});})[_0x613f('0x1e')](function(){_0x2e5590[_0x613f('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc02e,_0xaedbbd){return function(_0x4ed25f){if(!_0x4ed25f){_0x2fc02e[_0x613f('0x26')](0x194);}return _0x4ed25f;};}function handleError(_0x550cea,_0x310016){_0x310016=_0x310016||0x1f4;return function(_0x56c669){logger[_0x613f('0x21')](_0x56c669['stack']);if(_0x56c669[_0x613f('0x33')]){delete _0x56c669[_0x613f('0x33')];}_0x550cea[_0x613f('0x27')](_0x310016)['send'](_0x56c669);};}exports[_0x613f('0x34')]=function(_0x2c6a0c,_0x3f1351){var _0x2fb3a6={'include':[{'model':db[_0x613f('0x35')],'as':_0x613f('0x36')}]},_0x474432={},_0x19708b={'count':0x0,'rows':[]};var _0x1f71f3=_[_0x613f('0x37')](db['WhatsappAccount'][_0x613f('0x38')],function(_0x26f7c8){return{'name':_0x26f7c8[_0x613f('0x39')],'type':_0x26f7c8[_0x613f('0x3a')][_0x613f('0x3b')]};});_0x474432[_0x613f('0x3c')]=_[_0x613f('0x37')](_0x1f71f3,'name');_0x474432[_0x613f('0x3d')]=_[_0x613f('0x3e')](_0x2c6a0c[_0x613f('0x3d')]);_0x474432[_0x613f('0x3f')]=_[_0x613f('0x40')](_0x474432[_0x613f('0x3c')],_0x474432[_0x613f('0x3d')]);_0x2fb3a6['attributes']=_[_0x613f('0x40')](_0x474432[_0x613f('0x3c')],qs[_0x613f('0x41')](_0x2c6a0c[_0x613f('0x3d')][_0x613f('0x41')]));_0x2fb3a6[_0x613f('0x42')]=_0x2fb3a6[_0x613f('0x42')][_0x613f('0x43')]?_0x2fb3a6[_0x613f('0x42')]:_0x474432[_0x613f('0x3c')];if(!_0x2c6a0c[_0x613f('0x3d')][_0x613f('0x44')](_0x613f('0x45'))){_0x2fb3a6['limit']=qs[_0x613f('0x2a')](_0x2c6a0c[_0x613f('0x3d')][_0x613f('0x2a')]);_0x2fb3a6[_0x613f('0x29')]=qs['offset'](_0x2c6a0c[_0x613f('0x3d')][_0x613f('0x29')]);}_0x2fb3a6[_0x613f('0x46')]=qs[_0x613f('0x47')](_0x2c6a0c[_0x613f('0x3d')][_0x613f('0x47')]);_0x2fb3a6[_0x613f('0x48')]=qs[_0x613f('0x3f')](_[_0x613f('0x49')](_0x2c6a0c[_0x613f('0x3d')],_0x474432['filters']),_0x1f71f3);if(_0x2c6a0c['query'][_0x613f('0x4a')]){_0x2fb3a6[_0x613f('0x48')]=_['merge'](_0x2fb3a6[_0x613f('0x48')],{'$or':_[_0x613f('0x37')](_0x1f71f3,function(_0x3b6fc3){if(_0x3b6fc3[_0x613f('0x3a')]!==_0x613f('0x4b')){var _0x1c0b07={};_0x1c0b07[_0x3b6fc3[_0x613f('0x33')]]={'$like':'%'+_0x2c6a0c[_0x613f('0x3d')][_0x613f('0x4a')]+'%'};return _0x1c0b07;}})});}_0x2fb3a6=_[_0x613f('0x4c')]({},_0x2fb3a6,_0x2c6a0c[_0x613f('0x4d')]);var _0x2d0d05={'where':_0x2fb3a6[_0x613f('0x48')]};return db[_0x613f('0x4e')][_0x613f('0x28')](_0x2d0d05)[_0x613f('0x1e')](function(_0x3adc7c){_0x19708b[_0x613f('0x28')]=_0x3adc7c;if(_0x2c6a0c['query']['includeAll']){_0x2fb3a6[_0x613f('0x4f')]=[{'all':!![]}];}return db[_0x613f('0x4e')]['findAll'](_0x2fb3a6);})['then'](function(_0x94968f){_0x19708b['rows']=_0x94968f;return _0x19708b;})['then'](respondWithFilteredResult(_0x3f1351,_0x2fb3a6))[_0x613f('0x25')](handleError(_0x3f1351,null));};exports[_0x613f('0x50')]=function(_0x26ba69,_0x52b62f){var _0x1e3298={'raw':![],'where':{'id':_0x26ba69['params']['id']},'include':[{'model':db['Pause'],'as':_0x613f('0x36')}]},_0x150b36={};_0x150b36[_0x613f('0x3c')]=_[_0x613f('0x3e')](db[_0x613f('0x4e')][_0x613f('0x38')]);_0x150b36[_0x613f('0x3d')]=_[_0x613f('0x3e')](_0x26ba69['query']);_0x150b36['filters']=_[_0x613f('0x40')](_0x150b36['model'],_0x150b36['query']);_0x1e3298[_0x613f('0x42')]=_[_0x613f('0x40')](_0x150b36[_0x613f('0x3c')],qs['fields'](_0x26ba69[_0x613f('0x3d')][_0x613f('0x41')]));_0x1e3298[_0x613f('0x42')]=_0x1e3298[_0x613f('0x42')][_0x613f('0x43')]?_0x1e3298[_0x613f('0x42')]:_0x150b36[_0x613f('0x3c')];if(_0x26ba69['query'][_0x613f('0x51')]){_0x1e3298['include']=[{'all':!![]}];}_0x1e3298=_[_0x613f('0x4c')]({},_0x1e3298,_0x26ba69[_0x613f('0x4d')]);return db[_0x613f('0x4e')][_0x613f('0x52')](_0x1e3298)[_0x613f('0x1e')](handleEntityNotFound(_0x52b62f,null))[_0x613f('0x1e')](respondWithResult(_0x52b62f,null))[_0x613f('0x25')](handleError(_0x52b62f,null));};exports[_0x613f('0x53')]=function(_0x214d01,_0x49637d){return db[_0x613f('0x4e')][_0x613f('0x53')](_0x214d01[_0x613f('0x54')],{})['then'](function(_0x4f316c){var _0x687e56=_0x214d01['user'][_0x613f('0x32')]({'plain':!![]});if(!_0x687e56)throw new Error(_0x613f('0x55'));if(_0x687e56[_0x613f('0x56')]===_0x613f('0x57')){var _0x3f5b36=_0x4f316c[_0x613f('0x32')]({'plain':!![]});var _0x2fc217=_0x613f('0x58');return db[_0x613f('0x59')][_0x613f('0x52')]({'where':{'name':_0x2fc217,'userProfileId':_0x687e56[_0x613f('0x5a')]},'raw':!![]})['then'](function(_0xbc2c8f){if(_0xbc2c8f&&_0xbc2c8f[_0x613f('0x5b')]===0x0){return db[_0x613f('0x5c')][_0x613f('0x53')]({'name':_0x3f5b36['name'],'resourceId':_0x3f5b36['id'],'type':_0xbc2c8f[_0x613f('0x33')],'sectionId':_0xbc2c8f['id']},{})[_0x613f('0x1e')](function(){return _0x4f316c;});}else{return _0x4f316c;}})['catch'](function(_0x49ab25){logger[_0x613f('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49ab25);throw _0x49ab25;});}return _0x4f316c;})['then'](respondWithResult(_0x49637d,0xc9))['catch'](handleError(_0x49637d,null));};exports[_0x613f('0x30')]=function(_0x4ddb76,_0x49854b){if(_0x4ddb76['body']['id']){delete _0x4ddb76[_0x613f('0x54')]['id'];}return db[_0x613f('0x4e')]['find']({'where':{'id':_0x4ddb76[_0x613f('0x5d')]['id']},'include':[{'model':db[_0x613f('0x35')],'as':_0x613f('0x36')}]})[_0x613f('0x1e')](handleEntityNotFound(_0x49854b,null))['then'](saveUpdates(_0x4ddb76[_0x613f('0x54')],null))[_0x613f('0x1e')](respondWithResult(_0x49854b,null))['catch'](handleError(_0x49854b,null));};exports[_0x613f('0x31')]=function(_0x32f17b,_0xae53fa){return db[_0x613f('0x4e')][_0x613f('0x52')]({'where':{'id':_0x32f17b[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0xae53fa,null))[_0x613f('0x1e')](removeEntity(_0xae53fa,null))[_0x613f('0x25')](handleError(_0xae53fa,null));};exports[_0x613f('0x5e')]=function(_0x14f418,_0x2e5c06){return db['WhatsappAccount'][_0x613f('0x5e')]()[_0x613f('0x1e')](respondWithResult(_0x2e5c06,null))[_0x613f('0x25')](handleError(_0x2e5c06,null));};exports[_0x613f('0x5f')]=function(_0x2dc6a4,_0x2d9b65,_0x4e2002){if(_0x2dc6a4[_0x613f('0x54')]['id']){delete _0x2dc6a4[_0x613f('0x54')]['id'];}return db[_0x613f('0x4e')][_0x613f('0x52')]({'where':{'id':_0x2dc6a4[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x2d9b65,null))['then'](function(_0x4efc80){if(_0x4efc80){_0x2dc6a4[_0x613f('0x54')][_0x613f('0x60')]=_0x4efc80['id'];return db[_0x613f('0x61')][_0x613f('0x53')](_0x2dc6a4['body']);}})[_0x613f('0x1e')](respondWithResult(_0x2d9b65,null))[_0x613f('0x25')](handleError(_0x2d9b65,null));};exports[_0x613f('0x62')]=function(_0x3403f8,_0x5af9c6,_0x282a9f){var _0x28005b={'raw':![],'where':{}};var _0x155dbe={};var _0x1bff33={'count':0x0,'rows':[]};return db[_0x613f('0x4e')][_0x613f('0x63')]({'where':{'id':_0x3403f8[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x5af9c6,null))['then'](function(_0x20acbd){if(_0x20acbd){_0x155dbe[_0x613f('0x3c')]=_[_0x613f('0x3e')](db[_0x613f('0x61')][_0x613f('0x38')]);_0x155dbe[_0x613f('0x3d')]=_[_0x613f('0x3e')](_0x3403f8[_0x613f('0x3d')]);_0x155dbe[_0x613f('0x3f')]=_[_0x613f('0x40')](_0x155dbe['model'],_0x155dbe[_0x613f('0x3d')]);_0x28005b[_0x613f('0x42')]=_[_0x613f('0x40')](_0x155dbe[_0x613f('0x3c')],qs[_0x613f('0x41')](_0x3403f8[_0x613f('0x3d')][_0x613f('0x41')]));_0x28005b[_0x613f('0x42')]=_0x28005b[_0x613f('0x42')][_0x613f('0x43')]?_0x28005b[_0x613f('0x42')]:_0x155dbe['model'];if(!_0x3403f8[_0x613f('0x3d')][_0x613f('0x44')](_0x613f('0x45'))){_0x28005b[_0x613f('0x2a')]=qs[_0x613f('0x2a')](_0x3403f8[_0x613f('0x3d')][_0x613f('0x2a')]);_0x28005b[_0x613f('0x29')]=qs[_0x613f('0x29')](_0x3403f8[_0x613f('0x3d')][_0x613f('0x29')]);}_0x28005b[_0x613f('0x46')]=qs['sort'](_0x3403f8[_0x613f('0x3d')][_0x613f('0x47')]);_0x28005b['where']=qs[_0x613f('0x3f')](_['pick'](_0x3403f8[_0x613f('0x3d')],_0x155dbe['filters']));_0x28005b['where'][_0x613f('0x60')]=_0x20acbd['id'];if(_0x3403f8[_0x613f('0x3d')][_0x613f('0x4a')]){_0x28005b[_0x613f('0x48')]=_[_0x613f('0x4c')](_0x28005b[_0x613f('0x48')],{'$or':_[_0x613f('0x37')](_0x28005b['attributes'],function(_0x1f2179){var _0x45cf0a={};_0x45cf0a[_0x1f2179]={'$like':'%'+_0x3403f8[_0x613f('0x3d')][_0x613f('0x4a')]+'%'};return _0x45cf0a;})});}_0x28005b=_[_0x613f('0x4c')]({},_0x28005b,_0x3403f8['options']);return db[_0x613f('0x61')][_0x613f('0x28')]({'where':_0x28005b['where']})[_0x613f('0x1e')](function(_0x8073b2){_0x1bff33[_0x613f('0x28')]=_0x8073b2;if(_0x3403f8['query']['includeAll']){_0x28005b['include']=[{'all':!![]}];}return db[_0x613f('0x61')][_0x613f('0x64')](_0x28005b);})['then'](function(_0x23e150){_0x1bff33[_0x613f('0x65')]=_0x23e150;return _0x1bff33;});}})[_0x613f('0x1e')](respondWithFilteredResult(_0x5af9c6,_0x28005b))['catch'](handleError(_0x5af9c6,null));};exports[_0x613f('0x66')]=function(_0x4c89af,_0x8e4435,_0x537763){return db['WhatsappAccount'][_0x613f('0x52')]({'where':{'id':_0x4c89af[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x8e4435,null))[_0x613f('0x1e')](function(_0x39cb9d){if(_0x39cb9d){return _0x39cb9d[_0x613f('0x66')](_0x4c89af[_0x613f('0x3d')][_0x613f('0x67')]);}})[_0x613f('0x1e')](respondWithStatusCode(_0x8e4435,null))[_0x613f('0x25')](handleError(_0x8e4435,null));};exports[_0x613f('0x68')]=function(_0x50009f,_0x4522ae,_0x159b63){if(_0x50009f[_0x613f('0x54')]['id']){delete _0x50009f[_0x613f('0x54')]['id'];}return db[_0x613f('0x4e')][_0x613f('0x52')]({'where':{'id':_0x50009f[_0x613f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4522ae,null))[_0x613f('0x1e')](function(_0x3136c4){if(_0x3136c4){_0x50009f[_0x613f('0x54')][_0x613f('0x60')]=_0x3136c4['id'];return db['CannedAnswer'][_0x613f('0x53')](_0x50009f[_0x613f('0x54')]);}})[_0x613f('0x1e')](respondWithResult(_0x4522ae,null))[_0x613f('0x25')](handleError(_0x4522ae,null));};exports[_0x613f('0x69')]=function(_0x2fb442,_0x5d3a30,_0x688242){var _0xb7c10f={'raw':![],'where':{}};var _0x4ecf93={};var _0x3fb109={'count':0x0,'rows':[]};return db[_0x613f('0x4e')][_0x613f('0x63')]({'where':{'id':_0x2fb442[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x5d3a30,null))['then'](function(_0x275e85){if(_0x275e85){_0x4ecf93[_0x613f('0x3c')]=_[_0x613f('0x3e')](db[_0x613f('0x6a')][_0x613f('0x38')]);_0x4ecf93[_0x613f('0x3d')]=_['keys'](_0x2fb442['query']);_0x4ecf93[_0x613f('0x3f')]=_[_0x613f('0x40')](_0x4ecf93[_0x613f('0x3c')],_0x4ecf93['query']);_0xb7c10f[_0x613f('0x42')]=_[_0x613f('0x40')](_0x4ecf93[_0x613f('0x3c')],qs[_0x613f('0x41')](_0x2fb442['query'][_0x613f('0x41')]));_0xb7c10f[_0x613f('0x42')]=_0xb7c10f['attributes']['length']?_0xb7c10f['attributes']:_0x4ecf93[_0x613f('0x3c')];if(!_0x2fb442['query'][_0x613f('0x44')](_0x613f('0x45'))){_0xb7c10f[_0x613f('0x2a')]=qs[_0x613f('0x2a')](_0x2fb442['query'][_0x613f('0x2a')]);_0xb7c10f[_0x613f('0x29')]=qs[_0x613f('0x29')](_0x2fb442[_0x613f('0x3d')][_0x613f('0x29')]);}_0xb7c10f[_0x613f('0x46')]=qs[_0x613f('0x47')](_0x2fb442['query'][_0x613f('0x47')]);_0xb7c10f[_0x613f('0x48')]=qs[_0x613f('0x3f')](_['pick'](_0x2fb442[_0x613f('0x3d')],_0x4ecf93[_0x613f('0x3f')]));_0xb7c10f[_0x613f('0x48')]['WhatsappAccountId']=_0x275e85['id'];if(_0x2fb442[_0x613f('0x3d')][_0x613f('0x4a')]){_0xb7c10f[_0x613f('0x48')]=_[_0x613f('0x4c')](_0xb7c10f[_0x613f('0x48')],{'$or':_[_0x613f('0x37')](_0xb7c10f[_0x613f('0x42')],function(_0x74a966){var _0x59c8d0={};_0x59c8d0[_0x74a966]={'$like':'%'+_0x2fb442['query'][_0x613f('0x4a')]+'%'};return _0x59c8d0;})});}_0xb7c10f=_[_0x613f('0x4c')]({},_0xb7c10f,_0x2fb442[_0x613f('0x4d')]);return db[_0x613f('0x6a')][_0x613f('0x28')]({'where':_0xb7c10f['where']})[_0x613f('0x1e')](function(_0x4e560f){_0x3fb109[_0x613f('0x28')]=_0x4e560f;if(_0x2fb442[_0x613f('0x3d')][_0x613f('0x51')]){_0xb7c10f[_0x613f('0x4f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x613f('0x64')](_0xb7c10f);})[_0x613f('0x1e')](function(_0x4cb3d1){_0x3fb109[_0x613f('0x65')]=_0x4cb3d1;return _0x3fb109;});}})['then'](respondWithFilteredResult(_0x5d3a30,_0xb7c10f))[_0x613f('0x25')](handleError(_0x5d3a30,null));};exports[_0x613f('0x6b')]=function(_0x443f07,_0x152435,_0x1a8012){return db['WhatsappAccount'][_0x613f('0x52')]({'where':{'id':_0x443f07[_0x613f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x152435,null))[_0x613f('0x1e')](function(_0x4e3b26){if(_0x4e3b26){return _0x4e3b26[_0x613f('0x6b')](_0x443f07[_0x613f('0x3d')][_0x613f('0x67')]);}})[_0x613f('0x1e')](respondWithStatusCode(_0x152435,null))[_0x613f('0x25')](handleError(_0x152435,null));};exports[_0x613f('0x6c')]=function(_0x3b7ced,_0x5ef935,_0x46430f){return db[_0x613f('0x4e')][_0x613f('0x52')]({'where':{'id':_0x3b7ced[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x5ef935,null))[_0x613f('0x1e')](function(_0x13bcb8){if(_0x13bcb8){return _0x13bcb8[_0x613f('0x6c')](_0x3b7ced[_0x613f('0x54')][_0x613f('0x67')],_['omit'](_0x3b7ced[_0x613f('0x54')],[_0x613f('0x67'),'id'])||{})['spread'](function(_0x238a67){for(var _0x379d3e=0x0;_0x379d3e<_0x3b7ced['body'][_0x613f('0x67')][_0x613f('0x43')];_0x379d3e+=0x1){socket[_0x613f('0x6d')](_0x613f('0x6e'),{'UserId':_0x3b7ced[_0x613f('0x54')][_0x613f('0x67')][_0x379d3e],'WhatsappAccountId':_0x3b7ced[_0x613f('0x5d')]['id']});}return _0x238a67;});}})[_0x613f('0x1e')](respondWithResult(_0x5ef935,null))[_0x613f('0x25')](handleError(_0x5ef935,null));};exports[_0x613f('0x6f')]=function(_0x23799d,_0x149325,_0x2c7de2){return db[_0x613f('0x4e')][_0x613f('0x52')]({'where':{'id':_0x23799d[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x149325,null))[_0x613f('0x1e')](function(_0x3cc1c0){if(_0x3cc1c0){return _0x3cc1c0[_0x613f('0x6f')](_0x23799d['query'][_0x613f('0x67')])['then'](function(){if(_[_0x613f('0x70')](_0x23799d[_0x613f('0x3d')]['ids'])){for(var _0x36cd49=0x0;_0x36cd49<_0x23799d[_0x613f('0x3d')][_0x613f('0x67')][_0x613f('0x43')];_0x36cd49+=0x1){socket[_0x613f('0x6d')](_0x613f('0x71'),{'UserId':Number(_0x23799d['query'][_0x613f('0x67')][_0x36cd49]),'WhatsappAccountId':Number(_0x23799d[_0x613f('0x5d')]['id'])});}}else{socket['emit'](_0x613f('0x71'),{'UserId':Number(_0x23799d[_0x613f('0x3d')][_0x613f('0x67')]),'WhatsappAccountId':Number(_0x23799d[_0x613f('0x5d')]['id'])});}});}})[_0x613f('0x1e')](respondWithStatusCode(_0x149325,null))[_0x613f('0x25')](handleError(_0x149325,null));};exports['getAgents']=function(_0xa5e108,_0x456f89,_0x208282){var _0x2ddb23={};var _0x32b5f6={};var _0x210674;var _0xb04293;return db[_0x613f('0x4e')]['findOne']({'where':{'id':_0xa5e108[_0x613f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x456f89,null))['then'](function(_0x1ea4ba){if(_0x1ea4ba){_0x210674=_0x1ea4ba;_0x32b5f6[_0x613f('0x3c')]=_['keys'](db[_0x613f('0x72')][_0x613f('0x38')]);_0x32b5f6[_0x613f('0x3d')]=_[_0x613f('0x3e')](_0xa5e108[_0x613f('0x3d')]);_0x32b5f6[_0x613f('0x3f')]=_[_0x613f('0x40')](_0x32b5f6[_0x613f('0x3c')],_0x32b5f6[_0x613f('0x3d')]);_0x2ddb23['attributes']=_[_0x613f('0x40')](_0x32b5f6['model'],qs[_0x613f('0x41')](_0xa5e108[_0x613f('0x3d')]['fields']));_0x2ddb23[_0x613f('0x42')]=_0x2ddb23['attributes'][_0x613f('0x43')]?_0x2ddb23[_0x613f('0x42')]:_0x32b5f6[_0x613f('0x3c')];_0x2ddb23['order']=qs[_0x613f('0x47')](_0xa5e108[_0x613f('0x3d')][_0x613f('0x47')]);_0x2ddb23[_0x613f('0x48')]=qs[_0x613f('0x3f')](_[_0x613f('0x49')](_0xa5e108[_0x613f('0x3d')],_0x32b5f6[_0x613f('0x3f')]));if(_0xa5e108[_0x613f('0x3d')]['filter']){_0x2ddb23[_0x613f('0x48')]=_[_0x613f('0x4c')](_0x2ddb23[_0x613f('0x48')],{'$or':_['map'](_0x2ddb23[_0x613f('0x42')],function(_0x22eedd){var _0xcc5140={};_0xcc5140[_0x22eedd]={'$like':'%'+_0xa5e108[_0x613f('0x3d')][_0x613f('0x4a')]+'%'};return _0xcc5140;})});}_0x2ddb23=_[_0x613f('0x4c')]({},_0x2ddb23,_0xa5e108[_0x613f('0x4d')]);return _0x210674[_0x613f('0x73')](_0x2ddb23);}})['then'](function(_0x189b9e){if(_0x189b9e){_0xb04293=_0x189b9e[_0x613f('0x43')];if(!_0xa5e108[_0x613f('0x3d')][_0x613f('0x44')](_0x613f('0x45'))){_0x2ddb23[_0x613f('0x2a')]=qs[_0x613f('0x2a')](_0xa5e108[_0x613f('0x3d')]['limit']);_0x2ddb23['offset']=qs[_0x613f('0x29')](_0xa5e108[_0x613f('0x3d')][_0x613f('0x29')]);}return _0x210674['getAgents'](_0x2ddb23);}})[_0x613f('0x1e')](function(_0x1e13d6){if(_0x1e13d6){return _0x1e13d6?{'count':_0xb04293,'rows':_0x1e13d6}:null;}})[_0x613f('0x1e')](respondWithResult(_0x456f89,null))['catch'](handleError(_0x456f89,null));};exports[_0x613f('0x74')]=function(_0x57d05a,_0x54d104,_0x2b1107){return db[_0x613f('0x4e')]['findOne']({'where':{'id':_0x57d05a[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x54d104,null))['then'](function(_0xe7a09){if(_0xe7a09){return db[_0x613f('0x75')][_0x613f('0x76')](function(_0x2b26f9){return db[_0x613f('0x77')]['destroy']({'where':{'WhatsappAccountId':_0x57d05a['params']['id']},'transaction':_0x2b26f9})[_0x613f('0x1e')](function(_0x4aacc9){var _0x4268c0=_['map'](_0x57d05a[_0x613f('0x54')],function(_0x5f17a9){_0x5f17a9[_0x613f('0x60')]=_0x57d05a['params']['id'];return _0x5f17a9;});return db['WhatsappApplication'][_0x613f('0x78')](_0x4268c0,{'transaction':_0x2b26f9});});})[_0x613f('0x1e')](function(){return db['WhatsappApplication'][_0x613f('0x79')]({'where':{'WhatsappAccountId':_0x57d05a['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x54d104,null))[_0x613f('0x25')](handleError(_0x54d104,null));};exports[_0x613f('0x7a')]=function(_0x3c3527,_0x56d315,_0x1fd7a6){var _0x166040={};var _0x463cdf={};var _0x576665;var _0x107944;return db[_0x613f('0x4e')][_0x613f('0x63')]({'where':{'id':_0x3c3527[_0x613f('0x5d')]['id']}})[_0x613f('0x1e')](handleEntityNotFound(_0x56d315,null))[_0x613f('0x1e')](function(_0x2cdabf){if(_0x2cdabf){_0x576665=_0x2cdabf;_0x463cdf['model']=_[_0x613f('0x3e')](db[_0x613f('0x77')][_0x613f('0x38')]);_0x463cdf['query']=_[_0x613f('0x3e')](_0x3c3527[_0x613f('0x3d')]);_0x463cdf[_0x613f('0x3f')]=_['intersection'](_0x463cdf[_0x613f('0x3c')],_0x463cdf[_0x613f('0x3d')]);_0x166040[_0x613f('0x42')]=_['intersection'](_0x463cdf[_0x613f('0x3c')],qs['fields'](_0x3c3527[_0x613f('0x3d')][_0x613f('0x41')]));_0x166040[_0x613f('0x42')]=_0x166040[_0x613f('0x42')][_0x613f('0x43')]?_0x166040[_0x613f('0x42')]:_0x463cdf[_0x613f('0x3c')];_0x166040['order']=qs['sort'](_0x3c3527['query'][_0x613f('0x47')]);_0x166040[_0x613f('0x48')]=qs[_0x613f('0x3f')](_[_0x613f('0x49')](_0x3c3527['query'],_0x463cdf['filters']));if(_0x3c3527[_0x613f('0x3d')][_0x613f('0x4a')]){_0x166040[_0x613f('0x48')]=_[_0x613f('0x4c')](_0x166040[_0x613f('0x48')],{'$or':_['map'](_0x166040['attributes'],function(_0x2000cf){var _0x3b49ad={};_0x3b49ad[_0x2000cf]={'$like':'%'+_0x3c3527[_0x613f('0x3d')][_0x613f('0x4a')]+'%'};return _0x3b49ad;})});}_0x166040=_[_0x613f('0x4c')]({},_0x166040,_0x3c3527['options']);return _0x576665[_0x613f('0x7a')](_0x166040);}})[_0x613f('0x1e')](function(_0x1bdde0){if(_0x1bdde0){_0x107944=_0x1bdde0[_0x613f('0x43')];if(!_0x3c3527[_0x613f('0x3d')][_0x613f('0x44')](_0x613f('0x45'))){_0x166040[_0x613f('0x2a')]=qs[_0x613f('0x2a')](_0x3c3527[_0x613f('0x3d')][_0x613f('0x2a')]);_0x166040[_0x613f('0x29')]=qs[_0x613f('0x29')](_0x3c3527['query'][_0x613f('0x29')]);}return _0x576665[_0x613f('0x7a')](_0x166040);}})[_0x613f('0x1e')](function(_0x29ae7a){if(_0x29ae7a){return _0x29ae7a?{'count':_0x107944,'rows':_0x29ae7a}:null;}})['then'](respondWithResult(_0x56d315,null))[_0x613f('0x25')](handleError(_0x56d315,null));};exports[_0x613f('0x7b')]=function(_0x48d625,_0x3d82fe,_0x5834d6){var _0x362738={'channel':_0x613f('0x7c')};var _0x4d86ef=[];var _0x4894f5=[];var _0x203117={};return db['WhatsappAccount']['find']({'where':{'id':_0x48d625[_0x613f('0x5d')]['id']},'include':[{'model':db[_0x613f('0x77')],'as':'Applications'}]})[_0x613f('0x1e')](handleEntityNotFound(_0x3d82fe,null))['then'](function(_0x1b84da){_0x362738['account']=_0x1b84da;_0x362738[_0x613f('0x7d')]=_[_0x613f('0x7e')](_0x1b84da[_0x613f('0x7f')],[_0x613f('0x80')],['asc']);if(_0x362738[_0x613f('0x81')][_0x613f('0x7f')]){delete _0x362738[_0x613f('0x81')]['Applications'];}return db['CmContact']['describe']();})[_0x613f('0x1e')](function(_0x5b9ca0){if(!_0x5b9ca0){throw new db[(_0x613f('0x82'))]['ValidationError'](_0x613f('0x83'));}_0x4d86ef=_[_0x613f('0x84')](_[_0x613f('0x3e')](_0x5b9ca0),[_0x613f('0x85'),_0x613f('0x86')]);_0x4894f5=_[_0x613f('0x84')](_['keys'](_0x5b9ca0),[_0x613f('0x85'),_0x613f('0x86'),_0x613f('0x87'),'ListId']);_0x362738[_0x613f('0x54')]={'mapKey':'mobile'};if(_0x362738[_0x613f('0x81')][_0x613f('0x3a')]&&_0x362738[_0x613f('0x81')]['type']===_0x613f('0x88')){_0x362738['body'][_0x613f('0x89')]=_0x48d625['body'][_0x613f('0x8a')][_0x613f('0x8b')](_0x613f('0x8c'),'');_0x362738[_0x613f('0x54')]['body']=_0x48d625[_0x613f('0x54')]['Body'];_0x362738[_0x613f('0x54')][_0x613f('0x8d')]=_0x48d625[_0x613f('0x54')]['MessageSid'];}if(_0x362738[_0x613f('0x54')]['id']){delete _0x362738[_0x613f('0x54')]['id'];}if(_[_0x613f('0x8e')](_0x362738[_0x613f('0x54')][_0x613f('0x89')])){throw new db[(_0x613f('0x82'))][(_0x613f('0x8f'))](_0x613f('0x90'));}if(_[_0x613f('0x8e')](_0x362738[_0x613f('0x54')]['body'])||_0x362738['body'][_0x613f('0x54')]===''){throw new db[(_0x613f('0x82'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x362738[_0x613f('0x54')]['mapKey'])){throw new db['Sequelize'][(_0x613f('0x8f'))](_0x613f('0x91')+_0x4894f5);}if(!_['includes'](_0x4894f5,_0x362738[_0x613f('0x54')][_0x613f('0x92')])){throw new db[(_0x613f('0x82'))]['ValidationError'](_0x613f('0x93')+_0x4894f5);}_0x203117[_0x362738[_0x613f('0x54')][_0x613f('0x92')]]=_0x362738['body']['from'];return db[_0x613f('0x94')][_0x613f('0x52')]({'where':{'id':_0x362738[_0x613f('0x81')][_0x613f('0x95')]},'include':[{'model':db[_0x613f('0x96')],'as':'Contacts','where':_0x203117,'limit':0x1,'order':[[_0x613f('0x86'),_0x613f('0x97')]]}]});})[_0x613f('0x1e')](handleEntityNotFound(_0x3d82fe,null))[_0x613f('0x1e')](function(_0x193cca){if(_0x193cca){_0x362738[_0x613f('0x98')]=_[_0x613f('0x99')](_0x193cca,[_0x613f('0x9a')]);if(_0x193cca[_0x613f('0x9a')][_0x613f('0x43')]){return _0x193cca[_0x613f('0x9a')][0x0];}var _0x256d75=_[_0x613f('0x9b')](_0x362738[_0x613f('0x54')],{'firstName':_0x362738['body']['from'],'ListId':_0x193cca['id']});_0x256d75[_0x362738[_0x613f('0x54')][_0x613f('0x92')]]=_0x362738[_0x613f('0x54')][_0x613f('0x89')];return db[_0x613f('0x96')]['create'](_0x256d75,{'fields':_0x4d86ef,'raw':!![]});}})['then'](handleEntityNotFound(_0x3d82fe,null))[_0x613f('0x1e')](function(_0x27767a){if(_0x27767a){_0x362738[_0x613f('0x9c')]=_0x27767a;var _0x3671b4={'ContactId':_0x27767a['id'],'phone':_0x362738['body'][_0x613f('0x89')],'WhatsappAccountId':_0x48d625[_0x613f('0x5d')]['id']};var _0x3d2da9={'ContactId':_0x27767a['id'],'WhatsappAccountId':_0x48d625['params']['id'],'closed':![]};return db[_0x613f('0x9d')][_0x613f('0x52')]({'where':_0x3d2da9})[_0x613f('0x1e')](function(_0x562d82){if(_0x562d82){return[_0x562d82,![]];}return db[_0x613f('0x9d')][_0x613f('0x53')](_0x3671b4)[_0x613f('0x1e')](function(_0x3179d0){return[_0x3179d0,!![]];});});}})['spread'](function(_0x27dbde,_0x1fd03f){_0x362738[_0x613f('0x9e')]=_0x27dbde['get']({'plain':!![]});_0x362738[_0x613f('0x9e')][_0x613f('0x9f')]=![];if(_0x1fd03f){if(_0x362738['account'][_0x613f('0xa0')]){_0x362738[_0x613f('0x7d')][_0x613f('0xa1')]({'id':0x0,'priority':_0x362738['applications'][_0x613f('0x43')]+0x1,'app':'close','appdata':_0x613f('0xa2'),'interval':_0x613f('0xa3')});}_0x362738['interaction'][_0x613f('0x9f')]=!![];}return db[_0x613f('0xa4')][_0x613f('0x53')]({'phone':_0x362738['body'][_0x613f('0x89')],'messageId':_0x362738[_0x613f('0x54')]['messageId'],'body':_0x362738[_0x613f('0x54')][_0x613f('0x54')],'WhatsappAccountId':_0x48d625[_0x613f('0x5d')]['id'],'WhatsappInteractionId':_0x27dbde['id'],'direction':'in','ContactId':_0x27dbde[_0x613f('0xa5')],'AttachmentId':_0x362738['body']['AttachmentId']});})[_0x613f('0x1e')](function(_0x37c9ae){_0x362738[_0x613f('0x23')]=_0x37c9ae;if(_0x362738['interaction'][_0x613f('0xa6')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x362738['interaction'][_0x613f('0xa6')]}})[_0x613f('0x1e')](function(_0x37a7ca){if(_0x37a7ca){_0x362738[_0x613f('0x7d')][_0x613f('0xa7')]({'id':0x0,'priority':0x0,'app':_0x613f('0xa8'),'appdata':_0x37a7ca[_0x613f('0x33')]+','+(_0x362738['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x613f('0xa9'),_0x362738);});}return respondWithRpcPromise('Start',_0x613f('0xa9'),_0x362738);})[_0x613f('0x1e')](function(_0x1db7ac){if(_0x1db7ac){var _0x189a4a=0xc8;var _0x86a29='receiveMessage';logger[_0x613f('0xaa')](_0x613f('0xab'),_0x86a29,_0x189a4a,_0x613f('0xac'));logger['debug'](_0x613f('0xad'),_0x86a29,_0x189a4a,_0x613f('0xac'),JSON[_0x613f('0x20')](_0x1db7ac));if(_0x362738[_0x613f('0x81')][_0x613f('0x3a')]===_0x613f('0x88')){return _0x3d82fe[_0x613f('0x27')](_0x189a4a)[_0x613f('0x2b')](_0x613f('0xae'),'text/xml')['send'](_0x613f('0xaf'));}else{return _0x3d82fe[_0x613f('0x27')](_0x189a4a)[_0x613f('0x2d')](_0x1db7ac);}}})[_0x613f('0x25')](handleError(_0x3d82fe,null));};exports['send']=function(_0x85548f,_0x19fcc8,_0x234a6f){var _0x5b0b54,_0x38ebf5,_0x70f2a8;if(_['isNil'](_0x85548f[_0x613f('0x54')][_0x613f('0x54')])||_0x85548f[_0x613f('0x54')][_0x613f('0x54')]===''){throw new db[(_0x613f('0x82'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x85548f['body']['to'])){throw new db[(_0x613f('0x82'))][(_0x613f('0x8f'))](_0x613f('0xb0'));}_0x5b0b54=_0x85548f[_0x613f('0x54')]['to'];return db[_0x613f('0x4e')][_0x613f('0x52')]({'where':{'id':_0x85548f[_0x613f('0x5d')]['id']},'include':[{'model':db[_0x613f('0x94')],'as':_0x613f('0xb1'),'include':[{'model':db['CmContact'],'as':_0x613f('0x9a'),'where':{'mobile':_0x5b0b54},'limit':0x1,'order':[[_0x613f('0x86'),_0x613f('0x97')]]}]}]})[_0x613f('0x1e')](handleEntityNotFound(_0x19fcc8,null))[_0x613f('0x1e')](function(_0x3e80e0){if(_0x3e80e0&&_0x3e80e0['List']){_0x38ebf5=_0x3e80e0[_0x613f('0x32')]({'plain':!![]});if(_0x38ebf5['List']&&_0x38ebf5[_0x613f('0xb1')]['Contacts'][_0x613f('0x43')]){return _0x38ebf5[_0x613f('0xb1')][_0x613f('0x9a')][0x0];}return db[_0x613f('0x96')][_0x613f('0x53')](_[_0x613f('0x9b')](_0x85548f['body'],{'firstName':_0x5b0b54,'mobile':_0x5b0b54,'phone':_0x5b0b54,'ListId':_0x38ebf5['ListId']}));}})[_0x613f('0x1e')](handleEntityNotFound(_0x19fcc8,null))[_0x613f('0x1e')](function(_0x48bc0a){if(_0x48bc0a){_0x70f2a8=_0x48bc0a;return db[_0x613f('0x9d')][_0x613f('0x52')]({'where':{'ContactId':_0x70f2a8['id'],'closed':![],'WhatsappAccountId':_0x38ebf5['id']}})[_0x613f('0x1e')](function(_0x5672e2){if(_0x5672e2){return[_0x5672e2,![]];}return db[_0x613f('0x9d')]['create']({'UserId':_0x85548f[_0x613f('0x57')]['id'],'ContactId':_0x70f2a8['id'],'WhatsappAccountId':_0x38ebf5['id'],'phone':_0x5b0b54,'firstMsgDirection':_0x613f('0xb2'),'Messages':[_[_0x613f('0x4c')](_0x85548f[_0x613f('0x54')],{'read':![],'body':_0x85548f['body'][_0x613f('0x54')],'phone':_0x5b0b54,'WhatsappAccountId':_0x38ebf5['id'],'UserId':_0x85548f[_0x613f('0x57')]['id'],'ContactId':_0x70f2a8['id']})]},{'include':[{'model':db[_0x613f('0xa4')],'as':_0x613f('0xb3')}]})[_0x613f('0x1e')](function(_0x141780){return[_0x141780,!![]];});});}})[_0x613f('0xb4')](function(_0x24f8b5,_0x45ef6e){if(_0x45ef6e){return _0x24f8b5;}return db['WhatsappMessage'][_0x613f('0x53')](_[_0x613f('0x4c')](_0x85548f['body'],{'read':![],'body':_0x85548f[_0x613f('0x54')][_0x613f('0x54')],'phone':_0x5b0b54,'WhatsappAccountId':_0x38ebf5['id'],'WhatsappInteractionId':_0x24f8b5['id'],'UserId':_0x85548f[_0x613f('0x57')]['id'],'ContactId':_0x70f2a8['id']}))[_0x613f('0x1e')](function(_0x3094c5){_0x24f8b5[_0x613f('0xb5')][_0x613f('0xb3')]=[];_0x24f8b5['dataValues']['Messages'][_0x613f('0xa1')](_0x3094c5['dataValues']);return _0x24f8b5;});})[_0x613f('0x1e')](respondWithResult(_0x19fcc8,null))[_0x613f('0x25')](handleError(_0x19fcc8,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 207c813..70b263a 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 _0x126e=['emit','hasOwnProperty','hook','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x19e9cd,_0x3a99a6){var _0x2ad964=function(_0x408def){while(--_0x408def){_0x19e9cd['push'](_0x19e9cd['shift']());}};_0x2ad964(++_0x3a99a6);}(_0x126e,0x108));var _0xe126=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x126e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xe126('0x0'))['db'][_0xe126('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe126('0x2')](0x0);var events={'afterCreate':_0xe126('0x3'),'afterUpdate':_0xe126('0x4'),'afterDestroy':_0xe126('0x5')};function emitEvent(_0x5e7f60){return function(_0x3beaef,_0x31c902,_0x8cb81d){WhatsappAccountEvents[_0xe126('0x6')](_0x5e7f60+':'+_0x3beaef['id'],_0x3beaef);WhatsappAccountEvents[_0xe126('0x6')](_0x5e7f60,_0x3beaef);_0x8cb81d(null);};}for(var e in events){if(events[_0xe126('0x7')](e)){var event=events[e];WhatsappAccount[_0xe126('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xaa3f=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1a5946,_0x426991){var _0x25e9d5=function(_0x44e1ce){while(--_0x44e1ce){_0x1a5946['push'](_0x1a5946['shift']());}};_0x25e9d5(++_0x426991);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x3653aa,_0x3b47c0){_0x3653aa=_0x3653aa-0x0;var _0x21b3d2=_0xaa3f[_0x3653aa];return _0x21b3d2;};'use strict';var EventEmitter=require(_0xfaa3('0x0'));var WhatsappAccount=require(_0xfaa3('0x1'))['db'][_0xfaa3('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xfaa3('0x3')](0x0);var events={'afterCreate':_0xfaa3('0x4'),'afterUpdate':_0xfaa3('0x5'),'afterDestroy':_0xfaa3('0x6')};function emitEvent(_0x2b1aaf){return function(_0x32f4e1,_0x5123a3,_0x513eea){WhatsappAccountEvents[_0xfaa3('0x7')](_0x2b1aaf+':'+_0x32f4e1['id'],_0x32f4e1);WhatsappAccountEvents['emit'](_0x2b1aaf,_0x32f4e1);_0x513eea(null);};}for(var e in events){if(events[_0xfaa3('0x8')](e)){var event=events[e];WhatsappAccount[_0xfaa3('0x9')](e,emitEvent(event));}}module[_0xfaa3('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 1997495..4da41cf 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 _0x7592=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7592,0x84));var _0x2759=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x7592[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x2759('0x0'));var util=require(_0x2759('0x1'));var logger=require('../../config/logger')(_0x2759('0x2'));var moment=require(_0x2759('0x3'));var BPromise=require(_0x2759('0x4'));var rp=require(_0x2759('0x5'));var fs=require('fs');var path=require(_0x2759('0x6'));var rimraf=require(_0x2759('0x7'));var config=require(_0x2759('0x8'));var attributes=require(_0x2759('0x9'));module[_0x2759('0xa')]=function(_0x429ff7,_0x4960ef){return _0x429ff7['define'](_0x2759('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc601=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x1b76e6,_0x598520){var _0x333b53=function(_0x106e6a){while(--_0x106e6a){_0x1b76e6['push'](_0x1b76e6['shift']());}};_0x333b53(++_0x598520);}(_0xc601,0x1eb));var _0x1c60=function(_0x393795,_0xef903f){_0x393795=_0x393795-0x0;var _0x3fc226=_0xc601[_0x393795];return _0x3fc226;};'use strict';var _=require(_0x1c60('0x0'));var util=require(_0x1c60('0x1'));var logger=require(_0x1c60('0x2'))('api');var moment=require(_0x1c60('0x3'));var BPromise=require(_0x1c60('0x4'));var rp=require(_0x1c60('0x5'));var fs=require('fs');var path=require(_0x1c60('0x6'));var rimraf=require(_0x1c60('0x7'));var config=require(_0x1c60('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0x1c60('0x9')]=function(_0x492c59,_0x240307){return _0x492c59[_0x1c60('0xa')](_0x1c60('0xb'),attributes,{'tableName':_0x1c60('0xc'),'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 ec80f12..abbc097 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 _0x0f3e=['client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','map','model','include','then','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x212579,_0xdb4d5a){var _0x55d50e=function(_0x38fa1d){while(--_0x38fa1d){_0x212579['push'](_0x212579['shift']());}};_0x55d50e(++_0xdb4d5a);}(_0x0f3e,0x1e6));var _0xe0f3=function(_0x469e05,_0x35a1d5){_0x469e05=_0x469e05-0x0;var _0x582aec=_0x0f3e[_0x469e05];return _0x582aec;};'use strict';var _=require(_0xe0f3('0x0'));var util=require('util');var moment=require(_0xe0f3('0x1'));var BPromise=require(_0xe0f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0f3('0x3'));var db=require(_0xe0f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0f3('0x5'))(_0xe0f3('0x6'));var config=require('../../config/environment');var jayson=require(_0xe0f3('0x7'));var client=jayson[_0xe0f3('0x8')][_0xe0f3('0x9')]({'port':0x232a});config[_0xe0f3('0xa')]=_[_0xe0f3('0xb')](config[_0xe0f3('0xa')],{'host':_0xe0f3('0xc'),'port':0x18eb});var socket=require(_0xe0f3('0xd'))(new Redis(config[_0xe0f3('0xa')]));require(_0xe0f3('0xe'))[_0xe0f3('0xf')](socket);function respondWithRpcPromise(_0x934751,_0xfddf6f,_0x2bf562){return new BPromise(function(_0x33cb49,_0x5a847b){return client[_0xe0f3('0x10')](_0x934751,_0x2bf562)['then'](function(_0x22d3a8){logger[_0xe0f3('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0xfddf6f,_0xe0f3('0x12'));logger[_0xe0f3('0x13')](_0xe0f3('0x14'),_0xfddf6f,_0xe0f3('0x12'),JSON['stringify'](_0x22d3a8));if(_0x22d3a8[_0xe0f3('0x15')]){if(_0x22d3a8['error'][_0xe0f3('0x16')]===0x1f4){logger[_0xe0f3('0x15')](_0xe0f3('0x17'),_0xfddf6f,_0x22d3a8[_0xe0f3('0x15')][_0xe0f3('0x18')]);return _0x5a847b(_0x22d3a8['error'][_0xe0f3('0x18')]);}logger[_0xe0f3('0x15')](_0xe0f3('0x17'),_0xfddf6f,_0x22d3a8[_0xe0f3('0x15')][_0xe0f3('0x18')]);return _0x33cb49(_0x22d3a8[_0xe0f3('0x15')][_0xe0f3('0x18')]);}else{logger[_0xe0f3('0x11')](_0xe0f3('0x17'),_0xfddf6f,_0xe0f3('0x12'));_0x33cb49(_0x22d3a8[_0xe0f3('0x19')][_0xe0f3('0x18')]);}})[_0xe0f3('0x1a')](function(_0x45df4a){logger[_0xe0f3('0x15')](_0xe0f3('0x17'),_0xfddf6f,_0x45df4a);_0x5a847b(_0x45df4a);});});}exports[_0xe0f3('0x1b')]=function(_0x7a877c){var _0x399f8c=this;return new Promise(function(_0x3591b5,_0x51c25d){return db[_0xe0f3('0x1c')]['find']({'raw':_0x7a877c[_0xe0f3('0x1d')]?_0x7a877c[_0xe0f3('0x1d')][_0xe0f3('0x1e')]===undefined?!![]:![]:!![],'where':_0x7a877c['options']?_0x7a877c[_0xe0f3('0x1d')][_0xe0f3('0x1f')]||null:null,'attributes':_0x7a877c['options']?_0x7a877c[_0xe0f3('0x1d')][_0xe0f3('0x20')]||null:null,'include':_0x7a877c['options']?_0x7a877c[_0xe0f3('0x1d')]['include']?_[_0xe0f3('0x21')](_0x7a877c[_0xe0f3('0x1d')]['include'],function(_0x3c81b9){return{'model':db[_0x3c81b9[_0xe0f3('0x22')]],'as':_0x3c81b9['as'],'attributes':_0x3c81b9[_0xe0f3('0x20')],'include':_0x3c81b9[_0xe0f3('0x23')]?_['map'](_0x3c81b9[_0xe0f3('0x23')],function(_0x3a8f93){return{'model':db[_0x3a8f93[_0xe0f3('0x22')]],'as':_0x3a8f93['as'],'attributes':_0x3a8f93[_0xe0f3('0x20')],'include':_0x3a8f93[_0xe0f3('0x23')]?_[_0xe0f3('0x21')](_0x3a8f93[_0xe0f3('0x23')],function(_0x530cf0){return{'model':db[_0x530cf0[_0xe0f3('0x22')]],'as':_0x530cf0['as'],'attributes':_0x530cf0[_0xe0f3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe0f3('0x24')](function(_0x51e1ce){logger[_0xe0f3('0x11')]('ShowWhatsappAccount',_0x7a877c);logger[_0xe0f3('0x13')]('ShowWhatsappAccount',_0x7a877c,JSON[_0xe0f3('0x25')](_0x51e1ce));_0x3591b5(_0x51e1ce);})[_0xe0f3('0x1a')](function(_0x4fda66){logger['error'](_0xe0f3('0x1b'),_0x4fda66[_0xe0f3('0x18')],_0x7a877c);_0x51c25d(_0x399f8c[_0xe0f3('0x15')](0x1f4,_0x4fda66[_0xe0f3('0x18')]));});});}; \ No newline at end of file +var _0x7560=['../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','socket.io-emitter','redis','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappAccount','options','raw','where','attributes','map','include','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f4eb3,_0x52521d){var _0x415361=function(_0x76535e){while(--_0x76535e){_0x1f4eb3['push'](_0x1f4eb3['shift']());}};_0x415361(++_0x52521d);}(_0x7560,0x6e));var _0x0756=function(_0x2e9c6d,_0xbecdb4){_0x2e9c6d=_0x2e9c6d-0x0;var _0x139a4f=_0x7560[_0x2e9c6d];return _0x139a4f;};'use strict';var _=require(_0x0756('0x0'));var util=require(_0x0756('0x1'));var moment=require(_0x0756('0x2'));var BPromise=require(_0x0756('0x3'));var rs=require(_0x0756('0x4'));var fs=require('fs');var Redis=require(_0x0756('0x5'));var db=require(_0x0756('0x6'))['db'];var utils=require(_0x0756('0x7'));var logger=require(_0x0756('0x8'))(_0x0756('0x9'));var config=require('../../config/environment');var jayson=require(_0x0756('0xa'));var client=jayson['client'][_0x0756('0xb')]({'port':0x232a});config['redis']=_[_0x0756('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0756('0xd'))(new Redis(config[_0x0756('0xe')]));require(_0x0756('0xf'))[_0x0756('0x10')](socket);function respondWithRpcPromise(_0x32528a,_0x591ec1,_0x3bdd13){return new BPromise(function(_0x448cab,_0x193911){return client[_0x0756('0x11')](_0x32528a,_0x3bdd13)[_0x0756('0x12')](function(_0x1b86d0){logger[_0x0756('0x13')](_0x0756('0x14'),_0x591ec1,_0x0756('0x15'));logger[_0x0756('0x16')](_0x0756('0x17'),_0x591ec1,_0x0756('0x15'),JSON[_0x0756('0x18')](_0x1b86d0));if(_0x1b86d0[_0x0756('0x19')]){if(_0x1b86d0[_0x0756('0x19')][_0x0756('0x1a')]===0x1f4){logger['error'](_0x0756('0x14'),_0x591ec1,_0x1b86d0[_0x0756('0x19')]['message']);return _0x193911(_0x1b86d0[_0x0756('0x19')]['message']);}logger[_0x0756('0x19')](_0x0756('0x14'),_0x591ec1,_0x1b86d0['error']['message']);return _0x448cab(_0x1b86d0['error'][_0x0756('0x1b')]);}else{logger[_0x0756('0x13')](_0x0756('0x14'),_0x591ec1,_0x0756('0x15'));_0x448cab(_0x1b86d0[_0x0756('0x1c')][_0x0756('0x1b')]);}})[_0x0756('0x1d')](function(_0x6ad10){logger[_0x0756('0x19')](_0x0756('0x14'),_0x591ec1,_0x6ad10);_0x193911(_0x6ad10);});});}exports['ShowWhatsappAccount']=function(_0x4778c1){var _0x327a72=this;return new Promise(function(_0x2f509a,_0x5f491d){return db[_0x0756('0x1e')]['find']({'raw':_0x4778c1[_0x0756('0x1f')]?_0x4778c1[_0x0756('0x1f')][_0x0756('0x20')]===undefined?!![]:![]:!![],'where':_0x4778c1['options']?_0x4778c1[_0x0756('0x1f')][_0x0756('0x21')]||null:null,'attributes':_0x4778c1[_0x0756('0x1f')]?_0x4778c1['options'][_0x0756('0x22')]||null:null,'include':_0x4778c1[_0x0756('0x1f')]?_0x4778c1[_0x0756('0x1f')]['include']?_[_0x0756('0x23')](_0x4778c1['options'][_0x0756('0x24')],function(_0x2f7561){return{'model':db[_0x2f7561['model']],'as':_0x2f7561['as'],'attributes':_0x2f7561[_0x0756('0x22')],'include':_0x2f7561[_0x0756('0x24')]?_[_0x0756('0x23')](_0x2f7561[_0x0756('0x24')],function(_0x4e3408){return{'model':db[_0x4e3408[_0x0756('0x25')]],'as':_0x4e3408['as'],'attributes':_0x4e3408[_0x0756('0x22')],'include':_0x4e3408[_0x0756('0x24')]?_['map'](_0x4e3408[_0x0756('0x24')],function(_0x5a3fc0){return{'model':db[_0x5a3fc0[_0x0756('0x25')]],'as':_0x5a3fc0['as'],'attributes':_0x5a3fc0[_0x0756('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0756('0x12')](function(_0x4cdad5){logger[_0x0756('0x13')](_0x0756('0x26'),_0x4778c1);logger['debug']('ShowWhatsappAccount',_0x4778c1,JSON[_0x0756('0x18')](_0x4cdad5));_0x2f509a(_0x4cdad5);})[_0x0756('0x1d')](function(_0x3c43d7){logger[_0x0756('0x19')](_0x0756('0x26'),_0x3c43d7[_0x0756('0x1b')],_0x4778c1);_0x5f491d(_0x327a72[_0x0756('0x19')](0x1f4,_0x3c43d7['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1b2b6ed..0421f53 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 _0x999f=['save','remove','emit','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x413172,_0x21a4f9){var _0x49377c=function(_0x5e899f){while(--_0x5e899f){_0x413172['push'](_0x413172['shift']());}};_0x49377c(++_0x21a4f9);}(_0x999f,0xcb));var _0xf999=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x999f[_0x26f1b2];return _0x1624a4;};'use strict';var WhatsappAccountEvents=require(_0xf999('0x0'));var events=[_0xf999('0x1'),_0xf999('0x2'),'update'];function createListener(_0x101919,_0xc9d020){return function(_0x1b66c1){_0xc9d020[_0xf999('0x3')](_0x101919,_0x1b66c1);};}function removeListener(_0x56ccce,_0x32f35e){return function(){WhatsappAccountEvents['removeListener'](_0x56ccce,_0x32f35e);};}exports['register']=function(_0x4eaf69){for(var _0x6d24ec=0x0,_0x4e643f=events[_0xf999('0x4')];_0x6d24ec<_0x4e643f;_0x6d24ec++){var _0x63e021=events[_0x6d24ec];var _0x3a34c1=createListener(_0xf999('0x5')+_0x63e021,_0x4eaf69);WhatsappAccountEvents['on'](_0x63e021,_0x3a34c1);}}; \ No newline at end of file +var _0x3dc7=['save','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0x3dc7,0x70));var _0x73dc=function(_0x5ba94d,_0x3aee3a){_0x5ba94d=_0x5ba94d-0x0;var _0x3340b8=_0x3dc7[_0x5ba94d];return _0x3340b8;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x73dc('0x0'),_0x73dc('0x1'),_0x73dc('0x2')];function createListener(_0x20266a,_0x20ea82){return function(_0x3e0f04){_0x20ea82[_0x73dc('0x3')](_0x20266a,_0x3e0f04);};}function removeListener(_0x386450,_0x39720e){return function(){WhatsappAccountEvents[_0x73dc('0x4')](_0x386450,_0x39720e);};}exports[_0x73dc('0x5')]=function(_0x2c42a4){for(var _0x29a787=0x0,_0x5bf89d=events[_0x73dc('0x6')];_0x29a787<_0x5bf89d;_0x29a787++){var _0x15bd2c=events[_0x29a787];var _0x582594=createListener(_0x73dc('0x7')+_0x15bd2c,_0x2c42a4);WhatsappAccountEvents['on'](_0x15bd2c,_0x582594);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 59684ed..c9fc84d 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 _0xd9a6=['./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4390c7,_0x3a97b0){var _0x301fc6=function(_0x46efe0){while(--_0x46efe0){_0x4390c7['push'](_0x4390c7['shift']());}};_0x301fc6(++_0x3a97b0);}(_0xd9a6,0x1f2));var _0x6d9a=function(_0x42bec1,_0x25fc63){_0x42bec1=_0x42bec1-0x0;var _0x415058=_0xd9a6[_0x42bec1];return _0x415058;};'use strict';var multer=require(_0x6d9a('0x0'));var util=require('util');var path=require(_0x6d9a('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d9a('0x2'));var router=express[_0x6d9a('0x3')]();var auth=require(_0x6d9a('0x4'));var interaction=require(_0x6d9a('0x5'));var config=require('../../config/environment');var controller=require(_0x6d9a('0x6'));router[_0x6d9a('0x7')]('/',auth[_0x6d9a('0x8')](),controller[_0x6d9a('0x9')]);router['get'](_0x6d9a('0xa'),auth[_0x6d9a('0x8')](),controller[_0x6d9a('0xb')]);router[_0x6d9a('0xc')]('/',auth[_0x6d9a('0x8')](),controller['create']);router[_0x6d9a('0xd')](_0x6d9a('0xa'),auth['isAuthenticated'](),controller[_0x6d9a('0xe')]);router[_0x6d9a('0xf')](_0x6d9a('0xa'),auth['isAuthenticated'](),controller[_0x6d9a('0x10')]);module[_0x6d9a('0x11')]=router; \ No newline at end of file +var _0x0907=['../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x0907,0x103));var _0x7090=function(_0xdd14b2,_0xb8ed5e){_0xdd14b2=_0xdd14b2-0x0;var _0x35dab6=_0x0907[_0xdd14b2];return _0x35dab6;};'use strict';var multer=require(_0x7090('0x0'));var util=require(_0x7090('0x1'));var path=require(_0x7090('0x2'));var timeout=require(_0x7090('0x3'));var express=require(_0x7090('0x4'));var router=express['Router']();var auth=require(_0x7090('0x5'));var interaction=require(_0x7090('0x6'));var config=require(_0x7090('0x7'));var controller=require(_0x7090('0x8'));router[_0x7090('0x9')]('/',auth[_0x7090('0xa')](),controller[_0x7090('0xb')]);router['get'](_0x7090('0xc'),auth[_0x7090('0xa')](),controller[_0x7090('0xd')]);router[_0x7090('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7090('0xc'),auth[_0x7090('0xa')](),controller[_0x7090('0xf')]);router[_0x7090('0x10')](_0x7090('0xc'),auth['isAuthenticated'](),controller[_0x7090('0x11')]);module[_0x7090('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index c2f302c..f965114 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 _0x9372=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5f288b,_0x479393){var _0x105fac=function(_0x2e5609){while(--_0x2e5609){_0x5f288b['push'](_0x5f288b['shift']());}};_0x105fac(++_0x479393);}(_0x9372,0x175));var _0x2937=function(_0x315dec,_0x23c3e4){_0x315dec=_0x315dec-0x0;var _0x4d452b=_0x9372[_0x315dec];return _0x4d452b;};'use strict';var Sequelize=require(_0x2937('0x0'));module[_0x2937('0x1')]={'priority':{'type':Sequelize[_0x2937('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2937('0x3')],'allowNull':![],'defaultValue':_0x2937('0x4')},'appdata':{'type':Sequelize[_0x2937('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2937('0x6')}}; \ No newline at end of file +var _0x8cb0=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x220d04,_0x2df8a1){var _0x2316fe=function(_0x1f21f6){while(--_0x1f21f6){_0x220d04['push'](_0x220d04['shift']());}};_0x2316fe(++_0x2df8a1);}(_0x8cb0,0x1cb));var _0x08cb=function(_0x572cc7,_0x24129f){_0x572cc7=_0x572cc7-0x0;var _0x1db2fc=_0x8cb0[_0x572cc7];return _0x1db2fc;};'use strict';var Sequelize=require(_0x08cb('0x0'));module[_0x08cb('0x1')]={'priority':{'type':Sequelize[_0x08cb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x08cb('0x3')],'allowNull':![],'defaultValue':_0x08cb('0x4')},'appdata':{'type':Sequelize[_0x08cb('0x5')]()},'description':{'type':Sequelize[_0x08cb('0x3')]},'interval':{'type':Sequelize[_0x08cb('0x3')],'defaultValue':_0x08cb('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 0738b33..bb36818 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 _0xc3fc=['mustache','util','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','sendStatus','status','end','count','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','filter','merge','where','VIRTUAL','options','WhatsappApplication','includeAll','include','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2dd2e8,_0x460f32){var _0x2e95ad=function(_0x371ea3){while(--_0x371ea3){_0x2dd2e8['push'](_0x2dd2e8['shift']());}};_0x2e95ad(++_0x460f32);}(_0xc3fc,0x167));var _0xcc3f=function(_0x1e636a,_0x494535){_0x1e636a=_0x1e636a-0x0;var _0x33cf14=_0xc3fc[_0x1e636a];return _0x33cf14;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc3f('0x0'));var rimraf=require(_0xcc3f('0x1'));var zipdir=require(_0xcc3f('0x2'));var jsonpatch=require(_0xcc3f('0x3'));var rp=require('request-promise');var moment=require(_0xcc3f('0x4'));var BPromise=require(_0xcc3f('0x5'));var Mustache=require(_0xcc3f('0x6'));var util=require(_0xcc3f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcc3f('0x8'));var ejs=require(_0xcc3f('0x9'));var fs=require('fs');var _=require(_0xcc3f('0xa'));var squel=require(_0xcc3f('0xb'));var crypto=require(_0xcc3f('0xc'));var jsforce=require(_0xcc3f('0xd'));var deskjs=require(_0xcc3f('0xe'));var toCsv=require(_0xcc3f('0x8'));var querystring=require(_0xcc3f('0xf'));var Papa=require(_0xcc3f('0x10'));var Redis=require(_0xcc3f('0x11'));var authService=require(_0xcc3f('0x12'));var qs=require(_0xcc3f('0x13'));var as=require(_0xcc3f('0x14'));var hardwareService=require(_0xcc3f('0x15'));var logger=require(_0xcc3f('0x16'))(_0xcc3f('0x17'));var utils=require(_0xcc3f('0x18'));var config=require(_0xcc3f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc93b,_0x3c23be){_0x3c23be=_0x3c23be||0xcc;return function(_0x170bd2){if(_0x170bd2){return _0x3cc93b[_0xcc3f('0x1a')](_0x3c23be);}return _0x3cc93b[_0xcc3f('0x1b')](_0x3c23be)[_0xcc3f('0x1c')]();};}function respondWithResult(_0x3f3f2c,_0x9ca670){_0x9ca670=_0x9ca670||0xc8;return function(_0x107112){if(_0x107112){return _0x3f3f2c['status'](_0x9ca670)['json'](_0x107112);}};}function respondWithFilteredResult(_0x4369c2,_0x28e81c){return function(_0x56bd71){if(_0x56bd71){var _0x22b50d=_0x56bd71[_0xcc3f('0x1d')],_0x1a6bd2=_0x28e81c['offset'],_0x3b1476=_0x28e81c['offset']+_0x28e81c['limit'],_0x5d010e;if(_0x3b1476>=_0x22b50d){_0x3b1476=_0x22b50d;_0x5d010e=0xc8;}else{_0x5d010e=0xce;}_0x4369c2[_0xcc3f('0x1b')](_0x5d010e);return _0x4369c2['set'](_0xcc3f('0x1e'),_0x1a6bd2+'-'+_0x3b1476+'/'+_0x22b50d)[_0xcc3f('0x1f')](_0x56bd71);}return null;};}function patchUpdates(_0x478d2f){return function(_0x563d39){try{jsonpatch[_0xcc3f('0x20')](_0x563d39,_0x478d2f,!![]);}catch(_0xc03f97){return BPromise['reject'](_0xc03f97);}return _0x563d39[_0xcc3f('0x21')]();};}function saveUpdates(_0x32973f,_0x2d8deb){return function(_0x5826c4){if(_0x5826c4){return _0x5826c4[_0xcc3f('0x22')](_0x32973f)[_0xcc3f('0x23')](function(_0x295a98){return _0x295a98;});}return null;};}function removeEntity(_0x33e297,_0x4cdc92){return function(_0x4c16af){if(_0x4c16af){return _0x4c16af[_0xcc3f('0x24')]()['then'](function(){_0x33e297[_0xcc3f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2927bf,_0x2fc1fe){return function(_0xd15b1d){if(!_0xd15b1d){_0x2927bf['sendStatus'](0x194);}return _0xd15b1d;};}function handleError(_0x3e5395,_0x1b90fd){_0x1b90fd=_0x1b90fd||0x1f4;return function(_0x4e8bf0){logger['error'](_0x4e8bf0[_0xcc3f('0x25')]);if(_0x4e8bf0[_0xcc3f('0x26')]){delete _0x4e8bf0[_0xcc3f('0x26')];}_0x3e5395[_0xcc3f('0x1b')](_0x1b90fd)[_0xcc3f('0x27')](_0x4e8bf0);};}exports[_0xcc3f('0x28')]=function(_0x2bcd68,_0x391786){var _0x12c5f2={},_0x33ec63={},_0x566830={'count':0x0,'rows':[]};var _0x2bfd6c=_[_0xcc3f('0x29')](db['WhatsappApplication'][_0xcc3f('0x2a')],function(_0xf7a7ed){return{'name':_0xf7a7ed[_0xcc3f('0x2b')],'type':_0xf7a7ed[_0xcc3f('0x2c')][_0xcc3f('0x2d')]};});_0x33ec63[_0xcc3f('0x2e')]=_[_0xcc3f('0x29')](_0x2bfd6c,_0xcc3f('0x26'));_0x33ec63[_0xcc3f('0x2f')]=_[_0xcc3f('0x30')](_0x2bcd68[_0xcc3f('0x2f')]);_0x33ec63[_0xcc3f('0x31')]=_[_0xcc3f('0x32')](_0x33ec63[_0xcc3f('0x2e')],_0x33ec63['query']);_0x12c5f2[_0xcc3f('0x33')]=_[_0xcc3f('0x32')](_0x33ec63[_0xcc3f('0x2e')],qs[_0xcc3f('0x34')](_0x2bcd68[_0xcc3f('0x2f')][_0xcc3f('0x34')]));_0x12c5f2[_0xcc3f('0x33')]=_0x12c5f2['attributes'][_0xcc3f('0x35')]?_0x12c5f2['attributes']:_0x33ec63['model'];if(!_0x2bcd68[_0xcc3f('0x2f')][_0xcc3f('0x36')](_0xcc3f('0x37'))){_0x12c5f2[_0xcc3f('0x38')]=qs[_0xcc3f('0x38')](_0x2bcd68[_0xcc3f('0x2f')][_0xcc3f('0x38')]);_0x12c5f2[_0xcc3f('0x39')]=qs[_0xcc3f('0x39')](_0x2bcd68['query'][_0xcc3f('0x39')]);}_0x12c5f2[_0xcc3f('0x3a')]=qs[_0xcc3f('0x3b')](_0x2bcd68[_0xcc3f('0x2f')][_0xcc3f('0x3b')]);_0x12c5f2['where']=qs[_0xcc3f('0x31')](_['pick'](_0x2bcd68[_0xcc3f('0x2f')],_0x33ec63['filters']),_0x2bfd6c);if(_0x2bcd68[_0xcc3f('0x2f')][_0xcc3f('0x3c')]){_0x12c5f2['where']=_[_0xcc3f('0x3d')](_0x12c5f2[_0xcc3f('0x3e')],{'$or':_[_0xcc3f('0x29')](_0x2bfd6c,function(_0xdc7495){if(_0xdc7495[_0xcc3f('0x2c')]!==_0xcc3f('0x3f')){var _0x422803={};_0x422803[_0xdc7495[_0xcc3f('0x26')]]={'$like':'%'+_0x2bcd68[_0xcc3f('0x2f')][_0xcc3f('0x3c')]+'%'};return _0x422803;}})});}_0x12c5f2=_[_0xcc3f('0x3d')]({},_0x12c5f2,_0x2bcd68[_0xcc3f('0x40')]);var _0x556468={'where':_0x12c5f2[_0xcc3f('0x3e')]};return db[_0xcc3f('0x41')][_0xcc3f('0x1d')](_0x556468)[_0xcc3f('0x23')](function(_0x192733){_0x566830[_0xcc3f('0x1d')]=_0x192733;if(_0x2bcd68[_0xcc3f('0x2f')][_0xcc3f('0x42')]){_0x12c5f2[_0xcc3f('0x43')]=[{'all':!![]}];}return db[_0xcc3f('0x41')]['findAll'](_0x12c5f2);})['then'](function(_0x548a30){_0x566830['rows']=_0x548a30;return _0x566830;})[_0xcc3f('0x23')](respondWithFilteredResult(_0x391786,_0x12c5f2))['catch'](handleError(_0x391786,null));};exports['show']=function(_0x3cb2d4,_0x5d787d){var _0x1000a0={'raw':!![],'where':{'id':_0x3cb2d4[_0xcc3f('0x44')]['id']}},_0xfc853a={};_0xfc853a[_0xcc3f('0x2e')]=_['keys'](db[_0xcc3f('0x41')]['rawAttributes']);_0xfc853a[_0xcc3f('0x2f')]=_['keys'](_0x3cb2d4[_0xcc3f('0x2f')]);_0xfc853a[_0xcc3f('0x31')]=_[_0xcc3f('0x32')](_0xfc853a[_0xcc3f('0x2e')],_0xfc853a[_0xcc3f('0x2f')]);_0x1000a0['attributes']=_[_0xcc3f('0x32')](_0xfc853a[_0xcc3f('0x2e')],qs['fields'](_0x3cb2d4[_0xcc3f('0x2f')][_0xcc3f('0x34')]));_0x1000a0[_0xcc3f('0x33')]=_0x1000a0[_0xcc3f('0x33')][_0xcc3f('0x35')]?_0x1000a0['attributes']:_0xfc853a[_0xcc3f('0x2e')];if(_0x3cb2d4['query']['includeAll']){_0x1000a0[_0xcc3f('0x43')]=[{'all':!![]}];}_0x1000a0=_[_0xcc3f('0x3d')]({},_0x1000a0,_0x3cb2d4[_0xcc3f('0x40')]);return db['WhatsappApplication'][_0xcc3f('0x45')](_0x1000a0)[_0xcc3f('0x23')](handleEntityNotFound(_0x5d787d,null))[_0xcc3f('0x23')](respondWithResult(_0x5d787d,null))[_0xcc3f('0x46')](handleError(_0x5d787d,null));};exports[_0xcc3f('0x47')]=function(_0x5afcec,_0xedc573){return db[_0xcc3f('0x41')][_0xcc3f('0x47')](_0x5afcec[_0xcc3f('0x48')],{})['then'](respondWithResult(_0xedc573,0xc9))[_0xcc3f('0x46')](handleError(_0xedc573,null));};exports[_0xcc3f('0x22')]=function(_0x376d06,_0x4b1e1b){if(_0x376d06[_0xcc3f('0x48')]['id']){delete _0x376d06[_0xcc3f('0x48')]['id'];}return db[_0xcc3f('0x41')][_0xcc3f('0x45')]({'where':{'id':_0x376d06[_0xcc3f('0x44')]['id']}})[_0xcc3f('0x23')](handleEntityNotFound(_0x4b1e1b,null))['then'](saveUpdates(_0x376d06['body'],null))[_0xcc3f('0x23')](respondWithResult(_0x4b1e1b,null))[_0xcc3f('0x46')](handleError(_0x4b1e1b,null));};exports['destroy']=function(_0x475b7f,_0x25593a){return db[_0xcc3f('0x41')]['find']({'where':{'id':_0x475b7f[_0xcc3f('0x44')]['id']}})[_0xcc3f('0x23')](handleEntityNotFound(_0x25593a,null))[_0xcc3f('0x23')](removeEntity(_0x25593a,null))['catch'](handleError(_0x25593a,null));}; \ No newline at end of file +var _0x2513=['body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','update','then','destroy','error','stack','name','send','map','WhatsappApplication','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','catch','create'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0x2513,0x14b));var _0x3251=function(_0x183cc7,_0x234fec){_0x183cc7=_0x183cc7-0x0;var _0x563f4e=_0x2513[_0x183cc7];return _0x563f4e;};'use strict';var pdf=require(_0x3251('0x0'));var emlformat=require(_0x3251('0x1'));var rimraf=require(_0x3251('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3251('0x3'));var rp=require(_0x3251('0x4'));var moment=require(_0x3251('0x5'));var BPromise=require(_0x3251('0x6'));var Mustache=require(_0x3251('0x7'));var util=require(_0x3251('0x8'));var path=require(_0x3251('0x9'));var sox=require('sox');var csv=require(_0x3251('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3251('0xb'));var squel=require(_0x3251('0xc'));var crypto=require(_0x3251('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3251('0xe'));var toCsv=require(_0x3251('0xa'));var querystring=require(_0x3251('0xf'));var Papa=require('papaparse');var Redis=require(_0x3251('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3251('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3251('0x12'))(_0x3251('0x13'));var utils=require('../../config/utils');var config=require(_0x3251('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x320195,_0x3fff51){_0x3fff51=_0x3fff51||0xcc;return function(_0x3261e7){if(_0x3261e7){return _0x320195[_0x3251('0x15')](_0x3fff51);}return _0x320195[_0x3251('0x16')](_0x3fff51)['end']();};}function respondWithResult(_0x3b4cfc,_0x1d7439){_0x1d7439=_0x1d7439||0xc8;return function(_0x74d6f6){if(_0x74d6f6){return _0x3b4cfc[_0x3251('0x16')](_0x1d7439)[_0x3251('0x17')](_0x74d6f6);}};}function respondWithFilteredResult(_0x5ebdc8,_0x50d5ab){return function(_0x394d62){if(_0x394d62){var _0x45b526=_0x394d62[_0x3251('0x18')],_0x3b0c9c=_0x50d5ab[_0x3251('0x19')],_0x1d75a7=_0x50d5ab[_0x3251('0x19')]+_0x50d5ab[_0x3251('0x1a')],_0x1f1ec1;if(_0x1d75a7>=_0x45b526){_0x1d75a7=_0x45b526;_0x1f1ec1=0xc8;}else{_0x1f1ec1=0xce;}_0x5ebdc8[_0x3251('0x16')](_0x1f1ec1);return _0x5ebdc8[_0x3251('0x1b')]('Content-Range',_0x3b0c9c+'-'+_0x1d75a7+'/'+_0x45b526)['json'](_0x394d62);}return null;};}function patchUpdates(_0x13095e){return function(_0x3ebee0){try{jsonpatch['apply'](_0x3ebee0,_0x13095e,!![]);}catch(_0x1d35f6){return BPromise['reject'](_0x1d35f6);}return _0x3ebee0['save']();};}function saveUpdates(_0xf48f9f,_0x281d0e){return function(_0x5a40db){if(_0x5a40db){return _0x5a40db[_0x3251('0x1c')](_0xf48f9f)[_0x3251('0x1d')](function(_0x1aae8b){return _0x1aae8b;});}return null;};}function removeEntity(_0x4f39e2,_0x4fb513){return function(_0x1c4490){if(_0x1c4490){return _0x1c4490[_0x3251('0x1e')]()[_0x3251('0x1d')](function(){_0x4f39e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f019,_0x1b92c6){return function(_0x5694a3){if(!_0x5694a3){_0x22f019['sendStatus'](0x194);}return _0x5694a3;};}function handleError(_0x50ef81,_0x3bdda6){_0x3bdda6=_0x3bdda6||0x1f4;return function(_0x2433f8){logger[_0x3251('0x1f')](_0x2433f8[_0x3251('0x20')]);if(_0x2433f8[_0x3251('0x21')]){delete _0x2433f8[_0x3251('0x21')];}_0x50ef81[_0x3251('0x16')](_0x3bdda6)[_0x3251('0x22')](_0x2433f8);};}exports['index']=function(_0x359de5,_0x1ad524){var _0x4fcc78={},_0x211877={},_0x58ce08={'count':0x0,'rows':[]};var _0x4c5d33=_[_0x3251('0x23')](db[_0x3251('0x24')]['rawAttributes'],function(_0x53c25a){return{'name':_0x53c25a[_0x3251('0x25')],'type':_0x53c25a[_0x3251('0x26')]['key']};});_0x211877[_0x3251('0x27')]=_[_0x3251('0x23')](_0x4c5d33,_0x3251('0x21'));_0x211877[_0x3251('0x28')]=_[_0x3251('0x29')](_0x359de5[_0x3251('0x28')]);_0x211877['filters']=_[_0x3251('0x2a')](_0x211877[_0x3251('0x27')],_0x211877[_0x3251('0x28')]);_0x4fcc78[_0x3251('0x2b')]=_[_0x3251('0x2a')](_0x211877[_0x3251('0x27')],qs[_0x3251('0x2c')](_0x359de5[_0x3251('0x28')][_0x3251('0x2c')]));_0x4fcc78['attributes']=_0x4fcc78[_0x3251('0x2b')][_0x3251('0x2d')]?_0x4fcc78['attributes']:_0x211877[_0x3251('0x27')];if(!_0x359de5[_0x3251('0x28')][_0x3251('0x2e')](_0x3251('0x2f'))){_0x4fcc78['limit']=qs['limit'](_0x359de5['query'][_0x3251('0x1a')]);_0x4fcc78[_0x3251('0x19')]=qs[_0x3251('0x19')](_0x359de5[_0x3251('0x28')][_0x3251('0x19')]);}_0x4fcc78[_0x3251('0x30')]=qs[_0x3251('0x31')](_0x359de5[_0x3251('0x28')][_0x3251('0x31')]);_0x4fcc78['where']=qs['filters'](_[_0x3251('0x32')](_0x359de5[_0x3251('0x28')],_0x211877[_0x3251('0x33')]),_0x4c5d33);if(_0x359de5[_0x3251('0x28')][_0x3251('0x34')]){_0x4fcc78[_0x3251('0x35')]=_['merge'](_0x4fcc78[_0x3251('0x35')],{'$or':_[_0x3251('0x23')](_0x4c5d33,function(_0xca2572){if(_0xca2572[_0x3251('0x26')]!==_0x3251('0x36')){var _0x1b33ec={};_0x1b33ec[_0xca2572[_0x3251('0x21')]]={'$like':'%'+_0x359de5[_0x3251('0x28')][_0x3251('0x34')]+'%'};return _0x1b33ec;}})});}_0x4fcc78=_[_0x3251('0x37')]({},_0x4fcc78,_0x359de5[_0x3251('0x38')]);var _0x581b27={'where':_0x4fcc78[_0x3251('0x35')]};return db[_0x3251('0x24')][_0x3251('0x18')](_0x581b27)[_0x3251('0x1d')](function(_0x31af9b){_0x58ce08['count']=_0x31af9b;if(_0x359de5[_0x3251('0x28')][_0x3251('0x39')]){_0x4fcc78[_0x3251('0x3a')]=[{'all':!![]}];}return db[_0x3251('0x24')][_0x3251('0x3b')](_0x4fcc78);})[_0x3251('0x1d')](function(_0xc77518){_0x58ce08[_0x3251('0x3c')]=_0xc77518;return _0x58ce08;})[_0x3251('0x1d')](respondWithFilteredResult(_0x1ad524,_0x4fcc78))['catch'](handleError(_0x1ad524,null));};exports['show']=function(_0x51217b,_0x275dcc){var _0x2f9500={'raw':!![],'where':{'id':_0x51217b[_0x3251('0x3d')]['id']}},_0x3ba867={};_0x3ba867[_0x3251('0x27')]=_[_0x3251('0x29')](db[_0x3251('0x24')]['rawAttributes']);_0x3ba867[_0x3251('0x28')]=_[_0x3251('0x29')](_0x51217b[_0x3251('0x28')]);_0x3ba867[_0x3251('0x33')]=_[_0x3251('0x2a')](_0x3ba867[_0x3251('0x27')],_0x3ba867[_0x3251('0x28')]);_0x2f9500[_0x3251('0x2b')]=_[_0x3251('0x2a')](_0x3ba867[_0x3251('0x27')],qs[_0x3251('0x2c')](_0x51217b['query'][_0x3251('0x2c')]));_0x2f9500[_0x3251('0x2b')]=_0x2f9500['attributes'][_0x3251('0x2d')]?_0x2f9500[_0x3251('0x2b')]:_0x3ba867['model'];if(_0x51217b[_0x3251('0x28')][_0x3251('0x39')]){_0x2f9500[_0x3251('0x3a')]=[{'all':!![]}];}_0x2f9500=_[_0x3251('0x37')]({},_0x2f9500,_0x51217b[_0x3251('0x38')]);return db[_0x3251('0x24')][_0x3251('0x3e')](_0x2f9500)['then'](handleEntityNotFound(_0x275dcc,null))['then'](respondWithResult(_0x275dcc,null))[_0x3251('0x3f')](handleError(_0x275dcc,null));};exports[_0x3251('0x40')]=function(_0xb2215a,_0x436583){return db['WhatsappApplication'][_0x3251('0x40')](_0xb2215a[_0x3251('0x41')],{})[_0x3251('0x1d')](respondWithResult(_0x436583,0xc9))[_0x3251('0x3f')](handleError(_0x436583,null));};exports[_0x3251('0x1c')]=function(_0x150e8e,_0x139f5a){if(_0x150e8e['body']['id']){delete _0x150e8e[_0x3251('0x41')]['id'];}return db[_0x3251('0x24')][_0x3251('0x3e')]({'where':{'id':_0x150e8e[_0x3251('0x3d')]['id']}})['then'](handleEntityNotFound(_0x139f5a,null))[_0x3251('0x1d')](saveUpdates(_0x150e8e[_0x3251('0x41')],null))['then'](respondWithResult(_0x139f5a,null))['catch'](handleError(_0x139f5a,null));};exports['destroy']=function(_0x1cca9c,_0x42f852){return db[_0x3251('0x24')][_0x3251('0x3e')]({'where':{'id':_0x1cca9c['params']['id']}})[_0x3251('0x1d')](handleEntityNotFound(_0x42f852,null))['then'](removeEntity(_0x42f852,null))[_0x3251('0x3f')](handleError(_0x42f852,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ec73c70..5b686d0 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 _0x9baf=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappApplication'];(function(_0x35cc5f,_0x2ee9a6){var _0x2bce4f=function(_0x37d9a4){while(--_0x37d9a4){_0x35cc5f['push'](_0x35cc5f['shift']());}};_0x2bce4f(++_0x2ee9a6);}(_0x9baf,0xc6));var _0xf9ba=function(_0x10f121,_0x311af5){_0x10f121=_0x10f121-0x0;var _0xbcfd7a=_0x9baf[_0x10f121];return _0xbcfd7a;};'use strict';var _=require(_0xf9ba('0x0'));var util=require(_0xf9ba('0x1'));var logger=require(_0xf9ba('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9ba('0x3'));var fs=require('fs');var path=require(_0xf9ba('0x4'));var rimraf=require(_0xf9ba('0x5'));var config=require(_0xf9ba('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0xf9ba('0x7')]=function(_0x21f870,_0x4674ff){return _0x21f870[_0xf9ba('0x8')](_0xf9ba('0x9'),attributes,{'tableName':_0xf9ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf9ba('0xb'),'collate':_0xf9ba('0xc')});}; \ No newline at end of file +var _0xe4f4=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path'];(function(_0x5b4a71,_0x485138){var _0x2c0315=function(_0x13984a){while(--_0x13984a){_0x5b4a71['push'](_0x5b4a71['shift']());}};_0x2c0315(++_0x485138);}(_0xe4f4,0x1e5));var _0x4e4f=function(_0x4f25f9,_0x255051){_0x4f25f9=_0x4f25f9-0x0;var _0x92083c=_0xe4f4[_0x4f25f9];return _0x92083c;};'use strict';var _=require(_0x4e4f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e4f('0x1'));var moment=require(_0x4e4f('0x2'));var BPromise=require(_0x4e4f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e4f('0x4'));var rimraf=require(_0x4e4f('0x5'));var config=require(_0x4e4f('0x6'));var attributes=require(_0x4e4f('0x7'));module[_0x4e4f('0x8')]=function(_0xc26d58,_0x325451){return _0xc26d58[_0x4e4f('0x9')](_0x4e4f('0xa'),attributes,{'tableName':_0x4e4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4e4f('0xc'),'collate':_0x4e4f('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 8fe40b2..aa73bb9 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 _0x1696=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result'];(function(_0x32621f,_0x9f05c9){var _0xeb0922=function(_0x277720){while(--_0x277720){_0x32621f['push'](_0x32621f['shift']());}};_0xeb0922(++_0x9f05c9);}(_0x1696,0x79));var _0x6169=function(_0x482e6b,_0x4d0862){_0x482e6b=_0x482e6b-0x0;var _0x316ff5=_0x1696[_0x482e6b];return _0x316ff5;};'use strict';var _=require(_0x6169('0x0'));var util=require('util');var moment=require(_0x6169('0x1'));var BPromise=require(_0x6169('0x2'));var rs=require(_0x6169('0x3'));var fs=require('fs');var Redis=require(_0x6169('0x4'));var db=require(_0x6169('0x5'))['db'];var utils=require(_0x6169('0x6'));var logger=require(_0x6169('0x7'))(_0x6169('0x8'));var config=require(_0x6169('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6169('0xa')][_0x6169('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x277459,_0x6f5cec,_0x289333){return new BPromise(function(_0x2a1658,_0x40350b){return client['request'](_0x277459,_0x289333)[_0x6169('0xc')](function(_0x519a4d){logger[_0x6169('0xd')](_0x6169('0xe'),_0x6f5cec,'request\x20sent');logger[_0x6169('0xf')](_0x6169('0x10'),_0x6f5cec,_0x6169('0x11'),JSON[_0x6169('0x12')](_0x519a4d));if(_0x519a4d['error']){if(_0x519a4d['error'][_0x6169('0x13')]===0x1f4){logger[_0x6169('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x6f5cec,_0x519a4d[_0x6169('0x14')][_0x6169('0x15')]);return _0x40350b(_0x519a4d[_0x6169('0x14')]['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x6f5cec,_0x519a4d[_0x6169('0x14')][_0x6169('0x15')]);return _0x2a1658(_0x519a4d[_0x6169('0x14')][_0x6169('0x15')]);}else{logger[_0x6169('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x6f5cec,_0x6169('0x11'));_0x2a1658(_0x519a4d[_0x6169('0x16')]['message']);}})[_0x6169('0x17')](function(_0x5afc48){logger[_0x6169('0x14')](_0x6169('0xe'),_0x6f5cec,_0x5afc48);_0x40350b(_0x5afc48);});});} \ No newline at end of file +var _0x741c=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','WhatsappApplication,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug'];(function(_0x2da90d,_0xe12696){var _0x14523c=function(_0x1cd8e1){while(--_0x1cd8e1){_0x2da90d['push'](_0x2da90d['shift']());}};_0x14523c(++_0xe12696);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var moment=require(_0xc741('0x2'));var BPromise=require(_0xc741('0x3'));var rs=require(_0xc741('0x4'));var fs=require('fs');var Redis=require(_0xc741('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc741('0x6'))('rpc');var config=require(_0xc741('0x7'));var jayson=require(_0xc741('0x8'));var client=jayson[_0xc741('0x9')][_0xc741('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f3d82,_0x216e60,_0x46b743){return new BPromise(function(_0x598ead,_0x1ad6d9){return client[_0xc741('0xb')](_0x3f3d82,_0x46b743)['then'](function(_0xc6555){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x216e60,_0xc741('0xc'));logger[_0xc741('0xd')](_0xc741('0xe'),_0x216e60,_0xc741('0xc'),JSON[_0xc741('0xf')](_0xc6555));if(_0xc6555[_0xc741('0x10')]){if(_0xc6555[_0xc741('0x10')]['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x216e60,_0xc6555[_0xc741('0x10')][_0xc741('0x11')]);return _0x1ad6d9(_0xc6555[_0xc741('0x10')][_0xc741('0x11')]);}logger[_0xc741('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x216e60,_0xc6555[_0xc741('0x10')][_0xc741('0x11')]);return _0x598ead(_0xc6555['error'][_0xc741('0x11')]);}else{logger[_0xc741('0x12')](_0xc741('0x13'),_0x216e60,_0xc741('0xc'));_0x598ead(_0xc6555[_0xc741('0x14')]['message']);}})['catch'](function(_0x341f54){logger['error'](_0xc741('0x13'),_0x216e60,_0x341f54);_0x1ad6d9(_0x341f54);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 82c173b..2f5ded9 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 _0x226f=['./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x226f,0x190));var _0xf226=function(_0x3dae5b,_0x36cb90){_0x3dae5b=_0x3dae5b-0x0;var _0x505412=_0x226f[_0x3dae5b];return _0x505412;};'use strict';var multer=require(_0xf226('0x0'));var util=require(_0xf226('0x1'));var path=require(_0xf226('0x2'));var timeout=require(_0xf226('0x3'));var express=require(_0xf226('0x4'));var router=express['Router']();var auth=require(_0xf226('0x5'));var interaction=require(_0xf226('0x6'));var config=require(_0xf226('0x7'));var controller=require(_0xf226('0x8'));router[_0xf226('0x9')]('/',auth[_0xf226('0xa')](),controller['index']);router[_0xf226('0x9')](_0xf226('0xb'),auth[_0xf226('0xa')](),controller[_0xf226('0xc')]);router[_0xf226('0x9')](_0xf226('0xd'),auth[_0xf226('0xa')](),controller[_0xf226('0xe')]);router[_0xf226('0x9')](_0xf226('0xf'),auth[_0xf226('0xa')](),controller[_0xf226('0x10')]);router[_0xf226('0x9')](_0xf226('0x11'),auth[_0xf226('0xa')](),controller[_0xf226('0x12')]);router['post']('/',auth[_0xf226('0xa')](),controller[_0xf226('0x13')]);router[_0xf226('0x14')]('/:id/messages',auth[_0xf226('0xa')](),controller[_0xf226('0x15')]);router[_0xf226('0x14')](_0xf226('0x16'),auth[_0xf226('0xa')](),interaction[_0xf226('0x17')](_0xf226('0x18'),_0xf226('0x19')),controller[_0xf226('0x1a')]);router[_0xf226('0x1b')](_0xf226('0xd'),auth[_0xf226('0xa')](),interaction[_0xf226('0x17')](_0xf226('0x18'),_0xf226('0x1c')),controller[_0xf226('0x1d')]);router[_0xf226('0x1e')](_0xf226('0xd'),auth['isAuthenticated'](),interaction[_0xf226('0x17')](_0xf226('0x18'),_0xf226('0x1f')),controller[_0xf226('0x20')]);router['delete']('/:id/tags',auth[_0xf226('0xa')](),controller['removeTags']);module[_0xf226('0x21')]=router; \ No newline at end of file +var _0x9f5d=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','put','tracked','whatsapp','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2217a1,_0x441db1){var _0x49e5fe=function(_0x2d664c){while(--_0x2d664c){_0x2217a1['push'](_0x2217a1['shift']());}};_0x49e5fe(++_0x441db1);}(_0x9f5d,0x1a7));var _0xd9f5=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x9f5d[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0xd9f5('0x0'));var util=require('util');var path=require(_0xd9f5('0x1'));var timeout=require(_0xd9f5('0x2'));var express=require(_0xd9f5('0x3'));var router=express[_0xd9f5('0x4')]();var auth=require(_0xd9f5('0x5'));var interaction=require(_0xd9f5('0x6'));var config=require(_0xd9f5('0x7'));var controller=require(_0xd9f5('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd9f5('0x9')]);router[_0xd9f5('0xa')](_0xd9f5('0xb'),auth[_0xd9f5('0xc')](),controller[_0xd9f5('0xd')]);router[_0xd9f5('0xa')](_0xd9f5('0xe'),auth[_0xd9f5('0xc')](),controller[_0xd9f5('0xf')]);router['get'](_0xd9f5('0x10'),auth[_0xd9f5('0xc')](),controller[_0xd9f5('0x11')]);router[_0xd9f5('0xa')](_0xd9f5('0x12'),auth[_0xd9f5('0xc')](),controller[_0xd9f5('0x13')]);router[_0xd9f5('0x14')]('/',auth[_0xd9f5('0xc')](),controller[_0xd9f5('0x15')]);router['post'](_0xd9f5('0x10'),auth[_0xd9f5('0xc')](),controller[_0xd9f5('0x16')]);router[_0xd9f5('0x14')](_0xd9f5('0x17'),auth['isAuthenticated'](),interaction['tracked']('whatsapp','whatsappinteraction:addtags'),controller['addTags']);router[_0xd9f5('0x18')](_0xd9f5('0xe'),auth['isAuthenticated'](),interaction[_0xd9f5('0x19')](_0xd9f5('0x1a'),'whatsappinteraction:update'),controller[_0xd9f5('0x1b')]);router[_0xd9f5('0x1c')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xd9f5('0x1a'),_0xd9f5('0x1d')),controller[_0xd9f5('0x1e')]);router[_0xd9f5('0x1c')](_0xd9f5('0x17'),auth['isAuthenticated'](),controller[_0xd9f5('0x1f')]);module[_0xd9f5('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1156192..765579e 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 _0x3f09=['DATE','STRING','ENUM','out'];(function(_0x49ecac,_0x418885){var _0x25f7e9=function(_0x267e2){while(--_0x267e2){_0x49ecac['push'](_0x49ecac['shift']());}};_0x25f7e9(++_0x418885);}(_0x3f09,0x78));var _0x93f0=function(_0x15d3f4,_0x450f86){_0x15d3f4=_0x15d3f4-0x0;var _0x5ce800=_0x3f09[_0x15d3f4];return _0x5ce800;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x93f0('0x0')]},'disposition':{'type':Sequelize[_0x93f0('0x1')]},'note':{'type':Sequelize[_0x93f0('0x1')]},'phone':{'type':Sequelize[_0x93f0('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x93f0('0x2')]('in',_0x93f0('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x93f0('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x93f0('0x2')]('in',_0x93f0('0x3')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2b08=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x161427,_0x3a6d8a){var _0x3cf181=function(_0x3a1558){while(--_0x3a1558){_0x161427['push'](_0x161427['shift']());}};_0x3cf181(++_0x3a6d8a);}(_0x2b08,0x1e3));var _0x82b0=function(_0x2f21a1,_0x5372ed){_0x2f21a1=_0x2f21a1-0x0;var _0x220dfe=_0x2b08[_0x2f21a1];return _0x220dfe;};'use strict';var Sequelize=require(_0x82b0('0x0'));var moment=require(_0x82b0('0x1'));module['exports']={'closed':{'type':Sequelize[_0x82b0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x82b0('0x3')]},'disposition':{'type':Sequelize[_0x82b0('0x4')]},'note':{'type':Sequelize[_0x82b0('0x4')]},'phone':{'type':Sequelize[_0x82b0('0x4')]},'read1stAt':{'type':Sequelize[_0x82b0('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x82b0('0x5')]('in',_0x82b0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x82b0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x82b0('0x5')]('in',_0x82b0('0x6')),'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 32ccd83..c2674a0 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 _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','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','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0xca1d7a,_0x40eb7b){var _0x19e1f9=function(_0x4cb4cc){while(--_0x4cb4cc){_0xca1d7a['push'](_0xca1d7a['shift']());}};_0x19e1f9(++_0x40eb7b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file +var _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','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','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x4fee13,_0x1056cd){var _0x2dd75d=function(_0xc58c20){while(--_0xc58c20){_0x4fee13['push'](_0x4fee13['shift']());}};_0x2dd75d(++_0x1056cd);}(_0xadb5,0xad));var _0x5adb=function(_0x18d80c,_0x5dd957){_0x18d80c=_0x18d80c-0x0;var _0x5e43d0=_0xadb5[_0x18d80c];return _0x5e43d0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 88a9d44..503f4be 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 _0x72c9=['hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4ee17e,_0x4c73b3){var _0x5e2d44=function(_0x51347e){while(--_0x51347e){_0x4ee17e['push'](_0x4ee17e['shift']());}};_0x5e2d44(++_0x4c73b3);}(_0x72c9,0x1ab));var _0x972c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x72c9[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x972c('0x0'))['db'][_0x972c('0x1')];var WhatsappMessage=require(_0x972c('0x0'))['db'][_0x972c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x972c('0x3'),'afterDestroy':_0x972c('0x4')};function emitEvent(_0x3e8959){return function(_0x43c9bf,_0x89acc1,_0x11c20e){_0x43c9bf[_0x972c('0x5')]({'attributes':['id'],'raw':!![]})[_0x972c('0x6')](function(_0x28a406){_0x43c9bf[_0x972c('0x7')](_0x972c('0x8'),_0x28a406['map'](function(_0x3bad7b){return{'id':_0x3bad7b['id']};}));return WhatsappMessage[_0x972c('0x9')]({'where':{'WhatsappInteractionId':_0x43c9bf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x972c('0x6')](function(_0x5666f1){_0x43c9bf[_0x972c('0x7')](_0x972c('0xa'),_0x5666f1[_0x972c('0xb')]);WhatsappInteractionEvents[_0x972c('0xc')](_0x3e8959+':'+_0x43c9bf['id'],_0x43c9bf);WhatsappInteractionEvents[_0x972c('0xc')](_0x3e8959,_0x43c9bf);_0x11c20e(null);})[_0x972c('0xd')](_0x11c20e(null));};}for(var e in events){if(events[_0x972c('0xe')](e)){var event=events[e];WhatsappInteraction[_0x972c('0xf')](e,emitEvent(event));}}module[_0x972c('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x47cb=['findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','getUsers','Users','map'];(function(_0xfd3893,_0x3280b0){var _0x4bda97=function(_0x1a86f7){while(--_0x1a86f7){_0xfd3893['push'](_0xfd3893['shift']());}};_0x4bda97(++_0x3280b0);}(_0x47cb,0x196));var _0xb47c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47cb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb47c('0x0'));var WhatsappInteraction=require(_0xb47c('0x1'))['db'][_0xb47c('0x2')];var WhatsappMessage=require(_0xb47c('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb47c('0x3')](0x0);var events={'afterCreate':_0xb47c('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d229c){return function(_0x366759,_0x164795,_0x7d4932){_0x366759[_0xb47c('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0xbae40d){_0x366759['setDataValue'](_0xb47c('0x6'),_0xbae40d[_0xb47c('0x7')](function(_0x33b7bf){return{'id':_0x33b7bf['id']};}));return WhatsappMessage[_0xb47c('0x8')]({'where':{'WhatsappInteractionId':_0x366759['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb47c('0x9')](function(_0x2c8573){_0x366759[_0xb47c('0xa')](_0xb47c('0xb'),_0x2c8573[_0xb47c('0xc')]);WhatsappInteractionEvents['emit'](_0x2d229c+':'+_0x366759['id'],_0x366759);WhatsappInteractionEvents[_0xb47c('0xd')](_0x2d229c,_0x366759);_0x7d4932(null);})[_0xb47c('0xe')](_0x7d4932(null));};}for(var e in events){if(events[_0xb47c('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb47c('0x10')](e,emitEvent(event));}}module[_0xb47c('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index fd0c70f..57ca2b6 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 _0xaf38=['bluebird','request-promise','path','rimraf','exports','define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x3389ec,_0x48fd9d){var _0x1866e0=function(_0x5b70b5){while(--_0x5b70b5){_0x3389ec['push'](_0x3389ec['shift']());}};_0x1866e0(++_0x48fd9d);}(_0xaf38,0x74));var _0x8af3=function(_0x2af7f4,_0x1605a){_0x2af7f4=_0x2af7f4-0x0;var _0xfcced=_0xaf38[_0x2af7f4];return _0xfcced;};'use strict';var _=require(_0x8af3('0x0'));var util=require(_0x8af3('0x1'));var logger=require(_0x8af3('0x2'))(_0x8af3('0x3'));var moment=require('moment');var BPromise=require(_0x8af3('0x4'));var rp=require(_0x8af3('0x5'));var fs=require('fs');var path=require(_0x8af3('0x6'));var rimraf=require(_0x8af3('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x8af3('0x8')]=function(_0x5763dd,_0x208218){return _0x5763dd[_0x8af3('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x8af3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x205880,_0x569d10,_0x56ce2e){if(_0x205880[_0x8af3('0xb')]('closed')){_0x205880[_0x8af3('0xc')]=moment()[_0x8af3('0xd')](_0x8af3('0xe'));}_0x56ce2e(null,_0x205880);}}});}; \ No newline at end of file +var _0xe903=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./whatsappInteraction.attributes','changed'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xe903,0x18f));var _0x3e90=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xe903[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x3e90('0x0'));var util=require(_0x3e90('0x1'));var logger=require(_0x3e90('0x2'))('api');var moment=require(_0x3e90('0x3'));var BPromise=require(_0x3e90('0x4'));var rp=require(_0x3e90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e90('0x6'));var config=require('../../config/environment');var attributes=require(_0x3e90('0x7'));module['exports']=function(_0x33b3a1,_0x174931){return _0x33b3a1['define']('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a329d,_0xba426d,_0x516864){if(_0x2a329d[_0x3e90('0x8')]('closed')){_0x2a329d[_0x3e90('0x9')]=moment()[_0x3e90('0xa')](_0x3e90('0xb'));}_0x516864(null,_0x2a329d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 8828f21..4ae2fd4 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 _0xd2f2=['redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappInteraction','body','options','raw','limit','then','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0xd2f2,0x1c3));var _0x2d2f=function(_0x450b0e,_0x3187fb){_0x450b0e=_0x450b0e-0x0;var _0x5fcb96=_0xd2f2[_0x450b0e];return _0x5fcb96;};'use strict';var _=require(_0x2d2f('0x0'));var util=require(_0x2d2f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2d2f('0x2'));var fs=require('fs');var Redis=require(_0x2d2f('0x3'));var db=require(_0x2d2f('0x4'))['db'];var utils=require(_0x2d2f('0x5'));var logger=require(_0x2d2f('0x6'))(_0x2d2f('0x7'));var config=require(_0x2d2f('0x8'));var jayson=require(_0x2d2f('0x9'));var client=jayson['client'][_0x2d2f('0xa')]({'port':0x232a});config[_0x2d2f('0xb')]=_[_0x2d2f('0xc')](config['redis'],{'host':_0x2d2f('0xd'),'port':0x18eb});var socket=require(_0x2d2f('0xe'))(new Redis(config[_0x2d2f('0xb')]));require(_0x2d2f('0xf'))[_0x2d2f('0x10')](socket);function respondWithRpcPromise(_0xbdb24b,_0x614f6c,_0x100ac4){return new BPromise(function(_0x3b67f1,_0xef9faa){return client[_0x2d2f('0x11')](_0xbdb24b,_0x100ac4)['then'](function(_0x2f1343){logger[_0x2d2f('0x12')](_0x2d2f('0x13'),_0x614f6c,_0x2d2f('0x14'));logger['debug'](_0x2d2f('0x15'),_0x614f6c,_0x2d2f('0x14'),JSON['stringify'](_0x2f1343));if(_0x2f1343[_0x2d2f('0x16')]){if(_0x2f1343['error'][_0x2d2f('0x17')]===0x1f4){logger['error'](_0x2d2f('0x13'),_0x614f6c,_0x2f1343[_0x2d2f('0x16')][_0x2d2f('0x18')]);return _0xef9faa(_0x2f1343['error'][_0x2d2f('0x18')]);}logger[_0x2d2f('0x16')](_0x2d2f('0x13'),_0x614f6c,_0x2f1343[_0x2d2f('0x16')]['message']);return _0x3b67f1(_0x2f1343[_0x2d2f('0x16')][_0x2d2f('0x18')]);}else{logger[_0x2d2f('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x614f6c,_0x2d2f('0x14'));_0x3b67f1(_0x2f1343[_0x2d2f('0x19')][_0x2d2f('0x18')]);}})[_0x2d2f('0x1a')](function(_0x12b1d1){logger[_0x2d2f('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x614f6c,_0x12b1d1);_0xef9faa(_0x12b1d1);});});}exports['UpdateWhatsappInteraction']=function(_0x33633f){var _0x4eb85b=this;return new Promise(function(_0x31fff9,_0x4d4801){return db[_0x2d2f('0x1b')]['update'](_0x33633f[_0x2d2f('0x1c')],{'raw':_0x33633f[_0x2d2f('0x1d')]?_0x33633f['options'][_0x2d2f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33633f[_0x2d2f('0x1d')]?_0x33633f[_0x2d2f('0x1d')]['where']||null:null,'attributes':_0x33633f[_0x2d2f('0x1d')]?_0x33633f[_0x2d2f('0x1d')]['attributes']||null:null,'limit':_0x33633f[_0x2d2f('0x1d')]?_0x33633f[_0x2d2f('0x1d')][_0x2d2f('0x1f')]||null:null})[_0x2d2f('0x20')](function(_0x11b17d){logger['info'](_0x2d2f('0x21'),_0x33633f);logger[_0x2d2f('0x22')](_0x2d2f('0x21'),_0x33633f,JSON['stringify'](_0x11b17d));_0x31fff9(_0x11b17d);})['catch'](function(_0x35b1eb){logger[_0x2d2f('0x16')](_0x2d2f('0x21'),_0x35b1eb[_0x2d2f('0x18')],_0x33633f);_0x4d4801(_0x4eb85b['error'](0x1f4,_0x35b1eb[_0x2d2f('0x18')]));});});};exports[_0x2d2f('0x23')]=function(_0x28f9a0){return new Promise(function(_0x142a19,_0x250007){return db[_0x2d2f('0x1b')][_0x2d2f('0x24')]({'where':_0x28f9a0['options']?_0x28f9a0[_0x2d2f('0x1d')]['where']||null:null})['then'](function(_0x10f7c4){if(_0x10f7c4){return _0x10f7c4[_0x2d2f('0x25')](_0x28f9a0[_0x2d2f('0x1c')][_0x2d2f('0x26')],_[_0x2d2f('0x27')](_0x28f9a0['body'],[_0x2d2f('0x26'),'id'])||{});}})['spread'](function(_0x1021fe){logger[_0x2d2f('0x12')](_0x2d2f('0x28'),_0x28f9a0);logger[_0x2d2f('0x22')](_0x2d2f('0x28'),_0x28f9a0,JSON[_0x2d2f('0x29')](_0x1021fe));_0x142a19(_0x1021fe);})[_0x2d2f('0x1a')](function(_0x5424db){logger[_0x2d2f('0x16')](_0x2d2f('0x28'),_0x5424db[_0x2d2f('0x18')],_0x28f9a0);_0x250007(_this[_0x2d2f('0x16')](0x1f4,_0x5424db[_0x2d2f('0x18')]));});});}; \ No newline at end of file +var _0x617b=['error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x617b,0xe6));var _0xb617=function(_0x2462b8,_0x15367d){_0x2462b8=_0x2462b8-0x0;var _0x1b41f4=_0x617b[_0x2462b8];return _0x1b41f4;};'use strict';var _=require(_0xb617('0x0'));var util=require('util');var moment=require(_0xb617('0x1'));var BPromise=require(_0xb617('0x2'));var rs=require(_0xb617('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb617('0x4'))['db'];var utils=require(_0xb617('0x5'));var logger=require(_0xb617('0x6'))(_0xb617('0x7'));var config=require(_0xb617('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb617('0x9')]({'port':0x232a});config[_0xb617('0xa')]=_[_0xb617('0xb')](config[_0xb617('0xa')],{'host':_0xb617('0xc'),'port':0x18eb});var socket=require(_0xb617('0xd'))(new Redis(config[_0xb617('0xa')]));require('./whatsappInteraction.socket')[_0xb617('0xe')](socket);function respondWithRpcPromise(_0x4a3d41,_0xcca531,_0x5afab8){return new BPromise(function(_0x8f1689,_0x227a7f){return client[_0xb617('0xf')](_0x4a3d41,_0x5afab8)[_0xb617('0x10')](function(_0x32b04e){logger[_0xb617('0x11')](_0xb617('0x12'),_0xcca531,_0xb617('0x13'));logger[_0xb617('0x14')](_0xb617('0x15'),_0xcca531,_0xb617('0x13'),JSON['stringify'](_0x32b04e));if(_0x32b04e[_0xb617('0x16')]){if(_0x32b04e[_0xb617('0x16')][_0xb617('0x17')]===0x1f4){logger['error'](_0xb617('0x12'),_0xcca531,_0x32b04e[_0xb617('0x16')]['message']);return _0x227a7f(_0x32b04e['error'][_0xb617('0x18')]);}logger['error'](_0xb617('0x12'),_0xcca531,_0x32b04e[_0xb617('0x16')][_0xb617('0x18')]);return _0x8f1689(_0x32b04e[_0xb617('0x16')][_0xb617('0x18')]);}else{logger['info'](_0xb617('0x12'),_0xcca531,_0xb617('0x13'));_0x8f1689(_0x32b04e[_0xb617('0x19')][_0xb617('0x18')]);}})[_0xb617('0x1a')](function(_0x2e423d){logger[_0xb617('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0xcca531,_0x2e423d);_0x227a7f(_0x2e423d);});});}exports[_0xb617('0x1b')]=function(_0x16aeab){var _0x1e244c=this;return new Promise(function(_0xea836c,_0xc3aabf){return db[_0xb617('0x1c')]['update'](_0x16aeab[_0xb617('0x1d')],{'raw':_0x16aeab[_0xb617('0x1e')]?_0x16aeab[_0xb617('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16aeab[_0xb617('0x1e')]?_0x16aeab[_0xb617('0x1e')][_0xb617('0x1f')]||null:null,'attributes':_0x16aeab['options']?_0x16aeab[_0xb617('0x1e')][_0xb617('0x20')]||null:null,'limit':_0x16aeab[_0xb617('0x1e')]?_0x16aeab['options'][_0xb617('0x21')]||null:null})[_0xb617('0x10')](function(_0x1aab76){logger[_0xb617('0x11')](_0xb617('0x1b'),_0x16aeab);logger[_0xb617('0x14')]('UpdateWhatsappInteraction',_0x16aeab,JSON[_0xb617('0x22')](_0x1aab76));_0xea836c(_0x1aab76);})[_0xb617('0x1a')](function(_0x1aa7d6){logger[_0xb617('0x16')](_0xb617('0x1b'),_0x1aa7d6[_0xb617('0x18')],_0x16aeab);_0xc3aabf(_0x1e244c[_0xb617('0x16')](0x1f4,_0x1aa7d6[_0xb617('0x18')]));});});};exports[_0xb617('0x23')]=function(_0x191da4){return new Promise(function(_0x27b91e,_0x136c56){return db[_0xb617('0x1c')][_0xb617('0x24')]({'where':_0x191da4[_0xb617('0x1e')]?_0x191da4['options'][_0xb617('0x1f')]||null:null})[_0xb617('0x10')](function(_0x45e5f8){if(_0x45e5f8){return _0x45e5f8[_0xb617('0x25')](_0x191da4[_0xb617('0x1d')]['ids'],_[_0xb617('0x26')](_0x191da4['body'],[_0xb617('0x27'),'id'])||{});}})[_0xb617('0x28')](function(_0x14194e){logger[_0xb617('0x11')](_0xb617('0x29'),_0x191da4);logger['debug'](_0xb617('0x29'),_0x191da4,JSON[_0xb617('0x22')](_0x14194e));_0x27b91e(_0x14194e);})[_0xb617('0x1a')](function(_0x175519){logger[_0xb617('0x16')]('AddTags',_0x175519['message'],_0x191da4);_0x136c56(_this[_0xb617('0x16')](0x1f4,_0x175519['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 985b20d..8c4ed0d 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 _0x6183=['emit','register','length','./whatsappInteraction.events','save','remove','update'];(function(_0x3779eb,_0xc19002){var _0x50423a=function(_0x16e841){while(--_0x16e841){_0x3779eb['push'](_0x3779eb['shift']());}};_0x50423a(++_0xc19002);}(_0x6183,0x199));var _0x3618=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x6183[_0x487496];return _0x539dc8;};'use strict';var WhatsappInteractionEvents=require(_0x3618('0x0'));var events=[_0x3618('0x1'),_0x3618('0x2'),_0x3618('0x3')];function createListener(_0x3e399d,_0x437b58){return function(_0x2095d8){_0x437b58[_0x3618('0x4')](_0x3e399d,_0x2095d8);};}function removeListener(_0x47f3f7,_0xd4bb15){return function(){WhatsappInteractionEvents['removeListener'](_0x47f3f7,_0xd4bb15);};}exports[_0x3618('0x5')]=function(_0xbce3b8){for(var _0xeb7515=0x0,_0x33bb5e=events[_0x3618('0x6')];_0xeb7515<_0x33bb5e;_0xeb7515++){var _0x2ed58f=events[_0xeb7515];var _0x348f34=createListener('whatsappInteraction:'+_0x2ed58f,_0xbce3b8);WhatsappInteractionEvents['on'](_0x2ed58f,_0x348f34);}}; \ No newline at end of file +var _0x0f64=['length','whatsappInteraction:','./whatsappInteraction.events','save','update','removeListener','register'];(function(_0x3f77cc,_0x107623){var _0x104e89=function(_0x162eb9){while(--_0x162eb9){_0x3f77cc['push'](_0x3f77cc['shift']());}};_0x104e89(++_0x107623);}(_0x0f64,0x17c));var _0x40f6=function(_0x5ef9ea,_0x217535){_0x5ef9ea=_0x5ef9ea-0x0;var _0x1d1f90=_0x0f64[_0x5ef9ea];return _0x1d1f90;};'use strict';var WhatsappInteractionEvents=require(_0x40f6('0x0'));var events=[_0x40f6('0x1'),'remove',_0x40f6('0x2')];function createListener(_0x15e955,_0x3d9825){return function(_0x399b4e){_0x3d9825['emit'](_0x15e955,_0x399b4e);};}function removeListener(_0x1ad828,_0x515fd2){return function(){WhatsappInteractionEvents[_0x40f6('0x3')](_0x1ad828,_0x515fd2);};}exports[_0x40f6('0x4')]=function(_0x2075d3){for(var _0x1aa88c=0x0,_0x25187c=events[_0x40f6('0x5')];_0x1aa88c<_0x25187c;_0x1aa88c++){var _0x51677a=events[_0x1aa88c];var _0xf12ad6=createListener(_0x40f6('0x6')+_0x51677a,_0x2075d3);WhatsappInteractionEvents['on'](_0x51677a,_0xf12ad6);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f6e1fb7..0e3434b 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 _0x4e86=['/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','/describe','describe','get','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put'];(function(_0x1ba2e5,_0xbcc3fb){var _0x2b8957=function(_0x2a2427){while(--_0x2a2427){_0x1ba2e5['push'](_0x1ba2e5['shift']());}};_0x2b8957(++_0xbcc3fb);}(_0x4e86,0x157));var _0x64e8=function(_0x4f296d,_0xcc73f3){_0x4f296d=_0x4f296d-0x0;var _0x44d5a1=_0x4e86[_0x4f296d];return _0x44d5a1;};'use strict';var multer=require(_0x64e8('0x0'));var util=require(_0x64e8('0x1'));var path=require(_0x64e8('0x2'));var timeout=require(_0x64e8('0x3'));var express=require('express');var router=express[_0x64e8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x64e8('0x5'));var config=require(_0x64e8('0x6'));var controller=require(_0x64e8('0x7'));router['get']('/',auth[_0x64e8('0x8')](),controller['index']);router['get'](_0x64e8('0x9'),auth[_0x64e8('0x8')](),controller[_0x64e8('0xa')]);router[_0x64e8('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x64e8('0xc')]);router[_0x64e8('0xd')]('/',auth['isAuthenticated'](),interaction[_0x64e8('0xe')](_0x64e8('0xf'),_0x64e8('0x10')),controller[_0x64e8('0x11')]);router[_0x64e8('0xd')](_0x64e8('0x12'),controller[_0x64e8('0x13')]);router[_0x64e8('0x14')](_0x64e8('0x15'),auth[_0x64e8('0x8')](),controller[_0x64e8('0x16')]);router['put'](_0x64e8('0x17'),auth[_0x64e8('0x8')](),controller['accept']);router[_0x64e8('0x14')](_0x64e8('0x18'),auth[_0x64e8('0x8')](),controller[_0x64e8('0x19')]);router[_0x64e8('0x1a')](_0x64e8('0x15'),auth['isAuthenticated'](),controller[_0x64e8('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x2477=['isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x1a7305,_0x10e998){var _0x84a826=function(_0x11796c){while(--_0x11796c){_0x1a7305['push'](_0x1a7305['shift']());}};_0x84a826(++_0x10e998);}(_0x2477,0x1a9));var _0x7247=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x2477[_0x34b821];return _0x5e00a0;};'use strict';var multer=require(_0x7247('0x0'));var util=require(_0x7247('0x1'));var path=require(_0x7247('0x2'));var timeout=require('connect-timeout');var express=require(_0x7247('0x3'));var router=express[_0x7247('0x4')]();var auth=require(_0x7247('0x5'));var interaction=require(_0x7247('0x6'));var config=require(_0x7247('0x7'));var controller=require(_0x7247('0x8'));router[_0x7247('0x9')]('/',auth[_0x7247('0xa')](),controller[_0x7247('0xb')]);router[_0x7247('0x9')](_0x7247('0xc'),auth[_0x7247('0xa')](),controller[_0x7247('0xd')]);router[_0x7247('0x9')](_0x7247('0xe'),auth['isAuthenticated'](),controller[_0x7247('0xf')]);router[_0x7247('0x10')]('/',auth[_0x7247('0xa')](),interaction[_0x7247('0x11')](_0x7247('0x12'),'whatsappmessage:create'),controller['create']);router[_0x7247('0x10')](_0x7247('0x13'),controller['status']);router[_0x7247('0x14')](_0x7247('0xe'),auth[_0x7247('0xa')](),controller[_0x7247('0x15')]);router[_0x7247('0x14')](_0x7247('0x16'),auth['isAuthenticated'](),controller[_0x7247('0x17')]);router[_0x7247('0x14')](_0x7247('0x18'),auth['isAuthenticated'](),controller[_0x7247('0x19')]);router[_0x7247('0x1a')]('/:id',auth[_0x7247('0xa')](),controller[_0x7247('0x1b')]);module[_0x7247('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 81ea662..a738a5a 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 _0x9d55=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9d55,0x9d));var _0x59d5=function(_0x243996,_0x50b8b2){_0x243996=_0x243996-0x0;var _0x5500f1=_0x9d55[_0x243996];return _0x5500f1;};'use strict';var Sequelize=require(_0x59d5('0x0'));module[_0x59d5('0x1')]={'body':{'type':Sequelize[_0x59d5('0x2')](_0x59d5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x59d5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x59d5('0x5')]('in','out'),'defaultValue':_0x59d5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x59d5('0x7')](0xbe)},'phone':{'type':Sequelize[_0x59d5('0x7')]},'readAt':{'type':Sequelize[_0x59d5('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb630=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x57a0a8,_0x16f2ae){var _0x330716=function(_0x2436a3){while(--_0x2436a3){_0x57a0a8['push'](_0x57a0a8['shift']());}};_0x330716(++_0x16f2ae);}(_0xb630,0xb1));var _0x0b63=function(_0x236c13,_0x50cc9f){_0x236c13=_0x236c13-0x0;var _0x35aa66=_0xb630[_0x236c13];return _0x35aa66;};'use strict';var Sequelize=require(_0x0b63('0x0'));module[_0x0b63('0x1')]={'body':{'type':Sequelize[_0x0b63('0x2')](_0x0b63('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0b63('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0b63('0x5')]('in','out'),'defaultValue':_0x0b63('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0b63('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0b63('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 282b83c..fa59ff8 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 _0x977c=['result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','WhatsappMessage','findAll','show','params','keys','find','catch','create','body','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','test','Sequelize','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4b9b46,_0x348ec2){var _0x110075=function(_0x2f0ad0){while(--_0x2f0ad0){_0x4b9b46['push'](_0x4b9b46['shift']());}};_0x110075(++_0x348ec2);}(_0x977c,0x1d6));var _0xc977=function(_0x43e975,_0x5cf20a){_0x43e975=_0x43e975-0x0;var _0x567efa=_0x977c[_0x43e975];return _0x567efa;};'use strict';var pdf=require(_0xc977('0x0'));var emlformat=require(_0xc977('0x1'));var rimraf=require(_0xc977('0x2'));var zipdir=require(_0xc977('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc977('0x4'));var BPromise=require(_0xc977('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc977('0x6'));var sox=require(_0xc977('0x7'));var csv=require(_0xc977('0x8'));var ejs=require(_0xc977('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc977('0xa'));var crypto=require(_0xc977('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc977('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc977('0xd'));var Papa=require(_0xc977('0xe'));var Redis=require(_0xc977('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc977('0x10'));var as=require(_0xc977('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc977('0x12'))(_0xc977('0x13'));var utils=require(_0xc977('0x14'));var config=require(_0xc977('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xc977('0x16')],{'host':_0xc977('0x17'),'port':0x18eb});var socket=require(_0xc977('0x18'))(new Redis(config[_0xc977('0x16')]));require(_0xc977('0x19'))[_0xc977('0x1a')](socket);var jayson=require(_0xc977('0x1b'));var client=jayson['client'][_0xc977('0x1c')]({'port':0x232c});var client9002=jayson[_0xc977('0x1d')][_0xc977('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4b8f86,_0x40c75d,_0x34572a){if(_0x34572a){var _0x9f1e4d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9f1e4d[_0xc977('0x1e')](_0x40c75d)){return _0x4b8f86;}else{throw new db[(_0xc977('0x1f'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x4b8f86;}}function respondWithRpcPromise(_0x42efb0,_0x497c60,_0x52274c,_0x574ffb){return new BPromise(function(_0x551d42,_0x36f927){var _0x56c1ad=_0x574ffb||client;return _0x56c1ad['request'](_0x42efb0,_0x52274c)[_0xc977('0x20')](function(_0x30e595){logger[_0xc977('0x21')](_0xc977('0x22'),_0x497c60,_0xc977('0x23'));logger[_0xc977('0x24')](_0xc977('0x25'),_0x497c60,_0xc977('0x23'),JSON[_0xc977('0x26')](_0x30e595));if(_0x30e595[_0xc977('0x27')]){if(_0x30e595[_0xc977('0x27')][_0xc977('0x28')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x497c60,_0x30e595[_0xc977('0x27')][_0xc977('0x29')]);return _0x36f927(_0x30e595[_0xc977('0x27')][_0xc977('0x29')]);}logger[_0xc977('0x27')](_0xc977('0x22'),_0x497c60,_0x30e595[_0xc977('0x27')][_0xc977('0x29')]);return _0x551d42(_0x30e595[_0xc977('0x27')][_0xc977('0x29')]);}else{logger[_0xc977('0x21')](_0xc977('0x22'),_0x497c60,_0xc977('0x23'));_0x551d42(_0x30e595[_0xc977('0x2a')][_0xc977('0x29')]);}})['catch'](function(_0x42bd04){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x497c60,_0x42bd04);_0x36f927(_0x42bd04);});});}function respondWithStatusCode(_0x567ca3,_0x1a8b3c){_0x1a8b3c=_0x1a8b3c||0xcc;return function(_0x1ff884){if(_0x1ff884){return _0x567ca3[_0xc977('0x2b')](_0x1a8b3c);}return _0x567ca3[_0xc977('0x2c')](_0x1a8b3c)['end']();};}function respondWithResult(_0x4f298d,_0x28f21c){_0x28f21c=_0x28f21c||0xc8;return function(_0x659673){if(_0x659673){return _0x4f298d[_0xc977('0x2c')](_0x28f21c)['json'](_0x659673);}};}function respondWithFilteredResult(_0x1d2ec8,_0x50a621){return function(_0xea2525){if(_0xea2525){var _0x430df6=_0xea2525[_0xc977('0x2d')],_0x3dea24=_0x50a621[_0xc977('0x2e')],_0x3f2c09=_0x50a621[_0xc977('0x2e')]+_0x50a621[_0xc977('0x2f')],_0x5471f4;if(_0x3f2c09>=_0x430df6){_0x3f2c09=_0x430df6;_0x5471f4=0xc8;}else{_0x5471f4=0xce;}_0x1d2ec8[_0xc977('0x2c')](_0x5471f4);return _0x1d2ec8[_0xc977('0x30')](_0xc977('0x31'),_0x3dea24+'-'+_0x3f2c09+'/'+_0x430df6)[_0xc977('0x32')](_0xea2525);}return null;};}function patchUpdates(_0x5967ea){return function(_0x16d2bc){try{jsonpatch[_0xc977('0x33')](_0x16d2bc,_0x5967ea,!![]);}catch(_0xdc00ea){return BPromise[_0xc977('0x34')](_0xdc00ea);}return _0x16d2bc[_0xc977('0x35')]();};}function saveUpdates(_0x1f8105,_0x2b83ae){return function(_0x19bb79){if(_0x19bb79){return _0x19bb79[_0xc977('0x36')](_0x1f8105)[_0xc977('0x20')](function(_0x3b7ea3){return _0x3b7ea3;});}return null;};}function removeEntity(_0x236837,_0x5ab9ac){return function(_0x2e9c31){if(_0x2e9c31){return _0x2e9c31[_0xc977('0x37')]()[_0xc977('0x20')](function(){_0x236837[_0xc977('0x2c')](0xcc)[_0xc977('0x38')]();});}};}function handleEntityNotFound(_0x51d61d,_0x39424f){return function(_0x59a2d4){if(!_0x59a2d4){_0x51d61d['sendStatus'](0x194);}return _0x59a2d4;};}function handleError(_0x4c7af9,_0x3270f7){_0x3270f7=_0x3270f7||0x1f4;return function(_0x1f929c){logger[_0xc977('0x27')](_0x1f929c[_0xc977('0x39')]);if(_0x1f929c[_0xc977('0x3a')]){delete _0x1f929c[_0xc977('0x3a')];}_0x4c7af9[_0xc977('0x2c')](_0x3270f7)[_0xc977('0x3b')](_0x1f929c);};}exports[_0xc977('0x3c')]=function(_0x40a61a,_0x3952f2){var _0xd9e8ad={},_0x4c0dc5={},_0x369f4={'count':0x0,'rows':[]};var _0x45fa61=_[_0xc977('0x3d')](db['WhatsappMessage']['rawAttributes'],function(_0x30c89b){return{'name':_0x30c89b['fieldName'],'type':_0x30c89b[_0xc977('0x3e')][_0xc977('0x3f')]};});_0x4c0dc5['model']=_[_0xc977('0x3d')](_0x45fa61,_0xc977('0x3a'));_0x4c0dc5[_0xc977('0x40')]=_['keys'](_0x40a61a[_0xc977('0x40')]);_0x4c0dc5[_0xc977('0x41')]=_[_0xc977('0x42')](_0x4c0dc5[_0xc977('0x43')],_0x4c0dc5['query']);_0xd9e8ad[_0xc977('0x44')]=_[_0xc977('0x42')](_0x4c0dc5[_0xc977('0x43')],qs[_0xc977('0x45')](_0x40a61a[_0xc977('0x40')][_0xc977('0x45')]));_0xd9e8ad[_0xc977('0x44')]=_0xd9e8ad[_0xc977('0x44')][_0xc977('0x46')]?_0xd9e8ad[_0xc977('0x44')]:_0x4c0dc5[_0xc977('0x43')];if(!_0x40a61a[_0xc977('0x40')][_0xc977('0x47')]('nolimit')){_0xd9e8ad[_0xc977('0x2f')]=qs[_0xc977('0x2f')](_0x40a61a['query'][_0xc977('0x2f')]);_0xd9e8ad[_0xc977('0x2e')]=qs['offset'](_0x40a61a[_0xc977('0x40')]['offset']);}_0xd9e8ad[_0xc977('0x48')]=qs[_0xc977('0x49')](_0x40a61a[_0xc977('0x40')][_0xc977('0x49')]);_0xd9e8ad['where']=qs[_0xc977('0x41')](_['pick'](_0x40a61a[_0xc977('0x40')],_0x4c0dc5[_0xc977('0x41')]),_0x45fa61);if(_0x40a61a[_0xc977('0x40')][_0xc977('0x4a')]){_0xd9e8ad[_0xc977('0x4b')]=_['merge'](_0xd9e8ad['where'],{'$or':_[_0xc977('0x3d')](_0x45fa61,function(_0x52c544){if(_0x52c544['type']!==_0xc977('0x4c')){var _0x2d1971={};_0x2d1971[_0x52c544[_0xc977('0x3a')]]={'$like':'%'+_0x40a61a[_0xc977('0x40')][_0xc977('0x4a')]+'%'};return _0x2d1971;}})});}_0xd9e8ad=_[_0xc977('0x4d')]({},_0xd9e8ad,_0x40a61a[_0xc977('0x4e')]);var _0x19c298={'where':_0xd9e8ad[_0xc977('0x4b')]};return db['WhatsappMessage']['count'](_0x19c298)['then'](function(_0x2a753d){_0x369f4[_0xc977('0x2d')]=_0x2a753d;if(_0x40a61a[_0xc977('0x40')][_0xc977('0x4f')]){_0xd9e8ad[_0xc977('0x50')]=[{'all':!![]}];}return db[_0xc977('0x51')][_0xc977('0x52')](_0xd9e8ad);})[_0xc977('0x20')](function(_0xc0fdae){_0x369f4['rows']=_0xc0fdae;return _0x369f4;})['then'](respondWithFilteredResult(_0x3952f2,_0xd9e8ad))['catch'](handleError(_0x3952f2,null));};exports[_0xc977('0x53')]=function(_0x53b209,_0x3ffc0c){var _0x35b1e0={'raw':!![],'where':{'id':_0x53b209[_0xc977('0x54')]['id']}},_0x51f862={};_0x51f862[_0xc977('0x43')]=_[_0xc977('0x55')](db['WhatsappMessage']['rawAttributes']);_0x51f862['query']=_[_0xc977('0x55')](_0x53b209[_0xc977('0x40')]);_0x51f862[_0xc977('0x41')]=_[_0xc977('0x42')](_0x51f862[_0xc977('0x43')],_0x51f862[_0xc977('0x40')]);_0x35b1e0['attributes']=_[_0xc977('0x42')](_0x51f862[_0xc977('0x43')],qs[_0xc977('0x45')](_0x53b209[_0xc977('0x40')][_0xc977('0x45')]));_0x35b1e0['attributes']=_0x35b1e0[_0xc977('0x44')][_0xc977('0x46')]?_0x35b1e0['attributes']:_0x51f862['model'];if(_0x53b209[_0xc977('0x40')][_0xc977('0x4f')]){_0x35b1e0[_0xc977('0x50')]=[{'all':!![]}];}_0x35b1e0=_[_0xc977('0x4d')]({},_0x35b1e0,_0x53b209[_0xc977('0x4e')]);return db[_0xc977('0x51')][_0xc977('0x56')](_0x35b1e0)['then'](handleEntityNotFound(_0x3ffc0c,null))[_0xc977('0x20')](respondWithResult(_0x3ffc0c,null))[_0xc977('0x57')](handleError(_0x3ffc0c,null));};exports[_0xc977('0x58')]=function(_0x2f7861,_0x33ac72){return db['WhatsappMessage'][_0xc977('0x58')](_0x2f7861[_0xc977('0x59')],{})[_0xc977('0x20')](respondWithResult(_0x33ac72,0xc9))[_0xc977('0x57')](handleError(_0x33ac72,null));};exports[_0xc977('0x36')]=function(_0x1e7c1f,_0x30ab76){if(_0x1e7c1f[_0xc977('0x59')]['id']){delete _0x1e7c1f[_0xc977('0x59')]['id'];}return db['WhatsappMessage'][_0xc977('0x56')]({'where':{'id':_0x1e7c1f[_0xc977('0x54')]['id']}})[_0xc977('0x20')](handleEntityNotFound(_0x30ab76,null))[_0xc977('0x20')](saveUpdates(_0x1e7c1f['body'],null))[_0xc977('0x20')](respondWithResult(_0x30ab76,null))['catch'](handleError(_0x30ab76,null));};exports[_0xc977('0x37')]=function(_0x422a86,_0x6f0c5f){return db[_0xc977('0x51')]['find']({'where':{'id':_0x422a86[_0xc977('0x54')]['id']}})[_0xc977('0x20')](handleEntityNotFound(_0x6f0c5f,null))['then'](removeEntity(_0x6f0c5f,null))[_0xc977('0x57')](handleError(_0x6f0c5f,null));};exports[_0xc977('0x5a')]=function(_0x57004e,_0x3a151c){return db[_0xc977('0x51')][_0xc977('0x5a')]()[_0xc977('0x20')](respondWithResult(_0x3a151c,null))[_0xc977('0x57')](handleError(_0x3a151c,null));};var interaction_log=require(_0xc977('0x12'))('whatsapp-interactions');exports[_0xc977('0x5b')]=function(_0x5c3ec0,_0x14b6b4,_0x10292c){var _0x151317={'channel':_0xc977('0x5c')};if(_0x5c3ec0[_0xc977('0x59')]['id']){delete _0x5c3ec0[_0xc977('0x59')]['id'];}_0x5c3ec0['body'][_0xc977('0x5d')]=!![];_0x5c3ec0[_0xc977('0x59')][_0xc977('0x5e')]=moment()[_0xc977('0x5f')](_0xc977('0x60'));_0x5c3ec0[_0xc977('0x59')][_0xc977('0x61')]=_0x5c3ec0['body'][_0xc977('0x61')]||_0x5c3ec0[_0xc977('0x62')]['id'];return db['WhatsappMessage'][_0xc977('0x56')]({'where':{'id':_0x5c3ec0[_0xc977('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc977('0x63')}]})['then'](handleEntityNotFound(_0x14b6b4,null))[_0xc977('0x20')](saveUpdates(_0x5c3ec0['body'],null))['then'](function(_0xacf887){if(_0xacf887){_0x151317[_0xc977('0x29')]=_0xacf887[_0xc977('0x64')]({'plain':!![]});return db[_0xc977('0x65')][_0xc977('0x56')]({'where':{'id':_0xacf887[_0xc977('0x66')]}});}return null;})[_0xc977('0x20')](handleEntityNotFound(_0x14b6b4,null))['then'](function(_0x56db07){if(_0x56db07){return _0x56db07[_0xc977('0x36')]({'UserId':_0x5c3ec0['body']['UserId'],'read1stAt':_[_0xc977('0x67')](_0x56db07[_0xc977('0x68')])?moment()[_0xc977('0x5f')](_0xc977('0x60')):undefined});}return null;})['then'](function(_0x335f36){if(_0x335f36){_0x151317[_0xc977('0x69')]=_0x335f36[_0xc977('0x64')]({'plain':!![]});interaction_log[_0xc977('0x21')](_0xc977('0x6a'),_0x5c3ec0[_0xc977('0x62')]['id'],_0x5c3ec0[_0xc977('0x62')]['name'],_0x5c3ec0['user'][_0xc977('0x6b')],_0x151317['interaction']['id'],_0x5c3ec0[_0xc977('0x59')]?JSON[_0xc977('0x26')](_0x5c3ec0['body']):_0xc977('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x151317);}return null;})[_0xc977('0x20')](function(_0x13f00b){if(_0x13f00b){if(_0x5c3ec0[_0xc977('0x59')][_0xc977('0x6d')]){_0x151317[_0xc977('0x29')]['interface']=util[_0xc977('0x5f')](_0xc977('0x6e'),_0x5c3ec0[_0xc977('0x62')][_0xc977('0x3a')]);_0x151317['message'][_0xc977('0x6f')]=_0x151317['channel'];_0x151317[_0xc977('0x29')][_0xc977('0x70')]=_0xc977('0x5b');return respondWithRpcPromise(_0xc977('0x71'),'EventManager',{'event':_0xc977('0x72'),'message':_0x151317[_0xc977('0x29')]},client9002)['then'](function(){return _0x151317;});}return _0x151317;}return null;})['then'](respondWithResult(_0x14b6b4,null))['catch'](handleError(_0x14b6b4,null));};var interaction_log=require(_0xc977('0x12'))('whatsapp-interactions');exports[_0xc977('0x34')]=function(_0x4d8533,_0x3ff836,_0x37c1da){var _0x4f6782={'agent':{},'channel':_0xc977('0x5c')};if(_0x4d8533[_0xc977('0x59')]['id']){delete _0x4d8533['body']['id'];}_0x4d8533[_0xc977('0x59')][_0xc977('0x61')]=_0x4d8533[_0xc977('0x59')]['UserId']||_0x4d8533[_0xc977('0x62')]['id'];_0x4f6782[_0xc977('0x73')]['id']=_0x4d8533[_0xc977('0x59')]['UserId'];return db[_0xc977('0x51')][_0xc977('0x56')]({'where':{'id':_0x4d8533[_0xc977('0x54')]['id'],'UserId':null}})[_0xc977('0x20')](handleEntityNotFound(_0x3ff836,null))[_0xc977('0x20')](function(_0x1536db){if(_0x1536db){_0x4f6782[_0xc977('0x29')]=_0x1536db[_0xc977('0x64')]({'plain':!![]});return db[_0xc977('0x65')]['find']({'where':{'id':_0x1536db[_0xc977('0x66')]}});}return null;})[_0xc977('0x20')](handleEntityNotFound(_0x3ff836,null))['then'](function(_0x4f7f6c){if(_0x4f7f6c){_0x4f6782[_0xc977('0x69')]=_0x4f7f6c[_0xc977('0x64')]({'plain':!![]});interaction_log[_0xc977('0x21')](_0xc977('0x74'),_0x4d8533[_0xc977('0x62')]['id'],_0x4d8533[_0xc977('0x62')][_0xc977('0x3a')],_0x4d8533[_0xc977('0x62')]['role'],_0x4f6782[_0xc977('0x69')]['id'],_0x4d8533['body']?JSON[_0xc977('0x26')](_0x4d8533[_0xc977('0x59')]):'null');return respondWithRpcPromise(_0xc977('0x75'),'rejectMessage',_0x4f6782);}return null;})[_0xc977('0x20')](function(_0x5030d3){if(_0x5030d3){_0x5030d3['message']['interface']=util['format'](_0xc977('0x6e'),_0x4d8533[_0xc977('0x62')][_0xc977('0x3a')]);_0x5030d3[_0xc977('0x29')]['channel']=_0x4f6782[_0xc977('0x6f')];_0x5030d3[_0xc977('0x29')]['event']=_0xc977('0x34');respondWithRpcPromise(_0xc977('0x71'),_0xc977('0x71'),{'event':_0xc977('0x76'),'message':_0x5030d3['message']},client9002);return _0x4f6782;}return null;})[_0xc977('0x20')](respondWithResult(_0x3ff836,null))[_0xc977('0x57')](handleError(_0x3ff836,null));};exports['status']=function(_0x177e21,_0x1e8b0d,_0x5e48a1){if(_0x177e21['body']['id']){delete _0x177e21[_0xc977('0x59')]['id'];}var _0x47bece;return db[_0xc977('0x51')][_0xc977('0x56')]({'where':{'id':_0x177e21[_0xc977('0x54')]['id']}})['then'](handleEntityNotFound(_0x1e8b0d,null))[_0xc977('0x20')](function(_0x5da1bb){if(_0x5da1bb){_0x47bece=_0x5da1bb;return db[_0xc977('0x77')][_0xc977('0x56')]({'where':{'id':_0x5da1bb[_0xc977('0x78')]}});}})[_0xc977('0x20')](handleEntityNotFound(_0x1e8b0d,null))['then'](function(_0x1e3245){if(_0x1e3245){logger[_0xc977('0x24')](_0xc977('0x79'),'status',_0xc977('0x7a'),_0x1e3245[_0xc977('0x3e')],util[_0xc977('0x7b')](_0x177e21[_0xc977('0x59')],{'showHidden':![],'depth':null}));switch(_0x1e3245[_0xc977('0x3e')]){case _0xc977('0x7c'):if(_0x177e21[_0xc977('0x59')][_0xc977('0x7d')]&&_0x177e21[_0xc977('0x59')]['MessageSid']===_0x47bece[_0xc977('0x7e')]&&_0x177e21[_0xc977('0x59')][_0xc977('0x7f')]&&_0x177e21[_0xc977('0x59')][_0xc977('0x7f')]===_0xc977('0x5d')){return _0x47bece[_0xc977('0x36')]({'read':!![]});}else{logger[_0xc977('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xc977('0x2c'),_0xc977('0x7c'),util[_0xc977('0x7b')](_0x177e21[_0xc977('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x47bece;}})[_0xc977('0x20')](respondWithResult(_0x1e8b0d,null))[_0xc977('0x57')](handleError(_0x1e8b0d,null));}; \ No newline at end of file +var _0x6eb0=['client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','whatsapp','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise'];(function(_0x14c2d6,_0xda4bb1){var _0x4a04da=function(_0x166f37){while(--_0x166f37){_0x14c2d6['push'](_0x14c2d6['shift']());}};_0x4a04da(++_0xda4bb1);}(_0x6eb0,0xef));var _0x06eb=function(_0x128df6,_0x1dac7a){_0x128df6=_0x128df6-0x0;var _0x37bbf1=_0x6eb0[_0x128df6];return _0x37bbf1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x06eb('0x0'));var rimraf=require(_0x06eb('0x1'));var zipdir=require(_0x06eb('0x2'));var jsonpatch=require(_0x06eb('0x3'));var rp=require(_0x06eb('0x4'));var moment=require('moment');var BPromise=require(_0x06eb('0x5'));var Mustache=require(_0x06eb('0x6'));var util=require(_0x06eb('0x7'));var path=require(_0x06eb('0x8'));var sox=require(_0x06eb('0x9'));var csv=require(_0x06eb('0xa'));var ejs=require(_0x06eb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x06eb('0xc'));var crypto=require(_0x06eb('0xd'));var jsforce=require(_0x06eb('0xe'));var deskjs=require(_0x06eb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x06eb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x06eb('0x11'));var as=require(_0x06eb('0x12'));var hardwareService=require(_0x06eb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x06eb('0x14'));var config=require(_0x06eb('0x15'));var db=require(_0x06eb('0x16'))['db'];config[_0x06eb('0x17')]=_['defaults'](config[_0x06eb('0x17')],{'host':_0x06eb('0x18'),'port':0x18eb});var socket=require(_0x06eb('0x19'))(new Redis(config[_0x06eb('0x17')]));require(_0x06eb('0x1a'))[_0x06eb('0x1b')](socket);var jayson=require(_0x06eb('0x1c'));var client=jayson[_0x06eb('0x1d')][_0x06eb('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5b7bbf,_0x5a63cc,_0x143cdc){if(_0x143cdc){var _0x156159=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x156159[_0x06eb('0x1f')](_0x5a63cc)){return _0x5b7bbf;}else{throw new db['Sequelize'][(_0x06eb('0x20'))](_0x06eb('0x21'));}}else{return _0x5b7bbf;}}function respondWithRpcPromise(_0x397023,_0x4a1fef,_0x2383d9,_0x26b272){return new BPromise(function(_0x215977,_0x568e32){var _0x4bbc5a=_0x26b272||client;return _0x4bbc5a['request'](_0x397023,_0x2383d9)[_0x06eb('0x22')](function(_0x56331d){logger[_0x06eb('0x23')](_0x06eb('0x24'),_0x4a1fef,'request\x20sent');logger[_0x06eb('0x25')](_0x06eb('0x26'),_0x4a1fef,'request\x20sent',JSON[_0x06eb('0x27')](_0x56331d));if(_0x56331d[_0x06eb('0x28')]){if(_0x56331d[_0x06eb('0x28')][_0x06eb('0x29')]===0x1f4){logger['error'](_0x06eb('0x24'),_0x4a1fef,_0x56331d[_0x06eb('0x28')][_0x06eb('0x2a')]);return _0x568e32(_0x56331d[_0x06eb('0x28')]['message']);}logger[_0x06eb('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x4a1fef,_0x56331d[_0x06eb('0x28')][_0x06eb('0x2a')]);return _0x215977(_0x56331d[_0x06eb('0x28')][_0x06eb('0x2a')]);}else{logger[_0x06eb('0x23')](_0x06eb('0x24'),_0x4a1fef,_0x06eb('0x2b'));_0x215977(_0x56331d[_0x06eb('0x2c')]['message']);}})['catch'](function(_0x2356dc){logger[_0x06eb('0x28')](_0x06eb('0x24'),_0x4a1fef,_0x2356dc);_0x568e32(_0x2356dc);});});}function respondWithStatusCode(_0x2467e1,_0x58ac76){_0x58ac76=_0x58ac76||0xcc;return function(_0x944cf0){if(_0x944cf0){return _0x2467e1['sendStatus'](_0x58ac76);}return _0x2467e1[_0x06eb('0x2d')](_0x58ac76)[_0x06eb('0x2e')]();};}function respondWithResult(_0x2588d2,_0x58a691){_0x58a691=_0x58a691||0xc8;return function(_0x34e173){if(_0x34e173){return _0x2588d2[_0x06eb('0x2d')](_0x58a691)['json'](_0x34e173);}};}function respondWithFilteredResult(_0x1c0e27,_0x3f0f2d){return function(_0xeecfb7){if(_0xeecfb7){var _0x2b5a85=_0xeecfb7[_0x06eb('0x2f')],_0x43adc1=_0x3f0f2d[_0x06eb('0x30')],_0x35b63c=_0x3f0f2d[_0x06eb('0x30')]+_0x3f0f2d[_0x06eb('0x31')],_0x5767ee;if(_0x35b63c>=_0x2b5a85){_0x35b63c=_0x2b5a85;_0x5767ee=0xc8;}else{_0x5767ee=0xce;}_0x1c0e27[_0x06eb('0x2d')](_0x5767ee);return _0x1c0e27[_0x06eb('0x32')](_0x06eb('0x33'),_0x43adc1+'-'+_0x35b63c+'/'+_0x2b5a85)[_0x06eb('0x34')](_0xeecfb7);}return null;};}function patchUpdates(_0x18e0f7){return function(_0x27a917){try{jsonpatch[_0x06eb('0x35')](_0x27a917,_0x18e0f7,!![]);}catch(_0x2e73fc){return BPromise[_0x06eb('0x36')](_0x2e73fc);}return _0x27a917['save']();};}function saveUpdates(_0x50f54b,_0x5a8f66){return function(_0x18e2c9){if(_0x18e2c9){return _0x18e2c9[_0x06eb('0x37')](_0x50f54b)[_0x06eb('0x22')](function(_0xa424c1){return _0xa424c1;});}return null;};}function removeEntity(_0x5a747f,_0x43d22e){return function(_0x4e968f){if(_0x4e968f){return _0x4e968f[_0x06eb('0x38')]()['then'](function(){_0x5a747f[_0x06eb('0x2d')](0xcc)[_0x06eb('0x2e')]();});}};}function handleEntityNotFound(_0x56a231,_0x3c551d){return function(_0x19fd36){if(!_0x19fd36){_0x56a231['sendStatus'](0x194);}return _0x19fd36;};}function handleError(_0x2bc98b,_0x208aeb){_0x208aeb=_0x208aeb||0x1f4;return function(_0x1e0fc7){logger[_0x06eb('0x28')](_0x1e0fc7[_0x06eb('0x39')]);if(_0x1e0fc7[_0x06eb('0x3a')]){delete _0x1e0fc7['name'];}_0x2bc98b[_0x06eb('0x2d')](_0x208aeb)[_0x06eb('0x3b')](_0x1e0fc7);};}exports[_0x06eb('0x3c')]=function(_0x491b24,_0x40543e){var _0x5f0c38={},_0x26e110={},_0x3a766b={'count':0x0,'rows':[]};var _0x4239cf=_[_0x06eb('0x3d')](db['WhatsappMessage']['rawAttributes'],function(_0x19be6e){return{'name':_0x19be6e[_0x06eb('0x3e')],'type':_0x19be6e['type']['key']};});_0x26e110[_0x06eb('0x3f')]=_[_0x06eb('0x3d')](_0x4239cf,_0x06eb('0x3a'));_0x26e110[_0x06eb('0x40')]=_['keys'](_0x491b24['query']);_0x26e110[_0x06eb('0x41')]=_['intersection'](_0x26e110[_0x06eb('0x3f')],_0x26e110[_0x06eb('0x40')]);_0x5f0c38[_0x06eb('0x42')]=_[_0x06eb('0x43')](_0x26e110[_0x06eb('0x3f')],qs[_0x06eb('0x44')](_0x491b24['query']['fields']));_0x5f0c38[_0x06eb('0x42')]=_0x5f0c38['attributes'][_0x06eb('0x45')]?_0x5f0c38[_0x06eb('0x42')]:_0x26e110[_0x06eb('0x3f')];if(!_0x491b24[_0x06eb('0x40')][_0x06eb('0x46')](_0x06eb('0x47'))){_0x5f0c38['limit']=qs[_0x06eb('0x31')](_0x491b24[_0x06eb('0x40')]['limit']);_0x5f0c38[_0x06eb('0x30')]=qs[_0x06eb('0x30')](_0x491b24['query'][_0x06eb('0x30')]);}_0x5f0c38['order']=qs[_0x06eb('0x48')](_0x491b24[_0x06eb('0x40')][_0x06eb('0x48')]);_0x5f0c38[_0x06eb('0x49')]=qs[_0x06eb('0x41')](_[_0x06eb('0x4a')](_0x491b24[_0x06eb('0x40')],_0x26e110['filters']),_0x4239cf);if(_0x491b24[_0x06eb('0x40')][_0x06eb('0x4b')]){_0x5f0c38[_0x06eb('0x49')]=_[_0x06eb('0x4c')](_0x5f0c38[_0x06eb('0x49')],{'$or':_['map'](_0x4239cf,function(_0x399cb8){if(_0x399cb8[_0x06eb('0x4d')]!==_0x06eb('0x4e')){var _0x5b952f={};_0x5b952f[_0x399cb8[_0x06eb('0x3a')]]={'$like':'%'+_0x491b24[_0x06eb('0x40')]['filter']+'%'};return _0x5b952f;}})});}_0x5f0c38=_[_0x06eb('0x4c')]({},_0x5f0c38,_0x491b24[_0x06eb('0x4f')]);var _0x2048ef={'where':_0x5f0c38[_0x06eb('0x49')]};return db[_0x06eb('0x50')][_0x06eb('0x2f')](_0x2048ef)[_0x06eb('0x22')](function(_0x546d22){_0x3a766b[_0x06eb('0x2f')]=_0x546d22;if(_0x491b24['query'][_0x06eb('0x51')]){_0x5f0c38[_0x06eb('0x52')]=[{'all':!![]}];}return db[_0x06eb('0x50')][_0x06eb('0x53')](_0x5f0c38);})[_0x06eb('0x22')](function(_0x2e1ca7){_0x3a766b[_0x06eb('0x54')]=_0x2e1ca7;return _0x3a766b;})[_0x06eb('0x22')](respondWithFilteredResult(_0x40543e,_0x5f0c38))[_0x06eb('0x55')](handleError(_0x40543e,null));};exports[_0x06eb('0x56')]=function(_0x57ff3d,_0x3e1d62){var _0x5d4366={'raw':!![],'where':{'id':_0x57ff3d[_0x06eb('0x57')]['id']}},_0xb60c6a={};_0xb60c6a[_0x06eb('0x3f')]=_['keys'](db[_0x06eb('0x50')][_0x06eb('0x58')]);_0xb60c6a[_0x06eb('0x40')]=_[_0x06eb('0x59')](_0x57ff3d[_0x06eb('0x40')]);_0xb60c6a[_0x06eb('0x41')]=_['intersection'](_0xb60c6a['model'],_0xb60c6a['query']);_0x5d4366[_0x06eb('0x42')]=_[_0x06eb('0x43')](_0xb60c6a[_0x06eb('0x3f')],qs[_0x06eb('0x44')](_0x57ff3d[_0x06eb('0x40')][_0x06eb('0x44')]));_0x5d4366['attributes']=_0x5d4366[_0x06eb('0x42')][_0x06eb('0x45')]?_0x5d4366[_0x06eb('0x42')]:_0xb60c6a[_0x06eb('0x3f')];if(_0x57ff3d['query']['includeAll']){_0x5d4366[_0x06eb('0x52')]=[{'all':!![]}];}_0x5d4366=_[_0x06eb('0x4c')]({},_0x5d4366,_0x57ff3d[_0x06eb('0x4f')]);return db['WhatsappMessage'][_0x06eb('0x5a')](_0x5d4366)['then'](handleEntityNotFound(_0x3e1d62,null))[_0x06eb('0x22')](respondWithResult(_0x3e1d62,null))[_0x06eb('0x55')](handleError(_0x3e1d62,null));};exports[_0x06eb('0x5b')]=function(_0x58793f,_0x385e9a){return db[_0x06eb('0x50')][_0x06eb('0x5b')](_0x58793f[_0x06eb('0x5c')],{})[_0x06eb('0x22')](respondWithResult(_0x385e9a,0xc9))[_0x06eb('0x55')](handleError(_0x385e9a,null));};exports[_0x06eb('0x37')]=function(_0x261e9d,_0x1e9b46){if(_0x261e9d[_0x06eb('0x5c')]['id']){delete _0x261e9d[_0x06eb('0x5c')]['id'];}return db[_0x06eb('0x50')][_0x06eb('0x5a')]({'where':{'id':_0x261e9d[_0x06eb('0x57')]['id']}})[_0x06eb('0x22')](handleEntityNotFound(_0x1e9b46,null))[_0x06eb('0x22')](saveUpdates(_0x261e9d[_0x06eb('0x5c')],null))[_0x06eb('0x22')](respondWithResult(_0x1e9b46,null))[_0x06eb('0x55')](handleError(_0x1e9b46,null));};exports[_0x06eb('0x38')]=function(_0x1cf07a,_0xa8e240){return db[_0x06eb('0x50')]['find']({'where':{'id':_0x1cf07a[_0x06eb('0x57')]['id']}})[_0x06eb('0x22')](handleEntityNotFound(_0xa8e240,null))[_0x06eb('0x22')](removeEntity(_0xa8e240,null))[_0x06eb('0x55')](handleError(_0xa8e240,null));};exports[_0x06eb('0x5d')]=function(_0x576d7d,_0x23d041){return db['WhatsappMessage'][_0x06eb('0x5d')]()['then'](respondWithResult(_0x23d041,null))['catch'](handleError(_0x23d041,null));};var interaction_log=require(_0x06eb('0x5e'))(_0x06eb('0x5f'));exports[_0x06eb('0x60')]=function(_0x5c6d32,_0x41aaae,_0x5e8db9){var _0x584a78={'channel':'whatsapp'};if(_0x5c6d32[_0x06eb('0x5c')]['id']){delete _0x5c6d32['body']['id'];}_0x5c6d32['body'][_0x06eb('0x61')]=!![];_0x5c6d32[_0x06eb('0x5c')][_0x06eb('0x62')]=moment()['format'](_0x06eb('0x63'));_0x5c6d32[_0x06eb('0x5c')][_0x06eb('0x64')]=_0x5c6d32[_0x06eb('0x5c')]['UserId']||_0x5c6d32[_0x06eb('0x65')]['id'];return db[_0x06eb('0x50')]['find']({'where':{'id':_0x5c6d32[_0x06eb('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x06eb('0x66')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x41aaae,null))[_0x06eb('0x22')](saveUpdates(_0x5c6d32[_0x06eb('0x5c')],null))[_0x06eb('0x22')](function(_0x442e4c){if(_0x442e4c){_0x584a78['message']=_0x442e4c[_0x06eb('0x67')]({'plain':!![]});return db[_0x06eb('0x68')][_0x06eb('0x5a')]({'where':{'id':_0x442e4c[_0x06eb('0x69')]}});}return null;})[_0x06eb('0x22')](handleEntityNotFound(_0x41aaae,null))['then'](function(_0x46b983){if(_0x46b983){return _0x46b983[_0x06eb('0x37')]({'UserId':_0x5c6d32[_0x06eb('0x5c')][_0x06eb('0x64')],'read1stAt':_[_0x06eb('0x6a')](_0x46b983[_0x06eb('0x6b')])?moment()[_0x06eb('0x6c')](_0x06eb('0x63')):undefined});}return null;})[_0x06eb('0x22')](function(_0x14a026){if(_0x14a026){_0x584a78[_0x06eb('0x6d')]=_0x14a026[_0x06eb('0x67')]({'plain':!![]});interaction_log[_0x06eb('0x23')](_0x06eb('0x6e'),_0x5c6d32[_0x06eb('0x65')]['id'],_0x5c6d32['user']['name'],_0x5c6d32[_0x06eb('0x65')]['role'],_0x584a78[_0x06eb('0x6d')]['id'],_0x5c6d32[_0x06eb('0x5c')]?JSON[_0x06eb('0x27')](_0x5c6d32['body']):_0x06eb('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x06eb('0x70'),_0x584a78);}return null;})[_0x06eb('0x22')](function(_0x323ce9){if(_0x323ce9){if(_0x5c6d32[_0x06eb('0x5c')][_0x06eb('0x71')]){_0x584a78[_0x06eb('0x2a')][_0x06eb('0x72')]=util['format'](_0x06eb('0x73'),_0x5c6d32[_0x06eb('0x65')][_0x06eb('0x3a')]);_0x584a78[_0x06eb('0x2a')][_0x06eb('0x74')]=_0x584a78[_0x06eb('0x74')];_0x584a78[_0x06eb('0x2a')]['event']=_0x06eb('0x60');return respondWithRpcPromise(_0x06eb('0x75'),_0x06eb('0x75'),{'event':_0x06eb('0x76'),'message':_0x584a78[_0x06eb('0x2a')]},client9002)['then'](function(){return _0x584a78;});}return _0x584a78;}return null;})['then'](respondWithResult(_0x41aaae,null))['catch'](handleError(_0x41aaae,null));};var interaction_log=require(_0x06eb('0x5e'))(_0x06eb('0x5f'));exports[_0x06eb('0x36')]=function(_0xac050d,_0x2ffa77,_0xdcfeba){var _0x5000ab={'agent':{},'channel':_0x06eb('0x77')};if(_0xac050d['body']['id']){delete _0xac050d['body']['id'];}_0xac050d['body'][_0x06eb('0x64')]=_0xac050d[_0x06eb('0x5c')][_0x06eb('0x64')]||_0xac050d[_0x06eb('0x65')]['id'];_0x5000ab[_0x06eb('0x78')]['id']=_0xac050d[_0x06eb('0x5c')][_0x06eb('0x64')];return db[_0x06eb('0x50')]['find']({'where':{'id':_0xac050d[_0x06eb('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2ffa77,null))['then'](function(_0x3db092){if(_0x3db092){_0x5000ab[_0x06eb('0x2a')]=_0x3db092[_0x06eb('0x67')]({'plain':!![]});return db[_0x06eb('0x68')][_0x06eb('0x5a')]({'where':{'id':_0x3db092[_0x06eb('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x2ffa77,null))[_0x06eb('0x22')](function(_0x81b1e7){if(_0x81b1e7){_0x5000ab[_0x06eb('0x6d')]=_0x81b1e7[_0x06eb('0x67')]({'plain':!![]});interaction_log['info'](_0x06eb('0x79'),_0xac050d[_0x06eb('0x65')]['id'],_0xac050d[_0x06eb('0x65')]['name'],_0xac050d[_0x06eb('0x65')][_0x06eb('0x7a')],_0x5000ab['interaction']['id'],_0xac050d[_0x06eb('0x5c')]?JSON['stringify'](_0xac050d[_0x06eb('0x5c')]):_0x06eb('0x6f'));return respondWithRpcPromise(_0x06eb('0x7b'),'rejectMessage',_0x5000ab);}return null;})[_0x06eb('0x22')](function(_0x5019c2){if(_0x5019c2){_0x5019c2[_0x06eb('0x2a')][_0x06eb('0x72')]=util['format'](_0x06eb('0x73'),_0xac050d[_0x06eb('0x65')][_0x06eb('0x3a')]);_0x5019c2[_0x06eb('0x2a')][_0x06eb('0x74')]=_0x5000ab[_0x06eb('0x74')];_0x5019c2[_0x06eb('0x2a')][_0x06eb('0x7c')]=_0x06eb('0x36');respondWithRpcPromise(_0x06eb('0x75'),_0x06eb('0x75'),{'event':_0x06eb('0x7d'),'message':_0x5019c2[_0x06eb('0x2a')]},client9002);return _0x5000ab;}return null;})[_0x06eb('0x22')](respondWithResult(_0x2ffa77,null))['catch'](handleError(_0x2ffa77,null));};exports[_0x06eb('0x2d')]=function(_0xd63e8e,_0x3e1eee,_0x4fb7b8){if(_0xd63e8e['body']['id']){delete _0xd63e8e[_0x06eb('0x5c')]['id'];}var _0x9a171f;return db[_0x06eb('0x50')][_0x06eb('0x5a')]({'where':{'id':_0xd63e8e[_0x06eb('0x57')]['id']}})[_0x06eb('0x22')](handleEntityNotFound(_0x3e1eee,null))['then'](function(_0x151481){if(_0x151481){_0x9a171f=_0x151481;return db[_0x06eb('0x7e')]['find']({'where':{'id':_0x151481[_0x06eb('0x7f')]}});}})['then'](handleEntityNotFound(_0x3e1eee,null))[_0x06eb('0x22')](function(_0x52fc2a){if(_0x52fc2a){logger[_0x06eb('0x25')](_0x06eb('0x80'),_0x06eb('0x2d'),'received\x20delivery\x20report\x20from',_0x52fc2a[_0x06eb('0x4d')],util['inspect'](_0xd63e8e[_0x06eb('0x5c')],{'showHidden':![],'depth':null}));switch(_0x52fc2a[_0x06eb('0x4d')]){case _0x06eb('0x81'):if(_0xd63e8e[_0x06eb('0x5c')][_0x06eb('0x82')]&&_0xd63e8e[_0x06eb('0x5c')][_0x06eb('0x82')]===_0x9a171f['messageId']&&_0xd63e8e[_0x06eb('0x5c')][_0x06eb('0x83')]&&_0xd63e8e[_0x06eb('0x5c')]['MessageStatus']===_0x06eb('0x61')){return _0x9a171f[_0x06eb('0x37')]({'read':!![]});}else{logger[_0x06eb('0x28')](_0x06eb('0x84'),_0x06eb('0x2d'),_0x06eb('0x81'),util[_0x06eb('0x85')](_0xd63e8e[_0x06eb('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x9a171f;}})[_0x06eb('0x22')](respondWithResult(_0x3e1eee,null))[_0x06eb('0x55')](handleError(_0x3e1eee,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 97859e9..11e5966 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 _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x30d61a,_0x56cfae){var _0x2ada82=function(_0x5edc97){while(--_0x5edc97){_0x30d61a['push'](_0x30d61a['shift']());}};_0x2ada82(++_0x56cfae);}(_0xb10b,0x12a));var _0xbb10=function(_0x6d0143,_0x3d7c30){_0x6d0143=_0x6d0143-0x0;var _0x29cb75=_0xb10b[_0x6d0143];return _0x29cb75;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x93f196,_0x4af33a){var _0x41d23d=function(_0x6b4e6b){while(--_0x6b4e6b){_0x93f196['push'](_0x93f196['shift']());}};_0x41d23d(++_0x4af33a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5529a1,_0x178b85){_0x5529a1=_0x5529a1-0x0;var _0xf71f93=_0x5f2f[_0x5529a1];return _0xf71f93;};'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 diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 735a7c7..5437faa 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 _0x44d6=['messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x44d6,0x11b));var _0x644d=function(_0x3b662b,_0x5dab5a){_0x3b662b=_0x3b662b-0x0;var _0x1c968a=_0x44d6[_0x3b662b];return _0x1c968a;};'use strict';var _=require(_0x644d('0x0'));var util=require(_0x644d('0x1'));var logger=require(_0x644d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x644d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x644d('0x4'));var rimraf=require('rimraf');var config=require(_0x644d('0x5'));var attributes=require(_0x644d('0x6'));module[_0x644d('0x7')]=function(_0x48e9f0,_0x5a8d7d){return _0x48e9f0[_0x644d('0x8')](_0x644d('0x9'),attributes,{'tableName':_0x644d('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x644d('0xb')]},{'name':_0x644d('0xc'),'fields':[_0x644d('0xd')],'type':_0x644d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e8545,_0x55132d,_0x2699b7){var _0x20744f=_0x48e9f0[_0x644d('0xf')];var _0x458543=_0x1e8545[_0x644d('0x10')]({'plain':!![]});if(_0x458543[_0x644d('0x11')][_0x644d('0x12')]()==='in'||_0x458543[_0x644d('0x11')][_0x644d('0x12')]()==='out'&&!_0x458543[_0x644d('0x13')]&&!_[_0x644d('0x14')](_0x458543[_0x644d('0x15')])){_0x20744f['WhatsappInteraction']['findOne']({'where':{'id':_0x458543[_0x644d('0x16')]}})[_0x644d('0x17')](function(_0x47b5d7){if(_0x47b5d7){_0x47b5d7[_0x644d('0x18')]({'lastMsgAt':_0x458543[_0x644d('0x19')],'lastMsgDirection':_0x458543[_0x644d('0x11')][_0x644d('0x12')]()});}})[_0x644d('0x1a')](function(_0x3fd884){console['error'](_0x3fd884);});}if(_0x458543['direction']==='out'&&!_0x458543[_0x644d('0x13')]){var _0x2694b3;_0x20744f[_0x644d('0x1b')][_0x644d('0x1c')]({'where':{'id':_0x458543[_0x644d('0x1d')]},'raw':!![]})['then'](function(_0x577d88){_0x2694b3=_0x577d88;if(_0x2694b3&&_0x2694b3['type']){switch(_0x2694b3[_0x644d('0x1e')]){case _0x644d('0x1f'):var _0x39bb55=require(_0x644d('0x1f'));if(_0x2694b3[_0x644d('0x20')]&&_0x2694b3['authToken']&&_0x2694b3[_0x644d('0x21')]){var _0x42530b=new _0x39bb55(_0x2694b3['accountSid'],_0x2694b3[_0x644d('0x22')]);_0x42530b[_0x644d('0x23')]['create']({'body':_0x458543[_0x644d('0xd')],'to':_0x644d('0x24')+_0x458543[_0x644d('0x21')],'from':_0x644d('0x24')+_0x2694b3['phone'],'statusCallback':_0x2694b3[_0x644d('0x25')]+_0x644d('0x26')+_0x458543['id']+_0x644d('0x27')+_0x2694b3[_0x644d('0x28')]})[_0x644d('0x17')](function(_0xb48e2){if(_0xb48e2[_0x644d('0x29')]){return _0x1e8545['update']({'messageId':_0xb48e2[_0x644d('0x29')]});}})[_0x644d('0x1a')](function(_0x24aac0){logger[_0x644d('0x2a')](_0x644d('0x2b'),'afterCreate',_0x644d('0x1f'),util[_0x644d('0x2c')](_0x24aac0,{'showHidden':![],'depth':null}));});}else{logger[_0x644d('0x2a')](_0x644d('0x2b'),_0x644d('0x2d'),_0x644d('0x1f'),_0x644d('0x2e'));}break;}}})[_0x644d('0x2f')](function(){_0x2699b7();});}else{_0x2699b7();}}},'charset':'utf8mb4','collate':_0x644d('0x30')});}; \ No newline at end of file +var _0xe15b=['sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','FULLTEXT','get','toLowerCase','direction','secret','UserId','WhatsappInteraction','update','createdAt','out','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','whatsapp:','phone','remote','/api/whatsapp/messages/','token'];(function(_0x54e40d,_0x15fb66){var _0x42ce49=function(_0x180e35){while(--_0x180e35){_0x54e40d['push'](_0x54e40d['shift']());}};_0x42ce49(++_0x15fb66);}(_0xe15b,0x144));var _0xbe15=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0xe15b[_0x3b8f2e];return _0x1433d5;};'use strict';var _=require('lodash');var util=require(_0xbe15('0x0'));var logger=require(_0xbe15('0x1'))(_0xbe15('0x2'));var moment=require(_0xbe15('0x3'));var BPromise=require(_0xbe15('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe15('0x5'));var rimraf=require(_0xbe15('0x6'));var config=require(_0xbe15('0x7'));var attributes=require(_0xbe15('0x8'));module['exports']=function(_0x435ad8,_0x35ff1f){return _0x435ad8[_0xbe15('0x9')](_0xbe15('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xbe15('0xb'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xbe15('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xaa7990,_0x5eae4e,_0x82debc){var _0x1e5642=_0x435ad8['models'];var _0x559b09=_0xaa7990[_0xbe15('0xd')]({'plain':!![]});if(_0x559b09['direction'][_0xbe15('0xe')]()==='in'||_0x559b09[_0xbe15('0xf')]['toLowerCase']()==='out'&&!_0x559b09[_0xbe15('0x10')]&&!_['isNil'](_0x559b09[_0xbe15('0x11')])){_0x1e5642[_0xbe15('0x12')]['findOne']({'where':{'id':_0x559b09['WhatsappInteractionId']}})['then'](function(_0x23c42b){if(_0x23c42b){_0x23c42b[_0xbe15('0x13')]({'lastMsgAt':_0x559b09[_0xbe15('0x14')],'lastMsgDirection':_0x559b09[_0xbe15('0xf')]['toLowerCase']()});}})['catch'](function(_0x529f10){console['error'](_0x529f10);});}if(_0x559b09['direction']===_0xbe15('0x15')&&!_0x559b09['secret']){var _0x55c4ce;_0x1e5642[_0xbe15('0x16')][_0xbe15('0x17')]({'where':{'id':_0x559b09[_0xbe15('0x18')]},'raw':!![]})[_0xbe15('0x19')](function(_0x5d2706){_0x55c4ce=_0x5d2706;if(_0x55c4ce&&_0x55c4ce[_0xbe15('0x1a')]){switch(_0x55c4ce[_0xbe15('0x1a')]){case _0xbe15('0x1b'):var _0x6f6f9f=require(_0xbe15('0x1b'));if(_0x55c4ce[_0xbe15('0x1c')]&&_0x55c4ce[_0xbe15('0x1d')]&&_0x55c4ce['phone']){var _0x107bbf=new _0x6f6f9f(_0x55c4ce[_0xbe15('0x1c')],_0x55c4ce[_0xbe15('0x1d')]);_0x107bbf[_0xbe15('0x1e')]['create']({'body':_0x559b09['body'],'to':_0xbe15('0x1f')+_0x559b09[_0xbe15('0x20')],'from':_0xbe15('0x1f')+_0x55c4ce[_0xbe15('0x20')],'statusCallback':_0x55c4ce[_0xbe15('0x21')]+_0xbe15('0x22')+_0x559b09['id']+'/status?token='+_0x55c4ce[_0xbe15('0x23')]})[_0xbe15('0x19')](function(_0xab9959){if(_0xab9959[_0xbe15('0x24')]){return _0xaa7990['update']({'messageId':_0xab9959[_0xbe15('0x24')]});}})[_0xbe15('0x25')](function(_0x420c09){logger[_0xbe15('0x26')](_0xbe15('0x27'),_0xbe15('0x28'),_0xbe15('0x1b'),util[_0xbe15('0x29')](_0x420c09,{'showHidden':![],'depth':null}));});}else{logger[_0xbe15('0x26')](_0xbe15('0x27'),_0xbe15('0x28'),_0xbe15('0x1b'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xbe15('0x2a')](function(){_0x82debc();});}else{_0x82debc();}}},'charset':_0xbe15('0x2b'),'collate':_0xbe15('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index b255811..e7cfd58 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 _0x1e57=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xbd7f9c,_0x21d8ff){var _0xce6cad=function(_0x2d8adf){while(--_0x2d8adf){_0xbd7f9c['push'](_0xbd7f9c['shift']());}};_0xce6cad(++_0x21d8ff);}(_0x1e57,0x198));var _0x71e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e57[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x71e5('0x0'));var util=require(_0x71e5('0x1'));var moment=require(_0x71e5('0x2'));var BPromise=require(_0x71e5('0x3'));var rs=require(_0x71e5('0x4'));var fs=require('fs');var Redis=require(_0x71e5('0x5'));var db=require(_0x71e5('0x6'))['db'];var utils=require(_0x71e5('0x7'));var logger=require(_0x71e5('0x8'))(_0x71e5('0x9'));var config=require(_0x71e5('0xa'));var jayson=require(_0x71e5('0xb'));var client=jayson['client'][_0x71e5('0xc')]({'port':0x232a});config[_0x71e5('0xd')]=_[_0x71e5('0xe')](config['redis'],{'host':_0x71e5('0xf'),'port':0x18eb});var socket=require(_0x71e5('0x10'))(new Redis(config[_0x71e5('0xd')]));require('./whatsappMessage.socket')[_0x71e5('0x11')](socket);function respondWithRpcPromise(_0x20bfe9,_0x1db4f4,_0x9889fd){return new BPromise(function(_0x133f70,_0xbd6c8a){return client[_0x71e5('0x12')](_0x20bfe9,_0x9889fd)[_0x71e5('0x13')](function(_0x4801bb){logger[_0x71e5('0x14')](_0x71e5('0x15'),_0x1db4f4,_0x71e5('0x16'));logger[_0x71e5('0x17')](_0x71e5('0x18'),_0x1db4f4,_0x71e5('0x16'),JSON[_0x71e5('0x19')](_0x4801bb));if(_0x4801bb[_0x71e5('0x1a')]){if(_0x4801bb['error']['code']===0x1f4){logger[_0x71e5('0x1a')](_0x71e5('0x15'),_0x1db4f4,_0x4801bb[_0x71e5('0x1a')][_0x71e5('0x1b')]);return _0xbd6c8a(_0x4801bb['error'][_0x71e5('0x1b')]);}logger[_0x71e5('0x1a')](_0x71e5('0x15'),_0x1db4f4,_0x4801bb[_0x71e5('0x1a')]['message']);return _0x133f70(_0x4801bb['error'][_0x71e5('0x1b')]);}else{logger[_0x71e5('0x14')](_0x71e5('0x15'),_0x1db4f4,_0x71e5('0x16'));_0x133f70(_0x4801bb[_0x71e5('0x1c')][_0x71e5('0x1b')]);}})[_0x71e5('0x1d')](function(_0x420855){logger['error'](_0x71e5('0x15'),_0x1db4f4,_0x420855);_0xbd6c8a(_0x420855);});});}exports['CreateWhatsappMessage']=function(_0x4c97f5){var _0x2c76d4=this;return new Promise(function(_0x17090e,_0x45880a){return db['WhatsappMessage'][_0x71e5('0x1e')](_0x4c97f5[_0x71e5('0x1f')],{'raw':_0x4c97f5[_0x71e5('0x20')]?_0x4c97f5['options'][_0x71e5('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x57c155){logger[_0x71e5('0x14')](_0x71e5('0x22'),_0x4c97f5);logger[_0x71e5('0x17')]('CreateWhatsappMessage',_0x4c97f5,JSON[_0x71e5('0x19')](_0x57c155));_0x17090e(_0x57c155);})[_0x71e5('0x1d')](function(_0x156a34){logger[_0x71e5('0x1a')](_0x71e5('0x22'),_0x156a34['message'],_0x4c97f5);_0x45880a(_0x2c76d4[_0x71e5('0x1a')](0x1f4,_0x156a34['message']));});});}; \ No newline at end of file +var _0x56cc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','create','body','options','raw','util'];(function(_0x523ae9,_0xc1b244){var _0x3d7906=function(_0x38b043){while(--_0x38b043){_0x523ae9['push'](_0x523ae9['shift']());}};_0x3d7906(++_0xc1b244);}(_0x56cc,0xd8));var _0xc56c=function(_0x4d25eb,_0x5adee7){_0x4d25eb=_0x4d25eb-0x0;var _0xec5730=_0x56cc[_0x4d25eb];return _0xec5730;};'use strict';var _=require('lodash');var util=require(_0xc56c('0x0'));var moment=require('moment');var BPromise=require(_0xc56c('0x1'));var rs=require(_0xc56c('0x2'));var fs=require('fs');var Redis=require(_0xc56c('0x3'));var db=require(_0xc56c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc56c('0x5'))(_0xc56c('0x6'));var config=require('../../config/environment');var jayson=require(_0xc56c('0x7'));var client=jayson[_0xc56c('0x8')][_0xc56c('0x9')]({'port':0x232a});config[_0xc56c('0xa')]=_[_0xc56c('0xb')](config[_0xc56c('0xa')],{'host':_0xc56c('0xc'),'port':0x18eb});var socket=require(_0xc56c('0xd'))(new Redis(config[_0xc56c('0xa')]));require(_0xc56c('0xe'))['register'](socket);function respondWithRpcPromise(_0x1010c,_0x40dd7d,_0x32d5bb){return new BPromise(function(_0x30d6e9,_0x112c6b){return client['request'](_0x1010c,_0x32d5bb)[_0xc56c('0xf')](function(_0x308669){logger[_0xc56c('0x10')](_0xc56c('0x11'),_0x40dd7d,_0xc56c('0x12'));logger[_0xc56c('0x13')](_0xc56c('0x14'),_0x40dd7d,_0xc56c('0x12'),JSON[_0xc56c('0x15')](_0x308669));if(_0x308669[_0xc56c('0x16')]){if(_0x308669[_0xc56c('0x16')]['code']===0x1f4){logger['error'](_0xc56c('0x11'),_0x40dd7d,_0x308669[_0xc56c('0x16')]['message']);return _0x112c6b(_0x308669[_0xc56c('0x16')][_0xc56c('0x17')]);}logger['error'](_0xc56c('0x11'),_0x40dd7d,_0x308669[_0xc56c('0x16')]['message']);return _0x30d6e9(_0x308669[_0xc56c('0x16')][_0xc56c('0x17')]);}else{logger[_0xc56c('0x10')](_0xc56c('0x11'),_0x40dd7d,_0xc56c('0x12'));_0x30d6e9(_0x308669[_0xc56c('0x18')][_0xc56c('0x17')]);}})[_0xc56c('0x19')](function(_0x4cb322){logger[_0xc56c('0x16')](_0xc56c('0x11'),_0x40dd7d,_0x4cb322);_0x112c6b(_0x4cb322);});});}exports[_0xc56c('0x1a')]=function(_0x21273d){var _0x576111=this;return new Promise(function(_0xe1ea1f,_0x165f18){return db['WhatsappMessage'][_0xc56c('0x1b')](_0x21273d[_0xc56c('0x1c')],{'raw':_0x21273d[_0xc56c('0x1d')]?_0x21273d[_0xc56c('0x1d')][_0xc56c('0x1e')]===undefined?!![]:![]:!![]})[_0xc56c('0xf')](function(_0xb3c634){logger[_0xc56c('0x10')](_0xc56c('0x1a'),_0x21273d);logger[_0xc56c('0x13')](_0xc56c('0x1a'),_0x21273d,JSON[_0xc56c('0x15')](_0xb3c634));_0xe1ea1f(_0xb3c634);})['catch'](function(_0x30a693){logger['error'](_0xc56c('0x1a'),_0x30a693[_0xc56c('0x17')],_0x21273d);_0x165f18(_0x576111[_0xc56c('0x16')](0x1f4,_0x30a693[_0xc56c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index d86b694..fb44c8a 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 _0x16cc=['whatsappMessage:','save','remove','update','emit','removeListener','register'];(function(_0x5c2a05,_0x1d9712){var _0x45af18=function(_0x395ff1){while(--_0x395ff1){_0x5c2a05['push'](_0x5c2a05['shift']());}};_0x45af18(++_0x1d9712);}(_0x16cc,0x120));var _0xc16c=function(_0x194871,_0x3b7167){_0x194871=_0x194871-0x0;var _0x572804=_0x16cc[_0x194871];return _0x572804;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xc16c('0x0'),_0xc16c('0x1'),_0xc16c('0x2')];function createListener(_0x29c693,_0x203166){return function(_0xef5c6){_0x203166[_0xc16c('0x3')](_0x29c693,_0xef5c6);};}function removeListener(_0x5b0f8b,_0x10c787){return function(){WhatsappMessageEvents[_0xc16c('0x4')](_0x5b0f8b,_0x10c787);};}exports[_0xc16c('0x5')]=function(_0x1019ec){for(var _0x5ea82b=0x0,_0x3492da=events['length'];_0x5ea82b<_0x3492da;_0x5ea82b++){var _0x828798=events[_0x5ea82b];var _0x14d607=createListener(_0xc16c('0x6')+_0x828798,_0x1019ec);WhatsappMessageEvents['on'](_0x828798,_0x14d607);}}; \ No newline at end of file +var _0x853e=['save','remove','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x2984f0,_0x8a04e4){var _0x46f314=function(_0xccd238){while(--_0xccd238){_0x2984f0['push'](_0x2984f0['shift']());}};_0x46f314(++_0x8a04e4);}(_0x853e,0x1e9));var _0xe853=function(_0x43d216,_0x4c5add){_0x43d216=_0x43d216-0x0;var _0x301936=_0x853e[_0x43d216];return _0x301936;};'use strict';var WhatsappMessageEvents=require(_0xe853('0x0'));var events=[_0xe853('0x1'),_0xe853('0x2'),'update'];function createListener(_0x4ead57,_0x44be15){return function(_0x3fb0de){_0x44be15[_0xe853('0x3')](_0x4ead57,_0x3fb0de);};}function removeListener(_0x3a8ff7,_0x1c8900){return function(){WhatsappMessageEvents[_0xe853('0x4')](_0x3a8ff7,_0x1c8900);};}exports['register']=function(_0x516a37){for(var _0xd6c488=0x0,_0x43536c=events[_0xe853('0x5')];_0xd6c488<_0x43536c;_0xd6c488++){var _0x2d1214=events[_0xd6c488];var _0x5204ec=createListener(_0xe853('0x6')+_0x2d1214,_0x516a37);WhatsappMessageEvents['on'](_0x2d1214,_0x5204ec);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index f4bddcf..3b397d1 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 _0x607d=['exports','util','path','connect-timeout','Router','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeAgents'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x607d,0x92));var _0xd607=function(_0x2d9ece,_0x282f1c){_0x2d9ece=_0x2d9ece-0x0;var _0x4e2c19=_0x607d[_0x2d9ece];return _0x4e2c19;};'use strict';var multer=require('multer');var util=require(_0xd607('0x0'));var path=require(_0xd607('0x1'));var timeout=require(_0xd607('0x2'));var express=require('express');var router=express[_0xd607('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd607('0x4'));var controller=require(_0xd607('0x5'));router[_0xd607('0x6')]('/',auth[_0xd607('0x7')](),controller[_0xd607('0x8')]);router[_0xd607('0x6')](_0xd607('0x9'),auth[_0xd607('0x7')](),controller[_0xd607('0xa')]);router[_0xd607('0x6')](_0xd607('0xb'),auth[_0xd607('0x7')](),controller[_0xd607('0xc')]);router[_0xd607('0x6')](_0xd607('0xd'),auth[_0xd607('0x7')](),controller[_0xd607('0xe')]);router[_0xd607('0x6')]('/:id/teams',auth[_0xd607('0x7')](),controller[_0xd607('0xf')]);router[_0xd607('0x6')](_0xd607('0x10'),auth[_0xd607('0x7')](),controller[_0xd607('0x11')]);router[_0xd607('0x12')]('/',auth[_0xd607('0x7')](),controller[_0xd607('0x13')]);router[_0xd607('0x12')](_0xd607('0x14'),auth['isAuthenticated'](),controller[_0xd607('0x15')]);router[_0xd607('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0xd607('0x16')]);router[_0xd607('0x17')](_0xd607('0xb'),auth[_0xd607('0x7')](),controller[_0xd607('0x18')]);router['delete'](_0xd607('0xb'),auth[_0xd607('0x7')](),controller[_0xd607('0x19')]);router[_0xd607('0x1a')](_0xd607('0x14'),auth[_0xd607('0x7')](),controller['removeTeams']);router['delete'](_0xd607('0x10'),auth['isAuthenticated'](),controller[_0xd607('0x1b')]);module[_0xd607('0x1c')]=router; \ No newline at end of file +var _0x5d5f=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/:id','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents'];(function(_0x42a571,_0x481308){var _0x3a547d=function(_0x3ae704){while(--_0x3ae704){_0x42a571['push'](_0x42a571['shift']());}};_0x3a547d(++_0x481308);}(_0x5d5f,0x1d4));var _0xf5d5=function(_0x1d5494,_0x37d387){_0x1d5494=_0x1d5494-0x0;var _0x4f9a51=_0x5d5f[_0x1d5494];return _0x4f9a51;};'use strict';var multer=require(_0xf5d5('0x0'));var util=require(_0xf5d5('0x1'));var path=require(_0xf5d5('0x2'));var timeout=require(_0xf5d5('0x3'));var express=require('express');var router=express[_0xf5d5('0x4')]();var auth=require(_0xf5d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf5d5('0x6'));var controller=require(_0xf5d5('0x7'));router['get']('/',auth[_0xf5d5('0x8')](),controller[_0xf5d5('0x9')]);router[_0xf5d5('0xa')]('/describe',auth[_0xf5d5('0x8')](),controller['describe']);router['get'](_0xf5d5('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf5d5('0xa')]('/:id/members',auth[_0xf5d5('0x8')](),controller[_0xf5d5('0xc')]);router['get'](_0xf5d5('0xd'),auth[_0xf5d5('0x8')](),controller['getTeams']);router[_0xf5d5('0xa')](_0xf5d5('0xe'),auth[_0xf5d5('0x8')](),controller[_0xf5d5('0xf')]);router[_0xf5d5('0x10')]('/',auth['isAuthenticated'](),controller[_0xf5d5('0x11')]);router[_0xf5d5('0x10')](_0xf5d5('0xd'),auth[_0xf5d5('0x8')](),controller[_0xf5d5('0x12')]);router[_0xf5d5('0x10')](_0xf5d5('0xe'),auth['isAuthenticated'](),controller[_0xf5d5('0x13')]);router[_0xf5d5('0x14')](_0xf5d5('0xb'),auth['isAuthenticated'](),controller[_0xf5d5('0x15')]);router[_0xf5d5('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf5d5('0x17')]);router[_0xf5d5('0x16')](_0xf5d5('0xd'),auth[_0xf5d5('0x8')](),controller[_0xf5d5('0x18')]);router[_0xf5d5('0x16')](_0xf5d5('0xe'),auth[_0xf5d5('0x8')](),controller[_0xf5d5('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d94cbe5..1bf45be 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 _0xc243=['sequelize','exports','STRING','INTEGER','ENUM','roundrobin'];(function(_0x79b53e,_0x108f8d){var _0x2d4d6c=function(_0x256d7f){while(--_0x256d7f){_0x79b53e['push'](_0x79b53e['shift']());}};_0x2d4d6c(++_0x108f8d);}(_0xc243,0xd2));var _0x3c24=function(_0x26bbd1,_0xb274f3){_0x26bbd1=_0x26bbd1-0x0;var _0x26b1eb=_0xc243[_0x26bbd1];return _0x26b1eb;};'use strict';var Sequelize=require(_0x3c24('0x0'));module[_0x3c24('0x1')]={'name':{'type':Sequelize[_0x3c24('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3c24('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3c24('0x4')]('rrmemory','beepall',_0x3c24('0x5'))},'description':{'type':Sequelize[_0x3c24('0x2')]}}; \ No newline at end of file +var _0x81ae=['STRING','name','ENUM','rrmemory','beepall','exports'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x81ae,0x1d9));var _0xe81a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x81ae[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');module[_0xe81a('0x0')]={'name':{'type':Sequelize[_0xe81a('0x1')],'unique':_0xe81a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe81a('0x3')](_0xe81a('0x4'),_0xe81a('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xe81a('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 5c8ecaa..9c5c40d 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 _0x72a4=['../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','get','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','each','findOrCreate','emit','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','forEach','addAgents','userWhatsappQueue:save','removeAgents','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x547995,_0x2b72e0){var _0x47f062=function(_0x3d0859){while(--_0x3d0859){_0x547995['push'](_0x547995['shift']());}};_0x47f062(++_0x2b72e0);}(_0x72a4,0x191));var _0x472a=function(_0x3cad1a,_0x4a92c5){_0x3cad1a=_0x3cad1a-0x0;var _0x4b768d=_0x72a4[_0x3cad1a];return _0x4b768d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x472a('0x0'));var rimraf=require(_0x472a('0x1'));var zipdir=require(_0x472a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x472a('0x3'));var moment=require(_0x472a('0x4'));var BPromise=require(_0x472a('0x5'));var Mustache=require(_0x472a('0x6'));var util=require(_0x472a('0x7'));var path=require(_0x472a('0x8'));var sox=require(_0x472a('0x9'));var csv=require(_0x472a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x472a('0xb'));var squel=require(_0x472a('0xc'));var crypto=require(_0x472a('0xd'));var jsforce=require(_0x472a('0xe'));var deskjs=require(_0x472a('0xf'));var toCsv=require(_0x472a('0xa'));var querystring=require(_0x472a('0x10'));var Papa=require(_0x472a('0x11'));var Redis=require(_0x472a('0x12'));var authService=require(_0x472a('0x13'));var qs=require(_0x472a('0x14'));var as=require(_0x472a('0x15'));var hardwareService=require(_0x472a('0x16'));var logger=require(_0x472a('0x17'))(_0x472a('0x18'));var utils=require(_0x472a('0x19'));var config=require(_0x472a('0x1a'));var db=require(_0x472a('0x1b'))['db'];config[_0x472a('0x1c')]=_['defaults'](config['redis'],{'host':_0x472a('0x1d'),'port':0x18eb});var socket=require(_0x472a('0x1e'))(new Redis(config[_0x472a('0x1c')]));require(_0x472a('0x1f'))[_0x472a('0x20')](socket);function respondWithStatusCode(_0x50e92e,_0x14c784){_0x14c784=_0x14c784||0xcc;return function(_0x25dbc7){if(_0x25dbc7){return _0x50e92e[_0x472a('0x21')](_0x14c784);}return _0x50e92e[_0x472a('0x22')](_0x14c784)[_0x472a('0x23')]();};}function respondWithResult(_0x113337,_0x3e470e){_0x3e470e=_0x3e470e||0xc8;return function(_0x4ee351){if(_0x4ee351){return _0x113337[_0x472a('0x22')](_0x3e470e)[_0x472a('0x24')](_0x4ee351);}};}function respondWithFilteredResult(_0x590e03,_0x41f76e){return function(_0x44e8b7){if(_0x44e8b7){var _0x534a03=_0x44e8b7[_0x472a('0x25')],_0x588308=_0x41f76e['offset'],_0x1cd48e=_0x41f76e[_0x472a('0x26')]+_0x41f76e['limit'],_0x540b2a;if(_0x1cd48e>=_0x534a03){_0x1cd48e=_0x534a03;_0x540b2a=0xc8;}else{_0x540b2a=0xce;}_0x590e03[_0x472a('0x22')](_0x540b2a);return _0x590e03[_0x472a('0x27')]('Content-Range',_0x588308+'-'+_0x1cd48e+'/'+_0x534a03)[_0x472a('0x24')](_0x44e8b7);}return null;};}function patchUpdates(_0x31f8fa){return function(_0x3d54f6){try{jsonpatch[_0x472a('0x28')](_0x3d54f6,_0x31f8fa,!![]);}catch(_0x1a6b5e){return BPromise[_0x472a('0x29')](_0x1a6b5e);}return _0x3d54f6['save']();};}function saveUpdates(_0x2e5405,_0x4c6635){return function(_0x645d47){if(_0x645d47){return _0x645d47[_0x472a('0x2a')](_0x2e5405)[_0x472a('0x2b')](function(_0x273fe0){return _0x273fe0;});}return null;};}function removeEntity(_0x23a7fa,_0xfec868){return function(_0x5ec9aa){if(_0x5ec9aa){return _0x5ec9aa[_0x472a('0x2c')]()[_0x472a('0x2b')](function(){var _0x56ed4c=_0x5ec9aa[_0x472a('0x2d')]({'plain':!![]});var _0x1b6250='WhatsappQueues';return db['UserProfileResource'][_0x472a('0x2c')]({'where':{'type':_0x1b6250,'resourceId':_0x56ed4c['id']}})[_0x472a('0x2b')](function(){return _0x5ec9aa;});})['then'](function(){_0x23a7fa[_0x472a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b006,_0x166c95){return function(_0x40dddb){if(!_0x40dddb){_0x28b006[_0x472a('0x21')](0x194);}return _0x40dddb;};}function handleError(_0x4281fc,_0x423897){_0x423897=_0x423897||0x1f4;return function(_0x348fbd){logger[_0x472a('0x2e')](_0x348fbd[_0x472a('0x2f')]);if(_0x348fbd[_0x472a('0x30')]){delete _0x348fbd[_0x472a('0x30')];}_0x4281fc[_0x472a('0x22')](_0x423897)['send'](_0x348fbd);};}exports[_0x472a('0x31')]=function(_0x218831,_0x91a314){var _0x320fbc={},_0xc4ddfb={},_0xaf273e={'count':0x0,'rows':[]};var _0x13bcad=_[_0x472a('0x32')](db[_0x472a('0x33')][_0x472a('0x34')],function(_0x2a841e){return{'name':_0x2a841e[_0x472a('0x35')],'type':_0x2a841e['type'][_0x472a('0x36')]};});_0xc4ddfb[_0x472a('0x37')]=_['map'](_0x13bcad,'name');_0xc4ddfb[_0x472a('0x38')]=_['keys'](_0x218831[_0x472a('0x38')]);_0xc4ddfb[_0x472a('0x39')]=_[_0x472a('0x3a')](_0xc4ddfb['model'],_0xc4ddfb[_0x472a('0x38')]);_0x320fbc[_0x472a('0x3b')]=_[_0x472a('0x3a')](_0xc4ddfb['model'],qs[_0x472a('0x3c')](_0x218831[_0x472a('0x38')][_0x472a('0x3c')]));_0x320fbc[_0x472a('0x3b')]=_0x320fbc['attributes'][_0x472a('0x3d')]?_0x320fbc['attributes']:_0xc4ddfb[_0x472a('0x37')];if(!_0x218831[_0x472a('0x38')][_0x472a('0x3e')](_0x472a('0x3f'))){_0x320fbc[_0x472a('0x40')]=qs[_0x472a('0x40')](_0x218831[_0x472a('0x38')][_0x472a('0x40')]);_0x320fbc['offset']=qs['offset'](_0x218831[_0x472a('0x38')]['offset']);}_0x320fbc[_0x472a('0x41')]=qs[_0x472a('0x42')](_0x218831[_0x472a('0x38')][_0x472a('0x42')]);_0x320fbc[_0x472a('0x43')]=qs[_0x472a('0x39')](_[_0x472a('0x44')](_0x218831[_0x472a('0x38')],_0xc4ddfb[_0x472a('0x39')]),_0x13bcad);if(_0x218831[_0x472a('0x38')][_0x472a('0x45')]){_0x320fbc[_0x472a('0x43')]=_[_0x472a('0x46')](_0x320fbc[_0x472a('0x43')],{'$or':_[_0x472a('0x32')](_0x13bcad,function(_0x57f2c3){if(_0x57f2c3[_0x472a('0x47')]!==_0x472a('0x48')){var _0x1cd8dc={};_0x1cd8dc[_0x57f2c3[_0x472a('0x30')]]={'$like':'%'+_0x218831[_0x472a('0x38')][_0x472a('0x45')]+'%'};return _0x1cd8dc;}})});}_0x320fbc=_['merge']({},_0x320fbc,_0x218831[_0x472a('0x49')]);var _0x5e604c={'where':_0x320fbc[_0x472a('0x43')]};return db[_0x472a('0x33')]['count'](_0x5e604c)['then'](function(_0x270934){_0xaf273e[_0x472a('0x25')]=_0x270934;if(_0x218831['query'][_0x472a('0x4a')]){_0x320fbc['include']=[{'all':!![]}];}return db[_0x472a('0x33')]['findAll'](_0x320fbc);})[_0x472a('0x2b')](function(_0x1dadcd){_0xaf273e[_0x472a('0x4b')]=_0x1dadcd;return _0xaf273e;})[_0x472a('0x2b')](respondWithFilteredResult(_0x91a314,_0x320fbc))['catch'](handleError(_0x91a314,null));};exports[_0x472a('0x4c')]=function(_0x544e7d,_0x232887){var _0x205189={'raw':!![],'where':{'id':_0x544e7d[_0x472a('0x4d')]['id']}},_0x1e0069={};_0x1e0069[_0x472a('0x37')]=_[_0x472a('0x4e')](db[_0x472a('0x33')]['rawAttributes']);_0x1e0069['query']=_[_0x472a('0x4e')](_0x544e7d[_0x472a('0x38')]);_0x1e0069[_0x472a('0x39')]=_[_0x472a('0x3a')](_0x1e0069[_0x472a('0x37')],_0x1e0069['query']);_0x205189[_0x472a('0x3b')]=_[_0x472a('0x3a')](_0x1e0069[_0x472a('0x37')],qs['fields'](_0x544e7d['query'][_0x472a('0x3c')]));_0x205189[_0x472a('0x3b')]=_0x205189[_0x472a('0x3b')]['length']?_0x205189[_0x472a('0x3b')]:_0x1e0069[_0x472a('0x37')];if(_0x544e7d['query']['includeAll']){_0x205189['include']=[{'all':!![]}];}_0x205189=_[_0x472a('0x46')]({},_0x205189,_0x544e7d[_0x472a('0x49')]);return db[_0x472a('0x33')][_0x472a('0x4f')](_0x205189)[_0x472a('0x2b')](handleEntityNotFound(_0x232887,null))['then'](respondWithResult(_0x232887,null))[_0x472a('0x50')](handleError(_0x232887,null));};exports[_0x472a('0x51')]=function(_0x2615be,_0x4938ee){return db[_0x472a('0x33')][_0x472a('0x51')](_0x2615be[_0x472a('0x52')],{})[_0x472a('0x2b')](function(_0x55fb2a){var _0x1c47e9=_0x2615be[_0x472a('0x53')][_0x472a('0x2d')]({'plain':!![]});if(!_0x1c47e9)throw new Error(_0x472a('0x54'));if(_0x1c47e9['role']==='user'){var _0x348fe8=_0x55fb2a[_0x472a('0x2d')]({'plain':!![]});var _0x2bb4b3='WhatsappQueues';return db[_0x472a('0x55')][_0x472a('0x4f')]({'where':{'name':_0x2bb4b3,'userProfileId':_0x1c47e9[_0x472a('0x56')]},'raw':!![]})[_0x472a('0x2b')](function(_0x3cd5ed){if(_0x3cd5ed&&_0x3cd5ed[_0x472a('0x57')]===0x0){return db[_0x472a('0x58')][_0x472a('0x51')]({'name':_0x348fe8['name'],'resourceId':_0x348fe8['id'],'type':_0x3cd5ed[_0x472a('0x30')],'sectionId':_0x3cd5ed['id']},{})[_0x472a('0x2b')](function(){return _0x55fb2a;});}else{return _0x55fb2a;}})[_0x472a('0x50')](function(_0x403e99){logger[_0x472a('0x2e')](_0x472a('0x59'),_0x403e99);throw _0x403e99;});}return _0x55fb2a;})[_0x472a('0x2b')](respondWithResult(_0x4938ee,0xc9))[_0x472a('0x50')](handleError(_0x4938ee,null));};exports[_0x472a('0x2a')]=function(_0x29fa22,_0x29bf7d){if(_0x29fa22['body']['id']){delete _0x29fa22[_0x472a('0x52')]['id'];}return db[_0x472a('0x33')][_0x472a('0x4f')]({'where':{'id':_0x29fa22[_0x472a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29bf7d,null))[_0x472a('0x2b')](saveUpdates(_0x29fa22[_0x472a('0x52')],null))['then'](respondWithResult(_0x29bf7d,null))['catch'](handleError(_0x29bf7d,null));};exports[_0x472a('0x2c')]=function(_0x11b920,_0x221ed9){return db[_0x472a('0x33')][_0x472a('0x4f')]({'where':{'id':_0x11b920[_0x472a('0x4d')]['id']}})[_0x472a('0x2b')](handleEntityNotFound(_0x221ed9,null))[_0x472a('0x2b')](removeEntity(_0x221ed9,null))[_0x472a('0x50')](handleError(_0x221ed9,null));};exports[_0x472a('0x5a')]=function(_0x3629da,_0x526d10){return db[_0x472a('0x33')][_0x472a('0x5a')]()[_0x472a('0x2b')](respondWithResult(_0x526d10,null))[_0x472a('0x50')](handleError(_0x526d10,null));};exports[_0x472a('0x5b')]=function(_0x427ec1,_0x283e00,_0x334a10){var _0x63ed7f={'raw':!![],'where':{}},_0x3e72a7={},_0xdc5d0e;return db[_0x472a('0x33')][_0x472a('0x5c')]({'where':{'id':_0x427ec1[_0x472a('0x4d')]['id']}})[_0x472a('0x2b')](handleEntityNotFound(_0x283e00,null))['then'](function(_0xa80234){if(_0xa80234){_0xdc5d0e=_0xa80234[_0x472a('0x2d')]({'plain':!![]});_0x3e72a7[_0x472a('0x37')]=_[_0x472a('0x4e')](db['UserWhatsappQueue'][_0x472a('0x34')]);_0x3e72a7[_0x472a('0x38')]=_['keys'](_0x427ec1[_0x472a('0x38')]);_0x3e72a7[_0x472a('0x39')]=_[_0x472a('0x3a')](_0x3e72a7[_0x472a('0x37')],_0x3e72a7[_0x472a('0x38')]);_0x63ed7f[_0x472a('0x3b')]=_[_0x472a('0x3a')](_0x3e72a7['model'],qs[_0x472a('0x3c')](_0x427ec1[_0x472a('0x38')][_0x472a('0x3c')]));_0x63ed7f[_0x472a('0x3b')]=_0x63ed7f['attributes'][_0x472a('0x3d')]?_0x63ed7f[_0x472a('0x3b')]:_0x3e72a7[_0x472a('0x37')];if(!_0x427ec1[_0x472a('0x38')][_0x472a('0x3e')]('nolimit')){_0x63ed7f[_0x472a('0x40')]=qs['limit'](_0x427ec1[_0x472a('0x38')]['limit']);_0x63ed7f[_0x472a('0x26')]=qs[_0x472a('0x26')](_0x427ec1[_0x472a('0x38')]['offset']);}_0x63ed7f[_0x472a('0x41')]=qs[_0x472a('0x42')](_0x427ec1[_0x472a('0x38')][_0x472a('0x42')]);_0x63ed7f[_0x472a('0x43')]=qs[_0x472a('0x39')](_[_0x472a('0x44')](_0x427ec1[_0x472a('0x38')],_0x3e72a7[_0x472a('0x39')]));_0x63ed7f[_0x472a('0x43')][_0x472a('0x5d')]=_0xa80234['id'];if(_0x427ec1['query'][_0x472a('0x45')]){_0x63ed7f[_0x472a('0x43')]=_[_0x472a('0x46')](_0x63ed7f[_0x472a('0x43')],{'$or':_['map'](_0x63ed7f[_0x472a('0x3b')],function(_0x1ec8fd){var _0x3f05cb={};_0x3f05cb[_0x1ec8fd]={'$like':'%'+_0x427ec1['query'][_0x472a('0x45')]+'%'};return _0x3f05cb;})});}_0x63ed7f=_[_0x472a('0x46')]({},_0x63ed7f,_0x427ec1[_0x472a('0x49')]);return db[_0x472a('0x5e')][_0x472a('0x5f')](_0x63ed7f);}})[_0x472a('0x2b')](function(_0x21ea83){if(_0x21ea83){return db[_0x472a('0x60')][_0x472a('0x61')]({'where':{'id':_['map'](_0x21ea83,_0x472a('0x62')),'role':_0x472a('0x63')},'attributes':['id',_0x472a('0x30'),_0x472a('0x64'),_0x472a('0x65'),_0x472a('0x66')]});}})[_0x472a('0x2b')](function(_0x5d46d0){if(_0x5d46d0){return{'count':_0x5d46d0[_0x472a('0x25')],'rows':_[_0x472a('0x32')](_0x5d46d0[_0x472a('0x4b')],function(_0xf52941){return{'membername':_0xf52941[_0x472a('0x30')],'UserId':_0xf52941['id'],'queue_name':_0xdc5d0e['name'],'WhatsappQueueId':_0xdc5d0e['id'],'interface':util[_0x472a('0x67')](_0x472a('0x68'),'SIP',_0xf52941[_0x472a('0x30')]),'penalty':0x0,'paused':_0xf52941[_0x472a('0x64')],'createdAt':_0xf52941['createdAt'],'updatedAt':_0xf52941[_0x472a('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x472a('0x2b')](respondWithFilteredResult(_0x283e00,_0x63ed7f))[_0x472a('0x50')](handleError(_0x283e00,null));};exports[_0x472a('0x69')]=function(_0x5234b4,_0x552724,_0x131bfb){var _0x36560d={};var _0xe94180={};var _0x2b8288;var _0x473b07;return db[_0x472a('0x33')][_0x472a('0x5c')]({'where':{'id':_0x5234b4[_0x472a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x552724,null))['then'](function(_0x5c15a3){if(_0x5c15a3){_0x2b8288=_0x5c15a3;_0xe94180[_0x472a('0x37')]=_[_0x472a('0x4e')](db['Team'][_0x472a('0x34')]);_0xe94180[_0x472a('0x38')]=_['keys'](_0x5234b4[_0x472a('0x38')]);_0xe94180['filters']=_[_0x472a('0x3a')](_0xe94180['model'],_0xe94180['query']);_0x36560d[_0x472a('0x3b')]=_[_0x472a('0x3a')](_0xe94180[_0x472a('0x37')],qs[_0x472a('0x3c')](_0x5234b4[_0x472a('0x38')]['fields']));_0x36560d[_0x472a('0x3b')]=_0x36560d[_0x472a('0x3b')][_0x472a('0x3d')]?_0x36560d['attributes']:_0xe94180[_0x472a('0x37')];_0x36560d[_0x472a('0x41')]=qs['sort'](_0x5234b4[_0x472a('0x38')][_0x472a('0x42')]);_0x36560d[_0x472a('0x43')]=qs[_0x472a('0x39')](_[_0x472a('0x44')](_0x5234b4[_0x472a('0x38')],_0xe94180[_0x472a('0x39')]));if(_0x5234b4[_0x472a('0x38')][_0x472a('0x45')]){_0x36560d[_0x472a('0x43')]=_[_0x472a('0x46')](_0x36560d[_0x472a('0x43')],{'$or':_[_0x472a('0x32')](_0x36560d['attributes'],function(_0x238207){var _0x48613a={};_0x48613a[_0x238207]={'$like':'%'+_0x5234b4[_0x472a('0x38')][_0x472a('0x45')]+'%'};return _0x48613a;})});}_0x36560d=_[_0x472a('0x46')]({},_0x36560d,_0x5234b4['options']);return _0x2b8288[_0x472a('0x69')](_0x36560d);}})['then'](function(_0x549a8a){if(_0x549a8a){_0x473b07=_0x549a8a[_0x472a('0x3d')];if(!_0x5234b4[_0x472a('0x38')][_0x472a('0x3e')](_0x472a('0x3f'))){_0x36560d[_0x472a('0x40')]=qs[_0x472a('0x40')](_0x5234b4['query'][_0x472a('0x40')]);_0x36560d[_0x472a('0x26')]=qs[_0x472a('0x26')](_0x5234b4[_0x472a('0x38')][_0x472a('0x26')]);}return _0x2b8288['getTeams'](_0x36560d);}})[_0x472a('0x2b')](function(_0x383f19){if(_0x383f19){return _0x383f19?{'count':_0x473b07,'rows':_0x383f19}:null;}})[_0x472a('0x2b')](respondWithResult(_0x552724,null))['catch'](handleError(_0x552724,null));};exports[_0x472a('0x6a')]=function(_0x53ebc5,_0x214d75,_0x5eaacd){var _0x345bc5=_0x53ebc5['body'][_0x472a('0x6b')];return db['Team']['findAll']({'where':{'id':_0x345bc5},'attributes':['id'],'include':[{'model':db[_0x472a('0x60')],'as':_0x472a('0x6c'),'attributes':['id','name',_0x472a('0x6d'),'voicePause',_0x472a('0x6e')],'raw':!![]}]})[_0x472a('0x2b')](function(_0x1fb818){if(_0x1fb818){var _0x2902a1=_[_0x472a('0x6f')](_0x1fb818,function(_0x2da469){var _0x379c3b=_0x2da469[_0x472a('0x2d')]({'plain':!![]});return _0x379c3b['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x53ebc5['params']['id']}})[_0x472a('0x2b')](function(_0x168986){return db[_0x472a('0x70')]['transaction'](function(_0x2e151b){return _0x168986[_0x472a('0x6a')](_0x345bc5,{'transaction':_0x2e151b})[_0x472a('0x2b')](function(){return BPromise[_0x472a('0x71')](_0x2902a1,function(_0x492f6e){return db[_0x472a('0x5e')][_0x472a('0x72')]({'where':{'UserId':_0x492f6e['id'],'WhatsappQueueId':_0x53ebc5[_0x472a('0x4d')]['id']},'transaction':_0x2e151b});});})[_0x472a('0x2b')](function(){_0x2902a1['forEach'](function(_0x43d008){socket[_0x472a('0x73')]('userWhatsappQueue:save',{'UserId':_0x43d008['id'],'WhatsappQueueId':_0x168986['id']});});});});});}})[_0x472a('0x2b')](respondWithStatusCode(_0x214d75,null))['catch'](handleError(_0x214d75,null));};exports[_0x472a('0x74')]=function(_0x325cca,_0x3d0360,_0x1bd7f2){return db['Team']['findAll']({'where':{'id':_0x325cca[_0x472a('0x38')][_0x472a('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x472a('0x60')],'as':_0x472a('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x472a('0x2b')](handleEntityNotFound(_0x3d0360,null))[_0x472a('0x2b')](function(_0x103d16){var _0x2e7cbd=_[_0x472a('0x32')](_0x103d16,'id');var _0x39ec57=[];var _0x5b36fd=[];var _0x42375a=squel['select']();_0x42375a[_0x472a('0x75')](_0x472a('0x76'))[_0x472a('0x77')](_0x472a('0x78'),'tq')[_0x472a('0x79')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x472a('0x43')](_0x472a('0x7a'),_0x325cca[_0x472a('0x4d')]['id']);for(var _0x8d2440=0x0;_0x8d2440<_0x103d16[_0x472a('0x3d')];_0x8d2440+=0x1){let _0x15e2d3=_0x103d16[_0x8d2440];for(var _0xf95927=0x0;_0xf95927<_0x15e2d3[_0x472a('0x6c')][_0x472a('0x3d')];_0xf95927+=0x1){let _0x41aabc=_0x15e2d3[_0x472a('0x6c')][_0xf95927];var _0x54f581=_0x42375a[_0x472a('0x7b')]();_0x54f581['where'](_0x472a('0x7c'),_0x41aabc['id']);_0x5b36fd[_0x472a('0x7d')](db['sequelize'][_0x472a('0x38')](_0x54f581[_0x472a('0x7e')](),{'type':db[_0x472a('0x70')]['QueryTypes'][_0x472a('0x7f')]})['then'](function(_0x5db38d){if(_0x5db38d[_0x472a('0x3d')]===0x1){return _0x41aabc['id'];}else{var _0x133cba=_[_0x472a('0x80')](_[_0x472a('0x32')](_0x5db38d,_0x472a('0x81')),function(_0x58da70){return _[_0x472a('0x82')](_0x2e7cbd,_0x58da70);});if(_0x133cba){return _0x41aabc['id'];}}}));}}return BPromise[_0x472a('0x83')](_0x5b36fd)[_0x472a('0x2b')](function(_0x35e541){_0x39ec57=_(_0x39ec57)['union'](_0x35e541)[_0x472a('0x84')]()[_0x472a('0x85')]();return db[_0x472a('0x33')]['find']({'where':{'id':_0x325cca[_0x472a('0x4d')]['id']}})[_0x472a('0x2b')](function(_0x1b3b3){return db[_0x472a('0x70')][_0x472a('0x86')](function(_0x2b8db7){return _0x1b3b3['removeTeams'](_0x325cca['query']['ids'],{'transaction':_0x2b8db7})[_0x472a('0x2b')](function(){if(!_[_0x472a('0x87')](_0x39ec57)){return _0x1b3b3['removeAgents'](_0x39ec57,{'transaction':_0x2b8db7});}})[_0x472a('0x2b')](function(){_0x39ec57[_0x472a('0x88')](function(_0xe0dd51){socket[_0x472a('0x73')]('userWhatsappQueue:remove',{'UserId':_0xe0dd51,'WhatsappQueueId':_0x1b3b3['id']});});});});});});})[_0x472a('0x2b')](respondWithStatusCode(_0x3d0360,null))['catch'](handleError(_0x3d0360,null));};exports[_0x472a('0x89')]=function(_0x3b2535,_0x3f0be1,_0x48f599){return db['WhatsappQueue'][_0x472a('0x4f')]({'where':{'id':_0x3b2535[_0x472a('0x4d')]['id']}})[_0x472a('0x2b')](handleEntityNotFound(_0x3f0be1,null))[_0x472a('0x2b')](function(_0x430e67){if(_0x430e67){return _0x430e67[_0x472a('0x89')](_0x3b2535['body']['ids'],_['omit'](_0x3b2535[_0x472a('0x52')],[_0x472a('0x6b'),'id'])||{})['spread'](function(_0xd20ed7){for(var _0x212fa0=0x0;_0x212fa0<_0x3b2535['body'][_0x472a('0x6b')][_0x472a('0x3d')];_0x212fa0+=0x1){socket['emit'](_0x472a('0x8a'),{'UserId':_0x3b2535[_0x472a('0x52')][_0x472a('0x6b')][_0x212fa0],'WhatsappQueueId':_0x3b2535[_0x472a('0x4d')]['id']});}return _0xd20ed7;});}})['then'](respondWithResult(_0x3f0be1,null))['catch'](handleError(_0x3f0be1,null));};exports[_0x472a('0x8b')]=function(_0x3c9ad4,_0x3b7b1f,_0x3b84a9){return db['WhatsappQueue'][_0x472a('0x4f')]({'where':{'id':_0x3c9ad4[_0x472a('0x4d')]['id']}})[_0x472a('0x2b')](handleEntityNotFound(_0x3b7b1f,null))[_0x472a('0x2b')](function(_0x16048a){if(_0x16048a){return _0x16048a[_0x472a('0x8b')](_0x3c9ad4[_0x472a('0x38')][_0x472a('0x6b')])[_0x472a('0x2b')](function(){if(_['isArray'](_0x3c9ad4[_0x472a('0x38')][_0x472a('0x6b')])){for(var _0xb8d257=0x0;_0xb8d257<_0x3c9ad4['query']['ids']['length'];_0xb8d257+=0x1){socket[_0x472a('0x73')]('userWhatsappQueue:remove',{'UserId':Number(_0x3c9ad4[_0x472a('0x38')]['ids'][_0xb8d257]),'WhatsappQueueId':Number(_0x3c9ad4['params']['id'])});}}else{socket[_0x472a('0x73')](_0x472a('0x8c'),{'UserId':Number(_0x3c9ad4[_0x472a('0x38')][_0x472a('0x6b')]),'WhatsappQueueId':Number(_0x3c9ad4[_0x472a('0x4d')]['id'])});}});}})[_0x472a('0x2b')](respondWithStatusCode(_0x3b7b1f,null))[_0x472a('0x50')](handleError(_0x3b7b1f,null));};exports[_0x472a('0x8d')]=function(_0x3a5805,_0x36dc8a,_0x36a144){var _0x30dc9d={};var _0x4e2860={};var _0x17d0e5;var _0x478a6a;return db[_0x472a('0x33')][_0x472a('0x5c')]({'where':{'id':_0x3a5805[_0x472a('0x4d')]['id']}})[_0x472a('0x2b')](handleEntityNotFound(_0x36dc8a,null))[_0x472a('0x2b')](function(_0x43cb4b){if(_0x43cb4b){_0x17d0e5=_0x43cb4b;_0x4e2860['model']=_[_0x472a('0x4e')](db[_0x472a('0x60')][_0x472a('0x34')]);_0x4e2860[_0x472a('0x38')]=_[_0x472a('0x4e')](_0x3a5805[_0x472a('0x38')]);_0x4e2860[_0x472a('0x39')]=_[_0x472a('0x3a')](_0x4e2860[_0x472a('0x37')],_0x4e2860[_0x472a('0x38')]);_0x30dc9d[_0x472a('0x3b')]=_[_0x472a('0x3a')](_0x4e2860[_0x472a('0x37')],qs['fields'](_0x3a5805[_0x472a('0x38')][_0x472a('0x3c')]));_0x30dc9d[_0x472a('0x3b')]=_0x30dc9d[_0x472a('0x3b')][_0x472a('0x3d')]?_0x30dc9d[_0x472a('0x3b')]:_0x4e2860['model'];_0x30dc9d['order']=qs[_0x472a('0x42')](_0x3a5805[_0x472a('0x38')][_0x472a('0x42')]);_0x30dc9d[_0x472a('0x43')]=qs[_0x472a('0x39')](_[_0x472a('0x44')](_0x3a5805['query'],_0x4e2860[_0x472a('0x39')]));if(_0x3a5805['query'][_0x472a('0x45')]){_0x30dc9d[_0x472a('0x43')]=_[_0x472a('0x46')](_0x30dc9d['where'],{'$or':_[_0x472a('0x32')](_0x30dc9d['attributes'],function(_0x21a70b){var _0x18699d={};_0x18699d[_0x21a70b]={'$like':'%'+_0x3a5805[_0x472a('0x38')][_0x472a('0x45')]+'%'};return _0x18699d;})});}_0x30dc9d=_[_0x472a('0x46')]({},_0x30dc9d,_0x3a5805[_0x472a('0x49')]);return _0x17d0e5['getAgents'](_0x30dc9d);}})[_0x472a('0x2b')](function(_0x658f88){if(_0x658f88){_0x478a6a=_0x658f88[_0x472a('0x3d')];if(!_0x3a5805[_0x472a('0x38')][_0x472a('0x3e')]('nolimit')){_0x30dc9d[_0x472a('0x40')]=qs[_0x472a('0x40')](_0x3a5805[_0x472a('0x38')][_0x472a('0x40')]);_0x30dc9d[_0x472a('0x26')]=qs['offset'](_0x3a5805[_0x472a('0x38')][_0x472a('0x26')]);}return _0x17d0e5[_0x472a('0x8d')](_0x30dc9d);}})[_0x472a('0x2b')](function(_0x112b24){if(_0x112b24){return _0x112b24?{'count':_0x478a6a,'rows':_0x112b24}:null;}})[_0x472a('0x2b')](respondWithResult(_0x36dc8a,null))[_0x472a('0x50')](handleError(_0x36dc8a,null));}; \ No newline at end of file +var _0x83a8=['forEach','userWhatsappQueue:remove','addAgents','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','socket.io-emitter','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','include','catch','show','params','includeAll','options','find','create','body','user','role','WhatsappQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','findOrCreate','emit','userWhatsappQueue:save','removeTeams','findAll','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction'];(function(_0x3da6b4,_0x32134c){var _0x4acfab=function(_0x1c0d26){while(--_0x1c0d26){_0x3da6b4['push'](_0x3da6b4['shift']());}};_0x4acfab(++_0x32134c);}(_0x83a8,0x112));var _0x883a=function(_0x42f0f7,_0x323158){_0x42f0f7=_0x42f0f7-0x0;var _0x1227e2=_0x83a8[_0x42f0f7];return _0x1227e2;};'use strict';var pdf=require(_0x883a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x883a('0x1'));var zipdir=require(_0x883a('0x2'));var jsonpatch=require(_0x883a('0x3'));var rp=require(_0x883a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x883a('0x5'));var util=require(_0x883a('0x6'));var path=require(_0x883a('0x7'));var sox=require('sox');var csv=require(_0x883a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x883a('0x9'));var squel=require(_0x883a('0xa'));var crypto=require(_0x883a('0xb'));var jsforce=require(_0x883a('0xc'));var deskjs=require(_0x883a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x883a('0xe'));var Papa=require(_0x883a('0xf'));var Redis=require(_0x883a('0x10'));var authService=require(_0x883a('0x11'));var qs=require(_0x883a('0x12'));var as=require(_0x883a('0x13'));var hardwareService=require(_0x883a('0x14'));var logger=require(_0x883a('0x15'))('api');var utils=require(_0x883a('0x16'));var config=require(_0x883a('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x883a('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x883a('0x19'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x3776b0,_0x58f7f5){_0x58f7f5=_0x58f7f5||0xcc;return function(_0x4abdbe){if(_0x4abdbe){return _0x3776b0[_0x883a('0x1a')](_0x58f7f5);}return _0x3776b0['status'](_0x58f7f5)[_0x883a('0x1b')]();};}function respondWithResult(_0xad59fa,_0x13bd1e){_0x13bd1e=_0x13bd1e||0xc8;return function(_0x47b5e0){if(_0x47b5e0){return _0xad59fa[_0x883a('0x1c')](_0x13bd1e)[_0x883a('0x1d')](_0x47b5e0);}};}function respondWithFilteredResult(_0x31830e,_0x2b07c9){return function(_0x4a30e2){if(_0x4a30e2){var _0x4736e0=_0x4a30e2[_0x883a('0x1e')],_0x763066=_0x2b07c9['offset'],_0x54db95=_0x2b07c9[_0x883a('0x1f')]+_0x2b07c9[_0x883a('0x20')],_0x4cfd33;if(_0x54db95>=_0x4736e0){_0x54db95=_0x4736e0;_0x4cfd33=0xc8;}else{_0x4cfd33=0xce;}_0x31830e['status'](_0x4cfd33);return _0x31830e['set'](_0x883a('0x21'),_0x763066+'-'+_0x54db95+'/'+_0x4736e0)[_0x883a('0x1d')](_0x4a30e2);}return null;};}function patchUpdates(_0xe4c684){return function(_0x5657cf){try{jsonpatch[_0x883a('0x22')](_0x5657cf,_0xe4c684,!![]);}catch(_0x411383){return BPromise['reject'](_0x411383);}return _0x5657cf[_0x883a('0x23')]();};}function saveUpdates(_0x5edf83,_0x419827){return function(_0x3d7cc2){if(_0x3d7cc2){return _0x3d7cc2['update'](_0x5edf83)[_0x883a('0x24')](function(_0x2b5ef8){return _0x2b5ef8;});}return null;};}function removeEntity(_0x2c98b8,_0x1615dc){return function(_0x5c8a16){if(_0x5c8a16){return _0x5c8a16[_0x883a('0x25')]()['then'](function(){var _0x9c8eca=_0x5c8a16[_0x883a('0x26')]({'plain':!![]});var _0x3131ce='WhatsappQueues';return db[_0x883a('0x27')][_0x883a('0x25')]({'where':{'type':_0x3131ce,'resourceId':_0x9c8eca['id']}})[_0x883a('0x24')](function(){return _0x5c8a16;});})[_0x883a('0x24')](function(){_0x2c98b8[_0x883a('0x1c')](0xcc)[_0x883a('0x1b')]();});}};}function handleEntityNotFound(_0x283cb6,_0x3fc026){return function(_0x4ae240){if(!_0x4ae240){_0x283cb6[_0x883a('0x1a')](0x194);}return _0x4ae240;};}function handleError(_0x545516,_0x16c33b){_0x16c33b=_0x16c33b||0x1f4;return function(_0x2bd0d7){logger[_0x883a('0x28')](_0x2bd0d7[_0x883a('0x29')]);if(_0x2bd0d7[_0x883a('0x2a')]){delete _0x2bd0d7[_0x883a('0x2a')];}_0x545516[_0x883a('0x1c')](_0x16c33b)[_0x883a('0x2b')](_0x2bd0d7);};}exports[_0x883a('0x2c')]=function(_0x326b10,_0x150b12){var _0x5b6183={},_0x4f876d={},_0xb9a4a0={'count':0x0,'rows':[]};var _0x525ac0=_[_0x883a('0x2d')](db[_0x883a('0x2e')][_0x883a('0x2f')],function(_0xadda88){return{'name':_0xadda88[_0x883a('0x30')],'type':_0xadda88[_0x883a('0x31')]['key']};});_0x4f876d[_0x883a('0x32')]=_[_0x883a('0x2d')](_0x525ac0,_0x883a('0x2a'));_0x4f876d['query']=_[_0x883a('0x33')](_0x326b10['query']);_0x4f876d[_0x883a('0x34')]=_['intersection'](_0x4f876d[_0x883a('0x32')],_0x4f876d[_0x883a('0x35')]);_0x5b6183[_0x883a('0x36')]=_[_0x883a('0x37')](_0x4f876d['model'],qs[_0x883a('0x38')](_0x326b10[_0x883a('0x35')][_0x883a('0x38')]));_0x5b6183[_0x883a('0x36')]=_0x5b6183[_0x883a('0x36')][_0x883a('0x39')]?_0x5b6183['attributes']:_0x4f876d[_0x883a('0x32')];if(!_0x326b10['query'][_0x883a('0x3a')](_0x883a('0x3b'))){_0x5b6183[_0x883a('0x20')]=qs[_0x883a('0x20')](_0x326b10[_0x883a('0x35')][_0x883a('0x20')]);_0x5b6183[_0x883a('0x1f')]=qs[_0x883a('0x1f')](_0x326b10[_0x883a('0x35')][_0x883a('0x1f')]);}_0x5b6183[_0x883a('0x3c')]=qs[_0x883a('0x3d')](_0x326b10[_0x883a('0x35')][_0x883a('0x3d')]);_0x5b6183[_0x883a('0x3e')]=qs[_0x883a('0x34')](_[_0x883a('0x3f')](_0x326b10['query'],_0x4f876d[_0x883a('0x34')]),_0x525ac0);if(_0x326b10['query']['filter']){_0x5b6183[_0x883a('0x3e')]=_[_0x883a('0x40')](_0x5b6183[_0x883a('0x3e')],{'$or':_['map'](_0x525ac0,function(_0x54ae82){if(_0x54ae82['type']!=='VIRTUAL'){var _0x155ca2={};_0x155ca2[_0x54ae82[_0x883a('0x2a')]]={'$like':'%'+_0x326b10[_0x883a('0x35')][_0x883a('0x41')]+'%'};return _0x155ca2;}})});}_0x5b6183=_[_0x883a('0x40')]({},_0x5b6183,_0x326b10['options']);var _0x40e022={'where':_0x5b6183[_0x883a('0x3e')]};return db['WhatsappQueue'][_0x883a('0x1e')](_0x40e022)[_0x883a('0x24')](function(_0x282fee){_0xb9a4a0[_0x883a('0x1e')]=_0x282fee;if(_0x326b10['query']['includeAll']){_0x5b6183[_0x883a('0x42')]=[{'all':!![]}];}return db[_0x883a('0x2e')]['findAll'](_0x5b6183);})[_0x883a('0x24')](function(_0xc912e){_0xb9a4a0['rows']=_0xc912e;return _0xb9a4a0;})[_0x883a('0x24')](respondWithFilteredResult(_0x150b12,_0x5b6183))[_0x883a('0x43')](handleError(_0x150b12,null));};exports[_0x883a('0x44')]=function(_0x2b9c85,_0x3480d8){var _0x16bef4={'raw':!![],'where':{'id':_0x2b9c85[_0x883a('0x45')]['id']}},_0x22d003={};_0x22d003[_0x883a('0x32')]=_[_0x883a('0x33')](db[_0x883a('0x2e')][_0x883a('0x2f')]);_0x22d003[_0x883a('0x35')]=_[_0x883a('0x33')](_0x2b9c85[_0x883a('0x35')]);_0x22d003[_0x883a('0x34')]=_[_0x883a('0x37')](_0x22d003['model'],_0x22d003[_0x883a('0x35')]);_0x16bef4['attributes']=_['intersection'](_0x22d003['model'],qs[_0x883a('0x38')](_0x2b9c85[_0x883a('0x35')]['fields']));_0x16bef4[_0x883a('0x36')]=_0x16bef4['attributes'][_0x883a('0x39')]?_0x16bef4[_0x883a('0x36')]:_0x22d003['model'];if(_0x2b9c85[_0x883a('0x35')][_0x883a('0x46')]){_0x16bef4['include']=[{'all':!![]}];}_0x16bef4=_[_0x883a('0x40')]({},_0x16bef4,_0x2b9c85[_0x883a('0x47')]);return db[_0x883a('0x2e')][_0x883a('0x48')](_0x16bef4)[_0x883a('0x24')](handleEntityNotFound(_0x3480d8,null))['then'](respondWithResult(_0x3480d8,null))[_0x883a('0x43')](handleError(_0x3480d8,null));};exports[_0x883a('0x49')]=function(_0x3153ba,_0x1af4ca){return db['WhatsappQueue'][_0x883a('0x49')](_0x3153ba[_0x883a('0x4a')],{})[_0x883a('0x24')](function(_0x3655aa){var _0x4e257a=_0x3153ba[_0x883a('0x4b')][_0x883a('0x26')]({'plain':!![]});if(!_0x4e257a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e257a[_0x883a('0x4c')]===_0x883a('0x4b')){var _0x37a257=_0x3655aa['get']({'plain':!![]});var _0x55d050=_0x883a('0x4d');return db[_0x883a('0x4e')][_0x883a('0x48')]({'where':{'name':_0x55d050,'userProfileId':_0x4e257a[_0x883a('0x4f')]},'raw':!![]})[_0x883a('0x24')](function(_0x5dc81e){if(_0x5dc81e&&_0x5dc81e['autoAssociation']===0x0){return db[_0x883a('0x27')][_0x883a('0x49')]({'name':_0x37a257[_0x883a('0x2a')],'resourceId':_0x37a257['id'],'type':_0x5dc81e[_0x883a('0x2a')],'sectionId':_0x5dc81e['id']},{})[_0x883a('0x24')](function(){return _0x3655aa;});}else{return _0x3655aa;}})['catch'](function(_0x194f2a){logger[_0x883a('0x28')](_0x883a('0x50'),_0x194f2a);throw _0x194f2a;});}return _0x3655aa;})[_0x883a('0x24')](respondWithResult(_0x1af4ca,0xc9))[_0x883a('0x43')](handleError(_0x1af4ca,null));};exports[_0x883a('0x51')]=function(_0x4889b9,_0xfb94f8){if(_0x4889b9[_0x883a('0x4a')]['id']){delete _0x4889b9[_0x883a('0x4a')]['id'];}return db[_0x883a('0x2e')]['find']({'where':{'id':_0x4889b9[_0x883a('0x45')]['id']}})[_0x883a('0x24')](handleEntityNotFound(_0xfb94f8,null))['then'](saveUpdates(_0x4889b9[_0x883a('0x4a')],null))[_0x883a('0x24')](respondWithResult(_0xfb94f8,null))['catch'](handleError(_0xfb94f8,null));};exports[_0x883a('0x25')]=function(_0x4105bf,_0x30952f){return db[_0x883a('0x2e')][_0x883a('0x48')]({'where':{'id':_0x4105bf[_0x883a('0x45')]['id']}})[_0x883a('0x24')](handleEntityNotFound(_0x30952f,null))[_0x883a('0x24')](removeEntity(_0x30952f,null))['catch'](handleError(_0x30952f,null));};exports[_0x883a('0x52')]=function(_0x23abde,_0x5c6559){return db[_0x883a('0x2e')][_0x883a('0x52')]()[_0x883a('0x24')](respondWithResult(_0x5c6559,null))['catch'](handleError(_0x5c6559,null));};exports[_0x883a('0x53')]=function(_0x4ee165,_0x2d733d,_0x68bd22){var _0x417482={'raw':!![],'where':{}},_0x3d0f29={},_0x98a1a3;return db[_0x883a('0x2e')][_0x883a('0x54')]({'where':{'id':_0x4ee165[_0x883a('0x45')]['id']}})[_0x883a('0x24')](handleEntityNotFound(_0x2d733d,null))[_0x883a('0x24')](function(_0x5a9688){if(_0x5a9688){_0x98a1a3=_0x5a9688[_0x883a('0x26')]({'plain':!![]});_0x3d0f29[_0x883a('0x32')]=_[_0x883a('0x33')](db[_0x883a('0x55')][_0x883a('0x2f')]);_0x3d0f29[_0x883a('0x35')]=_[_0x883a('0x33')](_0x4ee165['query']);_0x3d0f29['filters']=_[_0x883a('0x37')](_0x3d0f29[_0x883a('0x32')],_0x3d0f29[_0x883a('0x35')]);_0x417482['attributes']=_[_0x883a('0x37')](_0x3d0f29['model'],qs['fields'](_0x4ee165[_0x883a('0x35')][_0x883a('0x38')]));_0x417482[_0x883a('0x36')]=_0x417482[_0x883a('0x36')][_0x883a('0x39')]?_0x417482['attributes']:_0x3d0f29['model'];if(!_0x4ee165['query'][_0x883a('0x3a')]('nolimit')){_0x417482[_0x883a('0x20')]=qs[_0x883a('0x20')](_0x4ee165[_0x883a('0x35')]['limit']);_0x417482[_0x883a('0x1f')]=qs[_0x883a('0x1f')](_0x4ee165[_0x883a('0x35')][_0x883a('0x1f')]);}_0x417482['order']=qs[_0x883a('0x3d')](_0x4ee165[_0x883a('0x35')][_0x883a('0x3d')]);_0x417482[_0x883a('0x3e')]=qs[_0x883a('0x34')](_[_0x883a('0x3f')](_0x4ee165['query'],_0x3d0f29[_0x883a('0x34')]));_0x417482[_0x883a('0x3e')][_0x883a('0x56')]=_0x5a9688['id'];if(_0x4ee165[_0x883a('0x35')]['filter']){_0x417482['where']=_[_0x883a('0x40')](_0x417482[_0x883a('0x3e')],{'$or':_[_0x883a('0x2d')](_0x417482['attributes'],function(_0x28d899){var _0x9b39bb={};_0x9b39bb[_0x28d899]={'$like':'%'+_0x4ee165[_0x883a('0x35')]['filter']+'%'};return _0x9b39bb;})});}_0x417482=_[_0x883a('0x40')]({},_0x417482,_0x4ee165['options']);return db[_0x883a('0x55')]['findAll'](_0x417482);}})[_0x883a('0x24')](function(_0x378be1){if(_0x378be1){return db[_0x883a('0x57')][_0x883a('0x58')]({'where':{'id':_[_0x883a('0x2d')](_0x378be1,'UserId'),'role':_0x883a('0x59')},'attributes':['id',_0x883a('0x2a'),_0x883a('0x5a'),_0x883a('0x5b'),_0x883a('0x5c')]});}})[_0x883a('0x24')](function(_0x27580b){if(_0x27580b){return{'count':_0x27580b[_0x883a('0x1e')],'rows':_[_0x883a('0x2d')](_0x27580b[_0x883a('0x5d')],function(_0x2c582d){return{'membername':_0x2c582d[_0x883a('0x2a')],'UserId':_0x2c582d['id'],'queue_name':_0x98a1a3[_0x883a('0x2a')],'WhatsappQueueId':_0x98a1a3['id'],'interface':util[_0x883a('0x5e')](_0x883a('0x5f'),_0x883a('0x60'),_0x2c582d[_0x883a('0x2a')]),'penalty':0x0,'paused':_0x2c582d['whatsappPause'],'createdAt':_0x2c582d[_0x883a('0x5c')],'updatedAt':_0x2c582d[_0x883a('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2d733d,_0x417482))['catch'](handleError(_0x2d733d,null));};exports[_0x883a('0x61')]=function(_0x316a03,_0x259068,_0x997e4e){var _0x274cfe={};var _0x920eb={};var _0x296bf1;var _0x56e5ca;return db[_0x883a('0x2e')][_0x883a('0x54')]({'where':{'id':_0x316a03[_0x883a('0x45')]['id']}})[_0x883a('0x24')](handleEntityNotFound(_0x259068,null))['then'](function(_0x5dbb41){if(_0x5dbb41){_0x296bf1=_0x5dbb41;_0x920eb[_0x883a('0x32')]=_[_0x883a('0x33')](db[_0x883a('0x62')][_0x883a('0x2f')]);_0x920eb[_0x883a('0x35')]=_['keys'](_0x316a03[_0x883a('0x35')]);_0x920eb['filters']=_['intersection'](_0x920eb[_0x883a('0x32')],_0x920eb['query']);_0x274cfe[_0x883a('0x36')]=_['intersection'](_0x920eb['model'],qs[_0x883a('0x38')](_0x316a03['query'][_0x883a('0x38')]));_0x274cfe[_0x883a('0x36')]=_0x274cfe[_0x883a('0x36')]['length']?_0x274cfe['attributes']:_0x920eb[_0x883a('0x32')];_0x274cfe[_0x883a('0x3c')]=qs[_0x883a('0x3d')](_0x316a03[_0x883a('0x35')]['sort']);_0x274cfe['where']=qs['filters'](_[_0x883a('0x3f')](_0x316a03[_0x883a('0x35')],_0x920eb['filters']));if(_0x316a03[_0x883a('0x35')]['filter']){_0x274cfe['where']=_[_0x883a('0x40')](_0x274cfe[_0x883a('0x3e')],{'$or':_[_0x883a('0x2d')](_0x274cfe[_0x883a('0x36')],function(_0x162b5f){var _0x3de8dc={};_0x3de8dc[_0x162b5f]={'$like':'%'+_0x316a03[_0x883a('0x35')]['filter']+'%'};return _0x3de8dc;})});}_0x274cfe=_[_0x883a('0x40')]({},_0x274cfe,_0x316a03[_0x883a('0x47')]);return _0x296bf1[_0x883a('0x61')](_0x274cfe);}})[_0x883a('0x24')](function(_0xdd6e4e){if(_0xdd6e4e){_0x56e5ca=_0xdd6e4e['length'];if(!_0x316a03[_0x883a('0x35')][_0x883a('0x3a')](_0x883a('0x3b'))){_0x274cfe[_0x883a('0x20')]=qs[_0x883a('0x20')](_0x316a03[_0x883a('0x35')][_0x883a('0x20')]);_0x274cfe[_0x883a('0x1f')]=qs[_0x883a('0x1f')](_0x316a03[_0x883a('0x35')]['offset']);}return _0x296bf1[_0x883a('0x61')](_0x274cfe);}})[_0x883a('0x24')](function(_0x80541f){if(_0x80541f){return _0x80541f?{'count':_0x56e5ca,'rows':_0x80541f}:null;}})[_0x883a('0x24')](respondWithResult(_0x259068,null))['catch'](handleError(_0x259068,null));};exports[_0x883a('0x63')]=function(_0x545c23,_0x11a528,_0x57a518){var _0x159ccb=_0x545c23[_0x883a('0x4a')][_0x883a('0x64')];return db[_0x883a('0x62')]['findAll']({'where':{'id':_0x159ccb},'attributes':['id'],'include':[{'model':db[_0x883a('0x57')],'as':_0x883a('0x65'),'attributes':['id','name',_0x883a('0x66'),_0x883a('0x67'),'interface'],'raw':!![]}]})[_0x883a('0x24')](function(_0x3b49ab){if(_0x3b49ab){var _0x3d8c33=_[_0x883a('0x68')](_0x3b49ab,function(_0x11bd55){var _0x1fdaa3=_0x11bd55[_0x883a('0x26')]({'plain':!![]});return _0x1fdaa3[_0x883a('0x65')];});return db['WhatsappQueue'][_0x883a('0x48')]({'where':{'id':_0x545c23['params']['id']}})[_0x883a('0x24')](function(_0x97dc49){return db['sequelize']['transaction'](function(_0x1be83d){return _0x97dc49[_0x883a('0x63')](_0x159ccb,{'transaction':_0x1be83d})[_0x883a('0x24')](function(){return BPromise['each'](_0x3d8c33,function(_0x3b3a9b){return db[_0x883a('0x55')][_0x883a('0x69')]({'where':{'UserId':_0x3b3a9b['id'],'WhatsappQueueId':_0x545c23[_0x883a('0x45')]['id']},'transaction':_0x1be83d});});})[_0x883a('0x24')](function(){_0x3d8c33['forEach'](function(_0x490eed){socket[_0x883a('0x6a')](_0x883a('0x6b'),{'UserId':_0x490eed['id'],'WhatsappQueueId':_0x97dc49['id']});});});});});}})[_0x883a('0x24')](respondWithStatusCode(_0x11a528,null))[_0x883a('0x43')](handleError(_0x11a528,null));};exports[_0x883a('0x6c')]=function(_0x59fc94,_0x13c17f,_0x267d5c){return db['Team'][_0x883a('0x6d')]({'where':{'id':_0x59fc94['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x883a('0x57')],'as':_0x883a('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x13c17f,null))[_0x883a('0x24')](function(_0x30c350){var _0x127937=_['map'](_0x30c350,'id');var _0x1c3cd5=[];var _0x22c180=[];var _0x1b69ba=squel[_0x883a('0x6e')]();_0x1b69ba['field'](_0x883a('0x6f'))[_0x883a('0x70')](_0x883a('0x71'),'tq')[_0x883a('0x72')](_0x883a('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x883a('0x3e')]('WhatsappQueueId\x20=\x20?',_0x59fc94[_0x883a('0x45')]['id']);for(var _0x1b69d3=0x0;_0x1b69d3<_0x30c350['length'];_0x1b69d3+=0x1){let _0x4e0c14=_0x30c350[_0x1b69d3];for(var _0x168a54=0x0;_0x168a54<_0x4e0c14[_0x883a('0x65')][_0x883a('0x39')];_0x168a54+=0x1){let _0x5af36e=_0x4e0c14[_0x883a('0x65')][_0x168a54];var _0x29b46e=_0x1b69ba[_0x883a('0x74')]();_0x29b46e['where']('ut.UserId\x20=\x20?',_0x5af36e['id']);_0x22c180[_0x883a('0x75')](db[_0x883a('0x76')][_0x883a('0x35')](_0x29b46e['toString'](),{'type':db[_0x883a('0x76')][_0x883a('0x77')][_0x883a('0x78')]})['then'](function(_0x5c3c21){if(_0x5c3c21['length']===0x1){return _0x5af36e['id'];}else{var _0x428490=_[_0x883a('0x79')](_[_0x883a('0x2d')](_0x5c3c21,_0x883a('0x7a')),function(_0x263630){return _[_0x883a('0x7b')](_0x127937,_0x263630);});if(_0x428490){return _0x5af36e['id'];}}}));}}return BPromise[_0x883a('0x7c')](_0x22c180)[_0x883a('0x24')](function(_0x293af2){_0x1c3cd5=_(_0x1c3cd5)[_0x883a('0x7d')](_0x293af2)[_0x883a('0x7e')]()['value']();return db[_0x883a('0x2e')][_0x883a('0x48')]({'where':{'id':_0x59fc94[_0x883a('0x45')]['id']}})[_0x883a('0x24')](function(_0x3453b0){return db[_0x883a('0x76')][_0x883a('0x7f')](function(_0x412ab0){return _0x3453b0[_0x883a('0x6c')](_0x59fc94['query'][_0x883a('0x64')],{'transaction':_0x412ab0})[_0x883a('0x24')](function(){if(!_['isEmpty'](_0x1c3cd5)){return _0x3453b0['removeAgents'](_0x1c3cd5,{'transaction':_0x412ab0});}})[_0x883a('0x24')](function(){_0x1c3cd5[_0x883a('0x80')](function(_0x565ea8){socket[_0x883a('0x6a')](_0x883a('0x81'),{'UserId':_0x565ea8,'WhatsappQueueId':_0x3453b0['id']});});});});});});})[_0x883a('0x24')](respondWithStatusCode(_0x13c17f,null))['catch'](handleError(_0x13c17f,null));};exports[_0x883a('0x82')]=function(_0x5bde0c,_0x353bb1,_0x4fb5d4){return db['WhatsappQueue'][_0x883a('0x48')]({'where':{'id':_0x5bde0c[_0x883a('0x45')]['id']}})[_0x883a('0x24')](handleEntityNotFound(_0x353bb1,null))[_0x883a('0x24')](function(_0x16660a){if(_0x16660a){return _0x16660a[_0x883a('0x82')](_0x5bde0c[_0x883a('0x4a')][_0x883a('0x64')],_['omit'](_0x5bde0c[_0x883a('0x4a')],[_0x883a('0x64'),'id'])||{})['spread'](function(_0x24bcb4){for(var _0x397928=0x0;_0x397928<_0x5bde0c[_0x883a('0x4a')]['ids']['length'];_0x397928+=0x1){socket['emit'](_0x883a('0x6b'),{'UserId':_0x5bde0c[_0x883a('0x4a')][_0x883a('0x64')][_0x397928],'WhatsappQueueId':_0x5bde0c['params']['id']});}return _0x24bcb4;});}})['then'](respondWithResult(_0x353bb1,null))[_0x883a('0x43')](handleError(_0x353bb1,null));};exports[_0x883a('0x83')]=function(_0x1c726e,_0x404876,_0x82e45a){return db[_0x883a('0x2e')]['find']({'where':{'id':_0x1c726e['params']['id']}})['then'](handleEntityNotFound(_0x404876,null))['then'](function(_0x5786f2){if(_0x5786f2){return _0x5786f2[_0x883a('0x83')](_0x1c726e[_0x883a('0x35')][_0x883a('0x64')])[_0x883a('0x24')](function(){if(_[_0x883a('0x84')](_0x1c726e[_0x883a('0x35')][_0x883a('0x64')])){for(var _0x377f10=0x0;_0x377f10<_0x1c726e[_0x883a('0x35')][_0x883a('0x64')][_0x883a('0x39')];_0x377f10+=0x1){socket[_0x883a('0x6a')](_0x883a('0x81'),{'UserId':Number(_0x1c726e[_0x883a('0x35')]['ids'][_0x377f10]),'WhatsappQueueId':Number(_0x1c726e[_0x883a('0x45')]['id'])});}}else{socket[_0x883a('0x6a')](_0x883a('0x81'),{'UserId':Number(_0x1c726e[_0x883a('0x35')][_0x883a('0x64')]),'WhatsappQueueId':Number(_0x1c726e['params']['id'])});}});}})[_0x883a('0x24')](respondWithStatusCode(_0x404876,null))['catch'](handleError(_0x404876,null));};exports[_0x883a('0x85')]=function(_0x422214,_0x5a465c,_0x394a46){var _0x11a056={};var _0x880a79={};var _0x26c0c5;var _0x32e3da;return db[_0x883a('0x2e')][_0x883a('0x54')]({'where':{'id':_0x422214[_0x883a('0x45')]['id']}})[_0x883a('0x24')](handleEntityNotFound(_0x5a465c,null))[_0x883a('0x24')](function(_0x4c65cc){if(_0x4c65cc){_0x26c0c5=_0x4c65cc;_0x880a79[_0x883a('0x32')]=_[_0x883a('0x33')](db[_0x883a('0x57')][_0x883a('0x2f')]);_0x880a79[_0x883a('0x35')]=_[_0x883a('0x33')](_0x422214[_0x883a('0x35')]);_0x880a79['filters']=_[_0x883a('0x37')](_0x880a79[_0x883a('0x32')],_0x880a79['query']);_0x11a056['attributes']=_[_0x883a('0x37')](_0x880a79[_0x883a('0x32')],qs[_0x883a('0x38')](_0x422214[_0x883a('0x35')][_0x883a('0x38')]));_0x11a056[_0x883a('0x36')]=_0x11a056[_0x883a('0x36')][_0x883a('0x39')]?_0x11a056[_0x883a('0x36')]:_0x880a79[_0x883a('0x32')];_0x11a056['order']=qs[_0x883a('0x3d')](_0x422214['query'][_0x883a('0x3d')]);_0x11a056[_0x883a('0x3e')]=qs[_0x883a('0x34')](_['pick'](_0x422214[_0x883a('0x35')],_0x880a79['filters']));if(_0x422214[_0x883a('0x35')]['filter']){_0x11a056[_0x883a('0x3e')]=_[_0x883a('0x40')](_0x11a056[_0x883a('0x3e')],{'$or':_[_0x883a('0x2d')](_0x11a056[_0x883a('0x36')],function(_0x3c203e){var _0x28b606={};_0x28b606[_0x3c203e]={'$like':'%'+_0x422214['query']['filter']+'%'};return _0x28b606;})});}_0x11a056=_['merge']({},_0x11a056,_0x422214['options']);return _0x26c0c5[_0x883a('0x85')](_0x11a056);}})[_0x883a('0x24')](function(_0x14444d){if(_0x14444d){_0x32e3da=_0x14444d['length'];if(!_0x422214[_0x883a('0x35')][_0x883a('0x3a')]('nolimit')){_0x11a056[_0x883a('0x20')]=qs[_0x883a('0x20')](_0x422214[_0x883a('0x35')]['limit']);_0x11a056['offset']=qs[_0x883a('0x1f')](_0x422214[_0x883a('0x35')]['offset']);}return _0x26c0c5[_0x883a('0x85')](_0x11a056);}})[_0x883a('0x24')](function(_0x3552f8){if(_0x3552f8){return _0x3552f8?{'count':_0x32e3da,'rows':_0x3552f8}:null;}})[_0x883a('0x24')](respondWithResult(_0x5a465c,null))['catch'](handleError(_0x5a465c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4d4d446..5d95bd4 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 _0xe3cd=['save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x6416b8,_0x41a1a7){var _0x408cf4=function(_0x575e59){while(--_0x575e59){_0x6416b8['push'](_0x6416b8['shift']());}};_0x408cf4(++_0x41a1a7);}(_0xe3cd,0x178));var _0xde3c=function(_0x34c7bc,_0x4288d0){_0x34c7bc=_0x34c7bc-0x0;var _0x2bd117=_0xe3cd[_0x34c7bc];return _0x2bd117;};'use strict';var EventEmitter=require(_0xde3c('0x0'));var WhatsappQueue=require(_0xde3c('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xde3c('0x2'),'afterUpdate':_0xde3c('0x3'),'afterDestroy':_0xde3c('0x4')};function emitEvent(_0x12ef9a){return function(_0x3f0e14,_0x12eb76,_0x13b0fb){WhatsappQueueEvents['emit'](_0x12ef9a+':'+_0x3f0e14['id'],_0x3f0e14);WhatsappQueueEvents[_0xde3c('0x5')](_0x12ef9a,_0x3f0e14);_0x13b0fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xde3c('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x15d9=['setMaxListeners','save','remove','emit','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x159638,_0x554a3a){var _0x2160f7=function(_0x952f03){while(--_0x952f03){_0x159638['push'](_0x159638['shift']());}};_0x2160f7(++_0x554a3a);}(_0x15d9,0x9d));var _0x915d=function(_0x394e86,_0x400c5f){_0x394e86=_0x394e86-0x0;var _0x26e62f=_0x15d9[_0x394e86];return _0x26e62f;};'use strict';var EventEmitter=require(_0x915d('0x0'));var WhatsappQueue=require(_0x915d('0x1'))['db'][_0x915d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x915d('0x3')](0x0);var events={'afterCreate':_0x915d('0x4'),'afterUpdate':'update','afterDestroy':_0x915d('0x5')};function emitEvent(_0x180cc1){return function(_0x56b193,_0x44522f,_0x11d351){WhatsappQueueEvents[_0x915d('0x6')](_0x180cc1+':'+_0x56b193['id'],_0x56b193);WhatsappQueueEvents[_0x915d('0x6')](_0x180cc1,_0x56b193);_0x11d351(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x915d('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 3bacd56..b37d665 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 _0x981e=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x1f7bc1,_0x1bca5c){var _0x5b7f3e=function(_0x2a8741){while(--_0x2a8741){_0x1f7bc1['push'](_0x1f7bc1['shift']());}};_0x5b7f3e(++_0x1bca5c);}(_0x981e,0x1d4));var _0xe981=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x981e[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xe981('0x0'));var util=require(_0xe981('0x1'));var logger=require(_0xe981('0x2'))(_0xe981('0x3'));var moment=require('moment');var BPromise=require(_0xe981('0x4'));var rp=require(_0xe981('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe981('0x6'));var config=require('../../config/environment');var attributes=require(_0xe981('0x7'));module[_0xe981('0x8')]=function(_0x568ad8,_0xa09c58){return _0x568ad8[_0xe981('0x9')](_0xe981('0xa'),attributes,{'tableName':_0xe981('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacbc=['./whatsappQueue.attributes','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b662b,_0x5dab5a){var _0x1c968a=function(_0x323d92){while(--_0x323d92){_0x3b662b['push'](_0x3b662b['shift']());}};_0x1c968a(++_0x5dab5a);}(_0xacbc,0xac));var _0xcacb=function(_0x1e2c37,_0x4dd529){_0x1e2c37=_0x1e2c37-0x0;var _0x3c6756=_0xacbc[_0x1e2c37];return _0x3c6756;};'use strict';var _=require(_0xcacb('0x0'));var util=require(_0xcacb('0x1'));var logger=require(_0xcacb('0x2'))(_0xcacb('0x3'));var moment=require(_0xcacb('0x4'));var BPromise=require(_0xcacb('0x5'));var rp=require(_0xcacb('0x6'));var fs=require('fs');var path=require(_0xcacb('0x7'));var rimraf=require(_0xcacb('0x8'));var config=require(_0xcacb('0x9'));var attributes=require(_0xcacb('0xa'));module['exports']=function(_0x36ce9c,_0x7bcb87){return _0x36ce9c['define'](_0xcacb('0xb'),attributes,{'tableName':_0xcacb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 6e0c6a4..046c9da 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 _0x245b=['raw','where','include','map','attributes','model','debug','stringify','find','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','http','redis','defaults','localhost','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','options'];(function(_0x5e0a79,_0x32972f){var _0x4bfef2=function(_0x1eb22b){while(--_0x1eb22b){_0x5e0a79['push'](_0x5e0a79['shift']());}};_0x4bfef2(++_0x32972f);}(_0x245b,0x1de));var _0xb245=function(_0x3cb6ff,_0x5926e2){_0x3cb6ff=_0x3cb6ff-0x0;var _0x20dbfb=_0x245b[_0x3cb6ff];return _0x20dbfb;};'use strict';var _=require(_0xb245('0x0'));var util=require(_0xb245('0x1'));var moment=require(_0xb245('0x2'));var BPromise=require(_0xb245('0x3'));var rs=require(_0xb245('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb245('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb245('0x6'));var client=jayson['client'][_0xb245('0x7')]({'port':0x232a});config[_0xb245('0x8')]=_[_0xb245('0x9')](config[_0xb245('0x8')],{'host':_0xb245('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb245('0x8')]));require(_0xb245('0xb'))[_0xb245('0xc')](socket);function respondWithRpcPromise(_0x3abb9a,_0x51d771,_0x13c357){return new BPromise(function(_0x4dd82d,_0x2ec4df){return client['request'](_0x3abb9a,_0x13c357)[_0xb245('0xd')](function(_0x40445e){logger['info'](_0xb245('0xe'),_0x51d771,_0xb245('0xf'));logger['debug'](_0xb245('0x10'),_0x51d771,_0xb245('0xf'),JSON['stringify'](_0x40445e));if(_0x40445e['error']){if(_0x40445e['error'][_0xb245('0x11')]===0x1f4){logger[_0xb245('0x12')](_0xb245('0xe'),_0x51d771,_0x40445e[_0xb245('0x12')][_0xb245('0x13')]);return _0x2ec4df(_0x40445e[_0xb245('0x12')][_0xb245('0x13')]);}logger[_0xb245('0x12')](_0xb245('0xe'),_0x51d771,_0x40445e['error'][_0xb245('0x13')]);return _0x4dd82d(_0x40445e[_0xb245('0x12')]['message']);}else{logger[_0xb245('0x14')](_0xb245('0xe'),_0x51d771,_0xb245('0xf'));_0x4dd82d(_0x40445e[_0xb245('0x15')][_0xb245('0x13')]);}})[_0xb245('0x16')](function(_0x1166b0){logger[_0xb245('0x12')](_0xb245('0xe'),_0x51d771,_0x1166b0);_0x2ec4df(_0x1166b0);});});}exports[_0xb245('0x17')]=function(_0x1f3621){var _0x4cb6b7=this;return new Promise(function(_0x36da8a,_0x4fc707){return db[_0xb245('0x18')]['findAll']({'raw':_0x1f3621[_0xb245('0x19')]?_0x1f3621[_0xb245('0x19')][_0xb245('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f3621[_0xb245('0x19')]?_0x1f3621[_0xb245('0x19')][_0xb245('0x1b')]||null:null,'attributes':_0x1f3621['options']?_0x1f3621[_0xb245('0x19')]['attributes']||null:null,'limit':_0x1f3621[_0xb245('0x19')]?_0x1f3621['options']['limit']||null:null,'include':_0x1f3621[_0xb245('0x19')]?_0x1f3621[_0xb245('0x19')][_0xb245('0x1c')]?_[_0xb245('0x1d')](_0x1f3621['options']['include'],function(_0x4c933a){return{'model':db[_0x4c933a['model']],'as':_0x4c933a['as'],'attributes':_0x4c933a[_0xb245('0x1e')],'include':_0x4c933a[_0xb245('0x1c')]?_['map'](_0x4c933a['include'],function(_0x54df84){return{'model':db[_0x54df84[_0xb245('0x1f')]],'as':_0x54df84['as'],'attributes':_0x54df84[_0xb245('0x1e')],'include':_0x54df84['include']?_[_0xb245('0x1d')](_0x54df84[_0xb245('0x1c')],function(_0xdf339b){return{'model':db[_0xdf339b[_0xb245('0x1f')]],'as':_0xdf339b['as'],'attributes':_0xdf339b[_0xb245('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51d4d8){logger[_0xb245('0x14')](_0xb245('0x17'),_0x1f3621);logger[_0xb245('0x20')](_0xb245('0x17'),_0x1f3621,JSON[_0xb245('0x21')](_0x51d4d8));_0x36da8a(_0x51d4d8);})[_0xb245('0x16')](function(_0x219a50){logger[_0xb245('0x12')](_0xb245('0x17'),_0x219a50['message'],_0x1f3621);_0x4fc707(_0x4cb6b7[_0xb245('0x12')](0x1f4,_0x219a50[_0xb245('0x13')]));});});};exports['ShowWhatsappQueue']=function(_0x3e654f){var _0x152220=this;return new Promise(function(_0x5497e9,_0x563f2f){return db[_0xb245('0x18')][_0xb245('0x22')]({'raw':_0x3e654f['options']?_0x3e654f[_0xb245('0x19')][_0xb245('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e654f[_0xb245('0x19')]?_0x3e654f[_0xb245('0x19')]['where']||null:null,'attributes':_0x3e654f[_0xb245('0x19')]?_0x3e654f[_0xb245('0x19')][_0xb245('0x1e')]||null:null,'include':_0x3e654f[_0xb245('0x19')]?_0x3e654f[_0xb245('0x19')][_0xb245('0x1c')]?_[_0xb245('0x1d')](_0x3e654f[_0xb245('0x19')][_0xb245('0x1c')],function(_0x5ed317){return{'model':db[_0x5ed317[_0xb245('0x1f')]],'as':_0x5ed317['as'],'attributes':_0x5ed317['attributes'],'include':_0x5ed317[_0xb245('0x1c')]?_['map'](_0x5ed317[_0xb245('0x1c')],function(_0x29019c){return{'model':db[_0x29019c['model']],'as':_0x29019c['as'],'attributes':_0x29019c[_0xb245('0x1e')],'include':_0x29019c['include']?_[_0xb245('0x1d')](_0x29019c[_0xb245('0x1c')],function(_0x215d5f){return{'model':db[_0x215d5f['model']],'as':_0x215d5f['as'],'attributes':_0x215d5f[_0xb245('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb245('0xd')](function(_0x2a3187){logger[_0xb245('0x14')](_0xb245('0x23'),_0x3e654f);logger[_0xb245('0x20')](_0xb245('0x23'),_0x3e654f,JSON[_0xb245('0x21')](_0x2a3187));_0x5497e9(_0x2a3187);})[_0xb245('0x16')](function(_0x4260a0){logger[_0xb245('0x12')]('ShowWhatsappQueue',_0x4260a0[_0xb245('0x13')],_0x3e654f);_0x563f2f(_0x152220['error'](0x1f4,_0x4260a0[_0xb245('0x13')]));});});}; \ No newline at end of file +var _0x6d91=['../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','map','model','include','debug','ShowWhatsappQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x507d71,_0x260c61){var _0xa8f225=function(_0x5c602d){while(--_0x5c602d){_0x507d71['push'](_0x507d71['shift']());}};_0xa8f225(++_0x260c61);}(_0x6d91,0x97));var _0x16d9=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x6d91[_0x46a3e8];return _0xf1442e;};'use strict';var _=require(_0x16d9('0x0'));var util=require(_0x16d9('0x1'));var moment=require(_0x16d9('0x2'));var BPromise=require(_0x16d9('0x3'));var rs=require(_0x16d9('0x4'));var fs=require('fs');var Redis=require(_0x16d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x16d9('0x6'));var logger=require(_0x16d9('0x7'))(_0x16d9('0x8'));var config=require(_0x16d9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x16d9('0xa')][_0x16d9('0xb')]({'port':0x232a});config[_0x16d9('0xc')]=_['defaults'](config[_0x16d9('0xc')],{'host':_0x16d9('0xd'),'port':0x18eb});var socket=require(_0x16d9('0xe'))(new Redis(config[_0x16d9('0xc')]));require(_0x16d9('0xf'))['register'](socket);function respondWithRpcPromise(_0x37b20b,_0x58984e,_0x317a99){return new BPromise(function(_0x5bcc90,_0x51f196){return client[_0x16d9('0x10')](_0x37b20b,_0x317a99)[_0x16d9('0x11')](function(_0x2b1459){logger[_0x16d9('0x12')](_0x16d9('0x13'),_0x58984e,_0x16d9('0x14'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x58984e,_0x16d9('0x14'),JSON[_0x16d9('0x15')](_0x2b1459));if(_0x2b1459[_0x16d9('0x16')]){if(_0x2b1459[_0x16d9('0x16')][_0x16d9('0x17')]===0x1f4){logger[_0x16d9('0x16')](_0x16d9('0x13'),_0x58984e,_0x2b1459['error']['message']);return _0x51f196(_0x2b1459[_0x16d9('0x16')][_0x16d9('0x18')]);}logger[_0x16d9('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x58984e,_0x2b1459[_0x16d9('0x16')][_0x16d9('0x18')]);return _0x5bcc90(_0x2b1459[_0x16d9('0x16')]['message']);}else{logger['info'](_0x16d9('0x13'),_0x58984e,_0x16d9('0x14'));_0x5bcc90(_0x2b1459[_0x16d9('0x19')][_0x16d9('0x18')]);}})[_0x16d9('0x1a')](function(_0x44160e){logger[_0x16d9('0x16')](_0x16d9('0x13'),_0x58984e,_0x44160e);_0x51f196(_0x44160e);});});}exports[_0x16d9('0x1b')]=function(_0x21b761){var _0x156ba0=this;return new Promise(function(_0x4e1f53,_0x2982f3){return db[_0x16d9('0x1c')][_0x16d9('0x1d')]({'raw':_0x21b761['options']?_0x21b761[_0x16d9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x21b761['options']?_0x21b761[_0x16d9('0x1e')][_0x16d9('0x1f')]||null:null,'attributes':_0x21b761[_0x16d9('0x1e')]?_0x21b761[_0x16d9('0x1e')][_0x16d9('0x20')]||null:null,'limit':_0x21b761[_0x16d9('0x1e')]?_0x21b761[_0x16d9('0x1e')]['limit']||null:null,'include':_0x21b761['options']?_0x21b761[_0x16d9('0x1e')]['include']?_[_0x16d9('0x21')](_0x21b761[_0x16d9('0x1e')]['include'],function(_0x2517db){return{'model':db[_0x2517db[_0x16d9('0x22')]],'as':_0x2517db['as'],'attributes':_0x2517db['attributes'],'include':_0x2517db['include']?_[_0x16d9('0x21')](_0x2517db[_0x16d9('0x23')],function(_0x4cc26a){return{'model':db[_0x4cc26a[_0x16d9('0x22')]],'as':_0x4cc26a['as'],'attributes':_0x4cc26a[_0x16d9('0x20')],'include':_0x4cc26a[_0x16d9('0x23')]?_[_0x16d9('0x21')](_0x4cc26a['include'],function(_0x3d9d2e){return{'model':db[_0x3d9d2e['model']],'as':_0x3d9d2e['as'],'attributes':_0x3d9d2e[_0x16d9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x16d9('0x11')](function(_0x9b4b81){logger[_0x16d9('0x12')]('GetWhatsappQueue',_0x21b761);logger[_0x16d9('0x24')](_0x16d9('0x1b'),_0x21b761,JSON[_0x16d9('0x15')](_0x9b4b81));_0x4e1f53(_0x9b4b81);})['catch'](function(_0xe0a739){logger[_0x16d9('0x16')](_0x16d9('0x1b'),_0xe0a739[_0x16d9('0x18')],_0x21b761);_0x2982f3(_0x156ba0['error'](0x1f4,_0xe0a739[_0x16d9('0x18')]));});});};exports[_0x16d9('0x25')]=function(_0x5728e4){var _0x42667e=this;return new Promise(function(_0x284dfa,_0x46267e){return db[_0x16d9('0x1c')][_0x16d9('0x26')]({'raw':_0x5728e4[_0x16d9('0x1e')]?_0x5728e4[_0x16d9('0x1e')][_0x16d9('0x27')]===undefined?!![]:![]:!![],'where':_0x5728e4[_0x16d9('0x1e')]?_0x5728e4[_0x16d9('0x1e')]['where']||null:null,'attributes':_0x5728e4[_0x16d9('0x1e')]?_0x5728e4['options'][_0x16d9('0x20')]||null:null,'include':_0x5728e4[_0x16d9('0x1e')]?_0x5728e4[_0x16d9('0x1e')][_0x16d9('0x23')]?_[_0x16d9('0x21')](_0x5728e4[_0x16d9('0x1e')]['include'],function(_0xe4128b){return{'model':db[_0xe4128b['model']],'as':_0xe4128b['as'],'attributes':_0xe4128b[_0x16d9('0x20')],'include':_0xe4128b[_0x16d9('0x23')]?_[_0x16d9('0x21')](_0xe4128b[_0x16d9('0x23')],function(_0x5264fd){return{'model':db[_0x5264fd['model']],'as':_0x5264fd['as'],'attributes':_0x5264fd[_0x16d9('0x20')],'include':_0x5264fd[_0x16d9('0x23')]?_[_0x16d9('0x21')](_0x5264fd['include'],function(_0x1c4385){return{'model':db[_0x1c4385[_0x16d9('0x22')]],'as':_0x1c4385['as'],'attributes':_0x1c4385[_0x16d9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x16d9('0x11')](function(_0x11bbb7){logger[_0x16d9('0x12')](_0x16d9('0x25'),_0x5728e4);logger[_0x16d9('0x24')](_0x16d9('0x25'),_0x5728e4,JSON[_0x16d9('0x15')](_0x11bbb7));_0x284dfa(_0x11bbb7);})['catch'](function(_0x147dae){logger['error']('ShowWhatsappQueue',_0x147dae[_0x16d9('0x18')],_0x5728e4);_0x46267e(_0x42667e['error'](0x1f4,_0x147dae[_0x16d9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 4184df6..99ec24d 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 _0xfb0e=['emit','removeListener','length','whatsappQueue:','save','remove','update'];(function(_0x5880d8,_0x30b0a5){var _0x88264a=function(_0x5ec626){while(--_0x5ec626){_0x5880d8['push'](_0x5880d8['shift']());}};_0x88264a(++_0x30b0a5);}(_0xfb0e,0xc1));var _0xefb0=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0xfb0e[_0x3932eb];return _0x5316e5;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xefb0('0x0'),_0xefb0('0x1'),_0xefb0('0x2')];function createListener(_0x238d0b,_0x5ef7a3){return function(_0x45ab99){_0x5ef7a3[_0xefb0('0x3')](_0x238d0b,_0x45ab99);};}function removeListener(_0x11096f,_0x597380){return function(){WhatsappQueueEvents[_0xefb0('0x4')](_0x11096f,_0x597380);};}exports['register']=function(_0x15a119){for(var _0x2bd423=0x0,_0x1b9b0f=events[_0xefb0('0x5')];_0x2bd423<_0x1b9b0f;_0x2bd423++){var _0x5211f3=events[_0x2bd423];var _0x41dfdb=createListener(_0xefb0('0x6')+_0x5211f3,_0x15a119);WhatsappQueueEvents['on'](_0x5211f3,_0x41dfdb);}}; \ No newline at end of file +var _0x2323=['register','length','./whatsappQueue.events','save','emit','removeListener'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x2323,0x146));var _0x3232=function(_0x55e2c3,_0xfbbb34){_0x55e2c3=_0x55e2c3-0x0;var _0x1ed368=_0x2323[_0x55e2c3];return _0x1ed368;};'use strict';var WhatsappQueueEvents=require(_0x3232('0x0'));var events=[_0x3232('0x1'),'remove','update'];function createListener(_0x5e35d5,_0x985b21){return function(_0x5dcf46){_0x985b21[_0x3232('0x2')](_0x5e35d5,_0x5dcf46);};}function removeListener(_0x5e7b8e,_0xb69166){return function(){WhatsappQueueEvents[_0x3232('0x3')](_0x5e7b8e,_0xb69166);};}exports[_0x3232('0x4')]=function(_0xc9fcf8){for(var _0x1949c8=0x0,_0x4686d9=events[_0x3232('0x5')];_0x1949c8<_0x4686d9;_0x1949c8++){var _0x11ef2a=events[_0x1949c8];var _0xb874fd=createListener('whatsappQueue:'+_0x11ef2a,_0xc9fcf8);WhatsappQueueEvents['on'](_0x11ef2a,_0xb874fd);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 03a32f0..5af1b50 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 _0x36d4=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update'];(function(_0x17b15f,_0x4de382){var _0x152c34=function(_0x4d356c){while(--_0x4d356c){_0x17b15f['push'](_0x17b15f['shift']());}};_0x152c34(++_0x4de382);}(_0x36d4,0x17d));var _0x436d=function(_0x2fffff,_0x415518){_0x2fffff=_0x2fffff-0x0;var _0x4f2a2c=_0x36d4[_0x2fffff];return _0x4f2a2c;};'use strict';var multer=require(_0x436d('0x0'));var util=require(_0x436d('0x1'));var path=require(_0x436d('0x2'));var timeout=require(_0x436d('0x3'));var express=require(_0x436d('0x4'));var router=express[_0x436d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x436d('0x6'));var config=require(_0x436d('0x7'));var controller=require(_0x436d('0x8'));router[_0x436d('0x9')]('/',auth[_0x436d('0xa')](),controller['index']);router[_0x436d('0x9')](_0x436d('0xb'),auth[_0x436d('0xa')](),controller[_0x436d('0xc')]);router[_0x436d('0x9')](_0x436d('0xd'),auth[_0x436d('0xa')](),controller[_0x436d('0xe')]);router[_0x436d('0xf')]('/',auth['isAuthenticated'](),controller[_0x436d('0x10')]);router['put'](_0x436d('0xd'),auth[_0x436d('0xa')](),controller[_0x436d('0x11')]);router['delete']('/:id',auth[_0x436d('0xa')](),controller['destroy']);module[_0x436d('0x12')]=router; \ No newline at end of file +var _0x16b9=['put','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x3619e6,_0x24c202){var _0x409222=function(_0x319f8c){while(--_0x319f8c){_0x3619e6['push'](_0x3619e6['shift']());}};_0x409222(++_0x24c202);}(_0x16b9,0xf1));var _0x916b=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x16b9[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require('multer');var util=require(_0x916b('0x0'));var path=require(_0x916b('0x1'));var timeout=require('connect-timeout');var express=require(_0x916b('0x2'));var router=express['Router']();var auth=require(_0x916b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x916b('0x4'));var controller=require(_0x916b('0x5'));router[_0x916b('0x6')]('/',auth[_0x916b('0x7')](),controller['index']);router[_0x916b('0x6')](_0x916b('0x8'),auth[_0x916b('0x7')](),controller[_0x916b('0x9')]);router[_0x916b('0x6')](_0x916b('0xa'),auth[_0x916b('0x7')](),controller[_0x916b('0xb')]);router[_0x916b('0xc')]('/',auth[_0x916b('0x7')](),controller[_0x916b('0xd')]);router[_0x916b('0xe')]('/:id',auth[_0x916b('0x7')](),controller['update']);router[_0x916b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x916b('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 95ddccc..bae42e7 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 _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x35d61a,_0x56f4a4){var _0x1cd155=function(_0x3c5ead){while(--_0x3c5ead){_0x35d61a['push'](_0x35d61a['shift']());}};_0x1cd155(++_0x56f4a4);}(_0x34e8,0x12c));var _0x834e=function(_0x1f0d89,_0x33212c){_0x1f0d89=_0x1f0d89-0x0;var _0x195cf9=_0x34e8[_0x1f0d89];return _0x195cf9;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x3e74,0x175));var _0x43e7=function(_0x5774f2,_0x339e93){_0x5774f2=_0x5774f2-0x0;var _0x5c65b7=_0x3e74[_0x5774f2];return _0x5c65b7;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x43e7('0x1')]},'joinAt':{'type':Sequelize[_0x43e7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43e7('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 180e0d3..bc20f89 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 _0x36d3=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','create','body','update','find','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x36d3,0xb5));var _0x336d=function(_0x477970,_0x16302d){_0x477970=_0x477970-0x0;var _0x90a619=_0x36d3[_0x477970];return _0x90a619;};'use strict';var pdf=require(_0x336d('0x0'));var emlformat=require(_0x336d('0x1'));var rimraf=require(_0x336d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x336d('0x3'));var moment=require(_0x336d('0x4'));var BPromise=require(_0x336d('0x5'));var Mustache=require(_0x336d('0x6'));var util=require(_0x336d('0x7'));var path=require(_0x336d('0x8'));var sox=require(_0x336d('0x9'));var csv=require(_0x336d('0xa'));var ejs=require(_0x336d('0xb'));var fs=require('fs');var _=require(_0x336d('0xc'));var squel=require(_0x336d('0xd'));var crypto=require(_0x336d('0xe'));var jsforce=require(_0x336d('0xf'));var deskjs=require(_0x336d('0x10'));var toCsv=require(_0x336d('0xa'));var querystring=require(_0x336d('0x11'));var Papa=require('papaparse');var Redis=require(_0x336d('0x12'));var authService=require(_0x336d('0x13'));var qs=require(_0x336d('0x14'));var as=require(_0x336d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x336d('0x16'))(_0x336d('0x17'));var utils=require(_0x336d('0x18'));var config=require(_0x336d('0x19'));var db=require(_0x336d('0x1a'))['db'];function respondWithStatusCode(_0x2c4bb3,_0x2cbea8){_0x2cbea8=_0x2cbea8||0xcc;return function(_0x271716){if(_0x271716){return _0x2c4bb3[_0x336d('0x1b')](_0x2cbea8);}return _0x2c4bb3[_0x336d('0x1c')](_0x2cbea8)[_0x336d('0x1d')]();};}function respondWithResult(_0x2ab8b1,_0x167720){_0x167720=_0x167720||0xc8;return function(_0x2ad93a){if(_0x2ad93a){return _0x2ab8b1[_0x336d('0x1c')](_0x167720)[_0x336d('0x1e')](_0x2ad93a);}};}function respondWithFilteredResult(_0x5bd2b5,_0x3ce54a){return function(_0x2c488e){if(_0x2c488e){var _0x470254=_0x2c488e[_0x336d('0x1f')],_0x970cb8=_0x3ce54a['offset'],_0x2dafce=_0x3ce54a[_0x336d('0x20')]+_0x3ce54a[_0x336d('0x21')],_0x587ecc;if(_0x2dafce>=_0x470254){_0x2dafce=_0x470254;_0x587ecc=0xc8;}else{_0x587ecc=0xce;}_0x5bd2b5[_0x336d('0x1c')](_0x587ecc);return _0x5bd2b5[_0x336d('0x22')](_0x336d('0x23'),_0x970cb8+'-'+_0x2dafce+'/'+_0x470254)[_0x336d('0x1e')](_0x2c488e);}return null;};}function patchUpdates(_0x4c5cc2){return function(_0x1f14b8){try{jsonpatch[_0x336d('0x24')](_0x1f14b8,_0x4c5cc2,!![]);}catch(_0x5439c7){return BPromise[_0x336d('0x25')](_0x5439c7);}return _0x1f14b8['save']();};}function saveUpdates(_0x11075f,_0x24f781){return function(_0x1dcce8){if(_0x1dcce8){return _0x1dcce8['update'](_0x11075f)[_0x336d('0x26')](function(_0x4a64ba){return _0x4a64ba;});}return null;};}function removeEntity(_0x557979,_0xe71ed6){return function(_0xec828d){if(_0xec828d){return _0xec828d[_0x336d('0x27')]()[_0x336d('0x26')](function(){_0x557979[_0x336d('0x1c')](0xcc)[_0x336d('0x1d')]();});}};}function handleEntityNotFound(_0x5a7bba,_0xeaa7cf){return function(_0x23ba74){if(!_0x23ba74){_0x5a7bba['sendStatus'](0x194);}return _0x23ba74;};}function handleError(_0x30d903,_0x111074){_0x111074=_0x111074||0x1f4;return function(_0xb241f2){logger['error'](_0xb241f2[_0x336d('0x28')]);if(_0xb241f2[_0x336d('0x29')]){delete _0xb241f2['name'];}_0x30d903[_0x336d('0x1c')](_0x111074)[_0x336d('0x2a')](_0xb241f2);};}exports['index']=function(_0x285b37,_0x3fd544){var _0x4e33ed={},_0x1e6428={},_0x178b4f={'count':0x0,'rows':[]};var _0x1834ef=_[_0x336d('0x2b')](db[_0x336d('0x2c')][_0x336d('0x2d')],function(_0x5c20a0){return{'name':_0x5c20a0[_0x336d('0x2e')],'type':_0x5c20a0[_0x336d('0x2f')][_0x336d('0x30')]};});_0x1e6428[_0x336d('0x31')]=_[_0x336d('0x2b')](_0x1834ef,_0x336d('0x29'));_0x1e6428[_0x336d('0x32')]=_['keys'](_0x285b37[_0x336d('0x32')]);_0x1e6428[_0x336d('0x33')]=_[_0x336d('0x34')](_0x1e6428[_0x336d('0x31')],_0x1e6428['query']);_0x4e33ed[_0x336d('0x35')]=_[_0x336d('0x34')](_0x1e6428['model'],qs['fields'](_0x285b37['query'][_0x336d('0x36')]));_0x4e33ed[_0x336d('0x35')]=_0x4e33ed[_0x336d('0x35')][_0x336d('0x37')]?_0x4e33ed['attributes']:_0x1e6428['model'];if(!_0x285b37['query'][_0x336d('0x38')](_0x336d('0x39'))){_0x4e33ed[_0x336d('0x21')]=qs['limit'](_0x285b37['query'][_0x336d('0x21')]);_0x4e33ed[_0x336d('0x20')]=qs[_0x336d('0x20')](_0x285b37[_0x336d('0x32')][_0x336d('0x20')]);}_0x4e33ed['order']=qs[_0x336d('0x3a')](_0x285b37[_0x336d('0x32')][_0x336d('0x3a')]);_0x4e33ed[_0x336d('0x3b')]=qs['filters'](_[_0x336d('0x3c')](_0x285b37[_0x336d('0x32')],_0x1e6428['filters']),_0x1834ef);if(_0x285b37['query'][_0x336d('0x3d')]){_0x4e33ed[_0x336d('0x3b')]=_[_0x336d('0x3e')](_0x4e33ed['where'],{'$or':_['map'](_0x1834ef,function(_0x9046a1){if(_0x9046a1[_0x336d('0x2f')]!==_0x336d('0x3f')){var _0x11f1ae={};_0x11f1ae[_0x9046a1[_0x336d('0x29')]]={'$like':'%'+_0x285b37[_0x336d('0x32')][_0x336d('0x3d')]+'%'};return _0x11f1ae;}})});}_0x4e33ed=_['merge']({},_0x4e33ed,_0x285b37[_0x336d('0x40')]);var _0x27572e={'where':_0x4e33ed[_0x336d('0x3b')]};return db[_0x336d('0x2c')][_0x336d('0x1f')](_0x27572e)['then'](function(_0x36a4f4){_0x178b4f['count']=_0x36a4f4;if(_0x285b37[_0x336d('0x32')][_0x336d('0x41')]){_0x4e33ed['include']=[{'all':!![]}];}return db[_0x336d('0x2c')][_0x336d('0x42')](_0x4e33ed);})[_0x336d('0x26')](function(_0xd18406){_0x178b4f['rows']=_0xd18406;return _0x178b4f;})['then'](respondWithFilteredResult(_0x3fd544,_0x4e33ed))[_0x336d('0x43')](handleError(_0x3fd544,null));};exports[_0x336d('0x44')]=function(_0x596f56,_0x4de7ef){var _0x5f576d={'raw':!![],'where':{'id':_0x596f56[_0x336d('0x45')]['id']}},_0x1c5750={};_0x1c5750[_0x336d('0x31')]=_[_0x336d('0x46')](db[_0x336d('0x2c')][_0x336d('0x2d')]);_0x1c5750[_0x336d('0x32')]=_[_0x336d('0x46')](_0x596f56['query']);_0x1c5750['filters']=_['intersection'](_0x1c5750['model'],_0x1c5750[_0x336d('0x32')]);_0x5f576d[_0x336d('0x35')]=_[_0x336d('0x34')](_0x1c5750['model'],qs[_0x336d('0x36')](_0x596f56[_0x336d('0x32')][_0x336d('0x36')]));_0x5f576d[_0x336d('0x35')]=_0x5f576d[_0x336d('0x35')]['length']?_0x5f576d[_0x336d('0x35')]:_0x1c5750['model'];if(_0x596f56[_0x336d('0x32')][_0x336d('0x41')]){_0x5f576d[_0x336d('0x47')]=[{'all':!![]}];}_0x5f576d=_[_0x336d('0x3e')]({},_0x5f576d,_0x596f56[_0x336d('0x40')]);return db['WhatsappQueueReport']['find'](_0x5f576d)[_0x336d('0x26')](handleEntityNotFound(_0x4de7ef,null))[_0x336d('0x26')](respondWithResult(_0x4de7ef,null))[_0x336d('0x43')](handleError(_0x4de7ef,null));};exports[_0x336d('0x48')]=function(_0x119573,_0x35aec0){return db[_0x336d('0x2c')]['create'](_0x119573[_0x336d('0x49')],{})[_0x336d('0x26')](respondWithResult(_0x35aec0,0xc9))['catch'](handleError(_0x35aec0,null));};exports[_0x336d('0x4a')]=function(_0x383d3f,_0x46e7fb){if(_0x383d3f['body']['id']){delete _0x383d3f['body']['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x383d3f[_0x336d('0x45')]['id']}})['then'](handleEntityNotFound(_0x46e7fb,null))[_0x336d('0x26')](saveUpdates(_0x383d3f[_0x336d('0x49')],null))['then'](respondWithResult(_0x46e7fb,null))[_0x336d('0x43')](handleError(_0x46e7fb,null));};exports[_0x336d('0x27')]=function(_0x4222e4,_0x51c1ca){return db[_0x336d('0x2c')][_0x336d('0x4b')]({'where':{'id':_0x4222e4[_0x336d('0x45')]['id']}})[_0x336d('0x26')](handleEntityNotFound(_0x51c1ca,null))[_0x336d('0x26')](removeEntity(_0x51c1ca,null))[_0x336d('0x43')](handleError(_0x51c1ca,null));};exports[_0x336d('0x4c')]=function(_0x1a9f54,_0x4c93f1){return db[_0x336d('0x2c')][_0x336d('0x4c')]()[_0x336d('0x26')](respondWithResult(_0x4c93f1,null))[_0x336d('0x43')](handleError(_0x4c93f1,null));}; \ No newline at end of file +var _0x1a3b=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x225d44,_0x399b52){var _0x4aa98a=function(_0xeffa74){while(--_0xeffa74){_0x225d44['push'](_0x225d44['shift']());}};_0x4aa98a(++_0x399b52);}(_0x1a3b,0x83));var _0xb1a3=function(_0x52bf6a,_0x38408b){_0x52bf6a=_0x52bf6a-0x0;var _0x4cb04a=_0x1a3b[_0x52bf6a];return _0x4cb04a;};'use strict';var pdf=require(_0xb1a3('0x0'));var emlformat=require(_0xb1a3('0x1'));var rimraf=require(_0xb1a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1a3('0x3'));var rp=require(_0xb1a3('0x4'));var moment=require(_0xb1a3('0x5'));var BPromise=require(_0xb1a3('0x6'));var Mustache=require('mustache');var util=require(_0xb1a3('0x7'));var path=require(_0xb1a3('0x8'));var sox=require(_0xb1a3('0x9'));var csv=require(_0xb1a3('0xa'));var ejs=require(_0xb1a3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb1a3('0xc'));var crypto=require(_0xb1a3('0xd'));var jsforce=require(_0xb1a3('0xe'));var deskjs=require(_0xb1a3('0xf'));var toCsv=require(_0xb1a3('0xa'));var querystring=require(_0xb1a3('0x10'));var Papa=require('papaparse');var Redis=require(_0xb1a3('0x11'));var authService=require(_0xb1a3('0x12'));var qs=require(_0xb1a3('0x13'));var as=require(_0xb1a3('0x14'));var hardwareService=require(_0xb1a3('0x15'));var logger=require(_0xb1a3('0x16'))(_0xb1a3('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb1a3('0x18'))['db'];function respondWithStatusCode(_0x477ab7,_0x49695a){_0x49695a=_0x49695a||0xcc;return function(_0x50648b){if(_0x50648b){return _0x477ab7[_0xb1a3('0x19')](_0x49695a);}return _0x477ab7[_0xb1a3('0x1a')](_0x49695a)['end']();};}function respondWithResult(_0x4fcd20,_0x504cd4){_0x504cd4=_0x504cd4||0xc8;return function(_0x45ff57){if(_0x45ff57){return _0x4fcd20[_0xb1a3('0x1a')](_0x504cd4)['json'](_0x45ff57);}};}function respondWithFilteredResult(_0x1f6f3b,_0x292435){return function(_0x4a8e6c){if(_0x4a8e6c){var _0x25c3bb=_0x4a8e6c[_0xb1a3('0x1b')],_0x65ea90=_0x292435[_0xb1a3('0x1c')],_0x1962ce=_0x292435[_0xb1a3('0x1c')]+_0x292435[_0xb1a3('0x1d')],_0x3e29d7;if(_0x1962ce>=_0x25c3bb){_0x1962ce=_0x25c3bb;_0x3e29d7=0xc8;}else{_0x3e29d7=0xce;}_0x1f6f3b[_0xb1a3('0x1a')](_0x3e29d7);return _0x1f6f3b[_0xb1a3('0x1e')](_0xb1a3('0x1f'),_0x65ea90+'-'+_0x1962ce+'/'+_0x25c3bb)[_0xb1a3('0x20')](_0x4a8e6c);}return null;};}function patchUpdates(_0xd871a7){return function(_0x382b0c){try{jsonpatch[_0xb1a3('0x21')](_0x382b0c,_0xd871a7,!![]);}catch(_0xe3a284){return BPromise[_0xb1a3('0x22')](_0xe3a284);}return _0x382b0c['save']();};}function saveUpdates(_0x47c172,_0x576523){return function(_0x59363c){if(_0x59363c){return _0x59363c[_0xb1a3('0x23')](_0x47c172)[_0xb1a3('0x24')](function(_0x4d9f82){return _0x4d9f82;});}return null;};}function removeEntity(_0x2e2a86,_0x579781){return function(_0x5b4666){if(_0x5b4666){return _0x5b4666[_0xb1a3('0x25')]()['then'](function(){_0x2e2a86[_0xb1a3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4946cf,_0x34f58d){return function(_0xeb52d4){if(!_0xeb52d4){_0x4946cf['sendStatus'](0x194);}return _0xeb52d4;};}function handleError(_0x43ac66,_0x117824){_0x117824=_0x117824||0x1f4;return function(_0x29cccf){logger['error'](_0x29cccf['stack']);if(_0x29cccf[_0xb1a3('0x26')]){delete _0x29cccf[_0xb1a3('0x26')];}_0x43ac66[_0xb1a3('0x1a')](_0x117824)[_0xb1a3('0x27')](_0x29cccf);};}exports[_0xb1a3('0x28')]=function(_0x209fc4,_0x509580){var _0x44b862={},_0x117f41={},_0x56b100={'count':0x0,'rows':[]};var _0x4d99d9=_['map'](db[_0xb1a3('0x29')][_0xb1a3('0x2a')],function(_0x2b1f5e){return{'name':_0x2b1f5e[_0xb1a3('0x2b')],'type':_0x2b1f5e[_0xb1a3('0x2c')]['key']};});_0x117f41['model']=_[_0xb1a3('0x2d')](_0x4d99d9,'name');_0x117f41['query']=_[_0xb1a3('0x2e')](_0x209fc4[_0xb1a3('0x2f')]);_0x117f41[_0xb1a3('0x30')]=_[_0xb1a3('0x31')](_0x117f41[_0xb1a3('0x32')],_0x117f41[_0xb1a3('0x2f')]);_0x44b862['attributes']=_[_0xb1a3('0x31')](_0x117f41[_0xb1a3('0x32')],qs[_0xb1a3('0x33')](_0x209fc4[_0xb1a3('0x2f')][_0xb1a3('0x33')]));_0x44b862[_0xb1a3('0x34')]=_0x44b862['attributes'][_0xb1a3('0x35')]?_0x44b862['attributes']:_0x117f41[_0xb1a3('0x32')];if(!_0x209fc4[_0xb1a3('0x2f')][_0xb1a3('0x36')](_0xb1a3('0x37'))){_0x44b862['limit']=qs[_0xb1a3('0x1d')](_0x209fc4[_0xb1a3('0x2f')][_0xb1a3('0x1d')]);_0x44b862['offset']=qs[_0xb1a3('0x1c')](_0x209fc4['query']['offset']);}_0x44b862['order']=qs[_0xb1a3('0x38')](_0x209fc4[_0xb1a3('0x2f')]['sort']);_0x44b862['where']=qs[_0xb1a3('0x30')](_[_0xb1a3('0x39')](_0x209fc4[_0xb1a3('0x2f')],_0x117f41['filters']),_0x4d99d9);if(_0x209fc4['query'][_0xb1a3('0x3a')]){_0x44b862[_0xb1a3('0x3b')]=_[_0xb1a3('0x3c')](_0x44b862[_0xb1a3('0x3b')],{'$or':_[_0xb1a3('0x2d')](_0x4d99d9,function(_0x52f0f4){if(_0x52f0f4[_0xb1a3('0x2c')]!==_0xb1a3('0x3d')){var _0x59f708={};_0x59f708[_0x52f0f4['name']]={'$like':'%'+_0x209fc4[_0xb1a3('0x2f')][_0xb1a3('0x3a')]+'%'};return _0x59f708;}})});}_0x44b862=_[_0xb1a3('0x3c')]({},_0x44b862,_0x209fc4[_0xb1a3('0x3e')]);var _0x247853={'where':_0x44b862[_0xb1a3('0x3b')]};return db[_0xb1a3('0x29')][_0xb1a3('0x1b')](_0x247853)[_0xb1a3('0x24')](function(_0x48ed93){_0x56b100[_0xb1a3('0x1b')]=_0x48ed93;if(_0x209fc4[_0xb1a3('0x2f')][_0xb1a3('0x3f')]){_0x44b862[_0xb1a3('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xb1a3('0x41')](_0x44b862);})[_0xb1a3('0x24')](function(_0x167f11){_0x56b100[_0xb1a3('0x42')]=_0x167f11;return _0x56b100;})['then'](respondWithFilteredResult(_0x509580,_0x44b862))['catch'](handleError(_0x509580,null));};exports['show']=function(_0x348900,_0x3a4db3){var _0x3c1e19={'raw':!![],'where':{'id':_0x348900[_0xb1a3('0x43')]['id']}},_0x4139e9={};_0x4139e9[_0xb1a3('0x32')]=_[_0xb1a3('0x2e')](db[_0xb1a3('0x29')][_0xb1a3('0x2a')]);_0x4139e9[_0xb1a3('0x2f')]=_['keys'](_0x348900[_0xb1a3('0x2f')]);_0x4139e9['filters']=_['intersection'](_0x4139e9['model'],_0x4139e9[_0xb1a3('0x2f')]);_0x3c1e19[_0xb1a3('0x34')]=_[_0xb1a3('0x31')](_0x4139e9[_0xb1a3('0x32')],qs[_0xb1a3('0x33')](_0x348900['query'][_0xb1a3('0x33')]));_0x3c1e19[_0xb1a3('0x34')]=_0x3c1e19[_0xb1a3('0x34')][_0xb1a3('0x35')]?_0x3c1e19[_0xb1a3('0x34')]:_0x4139e9[_0xb1a3('0x32')];if(_0x348900[_0xb1a3('0x2f')][_0xb1a3('0x3f')]){_0x3c1e19[_0xb1a3('0x40')]=[{'all':!![]}];}_0x3c1e19=_[_0xb1a3('0x3c')]({},_0x3c1e19,_0x348900[_0xb1a3('0x3e')]);return db[_0xb1a3('0x29')][_0xb1a3('0x44')](_0x3c1e19)[_0xb1a3('0x24')](handleEntityNotFound(_0x3a4db3,null))['then'](respondWithResult(_0x3a4db3,null))[_0xb1a3('0x45')](handleError(_0x3a4db3,null));};exports[_0xb1a3('0x46')]=function(_0x4a609e,_0x45126a){return db[_0xb1a3('0x29')]['create'](_0x4a609e[_0xb1a3('0x47')],{})['then'](respondWithResult(_0x45126a,0xc9))['catch'](handleError(_0x45126a,null));};exports[_0xb1a3('0x23')]=function(_0x3bb5be,_0xd5e88d){if(_0x3bb5be['body']['id']){delete _0x3bb5be['body']['id'];}return db[_0xb1a3('0x29')][_0xb1a3('0x44')]({'where':{'id':_0x3bb5be[_0xb1a3('0x43')]['id']}})['then'](handleEntityNotFound(_0xd5e88d,null))[_0xb1a3('0x24')](saveUpdates(_0x3bb5be[_0xb1a3('0x47')],null))['then'](respondWithResult(_0xd5e88d,null))[_0xb1a3('0x45')](handleError(_0xd5e88d,null));};exports[_0xb1a3('0x25')]=function(_0x379bcb,_0x59be1a){return db[_0xb1a3('0x29')]['find']({'where':{'id':_0x379bcb[_0xb1a3('0x43')]['id']}})[_0xb1a3('0x24')](handleEntityNotFound(_0x59be1a,null))[_0xb1a3('0x24')](removeEntity(_0x59be1a,null))['catch'](handleError(_0x59be1a,null));};exports[_0xb1a3('0x48')]=function(_0x582602,_0x55cb22){return db[_0xb1a3('0x29')][_0xb1a3('0x48')]()[_0xb1a3('0x24')](respondWithResult(_0x55cb22,null))[_0xb1a3('0x45')](handleError(_0x55cb22,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4530d3a..04ea47a 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 _0xfd73=['report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfd73,0xc5));var _0x3fd7=function(_0x27cbe5,_0x496213){_0x27cbe5=_0x27cbe5-0x0;var _0x58f8bf=_0xfd73[_0x27cbe5];return _0x58f8bf;};'use strict';var _=require(_0x3fd7('0x0'));var util=require('util');var logger=require(_0x3fd7('0x1'))(_0x3fd7('0x2'));var moment=require('moment');var BPromise=require(_0x3fd7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fd7('0x4'));var rimraf=require(_0x3fd7('0x5'));var config=require(_0x3fd7('0x6'));var attributes=require(_0x3fd7('0x7'));module[_0x3fd7('0x8')]=function(_0x472841,_0x53d6ca){return _0x472841[_0x3fd7('0x9')](_0x3fd7('0xa'),attributes,{'tableName':_0x3fd7('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3fd7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbbe8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x3d5947,_0x41b313){var _0x484542=function(_0x1d3409){while(--_0x1d3409){_0x3d5947['push'](_0x3d5947['shift']());}};_0x484542(++_0x41b313);}(_0xbbe8,0x12e));var _0x8bbe=function(_0x1a897b,_0x33c762){_0x1a897b=_0x1a897b-0x0;var _0x54da75=_0xbbe8[_0x1a897b];return _0x54da75;};'use strict';var _=require(_0x8bbe('0x0'));var util=require(_0x8bbe('0x1'));var logger=require(_0x8bbe('0x2'))(_0x8bbe('0x3'));var moment=require(_0x8bbe('0x4'));var BPromise=require(_0x8bbe('0x5'));var rp=require(_0x8bbe('0x6'));var fs=require('fs');var path=require(_0x8bbe('0x7'));var rimraf=require(_0x8bbe('0x8'));var config=require(_0x8bbe('0x9'));var attributes=require(_0x8bbe('0xa'));module[_0x8bbe('0xb')]=function(_0x1a7cec,_0x4b1d71){return _0x1a7cec[_0x8bbe('0xc')](_0x8bbe('0xd'),attributes,{'tableName':_0x8bbe('0xe'),'paranoid':![],'indexes':[{'name':_0x8bbe('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 329eb49..2248e8a 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 _0x9dc6=['create','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport'];(function(_0x2f0958,_0x6ebe98){var _0x50daba=function(_0x4e2b3f){while(--_0x4e2b3f){_0x2f0958['push'](_0x2f0958['shift']());}};_0x50daba(++_0x6ebe98);}(_0x9dc6,0xd5));var _0x69dc=function(_0x2ace81,_0x12b0bd){_0x2ace81=_0x2ace81-0x0;var _0x2f58a1=_0x9dc6[_0x2ace81];return _0x2f58a1;};'use strict';var _=require(_0x69dc('0x0'));var util=require(_0x69dc('0x1'));var moment=require(_0x69dc('0x2'));var BPromise=require(_0x69dc('0x3'));var rs=require(_0x69dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69dc('0x5'))['db'];var utils=require(_0x69dc('0x6'));var logger=require('../../config/logger')(_0x69dc('0x7'));var config=require(_0x69dc('0x8'));var jayson=require(_0x69dc('0x9'));var client=jayson[_0x69dc('0xa')][_0x69dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ab887,_0x3fa01e,_0x22a0af){return new BPromise(function(_0x567d69,_0x28a8a4){return client[_0x69dc('0xc')](_0x1ab887,_0x22a0af)[_0x69dc('0xd')](function(_0x1df8c5){logger[_0x69dc('0xe')](_0x69dc('0xf'),_0x3fa01e,_0x69dc('0x10'));logger[_0x69dc('0x11')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3fa01e,_0x69dc('0x10'),JSON[_0x69dc('0x12')](_0x1df8c5));if(_0x1df8c5[_0x69dc('0x13')]){if(_0x1df8c5[_0x69dc('0x13')][_0x69dc('0x14')]===0x1f4){logger[_0x69dc('0x13')](_0x69dc('0xf'),_0x3fa01e,_0x1df8c5[_0x69dc('0x13')][_0x69dc('0x15')]);return _0x28a8a4(_0x1df8c5[_0x69dc('0x13')][_0x69dc('0x15')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3fa01e,_0x1df8c5[_0x69dc('0x13')][_0x69dc('0x15')]);return _0x567d69(_0x1df8c5[_0x69dc('0x13')]['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x3fa01e,'request\x20sent');_0x567d69(_0x1df8c5[_0x69dc('0x16')][_0x69dc('0x15')]);}})[_0x69dc('0x17')](function(_0x2ac1a1){logger[_0x69dc('0x13')](_0x69dc('0xf'),_0x3fa01e,_0x2ac1a1);_0x28a8a4(_0x2ac1a1);});});}exports[_0x69dc('0x18')]=function(_0x481822){var _0x23c2eb=this;return new Promise(function(_0x4025ea,_0x5a8dc4){return db['WhatsappQueueReport'][_0x69dc('0x19')](_0x481822['body'],{'raw':_0x481822[_0x69dc('0x1a')]?_0x481822[_0x69dc('0x1a')][_0x69dc('0x1b')]===undefined?!![]:![]:!![]})[_0x69dc('0xd')](function(_0x5868e6){logger[_0x69dc('0xe')](_0x69dc('0x18'),_0x481822);logger[_0x69dc('0x11')](_0x69dc('0x18'),_0x481822,JSON['stringify'](_0x5868e6));_0x4025ea(_0x5868e6);})['catch'](function(_0x437d74){logger['error'](_0x69dc('0x18'),_0x437d74[_0x69dc('0x15')],_0x481822);_0x5a8dc4(_0x23c2eb[_0x69dc('0x13')](0x1f4,_0x437d74[_0x69dc('0x15')]));});});};exports[_0x69dc('0x1c')]=function(_0x4025a7){var _0x360a2f=this;return new Promise(function(_0x474faf,_0x2ab983){return db[_0x69dc('0x1d')][_0x69dc('0x1e')](_0x4025a7['body'],{'raw':_0x4025a7[_0x69dc('0x1a')]?_0x4025a7[_0x69dc('0x1a')][_0x69dc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4025a7[_0x69dc('0x1a')]?_0x4025a7[_0x69dc('0x1a')][_0x69dc('0x1f')]||null:null,'attributes':_0x4025a7['options']?_0x4025a7[_0x69dc('0x1a')][_0x69dc('0x20')]||null:null,'limit':_0x4025a7[_0x69dc('0x1a')]?_0x4025a7[_0x69dc('0x1a')][_0x69dc('0x21')]||null:null})[_0x69dc('0xd')](function(_0x296330){logger['info'](_0x69dc('0x1c'),_0x4025a7);logger[_0x69dc('0x11')]('UpdateWhatsappQueueReport',_0x4025a7,JSON[_0x69dc('0x12')](_0x296330));_0x474faf(_0x296330);})['catch'](function(_0x4f9481){logger['error'](_0x69dc('0x1c'),_0x4f9481[_0x69dc('0x15')],_0x4025a7);_0x2ab983(_0x360a2f[_0x69dc('0x13')](0x1f4,_0x4f9481[_0x69dc('0x15')]));});});}; \ No newline at end of file +var _0xca4e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','util'];(function(_0x45db04,_0x34d09b){var _0x4973cb=function(_0x9a4568){while(--_0x9a4568){_0x45db04['push'](_0x45db04['shift']());}};_0x4973cb(++_0x34d09b);}(_0xca4e,0x65));var _0xeca4=function(_0x3fa034,_0x528bb9){_0x3fa034=_0x3fa034-0x0;var _0xb01cef=_0xca4e[_0x3fa034];return _0xb01cef;};'use strict';var _=require('lodash');var util=require(_0xeca4('0x0'));var moment=require(_0xeca4('0x1'));var BPromise=require(_0xeca4('0x2'));var rs=require(_0xeca4('0x3'));var fs=require('fs');var Redis=require(_0xeca4('0x4'));var db=require(_0xeca4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeca4('0x6'))(_0xeca4('0x7'));var config=require(_0xeca4('0x8'));var jayson=require(_0xeca4('0x9'));var client=jayson[_0xeca4('0xa')][_0xeca4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x463d48,_0x4d9a74,_0x1466f9){return new BPromise(function(_0x1b4862,_0x422082){return client[_0xeca4('0xc')](_0x463d48,_0x1466f9)[_0xeca4('0xd')](function(_0x2bffca){logger['info'](_0xeca4('0xe'),_0x4d9a74,_0xeca4('0xf'));logger[_0xeca4('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4d9a74,_0xeca4('0xf'),JSON[_0xeca4('0x11')](_0x2bffca));if(_0x2bffca[_0xeca4('0x12')]){if(_0x2bffca[_0xeca4('0x12')][_0xeca4('0x13')]===0x1f4){logger[_0xeca4('0x12')](_0xeca4('0xe'),_0x4d9a74,_0x2bffca['error'][_0xeca4('0x14')]);return _0x422082(_0x2bffca['error'][_0xeca4('0x14')]);}logger[_0xeca4('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4d9a74,_0x2bffca[_0xeca4('0x12')][_0xeca4('0x14')]);return _0x1b4862(_0x2bffca[_0xeca4('0x12')][_0xeca4('0x14')]);}else{logger[_0xeca4('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4d9a74,_0xeca4('0xf'));_0x1b4862(_0x2bffca['result'][_0xeca4('0x14')]);}})[_0xeca4('0x16')](function(_0x4a52f3){logger['error'](_0xeca4('0xe'),_0x4d9a74,_0x4a52f3);_0x422082(_0x4a52f3);});});}exports[_0xeca4('0x17')]=function(_0x30823a){var _0x533cec=this;return new Promise(function(_0x4ca58b,_0x501801){return db[_0xeca4('0x18')][_0xeca4('0x19')](_0x30823a[_0xeca4('0x1a')],{'raw':_0x30823a[_0xeca4('0x1b')]?_0x30823a[_0xeca4('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xeca4('0xd')](function(_0x1d4911){logger['info']('CreateWhatsappQueueReport',_0x30823a);logger[_0xeca4('0x10')](_0xeca4('0x17'),_0x30823a,JSON['stringify'](_0x1d4911));_0x4ca58b(_0x1d4911);})[_0xeca4('0x16')](function(_0x51644e){logger[_0xeca4('0x12')](_0xeca4('0x17'),_0x51644e[_0xeca4('0x14')],_0x30823a);_0x501801(_0x533cec['error'](0x1f4,_0x51644e['message']));});});};exports[_0xeca4('0x1c')]=function(_0x2c359d){var _0x2d9dd3=this;return new Promise(function(_0x433905,_0x5d5296){return db[_0xeca4('0x18')][_0xeca4('0x1d')](_0x2c359d[_0xeca4('0x1a')],{'raw':_0x2c359d[_0xeca4('0x1b')]?_0x2c359d[_0xeca4('0x1b')][_0xeca4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c359d[_0xeca4('0x1b')]?_0x2c359d[_0xeca4('0x1b')][_0xeca4('0x1f')]||null:null,'attributes':_0x2c359d[_0xeca4('0x1b')]?_0x2c359d[_0xeca4('0x1b')][_0xeca4('0x20')]||null:null,'limit':_0x2c359d['options']?_0x2c359d[_0xeca4('0x1b')][_0xeca4('0x21')]||null:null})[_0xeca4('0xd')](function(_0x4b9de7){logger[_0xeca4('0x15')](_0xeca4('0x1c'),_0x2c359d);logger[_0xeca4('0x10')](_0xeca4('0x1c'),_0x2c359d,JSON[_0xeca4('0x11')](_0x4b9de7));_0x433905(_0x4b9de7);})[_0xeca4('0x16')](function(_0x3ae8c0){logger[_0xeca4('0x12')](_0xeca4('0x1c'),_0x3ae8c0[_0xeca4('0x14')],_0x2c359d);_0x5d5296(_0x2d9dd3[_0xeca4('0x12')](0x1f4,_0x3ae8c0[_0xeca4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a7e96bf..535f5a1 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 _0x51db=['isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0x107c8b,_0x22e18e){var _0x2b8171=function(_0x450df4){while(--_0x450df4){_0x107c8b['push'](_0x107c8b['shift']());}};_0x2b8171(++_0x22e18e);}(_0x51db,0xb5));var _0xb51d=function(_0x2ffaea,_0x43f64b){_0x2ffaea=_0x2ffaea-0x0;var _0x180ef8=_0x51db[_0x2ffaea];return _0x180ef8;};'use strict';var multer=require(_0xb51d('0x0'));var util=require(_0xb51d('0x1'));var path=require(_0xb51d('0x2'));var timeout=require(_0xb51d('0x3'));var express=require(_0xb51d('0x4'));var router=express[_0xb51d('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb51d('0x6'));var controller=require(_0xb51d('0x7'));router[_0xb51d('0x8')]('/',auth[_0xb51d('0x9')](),controller[_0xb51d('0xa')]);router[_0xb51d('0x8')](_0xb51d('0xb'),auth[_0xb51d('0x9')](),controller[_0xb51d('0xc')]);router[_0xb51d('0x8')](_0xb51d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb51d('0xe')]('/',auth['isAuthenticated'](),controller[_0xb51d('0xf')]);router[_0xb51d('0x10')](_0xb51d('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xb51d('0x11')](_0xb51d('0xd'),auth[_0xb51d('0x9')](),controller['destroy']);module[_0xb51d('0x12')]=router; \ No newline at end of file +var _0x38c1=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x4c6909,_0x30c50a){var _0x3d6f15=function(_0x33e662){while(--_0x33e662){_0x4c6909['push'](_0x4c6909['shift']());}};_0x3d6f15(++_0x30c50a);}(_0x38c1,0x7f));var _0x138c=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x38c1[_0x4a599b];return _0x2d53d3;};'use strict';var multer=require(_0x138c('0x0'));var util=require(_0x138c('0x1'));var path=require(_0x138c('0x2'));var timeout=require(_0x138c('0x3'));var express=require(_0x138c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x138c('0x5'));var config=require(_0x138c('0x6'));var controller=require(_0x138c('0x7'));router[_0x138c('0x8')]('/',auth[_0x138c('0x9')](),controller[_0x138c('0xa')]);router['get'](_0x138c('0xb'),auth[_0x138c('0x9')](),controller[_0x138c('0xc')]);router[_0x138c('0x8')](_0x138c('0xd'),auth[_0x138c('0x9')](),controller[_0x138c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x138c('0xf')]);router[_0x138c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x138c('0x11')]);router['delete'](_0x138c('0xd'),auth[_0x138c('0x9')](),controller['destroy']);module[_0x138c('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 15da11c..6ee9dda 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 _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x30c0ab,_0x5e60df){var _0x7d821=function(_0x367c1d){while(--_0x367c1d){_0x30c0ab['push'](_0x30c0ab['shift']());}};_0x7d821(++_0x5e60df);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfb4aed,_0x6d91a8){_0xfb4aed=_0xfb4aed-0x0;var _0x32d7ac=_0x5f2f[_0xfb4aed];return _0x32d7ac;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 4464ce3..e3844c4 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 _0xf657=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','save','then','destroy','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','length','options','find','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x4a4c20,_0x4990a1){var _0x345fad=function(_0x5d55c5){while(--_0x5d55c5){_0x4a4c20['push'](_0x4a4c20['shift']());}};_0x345fad(++_0x4990a1);}(_0xf657,0x85));var _0x7f65=function(_0x31b5bf,_0xa511e6){_0x31b5bf=_0x31b5bf-0x0;var _0x553be2=_0xf657[_0x31b5bf];return _0x553be2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7f65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f65('0x1'));var jsonpatch=require(_0x7f65('0x2'));var rp=require('request-promise');var moment=require(_0x7f65('0x3'));var BPromise=require(_0x7f65('0x4'));var Mustache=require(_0x7f65('0x5'));var util=require(_0x7f65('0x6'));var path=require(_0x7f65('0x7'));var sox=require(_0x7f65('0x8'));var csv=require('to-csv');var ejs=require(_0x7f65('0x9'));var fs=require('fs');var _=require(_0x7f65('0xa'));var squel=require(_0x7f65('0xb'));var crypto=require('crypto');var jsforce=require(_0x7f65('0xc'));var deskjs=require(_0x7f65('0xd'));var toCsv=require(_0x7f65('0xe'));var querystring=require(_0x7f65('0xf'));var Papa=require(_0x7f65('0x10'));var Redis=require('ioredis');var authService=require(_0x7f65('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f65('0x12'));var hardwareService=require(_0x7f65('0x13'));var logger=require(_0x7f65('0x14'))(_0x7f65('0x15'));var utils=require(_0x7f65('0x16'));var config=require(_0x7f65('0x17'));var db=require(_0x7f65('0x18'))['db'];function respondWithStatusCode(_0xdeadbc,_0x382c05){_0x382c05=_0x382c05||0xcc;return function(_0x4f8114){if(_0x4f8114){return _0xdeadbc[_0x7f65('0x19')](_0x382c05);}return _0xdeadbc[_0x7f65('0x1a')](_0x382c05)['end']();};}function respondWithResult(_0x3f4477,_0x1c7284){_0x1c7284=_0x1c7284||0xc8;return function(_0x39eea8){if(_0x39eea8){return _0x3f4477[_0x7f65('0x1a')](_0x1c7284)[_0x7f65('0x1b')](_0x39eea8);}};}function respondWithFilteredResult(_0x2b3c39,_0x1a0528){return function(_0x3c0f59){if(_0x3c0f59){var _0x38ce43=_0x3c0f59[_0x7f65('0x1c')],_0x381764=_0x1a0528[_0x7f65('0x1d')],_0x55b8dc=_0x1a0528[_0x7f65('0x1d')]+_0x1a0528['limit'],_0x118ffa;if(_0x55b8dc>=_0x38ce43){_0x55b8dc=_0x38ce43;_0x118ffa=0xc8;}else{_0x118ffa=0xce;}_0x2b3c39['status'](_0x118ffa);return _0x2b3c39[_0x7f65('0x1e')]('Content-Range',_0x381764+'-'+_0x55b8dc+'/'+_0x38ce43)[_0x7f65('0x1b')](_0x3c0f59);}return null;};}function patchUpdates(_0x2c04f0){return function(_0x5df644){try{jsonpatch[_0x7f65('0x1f')](_0x5df644,_0x2c04f0,!![]);}catch(_0x4c95d1){return BPromise['reject'](_0x4c95d1);}return _0x5df644[_0x7f65('0x20')]();};}function saveUpdates(_0x3b34f7,_0x572643){return function(_0x52b61f){if(_0x52b61f){return _0x52b61f['update'](_0x3b34f7)[_0x7f65('0x21')](function(_0x59bb2f){return _0x59bb2f;});}return null;};}function removeEntity(_0x110e66,_0x406034){return function(_0x25c4ba){if(_0x25c4ba){return _0x25c4ba[_0x7f65('0x22')]()[_0x7f65('0x21')](function(){_0x110e66['status'](0xcc)[_0x7f65('0x23')]();});}};}function handleEntityNotFound(_0x3cbc35,_0x230682){return function(_0x2eb2be){if(!_0x2eb2be){_0x3cbc35[_0x7f65('0x19')](0x194);}return _0x2eb2be;};}function handleError(_0x2ce7a6,_0x18f110){_0x18f110=_0x18f110||0x1f4;return function(_0x571008){logger[_0x7f65('0x24')](_0x571008[_0x7f65('0x25')]);if(_0x571008['name']){delete _0x571008[_0x7f65('0x26')];}_0x2ce7a6[_0x7f65('0x1a')](_0x18f110)[_0x7f65('0x27')](_0x571008);};}exports[_0x7f65('0x28')]=function(_0x204daa,_0x4895ca){var _0x506ee0={},_0x45fb7f={},_0x45eab6={'count':0x0,'rows':[]};var _0x2ce194=_[_0x7f65('0x29')](db[_0x7f65('0x2a')][_0x7f65('0x2b')],function(_0x347725){return{'name':_0x347725[_0x7f65('0x2c')],'type':_0x347725[_0x7f65('0x2d')][_0x7f65('0x2e')]};});_0x45fb7f[_0x7f65('0x2f')]=_['map'](_0x2ce194,_0x7f65('0x26'));_0x45fb7f[_0x7f65('0x30')]=_[_0x7f65('0x31')](_0x204daa[_0x7f65('0x30')]);_0x45fb7f['filters']=_[_0x7f65('0x32')](_0x45fb7f[_0x7f65('0x2f')],_0x45fb7f[_0x7f65('0x30')]);_0x506ee0[_0x7f65('0x33')]=_['intersection'](_0x45fb7f[_0x7f65('0x2f')],qs['fields'](_0x204daa['query'][_0x7f65('0x34')]));_0x506ee0[_0x7f65('0x33')]=_0x506ee0['attributes']['length']?_0x506ee0[_0x7f65('0x33')]:_0x45fb7f[_0x7f65('0x2f')];if(!_0x204daa[_0x7f65('0x30')][_0x7f65('0x35')](_0x7f65('0x36'))){_0x506ee0[_0x7f65('0x37')]=qs[_0x7f65('0x37')](_0x204daa[_0x7f65('0x30')][_0x7f65('0x37')]);_0x506ee0['offset']=qs[_0x7f65('0x1d')](_0x204daa[_0x7f65('0x30')][_0x7f65('0x1d')]);}_0x506ee0['order']=qs[_0x7f65('0x38')](_0x204daa[_0x7f65('0x30')][_0x7f65('0x38')]);_0x506ee0[_0x7f65('0x39')]=qs[_0x7f65('0x3a')](_[_0x7f65('0x3b')](_0x204daa[_0x7f65('0x30')],_0x45fb7f[_0x7f65('0x3a')]),_0x2ce194);if(_0x204daa[_0x7f65('0x30')][_0x7f65('0x3c')]){_0x506ee0[_0x7f65('0x39')]=_['merge'](_0x506ee0[_0x7f65('0x39')],{'$or':_['map'](_0x2ce194,function(_0x1d4a37){if(_0x1d4a37['type']!==_0x7f65('0x3d')){var _0xc2aea2={};_0xc2aea2[_0x1d4a37[_0x7f65('0x26')]]={'$like':'%'+_0x204daa[_0x7f65('0x30')][_0x7f65('0x3c')]+'%'};return _0xc2aea2;}})});}_0x506ee0=_[_0x7f65('0x3e')]({},_0x506ee0,_0x204daa['options']);var _0x1786a9={'where':_0x506ee0[_0x7f65('0x39')]};return db['WhatsappTransferReport']['count'](_0x1786a9)[_0x7f65('0x21')](function(_0x42c83f){_0x45eab6[_0x7f65('0x1c')]=_0x42c83f;if(_0x204daa[_0x7f65('0x30')][_0x7f65('0x3f')]){_0x506ee0[_0x7f65('0x40')]=[{'all':!![]}];}return db[_0x7f65('0x2a')]['findAll'](_0x506ee0);})['then'](function(_0x158967){_0x45eab6[_0x7f65('0x41')]=_0x158967;return _0x45eab6;})[_0x7f65('0x21')](respondWithFilteredResult(_0x4895ca,_0x506ee0))[_0x7f65('0x42')](handleError(_0x4895ca,null));};exports[_0x7f65('0x43')]=function(_0x37d3b3,_0x6c2178){var _0x133bc6={'raw':!![],'where':{'id':_0x37d3b3[_0x7f65('0x44')]['id']}},_0x6457da={};_0x6457da[_0x7f65('0x2f')]=_['keys'](db['WhatsappTransferReport']['rawAttributes']);_0x6457da[_0x7f65('0x30')]=_[_0x7f65('0x31')](_0x37d3b3[_0x7f65('0x30')]);_0x6457da['filters']=_[_0x7f65('0x32')](_0x6457da[_0x7f65('0x2f')],_0x6457da['query']);_0x133bc6['attributes']=_[_0x7f65('0x32')](_0x6457da['model'],qs[_0x7f65('0x34')](_0x37d3b3[_0x7f65('0x30')][_0x7f65('0x34')]));_0x133bc6[_0x7f65('0x33')]=_0x133bc6['attributes'][_0x7f65('0x45')]?_0x133bc6[_0x7f65('0x33')]:_0x6457da[_0x7f65('0x2f')];if(_0x37d3b3[_0x7f65('0x30')]['includeAll']){_0x133bc6[_0x7f65('0x40')]=[{'all':!![]}];}_0x133bc6=_[_0x7f65('0x3e')]({},_0x133bc6,_0x37d3b3[_0x7f65('0x46')]);return db[_0x7f65('0x2a')][_0x7f65('0x47')](_0x133bc6)[_0x7f65('0x21')](handleEntityNotFound(_0x6c2178,null))[_0x7f65('0x21')](respondWithResult(_0x6c2178,null))[_0x7f65('0x42')](handleError(_0x6c2178,null));};exports['create']=function(_0x22a2c2,_0x2de9b5){return db[_0x7f65('0x2a')]['create'](_0x22a2c2[_0x7f65('0x48')],{})[_0x7f65('0x21')](respondWithResult(_0x2de9b5,0xc9))[_0x7f65('0x42')](handleError(_0x2de9b5,null));};exports[_0x7f65('0x49')]=function(_0x24b5b2,_0x406b89){if(_0x24b5b2[_0x7f65('0x48')]['id']){delete _0x24b5b2[_0x7f65('0x48')]['id'];}return db[_0x7f65('0x2a')][_0x7f65('0x47')]({'where':{'id':_0x24b5b2[_0x7f65('0x44')]['id']}})[_0x7f65('0x21')](handleEntityNotFound(_0x406b89,null))['then'](saveUpdates(_0x24b5b2[_0x7f65('0x48')],null))[_0x7f65('0x21')](respondWithResult(_0x406b89,null))[_0x7f65('0x42')](handleError(_0x406b89,null));};exports[_0x7f65('0x22')]=function(_0x2b8842,_0x4b0714){return db[_0x7f65('0x2a')][_0x7f65('0x47')]({'where':{'id':_0x2b8842[_0x7f65('0x44')]['id']}})[_0x7f65('0x21')](handleEntityNotFound(_0x4b0714,null))['then'](removeEntity(_0x4b0714,null))[_0x7f65('0x42')](handleError(_0x4b0714,null));};exports[_0x7f65('0x4a')]=function(_0x5a242d,_0x1aaaf3){return db[_0x7f65('0x2a')][_0x7f65('0x4a')]()[_0x7f65('0x21')](respondWithResult(_0x1aaaf3,null))[_0x7f65('0x42')](handleError(_0x1aaaf3,null));}; \ No newline at end of file +var _0xae31=['findAll','rows','show','filters','includeAll','find','create','body','catch','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','include'];(function(_0x26d018,_0xedb83d){var _0x296c00=function(_0x1471d2){while(--_0x1471d2){_0x26d018['push'](_0x26d018['shift']());}};_0x296c00(++_0xedb83d);}(_0xae31,0x12f));var _0x1ae3=function(_0x2bd8e5,_0x113d99){_0x2bd8e5=_0x2bd8e5-0x0;var _0x5b0230=_0xae31[_0x2bd8e5];return _0x5b0230;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1ae3('0x0'));var zipdir=require(_0x1ae3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ae3('0x2'));var moment=require(_0x1ae3('0x3'));var BPromise=require(_0x1ae3('0x4'));var Mustache=require('mustache');var util=require(_0x1ae3('0x5'));var path=require('path');var sox=require(_0x1ae3('0x6'));var csv=require(_0x1ae3('0x7'));var ejs=require(_0x1ae3('0x8'));var fs=require('fs');var _=require(_0x1ae3('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ae3('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1ae3('0xb'));var Papa=require(_0x1ae3('0xc'));var Redis=require(_0x1ae3('0xd'));var authService=require(_0x1ae3('0xe'));var qs=require(_0x1ae3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ae3('0x10'));var logger=require(_0x1ae3('0x11'))(_0x1ae3('0x12'));var utils=require(_0x1ae3('0x13'));var config=require(_0x1ae3('0x14'));var db=require(_0x1ae3('0x15'))['db'];function respondWithStatusCode(_0x12e6fa,_0x369bc6){_0x369bc6=_0x369bc6||0xcc;return function(_0x2f6b87){if(_0x2f6b87){return _0x12e6fa[_0x1ae3('0x16')](_0x369bc6);}return _0x12e6fa['status'](_0x369bc6)[_0x1ae3('0x17')]();};}function respondWithResult(_0x2cb47d,_0x18d5c8){_0x18d5c8=_0x18d5c8||0xc8;return function(_0x260770){if(_0x260770){return _0x2cb47d['status'](_0x18d5c8)[_0x1ae3('0x18')](_0x260770);}};}function respondWithFilteredResult(_0xfdbfe,_0x5cc3b9){return function(_0x271e7a){if(_0x271e7a){var _0x3b37fa=_0x271e7a[_0x1ae3('0x19')],_0x44ede8=_0x5cc3b9[_0x1ae3('0x1a')],_0x2915fa=_0x5cc3b9['offset']+_0x5cc3b9[_0x1ae3('0x1b')],_0x1271da;if(_0x2915fa>=_0x3b37fa){_0x2915fa=_0x3b37fa;_0x1271da=0xc8;}else{_0x1271da=0xce;}_0xfdbfe['status'](_0x1271da);return _0xfdbfe[_0x1ae3('0x1c')](_0x1ae3('0x1d'),_0x44ede8+'-'+_0x2915fa+'/'+_0x3b37fa)['json'](_0x271e7a);}return null;};}function patchUpdates(_0x34ce57){return function(_0x3d09b3){try{jsonpatch[_0x1ae3('0x1e')](_0x3d09b3,_0x34ce57,!![]);}catch(_0x179b00){return BPromise[_0x1ae3('0x1f')](_0x179b00);}return _0x3d09b3[_0x1ae3('0x20')]();};}function saveUpdates(_0x540f31,_0x1c6239){return function(_0x26639d){if(_0x26639d){return _0x26639d[_0x1ae3('0x21')](_0x540f31)[_0x1ae3('0x22')](function(_0xece008){return _0xece008;});}return null;};}function removeEntity(_0x2405b2,_0x3859d8){return function(_0x1ab3a4){if(_0x1ab3a4){return _0x1ab3a4[_0x1ae3('0x23')]()[_0x1ae3('0x22')](function(){_0x2405b2[_0x1ae3('0x24')](0xcc)[_0x1ae3('0x17')]();});}};}function handleEntityNotFound(_0xb5f333,_0x306daa){return function(_0x1eb7df){if(!_0x1eb7df){_0xb5f333[_0x1ae3('0x16')](0x194);}return _0x1eb7df;};}function handleError(_0x2cf7af,_0x46e59c){_0x46e59c=_0x46e59c||0x1f4;return function(_0x4835ab){logger[_0x1ae3('0x25')](_0x4835ab[_0x1ae3('0x26')]);if(_0x4835ab['name']){delete _0x4835ab[_0x1ae3('0x27')];}_0x2cf7af[_0x1ae3('0x24')](_0x46e59c)[_0x1ae3('0x28')](_0x4835ab);};}exports[_0x1ae3('0x29')]=function(_0x532a70,_0x3ea9d5){var _0x222ac7={},_0xd0ddd8={},_0x302168={'count':0x0,'rows':[]};var _0x97f4ff=_[_0x1ae3('0x2a')](db[_0x1ae3('0x2b')][_0x1ae3('0x2c')],function(_0x4701b0){return{'name':_0x4701b0['fieldName'],'type':_0x4701b0[_0x1ae3('0x2d')][_0x1ae3('0x2e')]};});_0xd0ddd8[_0x1ae3('0x2f')]=_[_0x1ae3('0x2a')](_0x97f4ff,_0x1ae3('0x27'));_0xd0ddd8['query']=_[_0x1ae3('0x30')](_0x532a70[_0x1ae3('0x31')]);_0xd0ddd8['filters']=_['intersection'](_0xd0ddd8[_0x1ae3('0x2f')],_0xd0ddd8[_0x1ae3('0x31')]);_0x222ac7[_0x1ae3('0x32')]=_[_0x1ae3('0x33')](_0xd0ddd8['model'],qs[_0x1ae3('0x34')](_0x532a70['query'][_0x1ae3('0x34')]));_0x222ac7['attributes']=_0x222ac7[_0x1ae3('0x32')][_0x1ae3('0x35')]?_0x222ac7[_0x1ae3('0x32')]:_0xd0ddd8[_0x1ae3('0x2f')];if(!_0x532a70[_0x1ae3('0x31')][_0x1ae3('0x36')](_0x1ae3('0x37'))){_0x222ac7[_0x1ae3('0x1b')]=qs['limit'](_0x532a70[_0x1ae3('0x31')][_0x1ae3('0x1b')]);_0x222ac7[_0x1ae3('0x1a')]=qs['offset'](_0x532a70[_0x1ae3('0x31')][_0x1ae3('0x1a')]);}_0x222ac7[_0x1ae3('0x38')]=qs[_0x1ae3('0x39')](_0x532a70['query'][_0x1ae3('0x39')]);_0x222ac7[_0x1ae3('0x3a')]=qs['filters'](_['pick'](_0x532a70[_0x1ae3('0x31')],_0xd0ddd8['filters']),_0x97f4ff);if(_0x532a70[_0x1ae3('0x31')]['filter']){_0x222ac7[_0x1ae3('0x3a')]=_['merge'](_0x222ac7[_0x1ae3('0x3a')],{'$or':_[_0x1ae3('0x2a')](_0x97f4ff,function(_0x50e367){if(_0x50e367[_0x1ae3('0x2d')]!=='VIRTUAL'){var _0x5e26a9={};_0x5e26a9[_0x50e367[_0x1ae3('0x27')]]={'$like':'%'+_0x532a70[_0x1ae3('0x31')]['filter']+'%'};return _0x5e26a9;}})});}_0x222ac7=_[_0x1ae3('0x3b')]({},_0x222ac7,_0x532a70[_0x1ae3('0x3c')]);var _0x2634c4={'where':_0x222ac7[_0x1ae3('0x3a')]};return db['WhatsappTransferReport'][_0x1ae3('0x19')](_0x2634c4)[_0x1ae3('0x22')](function(_0x13130c){_0x302168[_0x1ae3('0x19')]=_0x13130c;if(_0x532a70['query']['includeAll']){_0x222ac7[_0x1ae3('0x3d')]=[{'all':!![]}];}return db[_0x1ae3('0x2b')][_0x1ae3('0x3e')](_0x222ac7);})[_0x1ae3('0x22')](function(_0x5da5c6){_0x302168[_0x1ae3('0x3f')]=_0x5da5c6;return _0x302168;})[_0x1ae3('0x22')](respondWithFilteredResult(_0x3ea9d5,_0x222ac7))['catch'](handleError(_0x3ea9d5,null));};exports[_0x1ae3('0x40')]=function(_0x13ffe9,_0x491421){var _0x5e59ac={'raw':!![],'where':{'id':_0x13ffe9['params']['id']}},_0x15644f={};_0x15644f['model']=_[_0x1ae3('0x30')](db[_0x1ae3('0x2b')][_0x1ae3('0x2c')]);_0x15644f[_0x1ae3('0x31')]=_[_0x1ae3('0x30')](_0x13ffe9[_0x1ae3('0x31')]);_0x15644f[_0x1ae3('0x41')]=_[_0x1ae3('0x33')](_0x15644f[_0x1ae3('0x2f')],_0x15644f[_0x1ae3('0x31')]);_0x5e59ac[_0x1ae3('0x32')]=_[_0x1ae3('0x33')](_0x15644f[_0x1ae3('0x2f')],qs['fields'](_0x13ffe9[_0x1ae3('0x31')]['fields']));_0x5e59ac[_0x1ae3('0x32')]=_0x5e59ac[_0x1ae3('0x32')][_0x1ae3('0x35')]?_0x5e59ac[_0x1ae3('0x32')]:_0x15644f[_0x1ae3('0x2f')];if(_0x13ffe9['query'][_0x1ae3('0x42')]){_0x5e59ac[_0x1ae3('0x3d')]=[{'all':!![]}];}_0x5e59ac=_[_0x1ae3('0x3b')]({},_0x5e59ac,_0x13ffe9[_0x1ae3('0x3c')]);return db['WhatsappTransferReport'][_0x1ae3('0x43')](_0x5e59ac)[_0x1ae3('0x22')](handleEntityNotFound(_0x491421,null))[_0x1ae3('0x22')](respondWithResult(_0x491421,null))['catch'](handleError(_0x491421,null));};exports[_0x1ae3('0x44')]=function(_0x2349ae,_0x235eaa){return db[_0x1ae3('0x2b')][_0x1ae3('0x44')](_0x2349ae[_0x1ae3('0x45')],{})[_0x1ae3('0x22')](respondWithResult(_0x235eaa,0xc9))[_0x1ae3('0x46')](handleError(_0x235eaa,null));};exports[_0x1ae3('0x21')]=function(_0x1fa7c0,_0x57b6f6){if(_0x1fa7c0[_0x1ae3('0x45')]['id']){delete _0x1fa7c0[_0x1ae3('0x45')]['id'];}return db['WhatsappTransferReport'][_0x1ae3('0x43')]({'where':{'id':_0x1fa7c0[_0x1ae3('0x47')]['id']}})['then'](handleEntityNotFound(_0x57b6f6,null))[_0x1ae3('0x22')](saveUpdates(_0x1fa7c0[_0x1ae3('0x45')],null))[_0x1ae3('0x22')](respondWithResult(_0x57b6f6,null))['catch'](handleError(_0x57b6f6,null));};exports[_0x1ae3('0x23')]=function(_0x4fcaa3,_0x39bdcd){return db['WhatsappTransferReport'][_0x1ae3('0x43')]({'where':{'id':_0x4fcaa3[_0x1ae3('0x47')]['id']}})[_0x1ae3('0x22')](handleEntityNotFound(_0x39bdcd,null))['then'](removeEntity(_0x39bdcd,null))['catch'](handleError(_0x39bdcd,null));};exports['describe']=function(_0x3e7af6,_0xd20dc8){return db[_0x1ae3('0x2b')][_0x1ae3('0x48')]()['then'](respondWithResult(_0xd20dc8,null))[_0x1ae3('0x46')](handleError(_0xd20dc8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 1dda9b7..7f9a169 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 _0xd0a7=['request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4aca86,_0x1ed97e){var _0x57bb1f=function(_0x1a9657){while(--_0x1a9657){_0x4aca86['push'](_0x4aca86['shift']());}};_0x57bb1f(++_0x1ed97e);}(_0xd0a7,0x1e8));var _0x7d0a=function(_0x23f48d,_0x370f63){_0x23f48d=_0x23f48d-0x0;var _0x2e1d3a=_0xd0a7[_0x23f48d];return _0x2e1d3a;};'use strict';var _=require(_0x7d0a('0x0'));var util=require(_0x7d0a('0x1'));var logger=require(_0x7d0a('0x2'))(_0x7d0a('0x3'));var moment=require(_0x7d0a('0x4'));var BPromise=require(_0x7d0a('0x5'));var rp=require(_0x7d0a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d0a('0x7'));var attributes=require(_0x7d0a('0x8'));module[_0x7d0a('0x9')]=function(_0x2df3e1,_0x264147){return _0x2df3e1[_0x7d0a('0xa')](_0x7d0a('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x7d0a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1387=['path','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1387,0xa3));var _0x7138=function(_0x1180a3,_0x2103bd){_0x1180a3=_0x1180a3-0x0;var _0x462124=_0x1387[_0x1180a3];return _0x462124;};'use strict';var _=require(_0x7138('0x0'));var util=require(_0x7138('0x1'));var logger=require(_0x7138('0x2'))(_0x7138('0x3'));var moment=require(_0x7138('0x4'));var BPromise=require(_0x7138('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7138('0x6'));var rimraf=require('rimraf');var config=require(_0x7138('0x7'));var attributes=require(_0x7138('0x8'));module[_0x7138('0x9')]=function(_0x15f889,_0x1328e4){return _0x15f889[_0x7138('0xa')]('WhatsappTransferReport',attributes,{'tableName':_0x7138('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7138('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c21c6b2..6a2e7f8 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(_0x17d2f6,_0x26601d){var _0x5722a5=function(_0x368e31){while(--_0x368e31){_0x17d2f6['push'](_0x17d2f6['shift']());}};_0x5722a5(++_0x26601d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x309a5a,_0x3a4312){var _0x1eac08=function(_0x4b1705){while(--_0x4b1705){_0x309a5a['push'](_0x309a5a['shift']());}};_0x1eac08(++_0x3a4312);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 431a54d..08d6be3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd405=['./config/pm2/config','./config/schedule','./config/schedule/transcribe','sequelize','then','listen','info','start','Online\x20apps:','map','online','name','join','Offline\x20apps:','filter','status','None','seedDB','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./rpc','./config/logger','app','./config/pm2'];(function(_0x3b2395,_0x1cf2c1){var _0x2e6751=function(_0x4ea274){while(--_0x4ea274){_0x3b2395['push'](_0x3b2395['shift']());}};_0x2e6751(++_0x1cf2c1);}(_0xd405,0xdd));var _0x5d40=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0xd405[_0x6a0266];return _0x309e00;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x5d40('0x0'));var config=require('./config/environment');var logger=require(_0x5d40('0x1'))(_0x5d40('0x2'));var pm2=require(_0x5d40('0x3'));var pm2Config=require(_0x5d40('0x4'));var schedule=require(_0x5d40('0x5'));var chat=require('./config/schedule/chat');var transcribe=require(_0x5d40('0x6'));function main(){return mysqldb['db'][_0x5d40('0x7')]['sync']()[_0x5d40('0x8')](function(){return rpc[_0x5d40('0x9')]();})[_0x5d40('0x8')](function(_0x17a81a){logger[_0x5d40('0xa')](_0x17a81a);return chat[_0x5d40('0xb')]();})['then'](function(){return schedule['start']();})[_0x5d40('0x8')](function(){return transcribe['start']();})[_0x5d40('0x8')](function(_0xc5464d){logger[_0x5d40('0xa')](_0xc5464d);return pm2[_0x5d40('0xb')](pm2Config);})['then'](function(_0xec808a){logger['info'](_0x5d40('0xc'),_[_0x5d40('0xd')](_['filter'](_0xec808a,{'status':_0x5d40('0xe')}),_0x5d40('0xf'))[_0x5d40('0x10')]());logger[_0x5d40('0xa')](_0x5d40('0x11'),_[_0x5d40('0xd')](_[_0x5d40('0x12')](_0xec808a,function(_0x4e78bd){return _0x4e78bd[_0x5d40('0x13')]!==_0x5d40('0xe');}),'name')[_0x5d40('0x10')]()||_0x5d40('0x14'));config[_0x5d40('0x15')]&&require('./config/seedDB')['default']();require(_0x5d40('0x16'))['default']();})['catch'](function(_0x3a5b1d){logger['error'](_0x5d40('0x17'),_0x3a5b1d);process[_0x5d40('0x18')](0x1);});}main(); \ No newline at end of file +var _0x78b7=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','listen','then','start','info','map','filter','online','name','join','seedDB','./config/seedDB','default','./config/license','catch','error'];(function(_0x152eec,_0x46756d){var _0x2b8f66=function(_0x22965e){while(--_0x22965e){_0x152eec['push'](_0x152eec['shift']());}};_0x2b8f66(++_0x46756d);}(_0x78b7,0xec));var _0x778b=function(_0x3f20a5,_0x5bbeda){_0x3f20a5=_0x3f20a5-0x0;var _0x168ec6=_0x78b7[_0x3f20a5];return _0x168ec6;};'use strict';var _=require(_0x778b('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0x778b('0x1'));var logger=require(_0x778b('0x2'))(_0x778b('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0x778b('0x4'));var schedule=require('./config/schedule');var chat=require(_0x778b('0x5'));var transcribe=require(_0x778b('0x6'));function main(){return mysqldb['db'][_0x778b('0x7')][_0x778b('0x8')]()['then'](function(){return rpc[_0x778b('0x9')]();})[_0x778b('0xa')](function(_0xc911ba){logger['info'](_0xc911ba);return chat['start']();})[_0x778b('0xa')](function(){return schedule['start']();})[_0x778b('0xa')](function(){return transcribe[_0x778b('0xb')]();})[_0x778b('0xa')](function(_0x20ff35){logger[_0x778b('0xc')](_0x20ff35);return pm2[_0x778b('0xb')](pm2Config);})[_0x778b('0xa')](function(_0x4c2fd3){logger[_0x778b('0xc')]('Online\x20apps:',_[_0x778b('0xd')](_[_0x778b('0xe')](_0x4c2fd3,{'status':_0x778b('0xf')}),_0x778b('0x10'))[_0x778b('0x11')]());logger[_0x778b('0xc')]('Offline\x20apps:',_[_0x778b('0xd')](_[_0x778b('0xe')](_0x4c2fd3,function(_0xcd998b){return _0xcd998b['status']!==_0x778b('0xf');}),'name')[_0x778b('0x11')]()||'None');config[_0x778b('0x12')]&&require(_0x778b('0x13'))[_0x778b('0x14')]();require(_0x778b('0x15'))['default']();})[_0x778b('0x16')](function(_0x7ea7a2){logger[_0x778b('0x17')](_0x778b('0x18'),_0x7ea7a2);process[_0x778b('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 297b27e..7964028 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 _0xca6d=['randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','name','internal','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','find','then','authenticate','pass','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','secret','payload','options','promisify'];(function(_0xb4d4f7,_0x57458c){var _0x58a362=function(_0x43e478){while(--_0x43e478){_0xb4d4f7['push'](_0xb4d4f7['shift']());}};_0x58a362(++_0x57458c);}(_0xca6d,0x67));var _0xdca6=function(_0x4c5613,_0x2a18f2){_0x4c5613=_0x4c5613-0x0;var _0x2689da=_0xca6d[_0x4c5613];return _0x2689da;};'use strict';var db=require(_0xdca6('0x0'))['db'];var config=require(_0xdca6('0x1'));var hardwareConf=require(_0xdca6('0x2'));var _=require('lodash');var jwt=require(_0xdca6('0x3'));var expressJwt=require(_0xdca6('0x4'));var compose=require(_0xdca6('0x5'));var basicAuth=require(_0xdca6('0x6'));var crypto=require(_0xdca6('0x7'));var BPromise=require(_0xdca6('0x8'));var validateJwt=expressJwt({'secret':config[_0xdca6('0x9')][_0xdca6('0xa')]});var userAttributes=['id',_0xdca6('0xb'),'fullname',_0xdca6('0xc'),_0xdca6('0xd'),'email',_0xdca6('0xe'),_0xdca6('0xf'),_0xdca6('0x10'),_0xdca6('0x11'),'chatPause',_0xdca6('0x12'),_0xdca6('0x13'),_0xdca6('0x14'),_0xdca6('0x15'),_0xdca6('0x16'),_0xdca6('0x17'),_0xdca6('0x18'),_0xdca6('0x19'),_0xdca6('0x1a'),_0xdca6('0x1b'),_0xdca6('0x1c'),'alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xdca6('0x1d'),_0xdca6('0x1e'),_0xdca6('0x1f'),_0xdca6('0x20'),_0xdca6('0x21'),'phoneBarPrefixRequired',_0xdca6('0x22'),_0xdca6('0x23'),'hotdesk',_0xdca6('0x24'),'userProfileId'];exports[_0xdca6('0x25')]=function(){return this['isAuthenticated'](!![])[_0xdca6('0x26')](function(_0x475b27,_0x34660d,_0x540744){if(_0x475b27[_0xdca6('0x27')]){_0x540744();}else{return db[_0xdca6('0x28')][_0xdca6('0x29')]({'where':{'id':_0x475b27[_0xdca6('0x2a')]['id']},'attributes':['id',_0xdca6('0x2b'),_0xdca6('0x2c')],'raw':!![]})['then'](function(_0x3a558e){if(_0x3a558e&&_0x3a558e[_0xdca6('0x2b')]){return _0x34660d[_0xdca6('0x2d')](_0x3a558e[_0xdca6('0x2c')]===_0xdca6('0x2e')?0x195:0x193)[_0xdca6('0x2f')]({'message':_0x3a558e[_0xdca6('0x2c')]===_0xdca6('0x2e')?_0xdca6('0x30'):_0xdca6('0x31')});}else{_0x540744();}})[_0xdca6('0x32')](function(_0x2cda37){_0x540744(_0x2cda37);});}});};exports[_0xdca6('0x33')]=function isAuthenticated(_0x37974c){return compose()['use'](function(_0x3932ba,_0x58a8dc,_0x26ce2f){if(_0x3932ba[_0xdca6('0x34')][_0xdca6('0x35')]){if(_[_0xdca6('0x36')](_0x3932ba['headers'][_0xdca6('0x35')],_0xdca6('0x37'))){var _0x4b8a29=basicAuth(_0x3932ba);db[_0xdca6('0x38')][_0xdca6('0x39')]({'where':{'name':_0x4b8a29[_0xdca6('0xc')]}})[_0xdca6('0x3a')](function(_0x4ddd48){if(!_0x4ddd48||!_0x4ddd48[_0xdca6('0x3b')](_0x4b8a29[_0xdca6('0x3c')])){return _0x58a8dc[_0xdca6('0x2d')](0x191)[_0xdca6('0x2f')]({'message':'Wrong\x20credentials.'});}_0x3932ba[_0xdca6('0x27')]={'id':_0x4ddd48['id']};_0x26ce2f();})[_0xdca6('0x32')](function(_0x121fc9){_0x26ce2f(_0x121fc9);});}else if(_[_0xdca6('0x36')](_0x3932ba[_0xdca6('0x34')][_0xdca6('0x35')],_0xdca6('0x3d'))){validateJwt(_0x3932ba,_0x58a8dc,_0x26ce2f);}else{if(_0x37974c){_0x26ce2f();}else{return _0x58a8dc[_0xdca6('0x2d')](0x193)[_0xdca6('0x2f')]({'message':_0xdca6('0x3e')});}}}else if(_0x3932ba[_0xdca6('0x3f')][_0xdca6('0x40')]){try{var _0x4000d9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdca6('0x41')]()};verifyJwt(_0x3932ba[_0xdca6('0x3f')]['apikey'],_0x4000d9)[_0xdca6('0x3a')](function(_0x36cee8){return db[_0xdca6('0x38')][_0xdca6('0x39')]({'where':{'id':_0x36cee8[_0xdca6('0x42')]}})[_0xdca6('0x3a')](function(_0x522776){if(!_0x522776||!_[_0xdca6('0x43')](_0x522776[_0xdca6('0x44')],_0x36cee8[_0xdca6('0x45')])){return _0x58a8dc[_0xdca6('0x2d')](0x191)[_0xdca6('0x2f')]({'message':_0xdca6('0x46')});}_0x3932ba[_0xdca6('0x27')]={'id':_0x522776['id']};_0x26ce2f();});})['catch'](function(){return _0x58a8dc[_0xdca6('0x2d')](0x191)[_0xdca6('0x2f')]({'message':_0xdca6('0x47')});});}catch(_0x1f25d2){_0x26ce2f(_0x1f25d2);}}else if(_0x37974c){_0x26ce2f();}else{return _0x58a8dc[_0xdca6('0x2d')](0x193)['json']({'message':_0xdca6('0x3e')});}})[_0xdca6('0x26')](function(_0x2c8269,_0x1060ec,_0x5ab20d){if(_0x2c8269[_0xdca6('0x27')]){db[_0xdca6('0x38')]['find']({'where':{'id':_0x2c8269[_0xdca6('0x27')]['id']},'attributes':userAttributes})['then'](function(_0x23eaf1){if(!_0x23eaf1){return _0x1060ec[_0xdca6('0x2d')](0x194)['json']({'message':_0xdca6('0x48')});}_0x2c8269[_0xdca6('0x27')]=_0x23eaf1;_0x5ab20d();})[_0xdca6('0x32')](function(_0x4cfb6e){_0x5ab20d(_0x4cfb6e);});}else if(_0x37974c){_0x5ab20d();}else{return _0x1060ec[_0xdca6('0x2d')](0x194)[_0xdca6('0x2f')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xdca6('0x49')]=function canUpdate(){return compose()[_0xdca6('0x26')](function(_0x463b0c,_0x4ead17,_0x141e5c){return require('../../config/license/util')[_0xdca6('0x4a')]()[_0xdca6('0x3a')](function(_0x38b475){if(_0x38b475[_0xdca6('0x4b')]){_0x141e5c();}else{return _0x4ead17[_0xdca6('0x2d')](0x193)[_0xdca6('0x2f')]({'message':_0xdca6('0x4c')});}})[_0xdca6('0x32')](function(_0x4fa355){_0x141e5c(_0x4fa355);});});};exports[_0xdca6('0x4d')]=function(_0x50a00f,_0x4d5dc3,_0x77e955){_0x50a00f[_0xdca6('0x4d')]=!![];return _0x77e955();};exports[_0xdca6('0x4e')]=function signToken(_0x34b0e5){return signJwt(_0x34b0e5);};exports[_0xdca6('0x4f')]=function(_0x56bd0f,_0x4d084e){if(!_0x56bd0f[_0xdca6('0x27')]){return _0x4d084e['status'](0x194)[_0xdca6('0x2f')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x941a01={'payload':{'id':_0x56bd0f[_0xdca6('0x27')]['id'],'role':_0x56bd0f[_0xdca6('0x27')][_0xdca6('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x941a01)[_0xdca6('0x3a')](function(_0x283de6){_0x4d084e[_0xdca6('0x50')]('motion.token',_0x283de6);_0x4d084e['redirect']('/dashboards/general');})[_0xdca6('0x32')](function(_0x371ceb){return _0x4d084e[_0xdca6('0x2d')](0x1f4)[_0xdca6('0x51')](_0x371ceb);});};exports[_0xdca6('0x52')]=function(_0x279361){if(_[_0xdca6('0x53')](_0x279361[_0xdca6('0x44')])||_[_0xdca6('0x53')](_0x279361[_0xdca6('0x54')])){return null;}else{return createJwt(_0x279361);}};exports['generateApiKey']=function(_0x118f01){_0x118f01[_0xdca6('0x44')]=generateNonce();_0x118f01[_0xdca6('0x54')]=generateIssuedAt();return createJwt(_0x118f01);};exports[_0xdca6('0x55')]=function(_0x28e3b0,_0x4d2efd){var _0x19b7fd=_0x28e3b0[_0xdca6('0x3f')][_0xdca6('0x40')];if(_0x19b7fd){var _0xc1653b={'nonce':_0x4d2efd[_0xdca6('0x44')],'iat':_0x4d2efd[_0xdca6('0x54')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdca6('0x41')]()};return verifyJwt(_0x19b7fd,_0xc1653b)[_0xdca6('0x3a')](function(){return generateApiKey(_0x4d2efd);});}else{throw{'message':_0xdca6('0x56')};}};function signJwt(_0x7e487c){var _0xde0822=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x5c7891=_0x7e487c[_0xdca6('0x57')]||config[_0xdca6('0x9')]['session'];return new BPromise(function(_0xd13bc2,_0x432dee){_0xde0822(_0x7e487c[_0xdca6('0x58')],_0x5c7891,_0x7e487c[_0xdca6('0x59')])['then'](function(_0x2eb795){_0xd13bc2(_0x2eb795);})[_0xdca6('0x32')](function(_0x195ec0){_0x432dee(_0x195ec0);});});}function verifyJwt(_0x6720a2,_0x8b857a,_0x18ab04){var _0x5b3c47=BPromise[_0xdca6('0x5a')](jwt['verify'],{'context':jwt});var _0xd8b7a8=_0x18ab04||config[_0xdca6('0x9')][_0xdca6('0xa')];return new BPromise(function(_0xea34a4,_0xccf95){_0x5b3c47(_0x6720a2,_0xd8b7a8,_0x8b857a)[_0xdca6('0x3a')](function(_0x588156){_0xea34a4(_0x588156);})['catch'](function(_0x4d5453){_0xccf95(_0x4d5453);});});}function generateNonce(){return crypto[_0xdca6('0x5b')](0x10)[_0xdca6('0x5c')](_0xdca6('0x5d'));}function generateIssuedAt(){return Math[_0xdca6('0x5e')](Date[_0xdca6('0x5f')]()/0x3e8)[_0xdca6('0x5c')]();}function createJwt(_0x3f613f){var _0x5d7db0={'payload':{'iat':_0x3f613f[_0xdca6('0x54')],'nonce':_0x3f613f[_0xdca6('0x44')]},'options':{'algorithm':_0xdca6('0x60'),'subject':_0x3f613f['id'][_0xdca6('0x5c')](),'issuer':hardwareConf[_0xdca6('0x41')](),'audience':hardwareConf[_0xdca6('0x41')]()}};return signJwt(_0x5d7db0)[_0xdca6('0x3a')](function(_0x5b44a6){return{'iat':_0x3f613f[_0xdca6('0x54')],'nonce':_0x3f613f[_0xdca6('0x44')],'token':_0x5b44a6};});} \ No newline at end of file +var _0xf6ee=['isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','verify','randomBytes','toString','hex','floor','now','HS512','../../config/license/hardware','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','secrets','session','role','fullname','name','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface'];(function(_0x2ca63a,_0x2d4b8f){var _0x18da3c=function(_0xd309f0){while(--_0xd309f0){_0x2ca63a['push'](_0x2ca63a['shift']());}};_0x18da3c(++_0x2d4b8f);}(_0xf6ee,0xa3));var _0xef6e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf6ee[_0x321bb2];return _0x9c12ed;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0xef6e('0x0'));var _=require('lodash');var jwt=require(_0xef6e('0x1'));var expressJwt=require(_0xef6e('0x2'));var compose=require(_0xef6e('0x3'));var basicAuth=require(_0xef6e('0x4'));var crypto=require(_0xef6e('0x5'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0xef6e('0x6')][_0xef6e('0x7')]});var userAttributes=['id',_0xef6e('0x8'),_0xef6e('0x9'),_0xef6e('0xa'),'internal','email','userpic','permissions',_0xef6e('0xb'),_0xef6e('0xc'),'chatPause','mailPause',_0xef6e('0xd'),_0xef6e('0xe'),_0xef6e('0xf'),_0xef6e('0x10'),_0xef6e('0x11'),_0xef6e('0x12'),_0xef6e('0x13'),'crudPermissions',_0xef6e('0x14'),_0xef6e('0x15'),_0xef6e('0x16'),'phoneBarAutoAnswer',_0xef6e('0x17'),_0xef6e('0x18'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xef6e('0x19'),_0xef6e('0x1a'),_0xef6e('0x1b'),_0xef6e('0x1c'),'phoneBarRemoteControlPort',_0xef6e('0x1d'),_0xef6e('0x1e'),'userProfileId'];exports[_0xef6e('0x1f')]=function(){return this[_0xef6e('0x20')](!![])['use'](function(_0x155b4e,_0x3ee36b,_0x1ed87f){if(_0x155b4e[_0xef6e('0x21')]){_0x1ed87f();}else{return db[_0xef6e('0x22')][_0xef6e('0x23')]({'where':{'id':_0x155b4e[_0xef6e('0x24')]['id']},'attributes':['id',_0xef6e('0x25'),_0xef6e('0x26')],'raw':!![]})[_0xef6e('0x27')](function(_0x28bdb7){if(_0x28bdb7&&_0x28bdb7[_0xef6e('0x25')]){return _0x3ee36b['status'](_0x28bdb7[_0xef6e('0x26')]===_0xef6e('0x28')?0x195:0x193)[_0xef6e('0x29')]({'message':_0x28bdb7['disposition']===_0xef6e('0x28')?_0xef6e('0x2a'):_0xef6e('0x2b')});}else{_0x1ed87f();}})[_0xef6e('0x2c')](function(_0xcaed6e){_0x1ed87f(_0xcaed6e);});}});};exports[_0xef6e('0x20')]=function isAuthenticated(_0x2d0bdd){return compose()['use'](function(_0x2ee865,_0x24ab8c,_0x1e094c){if(_0x2ee865[_0xef6e('0x2d')][_0xef6e('0x2e')]){if(_[_0xef6e('0x2f')](_0x2ee865[_0xef6e('0x2d')][_0xef6e('0x2e')],_0xef6e('0x30'))){var _0x33d031=basicAuth(_0x2ee865);db[_0xef6e('0x31')][_0xef6e('0x32')]({'where':{'name':_0x33d031[_0xef6e('0xa')]}})[_0xef6e('0x27')](function(_0x31e0f9){if(!_0x31e0f9||!_0x31e0f9[_0xef6e('0x33')](_0x33d031[_0xef6e('0x34')])){return _0x24ab8c[_0xef6e('0x35')](0x191)['json']({'message':_0xef6e('0x36')});}_0x2ee865[_0xef6e('0x21')]={'id':_0x31e0f9['id']};_0x1e094c();})[_0xef6e('0x2c')](function(_0x1519ad){_0x1e094c(_0x1519ad);});}else if(_[_0xef6e('0x2f')](_0x2ee865[_0xef6e('0x2d')][_0xef6e('0x2e')],'Bearer')){validateJwt(_0x2ee865,_0x24ab8c,_0x1e094c);}else{if(_0x2d0bdd){_0x1e094c();}else{return _0x24ab8c[_0xef6e('0x35')](0x193)[_0xef6e('0x29')]({'message':_0xef6e('0x37')});}}}else if(_0x2ee865[_0xef6e('0x38')][_0xef6e('0x39')]){try{var _0x49c750={'audience':hardwareConf[_0xef6e('0x3a')](),'issuer':hardwareConf[_0xef6e('0x3a')]()};verifyJwt(_0x2ee865[_0xef6e('0x38')][_0xef6e('0x39')],_0x49c750)['then'](function(_0x3b1391){return db['User'][_0xef6e('0x32')]({'where':{'id':_0x3b1391[_0xef6e('0x3b')]}})['then'](function(_0x2f45ca){if(!_0x2f45ca||!_[_0xef6e('0x3c')](_0x2f45ca[_0xef6e('0x3d')],_0x3b1391[_0xef6e('0x3e')])){return _0x24ab8c[_0xef6e('0x35')](0x191)[_0xef6e('0x29')]({'message':_0xef6e('0x3f')});}_0x2ee865[_0xef6e('0x21')]={'id':_0x2f45ca['id']};_0x1e094c();});})[_0xef6e('0x2c')](function(){return _0x24ab8c[_0xef6e('0x35')](0x191)[_0xef6e('0x29')]({'message':_0xef6e('0x40')});});}catch(_0xe6a14b){_0x1e094c(_0xe6a14b);}}else if(_0x2d0bdd){_0x1e094c();}else{return _0x24ab8c[_0xef6e('0x35')](0x193)[_0xef6e('0x29')]({'message':_0xef6e('0x37')});}})[_0xef6e('0x41')](function(_0x5e24da,_0x3d270e,_0x429c57){if(_0x5e24da[_0xef6e('0x21')]){db[_0xef6e('0x31')][_0xef6e('0x32')]({'where':{'id':_0x5e24da[_0xef6e('0x21')]['id']},'attributes':userAttributes})[_0xef6e('0x27')](function(_0x2389bc){if(!_0x2389bc){return _0x3d270e[_0xef6e('0x35')](0x194)[_0xef6e('0x29')]({'message':_0xef6e('0x42')});}_0x5e24da['user']=_0x2389bc;_0x429c57();})[_0xef6e('0x2c')](function(_0x5167b8){_0x429c57(_0x5167b8);});}else if(_0x2d0bdd){_0x429c57();}else{return _0x3d270e[_0xef6e('0x35')](0x194)['json']({'message':_0xef6e('0x43')});}});};exports[_0xef6e('0x44')]=function canUpdate(){return compose()[_0xef6e('0x41')](function(_0x477019,_0x1fe440,_0x8600e0){return require(_0xef6e('0x45'))[_0xef6e('0x46')]()[_0xef6e('0x27')](function(_0x5511be){if(_0x5511be[_0xef6e('0x47')]){_0x8600e0();}else{return _0x1fe440[_0xef6e('0x35')](0x193)['json']({'message':_0xef6e('0x48')});}})['catch'](function(_0x3e4342){_0x8600e0(_0x3e4342);});});};exports[_0xef6e('0x49')]=function(_0x57d340,_0xb6dfbf,_0x9a653d){_0x57d340[_0xef6e('0x49')]=!![];return _0x9a653d();};exports[_0xef6e('0x4a')]=function signToken(_0x5d4018){return signJwt(_0x5d4018);};exports[_0xef6e('0x4b')]=function(_0x15f35d,_0x4c8631){if(!_0x15f35d['user']){return _0x4c8631[_0xef6e('0x35')](0x194)[_0xef6e('0x29')]({'message':_0xef6e('0x4c')});}var _0x1d4952={'payload':{'id':_0x15f35d['user']['id'],'role':_0x15f35d[_0xef6e('0x21')][_0xef6e('0x8')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1d4952)[_0xef6e('0x27')](function(_0x4c899a){_0x4c8631[_0xef6e('0x4d')]('motion.token',_0x4c899a);_0x4c8631[_0xef6e('0x4e')](_0xef6e('0x4f'));})['catch'](function(_0xf63ad3){return _0x4c8631[_0xef6e('0x35')](0x1f4)[_0xef6e('0x50')](_0xf63ad3);});};exports[_0xef6e('0x51')]=function(_0x231393){if(_['isNil'](_0x231393[_0xef6e('0x3d')])||_[_0xef6e('0x52')](_0x231393['apiKeyIat'])){return null;}else{return createJwt(_0x231393);}};exports[_0xef6e('0x53')]=function(_0x41996f){_0x41996f['apiKeyNonce']=generateNonce();_0x41996f[_0xef6e('0x54')]=generateIssuedAt();return createJwt(_0x41996f);};exports[_0xef6e('0x55')]=function(_0x189c9f,_0x36efb2){var _0xb21e9f=_0x189c9f[_0xef6e('0x38')][_0xef6e('0x39')];if(_0xb21e9f){var _0x56fc39={'nonce':_0x36efb2[_0xef6e('0x3d')],'iat':_0x36efb2[_0xef6e('0x54')],'audience':hardwareConf[_0xef6e('0x3a')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xb21e9f,_0x56fc39)[_0xef6e('0x27')](function(){return generateApiKey(_0x36efb2);});}else{throw{'message':_0xef6e('0x56')};}};function signJwt(_0x20b47a){var _0x5404fc=BPromise[_0xef6e('0x57')](jwt[_0xef6e('0x58')],{'context':jwt});var _0x444e2c=_0x20b47a[_0xef6e('0x59')]||config[_0xef6e('0x6')][_0xef6e('0x7')];return new BPromise(function(_0x1edb83,_0x4669f8){_0x5404fc(_0x20b47a['payload'],_0x444e2c,_0x20b47a['options'])['then'](function(_0x3a2625){_0x1edb83(_0x3a2625);})['catch'](function(_0x22b1ff){_0x4669f8(_0x22b1ff);});});}function verifyJwt(_0x22c7a6,_0x4d676e,_0x33b65d){var _0x11be24=BPromise[_0xef6e('0x57')](jwt[_0xef6e('0x5a')],{'context':jwt});var _0x3e451a=_0x33b65d||config[_0xef6e('0x6')]['session'];return new BPromise(function(_0x48cdcf,_0x5052d6){_0x11be24(_0x22c7a6,_0x3e451a,_0x4d676e)[_0xef6e('0x27')](function(_0x584007){_0x48cdcf(_0x584007);})['catch'](function(_0x29ea79){_0x5052d6(_0x29ea79);});});}function generateNonce(){return crypto[_0xef6e('0x5b')](0x10)[_0xef6e('0x5c')](_0xef6e('0x5d'));}function generateIssuedAt(){return Math[_0xef6e('0x5e')](Date[_0xef6e('0x5f')]()/0x3e8)[_0xef6e('0x5c')]();}function createJwt(_0x1b60ea){var _0x5608e5={'payload':{'iat':_0x1b60ea[_0xef6e('0x54')],'nonce':_0x1b60ea[_0xef6e('0x3d')]},'options':{'algorithm':_0xef6e('0x60'),'subject':_0x1b60ea['id'][_0xef6e('0x5c')](),'issuer':hardwareConf[_0xef6e('0x3a')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5608e5)[_0xef6e('0x27')](function(_0x3687ab){return{'iat':_0x1b60ea[_0xef6e('0x54')],'nonce':_0x1b60ea[_0xef6e('0x3d')],'token':_0x3687ab};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 6dffff6..7c99df6 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 _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x2d120a,_0x5e4d33){var _0x205747=function(_0x3530de){while(--_0x3530de){_0x2d120a['push'](_0x2d120a['shift']());}};_0x205747(++_0x5e4d33);}(_0xe706,0xa3));var _0x6e70=function(_0x1ccb95,_0x1b3be8){_0x1ccb95=_0x1ccb95-0x0;var _0x1a9725=_0xe706[_0x1ccb95];return _0x1a9725;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file +var _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x177fca,_0x5e4e55){var _0x583ea8=function(_0x3ac89a){while(--_0x3ac89a){_0x177fca['push'](_0x177fca['shift']());}};_0x583ea8(++_0x5e4e55);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 92feb1f..6d45444 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 _0x9a19=['util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x340fc7,_0x12a901){var _0x586c93=function(_0xc3a679){while(--_0xc3a679){_0x340fc7['push'](_0x340fc7['shift']());}};_0x586c93(++_0x12a901);}(_0x9a19,0x114));var _0x99a1=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x9a19[_0xfc0976];return _0x23579f;};'use strict';var util=require(_0x99a1('0x0'));var path=require(_0x99a1('0x1'));var _=require(_0x99a1('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x99a1('0x3'));var zipdir=require(_0x99a1('0x4'));var rimraf=require(_0x99a1('0x5'));var db=require(_0x99a1('0x6'))['db'];var dbH=require(_0x99a1('0x6'))[_0x99a1('0x7')];var logger=require(_0x99a1('0x8'))(_0x99a1('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x99a1('0xa')][0x2]);var QUERY=process[_0x99a1('0xa')][0x3];var PATH=process[_0x99a1('0xa')][0x4];function analyticExtractedReport(_0x523b9e,_0x4d2a5c){var _0x5aa6c2={'status':_0x523b9e};var _0x56f50={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d2a5c){_0x5aa6c2[_0x99a1('0xb')]=_0x4d2a5c;}return db['AnalyticExtractedReport']['update'](_0x5aa6c2,_0x56f50);}function main(){var _0x4696f6=0x1388;var _0xd7b568;logger[_0x99a1('0xc')](util[_0x99a1('0xd')](_0x99a1('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x99a1('0xf')][_0x99a1('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x99a1('0x11'),_0x99a1('0x12')]})[_0x99a1('0x13')](function(_0x1bc7aa){if(_0x1bc7aa){_0xd7b568=_0x1bc7aa;_0x4696f6=_0xd7b568[_0x99a1('0x12')]||0x1388;}})[_0x99a1('0x13')](function(){return dbH[_0x99a1('0x14')][_0x99a1('0x15')](util[_0x99a1('0xd')](_0x99a1('0x16'),QUERY),{'type':dbH[_0x99a1('0x14')][_0x99a1('0x17')][_0x99a1('0x18')]});})['then'](function(_0x2d81ed){if(!_0x2d81ed[0x0][_0x99a1('0x19')]){return analyticExtractedReport(_0x99a1('0x1a'));}var _0x3d40cc=[];var _0x384f05=0x0;var _0x33e2c1=!![];if(_0x2d81ed&&_0x2d81ed[_0x99a1('0x1b')]){var _0x4e645b=_0x2d81ed[0x0]['num']%(_0x384f05+_0x4696f6);if(_0xd7b568[_0x99a1('0x11')]){for(;_0x33e2c1;_0x384f05+=_0x4696f6,_0x4e645b=_0x2d81ed[0x0][_0x99a1('0x19')]%(_0x384f05+_0x4696f6)){if(_0x4e645b==0x0||_0x4e645b==_0x2d81ed[0x0][_0x99a1('0x19')]){_0x33e2c1=![];}_0x3d40cc[_0x99a1('0x1c')](dbH[_0x99a1('0x14')][_0x99a1('0x15')](util[_0x99a1('0xd')](_0x99a1('0x1d'),QUERY,_0x4696f6,_0x384f05),{'type':dbH[_0x99a1('0x14')][_0x99a1('0x17')][_0x99a1('0x18')]}));}}else{_0x3d40cc['push'](dbH[_0x99a1('0x14')][_0x99a1('0x15')](QUERY,{'type':dbH['sequelize'][_0x99a1('0x17')]['SELECT']}));}}var _0x458ed3=path[_0x99a1('0x1e')](PATH);var _0x2d6f20=path[_0x99a1('0x1f')](PATH,'.csv');var _0x3eab51=_0xd7b568[_0x99a1('0x11')]&&_0x3d40cc['length']>0x1;var _0x44df2d=[];if(!fs['existsSync'](path[_0x99a1('0x20')](_0x458ed3,_0x2d6f20))&&_0x3eab51){fs[_0x99a1('0x21')](path[_0x99a1('0x20')](_0x458ed3,_0x2d6f20));}return BPromise[_0x99a1('0x22')](_0x3d40cc,function(_0x3c813){_0x44df2d[_0x99a1('0x1c')](_0x3c813);})['then'](function(){for(var _0x114b38=0x0;_0x114b38<_0x44df2d['length'];_0x114b38+=0x1){var _0x5dc733;var _0xafea84=_0x44df2d[_0x114b38];if(_0x3eab51){_0x5dc733=path[_0x99a1('0x20')](_0x458ed3,_0x2d6f20,util[_0x99a1('0xd')](_0x99a1('0x23'),_0x2d6f20,_0x114b38,_0x99a1('0x24')));}else{_0x5dc733=path[_0x99a1('0x20')](_0x458ed3,util[_0x99a1('0xd')]('%s.%s',_0x2d6f20,_0x99a1('0x24')));}fs['writeFileSync'](_0x5dc733,csv(_0xafea84));}})[_0x99a1('0x13')](function(){if(_0x3eab51){zipdir(path[_0x99a1('0x20')](_0x458ed3,_0x2d6f20),{'saveTo':path[_0x99a1('0x20')](_0x458ed3,util['format'](_0x99a1('0x25'),_0x2d6f20,_0x99a1('0x26')))},function(_0x5718b9,_0x37514e){});rimraf(path[_0x99a1('0x20')](_0x458ed3,_0x2d6f20),function(){});}})[_0x99a1('0x13')](function(){logger[_0x99a1('0xc')](util[_0x99a1('0xd')](_0x99a1('0x27'),EXTRACTED_REPORT_ID,_0x99a1('0x28')));return analyticExtractedReport(_0x99a1('0x29'),_0x3eab51?util['format']('%s.%s',_0x2d6f20,_0x3eab51?_0x99a1('0x26'):'csv'):null);});})[_0x99a1('0x2a')](function(_0x400581){logger['info'](util[_0x99a1('0xd')](_0x99a1('0x2b'),EXTRACTED_REPORT_ID,_0x99a1('0x28')),util[_0x99a1('0x2c')](_0x400581,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x99a1('0x2d'));});}main(); \ No newline at end of file +var _0x4bc3=['length','existsSync','join','mkdirSync','each','csv','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','push','sequelize','QueryTypes','dirname','basename'];(function(_0x425f68,_0x3030c3){var _0x33769d=function(_0x40c543){while(--_0x40c543){_0x425f68['push'](_0x425f68['shift']());}};_0x33769d(++_0x3030c3);}(_0x4bc3,0x16e));var _0x34bc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4bc3[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x34bc('0x0'));var path=require(_0x34bc('0x1'));var _=require('lodash');var csv=require(_0x34bc('0x2'));var fs=require('fs');var BPromise=require(_0x34bc('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x34bc('0x4'));var db=require(_0x34bc('0x5'))['db'];var dbH=require(_0x34bc('0x5'))[_0x34bc('0x6')];var logger=require(_0x34bc('0x7'))(_0x34bc('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x34bc('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x34bc('0x9')][0x4];function analyticExtractedReport(_0x50320d,_0x502087){var _0x18a01c={'status':_0x50320d};var _0x474108={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x502087){_0x18a01c[_0x34bc('0xa')]=_0x502087;}return db[_0x34bc('0xb')][_0x34bc('0xc')](_0x18a01c,_0x474108);}function main(){var _0x41b2ff=0x1388;var _0x5de8b5;logger['info'](util[_0x34bc('0xd')](_0x34bc('0xe'),EXTRACTED_REPORT_ID,_0x34bc('0xf')));return db['Setting'][_0x34bc('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x34bc('0x11')]})[_0x34bc('0x12')](function(_0x164fb2){if(_0x164fb2){_0x5de8b5=_0x164fb2;_0x41b2ff=_0x5de8b5['splitSizeCsv']||0x1388;}})[_0x34bc('0x12')](function(){return dbH['sequelize'][_0x34bc('0x13')](util[_0x34bc('0xd')](_0x34bc('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x34bc('0x15')]});})['then'](function(_0x3e93bf){if(!_0x3e93bf[0x0][_0x34bc('0x16')]){return analyticExtractedReport(_0x34bc('0x17'));}var _0x25da29=[];var _0x2db2dd=0x0;var _0x69542f=!![];if(_0x3e93bf&&_0x3e93bf['length']){var _0x4fa0ab=_0x3e93bf[0x0]['num']%(_0x2db2dd+_0x41b2ff);if(_0x5de8b5[_0x34bc('0x18')]){for(;_0x69542f;_0x2db2dd+=_0x41b2ff,_0x4fa0ab=_0x3e93bf[0x0][_0x34bc('0x16')]%(_0x2db2dd+_0x41b2ff)){if(_0x4fa0ab==0x0||_0x4fa0ab==_0x3e93bf[0x0][_0x34bc('0x16')]){_0x69542f=![];}_0x25da29[_0x34bc('0x19')](dbH['sequelize'][_0x34bc('0x13')](util[_0x34bc('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41b2ff,_0x2db2dd),{'type':dbH[_0x34bc('0x1a')][_0x34bc('0x1b')]['SELECT']}));}}else{_0x25da29[_0x34bc('0x19')](dbH[_0x34bc('0x1a')][_0x34bc('0x13')](QUERY,{'type':dbH[_0x34bc('0x1a')][_0x34bc('0x1b')][_0x34bc('0x15')]}));}}var _0x48087e=path[_0x34bc('0x1c')](PATH);var _0x3c9939=path[_0x34bc('0x1d')](PATH,'.csv');var _0x4c4b9a=_0x5de8b5[_0x34bc('0x18')]&&_0x25da29[_0x34bc('0x1e')]>0x1;var _0x4263de=[];if(!fs[_0x34bc('0x1f')](path[_0x34bc('0x20')](_0x48087e,_0x3c9939))&&_0x4c4b9a){fs[_0x34bc('0x21')](path[_0x34bc('0x20')](_0x48087e,_0x3c9939));}return BPromise[_0x34bc('0x22')](_0x25da29,function(_0x19472e){_0x4263de[_0x34bc('0x19')](_0x19472e);})[_0x34bc('0x12')](function(){for(var _0x1edcb0=0x0;_0x1edcb0<_0x4263de['length'];_0x1edcb0+=0x1){var _0x43e527;var _0x48ec13=_0x4263de[_0x1edcb0];if(_0x4c4b9a){_0x43e527=path['join'](_0x48087e,_0x3c9939,util[_0x34bc('0xd')]('%s%d.%s',_0x3c9939,_0x1edcb0,_0x34bc('0x23')));}else{_0x43e527=path[_0x34bc('0x20')](_0x48087e,util[_0x34bc('0xd')]('%s.%s',_0x3c9939,_0x34bc('0x23')));}fs[_0x34bc('0x24')](_0x43e527,csv(_0x48ec13));}})[_0x34bc('0x12')](function(){if(_0x4c4b9a){zipdir(path[_0x34bc('0x20')](_0x48087e,_0x3c9939),{'saveTo':path[_0x34bc('0x20')](_0x48087e,util[_0x34bc('0xd')]('%s.%s',_0x3c9939,_0x34bc('0x25')))},function(_0x1fb7c5,_0x22aacc){});rimraf(path[_0x34bc('0x20')](_0x48087e,_0x3c9939),function(){});}})[_0x34bc('0x12')](function(){logger[_0x34bc('0x26')](util['format'](_0x34bc('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x4c4b9a?util[_0x34bc('0xd')]('%s.%s',_0x3c9939,_0x4c4b9a?_0x34bc('0x25'):_0x34bc('0x23')):null);});})[_0x34bc('0x28')](function(_0x452a51){logger[_0x34bc('0x26')](util[_0x34bc('0xd')](_0x34bc('0x29'),EXTRACTED_REPORT_ID,'CSV'),util[_0x34bc('0x2a')](_0x452a51,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x34bc('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7a78048..ec73a4c 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 _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x4b7c7c,_0x164f1f){var _0x35cb85=function(_0x58ba30){while(--_0x58ba30){_0x4b7c7c['push'](_0x4b7c7c['shift']());}};_0x35cb85(++_0x164f1f);}(_0xb10b,0x12a));var _0xbb10=function(_0x106db6,_0xd6decc){_0x106db6=_0x106db6-0x0;var _0x4dc175=_0xb10b[_0x106db6];return _0x4dc175;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x96d344,_0x1e8299){var _0x47a986=function(_0x578bf2){while(--_0x578bf2){_0x96d344['push'](_0x96d344['shift']());}};_0x47a986(++_0x1e8299);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20aa8f,_0x515541){_0x20aa8f=_0x20aa8f-0x0;var _0x52f482=_0x5f2f[_0x20aa8f];return _0x52f482;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d4d5798..b76a6fd 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 _0x6209=['XLSX','Completed','catch','inspect','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','%s.%s','zip'];(function(_0x10d43e,_0x4e5d08){var _0xbcf9a5=function(_0x44ee2f){while(--_0x44ee2f){_0x10d43e['push'](_0x10d43e['shift']());}};_0xbcf9a5(++_0x4e5d08);}(_0x6209,0x1e8));var _0x9620=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x6209[_0x55f8b4];return _0x2475f9;};'use strict';var util=require(_0x9620('0x0'));var path=require(_0x9620('0x1'));var _=require(_0x9620('0x2'));var fs=require('fs');var json2xls=require(_0x9620('0x3'));var BPromise=require(_0x9620('0x4'));var zipdir=require(_0x9620('0x5'));var rimraf=require(_0x9620('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9620('0x7'))[_0x9620('0x8')];var logger=require(_0x9620('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9620('0xa')][0x2]);var QUERY=process[_0x9620('0xa')][0x3];var PATH=process[_0x9620('0xa')][0x4];function analyticExtractedReport(_0x339bdc,_0x488d59){var _0x4e9082={'status':_0x339bdc};var _0x11af3d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x488d59){_0x4e9082['savename']=_0x488d59;}return db[_0x9620('0xb')][_0x9620('0xc')](_0x4e9082,_0x11af3d);}function main(){var _0x186b36=0x1388;var _0x10e8c3;logger[_0x9620('0xd')](util[_0x9620('0xe')](_0x9620('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x9620('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9620('0x11'),_0x9620('0x12')]})[_0x9620('0x13')](function(_0x321ea1){if(_0x321ea1){_0x10e8c3=_0x321ea1;_0x186b36=_0x10e8c3[_0x9620('0x12')]||0x1388;}})[_0x9620('0x13')](function(){return dbH[_0x9620('0x14')][_0x9620('0x15')](util[_0x9620('0xe')](_0x9620('0x16'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x9620('0x17')]});})[_0x9620('0x13')](function(_0x51f0a7){if(!_0x51f0a7[0x0][_0x9620('0x18')]){return analyticExtractedReport(_0x9620('0x19'));}var _0x34168b=[];var _0x1a75d8=0x0;var _0x4f399c=!![];if(_0x10e8c3[_0x9620('0x11')]){if(_0x51f0a7&&_0x51f0a7[_0x9620('0x1a')]){var _0x5a9b98=_0x51f0a7[0x0][_0x9620('0x18')]%(_0x1a75d8+_0x186b36);for(;_0x4f399c;_0x1a75d8+=_0x186b36,_0x5a9b98=_0x51f0a7[0x0]['num']%(_0x1a75d8+_0x186b36)){if(_0x5a9b98==0x0||_0x5a9b98==_0x51f0a7[0x0][_0x9620('0x18')]){_0x4f399c=![];}_0x34168b[_0x9620('0x1b')](dbH[_0x9620('0x14')][_0x9620('0x15')](util[_0x9620('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x186b36,_0x1a75d8),{'type':dbH[_0x9620('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x34168b['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x9620('0x14')]['QueryTypes'][_0x9620('0x17')]}));}var _0xf7b4df=path[_0x9620('0x1c')](PATH);var _0x2c43fa=path[_0x9620('0x1d')](PATH,_0x9620('0x1e'));var _0x1c7b67=_0x10e8c3['split']&&_0x34168b['length']>0x1;var _0x1d8665=[];if(!fs[_0x9620('0x1f')](path['join'](_0xf7b4df,_0x2c43fa))&&_0x1c7b67){fs[_0x9620('0x20')](path[_0x9620('0x21')](_0xf7b4df,_0x2c43fa));}return BPromise[_0x9620('0x22')](_0x34168b,function(_0x156298){_0x1d8665[_0x9620('0x1b')](_0x156298);})[_0x9620('0x13')](function(){for(var _0x2edc88=0x0;_0x2edc88<_0x1d8665[_0x9620('0x1a')];_0x2edc88+=0x1){var _0x255cac;var _0x30c0cf=_0x1d8665[_0x2edc88];if(_0x1c7b67){_0x255cac=path[_0x9620('0x21')](_0xf7b4df,_0x2c43fa,util['format'](_0x9620('0x23'),_0x2c43fa,_0x2edc88,_0x9620('0x24')));}else{_0x255cac=path[_0x9620('0x21')](_0xf7b4df,util[_0x9620('0xe')]('%s.%s',_0x2c43fa,'xlsx'));}fs[_0x9620('0x25')](_0x255cac,json2xls(_0x30c0cf),'binary');}})[_0x9620('0x13')](function(){if(_0x1c7b67){zipdir(path['join'](_0xf7b4df,_0x2c43fa),{'saveTo':path['join'](_0xf7b4df,util[_0x9620('0xe')](_0x9620('0x26'),_0x2c43fa,_0x9620('0x27')))},function(_0x57977f,_0x19ddaf){});rimraf(path[_0x9620('0x21')](_0xf7b4df,_0x2c43fa),function(){});}})[_0x9620('0x13')](function(){logger['info'](util[_0x9620('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9620('0x28')));return analyticExtractedReport(_0x9620('0x29'),_0x1c7b67?util['format'](_0x9620('0x26'),_0x2c43fa,_0x1c7b67?_0x9620('0x27'):_0x9620('0x24')):null);});})[_0x9620('0x2a')](function(_0x4edf8c){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9620('0x28')),util[_0x9620('0x2b')](_0x4edf8c,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x5309=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5309,0x125));var _0x9530=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0x5309[_0x919445];return _0x511b3e;};'use strict';var util=require('util');var path=require(_0x9530('0x0'));var _=require(_0x9530('0x1'));var fs=require('fs');var json2xls=require(_0x9530('0x2'));var BPromise=require(_0x9530('0x3'));var zipdir=require(_0x9530('0x4'));var rimraf=require(_0x9530('0x5'));var db=require(_0x9530('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x9530('0x7'))(_0x9530('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9530('0x9')][0x3];var PATH=process[_0x9530('0x9')][0x4];function analyticExtractedReport(_0x294cbc,_0x225239){var _0x486b18={'status':_0x294cbc};var _0x30fe42={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x225239){_0x486b18['savename']=_0x225239;}return db[_0x9530('0xa')][_0x9530('0xb')](_0x486b18,_0x30fe42);}function main(){var _0x1c29ed=0x1388;var _0x1dbe6d;logger[_0x9530('0xc')](util['format'](_0x9530('0xd'),EXTRACTED_REPORT_ID,_0x9530('0xe')));return db[_0x9530('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9530('0x10'),'splitSizeXlsx']})[_0x9530('0x11')](function(_0x507dbf){if(_0x507dbf){_0x1dbe6d=_0x507dbf;_0x1c29ed=_0x1dbe6d[_0x9530('0x12')]||0x1388;}})['then'](function(){return dbH[_0x9530('0x13')][_0x9530('0x14')](util[_0x9530('0x15')](_0x9530('0x16'),QUERY),{'type':dbH[_0x9530('0x13')][_0x9530('0x17')][_0x9530('0x18')]});})[_0x9530('0x11')](function(_0x58e785){if(!_0x58e785[0x0][_0x9530('0x19')]){return analyticExtractedReport(_0x9530('0x1a'));}var _0x3d3906=[];var _0x4fa991=0x0;var _0x3933b2=!![];if(_0x1dbe6d[_0x9530('0x10')]){if(_0x58e785&&_0x58e785[_0x9530('0x1b')]){var _0x58abb8=_0x58e785[0x0][_0x9530('0x19')]%(_0x4fa991+_0x1c29ed);for(;_0x3933b2;_0x4fa991+=_0x1c29ed,_0x58abb8=_0x58e785[0x0][_0x9530('0x19')]%(_0x4fa991+_0x1c29ed)){if(_0x58abb8==0x0||_0x58abb8==_0x58e785[0x0][_0x9530('0x19')]){_0x3933b2=![];}_0x3d3906[_0x9530('0x1c')](dbH[_0x9530('0x13')][_0x9530('0x14')](util[_0x9530('0x15')](_0x9530('0x1d'),QUERY,_0x1c29ed,_0x4fa991),{'type':dbH[_0x9530('0x13')][_0x9530('0x17')]['SELECT']}));}}}else{_0x3d3906['push'](dbH['sequelize'][_0x9530('0x14')](QUERY,{'type':dbH[_0x9530('0x13')][_0x9530('0x17')]['SELECT']}));}var _0x317eb7=path[_0x9530('0x1e')](PATH);var _0x93e4c0=path[_0x9530('0x1f')](PATH,_0x9530('0x20'));var _0x4de8d7=_0x1dbe6d[_0x9530('0x10')]&&_0x3d3906[_0x9530('0x1b')]>0x1;var _0x51c4a6=[];if(!fs[_0x9530('0x21')](path['join'](_0x317eb7,_0x93e4c0))&&_0x4de8d7){fs[_0x9530('0x22')](path[_0x9530('0x23')](_0x317eb7,_0x93e4c0));}return BPromise['each'](_0x3d3906,function(_0x2121c0){_0x51c4a6['push'](_0x2121c0);})[_0x9530('0x11')](function(){for(var _0x582930=0x0;_0x582930<_0x51c4a6['length'];_0x582930+=0x1){var _0x592d7b;var _0x323718=_0x51c4a6[_0x582930];if(_0x4de8d7){_0x592d7b=path[_0x9530('0x23')](_0x317eb7,_0x93e4c0,util['format'](_0x9530('0x24'),_0x93e4c0,_0x582930,_0x9530('0x25')));}else{_0x592d7b=path[_0x9530('0x23')](_0x317eb7,util[_0x9530('0x15')]('%s.%s',_0x93e4c0,_0x9530('0x25')));}fs[_0x9530('0x26')](_0x592d7b,json2xls(_0x323718),_0x9530('0x27'));}})[_0x9530('0x11')](function(){if(_0x4de8d7){zipdir(path[_0x9530('0x23')](_0x317eb7,_0x93e4c0),{'saveTo':path[_0x9530('0x23')](_0x317eb7,util['format'](_0x9530('0x28'),_0x93e4c0,_0x9530('0x29')))},function(_0x274bbe,_0x480e7f){});rimraf(path[_0x9530('0x23')](_0x317eb7,_0x93e4c0),function(){});}})['then'](function(){logger[_0x9530('0xc')](util[_0x9530('0x15')](_0x9530('0x2a'),EXTRACTED_REPORT_ID,_0x9530('0xe')));return analyticExtractedReport(_0x9530('0x2b'),_0x4de8d7?util[_0x9530('0x15')]('%s.%s',_0x93e4c0,_0x4de8d7?_0x9530('0x29'):_0x9530('0x25')):null);});})[_0x9530('0x2c')](function(_0x5bddfc){logger['info'](util[_0x9530('0x15')](_0x9530('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x9530('0x2e')](_0x5bddfc,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x9530('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 5c75443..24cb97a 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 _0x3276=['exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','extensions','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','map'];(function(_0x348469,_0x4945da){var _0x319b8b=function(_0x1be3b7){while(--_0x1be3b7){_0x348469['push'](_0x348469['shift']());}};_0x319b8b(++_0x4945da);}(_0x3276,0xc7));var _0x6327=function(_0x3bfc78,_0x34e2d2){_0x3bfc78=_0x3bfc78-0x0;var _0x386779=_0x3276[_0x3bfc78];return _0x386779;};'use strict';var _=require(_0x6327('0x0'));var util=require('util');function rewrite(_0x4c10de,_0x35aa11){var _0x18ab44=this;return _0x4c10de[_0x6327('0x1')][_0x6327('0x2')][_0x6327('0x3')]({'raw':!![]})[_0x6327('0x4')](function(_0x436055){_0x18ab44['intervals']=_0x436055;return _0x4c10de['models'][_0x6327('0x5')][_0x6327('0x3')]({'where':{'IntervalId':_0x35aa11[_0x6327('0x6')]},'raw':!![]});})['then'](function(_0x29ba24){return _0x4c10de[_0x6327('0x1')][_0x6327('0x5')][_0x6327('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x6327('0x7')](_0x29ba24,_0x6327('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x6327('0x4')](function(_0x289415){var _0x572a9f=_[_0x6327('0x9')](_0x289415,{'priority':'1'});var _0x29af6a=_[_0x6327('0x9')](_0x289415,{'isApp':0x1});var _0x524eb2=_[_0x6327('0xa')](_0x29af6a,_0x6327('0x8'));var _0xb6de72=[_0x6327('0xb'),_0x6327('0xc')];var _0x144255=[];var _0x321c3b=[];for(var _0xa5554b in _0x524eb2){if(_0x524eb2[_0x6327('0xd')](_0xa5554b)){_0x18ab44[_0x6327('0xe')]=0x2;_0x18ab44['extensions']=[];_0x18ab44[_0x6327('0xf')]=_['find'](_0x572a9f,{'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')]});_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0]['type'],'app':_0x6327('0x12'),'appdata':util[_0x6327('0x13')](_0x6327('0x14'),_0x524eb2[_0xa5554b][0x0][_0x6327('0x15')]),'context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44[_0x6327('0xe')]++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});if(_0x524eb2[_0xa5554b][0x0][_0x6327('0x15')]===_0x6327('0x18')){if(_0x18ab44[_0x6327('0xf')]){_0x18ab44[_0x6327('0x10')]['push']({'type':_0x524eb2[_0xa5554b][0x0][_0x6327('0x15')],'app':_0x6327('0x12'),'appdata':_0x6327('0x19')+(_0x18ab44[_0x6327('0xf')]['cutdigits']?'${EXTEN:'+_0x18ab44[_0x6327('0xf')][_0x6327('0x1a')]+'}':_0x6327('0x1b')),'context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44[_0x6327('0xe')]++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});}_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0][_0x6327('0x15')],'app':_0x6327('0x12'),'appdata':_0x6327('0x1c')+_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')],'context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44[_0x6327('0xe')]++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0]['VoiceExtensionId']});var _0x51dbe9=_0x18ab44[_0x6327('0xe')]++;_0x18ab44['extensions'][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0]['type'],'app':_0x6327('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x51dbe9+0x2)+_0x6327('0x1e')+(_0x51dbe9+0x1)+')','context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0]['exten'],'priority':_0x51dbe9,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});if(_0x18ab44[_0x6327('0xf')]){_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0][_0x6327('0x15')],'app':_0x6327('0x12'),'appdata':_0x18ab44[_0x6327('0xf')][_0x6327('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x18ab44[_0x6327('0xf')][_0x6327('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44['priority']++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});}_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0]['type'],'app':_0x6327('0x12'),'appdata':_0x6327('0x1f')+_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')],'context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0]['exten'],'priority':_0x18ab44[_0x6327('0xe')]++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0]['VoiceExtensionId']});if(_0x18ab44['extension']&&_0x18ab44[_0x6327('0xf')][_0x6327('0xd')](_0x6327('0x20'))&&_0x18ab44[_0x6327('0xf')]['recordingFormat']!==_0x6327('0x21')){_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0][_0x6327('0x15')],'app':'Set','appdata':_0x6327('0x22'),'context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44['priority']++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0]['type'],'app':'Set','appdata':_0x6327('0x23')+_0x18ab44['extension'][_0x6327('0x20')]||'wav','context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44[_0x6327('0xe')]++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});}}_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0]['type'],'app':_0x6327('0x12'),'appdata':_0x6327('0x24'),'context':_0x524eb2[_0xa5554b][0x0][_0x6327('0x16')],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44['priority']++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0]['VoiceExtensionId']});_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0][_0x6327('0x15')],'app':_0x6327('0x12'),'appdata':_0x6327('0x25'),'context':_0x524eb2[_0xa5554b][0x0]['context'],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44[_0x6327('0xe')]++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});_0x18ab44[_0x6327('0x10')][_0x6327('0x11')]({'type':_0x524eb2[_0xa5554b][0x0]['type'],'app':_0x6327('0x12'),'appdata':_0x6327('0x26'),'context':_0x524eb2[_0xa5554b][0x0]['context'],'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'priority':_0x18ab44[_0x6327('0xe')]++,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});for(var _0x46b813=0x0,_0x482d4e=0x0;_0x46b813<_0x524eb2[_0xa5554b][_0x6327('0x27')];_0x46b813+=0x1,_0x482d4e=0x0){var _0x413a31=_0x524eb2[_0xa5554b][_0x46b813];if(_0x413a31[_0x6327('0x15')]){_0x413a31['type']=_0x413a31[_0x6327('0x15')][_0x6327('0x28')]();}var _0x486090=[];var _0x42695c=[];delete _0x413a31['id'];delete _0x413a31[_0x6327('0x29')];delete _0x413a31[_0x6327('0x2a')];var _0x292456=_0x413a31[_0x6327('0x2b')]!==_0x6327('0x2c')?[_0x413a31[_0x6327('0x2b')]]:_0x413a31[_0x6327('0x6')]?_[_0x6327('0x7')](_[_0x6327('0x9')](_0x18ab44[_0x6327('0x2d')],{'IntervalId':_0x413a31[_0x6327('0x6')]}),_0x6327('0x2b')):[];if(_0x413a31[_0x6327('0xd')](_0x6327('0x2e'))){if(_0x413a31[_0x6327('0x2e')]&&_0x413a31[_0x6327('0x2e')]!=='--'){_0x486090[_0x6327('0x11')]({'type':_0x413a31['type'],'app':_0x6327('0x12'),'appdata':_0x6327('0x2f')+_0x413a31['tag'],'context':_0x413a31['context'],'exten':_0x413a31['exten'],'priority':_0x292456[_0x6327('0x27')]+_0x18ab44[_0x6327('0xe')]+_0x482d4e++,'VoiceExtensionId':_0x413a31['VoiceExtensionId']});}}if(_0x413a31[_0x6327('0x15')]===_0x6327('0x18')&&_0x413a31[_0x6327('0xd')](_0x6327('0x30'))){if(_0x413a31[_0x6327('0x30')]){_0x486090[_0x6327('0x11')]({'type':_0x413a31[_0x6327('0x15')],'app':_0x6327('0x1d'),'appdata':_0x6327('0x31')+_0x413a31['callerID']+')','context':_0x413a31[_0x6327('0x16')],'exten':_0x413a31[_0x6327('0x8')],'priority':_0x292456[_0x6327('0x27')]+_0x18ab44['priority']+_0x482d4e++,'VoiceExtensionId':_0x413a31[_0x6327('0x17')]});}else{_0x486090[_0x6327('0x11')]({'type':_0x413a31[_0x6327('0x15')],'app':_0x6327('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x413a31[_0x6327('0x16')],'exten':_0x413a31[_0x6327('0x8')],'priority':_0x292456[_0x6327('0x27')]+_0x18ab44[_0x6327('0xe')]+_0x482d4e++,'VoiceExtensionId':_0x413a31[_0x6327('0x17')]});}}if(_0x413a31[_0x6327('0xd')](_0x6327('0x32'))){if(_0xb6de72[_0x6327('0x33')](_0x413a31[_0x6327('0x34')][_0x6327('0x28')]())>=0x0&&_0x413a31[_0x6327('0x35')]!==_0x6327('0x36')){if(_0x413a31[_0x6327('0x32')]){_0x486090[_0x6327('0x11')]({'type':_0x413a31['type'],'app':'ExecIf','appdata':_0x6327('0x37'),'context':_0x413a31[_0x6327('0x16')],'exten':_0x413a31[_0x6327('0x8')],'priority':_0x292456[_0x6327('0x27')]+_0x18ab44[_0x6327('0xe')]+_0x482d4e++,'VoiceExtensionId':_0x413a31[_0x6327('0x17')]});_0x486090[_0x6327('0x11')]({'type':_0x413a31[_0x6327('0x15')],'app':_0x6327('0x12'),'appdata':_0x6327('0x38'),'context':_0x413a31[_0x6327('0x16')],'exten':_0x413a31[_0x6327('0x8')],'priority':_0x292456[_0x6327('0x27')]+_0x18ab44[_0x6327('0xe')]+_0x482d4e++,'VoiceExtensionId':_0x413a31['VoiceExtensionId']});}else{_0x486090[_0x6327('0x11')]({'type':_0x413a31[_0x6327('0x15')],'app':_0x6327('0x1d'),'appdata':_0x6327('0x39'),'context':_0x413a31['context'],'exten':_0x413a31[_0x6327('0x8')],'priority':_0x292456[_0x6327('0x27')]+_0x18ab44[_0x6327('0xe')]+_0x482d4e++,'VoiceExtensionId':_0x413a31[_0x6327('0x17')]});_0x486090[_0x6327('0x11')]({'type':_0x413a31['type'],'app':_0x6327('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x413a31[_0x6327('0x16')],'exten':_0x413a31[_0x6327('0x8')],'priority':_0x292456[_0x6327('0x27')]+_0x18ab44[_0x6327('0xe')]+_0x482d4e++,'VoiceExtensionId':_0x413a31[_0x6327('0x17')]});}}}for(var _0x86c306=0x0;_0x86c306<_0x292456['length'];_0x86c306+=0x1){var _0x69d4f9=_0x18ab44[_0x6327('0xe')]+_0x292456['length'];var _0x24f516=_0x86c306===_0x292456[_0x6327('0x27')]-0x1?_0x18ab44[_0x6327('0xe')]+_0x486090[_0x6327('0x27')]+_0x42695c[_0x6327('0x27')]+0x2:_0x18ab44[_0x6327('0xe')]+_0x86c306+0x1;_0x486090[_0x6327('0x3a')](_0x86c306,0x0,{'type':_0x413a31[_0x6327('0x15')],'app':'GotoIfTime','appdata':_0x292456[_0x86c306]+'?'+_0x413a31[_0x6327('0x16')]+_0x6327('0x3b')+_0x69d4f9+':'+_0x413a31[_0x6327('0x16')]+_0x6327('0x3b')+_0x24f516,'exten':_0x413a31[_0x6327('0x8')],'context':_0x413a31[_0x6327('0x16')],'priority':_0x18ab44['priority']+_0x86c306,'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});}_0x413a31['priority']=_0x486090[_0x6327('0x27')]?_[_0x6327('0x3c')](_0x486090)[_0x6327('0xe')]+0x1:_0x18ab44[_0x6327('0xe')];_0x18ab44[_0x6327('0xe')]=(_0x42695c[_0x6327('0x27')]?_[_0x6327('0x3c')](_0x42695c)[_0x6327('0xe')]:_0x413a31[_0x6327('0xe')])+0x1;_0x18ab44[_0x6327('0x10')]=_[_0x6327('0x3d')](_0x18ab44[_0x6327('0x10')],_0x486090,[_0x413a31],_0x42695c);}_0x18ab44[_0x6327('0x10')]['push']({'type':_0x524eb2[_0xa5554b][0x0][_0x6327('0x15')],'app':_0x6327('0x3e'),'exten':_0x524eb2[_0xa5554b][0x0][_0x6327('0x8')],'context':_0x524eb2[_0xa5554b][0x0]['context'],'priority':_0x18ab44[_0x6327('0xe')],'VoiceExtensionId':_0x524eb2[_0xa5554b][0x0][_0x6327('0x17')]});_0x144255['push'](_0x524eb2[_0xa5554b][0x0]['VoiceExtensionId']);_0x321c3b=_['concat'](_0x321c3b,_0x18ab44['extensions']);}}return _0x4c10de[_0x6327('0x3f')](function(_0x129bbc){return _0x4c10de[_0x6327('0x1')][_0x6327('0x5')][_0x6327('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x144255}},'transaction':_0x129bbc})['then'](function(_0x5dea35){return _0x4c10de[_0x6327('0x1')][_0x6327('0x5')]['bulkCreate'](_[_0x6327('0x41')](_0x321c3b,_0x6327('0xe')),{'transaction':_0x129bbc});});});})[_0x6327('0x42')](function(_0x2d426c){console[_0x6327('0x43')](_0x2d426c);});}exports[_0x6327('0x44')]=rewrite; \ No newline at end of file +var _0xfb70=['uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','format','CDR(type)=%s','context','push','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','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','destroy','catch','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xfb70,0x150));var _0x0fb7=function(_0x49a306,_0x519eb6){_0x49a306=_0x49a306-0x0;var _0x507cc4=_0xfb70[_0x49a306];return _0x507cc4;};'use strict';var _=require(_0x0fb7('0x0'));var util=require(_0x0fb7('0x1'));function rewrite(_0x35ccb9,_0x1765e1){var _0xa84647=this;return _0x35ccb9[_0x0fb7('0x2')][_0x0fb7('0x3')][_0x0fb7('0x4')]({'raw':!![]})['then'](function(_0x30629f){_0xa84647[_0x0fb7('0x5')]=_0x30629f;return _0x35ccb9[_0x0fb7('0x2')][_0x0fb7('0x6')][_0x0fb7('0x4')]({'where':{'IntervalId':_0x1765e1[_0x0fb7('0x7')]},'raw':!![]});})[_0x0fb7('0x8')](function(_0x48643b){return _0x35ccb9[_0x0fb7('0x2')][_0x0fb7('0x6')][_0x0fb7('0x4')]({'where':{'exten':{'$in':_[_0x0fb7('0x9')](_[_0x0fb7('0xa')](_0x48643b,_0x0fb7('0xb')))}},'order':[{'raw':_0x0fb7('0xc')}],'raw':!![]});})[_0x0fb7('0x8')](function(_0x297e12){var _0x12c898=_[_0x0fb7('0xd')](_0x297e12,{'priority':'1'});var _0x324d0a=_[_0x0fb7('0xd')](_0x297e12,{'isApp':0x1});var _0x5142b1=_[_0x0fb7('0xe')](_0x324d0a,_0x0fb7('0xb'));var _0x3b5fe2=[_0x0fb7('0xf'),_0x0fb7('0x10')];var _0x293ef9=[];var _0x4bdac2=[];for(var _0x5b5cf7 in _0x5142b1){if(_0x5142b1[_0x0fb7('0x11')](_0x5b5cf7)){_0xa84647[_0x0fb7('0x12')]=0x2;_0xa84647[_0x0fb7('0x13')]=[];_0xa84647[_0x0fb7('0x14')]=_[_0x0fb7('0x15')](_0x12c898,{'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')]});_0xa84647[_0x0fb7('0x13')]['push']({'type':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')],'app':_0x0fb7('0x17'),'appdata':util[_0x0fb7('0x18')](_0x0fb7('0x19'),_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')]),'context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0]['exten'],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0]['VoiceExtensionId']});if(_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')]==='outbound'){if(_0xa84647[_0x0fb7('0x14')]){_0xa84647['extensions'][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')],'app':_0x0fb7('0x17'),'appdata':'CDR(destination)='+(_0xa84647[_0x0fb7('0x14')][_0x0fb7('0x1c')]?_0x0fb7('0x1d')+_0xa84647[_0x0fb7('0x14')]['cutdigits']+'}':_0x0fb7('0x1e')),'context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1f')]});}_0xa84647['extensions'][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')],'app':'Set','appdata':_0x0fb7('0x20')+_0x5142b1[_0x5b5cf7][0x0]['VoiceExtensionId'],'context':_0x5142b1[_0x5b5cf7][0x0]['context'],'exten':_0x5142b1[_0x5b5cf7][0x0]['exten'],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1f')]});var _0x5035a1=_0xa84647[_0x0fb7('0x12')]++;_0xa84647[_0x0fb7('0x13')][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')],'app':_0x0fb7('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5035a1+0x2)+'):Goto('+(_0x5035a1+0x1)+')','context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')],'priority':_0x5035a1,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0]['VoiceExtensionId']});if(_0xa84647[_0x0fb7('0x14')]){_0xa84647[_0x0fb7('0x13')][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')],'app':_0x0fb7('0x17'),'appdata':_0xa84647[_0x0fb7('0x14')][_0x0fb7('0x1c')]?_0x0fb7('0x22')+_0xa84647[_0x0fb7('0x14')][_0x0fb7('0x1c')]+'}':_0x0fb7('0x23'),'context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0]['VoiceExtensionId']});}_0xa84647[_0x0fb7('0x13')]['push']({'type':_0x5142b1[_0x5b5cf7][0x0]['type'],'app':_0x0fb7('0x17'),'appdata':_0x0fb7('0x24')+_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1f')],'context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0]['VoiceExtensionId']});if(_0xa84647[_0x0fb7('0x14')]&&_0xa84647['extension']['hasOwnProperty'](_0x0fb7('0x25'))&&_0xa84647[_0x0fb7('0x14')][_0x0fb7('0x25')]!==_0x0fb7('0x26')){_0xa84647[_0x0fb7('0x13')][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0]['type'],'app':_0x0fb7('0x17'),'appdata':_0x0fb7('0x27'),'context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1f')]});_0xa84647[_0x0fb7('0x13')]['push']({'type':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')],'app':_0x0fb7('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xa84647[_0x0fb7('0x14')][_0x0fb7('0x25')]||'wav','context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1f')]});}}_0xa84647['extensions'][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')],'app':'Set','appdata':_0x0fb7('0x28'),'context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0]['exten'],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1f')]});_0xa84647[_0x0fb7('0x13')][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0]['type'],'app':_0x0fb7('0x17'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')],'priority':_0xa84647['priority']++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1f')]});_0xa84647['extensions'][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x16')],'app':'Set','appdata':_0x0fb7('0x29'),'context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'exten':_0x5142b1[_0x5b5cf7][0x0]['exten'],'priority':_0xa84647[_0x0fb7('0x12')]++,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0]['VoiceExtensionId']});for(var _0x315fe7=0x0,_0x3fa14a=0x0;_0x315fe7<_0x5142b1[_0x5b5cf7]['length'];_0x315fe7+=0x1,_0x3fa14a=0x0){var _0x1b9902=_0x5142b1[_0x5b5cf7][_0x315fe7];if(_0x1b9902[_0x0fb7('0x16')]){_0x1b9902[_0x0fb7('0x16')]=_0x1b9902[_0x0fb7('0x16')]['toLowerCase']();}var _0x4d63b4=[];var _0x5e9756=[];delete _0x1b9902['id'];delete _0x1b9902['createdAt'];delete _0x1b9902[_0x0fb7('0x2a')];var _0x3b48a9=_0x1b9902[_0x0fb7('0x2b')]!==_0x0fb7('0x2c')?[_0x1b9902[_0x0fb7('0x2b')]]:_0x1b9902[_0x0fb7('0x7')]?_[_0x0fb7('0xa')](_[_0x0fb7('0xd')](_0xa84647[_0x0fb7('0x5')],{'IntervalId':_0x1b9902[_0x0fb7('0x7')]}),_0x0fb7('0x2b')):[];if(_0x1b9902[_0x0fb7('0x11')](_0x0fb7('0x2d'))){if(_0x1b9902[_0x0fb7('0x2d')]&&_0x1b9902[_0x0fb7('0x2d')]!=='--'){_0x4d63b4['push']({'type':_0x1b9902[_0x0fb7('0x16')],'app':_0x0fb7('0x17'),'appdata':_0x0fb7('0x2e')+_0x1b9902['tag'],'context':_0x1b9902[_0x0fb7('0x1a')],'exten':_0x1b9902[_0x0fb7('0xb')],'priority':_0x3b48a9[_0x0fb7('0x2f')]+_0xa84647[_0x0fb7('0x12')]+_0x3fa14a++,'VoiceExtensionId':_0x1b9902['VoiceExtensionId']});}}if(_0x1b9902['type']===_0x0fb7('0x30')&&_0x1b9902['hasOwnProperty'](_0x0fb7('0x31'))){if(_0x1b9902[_0x0fb7('0x31')]){_0x4d63b4[_0x0fb7('0x1b')]({'type':_0x1b9902['type'],'app':_0x0fb7('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x1b9902['callerID']+')','context':_0x1b9902[_0x0fb7('0x1a')],'exten':_0x1b9902[_0x0fb7('0xb')],'priority':_0x3b48a9[_0x0fb7('0x2f')]+_0xa84647[_0x0fb7('0x12')]+_0x3fa14a++,'VoiceExtensionId':_0x1b9902[_0x0fb7('0x1f')]});}else{_0x4d63b4[_0x0fb7('0x1b')]({'type':_0x1b9902[_0x0fb7('0x16')],'app':_0x0fb7('0x21'),'appdata':_0x0fb7('0x32'),'context':_0x1b9902['context'],'exten':_0x1b9902[_0x0fb7('0xb')],'priority':_0x3b48a9[_0x0fb7('0x2f')]+_0xa84647['priority']+_0x3fa14a++,'VoiceExtensionId':_0x1b9902['VoiceExtensionId']});}}if(_0x1b9902[_0x0fb7('0x11')](_0x0fb7('0x33'))){if(_0x3b5fe2[_0x0fb7('0x34')](_0x1b9902[_0x0fb7('0x35')][_0x0fb7('0x36')]())>=0x0&&_0x1b9902[_0x0fb7('0x37')]!==_0x0fb7('0x38')){if(_0x1b9902['answer']){_0x4d63b4['push']({'type':_0x1b9902[_0x0fb7('0x16')],'app':_0x0fb7('0x21'),'appdata':_0x0fb7('0x39'),'context':_0x1b9902[_0x0fb7('0x1a')],'exten':_0x1b9902['exten'],'priority':_0x3b48a9[_0x0fb7('0x2f')]+_0xa84647[_0x0fb7('0x12')]+_0x3fa14a++,'VoiceExtensionId':_0x1b9902[_0x0fb7('0x1f')]});_0x4d63b4[_0x0fb7('0x1b')]({'type':_0x1b9902[_0x0fb7('0x16')],'app':_0x0fb7('0x17'),'appdata':_0x0fb7('0x3a'),'context':_0x1b9902[_0x0fb7('0x1a')],'exten':_0x1b9902[_0x0fb7('0xb')],'priority':_0x3b48a9['length']+_0xa84647[_0x0fb7('0x12')]+_0x3fa14a++,'VoiceExtensionId':_0x1b9902[_0x0fb7('0x1f')]});}else{_0x4d63b4['push']({'type':_0x1b9902['type'],'app':_0x0fb7('0x21'),'appdata':_0x0fb7('0x3b'),'context':_0x1b9902['context'],'exten':_0x1b9902['exten'],'priority':_0x3b48a9['length']+_0xa84647[_0x0fb7('0x12')]+_0x3fa14a++,'VoiceExtensionId':_0x1b9902[_0x0fb7('0x1f')]});_0x4d63b4[_0x0fb7('0x1b')]({'type':_0x1b9902[_0x0fb7('0x16')],'app':_0x0fb7('0x17'),'appdata':_0x0fb7('0x3c'),'context':_0x1b9902[_0x0fb7('0x1a')],'exten':_0x1b9902[_0x0fb7('0xb')],'priority':_0x3b48a9[_0x0fb7('0x2f')]+_0xa84647[_0x0fb7('0x12')]+_0x3fa14a++,'VoiceExtensionId':_0x1b9902['VoiceExtensionId']});}}}for(var _0x5d9042=0x0;_0x5d9042<_0x3b48a9[_0x0fb7('0x2f')];_0x5d9042+=0x1){var _0x1d6b1d=_0xa84647['priority']+_0x3b48a9[_0x0fb7('0x2f')];var _0x4c7a3a=_0x5d9042===_0x3b48a9[_0x0fb7('0x2f')]-0x1?_0xa84647['priority']+_0x4d63b4[_0x0fb7('0x2f')]+_0x5e9756[_0x0fb7('0x2f')]+0x2:_0xa84647[_0x0fb7('0x12')]+_0x5d9042+0x1;_0x4d63b4['splice'](_0x5d9042,0x0,{'type':_0x1b9902[_0x0fb7('0x16')],'app':_0x0fb7('0x3d'),'appdata':_0x3b48a9[_0x5d9042]+'?'+_0x1b9902[_0x0fb7('0x1a')]+_0x0fb7('0x3e')+_0x1d6b1d+':'+_0x1b9902['context']+',${EXTEN},'+_0x4c7a3a,'exten':_0x1b9902[_0x0fb7('0xb')],'context':_0x1b9902['context'],'priority':_0xa84647[_0x0fb7('0x12')]+_0x5d9042,'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0]['VoiceExtensionId']});}_0x1b9902[_0x0fb7('0x12')]=_0x4d63b4['length']?_[_0x0fb7('0x3f')](_0x4d63b4)[_0x0fb7('0x12')]+0x1:_0xa84647['priority'];_0xa84647['priority']=(_0x5e9756['length']?_[_0x0fb7('0x3f')](_0x5e9756)[_0x0fb7('0x12')]:_0x1b9902[_0x0fb7('0x12')])+0x1;_0xa84647[_0x0fb7('0x13')]=_[_0x0fb7('0x40')](_0xa84647[_0x0fb7('0x13')],_0x4d63b4,[_0x1b9902],_0x5e9756);}_0xa84647[_0x0fb7('0x13')][_0x0fb7('0x1b')]({'type':_0x5142b1[_0x5b5cf7][0x0]['type'],'app':_0x0fb7('0x41'),'exten':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0xb')],'context':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1a')],'priority':_0xa84647[_0x0fb7('0x12')],'VoiceExtensionId':_0x5142b1[_0x5b5cf7][0x0][_0x0fb7('0x1f')]});_0x293ef9['push'](_0x5142b1[_0x5b5cf7][0x0]['VoiceExtensionId']);_0x4bdac2=_[_0x0fb7('0x40')](_0x4bdac2,_0xa84647['extensions']);}}return _0x35ccb9['transaction'](function(_0x5cd9e3){return _0x35ccb9[_0x0fb7('0x2')][_0x0fb7('0x6')][_0x0fb7('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x293ef9}},'transaction':_0x5cd9e3})[_0x0fb7('0x8')](function(_0xde9201){return _0x35ccb9[_0x0fb7('0x2')][_0x0fb7('0x6')]['bulkCreate'](_['sortBy'](_0x4bdac2,_0x0fb7('0x12')),{'transaction':_0x5cd9e3});});});})[_0x0fb7('0x43')](function(_0x516683){console['error'](_0x516683);});}exports[_0x0fb7('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d8ec2ce..3f1a55b 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 _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(_0x1114dc,_0x50aed4){var _0x164894=function(_0x40ec33){while(--_0x40ec33){_0x1114dc['push'](_0x1114dc['shift']());}};_0x164894(++_0x50aed4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 +var _0x70e0=['insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','createdAt','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','catch','query','BlackLists','all','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','duplicate','Duplicate\x20Contact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect'];(function(_0x5ba188,_0x58a5fa){var _0x34d663=function(_0x44ac75){while(--_0x44ac75){_0x5ba188['push'](_0x5ba188['shift']());}};_0x34d663(++_0x58a5fa);}(_0x70e0,0x17b));var _0x070e=function(_0x4d5d34,_0x77fe01){_0x4d5d34=_0x4d5d34-0x0;var _0x171e18=_0x70e0[_0x4d5d34];return _0x171e18;};'use strict';var BPromise=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var _=require(_0x070e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var config=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('api');config[_0x070e('0x7')]=_['defaults'](config[_0x070e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x8'))[_0x070e('0x9')](socket);try{if(!process[_0x070e('0xa')][0x2]||process[_0x070e('0xa')][0x2]===_0x070e('0xb')||process[_0x070e('0xa')][0x2]===_0x070e('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x070e('0xa')][0x3]||process[_0x070e('0xa')][0x3]===_0x070e('0xb')||process[_0x070e('0xa')][0x3]===_0x070e('0xc')||!process[_0x070e('0xa')][0x4]||process[_0x070e('0xa')][0x4]===_0x070e('0xb')||process[_0x070e('0xa')][0x4]===_0x070e('0xc')){throw new Error(_0x070e('0xd'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x070e('0xe')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x070e('0xa')][0x5]===_0x070e('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x070e('0xf'));}var LISTID=process[_0x070e('0xa')][0x5];var COMPANYID=process[_0x070e('0xa')][0x6]&&process[_0x070e('0xa')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x070e('0xc')?process[_0x070e('0xa')][0x6]:null;var DUPLICATES=process[_0x070e('0xa')][0x7]&&process[_0x070e('0xa')][0x7]!==_0x070e('0xb')&&process['argv'][0x7]!==_0x070e('0xc')?process[_0x070e('0xa')][0x7]:null;if(!process[_0x070e('0xa')][0x8]||process[_0x070e('0xa')][0x8]===_0x070e('0xb')||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x070e('0xa')][0x8];}catch(_0x3004f0){logger[_0x070e('0x10')](_0x3004f0);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(_0x4be0d7,_0x5b184,_0x5dc5d2,_0xf8dd5d){var _0x3f6985={'message':_0x5b184};_0x3f6985[_0x4be0d7]=!![];if(_0x5dc5d2){_0x3f6985[_0x070e('0x11')]=_0x5dc5d2;}if(_0xf8dd5d){_0x3f6985[_0x070e('0x12')]=_0xf8dd5d;}return _0x3f6985;}function isEmail(_0x28a1c3){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))*$/[_0x070e('0x13')](_0x28a1c3);}function checkRow(_0xe405e,_0x164cdf,_0x595c7e){return new BPromise(function(_0x2f8055,_0x270061){if(_[_0x070e('0x14')](_0xe405e)){return _0x270061(handleCheckRowError('error',_0x070e('0x15'),null,_0x595c7e));}if(_0xe405e['errors']&&_0xe405e['errors'][_0x070e('0x16')]){var _0x25f6e=_[_0x070e('0x17')](_0xe405e[_0x070e('0x18')],_0x070e('0x19'))['join'](';');return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x25f6e,null,_0x595c7e));}var _0x219e48={};for(var _0x1d72d6 in FIELDS){if(FIELDS[_0x070e('0x1a')](_0x1d72d6)&&FIELDS[_0x1d72d6]){_0x219e48[_0x1d72d6]=_0xe405e[_0x070e('0x1b')][0x0][FIELDS[_0x1d72d6]]||_0xe405e[_0x070e('0x1b')][0x0]['\ufeff'+FIELDS[_0x1d72d6]];}}if(!_0x219e48[_0x070e('0x1c')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),'firstName\x20not\x20specified!',null,_0x595c7e));}if(!_0x219e48[_0x070e('0x1d')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x1e'),null,_0x595c7e));}if(_0x219e48['birthDate']){var _0x5c5f0d=moment(_0x219e48[_0x070e('0x1f')],_0x070e('0x20'));if(!_0x5c5f0d[_0x070e('0x21')]()){return _0x270061(handleCheckRowError('error',_0x070e('0x22'),null,_0x595c7e));}}if(_0x219e48[_0x070e('0x23')]){if(!isEmail(_0x219e48[_0x070e('0x23')])){return _0x270061(handleCheckRowError(_0x070e('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0x595c7e));}}_0x219e48['ListId']=LISTID;_0x219e48['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x164cdf){var _0xdf8945={};for(var _0x4e0a7d=0x0,_0x1dff97=DUPLICATES[_0x070e('0x16')];_0x4e0a7d<_0x1dff97;_0x4e0a7d+=0x1){_0xdf8945[DUPLICATES[_0x4e0a7d]]=_0x219e48[DUPLICATES[_0x4e0a7d]];}var _0x4f8130=_['find'](_0x164cdf,_0xdf8945);if(_0x4f8130){return _0x270061(handleCheckRowError(_0x070e('0x24'),_0x070e('0x25'),_0x4f8130,_0x595c7e));}}return db['CmContact']['create'](_0x219e48,{'raw':!![],'hooks':![],'fields':_[_0x070e('0x26')](_0x219e48)})[_0x070e('0x27')](function(_0x444d02){if(DUPLICATES&&DUPLICATES[_0x070e('0x16')]&&_0x164cdf){_0x164cdf[_0x070e('0x28')](_['pick'](_0x219e48,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x444d02['id'];return _0x2f8055();})['catch'](function(_0x24d17d){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x29')+(_0x24d17d[_0x070e('0x19')]||JSON[_0x070e('0x2a')](_0x24d17d)),null,_0x595c7e));});});}function checkHopper(){function _0x4deaf8(){return function(_0x22f3a9){logger[_0x070e('0x10')]('cmContact',_0x070e('0x2b'),util[_0x070e('0x2c')](_0x22f3a9,{'showHidden':![],'depth':null}));};}var _0x4ba6f0=function(_0x4d4ee8,_0x5ddbe9){var _0x363bff=squel[_0x070e('0x2d')]()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x5ddbe9,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone',_0x070e('0x1d'))[_0x070e('0x36')]('NOW()',_0x070e('0x31'))['field']('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x4d4ee8['id']['toString'](),_0x5ddbe9)[_0x070e('0x36')]('NOW()','createdAt')[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'))[_0x070e('0x3d')]('cm_hopper')[_0x070e('0x3a')](_0x5ddbe9+'\x20=\x20?',_0x4d4ee8['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x363bff;};var _0xff760c=function(_0x52fcea,_0x54285a){var _0x261a27=squel['insert']()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),'ListId',_0x54285a,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'),_0x070e('0x1d'))['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x52fcea['id'][_0x070e('0x37')](),_0x54285a)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))['where'](_0x070e('0x42'))['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()['field'](_0x070e('0x43'))[_0x070e('0x3d')](_0x070e('0x44'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]()))[_0x070e('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x070e('0x35')]()['field']('phone')[_0x070e('0x3d')](_0x070e('0x2f'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x261a27;};function _0x440fa1(_0x343785,_0x53bea1){var _0x477e69=squel['insert']()['into'](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x53bea1,_0x070e('0x3e'),_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone','phone')['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))['field'](LISTID[_0x070e('0x37')](),'ListId')[_0x070e('0x36')](_0x343785['id'][_0x070e('0x37')](),_0x53bea1)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')]('NOW()',_0x070e('0x34'))[_0x070e('0x3d')](_0x070e('0x39'))['where'](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where'](_0x070e('0x40'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x477e69;}function _0x1ae5cb(_0x1100d8,_0x122198){var _0x3cb9ee=squel[_0x070e('0x2d')]()['into'](_0x070e('0x46'))['fromQuery']([_0x070e('0x1d'),'ContactId',_0x070e('0x33'),_0x122198,_0x070e('0x3e'),'updatedAt'],squel[_0x070e('0x35')]()['field'](_0x070e('0x1d'),_0x070e('0x1d'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x1100d8['id'][_0x070e('0x37')](),_0x122198)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),'updatedAt')[_0x070e('0x3d')](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))['where'](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))[_0x070e('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x3cb9ee;}return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x070e('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x36373d){var _0x3a1ad2=[];if(_0x36373d){var _0x150bf6;for(var _0x2a20d4=0x0,_0x50ef9f;_0x2a20d4<_0x36373d[_0x070e('0x16')];_0x2a20d4+=0x1){_0x50ef9f=_0x36373d[_0x2a20d4][_0x070e('0x4b')]({'plain':!![]});switch(_0x50ef9f[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0xff760c(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case'onlyIfOpen':_0x3a1ad2[_0x070e('0x28')](db['sequelize'][_0x070e('0x51')](_0x4ba6f0(_0x50ef9f,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0x440fa1(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})['catch'](_0x4deaf8()));}}}return _0x3a1ad2;})['all']()[_0x070e('0x27')](function(){return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id'],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x332c8a){var _0x25b599=[];if(_0x332c8a){var _0x1d1f44;for(var _0x72077d=0x0,_0x25670e;_0x72077d<_0x332c8a[_0x070e('0x16')];_0x72077d+=0x1){_0x25670e=_0x332c8a[_0x72077d]['get']({'plain':!![]});_0x25b599[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x1ae5cb(_0x25670e,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x25b599;})[_0x070e('0x53')]();})[_0x070e('0x27')](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id',_0x070e('0x4c')],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x55'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x62800d){var _0x2084a1=[];if(_0x62800d){for(var _0x46ec49=0x0,_0x595e2e;_0x46ec49<_0x62800d['length'];_0x46ec49+=0x1){_0x595e2e=_0x62800d[_0x46ec49]['get']({'plain':!![]});switch(_0x595e2e[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0xff760c(_0x595e2e,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case _0x070e('0x57'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x4ba6f0(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x440fa1(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));}}}return _0x2084a1;})[_0x070e('0x53')]();})['then'](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0xf0aef8){var _0x4da906=[];if(_0xf0aef8){for(var _0x40d7e6=0x0,_0xe8c476;_0x40d7e6<_0xf0aef8[_0x070e('0x16')];_0x40d7e6+=0x1){_0xe8c476=_0xf0aef8[_0x40d7e6][_0x070e('0x4b')]({'plain':!![]});_0x4da906[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x1ae5cb(_0xe8c476,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x4da906;})[_0x070e('0x53')]();})[_0x070e('0x50')](function(_0x18c27a){logger['error'](_0x070e('0x58'),_0x070e('0x59'),_0x18c27a[_0x070e('0x19')]);});}var processPromises=function(_0x1b71dd){return BPromise[_0x070e('0x53')](promises)[_0x070e('0x27')](function(_0x5c4352){})['catch'](function(_0x4a8563){logger[_0x070e('0x10')](_0x070e('0x5a'),JSON[_0x070e('0x2a')](_0x4a8563));})[_0x070e('0x5b')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1b71dd){return _0x1b71dd[_0x070e('0x5d')]();}});};var endCsv=function(){return BPromise[_0x070e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x070e('0x27')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x070e('0x5f')](FILEPATH);}catch(_0x59e6e5){logger['error'](_0x070e('0x60'),JSON[_0x070e('0x2a')](_0x59e6e5));}finally{process['exit'](0x0);}});};process['on'](_0x070e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x070e('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x070e('0xe')](',');return db[_0x070e('0x62')][_0x070e('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x070e('0x27')](function(_0x341756){var _0x2a12a1=fs[_0x070e('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x070e('0x64')](_0x2a12a1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xdcc60a,_0x4e0f6e){total+=0x1;var _0x1306e6=total;promises[_0x070e('0x28')](checkRow(_0xdcc60a,_0x341756,_0x1306e6)[_0x070e('0x27')](function(){success+=0x1;})[_0x070e('0x50')](function(_0x3f2bb5){if(_0x3f2bb5[_0x070e('0x10')]){errors+=0x1;delete _0x3f2bb5[_0x070e('0x10')];}else if(_0x3f2bb5[_0x070e('0x24')]){duplicates+=0x1;delete _0x3f2bb5[_0x070e('0x24')];}rows[_0x070e('0x28')](_0x3f2bb5);}));if(total%0xc8===0x0){_0x4e0f6e[_0x070e('0x65')]();return processPromises(_0x4e0f6e);}},'complete':function(){return processPromises()['then'](function(){logger[_0x070e('0x66')](_0x070e('0x67'));endCsv();});},'error':function(_0x449337,_0xe50b1b){logger['info'](_0x070e('0x68'),JSON[_0x070e('0x2a')](_0x449337));endCsv();}});})[_0x070e('0x50')](function(_0x2bad43){logger[_0x070e('0x10')](_0x070e('0x69'),JSON['stringify'](_0x2bad43));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 858bbeb..5bf21bd 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 _0x1112=['../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.UserId','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.createdAt','into','cm_hopper_black','.CmListId\x20=\x20?','ListId\x20=\x20?','concat','keys','CompanyId','insert','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','Received\x20SIGINT','errors','push','code','message','query','catch','error','info','stringify','send','start','root','server/files/tmp','.csv','writeFileSync','parse','createReadStream','data','rows','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','\x20not\x20specified','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','length','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','exit','argv','existsSync','file\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment'];(function(_0x3da2d6,_0x55a24a){var _0x47e3ef=function(_0x583c6b){while(--_0x583c6b){_0x3da2d6['push'](_0x3da2d6['shift']());}};_0x47e3ef(++_0x55a24a);}(_0x1112,0x174));var _0x2111=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1112[_0x5ddb1c];return _0x354adc;};'use strict';var fs=require('fs');var path=require(_0x2111('0x0'));var _=require(_0x2111('0x1'));var Papa=require(_0x2111('0x2'));var util=require(_0x2111('0x3'));var BPromise=require(_0x2111('0x4'));var moment=require(_0x2111('0x5'));var squel=require(_0x2111('0x6'));var Redis=require(_0x2111('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x2111('0x8'));var logger=require(_0x2111('0x9'))(_0x2111('0xa'));config[_0x2111('0xb')]=_[_0x2111('0xc')](config[_0x2111('0xb')],{'host':_0x2111('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2111('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x2111('0xe')](_0x2111('0xf'));function isEmail(_0x6e64a3){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))*$/[_0x2111('0x10')](_0x6e64a3);}function selectNotIn(_0x1b0f9a,_0x53911,_0x5b49c5,_0x3d878a,_0x351abd){return squel['select']()[_0x2111('0x11')](_0x2111('0x12'))[_0x2111('0x13')](_0x3d878a)[_0x2111('0x14')](_0x53911,null,_0x53911+'.id\x20=\x20'+_0x3d878a+'.'+_0x5b49c5)[_0x2111('0x15')](_0x3d878a+'.'+_0x5b49c5+_0x2111('0x16')+_0x1b0f9a+'.'+_0x5b49c5)['where'](_0x53911+_0x2111('0x17')+_0x351abd['join']()+')');}function insertCmHopper(_0x570bde,_0x12fb05,_0x976298,_0x263297,_0x4e8a28){var _0x4ab821=['cm_contacts.phone',_0x2111('0x18'),_0x2111('0x19'),_0x2111('0x1a'),_0x12fb05+'.'+_0x263297,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0x2111('0x1b'),'\x22'+_0x4e8a28+'\x22'];return squel['insert']()['into']('cm_hopper')[_0x2111('0x1c')]([_0x2111('0x12'),_0x2111('0x1d'),_0x2111('0x1e'),_0x2111('0x1f'),_0x263297,_0x2111('0x20'),_0x2111('0x21'),_0x2111('0x22'),_0x2111('0x23'),_0x2111('0x24')],squel[_0x2111('0x25')]()[_0x2111('0x26')](_0x4ab821)[_0x2111('0x13')](_0x12fb05)[_0x2111('0x14')](_0x2111('0x27'),null,_0x2111('0x28')+_0x12fb05+'.CmListId')[_0x2111('0x14')](_0x976298,null,_0x976298+_0x2111('0x29')+_0x12fb05+'.'+_0x263297)[_0x2111('0x15')](_0x12fb05+'.CmListId\x20=\x20?',_0x570bde)[_0x2111('0x15')](_0x2111('0x2a'),NOW)[_0x2111('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x12fb05,_0x976298,_0x263297,_0x2111('0x2b'),['\x22always\x22',_0x2111('0x2c')]))[_0x2111('0x15')](_0x2111('0x2d'),selectNotIn(_0x12fb05,_0x976298,_0x263297,_0x2111('0x2b'),[_0x2111('0x2e')])))[_0x2111('0x2f')]();}function insertCmHopperBlack(_0x3bd139,_0x52bff0,_0x24313e,_0x27e1e1){var _0x5bdd72=['cm_contacts.phone',_0x2111('0x19'),_0x2111('0x1a'),_0x52bff0+'.'+_0x27e1e1,_0x2111('0x30'),'cm_contacts.updatedAt'];return squel['insert']()[_0x2111('0x31')](_0x2111('0x32'))[_0x2111('0x1c')]([_0x2111('0x12'),'ContactId',_0x2111('0x1f'),_0x27e1e1,_0x2111('0x20'),'updatedAt'],squel[_0x2111('0x25')]()[_0x2111('0x26')](_0x5bdd72)['from'](_0x52bff0)[_0x2111('0x14')](_0x2111('0x27'),null,_0x2111('0x28')+_0x52bff0+'.CmListId')[_0x2111('0x14')](_0x24313e,null,_0x24313e+_0x2111('0x29')+_0x52bff0+'.'+_0x27e1e1)['where'](_0x52bff0+_0x2111('0x33'),_0x3bd139)[_0x2111('0x15')](_0x2111('0x2a'),NOW)['where'](_0x2111('0x2d'),squel[_0x2111('0x25')]()[_0x2111('0x11')](_0x2111('0x12'))[_0x2111('0x13')](_0x2111('0x32'))[_0x2111('0x15')](_0x2111('0x34'),_0x3bd139)[_0x2111('0x15')](_0x27e1e1+'\x20=\x20?',_0x52bff0+'.'+_0x27e1e1)))['toString']();}function insertCmContact(_0x3ba32b,_0x2e710b,_0x4192c5,_0xae1a75){var _0x5eb212=_[_0x2111('0x35')](_[_0x2111('0x36')](_0xae1a75),['ListId',_0x2111('0x37'),_0x2111('0x20'),_0x2111('0x21')]);return squel[_0x2111('0x38')]()['into']('cm_contacts')[_0x2111('0x1c')](_0x5eb212,squel[_0x2111('0x25')]()[_0x2111('0x26')](_0x5eb212)['from'](_0x2e710b)[_0x2111('0x15')]('('+_0x4192c5[_0x2111('0x14')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x4192c5)[_0x2111('0x13')](_0x2111('0x27'))[_0x2111('0x15')](_0x2111('0x34'),_0x3ba32b)[_0x2111('0x15')](_0x2111('0x39')))[_0x2111('0x15')](_0x2111('0x3a'),squel[_0x2111('0x25')]()[_0x2111('0x11')](_0x2111('0x3b'),'min_id')[_0x2111('0x13')](_0x2e710b)[_0x2111('0x3c')](_0x4192c5[_0x2111('0x14')](','))))['toString']();}function handleStop(){logger['info'](_0x2111('0x3d'));stopped=!![];}function handleUncaughtException(_0x40fe2d){logger['error'](_0x40fe2d['message']);process['exit'](0x1);}function handleError(_0x18111b,_0x356eab){stats[_0x2111('0x3e')][_0x2111('0x3f')]({'name':_0x356eab[_0x2111('0x40')],'message':_0x356eab[_0x2111('0x41')],'row':_0x18111b});}function handleQuery(_0x5c8948){logger['info'](_0x5c8948);return db['sequelize'][_0x2111('0x42')](_0x5c8948)['spread'](function(_0x46d904){results[_0x2111('0x3f')](_0x46d904);})[_0x2111('0x43')](function(_0xef3fc){logger[_0x2111('0x44')](_0xef3fc[_0x2111('0x41')]);});}function main(_0x2b7572,_0x4c46ec,_0x196571,_0x38eeb0){logger[_0x2111('0x45')]('main',_0x2b7572,JSON[_0x2111('0x46')](_0x4c46ec));process[_0x2111('0x47')](_0x2111('0x48'));var _0x6ea8ef=_0x4c46ec['binding'];var _0x2ec690=_0x4c46ec['socket_timestamp'];var _0xcd0cb0=path['join'](config[_0x2111('0x49')],_0x2111('0x4a'),_0x2ec690+_0x2111('0x4b'));var _0x44eee3=_['keys'](_0x6ea8ef)[_0x2111('0x14')]();logger[_0x2111('0x45')]('header',_0x44eee3);fs[_0x2111('0x4c')](_0xcd0cb0,_0x44eee3+'\x0a');Papa[_0x2111('0x4d')](fs[_0x2111('0x4e')](_0x2b7572),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ec887,_0x5326fe){try{for(var _0x1d7ebd=0x0,_0x47ddb3=[];_0x1d7ebd<_0x3ec887[_0x2111('0x4f')]['length'];_0x1d7ebd++){stats[_0x2111('0x50')]+=0x1;if(_0x3ec887[_0x2111('0x3e')][_0x1d7ebd]){handleError(_0x3ec887[_0x2111('0x4f')][_0x1d7ebd],_0x3ec887[_0x2111('0x3e')][_0x1d7ebd]);}else{var _0x559ace=[];for(var _0x5e3dfd in _0x6ea8ef){if(_0x6ea8ef['hasOwnProperty'](_0x5e3dfd)){if(_0x3ec887[_0x2111('0x4f')][_0x1d7ebd][_0x6ea8ef[_0x5e3dfd]]){var _0x14d8d1=_[_0x2111('0x51')](_0x3ec887[_0x2111('0x4f')][_0x1d7ebd][_0x6ea8ef[_0x5e3dfd]][_0x2111('0x52')](/"/g,'\x27'));switch(_0x5e3dfd){case _0x2111('0x1d'):var _0x478978=moment(_0x14d8d1,_0x2111('0xf'),!![]);if(_0x478978[_0x2111('0x53')]()){_0x47ddb3[_0x2111('0x3f')]('\x22'+_0x14d8d1+'\x22');}else{_0x559ace['push'](_0x2111('0x54'));}break;case _0x2111('0x22'):var _0x286d30=parseInt(_0x14d8d1);_0x14d8d1=_[_0x2111('0x55')](_0x286d30)||_0x286d30<0x0||_0x286d30>0x4?_0x38eeb0?0x3:0x2:_0x286d30;_0x47ddb3['push']('\x22'+_0x14d8d1+'\x22');break;case _0x2111('0x23'):var _0x37ca7b=parseInt(_0x14d8d1);if(_[_0x2111('0x56')](_0x37ca7b)&&_[_0x2111('0x57')](_0x196571,_0x37ca7b)){_0x47ddb3[_0x2111('0x3f')]('\x22'+_0x37ca7b+'\x22');}else{_0x559ace['push']('agent\x20not\x20exists');}break;case _0x2111('0x58'):if(isEmail(_0x14d8d1)){_0x47ddb3['push']('\x22'+_0x14d8d1+'\x22');}else{_0x559ace[_0x2111('0x3f')](_0x2111('0x59'));}break;case _0x2111('0x5a'):var _0x28e358=moment(_0x14d8d1,_0x2111('0x5b'),!![]);if(_0x28e358[_0x2111('0x53')]()){_0x47ddb3[_0x2111('0x3f')]('\x22'+_0x14d8d1+'\x22');}else{_0x559ace[_0x2111('0x3f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x47ddb3['push']('\x22'+_0x14d8d1+'\x22');}}else{switch(_0x5e3dfd){case'firstName':case'phone':_0x559ace[_0x2111('0x3f')](_0x5e3dfd+_0x2111('0x5c'));break;default:_0x47ddb3['push']('\x22\x22');}}}}if(_0x559ace['length']){handleError(_0x3ec887[_0x2111('0x4f')][_0x1d7ebd],{'code':_0x2111('0x5d'),'message':_0x559ace[_0x2111('0x14')]()});}else{fs['appendFileSync'](_0xcd0cb0,_0x47ddb3[_0x2111('0x14')]()+'\x0a');}_0x47ddb3=[];}if(!(stats['rows']%0xc8)){socket[_0x2111('0x5e')](_0x2111('0x5f')+_0x2ec690,stats);stats[_0x2111('0x3e')]=[];}}if(stopped){logger[_0x2111('0x45')](_0x2111('0x60'));_0x5326fe[_0x2111('0x61')]();}}catch(_0x2904d4){handleError(_0x3ec887[_0x2111('0x4f')][_0x1d7ebd],{'code':_0x2111('0x62'),'message':_0x2904d4[_0x2111('0x41')]});logger[_0x2111('0x44')](_0x2111('0x63'),_0x2904d4['message']);}},'complete':function(){try{var _0x5b3064=[];var _0x4621ec=_0x2111('0x27');if(_0x4c46ec[_0x2111('0x64')]&&_0x4c46ec[_0x2111('0x64')][_0x2111('0x65')]){_0x4621ec='cm_contacts_'+_0x2ec690;_0x5b3064['push'](_0x2111('0x66')+_0x4621ec+_0x2111('0x67'));}var _0x5afd7e=util[_0x2111('0xe')]('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',_0xcd0cb0,_0x4621ec,_0x44eee3,_0x4c46ec['ListId'],_0x4c46ec['CompanyId']||null,NOW,NOW);if(_[_0x2111('0x68')](_0x6ea8ef[_0x2111('0x1d')])){_0x5afd7e+=_0x2111('0x69');}_0x5b3064[_0x2111('0x3f')](_0x5afd7e);if(_0x4c46ec['duplicates']&&_0x4c46ec['duplicates']['length']){_0x5b3064['push'](insertCmContact(_0x4c46ec[_0x2111('0x1f')],_0x4621ec,_0x4c46ec[_0x2111('0x64')],_0x6ea8ef));_0x5b3064[_0x2111('0x3f')](_0x2111('0x6a')+_0x4621ec+';');}_0x5b3064[_0x2111('0x3f')](insertCmHopper(_0x4c46ec['ListId'],_0x2111('0x6b'),'voice_queues',_0x2111('0x6c'),_0x38eeb0));_0x5b3064[_0x2111('0x3f')](insertCmHopperBlack(_0x4c46ec[_0x2111('0x1f')],_0x2111('0x6d'),'voice_queues','VoiceQueueId'));_0x5b3064[_0x2111('0x3f')](insertCmHopper(_0x4c46ec[_0x2111('0x1f')],_0x2111('0x6e'),_0x2111('0x6f'),_0x2111('0x70'),_0x38eeb0));_0x5b3064[_0x2111('0x3f')](insertCmHopperBlack(_0x4c46ec[_0x2111('0x1f')],_0x2111('0x71'),'campaigns','CampaignId'));BPromise['each'](_0x5b3064,handleQuery)[_0x2111('0x72')](function(_0x10fe1a){stats[_0x2111('0x73')]=!![];stats[_0x2111('0x74')]=_0x4c46ec[_0x2111('0x64')]&&_0x4c46ec['duplicates'][_0x2111('0x65')]?results[0x2]['affectedRows']:results[0x0][_0x2111('0x74')];socket[_0x2111('0x5e')](_0x2111('0x5f')+_0x2ec690,stats);fs[_0x2111('0x75')](_0x2b7572);fs['unlink'](_0xcd0cb0);process['exit'](0x0);})['catch'](function(_0x5016f4){logger[_0x2111('0x44')](_0x5016f4[_0x2111('0x41')]);process['exit'](0x1);});}catch(_0x43e734){logger[_0x2111('0x44')]('complete',_0x43e734['message']);process[_0x2111('0x76')](0x1);}},'error':function(_0x236b05,_0x5d9ee3,_0x82bf4,_0xef04a1){throw new Error(_0xef04a1);}});}function validate(){if(process[_0x2111('0x77')]&&process[_0x2111('0x77')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x5e83b4=path[_0x2111('0x14')](config['root'],_0x2111('0x4a'),process['argv'][0x2]);if(!fs[_0x2111('0x78')](_0x5e83b4)){throw new Error(_0x2111('0x79'));}var _0x1bf387={};try{_0x1bf387=JSON['parse'](process[_0x2111('0x77')][0x3]);if(!_0x1bf387[_0x2111('0x7a')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x1bf387[_0x2111('0x7a')][_0x2111('0x12')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x1bf387[_0x2111('0x7a')]['firstName']){throw new Error(_0x2111('0x7b'));}var _0x1d4b5e=0x0;if(_0x1bf387['binding'][_0x2111('0x23')]){_0x1d4b5e=0x1;}if(!_0x1bf387[_0x2111('0x1f')]){throw new Error(_0x2111('0x7c'));}}catch(_0x1dee07){throw new Error('body\x20id\x20mandatory');}var _0x9066db=[];try{_0x9066db=_['map'](JSON[_0x2111('0x4d')](process[_0x2111('0x77')][0x4]),'id');}catch(_0x5e97de){logger[_0x2111('0x45')]('No\x20agent\x20available');}main(_0x5e83b4,_0x1bf387,_0x9066db,_0x1d4b5e);}validate();process['on'](_0x2111('0x7d'),handleStop);process['on'](_0x2111('0x7e'),handleUncaughtException); \ No newline at end of file +var _0x656d=['CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','length','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.updatedAt','cm_hopper_black','fields','field','ListId\x20=\x20?','\x20=\x20?','toString','concat','CompanyId','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','push','code','sequelize','query','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','writeFileSync','createReadStream','data','rows','errors','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','abort','step','duplicates','cm_contacts_'];(function(_0xf5267f,_0x574d17){var _0x250f33=function(_0x2b8380){while(--_0x2b8380){_0xf5267f['push'](_0xf5267f['shift']());}};_0x250f33(++_0x574d17);}(_0x656d,0x1a7));var _0xd656=function(_0x9f9ca8,_0x30388c){_0x9f9ca8=_0x9f9ca8-0x0;var _0x35c5e5=_0x656d[_0x9f9ca8];return _0x35c5e5;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xd656('0x0'));var util=require(_0xd656('0x1'));var BPromise=require(_0xd656('0x2'));var moment=require(_0xd656('0x3'));var squel=require('squel');var Redis=require(_0xd656('0x4'));var db=require(_0xd656('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xd656('0x6'));config[_0xd656('0x7')]=_[_0xd656('0x8')](config[_0xd656('0x7')],{'host':_0xd656('0x9'),'port':0x18eb});var socket=require(_0xd656('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0xd656('0xb'));function isEmail(_0x4da6e3){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'](_0x4da6e3);}function selectNotIn(_0x3d2fe9,_0x88c059,_0x2b75e3,_0x46f708,_0x2f1963){return squel['select']()['field'](_0xd656('0xc'))[_0xd656('0xd')](_0x46f708)[_0xd656('0xe')](_0x88c059,null,_0x88c059+_0xd656('0xf')+_0x46f708+'.'+_0x2b75e3)[_0xd656('0x10')](_0x46f708+'.'+_0x2b75e3+'\x20=\x20'+_0x3d2fe9+'.'+_0x2b75e3)['where'](_0x88c059+_0xd656('0x11')+_0x2f1963[_0xd656('0xe')]()+')');}function insertCmHopper(_0x1aeb57,_0x5bb705,_0x29ebda,_0x30f241,_0x3713a0){var _0x356ef9=[_0xd656('0x12'),_0xd656('0x13'),'cm_contacts.id',_0xd656('0x14'),_0x5bb705+'.'+_0x30f241,_0xd656('0x15'),'cm_contacts.updatedAt','cm_contacts.priority',_0xd656('0x16'),'\x22'+_0x3713a0+'\x22'];return squel[_0xd656('0x17')]()[_0xd656('0x18')](_0xd656('0x19'))[_0xd656('0x1a')]([_0xd656('0xc'),_0xd656('0x1b'),_0xd656('0x1c'),_0xd656('0x1d'),_0x30f241,_0xd656('0x1e'),_0xd656('0x1f'),_0xd656('0x20'),_0xd656('0x21'),_0xd656('0x22')],squel[_0xd656('0x23')]()['fields'](_0x356ef9)['from'](_0x5bb705)[_0xd656('0xe')]('cm_contacts',null,_0xd656('0x24')+_0x5bb705+_0xd656('0x25'))[_0xd656('0xe')](_0x29ebda,null,_0x29ebda+'.id\x20=\x20'+_0x5bb705+'.'+_0x30f241)[_0xd656('0x10')](_0x5bb705+_0xd656('0x26'),_0x1aeb57)[_0xd656('0x10')](_0xd656('0x27'),NOW)[_0xd656('0x10')](_0xd656('0x28'),selectNotIn(_0x5bb705,_0x29ebda,_0x30f241,'cm_hopper',['\x22always\x22',_0xd656('0x29')]))[_0xd656('0x10')](_0xd656('0x28'),selectNotIn(_0x5bb705,_0x29ebda,_0x30f241,_0xd656('0x19'),[_0xd656('0x2a')])))['toString']();}function insertCmHopperBlack(_0x16b87c,_0x418ed3,_0x1b6ffc,_0x4ad32f){var _0x1124a9=[_0xd656('0x12'),'cm_contacts.id',_0xd656('0x14'),_0x418ed3+'.'+_0x4ad32f,_0xd656('0x15'),_0xd656('0x2b')];return squel['insert']()[_0xd656('0x18')](_0xd656('0x2c'))[_0xd656('0x1a')](['phone',_0xd656('0x1c'),_0xd656('0x1d'),_0x4ad32f,_0xd656('0x1e'),_0xd656('0x1f')],squel[_0xd656('0x23')]()[_0xd656('0x2d')](_0x1124a9)[_0xd656('0xd')](_0x418ed3)[_0xd656('0xe')]('cm_contacts',null,_0xd656('0x24')+_0x418ed3+_0xd656('0x25'))[_0xd656('0xe')](_0x1b6ffc,null,_0x1b6ffc+'.id\x20=\x20'+_0x418ed3+'.'+_0x4ad32f)[_0xd656('0x10')](_0x418ed3+_0xd656('0x26'),_0x16b87c)[_0xd656('0x10')](_0xd656('0x27'),NOW)[_0xd656('0x10')](_0xd656('0x28'),squel['select']()[_0xd656('0x2e')]('phone')[_0xd656('0xd')](_0xd656('0x2c'))[_0xd656('0x10')](_0xd656('0x2f'),_0x16b87c)[_0xd656('0x10')](_0x4ad32f+_0xd656('0x30'),_0x418ed3+'.'+_0x4ad32f)))[_0xd656('0x31')]();}function insertCmContact(_0x22bf4d,_0x27b4c4,_0x4329c8,_0x1b8d12){var _0x5b21ca=_[_0xd656('0x32')](_['keys'](_0x1b8d12),['ListId',_0xd656('0x33'),_0xd656('0x1e'),_0xd656('0x1f')]);return squel[_0xd656('0x17')]()[_0xd656('0x18')](_0xd656('0x34'))['fromQuery'](_0x5b21ca,squel['select']()[_0xd656('0x2d')](_0x5b21ca)[_0xd656('0xd')](_0x27b4c4)[_0xd656('0x10')]('('+_0x4329c8[_0xd656('0xe')](',')+')\x20NOT\x20IN\x20?',squel[_0xd656('0x23')]()[_0xd656('0x2d')](_0x4329c8)[_0xd656('0xd')](_0xd656('0x34'))[_0xd656('0x10')](_0xd656('0x2f'),_0x22bf4d)[_0xd656('0x10')](_0xd656('0x35')))[_0xd656('0x10')](_0xd656('0x36'),squel[_0xd656('0x23')]()[_0xd656('0x2e')](_0xd656('0x37'),'min_id')['from'](_0x27b4c4)[_0xd656('0x38')](_0x4329c8[_0xd656('0xe')](','))))[_0xd656('0x31')]();}function handleStop(){logger[_0xd656('0x39')](_0xd656('0x3a'));stopped=!![];}function handleUncaughtException(_0x17d720){logger[_0xd656('0x3b')](_0x17d720[_0xd656('0x3c')]);process[_0xd656('0x3d')](0x1);}function handleError(_0x2fb41f,_0x109295){stats['errors'][_0xd656('0x3e')]({'name':_0x109295[_0xd656('0x3f')],'message':_0x109295[_0xd656('0x3c')],'row':_0x2fb41f});}function handleQuery(_0x2e245c){logger['info'](_0x2e245c);return db[_0xd656('0x40')][_0xd656('0x41')](_0x2e245c)['spread'](function(_0x3c2bb2){results[_0xd656('0x3e')](_0x3c2bb2);})['catch'](function(_0x17dcb5){logger['error'](_0x17dcb5[_0xd656('0x3c')]);});}function main(_0x211a05,_0x2ffcca,_0x435ad7,_0x4cf497){logger[_0xd656('0x39')](_0xd656('0x42'),_0x211a05,JSON['stringify'](_0x2ffcca));process[_0xd656('0x43')](_0xd656('0x44'));var _0x4fe00c=_0x2ffcca[_0xd656('0x45')];var _0x5440c2=_0x2ffcca[_0xd656('0x46')];var _0x2ef397=path[_0xd656('0xe')](config[_0xd656('0x47')],_0xd656('0x48'),_0x5440c2+_0xd656('0x49'));var _0x441cfe=_['keys'](_0x4fe00c)[_0xd656('0xe')]();logger[_0xd656('0x39')]('header',_0x441cfe);fs[_0xd656('0x4a')](_0x2ef397,_0x441cfe+'\x0a');Papa['parse'](fs[_0xd656('0x4b')](_0x211a05),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2aa60f,_0x3b4126){try{for(var _0x4ace50=0x0,_0x37238e=[];_0x4ace50<_0x2aa60f[_0xd656('0x4c')]['length'];_0x4ace50++){stats[_0xd656('0x4d')]+=0x1;if(_0x2aa60f[_0xd656('0x4e')][_0x4ace50]){handleError(_0x2aa60f[_0xd656('0x4c')][_0x4ace50],_0x2aa60f['errors'][_0x4ace50]);}else{var _0x3d6181=[];for(var _0x222e94 in _0x4fe00c){if(_0x4fe00c[_0xd656('0x4f')](_0x222e94)){if(_0x2aa60f['data'][_0x4ace50][_0x4fe00c[_0x222e94]]){var _0xdad8da=_[_0xd656('0x50')](_0x2aa60f[_0xd656('0x4c')][_0x4ace50][_0x4fe00c[_0x222e94]]['replace'](/"/g,'\x27'));switch(_0x222e94){case'scheduledat':var _0x419f8c=moment(_0xdad8da,_0xd656('0xb'),!![]);if(_0x419f8c[_0xd656('0x51')]()){_0x37238e[_0xd656('0x3e')]('\x22'+_0xdad8da+'\x22');}else{_0x3d6181['push'](_0xd656('0x52'));}break;case _0xd656('0x20'):var _0x3f9d86=parseInt(_0xdad8da);_0xdad8da=_[_0xd656('0x53')](_0x3f9d86)||_0x3f9d86<0x0||_0x3f9d86>0x4?_0x4cf497?0x3:0x2:_0x3f9d86;_0x37238e[_0xd656('0x3e')]('\x22'+_0xdad8da+'\x22');break;case _0xd656('0x21'):var _0x42426f=parseInt(_0xdad8da);if(_[_0xd656('0x54')](_0x42426f)&&_[_0xd656('0x55')](_0x435ad7,_0x42426f)){_0x37238e['push']('\x22'+_0x42426f+'\x22');}else{_0x3d6181['push'](_0xd656('0x56'));}break;case _0xd656('0x57'):if(isEmail(_0xdad8da)){_0x37238e['push']('\x22'+_0xdad8da+'\x22');}else{_0x3d6181[_0xd656('0x3e')]('email\x20wrong\x20format');}break;case _0xd656('0x58'):var _0x1c2a32=moment(_0xdad8da,_0xd656('0x59'),!![]);if(_0x1c2a32[_0xd656('0x51')]()){_0x37238e[_0xd656('0x3e')]('\x22'+_0xdad8da+'\x22');}else{_0x3d6181[_0xd656('0x3e')](_0xd656('0x5a'));}break;default:_0x37238e[_0xd656('0x3e')]('\x22'+_0xdad8da+'\x22');}}else{switch(_0x222e94){case _0xd656('0x5b'):case _0xd656('0xc'):_0x3d6181[_0xd656('0x3e')](_0x222e94+_0xd656('0x5c'));break;default:_0x37238e['push']('\x22\x22');}}}}if(_0x3d6181['length']){handleError(_0x2aa60f['data'][_0x4ace50],{'code':_0xd656('0x5d'),'message':_0x3d6181[_0xd656('0xe')]()});}else{fs[_0xd656('0x5e')](_0x2ef397,_0x37238e['join']()+'\x0a');}_0x37238e=[];}if(!(stats['rows']%0xc8)){socket[_0xd656('0x5f')]('contact:import:'+_0x5440c2,stats);stats[_0xd656('0x4e')]=[];}}if(stopped){logger[_0xd656('0x39')](_0xd656('0x60'));_0x3b4126[_0xd656('0x61')]();}}catch(_0x28f930){handleError(_0x2aa60f['data'][_0x4ace50],{'code':'SystemError','message':_0x28f930[_0xd656('0x3c')]});logger[_0xd656('0x3b')](_0xd656('0x62'),_0x28f930[_0xd656('0x3c')]);}},'complete':function(){try{var _0x13eda8=[];var _0x1d1532=_0xd656('0x34');if(_0x2ffcca[_0xd656('0x63')]&&_0x2ffcca[_0xd656('0x63')]['length']){_0x1d1532=_0xd656('0x64')+_0x5440c2;_0x13eda8[_0xd656('0x3e')](_0xd656('0x65')+_0x1d1532+'\x20LIKE\x20cm_contacts;');}var _0x286917=util['format'](_0xd656('0x66'),_0x2ef397,_0x1d1532,_0x441cfe,_0x2ffcca[_0xd656('0x1d')],_0x2ffcca[_0xd656('0x33')]||null,NOW,NOW);if(_['isNil'](_0x4fe00c[_0xd656('0x1b')])){_0x286917+=_0xd656('0x67');}_0x13eda8[_0xd656('0x3e')](_0x286917);if(_0x2ffcca[_0xd656('0x63')]&&_0x2ffcca[_0xd656('0x63')][_0xd656('0x68')]){_0x13eda8[_0xd656('0x3e')](insertCmContact(_0x2ffcca[_0xd656('0x1d')],_0x1d1532,_0x2ffcca['duplicates'],_0x4fe00c));_0x13eda8[_0xd656('0x3e')](_0xd656('0x69')+_0x1d1532+';');}_0x13eda8[_0xd656('0x3e')](insertCmHopper(_0x2ffcca[_0xd656('0x1d')],'voice_queues_has_cm_lists',_0xd656('0x6a'),_0xd656('0x6b'),_0x4cf497));_0x13eda8['push'](insertCmHopperBlack(_0x2ffcca['ListId'],_0xd656('0x6c'),_0xd656('0x6a'),_0xd656('0x6b')));_0x13eda8[_0xd656('0x3e')](insertCmHopper(_0x2ffcca['ListId'],_0xd656('0x6d'),_0xd656('0x6e'),_0xd656('0x6f'),_0x4cf497));_0x13eda8['push'](insertCmHopperBlack(_0x2ffcca[_0xd656('0x1d')],_0xd656('0x70'),_0xd656('0x6e'),'CampaignId'));BPromise[_0xd656('0x71')](_0x13eda8,handleQuery)[_0xd656('0x72')](function(_0x4210db){stats[_0xd656('0x73')]=!![];stats[_0xd656('0x74')]=_0x2ffcca[_0xd656('0x63')]&&_0x2ffcca[_0xd656('0x63')]['length']?results[0x2][_0xd656('0x74')]:results[0x0][_0xd656('0x74')];socket['emit']('contact:import:'+_0x5440c2,stats);fs[_0xd656('0x75')](_0x211a05);fs[_0xd656('0x75')](_0x2ef397);process[_0xd656('0x3d')](0x0);})['catch'](function(_0xfbc849){logger[_0xd656('0x3b')](_0xfbc849[_0xd656('0x3c')]);process[_0xd656('0x3d')](0x1);});}catch(_0x2b8153){logger[_0xd656('0x3b')](_0xd656('0x76'),_0x2b8153[_0xd656('0x3c')]);process[_0xd656('0x3d')](0x1);}},'error':function(_0x5b470f,_0x16c28d,_0x4b996a,_0xd163e3){throw new Error(_0xd163e3);}});}function validate(){if(process[_0xd656('0x77')]&&process[_0xd656('0x77')][_0xd656('0x68')]<0x4){throw new Error(_0xd656('0x78'));}var _0x5390b2=path[_0xd656('0xe')](config[_0xd656('0x47')],_0xd656('0x48'),process[_0xd656('0x77')][0x2]);if(!fs['existsSync'](_0x5390b2)){throw new Error(_0xd656('0x79'));}var _0x18fb85={};try{_0x18fb85=JSON[_0xd656('0x7a')](process[_0xd656('0x77')][0x3]);if(!_0x18fb85['binding']){throw new Error(_0xd656('0x7b'));}if(!_0x18fb85[_0xd656('0x45')][_0xd656('0xc')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x18fb85[_0xd656('0x45')][_0xd656('0x5b')]){throw new Error(_0xd656('0x7c'));}var _0x46a685=0x0;if(_0x18fb85[_0xd656('0x45')][_0xd656('0x21')]){_0x46a685=0x1;}if(!_0x18fb85[_0xd656('0x1d')]){throw new Error(_0xd656('0x7d'));}}catch(_0xa3440){throw new Error(_0xd656('0x7e'));}var _0x1ba49f=[];try{_0x1ba49f=_[_0xd656('0x7f')](JSON['parse'](process[_0xd656('0x77')][0x4]),'id');}catch(_0x2dffdb){logger[_0xd656('0x39')](_0xd656('0x80'));}main(_0x5390b2,_0x18fb85,_0x1ba49f,_0x46a685);}validate();process['on'](_0xd656('0x81'),handleStop);process['on'](_0xd656('0x82'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 6c3df1e..5b4efa5 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc9d=['Member\x20Name','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','inbound','push','variable','queue','outbound','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number'];(function(_0x1433d6,_0xe5121b){var _0x1ff605=function(_0x23adcc){while(--_0x23adcc){_0x1433d6['push'](_0x1433d6['shift']());}};_0x1ff605(++_0xe5121b);}(_0xbc9d,0xb4));var _0xdbc9=function(_0xb2a4d1,_0x328b4e){_0xb2a4d1=_0xb2a4d1-0x0;var _0x13a6d0=_0xbc9d[_0xb2a4d1];return _0x13a6d0;};'use strict';exports[_0xdbc9('0x0')]=function(_0xbca678,_0x8aa82b){var _0x434f6e=[{'type':_0xdbc9('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0xbca678['toLowerCase']()){case'voice':switch(_0x8aa82b[_0xdbc9('0x2')]()){case _0xdbc9('0x3'):_0x434f6e[_0xdbc9('0x4')]({'type':_0xdbc9('0x5'),'content':'','variableName':_0xdbc9('0x6')});_0x434f6e[_0xdbc9('0x4')]({'type':_0xdbc9('0x5'),'content':'','variableName':'calleridnum'});break;case _0xdbc9('0x7'):_0x434f6e[_0xdbc9('0x4')]({'type':_0xdbc9('0x1'),'content':'Outbound\x20Call','variableName':null});_0x434f6e[_0xdbc9('0x4')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x434f6e;};exports[_0xdbc9('0x8')]=function(_0xe9bbde,_0x19be1d){var _0x2f5e6d=[];switch(_0xe9bbde['toLowerCase']()){case _0xdbc9('0x9'):switch(_0x19be1d[_0xdbc9('0x2')]()){case _0xdbc9('0x3'):_0x2f5e6d=[{'type':_0xdbc9('0x1'),'content':_0xdbc9('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0xdbc9('0xb'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0xdbc9('0xc')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0xd'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0xe')},{'type':'keyValue','content':'','key':_0xdbc9('0xf'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x10')},{'type':'keyValue','content':'','key':_0xdbc9('0x11'),'keyType':_0xdbc9('0x5'),'variableName':'queue'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x12'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x13')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x14'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x15')},{'type':_0xdbc9('0x1'),'content':_0xdbc9('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xdbc9('0x17'),'keyType':'variable','variableName':_0xdbc9('0x18')},{'type':_0xdbc9('0xb'),'content':'','key':'Agent\x20Number','keyType':_0xdbc9('0x5'),'variableName':'destcalleridnum'},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xdbc9('0x19'),'keyType':_0xdbc9('0x5'),'variableName':'agentcalledAt'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x1a'),'keyType':'variable','variableName':_0xdbc9('0x1b')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x1c'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x1d')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x1e'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x1f')},{'type':'keyValue','content':'','key':_0xdbc9('0x20'),'keyType':_0xdbc9('0x5'),'variableName':_0xdbc9('0x21')}];break;case _0xdbc9('0x7'):_0x2f5e6d=[{'type':_0xdbc9('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x22'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x23'),'keyType':_0xdbc9('0x5'),'keyContent':'','variableName':'membername'},{'type':_0xdbc9('0xb'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0xdbc9('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0xdbc9('0x5'),'keyContent':'','variableName':_0xdbc9('0x24')},{'type':_0xdbc9('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x25'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x26'),'keyType':_0xdbc9('0x5'),'keyContent':'','variableName':_0xdbc9('0x27')},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x28'),'keyType':_0xdbc9('0x5'),'keyContent':'','variableName':'duration'},{'type':_0xdbc9('0xb'),'content':'','key':_0xdbc9('0x29'),'keyType':_0xdbc9('0x5'),'keyContent':'','variableName':_0xdbc9('0x2a')}];break;}}return _0x2f5e6d;}; \ No newline at end of file +var _0x7916=['destexten','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','agentcalledAt','Agent\x20Connect','agentconnectAt','talktime','outbound','membername','Date','starttime','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','push','queue','calleridnum','variable','getDescriptions','inbound','string','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To'];(function(_0x478cc4,_0x3f0784){var _0xedf5d7=function(_0x43703b){while(--_0x43703b){_0x478cc4['push'](_0x478cc4['shift']());}};_0xedf5d7(++_0x3f0784);}(_0x7916,0x128));var _0x6791=function(_0x4cda62,_0x33291d){_0x4cda62=_0x4cda62-0x0;var _0x5baa2a=_0x7916[_0x4cda62];return _0x5baa2a;};'use strict';exports[_0x6791('0x0')]=function(_0x5eaf3a,_0xeb0b9f){var _0xdaaf2b=[{'type':'string','content':_0x6791('0x1'),'variableName':null}];switch(_0x5eaf3a[_0x6791('0x2')]()){case _0x6791('0x3'):switch(_0xeb0b9f[_0x6791('0x2')]()){case'inbound':_0xdaaf2b[_0x6791('0x4')]({'type':'variable','content':'','variableName':_0x6791('0x5')});_0xdaaf2b[_0x6791('0x4')]({'type':'variable','content':'','variableName':_0x6791('0x6')});break;case'outbound':_0xdaaf2b[_0x6791('0x4')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0xdaaf2b[_0x6791('0x4')]({'type':_0x6791('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0xdaaf2b;};exports[_0x6791('0x8')]=function(_0x2769a4,_0x2aeae9){var _0x495d9c=[];switch(_0x2769a4[_0x6791('0x2')]()){case _0x6791('0x3'):switch(_0x2aeae9[_0x6791('0x2')]()){case _0x6791('0x9'):_0x495d9c=[{'type':_0x6791('0xa'),'content':_0x6791('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x6791('0xc'),'content':'','key':_0x6791('0xd'),'keyType':_0x6791('0x7'),'variableName':_0x6791('0x6')},{'type':_0x6791('0xc'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x6791('0xe')},{'type':'keyValue','content':'','key':_0x6791('0xf'),'keyType':'variable','variableName':_0x6791('0x10')},{'type':_0x6791('0xc'),'content':'','key':'Queue','keyType':_0x6791('0x7'),'variableName':'queue'},{'type':_0x6791('0xc'),'content':'','key':_0x6791('0x11'),'keyType':'variable','variableName':_0x6791('0x12')},{'type':_0x6791('0xc'),'content':'','key':'Date','keyType':_0x6791('0x7'),'variableName':'agentcalledAt'},{'type':_0x6791('0xa'),'content':_0x6791('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x6791('0xc'),'content':'','key':_0x6791('0x14'),'keyType':_0x6791('0x7'),'variableName':_0x6791('0x15')},{'type':_0x6791('0xc'),'content':'','key':'Agent\x20Number','keyType':_0x6791('0x7'),'variableName':_0x6791('0x16')},{'type':'string','content':_0x6791('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x6791('0xc'),'content':'','key':'Agent\x20Ring','keyType':_0x6791('0x7'),'variableName':_0x6791('0x18')},{'type':_0x6791('0xc'),'content':'','key':_0x6791('0x19'),'keyType':'variable','variableName':_0x6791('0x1a')},{'type':_0x6791('0xc'),'content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x6791('0xc'),'content':'','key':'Hold\x20Time','keyType':_0x6791('0x7'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x6791('0x7'),'variableName':_0x6791('0x1b')}];break;case _0x6791('0x1c'):_0x495d9c=[{'type':'string','content':_0x6791('0xb'),'variableName':null},{'type':_0x6791('0xc'),'content':'','key':'Called\x20Number','keyType':_0x6791('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x6791('0xc'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x6791('0x1d')},{'type':'keyValue','content':'','key':_0x6791('0x11'),'keyType':_0x6791('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x6791('0xc'),'content':'','key':_0x6791('0x1e'),'keyType':_0x6791('0x7'),'keyContent':'','variableName':_0x6791('0x1f')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x6791('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x6791('0x7'),'keyContent':'','variableName':_0x6791('0x20')},{'type':_0x6791('0xc'),'content':'','key':_0x6791('0x21'),'keyType':_0x6791('0x7'),'keyContent':'','variableName':_0x6791('0x22')},{'type':_0x6791('0xc'),'content':'','key':_0x6791('0x23'),'keyType':_0x6791('0x7'),'keyContent':'','variableName':_0x6791('0x24')},{'type':'keyValue','content':'','key':_0x6791('0x25'),'keyType':_0x6791('0x7'),'keyContent':'','variableName':_0x6791('0x26')}];break;}}return _0x495d9c;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 7f3ba22..f63cb0d 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fac=['omit','body','html','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','tracked','query','clone'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x2fac,0x1a5));var _0xc2fa=function(_0x2ede02,_0x4b2e19){_0x2ede02=_0x2ede02-0x0;var _0x4df0f3=_0x2fac[_0x2ede02];return _0x4df0f3;};'use strict';var _=require(_0xc2fa('0x0'));var db=require(_0xc2fa('0x1'))['db'];var loggers={'openchannel':require(_0xc2fa('0x2'))(_0xc2fa('0x3')),'mail':require(_0xc2fa('0x2'))(_0xc2fa('0x4')),'fax':require(_0xc2fa('0x2'))(_0xc2fa('0x5')),'sms':require(_0xc2fa('0x2'))(_0xc2fa('0x6')),'chat':require(_0xc2fa('0x2'))(_0xc2fa('0x7')),'whatsapp':require(_0xc2fa('0x2'))(_0xc2fa('0x8'))};function getInteractionId(_0x2fa51e,_0xbefcb5,_0x110a2e){if(_0x2fa51e&&_0x2fa51e[_['upperFirst'](_0x110a2e)+_0xc2fa('0x9')]){return _0x2fa51e[_[_0xc2fa('0xa')](_0x110a2e)+_0xc2fa('0x9')];}else if(_0x2fa51e&&_0x2fa51e['id']){return _0x2fa51e['id'];}else if(_0xbefcb5&&_0xbefcb5['id']){return _0xbefcb5['id'];}else{return _0xc2fa('0xb');}}function log(_0x23040e,_0x29106e,_0x10154b,_0x172b15,_0x17d7ca,_0x334784){loggers[_0x17d7ca['toLowerCase']()][_0x23040e](_0xc2fa('0xc'),_0x334784[_0xc2fa('0xd')](),_0x29106e?_0x29106e['id']:null,_0x29106e?_0x29106e[_0xc2fa('0xe')]:null,_0x29106e?_0x29106e[_0xc2fa('0xf')]:null,getInteractionId(_0x10154b,_0x172b15,_0x17d7ca),_0x10154b?JSON[_0xc2fa('0x10')](_0x10154b):_0xc2fa('0x11'));}function updateUser(_0x1a588d,_0x24d11d,_0x53a186,_0xe6dbb2,_0x4292ff){db[_[_0xc2fa('0xa')](_0xe6dbb2)+_0xc2fa('0x12')][_0xc2fa('0x13')]({'where':{'id':getInteractionId(_0x24d11d,_0x53a186,_0xe6dbb2)}})[_0xc2fa('0x14')](function(_0x4739a6){if(_0x4739a6){return _0x4739a6[_0xc2fa('0x15')]({'UserId':_0x1a588d?_0x1a588d['id']:null});}})[_0xc2fa('0x14')](function(_0x21e856){if(_0x21e856){log(_0xc2fa('0x16'),_0x1a588d,_0x24d11d,_0x53a186,_0xe6dbb2,_0x4292ff);}})[_0xc2fa('0x17')](function(){log('error',_0x1a588d,_0x24d11d,_0x53a186,_0xe6dbb2,_0x4292ff);});}exports[_0xc2fa('0x18')]=function(_0x1b2324,_0x19e243){return function(_0x30dec1,_0x209e02,_0xe2f092){var _0x5ef914=_0x30dec1['user'];var _0x41ade2={};var _0x37317c=_0x30dec1[_0xc2fa('0x19')];if(_0x41ade2){_0x41ade2=_[_0xc2fa('0x1a')](_0x30dec1['body']);_0x41ade2=_[_0xc2fa('0x1b')](_0x41ade2,[_0xc2fa('0x1c'),_0xc2fa('0x1d'),'phone',_0xc2fa('0x1e'),_0xc2fa('0x1f')]);}updateUser(_0x5ef914,_0x41ade2,_0x37317c,_0x1b2324,_0x19e243);_0xe2f092(null);};}; \ No newline at end of file +var _0xbc9d=['catch','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction','findOne','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbc9d,0xcc));var _0xdbc9=function(_0x2295d8,_0x119853){_0x2295d8=_0x2295d8-0x0;var _0x5aa2f7=_0xbc9d[_0x2295d8];return _0x5aa2f7;};'use strict';var _=require(_0xdbc9('0x0'));var db=require(_0xdbc9('0x1'))['db'];var loggers={'openchannel':require(_0xdbc9('0x2'))(_0xdbc9('0x3')),'mail':require('../../config/logger')(_0xdbc9('0x4')),'fax':require(_0xdbc9('0x2'))(_0xdbc9('0x5')),'sms':require(_0xdbc9('0x2'))(_0xdbc9('0x6')),'chat':require('../../config/logger')(_0xdbc9('0x7')),'whatsapp':require('../../config/logger')(_0xdbc9('0x8'))};function getInteractionId(_0x415dd8,_0x43ca9d,_0x515ac6){if(_0x415dd8&&_0x415dd8[_[_0xdbc9('0x9')](_0x515ac6)+_0xdbc9('0xa')]){return _0x415dd8[_[_0xdbc9('0x9')](_0x515ac6)+'InteractionId'];}else if(_0x415dd8&&_0x415dd8['id']){return _0x415dd8['id'];}else if(_0x43ca9d&&_0x43ca9d['id']){return _0x43ca9d['id'];}else{return _0xdbc9('0xb');}}function log(_0x1cd495,_0x5a3e67,_0x2d74d5,_0x55f0d2,_0x226c54,_0x4cefe8){loggers[_0x226c54[_0xdbc9('0xc')]()][_0x1cd495](_0xdbc9('0xd'),_0x4cefe8['toUpperCase'](),_0x5a3e67?_0x5a3e67['id']:null,_0x5a3e67?_0x5a3e67[_0xdbc9('0xe')]:null,_0x5a3e67?_0x5a3e67[_0xdbc9('0xf')]:null,getInteractionId(_0x2d74d5,_0x55f0d2,_0x226c54),_0x2d74d5?JSON['stringify'](_0x2d74d5):_0xdbc9('0x10'));}function updateUser(_0x42bd01,_0x4d68f1,_0x3cb1c3,_0x3050e9,_0x74b328){db[_['upperFirst'](_0x3050e9)+_0xdbc9('0x11')][_0xdbc9('0x12')]({'where':{'id':getInteractionId(_0x4d68f1,_0x3cb1c3,_0x3050e9)}})['then'](function(_0x469631){if(_0x469631){return _0x469631[_0xdbc9('0x13')]({'UserId':_0x42bd01?_0x42bd01['id']:null});}})['then'](function(_0x48b833){if(_0x48b833){log('info',_0x42bd01,_0x4d68f1,_0x3cb1c3,_0x3050e9,_0x74b328);}})[_0xdbc9('0x14')](function(){log(_0xdbc9('0x15'),_0x42bd01,_0x4d68f1,_0x3cb1c3,_0x3050e9,_0x74b328);});}exports[_0xdbc9('0x16')]=function(_0x29d83a,_0x2423e2){return function(_0x4f8316,_0x165831,_0x1dc29c){var _0x193e48=_0x4f8316[_0xdbc9('0x17')];var _0x4a6c54={};var _0x2e4368=_0x4f8316[_0xdbc9('0x18')];if(_0x4a6c54){_0x4a6c54=_[_0xdbc9('0x19')](_0x4f8316[_0xdbc9('0x1a')]);_0x4a6c54=_[_0xdbc9('0x1b')](_0x4a6c54,[_0xdbc9('0x1a'),_0xdbc9('0x1c'),_0xdbc9('0x1d'),_0xdbc9('0x1e'),_0xdbc9('0x1f')]);}updateUser(_0x193e48,_0x4a6c54,_0x2e4368,_0x29d83a,_0x2423e2);_0x1dc29c(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 210cbad..a7e06e4 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cbd=['../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb'];(function(_0x1d46c4,_0x181681){var _0x384a66=function(_0x1a5ef4){while(--_0x1a5ef4){_0x1d46c4['push'](_0x1d46c4['shift']());}};_0x384a66(++_0x181681);}(_0x9cbd,0xab));var _0xd9cb=function(_0x510e24,_0x21d802){_0x510e24=_0x510e24-0x0;var _0x20b844=_0x9cbd[_0x510e24];return _0x20b844;};'use strict';var crypto=require(_0xd9cb('0x0'));var util=require(_0xd9cb('0x1'));var compose=require(_0xd9cb('0x2'));var db=require(_0xd9cb('0x3'))['db'];var config=require(_0xd9cb('0x4'));function getValueFromLicense(_0x2cd689,_0x51223c){if(_0x2cd689&&_0x51223c){if(_0x51223c[_0xd9cb('0x5')]&&_0x51223c[_0xd9cb('0x6')]){var _0x9ddaf7=_0x51223c[_0xd9cb('0x5')];var _0x1a10d7=_0x51223c[_0xd9cb('0x6')];var _0x35b51e=_0x9ddaf7['split']('-')[0x4];var _0x745008=_0x9ddaf7[_0xd9cb('0x7')]('-')[0x0];var _0x199b26=crypto[_0xd9cb('0x8')](_0xd9cb('0x9'),util[_0xd9cb('0xa')]('%s:%s:%s',_0x35b51e,_0x9ddaf7,_0x745008));var _0x1c0bf9=_0x199b26[_0xd9cb('0xb')](_0x1a10d7,_0xd9cb('0xc'),_0xd9cb('0xd'));_0x1c0bf9+=_0x199b26[_0xd9cb('0xe')](_0xd9cb('0xd'));var _0xc3f779=JSON[_0xd9cb('0xf')](_0x1c0bf9);return _0xc3f779['hasOwnProperty'](_0x2cd689)?_0xc3f779[_0x2cd689]:null;}}return null;}function isLimit(_0x4b1fd3,_0x39d3f5,_0x5625d7,_0x59a9f2){var _0x47b8c4=_0x39d3f5;return compose()['use'](function(_0x45d4aa,_0x3d9bd8,_0x2cb2ef){return db['License'][_0xd9cb('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xd9cb('0x11')](function(_0x49aa0e){var _0x4b233d=getValueFromLicense(_0x4b1fd3,_0x49aa0e);return _0x4b233d?_0x4b233d:_0x47b8c4;})['then'](function(_0x2881b7){_0x47b8c4=_0x2881b7;return _0x5625d7[_0xd9cb('0x12')](_0x59a9f2);})[_0xd9cb('0x11')](function(_0x47727e){if(_0x47727e>=_0x47b8c4){return _0x3d9bd8[_0xd9cb('0x13')](0x193)[_0xd9cb('0x14')]({'message':util['format'](_0xd9cb('0x15'),_0x4b1fd3)});}_0x2cb2ef();})['catch'](function(_0x3d6a4c){_0x2cb2ef(_0x3d6a4c);});});}function isUserLimit(){return isLimit(_0xd9cb('0x16'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xd9cb('0x17')}]}});}exports[_0xd9cb('0x18')]=isUserLimit; \ No newline at end of file +var _0x67c4=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','hasOwnProperty','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split'];(function(_0x5c0f39,_0x428cb8){var _0x516fa8=function(_0x419f82){while(--_0x419f82){_0x5c0f39['push'](_0x5c0f39['shift']());}};_0x516fa8(++_0x428cb8);}(_0x67c4,0x7a));var _0x467c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x67c4[_0x11005e];return _0x29338f;};'use strict';var crypto=require(_0x467c('0x0'));var util=require(_0x467c('0x1'));var compose=require(_0x467c('0x2'));var db=require(_0x467c('0x3'))['db'];var config=require(_0x467c('0x4'));function getValueFromLicense(_0x31697d,_0x3135d7){if(_0x31697d&&_0x3135d7){if(_0x3135d7[_0x467c('0x5')]&&_0x3135d7['license']){var _0x1bf48b=_0x3135d7['data1'];var _0x1de111=_0x3135d7[_0x467c('0x6')];var _0x1d0273=_0x1bf48b[_0x467c('0x7')]('-')[0x4];var _0x4a3f43=_0x1bf48b['split']('-')[0x0];var _0x5899df=crypto[_0x467c('0x8')](_0x467c('0x9'),util[_0x467c('0xa')](_0x467c('0xb'),_0x1d0273,_0x1bf48b,_0x4a3f43));var _0x5793ec=_0x5899df[_0x467c('0xc')](_0x1de111,'base64',_0x467c('0xd'));_0x5793ec+=_0x5899df[_0x467c('0xe')](_0x467c('0xd'));var _0x31350c=JSON['parse'](_0x5793ec);return _0x31350c[_0x467c('0xf')](_0x31697d)?_0x31350c[_0x31697d]:null;}}return null;}function isLimit(_0x4a3f0b,_0x5f0b82,_0x246e45,_0x4bad9a){var _0x51d89a=_0x5f0b82;return compose()['use'](function(_0x2be29f,_0x305878,_0x507c2c){return db['License'][_0x467c('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x467c('0x11')](function(_0x49812b){var _0x2e3141=getValueFromLicense(_0x4a3f0b,_0x49812b);return _0x2e3141?_0x2e3141:_0x51d89a;})[_0x467c('0x11')](function(_0x580b36){_0x51d89a=_0x580b36;return _0x246e45[_0x467c('0x12')](_0x4bad9a);})[_0x467c('0x11')](function(_0x436376){if(_0x436376>=_0x51d89a){return _0x305878[_0x467c('0x13')](0x193)[_0x467c('0x14')]({'message':util['format'](_0x467c('0x15'),_0x4a3f0b)});}_0x507c2c();})[_0x467c('0x16')](function(_0x1eac12){_0x507c2c(_0x1eac12);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x467c('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x467c('0x18')}]}});}exports[_0x467c('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 27531ea..6f45c3e 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 _0xe0e6=['shift','match','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','DATE','utcOffset','add','minutes','seconds','format','lodash','moment','parseSearch','[$or]','and','replace','[$and]','split','slice','forEach'];(function(_0x26aa76,_0x3bbf3a){var _0x1c6cbb=function(_0x2af0a7){while(--_0x2af0a7){_0x26aa76['push'](_0x26aa76['shift']());}};_0x1c6cbb(++_0x3bbf3a);}(_0xe0e6,0x1ae));var _0x6e0e=function(_0x3fa4bd,_0x14a72d){_0x3fa4bd=_0x3fa4bd-0x0;var _0x358c95=_0xe0e6[_0x3fa4bd];return _0x358c95;};'use strict';var _=require(_0x6e0e('0x0'));var moment=require(_0x6e0e('0x1'));exports[_0x6e0e('0x2')]=function(_0x138cfc){var _0x1ddae1={'conditions':[]};_0x1ddae1['sqlOperator']=_['startsWith'](_0x138cfc,_0x6e0e('0x3'))?'or':_0x6e0e('0x4');var _0x62c4f6=_0x138cfc[_0x6e0e('0x5')](_0x6e0e('0x6'),'')[_0x6e0e('0x5')]('[$or]','')['split']('||');for(var _0x27029c=0x0;_0x27029c<_0x62c4f6['length'];_0x27029c++){var _0x18eda5=_0x62c4f6[_0x27029c][_0x6e0e('0x7')](':=');var _0x437dd0=_0x18eda5[0x0];var _0x4d9adf=_0x18eda5[_0x6e0e('0x8')](0x1);_0x4d9adf[_0x6e0e('0x9')](function(_0x1f4f52){var _0x48dbc2=_0x1f4f52[_0x6e0e('0x7')]('[')[_0x6e0e('0xa')]();var _0x4d986f=_0x1f4f52[_0x6e0e('0xb')](/\[(.*?)\]/g);_0x4d986f[_0x6e0e('0x9')](function(_0x2430c4){var _0x388e00=_0x2430c4[_0x6e0e('0x7')]('[')[_0x6e0e('0xc')](function(_0x3b56fb){return _0x3b56fb[_0x6e0e('0xd')](']')>-0x1;})[_0x6e0e('0xe')](function(_0xe5414c){return _0xe5414c[_0x6e0e('0x7')](']')[0x0];})[0x0];_0x1ddae1[_0x6e0e('0xf')][_0x6e0e('0x10')]({'field':_0x437dd0,'operator':_0x48dbc2,'value':_0x388e00});});});}return _0x1ddae1;};exports[_0x6e0e('0x11')]=function(_0x526818,_0x470885,_0x476d4d){var _0x3d0126={};if(_0x470885==='DATE'){if(_0x476d4d[_0x6e0e('0x12')]===_0x6e0e('0x13')){_0x476d4d['operator']=_0x6e0e('0x14');_0x476d4d[_0x6e0e('0x15')]+=','+_0x476d4d[_0x6e0e('0x15')];}else if(_['includes'](['$gt','$lte'],_0x476d4d['operator'])){_0x476d4d[_0x6e0e('0x15')]=moment(_0x476d4d[_0x6e0e('0x15')])['add'](0x1,_0x6e0e('0x16'))['format'](_0x6e0e('0x17'));}}if(_0x476d4d['castTo']){_0x470885=_0x476d4d[_0x6e0e('0x18')];_0x3d0126[_0x6e0e('0x19')]=_0x6e0e('0x1a')+_0x526818+'.'+_0x476d4d[_0x6e0e('0x1b')]+_0x6e0e('0x1c')+_0x476d4d[_0x6e0e('0x18')]+')\x20'+parseOperator(_0x476d4d['operator']);}else{_0x3d0126[_0x6e0e('0x19')]=_0x526818+'.'+_0x476d4d[_0x6e0e('0x1b')]+'\x20'+parseOperator(_0x476d4d['operator']);}if(_[_0x6e0e('0x1d')]([_0x6e0e('0x1e'),'$notIn'],_0x476d4d[_0x6e0e('0x12')]))_0x3d0126[_0x6e0e('0x19')]='('+_0x3d0126['text']+'\x20OR\x20'+_0x526818+'.'+_0x476d4d[_0x6e0e('0x1b')]+_0x6e0e('0x1f');_0x3d0126['value']=parseValue(_0x470885,_0x476d4d[_0x6e0e('0x12')],_0x476d4d[_0x6e0e('0x15')]);return _0x3d0126;};function parseOperator(_0x383904){var _0x42b327;switch(_0x383904){case _0x6e0e('0x20'):_0x42b327=_0x6e0e('0x21');break;case _0x6e0e('0x22'):_0x42b327=_0x6e0e('0x23');break;case _0x6e0e('0x13'):_0x42b327='=\x20?';break;case _0x6e0e('0x1e'):_0x42b327=_0x6e0e('0x24');break;case'$substring':case _0x6e0e('0x25'):case'$endsWith':_0x42b327=_0x6e0e('0x26');break;case _0x6e0e('0x27'):_0x42b327=_0x6e0e('0x28');break;case _0x6e0e('0x29'):_0x42b327=_0x6e0e('0x2a');break;case'$lte':_0x42b327=_0x6e0e('0x2b');break;case _0x6e0e('0x2c'):_0x42b327=_0x6e0e('0x2d');break;case _0x6e0e('0x14'):_0x42b327=_0x6e0e('0x2e');break;}return _0x42b327;}function parseValue(_0x4b618a,_0x4c0617,_0x47986e){var _0x46ff9e={'start':undefined,'end':undefined};switch(_0x4c0617){case _0x6e0e('0x20'):case _0x6e0e('0x22'):_0x46ff9e[_0x6e0e('0x2f')]=_0x47986e[_0x6e0e('0x7')](',');break;case _0x6e0e('0x30'):_0x46ff9e[_0x6e0e('0x2f')]='%'+_0x47986e+'%';break;case _0x6e0e('0x25'):_0x46ff9e['start']=_0x47986e+'%';break;case'$endsWith':_0x46ff9e['start']='%'+_0x47986e;break;case'$between':var _0x216790=_0x47986e[_0x6e0e('0x7')](',');var _0x47986e=_0x216790[_0x6e0e('0xa')]();var _0xa3b557=_0x216790['pop']();if(_0x4b618a===_0x6e0e('0x31')){_0x47986e=moment(_0x47986e)[_0x6e0e('0x32')](0x0,!![])['format']();_0xa3b557=moment(_0xa3b557)['utcOffset'](0x0,!![])[_0x6e0e('0x33')](0x17,'hours')['add'](0x3b,_0x6e0e('0x34'))['add'](0x3b,_0x6e0e('0x35'))[_0x6e0e('0x36')]();}_0x46ff9e={'start':_0x47986e,'end':_0xa3b557};break;default:_0x46ff9e[_0x6e0e('0x2f')]=_0x47986e;break;}return _0x46ff9e;} \ No newline at end of file +var _0xc9e7=['split','slice','shift','forEach','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','text','includes','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','hours','minutes','seconds','moment','sqlOperator','startsWith','[$or]','and','length'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0xc9e7,0xda));var _0x7c9e=function(_0xe7acb9,_0x479726){_0xe7acb9=_0xe7acb9-0x0;var _0x364bb6=_0xc9e7[_0xe7acb9];return _0x364bb6;};'use strict';var _=require('lodash');var moment=require(_0x7c9e('0x0'));exports['parseSearch']=function(_0x138ede){var _0x1b6099={'conditions':[]};_0x1b6099[_0x7c9e('0x1')]=_[_0x7c9e('0x2')](_0x138ede,_0x7c9e('0x3'))?'or':_0x7c9e('0x4');var _0x9b83ac=_0x138ede['replace']('[$and]','')['replace'](_0x7c9e('0x3'),'')['split']('||');for(var _0x4fbcd8=0x0;_0x4fbcd8<_0x9b83ac[_0x7c9e('0x5')];_0x4fbcd8++){var _0x16c5bb=_0x9b83ac[_0x4fbcd8][_0x7c9e('0x6')](':=');var _0x326129=_0x16c5bb[0x0];var _0x1da8e9=_0x16c5bb[_0x7c9e('0x7')](0x1);_0x1da8e9['forEach'](function(_0x399b85){var _0x5185ca=_0x399b85['split']('[')[_0x7c9e('0x8')]();var _0x54bf55=_0x399b85['match'](/\[(.*?)\]/g);_0x54bf55[_0x7c9e('0x9')](function(_0xcea85b){var _0x4202e4=_0xcea85b[_0x7c9e('0x6')]('[')[_0x7c9e('0xa')](function(_0x144398){return _0x144398[_0x7c9e('0xb')](']')>-0x1;})[_0x7c9e('0xc')](function(_0x212313){return _0x212313[_0x7c9e('0x6')](']')[0x0];})[0x0];_0x1b6099[_0x7c9e('0xd')][_0x7c9e('0xe')]({'field':_0x326129,'operator':_0x5185ca,'value':_0x4202e4});});});}return _0x1b6099;};exports[_0x7c9e('0xf')]=function(_0x4d891e,_0x2def5d,_0xde8a1a){var _0x4e462f={};if(_0x2def5d==='DATE'){if(_0xde8a1a[_0x7c9e('0x10')]===_0x7c9e('0x11')){_0xde8a1a[_0x7c9e('0x10')]=_0x7c9e('0x12');_0xde8a1a[_0x7c9e('0x13')]+=','+_0xde8a1a[_0x7c9e('0x13')];}else if(_['includes']([_0x7c9e('0x14'),_0x7c9e('0x15')],_0xde8a1a[_0x7c9e('0x10')])){_0xde8a1a[_0x7c9e('0x13')]=moment(_0xde8a1a['value'])[_0x7c9e('0x16')](0x1,_0x7c9e('0x17'))[_0x7c9e('0x18')](_0x7c9e('0x19'));}}if(_0xde8a1a[_0x7c9e('0x1a')]){_0x2def5d=_0xde8a1a['castTo'];_0x4e462f['text']='CAST('+_0x4d891e+'.'+_0xde8a1a[_0x7c9e('0x1b')]+_0x7c9e('0x1c')+_0xde8a1a[_0x7c9e('0x1a')]+')\x20'+parseOperator(_0xde8a1a[_0x7c9e('0x10')]);}else{_0x4e462f[_0x7c9e('0x1d')]=_0x4d891e+'.'+_0xde8a1a[_0x7c9e('0x1b')]+'\x20'+parseOperator(_0xde8a1a[_0x7c9e('0x10')]);}if(_[_0x7c9e('0x1e')](['$ne',_0x7c9e('0x1f')],_0xde8a1a['operator']))_0x4e462f[_0x7c9e('0x1d')]='('+_0x4e462f['text']+_0x7c9e('0x20')+_0x4d891e+'.'+_0xde8a1a['field']+_0x7c9e('0x21');_0x4e462f[_0x7c9e('0x13')]=parseValue(_0x2def5d,_0xde8a1a[_0x7c9e('0x10')],_0xde8a1a[_0x7c9e('0x13')]);return _0x4e462f;};function parseOperator(_0x34ddd9){var _0x5aa8cf;switch(_0x34ddd9){case _0x7c9e('0x22'):_0x5aa8cf=_0x7c9e('0x23');break;case _0x7c9e('0x1f'):_0x5aa8cf=_0x7c9e('0x24');break;case _0x7c9e('0x11'):_0x5aa8cf=_0x7c9e('0x25');break;case _0x7c9e('0x26'):_0x5aa8cf=_0x7c9e('0x27');break;case _0x7c9e('0x28'):case _0x7c9e('0x29'):case _0x7c9e('0x2a'):_0x5aa8cf=_0x7c9e('0x2b');break;case _0x7c9e('0x2c'):_0x5aa8cf=_0x7c9e('0x2d');break;case _0x7c9e('0x14'):_0x5aa8cf=_0x7c9e('0x2e');break;case'$lte':_0x5aa8cf=_0x7c9e('0x2f');break;case'$gte':_0x5aa8cf='>=\x20?';break;case _0x7c9e('0x12'):_0x5aa8cf=_0x7c9e('0x30');break;}return _0x5aa8cf;}function parseValue(_0x30a32a,_0x341e93,_0x4c36fe){var _0x881afc={'start':undefined,'end':undefined};switch(_0x341e93){case _0x7c9e('0x22'):case _0x7c9e('0x1f'):_0x881afc[_0x7c9e('0x31')]=_0x4c36fe[_0x7c9e('0x6')](',');break;case'$substring':_0x881afc[_0x7c9e('0x31')]='%'+_0x4c36fe+'%';break;case'$startsWith':_0x881afc[_0x7c9e('0x31')]=_0x4c36fe+'%';break;case _0x7c9e('0x2a'):_0x881afc[_0x7c9e('0x31')]='%'+_0x4c36fe;break;case'$between':var _0x6314e1=_0x4c36fe['split'](',');var _0x4c36fe=_0x6314e1[_0x7c9e('0x8')]();var _0x4345ef=_0x6314e1[_0x7c9e('0x32')]();if(_0x30a32a===_0x7c9e('0x33')){_0x4c36fe=moment(_0x4c36fe)[_0x7c9e('0x34')](0x0,!![])[_0x7c9e('0x18')]();_0x4345ef=moment(_0x4345ef)['utcOffset'](0x0,!![])[_0x7c9e('0x16')](0x17,_0x7c9e('0x35'))[_0x7c9e('0x16')](0x3b,_0x7c9e('0x36'))[_0x7c9e('0x16')](0x3b,_0x7c9e('0x37'))[_0x7c9e('0x18')]();}_0x881afc={'start':_0x4c36fe,'end':_0x4345ef};break;default:_0x881afc['start']=_0x4c36fe;break;}return _0x881afc;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 647ab48..0e15666 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 _0xdca2=['filters','isEmpty','forOwn','type','parse','$gte','YYYY-MM-DD','format','$lte','isArray','limit','cast','col','priority','unsigned','substr','DESC','omit','isObject','isString','length','unset','isNumeric','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','lodash','moment','split'];(function(_0x9c1e57,_0x59bad0){var _0x1adf13=function(_0x48a9f6){while(--_0x48a9f6){_0x9c1e57['push'](_0x9c1e57['shift']());}};_0x1adf13(++_0x59bad0);}(_0xdca2,0xfd));var _0x2dca=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdca2[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x2dca('0x0'));var sequelize=require('sequelize');var moment=require(_0x2dca('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x31bc29){var _0x4eccf7=null;if(_0x31bc29){_0x4eccf7=_0x31bc29[_0x2dca('0x2')](',');}return _0x4eccf7;};exports[_0x2dca('0x3')]=function(_0x594e44,_0x1655ca){var _0x50d0c6={};if(!_[_0x2dca('0x4')](_0x594e44)){_[_0x2dca('0x5')](_0x594e44,function(_0x53e2ac,_0x4de04b){try{if(_0x1655ca){var _0x3c78f1=_['find'](_0x1655ca,{'name':_0x4de04b})||{};if(_0x3c78f1[_0x2dca('0x6')]==='DATE'&&_['isPlainObject'](_0x53e2ac)){var _0x329c3c=JSON[_0x2dca('0x7')](_0x53e2ac);var _0xbde0f6={'$gte':moment(moment(_0x329c3c[_0x2dca('0x8')])['format'](_0x2dca('0x9')))['utc']()[_0x2dca('0xa')](),'$lte':moment(moment(_0x329c3c[_0x2dca('0xb')])[_0x2dca('0xa')](_0x2dca('0x9')))['utc']()['subtract'](0x1,'s')[_0x2dca('0xa')]()};_0x50d0c6[_0x4de04b]=_0xbde0f6;}else{_0x50d0c6[_0x4de04b]=_[_0x2dca('0xc')](_0x53e2ac)?_0x53e2ac:JSON[_0x2dca('0x7')](_0x53e2ac);}}else{_0x50d0c6[_0x4de04b]=_[_0x2dca('0xc')](_0x53e2ac)?_0x53e2ac:JSON[_0x2dca('0x7')](_0x53e2ac);}}catch(_0x4849c9){_0x50d0c6[_0x4de04b]=_0x53e2ac[_0x2dca('0x2')](',');}});}return _0x50d0c6;};exports[_0x2dca('0xd')]=function(_0x114a49){_0x114a49=parseInt(_0x114a49,0xa);if(!_0x114a49||_0x114a49<0x0){_0x114a49=LIMIT_VALUE;}return _0x114a49;};exports['offset']=function(_0x1cf451){_0x1cf451=parseInt(_0x1cf451,0xa);if(!_0x1cf451||_0x1cf451<0x0){_0x1cf451=0x0;}return _0x1cf451;};exports['sort']=function(_0x573390){var _0x3e8f9a,_0x178588=null;if(_0x573390){_0x3e8f9a=_0x573390[_0x2dca('0x2')](',');_0x178588=_['map'](_0x3e8f9a,function(_0x49caaf){if(_0x49caaf['indexOf']('-')===0x0){return[_0x49caaf==='priority'?sequelize[_0x2dca('0xe')](sequelize[_0x2dca('0xf')](_0x2dca('0x10')),_0x2dca('0x11')):_0x49caaf[_0x2dca('0x12')](0x1),_0x2dca('0x13')];}else{return[_0x49caaf===_0x2dca('0x10')?sequelize[_0x2dca('0xe')](sequelize[_0x2dca('0xf')](_0x2dca('0x10')),_0x2dca('0x11')):_0x49caaf,'ASC'];}});}return _0x178588;};exports[_0x2dca('0x14')]=function(_0x40d978,_0x1f59e2){if(_[_0x2dca('0x4')](_0x40d978)){return _0x40d978;}if(_['isArray'](_0x40d978)){for(var _0x3b0196=0x0;_0x3b0196<_0x40d978['length'];_0x3b0196+=0x1){_0x40d978[_0x3b0196]=this['omit'](_0x40d978[_0x3b0196],_0x1f59e2);}return _0x40d978;}if(!_[_0x2dca('0x15')](_0x40d978)){return _0x40d978;}if(_[_0x2dca('0x16')](_0x1f59e2)){_0x1f59e2=[_0x1f59e2];}if(!_[_0x2dca('0xc')](_0x1f59e2)){return _0x40d978;}for(var _0x444f6a=0x0;_0x444f6a<_0x1f59e2[_0x2dca('0x17')];_0x444f6a+=0x1){_[_0x2dca('0x18')](_0x40d978,_0x1f59e2[_0x444f6a]);}for(var _0x46d7c8 in _0x40d978){if(_0x40d978['hasOwnProperty'](_0x46d7c8)){_0x40d978[_0x46d7c8]=this[_0x2dca('0x14')](_0x40d978[_0x46d7c8],_0x1f59e2);}}return _0x40d978;};exports[_0x2dca('0x19')]=function(_0x480fe5){return _0x480fe5['match'](RegExp(_0x2dca('0x1a')))?!![]:![];};exports[_0x2dca('0x1b')]=function(_0x17e093){return _0x17e093['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x2dca('0x1c')]=function(_0x3b06a9){var _0x31b64c=[];_0x3b06a9[_0x2dca('0x2')]('\x20')[_0x2dca('0x1d')](function(_0x2d2ff8){_0x31b64c[_0x2dca('0x1e')]('+'+_0x2d2ff8[_0x2dca('0x1f')]()+'*');});return _0x31b64c['join']('\x20');}; \ No newline at end of file +var _0xe600=['toString','join','sequelize','moment','fields','split','isEmpty','forOwn','find','DATE','parse','format','utc','$lte','subtract','isArray','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','length','omit','isObject','isString','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','push'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xe600,0x160));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var sequelize=require(_0x0e60('0x0'));var moment=require(_0x0e60('0x1'));var LIMIT_VALUE=0xfa;exports[_0x0e60('0x2')]=function(_0x2a5aff){var _0x108ecd=null;if(_0x2a5aff){_0x108ecd=_0x2a5aff[_0x0e60('0x3')](',');}return _0x108ecd;};exports['filters']=function(_0x52b412,_0xb55fe1){var _0x3334f6={};if(!_[_0x0e60('0x4')](_0x52b412)){_[_0x0e60('0x5')](_0x52b412,function(_0x3bf677,_0x2730cd){try{if(_0xb55fe1){var _0x267933=_[_0x0e60('0x6')](_0xb55fe1,{'name':_0x2730cd})||{};if(_0x267933['type']===_0x0e60('0x7')&&_['isPlainObject'](_0x3bf677)){var _0x5b4d46=JSON[_0x0e60('0x8')](_0x3bf677);var _0x1ef189={'$gte':moment(moment(_0x5b4d46['$gte'])[_0x0e60('0x9')]('YYYY-MM-DD'))[_0x0e60('0xa')]()[_0x0e60('0x9')](),'$lte':moment(moment(_0x5b4d46[_0x0e60('0xb')])['format']('YYYY-MM-DD'))[_0x0e60('0xa')]()[_0x0e60('0xc')](0x1,'s')[_0x0e60('0x9')]()};_0x3334f6[_0x2730cd]=_0x1ef189;}else{_0x3334f6[_0x2730cd]=_[_0x0e60('0xd')](_0x3bf677)?_0x3bf677:JSON[_0x0e60('0x8')](_0x3bf677);}}else{_0x3334f6[_0x2730cd]=_[_0x0e60('0xd')](_0x3bf677)?_0x3bf677:JSON['parse'](_0x3bf677);}}catch(_0x174445){_0x3334f6[_0x2730cd]=_0x3bf677[_0x0e60('0x3')](',');}});}return _0x3334f6;};exports['limit']=function(_0x5d7ba0){_0x5d7ba0=parseInt(_0x5d7ba0,0xa);if(!_0x5d7ba0||_0x5d7ba0<0x0){_0x5d7ba0=LIMIT_VALUE;}return _0x5d7ba0;};exports['offset']=function(_0x57bbc7){_0x57bbc7=parseInt(_0x57bbc7,0xa);if(!_0x57bbc7||_0x57bbc7<0x0){_0x57bbc7=0x0;}return _0x57bbc7;};exports['sort']=function(_0x1440d0){var _0x254d67,_0x59485a=null;if(_0x1440d0){_0x254d67=_0x1440d0[_0x0e60('0x3')](',');_0x59485a=_['map'](_0x254d67,function(_0x338c66){if(_0x338c66[_0x0e60('0xe')]('-')===0x0){return[_0x338c66===_0x0e60('0xf')?sequelize[_0x0e60('0x10')](sequelize[_0x0e60('0x11')]('priority'),'unsigned'):_0x338c66[_0x0e60('0x12')](0x1),_0x0e60('0x13')];}else{return[_0x338c66===_0x0e60('0xf')?sequelize[_0x0e60('0x10')](sequelize[_0x0e60('0x11')](_0x0e60('0xf')),_0x0e60('0x14')):_0x338c66,_0x0e60('0x15')];}});}return _0x59485a;};exports['omit']=function(_0x3d4d1d,_0x38d070){if(_[_0x0e60('0x4')](_0x3d4d1d)){return _0x3d4d1d;}if(_['isArray'](_0x3d4d1d)){for(var _0x31a090=0x0;_0x31a090<_0x3d4d1d[_0x0e60('0x16')];_0x31a090+=0x1){_0x3d4d1d[_0x31a090]=this[_0x0e60('0x17')](_0x3d4d1d[_0x31a090],_0x38d070);}return _0x3d4d1d;}if(!_[_0x0e60('0x18')](_0x3d4d1d)){return _0x3d4d1d;}if(_[_0x0e60('0x19')](_0x38d070)){_0x38d070=[_0x38d070];}if(!_[_0x0e60('0xd')](_0x38d070)){return _0x3d4d1d;}for(var _0x265ce0=0x0;_0x265ce0<_0x38d070['length'];_0x265ce0+=0x1){_['unset'](_0x3d4d1d,_0x38d070[_0x265ce0]);}for(var _0x5bf4db in _0x3d4d1d){if(_0x3d4d1d[_0x0e60('0x1a')](_0x5bf4db)){_0x3d4d1d[_0x5bf4db]=this[_0x0e60('0x17')](_0x3d4d1d[_0x5bf4db],_0x38d070);}}return _0x3d4d1d;};exports[_0x0e60('0x1b')]=function(_0x466877){return _0x466877[_0x0e60('0x1c')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x0e60('0x1d')]=function(_0x479eb9){return _0x479eb9[_0x0e60('0x1c')](/^\S+@\S+$/)?!![]:![];};exports[_0x0e60('0x1e')]=function(_0x1454c5){var _0x4258d6=[];_0x1454c5[_0x0e60('0x3')]('\x20')[_0x0e60('0x1f')](function(_0x11a834){_0x4258d6[_0x0e60('0x20')]('+'+_0x11a834[_0x0e60('0x21')]()+'*');});return _0x4258d6[_0x0e60('0x22')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e82f4d6..fffbfb1 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb303=['public','development','test','join','client','json\x20replacer','toISOString','use','static','get','views','/server/views','engine','html','ejs','urlencoded','json','50mb','express','serve-favicon','cookie-parser','errorhandler','path','passport','moment','./environment','../mysqldb','default','production','set','appPath','root'];(function(_0x470c65,_0x55da39){var _0x4ca9e4=function(_0x44b6ab){while(--_0x44b6ab){_0x470c65['push'](_0x470c65['shift']());}};_0x4ca9e4(++_0x55da39);}(_0xb303,0x172));var _0x3b30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb303[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x3b30('0x0'));var favicon=require(_0x3b30('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x3b30('0x2'));var errorHandler=require(_0x3b30('0x3'));var path=require(_0x3b30('0x4'));var passport=require(_0x3b30('0x5'));var cors=require('cors');var moment=require(_0x3b30('0x6'));var config=require(_0x3b30('0x7'));var db=require(_0x3b30('0x8'))['db'];exports[_0x3b30('0x9')]=function(_0x4e4b72){var _0x2ef9f8=_0x4e4b72['get']('env');if(_0x2ef9f8===_0x3b30('0xa')){_0x4e4b72[_0x3b30('0xb')](_0x3b30('0xc'),path['join'](config[_0x3b30('0xd')],_0x3b30('0xe')));}if(_0x2ef9f8===_0x3b30('0xf')||_0x2ef9f8===_0x3b30('0x10')){_0x4e4b72[_0x3b30('0xb')](_0x3b30('0xc'),path[_0x3b30('0x11')](config[_0x3b30('0xd')],_0x3b30('0x12')));_0x4e4b72['use'](errorHandler());}_0x4e4b72[_0x3b30('0xb')](_0x3b30('0x13'),function(_0x4b0e4f,_0xdcf7bf){if(this[_0x4b0e4f]instanceof Date){_0xdcf7bf=this[_0x4b0e4f][_0x3b30('0x14')]()['split']('.')[0x0]+'Z';}return _0xdcf7bf;});_0x4e4b72[_0x3b30('0x15')](express[_0x3b30('0x16')](_0x4e4b72[_0x3b30('0x17')](_0x3b30('0xc'))));_0x4e4b72[_0x3b30('0xb')](_0x3b30('0x18'),config[_0x3b30('0xd')]+_0x3b30('0x19'));_0x4e4b72[_0x3b30('0x1a')](_0x3b30('0x1b'),require(_0x3b30('0x1c'))['renderFile']);_0x4e4b72['set']('view\x20engine',_0x3b30('0x1b'));_0x4e4b72[_0x3b30('0x15')](bodyParser[_0x3b30('0x1d')]({'limit':'50mb','extended':!![]}));_0x4e4b72[_0x3b30('0x15')](bodyParser[_0x3b30('0x1e')]({'limit':_0x3b30('0x1f')}));_0x4e4b72['use'](cors());_0x4e4b72[_0x3b30('0x15')](methodOverride());_0x4e4b72['use'](cookieParser());_0x4e4b72[_0x3b30('0x15')](passport['initialize']());}; \ No newline at end of file +var _0xb5fc=['toISOString','split','use','static','get','views','/server/views','engine','html','renderFile','urlencoded','50mb','initialize','serve-favicon','body-parser','method-override','errorhandler','passport','cors','moment','./environment','../mysqldb','env','production','set','appPath','join','root','public','development','json\x20replacer'];(function(_0x619a2b,_0x6b0c58){var _0x2645a8=function(_0x5811f8){while(--_0x5811f8){_0x619a2b['push'](_0x619a2b['shift']());}};_0x2645a8(++_0x6b0c58);}(_0xb5fc,0x124));var _0xcb5f=function(_0x436870,_0x1567cd){_0x436870=_0x436870-0x0;var _0x43e6b9=_0xb5fc[_0x436870];return _0x43e6b9;};'use strict';var express=require('express');var favicon=require(_0xcb5f('0x0'));var bodyParser=require(_0xcb5f('0x1'));var methodOverride=require(_0xcb5f('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xcb5f('0x3'));var path=require('path');var passport=require(_0xcb5f('0x4'));var cors=require(_0xcb5f('0x5'));var moment=require(_0xcb5f('0x6'));var config=require(_0xcb5f('0x7'));var db=require(_0xcb5f('0x8'))['db'];exports['default']=function(_0x310202){var _0x4c41ee=_0x310202['get'](_0xcb5f('0x9'));if(_0x4c41ee===_0xcb5f('0xa')){_0x310202[_0xcb5f('0xb')](_0xcb5f('0xc'),path[_0xcb5f('0xd')](config[_0xcb5f('0xe')],_0xcb5f('0xf')));}if(_0x4c41ee===_0xcb5f('0x10')||_0x4c41ee==='test'){_0x310202[_0xcb5f('0xb')]('appPath',path[_0xcb5f('0xd')](config[_0xcb5f('0xe')],'client'));_0x310202['use'](errorHandler());}_0x310202[_0xcb5f('0xb')](_0xcb5f('0x11'),function(_0x3c1747,_0x6b7e0f){if(this[_0x3c1747]instanceof Date){_0x6b7e0f=this[_0x3c1747][_0xcb5f('0x12')]()[_0xcb5f('0x13')]('.')[0x0]+'Z';}return _0x6b7e0f;});_0x310202[_0xcb5f('0x14')](express[_0xcb5f('0x15')](_0x310202[_0xcb5f('0x16')](_0xcb5f('0xc'))));_0x310202[_0xcb5f('0xb')](_0xcb5f('0x17'),config[_0xcb5f('0xe')]+_0xcb5f('0x18'));_0x310202[_0xcb5f('0x19')](_0xcb5f('0x1a'),require('ejs')[_0xcb5f('0x1b')]);_0x310202[_0xcb5f('0xb')]('view\x20engine',_0xcb5f('0x1a'));_0x310202[_0xcb5f('0x14')](bodyParser[_0xcb5f('0x1c')]({'limit':_0xcb5f('0x1d'),'extended':!![]}));_0x310202['use'](bodyParser['json']({'limit':_0xcb5f('0x1d')}));_0x310202[_0xcb5f('0x14')](cors());_0x310202[_0xcb5f('0x14')](methodOverride());_0x310202[_0xcb5f('0x14')](cookieParser());_0x310202[_0xcb5f('0x14')](passport[_0xcb5f('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a32a9a2..8fccea4 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 _0xe14b=['networkInterfaces','keys','length','filter','family','head','mac','address','127.0.0.1','orderBy','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','execSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x8a370,_0x321bd7){_0x8a370=_0x8a370-0x0;var _0x515b44=_0xe14b[_0x8a370];return _0x515b44;};'use strict';var _=require(_0xbe14('0x0'));var os=require('os');var crypto=require(_0xbe14('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xbe14('0x2')];function getInterfaces(){var _0x36393a=[];var _0x48a116=os[_0xbe14('0x3')]();var _0x5ce8fb=_['orderBy'](_[_0xbe14('0x4')](_0x48a116));for(var _0x2d1a4a=0x0;_0x2d1a4a<_0x5ce8fb[_0xbe14('0x5')];_0x2d1a4a++){var _0x1ff100=_0x48a116[_0x5ce8fb[_0x2d1a4a]][_0xbe14('0x6')](function(_0x39387e){return _0x39387e[_0xbe14('0x7')]==='IPv4'&&_0x39387e['internal']===![];});_0x36393a=_0x36393a['concat'](_0x1ff100);}return _0x36393a;}function getFirstInterface(){var _0x30c355=_[_0xbe14('0x8')](getInterfaces());return{'macAddress':_0x30c355&&_0x30c355[_0xbe14('0x9')]?_0x30c355[_0xbe14('0x9')]:'00:00:00:00:00:00','ipAddress':_0x30c355&&_0x30c355['address']?_0x30c355[_0xbe14('0xa')]:_0xbe14('0xb')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x254c3b=_[_0xbe14('0xc')](os[_0xbe14('0xd')]()[_0xbe14('0xe')](function(_0x27792f){return _0x27792f[_0xbe14('0xf')];}))[_0xbe14('0x10')](':');return crypto[_0xbe14('0x11')](_0xbe14('0x12'))[_0xbe14('0x13')](_0x254c3b)[_0xbe14('0x14')](_0xbe14('0x15'));}exports[_0xbe14('0x16')]=function(){switch(os['platform']()){case'win32':return exec(_0xbe14('0x17'),{'encoding':_0xbe14('0x18')})[_0xbe14('0x19')]('\x0d\x0a','');default:var _0x37ce4e=getFirstInterface();var _0x4e8f34=getCPUhash();var _0x21c789=_0x4e8f34+'|'+os[_0xbe14('0x1a')]()+'|'+_0x37ce4e[_0xbe14('0x1b')]+'|'+_0x37ce4e[_0xbe14('0x1c')];var _0x38f1ea=crypto[_0xbe14('0x11')](_0xbe14('0x12'))['update'](_0x21c789)[_0xbe14('0x14')](_0xbe14('0x15'));return _0x38f1ea[_0xbe14('0x1d')](0x0,0x8)+'-'+_0x38f1ea[_0xbe14('0x1d')](0x8,0xc)+'-'+_0x38f1ea[_0xbe14('0x1d')](0xc,0x10)+'-'+_0x38f1ea[_0xbe14('0x1d')](0x10,0x14)+'-'+_0x38f1ea['substring'](0x14);}}; \ No newline at end of file +var _0x0309=['model','join','createHash','md5','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring','lodash','bimedia-machine-uuid','execSync','networkInterfaces','orderBy','keys','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0309,0x165));var _0x9030=function(_0x599794,_0x2b5b98){_0x599794=_0x599794-0x0;var _0x1b10be=_0x0309[_0x599794];return _0x1b10be;};'use strict';var _=require(_0x9030('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x9030('0x1'));var exec=require('child_process')[_0x9030('0x2')];function getInterfaces(){var _0x352a94=[];var _0x40e75e=os[_0x9030('0x3')]();var _0x29e331=_[_0x9030('0x4')](_[_0x9030('0x5')](_0x40e75e));for(var _0x482786=0x0;_0x482786<_0x29e331['length'];_0x482786++){var _0x1c9c7b=_0x40e75e[_0x29e331[_0x482786]][_0x9030('0x6')](function(_0x4f2d84){return _0x4f2d84[_0x9030('0x7')]==='IPv4'&&_0x4f2d84[_0x9030('0x8')]===![];});_0x352a94=_0x352a94[_0x9030('0x9')](_0x1c9c7b);}return _0x352a94;}function getFirstInterface(){var _0x289add=_['head'](getInterfaces());return{'macAddress':_0x289add&&_0x289add[_0x9030('0xa')]?_0x289add[_0x9030('0xa')]:_0x9030('0xb'),'ipAddress':_0x289add&&_0x289add['address']?_0x289add[_0x9030('0xc')]:_0x9030('0xd')};}exports[_0x9030('0xe')]=getFirstInterface;function getCPUhash(){var _0x11a539=_[_0x9030('0x4')](os[_0x9030('0xf')]()[_0x9030('0x10')](function(_0x5ee60f){return _0x5ee60f[_0x9030('0x11')];}))[_0x9030('0x12')](':');return crypto[_0x9030('0x13')](_0x9030('0x14'))['update'](_0x11a539)[_0x9030('0x15')](_0x9030('0x16'));}exports[_0x9030('0x17')]=function(){switch(os[_0x9030('0x18')]()){case _0x9030('0x19'):return exec(_0x9030('0x1a'),{'encoding':_0x9030('0x1b')})[_0x9030('0x1c')]('\x0d\x0a','');default:var _0xfc6f46=getFirstInterface();var _0x55ac94=getCPUhash();var _0x213040=_0x55ac94+'|'+os[_0x9030('0x1d')]()+'|'+_0xfc6f46[_0x9030('0x1e')]+'|'+_0xfc6f46[_0x9030('0x1f')];var _0x319db3=crypto[_0x9030('0x13')](_0x9030('0x14'))[_0x9030('0x20')](_0x213040)[_0x9030('0x15')](_0x9030('0x16'));return _0x319db3[_0x9030('0x21')](0x0,0x8)+'-'+_0x319db3[_0x9030('0x21')](0x8,0xc)+'-'+_0x319db3[_0x9030('0x21')](0xc,0x10)+'-'+_0x319db3[_0x9030('0x21')](0x10,0x14)+'-'+_0x319db3[_0x9030('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 897f123..1f3a0b8 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 _0x9134=['License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','message','default','crypto','moment','request-promise','bluebird','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','aes-256-ctr','secrets','session','update','utf8','base64','createDecipher','final','||FIELD||VALUE||\x0a','admin','email','|reason|','|uuid|','|machineUuid|','|name|','fullname','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid'];(function(_0x59fbe3,_0xe2e9f3){var _0x3e2659=function(_0x42fe72){while(--_0x42fe72){_0x59fbe3['push'](_0x59fbe3['shift']());}};_0x3e2659(++_0xe2e9f3);}(_0x9134,0x87));var _0x4913=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9134[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var crypto=require(_0x4913('0x0'));var moment=require(_0x4913('0x1'));var rp=require(_0x4913('0x2'));var BPromise=require(_0x4913('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0x4913('0x4'))['db'];var config=require(_0x4913('0x5'));var hardware=require(_0x4913('0x6'));var logger=require(_0x4913('0x7'))(_0x4913('0x8'));var jira=require(_0x4913('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x46e307){return new BPromise(function(_0x177977,_0x16ab4f){var _0x5b3acd=util[_0x4913('0xa')](_0x4913('0xb'),HOST,_0x46e307,module['exports']['version']);if(oldToken){_0x5b3acd=util[_0x4913('0xa')](_0x4913('0xc'),HOST,_0x46e307,module['exports'][_0x4913('0xd')],oldToken);}var _0x1c08ac={'uri':_0x5b3acd,'method':_0x4913('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1c08ac)[_0x4913('0xf')](function(_0x3c3272){_0x177977(_0x3c3272);})['catch'](function(_0x43fc62){_0x16ab4f(_0x43fc62);});});}function encryptDate(_0x5db460){var _0x23b04f=crypto['createCipher'](_0x4913('0x10'),config[_0x4913('0x11')][_0x4913('0x12')]);var _0x58d537=_0x23b04f[_0x4913('0x13')](_0x5db460,_0x4913('0x14'),'base64');_0x58d537+=_0x23b04f['final'](_0x4913('0x15'));return _0x58d537;}function decryptDate(_0xa6bd33){var _0x270802=crypto[_0x4913('0x16')]('aes-256-ctr',config[_0x4913('0x11')][_0x4913('0x12')]);var _0x59615c=_0x270802[_0x4913('0x13')](_0xa6bd33,'base64',_0x4913('0x14'));_0x59615c+=_0x270802[_0x4913('0x17')]('utf8');return _0x59615c;}function sendJiraAlert(_0x366045,_0x589f35,_0x50584a){var _0x1371fc=_0x4913('0x18');return db['User']['findOne']({'where':{'role':_0x4913('0x19')},'attributes':['fullname',_0x4913('0x1a')],'raw':!![]})[_0x4913('0xf')](function(_0x574b09){ADMIN=_0x574b09;_0x1371fc+=_0x4913('0x1b')+_0x50584a+'|\x0a';_0x1371fc+=_0x4913('0x1c')+_0x366045+'|\x0a';_0x1371fc+=_0x4913('0x1d')+_0x589f35+'|\x0a';_0x1371fc+=_0x4913('0x1e')+ADMIN[_0x4913('0x1f')]+'|\x0a';_0x1371fc+=_0x4913('0x20')+ADMIN[_0x4913('0x1a')]+'|\x0a';return _0x1371fc;})['then'](function(_0x262cab){var _0x53cf21=hardware[_0x4913('0x21')]()[_0x4913('0x22')];return jira[_0x4913('0x23')]({'key':_0x4913('0x24'),'summary':_0x4913('0x25'),'description':_0x262cab,'issuetype':_0x4913('0x26'),'oldToken':_0x366045,'newToken':_0x589f35,'email':ADMIN[_0x4913('0x1a')],'name':ADMIN[_0x4913('0x1f')],'reason':GRAY_PERIOD_REASON,'ip':_0x53cf21});});}function manageLicense(_0x203ba7,_0x40a8b2){var _0x3bb9cd=_0x40a8b2[_0x4913('0x27')]({'plain':!![]});httpRequest(_0x203ba7)['then'](function(_0x412942){if(oldToken){oldToken=undefined;}if(_0x412942[_0x4913('0x28')]){if(!_0x3bb9cd['license']&&_0x3bb9cd[_0x4913('0x8')]!=_0x412942[_0x4913('0x8')]||_0x3bb9cd['license']&&_0x3bb9cd['data2']){logger[_0x4913('0x29')](_0x4913('0x2a'));}if(_0x3bb9cd[_0x4913('0x8')]&&!_0x3bb9cd['data2']&&_0x3bb9cd[_0x4913('0x8')]!=_0x412942[_0x4913('0x8')]){logger[_0x4913('0x29')](_0x4913('0x2b'));}if(_0x3bb9cd[_0x4913('0x8')]&&!_0x3bb9cd[_0x4913('0x2c')]&&_0x3bb9cd[_0x4913('0x8')]==_0x412942[_0x4913('0x8')]){return _0x40a8b2;}return _0x40a8b2[_0x4913('0x13')]({'data1':_0x203ba7,'data2':null,'license':_0x412942[_0x4913('0x8')]});}else{if(_0x412942[_0x4913('0x8')]||_0x3bb9cd[_0x4913('0x8')]){if(!_0x3bb9cd[_0x4913('0x2c')]){if(_0x3bb9cd[_0x4913('0x2d')]==_0x203ba7){GRAY_PERIOD_REASON='Disabled';logger[_0x4913('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x3bb9cd[_0x4913('0x2d')];logger[_0x4913('0x29')](_0x4913('0x2e'),_0x3bb9cd[_0x4913('0x2d')],_0x203ba7);}sendJiraAlert(_0x3bb9cd[_0x4913('0x2d')],_0x412942[_0x4913('0x2f')],GRAY_PERIOD_REASON);logger[_0x4913('0x29')](_0x4913('0x30'),GRAY_PERIOD_REASON[_0x4913('0x31')](),moment()[_0x4913('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x40a8b2[_0x4913('0x13')]({'data2':encryptDate(moment()['format'](_0x4913('0x32')))});}else{if(moment()[_0x4913('0x33')](decryptDate(_0x3bb9cd['data2']),_0x4913('0x34'))>DAYS){logger[_0x4913('0x29')](_0x4913('0x35'),moment()[_0x4913('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x40a8b2[_0x4913('0x13')]({'data1':_0x203ba7,'data2':null,'license':null});}}}else{if(_0x3bb9cd[_0x4913('0x2d')]!=_0x203ba7){logger['info'](_0x4913('0x2e'),_0x3bb9cd['data1'],_0x203ba7);return _0x40a8b2[_0x4913('0x13')]({'data1':_0x203ba7,'data2':null,'license':null});}}}return _0x40a8b2;})['then'](function(_0x522c0d){_0x40a8b2=_0x522c0d;})['catch'](function(_0x389909){logger[_0x4913('0x36')](_0x389909['message']);})[_0x4913('0x37')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x40a8b2);},TIME);});}function defaultLicense(){var _0x46351e=hardware[_0x4913('0x38')]();if(_0x46351e){return db[_0x4913('0x39')][_0x4913('0x3a')]({'where':{'id':0x1},'defaults':{'data1':_0x46351e}})[_0x4913('0x3b')](function(_0x328815,_0x166b23){logger[_0x4913('0x29')](_0x4913('0x3c'),_0x46351e);manageLicense(_0x46351e,_0x328815);})[_0x4913('0x3d')](function(_0x46f786){logger['error'](_0x46f786[_0x4913('0x3e')]);});}}exports[_0x4913('0x3f')]=defaultLicense; \ No newline at end of file +var _0x9666=['util','crypto','moment','request-promise','pkginfo','version','../../mysqldb','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','createCipher','aes-256-ctr','secrets','utf8','base64','final','createDecipher','session','update','email','|uuid|','|machineUuid|','|name|','fullname','|email|','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error'];(function(_0x5e46a2,_0x514659){var _0x33f9b3=function(_0x305f00){while(--_0x305f00){_0x5e46a2['push'](_0x5e46a2['shift']());}};_0x33f9b3(++_0x514659);}(_0x9666,0x17a));var _0x6966=function(_0x215b6e,_0x47f895){_0x215b6e=_0x215b6e-0x0;var _0x554267=_0x9666[_0x215b6e];return _0x554267;};'use strict';var util=require(_0x6966('0x0'));var crypto=require(_0x6966('0x1'));var moment=require(_0x6966('0x2'));var rp=require(_0x6966('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x6966('0x4'))(module,_0x6966('0x5'));var db=require(_0x6966('0x6'))['db'];var config=require('../environment');var hardware=require('./hardware');var logger=require(_0x6966('0x7'))(_0x6966('0x8'));var jira=require(_0x6966('0x9'));var HOST=_0x6966('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x363f5f){return new BPromise(function(_0x18fa4c,_0x484a87){var _0xb381c4=util[_0x6966('0xb')](_0x6966('0xc'),HOST,_0x363f5f,module['exports'][_0x6966('0x5')]);if(oldToken){_0xb381c4=util[_0x6966('0xb')](_0x6966('0xd'),HOST,_0x363f5f,module[_0x6966('0xe')][_0x6966('0x5')],oldToken);}var _0x3bb5b1={'uri':_0xb381c4,'method':_0x6966('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x3bb5b1)[_0x6966('0x10')](function(_0x276f89){_0x18fa4c(_0x276f89);})[_0x6966('0x11')](function(_0x4bee79){_0x484a87(_0x4bee79);});});}function encryptDate(_0x58c0ac){var _0x4c5272=crypto[_0x6966('0x12')](_0x6966('0x13'),config[_0x6966('0x14')]['session']);var _0x492e04=_0x4c5272['update'](_0x58c0ac,_0x6966('0x15'),_0x6966('0x16'));_0x492e04+=_0x4c5272[_0x6966('0x17')](_0x6966('0x16'));return _0x492e04;}function decryptDate(_0x19428c){var _0x48d414=crypto[_0x6966('0x18')](_0x6966('0x13'),config['secrets'][_0x6966('0x19')]);var _0x30f650=_0x48d414[_0x6966('0x1a')](_0x19428c,'base64',_0x6966('0x15'));_0x30f650+=_0x48d414['final'](_0x6966('0x15'));return _0x30f650;}function sendJiraAlert(_0x519049,_0x5a4ea7,_0x5de186){var _0x1cdf3b='||FIELD||VALUE||\x0a';return db['User']['findOne']({'where':{'role':'admin'},'attributes':['fullname',_0x6966('0x1b')],'raw':!![]})[_0x6966('0x10')](function(_0x10b9f6){ADMIN=_0x10b9f6;_0x1cdf3b+='|reason|'+_0x5de186+'|\x0a';_0x1cdf3b+=_0x6966('0x1c')+_0x519049+'|\x0a';_0x1cdf3b+=_0x6966('0x1d')+_0x5a4ea7+'|\x0a';_0x1cdf3b+=_0x6966('0x1e')+ADMIN[_0x6966('0x1f')]+'|\x0a';_0x1cdf3b+=_0x6966('0x20')+ADMIN[_0x6966('0x1b')]+'|\x0a';return _0x1cdf3b;})[_0x6966('0x10')](function(_0x2af0b7){var _0x3772d7=hardware['getFirstInterface']()[_0x6966('0x21')];return jira[_0x6966('0x22')]({'key':_0x6966('0x23'),'summary':_0x6966('0x24'),'description':_0x2af0b7,'issuetype':_0x6966('0x25'),'oldToken':_0x519049,'newToken':_0x5a4ea7,'email':ADMIN[_0x6966('0x1b')],'name':ADMIN[_0x6966('0x1f')],'reason':GRAY_PERIOD_REASON,'ip':_0x3772d7});});}function manageLicense(_0x4e4c30,_0x221b7d){var _0x5a7f85=_0x221b7d[_0x6966('0x26')]({'plain':!![]});httpRequest(_0x4e4c30)['then'](function(_0x17292b){if(oldToken){oldToken=undefined;}if(_0x17292b[_0x6966('0x27')]){if(!_0x5a7f85[_0x6966('0x8')]&&_0x5a7f85[_0x6966('0x8')]!=_0x17292b[_0x6966('0x8')]||_0x5a7f85[_0x6966('0x8')]&&_0x5a7f85[_0x6966('0x28')]){logger[_0x6966('0x29')](_0x6966('0x2a'));}if(_0x5a7f85['license']&&!_0x5a7f85[_0x6966('0x28')]&&_0x5a7f85[_0x6966('0x8')]!=_0x17292b['license']){logger[_0x6966('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5a7f85[_0x6966('0x8')]&&!_0x5a7f85[_0x6966('0x28')]&&_0x5a7f85[_0x6966('0x8')]==_0x17292b[_0x6966('0x8')]){return _0x221b7d;}return _0x221b7d[_0x6966('0x1a')]({'data1':_0x4e4c30,'data2':null,'license':_0x17292b[_0x6966('0x8')]});}else{if(_0x17292b[_0x6966('0x8')]||_0x5a7f85[_0x6966('0x8')]){if(!_0x5a7f85[_0x6966('0x28')]){if(_0x5a7f85[_0x6966('0x2b')]==_0x4e4c30){GRAY_PERIOD_REASON=_0x6966('0x2c');logger[_0x6966('0x29')](_0x6966('0x2d'));}else{GRAY_PERIOD_REASON=_0x6966('0x2e');oldToken=_0x5a7f85[_0x6966('0x2b')];logger[_0x6966('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5a7f85[_0x6966('0x2b')],_0x4e4c30);}sendJiraAlert(_0x5a7f85['data1'],_0x17292b[_0x6966('0x2f')],GRAY_PERIOD_REASON);logger[_0x6966('0x29')](_0x6966('0x30'),GRAY_PERIOD_REASON[_0x6966('0x31')](),moment()[_0x6966('0xb')](_0x6966('0x32')));return _0x221b7d[_0x6966('0x1a')]({'data2':encryptDate(moment()[_0x6966('0xb')](_0x6966('0x32')))});}else{if(moment()[_0x6966('0x33')](decryptDate(_0x5a7f85['data2']),_0x6966('0x34'))>DAYS){logger[_0x6966('0x29')](_0x6966('0x35'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x221b7d[_0x6966('0x1a')]({'data1':_0x4e4c30,'data2':null,'license':null});}}}else{if(_0x5a7f85[_0x6966('0x2b')]!=_0x4e4c30){logger['info'](_0x6966('0x36'),_0x5a7f85['data1'],_0x4e4c30);return _0x221b7d['update']({'data1':_0x4e4c30,'data2':null,'license':null});}}}return _0x221b7d;})[_0x6966('0x10')](function(_0xddf2f1){_0x221b7d=_0xddf2f1;})[_0x6966('0x11')](function(_0x1a38f6){logger['error'](_0x1a38f6[_0x6966('0x37')]);})[_0x6966('0x38')](function(){setTimeout(function(){manageLicense(hardware[_0x6966('0x39')](),_0x221b7d);},TIME);});}function defaultLicense(){var _0xa47954=hardware[_0x6966('0x39')]();if(_0xa47954){return db[_0x6966('0x3a')][_0x6966('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0xa47954}})[_0x6966('0x3c')](function(_0x7b6e24,_0x112bff){logger[_0x6966('0x29')](_0x6966('0x3d'),_0xa47954);manageLicense(_0xa47954,_0x7b6e24);})[_0x6966('0x11')](function(_0x576221){logger[_0x6966('0x3e')](_0x576221[_0x6966('0x37')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 1b35701..383b62e 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 _0x0896=['data2','split','aes-256-ctr','update','utf8','parse','demo','uuid','machineUuid','getUuid','createDecipher','secrets','session','base64','final','gray','deadline','add','format','grayReason','changed','disabled','Breaking\x20license','message','2027-01-01T00:00:00.000Z','Demo\x20license','data1','getLicense','find','defaults','then','checkLicense','crypto','lodash','moment','../environment','license','License\x20key\x20value\x20not\x20found'];(function(_0x13ec2b,_0x40b664){var _0x1fb3f4=function(_0x3e91e9){while(--_0x3e91e9){_0x13ec2b['push'](_0x13ec2b['shift']());}};_0x1fb3f4(++_0x40b664);}(_0x0896,0x12a));var _0x6089=function(_0x52beb2,_0x2d8b07){_0x52beb2=_0x52beb2-0x0;var _0x3bb222=_0x0896[_0x52beb2];return _0x3bb222;};'use strict';var crypto=require(_0x6089('0x0'));var util=require('util');var _=require(_0x6089('0x1'));var moment=require(_0x6089('0x2'));var hardware=require('./hardware');var config=require(_0x6089('0x3'));var db=require('../../mysqldb')['db'];function checkLicense(_0x486777,_0x38fe01){if(_0x486777){try{var _0x3f48cf=_0x38fe01||_0x486777[_0x6089('0x4')];if(_['isEmpty'](_0x3f48cf)){throw new Error(_0x6089('0x5'));}var _0x4f0dbd=_0x486777['data1'];var _0xa76bfd=_0x486777[_0x6089('0x6')];var _0x34b0b1=_0x4f0dbd['split']('-')[0x4];var _0x372d85=_0x4f0dbd[_0x6089('0x7')]('-')[0x0];var _0x2cd9ec=crypto['createDecipher'](_0x6089('0x8'),util['format']('%s:%s:%s',_0x34b0b1,_0x4f0dbd,_0x372d85));var _0x493078=_0x2cd9ec[_0x6089('0x9')](_0x3f48cf,'base64',_0x6089('0xa'));_0x493078+=_0x2cd9ec['final']('utf8');var _0x12eb03=JSON[_0x6089('0xb')](_0x493078);_0x12eb03[_0x6089('0xc')]=![];_0x12eb03[_0x6089('0xd')]=_0x4f0dbd;_0x12eb03[_0x6089('0xe')]=hardware[_0x6089('0xf')]();if(_0xa76bfd){var _0x493f1a=crypto[_0x6089('0x10')](_0x6089('0x8'),config[_0x6089('0x11')][_0x6089('0x12')]);var _0x205461=_0x493f1a[_0x6089('0x9')](_0xa76bfd,_0x6089('0x13'),_0x6089('0xa'));_0x205461+=_0x493f1a[_0x6089('0x14')](_0x6089('0xa'));_0x12eb03[_0x6089('0x15')]=_0x205461;_0x12eb03[_0x6089('0x16')]=moment(_0x205461)[_0x6089('0x17')](0x7,'days')[_0x6089('0x18')]();_0x12eb03[_0x6089('0x19')]=_0x12eb03['uuid']!=_0x12eb03[_0x6089('0xe')]?_0x6089('0x1a'):_0x6089('0x1b');}return _0x12eb03;}catch(_0x3a9478){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6089('0x1c'),'uuid':_0x486777['data1'],'machineUuid':hardware[_0x6089('0xf')](),'message':_0x3a9478[_0x6089('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6089('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6089('0x1f'),'uuid':_0x486777[_0x6089('0x20')],'machineUuid':hardware[_0x6089('0xf')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x6089('0x21')]=function(_0x7b2583){return db['License'][_0x6089('0x22')](_[_0x6089('0x23')](_0x7b2583,{'raw':!![],'where':{'id':0x1}}))[_0x6089('0x24')](function(_0x593803){return checkLicense(_0x593803,null);});};exports[_0x6089('0x25')]=checkLicense; \ No newline at end of file +var _0x273b=['../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','demo','uuid','machineUuid','getUuid','secrets','session','gray','deadline','add','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','message','find','defaults','checkLicense','util','lodash','moment','./hardware','../environment'];(function(_0x20c28b,_0x287a17){var _0xd4bb0d=function(_0x2aff37){while(--_0x2aff37){_0x20c28b['push'](_0x20c28b['shift']());}};_0xd4bb0d(++_0x287a17);}(_0x273b,0xb9));var _0xb273=function(_0x1ef82e,_0xa0111d){_0x1ef82e=_0x1ef82e-0x0;var _0x37f7e1=_0x273b[_0x1ef82e];return _0x37f7e1;};'use strict';var crypto=require('crypto');var util=require(_0xb273('0x0'));var _=require(_0xb273('0x1'));var moment=require(_0xb273('0x2'));var hardware=require(_0xb273('0x3'));var config=require(_0xb273('0x4'));var db=require(_0xb273('0x5'))['db'];function checkLicense(_0xdf2693,_0x614518){if(_0xdf2693){try{var _0x2c7f05=_0x614518||_0xdf2693[_0xb273('0x6')];if(_[_0xb273('0x7')](_0x2c7f05)){throw new Error(_0xb273('0x8'));}var _0x139ebc=_0xdf2693['data1'];var _0x285ac7=_0xdf2693[_0xb273('0x9')];var _0x3d9f79=_0x139ebc[_0xb273('0xa')]('-')[0x4];var _0x1cbf39=_0x139ebc[_0xb273('0xa')]('-')[0x0];var _0x13604a=crypto[_0xb273('0xb')](_0xb273('0xc'),util[_0xb273('0xd')](_0xb273('0xe'),_0x3d9f79,_0x139ebc,_0x1cbf39));var _0x44f1cc=_0x13604a[_0xb273('0xf')](_0x2c7f05,_0xb273('0x10'),'utf8');_0x44f1cc+=_0x13604a[_0xb273('0x11')](_0xb273('0x12'));var _0x4f81ff=JSON[_0xb273('0x13')](_0x44f1cc);_0x4f81ff[_0xb273('0x14')]=![];_0x4f81ff[_0xb273('0x15')]=_0x139ebc;_0x4f81ff[_0xb273('0x16')]=hardware[_0xb273('0x17')]();if(_0x285ac7){var _0x55c88d=crypto[_0xb273('0xb')](_0xb273('0xc'),config[_0xb273('0x18')][_0xb273('0x19')]);var _0x42f2eb=_0x55c88d[_0xb273('0xf')](_0x285ac7,_0xb273('0x10'),'utf8');_0x42f2eb+=_0x55c88d['final']('utf8');_0x4f81ff[_0xb273('0x1a')]=_0x42f2eb;_0x4f81ff[_0xb273('0x1b')]=moment(_0x42f2eb)[_0xb273('0x1c')](0x7,'days')[_0xb273('0xd')]();_0x4f81ff['grayReason']=_0x4f81ff[_0xb273('0x15')]!=_0x4f81ff[_0xb273('0x16')]?_0xb273('0x1d'):_0xb273('0x1e');}return _0x4f81ff;}catch(_0x4b0fee){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb273('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb273('0x20'),'uuid':_0xdf2693[_0xb273('0x21')],'machineUuid':hardware['getUuid'](),'message':_0x4b0fee[_0xb273('0x22')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb273('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0xdf2693[_0xb273('0x21')],'machineUuid':hardware[_0xb273('0x17')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x13e7d7){return db['License'][_0xb273('0x23')](_[_0xb273('0x24')](_0x13e7d7,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xb3e8cd){return checkLicense(_0xb3e8cd,null);});};exports[_0xb273('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index e1c1abc..6e8a681 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 _0x8434=['myappanuglar-secret','app-id','secret','http://localhost:9000'];(function(_0x4ee6d3,_0x1f626a){var _0x146a6a=function(_0x1b56bf){while(--_0x1b56bf){_0x4ee6d3['push'](_0x4ee6d3['shift']());}};_0x146a6a(++_0x1f626a);}(_0x8434,0x9f));var _0x4843=function(_0x1410f3,_0x135afb){_0x1410f3=_0x1410f3-0x0;var _0x4da016=_0x8434[_0x1410f3];return _0x4da016;};'use strict';module['exports']={'DOMAIN':_0x4843('0x0'),'SESSION_SECRET':_0x4843('0x1'),'GOOGLE_ID':_0x4843('0x2'),'GOOGLE_SECRET':_0x4843('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xd719=['app-id','exports','http://localhost:9000'];(function(_0x11d973,_0x58552a){var _0x1347c9=function(_0x45e1d5){while(--_0x45e1d5){_0x11d973['push'](_0x11d973['shift']());}};_0x1347c9(++_0x58552a);}(_0xd719,0xb8));var _0x9d71=function(_0x19a5c2,_0x5477d3){_0x19a5c2=_0x19a5c2-0x0;var _0x486fcc=_0xd719[_0x19a5c2];return _0x486fcc;};'use strict';module[_0x9d71('0x0')]={'DOMAIN':_0x9d71('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x9d71('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 673c433..56c0881 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92c4=['winston','util','path','INFO','join','/var','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','message','exports','Logger','transports','File','error','%s-%s','info','Console','env','debugLevel','moment'];(function(_0x492be7,_0x478064){var _0x251fa6=function(_0x1d7604){while(--_0x1d7604){_0x492be7['push'](_0x492be7['shift']());}};_0x251fa6(++_0x478064);}(_0x92c4,0x1e2));var _0x492c=function(_0x2a7fe8,_0xe13784){_0x2a7fe8=_0x2a7fe8-0x0;var _0xe0da98=_0x92c4[_0x2a7fe8];return _0xe0da98;};'use strict';var moment=require(_0x492c('0x0'));var winston=require(_0x492c('0x1'));var util=require(_0x492c('0x2'));var path=require(_0x492c('0x3'));var debugLevel=_0x492c('0x4');function filename(_0x4739bc,_0x5c9b84){return path[_0x492c('0x5')](_0x492c('0x6'),_0x492c('0x7'),_0x492c('0x8'),util[_0x492c('0x9')]('%s-%s.log',_0x4739bc,_0x5c9b84));}function formatter(_0xc1678b,_0x1e37dd){return util[_0x492c('0x9')](_0x492c('0xa'),moment()[_0x492c('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1e37dd['level'][_0x492c('0xb')](),_0xc1678b,_0x1e37dd[_0x492c('0xc')]);}module[_0x492c('0xd')]=function(_0x7c9a79){return new winston[(_0x492c('0xe'))]({'transports':[new winston[(_0x492c('0xf'))][(_0x492c('0x10'))]({'name':util[_0x492c('0x9')]('%s-%s',_0x7c9a79,_0x492c('0x11')),'filename':filename(_0x7c9a79,_0x492c('0x11')),'level':_0x492c('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1977e1){return formatter(_0x7c9a79,_0x1977e1);}}),new winston[(_0x492c('0xf'))][(_0x492c('0x10'))]({'name':util[_0x492c('0x9')](_0x492c('0x12'),_0x7c9a79,'info'),'filename':filename(_0x7c9a79,_0x492c('0x13')),'level':_0x492c('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3ecc16){return formatter(_0x7c9a79,_0x3ecc16);}}),new winston['transports'][(_0x492c('0x14'))]({'level':process[_0x492c('0x15')][_0x492c('0x16')]||debugLevel,'json':![],'formatter':function(_0x19e9f0){return formatter(_0x7c9a79,_0x19e9f0);}})]});}; \ No newline at end of file +var _0x3004=['env','debugLevel','winston','path','INFO','join','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','transports','File','error','%s-%s','info','Console'];(function(_0x454f24,_0x520074){var _0x1b4965=function(_0x4dde07){while(--_0x4dde07){_0x454f24['push'](_0x454f24['shift']());}};_0x1b4965(++_0x520074);}(_0x3004,0x1e5));var _0x4300=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x3004[_0x6cf19c];return _0xce14f3;};'use strict';var moment=require('moment');var winston=require(_0x4300('0x0'));var util=require('util');var path=require(_0x4300('0x1'));var debugLevel=_0x4300('0x2');function filename(_0x536c56,_0x55aa2a){return path[_0x4300('0x3')](_0x4300('0x4'),_0x4300('0x5'),_0x4300('0x6'),util[_0x4300('0x7')](_0x4300('0x8'),_0x536c56,_0x55aa2a));}function formatter(_0x562118,_0x38c237){return util[_0x4300('0x7')](_0x4300('0x9'),moment()[_0x4300('0x7')](_0x4300('0xa')),_0x38c237[_0x4300('0xb')][_0x4300('0xc')](),_0x562118,_0x38c237['message']);}module['exports']=function(_0x1fac90){return new winston['Logger']({'transports':[new winston[(_0x4300('0xd'))][(_0x4300('0xe'))]({'name':util[_0x4300('0x7')]('%s-%s',_0x1fac90,'error'),'filename':filename(_0x1fac90,_0x4300('0xf')),'level':_0x4300('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x51280d){return formatter(_0x1fac90,_0x51280d);}}),new winston[(_0x4300('0xd'))][(_0x4300('0xe'))]({'name':util[_0x4300('0x7')](_0x4300('0x10'),_0x1fac90,_0x4300('0x11')),'filename':filename(_0x1fac90,_0x4300('0x11')),'level':_0x4300('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xd3d0eb){return formatter(_0x1fac90,_0xd3d0eb);}}),new winston[(_0x4300('0xd'))][(_0x4300('0x12'))]({'level':process[_0x4300('0x13')][_0x4300('0x14')]||debugLevel,'json':![],'formatter':function(_0x2a2301){return formatter(_0x1fac90,_0x2a2301);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 36ecf0a..f897e15 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 _0x023b=['xdr','path','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x023b,0x123));var _0xb023=function(_0x3ef182,_0x267573){_0x3ef182=_0x3ef182-0x0;var _0x286b31=_0x023b[_0x3ef182];return _0x286b31;};'use strict';var path=require(_0xb023('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xb023('0x1')](__dirname,'../../services/express/index.js')},{'name':_0xb023('0x2'),'script':path[_0xb023('0x1')](__dirname,_0xb023('0x3'))},{'name':_0xb023('0x4'),'script':path[_0xb023('0x1')](__dirname,_0xb023('0x5'))},{'name':_0xb023('0x6'),'script':path[_0xb023('0x1')](__dirname,_0xb023('0x7'))},{'name':'routing','script':path[_0xb023('0x1')](__dirname,_0xb023('0x8'))},{'name':_0xb023('0x9'),'script':path[_0xb023('0x1')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0xdd50=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports'];(function(_0x367d7b,_0x43d21e){var _0x59eb24=function(_0x19f56c){while(--_0x19f56c){_0x367d7b['push'](_0x367d7b['shift']());}};_0x59eb24(++_0x43d21e);}(_0xdd50,0x172));var _0x0dd5=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xdd50[_0x45e98e];return _0x374dba;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x0dd5('0x0'),'script':path[_0x0dd5('0x1')](__dirname,_0x0dd5('0x2'))},{'name':_0x0dd5('0x3'),'script':path[_0x0dd5('0x1')](__dirname,_0x0dd5('0x4'))},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x0dd5('0x1')](__dirname,_0x0dd5('0x5'))},{'name':_0x0dd5('0x6'),'script':path[_0x0dd5('0x1')](__dirname,_0x0dd5('0x7'))},{'name':'xdr','script':path[_0x0dd5('0x1')](__dirname,_0x0dd5('0x8'))}]};module[_0x0dd5('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 80787a8..e0ae9a5 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 _0x2427=['stop','restart','list','describe','dump','saved','pm2','bluebird','connect','connected','start','disconnect','then'];(function(_0x54ac35,_0x137d6e){var _0x3d386c=function(_0x2da58b){while(--_0x2da58b){_0x54ac35['push'](_0x54ac35['shift']());}};_0x3d386c(++_0x137d6e);}(_0x2427,0x165));var _0x7242=function(_0x24788a,_0x101c98){_0x24788a=_0x24788a-0x0;var _0x45e196=_0x2427[_0x24788a];return _0x45e196;};'use strict';var pm2=require(_0x7242('0x0'));var BPromise=require(_0x7242('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x8a792,_0x520d61){return pm2[_0x7242('0x2')](function(_0x4b0c46){if(_0x4b0c46){return _0x520d61(_0x4b0c46);}return _0x8a792(_0x7242('0x3'));});});};exports[_0x7242('0x4')]=function(_0x226e44){return connect()['then'](function(){return new BPromise(function(_0x6ecd49,_0x4b0575){return pm2[_0x7242('0x4')](_0x226e44,function(_0x26f0a9,_0x21792a){if(_0x26f0a9){return _0x4b0575(_0x26f0a9);}pm2[_0x7242('0x5')]();return _0x6ecd49(_0x21792a);});});});};exports['stop']=function(_0x465ac8){return connect()[_0x7242('0x6')](function(){return new BPromise(function(_0x4f51e0,_0x26f36c){return pm2[_0x7242('0x7')](_0x465ac8,function(_0x3774d7,_0x4fdf5b){if(_0x3774d7){return _0x26f36c(_0x3774d7);}pm2[_0x7242('0x5')]();return _0x4f51e0(_0x4fdf5b);});});});};exports[_0x7242('0x8')]=function(_0x2e62a8){return connect()[_0x7242('0x6')](function(){return new BPromise(function(_0x57bd45,_0x1ab61f){return pm2[_0x7242('0x8')](_0x2e62a8,function(_0x4ea646,_0x2efc1e){if(_0x4ea646){return _0x1ab61f(_0x4ea646);}pm2[_0x7242('0x5')]();return _0x57bd45(_0x2efc1e);});});});};exports[_0x7242('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4bd60d,_0x25ed7a){return pm2['list'](function(_0x22af73,_0x375ca6){if(_0x22af73){return _0x25ed7a(_0x22af73);}pm2[_0x7242('0x5')]();return _0x4bd60d(_0x375ca6);});});});};exports[_0x7242('0xa')]=function(_0x461f20){return connect()[_0x7242('0x6')](function(){return new BPromise(function(_0x3ef574,_0x4db26b){return pm2[_0x7242('0xa')](_0x461f20,function(_0x5518a5,_0x988f40){if(_0x5518a5){return _0x4db26b(_0x5518a5);}pm2[_0x7242('0x5')]();return _0x3ef574(_0x988f40);});});});};exports['delete']=function(_0x517619){return connect()['then'](function(){return new BPromise(function(_0x2076ae,_0xf7f7f9){return pm2['delete'](_0x517619,function(_0x5c3ca2,_0x5e118d){if(_0x5c3ca2){return _0xf7f7f9(_0x5c3ca2);}pm2[_0x7242('0x5')]();return _0x2076ae(_0x5e118d);});});});};exports['dump']=function(){return connect()[_0x7242('0x6')](function(){return new BPromise(function(_0x5da4e6,_0x552a7d){return pm2[_0x7242('0xb')](function(_0xb3a27f){if(_0xb3a27f){return _0x552a7d(_0xb3a27f);}return _0x5da4e6(_0x7242('0xc'));});});});}; \ No newline at end of file +var _0x6510=['stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','then','disconnect'];(function(_0x58003d,_0x299519){var _0x2cd876=function(_0x1a1369){while(--_0x1a1369){_0x58003d['push'](_0x58003d['shift']());}};_0x2cd876(++_0x299519);}(_0x6510,0x77));var _0x0651=function(_0x1b01fb,_0x4ead00){_0x1b01fb=_0x1b01fb-0x0;var _0x51815f=_0x6510[_0x1b01fb];return _0x51815f;};'use strict';var pm2=require(_0x0651('0x0'));var BPromise=require(_0x0651('0x1'));var config=require(_0x0651('0x2'));function connect(){return new BPromise(function(_0x1668b0,_0x409785){return pm2['connect'](function(_0x36542d){if(_0x36542d){return _0x409785(_0x36542d);}return _0x1668b0(_0x0651('0x3'));});});};exports[_0x0651('0x4')]=function(_0x38d1c9){return connect()[_0x0651('0x5')](function(){return new BPromise(function(_0x534054,_0x1f6471){return pm2[_0x0651('0x4')](_0x38d1c9,function(_0x12708e,_0x1b1ddb){if(_0x12708e){return _0x1f6471(_0x12708e);}pm2[_0x0651('0x6')]();return _0x534054(_0x1b1ddb);});});});};exports['stop']=function(_0x9f9a66){return connect()[_0x0651('0x5')](function(){return new BPromise(function(_0x1894f4,_0x3d0285){return pm2[_0x0651('0x7')](_0x9f9a66,function(_0x53b31b,_0x3d424c){if(_0x53b31b){return _0x3d0285(_0x53b31b);}pm2[_0x0651('0x6')]();return _0x1894f4(_0x3d424c);});});});};exports[_0x0651('0x8')]=function(_0x61b5ca){return connect()[_0x0651('0x5')](function(){return new BPromise(function(_0x1ab65d,_0x349890){return pm2[_0x0651('0x8')](_0x61b5ca,function(_0x352db4,_0x268ca2){if(_0x352db4){return _0x349890(_0x352db4);}pm2[_0x0651('0x6')]();return _0x1ab65d(_0x268ca2);});});});};exports[_0x0651('0x9')]=function(){return connect()[_0x0651('0x5')](function(){return new BPromise(function(_0x25f9f,_0x47b39c){return pm2[_0x0651('0x9')](function(_0x3e59ec,_0xeef589){if(_0x3e59ec){return _0x47b39c(_0x3e59ec);}pm2[_0x0651('0x6')]();return _0x25f9f(_0xeef589);});});});};exports['describe']=function(_0x145c51){return connect()[_0x0651('0x5')](function(){return new BPromise(function(_0x31dc74,_0x3e3b89){return pm2[_0x0651('0xa')](_0x145c51,function(_0x2e07ff,_0xad5976){if(_0x2e07ff){return _0x3e3b89(_0x2e07ff);}pm2[_0x0651('0x6')]();return _0x31dc74(_0xad5976);});});});};exports[_0x0651('0xb')]=function(_0x150e2f){return connect()[_0x0651('0x5')](function(){return new BPromise(function(_0x237fa6,_0x38c40d){return pm2['delete'](_0x150e2f,function(_0x15b072,_0x565213){if(_0x15b072){return _0x38c40d(_0x15b072);}pm2[_0x0651('0x6')]();return _0x237fa6(_0x565213);});});});};exports['dump']=function(){return connect()[_0x0651('0x5')](function(){return new BPromise(function(_0x34e88a,_0x2d8da5){return pm2[_0x0651('0xc')](function(_0x9e6d37){if(_0x9e6d37){return _0x2d8da5(_0x9e6d37);}return _0x34e88a(_0x0651('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a675646..4cad1c5 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 _0xc240=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','length','catch','error','start','lodash','../../mysqldb','../../config/environment','defaults','redis','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xc240,0x7c));var _0x0c24=function(_0x324455,_0x5b72c9){_0x324455=_0x324455-0x0;var _0x1d06bc=_0xc240[_0x324455];return _0x1d06bc;};'use strict';var _=require(_0x0c24('0x0'));var moment=require('moment');var Redis=require('ioredis');var db=require(_0x0c24('0x1'))['db'];var config=require(_0x0c24('0x2'));config['redis']=_[_0x0c24('0x3')](config[_0x0c24('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x4e0ff0=0x0;var _0x3bc866=[];return db[_0x0c24('0x5')][_0x0c24('0x6')]({'raw':!![],'attributes':['id',_0x0c24('0x7')],'where':{'id':0x1}})['then'](function(_0x2e98cb){_0x4e0ff0=_0x2e98cb[_0x0c24('0x7')];if(_0x4e0ff0){return db[_0x0c24('0x8')]['findAll']({'raw':!![],'attributes':['id',_0x0c24('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0c24('0xa')](_0x2e98cb[_0x0c24('0x7')],_0x0c24('0xb'))}}});}else{return[];}})[_0x0c24('0xc')](function(_0x1ab60f){_0x3bc866=_0x1ab60f;if(_0x4e0ff0){return db[_0x0c24('0x8')][_0x0c24('0xd')]({'closeReason':_0x0c24('0xe'),'disposition':_0x0c24('0xf'),'closed':!![],'closedAt':moment()[_0x0c24('0x10')](_0x0c24('0x11'))},{'where':{'id':_[_0x0c24('0x12')](_0x3bc866||[],'id')}});}})[_0x0c24('0xc')](function(_0x449cb6){for(var _0x4da69d=0x0;_0x4da69d<_0x3bc866[_0x0c24('0x13')];_0x4da69d++){io['emit']('chatInteraction:update',{'id':_0x3bc866[_0x4da69d]['id'],'closed':!![]});}})[_0x0c24('0x14')](function(_0x5c7916){console[_0x0c24('0x15')](_0x5c7916);});}exports[_0x0c24('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe6f7=['minutes','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','catch','error','lodash','ioredis','../../config/environment','defaults','redis','localhost','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','lastMsgAt','subtract'];(function(_0x3239fd,_0x5bd44c){var _0x1e7a7a=function(_0x31aa13){while(--_0x31aa13){_0x3239fd['push'](_0x3239fd['shift']());}};_0x1e7a7a(++_0x5bd44c);}(_0xe6f7,0x1a2));var _0x7e6f=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0xe6f7[_0x128bef];return _0x1ba862;};'use strict';var _=require(_0x7e6f('0x0'));var moment=require('moment');var Redis=require(_0x7e6f('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x7e6f('0x2'));config['redis']=_[_0x7e6f('0x3')](config[_0x7e6f('0x4')],{'host':_0x7e6f('0x5'),'port':0x18eb});var io=require(_0x7e6f('0x6'))(new Redis(config['redis']));function closeInteractions(){var _0x2ce308=0x0;var _0x3a325b=[];return db[_0x7e6f('0x7')][_0x7e6f('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x7e6f('0x9')](function(_0xc23414){_0x2ce308=_0xc23414[_0x7e6f('0xa')];if(_0x2ce308){return db[_0x7e6f('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x7e6f('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7e6f('0xd')](_0xc23414[_0x7e6f('0xa')],_0x7e6f('0xe'))}}});}else{return[];}})[_0x7e6f('0x9')](function(_0x34f90e){_0x3a325b=_0x34f90e;if(_0x2ce308){return db['ChatInteraction'][_0x7e6f('0xf')]({'closeReason':_0x7e6f('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x7e6f('0x11')](_0x7e6f('0x12'))},{'where':{'id':_['map'](_0x3a325b||[],'id')}});}})[_0x7e6f('0x9')](function(_0x230fb9){for(var _0x16bf41=0x0;_0x16bf41<_0x3a325b[_0x7e6f('0x13')];_0x16bf41++){io[_0x7e6f('0x14')](_0x7e6f('0x15'),{'id':_0x3a325b[_0x16bf41]['id'],'closed':!![]});}})[_0x7e6f('0x16')](function(_0xd12e2){console[_0x7e6f('0x17')](_0xd12e2);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index df6dfbb..e50b3f2 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 _0xca36=['active','isBetween','endAt','start','exists','stop\x20cron','startAt','deleteJob','run','path','lodash','moment','cron-job-manager','bluebird','../logger','../../mysqldb','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','port','authentication','user','pass','\x22%s\x22\x20<%s>','email','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','text','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\x20mail','email\x20sent','error','data','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','catch','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','stop','delete\x20cron','length','my\x20id','resolve','run\x20job','cron'];(function(_0x4e9f3b,_0x2fd3b1){var _0x3a100c=function(_0x269125){while(--_0x269125){_0x4e9f3b['push'](_0x4e9f3b['shift']());}};_0x3a100c(++_0x2fd3b1);}(_0xca36,0xbb));var _0x6ca3=function(_0x684f24,_0x541f48){_0x684f24=_0x684f24-0x0;var _0x3e9984=_0xca36[_0x684f24];return _0x3e9984;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x6ca3('0x0'));var _=require(_0x6ca3('0x1'));var moment=require(_0x6ca3('0x2'));var CronJobManager=require(_0x6ca3('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x6ca3('0x4'));var logger=require(_0x6ca3('0x5'))('schedule');var db=require(_0x6ca3('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x6ca3('0x7')][_0x6ca3('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2e6150,_0x1ea802){return function(){logger['info'](_0x6ca3('0x9'),_0x2e6150['email']);var _0x164e63=!![];var _0x2a2ab7={'tls':{'rejectUnauthorized':![]}};if(_0x2e6150[_0x6ca3('0xa')][_0x6ca3('0xb')][_0x6ca3('0xc')]){_0x2a2ab7[_0x6ca3('0xc')]=_0x2e6150[_0x6ca3('0xa')][_0x6ca3('0xb')][_0x6ca3('0xc')];}else{_0x2a2ab7['host']=_0x2e6150['MailAccount'][_0x6ca3('0xb')]['host'];_0x2a2ab7[_0x6ca3('0xd')]=_0x2e6150[_0x6ca3('0xa')][_0x6ca3('0xb')][_0x6ca3('0xd')];_0x2a2ab7['secure']=_0x2e6150[_0x6ca3('0xa')][_0x6ca3('0xb')]['secure'];}if(_0x2e6150[_0x6ca3('0xa')][_0x6ca3('0xb')][_0x6ca3('0xe')]){_0x2a2ab7['auth']={'user':_0x2e6150['MailAccount'][_0x6ca3('0xb')][_0x6ca3('0xf')],'pass':_0x2e6150['MailAccount'][_0x6ca3('0xb')][_0x6ca3('0x10')]};}var _0x2f0f44={'account':_0x2a2ab7,'message':{'from':util['format'](_0x6ca3('0x11'),_0x2e6150[_0x6ca3('0xa')]['name'],_0x2e6150[_0x6ca3('0xa')]['email']||_0x2e6150[_0x6ca3('0xa')]['Smtp'][_0x6ca3('0xf')]),'to':_0x2e6150[_0x6ca3('0x12')],'cc':_0x2e6150['cc'],'bcc':_0x2e6150['bcc'],'subject':util[_0x6ca3('0x13')](_0x6ca3('0x14'),_0x1ea802[_0x6ca3('0x15')],_0x2e6150[_0x6ca3('0x16')],_0x2e6150[_0x6ca3('0x17')])}};var _0x17b0e8=path['join'](__dirname,_0x6ca3('0x18'));var _0x1628e6=_0x1ea802[_0x6ca3('0x19')];var _0x7c7130=util['format'](_0x6ca3('0x1a'),path[_0x6ca3('0x1b')](_0x1ea802['savename'],path[_0x6ca3('0x1c')](_0x1ea802[_0x6ca3('0x19')])),_0x6ca3('0x1d'));var _0x5eded8=path[_0x6ca3('0x1e')](_0x17b0e8,_0x1628e6);var _0x26aa38=path[_0x6ca3('0x1e')](_0x17b0e8,_0x7c7130);if(fs['existsSync'](_0x5eded8)){_0x1ea802[_0x6ca3('0x1f')]='Sent';_0x2f0f44[_0x6ca3('0x20')][_0x6ca3('0x21')]=[{'filename':_0x1628e6,'path':_0x5eded8}];_0x2f0f44['message']['text']=util['format'](_0x6ca3('0x22'),JSON[_0x6ca3('0x23')](_0x1ea802,null,0x2));}else if(fs[_0x6ca3('0x24')](_0x26aa38)){_0x1ea802['status']=_0x6ca3('0x25');_0x2f0f44[_0x6ca3('0x20')][_0x6ca3('0x21')]=[{'filename':_0x7c7130,'path':_0x26aa38}];}else{_0x2f0f44[_0x6ca3('0x20')][_0x6ca3('0x26')]=_0x6ca3('0x27');if(!_0x2e6150[_0x6ca3('0x28')]){_0x164e63=![];logger[_0x6ca3('0x29')](_0x6ca3('0x2a'));}}if(_0x164e63){return client[_0x6ca3('0x2b')](_0x6ca3('0x2c'),_0x2f0f44)[_0x6ca3('0x2d')](function(_0x3d248d){if(_0x3d248d['error']){return logger['error'](_0x6ca3('0x2e'),JSON['stringify'](_0x3d248d));}return logger['info'](_0x6ca3('0x2f'));})['catch'](function(_0x25f5dd){return logger[_0x6ca3('0x30')](_0x6ca3('0x2e'),JSON[_0x6ca3('0x23')](_0x25f5dd));});}};}function handleError(){return function(_0x3f81fb){return logger['error'](JSON[_0x6ca3('0x23')](_0x3f81fb));};}function handleResult(_0x649c1e){return function(_0x3d535a){logger[_0x6ca3('0x29')](_0x6ca3('0x31'),JSON[_0x6ca3('0x23')](_0x3d535a));if(_0x649c1e[_0x6ca3('0xa')]&&_0x649c1e[_0x6ca3('0xa')][_0x6ca3('0xb')]&&!_['isNil'](_0x649c1e['email'])){setTimeout(handleSendEmail(_0x649c1e,_0x3d535a),0x3c*0x3e8);}};}function handleJob(_0x394196){return function(){try{if(_['isNil'](_0x394196['subtractNumber'])){return logger[_0x6ca3('0x29')](_0x6ca3('0x32'));}if(_[_0x6ca3('0x33')](_0x394196[_0x6ca3('0x17')])){return logger[_0x6ca3('0x29')](_0x6ca3('0x34'));}var _0x19dae3={'startDate':moment()[_0x6ca3('0x35')](_0x394196['subtractNumber'],_0x394196[_0x6ca3('0x17')])[_0x6ca3('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x6ca3('0x36')),'type':_0x6ca3('0x37'),'output':_0x394196[_0x6ca3('0x38')],'name':_0x394196[_0x6ca3('0x15')]};if(!_[_0x6ca3('0x33')](_0x394196[_0x6ca3('0x39')])){logger[_0x6ca3('0x29')](_0x6ca3('0x3a'),_0x394196[_0x6ca3('0x39')]);return analyticDefaultReportController[_0x6ca3('0x3b')]({'id':_0x394196[_0x6ca3('0x39')]},_0x19dae3)[_0x6ca3('0x2d')](handleResult(_0x394196))['catch'](handleError());}if(!_[_0x6ca3('0x33')](_0x394196['CustomReportId'])){logger[_0x6ca3('0x29')](_0x6ca3('0x3c'),_0x394196[_0x6ca3('0x3d')]);return analyticCustomReportController[_0x6ca3('0x3b')]({'id':_0x394196[_0x6ca3('0x3d')]},_0x19dae3)[_0x6ca3('0x2d')](handleResult(_0x394196))[_0x6ca3('0x3e')](handleError());}}catch(_0x13b166){logger['error'](JSON[_0x6ca3('0x23')](_0x13b166));}return logger[_0x6ca3('0x29')]('no\x20report\x20id');};}function getJobs(_0x34aab5){var _0x4b487e={};if(_0x34aab5){_0x4b487e['id']=_0x34aab5;}return db[_0x6ca3('0x3f')][_0x6ca3('0x40')]({'where':_0x4b487e,'include':[{'model':db[_0x6ca3('0xa')],'attributes':['id','name',_0x6ca3('0x12')],'include':[{'model':db[_0x6ca3('0x41')],'as':_0x6ca3('0xb')}]}]})[_0x6ca3('0x2d')](function(_0x29593b){var _0x4e5948=_[_0x6ca3('0x42')](manager[_0x6ca3('0x43')]);var _0x392eb0=_[_0x6ca3('0x44')](_0x29593b,function(_0x29833c){return _0x29833c['id'][_0x6ca3('0x45')]();});var _0x1acb4c=_[_0x6ca3('0x46')](_0x29593b,function(_0x56017f){return _0x56017f['id'][_0x6ca3('0x45')]();});var _0x1b646b=_0x34aab5?_0x392eb0:_[_0x6ca3('0x47')](_0x392eb0,_0x4e5948);var _0x5b0d9f=_[_0x6ca3('0x48')](_0x392eb0,_0x4e5948);var _0x167ba0=_[_0x6ca3('0x47')](_0x4e5948,_0x392eb0);var _0x9c24b6;var _0x327a3a;for(_0x9c24b6=0x0;_0x9c24b6<_0x167ba0['length']&&!_0x34aab5;_0x9c24b6+=0x1){_0x327a3a=_0x167ba0[_0x9c24b6][_0x6ca3('0x45')]();if(manager['exists'](_0x327a3a)){manager[_0x6ca3('0x49')](_0x327a3a);manager['deleteJob'](_0x327a3a);logger[_0x6ca3('0x29')](_0x6ca3('0x4a'),_0x327a3a);}}logger['info']('toRun',JSON[_0x6ca3('0x23')](_0x1b646b));for(_0x9c24b6=0x0;_0x9c24b6<_0x1b646b[_0x6ca3('0x4b')];_0x9c24b6+=0x1){_0x327a3a=_0x1b646b[_0x9c24b6][_0x6ca3('0x45')]();logger[_0x6ca3('0x29')]('index',_0x327a3a);if(_0x34aab5){logger[_0x6ca3('0x29')](_0x6ca3('0x4c'),_0x34aab5);logger[_0x6ca3('0x29')](JSON[_0x6ca3('0x23')](_0x1acb4c[_0x327a3a]));BPromise[_0x6ca3('0x4d')]()[_0x6ca3('0x2d')](handleJob(_0x1acb4c[_0x327a3a]));logger[_0x6ca3('0x29')](_0x6ca3('0x4e'),_0x1acb4c[_0x327a3a][_0x6ca3('0x15')],_0x1acb4c[_0x327a3a][_0x6ca3('0x4f')]);}else if(_0x1acb4c[_0x327a3a]['cron']&&_0x1acb4c[_0x327a3a][_0x6ca3('0x50')]&&moment()[_0x6ca3('0x51')](_0x1acb4c[_0x327a3a]['startAt'],_0x1acb4c[_0x327a3a][_0x6ca3('0x52')])){manager['add'](_0x327a3a,_0x1acb4c[_0x327a3a][_0x6ca3('0x4f')],handleJob(_0x1acb4c[_0x327a3a]));manager[_0x6ca3('0x53')](_0x327a3a);logger[_0x6ca3('0x29')]('add\x20cron',_0x1acb4c[_0x327a3a][_0x6ca3('0x15')],_0x1acb4c[_0x327a3a][_0x6ca3('0x4f')]);}else if(manager[_0x6ca3('0x54')](_0x327a3a)){manager['stop'](_0x327a3a);manager['deleteJob'](_0x327a3a);logger[_0x6ca3('0x29')](_0x6ca3('0x55'),_0x1acb4c[_0x327a3a][_0x6ca3('0x15')],_0x1acb4c[_0x327a3a][_0x6ca3('0x4f')]);}}for(_0x9c24b6=0x0,_0x327a3a;_0x9c24b6<_0x5b0d9f['length']&&!_0x34aab5;_0x9c24b6+=0x1){_0x327a3a=_0x5b0d9f[_0x9c24b6]['toString']();if(manager[_0x6ca3('0x54')](_0x327a3a)){if(_0x1acb4c[_0x327a3a][_0x6ca3('0x4f')]&&_0x1acb4c[_0x327a3a]['active']&&moment()[_0x6ca3('0x51')](_0x1acb4c[_0x327a3a][_0x6ca3('0x56')],_0x1acb4c[_0x327a3a][_0x6ca3('0x52')])){manager['update'](_0x327a3a,_0x1acb4c[_0x327a3a]['cron'],handleJob(_0x1acb4c[_0x327a3a]));logger['info']('update\x20cron',_0x1acb4c[_0x327a3a][_0x6ca3('0x15')],_0x1acb4c[_0x327a3a][_0x6ca3('0x4f')]);}else{manager[_0x6ca3('0x49')](_0x327a3a);manager[_0x6ca3('0x57')](_0x327a3a);logger[_0x6ca3('0x29')](_0x6ca3('0x55'),_0x1acb4c[_0x327a3a][_0x6ca3('0x15')],_0x1acb4c[_0x327a3a][_0x6ca3('0x4f')]);}}}})[_0x6ca3('0x3e')](function(_0x1a5beb){logger[_0x6ca3('0x30')](JSON['stringify'](_0x1a5beb));});}exports[_0x6ca3('0x58')]=function(_0x21df82){return getJobs(_0x21df82);};exports[_0x6ca3('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe253=['stop','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','add','start','deleteJob','stop\x20cron','exists','startAt','endAt','update','update\x20cron','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','auth','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','basename','zip','join','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','stringify','Sent','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','output','name','DefaultReportId','runReport','then','catch','CustomReportId','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xe253,0x6c));var _0x3e25=function(_0x342492,_0x2ecd43){_0x342492=_0x342492-0x0;var _0x5b0821=_0xe253[_0x342492];return _0x5b0821;};'use strict';var fs=require('fs');var util=require(_0x3e25('0x0'));var path=require('path');var _=require(_0x3e25('0x1'));var moment=require(_0x3e25('0x2'));var CronJobManager=require(_0x3e25('0x3'));var jayson=require(_0x3e25('0x4'));var BPromise=require(_0x3e25('0x5'));var logger=require(_0x3e25('0x6'))(_0x3e25('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x3e25('0x8'));var analyticDefaultReportController=require(_0x3e25('0x9'));var client=jayson[_0x3e25('0xa')][_0x3e25('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x33c6bd,_0x37b4d0){return function(){logger[_0x3e25('0xc')](_0x3e25('0xd'),_0x33c6bd[_0x3e25('0xe')]);var _0x2e5d9b=!![];var _0x2f3ace={'tls':{'rejectUnauthorized':![]}};if(_0x33c6bd[_0x3e25('0xf')]['Smtp'][_0x3e25('0x10')]){_0x2f3ace[_0x3e25('0x10')]=_0x33c6bd[_0x3e25('0xf')][_0x3e25('0x11')][_0x3e25('0x10')];}else{_0x2f3ace[_0x3e25('0x12')]=_0x33c6bd[_0x3e25('0xf')]['Smtp'][_0x3e25('0x12')];_0x2f3ace[_0x3e25('0x13')]=_0x33c6bd[_0x3e25('0xf')]['Smtp'][_0x3e25('0x13')];_0x2f3ace[_0x3e25('0x14')]=_0x33c6bd[_0x3e25('0xf')]['Smtp'][_0x3e25('0x14')];}if(_0x33c6bd[_0x3e25('0xf')][_0x3e25('0x11')]['authentication']){_0x2f3ace[_0x3e25('0x15')]={'user':_0x33c6bd['MailAccount'][_0x3e25('0x11')]['user'],'pass':_0x33c6bd[_0x3e25('0xf')]['Smtp']['pass']};}var _0x506455={'account':_0x2f3ace,'message':{'from':util[_0x3e25('0x16')](_0x3e25('0x17'),_0x33c6bd[_0x3e25('0xf')]['name'],_0x33c6bd['MailAccount'][_0x3e25('0xe')]||_0x33c6bd[_0x3e25('0xf')][_0x3e25('0x11')]['user']),'to':_0x33c6bd['email'],'cc':_0x33c6bd['cc'],'bcc':_0x33c6bd[_0x3e25('0x18')],'subject':util[_0x3e25('0x16')](_0x3e25('0x19'),_0x37b4d0['name'],_0x33c6bd['subtractNumber'],_0x33c6bd[_0x3e25('0x1a')])}};var _0x17811c=path['join'](__dirname,_0x3e25('0x1b'));var _0x683d91=_0x37b4d0[_0x3e25('0x1c')];var _0x23d1c5=util[_0x3e25('0x16')](_0x3e25('0x1d'),path[_0x3e25('0x1e')](_0x37b4d0[_0x3e25('0x1c')],path['extname'](_0x37b4d0[_0x3e25('0x1c')])),_0x3e25('0x1f'));var _0x3f923f=path[_0x3e25('0x20')](_0x17811c,_0x683d91);var _0x554305=path['join'](_0x17811c,_0x23d1c5);if(fs['existsSync'](_0x3f923f)){_0x37b4d0[_0x3e25('0x21')]='Sent';_0x506455[_0x3e25('0x22')][_0x3e25('0x23')]=[{'filename':_0x683d91,'path':_0x3f923f}];_0x506455[_0x3e25('0x22')][_0x3e25('0x24')]=util[_0x3e25('0x16')](_0x3e25('0x25'),JSON[_0x3e25('0x26')](_0x37b4d0,null,0x2));}else if(fs['existsSync'](_0x554305)){_0x37b4d0[_0x3e25('0x21')]=_0x3e25('0x27');_0x506455['message'][_0x3e25('0x23')]=[{'filename':_0x23d1c5,'path':_0x554305}];}else{_0x506455[_0x3e25('0x22')][_0x3e25('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x33c6bd[_0x3e25('0x28')]){_0x2e5d9b=![];logger['info'](_0x3e25('0x29'));}}if(_0x2e5d9b){return client[_0x3e25('0x2a')](_0x3e25('0x2b'),_0x506455)['then'](function(_0x459801){if(_0x459801[_0x3e25('0x2c')]){return logger[_0x3e25('0x2c')](_0x3e25('0x2d'),JSON[_0x3e25('0x26')](_0x459801));}return logger['info'](_0x3e25('0x2e'));})['catch'](function(_0x4d75e8){return logger[_0x3e25('0x2c')]('error\x20mail',JSON[_0x3e25('0x26')](_0x4d75e8));});}};}function handleError(){return function(_0x46662d){return logger[_0x3e25('0x2c')](JSON['stringify'](_0x46662d));};}function handleResult(_0xa8399b){return function(_0x34866b){logger[_0x3e25('0xc')](_0x3e25('0x2f'),JSON[_0x3e25('0x26')](_0x34866b));if(_0xa8399b[_0x3e25('0xf')]&&_0xa8399b[_0x3e25('0xf')][_0x3e25('0x11')]&&!_[_0x3e25('0x30')](_0xa8399b[_0x3e25('0xe')])){setTimeout(handleSendEmail(_0xa8399b,_0x34866b),0x3c*0x3e8);}};}function handleJob(_0x5bde11){return function(){try{if(_[_0x3e25('0x30')](_0x5bde11['subtractNumber'])){return logger[_0x3e25('0xc')](_0x3e25('0x31'));}if(_[_0x3e25('0x30')](_0x5bde11[_0x3e25('0x1a')])){return logger['info'](_0x3e25('0x32'));}var _0x2935ba={'startDate':moment()[_0x3e25('0x33')](_0x5bde11[_0x3e25('0x34')],_0x5bde11[_0x3e25('0x1a')])['format'](_0x3e25('0x35')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x5bde11[_0x3e25('0x36')],'name':_0x5bde11[_0x3e25('0x37')]};if(!_[_0x3e25('0x30')](_0x5bde11[_0x3e25('0x38')])){logger[_0x3e25('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x5bde11[_0x3e25('0x38')]);return analyticDefaultReportController[_0x3e25('0x39')]({'id':_0x5bde11[_0x3e25('0x38')]},_0x2935ba)[_0x3e25('0x3a')](handleResult(_0x5bde11))[_0x3e25('0x3b')](handleError());}if(!_[_0x3e25('0x30')](_0x5bde11[_0x3e25('0x3c')])){logger[_0x3e25('0xc')]('exec\x20custom\x20report\x20id:%s',_0x5bde11[_0x3e25('0x3c')]);return analyticCustomReportController[_0x3e25('0x39')]({'id':_0x5bde11['CustomReportId']},_0x2935ba)[_0x3e25('0x3a')](handleResult(_0x5bde11))[_0x3e25('0x3b')](handleError());}}catch(_0x35a088){logger[_0x3e25('0x2c')](JSON[_0x3e25('0x26')](_0x35a088));}return logger[_0x3e25('0xc')]('no\x20report\x20id');};}function getJobs(_0x30fe29){var _0x33bfb1={};if(_0x30fe29){_0x33bfb1['id']=_0x30fe29;}return db[_0x3e25('0x3d')][_0x3e25('0x3e')]({'where':_0x33bfb1,'include':[{'model':db[_0x3e25('0xf')],'attributes':['id',_0x3e25('0x37'),'email'],'include':[{'model':db[_0x3e25('0x3f')],'as':_0x3e25('0x11')}]}]})[_0x3e25('0x3a')](function(_0x370538){var _0x56fea8=_[_0x3e25('0x40')](manager[_0x3e25('0x41')]);var _0x55e279=_[_0x3e25('0x42')](_0x370538,function(_0x22be0a){return _0x22be0a['id'][_0x3e25('0x43')]();});var _0x190ccb=_[_0x3e25('0x44')](_0x370538,function(_0x44cc4f){return _0x44cc4f['id'][_0x3e25('0x43')]();});var _0x2a3ff8=_0x30fe29?_0x55e279:_[_0x3e25('0x45')](_0x55e279,_0x56fea8);var _0x2266c8=_[_0x3e25('0x46')](_0x55e279,_0x56fea8);var _0x599953=_[_0x3e25('0x45')](_0x56fea8,_0x55e279);var _0x27ed28;var _0x358564;for(_0x27ed28=0x0;_0x27ed28<_0x599953[_0x3e25('0x47')]&&!_0x30fe29;_0x27ed28+=0x1){_0x358564=_0x599953[_0x27ed28]['toString']();if(manager['exists'](_0x358564)){manager[_0x3e25('0x48')](_0x358564);manager['deleteJob'](_0x358564);logger['info'](_0x3e25('0x49'),_0x358564);}}logger[_0x3e25('0xc')](_0x3e25('0x4a'),JSON[_0x3e25('0x26')](_0x2a3ff8));for(_0x27ed28=0x0;_0x27ed28<_0x2a3ff8[_0x3e25('0x47')];_0x27ed28+=0x1){_0x358564=_0x2a3ff8[_0x27ed28]['toString']();logger[_0x3e25('0xc')]('index',_0x358564);if(_0x30fe29){logger['info'](_0x3e25('0x4b'),_0x30fe29);logger[_0x3e25('0xc')](JSON['stringify'](_0x190ccb[_0x358564]));BPromise[_0x3e25('0x4c')]()[_0x3e25('0x3a')](handleJob(_0x190ccb[_0x358564]));logger[_0x3e25('0xc')](_0x3e25('0x4d'),_0x190ccb[_0x358564]['name'],_0x190ccb[_0x358564]['cron']);}else if(_0x190ccb[_0x358564][_0x3e25('0x4e')]&&_0x190ccb[_0x358564][_0x3e25('0x4f')]&&moment()[_0x3e25('0x50')](_0x190ccb[_0x358564]['startAt'],_0x190ccb[_0x358564]['endAt'])){manager[_0x3e25('0x51')](_0x358564,_0x190ccb[_0x358564][_0x3e25('0x4e')],handleJob(_0x190ccb[_0x358564]));manager[_0x3e25('0x52')](_0x358564);logger[_0x3e25('0xc')]('add\x20cron',_0x190ccb[_0x358564][_0x3e25('0x37')],_0x190ccb[_0x358564][_0x3e25('0x4e')]);}else if(manager['exists'](_0x358564)){manager['stop'](_0x358564);manager[_0x3e25('0x53')](_0x358564);logger[_0x3e25('0xc')](_0x3e25('0x54'),_0x190ccb[_0x358564][_0x3e25('0x37')],_0x190ccb[_0x358564][_0x3e25('0x4e')]);}}for(_0x27ed28=0x0,_0x358564;_0x27ed28<_0x2266c8[_0x3e25('0x47')]&&!_0x30fe29;_0x27ed28+=0x1){_0x358564=_0x2266c8[_0x27ed28][_0x3e25('0x43')]();if(manager[_0x3e25('0x55')](_0x358564)){if(_0x190ccb[_0x358564][_0x3e25('0x4e')]&&_0x190ccb[_0x358564]['active']&&moment()['isBetween'](_0x190ccb[_0x358564][_0x3e25('0x56')],_0x190ccb[_0x358564][_0x3e25('0x57')])){manager[_0x3e25('0x58')](_0x358564,_0x190ccb[_0x358564][_0x3e25('0x4e')],handleJob(_0x190ccb[_0x358564]));logger[_0x3e25('0xc')](_0x3e25('0x59'),_0x190ccb[_0x358564]['name'],_0x190ccb[_0x358564][_0x3e25('0x4e')]);}else{manager[_0x3e25('0x48')](_0x358564);manager['deleteJob'](_0x358564);logger[_0x3e25('0xc')](_0x3e25('0x54'),_0x190ccb[_0x358564][_0x3e25('0x37')],_0x190ccb[_0x358564][_0x3e25('0x4e')]);}}}})['catch'](function(_0xfc7f4d){logger['error'](JSON['stringify'](_0xfc7f4d));});}exports['run']=function(_0x268f90){return getJobs(_0x268f90);};exports[_0x3e25('0x52')]=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 1386ac0..9b74749 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 _0xb892=['Cloud\x20Provider\x20not\x20available','Mixed','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','forEach','push','all','SequelizeValidationError','lodash','aws-sdk','util','../../mysqldb','getTranscriptionJob','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','fileText','TranscriptionJob','COMPLETED','TranscriptionJobStatus','Transcript','info','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','data2','Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve'];(function(_0xf37ab1,_0x437deb){var _0xa9cfad=function(_0x459289){while(--_0x459289){_0xf37ab1['push'](_0xf37ab1['shift']());}};_0xa9cfad(++_0x437deb);}(_0xb892,0x161));var _0x2b89=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xb892[_0x485b5a];return _0xd2b34d;};var _=require(_0x2b89('0x0'));var AWS=require(_0x2b89('0x1'));var rp=require('request-promise');var util=require(_0x2b89('0x2'));var BPromise=require('bluebird');var db=require(_0x2b89('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4f7057,_0x597633,_0x1d13f8,_0x585a84){return new Promise(function(_0x4c3a60,_0x243e20){var _0x2049af=new AWS['TranscribeService']({'accessKeyId':_0x597633,'secretAccessKey':_0x4f7057,'region':_0x1d13f8});_0x2049af[_0x2b89('0x4')]({'TranscriptionJobName':_0x585a84},function(_0x40da25,_0x48cdb6){if(_0x40da25){return _0x243e20(_0x40da25);}else{return _0x4c3a60(_0x48cdb6);}});});}function sentiment(_0x352e8c,_0x4302d5,_0xfba332,_0x121651,_0x2f0e15){return new Promise(function(_0x59f81e,_0x266351){var _0x8df231=new AWS['Comprehend']({'accessKeyId':_0x4302d5,'secretAccessKey':_0x352e8c,'region':_0xfba332});_0x8df231['detectSentiment']({'Text':_0x121651,'LanguageCode':_0x2f0e15[_0x2b89('0x5')](0x0,0x2)},function(_0x497fcd,_0x20f6a7){if(_0x497fcd){return _0x266351(_0x497fcd);}else{return _0x59f81e(_0x20f6a7);}});});}function checkTranscribeJob(_0x5c749b,_0xb7df1f,_0x3805a8){var _0x45d9fa;return new BPromise(function(_0x7f7e16,_0x59849d){logger['info'](util[_0x2b89('0x6')](_0x2b89('0x7'),_0x5c749b['id'],_0x5c749b[_0x2b89('0x8')]));return getTranscriptionJob(_0x3805a8[_0x2b89('0x9')],_0x3805a8['data2'],_0xb7df1f['transcribeRegion'],_0x5c749b['transcribeName'])['then'](function(_0x496786){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5c749b['id'],_0x5c749b[_0x2b89('0x8')],_0x496786['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x5c749b[_0x2b89('0xa')]){switch(_0x496786[_0x2b89('0xb')]['TranscriptionJobStatus']){case _0x2b89('0xc'):var _0x2eb4dc={'transcribeStatus':_0x496786[_0x2b89('0xb')][_0x2b89('0xd')],'fileUri':_0x496786['TranscriptionJob'][_0x2b89('0xe')]['TranscriptFileUri']};logger[_0x2b89('0xf')](util[_0x2b89('0x6')]('[RECORDING:%d]\x20Get\x20transcript',_0x5c749b['id']));return rp({'uri':_0x496786[_0x2b89('0xb')][_0x2b89('0xe')][_0x2b89('0x10')],'json':!![]})[_0x2b89('0x11')](function(_0x371dc0){logger[_0x2b89('0xf')](util['format'](_0x2b89('0x12'),_0x5c749b['id']));if(_0x371dc0&&_0x371dc0[_0x2b89('0x13')]&&_0x371dc0[_0x2b89('0x13')]['transcripts']&&_0x371dc0['results'][_0x2b89('0x14')][_0x2b89('0x15')]){_0x2eb4dc[_0x2b89('0xa')]='';for(var _0x1d2a1f=0x0;_0x1d2a1f<_0x371dc0[_0x2b89('0x13')][_0x2b89('0x14')]['length'];_0x1d2a1f++){_0x2eb4dc[_0x2b89('0xa')]+=_0x371dc0['results'][_0x2b89('0x14')][_0x1d2a1f]['transcript']+'';}}return _0x5c749b['update'](_0x2eb4dc);})[_0x2b89('0x11')](function(){logger[_0x2b89('0xf')](util[_0x2b89('0x6')](_0x2b89('0x16'),_0x5c749b['id']));if(!_0x5c749b[_0x2b89('0x17')]){throw new db['Sequelize'][(_0x2b89('0x18'))](_0x2b89('0x19'));}if(!_0xb7df1f[_0x2b89('0x1a')]||!_0xb7df1f[_0x2b89('0x1b')]||!_0xb7df1f[_0x2b89('0x1c')]||!_0xb7df1f['language']||!_0xb7df1f[_0x2b89('0x1d')]){throw new db[(_0x2b89('0x1e'))][(_0x2b89('0x18'))](_0x2b89('0x1f'));}if(!_0x2eb4dc['fileText']){throw new Error(_0x2b89('0x20'));}if(_0xb7df1f[_0x2b89('0x1b')]===_0x3805a8['id']){return _0x3805a8;}else{return db[_0x2b89('0x21')][_0x2b89('0x22')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2b89('0x11')](function(_0x156cd8){if(!_0x156cd8){throw new db[(_0x2b89('0x1e'))][(_0x2b89('0x18'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x156cd8[_0x2b89('0x9')]||!_0x156cd8[_0x2b89('0x23')]){throw new db[(_0x2b89('0x1e'))][(_0x2b89('0x18'))](_0x2b89('0x24'));}_0x45d9fa=_0x156cd8;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5c749b['id']));return sentiment(_0x45d9fa[_0x2b89('0x9')],_0x45d9fa[_0x2b89('0x23')],_0xb7df1f['sentimentRegion'],_0x2eb4dc[_0x2b89('0xa')],_0xb7df1f[_0x2b89('0x25')]);})[_0x2b89('0x11')](function(_0xb501c1){logger[_0x2b89('0xf')](util[_0x2b89('0x6')](_0x2b89('0x26'),_0x5c749b['id']));return _0x5c749b[_0x2b89('0x27')]({'sentiment':_0xb501c1[_0x2b89('0x28')],'sPositive':_0xb501c1[_0x2b89('0x29')][_0x2b89('0x2a')],'sNegative':_0xb501c1[_0x2b89('0x29')][_0x2b89('0x2b')],'sMixed':_0xb501c1[_0x2b89('0x29')]['Mixed'],'sNeutral':_0xb501c1[_0x2b89('0x29')][_0x2b89('0x2c')]});})[_0x2b89('0x11')](function(){logger[_0x2b89('0xf')](util[_0x2b89('0x6')](_0x2b89('0x16'),_0x5c749b['id']));_0x7f7e16();});case _0x2b89('0x2d'):return _0x5c749b[_0x2b89('0x27')]({'transcribeStatus':_0x2b89('0x2d'),'failureReason':_0x496786[_0x2b89('0xb')][_0x2b89('0x2e')]})[_0x2b89('0x11')](function(){logger['info'](util[_0x2b89('0x6')](_0x2b89('0x16'),_0x5c749b['id']));_0x7f7e16();});default:logger[_0x2b89('0xf')](util['format'](_0x2b89('0x2f'),_0x5c749b['id']));break;}}else{return BPromise[_0x2b89('0x30')]()[_0x2b89('0x11')](function(){if(!_0x5c749b[_0x2b89('0x17')]){throw new db[(_0x2b89('0x1e'))][(_0x2b89('0x18'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xb7df1f['sentiment']||!_0xb7df1f['sentimentAccountId']||!_0xb7df1f[_0x2b89('0x1c')]||!_0xb7df1f[_0x2b89('0x25')]||!_0xb7df1f[_0x2b89('0x1d')]){throw new db[(_0x2b89('0x1e'))]['ValidationError'](_0x2b89('0x1f'));}if(!_0x5c749b['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0xb7df1f['sentimentAccountId']===_0x3805a8['id']){return _0x3805a8;}else{return db[_0x2b89('0x21')][_0x2b89('0x22')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2b89('0x11')](function(_0x19e4f8){if(!_0x19e4f8){throw new db[(_0x2b89('0x1e'))]['ValidationError'](_0x2b89('0x31'));}if(!_0x19e4f8[_0x2b89('0x9')]||!_0x19e4f8[_0x2b89('0x23')]){throw new db['Sequelize'][(_0x2b89('0x18'))](_0x2b89('0x24'));}_0x45d9fa=_0x19e4f8;logger[_0x2b89('0xf')](util[_0x2b89('0x6')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5c749b['id']));return sentiment(_0x45d9fa[_0x2b89('0x9')],_0x45d9fa['data2'],_0xb7df1f[_0x2b89('0x1c')],_0x5c749b['fileText'],_0xb7df1f[_0x2b89('0x25')]);})[_0x2b89('0x11')](function(_0x4d8086){logger[_0x2b89('0xf')](util[_0x2b89('0x6')](_0x2b89('0x26'),_0x5c749b['id']));return _0x5c749b[_0x2b89('0x27')]({'sentiment':_0x4d8086[_0x2b89('0x28')],'sPositive':_0x4d8086[_0x2b89('0x29')][_0x2b89('0x2a')],'sNegative':_0x4d8086[_0x2b89('0x29')][_0x2b89('0x2b')],'sMixed':_0x4d8086['SentimentScore'][_0x2b89('0x32')],'sNeutral':_0x4d8086[_0x2b89('0x29')][_0x2b89('0x2c')],'transcribeStatus':_0x2b89('0xc')});})[_0x2b89('0x11')](function(){logger[_0x2b89('0xf')](util[_0x2b89('0x6')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5c749b['id']));_0x7f7e16();});}})[_0x2b89('0x33')](function(_0x2d7407){if(_0x2d7407){if(!_0x2d7407[_0x2b89('0x34')]||_0x2d7407[_0x2b89('0x34')]!=='SequelizeValidationError'){logger[_0x2b89('0x35')](util[_0x2b89('0x6')](_0x2b89('0x36'),_0x5c749b['id']),util[_0x2b89('0x37')](_0x2d7407,{'showHidden':![],'depth':null}));}}_0x7f7e16();});});}function checkTranscribe(){var _0x1abaf2;var _0x3693a3;var _0x2b7280;return db['VoiceRecording'][_0x2b89('0x38')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x2b89('0x11')](function(_0x1c379d){if(!_0x1c379d||!_0x1c379d[_0x2b89('0x15')]){throw new db[(_0x2b89('0x1e'))][(_0x2b89('0x18'))](_0x2b89('0x39'));}_0x1abaf2=_0x1c379d;return db[_0x2b89('0x3a')][_0x2b89('0x22')]({'where':{'id':0x1}});})[_0x2b89('0x11')](function(_0x5cea5d){if(!_0x5cea5d){throw new db[(_0x2b89('0x1e'))][(_0x2b89('0x18'))](_0x2b89('0x3b'));}_0x3693a3=_0x5cea5d;if(!_0x3693a3[_0x2b89('0x3c')]||!_0x3693a3[_0x2b89('0x3d')]||!_0x3693a3[_0x2b89('0x3e')]||!_0x3693a3[_0x2b89('0x25')]||!_0x3693a3[_0x2b89('0x1d')]){throw new db[(_0x2b89('0x1e'))][(_0x2b89('0x18'))]('Transcribe\x20not\x20configured');}return db[_0x2b89('0x21')][_0x2b89('0x22')]({'where':{'id':_0x3693a3[_0x2b89('0x3d')]}});})['then'](function(_0x5cd15d){if(!_0x5cd15d){throw new db['Sequelize'][(_0x2b89('0x18'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5cd15d[_0x2b89('0x9')]||!_0x5cd15d[_0x2b89('0x23')]){throw new db['Sequelize'][(_0x2b89('0x18'))](_0x2b89('0x24'));}_0x2b7280=_0x5cd15d;var _0x370e00=[];_0x1abaf2[_0x2b89('0x3f')](function(_0x2045ec){_0x370e00[_0x2b89('0x40')](checkTranscribeJob(_0x2045ec,_0x3693a3,_0x2b7280));});return BPromise[_0x2b89('0x41')](_0x370e00);})['catch'](function(_0x4de3f5){if(_0x4de3f5){if(!_0x4de3f5['name']||_0x4de3f5[_0x2b89('0x34')]!==_0x2b89('0x42')){logger[_0x2b89('0x35')](util['inspect'](_0x4de3f5,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3f8d=['sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment'];(function(_0x4869dd,_0x66bb78){var _0x2947ce=function(_0x5d8dc0){while(--_0x5d8dc0){_0x4869dd['push'](_0x4869dd['shift']());}};_0x2947ce(++_0x66bb78);}(_0x3f8d,0x1ce));var _0xd3f8=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0x3f8d[_0x1c6089];return _0x4d97c1;};var _=require(_0xd3f8('0x0'));var AWS=require(_0xd3f8('0x1'));var rp=require(_0xd3f8('0x2'));var util=require('util');var BPromise=require(_0xd3f8('0x3'));var db=require(_0xd3f8('0x4'))['db'];var logger=require('../../config/logger')(_0xd3f8('0x5'));function getTranscriptionJob(_0x937369,_0x17763f,_0x32aeff,_0x53b909){return new Promise(function(_0xd13f10,_0x14d5c4){var _0x4c041b=new AWS[(_0xd3f8('0x6'))]({'accessKeyId':_0x17763f,'secretAccessKey':_0x937369,'region':_0x32aeff});_0x4c041b['getTranscriptionJob']({'TranscriptionJobName':_0x53b909},function(_0x47a974,_0x32a73f){if(_0x47a974){return _0x14d5c4(_0x47a974);}else{return _0xd13f10(_0x32a73f);}});});}function sentiment(_0x35ba9b,_0x436d32,_0x3c5440,_0x2a01f1,_0x2d5ccf){return new Promise(function(_0x3fd46c,_0x4b53d0){var _0x3afc58=new AWS[(_0xd3f8('0x7'))]({'accessKeyId':_0x436d32,'secretAccessKey':_0x35ba9b,'region':_0x3c5440});_0x3afc58[_0xd3f8('0x8')]({'Text':_0x2a01f1,'LanguageCode':_0x2d5ccf[_0xd3f8('0x9')](0x0,0x2)},function(_0x405fbd,_0x483984){if(_0x405fbd){return _0x4b53d0(_0x405fbd);}else{return _0x3fd46c(_0x483984);}});});}function checkTranscribeJob(_0x442bac,_0x338e0f,_0x46daf6){var _0x29c0b4;return new BPromise(function(_0x333ae9,_0x121bac){logger[_0xd3f8('0xa')](util[_0xd3f8('0xb')](_0xd3f8('0xc'),_0x442bac['id'],_0x442bac[_0xd3f8('0xd')]));return getTranscriptionJob(_0x46daf6[_0xd3f8('0xe')],_0x46daf6[_0xd3f8('0xf')],_0x338e0f[_0xd3f8('0x10')],_0x442bac[_0xd3f8('0xd')])[_0xd3f8('0x11')](function(_0x202909){logger[_0xd3f8('0xa')](util[_0xd3f8('0xb')](_0xd3f8('0x12'),_0x442bac['id'],_0x442bac[_0xd3f8('0xd')],_0x202909[_0xd3f8('0x13')]['TranscriptionJobStatus']));if(!_0x442bac[_0xd3f8('0x14')]){switch(_0x202909[_0xd3f8('0x13')][_0xd3f8('0x15')]){case _0xd3f8('0x16'):var _0x3922e0={'transcribeStatus':_0x202909[_0xd3f8('0x13')][_0xd3f8('0x15')],'fileUri':_0x202909[_0xd3f8('0x13')]['Transcript'][_0xd3f8('0x17')]};logger[_0xd3f8('0xa')](util[_0xd3f8('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x442bac['id']));return rp({'uri':_0x202909[_0xd3f8('0x13')][_0xd3f8('0x18')][_0xd3f8('0x17')],'json':!![]})['then'](function(_0x21cd45){logger[_0xd3f8('0xa')](util['format'](_0xd3f8('0x19'),_0x442bac['id']));if(_0x21cd45&&_0x21cd45[_0xd3f8('0x1a')]&&_0x21cd45['results'][_0xd3f8('0x1b')]&&_0x21cd45[_0xd3f8('0x1a')][_0xd3f8('0x1b')][_0xd3f8('0x1c')]){_0x3922e0[_0xd3f8('0x14')]='';for(var _0x25c7d5=0x0;_0x25c7d5<_0x21cd45[_0xd3f8('0x1a')][_0xd3f8('0x1b')]['length'];_0x25c7d5++){_0x3922e0[_0xd3f8('0x14')]+=_0x21cd45[_0xd3f8('0x1a')][_0xd3f8('0x1b')][_0x25c7d5][_0xd3f8('0x1d')]+'';}}return _0x442bac[_0xd3f8('0x1e')](_0x3922e0);})[_0xd3f8('0x11')](function(){logger[_0xd3f8('0xa')](util[_0xd3f8('0xb')](_0xd3f8('0x1f'),_0x442bac['id']));if(!_0x442bac[_0xd3f8('0x20')]){throw new db['Sequelize']['ValidationError'](_0xd3f8('0x21'));}if(!_0x338e0f[_0xd3f8('0x22')]||!_0x338e0f[_0xd3f8('0x23')]||!_0x338e0f[_0xd3f8('0x24')]||!_0x338e0f[_0xd3f8('0x25')]||!_0x338e0f[_0xd3f8('0x26')]){throw new db[(_0xd3f8('0x27'))][(_0xd3f8('0x28'))](_0xd3f8('0x29'));}if(!_0x3922e0[_0xd3f8('0x14')]){throw new Error(_0xd3f8('0x2a'));}if(_0x338e0f['sentimentAccountId']===_0x46daf6['id']){return _0x46daf6;}else{return db['CloudProvider'][_0xd3f8('0x2b')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd3f8('0x11')](function(_0x5ee6e1){if(!_0x5ee6e1){throw new db[(_0xd3f8('0x27'))]['ValidationError'](_0xd3f8('0x2c'));}if(!_0x5ee6e1[_0xd3f8('0xe')]||!_0x5ee6e1['data2']){throw new db[(_0xd3f8('0x27'))][(_0xd3f8('0x28'))](_0xd3f8('0x2d'));}_0x29c0b4=_0x5ee6e1;logger['info'](util[_0xd3f8('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x442bac['id']));return sentiment(_0x29c0b4[_0xd3f8('0xe')],_0x29c0b4[_0xd3f8('0xf')],_0x338e0f[_0xd3f8('0x24')],_0x3922e0['fileText'],_0x338e0f[_0xd3f8('0x25')]);})[_0xd3f8('0x11')](function(_0x501c84){logger[_0xd3f8('0xa')](util[_0xd3f8('0xb')](_0xd3f8('0x2e'),_0x442bac['id']));return _0x442bac[_0xd3f8('0x1e')]({'sentiment':_0x501c84[_0xd3f8('0x2f')],'sPositive':_0x501c84[_0xd3f8('0x30')]['Positive'],'sNegative':_0x501c84[_0xd3f8('0x30')][_0xd3f8('0x31')],'sMixed':_0x501c84['SentimentScore'][_0xd3f8('0x32')],'sNeutral':_0x501c84[_0xd3f8('0x30')][_0xd3f8('0x33')]});})['then'](function(){logger[_0xd3f8('0xa')](util[_0xd3f8('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x442bac['id']));_0x333ae9();});case _0xd3f8('0x34'):return _0x442bac[_0xd3f8('0x1e')]({'transcribeStatus':_0xd3f8('0x34'),'failureReason':_0x202909[_0xd3f8('0x13')]['FailureReason']})[_0xd3f8('0x11')](function(){logger[_0xd3f8('0xa')](util[_0xd3f8('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x442bac['id']));_0x333ae9();});default:logger[_0xd3f8('0xa')](util['format'](_0xd3f8('0x35'),_0x442bac['id']));break;}}else{return BPromise[_0xd3f8('0x36')]()[_0xd3f8('0x11')](function(){if(!_0x442bac['tempSentiment']){throw new db['Sequelize'][(_0xd3f8('0x28'))](_0xd3f8('0x21'));}if(!_0x338e0f[_0xd3f8('0x22')]||!_0x338e0f[_0xd3f8('0x23')]||!_0x338e0f['sentimentRegion']||!_0x338e0f['language']||!_0x338e0f[_0xd3f8('0x26')]){throw new db[(_0xd3f8('0x27'))][(_0xd3f8('0x28'))](_0xd3f8('0x29'));}if(!_0x442bac[_0xd3f8('0x14')]){throw new Error(_0xd3f8('0x2a'));}if(_0x338e0f['sentimentAccountId']===_0x46daf6['id']){return _0x46daf6;}else{return db[_0xd3f8('0x37')][_0xd3f8('0x2b')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x45c816){if(!_0x45c816){throw new db[(_0xd3f8('0x27'))][(_0xd3f8('0x28'))](_0xd3f8('0x2c'));}if(!_0x45c816[_0xd3f8('0xe')]||!_0x45c816[_0xd3f8('0xf')]){throw new db[(_0xd3f8('0x27'))][(_0xd3f8('0x28'))]('Cloud\x20Provider\x20not\x20configured');}_0x29c0b4=_0x45c816;logger[_0xd3f8('0xa')](util[_0xd3f8('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x442bac['id']));return sentiment(_0x29c0b4[_0xd3f8('0xe')],_0x29c0b4[_0xd3f8('0xf')],_0x338e0f[_0xd3f8('0x24')],_0x442bac[_0xd3f8('0x14')],_0x338e0f[_0xd3f8('0x25')]);})[_0xd3f8('0x11')](function(_0x4cdbe4){logger[_0xd3f8('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x442bac['id']));return _0x442bac['update']({'sentiment':_0x4cdbe4[_0xd3f8('0x2f')],'sPositive':_0x4cdbe4['SentimentScore']['Positive'],'sNegative':_0x4cdbe4[_0xd3f8('0x30')]['Negative'],'sMixed':_0x4cdbe4[_0xd3f8('0x30')][_0xd3f8('0x32')],'sNeutral':_0x4cdbe4[_0xd3f8('0x30')][_0xd3f8('0x33')],'transcribeStatus':'COMPLETED'});})[_0xd3f8('0x11')](function(){logger[_0xd3f8('0xa')](util['format'](_0xd3f8('0x1f'),_0x442bac['id']));_0x333ae9();});}})[_0xd3f8('0x38')](function(_0x381928){if(_0x381928){if(!_0x381928[_0xd3f8('0x39')]||_0x381928['name']!==_0xd3f8('0x3a')){logger[_0xd3f8('0x3b')](util[_0xd3f8('0xb')](_0xd3f8('0x3c'),_0x442bac['id']),util[_0xd3f8('0x3d')](_0x381928,{'showHidden':![],'depth':null}));}}_0x333ae9();});});}function checkTranscribe(){var _0x2668e3;var _0x21d7cc;var _0x62abb3;return db[_0xd3f8('0x3e')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xd3f8('0x11')](function(_0xf09841){if(!_0xf09841||!_0xf09841['length']){throw new db[(_0xd3f8('0x27'))][(_0xd3f8('0x28'))](_0xd3f8('0x3f'));}_0x2668e3=_0xf09841;return db[_0xd3f8('0x40')][_0xd3f8('0x2b')]({'where':{'id':0x1}});})[_0xd3f8('0x11')](function(_0x361438){if(!_0x361438){throw new db['Sequelize'][(_0xd3f8('0x28'))](_0xd3f8('0x41'));}_0x21d7cc=_0x361438;if(!_0x21d7cc[_0xd3f8('0x5')]||!_0x21d7cc[_0xd3f8('0x42')]||!_0x21d7cc[_0xd3f8('0x10')]||!_0x21d7cc[_0xd3f8('0x25')]||!_0x21d7cc['bucket']){throw new db[(_0xd3f8('0x27'))][(_0xd3f8('0x28'))](_0xd3f8('0x43'));}return db['CloudProvider'][_0xd3f8('0x2b')]({'where':{'id':_0x21d7cc[_0xd3f8('0x42')]}});})[_0xd3f8('0x11')](function(_0x1a501f){if(!_0x1a501f){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1a501f['data1']||!_0x1a501f[_0xd3f8('0xf')]){throw new db[(_0xd3f8('0x27'))]['ValidationError'](_0xd3f8('0x2d'));}_0x62abb3=_0x1a501f;var _0x27115f=[];_0x2668e3['forEach'](function(_0x3cdbd7){_0x27115f[_0xd3f8('0x44')](checkTranscribeJob(_0x3cdbd7,_0x21d7cc,_0x62abb3));});return BPromise[_0xd3f8('0x45')](_0x27115f);})['catch'](function(_0x4f872d){if(_0x4f872d){if(!_0x4f872d[_0xd3f8('0x39')]||_0x4f872d['name']!==_0xd3f8('0x3a')){logger[_0xd3f8('0x3b')](util[_0xd3f8('0x3d')](_0x4f872d,{'showHidden':![],'depth':null}));}}});}exports[_0xd3f8('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e27851c..add9a5e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f1c=['innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','hopper2','util','push','Innocenzo','Biondo'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7f1c,0xec));var _0xc7f1=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x7f1c[_0x351509];return _0x4e9861;};'use strict';var util=require(_0xc7f1('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc7f1('0x1')]({'id':i,'firstName':_0xc7f1('0x2')+i,'lastName':_0xc7f1('0x3')+i,'phone':0xf879fb460+i,'email':_0xc7f1('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc7f1('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xc7f1('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc7f1('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xc7f1('0x2')+i,'lastName':_0xc7f1('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc7f1('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc7f1('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc7f1('0x5')](),'updatedAt':Date[_0xc7f1('0x5')]()});}db[_0xc7f1('0x7')][_0xc7f1('0x8')]({'where':{}})[_0xc7f1('0x9')](function(){return db[_0xc7f1('0x7')][_0xc7f1('0xa')](contacts);})[_0xc7f1('0x9')](function(){console[_0xc7f1('0xb')](_0xc7f1('0xc'),'contacts1');return db[_0xc7f1('0xd')][_0xc7f1('0x8')]({'where':{}});})[_0xc7f1('0x9')](function(){return db[_0xc7f1('0xd')][_0xc7f1('0xa')](hopper);})[_0xc7f1('0x9')](function(){console['log'](_0xc7f1('0xc'),_0xc7f1('0xe'));return db['CmContact']['bulkCreate'](contacts2);})['then'](function(){console['log'](_0xc7f1('0xc'),'contacts2');return db[_0xc7f1('0xd')][_0xc7f1('0xa')](hopper2);})[_0xc7f1('0x9')](function(){console[_0xc7f1('0xb')](_0xc7f1('0xc'),_0xc7f1('0xf'));})['catch'](function(_0x29c90f){console[_0xc7f1('0xb')](_0x29c90f);}); \ No newline at end of file +var _0xa496=['bulkCreate','contacts1','CmHopper','log','finished\x20populating','CmContact','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa496,0x75));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6a49('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6a49('0x1')]({'id':i,'firstName':_0x6a49('0x2')+i,'lastName':_0x6a49('0x3')+i,'phone':0xf879fb460+i,'email':_0x6a49('0x4')+i+_0x6a49('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6a49('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6a49('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6a49('0x6')](),'updatedAt':Date[_0x6a49('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6a49('0x1')]({'id':i,'firstName':_0x6a49('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6a49('0x4')+i+_0x6a49('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6a49('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6a49('0x6')](),'updatedAt':Date[_0x6a49('0x6')]()});}db['CmContact'][_0x6a49('0x7')]({'where':{}})[_0x6a49('0x8')](function(){return db['CmContact'][_0x6a49('0x9')](contacts);})[_0x6a49('0x8')](function(){console['log']('finished\x20populating',_0x6a49('0xa'));return db[_0x6a49('0xb')][_0x6a49('0x7')]({'where':{}});})[_0x6a49('0x8')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0x6a49('0x8')](function(){console[_0x6a49('0xc')](_0x6a49('0xd'),'hopper1');return db[_0x6a49('0xe')][_0x6a49('0x9')](contacts2);})[_0x6a49('0x8')](function(){console[_0x6a49('0xc')](_0x6a49('0xd'),_0x6a49('0xf'));return db[_0x6a49('0xb')]['bulkCreate'](hopper2);})[_0x6a49('0x8')](function(){console[_0x6a49('0xc')](_0x6a49('0xd'),_0x6a49('0x10'));})[_0x6a49('0x11')](function(_0x26386d){console[_0x6a49('0xc')](_0x26386d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6bad219..34813c2 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c03=['/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','catch','log','../mysqldb','push','format','%s%s','agent','password','friend','udp','all','ulaw','yes'];(function(_0x2ed804,_0x1750a0){var _0x5bd11b=function(_0x38ae7d){while(--_0x38ae7d){_0x2ed804['push'](_0x2ed804['shift']());}};_0x5bd11b(++_0x1750a0);}(_0x6c03,0xec));var _0x36c0=function(_0x559df3,_0x4273b3){_0x559df3=_0x559df3-0x0;var _0x10f469=_0x6c03[_0x559df3];return _0x10f469;};'use strict';var util=require('util');var db=require(_0x36c0('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x36c0('0x1')]({'name':util[_0x36c0('0x2')](_0x36c0('0x3'),_0x36c0('0x4'),i),'fullname':util[_0x36c0('0x2')](_0x36c0('0x3'),_0x36c0('0x4'),i),'email':util[_0x36c0('0x2')]('%s%s@xcally.com',_0x36c0('0x4'),i),'role':_0x36c0('0x4'),'password':_0x36c0('0x5'),'internal':0xfa0+i,'type':_0x36c0('0x6'),'transport':[_0x36c0('0x7'),'ws','wss'],'disallow':[_0x36c0('0x8')],'allow':[_0x36c0('0x9')],'defaultuser':util[_0x36c0('0x2')](_0x36c0('0x3'),_0x36c0('0x4'),i),'encryption':_0x36c0('0xa'),'avpf':_0x36c0('0xa'),'force_avp':'yes','icesupport':_0x36c0('0xa'),'dtlsenable':_0x36c0('0xa'),'dtlsverify':'no','dtlscertfile':_0x36c0('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x36c0('0xc'),'callerid':util[_0x36c0('0x2')](_0x36c0('0xd'),util[_0x36c0('0x2')](_0x36c0('0x3'),'agent',i),0xfa0+i)});}db[_0x36c0('0xe')][_0x36c0('0xf')](users)[_0x36c0('0x10')](function(){console['log']('add\x20user');})[_0x36c0('0x11')](function(_0x4d6817){console[_0x36c0('0x12')](_0x4d6817);}); \ No newline at end of file +var _0xe14e=['User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>'];(function(_0x5be02e,_0x30bc67){var _0x26934c=function(_0x3088dc){while(--_0x3088dc){_0x5be02e['push'](_0x5be02e['shift']());}};_0x26934c(++_0x30bc67);}(_0xe14e,0x16b));var _0xee14=function(_0x3463b4,_0x400b02){_0x3463b4=_0x3463b4-0x0;var _0x24f82d=_0xe14e[_0x3463b4];return _0x24f82d;};'use strict';var util=require(_0xee14('0x0'));var db=require(_0xee14('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xee14('0x2'),_0xee14('0x3'),i),'fullname':util[_0xee14('0x4')]('%s%s',_0xee14('0x3'),i),'email':util[_0xee14('0x4')](_0xee14('0x5'),_0xee14('0x3'),i),'role':_0xee14('0x3'),'password':_0xee14('0x6'),'internal':0xfa0+i,'type':_0xee14('0x7'),'transport':[_0xee14('0x8'),'ws',_0xee14('0x9')],'disallow':['all'],'allow':[_0xee14('0xa')],'defaultuser':util[_0xee14('0x4')](_0xee14('0x2'),_0xee14('0x3'),i),'encryption':_0xee14('0xb'),'avpf':_0xee14('0xb'),'force_avp':_0xee14('0xb'),'icesupport':'yes','dtlsenable':_0xee14('0xb'),'dtlsverify':'no','dtlscertfile':_0xee14('0xc'),'dtlsprivatekey':_0xee14('0xd'),'dtlssetup':'actpass','callerid':util[_0xee14('0x4')](_0xee14('0xe'),util['format'](_0xee14('0x2'),'agent',i),0xfa0+i)});}db[_0xee14('0xf')][_0xee14('0x10')](users)[_0xee14('0x11')](function(){console[_0xee14('0x12')](_0xee14('0x13'));})[_0xee14('0x14')](function(_0x22ab9a){console[_0xee14('0x12')](_0x22ab9a);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 00a6489..eacb289 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6490=['name','User','agent','telephone','type','ivr','findOne','then','VoiceQueues','FaxQueues','SmsQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','role','Campaign','format','Agents','length','handshake','query','find','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','userProfileId','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','mail','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','lodash','util','./environment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6490,0x169));var _0x0649=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x6490[_0x1a7550];return _0x426e22;};'use strict';var _=require(_0x0649('0x0'));var util=require(_0x0649('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x0649('0x2'));var queryQueues={'attributes':['id',_0x0649('0x3')],'include':[{'as':'Agents','model':db[_0x0649('0x4')],'attributes':['id',_0x0649('0x3'),'role'],'raw':!![],'where':{'role':_0x0649('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0649('0x3')],'where':{'role':_0x0649('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0649('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x0649('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0649('0x3'),_0x0649('0x7')],'where':{'type':_0x0649('0x8')}};function getAssociatedResources(_0x17346f,_0x3181e9,_0x488302){return db['UserProfileSection'][_0x0649('0x9')]({'where':{'name':_0x17346f,'userProfileId':_0x3181e9},'raw':!![]})[_0x0649('0xa')](function(_0x13497d){if(_0x13497d){if(_0x13497d['autoAssociation']){switch(_0x17346f){case _0x0649('0xb'):case'ChatQueues':case _0x0649('0xc'):case _0x0649('0xd'):case'MailQueues':case'OpenchannelQueues':case _0x0649('0xe'):return db[_0x488302][_0x0649('0xf')](queryQueues);case _0x0649('0x10'):return db[_0x488302][_0x0649('0xf')](queryTelephones);case _0x0649('0x11'):return db[_0x488302][_0x0649('0xf')](queryTrunks);case _0x0649('0x12'):return db[_0x488302][_0x0649('0xf')](queryCampaigns);}}else{return db[_0x0649('0x13')][_0x0649('0xf')]({'attributes':[_0x0649('0x14')],'where':{'sectionId':_0x13497d['id']},'raw':!![]})[_0x0649('0xa')](function(_0x8ff318){if(_0x8ff318){var _0x4796bb={'where':{'id':_[_0x0649('0x15')](_0x8ff318,'resourceId')},'raw':!![]};switch(_0x488302){case'User':_0x4796bb['where'][_0x0649('0x16')]=_0x0649('0x6');break;case _0x0649('0x17'):_0x4796bb['where'][_0x0649('0x7')]=_0x0649('0x8');break;}return db[_0x488302][_0x0649('0xf')](_0x4796bb);}else{return[];}});}}else{return[];}})[_0x0649('0xa')](function(_0xab530b){return _0xab530b;});}function joinOrLeaveQueues(_0xa4cb19,_0xb478cd,_0x91a1b,_0x5e1a9e){_0xa4cb19[_0xb478cd](util[_0x0649('0x18')]('%s:queue:%s',_0x91a1b,_0x5e1a9e[_0x0649('0x3')]));if(_0x5e1a9e[_0x0649('0x19')]){for(var _0x24d601=0x0;_0x24d601<_0x5e1a9e[_0x0649('0x19')][_0x0649('0x1a')];_0x24d601+=0x1){_0xa4cb19[_0xb478cd](util[_0x0649('0x18')]('user:%s',_0x5e1a9e[_0x0649('0x19')][_0x24d601][_0x0649('0x3')]));}}}function joinOrLeave(_0x5160ab,_0x227c17,_0x25cad4){var _0x51f98a;if(_0x5160ab[_0x0649('0x1b')][_0x0649('0x1c')]['id']){db['User'][_0x0649('0x1d')]({'attributes':['id',_0x0649('0x3'),'role','userProfileId'],'where':{'id':_0x5160ab[_0x0649('0x1b')][_0x0649('0x1c')]['id']},'include':[{'model':db[_0x0649('0x1e')],'as':_0x0649('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x0649('0x20'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x0649('0x21'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0649('0x22')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0649('0x23')],'as':_0x0649('0x24'),'attributes':['id'],'raw':!![]}]})[_0x0649('0xa')](function(_0x1818d1){if(_0x1818d1){_0x51f98a=_0x1818d1;_0x5160ab[_0x227c17](util['format'](_0x0649('0x25'),_0x1818d1['name']));var _0x21878d=[];switch(_0x1818d1[_0x0649('0x16')]){case _0x0649('0x26'):_0x5160ab[_0x227c17](_0x0649('0x27'));_0x5160ab[_0x227c17](_0x0649('0x28'));if(queryQueues[_0x0649('0x29')](_0x0649('0x2a'))){delete queryQueues['include'];}_0x21878d['push'](db[_0x0649('0x2b')][_0x0649('0xf')](queryQueues));_0x21878d[_0x0649('0x2c')](db[_0x0649('0x2d')][_0x0649('0xf')](queryQueues));_0x21878d['push'](db[_0x0649('0x2e')]['findAll'](queryQueues));_0x21878d[_0x0649('0x2c')](db[_0x0649('0x2f')][_0x0649('0xf')](queryQueues));_0x21878d[_0x0649('0x2c')](db[_0x0649('0x30')][_0x0649('0xf')](queryQueues));_0x21878d[_0x0649('0x2c')](db[_0x0649('0x31')][_0x0649('0xf')](queryQueues));_0x21878d[_0x0649('0x2c')](db[_0x0649('0x32')][_0x0649('0xf')](queryQueues));_0x21878d[_0x0649('0x2c')](db[_0x0649('0x4')]['findAll'](queryTelephones));_0x21878d['push'](db[_0x0649('0x33')]['findAll'](queryTrunks));_0x21878d[_0x0649('0x2c')](db[_0x0649('0x17')][_0x0649('0xf')](queryCampaigns));_0x21878d[_0x0649('0x2c')](db[_0x0649('0x4')][_0x0649('0xf')](queryAgents));break;case'user':_0x5160ab[_0x227c17](_0x0649('0x27'));_0x5160ab[_0x227c17]('voice:outbound');_0x21878d['push'](getAssociatedResources('VoiceQueues',_0x1818d1['userProfileId'],'VoiceQueue'));_0x21878d[_0x0649('0x2c')](getAssociatedResources('ChatQueues',_0x1818d1[_0x0649('0x34')],'ChatQueue'));_0x21878d[_0x0649('0x2c')](getAssociatedResources(_0x0649('0xc'),_0x1818d1[_0x0649('0x34')],_0x0649('0x2e')));_0x21878d[_0x0649('0x2c')](getAssociatedResources(_0x0649('0xd'),_0x1818d1[_0x0649('0x34')],_0x0649('0x2f')));_0x21878d[_0x0649('0x2c')](getAssociatedResources('MailQueues',_0x1818d1['userProfileId'],_0x0649('0x30')));_0x21878d[_0x0649('0x2c')](getAssociatedResources('OpenchannelQueues',_0x1818d1['userProfileId'],_0x0649('0x31')));_0x21878d[_0x0649('0x2c')](getAssociatedResources(_0x0649('0xe'),_0x1818d1[_0x0649('0x34')],_0x0649('0x32')));_0x21878d[_0x0649('0x2c')](getAssociatedResources('Telephones',_0x1818d1['userProfileId'],_0x0649('0x4')));_0x21878d['push'](getAssociatedResources('Trunks',_0x1818d1[_0x0649('0x34')],_0x0649('0x33')));_0x21878d[_0x0649('0x2c')](getAssociatedResources(_0x0649('0x12'),_0x1818d1['userProfileId'],'Campaign'));_0x21878d['push'](db[_0x0649('0x4')][_0x0649('0xf')](queryAgents));break;case _0x0649('0x5'):_0x5160ab[_0x227c17](_0x0649('0x27'));_0x5160ab[_0x227c17](_0x0649('0x28'));_0x21878d['push'](_0x1818d1[_0x0649('0x35')]({'attributes':['id',_0x0649('0x3')]}));_0x21878d[_0x0649('0x2c')](_0x1818d1['getChatQueues']({'attributes':['id',_0x0649('0x3')]}));_0x21878d[_0x0649('0x2c')](_0x1818d1[_0x0649('0x36')]({'attributes':['id','name']}));_0x21878d[_0x0649('0x2c')](_0x1818d1[_0x0649('0x37')]({'attributes':['id',_0x0649('0x3')]}));_0x21878d[_0x0649('0x2c')](_0x1818d1[_0x0649('0x38')]({'attributes':['id',_0x0649('0x3')]}));_0x21878d[_0x0649('0x2c')](_0x1818d1[_0x0649('0x39')]({'attributes':['id','name']}));_0x21878d[_0x0649('0x2c')](_0x1818d1['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x0649('0x3a')](_0x21878d);}})['then'](function(_0x931cf8){if(_0x931cf8&&_0x931cf8[_0x0649('0x1a')]){for(var _0x326a7b=0x0;_0x326a7b<_0x931cf8['length'];_0x326a7b+=0x1){for(var _0x18b48e=0x0;_0x18b48e<_0x931cf8[_0x326a7b][_0x0649('0x1a')];_0x18b48e+=0x1){switch(_0x326a7b){case 0x0:joinOrLeaveQueues(_0x5160ab,_0x227c17,_0x0649('0x3b'),_0x931cf8[_0x326a7b][_0x18b48e]);break;case 0x1:joinOrLeaveQueues(_0x5160ab,_0x227c17,_0x0649('0x3c'),_0x931cf8[_0x326a7b][_0x18b48e]);break;case 0x2:joinOrLeaveQueues(_0x5160ab,_0x227c17,'fax',_0x931cf8[_0x326a7b][_0x18b48e]);break;case 0x3:joinOrLeaveQueues(_0x5160ab,_0x227c17,'sms',_0x931cf8[_0x326a7b][_0x18b48e]);break;case 0x4:joinOrLeaveQueues(_0x5160ab,_0x227c17,_0x0649('0x3d'),_0x931cf8[_0x326a7b][_0x18b48e]);break;case 0x5:joinOrLeaveQueues(_0x5160ab,_0x227c17,'openchannel',_0x931cf8[_0x326a7b][_0x18b48e]);break;case 0x6:joinOrLeaveQueues(_0x5160ab,_0x227c17,'whatsapp',_0x931cf8[_0x326a7b][_0x18b48e]);break;case 0x7:_0x5160ab[_0x227c17](util[_0x0649('0x18')]('telephone:%s',_0x931cf8[_0x326a7b][_0x18b48e][_0x0649('0x3')]));break;case 0x8:_0x5160ab[_0x227c17](util['format'](_0x0649('0x3e'),_0x931cf8[_0x326a7b][_0x18b48e][_0x0649('0x3')]));break;case 0x9:_0x5160ab[_0x227c17](util[_0x0649('0x18')](_0x0649('0x3f'),_0x931cf8[_0x326a7b][_0x18b48e][_0x0649('0x7')],_0x931cf8[_0x326a7b][_0x18b48e][_0x0649('0x3')]));break;case 0xa:_0x5160ab[_0x227c17](util[_0x0649('0x18')](_0x0649('0x25'),_0x931cf8[_0x326a7b][_0x18b48e][_0x0649('0x3')]));break;}}}}})[_0x0649('0xa')](function(){if(_0x227c17===_0x0649('0x40')){var _0x1a2de5=_[_0x0649('0x15')](_0x51f98a['ChatInteractions'],'id');return _0x51f98a[_0x0649('0x41')](_0x1a2de5)[_0x0649('0xa')](function(){for(var _0x1a7a20=0x0;_0x1a7a20<_0x1a2de5['length'];_0x1a7a20+=0x1){_0x25cad4['emit'](_0x0649('0x42'),{'ChatInteractionId':Number(_0x1a2de5[_0x1a7a20]),'UserId':Number(_0x51f98a['id'])});}});}})[_0x0649('0xa')](function(){if(_0x227c17===_0x0649('0x40')){var _0x537045=_[_0x0649('0x15')](_0x51f98a[_0x0649('0x20')],'id');return _0x51f98a['removeMailInteractions'](_0x537045)[_0x0649('0xa')](function(){for(var _0x565dcd=0x0;_0x565dcd<_0x537045[_0x0649('0x1a')];_0x565dcd+=0x1){_0x25cad4[_0x0649('0x43')](_0x0649('0x44'),{'MailInteractionId':Number(_0x537045[_0x565dcd]),'UserId':Number(_0x51f98a['id'])});}});}})[_0x0649('0xa')](function(){if(_0x227c17===_0x0649('0x40')){var _0x3fa61f=_[_0x0649('0x15')](_0x51f98a[_0x0649('0x21')],'id');return _0x51f98a[_0x0649('0x45')](_0x3fa61f)[_0x0649('0xa')](function(){for(var _0x32cb70=0x0;_0x32cb70<_0x3fa61f[_0x0649('0x1a')];_0x32cb70+=0x1){_0x25cad4[_0x0649('0x43')](_0x0649('0x46'),{'FaxInteractionId':Number(_0x3fa61f[_0x32cb70]),'UserId':Number(_0x51f98a['id'])});}});}})[_0x0649('0xa')](function(){if(_0x227c17===_0x0649('0x40')){var _0x1f21a6=_[_0x0649('0x15')](_0x51f98a[_0x0649('0x47')],'id');return _0x51f98a[_0x0649('0x48')](_0x1f21a6)[_0x0649('0xa')](function(){for(var _0x4ae98e=0x0;_0x4ae98e<_0x1f21a6[_0x0649('0x1a')];_0x4ae98e+=0x1){_0x25cad4[_0x0649('0x43')](_0x0649('0x49'),{'SmsInteractionId':Number(_0x1f21a6[_0x4ae98e]),'UserId':Number(_0x51f98a['id'])});}});}})[_0x0649('0xa')](function(){if(_0x227c17===_0x0649('0x40')){var _0x31f935=_[_0x0649('0x15')](_0x51f98a['OpenchannelInteractions'],'id');return _0x51f98a[_0x0649('0x4a')](_0x31f935)['then'](function(){for(var _0x4e3be1=0x0;_0x4e3be1<_0x31f935[_0x0649('0x1a')];_0x4e3be1+=0x1){_0x25cad4[_0x0649('0x43')](_0x0649('0x4b'),{'OpenchannelInteractionId':Number(_0x31f935[_0x4e3be1]),'UserId':Number(_0x51f98a['id'])});}});}})[_0x0649('0xa')](function(){if(_0x227c17===_0x0649('0x40')){var _0x3351a3=_[_0x0649('0x15')](_0x51f98a[_0x0649('0x24')],'id');return _0x51f98a[_0x0649('0x4c')](_0x3351a3)[_0x0649('0xa')](function(){for(var _0x5691b0=0x0;_0x5691b0<_0x3351a3[_0x0649('0x1a')];_0x5691b0+=0x1){_0x25cad4[_0x0649('0x43')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3351a3[_0x5691b0]),'UserId':Number(_0x51f98a['id'])});}});}})[_0x0649('0x4d')](function(_0x516f9b){_0x5160ab['log'](_0x516f9b);});}}function onDisconnect(_0x35f5db,_0x2f7c3f){joinOrLeave(_0x35f5db,_0x0649('0x40'),_0x2f7c3f);}function onConnect(_0x5dc0ac){joinOrLeave(_0x5dc0ac,_0x0649('0x4e'));}exports[_0x0649('0x4f')]=function(_0x4b18a3){_0x4b18a3['on'](_0x0649('0x50'),function(_0x1eb527){_0x1eb527[_0x0649('0x51')](0x0);_0x1eb527[_0x0649('0x52')]=_0x1eb527[_0x0649('0x53')][_0x0649('0x50')][_0x0649('0x54')]+':'+_0x1eb527['request'][_0x0649('0x50')][_0x0649('0x55')];_0x1eb527[_0x0649('0x56')]=new Date();_0x1eb527['log']=function(_0x3ac48f){console[_0x0649('0x57')](_0x0649('0x58')+_0x1eb527[_0x0649('0x59')][_0x0649('0x3')]+'['+_0x1eb527['address']+']',_0x3ac48f);};_0x1eb527['on'](_0x0649('0x5a'),function(){onDisconnect(_0x1eb527,_0x4b18a3);_0x1eb527[_0x0649('0x57')]('DISCONNECTED');});onConnect(_0x1eb527);_0x1eb527['log']('CONNECTED');});}; \ No newline at end of file +var _0xac3d=['push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueues','Telephones','Trunks','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','WhatsappInteractions','removeWhatsappInteractions','catch','log','join','default','address','connection','remotePort','nsp','disconnect','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','format','admin','voice:inbound','voice:outbound','hasOwnProperty','include'];(function(_0x1b857f,_0x286e31){var _0x5582e9=function(_0x643a90){while(--_0x643a90){_0x1b857f['push'](_0x1b857f['shift']());}};_0x5582e9(++_0x286e31);}(_0xac3d,0x92));var _0xdac3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdac3('0x0'));var util=require(_0xdac3('0x1'));var BPromise=require('bluebird');var db=require(_0xdac3('0x2'))['db'];var config=require(_0xdac3('0x3'));var queryQueues={'attributes':['id',_0xdac3('0x4')],'include':[{'as':_0xdac3('0x5'),'model':db[_0xdac3('0x6')],'attributes':['id',_0xdac3('0x4'),_0xdac3('0x7')],'raw':!![],'where':{'role':_0xdac3('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xdac3('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xdac3('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdac3('0x4'),_0xdac3('0xa')],'where':{'type':_0xdac3('0xb')}};function getAssociatedResources(_0x5665fd,_0x32891f,_0x40a7ba){return db[_0xdac3('0xc')][_0xdac3('0xd')]({'where':{'name':_0x5665fd,'userProfileId':_0x32891f},'raw':!![]})[_0xdac3('0xe')](function(_0x333e88){if(_0x333e88){if(_0x333e88[_0xdac3('0xf')]){switch(_0x5665fd){case _0xdac3('0x10'):case _0xdac3('0x11'):case _0xdac3('0x12'):case'SmsQueues':case _0xdac3('0x13'):case _0xdac3('0x14'):case'WhatsappQueues':return db[_0x40a7ba][_0xdac3('0x15')](queryQueues);case'Telephones':return db[_0x40a7ba][_0xdac3('0x15')](queryTelephones);case'Trunks':return db[_0x40a7ba]['findAll'](queryTrunks);case _0xdac3('0x16'):return db[_0x40a7ba][_0xdac3('0x15')](queryCampaigns);}}else{return db[_0xdac3('0x17')][_0xdac3('0x15')]({'attributes':[_0xdac3('0x18')],'where':{'sectionId':_0x333e88['id']},'raw':!![]})['then'](function(_0x189044){if(_0x189044){var _0x3a36db={'where':{'id':_[_0xdac3('0x19')](_0x189044,_0xdac3('0x18'))},'raw':!![]};switch(_0x40a7ba){case'User':_0x3a36db[_0xdac3('0x1a')][_0xdac3('0x7')]=_0xdac3('0x9');break;case _0xdac3('0x1b'):_0x3a36db[_0xdac3('0x1a')][_0xdac3('0xa')]=_0xdac3('0xb');break;}return db[_0x40a7ba][_0xdac3('0x15')](_0x3a36db);}else{return[];}});}}else{return[];}})['then'](function(_0x44175a){return _0x44175a;});}function joinOrLeaveQueues(_0x29fab9,_0x4b2438,_0x7185a9,_0x1fb398){_0x29fab9[_0x4b2438](util['format']('%s:queue:%s',_0x7185a9,_0x1fb398[_0xdac3('0x4')]));if(_0x1fb398[_0xdac3('0x5')]){for(var _0x51f9da=0x0;_0x51f9da<_0x1fb398['Agents']['length'];_0x51f9da+=0x1){_0x29fab9[_0x4b2438](util['format'](_0xdac3('0x1c'),_0x1fb398['Agents'][_0x51f9da][_0xdac3('0x4')]));}}}function joinOrLeave(_0xf3651d,_0x4fb706,_0x21f375){var _0x3bbe99;if(_0xf3651d[_0xdac3('0x1d')]['query']['id']){db['User'][_0xdac3('0x1e')]({'attributes':['id',_0xdac3('0x4'),_0xdac3('0x7'),_0xdac3('0x1f')],'where':{'id':_0xf3651d['handshake']['query']['id']},'include':[{'model':db[_0xdac3('0x20')],'as':_0xdac3('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xdac3('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xdac3('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xdac3('0x24')],'as':_0xdac3('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xdac3('0x26')],'as':_0xdac3('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xdac3('0xe')](function(_0xcb1b7e){if(_0xcb1b7e){_0x3bbe99=_0xcb1b7e;_0xf3651d[_0x4fb706](util[_0xdac3('0x28')](_0xdac3('0x1c'),_0xcb1b7e[_0xdac3('0x4')]));var _0x3098c8=[];switch(_0xcb1b7e['role']){case _0xdac3('0x29'):_0xf3651d[_0x4fb706](_0xdac3('0x2a'));_0xf3651d[_0x4fb706](_0xdac3('0x2b'));if(queryQueues[_0xdac3('0x2c')]('include')){delete queryQueues[_0xdac3('0x2d')];}_0x3098c8[_0xdac3('0x2e')](db[_0xdac3('0x2f')]['findAll'](queryQueues));_0x3098c8[_0xdac3('0x2e')](db[_0xdac3('0x30')][_0xdac3('0x15')](queryQueues));_0x3098c8[_0xdac3('0x2e')](db[_0xdac3('0x31')][_0xdac3('0x15')](queryQueues));_0x3098c8[_0xdac3('0x2e')](db[_0xdac3('0x32')][_0xdac3('0x15')](queryQueues));_0x3098c8[_0xdac3('0x2e')](db[_0xdac3('0x33')][_0xdac3('0x15')](queryQueues));_0x3098c8['push'](db[_0xdac3('0x34')][_0xdac3('0x15')](queryQueues));_0x3098c8[_0xdac3('0x2e')](db[_0xdac3('0x35')][_0xdac3('0x15')](queryQueues));_0x3098c8[_0xdac3('0x2e')](db[_0xdac3('0x6')]['findAll'](queryTelephones));_0x3098c8['push'](db[_0xdac3('0x36')]['findAll'](queryTrunks));_0x3098c8['push'](db[_0xdac3('0x1b')][_0xdac3('0x15')](queryCampaigns));_0x3098c8['push'](db[_0xdac3('0x6')][_0xdac3('0x15')](queryAgents));break;case _0xdac3('0x37'):_0xf3651d[_0x4fb706](_0xdac3('0x2a'));_0xf3651d[_0x4fb706](_0xdac3('0x2b'));_0x3098c8[_0xdac3('0x2e')](getAssociatedResources(_0xdac3('0x10'),_0xcb1b7e['userProfileId'],_0xdac3('0x2f')));_0x3098c8[_0xdac3('0x2e')](getAssociatedResources(_0xdac3('0x11'),_0xcb1b7e[_0xdac3('0x1f')],_0xdac3('0x30')));_0x3098c8[_0xdac3('0x2e')](getAssociatedResources(_0xdac3('0x12'),_0xcb1b7e[_0xdac3('0x1f')],_0xdac3('0x31')));_0x3098c8['push'](getAssociatedResources(_0xdac3('0x38'),_0xcb1b7e[_0xdac3('0x1f')],_0xdac3('0x32')));_0x3098c8[_0xdac3('0x2e')](getAssociatedResources(_0xdac3('0x13'),_0xcb1b7e[_0xdac3('0x1f')],_0xdac3('0x33')));_0x3098c8['push'](getAssociatedResources(_0xdac3('0x14'),_0xcb1b7e['userProfileId'],_0xdac3('0x34')));_0x3098c8['push'](getAssociatedResources('WhatsappQueues',_0xcb1b7e[_0xdac3('0x1f')],_0xdac3('0x35')));_0x3098c8['push'](getAssociatedResources(_0xdac3('0x39'),_0xcb1b7e['userProfileId'],_0xdac3('0x6')));_0x3098c8[_0xdac3('0x2e')](getAssociatedResources(_0xdac3('0x3a'),_0xcb1b7e[_0xdac3('0x1f')],'Trunk'));_0x3098c8[_0xdac3('0x2e')](getAssociatedResources('IvrCampaigns',_0xcb1b7e[_0xdac3('0x1f')],_0xdac3('0x1b')));_0x3098c8[_0xdac3('0x2e')](db[_0xdac3('0x6')]['findAll'](queryAgents));break;case _0xdac3('0x8'):_0xf3651d[_0x4fb706]('voice:inbound');_0xf3651d[_0x4fb706](_0xdac3('0x2b'));_0x3098c8[_0xdac3('0x2e')](_0xcb1b7e['getVoiceQueues']({'attributes':['id',_0xdac3('0x4')]}));_0x3098c8[_0xdac3('0x2e')](_0xcb1b7e[_0xdac3('0x3b')]({'attributes':['id',_0xdac3('0x4')]}));_0x3098c8[_0xdac3('0x2e')](_0xcb1b7e[_0xdac3('0x3c')]({'attributes':['id',_0xdac3('0x4')]}));_0x3098c8[_0xdac3('0x2e')](_0xcb1b7e[_0xdac3('0x3d')]({'attributes':['id',_0xdac3('0x4')]}));_0x3098c8['push'](_0xcb1b7e[_0xdac3('0x3e')]({'attributes':['id',_0xdac3('0x4')]}));_0x3098c8[_0xdac3('0x2e')](_0xcb1b7e['getOpenchannelQueues']({'attributes':['id','name']}));_0x3098c8[_0xdac3('0x2e')](_0xcb1b7e[_0xdac3('0x3f')]({'attributes':['id',_0xdac3('0x4')]}));break;}return BPromise[_0xdac3('0x40')](_0x3098c8);}})[_0xdac3('0xe')](function(_0x1cecef){if(_0x1cecef&&_0x1cecef[_0xdac3('0x41')]){for(var _0x2b6d18=0x0;_0x2b6d18<_0x1cecef[_0xdac3('0x41')];_0x2b6d18+=0x1){for(var _0x52b057=0x0;_0x52b057<_0x1cecef[_0x2b6d18][_0xdac3('0x41')];_0x52b057+=0x1){switch(_0x2b6d18){case 0x0:joinOrLeaveQueues(_0xf3651d,_0x4fb706,'voice',_0x1cecef[_0x2b6d18][_0x52b057]);break;case 0x1:joinOrLeaveQueues(_0xf3651d,_0x4fb706,_0xdac3('0x42'),_0x1cecef[_0x2b6d18][_0x52b057]);break;case 0x2:joinOrLeaveQueues(_0xf3651d,_0x4fb706,_0xdac3('0x43'),_0x1cecef[_0x2b6d18][_0x52b057]);break;case 0x3:joinOrLeaveQueues(_0xf3651d,_0x4fb706,_0xdac3('0x44'),_0x1cecef[_0x2b6d18][_0x52b057]);break;case 0x4:joinOrLeaveQueues(_0xf3651d,_0x4fb706,_0xdac3('0x45'),_0x1cecef[_0x2b6d18][_0x52b057]);break;case 0x5:joinOrLeaveQueues(_0xf3651d,_0x4fb706,'openchannel',_0x1cecef[_0x2b6d18][_0x52b057]);break;case 0x6:joinOrLeaveQueues(_0xf3651d,_0x4fb706,_0xdac3('0x46'),_0x1cecef[_0x2b6d18][_0x52b057]);break;case 0x7:_0xf3651d[_0x4fb706](util[_0xdac3('0x28')](_0xdac3('0x47'),_0x1cecef[_0x2b6d18][_0x52b057]['name']));break;case 0x8:_0xf3651d[_0x4fb706](util[_0xdac3('0x28')](_0xdac3('0x48'),_0x1cecef[_0x2b6d18][_0x52b057][_0xdac3('0x4')]));break;case 0x9:_0xf3651d[_0x4fb706](util[_0xdac3('0x28')](_0xdac3('0x49'),_0x1cecef[_0x2b6d18][_0x52b057]['type'],_0x1cecef[_0x2b6d18][_0x52b057][_0xdac3('0x4')]));break;case 0xa:_0xf3651d[_0x4fb706](util[_0xdac3('0x28')]('user:%s',_0x1cecef[_0x2b6d18][_0x52b057]['name']));break;}}}}})[_0xdac3('0xe')](function(){if(_0x4fb706===_0xdac3('0x4a')){var _0x2c3ed9=_['map'](_0x3bbe99['ChatInteractions'],'id');return _0x3bbe99[_0xdac3('0x4b')](_0x2c3ed9)[_0xdac3('0xe')](function(){for(var _0x49a639=0x0;_0x49a639<_0x2c3ed9[_0xdac3('0x41')];_0x49a639+=0x1){_0x21f375[_0xdac3('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2c3ed9[_0x49a639]),'UserId':Number(_0x3bbe99['id'])});}});}})[_0xdac3('0xe')](function(){if(_0x4fb706===_0xdac3('0x4a')){var _0xac649a=_['map'](_0x3bbe99['MailInteractions'],'id');return _0x3bbe99[_0xdac3('0x4d')](_0xac649a)[_0xdac3('0xe')](function(){for(var _0x705e0a=0x0;_0x705e0a<_0xac649a[_0xdac3('0x41')];_0x705e0a+=0x1){_0x21f375['emit'](_0xdac3('0x4e'),{'MailInteractionId':Number(_0xac649a[_0x705e0a]),'UserId':Number(_0x3bbe99['id'])});}});}})[_0xdac3('0xe')](function(){if(_0x4fb706===_0xdac3('0x4a')){var _0x5ef383=_[_0xdac3('0x19')](_0x3bbe99[_0xdac3('0x23')],'id');return _0x3bbe99[_0xdac3('0x4f')](_0x5ef383)[_0xdac3('0xe')](function(){for(var _0x130d39=0x0;_0x130d39<_0x5ef383[_0xdac3('0x41')];_0x130d39+=0x1){_0x21f375[_0xdac3('0x4c')](_0xdac3('0x50'),{'FaxInteractionId':Number(_0x5ef383[_0x130d39]),'UserId':Number(_0x3bbe99['id'])});}});}})[_0xdac3('0xe')](function(){if(_0x4fb706===_0xdac3('0x4a')){var _0xaf589e=_[_0xdac3('0x19')](_0x3bbe99[_0xdac3('0x25')],'id');return _0x3bbe99[_0xdac3('0x51')](_0xaf589e)['then'](function(){for(var _0x53cc6a=0x0;_0x53cc6a<_0xaf589e[_0xdac3('0x41')];_0x53cc6a+=0x1){_0x21f375[_0xdac3('0x4c')](_0xdac3('0x52'),{'SmsInteractionId':Number(_0xaf589e[_0x53cc6a]),'UserId':Number(_0x3bbe99['id'])});}});}})[_0xdac3('0xe')](function(){if(_0x4fb706==='leave'){var _0x452a23=_[_0xdac3('0x19')](_0x3bbe99[_0xdac3('0x27')],'id');return _0x3bbe99[_0xdac3('0x53')](_0x452a23)[_0xdac3('0xe')](function(){for(var _0x50ce8f=0x0;_0x50ce8f<_0x452a23[_0xdac3('0x41')];_0x50ce8f+=0x1){_0x21f375[_0xdac3('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x452a23[_0x50ce8f]),'UserId':Number(_0x3bbe99['id'])});}});}})[_0xdac3('0xe')](function(){if(_0x4fb706===_0xdac3('0x4a')){var _0x27fbe8=_[_0xdac3('0x19')](_0x3bbe99[_0xdac3('0x54')],'id');return _0x3bbe99[_0xdac3('0x55')](_0x27fbe8)[_0xdac3('0xe')](function(){for(var _0x50b76c=0x0;_0x50b76c<_0x27fbe8[_0xdac3('0x41')];_0x50b76c+=0x1){_0x21f375[_0xdac3('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x27fbe8[_0x50b76c]),'UserId':Number(_0x3bbe99['id'])});}});}})[_0xdac3('0x56')](function(_0x49e967){_0xf3651d[_0xdac3('0x57')](_0x49e967);});}}function onDisconnect(_0x992a99,_0x54bec0){joinOrLeave(_0x992a99,_0xdac3('0x4a'),_0x54bec0);}function onConnect(_0xf478ca){joinOrLeave(_0xf478ca,_0xdac3('0x58'));}exports[_0xdac3('0x59')]=function(_0x168f37){_0x168f37['on']('connection',function(_0xf9deeb){_0xf9deeb['setMaxListeners'](0x0);_0xf9deeb[_0xdac3('0x5a')]=_0xf9deeb['request'][_0xdac3('0x5b')]['remoteAddress']+':'+_0xf9deeb['request'][_0xdac3('0x5b')][_0xdac3('0x5c')];_0xf9deeb['connectedAt']=new Date();_0xf9deeb[_0xdac3('0x57')]=function(_0x2e8809){console[_0xdac3('0x57')]('SocketIO\x20'+_0xf9deeb[_0xdac3('0x5d')]['name']+'['+_0xf9deeb['address']+']',_0x2e8809);};_0xf9deeb['on'](_0xdac3('0x5e'),function(){onDisconnect(_0xf9deeb,_0x168f37);_0xf9deeb[_0xdac3('0x57')]('DISCONNECTED');});onConnect(_0xf9deeb);_0xf9deeb[_0xdac3('0x57')](_0xdac3('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 86ecffd..14034e2 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 _0x4f02=['opened','closed','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','../logger','client','http','Chat','newinteraction','ChatInteraction','afterUpdate','ChatMessage','afterCreate','SmsInteraction','Sms','closedinteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','Trigger,\x20%s','error','code','catch','get','channel','UserId','User','find','name','then','interface','SIP/%s','outgoingmessage','event'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f02,0x184));var _0x24f0=function(_0xb2ff30,_0x34f092){_0xb2ff30=_0xb2ff30-0x0;var _0x98e2f7=_0x4f02[_0xb2ff30];return _0x98e2f7;};'use strict';var util=require(_0x24f0('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x24f0('0x1'));var logger=require(_0x24f0('0x2'))('triggers');var client=jayson[_0x24f0('0x3')][_0x24f0('0x4')]({'port':0x232a});var triggers=[{'channel':_0x24f0('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':_0x24f0('0x6'),'callback':afterCreate},{'channel':_0x24f0('0x5'),'model':_0x24f0('0x7'),'event':_0x24f0('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x24f0('0x9'),'event':_0x24f0('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':_0x24f0('0xb'),'event':'afterCreate','condition':_0x24f0('0x6'),'callback':afterCreate},{'channel':_0x24f0('0xc'),'model':_0x24f0('0xb'),'event':_0x24f0('0x8'),'condition':_0x24f0('0xd'),'callback':afterUpdate},{'channel':_0x24f0('0xc'),'model':_0x24f0('0xe'),'event':_0x24f0('0xa'),'condition':_0x24f0('0xf'),'callback':afterCreateMessage},{'channel':_0x24f0('0x10'),'model':_0x24f0('0x11'),'event':_0x24f0('0xa'),'condition':_0x24f0('0x6'),'callback':afterCreate},{'channel':_0x24f0('0x10'),'model':_0x24f0('0x11'),'event':_0x24f0('0x8'),'condition':_0x24f0('0xd'),'callback':afterUpdate},{'channel':_0x24f0('0x10'),'model':_0x24f0('0x12'),'event':_0x24f0('0xa'),'condition':_0x24f0('0xf'),'callback':afterCreateMessage},{'channel':_0x24f0('0x13'),'model':_0x24f0('0x14'),'event':_0x24f0('0xa'),'condition':_0x24f0('0x6'),'callback':afterCreate},{'channel':_0x24f0('0x13'),'model':_0x24f0('0x14'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x24f0('0x13'),'model':_0x24f0('0x15'),'event':'afterCreate','condition':_0x24f0('0xf'),'callback':afterCreateMessage},{'channel':_0x24f0('0x16'),'model':_0x24f0('0x17'),'event':_0x24f0('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x24f0('0x16'),'model':_0x24f0('0x17'),'event':'afterUpdate','condition':_0x24f0('0xd'),'callback':afterUpdate},{'channel':_0x24f0('0x16'),'model':'MailMessage','event':_0x24f0('0xa'),'condition':_0x24f0('0xf'),'callback':afterCreateMessage},{'channel':_0x24f0('0x18'),'model':_0x24f0('0x19'),'event':_0x24f0('0xa'),'condition':_0x24f0('0x6'),'callback':afterCreate},{'channel':_0x24f0('0x18'),'model':_0x24f0('0x19'),'event':_0x24f0('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x24f0('0x18'),'model':_0x24f0('0x1a'),'event':_0x24f0('0xa'),'condition':_0x24f0('0xf'),'callback':afterCreateMessage}];function request(_0x76ca06){return client[_0x24f0('0x1b')](_0x24f0('0x1c'),_0x76ca06)['then'](function(_0x334ad7){logger['info'](_0x24f0('0x1d'),'EventManager',_0x334ad7);if(_0x334ad7['error']){if(_0x334ad7[_0x24f0('0x1e')][_0x24f0('0x1f')]===0x1f4){logger[_0x24f0('0x1e')](_0x24f0('0x1d'),'EventManager',_0x334ad7[_0x24f0('0x1e')]);}}})[_0x24f0('0x20')](function(_0x54184b){logger[_0x24f0('0x1e')](_0x24f0('0x1d'),_0x24f0('0x1c'),_0x54184b);});}function afterCreateMessage(_0xdaed38,_0x377ac0){return function(_0x5948c6,_0x56855f){_0x5948c6=_0x5948c6[_0x24f0('0x21')]({'plain':!![]});_0x5948c6[_0x24f0('0x22')]=_0xdaed38;_0x5948c6['event']=_0x5948c6['direction'];if(_0x5948c6[_0x24f0('0x23')]){return db[_0x24f0('0x24')][_0x24f0('0x25')]({'where':{'id':_0x5948c6['UserId']},'attributes':['id',_0x24f0('0x26')],'raw':!![]})[_0x24f0('0x27')](function(_0x3994ab){_0x5948c6[_0x24f0('0x28')]=util['format'](_0x24f0('0x29'),_0x3994ab['name']);_0x5948c6[_0x24f0('0x22')]=_0xdaed38;return request({'event':'incomingmessage','message':_0x5948c6});})['catch'](function(_0x1179a0){console[_0x24f0('0x1e')](_0x1179a0);});}else{return request({'event':_0x24f0('0x2a'),'message':_0x5948c6});}};}function afterCreate(_0x2618e1,_0x1c4adc){return function(_0x4c1f23,_0x634526){_0x4c1f23=_0x4c1f23[_0x24f0('0x21')]({'plain':!![]});_0x4c1f23[_0x24f0('0x22')]=_0x2618e1;_0x4c1f23[_0x24f0('0x2b')]=_0x24f0('0x2c');return request({'event':_0x1c4adc,'message':_0x4c1f23});};}function afterUpdate(_0x222166,_0x503832){return function(_0x1710df,_0x453a57){if(_0x1710df['changed']('closed')&&_0x1710df[_0x24f0('0x2d')]){_0x1710df=_0x1710df['get']({'plain':!![]});_0x1710df['channel']=_0x222166;_0x1710df['event']=_0x24f0('0x2d');if(_0x1710df[_0x24f0('0x23')]){return db[_0x24f0('0x24')][_0x24f0('0x25')]({'where':{'id':_0x1710df[_0x24f0('0x23')]},'attributes':['id',_0x24f0('0x26')],'raw':!![]})[_0x24f0('0x27')](function(_0x204157){_0x1710df[_0x24f0('0x28')]=util['format'](_0x24f0('0x29'),_0x204157['name']);return request({'event':_0x503832,'message':_0x1710df});})[_0x24f0('0x20')](function(_0x4e1b50){console[_0x24f0('0x1e')](_0x4e1b50);});}else{return request({'event':_0x503832,'message':_0x1710df});}}};}exports[_0x24f0('0x2e')]=function(){for(var _0x29675c=0x0;_0x29675c=_0x885093[_0x63e9('0x10')]){throw Error(_0x63e9('0x11'));}_0x29d4ca(_0x16b874);})['catch'](function(_0x36b470){_0x2bc985(_0x36b470);});});}; \ No newline at end of file +var _0x777a=['voice','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x777a,0x71));var _0xa777=function(_0x4f9563,_0x3ccd30){_0x4f9563=_0x4f9563-0x0;var _0x5c8eca=_0x777a[_0x4f9563];return _0x5c8eca;};'use strict';var _=require('lodash');var BPromise=require(_0xa777('0x0'));var db=require(_0xa777('0x1'))['db'];var util=require('./license/util');var channels=[_0xa777('0x2'),_0xa777('0x3'),'chat',_0xa777('0x4'),_0xa777('0x5'),_0xa777('0x6'),_0xa777('0x7')];exports[_0xa777('0x8')]=function(){return channels;};exports[_0xa777('0x9')]=function(_0x411a33){_0x411a33=_0x411a33[_0xa777('0xa')]();return _[_0xa777('0xb')](channels,_0x411a33);};exports[_0xa777('0xc')]=function(_0x47ff1d,_0x312e8f,_0x3e5a4e,_0x37ca06){var _0x33e097={'loginAttempts':_0x312e8f,'blocked':_0x3e5a4e};if(!_[_0xa777('0xd')](_0x37ca06)){_0x33e097[_0xa777('0xe')]=_0x37ca06;}return _0x47ff1d['updateAttributes'](_0x33e097);};exports['getLicense']=function(_0x11b673){return new BPromise(function(_0x544c99,_0x28d3d9){var _0x1aca50=0x0;if(_0x11b673['role']!==_0xa777('0xf')){_0x544c99(_0x11b673);}db[_0xa777('0x10')][_0xa777('0x11')]({'where':{'role':_0xa777('0xf'),'online':!![],'id':{'$ne':_0x11b673['id']}}})[_0xa777('0x12')](function(_0x93729a){_0x1aca50=_0x93729a;return util[_0xa777('0x13')]();})['then'](function(_0x2a7f99){if(_0x2a7f99&&_0x2a7f99[_0xa777('0x14')]&&_0x1aca50>=_0x2a7f99[_0xa777('0x14')]){throw Error(_0xa777('0x15'));}_0x544c99(_0x11b673);})[_0xa777('0x16')](function(_0x50a425){_0x28d3d9(_0x50a425);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 3c9e4d0..3477e1b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ed4=['status','render','json','send','exports','404'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6ed4,0xfa));var _0x46ed=function(_0x578baa,_0x19b16b){_0x578baa=_0x578baa-0x0;var _0xeac013=_0x6ed4[_0x578baa];return _0xeac013;};'use strict';module[_0x46ed('0x0')][0x194]=function pageNotFound(_0x1673ba,_0x580e3d){var _0x4f0185=_0x46ed('0x1');var _0x29a423=0x194;var _0x4c63e8={'status':_0x29a423};_0x580e3d[_0x46ed('0x2')](_0x4c63e8[_0x46ed('0x2')]);_0x580e3d[_0x46ed('0x3')](_0x4f0185,{},function(_0x1df4d7,_0x4c9dc4){if(_0x1df4d7){return _0x580e3d[_0x46ed('0x2')](_0x4c63e8[_0x46ed('0x2')])[_0x46ed('0x4')](_0x4c63e8);}_0x580e3d[_0x46ed('0x5')](_0x4c9dc4);});}; \ No newline at end of file +var _0x9e98=['render','json','send','exports','status'];(function(_0x44f641,_0x5e93a8){var _0x5036c0=function(_0x4e5a40){while(--_0x4e5a40){_0x44f641['push'](_0x44f641['shift']());}};_0x5036c0(++_0x5e93a8);}(_0x9e98,0x19d));var _0x89e9=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x9e98[_0xe501ff];return _0x17135d;};'use strict';module[_0x89e9('0x0')][0x194]=function pageNotFound(_0x51b081,_0x42aa26){var _0x578606='404';var _0x23de10=0x194;var _0x2df6fb={'status':_0x23de10};_0x42aa26[_0x89e9('0x1')](_0x2df6fb[_0x89e9('0x1')]);_0x42aa26[_0x89e9('0x2')](_0x578606,{},function(_0x1d421e,_0x502c61){if(_0x1d421e){return _0x42aa26['status'](_0x2df6fb[_0x89e9('0x1')])[_0x89e9('0x3')](_0x2df6fb);}_0x42aa26[_0x89e9('0x4')](_0x502c61);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a2e4452..ead1328 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3fe=['../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','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','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','hasMany','Recordings','UserId','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','FaxInteraction','WhatsappInteractions','Notifications','SenderId','userProfileId','Groups','chat_group_has_users','belongsToMany','CmContact','Contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','OpenchannelQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','cascade','ChanSpyId','Applications','VoiceMusicOnHold','Sound','Sounds','Members','VoiceQueueId','CmHopper','Hoppers','CmHopperBlack','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','mailbox','VoiceMailMessage','AgentReports','Contact','MailAccountId','hasOne','Imap','Smtp','Answers','List','Template','TemplateId','team_has_mail_queues','MailInteractionId','Tag','mail_interaction_has_tags','Tags','ThroughTags','Attachment','Attachments','Interaction','Account','restrict','Interval','ListId','ContactId','Dispositions','FaxAccountId','Interactions','FaxApplication','Exntensions','Owner','fax_interaction_has_tags','FaxInteractionId','AttachmentId','FaxQueueReport','Disposition','SmsAccountId','SmsMessage','TagId','SmsInteractionId','sms_interaction_has_tags','Users','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','UserOpenchannelQueue','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','ChatWebsiteId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','HopperHistories','cm_user_has_contacts','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','AllConditions','TriggerAllId','AnyConditions','AnyCondition','Fields','MetricId','Configurations','SubjectId','Descriptions','DescriptionId','AccountId','Subject','SalesforceField','Description','Field','FieldId','VariableId','SugarcrmAccount','Subjects','DeskField','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','FromId','ToId','SessionId','JscriptyAnswerReport','SmsQueueReport','ProjectId','team_has_fax_queues','team_has_openchannel_queues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport'];(function(_0x54c10d,_0x2f2251){var _0x1fa703=function(_0x508eb4){while(--_0x508eb4){_0x54c10d['push'](_0x54c10d['shift']());}};_0x1fa703(++_0x2f2251);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x182c1b,_0x358df5){_0x182c1b=_0x182c1b-0x0;var _0x4e5b8b=_0xf3fe[_0x182c1b];return _0x4e5b8b;};'use strict';var path=require('path');var config=require(_0xef3f('0x0'));var Sequelize=require(_0xef3f('0x1'));var _=require(_0xef3f('0x2'));var jstz=require(_0xef3f('0x3'));var timezone=jstz[_0xef3f('0x4')]();config['sequelize']=_[_0xef3f('0x5')](config[_0xef3f('0x1')],{'database':_0xef3f('0x6'),'username':_0xef3f('0x7'),'password':_0xef3f('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xef3f('0x9')},'logging':![],'timezone':timezone[_0xef3f('0xa')](),'define':{'charset':_0xef3f('0xb'),'collate':_0xef3f('0xc')}}});config[_0xef3f('0xd')]=_[_0xef3f('0x5')](config[_0xef3f('0xd')],{'database':_0xef3f('0x6'),'username':_0xef3f('0x7'),'password':'xC@LL1234','options':{'host':_0xef3f('0xe'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xef3f('0x9')},'logging':![],'timezone':timezone[_0xef3f('0xa')](),'define':{'charset':_0xef3f('0xb'),'collate':_0xef3f('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xef3f('0xf')],config[_0xef3f('0x1')]['username'],config[_0xef3f('0x1')]['password'],config[_0xef3f('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xef3f('0xd')][_0xef3f('0xf')],config[_0xef3f('0xd')][_0xef3f('0x10')],config[_0xef3f('0xd')][_0xef3f('0x11')],config[_0xef3f('0xd')][_0xef3f('0x12')])};db[_0xef3f('0x13')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/user/user.model');db[_0xef3f('0x15')]=db[_0xef3f('0x1')]['import'](_0xef3f('0x16'));db[_0xef3f('0x17')]=db['sequelize']['import']('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize'][_0xef3f('0x14')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xef3f('0x18')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x19'));db['VoiceRecording']=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x1a'));db[_0xef3f('0x1b')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/screenRecording/screenRecording.model');db[_0xef3f('0x1c')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x1d'));db['VoiceMailMessage']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xef3f('0x1e')]=db['sequelize'][_0xef3f('0x14')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x1f'));db[_0xef3f('0x20')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x21'));db['VoiceQueueReport']=db['sequelize']['import'](_0xef3f('0x22'));db[_0xef3f('0x23')]=db[_0xef3f('0x1')]['import'](_0xef3f('0x24'));db[_0xef3f('0x25')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/trunk/trunk.model');db[_0xef3f('0x26')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x27'));db['UserVoiceQueueRt']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x28'));db[_0xef3f('0x29')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x2a'));db[_0xef3f('0x2b')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x2c'));db[_0xef3f('0x2d')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x2e'));db['UserFaxQueue']=db[_0xef3f('0x1')]['import'](_0xef3f('0x2f'));db['UserSmsQueue']=db[_0xef3f('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x30'));db[_0xef3f('0x31')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x32'));db[_0xef3f('0x33')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x34'));db[_0xef3f('0x35')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x36'));db[_0xef3f('0x37')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x38'));db[_0xef3f('0x39')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/mailQueue/mailQueue.model');db[_0xef3f('0x3a')]=db[_0xef3f('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xef3f('0x3b')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x3c'));db[_0xef3f('0x3d')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/mailMessage/mailMessage.model');db[_0xef3f('0x3e')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x3f'));db[_0xef3f('0x40')]=db[_0xef3f('0x1')]['import'](_0xef3f('0x41'));db[_0xef3f('0x42')]=db[_0xef3f('0x1')]['import']('../api/dashboard/dashboard.model');db[_0xef3f('0x43')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0xef3f('0x44')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x45'));db['FaxApplication']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x46'));db['FaxInteraction']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x47'));db[_0xef3f('0x48')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x49'));db[_0xef3f('0x4a')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x4b'));db['FaxQueueReport']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x4c'));db['SmsAccount']=db[_0xef3f('0x1')]['import'](_0xef3f('0x4d'));db[_0xef3f('0x4e')]=db['sequelize'][_0xef3f('0x14')]('../api/smsApplication/smsApplication.model');db[_0xef3f('0x4f')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x50'));db['SmsMessage']=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x51'));db['SmsQueue']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x52'));db[_0xef3f('0x53')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x54'));db[_0xef3f('0x55')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x56'));db['OpenchannelInteraction']=db['sequelize'][_0xef3f('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xef3f('0x57')]=db['sequelize']['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xef3f('0x58')]=db[_0xef3f('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xef3f('0x59')]=db['sequelize']['import'](_0xef3f('0x5a'));db['OpenchannelQueueReport']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xef3f('0x5b')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x5c'));db['ChatInteraction']=db[_0xef3f('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x5d'));db[_0xef3f('0x5e')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x5f'));db['ChatQueue']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/chatQueue/chatQueue.model');db[_0xef3f('0x60')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x61'));db[_0xef3f('0x62')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x63'));db['CmCompany']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x64'));db['CmContact']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x65'));db['CmHopper']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x66'));db['CmHopperBlack']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x67'));db[_0xef3f('0x68')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x69'));db[_0xef3f('0x6a')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x6b'));db['ReportAgentPreview']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x6c'));db[_0xef3f('0x6d')]=db[_0xef3f('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0xef3f('0x6e')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x6f'));db[_0xef3f('0x70')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x71'));db[_0xef3f('0x72')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x73'));db['Disposition']=db['sequelize']['import'](_0xef3f('0x74'));db[_0xef3f('0x75')]=db[_0xef3f('0x1')]['import'](_0xef3f('0x76'));db['Interval']=db['sequelize']['import'](_0xef3f('0x77'));db[_0xef3f('0x78')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x79'));db[_0xef3f('0x7a')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/cdr/cdr.model');db[_0xef3f('0x7b')]=db[_0xef3f('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xef3f('0x7c')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x7d'));db['Sound']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/sound/sound.model');db['Tag']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x7e'));db['Template']=db['sequelize']['import']('../api/template/template.model');db[_0xef3f('0x7f')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x80'));db[_0xef3f('0x81')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x82'));db[_0xef3f('0x83')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x84'));db[_0xef3f('0x85')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/integrationReport/integrationReport.model');db[_0xef3f('0x86')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x87'));db[_0xef3f('0x88')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x89'));db['AnalyticExtractedReport']=db[_0xef3f('0x1')]['import'](_0xef3f('0x8a'));db[_0xef3f('0x8b')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0xef3f('0x8c')]=db['sequelize']['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0xef3f('0x8d')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x8e'));db[_0xef3f('0x8f')]=db[_0xef3f('0x1')]['import'](_0xef3f('0x90'));db[_0xef3f('0x91')]=db['sequelize']['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x92'));db['SugarcrmAccount']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x93'));db[_0xef3f('0x94')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x95'));db[_0xef3f('0x96')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x97'));db[_0xef3f('0x98')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0x99'));db[_0xef3f('0x9a')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x9b'));db['DeskField']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/intDeskField/intDeskField.model');db[_0xef3f('0x9c')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x9d'));db[_0xef3f('0x9e')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x9f'));db[_0xef3f('0xa0')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xa1'));db[_0xef3f('0xa2')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xa3'));db[_0xef3f('0xa4')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xa5'));db[_0xef3f('0xa6')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0xef3f('0xa7')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xa8'));db[_0xef3f('0xa9')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xef3f('0xaa')]=db[_0xef3f('0x1')]['import'](_0xef3f('0xab'));db[_0xef3f('0xac')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xad'));db['VtigerConfiguration']=db['sequelize'][_0xef3f('0x14')](_0xef3f('0xae'));db[_0xef3f('0xaf')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0xef3f('0xb0')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0xb1'));db[_0xef3f('0xb2')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xb3'));db[_0xef3f('0xb4')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xb5'));db[_0xef3f('0xb6')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xb7'));db[_0xef3f('0xb8')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xb9'));db['Dynamics365Field']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db['sequelize'][_0xef3f('0x14')](_0xef3f('0xba'));db['FreshsalesConfiguration']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xbb'));db['FreshsalesField']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xbc'));db[_0xef3f('0x83')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0x84'));db[_0xef3f('0xbd')]=db[_0xef3f('0x1')]['import'](_0xef3f('0xbe'));db[_0xef3f('0xbf')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xc0'));db[_0xef3f('0xc1')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xc2'));db['JscriptyAnswerReport']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xef3f('0xc3')]=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xef3f('0xc4')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xc5'));db['SmsQueueReport']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xc6'));db['SquareReport']=db['sequelize'][_0xef3f('0x14')](_0xef3f('0xc7'));db[_0xef3f('0xc8')]=db[_0xef3f('0x1')]['import'](_0xef3f('0xc9'));db[_0xef3f('0xca')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0xcb'));db[_0xef3f('0xcc')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/setting/setting.model');db[_0xef3f('0xcd')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xce'));db[_0xef3f('0xcf')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0xd0'));db[_0xef3f('0xd1')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xd2'));db[_0xef3f('0xd3')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/squareMessage/squareMessage.model');db[_0xef3f('0xd4')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xd5'));db[_0xef3f('0xd6')]=db[_0xef3f('0x1')]['import']('../api/license/license.model');db[_0xef3f('0xd7')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xd8'));db['Migration']=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/migration/migration.model');db['Attachment']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xd9'));db['Plugin']=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xda'));db[_0xef3f('0xdb')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0xef3f('0xdc')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xdd'));db[_0xef3f('0xde')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xdf'));db[_0xef3f('0xe0')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0xe1'));db[_0xef3f('0xe2')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xe3'));db[_0xef3f('0xe4')]=db['sequelize'][_0xef3f('0x14')](_0xef3f('0xe5'));db[_0xef3f('0xe6')]=db['sequelize']['import'](_0xef3f('0xe7'));db[_0xef3f('0xe8')]=db['sequelize'][_0xef3f('0x14')]('../api/userProfile/userProfile.model');db[_0xef3f('0xe9')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xea'));db[_0xef3f('0xeb')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xec'));db[_0xef3f('0xed')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/notification/notification.model');db[_0xef3f('0xee')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xef'));db[_0xef3f('0xf0')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xf1'));db[_0xef3f('0xf2')]=db[_0xef3f('0x1')][_0xef3f('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xef3f('0xf3')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xf4'));db['WhatsappQueueReport']=db[_0xef3f('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xef3f('0xf5')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xf6'));db[_0xef3f('0xf7')]=db[_0xef3f('0x1')][_0xef3f('0x14')](_0xef3f('0xf8'));db[_0xef3f('0xf9')]=db['sequelize'][_0xef3f('0x14')]('../api/cloudProvider/cloudProvider.model');db['User']['hasOne'](db['VoiceMail'],{'as':_0xef3f('0x1c'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0xef3f('0xfa')](db['VoiceRecording'],{'as':_0xef3f('0xfb'),'foreignKey':_0xef3f('0xfc')});db['User'][_0xef3f('0xfa')](db[_0xef3f('0xfd')],{'as':_0xef3f('0xfe'),'foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x13')]['hasMany'](db[_0xef3f('0xff')],{'as':_0xef3f('0x100'),'onDelete':'cascade','hooks':!![]});db[_0xef3f('0x13')][_0xef3f('0xfa')](db['CmHopperFinal'],{'as':_0xef3f('0x101'),'foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x13')][_0xef3f('0xfa')](db[_0xef3f('0x6a')],{'as':'HopperHistory','foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x13')][_0xef3f('0xfa')](db['ReportAgentPreview'],{'as':_0xef3f('0x102'),'foreignKey':'UserId'});db[_0xef3f('0x13')][_0xef3f('0xfa')](db[_0xef3f('0x103')],{'as':_0xef3f('0x104'),'foreignKey':'UserId'});db[_0xef3f('0x13')][_0xef3f('0xfa')](db[_0xef3f('0x105')],{'as':_0xef3f('0x106'),'foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x13')][_0xef3f('0xfa')](db[_0xef3f('0x4f')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xef3f('0x13')][_0xef3f('0xfa')](db[_0xef3f('0x107')],{'as':'FaxInteractions','foreignKey':_0xef3f('0xfc')});db['User']['hasMany'](db[_0xef3f('0x3b')],{'as':'MailInteractions','foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x13')][_0xef3f('0xfa')](db[_0xef3f('0xf2')],{'as':_0xef3f('0x108'),'foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x13')][_0xef3f('0xfa')](db['Notification'],{'as':_0xef3f('0x109'),'foreignKey':_0xef3f('0x10a')});db['User']['belongsTo'](db[_0xef3f('0xe8')],{'as':_0xef3f('0xe8'),'foreignKey':_0xef3f('0x10b')});db[_0xef3f('0x13')]['belongsToMany'](db['ChatGroup'],{'as':_0xef3f('0x10c'),'through':_0xef3f('0x10d')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0x10f')],{'as':_0xef3f('0x110'),'through':'cm_user_has_contacts'});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x111'),'through':_0xef3f('0x112')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0xd4')],{'through':_0xef3f('0x113')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0x3b')],{'as':_0xef3f('0x114'),'through':_0xef3f('0x115')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db['ChatInteraction'],{'as':_0xef3f('0x106'),'through':_0xef3f('0x116')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0x107')],{'as':_0xef3f('0x117'),'through':_0xef3f('0x118')});db['User']['belongsToMany'](db[_0xef3f('0x4f')],{'as':_0xef3f('0x119'),'through':'user_has_sms_interactions'});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0x103')],{'as':_0xef3f('0x104'),'through':_0xef3f('0x11a')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0xf2')],{'as':_0xef3f('0x108'),'through':_0xef3f('0x11b')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0x18')],{'as':_0xef3f('0x11c'),'through':'UserVoiceQueue','required':![]});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0x39')],{'as':_0xef3f('0x11d'),'through':_0xef3f('0x2d'),'required':![]});db['User'][_0xef3f('0x10e')](db[_0xef3f('0x11e')],{'as':_0xef3f('0x11f'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0xef3f('0x10e')](db[_0xef3f('0x4a')],{'as':_0xef3f('0x120'),'through':_0xef3f('0x121'),'required':![]});db['User'][_0xef3f('0x10e')](db[_0xef3f('0x122')],{'as':_0xef3f('0x123'),'through':'UserSmsQueue','required':![]});db['User'][_0xef3f('0x10e')](db[_0xef3f('0x58')],{'as':_0xef3f('0x124'),'through':'UserOpenchannelQueue','required':![]});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0xf7')],{'as':'WhatsappQueues','through':_0xef3f('0x31'),'required':![]});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0xe4')],{'through':_0xef3f('0x112')});db['User'][_0xef3f('0x10e')](db[_0xef3f('0xe6')],{'as':_0xef3f('0x125'),'through':_0xef3f('0x126'),'required':![]});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0x59')],{'as':_0xef3f('0x127'),'through':_0xef3f('0x128')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db['FaxAccount'],{'as':_0xef3f('0x129'),'through':_0xef3f('0x12a')});db['User'][_0xef3f('0x10e')](db['MailAccount'],{'as':'MailAccounts','through':_0xef3f('0x12b')});db[_0xef3f('0x13')]['belongsToMany'](db[_0xef3f('0x53')],{'as':'OpenchannelAccounts','through':_0xef3f('0x12c')});db[_0xef3f('0x13')][_0xef3f('0x10e')](db[_0xef3f('0x12d')],{'as':_0xef3f('0x12e'),'through':_0xef3f('0x12f')});db['User'][_0xef3f('0x10e')](db[_0xef3f('0xee')],{'as':'WhatsappAccounts','through':_0xef3f('0x130')});db['User'][_0xef3f('0x10e')](db[_0xef3f('0xcf')],{'as':_0xef3f('0x131'),'through':_0xef3f('0x132')});db[_0xef3f('0x15')][_0xef3f('0xfa')](db['VoiceExtension'],{'as':_0xef3f('0x133'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x135')});db[_0xef3f('0x17')]['hasMany'](db[_0xef3f('0xff')],{'onDelete':_0xef3f('0x134')});db[_0xef3f('0xff')][_0xef3f('0xfa')](db['VoiceExtension'],{'as':_0xef3f('0x136'),'onDelete':'cascade'});db[_0xef3f('0x137')][_0xef3f('0x10e')](db[_0xef3f('0x138')],{'as':_0xef3f('0x139'),'through':'moh_has_sounds'});db[_0xef3f('0x18')][_0xef3f('0xfa')](db[_0xef3f('0xfd')],{'as':_0xef3f('0x13a'),'foreignKey':_0xef3f('0x13b')});db[_0xef3f('0x18')][_0xef3f('0xfa')](db[_0xef3f('0x13c')],{'as':_0xef3f('0x13d'),'foreignKey':_0xef3f('0x13b')});db[_0xef3f('0x18')][_0xef3f('0xfa')](db['CmHopperFinal'],{'as':_0xef3f('0x101'),'foreignKey':_0xef3f('0x13b')});db[_0xef3f('0x18')][_0xef3f('0xfa')](db[_0xef3f('0x6a')],{'as':'HopperHistories','foreignKey':_0xef3f('0x13b')});db[_0xef3f('0x18')]['hasMany'](db[_0xef3f('0x102')],{'as':_0xef3f('0x102'),'foreignKey':_0xef3f('0x13b')});db[_0xef3f('0x18')]['hasMany'](db[_0xef3f('0x13e')],{'as':'HopperBlacks','foreignKey':_0xef3f('0x13b')});db[_0xef3f('0x18')][_0xef3f('0xfa')](db[_0xef3f('0xc4')],{'as':_0xef3f('0x13f'),'foreignKey':_0xef3f('0x13b')});db['VoiceQueue'][_0xef3f('0x140')](db[_0xef3f('0x25')],{'as':_0xef3f('0x25'),'foreignKey':_0xef3f('0x141')});db['VoiceQueue'][_0xef3f('0x140')](db[_0xef3f('0x25')],{'as':_0xef3f('0x142'),'foreignKey':_0xef3f('0x143')});db['VoiceQueue'][_0xef3f('0x140')](db['Interval'],{'as':'Interval','foreignKey':_0xef3f('0x144')});db[_0xef3f('0x18')][_0xef3f('0x140')](db[_0xef3f('0x78')],{'as':_0xef3f('0x145'),'foreignKey':_0xef3f('0x146')});db[_0xef3f('0x18')][_0xef3f('0x10e')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x111'),'through':_0xef3f('0x147')});db['VoiceQueue'][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x148'),'through':'UserVoiceQueue'});db[_0xef3f('0x18')]['belongsToMany'](db['Team'],{'as':_0xef3f('0x149'),'through':_0xef3f('0x14a')});db[_0xef3f('0x18')][_0xef3f('0x10e')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x14b'),'through':_0xef3f('0x14c')});db[_0xef3f('0x14d')]['belongsTo'](db[_0xef3f('0x13')],{'as':_0xef3f('0x13'),'foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x1b')][_0xef3f('0x140')](db['User'],{'as':_0xef3f('0x13'),'foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x1c')][_0xef3f('0xfa')](db['VoiceMailMessage'],{'as':_0xef3f('0x14e'),'onDelete':'cascade','foreignKey':_0xef3f('0x14f'),'sourceKey':_0xef3f('0x150')});db[_0xef3f('0x151')][_0xef3f('0x140')](db[_0xef3f('0x1c')],{'foreignKey':'mailboxuser','targetKey':_0xef3f('0x150')});db[_0xef3f('0x1e')][_0xef3f('0xfa')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xef3f('0x1e')][_0xef3f('0xfa')](db[_0xef3f('0x20')],{'as':_0xef3f('0x152'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xef3f('0x13')],{'as':'User','foreignKey':_0xef3f('0xfc')});db['VoiceCallReport']['belongsTo'](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':'ContactId'});db[_0xef3f('0x33')][_0xef3f('0x140')](db[_0xef3f('0x37')],{'as':'MailAccount','foreignKey':_0xef3f('0x154')});db[_0xef3f('0x35')][_0xef3f('0x140')](db[_0xef3f('0x37')],{'as':'MailAccount','foreignKey':_0xef3f('0x154')});db[_0xef3f('0x37')][_0xef3f('0x155')](db[_0xef3f('0x33')],{'as':_0xef3f('0x156'),'onDelete':_0xef3f('0x134')});db[_0xef3f('0x37')]['hasOne'](db[_0xef3f('0x35')],{'as':_0xef3f('0x157'),'onDelete':_0xef3f('0x134')});db[_0xef3f('0x37')][_0xef3f('0xfa')](db['Disposition'],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0xef3f('0x37')]['hasMany'](db[_0xef3f('0x72')],{'as':_0xef3f('0x158'),'foreignKey':_0xef3f('0x154')});db[_0xef3f('0x37')][_0xef3f('0xfa')](db['MailMessage'],{'as':_0xef3f('0x14e'),'foreignKey':_0xef3f('0x154')});db[_0xef3f('0x37')]['hasMany'](db[_0xef3f('0x3b')],{'as':'Interactions'});db[_0xef3f('0x37')][_0xef3f('0xfa')](db[_0xef3f('0x3e')],{'as':_0xef3f('0x136')});db[_0xef3f('0x37')][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':'ListId'});db[_0xef3f('0x37')][_0xef3f('0x140')](db[_0xef3f('0x15a')],{'as':_0xef3f('0x15a'),'foreignKey':_0xef3f('0x15b')});db[_0xef3f('0x37')][_0xef3f('0x140')](db[_0xef3f('0x78')],{'as':'mandatoryDispositionPause','foreignKey':_0xef3f('0x146')});db[_0xef3f('0x37')]['belongsToMany'](db[_0xef3f('0x13')],{'as':_0xef3f('0x148'),'through':'user_has_mail_accounts'});db['MailQueue'][_0xef3f('0x10e')](db['User'],{'as':_0xef3f('0x148'),'through':_0xef3f('0x2d')});db['MailQueue'][_0xef3f('0x10e')](db[_0xef3f('0xd4')],{'through':_0xef3f('0x15c'),'as':_0xef3f('0x149')});db[_0xef3f('0x3b')][_0xef3f('0xfa')](db[_0xef3f('0x3d')],{'as':_0xef3f('0x14e'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x15d')});db['MailInteraction'][_0xef3f('0x140')](db['MailAccount'],{'as':'Account','foreignKey':_0xef3f('0x154')});db[_0xef3f('0x3b')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'as':'Contact','foreignKey':'ContactId'});db[_0xef3f('0x3b')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x3b')][_0xef3f('0x10e')](db[_0xef3f('0x15e')],{'through':_0xef3f('0x15f'),'as':_0xef3f('0x160')});db[_0xef3f('0x3b')][_0xef3f('0x10e')](db['Tag'],{'through':_0xef3f('0x15f'),'as':_0xef3f('0x161')});db[_0xef3f('0x3b')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':'Users','through':_0xef3f('0x115'),'foreignKey':'MailInteractionId'});db[_0xef3f('0x3d')]['hasMany'](db[_0xef3f('0x162')],{'as':_0xef3f('0x163'),'onDelete':'cascade'});db[_0xef3f('0x3d')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'as':_0xef3f('0x13')});db[_0xef3f('0x3d')]['belongsTo'](db['CmContact'],{'onDelete':_0xef3f('0x134'),'as':_0xef3f('0x153')});db[_0xef3f('0x3d')][_0xef3f('0x140')](db[_0xef3f('0x3b')],{'as':_0xef3f('0x164'),'foreignKey':_0xef3f('0x15d')});db[_0xef3f('0x3d')][_0xef3f('0x140')](db[_0xef3f('0x37')],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x154')});db[_0xef3f('0x3e')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0x3e')][_0xef3f('0x140')](db['MailQueue'],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0x3e')]['belongsTo'](db[_0xef3f('0x37')],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0x3e')][_0xef3f('0x140')](db[_0xef3f('0x167')],{'onDelete':_0xef3f('0x166'),'foreignKey':_0xef3f('0x144')});db[_0xef3f('0x3e')][_0xef3f('0x140')](db[_0xef3f('0x15e')],{'onDelete':_0xef3f('0x166'),'foreignKey':'TagId'});db[_0xef3f('0x40')][_0xef3f('0x140')](db[_0xef3f('0x37')],{});db[_0xef3f('0x40')][_0xef3f('0x140')](db['CmList'],{'as':_0xef3f('0x159'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0x40')]['belongsTo'](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x40')][_0xef3f('0x140')](db[_0xef3f('0x3b')],{});db['MailQueueReport'][_0xef3f('0x140')](db[_0xef3f('0x3d')],{});db['MailQueueReport'][_0xef3f('0x140')](db[_0xef3f('0x13')],{});db['MailQueueReport'][_0xef3f('0x140')](db['MailQueue'],{});db[_0xef3f('0x42')][_0xef3f('0xfa')](db['DashboardItem'],{'as':'Items','onDelete':_0xef3f('0x134')});db[_0xef3f('0x44')]['hasMany'](db['Disposition'],{'as':_0xef3f('0x16a'),'foreignKey':_0xef3f('0x16b')});db[_0xef3f('0x44')][_0xef3f('0xfa')](db[_0xef3f('0x72')],{'as':_0xef3f('0x158'),'foreignKey':_0xef3f('0x16b')});db[_0xef3f('0x44')]['hasMany'](db[_0xef3f('0x107')],{'as':_0xef3f('0x16c')});db[_0xef3f('0x44')][_0xef3f('0xfa')](db[_0xef3f('0x16d')],{'as':_0xef3f('0x136')});db[_0xef3f('0x44')][_0xef3f('0xfa')](db[_0xef3f('0xff')],{'as':_0xef3f('0x16e'),'onDelete':_0xef3f('0x134')});db[_0xef3f('0x44')][_0xef3f('0xfa')](db[_0xef3f('0x48')],{'as':_0xef3f('0x14e')});db[_0xef3f('0x44')][_0xef3f('0x140')](db[_0xef3f('0x25')],{'as':_0xef3f('0x25')});db[_0xef3f('0x44')]['belongsTo'](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':'ListId'});db[_0xef3f('0x44')]['belongsTo'](db['Pause'],{'as':_0xef3f('0x145'),'foreignKey':_0xef3f('0x146')});db['FaxAccount'][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0xef3f('0x16d')][_0xef3f('0x140')](db['User'],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0x16d')]['belongsTo'](db[_0xef3f('0x4a')],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0x16d')][_0xef3f('0x140')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xef3f('0x16d')][_0xef3f('0x140')](db['Tag'],{'onDelete':_0xef3f('0x166'),'foreignKey':'TagId'});db['FaxInteraction'][_0xef3f('0xfa')](db[_0xef3f('0x48')],{'as':'Messages','onDelete':_0xef3f('0x134'),'foreignKey':'FaxInteractionId'});db[_0xef3f('0x107')][_0xef3f('0x140')](db[_0xef3f('0x44')],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x16b')});db[_0xef3f('0x107')]['belongsTo'](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db['FaxInteraction']['belongsTo'](db['User'],{'as':_0xef3f('0x16f'),'foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x107')]['belongsToMany'](db[_0xef3f('0x15e')],{'through':_0xef3f('0x170'),'as':_0xef3f('0x160')});db['FaxInteraction'][_0xef3f('0x10e')](db[_0xef3f('0x15e')],{'through':_0xef3f('0x170'),'as':_0xef3f('0x161')});db[_0xef3f('0x107')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':'Users','through':_0xef3f('0x118'),'foreignKey':_0xef3f('0x171')});db['FaxMessage'][_0xef3f('0x140')](db[_0xef3f('0x13')],{'onDelete':_0xef3f('0x134'),'as':'User'});db[_0xef3f('0x48')][_0xef3f('0x140')](db[_0xef3f('0x107')],{'as':_0xef3f('0x164'),'foreignKey':_0xef3f('0x171')});db[_0xef3f('0x48')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'onDelete':_0xef3f('0x134'),'as':_0xef3f('0x153')});db[_0xef3f('0x48')][_0xef3f('0x140')](db[_0xef3f('0x162')],{'as':_0xef3f('0x162'),'foreignKey':_0xef3f('0x172')});db[_0xef3f('0x48')]['belongsTo'](db[_0xef3f('0x44')],{'as':_0xef3f('0x165'),'foreignKey':'FaxAccountId'});db[_0xef3f('0x4a')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x148'),'through':_0xef3f('0x121')});db[_0xef3f('0x4a')][_0xef3f('0x10e')](db[_0xef3f('0xd4')],{'through':'team_has_fax_queues','as':_0xef3f('0x149')});db['FaxQueueReport'][_0xef3f('0x140')](db[_0xef3f('0x44')],{});db[_0xef3f('0x173')][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0x173')][_0xef3f('0x140')](db['CmContact'],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x173')]['belongsTo'](db[_0xef3f('0x107')],{});db['FaxQueueReport'][_0xef3f('0x140')](db['FaxMessage'],{});db[_0xef3f('0x173')][_0xef3f('0x140')](db['User'],{});db[_0xef3f('0x173')][_0xef3f('0x140')](db[_0xef3f('0x4a')],{});db[_0xef3f('0x12d')]['hasMany'](db[_0xef3f('0x174')],{'as':_0xef3f('0x16a'),'foreignKey':_0xef3f('0x175')});db['SmsAccount'][_0xef3f('0xfa')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xef3f('0x175')});db['SmsAccount'][_0xef3f('0xfa')](db[_0xef3f('0x176')],{'as':_0xef3f('0x14e'),'foreignKey':_0xef3f('0x175')});db[_0xef3f('0x12d')][_0xef3f('0xfa')](db['SmsInteraction'],{'as':_0xef3f('0x16c')});db[_0xef3f('0x12d')][_0xef3f('0xfa')](db[_0xef3f('0x4e')],{'as':'Applications'});db[_0xef3f('0x12d')][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0x12d')][_0xef3f('0x140')](db[_0xef3f('0x78')],{'as':_0xef3f('0x145'),'foreignKey':_0xef3f('0x146')});db[_0xef3f('0x12d')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xef3f('0x12f')});db['SmsApplication'][_0xef3f('0x140')](db[_0xef3f('0x13')],{'onDelete':'restrict'});db['SmsApplication'][_0xef3f('0x140')](db[_0xef3f('0x122')],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0x4e')]['belongsTo'](db[_0xef3f('0x12d')],{'onDelete':_0xef3f('0x166')});db['SmsApplication'][_0xef3f('0x140')](db[_0xef3f('0x167')],{'onDelete':_0xef3f('0x166'),'foreignKey':_0xef3f('0x144')});db[_0xef3f('0x4e')]['belongsTo'](db[_0xef3f('0x15e')],{'onDelete':'restrict','foreignKey':_0xef3f('0x177')});db[_0xef3f('0x4f')][_0xef3f('0xfa')](db[_0xef3f('0x176')],{'as':'Messages','onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x178')});db['SmsInteraction'][_0xef3f('0x140')](db[_0xef3f('0x12d')],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x175')});db[_0xef3f('0x4f')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x4f')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'as':_0xef3f('0x16f'),'foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x4f')][_0xef3f('0x10e')](db['Tag'],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0xef3f('0x4f')][_0xef3f('0x10e')](db[_0xef3f('0x15e')],{'through':_0xef3f('0x179'),'as':_0xef3f('0x161')});db['SmsInteraction'][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x17a'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0xef3f('0x176')]['belongsTo'](db['User'],{'as':'User'});db[_0xef3f('0x176')][_0xef3f('0x140')](db['CmContact'],{'onDelete':_0xef3f('0x134'),'as':'Contact'});db[_0xef3f('0x176')]['belongsTo'](db[_0xef3f('0x4f')],{'onDelete':_0xef3f('0x134'),'as':_0xef3f('0x164'),'foreignKey':'SmsInteractionId'});db[_0xef3f('0x176')]['belongsTo'](db['SmsAccount'],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x175')});db[_0xef3f('0x122')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x148'),'through':'UserSmsQueue','foreignKey':_0xef3f('0x17b')});db[_0xef3f('0x122')]['belongsToMany'](db[_0xef3f('0xd4')],{'through':_0xef3f('0x17c'),'as':_0xef3f('0x149')});db[_0xef3f('0x53')]['hasMany'](db[_0xef3f('0x174')],{'as':_0xef3f('0x16a'),'foreignKey':_0xef3f('0x17d')});db[_0xef3f('0x53')][_0xef3f('0xfa')](db[_0xef3f('0x72')],{'as':'Answers','foreignKey':_0xef3f('0x17d')});db['OpenchannelAccount']['hasMany'](db[_0xef3f('0x103')],{'as':'Interactions','foreignKey':_0xef3f('0x17d')});db['OpenchannelAccount'][_0xef3f('0xfa')](db[_0xef3f('0x57')],{'as':'Messages','foreignKey':_0xef3f('0x17d')});db[_0xef3f('0x53')][_0xef3f('0xfa')](db[_0xef3f('0x55')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':'ListId'});db[_0xef3f('0x53')][_0xef3f('0x140')](db['Pause'],{'as':_0xef3f('0x145'),'foreignKey':_0xef3f('0x146')});db[_0xef3f('0x53')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x148'),'through':_0xef3f('0x12c')});db['OpenchannelApplication'][_0xef3f('0x140')](db['User'],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0x55')][_0xef3f('0x140')](db[_0xef3f('0x58')],{'onDelete':'restrict','foreignKey':_0xef3f('0x17e')});db[_0xef3f('0x55')][_0xef3f('0x140')](db['OpenchannelAccount'],{'onDelete':_0xef3f('0x166'),'foreignKey':'OpenchannelAccountId'});db[_0xef3f('0x55')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xef3f('0x144')});db['OpenchannelApplication'][_0xef3f('0x140')](db[_0xef3f('0x15e')],{'onDelete':_0xef3f('0x166'),'foreignKey':'TagId'});db[_0xef3f('0x103')][_0xef3f('0xfa')](db[_0xef3f('0x57')],{'as':_0xef3f('0x14e'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xef3f('0x103')][_0xef3f('0x140')](db[_0xef3f('0x53')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xef3f('0x103')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'as':'Contact','foreignKey':'ContactId'});db[_0xef3f('0x103')]['belongsTo'](db[_0xef3f('0x13')],{'as':'Owner','foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x103')]['belongsToMany'](db[_0xef3f('0x15e')],{'through':_0xef3f('0x17f'),'as':'Tags'});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0xef3f('0x17f'),'as':_0xef3f('0x161')});db[_0xef3f('0x103')][_0xef3f('0x10e')](db['User'],{'as':_0xef3f('0x17a'),'through':_0xef3f('0x11a'),'foreignKey':'OpenchannelInteractionId'});db[_0xef3f('0x57')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'onDelete':'cascade','as':'User'});db[_0xef3f('0x57')]['belongsTo'](db[_0xef3f('0x10f')],{'onDelete':'cascade','as':_0xef3f('0x153')});db[_0xef3f('0x57')][_0xef3f('0x140')](db[_0xef3f('0x103')],{'onDelete':_0xef3f('0x134'),'as':_0xef3f('0x164'),'foreignKey':_0xef3f('0x180')});db[_0xef3f('0x57')]['belongsTo'](db['Attachment'],{'as':_0xef3f('0x162'),'foreignKey':_0xef3f('0x172')});db[_0xef3f('0x57')][_0xef3f('0x140')](db[_0xef3f('0x53')],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x17d')});db[_0xef3f('0x58')][_0xef3f('0x10e')](db['User'],{'as':'Agents','through':_0xef3f('0x181'),'foreignKey':'OpenchannelQueueId'});db[_0xef3f('0x58')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0xef3f('0x149')});db[_0xef3f('0x59')][_0xef3f('0xfa')](db[_0xef3f('0x174')],{'as':_0xef3f('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0xef3f('0x59')][_0xef3f('0xfa')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0xef3f('0x59')][_0xef3f('0xfa')](db[_0xef3f('0x62')],{'as':_0xef3f('0x182')});db['ChatWebsite']['hasMany'](db['ChatInteraction'],{'as':_0xef3f('0x16c')});db[_0xef3f('0x59')][_0xef3f('0xfa')](db['ChatApplication'],{'as':_0xef3f('0x136')});db[_0xef3f('0x59')][_0xef3f('0xfa')](db['ChatMessage'],{'as':_0xef3f('0x14e')});db['ChatWebsite'][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0x59')][_0xef3f('0x140')](db[_0xef3f('0x167')],{'as':_0xef3f('0x167'),'foreignKey':'IntervalId'});db['ChatWebsite']['belongsTo'](db[_0xef3f('0x78')],{'as':_0xef3f('0x145'),'foreignKey':_0xef3f('0x146')});db[_0xef3f('0x59')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x148'),'through':_0xef3f('0x128')});db[_0xef3f('0x183')][_0xef3f('0x140')](db['OpenchannelAccount'],{});db[_0xef3f('0x183')][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0x183')]['belongsTo'](db['CmContact'],{'as':_0xef3f('0x153'),'foreignKey':'ContactId'});db['OpenchannelQueueReport']['belongsTo'](db[_0xef3f('0x103')],{});db[_0xef3f('0x183')][_0xef3f('0x140')](db['OpenchannelMessage'],{});db[_0xef3f('0x183')][_0xef3f('0x140')](db['User'],{});db[_0xef3f('0x183')][_0xef3f('0x140')](db[_0xef3f('0x58')],{});db['ChatApplication'][_0xef3f('0x140')](db[_0xef3f('0x13')],{'as':_0xef3f('0x184'),'foreignKey':_0xef3f('0xfc'),'onDelete':_0xef3f('0x166')});db[_0xef3f('0x5b')][_0xef3f('0x140')](db['ChatQueue'],{'as':_0xef3f('0x185'),'foreignKey':_0xef3f('0x186'),'onDelete':'restrict'});db[_0xef3f('0x5b')][_0xef3f('0x140')](db[_0xef3f('0x59')],{'as':_0xef3f('0x187'),'foreignKey':'ChatWebsiteId','onDelete':_0xef3f('0x166')});db[_0xef3f('0x5b')][_0xef3f('0x140')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xef3f('0x177')});db['ChatInteraction'][_0xef3f('0xfa')](db[_0xef3f('0x188')],{'as':_0xef3f('0x14e'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x189')});db[_0xef3f('0x105')][_0xef3f('0x140')](db['ChatWebsite'],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x18a')});db[_0xef3f('0x105')]['belongsTo'](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db['ChatInteraction'][_0xef3f('0x140')](db[_0xef3f('0x13')],{'as':'Owner','foreignKey':_0xef3f('0xfc')});db[_0xef3f('0x105')][_0xef3f('0x10e')](db['Tag'],{'through':_0xef3f('0x18b'),'as':_0xef3f('0x160')});db[_0xef3f('0x105')][_0xef3f('0x10e')](db[_0xef3f('0x15e')],{'through':_0xef3f('0x18b'),'as':_0xef3f('0x161')});db[_0xef3f('0x105')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x17a'),'through':_0xef3f('0x116'),'foreignKey':_0xef3f('0x189')});db[_0xef3f('0x188')][_0xef3f('0x140')](db['User'],{'onDelete':_0xef3f('0x134'),'as':_0xef3f('0x13')});db[_0xef3f('0x188')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'onDelete':_0xef3f('0x134'),'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x188')]['belongsTo'](db[_0xef3f('0x105')],{'onDelete':'cascade','as':_0xef3f('0x164'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xef3f('0x140')](db[_0xef3f('0x162')],{'as':_0xef3f('0x162'),'foreignKey':_0xef3f('0x172')});db[_0xef3f('0x188')]['belongsTo'](db[_0xef3f('0x59')],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x18a')});db[_0xef3f('0x5e')]['belongsTo'](db[_0xef3f('0x10f')],{'onDelete':_0xef3f('0x134'),'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db['ChatOfflineMessage'][_0xef3f('0x140')](db[_0xef3f('0x59')],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x18a')});db['ChatQueue'][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':'Agents','through':_0xef3f('0x2b'),'hooks':!![]});db['ChatQueue'][_0xef3f('0x10e')](db[_0xef3f('0xd4')],{'through':_0xef3f('0x18c'),'as':_0xef3f('0x149')});db[_0xef3f('0x60')]['hasMany'](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xef3f('0x18d'),'onDelete':'cascade'});db['ChatGroup'][_0xef3f('0x10e')](db['User'],{'as':_0xef3f('0x13a'),'through':'chat_group_has_users'});db[_0xef3f('0x62')][_0xef3f('0x140')](db[_0xef3f('0x59')],{'as':_0xef3f('0x187'),'foreignKey':_0xef3f('0x18a')});db[_0xef3f('0x18e')][_0xef3f('0xfa')](db[_0xef3f('0x10f')],{'as':_0xef3f('0x110'),'foreignKey':_0xef3f('0x18f')});db[_0xef3f('0x10f')][_0xef3f('0xfa')](db[_0xef3f('0x13c')],{'as':_0xef3f('0x13d'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x10f')][_0xef3f('0xfa')](db['CmHopperFinal'],{'as':_0xef3f('0x101'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x10f')]['hasMany'](db['CmHopperHistory'],{'as':_0xef3f('0x190'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x10f')]['hasMany'](db[_0xef3f('0x102')],{'as':'ReportAgentPreview','foreignKey':_0xef3f('0x169')});db[_0xef3f('0x10f')][_0xef3f('0xfa')](db[_0xef3f('0xc4')],{'as':_0xef3f('0x13f'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x10f')]['hasMany'](db[_0xef3f('0x103')],{'as':_0xef3f('0x104'),'foreignKey':_0xef3f('0x169'),'onDelete':_0xef3f('0x166')});db[_0xef3f('0x10f')][_0xef3f('0xfa')](db[_0xef3f('0x105')],{'as':_0xef3f('0x106'),'foreignKey':_0xef3f('0x169'),'onDelete':_0xef3f('0x166')});db[_0xef3f('0x10f')][_0xef3f('0xfa')](db[_0xef3f('0x4f')],{'as':'SmsInteractions','foreignKey':_0xef3f('0x169'),'onDelete':_0xef3f('0x166')});db[_0xef3f('0x10f')]['hasMany'](db['FaxInteraction'],{'as':_0xef3f('0x117'),'foreignKey':_0xef3f('0x169'),'onDelete':_0xef3f('0x166')});db[_0xef3f('0x10f')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xef3f('0x169'),'onDelete':_0xef3f('0x166')});db[_0xef3f('0x10f')][_0xef3f('0x140')](db[_0xef3f('0x18e')],{'as':'Company','foreignKey':_0xef3f('0x18f')});db[_0xef3f('0x10f')][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':'ListId','onDelete':_0xef3f('0x134')});db[_0xef3f('0x10f')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x17a'),'through':_0xef3f('0x191')});db[_0xef3f('0x10f')][_0xef3f('0x10e')](db[_0xef3f('0x15e')],{'as':_0xef3f('0x160'),'through':'cm_contact_has_tags'});db[_0xef3f('0x10f')]['belongsToMany'](db[_0xef3f('0x15e')],{'through':'cm_contact_has_tags','as':_0xef3f('0x161')});db['CmHopper']['belongsTo'](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169'),'onDelete':_0xef3f('0x134')});db[_0xef3f('0x13c')][_0xef3f('0x140')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0xef3f('0x13c')][_0xef3f('0x140')](db['User'],{'as':_0xef3f('0x184'),'foreignKey':_0xef3f('0xfc')});db['CmHopper'][_0xef3f('0x140')](db[_0xef3f('0x18')],{'as':_0xef3f('0x185'),'foreignKey':'VoiceQueueId','onDelete':_0xef3f('0x134')});db[_0xef3f('0x13c')][_0xef3f('0x140')](db[_0xef3f('0xd7')],{'as':_0xef3f('0xd7'),'foreignKey':_0xef3f('0x192'),'onDelete':_0xef3f('0x134')});db[_0xef3f('0x13c')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'as':_0xef3f('0x16f'),'foreignKey':_0xef3f('0x193')});db[_0xef3f('0x13e')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169'),'onDelete':'cascade'});db[_0xef3f('0x13e')][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':'ListId','onDelete':_0xef3f('0x134')});db['CmHopperBlack'][_0xef3f('0x140')](db[_0xef3f('0x18')],{'as':'Queue','foreignKey':_0xef3f('0x13b'),'onDelete':_0xef3f('0x134')});db[_0xef3f('0x13e')][_0xef3f('0x140')](db['Campaign'],{'as':_0xef3f('0xd7'),'foreignKey':_0xef3f('0x192'),'onDelete':_0xef3f('0x134')});db[_0xef3f('0x70')][_0xef3f('0xfa')](db[_0xef3f('0x75')],{'as':{'plural':_0xef3f('0x194'),'singular':_0xef3f('0x195')},'foreignKey':_0xef3f('0x196'),'onDelete':_0xef3f('0x134'),'hooks':!![]});db[_0xef3f('0x70')][_0xef3f('0xfa')](db[_0xef3f('0x75')],{'as':{'plural':_0xef3f('0x197'),'singular':_0xef3f('0x198')},'foreignKey':_0xef3f('0x199'),'onDelete':_0xef3f('0x134'),'hooks':!![]});db['Automation'][_0xef3f('0xfa')](db['Action'],{'as':_0xef3f('0x19a'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xef3f('0x167')]['hasMany'](db[_0xef3f('0x167')],{'as':_0xef3f('0x19b'),'foreignKey':_0xef3f('0x144'),'onDelete':_0xef3f('0x134'),'hooks':!![],'required':![]});db['Interval'][_0xef3f('0xfa')](db['VoiceExtension'],{'as':_0xef3f('0x100'),'foreignKey':_0xef3f('0x144'),'onDelete':_0xef3f('0x166')});db['Interval'][_0xef3f('0xfa')](db[_0xef3f('0x3e')],{'as':_0xef3f('0x19c'),'foreignKey':_0xef3f('0x144')});db[_0xef3f('0x167')][_0xef3f('0xfa')](db[_0xef3f('0x5b')],{'as':_0xef3f('0x19d'),'foreignKey':_0xef3f('0x144')});db['Interval']['hasMany'](db[_0xef3f('0x16d')],{'as':_0xef3f('0x19e'),'foreignKey':_0xef3f('0x144')});db['Interval'][_0xef3f('0xfa')](db[_0xef3f('0x4e')],{'as':_0xef3f('0x19f'),'foreignKey':_0xef3f('0x144')});db['Schedule'][_0xef3f('0x140')](db[_0xef3f('0x37')],{});db[_0xef3f('0x7c')][_0xef3f('0x140')](db[_0xef3f('0x88')],{'foreignKey':_0xef3f('0x1a0')});db['Schedule'][_0xef3f('0x140')](db['AnalyticCustomReport'],{'foreignKey':_0xef3f('0x1a1')});db[_0xef3f('0x138')]['belongsToMany'](db[_0xef3f('0x137')],{'as':_0xef3f('0x1a2'),'through':'moh_has_sounds','onDelete':_0xef3f('0x166')});db['Tag'][_0xef3f('0x10e')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xef3f('0x15e')][_0xef3f('0x10e')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xef3f('0x15e')][_0xef3f('0x10e')](db[_0xef3f('0x3b')],{'through':'mail_interaction_has_tags'});db[_0xef3f('0x15e')][_0xef3f('0x10e')](db[_0xef3f('0x4f')],{'through':_0xef3f('0x179')});db[_0xef3f('0x15e')][_0xef3f('0x10e')](db[_0xef3f('0x107')],{'through':_0xef3f('0x170')});db[_0xef3f('0x15e')][_0xef3f('0x10e')](db[_0xef3f('0x103')],{'through':_0xef3f('0x17f')});db[_0xef3f('0x15e')][_0xef3f('0x10e')](db[_0xef3f('0xf2')],{'through':'whatsapp_interaction_has_tags'});db[_0xef3f('0x7f')][_0xef3f('0xfa')](db['Condition'],{'as':{'plural':_0xef3f('0x1a3'),'singular':'AllCondition'},'foreignKey':_0xef3f('0x1a4'),'onDelete':'cascade','hooks':!![]});db[_0xef3f('0x7f')][_0xef3f('0xfa')](db[_0xef3f('0x75')],{'as':{'plural':_0xef3f('0x1a5'),'singular':_0xef3f('0x1a6')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0xef3f('0xfa')](db[_0xef3f('0x6e')],{'as':_0xef3f('0x19a'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0xef3f('0xfa')](db[_0xef3f('0x8c')],{'as':_0xef3f('0x1a7'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1a1'),'hooks':!![]});db[_0xef3f('0x88')][_0xef3f('0xfa')](db['AnalyticFieldReport'],{'as':_0xef3f('0x1a7'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1a0')});db[_0xef3f('0x8b')][_0xef3f('0xfa')](db[_0xef3f('0x8c')],{'as':_0xef3f('0x1a7'),'onDelete':'cascade','foreignKey':_0xef3f('0x1a8')});db[_0xef3f('0x8c')][_0xef3f('0x140')](db[_0xef3f('0x8b')],{'foreignKey':'MetricId'});db[_0xef3f('0x8f')][_0xef3f('0xfa')](db[_0xef3f('0x91')],{'as':_0xef3f('0x1a9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xef3f('0x91')][_0xef3f('0xfa')](db['SalesforceField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0x91')]['hasMany'](db['SalesforceField'],{'as':_0xef3f('0x1ab'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0x91')][_0xef3f('0xfa')](db['SalesforceField'],{'as':'Fields','onDelete':_0xef3f('0x134'),'foreignKey':'FieldId'});db[_0xef3f('0x91')][_0xef3f('0x140')](db['SalesforceAccount'],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x1ad')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0xef3f('0x1ae'),'foreignKey':_0xef3f('0x1aa')});db['SalesforceField'][_0xef3f('0xfa')](db[_0xef3f('0x1af')],{'as':_0xef3f('0x1b0'),'foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0x1af')][_0xef3f('0xfa')](db['SalesforceField'],{'as':_0xef3f('0x1b1'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0x1af')][_0xef3f('0x140')](db[_0xef3f('0x81')],{'as':_0xef3f('0x81'),'foreignKey':_0xef3f('0x1b3')});db[_0xef3f('0x1b4')][_0xef3f('0xfa')](db[_0xef3f('0x94')],{'as':'Configurations','onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1ad')});db['SugarcrmConfiguration'][_0xef3f('0xfa')](db[_0xef3f('0x96')],{'as':'Subjects','onDelete':_0xef3f('0x134'),'foreignKey':'SubjectId'});db[_0xef3f('0x94')][_0xef3f('0xfa')](db[_0xef3f('0x96')],{'as':_0xef3f('0x1ab'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xef3f('0x94')][_0xef3f('0xfa')](db[_0xef3f('0x96')],{'as':_0xef3f('0x1a7'),'onDelete':'cascade','foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0x94')]['belongsTo'](db[_0xef3f('0x1b4')],{'as':'Account','foreignKey':'AccountId'});db[_0xef3f('0x96')]['hasMany'](db[_0xef3f('0x96')],{'as':_0xef3f('0x1ae'),'foreignKey':_0xef3f('0x1aa')});db['SugarcrmField'][_0xef3f('0xfa')](db[_0xef3f('0x96')],{'as':'Description','foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0x96')][_0xef3f('0xfa')](db[_0xef3f('0x96')],{'as':_0xef3f('0x1b1'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0x96')][_0xef3f('0x140')](db['Variable'],{'as':'Variable','foreignKey':_0xef3f('0x1b3')});db['DeskAccount'][_0xef3f('0xfa')](db[_0xef3f('0x9a')],{'as':_0xef3f('0x1a9'),'onDelete':'cascade','foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0x9a')]['hasMany'](db['DeskField'],{'as':_0xef3f('0x1b5'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0x9a')][_0xef3f('0xfa')](db[_0xef3f('0x1b6')],{'as':_0xef3f('0x1ab'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xef3f('0xfa')](db[_0xef3f('0x1b6')],{'as':_0xef3f('0x1a7'),'onDelete':_0xef3f('0x134'),'foreignKey':'FieldId'});db['DeskConfiguration']['belongsTo'](db[_0xef3f('0x98')],{'as':'Account','foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0x9a')][_0xef3f('0x10e')](db['Tag'],{'through':_0xef3f('0x1b7')});db[_0xef3f('0x1b6')][_0xef3f('0xfa')](db[_0xef3f('0x1b6')],{'as':_0xef3f('0x1ae'),'foreignKey':_0xef3f('0x1aa')});db['DeskField'][_0xef3f('0xfa')](db['DeskField'],{'as':_0xef3f('0x1b0'),'foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0x1b6')][_0xef3f('0xfa')](db['DeskField'],{'as':'Field','foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0x1b6')][_0xef3f('0x140')](db[_0xef3f('0x81')],{'as':_0xef3f('0x81'),'foreignKey':_0xef3f('0x1b3')});db[_0xef3f('0x9c')]['hasMany'](db['ZohoConfiguration'],{'as':_0xef3f('0x1a9'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0x9e')][_0xef3f('0xfa')](db[_0xef3f('0xa0')],{'as':_0xef3f('0x1b5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xef3f('0x9e')]['hasMany'](db[_0xef3f('0xa0')],{'as':_0xef3f('0x1ab'),'onDelete':_0xef3f('0x134'),'foreignKey':'DescriptionId'});db[_0xef3f('0x9e')][_0xef3f('0xfa')](db['ZohoField'],{'as':_0xef3f('0x1a7'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0x9e')][_0xef3f('0x140')](db['ZohoAccount'],{'as':_0xef3f('0x165'),'foreignKey':'AccountId'});db[_0xef3f('0xa0')][_0xef3f('0xfa')](db['ZohoField'],{'as':'Subject','foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0xa0')][_0xef3f('0xfa')](db[_0xef3f('0xa0')],{'as':_0xef3f('0x1b0'),'foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0xa0')]['hasMany'](db[_0xef3f('0xa0')],{'as':_0xef3f('0x1b1'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0xa0')][_0xef3f('0x140')](db[_0xef3f('0x81')],{'as':_0xef3f('0x81'),'foreignKey':_0xef3f('0x1b3')});db[_0xef3f('0xa2')][_0xef3f('0xfa')](db['ZendeskConfiguration'],{'as':_0xef3f('0x1a9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xef3f('0xa4')]['hasMany'](db[_0xef3f('0xa6')],{'as':_0xef3f('0x1b5'),'foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0xa4')][_0xef3f('0xfa')](db[_0xef3f('0xa6')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xef3f('0x1a7'),'foreignKey':'FieldId'});db[_0xef3f('0xa4')][_0xef3f('0x140')](db[_0xef3f('0xa2')],{'as':'Account','foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0xa4')]['belongsToMany'](db[_0xef3f('0x15e')],{'through':_0xef3f('0x1b8')});db[_0xef3f('0xa6')][_0xef3f('0xfa')](db[_0xef3f('0xa6')],{'as':_0xef3f('0x1ae'),'foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0xa6')][_0xef3f('0xfa')](db[_0xef3f('0xa6')],{'as':_0xef3f('0x1b0'),'foreignKey':'DescriptionId'});db[_0xef3f('0xa6')]['hasMany'](db[_0xef3f('0xa6')],{'as':'Field','foreignKey':_0xef3f('0x1b2')});db['ZendeskField'][_0xef3f('0x140')](db[_0xef3f('0x81')],{'as':_0xef3f('0x81'),'foreignKey':_0xef3f('0x1b3')});db['FreshdeskAccount'][_0xef3f('0xfa')](db[_0xef3f('0xa9')],{'as':'Configurations','onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0xa9')][_0xef3f('0xfa')](db[_0xef3f('0xaa')],{'as':_0xef3f('0x1b5'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0xa9')][_0xef3f('0xfa')](db['FreshdeskField'],{'as':_0xef3f('0x1ab'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xef3f('0xfa')](db['FreshdeskField'],{'as':_0xef3f('0x1a7'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0xa9')][_0xef3f('0x140')](db[_0xef3f('0xa7')],{'as':'Account','foreignKey':_0xef3f('0x1ad')});db['FreshdeskConfiguration'][_0xef3f('0x10e')](db[_0xef3f('0x15e')],{'through':_0xef3f('0x1b9')});db[_0xef3f('0xaa')]['hasMany'](db[_0xef3f('0xaa')],{'as':_0xef3f('0x1ae'),'foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0xaa')]['hasMany'](db[_0xef3f('0xaa')],{'as':_0xef3f('0x1b0'),'foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0xaa')]['hasMany'](db[_0xef3f('0xaa')],{'as':_0xef3f('0x1b1'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xef3f('0x140')](db[_0xef3f('0x81')],{'as':_0xef3f('0x81'),'foreignKey':'VariableId'});db[_0xef3f('0xac')]['hasMany'](db['VtigerConfiguration'],{'as':_0xef3f('0x1a9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xef3f('0x1ba')][_0xef3f('0xfa')](db[_0xef3f('0xaf')],{'as':_0xef3f('0x1b5'),'foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0x1ba')]['hasMany'](db[_0xef3f('0xaf')],{'as':_0xef3f('0x1ab'),'foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0x1ba')][_0xef3f('0xfa')](db[_0xef3f('0xaf')],{'as':_0xef3f('0x1a7'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0x1ba')]['belongsTo'](db[_0xef3f('0xac')],{'as':'Account','foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0xaf')]['hasMany'](db[_0xef3f('0xaf')],{'as':_0xef3f('0x1ae'),'foreignKey':'SubjectId'});db[_0xef3f('0xaf')][_0xef3f('0xfa')](db['VtigerField'],{'as':_0xef3f('0x1b0'),'foreignKey':'DescriptionId'});db[_0xef3f('0xaf')][_0xef3f('0xfa')](db['VtigerField'],{'as':_0xef3f('0x1b1'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0xaf')][_0xef3f('0x140')](db['Variable'],{'as':_0xef3f('0x81'),'foreignKey':'VariableId'});db[_0xef3f('0xb0')][_0xef3f('0xfa')](db[_0xef3f('0xb2')],{'as':'Configurations','onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1ad')});db['ServicenowConfiguration'][_0xef3f('0xfa')](db[_0xef3f('0xb4')],{'as':_0xef3f('0x1b5'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xef3f('0xfa')](db[_0xef3f('0xb4')],{'as':'Descriptions','foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0xb2')][_0xef3f('0xfa')](db[_0xef3f('0xb4')],{'as':_0xef3f('0x1a7'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0xb2')][_0xef3f('0x140')](db['ServicenowAccount'],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0xb4')][_0xef3f('0xfa')](db[_0xef3f('0xb4')],{'as':_0xef3f('0x1ae'),'foreignKey':_0xef3f('0x1aa')});db['ServicenowField'][_0xef3f('0xfa')](db[_0xef3f('0xb4')],{'as':_0xef3f('0x1b0'),'foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0xb4')][_0xef3f('0xfa')](db[_0xef3f('0xb4')],{'as':_0xef3f('0x1b1'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0xb4')][_0xef3f('0x140')](db[_0xef3f('0x81')],{'as':'Variable','foreignKey':_0xef3f('0x1b3')});db[_0xef3f('0xb6')]['hasMany'](db[_0xef3f('0xb8')],{'as':_0xef3f('0x1a9'),'onDelete':'cascade','foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0xb8')]['hasMany'](db[_0xef3f('0x1bb')],{'as':_0xef3f('0x1b5'),'onDelete':_0xef3f('0x134'),'foreignKey':'SubjectId'});db[_0xef3f('0xb8')][_0xef3f('0xfa')](db[_0xef3f('0x1bb')],{'as':'Descriptions','onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1ac')});db[_0xef3f('0xb8')][_0xef3f('0xfa')](db[_0xef3f('0x1bb')],{'as':_0xef3f('0x1a7'),'onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0xb8')]['belongsTo'](db[_0xef3f('0xb6')],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0x1bb')]['hasMany'](db[_0xef3f('0x1bb')],{'as':'Subject','foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0x1bb')]['hasMany'](db[_0xef3f('0x1bb')],{'as':'Description','foreignKey':_0xef3f('0x1ac')});db['Dynamics365Field'][_0xef3f('0xfa')](db[_0xef3f('0x1bb')],{'as':_0xef3f('0x1b1'),'foreignKey':'FieldId'});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xef3f('0x1b3')});db[_0xef3f('0x1bc')]['hasMany'](db[_0xef3f('0x1bd')],{'as':_0xef3f('0x1a9'),'onDelete':_0xef3f('0x134'),'foreignKey':'AccountId'});db[_0xef3f('0x1bd')]['hasMany'](db[_0xef3f('0x1be')],{'as':'Subjects','foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0x1bd')][_0xef3f('0xfa')](db[_0xef3f('0x1be')],{'as':_0xef3f('0x1ab'),'foreignKey':'DescriptionId'});db[_0xef3f('0x1bd')][_0xef3f('0xfa')](db[_0xef3f('0x1be')],{'as':'Fields','foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0x1bd')][_0xef3f('0x140')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0xef3f('0x1ad')});db[_0xef3f('0x1be')][_0xef3f('0xfa')](db[_0xef3f('0x1be')],{'as':'Subject','foreignKey':_0xef3f('0x1aa')});db[_0xef3f('0x1be')]['hasMany'](db['FreshsalesField'],{'as':_0xef3f('0x1b0'),'foreignKey':'DescriptionId'});db[_0xef3f('0x1be')][_0xef3f('0xfa')](db[_0xef3f('0x1be')],{'as':_0xef3f('0x1b1'),'foreignKey':_0xef3f('0x1b2')});db[_0xef3f('0x1be')][_0xef3f('0x140')](db[_0xef3f('0x81')],{'as':'Variable','foreignKey':_0xef3f('0x1b3')});db['ChatQueueReport'][_0xef3f('0x140')](db[_0xef3f('0x59')],{});db['ChatQueueReport']['belongsTo'](db[_0xef3f('0xe4')],{'as':'List','foreignKey':_0xef3f('0x168')});db[_0xef3f('0xbf')][_0xef3f('0x140')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xef3f('0xbf')][_0xef3f('0x140')](db['ChatInteraction'],{});db[_0xef3f('0xbf')]['belongsTo'](db[_0xef3f('0x188')],{});db[_0xef3f('0xbf')][_0xef3f('0x140')](db[_0xef3f('0x13')],{});db[_0xef3f('0xbf')][_0xef3f('0x140')](db['ChatQueue'],{});db[_0xef3f('0xc1')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0xef3f('0x1bf')});db[_0xef3f('0xc1')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0xef3f('0x1c0')});db[_0xef3f('0xc4')][_0xef3f('0xfa')](db[_0xef3f('0xc3')],{'foreignKey':_0xef3f('0x1c1'),'onDelete':_0xef3f('0x134')});db[_0xef3f('0xc4')]['hasMany'](db[_0xef3f('0x1c2')],{'foreignKey':'SessionId','onDelete':_0xef3f('0x134')});db['SmsQueueReport'][_0xef3f('0x140')](db[_0xef3f('0x12d')],{});db[_0xef3f('0x1c3')][_0xef3f('0x140')](db['CmList'],{'as':_0xef3f('0x159'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0x1c3')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db[_0xef3f('0x1c3')][_0xef3f('0x140')](db[_0xef3f('0x4f')],{});db[_0xef3f('0x1c3')][_0xef3f('0x140')](db[_0xef3f('0x176')],{});db['SmsQueueReport'][_0xef3f('0x140')](db[_0xef3f('0x13')],{});db['SmsQueueReport'][_0xef3f('0x140')](db[_0xef3f('0x122')],{});db['JscriptyProject'][_0xef3f('0xfa')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0xef3f('0xca')]['hasMany'](db[_0xef3f('0xc3')],{'foreignKey':_0xef3f('0x1c4')});db['JscriptyProject'][_0xef3f('0xfa')](db[_0xef3f('0x1c2')],{'foreignKey':'ProjectId'});db['SquareProject'][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x17a'),'through':_0xef3f('0x132')});db[_0xef3f('0xd4')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xef3f('0x113')});db[_0xef3f('0xd4')][_0xef3f('0x10e')](db[_0xef3f('0x18')],{'through':_0xef3f('0x14a'),'as':_0xef3f('0x11c')});db[_0xef3f('0xd4')][_0xef3f('0x10e')](db[_0xef3f('0x39')],{'through':'team_has_mail_queues','as':_0xef3f('0x11d')});db[_0xef3f('0xd4')][_0xef3f('0x10e')](db[_0xef3f('0x11e')],{'through':'team_has_chat_queues','as':'ChatQueues'});db['Team']['belongsToMany'](db['FaxQueue'],{'through':_0xef3f('0x1c5'),'as':'FaxQueues'});db[_0xef3f('0xd4')][_0xef3f('0x10e')](db[_0xef3f('0x122')],{'through':_0xef3f('0x17c'),'as':_0xef3f('0x123')});db[_0xef3f('0xd4')][_0xef3f('0x10e')](db[_0xef3f('0x58')],{'through':_0xef3f('0x1c6'),'as':_0xef3f('0x124')});db[_0xef3f('0xd4')][_0xef3f('0x10e')](db[_0xef3f('0xf7')],{'through':_0xef3f('0x1c7'),'as':_0xef3f('0x1c8')});db[_0xef3f('0xd7')]['hasMany'](db[_0xef3f('0x13c')],{'as':_0xef3f('0x13d'),'foreignKey':_0xef3f('0x192')});db[_0xef3f('0xd7')][_0xef3f('0xfa')](db['CmHopperFinal'],{'as':_0xef3f('0x101'),'foreignKey':'CampaignId'});db['Campaign'][_0xef3f('0xfa')](db[_0xef3f('0x6a')],{'as':_0xef3f('0x190'),'foreignKey':'CampaignId'});db['Campaign'][_0xef3f('0xfa')](db[_0xef3f('0x13e')],{'as':_0xef3f('0x1c9'),'foreignKey':'CampaignId'});db[_0xef3f('0xd7')]['belongsTo'](db[_0xef3f('0x25')],{'as':_0xef3f('0x25'),'foreignKey':_0xef3f('0x141')});db[_0xef3f('0xd7')][_0xef3f('0x140')](db['Trunk'],{'as':_0xef3f('0x142'),'foreignKey':_0xef3f('0x143')});db[_0xef3f('0xd7')]['belongsTo'](db[_0xef3f('0x167')],{'as':_0xef3f('0x167'),'foreignKey':_0xef3f('0x144')});db[_0xef3f('0xd7')][_0xef3f('0x140')](db[_0xef3f('0xcf')],{'as':_0xef3f('0xcf'),'foreignKey':_0xef3f('0x1ca')});db[_0xef3f('0xd7')]['belongsToMany'](db[_0xef3f('0xe4')],{'as':_0xef3f('0x111'),'through':_0xef3f('0x1cb')});db[_0xef3f('0xd7')]['belongsToMany'](db[_0xef3f('0xe4')],{'as':'BlackLists','through':_0xef3f('0x1cc')});db[_0xef3f('0xdb')][_0xef3f('0x140')](db['MailMessage'],{});db['MailTransferReport'][_0xef3f('0x140')](db[_0xef3f('0x3b')],{});db[_0xef3f('0xdb')][_0xef3f('0x140')](db[_0xef3f('0x37')],{'foreignKey':'FromMailAccountId','as':_0xef3f('0x1cd')});db[_0xef3f('0xdb')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'foreignKey':_0xef3f('0x1ce'),'as':_0xef3f('0x1cf')});db[_0xef3f('0xdb')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'foreignKey':_0xef3f('0x1d0'),'as':'ToAgent'});db[_0xef3f('0xdb')]['belongsTo'](db[_0xef3f('0x39')],{'foreignKey':_0xef3f('0x1d1'),'as':_0xef3f('0x1d2')});db[_0xef3f('0xdb')][_0xef3f('0x140')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0xef3f('0x1d3')});db[_0xef3f('0xdc')][_0xef3f('0x140')](db[_0xef3f('0x188')],{});db[_0xef3f('0xdc')][_0xef3f('0x140')](db['ChatInteraction'],{});db[_0xef3f('0xdc')][_0xef3f('0x140')](db[_0xef3f('0x59')],{'foreignKey':_0xef3f('0x1d4'),'as':_0xef3f('0x1cd')});db[_0xef3f('0xdc')]['belongsTo'](db[_0xef3f('0x13')],{'foreignKey':_0xef3f('0x1ce'),'as':_0xef3f('0x1cf')});db[_0xef3f('0xdc')]['belongsTo'](db[_0xef3f('0x13')],{'foreignKey':'ToUserId','as':_0xef3f('0x1d5')});db[_0xef3f('0xdc')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0xef3f('0x1d6'),'as':_0xef3f('0x1d2')});db[_0xef3f('0xdc')][_0xef3f('0x140')](db[_0xef3f('0x59')],{'foreignKey':'ToChatWebsiteId','as':_0xef3f('0x1d3')});db[_0xef3f('0xde')][_0xef3f('0x140')](db['FaxMessage'],{});db[_0xef3f('0xde')][_0xef3f('0x140')](db[_0xef3f('0x107')],{});db[_0xef3f('0xde')][_0xef3f('0x140')](db[_0xef3f('0x44')],{'foreignKey':_0xef3f('0x1d7'),'as':_0xef3f('0x1cd')});db[_0xef3f('0xde')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'foreignKey':_0xef3f('0x1ce'),'as':_0xef3f('0x1cf')});db['FaxTransferReport'][_0xef3f('0x140')](db[_0xef3f('0x13')],{'foreignKey':_0xef3f('0x1d0'),'as':_0xef3f('0x1d5')});db[_0xef3f('0xde')][_0xef3f('0x140')](db[_0xef3f('0x4a')],{'foreignKey':_0xef3f('0x1d8'),'as':_0xef3f('0x1d2')});db[_0xef3f('0xde')]['belongsTo'](db[_0xef3f('0x44')],{'foreignKey':_0xef3f('0x1d9'),'as':_0xef3f('0x1d3')});db[_0xef3f('0xe0')]['belongsTo'](db[_0xef3f('0x57')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0xef3f('0xe0')][_0xef3f('0x140')](db[_0xef3f('0x53')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0xef3f('0x140')](db[_0xef3f('0x13')],{'foreignKey':'FromUserId','as':_0xef3f('0x1cf')});db[_0xef3f('0xe0')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'foreignKey':_0xef3f('0x1d0'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0xef3f('0x140')](db['OpenchannelQueue'],{'foreignKey':_0xef3f('0x1da'),'as':_0xef3f('0x1d2')});db[_0xef3f('0xe0')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xef3f('0x1db'),'as':_0xef3f('0x1d3')});db['SmsTransferReport'][_0xef3f('0x140')](db[_0xef3f('0x176')],{});db[_0xef3f('0xe2')][_0xef3f('0x140')](db[_0xef3f('0x4f')],{});db[_0xef3f('0xe2')]['belongsTo'](db[_0xef3f('0x12d')],{'foreignKey':_0xef3f('0x1dc'),'as':'FromAccount'});db[_0xef3f('0xe2')]['belongsTo'](db[_0xef3f('0x13')],{'foreignKey':'FromUserId','as':_0xef3f('0x1cf')});db[_0xef3f('0xe2')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'foreignKey':_0xef3f('0x1d0'),'as':'ToAgent'});db[_0xef3f('0xe2')]['belongsTo'](db[_0xef3f('0x122')],{'foreignKey':_0xef3f('0x1dd'),'as':_0xef3f('0x1d2')});db[_0xef3f('0xe2')][_0xef3f('0x140')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0xef3f('0xfa')](db[_0xef3f('0x174')],{'as':_0xef3f('0x16a'),'foreignKey':_0xef3f('0x168')});db['CmList'][_0xef3f('0xfa')](db['CmCustomField'],{'as':_0xef3f('0x1de'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0xe4')][_0xef3f('0xfa')](db['CmContact'],{'as':_0xef3f('0x110'),'onDelete':_0xef3f('0x134'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['CmHopperFinal'],{'as':_0xef3f('0x101'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0xe4')][_0xef3f('0xfa')](db[_0xef3f('0x6a')],{'as':'HopperHistory','foreignKey':_0xef3f('0x168')});db[_0xef3f('0xe4')][_0xef3f('0xfa')](db['ReportAgentPreview'],{'as':_0xef3f('0x102'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0xe4')][_0xef3f('0x10e')](db[_0xef3f('0x18')],{'as':_0xef3f('0x1df'),'through':_0xef3f('0x147')});db[_0xef3f('0xe4')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':_0xef3f('0x148'),'through':_0xef3f('0x112')});db[_0xef3f('0xe6')][_0xef3f('0xfa')](db[_0xef3f('0xff')],{'as':_0xef3f('0x100'),'onDelete':'cascade'});db[_0xef3f('0xe6')][_0xef3f('0x10e')](db['User'],{'as':_0xef3f('0x148'),'through':'user_has_voice_prefixes'});db[_0xef3f('0xe8')]['hasMany'](db[_0xef3f('0x13')],{'as':_0xef3f('0x17a'),'foreignKey':_0xef3f('0x10b')});db[_0xef3f('0xe8')][_0xef3f('0xfa')](db[_0xef3f('0xe9')],{'as':_0xef3f('0x1e0'),'foreignKey':'userProfileId','onDelete':_0xef3f('0x134')});db[_0xef3f('0xe9')][_0xef3f('0xfa')](db['UserProfileResource'],{'as':_0xef3f('0x1e1'),'foreignKey':_0xef3f('0x1e2'),'onDelete':'cascade'});db[_0xef3f('0xee')][_0xef3f('0xfa')](db['Disposition'],{'as':_0xef3f('0x16a'),'foreignKey':_0xef3f('0x1e3')});db['WhatsappAccount'][_0xef3f('0xfa')](db[_0xef3f('0x72')],{'as':_0xef3f('0x158'),'foreignKey':'WhatsappAccountId'});db[_0xef3f('0xee')][_0xef3f('0xfa')](db[_0xef3f('0xf3')],{'as':_0xef3f('0x14e'),'foreignKey':'WhatsappAccountId'});db[_0xef3f('0xee')][_0xef3f('0xfa')](db[_0xef3f('0xf2')],{'as':_0xef3f('0x16c')});db[_0xef3f('0xee')]['hasMany'](db[_0xef3f('0xf0')],{'as':_0xef3f('0x136')});db['WhatsappAccount'][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':_0xef3f('0x168')});db[_0xef3f('0xee')][_0xef3f('0x140')](db[_0xef3f('0x78')],{'as':'mandatoryDispositionPause','foreignKey':_0xef3f('0x146')});db[_0xef3f('0xee')][_0xef3f('0x10e')](db[_0xef3f('0x13')],{'as':'Agents','through':_0xef3f('0x130')});db[_0xef3f('0xf0')][_0xef3f('0x140')](db['User'],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0xf0')][_0xef3f('0x140')](db['WhatsappQueue'],{'onDelete':_0xef3f('0x166')});db['WhatsappApplication']['belongsTo'](db[_0xef3f('0xee')],{'onDelete':_0xef3f('0x166')});db[_0xef3f('0xf0')][_0xef3f('0x140')](db[_0xef3f('0x167')],{'onDelete':_0xef3f('0x166'),'foreignKey':_0xef3f('0x144')});db[_0xef3f('0xf0')][_0xef3f('0x140')](db[_0xef3f('0x15e')],{'onDelete':_0xef3f('0x166'),'foreignKey':_0xef3f('0x177')});db[_0xef3f('0xf2')][_0xef3f('0xfa')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xef3f('0x134'),'foreignKey':_0xef3f('0x1e4')});db['WhatsappInteraction'][_0xef3f('0x140')](db[_0xef3f('0xee')],{'as':_0xef3f('0x165'),'foreignKey':'WhatsappAccountId'});db[_0xef3f('0xf2')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'as':_0xef3f('0x153'),'foreignKey':'ContactId'});db[_0xef3f('0xf2')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'as':_0xef3f('0x16f'),'foreignKey':_0xef3f('0xfc')});db['WhatsappInteraction']['belongsToMany'](db[_0xef3f('0x15e')],{'through':_0xef3f('0x1e5'),'as':_0xef3f('0x160')});db[_0xef3f('0xf2')]['belongsToMany'](db['Tag'],{'through':_0xef3f('0x1e5'),'as':_0xef3f('0x161')});db[_0xef3f('0xf2')]['belongsToMany'](db[_0xef3f('0x13')],{'as':_0xef3f('0x17a'),'through':_0xef3f('0x11b'),'foreignKey':_0xef3f('0x1e4')});db[_0xef3f('0xf3')]['belongsTo'](db['User'],{'as':_0xef3f('0x13')});db[_0xef3f('0xf3')][_0xef3f('0x140')](db[_0xef3f('0x10f')],{'onDelete':'cascade','as':_0xef3f('0x153')});db[_0xef3f('0xf3')][_0xef3f('0x140')](db[_0xef3f('0xf2')],{'onDelete':_0xef3f('0x134'),'as':_0xef3f('0x164'),'foreignKey':_0xef3f('0x1e4')});db[_0xef3f('0xf3')][_0xef3f('0x140')](db[_0xef3f('0xee')],{'as':_0xef3f('0x165'),'foreignKey':_0xef3f('0x1e3')});db[_0xef3f('0x1e6')][_0xef3f('0x140')](db[_0xef3f('0xee')],{});db['WhatsappQueueReport'][_0xef3f('0x140')](db[_0xef3f('0xe4')],{'as':_0xef3f('0x159'),'foreignKey':_0xef3f('0x168')});db['WhatsappQueueReport'][_0xef3f('0x140')](db['CmContact'],{'as':_0xef3f('0x153'),'foreignKey':_0xef3f('0x169')});db['WhatsappQueueReport'][_0xef3f('0x140')](db[_0xef3f('0xf2')],{});db[_0xef3f('0x1e6')][_0xef3f('0x140')](db[_0xef3f('0xf7')],{});db['WhatsappQueueReport'][_0xef3f('0x140')](db[_0xef3f('0xf3')],{});db['WhatsappQueueReport'][_0xef3f('0x140')](db[_0xef3f('0x13')],{});db[_0xef3f('0xf5')]['belongsTo'](db[_0xef3f('0xf3')],{});db['WhatsappTransferReport'][_0xef3f('0x140')](db[_0xef3f('0xf2')],{});db[_0xef3f('0xf5')][_0xef3f('0x140')](db[_0xef3f('0xee')],{'foreignKey':_0xef3f('0x1e7'),'as':_0xef3f('0x1cd')});db[_0xef3f('0xf5')][_0xef3f('0x140')](db['WhatsappAccount'],{'foreignKey':_0xef3f('0x1e8'),'as':'ToAccount'});db[_0xef3f('0xf5')][_0xef3f('0x140')](db[_0xef3f('0xf7')],{'foreignKey':_0xef3f('0x1e9'),'as':_0xef3f('0x1d2')});db[_0xef3f('0xf5')]['belongsTo'](db[_0xef3f('0x13')],{'foreignKey':_0xef3f('0x1ce'),'as':_0xef3f('0x1cf')});db[_0xef3f('0xf5')][_0xef3f('0x140')](db[_0xef3f('0x13')],{'foreignKey':'ToUserId','as':_0xef3f('0x1d5')});db[_0xef3f('0xf7')][_0xef3f('0x10e')](db['User'],{'as':'Agents','through':_0xef3f('0x31'),'foreignKey':_0xef3f('0x1ea')});db[_0xef3f('0xf7')][_0xef3f('0x10e')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0xef3f('0x149')});module[_0xef3f('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0bde=['../api/license/license.model','Campaign','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','UserId','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','cascade','hasMany','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','MailQueues','ChatQueues','UserFaxQueue','SmsQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','HopperFinals','CmHopperHistory','HopperHistories','belongsTo','TrunkId','TrunkBackup','IntervalId','Pause','mandatoryDispositionPause','Agents','Teams','team_has_voice_queues','BlackLists','ScreenRecording','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','Imap','MailServerOut','Smtp','Answers','MailMessage','MailApplication','Applications','List','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Contact','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','restrict','Items','Dispositions','FaxAccountId','FaxAccount','Interactions','Exntensions','FaxApplication','FaxInteractionId','Owner','fax_interaction_has_tags','Users','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','TagId','OpenchannelInteractionId','openchannel_interaction_has_tags','Attachment','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatMessage','Agent','Website','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatGroupId','CompanyId','Hoppers','Company','cm_contact_has_tags','Queue','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','Intervals','MailApplications','ChatApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZendeskConfiguration','ZendeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','Dynamics365Account','FreshsalesAccount','FromId','ToId','SessionId','SmsQueueReport','ProjectId','VoiceQueues','FaxQueues','OpenchannelQueues','team_has_whatsapp_queues','CampaignId','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToQueue','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','ToWhatsappAccountId','WhatsappQueueId','exports','path','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','options','password','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../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','Team','../api/team/team.model','License'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0xe0bd('0x0'));var config=require('../config/environment');var Sequelize=require(_0xe0bd('0x1'));var _=require(_0xe0bd('0x2'));var jstz=require('jstz');var timezone=jstz[_0xe0bd('0x3')]();config[_0xe0bd('0x1')]=_[_0xe0bd('0x4')](config['sequelize'],{'database':_0xe0bd('0x5'),'username':_0xe0bd('0x6'),'password':_0xe0bd('0x7'),'options':{'host':_0xe0bd('0x8'),'port':0xcea,'dialect':_0xe0bd('0x9'),'dialectOptions':{'charset':_0xe0bd('0xa')},'logging':![],'timezone':timezone[_0xe0bd('0xb')](),'define':{'charset':_0xe0bd('0xc'),'collate':_0xe0bd('0xd')}}});config[_0xe0bd('0xe')]=_[_0xe0bd('0x4')](config[_0xe0bd('0xe')],{'database':_0xe0bd('0x5'),'username':'xcall','password':_0xe0bd('0x7'),'options':{'host':_0xe0bd('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xe0bd('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe0bd('0xc'),'collate':_0xe0bd('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe0bd('0x1')][_0xe0bd('0xf')],config[_0xe0bd('0x1')][_0xe0bd('0x10')],config[_0xe0bd('0x1')]['password'],config[_0xe0bd('0x1')][_0xe0bd('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe0bd('0xe')]['database'],config[_0xe0bd('0xe')]['username'],config[_0xe0bd('0xe')][_0xe0bd('0x12')],config[_0xe0bd('0xe')][_0xe0bd('0x11')])};db[_0xe0bd('0x13')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x15'));db['VoiceChanSpy']=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x16'));db[_0xe0bd('0x17')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x18'));db['VoiceExtension']=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x19'));db[_0xe0bd('0x1a')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x1b'));db[_0xe0bd('0x1c')]=db['sequelize']['import'](_0xe0bd('0x1d'));db[_0xe0bd('0x1e')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x1f'));db['ScreenRecording']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x20'));db[_0xe0bd('0x21')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x22'));db[_0xe0bd('0x23')]=db['sequelize'][_0xe0bd('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe0bd('0x24')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x25'));db[_0xe0bd('0x26')]=db['sequelize'][_0xe0bd('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xe0bd('0x27')]=db[_0xe0bd('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0xe0bd('0x28')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x29'));db[_0xe0bd('0x2a')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/memberReport/memberReport.model');db[_0xe0bd('0x2b')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x2c'));db[_0xe0bd('0x2d')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x2e'));db[_0xe0bd('0x2f')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x30'));db[_0xe0bd('0x31')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x32'));db[_0xe0bd('0x33')]=db[_0xe0bd('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x34'));db[_0xe0bd('0x35')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0xe0bd('0x36')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xe0bd('0x37')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x38'));db[_0xe0bd('0x39')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x3a'));db['MailServerOut']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x3b'));db[_0xe0bd('0x3c')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x3d'));db[_0xe0bd('0x3e')]=db['sequelize']['import'](_0xe0bd('0x3f'));db[_0xe0bd('0x40')]=db[_0xe0bd('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xe0bd('0x41')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x42'));db['MailMessage']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x43'));db['MailApplication']=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x44'));db[_0xe0bd('0x45')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x46'));db[_0xe0bd('0x47')]=db[_0xe0bd('0x1')]['import']('../api/dashboard/dashboard.model');db[_0xe0bd('0x48')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x49'));db['FaxAccount']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x4a'));db['FaxApplication']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x4b'));db[_0xe0bd('0x4c')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x4d'));db[_0xe0bd('0x4e')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x4f'));db[_0xe0bd('0x50')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x51'));db[_0xe0bd('0x52')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x53'));db[_0xe0bd('0x54')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x55'));db['SmsApplication']=db[_0xe0bd('0x1')]['import']('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0xe0bd('0x1')]['import']('../api/smsInteraction/smsInteraction.model');db[_0xe0bd('0x56')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x57'));db[_0xe0bd('0x58')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x59'));db[_0xe0bd('0x5a')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x5b'));db['OpenchannelApplication']=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x5c'));db[_0xe0bd('0x5d')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x5e'));db[_0xe0bd('0x5f')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x60'));db[_0xe0bd('0x61')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x62'));db[_0xe0bd('0x63')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x64'));db[_0xe0bd('0x65')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xe0bd('0x66')]=db['sequelize']['import']('../api/chatApplication/chatApplication.model');db[_0xe0bd('0x67')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x68'));db['ChatMessage']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x69'));db[_0xe0bd('0x6a')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x6b'));db[_0xe0bd('0x6c')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x6d'));db[_0xe0bd('0x6e')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x6f'));db['ChatProactiveAction']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x70'));db[_0xe0bd('0x71')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x72'));db[_0xe0bd('0x73')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x74'));db['CmHopper']=db['sequelize']['import'](_0xe0bd('0x75'));db[_0xe0bd('0x76')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x77'));db[_0xe0bd('0x78')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x79'));db['CmHopperHistory']=db[_0xe0bd('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xe0bd('0x7a')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x7b'));db[_0xe0bd('0x7c')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0xe0bd('0x7d')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/action/action.model');db[_0xe0bd('0x7e')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x7f'));db[_0xe0bd('0x80')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0xe0bd('0x81')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x82'));db[_0xe0bd('0x83')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x84'));db[_0xe0bd('0x85')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x86'));db['Pause']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x87'));db[_0xe0bd('0x88')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x89'));db['VoiceQueuesLog']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x8a'));db['Schedule']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x8b'));db[_0xe0bd('0x8c')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x8d'));db[_0xe0bd('0x8e')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/tag/tag.model');db[_0xe0bd('0x8f')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x90'));db[_0xe0bd('0x91')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x92'));db[_0xe0bd('0x93')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/variable/variable.model');db[_0xe0bd('0x94')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/integration/integration.model');db[_0xe0bd('0x95')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/integrationReport/integrationReport.model');db[_0xe0bd('0x96')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x97'));db[_0xe0bd('0x98')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x99'));db[_0xe0bd('0x9a')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x9b'));db[_0xe0bd('0x9c')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x9d'));db[_0xe0bd('0x9e')]=db[_0xe0bd('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x9f'));db[_0xe0bd('0xa0')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xe0bd('0xa1')]=db['sequelize']['import'](_0xe0bd('0xa2'));db[_0xe0bd('0xa3')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xa4'));db[_0xe0bd('0xa5')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xa6'));db[_0xe0bd('0xa7')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xa8'));db[_0xe0bd('0xa9')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xaa'));db['DeskConfiguration']=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xab'));db[_0xe0bd('0xac')]=db['sequelize']['import']('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xad'));db[_0xe0bd('0xae')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xaf'));db[_0xe0bd('0xb0')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xb1'));db[_0xe0bd('0xb2')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xb3'));db['ZendeskConfiguration']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xb4'));db['ZendeskField']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xb5'));db['FreshdeskAccount']=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xe0bd('0xb6')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xb7'));db[_0xe0bd('0xb8')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xb9'));db[_0xe0bd('0xba')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xbb'));db[_0xe0bd('0xbc')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xe0bd('0xbd')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xbe'));db[_0xe0bd('0xbf')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xc0'));db[_0xe0bd('0xc1')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xc2'));db[_0xe0bd('0xc3')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xc4'));db['Dynamics365Account']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xc5'));db[_0xe0bd('0xc6')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xc7'));db[_0xe0bd('0xc8')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xc9'));db['FreshsalesAccount']=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xe0bd('0xca')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xcb'));db[_0xe0bd('0xcc')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xe0bd('0x94')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/integration/integration.model');db[_0xe0bd('0xcd')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xce'));db[_0xe0bd('0xcf')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0xe0bd('0xd0')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xd1'));db[_0xe0bd('0xd2')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xd3'));db[_0xe0bd('0xd4')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xe0bd('0xd5')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xd6'));db['SmsQueueReport']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xd7'));db['SquareReport']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xd8'));db[_0xe0bd('0xd9')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xda'));db[_0xe0bd('0xdb')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xdc'));db[_0xe0bd('0xdd')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xde'));db[_0xe0bd('0xdf')]=db['sequelize']['import'](_0xe0bd('0xe0'));db['SquareProject']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xe1'));db[_0xe0bd('0xe2')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xe3'));db[_0xe0bd('0xe4')]=db[_0xe0bd('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0xe0bd('0xe5')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xe6'));db[_0xe0bd('0xe7')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xe8'));db[_0xe0bd('0xe9')]=db[_0xe0bd('0x1')]['import']('../api/campaign/campaign.model');db[_0xe0bd('0xea')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xeb'));db['Attachment']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xec'));db['Plugin']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xed'));db[_0xe0bd('0xee')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xef'));db[_0xe0bd('0xf0')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xf1'));db[_0xe0bd('0xf2')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xf3'));db[_0xe0bd('0xf4')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xf5'));db[_0xe0bd('0xf6')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xf7'));db[_0xe0bd('0xf8')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/cmList/cmList.model');db[_0xe0bd('0xf9')]=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0xfa'));db[_0xe0bd('0xfb')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xfc'));db[_0xe0bd('0xfd')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0xfe'));db[_0xe0bd('0xff')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x100'));db[_0xe0bd('0x101')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x102'));db['WhatsappAccount']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x103'));db[_0xe0bd('0x104')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0xe0bd('0x105')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x106'));db[_0xe0bd('0x107')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x108'));db['WhatsappQueueReport']=db[_0xe0bd('0x1')][_0xe0bd('0x14')](_0xe0bd('0x109'));db[_0xe0bd('0x10a')]=db[_0xe0bd('0x1')][_0xe0bd('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize'][_0xe0bd('0x14')](_0xe0bd('0x10b'));db['CloudProvider']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x10c'));db[_0xe0bd('0x13')][_0xe0bd('0x10d')](db[_0xe0bd('0x21')],{'as':_0xe0bd('0x21'),'onDelete':'cascade','foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x13')]['hasMany'](db[_0xe0bd('0x1e')],{'as':_0xe0bd('0x10f'),'foreignKey':'UserId'});db[_0xe0bd('0x13')]['hasMany'](db[_0xe0bd('0x2f')],{'as':_0xe0bd('0x110'),'foreignKey':_0xe0bd('0x10e')});db['User']['hasMany'](db[_0xe0bd('0x111')],{'as':_0xe0bd('0x112'),'onDelete':_0xe0bd('0x113'),'hooks':!![]});db['User']['hasMany'](db[_0xe0bd('0x78')],{'as':'HopperFinals','foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x13')][_0xe0bd('0x114')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xe0bd('0x13')]['hasMany'](db[_0xe0bd('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x13')]['hasMany'](db[_0xe0bd('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x13')]['hasMany'](db[_0xe0bd('0x67')],{'as':_0xe0bd('0x115'),'foreignKey':'UserId'});db[_0xe0bd('0x13')][_0xe0bd('0x114')](db[_0xe0bd('0x116')],{'as':_0xe0bd('0x117'),'foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x13')][_0xe0bd('0x114')](db[_0xe0bd('0x4c')],{'as':_0xe0bd('0x118'),'foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x13')]['hasMany'](db[_0xe0bd('0x41')],{'as':_0xe0bd('0x119'),'foreignKey':_0xe0bd('0x10e')});db['User']['hasMany'](db['WhatsappInteraction'],{'as':_0xe0bd('0x11a'),'foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x13')]['hasMany'](db[_0xe0bd('0x101')],{'as':_0xe0bd('0x11b'),'foreignKey':_0xe0bd('0x11c')});db[_0xe0bd('0x13')]['belongsTo'](db[_0xe0bd('0xfb')],{'as':_0xe0bd('0xfb'),'foreignKey':_0xe0bd('0x11d')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db['ChatGroup'],{'as':'Groups','through':_0xe0bd('0x11f')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x120'),'through':_0xe0bd('0x121')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db['CmList'],{'as':_0xe0bd('0x122'),'through':_0xe0bd('0x123')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0xe5')],{'through':_0xe0bd('0x124')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0x41')],{'as':_0xe0bd('0x119'),'through':'user_has_mail_interactions'});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0x67')],{'as':_0xe0bd('0x115'),'through':_0xe0bd('0x125')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0xe0bd('0x126')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db['SmsInteraction'],{'as':_0xe0bd('0x117'),'through':_0xe0bd('0x127')});db['User'][_0xe0bd('0x11e')](db['OpenchannelInteraction'],{'as':_0xe0bd('0x128'),'through':_0xe0bd('0x129')});db[_0xe0bd('0x13')]['belongsToMany'](db[_0xe0bd('0x105')],{'as':_0xe0bd('0x11a'),'through':'user_has_whatsapp_interactions'});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0x1c')],{'as':'VoiceQueues','through':_0xe0bd('0x31'),'required':![]});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0x3e')],{'as':_0xe0bd('0x12a'),'through':_0xe0bd('0x33'),'required':![]});db['User'][_0xe0bd('0x11e')](db[_0xe0bd('0x6c')],{'as':_0xe0bd('0x12b'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0xe0bd('0x50')],{'as':'FaxQueues','through':_0xe0bd('0x12c'),'required':![]});db[_0xe0bd('0x13')]['belongsToMany'](db[_0xe0bd('0x58')],{'as':_0xe0bd('0x12d'),'through':_0xe0bd('0x35'),'required':![]});db['User'][_0xe0bd('0x11e')](db[_0xe0bd('0x61')],{'as':'OpenchannelQueues','through':_0xe0bd('0x36'),'required':![]});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0x12e')],{'as':_0xe0bd('0x12f'),'through':_0xe0bd('0x37'),'required':![]});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0xf8')],{'through':_0xe0bd('0x123')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0xf9')],{'as':_0xe0bd('0x130'),'through':_0xe0bd('0x131'),'required':![]});db[_0xe0bd('0x13')]['belongsToMany'](db[_0xe0bd('0x63')],{'as':_0xe0bd('0x132'),'through':_0xe0bd('0x133')});db['User']['belongsToMany'](db['FaxAccount'],{'as':_0xe0bd('0x134'),'through':_0xe0bd('0x135')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0x3c')],{'as':_0xe0bd('0x136'),'through':_0xe0bd('0x137')});db['User']['belongsToMany'](db[_0xe0bd('0x5a')],{'as':_0xe0bd('0x138'),'through':_0xe0bd('0x139')});db[_0xe0bd('0x13')][_0xe0bd('0x11e')](db[_0xe0bd('0x54')],{'as':_0xe0bd('0x13a'),'through':_0xe0bd('0x13b')});db[_0xe0bd('0x13')]['belongsToMany'](db[_0xe0bd('0x13c')],{'as':_0xe0bd('0x13d'),'through':_0xe0bd('0x13e')});db[_0xe0bd('0x13')]['belongsToMany'](db[_0xe0bd('0x13f')],{'as':_0xe0bd('0x140'),'through':_0xe0bd('0x141')});db[_0xe0bd('0x142')]['hasMany'](db[_0xe0bd('0x111')],{'as':_0xe0bd('0x143'),'onDelete':'cascade','foreignKey':_0xe0bd('0x144')});db[_0xe0bd('0x17')][_0xe0bd('0x114')](db['VoiceExtension'],{'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x111')]['hasMany'](db[_0xe0bd('0x111')],{'as':'Applications','onDelete':_0xe0bd('0x113')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xe0bd('0x8c')],{'as':_0xe0bd('0x145'),'through':_0xe0bd('0x146')});db['VoiceQueue'][_0xe0bd('0x114')](db[_0xe0bd('0x2f')],{'as':'Members','foreignKey':_0xe0bd('0x147')});db['VoiceQueue'][_0xe0bd('0x114')](db[_0xe0bd('0x148')],{'as':'Hoppers','foreignKey':_0xe0bd('0x147')});db[_0xe0bd('0x1c')][_0xe0bd('0x114')](db[_0xe0bd('0x78')],{'as':_0xe0bd('0x149'),'foreignKey':_0xe0bd('0x147')});db[_0xe0bd('0x1c')]['hasMany'](db[_0xe0bd('0x14a')],{'as':_0xe0bd('0x14b'),'foreignKey':_0xe0bd('0x147')});db[_0xe0bd('0x1c')]['hasMany'](db[_0xe0bd('0x7a')],{'as':_0xe0bd('0x7a'),'foreignKey':'VoiceQueueId'});db[_0xe0bd('0x1c')][_0xe0bd('0x114')](db[_0xe0bd('0x76')],{'as':'HopperBlacks','foreignKey':_0xe0bd('0x147')});db[_0xe0bd('0x1c')]['hasMany'](db[_0xe0bd('0xd5')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xe0bd('0x1c')][_0xe0bd('0x14c')](db[_0xe0bd('0x2b')],{'as':_0xe0bd('0x2b'),'foreignKey':_0xe0bd('0x14d')});db[_0xe0bd('0x1c')][_0xe0bd('0x14c')](db[_0xe0bd('0x2b')],{'as':_0xe0bd('0x14e'),'foreignKey':'TrunkBackupId'});db[_0xe0bd('0x1c')][_0xe0bd('0x14c')](db['Interval'],{'as':_0xe0bd('0x85'),'foreignKey':_0xe0bd('0x14f')});db[_0xe0bd('0x1c')][_0xe0bd('0x14c')](db[_0xe0bd('0x150')],{'as':_0xe0bd('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe0bd('0x1c')]['belongsToMany'](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x122'),'through':'voice_queues_has_cm_lists'});db[_0xe0bd('0x1c')][_0xe0bd('0x11e')](db['User'],{'as':_0xe0bd('0x152'),'through':'UserVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0xe0bd('0xe5')],{'as':_0xe0bd('0x153'),'through':_0xe0bd('0x154')});db[_0xe0bd('0x1c')][_0xe0bd('0x11e')](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x155'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording']['belongsTo'](db['User'],{'as':'User','foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x156')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'as':'User','foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x21')]['hasMany'](db[_0xe0bd('0x23')],{'as':_0xe0bd('0x157'),'onDelete':_0xe0bd('0x113'),'foreignKey':'mailboxuser','sourceKey':_0xe0bd('0x158')});db['VoiceMailMessage'][_0xe0bd('0x14c')](db[_0xe0bd('0x21')],{'foreignKey':_0xe0bd('0x159'),'targetKey':'mailbox'});db['VoiceCallReport'][_0xe0bd('0x114')](db[_0xe0bd('0x28')],{'as':_0xe0bd('0x15a'),'foreignKey':_0xe0bd('0x15b'),'constraints':![]});db[_0xe0bd('0x24')]['hasMany'](db[_0xe0bd('0x27')],{'as':_0xe0bd('0x15c'),'foreignKey':_0xe0bd('0x15b'),'constraints':![]});db[_0xe0bd('0x24')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x13'),'foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x24')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'as':'Contact','foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x39')][_0xe0bd('0x14c')](db['MailAccount'],{'as':_0xe0bd('0x3c'),'foreignKey':_0xe0bd('0x15e')});db['MailServerOut'][_0xe0bd('0x14c')](db[_0xe0bd('0x3c')],{'as':_0xe0bd('0x3c'),'foreignKey':_0xe0bd('0x15e')});db['MailAccount'][_0xe0bd('0x10d')](db[_0xe0bd('0x39')],{'as':_0xe0bd('0x15f'),'onDelete':'cascade'});db[_0xe0bd('0x3c')][_0xe0bd('0x10d')](db[_0xe0bd('0x160')],{'as':_0xe0bd('0x161'),'onDelete':'cascade'});db[_0xe0bd('0x3c')][_0xe0bd('0x114')](db[_0xe0bd('0x81')],{'as':'Dispositions','foreignKey':_0xe0bd('0x15e')});db[_0xe0bd('0x3c')][_0xe0bd('0x114')](db[_0xe0bd('0x80')],{'as':_0xe0bd('0x162'),'foreignKey':_0xe0bd('0x15e')});db['MailAccount'][_0xe0bd('0x114')](db[_0xe0bd('0x163')],{'as':'Messages','foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0xe0bd('0x41')],{'as':'Interactions'});db['MailAccount'][_0xe0bd('0x114')](db[_0xe0bd('0x164')],{'as':_0xe0bd('0x165')});db[_0xe0bd('0x3c')][_0xe0bd('0x14c')](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x166'),'foreignKey':_0xe0bd('0x167')});db['MailAccount'][_0xe0bd('0x14c')](db[_0xe0bd('0x8f')],{'as':_0xe0bd('0x8f'),'foreignKey':_0xe0bd('0x168')});db[_0xe0bd('0x3c')][_0xe0bd('0x14c')](db[_0xe0bd('0x150')],{'as':_0xe0bd('0x151'),'foreignKey':_0xe0bd('0x169')});db['MailAccount']['belongsToMany'](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x137')});db['MailQueue'][_0xe0bd('0x11e')](db['User'],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x33')});db[_0xe0bd('0x3e')][_0xe0bd('0x11e')](db['Team'],{'through':_0xe0bd('0x16a'),'as':'Teams'});db[_0xe0bd('0x41')][_0xe0bd('0x114')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xe0bd('0x16b')});db[_0xe0bd('0x41')][_0xe0bd('0x14c')](db[_0xe0bd('0x3c')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x15e')});db[_0xe0bd('0x41')][_0xe0bd('0x14c')](db['CmContact'],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x41')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0xe0bd('0x11e')](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x16e'),'as':_0xe0bd('0x16f')});db[_0xe0bd('0x41')]['belongsToMany'](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x16e'),'as':_0xe0bd('0x170')});db[_0xe0bd('0x41')]['belongsToMany'](db[_0xe0bd('0x13')],{'as':'Users','through':_0xe0bd('0x171'),'foreignKey':_0xe0bd('0x16b')});db[_0xe0bd('0x163')][_0xe0bd('0x114')](db['Attachment'],{'as':'Attachments','onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x163')][_0xe0bd('0x14c')](db['User'],{'as':'User'});db['MailMessage'][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'onDelete':'cascade','as':_0xe0bd('0x16d')});db[_0xe0bd('0x163')]['belongsTo'](db[_0xe0bd('0x41')],{'as':'Interaction','foreignKey':_0xe0bd('0x16b')});db[_0xe0bd('0x163')]['belongsTo'](db[_0xe0bd('0x3c')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x15e')});db['MailApplication'][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x164')][_0xe0bd('0x14c')](db['MailQueue'],{'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x164')][_0xe0bd('0x14c')](db[_0xe0bd('0x3c')],{'onDelete':'restrict'});db[_0xe0bd('0x164')][_0xe0bd('0x14c')](db[_0xe0bd('0x85')],{'onDelete':'restrict','foreignKey':_0xe0bd('0x14f')});db[_0xe0bd('0x164')][_0xe0bd('0x14c')](db[_0xe0bd('0x8e')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport'][_0xe0bd('0x14c')](db['MailAccount'],{});db[_0xe0bd('0x45')][_0xe0bd('0x14c')](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x166'),'foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0x45')][_0xe0bd('0x14c')](db['CmContact'],{'as':'Contact','foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x45')][_0xe0bd('0x14c')](db[_0xe0bd('0x41')],{});db[_0xe0bd('0x45')][_0xe0bd('0x14c')](db[_0xe0bd('0x163')],{});db[_0xe0bd('0x45')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{});db[_0xe0bd('0x45')][_0xe0bd('0x14c')](db[_0xe0bd('0x3e')],{});db[_0xe0bd('0x47')][_0xe0bd('0x114')](db['DashboardItem'],{'as':_0xe0bd('0x173'),'onDelete':_0xe0bd('0x113')});db['FaxAccount'][_0xe0bd('0x114')](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x174'),'foreignKey':_0xe0bd('0x175')});db[_0xe0bd('0x176')][_0xe0bd('0x114')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xe0bd('0x175')});db['FaxAccount'][_0xe0bd('0x114')](db['FaxInteraction'],{'as':_0xe0bd('0x177')});db[_0xe0bd('0x176')][_0xe0bd('0x114')](db['FaxApplication'],{'as':_0xe0bd('0x165')});db[_0xe0bd('0x176')][_0xe0bd('0x114')](db[_0xe0bd('0x111')],{'as':_0xe0bd('0x178'),'onDelete':'cascade'});db[_0xe0bd('0x176')][_0xe0bd('0x114')](db[_0xe0bd('0x4e')],{'as':_0xe0bd('0x157')});db[_0xe0bd('0x176')][_0xe0bd('0x14c')](db[_0xe0bd('0x2b')],{'as':_0xe0bd('0x2b')});db['FaxAccount']['belongsTo'](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x166'),'foreignKey':_0xe0bd('0x167')});db['FaxAccount'][_0xe0bd('0x14c')](db[_0xe0bd('0x150')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount']['belongsToMany'](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':'user_has_fax_accounts'});db[_0xe0bd('0x179')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'onDelete':'restrict'});db[_0xe0bd('0x179')][_0xe0bd('0x14c')](db['FaxQueue'],{'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x179')][_0xe0bd('0x14c')](db[_0xe0bd('0x176')],{'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x179')][_0xe0bd('0x14c')](db[_0xe0bd('0x8e')],{'onDelete':'restrict','foreignKey':'TagId'});db['FaxInteraction'][_0xe0bd('0x114')](db[_0xe0bd('0x4e')],{'as':'Messages','onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x17a')});db[_0xe0bd('0x4c')][_0xe0bd('0x14c')](db[_0xe0bd('0x176')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x175')});db['FaxInteraction']['belongsTo'](db['CmContact'],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x4c')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17b'),'foreignKey':'UserId'});db['FaxInteraction'][_0xe0bd('0x11e')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xe0bd('0x16f')});db['FaxInteraction'][_0xe0bd('0x11e')](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x17c'),'as':'ThroughTags'});db[_0xe0bd('0x4c')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17d'),'through':_0xe0bd('0x126'),'foreignKey':_0xe0bd('0x17a')});db[_0xe0bd('0x4e')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'onDelete':_0xe0bd('0x113'),'as':'User'});db[_0xe0bd('0x4e')][_0xe0bd('0x14c')](db['FaxInteraction'],{'as':_0xe0bd('0x17e'),'foreignKey':'FaxInteractionId'});db[_0xe0bd('0x4e')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'onDelete':_0xe0bd('0x113'),'as':'Contact'});db['FaxMessage'][_0xe0bd('0x14c')](db['Attachment'],{'as':'Attachment','foreignKey':_0xe0bd('0x17f')});db['FaxMessage'][_0xe0bd('0x14c')](db[_0xe0bd('0x176')],{'as':'Account','foreignKey':_0xe0bd('0x175')});db[_0xe0bd('0x50')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x12c')});db[_0xe0bd('0x50')][_0xe0bd('0x11e')](db[_0xe0bd('0xe5')],{'through':_0xe0bd('0x180'),'as':'Teams'});db['FaxQueueReport'][_0xe0bd('0x14c')](db['FaxAccount'],{});db[_0xe0bd('0x52')][_0xe0bd('0x14c')](db['CmList'],{'as':'List','foreignKey':_0xe0bd('0x167')});db['FaxQueueReport']['belongsTo'](db[_0xe0bd('0x73')],{'as':'Contact','foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x52')][_0xe0bd('0x14c')](db[_0xe0bd('0x4c')],{});db[_0xe0bd('0x52')][_0xe0bd('0x14c')](db[_0xe0bd('0x4e')],{});db[_0xe0bd('0x52')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{});db['FaxQueueReport']['belongsTo'](db[_0xe0bd('0x50')],{});db[_0xe0bd('0x54')][_0xe0bd('0x114')](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x174'),'foreignKey':_0xe0bd('0x181')});db[_0xe0bd('0x54')][_0xe0bd('0x114')](db['CannedAnswer'],{'as':_0xe0bd('0x162'),'foreignKey':_0xe0bd('0x181')});db[_0xe0bd('0x54')]['hasMany'](db[_0xe0bd('0x56')],{'as':'Messages','foreignKey':_0xe0bd('0x181')});db[_0xe0bd('0x54')][_0xe0bd('0x114')](db[_0xe0bd('0x116')],{'as':'Interactions'});db['SmsAccount'][_0xe0bd('0x114')](db[_0xe0bd('0x182')],{'as':_0xe0bd('0x165')});db[_0xe0bd('0x54')]['belongsTo'](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x166'),'foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0x54')][_0xe0bd('0x14c')](db['Pause'],{'as':_0xe0bd('0x151'),'foreignKey':_0xe0bd('0x169')});db[_0xe0bd('0x54')][_0xe0bd('0x11e')](db['User'],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x13b')});db[_0xe0bd('0x182')]['belongsTo'](db[_0xe0bd('0x13')],{'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x182')]['belongsTo'](db[_0xe0bd('0x58')],{'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x182')][_0xe0bd('0x14c')](db[_0xe0bd('0x54')],{'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x182')][_0xe0bd('0x14c')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe0bd('0x14f')});db[_0xe0bd('0x182')]['belongsTo'](db[_0xe0bd('0x8e')],{'onDelete':_0xe0bd('0x172'),'foreignKey':'TagId'});db[_0xe0bd('0x116')][_0xe0bd('0x114')](db[_0xe0bd('0x56')],{'as':_0xe0bd('0x157'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xe0bd('0x116')][_0xe0bd('0x14c')](db[_0xe0bd('0x54')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x181')});db[_0xe0bd('0x116')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'as':'Contact','foreignKey':_0xe0bd('0x15d')});db['SmsInteraction'][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17b'),'foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x116')][_0xe0bd('0x11e')](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x183'),'as':'Tags'});db['SmsInteraction'][_0xe0bd('0x11e')](db[_0xe0bd('0x8e')],{'through':'sms_interaction_has_tags','as':_0xe0bd('0x170')});db[_0xe0bd('0x116')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':'Users','through':_0xe0bd('0x127'),'foreignKey':_0xe0bd('0x184')});db[_0xe0bd('0x56')]['belongsTo'](db['User'],{'as':_0xe0bd('0x13')});db[_0xe0bd('0x56')]['belongsTo'](db[_0xe0bd('0x73')],{'onDelete':_0xe0bd('0x113'),'as':_0xe0bd('0x16d')});db['SmsMessage']['belongsTo'](db[_0xe0bd('0x116')],{'onDelete':_0xe0bd('0x113'),'as':_0xe0bd('0x17e'),'foreignKey':'SmsInteractionId'});db[_0xe0bd('0x56')][_0xe0bd('0x14c')](db[_0xe0bd('0x54')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x181')});db['SmsQueue'][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x35'),'foreignKey':_0xe0bd('0x185')});db[_0xe0bd('0x58')][_0xe0bd('0x11e')](db[_0xe0bd('0xe5')],{'through':_0xe0bd('0x186'),'as':_0xe0bd('0x153')});db[_0xe0bd('0x5a')][_0xe0bd('0x114')](db[_0xe0bd('0x81')],{'as':'Dispositions','foreignKey':_0xe0bd('0x187')});db[_0xe0bd('0x5a')][_0xe0bd('0x114')](db[_0xe0bd('0x80')],{'as':_0xe0bd('0x162'),'foreignKey':_0xe0bd('0x187')});db[_0xe0bd('0x5a')][_0xe0bd('0x114')](db['OpenchannelInteraction'],{'as':_0xe0bd('0x177'),'foreignKey':_0xe0bd('0x187')});db[_0xe0bd('0x5a')][_0xe0bd('0x114')](db[_0xe0bd('0x5f')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xe0bd('0x114')](db['OpenchannelApplication'],{'as':_0xe0bd('0x165'),'foreignKey':_0xe0bd('0x187')});db[_0xe0bd('0x5a')][_0xe0bd('0x14c')](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x166'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xe0bd('0x14c')](db[_0xe0bd('0x150')],{'as':_0xe0bd('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe0bd('0x5a')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x139')});db[_0xe0bd('0x188')][_0xe0bd('0x14c')](db['User'],{'onDelete':'restrict'});db[_0xe0bd('0x188')]['belongsTo'](db[_0xe0bd('0x61')],{'onDelete':_0xe0bd('0x172'),'foreignKey':'OpenchannelQueueId'});db[_0xe0bd('0x188')]['belongsTo'](db[_0xe0bd('0x5a')],{'onDelete':_0xe0bd('0x172'),'foreignKey':'OpenchannelAccountId'});db[_0xe0bd('0x188')][_0xe0bd('0x14c')](db[_0xe0bd('0x85')],{'onDelete':_0xe0bd('0x172'),'foreignKey':_0xe0bd('0x14f')});db[_0xe0bd('0x188')][_0xe0bd('0x14c')](db[_0xe0bd('0x8e')],{'onDelete':_0xe0bd('0x172'),'foreignKey':_0xe0bd('0x189')});db[_0xe0bd('0x5d')]['hasMany'](db[_0xe0bd('0x5f')],{'as':_0xe0bd('0x157'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x18a')});db[_0xe0bd('0x5d')][_0xe0bd('0x14c')](db[_0xe0bd('0x5a')],{'as':_0xe0bd('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0xe0bd('0x5d')]['belongsTo'](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x16d'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0xe0bd('0x14c')](db['User'],{'as':_0xe0bd('0x17b'),'foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x5d')]['belongsToMany'](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x18b'),'as':_0xe0bd('0x16f')});db[_0xe0bd('0x5d')][_0xe0bd('0x11e')](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x18b'),'as':'ThroughTags'});db[_0xe0bd('0x5d')][_0xe0bd('0x11e')](db['User'],{'as':'Users','through':_0xe0bd('0x129'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db[_0xe0bd('0x13')],{'onDelete':_0xe0bd('0x113'),'as':'User'});db[_0xe0bd('0x5f')]['belongsTo'](db[_0xe0bd('0x73')],{'onDelete':_0xe0bd('0x113'),'as':'Contact'});db['OpenchannelMessage'][_0xe0bd('0x14c')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0xe0bd('0x17e'),'foreignKey':_0xe0bd('0x18a')});db[_0xe0bd('0x5f')]['belongsTo'](db[_0xe0bd('0x18c')],{'as':'Attachment','foreignKey':_0xe0bd('0x17f')});db['OpenchannelMessage'][_0xe0bd('0x14c')](db[_0xe0bd('0x5a')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x187')});db[_0xe0bd('0x61')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x36'),'foreignKey':'OpenchannelQueueId'});db[_0xe0bd('0x61')][_0xe0bd('0x11e')](db['Team'],{'through':_0xe0bd('0x18d'),'as':_0xe0bd('0x153')});db[_0xe0bd('0x63')][_0xe0bd('0x114')](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x174'),'foreignKey':_0xe0bd('0x18e')});db[_0xe0bd('0x63')][_0xe0bd('0x114')](db['CannedAnswer'],{'as':_0xe0bd('0x162'),'foreignKey':_0xe0bd('0x18e')});db[_0xe0bd('0x63')][_0xe0bd('0x114')](db[_0xe0bd('0x18f')],{'as':_0xe0bd('0x190')});db[_0xe0bd('0x63')][_0xe0bd('0x114')](db[_0xe0bd('0x67')],{'as':'Interactions'});db[_0xe0bd('0x63')][_0xe0bd('0x114')](db[_0xe0bd('0x66')],{'as':_0xe0bd('0x165')});db[_0xe0bd('0x63')][_0xe0bd('0x114')](db[_0xe0bd('0x191')],{'as':_0xe0bd('0x157')});db['ChatWebsite'][_0xe0bd('0x14c')](db[_0xe0bd('0xf8')],{'as':'List','foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0x63')][_0xe0bd('0x14c')](db['Interval'],{'as':_0xe0bd('0x85'),'foreignKey':_0xe0bd('0x14f')});db[_0xe0bd('0x63')][_0xe0bd('0x14c')](db[_0xe0bd('0x150')],{'as':_0xe0bd('0x151'),'foreignKey':_0xe0bd('0x169')});db[_0xe0bd('0x63')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x133')});db[_0xe0bd('0x65')][_0xe0bd('0x14c')](db[_0xe0bd('0x5a')],{});db[_0xe0bd('0x65')][_0xe0bd('0x14c')](db[_0xe0bd('0xf8')],{'as':'List','foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0x65')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x65')]['belongsTo'](db[_0xe0bd('0x5d')],{});db[_0xe0bd('0x65')][_0xe0bd('0x14c')](db[_0xe0bd('0x5f')],{});db['OpenchannelQueueReport'][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{});db[_0xe0bd('0x65')]['belongsTo'](db[_0xe0bd('0x61')],{});db['ChatApplication'][_0xe0bd('0x14c')](db['User'],{'as':_0xe0bd('0x192'),'foreignKey':'UserId','onDelete':_0xe0bd('0x172')});db['ChatApplication'][_0xe0bd('0x14c')](db[_0xe0bd('0x6c')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x66')]['belongsTo'](db[_0xe0bd('0x63')],{'as':_0xe0bd('0x193'),'foreignKey':_0xe0bd('0x18e'),'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x66')]['belongsTo'](db['Tag'],{'onDelete':_0xe0bd('0x172'),'foreignKey':_0xe0bd('0x189')});db[_0xe0bd('0x67')][_0xe0bd('0x114')](db[_0xe0bd('0x191')],{'as':_0xe0bd('0x157'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x194')});db[_0xe0bd('0x67')][_0xe0bd('0x14c')](db[_0xe0bd('0x63')],{'as':_0xe0bd('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0xe0bd('0x67')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x16d'),'foreignKey':'ContactId'});db[_0xe0bd('0x67')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17b'),'foreignKey':'UserId'});db[_0xe0bd('0x67')]['belongsToMany'](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x195'),'as':'Tags'});db[_0xe0bd('0x67')]['belongsToMany'](db[_0xe0bd('0x8e')],{'through':'chat_interaction_has_tags','as':_0xe0bd('0x170')});db[_0xe0bd('0x67')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17d'),'through':_0xe0bd('0x125'),'foreignKey':'ChatInteractionId'});db[_0xe0bd('0x191')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'onDelete':_0xe0bd('0x113'),'as':_0xe0bd('0x13')});db[_0xe0bd('0x191')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'onDelete':_0xe0bd('0x113'),'as':_0xe0bd('0x16d'),'foreignKey':'ContactId'});db[_0xe0bd('0x191')][_0xe0bd('0x14c')](db[_0xe0bd('0x67')],{'onDelete':_0xe0bd('0x113'),'as':_0xe0bd('0x17e'),'foreignKey':_0xe0bd('0x194')});db[_0xe0bd('0x191')]['belongsTo'](db['Attachment'],{'as':_0xe0bd('0x18c'),'foreignKey':'AttachmentId'});db[_0xe0bd('0x191')][_0xe0bd('0x14c')](db[_0xe0bd('0x63')],{'as':_0xe0bd('0x16c'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'onDelete':_0xe0bd('0x113'),'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d')});db['ChatOfflineMessage'][_0xe0bd('0x14c')](db[_0xe0bd('0x63')],{'as':'Account','foreignKey':_0xe0bd('0x18e')});db['ChatQueue'][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x196'),'hooks':!![]});db[_0xe0bd('0x6c')][_0xe0bd('0x11e')](db[_0xe0bd('0xe5')],{'through':_0xe0bd('0x197'),'as':'Teams'});db[_0xe0bd('0x6e')][_0xe0bd('0x114')](db[_0xe0bd('0xd0')],{'as':_0xe0bd('0x157'),'foreignKey':_0xe0bd('0x198'),'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x6e')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':'Members','through':'chat_group_has_users'});db[_0xe0bd('0x18f')][_0xe0bd('0x14c')](db[_0xe0bd('0x63')],{'as':_0xe0bd('0x193'),'foreignKey':_0xe0bd('0x18e')});db[_0xe0bd('0x71')][_0xe0bd('0x114')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x120'),'foreignKey':_0xe0bd('0x199')});db[_0xe0bd('0x73')][_0xe0bd('0x114')](db[_0xe0bd('0x148')],{'as':_0xe0bd('0x19a'),'foreignKey':'ContactId'});db[_0xe0bd('0x73')][_0xe0bd('0x114')](db[_0xe0bd('0x78')],{'as':_0xe0bd('0x149'),'foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x73')][_0xe0bd('0x114')](db[_0xe0bd('0x14a')],{'as':'HopperHistories','foreignKey':_0xe0bd('0x15d')});db['CmContact'][_0xe0bd('0x114')](db[_0xe0bd('0x7a')],{'as':_0xe0bd('0x7a'),'foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x73')][_0xe0bd('0x114')](db[_0xe0bd('0xd5')],{'as':'JscriptySessions','foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x73')][_0xe0bd('0x114')](db[_0xe0bd('0x5d')],{'as':_0xe0bd('0x128'),'foreignKey':_0xe0bd('0x15d'),'onDelete':'restrict'});db['CmContact'][_0xe0bd('0x114')](db[_0xe0bd('0x67')],{'as':_0xe0bd('0x115'),'foreignKey':_0xe0bd('0x15d'),'onDelete':'restrict'});db[_0xe0bd('0x73')][_0xe0bd('0x114')](db[_0xe0bd('0x116')],{'as':_0xe0bd('0x117'),'foreignKey':_0xe0bd('0x15d'),'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x73')][_0xe0bd('0x114')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0xe0bd('0x15d'),'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x73')][_0xe0bd('0x114')](db[_0xe0bd('0x41')],{'as':_0xe0bd('0x119'),'foreignKey':_0xe0bd('0x15d'),'onDelete':_0xe0bd('0x172')});db['CmContact'][_0xe0bd('0x14c')](db[_0xe0bd('0x71')],{'as':_0xe0bd('0x19b'),'foreignKey':_0xe0bd('0x199')});db['CmContact'][_0xe0bd('0x14c')](db[_0xe0bd('0xf8')],{'as':'List','foreignKey':_0xe0bd('0x167'),'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x73')]['belongsToMany'](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17d'),'through':'cm_user_has_contacts'});db[_0xe0bd('0x73')]['belongsToMany'](db[_0xe0bd('0x8e')],{'as':_0xe0bd('0x16f'),'through':_0xe0bd('0x19c')});db[_0xe0bd('0x73')]['belongsToMany'](db['Tag'],{'through':_0xe0bd('0x19c'),'as':_0xe0bd('0x170')});db[_0xe0bd('0x148')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x16d'),'foreignKey':'ContactId','onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x148')]['belongsTo'](db['CmList'],{'as':_0xe0bd('0x166'),'foreignKey':_0xe0bd('0x167'),'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x148')][_0xe0bd('0x14c')](db['User'],{'as':_0xe0bd('0x192'),'foreignKey':'UserId'});db[_0xe0bd('0x148')][_0xe0bd('0x14c')](db[_0xe0bd('0x1c')],{'as':_0xe0bd('0x19d'),'foreignKey':_0xe0bd('0x147'),'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x148')][_0xe0bd('0x14c')](db[_0xe0bd('0xe9')],{'as':_0xe0bd('0xe9'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xe0bd('0x148')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17b'),'foreignKey':_0xe0bd('0x19e')});db['CmHopperBlack']['belongsTo'](db['CmContact'],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d'),'onDelete':'cascade'});db[_0xe0bd('0x76')][_0xe0bd('0x14c')](db['CmList'],{'as':_0xe0bd('0x166'),'foreignKey':'ListId','onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x76')]['belongsTo'](db[_0xe0bd('0x1c')],{'as':_0xe0bd('0x19d'),'foreignKey':_0xe0bd('0x147'),'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x76')][_0xe0bd('0x14c')](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x7e')][_0xe0bd('0x114')](db[_0xe0bd('0x83')],{'as':{'plural':_0xe0bd('0x19f'),'singular':_0xe0bd('0x1a0')},'foreignKey':_0xe0bd('0x1a1'),'onDelete':_0xe0bd('0x113'),'hooks':!![]});db[_0xe0bd('0x7e')][_0xe0bd('0x114')](db['Condition'],{'as':{'plural':'Any','singular':_0xe0bd('0x1a2')},'foreignKey':_0xe0bd('0x1a3'),'onDelete':_0xe0bd('0x113'),'hooks':!![]});db[_0xe0bd('0x7e')][_0xe0bd('0x114')](db['Action'],{'as':_0xe0bd('0x1a4'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db['Interval'][_0xe0bd('0x114')](db['Interval'],{'as':_0xe0bd('0x1a5'),'foreignKey':_0xe0bd('0x14f'),'onDelete':_0xe0bd('0x113'),'hooks':!![],'required':![]});db['Interval'][_0xe0bd('0x114')](db[_0xe0bd('0x111')],{'as':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x14f'),'onDelete':'restrict'});db[_0xe0bd('0x85')][_0xe0bd('0x114')](db[_0xe0bd('0x164')],{'as':_0xe0bd('0x1a6'),'foreignKey':_0xe0bd('0x14f')});db[_0xe0bd('0x85')][_0xe0bd('0x114')](db[_0xe0bd('0x66')],{'as':_0xe0bd('0x1a7'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0xe0bd('0x179')],{'as':'FaxApplications','foreignKey':_0xe0bd('0x14f')});db[_0xe0bd('0x85')][_0xe0bd('0x114')](db[_0xe0bd('0x182')],{'as':_0xe0bd('0x1a8'),'foreignKey':_0xe0bd('0x14f')});db[_0xe0bd('0x1a9')][_0xe0bd('0x14c')](db[_0xe0bd('0x3c')],{});db[_0xe0bd('0x1a9')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xe0bd('0x1aa')});db['Schedule'][_0xe0bd('0x14c')](db['AnalyticCustomReport'],{'foreignKey':_0xe0bd('0x1ab')});db[_0xe0bd('0x8c')]['belongsToMany'](db[_0xe0bd('0x1a')],{'as':_0xe0bd('0x1ac'),'through':_0xe0bd('0x146'),'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x8e')][_0xe0bd('0x11e')](db[_0xe0bd('0x73')],{'through':_0xe0bd('0x19c')});db[_0xe0bd('0x8e')]['belongsToMany'](db[_0xe0bd('0x67')],{'through':'chat_interaction_has_tags'});db[_0xe0bd('0x8e')][_0xe0bd('0x11e')](db[_0xe0bd('0x41')],{'through':_0xe0bd('0x16e')});db['Tag']['belongsToMany'](db[_0xe0bd('0x116')],{'through':'sms_interaction_has_tags'});db['Tag'][_0xe0bd('0x11e')](db['FaxInteraction'],{'through':_0xe0bd('0x17c')});db['Tag']['belongsToMany'](db[_0xe0bd('0x5d')],{'through':_0xe0bd('0x18b')});db['Tag'][_0xe0bd('0x11e')](db[_0xe0bd('0x105')],{'through':_0xe0bd('0x1ad')});db[_0xe0bd('0x91')][_0xe0bd('0x114')](db[_0xe0bd('0x83')],{'as':{'plural':_0xe0bd('0x1ae'),'singular':_0xe0bd('0x1af')},'foreignKey':_0xe0bd('0x1b0'),'onDelete':_0xe0bd('0x113'),'hooks':!![]});db['Trigger'][_0xe0bd('0x114')](db['Condition'],{'as':{'plural':_0xe0bd('0x1b1'),'singular':_0xe0bd('0x1b2')},'foreignKey':'TriggerAnyId','onDelete':_0xe0bd('0x113'),'hooks':!![]});db[_0xe0bd('0x91')]['hasMany'](db['Action'],{'as':_0xe0bd('0x1a4'),'foreignKey':_0xe0bd('0x1b3'),'onDelete':_0xe0bd('0x113'),'hooks':!![]});db[_0xe0bd('0x96')][_0xe0bd('0x114')](db[_0xe0bd('0x9c')],{'as':_0xe0bd('0x1b4'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1ab'),'hooks':!![]});db[_0xe0bd('0x98')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xe0bd('0x1b4'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1aa')});db[_0xe0bd('0x9a')][_0xe0bd('0x114')](db[_0xe0bd('0x9c')],{'as':'Fields','onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1b5')});db[_0xe0bd('0x9c')][_0xe0bd('0x14c')](db['AnalyticMetric'],{'foreignKey':_0xe0bd('0x1b5')});db[_0xe0bd('0x1b6')][_0xe0bd('0x114')](db[_0xe0bd('0xa0')],{'as':_0xe0bd('0x1b7'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xa0')]['hasMany'](db['SalesforceField'],{'as':_0xe0bd('0x1b9'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xa0')][_0xe0bd('0x114')](db['SalesforceField'],{'as':_0xe0bd('0x1bb'),'onDelete':_0xe0bd('0x113'),'foreignKey':'DescriptionId'});db[_0xe0bd('0xa0')][_0xe0bd('0x114')](db[_0xe0bd('0xa1')],{'as':_0xe0bd('0x1b4'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xa0')][_0xe0bd('0x14c')](db[_0xe0bd('0x1b6')],{'as':_0xe0bd('0x16c'),'foreignKey':'AccountId'});db[_0xe0bd('0xa1')][_0xe0bd('0x114')](db[_0xe0bd('0xa1')],{'as':_0xe0bd('0x1bd'),'foreignKey':_0xe0bd('0x1ba')});db['SalesforceField']['hasMany'](db[_0xe0bd('0xa1')],{'as':_0xe0bd('0x1be'),'foreignKey':_0xe0bd('0x1bf')});db['SalesforceField'][_0xe0bd('0x114')](db[_0xe0bd('0xa1')],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xa1')]['belongsTo'](db['Variable'],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1c1')});db['SugarcrmAccount'][_0xe0bd('0x114')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xa5')][_0xe0bd('0x114')](db[_0xe0bd('0xa7')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xe0bd('0x1ba')});db['SugarcrmConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0xa7')],{'as':_0xe0bd('0x1bb'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0xa5')][_0xe0bd('0x114')](db[_0xe0bd('0xa7')],{'as':'Fields','onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1bc')});db['SugarcrmConfiguration'][_0xe0bd('0x14c')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xa7')][_0xe0bd('0x114')](db[_0xe0bd('0xa7')],{'as':_0xe0bd('0x1bd'),'foreignKey':'SubjectId'});db[_0xe0bd('0xa7')][_0xe0bd('0x114')](db[_0xe0bd('0xa7')],{'as':_0xe0bd('0x1be'),'foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0xa7')][_0xe0bd('0x114')](db[_0xe0bd('0xa7')],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db['SugarcrmField'][_0xe0bd('0x14c')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1c1')});db[_0xe0bd('0xa9')][_0xe0bd('0x114')](db[_0xe0bd('0x1c2')],{'as':_0xe0bd('0x1b7'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0x1c2')][_0xe0bd('0x114')](db[_0xe0bd('0xac')],{'as':'Subjects','onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1ba')});db['DeskConfiguration']['hasMany'](db[_0xe0bd('0xac')],{'as':_0xe0bd('0x1bb'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1bf')});db['DeskConfiguration']['hasMany'](db[_0xe0bd('0xac')],{'as':_0xe0bd('0x1b4'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0x1c2')][_0xe0bd('0x14c')](db[_0xe0bd('0xa9')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1b8')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0xe0bd('0x1c3')});db[_0xe0bd('0xac')][_0xe0bd('0x114')](db[_0xe0bd('0xac')],{'as':_0xe0bd('0x1bd'),'foreignKey':_0xe0bd('0x1ba')});db['DeskField']['hasMany'](db[_0xe0bd('0xac')],{'as':'Description','foreignKey':_0xe0bd('0x1bf')});db['DeskField'][_0xe0bd('0x114')](db['DeskField'],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xac')][_0xe0bd('0x14c')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1c1')});db[_0xe0bd('0x1c4')][_0xe0bd('0x114')](db[_0xe0bd('0xae')],{'as':_0xe0bd('0x1b7'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xae')]['hasMany'](db['ZohoField'],{'as':_0xe0bd('0x1b9'),'onDelete':_0xe0bd('0x113'),'foreignKey':'SubjectId'});db[_0xe0bd('0xae')][_0xe0bd('0x114')](db[_0xe0bd('0xb0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xe0bd('0x1bf')});db['ZohoConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0xb0')],{'as':_0xe0bd('0x1b4'),'onDelete':_0xe0bd('0x113'),'foreignKey':'FieldId'});db[_0xe0bd('0xae')]['belongsTo'](db[_0xe0bd('0x1c4')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xb0')]['hasMany'](db[_0xe0bd('0xb0')],{'as':_0xe0bd('0x1bd'),'foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xb0')][_0xe0bd('0x114')](db[_0xe0bd('0xb0')],{'as':_0xe0bd('0x1be'),'foreignKey':'DescriptionId'});db[_0xe0bd('0xb0')]['hasMany'](db[_0xe0bd('0xb0')],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xb0')]['belongsTo'](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db['ZendeskConfiguration'],{'as':_0xe0bd('0x1b7'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0x1c5')][_0xe0bd('0x114')](db[_0xe0bd('0x1c6')],{'as':_0xe0bd('0x1b9'),'foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0x1c5')][_0xe0bd('0x114')](db[_0xe0bd('0x1c6')],{'as':_0xe0bd('0x1bb'),'foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0x1c5')][_0xe0bd('0x114')](db['ZendeskField'],{'as':_0xe0bd('0x1b4'),'foreignKey':_0xe0bd('0x1bc')});db['ZendeskConfiguration'][_0xe0bd('0x14c')](db['ZendeskAccount'],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0x1c5')][_0xe0bd('0x11e')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0xe0bd('0x1c6')][_0xe0bd('0x114')](db[_0xe0bd('0x1c6')],{'as':_0xe0bd('0x1bd'),'foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0x1c6')][_0xe0bd('0x114')](db[_0xe0bd('0x1c6')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xe0bd('0x1c6')][_0xe0bd('0x114')](db[_0xe0bd('0x1c6')],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0x1c6')][_0xe0bd('0x14c')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':'VariableId'});db[_0xe0bd('0x1c7')][_0xe0bd('0x114')](db[_0xe0bd('0xb6')],{'as':'Configurations','onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1b8')});db['FreshdeskConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0xb8')],{'as':_0xe0bd('0x1b9'),'onDelete':'cascade','foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0xb8')],{'as':_0xe0bd('0x1bb'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0xb6')][_0xe0bd('0x114')](db[_0xe0bd('0xb8')],{'as':_0xe0bd('0x1b4'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xb6')][_0xe0bd('0x14c')](db[_0xe0bd('0x1c7')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xb6')][_0xe0bd('0x11e')](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x1c8')});db[_0xe0bd('0xb8')]['hasMany'](db[_0xe0bd('0xb8')],{'as':_0xe0bd('0x1bd'),'foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xb8')][_0xe0bd('0x114')](db[_0xe0bd('0xb8')],{'as':_0xe0bd('0x1be'),'foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0xb8')][_0xe0bd('0x114')](db['FreshdeskField'],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xb8')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xe0bd('0x1c1')});db['VtigerAccount'][_0xe0bd('0x114')](db[_0xe0bd('0xbc')],{'as':_0xe0bd('0x1b7'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xbc')]['hasMany'](db[_0xe0bd('0xbd')],{'as':'Subjects','foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xbc')][_0xe0bd('0x114')](db[_0xe0bd('0xbd')],{'as':_0xe0bd('0x1bb'),'foreignKey':_0xe0bd('0x1bf')});db['VtigerConfiguration']['hasMany'](db[_0xe0bd('0xbd')],{'as':_0xe0bd('0x1b4'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xbc')][_0xe0bd('0x14c')](db['VtigerAccount'],{'as':_0xe0bd('0x16c'),'foreignKey':'AccountId'});db[_0xe0bd('0xbd')][_0xe0bd('0x114')](db[_0xe0bd('0xbd')],{'as':'Subject','foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xbd')]['hasMany'](db[_0xe0bd('0xbd')],{'as':'Description','foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0xbd')]['hasMany'](db[_0xe0bd('0xbd')],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xbd')][_0xe0bd('0x14c')](db['Variable'],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1c1')});db[_0xe0bd('0xbf')][_0xe0bd('0x114')](db[_0xe0bd('0xc1')],{'as':'Configurations','onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xc1')][_0xe0bd('0x114')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xc1')][_0xe0bd('0x114')](db[_0xe0bd('0xc3')],{'as':_0xe0bd('0x1bb'),'foreignKey':_0xe0bd('0x1bf')});db['ServicenowConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0xc3')],{'as':_0xe0bd('0x1b4'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xc1')][_0xe0bd('0x14c')](db[_0xe0bd('0xbf')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xc3')][_0xe0bd('0x114')](db['ServicenowField'],{'as':'Subject','foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xc3')]['hasMany'](db['ServicenowField'],{'as':_0xe0bd('0x1be'),'foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0xc3')][_0xe0bd('0x114')](db['ServicenowField'],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xc3')]['belongsTo'](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1c1')});db[_0xe0bd('0x1c9')][_0xe0bd('0x114')](db[_0xe0bd('0xc6')],{'as':_0xe0bd('0x1b7'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xc6')]['hasMany'](db['Dynamics365Field'],{'as':_0xe0bd('0x1b9'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xc6')][_0xe0bd('0x114')](db[_0xe0bd('0xc8')],{'as':_0xe0bd('0x1bb'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1bf')});db['Dynamics365Configuration'][_0xe0bd('0x114')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xc6')][_0xe0bd('0x14c')](db[_0xe0bd('0x1c9')],{'as':'Account','foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xc8')][_0xe0bd('0x114')](db[_0xe0bd('0xc8')],{'as':'Subject','foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xc8')][_0xe0bd('0x114')](db[_0xe0bd('0xc8')],{'as':_0xe0bd('0x1be'),'foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0xc8')]['hasMany'](db[_0xe0bd('0xc8')],{'as':_0xe0bd('0x1c0'),'foreignKey':'FieldId'});db[_0xe0bd('0xc8')][_0xe0bd('0x14c')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1c1')});db['FreshsalesAccount'][_0xe0bd('0x114')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xca')][_0xe0bd('0x114')](db[_0xe0bd('0xcc')],{'as':_0xe0bd('0x1b9'),'foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xca')][_0xe0bd('0x114')](db['FreshsalesField'],{'as':_0xe0bd('0x1bb'),'foreignKey':'DescriptionId'});db[_0xe0bd('0xca')][_0xe0bd('0x114')](db[_0xe0bd('0xcc')],{'as':'Fields','foreignKey':_0xe0bd('0x1bc')});db['FreshsalesConfiguration'][_0xe0bd('0x14c')](db[_0xe0bd('0x1ca')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1b8')});db[_0xe0bd('0xcc')][_0xe0bd('0x114')](db[_0xe0bd('0xcc')],{'as':'Subject','foreignKey':_0xe0bd('0x1ba')});db[_0xe0bd('0xcc')][_0xe0bd('0x114')](db[_0xe0bd('0xcc')],{'as':'Description','foreignKey':_0xe0bd('0x1bf')});db['FreshsalesField']['hasMany'](db[_0xe0bd('0xcc')],{'as':_0xe0bd('0x1c0'),'foreignKey':_0xe0bd('0x1bc')});db[_0xe0bd('0xcc')][_0xe0bd('0x14c')](db['Variable'],{'as':_0xe0bd('0x93'),'foreignKey':'VariableId'});db[_0xe0bd('0xcf')]['belongsTo'](db[_0xe0bd('0x63')],{});db['ChatQueueReport'][_0xe0bd('0x14c')](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x166'),'foreignKey':'ListId'});db[_0xe0bd('0xcf')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d')});db['ChatQueueReport'][_0xe0bd('0x14c')](db[_0xe0bd('0x67')],{});db[_0xe0bd('0xcf')]['belongsTo'](db[_0xe0bd('0x191')],{});db[_0xe0bd('0xcf')]['belongsTo'](db[_0xe0bd('0x13')],{});db[_0xe0bd('0xcf')]['belongsTo'](db[_0xe0bd('0x6c')],{});db[_0xe0bd('0xd0')][_0xe0bd('0x14c')](db['User'],{'onDelete':'cascade','foreignKey':_0xe0bd('0x1cb')});db[_0xe0bd('0xd0')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1cc')});db[_0xe0bd('0xd5')][_0xe0bd('0x114')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0xe0bd('0x113')});db[_0xe0bd('0xd5')][_0xe0bd('0x114')](db['JscriptyAnswerReport'],{'foreignKey':_0xe0bd('0x1cd'),'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x1ce')][_0xe0bd('0x14c')](db[_0xe0bd('0x54')],{});db[_0xe0bd('0x1ce')]['belongsTo'](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x166'),'foreignKey':'ListId'});db[_0xe0bd('0x1ce')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d')});db['SmsQueueReport']['belongsTo'](db['SmsInteraction'],{});db[_0xe0bd('0x1ce')][_0xe0bd('0x14c')](db[_0xe0bd('0x56')],{});db[_0xe0bd('0x1ce')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{});db[_0xe0bd('0x1ce')][_0xe0bd('0x14c')](db[_0xe0bd('0x58')],{});db[_0xe0bd('0xdb')][_0xe0bd('0x114')](db[_0xe0bd('0xd5')],{'foreignKey':_0xe0bd('0x1cf')});db[_0xe0bd('0xdb')][_0xe0bd('0x114')](db[_0xe0bd('0xd4')],{'foreignKey':_0xe0bd('0x1cf')});db[_0xe0bd('0xdb')][_0xe0bd('0x114')](db[_0xe0bd('0xd2')],{'foreignKey':'ProjectId'});db['SquareProject'][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17d'),'through':_0xe0bd('0x141')});db[_0xe0bd('0xe5')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x124')});db['Team'][_0xe0bd('0x11e')](db[_0xe0bd('0x1c')],{'through':'team_has_voice_queues','as':_0xe0bd('0x1d0')});db['Team']['belongsToMany'](db[_0xe0bd('0x3e')],{'through':'team_has_mail_queues','as':_0xe0bd('0x12a')});db[_0xe0bd('0xe5')][_0xe0bd('0x11e')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xe0bd('0x12b')});db['Team']['belongsToMany'](db['FaxQueue'],{'through':_0xe0bd('0x180'),'as':_0xe0bd('0x1d1')});db[_0xe0bd('0xe5')][_0xe0bd('0x11e')](db[_0xe0bd('0x58')],{'through':_0xe0bd('0x186'),'as':_0xe0bd('0x12d')});db[_0xe0bd('0xe5')][_0xe0bd('0x11e')](db[_0xe0bd('0x61')],{'through':_0xe0bd('0x18d'),'as':_0xe0bd('0x1d2')});db[_0xe0bd('0xe5')][_0xe0bd('0x11e')](db['WhatsappQueue'],{'through':_0xe0bd('0x1d3'),'as':'WhatsappQueues'});db[_0xe0bd('0xe9')][_0xe0bd('0x114')](db['CmHopper'],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xe0bd('0xe9')][_0xe0bd('0x114')](db[_0xe0bd('0x78')],{'as':_0xe0bd('0x149'),'foreignKey':_0xe0bd('0x1d4')});db[_0xe0bd('0xe9')][_0xe0bd('0x114')](db[_0xe0bd('0x14a')],{'as':'HopperHistories','foreignKey':_0xe0bd('0x1d4')});db[_0xe0bd('0xe9')][_0xe0bd('0x114')](db[_0xe0bd('0x76')],{'as':_0xe0bd('0x1d5'),'foreignKey':_0xe0bd('0x1d4')});db[_0xe0bd('0xe9')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0xe0bd('0x14d')});db[_0xe0bd('0xe9')]['belongsTo'](db['Trunk'],{'as':_0xe0bd('0x14e'),'foreignKey':'TrunkBackupId'});db[_0xe0bd('0xe9')][_0xe0bd('0x14c')](db[_0xe0bd('0x85')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xe0bd('0xe9')][_0xe0bd('0x14c')](db[_0xe0bd('0x13f')],{'as':_0xe0bd('0x13f'),'foreignKey':_0xe0bd('0x1d6')});db['Campaign'][_0xe0bd('0x11e')](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x122'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0xe0bd('0x11e')](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x155'),'through':_0xe0bd('0x1d7')});db[_0xe0bd('0xee')][_0xe0bd('0x14c')](db[_0xe0bd('0x163')],{});db[_0xe0bd('0xee')][_0xe0bd('0x14c')](db[_0xe0bd('0x41')],{});db[_0xe0bd('0xee')][_0xe0bd('0x14c')](db[_0xe0bd('0x3c')],{'foreignKey':_0xe0bd('0x1d8'),'as':'FromAccount'});db['MailTransferReport'][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'foreignKey':_0xe0bd('0x1d9'),'as':_0xe0bd('0x1da')});db[_0xe0bd('0xee')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'foreignKey':_0xe0bd('0x1db'),'as':_0xe0bd('0x1dc')});db['MailTransferReport'][_0xe0bd('0x14c')](db[_0xe0bd('0x3e')],{'foreignKey':_0xe0bd('0x1dd'),'as':'ToQueue'});db[_0xe0bd('0xee')]['belongsTo'](db[_0xe0bd('0x3c')],{'foreignKey':_0xe0bd('0x1de'),'as':_0xe0bd('0x1df')});db[_0xe0bd('0xf0')][_0xe0bd('0x14c')](db[_0xe0bd('0x191')],{});db[_0xe0bd('0xf0')][_0xe0bd('0x14c')](db[_0xe0bd('0x67')],{});db[_0xe0bd('0xf0')][_0xe0bd('0x14c')](db['ChatWebsite'],{'foreignKey':_0xe0bd('0x1e0'),'as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db[_0xe0bd('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe0bd('0xf0')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'foreignKey':_0xe0bd('0x1db'),'as':'ToAgent'});db['ChatTransferReport']['belongsTo'](db['ChatQueue'],{'foreignKey':_0xe0bd('0x1e1'),'as':'ToQueue'});db[_0xe0bd('0xf0')][_0xe0bd('0x14c')](db[_0xe0bd('0x63')],{'foreignKey':_0xe0bd('0x1e2'),'as':_0xe0bd('0x1df')});db[_0xe0bd('0xf2')]['belongsTo'](db['FaxMessage'],{});db[_0xe0bd('0xf2')][_0xe0bd('0x14c')](db[_0xe0bd('0x4c')],{});db[_0xe0bd('0xf2')][_0xe0bd('0x14c')](db[_0xe0bd('0x176')],{'foreignKey':_0xe0bd('0x1e3'),'as':_0xe0bd('0x1e4')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0xe0bd('0x1da')});db[_0xe0bd('0xf2')][_0xe0bd('0x14c')](db['User'],{'foreignKey':_0xe0bd('0x1db'),'as':_0xe0bd('0x1dc')});db[_0xe0bd('0xf2')][_0xe0bd('0x14c')](db[_0xe0bd('0x50')],{'foreignKey':'ToFaxQueueId','as':_0xe0bd('0x1e5')});db[_0xe0bd('0xf2')][_0xe0bd('0x14c')](db[_0xe0bd('0x176')],{'foreignKey':_0xe0bd('0x1e6'),'as':'ToAccount'});db[_0xe0bd('0xf4')]['belongsTo'](db[_0xe0bd('0x5f')],{});db[_0xe0bd('0xf4')][_0xe0bd('0x14c')](db[_0xe0bd('0x5d')],{});db['OpenchannelTransferReport'][_0xe0bd('0x14c')](db[_0xe0bd('0x5a')],{'foreignKey':_0xe0bd('0x1e7'),'as':_0xe0bd('0x1e4')});db['OpenchannelTransferReport'][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'foreignKey':_0xe0bd('0x1d9'),'as':_0xe0bd('0x1da')});db[_0xe0bd('0xf4')]['belongsTo'](db[_0xe0bd('0x13')],{'foreignKey':_0xe0bd('0x1db'),'as':_0xe0bd('0x1dc')});db[_0xe0bd('0xf4')]['belongsTo'](db[_0xe0bd('0x61')],{'foreignKey':_0xe0bd('0x1e8'),'as':_0xe0bd('0x1e5')});db[_0xe0bd('0xf4')][_0xe0bd('0x14c')](db[_0xe0bd('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0xe0bd('0x1df')});db['SmsTransferReport']['belongsTo'](db[_0xe0bd('0x56')],{});db[_0xe0bd('0xf6')]['belongsTo'](db['SmsInteraction'],{});db['SmsTransferReport'][_0xe0bd('0x14c')](db[_0xe0bd('0x54')],{'foreignKey':_0xe0bd('0x1e9'),'as':'FromAccount'});db[_0xe0bd('0xf6')]['belongsTo'](db[_0xe0bd('0x13')],{'foreignKey':_0xe0bd('0x1d9'),'as':_0xe0bd('0x1da')});db[_0xe0bd('0xf6')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'foreignKey':_0xe0bd('0x1db'),'as':_0xe0bd('0x1dc')});db[_0xe0bd('0xf6')][_0xe0bd('0x14c')](db[_0xe0bd('0x58')],{'foreignKey':_0xe0bd('0x1ea'),'as':'ToQueue'});db[_0xe0bd('0xf6')][_0xe0bd('0x14c')](db[_0xe0bd('0x54')],{'foreignKey':_0xe0bd('0x1eb'),'as':_0xe0bd('0x1df')});db[_0xe0bd('0xf8')][_0xe0bd('0x114')](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x174'),'foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0xf8')][_0xe0bd('0x114')](db['CmCustomField'],{'as':_0xe0bd('0x1ec'),'foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0xf8')]['hasMany'](db['CmContact'],{'as':_0xe0bd('0x120'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0xf8')][_0xe0bd('0x114')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0xf8')][_0xe0bd('0x114')](db[_0xe0bd('0x14a')],{'as':'HopperHistory','foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0xf8')][_0xe0bd('0x114')](db[_0xe0bd('0x7a')],{'as':_0xe0bd('0x7a'),'foreignKey':'ListId'});db['CmList']['belongsToMany'](db[_0xe0bd('0x1c')],{'as':_0xe0bd('0x1ed'),'through':_0xe0bd('0x1ee')});db['CmList']['belongsToMany'](db[_0xe0bd('0x13')],{'as':'Agents','through':_0xe0bd('0x123')});db['VoicePrefix'][_0xe0bd('0x114')](db[_0xe0bd('0x111')],{'as':'Extensions','onDelete':'cascade'});db[_0xe0bd('0xf9')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x131')});db['UserProfile']['hasMany'](db['User'],{'as':_0xe0bd('0x17d'),'foreignKey':_0xe0bd('0x11d')});db[_0xe0bd('0xfb')][_0xe0bd('0x114')](db[_0xe0bd('0xfd')],{'as':'UserProfileSections','foreignKey':_0xe0bd('0x11d'),'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0xfd')][_0xe0bd('0x114')](db[_0xe0bd('0xff')],{'as':_0xe0bd('0x1ef'),'foreignKey':_0xe0bd('0x1f0'),'onDelete':_0xe0bd('0x113')});db[_0xe0bd('0x13c')]['hasMany'](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x174'),'foreignKey':_0xe0bd('0x1f1')});db[_0xe0bd('0x13c')][_0xe0bd('0x114')](db[_0xe0bd('0x80')],{'as':_0xe0bd('0x162'),'foreignKey':_0xe0bd('0x1f1')});db[_0xe0bd('0x13c')]['hasMany'](db[_0xe0bd('0x107')],{'as':_0xe0bd('0x157'),'foreignKey':_0xe0bd('0x1f1')});db[_0xe0bd('0x13c')]['hasMany'](db[_0xe0bd('0x105')],{'as':'Interactions'});db[_0xe0bd('0x13c')][_0xe0bd('0x114')](db[_0xe0bd('0x104')],{'as':_0xe0bd('0x165')});db[_0xe0bd('0x13c')][_0xe0bd('0x14c')](db[_0xe0bd('0xf8')],{'as':_0xe0bd('0x166'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xe0bd('0x14c')](db[_0xe0bd('0x150')],{'as':_0xe0bd('0x151'),'foreignKey':_0xe0bd('0x169')});db[_0xe0bd('0x13c')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x152'),'through':_0xe0bd('0x13e')});db['WhatsappApplication'][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xe0bd('0x14c')](db['WhatsappQueue'],{'onDelete':_0xe0bd('0x172')});db[_0xe0bd('0x104')][_0xe0bd('0x14c')](db[_0xe0bd('0x13c')],{'onDelete':_0xe0bd('0x172')});db['WhatsappApplication'][_0xe0bd('0x14c')](db['Interval'],{'onDelete':_0xe0bd('0x172'),'foreignKey':_0xe0bd('0x14f')});db['WhatsappApplication'][_0xe0bd('0x14c')](db[_0xe0bd('0x8e')],{'onDelete':'restrict','foreignKey':_0xe0bd('0x189')});db[_0xe0bd('0x105')][_0xe0bd('0x114')](db[_0xe0bd('0x107')],{'as':_0xe0bd('0x157'),'onDelete':_0xe0bd('0x113'),'foreignKey':_0xe0bd('0x1f2')});db[_0xe0bd('0x105')]['belongsTo'](db[_0xe0bd('0x13c')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1f1')});db['WhatsappInteraction']['belongsTo'](db['CmContact'],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x105')]['belongsTo'](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17b'),'foreignKey':_0xe0bd('0x10e')});db[_0xe0bd('0x105')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xe0bd('0x16f')});db[_0xe0bd('0x105')][_0xe0bd('0x11e')](db[_0xe0bd('0x8e')],{'through':_0xe0bd('0x1ad'),'as':'ThroughTags'});db['WhatsappInteraction'][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':_0xe0bd('0x17d'),'through':_0xe0bd('0x1f3'),'foreignKey':_0xe0bd('0x1f2')});db[_0xe0bd('0x107')][_0xe0bd('0x14c')](db['User'],{'as':_0xe0bd('0x13')});db['WhatsappMessage'][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'onDelete':_0xe0bd('0x113'),'as':_0xe0bd('0x16d')});db['WhatsappMessage']['belongsTo'](db[_0xe0bd('0x105')],{'onDelete':'cascade','as':_0xe0bd('0x17e'),'foreignKey':_0xe0bd('0x1f2')});db[_0xe0bd('0x107')][_0xe0bd('0x14c')](db[_0xe0bd('0x13c')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1f1')});db[_0xe0bd('0x1f4')][_0xe0bd('0x14c')](db['WhatsappAccount'],{});db[_0xe0bd('0x1f4')][_0xe0bd('0x14c')](db['CmList'],{'as':'List','foreignKey':_0xe0bd('0x167')});db[_0xe0bd('0x1f4')][_0xe0bd('0x14c')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x15d')});db[_0xe0bd('0x1f4')]['belongsTo'](db[_0xe0bd('0x105')],{});db[_0xe0bd('0x1f4')][_0xe0bd('0x14c')](db[_0xe0bd('0x12e')],{});db['WhatsappQueueReport'][_0xe0bd('0x14c')](db[_0xe0bd('0x107')],{});db[_0xe0bd('0x1f4')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{});db[_0xe0bd('0x10a')][_0xe0bd('0x14c')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0xe0bd('0x14c')](db['WhatsappInteraction'],{});db[_0xe0bd('0x10a')][_0xe0bd('0x14c')](db[_0xe0bd('0x13c')],{'foreignKey':'FromWhatsappAccountId','as':_0xe0bd('0x1e4')});db[_0xe0bd('0x10a')]['belongsTo'](db[_0xe0bd('0x13c')],{'foreignKey':_0xe0bd('0x1f5'),'as':'ToAccount'});db[_0xe0bd('0x10a')][_0xe0bd('0x14c')](db[_0xe0bd('0x12e')],{'foreignKey':'ToQueueId','as':_0xe0bd('0x1e5')});db[_0xe0bd('0x10a')][_0xe0bd('0x14c')](db[_0xe0bd('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe0bd('0x10a')]['belongsTo'](db[_0xe0bd('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xe0bd('0x12e')][_0xe0bd('0x11e')](db[_0xe0bd('0x13')],{'as':'Agents','through':_0xe0bd('0x37'),'foreignKey':_0xe0bd('0x1f6')});db['WhatsappQueue']['belongsToMany'](db[_0xe0bd('0xe5')],{'through':_0xe0bd('0x1d3'),'as':'Teams'});module[_0xe0bd('0x1f7')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b0c7042..8553a23 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbde2=['/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/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/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/demo','snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','default','use','format','x-forwarded-for','statusCode','responseTime','user','name','role','logger','body','method','headers','connection','remoteAddress','url','device','other','agent_id','agent_name','test','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/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/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xbde2,0x92));var _0x2bde=function(_0x9d46ab,_0x1a0b82){_0x9d46ab=_0x9d46ab-0x0;var _0x411ec0=_0xbde2[_0x9d46ab];return _0x411ec0;};'use strict';var path=require(_0x2bde('0x0'));var express=require(_0x2bde('0x1'));var ewinston=require(_0x2bde('0x2'));var util=require(_0x2bde('0x3'));var errors=require(_0x2bde('0x4'));var config=require(_0x2bde('0x5'));var logger=require(_0x2bde('0x6'))(_0x2bde('0x7'));var authLogger=require(_0x2bde('0x6'))('auth');exports[_0x2bde('0x8')]=function(_0x58fd42){_0x58fd42[_0x2bde('0x9')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4f5318,_0xf83928){return util[_0x2bde('0xa')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x4f5318['method'],_0x4f5318['headers'][_0x2bde('0xb')]?_0x4f5318['headers'][_0x2bde('0xb')]:_0x4f5318['connection']['remoteAddress']||_0x4f5318['ip'],_0x4f5318['url'],_0xf83928[_0x2bde('0xc')],_0xf83928[_0x2bde('0xd')],_0x4f5318[_0x2bde('0xe')]?_0x4f5318[_0x2bde('0xe')]['id']:null,_0x4f5318[_0x2bde('0xe')]?_0x4f5318['user'][_0x2bde('0xf')]:null,_0x4f5318[_0x2bde('0xe')]?_0x4f5318['user'][_0x2bde('0x10')]:null);}}));_0x58fd42[_0x2bde('0x9')](ewinston[_0x2bde('0x11')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4ba63d,_0x340e42){var _0x35d323='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4ba63d[_0x2bde('0x12')]&&_0x4ba63d[_0x2bde('0x12')]['device']&&_0x4ba63d[_0x2bde('0x12')]['agent_id']){_0x35d323='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x2bde('0xa')](_0x35d323,_0x4ba63d[_0x2bde('0x13')],_0x4ba63d[_0x2bde('0x14')][_0x2bde('0xb')]?_0x4ba63d[_0x2bde('0x14')]['x-forwarded-for']:_0x4ba63d[_0x2bde('0x15')][_0x2bde('0x16')]||_0x4ba63d['ip'],_0x4ba63d[_0x2bde('0x17')],_0x340e42[_0x2bde('0xc')],_0x340e42[_0x2bde('0xd')],_0x4ba63d['user']?_0x4ba63d[_0x2bde('0xe')]['id']:null,_0x4ba63d['user']?_0x4ba63d[_0x2bde('0xe')][_0x2bde('0xf')]:null,_0x4ba63d[_0x2bde('0xe')]?_0x4ba63d[_0x2bde('0xe')][_0x2bde('0x10')]:null,_0x4ba63d[_0x2bde('0x12')]&&_0x4ba63d[_0x2bde('0x12')][_0x2bde('0x18')]?_0x4ba63d[_0x2bde('0x12')][_0x2bde('0x18')]:_0x2bde('0x19'),_0x4ba63d[_0x2bde('0x12')]&&_0x4ba63d['body'][_0x2bde('0x1a')]?_0x4ba63d[_0x2bde('0x12')][_0x2bde('0x1a')]:'',_0x4ba63d[_0x2bde('0x12')]&&_0x4ba63d[_0x2bde('0x12')][_0x2bde('0x1b')]?_0x4ba63d['body'][_0x2bde('0x1b')]:'');},'ignoreRoute':function(_0x2a4946){var _0x5f1984=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5f1984[_0x2bde('0x1c')](_0x2a4946['url']);}}));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x1d'),require('./api/user'));_0x58fd42['use']('/api/voice/chanspy',require(_0x2bde('0x1e')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x1f'),require(_0x2bde('0x20')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x21'),require('./api/voiceExtension'));_0x58fd42[_0x2bde('0x9')]('/api/voice/mohs',require(_0x2bde('0x22')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x23'),require(_0x2bde('0x24')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x25'),require('./api/voiceRecording'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x26'),require(_0x2bde('0x27')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x28'),require('./api/voiceMail'));_0x58fd42['use'](_0x2bde('0x29'),require('./api/voiceMailMessage'));_0x58fd42[_0x2bde('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x2a'),require(_0x2bde('0x2b')));_0x58fd42['use'](_0x2bde('0x2c'),require(_0x2bde('0x2d')));_0x58fd42['use']('/api/voice/queues/reports',require(_0x2bde('0x2e')));_0x58fd42[_0x2bde('0x9')]('/api/members/reports',require('./api/memberReport'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x2f'),require(_0x2bde('0x30')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x31'),require('./api/voiceTransferReport'));_0x58fd42[_0x2bde('0x9')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x32'),require(_0x2bde('0x33')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x34'),require(_0x2bde('0x35')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x36'),require(_0x2bde('0x37')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x38'),require(_0x2bde('0x39')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x3a'),require(_0x2bde('0x3b')));_0x58fd42[_0x2bde('0x9')]('/api/mail/applications',require('./api/mailApplication'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x3c'),require(_0x2bde('0x3d')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x3e'),require(_0x2bde('0x3f')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x40'),require(_0x2bde('0x41')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x42'),require('./api/faxAccount'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x43'),require('./api/faxApplication'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x44'),require(_0x2bde('0x45')));_0x58fd42[_0x2bde('0x9')]('/api/fax/messages',require(_0x2bde('0x46')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x47'),require(_0x2bde('0x48')));_0x58fd42['use'](_0x2bde('0x49'),require(_0x2bde('0x4a')));_0x58fd42['use']('/api/sms/accounts',require('./api/smsAccount'));_0x58fd42[_0x2bde('0x9')]('/api/sms/applications',require(_0x2bde('0x4b')));_0x58fd42[_0x2bde('0x9')]('/api/sms/interactions',require(_0x2bde('0x4c')));_0x58fd42['use'](_0x2bde('0x4d'),require(_0x2bde('0x4e')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x4f'),require(_0x2bde('0x50')));_0x58fd42[_0x2bde('0x9')]('/api/openchannel/accounts',require(_0x2bde('0x51')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x52'),require(_0x2bde('0x53')));_0x58fd42['use'](_0x2bde('0x54'),require(_0x2bde('0x55')));_0x58fd42[_0x2bde('0x9')]('/api/openchannel/messages',require(_0x2bde('0x56')));_0x58fd42[_0x2bde('0x9')]('/api/openchannel/queues',require(_0x2bde('0x57')));_0x58fd42[_0x2bde('0x9')]('/api/chat/websites',require(_0x2bde('0x58')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x59'),require('./api/openchannelQueueReport'));_0x58fd42['use']('/api/chat/applications',require('./api/chatApplication'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x5a'),require(_0x2bde('0x5b')));_0x58fd42['use'](_0x2bde('0x5c'),require(_0x2bde('0x5d')));_0x58fd42['use'](_0x2bde('0x5e'),require(_0x2bde('0x5f')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x60'),require(_0x2bde('0x61')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x62'),require(_0x2bde('0x63')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x64'),require(_0x2bde('0x65')));_0x58fd42[_0x2bde('0x9')]('/api/cm/companies',require('./api/cmCompany'));_0x58fd42['use'](_0x2bde('0x66'),require(_0x2bde('0x67')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x68'),require(_0x2bde('0x69')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x6a'),require(_0x2bde('0x6b')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x6c'),require(_0x2bde('0x6d')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x6e'),require('./api/cmHopperHistory'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x6f'),require(_0x2bde('0x70')));_0x58fd42['use']('/api/actions',require(_0x2bde('0x71')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x72'),require(_0x2bde('0x73')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x74'),require(_0x2bde('0x75')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x76'),require(_0x2bde('0x77')));_0x58fd42[_0x2bde('0x9')]('/api/conditions',require('./api/condition'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x78'),require(_0x2bde('0x79')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x7a'),require(_0x2bde('0x7b')));_0x58fd42[_0x2bde('0x9')]('/api/cdr',require(_0x2bde('0x7c')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x7d'),require(_0x2bde('0x7e')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x7f'),require(_0x2bde('0x80')));_0x58fd42[_0x2bde('0x9')]('/api/sounds',require(_0x2bde('0x81')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x82'),require(_0x2bde('0x83')));_0x58fd42['use'](_0x2bde('0x84'),require(_0x2bde('0x85')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x86'),require('./api/trigger'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x87'),require('./api/variable'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x88'),require('./api/integration'));_0x58fd42['use'](_0x2bde('0x89'),require('./api/integrationReport'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x8a'),require('./api/analyticCustomReport'));_0x58fd42[_0x2bde('0x9')]('/api/analytics/default_reports',require(_0x2bde('0x8b')));_0x58fd42['use']('/api/analytics/extracted_reports',require(_0x2bde('0x8c')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x8d'),require(_0x2bde('0x8e')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x8f'),require('./api/analyticFieldReport'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x90'),require(_0x2bde('0x91')));_0x58fd42[_0x2bde('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x92'),require('./api/intSalesforceConfiguration'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x93'),require(_0x2bde('0x94')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x95'),require(_0x2bde('0x96')));_0x58fd42['use'](_0x2bde('0x97'),require(_0x2bde('0x98')));_0x58fd42['use'](_0x2bde('0x99'),require(_0x2bde('0x9a')));_0x58fd42[_0x2bde('0x9')]('/api/integrations/desk/accounts',require(_0x2bde('0x9b')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x9c'),require('./api/intDeskConfiguration'));_0x58fd42[_0x2bde('0x9')]('/api/integrations/desk/fields',require(_0x2bde('0x9d')));_0x58fd42['use'](_0x2bde('0x9e'),require(_0x2bde('0x9f')));_0x58fd42['use'](_0x2bde('0xa0'),require(_0x2bde('0xa1')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xa2'),require(_0x2bde('0xa3')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xa4'),require(_0x2bde('0xa5')));_0x58fd42[_0x2bde('0x9')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xa6'),require(_0x2bde('0xa7')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xa8'),require('./api/intFreshdeskAccount'));_0x58fd42['use'](_0x2bde('0xa9'),require('./api/intFreshdeskConfiguration'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xaa'),require(_0x2bde('0xab')));_0x58fd42['use']('/api/integrations/vtiger/accounts',require(_0x2bde('0xac')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xad'),require(_0x2bde('0xae')));_0x58fd42['use'](_0x2bde('0xaf'),require(_0x2bde('0xb0')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xb1'),require(_0x2bde('0xb2')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xb3'),require(_0x2bde('0xb4')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xb5'),require(_0x2bde('0xb6')));_0x58fd42['use'](_0x2bde('0xb7'),require(_0x2bde('0xb8')));_0x58fd42['use'](_0x2bde('0xb9'),require(_0x2bde('0xba')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xbb'),require('./api/intDynamics365Field'));_0x58fd42['use'](_0x2bde('0xbc'),require('./api/intFreshsalesAccount'));_0x58fd42[_0x2bde('0x9')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x58fd42['use'](_0x2bde('0xbd'),require(_0x2bde('0xbe')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xbf'),require(_0x2bde('0xc0')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xc1'),require(_0x2bde('0xc2')));_0x58fd42[_0x2bde('0x9')]('/api/chat/internal/messages',require(_0x2bde('0xc3')));_0x58fd42['use'](_0x2bde('0xc4'),require(_0x2bde('0xc5')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xc6'),require(_0x2bde('0xc7')));_0x58fd42['use'](_0x2bde('0xc8'),require(_0x2bde('0xc9')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xca'),require(_0x2bde('0xcb')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xcc'),require('./api/squareReport'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xcd'),require(_0x2bde('0xce')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xcf'),require(_0x2bde('0xd0')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xd1'),require(_0x2bde('0xd2')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xd3'),require('./api/squareOdbc'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xd4'),require(_0x2bde('0xd5')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xd6'),require(_0x2bde('0xd7')));_0x58fd42[_0x2bde('0x9')]('/api/square/messages',require('./api/squareMessage'));_0x58fd42['use'](_0x2bde('0xd8'),require('./api/team'));_0x58fd42[_0x2bde('0x9')]('/api/license',require(_0x2bde('0xd9')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xda'),require(_0x2bde('0xdb')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xdc'),require(_0x2bde('0xdd')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xde'),require(_0x2bde('0xdf')));_0x58fd42[_0x2bde('0x9')]('/api/plugins',require(_0x2bde('0xe0')));_0x58fd42[_0x2bde('0x9')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x58fd42[_0x2bde('0x9')]('/api/chat/reports/transfer',require(_0x2bde('0xe1')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xe2'),require(_0x2bde('0xe3')));_0x58fd42['use'](_0x2bde('0xe4'),require('./api/openchannelTransferReport'));_0x58fd42['use'](_0x2bde('0xe5'),require(_0x2bde('0xe6')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xe7'),require(_0x2bde('0xe8')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xe9'),require('./api/voicePrefix'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xea'),require(_0x2bde('0xeb')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xec'),require('./api/userProfileSection'));_0x58fd42['use'](_0x2bde('0xed'),require(_0x2bde('0xee')));_0x58fd42['use'](_0x2bde('0xef'),require(_0x2bde('0xf0')));_0x58fd42['use'](_0x2bde('0xf1'),require(_0x2bde('0xf2')));_0x58fd42[_0x2bde('0x9')]('/api/whatsapp/applications',require(_0x2bde('0xf3')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xf4'),require(_0x2bde('0xf5')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xf6'),require('./api/whatsappMessage'));_0x58fd42['use'](_0x2bde('0xf7'),require('./api/whatsappQueueReport'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xf8'),require(_0x2bde('0xf9')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xfa'),require(_0x2bde('0xfb')));_0x58fd42[_0x2bde('0x9')]('/api/cloudProviders',require('./api/cloudProvider'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0xfc'),require(_0x2bde('0xfd')));_0x58fd42['use'](_0x2bde('0xfe'),require(_0x2bde('0xff')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x100'),require(_0x2bde('0x101')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x102'),require('./api/rpc'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x103'),require(_0x2bde('0x104')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x105'),require('./api/system'));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x106'),require(_0x2bde('0x107')));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x108'),require(_0x2bde('0x109')));_0x58fd42['use'](_0x2bde('0x10a'),express[_0x2bde('0x10b')](path[_0x2bde('0x10c')](config['root'],_0x2bde('0x10a'))));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x10d'),express['static'](path['join'](config[_0x2bde('0x10e')],_0x2bde('0x10d'))));_0x58fd42[_0x2bde('0x9')](_0x2bde('0x10f'),express['static'](path[_0x2bde('0x10c')](config[_0x2bde('0x10e')],'/demo')));_0x58fd42[_0x2bde('0x9')]('/snippet',express[_0x2bde('0x10b')](path['join'](config[_0x2bde('0x10e')],_0x2bde('0x110'),_0x2bde('0x111'))));_0x58fd42[_0x2bde('0x9')]('/plugins',express[_0x2bde('0x10b')](path[_0x2bde('0x10c')](config[_0x2bde('0x10e')],_0x2bde('0x112'))));_0x58fd42[_0x2bde('0x113')](_0x2bde('0x114'))[_0x2bde('0x115')](errors[0x194]);_0x58fd42[_0x2bde('0x113')]('/*')[_0x2bde('0x115')](function(_0x317001,_0x1039c5){_0x1039c5[_0x2bde('0x116')](path[_0x2bde('0x117')](_0x58fd42[_0x2bde('0x115')](_0x2bde('0x118'))+_0x2bde('0x119')));});}; \ No newline at end of file +var _0x6deb=['/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./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/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/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/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/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/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/messages','./api/squareMessage','./api/team','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/userProfile/sections','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','/www','/demo','join','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','./errors','./config/environment','./config/logger','api','auth','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','role','other','agent_name','./api/user','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue'];(function(_0x4a859d,_0x151719){var _0x4f685e=function(_0x5119f8){while(--_0x5119f8){_0x4a859d['push'](_0x4a859d['shift']());}};_0x4f685e(++_0x151719);}(_0x6deb,0x1f0));var _0xb6de=function(_0x58045a,_0x3a09ce){_0x58045a=_0x58045a-0x0;var _0x501d0f=_0x6deb[_0x58045a];return _0x501d0f;};'use strict';var path=require(_0xb6de('0x0'));var express=require(_0xb6de('0x1'));var ewinston=require(_0xb6de('0x2'));var util=require('util');var errors=require(_0xb6de('0x3'));var config=require(_0xb6de('0x4'));var logger=require(_0xb6de('0x5'))(_0xb6de('0x6'));var authLogger=require(_0xb6de('0x5'))(_0xb6de('0x7'));exports['default']=function(_0x2eeb32){_0x2eeb32[_0xb6de('0x8')](ewinston[_0xb6de('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x47c936,_0x509569){return util[_0xb6de('0xa')](_0xb6de('0xb'),_0x47c936[_0xb6de('0xc')],_0x47c936[_0xb6de('0xd')]['x-forwarded-for']?_0x47c936['headers'][_0xb6de('0xe')]:_0x47c936[_0xb6de('0xf')][_0xb6de('0x10')]||_0x47c936['ip'],_0x47c936[_0xb6de('0x11')],_0x509569[_0xb6de('0x12')],_0x509569['responseTime'],_0x47c936[_0xb6de('0x13')]?_0x47c936['user']['id']:null,_0x47c936[_0xb6de('0x13')]?_0x47c936[_0xb6de('0x13')][_0xb6de('0x14')]:null,_0x47c936['user']?_0x47c936['user']['role']:null);}}));_0x2eeb32[_0xb6de('0x8')](ewinston[_0xb6de('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xd8d3ef,_0x533a9a){var _0x1bc2fa=_0xb6de('0x15');if(_0xd8d3ef[_0xb6de('0x16')]&&_0xd8d3ef[_0xb6de('0x16')][_0xb6de('0x17')]&&_0xd8d3ef[_0xb6de('0x16')][_0xb6de('0x18')]){_0x1bc2fa=_0xb6de('0x19');}return util[_0xb6de('0xa')](_0x1bc2fa,_0xd8d3ef[_0xb6de('0xc')],_0xd8d3ef[_0xb6de('0xd')]['x-forwarded-for']?_0xd8d3ef[_0xb6de('0xd')][_0xb6de('0xe')]:_0xd8d3ef['connection'][_0xb6de('0x10')]||_0xd8d3ef['ip'],_0xd8d3ef['url'],_0x533a9a[_0xb6de('0x12')],_0x533a9a[_0xb6de('0x1a')],_0xd8d3ef[_0xb6de('0x13')]?_0xd8d3ef[_0xb6de('0x13')]['id']:null,_0xd8d3ef['user']?_0xd8d3ef[_0xb6de('0x13')][_0xb6de('0x14')]:null,_0xd8d3ef[_0xb6de('0x13')]?_0xd8d3ef[_0xb6de('0x13')][_0xb6de('0x1b')]:null,_0xd8d3ef[_0xb6de('0x16')]&&_0xd8d3ef['body']['device']?_0xd8d3ef[_0xb6de('0x16')][_0xb6de('0x17')]:_0xb6de('0x1c'),_0xd8d3ef[_0xb6de('0x16')]&&_0xd8d3ef[_0xb6de('0x16')][_0xb6de('0x18')]?_0xd8d3ef['body'][_0xb6de('0x18')]:'',_0xd8d3ef[_0xb6de('0x16')]&&_0xd8d3ef[_0xb6de('0x16')][_0xb6de('0x1d')]?_0xd8d3ef[_0xb6de('0x16')][_0xb6de('0x1d')]:'');},'ignoreRoute':function(_0x420364){var _0x219cfd=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x219cfd['test'](_0x420364[_0xb6de('0x11')]);}}));_0x2eeb32['use']('/api/users',require(_0xb6de('0x1e')));_0x2eeb32[_0xb6de('0x8')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x1f'),require('./api/voiceContext'));_0x2eeb32[_0xb6de('0x8')]('/api/voice/extensions',require(_0xb6de('0x20')));_0x2eeb32[_0xb6de('0x8')]('/api/voice/mohs',require(_0xb6de('0x21')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x22'),require(_0xb6de('0x23')));_0x2eeb32[_0xb6de('0x8')]('/api/voice/recordings',require(_0xb6de('0x24')));_0x2eeb32[_0xb6de('0x8')]('/api/screen/recordings',require(_0xb6de('0x25')));_0x2eeb32['use'](_0xb6de('0x26'),require('./api/voiceMail'));_0x2eeb32['use']('/api/voice/mails/messages',require(_0xb6de('0x27')));_0x2eeb32['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x2eeb32['use'](_0xb6de('0x28'),require(_0xb6de('0x29')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x2a'),require('./api/voiceAgentReport'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x2b'),require('./api/voiceQueueReport'));_0x2eeb32['use'](_0xb6de('0x2c'),require(_0xb6de('0x2d')));_0x2eeb32['use']('/api/trunks',require('./api/trunk'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x2e'),require(_0xb6de('0x2f')));_0x2eeb32['use']('/api/mail/out_servers',require(_0xb6de('0x30')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x31'),require(_0xb6de('0x32')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x33'),require('./api/mailQueue'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x34'),require(_0xb6de('0x35')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x36'),require(_0xb6de('0x37')));_0x2eeb32[_0xb6de('0x8')]('/api/mail/messages',require(_0xb6de('0x38')));_0x2eeb32[_0xb6de('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x39'),require(_0xb6de('0x3a')));_0x2eeb32['use']('/api/dashboards',require(_0xb6de('0x3b')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x3c'),require(_0xb6de('0x3d')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x3e'),require(_0xb6de('0x3f')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x40'),require('./api/faxApplication'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x41'),require('./api/faxInteraction'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x42'),require(_0xb6de('0x43')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x44'),require(_0xb6de('0x45')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x46'),require(_0xb6de('0x47')));_0x2eeb32['use'](_0xb6de('0x48'),require(_0xb6de('0x49')));_0x2eeb32[_0xb6de('0x8')]('/api/sms/applications',require(_0xb6de('0x4a')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x4b'),require(_0xb6de('0x4c')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x4d'),require(_0xb6de('0x4e')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x4f'),require(_0xb6de('0x50')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x51'),require(_0xb6de('0x52')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x53'),require('./api/openchannelApplication'));_0x2eeb32[_0xb6de('0x8')]('/api/openchannel/interactions',require(_0xb6de('0x54')));_0x2eeb32[_0xb6de('0x8')]('/api/openchannel/messages',require(_0xb6de('0x55')));_0x2eeb32['use'](_0xb6de('0x56'),require(_0xb6de('0x57')));_0x2eeb32[_0xb6de('0x8')]('/api/chat/websites',require(_0xb6de('0x58')));_0x2eeb32['use'](_0xb6de('0x59'),require(_0xb6de('0x5a')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x5b'),require(_0xb6de('0x5c')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x5d'),require(_0xb6de('0x5e')));_0x2eeb32['use']('/api/chat/messages',require('./api/chatMessage'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x5f'),require(_0xb6de('0x60')));_0x2eeb32['use']('/api/chat/queues',require(_0xb6de('0x61')));_0x2eeb32['use'](_0xb6de('0x62'),require(_0xb6de('0x63')));_0x2eeb32['use'](_0xb6de('0x64'),require('./api/chatProactiveAction'));_0x2eeb32['use']('/api/cm/companies',require(_0xb6de('0x65')));_0x2eeb32[_0xb6de('0x8')]('/api/cm/contacts',require('./api/cmContact'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x66'),require(_0xb6de('0x67')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x68'),require(_0xb6de('0x69')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x6a'),require(_0xb6de('0x6b')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x6c'),require(_0xb6de('0x6d')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x6e'),require(_0xb6de('0x6f')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x70'),require('./api/action'));_0x2eeb32[_0xb6de('0x8')]('/api/automations',require(_0xb6de('0x71')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x72'),require(_0xb6de('0x73')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x74'),require(_0xb6de('0x75')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x76'),require(_0xb6de('0x77')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x78'),require(_0xb6de('0x79')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x7a'),require(_0xb6de('0x7b')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x7c'),require(_0xb6de('0x7d')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x7e'),require(_0xb6de('0x7f')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x80'),require(_0xb6de('0x81')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x82'),require(_0xb6de('0x83')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x84'),require(_0xb6de('0x85')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x86'),require(_0xb6de('0x87')));_0x2eeb32[_0xb6de('0x8')]('/api/triggers',require(_0xb6de('0x88')));_0x2eeb32['use'](_0xb6de('0x89'),require(_0xb6de('0x8a')));_0x2eeb32['use']('/api/integrations',require(_0xb6de('0x8b')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x8c'),require('./api/integrationReport'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x8d'),require('./api/analyticCustomReport'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x8e'),require(_0xb6de('0x8f')));_0x2eeb32['use'](_0xb6de('0x90'),require(_0xb6de('0x91')));_0x2eeb32['use'](_0xb6de('0x92'),require('./api/analyticMetric'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x93'),require(_0xb6de('0x94')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x95'),require(_0xb6de('0x96')));_0x2eeb32['use'](_0xb6de('0x97'),require(_0xb6de('0x98')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x99'),require('./api/intSalesforceConfiguration'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x9a'),require(_0xb6de('0x9b')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x9c'),require(_0xb6de('0x9d')));_0x2eeb32[_0xb6de('0x8')]('/api/integrations/sugarcrm/configurations',require(_0xb6de('0x9e')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x9f'),require(_0xb6de('0xa0')));_0x2eeb32['use']('/api/integrations/desk/accounts',require(_0xb6de('0xa1')));_0x2eeb32['use']('/api/integrations/desk/configurations',require(_0xb6de('0xa2')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xa3'),require(_0xb6de('0xa4')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xa5'),require(_0xb6de('0xa6')));_0x2eeb32[_0xb6de('0x8')]('/api/integrations/zoho/configurations',require(_0xb6de('0xa7')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xa8'),require(_0xb6de('0xa9')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xaa'),require(_0xb6de('0xab')));_0x2eeb32['use'](_0xb6de('0xac'),require(_0xb6de('0xad')));_0x2eeb32[_0xb6de('0x8')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x2eeb32[_0xb6de('0x8')]('/api/integrations/freshdesk/accounts',require(_0xb6de('0xae')));_0x2eeb32[_0xb6de('0x8')]('/api/integrations/freshdesk/configurations',require(_0xb6de('0xaf')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xb0'),require('./api/intFreshdeskField'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xb1'),require(_0xb6de('0xb2')));_0x2eeb32['use'](_0xb6de('0xb3'),require('./api/intVtigerConfiguration'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xb4'),require('./api/intVtigerField'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xb5'),require(_0xb6de('0xb6')));_0x2eeb32['use']('/api/integrations/servicenow/configurations',require(_0xb6de('0xb7')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xb8'),require(_0xb6de('0xb9')));_0x2eeb32['use']('/api/integrations/dynamics365/accounts',require(_0xb6de('0xba')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xbb'),require('./api/intDynamics365Configuration'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xbc'),require(_0xb6de('0xbd')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xbe'),require(_0xb6de('0xbf')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xc0'),require(_0xb6de('0xc1')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xc2'),require(_0xb6de('0xc3')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xc4'),require(_0xb6de('0xc5')));_0x2eeb32['use'](_0xb6de('0xc6'),require(_0xb6de('0xc7')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xc8'),require('./api/chatInternalMessage'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xc9'),require(_0xb6de('0xca')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xcb'),require(_0xb6de('0xcc')));_0x2eeb32['use'](_0xb6de('0xcd'),require(_0xb6de('0xce')));_0x2eeb32['use'](_0xb6de('0xcf'),require(_0xb6de('0xd0')));_0x2eeb32['use'](_0xb6de('0xd1'),require(_0xb6de('0xd2')));_0x2eeb32['use'](_0xb6de('0xd3'),require(_0xb6de('0xd4')));_0x2eeb32[_0xb6de('0x8')]('/api/jscripty/projects',require(_0xb6de('0xd5')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xd6'),require(_0xb6de('0xd7')));_0x2eeb32[_0xb6de('0x8')]('/api/square/odbc',require(_0xb6de('0xd8')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xd9'),require(_0xb6de('0xda')));_0x2eeb32[_0xb6de('0x8')]('/api/square/recordings',require('./api/squareRecording'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xdb'),require(_0xb6de('0xdc')));_0x2eeb32[_0xb6de('0x8')]('/api/teams',require(_0xb6de('0xdd')));_0x2eeb32[_0xb6de('0x8')]('/api/license',require(_0xb6de('0xde')));_0x2eeb32['use'](_0xb6de('0xdf'),require(_0xb6de('0xe0')));_0x2eeb32[_0xb6de('0x8')]('/api/migrations',require(_0xb6de('0xe1')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xe2'),require(_0xb6de('0xe3')));_0x2eeb32[_0xb6de('0x8')]('/api/plugins',require(_0xb6de('0xe4')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xe5'),require('./api/mailTransferReport'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xe6'),require(_0xb6de('0xe7')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xe8'),require(_0xb6de('0xe9')));_0x2eeb32['use']('/api/openchannel/reports/transfer',require(_0xb6de('0xea')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xeb'),require(_0xb6de('0xec')));_0x2eeb32['use']('/api/cm/lists',require(_0xb6de('0xed')));_0x2eeb32[_0xb6de('0x8')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x2eeb32[_0xb6de('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xee'),require('./api/userProfileSection'));_0x2eeb32['use']('/api/userProfile/resources',require(_0xb6de('0xef')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xf0'),require(_0xb6de('0xf1')));_0x2eeb32['use'](_0xb6de('0xf2'),require(_0xb6de('0xf3')));_0x2eeb32['use']('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x2eeb32['use'](_0xb6de('0xf4'),require(_0xb6de('0xf5')));_0x2eeb32['use'](_0xb6de('0xf6'),require(_0xb6de('0xf7')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xf8'),require(_0xb6de('0xf9')));_0x2eeb32['use']('/api/whatsapp/reports/transfer',require(_0xb6de('0xfa')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xfb'),require(_0xb6de('0xfc')));_0x2eeb32[_0xb6de('0x8')]('/api/cloudProviders',require(_0xb6de('0xfd')));_0x2eeb32[_0xb6de('0x8')]('/api/auth/local',require(_0xb6de('0xfe')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0xff'),require(_0xb6de('0x100')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x101'),require(_0xb6de('0x102')));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x103'),require('./api/rpc'));_0x2eeb32[_0xb6de('0x8')]('/api/version',require(_0xb6de('0x104')));_0x2eeb32['use'](_0xb6de('0x105'),require(_0xb6de('0x106')));_0x2eeb32['use'](_0xb6de('0x107'),require('./api/pm2'));_0x2eeb32['use'](_0xb6de('0x108'),require(_0xb6de('0x109')));_0x2eeb32[_0xb6de('0x8')]('/apidoc',express[_0xb6de('0x10a')](path['join'](config[_0xb6de('0x10b')],_0xb6de('0x10c'))));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x10d'),express[_0xb6de('0x10a')](path['join'](config[_0xb6de('0x10b')],_0xb6de('0x10d'))));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x10e'),express['static'](path[_0xb6de('0x10f')](config['root'],_0xb6de('0x10e'))));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x110'),express[_0xb6de('0x10a')](path[_0xb6de('0x10f')](config['root'],_0xb6de('0x111'),_0xb6de('0x112'))));_0x2eeb32[_0xb6de('0x8')](_0xb6de('0x113'),express['static'](path[_0xb6de('0x10f')](config[_0xb6de('0x10b')],'/server/files/plugins')));_0x2eeb32[_0xb6de('0x114')](_0xb6de('0x115'))[_0xb6de('0x116')](errors[0x194]);_0x2eeb32[_0xb6de('0x114')]('/*')[_0xb6de('0x116')](function(_0x4519d0,_0x48e092){_0x48e092[_0xb6de('0x117')](path[_0xb6de('0x118')](_0x2eeb32['get'](_0xb6de('0x119'))+_0xb6de('0x11a')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0a1e9d4..d05e8ba 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9b3=['../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc'];(function(_0x2151fb,_0x49b905){var _0x455486=function(_0x91b3b1){while(--_0x91b3b1){_0x2151fb['push'](_0x2151fb['shift']());}};_0x455486(++_0x49b905);}(_0xa9b3,0x1d5));var _0x3a9b=function(_0x53f5ec,_0x34bca9){_0x53f5ec=_0x53f5ec-0x0;var _0x4e2d6a=_0xa9b3[_0x53f5ec];return _0x4e2d6a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3a9b('0x0'));var _=require(_0x3a9b('0x1'));var config=require(_0x3a9b('0x2'));exports[_0x3a9b('0x3')]=function(){return new BPromise(function(_0x23d08b,_0x22d426){var _0x11ba56={};_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/user/user.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x5')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x6')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x7')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x8')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x9')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0xa')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0xb')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0xc')));_0x11ba56=_['merge'](_0x11ba56,require('../api/trunk/trunk.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0xd')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0xe')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0xf')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x10')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x11')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/mailInteraction/mailInteraction.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/mailMessage/mailMessage.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/mailApplication/mailApplication.rpc'));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x12')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x13')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x14')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x15')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/faxMessage/faxMessage.rpc'));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x16')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x17')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x18')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/smsInteraction/smsInteraction.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x19')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x1a')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x1b')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x1c')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x1d')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x1e')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x1f')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x20')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x21')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x22')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x23')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/cmHopper/cmHopper.rpc'));_0x11ba56=_['merge'](_0x11ba56,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x24')));_0x11ba56=_['merge'](_0x11ba56,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x25')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x26')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/sound/sound.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x27')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x28')));_0x11ba56=_['merge'](_0x11ba56,require(_0x3a9b('0x29')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x2a')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x2b')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x2c')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x2d')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x2e')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x2f')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x30')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x31')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x32')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x33')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x34')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x35')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require('../api/campaign/campaign.rpc'));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x36')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x37')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x38')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x39')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x3a')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x3b')));_0x11ba56=_[_0x3a9b('0x4')](_0x11ba56,require(_0x3a9b('0x3c')));var _0x58e743=jayson['server'](_0x11ba56)[_0x3a9b('0x3d')]();var _0x413540=config[_0x3a9b('0x3e')]['port']||config[_0x3a9b('0x3f')]+0x1;var _0xe709f=config[_0x3a9b('0x3e')]['ip']||'localhost';_0x58e743['on']('error',function(_0x4b7602){return _0x22d426(_0x4b7602);});_0x58e743[_0x3a9b('0x3')](_0x413540,_0xe709f,function(){console[_0x3a9b('0x40')](_0x3a9b('0x41'),_0xe709f,_0x413540);require(_0x3a9b('0x42'))[_0x3a9b('0x43')]();return _0x23d08b('RPC\x20listening\x20on\x20'+_0xe709f+':'+_0x413540);});});}; \ No newline at end of file +var _0x0efa=['../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','log','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.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/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc'];(function(_0xeb7786,_0x53a053){var _0x120bbc=function(_0x291f05){while(--_0x291f05){_0xeb7786['push'](_0xeb7786['shift']());}};_0x120bbc(++_0x53a053);}(_0x0efa,0x15f));var _0xa0ef=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x0efa[_0x2e4e19];return _0x9ba20b;};'use strict';var jayson=require(_0xa0ef('0x0'));var BPromise=require(_0xa0ef('0x1'));var _=require('lodash');var config=require('../config/environment');exports[_0xa0ef('0x2')]=function(){return new BPromise(function(_0x29464d,_0x182264){var _0x3492e3={};_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x4')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x5')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x6')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/voiceRecording/voiceRecording.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x7')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x8')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x9')));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0xa')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0xb')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0xc')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0xd')));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0xe')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/mailInteraction/mailInteraction.rpc'));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0xf')));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x10')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x11')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x12')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x13')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x14')));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x15')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/faxQueue/faxQueue.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x16')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x17')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x18')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x19')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x1a')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x1b')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x3492e3=_['merge'](_0x3492e3,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x1c')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x1d')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x1e')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x1f')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x20')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x21')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x22')));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x23')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x24')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x25')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x26')));_0x3492e3=_['merge'](_0x3492e3,require('../api/sound/sound.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/template/template.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/trigger/trigger.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x27')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x28')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x29')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x2a')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x2b')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x2c')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x2d')));_0x3492e3=_['merge'](_0x3492e3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x2e')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x2f')));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x30')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x31')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x32')));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x33')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x34')));_0x3492e3=_['merge'](_0x3492e3,require(_0xa0ef('0x35')));_0x3492e3=_['merge'](_0x3492e3,require('../api/plugin/plugin.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x36')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x37')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x38')));_0x3492e3=_[_0xa0ef('0x3')](_0x3492e3,require(_0xa0ef('0x39')));var _0x37179f=jayson[_0xa0ef('0x3a')](_0x3492e3)[_0xa0ef('0x3b')]();var _0x1e8a95=config[_0xa0ef('0x3c')][_0xa0ef('0x3d')]||config[_0xa0ef('0x3d')]+0x1;var _0x3eb7bb=config[_0xa0ef('0x3c')]['ip']||'localhost';_0x37179f['on']('error',function(_0x194199){return _0x182264(_0x194199);});_0x37179f[_0xa0ef('0x2')](_0x1e8a95,_0x3eb7bb,function(){console[_0xa0ef('0x3e')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3eb7bb,_0x1e8a95);require(_0xa0ef('0x3f'))['default']();return _0x29464d(_0xa0ef('0x40')+_0x3eb7bb+':'+_0x1e8a95);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5c35d9d..b936e29 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 _0x34e8=['toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','inherits','sendRequest','prototype','answer','beep','format','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setEncoding','headers','emit','ready','line'];(function(_0x9443bd,_0x517a19){var _0x45d40d=function(_0x5a3b50){while(--_0x5a3b50){_0x9443bd['push'](_0x9443bd['shift']());}};_0x45d40d(++_0x517a19);}(_0x34e8,0x12c));var _0x834e=function(_0x1e82a0,_0x726eac){_0x1e82a0=_0x1e82a0-0x0;var _0x10c2b4=_0x34e8[_0x1e82a0];return _0x10c2b4;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x834e('0x4'));function AGIChannel(_0x21e2e0){var _0x472111=this,_0x31bf20=new AGIReply(),_0x289ef2=![],_0x19a3e0={};EventEmitter[_0x834e('0x5')](_0x472111);_0x21e2e0['setEncoding'](_0x834e('0x6'));_0x21e2e0['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x31bf20[_0x834e('0x7')](_0x834e('0x6'));_0x31bf20['on'](_0x834e('0x8'),function(_0x2e69e2){for(var _0x33ea05 in _0x2e69e2){_0x472111[_0x33ea05]=_0x2e69e2[_0x33ea05];}_0x472111[_0x834e('0x9')](_0x834e('0xa'));});_0x31bf20['on'](_0x834e('0xb'),function(_0x3bdda9){if(_0x3bdda9[_0x834e('0xc')]()==_0x834e('0xd')){_0x472111[_0x834e('0x9')](_0x834e('0xd'));return;}if(_0x3bdda9[_0x834e('0xe')](0x0,0xb)==_0x834e('0xf')){_0x289ef2=!![];}if(_0x289ef2){_0x19a3e0['rx']+=_0x3bdda9+'\x0a';if(_0x3bdda9[_0x834e('0x10')](_0x834e('0x11'))!=-0x1){_0x289ef2=![];}}else{_0x19a3e0['rx']=_0x3bdda9;}if(_0x289ef2){return;}if(typeof _0x19a3e0['cb']=='function'){var _0x5e5b6d=_0x19a3e0['rx'][_0x834e('0xe')](0x0,0x3),_0x6cd9b9=null,_0x58a27e=null;_0x5e5b6d=parseInt(_0x5e5b6d);if(isNaN(_0x5e5b6d)){_0x19a3e0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x834e('0x12')});return;}if(_0x5e5b6d!=0xc8){_0x19a3e0['cb'](null,{'code':_0x5e5b6d,'result':-0x1,'extra':'KO'});return;}_0x6cd9b9=_0x19a3e0['rx'][_0x834e('0xe')](0x4)[_0x834e('0x13')]('result=','');if(_0x6cd9b9[_0x834e('0x14')]('\x20')!=-0x1){_0x6cd9b9=_0x6cd9b9[_0x834e('0x15')](0x0,_0x6cd9b9['indexOf']('\x20'));}if(_[_0x834e('0x16')](_0x6cd9b9,'-1')){_0x6cd9b9=parseInt(_0x6cd9b9);}_0x58a27e=_0x19a3e0['rx']['split']('\x20');if(_0x58a27e[_0x834e('0x17')]==0x3){_0x58a27e=_0x58a27e[0x2][_0x834e('0xe')](0x1,_0x58a27e[0x2]['length']-0x1);}else if(_0x58a27e[_0x834e('0x17')]>0x3){var _0x22106e=/\((.+)\)/;var _0x370fb5=_0x19a3e0['rx']['match'](_0x22106e);if(_0x370fb5){_0x58a27e=_0x370fb5[0x1];}else{_0x58a27e=null;}}else{_0x58a27e=null;}_0x19a3e0['cb'](null,{'code':_0x5e5b6d,'result':_0x6cd9b9,'extra':_0x58a27e});}});_0x21e2e0['on'](_0x834e('0x18'),function(_0x211e9a){_0x472111[_0x834e('0x9')](_0x834e('0x18'),new AGIError(_0x834e('0x19'),_0x211e9a[_0x834e('0x1a')]));});_0x21e2e0['on'](_0x834e('0x1b'),function(){_0x472111['emit'](_0x834e('0x1b'),new AGIError(_0x834e('0x1c')));});_0x21e2e0['on'](_0x834e('0x1d'),function(){_0x472111[_0x834e('0x9')]('timeout',new AGIError(_0x834e('0x1e')));_0x21e2e0[_0x834e('0x1f')]();});_0x21e2e0['pipe'](_0x31bf20);this[_0x834e('0x20')]=function(_0x28d687,_0x8d406e){var _0x28d687=_0x28d687||'',_0x8d406e=typeof _0x8d406e==_0x834e('0x21')?_0x8d406e:new Function();_0x19a3e0={'tx':_0x28d687,'rx':'','cb':_0x8d406e};_0x21e2e0[_0x834e('0x22')](_0x28d687+'\x0a');},this['close']=function(){_0x21e2e0[_0x834e('0x1f')]();};}util[_0x834e('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x834e('0x24')]=function(_0x2e1983){return this[_0x834e('0x20')]['sync'](this,_0x2e1983);};AGIChannel[_0x834e('0x25')][_0x834e('0x26')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x834e('0x25')]['getData']=function(_0x2826ec,_0x3f1b0b,_0x3db026){_0x2826ec=_0x2826ec===undefined?_0x834e('0x27'):_0x2826ec;_0x3f1b0b=_0x3f1b0b===undefined?'5':_0x3f1b0b;_0x3db026=_0x3db026===undefined?'1':_0x3db026;return this[_0x834e('0x24')](util[_0x834e('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2826ec,_0x3f1b0b*0x3e8,_0x3db026));};AGIChannel['prototype']['noop']=function(_0x58c1d7){_0x58c1d7=_0x58c1d7||_0x834e('0x29');return this[_0x834e('0x24')](util[_0x834e('0x28')]('VERBOSE\x20\x22%s\x22',_0x58c1d7));};AGIChannel[_0x834e('0x25')][_0x834e('0x2a')]=function(_0x1f3671,_0x1e026a){if(_[_0x834e('0x2b')](_0x1e026a)){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x2c'),_0x1f3671,_0x1e026a[_0x834e('0x2d')](',')));}return this['sendRequest'](util[_0x834e('0x28')]('EXEC\x20%s\x20%s',_0x1f3671,_0x1e026a));};AGIChannel[_0x834e('0x25')][_0x834e('0x2e')]=function(_0x9ab921){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x2f'),_0x9ab921));};AGIChannel[_0x834e('0x25')][_0x834e('0x30')]=function(_0x358c31){return this[_0x834e('0x24')](util['format'](_0x834e('0x31'),_0x358c31));};AGIChannel[_0x834e('0x25')][_0x834e('0x32')]=function(_0xaf01f4){return this['sendRequest'](util[_0x834e('0x28')](_0x834e('0x33'),_0xaf01f4));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0x834e('0x34'));};AGIChannel[_0x834e('0x25')][_0x834e('0x35')]=function(_0x34fefb,_0x339e28){var _0x1b76dd=_['isBoolean'](_0x339e28)||_[_0x834e('0x36')](_0x339e28)?_0x339e28['toString']():_0x339e28;return this[_0x834e('0x24')](util[_0x834e('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x34fefb,_0x1b76dd?_0x1b76dd[_0x834e('0x37')]()[_0x834e('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x388711,_0xd0d43a){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x38'),_0x388711,_0xd0d43a));};AGIChannel['prototype'][_0x834e('0x39')]=function(_0x548d1d,_0x50c243){return this[_0x834e('0x24')](util['format'](_0x834e('0x3a'),_0x548d1d,_0x50c243));};AGIChannel[_0x834e('0x25')][_0x834e('0x3b')]=function(_0x3c59af,_0x2b7933){return this['sendRequest'](util[_0x834e('0x28')](_0x834e('0x3c'),_0x3c59af,_0x2b7933));};AGIChannel[_0x834e('0x25')]['continueAt']=function(_0x35380e,_0x16ac45,_0x57b89a){_0x16ac45=_0x16ac45||this[_0x834e('0x3d')];_0x57b89a=_0x57b89a||0x1;this['setContext'](_0x35380e);this[_0x834e('0x30')](_0x16ac45);this[_0x834e('0x32')](_0x57b89a);return this['noop'](util['format'](_0x834e('0x3e'),_0x35380e,_0x16ac45,_0x57b89a));};AGIChannel[_0x834e('0x25')][_0x834e('0x3f')]=function(_0xbc1571){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x40'),_0xbc1571));};AGIChannel['prototype'][_0x834e('0x41')]=function(_0x5abb7a,_0x321efa,_0x540685,_0x1df5b0,_0x5a5807,_0x361f60){_0x321efa=_0x321efa||_0x834e('0x42');_0x540685=_0x540685||'';_0x1df5b0=_0x1df5b0===undefined?-0x1:_0x1df5b0==='-1'?-0x1:_0x1df5b0*0x3e8;_0x5a5807=_0x5a5807===undefined?'':'s='+_0x5a5807;_0x361f60=_0x361f60?'BEEP':'';return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x43'),_0x5abb7a,_0x321efa,_0x540685,_0x1df5b0,_0x361f60,_0x5a5807));};AGIChannel[_0x834e('0x25')][_0x834e('0x44')]=function(_0x1a7149,_0xfa28da){_0xfa28da=_0xfa28da||'';return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x45'),_0x1a7149,_0xfa28da));};AGIChannel['prototype'][_0x834e('0x46')]=function(_0x6fff27){return this['exec'](_0x834e('0x47'),_0x6fff27);};AGIChannel[_0x834e('0x25')][_0x834e('0x48')]=function(_0x2112d5){return this[_0x834e('0x2a')](_0x834e('0x49'),_0x2112d5);};AGIChannel['prototype']['error']=function(_0x954d4b,_0x1a5444){this[_0x834e('0x4a')](util[_0x834e('0x28')](_0x834e('0x4b'),_0x954d4b['id'],_0x954d4b[_0x834e('0x4c')],_0x1a5444));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x834e('0x4d')]=AGIChannel; \ No newline at end of file +var _0xe706=['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','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x2f39cf,_0x3c59ec){var _0xd0ece8=function(_0x4ffc0f){while(--_0x4ffc0f){_0x2f39cf['push'](_0x2f39cf['shift']());}};_0xd0ece8(++_0x3c59ec);}(_0xe706,0xa3));var _0x6e70=function(_0x32f05c,_0x273aef){_0x32f05c=_0x32f05c-0x0;var _0x4307ed=_0xe706[_0x32f05c];return _0x4307ed;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e3098e3..2f44554 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 _0xac22=['push','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac22,0x138));var _0x2ac2=function(_0x42473d,_0x256837){_0x42473d=_0x42473d-0x0;var _0x420cf8=_0xac22[_0x42473d];return _0x420cf8;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x2ac2('0x0'),'E_AGI_ARGUMENT_PORT':_0x2ac2('0x1'),'E_AGI_SERVER_ERROR':_0x2ac2('0x2'),'E_AGI_SERVER_CLOSE':_0x2ac2('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x2ac2('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x2ac2('0x5'),'E_AGI_SOCKET_ERROR':_0x2ac2('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x2ac2('0x7'),'E_AGI_COMMAND_EMPTY':_0x2ac2('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2ac2('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xd807b2){var _0xd807b2=_0xd807b2||null,_0x480f72=_0x480f72||[],_0x253f97=0x1,_0x9bfab1='';if(!error[_0xd807b2]){_0xd807b2=_0x2ac2('0xa');}_0x480f72[_0x2ac2('0xb')](error[_0xd807b2]);while(arguments[_0x253f97]){_0x480f72[_0x2ac2('0xb')](arguments[_0x253f97]);_0x253f97++;}_0x9bfab1=util[_0x2ac2('0xc')][_0x2ac2('0xd')](util,_0x480f72);this[_0x2ac2('0xe')]=_0x9bfab1;this[_0x2ac2('0xf')]=_0xd807b2;}module[_0x2ac2('0x10')]=AGIError; \ No newline at end of file +var _0x3ffb=['Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x589f04,_0x4a7c23){var _0x375a4f=function(_0x2410d5){while(--_0x2410d5){_0x589f04['push'](_0x589f04['shift']());}};_0x375a4f(++_0x4a7c23);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x33e309,_0x3a0efb){_0x33e309=_0x33e309-0x0;var _0x326f94=_0x3ffb[_0x33e309];return _0x326f94;};'use strict';var util=require(_0xb3ff('0x0'));var error={'E_AGI_UNDEFINED':_0xb3ff('0x1'),'E_AGI_ARGUMENT_PORT':_0xb3ff('0x2'),'E_AGI_SERVER_ERROR':_0xb3ff('0x3'),'E_AGI_SERVER_CLOSE':_0xb3ff('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xb3ff('0x5'),'E_AGI_SOCKET_ERROR':_0xb3ff('0x6'),'E_AGI_SOCKET_CLOSE':_0xb3ff('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xb3ff('0x8'),'E_AGI_COMMAND_EMPTY':_0xb3ff('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb3ff('0xa'),'E_AGI_IVR_ENTRY':_0xb3ff('0xb')};function AGIError(_0x59bcb3){var _0x59bcb3=_0x59bcb3||null,_0x99d772=_0x99d772||[],_0x3a6e33=0x1,_0x4fecf1='';if(!error[_0x59bcb3]){_0x59bcb3='E_AGI_UNDEFINED';}_0x99d772['push'](error[_0x59bcb3]);while(arguments[_0x3a6e33]){_0x99d772[_0xb3ff('0xc')](arguments[_0x3a6e33]);_0x3a6e33++;}_0x4fecf1=util[_0xb3ff('0xd')][_0xb3ff('0xe')](util,_0x99d772);this[_0xb3ff('0xf')]=_0x4fecf1;this['name']=_0x59bcb3;}module[_0xb3ff('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ecca9b3..75080b0 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 _0x757a=['stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','default','target','menu','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','../../../config/logger','agi','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','traverseBFS','info'];(function(_0x4fa4ff,_0x4e4f25){var _0x1c0307=function(_0x2872cc){while(--_0x2872cc){_0x4fa4ff['push'](_0x4fa4ff['shift']());}};_0x1c0307(++_0x4e4f25);}(_0x757a,0xde));var _0xa757=function(_0x1d2fc0,_0x528d7f){_0x1d2fc0=_0x1d2fc0-0x0;var _0x21825c=_0x757a[_0x1d2fc0];return _0x21825c;};'use strict';var _=require('lodash');var logger=require(_0xa757('0x0'))(_0xa757('0x1'));var verticesWithRetry=['menu','getdigits','getsecretdigits'];var Graph=function(){this[_0xa757('0x2')]={};this[_0xa757('0x3')]={};this[_0xa757('0x4')]=0x0;};Graph[_0xa757('0x5')][_0xa757('0x6')]=function(_0x3caeb0){this['vertices'][_0x3caeb0['id']]=_0x3caeb0;this[_0xa757('0x3')][_0x3caeb0['id']]=[];};Graph[_0xa757('0x5')]['addEdge']=function(_0x2930fa,_0x2f7793,_0x447344){this[_0xa757('0x3')][_0x2930fa][_0xa757('0x7')]({'target':_0x2f7793,'condition':_0x447344});this['numberOfEdges']+=0x1;};Graph[_0xa757('0x5')][_0xa757('0x8')]=function(){return _[_0xa757('0x8')](this[_0xa757('0x2')]);};Graph[_0xa757('0x5')][_0xa757('0x9')]=function(){return this[_0xa757('0x4')];};Graph['prototype']['getVertex']=function(_0x5958c2){return this['vertices'][_0x5958c2];};Graph['prototype'][_0xa757('0xa')]=function(_0x544b45,_0x564187){if(!this[_0xa757('0x2')][_0x544b45]){return logger['info']('no\x20vertex\x20found');}var _0x32112b=_0x564187(this[_0xa757('0x2')][_0x544b45]);if(!_0x32112b){return logger[_0xa757('0xb')](_0xa757('0xc'));}if(this[_0xa757('0x3')][_0x544b45][_0xa757('0xd')]===0x0){return logger[_0xa757('0xb')](_0xa757('0xe'));}for(var _0x185011=0x0,_0x3df1f9=[],_0x50aac1=![];_0x185011\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','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','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\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','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','toJson','mxGraphModel','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xcd59,0x14b));var _0x9cd5=function(_0x2b9e76,_0x467e25){_0x2b9e76=_0x2b9e76-0x0;var _0x4c014e=_0xcd59[_0x2b9e76];return _0x4c014e;};'use strict';var parser=require(_0x9cd5('0x0'));var _=require(_0x9cd5('0x1'));var syncho=require(_0x9cd5('0x2'));var util=require(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var config=require(_0x9cd5('0x5'));var logger=require('../../config/logger')(_0x9cd5('0x6'));var utilLicense=require(_0x9cd5('0x7'));var rpc=require(_0x9cd5('0x8'));var mailRpc=require(_0x9cd5('0x9'));var Graph=require(_0x9cd5('0xa'));var Vertices=require(_0x9cd5('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x9cd5('0x6')]=_[_0x9cd5('0xc')](config[_0x9cd5('0x6')],{'ip':_0x9cd5('0xd'),'port':0x11dd});function connectionHandler(_0x545407){process[_0x9cd5('0xe')](function(){syncho(function(){try{setChannelVariables(_0x545407);agiHandler(_0x545407);}catch(_0x15e76c){logger[_0x9cd5('0xf')](_0x15e76c[_0x9cd5('0x10')]);}});});}function listeningHandler(){console[_0x9cd5('0x11')](_0x9cd5('0x12'),config[_0x9cd5('0x6')][_0x9cd5('0x13')]);logger['info'](util[_0x9cd5('0x14')](_0x9cd5('0x15'),config[_0x9cd5('0x6')]['ip'],config[_0x9cd5('0x6')]['port']));}function errorHandler(_0x58d6de){if(_0x58d6de&&_0x58d6de[_0x9cd5('0x16')]&&_0x58d6de[_0x9cd5('0x17')]){logger[_0x9cd5('0xf')](util[_0x9cd5('0x14')](_0x9cd5('0x18'),_0x58d6de[_0x9cd5('0x16')],_0x58d6de['message']));}else{logger[_0x9cd5('0xf')](util[_0x9cd5('0x14')](_0x9cd5('0x19'),_0x58d6de['stack']));}}function closeHandler(){logger['info'](util['format'](_0x9cd5('0x1a'),this[_0x9cd5('0x1b')],this['calleridname'],this[_0x9cd5('0x1c')],this[_0x9cd5('0x1d')],this[_0x9cd5('0x1e')]));try{createSquareReport(this);}catch(_0x57b986){logger[_0x9cd5('0xf')](_0x57b986[_0x9cd5('0x10')]);}}function timeoutHandler(){logger[_0x9cd5('0x1f')](util[_0x9cd5('0x14')](_0x9cd5('0x20'),this[_0x9cd5('0x1b')],this['calleridname'],this[_0x9cd5('0x1c')],this[_0x9cd5('0x1d')],this[_0x9cd5('0x1e')]));}function hangupHandler(){logger[_0x9cd5('0x1f')](util[_0x9cd5('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x9cd5('0x1b')],this[_0x9cd5('0x21')],this[_0x9cd5('0x1c')],this[_0x9cd5('0x1d')],this[_0x9cd5('0x1e')]));this[_0x9cd5('0x22')]=!![];}function getRoot(_0x1cf603){return parser[_0x9cd5('0x23')](_0x1cf603,{'object':!![]})[_0x9cd5('0x24')]['root'];}function addVertex(_0x297f0e,_0xba8ee9,_0x1a88e3){_0xba8ee9[_0x9cd5('0x25')]=_0x1a88e3;if(_0xba8ee9['hasOwnProperty'](_0x9cd5('0x26'))){_0xba8ee9[_0x9cd5('0x27')]=parseInt(_0xba8ee9[_0x9cd5('0x26')],0xa);}_0x297f0e[_0x9cd5('0x28')](_[_0x9cd5('0x29')](_0xba8ee9,_0x9cd5('0x2a')));}function initGraph(_0x359cca,_0x4a245f){var _0x1dcb6f=new Graph();for(var _0x64a1c4 in _0x359cca){if(_0x359cca[_0x9cd5('0x2b')](_0x64a1c4)){if(_['isArray'](_0x359cca[_0x64a1c4])){for(var _0x5c33e9=0x0;_0x5c33e9<_0x359cca[_0x64a1c4][_0x9cd5('0x2c')];_0x5c33e9+=0x1){addVertex(_0x1dcb6f,_0x359cca[_0x64a1c4][_0x5c33e9],_0x64a1c4);}}else{addVertex(_0x1dcb6f,_0x359cca[_0x64a1c4],_0x64a1c4);}}}for(var _0x502257=0x0;_0x502257<_0x4a245f['length'];_0x502257+=0x1){if(_0x4a245f[_0x502257][_0x9cd5('0x2d')]&&_0x4a245f[_0x502257][_0x9cd5('0x2e')]){_0x1dcb6f[_0x9cd5('0x2f')](_0x4a245f[_0x502257]['source'],_0x4a245f[_0x502257][_0x9cd5('0x2e')],_0x4a245f[_0x502257][_0x9cd5('0x30')]);}}return _0x1dcb6f;}function getSquareProject(_0x27e1fd,_0x2689c7){rpc[_0x9cd5('0x31')](_0x27e1fd)[_0x9cd5('0x32')](function(_0x1dbddc){_0x2689c7(null,_0x1dbddc);})[_0x9cd5('0x33')](function(_0x36b0ad){_0x2689c7(null,_0x36b0ad);});}function createSquareReport(_0x1c81fd,_0x3dc2c0){rpc[_0x9cd5('0x34')](_0x1c81fd)[_0x9cd5('0x32')](function(_0x21354a){if(_0x3dc2c0){_0x3dc2c0(null,_0x21354a);}})['catch'](function(_0x135dec){if(_0x3dc2c0){_0x3dc2c0(null,_0x135dec);}});}function setChannelVariables(_0x2a6a34){for(var _0x4bff30 in _0x2a6a34){if(_0x2a6a34['hasOwnProperty'](_0x4bff30)){if(_0x4bff30[_0x9cd5('0x35')](_0x9cd5('0x36'))===0x0){_0x2a6a34[_0x4bff30['substring'](0x4)]=_0x2a6a34[_0x4bff30];delete _0x2a6a34[_0x4bff30];}}}}function getLogFromObject(_0x2599fc){return util['inspect'](_0x2599fc,{'showHidden':![],'depth':null});}function agiHandler(_0x590ec3){var _0x7622d8,_0x462d9c,_0x3a071d,_0x392441,_0x53826d;logger[_0x9cd5('0x37')](_0x9cd5('0x38'),JSON[_0x9cd5('0x39')](_0x590ec3,null,0x2));logger['info'](util[_0x9cd5('0x14')](_0x9cd5('0x3a'),_0x590ec3[_0x9cd5('0x1b')],_0x590ec3[_0x9cd5('0x21')],_0x590ec3[_0x9cd5('0x1c')],_0x590ec3[_0x9cd5('0x1d')],_0x590ec3[_0x9cd5('0x1e')]));_0x590ec3['on'](_0x9cd5('0xf'),errorHandler);_0x590ec3['on'](_0x9cd5('0x3b'),closeHandler);_0x590ec3['on'](_0x9cd5('0x3c'),timeoutHandler);_0x590ec3[_0x9cd5('0x22')]=![];_0x590ec3['on']('hangup',hangupHandler);var _0x32e253=getSquareProject['sync'](null,_0x590ec3['arg_1']);if(_0x32e253){if(_0x32e253[_0x9cd5('0x3d')]){_0x7622d8=getRoot(_0x32e253[_0x9cd5('0x3d')]);if(_0x7622d8&&_0x7622d8[_0x9cd5('0x3e')]){logger[_0x9cd5('0x37')]('root',JSON[_0x9cd5('0x39')](_0x7622d8,null,0x2));_0x590ec3[_0x9cd5('0x3f')]=moment()[_0x9cd5('0x14')](_0x9cd5('0x40'));_0x462d9c=initGraph(_['omit'](_0x7622d8,_0x9cd5('0x2a')),_0x7622d8[_0x9cd5('0x2a')]);_0x3a071d=new Vertices(_0x590ec3,rpc,mailRpc);logger[_0x9cd5('0x1f')](util[_0x9cd5('0x14')](_0x9cd5('0x41'),_0x590ec3[_0x9cd5('0x1b')],_0x590ec3['calleridname'],_0x590ec3[_0x9cd5('0x1c')],_0x590ec3[_0x9cd5('0x1d')],_0x590ec3[_0x9cd5('0x1e')]));_0x462d9c[_0x9cd5('0x42')](_0x7622d8[_0x9cd5('0x3e')]['id'],function(_0x4182bd){try{_0x4182bd=_0x3a071d[_0x9cd5('0x43')](_0x4182bd);logger[_0x9cd5('0x37')](_0x9cd5('0x44'),JSON[_0x9cd5('0x39')](_0x4182bd,null,0x2));if(_0x4182bd[_0x9cd5('0x25')]===_0x9cd5('0x45')){logger[_0x9cd5('0x1f')](_0x9cd5('0x46'));_0x590ec3[_0x9cd5('0x47')]=_0x4182bd[_0x9cd5('0x47')]||_0x590ec3[_0x9cd5('0x47')];_0x590ec3[_0x9cd5('0x48')]=_0x4182bd['extension'];_0x590ec3[_0x9cd5('0x49')]=_0x4182bd['priority']?_0x4182bd[_0x9cd5('0x49')]-0x1:0x1;return null;}else if(_0x4182bd&&_0x3a071d[_0x4182bd[_0x9cd5('0x25')]]){_0x53826d=_0x3a071d[_0x4182bd[_0x9cd5('0x25')]](_0x4182bd);logger[_0x9cd5('0x1f')](_0x9cd5('0x4a'),JSON['stringify'](_0x53826d,null,0x2));if(_0x53826d&&_0x53826d[_0x9cd5('0x4b')]===AGI_CODE_SUCCESS&&_0x53826d[_0x9cd5('0x4c')]!==AGI_RESULT_ERROR&&!_0x590ec3[_0x9cd5('0x22')]){logger['debug'](_0x9cd5('0x4a'),getLogFromObject(_0x53826d));return _[_0x9cd5('0x4d')](_0x53826d[_0x9cd5('0x4c')])?null:_0x53826d[_0x9cd5('0x4c')]['toString']();}else{logger[_0x9cd5('0xf')](_0x9cd5('0x4a'),getLogFromObject(_0x53826d));return null;}}else{logger[_0x9cd5('0xf')](_0x9cd5('0x4e'));return null;}}catch(_0x1c4079){logger[_0x9cd5('0xf')](_0x1c4079[_0x9cd5('0x10')]);return null;}});if(_0x7622d8[_0x9cd5('0x4f')]){logger[_0x9cd5('0x1f')](util[_0x9cd5('0x14')](_0x9cd5('0x50'),_0x590ec3[_0x9cd5('0x1b')],_0x590ec3[_0x9cd5('0x21')],_0x590ec3[_0x9cd5('0x1c')],_0x590ec3[_0x9cd5('0x1d')],_0x590ec3[_0x9cd5('0x1e')]));_0x462d9c[_0x9cd5('0x42')](_0x7622d8[_0x9cd5('0x4f')]['id'],function(_0x4ea20d){try{_0x4ea20d=_0x3a071d[_0x9cd5('0x43')](_0x4ea20d);logger[_0x9cd5('0x37')](_0x9cd5('0x44'),JSON[_0x9cd5('0x39')](_0x4ea20d,null,0x2));if(_0x4ea20d&&_0x3a071d[_0x4ea20d['agicommand']]){_0x53826d=_0x3a071d[_0x4ea20d[_0x9cd5('0x25')]](_0x4ea20d);if(_0x53826d){logger[_0x9cd5('0x37')]('response',getLogFromObject(_0x53826d));return _[_0x9cd5('0x4d')](_0x53826d[_0x9cd5('0x4c')])?null:_0x53826d[_0x9cd5('0x4c')][_0x9cd5('0x51')]();}else{logger[_0x9cd5('0xf')](_0x9cd5('0x4a'),getLogFromObject(_0x53826d));return null;}}else{logger[_0x9cd5('0xf')](_0x9cd5('0x4e'));return null;}}catch(_0x5b6c7d){logger['error'](_0x5b6c7d[_0x9cd5('0x10')]);return null;}});}logger[_0x9cd5('0x1f')](util[_0x9cd5('0x14')](_0x9cd5('0x52'),_0x590ec3['arg_1'],_0x590ec3[_0x9cd5('0x21')],_0x590ec3['callerid'],_0x590ec3['dnid'],_0x590ec3[_0x9cd5('0x1e')]));logger[_0x9cd5('0x1f')](util[_0x9cd5('0x14')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x590ec3[_0x9cd5('0x47')],_0x590ec3[_0x9cd5('0x48')],parseInt(_0x590ec3[_0x9cd5('0x49')],0xa)+0x1));_0x590ec3[_0x9cd5('0x53')](_0x590ec3[_0x9cd5('0x47')],_0x590ec3[_0x9cd5('0x48')],parseInt(_0x590ec3['priority'],0xa)+0x1);_0x590ec3['close']();}}else{logger[_0x9cd5('0xf')](util[_0x9cd5('0x14')](_0x9cd5('0x54'),_0x590ec3[_0x9cd5('0x1b')]));_0x590ec3[_0x9cd5('0x53')](_0x590ec3['context'],_0x590ec3['extension'],parseInt(_0x590ec3['priority'],0xa)+0x1);_0x590ec3['close']();}}else{logger[_0x9cd5('0xf')](util[_0x9cd5('0x14')](_0x9cd5('0x55'),_0x590ec3[_0x9cd5('0x1b')]));_0x590ec3[_0x9cd5('0x53')](_0x590ec3[_0x9cd5('0x47')],_0x590ec3[_0x9cd5('0x48')],parseInt(_0x590ec3[_0x9cd5('0x49')],0xa)+0x1);_0x590ec3[_0x9cd5('0x3b')]();}}function main(){var _0x426016;return utilLicense[_0x9cd5('0x56')]()[_0x9cd5('0x32')](function(_0x39b81b){if(_0x39b81b){if(_0x39b81b[_0x9cd5('0x57')]){if(_0x39b81b['callysquare']&&_0x39b81b[_0x9cd5('0x58')]>0x0){logger[_0x9cd5('0x1f')](util['format'](_0x9cd5('0x59'),_0x39b81b[_0x9cd5('0x58')]));_0x426016=_0x39b81b[_0x9cd5('0x58')];}else{logger[_0x9cd5('0x1f')](_0x9cd5('0x5a'));}}else{logger[_0x9cd5('0x1f')](_0x9cd5('0x5b'));_0x426016=-0x1;}}})['catch'](function(_0x538ffa){logger[_0x9cd5('0xf')](_0x9cd5('0x5c'),_0x538ffa[_0x9cd5('0x10')]);})[_0x9cd5('0x4f')](function(){var _0x17b678=require(_0x9cd5('0x5d'))(config[_0x9cd5('0x6')][_0x9cd5('0x13')],config[_0x9cd5('0x6')]['ip'],_0x426016);_0x17b678['on'](_0x9cd5('0xf'),errorHandler);_0x17b678['on'](_0x9cd5('0x5e'),listeningHandler);_0x17b678['on'](_0x9cd5('0x5f'),connectionHandler);_0x17b678['on'](_0x9cd5('0x3b'),closeHandler);});}main(); \ No newline at end of file +var _0x6737=['target','value','getSquareProject','then','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','catch','[LICENSE]','./server','connection','lodash','syncho','moment','../../config/environment','../../config/logger','agi','./rpc','./mailRpc','./vertices','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%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','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source'];(function(_0x40ae6a,_0x596c60){var _0x3d0353=function(_0xd6cb70){while(--_0xd6cb70){_0x40ae6a['push'](_0x40ae6a['shift']());}};_0x3d0353(++_0x596c60);}(_0x6737,0xe2));var _0x7673=function(_0x2567c6,_0x561ec5){_0x2567c6=_0x2567c6-0x0;var _0x4e5694=_0x6737[_0x2567c6];return _0x4e5694;};'use strict';var parser=require('xml2json');var _=require(_0x7673('0x0'));var syncho=require(_0x7673('0x1'));var util=require('util');var moment=require(_0x7673('0x2'));var config=require(_0x7673('0x3'));var logger=require(_0x7673('0x4'))(_0x7673('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x7673('0x6'));var mailRpc=require(_0x7673('0x7'));var Graph=require('./graph');var Vertices=require(_0x7673('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7673('0x5')]=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x5292f7){process[_0x7673('0x9')](function(){syncho(function(){try{setChannelVariables(_0x5292f7);agiHandler(_0x5292f7);}catch(_0x5bede8){logger[_0x7673('0xa')](_0x5bede8[_0x7673('0xb')]);}});});}function listeningHandler(){console['log'](_0x7673('0xc'),config[_0x7673('0x5')][_0x7673('0xd')]);logger['info'](util['format'](_0x7673('0xe'),config['agi']['ip'],config[_0x7673('0x5')][_0x7673('0xd')]));}function errorHandler(_0x38090f){if(_0x38090f&&_0x38090f[_0x7673('0xf')]&&_0x38090f[_0x7673('0x10')]){logger[_0x7673('0xa')](util[_0x7673('0x11')](_0x7673('0x12'),_0x38090f[_0x7673('0xf')],_0x38090f[_0x7673('0x10')]));}else{logger['error'](util[_0x7673('0x11')](_0x7673('0x13'),_0x38090f[_0x7673('0xb')]));}}function closeHandler(){logger[_0x7673('0x14')](util[_0x7673('0x11')](_0x7673('0x15'),this[_0x7673('0x16')],this['calleridname'],this['callerid'],this[_0x7673('0x17')],this[_0x7673('0x18')]));try{createSquareReport(this);}catch(_0x50f8d9){logger[_0x7673('0xa')](_0x50f8d9[_0x7673('0xb')]);}}function timeoutHandler(){logger['info'](util[_0x7673('0x11')](_0x7673('0x19'),this[_0x7673('0x16')],this['calleridname'],this['callerid'],this[_0x7673('0x17')],this[_0x7673('0x18')]));}function hangupHandler(){logger['info'](util[_0x7673('0x11')](_0x7673('0x1a'),this[_0x7673('0x16')],this[_0x7673('0x1b')],this[_0x7673('0x1c')],this[_0x7673('0x17')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0xea9b37){return parser[_0x7673('0x1d')](_0xea9b37,{'object':!![]})[_0x7673('0x1e')][_0x7673('0x1f')];}function addVertex(_0x16bb16,_0x54f38d,_0x2009e1){_0x54f38d[_0x7673('0x20')]=_0x2009e1;if(_0x54f38d[_0x7673('0x21')](_0x7673('0x22'))){_0x54f38d[_0x7673('0x23')]=parseInt(_0x54f38d[_0x7673('0x22')],0xa);}_0x16bb16['addVertex'](_[_0x7673('0x24')](_0x54f38d,_0x7673('0x25')));}function initGraph(_0x425897,_0x191bf4){var _0x5a98fe=new Graph();for(var _0x5e2cd7 in _0x425897){if(_0x425897[_0x7673('0x21')](_0x5e2cd7)){if(_[_0x7673('0x26')](_0x425897[_0x5e2cd7])){for(var _0x291d10=0x0;_0x291d10<_0x425897[_0x5e2cd7][_0x7673('0x27')];_0x291d10+=0x1){addVertex(_0x5a98fe,_0x425897[_0x5e2cd7][_0x291d10],_0x5e2cd7);}}else{addVertex(_0x5a98fe,_0x425897[_0x5e2cd7],_0x5e2cd7);}}}for(var _0x119a21=0x0;_0x119a21<_0x191bf4[_0x7673('0x27')];_0x119a21+=0x1){if(_0x191bf4[_0x119a21][_0x7673('0x28')]&&_0x191bf4[_0x119a21]['target']){_0x5a98fe['addEdge'](_0x191bf4[_0x119a21][_0x7673('0x28')],_0x191bf4[_0x119a21][_0x7673('0x29')],_0x191bf4[_0x119a21][_0x7673('0x2a')]);}}return _0x5a98fe;}function getSquareProject(_0x335743,_0x12ac6b){rpc[_0x7673('0x2b')](_0x335743)[_0x7673('0x2c')](function(_0x4f12b9){_0x12ac6b(null,_0x4f12b9);})['catch'](function(_0xe7e528){_0x12ac6b(null,_0xe7e528);});}function createSquareReport(_0x36c841,_0x268863){rpc[_0x7673('0x2d')](_0x36c841)['then'](function(_0x3aa249){if(_0x268863){_0x268863(null,_0x3aa249);}})['catch'](function(_0x15f6a7){if(_0x268863){_0x268863(null,_0x15f6a7);}});}function setChannelVariables(_0x139717){for(var _0x42fee6 in _0x139717){if(_0x139717[_0x7673('0x21')](_0x42fee6)){if(_0x42fee6[_0x7673('0x2e')](_0x7673('0x2f'))===0x0){_0x139717[_0x42fee6[_0x7673('0x30')](0x4)]=_0x139717[_0x42fee6];delete _0x139717[_0x42fee6];}}}}function getLogFromObject(_0xc13d6){return util[_0x7673('0x31')](_0xc13d6,{'showHidden':![],'depth':null});}function agiHandler(_0x1b6061){var _0x16681f,_0x1beb59,_0x26cccd,_0x485b39,_0x32ee3d;logger[_0x7673('0x32')](_0x7673('0x33'),JSON[_0x7673('0x34')](_0x1b6061,null,0x2));logger[_0x7673('0x14')](util[_0x7673('0x11')](_0x7673('0x35'),_0x1b6061['arg_1'],_0x1b6061['calleridname'],_0x1b6061[_0x7673('0x1c')],_0x1b6061[_0x7673('0x17')],_0x1b6061[_0x7673('0x18')]));_0x1b6061['on'](_0x7673('0xa'),errorHandler);_0x1b6061['on'](_0x7673('0x36'),closeHandler);_0x1b6061['on'](_0x7673('0x37'),timeoutHandler);_0x1b6061[_0x7673('0x38')]=![];_0x1b6061['on']('hangup',hangupHandler);var _0x2845f6=getSquareProject[_0x7673('0x39')](null,_0x1b6061['arg_1']);if(_0x2845f6){if(_0x2845f6[_0x7673('0x3a')]){_0x16681f=getRoot(_0x2845f6[_0x7673('0x3a')]);if(_0x16681f&&_0x16681f[_0x7673('0x3b')]){logger[_0x7673('0x32')]('root',JSON[_0x7673('0x34')](_0x16681f,null,0x2));_0x1b6061[_0x7673('0x3c')]=moment()['format'](_0x7673('0x3d'));_0x1beb59=initGraph(_[_0x7673('0x24')](_0x16681f,_0x7673('0x25')),_0x16681f['mxCell']);_0x26cccd=new Vertices(_0x1b6061,rpc,mailRpc);logger[_0x7673('0x14')](util[_0x7673('0x11')](_0x7673('0x3e'),_0x1b6061['arg_1'],_0x1b6061['calleridname'],_0x1b6061[_0x7673('0x1c')],_0x1b6061['dnid'],_0x1b6061['uniqueid']));_0x1beb59[_0x7673('0x3f')](_0x16681f[_0x7673('0x3b')]['id'],function(_0x58b9b1){try{_0x58b9b1=_0x26cccd[_0x7673('0x40')](_0x58b9b1);logger[_0x7673('0x32')](_0x7673('0x41'),JSON[_0x7673('0x34')](_0x58b9b1,null,0x2));if(_0x58b9b1[_0x7673('0x20')]===_0x7673('0x42')){logger['info'](_0x7673('0x43'));_0x1b6061['context']=_0x58b9b1[_0x7673('0x44')]||_0x1b6061['context'];_0x1b6061[_0x7673('0x45')]=_0x58b9b1[_0x7673('0x45')];_0x1b6061['priority']=_0x58b9b1['priority']?_0x58b9b1[_0x7673('0x46')]-0x1:0x1;return null;}else if(_0x58b9b1&&_0x26cccd[_0x58b9b1['agicommand']]){_0x32ee3d=_0x26cccd[_0x58b9b1[_0x7673('0x20')]](_0x58b9b1);logger[_0x7673('0x14')](_0x7673('0x47'),JSON[_0x7673('0x34')](_0x32ee3d,null,0x2));if(_0x32ee3d&&_0x32ee3d[_0x7673('0x48')]===AGI_CODE_SUCCESS&&_0x32ee3d['result']!==AGI_RESULT_ERROR&&!_0x1b6061['evtHangup']){logger[_0x7673('0x32')](_0x7673('0x47'),getLogFromObject(_0x32ee3d));return _['isUndefined'](_0x32ee3d[_0x7673('0x49')])?null:_0x32ee3d[_0x7673('0x49')][_0x7673('0x4a')]();}else{logger['error'](_0x7673('0x47'),getLogFromObject(_0x32ee3d));return null;}}else{logger[_0x7673('0xa')](_0x7673('0x4b'));return null;}}catch(_0x229c13){logger[_0x7673('0xa')](_0x229c13[_0x7673('0xb')]);return null;}});if(_0x16681f[_0x7673('0x4c')]){logger[_0x7673('0x14')](util[_0x7673('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1b6061[_0x7673('0x16')],_0x1b6061[_0x7673('0x1b')],_0x1b6061[_0x7673('0x1c')],_0x1b6061[_0x7673('0x17')],_0x1b6061[_0x7673('0x18')]));_0x1beb59[_0x7673('0x3f')](_0x16681f[_0x7673('0x4c')]['id'],function(_0x5e879b){try{_0x5e879b=_0x26cccd[_0x7673('0x40')](_0x5e879b);logger[_0x7673('0x32')](_0x7673('0x41'),JSON[_0x7673('0x34')](_0x5e879b,null,0x2));if(_0x5e879b&&_0x26cccd[_0x5e879b[_0x7673('0x20')]]){_0x32ee3d=_0x26cccd[_0x5e879b['agicommand']](_0x5e879b);if(_0x32ee3d){logger[_0x7673('0x32')](_0x7673('0x47'),getLogFromObject(_0x32ee3d));return _[_0x7673('0x4d')](_0x32ee3d[_0x7673('0x49')])?null:_0x32ee3d[_0x7673('0x49')]['toString']();}else{logger['error'](_0x7673('0x47'),getLogFromObject(_0x32ee3d));return null;}}else{logger[_0x7673('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x2314e7){logger[_0x7673('0xa')](_0x2314e7[_0x7673('0xb')]);return null;}});}logger[_0x7673('0x14')](util[_0x7673('0x11')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1b6061[_0x7673('0x16')],_0x1b6061[_0x7673('0x1b')],_0x1b6061[_0x7673('0x1c')],_0x1b6061[_0x7673('0x17')],_0x1b6061['uniqueid']));logger[_0x7673('0x14')](util[_0x7673('0x11')](_0x7673('0x4e'),_0x1b6061[_0x7673('0x44')],_0x1b6061[_0x7673('0x45')],parseInt(_0x1b6061[_0x7673('0x46')],0xa)+0x1));_0x1b6061[_0x7673('0x4f')](_0x1b6061[_0x7673('0x44')],_0x1b6061[_0x7673('0x45')],parseInt(_0x1b6061[_0x7673('0x46')],0xa)+0x1);_0x1b6061[_0x7673('0x36')]();}}else{logger['error'](util[_0x7673('0x11')]('Project\x20%s\x20not\x20published',_0x1b6061[_0x7673('0x16')]));_0x1b6061[_0x7673('0x4f')](_0x1b6061[_0x7673('0x44')],_0x1b6061['extension'],parseInt(_0x1b6061[_0x7673('0x46')],0xa)+0x1);_0x1b6061[_0x7673('0x36')]();}}else{logger[_0x7673('0xa')](util[_0x7673('0x11')](_0x7673('0x50'),_0x1b6061[_0x7673('0x16')]));_0x1b6061[_0x7673('0x4f')](_0x1b6061[_0x7673('0x44')],_0x1b6061[_0x7673('0x45')],parseInt(_0x1b6061[_0x7673('0x46')],0xa)+0x1);_0x1b6061[_0x7673('0x36')]();}}function main(){var _0x950cc7;return utilLicense[_0x7673('0x51')]()[_0x7673('0x2c')](function(_0x59bcf3){if(_0x59bcf3){if(_0x59bcf3[_0x7673('0x52')]){if(_0x59bcf3['callysquare']&&_0x59bcf3[_0x7673('0x53')]>0x0){logger[_0x7673('0x14')](util[_0x7673('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x59bcf3[_0x7673('0x53')]));_0x950cc7=_0x59bcf3['callysquare'];}else{logger['info'](_0x7673('0x54'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x950cc7=-0x1;}}})[_0x7673('0x55')](function(_0x3f6ef3){logger[_0x7673('0xa')](_0x7673('0x56'),_0x3f6ef3[_0x7673('0xb')]);})[_0x7673('0x4c')](function(){var _0x151276=require(_0x7673('0x57'))(config[_0x7673('0x5')][_0x7673('0xd')],config[_0x7673('0x5')]['ip'],_0x950cc7);_0x151276['on']('error',errorHandler);_0x151276['on']('listening',listeningHandler);_0x151276['on'](_0x7673('0x58'),connectionHandler);_0x151276['on'](_0x7673('0x36'),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 1c2f75c..424a875 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x4c1ac0,_0x28f486){var _0x4f089f=function(_0x21d702){while(--_0x21d702){_0x4c1ac0['push'](_0x4c1ac0['shift']());}};_0x4f089f(++_0x28f486);}(_0x34e8,0x12c));var _0x834e=function(_0x173c8f,_0x4e4fcd){_0x173c8f=_0x173c8f-0x0;var _0x5741a5=_0x34e8[_0x173c8f];return _0x5741a5;};'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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0xf3e271,_0x4d40e0){var _0x3edcc0=function(_0x21fc2a){while(--_0x21fc2a){_0xf3e271['push'](_0xf3e271['shift']());}};_0x3edcc0(++_0x4d40e0);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 0b9cdf7..8d24b97 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x1f97e8,_0x445a4a){var _0x1ed77c=function(_0x1c990d){while(--_0x1c990d){_0x1f97e8['push'](_0x1f97e8['shift']());}};_0x1ed77c(++_0x445a4a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a7790,_0x39b940){_0x4a7790=_0x4a7790-0x0;var _0x42ce7e=_0x5f2f[_0x4a7790];return _0x42ce7e;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x1dc337,_0x163446){var _0x2c4d04=function(_0x849e1){while(--_0x849e1){_0x1dc337['push'](_0x1dc337['shift']());}};_0x2c4d04(++_0x163446);}(_0x5f2f,0x73));var _0xf5f2=function(_0xe9b0be,_0x20fbdc){_0xe9b0be=_0xe9b0be-0x0;var _0x30b375=_0x5f2f[_0xe9b0be];return _0x30b375;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 3b7671e..38560d7 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 _0x6aa1=['getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','util','jayson/promise','client','http','request','then','error','message','ShowSquareProject','production'];(function(_0x163da2,_0x491cdb){var _0xf93aaa=function(_0x369f2d){while(--_0x369f2d){_0x163da2['push'](_0x163da2['shift']());}};_0xf93aaa(++_0x491cdb);}(_0x6aa1,0x1b5));var _0x16aa=function(_0x5c83dc,_0x2be76e){_0x5c83dc=_0x5c83dc-0x0;var _0x28cdb0=_0x6aa1[_0x5c83dc];return _0x28cdb0;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x16aa('0x0'));var util=require(_0x16aa('0x1'));var jayson=require(_0x16aa('0x2'));var client=jayson[_0x16aa('0x3')][_0x16aa('0x4')]({'port':0x2329});function request(_0x4aaa8f,_0x33806f){return new BPromise(function(_0x3c93c4,_0xd4e210){return client[_0x16aa('0x5')](_0x4aaa8f,_0x33806f)[_0x16aa('0x6')](function(_0xc9f7ab){if(_0xc9f7ab[_0x16aa('0x7')]){return _0xd4e210(_0xc9f7ab[_0x16aa('0x7')][_0x16aa('0x8')]);}else{return _0x3c93c4(_0xc9f7ab['result']);}})['catch'](function(_0x4003fd){return _0xd4e210(_0x4003fd);});});}exports['getSquareProject']=function(_0x29658f){return request(_0x16aa('0x9'),{'options':{'raw':![],'where':{'name':_0x29658f},'attributes':[_0x16aa('0xa')]}});};exports[_0x16aa('0xb')]=function(_0x1d955b){return request(_0x16aa('0xc'),{'options':{'raw':![],'where':{'id':_0x1d955b},'include':[{'model':_0x16aa('0xd'),'as':'Smtp'}],'attributes':['id',_0x16aa('0xe'),_0x16aa('0xf')]}});};exports[_0x16aa('0x10')]=function(_0x16ef79){return request(_0x16aa('0x9'),{'options':{'where':{'id':_0x16ef79},'attributes':[_0x16aa('0xe')]}});};exports['getVoiceQueueById']=function(_0x560232){return request(_0x16aa('0x11'),{'options':{'where':{'id':_0x560232},'attributes':[_0x16aa('0xe')]}});};exports['getVariableById']=function(_0x276fe2){return request(_0x16aa('0x12'),{'options':{'where':{'id':_0x276fe2},'attributes':[_0x16aa('0xe')]}});};exports[_0x16aa('0x13')]=function(_0x5afc10){return request(_0x16aa('0x14'),{'options':{'where':{'id':_0x5afc10},'attributes':['dsn']}});};exports['getUserById']=function(_0xc116f9){return request(_0x16aa('0x15'),{'options':{'where':{'id':_0xc116f9},'attributes':[_0x16aa('0xe')]}});};exports[_0x16aa('0x16')]=function(_0x18b65d){return request(_0x16aa('0x17'),{'options':{'where':{'id':_0x18b65d},'attributes':[_0x16aa('0xe')]}});};exports[_0x16aa('0x18')]=function(_0x3ec33d){return request(_0x16aa('0x19'),{'options':{'where':{'id':_0x3ec33d},'attributes':[_0x16aa('0x1a')]}});};exports[_0x16aa('0x1b')]=function(_0x2be220){return request(_0x16aa('0x1c'),{'options':{'raw':![],'where':{'id':_0x2be220},'include':[{'model':'Interval','as':_0x16aa('0x1d')}]}});};exports[_0x16aa('0x1e')]=function(_0x90e5a7){return request(_0x16aa('0x1f'),{'options':{'where':{'id':_0x90e5a7},'attributes':['id',_0x16aa('0xe')]}});};exports[_0x16aa('0x20')]=function(_0x56c98e){return request(_0x16aa('0x21'),{'body':_0x56c98e});};exports[_0x16aa('0x22')]=function(_0x4f5eba){return request(_0x16aa('0x23'),{'body':_0x4f5eba});};exports[_0x16aa('0x24')]=function(_0x1d318f){return request(_0x16aa('0x25'),{'body':_[_0x16aa('0x26')](_0x1d318f,{'project_name':_0x1d318f[_0x16aa('0x27')],'prev_project_name':_0x1d318f[_0x16aa('0x28')]||'','is_subproject':_0x1d318f[_0x16aa('0x28')]?!![]:![],'leaveAt':moment()['format'](_0x16aa('0x29'))})});};exports[_0x16aa('0x2a')]=function(_0x4c2b92){return request('CreateSquareRecording',{'body':_0x4c2b92});};exports[_0x16aa('0x2b')]=function(_0x47a0f4){return request(_0x16aa('0x2c'),{'body':_0x47a0f4});};exports[_0x16aa('0x2d')]=function(_0x1d121b){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1d121b['phone'],'ListId':_0x1d121b[_0x16aa('0x2e')]}}})[_0x16aa('0x6')](function(_0xd80f7f){if(_0xd80f7f){return _0xd80f7f;}return request(_0x16aa('0x2f'),{'body':_0x1d121b});});};exports[_0x16aa('0x30')]=function(_0x26a018){return request(_0x16aa('0x31'),{'options':{'where':{'id':_0x26a018},'attributes':[_0x16aa('0xe')]}});};exports['agentLogin']=function(_0x1c658f,_0x1da0d7){return request(_0x16aa('0x32'),{'body':{'interface':_0x1da0d7},'options':{'where':_0x1c658f}});};exports[_0x16aa('0x33')]=function(_0x296b40,_0x61ecae,_0x434195){return request(_0x16aa('0x34'),{'body':{'type':_0x61ecae,'uniqueid':_0x434195},'options':{'where':_0x296b40}});};exports[_0x16aa('0x35')]=function(_0x736806){return request(_0x16aa('0x36'),{'body':{},'options':{'where':_0x736806}});};exports['agentLogout']=function(_0x5b0b49){return request(_0x16aa('0x37'),{'body':{},'options':{'where':_0x5b0b49}});}; \ No newline at end of file +var _0x6ee9=['getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue'];(function(_0x8b367a,_0x3d4e34){var _0x101632=function(_0x506658){while(--_0x506658){_0x8b367a['push'](_0x8b367a['shift']());}};_0x101632(++_0x3d4e34);}(_0x6ee9,0x9c));var _0x96ee=function(_0x796644,_0x46e427){_0x796644=_0x796644-0x0;var _0x564c78=_0x6ee9[_0x796644];return _0x564c78;};'use strict';var BPromise=require('bluebird');var moment=require(_0x96ee('0x0'));var _=require(_0x96ee('0x1'));var util=require('util');var jayson=require(_0x96ee('0x2'));var client=jayson[_0x96ee('0x3')][_0x96ee('0x4')]({'port':0x2329});function request(_0xa9b90e,_0x4abf7e){return new BPromise(function(_0x3bacbd,_0x47089a){return client[_0x96ee('0x5')](_0xa9b90e,_0x4abf7e)[_0x96ee('0x6')](function(_0x42c188){if(_0x42c188[_0x96ee('0x7')]){return _0x47089a(_0x42c188[_0x96ee('0x7')][_0x96ee('0x8')]);}else{return _0x3bacbd(_0x42c188[_0x96ee('0x9')]);}})[_0x96ee('0xa')](function(_0x44186a){return _0x47089a(_0x44186a);});});}exports[_0x96ee('0xb')]=function(_0x74f809){return request(_0x96ee('0xc'),{'options':{'raw':![],'where':{'name':_0x74f809},'attributes':[_0x96ee('0xd')]}});};exports['getMailAccountById']=function(_0x5138f0){return request(_0x96ee('0xe'),{'options':{'raw':![],'where':{'id':_0x5138f0},'include':[{'model':_0x96ee('0xf'),'as':_0x96ee('0x10')}],'attributes':['id',_0x96ee('0x11'),_0x96ee('0x12')]}});};exports['getSquareProjectById']=function(_0x20ca51){return request('ShowSquareProject',{'options':{'where':{'id':_0x20ca51},'attributes':[_0x96ee('0x11')]}});};exports[_0x96ee('0x13')]=function(_0x46a63e){return request(_0x96ee('0x14'),{'options':{'where':{'id':_0x46a63e},'attributes':[_0x96ee('0x11')]}});};exports[_0x96ee('0x15')]=function(_0x405391){return request(_0x96ee('0x16'),{'options':{'where':{'id':_0x405391},'attributes':[_0x96ee('0x11')]}});};exports[_0x96ee('0x17')]=function(_0x3c44ab){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3c44ab},'attributes':[_0x96ee('0x18')]}});};exports[_0x96ee('0x19')]=function(_0x3a8696){return request('ShowUser',{'options':{'where':{'id':_0x3a8696},'attributes':[_0x96ee('0x11')]}});};exports['getTrunkById']=function(_0x343758){return request(_0x96ee('0x1a'),{'options':{'where':{'id':_0x343758},'attributes':[_0x96ee('0x11')]}});};exports[_0x96ee('0x1b')]=function(_0x5d6de0){return request(_0x96ee('0x1c'),{'options':{'where':{'id':_0x5d6de0},'attributes':[_0x96ee('0x1d')]}});};exports['getIntervalById']=function(_0x56d268){return request(_0x96ee('0x1e'),{'options':{'raw':![],'where':{'id':_0x56d268},'include':[{'model':_0x96ee('0x1f'),'as':_0x96ee('0x20')}]}});};exports[_0x96ee('0x21')]=function(_0x392bf6){return request('ShowSmsAccount',{'options':{'where':{'id':_0x392bf6},'attributes':['id',_0x96ee('0x11')]}});};exports[_0x96ee('0x22')]=function(_0x38af3e){return request('CreateSmsMessage',{'body':_0x38af3e});};exports[_0x96ee('0x23')]=function(_0x4488fd){return request(_0x96ee('0x24'),{'body':_0x4488fd});};exports[_0x96ee('0x25')]=function(_0x595216){return request(_0x96ee('0x26'),{'body':_['merge'](_0x595216,{'project_name':_0x595216[_0x96ee('0x27')],'prev_project_name':_0x595216[_0x96ee('0x28')]||'','is_subproject':_0x595216[_0x96ee('0x28')]?!![]:![],'leaveAt':moment()[_0x96ee('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x96ee('0x2a')]=function(_0x2cabea){return request('CreateSquareRecording',{'body':_0x2cabea});};exports[_0x96ee('0x2b')]=function(_0x2fac03){return request(_0x96ee('0x2c'),{'body':_0x2fac03});};exports[_0x96ee('0x2d')]=function(_0x3db251){return request(_0x96ee('0x2e'),{'options':{'raw':![],'where':{'phone':_0x3db251[_0x96ee('0x2f')],'ListId':_0x3db251[_0x96ee('0x30')]}}})[_0x96ee('0x6')](function(_0x21743a){if(_0x21743a){return _0x21743a;}return request(_0x96ee('0x31'),{'body':_0x3db251});});};exports[_0x96ee('0x32')]=function(_0x19c6da){return request(_0x96ee('0x33'),{'options':{'where':{'id':_0x19c6da},'attributes':[_0x96ee('0x11')]}});};exports[_0x96ee('0x34')]=function(_0x2d1567,_0x47e54e){return request(_0x96ee('0x35'),{'body':{'interface':_0x47e54e},'options':{'where':_0x2d1567}});};exports[_0x96ee('0x36')]=function(_0x4d9fbe,_0x34a7a5,_0x229612){return request(_0x96ee('0x37'),{'body':{'type':_0x34a7a5,'uniqueid':_0x229612},'options':{'where':_0x4d9fbe}});};exports['agentUnpause']=function(_0x38ee55){return request(_0x96ee('0x38'),{'body':{},'options':{'where':_0x38ee55}});};exports[_0x96ee('0x39')]=function(_0x25e795){return request(_0x96ee('0x3a'),{'body':{},'options':{'where':_0x25e795}});}; \ 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 358cc99..840c3e9 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 _0xb7c8=['exports','./lex'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb7c8,0x119));var _0x8b7c=function(_0x800bbb,_0x3cbe48){_0x800bbb=_0x800bbb-0x0;var _0x44768a=_0xb7c8[_0x800bbb];return _0x44768a;};var polly=require('./polly');var lex=require(_0x8b7c('0x0'));module[_0x8b7c('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb4e6=['./polly','exports'];(function(_0x4acf6c,_0x9a0cc){var _0xe41f6c=function(_0x5d7bed){while(--_0x5d7bed){_0x4acf6c['push'](_0x4acf6c['shift']());}};_0xe41f6c(++_0x9a0cc);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0xb4e6[_0x2b0bc2];return _0x56e5b9;};var polly=require(_0x6b4e('0x0'));var lex=require('./lex');module[_0x6b4e('0x1')]={'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 8dce252..aa6537c 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 _0xffe1=['exports','./lib/api'];(function(_0x1ec318,_0x1f1609){var _0x1439da=function(_0x3f76fd){while(--_0x3f76fd){_0x1ec318['push'](_0x1ec318['shift']());}};_0x1439da(++_0x1f1609);}(_0xffe1,0x175));var _0x1ffe=function(_0x18436f,_0xfd6274){_0x18436f=_0x18436f-0x0;var _0x419643=_0xffe1[_0x18436f];return _0x419643;};'use strict';var lex=require(_0x1ffe('0x0'));module[_0x1ffe('0x1')]=function(_0x4ad905,_0x4ac1af,_0x37f22a,_0x100207,_0x38121,_0x4d13c2){return lex(_0x4ad905,_0x4ac1af,_0x37f22a,_0x100207,_0x38121,_0x4d13c2);}; \ No newline at end of file +var _0x5c37=['./lib/api','exports'];(function(_0x41d853,_0xf2796){var _0x45dc7c=function(_0x4f3160){while(--_0x4f3160){_0x41d853['push'](_0x41d853['shift']());}};_0x45dc7c(++_0xf2796);}(_0x5c37,0x11e));var _0x75c3=function(_0x7538c5,_0xa5d8ac){_0x7538c5=_0x7538c5-0x0;var _0x8b56be=_0x5c37[_0x7538c5];return _0x8b56be;};'use strict';var lex=require(_0x75c3('0x0'));module[_0x75c3('0x1')]=function(_0x302a73,_0x43cf5a,_0x2a3a11,_0x79e9a5,_0x524eee,_0x1f0ee1){return lex(_0x302a73,_0x43cf5a,_0x2a3a11,_0x79e9a5,_0x524eee,_0x1f0ee1);}; \ 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 97becf7..21b3b75 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 _0xdf93=['slots','hasOwnProperty','slot_','exports'];(function(_0x39ab3b,_0x49ea15){var _0x7a3ff0=function(_0x50706a){while(--_0x50706a){_0x39ab3b['push'](_0x39ab3b['shift']());}};_0x7a3ff0(++_0x49ea15);}(_0xdf93,0x70));var _0x3df9=function(_0x20ad29,_0x1f5790){_0x20ad29=_0x20ad29-0x0;var _0x49da80=_0xdf93[_0x20ad29];return _0x49da80;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x47843f,_0x310715){return new BPromise(function(_0x532aac,_0x206235){_0x47843f['postText'](_0x310715,function(_0x3d299c,_0x59e2ad){if(_0x3d299c){_0x206235(_0x3d299c);}if(_0x59e2ad[_0x3df9('0x0')]){for(const _0x313705 in _0x59e2ad['slots']){if(_0x59e2ad[_0x3df9('0x0')][_0x3df9('0x1')](_0x313705)){var _0x28c95e=_0x59e2ad[_0x3df9('0x0')][_0x313705];_0x59e2ad[_0x3df9('0x2')+_0x313705]=_0x28c95e;}}}_0x532aac(_0x59e2ad);});});}module[_0x3df9('0x3')]=function(_0x3a5b23,_0x19ced7,_0x1cf558,_0x37477c,_0x5a2847,_0x17dce5){var _0x3842cd=new AWS['LexRuntime']({'accessKeyId':_0x19ced7,'secretAccessKey':_0x1cf558,'region':_0x37477c});var _0x10f55b={'botAlias':'$LATEST','botName':_0x17dce5,'inputText':_0x5a2847,'userId':_0x3a5b23};return lexResult(_0x3842cd,_0x10f55b);}; \ No newline at end of file +var _0xccae=['slot_','exports','LexRuntime','$LATEST','bluebird','postText','slots','hasOwnProperty'];(function(_0x50a001,_0x352263){var _0x234764=function(_0x17ba3a){while(--_0x17ba3a){_0x50a001['push'](_0x50a001['shift']());}};_0x234764(++_0x352263);}(_0xccae,0x1d4));var _0xecca=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xccae[_0x500419];return _0x241c1a;};'use strict';var BPromise=require(_0xecca('0x0'));var AWS=require('aws-sdk');function lexResult(_0x990966,_0xb695db){return new BPromise(function(_0x1ab43c,_0x3e6908){_0x990966[_0xecca('0x1')](_0xb695db,function(_0x5410c0,_0x155fb7){if(_0x5410c0){_0x3e6908(_0x5410c0);}if(_0x155fb7[_0xecca('0x2')]){for(const _0x442a20 in _0x155fb7['slots']){if(_0x155fb7[_0xecca('0x2')][_0xecca('0x3')](_0x442a20)){var _0x294559=_0x155fb7[_0xecca('0x2')][_0x442a20];_0x155fb7[_0xecca('0x4')+_0x442a20]=_0x294559;}}}_0x1ab43c(_0x155fb7);});});}module[_0xecca('0x5')]=function(_0x662688,_0x2a8c07,_0x17d536,_0x396a2c,_0x3114a3,_0x53f770){var _0x162e3f=new AWS[(_0xecca('0x6'))]({'accessKeyId':_0x2a8c07,'secretAccessKey':_0x17d536,'region':_0x396a2c});var _0x14a63e={'botAlias':_0xecca('0x7'),'botName':_0x53f770,'inputText':_0x3114a3,'userId':_0x662688};return lexResult(_0x162e3f,_0x14a63e);}; \ 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 5456c25..b5013a8 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 _0x37a0=['./lib/api','exports'];(function(_0x4051d2,_0x1448c3){var _0x3ff0c6=function(_0x3a8281){while(--_0x3a8281){_0x4051d2['push'](_0x4051d2['shift']());}};_0x3ff0c6(++_0x1448c3);}(_0x37a0,0xe0));var _0x037a=function(_0x2cb7ef,_0x4dd339){_0x2cb7ef=_0x2cb7ef-0x0;var _0x5ce2e6=_0x37a0[_0x2cb7ef];return _0x5ce2e6;};'use strict';var polly=require(_0x037a('0x0'));module[_0x037a('0x1')]=function(_0x1ebeea,_0x5b8835,_0x4ebce0,_0x4bb296,_0x5d1c31,_0x1b93a1,_0x351020){return polly(_0x1ebeea,_0x5b8835,_0x4ebce0,_0x4bb296,_0x5d1c31,_0x1b93a1,_0x351020);}; \ No newline at end of file +var _0x0425=['./lib/api','exports'];(function(_0x523d5c,_0x289db6){var _0x2ff266=function(_0x3cc472){while(--_0x3cc472){_0x523d5c['push'](_0x523d5c['shift']());}};_0x2ff266(++_0x289db6);}(_0x0425,0x156));var _0x5042=function(_0x5b790d,_0x24664e){_0x5b790d=_0x5b790d-0x0;var _0x1a41a5=_0x0425[_0x5b790d];return _0x1a41a5;};'use strict';var polly=require(_0x5042('0x0'));module[_0x5042('0x1')]=function(_0x2cfda0,_0xb4362b,_0xdd8c72,_0x302084,_0x5a76b6,_0x212a8a,_0x50592d){return polly(_0x2cfda0,_0xb4362b,_0xdd8c72,_0x302084,_0x5a76b6,_0x212a8a,_0x50592d);}; \ 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 381f390..53f6f3d 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 _0x18e8=['mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x4c4ca2,_0x30d812){var _0x17dac3=function(_0x4f07e6){while(--_0x4f07e6){_0x4c4ca2['push'](_0x4c4ca2['shift']());}};_0x17dac3(++_0x30d812);}(_0x18e8,0x79));var _0x818e=function(_0x32ef54,_0x43c5ec){_0x32ef54=_0x32ef54-0x0;var _0x34b1cb=_0x18e8[_0x32ef54];return _0x34b1cb;};'use strict';var fs=require('fs');var path=require(_0x818e('0x0'));var BPromise=require('bluebird');var rs=require(_0x818e('0x1'));var AWS=require(_0x818e('0x2'));function pollyResult(_0x321bdb,_0x56c3cb,_0x423d8e){return new BPromise(function(_0x13fb5d,_0x19d02d){_0x321bdb[_0x818e('0x3')](_0x56c3cb,function(_0x43e99f,_0x52c475){if(_0x43e99f){_0x19d02d(_0x43e99f);}else if(_0x52c475){if(_0x52c475[_0x818e('0x4')]instanceof Buffer){fs['writeFile'](_0x423d8e,_0x52c475[_0x818e('0x4')],function(_0x227461){if(_0x227461){_0x19d02d(_0x227461);}else{_0x13fb5d();}});}else{_0x19d02d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x19d02d(new Error(_0x818e('0x5')));}});});}module[_0x818e('0x6')]=function(_0x9913f7,_0x35bcf0,_0x478d5a,_0x3c2c73,_0x3d4d47,_0x5cfe9e,_0x2f1c71){var _0x850410=new AWS[(_0x818e('0x7'))]({'accessKeyId':_0x9913f7,'secretAccessKey':_0x35bcf0,'region':_0x478d5a});var _0x501bf9={'Text':_0x3d4d47,'TextType':_0x5cfe9e||_0x818e('0x8'),'OutputFormat':_0x818e('0x9'),'VoiceId':_0x3c2c73};return pollyResult(_0x850410,_0x501bf9,_0x2f1c71);}; \ No newline at end of file +var _0x8fcf=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x38d5a7,_0x2c6399){var _0x2026f0=function(_0x220435){while(--_0x220435){_0x38d5a7['push'](_0x38d5a7['shift']());}};_0x2026f0(++_0x2c6399);}(_0x8fcf,0xd6));var _0xf8fc=function(_0x24fb0d,_0x17da4b){_0x24fb0d=_0x24fb0d-0x0;var _0x2303dc=_0x8fcf[_0x24fb0d];return _0x2303dc;};'use strict';var fs=require('fs');var path=require(_0xf8fc('0x0'));var BPromise=require(_0xf8fc('0x1'));var rs=require(_0xf8fc('0x2'));var AWS=require(_0xf8fc('0x3'));function pollyResult(_0x589fef,_0x7b10e1,_0x2c4511){return new BPromise(function(_0x23af59,_0x25c028){_0x589fef[_0xf8fc('0x4')](_0x7b10e1,function(_0x24d591,_0x1e2a82){if(_0x24d591){_0x25c028(_0x24d591);}else if(_0x1e2a82){if(_0x1e2a82[_0xf8fc('0x5')]instanceof Buffer){fs[_0xf8fc('0x6')](_0x2c4511,_0x1e2a82[_0xf8fc('0x5')],function(_0x5f78df){if(_0x5f78df){_0x25c028(_0x5f78df);}else{_0x23af59();}});}else{_0x25c028(new Error(_0xf8fc('0x7')));}}else{_0x25c028(new Error(_0xf8fc('0x8')));}});});}module[_0xf8fc('0x9')]=function(_0x2ec096,_0x3c4598,_0x33dba5,_0x3f933d,_0xd9d413,_0x4c7930,_0x2cf290){var _0x484a6f=new AWS[(_0xf8fc('0xa'))]({'accessKeyId':_0x2ec096,'secretAccessKey':_0x3c4598,'region':_0x33dba5});var _0x29f195={'Text':_0xd9d413,'TextType':_0x4c7930||_0xf8fc('0xb'),'OutputFormat':_0xf8fc('0xc'),'VoiceId':_0x3f933d};return pollyResult(_0x484a6f,_0x29f195,_0x2cf290);}; \ 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 5ba1360..75a8a5e 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 _0xef88=['exports'];(function(_0x4e515c,_0x50d2f7){var _0x58cc22=function(_0x105ad0){while(--_0x105ad0){_0x4e515c['push'](_0x4e515c['shift']());}};_0x58cc22(++_0x50d2f7);}(_0xef88,0xc6));var _0x8ef8=function(_0x46dfca,_0x2f7f9c){_0x46dfca=_0x46dfca-0x0;var _0x5defd7=_0xef88[_0x46dfca];return _0x5defd7;};'use strict';var asr=require('./lib/api');module[_0x8ef8('0x0')]=function(_0x4fe879,_0x3b5a35,_0x238693,_0x4d69d5){return asr(_0x4fe879,_0x3b5a35,_0x238693);}; \ No newline at end of file +var _0xa8d0=['./lib/api','exports'];(function(_0x3b9bfb,_0x40eb40){var _0x421d0a=function(_0x31e09e){while(--_0x31e09e){_0x3b9bfb['push'](_0x3b9bfb['shift']());}};_0x421d0a(++_0x40eb40);}(_0xa8d0,0xaa));var _0x0a8d=function(_0x5e3c4c,_0x570558){_0x5e3c4c=_0x5e3c4c-0x0;var _0x33064e=_0xa8d0[_0x5e3c4c];return _0x33064e;};'use strict';var asr=require(_0x0a8d('0x0'));module[_0x0a8d('0x1')]=function(_0x466c76,_0x457a4f,_0x40ce2b,_0x347d31){return asr(_0x466c76,_0x457a4f,_0x40ce2b);}; \ 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 89d6b8c..c1109af 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 _0xac5c=['8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16'];(function(_0x529f50,_0x43949b){var _0x2a837e=function(_0x1c29e3){while(--_0x1c29e3){_0x529f50['push'](_0x529f50['shift']());}};_0x2a837e(++_0x43949b);}(_0xac5c,0xc4));var _0xcac5=function(_0x4f2179,_0x566822){_0x4f2179=_0x4f2179-0x0;var _0x26d996=_0xac5c[_0x4f2179];return _0x26d996;};'use strict';var url=require('url');var BPromise=require(_0xcac5('0x0'));var fs=require('fs');var host=_0xcac5('0x1');module[_0xcac5('0x2')]=function(_0x500c3c,_0x25d9fc,_0x5e6b5c){return new BPromise(function(_0x2a55ab,_0x5685f8){var _0x109975;if(typeof _0x500c3c!==_0xcac5('0x3')||_0x500c3c[_0xcac5('0x4')]===0x0){return _0x5685f8(_0xcac5('0x5'));}if(typeof _0x25d9fc!==_0xcac5('0x3')||_0x25d9fc[_0xcac5('0x4')]===0x0){return _0x5685f8(_0xcac5('0x6'));}if(typeof _0x5e6b5c!==_0xcac5('0x7')&&(typeof _0x5e6b5c!==_0xcac5('0x3')||_0x5e6b5c[_0xcac5('0x4')]===0x0)){return _0x5685f8(_0xcac5('0x8'));}try{_0x109975=fs[_0xcac5('0x9')](_0x500c3c)[_0xcac5('0xa')](_0xcac5('0xb'));}catch(_0x1c9be5){return _0x5685f8(_0x1c9be5);}return _0x2a55ab({'method':_0xcac5('0xc'),'uri':host+'/v1/speech:recognize?key='+_0x25d9fc,'body':{'config':{'encoding':_0xcac5('0xd'),'sampleRateHertz':_0xcac5('0xe'),'languageCode':_0x5e6b5c},'audio':{'content':_0x109975}},'json':!![]});});}; \ No newline at end of file +var _0xbf0f=['exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xbf0f,0x6d));var _0xfbf0=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xbf0f[_0x622035];return _0x326cf2;};'use strict';var url=require(_0xfbf0('0x0'));var BPromise=require(_0xfbf0('0x1'));var fs=require('fs');var host=_0xfbf0('0x2');module[_0xfbf0('0x3')]=function(_0xbb0d9a,_0x465bda,_0x4f7869){return new BPromise(function(_0x1b353c,_0x1ac2b0){var _0x13993d;if(typeof _0xbb0d9a!==_0xfbf0('0x4')||_0xbb0d9a[_0xfbf0('0x5')]===0x0){return _0x1ac2b0(_0xfbf0('0x6'));}if(typeof _0x465bda!==_0xfbf0('0x4')||_0x465bda[_0xfbf0('0x5')]===0x0){return _0x1ac2b0(_0xfbf0('0x7'));}if(typeof _0x4f7869!==_0xfbf0('0x8')&&(typeof _0x4f7869!==_0xfbf0('0x4')||_0x4f7869[_0xfbf0('0x5')]===0x0)){return _0x1ac2b0('lang\x20should\x20be\x20a\x20string');}try{_0x13993d=fs['readFileSync'](_0xbb0d9a)[_0xfbf0('0x9')](_0xfbf0('0xa'));}catch(_0x44ac61){return _0x1ac2b0(_0x44ac61);}return _0x1b353c({'method':'POST','uri':host+_0xfbf0('0xb')+_0x465bda,'body':{'config':{'encoding':_0xfbf0('0xc'),'sampleRateHertz':_0xfbf0('0xd'),'languageCode':_0x4f7869},'audio':{'content':_0x13993d}},'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 1241418..a9917fd 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 _0x214e=['./asr','exports'];(function(_0x5f0ef3,_0x493b5b){var _0x27a1e7=function(_0x2655be){while(--_0x2655be){_0x5f0ef3['push'](_0x5f0ef3['shift']());}};_0x27a1e7(++_0x493b5b);}(_0x214e,0xda));var _0xe214=function(_0x5de3d9,_0x490138){_0x5de3d9=_0x5de3d9-0x0;var _0x175cdc=_0x214e[_0x5de3d9];return _0x175cdc;};var asr=require(_0xe214('0x0'));module[_0xe214('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8caf=['exports'];(function(_0x3dd5aa,_0x4e2fb6){var _0x17cf38=function(_0x539503){while(--_0x539503){_0x3dd5aa['push'](_0x3dd5aa['shift']());}};_0x17cf38(++_0x4e2fb6);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x312428,_0x458f28){_0x312428=_0x312428-0x0;var _0x583514=_0x8caf[_0x312428];return _0x583514;};var asr=require('./asr');module[_0xf8ca('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 0c99e7d..ec0f769 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 _0xce9b=['Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','https','parse','bluebird','randomstring','sox','request-promise','querystring','google-tts-api','apiai-promise','./google','./aws','./sestek','../../../config/logger','protocol','https:','WHAT_EVER','get','error','statusCode','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','close','unlink','download\x20error','pipe','end','host','data','transcode','wav','info','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','chmodSync','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','text:synthesize','POST','then','.mp3','writeFile','tmp','googleCloudTTS\x20path','split','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription'];(function(_0x58c6a9,_0x3a0caf){var _0x394f21=function(_0x37ddc2){while(--_0x37ddc2){_0x58c6a9['push'](_0x58c6a9['shift']());}};_0x394f21(++_0x3a0caf);}(_0xce9b,0xed));var _0xbce9=function(_0x33315a,_0x5354d5){_0x33315a=_0x33315a-0x0;var _0x5bcb51=_0xce9b[_0x33315a];return _0x5bcb51;};'use strict';var fs=require('fs');var path=require(_0xbce9('0x0'));var http=require(_0xbce9('0x1'));var https=require(_0xbce9('0x2'));var urlParse=require('url')[_0xbce9('0x3')];var BPromise=require(_0xbce9('0x4'));var rs=require(_0xbce9('0x5'));var sox=require(_0xbce9('0x6'));var rp=require(_0xbce9('0x7'));var util=require('util');var querystring=require(_0xbce9('0x8'));var tts=require(_0xbce9('0x9'));var apiai=require(_0xbce9('0xa'));var md5=require('md5');var google=require(_0xbce9('0xb'));var aws=require(_0xbce9('0xc'));var tilde=require('./tilde');var sestek=require(_0xbce9('0xd'));var logger=require(_0xbce9('0xe'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xfad0c7,_0x1b5bc5){return new BPromise(function(_0x14283d,_0x26c158){var _0x11fd22=urlParse(_0xfad0c7);var _0x288100=_0x11fd22[_0xbce9('0xf')]===_0xbce9('0x10')?https:http;var _0x835c30={'host':_0x11fd22['host'],'path':_0x11fd22['path'],'headers':{'user-agent':_0xbce9('0x11')}};_0x288100[_0xbce9('0x12')](_0x835c30,function(_0x400dce){if(_0x400dce['statusCode']!==0xc8){logger[_0xbce9('0x13')]('request\x20to\x20'+_0xfad0c7+'\x20failed,\x20status\x20code\x20=\x20'+_0x400dce[_0xbce9('0x14')]+'\x20('+_0x400dce[_0xbce9('0x15')]+')');_0x26c158(new Error(_0xbce9('0x16')+_0xfad0c7+_0xbce9('0x17')+_0x400dce[_0xbce9('0x14')]+'\x20('+_0x400dce[_0xbce9('0x15')]+')'));return;}var _0x6f3834=fs[_0xbce9('0x18')](_0x1b5bc5);_0x6f3834['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x6f3834[_0xbce9('0x19')](_0x14283d);});_0x6f3834['on'](_0xbce9('0x13'),function(_0x55d16a){fs[_0xbce9('0x1a')](_0x1b5bc5);logger[_0xbce9('0x13')](_0xbce9('0x1b'),_0x55d16a);_0x26c158(_0x55d16a);});_0x400dce[_0xbce9('0x1c')](_0x6f3834);})['on'](_0xbce9('0x13'),function(_0x46f5d4){logger['error'](_0x46f5d4);_0x26c158(_0x46f5d4);})[_0xbce9('0x1d')]();});}function uploadFile(_0x2ba880){return new BPromise(function(_0x2b2acc,_0x53a58f){var _0x4a060d=urlParse(_0x2ba880);var _0x359e3d=_0x4a060d['protocol']==='https:'?https:http;var _0x4456e0={'host':_0x4a060d[_0xbce9('0x1e')],'path':_0x4a060d[_0xbce9('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x359e3d[_0xbce9('0x12')](_0x4456e0,function(_0x43cadb){if(_0x43cadb[_0xbce9('0x14')]!==0xc8){_0x53a58f(new Error(_0xbce9('0x16')+_0x2ba880+_0xbce9('0x17')+_0x43cadb[_0xbce9('0x14')]+'\x20('+_0x43cadb[_0xbce9('0x15')]+')'));return;}var _0x4531d7='';_0x43cadb['on'](_0xbce9('0x1f'),function(_0x5cea4e){_0x4531d7+=_0x5cea4e;});_0x43cadb['on'](_0xbce9('0x1d'),function(){_0x2b2acc(_0x4531d7);});})['on'](_0xbce9('0x13'),function(_0x131d29){_0x53a58f(_0x131d29);})[_0xbce9('0x1d')]();});}function convertFile(_0x34fd23,_0x3b963b){return new BPromise(function(_0x536bd9,_0x489ce6){var _0x117edf=sox[_0xbce9('0x20')](_0x34fd23,_0x3b963b,{'sampleRate':0x1f40,'format':_0xbce9('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x117edf['on'](_0xbce9('0x13'),function(_0x129780){logger['error']('error\x20convert',_0x129780);_0x489ce6(_0x129780);});_0x117edf['on']('end',function(){logger[_0xbce9('0x22')](_0xbce9('0x23'));_0x536bd9();});_0x117edf[_0xbce9('0x24')]();});}function base64Decode(_0x1b4f6e,_0x4bb568){var _0x57baaa=path[_0xbce9('0x25')](__dirname,'tmp',rs[_0xbce9('0x26')](0x4)+_0xbce9('0x27'));fs[_0xbce9('0x28')](_0x57baaa,_0x1b4f6e,_0xbce9('0x29'));return convertFile(_0x57baaa,_0x4bb568)['then'](function(){try{fs[_0xbce9('0x1a')](_0x57baaa);fs[_0xbce9('0x2a')](_0x4bb568,_0xbce9('0x2b'));}catch(_0x35d356){logger[_0xbce9('0x13')](_0x35d356);}return _0x4bb568['split']('.')[0x0];});}function base64Encode(_0x2266af){var _0x196753=fs[_0xbce9('0x2c')](_0x2266af);return new Buffer(_0x196753)['toString']('base64');}exports[_0xbce9('0x2d')]=function(_0x460ee8,_0x1d7884,_0x2e4315,_0x4e6825,_0x118963,_0x411655){var _0x35b78d,_0x3eaee2;var _0x465d11=_0xbce9('0x2e');var _0x34e66d='?key='+_0x460ee8;var _0x1a1f8d={};if(_0x1d7884===_0xbce9('0x2f')){_0x1a1f8d[_0xbce9('0x30')]={'ssml':_0x2e4315};}else{_0x1a1f8d[_0xbce9('0x30')]={'text':_0x2e4315};};_0x1a1f8d[_0xbce9('0x31')]={'languageCode':_0x4e6825,'ssmlGender':_0x118963};_0x1a1f8d[_0xbce9('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5acf33={'url':_0x465d11+_0xbce9('0x33')+_0x34e66d,'method':_0xbce9('0x34'),'json':!![],'body':_0x1a1f8d};return rp(_0x5acf33)[_0xbce9('0x35')](function(_0x16a4c9){return new BPromise(function(_0x54892c,_0x5e56df){_0x35b78d=path['resolve'](__dirname,'tmp',rs[_0xbce9('0x26')](0x4)+_0xbce9('0x36'));var _0x2dc05f=Buffer['from'](_0x16a4c9['audioContent'],_0xbce9('0x29'));return fs[_0xbce9('0x37')](_0x35b78d,_0x2dc05f,function(_0x231da3){_0x5e56df(_0x231da3);},function(_0x290cde){fs[_0xbce9('0x2a')](_0x35b78d,_0xbce9('0x2b'));_0x54892c(_0x290cde);});});})[_0xbce9('0x35')](function(_0x1b68e5){_0x3eaee2=path['resolve'](__dirname,_0xbce9('0x38'),rs[_0xbce9('0x26')](0x4)+'.wav');return convertFile(_0x35b78d,_0x3eaee2);})['then'](function(){try{fs[_0xbce9('0x1a')](_0x35b78d);fs[_0xbce9('0x2a')](_0x3eaee2,'777');}catch(_0x142d1b){logger['error'](_0x142d1b);}logger['info'](_0xbce9('0x39'),_0x3eaee2[_0xbce9('0x3a')]('.')[0x0]);return _0x3eaee2[_0xbce9('0x3a')]('.')[0x0];});};exports[_0xbce9('0x3b')]=function(_0xd3a164,_0xa60250){var _0x35053d,_0x391a12;return tts(_0xd3a164,_0xa60250||'en',0x1)['then'](function(_0x22472e){logger['info'](_0x22472e);_0x35053d=path[_0xbce9('0x25')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');return downloadFile(_0x22472e,_0x35053d);})['then'](function(){_0x391a12=path[_0xbce9('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0xbce9('0x27'));return convertFile(_0x35053d,_0x391a12);})[_0xbce9('0x35')](function(){try{fs[_0xbce9('0x1a')](_0x35053d);fs[_0xbce9('0x2a')](_0x391a12,_0xbce9('0x2b'));}catch(_0xcb21c7){logger[_0xbce9('0x13')](_0xcb21c7);}logger['info'](_0xbce9('0x3c'),_0x391a12[_0xbce9('0x3a')]('.')[0x0]);return _0x391a12[_0xbce9('0x3a')]('.')[0x0];});};exports[_0xbce9('0x3d')]=function(_0x3838a4,_0x54e845,_0x493cb3){return google[_0xbce9('0x3e')](_0x3838a4,_0x54e845,_0x493cb3)['then'](function(_0x2f3803){logger['info'](_0x2f3803[_0xbce9('0x3f')]);return rp(_0x2f3803);})[_0xbce9('0x35')](function(_0x59ed9c){var _0x3a8fe='';var _0x5e4944=0x0;try{fs['unlink'](_0x3838a4);}catch(_0x595b1c){logger[_0xbce9('0x13')](_0x595b1c);}if(_0x59ed9c&&_0x59ed9c[_0xbce9('0x40')]){_0x3a8fe=_0x59ed9c['results'][_0xbce9('0x41')](function(_0x2f6127){return _0x2f6127&&_0x2f6127[_0xbce9('0x42')][0x0]&&_0x2f6127[_0xbce9('0x42')][0x0][_0xbce9('0x43')]?_0x2f6127['alternatives'][0x0][_0xbce9('0x43')]:'';})[_0xbce9('0x44')]('\x0a');_0x5e4944=_0x59ed9c[_0xbce9('0x40')]['map'](function(_0x10fa08){return _0x10fa08&&_0x10fa08[_0xbce9('0x42')][0x0]&&_0x10fa08[_0xbce9('0x42')][0x0]['confidence']?_0x10fa08[_0xbce9('0x42')][0x0][_0xbce9('0x45')]:0x0;})[_0xbce9('0x44')]('\x0a');}logger[_0xbce9('0x22')](_0xbce9('0x46'),_0x3a8fe);logger[_0xbce9('0x22')](_0xbce9('0x47'),_0x5e4944);return{'transcript':_0x3a8fe,'confidence':_0x5e4944};})[_0xbce9('0x48')](function(_0x2c9690){logger[_0xbce9('0x13')](_0xbce9('0x49'),_0x2c9690[_0xbce9('0x14')],_0x2c9690[_0xbce9('0x4a')],_0x2c9690[_0xbce9('0x4b')]);});};exports[_0xbce9('0x4c')]=function(_0xe2cbd3,_0x403c00,_0x1be1c5,_0x41984b){var _0x1b7668=apiai(_0x403c00,{'language':_0x41984b||'en'});return _0x1b7668[_0xbce9('0x4d')](_0x1be1c5,{'sessionId':md5(_0xe2cbd3)})[_0xbce9('0x35')](function(_0x22601b){logger['info'](JSON[_0xbce9('0x4e')](_0x22601b));return{'source':_0x22601b[_0xbce9('0x4f')][_0xbce9('0x50')],'resolvedQuery':_0x22601b[_0xbce9('0x4f')][_0xbce9('0x51')],'action':_0x22601b[_0xbce9('0x4f')]['action'],'actionIncomplete':_0x22601b[_0xbce9('0x4f')][_0xbce9('0x52')],'speech':_0x22601b[_0xbce9('0x4f')][_0xbce9('0x53')][_0xbce9('0x54')],'score':_0x22601b[_0xbce9('0x4f')][_0xbce9('0x55')],'statusCode':_0x22601b[_0xbce9('0x56')][_0xbce9('0x57')],'endConversation':_0x22601b['result'][_0xbce9('0x58')][_0xbce9('0x59')]||![],'isFallbackIntent':_0x22601b[_0xbce9('0x4f')][_0xbce9('0x58')][_0xbce9('0x5a')]};});};exports[_0xbce9('0x5b')]=function(_0x49d417,_0x14b7dd,_0xf719d1,_0x573932){return tilde[_0xbce9('0x3e')](_0x49d417,_0x14b7dd,_0xf719d1,_0x573932)['then'](function(_0x113b97){try{fs[_0xbce9('0x1a')](_0x49d417);}catch(_0x17fc94){logger[_0xbce9('0x13')](_0x17fc94);}logger[_0xbce9('0x22')](_0xbce9('0x5c'),_0x113b97[_0xbce9('0x43')]);logger[_0xbce9('0x22')](_0xbce9('0x5d'),_0x113b97['confidence']);return _0x113b97;});};exports['awsPolly']=function(_0x19ec4d,_0x5ecec0,_0x7d8dfa,_0x3c8822,_0x433ecf,_0x58ac2b){var _0x3cbd52=path[_0xbce9('0x25')](__dirname,_0xbce9('0x38'),rs[_0xbce9('0x26')](0x4)+_0xbce9('0x36'));var _0x499981;return aws[_0xbce9('0x5e')](_0x19ec4d,_0x5ecec0,_0x7d8dfa,_0x3c8822,_0x433ecf,_0x58ac2b,_0x3cbd52)['then'](function(){_0x499981=path[_0xbce9('0x25')](__dirname,_0xbce9('0x38'),rs[_0xbce9('0x26')](0x4)+_0xbce9('0x27'));return convertFile(_0x3cbd52,_0x499981);})[_0xbce9('0x35')](function(){try{fs[_0xbce9('0x1a')](_0x3cbd52);fs[_0xbce9('0x2a')](_0x499981,_0xbce9('0x2b'));}catch(_0x435d14){logger['error'](_0x435d14);}return _0x499981[_0xbce9('0x3a')]('.')[0x0];});};exports[_0xbce9('0x5f')]=function(_0x20467d,_0x9ca8a1,_0xf91f05,_0x3a06e5,_0x4e1c4d,_0x358571){return aws[_0xbce9('0x60')](_0x20467d,_0x9ca8a1,_0xf91f05,_0x3a06e5,_0x4e1c4d,_0x358571)[_0xbce9('0x35')](function(_0x3665d7){logger[_0xbce9('0x22')](JSON['stringify'](_0x3665d7));return _0x3665d7;});};exports[_0xbce9('0x61')]=function(_0x22d8ee,_0xd41ad4,_0x3d9ad5,_0x38596d){var _0x3ba553=util[_0xbce9('0x62')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x22d8ee,encodeURIComponent(_0xd41ad4),_0x3d9ad5,_0x38596d);var _0x930cd2=path['resolve'](__dirname,_0xbce9('0x38'),rs[_0xbce9('0x26')](0x4)+_0xbce9('0x36'));var _0xfda861;return downloadFile(_0x3ba553,_0x930cd2)[_0xbce9('0x35')](function(){_0xfda861=path[_0xbce9('0x25')](__dirname,_0xbce9('0x38'),rs[_0xbce9('0x26')](0x4)+_0xbce9('0x27'));return convertFile(_0x930cd2,_0xfda861);})['then'](function(){try{fs[_0xbce9('0x1a')](_0x930cd2);fs[_0xbce9('0x2a')](_0xfda861,_0xbce9('0x2b'));}catch(_0x2d2567){logger[_0xbce9('0x13')](_0x2d2567);}return _0xfda861[_0xbce9('0x3a')]('.')[0x0];});};exports[_0xbce9('0x63')]=function(_0x5b78c1,_0xa0ec47,_0x260d1c,_0x1c18ee){var _0x482cbf=util[_0xbce9('0x62')](_0xbce9('0x64'),ISPEECH_API,_0xa0ec47,_0x260d1c,base64Encode(_0x5b78c1),_0x1c18ee?util[_0xbce9('0x62')]('model=%s',encodeURIComponent(_0x1c18ee)):_0xbce9('0x65'));return uploadFile(_0x482cbf)[_0xbce9('0x35')](function(_0x5ab7b3){return querystring['parse'](_0x5ab7b3);});};exports['sestekNDA']=function(_0x3d51f8,_0x16a746){return sestek['nda'](_0x3d51f8,_0x16a746)[_0xbce9('0x35')](function(_0x468fd2){logger['info'](JSON[_0xbce9('0x4e')](_0x468fd2));var _0x24cbb7={'speech':_0x468fd2[_0xbce9('0x66')],'action':_0x468fd2['channelData']?_0x468fd2[_0xbce9('0x67')][_0xbce9('0x68')]:undefined,'actiondata':_0x468fd2[_0xbce9('0x67')]?_0x468fd2['channelData'][_0xbce9('0x69')]:undefined};if(_0x468fd2[_0xbce9('0x67')]&&_0x468fd2[_0xbce9('0x67')]['AudioFromTts']){return base64Decode(_0x468fd2[_0xbce9('0x67')][_0xbce9('0x6a')][_0xbce9('0x6b')],path[_0xbce9('0x25')](__dirname,_0xbce9('0x38'),rs[_0xbce9('0x26')](0x4)+_0xbce9('0x27')))['then'](function(_0x1ca9c0){_0x24cbb7[_0xbce9('0x6c')]=_0x1ca9c0;return _0x24cbb7;});}return _0x24cbb7;});};exports[_0xbce9('0x6d')]=function(){return __dirname;}; \ No newline at end of file +var _0xb40f=['catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','stringify','source','result','resolvedQuery','actionIncomplete','speech','status','code','metadata','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','AudioFromTts','Data','audiofile','url','parse','bluebird','randomstring','querystring','google-tts-api','apiai-promise','./google','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','end','get','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','from','writeFile','googleCloudTTS\x20path','googleTTS','.mp3','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence'];(function(_0x5a0136,_0x12305a){var _0x72da35=function(_0x5c18a8){while(--_0x5c18a8){_0x5a0136['push'](_0x5a0136['shift']());}};_0x72da35(++_0x12305a);}(_0xb40f,0x89));var _0xfb40=function(_0x4ac424,_0x554b5d){_0x4ac424=_0x4ac424-0x0;var _0xe1b890=_0xb40f[_0x4ac424];return _0xe1b890;};'use strict';var fs=require('fs');var path=require('path');var http=require('http');var https=require('https');var urlParse=require(_0xfb40('0x0'))[_0xfb40('0x1')];var BPromise=require(_0xfb40('0x2'));var rs=require(_0xfb40('0x3'));var sox=require('sox');var rp=require('request-promise');var util=require('util');var querystring=require(_0xfb40('0x4'));var tts=require(_0xfb40('0x5'));var apiai=require(_0xfb40('0x6'));var md5=require('md5');var google=require(_0xfb40('0x7'));var aws=require(_0xfb40('0x8'));var tilde=require('./tilde');var sestek=require(_0xfb40('0x9'));var logger=require(_0xfb40('0xa'))(_0xfb40('0xb'));var ISPEECH_API=_0xfb40('0xc');function downloadFile(_0x25b568,_0x3a4281){return new BPromise(function(_0x5b3705,_0x511f01){var _0x56b717=urlParse(_0x25b568);var _0x44a5c5=_0x56b717[_0xfb40('0xd')]===_0xfb40('0xe')?https:http;var _0x87642a={'host':_0x56b717[_0xfb40('0xf')],'path':_0x56b717[_0xfb40('0x10')],'headers':{'user-agent':_0xfb40('0x11')}};_0x44a5c5['get'](_0x87642a,function(_0x43bead){if(_0x43bead['statusCode']!==0xc8){logger[_0xfb40('0x12')](_0xfb40('0x13')+_0x25b568+_0xfb40('0x14')+_0x43bead[_0xfb40('0x15')]+'\x20('+_0x43bead[_0xfb40('0x16')]+')');_0x511f01(new Error(_0xfb40('0x13')+_0x25b568+_0xfb40('0x14')+_0x43bead['statusCode']+'\x20('+_0x43bead[_0xfb40('0x16')]+')'));return;}var _0x207529=fs[_0xfb40('0x17')](_0x3a4281);_0x207529['on'](_0xfb40('0x18'),function(){logger[_0xfb40('0x19')](_0xfb40('0x1a'));_0x207529['close'](_0x5b3705);});_0x207529['on'](_0xfb40('0x12'),function(_0x5818bd){fs[_0xfb40('0x1b')](_0x3a4281);logger[_0xfb40('0x12')](_0xfb40('0x1c'),_0x5818bd);_0x511f01(_0x5818bd);});_0x43bead['pipe'](_0x207529);})['on']('error',function(_0x4b41f9){logger[_0xfb40('0x12')](_0x4b41f9);_0x511f01(_0x4b41f9);})[_0xfb40('0x1d')]();});}function uploadFile(_0xdf3377){return new BPromise(function(_0x27f925,_0x7641d2){var _0xa2fdfb=urlParse(_0xdf3377);var _0x2eb787=_0xa2fdfb[_0xfb40('0xd')]===_0xfb40('0xe')?https:http;var _0x102ae1={'host':_0xa2fdfb[_0xfb40('0xf')],'path':_0xa2fdfb[_0xfb40('0x10')],'headers':{'user-agent':_0xfb40('0x11')}};_0x2eb787[_0xfb40('0x1e')](_0x102ae1,function(_0x3a4c09){if(_0x3a4c09['statusCode']!==0xc8){_0x7641d2(new Error(_0xfb40('0x13')+_0xdf3377+_0xfb40('0x14')+_0x3a4c09[_0xfb40('0x15')]+'\x20('+_0x3a4c09['statusMessage']+')'));return;}var _0x57579f='';_0x3a4c09['on'](_0xfb40('0x1f'),function(_0x59b683){_0x57579f+=_0x59b683;});_0x3a4c09['on'](_0xfb40('0x1d'),function(){_0x27f925(_0x57579f);});})['on'](_0xfb40('0x12'),function(_0x4b51b8){_0x7641d2(_0x4b51b8);})[_0xfb40('0x1d')]();});}function convertFile(_0x47ab03,_0x154ee4){return new BPromise(function(_0x169c60,_0x104efb){var _0x318246=sox[_0xfb40('0x20')](_0x47ab03,_0x154ee4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x318246['on']('error',function(_0x343654){logger[_0xfb40('0x12')](_0xfb40('0x21'),_0x343654);_0x104efb(_0x343654);});_0x318246['on'](_0xfb40('0x1d'),function(){logger[_0xfb40('0x19')](_0xfb40('0x22'));_0x169c60();});_0x318246[_0xfb40('0x23')]();});}function base64Decode(_0x5da976,_0x4fe9d1){var _0x3b8a71=path[_0xfb40('0x24')](__dirname,'tmp',rs[_0xfb40('0x25')](0x4)+_0xfb40('0x26'));fs[_0xfb40('0x27')](_0x3b8a71,_0x5da976,_0xfb40('0x28'));return convertFile(_0x3b8a71,_0x4fe9d1)[_0xfb40('0x29')](function(){try{fs['unlink'](_0x3b8a71);fs[_0xfb40('0x2a')](_0x4fe9d1,_0xfb40('0x2b'));}catch(_0x4a3bfa){logger[_0xfb40('0x12')](_0x4a3bfa);}return _0x4fe9d1[_0xfb40('0x2c')]('.')[0x0];});}function base64Encode(_0x9c28){var _0x52fa9d=fs['readFileSync'](_0x9c28);return new Buffer(_0x52fa9d)[_0xfb40('0x2d')](_0xfb40('0x28'));}exports[_0xfb40('0x2e')]=function(_0x465e3d,_0x1461e0,_0x1ed37c,_0x4c5e9e,_0x192176,_0x51bb11){var _0x4c57aa,_0x3a48d0;var _0x5dc2e2=_0xfb40('0x2f');var _0x2a09c9=_0xfb40('0x30')+_0x465e3d;var _0x53abe6={};if(_0x1461e0===_0xfb40('0x31')){_0x53abe6[_0xfb40('0x32')]={'ssml':_0x1ed37c};}else{_0x53abe6['input']={'text':_0x1ed37c};};_0x53abe6[_0xfb40('0x33')]={'languageCode':_0x4c5e9e,'ssmlGender':_0x192176};_0x53abe6[_0xfb40('0x34')]={'audioEncoding':_0xfb40('0x35'),'sampleRateHertz':0x1f40};var _0x48d15f={'url':_0x5dc2e2+_0xfb40('0x36')+_0x2a09c9,'method':_0xfb40('0x37'),'json':!![],'body':_0x53abe6};return rp(_0x48d15f)[_0xfb40('0x29')](function(_0x581f58){return new BPromise(function(_0x550377,_0x81d445){_0x4c57aa=path[_0xfb40('0x24')](__dirname,_0xfb40('0x38'),rs['generate'](0x4)+'.mp3');var _0x37003a=Buffer[_0xfb40('0x39')](_0x581f58['audioContent'],_0xfb40('0x28'));return fs[_0xfb40('0x3a')](_0x4c57aa,_0x37003a,function(_0x355569){_0x81d445(_0x355569);},function(_0x4c34a2){fs[_0xfb40('0x2a')](_0x4c57aa,'777');_0x550377(_0x4c34a2);});});})[_0xfb40('0x29')](function(_0x7f7caa){_0x3a48d0=path[_0xfb40('0x24')](__dirname,_0xfb40('0x38'),rs[_0xfb40('0x25')](0x4)+'.wav');return convertFile(_0x4c57aa,_0x3a48d0);})['then'](function(){try{fs[_0xfb40('0x1b')](_0x4c57aa);fs[_0xfb40('0x2a')](_0x3a48d0,_0xfb40('0x2b'));}catch(_0xf36231){logger['error'](_0xf36231);}logger[_0xfb40('0x19')](_0xfb40('0x3b'),_0x3a48d0[_0xfb40('0x2c')]('.')[0x0]);return _0x3a48d0[_0xfb40('0x2c')]('.')[0x0];});};exports[_0xfb40('0x3c')]=function(_0x166636,_0x56ec8c){var _0x54f1ea,_0xf78732;return tts(_0x166636,_0x56ec8c||'en',0x1)['then'](function(_0x356241){logger[_0xfb40('0x19')](_0x356241);_0x54f1ea=path[_0xfb40('0x24')](__dirname,_0xfb40('0x38'),rs['generate'](0x4)+_0xfb40('0x3d'));return downloadFile(_0x356241,_0x54f1ea);})[_0xfb40('0x29')](function(){_0xf78732=path[_0xfb40('0x24')](__dirname,_0xfb40('0x38'),rs[_0xfb40('0x25')](0x4)+_0xfb40('0x26'));return convertFile(_0x54f1ea,_0xf78732);})[_0xfb40('0x29')](function(){try{fs[_0xfb40('0x1b')](_0x54f1ea);fs[_0xfb40('0x2a')](_0xf78732,'777');}catch(_0x145d4e){logger[_0xfb40('0x12')](_0x145d4e);}logger['info']('goggleTTS\x20path',_0xf78732[_0xfb40('0x2c')]('.')[0x0]);return _0xf78732['split']('.')[0x0];});};exports[_0xfb40('0x3e')]=function(_0x253dc3,_0x2d01dc,_0x24c497){return google[_0xfb40('0x3f')](_0x253dc3,_0x2d01dc,_0x24c497)['then'](function(_0x37d153){logger[_0xfb40('0x19')](_0x37d153[_0xfb40('0x40')]);return rp(_0x37d153);})[_0xfb40('0x29')](function(_0x32f814){var _0x10b043='';var _0x552020=0x0;try{fs[_0xfb40('0x1b')](_0x253dc3);}catch(_0x315ecb){logger['error'](_0x315ecb);}if(_0x32f814&&_0x32f814[_0xfb40('0x41')]){_0x10b043=_0x32f814[_0xfb40('0x41')][_0xfb40('0x42')](function(_0x5e82cb){return _0x5e82cb&&_0x5e82cb['alternatives'][0x0]&&_0x5e82cb[_0xfb40('0x43')][0x0][_0xfb40('0x44')]?_0x5e82cb[_0xfb40('0x43')][0x0][_0xfb40('0x44')]:'';})[_0xfb40('0x45')]('\x0a');_0x552020=_0x32f814['results']['map'](function(_0x44786c){return _0x44786c&&_0x44786c[_0xfb40('0x43')][0x0]&&_0x44786c[_0xfb40('0x43')][0x0][_0xfb40('0x46')]?_0x44786c[_0xfb40('0x43')][0x0][_0xfb40('0x46')]:0x0;})[_0xfb40('0x45')]('\x0a');}logger[_0xfb40('0x19')](_0xfb40('0x47'),_0x10b043);logger[_0xfb40('0x19')](_0xfb40('0x48'),_0x552020);return{'transcript':_0x10b043,'confidence':_0x552020};})[_0xfb40('0x49')](function(_0x1d803a){logger[_0xfb40('0x12')](_0xfb40('0x4a'),_0x1d803a[_0xfb40('0x15')],_0x1d803a[_0xfb40('0x4b')],_0x1d803a['message']);});};exports[_0xfb40('0x4c')]=function(_0x2a855d,_0x413af7,_0x3aec73,_0x28b46d){var _0x1f348e=apiai(_0x413af7,{'language':_0x28b46d||'en'});return _0x1f348e[_0xfb40('0x4d')](_0x3aec73,{'sessionId':md5(_0x2a855d)})[_0xfb40('0x29')](function(_0x19dd5f){logger[_0xfb40('0x19')](JSON[_0xfb40('0x4e')](_0x19dd5f));return{'source':_0x19dd5f['result'][_0xfb40('0x4f')],'resolvedQuery':_0x19dd5f[_0xfb40('0x50')][_0xfb40('0x51')],'action':_0x19dd5f[_0xfb40('0x50')]['action'],'actionIncomplete':_0x19dd5f[_0xfb40('0x50')][_0xfb40('0x52')],'speech':_0x19dd5f['result']['fulfillment'][_0xfb40('0x53')],'score':_0x19dd5f[_0xfb40('0x50')]['score'],'statusCode':_0x19dd5f[_0xfb40('0x54')][_0xfb40('0x55')],'endConversation':_0x19dd5f[_0xfb40('0x50')][_0xfb40('0x56')]['endConversation']||![],'isFallbackIntent':_0x19dd5f[_0xfb40('0x50')][_0xfb40('0x56')][_0xfb40('0x57')]};});};exports[_0xfb40('0x58')]=function(_0x51d78c,_0x5b9592,_0x4d5364,_0x4dab85){return tilde[_0xfb40('0x3f')](_0x51d78c,_0x5b9592,_0x4d5364,_0x4dab85)[_0xfb40('0x29')](function(_0x76ad8f){try{fs[_0xfb40('0x1b')](_0x51d78c);}catch(_0x4e8415){logger['error'](_0x4e8415);}logger[_0xfb40('0x19')](_0xfb40('0x59'),_0x76ad8f[_0xfb40('0x44')]);logger[_0xfb40('0x19')]('Tilde\x20ASR\x20confidence',_0x76ad8f[_0xfb40('0x46')]);return _0x76ad8f;});};exports['awsPolly']=function(_0x5624d3,_0x64656,_0x4992fb,_0x17b5ff,_0x51e5ce,_0x2b9f10){var _0x2e7efd=path[_0xfb40('0x24')](__dirname,'tmp',rs[_0xfb40('0x25')](0x4)+_0xfb40('0x3d'));var _0x45f21b;return aws['polly'](_0x5624d3,_0x64656,_0x4992fb,_0x17b5ff,_0x51e5ce,_0x2b9f10,_0x2e7efd)[_0xfb40('0x29')](function(){_0x45f21b=path['resolve'](__dirname,_0xfb40('0x38'),rs[_0xfb40('0x25')](0x4)+_0xfb40('0x26'));return convertFile(_0x2e7efd,_0x45f21b);})[_0xfb40('0x29')](function(){try{fs[_0xfb40('0x1b')](_0x2e7efd);fs[_0xfb40('0x2a')](_0x45f21b,'777');}catch(_0x5903af){logger[_0xfb40('0x12')](_0x5903af);}return _0x45f21b[_0xfb40('0x2c')]('.')[0x0];});};exports[_0xfb40('0x5a')]=function(_0x54fffc,_0x530ffd,_0x5bc296,_0x446cb7,_0x4391e9,_0x36bda6){return aws[_0xfb40('0x5b')](_0x54fffc,_0x530ffd,_0x5bc296,_0x446cb7,_0x4391e9,_0x36bda6)[_0xfb40('0x29')](function(_0x4026c4){logger[_0xfb40('0x19')](JSON[_0xfb40('0x4e')](_0x4026c4));return _0x4026c4;});};exports[_0xfb40('0x5c')]=function(_0x139c7d,_0x41eee5,_0x4c3935,_0x3e827c){var _0x491e8f=util[_0xfb40('0x5d')](_0xfb40('0x5e'),ISPEECH_API,_0x139c7d,encodeURIComponent(_0x41eee5),_0x4c3935,_0x3e827c);var _0x3572a2=path['resolve'](__dirname,_0xfb40('0x38'),rs[_0xfb40('0x25')](0x4)+_0xfb40('0x3d'));var _0x1515aa;return downloadFile(_0x491e8f,_0x3572a2)[_0xfb40('0x29')](function(){_0x1515aa=path['resolve'](__dirname,'tmp',rs[_0xfb40('0x25')](0x4)+_0xfb40('0x26'));return convertFile(_0x3572a2,_0x1515aa);})[_0xfb40('0x29')](function(){try{fs[_0xfb40('0x1b')](_0x3572a2);fs[_0xfb40('0x2a')](_0x1515aa,'777');}catch(_0xe7027c){logger[_0xfb40('0x12')](_0xe7027c);}return _0x1515aa[_0xfb40('0x2c')]('.')[0x0];});};exports[_0xfb40('0x5f')]=function(_0x260732,_0x13457a,_0xacf0d8,_0x38fd3e){var _0x36c649=util[_0xfb40('0x5d')](_0xfb40('0x60'),ISPEECH_API,_0x13457a,_0xacf0d8,base64Encode(_0x260732),_0x38fd3e?util['format'](_0xfb40('0x61'),encodeURIComponent(_0x38fd3e)):_0xfb40('0x62'));return uploadFile(_0x36c649)['then'](function(_0x2af5d1){return querystring['parse'](_0x2af5d1);});};exports[_0xfb40('0x63')]=function(_0x1cba8f,_0x5246eb){return sestek[_0xfb40('0x64')](_0x1cba8f,_0x5246eb)[_0xfb40('0x29')](function(_0x30bd02){logger[_0xfb40('0x19')](JSON[_0xfb40('0x4e')](_0x30bd02));var _0x2252f1={'speech':_0x30bd02['text'],'action':_0x30bd02[_0xfb40('0x65')]?_0x30bd02[_0xfb40('0x65')]['CustomAction']:undefined,'actiondata':_0x30bd02[_0xfb40('0x65')]?_0x30bd02['channelData']['CustomActionData']:undefined};if(_0x30bd02['channelData']&&_0x30bd02['channelData'][_0xfb40('0x66')]){return base64Decode(_0x30bd02[_0xfb40('0x65')][_0xfb40('0x66')][_0xfb40('0x67')],path[_0xfb40('0x24')](__dirname,_0xfb40('0x38'),rs[_0xfb40('0x25')](0x4)+_0xfb40('0x26')))['then'](function(_0x40cdfa){_0x2252f1[_0xfb40('0x68')]=_0x40cdfa;return _0x2252f1;});}return _0x2252f1;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 35ddf7e..46bfb53 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 _0x3e7f=['./nda','exports'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x3e7f,0x9a));var _0xf3e7=function(_0x2c7116,_0xab590b){_0x2c7116=_0x2c7116-0x0;var _0x197395=_0x3e7f[_0x2c7116];return _0x197395;};var nda=require(_0xf3e7('0x0'));module[_0xf3e7('0x1')]={'nda':nda}; \ No newline at end of file +var _0x691c=['exports'];(function(_0x93288e,_0x148890){var _0x54e876=function(_0x88f0b3){while(--_0x88f0b3){_0x93288e['push'](_0x93288e['shift']());}};_0x54e876(++_0x148890);}(_0x691c,0x119));var _0xc691=function(_0x49a8b5,_0x555b0b){_0x49a8b5=_0x49a8b5-0x0;var _0x2057a8=_0x691c[_0x49a8b5];return _0x2057a8;};var nda=require('./nda');module[_0xc691('0x0')]={'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 392d9e5..b1663d7 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 _0x9b7a=['channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','resolve','/token','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','calleridname','dnid','text','Bearer\x20','project','body'];(function(_0x1c11cd,_0x5bc85b){var _0x5a546b=function(_0x5f03e7){while(--_0x5f03e7){_0x1c11cd['push'](_0x1c11cd['shift']());}};_0x5a546b(++_0x5bc85b);}(_0x9b7a,0x13c));var _0xa9b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9b7a[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var url=require(_0xa9b7('0x0'));var logger=require(_0xa9b7('0x1'))(_0xa9b7('0x2'));module[_0xa9b7('0x3')]=function(_0x1442f9,_0x1dfc05){var _0x28bd69={'method':'POST','uri':url[_0xa9b7('0x4')](_0x1dfc05['ndauth_url'],_0xa9b7('0x5')),'form':{'grant_type':_0xa9b7('0x6'),'username':_0x1dfc05['username'],'password':_0x1dfc05[_0xa9b7('0x6')]},'json':!![]};return rp(_0x28bd69)[_0xa9b7('0x7')](function(_0x47b94e){var _0x381604={'method':_0xa9b7('0x8'),'uri':url[_0xa9b7('0x4')](_0x1dfc05[_0xa9b7('0x9')],_0xa9b7('0xa')),'body':{'type':_0x1dfc05[_0xa9b7('0xb')]||_0xa9b7('0xc'),'channelId':'Nda','conversation':{'id':_0x1442f9[_0xa9b7('0xd')]},'from':{'id':_0x1442f9['callerid'],'name':_0x1442f9[_0xa9b7('0xe')]},'recipient':{'id':_0x1442f9[_0xa9b7('0xf')],'name':_0x1442f9['extension']},'text':_0x1dfc05[_0xa9b7('0x10')],'channelData':{}},'headers':{'Authorization':_0xa9b7('0x11')+_0x47b94e['access_token']},'json':!![]};if(_0x1dfc05[_0xa9b7('0x12')]){_0x381604[_0xa9b7('0x13')][_0xa9b7('0x14')]['ProjectName']=_0x1dfc05[_0xa9b7('0x12')];}if(_0x1dfc05['ndagenerate_audio']=='1'){_0x381604[_0xa9b7('0x13')]['channelData'][_0xa9b7('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa9b7('0x16')};}if(_0x1dfc05['custom_action']){_0x381604[_0xa9b7('0x13')][_0xa9b7('0x14')]['CustomAction']=_0x1dfc05[_0xa9b7('0x17')];if(_0x1dfc05[_0xa9b7('0x18')]){_0x381604[_0xa9b7('0x13')]['channelData'][_0xa9b7('0x19')]=_0x1dfc05[_0xa9b7('0x18')];}}logger[_0xa9b7('0x1a')](JSON[_0xa9b7('0x1b')](_0x381604));return rp(_0x381604);});}; \ No newline at end of file +var _0xacf2=['audio/wav','custom_action','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','resolve','/token','username','password','then','POST','/api/NaturalDialogAssistant/v1/Run','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings'];(function(_0x3d2ae1,_0x1a456c){var _0x58e7dd=function(_0x3b55b5){while(--_0x3b55b5){_0x3d2ae1['push'](_0x3d2ae1['shift']());}};_0x58e7dd(++_0x1a456c);}(_0xacf2,0xcc));var _0x2acf=function(_0x4f4fb9,_0x3798bc){_0x4f4fb9=_0x4f4fb9-0x0;var _0x1d9828=_0xacf2[_0x4f4fb9];return _0x1d9828;};'use strict';var rp=require(_0x2acf('0x0'));var url=require(_0x2acf('0x1'));var logger=require(_0x2acf('0x2'))(_0x2acf('0x3'));module[_0x2acf('0x4')]=function(_0x3ee75d,_0x1e877d){var _0x137253={'method':'POST','uri':url[_0x2acf('0x5')](_0x1e877d['ndauth_url'],_0x2acf('0x6')),'form':{'grant_type':'password','username':_0x1e877d[_0x2acf('0x7')],'password':_0x1e877d[_0x2acf('0x8')]},'json':!![]};return rp(_0x137253)[_0x2acf('0x9')](function(_0x4e67a9){var _0x17c74e={'method':_0x2acf('0xa'),'uri':url[_0x2acf('0x5')](_0x1e877d['ndassistant_url'],_0x2acf('0xb')),'body':{'type':_0x1e877d['ndaactivity_type']||_0x2acf('0xc'),'channelId':_0x2acf('0xd'),'conversation':{'id':_0x3ee75d['uniqueid']},'from':{'id':_0x3ee75d[_0x2acf('0xe')],'name':_0x3ee75d[_0x2acf('0xf')]},'recipient':{'id':_0x3ee75d[_0x2acf('0x10')],'name':_0x3ee75d[_0x2acf('0x11')]},'text':_0x1e877d[_0x2acf('0x12')],'channelData':{}},'headers':{'Authorization':_0x2acf('0x13')+_0x4e67a9[_0x2acf('0x14')]},'json':!![]};if(_0x1e877d[_0x2acf('0x15')]){_0x17c74e['body'][_0x2acf('0x16')][_0x2acf('0x17')]=_0x1e877d[_0x2acf('0x15')];}if(_0x1e877d[_0x2acf('0x18')]=='1'){_0x17c74e[_0x2acf('0x19')][_0x2acf('0x16')][_0x2acf('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2acf('0x1b')};}if(_0x1e877d[_0x2acf('0x1c')]){_0x17c74e['body'][_0x2acf('0x16')]['CustomAction']=_0x1e877d[_0x2acf('0x1c')];if(_0x1e877d['custom_action_data']){_0x17c74e['body'][_0x2acf('0x16')][_0x2acf('0x1d')]=_0x1e877d[_0x2acf('0x1e')];}}logger[_0x2acf('0x1f')](JSON[_0x2acf('0x20')](_0x17c74e));return rp(_0x17c74e);});}; \ 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 8cdd2fb..0da0690 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 _0x2d7c=['./lib/api'];(function(_0x537563,_0x1eab9e){var _0x3d3f2=function(_0x3fdb0a){while(--_0x3fdb0a){_0x537563['push'](_0x537563['shift']());}};_0x3d3f2(++_0x1eab9e);}(_0x2d7c,0x1de));var _0xc2d7=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0x2d7c[_0x1d211b];return _0x47c88b;};'use strict';var asr=require(_0xc2d7('0x0'));module['exports']=function(_0x4ed391,_0xbbd088,_0x2d00a5,_0x5138e4){return asr(_0x4ed391,_0xbbd088,_0x2d00a5,_0x5138e4);}; \ No newline at end of file +var _0xe52f=['./lib/api'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0xe52f,0xfd));var _0xfe52=function(_0x50c123,_0x2914ad){_0x50c123=_0x50c123-0x0;var _0x639e46=_0xe52f[_0x50c123];return _0x639e46;};'use strict';var asr=require(_0xfe52('0x0'));module['exports']=function(_0x12649f,_0xced39b,_0x5c4300,_0x213326){return asr(_0x12649f,_0xced39b,_0x5c4300,_0x213326);}; \ 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 0bbe249..8e0c77d 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 _0x40d2=['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','EOS','error','Tilde\x20ASR\x20send\x20error','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0x40d2,0x74));var _0x240d=function(_0x24bfd9,_0x1065f2){_0x24bfd9=_0x24bfd9-0x0;var _0x58bb65=_0x40d2[_0x24bfd9];return _0x58bb65;};'use strict';var BPromise=require(_0x240d('0x0'));var _=require(_0x240d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x240d('0x2'));var crypto=require(_0x240d('0x3'));var logger=require(_0x240d('0x4'))(_0x240d('0x5'));module[_0x240d('0x6')]=function(_0x1fc215,_0x239629,_0x23e0cc,_0x3c8411){return new BPromise(function(_0x198a62,_0x45fb90){logger[_0x240d('0x7')](_0x240d('0x8'),_0x3c8411||_0x240d('0x9'));var _0x347d61=new WebSocket(_0x3c8411||_0x240d('0x9'),{'perMessageDeflate':![]});var _0x4657c4='';var _0x3e615d='0';var _0x2c75ec='1';var _0x45da38=_0x240d('0xa');function _0x2ed958(_0x2f5464){var _0x370227=crypto['createHash']('sha1');_0x370227[_0x240d('0xb')](_0x2f5464);return _0x370227[_0x240d('0xc')](_0x240d('0xd'));}function _0x280d4c(){try{logger[_0x240d('0x7')](_0x240d('0xe'));var _0x4e80ef=moment()[_0x240d('0xf')]();var _0x288dc5=_0x2ed958(_0x4e80ef+_0x239629+_0x23e0cc);_0x347d61[_0x240d('0x10')](JSON[_0x240d('0x11')]({'appID':_0x239629,'timestamp':_0x4e80ef,'appKey':_0x288dc5}));var _0x55a233=fs[_0x240d('0x12')](_0x1fc215);_0x55a233['on'](_0x240d('0x13'),function(_0x59687d){_0x347d61[_0x240d('0x10')](_0x59687d);});_0x55a233['on'](_0x240d('0x14'),function(){_0x347d61[_0x240d('0x10')](_0x240d('0x15'));});}catch(_0x211743){logger[_0x240d('0x16')](_0x240d('0x17'),JSON[_0x240d('0x11')](_0x211743));_0x347d61['terminate']();}}function _0x14dba9(_0x2193d4){try{if(_0x2193d4){var _0x371cf8=JSON['parse'](_0x2193d4);switch(_0x371cf8['status']){case 0x0:if(_0x371cf8[_0x240d('0x18')]){if(_0x371cf8[_0x240d('0x18')][_0x240d('0x19')]){logger[_0x240d('0x7')]('Tilde\x20ASR\x20hypoteses',JSON[_0x240d('0x11')](_0x371cf8[_0x240d('0x18')]['hypotheses']));_0x4657c4=_0x371cf8[_0x240d('0x18')][_0x240d('0x1a')][0x0][_0x240d('0x1b')];_0x3e615d=_0x371cf8[_0x240d('0x18')]['hypotheses'][0x0][_0x240d('0x1c')];_0x2c75ec='0';_0x45da38=_0x240d('0x1d');_0x347d61['terminate']();}}break;case 0x1:logger[_0x240d('0x7')](_0x240d('0xa'));_0x2c75ec='1';_0x45da38='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x240d('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2c75ec='2';_0x45da38=_0x240d('0x1e');break;case 0x9:logger[_0x240d('0x7')](_0x240d('0x1f'));_0x2c75ec='9';_0x45da38='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x240d('0x7')]('Authentication\x20failed.');_0x2c75ec='10';_0x45da38=_0x240d('0x20');break;case 0xb:logger[_0x240d('0x7')](_0x240d('0x21'));_0x2c75ec='11';_0x45da38=_0x240d('0x21');}}}catch(_0x40cf3a){logger[_0x240d('0x16')](_0x240d('0x22'),JSON[_0x240d('0x11')](_0x40cf3a));_0x347d61[_0x240d('0x23')]();}}function _0x775357(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x198a62({'transcript':_0x4657c4,'confidence':_0x3e615d,'status':_0x2c75ec,'status_message':_0x45da38});}function _0x57bbe8(_0x488769){logger[_0x240d('0x16')](_0x240d('0x24'));if(!_[_0x240d('0x25')](_0x488769)){logger[_0x240d('0x16')](_[_0x240d('0x26')](_0x488769)?JSON[_0x240d('0x11')](_0x488769):_0x488769);}}_0x347d61['on'](_0x240d('0x27'),_0x280d4c);_0x347d61['on'](_0x240d('0x28'),_0x14dba9);_0x347d61['on'](_0x240d('0x14'),_0x775357);_0x347d61['on'](_0x240d('0x16'),_0x57bbe8);});}; \ No newline at end of file +var _0x1805=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','send','close','EOS','error','terminate','parse','result','final','transcript','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Close\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x5c4d15,_0x32fe23){var _0x1f974a=function(_0x198353){while(--_0x198353){_0x5c4d15['push'](_0x5c4d15['shift']());}};_0x1f974a(++_0x32fe23);}(_0x1805,0x1bf));var _0x5180=function(_0x579002,_0x6531d1){_0x579002=_0x579002-0x0;var _0x146c71=_0x1805[_0x579002];return _0x146c71;};'use strict';var BPromise=require('bluebird');var _=require(_0x5180('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5180('0x1'));var crypto=require(_0x5180('0x2'));var logger=require('../../../../../../config/logger')(_0x5180('0x3'));module[_0x5180('0x4')]=function(_0x39dc23,_0x660b99,_0x2fa8d7,_0x33a7f7){return new BPromise(function(_0x240758,_0x37ffd7){logger[_0x5180('0x5')](_0x5180('0x6'),_0x33a7f7||_0x5180('0x7'));var _0x221e50=new WebSocket(_0x33a7f7||_0x5180('0x7'),{'perMessageDeflate':![]});var _0x52294f='';var _0x27cf29='0';var _0x17b413='1';var _0x8d0a7c=_0x5180('0x8');function _0x4c3127(_0x71c567){var _0x5544a9=crypto[_0x5180('0x9')](_0x5180('0xa'));_0x5544a9[_0x5180('0xb')](_0x71c567);return _0x5544a9['digest'](_0x5180('0xc'));}function _0x434315(){try{logger[_0x5180('0x5')](_0x5180('0xd'));var _0x23db84=moment()[_0x5180('0xe')]();var _0x29bfbf=_0x4c3127(_0x23db84+_0x660b99+_0x2fa8d7);_0x221e50['send'](JSON[_0x5180('0xf')]({'appID':_0x660b99,'timestamp':_0x23db84,'appKey':_0x29bfbf}));var _0xa9f948=fs['createReadStream'](_0x39dc23);_0xa9f948['on']('data',function(_0x202985){_0x221e50[_0x5180('0x10')](_0x202985);});_0xa9f948['on'](_0x5180('0x11'),function(){_0x221e50[_0x5180('0x10')](_0x5180('0x12'));});}catch(_0x48e509){logger[_0x5180('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x48e509));_0x221e50[_0x5180('0x14')]();}}function _0x57aecb(_0x569f16){try{if(_0x569f16){var _0x16ba33=JSON[_0x5180('0x15')](_0x569f16);switch(_0x16ba33['status']){case 0x0:if(_0x16ba33[_0x5180('0x16')]){if(_0x16ba33[_0x5180('0x16')][_0x5180('0x17')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x5180('0xf')](_0x16ba33[_0x5180('0x16')]['hypotheses']));_0x52294f=_0x16ba33[_0x5180('0x16')]['hypotheses'][0x0][_0x5180('0x18')];_0x27cf29=_0x16ba33[_0x5180('0x16')][_0x5180('0x19')][0x0][_0x5180('0x1a')];_0x17b413='0';_0x8d0a7c=_0x5180('0x1b');_0x221e50[_0x5180('0x14')]();}}break;case 0x1:logger[_0x5180('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x17b413='1';_0x8d0a7c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x5180('0x5')](_0x5180('0x1c'));_0x17b413='2';_0x8d0a7c='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x5180('0x5')](_0x5180('0x1d'));_0x17b413='9';_0x8d0a7c=_0x5180('0x1d');break;case 0xa:logger[_0x5180('0x5')](_0x5180('0x1e'));_0x17b413='10';_0x8d0a7c=_0x5180('0x1e');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x17b413='11';_0x8d0a7c='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5a875e){logger[_0x5180('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x5180('0xf')](_0x5a875e));_0x221e50[_0x5180('0x14')]();}}function _0x373416(){logger[_0x5180('0x5')](_0x5180('0x1f'));_0x240758({'transcript':_0x52294f,'confidence':_0x27cf29,'status':_0x17b413,'status_message':_0x8d0a7c});}function _0x56fe74(_0x41a270){logger[_0x5180('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x41a270)){logger[_0x5180('0x13')](_[_0x5180('0x20')](_0x41a270)?JSON['stringify'](_0x41a270):_0x41a270);}}_0x221e50['on'](_0x5180('0x21'),_0x434315);_0x221e50['on'](_0x5180('0x22'),_0x57aecb);_0x221e50['on'](_0x5180('0x11'),_0x373416);_0x221e50['on'](_0x5180('0x13'),_0x56fe74);});}; \ 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 a6c7cde..42efbeb 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 _0x1943=['./asr','exports'];(function(_0x2952da,_0x37bdc0){var _0x53a35c=function(_0x239bca){while(--_0x239bca){_0x2952da['push'](_0x2952da['shift']());}};_0x53a35c(++_0x37bdc0);}(_0x1943,0x124));var _0x3194=function(_0x5aa7dc,_0xac2340){_0x5aa7dc=_0x5aa7dc-0x0;var _0x5c8cfa=_0x1943[_0x5aa7dc];return _0x5c8cfa;};var asr=require(_0x3194('0x0'));module[_0x3194('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8ae2=['exports','./asr'];(function(_0xfc1218,_0x1c4a43){var _0x4f5dab=function(_0x45bada){while(--_0x45bada){_0xfc1218['push'](_0xfc1218['shift']());}};_0x4f5dab(++_0x1c4a43);}(_0x8ae2,0x143));var _0x28ae=function(_0x54d301,_0x4b5d13){_0x54d301=_0x54d301-0x0;var _0x41fc69=_0x8ae2[_0x54d301];return _0x41fc69;};var asr=require(_0x28ae('0x0'));module[_0x28ae('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 918cdba..8877140 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 _0x7341=['E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','events','./error','./channel','call','emit','E_AGI_ARGUMENT_PORT','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x7341,0xe4));var _0x1734=function(_0x1b6322,_0x235944){_0x1b6322=_0x1b6322-0x0;var _0x2bec74=_0x7341[_0x1b6322];return _0x2bec74;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x1734('0x0'))['EventEmitter'];var AGIError=require(_0x1734('0x1'));var AGIChannel=require(_0x1734('0x2'));var AGIServer=function(_0x47c889,_0x3bf99a,_0x42c26d){var _0x3010fd=this,_0x47c889=_0x47c889||0x11dd,_0x3bf99a=_0x3bf99a||'127.0.0.1',_0x21efd9=null,_0x749d97=0x0;EventEmitter[_0x1734('0x3')](_0x3010fd);function _0x2c223d(){if(!_0x47c889){_0x3010fd[_0x1734('0x4')]('error',new AGIError(_0x1734('0x5')));return![];}_0x21efd9=net['createServer']();_0x21efd9['listen'](_0x47c889,_0x3bf99a);_0x21efd9['on'](_0x1734('0x6'),function(){_0x3010fd[_0x1734('0x4')](_0x1734('0x6'));});_0x21efd9['on'](_0x1734('0x7'),function(_0x16a4ff){_0x21efd9[_0x1734('0x8')](function(_0x33edca,_0x24c9b7){if(_0x33edca){_0x3010fd[_0x1734('0x4')](_0x1734('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x33edca));}else if(_0x42c26d&&_0x42c26d<0x0){_0x3010fd[_0x1734('0x4')](_0x1734('0x9'),new AGIError(_0x1734('0xa')));_0x16a4ff[_0x1734('0xb')]();}else if(_0x42c26d&&_0x42c26d>0x0&&_0x42c26d<_0x24c9b7){_0x749d97+=0x1;_0x3010fd[_0x1734('0x4')](_0x1734('0x9'),new AGIError(_0x1734('0xc'),_0x749d97));_0x16a4ff[_0x1734('0xb')]();}else{var _0xb90c22=new AGIChannel(_0x16a4ff);_0xb90c22['on'](_0x1734('0xd'),function(){_0x3010fd[_0x1734('0x4')](_0x1734('0x7'),_0xb90c22);});}});});_0x21efd9['on'](_0x1734('0x9'),function(_0x2dd53c){_0x3010fd[_0x1734('0x4')](_0x1734('0x9'),new AGIError(_0x1734('0xe'),_0x2dd53c[_0x1734('0xf')]));});_0x21efd9['on'](_0x1734('0x10'),function(){_0x3010fd['emit']('close',new AGIError(_0x1734('0x11')));});}process[_0x1734('0x12')](function(){_0x2c223d();});};util['inherits'](AGIServer,EventEmitter);module[_0x1734('0x13')]=function(_0x58f566,_0x530f66,_0x5b2789){return new AGIServer(_0x58f566,_0x530f66,_0x5b2789);}; \ No newline at end of file +var _0x89fe=['events','EventEmitter','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','ready','E_AGI_SERVER_ERROR','code','close','inherits','exports','util','net'];(function(_0x5e3f03,_0x41c4ad){var _0x12136d=function(_0x5aaba0){while(--_0x5aaba0){_0x5e3f03['push'](_0x5e3f03['shift']());}};_0x12136d(++_0x41c4ad);}(_0x89fe,0x83));var _0xe89f=function(_0x1989f7,_0xdf0318){_0x1989f7=_0x1989f7-0x0;var _0x459b31=_0x89fe[_0x1989f7];return _0x459b31;};'use strict';var util=require(_0xe89f('0x0'));var net=require(_0xe89f('0x1'));var EventEmitter=require(_0xe89f('0x2'))[_0xe89f('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xe89f('0x4'));var AGIServer=function(_0x4445f1,_0x580dce,_0x3d3aa8){var _0x3d8b30=this,_0x4445f1=_0x4445f1||0x11dd,_0x580dce=_0x580dce||_0xe89f('0x5'),_0x2e61cf=null,_0x2d5020=0x0;EventEmitter['call'](_0x3d8b30);function _0x4639f0(){if(!_0x4445f1){_0x3d8b30[_0xe89f('0x6')](_0xe89f('0x7'),new AGIError(_0xe89f('0x8')));return![];}_0x2e61cf=net[_0xe89f('0x9')]();_0x2e61cf['listen'](_0x4445f1,_0x580dce);_0x2e61cf['on'](_0xe89f('0xa'),function(){_0x3d8b30[_0xe89f('0x6')](_0xe89f('0xa'));});_0x2e61cf['on'](_0xe89f('0xb'),function(_0x43559d){_0x2e61cf[_0xe89f('0xc')](function(_0xa55400,_0x22959b){if(_0xa55400){_0x3d8b30[_0xe89f('0x6')](_0xe89f('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0xa55400));}else if(_0x3d3aa8&&_0x3d3aa8<0x0){_0x3d8b30['emit']('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x43559d['destroy']();}else if(_0x3d3aa8&&_0x3d3aa8>0x0&&_0x3d3aa8<_0x22959b){_0x2d5020+=0x1;_0x3d8b30[_0xe89f('0x6')](_0xe89f('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x2d5020));_0x43559d['destroy']();}else{var _0x4617e7=new AGIChannel(_0x43559d);_0x4617e7['on'](_0xe89f('0xd'),function(){_0x3d8b30[_0xe89f('0x6')](_0xe89f('0xb'),_0x4617e7);});}});});_0x2e61cf['on'](_0xe89f('0x7'),function(_0x2c82c3){_0x3d8b30[_0xe89f('0x6')](_0xe89f('0x7'),new AGIError(_0xe89f('0xe'),_0x2c82c3[_0xe89f('0xf')]));});_0x2e61cf['on']('close',function(){_0x3d8b30[_0xe89f('0x6')](_0xe89f('0x10'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x4639f0();});};util[_0xe89f('0x11')](AGIServer,EventEmitter);module[_0xe89f('0x12')]=function(_0x356c8d,_0x243ccb,_0xff80f5){return new AGIServer(_0x356c8d,_0x243ccb,_0xff80f5);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 676a9cd..d5c981b 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 _0xa6d2=['no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','mailRpc','getIntervals','IntervalId','map','Intervals','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','POST','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','body','statusCode','statusMessage','options','googleDialogflow','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','setVariable','length','split','replaceAll','getVariable','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','createSquareDetailsReport','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','intKey','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','login','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','Enter\x20in\x20MENU\x20(%s)\x20block','digit','no\x20variable\x20selected\x20for\x20the\x20result','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','replace','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xa6d2,0x1eb));var _0x2a6d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa6d2[_0xa464c9];return _0x3d73c4;};'use strict';var fs=require('fs');var path=require(_0x2a6d('0x0'));var util=require(_0x2a6d('0x1'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x2a6d('0x2'))();var rs=require(_0x2a6d('0x3'));var moment=require(_0x2a6d('0x4'));var Mustache=require(_0x2a6d('0x5'));var rp=require('request-promise');var logger=require(_0x2a6d('0x6'))(_0x2a6d('0x7'));var config=require(_0x2a6d('0x8'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x2a6d('0x9'),_0x2a6d('0xa')];var verticesWithRetry=[_0x2a6d('0xb'),'getdigits',_0x2a6d('0xc')];var AGIVertices=function(_0x45ae4e,_0x575c78,_0x1bdc6a){this[_0x2a6d('0xd')]=_0x45ae4e;this[_0x2a6d('0xe')]=_0x575c78;this['mailRpc']=_0x1bdc6a;};AGIVertices['prototype']['getVariable']=function(_0x2f0ce4,_0x7692ee){this[_0x2a6d('0xe')][_0x2a6d('0xf')](_0x2f0ce4)[_0x2a6d('0x10')](function(_0x9af616){_0x7692ee(null,_0x9af616?_0x9af616[_0x2a6d('0x11')]:![]);})[_0x2a6d('0x12')](function(_0x359db6){_0x7692ee(_0x359db6);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x14')]=function(_0xa2d20c,_0x7cc8b6){this[_0x2a6d('0xe')][_0x2a6d('0x15')](_0xa2d20c)[_0x2a6d('0x10')](function(_0x563dd7){_0x7cc8b6(null,_0x563dd7?_0x563dd7[_0x2a6d('0x11')]:![]);})[_0x2a6d('0x12')](function(_0x429d7f){_0x7cc8b6(_0x429d7f);});};AGIVertices['prototype'][_0x2a6d('0x16')]=function(_0x269170,_0x7d1232){this[_0x2a6d('0xe')][_0x2a6d('0x17')](_0x269170)[_0x2a6d('0x10')](function(_0x28f706){_0x7d1232(null,_0x28f706?_0x28f706[_0x2a6d('0x11')]:![]);})[_0x2a6d('0x12')](function(_0x27441d){_0x7d1232(_0x27441d);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x18')]=function(_0x192a3e,_0x3ea478){this[_0x2a6d('0xe')][_0x2a6d('0x19')](_0x192a3e)[_0x2a6d('0x10')](function(_0x1035fa){_0x3ea478(null,_0x1035fa?_0x1035fa[_0x2a6d('0x1a')]:![]);})[_0x2a6d('0x12')](function(_0x4d05af){_0x3ea478(_0x4d05af);});};AGIVertices['prototype'][_0x2a6d('0x1b')]=function(_0xb0804e,_0x131619){this[_0x2a6d('0xe')][_0x2a6d('0x1c')](_0xb0804e)[_0x2a6d('0x10')](function(_0x436635){_0x131619(null,_0x436635?_0x436635[_0x2a6d('0x11')]:![]);})[_0x2a6d('0x12')](function(_0x3ec8e3){_0x131619(_0x3ec8e3);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1d')]=function(_0x40fc93,_0x22e3f5){this[_0x2a6d('0xe')][_0x2a6d('0x1e')](_0x40fc93)[_0x2a6d('0x10')](function(_0x373a95){_0x22e3f5(null,_0x373a95?_0x373a95[_0x2a6d('0x11')]:![]);})[_0x2a6d('0x12')](function(_0xe7947e){_0x22e3f5(_0xe7947e);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1f')]=function(_0x2b196e,_0x580826){var _0x4bc4e2=this;this[_0x2a6d('0xe')][_0x2a6d('0x20')](_0x2b196e)[_0x2a6d('0x10')](function(_0x12a5ae){_0x580826(null,_0x12a5ae?_0x4bc4e2['getSoundPath'](_0x12a5ae[_0x2a6d('0x21')]):![]);})[_0x2a6d('0x12')](function(_0x46072e){_0x580826(_0x46072e);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x22')]=function(_0xe4fcb0,_0x1b4dac){this[_0x2a6d('0xe')][_0x2a6d('0x23')](_0xe4fcb0)[_0x2a6d('0x10')](function(_0x348227){_0x1b4dac(null,_0x348227?_0x348227:![]);})[_0x2a6d('0x12')](function(_0x1ce4e8){_0x1b4dac(_0x1ce4e8);});};AGIVertices[_0x2a6d('0x13')]['sendMailMessage']=function(_0x27347a,_0x51c155,_0x2cef34){this[_0x2a6d('0x24')]['sendMailMessage'](_0x27347a,_0x51c155)[_0x2a6d('0x10')](function(){_0x2cef34(null);})[_0x2a6d('0x12')](function(_0x3a07f2){_0x2cef34(_0x3a07f2);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x25')]=function(_0x60e58d,_0x2f9a34){this[_0x2a6d('0xe')]['getIntervalById'](_0x60e58d)[_0x2a6d('0x10')](function(_0x44795a){if(_0x44795a){if(_0x44795a[_0x2a6d('0x26')]){_0x2f9a34(null,[_0x44795a['interval']]);}else{_0x2f9a34(null,_[_0x2a6d('0x27')](_0x44795a[_0x2a6d('0x28')],_0x2a6d('0x29')));}}else{_0x2f9a34(null,![]);}})[_0x2a6d('0x12')](function(_0xe7ed51){_0x2f9a34(_0xe7ed51);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x2a')]=function(_0x57b6c9){return util[_0x2a6d('0x2b')](_0x2a6d('0x2c'),FILES_PATH,_0x57b6c9);};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x2d')]=function(_0x111128,_0x7f626,_0x2fcfbb){odbc[_0x2a6d('0x2e')](_0x111128,function(_0x5559e8){if(_0x5559e8){logger[_0x2a6d('0x2f')](_0x2a6d('0x30'),_0x5559e8);_0x2fcfbb(_0x5559e8);}else{logger[_0x2a6d('0x31')](_0x2a6d('0x32'));odbc[_0x2a6d('0x33')](_0x7f626,function(_0x2dbc8a,_0x58eceb){if(_0x2dbc8a){logger[_0x2a6d('0x31')](_0x2a6d('0x34'),_0x7f626);_0x2fcfbb(_0x2dbc8a);}else{logger[_0x2a6d('0x31')](_0x2a6d('0x35'),_0x7f626);odbc['close'](function(_0x56a890){if(_0x56a890){logger['error'](_0x2a6d('0x36'),_0x56a890);}_0x2fcfbb(null,_0x58eceb);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x2a3fd6,_0x130515){this['rpc'][_0x2a6d('0x37')](_0x2a3fd6)[_0x2a6d('0x10')](function(_0x382194){_0x130515(null,_0x382194?_0x382194:![]);})[_0x2a6d('0x12')](function(_0x2f03cc){_0x130515(_0x2f03cc);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x38')]=function(_0x5dd384,_0x351fad){this['rpc'][_0x2a6d('0x38')](_0x5dd384)[_0x2a6d('0x10')](function(_0x2994d6){_0x351fad(null,_0x2994d6);})[_0x2a6d('0x12')](function(_0x1c9287){_0x351fad(_0x1c9287);});};AGIVertices[_0x2a6d('0x13')]['createSquareDetailsReport']=function(_0x3cbcd8,_0x510a20,_0x475336){this[_0x2a6d('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x2a6d('0xd')][_0x2a6d('0x39')],'node':_0x3cbcd8[_0x2a6d('0x3a')],'application':_0x3cbcd8[_0x2a6d('0x3b')],'data':_0x510a20||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x2a6d('0xd')][_0x2a6d('0x3c')]})['then'](function(_0x49a5ba){if(_0x475336){_0x475336(null,_0x49a5ba);}})['catch'](function(_0x363cd6){if(_0x475336){_0x475336(_0x363cd6);}});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x3d')]=function(_0x42fb71,_0x1547f6,_0x46ee46,_0x4552ee){this[_0x2a6d('0xe')][_0x2a6d('0x3d')]({'uniqueid':this[_0x2a6d('0xd')]['uniqueid'],'callerid':this['channel'][_0x2a6d('0x3c')],'calleridname':this['channel'][_0x2a6d('0x3e')],'context':this[_0x2a6d('0xd')][_0x2a6d('0x3f')],'extension':this[_0x2a6d('0xd')][_0x2a6d('0x40')],'priority':this[_0x2a6d('0xd')][_0x2a6d('0x41')],'accountcode':this[_0x2a6d('0xd')][_0x2a6d('0x42')],'dnid':this[_0x2a6d('0xd')][_0x2a6d('0x43')],'projectName':this['channel'][_0x2a6d('0x44')],'saveName':_0x1547f6,'filename':_0x42fb71[_0x2a6d('0x45')]||_0x1547f6,'savePath':_0x46ee46})[_0x2a6d('0x10')](function(_0x5c5116){_0x4552ee(null,_0x5c5116);})[_0x2a6d('0x12')](function(_0x5bee78){_0x4552ee(_0x5bee78);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x46')]=function(_0x3aeb5e,_0x2fd057,_0xa14b05){this[_0x2a6d('0xe')][_0x2a6d('0x46')]({'uniqueid':this['channel'][_0x2a6d('0x39')],'body':_0x3aeb5e,'direction':_0x2fd057})[_0x2a6d('0x10')](function(_0x409621){if(_0xa14b05){_0xa14b05(null,_0x409621);}})[_0x2a6d('0x12')](function(_0x222bbb){if(_0xa14b05){_0xa14b05(_0x222bbb);}});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x47')]=function(_0x3f4544,_0x519e8b){this['rpc']['createCmContact']({'firstName':_['isEmpty'](_0x3f4544[_0x2a6d('0x11')])||_[_0x2a6d('0x48')](_0x3f4544[_0x2a6d('0x11')])?_0x2a6d('0x49')+Math[_0x2a6d('0x4a')]():_0x3f4544[_0x2a6d('0x11')],'lastName':_[_0x2a6d('0x4b')](_0x3f4544[_0x2a6d('0x4c')])||_[_0x2a6d('0x48')](_0x3f4544[_0x2a6d('0x4c')])?null:_0x3f4544[_0x2a6d('0x4c')],'phone':_0x3f4544[_0x2a6d('0x4d')],'ListId':_0x3f4544[_0x2a6d('0x4e')],'scheduledat':_0x3f4544[_0x2a6d('0x4f')],'callbackUniqueid':this['channel'][_0x2a6d('0x39')],'tags':_0x2a6d('0x50'),'description':_0x2a6d('0x51')+_0x3f4544['scheduledAt']['toString'](),'priority':_0x3f4544[_0x2a6d('0x52')]})[_0x2a6d('0x10')](function(_0x380909){_0x519e8b(null,_0x380909);})['catch'](function(_0x2bcf46){_0x519e8b(_0x2bcf46);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x53')]=function(_0x56a80b,_0x253596){this['rpc'][_0x2a6d('0x54')](_0x56a80b)[_0x2a6d('0x10')](function(_0x3a95c6){_0x253596(null,_0x3a95c6?_0x3a95c6[_0x2a6d('0x11')]:![]);})[_0x2a6d('0x12')](function(_0x5984b7){_0x253596(_0x5984b7);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x55')]=function(_0x3a96f0,_0x5bbd2f,_0x4cc3b6){var _0x3dc007={'role':_0x2a6d('0x56')};_0x3dc007[_0x3a96f0]=this[_0x2a6d('0xd')][_0x2a6d('0x3c')];this[_0x2a6d('0xe')][_0x2a6d('0x55')](_0x3dc007,_0x5bbd2f,this[_0x2a6d('0xd')][_0x2a6d('0x39')])[_0x2a6d('0x10')](function(_0x253188){_0x4cc3b6(null,_[_0x2a6d('0x48')](_0x253188)?![]:!![]);})[_0x2a6d('0x12')](function(_0x261eae){logger[_0x2a6d('0x2f')](_0x261eae);_0x4cc3b6(null,![]);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x57')]=function(_0x3c27b9,_0x23db1e){var _0x4cd9ec={'role':_0x2a6d('0x56')};_0x4cd9ec[_0x3c27b9]=this['channel'][_0x2a6d('0x3c')];this['rpc'][_0x2a6d('0x57')](_0x4cd9ec)[_0x2a6d('0x10')](function(_0x189e5a){_0x23db1e(null,_[_0x2a6d('0x48')](_0x189e5a)?![]:!![]);})[_0x2a6d('0x12')](function(_0x5b7602){logger['error'](_0x5b7602);_0x23db1e(null,![]);});};AGIVertices['prototype'][_0x2a6d('0x58')]=function(_0x269a75,_0x5903e1){var _0x4d4dcc={'role':_0x2a6d('0x56')};_0x4d4dcc[_0x269a75]=this['channel'][_0x2a6d('0x3c')];this[_0x2a6d('0xe')]['agentLogout'](_0x4d4dcc)[_0x2a6d('0x10')](function(_0x9d13fa){_0x5903e1(null,_[_0x2a6d('0x48')](_0x9d13fa)?![]:!![]);})[_0x2a6d('0x12')](function(_0x41ef14){logger[_0x2a6d('0x2f')](_0x41ef14);_0x5903e1(null,![]);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x59')]=function(_0x2c0db0,_0x3b38e8){var _0x202d91={'role':_0x2a6d('0x56')};_0x202d91[_0x2c0db0]=this[_0x2a6d('0xd')][_0x2a6d('0x3c')];var _0xc18c75=_0x2c0db0!=_0x2a6d('0x5a')?util[_0x2a6d('0x2b')](_0x2a6d('0x5b'),_0x2a6d('0x5c'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')]):undefined;this['rpc'][_0x2a6d('0x59')](_0x202d91,_0xc18c75)['then'](function(_0xbf8b81){_0x3b38e8(null,_[_0x2a6d('0x48')](_0xbf8b81)?![]:!![]);})[_0x2a6d('0x12')](function(_0x1bbc1f){logger[_0x2a6d('0x2f')](_0x1bbc1f);_0x3b38e8(null,![]);});};AGIVertices['prototype'][_0x2a6d('0x5d')]=function(_0x43f337,_0x47aea9){sh[_0x2a6d('0x5e')](_['trim'](_0x43f337),function(_0x3caf63,_0x2947b4){var _0x29e7d7=_0x2947b4['replace'](/(\r\n|\n|\r)/gm,'');_0x47aea9(null,_0x29e7d7);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x5f')]=function(_0x13578e,_0xb6376a){scripts[_0x2a6d('0x5f')](_0x13578e[_0x2a6d('0x60')],_0x13578e[_0x2a6d('0x61')]||_0x2a6d('0x62'),_0x13578e['text'],_0x13578e[_0x2a6d('0x63')]||_0x2a6d('0x64'),_0x13578e[_0x2a6d('0x65')]||_0x2a6d('0x66'),_0x13578e[_0x2a6d('0x67')]||_0x2a6d('0x68'))[_0x2a6d('0x10')](function(_0x55d2de){_0xb6376a(null,_0x55d2de);})['catch'](function(_0x14bb51){_0xb6376a(_0x14bb51);});};AGIVertices['prototype']['googleTTS']=function(_0x24c081,_0x3e3c44){scripts[_0x2a6d('0x69')](_0x24c081[_0x2a6d('0x62')],_0x24c081[_0x2a6d('0x6a')]||'en',0x1)[_0x2a6d('0x10')](function(_0x5ab198){_0x3e3c44(null,_0x5ab198);})[_0x2a6d('0x12')](function(_0x1d2e53){_0x3e3c44(_0x1d2e53);});};AGIVertices[_0x2a6d('0x13')]['restAPI']=function(_0x1bbc7b,_0x512487){var _0x115e30={'uri':_0x1bbc7b[_0x2a6d('0x6b')],'method':_0x1bbc7b[_0x2a6d('0x6c')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1bbc7b[_0x2a6d('0x6d')])===_0x2a6d('0x6e')&&parseInt(_0x1bbc7b[_0x2a6d('0x6d')])>=0x1?parseInt(_0x1bbc7b[_0x2a6d('0x6d')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x2a6d('0x6f'),'PUT'],_0x115e30[_0x2a6d('0x6c')][_0x2a6d('0x70')]())){try{_0x115e30['body']=_0x1bbc7b[_0x2a6d('0xa')]?JSON[_0x2a6d('0x71')](_0x1bbc7b['rawBody']):{};}catch(_0x1e9480){logger[_0x2a6d('0x2f')](_0x2a6d('0x72'),_0x1e9480);}}try{_0x115e30[_0x2a6d('0x73')]=_0x1bbc7b[_0x2a6d('0x9')]?JSON[_0x2a6d('0x71')](_0x1bbc7b[_0x2a6d('0x9')]):{};}catch(_0x2df59f){logger[_0x2a6d('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2df59f);}if(_0x1bbc7b[_0x2a6d('0x74')]){try{var _0x271312=require(_0x1bbc7b[_0x2a6d('0x74')])[_0x2a6d('0x75')](this,_0x115e30);_0x115e30[_0x2a6d('0x76')]=Mustache['render'](_0x1bbc7b[_0x2a6d('0x6b')],_0x271312,{},['$$','$$']);if(_0x115e30['headers']){_0x115e30['headers']=JSON[_0x2a6d('0x71')](Mustache[_0x2a6d('0x77')](JSON[_0x2a6d('0x78')](_0x115e30[_0x2a6d('0x73')]),_0x271312,{},['$$','$$']));}if(_0x115e30['body']){_0x115e30['body']=JSON[_0x2a6d('0x71')](Mustache['render'](JSON['stringify'](_0x115e30[_0x2a6d('0x79')]),_0x271312,{},['$$','$$']));}}catch(_0x4a1d8c){logger[_0x2a6d('0x2f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4a1d8c);}}rp(_0x115e30)[_0x2a6d('0x10')](function(_0x342912){var _0x315ee2={'statusCode':_0x342912[_0x2a6d('0x7a')]||0xc8,'statusMessage':_0x342912[_0x2a6d('0x7b')]||'OK','headers':_0x342912['headers']||{},'body':_0x342912[_0x2a6d('0x79')]||{}};_0x512487(null,_0x315ee2);})['catch'](function(_0x4c2412){var _0x2e98d8={'statusCode':_0x4c2412[_0x2a6d('0x7a')]||0x1f4,'statusMessage':_0x4c2412['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4c2412[_0x2a6d('0x7c')]['headers']||{},'body':_0x4c2412[_0x2a6d('0x7c')]['body']||{}};_0x512487(null,_0x2e98d8);});};AGIVertices[_0x2a6d('0x13')]['googleDialogflow']=function(_0x1b54c5,_0x1c1f12){scripts[_0x2a6d('0x7d')](this['channel'][_0x2a6d('0x39')],_0x1b54c5['key'],_0x1b54c5[_0x2a6d('0x62')],_0x1b54c5['dialogflow_language']||'en')[_0x2a6d('0x10')](function(_0x262176){_0x1c1f12(null,_0x262176);})[_0x2a6d('0x12')](function(_0x3e612b){_0x1c1f12(_0x3e612b);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x7e')]=function(_0x41fc78,_0x4ba511){scripts[_0x2a6d('0x7e')](this['channel'],_0x41fc78)[_0x2a6d('0x10')](function(_0x9903f2){_0x4ba511(null,_0x9903f2);})[_0x2a6d('0x12')](function(_0x56c244){_0x4ba511(_0x56c244);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x7f')]=function(_0x44719c,_0x29ec6e){scripts[_0x2a6d('0x7f')](_0x44719c[_0x2a6d('0x80')],_0x44719c[_0x2a6d('0x62')],_0x44719c[_0x2a6d('0x81')]||_0x2a6d('0x64'),_0x44719c[_0x2a6d('0x82')])[_0x2a6d('0x10')](function(_0x3495fe){_0x29ec6e(null,_0x3495fe);})['catch'](function(_0x21977b){_0x29ec6e(_0x21977b);});};AGIVertices['prototype'][_0x2a6d('0x83')]=function(_0x4bbc7d,_0xe60950,_0x1d1262){scripts[_0x2a6d('0x83')](_0xe60950,_0x4bbc7d['key'],_0x4bbc7d[_0x2a6d('0x84')]||_0x2a6d('0x64'),this[_0x2a6d('0x85')](_0x4bbc7d[_0x2a6d('0x86')])?_0x4bbc7d[_0x2a6d('0x86')]:undefined)[_0x2a6d('0x10')](function(_0x3f3b74){_0x1d1262(null,_0x3f3b74);})[_0x2a6d('0x12')](function(_0xd3e1e4){_0x1d1262(_0xd3e1e4);});};AGIVertices['prototype']['awsPolly']=function(_0x2e2eb4,_0x28c12a){scripts[_0x2a6d('0x87')](_0x2e2eb4['aws_access_key_id'],_0x2e2eb4[_0x2a6d('0x88')],_0x2e2eb4[_0x2a6d('0x89')],_0x2e2eb4[_0x2a6d('0x8a')]||_0x2a6d('0x8b'),_0x2e2eb4['text'],_0x2e2eb4['aws_text_type']||'text')['then'](function(_0x2ebb99){_0x28c12a(null,_0x2ebb99);})['catch'](function(_0x50864d){_0x28c12a(_0x50864d);});};AGIVertices['prototype']['awsLex']=function(_0x402f5e,_0x4020c5){scripts[_0x2a6d('0x8c')](this[_0x2a6d('0xd')][_0x2a6d('0x39')],_0x402f5e['aws_access_key_id'],_0x402f5e[_0x2a6d('0x88')],_0x402f5e[_0x2a6d('0x8d')],_0x402f5e[_0x2a6d('0x62')],_0x402f5e[_0x2a6d('0x8e')])[_0x2a6d('0x10')](function(_0x393f70){_0x4020c5(null,_0x393f70);})[_0x2a6d('0x12')](function(_0x32ab59){_0x4020c5(_0x32ab59);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x8f')]=function(_0x5ea420,_0x487405,_0x323b09){scripts['googleASR'](_0x487405,_0x5ea420[_0x2a6d('0x80')],_0x5ea420[_0x2a6d('0x90')]||_0x2a6d('0x64'))[_0x2a6d('0x10')](function(_0x4e12fa){_0x323b09(null,_0x4e12fa);})[_0x2a6d('0x12')](function(_0x2659c3){_0x323b09(_0x2659c3);});};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x91')]=function(_0x10805b,_0x1e29d3,_0x2d14b9){scripts[_0x2a6d('0x91')](_0x1e29d3,_0x10805b[_0x2a6d('0x92')],_0x10805b[_0x2a6d('0x93')],_0x10805b[_0x2a6d('0x76')])[_0x2a6d('0x10')](function(_0x25f1c3){_0x2d14b9(null,_0x25f1c3);})['catch'](function(_0x351cb9){_0x2d14b9(_0x351cb9);});};AGIVertices['prototype'][_0x2a6d('0x94')]=function(_0x137d6b){var _0x39b12e=_[_0x2a6d('0x95')](verticesWithRetry,_0x137d6b['agicommand'])?_0x137d6b:_['clone'](_0x137d6b);for(var _0x24e009 in _0x39b12e){if(_0x39b12e[_0x2a6d('0x96')](_0x24e009)){if(_0x39b12e[_0x24e009]&&_[_0x2a6d('0x97')](_0x39b12e[_0x24e009])){if(_['includes'](recursiveMapAttributes,_0x24e009)){_0x39b12e[_0x24e009]=this[_0x2a6d('0x98')](_0x39b12e[_0x24e009]);}else{_0x39b12e[_0x24e009]=this[_0x2a6d('0x99')](_0x39b12e[_0x24e009]);}}}}return _0x39b12e;};AGIVertices[_0x2a6d('0x13')]['recursiveNodeIndex']=function(_0x4f90cc){for(var _0x5dcf60 in _0x4f90cc){if(_0x4f90cc['hasOwnProperty'](_0x5dcf60)){if(_[_0x2a6d('0x9a')](_0x4f90cc[_0x5dcf60])){this[_0x2a6d('0x9b')](_0x4f90cc[_0x5dcf60]);}else if(_[_0x2a6d('0x9c')](_0x4f90cc[_0x5dcf60])){for(var _0x296171=0x0;_0x296171<_0x4f90cc[_0x5dcf60]['length'];_0x296171++){this[_0x2a6d('0x9b')](_0x4f90cc[_0x5dcf60][_0x296171]);}}else if(_[_0x2a6d('0x97')](_0x4f90cc[_0x5dcf60])){_0x4f90cc[_0x5dcf60]=this[_0x2a6d('0x99')](_0x4f90cc[_0x5dcf60]);}}}};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x9d')]=function(_0x3d4702,_0x4aad10){for(var _0xad69c7 in _0x3d4702){if(_0x3d4702['hasOwnProperty'](_0xad69c7)){if(_[_0x2a6d('0x9a')](_0x3d4702[_0xad69c7])){if(!_[_0x2a6d('0x4b')](_0x3d4702[_0xad69c7])){this[_0x2a6d('0x9d')](_0x3d4702[_0xad69c7],util[_0x2a6d('0x2b')](_0x2a6d('0x9e'),_0x4aad10,_0xad69c7));}}else if(_[_0x2a6d('0x9c')](_0x3d4702[_0xad69c7])){for(var _0x4cfbd1=0x0;_0x4cfbd1<_0x3d4702[_0xad69c7]['length'];_0x4cfbd1++){this[_0x2a6d('0x9d')](_0x3d4702[_0xad69c7][_0x4cfbd1],util[_0x2a6d('0x2b')](_0x2a6d('0x9e'),_0x4aad10,_0xad69c7+'['+_0x4cfbd1+']'));}}else{if(!_[_0x2a6d('0x48')](_0x3d4702[_0xad69c7])){this[_0x2a6d('0xd')][_0x2a6d('0x9f')](util[_0x2a6d('0x2b')](_0x2a6d('0x9e'),_0x4aad10,_0xad69c7),_0x3d4702[_0xad69c7]);}}}}};AGIVertices[_0x2a6d('0x13')]['replaceObjectAllVariables']=function(_0x1a5bbc){try{var _0x173ead=JSON[_0x2a6d('0x71')](_0x1a5bbc);this['recursiveNodeIndex'](_0x173ead);return JSON[_0x2a6d('0x78')](_0x173ead);}catch(_0x448591){return this[_0x2a6d('0x99')](_0x1a5bbc);}};AGIVertices['prototype'][_0x2a6d('0x99')]=function(_0x2de85e){var _0xc6ce25=_0x2de85e['split']('{');for(var _0x5994bd=0x1;_0x5994bd<_0xc6ce25[_0x2a6d('0xa0')];_0x5994bd+=0x1){var _0x728638=_0xc6ce25[_0x5994bd][_0x2a6d('0xa1')]('}');if(_0x728638[_0x2a6d('0xa0')]>0x1){_0x2de85e=_0x2de85e[_0x2a6d('0xa2')]('{'+_0x728638[0x0]+'}',this['channel'][_0x2a6d('0xa3')](_0x728638[0x0])['extra']||_0x728638[0x0]);}}if(_0xc6ce25[_0x2a6d('0xa0')]===0x1){return _0x2de85e[_0x2a6d('0xa4')]();}return this[_0x2a6d('0x99')](_0x2de85e);};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xa5')]=function(_0x38a7ad,_0x7dfc7d){var _0x13e813=this[_0x2a6d('0xd')][_0x2a6d('0xa3')](_0x38a7ad);if(_0x13e813[_0x2a6d('0xa6')]===-0x1){return _0x13e813;}logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xa7'),_0x7dfc7d,_0x13e813[_0x2a6d('0xa8')]));return this['channel'][_0x2a6d('0x9f')](_0x7dfc7d,_0x13e813['extra']);};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x85')]=function(_0xf1ef54){return _0xf1ef54&&_0xf1ef54!=='0'&&_0xf1ef54!=='-1'&&_0xf1ef54!=='';};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xa9')]=function(_0x5131d1){this[_0x2a6d('0xaa')]['sync'](this,_0x5131d1,'-');_0x5131d1[_0x2a6d('0xab')]=_0x5131d1[_0x2a6d('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x2a6d('0xac')]=function(_0x51b79a){logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0xad'),_0x51b79a[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x51b79a[_0x2a6d('0x62')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0xaf'));}var _0x2cb650='\x22'+_0x51b79a[_0x2a6d('0x62')]+'\x22';if(this[_0x2a6d('0x85')](_0x51b79a[_0x2a6d('0x7c')])){_0x2cb650+=','+_0x51b79a['options'];}var _0x1ec2b4=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x2a6d('0xb0'),_0x2cb650);if(_0x1ec2b4['result']===-0x1){return _0x1ec2b4;}return this[_0x2a6d('0xd')]['noop'](util['format'](_0x2a6d('0xb1'),_0x2cb650));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xb2')]=function(_0x4dbed9){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xb3'),_0x4dbed9[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x4dbed9[_0x2a6d('0xb4')])){return this[_0x2a6d('0xd')]['noop'](_0x2a6d('0xb5'));}var _0x2c9f3d=_0x4dbed9['grammar'];if(this['isConfigured'](_0x4dbed9['options'])){_0x2c9f3d+=','+_0x4dbed9[_0x2a6d('0x7c')];}var _0x12bd16=this['channel'][_0x2a6d('0x5e')](_0x2a6d('0xb6'),_0x2c9f3d);if(_0x12bd16[_0x2a6d('0xa6')]===-0x1){return _0x12bd16;}var _0x1023f0=this['getAndSetVariable'](_0x2a6d('0xb7'),'MRCP_RECOG_CONFIDENCE');if(_0x1023f0[_0x2a6d('0xa6')]===-0x1){return _0x1023f0;}var _0xfbb2bc=this[_0x2a6d('0xa5')](_0x2a6d('0xb8'),_0x2a6d('0xb9'));if(_0xfbb2bc['result']===-0x1){return _0xfbb2bc;}var _0x19e08d=this[_0x2a6d('0xa5')](_0x2a6d('0xba'),_0x2a6d('0xbb'));if(_0x19e08d['result']===-0x1){return _0x19e08d;}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2c9f3d));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x7')]=function(_0x5a45d0){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xbc'),_0x5a45d0[_0x2a6d('0x3a')]));return this[_0x2a6d('0xd')][_0x2a6d('0x7')]([_0x5a45d0[_0x2a6d('0xbd')],_0x5a45d0[_0x2a6d('0xbe')]]);};AGIVertices['prototype'][_0x2a6d('0xbf')]=function(_0x494911){logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0xc0'),_0x494911[_0x2a6d('0x3a')]));if(this[_0x2a6d('0x85')](_0x494911['timeout'])){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xc1'),_0x494911[_0x2a6d('0x6d')]));var _0x4bd132=this['channel'][_0x2a6d('0xc2')](_0x494911[_0x2a6d('0x6d')]);if(_0x4bd132[_0x2a6d('0xa6')]===-0x1){return _0x4bd132;}}return this['channel']['answer']();};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x50')]=function(_0x45914c){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xc3'),_0x45914c[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x45914c[_0x2a6d('0x4e')])){return this[_0x2a6d('0xd')]['error'](_0x45914c,_0x2a6d('0xc4'));}_0x45914c[_0x2a6d('0x4f')]=moment();if(this[_0x2a6d('0x85')](_0x45914c[_0x2a6d('0xc5')])){_0x45914c[_0x2a6d('0x4f')]=moment()[_0x2a6d('0xc6')](_0x45914c[_0x2a6d('0xc5')],_0x2a6d('0xc7'));}if(!this['isConfigured'](_0x45914c[_0x2a6d('0x52')])){_0x45914c[_0x2a6d('0x52')]=0x2;}this[_0x2a6d('0x47')][_0x2a6d('0x75')](this,_0x45914c);return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xc8'),_0x45914c[_0x2a6d('0x4d')],_0x45914c[_0x2a6d('0x4e')],_0x45914c[_0x2a6d('0x4f')]));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xc9')]=function(_0x326aac){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xca'),_0x326aac[_0x2a6d('0x3a')]));var _0x13e0b1=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x326aac['application'],_0x326aac[_0x2a6d('0x7c')]);if(_0x13e0b1['result']===-0x1){return _0x13e0b1;}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xcb'),_0x326aac[_0x2a6d('0xcc')],_0x326aac[_0x2a6d('0x7c')]));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xcd')]=function(_0x2cad6f){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xce'),_0x2cad6f[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x2cad6f[_0x2a6d('0x62')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0xaf'));}var _0x15d2f5='\x22'+_0x2cad6f[_0x2a6d('0x62')]+'\x22';if(this[_0x2a6d('0x85')](_0x2cad6f[_0x2a6d('0x7c')])){_0x15d2f5+=','+_0x2cad6f[_0x2a6d('0x7c')];}var _0x10fd11=this['channel']['exec']('MRCPSynth',_0x15d2f5);if(_0x10fd11['result']===-0x1){return _0x10fd11;}return this[_0x2a6d('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x15d2f5));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xcf')]=function(_0x3fe240){logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0xd0'),_0x3fe240['label']));if(!this[_0x2a6d('0x85')](_0x3fe240[_0x2a6d('0x62')])){return this['channel'][_0x2a6d('0xae')](_0x2a6d('0xaf'));}var _0x26d1d5='\x22'+_0x3fe240[_0x2a6d('0x62')]+'\x22';if(this[_0x2a6d('0x85')](_0x3fe240[_0x2a6d('0x7c')])){_0x26d1d5+=','+_0x3fe240['options'];}var _0x46e0b3=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x2a6d('0xb0'),_0x26d1d5);if(_0x46e0b3[_0x2a6d('0xa6')]===-0x1){return _0x46e0b3;}return this['channel'][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xb1'),_0x26d1d5));};AGIVertices[_0x2a6d('0x13')]['lumenvoxasr']=function(_0x44ada9){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x44ada9['label']));if(!this[_0x2a6d('0x85')](_0x44ada9[_0x2a6d('0xb4')])){return this['channel'][_0x2a6d('0xae')](_0x2a6d('0xb5'));}var _0x1c1a82=_0x44ada9['grammar'];if(this[_0x2a6d('0x85')](_0x44ada9[_0x2a6d('0x7c')])){_0x1c1a82+=','+_0x44ada9[_0x2a6d('0x7c')];}var _0x1661f5=this[_0x2a6d('0xd')]['exec'](_0x2a6d('0xb6'),_0x1c1a82);if(_0x1661f5['result']===-0x1){return _0x1661f5;}var _0x11d637=this[_0x2a6d('0xa5')](_0x2a6d('0xb7'),'LUMENVOX_ASR_CONFIDENCE');if(_0x11d637[_0x2a6d('0xa6')]===-0x1){return _0x11d637;}var _0x488111=this['getAndSetVariable'](_0x2a6d('0xb8'),_0x2a6d('0xd1'));if(_0x488111[_0x2a6d('0xa6')]===-0x1){return _0x488111;}var _0x101a55=this['getAndSetVariable'](_0x2a6d('0xba'),_0x2a6d('0xd2'));if(_0x101a55[_0x2a6d('0xa6')]===-0x1){return _0x101a55;}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1c1a82));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xd3')]=function(_0x139314){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xd4'),_0x139314['label']));if(!this[_0x2a6d('0x85')](_0x139314['grammar'])){return this[_0x2a6d('0xd')]['noop'](_0x2a6d('0xb5'));}var _0x3da79c=_0x139314[_0x2a6d('0xb4')];if(this[_0x2a6d('0x85')](_0x139314[_0x2a6d('0x7c')])){_0x3da79c+=','+_0x139314['options'];}var _0x386494=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x2a6d('0xb6'),_0x3da79c);if(_0x386494[_0x2a6d('0xa6')]===-0x1){return _0x386494;}var _0x3d3396=this[_0x2a6d('0xa5')](_0x2a6d('0xb7'),_0x2a6d('0xd5'));if(_0x3d3396[_0x2a6d('0xa6')]===-0x1){return _0x3d3396;}var _0x469003=this['getAndSetVariable'](_0x2a6d('0xb8'),_0x2a6d('0xd6'));if(_0x469003[_0x2a6d('0xa6')]===-0x1){return _0x469003;}var _0x177993=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x177993['result']===-0x1){return _0x177993;}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xd7'),_0x3da79c));};AGIVertices[_0x2a6d('0x13')]['database']=function(_0x2aac07){logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0xd8'),_0x2aac07[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x2aac07[_0x2a6d('0xd9')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x2aac07,'no\x20database\x20selected');}var _0x29075d=this[_0x2a6d('0x18')][_0x2a6d('0x75')](this,_0x2aac07[_0x2a6d('0xd9')]);if(!_0x29075d){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x2aac07,_0x2a6d('0xda'));}if(!this[_0x2a6d('0x85')](_0x2aac07[_0x2a6d('0x33')])){return this['channel'][_0x2a6d('0x2f')](_0x2aac07,_0x2a6d('0xdb'));}var _0x2289e5=_0x2aac07[_0x2a6d('0x33')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xdc'),_0x2289e5));var _0x14ed5e=this[_0x2a6d('0x2d')][_0x2a6d('0x75')](this,_0x29075d,_0x2289e5);this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x2aac07,_0x2289e5);if(!this['isConfigured'](_0x2aac07['variable_id'])){return this[_0x2a6d('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x60274f=this['getVariable'][_0x2a6d('0x75')](this,_0x2aac07[_0x2a6d('0xdd')]);if(!_0x60274f){return this['channel'][_0x2a6d('0x2f')](_0x2aac07,_0x2a6d('0xde'));}var _0x22683f=this;_0x14ed5e[_0x2a6d('0xdf')](function(_0x3200c1,_0x40b2b3){Object['keys'](_0x3200c1)[_0x2a6d('0xdf')](function(_0x4bd116){_0x22683f[_0x2a6d('0xd')]['setVariable'](util[_0x2a6d('0x2b')](_0x2a6d('0xe0'),_0x60274f,_0x40b2b3,_0x4bd116),_0x3200c1[_0x4bd116]);});});this['channel'][_0x2a6d('0x9f')](util[_0x2a6d('0x2b')](_0x2a6d('0xe1'),_0x60274f),_0x14ed5e[_0x2a6d('0xa0')]);return this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0xe2'),_0x60274f));};AGIVertices[_0x2a6d('0x13')]['dial']=function(_0x29275b){logger[_0x2a6d('0xe3')](util[_0x2a6d('0x2b')](_0x2a6d('0xe4'),_0x29275b[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x29275b[_0x2a6d('0xe5')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x29275b,_0x2a6d('0xe6'));}var _0x46d64e=this[_0x2a6d('0x1b')][_0x2a6d('0x75')](this,_0x29275b[_0x2a6d('0xe5')]);if(!_0x46d64e){return this[_0x2a6d('0xd')]['error'](_0x29275b,_0x2a6d('0xe7'));}var _0x521dad=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x2a6d('0xe8'),[util[_0x2a6d('0x2b')](_0x2a6d('0xe9'),_0x46d64e),_0x29275b['timeout'],_0x29275b[_0x2a6d('0xea')],_0x29275b[_0x2a6d('0x6b')]]);if(_0x521dad[_0x2a6d('0xa6')]===-0x1){return _0x521dad;}return this['channel'][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xeb'),_0x2a6d('0xe8')));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xec')]=function(_0x3633f4){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0xed'),_0x3633f4['label']));if(!this[_0x2a6d('0x85')](_0x3633f4[_0x2a6d('0x80')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0xee'));}if(!this[_0x2a6d('0x85')](_0x3633f4[_0x2a6d('0x62')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0xaf'));}this['channel'][_0x2a6d('0xef')]=!![];this[_0x2a6d('0xaa')](_0x3633f4);this[_0x2a6d('0x46')](_0x3633f4['text'],'in');this['channel']['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0xf0'),_0x3633f4[_0x2a6d('0x62')]));var _0x3848b6=this[_0x2a6d('0x7d')]['sync'](this,_0x3633f4);if(_0x3848b6){for(var _0x179768 in _0x3848b6){if(_0x3848b6['hasOwnProperty'](_0x179768)){this[_0x2a6d('0xd')][_0x2a6d('0x9f')](util[_0x2a6d('0x2b')]('DIALOGFLOW_%s',_0x179768[_0x2a6d('0x70')]()),_0x3848b6[_0x179768]);}}this[_0x2a6d('0x46')](_0x3848b6[_0x2a6d('0xf1')],_0x2a6d('0xf2'));return this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')]('Dialogflow\x20Result\x20%s',_0x3848b6[_0x2a6d('0xf1')]));}return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x3633f4,_0x2a6d('0xf3'));};AGIVertices['prototype'][_0x2a6d('0xf4')]=function(_0x290f9e){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x290f9e[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x290f9e[_0x2a6d('0xf5')])){return this[_0x2a6d('0xd')]['noop'](_0x2a6d('0xf6'));}if(!this['isConfigured'](_0x290f9e[_0x2a6d('0xf7')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')]('no\x20username\x20configured');}if(!this[_0x2a6d('0x85')](_0x290f9e[_0x2a6d('0xf8')])){return this['channel'][_0x2a6d('0xae')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x290f9e[_0x2a6d('0xf9')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0xaf'));}this[_0x2a6d('0xd')][_0x2a6d('0xef')]=!![];this[_0x2a6d('0xaa')](_0x290f9e);this[_0x2a6d('0x46')](_0x290f9e[_0x2a6d('0x62')],'in');this['channel'][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xfa'),_0x290f9e['text']));var _0x3edb9e=this['sestekNDA']['sync'](this,_0x290f9e);if(_0x3edb9e){for(var _0x513c03 in _0x3edb9e){if(_0x3edb9e[_0x2a6d('0x96')](_0x513c03)){this[_0x2a6d('0xd')][_0x2a6d('0x9f')](util[_0x2a6d('0x2b')](_0x2a6d('0xfb'),_0x513c03[_0x2a6d('0x70')]()),_0x3edb9e[_0x513c03]);}}this[_0x2a6d('0x46')](_0x3edb9e[_0x2a6d('0xf1')],_0x2a6d('0xf2'));if(_0x3edb9e['audiofile']){this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0xfc'),_0x3edb9e['audiofile']));var _0xf41428=this['channel']['streamFile'](_0x3edb9e[_0x2a6d('0xfd')]);try{fs['unlink'](_0x3edb9e['audiofile']+_0x2a6d('0xfe'));}catch(_0x32dae1){logger[_0x2a6d('0x2f')](_0x32dae1);}return _0xf41428;}else{return this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0xff'),_0x3edb9e[_0x2a6d('0xf1')]));}}return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x290f9e,_0x2a6d('0x100'));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x101')]=function(_0x39ce49){logger['info'](util[_0x2a6d('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x39ce49['label']));return this['channel'][_0x2a6d('0xae')](_0x2a6d('0x101'));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x102')]=function(_0x48858f){logger['info'](util[_0x2a6d('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x48858f[_0x2a6d('0x3a')]));var _0x1e8105='';if(_0x48858f[_0x2a6d('0x103')]){if(!this['isConfigured'](_0x48858f[_0x2a6d('0x103')])){return this['channel']['error'](_0x48858f,'no\x20trunk\x20selected');}else{var _0x5d99b5=parseInt(_0x48858f[_0x2a6d('0x103')],0xa);if(isNaN(_0x5d99b5)){_0x1e8105=_0x48858f['trunk_id'];}else{_0x1e8105=this[_0x2a6d('0x1d')][_0x2a6d('0x75')](this,_0x48858f[_0x2a6d('0x103')]);if(!_0x1e8105){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x48858f,_0x2a6d('0x104'));}}}}else if(_0x48858f[_0x2a6d('0x105')]){_0x1e8105=_0x48858f[_0x2a6d('0x105')];}else{return this['channel'][_0x2a6d('0x2f')](_0x48858f,'no\x20trunk\x20selected');}var _0x3874f9=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x2a6d('0xe8'),[util[_0x2a6d('0x2b')](_0x2a6d('0x106'),_0x1e8105,_0x48858f['phone']),_0x48858f['timeout'],_0x48858f['opts'],_0x48858f[_0x2a6d('0x6b')]]);if(_0x3874f9[_0x2a6d('0xa6')]===-0x1){return _0x3874f9;}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util['format'](_0x2a6d('0xeb'),'DIAL'));};AGIVertices[_0x2a6d('0x13')]['finally']=function(_0x375dc6){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x107'),_0x375dc6['label']));return this['channel'][_0x2a6d('0xae')](_0x2a6d('0x108'));};AGIVertices[_0x2a6d('0x13')]['getdigits']=function(_0x57c563){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x109'),_0x57c563['label']));if(_0x57c563[_0x2a6d('0xab')]===0x0){return this[_0x2a6d('0xa9')](_0x57c563);}_0x57c563[_0x2a6d('0xab')]-=0x1;if(!this[_0x2a6d('0x85')](_0x57c563[_0x2a6d('0x10a')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x57c563,_0x2a6d('0x10b'));}var _0x1f7df2=this[_0x2a6d('0x1f')][_0x2a6d('0x75')](this,_0x57c563['file_id']);if(!_0x1f7df2){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x57c563,_0x2a6d('0x10c'));}if(!this[_0x2a6d('0x85')](_0x57c563[_0x2a6d('0xdd')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x16583a=this[_0x2a6d('0xd')][_0x2a6d('0x10d')](_0x1f7df2,_0x57c563[_0x2a6d('0x10e')],_0x57c563[_0x2a6d('0x10f')]);var _0x23ab13=_0x16583a['result']?_0x16583a[_0x2a6d('0xa6')][_0x2a6d('0xa4')]():'';logger['info']('test',JSON[_0x2a6d('0x78')](_0x16583a));if(_0x16583a[_0x2a6d('0xa6')]===-0x1){this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x57c563,_0x23ab13);return _0x16583a;}else if(_0x16583a[_0x2a6d('0xa8')]===_0x2a6d('0x6d')){_0x16583a['result']=_0x23ab13[_0x2a6d('0xa0')]>=parseInt(_0x57c563[_0x2a6d('0x110')])?'x':'i';}else{_0x16583a[_0x2a6d('0xa6')]=_0x23ab13[_0x2a6d('0xa0')]>=parseInt(_0x57c563['mindigit'])&&_0x23ab13[_0x2a6d('0xa0')]<=parseInt(_0x57c563[_0x2a6d('0x10f')])?'x':'i';}var _0x345dd3=this[_0x2a6d('0xa3')][_0x2a6d('0x75')](this,_0x57c563[_0x2a6d('0xdd')]);if(!_0x345dd3){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x57c563,'no\x20variable\x20found');}this['channel'][_0x2a6d('0x9f')](_0x345dd3,_0x23ab13);if(this['isConfigured'](_0x57c563[_0x2a6d('0x111')])){var _0x1e0cca=parseInt(_0x57c563['hiddendigitsnum'],0xa);var _0x8d8876=rs[_0x2a6d('0x112')]({'charset':'*','length':_0x1e0cca});var _0x4eb010=_0x23ab13['length'];if(_0x4eb010>0x0){if(_0x4eb010>_0x1e0cca){this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x57c563,_0x57c563[_0x2a6d('0x113')]===_0x2a6d('0x114')?_0x8d8876+_0x23ab13[_0x2a6d('0x115')](_0x1e0cca):_0x23ab13[_0x2a6d('0x115')](0x0,_0x4eb010-_0x1e0cca)+_0x8d8876);}else{this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x57c563,rs[_0x2a6d('0x112')]({'charset':'*','length':_0x4eb010}));}}else{this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x57c563,'');}}else{this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x57c563,_0x23ab13);}return _0x16583a;};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xc')]=function(_0x12b85d){logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0x116'),_0x12b85d[_0x2a6d('0x3a')]));return this[_0x2a6d('0x117')](_0x12b85d);};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x118')]=function(_0x5b6a94){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x119'),_0x5b6a94[_0x2a6d('0x3a')]));this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x5b6a94,_0x5b6a94['goalname']);return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x11a'),_0x5b6a94[_0x2a6d('0x11b')]));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x11c')]=function(_0x9d4ba9){logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x11d'),_0x9d4ba9[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x9d4ba9[_0x2a6d('0x11e')])||!this['isConfigured'](_0x9d4ba9[_0x2a6d('0x88')])){return this['channel'][_0x2a6d('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x9d4ba9[_0x2a6d('0x62')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')]('no\x20text\x20configured');}this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x11f'),_0x9d4ba9['text']));var _0x571c78=this[_0x2a6d('0x87')][_0x2a6d('0x75')](this,_0x9d4ba9);if(_0x571c78){this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x120'),_0x571c78));var _0x566c09=this['channel'][_0x2a6d('0x121')](_0x571c78);try{fs[_0x2a6d('0x122')](_0x571c78+_0x2a6d('0xfe'));}catch(_0x2799ff){logger[_0x2a6d('0x2f')](_0x2799ff);}return _0x566c09;}return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x9d4ba9,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x123')]=function(_0xd5bc85){logger['info'](util['format'](_0x2a6d('0x124'),_0xd5bc85[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0xd5bc85[_0x2a6d('0x11e')])||!this[_0x2a6d('0x85')](_0xd5bc85['aws_secret_access_key'])){return this['channel'][_0x2a6d('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x2a6d('0x85')](_0xd5bc85[_0x2a6d('0x8e')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x125'));}if(!this['isConfigured'](_0xd5bc85[_0x2a6d('0x62')])){return this['channel'][_0x2a6d('0xae')]('no\x20text\x20configured');}this['channel'][_0x2a6d('0xef')]=!![];this['createSquareDetailsReport'](_0xd5bc85);this['createSquareMessage'](_0xd5bc85[_0x2a6d('0x62')],'in');this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x126'),_0xd5bc85[_0x2a6d('0x62')]));var _0x4ae4d3=this[_0x2a6d('0x8c')][_0x2a6d('0x75')](this,_0xd5bc85);if(_0x4ae4d3){for(var _0x4bae57 in _0x4ae4d3){if(_0x4ae4d3[_0x2a6d('0x96')](_0x4bae57)&&_[_0x2a6d('0x97')](_0x4ae4d3[_0x4bae57])){this[_0x2a6d('0xd')][_0x2a6d('0x9f')](util[_0x2a6d('0x2b')](_0x2a6d('0x127'),_0x4bae57['toUpperCase']()),_0x4ae4d3[_0x4bae57]);}}if(_[_0x2a6d('0x48')](_0x4ae4d3[_0x2a6d('0x128')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x129'));}else{this['createSquareMessage'](_0x4ae4d3[_0x2a6d('0x128')],_0x2a6d('0xf2'));return this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x12a'),_0x4ae4d3[_0x2a6d('0x128')]));}}return this[_0x2a6d('0xd')]['error'](_0xd5bc85,_0x2a6d('0x12b'));};AGIVertices['prototype'][_0x2a6d('0x12c')]=function(_0x2a4192){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x12d'),_0x2a4192[_0x2a6d('0x3a')],_0x2a4192[_0x2a6d('0x6d')]));if(!this[_0x2a6d('0x85')](_0x2a4192[_0x2a6d('0x80')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')]('no\x20key\x20configured');}var _0x39c0cd=_0x2a6d('0x12e');var _0x369ee0=util[_0x2a6d('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x2a6d('0x112')](0x4));var _0x1efed6=util['format'](_0x2a6d('0x9e'),_0x369ee0,_0x39c0cd);var _0x22ac68=!![];if(_0x2a4192[_0x2a6d('0x12f')]===_0x2a6d('0x130')){_0x22ac68=![];}var _0x127dfa=this['channel'][_0x2a6d('0x131')](_0x369ee0,_0x39c0cd,_0x2a4192['intKey'],_0x2a4192[_0x2a6d('0x6d')],undefined,_0x22ac68);if(_0x127dfa['result']!==-0x1){this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')]('google\x20%s\x20file\x20created',_0x1efed6));var _0x53647c=this['googleASR'][_0x2a6d('0x75')](this,_0x2a4192,_0x1efed6);if(_0x53647c){for(var _0x203bba in _0x53647c){if(_0x53647c[_0x2a6d('0x96')](_0x203bba)){this[_0x2a6d('0xd')][_0x2a6d('0x9f')](util['format'](_0x2a6d('0x132'),_0x203bba[_0x2a6d('0x70')]()),_0x53647c[_0x203bba]);}}return this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x133'),JSON[_0x2a6d('0x78')](_0x53647c)));}}return _0x127dfa;};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x134')]=function(_0x4390ff){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x135'),_0x4390ff[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x4390ff[_0x2a6d('0x92')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')]('no\x20appid\x20configured');}if(!this[_0x2a6d('0x85')](_0x4390ff[_0x2a6d('0x93')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x136'));}var _0x50a9fd=_0x2a6d('0x12e');var _0xcfca35=util[_0x2a6d('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x366b74=util[_0x2a6d('0x2b')]('%s.%s',_0xcfca35,_0x50a9fd);var _0x4215ad=!![];if(_0x4390ff[_0x2a6d('0x12f')]===_0x2a6d('0x130')){_0x4215ad=![];}var _0x5c8ced=this['channel']['recordFile'](_0xcfca35,_0x50a9fd,_0x4390ff[_0x2a6d('0x137')],_0x4390ff[_0x2a6d('0x6d')],undefined,_0x4215ad);if(_0x5c8ced[_0x2a6d('0xa6')]!==-0x1){this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')]('tilde\x20%s\x20file\x20created',_0x366b74));var _0x5a97b2=this['tildeASR'][_0x2a6d('0x75')](this,_0x4390ff,_0x366b74);if(_0x5a97b2){for(var _0x1d7b63 in _0x5a97b2){if(_0x5a97b2[_0x2a6d('0x96')](_0x1d7b63)){this['channel']['setVariable'](util['format']('TILDE_ASR_%s',_0x1d7b63['toUpperCase']()),_0x5a97b2[_0x1d7b63]);}}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')]('TildeASR\x20Result\x20%s',JSON[_0x2a6d('0x78')](_0x5a97b2)));}}return _0x5c8ced;};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x138')]=function(_0x13b09f){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x139'),_0x13b09f[_0x2a6d('0x3a')]));return this[_0x2a6d('0xd')][_0x2a6d('0x13a')](_0x13b09f[_0x2a6d('0x3f')],_0x13b09f[_0x2a6d('0x40')],_0x13b09f['priority']);};AGIVertices['prototype'][_0x2a6d('0x13b')]=function(_0x116aa7){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x13c'),_0x116aa7['label']));if(!this['isConfigured'](_0x116aa7[_0x2a6d('0x13d')])){return this[_0x2a6d('0xd')]['error'](_0x116aa7,_0x2a6d('0x13e'));}try{var _0x5840a7=eval(_0x116aa7[_0x2a6d('0x13d')])?_0x2a6d('0x13f'):_0x2a6d('0x140');this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x141'),_0x116aa7['condition'],_0x5840a7));return{'code':0xc8,'result':_0x5840a7};}catch(_0xf03966){return{'code':0xc8,'result':_0x2a6d('0x140')};}};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x142')]=function(_0x3052c3){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x143'),_0x3052c3[_0x2a6d('0x3a')]));if(!this['isConfigured'](_0x3052c3['interval_id'])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x3052c3,_0x2a6d('0x144'));}var _0x76663e=this[_0x2a6d('0x25')][_0x2a6d('0x75')](this,_0x3052c3[_0x2a6d('0x145')]);if(!_0x76663e){return this['channel'][_0x2a6d('0x2f')](_0x3052c3,_0x2a6d('0x146'));}for(var _0x2531c7=0x0;_0x2531c7<_0x76663e[_0x2a6d('0xa0')];_0x2531c7+=0x1){var _0x5970d5=this[_0x2a6d('0xd')][_0x2a6d('0xa3')](util[_0x2a6d('0x2b')](_0x2a6d('0x147'),_0x76663e[_0x2531c7]));if(_0x5970d5[_0x2a6d('0xa6')]===-0x1){return _0x5970d5;}logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0x148'),_0x76663e[_0x2531c7],_0x5970d5[_0x2a6d('0xa8')]));if(_0x5970d5['extra']===_0x2a6d('0x13f')){logger[_0x2a6d('0x31')](util['format']('IFTIME\x20%s\x20%s',_0x76663e[_0x2531c7],_0x2a6d('0x13f')));this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x148'),_0x76663e[_0x2531c7],_0x2a6d('0x13f')));return{'code':0xc8,'result':_0x2a6d('0x13f')};}else{logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x148'),_0x76663e[_0x2531c7],'false'));this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')]('IFTIME\x20%s\x20%s',_0x76663e[_0x2531c7],'false'));}}return{'code':0xc8,'result':_0x2a6d('0x140')};};AGIVertices['prototype'][_0x2a6d('0x149')]=function(_0x4e5f08){logger['info'](util['format'](_0x2a6d('0x14a'),_0x4e5f08[_0x2a6d('0x3a')]));return this[_0x2a6d('0xd')]['hangup']();};AGIVertices[_0x2a6d('0x13')]['ispeechasr']=function(_0x2dd4c3){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x14b'),_0x2dd4c3[_0x2a6d('0x3a')]));if(!this['isConfigured'](_0x2dd4c3['key'])){return this[_0x2a6d('0xd')]['noop'](_0x2a6d('0xee'));}var _0x599d78=_0x2a6d('0x12e');var _0x40274c=util['format'](_0x2a6d('0x14c'),FILES_PATH,rs[_0x2a6d('0x112')](0x4));var _0x474bc4=util[_0x2a6d('0x2b')](_0x2a6d('0x9e'),_0x40274c,_0x599d78);var _0x5a9894=!![];if(_0x2dd4c3[_0x2a6d('0x12f')]===_0x2a6d('0x130')){_0x5a9894=![];}var _0x145f6c=this[_0x2a6d('0xd')][_0x2a6d('0x131')](_0x40274c,_0x599d78,_0x2dd4c3[_0x2a6d('0x137')],_0x2dd4c3[_0x2a6d('0x6d')],undefined,_0x5a9894);if(_0x145f6c[_0x2a6d('0xa6')]!==-0x1){this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')]('ispeech\x20%s\x20file\x20created',_0x474bc4));var _0x34fc49=this[_0x2a6d('0x83')][_0x2a6d('0x75')](this,_0x2dd4c3,_0x474bc4);if(_0x34fc49){for(var _0x201e08 in _0x34fc49){if(_0x34fc49['hasOwnProperty'](_0x201e08)){this[_0x2a6d('0xd')][_0x2a6d('0x9f')](util[_0x2a6d('0x2b')](_0x2a6d('0x14d'),_0x201e08[_0x2a6d('0x70')]()),_0x34fc49[_0x201e08]);}}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x14e'),JSON[_0x2a6d('0x78')](_0x34fc49)));}}return _0x145f6c;};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x14f')]=function(_0x423e4a){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x150'),_0x423e4a[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x423e4a[_0x2a6d('0x80')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0xee'));}if(!this[_0x2a6d('0x85')](_0x423e4a[_0x2a6d('0x62')])){return this['channel'][_0x2a6d('0xae')](_0x2a6d('0xaf'));}this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x151'),_0x423e4a[_0x2a6d('0x62')]));var _0x868907=this[_0x2a6d('0x7f')][_0x2a6d('0x75')](this,_0x423e4a);if(_0x868907){this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x152'),_0x868907));var _0x5356e5=this[_0x2a6d('0xd')]['streamFile'](_0x868907,_0x423e4a[_0x2a6d('0x137')]);try{fs[_0x2a6d('0x122')](_0x868907+_0x2a6d('0xfe'));}catch(_0x2eed5a){logger[_0x2a6d('0x2f')](_0x2eed5a);}return _0x5356e5;}return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x423e4a,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x153')]=function(_0x11aefa){logger[_0x2a6d('0x31')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x11aefa[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x11aefa['findBy'])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x11aefa,'no\x20find\x20by\x20configured');}logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x154'),this[_0x2a6d('0xd')]['callerid'],_0x11aefa[_0x2a6d('0x155')]));var _0x35158a=this[_0x2a6d('0x59')]['sync'](this,_0x11aefa[_0x2a6d('0x155')]);if(_0x35158a){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x156'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x11aefa[_0x2a6d('0x155')]));this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x11aefa['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x157'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x11aefa[_0x2a6d('0x155')]));this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x157'),this['channel'][_0x2a6d('0x3c')],_0x11aefa['findBy']));return{'code':0xc8,'result':_0x2a6d('0x158')};}};AGIVertices['prototype'][_0x2a6d('0x159')]=function(_0xf51c9e){logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0x15a'),_0xf51c9e[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0xf51c9e[_0x2a6d('0x155')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0xf51c9e,_0x2a6d('0x15b'));}logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x154'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0xf51c9e['findBy']));var _0x42fbc9=this[_0x2a6d('0x58')][_0x2a6d('0x75')](this,_0xf51c9e[_0x2a6d('0x155')]);if(_0x42fbc9){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x156'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0xf51c9e[_0x2a6d('0x155')]));this['channel'][_0x2a6d('0xae')](util['format'](_0x2a6d('0x156'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0xf51c9e[_0x2a6d('0x155')]));return{'code':0xc8,'result':_0x2a6d('0x15c')};}else{logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0x157'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0xf51c9e['findBy']));this[_0x2a6d('0xd')]['noop'](util['format'](_0x2a6d('0x157'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0xf51c9e[_0x2a6d('0x155')]));return{'code':0xc8,'result':_0x2a6d('0x158')};}};AGIVertices['prototype'][_0x2a6d('0x15d')]=function(_0x360dcb){logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x15e'),_0x360dcb[_0x2a6d('0x3a')]));if(!this['isConfigured'](_0x360dcb[_0x2a6d('0x15f')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x360dcb,_0x2a6d('0x160'));}this['channel'][_0x2a6d('0xae')](util['format']('math\x20%s',_0x360dcb['operation']));var _0x5e400d=eval(_0x360dcb[_0x2a6d('0x15f')]);if(!this[_0x2a6d('0x85')](_0x360dcb['variable_id'])){return this[_0x2a6d('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x58cb62=this['getVariable'][_0x2a6d('0x75')](this,_0x360dcb[_0x2a6d('0xdd')]);if(!_0x58cb62){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x360dcb,_0x2a6d('0xde'));}if(_['isArray'](_0x5e400d)){var _0x4997c0=this;_0x5e400d[_0x2a6d('0xdf')](function(_0x146c5e,_0x592a75){_0x4997c0[_0x2a6d('0xd')]['setVariable'](util[_0x2a6d('0x2b')]('%s[%s]',_0x58cb62,_0x592a75),_0x146c5e);});return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')]('variable\x20%s[key]\x20set',_0x58cb62));}else{return this[_0x2a6d('0xd')][_0x2a6d('0x9f')](_0x58cb62,_0x5e400d);}};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xb')]=function(_0x1e4e23){logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x161'),_0x1e4e23[_0x2a6d('0x3a')]));if(_0x1e4e23['retry']===0x0){return this[_0x2a6d('0xa9')](_0x1e4e23);}_0x1e4e23['retry']-=0x1;if(!this[_0x2a6d('0x85')](_0x1e4e23[_0x2a6d('0x10a')])){return this[_0x2a6d('0xd')]['error'](_0x1e4e23,_0x2a6d('0x10b'));}var _0x182f06=this[_0x2a6d('0x1f')][_0x2a6d('0x75')](this,_0x1e4e23[_0x2a6d('0x10a')]);if(!_0x182f06){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x1e4e23,'no\x20file\x20audio\x20found');}var _0x3ba90e=this['channel']['getData'](_0x182f06,_0x1e4e23[_0x2a6d('0x10e')],_0x1e4e23[_0x2a6d('0x162')]);var _0x176267=_0x3ba90e[_0x2a6d('0xa6')];if(_0x3ba90e[_0x2a6d('0xa6')]===-0x1){this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x1e4e23,'-1');return _0x3ba90e;}else if(_0x3ba90e['extra']===_0x2a6d('0x6d')){_0x3ba90e[_0x2a6d('0xa6')]=_0x3ba90e[_0x2a6d('0xa6')][_0x2a6d('0xa0')]>0x0?_0x3ba90e[_0x2a6d('0xa6')]:'t';}else if(_[_0x2a6d('0x4b')](_0x3ba90e[_0x2a6d('0xa6')])){_0x3ba90e['result']='#';_0x176267='#';}if(!this[_0x2a6d('0x85')](_0x1e4e23[_0x2a6d('0xdd')])){this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x163'));}else{var _0xcb9575=this['getVariable']['sync'](this,_0x1e4e23[_0x2a6d('0xdd')]);if(!_0xcb9575){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x1e4e23,_0x2a6d('0xde'));}this['channel'][_0x2a6d('0x9f')](_0xcb9575,_0x176267);}this[_0x2a6d('0xaa')]['sync'](this,_0x1e4e23,_0x176267);return _0x3ba90e;};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0xae')]=function(_0x4858b6){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4858b6['label']));return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x4858b6['output']||_0x4858b6[_0x2a6d('0x3a')]);};AGIVertices['prototype'][_0x2a6d('0x164')]=function(_0x47c61b){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x165'),_0x47c61b['label']));if(!this['isConfigured'](_0x47c61b[_0x2a6d('0x155')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x47c61b,_0x2a6d('0x15b'));}logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x154'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x47c61b[_0x2a6d('0x155')]));var _0x42924f=this[_0x2a6d('0x53')][_0x2a6d('0x75')](this,_0x47c61b[_0x2a6d('0x166')]);var _0x1325a5=this[_0x2a6d('0x55')][_0x2a6d('0x75')](this,_0x47c61b['findBy'],_0x42924f);if(_0x1325a5){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x47c61b[_0x2a6d('0x155')]));this['channel']['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x156'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x47c61b['findBy']));return{'code':0xc8,'result':_0x2a6d('0x15c')};}else{logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x157'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x47c61b[_0x2a6d('0x155')]));this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2a6d('0xd')]['callerid'],_0x47c61b[_0x2a6d('0x155')]));return{'code':0xc8,'result':_0x2a6d('0x158')};}};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x167')]=function(_0x220117){logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x168'),_0x220117[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x220117['file_id'])){return this['channel'][_0x2a6d('0x2f')](_0x220117,_0x2a6d('0x10b'));}var _0x50a757=this[_0x2a6d('0x1f')][_0x2a6d('0x75')](this,_0x220117[_0x2a6d('0x10a')]);if(!_0x50a757){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x220117,_0x2a6d('0x10c'));}var _0x364b3e=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x2a6d('0x169'),[_0x50a757,_0x220117[_0x2a6d('0xea')]]);if(_0x364b3e[_0x2a6d('0xa6')]===-0x1){return _0x364b3e;}return this['channel'][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xcb'),_0x2a6d('0x169'),_0x50a757));};AGIVertices[_0x2a6d('0x13')]['queue']=function(_0x5ec4ba){logger[_0x2a6d('0x31')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5ec4ba[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x5ec4ba['queue_id'])){return this['channel'][_0x2a6d('0x2f')](_0x5ec4ba,_0x2a6d('0x16a'));}var _0x4d1f71='';var _0xe75fe0=parseInt(_0x5ec4ba[_0x2a6d('0x16b')],0xa);if(isNaN(_0xe75fe0)){_0x4d1f71=_0x5ec4ba[_0x2a6d('0x16b')];}else{_0x4d1f71=this['getVoiceQueue'][_0x2a6d('0x75')](this,_0x5ec4ba[_0x2a6d('0x16b')]);if(!_0x4d1f71){return this['channel'][_0x2a6d('0x2f')](_0x5ec4ba,_0x2a6d('0x16c'));}}var _0x33c559='';if(this[_0x2a6d('0x85')](_0x5ec4ba[_0x2a6d('0x10a')])){var _0x10ed0a=this['getSound'][_0x2a6d('0x75')](this,_0x5ec4ba['file_id']);if(_0x10ed0a){_0x33c559=_0x10ed0a;}}this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x5ec4ba,_0x4d1f71);if(_0x5ec4ba[_0x2a6d('0xea')][_0x2a6d('0x16d')]('x')<0x0){_0x5ec4ba[_0x2a6d('0xea')]+='x';}if(_0x5ec4ba['opts'][_0x2a6d('0x16d')]('X')<0x0){_0x5ec4ba[_0x2a6d('0xea')]+='X';}this[_0x2a6d('0xd')][_0x2a6d('0x9f')](_0x2a6d('0x16e'),_0x4d1f71?_0x4d1f71[_0x2a6d('0x16f')]():'');var _0x121c70=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x2a6d('0x170'),[_0x4d1f71,_0x5ec4ba['opts'],_0x5ec4ba[_0x2a6d('0x6b')],_0x33c559,_0x5ec4ba[_0x2a6d('0x6d')],_0x5ec4ba[_0x2a6d('0x7')],_0x5ec4ba[_0x2a6d('0x171')],_0x5ec4ba['gosub'],'',_0x5ec4ba[_0x2a6d('0x172')]]);if(_0x121c70[_0x2a6d('0xa6')]===-0x1){return _0x121c70;}return this[_0x2a6d('0xd')]['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0xcb'),_0x2a6d('0x170'),_0x4d1f71));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x173')]=function(_0x4689dc){logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0x174'),_0x4689dc[_0x2a6d('0x3a')]));var _0x3efaa4=_0x4689dc['recordingFormat']||_0x2a6d('0x12e');var _0x677620=util[_0x2a6d('0x2b')]('%s_%s',this['channel'][_0x2a6d('0x39')],rs[_0x2a6d('0x112')](0x5));var _0x47a558=util[_0x2a6d('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x677620,_0x3efaa4);var _0x45b8bd=util[_0x2a6d('0x2b')](_0x2a6d('0x14c'),FILES_PATH,_0x677620);this['createSquareRecording']['sync'](this,_0x4689dc,_0x677620,_0x47a558);this['channel'][_0x2a6d('0x9f')]('RECORDING_SAVENAME',_0x677620);logger[_0x2a6d('0x31')](_0x2a6d('0x175'),_0x45b8bd,_0x3efaa4,_0x4689dc[_0x2a6d('0x176')],_0x4689dc[_0x2a6d('0x6d')]);return this['channel'][_0x2a6d('0x131')](_0x45b8bd,_0x3efaa4,_0x4689dc[_0x2a6d('0x176')],_0x4689dc[_0x2a6d('0x6d')],undefined,!![]);};AGIVertices[_0x2a6d('0x13')]['restapi']=function(_0x461266){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x177'),_0x461266['label']));if(!this['isConfigured'](_0x461266[_0x2a6d('0x6b')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x178'));}var _0x172b43=this[_0x2a6d('0x179')][_0x2a6d('0x75')](this,_0x461266);logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')]('Response:',util[_0x2a6d('0x17a')](_0x172b43,{'showHidden':![],'depth':null})));if(!this[_0x2a6d('0x85')](_0x461266[_0x2a6d('0xdd')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2af6ef=this['getVariable'][_0x2a6d('0x75')](this,_0x461266[_0x2a6d('0xdd')]);if(!_0x2af6ef){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x461266,'no\x20variable\x20found');}this['channel'][_0x2a6d('0x9f')](util['format'](_0x2a6d('0x17b'),_0x2af6ef),_0x172b43[_0x2a6d('0x7a')]?_0x172b43[_0x2a6d('0x7a')]:_0x2a6d('0x17c'));this[_0x2a6d('0xd')][_0x2a6d('0x9f')](util['format'](_0x2a6d('0x17d'),_0x2af6ef),_0x172b43[_0x2a6d('0x7b')]?_0x172b43['statusMessage']:'OK');if(_0x172b43['body']){try{this['saveRestApiResult'](_0x172b43[_0x2a6d('0x79')],_0x2af6ef);}catch(_0x3bae1b){logger['error'](util[_0x2a6d('0x2b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2af6ef));}}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xe2'),_0x2af6ef));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x17e')]=function(_0x2ea5f9){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x17f'),_0x2ea5f9[_0x2a6d('0x3a')]));return this[_0x2a6d('0xd')]['sayDigits'](_0x2ea5f9[_0x2a6d('0x180')][_0x2a6d('0x181')](/\s+/g,''),_0x2ea5f9['escape_digits']);};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x182')]=function(_0x2f31c4){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2f31c4['label']));return this['channel'][_0x2a6d('0x183')](_0x2f31c4[_0x2a6d('0x6e')][_0x2a6d('0x181')](/\s+/g,''),_0x2f31c4[_0x2a6d('0x176')]);};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x184')]=function(_0x3356ea){logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0x185'),_0x3356ea[_0x2a6d('0x3a')]));return this[_0x2a6d('0xd')][_0x2a6d('0x186')](_0x3356ea[_0x2a6d('0x62')],_0x3356ea[_0x2a6d('0x176')]);};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x187')]=function(_0x30a3e0){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x188'),_0x30a3e0[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x30a3e0['account_id'])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x189'));}var _0x1ed963=this[_0x2a6d('0x22')][_0x2a6d('0x75')](this,_0x30a3e0[_0x2a6d('0x18a')]);if(!_0x1ed963||!_0x1ed963[_0x2a6d('0x18b')]){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x30a3e0,_0x2a6d('0x18c'));}var _0x2eb5c8={'from':util[_0x2a6d('0x2b')](_0x2a6d('0x18d'),_0x1ed963[_0x2a6d('0x11')],_0x1ed963[_0x2a6d('0x18e')]||_0x1ed963[_0x2a6d('0x18b')][_0x2a6d('0x18f')]),'to':_0x30a3e0['to']||'','cc':_0x30a3e0['cc']||'','bcc':_0x30a3e0[_0x2a6d('0x190')]||'','subject':_0x30a3e0[_0x2a6d('0x191')],'html':_0x30a3e0[_0x2a6d('0x62')],'text':_0x30a3e0[_0x2a6d('0x62')]};var _0x53e643={'tls':{'rejectUnauthorized':![]}};if(_0x1ed963[_0x2a6d('0x18b')][_0x2a6d('0x192')]){_0x53e643[_0x2a6d('0x192')]=_0x1ed963[_0x2a6d('0x18b')][_0x2a6d('0x192')];}else{_0x53e643[_0x2a6d('0x193')]=_0x1ed963[_0x2a6d('0x18b')][_0x2a6d('0x193')];_0x53e643['port']=_0x1ed963[_0x2a6d('0x18b')]['port'];_0x53e643[_0x2a6d('0x194')]=_0x1ed963[_0x2a6d('0x18b')][_0x2a6d('0x194')];}if(_0x1ed963[_0x2a6d('0x18b')][_0x2a6d('0x195')]){_0x53e643[_0x2a6d('0x196')]={'user':_0x1ed963[_0x2a6d('0x18b')][_0x2a6d('0x18f')],'pass':_0x1ed963[_0x2a6d('0x18b')]['pass']};}if(this[_0x2a6d('0x85')](_0x30a3e0[_0x2a6d('0x197')])){}logger[_0x2a6d('0xe3')](_0x2a6d('0x198'),JSON[_0x2a6d('0x78')](_0x2eb5c8));this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x30a3e0,_0x30a3e0[_0x2a6d('0x18a')]);this['channel'][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x199'),_0x1ed963[_0x2a6d('0x11')]));this[_0x2a6d('0x19a')][_0x2a6d('0x75')](this,_0x53e643,_0x2eb5c8);return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x19b'));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x19c')]=function(_0x4e6b98){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x19d'),_0x4e6b98['label']));return this[_0x2a6d('0xd')]['noop'](_0x2a6d('0x19e'));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x19f')]=function(_0x595762){logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x1a0'),_0x595762[_0x2a6d('0x3a')]));if(!this[_0x2a6d('0x85')](_0x595762[_0x2a6d('0x1a1')])){return this['channel']['noop'](_0x2a6d('0x1a2'));}var _0x33f234=this[_0x2a6d('0x1a3')][_0x2a6d('0x75')](this,_0x595762[_0x2a6d('0x1a1')]);if(!_0x33f234){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x595762,_0x2a6d('0x1a4'));}var _0x3e5e95={'body':_0x595762['sms_text'],'phone':_0x595762['to']||'','SmsAccountId':_0x33f234['id']};logger[_0x2a6d('0xe3')](_0x2a6d('0x1a5'),JSON[_0x2a6d('0x78')](_0x3e5e95));this[_0x2a6d('0xaa')][_0x2a6d('0x75')](this,_0x595762,_0x595762[_0x2a6d('0x1a1')]);this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x1a6'),_0x33f234[_0x2a6d('0x11')]));this['createSmsMessage'][_0x2a6d('0x75')](this,_0x3e5e95);return this[_0x2a6d('0xd')][_0x2a6d('0xae')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1a7')]=function(_0x170cd1){logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x1a8'),_0x170cd1['label']));if(!this[_0x2a6d('0x85')](_0x170cd1[_0x2a6d('0xdd')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x170cd1,_0x2a6d('0x1a9'));}var _0xba834d=this['getVariable'][_0x2a6d('0x75')](this,_0x170cd1[_0x2a6d('0xdd')]);if(!_0xba834d){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x170cd1,'no\x20variable\x20found');}return this[_0x2a6d('0xd')][_0x2a6d('0x9f')](_0xba834d,_0x170cd1[_0x2a6d('0x1aa')]);};AGIVertices['prototype'][_0x2a6d('0x1ab')]=function(_0x53db01){logger['info'](util['format'](_0x2a6d('0x1ac'),_0x53db01[_0x2a6d('0x3a')]));this['channel'][_0x2a6d('0xae')](_0x2a6d('0x1ad'));if(_0x53db01[_0x2a6d('0xbf')]===_0x2a6d('0x1ae')){this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x1af'));return this[_0x2a6d('0xd')][_0x2a6d('0xbf')]();}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](_0x2a6d('0x1b0'));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1b1')]=function(_0x441139){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x1b2'),_0x441139[_0x2a6d('0x3a')]));if(!this['isConfigured'](_0x441139[_0x2a6d('0x1b3')])){return this['channel'][_0x2a6d('0x2f')](_0x441139,_0x2a6d('0x1b4'));}var _0x4cc699=this[_0x2a6d('0x16')][_0x2a6d('0x75')](this,_0x441139[_0x2a6d('0x1b3')]);if(!this[_0x2a6d('0x85')](_0x4cc699)){return this[_0x2a6d('0xd')]['error'](_0x441139,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x441139[_0x2a6d('0x1b3')]));}if(_0x4cc699===this[_0x2a6d('0xd')]['arg_1']){return this['channel'][_0x2a6d('0x2f')](_0x441139,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x2a6d('0x75')](this,_0x441139,_0x4cc699);var _0x221e83=this[_0x2a6d('0xd')]['exec'](_0x2a6d('0x1b5'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x2a6d('0x7')][_0x2a6d('0x193')]||_0x2a6d('0x1b6'),_0x4cc699,this['channel'][_0x2a6d('0x44')]));if(_0x221e83['result']===-0x1){return _0x221e83;}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xcb'),_0x2a6d('0x1b5'),_0x4cc699));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1b7')]=function(_0x2a33a3){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x1b8'),_0x2a33a3['label']));var _0xe02fef=this[_0x2a6d('0x5d')][_0x2a6d('0x75')](this,_0x2a33a3[_0x2a6d('0xbd')]);this['createSquareDetailsReport'][_0x2a6d('0x75')](this,_0x2a33a3,_0x2a33a3[_0x2a6d('0xbd')]);if(this['isConfigured'](_0x2a33a3['variable_id'])){var _0x2a2d52=this['getVariable'][_0x2a6d('0x75')](this,_0x2a33a3[_0x2a6d('0xdd')]);if(_0x2a2d52){this[_0x2a6d('0xd')][_0x2a6d('0x9f')](_0x2a2d52,_0xe02fef);return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util['format'](_0x2a6d('0x1b9'),_0x2a33a3[_0x2a6d('0xbd')],_0x2a2d52));}}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2a33a3['command']));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1ba')]=function(_0x99759){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x1bb'),_0x99759[_0x2a6d('0x3a')]));_0x99759[_0x2a6d('0x62')]=_0x99759['text'][_0x2a6d('0x181')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x99759[_0x2a6d('0x60')])){return this[_0x2a6d('0xd')][_0x2a6d('0xae')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x99759[_0x2a6d('0x62')])){return this['channel'][_0x2a6d('0xae')]('no\x20text\x20configured');}this[_0x2a6d('0xd')][_0x2a6d('0xae')](util['format'](_0x2a6d('0x1bc'),_0x99759[_0x2a6d('0x62')]));var _0x24180f=this['googleCloudTTS'][_0x2a6d('0x75')](this,_0x99759);if(_0x24180f){this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x1bd'),_0x24180f));var _0x469965=this[_0x2a6d('0xd')][_0x2a6d('0x121')](_0x24180f);try{fs[_0x2a6d('0x122')](_0x24180f+_0x2a6d('0xfe'));}catch(_0x1ffee9){logger[_0x2a6d('0x2f')](_0x1ffee9);}return _0x469965;}return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x99759,_0x2a6d('0x1be'));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1bf')]=function(_0x4bc211){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4bc211[_0x2a6d('0x3a')]));_0x4bc211[_0x2a6d('0x62')]=_0x4bc211[_0x2a6d('0x62')][_0x2a6d('0x181')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2a6d('0x85')](_0x4bc211[_0x2a6d('0x62')])){return this[_0x2a6d('0xd')]['noop'](_0x2a6d('0xaf'));}this['channel']['noop'](util[_0x2a6d('0x2b')](_0x2a6d('0x1c0'),_0x4bc211['text']));var _0x26da73=this[_0x2a6d('0x69')][_0x2a6d('0x75')](this,_0x4bc211);if(_0x26da73){this['channel'][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x1c1'),_0x26da73));var _0x191e5c=this[_0x2a6d('0xd')][_0x2a6d('0x121')](_0x26da73);try{fs[_0x2a6d('0x122')](_0x26da73+_0x2a6d('0xfe'));}catch(_0x4dc3f4){logger[_0x2a6d('0x2f')](_0x4dc3f4);}return _0x191e5c;}return this['channel'][_0x2a6d('0x2f')](_0x4bc211,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1c2')]=function(_0x59cc90){logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0x1c3'),_0x59cc90[_0x2a6d('0x3a')]));if(!this['isConfigured'](_0x59cc90[_0x2a6d('0x155')])){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x59cc90,_0x2a6d('0x15b'));}logger[_0x2a6d('0x31')](util['format'](_0x2a6d('0x154'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x59cc90[_0x2a6d('0x155')]));var _0x160274=this[_0x2a6d('0x57')][_0x2a6d('0x75')](this,_0x59cc90[_0x2a6d('0x155')]);if(_0x160274){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x156'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x59cc90[_0x2a6d('0x155')]));this[_0x2a6d('0xd')][_0x2a6d('0xae')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x59cc90[_0x2a6d('0x155')]));return{'code':0xc8,'result':_0x2a6d('0x15c')};}else{logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')](_0x2a6d('0x157'),this[_0x2a6d('0xd')][_0x2a6d('0x3c')],_0x59cc90[_0x2a6d('0x155')]));this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0x157'),this['channel'][_0x2a6d('0x3c')],_0x59cc90[_0x2a6d('0x155')]));return{'code':0xc8,'result':_0x2a6d('0x158')};}};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1c4')]=function(_0x4f603d){logger[_0x2a6d('0x31')](util[_0x2a6d('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x4f603d[_0x2a6d('0x3a')]));var _0x310684=this[_0x2a6d('0xd')][_0x2a6d('0x5e')](_0x2a6d('0x1c5'),[_0x4f603d[_0x2a6d('0x1c6')],_0x4f603d['options']]);if(_0x310684[_0x2a6d('0xa6')]===-0x1){return _0x310684;}return this[_0x2a6d('0xd')][_0x2a6d('0xae')](util[_0x2a6d('0x2b')](_0x2a6d('0xcb'),'VOICEMAIL',_0x4f603d['mailbox']));};AGIVertices[_0x2a6d('0x13')][_0x2a6d('0x1c7')]=function(_0x23061e){logger['info'](util[_0x2a6d('0x2b')](_0x2a6d('0x1c8'),_0x23061e[_0x2a6d('0x3a')]));if(!this['isConfigured'](_0x23061e[_0x2a6d('0xdd')])){return this['channel'][_0x2a6d('0x2f')](_0x23061e,_0x2a6d('0x1a9'));}var _0x5ecc07=this[_0x2a6d('0xa3')][_0x2a6d('0x75')](this,_0x23061e[_0x2a6d('0xdd')]);if(!_0x5ecc07){return this[_0x2a6d('0xd')][_0x2a6d('0x2f')](_0x23061e,_0x2a6d('0xde'));}var _0x264a18=this[_0x2a6d('0xd')]['getVariable'](_0x5ecc07);return{'code':0xc8,'result':_0x264a18['extra']?_0x264a18[_0x2a6d('0xa8')]:'-'};};String[_0x2a6d('0x13')]['replaceAll']=function(_0x5663be,_0x3860f8){return this[_0x2a6d('0xa1')](_0x5663be)[_0x2a6d('0x1c9')](_0x3860f8);};module['exports']=AGIVertices; \ No newline at end of file +var _0x3e22=['appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','split','replaceAll','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','createSquareDetailsReport','maxRetry','mrcpsynth','no\x20text\x20configured','options','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','callback_priority','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','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','test','mindigit','maxdigit','hiddendigitspos','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','service','host','port','secure','authentication','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','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','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','MP3','googleTTS','url','method','timeout','includes','POST','PUT','body','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_polly_region','Amy','aws_text_type','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0x3e22,0x12e));var _0x23e2=function(_0x11ef2d,_0x4da792){_0x11ef2d=_0x11ef2d-0x0;var _0xc17ba0=_0x3e22[_0x11ef2d];return _0xc17ba0;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x23e2('0x0'));var _=require(_0x23e2('0x1'));var sh=require(_0x23e2('0x2'));var odbc=require(_0x23e2('0x3'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x23e2('0x4'));var rp=require(_0x23e2('0x5'));var logger=require(_0x23e2('0x6'))('agi');var config=require(_0x23e2('0x7'));var scripts=require(_0x23e2('0x8'));var FILES_PATH=_0x23e2('0x9');var recursiveMapAttributes=['rawHeaders',_0x23e2('0xa')];var verticesWithRetry=[_0x23e2('0xb'),_0x23e2('0xc'),'getsecretdigits'];var AGIVertices=function(_0x1f7a12,_0x362161,_0x29a850){this[_0x23e2('0xd')]=_0x1f7a12;this[_0x23e2('0xe')]=_0x362161;this[_0x23e2('0xf')]=_0x29a850;};AGIVertices[_0x23e2('0x10')][_0x23e2('0x11')]=function(_0x55d0aa,_0x286ded){this[_0x23e2('0xe')][_0x23e2('0x12')](_0x55d0aa)[_0x23e2('0x13')](function(_0x46680a){_0x286ded(null,_0x46680a?_0x46680a[_0x23e2('0x14')]:![]);})['catch'](function(_0x49b165){_0x286ded(_0x49b165);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x15')]=function(_0x5e5959,_0x95ba7e){this[_0x23e2('0xe')][_0x23e2('0x16')](_0x5e5959)['then'](function(_0x47a9c8){_0x95ba7e(null,_0x47a9c8?_0x47a9c8[_0x23e2('0x14')]:![]);})[_0x23e2('0x17')](function(_0x1ae451){_0x95ba7e(_0x1ae451);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x18')]=function(_0x5bd447,_0x50f78f){this[_0x23e2('0xe')]['getSquareProjectById'](_0x5bd447)[_0x23e2('0x13')](function(_0x403ba4){_0x50f78f(null,_0x403ba4?_0x403ba4[_0x23e2('0x14')]:![]);})[_0x23e2('0x17')](function(_0x18e0f2){_0x50f78f(_0x18e0f2);});};AGIVertices[_0x23e2('0x10')]['getSquareOdbc']=function(_0x78ebf,_0x5adfeb){this[_0x23e2('0xe')][_0x23e2('0x19')](_0x78ebf)[_0x23e2('0x13')](function(_0x4745bf){_0x5adfeb(null,_0x4745bf?_0x4745bf[_0x23e2('0x1a')]:![]);})[_0x23e2('0x17')](function(_0x28de44){_0x5adfeb(_0x28de44);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x1b')]=function(_0x54ed46,_0x4b31fb){this[_0x23e2('0xe')]['getUserById'](_0x54ed46)[_0x23e2('0x13')](function(_0x389dd2){_0x4b31fb(null,_0x389dd2?_0x389dd2[_0x23e2('0x14')]:![]);})[_0x23e2('0x17')](function(_0x533c40){_0x4b31fb(_0x533c40);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x1c')]=function(_0x37684d,_0x49c0b9){this[_0x23e2('0xe')]['getTrunkById'](_0x37684d)[_0x23e2('0x13')](function(_0x394ec4){_0x49c0b9(null,_0x394ec4?_0x394ec4['name']:![]);})[_0x23e2('0x17')](function(_0x36666a){_0x49c0b9(_0x36666a);});};AGIVertices['prototype'][_0x23e2('0x1d')]=function(_0x4810cb,_0x35f5a9){var _0x4780dc=this;this[_0x23e2('0xe')]['getSoundById'](_0x4810cb)[_0x23e2('0x13')](function(_0x375bfa){_0x35f5a9(null,_0x375bfa?_0x4780dc[_0x23e2('0x1e')](_0x375bfa[_0x23e2('0x1f')]):![]);})[_0x23e2('0x17')](function(_0x144b16){_0x35f5a9(_0x144b16);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x20')]=function(_0x40bea5,_0x110ec4){this[_0x23e2('0xe')][_0x23e2('0x21')](_0x40bea5)[_0x23e2('0x13')](function(_0x4cb67d){_0x110ec4(null,_0x4cb67d?_0x4cb67d:![]);})[_0x23e2('0x17')](function(_0x4724b6){_0x110ec4(_0x4724b6);});};AGIVertices['prototype']['sendMailMessage']=function(_0x326678,_0x2d083e,_0x2c799c){this[_0x23e2('0xf')][_0x23e2('0x22')](_0x326678,_0x2d083e)[_0x23e2('0x13')](function(){_0x2c799c(null);})[_0x23e2('0x17')](function(_0x1fa62a){_0x2c799c(_0x1fa62a);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x23')]=function(_0x5ada55,_0x96d00d){this[_0x23e2('0xe')][_0x23e2('0x24')](_0x5ada55)[_0x23e2('0x13')](function(_0x35a27b){if(_0x35a27b){if(_0x35a27b[_0x23e2('0x25')]){_0x96d00d(null,[_0x35a27b[_0x23e2('0x26')]]);}else{_0x96d00d(null,_[_0x23e2('0x27')](_0x35a27b[_0x23e2('0x28')],_0x23e2('0x26')));}}else{_0x96d00d(null,![]);}})['catch'](function(_0x228cad){_0x96d00d(_0x228cad);});};AGIVertices['prototype']['getSoundPath']=function(_0x2e5a1b){return util[_0x23e2('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x2e5a1b);};AGIVertices[_0x23e2('0x10')][_0x23e2('0x2a')]=function(_0x1528be,_0x25b30b,_0x550dee){odbc[_0x23e2('0x2b')](_0x1528be,function(_0x5622f6){if(_0x5622f6){logger[_0x23e2('0x2c')](_0x23e2('0x2d'),_0x5622f6);_0x550dee(_0x5622f6);}else{logger['info'](_0x23e2('0x2e'));odbc['query'](_0x25b30b,function(_0x532e41,_0x11ed36){if(_0x532e41){logger[_0x23e2('0x2f')](_0x23e2('0x30'),_0x25b30b);_0x550dee(_0x532e41);}else{logger['info'](_0x23e2('0x31'),_0x25b30b);odbc[_0x23e2('0x32')](function(_0x37f415){if(_0x37f415){logger['error'](_0x23e2('0x33'),_0x37f415);}_0x550dee(null,_0x11ed36);});}});}});};AGIVertices[_0x23e2('0x10')]['getSmsAccount']=function(_0x22c24e,_0x94ee88){this[_0x23e2('0xe')][_0x23e2('0x34')](_0x22c24e)[_0x23e2('0x13')](function(_0x19e6d7){_0x94ee88(null,_0x19e6d7?_0x19e6d7:![]);})[_0x23e2('0x17')](function(_0x3fe91c){_0x94ee88(_0x3fe91c);});};AGIVertices[_0x23e2('0x10')]['createSmsMessage']=function(_0x256ab6,_0x26bb2a){this['rpc']['createSmsMessage'](_0x256ab6)['then'](function(_0x1407ac){_0x26bb2a(null,_0x1407ac);})[_0x23e2('0x17')](function(_0x1db2e2){_0x26bb2a(_0x1db2e2);});};AGIVertices[_0x23e2('0x10')]['createSquareDetailsReport']=function(_0xe6122,_0x533493,_0x1f6ed6){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x23e2('0xd')][_0x23e2('0x35')],'node':_0xe6122[_0x23e2('0x36')],'application':_0xe6122[_0x23e2('0x37')],'data':_0x533493||null,'project_name':this[_0x23e2('0xd')][_0x23e2('0x38')],'callerid':this[_0x23e2('0xd')]['callerid']})[_0x23e2('0x13')](function(_0x5ed3f8){if(_0x1f6ed6){_0x1f6ed6(null,_0x5ed3f8);}})[_0x23e2('0x17')](function(_0x6e9564){if(_0x1f6ed6){_0x1f6ed6(_0x6e9564);}});};AGIVertices[_0x23e2('0x10')]['createSquareRecording']=function(_0x1b1396,_0x91be39,_0x2eb96c,_0x518a7d){this['rpc'][_0x23e2('0x39')]({'uniqueid':this['channel'][_0x23e2('0x35')],'callerid':this['channel'][_0x23e2('0x3a')],'calleridname':this[_0x23e2('0xd')][_0x23e2('0x3b')],'context':this[_0x23e2('0xd')][_0x23e2('0x3c')],'extension':this['channel']['extension'],'priority':this['channel'][_0x23e2('0x3d')],'accountcode':this[_0x23e2('0xd')][_0x23e2('0x3e')],'dnid':this[_0x23e2('0xd')]['dnid'],'projectName':this[_0x23e2('0xd')]['arg_1'],'saveName':_0x91be39,'filename':_0x1b1396[_0x23e2('0x3f')]||_0x91be39,'savePath':_0x2eb96c})['then'](function(_0x4b40cb){_0x518a7d(null,_0x4b40cb);})[_0x23e2('0x17')](function(_0x4b9dd8){_0x518a7d(_0x4b9dd8);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x40')]=function(_0x53470f,_0x4028c8,_0x351b5d){this[_0x23e2('0xe')][_0x23e2('0x40')]({'uniqueid':this[_0x23e2('0xd')][_0x23e2('0x35')],'body':_0x53470f,'direction':_0x4028c8})[_0x23e2('0x13')](function(_0x83c9b5){if(_0x351b5d){_0x351b5d(null,_0x83c9b5);}})[_0x23e2('0x17')](function(_0x3bec63){if(_0x351b5d){_0x351b5d(_0x3bec63);}});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x41')]=function(_0x3f3443,_0x2d6ab2){this[_0x23e2('0xe')][_0x23e2('0x41')]({'firstName':_['isEmpty'](_0x3f3443['name'])||_[_0x23e2('0x42')](_0x3f3443[_0x23e2('0x14')])?_0x23e2('0x43')+Math[_0x23e2('0x44')]():_0x3f3443[_0x23e2('0x14')],'lastName':_[_0x23e2('0x45')](_0x3f3443['lastName'])||_[_0x23e2('0x42')](_0x3f3443['lastName'])?null:_0x3f3443[_0x23e2('0x46')],'phone':_0x3f3443[_0x23e2('0x47')],'ListId':_0x3f3443[_0x23e2('0x48')],'scheduledat':_0x3f3443[_0x23e2('0x49')],'callbackUniqueid':this[_0x23e2('0xd')][_0x23e2('0x35')],'tags':_0x23e2('0x4a'),'description':_0x23e2('0x4b')+_0x3f3443['scheduledAt']['toString'](),'priority':_0x3f3443['callback_priority']})['then'](function(_0x57d5f6){_0x2d6ab2(null,_0x57d5f6);})['catch'](function(_0x17eb52){_0x2d6ab2(_0x17eb52);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x4c')]=function(_0x3c1308,_0x3498b8){this['rpc'][_0x23e2('0x4d')](_0x3c1308)[_0x23e2('0x13')](function(_0x1406c7){_0x3498b8(null,_0x1406c7?_0x1406c7[_0x23e2('0x14')]:![]);})[_0x23e2('0x17')](function(_0x32e9d6){_0x3498b8(_0x32e9d6);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x4e')]=function(_0x25b3b9,_0x4ff6ca,_0x5656d6){var _0x1aaece={'role':_0x23e2('0x4f')};_0x1aaece[_0x25b3b9]=this['channel'][_0x23e2('0x3a')];this[_0x23e2('0xe')][_0x23e2('0x4e')](_0x1aaece,_0x4ff6ca,this['channel'][_0x23e2('0x35')])[_0x23e2('0x13')](function(_0x371d6a){_0x5656d6(null,_[_0x23e2('0x42')](_0x371d6a)?![]:!![]);})[_0x23e2('0x17')](function(_0x382b3d){logger[_0x23e2('0x2c')](_0x382b3d);_0x5656d6(null,![]);});};AGIVertices[_0x23e2('0x10')]['agentUnpause']=function(_0x655129,_0x209188){var _0x42ae7d={'role':'agent'};_0x42ae7d[_0x655129]=this['channel']['callerid'];this[_0x23e2('0xe')][_0x23e2('0x50')](_0x42ae7d)['then'](function(_0x191694){_0x209188(null,_[_0x23e2('0x42')](_0x191694)?![]:!![]);})['catch'](function(_0x8edbc3){logger[_0x23e2('0x2c')](_0x8edbc3);_0x209188(null,![]);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x51')]=function(_0x32da80,_0x4f6ffc){var _0x423a10={'role':_0x23e2('0x4f')};_0x423a10[_0x32da80]=this[_0x23e2('0xd')][_0x23e2('0x3a')];this['rpc'][_0x23e2('0x51')](_0x423a10)['then'](function(_0x4667e5){_0x4f6ffc(null,_[_0x23e2('0x42')](_0x4667e5)?![]:!![]);})[_0x23e2('0x17')](function(_0x22b2a0){logger[_0x23e2('0x2c')](_0x22b2a0);_0x4f6ffc(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x5223f0,_0x3e42c5){var _0x9c7b3c={'role':_0x23e2('0x4f')};_0x9c7b3c[_0x5223f0]=this['channel'][_0x23e2('0x3a')];var _0x49dbe6=_0x5223f0!=_0x23e2('0x52')?util['format'](_0x23e2('0x53'),_0x23e2('0x54'),this['channel'][_0x23e2('0x3a')]):undefined;this[_0x23e2('0xe')][_0x23e2('0x55')](_0x9c7b3c,_0x49dbe6)[_0x23e2('0x13')](function(_0x3e87a5){_0x3e42c5(null,_[_0x23e2('0x42')](_0x3e87a5)?![]:!![]);})[_0x23e2('0x17')](function(_0x291f6f){logger[_0x23e2('0x2c')](_0x291f6f);_0x3e42c5(null,![]);});};AGIVertices['prototype'][_0x23e2('0x56')]=function(_0x9e6a2e,_0x2c9991){sh[_0x23e2('0x57')](_[_0x23e2('0x58')](_0x9e6a2e),function(_0x550102,_0x461ae2){var _0x3ff5b5=_0x461ae2[_0x23e2('0x59')](/(\r\n|\n|\r)/gm,'');_0x2c9991(null,_0x3ff5b5);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x5a')]=function(_0x5f0fd6,_0x1be2d5){scripts[_0x23e2('0x5a')](_0x5f0fd6[_0x23e2('0x5b')],_0x5f0fd6[_0x23e2('0x5c')]||_0x23e2('0x5d'),_0x5f0fd6[_0x23e2('0x5d')],_0x5f0fd6[_0x23e2('0x5e')]||_0x23e2('0x5f'),_0x5f0fd6['ssmlGender']||'MALE',_0x5f0fd6[_0x23e2('0x60')]||_0x23e2('0x61'))[_0x23e2('0x13')](function(_0x1020c2){_0x1be2d5(null,_0x1020c2);})[_0x23e2('0x17')](function(_0x3e8f78){_0x1be2d5(_0x3e8f78);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x62')]=function(_0x151ed2,_0x48f924){scripts[_0x23e2('0x62')](_0x151ed2[_0x23e2('0x5d')],_0x151ed2['google_tts_language']||'en',0x1)['then'](function(_0x579276){_0x48f924(null,_0x579276);})['catch'](function(_0x513d72){_0x48f924(_0x513d72);});};AGIVertices['prototype']['restAPI']=function(_0x598d81,_0x3ea1e4){var _0x57d231={'uri':_0x598d81[_0x23e2('0x63')],'method':_0x598d81[_0x23e2('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x598d81[_0x23e2('0x65')])==='number'&&parseInt(_0x598d81[_0x23e2('0x65')])>=0x1?parseInt(_0x598d81[_0x23e2('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x23e2('0x66')]([_0x23e2('0x67'),_0x23e2('0x68')],_0x57d231[_0x23e2('0x64')]['toUpperCase']())){try{_0x57d231[_0x23e2('0x69')]=_0x598d81['rawBody']?JSON[_0x23e2('0x6a')](_0x598d81[_0x23e2('0xa')]):{};}catch(_0x1ef01f){logger[_0x23e2('0x2c')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1ef01f);}}try{_0x57d231[_0x23e2('0x6b')]=_0x598d81[_0x23e2('0x6c')]?JSON['parse'](_0x598d81[_0x23e2('0x6c')]):{};}catch(_0x37b7e1){logger[_0x23e2('0x2c')](_0x23e2('0x6d'),_0x37b7e1);}if(_0x598d81['computedVariables']){try{var _0x2910c2=require(_0x598d81['computedVariables'])[_0x23e2('0x6e')](this,_0x57d231);_0x57d231[_0x23e2('0x6f')]=Mustache['render'](_0x598d81[_0x23e2('0x63')],_0x2910c2,{},['$$','$$']);if(_0x57d231[_0x23e2('0x6b')]){_0x57d231[_0x23e2('0x6b')]=JSON[_0x23e2('0x6a')](Mustache[_0x23e2('0x70')](JSON[_0x23e2('0x71')](_0x57d231[_0x23e2('0x6b')]),_0x2910c2,{},['$$','$$']));}if(_0x57d231[_0x23e2('0x69')]){_0x57d231[_0x23e2('0x69')]=JSON['parse'](Mustache[_0x23e2('0x70')](JSON['stringify'](_0x57d231[_0x23e2('0x69')]),_0x2910c2,{},['$$','$$']));}}catch(_0x59cbe2){logger[_0x23e2('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x59cbe2);}}rp(_0x57d231)[_0x23e2('0x13')](function(_0x26de25){var _0x50fb17={'statusCode':_0x26de25[_0x23e2('0x72')]||0xc8,'statusMessage':_0x26de25[_0x23e2('0x73')]||'OK','headers':_0x26de25[_0x23e2('0x6b')]||{},'body':_0x26de25[_0x23e2('0x69')]||{}};_0x3ea1e4(null,_0x50fb17);})['catch'](function(_0x5f31dc){var _0x49412a={'statusCode':_0x5f31dc['statusCode']||0x1f4,'statusMessage':_0x5f31dc[_0x23e2('0x74')]||_0x23e2('0x75'),'headers':_0x5f31dc['options'][_0x23e2('0x6b')]||{},'body':_0x5f31dc['options'][_0x23e2('0x69')]||{}};_0x3ea1e4(null,_0x49412a);});};AGIVertices['prototype'][_0x23e2('0x76')]=function(_0x4c5bf7,_0x1be617){scripts[_0x23e2('0x76')](this['channel'][_0x23e2('0x35')],_0x4c5bf7['key'],_0x4c5bf7[_0x23e2('0x5d')],_0x4c5bf7[_0x23e2('0x77')]||'en')[_0x23e2('0x13')](function(_0x5d39fb){_0x1be617(null,_0x5d39fb);})[_0x23e2('0x17')](function(_0x5ce2f4){_0x1be617(_0x5ce2f4);});};AGIVertices['prototype']['sestekNDA']=function(_0x34b380,_0x5b41cb){scripts[_0x23e2('0x78')](this[_0x23e2('0xd')],_0x34b380)['then'](function(_0x35a1b3){_0x5b41cb(null,_0x35a1b3);})[_0x23e2('0x17')](function(_0x2457de){_0x5b41cb(_0x2457de);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x79')]=function(_0x564199,_0xa46185){scripts[_0x23e2('0x79')](_0x564199[_0x23e2('0x7a')],_0x564199['text'],_0x564199[_0x23e2('0x7b')]||_0x23e2('0x5f'),_0x564199[_0x23e2('0x7c')])[_0x23e2('0x13')](function(_0x218345){_0xa46185(null,_0x218345);})[_0x23e2('0x17')](function(_0x4bc512){_0xa46185(_0x4bc512);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x7d')]=function(_0x356a21,_0x117d36,_0x4a5172){scripts['ispeechASR'](_0x117d36,_0x356a21['key'],_0x356a21['ispeech_asr_language']||_0x23e2('0x5f'),this[_0x23e2('0x7e')](_0x356a21['model'])?_0x356a21[_0x23e2('0x7f')]:undefined)[_0x23e2('0x13')](function(_0x5ddad2){_0x4a5172(null,_0x5ddad2);})[_0x23e2('0x17')](function(_0x46558f){_0x4a5172(_0x46558f);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x80')]=function(_0x4ba24e,_0x19ac01){scripts[_0x23e2('0x80')](_0x4ba24e['aws_access_key_id'],_0x4ba24e['aws_secret_access_key'],_0x4ba24e[_0x23e2('0x81')],_0x4ba24e['aws_polly_voice']||_0x23e2('0x82'),_0x4ba24e[_0x23e2('0x5d')],_0x4ba24e[_0x23e2('0x83')]||_0x23e2('0x5d'))['then'](function(_0x4d76d0){_0x19ac01(null,_0x4d76d0);})[_0x23e2('0x17')](function(_0x417b46){_0x19ac01(_0x417b46);});};AGIVertices[_0x23e2('0x10')]['awsLex']=function(_0xa81e6d,_0x50f3c1){scripts['awsLex'](this[_0x23e2('0xd')][_0x23e2('0x35')],_0xa81e6d['aws_access_key_id'],_0xa81e6d[_0x23e2('0x84')],_0xa81e6d[_0x23e2('0x85')],_0xa81e6d[_0x23e2('0x5d')],_0xa81e6d[_0x23e2('0x86')])[_0x23e2('0x13')](function(_0x1c7c13){_0x50f3c1(null,_0x1c7c13);})[_0x23e2('0x17')](function(_0x5f57c3){_0x50f3c1(_0x5f57c3);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x87')]=function(_0x17d5fe,_0x2b2d28,_0x56c241){scripts[_0x23e2('0x87')](_0x2b2d28,_0x17d5fe[_0x23e2('0x7a')],_0x17d5fe[_0x23e2('0x88')]||'en-US')[_0x23e2('0x13')](function(_0x441cf8){_0x56c241(null,_0x441cf8);})[_0x23e2('0x17')](function(_0x7e6476){_0x56c241(_0x7e6476);});};AGIVertices[_0x23e2('0x10')]['tildeASR']=function(_0x192eee,_0x3d59a3,_0x5c17fb){scripts[_0x23e2('0x89')](_0x3d59a3,_0x192eee[_0x23e2('0x8a')],_0x192eee[_0x23e2('0x8b')],_0x192eee[_0x23e2('0x6f')])[_0x23e2('0x13')](function(_0x4e42f2){_0x5c17fb(null,_0x4e42f2);})['catch'](function(_0x5ea219){_0x5c17fb(_0x5ea219);});};AGIVertices[_0x23e2('0x10')][_0x23e2('0x8c')]=function(_0x328ffe){var _0x4f9378=_[_0x23e2('0x66')](verticesWithRetry,_0x328ffe[_0x23e2('0x37')])?_0x328ffe:_[_0x23e2('0x8d')](_0x328ffe);for(var _0x4fd067 in _0x4f9378){if(_0x4f9378[_0x23e2('0x8e')](_0x4fd067)){if(_0x4f9378[_0x4fd067]&&_[_0x23e2('0x8f')](_0x4f9378[_0x4fd067])){if(_['includes'](recursiveMapAttributes,_0x4fd067)){_0x4f9378[_0x4fd067]=this[_0x23e2('0x90')](_0x4f9378[_0x4fd067]);}else{_0x4f9378[_0x4fd067]=this[_0x23e2('0x91')](_0x4f9378[_0x4fd067]);}}}}return _0x4f9378;};AGIVertices[_0x23e2('0x10')][_0x23e2('0x92')]=function(_0x2fd29f){for(var _0xf99f9d in _0x2fd29f){if(_0x2fd29f[_0x23e2('0x8e')](_0xf99f9d)){if(_['isPlainObject'](_0x2fd29f[_0xf99f9d])){this[_0x23e2('0x92')](_0x2fd29f[_0xf99f9d]);}else if(_[_0x23e2('0x93')](_0x2fd29f[_0xf99f9d])){for(var _0x3c9a0e=0x0;_0x3c9a0e<_0x2fd29f[_0xf99f9d][_0x23e2('0x94')];_0x3c9a0e++){this[_0x23e2('0x92')](_0x2fd29f[_0xf99f9d][_0x3c9a0e]);}}else if(_[_0x23e2('0x8f')](_0x2fd29f[_0xf99f9d])){_0x2fd29f[_0xf99f9d]=this[_0x23e2('0x91')](_0x2fd29f[_0xf99f9d]);}}}};AGIVertices[_0x23e2('0x10')][_0x23e2('0x95')]=function(_0x3a7d4b,_0x57686e){for(var _0x549bdf in _0x3a7d4b){if(_0x3a7d4b[_0x23e2('0x8e')](_0x549bdf)){if(_[_0x23e2('0x96')](_0x3a7d4b[_0x549bdf])){if(!_[_0x23e2('0x45')](_0x3a7d4b[_0x549bdf])){this['saveRestApiResult'](_0x3a7d4b[_0x549bdf],util[_0x23e2('0x29')](_0x23e2('0x97'),_0x57686e,_0x549bdf));}}else if(_['isArray'](_0x3a7d4b[_0x549bdf])){for(var _0x38a0fb=0x0;_0x38a0fb<_0x3a7d4b[_0x549bdf][_0x23e2('0x94')];_0x38a0fb++){this[_0x23e2('0x95')](_0x3a7d4b[_0x549bdf][_0x38a0fb],util[_0x23e2('0x29')]('%s.%s',_0x57686e,_0x549bdf+'['+_0x38a0fb+']'));}}else{if(!_['isNil'](_0x3a7d4b[_0x549bdf])){this['channel']['setVariable'](util[_0x23e2('0x29')](_0x23e2('0x97'),_0x57686e,_0x549bdf),_0x3a7d4b[_0x549bdf]);}}}}};AGIVertices[_0x23e2('0x10')]['replaceObjectAllVariables']=function(_0x2917a8){try{var _0x302557=JSON[_0x23e2('0x6a')](_0x2917a8);this[_0x23e2('0x92')](_0x302557);return JSON[_0x23e2('0x71')](_0x302557);}catch(_0x51cc1e){return this[_0x23e2('0x91')](_0x2917a8);}};AGIVertices[_0x23e2('0x10')][_0x23e2('0x91')]=function(_0x498cdf){var _0x129799=_0x498cdf[_0x23e2('0x98')]('{');for(var _0x57ffbe=0x1;_0x57ffbe<_0x129799[_0x23e2('0x94')];_0x57ffbe+=0x1){var _0x2bd355=_0x129799[_0x57ffbe][_0x23e2('0x98')]('}');if(_0x2bd355[_0x23e2('0x94')]>0x1){_0x498cdf=_0x498cdf[_0x23e2('0x99')]('{'+_0x2bd355[0x0]+'}',this[_0x23e2('0xd')]['getVariable'](_0x2bd355[0x0])['extra']||_0x2bd355[0x0]);}}if(_0x129799[_0x23e2('0x94')]===0x1){return _0x498cdf[_0x23e2('0x9a')]();}return this['replaceAllVariables'](_0x498cdf);};AGIVertices[_0x23e2('0x10')][_0x23e2('0x9b')]=function(_0x4bd511,_0x2645f3){var _0x3790c8=this[_0x23e2('0xd')][_0x23e2('0x11')](_0x4bd511);if(_0x3790c8['result']===-0x1){return _0x3790c8;}logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x9c'),_0x2645f3,_0x3790c8[_0x23e2('0x9d')]));return this[_0x23e2('0xd')][_0x23e2('0x9e')](_0x2645f3,_0x3790c8[_0x23e2('0x9d')]);};AGIVertices[_0x23e2('0x10')]['isConfigured']=function(_0x27d202){return _0x27d202&&_0x27d202!=='0'&&_0x27d202!=='-1'&&_0x27d202!=='';};AGIVertices[_0x23e2('0x10')]['maxRetry']=function(_0x5d6cca){this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x5d6cca,'-');_0x5d6cca['retry']=_0x5d6cca[_0x23e2('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x23e2('0x10')][_0x23e2('0xa1')]=function(_0x1cabd4){logger['info'](util[_0x23e2('0x29')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x1cabd4[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x1cabd4[_0x23e2('0x5d')])){return this['channel']['noop'](_0x23e2('0xa2'));}var _0x2e0ff1='\x22'+_0x1cabd4[_0x23e2('0x5d')]+'\x22';if(this[_0x23e2('0x7e')](_0x1cabd4[_0x23e2('0xa3')])){_0x2e0ff1+=','+_0x1cabd4[_0x23e2('0xa3')];}var _0x5782bd=this[_0x23e2('0xd')]['exec'](_0x23e2('0xa4'),_0x2e0ff1);if(_0x5782bd[_0x23e2('0xa5')]===-0x1){return _0x5782bd;}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util['format'](_0x23e2('0xa7'),_0x2e0ff1));};AGIVertices[_0x23e2('0x10')][_0x23e2('0xa8')]=function(_0x36fe81){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x36fe81[_0x23e2('0x36')]));if(!this['isConfigured'](_0x36fe81['grammar'])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xa9'));}var _0x296e43=_0x36fe81[_0x23e2('0xaa')];if(this[_0x23e2('0x7e')](_0x36fe81[_0x23e2('0xa3')])){_0x296e43+=','+_0x36fe81[_0x23e2('0xa3')];}var _0xcc8728=this[_0x23e2('0xd')][_0x23e2('0x57')](_0x23e2('0xab'),_0x296e43);if(_0xcc8728[_0x23e2('0xa5')]===-0x1){return _0xcc8728;}var _0x85736b=this[_0x23e2('0x9b')](_0x23e2('0xac'),_0x23e2('0xad'));if(_0x85736b[_0x23e2('0xa5')]===-0x1){return _0x85736b;}var _0x58f84a=this['getAndSetVariable']('RECOG_INPUT()',_0x23e2('0xae'));if(_0x58f84a[_0x23e2('0xa5')]===-0x1){return _0x58f84a;}var _0x2c7efa=this['getAndSetVariable'](_0x23e2('0xaf'),_0x23e2('0xb0'));if(_0x2c7efa[_0x23e2('0xa5')]===-0x1){return _0x2c7efa;}return this['channel'][_0x23e2('0xa6')](util['format'](_0x23e2('0xb1'),_0x296e43));};AGIVertices[_0x23e2('0x10')]['agi']=function(_0x324400){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0xb2'),_0x324400[_0x23e2('0x36')]));return this['channel'][_0x23e2('0xb3')]([_0x324400['command'],_0x324400[_0x23e2('0xb4')]]);};AGIVertices['prototype'][_0x23e2('0xb5')]=function(_0x28bc8f){logger['info'](util[_0x23e2('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x28bc8f['label']));if(this['isConfigured'](_0x28bc8f[_0x23e2('0x65')])){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0xb6'),_0x28bc8f[_0x23e2('0x65')]));var _0x4613fa=this[_0x23e2('0xd')]['wait'](_0x28bc8f['timeout']);if(_0x4613fa['result']===-0x1){return _0x4613fa;}}return this[_0x23e2('0xd')][_0x23e2('0xb5')]();};AGIVertices[_0x23e2('0x10')][_0x23e2('0x4a')]=function(_0x2a7519){logger['info'](util[_0x23e2('0x29')](_0x23e2('0xb7'),_0x2a7519[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x2a7519[_0x23e2('0x48')])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x2a7519,'no\x20list\x20selected');}_0x2a7519['scheduledAt']=moment();if(this['isConfigured'](_0x2a7519['delay'])){_0x2a7519[_0x23e2('0x49')]=moment()['add'](_0x2a7519[_0x23e2('0xb8')],_0x23e2('0xb9'));}if(!this[_0x23e2('0x7e')](_0x2a7519['callback_priority'])){_0x2a7519[_0x23e2('0xba')]=0x2;}this[_0x23e2('0x41')][_0x23e2('0x6e')](this,_0x2a7519);return this[_0x23e2('0xd')]['noop'](util[_0x23e2('0x29')](_0x23e2('0xbb'),_0x2a7519['phone'],_0x2a7519['list_id'],_0x2a7519[_0x23e2('0x49')]));};AGIVertices[_0x23e2('0x10')][_0x23e2('0xbc')]=function(_0x2c1b69){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0xbd'),_0x2c1b69[_0x23e2('0x36')]));var _0xed4d19=this[_0x23e2('0xd')]['exec'](_0x2c1b69[_0x23e2('0xbe')],_0x2c1b69[_0x23e2('0xa3')]);if(_0xed4d19[_0x23e2('0xa5')]===-0x1){return _0xed4d19;}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xbf'),_0x2c1b69['application'],_0x2c1b69[_0x23e2('0xa3')]));};AGIVertices[_0x23e2('0x10')][_0x23e2('0xc0')]=function(_0x5a8f37){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0xc1'),_0x5a8f37[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x5a8f37['text'])){return this[_0x23e2('0xd')][_0x23e2('0xa6')]('no\x20text\x20configured');}var _0x7613b2='\x22'+_0x5a8f37[_0x23e2('0x5d')]+'\x22';if(this['isConfigured'](_0x5a8f37[_0x23e2('0xa3')])){_0x7613b2+=','+_0x5a8f37[_0x23e2('0xa3')];}var _0x4fc147=this[_0x23e2('0xd')][_0x23e2('0x57')](_0x23e2('0xa4'),_0x7613b2);if(_0x4fc147[_0x23e2('0xa5')]===-0x1){return _0x4fc147;}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x7613b2));};AGIVertices[_0x23e2('0x10')]['sestektts']=function(_0x59a719){logger['info'](util[_0x23e2('0x29')](_0x23e2('0xc2'),_0x59a719[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x59a719[_0x23e2('0x5d')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xa2'));}var _0x34953d='\x22'+_0x59a719[_0x23e2('0x5d')]+'\x22';if(this['isConfigured'](_0x59a719[_0x23e2('0xa3')])){_0x34953d+=','+_0x59a719['options'];}var _0x34403c=this[_0x23e2('0xd')]['exec'](_0x23e2('0xa4'),_0x34953d);if(_0x34403c['result']===-0x1){return _0x34403c;}return this['channel'][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xa7'),_0x34953d));};AGIVertices['prototype'][_0x23e2('0xc3')]=function(_0x3b250b){logger['info'](util[_0x23e2('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3b250b['label']));if(!this[_0x23e2('0x7e')](_0x3b250b[_0x23e2('0xaa')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xa9'));}var _0x4f1c3f=_0x3b250b[_0x23e2('0xaa')];if(this[_0x23e2('0x7e')](_0x3b250b[_0x23e2('0xa3')])){_0x4f1c3f+=','+_0x3b250b[_0x23e2('0xa3')];}var _0x1e917a=this[_0x23e2('0xd')][_0x23e2('0x57')](_0x23e2('0xab'),_0x4f1c3f);if(_0x1e917a[_0x23e2('0xa5')]===-0x1){return _0x1e917a;}var _0x3f25fa=this['getAndSetVariable'](_0x23e2('0xac'),_0x23e2('0xc4'));if(_0x3f25fa['result']===-0x1){return _0x3f25fa;}var _0x84acf3=this[_0x23e2('0x9b')](_0x23e2('0xc5'),_0x23e2('0xc6'));if(_0x84acf3['result']===-0x1){return _0x84acf3;}var _0x3cb10d=this[_0x23e2('0x9b')](_0x23e2('0xaf'),_0x23e2('0xc7'));if(_0x3cb10d[_0x23e2('0xa5')]===-0x1){return _0x3cb10d;}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xb1'),_0x4f1c3f));};AGIVertices[_0x23e2('0x10')][_0x23e2('0xc8')]=function(_0x518431){logger[_0x23e2('0x2f')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x518431[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x518431['grammar'])){return this['channel'][_0x23e2('0xa6')](_0x23e2('0xa9'));}var _0x3a2116=_0x518431['grammar'];if(this[_0x23e2('0x7e')](_0x518431['options'])){_0x3a2116+=','+_0x518431[_0x23e2('0xa3')];}var _0xdfc26e=this[_0x23e2('0xd')][_0x23e2('0x57')](_0x23e2('0xab'),_0x3a2116);if(_0xdfc26e[_0x23e2('0xa5')]===-0x1){return _0xdfc26e;}var _0x9d94ef=this[_0x23e2('0x9b')](_0x23e2('0xac'),_0x23e2('0xc9'));if(_0x9d94ef[_0x23e2('0xa5')]===-0x1){return _0x9d94ef;}var _0x203cf7=this[_0x23e2('0x9b')](_0x23e2('0xc5'),_0x23e2('0xca'));if(_0x203cf7['result']===-0x1){return _0x203cf7;}var _0x1825c8=this[_0x23e2('0x9b')](_0x23e2('0xaf'),'SESTEK_ASR_INSTANCE');if(_0x1825c8['result']===-0x1){return _0x1825c8;}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xb1'),_0x3a2116));};AGIVertices[_0x23e2('0x10')][_0x23e2('0xcb')]=function(_0x19351a){logger['info'](util[_0x23e2('0x29')](_0x23e2('0xcc'),_0x19351a[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x19351a[_0x23e2('0xcd')])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x19351a,_0x23e2('0xce'));}var _0x27bb9d=this[_0x23e2('0xcf')][_0x23e2('0x6e')](this,_0x19351a[_0x23e2('0xcd')]);if(!_0x27bb9d){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x19351a,_0x23e2('0xd0'));}if(!this[_0x23e2('0x7e')](_0x19351a[_0x23e2('0xd1')])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x19351a,_0x23e2('0xd2'));}var _0xa75e6d=_0x19351a['query'][_0x23e2('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x23e2('0xd')]['noop'](util['format'](_0x23e2('0xd3'),_0xa75e6d));var _0x1c59b0=this[_0x23e2('0x2a')][_0x23e2('0x6e')](this,_0x27bb9d,_0xa75e6d);this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x19351a,_0xa75e6d);if(!this['isConfigured'](_0x19351a[_0x23e2('0xd4')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xd5'));}var _0x1dbcdc=this['getVariable'][_0x23e2('0x6e')](this,_0x19351a[_0x23e2('0xd4')]);if(!_0x1dbcdc){return this[_0x23e2('0xd')]['error'](_0x19351a,_0x23e2('0xd6'));}var _0x158eed=this;_0x1c59b0[_0x23e2('0xd7')](function(_0x2aa7a3,_0x59e5f4){Object[_0x23e2('0xd8')](_0x2aa7a3)[_0x23e2('0xd7')](function(_0x1a9465){_0x158eed[_0x23e2('0xd')][_0x23e2('0x9e')](util['format'](_0x23e2('0xd9'),_0x1dbcdc,_0x59e5f4,_0x1a9465),_0x2aa7a3[_0x1a9465]);});});this[_0x23e2('0xd')][_0x23e2('0x9e')](util[_0x23e2('0x29')](_0x23e2('0xda'),_0x1dbcdc),_0x1c59b0[_0x23e2('0x94')]);return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xdb'),_0x1dbcdc));};AGIVertices[_0x23e2('0x10')][_0x23e2('0xdc')]=function(_0x408342){logger['debug'](util['format'](_0x23e2('0xdd'),_0x408342['label']));if(!this[_0x23e2('0x7e')](_0x408342[_0x23e2('0xde')])){return this['channel'][_0x23e2('0x2c')](_0x408342,_0x23e2('0xdf'));}var _0x3dcaef=this[_0x23e2('0x1b')][_0x23e2('0x6e')](this,_0x408342[_0x23e2('0xde')]);if(!_0x3dcaef){return this['channel'][_0x23e2('0x2c')](_0x408342,_0x23e2('0xe0'));}var _0x2ec9b0=this[_0x23e2('0xd')][_0x23e2('0x57')](_0x23e2('0xe1'),[util[_0x23e2('0x29')](_0x23e2('0xe2'),_0x3dcaef),_0x408342['timeout'],_0x408342['opts'],_0x408342['url']]);if(_0x2ec9b0['result']===-0x1){return _0x2ec9b0;}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util['format'](_0x23e2('0xe3'),_0x23e2('0xe1')));};AGIVertices[_0x23e2('0x10')][_0x23e2('0xe4')]=function(_0x7992be){logger['info'](util['format'](_0x23e2('0xe5'),_0x7992be['label']));if(!this['isConfigured'](_0x7992be[_0x23e2('0x7a')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')]('no\x20key\x20configured');}if(!this[_0x23e2('0x7e')](_0x7992be['text'])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xa2'));}this[_0x23e2('0xd')][_0x23e2('0xe6')]=!![];this[_0x23e2('0x9f')](_0x7992be);this[_0x23e2('0x40')](_0x7992be[_0x23e2('0x5d')],'in');this['channel'][_0x23e2('0xa6')](util['format']('Trying\x20Dialogflow:\x20%s',_0x7992be['text']));var _0x4d8b5a=this[_0x23e2('0x76')][_0x23e2('0x6e')](this,_0x7992be);if(_0x4d8b5a){for(var _0x10ae66 in _0x4d8b5a){if(_0x4d8b5a[_0x23e2('0x8e')](_0x10ae66)){this[_0x23e2('0xd')][_0x23e2('0x9e')](util[_0x23e2('0x29')](_0x23e2('0xe7'),_0x10ae66[_0x23e2('0xe8')]()),_0x4d8b5a[_0x10ae66]);}}this['createSquareMessage'](_0x4d8b5a[_0x23e2('0xe9')],_0x23e2('0xea'));return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xeb'),_0x4d8b5a[_0x23e2('0xe9')]));}return this['channel']['error'](_0x7992be,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x23e2('0x10')][_0x23e2('0xec')]=function(_0x34ee2e){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0xed'),_0x34ee2e['label']));if(!this[_0x23e2('0x7e')](_0x34ee2e[_0x23e2('0xee')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xef'));}if(!this[_0x23e2('0x7e')](_0x34ee2e[_0x23e2('0xf0')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xf1'));}if(!this[_0x23e2('0x7e')](_0x34ee2e['password'])){return this['channel']['noop']('no\x20password\x20configured');}if(!this[_0x23e2('0x7e')](_0x34ee2e[_0x23e2('0xf2')])){return this[_0x23e2('0xd')]['noop'](_0x23e2('0xa2'));}this[_0x23e2('0xd')][_0x23e2('0xe6')]=!![];this[_0x23e2('0x9f')](_0x34ee2e);this[_0x23e2('0x40')](_0x34ee2e[_0x23e2('0x5d')],'in');this[_0x23e2('0xd')]['noop'](util[_0x23e2('0x29')](_0x23e2('0xf3'),_0x34ee2e[_0x23e2('0x5d')]));var _0x5a902e=this[_0x23e2('0x78')][_0x23e2('0x6e')](this,_0x34ee2e);if(_0x5a902e){for(var _0x36dcb1 in _0x5a902e){if(_0x5a902e['hasOwnProperty'](_0x36dcb1)){this[_0x23e2('0xd')][_0x23e2('0x9e')](util[_0x23e2('0x29')](_0x23e2('0xf4'),_0x36dcb1['toUpperCase']()),_0x5a902e[_0x36dcb1]);}}this[_0x23e2('0x40')](_0x5a902e[_0x23e2('0xe9')],_0x23e2('0xea'));if(_0x5a902e['audiofile']){this['channel'][_0x23e2('0xa6')](util[_0x23e2('0x29')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5a902e['audiofile']));var _0x1e6c77=this[_0x23e2('0xd')][_0x23e2('0xf5')](_0x5a902e[_0x23e2('0xf6')]);try{fs[_0x23e2('0xf7')](_0x5a902e[_0x23e2('0xf6')]+_0x23e2('0xf8'));}catch(_0x191eb9){logger[_0x23e2('0x2c')](_0x191eb9);}return _0x1e6c77;}else{return this[_0x23e2('0xd')][_0x23e2('0xa6')](util['format'](_0x23e2('0xf9'),_0x5a902e[_0x23e2('0xe9')]));}}return this[_0x23e2('0xd')]['error'](_0x34ee2e,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x23e2('0xfa')]=function(_0x13bcd8){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0xfb'),_0x13bcd8['label']));return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xfa'));};AGIVertices[_0x23e2('0x10')]['ext_dial']=function(_0xe219b8){logger[_0x23e2('0x2f')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe219b8[_0x23e2('0x36')]));var _0x17b221='';if(_0xe219b8['trunk_id']){if(!this[_0x23e2('0x7e')](_0xe219b8['trunk_id'])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0xe219b8,_0x23e2('0xfc'));}else{var _0x53f8d8=parseInt(_0xe219b8[_0x23e2('0xfd')],0xa);if(isNaN(_0x53f8d8)){_0x17b221=_0xe219b8[_0x23e2('0xfd')];}else{_0x17b221=this[_0x23e2('0x1c')][_0x23e2('0x6e')](this,_0xe219b8['trunk_id']);if(!_0x17b221){return this['channel']['error'](_0xe219b8,_0x23e2('0xfe'));}}}}else if(_0xe219b8['trunk_name']){_0x17b221=_0xe219b8[_0x23e2('0xff')];}else{return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0xe219b8,'no\x20trunk\x20selected');}var _0x3c16bf=this[_0x23e2('0xd')]['exec']('DIAL',[util[_0x23e2('0x29')]('SIP/%s/%s',_0x17b221,_0xe219b8[_0x23e2('0x47')]),_0xe219b8[_0x23e2('0x65')],_0xe219b8[_0x23e2('0x100')],_0xe219b8[_0x23e2('0x63')]]);if(_0x3c16bf[_0x23e2('0xa5')]===-0x1){return _0x3c16bf;}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xe3'),'DIAL'));};AGIVertices[_0x23e2('0x10')]['finally']=function(_0x68ad33){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x101'),_0x68ad33[_0x23e2('0x36')]));return this['channel']['noop']('finally');};AGIVertices[_0x23e2('0x10')][_0x23e2('0xc')]=function(_0x28890f){logger['info'](util['format'](_0x23e2('0x102'),_0x28890f[_0x23e2('0x36')]));if(_0x28890f[_0x23e2('0x103')]===0x0){return this['maxRetry'](_0x28890f);}_0x28890f[_0x23e2('0x103')]-=0x1;if(!this['isConfigured'](_0x28890f['file_id'])){return this['channel'][_0x23e2('0x2c')](_0x28890f,'no\x20file\x20audio\x20selected');}var _0x335412=this[_0x23e2('0x1d')][_0x23e2('0x6e')](this,_0x28890f[_0x23e2('0x104')]);if(!_0x335412){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x28890f,'no\x20file\x20audio\x20found');}if(!this[_0x23e2('0x7e')](_0x28890f['variable_id'])){return this[_0x23e2('0xd')][_0x23e2('0x2c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1a9026=this['channel']['getData'](_0x335412,_0x28890f['response'],_0x28890f['maxdigit']);var _0x9931de=_0x1a9026['result']?_0x1a9026[_0x23e2('0xa5')][_0x23e2('0x9a')]():'';logger['info'](_0x23e2('0x105'),JSON[_0x23e2('0x71')](_0x1a9026));if(_0x1a9026['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x28890f,_0x9931de);return _0x1a9026;}else if(_0x1a9026[_0x23e2('0x9d')]==='timeout'){_0x1a9026[_0x23e2('0xa5')]=_0x9931de[_0x23e2('0x94')]>=parseInt(_0x28890f[_0x23e2('0x106')])?'x':'i';}else{_0x1a9026[_0x23e2('0xa5')]=_0x9931de['length']>=parseInt(_0x28890f[_0x23e2('0x106')])&&_0x9931de[_0x23e2('0x94')]<=parseInt(_0x28890f[_0x23e2('0x107')])?'x':'i';}var _0x443a1b=this[_0x23e2('0x11')]['sync'](this,_0x28890f[_0x23e2('0xd4')]);if(!_0x443a1b){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x28890f,'no\x20variable\x20found');}this[_0x23e2('0xd')]['setVariable'](_0x443a1b,_0x9931de);if(this[_0x23e2('0x7e')](_0x28890f['hiddendigitsnum'])){var _0x2583de=parseInt(_0x28890f['hiddendigitsnum'],0xa);var _0x35ddc2=rs['generate']({'charset':'*','length':_0x2583de});var _0x2eb300=_0x9931de['length'];if(_0x2eb300>0x0){if(_0x2eb300>_0x2583de){this['createSquareDetailsReport']['sync'](this,_0x28890f,_0x28890f[_0x23e2('0x108')]==='first'?_0x35ddc2+_0x9931de['substr'](_0x2583de):_0x9931de[_0x23e2('0x109')](0x0,_0x2eb300-_0x2583de)+_0x35ddc2);}else{this[_0x23e2('0x9f')]['sync'](this,_0x28890f,rs[_0x23e2('0x10a')]({'charset':'*','length':_0x2eb300}));}}else{this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x28890f,'');}}else{this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x28890f,_0x9931de);}return _0x1a9026;};AGIVertices['prototype'][_0x23e2('0x10b')]=function(_0x2361f3){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x10c'),_0x2361f3['label']));return this[_0x23e2('0xc')](_0x2361f3);};AGIVertices[_0x23e2('0x10')]['goal']=function(_0x160a0f){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x10d'),_0x160a0f[_0x23e2('0x36')]));this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x160a0f,_0x160a0f[_0x23e2('0x10e')]);return this[_0x23e2('0xd')]['noop'](util[_0x23e2('0x29')]('GOAL\x20%s',_0x160a0f[_0x23e2('0x10e')]));};AGIVertices[_0x23e2('0x10')]['awspolly']=function(_0x4c0ac1){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x10f'),_0x4c0ac1['label']));if(!this[_0x23e2('0x7e')](_0x4c0ac1[_0x23e2('0x110')])||!this['isConfigured'](_0x4c0ac1[_0x23e2('0x84')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0x111'));}if(!this[_0x23e2('0x7e')](_0x4c0ac1[_0x23e2('0x5d')])){return this['channel'][_0x23e2('0xa6')](_0x23e2('0xa2'));}this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')]('Trying\x20aws\x20Polly\x20%s',_0x4c0ac1[_0x23e2('0x5d')]));var _0xbf616c=this['awsPolly'][_0x23e2('0x6e')](this,_0x4c0ac1);if(_0xbf616c){this['channel'][_0x23e2('0xa6')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0xbf616c));var _0x359a9a=this[_0x23e2('0xd')][_0x23e2('0xf5')](_0xbf616c);try{fs['unlink'](_0xbf616c+_0x23e2('0xf8'));}catch(_0x5c1a6e){logger[_0x23e2('0x2c')](_0x5c1a6e);}return _0x359a9a;}return this[_0x23e2('0xd')]['error'](_0x4c0ac1,_0x23e2('0x112'));};AGIVertices['prototype'][_0x23e2('0x113')]=function(_0xa44398){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x114'),_0xa44398[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0xa44398[_0x23e2('0x110')])||!this[_0x23e2('0x7e')](_0xa44398[_0x23e2('0x84')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0x111'));}if(!this[_0x23e2('0x7e')](_0xa44398[_0x23e2('0x86')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0x115'));}if(!this[_0x23e2('0x7e')](_0xa44398[_0x23e2('0x5d')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xa2'));}this['channel'][_0x23e2('0xe6')]=!![];this[_0x23e2('0x9f')](_0xa44398);this[_0x23e2('0x40')](_0xa44398[_0x23e2('0x5d')],'in');this['channel']['noop'](util[_0x23e2('0x29')](_0x23e2('0x116'),_0xa44398[_0x23e2('0x5d')]));var _0x356fa5=this[_0x23e2('0x117')][_0x23e2('0x6e')](this,_0xa44398);if(_0x356fa5){for(var _0x5e7d11 in _0x356fa5){if(_0x356fa5['hasOwnProperty'](_0x5e7d11)&&_['isString'](_0x356fa5[_0x5e7d11])){this[_0x23e2('0xd')][_0x23e2('0x9e')](util[_0x23e2('0x29')](_0x23e2('0x118'),_0x5e7d11['toUpperCase']()),_0x356fa5[_0x5e7d11]);}}if(_[_0x23e2('0x42')](_0x356fa5[_0x23e2('0x74')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0x119'));}else{this[_0x23e2('0x40')](_0x356fa5[_0x23e2('0x74')],_0x23e2('0xea'));return this['channel'][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x11a'),_0x356fa5[_0x23e2('0x74')]));}}return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0xa44398,_0x23e2('0x11b'));};AGIVertices['prototype'][_0x23e2('0x11c')]=function(_0x55c1b7){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x11d'),_0x55c1b7[_0x23e2('0x36')],_0x55c1b7['timeout']));if(!this[_0x23e2('0x7e')](_0x55c1b7[_0x23e2('0x7a')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')]('no\x20key\x20configured');}var _0x160018=_0x23e2('0x11e');var _0x614e2=util[_0x23e2('0x29')](_0x23e2('0x11f'),FILES_PATH,rs[_0x23e2('0x10a')](0x4));var _0x35980c=util[_0x23e2('0x29')]('%s.%s',_0x614e2,_0x160018);var _0x46bb39=!![];if(_0x55c1b7['beep']===_0x23e2('0x120')){_0x46bb39=![];}var _0x51523a=this[_0x23e2('0xd')][_0x23e2('0x121')](_0x614e2,_0x160018,_0x55c1b7[_0x23e2('0x122')],_0x55c1b7[_0x23e2('0x65')],undefined,_0x46bb39);if(_0x51523a[_0x23e2('0xa5')]!==-0x1){this['channel'][_0x23e2('0xa6')](util['format'](_0x23e2('0x123'),_0x35980c));var _0x93754c=this[_0x23e2('0x87')][_0x23e2('0x6e')](this,_0x55c1b7,_0x35980c);if(_0x93754c){for(var _0x3119c7 in _0x93754c){if(_0x93754c[_0x23e2('0x8e')](_0x3119c7)){this[_0x23e2('0xd')][_0x23e2('0x9e')](util[_0x23e2('0x29')](_0x23e2('0x124'),_0x3119c7['toUpperCase']()),_0x93754c[_0x3119c7]);}}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x125'),JSON[_0x23e2('0x71')](_0x93754c)));}}return _0x51523a;};AGIVertices['prototype'][_0x23e2('0x126')]=function(_0x487c8c){logger['info'](util[_0x23e2('0x29')](_0x23e2('0x127'),_0x487c8c['label']));if(!this[_0x23e2('0x7e')](_0x487c8c[_0x23e2('0x8a')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0x128'));}if(!this[_0x23e2('0x7e')](_0x487c8c['appsecret'])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x352f5a='wav';var _0x5eb22b=util['format'](_0x23e2('0x11f'),FILES_PATH,rs[_0x23e2('0x10a')](0x4));var _0x165969=util[_0x23e2('0x29')](_0x23e2('0x97'),_0x5eb22b,_0x352f5a);var _0x7f18b4=!![];if(_0x487c8c[_0x23e2('0x129')]===_0x23e2('0x120')){_0x7f18b4=![];}var _0x5b1183=this[_0x23e2('0xd')][_0x23e2('0x121')](_0x5eb22b,_0x352f5a,_0x487c8c[_0x23e2('0x122')],_0x487c8c['timeout'],undefined,_0x7f18b4);if(_0x5b1183[_0x23e2('0xa5')]!==-0x1){this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x12a'),_0x165969));var _0x1abeb3=this[_0x23e2('0x89')][_0x23e2('0x6e')](this,_0x487c8c,_0x165969);if(_0x1abeb3){for(var _0x364be4 in _0x1abeb3){if(_0x1abeb3[_0x23e2('0x8e')](_0x364be4)){this[_0x23e2('0xd')]['setVariable'](util['format']('TILDE_ASR_%s',_0x364be4[_0x23e2('0xe8')]()),_0x1abeb3[_0x364be4]);}}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x12b'),JSON[_0x23e2('0x71')](_0x1abeb3)));}}return _0x5b1183;};AGIVertices[_0x23e2('0x10')]['gotoc']=function(_0x59d223){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x12c'),_0x59d223[_0x23e2('0x36')]));return this[_0x23e2('0xd')][_0x23e2('0x12d')](_0x59d223[_0x23e2('0x3c')],_0x59d223['extension'],_0x59d223['priority']);};AGIVertices['prototype'][_0x23e2('0x12e')]=function(_0xb819d2){logger[_0x23e2('0x2f')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xb819d2[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0xb819d2['condition'])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0xb819d2,_0x23e2('0x12f'));}try{var _0x4aee2d=eval(_0xb819d2[_0x23e2('0x130')])?'true':_0x23e2('0x131');this['channel'][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x132'),_0xb819d2[_0x23e2('0x130')],_0x4aee2d));return{'code':0xc8,'result':_0x4aee2d};}catch(_0x349abe){return{'code':0xc8,'result':_0x23e2('0x131')};}};AGIVertices[_0x23e2('0x10')]['gotoiftime']=function(_0xca32ef){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xca32ef[_0x23e2('0x36')]));if(!this['isConfigured'](_0xca32ef['interval_id'])){return this['channel'][_0x23e2('0x2c')](_0xca32ef,_0x23e2('0x133'));}var _0x1917e3=this[_0x23e2('0x23')][_0x23e2('0x6e')](this,_0xca32ef[_0x23e2('0x134')]);if(!_0x1917e3){return this['channel']['error'](_0xca32ef,_0x23e2('0x135'));}for(var _0x359bf8=0x0;_0x359bf8<_0x1917e3[_0x23e2('0x94')];_0x359bf8+=0x1){var _0x27b177=this['channel'][_0x23e2('0x11')](util['format'](_0x23e2('0x136'),_0x1917e3[_0x359bf8]));if(_0x27b177[_0x23e2('0xa5')]===-0x1){return _0x27b177;}logger['info'](util[_0x23e2('0x29')]('IFTIME\x20%s\x20%s',_0x1917e3[_0x359bf8],_0x27b177[_0x23e2('0x9d')]));if(_0x27b177[_0x23e2('0x9d')]===_0x23e2('0x137')){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x138'),_0x1917e3[_0x359bf8],'true'));this['channel'][_0x23e2('0xa6')](util['format'](_0x23e2('0x138'),_0x1917e3[_0x359bf8],'true'));return{'code':0xc8,'result':_0x23e2('0x137')};}else{logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x138'),_0x1917e3[_0x359bf8],_0x23e2('0x131')));this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x138'),_0x1917e3[_0x359bf8],_0x23e2('0x131')));}}return{'code':0xc8,'result':_0x23e2('0x131')};};AGIVertices[_0x23e2('0x10')][_0x23e2('0x139')]=function(_0x2da260){logger['info'](util[_0x23e2('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2da260[_0x23e2('0x36')]));return this[_0x23e2('0xd')][_0x23e2('0x139')]();};AGIVertices['prototype'][_0x23e2('0x13a')]=function(_0x5e8447){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x13b'),_0x5e8447['label']));if(!this[_0x23e2('0x7e')](_0x5e8447[_0x23e2('0x7a')])){return this[_0x23e2('0xd')]['noop'](_0x23e2('0x13c'));}var _0x1b2d43=_0x23e2('0x11e');var _0x575d84=util[_0x23e2('0x29')](_0x23e2('0x11f'),FILES_PATH,rs['generate'](0x4));var _0x4e9f18=util[_0x23e2('0x29')](_0x23e2('0x97'),_0x575d84,_0x1b2d43);var _0x4c08b5=!![];if(_0x5e8447[_0x23e2('0x129')]===_0x23e2('0x120')){_0x4c08b5=![];}var _0x518b72=this['channel'][_0x23e2('0x121')](_0x575d84,_0x1b2d43,_0x5e8447[_0x23e2('0x122')],_0x5e8447[_0x23e2('0x65')],undefined,_0x4c08b5);if(_0x518b72[_0x23e2('0xa5')]!==-0x1){this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')]('ispeech\x20%s\x20file\x20created',_0x4e9f18));var _0x158cf3=this[_0x23e2('0x7d')][_0x23e2('0x6e')](this,_0x5e8447,_0x4e9f18);if(_0x158cf3){for(var _0x31f278 in _0x158cf3){if(_0x158cf3['hasOwnProperty'](_0x31f278)){this[_0x23e2('0xd')][_0x23e2('0x9e')](util[_0x23e2('0x29')]('ISPEECH_ASR_%s',_0x31f278['toUpperCase']()),_0x158cf3[_0x31f278]);}}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')]('IspeechASR\x20Result\x20%s',JSON[_0x23e2('0x71')](_0x158cf3)));}}return _0x518b72;};AGIVertices[_0x23e2('0x10')][_0x23e2('0x13d')]=function(_0x5a7fe9){logger['info'](util['format'](_0x23e2('0x13e'),_0x5a7fe9['label']));if(!this[_0x23e2('0x7e')](_0x5a7fe9[_0x23e2('0x7a')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0x13c'));}if(!this['isConfigured'](_0x5a7fe9[_0x23e2('0x5d')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')]('no\x20text\x20configured');}this['channel'][_0x23e2('0xa6')](util[_0x23e2('0x29')]('Trying\x20ispeech\x20TTS\x20%s',_0x5a7fe9['text']));var _0x5d245f=this[_0x23e2('0x79')]['sync'](this,_0x5a7fe9);if(_0x5d245f){this[_0x23e2('0xd')]['noop'](util[_0x23e2('0x29')](_0x23e2('0x13f'),_0x5d245f));var _0x215282=this[_0x23e2('0xd')]['streamFile'](_0x5d245f,_0x5a7fe9[_0x23e2('0x122')]);try{fs[_0x23e2('0xf7')](_0x5d245f+_0x23e2('0xf8'));}catch(_0x46f0cb){logger[_0x23e2('0x2c')](_0x46f0cb);}return _0x215282;}return this['channel'][_0x23e2('0x2c')](_0x5a7fe9,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x23e2('0x10')]['login']=function(_0x46c24e){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x140'),_0x46c24e[_0x23e2('0x36')]));if(!this['isConfigured'](_0x46c24e['findBy'])){return this[_0x23e2('0xd')]['error'](_0x46c24e,_0x23e2('0x141'));}logger['info'](util[_0x23e2('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x46c24e[_0x23e2('0x142')]));var _0x505807=this[_0x23e2('0x55')][_0x23e2('0x6e')](this,_0x46c24e[_0x23e2('0x142')]);if(_0x505807){logger['info'](util[_0x23e2('0x29')](_0x23e2('0x143'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x46c24e[_0x23e2('0x142')]));this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x143'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x46c24e[_0x23e2('0x142')]));return{'code':0xc8,'result':_0x23e2('0x144')};}else{logger['info'](util[_0x23e2('0x29')](_0x23e2('0x145'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x46c24e[_0x23e2('0x142')]));this['channel']['noop'](util[_0x23e2('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x46c24e[_0x23e2('0x142')]));return{'code':0xc8,'result':_0x23e2('0x146')};}};AGIVertices[_0x23e2('0x10')][_0x23e2('0x147')]=function(_0x49c18b){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x148'),_0x49c18b[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x49c18b[_0x23e2('0x142')])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x49c18b,_0x23e2('0x141'));}logger[_0x23e2('0x2f')](util[_0x23e2('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x23e2('0x3a')],_0x49c18b[_0x23e2('0x142')]));var _0x32d64c=this[_0x23e2('0x51')][_0x23e2('0x6e')](this,_0x49c18b[_0x23e2('0x142')]);if(_0x32d64c){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x143'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x49c18b[_0x23e2('0x142')]));this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x143'),this['channel']['callerid'],_0x49c18b[_0x23e2('0x142')]));return{'code':0xc8,'result':_0x23e2('0x144')};}else{logger[_0x23e2('0x2f')](util[_0x23e2('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x49c18b[_0x23e2('0x142')]));this[_0x23e2('0xd')]['noop'](util[_0x23e2('0x29')](_0x23e2('0x145'),this[_0x23e2('0xd')]['callerid'],_0x49c18b['findBy']));return{'code':0xc8,'result':_0x23e2('0x146')};}};AGIVertices[_0x23e2('0x10')]['math']=function(_0x47e763){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x149'),_0x47e763[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x47e763['operation'])){return this[_0x23e2('0xd')]['error'](_0x47e763,_0x23e2('0x14a'));}this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x14b'),_0x47e763[_0x23e2('0x14c')]));var _0xcd5f8b=eval(_0x47e763[_0x23e2('0x14c')]);if(!this[_0x23e2('0x7e')](_0x47e763[_0x23e2('0xd4')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0xd5'));}var _0x25a8c0=this[_0x23e2('0x11')][_0x23e2('0x6e')](this,_0x47e763[_0x23e2('0xd4')]);if(!_0x25a8c0){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x47e763,_0x23e2('0xd6'));}if(_[_0x23e2('0x93')](_0xcd5f8b)){var _0x16a077=this;_0xcd5f8b[_0x23e2('0xd7')](function(_0x5e2773,_0x4066b9){_0x16a077['channel'][_0x23e2('0x9e')](util[_0x23e2('0x29')](_0x23e2('0x14d'),_0x25a8c0,_0x4066b9),_0x5e2773);});return this[_0x23e2('0xd')][_0x23e2('0xa6')](util['format'](_0x23e2('0x14e'),_0x25a8c0));}else{return this['channel'][_0x23e2('0x9e')](_0x25a8c0,_0xcd5f8b);}};AGIVertices[_0x23e2('0x10')][_0x23e2('0xb')]=function(_0x4a3ab7){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x14f'),_0x4a3ab7[_0x23e2('0x36')]));if(_0x4a3ab7[_0x23e2('0x103')]===0x0){return this[_0x23e2('0xa0')](_0x4a3ab7);}_0x4a3ab7[_0x23e2('0x103')]-=0x1;if(!this[_0x23e2('0x7e')](_0x4a3ab7[_0x23e2('0x104')])){return this[_0x23e2('0xd')]['error'](_0x4a3ab7,_0x23e2('0x150'));}var _0x5099fc=this[_0x23e2('0x1d')][_0x23e2('0x6e')](this,_0x4a3ab7[_0x23e2('0x104')]);if(!_0x5099fc){return this['channel'][_0x23e2('0x2c')](_0x4a3ab7,_0x23e2('0x151'));}var _0x3a35eb=this['channel'][_0x23e2('0x152')](_0x5099fc,_0x4a3ab7[_0x23e2('0x153')],_0x4a3ab7[_0x23e2('0x154')]);var _0x577407=_0x3a35eb[_0x23e2('0xa5')];if(_0x3a35eb[_0x23e2('0xa5')]===-0x1){this[_0x23e2('0x9f')]['sync'](this,_0x4a3ab7,'-1');return _0x3a35eb;}else if(_0x3a35eb[_0x23e2('0x9d')]===_0x23e2('0x65')){_0x3a35eb['result']=_0x3a35eb['result'][_0x23e2('0x94')]>0x0?_0x3a35eb[_0x23e2('0xa5')]:'t';}else if(_[_0x23e2('0x45')](_0x3a35eb[_0x23e2('0xa5')])){_0x3a35eb[_0x23e2('0xa5')]='#';_0x577407='#';}if(!this[_0x23e2('0x7e')](_0x4a3ab7[_0x23e2('0xd4')])){this['channel'][_0x23e2('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1134e1=this[_0x23e2('0x11')][_0x23e2('0x6e')](this,_0x4a3ab7[_0x23e2('0xd4')]);if(!_0x1134e1){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x4a3ab7,'no\x20variable\x20found');}this['channel'][_0x23e2('0x9e')](_0x1134e1,_0x577407);}this['createSquareDetailsReport'][_0x23e2('0x6e')](this,_0x4a3ab7,_0x577407);return _0x3a35eb;};AGIVertices[_0x23e2('0x10')][_0x23e2('0xa6')]=function(_0x187b16){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x187b16[_0x23e2('0x36')]));return this[_0x23e2('0xd')]['noop'](_0x187b16['output']||_0x187b16['label']);};AGIVertices['prototype'][_0x23e2('0x155')]=function(_0x515272){logger['info'](util[_0x23e2('0x29')](_0x23e2('0x156'),_0x515272['label']));if(!this[_0x23e2('0x7e')](_0x515272[_0x23e2('0x142')])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x515272,_0x23e2('0x141'));}logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x157'),this[_0x23e2('0xd')]['callerid'],_0x515272[_0x23e2('0x142')]));var _0x496572=this[_0x23e2('0x4c')][_0x23e2('0x6e')](this,_0x515272['pause_id']);var _0x95c4aa=this[_0x23e2('0x4e')]['sync'](this,_0x515272['findBy'],_0x496572);if(_0x95c4aa){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x143'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x515272[_0x23e2('0x142')]));this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x143'),this[_0x23e2('0xd')]['callerid'],_0x515272[_0x23e2('0x142')]));return{'code':0xc8,'result':_0x23e2('0x144')};}else{logger['info'](util[_0x23e2('0x29')](_0x23e2('0x145'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x515272[_0x23e2('0x142')]));this['channel'][_0x23e2('0xa6')](util['format'](_0x23e2('0x143'),this[_0x23e2('0xd')]['callerid'],_0x515272['findBy']));return{'code':0xc8,'result':_0x23e2('0x146')};}};AGIVertices['prototype'][_0x23e2('0x158')]=function(_0x58c0cc){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x159'),_0x58c0cc[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x58c0cc[_0x23e2('0x104')])){return this[_0x23e2('0xd')]['error'](_0x58c0cc,_0x23e2('0x150'));}var _0x37c871=this['getSound'][_0x23e2('0x6e')](this,_0x58c0cc[_0x23e2('0x104')]);if(!_0x37c871){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x58c0cc,_0x23e2('0x151'));}var _0x4a0f36=this[_0x23e2('0xd')][_0x23e2('0x57')]('PLAYBACK',[_0x37c871,_0x58c0cc[_0x23e2('0x100')]]);if(_0x4a0f36[_0x23e2('0xa5')]===-0x1){return _0x4a0f36;}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xbf'),_0x23e2('0x15a'),_0x37c871));};AGIVertices[_0x23e2('0x10')]['queue']=function(_0x28bb99){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x15b'),_0x28bb99[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x28bb99[_0x23e2('0x15c')])){return this['channel'][_0x23e2('0x2c')](_0x28bb99,_0x23e2('0x15d'));}var _0x5c5711='';var _0x3de422=parseInt(_0x28bb99['queue_id'],0xa);if(isNaN(_0x3de422)){_0x5c5711=_0x28bb99['queue_id'];}else{_0x5c5711=this[_0x23e2('0x15')][_0x23e2('0x6e')](this,_0x28bb99[_0x23e2('0x15c')]);if(!_0x5c5711){return this['channel'][_0x23e2('0x2c')](_0x28bb99,_0x23e2('0x15e'));}}var _0x3f34a6='';if(this['isConfigured'](_0x28bb99[_0x23e2('0x104')])){var _0x302597=this[_0x23e2('0x1d')][_0x23e2('0x6e')](this,_0x28bb99['file_id']);if(_0x302597){_0x3f34a6=_0x302597;}}this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x28bb99,_0x5c5711);if(_0x28bb99['opts'][_0x23e2('0x15f')]('x')<0x0){_0x28bb99[_0x23e2('0x100')]+='x';}if(_0x28bb99[_0x23e2('0x100')][_0x23e2('0x15f')]('X')<0x0){_0x28bb99['opts']+='X';}this[_0x23e2('0xd')]['setVariable'](_0x23e2('0x160'),_0x5c5711?_0x5c5711['toLowerCase']():'');var _0x14cfef=this['channel']['exec'](_0x23e2('0x161'),[_0x5c5711,_0x28bb99[_0x23e2('0x100')],_0x28bb99[_0x23e2('0x63')],_0x3f34a6,_0x28bb99[_0x23e2('0x65')],_0x28bb99[_0x23e2('0xb3')],_0x28bb99[_0x23e2('0x162')],_0x28bb99['gosub'],'',_0x28bb99[_0x23e2('0x163')]]);if(_0x14cfef[_0x23e2('0xa5')]===-0x1){return _0x14cfef;}return this[_0x23e2('0xd')]['noop'](util['format'](_0x23e2('0xbf'),_0x23e2('0x161'),_0x5c5711));};AGIVertices[_0x23e2('0x10')][_0x23e2('0x164')]=function(_0x19c380){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x165'),_0x19c380[_0x23e2('0x36')]));var _0x4680a0=_0x19c380[_0x23e2('0x166')]||_0x23e2('0x11e');var _0x1e11c5=util[_0x23e2('0x29')](_0x23e2('0x167'),this['channel'][_0x23e2('0x35')],rs[_0x23e2('0x10a')](0x5));var _0x477bd0=util['format'](_0x23e2('0x168'),FILES_PATH,_0x1e11c5,_0x4680a0);var _0x1a6e2c=util[_0x23e2('0x29')](_0x23e2('0x11f'),FILES_PATH,_0x1e11c5);this[_0x23e2('0x39')]['sync'](this,_0x19c380,_0x1e11c5,_0x477bd0);this[_0x23e2('0xd')][_0x23e2('0x9e')](_0x23e2('0x169'),_0x1e11c5);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x1a6e2c,_0x4680a0,_0x19c380[_0x23e2('0x16a')],_0x19c380[_0x23e2('0x65')]);return this[_0x23e2('0xd')][_0x23e2('0x121')](_0x1a6e2c,_0x4680a0,_0x19c380['escape_digits'],_0x19c380[_0x23e2('0x65')],undefined,!![]);};AGIVertices[_0x23e2('0x10')][_0x23e2('0x16b')]=function(_0x4f15fc){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x16c'),_0x4f15fc[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x4f15fc[_0x23e2('0x63')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')]('no\x20url\x20configured');}var _0x4259bc=this[_0x23e2('0x16d')][_0x23e2('0x6e')](this,_0x4f15fc);logger[_0x23e2('0x2f')](util[_0x23e2('0x29')]('Response:',util[_0x23e2('0x16e')](_0x4259bc,{'showHidden':![],'depth':null})));if(!this[_0x23e2('0x7e')](_0x4f15fc['variable_id'])){return this[_0x23e2('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0xead0d4=this['getVariable'][_0x23e2('0x6e')](this,_0x4f15fc[_0x23e2('0xd4')]);if(!_0xead0d4){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x4f15fc,_0x23e2('0xd6'));}this['channel'][_0x23e2('0x9e')](util[_0x23e2('0x29')](_0x23e2('0x16f'),_0xead0d4),_0x4259bc[_0x23e2('0x72')]?_0x4259bc[_0x23e2('0x72')]:'200');this[_0x23e2('0xd')][_0x23e2('0x9e')](util[_0x23e2('0x29')](_0x23e2('0x170'),_0xead0d4),_0x4259bc['statusMessage']?_0x4259bc['statusMessage']:'OK');if(_0x4259bc[_0x23e2('0x69')]){try{this[_0x23e2('0x95')](_0x4259bc['body'],_0xead0d4);}catch(_0x2930b1){logger[_0x23e2('0x2c')](util[_0x23e2('0x29')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xead0d4));}}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0xdb'),_0xead0d4));};AGIVertices['prototype'][_0x23e2('0x171')]=function(_0xf5682a){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x172'),_0xf5682a['label']));return this[_0x23e2('0xd')]['sayDigits'](_0xf5682a[_0x23e2('0x173')]['replace'](/\s+/g,''),_0xf5682a[_0x23e2('0x16a')]);};AGIVertices[_0x23e2('0x10')]['saynumber']=function(_0x5015e7){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x174'),_0x5015e7[_0x23e2('0x36')]));return this[_0x23e2('0xd')][_0x23e2('0x175')](_0x5015e7[_0x23e2('0x176')][_0x23e2('0x59')](/\s+/g,''),_0x5015e7[_0x23e2('0x16a')]);};AGIVertices[_0x23e2('0x10')][_0x23e2('0x177')]=function(_0x5f39df){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x178'),_0x5f39df['label']));return this[_0x23e2('0xd')][_0x23e2('0x179')](_0x5f39df['text'],_0x5f39df[_0x23e2('0x16a')]);};AGIVertices[_0x23e2('0x10')][_0x23e2('0x17a')]=function(_0x526e62){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x17b'),_0x526e62['label']));if(!this[_0x23e2('0x7e')](_0x526e62[_0x23e2('0x17c')])){return this['channel'][_0x23e2('0xa6')](_0x23e2('0x17d'));}var _0x594361=this['getMailAccount'][_0x23e2('0x6e')](this,_0x526e62['account_id']);if(!_0x594361||!_0x594361['Smtp']){return this[_0x23e2('0xd')]['error'](_0x526e62,_0x23e2('0x17e'));}var _0x1679df={'from':util[_0x23e2('0x29')](_0x23e2('0x17f'),_0x594361['name'],_0x594361[_0x23e2('0x180')]||_0x594361[_0x23e2('0x181')][_0x23e2('0x182')]),'to':_0x526e62['to']||'','cc':_0x526e62['cc']||'','bcc':_0x526e62[_0x23e2('0x183')]||'','subject':_0x526e62['subject'],'html':_0x526e62['text'],'text':_0x526e62[_0x23e2('0x5d')]};var _0x55df38={'tls':{'rejectUnauthorized':![]}};if(_0x594361[_0x23e2('0x181')]['service']){_0x55df38['service']=_0x594361[_0x23e2('0x181')][_0x23e2('0x184')];}else{_0x55df38[_0x23e2('0x185')]=_0x594361[_0x23e2('0x181')]['host'];_0x55df38[_0x23e2('0x186')]=_0x594361[_0x23e2('0x181')][_0x23e2('0x186')];_0x55df38[_0x23e2('0x187')]=_0x594361[_0x23e2('0x181')][_0x23e2('0x187')];}if(_0x594361[_0x23e2('0x181')][_0x23e2('0x188')]){_0x55df38['auth']={'user':_0x594361[_0x23e2('0x181')]['user'],'pass':_0x594361[_0x23e2('0x181')]['pass']};}if(this[_0x23e2('0x7e')](_0x526e62[_0x23e2('0x189')])){}logger[_0x23e2('0x18a')](_0x23e2('0x18b'),JSON[_0x23e2('0x71')](_0x1679df));this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x526e62,_0x526e62['account_id']);this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x18c'),_0x594361[_0x23e2('0x14')]));this[_0x23e2('0x22')][_0x23e2('0x6e')](this,_0x55df38,_0x1679df);return this[_0x23e2('0xd')]['noop'](_0x23e2('0x18d'));};AGIVertices['prototype']['sendFax']=function(_0x22ae81){logger[_0x23e2('0x2f')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x22ae81[_0x23e2('0x36')]));return this[_0x23e2('0xd')]['noop'](_0x23e2('0x18e'));};AGIVertices[_0x23e2('0x10')][_0x23e2('0x18f')]=function(_0xe69965){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x190'),_0xe69965[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0xe69965[_0x23e2('0x191')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')]('no\x20sms\x20account\x20configured');}var _0x16116b=this[_0x23e2('0x192')][_0x23e2('0x6e')](this,_0xe69965[_0x23e2('0x191')]);if(!_0x16116b){return this['channel'][_0x23e2('0x2c')](_0xe69965,_0x23e2('0x193'));}var _0x53cdf6={'body':_0xe69965[_0x23e2('0x194')],'phone':_0xe69965['to']||'','SmsAccountId':_0x16116b['id']};logger[_0x23e2('0x18a')](_0x23e2('0x195'),JSON['stringify'](_0x53cdf6));this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0xe69965,_0xe69965[_0x23e2('0x191')]);this['channel'][_0x23e2('0xa6')](util['format'](_0x23e2('0x196'),_0x16116b[_0x23e2('0x14')]));this[_0x23e2('0x197')]['sync'](this,_0x53cdf6);return this[_0x23e2('0xd')]['noop'](_0x23e2('0x198'));};AGIVertices[_0x23e2('0x10')]['set']=function(_0x2cdf17){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x199'),_0x2cdf17['label']));if(!this['isConfigured'](_0x2cdf17[_0x23e2('0xd4')])){return this['channel'][_0x23e2('0x2c')](_0x2cdf17,'no\x20variable\x20selected');}var _0x157cee=this[_0x23e2('0x11')][_0x23e2('0x6e')](this,_0x2cdf17[_0x23e2('0xd4')]);if(!_0x157cee){return this[_0x23e2('0xd')]['error'](_0x2cdf17,'no\x20variable\x20found');}return this[_0x23e2('0xd')][_0x23e2('0x9e')](_0x157cee,_0x2cdf17['variable_value']);};AGIVertices[_0x23e2('0x10')]['start']=function(_0x5341d9){logger['info'](util[_0x23e2('0x29')](_0x23e2('0x19a'),_0x5341d9[_0x23e2('0x36')]));this['channel'][_0x23e2('0xa6')](_0x23e2('0x19b'));if(_0x5341d9['answer']===_0x23e2('0x19c')){this[_0x23e2('0xd')][_0x23e2('0xa6')]('Answer');return this['channel'][_0x23e2('0xb5')]();}return this[_0x23e2('0xd')][_0x23e2('0xa6')](_0x23e2('0x19d'));};AGIVertices[_0x23e2('0x10')][_0x23e2('0x19e')]=function(_0x2b6e6f){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x19f'),_0x2b6e6f[_0x23e2('0x36')]));if(!this[_0x23e2('0x7e')](_0x2b6e6f[_0x23e2('0x1a0')])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x2b6e6f,_0x23e2('0x1a1'));}var _0x56f0de=this[_0x23e2('0x18')][_0x23e2('0x6e')](this,_0x2b6e6f['project_id']);if(!this[_0x23e2('0x7e')](_0x56f0de)){return this[_0x23e2('0xd')]['error'](_0x2b6e6f,util[_0x23e2('0x29')](_0x23e2('0x1a2'),_0x2b6e6f['project_id']));}if(_0x56f0de===this[_0x23e2('0xd')]['arg_1']){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x2b6e6f,_0x23e2('0x1a3'));}this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x2b6e6f,_0x56f0de);var _0x1acdf4=this['channel'][_0x23e2('0x57')](_0x23e2('0x1a4'),util[_0x23e2('0x29')](_0x23e2('0x1a5'),config[_0x23e2('0xb3')]['host']||_0x23e2('0x1a6'),_0x56f0de,this[_0x23e2('0xd')]['arg_1']));if(_0x1acdf4[_0x23e2('0xa5')]===-0x1){return _0x1acdf4;}return this[_0x23e2('0xd')]['noop'](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x56f0de));};AGIVertices[_0x23e2('0x10')]['system']=function(_0x430988){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x1a7'),_0x430988['label']));var _0x23e451=this[_0x23e2('0x56')][_0x23e2('0x6e')](this,_0x430988[_0x23e2('0x1a8')]);this[_0x23e2('0x9f')][_0x23e2('0x6e')](this,_0x430988,_0x430988[_0x23e2('0x1a8')]);if(this['isConfigured'](_0x430988[_0x23e2('0xd4')])){var _0x4abc0c=this[_0x23e2('0x11')][_0x23e2('0x6e')](this,_0x430988[_0x23e2('0xd4')]);if(_0x4abc0c){this[_0x23e2('0xd')]['setVariable'](_0x4abc0c,_0x23e451);return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x430988['command'],_0x4abc0c));}}return this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x430988[_0x23e2('0x1a8')]));};AGIVertices[_0x23e2('0x10')][_0x23e2('0x1a9')]=function(_0x566799){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x1aa'),_0x566799[_0x23e2('0x36')]));_0x566799['text']=_0x566799[_0x23e2('0x5d')][_0x23e2('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x23e2('0x7e')](_0x566799[_0x23e2('0x5b')])){return this['channel'][_0x23e2('0xa6')](_0x23e2('0x1ab'));}if(!this[_0x23e2('0x7e')](_0x566799[_0x23e2('0x5d')])){return this['channel'][_0x23e2('0xa6')](_0x23e2('0xa2'));}this['channel'][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x1ac'),_0x566799[_0x23e2('0x5d')]));var _0x58587d=this[_0x23e2('0x5a')]['sync'](this,_0x566799);if(_0x58587d){this['channel'][_0x23e2('0xa6')](util['format'](_0x23e2('0x1ad'),_0x58587d));var _0x4340a6=this[_0x23e2('0xd')][_0x23e2('0xf5')](_0x58587d);try{fs[_0x23e2('0xf7')](_0x58587d+_0x23e2('0xf8'));}catch(_0x5463c4){logger[_0x23e2('0x2c')](_0x5463c4);}return _0x4340a6;}return this['channel'][_0x23e2('0x2c')](_0x566799,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x2ed063){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x1ae'),_0x2ed063['label']));_0x2ed063[_0x23e2('0x5d')]=_0x2ed063[_0x23e2('0x5d')][_0x23e2('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x23e2('0x7e')](_0x2ed063[_0x23e2('0x5d')])){return this[_0x23e2('0xd')][_0x23e2('0xa6')]('no\x20text\x20configured');}this['channel'][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x1af'),_0x2ed063[_0x23e2('0x5d')]));var _0x4f6c84=this[_0x23e2('0x62')][_0x23e2('0x6e')](this,_0x2ed063);if(_0x4f6c84){this[_0x23e2('0xd')][_0x23e2('0xa6')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x4f6c84));var _0x1fee22=this[_0x23e2('0xd')][_0x23e2('0xf5')](_0x4f6c84);try{fs['unlink'](_0x4f6c84+_0x23e2('0xf8'));}catch(_0x4411e6){logger[_0x23e2('0x2c')](_0x4411e6);}return _0x1fee22;}return this['channel']['error'](_0x2ed063,_0x23e2('0x1b0'));};AGIVertices[_0x23e2('0x10')][_0x23e2('0x1b1')]=function(_0x228360){logger['info'](util[_0x23e2('0x29')](_0x23e2('0x1b2'),_0x228360['label']));if(!this[_0x23e2('0x7e')](_0x228360[_0x23e2('0x142')])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x228360,'no\x20find\x20by\x20configured');}logger[_0x23e2('0x2f')](util[_0x23e2('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x228360[_0x23e2('0x142')]));var _0xebe5d1=this[_0x23e2('0x50')][_0x23e2('0x6e')](this,_0x228360['findBy']);if(_0xebe5d1){logger['info'](util[_0x23e2('0x29')](_0x23e2('0x143'),this['channel'][_0x23e2('0x3a')],_0x228360['findBy']));this[_0x23e2('0xd')][_0x23e2('0xa6')](util['format'](_0x23e2('0x143'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x228360[_0x23e2('0x142')]));return{'code':0xc8,'result':_0x23e2('0x144')};}else{logger[_0x23e2('0x2f')](util[_0x23e2('0x29')](_0x23e2('0x145'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x228360['findBy']));this[_0x23e2('0xd')][_0x23e2('0xa6')](util[_0x23e2('0x29')](_0x23e2('0x145'),this[_0x23e2('0xd')][_0x23e2('0x3a')],_0x228360['findBy']));return{'code':0xc8,'result':_0x23e2('0x146')};}};AGIVertices[_0x23e2('0x10')]['voicemail']=function(_0x1fc757){logger[_0x23e2('0x2f')](util[_0x23e2('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1fc757[_0x23e2('0x36')]));var _0x242381=this[_0x23e2('0xd')][_0x23e2('0x57')]('VOICEMAIL',[_0x1fc757['mailbox'],_0x1fc757[_0x23e2('0xa3')]]);if(_0x242381[_0x23e2('0xa5')]===-0x1){return _0x242381;}return this[_0x23e2('0xd')]['noop'](util[_0x23e2('0x29')](_0x23e2('0xbf'),'VOICEMAIL',_0x1fc757[_0x23e2('0x1b3')]));};AGIVertices['prototype']['vswitch']=function(_0x4b66df){logger[_0x23e2('0x2f')](util['format'](_0x23e2('0x1b4'),_0x4b66df['label']));if(!this[_0x23e2('0x7e')](_0x4b66df[_0x23e2('0xd4')])){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x4b66df,_0x23e2('0x1b5'));}var _0x358ed2=this[_0x23e2('0x11')][_0x23e2('0x6e')](this,_0x4b66df[_0x23e2('0xd4')]);if(!_0x358ed2){return this[_0x23e2('0xd')][_0x23e2('0x2c')](_0x4b66df,_0x23e2('0xd6'));}var _0x34185f=this[_0x23e2('0xd')][_0x23e2('0x11')](_0x358ed2);return{'code':0xc8,'result':_0x34185f[_0x23e2('0x9d')]?_0x34185f[_0x23e2('0x9d')]:'-'};};String[_0x23e2('0x10')][_0x23e2('0x99')]=function(_0xa7377,_0x4528de){return this[_0x23e2('0x98')](_0xa7377)[_0x23e2('0x1b6')](_0x4528de);};module[_0x23e2('0x1b7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0160ee7..7d948f2 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 _0x5c12=['timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','name','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','channels','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','queue','updateAcw','lastPauseAt','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x5c12,0x188));var _0x25c1=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x5c12[_0x2c18a8];return _0x1e009a;};'use strict';var util=require('util');var _=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var ami=require('../ami');var logger=require(_0x25c1('0x2'))(_0x25c1('0x3'));var RpcUser=require(_0x25c1('0x4'));var RpcVoiceAgentReport=require(_0x25c1('0x5'));function Acw(_0x2c5df0){this[_0x25c1('0x6')]=_0x2c5df0[_0x25c1('0x6')];this['agents']=_0x2c5df0[_0x25c1('0x7')];this[_0x25c1('0x8')]=_0x2c5df0[_0x25c1('0x8')];this['channels']={};ami['on']('agentconnect',this[_0x25c1('0x9')][_0x25c1('0xa')](this));ami['on'](_0x25c1('0xb'),this[_0x25c1('0xc')][_0x25c1('0xa')](this));ami['on']('hangup',this[_0x25c1('0xd')][_0x25c1('0xa')](this));ami['on'](_0x25c1('0xe'),this[_0x25c1('0xf')][_0x25c1('0xa')](this));ami['on']('attendedtransfer',this[_0x25c1('0x10')][_0x25c1('0xa')](this));ami['on']('blindtransfer',this[_0x25c1('0x11')][_0x25c1('0xa')](this));ami['on'](_0x25c1('0x12'),this[_0x25c1('0x13')]['bind'](this));}function getDiff(_0x569ef9){var _0x4ef5d7=moment()['milliseconds'](0x0);var _0x3ef429=moment(_0x569ef9)[_0x25c1('0x14')](0x0);return _0x4ef5d7[_0x25c1('0x15')](_0x3ef429,_0x25c1('0x16'));}Acw[_0x25c1('0x17')]['startAcw']=function(_0x4638f0){try{var _0x55b62d=this;var _0x5d631e=this['channels'][_0x4638f0][_0x25c1('0x18')];var _0x1a08b5=this['channels'][_0x4638f0]['queue'];var _0x61a29f=this['voiceQueues'][_0x1a08b5];var _0x7175d4=![];var _0x23a418='ACW';if(_0x61a29f['mandatoryDisposition']){if(_0x61a29f['mandatoryDispositionPause'][_0x25c1('0x19')]){_0x7175d4=!![];_0x23a418=_0x61a29f[_0x25c1('0x1a')][_0x25c1('0x19')];}}ami[_0x25c1('0x1b')]({'action':'QueuePause','interface':_0x5d631e,'paused':!![],'reason':_0x23a418})[_0x25c1('0x1c')](function(_0x9f54e3){if(_0x55b62d[_0x25c1('0x7')][_0x5d631e]){return RpcUser[_0x25c1('0x1d')](_0x55b62d['agents'][_0x5d631e]['id'])['then'](function(_0x2a8a84){if(_0x2a8a84&&!_0x2a8a84[_0x25c1('0x1e')]){logger[_0x25c1('0x1f')](_0x25c1('0x20'),_0x4638f0,_0x5d631e,_0x1a08b5);var _0x15cf2f=_0x55b62d[_0x25c1('0x21')][_0x4638f0][_0x25c1('0x22')]&&_0x55b62d[_0x25c1('0x21')][_0x4638f0][_0x25c1('0x23')]?_0x55b62d[_0x25c1('0x21')][_0x4638f0][_0x25c1('0x23')]:_0x4638f0;return RpcUser[_0x25c1('0x24')](_0x55b62d[_0x25c1('0x7')][_0x5d631e],_0x23a418,_0x15cf2f)['then'](function(_0x2dadae){if(!_0x7175d4){_0x55b62d[_0x25c1('0x8')][_0x5d631e]={};logger[_0x25c1('0x1f')](_0x25c1('0x25'),_0x4638f0,_0x55b62d[_0x25c1('0x6')][_0x1a08b5][_0x25c1('0x26')],_0x5d631e,_0x1a08b5);_0x55b62d['timers'][_0x5d631e][_0x25c1('0x27')]=setTimeout(_0x55b62d[_0x25c1('0x28')][_0x25c1('0xa')](_0x55b62d,_0x5d631e),_0x55b62d[_0x25c1('0x6')][_0x1a08b5][_0x25c1('0x26')]*0x3e8);_0x55b62d[_0x25c1('0x8')][_0x5d631e]['lastPauseAt']=moment()[_0x25c1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x55b62d[_0x25c1('0x8')][_0x5d631e][_0x25c1('0x2a')]=_0x4638f0;_0x55b62d[_0x25c1('0x8')][_0x5d631e][_0x25c1('0x2b')]=_0x1a08b5;_0x55b62d[_0x25c1('0x8')][_0x5d631e][_0x25c1('0x2c')]=function(){var _0x1fd4e3=getDiff(_0x55b62d[_0x25c1('0x8')][_0x5d631e][_0x25c1('0x2d')]);clearTimeout(_0x55b62d['timers'][_0x5d631e][_0x25c1('0x27')]);_0x55b62d['timers'][_0x5d631e]['timer']=![];RpcVoiceAgentReport[_0x25c1('0x2e')]({'acwtime':_0x1fd4e3},_0x55b62d[_0x25c1('0x8')][_0x5d631e]['uniqueid'],_0x5d631e)[_0x25c1('0x1c')](function(_0x5a5a32){logger[_0x25c1('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x4638f0,_0x1fd4e3,_0x5a5a32);})[_0x25c1('0x2f')](function(_0x7f1e7a){logger[_0x25c1('0x30')](_0x25c1('0x31'),_0x4638f0,_0x7f1e7a);});delete _0x55b62d[_0x25c1('0x8')][_0x5d631e];};}});}else{logger[_0x25c1('0x1f')](_0x25c1('0x32'),_0x4638f0,_0x5d631e,_0x1a08b5);}});}})[_0x25c1('0x2f')](function(_0x578713){logger[_0x25c1('0x30')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4638f0,_0x55b62d[_0x25c1('0x6')][_0x1a08b5]['acwTimeout'],_0x5d631e,_0x1a08b5);})[_0x25c1('0x33')](function(){delete _0x55b62d[_0x25c1('0x21')][_0x4638f0];});}catch(_0x18f10c){logger[_0x25c1('0x30')](_0x25c1('0x34'),_0x18f10c[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')][_0x25c1('0x28')]=function(_0x3fced1){try{var _0x2d060c=this;if(_0x2d060c[_0x25c1('0x8')][_0x3fced1]){_0x2d060c[_0x25c1('0x8')][_0x3fced1][_0x25c1('0x27')]=![];var _0x1b6e92=_0x2d060c[_0x25c1('0x8')][_0x3fced1][_0x25c1('0x2a')];var _0x349aef=_0x2d060c[_0x25c1('0x8')][_0x3fced1][_0x25c1('0x2b')];var _0x357385=_0x2d060c['voiceQueues'][_0x349aef][_0x25c1('0x26')];logger[_0x25c1('0x1f')]('[TIMER][STOP][AGENT:%s]',_0x3fced1);RpcUser[_0x25c1('0x36')](this['agents'][_0x3fced1]);RpcVoiceAgentReport[_0x25c1('0x2e')]({'acwtime':_0x357385,'agentacw':!![]},_0x1b6e92,_0x3fced1)['then'](function(_0x4326fb){logger[_0x25c1('0x1f')](_0x25c1('0x37'),_0x1b6e92,_0x357385,_0x4326fb);})[_0x25c1('0x2f')](function(_0xbc20a3){logger['error'](_0x25c1('0x31'),_0x1b6e92,_0xbc20a3);});}else{logger['error'](_0x25c1('0x38'),_0x3fced1);if(_0x2d060c[_0x25c1('0x8')]){logger[_0x25c1('0x1f')](_0x25c1('0x39'),JSON['stringify'](_0x2d060c['timers']));}}}catch(_0x58b8f3){logger[_0x25c1('0x30')](_0x25c1('0x3a'),_0x58b8f3['message']);}};Acw[_0x25c1('0x17')]['syncAgentConnect']=function(_0x3d5172){try{if(this[_0x25c1('0x6')][_0x3d5172[_0x25c1('0x2b')]]&&(this['voiceQueues'][_0x3d5172['queue']]['acw']||this[_0x25c1('0x6')][_0x3d5172[_0x25c1('0x2b')]]['mandatoryDisposition'])){if(this[_0x25c1('0x7')][_0x3d5172[_0x25c1('0x18')]]){this[_0x25c1('0x21')][_0x3d5172['uniqueid']]={'queue':_0x3d5172['queue'],'interface':_0x3d5172['interface'],'destlinkedid':_0x3d5172['destlinkedid']};}}}catch(_0x669152){logger[_0x25c1('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x669152[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')][_0x25c1('0x13')]=function(_0x2dbe23){try{if(this[_0x25c1('0x6')][_0x2dbe23[_0x25c1('0x2b')]]&&(this[_0x25c1('0x6')][_0x2dbe23['queue']]['acw']||this[_0x25c1('0x6')][_0x2dbe23[_0x25c1('0x2b')]][_0x25c1('0x3b')])){if(this['agents'][_0x2dbe23[_0x25c1('0x18')]]){this[_0x25c1('0x21')][_0x2dbe23[_0x25c1('0x2a')]]={'queue':_0x2dbe23[_0x25c1('0x2b')],'interface':_0x2dbe23['interface']};}}}catch(_0xb87cf1){logger[_0x25c1('0x30')](_0x25c1('0x3c'),_0xb87cf1[_0x25c1('0x35')]);}};Acw['prototype']['syncHangupRequest']=function(_0x13ac06){try{if(this[_0x25c1('0x21')][_0x13ac06[_0x25c1('0x2a')]]&&_[_0x25c1('0x3d')](this['channels'][_0x13ac06[_0x25c1('0x2a')]][_0x25c1('0x22')])){logger['info'](_0x25c1('0x3e'),_0x13ac06[_0x25c1('0x2a')]);this[_0x25c1('0x3f')](_0x13ac06[_0x25c1('0x2a')]);}else if(this['channels'][_0x13ac06['linkedid']]&&_[_0x25c1('0x3d')](this[_0x25c1('0x21')][_0x13ac06[_0x25c1('0x40')]]['attended'])){logger[_0x25c1('0x1f')](_0x25c1('0x41'),_0x13ac06['linkedid']);this[_0x25c1('0x3f')](_0x13ac06[_0x25c1('0x40')]);}}catch(_0x2b58a3){logger[_0x25c1('0x30')](_0x25c1('0x42'),_0x2b58a3[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')]['syncHangup']=function(_0x5344da){try{if(this['channels'][_0x5344da[_0x25c1('0x2a')]]&&this['channels'][_0x5344da[_0x25c1('0x2a')]][_0x25c1('0x22')]){logger[_0x25c1('0x1f')](_0x25c1('0x43'),_0x5344da[_0x25c1('0x2a')]);this[_0x25c1('0x3f')](_0x5344da['uniqueid']);}else if(this[_0x25c1('0x21')][_0x5344da[_0x25c1('0x40')]]&&this[_0x25c1('0x21')][_0x5344da[_0x25c1('0x40')]][_0x25c1('0x22')]){logger[_0x25c1('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5344da[_0x25c1('0x40')]);this[_0x25c1('0x3f')](_0x5344da[_0x25c1('0x40')]);}}catch(_0xbff8ad){logger[_0x25c1('0x30')]('[ACW][syncHangup]\x20%s',_0xbff8ad[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')]['syncAttendedTransfer']=function(_0x1341d2){try{if(!_[_0x25c1('0x44')](this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x45')]])){this[_0x25c1('0x3f')](_0x1341d2[_0x25c1('0x45')]);if(this['channels'][_0x1341d2[_0x25c1('0x46')]]){this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x46')]][_0x25c1('0x22')]=!![];this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x47')]]=this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x46')]];delete this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x46')]];}}else if(!_[_0x25c1('0x44')](this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x47')]])){this[_0x25c1('0x3f')](_0x1341d2['transfertargetuniqueid']);if(this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x48')]]){this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x48')]][_0x25c1('0x22')]=!![];this[_0x25c1('0x21')][_0x1341d2[_0x25c1('0x45')]]=this['channels'][_0x1341d2[_0x25c1('0x48')]];delete this['channels'][_0x1341d2[_0x25c1('0x48')]];}}}catch(_0x24568c){logger[_0x25c1('0x30')](_0x25c1('0x49'),_0x24568c[_0x25c1('0x35')]);}};Acw[_0x25c1('0x17')][_0x25c1('0x11')]=function(_0x19df83){try{if(this['channels'][_0x19df83[_0x25c1('0x4a')]]){logger[_0x25c1('0x1f')](_0x25c1('0x4b'),JSON[_0x25c1('0x4c')](_0x19df83[_0x25c1('0x4a')]));this[_0x25c1('0x3f')](_0x19df83[_0x25c1('0x4a')]);}else if(this['channels'][_0x19df83[_0x25c1('0x4d')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x19df83[_0x25c1('0x4d')]));this[_0x25c1('0x3f')](_0x19df83[_0x25c1('0x4d')]);}}catch(_0x15cd6d){logger[_0x25c1('0x30')]('[ACW][syncBlindTransfer]\x20%s',_0x15cd6d[_0x25c1('0x35')]);}};Acw['prototype'][_0x25c1('0xf')]=function(_0x36aa98){try{if(this[_0x25c1('0x6')][_0x36aa98[_0x25c1('0x2b')]]&&this[_0x25c1('0x6')][_0x36aa98[_0x25c1('0x2b')]][_0x25c1('0x4e')]==='all'){if(this[_0x25c1('0x7')][_0x36aa98[_0x25c1('0x18')]]){logger[_0x25c1('0x1f')](_0x25c1('0x4f'),_0x36aa98[_0x25c1('0x2a')],_0x36aa98[_0x25c1('0x18')],_0x36aa98['queue']);return RpcUser[_0x25c1('0x24')](this['agents'][_0x36aa98[_0x25c1('0x18')]],'Auto-Pause',_0x36aa98['uniqueid']);}}}catch(_0x1c66d6){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1c66d6['message']);}};module['exports']=Acw; \ No newline at end of file +var _0xd0bb=['name','mandatoryDispositionPause','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','startAcw','queue','mandatoryDisposition'];(function(_0x6ccf4a,_0x32792d){var _0x2bc874=function(_0x41aadd){while(--_0x41aadd){_0x6ccf4a['push'](_0x6ccf4a['shift']());}};_0x2bc874(++_0x32792d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x433f44,_0xa365ce){_0x433f44=_0x433f44-0x0;var _0x73664=_0xd0bb[_0x433f44];return _0x73664;};'use strict';var util=require(_0xbd0b('0x0'));var _=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var ami=require('../ami');var logger=require(_0xbd0b('0x3'))('acw');var RpcUser=require(_0xbd0b('0x4'));var RpcVoiceAgentReport=require(_0xbd0b('0x5'));function Acw(_0x53e6ce){this[_0xbd0b('0x6')]=_0x53e6ce['voiceQueues'];this[_0xbd0b('0x7')]=_0x53e6ce[_0xbd0b('0x7')];this[_0xbd0b('0x8')]=_0x53e6ce[_0xbd0b('0x8')];this[_0xbd0b('0x9')]={};ami['on']('agentconnect',this[_0xbd0b('0xa')][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xc'),this[_0xbd0b('0xd')][_0xbd0b('0xb')](this));ami['on']('hangup',this['syncHangup'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xe'),this['syncAgentRingNoAnswer'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xf'),this['syncAttendedTransfer'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0x10'),this[_0xbd0b('0x11')][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0x12'),this[_0xbd0b('0x13')][_0xbd0b('0xb')](this));}function getDiff(_0x1f25b6){var _0x1a55ab=moment()[_0xbd0b('0x14')](0x0);var _0x2d4664=moment(_0x1f25b6)['milliseconds'](0x0);return _0x1a55ab[_0xbd0b('0x15')](_0x2d4664,'seconds');}Acw['prototype'][_0xbd0b('0x16')]=function(_0x4c0e52){try{var _0x3183cf=this;var _0x40b075=this[_0xbd0b('0x9')][_0x4c0e52]['interface'];var _0x55e0a1=this[_0xbd0b('0x9')][_0x4c0e52][_0xbd0b('0x17')];var _0x1f2a6e=this[_0xbd0b('0x6')][_0x55e0a1];var _0x1c0a7c=![];var _0x40b798='ACW';if(_0x1f2a6e[_0xbd0b('0x18')]){if(_0x1f2a6e['mandatoryDispositionPause'][_0xbd0b('0x19')]){_0x1c0a7c=!![];_0x40b798=_0x1f2a6e[_0xbd0b('0x1a')][_0xbd0b('0x19')];}}ami[_0xbd0b('0x1b')]({'action':'QueuePause','interface':_0x40b075,'paused':!![],'reason':_0x40b798})[_0xbd0b('0x1c')](function(_0x38c27f){if(_0x3183cf[_0xbd0b('0x7')][_0x40b075]){return RpcUser['getAgent'](_0x3183cf[_0xbd0b('0x7')][_0x40b075]['id'])['then'](function(_0xc66b8){if(_0xc66b8&&!_0xc66b8[_0xbd0b('0x1d')]){logger[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x4c0e52,_0x40b075,_0x55e0a1);var _0x297c85=_0x3183cf['channels'][_0x4c0e52][_0xbd0b('0x20')]&&_0x3183cf['channels'][_0x4c0e52][_0xbd0b('0x21')]?_0x3183cf[_0xbd0b('0x9')][_0x4c0e52][_0xbd0b('0x21')]:_0x4c0e52;return RpcUser[_0xbd0b('0x22')](_0x3183cf[_0xbd0b('0x7')][_0x40b075],_0x40b798,_0x297c85)[_0xbd0b('0x1c')](function(_0x4fe9ed){if(!_0x1c0a7c){_0x3183cf[_0xbd0b('0x8')][_0x40b075]={};logger[_0xbd0b('0x1e')](_0xbd0b('0x23'),_0x4c0e52,_0x3183cf[_0xbd0b('0x6')][_0x55e0a1][_0xbd0b('0x24')],_0x40b075,_0x55e0a1);_0x3183cf[_0xbd0b('0x8')][_0x40b075]['timer']=setTimeout(_0x3183cf[_0xbd0b('0x25')][_0xbd0b('0xb')](_0x3183cf,_0x40b075),_0x3183cf[_0xbd0b('0x6')][_0x55e0a1]['acwTimeout']*0x3e8);_0x3183cf['timers'][_0x40b075][_0xbd0b('0x26')]=moment()[_0xbd0b('0x27')](_0xbd0b('0x28'));_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x29')]=_0x4c0e52;_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x17')]=_0x55e0a1;_0x3183cf['timers'][_0x40b075][_0xbd0b('0x2a')]=function(){var _0x3b70b4=getDiff(_0x3183cf['timers'][_0x40b075]['lastPauseAt']);clearTimeout(_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x2b')]);_0x3183cf['timers'][_0x40b075][_0xbd0b('0x2b')]=![];RpcVoiceAgentReport[_0xbd0b('0x2c')]({'acwtime':_0x3b70b4},_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x29')],_0x40b075)[_0xbd0b('0x1c')](function(_0x27c478){logger['info'](_0xbd0b('0x2d'),_0x4c0e52,_0x3b70b4,_0x27c478);})[_0xbd0b('0x2e')](function(_0x32572e){logger[_0xbd0b('0x2f')](_0xbd0b('0x30'),_0x4c0e52,_0x32572e);});delete _0x3183cf[_0xbd0b('0x8')][_0x40b075];};}});}else{logger[_0xbd0b('0x1e')](_0xbd0b('0x31'),_0x4c0e52,_0x40b075,_0x55e0a1);}});}})[_0xbd0b('0x2e')](function(_0x3ac75f){logger[_0xbd0b('0x2f')](_0xbd0b('0x23'),_0x4c0e52,_0x3183cf[_0xbd0b('0x6')][_0x55e0a1][_0xbd0b('0x24')],_0x40b075,_0x55e0a1);})['finally'](function(){delete _0x3183cf[_0xbd0b('0x9')][_0x4c0e52];});}catch(_0x23b0fa){logger['error'](_0xbd0b('0x32'),_0x23b0fa[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x25')]=function(_0x27ad8b){try{var _0x288715=this;if(_0x288715['timers'][_0x27ad8b]){_0x288715[_0xbd0b('0x8')][_0x27ad8b][_0xbd0b('0x2b')]=![];var _0x3b5098=_0x288715[_0xbd0b('0x8')][_0x27ad8b][_0xbd0b('0x29')];var _0x47c961=_0x288715['timers'][_0x27ad8b][_0xbd0b('0x17')];var _0x8db305=_0x288715[_0xbd0b('0x6')][_0x47c961][_0xbd0b('0x24')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x27ad8b);RpcUser[_0xbd0b('0x35')](this['agents'][_0x27ad8b]);RpcVoiceAgentReport[_0xbd0b('0x2c')]({'acwtime':_0x8db305,'agentacw':!![]},_0x3b5098,_0x27ad8b)[_0xbd0b('0x1c')](function(_0x3f34dc){logger[_0xbd0b('0x1e')](_0xbd0b('0x2d'),_0x3b5098,_0x8db305,_0x3f34dc);})[_0xbd0b('0x2e')](function(_0x43115e){logger[_0xbd0b('0x2f')](_0xbd0b('0x30'),_0x3b5098,_0x43115e);});}else{logger[_0xbd0b('0x2f')](_0xbd0b('0x36'),_0x27ad8b);if(_0x288715[_0xbd0b('0x8')]){logger[_0xbd0b('0x1e')](_0xbd0b('0x37'),JSON[_0xbd0b('0x38')](_0x288715[_0xbd0b('0x8')]));}}}catch(_0x16c77c){logger[_0xbd0b('0x2f')]('[ACW][STOP]\x20%s',_0x16c77c[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0xa')]=function(_0x3f4d9b){try{if(this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]]&&(this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]][_0xbd0b('0x39')]||this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]][_0xbd0b('0x18')])){if(this['agents'][_0x3f4d9b[_0xbd0b('0x3a')]]){this['channels'][_0x3f4d9b['uniqueid']]={'queue':_0x3f4d9b[_0xbd0b('0x17')],'interface':_0x3f4d9b[_0xbd0b('0x3a')],'destlinkedid':_0x3f4d9b[_0xbd0b('0x21')]};}}}catch(_0x580fa2){logger[_0xbd0b('0x2f')](_0xbd0b('0x3b'),_0x580fa2[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x13')]=function(_0x4f1e3a){try{if(this[_0xbd0b('0x6')][_0x4f1e3a[_0xbd0b('0x17')]]&&(this[_0xbd0b('0x6')][_0x4f1e3a[_0xbd0b('0x17')]][_0xbd0b('0x39')]||this[_0xbd0b('0x6')][_0x4f1e3a['queue']][_0xbd0b('0x18')])){if(this[_0xbd0b('0x7')][_0x4f1e3a[_0xbd0b('0x3a')]]){this[_0xbd0b('0x9')][_0x4f1e3a[_0xbd0b('0x29')]]={'queue':_0x4f1e3a[_0xbd0b('0x17')],'interface':_0x4f1e3a[_0xbd0b('0x3a')]};}}}catch(_0x563c64){logger[_0xbd0b('0x2f')](_0xbd0b('0x3c'),_0x563c64[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0xd')]=function(_0x30f77e){try{if(this[_0xbd0b('0x9')][_0x30f77e[_0xbd0b('0x29')]]&&_[_0xbd0b('0x3d')](this[_0xbd0b('0x9')][_0x30f77e[_0xbd0b('0x29')]][_0xbd0b('0x20')])){logger[_0xbd0b('0x1e')](_0xbd0b('0x3e'),_0x30f77e[_0xbd0b('0x29')]);this['startAcw'](_0x30f77e[_0xbd0b('0x29')]);}else if(this[_0xbd0b('0x9')][_0x30f77e['linkedid']]&&_['isUndefined'](this['channels'][_0x30f77e[_0xbd0b('0x3f')]]['attended'])){logger[_0xbd0b('0x1e')](_0xbd0b('0x40'),_0x30f77e[_0xbd0b('0x3f')]);this[_0xbd0b('0x16')](_0x30f77e['linkedid']);}}catch(_0x2d2e58){logger['error'](_0xbd0b('0x41'),_0x2d2e58['message']);}};Acw['prototype'][_0xbd0b('0x42')]=function(_0x22f741){try{if(this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x29')]]&&this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x29')]][_0xbd0b('0x20')]){logger[_0xbd0b('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x22f741['uniqueid']);this[_0xbd0b('0x16')](_0x22f741[_0xbd0b('0x29')]);}else if(this['channels'][_0x22f741['linkedid']]&&this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x3f')]][_0xbd0b('0x20')]){logger[_0xbd0b('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x22f741[_0xbd0b('0x3f')]);this[_0xbd0b('0x16')](_0x22f741[_0xbd0b('0x3f')]);}}catch(_0x183029){logger['error'](_0xbd0b('0x43'),_0x183029[_0xbd0b('0x33')]);}};Acw['prototype'][_0xbd0b('0x44')]=function(_0x1ea443){try{if(!_[_0xbd0b('0x45')](this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x46')]])){this[_0xbd0b('0x16')](_0x1ea443[_0xbd0b('0x46')]);if(this[_0xbd0b('0x9')][_0x1ea443['secondtransfereruniqueid']]){this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x47')]][_0xbd0b('0x20')]=!![];this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x48')]]=this[_0xbd0b('0x9')][_0x1ea443['secondtransfereruniqueid']];delete this['channels'][_0x1ea443[_0xbd0b('0x47')]];}}else if(!_[_0xbd0b('0x45')](this['channels'][_0x1ea443[_0xbd0b('0x48')]])){this[_0xbd0b('0x16')](_0x1ea443[_0xbd0b('0x48')]);if(this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]]){this['channels'][_0x1ea443[_0xbd0b('0x49')]][_0xbd0b('0x20')]=!![];this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x46')]]=this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]];delete this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]];}}}catch(_0x429534){logger[_0xbd0b('0x2f')](_0xbd0b('0x4a'),_0x429534[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x11')]=function(_0x164a2e){try{if(this[_0xbd0b('0x9')][_0x164a2e[_0xbd0b('0x4b')]]){logger['info'](_0xbd0b('0x4c'),JSON[_0xbd0b('0x38')](_0x164a2e[_0xbd0b('0x4b')]));this[_0xbd0b('0x16')](_0x164a2e['transfereruniqueid']);}else if(this['channels'][_0x164a2e[_0xbd0b('0x4d')]]){logger[_0xbd0b('0x1e')](_0xbd0b('0x4e'),JSON[_0xbd0b('0x38')](_0x164a2e[_0xbd0b('0x4d')]));this['startAcw'](_0x164a2e[_0xbd0b('0x4d')]);}}catch(_0x4d3664){logger[_0xbd0b('0x2f')](_0xbd0b('0x4f'),_0x4d3664[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x50')]=function(_0x463db8){try{if(this['voiceQueues'][_0x463db8[_0xbd0b('0x17')]]&&this[_0xbd0b('0x6')][_0x463db8[_0xbd0b('0x17')]][_0xbd0b('0x51')]==='all'){if(this[_0xbd0b('0x7')][_0x463db8[_0xbd0b('0x3a')]]){logger[_0xbd0b('0x1e')](_0xbd0b('0x52'),_0x463db8[_0xbd0b('0x29')],_0x463db8['interface'],_0x463db8['queue']);return RpcUser[_0xbd0b('0x22')](this['agents'][_0x463db8[_0xbd0b('0x3a')]],_0xbd0b('0x53'),_0x463db8[_0xbd0b('0x29')]);}}}catch(_0x1876ae){logger[_0xbd0b('0x2f')](_0xbd0b('0x54'),_0x1876ae['message']);}};module[_0xbd0b('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1464a40..21c13d0 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 _0xac49=['asterisk','port','username','keepConnected','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','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionQueueSummary','close','exports','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x514c2e,_0x5683f6){var _0x8c0ba3=function(_0x53a31f){while(--_0x53a31f){_0x514c2e['push'](_0x514c2e['shift']());}};_0x8c0ba3(++_0x5683f6);}(_0xac49,0x12c));var _0x9ac4=function(_0x54e676,_0x3ce8e6){_0x54e676=_0x54e676-0x0;var _0x28e145=_0xac49[_0x54e676];return _0x28e145;};'use strict';var Manager=require(_0x9ac4('0x0'));var BPromise=require('bluebird');var moment=require(_0x9ac4('0x1'));var util=require(_0x9ac4('0x2'));var _=require(_0x9ac4('0x3'));var logger=require('../../config/logger')(_0x9ac4('0x4'));var config=require(_0x9ac4('0x5'));var ami=new Manager(config[_0x9ac4('0x6')][_0x9ac4('0x7')],config['asterisk']['ip'],config[_0x9ac4('0x6')][_0x9ac4('0x8')],config[_0x9ac4('0x6')]['password'],!![]);ami[_0x9ac4('0x9')]();ami[_0x9ac4('0xa')]=BPromise['promisify'](ami['action']);function error(_0x3a720e){logger[_0x9ac4('0xb')](util[_0x9ac4('0xc')](_0x9ac4('0xd'),config[_0x9ac4('0x6')][_0x9ac4('0x8')],config['asterisk']['ip'],config['asterisk'][_0x9ac4('0x7')],util[_0x9ac4('0xe')](_0x3a720e,![],null)));}function close(){logger[_0x9ac4('0xb')](util[_0x9ac4('0xc')](_0x9ac4('0xf'),config[_0x9ac4('0x6')][_0x9ac4('0x8')],config['asterisk']['ip'],config[_0x9ac4('0x6')][_0x9ac4('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x9ac4('0xa')]({'action':_0x9ac4('0x10')});};};ami[_0x9ac4('0x11')]=function(){return function(){return ami[_0x9ac4('0xa')]({'action':'devicestatelist'});};};ami[_0x9ac4('0x12')]=function(){return function(){return ami[_0x9ac4('0xa')]({'action':_0x9ac4('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x9ac4('0xa')]({'action':'queuesummary'});};};ami[_0x9ac4('0x14')]=function(){return function(){return ami[_0x9ac4('0xa')]({'action':_0x9ac4('0x15')});};};function connect(_0x37fdd2){logger[_0x9ac4('0x16')](util[_0x9ac4('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x9ac4('0x6')][_0x9ac4('0x8')],config[_0x9ac4('0x6')]['ip'],config[_0x9ac4('0x6')][_0x9ac4('0x7')]));ami[_0x9ac4('0x17')]('error',error);ami['once']('close',close);}ami['on'](_0x9ac4('0x18'),connect);ami['on'](_0x9ac4('0x19'),function(_0x51cd7d){logger['info'](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x9ac4('0x6')][_0x9ac4('0x8')],config[_0x9ac4('0x6')]['ip'],config[_0x9ac4('0x6')][_0x9ac4('0x7')],util['inspect'](_0x51cd7d,![],null)));});ami['on'](_0x9ac4('0x1a'),function(_0x5ecddf){logger['info'](util[_0x9ac4('0xc')](_0x9ac4('0x1b'),config[_0x9ac4('0x6')][_0x9ac4('0x8')],config['asterisk']['ip'],config['asterisk'][_0x9ac4('0x7')]));return BPromise[_0x9ac4('0x1c')]()[_0x9ac4('0x1d')](ami[_0x9ac4('0x1e')]())['then'](ami[_0x9ac4('0x11')]())[_0x9ac4('0x1d')](ami['actionSipPeerStatus']())['then'](ami[_0x9ac4('0x1f')]())[_0x9ac4('0x1d')](ami['actionCoreShowChannels']())['catch'](function(_0x1fe9b6){console['log'](_0x1fe9b6);});});ami['once']('error',error);ami[_0x9ac4('0x17')](_0x9ac4('0x20'),close);module[_0x9ac4('0x21')]=ami; \ No newline at end of file +var _0xd7ef=['password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','close','exports','moment','util','ami','../../config/environment','port','asterisk'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xd7ef,0x82));var _0xfd7e=function(_0x11b801,_0x2500a6){_0x11b801=_0x11b801-0x0;var _0x724728=_0xd7ef[_0x11b801];return _0x724728;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0xfd7e('0x0'));var util=require(_0xfd7e('0x1'));var _=require('lodash');var logger=require('../../config/logger')(_0xfd7e('0x2'));var config=require(_0xfd7e('0x3'));var ami=new Manager(config['asterisk'][_0xfd7e('0x4')],config[_0xfd7e('0x5')]['ip'],config[_0xfd7e('0x5')]['username'],config[_0xfd7e('0x5')][_0xfd7e('0x6')],!![]);ami[_0xfd7e('0x7')]();ami[_0xfd7e('0x8')]=BPromise['promisify'](ami[_0xfd7e('0x9')]);function error(_0x56b4c6){logger[_0xfd7e('0xa')](util[_0xfd7e('0xb')](_0xfd7e('0xc'),config[_0xfd7e('0x5')][_0xfd7e('0xd')],config[_0xfd7e('0x5')]['ip'],config['asterisk'][_0xfd7e('0x4')],util['inspect'](_0x56b4c6,![],null)));}function close(){logger['error'](util[_0xfd7e('0xb')](_0xfd7e('0xe'),config['asterisk'][_0xfd7e('0xd')],config[_0xfd7e('0x5')]['ip'],config[_0xfd7e('0x5')][_0xfd7e('0x4')]));}ami[_0xfd7e('0xf')]=function(){return function(){return ami[_0xfd7e('0x8')]({'action':_0xfd7e('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xfd7e('0x8')]({'action':'devicestatelist'});};};ami[_0xfd7e('0x11')]=function(){return function(){return ami[_0xfd7e('0x8')]({'action':_0xfd7e('0x12')});};};ami[_0xfd7e('0x13')]=function(){return function(){return ami[_0xfd7e('0x8')]({'action':_0xfd7e('0x14')});};};ami[_0xfd7e('0x15')]=function(){return function(){return ami[_0xfd7e('0x8')]({'action':'coreshowchannels'});};};function connect(_0x517b59){logger['info'](util[_0xfd7e('0xb')](_0xfd7e('0x16'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xfd7e('0x5')]['port']));ami[_0xfd7e('0x17')](_0xfd7e('0xa'),error);ami[_0xfd7e('0x17')]('close',close);}ami['on']('connect',connect);ami['on'](_0xfd7e('0x18'),function(_0x183fc7){logger['info'](util[_0xfd7e('0xb')](_0xfd7e('0x19'),config[_0xfd7e('0x5')][_0xfd7e('0xd')],config[_0xfd7e('0x5')]['ip'],config[_0xfd7e('0x5')]['port'],util['inspect'](_0x183fc7,![],null)));});ami['on']('fullybooted',function(_0x540d0b){logger[_0xfd7e('0x1a')](util[_0xfd7e('0xb')](_0xfd7e('0x1b'),config[_0xfd7e('0x5')]['username'],config[_0xfd7e('0x5')]['ip'],config[_0xfd7e('0x5')]['port']));return BPromise[_0xfd7e('0x1c')]()['then'](ami[_0xfd7e('0xf')]())[_0xfd7e('0x1d')](ami['actionDeviceStateList']())[_0xfd7e('0x1d')](ami[_0xfd7e('0x11')]())['then'](ami[_0xfd7e('0x13')]())[_0xfd7e('0x1d')](ami[_0xfd7e('0x15')]())[_0xfd7e('0x1e')](function(_0x493970){console[_0xfd7e('0x1f')](_0x493970);});});ami[_0xfd7e('0x17')](_0xfd7e('0xa'),error);ami[_0xfd7e('0x17')](_0xfd7e('0x20'),close);module[_0xfd7e('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 658f90f..fbdbe36 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 _0x7af3=['rpc','memberReport','error','message','bluebird','../../config/logger','client','Request','request','then','debug'];(function(_0x211e45,_0x5e3891){var _0x20d6b7=function(_0x4f36fc){while(--_0x4f36fc){_0x211e45['push'](_0x211e45['shift']());}};_0x20d6b7(++_0x5e3891);}(_0x7af3,0xca));var _0x37af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7af3[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x37af('0x0'));var logger=require(_0x37af('0x1'))('ami');var client=jayson[_0x37af('0x2')]['http']({'port':0x2329});client[_0x37af('0x3')]=function(_0x5e8de5,_0x23bf0b){return new BPromise(function(_0x63dd99,_0x514acf){return client[_0x37af('0x4')](_0x5e8de5,_0x23bf0b)[_0x37af('0x5')](function(_0x3787ea){logger[_0x37af('0x6')](_0x37af('0x7'),_0x37af('0x8'),_0x5e8de5,_0x23bf0b,_0x3787ea);if(_0x3787ea[_0x37af('0x9')]){logger[_0x37af('0x9')](_0x37af('0x7'),_0x37af('0x8'),_0x5e8de5,_0x3787ea[_0x37af('0x9')][_0x37af('0xa')],_0x23bf0b);return _0x514acf(_0x3787ea[_0x37af('0x9')][_0x37af('0xa')]);}else{return _0x63dd99(_0x3787ea['result']);}})['catch'](function(_0x5c3b62){logger[_0x37af('0x9')](_0x37af('0x7'),'memberReport',_0x5e8de5,_0x5c3b62,_0x23bf0b);return _0x514acf(_0x5c3b62);});});};module['exports']=client; \ No newline at end of file +var _0x35aa=['error','message','catch','../../config/logger','ami','http','request','then','debug','rpc','memberReport'];(function(_0x2033a6,_0x4cce00){var _0x3768a1=function(_0x589531){while(--_0x589531){_0x2033a6['push'](_0x2033a6['shift']());}};_0x3768a1(++_0x4cce00);}(_0x35aa,0x9d));var _0xa35a=function(_0x17a749,_0x40908b){_0x17a749=_0x17a749-0x0;var _0x10ee89=_0x35aa[_0x17a749];return _0x10ee89;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xa35a('0x0'))(_0xa35a('0x1'));var client=jayson['client'][_0xa35a('0x2')]({'port':0x2329});client['Request']=function(_0x58fe0d,_0x2e1a8d){return new BPromise(function(_0x4fb93c,_0x50efb2){return client[_0xa35a('0x3')](_0x58fe0d,_0x2e1a8d)[_0xa35a('0x4')](function(_0x53dcf9){logger[_0xa35a('0x5')](_0xa35a('0x6'),_0xa35a('0x7'),_0x58fe0d,_0x2e1a8d,_0x53dcf9);if(_0x53dcf9['error']){logger[_0xa35a('0x8')](_0xa35a('0x6'),_0xa35a('0x7'),_0x58fe0d,_0x53dcf9['error'][_0xa35a('0x9')],_0x2e1a8d);return _0x50efb2(_0x53dcf9[_0xa35a('0x8')][_0xa35a('0x9')]);}else{return _0x4fb93c(_0x53dcf9['result']);}})[_0xa35a('0xa')](function(_0x4f5e0b){logger[_0xa35a('0x8')](_0xa35a('0x6'),_0xa35a('0x7'),_0x58fe0d,_0x4f5e0b,_0x2e1a8d);return _0x50efb2(_0x4f5e0b);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index be8b486..d4ca14b 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 _0xc8ac=['YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format'];(function(_0x17c28d,_0x521c95){var _0x218704=function(_0x19079c){while(--_0x19079c){_0x17c28d['push'](_0x17c28d['shift']());}};_0x218704(++_0x521c95);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0xc8ac[_0x4503df];return _0x3f1b2b;};'use strict';var util=require(_0xcc8a('0x0'));var _=require(_0xcc8a('0x1'));var moment=require(_0xcc8a('0x2'));function checkNameSurname(_0x7fb54a,_0x49e7b9,_0xabf5ee){var _0x5e8e2a='';if(!_[_0xcc8a('0x3')](_0x49e7b9)&&_0xcc8a('0x4')===typeof _0x49e7b9){_0x5e8e2a+=_0x49e7b9;}if(!_[_0xcc8a('0x3')](_0xabf5ee)&&_0xcc8a('0x4')===typeof _0xabf5ee){_0x5e8e2a+='\x20'+_0xabf5ee;}if(_0x5e8e2a!==''){return _0x5e8e2a;}return _0x7fb54a;}function Action(_0x243f6b,_0x5321e3,_0x4e6a35){this[_0xcc8a('0x5')]=_0x243f6b;this[_0xcc8a('0x6')]=_0x4e6a35||undefined;this[_0xcc8a('0x7')]=checkNameSurname(_0x5321e3['Contact']['phone'],_0x5321e3[_0xcc8a('0x8')][_0xcc8a('0x9')],_0x5321e3['Contact'][_0xcc8a('0xa')]);this[_0xcc8a('0xb')]=_0x5321e3['Contact'][_0xcc8a('0xc')];this['queue']=_0x243f6b['name'];this[_0xcc8a('0xd')]=_0x5321e3[_0xcc8a('0xd')]||![];this[_0xcc8a('0xe')]=_0x243f6b[_0xcc8a('0xe')];this[_0xcc8a('0xf')]=_0x243f6b[_0xcc8a('0xf')]||0x3;this[_0xcc8a('0x10')]=_0x5321e3[_0xcc8a('0x10')];this[_0xcc8a('0x11')]=_0x5321e3[_0xcc8a('0x11')];this[_0xcc8a('0x12')]=_0x5321e3['countcongestionretry'];this[_0xcc8a('0x13')]=_0x5321e3[_0xcc8a('0x13')];this[_0xcc8a('0x14')]=_0x5321e3[_0xcc8a('0x14')];this[_0xcc8a('0x15')]=_0x5321e3[_0xcc8a('0x15')];this['countabandonedretry']=_0x5321e3[_0xcc8a('0x16')];this[_0xcc8a('0x17')]=_0x5321e3[_0xcc8a('0x17')];this[_0xcc8a('0x18')]=_0x5321e3[_0xcc8a('0x18')];this[_0xcc8a('0x19')]=_0x5321e3[_0xcc8a('0x19')];this['ListId']=_0x5321e3['ListId'];this[_0xcc8a('0x1a')]=_0x5321e3[_0xcc8a('0x1a')];this[_0xcc8a('0x1b')]=_0x5321e3[_0xcc8a('0x1b')];this['CampaignId']=_0x5321e3[_0xcc8a('0x1c')];this['idHopper']=_0x5321e3['id'];this[_0xcc8a('0x1d')]=_0x5321e3[_0xcc8a('0x8')][_0xcc8a('0x9')]||'';this['starttime']=moment()[_0xcc8a('0x1e')](_0xcc8a('0x1f'));this['callback']=_0x5321e3[_0xcc8a('0x20')];this[_0xcc8a('0x21')]=_0x5321e3[_0xcc8a('0x21')];this[_0xcc8a('0x22')]=_0x5321e3[_0xcc8a('0x22')];this['recallme']=_0x5321e3[_0xcc8a('0x23')];this[_0xcc8a('0x24')]='';this['originatecalleridname']='';}Action[_0xcc8a('0x25')][_0xcc8a('0x26')]=function(){return util['format'](_0xcc8a('0x27'),this[_0xcc8a('0x7')],this[_0xcc8a('0x5')][_0xcc8a('0x28')]>0x0?this[_0xcc8a('0xb')][_0xcc8a('0x29')](this[_0xcc8a('0x5')][_0xcc8a('0x28')]):this[_0xcc8a('0xb')]);};Action[_0xcc8a('0x25')][_0xcc8a('0x2a')]=function(){return this[_0xcc8a('0x2b')];};module['exports']=Action; \ No newline at end of file +var _0xd1da=['queue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','voiceQueue','getQueue'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xd1da,0x162));var _0xad1d=function(_0x463697,_0xccfdc4){_0x463697=_0x463697-0x0;var _0x33cfe1=_0xd1da[_0x463697];return _0x33cfe1;};'use strict';var util=require(_0xad1d('0x0'));var _=require(_0xad1d('0x1'));var moment=require(_0xad1d('0x2'));function checkNameSurname(_0x2e2065,_0xeeeb5e,_0x1d8816){var _0x29f718='';if(!_[_0xad1d('0x3')](_0xeeeb5e)&&_0xad1d('0x4')===typeof _0xeeeb5e){_0x29f718+=_0xeeeb5e;}if(!_[_0xad1d('0x3')](_0x1d8816)&&_0xad1d('0x4')===typeof _0x1d8816){_0x29f718+='\x20'+_0x1d8816;}if(_0x29f718!==''){return _0x29f718;}return _0x2e2065;}function Action(_0x1bd69a,_0x41d7b3,_0x47fb73){this['voiceQueue']=_0x1bd69a;this[_0xad1d('0x5')]=_0x47fb73||undefined;this[_0xad1d('0x6')]=checkNameSurname(_0x41d7b3[_0xad1d('0x7')][_0xad1d('0x8')],_0x41d7b3[_0xad1d('0x7')][_0xad1d('0x9')],_0x41d7b3[_0xad1d('0x7')][_0xad1d('0xa')]);this[_0xad1d('0xb')]=_0x41d7b3[_0xad1d('0x7')][_0xad1d('0x8')];this['queue']=_0x1bd69a[_0xad1d('0x6')];this[_0xad1d('0xc')]=_0x41d7b3[_0xad1d('0xc')]||![];this['type']=_0x1bd69a['type'];this[_0xad1d('0xd')]=_0x1bd69a[_0xad1d('0xd')]||0x3;this[_0xad1d('0xe')]=_0x41d7b3[_0xad1d('0xe')];this[_0xad1d('0xf')]=_0x41d7b3[_0xad1d('0xf')];this['countcongestionretry']=_0x41d7b3[_0xad1d('0x10')];this[_0xad1d('0x11')]=_0x41d7b3[_0xad1d('0x11')];this[_0xad1d('0x12')]=_0x41d7b3['countnosuchnumberretry'];this[_0xad1d('0x13')]=_0x41d7b3[_0xad1d('0x13')];this[_0xad1d('0x14')]=_0x41d7b3[_0xad1d('0x14')];this[_0xad1d('0x15')]=_0x41d7b3[_0xad1d('0x15')];this[_0xad1d('0x16')]=_0x41d7b3[_0xad1d('0x16')];this['ContactId']=_0x41d7b3['ContactId'];this['ListId']=_0x41d7b3[_0xad1d('0x17')];this['UserId']=_0x41d7b3[_0xad1d('0x18')];this['VoiceQueueId']=_0x41d7b3[_0xad1d('0x19')];this[_0xad1d('0x1a')]=_0x41d7b3[_0xad1d('0x1a')];this[_0xad1d('0x1b')]=_0x41d7b3['id'];this[_0xad1d('0x1c')]=_0x41d7b3[_0xad1d('0x7')][_0xad1d('0x9')]||'';this['starttime']=moment()[_0xad1d('0x1d')](_0xad1d('0x1e'));this[_0xad1d('0x1f')]=_0x41d7b3[_0xad1d('0x1f')];this[_0xad1d('0x20')]=_0x41d7b3[_0xad1d('0x20')];this['callbackat']=_0x41d7b3[_0xad1d('0x21')];this[_0xad1d('0x22')]=_0x41d7b3[_0xad1d('0x22')];this[_0xad1d('0x23')]='';this[_0xad1d('0x24')]='';}Action[_0xad1d('0x25')]['getCaller']=function(){return util[_0xad1d('0x1d')](_0xad1d('0x26'),this[_0xad1d('0x6')],this['voiceQueue'][_0xad1d('0x27')]>0x0?this[_0xad1d('0xb')]['substring'](this[_0xad1d('0x28')]['dialCutDigit']):this[_0xad1d('0xb')]);};Action[_0xad1d('0x25')][_0xad1d('0x29')]=function(){return this[_0xad1d('0x2a')];};module[_0xad1d('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 05b4d2a..e22341b 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 _0x50e2=['countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','queue','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','countbusyretry'];(function(_0x84aa08,_0x1cdad7){var _0x183b5=function(_0x11b51f){while(--_0x11b51f){_0x84aa08['push'](_0x84aa08['shift']());}};_0x183b5(++_0x1cdad7);}(_0x50e2,0x99));var _0x250e=function(_0x2b5ee5,_0x3741bf){_0x2b5ee5=_0x2b5ee5-0x0;var _0x1c480b=_0x50e2[_0x2b5ee5];return _0x1c480b;};'use strict';var util=require(_0x250e('0x0'));var _=require(_0x250e('0x1'));var moment=require(_0x250e('0x2'));function getSeconds(_0x4f640d,_0x58aa6d){var _0x1f7873=moment(_0x4f640d)[_0x250e('0x3')](0x0);var _0x265401=moment(_0x58aa6d)['milliseconds'](0x0);return _0x1f7873[_0x250e('0x4')](_0x265401,_0x250e('0x5'));}function AgentComplete(_0x280998,_0xdb8e4f){this[_0x250e('0x6')]=0x4;this[_0x250e('0x7')]='Answer';this[_0x250e('0x8')]=_0x280998['scheduledat'];this[_0x250e('0x9')]=_0x280998[_0x250e('0x9')];this['campaigntype']=_0x280998[_0x250e('0x9')]==='outbound'?'queue':_0x280998[_0x250e('0x9')];this[_0x250e('0xa')]=_0x280998[_0x250e('0xa')];this['countcongestionretry']=_0x280998['countcongestionretry'];this[_0x250e('0xb')]=_0x280998[_0x250e('0xb')];this[_0x250e('0xc')]=_0x280998[_0x250e('0xa')]+_0x280998[_0x250e('0xd')]+_0x280998[_0x250e('0xb')]+_0x280998['countnosuchnumberretry']+_0x280998[_0x250e('0xe')]+_0x280998[_0x250e('0xf')]+_0x280998[_0x250e('0x10')]+_0x280998[_0x250e('0x11')];this[_0x250e('0x12')]=_0x280998[_0x250e('0x12')];this[_0x250e('0xe')]=_0x280998[_0x250e('0xe')];this[_0x250e('0xf')]=_0x280998[_0x250e('0xf')];this[_0x250e('0x10')]=_0x280998[_0x250e('0x10')];this[_0x250e('0x11')]=_0x280998[_0x250e('0x11')];this[_0x250e('0x13')]=_0xdb8e4f['uniqueid'];this['calleridname']=_0x280998[_0x250e('0x14')];this['calleridnum']=_0x280998[_0x250e('0x15')];this['starttime']=_0x280998[_0x250e('0x16')];this[_0x250e('0x17')]=_0x280998[_0x250e('0x17')];this[_0x250e('0x18')]=_0x280998['answertime'];this[_0x250e('0x19')]=moment()[_0x250e('0x1a')](_0x250e('0x1b'));this[_0x250e('0x1c')]=getSeconds(_0x280998[_0x250e('0x17')],_0x280998[_0x250e('0x16')]);this['holdtime']=getSeconds(_0x280998[_0x250e('0x18')],_0x280998[_0x250e('0x17')]);this['talktime']=getSeconds(this['endtime'],_0x280998[_0x250e('0x18')]);this[_0x250e('0x1d')]=_0xdb8e4f[_0x250e('0x1d')];this[_0x250e('0x1e')]=_0xdb8e4f[_0x250e('0x1e')];this['reason']=_0xdb8e4f['reason'];this[_0x250e('0x1f')]=_0x280998['callback'];this[_0x250e('0x20')]=_0x280998[_0x250e('0x20')];this[_0x250e('0x21')]=_0x280998[_0x250e('0x21')];this[_0x250e('0x22')]=_0x280998[_0x250e('0x22')];this[_0x250e('0x23')]=_0x280998[_0x250e('0x23')];this[_0x250e('0x24')]=_0x280998['ListId'];this[_0x250e('0x25')]=_0x280998['UserId'];this['VoiceQueueId']=_0x280998['VoiceQueueId'];this[_0x250e('0x26')]=_0x280998[_0x250e('0x26')];this['originatecalleridnum']=_0x280998['originatecalleridnum']||'';this[_0x250e('0x27')]=_0x280998[_0x250e('0x27')]||'';}module[_0x250e('0x28')]=AgentComplete; \ No newline at end of file +var _0x2c3f=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0xc977a,_0x1fb630){var _0x33eadd=function(_0x4584fb){while(--_0x4584fb){_0xc977a['push'](_0xc977a['shift']());}};_0x33eadd(++_0x1fb630);}(_0x2c3f,0x64));var _0xf2c3=function(_0x38d303,_0x4261f0){_0x38d303=_0x38d303-0x0;var _0xfbba86=_0x2c3f[_0x38d303];return _0xfbba86;};'use strict';var util=require(_0xf2c3('0x0'));var _=require(_0xf2c3('0x1'));var moment=require(_0xf2c3('0x2'));function getSeconds(_0x283a48,_0xafbc8d){var _0x3ddc3c=moment(_0x283a48)['milliseconds'](0x0);var _0x50f8e7=moment(_0xafbc8d)['milliseconds'](0x0);return _0x3ddc3c[_0xf2c3('0x3')](_0x50f8e7,_0xf2c3('0x4'));}function AgentComplete(_0x41243b,_0x28c69f){this[_0xf2c3('0x5')]=0x4;this[_0xf2c3('0x6')]=_0xf2c3('0x7');this[_0xf2c3('0x8')]=_0x41243b[_0xf2c3('0x8')];this[_0xf2c3('0x9')]=_0x41243b[_0xf2c3('0x9')];this[_0xf2c3('0xa')]=_0x41243b[_0xf2c3('0x9')]==='outbound'?'queue':_0x41243b[_0xf2c3('0x9')];this[_0xf2c3('0xb')]=_0x41243b[_0xf2c3('0xb')];this[_0xf2c3('0xc')]=_0x41243b[_0xf2c3('0xc')];this['countnoanswerretry']=_0x41243b[_0xf2c3('0xd')];this[_0xf2c3('0xe')]=_0x41243b[_0xf2c3('0xb')]+_0x41243b[_0xf2c3('0xc')]+_0x41243b[_0xf2c3('0xd')]+_0x41243b[_0xf2c3('0xf')]+_0x41243b[_0xf2c3('0x10')]+_0x41243b['countabandonedretry']+_0x41243b[_0xf2c3('0x11')]+_0x41243b['countagentrejectretry'];this[_0xf2c3('0xf')]=_0x41243b[_0xf2c3('0xf')];this['countdropretry']=_0x41243b['countdropretry'];this[_0xf2c3('0x12')]=_0x41243b[_0xf2c3('0x12')];this[_0xf2c3('0x11')]=_0x41243b[_0xf2c3('0x11')];this[_0xf2c3('0x13')]=_0x41243b[_0xf2c3('0x13')];this[_0xf2c3('0x14')]=_0x28c69f[_0xf2c3('0x14')];this[_0xf2c3('0x15')]=_0x41243b[_0xf2c3('0x16')];this[_0xf2c3('0x17')]=_0x41243b[_0xf2c3('0x18')];this[_0xf2c3('0x19')]=_0x41243b[_0xf2c3('0x19')];this['responsetime']=_0x41243b['responsetime'];this[_0xf2c3('0x1a')]=_0x41243b[_0xf2c3('0x1a')];this['endtime']=moment()[_0xf2c3('0x1b')](_0xf2c3('0x1c'));this[_0xf2c3('0x1d')]=getSeconds(_0x41243b[_0xf2c3('0x1e')],_0x41243b['starttime']);this[_0xf2c3('0x1f')]=getSeconds(_0x41243b[_0xf2c3('0x1a')],_0x41243b[_0xf2c3('0x1e')]);this[_0xf2c3('0x20')]=getSeconds(this[_0xf2c3('0x21')],_0x41243b[_0xf2c3('0x1a')]);this[_0xf2c3('0x22')]=_0x28c69f[_0xf2c3('0x22')];this[_0xf2c3('0x23')]=_0x28c69f[_0xf2c3('0x23')];this['reason']=_0x28c69f[_0xf2c3('0x24')];this[_0xf2c3('0x25')]=_0x41243b['callback'];this[_0xf2c3('0x26')]=_0x41243b[_0xf2c3('0x26')];this[_0xf2c3('0x27')]=_0x41243b['callbackat'];this[_0xf2c3('0x28')]=_0x41243b[_0xf2c3('0x28')];this[_0xf2c3('0x29')]=_0x41243b[_0xf2c3('0x29')];this[_0xf2c3('0x2a')]=_0x41243b[_0xf2c3('0x2a')];this[_0xf2c3('0x2b')]=_0x41243b[_0xf2c3('0x2b')];this[_0xf2c3('0x2c')]=_0x41243b[_0xf2c3('0x2c')];this['CampaignId']=_0x41243b[_0xf2c3('0x2d')];this['originatecalleridnum']=_0x41243b['originatecalleridnum']||'';this[_0xf2c3('0x2e')]=_0x41243b[_0xf2c3('0x2e')]||'';}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 a16d9b2..bf1ea6f 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 _0xe814=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe814,0x191));var _0x4e81=function(_0x31abb7,_0x47a3ea){_0x31abb7=_0x31abb7-0x0;var _0x3cfed2=_0xe814[_0x31abb7];return _0x3cfed2;};'use strict';var util=require(_0x4e81('0x0'));var _=require(_0x4e81('0x1'));var moment=require(_0x4e81('0x2'));function getSeconds(_0x4370a7,_0x234840){var _0x4fe36f=moment(_0x4370a7)[_0x4e81('0x3')](0x0);var _0x5bd3e8=moment(_0x234840)[_0x4e81('0x3')](0x0);return _0x4fe36f[_0x4e81('0x4')](_0x5bd3e8,'seconds');}function Final(_0x20f738){this[_0x4e81('0x5')]=_0x20f738[_0x4e81('0x5')];this[_0x4e81('0x6')]=_0x20f738['scheduledat'];this[_0x4e81('0x7')]=_0x20f738[_0x4e81('0x7')];this[_0x4e81('0x8')]=_0x20f738[_0x4e81('0x7')]===_0x4e81('0x9')?_0x4e81('0xa'):_0x20f738[_0x4e81('0x7')];this[_0x4e81('0xb')]=_0x20f738[_0x4e81('0xb')];this['countcongestionretry']=_0x20f738[_0x4e81('0xc')];this['countnoanswerretry']=_0x20f738[_0x4e81('0xd')];this['countglobal']=_0x20f738['countbusyretry']+_0x20f738[_0x4e81('0xc')]+_0x20f738[_0x4e81('0xd')]+_0x20f738[_0x4e81('0xe')]+_0x20f738[_0x4e81('0xf')]+_0x20f738[_0x4e81('0x10')]+_0x20f738['countmachineretry']+_0x20f738['countagentrejectretry'];this[_0x4e81('0xe')]=_0x20f738['countnosuchnumberretry'];this[_0x4e81('0xf')]=_0x20f738[_0x4e81('0xf')];this[_0x4e81('0x10')]=_0x20f738[_0x4e81('0x10')];this['countmachineretry']=_0x20f738['countmachineretry'];this['countagentrejectretry']=_0x20f738[_0x4e81('0x11')];this[_0x4e81('0xa')]=_0x20f738[_0x4e81('0xa')];this['calleridname']=_0x20f738[_0x4e81('0x12')];this[_0x4e81('0x13')]=_0x20f738[_0x4e81('0x13')];this[_0x4e81('0x14')]=_0x20f738[_0x4e81('0x14')];this[_0x4e81('0x15')]=_0x20f738[_0x4e81('0x15')];this['endtime']=_0x20f738['responsetime'];this['ringtime']=_0x20f738['ringtime']||0x0;this[_0x4e81('0x16')]=_0x20f738[_0x4e81('0x16')]||0x0;this[_0x4e81('0x17')]=_0x20f738[_0x4e81('0x17')]||0x0;this[_0x4e81('0x18')]=_0x20f738[_0x4e81('0x18')];this['callbackuniqueid']=_0x20f738[_0x4e81('0x19')];this[_0x4e81('0x1a')]=_0x20f738[_0x4e81('0x1a')];this[_0x4e81('0x1b')]=_0x20f738[_0x4e81('0x1b')];this[_0x4e81('0x1c')]=_0x20f738[_0x4e81('0x1c')];this[_0x4e81('0x1d')]=_0x20f738[_0x4e81('0x1d')];this[_0x4e81('0x1e')]=_0x20f738[_0x4e81('0x1e')];this[_0x4e81('0x1f')]=_0x20f738['VoiceQueueId'];this[_0x4e81('0x20')]=_0x20f738[_0x4e81('0x20')];this[_0x4e81('0x21')]=_0x20f738['originatecalleridnum']||'';this['originatecalleridname']=_0x20f738[_0x4e81('0x22')]||'';}module[_0x4e81('0x23')]=Final; \ No newline at end of file +var _0x4f90=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','queue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4f90,0x12b));var _0x04f9=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x4f90[_0x1e6db3];return _0x1de886;};'use strict';var util=require(_0x04f9('0x0'));var _=require(_0x04f9('0x1'));var moment=require(_0x04f9('0x2'));function getSeconds(_0x337534,_0x5fec23){var _0x4df54d=moment(_0x337534)[_0x04f9('0x3')](0x0);var _0xb406ad=moment(_0x5fec23)['milliseconds'](0x0);return _0x4df54d[_0x04f9('0x4')](_0xb406ad,_0x04f9('0x5'));}function Final(_0x420d7e){this[_0x04f9('0x6')]=_0x420d7e['uniqueid'];this[_0x04f9('0x7')]=_0x420d7e[_0x04f9('0x7')];this[_0x04f9('0x8')]=_0x420d7e[_0x04f9('0x8')];this[_0x04f9('0x9')]=_0x420d7e['type']===_0x04f9('0xa')?'queue':_0x420d7e['type'];this[_0x04f9('0xb')]=_0x420d7e[_0x04f9('0xb')];this[_0x04f9('0xc')]=_0x420d7e[_0x04f9('0xc')];this[_0x04f9('0xd')]=_0x420d7e[_0x04f9('0xd')];this[_0x04f9('0xe')]=_0x420d7e[_0x04f9('0xb')]+_0x420d7e[_0x04f9('0xc')]+_0x420d7e[_0x04f9('0xd')]+_0x420d7e['countnosuchnumberretry']+_0x420d7e[_0x04f9('0xf')]+_0x420d7e[_0x04f9('0x10')]+_0x420d7e['countmachineretry']+_0x420d7e[_0x04f9('0x11')];this[_0x04f9('0x12')]=_0x420d7e[_0x04f9('0x12')];this[_0x04f9('0xf')]=_0x420d7e[_0x04f9('0xf')];this['countabandonedretry']=_0x420d7e[_0x04f9('0x10')];this[_0x04f9('0x13')]=_0x420d7e['countmachineretry'];this[_0x04f9('0x11')]=_0x420d7e[_0x04f9('0x11')];this['queue']=_0x420d7e[_0x04f9('0x14')];this[_0x04f9('0x15')]=_0x420d7e[_0x04f9('0x15')];this['calleridnum']=_0x420d7e[_0x04f9('0x16')];this['starttime']=_0x420d7e[_0x04f9('0x17')];this[_0x04f9('0x18')]=_0x420d7e[_0x04f9('0x18')];this[_0x04f9('0x19')]=_0x420d7e[_0x04f9('0x18')];this[_0x04f9('0x1a')]=_0x420d7e[_0x04f9('0x1a')]||0x0;this[_0x04f9('0x1b')]=_0x420d7e['holdtime']||0x0;this[_0x04f9('0x1c')]=_0x420d7e['talktime']||0x0;this[_0x04f9('0x1d')]=_0x420d7e[_0x04f9('0x1d')];this[_0x04f9('0x1e')]=_0x420d7e[_0x04f9('0x1e')];this[_0x04f9('0x1f')]=_0x420d7e[_0x04f9('0x1f')];this[_0x04f9('0x20')]=_0x420d7e[_0x04f9('0x20')];this[_0x04f9('0x21')]=_0x420d7e['ContactId'];this[_0x04f9('0x22')]=_0x420d7e[_0x04f9('0x22')];this[_0x04f9('0x23')]=_0x420d7e[_0x04f9('0x23')];this[_0x04f9('0x24')]=_0x420d7e[_0x04f9('0x24')];this['CampaignId']=_0x420d7e[_0x04f9('0x25')];this[_0x04f9('0x26')]=_0x420d7e['originatecalleridnum']||'';this[_0x04f9('0x27')]=_0x420d7e[_0x04f9('0x27')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 99147e8..7260e04 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 _0x3219=['uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','milliseconds','diff','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry'];(function(_0x41d360,_0x12436b){var _0x73aef5=function(_0x22ffd5){while(--_0x22ffd5){_0x41d360['push'](_0x41d360['shift']());}};_0x73aef5(++_0x12436b);}(_0x3219,0x6d));var _0x9321=function(_0x4604ad,_0x2c516e){_0x4604ad=_0x4604ad-0x0;var _0x3ed8ef=_0x3219[_0x4604ad];return _0x3ed8ef;};'use strict';var util=require('util');var _=require(_0x9321('0x0'));var moment=require('moment');function getSeconds(_0x3f9ddc,_0x5e523c){var _0x477a61=moment(_0x3f9ddc)[_0x9321('0x1')](0x0);var _0x3c48d8=moment(_0x5e523c)[_0x9321('0x1')](0x0);return _0x477a61[_0x9321('0x2')](_0x3c48d8,'seconds');}function Hangup(_0x253d5e,_0x37cc48){this[_0x9321('0x3')]=0x4;this['statedesc']='Answer';this[_0x9321('0x4')]=_0x253d5e[_0x9321('0x4')];this['type']=_0x253d5e[_0x9321('0x5')];this[_0x9321('0x6')]=_0x253d5e['type']===_0x9321('0x7')?_0x9321('0x8'):_0x253d5e[_0x9321('0x5')];this[_0x9321('0x9')]=_0x253d5e[_0x9321('0x9')];this[_0x9321('0xa')]=_0x253d5e[_0x9321('0xa')];this['countnoanswerretry']=_0x253d5e[_0x9321('0xb')];this['countglobal']=_0x253d5e[_0x9321('0x9')]+_0x253d5e[_0x9321('0xa')]+_0x253d5e[_0x9321('0xb')]+_0x253d5e['countnosuchnumberretry']+_0x253d5e[_0x9321('0xc')]+_0x253d5e[_0x9321('0xd')]+_0x253d5e[_0x9321('0xe')]+_0x253d5e['countagentrejectretry'];this[_0x9321('0xf')]=_0x253d5e[_0x9321('0xf')];this[_0x9321('0xc')]=_0x253d5e[_0x9321('0xc')];this['countabandonedretry']=_0x253d5e[_0x9321('0xd')];this['countmachineretry']=_0x253d5e[_0x9321('0xe')];this[_0x9321('0x10')]=_0x253d5e[_0x9321('0x10')];this['uniqueid']=_0x37cc48[_0x9321('0x11')];this[_0x9321('0x12')]=_0x253d5e[_0x9321('0x13')];this[_0x9321('0x14')]=_0x253d5e['number'];this[_0x9321('0x15')]=_0x253d5e['starttime'];this[_0x9321('0x16')]=_0x253d5e[_0x9321('0x16')];this[_0x9321('0x17')]=moment()[_0x9321('0x18')](_0x9321('0x19'));this[_0x9321('0x1a')]=getSeconds(_0x253d5e[_0x9321('0x16')],_0x253d5e[_0x9321('0x15')]);this['holdtime']=0x0;this[_0x9321('0x1b')]=getSeconds(this[_0x9321('0x17')],_0x253d5e[_0x9321('0x16')]);this[_0x9321('0x8')]=_0x253d5e[_0x9321('0x8')];this[_0x9321('0x1c')]=_0x9321('0x1d');this[_0x9321('0x1e')]=_0x37cc48[_0x9321('0x1f')];this[_0x9321('0x20')]=_0x253d5e[_0x9321('0x20')];this[_0x9321('0x21')]=_0x253d5e[_0x9321('0x21')];this[_0x9321('0x22')]=_0x253d5e[_0x9321('0x22')];this[_0x9321('0x23')]=_0x253d5e[_0x9321('0x23')];this[_0x9321('0x24')]=_0x253d5e[_0x9321('0x24')];this['ListId']=_0x253d5e[_0x9321('0x25')];this[_0x9321('0x26')]=_0x253d5e['UserId'];this[_0x9321('0x27')]=_0x253d5e[_0x9321('0x27')];this[_0x9321('0x28')]=_0x253d5e[_0x9321('0x28')];}module[_0x9321('0x29')]=Hangup; \ No newline at end of file +var _0x00f0=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt'];(function(_0x407bbe,_0x1ca38b){var _0x52fb99=function(_0x371664){while(--_0x371664){_0x407bbe['push'](_0x407bbe['shift']());}};_0x52fb99(++_0x1ca38b);}(_0x00f0,0x1ad));var _0x000f=function(_0x261c86,_0xe9cb28){_0x261c86=_0x261c86-0x0;var _0x22703f=_0x00f0[_0x261c86];return _0x22703f;};'use strict';var util=require(_0x000f('0x0'));var _=require(_0x000f('0x1'));var moment=require(_0x000f('0x2'));function getSeconds(_0x5ddd11,_0xfbda8){var _0x51a92f=moment(_0x5ddd11)[_0x000f('0x3')](0x0);var _0x1ffaf0=moment(_0xfbda8)[_0x000f('0x3')](0x0);return _0x51a92f[_0x000f('0x4')](_0x1ffaf0,_0x000f('0x5'));}function Hangup(_0x3c0dec,_0x4a3ea5){this[_0x000f('0x6')]=0x4;this[_0x000f('0x7')]='Answer';this[_0x000f('0x8')]=_0x3c0dec[_0x000f('0x8')];this[_0x000f('0x9')]=_0x3c0dec[_0x000f('0x9')];this[_0x000f('0xa')]=_0x3c0dec[_0x000f('0x9')]==='outbound'?_0x000f('0xb'):_0x3c0dec[_0x000f('0x9')];this['countbusyretry']=_0x3c0dec[_0x000f('0xc')];this[_0x000f('0xd')]=_0x3c0dec[_0x000f('0xd')];this[_0x000f('0xe')]=_0x3c0dec[_0x000f('0xe')];this['countglobal']=_0x3c0dec[_0x000f('0xc')]+_0x3c0dec[_0x000f('0xd')]+_0x3c0dec[_0x000f('0xe')]+_0x3c0dec[_0x000f('0xf')]+_0x3c0dec[_0x000f('0x10')]+_0x3c0dec['countabandonedretry']+_0x3c0dec['countmachineretry']+_0x3c0dec['countagentrejectretry'];this['countnosuchnumberretry']=_0x3c0dec[_0x000f('0xf')];this[_0x000f('0x10')]=_0x3c0dec[_0x000f('0x10')];this[_0x000f('0x11')]=_0x3c0dec[_0x000f('0x11')];this[_0x000f('0x12')]=_0x3c0dec[_0x000f('0x12')];this[_0x000f('0x13')]=_0x3c0dec[_0x000f('0x13')];this[_0x000f('0x14')]=_0x4a3ea5[_0x000f('0x14')];this['calleridname']=_0x3c0dec['name'];this[_0x000f('0x15')]=_0x3c0dec[_0x000f('0x16')];this['starttime']=_0x3c0dec[_0x000f('0x17')];this[_0x000f('0x18')]=_0x3c0dec[_0x000f('0x18')];this[_0x000f('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x000f('0x1a')]=getSeconds(_0x3c0dec[_0x000f('0x18')],_0x3c0dec[_0x000f('0x17')]);this[_0x000f('0x1b')]=0x0;this[_0x000f('0x1c')]=getSeconds(this[_0x000f('0x19')],_0x3c0dec[_0x000f('0x18')]);this[_0x000f('0xb')]=_0x3c0dec[_0x000f('0xb')];this[_0x000f('0x1d')]=_0x000f('0x1e');this[_0x000f('0x1f')]=_0x4a3ea5[_0x000f('0x20')];this[_0x000f('0x21')]=_0x3c0dec[_0x000f('0x21')];this[_0x000f('0x22')]=_0x3c0dec[_0x000f('0x22')];this['callbackat']=_0x3c0dec[_0x000f('0x23')];this[_0x000f('0x24')]=_0x3c0dec[_0x000f('0x24')];this[_0x000f('0x25')]=_0x3c0dec[_0x000f('0x25')];this[_0x000f('0x26')]=_0x3c0dec[_0x000f('0x26')];this[_0x000f('0x27')]=_0x3c0dec['UserId'];this[_0x000f('0x28')]=_0x3c0dec[_0x000f('0x28')];this[_0x000f('0x29')]=_0x3c0dec[_0x000f('0x29')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 8d80c7b..5383003 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 _0xb59a=['responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime'];(function(_0x14137b,_0x239ced){var _0x3fefb1=function(_0x289a97){while(--_0x289a97){_0x14137b['push'](_0x14137b['shift']());}};_0x3fefb1(++_0x239ced);}(_0xb59a,0x16f));var _0xab59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb59a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xab59('0x0'));var _=require(_0xab59('0x1'));var moment=require('moment');function getSeconds(_0x3273e3,_0x59968d){var _0x1b0a96=moment(_0x3273e3)[_0xab59('0x2')](0x0);var _0x389f60=moment(_0x59968d)[_0xab59('0x2')](0x0);return _0x1b0a96[_0xab59('0x3')](_0x389f60,'seconds');}function History(_0x252952){this[_0xab59('0x4')]=_0x252952[_0xab59('0x4')];this[_0xab59('0x5')]=_0x252952['scheduledat']||undefined;this[_0xab59('0x6')]=_0x252952[_0xab59('0x6')];this[_0xab59('0x7')]=_0x252952['type']===_0xab59('0x8')?_0xab59('0x9'):_0x252952[_0xab59('0x6')];this[_0xab59('0xa')]=_0x252952[_0xab59('0xa')];this[_0xab59('0xb')]=_0x252952[_0xab59('0xb')];this['countnoanswerretry']=_0x252952[_0xab59('0xc')];this[_0xab59('0xd')]=_0x252952['countbusyretry']+_0x252952['countcongestionretry']+_0x252952[_0xab59('0xc')]+_0x252952[_0xab59('0xe')]+_0x252952[_0xab59('0xf')]+_0x252952[_0xab59('0x10')]+_0x252952[_0xab59('0x11')]+_0x252952[_0xab59('0x12')];this['countnosuchnumberretry']=_0x252952[_0xab59('0xe')];this[_0xab59('0xf')]=_0x252952['countdropretry'];this[_0xab59('0x10')]=_0x252952[_0xab59('0x10')];this[_0xab59('0x11')]=_0x252952[_0xab59('0x11')];this['countagentrejectretry']=_0x252952[_0xab59('0x12')];this[_0xab59('0x9')]=_0x252952[_0xab59('0x9')];this[_0xab59('0x13')]=_0x252952[_0xab59('0x14')];this[_0xab59('0x15')]=_0x252952['number'];this[_0xab59('0x16')]=_0x252952[_0xab59('0x16')];this[_0xab59('0x17')]=_0x252952[_0xab59('0x17')];this[_0xab59('0x18')]=_0x252952['responsetime'];this['ringtime']=getSeconds(_0x252952[_0xab59('0x17')],_0x252952[_0xab59('0x16')]);this[_0xab59('0x19')]=0x0;this[_0xab59('0x1a')]=0x0;this[_0xab59('0x1b')]=_0x252952[_0xab59('0x1b')];this[_0xab59('0x1c')]=_0x252952[_0xab59('0x1c')];this[_0xab59('0x1d')]=_0x252952[_0xab59('0x1d')];this['recallme']=_0x252952[_0xab59('0x1e')];this['ContactId']=_0x252952[_0xab59('0x1f')];this[_0xab59('0x20')]=_0x252952[_0xab59('0x20')];this['UserId']=_0x252952[_0xab59('0x21')];this['VoiceQueueId']=_0x252952[_0xab59('0x22')];this[_0xab59('0x23')]=_0x252952[_0xab59('0x23')];this[_0xab59('0x24')]=_0x252952['originatecalleridnum']||'';this['originatecalleridname']=_0x252952[_0xab59('0x25')]||'';}module[_0xab59('0x26')]=History; \ No newline at end of file +var _0xd406=['seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x3fd6f8,_0x2fff39){var _0x58377d=function(_0x1d9162){while(--_0x1d9162){_0x3fd6f8['push'](_0x3fd6f8['shift']());}};_0x58377d(++_0x2fff39);}(_0xd406,0x90));var _0x6d40=function(_0x23c248,_0x57c7ad){_0x23c248=_0x23c248-0x0;var _0x4b7aac=_0xd406[_0x23c248];return _0x4b7aac;};'use strict';var util=require(_0x6d40('0x0'));var _=require(_0x6d40('0x1'));var moment=require(_0x6d40('0x2'));function getSeconds(_0x55a1ec,_0x329bf6){var _0x33e230=moment(_0x55a1ec)[_0x6d40('0x3')](0x0);var _0x3884cc=moment(_0x329bf6)[_0x6d40('0x3')](0x0);return _0x33e230['diff'](_0x3884cc,_0x6d40('0x4'));}function History(_0x2bdb2e){this[_0x6d40('0x5')]=_0x2bdb2e[_0x6d40('0x5')];this['scheduledat']=_0x2bdb2e[_0x6d40('0x6')]||undefined;this['type']=_0x2bdb2e['type'];this['campaigntype']=_0x2bdb2e[_0x6d40('0x7')]==='outbound'?_0x6d40('0x8'):_0x2bdb2e[_0x6d40('0x7')];this[_0x6d40('0x9')]=_0x2bdb2e[_0x6d40('0x9')];this['countcongestionretry']=_0x2bdb2e[_0x6d40('0xa')];this[_0x6d40('0xb')]=_0x2bdb2e[_0x6d40('0xb')];this['countglobal']=_0x2bdb2e[_0x6d40('0x9')]+_0x2bdb2e[_0x6d40('0xa')]+_0x2bdb2e[_0x6d40('0xb')]+_0x2bdb2e[_0x6d40('0xc')]+_0x2bdb2e[_0x6d40('0xd')]+_0x2bdb2e[_0x6d40('0xe')]+_0x2bdb2e[_0x6d40('0xf')]+_0x2bdb2e[_0x6d40('0x10')];this['countnosuchnumberretry']=_0x2bdb2e[_0x6d40('0xc')];this['countdropretry']=_0x2bdb2e['countdropretry'];this[_0x6d40('0xe')]=_0x2bdb2e[_0x6d40('0xe')];this[_0x6d40('0xf')]=_0x2bdb2e[_0x6d40('0xf')];this['countagentrejectretry']=_0x2bdb2e[_0x6d40('0x10')];this[_0x6d40('0x8')]=_0x2bdb2e[_0x6d40('0x8')];this[_0x6d40('0x11')]=_0x2bdb2e[_0x6d40('0x12')];this[_0x6d40('0x13')]=_0x2bdb2e['number'];this['starttime']=_0x2bdb2e[_0x6d40('0x14')];this[_0x6d40('0x15')]=_0x2bdb2e[_0x6d40('0x15')];this[_0x6d40('0x16')]=_0x2bdb2e['responsetime'];this[_0x6d40('0x17')]=getSeconds(_0x2bdb2e['responsetime'],_0x2bdb2e[_0x6d40('0x14')]);this['holdtime']=0x0;this[_0x6d40('0x18')]=0x0;this[_0x6d40('0x19')]=_0x2bdb2e['callback'];this[_0x6d40('0x1a')]=_0x2bdb2e[_0x6d40('0x1a')];this['callbackat']=_0x2bdb2e[_0x6d40('0x1b')];this[_0x6d40('0x1c')]=_0x2bdb2e[_0x6d40('0x1c')];this['ContactId']=_0x2bdb2e[_0x6d40('0x1d')];this[_0x6d40('0x1e')]=_0x2bdb2e[_0x6d40('0x1e')];this[_0x6d40('0x1f')]=_0x2bdb2e[_0x6d40('0x1f')];this[_0x6d40('0x20')]=_0x2bdb2e[_0x6d40('0x20')];this['CampaignId']=_0x2bdb2e[_0x6d40('0x21')];this['originatecalleridnum']=_0x2bdb2e[_0x6d40('0x22')]||'';this[_0x6d40('0x23')]=_0x2bdb2e[_0x6d40('0x23')]||'';}module[_0x6d40('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9a76c5d..03a25dc 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 _0x765e=['ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','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---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','state','statedesc','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countcongestionretry','countnoanswerretry','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','syncAgentConnect','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','push','command','interval','timezones','content','indexOf','true','iftime\x20%s,%s','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','handlePower','power','dialPowerLevel','predictive','method\x20not\x20recognized','handleIvr','dialMethod','dialTimezone','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','outbound','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','answered','available','sumDuration','talking','total','unmanaged','abandoned','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','callerid','format','voice:queue:%s'];(function(_0x4f2673,_0x7342b9){var _0x4d5d26=function(_0x34b811){while(--_0x34b811){_0x4f2673['push'](_0x4f2673['shift']());}};_0x4d5d26(++_0x7342b9);}(_0x765e,0x198));var _0xe765=function(_0x5a405d,_0x2b3e5a){_0x5a405d=_0x5a405d-0x0;var _0x3d0885=_0x765e[_0x5a405d];return _0x3d0885;};'use strict';var util=require('util');var _=require(_0xe765('0x0'));var BPromise=require(_0xe765('0x1'));var uuid=require(_0xe765('0x2'));var moment=require(_0xe765('0x3'));var rr=require('rr');var md5=require(_0xe765('0x4'));var Redis=require(_0xe765('0x5'));var ut=require(_0xe765('0x6'));var config=require(_0xe765('0x7'));var logger=require('../../../config/logger')(_0xe765('0x8'));var loggerBooked=require(_0xe765('0x9'))(_0xe765('0xa'));var loggerPredictive=require(_0xe765('0x9'))('predictive');var loggerPredictiveCalls=require(_0xe765('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xe765('0x9'))(_0xe765('0xb'));var ami=require(_0xe765('0xc'));config[_0xe765('0xd')]=_['defaults'](config[_0xe765('0xd')],{'host':_0xe765('0xe'),'port':0x18eb});var io=require(_0xe765('0xf'))(new Redis(config['redis']));var cmHopper=require(_0xe765('0x10'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xe765('0x11'));var Action=require(_0xe765('0x12'));var History=require(_0xe765('0x13'));var Final=require(_0xe765('0x14'));var AgentComplete=require(_0xe765('0x15'));var QueueCallerAbandon=require(_0xe765('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0xe765('0x17')][_0xe765('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0xe765('0x19'),'roundrobin':_0xe765('0x1a')};var Sequence=function(){};Sequence[_0xe765('0x1b')][_0xe765('0x1c')]=function(_0x489df0){this[_0xe765('0x1d')]=this[_0xe765('0x1d')]?this[_0xe765('0x1d')][_0xe765('0x1e')](_0x489df0):_0x489df0();};function Dialer(_0x54c127,_0x1132c1){this[_0xe765('0x1f')]=new Sequence();this[_0xe765('0x20')]=_0x1132c1;this[_0xe765('0x21')]=_0x54c127[_0xe765('0x21')];this['campaigns']=_0x54c127[_0xe765('0x22')];this['agents']=_0x54c127[_0xe765('0x23')];this[_0xe765('0x24')]=_0x54c127['trunks'];this[_0xe765('0x25')]=config[_0xe765('0x25')]||0x2;this['channels']={};this[_0xe765('0x26')]={};this['contactsId']={};this[_0xe765('0x27')]={};this[_0xe765('0x28')]={};this[_0xe765('0x29')]={};this['startProgressive']={};this[_0xe765('0x2a')]={};this[_0xe765('0x2b')]={};this[_0xe765('0x2c')]={};ami['on'](_0xe765('0x2d'),this['syncAgentConnect']['bind'](this));ami['on'](_0xe765('0x2e'),this[_0xe765('0x2f')][_0xe765('0x30')](this));ami['on'](_0xe765('0x31'),this['syncOriginateResponse'][_0xe765('0x30')](this));ami['on'](_0xe765('0x32'),this[_0xe765('0x33')][_0xe765('0x30')](this));ami['on'](_0xe765('0x34'),this[_0xe765('0xb')][_0xe765('0x30')](this));ami['on'](_0xe765('0x35'),this['syncHangup']['bind'](this));ami['on'](_0xe765('0x36'),this[_0xe765('0x37')]['bind'](this));ami['on'](_0xe765('0x38'),this[_0xe765('0x39')][_0xe765('0x30')](this));ami['on']('queuemember',this['syncQueueMember'][_0xe765('0x30')](this));ami['on']('queuestatuscomplete',this[_0xe765('0x3a')][_0xe765('0x30')](this));this['loopCampaigns']();this[_0xe765('0x3b')]();}function isNotNull(_0x2d4f98){return _0x2d4f98!==null&&!_[_0xe765('0x3c')](_0x2d4f98);}function checkIsLoggedIn(_0x34d840,_0x54859f){return function(){if(_0x54859f<=0x0){_0x34d840[_0xe765('0x3d')]=_0xe765('0x3e');throw _0x34d840[_0xe765('0x3f')]+_0xe765('0x40');}};}function isActive(_0x30e5ca){return _0x30e5ca;}function checkIsActive(_0x5ee7ae,_0x2e4268){return function(){if(!isActive(_0x2e4268)){_0x5ee7ae[_0xe765('0x3d')]=_0xe765('0x41');throw _0x5ee7ae[_0xe765('0x3f')]+_0xe765('0x42');}};}function checkInterval(_0x2894a6){return function(){if(!isNotNull(_0x2894a6['Interval'])){_0x2894a6[_0xe765('0x3d')]=_0xe765('0x43');throw _0x2894a6['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2894a6[_0xe765('0x44')][_0xe765('0x45')])){_0x2894a6[_0xe765('0x3d')]='INTERVAL_IS_NULL';throw _0x2894a6[_0xe765('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xe765('0x46')](_0x2894a6[_0xe765('0x44')][_0xe765('0x45')]))){_0x2894a6[_0xe765('0x3d')]=_0xe765('0x43');throw _0x2894a6[_0xe765('0x3f')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x22da02,_0x92b06f,_0x3af7e1){return{'action':_0x22da02,'response':_0x92b06f,'message':_0x3af7e1,'stack':_0x3af7e1};}function myreject(_0xb65e05){return function(_0x1f2ed2){return _0xb65e05(msgResponse(_0xe765('0x47'),_0xe765('0x48'),JSON[_0xe765('0x49')](_0x1f2ed2)));};}function getSeconds(_0x2ea6eb,_0x549db1){var _0x54613c=moment(_0x2ea6eb)[_0xe765('0x4a')](0x0);var _0x3ea621=moment(_0x549db1)[_0xe765('0x4a')](0x0);return _0x54613c[_0xe765('0x4b')](_0x3ea621,_0xe765('0x4c'));}function emit(_0x4bb03d,_0x302e12,_0x228dd3){io['to'](_0x4bb03d)[_0xe765('0x4d')](_0x302e12,_0x228dd3);}function emitVoiceQueueSummary(_0x250c87){if(_0x250c87[_0xe765('0x4e')]==='outbound'){var _0xbf1660={'id':_0x250c87['id'],'name':_0x250c87['name'],'strategy':_0x250c87[_0xe765('0x4f')],'answered':_0x250c87[_0xe765('0x50')],'available':_0x250c87[_0xe765('0x51')],'loggedIn':_0x250c87['loggedIn'],'pTalking':_0x250c87['pTalking'],'sumBillable':_0x250c87['sumBillable'],'sumDuration':_0x250c87[_0xe765('0x52')],'sumHoldTime':_0x250c87['sumHoldTime']||0x0,'talking':_0x250c87[_0xe765('0x53')],'total':_0x250c87[_0xe765('0x54')],'type':_0x250c87[_0xe765('0x4e')],'unmanaged':_0x250c87[_0xe765('0x55')],'abandoned':_0x250c87[_0xe765('0x56')],'waiting':_0x250c87['waiting'],'loggedInDb':_0x250c87['loggedInDb'],'dialActive':_0x250c87[_0xe765('0x57')],'dialMethod':_0x250c87['dialMethod'],'dialOriginateCallerIdName':_0x250c87[_0xe765('0x58')],'dialOriginateCallerIdNumber':_0x250c87['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x250c87[_0xe765('0x59')],'dialPrefix':_0x250c87[_0xe765('0x5a')],'outboundAnswerAgiCallsDay':_0x250c87['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x250c87['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x250c87['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x250c87[_0xe765('0x5b')],'outboundCongestionCallsDay':_0x250c87[_0xe765('0x5c')],'outboundDropCallsDayACS':_0x250c87['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x250c87[_0xe765('0x5d')],'outboundDropCallsDayTimeout':_0x250c87[_0xe765('0x5e')],'outboundNoAnswerCallsDay':_0x250c87[_0xe765('0x5f')],'outboundNoSuchCallsDay':_0x250c87[_0xe765('0x60')],'outboundOriginateFailureCallsDay':_0x250c87[_0xe765('0x61')],'outboundReCallsDay':_0x250c87[_0xe765('0x62')],'outboundRejectCallsDay':_0x250c87[_0xe765('0x63')],'outboundUnknownCallsDay':_0x250c87[_0xe765('0x64')],'predictiveIntervalAnsweredCalls':_0x250c87['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x250c87[_0xe765('0x65')],'predictiveIntervalAvgTalktime':_0x250c87['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x250c87['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x250c87['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x250c87[_0xe765('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x250c87[_0xe765('0x67')],'predictiveIntervalHitRate':_0x250c87[_0xe765('0x68')],'predictiveIntervalMultiplicativeFactor':_0x250c87['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x250c87[_0xe765('0x69')],'predictiveIntervalAvailable':_0x250c87[_0xe765('0x6a')],'predictiveIntervalTotalCalls':_0x250c87[_0xe765('0x6b')],'message':_0x250c87[_0xe765('0x3d')],'originated':_0x250c87[_0xe765('0x6c')],'erlangCalls':_0x250c87['erlangCalls'],'erlangCallToSecond':_0x250c87[_0xe765('0x6d')],'erlangAbandonmentRate':_0x250c87[_0xe765('0x6e')],'erlangBusyFactor':_0x250c87['erlangBusyFactor'],'startPredictive':_0x250c87[_0xe765('0x29')],'startProgressive':_0x250c87[_0xe765('0x6f')]};if(_0x250c87[_0xe765('0x70')]){_0xbf1660[_0xe765('0x70')]={'id':_0x250c87[_0xe765('0x70')]['id'],'name':_0x250c87[_0xe765('0x70')][_0xe765('0x3f')],'active':_0x250c87[_0xe765('0x70')]['active'],'callerid':_0x250c87['Trunk'][_0xe765('0x71')]};}if(_0x250c87['Interval']){_0xbf1660[_0xe765('0x44')]={'id':_0x250c87[_0xe765('0x44')]['id'],'name':_0x250c87['Interval']['name']};}var _0x519553=md5(JSON[_0xe765('0x49')](_0xbf1660));if(_0x250c87['md5']!==_0x519553){_0x250c87[_0xe765('0x4')]=_0x519553;emit(util[_0xe765('0x72')](_0xe765('0x73'),_0xbf1660['name']),'voice_queue:save',_0xbf1660);}}}function emitCampaignSummary(_0x3f3542){if(_0x3f3542['type']===_0xe765('0x74')){emit(util[_0xe765('0x72')](_0xe765('0x75'),_0x3f3542[_0xe765('0x3f')]),_0xe765('0x76'),_0x3f3542);}}function checkGetDataPredictive(_0x5ef99b){if(isNotNull(_0x5ef99b)){if(!_['isEmpty'](_0x5ef99b)){loggerPredictive[_0xe765('0x77')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xe765('0x77')](_0xe765('0x78'),_0x5ef99b[_0xe765('0x6b')]);loggerPredictive[_0xe765('0x77')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ef99b['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xe765('0x77')](_0xe765('0x79'),_0x5ef99b['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xe765('0x77')](_0xe765('0x7a'),_0x5ef99b[_0xe765('0x7b')]);loggerPredictive[_0xe765('0x77')](_0xe765('0x7c'),_0x5ef99b[_0xe765('0x65')]);loggerPredictive[_0xe765('0x77')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ef99b[_0xe765('0x7d')]);loggerPredictive[_0xe765('0x77')](_0xe765('0x7e'));if(_0x5ef99b['predictiveIntervalTotalCalls']>0x0){if(!_[_0xe765('0x3c')](_0x5ef99b[_0xe765('0x7d')])&&_0x5ef99b[_0xe765('0x7d')]>0x0){return!![];}else{loggerPredictive[_0xe765('0x77')](_0xe765('0x7f'));}if(!_[_0xe765('0x3c')](_0x5ef99b[_0xe765('0x65')])&&_0x5ef99b[_0xe765('0x65')]>0x0){return!![];}else{loggerPredictive[_0xe765('0x77')](_0xe765('0x80'));}}else{loggerPredictive[_0xe765('0x77')](_0xe765('0x81'));}}else{loggerPredictive[_0xe765('0x77')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0xe765('0x77')](_0xe765('0x82'));}return![];}function mergeDataErlangB(_0x220125){return function(_0x173e28){loggerPredictive[_0xe765('0x77')](_0xe765('0x83'));loggerPredictive[_0xe765('0x77')](_0xe765('0x84'),_0x173e28[_0xe765('0x85')]);loggerPredictive[_0xe765('0x77')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x173e28[_0xe765('0x6d')]);loggerPredictive[_0xe765('0x77')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x173e28[_0xe765('0x6e')]);loggerPredictive[_0xe765('0x77')](_0xe765('0x86'),_0x173e28[_0xe765('0x87')]);loggerPredictive[_0xe765('0x77')](_0xe765('0x88'),_0x173e28[_0xe765('0x6e')]);loggerPredictive['info'](_0xe765('0x7e'));_['merge'](_0x220125,_0x173e28);};}function getDiff(_0x2f26c4){var _0x335e52=moment()['milliseconds'](0x0);var _0x32ba3d=moment(_0x2f26c4)[_0xe765('0x4a')](0x0);return _0x335e52[_0xe765('0x4b')](_0x32ba3d,_0xe765('0x4c'));}function ifInterval(_0x5d5b95,_0x19947f){if(_[_0xe765('0x3c')](_0x19947f)){return![];}if(getDiff(_0x19947f)<_0x5d5b95*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2c8f8a){if(isNotNull(_0x2c8f8a)){if(!_[_0xe765('0x3c')](_0x2c8f8a['startProgressive'])){_0x2c8f8a[_0xe765('0x6f')]=undefined;loggerPredictive['info'](_0x2c8f8a['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xe765('0x3c')](_0x2c8f8a[_0xe765('0x29')])){_0x2c8f8a[_0xe765('0x29')]=undefined;loggerPredictive[_0xe765('0x77')](_0x2c8f8a['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xe765('0x3c')](_0x2c8f8a[_0xe765('0x89')])){clearInterval(_0x2c8f8a[_0xe765('0x89')]);_0x2c8f8a[_0xe765('0x89')]=undefined;loggerPredictive[_0xe765('0x77')](_0x2c8f8a[_0xe765('0x3f')],_0xe765('0x8a'));}}}function erlangb(_0x477fb3,_0x5b51f4){if(_0x5b51f4===0x0){return 0x0;}var _0x46de45=0x1;for(var _0x3e2cc4=0x1;_0x3e2cc4<=_0x5b51f4;_0x3e2cc4+=0x1){_0x46de45=0x1+_0x46de45*_0x3e2cc4/_0x477fb3;}return 0x1/_0x46de45;}function isVoiceQueueOutbound(_0x26fb08){return _0x26fb08==='outbound';}function isNotPreview(_0x207f05){return _0x207f05!==_0xe765('0x20');}function isCampaignIvr(_0x4b9091){return _0x4b9091===_0xe765('0x74');}function getCallerId(_0xfdc195,_0x548026,_0x13c81b){if(!_[_0xe765('0x3c')](_0x13c81b)&&_0xe765('0x8b')===typeof _0x13c81b&&!_[_0xe765('0x46')](_0x13c81b)){if(!_['isUndefined'](_0x548026)&&_0xe765('0x8b')===typeof _0x548026&&!_[_0xe765('0x46')](_0x548026)){return util[_0xe765('0x72')](_0xe765('0x8c'),_0x548026,_0x13c81b);}return util[_0xe765('0x72')](_0xe765('0x8c'),_0x13c81b,_0x13c81b);}if(!_[_0xe765('0x3c')](_0xfdc195)&&_0xe765('0x8b')===typeof _0xfdc195&&!_['isEmpty'](_0xfdc195)){return _0xfdc195;}return _0xe765('0x8d');}function loggerCatchQueueSummary(_0x5da1c4,_0x202219){return function(_0x37d813){freeVariablesPredictive(_0x202219);emitVoiceQueueSummary(_0x202219);emitCampaignSummary(_0x202219);loggerSyncQueueSummary[_0xe765('0x8e')](_0x5da1c4,util[_0xe765('0x8f')](_0x37d813,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xf4d1d7,_0x256788){return function(_0x2ada41){loggerPredictive[_0xe765('0x8e')](_0x256788[_0xe765('0x3f')],_0xf4d1d7);loggerPredictive[_0xe765('0x8e')](_0x2ada41[_0xe765('0x90')]);freeVariablesPredictive(_0x256788);};}function loggerCatch(_0xd9cd0f){return function(_0x4b4e1c){logger[_0xe765('0x8e')](_0xd9cd0f,util[_0xe765('0x8f')](_0x4b4e1c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3df7bf){return _0x3df7bf&&!_['isUndefined'](_0x3df7bf)&&_0x3df7bf[_0xe765('0x91')]>0x0;}function decremetOriginate(_0x544aeb){if(!_['isUndefined'](_0x544aeb)&&_0x544aeb!==null){if(_0x544aeb[_0xe765('0x92')](_0xe765('0x6c'))){if(_0x544aeb[_0xe765('0x6c')]>0x0){_0x544aeb[_0xe765('0x6c')]-=0x1;}else{logger['error'](_0xe765('0x93'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x6b6956,_0x320088,_0x5e6a56){if(_0x320088>_0x5e6a56){for(var _0x5419c6=0x0;_0x5419c6<_0x320088-_0x5e6a56;_0x5419c6+=0x1){decremetOriginate(_0x6b6956);}}}function loggerGetContactDialer(_0xb4b0de,_0x370e21,_0xe756db){return function(_0xb810e8){checkContactLowerLimitOriginate(_0x370e21,_0xe756db,0x0);logger[_0xe765('0x8e')](_0xb4b0de,util[_0xe765('0x8f')](_0xb810e8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x34ee6b){return function(_0x411bcc){if(isNotNull(_0x411bcc)&&isNotNull(_0x411bcc[0x0])){if(_0x411bcc[0x0]['contactsRescheduled']>0x0){_0x34ee6b['message']='RESCHEDULED_CONTACTS';logger['info'](_0xe765('0x94')+_0x34ee6b[_0xe765('0x3f')],_0x411bcc[0x0][_0xe765('0x95')],_0xe765('0x96'));}else{_0x34ee6b[_0xe765('0x3d')]=_0xe765('0x97');logger['info'](_0xe765('0x98')+_0x34ee6b[_0xe765('0x3f')]);}}};}function notSendMessagesQueue(_0x347522){if(_0x347522[_0xe765('0x99')]){freeVariablesPredictive(_0x347522);if(_0x347522['originated']===0x0&&_0x347522[_0xe765('0x53')]===0x0&&_0x347522[_0xe765('0x9a')]===0x0&&(_0x347522[_0xe765('0x9b')]||0x0)===0x0){_0x347522[_0xe765('0x99')]=![];_0x347522[_0xe765('0x51')]=0x0;_0x347522[_0xe765('0x3d')]=_0xe765('0x41');loggerSyncQueueSummary[_0xe765('0x8e')](_0xe765('0x9c'),_0x347522[_0xe765('0x3f')],_0xe765('0x9d'));}else{_0x347522[_0xe765('0x3d')]=_0xe765('0x9e');loggerSyncQueueSummary['error'](_0xe765('0x9c'),_0x347522['name'],_0xe765('0x9f'));}emitVoiceQueueSummary(_0x347522);}}function notSendMessagesCampaign(_0x25475d){if(_0x25475d['sendMessageOneNotActive']){if(_0x25475d['originated']===0x0){_0x25475d['sendMessageOneNotActive']=![];_0x25475d['message']=_0xe765('0x41');loggerSyncQueueSummary[_0xe765('0x8e')](_0xe765('0xa0'),_0x25475d['name'],_0xe765('0x9d'));}else{_0x25475d['message']=_0xe765('0x9e');loggerSyncQueueSummary[_0xe765('0x8e')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x25475d[_0xe765('0x3f')],_0xe765('0x9f'));}emitCampaignSummary(_0x25475d);}}function createObjHistory(_0x4288a2,_0x221508,_0x598bce,_0x20b369,_0x14b2c3){_0x4288a2[_0xe765('0x3d')]=_0x598bce;var _0x132f79=new Action(_0x4288a2,_0x221508);var _0x3ab851=new History(_0x132f79);_0x3ab851['state']=_0x20b369;_0x3ab851['statedesc']=_0x14b2c3;_0x3ab851[_0xe765('0xa1')]=_0x132f79[_0xe765('0xa2')];return _0x3ab851;}Dialer[_0xe765('0x1b')][_0xe765('0x3b')]=function(){var _0x34422b=this;setInterval(function(){_0x34422b[_0xe765('0xa3')](_0x34422b['uniqueId'],_0xe765('0xa4'));_0x34422b['clearZombieChannels'](_0x34422b[_0xe765('0x26')],_0xe765('0xa5'));},0x32c8);};Dialer['prototype'][_0xe765('0xa3')]=function(_0x2e0914,_0x137c1e){var _0x38da83=this;for(var _0x731acd in _0x2e0914){if(_0x2e0914[_0xe765('0x92')](_0x731acd)){this[_0xe765('0x1f')]['enqueue'](function(){if(!_[_0xe765('0xa6')](_0x2e0914[_0x731acd])){return ami[_0xe765('0xa7')]({'action':_0xe765('0xa8'),'channel':_0x2e0914[_0x731acd][_0xe765('0xa9')]})['catch'](function(_0x14ffc7){if(_0x14ffc7[_0xe765('0x3d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2e0914[_0x731acd]&&_0x2e0914[_0x731acd][_0xe765('0x4e')]!==_0xe765('0x74')){_0x38da83['updateOriginated'](_0x38da83[_0xe765('0x21')][_0x2e0914[_0x731acd]['queue']]);logger[_0xe765('0x8e')]('[Dialer][checkChannel]',_0x137c1e,_0x731acd,_0x2e0914[_0x731acd][_0xe765('0xaa')]);delete _0x2e0914[_0x731acd];}if(_0x2e0914[_0x731acd]&&_0x2e0914[_0x731acd][_0xe765('0x4e')]===_0xe765('0x74')){_0x38da83['updateOriginated'](_0x38da83[_0xe765('0x22')][_0x2e0914[_0x731acd][_0xe765('0xaa')]]);logger['error'](_0xe765('0xab'),_0x137c1e,_0x731acd,_0x2e0914[_0x731acd][_0xe765('0xaa')]);delete _0x2e0914[_0x731acd];}},0x2328);}});}});}}};Dialer[_0xe765('0x1b')][_0xe765('0xac')]=function(_0x36e685){return BPromise[_0xe765('0xad')]()[_0xe765('0xae')](cmHopper[_0xe765('0xac')](_0x36e685))[_0xe765('0xaf')](loggerCatch(_0xe765('0xb0')));};Dialer[_0xe765('0x1b')][_0xe765('0xb1')]=function(_0x5e7b71){return BPromise['resolve']()[_0xe765('0xae')](cmHopperBlack[_0xe765('0xb1')](_0x5e7b71))[_0xe765('0xaf')](loggerCatch(_0xe765('0xb2')));};Dialer[_0xe765('0x1b')][_0xe765('0xb3')]=function(_0x5b83f6){return BPromise[_0xe765('0xad')]()[_0xe765('0xae')](cmHopperBlack[_0xe765('0xb3')](_0x5b83f6))[_0xe765('0xaf')](loggerCatch(_0xe765('0xb4')));};Dialer['prototype'][_0xe765('0xb5')]=function(_0x380504){return BPromise[_0xe765('0xad')]()[_0xe765('0xae')](cmHopperHistory['avgHandleTime'](_0x380504))[_0xe765('0xaf')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xe765('0x1b')][_0xe765('0xb6')]=function(_0x5bcc1a){return BPromise[_0xe765('0xad')]()[_0xe765('0xae')](cmHopper['rescheduleContact'](_0x5bcc1a))[_0xe765('0xaf')](loggerCatch(_0xe765('0xb7')));};Dialer['prototype'][_0xe765('0xb8')]=function(_0x138e0e,_0x54292f,_0xe27e3b){return BPromise['resolve']()['then'](cmHopper[_0xe765('0xb8')](_0x138e0e,_0x54292f,_0xe27e3b))['catch'](loggerCatch(_0xe765('0xb9')));};Dialer[_0xe765('0x1b')][_0xe765('0xba')]=function(_0x40c40b,_0x2e78ab,_0x530eea,_0x220398){return BPromise[_0xe765('0xad')]()['then'](cmHopper['getContactDialer'](_0x40c40b,_0x2e78ab,_0x530eea,_0x220398))[_0xe765('0xaf')](loggerCatch(_0xe765('0xbb')));};Dialer['prototype'][_0xe765('0xbc')]=function(_0x14368d,_0x43654b,_0x180fff){return BPromise[_0xe765('0xad')]()[_0xe765('0xae')](cmHopper[_0xe765('0xbc')](_0x14368d,_0x43654b,_0x180fff))[_0xe765('0xaf')](loggerCatch(_0xe765('0xbb')));};Dialer[_0xe765('0x1b')][_0xe765('0xbd')]=function(_0xf9b581){return BPromise[_0xe765('0xad')]()[_0xe765('0xae')](voiceQueueRt[_0xe765('0xbd')](_0xf9b581))[_0xe765('0xaf')](loggerCatch(_0xe765('0xbe')));};Dialer[_0xe765('0x1b')][_0xe765('0xbf')]=function(_0x56aa91){return BPromise[_0xe765('0xad')]()[_0xe765('0xae')](cmHopper['moveContactManagedDialer'](_0x56aa91))[_0xe765('0xaf')](loggerCatch(_0xe765('0xc0')));};Dialer[_0xe765('0x1b')][_0xe765('0xc1')]=function(_0x5245cb){return BPromise[_0xe765('0xad')]()['then'](cmHopperHistory[_0xe765('0xc1')](_0x5245cb))[_0xe765('0xaf')](loggerCatch(_0xe765('0xc2')));};Dialer['prototype'][_0xe765('0xc3')]=function(_0x1296a5){if(!_[_0xe765('0x3c')](_0x1296a5)&&_0x1296a5!==null){if(_0x1296a5[_0xe765('0x92')]('originated')){if(_0x1296a5[_0xe765('0x6c')]>0x0){_0x1296a5['originated']-=0x1;}else{logger[_0xe765('0x8e')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xe765('0xc4'));}};Dialer[_0xe765('0x1b')][_0xe765('0xc5')]=function(_0x2cac9b,_0x1e898e){var _0x39bf7b=this;return function(_0x3482ae){_0x39bf7b['updateOriginated'](_0x1e898e);logger['error'](_0x2cac9b,util['inspect'](_0x3482ae,{'showHidden':![],'depth':null}));};};Dialer[_0xe765('0x1b')][_0xe765('0xc6')]=function(_0x1c8096,_0x504296,_0x3d2b1b){var _0x4ddf52={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x504296);this[_0xe765('0xc7')](_[_0xe765('0xc8')](_0x4ddf52,_[_0xe765('0xc9')](_0x3d2b1b,[_0xe765('0xca'),_0xe765('0xcb'),_0xe765('0xcc'),_0xe765('0xcd'),'CampaignId'])),_0xe765('0xce'),_0xe765('0xcf'));logger['error'](_0x1c8096);};Dialer[_0xe765('0x1b')][_0xe765('0xd0')]=function(_0x1d86f3){return _0x1d86f3===_0xe765('0xd1');};Dialer[_0xe765('0x1b')][_0xe765('0xd2')]=function(_0x5ce302){return!_[_0xe765('0x3c')](_0x5ce302)&&_0x5ce302&&!_[_0xe765('0x3c')](_0x5ce302['name'])&&!_[_0xe765('0x3c')](_0x5ce302[_0xe765('0xd3')])&&_0x5ce302[_0xe765('0xd3')]&&(this[_0xe765('0x24')][util[_0xe765('0x72')](_0xe765('0xd4'),_0x5ce302['name'])][_0xe765('0xa8')]===_0xe765('0xd5')||this[_0xe765('0x24')][util[_0xe765('0x72')](_0xe765('0xd4'),_0x5ce302[_0xe765('0x3f')])][_0xe765('0xa8')]===_0xe765('0xd6'));};Dialer[_0xe765('0x1b')][_0xe765('0xc7')]=function(_0x2f526c,_0x8df8cc,_0x85a66c){this[_0xe765('0xc1')](_0x2f526c)[_0xe765('0xaf')](loggerCatch(_0x8df8cc));this['moveContactManagedDialer'](_0x2f526c)[_0xe765('0xaf')](loggerCatch(_0x85a66c));};Dialer['prototype'][_0xe765('0x39')]=function(_0x1e9f60){var _0xda2610=this['uniqueId'][_0x1e9f60[_0xe765('0xd7')]];var _0xaa3108;if(!_[_0xe765('0xa6')](_0x1e9f60)&&!_[_0xe765('0xa6')](_0x1e9f60[_0xe765('0xd8')])&&!_[_0xe765('0xa6')](_0x1e9f60['variable'][_0xe765('0xd9')])&&_0x1e9f60[_0xe765('0xda')]===_0xe765('0xdb')&&_0xda2610){if(_0xda2610[_0xe765('0x4e')]!==_0xe765('0x74')&&this[_0xe765('0x21')][_0xda2610[_0xe765('0xaa')]][_0xe765('0xdc')]&&_0x1e9f60[_0xe765('0xdd')]===_0xe765('0xde')){delete this[_0xe765('0x27')][_0x1e9f60[_0xe765('0xd7')]];this[_0xe765('0xc3')](this[_0xe765('0x21')][_0xda2610[_0xe765('0xaa')]]);this[_0xe765('0x21')][_0xda2610['queue']][_0xe765('0xdf')]+=0x1;this[_0xe765('0x21')][_0xda2610[_0xe765('0xaa')]][_0xe765('0xe0')]+=0x1;_0xaa3108=new Hangup(_0xda2610,_0x1e9f60);_0xaa3108[_0xe765('0xe1')]=0x12;_0xaa3108[_0xe765('0xe2')]=_0xe765('0xe3');_0xaa3108[_0xe765('0xe4')]=_0xe765('0xe5');this[_0xe765('0xc7')](_0xaa3108,_0xe765('0xe6'),'[syncHangupInAMD]');}if(_0xda2610[_0xe765('0x4e')]!==_0xe765('0x74')&&this['voiceQueues'][_0xda2610[_0xe765('0xaa')]][_0xe765('0xdc')]&&_0x1e9f60[_0xe765('0xdd')]==='MACHINE'){var _0x5480fe=this;return new BPromise(function(_0x1eb00b,_0x537b03){delete _0x5480fe[_0xe765('0x27')][_0x1e9f60[_0xe765('0xd7')]];_0x5480fe[_0xe765('0xc3')](_0x5480fe[_0xe765('0x21')][_0xda2610[_0xe765('0xaa')]]);_0x5480fe[_0xe765('0x21')][_0xda2610[_0xe765('0xaa')]][_0xe765('0xdf')]+=0x1;_0x5480fe[_0xe765('0x21')][_0xda2610[_0xe765('0xaa')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x25816e=_0x5480fe[_0xe765('0x21')][_0xda2610[_0xe765('0xaa')]];var _0x2a84ee=new Hangup(_0xda2610,_0x1e9f60);_0x2a84ee[_0xe765('0xe1')]=0x13;_0x2a84ee['statedesc']='Machine';_0x2a84ee['membername']=_0xe765('0xe5');_0x2a84ee[_0xe765('0xe7')]+=0x1;_0x2a84ee[_0xe765('0xe8')]+=0x1;_0x2a84ee[_0xe765('0xe9')]=!![];_0x5480fe[_0xe765('0xc1')](_0x2a84ee)['catch'](loggerCatch(_0xe765('0xea')));if(_0x2a84ee[_0xe765('0xeb')]+_0x2a84ee['countcongestionretry']+_0x2a84ee['countnoanswerretry']+_0x2a84ee[_0xe765('0xec')]+_0x2a84ee[_0xe765('0xed')]+_0x2a84ee[_0xe765('0xee')]+_0x2a84ee['countmachineretry']+_0x2a84ee[_0xe765('0xef')]>=_0x25816e['dialGlobalMaxRetry']){_0x5480fe[_0xe765('0xf0')](_0x2a84ee,_0x1eb00b,_0x537b03,_0xe765('0xf1'));}else{if(_0x2a84ee[_0xe765('0xe7')]>=_0x25816e[_0xe765('0xf2')]){_0x5480fe[_0xe765('0xf3')](_0x2a84ee,_0x1eb00b,_0x537b03,_0xe765('0xf4'));}else{_0x5480fe[_0xe765('0xb6')]({'active':![],'countmachineretry':_0x2a84ee[_0xe765('0xe7')],'scheduledat':moment()[_0xe765('0xf5')](_0x25816e[_0xe765('0xf6')],_0xe765('0xf7'))[_0xe765('0x72')](_0xe765('0xf8')),'ContactId':_0x2a84ee[_0xe765('0xca')],'ListId':_0x2a84ee[_0xe765('0xcb')],'VoiceQueueId':_0x2a84ee[_0xe765('0xcd')]||undefined,'CampaignId':_0x2a84ee[_0xe765('0xf9')]||undefined})[_0xe765('0xaf')](loggerCatch('[rescheduleContact][Machine]'));_0x1eb00b({'reschedule':0x1});}}});}if(_0xda2610[_0xe765('0x4e')]===_0xe765('0x74')&&this[_0xe765('0x22')][_0xda2610[_0xe765('0xaa')]][_0xe765('0xdc')]&&_0x1e9f60['value']===_0xe765('0xde')){delete this['uniqueId'][_0x1e9f60['uniqueid']];this[_0xe765('0xc3')](this[_0xe765('0x22')][_0xda2610[_0xe765('0xaa')]]);_0xaa3108=new Hangup(_0xda2610,_0x1e9f60);_0xaa3108['state']=0x12;_0xaa3108['statedesc']=_0xe765('0xe3');_0xaa3108[_0xe765('0xe4')]=_0xe765('0xe5');this[_0xe765('0xc7')](_0xaa3108,_0xe765('0xfa'),_0xe765('0xfb'));}if(_0xda2610[_0xe765('0x4e')]==='ivr'&&this[_0xe765('0x22')][_0xda2610[_0xe765('0xaa')]][_0xe765('0xdc')]&&_0x1e9f60['value']===_0xe765('0xfc')){var _0x5480fe=this;return new BPromise(function(_0x12c4c2,_0x4e8109){delete _0x5480fe['uniqueId'][_0x1e9f60[_0xe765('0xd7')]];_0x5480fe[_0xe765('0xc3')](_0x5480fe['campaigns'][_0xda2610['queue']]);_0x5480fe[_0xe765('0x22')][_0xda2610[_0xe765('0xaa')]]['outboundAnswerCallsDay']+=0x1;_0x5480fe['campaigns'][_0xda2610[_0xe765('0xaa')]][_0xe765('0xe0')]+=0x1;var _0x2d2bb6=_0x5480fe[_0xe765('0x22')][_0xda2610[_0xe765('0xaa')]];var _0xafaf8e=new Hangup(_0xda2610,_0x1e9f60);_0xafaf8e[_0xe765('0xe1')]=0x13;_0xafaf8e[_0xe765('0xe2')]=_0xe765('0xfd');_0xafaf8e[_0xe765('0xe4')]=_0xe765('0xe5');_0xafaf8e['countmachineretry']+=0x1;_0xafaf8e['countglobal']+=0x1;_0xafaf8e[_0xe765('0xe9')]=!![];_0x5480fe[_0xe765('0xc1')](_0xafaf8e)['catch'](loggerCatch(_0xe765('0xea')));if(_0xafaf8e[_0xe765('0xeb')]+_0xafaf8e[_0xe765('0xfe')]+_0xafaf8e[_0xe765('0xff')]+_0xafaf8e[_0xe765('0xec')]+_0xafaf8e[_0xe765('0xed')]+_0xafaf8e[_0xe765('0xee')]+_0xafaf8e['countmachineretry']+_0xafaf8e[_0xe765('0xef')]>=_0x2d2bb6['dialGlobalMaxRetry']){_0x5480fe[_0xe765('0xf0')](_0xafaf8e,_0x12c4c2,_0x4e8109,_0xe765('0xf1'));}else{if(_0xafaf8e[_0xe765('0xe7')]>=_0x2d2bb6[_0xe765('0xf2')]){_0x5480fe[_0xe765('0xf3')](_0xafaf8e,_0x12c4c2,_0x4e8109,_0xe765('0xf4'));}else{_0x5480fe['rescheduleContact']({'active':![],'countmachineretry':_0xafaf8e['countmachineretry'],'scheduledat':moment()[_0xe765('0xf5')](_0x2d2bb6[_0xe765('0xf6')],_0xe765('0xf7'))[_0xe765('0x72')](_0xe765('0xf8')),'ContactId':_0xafaf8e[_0xe765('0xca')],'ListId':_0xafaf8e[_0xe765('0xcb')],'VoiceQueueId':_0xafaf8e[_0xe765('0xcd')]||undefined,'CampaignId':_0xafaf8e[_0xe765('0xf9')]||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x100')));_0x12c4c2({'reschedule':0x1});}}});}}};Dialer[_0xe765('0x1b')]['syncHangup']=function(_0x223f0a){var _0x4a553a=this['uniqueId'][_0x223f0a[_0xe765('0xd7')]];var _0x477569=this;var _0x49312f;if(_0x4a553a&&_0x4a553a[_0xe765('0x4e')]==='ivr'){delete this['uniqueId'][_0x223f0a[_0xe765('0xd7')]];this[_0xe765('0xc3')](this[_0xe765('0x22')][_0x4a553a[_0xe765('0xaa')]]);this['campaigns'][_0x4a553a['queue']]['ivrAnswerCallsDay']+=0x1;_0x49312f=new Hangup(_0x4a553a,_0x223f0a);this['createHistory'](_0x49312f)[_0xe765('0xaf')](loggerCatch(_0xe765('0x101')));this[_0xe765('0xbf')](_0x49312f)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x4a553a&&_0x4a553a[_0xe765('0x4e')]!==_0xe765('0x74')&&isNotNull(this['voiceQueues'][_0x4a553a[_0xe765('0xaa')]][_0xe765('0x102')])){delete this[_0xe765('0x27')][_0x223f0a[_0xe765('0xd7')]];this[_0xe765('0xc3')](this[_0xe765('0x21')][_0x4a553a['queue']]);this['voiceQueues'][_0x4a553a[_0xe765('0xaa')]][_0xe765('0xdf')]+=0x1;this[_0xe765('0x21')][_0x4a553a[_0xe765('0xaa')]][_0xe765('0xe0')]+=0x1;_0x49312f=new Hangup(_0x4a553a,_0x223f0a);_0x49312f[_0xe765('0xe1')]=0x10;_0x49312f[_0xe765('0xe2')]='AnswerAGI';_0x49312f[_0xe765('0xe4')]=_0xe765('0x103');this[_0xe765('0xc1')](_0x49312f)['catch'](loggerCatch(_0xe765('0x101')));this['moveContactManagedDialer'](_0x49312f)[_0xe765('0xaf')](loggerCatch(_0xe765('0x104')));}if(_0x4a553a&&_0x4a553a[_0xe765('0x4e')]!=='ivr'&&!isNotNull(this[_0xe765('0x21')][_0x4a553a['queue']][_0xe765('0x102')])){delete this[_0xe765('0x27')][_0x223f0a[_0xe765('0xd7')]];this['updateOriginated'](this['voiceQueues'][_0x4a553a['queue']]);this[_0xe765('0x21')][_0x4a553a[_0xe765('0xaa')]][_0xe765('0x64')]+=0x1;_0x49312f=new Hangup(_0x4a553a,_0x223f0a);_0x49312f[_0xe765('0xe1')]=0xc;_0x49312f[_0xe765('0xe2')]=_0x223f0a[_0xe765('0x105')];_0x49312f[_0xe765('0xe4')]=_0xe765('0x106');this[_0xe765('0xc1')](_0x49312f)[_0xe765('0xaf')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xe765('0xbf')](_0x49312f)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0x139d4c){var _0xb66d02=this['uniqueId'][_0x139d4c[_0xe765('0xd7')]];var _0xbb5d78=this;if(this['voiceQueues'][_0x139d4c[_0xe765('0xaa')]]){if(_0xb66d02&&_0xb66d02['type']!==_0xe765('0x74')){delete this[_0xe765('0x27')][_0x139d4c[_0xe765('0xd7')]];this['voiceQueues'][_0x139d4c['queue']]['outboundAnswerCallsDay']+=0x1;var _0x5e2d18=new AgentComplete(_0xb66d02,_0x139d4c);if(_0x139d4c[_0xe765('0x107')]===_0xe765('0x108')){_0x5e2d18[_0xe765('0x109')]=this['voiceQueues'][_0x139d4c[_0xe765('0xaa')]][_0xe765('0x10a')]&&this['voiceQueues'][_0x139d4c['queue']]['dialAgiAfterHangupAgent']?moment()[_0xe765('0x72')](_0xe765('0xf8')):undefined;}this[_0xe765('0xc1')](_0x5e2d18)[_0xe765('0xaf')](loggerCatch(_0xe765('0x10b')));this[_0xe765('0xbf')](_0x5e2d18)[_0xe765('0xaf')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xe765('0x10c')]=function(_0x21c567){if(this[_0xe765('0x21')][_0x21c567['queue']]){if(this[_0xe765('0x27')][_0x21c567['uniqueid']]&&this[_0xe765('0x27')][_0x21c567['uniqueid']][_0xe765('0x4e')]!==_0xe765('0x74')){this[_0xe765('0xc3')](this[_0xe765('0x21')][_0x21c567[_0xe765('0xaa')]]);this['uniqueId'][_0x21c567[_0xe765('0xd7')]]['answertime']=moment()[_0xe765('0x72')](_0xe765('0xf8'));}}};Dialer['prototype'][_0xe765('0x10d')]=function(_0x3eb18d){this[_0xe765('0xc1')](_0x3eb18d)['catch'](loggerCatch(_0xe765('0x10b')));this['moveContactManagedDialer'](_0x3eb18d)[_0xe765('0xaf')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0xe765('0x2f')]=function(_0x32edd8){var _0x423f1b=this[_0xe765('0x27')][_0x32edd8[_0xe765('0xd7')]];var _0xedf952=this;if(this[_0xe765('0x21')][_0x32edd8['queue']]){if(_0x423f1b&&_0x423f1b[_0xe765('0x4e')]!==_0xe765('0x74')){delete this[_0xe765('0x27')][_0x32edd8[_0xe765('0xd7')]];this['updateOriginated'](this[_0xe765('0x21')][_0x32edd8['queue']]);_0x423f1b[_0xe765('0x10e')]=moment()[_0xe765('0x72')](_0xe765('0xf8'));var _0x5e69a7=new QueueCallerAbandon(_0x423f1b,_0x32edd8);if(getSeconds(_0x423f1b[_0xe765('0x10e')],_0x423f1b[_0xe765('0x10f')])>=_0x423f1b[_0xe765('0x110')]){this[_0xe765('0x21')][_0x32edd8[_0xe765('0xaa')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xe765('0x21')][_0x32edd8['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x32edd8[_0xe765('0xaa')]][_0xe765('0x67')]+=0x1;_0x5e69a7[_0xe765('0xe1')]=0xa;_0x5e69a7[_0xe765('0xe2')]=_0xe765('0x111');_0x5e69a7[_0xe765('0x112')]=_0xe765('0x113');_0x5e69a7[_0xe765('0x109')]=this[_0xe765('0x21')][_0x32edd8['queue']][_0xe765('0x10a')]?moment()[_0xe765('0x72')](_0xe765('0xf8')):undefined;_0x5e69a7[_0xe765('0xed')]+=0x1;_0x5e69a7['countglobal']+=0x1;if(_0x5e69a7[_0xe765('0xed')]>=this['voiceQueues'][_0x32edd8[_0xe765('0xaa')]][_0xe765('0x114')]){this[_0xe765('0x10d')](_0x5e69a7);}else{this[_0xe765('0xb6')]({'active':![],'countdropretry':_0x5e69a7[_0xe765('0xed')],'scheduledat':moment()[_0xe765('0xf5')](this[_0xe765('0x21')][_0x32edd8['queue']]['dialDropRetryFrequency'],_0xe765('0xf7'))['format'](_0xe765('0xf8')),'ContactId':_0x423f1b[_0xe765('0xca')],'ListId':_0x423f1b['ListId'],'VoiceQueueId':_0x423f1b[_0xe765('0xcd')]||undefined,'CampaignId':_0x423f1b[_0xe765('0xf9')]||undefined})['catch'](loggerCatch(_0xe765('0x115')));var _0x538d4c=new History(_0x5e69a7);_0x538d4c[_0xe765('0xe1')]=0xa;_0x538d4c[_0xe765('0xe2')]='Drop';_0x538d4c[_0xe765('0xa2')]=moment()['format'](_0xe765('0xf8'));_0x538d4c['endtime']=_0x538d4c[_0xe765('0xa2')];_0x538d4c[_0xe765('0x116')]=_0x5e69a7[_0xe765('0x116')];_0x538d4c['calleridnum']=_0x5e69a7[_0xe765('0x117')];this['createHistory'](_0x538d4c)[_0xe765('0xaf')](loggerCatch(_0xe765('0x118')));}}else{this[_0xe765('0x21')][_0x32edd8[_0xe765('0xaa')]][_0xe765('0x7b')]+=0x1;this[_0xe765('0x21')][_0x32edd8[_0xe765('0xaa')]][_0xe765('0x5d')]+=0x1;_0x5e69a7[_0xe765('0xe1')]=0xb;_0x5e69a7['statedesc']=_0xe765('0x119');_0x5e69a7[_0xe765('0x112')]=_0xe765('0x11a');_0x5e69a7[_0xe765('0xee')]+=0x1;_0x5e69a7[_0xe765('0xe8')]+=0x1;if(_0x5e69a7['countabandonedretry']>=this[_0xe765('0x21')][_0x32edd8[_0xe765('0xaa')]]['dialAbandonedMaxRetry']){this[_0xe765('0x10d')](_0x5e69a7);}else{this[_0xe765('0xb6')]({'active':![],'countabandonedretry':_0x5e69a7[_0xe765('0xee')],'scheduledat':moment()[_0xe765('0xf5')](this[_0xe765('0x21')][_0x32edd8[_0xe765('0xaa')]]['dialAbandonedRetryFrequency'],'minutes')[_0xe765('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x423f1b['ContactId'],'ListId':_0x423f1b[_0xe765('0xcb')],'VoiceQueueId':_0x423f1b['VoiceQueueId']||undefined,'CampaignId':_0x423f1b[_0xe765('0xf9')]||undefined})[_0xe765('0xaf')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x538d4c=new History(_0x5e69a7);_0x538d4c['state']=0xb;_0x538d4c['statedesc']=_0xe765('0x119');_0x538d4c[_0xe765('0xa2')]=moment()['format'](_0xe765('0xf8'));_0x538d4c['endtime']=_0x538d4c[_0xe765('0xa2')];_0x538d4c[_0xe765('0x116')]=_0x5e69a7[_0xe765('0x116')];_0x538d4c[_0xe765('0x117')]=_0x5e69a7[_0xe765('0x117')];this[_0xe765('0xc1')](_0x538d4c)[_0xe765('0xaf')](loggerCatch(_0xe765('0x11b')));}}}}};Dialer[_0xe765('0x1b')]['syncNewExten']=function(_0x228811){if(this[_0xe765('0x26')][_0x228811['uniqueid']]){this['actions'][_0x228811['uniqueid']][_0xe765('0xa9')]=_0x228811[_0xe765('0xa9')];}if(this['uniqueId'][_0x228811[_0xe765('0xd7')]]){this[_0xe765('0x27')][_0x228811[_0xe765('0xd7')]][_0xe765('0xa9')]=_0x228811[_0xe765('0xa9')];}};Dialer[_0xe765('0x1b')][_0xe765('0x11c')]=function(_0xf05773){if(strategy[this[_0xe765('0x21')][this['actions'][_0xf05773[_0xe765('0x11d')]][_0xe765('0xaa')]][_0xe765('0x4f')]]==='roundrobin'){if(this['actions'][_0xf05773[_0xe765('0x11d')]]&&_[_0xe765('0xa6')](this[_0xe765('0x26')][_0xf05773[_0xe765('0x11d')]][_0xe765('0x11e')])&&_0xf05773[_0xe765('0xa8')]==='1'&&_0xf05773[_0xe765('0x11f')]==='0'){if(this[_0xe765('0x23')][_0xf05773[_0xe765('0x120')]]){if(!this[_0xe765('0x23')][_0xf05773[_0xe765('0x120')]][_0xe765('0x11e')]){this[_0xe765('0x23')][_0xf05773[_0xe765('0x120')]]['locked']=!![];this[_0xe765('0x26')][_0xf05773['actionid']][_0xe765('0x11e')]=!![];this[_0xe765('0x26')][_0xf05773[_0xe765('0x11d')]][_0xe765('0x120')]=_0xf05773[_0xe765('0x120')];}}}}else if((strategy[this[_0xe765('0x21')][this[_0xe765('0x26')][_0xf05773['actionid']][_0xe765('0xaa')]][_0xe765('0x4f')]]||'rrmemory')===_0xe765('0x19')){if(this[_0xe765('0x26')][_0xf05773[_0xe765('0x11d')]]){if(this[_0xe765('0x23')][_0xf05773[_0xe765('0x120')]]){this[_0xe765('0x26')][_0xf05773['actionid']]['stateinterface']=_0xf05773[_0xe765('0x120')];if(_[_0xe765('0xa6')](this[_0xe765('0x2b')][this[_0xe765('0x26')][_0xf05773[_0xe765('0x11d')]][_0xe765('0xaa')]])){this[_0xe765('0x2b')][this[_0xe765('0x26')][_0xf05773['actionid']][_0xe765('0xaa')]]=[];}this[_0xe765('0x2b')][this[_0xe765('0x26')][_0xf05773[_0xe765('0x11d')]][_0xe765('0xaa')]]['push'](_[_0xe765('0xc8')](_['pick'](this[_0xe765('0x26')][_0xf05773[_0xe765('0x11d')]],[_0xe765('0x121'),_0xe765('0x120')]),{'status':_0xf05773[_0xe765('0xa8')],'paused':_0xf05773[_0xe765('0x11f')]}));}}}};function unlockQueueStatus(_0x558919,_0x2dcfdb){setTimeout(function(){if(_[_0xe765('0x3c')](_0x558919['queueStatusComplete'])){loggerBooked[_0xe765('0x8e')](_0xe765('0x122'),_0x2dcfdb);}_0x558919[_0xe765('0x123')]=!![];loggerBooked[_0xe765('0x77')]('[booked][unlockQueueStatus]',_0x2dcfdb,JSON['stringify'](_[_0xe765('0xc9')](_0x558919,[_0xe765('0x3f'),_0xe765('0x123')])));},0x1f3);}Dialer[_0xe765('0x1b')][_0xe765('0x3a')]=function(_0x224b01){var _0x4f2496=this;var _0x5ba3a1=_0x4f2496[_0xe765('0x21')][_0x4f2496['actions'][_0x224b01[_0xe765('0x11d')]][_0xe765('0xaa')]];if(strategy[this[_0xe765('0x21')][this[_0xe765('0x26')][_0x224b01['actionid']]['queue']][_0xe765('0x4f')]]===_0xe765('0x1a')){if(this[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]]&&this[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]][_0xe765('0x120')]){this[_0xe765('0x20')][_0xe765('0x124')](this[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]][_0xe765('0x121')],this[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]][_0xe765('0x120')])[_0xe765('0xaf')](function(_0x43e123){logger[_0xe765('0x8e')](_0xe765('0x125'),util['inspect'](_0x43e123,{'showHidden':![],'depth':null}));})[_0xe765('0x1e')](function(){_0x4f2496[_0xe765('0xc3')](_0x4f2496[_0xe765('0x21')][_0x4f2496[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]][_0xe765('0xaa')]]);_0x4f2496[_0xe765('0x23')][_0x4f2496[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]][_0xe765('0x120')]][_0xe765('0x11e')]=![];delete _0x4f2496['actions'][_0x224b01[_0xe765('0x11d')]];unlockQueueStatus(_0x5ba3a1);});}else{this[_0xe765('0xc3')](this[_0xe765('0x21')][this[_0xe765('0x26')][_0x224b01['actionid']][_0xe765('0xaa')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x224b01['actionid']][_0xe765('0xca')],'ListId':this[_0xe765('0x26')][_0x224b01['actionid']][_0xe765('0xcb')],'VoiceQueueId':this[_0xe765('0x26')][_0x224b01['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]]['CampaignId']||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x126')));delete this['actions'][_0x224b01[_0xe765('0x11d')]];unlockQueueStatus(_0x5ba3a1);}}else if((strategy[this['voiceQueues'][this[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]]['queue']][_0xe765('0x4f')]]||_0xe765('0x19'))===_0xe765('0x19')){var _0xf66b19;if(this[_0xe765('0x26')][_0x224b01['actionid']]&&!_[_0xe765('0x46')](this[_0xe765('0x2b')][this['actions'][_0x224b01[_0xe765('0x11d')]][_0xe765('0xaa')]])){if(this['queueBookedRR'][_0x4f2496['actions'][_0x224b01['actionid']]['queue']]){this['queueBookedRR'][_0x4f2496[_0xe765('0x26')][_0x224b01['actionid']][_0xe765('0xaa')]]=this['queueBookedRR'][this[_0xe765('0x26')][_0x224b01['actionid']][_0xe765('0xaa')]]?this[_0xe765('0x2c')][this['actions'][_0x224b01[_0xe765('0x11d')]][_0xe765('0xaa')]]:this[_0xe765('0x2b')][this[_0xe765('0x26')][_0x224b01[_0xe765('0x11d')]][_0xe765('0xaa')]]?this['queueBooked'][this['actions'][_0x224b01[_0xe765('0x11d')]][_0xe765('0xaa')]][_0xe765('0x127')]||0x0:0x0;}this['queueBooked'][this[_0xe765('0x26')][_0x224b01['actionid']][_0xe765('0xaa')]]['_rr']=this['queueBookedRR'][this[_0xe765('0x26')][_0x224b01['actionid']][_0xe765('0xaa')]];for(var _0x586208=0x0;_0x586208=0x0?!![]:![];})[_0xe765('0xaf')](myreject(_0x372e4c)));}}else{_0x242d2c['push'](ami['Action']({'action':_0xe765('0x140'),'command':util[_0xe765('0x72')](_0xe765('0x146'),_0x1877af,!_[_0xe765('0x3c')](config[_0xe765('0x142')][_0x50dee3])?_0x50dee3:'')})[_0xe765('0xae')](function(_0x4396c3){return _0x4396c3[_0xe765('0x143')][_0xe765('0x144')](_0xe765('0x145'))>=0x0?!![]:![];})[_0xe765('0xaf')](myreject(_0x372e4c)));}BPromise['all'](_0x242d2c)[_0xe765('0xae')](function(_0x3c47a7){var _0x184962=_[_0xe765('0x147')](_0x3c47a7);if(_0x184962){return _0x109e33(_0x184962);}else{_0x569fa0[_0xe765('0x3d')]=_0x1f07f1?_0xe765('0x148'):_0xe765('0x149');return _0x372e4c(msgResponse(_0xe765('0x14a'),_0xe765('0x13a'),'Global:\x20'+_0x1f07f1+'\x20'+_0x4fbeba+_0xe765('0x14b')+util['inspect'](_0x1877af,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x50dee3));}})['catch'](function(_0x39eb0a){return _0x372e4c(msgResponse(_0xe765('0x139'),_0xe765('0x13a'),JSON[_0xe765('0x49')](_0x39eb0a)));});});};Dialer[_0xe765('0x1b')][_0xe765('0x14c')]=function(_0x3fd274){var _0x2fb274=this;return function(){switch(_0x3fd274['dialMethod']){case'progressive':freeVariablesPredictive(_0x3fd274);_0x2fb274[_0xe765('0x14d')](_0x3fd274,0x1);break;case _0xe765('0x14e'):freeVariablesPredictive(_0x3fd274);_0x2fb274['handlePower'](_0x3fd274,_0x3fd274[_0xe765('0x14f')]);break;case _0xe765('0x150'):_0x2fb274[_0xe765('0x150')](_0x3fd274);break;case _0xe765('0xa'):freeVariablesPredictive(_0x3fd274);_0x2fb274[_0xe765('0x14d')](_0x3fd274,0x1);break;default:freeVariablesPredictive(_0x3fd274);logger[_0xe765('0x8e')]('Queue',_0x3fd274[_0xe765('0x3f')],_0xe765('0x151'));}};};Dialer[_0xe765('0x1b')]['launchHandleIvr']=function(_0x17830e){var _0x4b74e7=this;return function(){_0x4b74e7[_0xe765('0x152')](_0x17830e);};};Dialer[_0xe765('0x1b')][_0xe765('0xb')]=function(_0x1707dc){var _0x591d7e=this;if(isNotPreview(_0x1707dc[_0xe765('0x153')])){if(isVoiceQueueOutbound(_0x1707dc[_0xe765('0x4e')])&&isActive(_0x1707dc[_0xe765('0x57')])){_0x1707dc[_0xe765('0x99')]=!![];BPromise[_0xe765('0xad')]()[_0xe765('0xae')](checkIsLoggedIn(_0x1707dc,_0x1707dc['loggedIn']))[_0xe765('0xae')](checkIsActive(_0x1707dc,_0x1707dc[_0xe765('0x57')]))[_0xe765('0xae')](checkInterval(_0x1707dc))[_0xe765('0xae')](_0x591d7e['checkIsTrunkReachable'](_0x1707dc))[_0xe765('0xae')](_0x591d7e[_0xe765('0x137')](_0x1707dc['dialGlobalInterval'],_0x1707dc[_0xe765('0x154')],_0x1707dc[_0xe765('0x3f')],_0x1707dc))[_0xe765('0xae')](_0x591d7e['checkIfTimeIntervals'](_0x1707dc[_0xe765('0x44')],_0x1707dc['dialTimezone'],_0x1707dc[_0xe765('0x3f')],_0x1707dc))[_0xe765('0xae')](_0x591d7e[_0xe765('0x14c')](_0x1707dc))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x1707dc));}else{notSendMessagesQueue(_0x1707dc);}}else{freeVariablesPredictive(_0x1707dc);}};Dialer['prototype'][_0xe765('0x132')]=function(){var _0x1d21f3=this;var _0x299d49;for(var _0x27b198 in this['campaigns']){if(this[_0xe765('0x22')][_0xe765('0x92')](_0x27b198)){_0x299d49=this[_0xe765('0x22')][_0x27b198];if(isCampaignIvr(_0x299d49[_0xe765('0x4e')])&&isActive(_0x299d49[_0xe765('0xd3')])){_0x299d49[_0xe765('0x99')]=!![];BPromise[_0xe765('0xad')]()[_0xe765('0xae')](checkIsActive(_0x299d49,_0x299d49[_0xe765('0xd3')]))['then'](checkInterval(_0x299d49))[_0xe765('0xae')](_0x1d21f3[_0xe765('0x133')](_0x299d49))['then'](_0x1d21f3[_0xe765('0x137')](_0x299d49['dialGlobalInterval'],_0x299d49['dialTimezone'],_0x299d49[_0xe765('0x3f')],_0x299d49))[_0xe765('0xae')](_0x1d21f3['checkIfTimeIntervals'](_0x299d49[_0xe765('0x44')],_0x299d49[_0xe765('0x154')],_0x299d49[_0xe765('0x3f')],_0x299d49))['then'](_0x1d21f3['launchHandleIvr'](_0x299d49))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x299d49));}else{notSendMessagesCampaign(_0x299d49);}}}};function getCallerIdRandom(_0x4e82b6,_0x5bb003){var _0x59b412,_0x321d46,_0x5307ab;if(_0x5bb003<=0x0){_0x5bb003=0x1;}_0x59b412=new RegExp('\x5cw{0,'+_0x5bb003+'}$');_0x321d46=Math[_0xe765('0x155')](0xa,_0x5bb003-0x1);_0x5307ab=Math['pow'](0xa,_0x5bb003)-0x1;return util[_0xe765('0x72')]('%s',_['replace'](_0x4e82b6,_0x59b412,_[_0xe765('0x156')](_0x321d46,_0x5307ab)));}function extractCalleridName(_0x48e5de){var _0x2cbb88=_0x48e5de[_0xe765('0x157')](/"(.*?)"/);return _0x2cbb88?_0x2cbb88[0x1]:_0x48e5de;}function extractCalleridNumber(_0x398da2){var _0x2bb180=_0x398da2['match'](/<(.*?)>/);return _0x2bb180?_0x2bb180[0x1]:_0x398da2;}Dialer[_0xe765('0x1b')][_0xe765('0x158')]=function(_0x270708,_0x298fbb){var _0xf23d30=this;var _0x3ba114=uuid['v4']();this[_0xe765('0x26')][_0x3ba114]=new Action(_0x270708,_0x298fbb,_0x3ba114);return new BPromise(function(_0x146312,_0x5e91f7){if(_[_0xe765('0x3c')](_0x270708)&&_0xe765('0x159')!==typeof _0x270708){return _0x5e91f7(msgResponse(_0xe765('0x15a'),_0xe765('0x13a'),_0xe765('0x15b')));}if(_[_0xe765('0x3c')](_0x298fbb[_0xe765('0x15c')][_0xe765('0x15d')])||_0x298fbb[_0xe765('0x15c')]['phone']===null){return _0x5e91f7(msgResponse(_0xe765('0x15a'),'Failure',_0xe765('0x15e')));}var _0x417bfd={'XMD-CALLERID':_0xf23d30[_0xe765('0x26')][_0x3ba114][_0xe765('0x15f')](),'XMD-AGI':_0x270708[_0xe765('0x102')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x270708[_0xe765('0x102')]):_0xe765('0x160'),'XMD-AGIAFTER':_0x270708[_0xe765('0x10a')]?util[_0xe765('0x72')](_0xe765('0x161'),ipAgi,_0x270708[_0xe765('0x10a')]):'NONE','XMD-QUEUE':_0x270708['type']===_0xe765('0x162')?util['format']('\x22%s,%s%s,,,%s\x22',_0x270708['name'],_0x270708[_0xe765('0x163')]||'',_0x270708['dialAgiAfterHangupAgent']?'c':'',_0x270708[_0xe765('0x110')]||0x3):'NONE','XMD-CONTACTID':_0x298fbb[_0xe765('0xca')],'XMD-CDRTYPE':_0xe765('0x8'),'CALLERID(all)':_0xf23d30[_0xe765('0x26')][_0x3ba114][_0xe765('0x15f')](),'XMD-AMD':_0x270708[_0xe765('0xdc')]?_0xe765('0x164'):_0xe765('0x160'),'XMD-DESTINATION':_0xe765('0xdb')};if(_0x270708[_0xe765('0xdc')]){_0x417bfd[_0xe765('0x165')]=_0x270708[_0xe765('0x166')]||0x9c4;_0x417bfd[_0xe765('0x167')]=_0x270708[_0xe765('0x168')]||0x5dc;_0x417bfd[_0xe765('0x169')]=_0x270708[_0xe765('0x16a')]||0x320;_0x417bfd[_0xe765('0x16b')]=_0x270708['dialAMDTotalAnalysisTime']||0x1388;_0x417bfd['XMD-AMDMINWORDLENGTH']=_0x270708['dialAMDMinWordLength']||0x64;_0x417bfd[_0xe765('0x16c')]=_0x270708[_0xe765('0x16d')]||0x32;_0x417bfd['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x270708['dialAMDMaximumNumberOfWords']||0x3;_0x417bfd[_0xe765('0x16e')]=_0x270708['dialAMDSilenceThreshold']||0x100;_0x417bfd[_0xe765('0x16f')]=_0x270708[_0xe765('0x170')]||0x1388;}if(_0x270708[_0xe765('0x4e')]===_0xe765('0x162')){_0x417bfd[_0xe765('0x171')]=_0x298fbb[_0xe765('0xcd')];}else{_0x417bfd[_0xe765('0x172')]=_0x298fbb[_0xe765('0xf9')];}for(var _0x2260c7 in _0x298fbb[_0xe765('0x15c')]){if(_0x298fbb[_0xe765('0x15c')][_0xe765('0x92')](_0x2260c7)){if(isNotNull(_0x298fbb[_0xe765('0x15c')][_0x2260c7])&&_0x2260c7!=='id'&&_0x2260c7!==_0xe765('0x173')&&_0x2260c7!==_0xe765('0x174')&&_0x2260c7!==_0xe765('0x175')){_0x417bfd[util[_0xe765('0x72')]('%s%s',_0xe765('0x176'),_['toUpper'](_0x2260c7))]=_0x298fbb[_0xe765('0x15c')][_0x2260c7];}}}var _0x17700e=_0xf23d30['isTrunkReachable'](_0x270708[_0xe765('0x70')])?getCallerId(_0x270708[_0xe765('0x70')][_0xe765('0x71')],_0x270708[_0xe765('0x58')],_0x270708['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x270708[_0xe765('0x177')],_0x270708['dialRandomLastDigitCallerIdNumber']):_0x270708['dialOriginateCallerIdNumber']):getCallerId(_[_0xe765('0xa6')](_0x270708['TrunkBackup'])?_0x270708['Trunk'][_0xe765('0x71')]:_0x270708[_0xe765('0x134')][_0xe765('0x71')],_0x270708[_0xe765('0x58')],_0x270708[_0xe765('0x178')]>0x0?getCallerIdRandom(_0x270708[_0xe765('0x177')],_0x270708[_0xe765('0x178')]):_0x270708['dialOriginateCallerIdNumber']);if(_0x17700e){_0x417bfd[_0xe765('0x179')]=_0xf23d30['actions'][_0x3ba114]['originatecalleridname']=extractCalleridName(_0x17700e);_0x417bfd[_0xe765('0x17a')]=_0xf23d30['actions'][_0x3ba114][_0xe765('0x17b')]=extractCalleridNumber(_0x17700e);}return ami[_0xe765('0xa7')]({'actionid':_0x3ba114,'action':_0xe765('0x15a'),'channel':_0xf23d30[_0xe765('0xd2')](_0x270708[_0xe765('0x70')])?util[_0xe765('0x72')](_0xe765('0x17c'),_0x270708['Trunk']['name'],isNotNull(_0x270708[_0xe765('0x5a')])?_0x270708['dialPrefix'][_0xe765('0x17d')]()||'':'',_0x270708[_0xe765('0x17e')]>0x0?_0x298fbb[_0xe765('0x15c')][_0xe765('0x15d')][_0xe765('0x17f')](_0x270708['dialCutDigit']):_0x298fbb[_0xe765('0x15c')][_0xe765('0x15d')]):util[_0xe765('0x72')](_0xe765('0x17c'),_[_0xe765('0xa6')](_0x270708['TrunkBackup'])?_0x270708['Trunk'][_0xe765('0x3f')]:_0x270708[_0xe765('0x134')][_0xe765('0x3f')],isNotNull(_0x270708['dialPrefix'])?_0x270708[_0xe765('0x5a')][_0xe765('0x17d')]()||'':'',_0x270708[_0xe765('0x17e')]>0x0?_0x298fbb['Contact'][_0xe765('0x15d')]['substring'](_0x270708[_0xe765('0x17e')]):_0x298fbb['Contact']['phone']),'callerid':_0x17700e,'Exten':_0xe765('0xdb'),'Context':_0xe765('0x180'),'Priority':'1','variable':_0x417bfd,'timeout':(_0x270708[_0xe765('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3ba114})[_0xe765('0xae')](function(_0x5cd861){return _0x146312(_0x5cd861);})[_0xe765('0xaf')](function(_0x176241){_0x270708[_0xe765('0x61')]+=0x1;var _0x3df106=new History(_0xf23d30['actions'][_0x3ba114]);logger[_0xe765('0x8e')](util[_0xe765('0x72')](_0xe765('0x181'),JSON[_0xe765('0x49')](_0x176241)));_0x3df106[_0xe765('0xe1')]=0xe;_0x3df106[_0xe765('0xe2')]=_0xe765('0x182');_0x3df106[_0xe765('0xa2')]=moment()[_0xe765('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x3df106[_0xe765('0xa1')]=_0x3df106[_0xe765('0xa2')];_0xf23d30[_0xe765('0xc1')](_0x3df106)['catch'](loggerCatch(_0xe765('0x183')));_0xf23d30[_0xe765('0xbf')](_0x3df106)[_0xe765('0xaf')](loggerCatch(_0xe765('0x183')))['finally'](function(){delete _0xf23d30[_0xe765('0x26')][_0x3ba114];return _0x5e91f7(msgResponse(_0xe765('0x15a'),_0xe765('0x48'),_0xe765('0x184')));});});});};Dialer[_0xe765('0x1b')][_0xe765('0x185')]=function(_0xfeee1b){var _0x28c73b=this[_0xe765('0x26')][_0xfeee1b[_0xe765('0x11d')]];var _0x4260fe=this;if(_0x28c73b){delete this[_0xe765('0x26')][_0xfeee1b[_0xe765('0x11d')]];_0x28c73b[_0xe765('0x10f')]=moment()[_0xe765('0x72')](_0xe765('0xf8'));var _0x326e29=_0x28c73b[_0xe765('0x4e')]===_0xe765('0x74')?this[_0xe765('0x22')][_0x28c73b[_0xe765('0xaa')]]:this[_0xe765('0x21')][_0x28c73b[_0xe765('0x186')]()];if(!this[_0xe765('0xd0')](_0xfeee1b[_0xe765('0x187')])){this[_0xe765('0xc3')](_0x326e29);return this[_0xe765('0x188')](_0x28c73b,_0x326e29,_0xfeee1b)[_0xe765('0xae')](function(_0xb50ab8){})[_0xe765('0xaf')](loggerCatch(_0xe765('0x189')));}else{this[_0xe765('0x27')][_0xfeee1b[_0xe765('0xd7')]]=_0x28c73b;}}};Dialer[_0xe765('0x1b')][_0xe765('0x18a')]=function(_0x1ce916,_0x184fa5,_0x5dce01){var _0x249fa3=new History(_0x184fa5);if(_0x249fa3[_0xe765('0xeb')]+_0x249fa3[_0xe765('0xfe')]+_0x249fa3[_0xe765('0xff')]+_0x249fa3[_0xe765('0xec')]+_0x249fa3[_0xe765('0xed')]+_0x249fa3[_0xe765('0xee')]+_0x249fa3['countmachineretry']+_0x249fa3[_0xe765('0xef')]>=_0x5dce01[_0xe765('0x18b')]-0x1){return!![];}switch(_0x1ce916){case 0x3:if(_0x249fa3[_0xe765('0xff')]>=_0x5dce01[_0xe765('0x18c')]-0x1){return!![];}else{this[_0xe765('0xb6')]({'active':![],'countnoanswerretry':_0x249fa3[_0xe765('0xff')]+=0x1,'scheduledat':moment()[_0xe765('0xf5')](_0x5dce01[_0xe765('0x18d')],_0xe765('0xf7'))[_0xe765('0x72')](_0xe765('0xf8')),'ContactId':_0x249fa3[_0xe765('0xca')],'ListId':_0x249fa3[_0xe765('0xcb')],'VoiceQueueId':_0x249fa3[_0xe765('0xcd')]||undefined,'CampaignId':_0x249fa3[_0xe765('0xf9')]||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x18e')));}break;case 0x5:if(_0x249fa3['countbusyretry']>=_0x5dce01[_0xe765('0x18f')]-0x1){return!![];}else{this[_0xe765('0xb6')]({'active':![],'countbusyretry':_0x249fa3[_0xe765('0xeb')]+=0x1,'scheduledat':moment()[_0xe765('0xf5')](_0x5dce01[_0xe765('0x190')],_0xe765('0xf7'))[_0xe765('0x72')](_0xe765('0xf8')),'ContactId':_0x249fa3[_0xe765('0xca')],'ListId':_0x249fa3[_0xe765('0xcb')],'VoiceQueueId':_0x249fa3[_0xe765('0xcd')]||undefined,'CampaignId':_0x249fa3[_0xe765('0xf9')]||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x191')));}break;case 0x8:if(_0x249fa3[_0xe765('0xfe')]>=_0x5dce01[_0xe765('0x192')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x249fa3[_0xe765('0xfe')]+=0x1,'scheduledat':moment()[_0xe765('0xf5')](_0x5dce01[_0xe765('0x193')],_0xe765('0xf7'))[_0xe765('0x72')](_0xe765('0xf8')),'ContactId':_0x249fa3[_0xe765('0xca')],'ListId':_0x249fa3[_0xe765('0xcb')],'VoiceQueueId':_0x249fa3[_0xe765('0xcd')]||undefined,'CampaignId':_0x249fa3['CampaignId']||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x194')));}break;case 0x0:if(_0x249fa3[_0xe765('0xec')]>=_0x5dce01[_0xe765('0x195')]-0x1){return!![];}else{this[_0xe765('0xb6')]({'active':![],'countnosuchnumberretry':_0x249fa3[_0xe765('0xec')]+=0x1,'scheduledat':moment()[_0xe765('0xf5')](_0x5dce01[_0xe765('0x196')],_0xe765('0xf7'))[_0xe765('0x72')](_0xe765('0xf8')),'ContactId':_0x249fa3[_0xe765('0xca')],'ListId':_0x249fa3['ListId'],'VoiceQueueId':_0x249fa3['VoiceQueueId']||undefined,'CampaignId':_0x249fa3['CampaignId']||undefined})[_0xe765('0xaf')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x249fa3[_0xe765('0xed')]>=_0x5dce01[_0xe765('0x114')]-0x1){return!![];}else{this[_0xe765('0xb6')]({'active':![],'countdropretry':_0x249fa3['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x5dce01['dialDropRetryFrequency'],_0xe765('0xf7'))[_0xe765('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x249fa3['ContactId'],'ListId':_0x249fa3[_0xe765('0xcb')],'VoiceQueueId':_0x249fa3['VoiceQueueId']||undefined,'CampaignId':_0x249fa3[_0xe765('0xf9')]||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x115')));}break;case 0xb:if(_0x249fa3['countabandonedretry']>=_0x5dce01[_0xe765('0x197')]-0x1){return!![];}else{this[_0xe765('0xb6')]({'active':![],'countabandonedretry':_0x249fa3[_0xe765('0xee')]+=0x1,'scheduledat':moment()[_0xe765('0xf5')](_0x5dce01[_0xe765('0x198')],_0xe765('0xf7'))[_0xe765('0x72')](_0xe765('0xf8')),'ContactId':_0x249fa3[_0xe765('0xca')],'ListId':_0x249fa3[_0xe765('0xcb')],'VoiceQueueId':_0x249fa3[_0xe765('0xcd')]||undefined,'CampaignId':_0x249fa3['CampaignId']||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x199')));}break;case 0x13:if(_0x249fa3['countmachineretry']>=_0x5dce01[_0xe765('0xf2')]-0x1){return!![];}else{this[_0xe765('0xb6')]({'active':![],'countmachineretry':_0x249fa3[_0xe765('0xe7')]+=0x1,'scheduledat':moment()['add'](_0x5dce01[_0xe765('0xf6')],_0xe765('0xf7'))[_0xe765('0x72')](_0xe765('0xf8')),'ContactId':_0x249fa3[_0xe765('0xca')],'ListId':_0x249fa3['ListId'],'VoiceQueueId':_0x249fa3[_0xe765('0xcd')]||undefined,'CampaignId':_0x249fa3[_0xe765('0xf9')]||undefined})['catch'](loggerCatch(_0xe765('0x100')));}break;case 0x14:if(_0x249fa3[_0xe765('0xef')]>=_0x5dce01[_0xe765('0x19a')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x249fa3['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xe765('0xf5')](_0x5dce01[_0xe765('0x19b')],'minutes')['format'](_0xe765('0xf8')),'ContactId':_0x249fa3[_0xe765('0xca')],'ListId':_0x249fa3[_0xe765('0xcb')],'VoiceQueueId':_0x249fa3[_0xe765('0xcd')]||undefined,'CampaignId':_0x249fa3[_0xe765('0xf9')]||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x19c')));}break;default:return!![];}};Dialer[_0xe765('0x1b')][_0xe765('0x188')]=function(_0xb7d898,_0x3e6478,_0x11d0f5){var _0x1c928d=this;var _0x78089=new History(_0xb7d898);return new BPromise(function(_0x4f7d32,_0x548565){if(_[_0xe765('0x3c')](_0x3e6478)&&_0xe765('0x159')!==typeof _0x3e6478){return _0x548565(msgResponse('[callProgressDetecting]',_0xe765('0x13a'),'entity\x20is\x20undefine'));}if(_[_0xe765('0x3c')](_0x11d0f5)&&_0xe765('0x159')!==typeof _0x11d0f5){return _0x548565(msgResponse('[callProgressDetecting]',_0xe765('0x13a'),_0xe765('0x19d')));}switch(_0x11d0f5[_0xe765('0x107')]){case'0':_0x3e6478[_0xe765('0x60')]+=0x1;_0x78089[_0xe765('0xe1')]=0x0;_0x78089[_0xe765('0xe2')]=_0xe765('0x19e');_0x78089[_0xe765('0xec')]+=0x1;_0x78089[_0xe765('0xe8')]+=0x1;ami['emit'](_0xe765('0x19f'),ut[_0xe765('0x1a0')](_0xb7d898,_0xe765('0x1a1')));_0x1c928d[_0xe765('0xc1')](_0x78089)[_0xe765('0xaf')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1c928d[_0xe765('0x18a')](0x0,_0xb7d898,_0x3e6478)){if(_0x78089[_0xe765('0xec')]>=_0x3e6478[_0xe765('0x195')]){_0x1c928d['createStateFinal'](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1a2'));}else{_0x1c928d[_0xe765('0xf0')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1a2'));}}break;case'3':_0x3e6478[_0xe765('0x5f')]+=0x1;_0x78089[_0xe765('0xe1')]=0x3;_0x78089[_0xe765('0xe2')]=_0xe765('0x1a3');_0x78089[_0xe765('0xff')]+=0x1;_0x78089[_0xe765('0xe8')]+=0x1;ami[_0xe765('0x4d')](_0xe765('0x1a4'),ut[_0xe765('0x1a0')](_0xb7d898,_0xe765('0x1a5')));_0x1c928d[_0xe765('0xc1')](_0x78089)[_0xe765('0xaf')](loggerCatch(_0xe765('0x1a6')));if(_0x1c928d[_0xe765('0x18a')](0x3,_0xb7d898,_0x3e6478)){if(_0x78089[_0xe765('0xff')]>=_0x3e6478[_0xe765('0x18c')]){_0x1c928d[_0xe765('0xf3')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1a7'));}else{_0x1c928d[_0xe765('0xf0')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1a7'));}}break;case'5':_0x3e6478[_0xe765('0x5b')]+=0x1;_0x78089[_0xe765('0xe1')]=0x5;_0x78089[_0xe765('0xe2')]=_0xe765('0x1a8');_0x78089[_0xe765('0xeb')]+=0x1;_0x78089[_0xe765('0xe8')]+=0x1;ami[_0xe765('0x4d')]('custom:agentbusy',ut[_0xe765('0x1a0')](_0xb7d898,_0xe765('0x1a9')));_0x1c928d[_0xe765('0xc1')](_0x78089)[_0xe765('0xaf')](loggerCatch(_0xe765('0x1aa')));if(_0x1c928d['checkRetriveMax'](0x5,_0xb7d898,_0x3e6478)){if(_0x78089[_0xe765('0xeb')]>=_0x3e6478[_0xe765('0x18f')]){_0x1c928d[_0xe765('0xf3')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1ab'));}else{_0x1c928d[_0xe765('0xf0')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1ab'));}}break;case'8':_0x3e6478['outboundCongestionCallsDay']+=0x1;_0x78089[_0xe765('0xe1')]=0x8;_0x78089['statedesc']=_0xe765('0x1ac');_0x78089['countcongestionretry']+=0x1;_0x78089['countglobal']+=0x1;ami[_0xe765('0x4d')](_0xe765('0x1ad'),ut['buildObj'](_0xb7d898,'congestion'));_0x1c928d[_0xe765('0xc1')](_0x78089)[_0xe765('0xaf')](loggerCatch(_0xe765('0x1ae')));if(_0x1c928d[_0xe765('0x18a')](0x8,_0xb7d898,_0x3e6478)){if(_0x78089['countcongestionretry']>=_0x3e6478['dialCongestionMaxRetry']){_0x1c928d[_0xe765('0xf3')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1af'));}else{_0x1c928d[_0xe765('0xf0')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1af'));}}break;case'11':_0x3e6478[_0xe765('0x1b0')]+=0x1;_0x78089['state']=0xb;_0x78089['statedesc']=_0xe765('0x119');_0x78089['countabandonedretry']+=0x1;_0x78089[_0xe765('0xe8')]+=0x1;_0x1c928d[_0xe765('0xc1')](_0x78089)['catch'](loggerCatch(_0xe765('0x11b')));if(_0x1c928d['checkRetriveMax'](0xb,_0xb7d898,_0x3e6478)){if(_0x78089[_0xe765('0xee')]>=_0x3e6478[_0xe765('0x197')]){_0x1c928d[_0xe765('0xf3')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1b1'));}else{_0x1c928d[_0xe765('0xf0')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1b1'));}}break;case'20':_0x3e6478[_0xe765('0x63')]+=0x1;_0x78089[_0xe765('0xe1')]=0x14;_0x78089[_0xe765('0xe2')]='AgentReject';_0x78089[_0xe765('0xef')]+=0x1;_0x78089[_0xe765('0xe8')]+=0x1;ami[_0xe765('0x4d')](_0xe765('0x1b2'),ut[_0xe765('0x1a0')](_0xb7d898,_0xe765('0x1b3')));_0x1c928d[_0xe765('0xc1')](_0x78089)[_0xe765('0xaf')](loggerCatch(_0xe765('0x1b4')));if(_0x1c928d[_0xe765('0x18a')](0x14,_0xb7d898,_0x3e6478)){if(_0x78089['countagentrejectretry']>=_0x3e6478[_0xe765('0x19a')]){_0x1c928d[_0xe765('0xf3')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1b5'));}else{_0x1c928d[_0xe765('0xf0')](_0x78089,_0x4f7d32,_0x548565,_0xe765('0x1b5'));}}break;default:_0x3e6478[_0xe765('0x64')]+=0x1;_0x78089[_0xe765('0xe1')]=0xc;_0x78089[_0xe765('0xe2')]=_0x11d0f5['reason'];_0x1c928d['createHistory'](_0x78089)[_0xe765('0xaf')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1c928d[_0xe765('0x18a')](_0x11d0f5[_0xe765('0x107')],_0xb7d898,_0x3e6478)){if(_0x78089['countbusyretry']+_0x78089['countcongestionretry']+_0x78089[_0xe765('0xff')]+_0x78089[_0xe765('0xec')]+_0x78089[_0xe765('0xed')]+_0x78089['countabandonedretry']+_0x78089[_0xe765('0xe7')]+_0x78089[_0xe765('0xef')]>=_0x3e6478['dialGlobalMaxRetry']){_0x1c928d['stateGlobal'](_0x78089,_0x4f7d32,_0x548565,_0x11d0f5[_0xe765('0x107')]);}else{_0x1c928d[_0xe765('0xf3')](_0x78089,_0x4f7d32,_0x548565,_0x11d0f5[_0xe765('0x107')]);}}}});};Dialer[_0xe765('0x1b')]['stateGlobal']=function(_0x5ee1f6,_0x990e05,_0x412cbc,_0x1bcbd2){var _0x2e7ddd=new Final(_0x5ee1f6);_0x2e7ddd['state']=0xf;_0x2e7ddd['statedesc']='Global';this[_0xe765('0xf3')](_0x2e7ddd,_0x990e05,_0x412cbc,_0x1bcbd2);};Dialer[_0xe765('0x1b')][_0xe765('0xf3')]=function(_0x1015a0,_0xe4de2e,_0xdcc45b,_0x58c892){this[_0xe765('0xbf')](_0x1015a0)[_0xe765('0xae')](function(_0x1ec22a){return _0xe4de2e(msgResponse(_0xe765('0x1b6'),_0xe765('0xd1'),_0x58c892));})[_0xe765('0xaf')](function(_0x47ccda){return _0xdcc45b(msgResponse(_0xe765('0x1b7'),_0xe765('0x13a'),_0xe765('0x1b8')));});};Dialer['prototype'][_0xe765('0x150')]=function(_0x2332e1){var _0x4ecdc3=this;var _0x22d71f=_0x2332e1[_0xe765('0x1b9')]/0x64;var _0x319e42=_0x2332e1[_0xe765('0x5e')]/(_0x2332e1['outboundDropCallsDayTimeout']+_0x2332e1['outboundAnswerCallsDay']);var _0x5c536c=Math['round'](_0x2332e1[_0xe765('0x6a')]*(_0x2332e1[_0xe765('0x1ba')]/0x64));var _0x465ae6=Math[_0xe765('0x1bb')](_0x2332e1['predictiveIntervalAvailable']*(_0x2332e1['predictiveIntervalMinThreshold']/0x64));var _0x1be5d8=_0x2332e1[_0xe765('0x51')]+_0x2332e1[_0xe765('0x53')];var _0x124cb9=Math[_0xe765('0x1bc')](_0x2332e1['erlangCalls']*_0x2332e1[_0xe765('0x6e')]*_0x2332e1[_0xe765('0x68')]*_0x2332e1[_0xe765('0x1bd')]);if(_[_0xe765('0x3c')](_0x2332e1[_0xe765('0x6f')])){if(!_[_0xe765('0x3c')](_0x2332e1[_0xe765('0x29')])){_0x2332e1['startPredictive']=undefined;loggerPredictive['error'](_0xe765('0x1be'),_0xe765('0x1bf'));}if(!_[_0xe765('0x3c')](_0x2332e1[_0xe765('0x89')])){loggerPredictive[_0xe765('0x8e')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2332e1['handlePredictive']);_0x2332e1[_0xe765('0x89')]=undefined;}_0x2332e1[_0xe765('0x6f')]=moment()[_0xe765('0x72')](_0xe765('0xf8'));loggerPredictive[_0xe765('0x77')](_0x2332e1[_0xe765('0x3f')],_0xe765('0x1c0'),_0x2332e1[_0xe765('0x6f')]);this[_0xe765('0x14d')](_0x2332e1,0x1);}else if(ifInterval(_0x2332e1[_0xe765('0x1c1')],_0x2332e1[_0xe765('0x6f')])){this['handlePower'](_0x2332e1,0x1);loggerPredictiveCalls[_0xe765('0x77')](_0xe765('0x1c2'),_0x2332e1[_0xe765('0x6f')],_0x2332e1['name']);_0x2332e1[_0xe765('0x85')]=0x0;_0x2332e1[_0xe765('0x67')]=0x0;}else if(_0x22d71f<_0x319e42&&_0x2332e1['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x2332e1);loggerPredictive[_0xe765('0x77')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x319e42,'startProgressive',_0x2332e1[_0xe765('0x3f')]);}else if(_0x124cb9<_0x2332e1['predictiveIntervalErlangCallsDroppedCalls']&&_0x2332e1[_0xe765('0x1c3')]===_0xe765('0x1c4')){freeVariablesPredictive(_0x2332e1);loggerPredictive[_0xe765('0x77')](_0xe765('0x1c5'),'Max\x20Drop\x20',_0x124cb9,_0xe765('0x1c6'),_0x2332e1[_0xe765('0x67')],'startProgressive',_0x2332e1['name']);}else if(!ifInterval(_0x2332e1['dialPredictiveInterval'],_0x2332e1['startProgressive'])&&_[_0xe765('0x3c')](_0x2332e1[_0xe765('0x29')])&&!_[_0xe765('0x3c')](_0x2332e1[_0xe765('0x6f')])){_0x2332e1[_0xe765('0x29')]=moment()[_0xe765('0x72')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe765('0x77')](_0x2332e1[_0xe765('0x3f')],'started\x20in\x20predictive\x20at',_0x2332e1[_0xe765('0x29')]);this['averageHandleTime'](_0x2332e1[_0xe765('0x1c1')])[_0xe765('0xae')](this['getDataPredictive'](_0x2332e1))[_0xe765('0xae')](mergeDataErlangB(_0x2332e1))[_0xe765('0xae')](this[_0xe765('0x1c7')](_0x2332e1))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2332e1));}else if(!ifInterval(_0x2332e1[_0xe765('0x1c1')],_0x2332e1[_0xe765('0x29')])){_0x2332e1['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2332e1[_0xe765('0x29')]=moment()[_0xe765('0x72')](_0xe765('0xf8'));loggerPredictive[_0xe765('0x77')](_0x2332e1[_0xe765('0x3f')],_0xe765('0x1c8'),_0x2332e1[_0xe765('0x29')]);clearInterval(_0x2332e1[_0xe765('0x89')]);_0x2332e1[_0xe765('0x89')]=undefined;this[_0xe765('0xb5')](_0x2332e1[_0xe765('0x1c1')])['then'](this['getDataPredictive'](_0x2332e1))['then'](mergeDataErlangB(_0x2332e1))[_0xe765('0xae')](this[_0xe765('0x1c7')](_0x2332e1))['catch'](loggerCatchPredictive(_0xe765('0x1c9'),_0x2332e1));}else if(_0x2332e1[_0xe765('0x6a')]&&_0x1be5d8<_0x2332e1['predictiveIntervalAvailable']-_0x465ae6){freeVariablesPredictive(_0x2332e1);loggerPredictive['info'](_0x2332e1[_0xe765('0x3f')],_0xe765('0x1ca'),_0x1be5d8,_0xe765('0x1cb'),_0x2332e1[_0xe765('0x6a')],'-',_0x465ae6,'=',_0x2332e1[_0xe765('0x6a')]-_0x465ae6,')');}else if(_0x2332e1['predictiveIntervalAvailable']&&_0x1be5d8>_0x2332e1[_0xe765('0x6a')]+_0x5c536c){freeVariablesPredictive(_0x2332e1);loggerPredictive[_0xe765('0x77')](_0x2332e1[_0xe765('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1be5d8,_0xe765('0x1cc'),_0x2332e1['predictiveIntervalAvailable'],'+',_0x5c536c,'=',_0x2332e1[_0xe765('0x6a')]+_0x5c536c,')');}};Dialer[_0xe765('0x1b')][_0xe765('0x1cd')]=function(_0x3614ad){var _0x1a6fda=this;return function(_0xd5f64f){return new BPromise(function(_0x24af89,_0x4061ea){_[_0xe765('0xc8')](_0x3614ad,_0xd5f64f[0x0]);if(checkGetDataPredictive(_0xd5f64f[0x0])){var _0x2d9304=_0x3614ad[_0xe765('0x6a')]=_0x3614ad[_0xe765('0x53')]+_0x3614ad[_0xe765('0x51')];var _0x56480e=_0x3614ad[_0xe765('0x1c1')]*0x3c;var _0x5af0a6=_0xd5f64f[0x0][_0xe765('0x7d')]+_0xd5f64f[0x0][_0xe765('0x65')];var _0x1d52ba=(_0xd5f64f[0x0]['predictiveIntervalAnsweredCalls']+_0xd5f64f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xd5f64f[0x0][_0xe765('0x7b')])/_0xd5f64f[0x0][_0xe765('0x6b')];_0x3614ad[_0xe765('0x68')]=_0x1d52ba>0x0?_0x1d52ba:0x1;switch(_0x3614ad[_0xe765('0x1c3')]){case _0xe765('0x1c4'):var _0x1cc02a=_0x3614ad[_0xe765('0x1b9')]/0x64;return _0x1a6fda[_0xe765('0x1ce')](_0x2d9304,_0x56480e,_0x5af0a6,_0x1d52ba,_0x1cc02a)[_0xe765('0xae')](function(_0x17c1b7){return _0x24af89(_0x17c1b7);});case _0xe765('0x1cf'):var _0x347f9a=_0x3614ad['dialPredictiveOptimizationPercentage']/0x64;return _0x1a6fda['busyFactor'](_0x2d9304,_0x56480e,_0x5af0a6,_0x1d52ba,_0x347f9a)[_0xe765('0xae')](function(_0x1e1792){return _0x24af89(_0x1e1792);});default:return _0x4061ea(msgResponse('[getDataPredictive]',_0xe765('0x13a'),_0xe765('0x1d0')));}}else{return _0x4061ea(msgResponse(_0xe765('0x1d1'),_0xe765('0x13a'),_0xe765('0x1d2')));}});};};Dialer['prototype'][_0xe765('0x1d3')]=function(_0x5cbd81){var _0x2c2136=this;return function(_0x588b6a){return new BPromise(function(_0x115f55,_0x4c49ae){_[_0xe765('0xc8')](_0x5cbd81,_0x588b6a[0x0]);if(checkGetDataPredictive(_0x588b6a[0x0])){loggerPredictive[_0xe765('0x77')](JSON[_0xe765('0x49')](_0x588b6a[0x0]));if(_0x5cbd81['dialPredictiveOptimization']===_0xe765('0x1c4')){return _0x2c2136['getVoiceQueueRtPauses'](_0x5cbd81['id'])[_0xe765('0xae')](function(_0x4905ef){var _0x358314=_0x5cbd81[_0xe765('0x1d4')]-_0x4905ef[0x0][_0xe765('0x1d5')];var _0x22e3b5=_0x5cbd81['dialPredictiveInterval']*0x3c;var _0x1237b9=_0x588b6a[0x0][_0xe765('0x7d')]+_0x588b6a[0x0]['predictiveIntervalAvgHoldtime'];var _0x51952b=(_0x588b6a[0x0]['predictiveIntervalAnsweredCalls']+_0x588b6a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x588b6a[0x0][_0xe765('0x7b')])/_0x588b6a[0x0][_0xe765('0x6b')];var _0x17adac=_0x5cbd81[_0xe765('0x1b9')]/0x64;_0x5cbd81[_0xe765('0x69')]=_0x4905ef[0x0]['outboundQueuePauses']||0x0;_0x5cbd81[_0xe765('0x68')]=_0x51952b>0x0?_0x51952b:0x1;return _0x2c2136[_0xe765('0x1ce')](_0x358314,_0x22e3b5,_0x1237b9,_0x51952b,_0x17adac);})['then'](function(_0x183dbd){return _0x115f55(_0x183dbd);})[_0xe765('0xaf')](function(_0x25c7d5){return _0x4c49ae(msgResponse('[CatchErlangB]','Failure',JSON[_0xe765('0x49')](_0x25c7d5)));});}if(_0x5cbd81[_0xe765('0x1c3')]===_0xe765('0x1cf')){return _0x2c2136[_0xe765('0xbd')](_0x5cbd81['id'])['then'](function(_0x116db0){var _0x38d79a=_0x5cbd81[_0xe765('0x1d4')]-_0x116db0[0x0][_0xe765('0x1d5')];var _0x1f479f=_0x5cbd81[_0xe765('0x1c1')]*0x3c;var _0x34c34a=_0x588b6a[0x0][_0xe765('0x7d')]+_0x588b6a[0x0][_0xe765('0x65')];var _0x3454c3=(_0x588b6a[0x0][_0xe765('0x1d6')]+_0x588b6a[0x0][_0xe765('0x1d7')]+_0x588b6a[0x0][_0xe765('0x7b')])/_0x588b6a[0x0]['predictiveIntervalTotalCalls'];var _0x4bf85c=_0x5cbd81[_0xe765('0x1b9')]/0x64;_0x5cbd81[_0xe765('0x69')]=_0x116db0[0x0]['outboundQueuePauses']||0x0;_0x5cbd81[_0xe765('0x68')]=_0x3454c3>0x0?_0x3454c3:0x1;return _0x2c2136['busyFactor'](_0x38d79a,_0x1f479f,_0x34c34a,_0x3454c3,_0x4bf85c);})['then'](function(_0x489b39){return _0x115f55(_0x489b39);})['catch'](function(_0x3166e0){return _0x4c49ae(msgResponse(_0xe765('0x1d8'),_0xe765('0x13a'),JSON['stringify'](_0x3166e0)));});}}else{return _0x4c49ae(msgResponse(_0xe765('0x1d1'),'Failure',_0xe765('0x1d2')));}});};};Dialer[_0xe765('0x1b')][_0xe765('0x1c7')]=function(_0x3a363f){var _0x3292e8=this;return function(){var _0x4e3bd0=0x0;var _0x42352d=Math[_0xe765('0x1bc')](_0x3a363f[_0xe765('0x6d')]*0x3e8);if(_0x42352d>0x0){_0x42352d=_0x42352d<0x64?0x64:_0x42352d;loggerPredictive['info'](_0x3a363f[_0xe765('0x3f')],_0xe765('0x1d9'),_0x42352d,'milliseconds');_0x3a363f[_0xe765('0x89')]=setInterval(function(){_0x3292e8['handlePredictive'](_0x3a363f);loggerPredictiveCalls[_0xe765('0x77')](_0xe765('0x1da'),_0x4e3bd0+=0x1);},_0x42352d);}else{loggerPredictive['info'](_0x3a363f[_0xe765('0x3f')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xe765('0x1b')][_0xe765('0x1db')]=function(_0x528fa2,_0x115a0d){var _0x5a9508=this;return function(_0x18643a){if(_[_0xe765('0x46')](_0x18643a)){if(_[_0xe765('0xa6')](_0x115a0d[_0xe765('0xcc')])||!_0x115a0d[_0xe765('0x1dc')]){if(_0x528fa2[_0xe765('0x153')]===_0xe765('0xa')){_0x528fa2[_0xe765('0x123')]=_[_0xe765('0x3c')](_0x528fa2['queueStatusComplete'])?!![]:_0x528fa2[_0xe765('0x123')];var _0x52ce18=uuid['v4']();_0x5a9508[_0xe765('0x26')][_0x52ce18]=new Action(_0x528fa2,_0x115a0d,_0x52ce18);loggerBooked[_0xe765('0x77')](_0xe765('0x1dd'),_0x52ce18,_0xe765('0x1de'),JSON[_0xe765('0x49')](_0x528fa2[_0xe765('0x123')]),_0xe765('0x1df'),_0x528fa2[_0xe765('0x3f')]);if(_0x528fa2[_0xe765('0x123')]){_0x528fa2['queueStatusComplete']=![];_0x5a9508['queueBooked'][_0x5a9508['actions'][_0x52ce18][_0xe765('0xaa')]]=[];ami['Action']({'actionid':_0x52ce18,'action':'queuestatus','queue':_0x528fa2['name']})[_0xe765('0xaf')](function(_0x20bfc3){_0x5a9508['updateOriginated'](_0x528fa2);_0x5a9508['rescheduleContact']({'active':![],'ContactId':_0x5a9508[_0xe765('0x26')][_0x52ce18][_0xe765('0xca')],'ListId':_0x5a9508[_0xe765('0x26')][_0x52ce18][_0xe765('0xcb')],'VoiceQueueId':_0x5a9508[_0xe765('0x26')][_0x52ce18][_0xe765('0xcd')]||undefined,'CampaignId':_0x5a9508[_0xe765('0x26')][_0x52ce18]['CampaignId']||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x1e0')));delete _0x5a9508['actions'][_0x52ce18];});}else{loggerBooked[_0xe765('0x77')]('[booked][checkContactBlack][else]',JSON[_0xe765('0x49')](_0x528fa2[_0xe765('0x123')]),'Queue:\x20',_0x528fa2['name']);_0x5a9508[_0xe765('0xc3')](_0x528fa2);_0x5a9508[_0xe765('0xb6')]({'active':![],'ContactId':_0x5a9508['actions'][_0x52ce18][_0xe765('0xca')],'ListId':_0x5a9508[_0xe765('0x26')][_0x52ce18][_0xe765('0xcb')],'VoiceQueueId':_0x5a9508[_0xe765('0x26')][_0x52ce18][_0xe765('0xcd')]||undefined,'CampaignId':_0x5a9508['actions'][_0x52ce18]['CampaignId']||undefined})[_0xe765('0xaf')](loggerCatch(_0xe765('0x1e0')));delete _0x5a9508[_0xe765('0x26')][_0x52ce18];}}else{return _0x5a9508[_0xe765('0x158')](_0x528fa2,_0x115a0d);}}else{if(getDiff(_0x115a0d[_0xe765('0x1e1')])<_0x528fa2['dialRecallMeTimeout']*0x3c){if(_0x115a0d[_0xe765('0x1e2')]&&!_0x115a0d['Agent']['voicePause']){_0x5a9508['preview'][_0xe765('0x124')](_0x115a0d['id'])[_0xe765('0x1e')](function(){_0x5a9508[_0xe765('0xc3')](_0x528fa2);});}else{_0x5a9508['unlockContact']({'active':![]},_0x115a0d['id'],0x1)['finally'](function(){console['log'](_0xe765('0x1e3'));_0x5a9508[_0xe765('0xc3')](_0x528fa2);});}}else{_0x528fa2[_0xe765('0x62')]+=0x1;_0x5a9508[_0xe765('0xc3')](_0x528fa2);if(_0x528fa2['dialRecallInQueue']){_0x5a9508[_0xe765('0xb6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x115a0d[_0xe765('0xca')],'ListId':_0x115a0d[_0xe765('0xcb')],'VoiceQueueId':_0x115a0d[_0xe765('0xcd')]||undefined,'CampaignId':_0x115a0d[_0xe765('0xf9')]||undefined})['catch'](loggerCatch(_0xe765('0x1e4')));_0x5a9508['createHistory'](createObjHistory(_0x528fa2,_0x115a0d,_0xe765('0x1e5'),0x17,_0xe765('0x1e6')))[_0xe765('0xaf')](loggerCatch(_0xe765('0x1e7')));}else{_0x5a9508[_0xe765('0xc7')](createObjHistory(_0x528fa2,_0x115a0d,_0xe765('0x1e8'),0x16,_0xe765('0x1e9')),_0xe765('0x1ea'),_0xe765('0x1eb'));}}}}else{_0x528fa2[_0xe765('0x1ec')]+=0x1;_0x5a9508[_0xe765('0xc7')](createObjHistory(_0x528fa2,_0x115a0d,_0xe765('0x1ed'),0xd,_0xe765('0x1ee')),'[Originate][historyBlacklist]',_0xe765('0x1ef'));throw'inBlackList';}};};Dialer[_0xe765('0x1b')][_0xe765('0x152')]=function(_0x216b4d){var _0x1babdd=this;var _0x31d4ba=[];var _0x5b5ba5=_0x216b4d['limitCalls']-_0x216b4d[_0xe765('0x6c')]-_0x216b4d[_0xe765('0x1f0')];emitCampaignSummary(_0x216b4d);if(_0x5b5ba5>0x0){if(_0x5b5ba5>this[_0xe765('0x25')]){_0x5b5ba5=this[_0xe765('0x25')];}_0x216b4d[_0xe765('0x1f0')]+=_0x5b5ba5;this[_0xe765('0xbc')](_0x216b4d['id'],_0x5b5ba5,_0x216b4d[_0xe765('0x1f1')])[_0xe765('0xae')](function(_0x4ebbf0){_0x216b4d[_0xe765('0x1f0')]-=_0x5b5ba5;_0x216b4d[_0xe765('0x1f0')]=_0x216b4d[_0xe765('0x1f0')]>0x0?_0x216b4d[_0xe765('0x1f0')]:0x0;if(!checkContactEmpty(_0x4ebbf0)){_0x216b4d[_0xe765('0x3d')]=_0xe765('0x97');logger['info'](_0xe765('0x1f2')+_0x216b4d[_0xe765('0x3f')]);}else{_0x216b4d[_0xe765('0x6c')]+=_0x4ebbf0['length'];_0x216b4d[_0xe765('0x3d')]='RUNNING';for(var _0x3cd6c1=0x0;_0x3cd6c1<_0x4ebbf0['length'];_0x3cd6c1+=0x1){_0x216b4d[_0xe765('0x1f3')]+=0x1;if(_['isNil'](_0x4ebbf0[_0x3cd6c1])||_[_0xe765('0xa6')](_0x4ebbf0[_0x3cd6c1][_0xe765('0x15c')])||_[_0xe765('0xa6')](_0x4ebbf0[_0x3cd6c1][_0xe765('0x15c')][_0xe765('0x15d')])){_0x1babdd[_0xe765('0xc6')](_0xe765('0x1f4'),_0x216b4d,_0x4ebbf0[_0x3cd6c1]);}else{_0x1babdd[_0xe765('0xb3')](_[_0xe765('0xc9')](_0x4ebbf0[_0x3cd6c1],[_0xe765('0xf9'),_0xe765('0x1f5')]))[_0xe765('0xae')](_0x1babdd[_0xe765('0x1db')](_0x216b4d,_0x4ebbf0[_0x3cd6c1]))['catch'](_0x1babdd[_0xe765('0xc5')](_0xe765('0x1f6'),_0x216b4d));}}}})[_0xe765('0xaf')](loggerGetContactDialer('[getContactCampaign2]',_0x216b4d,_0x5b5ba5));}};Dialer[_0xe765('0x1b')]['handlePower']=function(_0x45556b,_0x40f978){var _0x12a50b=this;var _0x8a9d05=[];var _0x224361=_0x40f978>=0x1?_0x40f978:0x1;var _0x347ef8=[];if(_0x45556b[_0xe765('0x153')]==='booked'){_0x224361=0x1;}var _0x2421bc=Math[_0xe765('0x1bc')](_0x45556b['available']*_0x224361)-_0x45556b[_0xe765('0x6c')]-_0x45556b[_0xe765('0x1f0')];emitVoiceQueueSummary(_0x45556b);if(_0x45556b[_0xe765('0x1f7')]>0x0){var _0x26bb3b=_0x45556b[_0xe765('0x1f7')]-_0x45556b[_0xe765('0x6c')]-_0x45556b[_0xe765('0x53')]-_0x45556b[_0xe765('0x1f0')]-_0x45556b[_0xe765('0x9b')];if(_0x2421bc>_0x26bb3b){_0x2421bc=_0x26bb3b;}}if(_0x2421bc>0x0){if(_0x45556b[_0xe765('0x153')]===_0xe765('0xa')){_0x2421bc=0x1;}if(_0x2421bc>this['maxNumberOriginate']){_0x2421bc=this[_0xe765('0x25')];}_0x45556b['temp']+=_0x2421bc;for(var _0xe699dd in this[_0xe765('0x23')]){if(this[_0xe765('0x23')]['hasOwnProperty'](_0xe699dd)){if(this['agents'][_0xe699dd][_0xe765('0xe1')]===_0xe765('0x1f8')&&this[_0xe765('0x23')][_0xe699dd][_0xe765('0xa8')]===_0xe765('0xd5')){_0x8a9d05[_0xe765('0x13f')](this[_0xe765('0x23')][_0xe699dd]['id']);}}}this['getContactDialer'](_0x45556b['id'],_0x8a9d05,_0x2421bc,_0x45556b[_0xe765('0x1f1')])[_0xe765('0xae')](function(_0x260f51){_0x45556b['temp']-=_0x2421bc;_0x45556b[_0xe765('0x1f0')]=_0x45556b[_0xe765('0x1f0')]>0x0?_0x45556b[_0xe765('0x1f0')]:0x0;if(!checkContactEmpty(_0x260f51)){_0x12a50b[_0xe765('0xac')](_0x45556b)[_0xe765('0xae')](sendMessageReschedule(_0x45556b))['catch'](loggerCatch(_0xe765('0xb0')));}else{_0x45556b[_0xe765('0x6c')]+=_0x260f51[_0xe765('0x91')];_0x45556b[_0xe765('0x3d')]=_0x45556b[_0xe765('0x153')]==='booked'?'ACTIVE':'RUNNING';for(var _0x2db4f4=0x0;_0x2db4f4<_0x260f51['length'];_0x2db4f4+=0x1){if(_[_0xe765('0xa6')](_0x260f51[_0x2db4f4])||_[_0xe765('0xa6')](_0x260f51[_0x2db4f4][_0xe765('0x15c')])||_[_0xe765('0xa6')](_0x260f51[_0x2db4f4][_0xe765('0x15c')][_0xe765('0x15d')])){_0x12a50b['emptyContact'](_0xe765('0x1f4'),_0x45556b,_0x260f51[_0x2db4f4]);}else{_0x12a50b[_0xe765('0xb1')](_[_0xe765('0xc9')](_0x260f51[_0x2db4f4],[_0xe765('0xcd'),'Contact.phone']))[_0xe765('0xae')](_0x12a50b[_0xe765('0x1db')](_0x45556b,_0x260f51[_0x2db4f4]))[_0xe765('0xaf')](_0x12a50b[_0xe765('0xc5')](_0xe765('0x1f4'),_0x45556b));}}}})[_0xe765('0xaf')](loggerGetContactDialer(_0xe765('0x1f9'),_0x45556b,_0x2421bc));}};Dialer['prototype'][_0xe765('0x89')]=function(_0x12cf2c){var _0x136bcd=this;if(_0x12cf2c[_0xe765('0x1f7')]>0x0){var _0x156a93=_0x12cf2c[_0xe765('0x1f7')]-_0x12cf2c[_0xe765('0x6c')]-_0x12cf2c[_0xe765('0x53')];if(_0x156a93>0x0){this[_0xe765('0x1fa')](_0x12cf2c);}else{loggerPredictiveCalls[_0xe765('0x77')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x12cf2c);}};Dialer[_0xe765('0x1b')][_0xe765('0x1fa')]=function(_0x357105){var _0x40dab1=this;var _0x44b613=[];_0x357105['originated']+=0x1;for(var _0x346238 in this['agents']){if(this[_0xe765('0x23')][_0xe765('0x92')](_0x346238)){if(this[_0xe765('0x23')][_0x346238][_0xe765('0xe1')]===_0xe765('0x1f8')&&this[_0xe765('0x23')][_0x346238][_0xe765('0xa8')]==='reachable'){_0x44b613[_0xe765('0x13f')](this[_0xe765('0x23')][_0x346238]['id']);}}}this['getContactDialer'](_0x357105['id'],_0x44b613,0x1,_0x357105[_0xe765('0x1f1')])['then'](function(_0x55cc9d){if(!checkContactEmpty(_0x55cc9d)){checkContactLowerLimitOriginate(_0x357105,0x1,0x0);_0x40dab1[_0xe765('0xac')](_0x357105)[_0xe765('0xae')](sendMessageReschedule(_0x357105))['catch'](loggerCatch(_0xe765('0xb0')));}else{_0x357105[_0xe765('0x3d')]='RUNNING';if(_[_0xe765('0xa6')](_0x55cc9d[0x0])||_['isNil'](_0x55cc9d[0x0][_0xe765('0x15c')])||_[_0xe765('0xa6')](_0x55cc9d[0x0]['Contact']['phone'])){_0x40dab1[_0xe765('0xc6')](_0xe765('0x1f4'),_0x357105,_0x55cc9d[0x0]);}else{_0x40dab1[_0xe765('0xb1')](_[_0xe765('0xc9')](_0x55cc9d[0x0],['VoiceQueueId',_0xe765('0x1f5')]))['then'](_0x40dab1[_0xe765('0x1db')](_0x357105,_0x55cc9d[0x0]))['catch'](_0x40dab1[_0xe765('0xc5')]('[actionOriginatePredictive]\x20',_0x357105));}}})[_0xe765('0xaf')](loggerGetContactDialer(_0xe765('0x1fb'),_0x357105,0x1));emitVoiceQueueSummary(_0x357105);};Dialer[_0xe765('0x1b')][_0xe765('0x1ce')]=function(_0x4a845b,_0x22462f,_0x345807,_0x588632,_0x389c0c,_0x4f9249){loggerPredictive[_0xe765('0x77')](_0xe765('0x1fc'));loggerPredictive[_0xe765('0x77')](_0xe765('0x1fd'),_0x4a845b);loggerPredictive[_0xe765('0x77')](_0xe765('0x1fe'),_0x22462f);loggerPredictive[_0xe765('0x77')]('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',_0x345807);loggerPredictive['info'](_0xe765('0x1ff'),_0x588632);loggerPredictive[_0xe765('0x77')](_0xe765('0x200'),_0x389c0c);loggerPredictive[_0xe765('0x77')](_0xe765('0x7e'));return new BPromise(function(_0xd0f945,_0x293166){if(_0x4a845b<=0x0||isNaN(_0x4a845b)){return _0x293166(msgResponse('[abandonmentRate]','Error',_0xe765('0x201')+_0x4a845b));}if(_0x345807<=0x0||isNaN(_0x345807)){return _0x293166(msgResponse(_0xe765('0x202'),'Error',_0xe765('0x203')+_0x345807));}if(_0x588632<=0x0||isNaN(_0x588632)){return _0x293166(msgResponse(_0xe765('0x202'),_0xe765('0x48'),_0xe765('0x204')+_0x588632));}if(_0x22462f<=0x0||isNaN(_0x22462f)){return _0x293166(msgResponse(_0xe765('0x202'),_0xe765('0x48'),'interval\x20=\x20'+_0x22462f));}if(_0x389c0c<=0x0||isNaN(_0x389c0c)){return _0x293166(msgResponse(_0xe765('0x202'),'Error',_0xe765('0x205')+_0x389c0c));}_0x4f9249=_0x4f9249||0x0;var _0x5a852c=0x1/_0x345807;var _0x414374=0x0;var _0x1e9bad=0x0;var _0x33ea16=0x0;var _0x8a987=0x0;for(var _0x196e95=0x0;_0x33ea16<_0x389c0c;_0x196e95+=0x1){_0x1e9bad=_0x196e95/_0x22462f;_0x414374=(_0x588632*_0x1e9bad+_0x4f9249)/_0x5a852c;_0x33ea16=erlangb(_0x414374,_0x4a845b);_0x8a987=_0x414374/_0x4a845b*(0x1-erlangb(_0x414374,_0x4a845b));}return _0xd0f945({'erlangCalls':_0x196e95,'erlangCallToSecond':_0x22462f/_0x196e95,'erlangAbandonmentRate':_0x33ea16,'erlangBusyFactor':_0x8a987});});};Dialer['prototype'][_0xe765('0x206')]=function(_0x4648b0,_0x25327a,_0xbad241,_0x40e2fd,_0x4b9a88,_0x318b1e){loggerPredictive[_0xe765('0x77')](_0xe765('0x207'));loggerPredictive[_0xe765('0x77')](_0xe765('0x1fd'),_0x4648b0);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25327a);loggerPredictive['info'](_0xe765('0x208'),_0xbad241);loggerPredictive[_0xe765('0x77')](_0xe765('0x1ff'),_0x40e2fd);loggerPredictive[_0xe765('0x77')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b9a88);loggerPredictive['info'](_0xe765('0x7e'));return new BPromise(function(_0x1394d4,_0x4a50f7){if(_0x4648b0<=0x0||isNaN(_0x4648b0)){return _0x4a50f7(msgResponse(_0xe765('0x209'),'Error',_0xe765('0x201')+_0x4648b0));}if(_0xbad241<=0x0||isNaN(_0xbad241)){return _0x4a50f7(msgResponse(_0xe765('0x209'),_0xe765('0x48'),_0xe765('0x203')+_0xbad241));}if(_0x40e2fd<=0x0||isNaN(_0x40e2fd)){return _0x4a50f7(msgResponse(_0xe765('0x209'),'Error','p\x20=\x20'+_0x40e2fd));}if(_0x25327a<=0x0||isNaN(_0x25327a)){return _0x4a50f7(msgResponse('[busyFactor]',_0xe765('0x48'),'interval\x20=\x20'+_0x25327a));}if(_0x4b9a88<=0x0||isNaN(_0x4b9a88)){return _0x4a50f7(msgResponse(_0xe765('0x209'),_0xe765('0x48'),_0xe765('0x20a')+_0x4b9a88));}_0x318b1e=_0x318b1e||0x0;var _0x2f0ac1=0x1/_0xbad241;var _0x2473ae=0x0;var _0x5e2b57=0x0;var _0x165170=0x0;var _0x1a3902=0x0;for(var _0x22fafc=0x0;_0x1a3902<_0x4b9a88;_0x22fafc+=0x1){_0x5e2b57=_0x22fafc/_0x25327a;_0x2473ae=(_0x40e2fd*_0x5e2b57+_0x318b1e)/_0x2f0ac1;_0x165170=erlangb(_0x2473ae,_0x4648b0);_0x1a3902=_0x2473ae/_0x4648b0*(0x1-erlangb(_0x2473ae,_0x4648b0));}return _0x1394d4({'erlangCalls':_0x22fafc,'erlangCallToSecond':_0x25327a/_0x22fafc,'erlangAbandonmentRate':_0x165170,'erlangBusyFactor':_0x1a3902});});};module[_0xe765('0x20b')]=Dialer; \ No newline at end of file +var _0xbcbc=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','dialMachineMaxRetry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AGI','cause-txt','Unknow','[syncHangupIvr]','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','syncAgentConnect','answertime','queueCallerAbandonCreateState','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','stateinterface','locked','rrmemory','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','[syncQueueSummary]','checkIsTrunkReachable','checkIfTimeIntervals','\x5cw{0,','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','run','log','Contact\x20updated','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','push','Contact.phone','loggerHandler','[getContactDialer2]','tryOriginatePredictive','RUNNING','[actionOriginatePredictive]\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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','bind','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','milliseconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','stack','length','error','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','NOT_ACTIVE','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','countmachineretry','amd','countcongestionretry'];(function(_0xe63e11,_0x48f349){var _0x3403d1=function(_0x40a4fe){while(--_0x40a4fe){_0xe63e11['push'](_0xe63e11['shift']());}};_0x3403d1(++_0x48f349);}(_0xbcbc,0x123));var _0xcbcb=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xbcbc[_0x5ac0f0];return _0x4aceec;};'use strict';var util=require(_0xcbcb('0x0'));var _=require(_0xcbcb('0x1'));var BPromise=require(_0xcbcb('0x2'));var uuid=require(_0xcbcb('0x3'));var moment=require(_0xcbcb('0x4'));var rr=require('rr');var md5=require(_0xcbcb('0x5'));var Redis=require('ioredis');var ut=require(_0xcbcb('0x6'));var config=require(_0xcbcb('0x7'));var logger=require(_0xcbcb('0x8'))(_0xcbcb('0x9'));var loggerBooked=require(_0xcbcb('0x8'))(_0xcbcb('0xa'));var loggerPredictive=require(_0xcbcb('0x8'))('predictive');var loggerPredictiveCalls=require(_0xcbcb('0x8'))(_0xcbcb('0xb'));var loggerSyncQueueSummary=require(_0xcbcb('0x8'))(_0xcbcb('0xc'));var ami=require(_0xcbcb('0xd'));config[_0xcbcb('0xe')]=_[_0xcbcb('0xf')](config['redis'],{'host':_0xcbcb('0x10'),'port':0x18eb});var io=require(_0xcbcb('0x11'))(new Redis(config['redis']));var cmHopper=require(_0xcbcb('0x12'));var cmHopperFinal=require(_0xcbcb('0x13'));var cmHopperHistory=require(_0xcbcb('0x14'));var cmHopperBlack=require(_0xcbcb('0x15'));var voiceQueueRt=require(_0xcbcb('0x16'));var Action=require(_0xcbcb('0x17'));var History=require(_0xcbcb('0x18'));var Final=require('./final');var AgentComplete=require(_0xcbcb('0x19'));var QueueCallerAbandon=require(_0xcbcb('0x1a'));var Hangup=require(_0xcbcb('0x1b'));var ipAgi=process[_0xcbcb('0x1c')][_0xcbcb('0x1d')]||_0xcbcb('0x1e');var strategy={'rrmemory':'rrmemory','roundrobin':_0xcbcb('0x1f')};var Sequence=function(){};Sequence[_0xcbcb('0x20')][_0xcbcb('0x21')]=function(_0x492a2d){this[_0xcbcb('0x22')]=this['tail']?this[_0xcbcb('0x22')][_0xcbcb('0x23')](_0x492a2d):_0x492a2d();};function Dialer(_0xdefdcc,_0x4965e2){this[_0xcbcb('0x24')]=new Sequence();this[_0xcbcb('0x25')]=_0x4965e2;this[_0xcbcb('0x26')]=_0xdefdcc[_0xcbcb('0x26')];this[_0xcbcb('0x27')]=_0xdefdcc[_0xcbcb('0x27')];this[_0xcbcb('0x28')]=_0xdefdcc[_0xcbcb('0x28')];this['trunks']=_0xdefdcc[_0xcbcb('0x29')];this[_0xcbcb('0x2a')]=config[_0xcbcb('0x2a')]||0x2;this[_0xcbcb('0x2b')]={};this[_0xcbcb('0x2c')]={};this[_0xcbcb('0x2d')]={};this[_0xcbcb('0x2e')]={};this['optionPredictive']={};this[_0xcbcb('0x2f')]={};this[_0xcbcb('0x30')]={};this[_0xcbcb('0x31')]={};this[_0xcbcb('0x32')]={};this['queueBookedRR']={};ami['on']('agentconnect',this['syncAgentConnect'][_0xcbcb('0x33')](this));ami['on']('queuecallerabandon',this[_0xcbcb('0x34')][_0xcbcb('0x33')](this));ami['on']('originateresponse',this[_0xcbcb('0x35')][_0xcbcb('0x33')](this));ami['on']('agentcomplete',this[_0xcbcb('0x36')][_0xcbcb('0x33')](this));ami['on'](_0xcbcb('0x37'),this['syncQueueSummary'][_0xcbcb('0x33')](this));ami['on'](_0xcbcb('0x38'),this[_0xcbcb('0x39')]['bind'](this));ami['on'](_0xcbcb('0x3a'),this['syncNewExten'][_0xcbcb('0x33')](this));ami['on'](_0xcbcb('0x3b'),this[_0xcbcb('0x3c')][_0xcbcb('0x33')](this));ami['on'](_0xcbcb('0x3d'),this['syncQueueMember'][_0xcbcb('0x33')](this));ami['on'](_0xcbcb('0x3e'),this[_0xcbcb('0x3f')]['bind'](this));this[_0xcbcb('0x40')]();this['loopClearZombieChannels']();}function isNotNull(_0x4a2af3){return _0x4a2af3!==null&&!_[_0xcbcb('0x41')](_0x4a2af3);}function checkIsLoggedIn(_0x59df80,_0x378f5e){return function(){if(_0x378f5e<=0x0){_0x59df80[_0xcbcb('0x42')]='AGENTS_NOT_LOGGED';throw _0x59df80[_0xcbcb('0x43')]+_0xcbcb('0x44');}};}function isActive(_0x33f7f5){return _0x33f7f5;}function checkIsActive(_0x1768f3,_0x43f698){return function(){if(!isActive(_0x43f698)){_0x1768f3[_0xcbcb('0x42')]='NOT_ACTIVE';throw _0x1768f3[_0xcbcb('0x43')]+'\x20NOT\x20Active';}};}function checkInterval(_0x7a5e83){return function(){if(!isNotNull(_0x7a5e83[_0xcbcb('0x45')])){_0x7a5e83['message']=_0xcbcb('0x46');throw _0x7a5e83[_0xcbcb('0x43')]+_0xcbcb('0x47');}if(!isNotNull(_0x7a5e83[_0xcbcb('0x45')][_0xcbcb('0x48')])){_0x7a5e83['message']=_0xcbcb('0x46');throw _0x7a5e83[_0xcbcb('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xcbcb('0x49')](_0x7a5e83[_0xcbcb('0x45')][_0xcbcb('0x48')]))){_0x7a5e83['message']=_0xcbcb('0x46');throw _0x7a5e83['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x13031f,_0x42c9e6,_0x20997d){return{'action':_0x13031f,'response':_0x42c9e6,'message':_0x20997d,'stack':_0x20997d};}function myreject(_0x330a8f){return function(_0x30e02a){return _0x330a8f(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x30e02a)));};}function getSeconds(_0x11972e,_0x35ccfe){var _0x1559d9=moment(_0x11972e)['milliseconds'](0x0);var _0x568380=moment(_0x35ccfe)['milliseconds'](0x0);return _0x1559d9[_0xcbcb('0x4a')](_0x568380,_0xcbcb('0x4b'));}function emit(_0x44497f,_0x31e677,_0x401590){io['to'](_0x44497f)[_0xcbcb('0x4c')](_0x31e677,_0x401590);}function emitVoiceQueueSummary(_0x223656){if(_0x223656[_0xcbcb('0x4d')]===_0xcbcb('0x4e')){var _0x5d7263={'id':_0x223656['id'],'name':_0x223656['name'],'strategy':_0x223656[_0xcbcb('0x4f')],'answered':_0x223656[_0xcbcb('0x50')],'available':_0x223656['available'],'loggedIn':_0x223656[_0xcbcb('0x51')],'pTalking':_0x223656['pTalking'],'sumBillable':_0x223656['sumBillable'],'sumDuration':_0x223656[_0xcbcb('0x52')],'sumHoldTime':_0x223656[_0xcbcb('0x53')]||0x0,'talking':_0x223656[_0xcbcb('0x54')],'total':_0x223656[_0xcbcb('0x55')],'type':_0x223656[_0xcbcb('0x4d')],'unmanaged':_0x223656[_0xcbcb('0x56')],'abandoned':_0x223656[_0xcbcb('0x57')],'waiting':_0x223656[_0xcbcb('0x58')],'loggedInDb':_0x223656[_0xcbcb('0x59')],'dialActive':_0x223656[_0xcbcb('0x5a')],'dialMethod':_0x223656['dialMethod'],'dialOriginateCallerIdName':_0x223656[_0xcbcb('0x5b')],'dialOriginateCallerIdNumber':_0x223656[_0xcbcb('0x5c')],'dialOriginateTimeout':_0x223656[_0xcbcb('0x5d')],'dialPrefix':_0x223656[_0xcbcb('0x5e')],'outboundAnswerAgiCallsDay':_0x223656['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x223656[_0xcbcb('0x5f')],'outboundBlacklistCallsDay':_0x223656['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x223656[_0xcbcb('0x60')],'outboundCongestionCallsDay':_0x223656['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x223656[_0xcbcb('0x61')],'outboundDropCallsDayCallersExit':_0x223656[_0xcbcb('0x62')],'outboundDropCallsDayTimeout':_0x223656[_0xcbcb('0x63')],'outboundNoAnswerCallsDay':_0x223656['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x223656[_0xcbcb('0x64')],'outboundOriginateFailureCallsDay':_0x223656[_0xcbcb('0x65')],'outboundReCallsDay':_0x223656[_0xcbcb('0x66')],'outboundRejectCallsDay':_0x223656[_0xcbcb('0x67')],'outboundUnknownCallsDay':_0x223656[_0xcbcb('0x68')],'predictiveIntervalAnsweredCalls':_0x223656[_0xcbcb('0x69')],'predictiveIntervalAvgHoldtime':_0x223656['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x223656[_0xcbcb('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x223656[_0xcbcb('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x223656[_0xcbcb('0x6c')],'predictiveIntervalErlangCalls':_0x223656[_0xcbcb('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x223656['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x223656[_0xcbcb('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x223656['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x223656['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x223656['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x223656[_0xcbcb('0x6f')],'message':_0x223656['message'],'originated':_0x223656[_0xcbcb('0x70')],'erlangCalls':_0x223656[_0xcbcb('0x71')],'erlangCallToSecond':_0x223656[_0xcbcb('0x72')],'erlangAbandonmentRate':_0x223656[_0xcbcb('0x73')],'erlangBusyFactor':_0x223656[_0xcbcb('0x74')],'startPredictive':_0x223656[_0xcbcb('0x2f')],'startProgressive':_0x223656[_0xcbcb('0x30')]};if(_0x223656[_0xcbcb('0x75')]){_0x5d7263['Trunk']={'id':_0x223656['Trunk']['id'],'name':_0x223656[_0xcbcb('0x75')][_0xcbcb('0x43')],'active':_0x223656[_0xcbcb('0x75')][_0xcbcb('0x76')],'callerid':_0x223656[_0xcbcb('0x75')]['callerid']};}if(_0x223656[_0xcbcb('0x45')]){_0x5d7263[_0xcbcb('0x45')]={'id':_0x223656[_0xcbcb('0x45')]['id'],'name':_0x223656['Interval'][_0xcbcb('0x43')]};}var _0x9599cb=md5(JSON[_0xcbcb('0x77')](_0x5d7263));if(_0x223656[_0xcbcb('0x5')]!==_0x9599cb){_0x223656[_0xcbcb('0x5')]=_0x9599cb;emit(util[_0xcbcb('0x78')](_0xcbcb('0x79'),_0x5d7263[_0xcbcb('0x43')]),_0xcbcb('0x7a'),_0x5d7263);}}}function emitCampaignSummary(_0x57f273){if(_0x57f273[_0xcbcb('0x4d')]===_0xcbcb('0x7b')){emit(util[_0xcbcb('0x78')](_0xcbcb('0x7c'),_0x57f273['name']),_0xcbcb('0x7d'),_0x57f273);}}function checkGetDataPredictive(_0x59a1cc){if(isNotNull(_0x59a1cc)){if(!_[_0xcbcb('0x49')](_0x59a1cc)){loggerPredictive[_0xcbcb('0x7e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x7f'),_0x59a1cc[_0xcbcb('0x6f')]);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x80'),_0x59a1cc[_0xcbcb('0x69')]);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x81'),_0x59a1cc[_0xcbcb('0x6c')]);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x82'),_0x59a1cc[_0xcbcb('0x6b')]);loggerPredictive[_0xcbcb('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59a1cc['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x83'),_0x59a1cc[_0xcbcb('0x6a')]);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x84'));if(_0x59a1cc[_0xcbcb('0x6f')]>0x0){if(!_['isUndefined'](_0x59a1cc[_0xcbcb('0x6a')])&&_0x59a1cc[_0xcbcb('0x6a')]>0x0){return!![];}else{loggerPredictive['info'](_0xcbcb('0x85'));}if(!_[_0xcbcb('0x41')](_0x59a1cc[_0xcbcb('0x86')])&&_0x59a1cc[_0xcbcb('0x86')]>0x0){return!![];}else{loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x87'));}}else{loggerPredictive[_0xcbcb('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xcbcb('0x7e')]('History\x20information\x20are\x20empty');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x53c127){return function(_0x4e51b7){loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x88'));loggerPredictive['info'](_0xcbcb('0x89'),_0x4e51b7[_0xcbcb('0x71')]);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x8a'),_0x4e51b7[_0xcbcb('0x72')]);loggerPredictive[_0xcbcb('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e51b7['erlangAbandonmentRate']);loggerPredictive[_0xcbcb('0x7e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e51b7[_0xcbcb('0x74')]);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x8b'),_0x4e51b7['erlangAbandonmentRate']);loggerPredictive['info'](_0xcbcb('0x84'));_[_0xcbcb('0x8c')](_0x53c127,_0x4e51b7);};}function getDiff(_0x5f5803){var _0x5b498b=moment()[_0xcbcb('0x8d')](0x0);var _0xb9ca1a=moment(_0x5f5803)['milliseconds'](0x0);return _0x5b498b[_0xcbcb('0x4a')](_0xb9ca1a,_0xcbcb('0x4b'));}function ifInterval(_0xe00908,_0x4110b9){if(_['isUndefined'](_0x4110b9)){return![];}if(getDiff(_0x4110b9)<_0xe00908*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x506bfc){if(isNotNull(_0x506bfc)){if(!_['isUndefined'](_0x506bfc[_0xcbcb('0x30')])){_0x506bfc['startProgressive']=undefined;loggerPredictive[_0xcbcb('0x7e')](_0x506bfc[_0xcbcb('0x43')],_0xcbcb('0x8e'));}if(!_[_0xcbcb('0x41')](_0x506bfc['startPredictive'])){_0x506bfc[_0xcbcb('0x2f')]=undefined;loggerPredictive[_0xcbcb('0x7e')](_0x506bfc[_0xcbcb('0x43')],_0xcbcb('0x8f'));}if(!_['isUndefined'](_0x506bfc[_0xcbcb('0x90')])){clearInterval(_0x506bfc[_0xcbcb('0x90')]);_0x506bfc[_0xcbcb('0x90')]=undefined;loggerPredictive['info'](_0x506bfc[_0xcbcb('0x43')],_0xcbcb('0x91'));}}}function erlangb(_0x415c0e,_0x254801){if(_0x254801===0x0){return 0x0;}var _0x3db80f=0x1;for(var _0x4a0a2d=0x1;_0x4a0a2d<=_0x254801;_0x4a0a2d+=0x1){_0x3db80f=0x1+_0x3db80f*_0x4a0a2d/_0x415c0e;}return 0x1/_0x3db80f;}function isVoiceQueueOutbound(_0x3e4c75){return _0x3e4c75==='outbound';}function isNotPreview(_0x5e6c78){return _0x5e6c78!==_0xcbcb('0x25');}function isCampaignIvr(_0x4fd342){return _0x4fd342===_0xcbcb('0x7b');}function getCallerId(_0x3e21bc,_0x4f312e,_0x2735d3){if(!_[_0xcbcb('0x41')](_0x2735d3)&&_0xcbcb('0x92')===typeof _0x2735d3&&!_['isEmpty'](_0x2735d3)){if(!_[_0xcbcb('0x41')](_0x4f312e)&&_0xcbcb('0x92')===typeof _0x4f312e&&!_['isEmpty'](_0x4f312e)){return util[_0xcbcb('0x78')]('\x22%s\x22\x20<%s>',_0x4f312e,_0x2735d3);}return util[_0xcbcb('0x78')](_0xcbcb('0x93'),_0x2735d3,_0x2735d3);}if(!_['isUndefined'](_0x3e21bc)&&_0xcbcb('0x92')===typeof _0x3e21bc&&!_[_0xcbcb('0x49')](_0x3e21bc)){return _0x3e21bc;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4813d1,_0x14766b){return function(_0x1e7f47){freeVariablesPredictive(_0x14766b);emitVoiceQueueSummary(_0x14766b);emitCampaignSummary(_0x14766b);loggerSyncQueueSummary['error'](_0x4813d1,util['inspect'](_0x1e7f47,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x29f09b,_0x43077e){return function(_0x40b7aa){loggerPredictive['error'](_0x43077e[_0xcbcb('0x43')],_0x29f09b);loggerPredictive['error'](_0x40b7aa[_0xcbcb('0x94')]);freeVariablesPredictive(_0x43077e);};}function loggerCatch(_0x5bd3e5){return function(_0x2ffc94){logger['error'](_0x5bd3e5,util['inspect'](_0x2ffc94,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x150f2c){return _0x150f2c&&!_[_0xcbcb('0x41')](_0x150f2c)&&_0x150f2c[_0xcbcb('0x95')]>0x0;}function decremetOriginate(_0x146356){if(!_[_0xcbcb('0x41')](_0x146356)&&_0x146356!==null){if(_0x146356['hasOwnProperty'](_0xcbcb('0x70'))){if(_0x146356[_0xcbcb('0x70')]>0x0){_0x146356[_0xcbcb('0x70')]-=0x1;}else{logger[_0xcbcb('0x96')](_0xcbcb('0x97'));}}}else{logger['error'](_0xcbcb('0x98'));}}function checkContactLowerLimitOriginate(_0x595ccd,_0x13fdd3,_0x1b1998){if(_0x13fdd3>_0x1b1998){for(var _0x4b10fd=0x0;_0x4b10fd<_0x13fdd3-_0x1b1998;_0x4b10fd+=0x1){decremetOriginate(_0x595ccd);}}}function loggerGetContactDialer(_0x4bfb30,_0x3344a7,_0x36ff56){return function(_0x439c9b){checkContactLowerLimitOriginate(_0x3344a7,_0x36ff56,0x0);logger[_0xcbcb('0x96')](_0x4bfb30,util[_0xcbcb('0x99')](_0x439c9b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x57b505){return function(_0x1a218a){if(isNotNull(_0x1a218a)&&isNotNull(_0x1a218a[0x0])){if(_0x1a218a[0x0][_0xcbcb('0x9a')]>0x0){_0x57b505[_0xcbcb('0x42')]='RESCHEDULED_CONTACTS';logger[_0xcbcb('0x7e')](_0xcbcb('0x9b')+_0x57b505[_0xcbcb('0x43')],_0x1a218a[0x0][_0xcbcb('0x9a')],_0xcbcb('0x9c'));}else{_0x57b505[_0xcbcb('0x42')]=_0xcbcb('0x9d');logger['info'](_0xcbcb('0x9e')+_0x57b505[_0xcbcb('0x43')]);}}};}function notSendMessagesQueue(_0x254b05){if(_0x254b05[_0xcbcb('0x9f')]){freeVariablesPredictive(_0x254b05);if(_0x254b05[_0xcbcb('0x70')]===0x0&&_0x254b05['talking']===0x0&&_0x254b05[_0xcbcb('0x58')]===0x0&&(_0x254b05['pTalking']||0x0)===0x0){_0x254b05['sendMessageOneNotActive']=![];_0x254b05[_0xcbcb('0xa0')]=0x0;_0x254b05['message']=_0xcbcb('0xa1');loggerSyncQueueSummary[_0xcbcb('0x96')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x254b05['name'],_0xcbcb('0xa2'));}else{_0x254b05['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0xcbcb('0x96')](_0xcbcb('0xa3'),_0x254b05[_0xcbcb('0x43')],_0xcbcb('0xa4'));}emitVoiceQueueSummary(_0x254b05);}}function notSendMessagesCampaign(_0x3e8cda){if(_0x3e8cda[_0xcbcb('0x9f')]){if(_0x3e8cda[_0xcbcb('0x70')]===0x0){_0x3e8cda[_0xcbcb('0x9f')]=![];_0x3e8cda['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xcbcb('0x96')](_0xcbcb('0xa5'),_0x3e8cda[_0xcbcb('0x43')],_0xcbcb('0xa2'));}else{_0x3e8cda['message']=_0xcbcb('0xa6');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3e8cda['name'],_0xcbcb('0xa4'));}emitCampaignSummary(_0x3e8cda);}}function createObjHistory(_0x20ac85,_0x433056,_0x3c4e0a,_0x3ed158,_0x2064b1){_0x20ac85['message']=_0x3c4e0a;var _0xb73468=new Action(_0x20ac85,_0x433056);var _0xc701be=new History(_0xb73468);_0xc701be[_0xcbcb('0xa7')]=_0x3ed158;_0xc701be[_0xcbcb('0xa8')]=_0x2064b1;_0xc701be['endtime']=_0xb73468[_0xcbcb('0xa9')];return _0xc701be;}Dialer[_0xcbcb('0x20')][_0xcbcb('0xaa')]=function(){var _0x3b7046=this;setInterval(function(){_0x3b7046[_0xcbcb('0xab')](_0x3b7046[_0xcbcb('0x2e')],_0xcbcb('0xac'));_0x3b7046[_0xcbcb('0xab')](_0x3b7046[_0xcbcb('0x2c')],_0xcbcb('0xad'));},0x32c8);};Dialer['prototype'][_0xcbcb('0xab')]=function(_0x33cd39,_0x33fee4){var _0x373363=this;for(var _0x4e23ac in _0x33cd39){if(_0x33cd39[_0xcbcb('0xae')](_0x4e23ac)){this['sequence'][_0xcbcb('0x21')](function(){if(!_[_0xcbcb('0xaf')](_0x33cd39[_0x4e23ac])){return ami[_0xcbcb('0xb0')]({'action':_0xcbcb('0xb1'),'channel':_0x33cd39[_0x4e23ac][_0xcbcb('0xb2')]})['catch'](function(_0x214375){if(_0x214375['message']===_0xcbcb('0xb3')){setTimeout(function(){if(_0x33cd39[_0x4e23ac]&&_0x33cd39[_0x4e23ac][_0xcbcb('0x4d')]!=='ivr'){_0x373363[_0xcbcb('0xb4')](_0x373363[_0xcbcb('0x26')][_0x33cd39[_0x4e23ac][_0xcbcb('0xb5')]]);logger['error'](_0xcbcb('0xb6'),_0x33fee4,_0x4e23ac,_0x33cd39[_0x4e23ac][_0xcbcb('0xb5')]);delete _0x33cd39[_0x4e23ac];}if(_0x33cd39[_0x4e23ac]&&_0x33cd39[_0x4e23ac]['type']===_0xcbcb('0x7b')){_0x373363[_0xcbcb('0xb4')](_0x373363['campaigns'][_0x33cd39[_0x4e23ac][_0xcbcb('0xb5')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x33fee4,_0x4e23ac,_0x33cd39[_0x4e23ac][_0xcbcb('0xb5')]);delete _0x33cd39[_0x4e23ac];}},0x2328);}});}});}}};Dialer[_0xcbcb('0x20')][_0xcbcb('0xb7')]=function(_0x589ba2){return BPromise[_0xcbcb('0xb8')]()[_0xcbcb('0xb9')](cmHopper[_0xcbcb('0xb7')](_0x589ba2))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xbb')));};Dialer[_0xcbcb('0x20')][_0xcbcb('0xbc')]=function(_0x2e8357){return BPromise[_0xcbcb('0xb8')]()[_0xcbcb('0xb9')](cmHopperBlack[_0xcbcb('0xbc')](_0x2e8357))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xcbcb('0x20')]['checkIsBlackListIvr']=function(_0x36bef1){return BPromise[_0xcbcb('0xb8')]()[_0xcbcb('0xb9')](cmHopperBlack[_0xcbcb('0xbd')](_0x36bef1))['catch'](loggerCatch(_0xcbcb('0xbe')));};Dialer[_0xcbcb('0x20')][_0xcbcb('0xbf')]=function(_0x40b504){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x40b504))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xc0')));};Dialer[_0xcbcb('0x20')][_0xcbcb('0xc1')]=function(_0x3952eb){return BPromise['resolve']()[_0xcbcb('0xb9')](cmHopper['rescheduleContact'](_0x3952eb))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xc2')));};Dialer['prototype'][_0xcbcb('0xc3')]=function(_0x212e89,_0x1e09e5,_0x10c7d2){return BPromise[_0xcbcb('0xb8')]()['then'](cmHopper[_0xcbcb('0xc3')](_0x212e89,_0x1e09e5,_0x10c7d2))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xc4')));};Dialer[_0xcbcb('0x20')][_0xcbcb('0xc5')]=function(_0x480446,_0x54b870,_0x1f7c42,_0x7869f){return BPromise['resolve']()[_0xcbcb('0xb9')](cmHopper[_0xcbcb('0xc5')](_0x480446,_0x54b870,_0x1f7c42,_0x7869f))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xc6')));};Dialer[_0xcbcb('0x20')][_0xcbcb('0xc7')]=function(_0x38e618,_0x1df428,_0x187273){return BPromise['resolve']()[_0xcbcb('0xb9')](cmHopper[_0xcbcb('0xc7')](_0x38e618,_0x1df428,_0x187273))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xc6')));};Dialer[_0xcbcb('0x20')][_0xcbcb('0xc8')]=function(_0x268169){return BPromise[_0xcbcb('0xb8')]()['then'](voiceQueueRt[_0xcbcb('0xc8')](_0x268169))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xcbcb('0x20')][_0xcbcb('0xc9')]=function(_0x4509bd){return BPromise[_0xcbcb('0xb8')]()[_0xcbcb('0xb9')](cmHopper[_0xcbcb('0xc9')](_0x4509bd))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xca')));};Dialer['prototype'][_0xcbcb('0xcb')]=function(_0x5b9768){return BPromise[_0xcbcb('0xb8')]()[_0xcbcb('0xb9')](cmHopperHistory[_0xcbcb('0xcb')](_0x5b9768))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xcc')));};Dialer[_0xcbcb('0x20')][_0xcbcb('0xb4')]=function(_0xa97399){if(!_['isUndefined'](_0xa97399)&&_0xa97399!==null){if(_0xa97399[_0xcbcb('0xae')]('originated')){if(_0xa97399[_0xcbcb('0x70')]>0x0){_0xa97399['originated']-=0x1;}else{logger[_0xcbcb('0x96')](_0xcbcb('0xcd'));}}}else{logger[_0xcbcb('0x96')](_0xcbcb('0xce'));}};Dialer[_0xcbcb('0x20')]['loggerHandler']=function(_0x43ecf5,_0x138fa8){var _0x123eef=this;return function(_0x457468){_0x123eef[_0xcbcb('0xb4')](_0x138fa8);logger[_0xcbcb('0x96')](_0x43ecf5,util[_0xcbcb('0x99')](_0x457468,{'showHidden':![],'depth':null}));};};Dialer[_0xcbcb('0x20')]['emptyContact']=function(_0x3acc51,_0x40b00a,_0xd3dccd){var _0x2a27f={'state':0x19,'statedesc':_0xcbcb('0xcf')};this['updateOriginated'](_0x40b00a);this[_0xcbcb('0xd0')](_[_0xcbcb('0x8c')](_0x2a27f,_[_0xcbcb('0xd1')](_0xd3dccd,[_0xcbcb('0xd2'),_0xcbcb('0xd3'),_0xcbcb('0xd4'),_0xcbcb('0xd5'),_0xcbcb('0xd6')])),_0xcbcb('0xd7'),_0xcbcb('0xd8'));logger['error'](_0x3acc51);};Dialer[_0xcbcb('0x20')][_0xcbcb('0xd9')]=function(_0x3cc432){return _0x3cc432==='Success';};Dialer[_0xcbcb('0x20')][_0xcbcb('0xda')]=function(_0x567892){return!_[_0xcbcb('0x41')](_0x567892)&&_0x567892&&!_[_0xcbcb('0x41')](_0x567892[_0xcbcb('0x43')])&&!_[_0xcbcb('0x41')](_0x567892[_0xcbcb('0x76')])&&_0x567892[_0xcbcb('0x76')]&&(this[_0xcbcb('0x29')][util[_0xcbcb('0x78')](_0xcbcb('0xdb'),_0x567892[_0xcbcb('0x43')])][_0xcbcb('0xb1')]===_0xcbcb('0xdc')||this[_0xcbcb('0x29')][util['format'](_0xcbcb('0xdb'),_0x567892[_0xcbcb('0x43')])][_0xcbcb('0xb1')]===_0xcbcb('0xdd'));};Dialer['prototype'][_0xcbcb('0xd0')]=function(_0x3263ee,_0x254402,_0x4c8807){this[_0xcbcb('0xcb')](_0x3263ee)[_0xcbcb('0xba')](loggerCatch(_0x254402));this[_0xcbcb('0xc9')](_0x3263ee)[_0xcbcb('0xba')](loggerCatch(_0x4c8807));};Dialer[_0xcbcb('0x20')]['syncVarSet']=function(_0x40b2d1){var _0x40c1dd=this[_0xcbcb('0x2e')][_0x40b2d1[_0xcbcb('0xde')]];var _0x45b99f;if(!_[_0xcbcb('0xaf')](_0x40b2d1)&&!_['isNil'](_0x40b2d1[_0xcbcb('0xdf')])&&!_[_0xcbcb('0xaf')](_0x40b2d1[_0xcbcb('0xdf')][_0xcbcb('0xe0')])&&_0x40b2d1[_0xcbcb('0xe1')]===_0xcbcb('0xe2')&&_0x40c1dd){if(_0x40c1dd[_0xcbcb('0x4d')]!==_0xcbcb('0x7b')&&this[_0xcbcb('0x26')][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0xe3')]&&_0x40b2d1['value']===_0xcbcb('0xe4')){delete this[_0xcbcb('0x2e')][_0x40b2d1[_0xcbcb('0xde')]];this[_0xcbcb('0xb4')](this[_0xcbcb('0x26')][_0x40c1dd['queue']]);this[_0xcbcb('0x26')][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0x5f')]+=0x1;this['voiceQueues'][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0xe5')]+=0x1;_0x45b99f=new Hangup(_0x40c1dd,_0x40b2d1);_0x45b99f[_0xcbcb('0xa7')]=0x12;_0x45b99f[_0xcbcb('0xa8')]='HangupInAMD';_0x45b99f['membername']=_0xcbcb('0xe6');this[_0xcbcb('0xd0')](_0x45b99f,_0xcbcb('0xe7'),_0xcbcb('0xe8'));}if(_0x40c1dd[_0xcbcb('0x4d')]!=='ivr'&&this[_0xcbcb('0x26')][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0xe3')]&&_0x40b2d1[_0xcbcb('0xe9')]===_0xcbcb('0xea')){var _0x576616=this;return new BPromise(function(_0x78442b,_0x29c719){delete _0x576616[_0xcbcb('0x2e')][_0x40b2d1[_0xcbcb('0xde')]];_0x576616[_0xcbcb('0xb4')](_0x576616[_0xcbcb('0x26')][_0x40c1dd[_0xcbcb('0xb5')]]);_0x576616[_0xcbcb('0x26')][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0x5f')]+=0x1;_0x576616[_0xcbcb('0x26')][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0xe5')]+=0x1;var _0x59bbd8=_0x576616[_0xcbcb('0x26')][_0x40c1dd[_0xcbcb('0xb5')]];var _0x4933d4=new Hangup(_0x40c1dd,_0x40b2d1);_0x4933d4['state']=0x13;_0x4933d4[_0xcbcb('0xa8')]=_0xcbcb('0xeb');_0x4933d4[_0xcbcb('0xec')]=_0xcbcb('0xe6');_0x4933d4[_0xcbcb('0xed')]+=0x1;_0x4933d4['countglobal']+=0x1;_0x4933d4[_0xcbcb('0xee')]=!![];_0x576616[_0xcbcb('0xcb')](_0x4933d4)[_0xcbcb('0xba')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4933d4['countbusyretry']+_0x4933d4[_0xcbcb('0xef')]+_0x4933d4[_0xcbcb('0xf0')]+_0x4933d4[_0xcbcb('0xf1')]+_0x4933d4[_0xcbcb('0xf2')]+_0x4933d4[_0xcbcb('0xf3')]+_0x4933d4[_0xcbcb('0xed')]+_0x4933d4[_0xcbcb('0xf4')]>=_0x59bbd8[_0xcbcb('0xf5')]){_0x576616[_0xcbcb('0xf6')](_0x4933d4,_0x78442b,_0x29c719,_0xcbcb('0xf7'));}else{if(_0x4933d4[_0xcbcb('0xed')]>=_0x59bbd8['dialMachineMaxRetry']){_0x576616[_0xcbcb('0xf8')](_0x4933d4,_0x78442b,_0x29c719,'reason\x2019\x20machine....');}else{_0x576616[_0xcbcb('0xc1')]({'active':![],'countmachineretry':_0x4933d4['countmachineretry'],'scheduledat':moment()[_0xcbcb('0xf9')](_0x59bbd8[_0xcbcb('0xfa')],_0xcbcb('0xfb'))['format'](_0xcbcb('0xfc')),'ContactId':_0x4933d4[_0xcbcb('0xd2')],'ListId':_0x4933d4[_0xcbcb('0xd3')],'VoiceQueueId':_0x4933d4[_0xcbcb('0xd5')]||undefined,'CampaignId':_0x4933d4['CampaignId']||undefined})[_0xcbcb('0xba')](loggerCatch('[rescheduleContact][Machine]'));_0x78442b({'reschedule':0x1});}}});}if(_0x40c1dd['type']===_0xcbcb('0x7b')&&this['campaigns'][_0x40c1dd[_0xcbcb('0xb5')]]['dialAMDActive']&&_0x40b2d1[_0xcbcb('0xe9')]==='HANGUP'){delete this['uniqueId'][_0x40b2d1[_0xcbcb('0xde')]];this[_0xcbcb('0xb4')](this[_0xcbcb('0x27')][_0x40c1dd[_0xcbcb('0xb5')]]);_0x45b99f=new Hangup(_0x40c1dd,_0x40b2d1);_0x45b99f[_0xcbcb('0xa7')]=0x12;_0x45b99f['statedesc']='HangupInAMD';_0x45b99f['membername']='AMD';this[_0xcbcb('0xd0')](_0x45b99f,_0xcbcb('0xfd'),'[syncHangupInAMDIvr]');}if(_0x40c1dd['type']===_0xcbcb('0x7b')&&this[_0xcbcb('0x27')][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0xe3')]&&_0x40b2d1['value']===_0xcbcb('0xea')){var _0x576616=this;return new BPromise(function(_0x8f8ffd,_0x2b2318){delete _0x576616[_0xcbcb('0x2e')][_0x40b2d1['uniqueid']];_0x576616[_0xcbcb('0xb4')](_0x576616[_0xcbcb('0x27')][_0x40c1dd['queue']]);_0x576616[_0xcbcb('0x27')][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0x5f')]+=0x1;_0x576616['campaigns'][_0x40c1dd[_0xcbcb('0xb5')]][_0xcbcb('0xe5')]+=0x1;var _0x106949=_0x576616['campaigns'][_0x40c1dd[_0xcbcb('0xb5')]];var _0xe81f08=new Hangup(_0x40c1dd,_0x40b2d1);_0xe81f08['state']=0x13;_0xe81f08[_0xcbcb('0xa8')]=_0xcbcb('0xeb');_0xe81f08[_0xcbcb('0xec')]=_0xcbcb('0xe6');_0xe81f08['countmachineretry']+=0x1;_0xe81f08[_0xcbcb('0xfe')]+=0x1;_0xe81f08['amd']=!![];_0x576616[_0xcbcb('0xcb')](_0xe81f08)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xff')));if(_0xe81f08[_0xcbcb('0x100')]+_0xe81f08[_0xcbcb('0xef')]+_0xe81f08['countnoanswerretry']+_0xe81f08[_0xcbcb('0xf1')]+_0xe81f08[_0xcbcb('0xf2')]+_0xe81f08[_0xcbcb('0xf3')]+_0xe81f08[_0xcbcb('0xed')]+_0xe81f08[_0xcbcb('0xf4')]>=_0x106949[_0xcbcb('0xf5')]){_0x576616[_0xcbcb('0xf6')](_0xe81f08,_0x8f8ffd,_0x2b2318,'reason19\x20machine....');}else{if(_0xe81f08[_0xcbcb('0xed')]>=_0x106949[_0xcbcb('0x101')]){_0x576616[_0xcbcb('0xf8')](_0xe81f08,_0x8f8ffd,_0x2b2318,'reason\x2019\x20machine....');}else{_0x576616[_0xcbcb('0xc1')]({'active':![],'countmachineretry':_0xe81f08[_0xcbcb('0xed')],'scheduledat':moment()[_0xcbcb('0xf9')](_0x106949[_0xcbcb('0xfa')],_0xcbcb('0xfb'))[_0xcbcb('0x78')](_0xcbcb('0xfc')),'ContactId':_0xe81f08[_0xcbcb('0xd2')],'ListId':_0xe81f08[_0xcbcb('0xd3')],'VoiceQueueId':_0xe81f08[_0xcbcb('0xd5')]||undefined,'CampaignId':_0xe81f08[_0xcbcb('0xd6')]||undefined})[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x102')));_0x8f8ffd({'reschedule':0x1});}}});}}};Dialer[_0xcbcb('0x20')][_0xcbcb('0x39')]=function(_0x2b571e){var _0x1f3812=this[_0xcbcb('0x2e')][_0x2b571e[_0xcbcb('0xde')]];var _0x18851b=this;var _0x2ced8b;if(_0x1f3812&&_0x1f3812[_0xcbcb('0x4d')]===_0xcbcb('0x7b')){delete this[_0xcbcb('0x2e')][_0x2b571e[_0xcbcb('0xde')]];this[_0xcbcb('0xb4')](this['campaigns'][_0x1f3812[_0xcbcb('0xb5')]]);this[_0xcbcb('0x27')][_0x1f3812[_0xcbcb('0xb5')]][_0xcbcb('0x103')]+=0x1;_0x2ced8b=new Hangup(_0x1f3812,_0x2b571e);this[_0xcbcb('0xcb')](_0x2ced8b)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x104')));this[_0xcbcb('0xc9')](_0x2ced8b)[_0xcbcb('0xba')](loggerCatch('[syncHangupIvr]'));}if(_0x1f3812&&_0x1f3812[_0xcbcb('0x4d')]!==_0xcbcb('0x7b')&&isNotNull(this[_0xcbcb('0x26')][_0x1f3812[_0xcbcb('0xb5')]][_0xcbcb('0x105')])){delete this[_0xcbcb('0x2e')][_0x2b571e[_0xcbcb('0xde')]];this[_0xcbcb('0xb4')](this[_0xcbcb('0x26')][_0x1f3812['queue']]);this['voiceQueues'][_0x1f3812[_0xcbcb('0xb5')]][_0xcbcb('0x5f')]+=0x1;this[_0xcbcb('0x26')][_0x1f3812[_0xcbcb('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;_0x2ced8b=new Hangup(_0x1f3812,_0x2b571e);_0x2ced8b['state']=0x10;_0x2ced8b['statedesc']='AnswerAGI';_0x2ced8b['membername']=_0xcbcb('0x106');this[_0xcbcb('0xcb')](_0x2ced8b)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x104')));this[_0xcbcb('0xc9')](_0x2ced8b)[_0xcbcb('0xba')](loggerCatch('[syncHangupIvr]'));}if(_0x1f3812&&_0x1f3812[_0xcbcb('0x4d')]!=='ivr'&&!isNotNull(this[_0xcbcb('0x26')][_0x1f3812['queue']][_0xcbcb('0x105')])){delete this[_0xcbcb('0x2e')][_0x2b571e[_0xcbcb('0xde')]];this[_0xcbcb('0xb4')](this[_0xcbcb('0x26')][_0x1f3812[_0xcbcb('0xb5')]]);this[_0xcbcb('0x26')][_0x1f3812[_0xcbcb('0xb5')]][_0xcbcb('0x68')]+=0x1;_0x2ced8b=new Hangup(_0x1f3812,_0x2b571e);_0x2ced8b['state']=0xc;_0x2ced8b[_0xcbcb('0xa8')]=_0x2b571e[_0xcbcb('0x107')];_0x2ced8b[_0xcbcb('0xec')]=_0xcbcb('0x108');this[_0xcbcb('0xcb')](_0x2ced8b)[_0xcbcb('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xcbcb('0xc9')](_0x2ced8b)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x109')));}};Dialer[_0xcbcb('0x20')][_0xcbcb('0x36')]=function(_0x8eecfe){var _0x3ac557=this['uniqueId'][_0x8eecfe[_0xcbcb('0xde')]];var _0x2d7c52=this;if(this[_0xcbcb('0x26')][_0x8eecfe[_0xcbcb('0xb5')]]){if(_0x3ac557&&_0x3ac557[_0xcbcb('0x4d')]!==_0xcbcb('0x7b')){delete this[_0xcbcb('0x2e')][_0x8eecfe[_0xcbcb('0xde')]];this[_0xcbcb('0x26')][_0x8eecfe[_0xcbcb('0xb5')]][_0xcbcb('0x5f')]+=0x1;var _0x2f127d=new AgentComplete(_0x3ac557,_0x8eecfe);if(_0x8eecfe[_0xcbcb('0x10a')]==='agent'){_0x2f127d[_0xcbcb('0x10b')]=this['voiceQueues'][_0x8eecfe[_0xcbcb('0xb5')]][_0xcbcb('0x10c')]&&this[_0xcbcb('0x26')][_0x8eecfe[_0xcbcb('0xb5')]][_0xcbcb('0x10d')]?moment()[_0xcbcb('0x78')](_0xcbcb('0xfc')):undefined;}this[_0xcbcb('0xcb')](_0x2f127d)['catch'](loggerCatch(_0xcbcb('0x10e')));this[_0xcbcb('0xc9')](_0x2f127d)[_0xcbcb('0xba')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xcbcb('0x10f')]=function(_0x404fb4){if(this[_0xcbcb('0x26')][_0x404fb4['queue']]){if(this['uniqueId'][_0x404fb4[_0xcbcb('0xde')]]&&this['uniqueId'][_0x404fb4[_0xcbcb('0xde')]][_0xcbcb('0x4d')]!==_0xcbcb('0x7b')){this[_0xcbcb('0xb4')](this[_0xcbcb('0x26')][_0x404fb4['queue']]);this['uniqueId'][_0x404fb4['uniqueid']][_0xcbcb('0x110')]=moment()[_0xcbcb('0x78')](_0xcbcb('0xfc'));}}};Dialer['prototype'][_0xcbcb('0x111')]=function(_0x39fd09){this[_0xcbcb('0xcb')](_0x39fd09)[_0xcbcb('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x39fd09)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xcbcb('0x20')]['syncQueueCallerAbandon']=function(_0x175465){var _0x12c1c5=this[_0xcbcb('0x2e')][_0x175465['uniqueid']];var _0x52dffc=this;if(this['voiceQueues'][_0x175465[_0xcbcb('0xb5')]]){if(_0x12c1c5&&_0x12c1c5[_0xcbcb('0x4d')]!==_0xcbcb('0x7b')){delete this[_0xcbcb('0x2e')][_0x175465[_0xcbcb('0xde')]];this[_0xcbcb('0xb4')](this[_0xcbcb('0x26')][_0x175465[_0xcbcb('0xb5')]]);_0x12c1c5['droptime']=moment()[_0xcbcb('0x78')](_0xcbcb('0xfc'));var _0x2a5147=new QueueCallerAbandon(_0x12c1c5,_0x175465);if(getSeconds(_0x12c1c5[_0xcbcb('0x112')],_0x12c1c5[_0xcbcb('0x113')])>=_0x12c1c5['dialQueueTimeout']){this[_0xcbcb('0x26')][_0x175465['queue']][_0xcbcb('0x6c')]+=0x1;this[_0xcbcb('0x26')][_0x175465['queue']][_0xcbcb('0x63')]+=0x1;this['voiceQueues'][_0x175465[_0xcbcb('0xb5')]][_0xcbcb('0x114')]+=0x1;_0x2a5147[_0xcbcb('0xa7')]=0xa;_0x2a5147[_0xcbcb('0xa8')]=_0xcbcb('0x115');_0x2a5147[_0xcbcb('0x116')]=_0xcbcb('0x117');_0x2a5147[_0xcbcb('0x10b')]=this[_0xcbcb('0x26')][_0x175465['queue']]['dialQueueProject2']?moment()[_0xcbcb('0x78')](_0xcbcb('0xfc')):undefined;_0x2a5147[_0xcbcb('0xf2')]+=0x1;_0x2a5147['countglobal']+=0x1;if(_0x2a5147[_0xcbcb('0xf2')]>=this[_0xcbcb('0x26')][_0x175465[_0xcbcb('0xb5')]][_0xcbcb('0x118')]){this[_0xcbcb('0x111')](_0x2a5147);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x2a5147[_0xcbcb('0xf2')],'scheduledat':moment()[_0xcbcb('0xf9')](this['voiceQueues'][_0x175465[_0xcbcb('0xb5')]][_0xcbcb('0x119')],'minutes')[_0xcbcb('0x78')](_0xcbcb('0xfc')),'ContactId':_0x12c1c5[_0xcbcb('0xd2')],'ListId':_0x12c1c5[_0xcbcb('0xd3')],'VoiceQueueId':_0x12c1c5[_0xcbcb('0xd5')]||undefined,'CampaignId':_0x12c1c5['CampaignId']||undefined})['catch'](loggerCatch(_0xcbcb('0x11a')));var _0x3c73c4=new History(_0x2a5147);_0x3c73c4['state']=0xa;_0x3c73c4[_0xcbcb('0xa8')]=_0xcbcb('0x115');_0x3c73c4[_0xcbcb('0xa9')]=moment()['format'](_0xcbcb('0xfc'));_0x3c73c4[_0xcbcb('0x11b')]=_0x3c73c4['starttime'];_0x3c73c4['calleridname']=_0x2a5147[_0xcbcb('0x11c')];_0x3c73c4['calleridnum']=_0x2a5147[_0xcbcb('0x11d')];this[_0xcbcb('0xcb')](_0x3c73c4)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x11e')));}}else{this['voiceQueues'][_0x175465[_0xcbcb('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xcbcb('0x26')][_0x175465[_0xcbcb('0xb5')]][_0xcbcb('0x62')]+=0x1;_0x2a5147[_0xcbcb('0xa7')]=0xb;_0x2a5147['statedesc']=_0xcbcb('0x11f');_0x2a5147[_0xcbcb('0x116')]='CALLEREXIT';_0x2a5147[_0xcbcb('0xf3')]+=0x1;_0x2a5147[_0xcbcb('0xfe')]+=0x1;if(_0x2a5147['countabandonedretry']>=this['voiceQueues'][_0x175465[_0xcbcb('0xb5')]][_0xcbcb('0x120')]){this[_0xcbcb('0x111')](_0x2a5147);}else{this[_0xcbcb('0xc1')]({'active':![],'countabandonedretry':_0x2a5147[_0xcbcb('0xf3')],'scheduledat':moment()['add'](this[_0xcbcb('0x26')][_0x175465[_0xcbcb('0xb5')]][_0xcbcb('0x121')],_0xcbcb('0xfb'))[_0xcbcb('0x78')](_0xcbcb('0xfc')),'ContactId':_0x12c1c5[_0xcbcb('0xd2')],'ListId':_0x12c1c5[_0xcbcb('0xd3')],'VoiceQueueId':_0x12c1c5[_0xcbcb('0xd5')]||undefined,'CampaignId':_0x12c1c5[_0xcbcb('0xd6')]||undefined})['catch'](loggerCatch(_0xcbcb('0x122')));var _0x3c73c4=new History(_0x2a5147);_0x3c73c4[_0xcbcb('0xa7')]=0xb;_0x3c73c4[_0xcbcb('0xa8')]=_0xcbcb('0x11f');_0x3c73c4[_0xcbcb('0xa9')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3c73c4[_0xcbcb('0x11b')]=_0x3c73c4['starttime'];_0x3c73c4[_0xcbcb('0x11c')]=_0x2a5147[_0xcbcb('0x11c')];_0x3c73c4[_0xcbcb('0x11d')]=_0x2a5147[_0xcbcb('0x11d')];this[_0xcbcb('0xcb')](_0x3c73c4)[_0xcbcb('0xba')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xcbcb('0x20')]['syncNewExten']=function(_0x28754d){if(this['actions'][_0x28754d[_0xcbcb('0xde')]]){this[_0xcbcb('0x2c')][_0x28754d[_0xcbcb('0xde')]][_0xcbcb('0xb2')]=_0x28754d[_0xcbcb('0xb2')];}if(this[_0xcbcb('0x2e')][_0x28754d['uniqueid']]){this['uniqueId'][_0x28754d['uniqueid']][_0xcbcb('0xb2')]=_0x28754d[_0xcbcb('0xb2')];}};Dialer['prototype'][_0xcbcb('0x123')]=function(_0x1319dd){if(strategy[this[_0xcbcb('0x26')][this['actions'][_0x1319dd[_0xcbcb('0x124')]]['queue']][_0xcbcb('0x4f')]]===_0xcbcb('0x1f')){if(this[_0xcbcb('0x2c')][_0x1319dd[_0xcbcb('0x124')]]&&_[_0xcbcb('0xaf')](this[_0xcbcb('0x2c')][_0x1319dd[_0xcbcb('0x124')]]['locked'])&&_0x1319dd['status']==='1'&&_0x1319dd['paused']==='0'){if(this[_0xcbcb('0x28')][_0x1319dd[_0xcbcb('0x125')]]){if(!this[_0xcbcb('0x28')][_0x1319dd['stateinterface']][_0xcbcb('0x126')]){this[_0xcbcb('0x28')][_0x1319dd[_0xcbcb('0x125')]][_0xcbcb('0x126')]=!![];this['actions'][_0x1319dd[_0xcbcb('0x124')]][_0xcbcb('0x126')]=!![];this[_0xcbcb('0x2c')][_0x1319dd[_0xcbcb('0x124')]][_0xcbcb('0x125')]=_0x1319dd[_0xcbcb('0x125')];}}}}else if((strategy[this[_0xcbcb('0x26')][this['actions'][_0x1319dd['actionid']]['queue']][_0xcbcb('0x4f')]]||_0xcbcb('0x127'))===_0xcbcb('0x127')){if(this[_0xcbcb('0x2c')][_0x1319dd[_0xcbcb('0x124')]]){if(this[_0xcbcb('0x28')][_0x1319dd[_0xcbcb('0x125')]]){this[_0xcbcb('0x2c')][_0x1319dd[_0xcbcb('0x124')]][_0xcbcb('0x125')]=_0x1319dd[_0xcbcb('0x125')];if(_['isNil'](this['queueBooked'][this[_0xcbcb('0x2c')][_0x1319dd[_0xcbcb('0x124')]]['queue']])){this['queueBooked'][this[_0xcbcb('0x2c')][_0x1319dd[_0xcbcb('0x124')]][_0xcbcb('0xb5')]]=[];}this[_0xcbcb('0x32')][this[_0xcbcb('0x2c')][_0x1319dd[_0xcbcb('0x124')]][_0xcbcb('0xb5')]]['push'](_[_0xcbcb('0x8c')](_['pick'](this['actions'][_0x1319dd['actionid']],[_0xcbcb('0x128'),_0xcbcb('0x125')]),{'status':_0x1319dd['status'],'paused':_0x1319dd['paused']}));}}}};function unlockQueueStatus(_0x4c6a9c,_0x165290){setTimeout(function(){if(_['isUndefined'](_0x4c6a9c[_0xcbcb('0x129')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x165290);}_0x4c6a9c['queueStatusComplete']=!![];loggerBooked[_0xcbcb('0x7e')](_0xcbcb('0x12a'),_0x165290,JSON[_0xcbcb('0x77')](_[_0xcbcb('0xd1')](_0x4c6a9c,['name',_0xcbcb('0x129')])));},0x1f3);}Dialer[_0xcbcb('0x20')][_0xcbcb('0x3f')]=function(_0x3e2b76){var _0xd9129=this;var _0x322145=_0xd9129['voiceQueues'][_0xd9129[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]]['queue']];if(strategy[this[_0xcbcb('0x26')][this['actions'][_0x3e2b76[_0xcbcb('0x124')]]['queue']][_0xcbcb('0x4f')]]===_0xcbcb('0x1f')){if(this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]]&&this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0x125')]){this[_0xcbcb('0x25')]['run'](this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0x128')],this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0x125')])[_0xcbcb('0xba')](function(_0x1b5c98){logger[_0xcbcb('0x96')](_0xcbcb('0x12b'),util['inspect'](_0x1b5c98,{'showHidden':![],'depth':null}));})[_0xcbcb('0x23')](function(){_0xd9129[_0xcbcb('0xb4')](_0xd9129['voiceQueues'][_0xd9129[_0xcbcb('0x2c')][_0x3e2b76['actionid']][_0xcbcb('0xb5')]]);_0xd9129[_0xcbcb('0x28')][_0xd9129[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0x125')]][_0xcbcb('0x126')]=![];delete _0xd9129[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]];unlockQueueStatus(_0x322145);});}else{this[_0xcbcb('0xb4')](this[_0xcbcb('0x26')][this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0xd2')],'ListId':this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]]['ListId'],'VoiceQueueId':this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0xd6')]||undefined})[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x12c')));delete this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]];unlockQueueStatus(_0x322145);}}else if((strategy[this[_0xcbcb('0x26')][this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0xb5')]]['strategy']]||_0xcbcb('0x127'))===_0xcbcb('0x127')){var _0x232073;if(this[_0xcbcb('0x2c')][_0x3e2b76['actionid']]&&!_[_0xcbcb('0x49')](this[_0xcbcb('0x32')][this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0xb5')]])){if(this[_0xcbcb('0x12d')][_0xd9129[_0xcbcb('0x2c')][_0x3e2b76['actionid']]['queue']]){this[_0xcbcb('0x12d')][_0xd9129[_0xcbcb('0x2c')][_0x3e2b76['actionid']][_0xcbcb('0xb5')]]=this[_0xcbcb('0x12d')][this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]]['queue']]?this[_0xcbcb('0x12d')][this[_0xcbcb('0x2c')][_0x3e2b76['actionid']][_0xcbcb('0xb5')]]:this['queueBooked'][this['actions'][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0xb5')]]?this[_0xcbcb('0x32')][this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]][_0xcbcb('0xb5')]][_0xcbcb('0x12e')]||0x0:0x0;}this[_0xcbcb('0x32')][this['actions'][_0x3e2b76[_0xcbcb('0x124')]]['queue']][_0xcbcb('0x12e')]=this['queueBookedRR'][this[_0xcbcb('0x2c')][_0x3e2b76[_0xcbcb('0x124')]]['queue']];for(var _0x8820=0x0;_0x8820=0x0?!![]:![];})[_0xcbcb('0xba')](myreject(_0x27568d)));}}else{_0x4193a0['push'](ami['Action']({'action':'command','command':util[_0xcbcb('0x78')](_0xcbcb('0x143'),_0x49dcaf,!_[_0xcbcb('0x41')](config['timezones'][_0x47e518])?_0x47e518:'')})['then'](function(_0x2df431){return _0x2df431['content'][_0xcbcb('0x145')](_0xcbcb('0x146'))>=0x0?!![]:![];})[_0xcbcb('0xba')](myreject(_0x27568d)));}BPromise[_0xcbcb('0x147')](_0x4193a0)[_0xcbcb('0xb9')](function(_0x285976){var _0x2f8928=_[_0xcbcb('0x148')](_0x285976);if(_0x2f8928){return _0x114c90(_0x2f8928);}else{_0xdf3d8e[_0xcbcb('0x42')]=_0x566a9?_0xcbcb('0x149'):_0xcbcb('0x14a');return _0x27568d(msgResponse(_0xcbcb('0x14b'),_0xcbcb('0x13d'),_0xcbcb('0x14c')+_0x566a9+'\x20'+_0x349441+_0xcbcb('0x14d')+util[_0xcbcb('0x99')](_0x49dcaf,{'showHidden':![],'depth':null})+_0xcbcb('0x14e')+_0x47e518));}})['catch'](function(_0x2134b3){return _0x27568d(msgResponse(_0xcbcb('0x13b'),'Failure',JSON[_0xcbcb('0x77')](_0x2134b3)));});});};Dialer[_0xcbcb('0x20')][_0xcbcb('0x14f')]=function(_0x8fa50f){var _0x11cc28=this;return function(){switch(_0x8fa50f[_0xcbcb('0x150')]){case _0xcbcb('0x151'):freeVariablesPredictive(_0x8fa50f);_0x11cc28[_0xcbcb('0x152')](_0x8fa50f,0x1);break;case _0xcbcb('0x153'):freeVariablesPredictive(_0x8fa50f);_0x11cc28[_0xcbcb('0x152')](_0x8fa50f,_0x8fa50f['dialPowerLevel']);break;case'predictive':_0x11cc28[_0xcbcb('0x154')](_0x8fa50f);break;case _0xcbcb('0xa'):freeVariablesPredictive(_0x8fa50f);_0x11cc28[_0xcbcb('0x152')](_0x8fa50f,0x1);break;default:freeVariablesPredictive(_0x8fa50f);logger[_0xcbcb('0x96')](_0xcbcb('0x155'),_0x8fa50f[_0xcbcb('0x43')],_0xcbcb('0x156'));}};};Dialer[_0xcbcb('0x20')][_0xcbcb('0x157')]=function(_0x3ae4d5){var _0x36d082=this;return function(){_0x36d082[_0xcbcb('0x158')](_0x3ae4d5);};};Dialer[_0xcbcb('0x20')]['syncQueueSummary']=function(_0x1cb812){var _0x2c80e5=this;if(isNotPreview(_0x1cb812[_0xcbcb('0x150')])){if(isVoiceQueueOutbound(_0x1cb812[_0xcbcb('0x4d')])&&isActive(_0x1cb812['dialActive'])){_0x1cb812[_0xcbcb('0x9f')]=!![];BPromise[_0xcbcb('0xb8')]()[_0xcbcb('0xb9')](checkIsLoggedIn(_0x1cb812,_0x1cb812['loggedIn']))['then'](checkIsActive(_0x1cb812,_0x1cb812[_0xcbcb('0x5a')]))[_0xcbcb('0xb9')](checkInterval(_0x1cb812))[_0xcbcb('0xb9')](_0x2c80e5['checkIsTrunkReachable'](_0x1cb812))[_0xcbcb('0xb9')](_0x2c80e5['checkIfTime'](_0x1cb812['dialGlobalInterval'],_0x1cb812[_0xcbcb('0x159')],_0x1cb812['name'],_0x1cb812))[_0xcbcb('0xb9')](_0x2c80e5['checkIfTimeIntervals'](_0x1cb812[_0xcbcb('0x45')],_0x1cb812[_0xcbcb('0x159')],_0x1cb812[_0xcbcb('0x43')],_0x1cb812))['then'](_0x2c80e5[_0xcbcb('0x14f')](_0x1cb812))[_0xcbcb('0xba')](loggerCatchQueueSummary(_0xcbcb('0x15a'),_0x1cb812));}else{notSendMessagesQueue(_0x1cb812);}}else{freeVariablesPredictive(_0x1cb812);}};Dialer[_0xcbcb('0x20')][_0xcbcb('0x137')]=function(){var _0x148dce=this;var _0x26d94c;for(var _0x5c01a5 in this['campaigns']){if(this[_0xcbcb('0x27')]['hasOwnProperty'](_0x5c01a5)){_0x26d94c=this[_0xcbcb('0x27')][_0x5c01a5];if(isCampaignIvr(_0x26d94c[_0xcbcb('0x4d')])&&isActive(_0x26d94c['active'])){_0x26d94c[_0xcbcb('0x9f')]=!![];BPromise[_0xcbcb('0xb8')]()[_0xcbcb('0xb9')](checkIsActive(_0x26d94c,_0x26d94c[_0xcbcb('0x76')]))['then'](checkInterval(_0x26d94c))[_0xcbcb('0xb9')](_0x148dce[_0xcbcb('0x15b')](_0x26d94c))[_0xcbcb('0xb9')](_0x148dce[_0xcbcb('0x13a')](_0x26d94c['dialGlobalInterval'],_0x26d94c[_0xcbcb('0x159')],_0x26d94c[_0xcbcb('0x43')],_0x26d94c))[_0xcbcb('0xb9')](_0x148dce[_0xcbcb('0x15c')](_0x26d94c[_0xcbcb('0x45')],_0x26d94c[_0xcbcb('0x159')],_0x26d94c[_0xcbcb('0x43')],_0x26d94c))[_0xcbcb('0xb9')](_0x148dce[_0xcbcb('0x157')](_0x26d94c))[_0xcbcb('0xba')](loggerCatchQueueSummary('[syncCampaigns]',_0x26d94c));}else{notSendMessagesCampaign(_0x26d94c);}}}};function getCallerIdRandom(_0x4c0e24,_0x12eb6b){var _0x2498b5,_0x2fdd3b,_0x2d5f94;if(_0x12eb6b<=0x0){_0x12eb6b=0x1;}_0x2498b5=new RegExp(_0xcbcb('0x15d')+_0x12eb6b+'}$');_0x2fdd3b=Math['pow'](0xa,_0x12eb6b-0x1);_0x2d5f94=Math['pow'](0xa,_0x12eb6b)-0x1;return util['format']('%s',_[_0xcbcb('0x15e')](_0x4c0e24,_0x2498b5,_['random'](_0x2fdd3b,_0x2d5f94)));}function extractCalleridName(_0x4acc22){var _0x432ce2=_0x4acc22[_0xcbcb('0x15f')](/"(.*?)"/);return _0x432ce2?_0x432ce2[0x1]:_0x4acc22;}function extractCalleridNumber(_0x395091){var _0x36d559=_0x395091['match'](/<(.*?)>/);return _0x36d559?_0x36d559[0x1]:_0x395091;}Dialer['prototype'][_0xcbcb('0x160')]=function(_0x4e9bf5,_0x42939d){var _0x4b7fcb=this;var _0xd77930=uuid['v4']();this[_0xcbcb('0x2c')][_0xd77930]=new Action(_0x4e9bf5,_0x42939d,_0xd77930);return new BPromise(function(_0x3d95e6,_0x57c899){if(_['isUndefined'](_0x4e9bf5)&&_0xcbcb('0x161')!==typeof _0x4e9bf5){return _0x57c899(msgResponse(_0xcbcb('0x162'),'Failure',_0xcbcb('0x163')));}if(_['isUndefined'](_0x42939d[_0xcbcb('0x164')]['phone'])||_0x42939d['Contact'][_0xcbcb('0x165')]===null){return _0x57c899(msgResponse('originate',_0xcbcb('0x13d'),'contact\x20is\x20undefine'));}var _0x21a04f={'XMD-CALLERID':_0x4b7fcb[_0xcbcb('0x2c')][_0xd77930][_0xcbcb('0x166')](),'XMD-AGI':_0x4e9bf5['dialQueueProject']?util[_0xcbcb('0x78')](_0xcbcb('0x167'),ipAgi,_0x4e9bf5[_0xcbcb('0x105')]):_0xcbcb('0x168'),'XMD-AGIAFTER':_0x4e9bf5[_0xcbcb('0x10c')]?util[_0xcbcb('0x78')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4e9bf5[_0xcbcb('0x10c')]):_0xcbcb('0x168'),'XMD-QUEUE':_0x4e9bf5[_0xcbcb('0x4d')]==='outbound'?util[_0xcbcb('0x78')]('\x22%s,%s%s,,,%s\x22',_0x4e9bf5['name'],_0x4e9bf5['dialQueueOptions']||'',_0x4e9bf5['dialAgiAfterHangupAgent']?'c':'',_0x4e9bf5[_0xcbcb('0x169')]||0x3):_0xcbcb('0x168'),'XMD-CONTACTID':_0x42939d[_0xcbcb('0xd2')],'XMD-CDRTYPE':_0xcbcb('0x9'),'CALLERID(all)':_0x4b7fcb[_0xcbcb('0x2c')][_0xd77930][_0xcbcb('0x166')](),'XMD-AMD':_0x4e9bf5[_0xcbcb('0xe3')]?_0xcbcb('0x16a'):_0xcbcb('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4e9bf5[_0xcbcb('0xe3')]){_0x21a04f[_0xcbcb('0x16b')]=_0x4e9bf5[_0xcbcb('0x16c')]||0x9c4;_0x21a04f[_0xcbcb('0x16d')]=_0x4e9bf5[_0xcbcb('0x16e')]||0x5dc;_0x21a04f['XMD-AMDAFTERGREETINGSILENCE']=_0x4e9bf5[_0xcbcb('0x16f')]||0x320;_0x21a04f['XMD-AMDTOTALANALYSISTIME']=_0x4e9bf5[_0xcbcb('0x170')]||0x1388;_0x21a04f[_0xcbcb('0x171')]=_0x4e9bf5[_0xcbcb('0x172')]||0x64;_0x21a04f['XMD-AMDBETWEENWORDSSILENCE']=_0x4e9bf5[_0xcbcb('0x173')]||0x32;_0x21a04f[_0xcbcb('0x174')]=_0x4e9bf5[_0xcbcb('0x175')]||0x3;_0x21a04f['XMD-AMDSILENCETHRESHOLD']=_0x4e9bf5[_0xcbcb('0x176')]||0x100;_0x21a04f[_0xcbcb('0x177')]=_0x4e9bf5[_0xcbcb('0x178')]||0x1388;}if(_0x4e9bf5['type']==='outbound'){_0x21a04f['XMD-VOICEQUEUEID']=_0x42939d[_0xcbcb('0xd5')];}else{_0x21a04f[_0xcbcb('0x179')]=_0x42939d[_0xcbcb('0xd6')];}for(var _0x474499 in _0x42939d['Contact']){if(_0x42939d['Contact'][_0xcbcb('0xae')](_0x474499)){if(isNotNull(_0x42939d[_0xcbcb('0x164')][_0x474499])&&_0x474499!=='id'&&_0x474499!==_0xcbcb('0x17a')&&_0x474499!=='createdAt'&&_0x474499!==_0xcbcb('0x17b')){_0x21a04f[util[_0xcbcb('0x78')](_0xcbcb('0x17c'),_0xcbcb('0x17d'),_[_0xcbcb('0x17e')](_0x474499))]=_0x42939d['Contact'][_0x474499];}}}var _0x1560f4=_0x4b7fcb[_0xcbcb('0xda')](_0x4e9bf5[_0xcbcb('0x75')])?getCallerId(_0x4e9bf5['Trunk'][_0xcbcb('0x17f')],_0x4e9bf5[_0xcbcb('0x5b')],_0x4e9bf5[_0xcbcb('0x180')]>0x0?getCallerIdRandom(_0x4e9bf5[_0xcbcb('0x5c')],_0x4e9bf5[_0xcbcb('0x180')]):_0x4e9bf5[_0xcbcb('0x5c')]):getCallerId(_['isNil'](_0x4e9bf5[_0xcbcb('0x138')])?_0x4e9bf5[_0xcbcb('0x75')][_0xcbcb('0x17f')]:_0x4e9bf5['TrunkBackup']['callerid'],_0x4e9bf5[_0xcbcb('0x5b')],_0x4e9bf5['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4e9bf5['dialOriginateCallerIdNumber'],_0x4e9bf5[_0xcbcb('0x180')]):_0x4e9bf5[_0xcbcb('0x5c')]);if(_0x1560f4){_0x21a04f[_0xcbcb('0x181')]=_0x4b7fcb[_0xcbcb('0x2c')][_0xd77930]['originatecalleridname']=extractCalleridName(_0x1560f4);_0x21a04f[_0xcbcb('0x182')]=_0x4b7fcb[_0xcbcb('0x2c')][_0xd77930][_0xcbcb('0x183')]=extractCalleridNumber(_0x1560f4);}return ami[_0xcbcb('0xb0')]({'actionid':_0xd77930,'action':_0xcbcb('0x162'),'channel':_0x4b7fcb['isTrunkReachable'](_0x4e9bf5[_0xcbcb('0x75')])?util['format'](_0xcbcb('0x184'),_0x4e9bf5['Trunk'][_0xcbcb('0x43')],isNotNull(_0x4e9bf5['dialPrefix'])?_0x4e9bf5['dialPrefix']['trim']()||'':'',_0x4e9bf5[_0xcbcb('0x185')]>0x0?_0x42939d['Contact']['phone']['substring'](_0x4e9bf5['dialCutDigit']):_0x42939d[_0xcbcb('0x164')]['phone']):util[_0xcbcb('0x78')](_0xcbcb('0x184'),_[_0xcbcb('0xaf')](_0x4e9bf5[_0xcbcb('0x138')])?_0x4e9bf5[_0xcbcb('0x75')][_0xcbcb('0x43')]:_0x4e9bf5['TrunkBackup'][_0xcbcb('0x43')],isNotNull(_0x4e9bf5['dialPrefix'])?_0x4e9bf5[_0xcbcb('0x5e')]['trim']()||'':'',_0x4e9bf5[_0xcbcb('0x185')]>0x0?_0x42939d['Contact']['phone']['substring'](_0x4e9bf5[_0xcbcb('0x185')]):_0x42939d[_0xcbcb('0x164')][_0xcbcb('0x165')]),'callerid':_0x1560f4,'Exten':_0xcbcb('0xe2'),'Context':'from-sip','Priority':'1','variable':_0x21a04f,'timeout':(_0x4e9bf5[_0xcbcb('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0xd77930})[_0xcbcb('0xb9')](function(_0x1874ef){return _0x3d95e6(_0x1874ef);})[_0xcbcb('0xba')](function(_0x12e740){_0x4e9bf5[_0xcbcb('0x65')]+=0x1;var _0x3291c9=new History(_0x4b7fcb[_0xcbcb('0x2c')][_0xd77930]);logger[_0xcbcb('0x96')](util[_0xcbcb('0x78')](_0xcbcb('0x186'),JSON[_0xcbcb('0x77')](_0x12e740)));_0x3291c9[_0xcbcb('0xa7')]=0xe;_0x3291c9[_0xcbcb('0xa8')]=_0xcbcb('0x187');_0x3291c9[_0xcbcb('0xa9')]=moment()[_0xcbcb('0x78')](_0xcbcb('0xfc'));_0x3291c9[_0xcbcb('0x11b')]=_0x3291c9[_0xcbcb('0xa9')];_0x4b7fcb[_0xcbcb('0xcb')](_0x3291c9)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x188')));_0x4b7fcb[_0xcbcb('0xc9')](_0x3291c9)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x188')))['finally'](function(){delete _0x4b7fcb['actions'][_0xd77930];return _0x57c899(msgResponse(_0xcbcb('0x162'),_0xcbcb('0x189'),_0xcbcb('0x18a')));});});});};Dialer[_0xcbcb('0x20')][_0xcbcb('0x35')]=function(_0x5d408a){var _0x129ee7=this[_0xcbcb('0x2c')][_0x5d408a[_0xcbcb('0x124')]];var _0x54e91d=this;if(_0x129ee7){delete this[_0xcbcb('0x2c')][_0x5d408a[_0xcbcb('0x124')]];_0x129ee7[_0xcbcb('0x113')]=moment()[_0xcbcb('0x78')](_0xcbcb('0xfc'));var _0x52994e=_0x129ee7['type']===_0xcbcb('0x7b')?this[_0xcbcb('0x27')][_0x129ee7['queue']]:this['voiceQueues'][_0x129ee7[_0xcbcb('0x18b')]()];if(!this[_0xcbcb('0xd9')](_0x5d408a[_0xcbcb('0x18c')])){this[_0xcbcb('0xb4')](_0x52994e);return this[_0xcbcb('0x18d')](_0x129ee7,_0x52994e,_0x5d408a)[_0xcbcb('0xb9')](function(_0x48e679){})['catch'](loggerCatch(_0xcbcb('0x18e')));}else{this[_0xcbcb('0x2e')][_0x5d408a[_0xcbcb('0xde')]]=_0x129ee7;}}};Dialer['prototype'][_0xcbcb('0x18f')]=function(_0x42d41e,_0x4515dc,_0x50539c){var _0x4f029b=new History(_0x4515dc);if(_0x4f029b[_0xcbcb('0x100')]+_0x4f029b['countcongestionretry']+_0x4f029b[_0xcbcb('0xf0')]+_0x4f029b[_0xcbcb('0xf1')]+_0x4f029b['countdropretry']+_0x4f029b['countabandonedretry']+_0x4f029b['countmachineretry']+_0x4f029b[_0xcbcb('0xf4')]>=_0x50539c[_0xcbcb('0xf5')]-0x1){return!![];}switch(_0x42d41e){case 0x3:if(_0x4f029b[_0xcbcb('0xf0')]>=_0x50539c[_0xcbcb('0x190')]-0x1){return!![];}else{this[_0xcbcb('0xc1')]({'active':![],'countnoanswerretry':_0x4f029b['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xcbcb('0xf9')](_0x50539c[_0xcbcb('0x191')],_0xcbcb('0xfb'))['format'](_0xcbcb('0xfc')),'ContactId':_0x4f029b[_0xcbcb('0xd2')],'ListId':_0x4f029b['ListId'],'VoiceQueueId':_0x4f029b['VoiceQueueId']||undefined,'CampaignId':_0x4f029b[_0xcbcb('0xd6')]||undefined})['catch'](loggerCatch(_0xcbcb('0x192')));}break;case 0x5:if(_0x4f029b[_0xcbcb('0x100')]>=_0x50539c['dialBusyMaxRetry']-0x1){return!![];}else{this[_0xcbcb('0xc1')]({'active':![],'countbusyretry':_0x4f029b[_0xcbcb('0x100')]+=0x1,'scheduledat':moment()['add'](_0x50539c[_0xcbcb('0x193')],_0xcbcb('0xfb'))[_0xcbcb('0x78')](_0xcbcb('0xfc')),'ContactId':_0x4f029b[_0xcbcb('0xd2')],'ListId':_0x4f029b['ListId'],'VoiceQueueId':_0x4f029b[_0xcbcb('0xd5')]||undefined,'CampaignId':_0x4f029b['CampaignId']||undefined})[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x194')));}break;case 0x8:if(_0x4f029b['countcongestionretry']>=_0x50539c[_0xcbcb('0x195')]-0x1){return!![];}else{this[_0xcbcb('0xc1')]({'active':![],'countcongestionretry':_0x4f029b[_0xcbcb('0xef')]+=0x1,'scheduledat':moment()[_0xcbcb('0xf9')](_0x50539c[_0xcbcb('0x196')],'minutes')[_0xcbcb('0x78')](_0xcbcb('0xfc')),'ContactId':_0x4f029b['ContactId'],'ListId':_0x4f029b[_0xcbcb('0xd3')],'VoiceQueueId':_0x4f029b['VoiceQueueId']||undefined,'CampaignId':_0x4f029b[_0xcbcb('0xd6')]||undefined})[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x197')));}break;case 0x0:if(_0x4f029b[_0xcbcb('0xf1')]>=_0x50539c[_0xcbcb('0x198')]-0x1){return!![];}else{this[_0xcbcb('0xc1')]({'active':![],'countnosuchnumberretry':_0x4f029b['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xcbcb('0xf9')](_0x50539c[_0xcbcb('0x199')],'minutes')[_0xcbcb('0x78')](_0xcbcb('0xfc')),'ContactId':_0x4f029b['ContactId'],'ListId':_0x4f029b[_0xcbcb('0xd3')],'VoiceQueueId':_0x4f029b['VoiceQueueId']||undefined,'CampaignId':_0x4f029b[_0xcbcb('0xd6')]||undefined})[_0xcbcb('0xba')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4f029b['countdropretry']>=_0x50539c[_0xcbcb('0x118')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x4f029b[_0xcbcb('0xf2')]+=0x1,'scheduledat':moment()[_0xcbcb('0xf9')](_0x50539c['dialDropRetryFrequency'],_0xcbcb('0xfb'))[_0xcbcb('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f029b[_0xcbcb('0xd2')],'ListId':_0x4f029b[_0xcbcb('0xd3')],'VoiceQueueId':_0x4f029b['VoiceQueueId']||undefined,'CampaignId':_0x4f029b['CampaignId']||undefined})['catch'](loggerCatch(_0xcbcb('0x11a')));}break;case 0xb:if(_0x4f029b['countabandonedretry']>=_0x50539c['dialAbandonedMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x4f029b[_0xcbcb('0xf3')]+=0x1,'scheduledat':moment()[_0xcbcb('0xf9')](_0x50539c[_0xcbcb('0x121')],_0xcbcb('0xfb'))[_0xcbcb('0x78')](_0xcbcb('0xfc')),'ContactId':_0x4f029b[_0xcbcb('0xd2')],'ListId':_0x4f029b[_0xcbcb('0xd3')],'VoiceQueueId':_0x4f029b[_0xcbcb('0xd5')]||undefined,'CampaignId':_0x4f029b['CampaignId']||undefined})['catch'](loggerCatch(_0xcbcb('0x122')));}break;case 0x13:if(_0x4f029b[_0xcbcb('0xed')]>=_0x50539c['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xcbcb('0xc1')]({'active':![],'countmachineretry':_0x4f029b[_0xcbcb('0xed')]+=0x1,'scheduledat':moment()[_0xcbcb('0xf9')](_0x50539c[_0xcbcb('0xfa')],_0xcbcb('0xfb'))['format'](_0xcbcb('0xfc')),'ContactId':_0x4f029b[_0xcbcb('0xd2')],'ListId':_0x4f029b['ListId'],'VoiceQueueId':_0x4f029b[_0xcbcb('0xd5')]||undefined,'CampaignId':_0x4f029b[_0xcbcb('0xd6')]||undefined})[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x102')));}break;case 0x14:if(_0x4f029b[_0xcbcb('0xf4')]>=_0x50539c[_0xcbcb('0x19a')]-0x1){return!![];}else{this[_0xcbcb('0xc1')]({'active':![],'countagentrejectretry':_0x4f029b[_0xcbcb('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x50539c['dialAgentRejectRetryFrequency'],_0xcbcb('0xfb'))[_0xcbcb('0x78')](_0xcbcb('0xfc')),'ContactId':_0x4f029b[_0xcbcb('0xd2')],'ListId':_0x4f029b['ListId'],'VoiceQueueId':_0x4f029b[_0xcbcb('0xd5')]||undefined,'CampaignId':_0x4f029b[_0xcbcb('0xd6')]||undefined})['catch'](loggerCatch(_0xcbcb('0x19b')));}break;default:return!![];}};Dialer[_0xcbcb('0x20')][_0xcbcb('0x18d')]=function(_0x568b97,_0x319c68,_0x5cb396){var _0x2a7af9=this;var _0x26651b=new History(_0x568b97);return new BPromise(function(_0x3a197d,_0x44c6d4){if(_[_0xcbcb('0x41')](_0x319c68)&&_0xcbcb('0x161')!==typeof _0x319c68){return _0x44c6d4(msgResponse(_0xcbcb('0x19c'),_0xcbcb('0x13d'),_0xcbcb('0x19d')));}if(_[_0xcbcb('0x41')](_0x5cb396)&&_0xcbcb('0x161')!==typeof _0x5cb396){return _0x44c6d4(msgResponse(_0xcbcb('0x19c'),_0xcbcb('0x13d'),'evt\x20is\x20undefine'));}switch(_0x5cb396[_0xcbcb('0x10a')]){case'0':_0x319c68[_0xcbcb('0x64')]+=0x1;_0x26651b['state']=0x0;_0x26651b['statedesc']='NoSuchNumber';_0x26651b[_0xcbcb('0xf1')]+=0x1;_0x26651b[_0xcbcb('0xfe')]+=0x1;ami[_0xcbcb('0x4c')](_0xcbcb('0x19e'),ut[_0xcbcb('0x19f')](_0x568b97,_0xcbcb('0x1a0')));_0x2a7af9[_0xcbcb('0xcb')](_0x26651b)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xff')));if(_0x2a7af9[_0xcbcb('0x18f')](0x0,_0x568b97,_0x319c68)){if(_0x26651b['countnosuchnumberretry']>=_0x319c68['dialNoSuchNumberMaxRetry']){_0x2a7af9[_0xcbcb('0xf8')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1a1'));}else{_0x2a7af9[_0xcbcb('0xf6')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1a1'));}}break;case'3':_0x319c68[_0xcbcb('0x1a2')]+=0x1;_0x26651b['state']=0x3;_0x26651b['statedesc']=_0xcbcb('0x1a3');_0x26651b[_0xcbcb('0xf0')]+=0x1;_0x26651b['countglobal']+=0x1;ami['emit'](_0xcbcb('0x1a4'),ut[_0xcbcb('0x19f')](_0x568b97,_0xcbcb('0x1a5')));_0x2a7af9[_0xcbcb('0xcb')](_0x26651b)[_0xcbcb('0xba')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2a7af9['checkRetriveMax'](0x3,_0x568b97,_0x319c68)){if(_0x26651b[_0xcbcb('0xf0')]>=_0x319c68['dialNoAnswerMaxRetry']){_0x2a7af9[_0xcbcb('0xf8')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1a6'));}else{_0x2a7af9[_0xcbcb('0xf6')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1a6'));}}break;case'5':_0x319c68['outboundBusyCallsDay']+=0x1;_0x26651b[_0xcbcb('0xa7')]=0x5;_0x26651b[_0xcbcb('0xa8')]=_0xcbcb('0x1a7');_0x26651b[_0xcbcb('0x100')]+=0x1;_0x26651b[_0xcbcb('0xfe')]+=0x1;ami[_0xcbcb('0x4c')](_0xcbcb('0x1a8'),ut[_0xcbcb('0x19f')](_0x568b97,_0xcbcb('0x1a9')));_0x2a7af9[_0xcbcb('0xcb')](_0x26651b)[_0xcbcb('0xba')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2a7af9['checkRetriveMax'](0x5,_0x568b97,_0x319c68)){if(_0x26651b[_0xcbcb('0x100')]>=_0x319c68[_0xcbcb('0x1aa')]){_0x2a7af9[_0xcbcb('0xf8')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1ab'));}else{_0x2a7af9[_0xcbcb('0xf6')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1ab'));}}break;case'8':_0x319c68[_0xcbcb('0x1ac')]+=0x1;_0x26651b[_0xcbcb('0xa7')]=0x8;_0x26651b[_0xcbcb('0xa8')]='Congestion';_0x26651b['countcongestionretry']+=0x1;_0x26651b[_0xcbcb('0xfe')]+=0x1;ami[_0xcbcb('0x4c')](_0xcbcb('0x1ad'),ut[_0xcbcb('0x19f')](_0x568b97,_0xcbcb('0x1ae')));_0x2a7af9[_0xcbcb('0xcb')](_0x26651b)[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x1af')));if(_0x2a7af9[_0xcbcb('0x18f')](0x8,_0x568b97,_0x319c68)){if(_0x26651b[_0xcbcb('0xef')]>=_0x319c68['dialCongestionMaxRetry']){_0x2a7af9[_0xcbcb('0xf8')](_0x26651b,_0x3a197d,_0x44c6d4,'reason\x208\x20congestion');}else{_0x2a7af9[_0xcbcb('0xf6')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1b0'));}}break;case'11':_0x319c68[_0xcbcb('0x1b1')]+=0x1;_0x26651b[_0xcbcb('0xa7')]=0xb;_0x26651b[_0xcbcb('0xa8')]=_0xcbcb('0x11f');_0x26651b['countabandonedretry']+=0x1;_0x26651b[_0xcbcb('0xfe')]+=0x1;_0x2a7af9[_0xcbcb('0xcb')](_0x26651b)[_0xcbcb('0xba')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2a7af9['checkRetriveMax'](0xb,_0x568b97,_0x319c68)){if(_0x26651b[_0xcbcb('0xf3')]>=_0x319c68['dialAbandonedMaxRetry']){_0x2a7af9['createStateFinal'](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1b2'));}else{_0x2a7af9[_0xcbcb('0xf6')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1b2'));}}break;case'20':_0x319c68[_0xcbcb('0x67')]+=0x1;_0x26651b[_0xcbcb('0xa7')]=0x14;_0x26651b[_0xcbcb('0xa8')]=_0xcbcb('0x1b3');_0x26651b[_0xcbcb('0xf4')]+=0x1;_0x26651b['countglobal']+=0x1;ami[_0xcbcb('0x4c')]('custom:agentreject',ut[_0xcbcb('0x19f')](_0x568b97,_0xcbcb('0x1b4')));_0x2a7af9[_0xcbcb('0xcb')](_0x26651b)[_0xcbcb('0xba')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2a7af9['checkRetriveMax'](0x14,_0x568b97,_0x319c68)){if(_0x26651b['countagentrejectretry']>=_0x319c68[_0xcbcb('0x19a')]){_0x2a7af9['createStateFinal'](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1b5'));}else{_0x2a7af9[_0xcbcb('0xf6')](_0x26651b,_0x3a197d,_0x44c6d4,_0xcbcb('0x1b5'));}}break;default:_0x319c68[_0xcbcb('0x68')]+=0x1;_0x26651b[_0xcbcb('0xa7')]=0xc;_0x26651b[_0xcbcb('0xa8')]=_0x5cb396[_0xcbcb('0x10a')];_0x2a7af9['createHistory'](_0x26651b)['catch'](loggerCatch(_0xcbcb('0x1b6')));if(_0x2a7af9[_0xcbcb('0x18f')](_0x5cb396['reason'],_0x568b97,_0x319c68)){if(_0x26651b[_0xcbcb('0x100')]+_0x26651b[_0xcbcb('0xef')]+_0x26651b[_0xcbcb('0xf0')]+_0x26651b[_0xcbcb('0xf1')]+_0x26651b['countdropretry']+_0x26651b[_0xcbcb('0xf3')]+_0x26651b[_0xcbcb('0xed')]+_0x26651b[_0xcbcb('0xf4')]>=_0x319c68[_0xcbcb('0xf5')]){_0x2a7af9[_0xcbcb('0xf6')](_0x26651b,_0x3a197d,_0x44c6d4,_0x5cb396[_0xcbcb('0x10a')]);}else{_0x2a7af9[_0xcbcb('0xf8')](_0x26651b,_0x3a197d,_0x44c6d4,_0x5cb396[_0xcbcb('0x10a')]);}}}});};Dialer[_0xcbcb('0x20')][_0xcbcb('0xf6')]=function(_0x2a2c09,_0x7aeb78,_0x3c1429,_0x1418b2){var _0x30fb61=new Final(_0x2a2c09);_0x30fb61[_0xcbcb('0xa7')]=0xf;_0x30fb61['statedesc']='Global';this[_0xcbcb('0xf8')](_0x30fb61,_0x7aeb78,_0x3c1429,_0x1418b2);};Dialer[_0xcbcb('0x20')]['createStateFinal']=function(_0x523c80,_0x1f7e1c,_0x5e0cd8,_0x1b50f8){this[_0xcbcb('0xc9')](_0x523c80)[_0xcbcb('0xb9')](function(_0x4e6784){return _0x1f7e1c(msgResponse(_0xcbcb('0x19c'),_0xcbcb('0x1b7'),_0x1b50f8));})[_0xcbcb('0xba')](function(_0x2a1e76){return _0x5e0cd8(msgResponse(_0xcbcb('0x1b8'),_0xcbcb('0x13d'),_0xcbcb('0x1b9')));});};Dialer[_0xcbcb('0x20')][_0xcbcb('0x154')]=function(_0x25b2e0){var _0x4f5bf2=this;var _0x39f57a=_0x25b2e0[_0xcbcb('0x1ba')]/0x64;var _0x5723d5=_0x25b2e0[_0xcbcb('0x63')]/(_0x25b2e0[_0xcbcb('0x63')]+_0x25b2e0[_0xcbcb('0x5f')]);var _0x58cb67=Math[_0xcbcb('0x1bb')](_0x25b2e0[_0xcbcb('0x1bc')]*(_0x25b2e0[_0xcbcb('0x1bd')]/0x64));var _0x5e442f=Math[_0xcbcb('0x1bb')](_0x25b2e0[_0xcbcb('0x1bc')]*(_0x25b2e0['predictiveIntervalMinThreshold']/0x64));var _0x103442=_0x25b2e0[_0xcbcb('0xa0')]+_0x25b2e0[_0xcbcb('0x54')];var _0x571f5d=Math['floor'](_0x25b2e0['erlangCalls']*_0x25b2e0['erlangAbandonmentRate']*_0x25b2e0[_0xcbcb('0x6e')]*_0x25b2e0['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x25b2e0['startProgressive'])){if(!_[_0xcbcb('0x41')](_0x25b2e0[_0xcbcb('0x2f')])){_0x25b2e0['startPredictive']=undefined;loggerPredictive[_0xcbcb('0x96')](_0xcbcb('0x1be'),_0xcbcb('0x1bf'));}if(!_[_0xcbcb('0x41')](_0x25b2e0['handlePredictive'])){loggerPredictive[_0xcbcb('0x96')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x25b2e0[_0xcbcb('0x90')]);_0x25b2e0[_0xcbcb('0x90')]=undefined;}_0x25b2e0[_0xcbcb('0x30')]=moment()[_0xcbcb('0x78')](_0xcbcb('0xfc'));loggerPredictive[_0xcbcb('0x7e')](_0x25b2e0['name'],_0xcbcb('0x1c0'),_0x25b2e0[_0xcbcb('0x30')]);this[_0xcbcb('0x152')](_0x25b2e0,0x1);}else if(ifInterval(_0x25b2e0[_0xcbcb('0x1c1')],_0x25b2e0[_0xcbcb('0x30')])){this[_0xcbcb('0x152')](_0x25b2e0,0x1);loggerPredictiveCalls[_0xcbcb('0x7e')]('[startMethodPredictive][StartProgressive][Loop]',_0x25b2e0['startProgressive'],_0x25b2e0['name']);_0x25b2e0[_0xcbcb('0x71')]=0x0;_0x25b2e0['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x39f57a<_0x5723d5&&_0x25b2e0[_0xcbcb('0x1c2')]===_0xcbcb('0x1c3')){freeVariablesPredictive(_0x25b2e0);loggerPredictive['info'](_0xcbcb('0x1c4'),_0xcbcb('0x1c5'),_0x5723d5,_0xcbcb('0x30'),_0x25b2e0[_0xcbcb('0x43')]);}else if(_0x571f5d<_0x25b2e0[_0xcbcb('0x114')]&&_0x25b2e0[_0xcbcb('0x1c2')]==='dropRate'){freeVariablesPredictive(_0x25b2e0);loggerPredictive[_0xcbcb('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xcbcb('0x1c6'),_0x571f5d,_0xcbcb('0x1c7'),_0x25b2e0[_0xcbcb('0x114')],'startProgressive',_0x25b2e0['name']);}else if(!ifInterval(_0x25b2e0[_0xcbcb('0x1c1')],_0x25b2e0[_0xcbcb('0x30')])&&_[_0xcbcb('0x41')](_0x25b2e0['startPredictive'])&&!_[_0xcbcb('0x41')](_0x25b2e0[_0xcbcb('0x30')])){_0x25b2e0['startPredictive']=moment()[_0xcbcb('0x78')](_0xcbcb('0xfc'));loggerPredictive['info'](_0x25b2e0[_0xcbcb('0x43')],_0xcbcb('0x1c8'),_0x25b2e0['startPredictive']);this[_0xcbcb('0xbf')](_0x25b2e0[_0xcbcb('0x1c1')])['then'](this[_0xcbcb('0x1c9')](_0x25b2e0))['then'](mergeDataErlangB(_0x25b2e0))[_0xcbcb('0xb9')](this['startMethodPredictive'](_0x25b2e0))['catch'](loggerCatchPredictive(_0xcbcb('0x1ca'),_0x25b2e0));}else if(!ifInterval(_0x25b2e0['dialPredictiveInterval'],_0x25b2e0[_0xcbcb('0x2f')])){_0x25b2e0[_0xcbcb('0x114')]=0x0;_0x25b2e0[_0xcbcb('0x2f')]=moment()[_0xcbcb('0x78')](_0xcbcb('0xfc'));loggerPredictive[_0xcbcb('0x7e')](_0x25b2e0[_0xcbcb('0x43')],_0xcbcb('0x1cb'),_0x25b2e0['startPredictive']);clearInterval(_0x25b2e0[_0xcbcb('0x90')]);_0x25b2e0[_0xcbcb('0x90')]=undefined;this[_0xcbcb('0xbf')](_0x25b2e0['dialPredictiveInterval'])[_0xcbcb('0xb9')](this['getDataPredictive'](_0x25b2e0))[_0xcbcb('0xb9')](mergeDataErlangB(_0x25b2e0))[_0xcbcb('0xb9')](this[_0xcbcb('0x1cc')](_0x25b2e0))['catch'](loggerCatchPredictive(_0xcbcb('0x1cd'),_0x25b2e0));}else if(_0x25b2e0[_0xcbcb('0x1bc')]&&_0x103442<_0x25b2e0[_0xcbcb('0x1bc')]-_0x5e442f){freeVariablesPredictive(_0x25b2e0);loggerPredictive['info'](_0x25b2e0[_0xcbcb('0x43')],_0xcbcb('0x1ce'),_0x103442,')\x20are\x20less\x20than\x20threshold\x20(',_0x25b2e0[_0xcbcb('0x1bc')],'-',_0x5e442f,'=',_0x25b2e0[_0xcbcb('0x1bc')]-_0x5e442f,')');}else if(_0x25b2e0[_0xcbcb('0x1bc')]&&_0x103442>_0x25b2e0['predictiveIntervalAvailable']+_0x58cb67){freeVariablesPredictive(_0x25b2e0);loggerPredictive[_0xcbcb('0x7e')](_0x25b2e0['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x103442,_0xcbcb('0x1cf'),_0x25b2e0[_0xcbcb('0x1bc')],'+',_0x58cb67,'=',_0x25b2e0[_0xcbcb('0x1bc')]+_0x58cb67,')');}};Dialer[_0xcbcb('0x20')][_0xcbcb('0x1c9')]=function(_0x543001){var _0x5f4f37=this;return function(_0x119a33){return new BPromise(function(_0x2d8d4a,_0x3f79bf){_['merge'](_0x543001,_0x119a33[0x0]);if(checkGetDataPredictive(_0x119a33[0x0])){var _0x2ed244=_0x543001[_0xcbcb('0x1bc')]=_0x543001[_0xcbcb('0x54')]+_0x543001[_0xcbcb('0xa0')];var _0x3a13b0=_0x543001['dialPredictiveInterval']*0x3c;var _0x202dc9=_0x119a33[0x0][_0xcbcb('0x6a')]+_0x119a33[0x0]['predictiveIntervalAvgHoldtime'];var _0x11d472=(_0x119a33[0x0][_0xcbcb('0x69')]+_0x119a33[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x119a33[0x0][_0xcbcb('0x6b')])/_0x119a33[0x0][_0xcbcb('0x6f')];_0x543001['predictiveIntervalHitRate']=_0x11d472>0x0?_0x11d472:0x1;switch(_0x543001[_0xcbcb('0x1c2')]){case'dropRate':var _0x3f75df=_0x543001[_0xcbcb('0x1ba')]/0x64;return _0x5f4f37['abandonmentRate'](_0x2ed244,_0x3a13b0,_0x202dc9,_0x11d472,_0x3f75df)[_0xcbcb('0xb9')](function(_0x5a9763){return _0x2d8d4a(_0x5a9763);});case _0xcbcb('0x1d0'):var _0x36d7e5=_0x543001[_0xcbcb('0x1ba')]/0x64;return _0x5f4f37[_0xcbcb('0x1d1')](_0x2ed244,_0x3a13b0,_0x202dc9,_0x11d472,_0x36d7e5)[_0xcbcb('0xb9')](function(_0xc75f6e){return _0x2d8d4a(_0xc75f6e);});default:return _0x3f79bf(msgResponse(_0xcbcb('0x1d2'),_0xcbcb('0x13d'),_0xcbcb('0x1d3')));}}else{return _0x3f79bf(msgResponse(_0xcbcb('0x1d2'),_0xcbcb('0x13d'),_0xcbcb('0x1d4')));}});};};Dialer[_0xcbcb('0x20')][_0xcbcb('0x1d5')]=function(_0xdc521d){var _0x48fa9c=this;return function(_0x443f9e){return new BPromise(function(_0xb88f00,_0x337ba6){_[_0xcbcb('0x8c')](_0xdc521d,_0x443f9e[0x0]);if(checkGetDataPredictive(_0x443f9e[0x0])){loggerPredictive[_0xcbcb('0x7e')](JSON['stringify'](_0x443f9e[0x0]));if(_0xdc521d['dialPredictiveOptimization']===_0xcbcb('0x1c3')){return _0x48fa9c[_0xcbcb('0xc8')](_0xdc521d['id'])[_0xcbcb('0xb9')](function(_0x2b4909){var _0x17c3ad=_0xdc521d[_0xcbcb('0x51')]-_0x2b4909[0x0][_0xcbcb('0x1d6')];var _0x3d7cb8=_0xdc521d[_0xcbcb('0x1c1')]*0x3c;var _0x401c7b=_0x443f9e[0x0][_0xcbcb('0x6a')]+_0x443f9e[0x0][_0xcbcb('0x86')];var _0x2b33ba=(_0x443f9e[0x0][_0xcbcb('0x69')]+_0x443f9e[0x0][_0xcbcb('0x6c')]+_0x443f9e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x443f9e[0x0]['predictiveIntervalTotalCalls'];var _0x4c3d34=_0xdc521d[_0xcbcb('0x1ba')]/0x64;_0xdc521d[_0xcbcb('0x1d7')]=_0x2b4909[0x0]['outboundQueuePauses']||0x0;_0xdc521d['predictiveIntervalHitRate']=_0x2b33ba>0x0?_0x2b33ba:0x1;return _0x48fa9c[_0xcbcb('0x1d8')](_0x17c3ad,_0x3d7cb8,_0x401c7b,_0x2b33ba,_0x4c3d34);})[_0xcbcb('0xb9')](function(_0x228926){return _0xb88f00(_0x228926);})['catch'](function(_0x14e3db){return _0x337ba6(msgResponse('[CatchErlangB]',_0xcbcb('0x13d'),JSON[_0xcbcb('0x77')](_0x14e3db)));});}if(_0xdc521d[_0xcbcb('0x1c2')]===_0xcbcb('0x1d0')){return _0x48fa9c[_0xcbcb('0xc8')](_0xdc521d['id'])[_0xcbcb('0xb9')](function(_0x12793a){var _0x3dced1=_0xdc521d[_0xcbcb('0x51')]-_0x12793a[0x0][_0xcbcb('0x1d6')];var _0x929de9=_0xdc521d[_0xcbcb('0x1c1')]*0x3c;var _0x14aa75=_0x443f9e[0x0][_0xcbcb('0x6a')]+_0x443f9e[0x0][_0xcbcb('0x86')];var _0x889dd=(_0x443f9e[0x0][_0xcbcb('0x69')]+_0x443f9e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x443f9e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x443f9e[0x0][_0xcbcb('0x6f')];var _0x369231=_0xdc521d['dialPredictiveOptimizationPercentage']/0x64;_0xdc521d[_0xcbcb('0x1d7')]=_0x12793a[0x0][_0xcbcb('0x1d6')]||0x0;_0xdc521d['predictiveIntervalHitRate']=_0x889dd>0x0?_0x889dd:0x1;return _0x48fa9c[_0xcbcb('0x1d1')](_0x3dced1,_0x929de9,_0x14aa75,_0x889dd,_0x369231);})['then'](function(_0x45fa55){return _0xb88f00(_0x45fa55);})[_0xcbcb('0xba')](function(_0x246db3){return _0x337ba6(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x246db3)));});}}else{return _0x337ba6(msgResponse('[getDataPredictive]',_0xcbcb('0x13d'),'check\x20failure'));}});};};Dialer['prototype'][_0xcbcb('0x1cc')]=function(_0x108268){var _0x2938b0=this;return function(){var _0x2abc68=0x0;var _0x4491c2=Math[_0xcbcb('0x1d9')](_0x108268['erlangCallToSecond']*0x3e8);if(_0x4491c2>0x0){_0x4491c2=_0x4491c2<0x64?0x64:_0x4491c2;loggerPredictive[_0xcbcb('0x7e')](_0x108268[_0xcbcb('0x43')],_0xcbcb('0x1da'),_0x4491c2,'milliseconds');_0x108268[_0xcbcb('0x90')]=setInterval(function(){_0x2938b0['handlePredictive'](_0x108268);loggerPredictiveCalls[_0xcbcb('0x7e')](_0xcbcb('0x1db'),_0x2abc68+=0x1);},_0x4491c2);}else{loggerPredictive['info'](_0x108268[_0xcbcb('0x43')],_0xcbcb('0x1dc'));}};};Dialer['prototype'][_0xcbcb('0x1dd')]=function(_0x4fc79b,_0x19b32f){var _0x12749e=this;return function(_0x5669e5){if(_[_0xcbcb('0x49')](_0x5669e5)){if(_['isNil'](_0x19b32f[_0xcbcb('0xd4')])||!_0x19b32f[_0xcbcb('0x1de')]){if(_0x4fc79b[_0xcbcb('0x150')]===_0xcbcb('0xa')){_0x4fc79b[_0xcbcb('0x129')]=_[_0xcbcb('0x41')](_0x4fc79b[_0xcbcb('0x129')])?!![]:_0x4fc79b['queueStatusComplete'];var _0x4aec83=uuid['v4']();_0x12749e[_0xcbcb('0x2c')][_0x4aec83]=new Action(_0x4fc79b,_0x19b32f,_0x4aec83);loggerBooked[_0xcbcb('0x7e')](_0xcbcb('0x1df'),_0x4aec83,'queueStatusComplete:\x20',JSON[_0xcbcb('0x77')](_0x4fc79b['queueStatusComplete']),_0xcbcb('0x1e0'),_0x4fc79b[_0xcbcb('0x43')]);if(_0x4fc79b[_0xcbcb('0x129')]){_0x4fc79b['queueStatusComplete']=![];_0x12749e[_0xcbcb('0x32')][_0x12749e[_0xcbcb('0x2c')][_0x4aec83][_0xcbcb('0xb5')]]=[];ami[_0xcbcb('0xb0')]({'actionid':_0x4aec83,'action':_0xcbcb('0x1e1'),'queue':_0x4fc79b[_0xcbcb('0x43')]})[_0xcbcb('0xba')](function(_0x49b6a4){_0x12749e[_0xcbcb('0xb4')](_0x4fc79b);_0x12749e[_0xcbcb('0xc1')]({'active':![],'ContactId':_0x12749e['actions'][_0x4aec83]['ContactId'],'ListId':_0x12749e[_0xcbcb('0x2c')][_0x4aec83]['ListId'],'VoiceQueueId':_0x12749e[_0xcbcb('0x2c')][_0x4aec83][_0xcbcb('0xd5')]||undefined,'CampaignId':_0x12749e[_0xcbcb('0x2c')][_0x4aec83][_0xcbcb('0xd6')]||undefined})[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x1e2')));delete _0x12749e[_0xcbcb('0x2c')][_0x4aec83];});}else{loggerBooked[_0xcbcb('0x7e')](_0xcbcb('0x1e3'),JSON[_0xcbcb('0x77')](_0x4fc79b[_0xcbcb('0x129')]),_0xcbcb('0x1e0'),_0x4fc79b[_0xcbcb('0x43')]);_0x12749e['updateOriginated'](_0x4fc79b);_0x12749e[_0xcbcb('0xc1')]({'active':![],'ContactId':_0x12749e['actions'][_0x4aec83][_0xcbcb('0xd2')],'ListId':_0x12749e[_0xcbcb('0x2c')][_0x4aec83][_0xcbcb('0xd3')],'VoiceQueueId':_0x12749e[_0xcbcb('0x2c')][_0x4aec83][_0xcbcb('0xd5')]||undefined,'CampaignId':_0x12749e[_0xcbcb('0x2c')][_0x4aec83][_0xcbcb('0xd6')]||undefined})[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0x1e2')));delete _0x12749e[_0xcbcb('0x2c')][_0x4aec83];}}else{return _0x12749e[_0xcbcb('0x160')](_0x4fc79b,_0x19b32f);}}else{if(getDiff(_0x19b32f[_0xcbcb('0x1e4')])<_0x4fc79b[_0xcbcb('0x1e5')]*0x3c){if(_0x19b32f['Agent']&&!_0x19b32f['Agent'][_0xcbcb('0x1e6')]){_0x12749e['preview'][_0xcbcb('0x1e7')](_0x19b32f['id'])['finally'](function(){_0x12749e[_0xcbcb('0xb4')](_0x4fc79b);});}else{_0x12749e[_0xcbcb('0xc3')]({'active':![]},_0x19b32f['id'],0x1)[_0xcbcb('0x23')](function(){console[_0xcbcb('0x1e8')](_0xcbcb('0x1e9'));_0x12749e['updateOriginated'](_0x4fc79b);});}}else{_0x4fc79b[_0xcbcb('0x66')]+=0x1;_0x12749e[_0xcbcb('0xb4')](_0x4fc79b);if(_0x4fc79b[_0xcbcb('0x1ea')]){_0x12749e['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x19b32f[_0xcbcb('0xd2')],'ListId':_0x19b32f[_0xcbcb('0xd3')],'VoiceQueueId':_0x19b32f[_0xcbcb('0xd5')]||undefined,'CampaignId':_0x19b32f['CampaignId']||undefined})[_0xcbcb('0xba')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x12749e['createHistory'](createObjHistory(_0x4fc79b,_0x19b32f,_0xcbcb('0x1eb'),0x17,_0xcbcb('0x1ec')))[_0xcbcb('0xba')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x12749e[_0xcbcb('0xd0')](createObjHistory(_0x4fc79b,_0x19b32f,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xcbcb('0x1ed'));}}}}else{_0x4fc79b[_0xcbcb('0x1ee')]+=0x1;_0x12749e[_0xcbcb('0xd0')](createObjHistory(_0x4fc79b,_0x19b32f,_0xcbcb('0x1ef'),0xd,_0xcbcb('0x1f0')),_0xcbcb('0x1f1'),_0xcbcb('0x1f2'));throw _0xcbcb('0x1f3');}};};Dialer['prototype'][_0xcbcb('0x158')]=function(_0x2a5804){var _0x33cd95=this;var _0x14caba=[];var _0x16ceda=_0x2a5804['limitCalls']-_0x2a5804[_0xcbcb('0x70')]-_0x2a5804[_0xcbcb('0x1f4')];emitCampaignSummary(_0x2a5804);if(_0x16ceda>0x0){if(_0x16ceda>this['maxNumberOriginate']){_0x16ceda=this[_0xcbcb('0x2a')];}_0x2a5804['temp']+=_0x16ceda;this['getContactDialerIvr'](_0x2a5804['id'],_0x16ceda,_0x2a5804[_0xcbcb('0x1f5')])['then'](function(_0x30f332){_0x2a5804[_0xcbcb('0x1f4')]-=_0x16ceda;_0x2a5804[_0xcbcb('0x1f4')]=_0x2a5804[_0xcbcb('0x1f4')]>0x0?_0x2a5804[_0xcbcb('0x1f4')]:0x0;if(!checkContactEmpty(_0x30f332)){_0x2a5804[_0xcbcb('0x42')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xcbcb('0x1f6')+_0x2a5804[_0xcbcb('0x43')]);}else{_0x2a5804[_0xcbcb('0x70')]+=_0x30f332[_0xcbcb('0x95')];_0x2a5804[_0xcbcb('0x42')]='RUNNING';for(var _0x2e82dc=0x0;_0x2e82dc<_0x30f332[_0xcbcb('0x95')];_0x2e82dc+=0x1){_0x2a5804[_0xcbcb('0x1f7')]+=0x1;if(_[_0xcbcb('0xaf')](_0x30f332[_0x2e82dc])||_[_0xcbcb('0xaf')](_0x30f332[_0x2e82dc][_0xcbcb('0x164')])||_[_0xcbcb('0xaf')](_0x30f332[_0x2e82dc][_0xcbcb('0x164')]['phone'])){_0x33cd95[_0xcbcb('0x1f8')](_0xcbcb('0x1f9'),_0x2a5804,_0x30f332[_0x2e82dc]);}else{_0x33cd95['checkIsBlackListIvr'](_[_0xcbcb('0xd1')](_0x30f332[_0x2e82dc],[_0xcbcb('0xd6'),'Contact.phone']))[_0xcbcb('0xb9')](_0x33cd95['checkContactBlack'](_0x2a5804,_0x30f332[_0x2e82dc]))[_0xcbcb('0xba')](_0x33cd95['loggerHandler'](_0xcbcb('0x1fa'),_0x2a5804));}}}})[_0xcbcb('0xba')](loggerGetContactDialer(_0xcbcb('0x1fb'),_0x2a5804,_0x16ceda));}};Dialer[_0xcbcb('0x20')][_0xcbcb('0x152')]=function(_0x14e8a8,_0x1e6584){var _0x271a9d=this;var _0x410600=[];var _0x5634a4=_0x1e6584>=0x1?_0x1e6584:0x1;var _0x4e8f3b=[];if(_0x14e8a8[_0xcbcb('0x150')]===_0xcbcb('0xa')){_0x5634a4=0x1;}var _0x34512b=Math[_0xcbcb('0x1d9')](_0x14e8a8['available']*_0x5634a4)-_0x14e8a8[_0xcbcb('0x70')]-_0x14e8a8['temp'];emitVoiceQueueSummary(_0x14e8a8);if(_0x14e8a8[_0xcbcb('0x1fc')]>0x0){var _0x1ae45c=_0x14e8a8['dialLimitQueue']-_0x14e8a8['originated']-_0x14e8a8['talking']-_0x14e8a8[_0xcbcb('0x1f4')]-_0x14e8a8[_0xcbcb('0x1fd')];if(_0x34512b>_0x1ae45c){_0x34512b=_0x1ae45c;}}if(_0x34512b>0x0){if(_0x14e8a8[_0xcbcb('0x150')]==='booked'){_0x34512b=0x1;}if(_0x34512b>this[_0xcbcb('0x2a')]){_0x34512b=this[_0xcbcb('0x2a')];}_0x14e8a8[_0xcbcb('0x1f4')]+=_0x34512b;for(var _0x5c22c1 in this['agents']){if(this['agents'][_0xcbcb('0xae')](_0x5c22c1)){if(this[_0xcbcb('0x28')][_0x5c22c1][_0xcbcb('0xa7')]===_0xcbcb('0x1fe')&&this[_0xcbcb('0x28')][_0x5c22c1][_0xcbcb('0xb1')]===_0xcbcb('0xdc')){_0x410600[_0xcbcb('0x1ff')](this[_0xcbcb('0x28')][_0x5c22c1]['id']);}}}this[_0xcbcb('0xc5')](_0x14e8a8['id'],_0x410600,_0x34512b,_0x14e8a8[_0xcbcb('0x1f5')])[_0xcbcb('0xb9')](function(_0x32c14b){_0x14e8a8[_0xcbcb('0x1f4')]-=_0x34512b;_0x14e8a8[_0xcbcb('0x1f4')]=_0x14e8a8[_0xcbcb('0x1f4')]>0x0?_0x14e8a8[_0xcbcb('0x1f4')]:0x0;if(!checkContactEmpty(_0x32c14b)){_0x271a9d[_0xcbcb('0xb7')](_0x14e8a8)[_0xcbcb('0xb9')](sendMessageReschedule(_0x14e8a8))[_0xcbcb('0xba')](loggerCatch(_0xcbcb('0xbb')));}else{_0x14e8a8[_0xcbcb('0x70')]+=_0x32c14b[_0xcbcb('0x95')];_0x14e8a8[_0xcbcb('0x42')]=_0x14e8a8[_0xcbcb('0x150')]===_0xcbcb('0xa')?'ACTIVE':'RUNNING';for(var _0x96f751=0x0;_0x96f751<_0x32c14b[_0xcbcb('0x95')];_0x96f751+=0x1){if(_[_0xcbcb('0xaf')](_0x32c14b[_0x96f751])||_[_0xcbcb('0xaf')](_0x32c14b[_0x96f751][_0xcbcb('0x164')])||_[_0xcbcb('0xaf')](_0x32c14b[_0x96f751][_0xcbcb('0x164')][_0xcbcb('0x165')])){_0x271a9d['emptyContact']('[actionOriginate]\x20',_0x14e8a8,_0x32c14b[_0x96f751]);}else{_0x271a9d[_0xcbcb('0xbc')](_[_0xcbcb('0xd1')](_0x32c14b[_0x96f751],['VoiceQueueId',_0xcbcb('0x200')]))[_0xcbcb('0xb9')](_0x271a9d['checkContactBlack'](_0x14e8a8,_0x32c14b[_0x96f751]))['catch'](_0x271a9d[_0xcbcb('0x201')](_0xcbcb('0x1f9'),_0x14e8a8));}}}})[_0xcbcb('0xba')](loggerGetContactDialer(_0xcbcb('0x202'),_0x14e8a8,_0x34512b));}};Dialer[_0xcbcb('0x20')][_0xcbcb('0x90')]=function(_0x14e584){var _0x39d7e3=this;if(_0x14e584[_0xcbcb('0x1fc')]>0x0){var _0x184e41=_0x14e584[_0xcbcb('0x1fc')]-_0x14e584[_0xcbcb('0x70')]-_0x14e584[_0xcbcb('0x54')];if(_0x184e41>0x0){this['tryOriginatePredictive'](_0x14e584);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0xcbcb('0x203')](_0x14e584);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x9b614a){var _0x5e18ae=this;var _0x9c3d05=[];_0x9b614a[_0xcbcb('0x70')]+=0x1;for(var _0x116005 in this[_0xcbcb('0x28')]){if(this[_0xcbcb('0x28')]['hasOwnProperty'](_0x116005)){if(this[_0xcbcb('0x28')][_0x116005][_0xcbcb('0xa7')]===_0xcbcb('0x1fe')&&this[_0xcbcb('0x28')][_0x116005][_0xcbcb('0xb1')]===_0xcbcb('0xdc')){_0x9c3d05[_0xcbcb('0x1ff')](this[_0xcbcb('0x28')][_0x116005]['id']);}}}this[_0xcbcb('0xc5')](_0x9b614a['id'],_0x9c3d05,0x1,_0x9b614a['dialOrderByScheduledAt'])[_0xcbcb('0xb9')](function(_0x3ac541){if(!checkContactEmpty(_0x3ac541)){checkContactLowerLimitOriginate(_0x9b614a,0x1,0x0);_0x5e18ae[_0xcbcb('0xb7')](_0x9b614a)[_0xcbcb('0xb9')](sendMessageReschedule(_0x9b614a))['catch'](loggerCatch(_0xcbcb('0xbb')));}else{_0x9b614a['message']=_0xcbcb('0x204');if(_[_0xcbcb('0xaf')](_0x3ac541[0x0])||_['isNil'](_0x3ac541[0x0]['Contact'])||_['isNil'](_0x3ac541[0x0]['Contact'][_0xcbcb('0x165')])){_0x5e18ae[_0xcbcb('0x1f8')](_0xcbcb('0x1f9'),_0x9b614a,_0x3ac541[0x0]);}else{_0x5e18ae[_0xcbcb('0xbc')](_[_0xcbcb('0xd1')](_0x3ac541[0x0],[_0xcbcb('0xd5'),_0xcbcb('0x200')]))['then'](_0x5e18ae[_0xcbcb('0x1dd')](_0x9b614a,_0x3ac541[0x0]))[_0xcbcb('0xba')](_0x5e18ae['loggerHandler'](_0xcbcb('0x205'),_0x9b614a));}}})['catch'](loggerGetContactDialer(_0xcbcb('0x206'),_0x9b614a,0x1));emitVoiceQueueSummary(_0x9b614a);};Dialer[_0xcbcb('0x20')]['abandonmentRate']=function(_0x52bcea,_0x2b9abd,_0x5ccad1,_0x138844,_0x38703c,_0x4bb71b){loggerPredictive[_0xcbcb('0x7e')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x207'),_0x52bcea);loggerPredictive['info'](_0xcbcb('0x208'),_0x2b9abd);loggerPredictive['info'](_0xcbcb('0x209'),_0x5ccad1);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x20a'),_0x138844);loggerPredictive[_0xcbcb('0x7e')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38703c);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x84'));return new BPromise(function(_0x1db9df,_0x1d5ad0){if(_0x52bcea<=0x0||isNaN(_0x52bcea)){return _0x1d5ad0(msgResponse(_0xcbcb('0x20b'),_0xcbcb('0x189'),_0xcbcb('0x20c')+_0x52bcea));}if(_0x5ccad1<=0x0||isNaN(_0x5ccad1)){return _0x1d5ad0(msgResponse('[abandonmentRate]',_0xcbcb('0x189'),_0xcbcb('0x20d')+_0x5ccad1));}if(_0x138844<=0x0||isNaN(_0x138844)){return _0x1d5ad0(msgResponse('[abandonmentRate]',_0xcbcb('0x189'),'p\x20=\x20'+_0x138844));}if(_0x2b9abd<=0x0||isNaN(_0x2b9abd)){return _0x1d5ad0(msgResponse(_0xcbcb('0x20b'),_0xcbcb('0x189'),_0xcbcb('0x20e')+_0x2b9abd));}if(_0x38703c<=0x0||isNaN(_0x38703c)){return _0x1d5ad0(msgResponse('[abandonmentRate]',_0xcbcb('0x189'),'Amax\x20=\x20'+_0x38703c));}_0x4bb71b=_0x4bb71b||0x0;var _0x535696=0x1/_0x5ccad1;var _0x43815b=0x0;var _0x45a496=0x0;var _0x30acf3=0x0;var _0x36998a=0x0;for(var _0x267e30=0x0;_0x30acf3<_0x38703c;_0x267e30+=0x1){_0x45a496=_0x267e30/_0x2b9abd;_0x43815b=(_0x138844*_0x45a496+_0x4bb71b)/_0x535696;_0x30acf3=erlangb(_0x43815b,_0x52bcea);_0x36998a=_0x43815b/_0x52bcea*(0x1-erlangb(_0x43815b,_0x52bcea));}return _0x1db9df({'erlangCalls':_0x267e30,'erlangCallToSecond':_0x2b9abd/_0x267e30,'erlangAbandonmentRate':_0x30acf3,'erlangBusyFactor':_0x36998a});});};Dialer[_0xcbcb('0x20')][_0xcbcb('0x1d1')]=function(_0x2c469b,_0x330a09,_0x463e9f,_0x5a6f88,_0x5cb3b5,_0x338f00){loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x20f'));loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x207'),_0x2c469b);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x208'),_0x330a09);loggerPredictive['info'](_0xcbcb('0x209'),_0x463e9f);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x20a'),_0x5a6f88);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x210'),_0x5cb3b5);loggerPredictive[_0xcbcb('0x7e')](_0xcbcb('0x84'));return new BPromise(function(_0x4aa67f,_0x55679f){if(_0x2c469b<=0x0||isNaN(_0x2c469b)){return _0x55679f(msgResponse('[busyFactor]',_0xcbcb('0x189'),_0xcbcb('0x20c')+_0x2c469b));}if(_0x463e9f<=0x0||isNaN(_0x463e9f)){return _0x55679f(msgResponse(_0xcbcb('0x211'),_0xcbcb('0x189'),_0xcbcb('0x20d')+_0x463e9f));}if(_0x5a6f88<=0x0||isNaN(_0x5a6f88)){return _0x55679f(msgResponse(_0xcbcb('0x211'),_0xcbcb('0x189'),'p\x20=\x20'+_0x5a6f88));}if(_0x330a09<=0x0||isNaN(_0x330a09)){return _0x55679f(msgResponse(_0xcbcb('0x211'),'Error','interval\x20=\x20'+_0x330a09));}if(_0x5cb3b5<=0x0||isNaN(_0x5cb3b5)){return _0x55679f(msgResponse(_0xcbcb('0x211'),_0xcbcb('0x189'),_0xcbcb('0x212')+_0x5cb3b5));}_0x338f00=_0x338f00||0x0;var _0x3824d1=0x1/_0x463e9f;var _0x35aa81=0x0;var _0xd07919=0x0;var _0x2e0987=0x0;var _0x3d95d=0x0;for(var _0x3846cb=0x0;_0x3d95d<_0x5cb3b5;_0x3846cb+=0x1){_0xd07919=_0x3846cb/_0x330a09;_0x35aa81=(_0x5a6f88*_0xd07919+_0x338f00)/_0x3824d1;_0x2e0987=erlangb(_0x35aa81,_0x2c469b);_0x3d95d=_0x35aa81/_0x2c469b*(0x1-erlangb(_0x35aa81,_0x2c469b));}return _0x4aa67f({'erlangCalls':_0x3846cb,'erlangCallToSecond':_0x330a09/_0x3846cb,'erlangAbandonmentRate':_0x2e0987,'erlangBusyFactor':_0x3d95d});});};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 8622a40..ce0f435 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 _0x013d=['droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','milliseconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','responsetime'];(function(_0x3c0f17,_0x4c1795){var _0x595c21=function(_0x2b83e2){while(--_0x2b83e2){_0x3c0f17['push'](_0x3c0f17['shift']());}};_0x595c21(++_0x4c1795);}(_0x013d,0x1d9));var _0xd013=function(_0xddf2eb,_0x4bc8ab){_0xddf2eb=_0xddf2eb-0x0;var _0x39948f=_0x013d[_0xddf2eb];return _0x39948f;};'use strict';var util=require(_0xd013('0x0'));var _=require(_0xd013('0x1'));var moment=require('moment');function getSeconds(_0x3b2a3f,_0x5abc01){var _0x61c948=moment(_0x3b2a3f)['milliseconds'](0x0);var _0x1ea98b=moment(_0x5abc01)[_0xd013('0x2')](0x0);return _0x61c948['diff'](_0x1ea98b,'seconds');}function QueueCallerAbandon(_0x10bc1c,_0x2f92d8){this[_0xd013('0x3')]=_0x10bc1c[_0xd013('0x3')];this[_0xd013('0x4')]=_0x10bc1c[_0xd013('0x4')];this[_0xd013('0x5')]=_0x10bc1c['type']===_0xd013('0x6')?_0xd013('0x7'):_0x10bc1c['type'];this[_0xd013('0x8')]=_0x10bc1c[_0xd013('0x8')];this[_0xd013('0x9')]=_0x10bc1c[_0xd013('0x9')];this[_0xd013('0xa')]=_0x10bc1c[_0xd013('0xa')];this[_0xd013('0xb')]=_0x10bc1c['countbusyretry']+_0x10bc1c['countcongestionretry']+_0x10bc1c[_0xd013('0xa')]+_0x10bc1c[_0xd013('0xc')]+_0x10bc1c[_0xd013('0xd')]+_0x10bc1c['countabandonedretry']+_0x10bc1c['countmachineretry']+_0x10bc1c[_0xd013('0xe')];this[_0xd013('0xc')]=_0x10bc1c[_0xd013('0xc')];this[_0xd013('0xd')]=_0x10bc1c['countdropretry'];this[_0xd013('0xf')]=_0x10bc1c[_0xd013('0xf')];this['countmachineretry']=_0x10bc1c[_0xd013('0x10')];this[_0xd013('0xe')]=_0x10bc1c['countagentrejectretry'];this[_0xd013('0x11')]=_0x2f92d8[_0xd013('0x11')];this[_0xd013('0x12')]=_0x10bc1c[_0xd013('0x13')];this['calleridnum']=_0x10bc1c['number'];this['starttime']=_0x10bc1c['starttime'];this[_0xd013('0x14')]=_0x10bc1c['responsetime'];this[_0xd013('0x15')]=_0x10bc1c[_0xd013('0x15')];this[_0xd013('0x16')]=this[_0xd013('0x15')];this[_0xd013('0x17')]=getSeconds(_0x10bc1c[_0xd013('0x14')],_0x10bc1c['starttime']);this[_0xd013('0x18')]=getSeconds(this['droptime'],_0x10bc1c[_0xd013('0x14')]);this['talktime']=0x0;this['queue']=_0x2f92d8[_0xd013('0x7')];this[_0xd013('0x19')]=_0x2f92d8[_0xd013('0x1a')];this[_0xd013('0x1b')]=_0x2f92d8[_0xd013('0x1b')];this[_0xd013('0x1c')]=_0x10bc1c[_0xd013('0x1c')];this[_0xd013('0x1d')]=_0x10bc1c[_0xd013('0x1d')];this[_0xd013('0x1e')]=_0x10bc1c[_0xd013('0x1e')];this['recallme']=_0x10bc1c[_0xd013('0x1f')];this['ContactId']=_0x10bc1c['ContactId'];this[_0xd013('0x20')]=_0x10bc1c['ListId'];this[_0xd013('0x21')]=_0x10bc1c['UserId'];this[_0xd013('0x22')]=_0x10bc1c['VoiceQueueId'];this[_0xd013('0x23')]=_0x10bc1c[_0xd013('0x23')];this[_0xd013('0x24')]=_0x10bc1c[_0xd013('0x24')]||'';this['originatecalleridname']=_0x10bc1c['originatecalleridname']||'';}module[_0xd013('0x25')]=QueueCallerAbandon; \ No newline at end of file +var _0x06ff=['responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','diff','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','starttime'];(function(_0x3f577f,_0x20a9bd){var _0x392a7a=function(_0x353f50){while(--_0x353f50){_0x3f577f['push'](_0x3f577f['shift']());}};_0x392a7a(++_0x20a9bd);}(_0x06ff,0xdd));var _0xf06f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x06ff[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0xf06f('0x0'));var _=require(_0xf06f('0x1'));var moment=require('moment');function getSeconds(_0x362129,_0xc999fa){var _0x19f79c=moment(_0x362129)['milliseconds'](0x0);var _0x338e46=moment(_0xc999fa)['milliseconds'](0x0);return _0x19f79c[_0xf06f('0x2')](_0x338e46,'seconds');}function QueueCallerAbandon(_0x512d66,_0x334ab2){this[_0xf06f('0x3')]=_0x512d66[_0xf06f('0x3')];this['type']=_0x512d66['type'];this['campaigntype']=_0x512d66[_0xf06f('0x4')]===_0xf06f('0x5')?_0xf06f('0x6'):_0x512d66[_0xf06f('0x4')];this[_0xf06f('0x7')]=_0x512d66['countbusyretry'];this['countcongestionretry']=_0x512d66['countcongestionretry'];this[_0xf06f('0x8')]=_0x512d66[_0xf06f('0x8')];this['countglobal']=_0x512d66[_0xf06f('0x7')]+_0x512d66[_0xf06f('0x9')]+_0x512d66[_0xf06f('0x8')]+_0x512d66[_0xf06f('0xa')]+_0x512d66[_0xf06f('0xb')]+_0x512d66[_0xf06f('0xc')]+_0x512d66[_0xf06f('0xd')]+_0x512d66[_0xf06f('0xe')];this[_0xf06f('0xa')]=_0x512d66[_0xf06f('0xa')];this[_0xf06f('0xb')]=_0x512d66[_0xf06f('0xb')];this[_0xf06f('0xc')]=_0x512d66[_0xf06f('0xc')];this[_0xf06f('0xd')]=_0x512d66['countmachineretry'];this[_0xf06f('0xe')]=_0x512d66[_0xf06f('0xe')];this['uniqueid']=_0x334ab2['uniqueid'];this[_0xf06f('0xf')]=_0x512d66['name'];this['calleridnum']=_0x512d66['number'];this[_0xf06f('0x10')]=_0x512d66[_0xf06f('0x10')];this[_0xf06f('0x11')]=_0x512d66['responsetime'];this[_0xf06f('0x12')]=_0x512d66[_0xf06f('0x12')];this['endtime']=this['droptime'];this[_0xf06f('0x13')]=getSeconds(_0x512d66[_0xf06f('0x11')],_0x512d66[_0xf06f('0x10')]);this[_0xf06f('0x14')]=getSeconds(this['droptime'],_0x512d66[_0xf06f('0x11')]);this[_0xf06f('0x15')]=0x0;this[_0xf06f('0x6')]=_0x334ab2[_0xf06f('0x6')];this[_0xf06f('0x16')]=_0x334ab2[_0xf06f('0x17')];this[_0xf06f('0x18')]=_0x334ab2[_0xf06f('0x18')];this[_0xf06f('0x19')]=_0x512d66[_0xf06f('0x19')];this[_0xf06f('0x1a')]=_0x512d66[_0xf06f('0x1a')];this[_0xf06f('0x1b')]=_0x512d66['callbackat'];this['recallme']=_0x512d66['recallme'];this[_0xf06f('0x1c')]=_0x512d66[_0xf06f('0x1c')];this[_0xf06f('0x1d')]=_0x512d66[_0xf06f('0x1d')];this[_0xf06f('0x1e')]=_0x512d66[_0xf06f('0x1e')];this[_0xf06f('0x1f')]=_0x512d66[_0xf06f('0x1f')];this['CampaignId']=_0x512d66['CampaignId'];this['originatecalleridnum']=_0x512d66[_0xf06f('0x20')]||'';this[_0xf06f('0x21')]=_0x512d66[_0xf06f('0x21')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 543dd4d..91c87c0 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 _0xa430=['channel','format','tech','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid'];(function(_0x463757,_0x27d122){var _0x1a9b66=function(_0x2b3419){while(--_0x2b3419){_0x463757['push'](_0x463757['shift']());}};_0x1a9b66(++_0x27d122);}(_0xa430,0x96));var _0x0a43=function(_0x33fda1,_0x4c3dc1){_0x33fda1=_0x33fda1-0x0;var _0x518c42=_0xa430[_0x33fda1];return _0x518c42;};'use strict';var util=require(_0x0a43('0x0'));var _=require(_0x0a43('0x1'));var moment=require(_0x0a43('0x2'));function Action(_0xb46bd9,_0x41f3b8,_0x290f79){this[_0x0a43('0x3')]=_0xb46bd9||undefined;this[_0x0a43('0x4')]=util[_0x0a43('0x5')]('%s/%s/%s',_0x41f3b8[_0x0a43('0x6')],_0x41f3b8['Trunk'][_0x0a43('0x7')],_0x290f79[_0x0a43('0x8')]);this[_0x0a43('0x9')]=_0x41f3b8['localstationid'];this['headerinfo']=_0x41f3b8[_0x0a43('0xa')];this[_0x0a43('0xb')]=_0x290f79[_0x0a43('0xb')];this['AttachmentId']=_0x290f79[_0x0a43('0xc')];}module[_0x0a43('0xd')]=Action; \ No newline at end of file +var _0xef4d=['uniqueid','channel','format','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment'];(function(_0x119b51,_0x12556e){var _0x211481=function(_0x5f41c5){while(--_0x5f41c5){_0x119b51['push'](_0x119b51['shift']());}};_0x211481(++_0x12556e);}(_0xef4d,0xb1));var _0xdef4=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xef4d[_0xaa0309];return _0x5de7ce;};'use strict';var util=require(_0xdef4('0x0'));var _=require(_0xdef4('0x1'));var moment=require(_0xdef4('0x2'));function Action(_0xf1db8b,_0x333e71,_0xcb5aef){this[_0xdef4('0x3')]=_0xf1db8b||undefined;this[_0xdef4('0x4')]=util[_0xdef4('0x5')]('%s/%s/%s',_0x333e71[_0xdef4('0x6')],_0x333e71[_0xdef4('0x7')][_0xdef4('0x8')],_0xcb5aef[_0xdef4('0x9')]);this[_0xdef4('0xa')]=_0x333e71[_0xdef4('0xa')];this[_0xdef4('0xb')]=_0x333e71[_0xdef4('0xb')];this['path']=_0xcb5aef[_0xdef4('0xc')];this['AttachmentId']=_0xcb5aef[_0xdef4('0xd')];}module[_0xdef4('0xe')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ae8fbe6..a47f536 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 _0x27f3=['faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','isValid','Trunk\x20Reachable','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','context','hasOwnProperty','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','\x20receiveFax\x20','merge','pick','response','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','update','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','updateStatus'];(function(_0x10cf4e,_0x3290e9){var _0x238609=function(_0x14a0ba){while(--_0x14a0ba){_0x10cf4e['push'](_0x10cf4e['shift']());}};_0x238609(++_0x3290e9);}(_0x27f3,0x165));var _0x327f=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x27f3[_0x7148a3];return _0x52f31d;};'use strict';var util=require('util');var _=require(_0x327f('0x0'));var BPromise=require('bluebird');var uuid=require(_0x327f('0x1'));var moment=require(_0x327f('0x2'));var path=require(_0x327f('0x3'));var tiff2pdf=require(_0x327f('0x4'));var gs=require(_0x327f('0x5'));var logger=require(_0x327f('0x6'))('fax');var ami=require(_0x327f('0x7'));var rpcDb=require(_0x327f('0x8'));var Channel=require('./channel');var ut=require(_0x327f('0x9'));var Action=require(_0x327f('0xa'));var faxAccount=require(_0x327f('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x2a596c){this['channels']={};this['faxAccounts']=_0x2a596c[_0x327f('0xc')];this[_0x327f('0xd')]=_0x2a596c[_0x327f('0xd')];this[_0x327f('0xe')]={};ami['on'](_0x327f('0xf'),this[_0x327f('0x10')][_0x327f('0x11')](this));ami['on'](_0x327f('0x12'),this[_0x327f('0x13')][_0x327f('0x11')](this));ami['on']('newstate',this[_0x327f('0x14')][_0x327f('0x11')](this));ami['on'](_0x327f('0x15'),this[_0x327f('0x16')]['bind'](this));ami['on'](_0x327f('0x17'),this[_0x327f('0x18')][_0x327f('0x11')](this));ami['on'](_0x327f('0x19'),this[_0x327f('0x1a')][_0x327f('0x11')](this));ami['on'](_0x327f('0x1b'),this['syncHangup'][_0x327f('0x11')](this));ami['on']('originateresponse',this[_0x327f('0x1c')][_0x327f('0x11')](this));}Fax[_0x327f('0x1d')][_0x327f('0x10')]=function(_0x58f2ff){if(_0x58f2ff[_0x327f('0x1e')]==='from-voip-provider'){for(var _0x2bd2e9 in this[_0x327f('0xc')]){if(this[_0x327f('0xc')][_0x327f('0x1f')](_0x2bd2e9)){if(_0x58f2ff['exten']===this['faxAccounts'][_0x2bd2e9][_0x327f('0x20')]){this[_0x327f('0x21')][_0x58f2ff[_0x327f('0x22')]]={};this[_0x327f('0x21')][_0x58f2ff[_0x327f('0x22')]][_0x327f('0x23')]=_0x58f2ff['channel'];this[_0x327f('0x21')][_0x58f2ff[_0x327f('0x22')]]['id']=this[_0x327f('0xc')][_0x2bd2e9]['id'];this['channels'][_0x58f2ff[_0x327f('0x22')]][_0x327f('0x24')]=this[_0x327f('0xc')][_0x2bd2e9]['name'];logger[_0x327f('0x25')](_0x58f2ff[_0x327f('0x22')],_0x327f('0x26'));}}}}if(this['actions'][_0x58f2ff['uniqueid']]){this[_0x327f('0x21')][_0x58f2ff['uniqueid']]={};this['channels'][_0x58f2ff['uniqueid']][_0x327f('0x23')]=_0x58f2ff[_0x327f('0x23')];logger[_0x327f('0x25')](_0x58f2ff[_0x327f('0x22')],'\x20syncNewchannel\x20');}};Fax[_0x327f('0x1d')][_0x327f('0x13')]=function(_0x3e6bb7){if(this[_0x327f('0x21')][_0x3e6bb7[_0x327f('0x22')]]){for(var _0x25f03c in _0x3e6bb7[_0x327f('0x27')]){if(_0x3e6bb7[_0x327f('0x27')][_0x327f('0x1f')](_0x25f03c)){this['channels'][_0x3e6bb7[_0x327f('0x22')]][_0x25f03c]=_0x3e6bb7['value'];}}}};Fax[_0x327f('0x1d')][_0x327f('0x14')]=function(_0x1a1c72){if(this[_0x327f('0x21')][_0x1a1c72[_0x327f('0x22')]]){this[_0x327f('0x21')][_0x1a1c72[_0x327f('0x22')]][_0x327f('0x28')]=_0x1a1c72[_0x327f('0x28')];this[_0x327f('0x21')][_0x1a1c72[_0x327f('0x22')]][_0x327f('0x29')]=_0x1a1c72[_0x327f('0x29')];}};Fax[_0x327f('0x1d')][_0x327f('0x16')]=function(_0x91227b){if(this[_0x327f('0x21')][_0x91227b['uniqueid']]){for(var _0x180261 in _0x91227b[_0x327f('0x27')]){if(_0x91227b['variable'][_0x327f('0x1f')](_0x180261)){this['channels'][_0x91227b[_0x327f('0x22')]][_0x180261]=_0x91227b['value'];}}}};Fax['prototype'][_0x327f('0x18')]=function(_0x26c0de){if(this['channels'][_0x26c0de[_0x327f('0x22')]]){this[_0x327f('0x21')][_0x26c0de[_0x327f('0x22')]]['operation']=_0x26c0de['operation'];this[_0x327f('0x21')][_0x26c0de['uniqueid']][_0x327f('0x2a')]=_0x26c0de[_0x327f('0x2a')];this[_0x327f('0x21')][_0x26c0de[_0x327f('0x22')]]['localstationid']=_0x26c0de[_0x327f('0x20')];this['channels'][_0x26c0de[_0x327f('0x22')]][_0x327f('0x2b')]=_0x26c0de[_0x327f('0x2b')];logger['info'](_0x26c0de[_0x327f('0x22')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x327f('0x1a')]=function(_0x2c501f){var _0x59ffb2=this;if(this[_0x327f('0x21')][_0x2c501f[_0x327f('0x22')]]){var _0x3206f3=this[_0x327f('0x21')][_0x2c501f[_0x327f('0x22')]]['id'];this['channels'][_0x2c501f[_0x327f('0x22')]][_0x327f('0x2c')]=_0x2c501f[_0x327f('0x2c')];this[_0x327f('0x21')][_0x2c501f['uniqueid']][_0x327f('0x2d')]=_0x2c501f[_0x327f('0x2d')];this[_0x327f('0x21')][_0x2c501f[_0x327f('0x22')]][_0x327f('0x20')]=_0x2c501f[_0x327f('0x20')];this[_0x327f('0x21')][_0x2c501f[_0x327f('0x22')]][_0x327f('0x2e')]=_0x2c501f[_0x327f('0x2e')];this[_0x327f('0x21')][_0x2c501f['uniqueid']][_0x327f('0x2f')]=_0x2c501f['transferrate'];this[_0x327f('0x21')][_0x2c501f[_0x327f('0x22')]][_0x327f('0x2b')]=_0x2c501f['filename'];this[_0x327f('0x21')][_0x2c501f[_0x327f('0x22')]][_0x327f('0x30')]=_0x2c501f[_0x327f('0x30')];if(this['channels'][_0x2c501f['uniqueid']][_0x327f('0x2d')]>0x0){tiff2pdf(_0x2c501f[_0x327f('0x2b')],_0x327f('0x31'),function(_0x30052f){logger[_0x327f('0x25')](_0x2c501f[_0x327f('0x22')],'\x20result\x20conversion\x20file\x20',_0x30052f[_0x327f('0x32')]);attachment[_0x327f('0x33')]({'name':path[_0x327f('0x34')](_0x2c501f[_0x327f('0x2b')])['name'],'basename':path[_0x327f('0x34')](_0x2c501f['filename'])['name']+_0x327f('0x35'),'type':_0x327f('0x36')})['then'](function(_0x3ac899){faxAccount[_0x327f('0x37')](_0x3206f3,{'from':_0x2c501f[_0x327f('0x30')],'mapKey':_0x327f('0x38'),'body':path[_0x327f('0x34')](_0x2c501f[_0x327f('0x2b')])[_0x327f('0x24')]+_0x327f('0x35'),'AttachmentId':_0x3ac899['id']})[_0x327f('0x39')](function(_0x5a647d){logger[_0x327f('0x3a')](_0x2c501f[_0x327f('0x22')],_0x327f('0x3b'),JSON['stringify'](_0x5a647d));});})[_0x327f('0x39')](function(_0x2c90eb){logger['error'](_0x2c501f[_0x327f('0x22')],'\x20receiveFax\x20',JSON['stringify'](_0x2c90eb));});});}logger[_0x327f('0x25')](_0x2c501f[_0x327f('0x22')],_0x327f('0x3c'));}};Fax['prototype'][_0x327f('0x1c')]=function(_0x401ef3){if(this[_0x327f('0xe')][_0x401ef3[_0x327f('0x22')]]){_[_0x327f('0x3d')](this[_0x327f('0x21')][_0x401ef3[_0x327f('0x22')]],_[_0x327f('0x3e')](_0x401ef3,[_0x327f('0x3f'),'reason']));}};function updateStatus(_0x242d84){if(_0x242d84['AttachmentId']){faxMessage['update'](_0x242d84['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x327f('0x40')](function(_0x1c1f13){ut[_0x327f('0x41')](_0x327f('0x42'),_0x1c1f13);})['catch'](function(_0x3d2a68){ut['logger'](_0x327f('0x43'),_0x3d2a68);});}else{ut[_0x327f('0x41')](_0x327f('0x44'));}}Fax[_0x327f('0x1d')]['updateStatus']=function(_0xaf171e,_0x549ff8,_0xd6b044){var _0x4681b5=this;var _0x13b9a5={};if(_0x549ff8){_0x13b9a5={'read':_0x549ff8};}else{_0x13b9a5={'failMessage':_0xd6b044};}if(this[_0x327f('0xe')][_0xaf171e]['AttachmentId']){faxMessage[_0x327f('0x45')](this[_0x327f('0xe')][_0xaf171e][_0x327f('0x46')],_0x13b9a5)['then'](function(_0x2d4aac){ut[_0x327f('0x41')](_0x327f('0x47'),_0x2d4aac);})[_0x327f('0x39')](function(_0xdfb74c){ut[_0x327f('0x41')](_0x327f('0x48'),_0xdfb74c);})['finally'](function(){delete _0x4681b5[_0x327f('0x21')][_0xaf171e];delete _0x4681b5['actions'][_0xaf171e];});}else{ut[_0x327f('0x41')](_0x327f('0x49'));delete this[_0x327f('0x21')][_0xaf171e];delete this[_0x327f('0xe')][_0xaf171e];}};Fax['prototype'][_0x327f('0x4a')]=function(_0x50dc65){var _0x127816=this;if(this[_0x327f('0x21')][_0x50dc65[_0x327f('0x22')]]){if(this[_0x327f('0xe')][_0x50dc65[_0x327f('0x22')]]){this[_0x327f('0x21')][_0x50dc65[_0x327f('0x22')]]['id']=this[_0x327f('0xe')][_0x50dc65[_0x327f('0x22')]]['id'];this[_0x327f('0x21')][_0x50dc65[_0x327f('0x22')]][_0x327f('0x24')]=this[_0x327f('0xe')][_0x50dc65[_0x327f('0x22')]]['name'];}logger['info'](_0x50dc65[_0x327f('0x22')],this[_0x327f('0xe')][_0x50dc65['uniqueid']]?_0x327f('0x4b'):_0x327f('0x4c'),JSON[_0x327f('0x4d')](this[_0x327f('0x21')][_0x50dc65[_0x327f('0x22')]]));if(this[_0x327f('0xe')][_0x50dc65[_0x327f('0x22')]]){if(this[_0x327f('0x21')][_0x50dc65['uniqueid']]['faxpages']>0x0&&this[_0x327f('0x21')][_0x50dc65['uniqueid']][_0x327f('0x17')]==='SUCCESS'){this[_0x327f('0x4e')](_0x50dc65[_0x327f('0x22')],!![]);}else{this[_0x327f('0x4e')](_0x50dc65[_0x327f('0x22')],![],this[_0x327f('0x21')][_0x50dc65[_0x327f('0x22')]][_0x327f('0x4f')]?_0x327f('0x50')+this[_0x327f('0x21')][_0x50dc65[_0x327f('0x22')]]['faxstatusstring']:_0x327f('0x51'));}}}};Fax['prototype'][_0x327f('0x52')]=function(_0x2fc9a9){var _0x93058c=this;return new BPromise(function(_0x4aa840,_0x4684a1){_0x93058c[_0x327f('0x53')](_0x2fc9a9,_0x93058c[_0x327f('0xc')][_0x2fc9a9['FaxAccountId']])[_0x327f('0x40')](function(_0x4e91ed){ut[_0x327f('0x41')]('[Fax][execOriginate][success]',_0x4e91ed);_0x4aa840(ut['message']('Fax\x20received'));})[_0x327f('0x39')](function(_0x29ddda){ut[_0x327f('0x41')](_0x327f('0x54'),_0x29ddda);updateStatus(_0x2fc9a9);_0x4684a1(ut[_0x327f('0x32')](_0x327f('0x55')));});});};Fax['prototype'][_0x327f('0x56')]=function(_0x5aa71b){var _0x92e7f8=this;return new BPromise(function(_0x299eda,_0x12cbf0){var _0x1716fe=_0x92e7f8[_0x327f('0x57')](_0x92e7f8['faxAccounts'][_0x5aa71b[_0x327f('0x58')]]['Trunk'],_0x5aa71b);if(_0x1716fe[_0x327f('0x59')]){_0x299eda(ut[_0x327f('0x32')](_0x327f('0x5a')));}else{_0x12cbf0(ut[_0x327f('0x32')](_0x1716fe[_0x327f('0x32')]));}});};function originate(_0x1079df,_0x35629a,_0xa4c8cd){return new BPromise(function(_0x4d8d06,_0x1520bd){if(_0xa4c8cd){var _0x11d651=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x1079df[_0x327f('0x3')])['name'],_0x1079df[_0x327f('0x3')]);gs['execute'](_0x11d651)[_0x327f('0x40')](function(){_0x1079df[_0x327f('0x3')]=util['format'](_0x327f('0x5b'),path[_0x327f('0x34')](_0x1079df['path'])['dir'],path['parse'](_0x1079df[_0x327f('0x3')])[_0x327f('0x24')]);_0x35629a[_0x327f('0x5c')]=_0x1079df[_0x327f('0x3')];ut[_0x327f('0x41')](_0x327f('0x5d'),'');ami[_0x327f('0x5e')](ut['variablesAction'](_0x1079df,_0x35629a))[_0x327f('0x40')](function(_0x259c09){_0x4d8d06(_0x259c09);})[_0x327f('0x39')](function(_0x6bbcc4){_0x1520bd(_0x6bbcc4);});})[_0x327f('0x39')](function(_0x33b1f2){_0x1520bd(_0x33b1f2);});}else{ami['Action'](ut[_0x327f('0x5f')](_0x1079df,_0x35629a))[_0x327f('0x40')](function(_0x3356e6){_0x4d8d06(_0x3356e6);})[_0x327f('0x39')](function(_0x410585){_0x1520bd(_0x410585);});}});}Fax[_0x327f('0x1d')][_0x327f('0x53')]=function(_0x544d9d,_0x340501){var _0x25d68d=this;return new BPromise(function(_0x2832b9,_0x34cbe6){var _0x474515=uuid['v4']();var _0x30bbd2=ut[_0x327f('0x60')](_0x544d9d,_0x340501);_0x25d68d[_0x327f('0xe')][_0x474515]=new Action(_0x474515,_0x340501,_0x544d9d);var _0x43f3c7=_0x25d68d[_0x327f('0xe')][_0x474515];if(path[_0x327f('0x34')](_0x544d9d[_0x327f('0x3')])['ext']===_0x327f('0x35')){originate(_0x43f3c7,_0x30bbd2,!![])[_0x327f('0x40')](function(_0x134713){_0x2832b9(_0x134713);})['catch'](function(_0x29e3c4){_0x34cbe6(_0x29e3c4);});}else{originate(_0x43f3c7,_0x30bbd2,![])[_0x327f('0x40')](function(_0x55dcfd){_0x2832b9(_0x55dcfd);})[_0x327f('0x39')](function(_0x2a3584){_0x34cbe6(_0x2a3584);});}});};Fax[_0x327f('0x1d')][_0x327f('0x61')]=function(_0x5ca3fa){return!_[_0x327f('0x62')](_0x5ca3fa)&&!_[_0x327f('0x62')](_0x5ca3fa[_0x327f('0x24')])&&!_[_0x327f('0x62')](_0x5ca3fa[_0x327f('0x63')])&&_0x5ca3fa[_0x327f('0x63')]&&!_[_0x327f('0x62')](this[_0x327f('0xd')][util[_0x327f('0x64')](_0x327f('0x65'),_0x5ca3fa[_0x327f('0x24')])])&&!_[_0x327f('0x62')](this[_0x327f('0xd')][util['format']('SIP/%s',_0x5ca3fa[_0x327f('0x24')])][_0x327f('0x2a')])&&(this[_0x327f('0xd')][util[_0x327f('0x64')]('SIP/%s',_0x5ca3fa[_0x327f('0x24')])][_0x327f('0x2a')]===_0x327f('0x66')||this[_0x327f('0xd')][util[_0x327f('0x64')](_0x327f('0x65'),_0x5ca3fa[_0x327f('0x24')])][_0x327f('0x2a')]==='unmonitored');};Fax[_0x327f('0x1d')][_0x327f('0x57')]=function(_0x172b93,_0x3cfa4d){if(!this[_0x327f('0x61')](_0x172b93)){ut[_0x327f('0x41')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x327f('0x62')](_0x172b93)?'':_0x172b93['name']+_0x327f('0x67'));return{'isValid':![],'message':_0x327f('0x68')};}if(_['isNil'](_0x3cfa4d[_0x327f('0x38')])){ut[_0x327f('0x41')](_0x327f('0x69'),JSON['stringify'](_0x3cfa4d));return{'isValid':![],'message':_0x327f('0x6a')};}if(_['isNil'](_0x3cfa4d[_0x327f('0x3')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x327f('0x4d')](_0x3cfa4d));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x327f('0x6b')};};module[_0x327f('0x6c')]=Fax; \ No newline at end of file +var _0x8183=['channelstatedesc','value','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','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','path','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','ext','isNil','active','SIP/%s','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','newexten','faxstatus','receivefax','syncReceiveFax','hangup','originateresponse','prototype','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','syncNewState','channelstate'];(function(_0xd135c0,_0x10a2ad){var _0x2f495f=function(_0x5a2947){while(--_0x5a2947){_0xd135c0['push'](_0xd135c0['shift']());}};_0x2f495f(++_0x10a2ad);}(_0x8183,0x12e));var _0x3818=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x8183[_0x456fb1];return _0x4083d6;};'use strict';var util=require(_0x3818('0x0'));var _=require(_0x3818('0x1'));var BPromise=require(_0x3818('0x2'));var uuid=require(_0x3818('0x3'));var moment=require(_0x3818('0x4'));var path=require('path');var tiff2pdf=require(_0x3818('0x5'));var gs=require(_0x3818('0x6'));var logger=require(_0x3818('0x7'))(_0x3818('0x8'));var ami=require(_0x3818('0x9'));var rpcDb=require(_0x3818('0xa'));var Channel=require(_0x3818('0xb'));var ut=require(_0x3818('0xc'));var Action=require(_0x3818('0xd'));var faxAccount=require(_0x3818('0xe'));var attachment=require(_0x3818('0xf'));var faxMessage=require(_0x3818('0x10'));function Fax(_0x15b15d){this['channels']={};this['faxAccounts']=_0x15b15d[_0x3818('0x11')];this[_0x3818('0x12')]=_0x15b15d[_0x3818('0x12')];this[_0x3818('0x13')]={};ami['on'](_0x3818('0x14'),this[_0x3818('0x15')][_0x3818('0x16')](this));ami['on']('varset',this[_0x3818('0x17')][_0x3818('0x16')](this));ami['on'](_0x3818('0x18'),this['syncNewState'][_0x3818('0x16')](this));ami['on'](_0x3818('0x19'),this['syncNewExten'][_0x3818('0x16')](this));ami['on'](_0x3818('0x1a'),this['syncFaxStatus'][_0x3818('0x16')](this));ami['on'](_0x3818('0x1b'),this[_0x3818('0x1c')]['bind'](this));ami['on'](_0x3818('0x1d'),this['syncHangup'][_0x3818('0x16')](this));ami['on'](_0x3818('0x1e'),this['syncOriginateResponse'][_0x3818('0x16')](this));}Fax[_0x3818('0x1f')][_0x3818('0x15')]=function(_0x3278bd){if(_0x3278bd['context']==='from-voip-provider'){for(var _0x266a4d in this['faxAccounts']){if(this[_0x3818('0x11')][_0x3818('0x20')](_0x266a4d)){if(_0x3278bd[_0x3818('0x21')]===this[_0x3818('0x11')][_0x266a4d]['localstationid']){this[_0x3818('0x22')][_0x3278bd[_0x3818('0x23')]]={};this['channels'][_0x3278bd[_0x3818('0x23')]][_0x3818('0x24')]=_0x3278bd[_0x3818('0x24')];this[_0x3818('0x22')][_0x3278bd[_0x3818('0x23')]]['id']=this[_0x3818('0x11')][_0x266a4d]['id'];this[_0x3818('0x22')][_0x3278bd['uniqueid']][_0x3818('0x25')]=this[_0x3818('0x11')][_0x266a4d]['name'];logger[_0x3818('0x26')](_0x3278bd[_0x3818('0x23')],_0x3818('0x27'));}}}}if(this[_0x3818('0x13')][_0x3278bd[_0x3818('0x23')]]){this[_0x3818('0x22')][_0x3278bd[_0x3818('0x23')]]={};this[_0x3818('0x22')][_0x3278bd[_0x3818('0x23')]][_0x3818('0x24')]=_0x3278bd[_0x3818('0x24')];logger['info'](_0x3278bd[_0x3818('0x23')],_0x3818('0x27'));}};Fax[_0x3818('0x1f')]['syncVarSet']=function(_0xaafaf1){if(this[_0x3818('0x22')][_0xaafaf1['uniqueid']]){for(var _0x52b8e5 in _0xaafaf1[_0x3818('0x28')]){if(_0xaafaf1[_0x3818('0x28')][_0x3818('0x20')](_0x52b8e5)){this[_0x3818('0x22')][_0xaafaf1[_0x3818('0x23')]][_0x52b8e5]=_0xaafaf1['value'];}}}};Fax['prototype'][_0x3818('0x29')]=function(_0x540849){if(this[_0x3818('0x22')][_0x540849[_0x3818('0x23')]]){this[_0x3818('0x22')][_0x540849[_0x3818('0x23')]][_0x3818('0x2a')]=_0x540849['channelstate'];this[_0x3818('0x22')][_0x540849[_0x3818('0x23')]]['channelstatedesc']=_0x540849[_0x3818('0x2b')];}};Fax[_0x3818('0x1f')]['syncNewExten']=function(_0x30e59c){if(this[_0x3818('0x22')][_0x30e59c[_0x3818('0x23')]]){for(var _0x17acbe in _0x30e59c[_0x3818('0x28')]){if(_0x30e59c[_0x3818('0x28')][_0x3818('0x20')](_0x17acbe)){this[_0x3818('0x22')][_0x30e59c[_0x3818('0x23')]][_0x17acbe]=_0x30e59c[_0x3818('0x2c')];}}}};Fax[_0x3818('0x1f')]['syncFaxStatus']=function(_0x29b123){if(this[_0x3818('0x22')][_0x29b123['uniqueid']]){this['channels'][_0x29b123['uniqueid']][_0x3818('0x2d')]=_0x29b123['operation'];this[_0x3818('0x22')][_0x29b123[_0x3818('0x23')]][_0x3818('0x2e')]=_0x29b123[_0x3818('0x2e')];this[_0x3818('0x22')][_0x29b123[_0x3818('0x23')]][_0x3818('0x2f')]=_0x29b123[_0x3818('0x2f')];this[_0x3818('0x22')][_0x29b123[_0x3818('0x23')]]['filename']=_0x29b123[_0x3818('0x30')];logger[_0x3818('0x26')](_0x29b123[_0x3818('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x3818('0x1f')]['syncReceiveFax']=function(_0x42d020){var _0x327d2d=this;if(this[_0x3818('0x22')][_0x42d020[_0x3818('0x23')]]){var _0x4de62a=this[_0x3818('0x22')][_0x42d020[_0x3818('0x23')]]['id'];this[_0x3818('0x22')][_0x42d020[_0x3818('0x23')]]['remotestationid']=_0x42d020[_0x3818('0x31')];this[_0x3818('0x22')][_0x42d020[_0x3818('0x23')]][_0x3818('0x32')]=_0x42d020[_0x3818('0x32')];this['channels'][_0x42d020[_0x3818('0x23')]][_0x3818('0x2f')]=_0x42d020['localstationid'];this[_0x3818('0x22')][_0x42d020[_0x3818('0x23')]]['resolution']=_0x42d020[_0x3818('0x33')];this['channels'][_0x42d020[_0x3818('0x23')]][_0x3818('0x34')]=_0x42d020[_0x3818('0x34')];this[_0x3818('0x22')][_0x42d020[_0x3818('0x23')]][_0x3818('0x30')]=_0x42d020[_0x3818('0x30')];this[_0x3818('0x22')][_0x42d020[_0x3818('0x23')]][_0x3818('0x35')]=_0x42d020[_0x3818('0x35')];if(this['channels'][_0x42d020[_0x3818('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x42d020['filename'],_0x3818('0x36'),function(_0x2a13a1){logger[_0x3818('0x26')](_0x42d020[_0x3818('0x23')],_0x3818('0x37'),_0x2a13a1[_0x3818('0x38')]);attachment[_0x3818('0x39')]({'name':path[_0x3818('0x3a')](_0x42d020[_0x3818('0x30')])['name'],'basename':path[_0x3818('0x3a')](_0x42d020[_0x3818('0x30')])['name']+_0x3818('0x3b'),'type':_0x3818('0x3c')})[_0x3818('0x3d')](function(_0x592cee){faxAccount['notify'](_0x4de62a,{'from':_0x42d020[_0x3818('0x35')],'mapKey':_0x3818('0x8'),'body':path[_0x3818('0x3a')](_0x42d020['filename'])[_0x3818('0x25')]+_0x3818('0x3b'),'AttachmentId':_0x592cee['id']})[_0x3818('0x3e')](function(_0x3e6044){logger['error'](_0x42d020[_0x3818('0x23')],_0x3818('0x3f'),JSON[_0x3818('0x40')](_0x3e6044));});})[_0x3818('0x3e')](function(_0x504a53){logger[_0x3818('0x41')](_0x42d020[_0x3818('0x23')],_0x3818('0x42'),JSON[_0x3818('0x40')](_0x504a53));});});}logger[_0x3818('0x26')](_0x42d020[_0x3818('0x23')],_0x3818('0x42'));}};Fax[_0x3818('0x1f')]['syncOriginateResponse']=function(_0x3d05e2){if(this[_0x3818('0x13')][_0x3d05e2[_0x3818('0x23')]]){_['merge'](this[_0x3818('0x22')][_0x3d05e2[_0x3818('0x23')]],_[_0x3818('0x43')](_0x3d05e2,[_0x3818('0x44'),'reason']));}};function updateStatus(_0x435b27){if(_0x435b27[_0x3818('0x45')]){faxMessage[_0x3818('0x46')](_0x435b27['AttachmentId'],{'failMessage':_0x3818('0x47')})['then'](function(_0x493da9){ut[_0x3818('0x48')](_0x3818('0x49'),_0x493da9);})['catch'](function(_0x3d6616){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x3d6616);});}else{ut[_0x3818('0x48')](_0x3818('0x4a'));}}Fax[_0x3818('0x1f')][_0x3818('0x4b')]=function(_0x54da58,_0x10f661,_0x588a84){var _0x2efd9b=this;var _0x4522ff={};if(_0x10f661){_0x4522ff={'read':_0x10f661};}else{_0x4522ff={'failMessage':_0x588a84};}if(this[_0x3818('0x13')][_0x54da58][_0x3818('0x45')]){faxMessage[_0x3818('0x46')](this[_0x3818('0x13')][_0x54da58][_0x3818('0x45')],_0x4522ff)[_0x3818('0x3d')](function(_0x235d02){ut[_0x3818('0x48')]('[Fax][Message][Updated]',_0x235d02);})[_0x3818('0x3e')](function(_0x5517bf){ut['logger'](_0x3818('0x4c'),_0x5517bf);})[_0x3818('0x4d')](function(){delete _0x2efd9b[_0x3818('0x22')][_0x54da58];delete _0x2efd9b[_0x3818('0x13')][_0x54da58];});}else{ut[_0x3818('0x48')](_0x3818('0x4e'));delete this[_0x3818('0x22')][_0x54da58];delete this[_0x3818('0x13')][_0x54da58];}};Fax[_0x3818('0x1f')][_0x3818('0x4f')]=function(_0x4ad095){var _0x4e85ad=this;if(this[_0x3818('0x22')][_0x4ad095[_0x3818('0x23')]]){if(this['actions'][_0x4ad095['uniqueid']]){this[_0x3818('0x22')][_0x4ad095[_0x3818('0x23')]]['id']=this[_0x3818('0x13')][_0x4ad095[_0x3818('0x23')]]['id'];this[_0x3818('0x22')][_0x4ad095[_0x3818('0x23')]][_0x3818('0x25')]=this[_0x3818('0x13')][_0x4ad095[_0x3818('0x23')]][_0x3818('0x25')];}logger[_0x3818('0x26')](_0x4ad095['uniqueid'],this[_0x3818('0x13')][_0x4ad095[_0x3818('0x23')]]?'\x20hangup\x20sendFile\x20':_0x3818('0x50'),JSON[_0x3818('0x40')](this[_0x3818('0x22')][_0x4ad095[_0x3818('0x23')]]));if(this[_0x3818('0x13')][_0x4ad095['uniqueid']]){if(this[_0x3818('0x22')][_0x4ad095[_0x3818('0x23')]][_0x3818('0x51')]>0x0&&this[_0x3818('0x22')][_0x4ad095['uniqueid']][_0x3818('0x1a')]==='SUCCESS'){this[_0x3818('0x4b')](_0x4ad095['uniqueid'],!![]);}else{this[_0x3818('0x4b')](_0x4ad095[_0x3818('0x23')],![],this[_0x3818('0x22')][_0x4ad095[_0x3818('0x23')]][_0x3818('0x52')]?_0x3818('0x53')+this['channels'][_0x4ad095[_0x3818('0x23')]][_0x3818('0x52')]:_0x3818('0x54'));}}}};Fax[_0x3818('0x1f')][_0x3818('0x55')]=function(_0x392050){var _0x4373a3=this;return new BPromise(function(_0x14fb0e,_0x417bee){_0x4373a3[_0x3818('0x56')](_0x392050,_0x4373a3[_0x3818('0x11')][_0x392050[_0x3818('0x57')]])[_0x3818('0x3d')](function(_0x5bfb23){ut[_0x3818('0x48')](_0x3818('0x58'),_0x5bfb23);_0x14fb0e(ut['message'](_0x3818('0x59')));})['catch'](function(_0x2c7e36){ut[_0x3818('0x48')]('[Fax][execOriginate][failure]',_0x2c7e36);updateStatus(_0x392050);_0x417bee(ut['message'](_0x3818('0x5a')));});});};Fax[_0x3818('0x1f')][_0x3818('0x5b')]=function(_0x58bb91){var _0x4e60e6=this;return new BPromise(function(_0x3bf417,_0x34e76c){var _0x5e3994=_0x4e60e6[_0x3818('0x5c')](_0x4e60e6['faxAccounts'][_0x58bb91[_0x3818('0x57')]]['Trunk'],_0x58bb91);if(_0x5e3994['isValid']){_0x3bf417(ut[_0x3818('0x38')](_0x3818('0x5d')));}else{_0x34e76c(ut['message'](_0x5e3994[_0x3818('0x38')]));}});};function originate(_0x14111e,_0x53cb0b,_0x3fbb09){return new BPromise(function(_0x561157,_0x287f9f){if(_0x3fbb09){var _0x2b5f5f=util[_0x3818('0x5e')](_0x3818('0x5f'),path[_0x3818('0x3a')](_0x14111e[_0x3818('0x60')])[_0x3818('0x25')],_0x14111e[_0x3818('0x60')]);gs[_0x3818('0x61')](_0x2b5f5f)[_0x3818('0x3d')](function(){_0x14111e['path']=util[_0x3818('0x5e')](_0x3818('0x62'),path[_0x3818('0x3a')](_0x14111e[_0x3818('0x60')])['dir'],path[_0x3818('0x3a')](_0x14111e['path'])['name']);_0x53cb0b['XMF-PATH']=_0x14111e[_0x3818('0x60')];ut['logger'](_0x3818('0x63'),'');ami['Action'](ut[_0x3818('0x64')](_0x14111e,_0x53cb0b))['then'](function(_0x17c28c){_0x561157(_0x17c28c);})[_0x3818('0x3e')](function(_0x29453e){_0x287f9f(_0x29453e);});})['catch'](function(_0x117122){_0x287f9f(_0x117122);});}else{ami['Action'](ut['variablesAction'](_0x14111e,_0x53cb0b))['then'](function(_0x37e8c0){_0x561157(_0x37e8c0);})[_0x3818('0x3e')](function(_0x63421f){_0x287f9f(_0x63421f);});}});}Fax['prototype'][_0x3818('0x56')]=function(_0x273546,_0x49175e){var _0x3dabfa=this;return new BPromise(function(_0x3658a1,_0x58d5b2){var _0x1ba4fa=uuid['v4']();var _0x2732bf=ut[_0x3818('0x65')](_0x273546,_0x49175e);_0x3dabfa[_0x3818('0x13')][_0x1ba4fa]=new Action(_0x1ba4fa,_0x49175e,_0x273546);var _0xf8ca18=_0x3dabfa[_0x3818('0x13')][_0x1ba4fa];if(path[_0x3818('0x3a')](_0x273546[_0x3818('0x60')])[_0x3818('0x66')]===_0x3818('0x3b')){originate(_0xf8ca18,_0x2732bf,!![])['then'](function(_0x337d68){_0x3658a1(_0x337d68);})['catch'](function(_0x23470f){_0x58d5b2(_0x23470f);});}else{originate(_0xf8ca18,_0x2732bf,![])[_0x3818('0x3d')](function(_0x2838c0){_0x3658a1(_0x2838c0);})['catch'](function(_0x4549e){_0x58d5b2(_0x4549e);});}});};Fax[_0x3818('0x1f')]['isTrunkReachable']=function(_0x5035ae){return!_[_0x3818('0x67')](_0x5035ae)&&!_[_0x3818('0x67')](_0x5035ae['name'])&&!_[_0x3818('0x67')](_0x5035ae[_0x3818('0x68')])&&_0x5035ae[_0x3818('0x68')]&&!_[_0x3818('0x67')](this['trunks'][util[_0x3818('0x5e')](_0x3818('0x69'),_0x5035ae['name'])])&&!_[_0x3818('0x67')](this['trunks'][util[_0x3818('0x5e')](_0x3818('0x69'),_0x5035ae[_0x3818('0x25')])][_0x3818('0x2e')])&&(this['trunks'][util['format'](_0x3818('0x69'),_0x5035ae[_0x3818('0x25')])][_0x3818('0x2e')]==='reachable'||this[_0x3818('0x12')][util[_0x3818('0x5e')](_0x3818('0x69'),_0x5035ae[_0x3818('0x25')])][_0x3818('0x2e')]==='unmonitored');};Fax[_0x3818('0x1f')][_0x3818('0x5c')]=function(_0x3c93c4,_0x1af635){if(!this[_0x3818('0x6a')](_0x3c93c4)){ut[_0x3818('0x48')](_0x3818('0x6b'),_[_0x3818('0x67')](_0x3c93c4)?'':_0x3c93c4[_0x3818('0x25')]+_0x3818('0x6c'));return{'isValid':![],'message':_0x3818('0x6d')};}if(_[_0x3818('0x67')](_0x1af635[_0x3818('0x8')])){ut['logger'](_0x3818('0x6e'),JSON[_0x3818('0x40')](_0x1af635));return{'isValid':![],'message':_0x3818('0x6f')};}if(_[_0x3818('0x67')](_0x1af635[_0x3818('0x60')])){ut['logger'](_0x3818('0x70'),JSON[_0x3818('0x40')](_0x1af635));return{'isValid':![],'message':_0x3818('0x71')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x3818('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index e5ed051..d2c9fd3 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 _0x8e89=['bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8e89,0x83));var _0x98e8=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x8e89[_0x296809];return _0x18c0d3;};'use strict';var util=require(_0x98e8('0x0'));var BPromise=require(_0x98e8('0x1'));var logger=require(_0x98e8('0x2'))(_0x98e8('0x3'));var _=require(_0x98e8('0x4'));var faxAccount=require(_0x98e8('0x5'));function loggerCatch(_0x16e05a){return function(_0x1551dd){logger['error'](_0x16e05a,util[_0x98e8('0x6')](_0x1551dd,{'showHidden':![],'depth':null}));};}exports[_0x98e8('0x7')]=function(_0x1246a5,_0x2b852c){return BPromise[_0x98e8('0x8')]()[_0x98e8('0x9')](faxAccount['notify'](_0x1246a5,_0x2b852c))[_0x98e8('0xa')](loggerCatch(_0x98e8('0xb')));}; \ No newline at end of file +var _0x1154=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util','../../../config/logger','preview'];(function(_0xe60633,_0x4143d1){var _0x264cfd=function(_0x2e6c94){while(--_0x2e6c94){_0xe60633['push'](_0xe60633['shift']());}};_0x264cfd(++_0x4143d1);}(_0x1154,0xce));var _0x4115=function(_0x439b95,_0x76aeb8){_0x439b95=_0x439b95-0x0;var _0x193625=_0x1154[_0x439b95];return _0x193625;};'use strict';var util=require(_0x4115('0x0'));var BPromise=require('bluebird');var logger=require(_0x4115('0x1'))(_0x4115('0x2'));var _=require(_0x4115('0x3'));var faxAccount=require(_0x4115('0x4'));function loggerCatch(_0x1c41c5){return function(_0x121fbf){logger[_0x4115('0x5')](_0x1c41c5,util[_0x4115('0x6')](_0x121fbf,{'showHidden':![],'depth':null}));};}exports[_0x4115('0x7')]=function(_0xa3ab,_0x2718a5){return BPromise[_0x4115('0x8')]()[_0x4115('0x9')](faxAccount[_0x4115('0x7')](_0xa3ab,_0x2718a5))['catch'](loggerCatch(_0x4115('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 9c072f0..bafc8bb 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 _0xc61a=['inspect','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0xc61a,0x86));var _0xac61=function(_0x238472,_0xc88b3e){_0x238472=_0x238472-0x0;var _0x3c523a=_0xc61a[_0x238472];return _0x3c523a;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xac61('0x0'));var exec=require(_0xac61('0x1'))[_0xac61('0x2')];exports['execute']=function(_0x3d0ab0){return new BPromise(function(_0x3be7d6,_0x3860b4){exec(_0x3d0ab0,function(_0x6dd49d,_0x420459,_0x45e32c){logger[_0xac61('0x3')](_0xac61('0x4'),_0x420459);if(_0x6dd49d){logger[_0xac61('0x3')](_0xac61('0x4'),_0xac61('0x5'),util[_0xac61('0x6')](_0x6dd49d,{'showHidden':![],'depth':null}),_0x420459,_0x45e32c);_0x3860b4(_0x6dd49d);}_0x3be7d6(_0x420459);});});}; \ No newline at end of file +var _0x0cd5=['Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','bluebird','exec','execute','info'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0x0cd5,0x113));var _0x50cd=function(_0x2c10fb,_0x380e1b){_0x2c10fb=_0x2c10fb-0x0;var _0x23e4c0=_0x0cd5[_0x2c10fb];return _0x23e4c0;};'use strict';var util=require('util');var logger=require(_0x50cd('0x0'))('fax');var BPromise=require(_0x50cd('0x1'));var exec=require('child_process')[_0x50cd('0x2')];exports[_0x50cd('0x3')]=function(_0x55d168){return new BPromise(function(_0x2f6f0a,_0x37ce7f){exec(_0x55d168,function(_0x273f38,_0x180ba5,_0x20db4e){logger[_0x50cd('0x4')](_0x50cd('0x5'),_0x180ba5);if(_0x273f38){logger[_0x50cd('0x4')](_0x50cd('0x5'),_0x50cd('0x6'),util[_0x50cd('0x7')](_0x273f38,{'showHidden':![],'depth':null}),_0x180ba5,_0x20db4e);_0x37ce7f(_0x273f38);}_0x2f6f0a(_0x180ba5);});});}; \ 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 ba3770a..d2c42f7 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 _0x9bde=['path','uniqueid','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','message','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','localstationid'];(function(_0x19d1de,_0x2c5a5c){var _0x2d9d2b=function(_0x1a3847){while(--_0x1a3847){_0x19d1de['push'](_0x19d1de['shift']());}};_0x2d9d2b(++_0x2c5a5c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1cd307,_0x3e486e){_0x1cd307=_0x1cd307-0x0;var _0xad3f0b=_0x9bde[_0x1cd307];return _0xad3f0b;};'use strict';var util=require('util');var _=require(_0xe9bd('0x0'));var moment=require('moment');var logger=require(_0xe9bd('0x1'))('fax');exports[_0xe9bd('0x2')]=function(_0x3005aa){return{'message':_0x3005aa};};exports[_0xe9bd('0x3')]=function(_0x1c1b34,_0x10822d){logger[_0xe9bd('0x4')](_0x1c1b34,util[_0xe9bd('0x5')](_0x10822d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4763e9,_0x5f18fe){var _0x22a438={'XMF-ECM':_0x5f18fe[_0xe9bd('0x6')],'XMF-HEADERINFO':_0x5f18fe[_0xe9bd('0x7')],'XMF-MINRATE':_0x5f18fe[_0xe9bd('0x8')],'XMF-MAXRATE':_0x5f18fe[_0xe9bd('0x9')],'XMF-MODEM':util[_0xe9bd('0xa')](_0xe9bd('0xb'),_0x5f18fe[_0xe9bd('0xc')]),'XMF-GATEWAY':_0x5f18fe['gateway'],'XMF-FAXDETECT':_0x5f18fe['faxdetect'],'XMF-T38TIMEOUT':_0x5f18fe[_0xe9bd('0xd')],'XMF-LOCALSTATIONID':_0x5f18fe[_0xe9bd('0xe')],'XMF-PATH':_0x4763e9[_0xe9bd('0xf')]};return _0x22a438;};exports['variablesAction']=function(_0x12c96e,_0x9eca50){return{'actionid':_0x12c96e[_0xe9bd('0x10')],'action':_0xe9bd('0x11'),'channel':_0x12c96e['channel'],'Exten':_0xe9bd('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0xe9bd('0xa')](_0xe9bd('0x13'),_0x12c96e[_0xe9bd('0x7')]?_0x12c96e['headerinfo']:'',_0x12c96e['localstationid']),'variable':_0x9eca50,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x12c96e[_0xe9bd('0x10')]};}; \ No newline at end of file +var _0x524a=['gateway','t38timeout','localstationid','uniqueid','xcally-motion-fax','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem'];(function(_0x4bbd93,_0x205605){var _0x669c4=function(_0x12a82f){while(--_0x12a82f){_0x4bbd93['push'](_0x4bbd93['shift']());}};_0x669c4(++_0x205605);}(_0x524a,0xf5));var _0xa524=function(_0x43bd37,_0x5dc6df){_0x43bd37=_0x43bd37-0x0;var _0x33dfa1=_0x524a[_0x43bd37];return _0x33dfa1;};'use strict';var util=require(_0xa524('0x0'));var _=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var logger=require(_0xa524('0x3'))('fax');exports[_0xa524('0x4')]=function(_0x2ef77c){return{'message':_0x2ef77c};};exports[_0xa524('0x5')]=function(_0x56ab08,_0x50ec75){logger[_0xa524('0x6')](_0x56ab08,util[_0xa524('0x7')](_0x50ec75,{'showHidden':![],'depth':null}));};exports[_0xa524('0x8')]=function(_0x5f472f,_0x460738){var _0x56bd0e={'XMF-ECM':_0x460738[_0xa524('0x9')],'XMF-HEADERINFO':_0x460738[_0xa524('0xa')],'XMF-MINRATE':_0x460738['minrate'],'XMF-MAXRATE':_0x460738[_0xa524('0xb')],'XMF-MODEM':util[_0xa524('0xc')](_0xa524('0xd'),_0x460738[_0xa524('0xe')]),'XMF-GATEWAY':_0x460738[_0xa524('0xf')],'XMF-FAXDETECT':_0x460738['faxdetect'],'XMF-T38TIMEOUT':_0x460738[_0xa524('0x10')],'XMF-LOCALSTATIONID':_0x460738[_0xa524('0x11')],'XMF-PATH':_0x5f472f['path']};return _0x56bd0e;};exports['variablesAction']=function(_0x2fc0f9,_0xdbba15){return{'actionid':_0x2fc0f9[_0xa524('0x12')],'action':'originate','channel':_0x2fc0f9['channel'],'Exten':_0xa524('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0xa524('0xc')]('\x22%s\x22\x20<%s>',_0x2fc0f9[_0xa524('0xa')]?_0x2fc0f9['headerinfo']:'',_0x2fc0f9[_0xa524('0x11')]),'variable':_0xdbba15,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fc0f9[_0xa524('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index dd9d59a..6765048 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 _0xdb0d=['initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./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/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','resolve','then','initAgents','getTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports'];(function(_0x1f34f6,_0x41cd51){var _0x4e5bd5=function(_0x3f4f52){while(--_0x3f4f52){_0x1f34f6['push'](_0x1f34f6['shift']());}};_0x4e5bd5(++_0x41cd51);}(_0xdb0d,0x93));var _0xddb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb0d[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0xddb0('0x0'));var server=require(_0xddb0('0x1'));var Realtime=require(_0xddb0('0x2'));var Report=require(_0xddb0('0x3'));var Acw=require(_0xddb0('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xddb0('0x5'));var Preview=require(_0xddb0('0x6'));var Fax=require(_0xddb0('0x7'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xddb0('0x8'));var voiceCallReport=require(_0xddb0('0x9'));var trunk=require(_0xddb0('0xa'));var trigger=require(_0xddb0('0xb'));var template=require(_0xddb0('0xc'));var cmHopperHistory=require(_0xddb0('0xd'));var campaign=require(_0xddb0('0xe'));var voiceExtension=require(_0xddb0('0xf'));var faxAccount=require(_0xddb0('0x10'));var zendesk=require(_0xddb0('0x11'));var salesforce=require(_0xddb0('0x12'));var sugarcrm=require(_0xddb0('0x13'));var freshdesk=require(_0xddb0('0x14'));var desk=require(_0xddb0('0x15'));var zoho=require(_0xddb0('0x16'));var vtiger=require(_0xddb0('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xddb0('0x18'));var dynamics365=require(_0xddb0('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xddb0('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xddb0('0x1b')]()[_0xddb0('0x1c')](user['getAgents']())[_0xddb0('0x1c')](realtime[_0xddb0('0x1d')]())[_0xddb0('0x1c')](user[_0xddb0('0x1e')]())[_0xddb0('0x1c')](realtime['initTelephones']())['then'](trunk[_0xddb0('0x1f')]())[_0xddb0('0x1c')](realtime['initTrunks']())['then'](voiceQueue[_0xddb0('0x20')]())[_0xddb0('0x1c')](realtime['initVoiceQueues']())['then'](trigger[_0xddb0('0x21')]())['then'](realtime[_0xddb0('0x22')]())['then'](template[_0xddb0('0x23')]())[_0xddb0('0x1c')](realtime['initTemplates']())[_0xddb0('0x1c')](zendesk[_0xddb0('0x24')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x25')]())[_0xddb0('0x1c')](salesforce[_0xddb0('0x26')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x27')]())[_0xddb0('0x1c')](sugarcrm[_0xddb0('0x28')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x29')]())[_0xddb0('0x1c')](freshdesk[_0xddb0('0x2a')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x2b')]())['then'](desk[_0xddb0('0x2c')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x2d')]())[_0xddb0('0x1c')](zoho[_0xddb0('0x2e')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x2f')]())[_0xddb0('0x1c')](vtiger['getVtigerAccounts']())[_0xddb0('0x1c')](realtime[_0xddb0('0x30')]())['then'](freshsales[_0xddb0('0x31')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0xddb0('0x32')]())['then'](realtime[_0xddb0('0x33')]())['then'](dynamics365[_0xddb0('0x34')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x35')]())['then'](campaign[_0xddb0('0x36')]())[_0xddb0('0x1c')](realtime['initCampaigns']())['then'](voiceExtension[_0xddb0('0x37')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x38')]())['then'](faxAccount[_0xddb0('0x39')]())['then'](realtime[_0xddb0('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xddb0('0x1b')]()[_0xddb0('0x1c')](voiceQueueReport[_0xddb0('0x3b')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x3c')]())[_0xddb0('0x1c')](cmHopperHistory[_0xddb0('0x3d')]())[_0xddb0('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xddb0('0x3e')]())[_0xddb0('0x1c')](realtime[_0xddb0('0x3f')]())[_0xddb0('0x1c')](voiceCallReport[_0xddb0('0x40')]())['then'](realtime[_0xddb0('0x41')]())['then'](function(_0x273ea7){})[_0xddb0('0x42')](function(_0xc58837){console[_0xddb0('0x43')](_0xc58837);});}function main(){return server[_0xddb0('0x44')](realtime,preview,fax)['then'](function(_0x43d76d){return initRealtime();})[_0xddb0('0x1c')](function(){return initParams();})[_0xddb0('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xddb0('0x42')](function(_0x355d6f){console[_0xddb0('0x43')](_0x355d6f);});}main(); \ No newline at end of file +var _0xcb3a=['getFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','listen','log','bluebird','util','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','initTelephones','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0xcb3a,0x8d));var _0xacb3=function(_0x350f8b,_0x155f52){_0x350f8b=_0x350f8b-0x0;var _0x4f50a6=_0xcb3a[_0x350f8b];return _0x4f50a6;};'use strict';var BPromise=require(_0xacb3('0x0'));var util=require(_0xacb3('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xacb3('0x2'));var Acw=require('./acw');var Trigger=require(_0xacb3('0x3'));var Dialer=require(_0xacb3('0x4'));var Preview=require(_0xacb3('0x5'));var Fax=require(_0xacb3('0x6'));var user=require(_0xacb3('0x7'));var voiceQueue=require(_0xacb3('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xacb3('0x9'));var trunk=require(_0xacb3('0xa'));var trigger=require(_0xacb3('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0xacb3('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xacb3('0xd'));var faxAccount=require(_0xacb3('0xe'));var zendesk=require(_0xacb3('0xf'));var salesforce=require(_0xacb3('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xacb3('0x11'));var vtiger=require(_0xacb3('0x12'));var freshsales=require(_0xacb3('0x13'));var servicenow=require(_0xacb3('0x14'));var dynamics365=require(_0xacb3('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xacb3('0x16')](_0xacb3('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xacb3('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xacb3('0x18')](user[_0xacb3('0x19')]())[_0xacb3('0x18')](realtime[_0xacb3('0x1a')]())[_0xacb3('0x18')](user['getTelephones']())[_0xacb3('0x18')](realtime[_0xacb3('0x1b')]())[_0xacb3('0x18')](trunk['getTrunks']())[_0xacb3('0x18')](realtime[_0xacb3('0x1c')]())['then'](voiceQueue['getVoiceQueues']())[_0xacb3('0x18')](realtime[_0xacb3('0x1d')]())[_0xacb3('0x18')](trigger[_0xacb3('0x1e')]())[_0xacb3('0x18')](realtime[_0xacb3('0x1f')]())['then'](template[_0xacb3('0x20')]())[_0xacb3('0x18')](realtime[_0xacb3('0x21')]())[_0xacb3('0x18')](zendesk[_0xacb3('0x22')]())[_0xacb3('0x18')](realtime[_0xacb3('0x23')]())['then'](salesforce[_0xacb3('0x24')]())['then'](realtime['initSalesforceAccounts']())[_0xacb3('0x18')](sugarcrm[_0xacb3('0x25')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xacb3('0x26')]())['then'](realtime['initFreshdeskAccounts']())['then'](desk[_0xacb3('0x27')]())[_0xacb3('0x18')](realtime[_0xacb3('0x28')]())[_0xacb3('0x18')](zoho[_0xacb3('0x29')]())[_0xacb3('0x18')](realtime[_0xacb3('0x2a')]())['then'](vtiger[_0xacb3('0x2b')]())['then'](realtime[_0xacb3('0x2c')]())[_0xacb3('0x18')](freshsales[_0xacb3('0x2d')]())[_0xacb3('0x18')](realtime['initFreshsalesAccounts']())[_0xacb3('0x18')](servicenow[_0xacb3('0x2e')]())[_0xacb3('0x18')](realtime['initServicenowAccounts']())[_0xacb3('0x18')](dynamics365[_0xacb3('0x2f')]())[_0xacb3('0x18')](realtime['initDynamics365Accounts']())[_0xacb3('0x18')](campaign[_0xacb3('0x30')]())[_0xacb3('0x18')](realtime[_0xacb3('0x31')]())[_0xacb3('0x18')](voiceExtension[_0xacb3('0x32')]())[_0xacb3('0x18')](realtime[_0xacb3('0x33')]())[_0xacb3('0x18')](faxAccount['getFaxAccounts']())[_0xacb3('0x18')](realtime[_0xacb3('0x34')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xacb3('0x35')]()[_0xacb3('0x18')](voiceQueueReport['getVoiceQueueReports']())[_0xacb3('0x18')](realtime[_0xacb3('0x36')]())[_0xacb3('0x18')](cmHopperHistory[_0xacb3('0x37')]())[_0xacb3('0x18')](realtime[_0xacb3('0x38')]())[_0xacb3('0x18')](cmHopperHistory[_0xacb3('0x39')]())[_0xacb3('0x18')](realtime['initCampaignHopperHistory']())[_0xacb3('0x18')](voiceCallReport[_0xacb3('0x3a')]())['then'](realtime['initVoiceCallReports']())[_0xacb3('0x18')](function(_0x2a3a3e){})[_0xacb3('0x3b')](function(_0x1498ab){console['log'](_0x1498ab);});}function main(){return server[_0xacb3('0x3c')](realtime,preview,fax)['then'](function(_0x85f9ac){return initRealtime();})[_0xacb3('0x18')](function(){return initParams();})[_0xacb3('0x18')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xacb3('0x3b')](function(_0xf8276d){console[_0xacb3('0x3d')](_0xf8276d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1086f82..30f1369 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 _0xd949=['voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','state','toLowerCase','not_inuse','talking','statePause','toNumber','format','accountcode','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','fullname','unknown','stateTime','status','address','phone','mobile','interface','online'];(function(_0x4ff0a7,_0x33effc){var _0x4caec0=function(_0x5d4661){while(--_0x5d4661){_0x4ff0a7['push'](_0x4ff0a7['shift']());}};_0x4caec0(++_0x33effc);}(_0xd949,0x1e7));var _0x9d94=function(_0x4fc9aa,_0x36bc52){_0x4fc9aa=_0x4fc9aa-0x0;var _0x3383c3=_0xd949[_0x4fc9aa];return _0x3383c3;};'use strict';var _=require(_0x9d94('0x0'));var util=require(_0x9d94('0x1'));var moment=require(_0x9d94('0x2'));var md5=require(_0x9d94('0x3'));var Redis=require(_0x9d94('0x4'));var config=require(_0x9d94('0x5'));config[_0x9d94('0x6')]=_['defaults'](config['redis'],{'host':_0x9d94('0x7'),'port':0x18eb});var io=require(_0x9d94('0x8'))(new Redis(config[_0x9d94('0x6')]));function Agent(_0xff4a63){this['id']=_0xff4a63['id']||0x0;this[_0x9d94('0x9')]=_0xff4a63['name']||'';this['email']=_0xff4a63[_0x9d94('0xa')]||'';this['accountcode']=_0xff4a63['accountcode']||'';this['fullname']=_0xff4a63[_0x9d94('0xb')]||'';this['state']=_0x9d94('0xc');this[_0x9d94('0xd')]=0x0;this[_0x9d94('0xe')]=_0x9d94('0xc');this[_0x9d94('0xf')]='';this[_0x9d94('0x10')]='';this[_0x9d94('0x11')]='';this[_0x9d94('0x12')]='';this[_0x9d94('0x13')]=_0xff4a63[_0x9d94('0x13')]||![];this[_0x9d94('0x14')]=_0x9d94('0xc');this[_0x9d94('0x15')]=0x0;this[_0x9d94('0x16')]='';this[_0x9d94('0x17')]='';this[_0x9d94('0x18')]=![];this[_0x9d94('0x19')]=![];this[_0x9d94('0x3')]='';}Agent[_0x9d94('0x1a')]['updateStatusRealtime']=function(_0x1ecebd){var _0x51c232;if(_0x1ecebd&&_0x1ecebd[_0x9d94('0x1b')]){_0x51c232=_0x1ecebd[_0x9d94('0x1b')][_0x9d94('0x1c')]();switch(_0x51c232){case _0x9d94('0x1d'):_0x51c232='idle';break;case'inuse':_0x51c232=_0x9d94('0x1e');break;}}if(_0x51c232&&this[_0x9d94('0x14')]!==_0x51c232||_0x1ecebd[_0x9d94('0x1f')]){this[_0x9d94('0x15')]=_[_0x9d94('0x20')](moment()[_0x9d94('0x21')]('x'));}if(_0x51c232){this[_0x9d94('0x14')]=_0x51c232;}var _0x1d98c9={'id':this['id'],'name':this[_0x9d94('0x9')],'email':this[_0x9d94('0xa')],'accountcode':this[_0x9d94('0x22')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x9d94('0xd')],'status':this[_0x9d94('0xe')],'address':this[_0x9d94('0xf')],'online':this['online'],'voiceStatus':this[_0x9d94('0x14')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x9d94('0x16')],'voiceStatusQueue':this[_0x9d94('0x17')],'interface':this['interface'],'onhold':this[_0x9d94('0x18')]};var _0x7551ac=md5(JSON['stringify'](_0x1d98c9));if(this['md5']!==_0x7551ac){this[_0x9d94('0x3')]=_0x7551ac;io['to'](util[_0x9d94('0x21')](_0x9d94('0x23'),_0x1d98c9['name']))[_0x9d94('0x24')](_0x9d94('0x25'),_0x1d98c9);}};module[_0x9d94('0x26')]=Agent; \ No newline at end of file +var _0xb9c1=['lodash','util','moment','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','email','fullname','state','unknown','stateTime','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','updateStatusRealtime','toLowerCase','not_inuse','inuse','statePause','format','accountcode','voiceStatusCallerIdNumber','stringify','emit','user:save','exports'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0xb9c1,0xcc));var _0x1b9c=function(_0xf0b5eb,_0xcccc1f){_0xf0b5eb=_0xf0b5eb-0x0;var _0x3c3bda=_0xb9c1[_0xf0b5eb];return _0x3c3bda;};'use strict';var _=require(_0x1b9c('0x0'));var util=require(_0x1b9c('0x1'));var moment=require(_0x1b9c('0x2'));var md5=require(_0x1b9c('0x3'));var Redis=require(_0x1b9c('0x4'));var config=require(_0x1b9c('0x5'));config[_0x1b9c('0x6')]=_['defaults'](config[_0x1b9c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x1b9c('0x7'))(new Redis(config[_0x1b9c('0x6')]));function Agent(_0x110ef0){this['id']=_0x110ef0['id']||0x0;this[_0x1b9c('0x8')]=_0x110ef0[_0x1b9c('0x8')]||'';this['email']=_0x110ef0[_0x1b9c('0x9')]||'';this['accountcode']=_0x110ef0['accountcode']||'';this['fullname']=_0x110ef0[_0x1b9c('0xa')]||'';this[_0x1b9c('0xb')]=_0x1b9c('0xc');this[_0x1b9c('0xd')]=0x0;this['status']='unknown';this[_0x1b9c('0xe')]='';this[_0x1b9c('0xf')]='';this[_0x1b9c('0x10')]='';this[_0x1b9c('0x11')]='';this[_0x1b9c('0x12')]=_0x110ef0['online']||![];this[_0x1b9c('0x13')]=_0x1b9c('0xc');this[_0x1b9c('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1b9c('0x15')]='';this['onhold']=![];this['local']=![];this[_0x1b9c('0x3')]='';}Agent['prototype'][_0x1b9c('0x16')]=function(_0x46b86d){var _0xfc24ff;if(_0x46b86d&&_0x46b86d[_0x1b9c('0xb')]){_0xfc24ff=_0x46b86d['state'][_0x1b9c('0x17')]();switch(_0xfc24ff){case _0x1b9c('0x18'):_0xfc24ff='idle';break;case _0x1b9c('0x19'):_0xfc24ff='talking';break;}}if(_0xfc24ff&&this[_0x1b9c('0x13')]!==_0xfc24ff||_0x46b86d[_0x1b9c('0x1a')]){this[_0x1b9c('0x14')]=_['toNumber'](moment()[_0x1b9c('0x1b')]('x'));}if(_0xfc24ff){this['voiceStatus']=_0xfc24ff;}var _0x400b12={'id':this['id'],'name':this[_0x1b9c('0x8')],'email':this[_0x1b9c('0x9')],'accountcode':this[_0x1b9c('0x1c')],'fullname':this['fullname'],'state':this[_0x1b9c('0xb')],'stateTime':this[_0x1b9c('0xd')],'status':this['status'],'address':this['address'],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x1b9c('0x1d')],'voiceStatusQueue':this[_0x1b9c('0x15')],'interface':this['interface'],'onhold':this['onhold']};var _0x535351=md5(JSON[_0x1b9c('0x1e')](_0x400b12));if(this['md5']!==_0x535351){this[_0x1b9c('0x3')]=_0x535351;io['to'](util[_0x1b9c('0x1b')]('user:%s',_0x400b12[_0x1b9c('0x8')]))[_0x1b9c('0x1f')](_0x1b9c('0x20'),_0x400b12);}};module[_0x1b9c('0x21')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b29bd63..8c92b09 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 _0x334d=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x23a07e,_0x2590aa){var _0x5bee3e=function(_0x4230a7){while(--_0x4230a7){_0x23a07e['push'](_0x23a07e['shift']());}};_0x5bee3e(++_0x2590aa);}(_0x334d,0x11a));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x552c2b){this['id']=_0x552c2b['id']||0x0;this[_0xd334('0x0')]=_0x552c2b[_0xd334('0x0')]||'';this[_0xd334('0x1')]=_0x552c2b[_0xd334('0x1')]||_0xd334('0x2');this['originated']=0x0;this[_0xd334('0x3')]=0x0;this[_0xd334('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xd334('0x5')]=!![];this['active']=_0x552c2b[_0xd334('0x6')];this[_0xd334('0x7')]=_0x552c2b[_0xd334('0x7')];this[_0xd334('0x8')]=_0x552c2b[_0xd334('0x8')]||null;this[_0xd334('0x9')]=_0x552c2b[_0xd334('0x9')]?_0x552c2b[_0xd334('0x9')]:null;this['dialOriginateCallerIdName']=_0x552c2b[_0xd334('0xa')];this[_0xd334('0xb')]=_0x552c2b['dialOriginateCallerIdNumber'];this[_0xd334('0xc')]=_0x552c2b['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x552c2b[_0xd334('0xd')];this[_0xd334('0xe')]=_0x552c2b[_0xd334('0xe')];this[_0xd334('0xf')]=_0x552c2b[_0xd334('0xf')];this[_0xd334('0x10')]=_0x552c2b[_0xd334('0x10')];this[_0xd334('0x11')]=_0x552c2b[_0xd334('0x11')];this[_0xd334('0x12')]=_0x552c2b[_0xd334('0x12')];this[_0xd334('0x13')]=_0x552c2b[_0xd334('0x13')];this['dialNoSuchNumberMaxRetry']=_0x552c2b[_0xd334('0x14')]||0x3;this[_0xd334('0x15')]=_0x552c2b[_0xd334('0x15')]||0x96;this['dialDropMaxRetry']=_0x552c2b['dialDropMaxRetry']||0x3;this[_0xd334('0x16')]=_0x552c2b[_0xd334('0x16')]||0x96;this[_0xd334('0x17')]=_0x552c2b[_0xd334('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x552c2b[_0xd334('0x18')]||0x96;this[_0xd334('0x19')]=_0x552c2b[_0xd334('0x19')]||0x3;this[_0xd334('0x1a')]=_0x552c2b[_0xd334('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x552c2b[_0xd334('0x1b')]||0x3;this[_0xd334('0x1c')]=_0x552c2b[_0xd334('0x1c')]||0x96;this[_0xd334('0x1d')]=_0x552c2b[_0xd334('0x1d')]||'DESC';this[_0xd334('0x1e')]=_0x552c2b[_0xd334('0x1e')]||undefined;this[_0xd334('0x1f')]=_0x552c2b[_0xd334('0x1f')]||undefined;this[_0xd334('0x20')]=_0x552c2b['dialCutDigit']||undefined;this[_0xd334('0x21')]=_0x552c2b[_0xd334('0x21')]?_0x552c2b[_0xd334('0x21')]:undefined;this['Trunk']=_0x552c2b[_0xd334('0x22')]?_0x552c2b[_0xd334('0x22')]:undefined;this['Interval']=_0x552c2b[_0xd334('0x23')]?_0x552c2b[_0xd334('0x23')]:undefined;this['SquareProject']=_0x552c2b[_0xd334('0x24')]?_0x552c2b[_0xd334('0x24')]:undefined;this[_0xd334('0x25')]=_0x552c2b[_0xd334('0x24')]?_0x552c2b[_0xd334('0x24')][_0xd334('0x0')]:undefined;this[_0xd334('0x26')]=_0x552c2b[_0xd334('0x26')]||![];this[_0xd334('0x27')]=_0x552c2b[_0xd334('0x27')];this[_0xd334('0x28')]=_0x552c2b[_0xd334('0x28')];this[_0xd334('0x29')]=_0x552c2b[_0xd334('0x29')];this[_0xd334('0x2a')]=_0x552c2b[_0xd334('0x2a')];this[_0xd334('0x2b')]=_0x552c2b[_0xd334('0x2b')];this[_0xd334('0x2c')]=_0x552c2b[_0xd334('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x552c2b[_0xd334('0x2d')];this[_0xd334('0x2e')]=_0x552c2b[_0xd334('0x2e')];this[_0xd334('0x2f')]=_0x552c2b[_0xd334('0x2f')];}module[_0xd334('0x30')]=Campaign; \ No newline at end of file +var _0x69d5=['temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated'];(function(_0x43be21,_0x1a1140){var _0x535370=function(_0x5a8d39){while(--_0x5a8d39){_0x43be21['push'](_0x43be21['shift']());}};_0x535370(++_0x1a1140);}(_0x69d5,0x15a));var _0x569d=function(_0x3a63c1,_0x33d6c4){_0x3a63c1=_0x3a63c1-0x0;var _0x87d9e=_0x69d5[_0x3a63c1];return _0x87d9e;};'use strict';function Campaign(_0x46656e){this['id']=_0x46656e['id']||0x0;this[_0x569d('0x0')]=_0x46656e[_0x569d('0x0')]||'';this[_0x569d('0x1')]=_0x46656e[_0x569d('0x1')]||_0x569d('0x2');this[_0x569d('0x3')]=0x0;this[_0x569d('0x4')]=0x0;this[_0x569d('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x569d('0x6')]='';this[_0x569d('0x7')]=!![];this[_0x569d('0x8')]=_0x46656e['active'];this[_0x569d('0x9')]=_0x46656e['limitCalls'];this[_0x569d('0xa')]=_0x46656e[_0x569d('0xa')]||null;this[_0x569d('0xb')]=_0x46656e['dialGlobalInterval']?_0x46656e[_0x569d('0xb')]:null;this[_0x569d('0xc')]=_0x46656e[_0x569d('0xc')];this[_0x569d('0xd')]=_0x46656e[_0x569d('0xd')];this[_0x569d('0xe')]=_0x46656e[_0x569d('0xe')]||0x1e;this[_0x569d('0xf')]=_0x46656e[_0x569d('0xf')];this[_0x569d('0x10')]=_0x46656e[_0x569d('0x10')];this['dialBusyMaxRetry']=_0x46656e[_0x569d('0x11')];this['dialBusyRetryFrequency']=_0x46656e['dialBusyRetryFrequency'];this[_0x569d('0x12')]=_0x46656e['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x46656e[_0x569d('0x13')];this['dialGlobalMaxRetry']=_0x46656e[_0x569d('0x14')];this[_0x569d('0x15')]=_0x46656e[_0x569d('0x15')]||0x3;this[_0x569d('0x16')]=_0x46656e['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x46656e[_0x569d('0x17')]||0x3;this[_0x569d('0x18')]=_0x46656e[_0x569d('0x18')]||0x96;this[_0x569d('0x19')]=_0x46656e[_0x569d('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x46656e['dialAbandonedRetryFrequency']||0x96;this[_0x569d('0x1a')]=_0x46656e[_0x569d('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x46656e[_0x569d('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x46656e[_0x569d('0x1c')]||0x3;this[_0x569d('0x1d')]=_0x46656e['dialAgentRejectRetryFrequency']||0x96;this[_0x569d('0x1e')]=_0x46656e[_0x569d('0x1e')]||_0x569d('0x1f');this[_0x569d('0x20')]=_0x46656e[_0x569d('0x20')]||undefined;this[_0x569d('0x21')]=_0x46656e['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x569d('0x22')]=_0x46656e[_0x569d('0x22')]||undefined;this[_0x569d('0x23')]=_0x46656e[_0x569d('0x23')]?_0x46656e['TrunkBackup']:undefined;this[_0x569d('0x24')]=_0x46656e[_0x569d('0x24')]?_0x46656e[_0x569d('0x24')]:undefined;this['Interval']=_0x46656e['Interval']?_0x46656e['Interval']:undefined;this[_0x569d('0x25')]=_0x46656e['SquareProject']?_0x46656e[_0x569d('0x25')]:undefined;this[_0x569d('0x26')]=_0x46656e[_0x569d('0x25')]?_0x46656e['SquareProject']['name']:undefined;this[_0x569d('0x27')]=_0x46656e[_0x569d('0x27')]||![];this[_0x569d('0x28')]=_0x46656e[_0x569d('0x28')];this['dialAMDGreeting']=_0x46656e[_0x569d('0x29')];this['dialAMDAfterGreetingSilence']=_0x46656e[_0x569d('0x2a')];this['dialAMDTotalAnalysisTime']=_0x46656e[_0x569d('0x2b')];this[_0x569d('0x2c')]=_0x46656e[_0x569d('0x2c')];this[_0x569d('0x2d')]=_0x46656e[_0x569d('0x2d')];this[_0x569d('0x2e')]=_0x46656e[_0x569d('0x2e')];this[_0x569d('0x2f')]=_0x46656e['dialAMDSilenceThreshold'];this[_0x569d('0x30')]=_0x46656e['dialAMDMaximumWordLength'];}module[_0x569d('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index b055ddb..15d7128 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 _0xa282=['calleridnum','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','exports','starttime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa282,0x1f3));var _0x2a28=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xa282[_0x2235bf];return _0x4c3a64;};'use strict';function Channel(){this[_0x2a28('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x2a28('0x1')]=0x0;this['calleridname']='';this[_0x2a28('0x2')]=undefined;this['connectedlinename']=undefined;this[_0x2a28('0x3')]=0x0;this[_0x2a28('0x4')]='';this[_0x2a28('0x5')]=0x0;this[_0x2a28('0x6')]=0x0;this[_0x2a28('0x7')]=0x0;this[_0x2a28('0x8')]=![];this[_0x2a28('0x9')]=null;this[_0x2a28('0xa')]=null;this[_0x2a28('0xb')]=![];this[_0x2a28('0xc')]=![];this[_0x2a28('0xd')]='';this[_0x2a28('0xe')]='';this[_0x2a28('0xf')]=0x0;this['billableseconds']=0x0;this[_0x2a28('0x10')]=0x0;this['type']=null;this[_0x2a28('0x11')]=null;this[_0x2a28('0x12')]=null;this[_0x2a28('0x13')]=![];this[_0x2a28('0x14')]=null;this[_0x2a28('0x15')]=null;this[_0x2a28('0x16')]=[];this[_0x2a28('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this['mohtime']=0x0;}module[_0x2a28('0x18')]=Channel; \ No newline at end of file +var _0x80c4=['billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration'];(function(_0x548d31,_0x289aa5){var _0x33c463=function(_0x3530c1){while(--_0x3530c1){_0x548d31['push'](_0x548d31['shift']());}};_0x33c463(++_0x289aa5);}(_0x80c4,0xa3));var _0x480c=function(_0x26c457,_0x3e9e8e){_0x26c457=_0x26c457-0x0;var _0x5a0079=_0x80c4[_0x26c457];return _0x5a0079;};'use strict';function Channel(){this[_0x480c('0x0')]=null;this['channel']='';this[_0x480c('0x1')]='';this[_0x480c('0x2')]=0x0;this[_0x480c('0x3')]='';this[_0x480c('0x4')]=undefined;this[_0x480c('0x5')]=undefined;this[_0x480c('0x6')]=0x0;this['context']='';this[_0x480c('0x7')]=0x0;this[_0x480c('0x8')]=0x0;this[_0x480c('0x9')]=0x0;this[_0x480c('0xa')]=![];this[_0x480c('0xb')]=null;this[_0x480c('0xc')]=null;this[_0x480c('0xd')]=![];this[_0x480c('0xe')]=![];this[_0x480c('0xf')]='';this['lastdata']='';this[_0x480c('0x10')]=0x0;this[_0x480c('0x11')]=0x0;this[_0x480c('0x12')]=0x0;this[_0x480c('0x13')]=null;this[_0x480c('0x14')]=null;this[_0x480c('0x15')]=null;this[_0x480c('0x16')]=![];this[_0x480c('0x17')]=null;this[_0x480c('0x18')]=null;this[_0x480c('0x19')]=[];this[_0x480c('0x1a')]=undefined;this[_0x480c('0x1b')]=undefined;this[_0x480c('0x1c')]=0x0;}module[_0x480c('0x1d')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 3d592aa..318a50b 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 _0x7dfd=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0xf1603b,_0x257c11){var _0x298fab=function(_0x5a96fd){while(--_0x5a96fd){_0xf1603b['push'](_0xf1603b['shift']());}};_0x298fab(++_0x257c11);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x42fed7){this['id']=_0x42fed7['id']||0x0;this[_0xd7df('0x0')]=_0x42fed7[_0xd7df('0x0')]||'';this[_0xd7df('0x1')]=_0x42fed7[_0xd7df('0x1')]||'';this[_0xd7df('0x2')]=_0x42fed7[_0xd7df('0x2')]||'';this[_0xd7df('0x3')]=_0x42fed7[_0xd7df('0x3')]||'';this[_0xd7df('0x4')]=_0x42fed7[_0xd7df('0x4')]||'';this[_0xd7df('0x5')]=_0x42fed7[_0xd7df('0x5')]||'';this[_0xd7df('0x6')]=_0x42fed7[_0xd7df('0x6')]||'';this[_0xd7df('0x7')]=_0x42fed7[_0xd7df('0x7')]||'';this['tokenSecret']=_0x42fed7[_0xd7df('0x8')]||'';this[_0xd7df('0x9')]=_0x42fed7[_0xd7df('0x9')]||'';this[_0xd7df('0xa')]=_0x42fed7['serverUrl']||'';this[_0xd7df('0xb')]=_0x42fed7['Configurations']||{};}module[_0xd7df('0xc')]=DeskAccount; \ No newline at end of file +var _0x74f3=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x4fb439,_0x334007){var _0x18d93a=function(_0x4ca5a4){while(--_0x4ca5a4){_0x4fb439['push'](_0x4fb439['shift']());}};_0x18d93a(++_0x334007);}(_0x74f3,0x164));var _0x374f=function(_0xb5f3c2,_0x728f91){_0xb5f3c2=_0xb5f3c2-0x0;var _0x5079db=_0x74f3[_0xb5f3c2];return _0x5079db;};'use strict';function DeskAccount(_0x195ed5){this['id']=_0x195ed5['id']||0x0;this[_0x374f('0x0')]=_0x195ed5[_0x374f('0x0')]||'';this['username']=_0x195ed5[_0x374f('0x1')]||'';this[_0x374f('0x2')]=_0x195ed5[_0x374f('0x2')]||'';this[_0x374f('0x3')]=_0x195ed5['authType']||'';this[_0x374f('0x4')]=_0x195ed5[_0x374f('0x4')]||'';this['consumerKey']=_0x195ed5[_0x374f('0x5')]||'';this[_0x374f('0x6')]=_0x195ed5[_0x374f('0x6')]||'';this[_0x374f('0x7')]=_0x195ed5[_0x374f('0x7')]||'';this[_0x374f('0x8')]=_0x195ed5[_0x374f('0x8')]||'';this[_0x374f('0x9')]=_0x195ed5['type']||'';this[_0x374f('0xa')]=_0x195ed5[_0x374f('0xa')]||'';this[_0x374f('0xb')]=_0x195ed5[_0x374f('0xb')]||{};}module[_0x374f('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index c930198..6ce6719 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 _0xcbbf=['exports','name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0xeb3047,_0x21025a){var _0x3ed8c0=function(_0x386758){while(--_0x386758){_0xeb3047['push'](_0xeb3047['shift']());}};_0x3ed8c0(++_0x21025a);}(_0xcbbf,0xf4));var _0xfcbb=function(_0x2371e4,_0x349120){_0x2371e4=_0x2371e4-0x0;var _0x2d53ea=_0xcbbf[_0x2371e4];return _0x2d53ea;};'use strict';function Dynamics365Account(_0x3e55d4){this['id']=_0x3e55d4['id']||0x0;this[_0xfcbb('0x0')]=_0x3e55d4[_0xfcbb('0x0')]||'';this['username']=_0x3e55d4['username']||'';this['password']=_0x3e55d4[_0xfcbb('0x1')]||'';this[_0xfcbb('0x2')]=_0x3e55d4[_0xfcbb('0x2')]||'';this[_0xfcbb('0x3')]=_0x3e55d4['tenantId']||'';this[_0xfcbb('0x4')]=_0x3e55d4['clientId']||'';this[_0xfcbb('0x5')]=_0x3e55d4['clientSecret']||{};this[_0xfcbb('0x6')]=_0x3e55d4[_0xfcbb('0x6')]||'';this[_0xfcbb('0x7')]=_0x3e55d4[_0xfcbb('0x7')]||{};}module[_0xfcbb('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x8c44=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c44,0x6b));var _0x48c4=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x8c44[_0x427217];return _0x5b28fb;};'use strict';function Dynamics365Account(_0x3d6b2a){this['id']=_0x3d6b2a['id']||0x0;this[_0x48c4('0x0')]=_0x3d6b2a[_0x48c4('0x0')]||'';this[_0x48c4('0x1')]=_0x3d6b2a['username']||'';this[_0x48c4('0x2')]=_0x3d6b2a[_0x48c4('0x2')]||'';this['remoteUri']=_0x3d6b2a[_0x48c4('0x3')]||'';this['tenantId']=_0x3d6b2a[_0x48c4('0x4')]||'';this[_0x48c4('0x5')]=_0x3d6b2a[_0x48c4('0x5')]||'';this[_0x48c4('0x6')]=_0x3d6b2a['clientSecret']||{};this['serverUrl']=_0x3d6b2a[_0x48c4('0x7')]||'';this[_0x48c4('0x8')]=_0x3d6b2a[_0x48c4('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 4f06225..fb0120b 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 _0x3116=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x5db894,_0x1dc679){var _0x6c211e=function(_0x16411e){while(--_0x16411e){_0x5db894['push'](_0x5db894['shift']());}};_0x6c211e(++_0x1dc679);}(_0x3116,0x17e));var _0x6311=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x3116[_0x4c7fb5];return _0x2e10ac;};'use strict';function FaxAccount(_0x2efce7){this['id']=_0x2efce7['id']||0x0;this[_0x6311('0x0')]=_0x2efce7[_0x6311('0x0')]||'';this[_0x6311('0x1')]=_0x2efce7[_0x6311('0x1')];this[_0x6311('0x2')]=_0x2efce7['ecm'];this[_0x6311('0x3')]=_0x2efce7[_0x6311('0x3')];this[_0x6311('0x4')]=_0x2efce7[_0x6311('0x4')];this['minrate']=_0x2efce7[_0x6311('0x5')]||0x960;this[_0x6311('0x6')]=_0x2efce7[_0x6311('0x6')]||0x3840;this[_0x6311('0x7')]=_0x2efce7[_0x6311('0x7')]||_0x6311('0x8');this[_0x6311('0x9')]=_0x2efce7[_0x6311('0x9')]||'no';this[_0x6311('0xa')]=_0x2efce7[_0x6311('0xa')]||'no';this['t38timeout']=_0x2efce7[_0x6311('0xb')]||0x1388;this[_0x6311('0xc')]=_0x2efce7[_0x6311('0xc')]||_0x6311('0xd');this['Trunk']=_0x2efce7['Trunk']?_0x2efce7[_0x6311('0xe')]:undefined;this['ListId']=_0x2efce7[_0x6311('0xf')];this[_0x6311('0x10')]=_0x2efce7[_0x6311('0x10')];}module[_0x6311('0x11')]=FaxAccount; \ No newline at end of file +var _0x6eaf=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','name'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x6eaf,0x6f));var _0xf6ea=function(_0x3c47b8,_0x510ae2){_0x3c47b8=_0x3c47b8-0x0;var _0x3c6ccf=_0x6eaf[_0x3c47b8];return _0x3c6ccf;};'use strict';function FaxAccount(_0x1f9041){this['id']=_0x1f9041['id']||0x0;this[_0xf6ea('0x0')]=_0x1f9041[_0xf6ea('0x0')]||'';this['description']=_0x1f9041[_0xf6ea('0x1')];this[_0xf6ea('0x2')]=_0x1f9041[_0xf6ea('0x2')];this['headerinfo']=_0x1f9041[_0xf6ea('0x3')];this[_0xf6ea('0x4')]=_0x1f9041[_0xf6ea('0x4')];this[_0xf6ea('0x5')]=_0x1f9041['minrate']||0x960;this['maxrate']=_0x1f9041[_0xf6ea('0x6')]||0x3840;this[_0xf6ea('0x7')]=_0x1f9041[_0xf6ea('0x7')]||_0xf6ea('0x8');this[_0xf6ea('0x9')]=_0x1f9041[_0xf6ea('0x9')]||'no';this[_0xf6ea('0xa')]=_0x1f9041[_0xf6ea('0xa')]||'no';this['t38timeout']=_0x1f9041['t38timeout']||0x1388;this[_0xf6ea('0xb')]=_0x1f9041['tech']||_0xf6ea('0xc');this[_0xf6ea('0xd')]=_0x1f9041[_0xf6ea('0xd')]?_0x1f9041['Trunk']:undefined;this[_0xf6ea('0xe')]=_0x1f9041[_0xf6ea('0xe')];this[_0xf6ea('0xf')]=_0x1f9041[_0xf6ea('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 cbc6fd2..bd6df77 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 _0x60de=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x30af23,_0x1b9d6a){var _0x5cea96=function(_0x31be06){while(--_0x31be06){_0x30af23['push'](_0x30af23['shift']());}};_0x5cea96(++_0x1b9d6a);}(_0x60de,0x158));var _0xe60d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x60de[_0x4a9fb1];return _0x348672;};'use strict';function FreshdeskAccount(_0x4aed0a){this['id']=_0x4aed0a['id']||0x0;this[_0xe60d('0x0')]=_0x4aed0a[_0xe60d('0x0')]||'';this[_0xe60d('0x1')]=_0x4aed0a[_0xe60d('0x1')]||'';this['apiKey']=_0x4aed0a[_0xe60d('0x2')]||'';this['remoteUri']=_0x4aed0a[_0xe60d('0x3')]||'';this[_0xe60d('0x4')]=_0x4aed0a[_0xe60d('0x4')]||'';this[_0xe60d('0x5')]=_0x4aed0a[_0xe60d('0x5')]||{};}module[_0xe60d('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xbe3e=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x145a51,_0x465bf6){var _0x72c725=function(_0x45bc40){while(--_0x45bc40){_0x145a51['push'](_0x145a51['shift']());}};_0x72c725(++_0x465bf6);}(_0xbe3e,0x12f));var _0xebe3=function(_0x131738,_0x8ff5e){_0x131738=_0x131738-0x0;var _0x2ac88f=_0xbe3e[_0x131738];return _0x2ac88f;};'use strict';function FreshdeskAccount(_0x3fbe6c){this['id']=_0x3fbe6c['id']||0x0;this[_0xebe3('0x0')]=_0x3fbe6c['name']||'';this[_0xebe3('0x1')]=_0x3fbe6c['username']||'';this[_0xebe3('0x2')]=_0x3fbe6c[_0xebe3('0x3')]||'';this[_0xebe3('0x4')]=_0x3fbe6c[_0xebe3('0x4')]||'';this['serverUrl']=_0x3fbe6c[_0xebe3('0x5')]||'';this[_0xebe3('0x6')]=_0x3fbe6c[_0xebe3('0x6')]||{};}module[_0xebe3('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7a7ac8e..490ea10 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 _0xc931=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x5ef3ef,_0x3fa066){var _0x513b1c=function(_0x17239a){while(--_0x17239a){_0x5ef3ef['push'](_0x5ef3ef['shift']());}};_0x513b1c(++_0x3fa066);}(_0xc931,0x15d));var _0x1c93=function(_0x36ceb0,_0x400094){_0x36ceb0=_0x36ceb0-0x0;var _0x36498a=_0xc931[_0x36ceb0];return _0x36498a;};'use strict';function FreshsalesAccount(_0x1c8d29){this['id']=_0x1c8d29['id']||0x0;this['name']=_0x1c8d29[_0x1c93('0x0')]||'';this[_0x1c93('0x1')]=_0x1c8d29['username']||'';this[_0x1c93('0x2')]=_0x1c8d29[_0x1c93('0x3')]||'';this[_0x1c93('0x4')]=_0x1c8d29[_0x1c93('0x4')]||'';this['serverUrl']=_0x1c8d29[_0x1c93('0x5')]||'';this[_0x1c93('0x6')]=_0x1c8d29[_0x1c93('0x6')]||{};}module[_0x1c93('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xd742=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x51dd52,_0x22ea53){var _0x591121=function(_0x156199){while(--_0x156199){_0x51dd52['push'](_0x51dd52['shift']());}};_0x591121(++_0x22ea53);}(_0xd742,0x1ca));var _0x2d74=function(_0x1e5eaf,_0xcf96a4){_0x1e5eaf=_0x1e5eaf-0x0;var _0x301de8=_0xd742[_0x1e5eaf];return _0x301de8;};'use strict';function FreshsalesAccount(_0xc3c370){this['id']=_0xc3c370['id']||0x0;this[_0x2d74('0x0')]=_0xc3c370['name']||'';this[_0x2d74('0x1')]=_0xc3c370[_0x2d74('0x1')]||'';this[_0x2d74('0x2')]=_0xc3c370[_0x2d74('0x3')]||'';this[_0x2d74('0x4')]=_0xc3c370[_0x2d74('0x4')]||'';this[_0x2d74('0x5')]=_0xc3c370[_0x2d74('0x5')]||'';this[_0x2d74('0x6')]=_0xc3c370[_0x2d74('0x6')]||{};}module[_0x2d74('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 54d623f..635f923 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 _0x6496=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','exports','inbound','uniqueid','calleridnum','calleridname','queue'];(function(_0x258d6a,_0x3e6938){var _0x5bdabb=function(_0x4c65ed){while(--_0x4c65ed){_0x258d6a['push'](_0x258d6a['shift']());}};_0x5bdabb(++_0x3e6938);}(_0x6496,0xa3));var _0x6649=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x6496[_0x2d4421];return _0x2d3b01;};'use strict';function QueueReport(){this['type']=_0x6649('0x0');this[_0x6649('0x1')]='';this[_0x6649('0x2')]='';this[_0x6649('0x3')]='';this[_0x6649('0x4')]='';this[_0x6649('0x5')]=null;this[_0x6649('0x6')]=null;this[_0x6649('0x7')]=0x1;this[_0x6649('0x8')]=0x1;this[_0x6649('0x9')]=![];this[_0x6649('0xa')]=null;this[_0x6649('0xb')]=![];this[_0x6649('0xc')]=null;this[_0x6649('0xd')]=![];this[_0x6649('0xe')]=null;this['originalposition']=0x1;this['channel']='';this[_0x6649('0xf')]='';this[_0x6649('0x10')]='';this[_0x6649('0x11')]='';this[_0x6649('0x12')]='';this[_0x6649('0x13')]='';this[_0x6649('0x14')]='';this[_0x6649('0x15')]=0x0;this['assigned']=![];this[_0x6649('0x16')]='';this['mohtime']=0x0;this['variables']={};}module[_0x6649('0x17')]=QueueReport; \ No newline at end of file +var _0x2dc3=['priority','holdtime','assigned','lastAssignedTo','mohtime','variables','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','channel','connectedlinename','exten'];(function(_0x5bc1de,_0x40d9df){var _0x478bd3=function(_0x483c82){while(--_0x483c82){_0x5bc1de['push'](_0x5bc1de['shift']());}};_0x478bd3(++_0x40d9df);}(_0x2dc3,0x150));var _0x32dc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dc3[_0x501510];return _0x1e6ee5;};'use strict';function QueueReport(){this['type']=_0x32dc('0x0');this['uniqueid']='';this[_0x32dc('0x1')]='';this[_0x32dc('0x2')]='';this[_0x32dc('0x3')]='';this[_0x32dc('0x4')]=null;this[_0x32dc('0x5')]=null;this[_0x32dc('0x6')]=0x1;this[_0x32dc('0x7')]=0x1;this[_0x32dc('0x8')]=![];this[_0x32dc('0x9')]=null;this[_0x32dc('0xa')]=![];this['queuecallercompleteAt']=null;this[_0x32dc('0xb')]=![];this[_0x32dc('0xc')]=null;this['originalposition']=0x1;this[_0x32dc('0xd')]='';this['connectedlinenum']='';this[_0x32dc('0xe')]='';this['accountcode']='';this['context']='';this[_0x32dc('0xf')]='';this[_0x32dc('0x10')]='';this[_0x32dc('0x11')]=0x0;this[_0x32dc('0x12')]=![];this[_0x32dc('0x13')]='';this[_0x32dc('0x14')]=0x0;this[_0x32dc('0x15')]={};}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 7a3482b..00c0645 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 _0x498d=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0xf458ea,_0x5767e5){var _0x20f763=function(_0x223f6d){while(--_0x223f6d){_0xf458ea['push'](_0xf458ea['shift']());}};_0x20f763(++_0x5767e5);}(_0x498d,0x191));var _0xd498=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x498d[_0x5d07ff];return _0x5226ad;};'use strict';function SalesforceAccount(_0x3d95bb){this['id']=_0x3d95bb['id']||0x0;this[_0xd498('0x0')]=_0x3d95bb['name']||'';this[_0xd498('0x1')]=_0x3d95bb[_0xd498('0x1')]||'';this[_0xd498('0x2')]=_0x3d95bb[_0xd498('0x2')]||'';this[_0xd498('0x3')]=_0x3d95bb['password']||'';this[_0xd498('0x4')]=_0x3d95bb[_0xd498('0x4')]||'';this[_0xd498('0x5')]=_0x3d95bb[_0xd498('0x5')]||'';this[_0xd498('0x6')]=_0x3d95bb['securityToken']||'';this[_0xd498('0x7')]=_0x3d95bb[_0xd498('0x7')]||'integrationTab';this['serverUrl']=_0x3d95bb[_0xd498('0x8')]||'';this[_0xd498('0x9')]=_0x3d95bb[_0xd498('0x9')]||{};}module[_0xd498('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x5cda=['name','username','remoteUri','password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x26f585,_0x19526d){var _0xd40df=function(_0x555186){while(--_0x555186){_0x26f585['push'](_0x26f585['shift']());}};_0xd40df(++_0x19526d);}(_0x5cda,0xa5));var _0xa5cd=function(_0x56a494,_0x2117fc){_0x56a494=_0x56a494-0x0;var _0x51fab2=_0x5cda[_0x56a494];return _0x51fab2;};'use strict';function SalesforceAccount(_0x13d0cc){this['id']=_0x13d0cc['id']||0x0;this[_0xa5cd('0x0')]=_0x13d0cc['name']||'';this['username']=_0x13d0cc[_0xa5cd('0x1')]||'';this[_0xa5cd('0x2')]=_0x13d0cc[_0xa5cd('0x2')]||'';this[_0xa5cd('0x3')]=_0x13d0cc['password']||'';this['clientId']=_0x13d0cc['clientId']||'';this[_0xa5cd('0x4')]=_0x13d0cc[_0xa5cd('0x4')]||'';this[_0xa5cd('0x5')]=_0x13d0cc[_0xa5cd('0x5')]||'';this[_0xa5cd('0x6')]=_0x13d0cc[_0xa5cd('0x6')]||_0xa5cd('0x7');this['serverUrl']=_0x13d0cc[_0xa5cd('0x8')]||'';this[_0xa5cd('0x9')]=_0x13d0cc[_0xa5cd('0x9')]||{};}module[_0xa5cd('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 8e342ef..bf9f0d7 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 _0x35e7=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xbda183,_0x4e7cee){var _0x362380=function(_0x3fa3f0){while(--_0x3fa3f0){_0xbda183['push'](_0xbda183['shift']());}};_0x362380(++_0x4e7cee);}(_0x35e7,0x13f));var _0x735e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x35e7[_0x16d10f];return _0x50c823;};'use strict';function ServicenowAccount(_0x1bdf66){this['id']=_0x1bdf66['id']||0x0;this[_0x735e('0x0')]=_0x1bdf66[_0x735e('0x0')]||'';this[_0x735e('0x1')]=_0x1bdf66['username']||'';this[_0x735e('0x2')]=_0x1bdf66['password']||'';this[_0x735e('0x3')]=_0x1bdf66[_0x735e('0x3')]||'';this[_0x735e('0x4')]=_0x1bdf66[_0x735e('0x4')]||'';this['Configurations']=_0x1bdf66[_0x735e('0x5')]||{};}module[_0x735e('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x4e17=['serverUrl','exports','name','username','remoteUri'];(function(_0x35ba52,_0xff6716){var _0x489d58=function(_0x23cd6c){while(--_0x23cd6c){_0x35ba52['push'](_0x35ba52['shift']());}};_0x489d58(++_0xff6716);}(_0x4e17,0x1ce));var _0x74e1=function(_0x2be770,_0xf8f7ad){_0x2be770=_0x2be770-0x0;var _0x5d91b4=_0x4e17[_0x2be770];return _0x5d91b4;};'use strict';function ServicenowAccount(_0x55cde9){this['id']=_0x55cde9['id']||0x0;this[_0x74e1('0x0')]=_0x55cde9[_0x74e1('0x0')]||'';this[_0x74e1('0x1')]=_0x55cde9['username']||'';this['password']=_0x55cde9['password']||'';this[_0x74e1('0x2')]=_0x55cde9[_0x74e1('0x2')]||'';this[_0x74e1('0x3')]=_0x55cde9[_0x74e1('0x3')]||'';this['Configurations']=_0x55cde9['Configurations']||{};}module[_0x74e1('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index f9d79fa..8581bbd 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 _0x554b=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x4af2e8,_0x5927c8){var _0x591daf=function(_0x488785){while(--_0x488785){_0x4af2e8['push'](_0x4af2e8['shift']());}};_0x591daf(++_0x5927c8);}(_0x554b,0x182));var _0xb554=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x554b[_0x178e48];return _0x440d7e;};'use strict';function SugarcrmAccount(_0x3deebf){this['id']=_0x3deebf['id']||0x0;this[_0xb554('0x0')]=_0x3deebf['name']||'';this[_0xb554('0x1')]=_0x3deebf[_0xb554('0x1')]||'';this[_0xb554('0x2')]=_0x3deebf[_0xb554('0x2')]||'';this[_0xb554('0x3')]=_0x3deebf['remoteUri']||'';this['serverUrl']=_0x3deebf[_0xb554('0x4')]||'';this[_0xb554('0x5')]=_0x3deebf[_0xb554('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x52e6=['name','username','serverUrl','Configurations','exports'];(function(_0x44d352,_0x56facc){var _0x1eb543=function(_0xc008c4){while(--_0xc008c4){_0x44d352['push'](_0x44d352['shift']());}};_0x1eb543(++_0x56facc);}(_0x52e6,0x1c7));var _0x652e=function(_0x49a99a,_0x416551){_0x49a99a=_0x49a99a-0x0;var _0x13d103=_0x52e6[_0x49a99a];return _0x13d103;};'use strict';function SugarcrmAccount(_0x279847){this['id']=_0x279847['id']||0x0;this[_0x652e('0x0')]=_0x279847[_0x652e('0x0')]||'';this['username']=_0x279847[_0x652e('0x1')]||'';this['password']=_0x279847['password']||'';this['remoteUri']=_0x279847['remoteUri']||'';this[_0x652e('0x2')]=_0x279847[_0x652e('0x2')]||'';this[_0x652e('0x3')]=_0x279847[_0x652e('0x3')]||{};}module[_0x652e('0x4')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 4478d49..37c0371 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 _0x78ae=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x78ae,0x92));var _0xe78a=function(_0xe86041,_0x2fbd7b){_0xe86041=_0xe86041-0x0;var _0x1230a9=_0x78ae[_0xe86041];return _0x1230a9;};'use strict';function Telephone(_0x20c76b){this['id']=_0x20c76b['id']||0x0;this[_0xe78a('0x0')]=_0x20c76b['name']||'';this[_0xe78a('0x1')]=_0x20c76b[_0xe78a('0x1')]||'';this[_0xe78a('0x2')]=_0xe78a('0x3');this[_0xe78a('0x4')]=0x0;this[_0xe78a('0x5')]=_0xe78a('0x3');this[_0xe78a('0x6')]='';}module[_0xe78a('0x7')]=Telephone; \ No newline at end of file +var _0x3f5b=['accountcode','state','stateTime','unknown','address','exports','name'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x3f5b,0x8b));var _0xb3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5b[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x35df67){this['id']=_0x35df67['id']||0x0;this[_0xb3f5('0x0')]=_0x35df67['name']||'';this[_0xb3f5('0x1')]=_0x35df67[_0xb3f5('0x1')]||'';this[_0xb3f5('0x2')]='unknown';this[_0xb3f5('0x3')]=0x0;this['status']=_0xb3f5('0x4');this[_0xb3f5('0x5')]='';}module[_0xb3f5('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 acd4668..2ee43c0 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 _0xc5fb=['name','html'];(function(_0x58b101,_0x2d7709){var _0x1e201b=function(_0x45bc3a){while(--_0x45bc3a){_0x58b101['push'](_0x58b101['shift']());}};_0x1e201b(++_0x2d7709);}(_0xc5fb,0xa8));var _0xbc5f=function(_0x1b79f5,_0x1cf93a){_0x1b79f5=_0x1b79f5-0x0;var _0x26a6f1=_0xc5fb[_0x1b79f5];return _0x26a6f1;};'use strict';function template(_0x5eef11){this['id']=_0x5eef11['id']||0x0;this[_0xbc5f('0x0')]=_0x5eef11[_0xbc5f('0x0')]||'';this[_0xbc5f('0x1')]=_0x5eef11[_0xbc5f('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xf20b=['name','html','exports'];(function(_0x4b5b90,_0x25f0f5){var _0x1ad181=function(_0x45d59c){while(--_0x45d59c){_0x4b5b90['push'](_0x4b5b90['shift']());}};_0x1ad181(++_0x25f0f5);}(_0xf20b,0x1da));var _0xbf20=function(_0x3ea5e8,_0x293d93){_0x3ea5e8=_0x3ea5e8-0x0;var _0xe882f7=_0xf20b[_0x3ea5e8];return _0xe882f7;};'use strict';function template(_0x5c3672){this['id']=_0x5c3672['id']||0x0;this['name']=_0x5c3672[_0xbf20('0x0')]||'';this[_0xbf20('0x1')]=_0x5c3672[_0xbf20('0x1')]||'';}module[_0xbf20('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 28fd982..3111f6f 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 _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x1d31cf,_0x3354eb){var _0x4db495=function(_0x33942f){while(--_0x33942f){_0x1d31cf['push'](_0x1d31cf['shift']());}};_0x4db495(++_0x3354eb);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d7328,_0x3e4774){_0x1d7328=_0x1d7328-0x0;var _0xc76824=_0xedd9[_0x1d7328];return _0xc76824;};'use strict';function Trigger(_0x265eb8){this['id']=_0x265eb8['id']||0x0;this[_0x9edd('0x0')]=_0x265eb8[_0x9edd('0x0')]||'';this[_0x9edd('0x1')]=_0x265eb8[_0x9edd('0x1')]||_0x9edd('0x2');this[_0x9edd('0x3')]=_0x265eb8[_0x9edd('0x3')]||![];this[_0x9edd('0x4')]=_0x265eb8['AllConditions']||[];this[_0x9edd('0x5')]=_0x265eb8[_0x9edd('0x5')]||[];this[_0x9edd('0x6')]=_0x265eb8[_0x9edd('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x7217=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x295d56,_0x565bdc){var _0x12c664=function(_0x3bfd3d){while(--_0x3bfd3d){_0x295d56['push'](_0x295d56['shift']());}};_0x12c664(++_0x565bdc);}(_0x7217,0x19e));var _0x7721=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7217[_0x6131cd];return _0x47e916;};'use strict';function Trigger(_0x516f0e){this['id']=_0x516f0e['id']||0x0;this['name']=_0x516f0e[_0x7721('0x0')]||'';this[_0x7721('0x1')]=_0x516f0e[_0x7721('0x1')]||_0x7721('0x2');this[_0x7721('0x3')]=_0x516f0e['status']||![];this['AllConditions']=_0x516f0e[_0x7721('0x4')]||[];this[_0x7721('0x5')]=_0x516f0e[_0x7721('0x5')]||[];this[_0x7721('0x6')]=_0x516f0e[_0x7721('0x6')]||[];}module[_0x7721('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index ccd566e..de943a3 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 _0x257e=['registry','split','host','domain','domainport','refresh','stateRegistry','exports','active','name','unknown','stateTime','status'];(function(_0x41a7ef,_0x351528){var _0x74578c=function(_0x2e1a22){while(--_0x2e1a22){_0x41a7ef['push'](_0x41a7ef['shift']());}};_0x74578c(++_0x351528);}(_0x257e,0x1dc));var _0xe257=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x257e[_0x1f7839];return _0x36b42e;};'use strict';function Trunk(_0x398123){this['id']=_0x398123['id']||0x0;this[_0xe257('0x0')]=_0x398123[_0xe257('0x0')]||![];this['name']=_0x398123[_0xe257('0x1')]||'';this['state']=_0xe257('0x2');this[_0xe257('0x3')]=0x0;this[_0xe257('0x4')]=_0xe257('0x2');this['registry']=_0x398123[_0xe257('0x5')]&&_0x398123[_0xe257('0x5')]['indexOf'](':')?_0x398123[_0xe257('0x5')][_0xe257('0x6')](':')[0x0]:'';this[_0xe257('0x7')]='';this['port']='';this[_0xe257('0x8')]='';this[_0xe257('0x9')]='';this[_0xe257('0xa')]='';this[_0xe257('0xb')]=_0xe257('0x2');this['registrationtime']='';this['address']='';}module[_0xe257('0xc')]=Trunk; \ No newline at end of file +var _0xe099=['host','port','domain','domainport','refresh','stateRegistry','registrationtime','exports','active','name','state','unknown','stateTime','registry','split'];(function(_0x58cddf,_0x4d5c79){var _0x321621=function(_0x4d37de){while(--_0x4d37de){_0x58cddf['push'](_0x58cddf['shift']());}};_0x321621(++_0x4d5c79);}(_0xe099,0xe9));var _0x9e09=function(_0x9024aa,_0x2b7596){_0x9024aa=_0x9024aa-0x0;var _0x1d8cde=_0xe099[_0x9024aa];return _0x1d8cde;};'use strict';function Trunk(_0x1ec34c){this['id']=_0x1ec34c['id']||0x0;this['active']=_0x1ec34c[_0x9e09('0x0')]||![];this['name']=_0x1ec34c[_0x9e09('0x1')]||'';this[_0x9e09('0x2')]=_0x9e09('0x3');this[_0x9e09('0x4')]=0x0;this['status']=_0x9e09('0x3');this['registry']=_0x1ec34c[_0x9e09('0x5')]&&_0x1ec34c['registry']['indexOf'](':')?_0x1ec34c[_0x9e09('0x5')][_0x9e09('0x6')](':')[0x0]:'';this[_0x9e09('0x7')]='';this[_0x9e09('0x8')]='';this[_0x9e09('0x9')]='';this[_0x9e09('0xa')]='';this[_0x9e09('0xb')]='';this[_0x9e09('0xc')]='unknown';this[_0x9e09('0xd')]='';this['address']='';}module[_0x9e09('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a233217..dac32e5 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 _0xb34d=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x463758,_0x542002){var _0x268a00=function(_0xdd37db){while(--_0xdd37db){_0x463758['push'](_0x463758['shift']());}};_0x268a00(++_0x542002);}(_0xb34d,0x1e4));var _0xdb34=function(_0x4816e0,_0x1794b7){_0x4816e0=_0x4816e0-0x0;var _0x267e39=_0xb34d[_0x4816e0];return _0x267e39;};'use strict';function voiceExtension(_0x241e94){this['id']=_0x241e94['id']||0x0;this[_0xdb34('0x0')]=_0x241e94[_0xdb34('0x0')]||'';this[_0xdb34('0x1')]=_0x241e94[_0xdb34('0x1')]||_0xdb34('0x2');this['mandatoryDisposition']=_0x241e94[_0xdb34('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xdbdc=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x2302ad,_0x44046f){var _0xb0ae7b=function(_0xd842ef){while(--_0xd842ef){_0x2302ad['push'](_0x2302ad['shift']());}};_0xb0ae7b(++_0x44046f);}(_0xdbdc,0x13d));var _0xcdbd=function(_0x3fb46e,_0x46092f){_0x3fb46e=_0x3fb46e-0x0;var _0x1c43f2=_0xdbdc[_0x3fb46e];return _0x1c43f2;};'use strict';function voiceExtension(_0x34c90a){this['id']=_0x34c90a['id']||0x0;this[_0xcdbd('0x0')]=_0x34c90a[_0xcdbd('0x0')]||'';this[_0xcdbd('0x1')]=_0x34c90a[_0xcdbd('0x1')]||_0xcdbd('0x2');this[_0xcdbd('0x3')]=_0x34c90a[_0xcdbd('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 1b11b76..123c339 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 _0x1f82=['roundrobin','name','monitor_format','type','inbound','talking','answered','sumDuration','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringing','onhold','wav','wav49','gsm','rrmemory'];(function(_0xd71815,_0x45dfa9){var _0x32937f=function(_0xf20d58){while(--_0xf20d58){_0xd71815['push'](_0xd71815['shift']());}};_0x32937f(++_0x45dfa9);}(_0x1f82,0x6a));var _0x21f8=function(_0x3496d3,_0x4467a2){_0x3496d3=_0x3496d3-0x0;var _0x509096=_0x1f82[_0x3496d3];return _0x509096;};'use strict';var statusDesc=[_0x21f8('0x0'),_0x21f8('0x1'),_0x21f8('0x2'),_0x21f8('0x3'),_0x21f8('0x4'),'unavailable',_0x21f8('0x5'),'ringinuse',_0x21f8('0x6')];var monitorFormat={'wav':_0x21f8('0x7'),'wav49':_0x21f8('0x8'),'gsm':_0x21f8('0x9')};var strategy={'rrmemory':_0x21f8('0xa'),'roundrobin':_0x21f8('0xb')};function VoiceQueue(_0x1c0f5e){this['id']=_0x1c0f5e['id']||0x0;this[_0x21f8('0xc')]=_0x1c0f5e['name']||'';this[_0x21f8('0xd')]=_0x1c0f5e[_0x21f8('0xd')]||'';this[_0x21f8('0xe')]=_0x1c0f5e[_0x21f8('0xe')]||_0x21f8('0xf');this['waiting']=0x0;this[_0x21f8('0x10')]=0x0;this['total']=0x0;this[_0x21f8('0x11')]=0x0;this[_0x21f8('0x12')]=0x0;this['sumHoldTime']=0x0;this[_0x21f8('0x13')]=0x0;this['unmanaged']=0x0;this[_0x21f8('0x14')]=0x0;this['loggedIn']=0x0;this[_0x21f8('0x15')]=0x0;this[_0x21f8('0x16')]=_0x1c0f5e['acw']||![];this['acwTimeout']=_0x1c0f5e[_0x21f8('0x17')]||0xa;this[_0x21f8('0x18')]=_0x1c0f5e[_0x21f8('0x18')]||'no';this[_0x21f8('0x19')]=!![];this[_0x21f8('0x1a')]='';this[_0x21f8('0x1b')]=0x0;this[_0x21f8('0x1c')]=0x0;this[_0x21f8('0x1d')]=_0x1c0f5e[_0x21f8('0x1d')]||null;this[_0x21f8('0x1e')]=_0x1c0f5e[_0x21f8('0x1e')]?_0x1c0f5e[_0x21f8('0x1e')]:null;this[_0x21f8('0x1f')]=_0x1c0f5e['dialActive'];this[_0x21f8('0x20')]=_0x1c0f5e[_0x21f8('0x20')]||_0x21f8('0x21');this[_0x21f8('0x22')]=_0x1c0f5e[_0x21f8('0x22')]||0x0;this[_0x21f8('0x23')]=_0x1c0f5e[_0x21f8('0x23')]||0x0;this[_0x21f8('0x24')]=_0x1c0f5e[_0x21f8('0x24')]||0x1;this[_0x21f8('0x25')]=_0x1c0f5e[_0x21f8('0x25')]||_0x21f8('0x26');this[_0x21f8('0x27')]=_0x1c0f5e[_0x21f8('0x27')]||0.03;this[_0x21f8('0x28')]=_0x1c0f5e['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x1c0f5e['dialOriginateCallerIdName']||_0x21f8('0x29');this[_0x21f8('0x2a')]=_0x1c0f5e[_0x21f8('0x2a')]||_0x21f8('0x29');this[_0x21f8('0x2b')]=_0x1c0f5e[_0x21f8('0x2b')]||0x1e;this[_0x21f8('0x2c')]=_0x1c0f5e[_0x21f8('0x2c')]||'tTxX';this[_0x21f8('0x2d')]=_0x1c0f5e[_0x21f8('0x2d')]||0x3;this['dialQueueProject']=_0x1c0f5e['dialQueueProject']||undefined;this[_0x21f8('0x2e')]=_0x1c0f5e[_0x21f8('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x1c0f5e[_0x21f8('0x2f')]||0x96;this[_0x21f8('0x30')]=_0x1c0f5e[_0x21f8('0x30')]||0x3;this[_0x21f8('0x31')]=_0x1c0f5e[_0x21f8('0x31')]||0x96;this[_0x21f8('0x32')]=_0x1c0f5e['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x1c0f5e[_0x21f8('0x33')]||0x96;this[_0x21f8('0x34')]=_0x1c0f5e[_0x21f8('0x34')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1c0f5e[_0x21f8('0x35')]||0x96;this['dialDropMaxRetry']=_0x1c0f5e[_0x21f8('0x36')]||0x3;this[_0x21f8('0x37')]=_0x1c0f5e['dialDropRetryFrequency']||0x96;this[_0x21f8('0x38')]=_0x1c0f5e[_0x21f8('0x38')]||0x3;this[_0x21f8('0x39')]=_0x1c0f5e['dialAbandonedRetryFrequency']||0x96;this[_0x21f8('0x3a')]=_0x1c0f5e[_0x21f8('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x1c0f5e[_0x21f8('0x3b')]||0x96;this[_0x21f8('0x3c')]=_0x1c0f5e['dialAgentRejectMaxRetry']||0x3;this[_0x21f8('0x3d')]=_0x1c0f5e[_0x21f8('0x3d')]||0x96;this[_0x21f8('0x3e')]=_0x1c0f5e[_0x21f8('0x3e')]||0x4;this[_0x21f8('0x3f')]=_0x1c0f5e[_0x21f8('0x3f')]?_0x1c0f5e[_0x21f8('0x3f')]:undefined;this['TrunkBackup']=_0x1c0f5e[_0x21f8('0x40')]?_0x1c0f5e[_0x21f8('0x40')]:undefined;this[_0x21f8('0x41')]=_0x1c0f5e[_0x21f8('0x41')]||undefined;this[_0x21f8('0x42')]=_0x1c0f5e[_0x21f8('0x42')]?_0x1c0f5e['Interval']:undefined;this['dialOrderByScheduledAt']=_0x1c0f5e[_0x21f8('0x43')]||_0x21f8('0x44');this[_0x21f8('0x45')]=_0x1c0f5e[_0x21f8('0x45')]||undefined;this[_0x21f8('0x46')]=_0x1c0f5e[_0x21f8('0x46')]||undefined;this['strategy']=strategy[_0x1c0f5e[_0x21f8('0x47')]]||_0x21f8('0xa');this[_0x21f8('0x48')]=!![];this[_0x21f8('0x49')]=_0x1c0f5e[_0x21f8('0x49')]||![];this[_0x21f8('0x4a')]=_0x1c0f5e[_0x21f8('0x4a')];this[_0x21f8('0x4b')]=_0x1c0f5e[_0x21f8('0x4b')];this[_0x21f8('0x4c')]=_0x1c0f5e[_0x21f8('0x4c')];this[_0x21f8('0x4d')]=_0x1c0f5e[_0x21f8('0x4d')];this[_0x21f8('0x4e')]=_0x1c0f5e[_0x21f8('0x4e')];this['dialAMDBetweenWordsSilence']=_0x1c0f5e['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x1c0f5e['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x1c0f5e[_0x21f8('0x4f')];this[_0x21f8('0x50')]=_0x1c0f5e[_0x21f8('0x50')];this[_0x21f8('0x51')]=0x0;this[_0x21f8('0x52')]=0x0;this[_0x21f8('0x53')]=_0x1c0f5e[_0x21f8('0x53')];this[_0x21f8('0x54')]=0x0;this[_0x21f8('0x55')]=0x0;this[_0x21f8('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x21f8('0x57')]=0x0;this[_0x21f8('0x58')]=0x0;this[_0x21f8('0x59')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x21f8('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x21f8('0x5b')]=0x0;this[_0x21f8('0x5c')]=0x0;this['outboundReCallsDay']=0x0;this[_0x21f8('0x5d')]=0x0;this[_0x21f8('0x5e')]=undefined;this[_0x21f8('0x5f')]=undefined;this['handlePredictive']=undefined;this[_0x21f8('0x60')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x21f8('0x61')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x21f8('0x62')]=0x0;this[_0x21f8('0x63')]=0x0;this[_0x21f8('0x64')]=0x0;this[_0x21f8('0x65')]=0x0;this[_0x21f8('0x66')]=_0x1c0f5e[_0x21f8('0x67')]||0x14;this[_0x21f8('0x68')]=_0x1c0f5e[_0x21f8('0x67')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x21f8('0x69')]=0x0;this[_0x21f8('0x6a')]=0x1;this[_0x21f8('0x6b')]=0x0;this[_0x21f8('0x6c')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x21f8('0x6d')]=0x0;this[_0x21f8('0x6e')]=_0x1c0f5e['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x1c0f5e['dialRecallInQueue']||![];this[_0x21f8('0x6f')]=_0x1c0f5e[_0x21f8('0x6f')]||undefined;this[_0x21f8('0x70')]=_0x1c0f5e[_0x21f8('0x70')]||![];this['dialAgiAfterHangupAgent']=_0x1c0f5e[_0x21f8('0x71')]||![];this[_0x21f8('0xd')]=monitorFormat[_0x1c0f5e[_0x21f8('0xd')]]?monitorFormat[_0x1c0f5e[_0x21f8('0xd')]]:undefined;this['mandatoryDisposition']=_0x1c0f5e[_0x21f8('0x72')]||![];this['mandatoryDispositionPause']=_0x1c0f5e[_0x21f8('0x73')]?_0x1c0f5e[_0x21f8('0x73')]:undefined;}module[_0x21f8('0x74')]=VoiceQueue; \ No newline at end of file +var _0x40b8=['dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','unavailable','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x40b8,0x79));var _0x840b=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x40b8[_0x525c7b];return _0x27b33e;};'use strict';var statusDesc=[_0x840b('0x0'),_0x840b('0x1'),'inuse','busy',_0x840b('0x2'),_0x840b('0x3'),'ringing','ringinuse','onhold'];var monitorFormat={'wav':_0x840b('0x4'),'wav49':_0x840b('0x5'),'gsm':_0x840b('0x6')};var strategy={'rrmemory':_0x840b('0x7'),'roundrobin':_0x840b('0x8')};function VoiceQueue(_0x346822){this['id']=_0x346822['id']||0x0;this['name']=_0x346822[_0x840b('0x9')]||'';this[_0x840b('0xa')]=_0x346822[_0x840b('0xa')]||'';this[_0x840b('0xb')]=_0x346822[_0x840b('0xb')]||_0x840b('0xc');this[_0x840b('0xd')]=0x0;this[_0x840b('0xe')]=0x0;this[_0x840b('0xf')]=0x0;this[_0x840b('0x10')]=0x0;this['sumDuration']=0x0;this[_0x840b('0x11')]=0x0;this[_0x840b('0x12')]=0x0;this['unmanaged']=0x0;this[_0x840b('0x13')]=0x0;this['loggedIn']=0x0;this[_0x840b('0x14')]=0x0;this[_0x840b('0x15')]=_0x346822['acw']||![];this[_0x840b('0x16')]=_0x346822['acwTimeout']||0xa;this['autopause']=_0x346822['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this['originated']=0x0;this[_0x840b('0x17')]=0x0;this[_0x840b('0x18')]=_0x346822[_0x840b('0x18')]||null;this[_0x840b('0x19')]=_0x346822['dialGlobalInterval']?_0x346822[_0x840b('0x19')]:null;this[_0x840b('0x1a')]=_0x346822['dialActive'];this[_0x840b('0x1b')]=_0x346822['dialMethod']||_0x840b('0x1c');this[_0x840b('0x1d')]=_0x346822['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x346822['dialLimitQueue']||0x0;this[_0x840b('0x1e')]=_0x346822[_0x840b('0x1e')]||0x1;this[_0x840b('0x1f')]=_0x346822[_0x840b('0x1f')]||'dropRate';this[_0x840b('0x20')]=_0x346822[_0x840b('0x20')]||0.03;this[_0x840b('0x21')]=_0x346822[_0x840b('0x21')]||0x258;this[_0x840b('0x22')]=_0x346822['dialOriginateCallerIdName']||_0x840b('0x23');this[_0x840b('0x24')]=_0x346822[_0x840b('0x24')]||_0x840b('0x23');this[_0x840b('0x25')]=_0x346822[_0x840b('0x25')]||0x1e;this[_0x840b('0x26')]=_0x346822[_0x840b('0x26')]||'tTxX';this[_0x840b('0x27')]=_0x346822[_0x840b('0x27')]||0x3;this['dialQueueProject']=_0x346822[_0x840b('0x28')]||undefined;this[_0x840b('0x29')]=_0x346822[_0x840b('0x29')]||0x3;this[_0x840b('0x2a')]=_0x346822[_0x840b('0x2a')]||0x96;this['dialBusyMaxRetry']=_0x346822[_0x840b('0x2b')]||0x3;this[_0x840b('0x2c')]=_0x346822[_0x840b('0x2c')]||0x96;this['dialNoAnswerMaxRetry']=_0x346822[_0x840b('0x2d')]||0x3;this[_0x840b('0x2e')]=_0x346822[_0x840b('0x2e')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x346822['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x346822[_0x840b('0x2f')]||0x96;this[_0x840b('0x30')]=_0x346822[_0x840b('0x30')]||0x3;this[_0x840b('0x31')]=_0x346822[_0x840b('0x31')]||0x96;this[_0x840b('0x32')]=_0x346822[_0x840b('0x32')]||0x3;this['dialAbandonedRetryFrequency']=_0x346822[_0x840b('0x33')]||0x96;this[_0x840b('0x34')]=_0x346822[_0x840b('0x34')]||0x3;this['dialMachineRetryFrequency']=_0x346822[_0x840b('0x35')]||0x96;this['dialAgentRejectMaxRetry']=_0x346822[_0x840b('0x36')]||0x3;this['dialAgentRejectRetryFrequency']=_0x346822['dialAgentRejectRetryFrequency']||0x96;this[_0x840b('0x37')]=_0x346822['dialGlobalMaxRetry']||0x4;this[_0x840b('0x38')]=_0x346822[_0x840b('0x38')]?_0x346822[_0x840b('0x38')]:undefined;this[_0x840b('0x39')]=_0x346822['TrunkBackup']?_0x346822[_0x840b('0x39')]:undefined;this['dialPrefix']=_0x346822[_0x840b('0x3a')]||undefined;this[_0x840b('0x3b')]=_0x346822[_0x840b('0x3b')]?_0x346822[_0x840b('0x3b')]:undefined;this[_0x840b('0x3c')]=_0x346822[_0x840b('0x3c')]||_0x840b('0x3d');this[_0x840b('0x3e')]=_0x346822[_0x840b('0x3e')]||undefined;this['dialCutDigit']=_0x346822[_0x840b('0x3f')]||undefined;this[_0x840b('0x40')]=strategy[_0x346822[_0x840b('0x40')]]||'rrmemory';this[_0x840b('0x41')]=!![];this[_0x840b('0x42')]=_0x346822['dialAMDActive']||![];this[_0x840b('0x43')]=_0x346822[_0x840b('0x43')];this[_0x840b('0x44')]=_0x346822['dialAMDGreeting'];this[_0x840b('0x45')]=_0x346822['dialAMDAfterGreetingSilence'];this[_0x840b('0x46')]=_0x346822[_0x840b('0x46')];this[_0x840b('0x47')]=_0x346822['dialAMDMinWordLength'];this[_0x840b('0x48')]=_0x346822[_0x840b('0x48')];this['dialAMDMaximumNumberOfWords']=_0x346822[_0x840b('0x49')];this['dialAMDSilenceThreshold']=_0x346822[_0x840b('0x4a')];this[_0x840b('0x4b')]=_0x346822[_0x840b('0x4b')];this[_0x840b('0x4c')]=0x0;this[_0x840b('0x4d')]=0x0;this[_0x840b('0x4e')]=_0x346822[_0x840b('0x4e')];this['outboundAnswerCallsDay']=0x0;this[_0x840b('0x4f')]=0x0;this[_0x840b('0x50')]=0x0;this[_0x840b('0x51')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x840b('0x52')]=0x0;this[_0x840b('0x53')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x840b('0x54')]=0x0;this[_0x840b('0x55')]=0x0;this[_0x840b('0x56')]=0x0;this[_0x840b('0x57')]=undefined;this[_0x840b('0x58')]=undefined;this[_0x840b('0x59')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x840b('0x5a')]=0x0;this[_0x840b('0x5b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x840b('0x5c')]=0x0;this[_0x840b('0x5d')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x840b('0x5e')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x346822[_0x840b('0x5f')]||0x14;this[_0x840b('0x60')]=_0x346822['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x840b('0x61')]=0x1;this[_0x840b('0x62')]=0x0;this[_0x840b('0x63')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x840b('0x64')]=0x0;this[_0x840b('0x65')]=_0x346822[_0x840b('0x65')]||0x1e;this['dialRecallInQueue']=_0x346822['dialRecallInQueue']||![];this[_0x840b('0x66')]=_0x346822['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x346822[_0x840b('0x67')]||![];this[_0x840b('0x68')]=_0x346822[_0x840b('0x68')]||![];this['monitor_format']=monitorFormat[_0x346822['monitor_format']]?monitorFormat[_0x346822[_0x840b('0xa')]]:undefined;this[_0x840b('0x69')]=_0x346822['mandatoryDisposition']||![];this[_0x840b('0x6a')]=_0x346822[_0x840b('0x6a')]?_0x346822[_0x840b('0x6a')]:undefined;}module[_0x840b('0x6b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 0dba724..b352785 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 _0x876c=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x876c,0x12f));var _0xc876=function(_0x7fd850,_0x5ba49c){_0x7fd850=_0x7fd850-0x0;var _0x492643=_0x876c[_0x7fd850];return _0x492643;};'use strict';function VtigerAccount(_0x74656){this['id']=_0x74656['id']||0x0;this[_0xc876('0x0')]=_0x74656[_0xc876('0x0')]||'';this[_0xc876('0x1')]=_0x74656[_0xc876('0x1')]||'';this['accessKey']=_0x74656[_0xc876('0x2')]||'';this['remoteUri']=_0x74656[_0xc876('0x3')]||'';this[_0xc876('0x4')]=_0x74656[_0xc876('0x4')]||'';this[_0xc876('0x5')]=_0x74656[_0xc876('0x5')]||{};}module[_0xc876('0x6')]=VtigerAccount; \ No newline at end of file +var _0xfa58=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x485d75,_0x5732d6){var _0x44b777=function(_0x4fa790){while(--_0x4fa790){_0x485d75['push'](_0x485d75['shift']());}};_0x44b777(++_0x5732d6);}(_0xfa58,0x163));var _0x8fa5=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0xfa58[_0x38a3d6];return _0x3768d7;};'use strict';function VtigerAccount(_0x14b133){this['id']=_0x14b133['id']||0x0;this[_0x8fa5('0x0')]=_0x14b133[_0x8fa5('0x0')]||'';this[_0x8fa5('0x1')]=_0x14b133[_0x8fa5('0x1')]||'';this['accessKey']=_0x14b133[_0x8fa5('0x2')]||'';this[_0x8fa5('0x3')]=_0x14b133['remoteUri']||'';this[_0x8fa5('0x4')]=_0x14b133[_0x8fa5('0x4')]||'';this['Configurations']=_0x14b133[_0x8fa5('0x5')]||{};}module[_0x8fa5('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 a65bb4a..82c9eab 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 _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x543368,_0x45abbf){var _0x355f86=function(_0x7c7545){while(--_0x7c7545){_0x543368['push'](_0x543368['shift']());}};_0x355f86(++_0x45abbf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x0b0e,0x187));var _0xe0b0=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x0b0e[_0x19ef2b];return _0x4df537;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 082a7be..82d8394 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 _0xa8b1=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId'];(function(_0x1e31fa,_0x2dea6b){var _0x1b9c65=function(_0x3dbe83){while(--_0x3dbe83){_0x1e31fa['push'](_0x1e31fa['shift']());}};_0x1b9c65(++_0x2dea6b);}(_0xa8b1,0x182));var _0x1a8b=function(_0x3626b3,_0x2fe74b){_0x3626b3=_0x3626b3-0x0;var _0x471fd3=_0xa8b1[_0x3626b3];return _0x471fd3;};'use strict';function ZohoAccount(_0x844f27){this['id']=_0x844f27['id']||0x0;this[_0x1a8b('0x0')]=_0x844f27[_0x1a8b('0x0')]||'';this[_0x1a8b('0x1')]=_0x844f27[_0x1a8b('0x1')]||'';this[_0x1a8b('0x2')]=_0x844f27[_0x1a8b('0x2')]||'';this['zone']=_0x844f27['zone']||'';this[_0x1a8b('0x3')]=_0x844f27[_0x1a8b('0x3')]||'';this['clientSecret']=_0x844f27[_0x1a8b('0x4')]||'';this[_0x1a8b('0x5')]=_0x844f27[_0x1a8b('0x5')]||'';this['code']=_0x844f27[_0x1a8b('0x6')]||'';this[_0x1a8b('0x7')]=_0x844f27[_0x1a8b('0x7')]||'';this[_0x1a8b('0x8')]=_0x844f27[_0x1a8b('0x8')]||{};}module[_0x1a8b('0x9')]=ZohoAccount; \ No newline at end of file +var _0xb114=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x23c02c,_0x27037e){var _0x5b0384=function(_0x350c7d){while(--_0x350c7d){_0x23c02c['push'](_0x23c02c['shift']());}};_0x5b0384(++_0x27037e);}(_0xb114,0x11f));var _0x4b11=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb114[_0x53ccf2];return _0x5a2964;};'use strict';function ZohoAccount(_0x174ce5){this['id']=_0x174ce5['id']||0x0;this['name']=_0x174ce5[_0x4b11('0x0')]||'';this[_0x4b11('0x1')]=_0x174ce5['description']||'';this[_0x4b11('0x2')]=_0x174ce5[_0x4b11('0x2')]||'';this[_0x4b11('0x3')]=_0x174ce5[_0x4b11('0x3')]||'';this[_0x4b11('0x4')]=_0x174ce5[_0x4b11('0x4')]||'';this['clientSecret']=_0x174ce5[_0x4b11('0x5')]||'';this[_0x4b11('0x6')]=_0x174ce5[_0x4b11('0x6')]||'';this[_0x4b11('0x7')]=_0x174ce5[_0x4b11('0x7')]||'';this[_0x4b11('0x8')]=_0x174ce5[_0x4b11('0x8')]||'';this['Configurations']=_0x174ce5[_0x4b11('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 195f91c..fd72af0 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 _0x3ee6=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','isNil','string','idContact','queue','name','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0x3ee6,0x86));var _0x63ee=function(_0x59985a,_0x2ead45){_0x59985a=_0x59985a-0x0;var _0x29ae3b=_0x3ee6[_0x59985a];return _0x29ae3b;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x4a9213,_0x420b55,_0x105c36){var _0x1f1f3b='';if(!_[_0x63ee('0x0')](_0x420b55)&&'string'===typeof _0x420b55){_0x1f1f3b+=_0x420b55;}if(!_[_0x63ee('0x0')](_0x105c36)&&_0x63ee('0x1')===typeof _0x105c36){_0x1f1f3b+='\x20'+_0x105c36;}if(_0x1f1f3b!==''){return _0x1f1f3b;}return _0x4a9213;}function Action(_0x4f4885,_0x1daaa2,_0x43f4be,_0x4400c8,_0x407247){this['uniqueid']=_0x43f4be||undefined;this[_0x63ee('0x2')]=_0x4f4885['id'];this[_0x63ee('0x3')]=_0x1daaa2[_0x63ee('0x4')];this['type']=_0x1daaa2['type'];this[_0x63ee('0x5')]=_0x63ee('0x3');this[_0x63ee('0x6')]=![];this[_0x63ee('0x7')]=_['isNil'](_0x4f4885[_0x63ee('0x8')])?undefined:_0x4f4885[_0x63ee('0x8')][_0x63ee('0x4')];this[_0x63ee('0x9')]=this['membername']?util[_0x63ee('0xa')](_0x63ee('0xb'),this['membername']):_0x4400c8||undefined;this[_0x63ee('0xc')]=checkNameSurname(_0x4f4885[_0x63ee('0xd')][_0x63ee('0xe')],_0x4f4885[_0x63ee('0xd')]['firstName'],_0x4f4885['Contact'][_0x63ee('0xf')]);this[_0x63ee('0x10')]=_0x4f4885[_0x63ee('0x10')]||![];this[_0x63ee('0x11')]=_0x4f4885['Contact'][_0x63ee('0xe')];this[_0x63ee('0x12')]=_0x4f4885['scheduledat'];this['countbusyretry']=_0x4f4885[_0x63ee('0x13')]||0x0;this['countcongestionretry']=_0x4f4885[_0x63ee('0x14')]||0x0;this[_0x63ee('0x15')]=_0x4f4885[_0x63ee('0x15')]||0x0;this['countglobal']=(_0x4f4885['countbusyretry']||0x0)+(_0x4f4885[_0x63ee('0x14')]||0x0)+(_0x4f4885['countnoanswerretry']||0x0)+(_0x4f4885[_0x63ee('0x16')]||0x0)+(_0x4f4885[_0x63ee('0x17')]||0x0)+(_0x4f4885[_0x63ee('0x18')]||0x0)+(_0x4f4885[_0x63ee('0x19')]||0x0)+(_0x4f4885[_0x63ee('0x1a')]||0x0);this['countnosuchnumberretry']=_0x4f4885['countnosuchnumberretry']||0x0;this[_0x63ee('0x17')]=_0x4f4885[_0x63ee('0x17')]||0x0;this[_0x63ee('0x18')]=_0x4f4885[_0x63ee('0x18')]||0x0;this[_0x63ee('0x19')]=_0x4f4885[_0x63ee('0x19')]||0x0;this[_0x63ee('0x1a')]=_0x4f4885['countagentrejectretry']||0x0;this[_0x63ee('0x1b')]=_0x4f4885[_0x63ee('0x1b')];this[_0x63ee('0x1c')]=_0x4f4885[_0x63ee('0x1c')];this['callbackat']=_0x4f4885['callbackat'];this[_0x63ee('0x1d')]=_0x4f4885['recallme'];this[_0x63ee('0x1e')]=_0x4f4885[_0x63ee('0x1e')];this['ListId']=_0x4f4885[_0x63ee('0x1f')];this[_0x63ee('0x20')]=_[_0x63ee('0x0')](_0x4f4885['Agent'])?_0x4f4885[_0x63ee('0x20')]:_0x4f4885['Agent']['id'];this['VoiceQueueId']=_0x4f4885[_0x63ee('0x21')];this[_0x63ee('0x22')]='';this['originatecalleridname']='';}Action[_0x63ee('0x23')][_0x63ee('0x24')]=function(){return util[_0x63ee('0xa')](_0x63ee('0x25'),this[_0x63ee('0xc')],this[_0x63ee('0x26')]);};module['exports']=Action; \ No newline at end of file +var _0xc716=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x2683d3,_0x1d4213){var _0x4de0af=function(_0x19eb0b){while(--_0x19eb0b){_0x2683d3['push'](_0x2683d3['shift']());}};_0x4de0af(++_0x1d4213);}(_0xc716,0x1b5));var _0x6c71=function(_0x2c899f,_0x4d87e3){_0x2c899f=_0x2c899f-0x0;var _0x2227fe=_0xc716[_0x2c899f];return _0x2227fe;};'use strict';var util=require(_0x6c71('0x0'));var _=require(_0x6c71('0x1'));var moment=require(_0x6c71('0x2'));function checkNameSurname(_0xf40723,_0x2180c8,_0x5411e7){var _0x1ff17c='';if(!_[_0x6c71('0x3')](_0x2180c8)&&_0x6c71('0x4')===typeof _0x2180c8){_0x1ff17c+=_0x2180c8;}if(!_[_0x6c71('0x3')](_0x5411e7)&&'string'===typeof _0x5411e7){_0x1ff17c+='\x20'+_0x5411e7;}if(_0x1ff17c!==''){return _0x1ff17c;}return _0xf40723;}function Action(_0x3c4e07,_0x3707f3,_0x543d13,_0x57774b,_0x1b40d2){this[_0x6c71('0x5')]=_0x543d13||undefined;this[_0x6c71('0x6')]=_0x3c4e07['id'];this[_0x6c71('0x7')]=_0x3707f3[_0x6c71('0x8')];this[_0x6c71('0x9')]=_0x3707f3['type'];this['campaigntype']=_0x6c71('0x7');this[_0x6c71('0xa')]=![];this[_0x6c71('0xb')]=_[_0x6c71('0x3')](_0x3c4e07['Agent'])?undefined:_0x3c4e07[_0x6c71('0xc')][_0x6c71('0x8')];this['channelAgent']=this[_0x6c71('0xb')]?util[_0x6c71('0xd')](_0x6c71('0xe'),this[_0x6c71('0xb')]):_0x57774b||undefined;this[_0x6c71('0xf')]=checkNameSurname(_0x3c4e07[_0x6c71('0x10')]['phone'],_0x3c4e07[_0x6c71('0x10')][_0x6c71('0x11')],_0x3c4e07[_0x6c71('0x10')]['lastName']);this[_0x6c71('0x12')]=_0x3c4e07[_0x6c71('0x12')]||![];this[_0x6c71('0x13')]=_0x3c4e07[_0x6c71('0x10')][_0x6c71('0x14')];this[_0x6c71('0x15')]=_0x3c4e07[_0x6c71('0x15')];this[_0x6c71('0x16')]=_0x3c4e07[_0x6c71('0x16')]||0x0;this['countcongestionretry']=_0x3c4e07[_0x6c71('0x17')]||0x0;this[_0x6c71('0x18')]=_0x3c4e07[_0x6c71('0x18')]||0x0;this[_0x6c71('0x19')]=(_0x3c4e07[_0x6c71('0x16')]||0x0)+(_0x3c4e07[_0x6c71('0x17')]||0x0)+(_0x3c4e07[_0x6c71('0x18')]||0x0)+(_0x3c4e07['countnosuchnumberretry']||0x0)+(_0x3c4e07['countdropretry']||0x0)+(_0x3c4e07[_0x6c71('0x1a')]||0x0)+(_0x3c4e07[_0x6c71('0x1b')]||0x0)+(_0x3c4e07['countagentrejectretry']||0x0);this[_0x6c71('0x1c')]=_0x3c4e07[_0x6c71('0x1c')]||0x0;this['countdropretry']=_0x3c4e07['countdropretry']||0x0;this[_0x6c71('0x1a')]=_0x3c4e07[_0x6c71('0x1a')]||0x0;this[_0x6c71('0x1b')]=_0x3c4e07[_0x6c71('0x1b')]||0x0;this[_0x6c71('0x1d')]=_0x3c4e07['countagentrejectretry']||0x0;this[_0x6c71('0x1e')]=_0x3c4e07[_0x6c71('0x1e')];this[_0x6c71('0x1f')]=_0x3c4e07[_0x6c71('0x1f')];this[_0x6c71('0x20')]=_0x3c4e07[_0x6c71('0x20')];this[_0x6c71('0x21')]=_0x3c4e07[_0x6c71('0x21')];this['ContactId']=_0x3c4e07[_0x6c71('0x22')];this[_0x6c71('0x23')]=_0x3c4e07[_0x6c71('0x23')];this[_0x6c71('0x24')]=_[_0x6c71('0x3')](_0x3c4e07[_0x6c71('0xc')])?_0x3c4e07[_0x6c71('0x24')]:_0x3c4e07['Agent']['id'];this['VoiceQueueId']=_0x3c4e07[_0x6c71('0x25')];this[_0x6c71('0x26')]='';this[_0x6c71('0x27')]='';}Action[_0x6c71('0x28')][_0x6c71('0x29')]=function(){return util[_0x6c71('0xd')](_0x6c71('0x2a'),this[_0x6c71('0xf')],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 30a11fd..7d1cc8e 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 _0x4d79=['NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','called','Calling','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','run','unlock','unlockContact','execRun','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','Action','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','actionPreview','./rpcDb','defaults','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','bind','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','blindtransfer','syncBlindTransfer','emit','outbound','name','strategy','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','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','sendMessageOneNotActive','pTalking','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','loopCampaigns','syncCampaigns','preview','clearZombieChannels','setMessage','recallMe','[clearZombieChannels][talking]','actions','originated:\x20','pTalking:\x20','dialAnswer','pick','VoiceQueueId','ListId','status','channel','updateOriginated','queue','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','isNil','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency'];(function(_0x51b42e,_0x8dea09){var _0x43ed23=function(_0x2de749){while(--_0x2de749){_0x51b42e['push'](_0x51b42e['shift']());}};_0x43ed23(++_0x8dea09);}(_0x4d79,0x8f));var _0x94d7=function(_0x272d8a,_0x45184b){_0x272d8a=_0x272d8a-0x0;var _0x26286e=_0x4d79[_0x272d8a];return _0x26286e;};'use strict';var util=require(_0x94d7('0x0'));var _=require(_0x94d7('0x1'));var BPromise=require(_0x94d7('0x2'));var uuid=require(_0x94d7('0x3'));var moment=require(_0x94d7('0x4'));var md5=require(_0x94d7('0x5'));var Redis=require(_0x94d7('0x6'));var config=require('../../../config/environment');var logger=require(_0x94d7('0x7'))('preview');var loggerAction=require(_0x94d7('0x7'))(_0x94d7('0x8'));var ami=require('../ami');var rpcDb=require(_0x94d7('0x9'));var Action=require('./action');var ut=require('./util/util');config['redis']=_[_0x94d7('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x94d7('0xb'))(new Redis(config[_0x94d7('0xc')]));var Sequence=function(){};Sequence[_0x94d7('0xd')][_0x94d7('0xe')]=function(_0x358ebf){this[_0x94d7('0xf')]=this[_0x94d7('0xf')]?this['tail'][_0x94d7('0x10')](_0x358ebf):_0x358ebf();};function Preview(_0x4e4e27){this[_0x94d7('0x11')]=new Sequence();this[_0x94d7('0x12')]=_0x4e4e27[_0x94d7('0x13')];this[_0x94d7('0x14')]=_0x4e4e27[_0x94d7('0x14')];this['actions']={};this[_0x94d7('0x15')]=_0x4e4e27[_0x94d7('0x15')];this[_0x94d7('0x16')]=0x0;ami['on'](_0x94d7('0x17'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x94d7('0x18'),this[_0x94d7('0x19')][_0x94d7('0x1a')](this));ami['on']('hanguprequest',this[_0x94d7('0x1b')][_0x94d7('0x1a')](this));ami['on'](_0x94d7('0x1c'),this[_0x94d7('0x1d')][_0x94d7('0x1a')](this));ami['on'](_0x94d7('0x1e'),this[_0x94d7('0x1f')]['bind'](this));ami['on'](_0x94d7('0x20'),this['syncVarSet']['bind'](this));ami['on'](_0x94d7('0x21'),this['syncAttendedTransfer'][_0x94d7('0x1a')](this));ami['on'](_0x94d7('0x22'),this[_0x94d7('0x23')][_0x94d7('0x1a')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0xd4ee6c,_0x156254,_0x2ea1a3){io['to'](_0xd4ee6c)[_0x94d7('0x24')](_0x156254,_0x2ea1a3);}function emitCampaignPreview(_0x372673){if(_0x372673['type']===_0x94d7('0x25')){var _0x17e569={'id':_0x372673['id'],'name':_0x372673[_0x94d7('0x26')],'strategy':_0x372673[_0x94d7('0x27')],'answered':_0x372673['answered'],'available':_0x372673['available'],'loggedIn':_0x372673[_0x94d7('0x28')],'pTalking':_0x372673['pTalking'],'sumBillable':_0x372673[_0x94d7('0x29')],'sumDuration':_0x372673[_0x94d7('0x2a')],'sumHoldTime':_0x372673[_0x94d7('0x2b')]||0x0,'talking':_0x372673['talking'],'total':_0x372673[_0x94d7('0x2c')],'type':_0x372673[_0x94d7('0x2d')],'unmanaged':_0x372673['unmanaged'],'abandoned':_0x372673[_0x94d7('0x2e')],'waiting':_0x372673[_0x94d7('0x2f')],'loggedInDb':_0x372673[_0x94d7('0x30')],'dialActive':_0x372673[_0x94d7('0x31')],'dialMethod':_0x372673[_0x94d7('0x32')],'dialOriginateCallerIdName':_0x372673[_0x94d7('0x33')],'dialOriginateCallerIdNumber':_0x372673[_0x94d7('0x34')],'dialOriginateTimeout':_0x372673[_0x94d7('0x35')],'dialPrefix':_0x372673[_0x94d7('0x36')],'outboundAnswerAgiCallsDay':_0x372673[_0x94d7('0x37')],'outboundAnswerCallsDay':_0x372673[_0x94d7('0x38')],'outboundBlacklistCallsDay':_0x372673[_0x94d7('0x39')],'outboundBusyCallsDay':_0x372673['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x372673[_0x94d7('0x3a')],'outboundDropCallsDayACS':_0x372673[_0x94d7('0x3b')],'outboundDropCallsDayCallersExit':_0x372673[_0x94d7('0x3c')],'outboundDropCallsDayTimeout':_0x372673[_0x94d7('0x3d')],'outboundNoAnswerCallsDay':_0x372673['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x372673[_0x94d7('0x3e')],'outboundOriginateFailureCallsDay':_0x372673[_0x94d7('0x3f')],'outboundReCallsDay':_0x372673['outboundReCallsDay'],'outboundRejectCallsDay':_0x372673[_0x94d7('0x40')],'outboundUnknownCallsDay':_0x372673[_0x94d7('0x41')],'outboundAbandonedCallsDay':_0x372673[_0x94d7('0x42')],'predictiveIntervalAnsweredCalls':_0x372673[_0x94d7('0x43')],'predictiveIntervalAvgHoldtime':_0x372673[_0x94d7('0x44')],'predictiveIntervalAvgTalktime':_0x372673[_0x94d7('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x372673['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x372673[_0x94d7('0x46')],'predictiveIntervalErlangCalls':_0x372673[_0x94d7('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x372673[_0x94d7('0x48')],'predictiveIntervalHitRate':_0x372673[_0x94d7('0x49')],'predictiveIntervalMultiplicativeFactor':_0x372673[_0x94d7('0x4a')],'predictiveIntervalPauses':_0x372673[_0x94d7('0x4b')],'predictiveIntervalAvailable':_0x372673[_0x94d7('0x4c')],'predictiveIntervalTotalCalls':_0x372673[_0x94d7('0x4d')],'message':_0x372673[_0x94d7('0x4e')],'originated':_0x372673[_0x94d7('0x4f')],'erlangCalls':_0x372673[_0x94d7('0x50')],'erlangCallToSecond':_0x372673[_0x94d7('0x51')],'erlangAbandonmentRate':_0x372673[_0x94d7('0x52')],'erlangBusyFactor':_0x372673[_0x94d7('0x53')],'startPredictive':_0x372673[_0x94d7('0x54')],'startProgressive':_0x372673[_0x94d7('0x55')]};if(_0x372673[_0x94d7('0x56')]){_0x17e569[_0x94d7('0x56')]={'id':_0x372673[_0x94d7('0x56')]['id'],'name':_0x372673[_0x94d7('0x56')][_0x94d7('0x26')],'active':_0x372673[_0x94d7('0x56')][_0x94d7('0x57')],'callerid':_0x372673[_0x94d7('0x56')][_0x94d7('0x58')]};}if(_0x372673['Interval']){_0x17e569['Interval']={'id':_0x372673[_0x94d7('0x59')]['id'],'name':_0x372673[_0x94d7('0x59')]['name']};}var _0x123e19=md5(JSON[_0x94d7('0x5a')](_0x17e569));if(_0x372673[_0x94d7('0x5')]!==_0x123e19){_0x372673[_0x94d7('0x5')]=_0x123e19;emit(util['format'](_0x94d7('0x5b'),_0x17e569[_0x94d7('0x26')]),_0x94d7('0x5c'),_0x17e569);}}}function emitVoiceQueueChannelRemove(_0x4804d1){logger[_0x94d7('0x5d')](_0x94d7('0x5e'),JSON['stringify'](_0x4804d1));emit(util[_0x94d7('0x5f')](_0x94d7('0x5b'),_0x4804d1[_0x94d7('0x26')]),_0x94d7('0x60'),_0x4804d1);}function notSendMessagesQueue(_0x4b3c99){if(_0x4b3c99[_0x94d7('0x61')]){if(_0x4b3c99[_0x94d7('0x4f')]===0x0&&_0x4b3c99[_0x94d7('0x62')]===0x0){_0x4b3c99[_0x94d7('0x61')]=![];_0x4b3c99[_0x94d7('0x63')]=0x0;_0x4b3c99[_0x94d7('0x64')]=0x0;_0x4b3c99[_0x94d7('0x4e')]=_0x94d7('0x65');ut[_0x94d7('0x66')](_0x94d7('0x67'),_0x4b3c99[_0x94d7('0x26')]+_0x94d7('0x68'));}else{_0x4b3c99[_0x94d7('0x4e')]='IS_DISACTIVED';ut[_0x94d7('0x66')](_0x94d7('0x67'),_0x4b3c99[_0x94d7('0x26')]+_0x94d7('0x69'));}emitCampaignPreview(_0x4b3c99);}}Preview[_0x94d7('0xd')][_0x94d7('0x6a')]=function(){var _0x1dda48=this;setInterval(function(){_0x1dda48[_0x94d7('0x6b')]();},0x7cf);};Preview[_0x94d7('0xd')][_0x94d7('0x6b')]=function(){var _0x27e4f9=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x44c22b in _0x27e4f9){if(_0x27e4f9['hasOwnProperty'](_0x44c22b)&&(_0x27e4f9[_0x44c22b][_0x94d7('0x32')]===_0x94d7('0x6c')||_0x27e4f9[_0x44c22b][_0x94d7('0x32')]==='booked')&&_0x27e4f9[_0x44c22b]['type']===_0x94d7('0x25')){if(this['clockClearZombieChannels']>0x7){this[_0x94d7('0x16')]=0x0;this[_0x94d7('0x6d')]();}}if(_0x27e4f9['hasOwnProperty'](_0x44c22b)&&_0x27e4f9[_0x44c22b][_0x94d7('0x32')]===_0x94d7('0x6c')&&_0x27e4f9[_0x44c22b]['type']==='outbound'){if(_0x27e4f9[_0x44c22b][_0x94d7('0x31')]){this[_0x94d7('0x6e')](_0x27e4f9[_0x44c22b]);this[_0x94d7('0x6f')](_0x27e4f9[_0x44c22b]);}else{notSendMessagesQueue(_0x27e4f9[_0x44c22b]);}}}};Preview[_0x94d7('0xd')]['clearZombieChannel']=function(_0x89a91c){var _0x483f41=this;this[_0x94d7('0x11')]['enqueue'](function(){if(!_['isNil'](_0x483f41['actions'][_0x89a91c])){loggerAction[_0x94d7('0x5d')](_0x94d7('0x70'),_0x89a91c,'Queue',_0x483f41[_0x94d7('0x71')][_0x89a91c]['queue'],_0x94d7('0x72'),JSON['stringify'](_0x483f41[_0x94d7('0x12')][_0x483f41[_0x94d7('0x71')][_0x89a91c]['queue']]['originated']),_0x94d7('0x73'),JSON[_0x94d7('0x5a')](_0x483f41[_0x94d7('0x12')][_0x483f41[_0x94d7('0x71')][_0x89a91c]['queue']][_0x94d7('0x62')]),JSON[_0x94d7('0x5a')](_0x483f41[_0x94d7('0x71')][_0x89a91c][_0x94d7('0x74')]),JSON[_0x94d7('0x5a')](_[_0x94d7('0x75')](_0x483f41[_0x94d7('0x71')][_0x89a91c],['contactId','UserId',_0x94d7('0x76'),_0x94d7('0x77')])));return ami['Action']({'action':_0x94d7('0x78'),'channel':_0x483f41[_0x94d7('0x71')][_0x89a91c][_0x94d7('0x79')]})['catch'](function(_0x590db1){if(_0x590db1[_0x94d7('0x4e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x483f41[_0x94d7('0x71')][_0x89a91c]){ut[_0x94d7('0x7a')](_0x483f41['campaignsPreview'][_0x483f41[_0x94d7('0x71')][_0x89a91c][_0x94d7('0x7b')]],'[clearZombieChannel]');if(_0x483f41[_0x94d7('0x71')][_0x89a91c]['dialAnswer']===!![]){ut[_0x94d7('0x7c')](_0x483f41[_0x94d7('0x12')][_0x483f41['actions'][_0x89a91c][_0x94d7('0x7b')]],'[clearZombieChannel]');ut[_0x94d7('0x7d')](_0x94d7('0x7e')+_0x89a91c,_0x483f41[_0x94d7('0x71')][_0x89a91c][_0x94d7('0x7b')]);}ut[_0x94d7('0x7d')]('[Dialer][checkChannel][Preview]'+_0x89a91c,_0x483f41[_0x94d7('0x71')][_0x89a91c][_0x94d7('0x7b')]);delete _0x483f41[_0x94d7('0x71')][_0x89a91c];}},0x2328);}});}});};Preview['prototype'][_0x94d7('0x6d')]=function(){var _0x404338=this;loggerAction[_0x94d7('0x5d')](_0x94d7('0x7f'),_[_0x94d7('0x80')](this[_0x94d7('0x71')]));for(var _0x549e8d in this[_0x94d7('0x71')]){if(_0x404338[_0x94d7('0x71')]['hasOwnProperty'](_0x549e8d)){_0x404338[_0x94d7('0x81')](_0x549e8d);}}};Preview[_0x94d7('0xd')][_0x94d7('0x6f')]=function(_0x1b5730){var _0xd66030=this;rpcDb[_0x94d7('0x82')](_0x1b5730['id'],ut[_0x94d7('0x83')](this[_0x94d7('0x15')]))[_0x94d7('0x84')](function(_0x23fa06){if(!_[_0x94d7('0x85')](_0x23fa06)){for(var _0x256af9=0x0;_0x256af9<_0x23fa06['length'];_0x256af9+=0x1){if(ut[_0x94d7('0x86')](_0x23fa06[_0x256af9][_0x94d7('0x87')])<_0x1b5730[_0x94d7('0x88')]*0x3c){if(_0x23fa06[_0x256af9][_0x94d7('0x89')]&&!_0x23fa06[_0x256af9]['Agent'][_0x94d7('0x8a')]){_0xd66030['run'](_0x23fa06[_0x256af9]['id'])[_0x94d7('0x84')](ut[_0x94d7('0x8b')](_0x94d7('0x8c')))[_0x94d7('0x8d')](ut[_0x94d7('0x8b')](_0x94d7('0x8c')));}else{rpcDb[_0x94d7('0x8e')](_0x23fa06[_0x256af9]['id']);}}else{var _0x5fddb6=new Action(_0x23fa06[_0x256af9],_0x1b5730);_0x5fddb6['starttime']=moment()[_0x94d7('0x5f')](_0x94d7('0x8f'));_0x1b5730[_0x94d7('0x90')]+=0x1;ut[_0x94d7('0x91')](_0x5fddb6,0x17,_0x94d7('0x92'));if(_0x1b5730['dialRecallInQueue']){rpcDb[_0x94d7('0x93')](ut['createBody'](_0x23fa06[_0x256af9]));rpcDb['createCustomerHistory'](_0x5fddb6,_0x94d7('0x94'));}else{ut[_0x94d7('0x91')](_0x5fddb6,0x16,_0x94d7('0x95'));rpcDb[_0x94d7('0x96')](_0x5fddb6,'[HistoryRecallClose]');rpcDb[_0x94d7('0x97')](_0x5fddb6,_0x94d7('0x98'));}}}}})['catch'](ut['logger2'](_0x94d7('0x99')));};Preview[_0x94d7('0xd')][_0x94d7('0x6e')]=function(_0x19bdc7){_0x19bdc7[_0x94d7('0x61')]=!![];if(ut[_0x94d7('0x9a')](_0x19bdc7['loggedIn'])){_0x19bdc7[_0x94d7('0x4e')]=_0x94d7('0x9b');}else if(!ut['isActive'](_0x19bdc7['dialActive'])){_0x19bdc7[_0x94d7('0x4e')]=_0x94d7('0x65');}else if(!this['isTrunkReachable'](_0x19bdc7[_0x94d7('0x56')])){if(!this[_0x94d7('0x9c')](_0x19bdc7[_0x94d7('0x9d')])){_0x19bdc7[_0x94d7('0x4e')]='TRUNK_IS_NOT_REACHABLE';}else{_0x19bdc7[_0x94d7('0x4e')]=_0x94d7('0x9e');}}else{_0x19bdc7[_0x94d7('0x4e')]=_0x94d7('0x9e');}emitCampaignPreview(_0x19bdc7);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x937ec5,_0x413b16,_0x1e96ff){var _0x53aff4=this;var _0x19b80b=this['actions'][_0x413b16];var _0x401f5d=this[_0x94d7('0x12')][_0x19b80b[_0x94d7('0x7b')]];var _0x18f1cb;if(_0x401f5d){switch(_0x1e96ff){case'1':_0x401f5d[_0x94d7('0x3e')]+=0x1;_0x19b80b[_0x94d7('0x9f')]+=0x1;_0x19b80b[_0x94d7('0xa0')]=ut['totalGlobal'](_0x19b80b);ut[_0x94d7('0x91')](_0x19b80b,0x0,'NoSuchNumber');ami['emit'](_0x94d7('0xa1'),ut[_0x94d7('0xa2')](_0x19b80b,_0x94d7('0xa3')));rpcDb['createCustomerHistory'](_0x19b80b,_0x94d7('0xa4'));if(ut[_0x94d7('0xa5')](_0x19b80b)>=_0x401f5d[_0x94d7('0xa6')]){_0x18f1cb=ut[_0x94d7('0xa7')](_0x19b80b,0xf,_0x94d7('0xa8'));rpcDb['createCustomerFinal'](_0x18f1cb,_0x94d7('0xa9'));}else{if(_0x19b80b[_0x94d7('0x9f')]>=_0x401f5d[_0x94d7('0xaa')]){rpcDb[_0x94d7('0x97')](_0x19b80b,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x94d7('0xab')](ut[_0x94d7('0xac')](_0x19b80b,_0x94d7('0x9f'),_0x401f5d[_0x94d7('0xad')]),_0x19b80b[_0x94d7('0xae')],_0x19b80b[_0x94d7('0xaf')]);}}delete this[_0x94d7('0x71')][_0x937ec5[_0x94d7('0xb0')]];break;case _0x94d7('0xb1'):var _0x2efaf5=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x19b80b[_0x94d7('0xb2')]=_0x2efaf5;_0x19b80b[_0x94d7('0xb3')]=_0x2efaf5;_0x19b80b[_0x94d7('0x74')]=!![];_0x401f5d[_0x94d7('0x62')]+=0x1;logger[_0x94d7('0x5d')](_0x94d7('0xb4'),_0x19b80b[_0x94d7('0xb5')],'\x20Queue',_0x401f5d[_0x94d7('0x26')],_0x94d7('0x73'),_0x401f5d[_0x94d7('0x62')]);ami[_0x94d7('0x24')](_0x94d7('0xb6'),ut[_0x94d7('0xa2')](_0x19b80b,'connect'));if(_0x401f5d['acw']){ami[_0x94d7('0x24')](_0x94d7('0xb7'),ut[_0x94d7('0xb8')](_0x19b80b));}break;case'16':ami[_0x94d7('0x24')](_0x94d7('0xb9'),ut['buildObj'](_0x19b80b,_0x94d7('0xba')));emitVoiceQueueChannelRemove(ut[_0x94d7('0xa2')](_0x19b80b,_0x94d7('0xba')));_0x401f5d[_0x94d7('0x38')]+=0x1;_0x401f5d[_0x94d7('0x2c')]+=0x1;_0x401f5d[_0x94d7('0xbb')]+=0x1;ut[_0x94d7('0x7c')](_0x401f5d,_0x94d7('0xbc'));_0x19b80b[_0x94d7('0xa0')]=ut[_0x94d7('0xa5')](_0x19b80b);ut[_0x94d7('0x91')](_0x19b80b,0x4,_0x94d7('0xbd'));rpcDb['createCustomerHistory'](_0x19b80b,_0x94d7('0xbe'));rpcDb['createCustomerFinal'](_0x19b80b,_0x94d7('0xbf'));rpcDb['crateCustomerReportQueue'](_0x19b80b);_0x401f5d['sumDuration']+=_0x19b80b['talktime'];_0x401f5d[_0x94d7('0x29')]+=_0x19b80b['talktime'];logger[_0x94d7('0x5d')](_0x94d7('0xc0'),_0x19b80b[_0x94d7('0xb5')],'\x20Queue',_0x401f5d[_0x94d7('0x26')],_0x94d7('0x73'),_0x401f5d[_0x94d7('0x62')]);delete this['actions'][_0x937ec5[_0x94d7('0xb0')]];break;case _0x94d7('0xc1'):_0x401f5d['outboundBusyCallsDay']+=0x1;_0x19b80b[_0x94d7('0xc2')]+=0x1;_0x19b80b[_0x94d7('0xa0')]=ut[_0x94d7('0xa5')](_0x19b80b);ut[_0x94d7('0x91')](_0x19b80b,0x5,'Busy');ami['emit'](_0x94d7('0xc3'),ut[_0x94d7('0xa2')](_0x19b80b,_0x94d7('0xc4')));rpcDb['createCustomerHistory'](_0x19b80b,_0x94d7('0xc5'));if(ut['totalGlobal'](_0x19b80b)>=_0x401f5d['dialGlobalMaxRetry']){_0x18f1cb=ut[_0x94d7('0xa7')](_0x19b80b,0xf,_0x94d7('0xa8'));rpcDb[_0x94d7('0x97')](_0x18f1cb,_0x94d7('0xc6'));}else{if(_0x19b80b[_0x94d7('0xc2')]>=_0x401f5d['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x19b80b,_0x94d7('0xc5'));}else{rpcDb[_0x94d7('0xab')](ut['scheduledAt'](_0x19b80b,'countbusyretry',_0x401f5d[_0x94d7('0xc7')]),_0x19b80b[_0x94d7('0xae')],_0x19b80b[_0x94d7('0xaf')]);}}break;case _0x94d7('0xc8'):_0x401f5d[_0x94d7('0xc9')]+=0x1;_0x19b80b[_0x94d7('0xca')]+=0x1;_0x19b80b['countglobal']=ut[_0x94d7('0xa5')](_0x19b80b);ut[_0x94d7('0x91')](_0x19b80b,0x3,'NoAnswer');ami[_0x94d7('0x24')](_0x94d7('0xcb'),ut[_0x94d7('0xa2')](_0x19b80b,_0x94d7('0xcc')));rpcDb[_0x94d7('0x96')](_0x19b80b,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x19b80b)>=_0x401f5d[_0x94d7('0xa6')]){_0x18f1cb=ut['cloneAction'](_0x19b80b,0xf,_0x94d7('0xa8'));rpcDb[_0x94d7('0x97')](_0x18f1cb,_0x94d7('0xcd'));}else{if(_0x19b80b['countnoanswerretry']>=_0x401f5d[_0x94d7('0xce')]){rpcDb[_0x94d7('0x97')](_0x19b80b,_0x94d7('0xcf'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x19b80b,'countnoanswerretry',_0x401f5d['dialNoAnswerRetryFrequency']),_0x19b80b[_0x94d7('0xae')],_0x19b80b['activeContact']);}}break;case _0x94d7('0xd0'):_0x401f5d[_0x94d7('0x3a')]+=0x1;_0x19b80b[_0x94d7('0xd1')]+=0x1;_0x19b80b[_0x94d7('0xa0')]=ut['totalGlobal'](_0x19b80b);ut[_0x94d7('0x91')](_0x19b80b,0x8,'Congestion');ami['emit'](_0x94d7('0xd2'),ut[_0x94d7('0xa2')](_0x19b80b,_0x94d7('0xd3')));rpcDb[_0x94d7('0x96')](_0x19b80b,_0x94d7('0xd4'));if(ut[_0x94d7('0xa5')](_0x19b80b)>=_0x401f5d['dialGlobalMaxRetry']){_0x18f1cb=ut[_0x94d7('0xa7')](_0x19b80b,0xf,_0x94d7('0xa8'));rpcDb['createCustomerFinal'](_0x18f1cb,_0x94d7('0xd5'));}else{if(_0x19b80b[_0x94d7('0xd1')]>=_0x401f5d[_0x94d7('0xd6')]){rpcDb[_0x94d7('0x97')](_0x19b80b,_0x94d7('0xd4'));}else{rpcDb[_0x94d7('0xab')](ut[_0x94d7('0xac')](_0x19b80b,'countcongestionretry',_0x401f5d['dialBusyRetryFrequency']),_0x19b80b[_0x94d7('0xae')],_0x19b80b['activeContact']);}}break;case _0x94d7('0xd7'):_0x401f5d['outboundRejectCallsDay']+=0x1;_0x19b80b[_0x94d7('0xd8')]+=0x1;_0x19b80b[_0x94d7('0xa0')]=ut[_0x94d7('0xa5')](_0x19b80b);ut[_0x94d7('0x91')](_0x19b80b,0x14,_0x94d7('0xd9'));ami[_0x94d7('0x24')](_0x94d7('0xda'),ut[_0x94d7('0xa2')](_0x19b80b,_0x94d7('0xdb')));rpcDb['createCustomerHistory'](_0x19b80b,_0x94d7('0xdc'));if(ut[_0x94d7('0xa5')](_0x19b80b)>=_0x401f5d[_0x94d7('0xa6')]){_0x18f1cb=ut[_0x94d7('0xa7')](_0x19b80b,0x14,'AgentReject');rpcDb[_0x94d7('0x97')](_0x18f1cb,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x19b80b[_0x94d7('0xd8')]>=_0x401f5d[_0x94d7('0xdd')]){rpcDb['createCustomerFinal'](_0x19b80b,_0x94d7('0xde'));}else{rpcDb[_0x94d7('0xab')](ut[_0x94d7('0xac')](_0x19b80b,_0x94d7('0xd8'),_0x401f5d[_0x94d7('0xdf')]),_0x19b80b[_0x94d7('0xae')],_0x19b80b['activeContact']);}}break;case'ABANDONED':_0x401f5d['outboundAbandonedCallsDay']+=0x1;_0x19b80b[_0x94d7('0xe0')]+=0x1;_0x19b80b[_0x94d7('0xa0')]=ut[_0x94d7('0xa5')](_0x19b80b);ut[_0x94d7('0x91')](_0x19b80b,0xb,_0x94d7('0xe1'));rpcDb[_0x94d7('0x96')](_0x19b80b,_0x94d7('0xe2'));if(ut['totalGlobal'](_0x19b80b)>=_0x401f5d[_0x94d7('0xa6')]){_0x18f1cb=ut[_0x94d7('0xa7')](_0x19b80b,0xf,'Global');rpcDb[_0x94d7('0x97')](_0x18f1cb,_0x94d7('0xe2'));}else{if(_0x19b80b[_0x94d7('0xe3')]>=_0x401f5d[_0x94d7('0xe4')]){rpcDb[_0x94d7('0x97')](_0x19b80b,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x19b80b,_0x94d7('0xe0'),_0x401f5d[_0x94d7('0xe5')]),_0x19b80b[_0x94d7('0xae')],_0x19b80b[_0x94d7('0xaf')]);}}break;default:if(_0x19b80b[_0x94d7('0x74')]){ut['decrementTalkink'](_0x401f5d,_0x94d7('0xe6'));ut[_0x94d7('0x7d')](_0x94d7('0xe7')+_0x401f5d[_0x94d7('0x26')],_0x937ec5);}_0x401f5d[_0x94d7('0x41')]+=0x1;_0x19b80b['countglobal']=ut[_0x94d7('0xa5')](_0x19b80b);ut[_0x94d7('0x91')](_0x19b80b,0xc,_0x937ec5[_0x94d7('0xe8')]||_0x937ec5[_0x94d7('0xe9')]);rpcDb[_0x94d7('0x96')](_0x19b80b,_0x94d7('0xea'));if(ut['totalGlobal'](_0x19b80b)>=_0x401f5d['dialGlobalMaxRetry']){_0x18f1cb=ut[_0x94d7('0xa7')](_0x19b80b,0xf,_0x94d7('0xa8'));rpcDb[_0x94d7('0x97')](_0x18f1cb,_0x94d7('0xeb'));}else{rpcDb[_0x94d7('0x97')](_0x19b80b,_0x94d7('0xeb'));}delete this[_0x94d7('0x71')][_0x937ec5[_0x94d7('0xb0')]];}if(!(_0x19b80b[_0x94d7('0x74')]&&_0x1e96ff==='16')){ut[_0x94d7('0x7a')](_0x401f5d,_0x94d7('0xec'));logger['info'](_0x94d7('0xed'),_0x19b80b['uniqueid'],_0x94d7('0xee'),_0x401f5d['name'],_0x94d7('0x72'),_0x401f5d['originated']);}if(_0x1e96ff!==_0x94d7('0xb1')){delete this[_0x94d7('0x71')][_0x937ec5[_0x94d7('0xb0')]];delete this['actions'][_0x937ec5[_0x94d7('0xef')]];}}};Preview['prototype'][_0x94d7('0xf0')]=function(_0x285b46,_0x1b6f5c,_0x241262){if(_['isUndefined'](_0x1b6f5c)&&_0x94d7('0xf1')!==typeof _0x1b6f5c){return;}if(_[_0x94d7('0xf2')](_0x241262)&&'object'!==typeof _0x241262){return;}switch(_0x241262[_0x94d7('0xf3')]){case'0':ut[_0x94d7('0xf4')](_0x285b46,0x0,_0x94d7('0xf5'));rpcDb[_0x94d7('0xf6')](_0x285b46,_0x94d7('0xf7'));break;case'3':ut[_0x94d7('0xf4')](_0x285b46,0x3,'NoAnswer');rpcDb[_0x94d7('0xf6')](_0x285b46,_0x94d7('0xf8'));break;case'5':ut[_0x94d7('0xf4')](_0x285b46,0x5,_0x94d7('0xf9'));rpcDb['createAgentHistory'](_0x285b46,_0x94d7('0xfa'));break;case'8':ut['logAgent'](_0x285b46,0x8,_0x94d7('0xfb'));rpcDb[_0x94d7('0xf6')](_0x285b46,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x94d7('0xf4')](_0x285b46,0x16,_0x94d7('0xfc'));rpcDb['createAgentHistory'](_0x285b46,_0x94d7('0xfd'));break;default:ut[_0x94d7('0xf4')](_0x285b46,0xc,_0x241262[_0x94d7('0xf3')]);rpcDb[_0x94d7('0xf6')](_0x285b46,_0x94d7('0xfe'));}ut[_0x94d7('0x7a')](_0x1b6f5c,_0x94d7('0xff'));logger[_0x94d7('0x5d')]('[originated][decrement][callProgressDetectingAgent]',_0x285b46[_0x94d7('0xb5')],_0x94d7('0xee'),_0x1b6f5c[_0x94d7('0x26')],_0x94d7('0x72'),_0x1b6f5c[_0x94d7('0x4f')]);delete this[_0x94d7('0x71')][_0x285b46[_0x94d7('0xb5')]];};Preview[_0x94d7('0xd')][_0x94d7('0x100')]=function(_0x494187,_0x3388f9,_0x2bb86b,_0x5aba34,_0x8644a5){var _0xbcc565=this;return new BPromise(function(_0xdaba5f,_0x2d78dc){if(_[_0x94d7('0x85')](_0x3388f9)||_[_0x94d7('0x85')](_0x3388f9[_0x94d7('0x101')])||_['isNil'](_0x3388f9[_0x94d7('0x101')][_0x94d7('0x102')])||_[_0x94d7('0x85')](_0x3388f9['VoiceQueueId'])){_0x2d78dc(ut[_0x94d7('0x4e')](_0x94d7('0x103'),_0x5aba34,_0x8644a5));return;}var _0xd3b656=uuid['v4']();var _0x4744c2=_0xbcc565[_0x94d7('0x12')][_0x3388f9['Queue']['name']];var _0x4c46ca=_0x2bb86b?_0xbcc565[_0x94d7('0x15')][_0x2bb86b]['id']:undefined;_0xbcc565[_0x94d7('0x71')][_0xd3b656]=new Action(_0x3388f9,_0x4744c2,_0xd3b656,_0x2bb86b,_0x4c46ca);var _0x1b4103=_0xbcc565[_0x94d7('0x71')][_0xd3b656];_0x1b4103[_0x94d7('0xae')]=_0x5aba34;_0x1b4103[_0x94d7('0xaf')]=_0x8644a5;_0x1b4103[_0x94d7('0x104')]=_0x2bb86b;if(_[_0x94d7('0x105')](_0x494187)){_0xbcc565[_0x94d7('0x106')](_0x1b4103,_0x4744c2,_0x3388f9,_0x2bb86b)['then'](function(_0x4359ee){logger['info'](_0x94d7('0x107'),_0x94d7('0x108')+_0x1b4103['queue']+'\x20IdHopper:\x20'+_0x1b4103[_0x94d7('0x109')],JSON['stringify'](_0x4359ee));ami[_0x94d7('0x24')]('custom:agentcalled',ut[_0x94d7('0xa2')](_0x1b4103,_0x94d7('0x10a')));_0xdaba5f(ut[_0x94d7('0x4e')](_0x94d7('0x10b')));})[_0x94d7('0x8d')](function(_0x5486c2){ut[_0x94d7('0x66')]('[Preview][execCall][failure]',_0x5486c2);_0x2d78dc(ut[_0x94d7('0x4e')]('Call\x20failed',_0x5aba34,_0x8644a5));});}else{_0x4744c2[_0x94d7('0x39')]+=0x1;ut[_0x94d7('0x10c')](_0x1b4103);rpcDb[_0x94d7('0x10d')](_0x1b4103,'[Blacklist][error]');delete _0xbcc565[_0x94d7('0x71')][_0xd3b656];_0x2d78dc(ut[_0x94d7('0x4e')](_0x94d7('0x10e'),_0x5aba34,_0x8644a5));}});};Preview[_0x94d7('0xd')]['isTrunkReachable']=function(_0x4f116d){return!_['isNil'](_0x4f116d)&&!_[_0x94d7('0x85')](_0x4f116d[_0x94d7('0x26')])&&!_[_0x94d7('0x85')](_0x4f116d['active'])&&_0x4f116d[_0x94d7('0x57')]&&!_[_0x94d7('0x85')](this[_0x94d7('0x14')][util[_0x94d7('0x5f')](_0x94d7('0x10f'),_0x4f116d[_0x94d7('0x26')])])&&!_['isNil'](this[_0x94d7('0x14')][util['format']('SIP/%s',_0x4f116d['name'])][_0x94d7('0x78')])&&(this[_0x94d7('0x14')][util['format'](_0x94d7('0x10f'),_0x4f116d[_0x94d7('0x26')])][_0x94d7('0x78')]==='reachable'||this[_0x94d7('0x14')][util['format'](_0x94d7('0x10f'),_0x4f116d['name'])][_0x94d7('0x78')]===_0x94d7('0x110'));};Preview['prototype'][_0x94d7('0x111')]=function(_0x36b57d,_0x50c606){var _0x395ecd=this;return new BPromise(function(_0x5a2a01,_0x35bf93){_0x395ecd['execRun'](_0x36b57d,_0x50c606)[_0x94d7('0x84')](function(_0x6e93c0){_0x5a2a01(_[_0x94d7('0x75')](_0x6e93c0,[_0x94d7('0x4e')]));})['catch'](function(_0x2819be){if(_0x2819be[_0x94d7('0x112')]){rpcDb[_0x94d7('0x113')](_0x36b57d);}if(_0x2819be[_0x94d7('0x57')]){rpcDb['disableContact'](_0x36b57d);}_0x35bf93(_[_0x94d7('0x75')](_0x2819be,[_0x94d7('0x4e')]));});});};Preview[_0x94d7('0xd')][_0x94d7('0x114')]=function(_0x254339,_0x10a325){var _0x5d5a8d=this;return new BPromise(function(_0x178b80,_0x145546){var _0x43c7c8,_0x496054;rpcDb[_0x94d7('0x115')](_0x254339)[_0x94d7('0x84')](function(_0xae700){if(!_[_0x94d7('0x85')](_0xae700[0x0])){_0x496054=_0xae700[0x0]['recallme']?![]:!![];_0x43c7c8=_0xae700[0x0][_0x94d7('0x116')]?!![]:![];_0x43c7c8=_0x10a325?!![]:_0x43c7c8;}var _0x1adbb6=_0x5d5a8d['validateContact'](_0xae700);if(_0x1adbb6[_0x94d7('0x117')]){rpcDb[_0x94d7('0x118')](_[_0x94d7('0x75')](_0xae700[0x0],['VoiceQueueId',_0x94d7('0x119')]))[_0x94d7('0x84')](function(_0x5bd7d3){_0x5d5a8d['checkInBlack'](_0x5bd7d3,_0xae700[0x0],_0x10a325,_0x496054,_0x43c7c8)['then'](function(_0x200a3e){_0x178b80(_0x200a3e);})[_0x94d7('0x8d')](function(_0xbe7a44){_0x145546(_0xbe7a44);});})[_0x94d7('0x8d')](function(_0x29d37b){ut[_0x94d7('0x66')](_0x94d7('0x11a'),_0x29d37b);_0x145546(ut['message'](_0x94d7('0x11b'),_0x496054,_0x43c7c8));});}else{_0x145546(ut[_0x94d7('0x4e')](_0x1adbb6['message'],_0x496054,_0x43c7c8));}})[_0x94d7('0x8d')](function(_0x58e9eb){ut[_0x94d7('0x66')](_0x94d7('0x11c'),_0x58e9eb);_0x145546(ut[_0x94d7('0x4e')](_0x94d7('0x11b'),![],!![]));});});};Preview[_0x94d7('0xd')][_0x94d7('0x11d')]=function(_0x3b0fa1){if(_[_0x94d7('0x85')](_0x3b0fa1)||_[_0x94d7('0x105')](_0x3b0fa1)||!_[_0x94d7('0x85')](_0x3b0fa1[0x0][_0x94d7('0x89')])&&_[_0x94d7('0x85')](_0x3b0fa1[0x0]['Agent'][_0x94d7('0x26')])){ut['logger'](_0x94d7('0x11e'),_0x3b0fa1);return{'isValid':![],'message':_0x94d7('0x11f')};}var _0x11ac88=this[_0x94d7('0x12')][_0x3b0fa1[0x0][_0x94d7('0x120')][_0x94d7('0x26')]];_0x11ac88[_0x94d7('0x4e')]=_0x94d7('0x9e');if(_[_0x94d7('0x85')](_0x11ac88)){ut[_0x94d7('0x66')]('[Preview][validateContact][Empty\x20Campaign]',_0x11ac88);return{'isValid':![],'message':_0x94d7('0x121')};}if(!this[_0x94d7('0x9c')](_0x11ac88[_0x94d7('0x56')])){ut['logger'](_0x94d7('0x122'),_0x94d7('0x123')+_0x11ac88[_0x94d7('0x26')]+_0x94d7('0x124'));if(!this[_0x94d7('0x9c')](_0x11ac88[_0x94d7('0x9d')])){ut[_0x94d7('0x66')](_0x94d7('0x122'),_0x11ac88[_0x94d7('0x26')]+_0x94d7('0x125'));return{'isValid':![],'message':_0x94d7('0x126')};}}if(!ut[_0x94d7('0x127')](_0x11ac88[_0x94d7('0x31')])){ut[_0x94d7('0x66')](_0x94d7('0x128'),_0x11ac88[_0x94d7('0x26')]+_0x94d7('0x129'));return{'isValid':![],'message':_0x94d7('0x123')+_0x11ac88[_0x94d7('0x26')]+_0x94d7('0x129')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0x58026a,_0xce6f80,_0xf83a72,_0x2b9236){var _0x4fdcf5=this;return new BPromise(function(_0x2dfeb1,_0x261449){var _0x204d8d=_0x58026a['uniqueid'];var _0x5a81a2=_0x4fdcf5[_0x94d7('0x9c')](_0xce6f80[_0x94d7('0x56')])?util[_0x94d7('0x5f')](_0x94d7('0x12a'),_0xce6f80[_0x94d7('0x56')][_0x94d7('0x26')],_[_0x94d7('0x85')](_0xce6f80['dialPrefix'])?'':_0xce6f80['dialPrefix'][_0x94d7('0x12b')]()||'',_0xce6f80[_0x94d7('0x12c')]>0x0?_0xf83a72[_0x94d7('0x101')]['phone'][_0x94d7('0x12d')](_0xce6f80[_0x94d7('0x12c')]):_0xf83a72[_0x94d7('0x101')][_0x94d7('0x102')]):util[_0x94d7('0x5f')](_0x94d7('0x12a'),_['isNil'](_0xce6f80[_0x94d7('0x9d')])?_0xce6f80[_0x94d7('0x56')][_0x94d7('0x26')]:_0xce6f80[_0x94d7('0x9d')]['name'],_[_0x94d7('0x85')](_0xce6f80[_0x94d7('0x36')])?'':_0xce6f80['dialPrefix'][_0x94d7('0x12b')]()||'',_0xce6f80['dialCutDigit']>0x0?_0xf83a72['Contact'][_0x94d7('0x102')][_0x94d7('0x12d')](_0xce6f80[_0x94d7('0x12c')]):_0xf83a72[_0x94d7('0x101')]['phone']);var _0x1a4768=_0x4fdcf5['isTrunkReachable'](_0xce6f80['Trunk'])?ut[_0x94d7('0x12e')](_0xce6f80['Trunk']['callerid'],_0xce6f80[_0x94d7('0x33')],_0xce6f80[_0x94d7('0x12f')]>0x0?ut[_0x94d7('0x130')](_0xce6f80[_0x94d7('0x34')],_0xce6f80[_0x94d7('0x12f')]):_0xce6f80[_0x94d7('0x34')]):ut[_0x94d7('0x12e')](_['isNil'](_0xce6f80['TrunkBackup'])?_0xce6f80[_0x94d7('0x56')][_0x94d7('0x58')]:_0xce6f80['TrunkBackup'][_0x94d7('0x58')],_0xce6f80[_0x94d7('0x33')],_0xce6f80['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x94d7('0x130')](_0xce6f80[_0x94d7('0x34')],_0xce6f80[_0x94d7('0x12f')]):_0xce6f80['dialOriginateCallerIdNumber']);if(_0x1a4768){_0x58026a[_0x94d7('0x131')]=ut[_0x94d7('0x132')](_0x1a4768);_0x58026a[_0x94d7('0x133')]=ut[_0x94d7('0x134')](_0x1a4768);}var _0x4fdaf5=ut[_0x94d7('0x135')](_0xce6f80,_0xf83a72,_0x5a81a2,_0x1a4768,_0x204d8d,_0x58026a);_[_0x94d7('0x136')](_0x58026a,ut['toLowerVariables'](_0x4fdaf5));_0x58026a[_0x94d7('0x137')]=moment()[_0x94d7('0x5f')](_0x94d7('0x8f'));ami[_0x94d7('0x138')](ut[_0x94d7('0x139')](_0x58026a,_0xce6f80,_0x4fdaf5,_0x58026a['activeContact'],_0x2b9236))[_0x94d7('0x84')](function(_0x21cedf){_0xce6f80[_0x94d7('0x4f')]+=0x1;logger[_0x94d7('0x5d')](_0x94d7('0x13a'),_0x204d8d,_0x94d7('0xee'),_0xce6f80[_0x94d7('0x26')],_0x94d7('0x72'),_0xce6f80[_0x94d7('0x4f')]);_0x2dfeb1(_0x21cedf);})[_0x94d7('0x8d')](function(_0x4eae97){ut[_0x94d7('0xf4')](_0x58026a,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x58026a,_0x94d7('0x13b'));_0x261449(_0x4eae97);});});};Preview[_0x94d7('0xd')][_0x94d7('0x1f')]=function(_0x413f3d){if(this['actions'][_0x413f3d['linkedid']]){this[_0x94d7('0x71')][_0x413f3d[_0x94d7('0xb0')]]['channel']=_0x413f3d[_0x94d7('0x79')];}};Preview[_0x94d7('0xd')][_0x94d7('0x13c')]=function(_0x3a3e24){var _0x280d83=this;var _0x81e189=this[_0x94d7('0x71')][_0x3a3e24[_0x94d7('0x13d')]];if(_0x81e189){if(_0x81e189[_0x94d7('0x104')]&&this[_0x94d7('0x15')][_0x81e189[_0x94d7('0x104')]]){ut[_0x94d7('0x13e')](_0x81e189,this[_0x94d7('0x15')][_0x81e189[_0x94d7('0x104')]][_0x94d7('0x26')],this[_0x94d7('0x15')][_0x81e189[_0x94d7('0x104')]]['id']);}var _0xdd603f=_[_0x94d7('0x13f')](_0x81e189);_0xdd603f[_0x94d7('0xb2')]=moment()[_0x94d7('0x5f')](_0x94d7('0x8f'));var _0x32ac81=_0x280d83['campaignsPreview'][_0x81e189[_0x94d7('0x7b')]];if(ut[_0x94d7('0x140')](_0x3a3e24['response'])){if(_0x81e189[_0x94d7('0xae')]){rpcDb[_0x94d7('0x113')](_0x81e189[_0x94d7('0x109')]);}if(_0x81e189[_0x94d7('0xaf')]){rpcDb['disableContact'](_0x81e189[_0x94d7('0x109')]);}ami[_0x94d7('0x24')](_0x94d7('0x141'),ut[_0x94d7('0xa2')](_0x81e189,_0x94d7('0x142')));this[_0x94d7('0xf0')](_0xdd603f,_0x32ac81,_0x3a3e24);}else{_0x81e189[_0x94d7('0x137')]=moment()[_0x94d7('0x5f')](_0x94d7('0x8f'));ut[_0x94d7('0xf4')](_0xdd603f,0x4,'Answer');rpcDb[_0x94d7('0xf6')](_0xdd603f,_0x94d7('0x143'));}}};Preview[_0x94d7('0xd')]['syncHangup']=function(_0x21a985){var _0x3f04b6=this;var _0x228be1=this[_0x94d7('0x71')][_0x21a985[_0x94d7('0xb0')]];var _0x1c4db7;if(_0x228be1){_0x1c4db7=this[_0x94d7('0x12')][_0x228be1[_0x94d7('0x7b')]];logger[_0x94d7('0x5d')](_0x94d7('0x144'),_0x21a985[_0x94d7('0xb0')],_0x94d7('0xee'),_0x1c4db7[_0x94d7('0x26')],_0x94d7('0x73'),_0x1c4db7[_0x94d7('0x62')]);}if(this[_0x94d7('0x71')][_0x21a985['linkedid']]&&_0x21a985[_0x94d7('0xb0')]!==_0x21a985[_0x94d7('0xb5')]){if(_0x21a985['cause']==='16'&&this[_0x94d7('0x71')][_0x21a985[_0x94d7('0xb0')]][_0x94d7('0x74')]){this[_0x94d7('0x145')](_0x21a985,_0x21a985[_0x94d7('0xb0')],_0x21a985[_0x94d7('0x146')]);}else if(this[_0x94d7('0x71')][_0x21a985['linkedid']][_0x94d7('0x74')]){logger[_0x94d7('0x5d')](_0x94d7('0x147'),_0x21a985[_0x94d7('0xb0')],_0x21a985[_0x94d7('0x146')],'\x20Queue',_0x1c4db7[_0x94d7('0x26')],_0x94d7('0x73'),_0x1c4db7[_0x94d7('0x62')]);this[_0x94d7('0x145')](_0x21a985,_0x21a985[_0x94d7('0xb0')],_0x21a985[_0x94d7('0x146')]);}}else if(_0x228be1&&_[_0x94d7('0x85')](_0x228be1[_0x94d7('0x148')])&&_0x1c4db7[_0x94d7('0x149')]&&_0x21a985[_0x94d7('0xb0')]===_0x21a985[_0x94d7('0xb5')]&&_[_0x94d7('0x85')](_0x21a985[_0x94d7('0xf3')])&&_0x21a985[_0x94d7('0x146')]==='16'&&_0x21a985[_0x94d7('0x14a')]==='6'&&_['isUndefined'](_0x228be1[_0x94d7('0x14b')])){if(_0x228be1[_0x94d7('0xae')]){rpcDb[_0x94d7('0x113')](_0x228be1['idContact']);}if(_0x228be1['activeContact']){rpcDb[_0x94d7('0x8e')](_0x228be1[_0x94d7('0x109')]);}_0x21a985[_0x94d7('0xf3')]='22';this['callProgressDetectingAgent'](_0x228be1,_0x1c4db7,_0x21a985);}else if(_0x228be1&&_0x228be1['transfer']){if(_0x21a985[_0x94d7('0x146')]==='16'&&this[_0x94d7('0x71')][_0x21a985[_0x94d7('0xb0')]][_0x94d7('0x74')]){logger[_0x94d7('0x5d')]('[syncHangup][talking][transfer]',_0x21a985[_0x94d7('0xb0')],_0x21a985['cause'],_0x94d7('0xee'),_0x1c4db7[_0x94d7('0x26')],_0x94d7('0x73'),_0x1c4db7[_0x94d7('0x62')]);this[_0x94d7('0x145')](_0x21a985,_0x21a985[_0x94d7('0xb0')],_0x21a985[_0x94d7('0x146')]);}else if(this[_0x94d7('0x71')][_0x21a985['linkedid']][_0x94d7('0x74')]){logger[_0x94d7('0x5d')](_0x94d7('0x147'),_0x21a985['linkedid'],_0x21a985['cause'],'\x20Queue',_0x1c4db7[_0x94d7('0x26')],_0x94d7('0x73'),_0x1c4db7[_0x94d7('0x62')]);this[_0x94d7('0x145')](_0x21a985,_0x21a985[_0x94d7('0xb0')],_0x21a985['cause']);}}};Preview[_0x94d7('0xd')][_0x94d7('0x1d')]=function(_0xa92eb6){if(this['actions'][_0xa92eb6['destlinkedid']]&&_0xa92eb6[_0x94d7('0xef')]!==_0xa92eb6['destuniqueid']){this[_0x94d7('0x145')](_0xa92eb6,_0xa92eb6['destlinkedid'],_0xa92eb6[_0x94d7('0xe9')]);}};Preview[_0x94d7('0xd')]['syncHangupRequest']=function(_0x38c71f){if(this[_0x94d7('0x71')][_0x38c71f['linkedid']]&&_0x38c71f['linkedid']!==_0x38c71f['uniqueid']&&!this['actions'][_0x38c71f[_0x94d7('0xb0')]]['dialAnswer']){if(_0x38c71f[_0x94d7('0x146')]==='1'){this['callProgressDetectingCustomer'](_0x38c71f,_0x38c71f['linkedid'],_0x38c71f[_0x94d7('0x146')]);}}};Preview[_0x94d7('0xd')][_0x94d7('0x14c')]=function(_0x424216,_0x5af437,_0x3d196c){if(this['actions'][_0x424216]){if(_[_0x94d7('0x85')](this['actions'][_0x424216]['variables'])){this[_0x94d7('0x71')][_0x424216][_0x94d7('0x14d')]={};}this[_0x94d7('0x71')][_0x424216][_0x94d7('0x14d')][_0x5af437]=_0x3d196c;}};Preview['prototype'][_0x94d7('0x14e')]=function(_0x379042){try{if(!_[_0x94d7('0x85')](_0x379042)){if(ut[_0x94d7('0x14f')](_[_0x94d7('0x150')](_0x379042[_0x94d7('0x151')])[0x0])){this[_0x94d7('0x14c')](_0x379042['uniqueid'],_[_0x94d7('0x150')](_0x379042['variable'])[0x0],_0x379042[_0x94d7('0x152')]);}}}catch(_0x32c41e){logger[_0x94d7('0x153')]('[syncVarSet][Preview]',util[_0x94d7('0x154')](_0x32c41e,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x586777){if(_0x586777){if(this[_0x94d7('0x71')][_0x586777[_0x94d7('0x155')]]){this['actions'][_0x586777[_0x94d7('0x155')]]['transfer']=!![];}}};Preview[_0x94d7('0xd')][_0x94d7('0x23')]=function(_0x324c9e){if(_0x324c9e){if(this[_0x94d7('0x71')][_0x324c9e[_0x94d7('0x156')]]){this['actions'][_0x324c9e[_0x94d7('0x156')]][_0x94d7('0x14b')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x3eea=['isUndefined','object','reason','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Queue','lookAgent','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','trunks','reachable','unmonitored','execRun','pick','disableContact','recallme','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','substring','dialCutDigit','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./action','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','clockClearZombieChannels','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','loggedIn','pTalking','sumDuration','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','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','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','booked','outbound','clearZombieChannels','hasOwnProperty','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agents','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','ACTIVE','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','activeContact','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent'];(function(_0x482479,_0x5dee3b){var _0x135af2=function(_0x24f8e9){while(--_0x24f8e9){_0x482479['push'](_0x482479['shift']());}};_0x135af2(++_0x5dee3b);}(_0x3eea,0x1ab));var _0xa3ee=function(_0x1efa60,_0x2156eb){_0x1efa60=_0x1efa60-0x0;var _0x2b18a3=_0x3eea[_0x1efa60];return _0x2b18a3;};'use strict';var util=require('util');var _=require(_0xa3ee('0x0'));var BPromise=require('bluebird');var uuid=require(_0xa3ee('0x1'));var moment=require(_0xa3ee('0x2'));var md5=require(_0xa3ee('0x3'));var Redis=require(_0xa3ee('0x4'));var config=require(_0xa3ee('0x5'));var logger=require(_0xa3ee('0x6'))(_0xa3ee('0x7'));var loggerAction=require(_0xa3ee('0x6'))(_0xa3ee('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xa3ee('0x9'));var ut=require('./util/util');config[_0xa3ee('0xa')]=_['defaults'](config[_0xa3ee('0xa')],{'host':_0xa3ee('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa3ee('0xa')]));var Sequence=function(){};Sequence[_0xa3ee('0xc')][_0xa3ee('0xd')]=function(_0x36c1d8){this[_0xa3ee('0xe')]=this['tail']?this[_0xa3ee('0xe')][_0xa3ee('0xf')](_0x36c1d8):_0x36c1d8();};function Preview(_0x4f5a66){this[_0xa3ee('0x10')]=new Sequence();this[_0xa3ee('0x11')]=_0x4f5a66[_0xa3ee('0x12')];this['trunks']=_0x4f5a66['trunks'];this[_0xa3ee('0x13')]={};this['agents']=_0x4f5a66['agents'];this[_0xa3ee('0x14')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xa3ee('0x15')](this));ami['on'](_0xa3ee('0x16'),this['syncHangup'][_0xa3ee('0x15')](this));ami['on'](_0xa3ee('0x17'),this[_0xa3ee('0x18')][_0xa3ee('0x15')](this));ami['on'](_0xa3ee('0x19'),this[_0xa3ee('0x1a')][_0xa3ee('0x15')](this));ami['on'](_0xa3ee('0x1b'),this['syncNewExten'][_0xa3ee('0x15')](this));ami['on']('varset',this[_0xa3ee('0x1c')][_0xa3ee('0x15')](this));ami['on'](_0xa3ee('0x1d'),this[_0xa3ee('0x1e')][_0xa3ee('0x15')](this));ami['on'](_0xa3ee('0x1f'),this[_0xa3ee('0x20')][_0xa3ee('0x15')](this));this[_0xa3ee('0x21')](this[_0xa3ee('0x11')]);}function emit(_0xbaf973,_0x6521b8,_0x2e26e0){io['to'](_0xbaf973)[_0xa3ee('0x22')](_0x6521b8,_0x2e26e0);}function emitCampaignPreview(_0x805fe4){if(_0x805fe4[_0xa3ee('0x23')]==='outbound'){var _0x445789={'id':_0x805fe4['id'],'name':_0x805fe4[_0xa3ee('0x24')],'strategy':_0x805fe4[_0xa3ee('0x25')],'answered':_0x805fe4['answered'],'available':_0x805fe4['available'],'loggedIn':_0x805fe4[_0xa3ee('0x26')],'pTalking':_0x805fe4[_0xa3ee('0x27')],'sumBillable':_0x805fe4['sumBillable'],'sumDuration':_0x805fe4[_0xa3ee('0x28')],'sumHoldTime':_0x805fe4['sumHoldTime']||0x0,'talking':_0x805fe4[_0xa3ee('0x29')],'total':_0x805fe4[_0xa3ee('0x2a')],'type':_0x805fe4[_0xa3ee('0x23')],'unmanaged':_0x805fe4[_0xa3ee('0x2b')],'abandoned':_0x805fe4['abandoned'],'waiting':_0x805fe4[_0xa3ee('0x2c')],'loggedInDb':_0x805fe4[_0xa3ee('0x2d')],'dialActive':_0x805fe4[_0xa3ee('0x2e')],'dialMethod':_0x805fe4[_0xa3ee('0x2f')],'dialOriginateCallerIdName':_0x805fe4[_0xa3ee('0x30')],'dialOriginateCallerIdNumber':_0x805fe4['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x805fe4['dialOriginateTimeout'],'dialPrefix':_0x805fe4[_0xa3ee('0x31')],'outboundAnswerAgiCallsDay':_0x805fe4[_0xa3ee('0x32')],'outboundAnswerCallsDay':_0x805fe4['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x805fe4[_0xa3ee('0x33')],'outboundBusyCallsDay':_0x805fe4['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x805fe4[_0xa3ee('0x34')],'outboundDropCallsDayACS':_0x805fe4[_0xa3ee('0x35')],'outboundDropCallsDayCallersExit':_0x805fe4[_0xa3ee('0x36')],'outboundDropCallsDayTimeout':_0x805fe4['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x805fe4[_0xa3ee('0x37')],'outboundNoSuchCallsDay':_0x805fe4[_0xa3ee('0x38')],'outboundOriginateFailureCallsDay':_0x805fe4[_0xa3ee('0x39')],'outboundReCallsDay':_0x805fe4[_0xa3ee('0x3a')],'outboundRejectCallsDay':_0x805fe4[_0xa3ee('0x3b')],'outboundUnknownCallsDay':_0x805fe4['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x805fe4[_0xa3ee('0x3c')],'predictiveIntervalAnsweredCalls':_0x805fe4[_0xa3ee('0x3d')],'predictiveIntervalAvgHoldtime':_0x805fe4[_0xa3ee('0x3e')],'predictiveIntervalAvgTalktime':_0x805fe4[_0xa3ee('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x805fe4[_0xa3ee('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x805fe4[_0xa3ee('0x41')],'predictiveIntervalErlangCalls':_0x805fe4[_0xa3ee('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x805fe4[_0xa3ee('0x43')],'predictiveIntervalHitRate':_0x805fe4[_0xa3ee('0x44')],'predictiveIntervalMultiplicativeFactor':_0x805fe4[_0xa3ee('0x45')],'predictiveIntervalPauses':_0x805fe4[_0xa3ee('0x46')],'predictiveIntervalAvailable':_0x805fe4[_0xa3ee('0x47')],'predictiveIntervalTotalCalls':_0x805fe4[_0xa3ee('0x48')],'message':_0x805fe4[_0xa3ee('0x49')],'originated':_0x805fe4[_0xa3ee('0x4a')],'erlangCalls':_0x805fe4[_0xa3ee('0x4b')],'erlangCallToSecond':_0x805fe4[_0xa3ee('0x4c')],'erlangAbandonmentRate':_0x805fe4[_0xa3ee('0x4d')],'erlangBusyFactor':_0x805fe4[_0xa3ee('0x4e')],'startPredictive':_0x805fe4[_0xa3ee('0x4f')],'startProgressive':_0x805fe4[_0xa3ee('0x50')]};if(_0x805fe4[_0xa3ee('0x51')]){_0x445789[_0xa3ee('0x51')]={'id':_0x805fe4['Trunk']['id'],'name':_0x805fe4[_0xa3ee('0x51')]['name'],'active':_0x805fe4[_0xa3ee('0x51')][_0xa3ee('0x52')],'callerid':_0x805fe4[_0xa3ee('0x51')][_0xa3ee('0x53')]};}if(_0x805fe4[_0xa3ee('0x54')]){_0x445789[_0xa3ee('0x54')]={'id':_0x805fe4[_0xa3ee('0x54')]['id'],'name':_0x805fe4[_0xa3ee('0x54')][_0xa3ee('0x24')]};}var _0x466d58=md5(JSON[_0xa3ee('0x55')](_0x445789));if(_0x805fe4[_0xa3ee('0x3')]!==_0x466d58){_0x805fe4['md5']=_0x466d58;emit(util['format'](_0xa3ee('0x56'),_0x445789['name']),_0xa3ee('0x57'),_0x445789);}}}function emitVoiceQueueChannelRemove(_0x1d8066){logger[_0xa3ee('0x58')](_0xa3ee('0x59'),JSON[_0xa3ee('0x55')](_0x1d8066));emit(util[_0xa3ee('0x5a')]('voice:queue:%s',_0x1d8066[_0xa3ee('0x24')]),_0xa3ee('0x5b'),_0x1d8066);}function notSendMessagesQueue(_0x49ae93){if(_0x49ae93['sendMessageOneNotActive']){if(_0x49ae93[_0xa3ee('0x4a')]===0x0&&_0x49ae93[_0xa3ee('0x27')]===0x0){_0x49ae93[_0xa3ee('0x5c')]=![];_0x49ae93[_0xa3ee('0x5d')]=0x0;_0x49ae93[_0xa3ee('0x5e')]=0x0;_0x49ae93[_0xa3ee('0x49')]=_0xa3ee('0x5f');ut['logger'](_0xa3ee('0x60'),_0x49ae93[_0xa3ee('0x24')]+_0xa3ee('0x61'));}else{_0x49ae93[_0xa3ee('0x49')]=_0xa3ee('0x62');ut['logger'](_0xa3ee('0x60'),_0x49ae93['name']+_0xa3ee('0x63'));}emitCampaignPreview(_0x49ae93);}}Preview[_0xa3ee('0xc')]['loopCampaigns']=function(){var _0x20fece=this;setInterval(function(){_0x20fece[_0xa3ee('0x64')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x147980=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x75f23 in _0x147980){if(_0x147980['hasOwnProperty'](_0x75f23)&&(_0x147980[_0x75f23]['dialMethod']===_0xa3ee('0x7')||_0x147980[_0x75f23]['dialMethod']===_0xa3ee('0x65'))&&_0x147980[_0x75f23][_0xa3ee('0x23')]===_0xa3ee('0x66')){if(this[_0xa3ee('0x14')]>0x7){this[_0xa3ee('0x14')]=0x0;this[_0xa3ee('0x67')]();}}if(_0x147980[_0xa3ee('0x68')](_0x75f23)&&_0x147980[_0x75f23][_0xa3ee('0x2f')]===_0xa3ee('0x7')&&_0x147980[_0x75f23][_0xa3ee('0x23')]==='outbound'){if(_0x147980[_0x75f23]['dialActive']){this[_0xa3ee('0x69')](_0x147980[_0x75f23]);this[_0xa3ee('0x6a')](_0x147980[_0x75f23]);}else{notSendMessagesQueue(_0x147980[_0x75f23]);}}}};Preview[_0xa3ee('0xc')][_0xa3ee('0x6b')]=function(_0x4ef65e){var _0x5c7d5f=this;this[_0xa3ee('0x10')][_0xa3ee('0xd')](function(){if(!_[_0xa3ee('0x6c')](_0x5c7d5f[_0xa3ee('0x13')][_0x4ef65e])){loggerAction[_0xa3ee('0x58')](_0xa3ee('0x6d'),_0x4ef65e,'Queue',_0x5c7d5f[_0xa3ee('0x13')][_0x4ef65e][_0xa3ee('0x6e')],_0xa3ee('0x6f'),JSON['stringify'](_0x5c7d5f[_0xa3ee('0x11')][_0x5c7d5f[_0xa3ee('0x13')][_0x4ef65e][_0xa3ee('0x6e')]][_0xa3ee('0x4a')]),_0xa3ee('0x70'),JSON[_0xa3ee('0x55')](_0x5c7d5f[_0xa3ee('0x11')][_0x5c7d5f['actions'][_0x4ef65e][_0xa3ee('0x6e')]][_0xa3ee('0x27')]),JSON[_0xa3ee('0x55')](_0x5c7d5f[_0xa3ee('0x13')][_0x4ef65e][_0xa3ee('0x71')]),JSON[_0xa3ee('0x55')](_['pick'](_0x5c7d5f['actions'][_0x4ef65e],[_0xa3ee('0x72'),'UserId',_0xa3ee('0x73'),_0xa3ee('0x74')])));return ami[_0xa3ee('0x75')]({'action':_0xa3ee('0x76'),'channel':_0x5c7d5f[_0xa3ee('0x13')][_0x4ef65e][_0xa3ee('0x77')]})[_0xa3ee('0x78')](function(_0x1320df){if(_0x1320df[_0xa3ee('0x49')]===_0xa3ee('0x79')){setTimeout(function(){if(_0x5c7d5f[_0xa3ee('0x13')][_0x4ef65e]){ut[_0xa3ee('0x7a')](_0x5c7d5f[_0xa3ee('0x11')][_0x5c7d5f[_0xa3ee('0x13')][_0x4ef65e][_0xa3ee('0x6e')]],_0xa3ee('0x7b'));if(_0x5c7d5f['actions'][_0x4ef65e]['dialAnswer']===!![]){ut[_0xa3ee('0x7c')](_0x5c7d5f[_0xa3ee('0x11')][_0x5c7d5f[_0xa3ee('0x13')][_0x4ef65e][_0xa3ee('0x6e')]],_0xa3ee('0x7b'));ut[_0xa3ee('0x7d')](_0xa3ee('0x7e')+_0x4ef65e,_0x5c7d5f['actions'][_0x4ef65e][_0xa3ee('0x6e')]);}ut[_0xa3ee('0x7d')](_0xa3ee('0x7f')+_0x4ef65e,_0x5c7d5f['actions'][_0x4ef65e][_0xa3ee('0x6e')]);delete _0x5c7d5f['actions'][_0x4ef65e];}},0x2328);}});}});};Preview[_0xa3ee('0xc')][_0xa3ee('0x67')]=function(){var _0x5ef602=this;loggerAction[_0xa3ee('0x58')](_0xa3ee('0x80'),_[_0xa3ee('0x81')](this['actions']));for(var _0x523ff2 in this[_0xa3ee('0x13')]){if(_0x5ef602[_0xa3ee('0x13')][_0xa3ee('0x68')](_0x523ff2)){_0x5ef602['clearZombieChannel'](_0x523ff2);}}};Preview[_0xa3ee('0xc')][_0xa3ee('0x6a')]=function(_0x915268){var _0x56310f=this;rpcDb[_0xa3ee('0x82')](_0x915268['id'],ut['agentReadyId'](this[_0xa3ee('0x83')]))[_0xa3ee('0x84')](function(_0x378ace){if(!_['isNil'](_0x378ace)){for(var _0x21fd7c=0x0;_0x21fd7c<_0x378ace[_0xa3ee('0x85')];_0x21fd7c+=0x1){if(ut[_0xa3ee('0x86')](_0x378ace[_0x21fd7c][_0xa3ee('0x87')])<_0x915268[_0xa3ee('0x88')]*0x3c){if(_0x378ace[_0x21fd7c][_0xa3ee('0x89')]&&!_0x378ace[_0x21fd7c][_0xa3ee('0x89')]['voicePause']){_0x56310f[_0xa3ee('0x8a')](_0x378ace[_0x21fd7c]['id'])[_0xa3ee('0x84')](ut[_0xa3ee('0x8b')](_0xa3ee('0x8c')))[_0xa3ee('0x78')](ut[_0xa3ee('0x8b')](_0xa3ee('0x8c')));}else{rpcDb['disableContact'](_0x378ace[_0x21fd7c]['id']);}}else{var _0x4c9d9f=new Action(_0x378ace[_0x21fd7c],_0x915268);_0x4c9d9f[_0xa3ee('0x8d')]=moment()[_0xa3ee('0x5a')](_0xa3ee('0x8e'));_0x915268['outboundReCallsDay']+=0x1;ut[_0xa3ee('0x8f')](_0x4c9d9f,0x17,_0xa3ee('0x90'));if(_0x915268[_0xa3ee('0x91')]){rpcDb['rescheduleContactInQueue'](ut[_0xa3ee('0x92')](_0x378ace[_0x21fd7c]));rpcDb[_0xa3ee('0x93')](_0x4c9d9f,_0xa3ee('0x94'));}else{ut[_0xa3ee('0x8f')](_0x4c9d9f,0x16,_0xa3ee('0x95'));rpcDb['createCustomerHistory'](_0x4c9d9f,_0xa3ee('0x96'));rpcDb[_0xa3ee('0x97')](_0x4c9d9f,_0xa3ee('0x96'));}}}}})[_0xa3ee('0x78')](ut[_0xa3ee('0x8b')](_0xa3ee('0x98')));};Preview[_0xa3ee('0xc')]['setMessage']=function(_0x2f72be){_0x2f72be['sendMessageOneNotActive']=!![];if(ut[_0xa3ee('0x99')](_0x2f72be['loggedIn'])){_0x2f72be[_0xa3ee('0x49')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xa3ee('0x9a')](_0x2f72be['dialActive'])){_0x2f72be['message']='NOT_ACTIVE';}else if(!this[_0xa3ee('0x9b')](_0x2f72be['Trunk'])){if(!this[_0xa3ee('0x9b')](_0x2f72be['TrunkBackup'])){_0x2f72be[_0xa3ee('0x49')]='TRUNK_IS_NOT_REACHABLE';}else{_0x2f72be[_0xa3ee('0x49')]=_0xa3ee('0x9c');}}else{_0x2f72be[_0xa3ee('0x49')]=_0xa3ee('0x9c');}emitCampaignPreview(_0x2f72be);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x2375c2,_0x662b22,_0x28f80b){var _0x5a8b17=this;var _0x5a1ffc=this[_0xa3ee('0x13')][_0x662b22];var _0x1ce858=this[_0xa3ee('0x11')][_0x5a1ffc[_0xa3ee('0x6e')]];var _0x39f45e;if(_0x1ce858){switch(_0x28f80b){case'1':_0x1ce858[_0xa3ee('0x38')]+=0x1;_0x5a1ffc['countnosuchnumberretry']+=0x1;_0x5a1ffc[_0xa3ee('0x9d')]=ut[_0xa3ee('0x9e')](_0x5a1ffc);ut[_0xa3ee('0x8f')](_0x5a1ffc,0x0,'NoSuchNumber');ami['emit'](_0xa3ee('0x9f'),ut[_0xa3ee('0xa0')](_0x5a1ffc,_0xa3ee('0xa1')));rpcDb['createCustomerHistory'](_0x5a1ffc,_0xa3ee('0xa2'));if(ut[_0xa3ee('0x9e')](_0x5a1ffc)>=_0x1ce858[_0xa3ee('0xa3')]){_0x39f45e=ut['cloneAction'](_0x5a1ffc,0xf,_0xa3ee('0xa4'));rpcDb[_0xa3ee('0x97')](_0x39f45e,_0xa3ee('0xa5'));}else{if(_0x5a1ffc[_0xa3ee('0xa6')]>=_0x1ce858['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x5a1ffc,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0xa3ee('0xa7')](_0x5a1ffc,'countnosuchnumberretry',_0x1ce858[_0xa3ee('0xa8')]),_0x5a1ffc[_0xa3ee('0xa9')],_0x5a1ffc['activeContact']);}}delete this[_0xa3ee('0x13')][_0x2375c2[_0xa3ee('0xaa')]];break;case _0xa3ee('0xab'):var _0x38cdca=moment()['format'](_0xa3ee('0x8e'));_0x5a1ffc['responsetime']=_0x38cdca;_0x5a1ffc['answertime']=_0x38cdca;_0x5a1ffc[_0xa3ee('0x71')]=!![];_0x1ce858['pTalking']+=0x1;logger[_0xa3ee('0x58')](_0xa3ee('0xac'),_0x5a1ffc[_0xa3ee('0xad')],_0xa3ee('0xae'),_0x1ce858[_0xa3ee('0x24')],'pTalking:\x20',_0x1ce858[_0xa3ee('0x27')]);ami['emit'](_0xa3ee('0xaf'),ut[_0xa3ee('0xa0')](_0x5a1ffc,_0xa3ee('0xb0')));if(_0x1ce858['acw']){ami[_0xa3ee('0x22')](_0xa3ee('0xb1'),ut[_0xa3ee('0xb2')](_0x5a1ffc));}break;case'16':ami[_0xa3ee('0x22')](_0xa3ee('0xb3'),ut[_0xa3ee('0xa0')](_0x5a1ffc,_0xa3ee('0xb4')));emitVoiceQueueChannelRemove(ut[_0xa3ee('0xa0')](_0x5a1ffc,_0xa3ee('0xb4')));_0x1ce858[_0xa3ee('0xb5')]+=0x1;_0x1ce858[_0xa3ee('0x2a')]+=0x1;_0x1ce858[_0xa3ee('0xb6')]+=0x1;ut[_0xa3ee('0x7c')](_0x1ce858,_0xa3ee('0xb7'));_0x5a1ffc['countglobal']=ut[_0xa3ee('0x9e')](_0x5a1ffc);ut['logCustomer'](_0x5a1ffc,0x4,_0xa3ee('0xb8'));rpcDb['createCustomerHistory'](_0x5a1ffc,_0xa3ee('0xb9'));rpcDb[_0xa3ee('0x97')](_0x5a1ffc,_0xa3ee('0xba'));rpcDb[_0xa3ee('0xbb')](_0x5a1ffc);_0x1ce858['sumDuration']+=_0x5a1ffc['talktime'];_0x1ce858[_0xa3ee('0xbc')]+=_0x5a1ffc[_0xa3ee('0xbd')];logger['info']('[syncHangup][talking][decrement]',_0x5a1ffc[_0xa3ee('0xad')],_0xa3ee('0xae'),_0x1ce858[_0xa3ee('0x24')],'pTalking:\x20',_0x1ce858[_0xa3ee('0x27')]);delete this[_0xa3ee('0x13')][_0x2375c2['linkedid']];break;case'BUSY':_0x1ce858[_0xa3ee('0xbe')]+=0x1;_0x5a1ffc[_0xa3ee('0xbf')]+=0x1;_0x5a1ffc['countglobal']=ut[_0xa3ee('0x9e')](_0x5a1ffc);ut[_0xa3ee('0x8f')](_0x5a1ffc,0x5,'Busy');ami[_0xa3ee('0x22')](_0xa3ee('0xc0'),ut[_0xa3ee('0xa0')](_0x5a1ffc,_0xa3ee('0xc1')));rpcDb[_0xa3ee('0x93')](_0x5a1ffc,_0xa3ee('0xc2'));if(ut['totalGlobal'](_0x5a1ffc)>=_0x1ce858[_0xa3ee('0xa3')]){_0x39f45e=ut[_0xa3ee('0xc3')](_0x5a1ffc,0xf,'Global');rpcDb[_0xa3ee('0x97')](_0x39f45e,_0xa3ee('0xc4'));}else{if(_0x5a1ffc['countbusyretry']>=_0x1ce858['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x5a1ffc,_0xa3ee('0xc2'));}else{rpcDb[_0xa3ee('0xc5')](ut[_0xa3ee('0xa7')](_0x5a1ffc,_0xa3ee('0xbf'),_0x1ce858[_0xa3ee('0xc6')]),_0x5a1ffc[_0xa3ee('0xa9')],_0x5a1ffc['activeContact']);}}break;case _0xa3ee('0xc7'):_0x1ce858[_0xa3ee('0x37')]+=0x1;_0x5a1ffc[_0xa3ee('0xc8')]+=0x1;_0x5a1ffc[_0xa3ee('0x9d')]=ut['totalGlobal'](_0x5a1ffc);ut['logCustomer'](_0x5a1ffc,0x3,_0xa3ee('0xc9'));ami['emit'](_0xa3ee('0xca'),ut[_0xa3ee('0xa0')](_0x5a1ffc,_0xa3ee('0xcb')));rpcDb[_0xa3ee('0x93')](_0x5a1ffc,_0xa3ee('0xcc'));if(ut[_0xa3ee('0x9e')](_0x5a1ffc)>=_0x1ce858['dialGlobalMaxRetry']){_0x39f45e=ut['cloneAction'](_0x5a1ffc,0xf,_0xa3ee('0xa4'));rpcDb[_0xa3ee('0x97')](_0x39f45e,_0xa3ee('0xcd'));}else{if(_0x5a1ffc['countnoanswerretry']>=_0x1ce858[_0xa3ee('0xce')]){rpcDb[_0xa3ee('0x97')](_0x5a1ffc,_0xa3ee('0xcc'));}else{rpcDb[_0xa3ee('0xc5')](ut['scheduledAt'](_0x5a1ffc,_0xa3ee('0xc8'),_0x1ce858[_0xa3ee('0xcf')]),_0x5a1ffc[_0xa3ee('0xa9')],_0x5a1ffc['activeContact']);}}break;case _0xa3ee('0xd0'):_0x1ce858[_0xa3ee('0x34')]+=0x1;_0x5a1ffc[_0xa3ee('0xd1')]+=0x1;_0x5a1ffc[_0xa3ee('0x9d')]=ut['totalGlobal'](_0x5a1ffc);ut['logCustomer'](_0x5a1ffc,0x8,_0xa3ee('0xd2'));ami['emit'](_0xa3ee('0xd3'),ut[_0xa3ee('0xa0')](_0x5a1ffc,_0xa3ee('0xd4')));rpcDb['createCustomerHistory'](_0x5a1ffc,_0xa3ee('0xd5'));if(ut['totalGlobal'](_0x5a1ffc)>=_0x1ce858[_0xa3ee('0xa3')]){_0x39f45e=ut[_0xa3ee('0xc3')](_0x5a1ffc,0xf,_0xa3ee('0xa4'));rpcDb[_0xa3ee('0x97')](_0x39f45e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5a1ffc[_0xa3ee('0xd1')]>=_0x1ce858['dialCongestionMaxRetry']){rpcDb[_0xa3ee('0x97')](_0x5a1ffc,_0xa3ee('0xd5'));}else{rpcDb[_0xa3ee('0xc5')](ut[_0xa3ee('0xa7')](_0x5a1ffc,_0xa3ee('0xd1'),_0x1ce858[_0xa3ee('0xc6')]),_0x5a1ffc['unlockAgent'],_0x5a1ffc['activeContact']);}}break;case'CANCEL':_0x1ce858[_0xa3ee('0x3b')]+=0x1;_0x5a1ffc[_0xa3ee('0xd6')]+=0x1;_0x5a1ffc[_0xa3ee('0x9d')]=ut['totalGlobal'](_0x5a1ffc);ut[_0xa3ee('0x8f')](_0x5a1ffc,0x14,_0xa3ee('0xd7'));ami[_0xa3ee('0x22')](_0xa3ee('0xd8'),ut[_0xa3ee('0xa0')](_0x5a1ffc,_0xa3ee('0xd9')));rpcDb[_0xa3ee('0x93')](_0x5a1ffc,_0xa3ee('0xda'));if(ut[_0xa3ee('0x9e')](_0x5a1ffc)>=_0x1ce858['dialGlobalMaxRetry']){_0x39f45e=ut[_0xa3ee('0xc3')](_0x5a1ffc,0x14,_0xa3ee('0xd7'));rpcDb[_0xa3ee('0x97')](_0x39f45e,_0xa3ee('0xdb'));}else{if(_0x5a1ffc[_0xa3ee('0xd6')]>=_0x1ce858[_0xa3ee('0xdc')]){rpcDb[_0xa3ee('0x97')](_0x5a1ffc,_0xa3ee('0xdb'));}else{rpcDb[_0xa3ee('0xc5')](ut[_0xa3ee('0xa7')](_0x5a1ffc,_0xa3ee('0xd6'),_0x1ce858[_0xa3ee('0xdd')]),_0x5a1ffc[_0xa3ee('0xa9')],_0x5a1ffc[_0xa3ee('0xde')]);}}break;case'ABANDONED':_0x1ce858[_0xa3ee('0x3c')]+=0x1;_0x5a1ffc[_0xa3ee('0xdf')]+=0x1;_0x5a1ffc[_0xa3ee('0x9d')]=ut[_0xa3ee('0x9e')](_0x5a1ffc);ut[_0xa3ee('0x8f')](_0x5a1ffc,0xb,'Abandoned');rpcDb[_0xa3ee('0x93')](_0x5a1ffc,_0xa3ee('0xe0'));if(ut['totalGlobal'](_0x5a1ffc)>=_0x1ce858['dialGlobalMaxRetry']){_0x39f45e=ut[_0xa3ee('0xc3')](_0x5a1ffc,0xf,_0xa3ee('0xa4'));rpcDb[_0xa3ee('0x97')](_0x39f45e,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5a1ffc[_0xa3ee('0xe1')]>=_0x1ce858[_0xa3ee('0xe2')]){rpcDb[_0xa3ee('0x97')](_0x5a1ffc,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5a1ffc,_0xa3ee('0xdf'),_0x1ce858[_0xa3ee('0xe3')]),_0x5a1ffc[_0xa3ee('0xa9')],_0x5a1ffc[_0xa3ee('0xde')]);}}break;default:if(_0x5a1ffc['dialAnswer']){ut['decrementTalkink'](_0x1ce858,'[default]');ut[_0xa3ee('0x7d')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1ce858['name'],_0x2375c2);}_0x1ce858[_0xa3ee('0xe4')]+=0x1;_0x5a1ffc[_0xa3ee('0x9d')]=ut[_0xa3ee('0x9e')](_0x5a1ffc);ut[_0xa3ee('0x8f')](_0x5a1ffc,0xc,_0x2375c2[_0xa3ee('0xe5')]||_0x2375c2[_0xa3ee('0xe6')]);rpcDb[_0xa3ee('0x93')](_0x5a1ffc,_0xa3ee('0xe7'));if(ut[_0xa3ee('0x9e')](_0x5a1ffc)>=_0x1ce858[_0xa3ee('0xa3')]){_0x39f45e=ut[_0xa3ee('0xc3')](_0x5a1ffc,0xf,'Global');rpcDb['createCustomerFinal'](_0x39f45e,_0xa3ee('0xe8'));}else{rpcDb[_0xa3ee('0x97')](_0x5a1ffc,_0xa3ee('0xe8'));}delete this['actions'][_0x2375c2[_0xa3ee('0xaa')]];}if(!(_0x5a1ffc[_0xa3ee('0x71')]&&_0x28f80b==='16')){ut[_0xa3ee('0x7a')](_0x1ce858,_0xa3ee('0xe9'));logger[_0xa3ee('0x58')](_0xa3ee('0xea'),_0x5a1ffc[_0xa3ee('0xad')],'\x20Queue',_0x1ce858[_0xa3ee('0x24')],'originated:\x20',_0x1ce858[_0xa3ee('0x4a')]);}if(_0x28f80b!==_0xa3ee('0xab')){delete this[_0xa3ee('0x13')][_0x2375c2[_0xa3ee('0xaa')]];delete this[_0xa3ee('0x13')][_0x2375c2[_0xa3ee('0xeb')]];}}};Preview['prototype'][_0xa3ee('0xec')]=function(_0x10918f,_0xd60869,_0x4eed95){if(_[_0xa3ee('0xed')](_0xd60869)&&_0xa3ee('0xee')!==typeof _0xd60869){return;}if(_[_0xa3ee('0xed')](_0x4eed95)&&_0xa3ee('0xee')!==typeof _0x4eed95){return;}switch(_0x4eed95[_0xa3ee('0xef')]){case'0':ut['logAgent'](_0x10918f,0x0,_0xa3ee('0xf0'));rpcDb['createAgentHistory'](_0x10918f,_0xa3ee('0xf1'));break;case'3':ut[_0xa3ee('0xf2')](_0x10918f,0x3,_0xa3ee('0xc9'));rpcDb[_0xa3ee('0xf3')](_0x10918f,_0xa3ee('0xf4'));break;case'5':ut['logAgent'](_0x10918f,0x5,'Busy');rpcDb[_0xa3ee('0xf3')](_0x10918f,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x10918f,0x8,_0xa3ee('0xd2'));rpcDb[_0xa3ee('0xf3')](_0x10918f,_0xa3ee('0xf5'));break;case'22':ut[_0xa3ee('0xf2')](_0x10918f,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x10918f,_0xa3ee('0xf6'));break;default:ut['logAgent'](_0x10918f,0xc,_0x4eed95['reason']);rpcDb[_0xa3ee('0xf3')](_0x10918f,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa3ee('0x7a')](_0xd60869,'[callProgressDetectingAgent]');logger[_0xa3ee('0x58')](_0xa3ee('0xf7'),_0x10918f[_0xa3ee('0xad')],'\x20Queue',_0xd60869[_0xa3ee('0x24')],'originated:\x20',_0xd60869[_0xa3ee('0x4a')]);delete this[_0xa3ee('0x13')][_0x10918f[_0xa3ee('0xad')]];};Preview['prototype'][_0xa3ee('0xf8')]=function(_0x1aaccb,_0x261dbc,_0x1eb4da,_0x45af56,_0x1b60b9){var _0x33a3de=this;return new BPromise(function(_0x19b032,_0x57ba61){if(_[_0xa3ee('0x6c')](_0x261dbc)||_[_0xa3ee('0x6c')](_0x261dbc[_0xa3ee('0xf9')])||_[_0xa3ee('0x6c')](_0x261dbc['Contact'][_0xa3ee('0xfa')])||_['isNil'](_0x261dbc[_0xa3ee('0x73')])){_0x57ba61(ut[_0xa3ee('0x49')]('Contact\x20is\x20undefined',_0x45af56,_0x1b60b9));return;}var _0x165878=uuid['v4']();var _0xaf13e9=_0x33a3de[_0xa3ee('0x11')][_0x261dbc[_0xa3ee('0xfb')][_0xa3ee('0x24')]];var _0x2c8b4e=_0x1eb4da?_0x33a3de['agents'][_0x1eb4da]['id']:undefined;_0x33a3de[_0xa3ee('0x13')][_0x165878]=new Action(_0x261dbc,_0xaf13e9,_0x165878,_0x1eb4da,_0x2c8b4e);var _0x286c1f=_0x33a3de[_0xa3ee('0x13')][_0x165878];_0x286c1f[_0xa3ee('0xa9')]=_0x45af56;_0x286c1f[_0xa3ee('0xde')]=_0x1b60b9;_0x286c1f[_0xa3ee('0xfc')]=_0x1eb4da;if(_['isEmpty'](_0x1aaccb)){_0x33a3de[_0xa3ee('0xfd')](_0x286c1f,_0xaf13e9,_0x261dbc,_0x1eb4da)[_0xa3ee('0x84')](function(_0x5f4141){logger[_0xa3ee('0x58')](_0xa3ee('0xfe'),'Queue:\x20'+_0x286c1f[_0xa3ee('0x6e')]+_0xa3ee('0xff')+_0x286c1f['idContact'],JSON[_0xa3ee('0x55')](_0x5f4141));ami[_0xa3ee('0x22')](_0xa3ee('0x100'),ut[_0xa3ee('0xa0')](_0x286c1f,_0xa3ee('0x101')));_0x19b032(ut['message'](_0xa3ee('0x102')));})['catch'](function(_0x18b0d2){ut[_0xa3ee('0x103')](_0xa3ee('0x104'),_0x18b0d2);_0x57ba61(ut['message']('Call\x20failed',_0x45af56,_0x1b60b9));});}else{_0xaf13e9['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x286c1f);rpcDb[_0xa3ee('0x105')](_0x286c1f,_0xa3ee('0x106'));delete _0x33a3de[_0xa3ee('0x13')][_0x165878];_0x57ba61(ut[_0xa3ee('0x49')](_0xa3ee('0x107'),_0x45af56,_0x1b60b9));}});};Preview['prototype']['isTrunkReachable']=function(_0x43bbd5){return!_[_0xa3ee('0x6c')](_0x43bbd5)&&!_[_0xa3ee('0x6c')](_0x43bbd5['name'])&&!_[_0xa3ee('0x6c')](_0x43bbd5['active'])&&_0x43bbd5[_0xa3ee('0x52')]&&!_[_0xa3ee('0x6c')](this['trunks'][util[_0xa3ee('0x5a')](_0xa3ee('0x108'),_0x43bbd5[_0xa3ee('0x24')])])&&!_['isNil'](this[_0xa3ee('0x109')][util[_0xa3ee('0x5a')](_0xa3ee('0x108'),_0x43bbd5[_0xa3ee('0x24')])][_0xa3ee('0x76')])&&(this[_0xa3ee('0x109')][util['format'](_0xa3ee('0x108'),_0x43bbd5[_0xa3ee('0x24')])][_0xa3ee('0x76')]===_0xa3ee('0x10a')||this['trunks'][util['format'](_0xa3ee('0x108'),_0x43bbd5[_0xa3ee('0x24')])][_0xa3ee('0x76')]===_0xa3ee('0x10b'));};Preview[_0xa3ee('0xc')][_0xa3ee('0x8a')]=function(_0x5e82b7,_0x2017c1){var _0x53e475=this;return new BPromise(function(_0x396660,_0x1f187c){_0x53e475[_0xa3ee('0x10c')](_0x5e82b7,_0x2017c1)[_0xa3ee('0x84')](function(_0x25c6e2){_0x396660(_[_0xa3ee('0x10d')](_0x25c6e2,['message']));})[_0xa3ee('0x78')](function(_0x3b6b3c){if(_0x3b6b3c['unlock']){rpcDb['unlockContact'](_0x5e82b7);}if(_0x3b6b3c[_0xa3ee('0x52')]){rpcDb[_0xa3ee('0x10e')](_0x5e82b7);}_0x1f187c(_[_0xa3ee('0x10d')](_0x3b6b3c,['message']));});});};Preview[_0xa3ee('0xc')]['execRun']=function(_0x35d801,_0x38aedc){var _0x29e049=this;return new BPromise(function(_0x1e3fe3,_0xcc3238){var _0x259d87,_0x1c5dc1;rpcDb['getContactPreview'](_0x35d801)[_0xa3ee('0x84')](function(_0xafef70){if(!_[_0xa3ee('0x6c')](_0xafef70[0x0])){_0x1c5dc1=_0xafef70[0x0][_0xa3ee('0x10f')]?![]:!![];_0x259d87=_0xafef70[0x0]['recallme']?!![]:![];_0x259d87=_0x38aedc?!![]:_0x259d87;}var _0x26296a=_0x29e049['validateContact'](_0xafef70);if(_0x26296a['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0xafef70[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0xa4b78a){_0x29e049[_0xa3ee('0xf8')](_0xa4b78a,_0xafef70[0x0],_0x38aedc,_0x1c5dc1,_0x259d87)['then'](function(_0xd45e3c){_0x1e3fe3(_0xd45e3c);})[_0xa3ee('0x78')](function(_0xb6e1c0){_0xcc3238(_0xb6e1c0);});})[_0xa3ee('0x78')](function(_0xce6382){ut[_0xa3ee('0x103')](_0xa3ee('0x110'),_0xce6382);_0xcc3238(ut[_0xa3ee('0x49')](_0xa3ee('0x111'),_0x1c5dc1,_0x259d87));});}else{_0xcc3238(ut['message'](_0x26296a[_0xa3ee('0x49')],_0x1c5dc1,_0x259d87));}})[_0xa3ee('0x78')](function(_0x3d96df){ut[_0xa3ee('0x103')](_0xa3ee('0x112'),_0x3d96df);_0xcc3238(ut['message'](_0xa3ee('0x111'),![],!![]));});});};Preview['prototype'][_0xa3ee('0x113')]=function(_0x31c956){if(_[_0xa3ee('0x6c')](_0x31c956)||_[_0xa3ee('0x114')](_0x31c956)||!_[_0xa3ee('0x6c')](_0x31c956[0x0][_0xa3ee('0x89')])&&_['isNil'](_0x31c956[0x0][_0xa3ee('0x89')][_0xa3ee('0x24')])){ut['logger'](_0xa3ee('0x115'),_0x31c956);return{'isValid':![],'message':_0xa3ee('0x116')};}var _0x3925f3=this[_0xa3ee('0x11')][_0x31c956[0x0][_0xa3ee('0xfb')][_0xa3ee('0x24')]];_0x3925f3['message']='ACTIVE';if(_['isNil'](_0x3925f3)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x3925f3);return{'isValid':![],'message':_0xa3ee('0x117')};}if(!this['isTrunkReachable'](_0x3925f3[_0xa3ee('0x51')])){ut[_0xa3ee('0x103')](_0xa3ee('0x118'),_0xa3ee('0x119')+_0x3925f3['name']+_0xa3ee('0x11a'));if(!this['isTrunkReachable'](_0x3925f3[_0xa3ee('0x11b')])){ut[_0xa3ee('0x103')](_0xa3ee('0x118'),_0x3925f3[_0xa3ee('0x24')]+_0xa3ee('0x11c'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xa3ee('0x9a')](_0x3925f3[_0xa3ee('0x2e')])){ut[_0xa3ee('0x103')](_0xa3ee('0x11d'),_0x3925f3[_0xa3ee('0x24')]+_0xa3ee('0x11e'));return{'isValid':![],'message':_0xa3ee('0x119')+_0x3925f3[_0xa3ee('0x24')]+_0xa3ee('0x11e')};}return{'isValid':!![],'message':_0xa3ee('0x11f')};};Preview[_0xa3ee('0xc')][_0xa3ee('0xfd')]=function(_0x2836ac,_0x53cf94,_0x307803,_0x5c5409){var _0x445a10=this;return new BPromise(function(_0x3c7c8e,_0x3a79ea){var _0x5c270a=_0x2836ac[_0xa3ee('0xad')];var _0x20993c=_0x445a10['isTrunkReachable'](_0x53cf94[_0xa3ee('0x51')])?util[_0xa3ee('0x5a')]('SIP/%s/%s%s',_0x53cf94['Trunk'][_0xa3ee('0x24')],_[_0xa3ee('0x6c')](_0x53cf94[_0xa3ee('0x31')])?'':_0x53cf94[_0xa3ee('0x31')][_0xa3ee('0x120')]()||'',_0x53cf94['dialCutDigit']>0x0?_0x307803[_0xa3ee('0xf9')][_0xa3ee('0xfa')][_0xa3ee('0x121')](_0x53cf94[_0xa3ee('0x122')]):_0x307803[_0xa3ee('0xf9')][_0xa3ee('0xfa')]):util['format'](_0xa3ee('0x123'),_['isNil'](_0x53cf94['TrunkBackup'])?_0x53cf94[_0xa3ee('0x51')]['name']:_0x53cf94['TrunkBackup'][_0xa3ee('0x24')],_['isNil'](_0x53cf94[_0xa3ee('0x31')])?'':_0x53cf94[_0xa3ee('0x31')][_0xa3ee('0x120')]()||'',_0x53cf94[_0xa3ee('0x122')]>0x0?_0x307803[_0xa3ee('0xf9')][_0xa3ee('0xfa')][_0xa3ee('0x121')](_0x53cf94[_0xa3ee('0x122')]):_0x307803['Contact']['phone']);var _0x5c4ac6=_0x445a10[_0xa3ee('0x9b')](_0x53cf94['Trunk'])?ut[_0xa3ee('0x124')](_0x53cf94[_0xa3ee('0x51')][_0xa3ee('0x53')],_0x53cf94[_0xa3ee('0x30')],_0x53cf94[_0xa3ee('0x125')]>0x0?ut[_0xa3ee('0x126')](_0x53cf94[_0xa3ee('0x127')],_0x53cf94['dialRandomLastDigitCallerIdNumber']):_0x53cf94[_0xa3ee('0x127')]):ut['getCallerId'](_[_0xa3ee('0x6c')](_0x53cf94[_0xa3ee('0x11b')])?_0x53cf94[_0xa3ee('0x51')]['callerid']:_0x53cf94['TrunkBackup'][_0xa3ee('0x53')],_0x53cf94[_0xa3ee('0x30')],_0x53cf94[_0xa3ee('0x125')]>0x0?ut[_0xa3ee('0x126')](_0x53cf94[_0xa3ee('0x127')],_0x53cf94[_0xa3ee('0x125')]):_0x53cf94[_0xa3ee('0x127')]);if(_0x5c4ac6){_0x2836ac['originatecalleridname']=ut[_0xa3ee('0x128')](_0x5c4ac6);_0x2836ac[_0xa3ee('0x129')]=ut[_0xa3ee('0x12a')](_0x5c4ac6);}var _0x2d4c1a=ut['addVariables'](_0x53cf94,_0x307803,_0x20993c,_0x5c4ac6,_0x5c270a,_0x2836ac);_[_0xa3ee('0x12b')](_0x2836ac,ut[_0xa3ee('0x12c')](_0x2d4c1a));_0x2836ac['starttime']=moment()[_0xa3ee('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xa3ee('0x75')](ut['variablesAction'](_0x2836ac,_0x53cf94,_0x2d4c1a,_0x2836ac[_0xa3ee('0xde')],_0x5c5409))[_0xa3ee('0x84')](function(_0x2c9c0c){_0x53cf94[_0xa3ee('0x4a')]+=0x1;logger['info']('[originated][increment]',_0x5c270a,_0xa3ee('0xae'),_0x53cf94[_0xa3ee('0x24')],_0xa3ee('0x6f'),_0x53cf94[_0xa3ee('0x4a')]);_0x3c7c8e(_0x2c9c0c);})['catch'](function(_0x400b53){ut[_0xa3ee('0xf2')](_0x2836ac,0xe,_0xa3ee('0x12d'));rpcDb[_0xa3ee('0xf3')](_0x2836ac,_0xa3ee('0x12e'));_0x3a79ea(_0x400b53);});});};Preview['prototype'][_0xa3ee('0x12f')]=function(_0x6f7147){if(this['actions'][_0x6f7147['linkedid']]){this[_0xa3ee('0x13')][_0x6f7147[_0xa3ee('0xaa')]][_0xa3ee('0x77')]=_0x6f7147[_0xa3ee('0x77')];}};Preview[_0xa3ee('0xc')][_0xa3ee('0x130')]=function(_0x862bbf){var _0x328017=this;var _0x5cf3c3=this[_0xa3ee('0x13')][_0x862bbf[_0xa3ee('0x131')]];if(_0x5cf3c3){if(_0x5cf3c3['lookAgent']&&this[_0xa3ee('0x83')][_0x5cf3c3['lookAgent']]){ut[_0xa3ee('0x132')](_0x5cf3c3,this['agents'][_0x5cf3c3[_0xa3ee('0xfc')]]['name'],this['agents'][_0x5cf3c3[_0xa3ee('0xfc')]]['id']);}var _0x238f89=_[_0xa3ee('0x133')](_0x5cf3c3);_0x238f89['responsetime']=moment()[_0xa3ee('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4f0631=_0x328017[_0xa3ee('0x11')][_0x5cf3c3[_0xa3ee('0x6e')]];if(ut[_0xa3ee('0x134')](_0x862bbf[_0xa3ee('0x135')])){if(_0x5cf3c3[_0xa3ee('0xa9')]){rpcDb[_0xa3ee('0x136')](_0x5cf3c3[_0xa3ee('0x137')]);}if(_0x5cf3c3[_0xa3ee('0xde')]){rpcDb['disableContact'](_0x5cf3c3[_0xa3ee('0x137')]);}ami[_0xa3ee('0x22')](_0xa3ee('0x138'),ut[_0xa3ee('0xa0')](_0x5cf3c3,_0xa3ee('0x139')));this[_0xa3ee('0xec')](_0x238f89,_0x4f0631,_0x862bbf);}else{_0x5cf3c3[_0xa3ee('0x8d')]=moment()['format'](_0xa3ee('0x8e'));ut[_0xa3ee('0xf2')](_0x238f89,0x4,_0xa3ee('0xb8'));rpcDb[_0xa3ee('0xf3')](_0x238f89,_0xa3ee('0x13a'));}}};Preview['prototype']['syncHangup']=function(_0x553e95){var _0x2afee7=this;var _0x1ea499=this[_0xa3ee('0x13')][_0x553e95[_0xa3ee('0xaa')]];var _0x3f7856;if(_0x1ea499){_0x3f7856=this[_0xa3ee('0x11')][_0x1ea499[_0xa3ee('0x6e')]];logger[_0xa3ee('0x58')](_0xa3ee('0x13b'),_0x553e95[_0xa3ee('0xaa')],_0xa3ee('0xae'),_0x3f7856[_0xa3ee('0x24')],_0xa3ee('0x70'),_0x3f7856[_0xa3ee('0x27')]);}if(this[_0xa3ee('0x13')][_0x553e95[_0xa3ee('0xaa')]]&&_0x553e95[_0xa3ee('0xaa')]!==_0x553e95['uniqueid']){if(_0x553e95[_0xa3ee('0x13c')]==='16'&&this[_0xa3ee('0x13')][_0x553e95[_0xa3ee('0xaa')]][_0xa3ee('0x71')]){this[_0xa3ee('0x13d')](_0x553e95,_0x553e95[_0xa3ee('0xaa')],_0x553e95[_0xa3ee('0x13c')]);}else if(this['actions'][_0x553e95[_0xa3ee('0xaa')]][_0xa3ee('0x71')]){logger[_0xa3ee('0x58')]('[syncHangup][talking][cause]',_0x553e95[_0xa3ee('0xaa')],_0x553e95[_0xa3ee('0x13c')],_0xa3ee('0xae'),_0x3f7856[_0xa3ee('0x24')],_0xa3ee('0x70'),_0x3f7856[_0xa3ee('0x27')]);this[_0xa3ee('0x13d')](_0x553e95,_0x553e95[_0xa3ee('0xaa')],_0x553e95[_0xa3ee('0x13c')]);}}else if(_0x1ea499&&_[_0xa3ee('0x6c')](_0x1ea499[_0xa3ee('0x13e')])&&_0x3f7856[_0xa3ee('0x13f')]&&_0x553e95['linkedid']===_0x553e95[_0xa3ee('0xad')]&&_[_0xa3ee('0x6c')](_0x553e95[_0xa3ee('0xef')])&&_0x553e95[_0xa3ee('0x13c')]==='16'&&_0x553e95['channelstate']==='6'&&_[_0xa3ee('0xed')](_0x1ea499[_0xa3ee('0x140')])){if(_0x1ea499[_0xa3ee('0xa9')]){rpcDb[_0xa3ee('0x136')](_0x1ea499['idContact']);}if(_0x1ea499[_0xa3ee('0xde')]){rpcDb['disableContact'](_0x1ea499[_0xa3ee('0x137')]);}_0x553e95[_0xa3ee('0xef')]='22';this[_0xa3ee('0xec')](_0x1ea499,_0x3f7856,_0x553e95);}else if(_0x1ea499&&_0x1ea499[_0xa3ee('0x140')]){if(_0x553e95[_0xa3ee('0x13c')]==='16'&&this[_0xa3ee('0x13')][_0x553e95['linkedid']][_0xa3ee('0x71')]){logger[_0xa3ee('0x58')](_0xa3ee('0x141'),_0x553e95[_0xa3ee('0xaa')],_0x553e95[_0xa3ee('0x13c')],_0xa3ee('0xae'),_0x3f7856['name'],_0xa3ee('0x70'),_0x3f7856['pTalking']);this[_0xa3ee('0x13d')](_0x553e95,_0x553e95[_0xa3ee('0xaa')],_0x553e95[_0xa3ee('0x13c')]);}else if(this[_0xa3ee('0x13')][_0x553e95[_0xa3ee('0xaa')]][_0xa3ee('0x71')]){logger['info']('[syncHangup][talking][cause]',_0x553e95[_0xa3ee('0xaa')],_0x553e95[_0xa3ee('0x13c')],_0xa3ee('0xae'),_0x3f7856[_0xa3ee('0x24')],_0xa3ee('0x70'),_0x3f7856[_0xa3ee('0x27')]);this[_0xa3ee('0x13d')](_0x553e95,_0x553e95[_0xa3ee('0xaa')],_0x553e95[_0xa3ee('0x13c')]);}}};Preview[_0xa3ee('0xc')][_0xa3ee('0x1a')]=function(_0x3cc15f){if(this[_0xa3ee('0x13')][_0x3cc15f[_0xa3ee('0xeb')]]&&_0x3cc15f[_0xa3ee('0xeb')]!==_0x3cc15f[_0xa3ee('0x142')]){this[_0xa3ee('0x13d')](_0x3cc15f,_0x3cc15f[_0xa3ee('0xeb')],_0x3cc15f[_0xa3ee('0xe6')]);}};Preview[_0xa3ee('0xc')]['syncHangupRequest']=function(_0xc3db80){if(this[_0xa3ee('0x13')][_0xc3db80[_0xa3ee('0xaa')]]&&_0xc3db80[_0xa3ee('0xaa')]!==_0xc3db80[_0xa3ee('0xad')]&&!this['actions'][_0xc3db80[_0xa3ee('0xaa')]][_0xa3ee('0x71')]){if(_0xc3db80['cause']==='1'){this[_0xa3ee('0x13d')](_0xc3db80,_0xc3db80['linkedid'],_0xc3db80[_0xa3ee('0x13c')]);}}};Preview[_0xa3ee('0xc')][_0xa3ee('0x143')]=function(_0x2667d4,_0x1d1717,_0x6fd11c){if(this['actions'][_0x2667d4]){if(_[_0xa3ee('0x6c')](this[_0xa3ee('0x13')][_0x2667d4]['variables'])){this[_0xa3ee('0x13')][_0x2667d4]['variables']={};}this['actions'][_0x2667d4][_0xa3ee('0x144')][_0x1d1717]=_0x6fd11c;}};Preview['prototype'][_0xa3ee('0x1c')]=function(_0x2ff9ad){try{if(!_['isNil'](_0x2ff9ad)){if(ut[_0xa3ee('0x145')](_[_0xa3ee('0x146')](_0x2ff9ad[_0xa3ee('0x147')])[0x0])){this['addVariable'](_0x2ff9ad[_0xa3ee('0xad')],_[_0xa3ee('0x146')](_0x2ff9ad[_0xa3ee('0x147')])[0x0],_0x2ff9ad['value']);}}}catch(_0x4658b8){logger['error'](_0xa3ee('0x148'),util[_0xa3ee('0x149')](_0x4658b8,{'showHidden':![],'depth':null}));}};Preview[_0xa3ee('0xc')][_0xa3ee('0x1e')]=function(_0xa79c27){if(_0xa79c27){if(this[_0xa3ee('0x13')][_0xa79c27[_0xa3ee('0x14a')]]){this[_0xa3ee('0x13')][_0xa79c27[_0xa3ee('0x14a')]][_0xa3ee('0x140')]=!![];}}};Preview[_0xa3ee('0xc')][_0xa3ee('0x20')]=function(_0x356c0c){if(_0x356c0c){if(this[_0xa3ee('0x13')][_0x356c0c['transfererlinkedid']]){this['actions'][_0x356c0c['transfererlinkedid']][_0xa3ee('0x140')]=!![];}}};module[_0xa3ee('0x14b')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c688844..8bda2d4 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 _0x29d4=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x34b23b,_0x42fb8b){var _0x3207a1=function(_0x1984ae){while(--_0x1984ae){_0x34b23b['push'](_0x34b23b['shift']());}};_0x3207a1(++_0x42fb8b);}(_0x29d4,0x1a1));var _0x429d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x29d4[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x429d('0x0'));var BPromise=require('bluebird');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var _=require(_0x429d('0x3'));var cmHopper=require(_0x429d('0x4'));var cmHopperFinal=require(_0x429d('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x429d('0x6'));var voiceQueueRt=require(_0x429d('0x7'));var agentReportPreview=require(_0x429d('0x8'));var voiceQueueReport=require(_0x429d('0x9'));function loggerCatch(_0x1c55aa){return function(_0xa71445){logger[_0x429d('0xa')](_0x1c55aa,util[_0x429d('0xb')](_0xa71445,{'showHidden':![],'depth':null}));};}function create(_0x4befb9){return BPromise[_0x429d('0xc')]()['then'](cmHopperHistory[_0x429d('0xd')](_0x4befb9))[_0x429d('0xe')](loggerCatch(_0x429d('0xf')));}function createAgent(_0x5e8430){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](agentReportPreview['createHistory'](_0x5e8430))[_0x429d('0xe')](loggerCatch(_0x429d('0xf')));}function moveContact(_0x417f77){return BPromise['resolve']()[_0x429d('0x10')](cmHopper[_0x429d('0x11')](_0x417f77,!![]))[_0x429d('0xe')](loggerCatch(_0x429d('0x12')));}exports['checkIsBlackList']=function(_0x1c542c){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopperBlack['checkIsBlackList'](_0x1c542c))[_0x429d('0xe')](loggerCatch(_0x429d('0x13')));};exports['getContactPreview']=function(_0x32d6b3){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x14')](_0x32d6b3))[_0x429d('0xe')](loggerCatch(_0x429d('0x15')));};exports['createHistory']=function(_0xbfe8a0,_0x53d19d){create(_0xbfe8a0)[_0x429d('0xe')](loggerCatch(_0x53d19d));moveContact(_0xbfe8a0)[_0x429d('0xe')](loggerCatch(_0x53d19d));};exports[_0x429d('0x16')]=function(_0x2dc57a,_0x51ef88){createAgent(_0x2dc57a)[_0x429d('0xe')](loggerCatch(_0x51ef88));};exports[_0x429d('0x17')]=function(_0x2b9e78,_0x513854){create(_0x2b9e78)[_0x429d('0xe')](loggerCatch(_0x513854));};exports[_0x429d('0x18')]=function(_0x202c4e,_0xcbf00c){moveContact(_0x202c4e)[_0x429d('0xe')](loggerCatch(_0xcbf00c));};exports[_0x429d('0x19')]=function(_0x5a4093,_0x13e309,_0x165e4d){if(_0x13e309){_0x5a4093[_0x429d('0x1a')]=null;}if(_0x165e4d){_0x5a4093['active']=![];}return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x19')](_0x5a4093))[_0x429d('0xe')](loggerCatch(_0x429d('0x1b')));};exports[_0x429d('0x1c')]=function(_0x4c6d89){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper['countReScheduled'](_0x4c6d89))[_0x429d('0xe')](loggerCatch(_0x429d('0x1d')));};exports[_0x429d('0x1e')]=function(_0x11c423){return BPromise['resolve']()[_0x429d('0x10')](cmHopper[_0x429d('0x1e')]({'UserId':null},_0x11c423,0x1))[_0x429d('0xe')](loggerCatch(_0x429d('0x1f')));};exports[_0x429d('0x20')]=function(_0x514f1b){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x1e')]({'active':![]},_0x514f1b,0x1))[_0x429d('0xe')](loggerCatch(_0x429d('0x21')));};exports[_0x429d('0x22')]=function(_0x2351c9){var _0xdc7bf9={};_0xdc7bf9[_0x429d('0x23')]=_0x2351c9['type'];_0xdc7bf9[_0x429d('0x24')]=_0x2351c9[_0x429d('0x24')];_0xdc7bf9['calleridnum']=_0x2351c9[_0x429d('0x25')];_0xdc7bf9[_0x429d('0x26')]=_0x2351c9[_0x429d('0x26')];_0xdc7bf9[_0x429d('0x27')]=_0x2351c9[_0x429d('0x27')];_0xdc7bf9['queuecallerjoinAt']=_0x2351c9[_0x429d('0x28')];_0xdc7bf9[_0x429d('0x29')]=_0x2351c9[_0x429d('0x28')];_0xdc7bf9[_0x429d('0x2a')]=0x1;_0xdc7bf9[_0x429d('0x2b')]=_0x2351c9[_0x429d('0x2c')];_0xdc7bf9['connectedlinename']=_0x2351c9['membername'];_0xdc7bf9[_0x429d('0x2d')]=_0x429d('0x2e');_0xdc7bf9['exten']='xcally-motion-preview';_0xdc7bf9[_0x429d('0x2f')]=0x0;_0xdc7bf9['assigned']=0x1;_0xdc7bf9[_0x429d('0x30')]=_0x2351c9[_0x429d('0x31')];_0xdc7bf9[_0x429d('0x32')]=_0x429d('0x33');return BPromise['resolve']()[_0x429d('0x10')](voiceQueueReport[_0x429d('0x34')](_0xdc7bf9))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x5698f5,_0x5bb435){return BPromise[_0x429d('0xc')]()['then'](cmHopper['getContactRecallMe'](_0x5698f5,_0x5bb435))[_0x429d('0xe')](loggerCatch(_0x429d('0x35')));};exports[_0x429d('0x36')]=function(_0x30e645){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper['rescheduleContact'](_0x30e645,!![],!![]))[_0x429d('0xe')](loggerCatch(_0x429d('0x37')));}; \ No newline at end of file +var _0x29d4=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x17dcd1,_0x3b7ccb){var _0x12af77=function(_0x5c3bac){while(--_0x5c3bac){_0x17dcd1['push'](_0x17dcd1['shift']());}};_0x12af77(++_0x3b7ccb);}(_0x29d4,0x1a1));var _0x429d=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x29d4[_0x373dee];return _0x46798f;};'use strict';var util=require(_0x429d('0x0'));var BPromise=require('bluebird');var logger=require(_0x429d('0x1'))(_0x429d('0x2'));var _=require(_0x429d('0x3'));var cmHopper=require(_0x429d('0x4'));var cmHopperFinal=require(_0x429d('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x429d('0x6'));var voiceQueueRt=require(_0x429d('0x7'));var agentReportPreview=require(_0x429d('0x8'));var voiceQueueReport=require(_0x429d('0x9'));function loggerCatch(_0x1c55aa){return function(_0xa71445){logger[_0x429d('0xa')](_0x1c55aa,util[_0x429d('0xb')](_0xa71445,{'showHidden':![],'depth':null}));};}function create(_0x4befb9){return BPromise[_0x429d('0xc')]()['then'](cmHopperHistory[_0x429d('0xd')](_0x4befb9))[_0x429d('0xe')](loggerCatch(_0x429d('0xf')));}function createAgent(_0x5e8430){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](agentReportPreview['createHistory'](_0x5e8430))[_0x429d('0xe')](loggerCatch(_0x429d('0xf')));}function moveContact(_0x417f77){return BPromise['resolve']()[_0x429d('0x10')](cmHopper[_0x429d('0x11')](_0x417f77,!![]))[_0x429d('0xe')](loggerCatch(_0x429d('0x12')));}exports['checkIsBlackList']=function(_0x1c542c){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopperBlack['checkIsBlackList'](_0x1c542c))[_0x429d('0xe')](loggerCatch(_0x429d('0x13')));};exports['getContactPreview']=function(_0x32d6b3){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x14')](_0x32d6b3))[_0x429d('0xe')](loggerCatch(_0x429d('0x15')));};exports['createHistory']=function(_0xbfe8a0,_0x53d19d){create(_0xbfe8a0)[_0x429d('0xe')](loggerCatch(_0x53d19d));moveContact(_0xbfe8a0)[_0x429d('0xe')](loggerCatch(_0x53d19d));};exports[_0x429d('0x16')]=function(_0x2dc57a,_0x51ef88){createAgent(_0x2dc57a)[_0x429d('0xe')](loggerCatch(_0x51ef88));};exports[_0x429d('0x17')]=function(_0x2b9e78,_0x513854){create(_0x2b9e78)[_0x429d('0xe')](loggerCatch(_0x513854));};exports[_0x429d('0x18')]=function(_0x202c4e,_0xcbf00c){moveContact(_0x202c4e)[_0x429d('0xe')](loggerCatch(_0xcbf00c));};exports[_0x429d('0x19')]=function(_0x5a4093,_0x13e309,_0x165e4d){if(_0x13e309){_0x5a4093[_0x429d('0x1a')]=null;}if(_0x165e4d){_0x5a4093['active']=![];}return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x19')](_0x5a4093))[_0x429d('0xe')](loggerCatch(_0x429d('0x1b')));};exports[_0x429d('0x1c')]=function(_0x4c6d89){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper['countReScheduled'](_0x4c6d89))[_0x429d('0xe')](loggerCatch(_0x429d('0x1d')));};exports[_0x429d('0x1e')]=function(_0x11c423){return BPromise['resolve']()[_0x429d('0x10')](cmHopper[_0x429d('0x1e')]({'UserId':null},_0x11c423,0x1))[_0x429d('0xe')](loggerCatch(_0x429d('0x1f')));};exports[_0x429d('0x20')]=function(_0x514f1b){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper[_0x429d('0x1e')]({'active':![]},_0x514f1b,0x1))[_0x429d('0xe')](loggerCatch(_0x429d('0x21')));};exports[_0x429d('0x22')]=function(_0x2351c9){var _0xdc7bf9={};_0xdc7bf9[_0x429d('0x23')]=_0x2351c9['type'];_0xdc7bf9[_0x429d('0x24')]=_0x2351c9[_0x429d('0x24')];_0xdc7bf9['calleridnum']=_0x2351c9[_0x429d('0x25')];_0xdc7bf9[_0x429d('0x26')]=_0x2351c9[_0x429d('0x26')];_0xdc7bf9[_0x429d('0x27')]=_0x2351c9[_0x429d('0x27')];_0xdc7bf9['queuecallerjoinAt']=_0x2351c9[_0x429d('0x28')];_0xdc7bf9[_0x429d('0x29')]=_0x2351c9[_0x429d('0x28')];_0xdc7bf9[_0x429d('0x2a')]=0x1;_0xdc7bf9[_0x429d('0x2b')]=_0x2351c9[_0x429d('0x2c')];_0xdc7bf9['connectedlinename']=_0x2351c9['membername'];_0xdc7bf9[_0x429d('0x2d')]=_0x429d('0x2e');_0xdc7bf9['exten']='xcally-motion-preview';_0xdc7bf9[_0x429d('0x2f')]=0x0;_0xdc7bf9['assigned']=0x1;_0xdc7bf9[_0x429d('0x30')]=_0x2351c9[_0x429d('0x31')];_0xdc7bf9[_0x429d('0x32')]=_0x429d('0x33');return BPromise['resolve']()[_0x429d('0x10')](voiceQueueReport[_0x429d('0x34')](_0xdc7bf9))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x5698f5,_0x5bb435){return BPromise[_0x429d('0xc')]()['then'](cmHopper['getContactRecallMe'](_0x5698f5,_0x5bb435))[_0x429d('0xe')](loggerCatch(_0x429d('0x35')));};exports[_0x429d('0x36')]=function(_0x30e645){return BPromise[_0x429d('0xc')]()[_0x429d('0x10')](cmHopper['rescheduleContact'](_0x30e645,!![],!![]))[_0x429d('0xe')](loggerCatch(_0x429d('0x37')));}; \ 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 992997a..5c1e0f4 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 _0x0120=['Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','RECALL','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','buildAcw','interface','agentReadyId','not_inuse','status','reachable','diff','createBody','CampaignId','idContact','type','dialAnswer','countglobal','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','logger','info','loggerError','inspect','logger2','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil'];(function(_0x37e9c6,_0x33ebb1){var _0x12aeb9=function(_0x1b5d48){while(--_0x1b5d48){_0x37e9c6['push'](_0x37e9c6['shift']());}};_0x12aeb9(++_0x33ebb1);}(_0x0120,0x6f));var _0x0012=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x0120[_0x110c3d];return _0x226d67;};'use strict';var util=require(_0x0012('0x0'));var _=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var logger=require(_0x0012('0x3'))(_0x0012('0x4'));var ipAgi=process[_0x0012('0x5')][_0x0012('0x6')]||_0x0012('0x7');function getSeconds(_0x357f77,_0x302029){var _0x3505ab=moment(_0x357f77)[_0x0012('0x8')](0x0);var _0x4eaa5b=moment(_0x302029)['milliseconds'](0x0);return _0x3505ab['diff'](_0x4eaa5b,_0x0012('0x9'));}exports[_0x0012('0xa')]=function(_0x3d4c64){return function(_0x30176d){logger[_0x0012('0xb')](_0x3d4c64,util['inspect'](_0x30176d,{'showHidden':![],'depth':null}));};};exports[_0x0012('0xc')]=function(_0x2d484c,_0x1dc1b2){logger[_0x0012('0xd')](_0x2d484c,util['inspect'](_0x1dc1b2,{'showHidden':![],'depth':null}));};exports[_0x0012('0xe')]=function(_0x4b2068,_0x443fef){logger[_0x0012('0xb')](_0x4b2068,util[_0x0012('0xf')](_0x443fef,{'showHidden':![],'depth':null}));};exports[_0x0012('0x10')]=function(_0x2451b5){return function(_0x4d3e7a){logger[_0x0012('0xd')](_0x2451b5,util['inspect'](_0x4d3e7a,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5d845a,_0x5563fc,_0x3a7d50){return{'message':_0x5d845a,'unlock':_0x5563fc,'active':_0x3a7d50};};exports['getCallerId']=function(_0x3995fd,_0xf658bc,_0x47a6ef){if(!_[_0x0012('0x11')](_0x47a6ef)&&_0x0012('0x12')===typeof _0x47a6ef&&!_[_0x0012('0x13')](_0x47a6ef)){if(!_[_0x0012('0x11')](_0xf658bc)&&'string'===typeof _0xf658bc&&!_['isEmpty'](_0xf658bc)){return util[_0x0012('0x14')](_0x0012('0x15'),_0xf658bc,_0x47a6ef);}return util[_0x0012('0x14')](_0x0012('0x15'),_0x47a6ef,_0x47a6ef);}if(!_[_0x0012('0x11')](_0x3995fd)&&_0x0012('0x12')===typeof _0x3995fd&&!_[_0x0012('0x13')](_0x3995fd)){return _0x3995fd;}return _0x0012('0x16');};exports['isActive']=function(_0x226968){if(_[_0x0012('0x17')](_0x226968)){return![];}return _0x226968;};exports['addVariables']=function(_0x45d00b,_0x1f54fc,_0xa2e623,_0x2c837e,_0x53ac2d,_0x4d56ff){var _0x460d82={'XMD-QUEUE':_0x1f54fc[_0x0012('0x18')]?_0x1f54fc[_0x0012('0x18')][_0x0012('0x19')]:'','XMD-CALLERID':_0x2c837e,'XMD-CALLERID-PREVIEW':_0x4d56ff?util[_0x0012('0x14')](_0x0012('0x15'),_0x4d56ff[_0x0012('0x1a')],_0x4d56ff[_0x0012('0x1b')]):_0x2c837e,'XMD-DIALID':_0x53ac2d,'XMD-CONTACTID':_0x1f54fc['ContactId'],'XMD-CDRTYPE':_0x0012('0x1c'),'CALLERID(all)':_0x2c837e,'XMD-VOICEQUEUEID':_0x1f54fc[_0x0012('0x1d')],'XMD-DIALCHANNEL':_0xa2e623,'XMD-DIALTIMEOUT':_0x45d00b['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x0012('0x14')](_0x0012('0x1e'),_0x45d00b[_0x0012('0x1f')]?'g':'',_[_0x0012('0x13')](_0x45d00b[_0x0012('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x45d00b[_0x0012('0x21')]||'','XMD-AGI':_0x45d00b[_0x0012('0x22')]?util[_0x0012('0x14')](_0x0012('0x23'),ipAgi,_0x45d00b[_0x0012('0x22')]):_0x0012('0x24'),'XMD-AGIAFTER':_0x45d00b[_0x0012('0x1f')]?util[_0x0012('0x14')](_0x0012('0x23'),ipAgi,_0x45d00b[_0x0012('0x1f')]):_0x0012('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x4d56ff?_0x4d56ff[_0x0012('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x4d56ff?_0x4d56ff[_0x0012('0x26')]:'','XMD-DESTINATION':_0x0012('0x27')};if(!_[_0x0012('0x13')](_0x45d00b[_0x0012('0x20')])){_0x460d82[util[_0x0012('0x14')]('%s',_0x0012('0x28'))]=_0x45d00b[_0x0012('0x20')];_0x460d82[util[_0x0012('0x14')]('%s',_0x0012('0x29'))]=_0x53ac2d;}if(_0x1f54fc&&_0x1f54fc['Contact']){for(var _0x283134 in _0x1f54fc[_0x0012('0x2a')]){if(_0x1f54fc['Contact'][_0x0012('0x2b')](_0x283134)){if(!_[_0x0012('0x17')](_0x1f54fc[_0x0012('0x2a')][_0x283134])&&_0x283134!=='id'&&_0x283134!==_0x0012('0x2c')&&_0x283134!==_0x0012('0x2d')&&_0x283134!=='updatedAt'){_0x460d82[util[_0x0012('0x14')](_0x0012('0x2e'),_0x0012('0x2f'),_['toUpper'](_0x283134))]=_0x1f54fc[_0x0012('0x2a')][_0x283134];}}}}return _0x460d82;};exports[_0x0012('0x30')]=function(_0x398990){var _0x6aa43e={};for(var _0x46b600 in _0x398990){if(_0x398990[_0x0012('0x2b')](_0x46b600)){_0x6aa43e[util['format']('%s',_[_0x0012('0x31')](_0x46b600))]=_0x398990[_0x46b600];}}return{'variables':_0x6aa43e};};exports[_0x0012('0x32')]=function(_0x4648ec,_0x666a20){if(!_['isNil'](_0x4648ec)){if(_0x4648ec['hasOwnProperty'](_0x0012('0x33'))){if(_0x4648ec[_0x0012('0x33')]>0x0){_0x4648ec[_0x0012('0x33')]-=0x1;}else{logger[_0x0012('0xb')](_0x0012('0x34'),_0x666a20);}}}else{logger[_0x0012('0xb')](_0x0012('0x35'),_0x666a20);}};exports['logBlacklist']=function(_0x23e005){var _0xfdb3be=moment()['format'](_0x0012('0x36'));_0x23e005[_0x0012('0x37')]=0xd;_0x23e005[_0x0012('0x38')]=_0x0012('0x39');_0x23e005[_0x0012('0x3a')]=_0xfdb3be;_0x23e005[_0x0012('0x3b')]=_0xfdb3be;_0x23e005[_0x0012('0x3c')]=_0xfdb3be;};exports['logAgent']=function(_0x1616ce,_0x4e0b25,_0xaf7315){var _0x4b0b19=moment()['format'](_0x0012('0x36'));_0x1616ce[_0x0012('0x37')]=_0x4e0b25;_0x1616ce[_0x0012('0x38')]=_0xaf7315;_0x1616ce['responsetime']=_0x4b0b19;_0x1616ce[_0x0012('0x3d')]=getSeconds(_0x1616ce[_0x0012('0x3b')],_0x1616ce[_0x0012('0x3a')]);};exports[_0x0012('0x3e')]=function(_0x3d81ed,_0x379780,_0x85a93e){_0x3d81ed[_0x0012('0x3f')]=_0x379780;_0x3d81ed['UserId']=_0x85a93e;};exports[_0x0012('0x40')]=function(_0x25aff1,_0x559751,_0x1799f2){var _0x42e01c=moment()[_0x0012('0x14')](_0x0012('0x36'));_0x25aff1['state']=_0x559751;_0x25aff1['statedesc']=_0x1799f2;_0x25aff1[_0x0012('0x3b')]=_0x25aff1['responsetime']?_0x25aff1[_0x0012('0x3b')]:_0x42e01c;_0x25aff1[_0x0012('0x3c')]=_0x25aff1[_0x0012('0x3c')]?_0x25aff1[_0x0012('0x3c')]:_0x42e01c;_0x25aff1[_0x0012('0x3d')]=getSeconds(_0x25aff1['responsetime']||0x0,_0x25aff1[_0x0012('0x3a')]||0x0);_0x25aff1[_0x0012('0x41')]=_0x25aff1['answertime']?getSeconds(_0x25aff1[_0x0012('0x3c')],_0x25aff1[_0x0012('0x42')]):0x0;};exports[_0x0012('0x43')]=function(_0x207b61){return _0x207b61==='Failure';};exports['variablesAction']=function(_0x22090f,_0x58d956,_0x3439b6,_0x56fac8,_0xdd4689){var _0x1296fd=_0x56fac8?_0x0012('0x44'):_0x22090f[_0x0012('0x1a')];_0x1296fd=_0xdd4689?'BOOKED':_0x1296fd;return{'actionid':_0x22090f[_0x0012('0x45')],'action':'originate','channel':_0x22090f[_0x0012('0x46')],'callerid':util[_0x0012('0x14')](_0x0012('0x15'),_0x1296fd,_0x22090f[_0x0012('0x1b')]),'Exten':_0x0012('0x27'),'Context':_0x0012('0x47'),'Priority':'1','variable':_0x3439b6,'timeout':(_0x58d956[_0x0012('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x22090f['uniqueid']};};exports[_0x0012('0x49')]=function(_0x34d592){return _0x34d592[_0x0012('0x4a')]+_0x34d592[_0x0012('0x4b')]+_0x34d592[_0x0012('0x4c')]+_0x34d592[_0x0012('0x4d')]+_0x34d592['countnosuchnumberretry'];};exports['cloneAction']=function(_0x48de64){var _0x5b6370=_[_0x0012('0x4e')](_0x48de64);_0x5b6370[_0x0012('0x37')]=0xf;_0x5b6370[_0x0012('0x38')]=_0x0012('0x4f');return _0x5b6370;};exports[_0x0012('0x50')]=function(_0x53d552,_0x44ffaf,_0x3a5006){var _0x7d04c7={};_0x7d04c7[_0x44ffaf]=_0x53d552[_0x44ffaf];_0x7d04c7[_0x0012('0x51')]=![];_0x7d04c7[_0x0012('0x52')]=moment()[_0x0012('0x53')](_0x3a5006,_0x0012('0x54'))[_0x0012('0x14')](_0x0012('0x36'));_0x7d04c7[_0x0012('0x55')]=_0x53d552[_0x0012('0x55')];_0x7d04c7['ListId']=_0x53d552[_0x0012('0x56')];_0x7d04c7[_0x0012('0x1d')]=_0x53d552[_0x0012('0x1d')]||undefined;return _0x7d04c7;};exports['decrementTalkink']=function(_0x2d4ee7,_0x2f451b){if(!_[_0x0012('0x17')](_0x2d4ee7)){if(_0x2d4ee7[_0x0012('0x57')]>0x0){_0x2d4ee7[_0x0012('0x57')]-=0x1;}else{logger['error'](_0x2f451b,_0x0012('0x58'));}}else{logger['error'](_0x2f451b,_0x0012('0x59'));}};exports[_0x0012('0x5a')]=function(_0x5c074f){if(_0x5c074f<=0x0){return!![];}return![];};exports[_0x0012('0x5b')]=function(_0x19cf31,_0x431ec5){_0x19cf31[_0x0012('0x5c')]=_0x431ec5;_0x19cf31[_0x0012('0x19')]=_0x19cf31[_0x0012('0x5d')];_0x19cf31['interface']=_0x19cf31[_0x0012('0x46')];return _0x19cf31;};exports[_0x0012('0x5e')]=function(_0x213fb3){var _0xade4b4={};_0xade4b4['queue']=_0x213fb3[_0x0012('0x5d')];_0xade4b4[_0x0012('0x5f')]=_0x213fb3[_0x0012('0x46')];_0xade4b4['uniqueid']=_0x213fb3[_0x0012('0x45')];return _0xade4b4;};exports[_0x0012('0x60')]=function(_0x1e3041){var _0x240ce6=[];for(var _0x1a48d9 in _0x1e3041){if(_0x1e3041[_0x0012('0x2b')](_0x1a48d9)){if(!_[_0x0012('0x17')](_0x1e3041[_0x1a48d9])&&_0x1e3041[_0x1a48d9][_0x0012('0x37')]===_0x0012('0x61')&&_0x1e3041[_0x1a48d9][_0x0012('0x62')]===_0x0012('0x63')){_0x240ce6['push'](_0x1e3041[_0x1a48d9]['id']);}}}return _0x240ce6;};exports['getDiff']=function(_0x2892ff){var _0x18fc75=moment()[_0x0012('0x8')](0x0);var _0x3d34e6=moment(_0x2892ff)['milliseconds'](0x0);return _0x18fc75[_0x0012('0x64')](_0x3d34e6,_0x0012('0x9'));};exports[_0x0012('0x65')]=function(_0x3d54c0){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d54c0[_0x0012('0x55')],'ListId':_0x3d54c0[_0x0012('0x56')],'VoiceQueueId':_0x3d54c0['VoiceQueueId']||undefined,'CampaignId':_0x3d54c0[_0x0012('0x66')]||undefined};};exports['filterKey']=function(_0x1495ce){if(_0x1495ce===_0x0012('0x45')||_0x1495ce===_0x0012('0x67')||_0x1495ce===_0x0012('0x5d')||_0x1495ce===_0x0012('0x68')||_0x1495ce==='campaigntype'||_0x1495ce===_0x0012('0x69')||_0x1495ce===_0x0012('0x3f')||_0x1495ce===_0x0012('0x46')||_0x1495ce===_0x0012('0x1a')||_0x1495ce===_0x0012('0x51')||_0x1495ce===_0x0012('0x1b')||_0x1495ce==='scheduledat'||_0x1495ce==='countbusyretry'||_0x1495ce==='countcongestionretry'||_0x1495ce===_0x0012('0x4c')||_0x1495ce===_0x0012('0x6a')||_0x1495ce==='callback'||_0x1495ce==='callbackuniqueid'||_0x1495ce==='callbackat'||_0x1495ce===_0x0012('0x6b')||_0x1495ce===_0x0012('0x55')||_0x1495ce===_0x0012('0x56')||_0x1495ce===_0x0012('0x6c')||_0x1495ce===_0x0012('0x1d')||_0x1495ce===_0x0012('0x6d')||_0x1495ce===_0x0012('0x6e')||_0x1495ce===_0x0012('0x6f')||_0x1495ce===_0x0012('0x70')||_0x1495ce===_0x0012('0x71')||_0x1495ce==='xmd-dialurl'||_0x1495ce===_0x0012('0x72')||_0x1495ce===_0x0012('0x73')||_0x1495ce===_0x0012('0x74')||_0x1495ce==='xmd-dialchannel'||_0x1495ce===_0x0012('0x75')||_0x1495ce===_0x0012('0x76')||_0x1495ce===_0x0012('0x77')||_0x1495ce===_0x0012('0x78')||_0x1495ce==='xmd-agi'||_0x1495ce===_0x0012('0x79')||_0x1495ce===_0x0012('0x7a')||_0x1495ce===_0x0012('0x7b')||_0x1495ce===_0x0012('0x7c')||_0x1495ce==='rtpaudioqosloss'||_0x1495ce===_0x0012('0x7d')||_0x1495ce===_0x0012('0x7e')||_0x1495ce===_0x0012('0x7f')||_0x1495ce===_0x0012('0x79')||_0x1495ce===_0x0012('0x7a')||_0x1495ce===_0x0012('0x7b')||_0x1495ce===_0x0012('0x7c')||_0x1495ce==='rtpaudioqosloss'||_0x1495ce==='rtpaudioqoslossbridged'||_0x1495ce===_0x0012('0x7e')||_0x1495ce===_0x0012('0x7f')||_0x1495ce===_0x0012('0x80')||_0x1495ce===_0x0012('0x81')||_0x1495ce===_0x0012('0x37')||_0x1495ce===_0x0012('0x38')){return![];}return!![];};exports[_0x0012('0x82')]=function(_0x38cc51,_0x548487){var _0x15b058,_0x2ec0ec,_0x371934;if(_0x548487<=0x0){_0x548487=0x1;}_0x15b058=new RegExp(_0x0012('0x83')+_0x548487+'}$');_0x2ec0ec=Math[_0x0012('0x84')](0xa,_0x548487-0x1);_0x371934=Math[_0x0012('0x84')](0xa,_0x548487)-0x1;return util['format']('%s',_['replace'](_0x38cc51,_0x15b058,_['random'](_0x2ec0ec,_0x371934)));};exports['extractCalleridName']=function(_0x5292dc){var _0x4da3a6=_0x5292dc[_0x0012('0x85')](/"(.*?)"/);return _0x4da3a6?_0x4da3a6[0x1]:_0x5292dc;};exports[_0x0012('0x86')]=function(_0x4b1288){var _0x1cfe39=_0x4b1288[_0x0012('0x85')](/<(.*?)>/);return _0x1cfe39?_0x1cfe39[0x1]:_0x4b1288;}; \ No newline at end of file +var _0x896e=['NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','logAgent','ringtime','starttime','logLookAgent','membername','statedesc','endtime','answertime','Failure','RECALL','uniqueid','originate','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','scheduledAt','scheduledat','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','buildObj','lastevent','queue','interface','channelAgent','buildAcw','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','type','active','countnoanswerretry','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','format','calleridname','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22'];(function(_0x5d851d,_0x53c51c){var _0xbaaa92=function(_0x216b72){while(--_0x216b72){_0x5d851d['push'](_0x5d851d['shift']());}};_0xbaaa92(++_0x53c51c);}(_0x896e,0x1e9));var _0xe896=function(_0x479307,_0x30f5cd){_0x479307=_0x479307-0x0;var _0x58c8fd=_0x896e[_0x479307];return _0x58c8fd;};'use strict';var util=require(_0xe896('0x0'));var _=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var logger=require(_0xe896('0x3'))(_0xe896('0x4'));var ipAgi=process[_0xe896('0x5')][_0xe896('0x6')]||_0xe896('0x7');function getSeconds(_0x3f85e5,_0x2d3521){var _0x244f68=moment(_0x3f85e5)[_0xe896('0x8')](0x0);var _0x52ac80=moment(_0x2d3521)[_0xe896('0x8')](0x0);return _0x244f68[_0xe896('0x9')](_0x52ac80,_0xe896('0xa'));}exports[_0xe896('0xb')]=function(_0x43c619){return function(_0x5a1909){logger[_0xe896('0xc')](_0x43c619,util[_0xe896('0xd')](_0x5a1909,{'showHidden':![],'depth':null}));};};exports[_0xe896('0xe')]=function(_0x4afd3f,_0x305616){logger['info'](_0x4afd3f,util[_0xe896('0xd')](_0x305616,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x409eaf,_0x146b12){logger[_0xe896('0xc')](_0x409eaf,util['inspect'](_0x146b12,{'showHidden':![],'depth':null}));};exports[_0xe896('0xf')]=function(_0x4452cd){return function(_0x3e8ac9){logger['info'](_0x4452cd,util[_0xe896('0xd')](_0x3e8ac9,{'showHidden':![],'depth':null}));};};exports[_0xe896('0x10')]=function(_0x3b99b0,_0x5383b7,_0x2d0e46){return{'message':_0x3b99b0,'unlock':_0x5383b7,'active':_0x2d0e46};};exports[_0xe896('0x11')]=function(_0x1e7ef8,_0x564758,_0x5a7957){if(!_[_0xe896('0x12')](_0x5a7957)&&_0xe896('0x13')===typeof _0x5a7957&&!_['isEmpty'](_0x5a7957)){if(!_['isUndefined'](_0x564758)&&_0xe896('0x13')===typeof _0x564758&&!_[_0xe896('0x14')](_0x564758)){return util['format'](_0xe896('0x15'),_0x564758,_0x5a7957);}return util['format'](_0xe896('0x15'),_0x5a7957,_0x5a7957);}if(!_[_0xe896('0x12')](_0x1e7ef8)&&_0xe896('0x13')===typeof _0x1e7ef8&&!_['isEmpty'](_0x1e7ef8)){return _0x1e7ef8;}return _0xe896('0x16');};exports[_0xe896('0x17')]=function(_0xdcdba8){if(_[_0xe896('0x18')](_0xdcdba8)){return![];}return _0xdcdba8;};exports[_0xe896('0x19')]=function(_0x3ac8b8,_0x388c2e,_0x32d3d3,_0x49547b,_0x180d46,_0x5e1f29){var _0x5d2c8d={'XMD-QUEUE':_0x388c2e[_0xe896('0x1a')]?_0x388c2e[_0xe896('0x1a')][_0xe896('0x1b')]:'','XMD-CALLERID':_0x49547b,'XMD-CALLERID-PREVIEW':_0x5e1f29?util[_0xe896('0x1c')]('\x22%s\x22\x20<%s>',_0x5e1f29[_0xe896('0x1d')],_0x5e1f29['calleridnum']):_0x49547b,'XMD-DIALID':_0x180d46,'XMD-CONTACTID':_0x388c2e['ContactId'],'XMD-CDRTYPE':_0xe896('0x1e'),'CALLERID(all)':_0x49547b,'XMD-VOICEQUEUEID':_0x388c2e[_0xe896('0x1f')],'XMD-DIALCHANNEL':_0x32d3d3,'XMD-DIALTIMEOUT':_0x3ac8b8[_0xe896('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xe896('0x1c')](_0xe896('0x21'),_0x3ac8b8[_0xe896('0x22')]?'g':'',_[_0xe896('0x14')](_0x3ac8b8['monitor_format'])?'':_0xe896('0x23')),'XMD-DIALURL':_0x3ac8b8[_0xe896('0x24')]||'','XMD-AGI':_0x3ac8b8[_0xe896('0x25')]?util['format'](_0xe896('0x26'),ipAgi,_0x3ac8b8[_0xe896('0x25')]):_0xe896('0x27'),'XMD-AGIAFTER':_0x3ac8b8[_0xe896('0x22')]?util[_0xe896('0x1c')](_0xe896('0x26'),ipAgi,_0x3ac8b8['dialQueueProject2']):_0xe896('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x5e1f29?_0x5e1f29[_0xe896('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x5e1f29?_0x5e1f29[_0xe896('0x29')]:'','XMD-DESTINATION':_0xe896('0x2a')};if(!_[_0xe896('0x14')](_0x3ac8b8['monitor_format'])){_0x5d2c8d[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3ac8b8['monitor_format'];_0x5d2c8d[util['format']('%s',_0xe896('0x2b'))]=_0x180d46;}if(_0x388c2e&&_0x388c2e[_0xe896('0x2c')]){for(var _0x10fd26 in _0x388c2e[_0xe896('0x2c')]){if(_0x388c2e[_0xe896('0x2c')][_0xe896('0x2d')](_0x10fd26)){if(!_[_0xe896('0x18')](_0x388c2e[_0xe896('0x2c')][_0x10fd26])&&_0x10fd26!=='id'&&_0x10fd26!=='tags'&&_0x10fd26!=='createdAt'&&_0x10fd26!==_0xe896('0x2e')){_0x5d2c8d[util[_0xe896('0x1c')](_0xe896('0x2f'),_0xe896('0x30'),_['toUpper'](_0x10fd26))]=_0x388c2e[_0xe896('0x2c')][_0x10fd26];}}}}return _0x5d2c8d;};exports['toLowerVariables']=function(_0x57c6e8){var _0x166b86={};for(var _0x363fd8 in _0x57c6e8){if(_0x57c6e8[_0xe896('0x2d')](_0x363fd8)){_0x166b86[util['format']('%s',_['toLower'](_0x363fd8))]=_0x57c6e8[_0x363fd8];}}return{'variables':_0x166b86};};exports['updateOriginated']=function(_0x46c8ae,_0x1493b8){if(!_[_0xe896('0x18')](_0x46c8ae)){if(_0x46c8ae[_0xe896('0x2d')](_0xe896('0x31'))){if(_0x46c8ae['originated']>0x0){_0x46c8ae[_0xe896('0x31')]-=0x1;}else{logger[_0xe896('0xc')](_0xe896('0x32'),_0x1493b8);}}}else{logger[_0xe896('0xc')](_0xe896('0x33'),_0x1493b8);}};exports[_0xe896('0x34')]=function(_0x3aeccc){var _0x3e28f0=moment()['format'](_0xe896('0x35'));_0x3aeccc[_0xe896('0x36')]=0xd;_0x3aeccc['statedesc']=_0xe896('0x37');_0x3aeccc['starttime']=_0x3e28f0;_0x3aeccc[_0xe896('0x38')]=_0x3e28f0;_0x3aeccc['endtime']=_0x3e28f0;};exports[_0xe896('0x39')]=function(_0x5ba71e,_0x2ab7a6,_0x470c29){var _0x403ff4=moment()[_0xe896('0x1c')](_0xe896('0x35'));_0x5ba71e['state']=_0x2ab7a6;_0x5ba71e['statedesc']=_0x470c29;_0x5ba71e[_0xe896('0x38')]=_0x403ff4;_0x5ba71e[_0xe896('0x3a')]=getSeconds(_0x5ba71e[_0xe896('0x38')],_0x5ba71e[_0xe896('0x3b')]);};exports[_0xe896('0x3c')]=function(_0x4c0ef0,_0x5b8131,_0x127a6f){_0x4c0ef0[_0xe896('0x3d')]=_0x5b8131;_0x4c0ef0['UserId']=_0x127a6f;};exports['logCustomer']=function(_0x19d2fd,_0x3b1de8,_0x911adb){var _0x2ab0ac=moment()[_0xe896('0x1c')](_0xe896('0x35'));_0x19d2fd[_0xe896('0x36')]=_0x3b1de8;_0x19d2fd[_0xe896('0x3e')]=_0x911adb;_0x19d2fd[_0xe896('0x38')]=_0x19d2fd[_0xe896('0x38')]?_0x19d2fd[_0xe896('0x38')]:_0x2ab0ac;_0x19d2fd[_0xe896('0x3f')]=_0x19d2fd['endtime']?_0x19d2fd[_0xe896('0x3f')]:_0x2ab0ac;_0x19d2fd[_0xe896('0x3a')]=getSeconds(_0x19d2fd['responsetime']||0x0,_0x19d2fd['starttime']||0x0);_0x19d2fd['talktime']=_0x19d2fd[_0xe896('0x40')]?getSeconds(_0x19d2fd[_0xe896('0x3f')],_0x19d2fd[_0xe896('0x40')]):0x0;};exports['isFailure']=function(_0x431323){return _0x431323===_0xe896('0x41');};exports['variablesAction']=function(_0x4c05ce,_0x489254,_0x22c628,_0x2b0273,_0x16927a){var _0x402aef=_0x2b0273?_0xe896('0x42'):_0x4c05ce[_0xe896('0x1d')];_0x402aef=_0x16927a?'BOOKED':_0x402aef;return{'actionid':_0x4c05ce[_0xe896('0x43')],'action':_0xe896('0x44'),'channel':_0x4c05ce['channelAgent'],'callerid':util[_0xe896('0x1c')](_0xe896('0x15'),_0x402aef,_0x4c05ce[_0xe896('0x45')]),'Exten':_0xe896('0x2a'),'Context':'from-sip','Priority':'1','variable':_0x22c628,'timeout':(_0x489254[_0xe896('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4c05ce[_0xe896('0x43')]};};exports[_0xe896('0x47')]=function(_0x11615a){return _0x11615a[_0xe896('0x48')]+_0x11615a[_0xe896('0x49')]+_0x11615a['countnoanswerretry']+_0x11615a[_0xe896('0x4a')]+_0x11615a['countnosuchnumberretry'];};exports[_0xe896('0x4b')]=function(_0x1c6ae1){var _0x2dd1fa=_[_0xe896('0x4c')](_0x1c6ae1);_0x2dd1fa[_0xe896('0x36')]=0xf;_0x2dd1fa[_0xe896('0x3e')]='Global';return _0x2dd1fa;};exports[_0xe896('0x4d')]=function(_0x206ad3,_0x4818cd,_0x3373dc){var _0x355443={};_0x355443[_0x4818cd]=_0x206ad3[_0x4818cd];_0x355443['active']=![];_0x355443[_0xe896('0x4e')]=moment()['add'](_0x3373dc,_0xe896('0x4f'))[_0xe896('0x1c')](_0xe896('0x35'));_0x355443[_0xe896('0x50')]=_0x206ad3[_0xe896('0x50')];_0x355443['ListId']=_0x206ad3[_0xe896('0x51')];_0x355443[_0xe896('0x1f')]=_0x206ad3[_0xe896('0x1f')]||undefined;return _0x355443;};exports['decrementTalkink']=function(_0x2ceae5,_0x5d205b){if(!_['isNil'](_0x2ceae5)){if(_0x2ceae5[_0xe896('0x52')]>0x0){_0x2ceae5[_0xe896('0x52')]-=0x1;}else{logger['error'](_0x5d205b,_0xe896('0x53'));}}else{logger[_0xe896('0xc')](_0x5d205b,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x2e8fac){if(_0x2e8fac<=0x0){return!![];}return![];};exports[_0xe896('0x54')]=function(_0x5b8719,_0x1d18f6){_0x5b8719[_0xe896('0x55')]=_0x1d18f6;_0x5b8719[_0xe896('0x1b')]=_0x5b8719[_0xe896('0x56')];_0x5b8719[_0xe896('0x57')]=_0x5b8719[_0xe896('0x58')];return _0x5b8719;};exports[_0xe896('0x59')]=function(_0xbfd18){var _0x2e85f0={};_0x2e85f0[_0xe896('0x56')]=_0xbfd18[_0xe896('0x56')];_0x2e85f0['interface']=_0xbfd18[_0xe896('0x58')];_0x2e85f0[_0xe896('0x43')]=_0xbfd18[_0xe896('0x43')];return _0x2e85f0;};exports[_0xe896('0x5a')]=function(_0x2db6d1){var _0x235a2a=[];for(var _0x157946 in _0x2db6d1){if(_0x2db6d1[_0xe896('0x2d')](_0x157946)){if(!_[_0xe896('0x18')](_0x2db6d1[_0x157946])&&_0x2db6d1[_0x157946][_0xe896('0x36')]===_0xe896('0x5b')&&_0x2db6d1[_0x157946][_0xe896('0x5c')]==='reachable'){_0x235a2a[_0xe896('0x5d')](_0x2db6d1[_0x157946]['id']);}}}return _0x235a2a;};exports[_0xe896('0x5e')]=function(_0x156867){var _0x5180b6=moment()['milliseconds'](0x0);var _0x4bf8d6=moment(_0x156867)[_0xe896('0x8')](0x0);return _0x5180b6[_0xe896('0x9')](_0x4bf8d6,_0xe896('0xa'));};exports[_0xe896('0x5f')]=function(_0x50c910){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x50c910[_0xe896('0x50')],'ListId':_0x50c910[_0xe896('0x51')],'VoiceQueueId':_0x50c910[_0xe896('0x1f')]||undefined,'CampaignId':_0x50c910[_0xe896('0x60')]||undefined};};exports['filterKey']=function(_0x1d227a){if(_0x1d227a===_0xe896('0x43')||_0x1d227a==='idContact'||_0x1d227a===_0xe896('0x56')||_0x1d227a===_0xe896('0x61')||_0x1d227a==='campaigntype'||_0x1d227a==='dialAnswer'||_0x1d227a===_0xe896('0x3d')||_0x1d227a===_0xe896('0x58')||_0x1d227a===_0xe896('0x1d')||_0x1d227a===_0xe896('0x62')||_0x1d227a===_0xe896('0x45')||_0x1d227a==='scheduledat'||_0x1d227a===_0xe896('0x48')||_0x1d227a===_0xe896('0x49')||_0x1d227a===_0xe896('0x63')||_0x1d227a===_0xe896('0x64')||_0x1d227a==='callback'||_0x1d227a==='callbackuniqueid'||_0x1d227a===_0xe896('0x65')||_0x1d227a===_0xe896('0x66')||_0x1d227a==='ContactId'||_0x1d227a===_0xe896('0x51')||_0x1d227a==='UserId'||_0x1d227a===_0xe896('0x1f')||_0x1d227a===_0xe896('0x67')||_0x1d227a===_0xe896('0x68')||_0x1d227a===_0xe896('0x69')||_0x1d227a===_0xe896('0x6a')||_0x1d227a===_0xe896('0x6b')||_0x1d227a===_0xe896('0x6c')||_0x1d227a===_0xe896('0x6d')||_0x1d227a===_0xe896('0x6e')||_0x1d227a===_0xe896('0x6f')||_0x1d227a===_0xe896('0x70')||_0x1d227a===_0xe896('0x71')||_0x1d227a===_0xe896('0x72')||_0x1d227a===_0xe896('0x73')||_0x1d227a===_0xe896('0x74')||_0x1d227a===_0xe896('0x75')||_0x1d227a===_0xe896('0x76')||_0x1d227a===_0xe896('0x77')||_0x1d227a===_0xe896('0x78')||_0x1d227a===_0xe896('0x79')||_0x1d227a===_0xe896('0x7a')||_0x1d227a===_0xe896('0x7b')||_0x1d227a==='rtpaudioqosrtt'||_0x1d227a==='rtpaudioqosrttbridged'||_0x1d227a===_0xe896('0x76')||_0x1d227a===_0xe896('0x77')||_0x1d227a==='rtpaudioqosjitter'||_0x1d227a===_0xe896('0x79')||_0x1d227a===_0xe896('0x7a')||_0x1d227a===_0xe896('0x7b')||_0x1d227a===_0xe896('0x7c')||_0x1d227a===_0xe896('0x7d')||_0x1d227a===_0xe896('0x7e')||_0x1d227a===_0xe896('0x7f')||_0x1d227a===_0xe896('0x36')||_0x1d227a===_0xe896('0x3e')){return![];}return!![];};exports[_0xe896('0x80')]=function(_0x1479c8,_0x4e417a){var _0x3d299a,_0x1be74e,_0x4c1586;if(_0x4e417a<=0x0){_0x4e417a=0x1;}_0x3d299a=new RegExp(_0xe896('0x81')+_0x4e417a+'}$');_0x1be74e=Math['pow'](0xa,_0x4e417a-0x1);_0x4c1586=Math['pow'](0xa,_0x4e417a)-0x1;return util[_0xe896('0x1c')]('%s',_[_0xe896('0x82')](_0x1479c8,_0x3d299a,_['random'](_0x1be74e,_0x4c1586)));};exports['extractCalleridName']=function(_0x2695a5){var _0x4a39b3=_0x2695a5['match'](/"(.*?)"/);return _0x4a39b3?_0x4a39b3[0x1]:_0x2695a5;};exports[_0xe896('0x83')]=function(_0x22ce83){var _0xf7e014=_0x22ce83['match'](/<(.*?)>/);return _0xf7e014?_0xf7e014[0x1]:_0x22ce83;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index fa98c24..00673a2 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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x2478a7,_0x5c3223){var _0xcaac7b=function(_0x42c209){while(--_0x42c209){_0x2478a7['push'](_0x2478a7['shift']());}};_0xcaac7b(++_0x5c3223);}(_0xb10b,0x12a));var _0xbb10=function(_0x19a0bc,_0x2f7125){_0x19a0bc=_0x19a0bc-0x0;var _0x4d6c30=_0xb10b[_0x19a0bc];return _0x4d6c30;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x16bf05,_0x4f70da){var _0xbcf546=function(_0x70b01d){while(--_0x70b01d){_0x16bf05['push'](_0x16bf05['shift']());}};_0xbcf546(++_0x4f70da);}(_0xb10b,0x12a));var _0xbb10=function(_0x429370,_0x46ff4c){_0x429370=_0x429370-0x0;var _0x41a3ad=_0xb10b[_0x429370];return _0x41a3ad;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index ff79af0..f9d40bf 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 _0x1533=['diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','SquareProject','initVoiceExtensions','exports','bluebird','util','lodash','moment','../model/trunk','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','name','hasOwnProperty','isNil','interface','SIP/%s','total','sumHoldTime','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumDuration','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','agents','length','initTelephones','telephones','isUndefined','mergeFromDatabase','initVoiceQueues','initTemplates','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','uniqueid','queue','queuecallerexit','queuecallerabandon'];(function(_0x2d9349,_0x14f633){var _0x2499c6=function(_0xfe06b6){while(--_0xfe06b6){_0x2d9349['push'](_0x2d9349['shift']());}};_0x2499c6(++_0x14f633);}(_0x1533,0x78));var _0x3153=function(_0x238202,_0x10da07){_0x238202=_0x238202-0x0;var _0x217367=_0x1533[_0x238202];return _0x217367;};'use strict';var BPromise=require(_0x3153('0x0'));var util=require(_0x3153('0x1'));var _=require(_0x3153('0x2'));var moment=require(_0x3153('0x3'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x3153('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x3153('0x5'));var Campaign=require(_0x3153('0x6'));var VoiceExtension=require(_0x3153('0x7'));var ZendeskAccount=require(_0x3153('0x8'));var SalesforceAccount=require(_0x3153('0x9'));var FreshdeskAccount=require(_0x3153('0xa'));var SugarcrmAccount=require(_0x3153('0xb'));var ZohoAccount=require(_0x3153('0xc'));var DeskAccount=require(_0x3153('0xd'));var VtigerAccount=require(_0x3153('0xe'));var ServicenowAccount=require(_0x3153('0xf'));var Dynamics365Account=require(_0x3153('0x10'));var FreshsalesAccount=require(_0x3153('0x11'));var FaxAccount=require(_0x3153('0x12'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x3153('0x13')]={};this[_0x3153('0x14')]={};this[_0x3153('0x15')]={};this[_0x3153('0x16')]={};this[_0x3153('0x17')]={};this[_0x3153('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3153('0x19')]={};this['channels']={};this[_0x3153('0x1a')]={};this[_0x3153('0x1b')]={};this[_0x3153('0x1c')]={};this['zendeskAccounts']={};this[_0x3153('0x1d')]={};this[_0x3153('0x1e')]={};this[_0x3153('0x1f')]={};this[_0x3153('0x20')]={};this[_0x3153('0x21')]={};this[_0x3153('0x22')]={};this['servicenowAccounts']={};this[_0x3153('0x23')]={};this['freshsalesAccounts']={};this[_0x3153('0x24')]={};};function freeIsNotKey(_0x362dd3,_0x375edc,_0x61a1a){var _0x5a17ea=_['mapKeys'](_0x362dd3,function(_0x168ffb,_0x1b5497){return _0x168ffb[_0x61a1a];});for(var _0x43abee in _0x375edc){if(_0x375edc['hasOwnProperty'](_0x43abee)){if(!_0x5a17ea[_0x43abee]){delete _0x375edc[_0x43abee];}}}}function freeIsNotKeySip(_0x14e885,_0x215065){var _0x20c09c=_[_0x3153('0x25')](_0x14e885,function(_0x32c075,_0x17f82a){return util[_0x3153('0x26')]('SIP/%s',_0x32c075[_0x3153('0x27')]);});for(var _0x477d6e in _0x215065){if(_0x215065[_0x3153('0x28')](_0x477d6e)){if(!_0x20c09c[_0x477d6e]){delete _0x215065[_0x477d6e];}}}}function freeIsNotKeyAgent(_0x21a29e,_0x3e275b){var _0x3e6a22=_[_0x3153('0x25')](_0x21a29e,function(_0x576e11,_0x12e30f){var _0x4eb67d=_[_0x3153('0x29')](_0x576e11[_0x3153('0x2a')])?util[_0x3153('0x26')](_0x3153('0x2b'),_0x576e11['name']):_0x576e11[_0x3153('0x2a')];return _0x4eb67d;});for(var _0x42754f in _0x3e275b){if(_0x3e275b[_0x3153('0x28')](_0x42754f)){if(!_0x3e6a22[_0x42754f]){delete _0x3e275b[_0x42754f];}}}}function clearVoiceCallReports(_0x4dfd77){_0x4dfd77[_0x3153('0x2c')]=0x0;_0x4dfd77['answered']=0x0;_0x4dfd77[_0x3153('0x2d')]=0x0;_0x4dfd77['sumDuration']=0x0;_0x4dfd77[_0x3153('0x2e')]=0x0;}function clearCampaigns(_0x1b662b){if(!_['isEmpty'](_0x1b662b)){for(var _0x3714ee in _0x1b662b){if(_0x1b662b[_0x3153('0x28')](_0x3714ee)){_0x1b662b[_0x3714ee][_0x3153('0x2f')]=0x0;_0x1b662b[_0x3714ee][_0x3153('0x30')]=0x0;}}}}function clearVoiceQueues(_0x2bc285){if(!_['isEmpty'](_0x2bc285)){for(var _0x7d92a4 in _0x2bc285){if(_0x2bc285[_0x3153('0x28')](_0x7d92a4)){_0x2bc285[_0x7d92a4][_0x3153('0x2c')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x31')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x32')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x33')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x2d')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x34')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x2e')]=0x0;_0x2bc285[_0x7d92a4]['outboundAnswerAgiCallsDay']=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x35')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x36')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x37')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x38')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x39')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x3a')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x3b')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x3c')]=0x0;_0x2bc285[_0x7d92a4]['outboundOriginateFailureCallsDay']=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x3d')]=0x0;_0x2bc285[_0x7d92a4]['outboundReCallsDay']=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x3e')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x3f')]=0x0;_0x2bc285[_0x7d92a4][_0x3153('0x40')]=!![];}}}}Realtime[_0x3153('0x41')]['mergeFromDatabase']=function(_0x52e42f,_0x534288){for(var _0x4ae0dc in _0x534288){if(_0x52e42f[_0x3153('0x28')](_0x4ae0dc)){_0x52e42f[_0x4ae0dc]=_0x534288[_0x4ae0dc];}}};Realtime[_0x3153('0x41')]['initAgents']=function(){var _0xffbdb8=this;return function(_0x2766aa){if(_0x2766aa){freeIsNotKeyAgent(_0x2766aa,_0xffbdb8[_0x3153('0x42')]);for(var _0x10e99a=0x0,_0x28adee={},_0x20444f={};_0x10e99a<_0x2766aa[_0x3153('0x43')];_0x10e99a+=0x1){_0x28adee=_0x2766aa[_0x10e99a];var _0x4efeac=_[_0x3153('0x29')](_0x28adee[_0x3153('0x2a')])?util[_0x3153('0x26')](_0x3153('0x2b'),_0x28adee[_0x3153('0x27')]):_0x28adee[_0x3153('0x2a')];if(_['isUndefined'](_0xffbdb8[_0x3153('0x42')][_0x4efeac])){_0xffbdb8[_0x3153('0x42')][_0x4efeac]=new Agent(_0x28adee);}else{_0xffbdb8['mergeFromDatabase'](_0xffbdb8['agents'][_0x4efeac],_0x28adee);}}}return _0xffbdb8['agents'];};};Realtime[_0x3153('0x41')][_0x3153('0x44')]=function(){var _0x1c3a75=this;return function(_0x325fed){if(_0x325fed){freeIsNotKeySip(_0x325fed,_0x1c3a75[_0x3153('0x45')]);for(var _0x23d517=0x0,_0x4d9b4c={},_0x4433bf={};_0x23d517<_0x325fed[_0x3153('0x43')];_0x23d517+=0x1){_0x4d9b4c=_0x325fed[_0x23d517];if(_[_0x3153('0x46')](_0x1c3a75[_0x3153('0x45')][util['format']('SIP/%s',_0x4d9b4c[_0x3153('0x27')])])){_0x1c3a75[_0x3153('0x45')][util[_0x3153('0x26')]('SIP/%s',_0x4d9b4c['name'])]=new Telephone(_0x4d9b4c);}else{_0x1c3a75[_0x3153('0x47')](_0x1c3a75[_0x3153('0x45')][util[_0x3153('0x26')](_0x3153('0x2b'),_0x4d9b4c[_0x3153('0x27')])],_0x4d9b4c);}}}return _0x1c3a75[_0x3153('0x45')];};};Realtime[_0x3153('0x41')]['initTrunks']=function(){var _0x3597d7=this;return function(_0x23fd33){if(_0x23fd33){freeIsNotKeySip(_0x23fd33,_0x3597d7[_0x3153('0x13')]);for(var _0x44efa8=0x0,_0x7a44be={},_0x530e0f={};_0x44efa8<_0x23fd33[_0x3153('0x43')];_0x44efa8+=0x1){_0x7a44be=_0x23fd33[_0x44efa8];if(_[_0x3153('0x46')](_0x3597d7['trunks'][util[_0x3153('0x26')](_0x3153('0x2b'),_0x7a44be[_0x3153('0x27')])])){_0x3597d7['trunks'][util[_0x3153('0x26')](_0x3153('0x2b'),_0x7a44be[_0x3153('0x27')])]=new Trunk(_0x7a44be);}else{_0x3597d7[_0x3153('0x47')](_0x3597d7[_0x3153('0x13')][util[_0x3153('0x26')](_0x3153('0x2b'),_0x7a44be[_0x3153('0x27')])],_0x7a44be);}}}return _0x3597d7[_0x3153('0x13')];};};Realtime[_0x3153('0x41')][_0x3153('0x48')]=function(){var _0x1d1a4f=this;return function(_0x35e249){if(_0x35e249){freeIsNotKey(_0x35e249,_0x1d1a4f['voiceQueues'],_0x3153('0x27'));for(var _0x29bac7=0x0,_0x28c956={},_0x783494={};_0x29bac7<_0x35e249[_0x3153('0x43')];_0x29bac7+=0x1){_0x28c956=_0x35e249[_0x29bac7];if(_[_0x3153('0x46')](_0x1d1a4f[_0x3153('0x14')][_0x28c956[_0x3153('0x27')]])){_0x1d1a4f[_0x3153('0x14')][_0x28c956[_0x3153('0x27')]]=new VoiceQueue(_0x28c956);}else{_0x1d1a4f['mergeFromDatabase'](_0x1d1a4f['voiceQueues'][_0x28c956['name']],_0x28c956);}}}return _0x1d1a4f[_0x3153('0x14')];};};Realtime[_0x3153('0x41')]['initTriggers']=function(){var _0x3ddb99=this;return function(_0x15ad1e){if(_0x15ad1e){freeIsNotKey(_0x15ad1e,_0x3ddb99[_0x3153('0x15')],'id');for(var _0x3cff07=0x0,_0x4f12aa={},_0x1e3834={};_0x3cff07<_0x15ad1e[_0x3153('0x43')];_0x3cff07+=0x1){_0x4f12aa=_0x15ad1e[_0x3cff07];if(_[_0x3153('0x46')](_0x3ddb99[_0x3153('0x15')][_0x4f12aa['id']])){_0x3ddb99[_0x3153('0x15')][_0x4f12aa['id']]=new Trigger(_0x4f12aa);}else{_0x3ddb99[_0x3153('0x47')](_0x3ddb99[_0x3153('0x15')][_0x4f12aa['id']],_0x4f12aa);}}}return _0x3ddb99[_0x3153('0x15')];};};Realtime[_0x3153('0x41')][_0x3153('0x49')]=function(){var _0x3fd32e=this;return function(_0x49b2ae){if(_0x49b2ae){freeIsNotKey(_0x49b2ae,_0x3fd32e[_0x3153('0x17')],'id');for(var _0xc23976=0x0,_0x59c435={},_0x157ec6={};_0xc23976<_0x49b2ae[_0x3153('0x43')];_0xc23976+=0x1){_0x59c435=_0x49b2ae[_0xc23976];if(_[_0x3153('0x46')](_0x3fd32e[_0x3153('0x17')][_0x59c435['id']])){_0x3fd32e[_0x3153('0x17')][_0x59c435['id']]=new Template(_0x59c435);}else{_0x3fd32e['mergeFromDatabase'](_0x3fd32e['templates'][_0x59c435['id']],_0x59c435);}}}return _0x3fd32e[_0x3153('0x17')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x5bb592=this;return function(_0x4194cf){if(_0x4194cf){freeIsNotKey(_0x4194cf,_0x5bb592[_0x3153('0x4a')],'id');for(var _0x19a59f=0x0,_0x431698={},_0x2992be={};_0x19a59f<_0x4194cf['length'];_0x19a59f+=0x1){_0x431698=_0x4194cf[_0x19a59f];if(_[_0x3153('0x46')](_0x5bb592[_0x3153('0x4a')][_0x431698['id']])){_0x5bb592[_0x3153('0x4a')][_0x431698['id']]=new ZendeskAccount(_0x431698);}else{_0x5bb592[_0x3153('0x47')](_0x5bb592[_0x3153('0x4a')][_0x431698['id']],_0x431698);}}}return _0x5bb592[_0x3153('0x4a')];};};Realtime['prototype'][_0x3153('0x4b')]=function(){var _0x135e13=this;return function(_0x192b09){if(_0x192b09){freeIsNotKey(_0x192b09,_0x135e13['salesforceAccounts'],'id');for(var _0x380d6e=0x0,_0x118697={},_0x2be1db={};_0x380d6e<_0x192b09[_0x3153('0x43')];_0x380d6e+=0x1){_0x118697=_0x192b09[_0x380d6e];if(_[_0x3153('0x46')](_0x135e13[_0x3153('0x1d')][_0x118697['id']])){_0x135e13[_0x3153('0x1d')][_0x118697['id']]=new SalesforceAccount(_0x118697);}else{_0x135e13[_0x3153('0x47')](_0x135e13[_0x3153('0x1d')][_0x118697['id']],_0x118697);}}}return _0x135e13[_0x3153('0x1d')];};};Realtime[_0x3153('0x41')][_0x3153('0x4c')]=function(){var _0x2a31a2=this;return function(_0x5d360d){if(_0x5d360d){freeIsNotKey(_0x5d360d,_0x2a31a2[_0x3153('0x1f')],'id');for(var _0x27d5de=0x0,_0xc9c31e={},_0x4564e1={};_0x27d5de<_0x5d360d[_0x3153('0x43')];_0x27d5de+=0x1){_0xc9c31e=_0x5d360d[_0x27d5de];if(_[_0x3153('0x46')](_0x2a31a2[_0x3153('0x1f')][_0xc9c31e['id']])){_0x2a31a2[_0x3153('0x1f')][_0xc9c31e['id']]=new FreshdeskAccount(_0xc9c31e);}else{_0x2a31a2[_0x3153('0x47')](_0x2a31a2[_0x3153('0x1f')][_0xc9c31e['id']],_0xc9c31e);}}}return _0x2a31a2[_0x3153('0x1f')];};};Realtime[_0x3153('0x41')]['initZohoAccounts']=function(){var _0x1f1065=this;return function(_0x4bca6b){if(_0x4bca6b){freeIsNotKey(_0x4bca6b,_0x1f1065['zohoAccounts'],'id');for(var _0x133bb3=0x0,_0x16986e={},_0x1ee4cd={};_0x133bb3<_0x4bca6b[_0x3153('0x43')];_0x133bb3+=0x1){_0x16986e=_0x4bca6b[_0x133bb3];if(_[_0x3153('0x46')](_0x1f1065[_0x3153('0x20')][_0x16986e['id']])){_0x1f1065['zohoAccounts'][_0x16986e['id']]=new ZohoAccount(_0x16986e);}else{_0x1f1065[_0x3153('0x47')](_0x1f1065[_0x3153('0x20')][_0x16986e['id']],_0x16986e);}}}return _0x1f1065[_0x3153('0x20')];};};Realtime['prototype'][_0x3153('0x4d')]=function(){var _0x5a8a66=this;return function(_0x4148a0){if(_0x4148a0){freeIsNotKey(_0x4148a0,_0x5a8a66[_0x3153('0x21')],'id');for(var _0x508312=0x0,_0xca3d9f={},_0x118a9f={};_0x508312<_0x4148a0[_0x3153('0x43')];_0x508312+=0x1){_0xca3d9f=_0x4148a0[_0x508312];if(_['isUndefined'](_0x5a8a66[_0x3153('0x21')][_0xca3d9f['id']])){_0x5a8a66['deskAccounts'][_0xca3d9f['id']]=new DeskAccount(_0xca3d9f);}else{_0x5a8a66[_0x3153('0x47')](_0x5a8a66[_0x3153('0x21')][_0xca3d9f['id']],_0xca3d9f);}}}return _0x5a8a66[_0x3153('0x21')];};};Realtime[_0x3153('0x41')][_0x3153('0x4e')]=function(){var _0xc5a634=this;return function(_0x28c081){if(_0x28c081){freeIsNotKey(_0x28c081,_0xc5a634[_0x3153('0x1e')],'id');for(var _0x176b66=0x0,_0x501c03={},_0x1138a2={};_0x176b66<_0x28c081[_0x3153('0x43')];_0x176b66+=0x1){_0x501c03=_0x28c081[_0x176b66];if(_['isUndefined'](_0xc5a634['sugarcrmAccounts'][_0x501c03['id']])){_0xc5a634[_0x3153('0x1e')][_0x501c03['id']]=new SugarcrmAccount(_0x501c03);}else{_0xc5a634['mergeFromDatabase'](_0xc5a634[_0x3153('0x1e')][_0x501c03['id']],_0x501c03);}}}return _0xc5a634[_0x3153('0x1e')];};};Realtime[_0x3153('0x41')][_0x3153('0x4f')]=function(){var _0x2dcbca=this;return function(_0x4bc941){if(_0x4bc941){freeIsNotKey(_0x4bc941,_0x2dcbca[_0x3153('0x22')],'id');for(var _0x40fb74=0x0,_0x8d943b={},_0xe4dff6={};_0x40fb74<_0x4bc941[_0x3153('0x43')];_0x40fb74+=0x1){_0x8d943b=_0x4bc941[_0x40fb74];if(_[_0x3153('0x46')](_0x2dcbca['vtigerAccounts'][_0x8d943b['id']])){_0x2dcbca['vtigerAccounts'][_0x8d943b['id']]=new VtigerAccount(_0x8d943b);}else{_0x2dcbca[_0x3153('0x47')](_0x2dcbca[_0x3153('0x22')][_0x8d943b['id']],_0x8d943b);}}}return _0x2dcbca['vtigerAccounts'];};};Realtime[_0x3153('0x41')][_0x3153('0x50')]=function(){var _0x8d90c8=this;return function(_0x3e3925){if(_0x3e3925){freeIsNotKey(_0x3e3925,_0x8d90c8[_0x3153('0x51')],'id');for(var _0x35065c=0x0,_0x56e61d={},_0x50c5e3={};_0x35065c<_0x3e3925[_0x3153('0x43')];_0x35065c+=0x1){_0x56e61d=_0x3e3925[_0x35065c];if(_[_0x3153('0x46')](_0x8d90c8[_0x3153('0x51')][_0x56e61d['id']])){_0x8d90c8[_0x3153('0x51')][_0x56e61d['id']]=new ServicenowAccount(_0x56e61d);}else{_0x8d90c8[_0x3153('0x47')](_0x8d90c8['servicenowAccounts'][_0x56e61d['id']],_0x56e61d);}}}return _0x8d90c8['servicenowAccounts'];};};Realtime['prototype'][_0x3153('0x52')]=function(){var _0x4c1937=this;return function(_0x35a4d0){if(_0x35a4d0){freeIsNotKey(_0x35a4d0,_0x4c1937['dynamics365Accounts'],'id');for(var _0x31dd0b=0x0,_0x138830={},_0x456519={};_0x31dd0b<_0x35a4d0[_0x3153('0x43')];_0x31dd0b+=0x1){_0x138830=_0x35a4d0[_0x31dd0b];if(_[_0x3153('0x46')](_0x4c1937[_0x3153('0x23')][_0x138830['id']])){_0x4c1937[_0x3153('0x23')][_0x138830['id']]=new Dynamics365Account(_0x138830);}else{_0x4c1937[_0x3153('0x47')](_0x4c1937[_0x3153('0x23')][_0x138830['id']],_0x138830);}}}return _0x4c1937[_0x3153('0x23')];};};Realtime[_0x3153('0x41')]['initFreshsalesAccounts']=function(){var _0x517f71=this;return function(_0xcda0c0){if(_0xcda0c0){freeIsNotKey(_0xcda0c0,_0x517f71[_0x3153('0x53')],'id');for(var _0x512f5d=0x0,_0x35d6db={},_0x5523fa={};_0x512f5d<_0xcda0c0[_0x3153('0x43')];_0x512f5d+=0x1){_0x35d6db=_0xcda0c0[_0x512f5d];if(_[_0x3153('0x46')](_0x517f71[_0x3153('0x53')][_0x35d6db['id']])){_0x517f71[_0x3153('0x53')][_0x35d6db['id']]=new FreshsalesAccount(_0x35d6db);}else{_0x517f71[_0x3153('0x47')](_0x517f71['freshsalesAccounts'][_0x35d6db['id']],_0x35d6db);}}}return _0x517f71[_0x3153('0x53')];};};Realtime[_0x3153('0x41')][_0x3153('0x54')]=function(){var _0x125cee=this;return function(_0x1ff8aa){for(var _0x32c06a=0x0;_0x32c06a<_0x1ff8aa[_0x3153('0x43')];_0x32c06a+=0x1){_[_0x3153('0x55')](_0x125cee[_0x3153('0x14')][_0x1ff8aa[_0x32c06a][_0x3153('0x27')]],_0x1ff8aa[_0x32c06a]);}return _0x125cee[_0x3153('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x578351=this;return function(_0x3fbcec){clearVoiceQueues(_0x578351[_0x3153('0x14')]);if(_0x3fbcec){_0x3fbcec=_['groupBy'](_0x3fbcec,_0x3153('0x56'));for(var _0x499494 in _0x3fbcec){if(_0x3fbcec[_0x3153('0x28')](_0x499494)){var _0x28c7a7={};for(var _0x1d3f17=0x0;_0x1d3f17<_0x3fbcec[_0x499494][_0x3153('0x43')];_0x1d3f17+=0x1){var _0x1e78bc=_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x57')];if(_0x578351[_0x3153('0x14')][_0x1e78bc]){if(_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x58')]){_0x578351['voiceQueues'][_0x1e78bc]['unmanaged']+=0x1;}if(_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x59')]){_0x578351[_0x3153('0x14')][_0x1e78bc][_0x3153('0x33')]+=0x1;}_0x578351['voiceQueues'][_0x1e78bc][_0x3153('0x2d')]+=moment(_0x3fbcec[_0x499494][_0x1d3f17]['queuecallerleaveAt'])[_0x3153('0x5a')](moment(_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x5b')]),_0x3153('0x5c'))||0x0;if(_0x1d3f17===_0x3fbcec[_0x499494]['length']-0x1){_0x578351[_0x3153('0x14')][_0x1e78bc][_0x3153('0x34')]+=moment(_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x5d')]||_0x3fbcec[_0x499494][_0x1d3f17]['queuecallerabandonAt']||_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x5e')])[_0x3153('0x5a')](moment(_0x3fbcec[_0x499494][_0x1d3f17]['queuecallerjoinAt']),_0x3153('0x5c'))||0x0;_0x578351[_0x3153('0x14')][_0x1e78bc][_0x3153('0x2c')]+=0x1;if(_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x5f')]){_0x578351[_0x3153('0x14')][_0x1e78bc][_0x3153('0x31')]+=0x1;_0x578351[_0x3153('0x14')][_0x1e78bc]['sumBillable']+=moment(_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x5d')])['diff'](moment(_0x3fbcec[_0x499494][_0x1d3f17][_0x3153('0x60')]),_0x3153('0x5c'))||0x0;}}else{_0x578351['voiceQueues'][_0x1e78bc]['sumDuration']+=_0x578351['voiceQueues'][_0x1e78bc][_0x3153('0x2d')]||0x0;}}}}}}return _0x578351[_0x3153('0x14')];};};Realtime[_0x3153('0x41')][_0x3153('0x61')]=function(){var _0x2d0b05=this;return function(_0x23e4f0){clearVoiceCallReports(_0x2d0b05[_0x3153('0x18')]);if(_0x23e4f0){for(var _0x5b30d8=0x0;_0x5b30d8<_0x23e4f0[_0x3153('0x43')];_0x5b30d8+=0x1){_0x2d0b05[_0x3153('0x18')][_0x3153('0x2c')]+=0x1;_0x2d0b05[_0x3153('0x18')][_0x3153('0x34')]+=_0x23e4f0[_0x5b30d8][_0x3153('0x62')];if(_0x23e4f0[_0x5b30d8][_0x3153('0x63')]===_0x3153('0x64')){_0x2d0b05['outbound'][_0x3153('0x31')]+=0x1;_0x2d0b05[_0x3153('0x18')][_0x3153('0x2d')]+=_0x23e4f0[_0x5b30d8][_0x3153('0x62')]-_0x23e4f0[_0x5b30d8]['billableseconds']||0x0;_0x2d0b05[_0x3153('0x18')][_0x3153('0x2e')]+=_0x23e4f0[_0x5b30d8][_0x3153('0x65')];}}}return _0x2d0b05['outbound'];};};Realtime['prototype']['initCampaigns']=function(){var _0x1d1ae8=this;return function(_0x16c5d2){if(_0x16c5d2){freeIsNotKey(_0x16c5d2,_0x1d1ae8[_0x3153('0x16')],_0x3153('0x27'));for(var _0x31bb70=0x0,_0xd20a87={};_0x31bb70<_0x16c5d2['length'];_0x31bb70+=0x1){_0xd20a87=_0x16c5d2[_0x31bb70];if(_[_0x3153('0x46')](_0x1d1ae8[_0x3153('0x16')][_0xd20a87[_0x3153('0x27')]])){_0x1d1ae8[_0x3153('0x16')][_0xd20a87['name']]=new Campaign(_0xd20a87);}else{_0x1d1ae8[_0x3153('0x47')](_0x1d1ae8[_0x3153('0x16')][_0xd20a87['name']],_0xd20a87);_0x1d1ae8[_0x3153('0x16')][_0xd20a87[_0x3153('0x27')]]['dialQueueProject']=_0xd20a87[_0x3153('0x66')]?_0xd20a87[_0x3153('0x66')][_0x3153('0x27')]:undefined;}}}return _0x1d1ae8[_0x3153('0x16')];};};Realtime[_0x3153('0x41')][_0x3153('0x67')]=function(){var _0x3c5a0b=this;return function(_0x536ae5){if(_0x536ae5){freeIsNotKey(_0x536ae5,_0x3c5a0b[_0x3153('0x19')],'id');for(var _0x5625f7=0x0,_0x2d46fb={};_0x5625f7<_0x536ae5[_0x3153('0x43')];_0x5625f7+=0x1){_0x2d46fb=_0x536ae5[_0x5625f7];if(_[_0x3153('0x46')](_0x3c5a0b['voiceExtensions'][_0x2d46fb['id']])){_0x3c5a0b[_0x3153('0x19')][_0x2d46fb['id']]=new VoiceExtension(_0x2d46fb);}else{_0x3c5a0b[_0x3153('0x47')](_0x3c5a0b[_0x3153('0x19')][_0x2d46fb['id']],_0x2d46fb);}}}return _0x3c5a0b[_0x3153('0x19')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x11d149=this;return function(_0x236871){clearCampaigns(_0x11d149['campaigns']);for(var _0x318861=0x0;_0x318861<_0x236871['length'];_0x318861+=0x1){_[_0x3153('0x55')](_0x11d149[_0x3153('0x16')][_0x236871[_0x318861][_0x3153('0x27')]],_0x236871[_0x318861]);}return _0x11d149[_0x3153('0x16')];};};Realtime[_0x3153('0x41')]['initFaxAccounts']=function(){var _0x5d7f3d=this;return function(_0x41f979){if(_0x41f979){freeIsNotKey(_0x41f979,_0x5d7f3d[_0x3153('0x24')],'id');for(var _0x3032e9=0x0,_0x3cfc39={},_0x3d05b8={};_0x3032e9<_0x41f979['length'];_0x3032e9+=0x1){_0x3cfc39=_0x41f979[_0x3032e9];if(_['isUndefined'](_0x5d7f3d[_0x3153('0x24')][_0x3cfc39['id']])){_0x5d7f3d[_0x3153('0x24')][_0x3cfc39['id']]=new FaxAccount(_0x3cfc39);}else{_0x5d7f3d['mergeFromDatabase'](_0x5d7f3d[_0x3153('0x24')][_0x3cfc39['id']],_0x3cfc39);}}}return _0x5d7f3d[_0x3153('0x24')];};};module[_0x3153('0x68')]=Realtime; \ No newline at end of file +var _0x05d8=['initFreshsalesAccounts','merge','uniqueid','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','outbound','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','total','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','initTrunks','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts'];(function(_0x1a9e6a,_0x28e459){var _0x46edac=function(_0x1c5fe2){while(--_0x1c5fe2){_0x1a9e6a['push'](_0x1a9e6a['shift']());}};_0x46edac(++_0x28e459);}(_0x05d8,0xe5));var _0x805d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x05d8[_0x397e5f];return _0x5302b8;};'use strict';var BPromise=require(_0x805d('0x0'));var util=require(_0x805d('0x1'));var _=require(_0x805d('0x2'));var moment=require('moment');var Agent=require(_0x805d('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x805d('0x4'));var VoiceQueue=require(_0x805d('0x5'));var Trigger=require(_0x805d('0x6'));var Template=require(_0x805d('0x7'));var Campaign=require(_0x805d('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x805d('0x9'));var SalesforceAccount=require(_0x805d('0xa'));var FreshdeskAccount=require(_0x805d('0xb'));var SugarcrmAccount=require(_0x805d('0xc'));var ZohoAccount=require(_0x805d('0xd'));var DeskAccount=require(_0x805d('0xe'));var VtigerAccount=require(_0x805d('0xf'));var ServicenowAccount=require(_0x805d('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x805d('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x805d('0x12')]={};this[_0x805d('0x13')]={};this[_0x805d('0x14')]={};this[_0x805d('0x15')]={};this[_0x805d('0x16')]={};this['campaigns']={};this['templates']={};this[_0x805d('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x805d('0x18')]={};this[_0x805d('0x19')]={};this['outboundChannels']={};this[_0x805d('0x1a')]={};this[_0x805d('0x1b')]={};this[_0x805d('0x1c')]={};this[_0x805d('0x1d')]={};this['freshdeskAccounts']={};this[_0x805d('0x1e')]={};this[_0x805d('0x1f')]={};this['vtigerAccounts']={};this[_0x805d('0x20')]={};this['dynamics365Accounts']={};this[_0x805d('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0x83273,_0x55a9bd,_0x3114c6){var _0x1fe810=_[_0x805d('0x22')](_0x83273,function(_0x22c5d5,_0x95757b){return _0x22c5d5[_0x3114c6];});for(var _0xabb590 in _0x55a9bd){if(_0x55a9bd[_0x805d('0x23')](_0xabb590)){if(!_0x1fe810[_0xabb590]){delete _0x55a9bd[_0xabb590];}}}}function freeIsNotKeySip(_0x3959fe,_0x935cd3){var _0xf6e6a8=_['mapKeys'](_0x3959fe,function(_0x7d0d1d,_0x5bdea5){return util[_0x805d('0x24')](_0x805d('0x25'),_0x7d0d1d[_0x805d('0x26')]);});for(var _0x701925 in _0x935cd3){if(_0x935cd3[_0x805d('0x23')](_0x701925)){if(!_0xf6e6a8[_0x701925]){delete _0x935cd3[_0x701925];}}}}function freeIsNotKeyAgent(_0x248ec2,_0xda8ce8){var _0x13107e=_[_0x805d('0x22')](_0x248ec2,function(_0x3a386c,_0x5a8dca){var _0x22dd57=_[_0x805d('0x27')](_0x3a386c['interface'])?util[_0x805d('0x24')](_0x805d('0x25'),_0x3a386c[_0x805d('0x26')]):_0x3a386c[_0x805d('0x28')];return _0x22dd57;});for(var _0xe3101d in _0xda8ce8){if(_0xda8ce8[_0x805d('0x23')](_0xe3101d)){if(!_0x13107e[_0xe3101d]){delete _0xda8ce8[_0xe3101d];}}}}function clearVoiceCallReports(_0x2af895){_0x2af895['total']=0x0;_0x2af895['answered']=0x0;_0x2af895['sumHoldTime']=0x0;_0x2af895[_0x805d('0x29')]=0x0;_0x2af895[_0x805d('0x2a')]=0x0;}function clearCampaigns(_0x538ea6){if(!_['isEmpty'](_0x538ea6)){for(var _0x136c23 in _0x538ea6){if(_0x538ea6[_0x805d('0x23')](_0x136c23)){_0x538ea6[_0x136c23][_0x805d('0x2b')]=0x0;_0x538ea6[_0x136c23][_0x805d('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x460445){if(!_[_0x805d('0x2d')](_0x460445)){for(var _0x5abd96 in _0x460445){if(_0x460445[_0x805d('0x23')](_0x5abd96)){_0x460445[_0x5abd96][_0x805d('0x2e')]=0x0;_0x460445[_0x5abd96]['answered']=0x0;_0x460445[_0x5abd96]['unmanaged']=0x0;_0x460445[_0x5abd96][_0x805d('0x2f')]=0x0;_0x460445[_0x5abd96][_0x805d('0x30')]=0x0;_0x460445[_0x5abd96][_0x805d('0x29')]=0x0;_0x460445[_0x5abd96][_0x805d('0x2a')]=0x0;_0x460445[_0x5abd96][_0x805d('0x31')]=0x0;_0x460445[_0x5abd96][_0x805d('0x32')]=0x0;_0x460445[_0x5abd96]['outboundBusyCallsDay']=0x0;_0x460445[_0x5abd96]['outboundCongestionCallsDay']=0x0;_0x460445[_0x5abd96]['outboundNoSuchCallsDay']=0x0;_0x460445[_0x5abd96]['outboundUnknownCallsDay']=0x0;_0x460445[_0x5abd96][_0x805d('0x33')]=0x0;_0x460445[_0x5abd96]['outboundDropCallsDayCallersExit']=0x0;_0x460445[_0x5abd96][_0x805d('0x34')]=0x0;_0x460445[_0x5abd96]['outboundOriginateFailureCallsDay']=0x0;_0x460445[_0x5abd96]['outboundRejectCallsDay']=0x0;_0x460445[_0x5abd96][_0x805d('0x35')]=0x0;_0x460445[_0x5abd96][_0x805d('0x31')]=0x0;_0x460445[_0x5abd96][_0x805d('0x36')]=0x0;_0x460445[_0x5abd96][_0x805d('0x37')]=!![];}}}}Realtime[_0x805d('0x38')][_0x805d('0x39')]=function(_0x58071f,_0x355e2c){for(var _0x2f6838 in _0x355e2c){if(_0x58071f[_0x805d('0x23')](_0x2f6838)){_0x58071f[_0x2f6838]=_0x355e2c[_0x2f6838];}}};Realtime[_0x805d('0x38')]['initAgents']=function(){var _0x2e1b80=this;return function(_0x58ccde){if(_0x58ccde){freeIsNotKeyAgent(_0x58ccde,_0x2e1b80[_0x805d('0x12')]);for(var _0x5307f7=0x0,_0x537604={},_0x11b60f={};_0x5307f7<_0x58ccde[_0x805d('0x3a')];_0x5307f7+=0x1){_0x537604=_0x58ccde[_0x5307f7];var _0x39b816=_[_0x805d('0x27')](_0x537604[_0x805d('0x28')])?util[_0x805d('0x24')](_0x805d('0x25'),_0x537604[_0x805d('0x26')]):_0x537604['interface'];if(_[_0x805d('0x3b')](_0x2e1b80[_0x805d('0x12')][_0x39b816])){_0x2e1b80[_0x805d('0x12')][_0x39b816]=new Agent(_0x537604);}else{_0x2e1b80['mergeFromDatabase'](_0x2e1b80[_0x805d('0x12')][_0x39b816],_0x537604);}}}return _0x2e1b80[_0x805d('0x12')];};};Realtime[_0x805d('0x38')][_0x805d('0x3c')]=function(){var _0x2b2930=this;return function(_0x5a57fd){if(_0x5a57fd){freeIsNotKeySip(_0x5a57fd,_0x2b2930[_0x805d('0x13')]);for(var _0x70f68=0x0,_0xad39ff={},_0x461828={};_0x70f68<_0x5a57fd[_0x805d('0x3a')];_0x70f68+=0x1){_0xad39ff=_0x5a57fd[_0x70f68];if(_[_0x805d('0x3b')](_0x2b2930[_0x805d('0x13')][util['format']('SIP/%s',_0xad39ff['name'])])){_0x2b2930[_0x805d('0x13')][util[_0x805d('0x24')](_0x805d('0x25'),_0xad39ff[_0x805d('0x26')])]=new Telephone(_0xad39ff);}else{_0x2b2930['mergeFromDatabase'](_0x2b2930['telephones'][util[_0x805d('0x24')](_0x805d('0x25'),_0xad39ff[_0x805d('0x26')])],_0xad39ff);}}}return _0x2b2930['telephones'];};};Realtime['prototype'][_0x805d('0x3d')]=function(){var _0x390eec=this;return function(_0x2b6e13){if(_0x2b6e13){freeIsNotKeySip(_0x2b6e13,_0x390eec['trunks']);for(var _0x25f5d6=0x0,_0x290bda={},_0x1d1e2f={};_0x25f5d6<_0x2b6e13[_0x805d('0x3a')];_0x25f5d6+=0x1){_0x290bda=_0x2b6e13[_0x25f5d6];if(_['isUndefined'](_0x390eec[_0x805d('0x14')][util[_0x805d('0x24')]('SIP/%s',_0x290bda['name'])])){_0x390eec['trunks'][util[_0x805d('0x24')]('SIP/%s',_0x290bda[_0x805d('0x26')])]=new Trunk(_0x290bda);}else{_0x390eec[_0x805d('0x39')](_0x390eec[_0x805d('0x14')][util[_0x805d('0x24')](_0x805d('0x25'),_0x290bda[_0x805d('0x26')])],_0x290bda);}}}return _0x390eec['trunks'];};};Realtime[_0x805d('0x38')]['initVoiceQueues']=function(){var _0x3955d4=this;return function(_0x25a27a){if(_0x25a27a){freeIsNotKey(_0x25a27a,_0x3955d4[_0x805d('0x15')],_0x805d('0x26'));for(var _0x28be9e=0x0,_0x3650c0={},_0x445012={};_0x28be9e<_0x25a27a[_0x805d('0x3a')];_0x28be9e+=0x1){_0x3650c0=_0x25a27a[_0x28be9e];if(_[_0x805d('0x3b')](_0x3955d4[_0x805d('0x15')][_0x3650c0['name']])){_0x3955d4[_0x805d('0x15')][_0x3650c0[_0x805d('0x26')]]=new VoiceQueue(_0x3650c0);}else{_0x3955d4[_0x805d('0x39')](_0x3955d4['voiceQueues'][_0x3650c0['name']],_0x3650c0);}}}return _0x3955d4['voiceQueues'];};};Realtime[_0x805d('0x38')]['initTriggers']=function(){var _0x3968bc=this;return function(_0x4d6228){if(_0x4d6228){freeIsNotKey(_0x4d6228,_0x3968bc[_0x805d('0x16')],'id');for(var _0x2a0beb=0x0,_0x3e7461={},_0x48dce9={};_0x2a0beb<_0x4d6228[_0x805d('0x3a')];_0x2a0beb+=0x1){_0x3e7461=_0x4d6228[_0x2a0beb];if(_[_0x805d('0x3b')](_0x3968bc[_0x805d('0x16')][_0x3e7461['id']])){_0x3968bc[_0x805d('0x16')][_0x3e7461['id']]=new Trigger(_0x3e7461);}else{_0x3968bc[_0x805d('0x39')](_0x3968bc['triggers'][_0x3e7461['id']],_0x3e7461);}}}return _0x3968bc[_0x805d('0x16')];};};Realtime['prototype'][_0x805d('0x3e')]=function(){var _0x17ab12=this;return function(_0x556ebf){if(_0x556ebf){freeIsNotKey(_0x556ebf,_0x17ab12['templates'],'id');for(var _0x6617fb=0x0,_0x5c9aac={},_0x357e7a={};_0x6617fb<_0x556ebf[_0x805d('0x3a')];_0x6617fb+=0x1){_0x5c9aac=_0x556ebf[_0x6617fb];if(_[_0x805d('0x3b')](_0x17ab12[_0x805d('0x3f')][_0x5c9aac['id']])){_0x17ab12[_0x805d('0x3f')][_0x5c9aac['id']]=new Template(_0x5c9aac);}else{_0x17ab12[_0x805d('0x39')](_0x17ab12['templates'][_0x5c9aac['id']],_0x5c9aac);}}}return _0x17ab12[_0x805d('0x3f')];};};Realtime[_0x805d('0x38')][_0x805d('0x40')]=function(){var _0x43495e=this;return function(_0x28b7ba){if(_0x28b7ba){freeIsNotKey(_0x28b7ba,_0x43495e['zendeskAccounts'],'id');for(var _0x33592e=0x0,_0x1b6a7a={},_0x28deaa={};_0x33592e<_0x28b7ba['length'];_0x33592e+=0x1){_0x1b6a7a=_0x28b7ba[_0x33592e];if(_[_0x805d('0x3b')](_0x43495e[_0x805d('0x1b')][_0x1b6a7a['id']])){_0x43495e[_0x805d('0x1b')][_0x1b6a7a['id']]=new ZendeskAccount(_0x1b6a7a);}else{_0x43495e[_0x805d('0x39')](_0x43495e[_0x805d('0x1b')][_0x1b6a7a['id']],_0x1b6a7a);}}}return _0x43495e['zendeskAccounts'];};};Realtime[_0x805d('0x38')][_0x805d('0x41')]=function(){var _0x440ba4=this;return function(_0xa2beb3){if(_0xa2beb3){freeIsNotKey(_0xa2beb3,_0x440ba4[_0x805d('0x1c')],'id');for(var _0x467b13=0x0,_0x22be18={},_0x32264f={};_0x467b13<_0xa2beb3[_0x805d('0x3a')];_0x467b13+=0x1){_0x22be18=_0xa2beb3[_0x467b13];if(_[_0x805d('0x3b')](_0x440ba4['salesforceAccounts'][_0x22be18['id']])){_0x440ba4[_0x805d('0x1c')][_0x22be18['id']]=new SalesforceAccount(_0x22be18);}else{_0x440ba4[_0x805d('0x39')](_0x440ba4[_0x805d('0x1c')][_0x22be18['id']],_0x22be18);}}}return _0x440ba4[_0x805d('0x1c')];};};Realtime[_0x805d('0x38')][_0x805d('0x42')]=function(){var _0xec09de=this;return function(_0x30455c){if(_0x30455c){freeIsNotKey(_0x30455c,_0xec09de[_0x805d('0x43')],'id');for(var _0x24be34=0x0,_0x4e23f7={},_0x3d489e={};_0x24be34<_0x30455c[_0x805d('0x3a')];_0x24be34+=0x1){_0x4e23f7=_0x30455c[_0x24be34];if(_[_0x805d('0x3b')](_0xec09de['freshdeskAccounts'][_0x4e23f7['id']])){_0xec09de[_0x805d('0x43')][_0x4e23f7['id']]=new FreshdeskAccount(_0x4e23f7);}else{_0xec09de[_0x805d('0x39')](_0xec09de['freshdeskAccounts'][_0x4e23f7['id']],_0x4e23f7);}}}return _0xec09de[_0x805d('0x43')];};};Realtime[_0x805d('0x38')][_0x805d('0x44')]=function(){var _0xa6509f=this;return function(_0x2a8719){if(_0x2a8719){freeIsNotKey(_0x2a8719,_0xa6509f[_0x805d('0x1e')],'id');for(var _0x10b4ef=0x0,_0x1dce39={},_0x4bfaf6={};_0x10b4ef<_0x2a8719[_0x805d('0x3a')];_0x10b4ef+=0x1){_0x1dce39=_0x2a8719[_0x10b4ef];if(_[_0x805d('0x3b')](_0xa6509f[_0x805d('0x1e')][_0x1dce39['id']])){_0xa6509f[_0x805d('0x1e')][_0x1dce39['id']]=new ZohoAccount(_0x1dce39);}else{_0xa6509f[_0x805d('0x39')](_0xa6509f['zohoAccounts'][_0x1dce39['id']],_0x1dce39);}}}return _0xa6509f['zohoAccounts'];};};Realtime[_0x805d('0x38')][_0x805d('0x45')]=function(){var _0x42de7e=this;return function(_0x317c33){if(_0x317c33){freeIsNotKey(_0x317c33,_0x42de7e[_0x805d('0x1f')],'id');for(var _0x39e4b3=0x0,_0x5611d4={},_0x1e7d2f={};_0x39e4b3<_0x317c33['length'];_0x39e4b3+=0x1){_0x5611d4=_0x317c33[_0x39e4b3];if(_[_0x805d('0x3b')](_0x42de7e['deskAccounts'][_0x5611d4['id']])){_0x42de7e['deskAccounts'][_0x5611d4['id']]=new DeskAccount(_0x5611d4);}else{_0x42de7e[_0x805d('0x39')](_0x42de7e['deskAccounts'][_0x5611d4['id']],_0x5611d4);}}}return _0x42de7e[_0x805d('0x1f')];};};Realtime[_0x805d('0x38')]['initSugarcrmAccounts']=function(){var _0x4eac32=this;return function(_0x307ced){if(_0x307ced){freeIsNotKey(_0x307ced,_0x4eac32[_0x805d('0x1d')],'id');for(var _0x548b41=0x0,_0x4d07cd={},_0x23fe94={};_0x548b41<_0x307ced[_0x805d('0x3a')];_0x548b41+=0x1){_0x4d07cd=_0x307ced[_0x548b41];if(_[_0x805d('0x3b')](_0x4eac32[_0x805d('0x1d')][_0x4d07cd['id']])){_0x4eac32[_0x805d('0x1d')][_0x4d07cd['id']]=new SugarcrmAccount(_0x4d07cd);}else{_0x4eac32[_0x805d('0x39')](_0x4eac32[_0x805d('0x1d')][_0x4d07cd['id']],_0x4d07cd);}}}return _0x4eac32[_0x805d('0x1d')];};};Realtime[_0x805d('0x38')][_0x805d('0x46')]=function(){var _0x235d98=this;return function(_0x2a969f){if(_0x2a969f){freeIsNotKey(_0x2a969f,_0x235d98[_0x805d('0x47')],'id');for(var _0xeeb361=0x0,_0x549a4e={},_0x54603b={};_0xeeb361<_0x2a969f['length'];_0xeeb361+=0x1){_0x549a4e=_0x2a969f[_0xeeb361];if(_['isUndefined'](_0x235d98['vtigerAccounts'][_0x549a4e['id']])){_0x235d98[_0x805d('0x47')][_0x549a4e['id']]=new VtigerAccount(_0x549a4e);}else{_0x235d98[_0x805d('0x39')](_0x235d98['vtigerAccounts'][_0x549a4e['id']],_0x549a4e);}}}return _0x235d98[_0x805d('0x47')];};};Realtime[_0x805d('0x38')][_0x805d('0x48')]=function(){var _0x278ae8=this;return function(_0xd1ac27){if(_0xd1ac27){freeIsNotKey(_0xd1ac27,_0x278ae8[_0x805d('0x20')],'id');for(var _0x55adfc=0x0,_0x187e95={},_0x3e2f14={};_0x55adfc<_0xd1ac27[_0x805d('0x3a')];_0x55adfc+=0x1){_0x187e95=_0xd1ac27[_0x55adfc];if(_['isUndefined'](_0x278ae8['servicenowAccounts'][_0x187e95['id']])){_0x278ae8[_0x805d('0x20')][_0x187e95['id']]=new ServicenowAccount(_0x187e95);}else{_0x278ae8[_0x805d('0x39')](_0x278ae8[_0x805d('0x20')][_0x187e95['id']],_0x187e95);}}}return _0x278ae8[_0x805d('0x20')];};};Realtime[_0x805d('0x38')]['initDynamics365Accounts']=function(){var _0x33794e=this;return function(_0x3a438c){if(_0x3a438c){freeIsNotKey(_0x3a438c,_0x33794e[_0x805d('0x49')],'id');for(var _0x6bfd81=0x0,_0x3b8353={},_0x250710={};_0x6bfd81<_0x3a438c[_0x805d('0x3a')];_0x6bfd81+=0x1){_0x3b8353=_0x3a438c[_0x6bfd81];if(_['isUndefined'](_0x33794e[_0x805d('0x49')][_0x3b8353['id']])){_0x33794e[_0x805d('0x49')][_0x3b8353['id']]=new Dynamics365Account(_0x3b8353);}else{_0x33794e[_0x805d('0x39')](_0x33794e['dynamics365Accounts'][_0x3b8353['id']],_0x3b8353);}}}return _0x33794e[_0x805d('0x49')];};};Realtime[_0x805d('0x38')][_0x805d('0x4a')]=function(){var _0xd1bd56=this;return function(_0x1ac6ff){if(_0x1ac6ff){freeIsNotKey(_0x1ac6ff,_0xd1bd56['freshsalesAccounts'],'id');for(var _0x32cfbc=0x0,_0x416a9e={},_0x5d8b53={};_0x32cfbc<_0x1ac6ff['length'];_0x32cfbc+=0x1){_0x416a9e=_0x1ac6ff[_0x32cfbc];if(_['isUndefined'](_0xd1bd56['freshsalesAccounts'][_0x416a9e['id']])){_0xd1bd56[_0x805d('0x21')][_0x416a9e['id']]=new FreshsalesAccount(_0x416a9e);}else{_0xd1bd56[_0x805d('0x39')](_0xd1bd56[_0x805d('0x21')][_0x416a9e['id']],_0x416a9e);}}}return _0xd1bd56[_0x805d('0x21')];};};Realtime[_0x805d('0x38')]['initVoiceQueueHopperHistory']=function(){var _0x1165f0=this;return function(_0x64dd04){for(var _0x34a540=0x0;_0x34a540<_0x64dd04[_0x805d('0x3a')];_0x34a540+=0x1){_[_0x805d('0x4b')](_0x1165f0[_0x805d('0x15')][_0x64dd04[_0x34a540][_0x805d('0x26')]],_0x64dd04[_0x34a540]);}return _0x1165f0['voiceQueues'];};};Realtime[_0x805d('0x38')]['initVoiceQueueReports']=function(){var _0x18dc22=this;return function(_0x7c6ff9){clearVoiceQueues(_0x18dc22[_0x805d('0x15')]);if(_0x7c6ff9){_0x7c6ff9=_['groupBy'](_0x7c6ff9,_0x805d('0x4c'));for(var _0x5c6b7b in _0x7c6ff9){if(_0x7c6ff9[_0x805d('0x23')](_0x5c6b7b)){var _0x587370={};for(var _0x537cc2=0x0;_0x537cc2<_0x7c6ff9[_0x5c6b7b][_0x805d('0x3a')];_0x537cc2+=0x1){var _0x2ff5c9=_0x7c6ff9[_0x5c6b7b][_0x537cc2]['queue'];if(_0x18dc22[_0x805d('0x15')][_0x2ff5c9]){if(_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x4d')]){_0x18dc22[_0x805d('0x15')][_0x2ff5c9]['unmanaged']+=0x1;}if(_0x7c6ff9[_0x5c6b7b][_0x537cc2]['queuecallerabandon']){_0x18dc22[_0x805d('0x15')][_0x2ff5c9]['abandoned']+=0x1;}_0x18dc22[_0x805d('0x15')][_0x2ff5c9][_0x805d('0x30')]+=moment(_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x4e')])[_0x805d('0x4f')](moment(_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x50')]),_0x805d('0x51'))||0x0;if(_0x537cc2===_0x7c6ff9[_0x5c6b7b][_0x805d('0x3a')]-0x1){_0x18dc22[_0x805d('0x15')][_0x2ff5c9][_0x805d('0x29')]+=moment(_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x52')]||_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x53')]||_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x54')])['diff'](moment(_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x50')]),'seconds')||0x0;_0x18dc22[_0x805d('0x15')][_0x2ff5c9][_0x805d('0x2e')]+=0x1;if(_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x55')]){_0x18dc22[_0x805d('0x15')][_0x2ff5c9][_0x805d('0x56')]+=0x1;_0x18dc22[_0x805d('0x15')][_0x2ff5c9][_0x805d('0x2a')]+=moment(_0x7c6ff9[_0x5c6b7b][_0x537cc2]['queuecallercompleteAt'])['diff'](moment(_0x7c6ff9[_0x5c6b7b][_0x537cc2][_0x805d('0x4e')]),_0x805d('0x51'))||0x0;}}else{_0x18dc22[_0x805d('0x15')][_0x2ff5c9][_0x805d('0x29')]+=_0x18dc22[_0x805d('0x15')][_0x2ff5c9][_0x805d('0x30')]||0x0;}}}}}}return _0x18dc22[_0x805d('0x15')];};};Realtime['prototype'][_0x805d('0x57')]=function(){var _0x2f93dd=this;return function(_0x1c6eb0){clearVoiceCallReports(_0x2f93dd[_0x805d('0x17')]);if(_0x1c6eb0){for(var _0x4fbafe=0x0;_0x4fbafe<_0x1c6eb0[_0x805d('0x3a')];_0x4fbafe+=0x1){_0x2f93dd[_0x805d('0x17')]['total']+=0x1;_0x2f93dd[_0x805d('0x17')][_0x805d('0x29')]+=_0x1c6eb0[_0x4fbafe][_0x805d('0x58')];if(_0x1c6eb0[_0x4fbafe][_0x805d('0x59')]===_0x805d('0x5a')){_0x2f93dd[_0x805d('0x17')]['answered']+=0x1;_0x2f93dd[_0x805d('0x17')]['sumHoldTime']+=_0x1c6eb0[_0x4fbafe]['duration']-_0x1c6eb0[_0x4fbafe][_0x805d('0x5b')]||0x0;_0x2f93dd['outbound']['sumBillable']+=_0x1c6eb0[_0x4fbafe]['billableseconds'];}}}return _0x2f93dd['outbound'];};};Realtime[_0x805d('0x38')][_0x805d('0x5c')]=function(){var _0x2aad80=this;return function(_0x409fe3){if(_0x409fe3){freeIsNotKey(_0x409fe3,_0x2aad80[_0x805d('0x5d')],'name');for(var _0x147b59=0x0,_0x2c1de7={};_0x147b59<_0x409fe3[_0x805d('0x3a')];_0x147b59+=0x1){_0x2c1de7=_0x409fe3[_0x147b59];if(_[_0x805d('0x3b')](_0x2aad80[_0x805d('0x5d')][_0x2c1de7[_0x805d('0x26')]])){_0x2aad80[_0x805d('0x5d')][_0x2c1de7[_0x805d('0x26')]]=new Campaign(_0x2c1de7);}else{_0x2aad80['mergeFromDatabase'](_0x2aad80[_0x805d('0x5d')][_0x2c1de7[_0x805d('0x26')]],_0x2c1de7);_0x2aad80[_0x805d('0x5d')][_0x2c1de7[_0x805d('0x26')]][_0x805d('0x5e')]=_0x2c1de7[_0x805d('0x5f')]?_0x2c1de7[_0x805d('0x5f')][_0x805d('0x26')]:undefined;}}}return _0x2aad80[_0x805d('0x5d')];};};Realtime[_0x805d('0x38')][_0x805d('0x60')]=function(){var _0xa08276=this;return function(_0x1a9f36){if(_0x1a9f36){freeIsNotKey(_0x1a9f36,_0xa08276[_0x805d('0x61')],'id');for(var _0x2c6377=0x0,_0x56902a={};_0x2c6377<_0x1a9f36[_0x805d('0x3a')];_0x2c6377+=0x1){_0x56902a=_0x1a9f36[_0x2c6377];if(_['isUndefined'](_0xa08276[_0x805d('0x61')][_0x56902a['id']])){_0xa08276[_0x805d('0x61')][_0x56902a['id']]=new VoiceExtension(_0x56902a);}else{_0xa08276[_0x805d('0x39')](_0xa08276[_0x805d('0x61')][_0x56902a['id']],_0x56902a);}}}return _0xa08276[_0x805d('0x61')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x180649=this;return function(_0x1a666c){clearCampaigns(_0x180649[_0x805d('0x5d')]);for(var _0xd5f71=0x0;_0xd5f71<_0x1a666c['length'];_0xd5f71+=0x1){_[_0x805d('0x4b')](_0x180649['campaigns'][_0x1a666c[_0xd5f71][_0x805d('0x26')]],_0x1a666c[_0xd5f71]);}return _0x180649[_0x805d('0x5d')];};};Realtime[_0x805d('0x38')][_0x805d('0x62')]=function(){var _0x42d759=this;return function(_0x20db25){if(_0x20db25){freeIsNotKey(_0x20db25,_0x42d759[_0x805d('0x63')],'id');for(var _0x238903=0x0,_0x4e54b7={},_0x4fd69e={};_0x238903<_0x20db25[_0x805d('0x3a')];_0x238903+=0x1){_0x4e54b7=_0x20db25[_0x238903];if(_['isUndefined'](_0x42d759['faxAccounts'][_0x4e54b7['id']])){_0x42d759[_0x805d('0x63')][_0x4e54b7['id']]=new FaxAccount(_0x4e54b7);}else{_0x42d759[_0x805d('0x39')](_0x42d759[_0x805d('0x63')][_0x4e54b7['id']],_0x4e54b7);}}}return _0x42d759[_0x805d('0x63')];};};module[_0x805d('0x64')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 82af53a..56cc83a 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 _0x5775=['findAgent','find','name','accountcode','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','isNil','queuecallercompleteAt','queuecallerexit','create','match','destination','exten','type','dialer','lastapplication','queue','from-voip-provider','callerid','context','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitorFilename','filename','createdAt','monitors','xcally-motion-preview','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','exports','bluebird','lodash','util','../../../config/environment','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','prototype'];(function(_0x3076b5,_0x6bc9df){var _0x5ef5da=function(_0xac1ad1){while(--_0xac1ad1){_0x3076b5['push'](_0x3076b5['shift']());}};_0x5ef5da(++_0x6bc9df);}(_0x5775,0x12c));var _0x5577=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x5775[_0x597484];return _0x218e64;};'use strict';var BPromise=require(_0x5577('0x0'));var _=require(_0x5577('0x1'));var moment=require('moment');var util=require(_0x5577('0x2'));var config=require(_0x5577('0x3'));var logger=require('../../../config/logger')(_0x5577('0x4'));var ami=require(_0x5577('0x5'));var RpcVoiceAgentReport=require(_0x5577('0x6'));var RpcVoiceCallReport=require(_0x5577('0x7'));var RpcVoiceDialReport=require(_0x5577('0x8'));var RpcMemberReport=require(_0x5577('0x9'));var RpcVoiceQueueReport=require(_0x5577('0xa'));var RpcVoiceRecording=require(_0x5577('0xb'));var RpcVoiceTransferReport=require(_0x5577('0xc'));var VoiceQueueReport=require(_0x5577('0xd'));var VoiceCallReport=require(_0x5577('0xe'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x5577('0xf'));function Report(_0x54f251){this[_0x5577('0x10')]=_0x54f251;this['agents']=_0x54f251[_0x5577('0x11')];this[_0x5577('0x12')]=_0x54f251['telephones'];}Report['prototype'][_0x5577('0x13')]=function(_0x42fae6){var _0x280e6f=new VoiceQueueReport(this[_0x5577('0x10')]);var _0x22bfe9=new VoiceAgentReport(this[_0x5577('0x10')]);var _0x27fa3e=new VoiceDialReport(this[_0x5577('0x10')]);var _0x243520=new VoiceCallReport(this[_0x5577('0x10')]);var _0x1e0b81=new UserReport(this['realtime']);if(config[_0x5577('0x14')]&&config[_0x5577('0x14')][_0x5577('0x15')]){ami['on'](_0x5577('0x16'),this['voiceQueueReport'][_0x5577('0x17')](this));ami['on']('custom:voiceCallReport',this[_0x5577('0x18')]['bind'](this));ami['on'](_0x5577('0x19'),this[_0x5577('0x1a')][_0x5577('0x17')](this));ami['on'](_0x5577('0x1b'),this[_0x5577('0x1c')]['bind'](this));ami['on']('blindtransfer',this[_0x5577('0x1d')]['bind'](this));ami['on']('attendedtransfer',this[_0x5577('0x1e')][_0x5577('0x17')](this));}};Report[_0x5577('0x1f')][_0x5577('0x20')]=function(_0x22f674){var _0x32736b=undefined;_0x32736b=_[_0x5577('0x21')](this[_0x5577('0x11')],function(_0x1ed3c9){return _0x1ed3c9['accountcode']==_0x22f674||_0x1ed3c9[_0x5577('0x22')]==_0x22f674;});if(_['isNil'](_0x32736b)){var _0x39331b=_[_0x5577('0x21')](this['telephones'],function(_0x3f2c0c){return _0x3f2c0c[_0x5577('0x23')]==_0x22f674||_0x3f2c0c['name']==_0x22f674;});if(_0x39331b){_0x32736b=_[_0x5577('0x21')](this['agents'],function(_0x804c2b){return _0x804c2b[_0x5577('0x24')]==util[_0x5577('0x25')](_0x5577('0x26'),_0x39331b[_0x5577('0x22')]);});}}return _0x32736b;};Report['prototype'][_0x5577('0x27')]=function(_0x26f2ab){for(var _0x28dea8=0x0;_0x28dea8<_0x26f2ab[_0x5577('0x28')];_0x28dea8+=0x1){var _0x11993=this['findAgent'](_0x26f2ab[_0x28dea8][_0x5577('0x29')]);if(_0x11993){_0x26f2ab[_0x28dea8][_0x5577('0x23')]=_0x11993['accountcode'];_0x26f2ab[_0x28dea8][_0x5577('0x2a')]=!![];_0x26f2ab[_0x28dea8]['lastAssignedTo']=_0x11993[_0x5577('0x22')];_0x26f2ab[_0x28dea8][_0x5577('0x24')]=_[_0x5577('0x2b')](_0x11993[_0x5577('0x24')])?util[_0x5577('0x25')](_0x5577('0x26'),_0x11993['name']):_0x11993[_0x5577('0x24')];if(_0x26f2ab[_0x28dea8]['queuecallercomplete']){_0x26f2ab[_0x28dea8][_0x5577('0x2c')]=moment()[_0x5577('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x26f2ab[_0x28dea8][_0x5577('0x2d')]){_0x26f2ab[_0x28dea8]['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x26f2ab[_0x28dea8]);}RpcVoiceQueueReport[_0x5577('0x2e')](_0x26f2ab[_0x28dea8]);}};function extractCalleridNumber(_0x51b11f){var _0x217dc7=_0x51b11f[_0x5577('0x2f')](/<(.*?)>/);return _0x217dc7?_0x217dc7[0x1]:_0x51b11f;}Report[_0x5577('0x1f')][_0x5577('0x18')]=function(_0x413158){_0x413158[_0x5577('0x30')]=_0x413158[_0x5577('0x30')]||_0x413158[_0x5577('0x31')];if(_0x413158[_0x5577('0x32')]==_0x5577('0x33')){_0x413158[_0x5577('0x34')]='queue';_0x413158['lastdata']=_0x413158[_0x5577('0x35')];if(_0x413158['context']==_0x5577('0x36')){_0x413158[_0x5577('0x23')]='';_0x413158[_0x5577('0x30')]=extractCalleridNumber(_0x413158[_0x5577('0x37')]);}else if(_0x413158[_0x5577('0x38')]=='from-sip'){if(_0x413158[_0x5577('0x30')]=='xcally-motion-preview'){_0x413158['destination']=extractCalleridNumber(_0x413158[_0x5577('0x39')]);_0x413158[_0x5577('0x3a')]=_0x413158[_0x5577('0x3b')];_0x413158[_0x5577('0x3c')]=[_0x413158['channel'],_0x413158[_0x5577('0x3d')]=_0x413158[_0x5577('0x3c')]][0x0];_0x413158[_0x5577('0x37')]=_0x413158['calleridpreview'];}else{_0x413158[_0x5577('0x30')]=_0x413158['calleridnum'];_0x413158[_0x5577('0x3a')]=_0x413158[_0x5577('0x3b')];if(_0x413158['disposition']==_0x5577('0x3e')){_0x413158[_0x5577('0x23')]=_0x413158[_0x5577('0x29')];}else{_0x413158[_0x5577('0x23')]='';}}}}else{_0x413158['callerid']=util[_0x5577('0x25')](_0x5577('0x3f'),_0x413158['calleridname'],_0x413158[_0x5577('0x3a')]);}RpcVoiceCallReport[_0x5577('0x2e')](_0x413158);if(_0x413158[_0x5577('0x40')]){for(var _0x215c7b=0x0;_0x215c7b<_0x413158['monitors'][_0x5577('0x28')];_0x215c7b+=0x1){_0x413158[_0x5577('0x41')]=_0x413158['monitors'][_0x215c7b][_0x5577('0x42')];_0x413158[_0x5577('0x43')]=_0x413158[_0x5577('0x44')][_0x215c7b][_0x5577('0x43')];if(_0x413158[_0x5577('0x31')]==_0x5577('0x45')){_0x413158[_0x5577('0x3a')]=_0x413158['connectedlinenum'];_0x413158[_0x5577('0x46')]=_0x413158[_0x5577('0x47')];_0x413158[_0x5577('0x29')]=_0x413158[_0x5577('0x23')];_0x413158[_0x5577('0x47')]=_0x413158[_0x5577('0x48')];_0x413158[_0x5577('0x31')]=_0x413158[_0x5577('0x3b')];}else if(_0x413158[_0x5577('0x31')]==_0x5577('0x49')){_0x413158[_0x5577('0x3a')]=_0x413158[_0x5577('0x30')];_0x413158[_0x5577('0x31')]=_0x413158[_0x5577('0x3b')];}RpcVoiceRecording['create'](_0x413158);}}};Report['prototype'][_0x5577('0x1a')]=function(_0x5979f5){if(_[_0x5577('0x4a')](_0x5979f5)){_0x5979f5[_0x5577('0x4b')](function(_0x92e96d){RpcVoiceAgentReport[_0x5577('0x2e')](_0x92e96d);});}else{RpcVoiceAgentReport[_0x5577('0x2e')](_0x5979f5);}};Report[_0x5577('0x1f')][_0x5577('0x1c')]=function(_0x336b80){RpcVoiceDialReport[_0x5577('0x2e')](_0x336b80);var _0x4bf12b=undefined;var _0x399bc5=_0x336b80[_0x5577('0x3d')];if(_['startsWith'](_0x399bc5,_0x5577('0x4c'))){var _0x1bd5a4=_0x399bc5[_0x5577('0x4d')](_0x399bc5[_0x5577('0x4e')]('/')+0x1,_0x399bc5[_0x5577('0x4e')]('@'));_0x4bf12b=_['find'](this[_0x5577('0x11')],function(_0x5dd664){return _0x5dd664[_0x5577('0x4f')]==_0x1bd5a4||_0x5dd664[_0x5577('0x50')]==_0x1bd5a4||_0x5dd664['accountcode']==_0x1bd5a4;});}else{var _0x1bd5a4=_0x399bc5[_0x5577('0x4d')](_0x399bc5[_0x5577('0x4e')]('/')+0x1,_0x399bc5[_0x5577('0x51')]('-'));_0x4bf12b=this['findAgent'](_0x1bd5a4);}if(_0x4bf12b){_0x336b80[_0x5577('0x24')]=_['isNil'](_0x4bf12b['interface'])?util[_0x5577('0x25')]('SIP/%s',_0x4bf12b[_0x5577('0x22')]):_0x4bf12b[_0x5577('0x24')];_0x336b80[_0x5577('0x48')]=_0x4bf12b['name'];_0x336b80['accountcode']=_0x4bf12b['accountcode'];RpcMemberReport['voiceDialReport'](_0x336b80);}};Report[_0x5577('0x1f')][_0x5577('0x1d')]=function(_0x2148cb){RpcVoiceTransferReport['blindTransfer'](_0x2148cb);};Report[_0x5577('0x1f')][_0x5577('0x1e')]=function(_0x48613b){RpcVoiceTransferReport['attendedTransfer'](_0x48613b);};module[_0x5577('0x52')]=Report; \ No newline at end of file +var _0x92b5=['context','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','monitorFilename','filename','createdAt','exten','xcally-motion-preview','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','create','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','bluebird','lodash','moment','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','interface','format','name','length','connectedlinenum','lastAssignedTo','SIP/%s','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','match','voiceCallReport','destination','type','dialer','lastapplication','queue','lastdata'];(function(_0x4a881c,_0x563b3a){var _0x5b653d=function(_0x4a7da7){while(--_0x4a7da7){_0x4a881c['push'](_0x4a881c['shift']());}};_0x5b653d(++_0x563b3a);}(_0x92b5,0x1c2));var _0x592b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x92b5[_0x13e741];return _0x3f8bb3;};'use strict';var BPromise=require(_0x592b('0x0'));var _=require(_0x592b('0x1'));var moment=require(_0x592b('0x2'));var util=require(_0x592b('0x3'));var config=require('../../../config/environment');var logger=require(_0x592b('0x4'))(_0x592b('0x5'));var ami=require(_0x592b('0x6'));var RpcVoiceAgentReport=require(_0x592b('0x7'));var RpcVoiceCallReport=require(_0x592b('0x8'));var RpcVoiceDialReport=require(_0x592b('0x9'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x592b('0xa'));var RpcVoiceTransferReport=require(_0x592b('0xb'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x592b('0xc'));var VoiceAgentReport=require(_0x592b('0xd'));var VoiceDialReport=require(_0x592b('0xe'));var UserReport=require(_0x592b('0xf'));function Report(_0x234c59){this['realtime']=_0x234c59;this['agents']=_0x234c59[_0x592b('0x10')];this[_0x592b('0x11')]=_0x234c59['telephones'];}Report[_0x592b('0x12')]['sync']=function(_0xfbc36c){var _0xcd78a9=new VoiceQueueReport(this[_0x592b('0x13')]);var _0xf2d39b=new VoiceAgentReport(this['realtime']);var _0x5cbf6c=new VoiceDialReport(this[_0x592b('0x13')]);var _0x1a9631=new VoiceCallReport(this['realtime']);var _0xad8947=new UserReport(this[_0x592b('0x13')]);if(config['xdr']&&config['xdr'][_0x592b('0x14')]){ami['on'](_0x592b('0x15'),this[_0x592b('0x16')][_0x592b('0x17')](this));ami['on'](_0x592b('0x18'),this['voiceCallReport'][_0x592b('0x17')](this));ami['on'](_0x592b('0x19'),this[_0x592b('0x1a')][_0x592b('0x17')](this));ami['on'](_0x592b('0x1b'),this[_0x592b('0x1c')][_0x592b('0x17')](this));ami['on'](_0x592b('0x1d'),this[_0x592b('0x1e')]['bind'](this));ami['on'](_0x592b('0x1f'),this[_0x592b('0x20')]['bind'](this));}};Report[_0x592b('0x12')][_0x592b('0x21')]=function(_0x33e5c5){var _0x1c9e6a=undefined;_0x1c9e6a=_[_0x592b('0x22')](this[_0x592b('0x10')],function(_0x1ad24f){return _0x1ad24f['accountcode']==_0x33e5c5||_0x1ad24f['name']==_0x33e5c5;});if(_[_0x592b('0x23')](_0x1c9e6a)){var _0x8517f2=_[_0x592b('0x22')](this[_0x592b('0x11')],function(_0x57fe36){return _0x57fe36[_0x592b('0x24')]==_0x33e5c5||_0x57fe36['name']==_0x33e5c5;});if(_0x8517f2){_0x1c9e6a=_[_0x592b('0x22')](this['agents'],function(_0x9eed20){return _0x9eed20[_0x592b('0x25')]==util[_0x592b('0x26')]('SIP/%s',_0x8517f2[_0x592b('0x27')]);});}}return _0x1c9e6a;};Report['prototype']['voiceQueueReport']=function(_0x12920d){for(var _0x54e91e=0x0;_0x54e91e<_0x12920d[_0x592b('0x28')];_0x54e91e+=0x1){var _0x17944f=this[_0x592b('0x21')](_0x12920d[_0x54e91e][_0x592b('0x29')]);if(_0x17944f){_0x12920d[_0x54e91e][_0x592b('0x24')]=_0x17944f[_0x592b('0x24')];_0x12920d[_0x54e91e]['assigned']=!![];_0x12920d[_0x54e91e][_0x592b('0x2a')]=_0x17944f[_0x592b('0x27')];_0x12920d[_0x54e91e]['interface']=_[_0x592b('0x23')](_0x17944f[_0x592b('0x25')])?util[_0x592b('0x26')](_0x592b('0x2b'),_0x17944f[_0x592b('0x27')]):_0x17944f[_0x592b('0x25')];if(_0x12920d[_0x54e91e]['queuecallercomplete']){_0x12920d[_0x54e91e][_0x592b('0x2c')]=moment()[_0x592b('0x26')](_0x592b('0x2d'));}if(_0x12920d[_0x54e91e]['queuecallerexit']){_0x12920d[_0x54e91e]['queuecallerexitAt']=moment()['format'](_0x592b('0x2d'));}RpcMemberReport[_0x592b('0x16')](_0x12920d[_0x54e91e]);}RpcVoiceQueueReport['create'](_0x12920d[_0x54e91e]);}};function extractCalleridNumber(_0x2ef99a){var _0x130672=_0x2ef99a[_0x592b('0x2e')](/<(.*?)>/);return _0x130672?_0x130672[0x1]:_0x2ef99a;}Report['prototype'][_0x592b('0x2f')]=function(_0x436f43){_0x436f43[_0x592b('0x30')]=_0x436f43[_0x592b('0x30')]||_0x436f43['exten'];if(_0x436f43[_0x592b('0x31')]==_0x592b('0x32')){_0x436f43[_0x592b('0x33')]=_0x592b('0x34');_0x436f43[_0x592b('0x35')]=_0x436f43['queue'];if(_0x436f43[_0x592b('0x36')]=='from-voip-provider'){_0x436f43[_0x592b('0x24')]='';_0x436f43[_0x592b('0x30')]=extractCalleridNumber(_0x436f43['callerid']);}else if(_0x436f43[_0x592b('0x36')]==_0x592b('0x37')){if(_0x436f43[_0x592b('0x30')]=='xcally-motion-preview'){_0x436f43[_0x592b('0x30')]=extractCalleridNumber(_0x436f43[_0x592b('0x38')]);_0x436f43[_0x592b('0x39')]=_0x436f43[_0x592b('0x3a')];_0x436f43[_0x592b('0x3b')]=[_0x436f43['channel'],_0x436f43[_0x592b('0x3c')]=_0x436f43[_0x592b('0x3b')]][0x0];_0x436f43[_0x592b('0x3d')]=_0x436f43[_0x592b('0x38')];}else{_0x436f43[_0x592b('0x30')]=_0x436f43[_0x592b('0x39')];_0x436f43[_0x592b('0x39')]=_0x436f43['originatecalleridnum'];if(_0x436f43['disposition']==_0x592b('0x3e')){_0x436f43[_0x592b('0x24')]=_0x436f43[_0x592b('0x29')];}else{_0x436f43['accountcode']='';}}}}else{_0x436f43[_0x592b('0x3d')]=util[_0x592b('0x26')](_0x592b('0x3f'),_0x436f43['calleridname'],_0x436f43[_0x592b('0x39')]);}RpcVoiceCallReport['create'](_0x436f43);if(_0x436f43[_0x592b('0x40')]){for(var _0x2a5609=0x0;_0x2a5609<_0x436f43[_0x592b('0x41')][_0x592b('0x28')];_0x2a5609+=0x1){_0x436f43[_0x592b('0x42')]=_0x436f43[_0x592b('0x41')][_0x2a5609][_0x592b('0x43')];_0x436f43['createdAt']=_0x436f43['monitors'][_0x2a5609][_0x592b('0x44')];if(_0x436f43[_0x592b('0x45')]==_0x592b('0x46')){_0x436f43[_0x592b('0x39')]=_0x436f43[_0x592b('0x29')];_0x436f43[_0x592b('0x47')]=_0x436f43[_0x592b('0x48')];_0x436f43[_0x592b('0x29')]=_0x436f43[_0x592b('0x24')];_0x436f43[_0x592b('0x48')]=_0x436f43[_0x592b('0x49')];_0x436f43['exten']=_0x436f43[_0x592b('0x3a')];}else if(_0x436f43[_0x592b('0x45')]==_0x592b('0x4a')){_0x436f43['calleridnum']=_0x436f43[_0x592b('0x30')];_0x436f43['exten']=_0x436f43[_0x592b('0x3a')];}RpcVoiceRecording['create'](_0x436f43);}}};Report[_0x592b('0x12')][_0x592b('0x1a')]=function(_0x5daf3c){if(_[_0x592b('0x4b')](_0x5daf3c)){_0x5daf3c['forEach'](function(_0xbaf82b){RpcVoiceAgentReport['create'](_0xbaf82b);});}else{RpcVoiceAgentReport[_0x592b('0x4c')](_0x5daf3c);}};Report['prototype'][_0x592b('0x1c')]=function(_0x5e324f){RpcVoiceDialReport[_0x592b('0x4c')](_0x5e324f);var _0x435f4b=undefined;var _0x5c6786=_0x5e324f['channel'];if(_[_0x592b('0x4d')](_0x5c6786,_0x592b('0x4e'))){var _0x5e1f6b=_0x5c6786['substring'](_0x5c6786[_0x592b('0x4f')]('/')+0x1,_0x5c6786['indexOf']('@'));_0x435f4b=_[_0x592b('0x22')](this[_0x592b('0x10')],function(_0x51acd8){return _0x51acd8[_0x592b('0x50')]==_0x5e1f6b||_0x51acd8[_0x592b('0x51')]==_0x5e1f6b||_0x51acd8[_0x592b('0x24')]==_0x5e1f6b;});}else{var _0x5e1f6b=_0x5c6786[_0x592b('0x52')](_0x5c6786[_0x592b('0x4f')]('/')+0x1,_0x5c6786[_0x592b('0x53')]('-'));_0x435f4b=this['findAgent'](_0x5e1f6b);}if(_0x435f4b){_0x5e324f[_0x592b('0x25')]=_[_0x592b('0x23')](_0x435f4b[_0x592b('0x25')])?util[_0x592b('0x26')](_0x592b('0x2b'),_0x435f4b[_0x592b('0x27')]):_0x435f4b['interface'];_0x5e324f[_0x592b('0x49')]=_0x435f4b[_0x592b('0x27')];_0x5e324f['accountcode']=_0x435f4b[_0x592b('0x24')];RpcMemberReport[_0x592b('0x1c')](_0x5e324f);}};Report['prototype']['blindTransfer']=function(_0x31b81c){RpcVoiceTransferReport['blindTransfer'](_0x31b81c);};Report[_0x592b('0x12')]['attendedTransfer']=function(_0x4c8b17){RpcVoiceTransferReport[_0x592b('0x20')](_0x4c8b17);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 138f371..6c8fdc8 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 _0x906c=['syncPeerStatus','loopSyncRealTimeShow','then','actionDeviceStateList','catch','[loopSyncRealTimeShow]','error','inspect','prototype','actionSipPeerStatus','isNotNull','emit','find','username','state','merge','omit','event','actionid','format','name','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','updateStatusRealtime','toNumber','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','mobile','accountcode','[syncDeviceState][UserReport]','peer','peerstatus','registered','status','address','trunk:%s','trunk:save','[syncPeerStatus][UserReport]','exports','lodash','moment','ioredis','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x906c,0xb2));var _0xc906=function(_0x28a517,_0x39c0cf){_0x28a517=_0x28a517-0x0;var _0x5e00aa=_0x906c[_0x28a517];return _0x5e00aa;};'use strict';var _=require(_0xc906('0x0'));var moment=require(_0xc906('0x1'));var BPromise=require('bluebird');var util=require('util');var Redis=require(_0xc906('0x2'));var config=require(_0xc906('0x3'));var logger=require('../../../config/logger')(_0xc906('0x4'));var ami=require(_0xc906('0x5'));config['redis']=_[_0xc906('0x6')](config[_0xc906('0x7')],{'host':_0xc906('0x8'),'port':0x18eb});var io=require(_0xc906('0x9'))(new Redis(config[_0xc906('0x7')]));function UserReport(_0x3280eb){this[_0xc906('0xa')]=_0x3280eb['trunks'];this[_0xc906('0xb')]=_0x3280eb[_0xc906('0xb')];this[_0xc906('0xc')]=_0x3280eb['telephones'];ami['on']('registryentry',this[_0xc906('0xd')][_0xc906('0xe')](this));ami['on']('registry',this[_0xc906('0xd')][_0xc906('0xe')](this));ami['on'](_0xc906('0xf'),this[_0xc906('0x10')][_0xc906('0xe')](this));ami['on']('peerstatus',this[_0xc906('0x11')]['bind'](this));this[_0xc906('0x12')]();return BPromise['resolve']()[_0xc906('0x13')](ami['actionSipShowRegistry']())[_0xc906('0x13')](ami[_0xc906('0x14')]())[_0xc906('0x13')](ami['actionSipPeerStatus']())[_0xc906('0x15')](loggerCatch(_0xc906('0x16')));}function loggerCatch(_0x13393d){return function(_0x48c8a1){logger[_0xc906('0x17')](_0x13393d,util[_0xc906('0x18')](_0x48c8a1,{'showHidden':![],'depth':null}));};}UserReport[_0xc906('0x19')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise['resolve']()['then'](ami['actionSipShowRegistry']())[_0xc906('0x13')](ami[_0xc906('0x14')]())[_0xc906('0x13')](ami[_0xc906('0x1a')]())[_0xc906('0x15')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xc906('0x19')][_0xc906('0x1b')]=function(_0x952fbe){return _0x952fbe!==null&&!_['isUndefined'](_0x952fbe);};UserReport['prototype']['emit']=function(_0x5ce1e5,_0x2f4792,_0x8a561){io['to'](_0x5ce1e5)[_0xc906('0x1c')](_0x2f4792,_0x8a561);};UserReport[_0xc906('0x19')][_0xc906('0xd')]=function(_0x32257c){try{if(this['isNotNull'](_0x32257c)){var _0x862db7=_[_0xc906('0x1d')](this[_0xc906('0xa')],{'registry':_0x32257c[_0xc906('0x1e')]});if(_0x862db7){_0x32257c['stateRegistry']=_0x32257c[_0xc906('0x1f')];_[_0xc906('0x20')](_0x862db7,_[_0xc906('0x21')](_0x32257c,[_0xc906('0x22'),_0xc906('0x23'),'username','state']));this[_0xc906('0x1c')](util[_0xc906('0x24')]('trunk:%s',_0x862db7[_0xc906('0x25')]),'trunk:save',_0x862db7);}}}catch(_0x27d5bf){logger[_0xc906('0x17')](_0xc906('0x26'),util[_0xc906('0x18')](_0x27d5bf,{'showHidden':![],'depth':null}));}};UserReport[_0xc906('0x19')]['syncDeviceState']=function(_0x2325ff){try{if(this[_0xc906('0x1b')](_0x2325ff)){if(this[_0xc906('0xb')][_0x2325ff[_0xc906('0x27')]]){if(!this[_0xc906('0xb')][_0x2325ff[_0xc906('0x27')]][_0xc906('0x28')]||_0x2325ff[_0xc906('0x1f')][_0xc906('0x29')]()==_0xc906('0x2a')){this['agents'][_0x2325ff[_0xc906('0x27')]][_0xc906('0x28')]=![];if(this[_0xc906('0xb')][_0x2325ff[_0xc906('0x27')]][_0xc906('0x1f')]!==_0x2325ff[_0xc906('0x1f')][_0xc906('0x29')]()){this['agents'][_0x2325ff['device']][_0xc906('0x2b')]=_['toNumber'](moment()['format']('x'));}this['agents'][_0x2325ff[_0xc906('0x27')]][_0xc906('0x1f')]=_0x2325ff[_0xc906('0x1f')]['toLowerCase']();this[_0xc906('0xb')][_0x2325ff[_0xc906('0x27')]][_0xc906('0x2c')](_0x2325ff);}}else if(this['telephones'][_0x2325ff[_0xc906('0x27')]]){if(this[_0xc906('0xc')][_0x2325ff['device']][_0xc906('0x1f')]!==_0x2325ff[_0xc906('0x1f')][_0xc906('0x29')]()){this[_0xc906('0xc')][_0x2325ff[_0xc906('0x27')]][_0xc906('0x2b')]=_[_0xc906('0x2d')](moment()[_0xc906('0x24')]('x'));}this[_0xc906('0xc')][_0x2325ff['device']][_0xc906('0x1f')]=_0x2325ff[_0xc906('0x1f')]['toLowerCase']();this[_0xc906('0x1c')](util[_0xc906('0x24')](_0xc906('0x2e'),this[_0xc906('0xc')][_0x2325ff[_0xc906('0x27')]][_0xc906('0x25')]),_0xc906('0x2f'),this[_0xc906('0xc')][_0x2325ff['device']]);}else if(this[_0xc906('0xa')][_0x2325ff[_0xc906('0x27')]]){if(this[_0xc906('0xa')][_0x2325ff['device']]['state']!==_0x2325ff[_0xc906('0x1f')]['toLowerCase']()){this[_0xc906('0xa')][_0x2325ff[_0xc906('0x27')]]['stateTime']=_[_0xc906('0x2d')](moment()[_0xc906('0x24')]('x'));}this[_0xc906('0xa')][_0x2325ff[_0xc906('0x27')]][_0xc906('0x1f')]=_0x2325ff['state'][_0xc906('0x29')]();this[_0xc906('0x1c')](util[_0xc906('0x24')]('trunk:%s',this[_0xc906('0xa')][_0x2325ff[_0xc906('0x27')]]['name']),'trunk:save',this[_0xc906('0xa')][_0x2325ff['device']]);}else if(_[_0xc906('0x30')](_0x2325ff['device'],_0xc906('0x31'))){}else if(_['startsWith'](_0x2325ff[_0xc906('0x27')],_0xc906('0x32'))){var _0x531d92=_0x2325ff[_0xc906('0x27')];var _0x2718c7=_0x531d92[_0xc906('0x33')](_0x531d92['indexOf']('/')+0x1,_0x531d92[_0xc906('0x34')]('@'));var _0x2bade1=_[_0xc906('0x1d')](this[_0xc906('0xb')],function(_0x166bb8){return _0x166bb8[_0xc906('0x35')]==_0x2718c7||_0x166bb8['phone']==_0x2718c7||_0x166bb8[_0xc906('0x36')]==_0x2718c7;});if(_0x2bade1){if(_0x2bade1[_0xc906('0x1f')]!==_0x2325ff['state']['toLowerCase']()){_0x2bade1['stateTime']=_[_0xc906('0x2d')](moment()[_0xc906('0x24')]('x'));}_0x2bade1[_0xc906('0x1f')]=_0x2325ff['state'][_0xc906('0x29')]();_0x2bade1[_0xc906('0x28')]=!![];_0x2bade1[_0xc906('0x2c')](_0x2325ff);}}else{}}}catch(_0x596d2d){logger['error'](_0xc906('0x37'),util[_0xc906('0x18')](_0x596d2d,{'showHidden':![],'depth':null}));}};UserReport[_0xc906('0x19')][_0xc906('0x11')]=function(_0x24b630){try{if(this['isNotNull'](_0x24b630)&&this['isNotNull'](_0x24b630['peerstatus'])){if(this['agents'][_0x24b630['peer']]){if(!this[_0xc906('0xb')][_0x24b630[_0xc906('0x38')]]['local']||_0x24b630[_0xc906('0x39')][_0xc906('0x29')]()==_0xc906('0x3a')){this[_0xc906('0xb')][_0x24b630[_0xc906('0x38')]][_0xc906('0x28')]=![];this['agents'][_0x24b630[_0xc906('0x38')]][_0xc906('0x3b')]=_0x24b630[_0xc906('0x39')][_0xc906('0x29')]();this[_0xc906('0xb')][_0x24b630[_0xc906('0x38')]]['address']=_0x24b630[_0xc906('0x3c')];this[_0xc906('0xb')][_0x24b630[_0xc906('0x38')]][_0xc906('0x2c')](_0x24b630);}}else if(this[_0xc906('0xc')][_0x24b630[_0xc906('0x38')]]){this[_0xc906('0xc')][_0x24b630[_0xc906('0x38')]]['status']=_0x24b630[_0xc906('0x39')][_0xc906('0x29')]();this[_0xc906('0xc')][_0x24b630[_0xc906('0x38')]][_0xc906('0x3c')]=_0x24b630[_0xc906('0x3c')];this['emit'](util[_0xc906('0x24')](_0xc906('0x2e'),this[_0xc906('0xc')][_0x24b630[_0xc906('0x38')]][_0xc906('0x25')]),'telephone:save',this[_0xc906('0xc')][_0x24b630[_0xc906('0x38')]]);}else if(this[_0xc906('0xa')][_0x24b630[_0xc906('0x38')]]){this['trunks'][_0x24b630['peer']]['status']=_0x24b630[_0xc906('0x39')][_0xc906('0x29')]();this[_0xc906('0xa')][_0x24b630[_0xc906('0x38')]][_0xc906('0x3c')]=_0x24b630[_0xc906('0x3c')];this[_0xc906('0x1c')](util[_0xc906('0x24')](_0xc906('0x3d'),this[_0xc906('0xa')][_0x24b630['peer']][_0xc906('0x25')]),_0xc906('0x3e'),this[_0xc906('0xa')][_0x24b630[_0xc906('0x38')]]);}else{}}}catch(_0x7e64b){logger[_0xc906('0x17')](_0xc906('0x3f'),util[_0xc906('0x18')](_0x7e64b,{'showHidden':![],'depth':null}));}};module[_0xc906('0x40')]=UserReport; \ No newline at end of file +var _0xa3ff=['toLowerCase','stateTime','toNumber','telephone:%s','telephone:save','trunk:save','startsWith','Local','indexOf','find','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','local','registered','address','updateStatusRealtime','status','[syncPeerStatus][UserReport]','exports','lodash','bluebird','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','catch','isNotNull','isUndefined','emit','username','stateRegistry','state','merge','omit','event','actionid','format','trunk:%s','name','[syncRegistry][UserReport]','device'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa3ff,0xe5));var _0xfa3f=function(_0x16289a,_0x33dfa5){_0x16289a=_0x16289a-0x0;var _0x2b891f=_0xa3ff[_0x16289a];return _0x2b891f;};'use strict';var _=require(_0xfa3f('0x0'));var moment=require('moment');var BPromise=require(_0xfa3f('0x1'));var util=require('util');var Redis=require(_0xfa3f('0x2'));var config=require(_0xfa3f('0x3'));var logger=require('../../../config/logger')(_0xfa3f('0x4'));var ami=require(_0xfa3f('0x5'));config[_0xfa3f('0x6')]=_[_0xfa3f('0x7')](config[_0xfa3f('0x6')],{'host':_0xfa3f('0x8'),'port':0x18eb});var io=require(_0xfa3f('0x9'))(new Redis(config[_0xfa3f('0x6')]));function UserReport(_0x11da15){this[_0xfa3f('0xa')]=_0x11da15[_0xfa3f('0xa')];this[_0xfa3f('0xb')]=_0x11da15[_0xfa3f('0xb')];this[_0xfa3f('0xc')]=_0x11da15[_0xfa3f('0xc')];ami['on'](_0xfa3f('0xd'),this[_0xfa3f('0xe')][_0xfa3f('0xf')](this));ami['on'](_0xfa3f('0x10'),this[_0xfa3f('0xe')][_0xfa3f('0xf')](this));ami['on'](_0xfa3f('0x11'),this[_0xfa3f('0x12')][_0xfa3f('0xf')](this));ami['on'](_0xfa3f('0x13'),this[_0xfa3f('0x14')][_0xfa3f('0xf')](this));this[_0xfa3f('0x15')]();return BPromise[_0xfa3f('0x16')]()['then'](ami[_0xfa3f('0x17')]())[_0xfa3f('0x18')](ami[_0xfa3f('0x19')]())['then'](ami[_0xfa3f('0x1a')]())['catch'](loggerCatch(_0xfa3f('0x1b')));}function loggerCatch(_0x1b5ec1){return function(_0x35650d){logger[_0xfa3f('0x1c')](_0x1b5ec1,util[_0xfa3f('0x1d')](_0x35650d,{'showHidden':![],'depth':null}));};}UserReport[_0xfa3f('0x1e')]['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xfa3f('0x16')]()['then'](ami[_0xfa3f('0x17')]())[_0xfa3f('0x18')](ami['actionDeviceStateList']())[_0xfa3f('0x18')](ami['actionSipPeerStatus']())[_0xfa3f('0x1f')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xfa3f('0x1e')][_0xfa3f('0x20')]=function(_0x3140ba){return _0x3140ba!==null&&!_[_0xfa3f('0x21')](_0x3140ba);};UserReport['prototype'][_0xfa3f('0x22')]=function(_0x12a4bb,_0x9abfef,_0x5bad6b){io['to'](_0x12a4bb)[_0xfa3f('0x22')](_0x9abfef,_0x5bad6b);};UserReport[_0xfa3f('0x1e')][_0xfa3f('0xe')]=function(_0x1b061b){try{if(this[_0xfa3f('0x20')](_0x1b061b)){var _0x143e61=_['find'](this[_0xfa3f('0xa')],{'registry':_0x1b061b[_0xfa3f('0x23')]});if(_0x143e61){_0x1b061b[_0xfa3f('0x24')]=_0x1b061b[_0xfa3f('0x25')];_[_0xfa3f('0x26')](_0x143e61,_[_0xfa3f('0x27')](_0x1b061b,[_0xfa3f('0x28'),_0xfa3f('0x29'),_0xfa3f('0x23'),_0xfa3f('0x25')]));this[_0xfa3f('0x22')](util[_0xfa3f('0x2a')](_0xfa3f('0x2b'),_0x143e61[_0xfa3f('0x2c')]),'trunk:save',_0x143e61);}}}catch(_0x347f16){logger[_0xfa3f('0x1c')](_0xfa3f('0x2d'),util[_0xfa3f('0x1d')](_0x347f16,{'showHidden':![],'depth':null}));}};UserReport[_0xfa3f('0x1e')][_0xfa3f('0x12')]=function(_0x3d2ada){try{if(this[_0xfa3f('0x20')](_0x3d2ada)){if(this[_0xfa3f('0xb')][_0x3d2ada['device']]){if(!this[_0xfa3f('0xb')][_0x3d2ada[_0xfa3f('0x2e')]]['local']||_0x3d2ada[_0xfa3f('0x25')][_0xfa3f('0x2f')]()=='inuse'){this[_0xfa3f('0xb')][_0x3d2ada[_0xfa3f('0x2e')]]['local']=![];if(this[_0xfa3f('0xb')][_0x3d2ada[_0xfa3f('0x2e')]]['state']!==_0x3d2ada[_0xfa3f('0x25')]['toLowerCase']()){this[_0xfa3f('0xb')][_0x3d2ada['device']][_0xfa3f('0x30')]=_[_0xfa3f('0x31')](moment()['format']('x'));}this[_0xfa3f('0xb')][_0x3d2ada[_0xfa3f('0x2e')]][_0xfa3f('0x25')]=_0x3d2ada[_0xfa3f('0x25')][_0xfa3f('0x2f')]();this[_0xfa3f('0xb')][_0x3d2ada[_0xfa3f('0x2e')]]['updateStatusRealtime'](_0x3d2ada);}}else if(this['telephones'][_0x3d2ada['device']]){if(this[_0xfa3f('0xc')][_0x3d2ada[_0xfa3f('0x2e')]][_0xfa3f('0x25')]!==_0x3d2ada['state'][_0xfa3f('0x2f')]()){this[_0xfa3f('0xc')][_0x3d2ada[_0xfa3f('0x2e')]][_0xfa3f('0x30')]=_[_0xfa3f('0x31')](moment()[_0xfa3f('0x2a')]('x'));}this[_0xfa3f('0xc')][_0x3d2ada[_0xfa3f('0x2e')]][_0xfa3f('0x25')]=_0x3d2ada[_0xfa3f('0x25')][_0xfa3f('0x2f')]();this[_0xfa3f('0x22')](util[_0xfa3f('0x2a')](_0xfa3f('0x32'),this[_0xfa3f('0xc')][_0x3d2ada[_0xfa3f('0x2e')]]['name']),_0xfa3f('0x33'),this['telephones'][_0x3d2ada['device']]);}else if(this[_0xfa3f('0xa')][_0x3d2ada[_0xfa3f('0x2e')]]){if(this[_0xfa3f('0xa')][_0x3d2ada[_0xfa3f('0x2e')]][_0xfa3f('0x25')]!==_0x3d2ada[_0xfa3f('0x25')][_0xfa3f('0x2f')]()){this[_0xfa3f('0xa')][_0x3d2ada[_0xfa3f('0x2e')]][_0xfa3f('0x30')]=_['toNumber'](moment()[_0xfa3f('0x2a')]('x'));}this[_0xfa3f('0xa')][_0x3d2ada[_0xfa3f('0x2e')]]['state']=_0x3d2ada[_0xfa3f('0x25')][_0xfa3f('0x2f')]();this[_0xfa3f('0x22')](util[_0xfa3f('0x2a')](_0xfa3f('0x2b'),this[_0xfa3f('0xa')][_0x3d2ada[_0xfa3f('0x2e')]]['name']),_0xfa3f('0x34'),this[_0xfa3f('0xa')][_0x3d2ada[_0xfa3f('0x2e')]]);}else if(_['startsWith'](_0x3d2ada[_0xfa3f('0x2e')],'Queue')){}else if(_[_0xfa3f('0x35')](_0x3d2ada[_0xfa3f('0x2e')],_0xfa3f('0x36'))){var _0x23c9e5=_0x3d2ada[_0xfa3f('0x2e')];var _0x141066=_0x23c9e5['substring'](_0x23c9e5[_0xfa3f('0x37')]('/')+0x1,_0x23c9e5[_0xfa3f('0x37')]('@'));var _0x521aa2=_[_0xfa3f('0x38')](this['agents'],function(_0x1291f2){return _0x1291f2[_0xfa3f('0x39')]==_0x141066||_0x1291f2[_0xfa3f('0x3a')]==_0x141066||_0x1291f2[_0xfa3f('0x3b')]==_0x141066;});if(_0x521aa2){if(_0x521aa2[_0xfa3f('0x25')]!==_0x3d2ada[_0xfa3f('0x25')][_0xfa3f('0x2f')]()){_0x521aa2[_0xfa3f('0x30')]=_[_0xfa3f('0x31')](moment()[_0xfa3f('0x2a')]('x'));}_0x521aa2[_0xfa3f('0x25')]=_0x3d2ada[_0xfa3f('0x25')]['toLowerCase']();_0x521aa2['local']=!![];_0x521aa2['updateStatusRealtime'](_0x3d2ada);}}else{}}}catch(_0x4f8cc1){logger[_0xfa3f('0x1c')](_0xfa3f('0x3c'),util[_0xfa3f('0x1d')](_0x4f8cc1,{'showHidden':![],'depth':null}));}};UserReport[_0xfa3f('0x1e')]['syncPeerStatus']=function(_0x2bcd93){try{if(this[_0xfa3f('0x20')](_0x2bcd93)&&this['isNotNull'](_0x2bcd93[_0xfa3f('0x13')])){if(this['agents'][_0x2bcd93[_0xfa3f('0x3d')]]){if(!this['agents'][_0x2bcd93[_0xfa3f('0x3d')]][_0xfa3f('0x3e')]||_0x2bcd93[_0xfa3f('0x13')][_0xfa3f('0x2f')]()==_0xfa3f('0x3f')){this[_0xfa3f('0xb')][_0x2bcd93[_0xfa3f('0x3d')]][_0xfa3f('0x3e')]=![];this['agents'][_0x2bcd93[_0xfa3f('0x3d')]]['status']=_0x2bcd93[_0xfa3f('0x13')][_0xfa3f('0x2f')]();this[_0xfa3f('0xb')][_0x2bcd93[_0xfa3f('0x3d')]][_0xfa3f('0x40')]=_0x2bcd93[_0xfa3f('0x40')];this[_0xfa3f('0xb')][_0x2bcd93[_0xfa3f('0x3d')]][_0xfa3f('0x41')](_0x2bcd93);}}else if(this[_0xfa3f('0xc')][_0x2bcd93[_0xfa3f('0x3d')]]){this[_0xfa3f('0xc')][_0x2bcd93[_0xfa3f('0x3d')]][_0xfa3f('0x42')]=_0x2bcd93[_0xfa3f('0x13')][_0xfa3f('0x2f')]();this['telephones'][_0x2bcd93[_0xfa3f('0x3d')]][_0xfa3f('0x40')]=_0x2bcd93[_0xfa3f('0x40')];this[_0xfa3f('0x22')](util['format'](_0xfa3f('0x32'),this[_0xfa3f('0xc')][_0x2bcd93['peer']][_0xfa3f('0x2c')]),_0xfa3f('0x33'),this[_0xfa3f('0xc')][_0x2bcd93[_0xfa3f('0x3d')]]);}else if(this[_0xfa3f('0xa')][_0x2bcd93['peer']]){this['trunks'][_0x2bcd93[_0xfa3f('0x3d')]][_0xfa3f('0x42')]=_0x2bcd93[_0xfa3f('0x13')][_0xfa3f('0x2f')]();this[_0xfa3f('0xa')][_0x2bcd93[_0xfa3f('0x3d')]][_0xfa3f('0x40')]=_0x2bcd93[_0xfa3f('0x40')];this[_0xfa3f('0x22')](util[_0xfa3f('0x2a')]('trunk:%s',this['trunks'][_0x2bcd93['peer']][_0xfa3f('0x2c')]),_0xfa3f('0x34'),this[_0xfa3f('0xa')][_0x2bcd93[_0xfa3f('0x3d')]]);}else{}}}catch(_0x4ecd5e){logger[_0xfa3f('0x1c')](_0xfa3f('0x43'),util[_0xfa3f('0x1d')](_0x4ecd5e,{'showHidden':![],'depth':null}));}};module[_0xfa3f('0x44')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 11948d3..32eb288 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 _0x7576=['emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','called','variables','type','inbound','merge','omit','event','custom:agentcalled','membername','user:called','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','lastevent','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','queue','destconnectedlinenum','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','agentringnoanswerAt','rejected','custom:agentringnoanswer','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentconnectAt','complete','talktime','transfer','acw','acwtime','acwTimeout','user:%s','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','agentcompleteAt','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','exports','lodash','moment','util','../../../config/environment','../ami','redis','localhost','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype'];(function(_0x1f1731,_0x4b77eb){var _0x1f7625=function(_0x3a7550){while(--_0x3a7550){_0x1f1731['push'](_0x1f1731['shift']());}};_0x1f7625(++_0x4b77eb);}(_0x7576,0x1d5));var _0x6757=function(_0x5897cc,_0x8fe30a){_0x5897cc=_0x5897cc-0x0;var _0x41d727=_0x7576[_0x5897cc];return _0x41d727;};'use strict';var _=require(_0x6757('0x0'));var moment=require(_0x6757('0x1'));var util=require(_0x6757('0x2'));var Redis=require('ioredis');var config=require(_0x6757('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x6757('0x4'));config[_0x6757('0x5')]=_['defaults'](config['redis'],{'host':_0x6757('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x4305f8){this[_0x6757('0x7')]={};this[_0x6757('0x8')]=_0x4305f8[_0x6757('0x8')];this[_0x6757('0x9')]=_0x4305f8[_0x6757('0x9')];this['variables']={};ami['on'](_0x6757('0xa'),this[_0x6757('0xb')][_0x6757('0xc')](this));ami['on'](_0x6757('0xd'),this[_0x6757('0xe')]['bind'](this));ami['on'](_0x6757('0xf'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x6757('0x10'),this[_0x6757('0x11')][_0x6757('0xc')](this));ami['on'](_0x6757('0x12'),this[_0x6757('0x13')][_0x6757('0xc')](this));ami['on']('varset',this[_0x6757('0x14')][_0x6757('0xc')](this));ami['on'](_0x6757('0x15'),this[_0x6757('0x16')][_0x6757('0xc')](this));ami['on'](_0x6757('0x17'),this[_0x6757('0x18')]['bind'](this));ami['on'](_0x6757('0x19'),this[_0x6757('0x1a')][_0x6757('0xc')](this));ami['on'](_0x6757('0x1b'),this[_0x6757('0x1c')]['bind'](this));ami['on'](_0x6757('0x1d'),this['syncBlindTransfer'][_0x6757('0xc')](this));}VoiceAgentReport[_0x6757('0x1e')][_0x6757('0x1f')]=function(_0x486d21,_0x495476,_0x39ecec){io['to'](_0x486d21)[_0x6757('0x1f')](_0x495476,_0x39ecec);};VoiceAgentReport[_0x6757('0x1e')]['isNotNull']=function(_0x1a9602){return _0x1a9602!==null&&!_['isUndefined'](_0x1a9602);};VoiceAgentReport[_0x6757('0x1e')][_0x6757('0xb')]=function(_0x34a74f){try{if(this[_0x6757('0x20')](_0x34a74f)){if(_[_0x6757('0x21')](this['channels'][_0x34a74f[_0x6757('0x22')]])){this[_0x6757('0x7')][_0x34a74f[_0x6757('0x22')]]={};}if(_[_0x6757('0x21')](this['channels'][_0x34a74f['uniqueid']][_0x34a74f[_0x6757('0x23')]])){this['channels'][_0x34a74f[_0x6757('0x22')]][_0x34a74f[_0x6757('0x23')]]={'agentcalledAt':moment()[_0x6757('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x6757('0x25'),'variables':this[_0x6757('0x26')][_0x34a74f[_0x6757('0x22')]],'type':this[_0x6757('0x8')][_0x34a74f['queue']]?this[_0x6757('0x8')][_0x34a74f['queue']][_0x6757('0x27')]||_0x6757('0x28'):_0x6757('0x28')};}_[_0x6757('0x29')](this[_0x6757('0x7')][_0x34a74f[_0x6757('0x22')]][_0x34a74f[_0x6757('0x23')]],_[_0x6757('0x2a')](_0x34a74f,[_0x6757('0x2b'),'privilege']));ami[_0x6757('0x1f')](_0x6757('0x2c'),this[_0x6757('0x7')][_0x34a74f[_0x6757('0x22')]][_0x34a74f[_0x6757('0x23')]]);this['emit'](util[_0x6757('0x24')]('user:%s',_0x34a74f[_0x6757('0x2d')]),_0x6757('0x2e'),this[_0x6757('0x7')][_0x34a74f['uniqueid']][_0x34a74f['destuniqueid']]);}}catch(_0x50309e){logger['error'](_0x6757('0x2f'),util[_0x6757('0x30')](_0x50309e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6757('0x1e')][_0x6757('0xe')]=function(_0x2f4a09){try{if(this[_0x6757('0x20')](_0x2f4a09)){if(this[_0x6757('0x7')][_0x2f4a09['uniqueid']]){for(var _0x82f79e in this[_0x6757('0x7')][_0x2f4a09['uniqueid']]){if(this[_0x6757('0x7')][_0x2f4a09['uniqueid']][_0x6757('0x31')](_0x82f79e)){if(_0x2f4a09[_0x6757('0x23')]===_0x82f79e){this['channels'][_0x2f4a09['uniqueid']][_0x82f79e]['agentconnectAt']=moment()['format'](_0x6757('0x32'));this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0x33')]='connect';this['channels'][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0x34')]=_0x2f4a09[_0x6757('0x34')];this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0x35')]=_0x2f4a09['connectedlinenum'];this['channels'][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0x36')]=_0x2f4a09[_0x6757('0x36')];this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e]['destchannelstate']=_0x2f4a09[_0x6757('0x37')];this[_0x6757('0x7')][_0x2f4a09['uniqueid']][_0x82f79e]['destchannelstatedesc']=_0x2f4a09[_0x6757('0x38')];_[_0x6757('0x29')](this['agents'][_0x2f4a09[_0x6757('0x39')]],_[_0x6757('0x3a')](_0x2f4a09,[_0x6757('0x3b'),_0x6757('0x3c')]));this[_0x6757('0x1f')](util[_0x6757('0x24')]('user:%s',_0x2f4a09[_0x6757('0x2d')]),_0x6757('0x3d'),this['channels'][_0x2f4a09[_0x6757('0x22')]][_0x2f4a09[_0x6757('0x23')]]);ami['emit'](_0x6757('0x3e'),this[_0x6757('0x7')][_0x2f4a09['uniqueid']][_0x82f79e]);}else if(!this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0xf')]&&!this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0x12')]){this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e]['agentringnoanswer']=!![];this[_0x6757('0x7')][_0x2f4a09['uniqueid']][_0x82f79e]['agentringnoanswerAt']=moment()[_0x6757('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0x3f')]=_0x6757('0x40');this['channels'][_0x2f4a09['uniqueid']][_0x82f79e][_0x6757('0x33')]=_0x6757('0x40');this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0x41')]=_0x2f4a09[_0x6757('0x23')];this[_0x6757('0x7')][_0x2f4a09[_0x6757('0x22')]][_0x82f79e][_0x6757('0x42')]=_0x2f4a09[_0x6757('0x2d')];ami['emit'](_0x6757('0x43'),this['channels'][_0x2f4a09[_0x6757('0x22')]][_0x82f79e]);}}}}}}catch(_0xe5a9f1){logger[_0x6757('0x44')](_0x6757('0x45'),util[_0x6757('0x30')](_0xe5a9f1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6757('0x46')]=function(_0x2dd919){try{if(this['isNotNull'](_0x2dd919)){if(this['channels'][_0x2dd919['uniqueid']]&&this[_0x6757('0x7')][_0x2dd919[_0x6757('0x22')]][_0x2dd919[_0x6757('0x23')]]){this['channels'][_0x2dd919[_0x6757('0x22')]][_0x2dd919[_0x6757('0x23')]][_0x6757('0xf')]=!![];this[_0x6757('0x7')][_0x2dd919[_0x6757('0x22')]][_0x2dd919[_0x6757('0x23')]][_0x6757('0x47')]=moment()[_0x6757('0x24')](_0x6757('0x32'));this[_0x6757('0x7')][_0x2dd919['uniqueid']][_0x2dd919[_0x6757('0x23')]]['reason']=_0x6757('0x48');this['channels'][_0x2dd919['uniqueid']][_0x2dd919[_0x6757('0x23')]][_0x6757('0x33')]='rejected';ami[_0x6757('0x1f')](_0x6757('0x49'),this['channels'][_0x2dd919[_0x6757('0x22')]][_0x2dd919[_0x6757('0x23')]]);}}}catch(_0x4d5d12){logger[_0x6757('0x44')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x6757('0x30')](_0x4d5d12,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6757('0x1e')][_0x6757('0x11')]=function(_0x221345){try{if(this[_0x6757('0x20')](_0x221345)){if(this[_0x6757('0x7')][_0x221345[_0x6757('0x22')]]){for(var _0x47154 in this['channels'][_0x221345[_0x6757('0x22')]]){if(this[_0x6757('0x7')][_0x221345['uniqueid']][_0x6757('0x31')](_0x47154)&&!this[_0x6757('0x7')][_0x221345['uniqueid']][_0x47154][_0x6757('0xf')]&&!this[_0x6757('0x7')][_0x221345['uniqueid']][_0x47154]['agentcomplete']){this[_0x6757('0x7')][_0x221345[_0x6757('0x22')]][_0x47154][_0x6757('0xf')]=!![];this['channels'][_0x221345[_0x6757('0x22')]][_0x47154][_0x6757('0x47')]=moment()[_0x6757('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x221345['uniqueid']][_0x47154]['reason']=_0x6757('0x4a');this['channels'][_0x221345[_0x6757('0x22')]][_0x47154][_0x6757('0x33')]=_0x6757('0x4a');ami[_0x6757('0x1f')](_0x6757('0x4b'),this['channels'][_0x221345[_0x6757('0x22')]][_0x47154]);}}}}}catch(_0x3e1546){logger['error'](_0x6757('0x4c'),util[_0x6757('0x30')](_0x3e1546,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6757('0x1e')][_0x6757('0x13')]=function(_0x36e051){try{if(this[_0x6757('0x20')](_0x36e051)){if(this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]]){for(var _0x31b974 in this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]]){if(this['channels'][_0x36e051[_0x6757('0x22')]][_0x6757('0x31')](_0x31b974)){if(this[_0x6757('0x7')][_0x36e051['uniqueid']][_0x31b974][_0x6757('0x4d')]&&!this[_0x6757('0x7')][_0x36e051['uniqueid']][_0x31b974]['agentcomplete']){this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]][_0x31b974][_0x6757('0x12')]=!![];this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]][_0x31b974]['agentcompleteAt']=moment()[_0x6757('0x24')](_0x6757('0x32'));this['channels'][_0x36e051[_0x6757('0x22')]][_0x31b974][_0x6757('0x33')]=_0x6757('0x4e');this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]][_0x31b974]['talktime']=_0x36e051[_0x6757('0x4f')];this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]][_0x31b974]['reason']=_0x36e051['reason']==_0x6757('0x50')?'agent':_0x36e051[_0x6757('0x3f')];if(this[_0x6757('0x8')][_0x36e051[_0x6757('0x3b')]]&&this[_0x6757('0x8')][_0x36e051[_0x6757('0x3b')]][_0x6757('0x51')]){this[_0x6757('0x7')][_0x36e051['uniqueid']][_0x31b974]['agentacw']=!![];this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]][_0x31b974][_0x6757('0x52')]=this['voiceQueues'][_0x36e051['queue']][_0x6757('0x53')];}this[_0x6757('0x9')][_0x36e051['interface']]=_[_0x6757('0x2a')](this[_0x6757('0x9')][_0x36e051['interface']],[_0x6757('0x3b'),'destconnectedlinenum']);this['emit'](util[_0x6757('0x24')](_0x6757('0x54'),_0x36e051[_0x6757('0x2d')]),_0x6757('0x55'),this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]][_0x31b974]);ami[_0x6757('0x1f')](_0x6757('0x56'),this[_0x6757('0x7')][_0x36e051[_0x6757('0x22')]][_0x31b974]);}}}}}}catch(_0xb4533e){logger[_0x6757('0x44')](_0x6757('0x57'),util['inspect'](_0xb4533e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6757('0x1e')][_0x6757('0x14')]=function(_0x3f49a7){try{if(this[_0x6757('0x20')](_0x3f49a7)){this[_0x6757('0x58')](_0x3f49a7[_0x6757('0x22')],_[_0x6757('0x59')](_0x3f49a7[_0x6757('0x5a')])[0x0],_0x3f49a7[_0x6757('0x5b')]);if(this['channels'][_0x3f49a7[_0x6757('0x22')]]){for(var _0x2ddcb1 in this[_0x6757('0x7')][_0x3f49a7['uniqueid']]){if(this['channels'][_0x3f49a7[_0x6757('0x22')]]['hasOwnProperty'](_0x2ddcb1)){if(_['isUndefined'](this[_0x6757('0x7')][_0x3f49a7[_0x6757('0x22')]][_0x2ddcb1][_0x6757('0x26')])){this[_0x6757('0x7')][_0x3f49a7[_0x6757('0x22')]][_0x2ddcb1][_0x6757('0x26')]={};}this[_0x6757('0x7')][_0x3f49a7[_0x6757('0x22')]][_0x2ddcb1][_0x6757('0x26')]=this[_0x6757('0x26')][_0x3f49a7[_0x6757('0x22')]];}}}}}catch(_0x1be217){logger[_0x6757('0x44')](_0x6757('0x5c'),util[_0x6757('0x30')](_0x1be217,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6757('0x1e')][_0x6757('0x58')]=function(_0x355eb6,_0x243dd2,_0x33ac1b){var _0xb47972=[_0x6757('0x5d'),_0x6757('0x5e'),'rtpaudioqosjitter',_0x6757('0x5f'),_0x6757('0x60'),_0x6757('0x61'),'rtpaudioqosrtt',_0x6757('0x62'),'sipcallid',_0x6757('0x63'),_0x6757('0x64'),_0x6757('0x65'),_0x6757('0x66'),'memberdynamic',_0x6757('0x67'),_0x6757('0x68'),_0x6757('0x2d'),_0x6757('0x69'),_0x6757('0x6a')];if(!_[_0x6757('0x6b')](_0x243dd2)&&!_[_0x6757('0x6c')](_0xb47972,_0x243dd2)){if(_['isUndefined'](this[_0x6757('0x26')][_0x355eb6])){this[_0x6757('0x26')][_0x355eb6]={};}this[_0x6757('0x26')][_0x355eb6][_0x243dd2]=_0x33ac1b;}};VoiceAgentReport['prototype'][_0x6757('0x16')]=function(_0xb34354){try{if(this[_0x6757('0x20')](_0xb34354)){if(this['channels'][_0xb34354['uniqueid']]){for(var _0x5732fb in this['channels'][_0xb34354[_0x6757('0x22')]]){if(this['channels'][_0xb34354['uniqueid']][_0x6757('0x31')](_0x5732fb)){if(this[_0x6757('0x7')][_0xb34354[_0x6757('0x22')]][_0x5732fb][_0x6757('0x3f')]==_0x6757('0x50')&&this['channels'][_0xb34354['uniqueid']][_0x5732fb][_0x6757('0x12')]){this[_0x6757('0x7')][_0xb34354[_0x6757('0x22')]][_0x5732fb][_0x6757('0x6d')]=moment()[_0x6757('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0x6757('0x1f')](_0x6757('0x6e'),_[_0x6757('0x6f')](this['channels'][_0xb34354[_0x6757('0x22')]]));delete this[_0x6757('0x7')][_0xb34354[_0x6757('0x22')]];}if(this[_0x6757('0x26')][_0xb34354['uniqueid']]){delete this[_0x6757('0x26')][_0xb34354[_0x6757('0x22')]];}}}catch(_0x302a03){logger['error'](_0x6757('0x70'),util[_0x6757('0x30')](_0x302a03,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6757('0x1c')]=function(_0x5836a7){try{if(this[_0x6757('0x20')](_0x5836a7)){if(this[_0x6757('0x7')][_0x5836a7[_0x6757('0x71')]]){for(var _0x387a64 in this['channels'][_0x5836a7['transfereeuniqueid']]){if(this['channels'][_0x5836a7[_0x6757('0x71')]][_0x6757('0x31')](_0x387a64)){if(_0x5836a7['origtransfereruniqueid']===_0x387a64){var _0x1c6465=moment();this['channels'][_0x5836a7[_0x6757('0x71')]][_0x387a64][_0x6757('0x12')]=!![];this[_0x6757('0x7')][_0x5836a7[_0x6757('0x71')]][_0x387a64][_0x6757('0x6d')]=moment()[_0x6757('0x24')](_0x6757('0x32'));this['channels'][_0x5836a7[_0x6757('0x71')]][_0x387a64]['reason']='transfer';this[_0x6757('0x7')][_0x5836a7[_0x6757('0x71')]][_0x387a64][_0x6757('0x33')]='complete';this[_0x6757('0x7')][_0x5836a7['transfereeuniqueid']][_0x387a64]['talktime']=_0x1c6465[_0x6757('0x72')](this[_0x6757('0x7')][_0x5836a7['transfereeuniqueid']][_0x387a64][_0x6757('0x4d')],_0x6757('0x73'));}}}}if(this[_0x6757('0x7')][_0x5836a7[_0x6757('0x74')]]){var _0x158b72=this[_0x6757('0x7')][_0x5836a7[_0x6757('0x74')]];this['channels'][_0x5836a7[_0x6757('0x74')]]=this[_0x6757('0x7')][_0x5836a7[_0x6757('0x71')]];this[_0x6757('0x7')][_0x5836a7[_0x6757('0x71')]]=_0x158b72;}}}catch(_0x259bcd){logger[_0x6757('0x44')](_0x6757('0x75'),util['inspect'](_0x259bcd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6757('0x1e')][_0x6757('0x76')]=function(_0x25003a){try{if(this['isNotNull'](_0x25003a)){if(this[_0x6757('0x7')][_0x25003a[_0x6757('0x71')]]){for(var _0x41a7ff in this[_0x6757('0x7')][_0x25003a[_0x6757('0x71')]]){if(this[_0x6757('0x7')][_0x25003a[_0x6757('0x71')]][_0x6757('0x31')](_0x41a7ff)){if(_0x25003a['transfereruniqueid']===_0x41a7ff){var _0x453737=moment();this[_0x6757('0x7')][_0x25003a[_0x6757('0x71')]][_0x41a7ff][_0x6757('0x12')]=!![];this[_0x6757('0x7')][_0x25003a[_0x6757('0x71')]][_0x41a7ff]['agentcompleteAt']=_0x453737;this[_0x6757('0x7')][_0x25003a['transfereeuniqueid']][_0x41a7ff][_0x6757('0x3f')]=_0x6757('0x50');this['channels'][_0x25003a[_0x6757('0x71')]][_0x41a7ff][_0x6757('0x33')]=_0x6757('0x4e');this[_0x6757('0x7')][_0x25003a[_0x6757('0x71')]][_0x41a7ff][_0x6757('0x4f')]=_0x453737[_0x6757('0x72')](this[_0x6757('0x7')][_0x25003a[_0x6757('0x71')]][_0x41a7ff]['agentconnectAt'],'seconds');}}}}}}catch(_0xdb322a){logger[_0x6757('0x44')](_0x6757('0x77'),util[_0x6757('0x30')](_0xdb322a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6757('0x1e')]['syncMusicOnHoldStart']=function(_0x139b66){var _0x584541='';try{if(this[_0x6757('0x20')](_0x139b66)){if(_0x139b66[_0x6757('0x78')]){_0x584541=_0x139b66[_0x6757('0x78')][_0x6757('0x79')](0x0,_0x139b66['channel'][_0x6757('0x7a')]('-'));if(this[_0x6757('0x9')][_0x584541]){this['agents'][_0x584541][_0x6757('0x7b')]=!![];}}}}catch(_0xdfa0cb){logger[_0x6757('0x44')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0x6757('0x30')](_0xdfa0cb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6757('0x1a')]=function(_0x472ec8){var _0xdf4e97='';try{if(this[_0x6757('0x20')](_0x472ec8)){if(_0x472ec8[_0x6757('0x78')]){_0xdf4e97=_0x472ec8[_0x6757('0x78')][_0x6757('0x79')](0x0,_0x472ec8[_0x6757('0x78')][_0x6757('0x7a')]('-'));if(this[_0x6757('0x9')][_0xdf4e97]){this['agents'][_0xdf4e97][_0x6757('0x7b')]=![];}}}}catch(_0x407515){logger[_0x6757('0x44')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x6757('0x30')](_0x407515,{'showHidden':![],'depth':null}));}};module[_0x6757('0x7c')]=VoiceAgentReport; \ No newline at end of file +var _0xc335=['musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','format','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connectedlinenum','connectedlinename','destchannelstatedesc','agents','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswer','agentcomplete','agentringnoanswerAt','reason','answered_elsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','acw','agentacw','acwTimeout','user:%s','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','diff','seconds','[syncBlindTransfer][VoiceAgentReport]','syncMusicOnHoldStart','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','substring','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','ioredis','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','variables','agentcalled','bind','syncAgentRingNoAnswer','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0xc335,0x1d0));var _0x5c33=function(_0x134f43,_0xa76cbb){_0x134f43=_0x134f43-0x0;var _0x1c2c6f=_0xc335[_0x134f43];return _0x1c2c6f;};'use strict';var _=require(_0x5c33('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x5c33('0x1'));var config=require('../../../config/environment');var logger=require(_0x5c33('0x2'))('ami');var ami=require(_0x5c33('0x3'));config[_0x5c33('0x4')]=_[_0x5c33('0x5')](config['redis'],{'host':_0x5c33('0x6'),'port':0x18eb});var io=require(_0x5c33('0x7'))(new Redis(config[_0x5c33('0x4')]));function VoiceAgentReport(_0x573789){this[_0x5c33('0x8')]={};this[_0x5c33('0x9')]=_0x573789[_0x5c33('0x9')];this['agents']=_0x573789['agents'];this[_0x5c33('0xa')]={};ami['on'](_0x5c33('0xb'),this['syncAgentCalled'][_0x5c33('0xc')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x5c33('0xc')](this));ami['on']('agentringnoanswer',this[_0x5c33('0xd')][_0x5c33('0xc')](this));ami['on']('queuecallerabandon',this[_0x5c33('0xe')][_0x5c33('0xc')](this));ami['on']('agentcomplete',this[_0x5c33('0xf')][_0x5c33('0xc')](this));ami['on'](_0x5c33('0x10'),this[_0x5c33('0x11')][_0x5c33('0xc')](this));ami['on']('hangup',this[_0x5c33('0x12')][_0x5c33('0xc')](this));ami['on'](_0x5c33('0x13'),this['syncMusicOnHoldStart'][_0x5c33('0xc')](this));ami['on'](_0x5c33('0x14'),this[_0x5c33('0x15')][_0x5c33('0xc')](this));ami['on'](_0x5c33('0x16'),this[_0x5c33('0x17')][_0x5c33('0xc')](this));ami['on']('blindtransfer',this[_0x5c33('0x18')]['bind'](this));}VoiceAgentReport[_0x5c33('0x19')][_0x5c33('0x1a')]=function(_0x554d6b,_0x31fb3e,_0x17e06c){io['to'](_0x554d6b)[_0x5c33('0x1a')](_0x31fb3e,_0x17e06c);};VoiceAgentReport['prototype'][_0x5c33('0x1b')]=function(_0x50b369){return _0x50b369!==null&&!_[_0x5c33('0x1c')](_0x50b369);};VoiceAgentReport[_0x5c33('0x19')][_0x5c33('0x1d')]=function(_0x1bdb9c){try{if(this[_0x5c33('0x1b')](_0x1bdb9c)){if(_['isUndefined'](this[_0x5c33('0x8')][_0x1bdb9c[_0x5c33('0x1e')]])){this['channels'][_0x1bdb9c[_0x5c33('0x1e')]]={};}if(_[_0x5c33('0x1c')](this['channels'][_0x1bdb9c[_0x5c33('0x1e')]][_0x1bdb9c['destuniqueid']])){this[_0x5c33('0x8')][_0x1bdb9c[_0x5c33('0x1e')]][_0x1bdb9c[_0x5c33('0x1f')]]={'agentcalledAt':moment()['format'](_0x5c33('0x20')),'lastevent':_0x5c33('0x21'),'variables':this['variables'][_0x1bdb9c[_0x5c33('0x1e')]],'type':this[_0x5c33('0x9')][_0x1bdb9c[_0x5c33('0x22')]]?this[_0x5c33('0x9')][_0x1bdb9c[_0x5c33('0x22')]][_0x5c33('0x23')]||_0x5c33('0x24'):_0x5c33('0x24')};}_[_0x5c33('0x25')](this[_0x5c33('0x8')][_0x1bdb9c[_0x5c33('0x1e')]][_0x1bdb9c[_0x5c33('0x1f')]],_[_0x5c33('0x26')](_0x1bdb9c,[_0x5c33('0x27'),_0x5c33('0x28')]));ami[_0x5c33('0x1a')](_0x5c33('0x29'),this[_0x5c33('0x8')][_0x1bdb9c[_0x5c33('0x1e')]][_0x1bdb9c[_0x5c33('0x1f')]]);this[_0x5c33('0x1a')](util[_0x5c33('0x2a')]('user:%s',_0x1bdb9c[_0x5c33('0x2b')]),_0x5c33('0x2c'),this[_0x5c33('0x8')][_0x1bdb9c[_0x5c33('0x1e')]][_0x1bdb9c[_0x5c33('0x1f')]]);}}catch(_0x2640a5){logger[_0x5c33('0x2d')](_0x5c33('0x2e'),util[_0x5c33('0x2f')](_0x2640a5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x3f51ef){try{if(this[_0x5c33('0x1b')](_0x3f51ef)){if(this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]]){for(var _0x1b2918 in this[_0x5c33('0x8')][_0x3f51ef['uniqueid']]){if(this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x5c33('0x30')](_0x1b2918)){if(_0x3f51ef[_0x5c33('0x1f')]===_0x1b2918){this[_0x5c33('0x8')][_0x3f51ef['uniqueid']][_0x1b2918][_0x5c33('0x31')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5c33('0x8')][_0x3f51ef['uniqueid']][_0x1b2918][_0x5c33('0x32')]='connect';this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918]['holdtime']=_0x3f51ef['holdtime'];this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918]['connectedlinenum']=_0x3f51ef[_0x5c33('0x33')];this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918][_0x5c33('0x34')]=_0x3f51ef[_0x5c33('0x34')];this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918]['destchannelstate']=_0x3f51ef['destchannelstate'];this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918][_0x5c33('0x35')]=_0x3f51ef[_0x5c33('0x35')];_[_0x5c33('0x25')](this[_0x5c33('0x36')][_0x3f51ef[_0x5c33('0x37')]],_[_0x5c33('0x38')](_0x3f51ef,[_0x5c33('0x22'),_0x5c33('0x39')]));this['emit'](util[_0x5c33('0x2a')]('user:%s',_0x3f51ef[_0x5c33('0x2b')]),_0x5c33('0x3a'),this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x3f51ef[_0x5c33('0x1f')]]);ami[_0x5c33('0x1a')](_0x5c33('0x3b'),this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918]);}else if(!this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918][_0x5c33('0x3c')]&&!this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918][_0x5c33('0x3d')]){this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918][_0x5c33('0x3c')]=!![];this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918][_0x5c33('0x3e')]=moment()[_0x5c33('0x2a')](_0x5c33('0x20'));this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918][_0x5c33('0x3f')]='answered_elsewhere';this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918][_0x5c33('0x32')]=_0x5c33('0x40');this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918]['answeredelsewheredestinationuniqueid']=_0x3f51ef['destuniqueid'];this[_0x5c33('0x8')][_0x3f51ef[_0x5c33('0x1e')]][_0x1b2918]['answeredelsewheremembername']=_0x3f51ef[_0x5c33('0x2b')];ami[_0x5c33('0x1a')]('custom:agentansweredelsewhere',this[_0x5c33('0x8')][_0x3f51ef['uniqueid']][_0x1b2918]);}}}}}}catch(_0x140c0a){logger[_0x5c33('0x2d')](_0x5c33('0x41'),util[_0x5c33('0x2f')](_0x140c0a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5c33('0x19')][_0x5c33('0xd')]=function(_0x226f4c){try{if(this[_0x5c33('0x1b')](_0x226f4c)){if(this['channels'][_0x226f4c[_0x5c33('0x1e')]]&&this[_0x5c33('0x8')][_0x226f4c[_0x5c33('0x1e')]][_0x226f4c[_0x5c33('0x1f')]]){this[_0x5c33('0x8')][_0x226f4c[_0x5c33('0x1e')]][_0x226f4c['destuniqueid']]['agentringnoanswer']=!![];this['channels'][_0x226f4c[_0x5c33('0x1e')]][_0x226f4c[_0x5c33('0x1f')]]['agentringnoanswerAt']=moment()['format'](_0x5c33('0x20'));this[_0x5c33('0x8')][_0x226f4c['uniqueid']][_0x226f4c['destuniqueid']]['reason']=_0x5c33('0x42');this['channels'][_0x226f4c[_0x5c33('0x1e')]][_0x226f4c[_0x5c33('0x1f')]][_0x5c33('0x32')]=_0x5c33('0x42');ami['emit'](_0x5c33('0x43'),this['channels'][_0x226f4c['uniqueid']][_0x226f4c[_0x5c33('0x1f')]]);}}}catch(_0x10dac1){logger[_0x5c33('0x2d')](_0x5c33('0x44'),util['inspect'](_0x10dac1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5c33('0x19')][_0x5c33('0xe')]=function(_0x56508d){try{if(this[_0x5c33('0x1b')](_0x56508d)){if(this[_0x5c33('0x8')][_0x56508d[_0x5c33('0x1e')]]){for(var _0x189001 in this[_0x5c33('0x8')][_0x56508d[_0x5c33('0x1e')]]){if(this[_0x5c33('0x8')][_0x56508d[_0x5c33('0x1e')]][_0x5c33('0x30')](_0x189001)&&!this['channels'][_0x56508d['uniqueid']][_0x189001]['agentringnoanswer']&&!this[_0x5c33('0x8')][_0x56508d[_0x5c33('0x1e')]][_0x189001][_0x5c33('0x3d')]){this[_0x5c33('0x8')][_0x56508d[_0x5c33('0x1e')]][_0x189001][_0x5c33('0x3c')]=!![];this[_0x5c33('0x8')][_0x56508d[_0x5c33('0x1e')]][_0x189001][_0x5c33('0x3e')]=moment()[_0x5c33('0x2a')](_0x5c33('0x20'));this['channels'][_0x56508d[_0x5c33('0x1e')]][_0x189001]['reason']=_0x5c33('0x45');this[_0x5c33('0x8')][_0x56508d['uniqueid']][_0x189001][_0x5c33('0x32')]='abandoned';ami['emit'](_0x5c33('0x46'),this[_0x5c33('0x8')][_0x56508d[_0x5c33('0x1e')]][_0x189001]);}}}}}catch(_0xdbcd6e){logger['error'](_0x5c33('0x47'),util[_0x5c33('0x2f')](_0xdbcd6e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5c33('0xf')]=function(_0x4c7999){try{if(this[_0x5c33('0x1b')](_0x4c7999)){if(this['channels'][_0x4c7999[_0x5c33('0x1e')]]){for(var _0xfb9c62 in this['channels'][_0x4c7999['uniqueid']]){if(this['channels'][_0x4c7999[_0x5c33('0x1e')]][_0x5c33('0x30')](_0xfb9c62)){if(this[_0x5c33('0x8')][_0x4c7999['uniqueid']][_0xfb9c62][_0x5c33('0x31')]&&!this[_0x5c33('0x8')][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62][_0x5c33('0x3d')]){this[_0x5c33('0x8')][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62][_0x5c33('0x3d')]=!![];this[_0x5c33('0x8')][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62][_0x5c33('0x48')]=moment()[_0x5c33('0x2a')](_0x5c33('0x20'));this[_0x5c33('0x8')][_0x4c7999['uniqueid']][_0xfb9c62]['lastevent']=_0x5c33('0x49');this[_0x5c33('0x8')][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62][_0x5c33('0x4a')]=_0x4c7999[_0x5c33('0x4a')];this[_0x5c33('0x8')][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62][_0x5c33('0x3f')]=_0x4c7999[_0x5c33('0x3f')]==_0x5c33('0x4b')?'agent':_0x4c7999['reason'];if(this[_0x5c33('0x9')][_0x4c7999[_0x5c33('0x22')]]&&this['voiceQueues'][_0x4c7999[_0x5c33('0x22')]][_0x5c33('0x4c')]){this[_0x5c33('0x8')][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62][_0x5c33('0x4d')]=!![];this[_0x5c33('0x8')][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62]['acwtime']=this[_0x5c33('0x9')][_0x4c7999[_0x5c33('0x22')]][_0x5c33('0x4e')];}this[_0x5c33('0x36')][_0x4c7999['interface']]=_['omit'](this[_0x5c33('0x36')][_0x4c7999[_0x5c33('0x37')]],[_0x5c33('0x22'),_0x5c33('0x39')]);this[_0x5c33('0x1a')](util[_0x5c33('0x2a')](_0x5c33('0x4f'),_0x4c7999[_0x5c33('0x2b')]),'user:agentcomplete',this['channels'][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62]);ami[_0x5c33('0x1a')](_0x5c33('0x50'),this[_0x5c33('0x8')][_0x4c7999[_0x5c33('0x1e')]][_0xfb9c62]);}}}}}}catch(_0xaee815){logger[_0x5c33('0x2d')](_0x5c33('0x51'),util[_0x5c33('0x2f')](_0xaee815,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5c33('0x11')]=function(_0x427014){try{if(this[_0x5c33('0x1b')](_0x427014)){this[_0x5c33('0x52')](_0x427014['uniqueid'],_['keys'](_0x427014[_0x5c33('0x53')])[0x0],_0x427014['value']);if(this['channels'][_0x427014['uniqueid']]){for(var _0x24daec in this[_0x5c33('0x8')][_0x427014[_0x5c33('0x1e')]]){if(this['channels'][_0x427014[_0x5c33('0x1e')]]['hasOwnProperty'](_0x24daec)){if(_[_0x5c33('0x1c')](this[_0x5c33('0x8')][_0x427014[_0x5c33('0x1e')]][_0x24daec][_0x5c33('0xa')])){this[_0x5c33('0x8')][_0x427014[_0x5c33('0x1e')]][_0x24daec][_0x5c33('0xa')]={};}this[_0x5c33('0x8')][_0x427014[_0x5c33('0x1e')]][_0x24daec][_0x5c33('0xa')]=this[_0x5c33('0xa')][_0x427014[_0x5c33('0x1e')]];}}}}}catch(_0x4d76ff){logger[_0x5c33('0x2d')](_0x5c33('0x54'),util[_0x5c33('0x2f')](_0x4d76ff,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5c33('0x52')]=function(_0x3ea5de,_0x5aa786,_0xc54c9f){var _0x26f181=[_0x5c33('0x55'),_0x5c33('0x56'),_0x5c33('0x57'),_0x5c33('0x58'),_0x5c33('0x59'),_0x5c33('0x5a'),_0x5c33('0x5b'),_0x5c33('0x5c'),_0x5c33('0x5d'),'sipuri',_0x5c33('0x5e'),_0x5c33('0x5f'),_0x5c33('0x60'),_0x5c33('0x61'),_0x5c33('0x62'),'memberlastcall',_0x5c33('0x2b'),_0x5c33('0x63'),_0x5c33('0x64')];if(!_[_0x5c33('0x65')](_0x5aa786)&&!_['includes'](_0x26f181,_0x5aa786)){if(_[_0x5c33('0x1c')](this[_0x5c33('0xa')][_0x3ea5de])){this['variables'][_0x3ea5de]={};}this['variables'][_0x3ea5de][_0x5aa786]=_0xc54c9f;}};VoiceAgentReport[_0x5c33('0x19')][_0x5c33('0x12')]=function(_0x16d6e5){try{if(this[_0x5c33('0x1b')](_0x16d6e5)){if(this[_0x5c33('0x8')][_0x16d6e5[_0x5c33('0x1e')]]){for(var _0x55398d in this[_0x5c33('0x8')][_0x16d6e5['uniqueid']]){if(this[_0x5c33('0x8')][_0x16d6e5[_0x5c33('0x1e')]][_0x5c33('0x30')](_0x55398d)){if(this[_0x5c33('0x8')][_0x16d6e5['uniqueid']][_0x55398d][_0x5c33('0x3f')]==_0x5c33('0x4b')&&this['channels'][_0x16d6e5['uniqueid']][_0x55398d][_0x5c33('0x3d')]){this['channels'][_0x16d6e5['uniqueid']][_0x55398d][_0x5c33('0x48')]=moment()[_0x5c33('0x2a')](_0x5c33('0x20'));}}}ami['emit'](_0x5c33('0x66'),_[_0x5c33('0x67')](this[_0x5c33('0x8')][_0x16d6e5[_0x5c33('0x1e')]]));delete this['channels'][_0x16d6e5[_0x5c33('0x1e')]];}if(this[_0x5c33('0xa')][_0x16d6e5[_0x5c33('0x1e')]]){delete this[_0x5c33('0xa')][_0x16d6e5[_0x5c33('0x1e')]];}}}catch(_0x392b7d){logger[_0x5c33('0x2d')](_0x5c33('0x68'),util[_0x5c33('0x2f')](_0x392b7d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5c33('0x19')][_0x5c33('0x17')]=function(_0x574ac1){try{if(this['isNotNull'](_0x574ac1)){if(this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x69')]]){for(var _0x1d3789 in this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x69')]]){if(this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x69')]][_0x5c33('0x30')](_0x1d3789)){if(_0x574ac1[_0x5c33('0x6a')]===_0x1d3789){var _0x2ffa6f=moment();this[_0x5c33('0x8')][_0x574ac1['transfereeuniqueid']][_0x1d3789][_0x5c33('0x3d')]=!![];this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x69')]][_0x1d3789]['agentcompleteAt']=moment()[_0x5c33('0x2a')](_0x5c33('0x20'));this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x69')]][_0x1d3789][_0x5c33('0x3f')]=_0x5c33('0x4b');this[_0x5c33('0x8')][_0x574ac1['transfereeuniqueid']][_0x1d3789][_0x5c33('0x32')]=_0x5c33('0x49');this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x69')]][_0x1d3789][_0x5c33('0x4a')]=_0x2ffa6f['diff'](this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x69')]][_0x1d3789][_0x5c33('0x31')],'seconds');}}}}if(this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x6b')]]){var _0x3311b5=this['channels'][_0x574ac1[_0x5c33('0x6b')]];this['channels'][_0x574ac1['secondtransfereruniqueid']]=this[_0x5c33('0x8')][_0x574ac1['transfereeuniqueid']];this[_0x5c33('0x8')][_0x574ac1[_0x5c33('0x69')]]=_0x3311b5;}}}catch(_0x162f8b){logger[_0x5c33('0x2d')](_0x5c33('0x6c'),util[_0x5c33('0x2f')](_0x162f8b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5c33('0x18')]=function(_0x150fb5){try{if(this[_0x5c33('0x1b')](_0x150fb5)){if(this['channels'][_0x150fb5[_0x5c33('0x69')]]){for(var _0x444b97 in this[_0x5c33('0x8')][_0x150fb5['transfereeuniqueid']]){if(this[_0x5c33('0x8')][_0x150fb5[_0x5c33('0x69')]]['hasOwnProperty'](_0x444b97)){if(_0x150fb5[_0x5c33('0x6d')]===_0x444b97){var _0x69650e=moment();this[_0x5c33('0x8')][_0x150fb5['transfereeuniqueid']][_0x444b97][_0x5c33('0x3d')]=!![];this['channels'][_0x150fb5[_0x5c33('0x69')]][_0x444b97]['agentcompleteAt']=_0x69650e;this['channels'][_0x150fb5[_0x5c33('0x69')]][_0x444b97][_0x5c33('0x3f')]=_0x5c33('0x4b');this[_0x5c33('0x8')][_0x150fb5[_0x5c33('0x69')]][_0x444b97][_0x5c33('0x32')]=_0x5c33('0x49');this[_0x5c33('0x8')][_0x150fb5['transfereeuniqueid']][_0x444b97][_0x5c33('0x4a')]=_0x69650e[_0x5c33('0x6e')](this[_0x5c33('0x8')][_0x150fb5[_0x5c33('0x69')]][_0x444b97][_0x5c33('0x31')],_0x5c33('0x6f'));}}}}}}catch(_0x100557){logger[_0x5c33('0x2d')](_0x5c33('0x70'),util[_0x5c33('0x2f')](_0x100557,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5c33('0x19')][_0x5c33('0x71')]=function(_0x1c10af){var _0x34569f='';try{if(this[_0x5c33('0x1b')](_0x1c10af)){if(_0x1c10af[_0x5c33('0x72')]){_0x34569f=_0x1c10af[_0x5c33('0x72')]['substring'](0x0,_0x1c10af['channel'][_0x5c33('0x73')]('-'));if(this[_0x5c33('0x36')][_0x34569f]){this[_0x5c33('0x36')][_0x34569f][_0x5c33('0x74')]=!![];}}}}catch(_0x53bd94){logger[_0x5c33('0x2d')](_0x5c33('0x75'),util[_0x5c33('0x2f')](_0x53bd94,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5c33('0x19')]['syncMusicOnHoldStop']=function(_0x34fb41){var _0x13373e='';try{if(this[_0x5c33('0x1b')](_0x34fb41)){if(_0x34fb41[_0x5c33('0x72')]){_0x13373e=_0x34fb41['channel'][_0x5c33('0x76')](0x0,_0x34fb41[_0x5c33('0x72')][_0x5c33('0x73')]('-'));if(this[_0x5c33('0x36')][_0x13373e]){this['agents'][_0x13373e][_0x5c33('0x74')]=![];}}}}catch(_0x1655e1){logger['error'](_0x5c33('0x77'),util[_0x5c33('0x2f')](_0x1655e1,{'showHidden':![],'depth':null}));}};module[_0x5c33('0x78')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index f5817b7..4bc717f 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 _0x3b2e=['agents','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','bind','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','isUndefined','emit','prototype','isNotNull','uniqueid','linkedid','merge','channels','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','destconnectedlinenum','exten','user:%s','split','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','starttime','duration','subtract','seconds','lastapplication','lastdata','startsWith','cdr(','[syncNewExten][VoiceCallReport]','answered','holdtime','calleridnum','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','syncMixMonitorFilename','monitor','.wav49','replace','find','monitors','isNil','push','rec','variable','value','xmd-callerid','xmd-cdrtype','type','xmd-queue','originatecalleridnum','xmd-destination','destination','calleridpreview','sipcallid','sipcalluniqueid','sipcalllinkedid','endtime','answertime','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','exports','lodash','moment','util','path','../../../config/logger','ami','../model/channel','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost'];(function(_0x39f89b,_0x3f8ab8){var _0x230d5b=function(_0xc9840f){while(--_0xc9840f){_0x39f89b['push'](_0x39f89b['shift']());}};_0x230d5b(++_0x3f8ab8);}(_0x3b2e,0x10a));var _0xe3b2=function(_0x4a05e7,_0x22f0df){_0x4a05e7=_0x4a05e7-0x0;var _0x126423=_0x3b2e[_0x4a05e7];return _0x126423;};'use strict';var BPromise=require('bluebird');var _=require(_0xe3b2('0x0'));var moment=require(_0xe3b2('0x1'));var util=require(_0xe3b2('0x2'));var path=require(_0xe3b2('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xe3b2('0x4'))(_0xe3b2('0x5'));var ami=require('../ami');var Channel=require(_0xe3b2('0x6'));var statusDesc=[_0xe3b2('0x7'),_0xe3b2('0x8'),_0xe3b2('0x9'),_0xe3b2('0xa'),'invalid',_0xe3b2('0xb'),_0xe3b2('0xc'),_0xe3b2('0xd'),_0xe3b2('0xe')];var applications=[_0xe3b2('0xf'),_0xe3b2('0x10'),_0xe3b2('0x11'),_0xe3b2('0x12'),'playback','voicemail'];var dispositions=[_0xe3b2('0x13'),_0xe3b2('0x14'),'FAILED','NO\x20ANSWER',_0xe3b2('0x13'),_0xe3b2('0x13'),_0xe3b2('0x15'),_0xe3b2('0x16'),_0xe3b2('0x14'),_0xe3b2('0x14'),_0xe3b2('0x14')];var actions={};config[_0xe3b2('0x17')]=_[_0xe3b2('0x18')](config[_0xe3b2('0x17')],{'host':_0xe3b2('0x19'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe3b2('0x17')]));function VoiceCallReport(_0x5e03d4){this['channels']=_0x5e03d4['channels'];this['agents']=_0x5e03d4[_0xe3b2('0x1a')];ami['on'](_0xe3b2('0x1b'),this[_0xe3b2('0x1c')]['bind'](this));ami['on'](_0xe3b2('0x1d'),this[_0xe3b2('0x1c')]['bind'](this));ami['on'](_0xe3b2('0x1e'),this[_0xe3b2('0x1f')]['bind'](this));ami['on'](_0xe3b2('0x20'),this[_0xe3b2('0x21')]['bind'](this));ami['on'](_0xe3b2('0x22'),this[_0xe3b2('0x23')][_0xe3b2('0x24')](this));ami['on']('hangup',this[_0xe3b2('0x25')][_0xe3b2('0x24')](this));ami['on'](_0xe3b2('0x26'),this[_0xe3b2('0x27')][_0xe3b2('0x24')](this));ami['on'](_0xe3b2('0x28'),this['syncAttendedTransfer'][_0xe3b2('0x24')](this));ami['on']('blindtransfer',this[_0xe3b2('0x29')][_0xe3b2('0x24')](this));ami['on'](_0xe3b2('0x2a'),this[_0xe3b2('0x2b')][_0xe3b2('0x24')](this));ami['on'](_0xe3b2('0x2c'),this[_0xe3b2('0x2d')][_0xe3b2('0x24')](this));return BPromise['resolve']()[_0xe3b2('0x2e')](ami[_0xe3b2('0x2f')]())[_0xe3b2('0x30')](function(_0x3450d4){console['log'](_0x3450d4);});}VoiceCallReport['prototype']['isNotNull']=function(_0x37d363){return _0x37d363!==null&&!_[_0xe3b2('0x31')](_0x37d363);};VoiceCallReport['prototype'][_0xe3b2('0x32')]=function(_0x651a40,_0x296e4d,_0x1537b2){io['to'](_0x651a40)[_0xe3b2('0x32')](_0x296e4d,_0x1537b2);};VoiceCallReport[_0xe3b2('0x33')]['syncNewCallerId']=function(_0x1a923a){try{if(this[_0xe3b2('0x34')](_0x1a923a)){if(_0x1a923a[_0xe3b2('0x35')]===_0x1a923a[_0xe3b2('0x36')]){if(!_['isUndefined'](this['channels'][_0x1a923a[_0xe3b2('0x35')]])){_[_0xe3b2('0x37')](this[_0xe3b2('0x38')][_0x1a923a[_0xe3b2('0x35')]],_[_0xe3b2('0x39')](_0x1a923a,_[_0xe3b2('0x3a')](this['channels'][_0x1a923a[_0xe3b2('0x35')]])));}}}}catch(_0x45e3e6){logger[_0xe3b2('0x3b')](_0xe3b2('0x3c'),util[_0xe3b2('0x3d')](_0x45e3e6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe3b2('0x33')][_0xe3b2('0x1f')]=function(_0xbb6ad4){try{if(this[_0xe3b2('0x34')](_0xbb6ad4)){if(_0xbb6ad4[_0xe3b2('0x35')]===_0xbb6ad4[_0xe3b2('0x36')]&&_0xbb6ad4[_0xe3b2('0x3e')]!=_0xe3b2('0x3f')){if(_['isUndefined'](this[_0xe3b2('0x38')][_0xbb6ad4[_0xe3b2('0x35')]])){this[_0xe3b2('0x38')][_0xbb6ad4['uniqueid']]=new Channel();this['channels'][_0xbb6ad4[_0xe3b2('0x35')]]['starttime']=moment()[_0xe3b2('0x40')](_0xe3b2('0x41'));this[_0xe3b2('0x38')][_0xbb6ad4[_0xe3b2('0x35')]][_0xe3b2('0x42')]=dispositions[_[_0xe3b2('0x43')](_0xbb6ad4[_0xe3b2('0x44')])];_['merge'](this[_0xe3b2('0x38')][_0xbb6ad4[_0xe3b2('0x35')]],_[_0xe3b2('0x39')](_0xbb6ad4,_[_0xe3b2('0x3a')](this['channels'][_0xbb6ad4[_0xe3b2('0x35')]])));if(_0xbb6ad4[_0xe3b2('0x45')]===_0xe3b2('0x46')){if(this[_0xe3b2('0x1a')][_0xbb6ad4[_0xe3b2('0x3e')]['split']('-')[0x0]]){this[_0xe3b2('0x1a')][_0xbb6ad4[_0xe3b2('0x3e')]['split']('-')[0x0]][_0xe3b2('0x47')]=_0xbb6ad4[_0xe3b2('0x48')];this[_0xe3b2('0x32')](util['format'](_0xe3b2('0x49'),this['agents'][_0xbb6ad4['channel'][_0xe3b2('0x4a')]('-')[0x0]][_0xe3b2('0x4b')]),_0xe3b2('0x4c'),{'destaccountcode':this[_0xe3b2('0x1a')][_0xbb6ad4['channel'][_0xe3b2('0x4a')]('-')[0x0]][_0xe3b2('0x4d')],'destconnectedlinenum':_0xbb6ad4[_0xe3b2('0x48')]});}}}}}}catch(_0x3ead97){logger['error'](_0xe3b2('0x4e'),util[_0xe3b2('0x3d')](_0x3ead97,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe3b2('0x33')]['syncNewExten']=function(_0x246df8){try{if(this['isNotNull'](_0x246df8)){if(_0x246df8[_0xe3b2('0x35')]===_0x246df8[_0xe3b2('0x36')]&&_0x246df8[_0xe3b2('0x48')]!='h'&&_0x246df8[_0xe3b2('0x3e')]!=_0xe3b2('0x3f')){_0x246df8['application']=_0x246df8[_0xe3b2('0x4f')][_0xe3b2('0x50')]();_0x246df8[_0xe3b2('0x51')]=(_0x246df8[_0xe3b2('0x52')]||_0x246df8[_0xe3b2('0x51')])[_0xe3b2('0x50')]();if(_['isUndefined'](this[_0xe3b2('0x38')][_0x246df8['uniqueid']])){this[_0xe3b2('0x38')][_0x246df8[_0xe3b2('0x35')]]=new Channel();this[_0xe3b2('0x38')][_0x246df8[_0xe3b2('0x35')]][_0xe3b2('0x53')]=_0x246df8[_0xe3b2('0x54')]?moment()[_0xe3b2('0x55')](moment[_0xe3b2('0x54')](_0x246df8[_0xe3b2('0x54')])[_0xe3b2('0x56')](),_0xe3b2('0x56'))[_0xe3b2('0x40')](_0xe3b2('0x41')):moment()[_0xe3b2('0x40')](_0xe3b2('0x41'));this['channels'][_0x246df8['uniqueid']][_0xe3b2('0x42')]='NO\x20ANSWER';}_[_0xe3b2('0x37')](this[_0xe3b2('0x38')][_0x246df8[_0xe3b2('0x35')]],_['pick'](_0x246df8,_[_0xe3b2('0x3a')](this['channels'][_0x246df8[_0xe3b2('0x35')]])));if(_['includes'](applications,_0x246df8[_0xe3b2('0x4f')])){this[_0xe3b2('0x38')][_0x246df8[_0xe3b2('0x35')]][_0xe3b2('0x57')]=_0x246df8['application'];this[_0xe3b2('0x38')][_0x246df8['uniqueid']][_0xe3b2('0x58')]=_0x246df8[_0xe3b2('0x51')];if(_0x246df8['application']===_0xe3b2('0xf')&&_[_0xe3b2('0x59')](_0x246df8[_0xe3b2('0x51')],_0xe3b2('0x5a'))){var _0x5511ec=_0x246df8[_0xe3b2('0x51')]['split']('=');var _0xd20871=_0x5511ec[0x0]['match'](/cdr\((.*)\)/);if(_0xd20871){this[_0xe3b2('0x38')][_0x246df8['uniqueid']][_0xd20871[0x1]]=_0x5511ec[0x1];}}else if(_0x246df8[_0xe3b2('0x4f')]===_0xe3b2('0x10')){this[_0xe3b2('0x38')][_0x246df8[_0xe3b2('0x35')]][_0xe3b2('0x10')]=_0x246df8[_0xe3b2('0x51')][_0xe3b2('0x4a')](',')[0x0];}}}}}catch(_0x3228d2){logger[_0xe3b2('0x3b')](_0xe3b2('0x5b'),util[_0xe3b2('0x3d')](_0x3228d2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe3b2('0x33')][_0xe3b2('0x21')]=function(_0x6a15){try{if(this[_0xe3b2('0x34')](_0x6a15)){if(_0x6a15[_0xe3b2('0x35')]!==_0x6a15['linkedid']){if(this[_0xe3b2('0x38')][_0x6a15['linkedid']]){if(_0x6a15[_0xe3b2('0x44')]==='6'){if(!this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x36')]]['answered']){var _0x4ac2f4=moment();this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x5c')]=!![];this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x36')]]['answertime']=_0x4ac2f4[_0xe3b2('0x40')](_0xe3b2('0x41'));if(this['channels'][_0x6a15['linkedid']][_0xe3b2('0x53')]){this['channels'][_0x6a15['linkedid']][_0xe3b2('0x5d')]=_0x4ac2f4['diff'](this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x53')],_0xe3b2('0x56'));}}this['channels'][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x36')]=_0x6a15[_0xe3b2('0x35')];if(_0x6a15[_0xe3b2('0x5e')]!=='xcally-motion-preview'){this['channels'][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x5f')]=_0x6a15[_0xe3b2('0x5e')];}this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x60')]=_0x6a15[_0xe3b2('0x61')];this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x62')]=_0x6a15['channel'];this['channels'][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x42')]=dispositions[_[_0xe3b2('0x43')](_0x6a15[_0xe3b2('0x44')])];if(this['agents'][_0x6a15[_0xe3b2('0x3e')][_0xe3b2('0x4a')]('-')[0x0]]){this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x63')]=this['agents'][_0x6a15[_0xe3b2('0x3e')]['split']('-')[0x0]]['id'];this['channels'][_0x6a15[_0xe3b2('0x36')]][_0xe3b2('0x64')]=this[_0xe3b2('0x1a')][_0x6a15[_0xe3b2('0x3e')][_0xe3b2('0x4a')]('-')[0x0]][_0xe3b2('0x4b')];}}}}else{if(this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x35')]]){if(_0x6a15[_0xe3b2('0x44')]==='6'){if(this[_0xe3b2('0x1a')][_0x6a15[_0xe3b2('0x3e')][_0xe3b2('0x4a')]('-')[0x0]]){this[_0xe3b2('0x38')][_0x6a15[_0xe3b2('0x35')]][_0xe3b2('0x63')]=this[_0xe3b2('0x1a')][_0x6a15[_0xe3b2('0x3e')][_0xe3b2('0x4a')]('-')[0x0]]['id'];this[_0xe3b2('0x38')][_0x6a15['uniqueid']]['membername']=this['agents'][_0x6a15[_0xe3b2('0x3e')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x3064f2){logger[_0xe3b2('0x3b')]('[syncNewState][VoiceCallReport]',util[_0xe3b2('0x3d')](_0x3064f2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe3b2('0x65')]=function(_0x51f9de,_0x1feadb){if(this[_0xe3b2('0x38')][_0x51f9de]){this[_0xe3b2('0x38')][_0x51f9de][_0xe3b2('0x66')]=!![];if(_['endsWith'](_0x1feadb,_0xe3b2('0x67'))){_0x1feadb=_0x1feadb[_0xe3b2('0x68')](_0xe3b2('0x67'),'.WAV');}this[_0xe3b2('0x38')][_0x51f9de]['monitorFilename']=_0x1feadb;var _0x1b5e70=_[_0xe3b2('0x69')](this[_0xe3b2('0x38')][_0x51f9de][_0xe3b2('0x6a')],{'filename':_0x1feadb});if(_[_0xe3b2('0x6b')](_0x1b5e70)){this['channels'][_0x51f9de][_0xe3b2('0x6a')][_0xe3b2('0x6c')]({'filename':_0x1feadb,'createdAt':moment()[_0xe3b2('0x40')](_0xe3b2('0x41')),'mixmonitorid':'','status':_0xe3b2('0x6d')});}}};VoiceCallReport[_0xe3b2('0x33')][_0xe3b2('0x23')]=function(_0x13497b){try{if(this[_0xe3b2('0x34')](_0x13497b)){if(this['channels'][_0x13497b['uniqueid']]&&_0x13497b[_0xe3b2('0x3e')]!=_0xe3b2('0x3f')){if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')])){if(this[_0xe3b2('0x34')](_0x13497b['variable']['mixmonitor_filename'])){this[_0xe3b2('0x65')](_0x13497b[_0xe3b2('0x35')],_0x13497b[_0xe3b2('0x6f')]);}else if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')]['xmd-phone'])){this['channels'][_0x13497b[_0xe3b2('0x35')]][_0xe3b2('0x5e')]=_0x13497b[_0xe3b2('0x6f')];}else if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')][_0xe3b2('0x70')])){this[_0xe3b2('0x38')][_0x13497b[_0xe3b2('0x35')]]['callerid']=_0x13497b[_0xe3b2('0x6f')];}else if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')][_0xe3b2('0x71')])){this['channels'][_0x13497b[_0xe3b2('0x35')]][_0xe3b2('0x72')]=_0x13497b['value'];}else if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')][_0xe3b2('0x73')])){this[_0xe3b2('0x38')][_0x13497b['uniqueid']][_0xe3b2('0x10')]=_0x13497b[_0xe3b2('0x6f')]['split'](',')[0x0];}else if(this['isNotNull'](_0x13497b[_0xe3b2('0x6e')]['xmd-originatecalleridnum'])){this[_0xe3b2('0x38')][_0x13497b[_0xe3b2('0x35')]][_0xe3b2('0x74')]=_0x13497b[_0xe3b2('0x6f')];}else if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')][_0xe3b2('0x75')])){this[_0xe3b2('0x38')][_0x13497b['uniqueid']][_0xe3b2('0x76')]=_0x13497b[_0xe3b2('0x6f')];}else if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')]['xmd-callerid-preview'])){this['channels'][_0x13497b['uniqueid']][_0xe3b2('0x77')]=_0x13497b['value'];}else if(this[_0xe3b2('0x34')](_0x13497b['variable']['xmcs-queue'])){this[_0xe3b2('0x38')][_0x13497b[_0xe3b2('0x35')]][_0xe3b2('0x10')]=_0x13497b[_0xe3b2('0x6f')];}else if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')][_0xe3b2('0x78')])){this['channels'][_0x13497b[_0xe3b2('0x35')]][_0xe3b2('0x79')]=_0x13497b['value'];}}}else if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')]['mixmonitor_filename'])){if(_0x13497b[_0xe3b2('0x6f')]){var _0x979e01=path['parse'](_0x13497b[_0xe3b2('0x6f')])[_0xe3b2('0x4b')];this[_0xe3b2('0x65')](_0x979e01,_0x13497b[_0xe3b2('0x6f')]);}}else if(this['channels'][_0x13497b[_0xe3b2('0x36')]]){if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')])){if(this[_0xe3b2('0x34')](_0x13497b[_0xe3b2('0x6e')][_0xe3b2('0x78')])){this[_0xe3b2('0x38')][_0x13497b[_0xe3b2('0x36')]][_0xe3b2('0x7a')]=_0x13497b[_0xe3b2('0x6f')];}}}}}catch(_0x40e0a5){logger[_0xe3b2('0x3b')]('[syncVarSet][VoiceCallReport]',util[_0xe3b2('0x3d')](_0x40e0a5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe3b2('0x33')][_0xe3b2('0x25')]=function(_0x10a059){try{if(this['isNotNull'](_0x10a059)){if(this[_0xe3b2('0x38')][_0x10a059[_0xe3b2('0x35')]]){var _0x3ef72e=moment();this[_0xe3b2('0x38')][_0x10a059[_0xe3b2('0x35')]][_0xe3b2('0x7b')]=_0x3ef72e[_0xe3b2('0x40')](_0xe3b2('0x41'));this[_0xe3b2('0x38')][_0x10a059[_0xe3b2('0x35')]][_0xe3b2('0x54')]=_0x3ef72e['diff'](this[_0xe3b2('0x38')][_0x10a059[_0xe3b2('0x35')]][_0xe3b2('0x53')],_0xe3b2('0x56'));if(this[_0xe3b2('0x38')][_0x10a059[_0xe3b2('0x35')]][_0xe3b2('0x5c')]){this[_0xe3b2('0x38')][_0x10a059[_0xe3b2('0x35')]]['billableseconds']=_0x3ef72e['diff'](this[_0xe3b2('0x38')][_0x10a059[_0xe3b2('0x35')]][_0xe3b2('0x7c')],_0xe3b2('0x56'));this['channels'][_0x10a059['uniqueid']][_0xe3b2('0x5d')]=this[_0xe3b2('0x38')][_0x10a059['uniqueid']]['duration']-this[_0xe3b2('0x38')][_0x10a059['uniqueid']]['billableseconds'];}if(_0x10a059[_0xe3b2('0x45')]===_0xe3b2('0x46')){if(this[_0xe3b2('0x1a')][_0x10a059[_0xe3b2('0x3e')][_0xe3b2('0x4a')]('-')[0x0]]){this[_0xe3b2('0x1a')][_0x10a059[_0xe3b2('0x3e')][_0xe3b2('0x4a')]('-')[0x0]]=_['omit'](this[_0xe3b2('0x1a')][_0x10a059['channel'][_0xe3b2('0x4a')]('-')[0x0]],['destconnectedlinenum']);this[_0xe3b2('0x32')](util[_0xe3b2('0x40')](_0xe3b2('0x49'),this['agents'][_0x10a059['channel']['split']('-')[0x0]][_0xe3b2('0x4b')]),_0xe3b2('0x7d'),{'destaccountcode':this[_0xe3b2('0x1a')][_0x10a059['channel']['split']('-')[0x0]][_0xe3b2('0x4d')]});}}ami[_0xe3b2('0x32')](_0xe3b2('0x7e'),this['channels'][_0x10a059[_0xe3b2('0x35')]]);delete this[_0xe3b2('0x38')][_0x10a059[_0xe3b2('0x35')]];}}}catch(_0x3ed47e){logger[_0xe3b2('0x3b')](_0xe3b2('0x7f'),util['inspect'](_0x3ed47e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe3b2('0x33')][_0xe3b2('0x80')]=function(_0x4c2edb){try{if(this[_0xe3b2('0x34')](_0x4c2edb)){if(this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x81')]]){this[_0xe3b2('0x38')][_0x4c2edb['transfereeuniqueid']][_0xe3b2('0x82')]=_0x4c2edb[_0xe3b2('0x83')];this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x81')]][_0xe3b2('0x84')]=_0x4c2edb['transfertargetcalleridnum'];if(this['channels'][_0x4c2edb[_0xe3b2('0x85')]]){var _0x4cd69=this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x85')]];this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x85')]]=this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x81')]];this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x81')]]=_0x4cd69;}}else if(this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x86')]]){this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x86')]][_0xe3b2('0x82')]=_0x4c2edb['origtransferercalleridnum'];this['channels'][_0x4c2edb[_0xe3b2('0x86')]]['transferconnectedlinenum']=_0x4c2edb['transfertargetcalleridnum'];if(this[_0xe3b2('0x38')][_0x4c2edb['origtransfereruniqueid']]){var _0x4cd69=this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x87')]];this[_0xe3b2('0x38')][_0x4c2edb[_0xe3b2('0x87')]]=this[_0xe3b2('0x38')][_0x4c2edb['transfertargetuniqueid']];this['channels'][_0x4c2edb['transfertargetuniqueid']]=_0x4cd69;}}}}catch(_0x555de5){logger[_0xe3b2('0x3b')](_0xe3b2('0x88'),util[_0xe3b2('0x3d')](_0x555de5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe3b2('0x33')]['syncBlindTransfer']=function(_0x343e5e){try{if(this[_0xe3b2('0x34')](_0x343e5e)){if(this['channels'][_0x343e5e[_0xe3b2('0x81')]]){this[_0xe3b2('0x38')][_0x343e5e[_0xe3b2('0x81')]][_0xe3b2('0x82')]=_0x343e5e[_0xe3b2('0x89')];this[_0xe3b2('0x38')][_0x343e5e['transfereeuniqueid']][_0xe3b2('0x84')]=_0x343e5e[_0xe3b2('0x8a')];this[_0xe3b2('0x25')]({'event':'BlindTransfer','uniqueid':_0x343e5e[_0xe3b2('0x81')],'context':_0x343e5e[_0xe3b2('0x45')],'channel':_0x343e5e[_0xe3b2('0x8b')]});}}}catch(_0x424c27){logger['error'](_0xe3b2('0x8c'),util['inspect'](_0x424c27,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe3b2('0x33')]['syncMusicOnHoldStart']=function(_0x18fdf2){try{if(this[_0xe3b2('0x34')](_0x18fdf2)){if(this[_0xe3b2('0x38')][_0x18fdf2[_0xe3b2('0x35')]]){if(!_[_0xe3b2('0x6b')](this[_0xe3b2('0x38')][_0x18fdf2['uniqueid']][_0xe3b2('0x7c')])){this[_0xe3b2('0x38')][_0x18fdf2[_0xe3b2('0x35')]][_0xe3b2('0x8d')]=moment()[_0xe3b2('0x40')](_0xe3b2('0x41'));}}}}catch(_0x437b3e){logger[_0xe3b2('0x3b')](_0xe3b2('0x8e'),util['inspect'](_0x437b3e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe3b2('0x33')][_0xe3b2('0x2d')]=function(_0x3c4ab5){try{if(this['isNotNull'](_0x3c4ab5)){if(this[_0xe3b2('0x38')][_0x3c4ab5[_0xe3b2('0x35')]]){if(!_[_0xe3b2('0x6b')](this[_0xe3b2('0x38')][_0x3c4ab5[_0xe3b2('0x35')]][_0xe3b2('0x8d')])){this[_0xe3b2('0x38')][_0x3c4ab5[_0xe3b2('0x35')]][_0xe3b2('0x8f')]+=moment()[_0xe3b2('0x90')](0x0)['diff'](this[_0xe3b2('0x38')][_0x3c4ab5[_0xe3b2('0x35')]][_0xe3b2('0x8d')],_0xe3b2('0x56'));delete this[_0xe3b2('0x38')][_0x3c4ab5[_0xe3b2('0x35')]][_0xe3b2('0x8d')];}}}}catch(_0x46f1db){logger[_0xe3b2('0x3b')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0xe3b2('0x3d')](_0x46f1db,{'showHidden':![],'depth':null}));}};module[_0xe3b2('0x91')]=VoiceCallReport; \ No newline at end of file +var _0x94ac=['accountcode','custom:voiceCallReport','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','extension','BlindTransfer','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','inuse','busy','unavailable','ringinuse','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','prototype','isNotNull','isUndefined','emit','linkedid','uniqueid','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','OutgoingSpoolFailed','starttime','format','disposition','toNumber','channelstate','pick','context','from-sip','channel','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','merge','includes','lastapplication','lastdata','set','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone','variable','xmd-callerid','callerid','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','calleridpreview','sipcallid','sipcalluniqueid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','holdtime'];(function(_0x5ab191,_0x3796a6){var _0x1027cc=function(_0x51739e){while(--_0x51739e){_0x5ab191['push'](_0x5ab191['shift']());}};_0x1027cc(++_0x3796a6);}(_0x94ac,0x139));var _0xc94a=function(_0xc6499f,_0x536333){_0xc6499f=_0xc6499f-0x0;var _0x5e2394=_0x94ac[_0xc6499f];return _0x5e2394;};'use strict';var BPromise=require(_0xc94a('0x0'));var _=require(_0xc94a('0x1'));var moment=require(_0xc94a('0x2'));var util=require(_0xc94a('0x3'));var path=require(_0xc94a('0x4'));var Redis=require(_0xc94a('0x5'));var config=require(_0xc94a('0x6'));var logger=require('../../../config/logger')(_0xc94a('0x7'));var ami=require(_0xc94a('0x8'));var Channel=require('../model/channel');var statusDesc=['unknown','not_inuse',_0xc94a('0x9'),_0xc94a('0xa'),'invalid',_0xc94a('0xb'),'ringing',_0xc94a('0xc'),'onhold'];var applications=['set',_0xc94a('0xd'),_0xc94a('0xe'),_0xc94a('0xf'),_0xc94a('0x10'),_0xc94a('0x11')];var dispositions=[_0xc94a('0x12'),'FAILED','FAILED','NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0xc94a('0x13'),_0xc94a('0x14'),_0xc94a('0x15'),_0xc94a('0x15'),_0xc94a('0x15')];var actions={};config[_0xc94a('0x16')]=_[_0xc94a('0x17')](config[_0xc94a('0x16')],{'host':_0xc94a('0x18'),'port':0x18eb});var io=require(_0xc94a('0x19'))(new Redis(config['redis']));function VoiceCallReport(_0xbfd406){this[_0xc94a('0x1a')]=_0xbfd406['channels'];this[_0xc94a('0x1b')]=_0xbfd406[_0xc94a('0x1b')];ami['on'](_0xc94a('0x1c'),this[_0xc94a('0x1d')][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x1f'),this[_0xc94a('0x1d')][_0xc94a('0x1e')](this));ami['on']('newchannel',this[_0xc94a('0x20')]['bind'](this));ami['on'](_0xc94a('0x21'),this[_0xc94a('0x22')]['bind'](this));ami['on'](_0xc94a('0x23'),this[_0xc94a('0x24')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x25'),this[_0xc94a('0x26')][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x27'),this['syncAttendedTransfer'][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x28'),this[_0xc94a('0x29')]['bind'](this));ami['on']('musiconholdstart',this[_0xc94a('0x2a')][_0xc94a('0x1e')](this));ami['on'](_0xc94a('0x2b'),this[_0xc94a('0x2c')][_0xc94a('0x1e')](this));return BPromise['resolve']()[_0xc94a('0x2d')](ami[_0xc94a('0x2e')]())[_0xc94a('0x2f')](function(_0x52a48e){console['log'](_0x52a48e);});}VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x31')]=function(_0x208512){return _0x208512!==null&&!_[_0xc94a('0x32')](_0x208512);};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x33')]=function(_0x4a3741,_0x5167a7,_0x22d3f9){io['to'](_0x4a3741)[_0xc94a('0x33')](_0x5167a7,_0x22d3f9);};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x26')]=function(_0x4d63b4){try{if(this[_0xc94a('0x31')](_0x4d63b4)){if(_0x4d63b4['uniqueid']===_0x4d63b4[_0xc94a('0x34')]){if(!_['isUndefined'](this[_0xc94a('0x1a')][_0x4d63b4[_0xc94a('0x35')]])){_['merge'](this['channels'][_0x4d63b4['uniqueid']],_['pick'](_0x4d63b4,_[_0xc94a('0x36')](this[_0xc94a('0x1a')][_0x4d63b4['uniqueid']])));}}}}catch(_0x4b9470){logger[_0xc94a('0x37')](_0xc94a('0x38'),util[_0xc94a('0x39')](_0x4b9470,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x20')]=function(_0x19c20b){try{if(this[_0xc94a('0x31')](_0x19c20b)){if(_0x19c20b[_0xc94a('0x35')]===_0x19c20b[_0xc94a('0x34')]&&_0x19c20b['channel']!=_0xc94a('0x3a')){if(_[_0xc94a('0x32')](this[_0xc94a('0x1a')][_0x19c20b['uniqueid']])){this['channels'][_0x19c20b[_0xc94a('0x35')]]=new Channel();this['channels'][_0x19c20b[_0xc94a('0x35')]][_0xc94a('0x3b')]=moment()[_0xc94a('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc94a('0x1a')][_0x19c20b[_0xc94a('0x35')]][_0xc94a('0x3d')]=dispositions[_[_0xc94a('0x3e')](_0x19c20b[_0xc94a('0x3f')])];_['merge'](this[_0xc94a('0x1a')][_0x19c20b['uniqueid']],_[_0xc94a('0x40')](_0x19c20b,_[_0xc94a('0x36')](this[_0xc94a('0x1a')][_0x19c20b['uniqueid']])));if(_0x19c20b[_0xc94a('0x41')]===_0xc94a('0x42')){if(this[_0xc94a('0x1b')][_0x19c20b[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]]){this['agents'][_0x19c20b['channel'][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x45')]=_0x19c20b[_0xc94a('0x46')];this[_0xc94a('0x33')](util[_0xc94a('0x3c')](_0xc94a('0x47'),this[_0xc94a('0x1b')][_0x19c20b[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x48')]),_0xc94a('0x49'),{'destaccountcode':this[_0xc94a('0x1b')][_0x19c20b[_0xc94a('0x43')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x19c20b[_0xc94a('0x46')]});}}}}}}catch(_0x3cfc2f){logger[_0xc94a('0x37')]('[syncNewChannel][VoiceCallReport]',util['inspect'](_0x3cfc2f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')]['syncNewExten']=function(_0x20aa12){try{if(this[_0xc94a('0x31')](_0x20aa12)){if(_0x20aa12[_0xc94a('0x35')]===_0x20aa12[_0xc94a('0x34')]&&_0x20aa12[_0xc94a('0x46')]!='h'&&_0x20aa12['channel']!='OutgoingSpoolFailed'){_0x20aa12[_0xc94a('0x4a')]=_0x20aa12[_0xc94a('0x4a')][_0xc94a('0x4b')]();_0x20aa12[_0xc94a('0x4c')]=(_0x20aa12[_0xc94a('0x4d')]||_0x20aa12[_0xc94a('0x4c')])[_0xc94a('0x4b')]();if(_[_0xc94a('0x32')](this[_0xc94a('0x1a')][_0x20aa12['uniqueid']])){this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]]=new Channel();this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]][_0xc94a('0x3b')]=_0x20aa12[_0xc94a('0x4e')]?moment()[_0xc94a('0x4f')](moment[_0xc94a('0x4e')](_0x20aa12[_0xc94a('0x4e')])[_0xc94a('0x50')](),_0xc94a('0x50'))['format'](_0xc94a('0x51')):moment()[_0xc94a('0x3c')](_0xc94a('0x51'));this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]][_0xc94a('0x3d')]=_0xc94a('0x12');}_[_0xc94a('0x52')](this['channels'][_0x20aa12[_0xc94a('0x35')]],_[_0xc94a('0x40')](_0x20aa12,_[_0xc94a('0x36')](this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]])));if(_[_0xc94a('0x53')](applications,_0x20aa12[_0xc94a('0x4a')])){this['channels'][_0x20aa12[_0xc94a('0x35')]][_0xc94a('0x54')]=_0x20aa12[_0xc94a('0x4a')];this[_0xc94a('0x1a')][_0x20aa12['uniqueid']][_0xc94a('0x55')]=_0x20aa12['applicationdata'];if(_0x20aa12[_0xc94a('0x4a')]===_0xc94a('0x56')&&_[_0xc94a('0x57')](_0x20aa12[_0xc94a('0x4c')],_0xc94a('0x58'))){var _0xabffa=_0x20aa12[_0xc94a('0x4c')][_0xc94a('0x44')]('=');var _0x278205=_0xabffa[0x0][_0xc94a('0x59')](/cdr\((.*)\)/);if(_0x278205){this[_0xc94a('0x1a')][_0x20aa12[_0xc94a('0x35')]][_0x278205[0x1]]=_0xabffa[0x1];}}else if(_0x20aa12[_0xc94a('0x4a')]===_0xc94a('0xd')){this['channels'][_0x20aa12[_0xc94a('0x35')]][_0xc94a('0xd')]=_0x20aa12[_0xc94a('0x4c')][_0xc94a('0x44')](',')[0x0];}}}}}catch(_0x314467){logger[_0xc94a('0x37')](_0xc94a('0x5a'),util[_0xc94a('0x39')](_0x314467,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x22')]=function(_0x34021f){try{if(this[_0xc94a('0x31')](_0x34021f)){if(_0x34021f[_0xc94a('0x35')]!==_0x34021f[_0xc94a('0x34')]){if(this['channels'][_0x34021f['linkedid']]){if(_0x34021f[_0xc94a('0x3f')]==='6'){if(!this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]][_0xc94a('0x5b')]){var _0x28ffd6=moment();this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]][_0xc94a('0x5b')]=!![];this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]][_0xc94a('0x5c')]=_0x28ffd6[_0xc94a('0x3c')](_0xc94a('0x51'));if(this[_0xc94a('0x1a')][_0x34021f['linkedid']][_0xc94a('0x3b')]){this[_0xc94a('0x1a')][_0x34021f['linkedid']]['holdtime']=_0x28ffd6[_0xc94a('0x5d')](this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]]['starttime'],_0xc94a('0x50'));}}this['channels'][_0x34021f[_0xc94a('0x34')]]['linkedid']=_0x34021f[_0xc94a('0x35')];if(_0x34021f[_0xc94a('0x5e')]!==_0xc94a('0x5f')){this[_0xc94a('0x1a')][_0x34021f['linkedid']]['connectedlinenum']=_0x34021f[_0xc94a('0x5e')];}this[_0xc94a('0x1a')][_0x34021f['linkedid']][_0xc94a('0x60')]=_0x34021f['calleridname'];this[_0xc94a('0x1a')][_0x34021f['linkedid']][_0xc94a('0x61')]=_0x34021f[_0xc94a('0x43')];this[_0xc94a('0x1a')][_0x34021f['linkedid']][_0xc94a('0x3d')]=dispositions[_[_0xc94a('0x3e')](_0x34021f[_0xc94a('0x3f')])];if(this[_0xc94a('0x1b')][_0x34021f[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]]){this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]]['UserId']=this[_0xc94a('0x1b')][_0x34021f[_0xc94a('0x43')]['split']('-')[0x0]]['id'];this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x34')]]['membername']=this[_0xc94a('0x1b')][_0x34021f[_0xc94a('0x43')]['split']('-')[0x0]][_0xc94a('0x48')];}}}}else{if(this['channels'][_0x34021f[_0xc94a('0x35')]]){if(_0x34021f[_0xc94a('0x3f')]==='6'){if(this[_0xc94a('0x1b')][_0x34021f['channel'][_0xc94a('0x44')]('-')[0x0]]){this['channels'][_0x34021f[_0xc94a('0x35')]][_0xc94a('0x62')]=this[_0xc94a('0x1b')][_0x34021f['channel'][_0xc94a('0x44')]('-')[0x0]]['id'];this[_0xc94a('0x1a')][_0x34021f[_0xc94a('0x35')]][_0xc94a('0x63')]=this[_0xc94a('0x1b')][_0x34021f['channel'][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x48')];}}}}}}catch(_0xca194d){logger[_0xc94a('0x37')](_0xc94a('0x64'),util[_0xc94a('0x39')](_0xca194d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x54f6f8,_0x59f73d){if(this['channels'][_0x54f6f8]){this[_0xc94a('0x1a')][_0x54f6f8][_0xc94a('0x65')]=!![];if(_[_0xc94a('0x66')](_0x59f73d,_0xc94a('0x67'))){_0x59f73d=_0x59f73d[_0xc94a('0x68')](_0xc94a('0x67'),_0xc94a('0x69'));}this[_0xc94a('0x1a')][_0x54f6f8][_0xc94a('0x6a')]=_0x59f73d;var _0xd98139=_[_0xc94a('0x6b')](this[_0xc94a('0x1a')][_0x54f6f8][_0xc94a('0x6c')],{'filename':_0x59f73d});if(_[_0xc94a('0x6d')](_0xd98139)){this[_0xc94a('0x1a')][_0x54f6f8][_0xc94a('0x6c')][_0xc94a('0x6e')]({'filename':_0x59f73d,'createdAt':moment()[_0xc94a('0x3c')](_0xc94a('0x51')),'mixmonitorid':'','status':_0xc94a('0x6f')});}}};VoiceCallReport['prototype'][_0xc94a('0x24')]=function(_0x10f402){try{if(this['isNotNull'](_0x10f402)){if(this['channels'][_0x10f402[_0xc94a('0x35')]]&&_0x10f402[_0xc94a('0x43')]!='OutgoingSpoolFailed'){if(this[_0xc94a('0x31')](_0x10f402['variable'])){if(this['isNotNull'](_0x10f402['variable'][_0xc94a('0x70')])){this[_0xc94a('0x71')](_0x10f402[_0xc94a('0x35')],_0x10f402[_0xc94a('0x72')]);}else if(this[_0xc94a('0x31')](_0x10f402['variable'][_0xc94a('0x73')])){this[_0xc94a('0x1a')][_0x10f402['uniqueid']]['calleridnum']=_0x10f402[_0xc94a('0x72')];}else if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')][_0xc94a('0x75')])){this[_0xc94a('0x1a')][_0x10f402['uniqueid']][_0xc94a('0x76')]=_0x10f402[_0xc94a('0x72')];}else if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')]['xmd-cdrtype'])){this['channels'][_0x10f402[_0xc94a('0x35')]][_0xc94a('0x77')]=_0x10f402[_0xc94a('0x72')];}else if(this[_0xc94a('0x31')](_0x10f402['variable'][_0xc94a('0x78')])){this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x35')]][_0xc94a('0xd')]=_0x10f402[_0xc94a('0x72')]['split'](',')[0x0];}else if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')][_0xc94a('0x79')])){this[_0xc94a('0x1a')][_0x10f402['uniqueid']][_0xc94a('0x7a')]=_0x10f402['value'];}else if(this['isNotNull'](_0x10f402[_0xc94a('0x74')]['xmd-destination'])){this[_0xc94a('0x1a')][_0x10f402['uniqueid']]['destination']=_0x10f402['value'];}else if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')]['xmd-callerid-preview'])){this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x35')]][_0xc94a('0x7b')]=_0x10f402[_0xc94a('0x72')];}else if(this['isNotNull'](_0x10f402[_0xc94a('0x74')]['xmcs-queue'])){this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x35')]][_0xc94a('0xd')]=_0x10f402['value'];}else if(this[_0xc94a('0x31')](_0x10f402['variable'][_0xc94a('0x7c')])){this['channels'][_0x10f402[_0xc94a('0x35')]][_0xc94a('0x7d')]=_0x10f402[_0xc94a('0x72')];}}}else if(this[_0xc94a('0x31')](_0x10f402['variable'][_0xc94a('0x70')])){if(_0x10f402['value']){var _0x5b4194=path['parse'](_0x10f402[_0xc94a('0x72')])[_0xc94a('0x48')];this['syncMixMonitorFilename'](_0x5b4194,_0x10f402['value']);}}else if(this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x34')]]){if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')])){if(this[_0xc94a('0x31')](_0x10f402[_0xc94a('0x74')][_0xc94a('0x7c')])){this[_0xc94a('0x1a')][_0x10f402[_0xc94a('0x34')]][_0xc94a('0x7e')]=_0x10f402[_0xc94a('0x72')];}}}}}catch(_0x4f51df){logger['error'](_0xc94a('0x7f'),util['inspect'](_0x4f51df,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')]['syncHangup']=function(_0x118898){try{if(this[_0xc94a('0x31')](_0x118898)){if(this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]]){var _0x1ab356=moment();this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x80')]=_0x1ab356[_0xc94a('0x3c')](_0xc94a('0x51'));this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x4e')]=_0x1ab356[_0xc94a('0x5d')](this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x3b')],_0xc94a('0x50'));if(this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x5b')]){this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x81')]=_0x1ab356['diff'](this['channels'][_0x118898[_0xc94a('0x35')]][_0xc94a('0x5c')],_0xc94a('0x50'));this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x82')]=this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]][_0xc94a('0x4e')]-this['channels'][_0x118898['uniqueid']][_0xc94a('0x81')];}if(_0x118898[_0xc94a('0x41')]===_0xc94a('0x42')){if(this['agents'][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]]){this['agents'][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]]=_['omit'](this['agents'][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]],[_0xc94a('0x45')]);this[_0xc94a('0x33')](util['format'](_0xc94a('0x47'),this[_0xc94a('0x1b')][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x48')]),'user:agentcomplete',{'destaccountcode':this[_0xc94a('0x1b')][_0x118898[_0xc94a('0x43')][_0xc94a('0x44')]('-')[0x0]][_0xc94a('0x83')]});}}ami[_0xc94a('0x33')](_0xc94a('0x84'),this[_0xc94a('0x1a')][_0x118898[_0xc94a('0x35')]]);delete this[_0xc94a('0x1a')][_0x118898['uniqueid']];}}}catch(_0x1f0420){logger[_0xc94a('0x37')]('[syncHangup][VoiceCallReport]',util[_0xc94a('0x39')](_0x1f0420,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0xccee4f){try{if(this[_0xc94a('0x31')](_0xccee4f)){if(this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x85')]]){this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x85')]]['transfercalleridnum']=_0xccee4f[_0xc94a('0x86')];this['channels'][_0xccee4f[_0xc94a('0x85')]][_0xc94a('0x87')]=_0xccee4f[_0xc94a('0x88')];if(this['channels'][_0xccee4f[_0xc94a('0x89')]]){var _0x7be837=this[_0xc94a('0x1a')][_0xccee4f['secondtransfereruniqueid']];this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x89')]]=this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x85')]];this['channels'][_0xccee4f[_0xc94a('0x85')]]=_0x7be837;}}else if(this[_0xc94a('0x1a')][_0xccee4f['transfertargetuniqueid']]){this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x8a')]][_0xc94a('0x8b')]=_0xccee4f['origtransferercalleridnum'];this['channels'][_0xccee4f[_0xc94a('0x8a')]][_0xc94a('0x87')]=_0xccee4f[_0xc94a('0x88')];if(this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x8c')]]){var _0x7be837=this['channels'][_0xccee4f[_0xc94a('0x8c')]];this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x8c')]]=this[_0xc94a('0x1a')][_0xccee4f[_0xc94a('0x8a')]];this['channels'][_0xccee4f[_0xc94a('0x8a')]]=_0x7be837;}}}}catch(_0x3a61e0){logger[_0xc94a('0x37')]('[syncAttendedTransfer][VoiceCallReport]',util[_0xc94a('0x39')](_0x3a61e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x29')]=function(_0x1f2e5c){try{if(this['isNotNull'](_0x1f2e5c)){if(this[_0xc94a('0x1a')][_0x1f2e5c['transfereeuniqueid']]){this[_0xc94a('0x1a')][_0x1f2e5c['transfereeuniqueid']][_0xc94a('0x8b')]=_0x1f2e5c['transfereecalleridnum'];this[_0xc94a('0x1a')][_0x1f2e5c[_0xc94a('0x85')]]['transferconnectedlinenum']=_0x1f2e5c[_0xc94a('0x8d')];this['syncHangup']({'event':_0xc94a('0x8e'),'uniqueid':_0x1f2e5c[_0xc94a('0x85')],'context':_0x1f2e5c[_0xc94a('0x41')],'channel':_0x1f2e5c['transfererchannel']});}}}catch(_0x1b7daa){logger[_0xc94a('0x37')]('[syncBlindTransfer][VoiceCallReport]',util[_0xc94a('0x39')](_0x1b7daa,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x48d5dc){try{if(this[_0xc94a('0x31')](_0x48d5dc)){if(this[_0xc94a('0x1a')][_0x48d5dc[_0xc94a('0x35')]]){if(!_[_0xc94a('0x6d')](this[_0xc94a('0x1a')][_0x48d5dc[_0xc94a('0x35')]]['answertime'])){this[_0xc94a('0x1a')][_0x48d5dc[_0xc94a('0x35')]][_0xc94a('0x8f')]=moment()[_0xc94a('0x3c')](_0xc94a('0x51'));}}}}catch(_0x189c9b){logger[_0xc94a('0x37')](_0xc94a('0x90'),util[_0xc94a('0x39')](_0x189c9b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc94a('0x30')][_0xc94a('0x2c')]=function(_0x4dd2fe){try{if(this[_0xc94a('0x31')](_0x4dd2fe)){if(this['channels'][_0x4dd2fe[_0xc94a('0x35')]]){if(!_[_0xc94a('0x6d')](this[_0xc94a('0x1a')][_0x4dd2fe['uniqueid']][_0xc94a('0x8f')])){this[_0xc94a('0x1a')][_0x4dd2fe[_0xc94a('0x35')]][_0xc94a('0x91')]+=moment()['milliseconds'](0x0)[_0xc94a('0x5d')](this[_0xc94a('0x1a')][_0x4dd2fe['uniqueid']][_0xc94a('0x8f')],'seconds');delete this['channels'][_0x4dd2fe[_0xc94a('0x35')]][_0xc94a('0x8f')];}}}}catch(_0x4c78a1){logger['error'](_0xc94a('0x92'),util['inspect'](_0x4c78a1,{'showHidden':![],'depth':null}));}};module[_0xc94a('0x93')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 60ab1b3..3b22f6f 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 _0x8b97=['membername','memberpenalty','memberrealtime','isNil','includes','endtime','diff','starttime','seconds','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[syncHangup][VoiceDialReport]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','voice:outbound','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x8b97,0x1d9));var _0x78b9=function(_0x337e77,_0x205300){_0x337e77=_0x337e77-0x0;var _0x24fad5=_0x8b97[_0x337e77];return _0x24fad5;};'use strict';var _=require(_0x78b9('0x0'));var moment=require('moment');var util=require(_0x78b9('0x1'));var Redis=require(_0x78b9('0x2'));var config=require(_0x78b9('0x3'));var logger=require(_0x78b9('0x4'))(_0x78b9('0x5'));var ami=require(_0x78b9('0x6'));config['redis']=_[_0x78b9('0x7')](config[_0x78b9('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x78b9('0x9'))(new Redis(config[_0x78b9('0x8')]));function VoiceDialReport(_0x4b59e4){this[_0x78b9('0xa')]=_0x4b59e4[_0x78b9('0xb')];this[_0x78b9('0xc')]=_0x4b59e4[_0x78b9('0xc')];this[_0x78b9('0xd')]={};ami['on'](_0x78b9('0xe'),this[_0x78b9('0xf')][_0x78b9('0x10')](this));ami['on'](_0x78b9('0x11'),this[_0x78b9('0x12')][_0x78b9('0x10')](this));ami['on'](_0x78b9('0x13'),this[_0x78b9('0x14')]['bind'](this));ami['on'](_0x78b9('0x15'),this[_0x78b9('0x16')][_0x78b9('0x10')](this));}VoiceDialReport['prototype'][_0x78b9('0x17')]=function(_0x38e486){return _0x38e486!==null&&!_[_0x78b9('0x18')](_0x38e486);};VoiceDialReport[_0x78b9('0x19')][_0x78b9('0x1a')]=function(_0x2ca12a,_0x386a35,_0x2fb5a4){io['to'](_0x2ca12a)[_0x78b9('0x1a')](_0x386a35,_0x2fb5a4);};VoiceDialReport[_0x78b9('0x19')][_0x78b9('0xf')]=function(_0x2c715e){try{if(this[_0x78b9('0x17')](_0x2c715e)){if(this[_0x78b9('0xa')][_0x2c715e[_0x78b9('0x1b')]]){_[_0x78b9('0x1c')](this[_0x78b9('0xa')][_0x2c715e[_0x78b9('0x1b')]],{'starttime':moment()[_0x78b9('0x1d')](_0x78b9('0x1e')),'lastevent':'called','interface':_0x2c715e[_0x78b9('0x1f')][_0x78b9('0x20')](0x0,_0x2c715e[_0x78b9('0x1f')][_0x78b9('0x21')]('-')),'membername':_0x2c715e[_0x78b9('0x1f')][_0x78b9('0x20')](_0x2c715e[_0x78b9('0x1f')][_0x78b9('0x21')]('/')+0x1,_0x2c715e['channel']['lastIndexOf']('-'))},_[_0x78b9('0x22')](_0x2c715e,[_0x78b9('0x23'),'privilege']));this['emit']('voice:outbound',_0x78b9('0x24'),this[_0x78b9('0xa')][_0x2c715e[_0x78b9('0x1b')]]);ami[_0x78b9('0x1a')](_0x78b9('0x25'),this[_0x78b9('0xa')][_0x2c715e[_0x78b9('0x1b')]]);}}}catch(_0x54c196){logger[_0x78b9('0x26')](_0x78b9('0x27'),util[_0x78b9('0x28')](_0x54c196,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x78b9('0x19')][_0x78b9('0x12')]=function(_0x327885){try{if(this[_0x78b9('0x17')](_0x327885)){if(this[_0x78b9('0xa')][_0x327885['uniqueid']]){this[_0x78b9('0xa')][_0x327885[_0x78b9('0x1b')]]['dialstatus']=_0x327885['dialstatus'];if(_0x327885[_0x78b9('0x29')]===_0x78b9('0x2a')){this[_0x78b9('0xa')][_0x327885['uniqueid']]['connectedlinenum']=_0x327885[_0x78b9('0x2b')];this['channels'][_0x327885[_0x78b9('0x1b')]][_0x78b9('0x2c')]=_0x327885['connectedlinename'];this[_0x78b9('0xa')][_0x327885[_0x78b9('0x1b')]][_0x78b9('0x2d')]=moment()['format'](_0x78b9('0x1e'));this[_0x78b9('0xa')][_0x327885[_0x78b9('0x1b')]][_0x78b9('0x2e')]=_0x78b9('0x2f');ami[_0x78b9('0x1a')](_0x78b9('0x30'),this[_0x78b9('0xa')][_0x327885[_0x78b9('0x1b')]]);}this[_0x78b9('0x1a')]('voice:outbound',_0x78b9('0x24'),this[_0x78b9('0xa')][_0x327885[_0x78b9('0x1b')]]);}}}catch(_0x3f83e1){logger[_0x78b9('0x26')](_0x78b9('0x31'),util[_0x78b9('0x28')](_0x3f83e1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x78b9('0x19')][_0x78b9('0x14')]=function(_0x4a594e){try{if(this[_0x78b9('0x17')](_0x4a594e)){this[_0x78b9('0x32')](_0x4a594e[_0x78b9('0x1b')],_[_0x78b9('0x33')](_0x4a594e[_0x78b9('0x34')])[0x0],_0x4a594e[_0x78b9('0x35')]);if(this[_0x78b9('0x17')](_0x4a594e['variable'])&&this[_0x78b9('0x17')](_0x4a594e[_0x78b9('0x34')][_0x78b9('0x36')])){if(_[_0x78b9('0x18')](this[_0x78b9('0xa')][_0x4a594e[_0x78b9('0x1b')]])){this[_0x78b9('0xa')][_0x4a594e[_0x78b9('0x1b')]]={'routeId':_0x4a594e[_0x78b9('0x35')],'variables':this[_0x78b9('0xd')][_0x4a594e[_0x78b9('0x1b')]]};this['emit'](_0x78b9('0x37'),_0x78b9('0x24'),this['channels'][_0x4a594e['uniqueid']]);}}}}catch(_0x29ec59){logger[_0x78b9('0x26')]('[syncVarSet][VoiceDialReport]',util['inspect'](_0x29ec59,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x78b9('0x19')][_0x78b9('0x32')]=function(_0x163e9f,_0x6bb7d5,_0x2ab563){var _0x2701b3=['rtpaudioqos',_0x78b9('0x38'),_0x78b9('0x39'),'rtpaudioqosjitterbridged',_0x78b9('0x3a'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x78b9('0x3b'),_0x78b9('0x3c'),_0x78b9('0x3d'),_0x78b9('0x3e'),_0x78b9('0x3f'),_0x78b9('0x40'),_0x78b9('0x41'),'memberinterface',_0x78b9('0x42'),_0x78b9('0x43'),_0x78b9('0x44'),_0x78b9('0x45')];if(!_[_0x78b9('0x46')](_0x6bb7d5)&&!_[_0x78b9('0x47')](_0x2701b3,_0x6bb7d5)){if(_['isUndefined'](this[_0x78b9('0xd')][_0x163e9f])){this[_0x78b9('0xd')][_0x163e9f]={};}this[_0x78b9('0xd')][_0x163e9f][_0x6bb7d5]=_0x2ab563;}};VoiceDialReport[_0x78b9('0x19')][_0x78b9('0x16')]=function(_0x5af85a){try{if(this[_0x78b9('0x17')](_0x5af85a)){if(this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]]){this['channels'][_0x5af85a[_0x78b9('0x1b')]][_0x78b9('0x48')]=moment()[_0x78b9('0x1d')](_0x78b9('0x1e'));this[_0x78b9('0xa')][_0x5af85a['uniqueid']]['duration']=moment(this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]]['endtime'])[_0x78b9('0x49')](this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]][_0x78b9('0x4a')],_0x78b9('0x4b'));this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]][_0x78b9('0x2e')]='complete';this['outbound'][_0x78b9('0x4c')]+=0x1;if(this['channels'][_0x5af85a['uniqueid']]['answertime']){this[_0x78b9('0xc')][_0x78b9('0x4d')]+=0x1;this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]][_0x78b9('0x4e')]=moment(this['channels'][_0x5af85a[_0x78b9('0x1b')]]['answertime'])['diff'](this['channels'][_0x5af85a['uniqueid']][_0x78b9('0x4a')],_0x78b9('0x4b'));this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]][_0x78b9('0x4f')]=moment(this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]][_0x78b9('0x48')])[_0x78b9('0x49')](this['channels'][_0x5af85a['uniqueid']]['answertime'],'seconds');this[_0x78b9('0xc')][_0x78b9('0x50')]+=this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]][_0x78b9('0x4e')]||0x0;this[_0x78b9('0xc')][_0x78b9('0x51')]+=this['channels'][_0x5af85a['uniqueid']]['billableseconds'];}this['outbound'][_0x78b9('0x52')]+=this['channels'][_0x5af85a['uniqueid']][_0x78b9('0x53')];ami[_0x78b9('0x1a')]('custom:voiceDialReport',this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]]);ami[_0x78b9('0x1a')](_0x78b9('0x54'),this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]]);this['emit']('voice:outbound',_0x78b9('0x55'),this['outbound']);logger['info'](_0x78b9('0x56'),JSON[_0x78b9('0x57')](this['channels'][_0x5af85a[_0x78b9('0x1b')]]));this[_0x78b9('0x1a')](_0x78b9('0x37'),'voice_outbound_channel:remove',this['channels'][_0x5af85a[_0x78b9('0x1b')]]);delete this[_0x78b9('0xa')][_0x5af85a[_0x78b9('0x1b')]];}if(this['variables'][_0x5af85a[_0x78b9('0x1b')]]){delete this[_0x78b9('0xd')][_0x5af85a[_0x78b9('0x1b')]];}}}catch(_0x25c642){logger[_0x78b9('0x26')](_0x78b9('0x58'),util[_0x78b9('0x28')](_0x25c642,{'showHidden':![],'depth':null}));}};module[_0x78b9('0x59')]=VoiceDialReport; \ No newline at end of file +var _0xc452=['uniqueid','format','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','endtime','duration','diff','starttime','complete','total','answered','holdtime','billableseconds','seconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','info','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','merge'];(function(_0x2b0102,_0xe3da2e){var _0x22e6e1=function(_0x5c18fb){while(--_0x5c18fb){_0x2b0102['push'](_0x2b0102['shift']());}};_0x22e6e1(++_0xe3da2e);}(_0xc452,0x154));var _0x2c45=function(_0x3cd0d5,_0x3cce8b){_0x3cd0d5=_0x3cd0d5-0x0;var _0x252559=_0xc452[_0x3cd0d5];return _0x252559;};'use strict';var _=require('lodash');var moment=require(_0x2c45('0x0'));var util=require('util');var Redis=require(_0x2c45('0x1'));var config=require(_0x2c45('0x2'));var logger=require(_0x2c45('0x3'))(_0x2c45('0x4'));var ami=require(_0x2c45('0x5'));config[_0x2c45('0x6')]=_[_0x2c45('0x7')](config['redis'],{'host':_0x2c45('0x8'),'port':0x18eb});var io=require(_0x2c45('0x9'))(new Redis(config[_0x2c45('0x6')]));function VoiceDialReport(_0x573bfe){this[_0x2c45('0xa')]=_0x573bfe[_0x2c45('0xb')];this[_0x2c45('0xc')]=_0x573bfe[_0x2c45('0xc')];this[_0x2c45('0xd')]={};ami['on'](_0x2c45('0xe'),this[_0x2c45('0xf')][_0x2c45('0x10')](this));ami['on'](_0x2c45('0x11'),this[_0x2c45('0x12')][_0x2c45('0x10')](this));ami['on'](_0x2c45('0x13'),this[_0x2c45('0x14')][_0x2c45('0x10')](this));ami['on'](_0x2c45('0x15'),this[_0x2c45('0x16')]['bind'](this));}VoiceDialReport['prototype'][_0x2c45('0x17')]=function(_0x59b599){return _0x59b599!==null&&!_[_0x2c45('0x18')](_0x59b599);};VoiceDialReport[_0x2c45('0x19')][_0x2c45('0x1a')]=function(_0x26f5ba,_0x1913a8,_0x7623b8){io['to'](_0x26f5ba)[_0x2c45('0x1a')](_0x1913a8,_0x7623b8);};VoiceDialReport[_0x2c45('0x19')][_0x2c45('0xf')]=function(_0x497e3b){try{if(this[_0x2c45('0x17')](_0x497e3b)){if(this['channels'][_0x497e3b['uniqueid']]){_[_0x2c45('0x1b')](this[_0x2c45('0xa')][_0x497e3b[_0x2c45('0x1c')]],{'starttime':moment()[_0x2c45('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x2c45('0x1e'),'interface':_0x497e3b[_0x2c45('0x1f')][_0x2c45('0x20')](0x0,_0x497e3b[_0x2c45('0x1f')][_0x2c45('0x21')]('-')),'membername':_0x497e3b[_0x2c45('0x1f')][_0x2c45('0x20')](_0x497e3b[_0x2c45('0x1f')][_0x2c45('0x21')]('/')+0x1,_0x497e3b[_0x2c45('0x1f')][_0x2c45('0x21')]('-'))},_[_0x2c45('0x22')](_0x497e3b,[_0x2c45('0x23'),_0x2c45('0x24')]));this[_0x2c45('0x1a')](_0x2c45('0x25'),_0x2c45('0x26'),this[_0x2c45('0xa')][_0x497e3b[_0x2c45('0x1c')]]);ami[_0x2c45('0x1a')]('custom:dialbegin',this[_0x2c45('0xa')][_0x497e3b[_0x2c45('0x1c')]]);}}}catch(_0x1095fe){logger[_0x2c45('0x27')](_0x2c45('0x28'),util[_0x2c45('0x29')](_0x1095fe,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2c45('0x19')]['syncDialEnd']=function(_0x5cfe1b){try{if(this['isNotNull'](_0x5cfe1b)){if(this['channels'][_0x5cfe1b[_0x2c45('0x1c')]]){this[_0x2c45('0xa')][_0x5cfe1b['uniqueid']]['dialstatus']=_0x5cfe1b[_0x2c45('0x2a')];if(_0x5cfe1b[_0x2c45('0x2a')]===_0x2c45('0x2b')){this[_0x2c45('0xa')][_0x5cfe1b[_0x2c45('0x1c')]][_0x2c45('0x2c')]=_0x5cfe1b[_0x2c45('0x2c')];this[_0x2c45('0xa')][_0x5cfe1b[_0x2c45('0x1c')]][_0x2c45('0x2d')]=_0x5cfe1b['connectedlinename'];this[_0x2c45('0xa')][_0x5cfe1b[_0x2c45('0x1c')]][_0x2c45('0x2e')]=moment()[_0x2c45('0x1d')](_0x2c45('0x2f'));this[_0x2c45('0xa')][_0x5cfe1b[_0x2c45('0x1c')]][_0x2c45('0x30')]=_0x2c45('0x31');ami['emit'](_0x2c45('0x32'),this[_0x2c45('0xa')][_0x5cfe1b[_0x2c45('0x1c')]]);}this[_0x2c45('0x1a')]('voice:outbound',_0x2c45('0x26'),this[_0x2c45('0xa')][_0x5cfe1b['uniqueid']]);}}}catch(_0x438865){logger['error'](_0x2c45('0x33'),util['inspect'](_0x438865,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2c45('0x19')][_0x2c45('0x14')]=function(_0xd0b0cb){try{if(this[_0x2c45('0x17')](_0xd0b0cb)){this[_0x2c45('0x34')](_0xd0b0cb[_0x2c45('0x1c')],_[_0x2c45('0x35')](_0xd0b0cb[_0x2c45('0x36')])[0x0],_0xd0b0cb[_0x2c45('0x37')]);if(this['isNotNull'](_0xd0b0cb[_0x2c45('0x36')])&&this[_0x2c45('0x17')](_0xd0b0cb[_0x2c45('0x36')][_0x2c45('0x38')])){if(_[_0x2c45('0x18')](this['channels'][_0xd0b0cb[_0x2c45('0x1c')]])){this['channels'][_0xd0b0cb[_0x2c45('0x1c')]]={'routeId':_0xd0b0cb[_0x2c45('0x37')],'variables':this[_0x2c45('0xd')][_0xd0b0cb[_0x2c45('0x1c')]]};this['emit'](_0x2c45('0x25'),_0x2c45('0x26'),this[_0x2c45('0xa')][_0xd0b0cb[_0x2c45('0x1c')]]);}}}}catch(_0x319c9e){logger[_0x2c45('0x27')](_0x2c45('0x39'),util[_0x2c45('0x29')](_0x319c9e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x5b9e13,_0x527199,_0x572e6a){var _0x1228fb=[_0x2c45('0x3a'),_0x2c45('0x3b'),_0x2c45('0x3c'),_0x2c45('0x3d'),_0x2c45('0x3e'),_0x2c45('0x3f'),_0x2c45('0x40'),_0x2c45('0x41'),_0x2c45('0x42'),_0x2c45('0x43'),_0x2c45('0x44'),_0x2c45('0x45'),_0x2c45('0x46'),_0x2c45('0x47'),_0x2c45('0x48'),_0x2c45('0x49'),'membername','memberpenalty',_0x2c45('0x4a')];if(!_['isNil'](_0x527199)&&!_[_0x2c45('0x4b')](_0x1228fb,_0x527199)){if(_[_0x2c45('0x18')](this['variables'][_0x5b9e13])){this[_0x2c45('0xd')][_0x5b9e13]={};}this[_0x2c45('0xd')][_0x5b9e13][_0x527199]=_0x572e6a;}};VoiceDialReport[_0x2c45('0x19')][_0x2c45('0x16')]=function(_0x4ea0ba){try{if(this[_0x2c45('0x17')](_0x4ea0ba)){if(this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]]){this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x4c')]=moment()['format'](_0x2c45('0x2f'));this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x4d')]=moment(this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x4c')])[_0x2c45('0x4e')](this['channels'][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x4f')],'seconds');this[_0x2c45('0xa')][_0x4ea0ba['uniqueid']]['lastevent']=_0x2c45('0x50');this[_0x2c45('0xc')][_0x2c45('0x51')]+=0x1;if(this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x2e')]){this['outbound'][_0x2c45('0x52')]+=0x1;this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x53')]=moment(this['channels'][_0x4ea0ba[_0x2c45('0x1c')]]['answertime'])['diff'](this['channels'][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x4f')],'seconds');this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x54')]=moment(this['channels'][_0x4ea0ba['uniqueid']]['endtime'])[_0x2c45('0x4e')](this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x2e')],_0x2c45('0x55'));this[_0x2c45('0xc')][_0x2c45('0x56')]+=this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x53')]||0x0;this['outbound'][_0x2c45('0x57')]+=this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]]['billableseconds'];}this[_0x2c45('0xc')][_0x2c45('0x58')]+=this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]][_0x2c45('0x4d')];ami[_0x2c45('0x1a')](_0x2c45('0x59'),this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]]);ami[_0x2c45('0x1a')](_0x2c45('0x5a'),this[_0x2c45('0xa')][_0x4ea0ba['uniqueid']]);this['emit'](_0x2c45('0x25'),'voice_outbound:save',this[_0x2c45('0xc')]);logger[_0x2c45('0x5b')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]]));this[_0x2c45('0x1a')]('voice:outbound','voice_outbound_channel:remove',this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]]);delete this[_0x2c45('0xa')][_0x4ea0ba[_0x2c45('0x1c')]];}if(this[_0x2c45('0xd')][_0x4ea0ba[_0x2c45('0x1c')]]){delete this[_0x2c45('0xd')][_0x4ea0ba['uniqueid']];}}}catch(_0x557fb5){logger['error']('[syncHangup][VoiceDialReport]',util[_0x2c45('0x29')](_0x557fb5,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index bac4b06..37afa17 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 _0x6e37=['strategy','answered','available','sumBillable','sumHoldTime','total','abandoned','waiting','Trunk','callerid','Interval','stringify','voice_queue:save','clearZombieChannels','queues','catch','loopQueueSummary','flagQueueSummary','then','syncQueueSummary','isNotNull','queue','callers','loggedIn','toNumber','loggedin','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','syncQueueCallerJoin','uniqueid','position','count','merge','pick','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','syncQueueCallerAbandon','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','lastAssignedTo','queuecallerexitAt','transfer','reason','COMPLETED','linkedid','queuecallerexit','seconds','YYYY-MM-DD\x20HH:mm:ss','transfertype','FORWARD','destexten','COMPLETEDBY','toUpperCase','syncVarSet','variable','value','CONTINUE','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','unmanaged','diff','queuecallerjoinAt','sumDuration','milliseconds','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','transferexten','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLIND','extension','context','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','mohstarttime','moment','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','tail','finally','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','bind','syncQueueSummaryComplete','queuecallerjoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isUndefined','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','isEmpty','unlockRR','prototype','switch','sequence','enqueue','isNil','Action','channel','message','No\x20such\x20channel','[voiceQueueReport][checkChannel]','queueReports','error','[voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','name','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','type','inbound'];(function(_0x4a8a22,_0x2fb873){var _0x3d5522=function(_0x568aa1){while(--_0x568aa1){_0x4a8a22['push'](_0x4a8a22['shift']());}};_0x3d5522(++_0x2fb873);}(_0x6e37,0x13a));var _0x76e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e37[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0x76e3('0x0'));var BPromise=require('bluebird');var util=require('util');var md5=require(_0x76e3('0x1'));var Redis=require(_0x76e3('0x2'));var config=require(_0x76e3('0x3'));var logger=require(_0x76e3('0x4'))(_0x76e3('0x5'));var ami=require(_0x76e3('0x6'));var QueueReport=require('../model/queueReport');config[_0x76e3('0x7')]=_[_0x76e3('0x8')](config[_0x76e3('0x7')],{'host':_0x76e3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x76e3('0x7')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x49f3a3){this['tail']=this[_0x76e3('0xa')]?this[_0x76e3('0xa')][_0x76e3('0xb')](_0x49f3a3):_0x49f3a3();};function VoiceQueueReport(_0x50c5c0){this['sequence']=new Sequence();this['queueReports']={};this[_0x76e3('0xc')]=_0x50c5c0[_0x76e3('0xc')];this[_0x76e3('0xd')]=_0x50c5c0[_0x76e3('0xe')];this[_0x76e3('0xf')]=_0x50c5c0[_0x76e3('0xf')];this['flagQueueSummary']=!![];this[_0x76e3('0x10')]=_0x50c5c0[_0x76e3('0x10')];this[_0x76e3('0x11')]={};ami['on'](_0x76e3('0x12'),this['syncQueueSummary'][_0x76e3('0x13')](this));ami['on']('queuesummarycomplete',this[_0x76e3('0x14')][_0x76e3('0x13')](this));ami['on'](_0x76e3('0x15'),this['syncQueueCallerJoin']['bind'](this));ami['on'](_0x76e3('0x16'),this['syncQueueCallerAbandon'][_0x76e3('0x13')](this));ami['on'](_0x76e3('0x17'),this[_0x76e3('0x18')][_0x76e3('0x13')](this));ami['on']('agentcomplete',this[_0x76e3('0x19')][_0x76e3('0x13')](this));ami['on'](_0x76e3('0x1a'),this[_0x76e3('0x1b')][_0x76e3('0x13')](this));ami['on']('varset',this['syncVarSet'][_0x76e3('0x13')](this));ami['on'](_0x76e3('0x1c'),this[_0x76e3('0x1d')][_0x76e3('0x13')](this));ami['on']('fullybooted',this['syncFullyBooted'][_0x76e3('0x13')](this));ami['on']('musiconholdstart',this[_0x76e3('0x1e')][_0x76e3('0x13')](this));ami['on'](_0x76e3('0x1f'),this[_0x76e3('0x20')][_0x76e3('0x13')](this));ami['on'](_0x76e3('0x21'),this[_0x76e3('0x22')][_0x76e3('0x13')](this));ami['on'](_0x76e3('0x23'),this[_0x76e3('0x24')][_0x76e3('0x13')](this));this['loopQueueSummary']();this[_0x76e3('0x25')]();}function isNotNull(_0x353bf3){return _0x353bf3!==null&&!_[_0x76e3('0x26')](_0x353bf3);}function clearChannels(_0x21a51f){if(!_['isEmpty'](_0x21a51f)){for(var _0x3d8aa6 in _0x21a51f){if(_0x21a51f[_0x76e3('0x27')](_0x3d8aa6)){delete _0x21a51f[_0x3d8aa6];}}}}function clearCampaigns(_0x49db0e){if(!_['isEmpty'](_0x49db0e)){for(var _0x3541cf in _0x49db0e){if(_0x49db0e[_0x76e3('0x27')](_0x3541cf)){_0x49db0e[_0x3541cf][_0x76e3('0x28')]=0x0;}}}}function clearVoiceQueues(_0x296cd3){if(!_['isEmpty'](_0x296cd3)){for(var _0x132a00 in _0x296cd3){if(_0x296cd3[_0x76e3('0x27')](_0x132a00)){_0x296cd3[_0x132a00]['originated']=0x0;_0x296cd3[_0x132a00][_0x76e3('0x29')]=0x0;_0x296cd3[_0x132a00][_0x76e3('0x2a')]=0x0;_0x296cd3[_0x132a00]['waiting']=0x0;_0x296cd3[_0x132a00][_0x76e3('0x2b')]=!![];}}}}function clearAgentBooked(_0x3a5ea2){if(!_[_0x76e3('0x2c')](_0x3a5ea2)){for(var _0x3d4433 in _0x3a5ea2){if(_0x3a5ea2[_0x76e3('0x27')](_0x3d4433)){_0x3a5ea2[_0x3d4433][_0x76e3('0x2d')]=!![];}}}}VoiceQueueReport[_0x76e3('0x2e')]['clearZombieChannels']=function(){var _0x4064e1=this;for(var _0x4216e3 in this[_0x76e3('0xd')]){if(this[_0x76e3('0xd')][_0x76e3('0x27')](_0x4216e3)&&!this[_0x76e3('0xd')][_0x4216e3][_0x76e3('0x2f')]){this[_0x76e3('0x30')][_0x76e3('0x31')](function(){if(!_[_0x76e3('0x32')](_0x4064e1[_0x76e3('0xd')][_0x4216e3])){return ami[_0x76e3('0x33')]({'action':'status','channel':_0x4064e1['channels'][_0x4216e3][_0x76e3('0x34')]})['catch'](function(_0x82b358){if(_0x82b358[_0x76e3('0x35')]===_0x76e3('0x36')){setTimeout(function(){if(_0x4064e1['channels'][_0x4216e3]){delete _0x4064e1[_0x76e3('0xd')][_0x4216e3];logger['error'](_0x76e3('0x37'),_0x4216e3);}if(_0x4064e1[_0x76e3('0x38')][_0x4216e3]){delete _0x4064e1[_0x76e3('0x38')][_0x4216e3];logger[_0x76e3('0x39')]('[voiceQueueReport][checkQueueReport]',_0x4216e3);}if(_0x4064e1[_0x76e3('0x11')][_0x4216e3]){delete _0x4064e1[_0x76e3('0x11')][_0x4216e3];logger[_0x76e3('0x39')](_0x76e3('0x3a'),_0x4216e3);}},0x1f40);}});}});}}};VoiceQueueReport[_0x76e3('0x2e')]['syncFullyBooted']=function(){logger[_0x76e3('0x39')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x76e3('0xd')]);this[_0x76e3('0x3b')](this[_0x76e3('0x38')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x76e3('0xf')]);clearCampaigns(this[_0x76e3('0x10')]);};VoiceQueueReport['prototype']['clearQueueReport']=function(_0x2aac70){var _0xf4d316=this;if(!_['isEmpty'](_0x2aac70)){for(var _0x214f93 in _0x2aac70){if(_0x2aac70[_0x76e3('0x27')](_0x214f93)){_0xf4d316[_0x76e3('0x3c')](_0x2aac70[_0x214f93]);delete _0x2aac70[_0x214f93];}}}};function loggerCatch(_0x4188d0){return function(_0x4062d8){logger[_0x76e3('0x39')](_0x4188d0,util[_0x76e3('0x3d')](_0x4062d8,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x3e')]=function(_0x33d016,_0x23ad0e,_0x4c6a24){io['to'](_0x33d016)[_0x76e3('0x3e')](_0x23ad0e,_0x4c6a24);};VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x3f')]=function(_0x37f6a9){this[_0x76e3('0x3e')](util['format'](_0x76e3('0x40'),_0x37f6a9[_0x76e3('0x41')]),'voice_queue_channel:save',_0x37f6a9);};VoiceQueueReport['prototype'][_0x76e3('0x3c')]=function(_0x4603c1){logger[_0x76e3('0x42')](_0x76e3('0x43'),JSON['stringify'](_0x4603c1));this[_0x76e3('0x3e')](util[_0x76e3('0x44')](_0x76e3('0x40'),_0x4603c1[_0x76e3('0x41')]),_0x76e3('0x45'),_0x4603c1);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0xb2c7f9){if(_0xb2c7f9[_0x76e3('0x46')]===_0x76e3('0x47')){var _0x333780={'id':_0xb2c7f9['id'],'name':_0xb2c7f9[_0x76e3('0x41')],'strategy':_0xb2c7f9[_0x76e3('0x48')],'answered':_0xb2c7f9[_0x76e3('0x49')],'available':_0xb2c7f9[_0x76e3('0x4a')],'loggedIn':_0xb2c7f9['loggedIn'],'pTalking':_0xb2c7f9[_0x76e3('0x2a')],'sumBillable':_0xb2c7f9[_0x76e3('0x4b')],'sumDuration':_0xb2c7f9['sumDuration'],'sumHoldTime':_0xb2c7f9[_0x76e3('0x4c')]||0x0,'talking':_0xb2c7f9[_0x76e3('0x29')],'total':_0xb2c7f9[_0x76e3('0x4d')],'type':_0xb2c7f9[_0x76e3('0x46')],'unmanaged':_0xb2c7f9['unmanaged'],'abandoned':_0xb2c7f9[_0x76e3('0x4e')],'waiting':_0xb2c7f9[_0x76e3('0x4f')]};if(_0xb2c7f9[_0x76e3('0x50')]){_0x333780[_0x76e3('0x50')]={'id':_0xb2c7f9[_0x76e3('0x50')]['id'],'name':_0xb2c7f9[_0x76e3('0x50')][_0x76e3('0x41')],'active':_0xb2c7f9[_0x76e3('0x50')]['active'],'callerid':_0xb2c7f9[_0x76e3('0x50')][_0x76e3('0x51')]};}if(_0xb2c7f9[_0x76e3('0x52')]){_0x333780[_0x76e3('0x52')]={'id':_0xb2c7f9[_0x76e3('0x52')]['id'],'name':_0xb2c7f9['Interval'][_0x76e3('0x41')]};}var _0x282b8c=md5(JSON[_0x76e3('0x53')](_0x333780));if(_0xb2c7f9[_0x76e3('0x1')]!==_0x282b8c){_0xb2c7f9['md5']=_0x282b8c;this['emit'](util[_0x76e3('0x44')]('voice:queue:%s',_0x333780[_0x76e3('0x41')]),_0x76e3('0x54'),_0x333780);}}};VoiceQueueReport[_0x76e3('0x2e')]['isNotNull']=function(_0x358601){return _0x358601!==null&&!_[_0x76e3('0x26')](_0x358601);};VoiceQueueReport['prototype'][_0x76e3('0x25')]=function(){var _0x3d48d4=this;setInterval(function(){_0x3d48d4[_0x76e3('0x55')]();ami[_0x76e3('0x33')]({'action':_0x76e3('0x56')})[_0x76e3('0x57')](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport['prototype'][_0x76e3('0x58')]=function(){var _0x59e169=this;setInterval(function(){if(_0x59e169[_0x76e3('0x59')]){return ami[_0x76e3('0x33')]({'action':'queuesummary'})[_0x76e3('0x5a')](function(_0x3f479b){_0x59e169[_0x76e3('0x59')]=![];})[_0x76e3('0x57')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport['prototype'][_0x76e3('0x5b')]=function(_0x441ce3){try{if(this[_0x76e3('0x5c')](_0x441ce3)&&this[_0x76e3('0x5c')](_0x441ce3[_0x76e3('0x5d')])){if(this[_0x76e3('0xf')][_0x441ce3[_0x76e3('0x5d')]]){var _0x2d5ae3=_['countBy'](this['channels'],_0x76e3('0x5d'))[_0x441ce3['queue']]||0x0;var _0x228a64=_0x2d5ae3-_0x441ce3[_0x76e3('0x5e')];if(this['voiceQueues'][_0x441ce3[_0x76e3('0x5d')]][_0x76e3('0x4f')]!==_['toNumber'](_0x441ce3[_0x76e3('0x5e')])||this['voiceQueues'][_0x441ce3[_0x76e3('0x5d')]][_0x76e3('0x5f')]!==_[_0x76e3('0x60')](_0x441ce3[_0x76e3('0x61')])||this[_0x76e3('0xf')][_0x441ce3['queue']]['available']!==_['toNumber'](_0x441ce3[_0x76e3('0x4a')])||this[_0x76e3('0xf')][_0x441ce3[_0x76e3('0x5d')]][_0x76e3('0x29')]!==_0x228a64){this[_0x76e3('0xf')][_0x441ce3[_0x76e3('0x5d')]][_0x76e3('0x4f')]=_[_0x76e3('0x60')](_0x441ce3['callers']);this['voiceQueues'][_0x441ce3[_0x76e3('0x5d')]][_0x76e3('0x5f')]=_[_0x76e3('0x60')](_0x441ce3[_0x76e3('0x61')]);this[_0x76e3('0xf')][_0x441ce3[_0x76e3('0x5d')]][_0x76e3('0x4a')]=_[_0x76e3('0x60')](_0x441ce3[_0x76e3('0x4a')]);this['voiceQueues'][_0x441ce3['queue']][_0x76e3('0x29')]=_0x228a64>0x0?_0x228a64:0x0;this[_0x76e3('0xf')][_0x441ce3[_0x76e3('0x5d')]]['talking']=this[_0x76e3('0xf')][_0x441ce3[_0x76e3('0x5d')]][_0x76e3('0x29')]>_[_0x76e3('0x60')](_0x441ce3['loggedin'])?_[_0x76e3('0x60')](_0x441ce3[_0x76e3('0x61')]):this['voiceQueues'][_0x441ce3['queue']]['talking'];this[_0x76e3('0x62')](this[_0x76e3('0xf')][_0x441ce3[_0x76e3('0x5d')]]);}ami[_0x76e3('0x3e')](_0x76e3('0x63'),this[_0x76e3('0xf')][_0x441ce3[_0x76e3('0x5d')]]);}}}catch(_0x434e7c){logger[_0x76e3('0x39')](_0x76e3('0x64'),util[_0x76e3('0x3d')](_0x434e7c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x2b7b72){this[_0x76e3('0x59')]=!![];};VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x65')]=function(_0x2e7717){};VoiceQueueReport['prototype'][_0x76e3('0x66')]=function(_0x14b648){try{if(this[_0x76e3('0x5c')](_0x14b648)){if(_[_0x76e3('0x26')](this[_0x76e3('0x38')][_0x14b648['uniqueid']])){this['queueReports'][_0x14b648[_0x76e3('0x67')]]=[];this[_0x76e3('0xd')][_0x14b648[_0x76e3('0x67')]]={};}var _0x538124=new QueueReport();_0x538124[_0x76e3('0x41')]=_0x14b648[_0x76e3('0x5d')];_0x538124[_0x76e3('0x46')]=this[_0x76e3('0xf')][_0x538124[_0x76e3('0x41')]]&&this[_0x76e3('0xf')][_0x538124['name']][_0x76e3('0x46')]?this[_0x76e3('0xf')][_0x538124[_0x76e3('0x41')]][_0x76e3('0x46')]||'inbound':_0x76e3('0x47');_0x538124['queue']=_0x14b648[_0x76e3('0x5d')];_0x538124['queuecallerjoinAt']=moment()[_0x76e3('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x538124['position']=_0x14b648[_0x76e3('0x68')];_0x538124[_0x76e3('0x69')]=_0x14b648[_0x76e3('0x69')];_[_0x76e3('0x6a')](_0x538124,_[_0x76e3('0x6b')](_0x14b648,_[_0x76e3('0x6c')](_0x538124)));this['queueReports'][_0x14b648[_0x76e3('0x67')]][_0x76e3('0x6d')](_0x538124);this[_0x76e3('0xd')][_0x14b648['uniqueid']]=_0x538124;this[_0x76e3('0x3f')](_0x538124);}}catch(_0x4dd75c){logger[_0x76e3('0x39')](_0x76e3('0x6e'),util[_0x76e3('0x3d')](_0x4dd75c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x6f')]=function(_0x586b45){try{if(this['isNotNull'](_0x586b45)){if(this[_0x76e3('0x38')][_0x586b45[_0x76e3('0x67')]]){var _0x10e8a1=_[_0x76e3('0x70')](this[_0x76e3('0x38')][_0x586b45[_0x76e3('0x67')]]);_0x10e8a1[_0x76e3('0x71')]=![];_0x10e8a1[_0x76e3('0x72')]=null;_0x10e8a1['holdtime']=_0x586b45[_0x76e3('0x73')];_0x10e8a1[_0x76e3('0x74')]=_0x586b45[_0x76e3('0x74')];_0x10e8a1[_0x76e3('0x16')]=!![];_0x10e8a1[_0x76e3('0x75')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x10e8a1[_0x76e3('0x76')]=_0x76e3('0x77');_0x10e8a1['lastAssignedTo']=null;this[_0x76e3('0xd')][_0x586b45[_0x76e3('0x67')]]=_0x10e8a1;this['emitVoiceQueueChannelRemove'](_0x10e8a1);}}}catch(_0xa0be0f){logger['error'](_0x76e3('0x78'),util[_0x76e3('0x3d')](_0xa0be0f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x18')]=function(_0x47e6ae){try{if(this[_0x76e3('0x5c')](_0x47e6ae)){if(this[_0x76e3('0x38')][_0x47e6ae[_0x76e3('0x67')]]){var _0x87417e=_[_0x76e3('0x70')](this['queueReports'][_0x47e6ae[_0x76e3('0x67')]]);_0x87417e[_0x76e3('0x79')]=moment()[_0x76e3('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x87417e[_0x76e3('0x7a')]=_0x47e6ae[_0x76e3('0x7a')];_0x87417e[_0x76e3('0x7b')]=_0x47e6ae[_0x76e3('0x7b')];this['channels'][_0x47e6ae[_0x76e3('0x67')]]=_0x87417e;this[_0x76e3('0x3f')](_0x87417e);}}}catch(_0x3fd7a6){logger[_0x76e3('0x39')](_0x76e3('0x7c'),util['inspect'](_0x3fd7a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x1b')]=function(_0x5096b8){try{if(this[_0x76e3('0x5c')](_0x5096b8)){if(this[_0x76e3('0x38')][_0x5096b8[_0x76e3('0x67')]]){var _0x58a671=_[_0x76e3('0x70')](this[_0x76e3('0x38')][_0x5096b8['uniqueid']]);_0x58a671['queuecallercomplete']=!![];_0x58a671[_0x76e3('0x76')]=_0x76e3('0x7d');}}}catch(_0x3d3184){logger[_0x76e3('0x39')](_0x76e3('0x7e'),util[_0x76e3('0x3d')](_0x3d3184,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x19')]=function(_0x2c52ee){try{if(this['isNotNull'](_0x2c52ee)){if(this[_0x76e3('0x38')][_0x2c52ee[_0x76e3('0x67')]]){var _0x2e17b9=_[_0x76e3('0x70')](this[_0x76e3('0x38')][_0x2c52ee['uniqueid']]);_0x2e17b9[_0x76e3('0x16')]=![];_0x2e17b9[_0x76e3('0x75')]=null;_0x2e17b9[_0x76e3('0x7f')]=!![];_0x2e17b9[_0x76e3('0x80')]=_0x2c52ee['membername'];_0x2e17b9[_0x76e3('0x73')]=_0x2c52ee[_0x76e3('0x73')];_0x2e17b9[_0x76e3('0x71')]=!![];_0x2e17b9['queuecallerexit']=![];_0x2e17b9[_0x76e3('0x81')]=null;if(!_0x2e17b9[_0x76e3('0x82')]){if(_0x2c52ee[_0x76e3('0x83')]=='transfer'){_0x2e17b9['queuecallerexitreason']=_0x76e3('0x84');}else{if(_['startsWith'](_0x2c52ee[_0x76e3('0x34')]['toLowerCase'](),'local/')){if(this['queueReports'][_0x2c52ee[_0x76e3('0x85')]]){var _0xa6ddea=_[_0x76e3('0x70')](this[_0x76e3('0x38')][_0x2c52ee['linkedid']]);_0xa6ddea[_0x76e3('0x71')]=![];_0xa6ddea[_0x76e3('0x86')]=!![];_0xa6ddea[_0x76e3('0x81')]=moment(_0x2e17b9['queuecallerjoinAt'])['add'](_0x2c52ee['holdtime'],_0x76e3('0x87'))[_0x76e3('0x44')](_0x76e3('0x88'));_0xa6ddea['queuecallerexitreason']='FORWARDTRANSFER';_0xa6ddea['transfer']=!![];_0xa6ddea[_0x76e3('0x89')]=_0x76e3('0x8a');_0xa6ddea['transferexten']=_0x2c52ee[_0x76e3('0x8b')];_0xa6ddea['transferuniqueid']=_0x2c52ee['uniqueid'];var _0x45a69a=this[_0x76e3('0x38')][_0x2c52ee['linkedid']];this[_0x76e3('0x38')][_0x2c52ee[_0x76e3('0x85')]]=this[_0x76e3('0x38')][_0x2c52ee['uniqueid']];this[_0x76e3('0x38')][_0x2c52ee[_0x76e3('0x67')]]=_0x45a69a;}}else{_0x2e17b9[_0x76e3('0x76')]=_0x76e3('0x8c')+_0x2c52ee[_0x76e3('0x83')][_0x76e3('0x8d')]();}}}this[_0x76e3('0xd')][_0x2c52ee[_0x76e3('0x67')]]=_0x2e17b9;this[_0x76e3('0x3c')](_0x2e17b9);}}}catch(_0x5c7369){logger['error']('[syncAgentComplete][VoiceQueueReport]',util[_0x76e3('0x3d')](_0x5c7369,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x76e3('0x8e')]=function(_0x305094){try{if(this[_0x76e3('0x5c')](_0x305094)){this['addVariable'](_0x305094['uniqueid'],_[_0x76e3('0x6c')](_0x305094[_0x76e3('0x8f')])[0x0],_0x305094[_0x76e3('0x90')]);if(this[_0x76e3('0x38')][_0x305094[_0x76e3('0x67')]]){var _0x22602d=_['last'](this[_0x76e3('0x38')][_0x305094[_0x76e3('0x67')]]);if(_0x22602d){if(this[_0x76e3('0x5c')](_0x305094[_0x76e3('0x8f')])&&this[_0x76e3('0x5c')](_0x305094[_0x76e3('0x8f')]['queuestatus'])){switch(_0x305094[_0x76e3('0x90')]){case _0x76e3('0x91'):_0x22602d[_0x76e3('0x86')]=![];_0x22602d[_0x76e3('0x81')]=null;break;case'TIMEOUT':_0x22602d[_0x76e3('0x92')]=_0x76e3('0x93');ami[_0x76e3('0x3e')](_0x76e3('0x94'),_0x22602d);break;default:_0x22602d[_0x76e3('0x86')]=!![];_0x22602d['queuecallerexitAt']=moment()[_0x76e3('0x44')](_0x76e3('0x88'));_0x22602d[_0x76e3('0x79')]=moment()[_0x76e3('0x44')]('YYYY-MM-DD\x20HH:mm:ss');}_0x22602d['queuecallerabandon']=![];_0x22602d[_0x76e3('0x75')]=null;_0x22602d[_0x76e3('0x76')]=_0x305094[_0x76e3('0x90')];this['channels'][_0x305094[_0x76e3('0x67')]]=_0x22602d;this[_0x76e3('0x3c')](_0x22602d);}else if(this[_0x76e3('0x5c')](_0x305094['variable'])&&this[_0x76e3('0x5c')](_0x305094['variable'][_0x76e3('0x95')])){if(!_0x22602d[_0x76e3('0x16')]){_0x22602d[_0x76e3('0x86')]=!![];_0x22602d[_0x76e3('0x81')]=moment()[_0x76e3('0x44')](_0x76e3('0x88'));_0x22602d[_0x76e3('0x76')]=_0x76e3('0x96');_0x22602d[_0x76e3('0x79')]=moment()[_0x76e3('0x44')](_0x76e3('0x88'));this[_0x76e3('0xd')][_0x305094['uniqueid']]=_0x22602d;}}_0x22602d[_0x76e3('0x11')]=this['variables'][_0x305094[_0x76e3('0x67')]];}}}}catch(_0x2fd103){logger[_0x76e3('0x39')]('[syncVarSet][VoiceQueueReport]',util[_0x76e3('0x3d')](_0x2fd103,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x97')]=function(_0x397032,_0x2ff7d1,_0x18826b){var _0x39a4e8=[_0x76e3('0x98'),_0x76e3('0x99'),'rtpaudioqosjitter',_0x76e3('0x9a'),_0x76e3('0x9b'),_0x76e3('0x9c'),_0x76e3('0x9d'),'rtpaudioqosrttbridged',_0x76e3('0x9e'),_0x76e3('0x9f'),'bridgepeer',_0x76e3('0xa0'),_0x76e3('0xa1'),'memberdynamic',_0x76e3('0xa2'),_0x76e3('0xa3'),'membername',_0x76e3('0xa4'),_0x76e3('0xa5')];if(!_[_0x76e3('0x32')](_0x2ff7d1)&&!_[_0x76e3('0xa6')](_0x39a4e8,_0x2ff7d1)){if(_[_0x76e3('0x26')](this[_0x76e3('0x11')][_0x397032])){this['variables'][_0x397032]={};}this[_0x76e3('0x11')][_0x397032][_0x2ff7d1]=_0x18826b;}};VoiceQueueReport[_0x76e3('0x2e')][_0x76e3('0x1d')]=function(_0x4d8621){try{if(this[_0x76e3('0x5c')](_0x4d8621)){if(this['queueReports'][_0x4d8621[_0x76e3('0x67')]]){for(var _0x189264=0x0,_0x56c735={};_0x1892640x0?_0x406bf0:0x0;this[_0x9877('0xf')][_0x1f26df[_0x9877('0x5b')]][_0x9877('0x2a')]=this['voiceQueues'][_0x1f26df[_0x9877('0x5b')]][_0x9877('0x2a')]>_['toNumber'](_0x1f26df[_0x9877('0x5e')])?_[_0x9877('0x5d')](_0x1f26df[_0x9877('0x5e')]):this[_0x9877('0xf')][_0x1f26df['queue']][_0x9877('0x2a')];this[_0x9877('0x45')](this[_0x9877('0xf')][_0x1f26df[_0x9877('0x5b')]]);}ami[_0x9877('0x3d')](_0x9877('0x5f'),this[_0x9877('0xf')][_0x1f26df['queue']]);}}}catch(_0x3e8666){logger[_0x9877('0x35')](_0x9877('0x60'),util[_0x9877('0x3c')](_0x3e8666,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9877('0x16')]=function(_0x3bc04b){this[_0x9877('0x10')]=!![];};VoiceQueueReport[_0x9877('0x9')][_0x9877('0x61')]=function(_0x2ded30){};VoiceQueueReport[_0x9877('0x9')][_0x9877('0x62')]=function(_0x3e9705){try{if(this[_0x9877('0x53')](_0x3e9705)){if(_['isUndefined'](this[_0x9877('0xc')][_0x3e9705['uniqueid']])){this[_0x9877('0xc')][_0x3e9705[_0x9877('0x63')]]=[];this['channels'][_0x3e9705[_0x9877('0x63')]]={};}var _0x19e116=new QueueReport();_0x19e116[_0x9877('0x3f')]=_0x3e9705['queue'];_0x19e116[_0x9877('0x46')]=this[_0x9877('0xf')][_0x19e116[_0x9877('0x3f')]]&&this[_0x9877('0xf')][_0x19e116['name']]['type']?this[_0x9877('0xf')][_0x19e116[_0x9877('0x3f')]][_0x9877('0x46')]||'inbound':_0x9877('0x47');_0x19e116[_0x9877('0x5b')]=_0x3e9705[_0x9877('0x5b')];_0x19e116[_0x9877('0x64')]=moment()[_0x9877('0x3e')](_0x9877('0x65'));_0x19e116[_0x9877('0x66')]=_0x3e9705[_0x9877('0x66')];_0x19e116[_0x9877('0x67')]=_0x3e9705[_0x9877('0x67')];_[_0x9877('0x68')](_0x19e116,_[_0x9877('0x69')](_0x3e9705,_['keys'](_0x19e116)));this['queueReports'][_0x3e9705['uniqueid']]['push'](_0x19e116);this[_0x9877('0xe')][_0x3e9705[_0x9877('0x63')]]=_0x19e116;this[_0x9877('0x6a')](_0x19e116);}}catch(_0x40819d){logger[_0x9877('0x35')](_0x9877('0x6b'),util['inspect'](_0x40819d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9877('0x9')][_0x9877('0x19')]=function(_0xd952f4){try{if(this[_0x9877('0x53')](_0xd952f4)){if(this['queueReports'][_0xd952f4['uniqueid']]){var _0x7e41f4=_[_0x9877('0x6c')](this[_0x9877('0xc')][_0xd952f4[_0x9877('0x63')]]);_0x7e41f4[_0x9877('0x6d')]=![];_0x7e41f4[_0x9877('0x6e')]=null;_0x7e41f4[_0x9877('0x6f')]=_0xd952f4['holdtime'];_0x7e41f4[_0x9877('0x70')]=_0xd952f4[_0x9877('0x70')];_0x7e41f4[_0x9877('0x18')]=!![];_0x7e41f4[_0x9877('0x71')]=moment()[_0x9877('0x3e')](_0x9877('0x65'));_0x7e41f4[_0x9877('0x72')]='ABANDONED';_0x7e41f4[_0x9877('0x73')]=null;this['channels'][_0xd952f4[_0x9877('0x63')]]=_0x7e41f4;this[_0x9877('0x74')](_0x7e41f4);}}}catch(_0x182bda){logger[_0x9877('0x35')](_0x9877('0x75'),util['inspect'](_0x182bda,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9877('0x9')]['syncQueueCallerLeave']=function(_0xb9dec0){try{if(this['isNotNull'](_0xb9dec0)){if(this[_0x9877('0xc')][_0xb9dec0['uniqueid']]){var _0x4184d3=_[_0x9877('0x6c')](this[_0x9877('0xc')][_0xb9dec0[_0x9877('0x63')]]);_0x4184d3['queuecallerleaveAt']=moment()[_0x9877('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4184d3[_0x9877('0x76')]=_0xb9dec0[_0x9877('0x76')];_0x4184d3['connectedlinename']=_0xb9dec0[_0x9877('0x77')];this[_0x9877('0xe')][_0xb9dec0[_0x9877('0x63')]]=_0x4184d3;this[_0x9877('0x6a')](_0x4184d3);}}}catch(_0x85877f){logger[_0x9877('0x35')](_0x9877('0x78'),util[_0x9877('0x3c')](_0x85877f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9877('0x9')][_0x9877('0x1c')]=function(_0x58fb63){try{if(this[_0x9877('0x53')](_0x58fb63)){if(this[_0x9877('0xc')][_0x58fb63[_0x9877('0x63')]]){var _0x5812dc=_[_0x9877('0x6c')](this[_0x9877('0xc')][_0x58fb63['uniqueid']]);_0x5812dc[_0x9877('0x6d')]=!![];_0x5812dc[_0x9877('0x72')]=_0x9877('0x79');}}}catch(_0x5d1d04){logger[_0x9877('0x35')](_0x9877('0x7a'),util['inspect'](_0x5d1d04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9877('0x9')][_0x9877('0x1b')]=function(_0x1e77cf){try{if(this[_0x9877('0x53')](_0x1e77cf)){if(this['queueReports'][_0x1e77cf['uniqueid']]){var _0x386bec=_[_0x9877('0x6c')](this[_0x9877('0xc')][_0x1e77cf[_0x9877('0x63')]]);_0x386bec[_0x9877('0x18')]=![];_0x386bec[_0x9877('0x71')]=null;_0x386bec[_0x9877('0x7b')]=!![];_0x386bec[_0x9877('0x73')]=_0x1e77cf[_0x9877('0x7c')];_0x386bec['holdtime']=_0x1e77cf[_0x9877('0x6f')];_0x386bec[_0x9877('0x6d')]=!![];_0x386bec[_0x9877('0x7d')]=![];_0x386bec[_0x9877('0x7e')]=null;if(!_0x386bec[_0x9877('0x7f')]){if(_0x1e77cf['reason']=='transfer'){_0x386bec['queuecallerexitreason']=_0x9877('0x80');}else{if(_['startsWith'](_0x1e77cf[_0x9877('0x31')]['toLowerCase'](),_0x9877('0x81'))){if(this[_0x9877('0xc')][_0x1e77cf[_0x9877('0x82')]]){var _0x34177d=_[_0x9877('0x6c')](this[_0x9877('0xc')][_0x1e77cf[_0x9877('0x82')]]);_0x34177d[_0x9877('0x6d')]=![];_0x34177d[_0x9877('0x7d')]=!![];_0x34177d[_0x9877('0x7e')]=moment(_0x386bec[_0x9877('0x64')])[_0x9877('0x83')](_0x1e77cf[_0x9877('0x6f')],'seconds')[_0x9877('0x3e')](_0x9877('0x65'));_0x34177d[_0x9877('0x72')]=_0x9877('0x84');_0x34177d['transfer']=!![];_0x34177d[_0x9877('0x85')]=_0x9877('0x86');_0x34177d[_0x9877('0x87')]=_0x1e77cf['destexten'];_0x34177d[_0x9877('0x88')]=_0x1e77cf['uniqueid'];var _0x1810a8=this[_0x9877('0xc')][_0x1e77cf['linkedid']];this['queueReports'][_0x1e77cf[_0x9877('0x82')]]=this[_0x9877('0xc')][_0x1e77cf['uniqueid']];this['queueReports'][_0x1e77cf[_0x9877('0x63')]]=_0x1810a8;}}else{_0x386bec[_0x9877('0x72')]=_0x9877('0x89')+_0x1e77cf[_0x9877('0x8a')]['toUpperCase']();}}}this['channels'][_0x1e77cf[_0x9877('0x63')]]=_0x386bec;this[_0x9877('0x74')](_0x386bec);}}}catch(_0x2d25a6){logger[_0x9877('0x35')]('[syncAgentComplete][VoiceQueueReport]',util['inspect'](_0x2d25a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9877('0x1e')]=function(_0x47c390){try{if(this['isNotNull'](_0x47c390)){this['addVariable'](_0x47c390['uniqueid'],_[_0x9877('0x8b')](_0x47c390['variable'])[0x0],_0x47c390[_0x9877('0x8c')]);if(this[_0x9877('0xc')][_0x47c390['uniqueid']]){var _0x3bbd16=_[_0x9877('0x6c')](this['queueReports'][_0x47c390[_0x9877('0x63')]]);if(_0x3bbd16){if(this[_0x9877('0x53')](_0x47c390[_0x9877('0x8d')])&&this[_0x9877('0x53')](_0x47c390[_0x9877('0x8d')]['queuestatus'])){switch(_0x47c390[_0x9877('0x8c')]){case'CONTINUE':_0x3bbd16['queuecallerexit']=![];_0x3bbd16[_0x9877('0x7e')]=null;break;case'TIMEOUT':_0x3bbd16[_0x9877('0x8e')]='timeout';ami[_0x9877('0x3d')](_0x9877('0x8f'),_0x3bbd16);break;default:_0x3bbd16[_0x9877('0x7d')]=!![];_0x3bbd16[_0x9877('0x7e')]=moment()[_0x9877('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bbd16[_0x9877('0x90')]=moment()[_0x9877('0x3e')](_0x9877('0x65'));}_0x3bbd16[_0x9877('0x18')]=![];_0x3bbd16['queuecallerabandonAt']=null;_0x3bbd16[_0x9877('0x72')]=_0x47c390[_0x9877('0x8c')];this['channels'][_0x47c390[_0x9877('0x63')]]=_0x3bbd16;this[_0x9877('0x74')](_0x3bbd16);}else if(this['isNotNull'](_0x47c390['variable'])&&this[_0x9877('0x53')](_0x47c390[_0x9877('0x8d')]['queueposition'])){if(!_0x3bbd16['queuecallerabandon']){_0x3bbd16[_0x9877('0x7d')]=!![];_0x3bbd16[_0x9877('0x7e')]=moment()[_0x9877('0x3e')](_0x9877('0x65'));_0x3bbd16[_0x9877('0x72')]=_0x9877('0x91');_0x3bbd16[_0x9877('0x90')]=moment()[_0x9877('0x3e')](_0x9877('0x65'));this['channels'][_0x47c390[_0x9877('0x63')]]=_0x3bbd16;}}_0x3bbd16['variables']=this[_0x9877('0x12')][_0x47c390[_0x9877('0x63')]];}}}}catch(_0xdb55c9){logger[_0x9877('0x35')](_0x9877('0x92'),util['inspect'](_0xdb55c9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9877('0x9')][_0x9877('0x93')]=function(_0x55f0c2,_0x5aa133,_0x4d0da2){var _0x27cb10=['rtpaudioqos',_0x9877('0x94'),_0x9877('0x95'),_0x9877('0x96'),_0x9877('0x97'),_0x9877('0x98'),_0x9877('0x99'),_0x9877('0x9a'),_0x9877('0x9b'),'sipuri',_0x9877('0x9c'),_0x9877('0x9d'),_0x9877('0x9e'),'memberdynamic',_0x9877('0x9f'),_0x9877('0xa0'),_0x9877('0x7c'),_0x9877('0xa1'),_0x9877('0xa2')];if(!_[_0x9877('0x2e')](_0x5aa133)&&!_[_0x9877('0xa3')](_0x27cb10,_0x5aa133)){if(_['isUndefined'](this[_0x9877('0x12')][_0x55f0c2])){this['variables'][_0x55f0c2]={};}this[_0x9877('0x12')][_0x55f0c2][_0x5aa133]=_0x4d0da2;}};VoiceQueueReport[_0x9877('0x9')][_0x9877('0x20')]=function(_0x2438eb){try{if(this['isNotNull'](_0x2438eb)){if(this[_0x9877('0xc')][_0x2438eb[_0x9877('0x63')]]){for(var _0x5518c5=0x0,_0x3986c1={};_0x5518c5=0x0?moment(_0x1a8682[_0x0114('0x17')])[_0x0114('0xf')](_0x1a8682['starttime'],'seconds'):null,'data1':_0x0114('0x18'),'data2':_0x1a8682['accountcode'],'data3':_0x1a8682[_0x0114('0x11')],'data4':_0x1a8682[_0x0114('0x19')]||null,'role':_0x0114('0x13'),'internal':_0x1a8682[_0x0114('0x1a')]?_['toNumber'](_0x1a8682[_0x0114('0x1a')]):undefined,'uniqueid':_0x1a8682[_0x0114('0x1b')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x598d=['endtime','outbound','dialstring','moment','lodash','util','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','membername','starttime'];(function(_0x24ca33,_0x4be3cf){var _0x31aa3b=function(_0x343461){while(--_0x343461){_0x24ca33['push'](_0x24ca33['shift']());}};_0x31aa3b(++_0x4be3cf);}(_0x598d,0x125));var _0xd598=function(_0x3c47e9,_0x4b3811){_0x3c47e9=_0x3c47e9-0x0;var _0x14277e=_0x598d[_0x3c47e9];return _0x14277e;};'use strict';var moment=require(_0xd598('0x0'));var _=require(_0xd598('0x1'));var util=require(_0xd598('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x40f354){var _0x50d853=_0x40f354['queuecallercompleteAt']||_0x40f354[_0xd598('0x3')];return client['Request'](_0xd598('0x4'),{'body':{'channel':_0xd598('0x5'),'membername':_0x40f354[_0xd598('0x6')],'interface':_[_0xd598('0x7')](_0x40f354[_0xd598('0x8')])?util[_0xd598('0x9')]('SIP/%s',_0x40f354[_0xd598('0x6')]):_0x40f354[_0xd598('0x8')],'type':_0xd598('0xa'),'enterAt':_0x40f354[_0xd598('0xb')],'exitAt':_0x50d853,'duration':moment(_0x50d853)[_0xd598('0xc')](_0x40f354['queuecallerleaveAt'],_0xd598('0xd')),'data1':_0xd598('0xe'),'data2':_0x40f354[_0xd598('0xf')],'data3':_0x40f354[_0xd598('0x10')],'data4':null,'data5':_0x40f354[_0xd598('0x11')],'role':_0xd598('0x12'),'internal':_0x40f354[_0xd598('0x13')]?_[_0xd598('0x14')](_0x40f354[_0xd598('0x13')]):undefined,'uniqueid':_0x40f354[_0xd598('0x15')]},'log':_0xd598('0x4')});};exports[_0xd598('0x16')]=function(_0xc28f1b){return client[_0xd598('0x17')](_0xd598('0x4'),{'body':{'channel':'voice','membername':_0xc28f1b[_0xd598('0x18')],'interface':_0xc28f1b['interface'],'type':_0xd598('0xa'),'enterAt':_0xc28f1b[_0xd598('0x19')],'exitAt':_0xc28f1b[_0xd598('0x1a')],'duration':moment(_0xc28f1b[_0xd598('0x1a')])[_0xd598('0xc')](_0xc28f1b['starttime'],'seconds')>=0x0?moment(_0xc28f1b['endtime'])['diff'](_0xc28f1b['starttime'],_0xd598('0xd')):null,'data1':_0xd598('0x1b'),'data2':_0xc28f1b[_0xd598('0x13')],'data3':_0xc28f1b[_0xd598('0x10')],'data4':_0xc28f1b[_0xd598('0x1c')]||null,'role':_0xd598('0x12'),'internal':_0xc28f1b[_0xd598('0x13')]?_[_0xd598('0x14')](_0xc28f1b[_0xd598('0x13')]):undefined,'uniqueid':_0xc28f1b[_0xd598('0x15')]},'log':_0xd598('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 4b9ee36..9c3bf28 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 _0x9b87=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x43ebdb,_0x3ff0df){var _0x24d75b=function(_0x260d4f){while(--_0x260d4f){_0x43ebdb['push'](_0x43ebdb['shift']());}};_0x24d75b(++_0x3ff0df);}(_0x9b87,0x8e));var _0x79b8=function(_0x420a5c,_0x346f29){_0x420a5c=_0x420a5c-0x0;var _0x1656f0=_0x9b87[_0x420a5c];return _0x1656f0;};'use strict';var client=require(_0x79b8('0x0'));exports[_0x79b8('0x1')]=function(_0x20fb46){return function(_0x7078){return client[_0x79b8('0x2')](_0x79b8('0x3'),{'options':{'raw':!![],'attributes':['id',_0x79b8('0x4'),_0x79b8('0x5')]},'log':_0x79b8('0x3')});};}; \ No newline at end of file +var _0xd64b=['GetTemplate','name','html','../client','Request'];(function(_0x10a90f,_0x3de1c7){var _0x5c7955=function(_0x91e2a1){while(--_0x91e2a1){_0x10a90f['push'](_0x10a90f['shift']());}};_0x5c7955(++_0x3de1c7);}(_0xd64b,0xc1));var _0xbd64=function(_0x24d2fb,_0x215adf){_0x24d2fb=_0x24d2fb-0x0;var _0x123bd1=_0xd64b[_0x24d2fb];return _0x123bd1;};'use strict';var client=require(_0xbd64('0x0'));exports['getTemplates']=function(_0xf0de04){return function(_0x4bfb7c){return client[_0xbd64('0x1')](_0xbd64('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbd64('0x3'),_0xbd64('0x4')]},'log':_0xbd64('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 1be2a39..240da83 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 _0xacf3=['Request','name','channel','status','Condition','field','value','AnyConditions','Action','data1','data2','data4','data5','data6','data7','../client','getTriggers'];(function(_0x1e9dcc,_0x461662){var _0x49637d=function(_0x872eeb){while(--_0x872eeb){_0x1e9dcc['push'](_0x1e9dcc['shift']());}};_0x49637d(++_0x461662);}(_0xacf3,0x163));var _0x3acf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xacf3[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x3acf('0x0'));exports[_0x3acf('0x1')]=function(_0x4cdf90){return function(_0x2286d7){return client[_0x3acf('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x3acf('0x3'),_0x3acf('0x4'),_0x3acf('0x5')],'include':[{'model':_0x3acf('0x6'),'as':'AllConditions','attributes':['id',_0x3acf('0x7'),'operator',_0x3acf('0x8')]},{'model':'Condition','as':_0x3acf('0x9'),'attributes':['id',_0x3acf('0x7'),'operator',_0x3acf('0x8')]},{'model':_0x3acf('0xa'),'as':'Actions','attributes':['id','action',_0x3acf('0xb'),_0x3acf('0xc'),'data3',_0x3acf('0xd'),_0x3acf('0xe'),_0x3acf('0xf'),_0x3acf('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xa246=['data2','data3','data6','data7','getTriggers','GetTrigger','name','status','field','value','AnyConditions','Action','Actions','data1'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xa246,0x162));var _0x6a24=function(_0x8d384d,_0x16053f){_0x8d384d=_0x8d384d-0x0;var _0x485c78=_0xa246[_0x8d384d];return _0x485c78;};'use strict';var client=require('../client');exports[_0x6a24('0x0')]=function(_0xfca8f3){return function(_0x44c262){return client['Request'](_0x6a24('0x1'),{'options':{'raw':![],'attributes':['id',_0x6a24('0x2'),'channel',_0x6a24('0x3')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x6a24('0x4'),'operator',_0x6a24('0x5')]},{'model':'Condition','as':_0x6a24('0x6'),'attributes':['id','field','operator',_0x6a24('0x5')]},{'model':_0x6a24('0x7'),'as':_0x6a24('0x8'),'attributes':['id','action',_0x6a24('0x9'),_0x6a24('0xa'),_0x6a24('0xb'),'data4','data5',_0x6a24('0xc'),_0x6a24('0xd')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f3dcb2c..8c72339 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 _0xf4ed=['../client','getTrunks','Request','GetTrunk','name'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0xf4ed,0x1a4));var _0xdf4e=function(_0x2f8c05,_0x551e3d){_0x2f8c05=_0x2f8c05-0x0;var _0x14cfde=_0xf4ed[_0x2f8c05];return _0x14cfde;};'use strict';var client=require(_0xdf4e('0x0'));exports[_0xdf4e('0x1')]=function(_0x443c76){return function(_0x1bf0b5){return client[_0xdf4e('0x2')](_0xdf4e('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xdf4e('0x4'),'registry']},'log':_0xdf4e('0x3')});};}; \ No newline at end of file +var _0x0f2b=['../client','Request','GetTrunk','name','registry'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x0f2b,0x168));var _0xb0f2=function(_0x344f01,_0x2815ee){_0x344f01=_0x344f01-0x0;var _0x92719a=_0x0f2b[_0x344f01];return _0x92719a;};'use strict';var client=require(_0xb0f2('0x0'));exports['getTrunks']=function(_0x1099b3){return function(_0x8ebb43){return client[_0xb0f2('0x1')](_0xb0f2('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb0f2('0x3'),_0xb0f2('0x4')]},'log':_0xb0f2('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d6c94a4..25d9241 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 _0x968f=['name','email','accountcode','fullname','online','lastPauseAt','voicePause','mobile','interface','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastLoginAt','pauseType','getAgents','Request','GetUser'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x968f,0x19f));var _0xf968=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x968f[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0xf968('0x0')]=function(){return function(){return client[_0xf968('0x1')](_0xf968('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xf968('0x3'),_0xf968('0x4'),_0xf968('0x5'),_0xf968('0x6'),_0xf968('0x7'),'lastLoginAt','pauseType',_0xf968('0x8'),_0xf968('0x9'),'phone',_0xf968('0xa'),_0xf968('0xb')]},'log':_0xf968('0x0')});};};exports['getTelephones']=function(){return function(){return client[_0xf968('0x1')](_0xf968('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xf968('0x3'),_0xf968('0x5'),_0xf968('0xc')]},'log':'getTelephones'});};};exports[_0xf968('0xd')]=function(_0x48690d,_0x4668cc,_0x4893e7){return client[_0xf968('0x1')](_0xf968('0xe'),{'body':{'type':_0x4668cc,'uniqueid':_0x4893e7},'options':{'where':{'id':_0x48690d['id']}},'log':_0xf968('0xd')});};exports[_0xf968('0xf')]=function(_0x4837c3){return client['Request'](_0xf968('0x10'),{'body':{},'options':{'where':{'id':_0x4837c3['id']}},'log':_0xf968('0xd')});};exports[_0xf968('0x11')]=function(_0x1d319e){return client[_0xf968('0x1')](_0xf968('0x12'),{'options':{'raw':![],'where':{'role':_0xf968('0x13'),'id':_0x1d319e},'attributes':['id',_0xf968('0x3'),'email',_0xf968('0x5'),_0xf968('0x6'),_0xf968('0x7'),_0xf968('0x14'),_0xf968('0x15'),_0xf968('0x8'),'voicePause',_0xf968('0xb')]},'log':_0xf968('0x11')});}; \ No newline at end of file +var _0xe6df=['savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','email','getAgents','Request','GetUser','agent','name','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','interface','getTelephones','telephone','internal'];(function(_0x47abb1,_0x3f5545){var _0x26ef7c=function(_0x1f7d42){while(--_0x1f7d42){_0x47abb1['push'](_0x47abb1['shift']());}};_0x26ef7c(++_0x3f5545);}(_0xe6df,0x10f));var _0xfe6d=function(_0x1082f8,_0x523f0f){_0x1082f8=_0x1082f8-0x0;var _0x36ee09=_0xe6df[_0x1082f8];return _0x36ee09;};'use strict';var client=require('../client');exports[_0xfe6d('0x0')]=function(){return function(){return client[_0xfe6d('0x1')](_0xfe6d('0x2'),{'options':{'raw':![],'where':{'role':_0xfe6d('0x3')},'attributes':['id',_0xfe6d('0x4'),'email',_0xfe6d('0x5'),_0xfe6d('0x6'),_0xfe6d('0x7'),_0xfe6d('0x8'),_0xfe6d('0x9'),_0xfe6d('0xa'),_0xfe6d('0xb'),_0xfe6d('0xc'),'mobile',_0xfe6d('0xd')]},'log':_0xfe6d('0x0')});};};exports[_0xfe6d('0xe')]=function(){return function(){return client[_0xfe6d('0x1')](_0xfe6d('0x2'),{'options':{'raw':!![],'where':{'role':_0xfe6d('0xf')},'attributes':['id',_0xfe6d('0x4'),_0xfe6d('0x5'),_0xfe6d('0x10')]},'log':'getTelephones'});};};exports[_0xfe6d('0x11')]=function(_0x46987e,_0x54e7b0,_0x2db69f){return client[_0xfe6d('0x1')](_0xfe6d('0x12'),{'body':{'type':_0x54e7b0,'uniqueid':_0x2db69f},'options':{'where':{'id':_0x46987e['id']}},'log':_0xfe6d('0x11')});};exports[_0xfe6d('0x13')]=function(_0x4e945d){return client[_0xfe6d('0x1')](_0xfe6d('0x14'),{'body':{},'options':{'where':{'id':_0x4e945d['id']}},'log':_0xfe6d('0x11')});};exports[_0xfe6d('0x15')]=function(_0x451e3f){return client[_0xfe6d('0x1')](_0xfe6d('0x16'),{'options':{'raw':![],'where':{'role':'agent','id':_0x451e3f},'attributes':['id',_0xfe6d('0x4'),_0xfe6d('0x17'),_0xfe6d('0x5'),_0xfe6d('0x6'),_0xfe6d('0x7'),_0xfe6d('0x8'),_0xfe6d('0x9'),_0xfe6d('0xa'),_0xfe6d('0xb'),_0xfe6d('0xd')]},'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 1fad6e1..89e8c89 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 _0x6597=['../client','create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x14e190,_0xca878f){var _0x720487=function(_0x2632fa){while(--_0x2632fa){_0x14e190['push'](_0x14e190['shift']());}};_0x720487(++_0xca878f);}(_0x6597,0x16e));var _0x7659=function(_0x129f2b,_0x5de93c){_0x129f2b=_0x129f2b-0x0;var _0x24106b=_0x6597[_0x129f2b];return _0x24106b;};'use strict';var client=require(_0x7659('0x0'));exports[_0x7659('0x1')]=function(_0x2720d8){return client['Request'](_0x7659('0x2'),{'body':_0x2720d8,'log':'CreateVoiceAgentReport'});};exports[_0x7659('0x3')]=function(_0x4f5b89,_0x5e96ed,_0x576e8b){return client[_0x7659('0x4')](_0x7659('0x5'),{'body':_0x4f5b89,'options':{'where':{'uniqueid':_0x5e96ed,'interface':_0x576e8b,'agentcomplete':!![]}},'log':_0x7659('0x5')});}; \ No newline at end of file +var _0x4e0a=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4e0a,0x127));var _0xa4e0=function(_0x25a45a,_0x156e4b){_0x25a45a=_0x25a45a-0x0;var _0x237f87=_0x4e0a[_0x25a45a];return _0x237f87;};'use strict';var client=require(_0xa4e0('0x0'));exports[_0xa4e0('0x1')]=function(_0x3f95eb){return client[_0xa4e0('0x2')](_0xa4e0('0x3'),{'body':_0x3f95eb,'log':_0xa4e0('0x3')});};exports[_0xa4e0('0x4')]=function(_0x298b0b,_0x4e43f9,_0x247cae){return client[_0xa4e0('0x2')](_0xa4e0('0x5'),{'body':_0x298b0b,'options':{'where':{'uniqueid':_0x4e43f9,'interface':_0x247cae,'agentcomplete':!![]}},'log':_0xa4e0('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 09e751a..c4ebb58 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 _0xf24c=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','util','lodash','../client','Request','CreateVoiceCallReport','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0xf24c,0xb3));var _0xcf24=function(_0x3afe55,_0x39d26f){_0x3afe55=_0x3afe55-0x0;var _0x56a928=_0xf24c[_0x3afe55];return _0x56a928;};'use strict';var moment=require('moment');var util=require(_0xcf24('0x0'));var _=require(_0xcf24('0x1'));var client=require(_0xcf24('0x2'));exports['create']=function(_0x362edd){return client[_0xcf24('0x3')](_0xcf24('0x4'),{'body':_['merge'](_0x362edd,{'source':_0x362edd['calleridnum'],'destinationcontext':_0x362edd[_0xcf24('0x5')],'callerid':_0x362edd[_0xcf24('0x6')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0xcf24('0x7')]=function(){return function(){return client['Request'](_0xcf24('0x8'),{'options':{'where':{'type':[_0xcf24('0x9')],'createdAt':{'$between':[moment()[_0xcf24('0xa')](_0xcf24('0xb'))[_0xcf24('0xc')](_0xcf24('0xd')),moment()[_0xcf24('0xe')](_0xcf24('0xb'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xcf24('0xf'),_0xcf24('0x10'),_0xcf24('0x11'),'billableseconds']},'log':_0xcf24('0x12')});};}; \ No newline at end of file +var _0xe25b=['type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x6d31bf,_0x30b243){var _0x367ef8=function(_0x286e05){while(--_0x286e05){_0x6d31bf['push'](_0x6d31bf['shift']());}};_0x367ef8(++_0x30b243);}(_0xe25b,0xf7));var _0xbe25=function(_0x466e08,_0x5c4d83){_0x466e08=_0x466e08-0x0;var _0x417cbb=_0xe25b[_0x466e08];return _0x417cbb;};'use strict';var moment=require(_0xbe25('0x0'));var util=require('util');var _=require(_0xbe25('0x1'));var client=require(_0xbe25('0x2'));exports['create']=function(_0x446659){return client[_0xbe25('0x3')](_0xbe25('0x4'),{'body':_[_0xbe25('0x5')](_0x446659,{'source':_0x446659[_0xbe25('0x6')],'destinationcontext':_0x446659[_0xbe25('0x7')],'callerid':_0x446659[_0xbe25('0x8')],'amaflags':_0xbe25('0x9')}),'log':_0xbe25('0x4')});};exports[_0xbe25('0xa')]=function(){return function(){return client[_0xbe25('0x3')](_0xbe25('0xb'),{'options':{'where':{'type':[_0xbe25('0xc')],'createdAt':{'$between':[moment()[_0xbe25('0xd')](_0xbe25('0xe'))[_0xbe25('0xf')](_0xbe25('0x10')),moment()['endOf'](_0xbe25('0xe'))[_0xbe25('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xbe25('0x11'),_0xbe25('0x12'),_0xbe25('0x13'),_0xbe25('0x14')]},'log':_0xbe25('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 0bc940e..4496705 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 _0x14fc=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2ce0d5,_0xd17915){var _0x2b3528=function(_0x3996a0){while(--_0x3996a0){_0x2ce0d5['push'](_0x2ce0d5['shift']());}};_0x2b3528(++_0xd17915);}(_0x14fc,0xf4));var _0xc14f=function(_0x458dd7,_0xe5602b){_0x458dd7=_0x458dd7-0x0;var _0x2a12f3=_0x14fc[_0x458dd7];return _0x2a12f3;};'use strict';var client=require(_0xc14f('0x0'));exports[_0xc14f('0x1')]=function(_0x33ccc1){return client[_0xc14f('0x2')](_0xc14f('0x3'),{'body':_0x33ccc1,'log':_0xc14f('0x3')});}; \ No newline at end of file +var _0x9b73=['create','Request','CreateVoiceDialReport'];(function(_0x352094,_0x4ab63c){var _0x226e43=function(_0x55b3c2){while(--_0x55b3c2){_0x352094['push'](_0x352094['shift']());}};_0x226e43(++_0x4ab63c);}(_0x9b73,0x12c));var _0x39b7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9b73[_0x5b644e];return _0x49c6bf;};'use strict';var client=require('../client');exports[_0x39b7('0x0')]=function(_0x49fa8f){return client[_0x39b7('0x1')](_0x39b7('0x2'),{'body':_0x49fa8f,'log':_0x39b7('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d0536bc..6d7dff5 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 _0x9189=['Request','GetVoiceExtension','exten','recordingFormat'];(function(_0xffebeb,_0x3f15ea){var _0x532c0f=function(_0x1b6a7c){while(--_0x1b6a7c){_0xffebeb['push'](_0xffebeb['shift']());}};_0x532c0f(++_0x3f15ea);}(_0x9189,0x1b0));var _0x9918=function(_0x162c3b,_0x2a52e9){_0x162c3b=_0x162c3b-0x0;var _0x164e3e=_0x9189[_0x162c3b];return _0x164e3e;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x9918('0x0')](_0x9918('0x1'),{'options':{'raw':!![],'attributes':['id',_0x9918('0x2'),_0x9918('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x105b=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x106c88,_0x1de8f1){var _0x264319=function(_0x52d235){while(--_0x52d235){_0x106c88['push'](_0x106c88['shift']());}};_0x264319(++_0x1de8f1);}(_0x105b,0x1a7));var _0xb105=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x105b[_0x30ae5e];return _0x1f2e93;};'use strict';var client=require(_0xb105('0x0'));exports[_0xb105('0x1')]=function(){return function(){return client[_0xb105('0x2')](_0xb105('0x3'),{'options':{'raw':!![],'attributes':['id',_0xb105('0x4'),_0xb105('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xb105('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index fa02620..2d7225f 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 _0x23d1=['callerid','Pause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','name','acw','acwTimeout','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk'];(function(_0x57b754,_0xba6e3b){var _0x57ad0c=function(_0x4ebae9){while(--_0x4ebae9){_0x57b754['push'](_0x57b754['shift']());}};_0x57ad0c(++_0xba6e3b);}(_0x23d1,0x17b));var _0x123d=function(_0xdbef3,_0x38cbde){_0xdbef3=_0xdbef3-0x0;var _0x26eb71=_0x23d1[_0xdbef3];return _0x26eb71;};'use strict';var client=require('../client');exports[_0x123d('0x0')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x123d('0x1'),_0x123d('0x2'),_0x123d('0x3'),'autopause',_0x123d('0x4'),'type',_0x123d('0x5'),'dialMethod',_0x123d('0x6'),_0x123d('0x7'),_0x123d('0x8'),_0x123d('0x9'),_0x123d('0xa'),_0x123d('0xb'),_0x123d('0xc'),'dialOriginateCallerIdNumber',_0x123d('0xd'),_0x123d('0xe'),_0x123d('0xf'),_0x123d('0x10'),_0x123d('0x11'),_0x123d('0x12'),'dialBusyMaxRetry',_0x123d('0x13'),_0x123d('0x14'),_0x123d('0x15'),_0x123d('0x16'),_0x123d('0x17'),'dialGlobalInterval',_0x123d('0x18'),_0x123d('0x19'),_0x123d('0x1a'),_0x123d('0x1b'),_0x123d('0x1c'),_0x123d('0x1d'),_0x123d('0x1e'),_0x123d('0x1f'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x123d('0x20'),_0x123d('0x21'),_0x123d('0x22'),_0x123d('0x23'),'dialRecallInQueue',_0x123d('0x24'),_0x123d('0x25'),_0x123d('0x26'),_0x123d('0x27'),'monitor_format',_0x123d('0x28'),_0x123d('0x29'),_0x123d('0x2a'),'dialNoSuchNumberMaxRetry',_0x123d('0x2b'),_0x123d('0x2c'),_0x123d('0x2d'),_0x123d('0x2e'),_0x123d('0x2f'),_0x123d('0x30'),'dialMachineRetryFrequency',_0x123d('0x31'),_0x123d('0x32'),_0x123d('0x33'),_0x123d('0x34'),_0x123d('0x35')],'include':[{'model':_0x123d('0x36'),'as':_0x123d('0x36'),'attributes':['id',_0x123d('0x1'),_0x123d('0x37'),'active']},{'model':_0x123d('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x123d('0x1')]},{'model':_0x123d('0x36'),'as':_0x123d('0x39'),'attributes':['id',_0x123d('0x1'),_0x123d('0x37'),_0x123d('0x3a')]},{'model':_0x123d('0x3b'),'as':_0x123d('0x3b'),'attributes':['id',_0x123d('0x1')],'include':[{'model':'Interval','as':_0x123d('0x3c'),'attributes':['id','name',_0x123d('0x3d')]}]}]},'log':_0x123d('0x0')});};}; \ No newline at end of file +var _0x481b=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive'];(function(_0x554e03,_0xa831b5){var _0x358f8e=function(_0x246af1){while(--_0x246af1){_0x554e03['push'](_0x554e03['shift']());}};_0x358f8e(++_0xa831b5);}(_0x481b,0xdd));var _0xb481=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x481b[_0x5d2803];return _0xdcad2c;};'use strict';var client=require(_0xb481('0x0'));exports[_0xb481('0x1')]=function(){return function(){return client[_0xb481('0x2')](_0xb481('0x3'),{'options':{'raw':![],'attributes':['id',_0xb481('0x4'),_0xb481('0x5'),_0xb481('0x6'),'autopause','monitor_format',_0xb481('0x7'),_0xb481('0x8'),_0xb481('0x9'),'dialLimitChannel',_0xb481('0xa'),_0xb481('0xb'),_0xb481('0xc'),'dialPredictiveOptimizationPercentage',_0xb481('0xd'),'dialOriginateCallerIdName',_0xb481('0xe'),_0xb481('0xf'),_0xb481('0x10'),_0xb481('0x11'),_0xb481('0x12'),_0xb481('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency',_0xb481('0x14'),'dialNoAnswerRetryFrequency',_0xb481('0x15'),_0xb481('0x16'),_0xb481('0x17'),_0xb481('0x18'),_0xb481('0x19'),_0xb481('0x1a'),_0xb481('0x1b'),_0xb481('0x1c'),_0xb481('0x1d'),_0xb481('0x1e'),_0xb481('0x1f'),_0xb481('0x20'),_0xb481('0x21'),'dialAMDSilenceThreshold',_0xb481('0x22'),_0xb481('0x23'),_0xb481('0x24'),_0xb481('0x25'),_0xb481('0x26'),_0xb481('0x27'),_0xb481('0x28'),'dialQueueProject2','monitor_format',_0xb481('0x29'),_0xb481('0x2a'),'dialCutDigit',_0xb481('0x2b'),'dialNoSuchNumberRetryFrequency',_0xb481('0x2c'),_0xb481('0x2d'),_0xb481('0x2e'),_0xb481('0x2f'),_0xb481('0x30'),_0xb481('0x31'),'dialAgentRejectMaxRetry',_0xb481('0x32'),_0xb481('0x33'),'dialPredictiveIntervalMaxThreshold',_0xb481('0x34')],'include':[{'model':'Trunk','as':_0xb481('0x35'),'attributes':['id',_0xb481('0x4'),_0xb481('0x36'),_0xb481('0x37')]},{'model':_0xb481('0x38'),'as':_0xb481('0x39'),'attributes':['id',_0xb481('0x4')]},{'model':_0xb481('0x35'),'as':_0xb481('0x3a'),'attributes':['id',_0xb481('0x4'),'callerid',_0xb481('0x37')]},{'model':_0xb481('0x3b'),'as':_0xb481('0x3b'),'attributes':['id',_0xb481('0x4')],'include':[{'model':_0xb481('0x3b'),'as':_0xb481('0x3c'),'attributes':['id',_0xb481('0x4'),_0xb481('0x3d')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e343d64..3728fe4 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 _0x5f27=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport'];(function(_0x518c3f,_0x36f9dd){var _0x21f786=function(_0x326e5d){while(--_0x326e5d){_0x518c3f['push'](_0x518c3f['shift']());}};_0x21f786(++_0x36f9dd);}(_0x5f27,0xd8));var _0x75f2=function(_0x2d67fe,_0x26645c){_0x2d67fe=_0x2d67fe-0x0;var _0x2f926c=_0x5f27[_0x2d67fe];return _0x2f926c;};'use strict';var moment=require(_0x75f2('0x0'));var _=require('lodash');var client=require('../client');exports['create']=function(_0x44f29c){return client[_0x75f2('0x1')]('CreateVoiceQueueReport',{'body':_0x44f29c,'log':_0x75f2('0x2')});};exports[_0x75f2('0x3')]=function(){return function(){return client[_0x75f2('0x1')](_0x75f2('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x75f2('0x5')](_0x75f2('0x6'))[_0x75f2('0x7')](_0x75f2('0x8')),moment()[_0x75f2('0x9')](_0x75f2('0x6'))[_0x75f2('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x75f2('0xa'),'queue',_0x75f2('0xb'),'queuecallerleaveAt','queuecallercomplete',_0x75f2('0xc'),'queuecallerexit',_0x75f2('0xd'),_0x75f2('0xe'),_0x75f2('0xf')]},'log':_0x75f2('0x10')});};}; \ No newline at end of file +var _0x77d6=['endOf','format','uniqueid','queue','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x47c2f4,_0x412693){var _0xbe1cbe=function(_0x41a2b4){while(--_0x41a2b4){_0x47c2f4['push'](_0x47c2f4['shift']());}};_0xbe1cbe(++_0x412693);}(_0x77d6,0x17f));var _0x677d=function(_0x1c5835,_0x20431a){_0x1c5835=_0x1c5835-0x0;var _0x558ebf=_0x77d6[_0x1c5835];return _0x558ebf;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0x677d('0x0'));exports[_0x677d('0x1')]=function(_0x27b2fc){return client[_0x677d('0x2')](_0x677d('0x3'),{'body':_0x27b2fc,'log':_0x677d('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x677d('0x2')](_0x677d('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x677d('0x5')](_0x677d('0x6'))['format'](_0x677d('0x7')),moment()[_0x677d('0x8')]('day')[_0x677d('0x9')](_0x677d('0x7'))]}},'attributes':[_0x677d('0xa'),_0x677d('0xb'),'queuecallerjoinAt',_0x677d('0xc'),'queuecallercomplete',_0x677d('0xd'),_0x677d('0xe'),_0x677d('0xf'),'queuecallerabandon',_0x677d('0x10')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 5590831..721b969 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 _0xdb3e=['getVoiceQueueRtPauses','../client','Request'];(function(_0x14dbee,_0x15b555){var _0x5f383e=function(_0x5e1af4){while(--_0x5e1af4){_0x14dbee['push'](_0x14dbee['shift']());}};_0x5f383e(++_0x15b555);}(_0xdb3e,0xc4));var _0xedb3=function(_0x58bff4,_0x4c9611){_0x58bff4=_0x58bff4-0x0;var _0x5f4957=_0xdb3e[_0x58bff4];return _0x5f4957;};'use strict';var client=require(_0xedb3('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5fac94){return function(){return client[_0xedb3('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5fac94,'paused':!![]},'raw':!![]},'log':_0xedb3('0x2')});};}; \ No newline at end of file +var _0xba33=['GetVoiceQueueRtPauses','../client','Request'];(function(_0x541381,_0x5d7688){var _0x444b3d=function(_0x49a10e){while(--_0x49a10e){_0x541381['push'](_0x541381['shift']());}};_0x444b3d(++_0x5d7688);}(_0xba33,0x10c));var _0x3ba3=function(_0x21d400,_0x6d4f4b){_0x21d400=_0x21d400-0x0;var _0x3f8124=_0xba33[_0x21d400];return _0x3f8124;};'use strict';var client=require(_0x3ba3('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3975af){return function(){return client[_0x3ba3('0x1')](_0x3ba3('0x2'),{'options':{'where':{'VoiceQueueId':_0x3975af,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e6dd4e4..af9312a 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 _0x5029=['../client','create','Request','monitorFilename','CreateVoiceRecording','lodash'];(function(_0x4ae379,_0x35c7ad){var _0x453826=function(_0x36d953){while(--_0x36d953){_0x4ae379['push'](_0x4ae379['shift']());}};_0x453826(++_0x35c7ad);}(_0x5029,0x1d3));var _0x9502=function(_0x368963,_0xc0b936){_0x368963=_0x368963-0x0;var _0xcf2b5d=_0x5029[_0x368963];return _0xcf2b5d;};'use strict';var _=require(_0x9502('0x0'));var client=require(_0x9502('0x1'));exports[_0x9502('0x2')]=function(_0x22e70c){return client[_0x9502('0x3')]('CreateVoiceRecording',{'body':_['merge'](_0x22e70c,{'value':_0x22e70c[_0x9502('0x4')]}),'log':_0x9502('0x5')});}; \ No newline at end of file +var _0xff50=['../client','create','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0x3d480b,_0x240aa3){var _0x2bc5d5=function(_0x5a01cf){while(--_0x5a01cf){_0x3d480b['push'](_0x3d480b['shift']());}};_0x2bc5d5(++_0x240aa3);}(_0xff50,0xde));var _0x0ff5=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0xff50[_0x49beea];return _0x27693a;};'use strict';var _=require('lodash');var client=require(_0x0ff5('0x0'));exports[_0x0ff5('0x1')]=function(_0x379841){return client[_0x0ff5('0x2')](_0x0ff5('0x3'),{'body':_[_0x0ff5('0x4')](_0x379841,{'value':_0x379841[_0x0ff5('0x5')]}),'log':_0x0ff5('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e2ab2dd..2fa00d3 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 _0xc2aa=['origtransfererexten','../client','blindTransfer','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','Request','CreateVoiceTransferReport','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext'];(function(_0x3c0a36,_0x8e2f2b){var _0x5ac4cb=function(_0x42b695){while(--_0x42b695){_0x3c0a36['push'](_0x3c0a36['shift']());}};_0x5ac4cb(++_0x8e2f2b);}(_0xc2aa,0x18d));var _0xac2a=function(_0x461925,_0x2bee39){_0x461925=_0x461925-0x0;var _0x504bd8=_0xc2aa[_0x461925];return _0x504bd8;};'use strict';var client=require(_0xac2a('0x0'));exports[_0xac2a('0x1')]=function(_0x5623c1){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x5623c1[_0xac2a('0x2')],'transfererchannel':_0x5623c1[_0xac2a('0x3')],'transferercalleridnum':_0x5623c1['transferercalleridnum'],'transferercalleridname':_0x5623c1['transferercalleridname'],'transfererconnectedlinenum':_0x5623c1[_0xac2a('0x4')],'transfererconnectedlinename':_0x5623c1[_0xac2a('0x5')],'transfereraccountcode':_0x5623c1[_0xac2a('0x6')],'transferercontext':_0x5623c1[_0xac2a('0x7')],'transfererexten':_0x5623c1['transfererexten'],'transfererlinkedid':_0x5623c1[_0xac2a('0x8')],'transfereechannel':_0x5623c1['transfereechannel'],'transfereecalleridnum':_0x5623c1[_0xac2a('0x9')],'transfereecalleridname':_0x5623c1[_0xac2a('0xa')],'transfereeconnectedlinenum':_0x5623c1[_0xac2a('0xb')],'transfereeconnectedlinename':_0x5623c1[_0xac2a('0xc')],'transfereeaccountcode':_0x5623c1[_0xac2a('0xd')],'transfereecontext':_0x5623c1[_0xac2a('0xe')],'transfereeexten':_0x5623c1[_0xac2a('0xf')],'transfereelinkedid':_0x5623c1['transfereelinkedid'],'isexternal':_0x5623c1[_0xac2a('0x10')],'context':_0x5623c1[_0xac2a('0x11')],'extension':_0x5623c1[_0xac2a('0x12')],'type':_0xac2a('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0xac2a('0x14')]=function(_0x4e21da){return client[_0xac2a('0x15')](_0xac2a('0x16'),{'body':{'result':_0x4e21da['result'],'transfererchannel':_0x4e21da['origtransfererchannel'],'transferercalleridnum':_0x4e21da[_0xac2a('0x17')],'transferercalleridname':_0x4e21da[_0xac2a('0x18')],'transfererconnectedlinenum':_0x4e21da[_0xac2a('0x19')],'transfererconnectedlinename':_0x4e21da['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4e21da[_0xac2a('0x1a')],'transferercontext':_0x4e21da[_0xac2a('0x1b')],'transfererexten':_0x4e21da[_0xac2a('0x1c')],'transfererlinkedid':_0x4e21da[_0xac2a('0x1d')],'transfereechannel':_0x4e21da['transfertargetchannel'],'transfereecalleridnum':_0x4e21da[_0xac2a('0x1e')],'transfereecalleridname':_0x4e21da['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4e21da['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4e21da['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4e21da[_0xac2a('0x1f')],'transfereecontext':_0x4e21da[_0xac2a('0x20')],'transfereeexten':_0x4e21da[_0xac2a('0x21')],'transfereelinkedid':_0x4e21da['transfertargetlinkedid'],'isexternal':_0x4e21da['isexternal'],'context':_0x4e21da[_0xac2a('0x22')],'extension':_0x4e21da[_0xac2a('0x23')],'type':'attended'},'log':_0xac2a('0x16')});}; \ No newline at end of file +var _0x61e8=['../client','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten'];(function(_0x42991d,_0x48b22a){var _0x20b6dd=function(_0x175685){while(--_0x175685){_0x42991d['push'](_0x42991d['shift']());}};_0x20b6dd(++_0x48b22a);}(_0x61e8,0x14d));var _0x861e=function(_0x2d8031,_0x334303){_0x2d8031=_0x2d8031-0x0;var _0x4305bc=_0x61e8[_0x2d8031];return _0x4305bc;};'use strict';var client=require(_0x861e('0x0'));exports['blindTransfer']=function(_0x52112d){return client[_0x861e('0x1')](_0x861e('0x2'),{'body':{'result':_0x52112d['result'],'transfererchannel':_0x52112d[_0x861e('0x3')],'transferercalleridnum':_0x52112d['transferercalleridnum'],'transferercalleridname':_0x52112d[_0x861e('0x4')],'transfererconnectedlinenum':_0x52112d[_0x861e('0x5')],'transfererconnectedlinename':_0x52112d[_0x861e('0x6')],'transfereraccountcode':_0x52112d[_0x861e('0x7')],'transferercontext':_0x52112d[_0x861e('0x8')],'transfererexten':_0x52112d[_0x861e('0x9')],'transfererlinkedid':_0x52112d[_0x861e('0xa')],'transfereechannel':_0x52112d[_0x861e('0xb')],'transfereecalleridnum':_0x52112d['transfereecalleridnum'],'transfereecalleridname':_0x52112d['transfereecalleridname'],'transfereeconnectedlinenum':_0x52112d[_0x861e('0xc')],'transfereeconnectedlinename':_0x52112d[_0x861e('0xd')],'transfereeaccountcode':_0x52112d[_0x861e('0xe')],'transfereecontext':_0x52112d[_0x861e('0xf')],'transfereeexten':_0x52112d[_0x861e('0x10')],'transfereelinkedid':_0x52112d[_0x861e('0x11')],'isexternal':_0x52112d[_0x861e('0x12')],'context':_0x52112d['context'],'extension':_0x52112d[_0x861e('0x13')],'type':_0x861e('0x14')},'log':_0x861e('0x2')});};exports['attendedTransfer']=function(_0x85de6e){return client['Request'](_0x861e('0x2'),{'body':{'result':_0x85de6e[_0x861e('0x15')],'transfererchannel':_0x85de6e['origtransfererchannel'],'transferercalleridnum':_0x85de6e[_0x861e('0x16')],'transferercalleridname':_0x85de6e[_0x861e('0x17')],'transfererconnectedlinenum':_0x85de6e[_0x861e('0x18')],'transfererconnectedlinename':_0x85de6e[_0x861e('0x19')],'transfereraccountcode':_0x85de6e['origtransfereraccountcode'],'transferercontext':_0x85de6e[_0x861e('0x1a')],'transfererexten':_0x85de6e[_0x861e('0x1b')],'transfererlinkedid':_0x85de6e[_0x861e('0x1c')],'transfereechannel':_0x85de6e['transfertargetchannel'],'transfereecalleridnum':_0x85de6e[_0x861e('0x1d')],'transfereecalleridname':_0x85de6e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x85de6e[_0x861e('0x1e')],'transfereeconnectedlinename':_0x85de6e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x85de6e[_0x861e('0x1f')],'transfereecontext':_0x85de6e[_0x861e('0x20')],'transfereeexten':_0x85de6e[_0x861e('0x21')],'transfereelinkedid':_0x85de6e[_0x861e('0x22')],'isexternal':_0x85de6e[_0x861e('0x12')],'context':_0x85de6e[_0x861e('0x23')],'extension':_0x85de6e[_0x861e('0x24')],'type':'attended'},'log':_0x861e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 444660a..1199d33 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 _0xcdcb=['action','Reload','Action','message','catch','join','pick','command','Command','then','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','values','channels','isConnected','ami\x20disconnected','validate','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','MixMonitor\x20Success','voicechannel','resolve','StopMixMonitor','status','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','custom:','checkAfterSend','server','http','listen','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','QueuePause','error','asterisk','username','keys','module'];(function(_0x2c6135,_0x1726a2){var _0xf8606=function(_0x3b6364){while(--_0x3b6364){_0x2c6135['push'](_0x2c6135['shift']());}};_0xf8606(++_0x1726a2);}(_0xcdcb,0x178));var _0xbcdc=function(_0x505ec4,_0x42f8e9){_0x505ec4=_0x505ec4-0x0;var _0x5578a9=_0xcdcb[_0x505ec4];return _0x5578a9;};'use strict';var _=require('lodash');var util=require(_0xbcdc('0x0'));var jayson=require(_0xbcdc('0x1'));var schema=require('validate');var BPromise=require(_0xbcdc('0x2'));var moment=require(_0xbcdc('0x3'));var config=require(_0xbcdc('0x4'));var properties=require('../properties');var ami=require(_0xbcdc('0x5'));exports['listen']=function(_0x2bb202,_0x5e7134,_0x71e29b){return new BPromise(function(_0x5b82e8,_0x5dc460){var _0x33ab42={'QueuePause':function(_0x26c757){return new Promise(function(_0x31e95f,_0x3118f0){var _0x3a500b=util[_0xbcdc('0x6')](_0xbcdc('0x7'),_0xbcdc('0x8'),_0x26c757[_0xbcdc('0x9')]);if(_0x2bb202[_0xbcdc('0xa')]&&_0x2bb202[_0xbcdc('0xa')][_0x3a500b]&&_0x2bb202[_0xbcdc('0xa')][_0x3a500b]['timer']){_0x2bb202[_0xbcdc('0xa')][_0x3a500b][_0xbcdc('0xb')]();}if(_0x2bb202[_0xbcdc('0xc')][_0x3a500b]){_0x2bb202[_0xbcdc('0xc')][_0x3a500b][_0xbcdc('0xd')]({'statePause':_0x26c757['pause']?!![]:![]});}_0x31e95f({'code':0xc8,'message':_0xbcdc('0xe')});});},'Reload':function(_0x2cbc73){var _0x7419cc=this;return new Promise(function(_0x24577b,_0x46487a){if(ami['isConnected']()==![]){return _0x46487a(_0x7419cc[_0xbcdc('0xf')](0x1f4,[config['asterisk']['ip'],config[_0xbcdc('0x10')][_0xbcdc('0x11')],'ami\x20disconnected']['join']('\x20')));}_0x2cbc73=_['pick'](_0x2cbc73,_[_0xbcdc('0x12')](properties[_0xbcdc('0x13')]));_0x2cbc73[_0xbcdc('0x14')]=_0xbcdc('0x15');return ami[_0xbcdc('0x16')](_0x2cbc73)['then'](function(_0x75af6d){_0x24577b({'code':0xc8,'message':_0x75af6d[_0xbcdc('0x17')]});})[_0xbcdc('0x18')](function(_0x18bd48){_0x46487a(_0x7419cc[_0xbcdc('0xf')](0x1f5,_0x18bd48[_0xbcdc('0x17')]));});});},'Command':function(_0x3fff4c){var _0x51126c=this;return new Promise(function(_0x338c67,_0x2ae8dd){if(ami['isConnected']()==![]){return _0x2ae8dd(_0x51126c[_0xbcdc('0xf')](0x1f4,[config[_0xbcdc('0x10')]['ip'],config[_0xbcdc('0x10')][_0xbcdc('0x11')],'ami\x20disconnected'][_0xbcdc('0x19')]('\x20')));}_0x3fff4c=_[_0xbcdc('0x1a')](_0x3fff4c,_0xbcdc('0x1b'));_0x3fff4c[_0xbcdc('0x14')]=_0xbcdc('0x1c');return ami[_0xbcdc('0x16')](_0x3fff4c)[_0xbcdc('0x1d')](function(_0x3dfa91){_0x338c67({'code':0xc8,'message':_0x3dfa91[_0xbcdc('0x1e')]});})[_0xbcdc('0x18')](function(_0x3b4820){_0x2ae8dd(_0x51126c[_0xbcdc('0xf')](0x1f5,_0x3b4820[_0xbcdc('0x17')]));});});},'VoiceQueues':function(_0x1fe5b4){return new Promise(function(_0xb6ec99,_0x4d0be7){var _0x23c81d=[];for(var _0x3ae433 in _0x2bb202[_0xbcdc('0x1f')]){if(_0x2bb202['voiceQueues'][_0xbcdc('0x20')](_0x3ae433)){var _0x4542f0=_0x2bb202[_0xbcdc('0x1f')][_0x3ae433];var _0x3cb7f6={'id':_0x4542f0['id'],'name':_0x4542f0[_0xbcdc('0x9')],'strategy':_0x4542f0[_0xbcdc('0x21')],'answered':_0x4542f0['answered'],'available':_0x4542f0['available'],'loggedIn':_0x4542f0[_0xbcdc('0x22')],'pTalking':_0x4542f0[_0xbcdc('0x23')],'sumBillable':_0x4542f0[_0xbcdc('0x24')],'sumDuration':_0x4542f0[_0xbcdc('0x25')],'sumHoldTime':_0x4542f0[_0xbcdc('0x26')]||0x0,'talking':_0x4542f0[_0xbcdc('0x27')],'total':_0x4542f0[_0xbcdc('0x28')],'type':_0x4542f0[_0xbcdc('0x29')],'unmanaged':_0x4542f0['unmanaged'],'abandoned':_0x4542f0[_0xbcdc('0x2a')],'waiting':_0x4542f0['waiting'],'loggedInDb':_0x4542f0[_0xbcdc('0x2b')]};if(_0x4542f0['type']==='outbound'){_0x3cb7f6[_0xbcdc('0x2c')]=_0x4542f0['dialActive'];_0x3cb7f6[_0xbcdc('0x2d')]=_0x4542f0['dialMethod'];_0x3cb7f6[_0xbcdc('0x2e')]=_0x4542f0['dialOriginateCallerIdName'];_0x3cb7f6[_0xbcdc('0x2f')]=_0x4542f0[_0xbcdc('0x2f')];_0x3cb7f6[_0xbcdc('0x30')]=_0x4542f0['dialOriginateTimeout'];_0x3cb7f6['dialPrefix']=_0x4542f0[_0xbcdc('0x31')];_0x3cb7f6[_0xbcdc('0x32')]=_0x4542f0[_0xbcdc('0x32')];_0x3cb7f6[_0xbcdc('0x33')]=_0x4542f0[_0xbcdc('0x33')];_0x3cb7f6[_0xbcdc('0x34')]=_0x4542f0[_0xbcdc('0x34')];_0x3cb7f6['outboundBusyCallsDay']=_0x4542f0[_0xbcdc('0x35')];_0x3cb7f6[_0xbcdc('0x36')]=_0x4542f0[_0xbcdc('0x36')];_0x3cb7f6[_0xbcdc('0x37')]=_0x4542f0[_0xbcdc('0x37')];_0x3cb7f6[_0xbcdc('0x38')]=_0x4542f0['outboundDropCallsDayCallersExit'];_0x3cb7f6[_0xbcdc('0x39')]=_0x4542f0[_0xbcdc('0x39')];_0x3cb7f6[_0xbcdc('0x3a')]=_0x4542f0[_0xbcdc('0x3a')];_0x3cb7f6[_0xbcdc('0x3b')]=_0x4542f0[_0xbcdc('0x3b')];_0x3cb7f6['outboundOriginateFailureCallsDay']=_0x4542f0[_0xbcdc('0x3c')];_0x3cb7f6[_0xbcdc('0x3d')]=_0x4542f0[_0xbcdc('0x3d')];_0x3cb7f6[_0xbcdc('0x3e')]=_0x4542f0[_0xbcdc('0x3e')];_0x3cb7f6[_0xbcdc('0x3f')]=_0x4542f0['outboundUnknownCallsDay'];_0x3cb7f6[_0xbcdc('0x40')]=_0x4542f0[_0xbcdc('0x40')];_0x3cb7f6[_0xbcdc('0x41')]=_0x4542f0[_0xbcdc('0x41')];_0x3cb7f6['predictiveIntervalAvgTalktime']=_0x4542f0['predictiveIntervalAvgTalktime'];_0x3cb7f6[_0xbcdc('0x42')]=_0x4542f0[_0xbcdc('0x42')];_0x3cb7f6['predictiveIntervalDroppedCallsTimeout']=_0x4542f0[_0xbcdc('0x43')];_0x3cb7f6[_0xbcdc('0x44')]=_0x4542f0[_0xbcdc('0x44')];_0x3cb7f6['predictiveIntervalErlangCallsDroppedCalls']=_0x4542f0['predictiveIntervalErlangCallsDroppedCalls'];_0x3cb7f6[_0xbcdc('0x45')]=_0x4542f0['predictiveIntervalHitRate'];_0x3cb7f6[_0xbcdc('0x46')]=_0x4542f0[_0xbcdc('0x46')];_0x3cb7f6[_0xbcdc('0x47')]=_0x4542f0[_0xbcdc('0x47')];_0x3cb7f6[_0xbcdc('0x48')]=_0x4542f0[_0xbcdc('0x48')];_0x3cb7f6[_0xbcdc('0x49')]=_0x4542f0['predictiveIntervalTotalCalls'];_0x3cb7f6[_0xbcdc('0x17')]=_0x4542f0['message'];_0x3cb7f6['originated']=_0x4542f0['originated'];_0x3cb7f6[_0xbcdc('0x4a')]=_0x4542f0[_0xbcdc('0x4a')];_0x3cb7f6[_0xbcdc('0x4b')]=_0x4542f0[_0xbcdc('0x4b')];_0x3cb7f6[_0xbcdc('0x4c')]=_0x4542f0[_0xbcdc('0x4c')];_0x3cb7f6[_0xbcdc('0x4d')]=_0x4542f0[_0xbcdc('0x4d')];_0x3cb7f6[_0xbcdc('0x4e')]=_0x4542f0[_0xbcdc('0x4e')];_0x3cb7f6[_0xbcdc('0x4f')]=_0x4542f0[_0xbcdc('0x4f')];}if(_0x4542f0[_0xbcdc('0x50')]){_0x3cb7f6[_0xbcdc('0x50')]={'id':_0x4542f0[_0xbcdc('0x50')]['id'],'name':_0x4542f0[_0xbcdc('0x50')][_0xbcdc('0x9')],'active':_0x4542f0[_0xbcdc('0x50')]['active'],'callerid':_0x4542f0[_0xbcdc('0x50')][_0xbcdc('0x51')]};}if(_0x4542f0[_0xbcdc('0x52')]){_0x3cb7f6[_0xbcdc('0x52')]={'id':_0x4542f0[_0xbcdc('0x52')]['id'],'name':_0x4542f0['Interval'][_0xbcdc('0x9')]};}_0x23c81d[_0xbcdc('0x53')](_0x3cb7f6);}}_0xb6ec99({'count':_0x23c81d[_0xbcdc('0x54')],'rows':_0x23c81d});});},'VoiceChannels':function(_0x23f136){return new Promise(function(_0x3fda4c,_0x8ed8fd){var _0x5ee457=_[_0xbcdc('0x55')](_0x2bb202[_0xbcdc('0x56')]);_0x3fda4c({'count':_0x5ee457['length'],'rows':_0x5ee457});});},'VoiceChannelMixMonitor':function(_0x24abde){var _0x15cd50=this;return new Promise(function(_0xec74da,_0x338b85){if(ami[_0xbcdc('0x57')]()==![]){return _0x338b85(_0x15cd50[_0xbcdc('0xf')](0x1f4,[config[_0xbcdc('0x10')]['ip'],config['asterisk'][_0xbcdc('0x11')],_0xbcdc('0x58')]['join']('\x20')));}var _0x5563f5=schema(properties['voicechannel'])[_0xbcdc('0x59')](_0x24abde);if(_0x5563f5[_0xbcdc('0x54')]>0x0){return _0x338b85(_0x15cd50[_0xbcdc('0xf')](0x1f4,_[_0xbcdc('0x5a')](_0x5563f5,_0xbcdc('0x17'))[_0xbcdc('0x19')](',\x20')));}var _0x34e8f3=_[_0xbcdc('0x5b')](_0x2bb202[_0xbcdc('0x56')],{'uniqueid':_0x24abde[_0xbcdc('0x5c')]});if(_0x34e8f3&&_0x34e8f3[_0xbcdc('0x5d')]){var _0x334606=util[_0xbcdc('0x6')](_0xbcdc('0x5e'),_0x24abde[_0xbcdc('0x5f')]||_0x24abde['uniqueid'],_0x24abde[_0xbcdc('0x6')]||_0xbcdc('0x60'));return ami[_0xbcdc('0x16')]({'action':_0xbcdc('0x61'),'channel':_0x34e8f3[_0xbcdc('0x5d')],'file':_0x334606,'options':_0xbcdc('0x62')})['then'](function(_0x45f402){var _0x14c365=_[_0xbcdc('0x5b')](_0x34e8f3[_0xbcdc('0x63')],{'filename':_0xbcdc('0x64')+_0x334606[_0xbcdc('0x65')]()});if(_[_0xbcdc('0x66')](_0x14c365)){_0x34e8f3[_0xbcdc('0x63')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0x334606[_0xbcdc('0x65')](),'createdAt':moment()[_0xbcdc('0x6')](_0xbcdc('0x67')),'mixmonitorid':_0x45f402['mixmonitorid'],'status':_0xbcdc('0x68')});}else{_0x14c365[_0xbcdc('0x69')]=_0x45f402['mixmonitorid'];_0x14c365['status']=_0xbcdc('0x68');}_0xec74da({'code':0xc8,'message':[_0x24abde['uniqueid'],_0xbcdc('0x6a'),_0x45f402[_0xbcdc('0x69')]][_0xbcdc('0x19')]('\x20'),'mixmonitorid':_0x45f402[_0xbcdc('0x69')]});})[_0xbcdc('0x18')](function(_0x13a62){_0x338b85(_0x15cd50[_0xbcdc('0xf')](0x1f5,[_0x24abde['uniqueid'],_0x13a62['message']['toLowerCase']()][_0xbcdc('0x19')]('\x20')));});}else{return _0x338b85(_0x15cd50[_0xbcdc('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5b142e){var _0x2b7524=this;return new Promise(function(_0x5e6207,_0x23f4d4){if(ami['isConnected']()==![]){return _0x23f4d4(_0x2b7524[_0xbcdc('0xf')](0x1f4,[config[_0xbcdc('0x10')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xbcdc('0x19')]('\x20')));}var _0x3a2d4d=schema(properties[_0xbcdc('0x6b')])[_0xbcdc('0x59')](_0x5b142e);if(_0x3a2d4d['length']>0x0){return _0x23f4d4(_0x2b7524[_0xbcdc('0xf')](0x1f4,_[_0xbcdc('0x5a')](_0x3a2d4d,'message')[_0xbcdc('0x19')](',\x20')));}var _0x1739d3=_['find'](_0x2bb202[_0xbcdc('0x56')],{'uniqueid':_0x5b142e[_0xbcdc('0x5c')]});if(_0x1739d3){return BPromise[_0xbcdc('0x6c')]()[_0xbcdc('0x1d')](function(){if(_0x1739d3[_0xbcdc('0x5d')]){return ami[_0xbcdc('0x16')]({'action':_0xbcdc('0x6d'),'channel':_0x1739d3[_0xbcdc('0x5d')],'mixmonitorid':_0x5b142e[_0xbcdc('0x69')]})[_0xbcdc('0x18')](function(_0x258452){});}})['then'](function(){if(_0x1739d3['destinationchannel']){return ami[_0xbcdc('0x16')]({'action':_0xbcdc('0x6d'),'channel':_0x1739d3['destinationchannel'],'mixmonitorid':_0x5b142e['mixmonitorid']})[_0xbcdc('0x18')](function(_0x5aab30){});}})[_0xbcdc('0x1d')](function(_0x150083){var _0x2183c6=_[_0xbcdc('0x5b')](_0x1739d3['monitors'],{'mixmonitorid':_0x5b142e['mixmonitorid']});if(_0x2183c6){_0x2183c6[_0xbcdc('0x6e')]=_0xbcdc('0x6f');}})['then'](function(){var _0x1679fd=util[_0xbcdc('0x6')](_0xbcdc('0x5e'),_0x5b142e[_0xbcdc('0x5f')]||_0x5b142e[_0xbcdc('0x5c')],_0x5b142e['format']||'wav');var _0x5a9440=_[_0xbcdc('0x5b')](_0x1739d3['monitors'],{'filename':_0xbcdc('0x64')+_0x1679fd[_0xbcdc('0x65')]()});if(_0x5a9440){_0x5a9440['status']=_0xbcdc('0x6f');}})[_0xbcdc('0x1d')](function(){_0x5e6207({'code':0xc8,'message':[_0x5b142e[_0xbcdc('0x5c')],_0xbcdc('0x70')]['join']('\x20')});})[_0xbcdc('0x18')](function(_0x303dca){_0x23f4d4(_0x2b7524['error'](0x1f5,[_0x5b142e[_0xbcdc('0x5c')],_0x303dca['message']['toLowerCase']()][_0xbcdc('0x19')]('\x20')));});}else{return _0x23f4d4(_0x2b7524[_0xbcdc('0xf')](0x1f5,_0xbcdc('0x71')));}});},'VoiceQueuesChannels':function(_0x12c50a){return new Promise(function(_0x3034a1,_0x3f52db){var _0x5dffa1=_[_0xbcdc('0x55')](_0x2bb202[_0xbcdc('0x72')]);_0x3034a1({'count':_0x5dffa1[_0xbcdc('0x54')],'rows':_0x5dffa1});});},'VoiceQueuesChannel':function(_0x33bebe){var _0x5013ad=this;return new Promise(function(_0x2c7944,_0x53c382){var _0x2ff012=schema(properties['voicequeuechannel'])[_0xbcdc('0x59')](_0x33bebe);if(_0x2ff012[_0xbcdc('0x54')]>0x0){return _0x53c382(_0x5013ad[_0xbcdc('0xf')](0x1f4,_['map'](_0x2ff012,'message')[_0xbcdc('0x19')](',\x20')));}var _0x4500fd=_[_0xbcdc('0x5b')](_0x2bb202['queueChannels'],{'uniqueid':_0x33bebe['uniqueid']});if(_0x4500fd){_0x2c7944(_0x4500fd);}else{return _0x53c382(_0x5013ad['error'](0x1f5,_0xbcdc('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x2144d8){var _0x517a86=this;return new Promise(function(_0x3adcca,_0x27475e){if(ami[_0xbcdc('0x57')]()==![]){return _0x27475e(_0x517a86[_0xbcdc('0xf')](0x1f4,[config[_0xbcdc('0x10')]['ip'],config[_0xbcdc('0x10')][_0xbcdc('0x11')],_0xbcdc('0x58')]['join']('\x20')));}var _0x5d4bf9=schema(properties['voicequeuechannelhangup'])[_0xbcdc('0x59')](_0x2144d8);if(_0x5d4bf9[_0xbcdc('0x54')]>0x0){return _0x27475e(_0x517a86[_0xbcdc('0xf')](0x1f4,_['map'](_0x5d4bf9,_0xbcdc('0x17'))[_0xbcdc('0x19')](',\x20')));}var _0x196c14=_[_0xbcdc('0x5b')](_0x2bb202['queueChannels'],{'uniqueid':_0x2144d8[_0xbcdc('0x5c')]});if(_0x196c14&&_0x196c14[_0xbcdc('0x5d')]){return ami[_0xbcdc('0x16')]({'action':'Hangup','channel':_0x196c14[_0xbcdc('0x5d')]})[_0xbcdc('0x1d')](function(_0x42b723){_0x3adcca({'code':0xc8,'message':[_0x2144d8[_0xbcdc('0x5c')],_0x42b723['message'][_0xbcdc('0x65')]()][_0xbcdc('0x19')]('\x20')});})[_0xbcdc('0x18')](function(_0x174c3c){_0x27475e(_0x517a86['error'](0x1f5,[_0x2144d8['uniqueid'],_0x174c3c['message'][_0xbcdc('0x65')]()]['join']('\x20')));});}else{return _0x27475e(_0x517a86[_0xbcdc('0xf')](0x1f5,_0xbcdc('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x122ac4){var _0x37a515=this;return new Promise(function(_0x1aae1e,_0x51d3c3){if(ami[_0xbcdc('0x57')]()==![]){return _0x51d3c3(_0x37a515[_0xbcdc('0xf')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xbcdc('0x11')],'ami\x20disconnected'][_0xbcdc('0x19')]('\x20')));}var _0x22a026=schema(properties[_0xbcdc('0x73')])[_0xbcdc('0x59')](_0x122ac4);if(_0x22a026[_0xbcdc('0x54')]>0x0){return _0x51d3c3(_0x37a515[_0xbcdc('0xf')](0x1f4,_['map'](_0x22a026,'message')[_0xbcdc('0x19')](',\x20')));}var _0x13018b=_[_0xbcdc('0x5b')](_0x2bb202[_0xbcdc('0x72')],{'uniqueid':_0x122ac4['uniqueid']});if(_0x13018b&&_0x13018b[_0xbcdc('0x5d')]){return ami[_0xbcdc('0x16')]({'action':_0xbcdc('0x74'),'channel':_0x13018b[_0xbcdc('0x5d')],'exten':_0x122ac4[_0xbcdc('0x75')],'context':_0x122ac4['context']||_0x13018b[_0xbcdc('0x76')],'priority':0x1})[_0xbcdc('0x1d')](function(_0x30c091){_0x1aae1e({'code':0xc8,'message':[_0x122ac4[_0xbcdc('0x5c')],_0x30c091[_0xbcdc('0x17')][_0xbcdc('0x65')]()][_0xbcdc('0x19')]('\x20')});})[_0xbcdc('0x18')](function(_0x161dbc){_0x51d3c3(_0x37a515[_0xbcdc('0xf')](0x1f5,[_0x122ac4['uniqueid'],_0x161dbc[_0xbcdc('0x17')][_0xbcdc('0x65')]()][_0xbcdc('0x19')]('\x20')));});}else{return _0x51d3c3(_0x37a515[_0xbcdc('0xf')](0x1f5,_0xbcdc('0x71')));}});},'Agents':function(_0x4f2cb2){return new Promise(function(_0x3ad5d8,_0x39f1b6){var _0x4dd2ff=_[_0xbcdc('0x55')](_0x2bb202[_0xbcdc('0xc')]);_0x3ad5d8({'count':_0x4dd2ff[_0xbcdc('0x54')],'rows':_0x4dd2ff});});},'Telephones':function(_0x266fbb){return new Promise(function(_0x4aefe4,_0x1330fa){var _0xcc6ca1=_['values'](_0x2bb202[_0xbcdc('0x77')]);_0x4aefe4({'count':_0xcc6ca1[_0xbcdc('0x54')],'rows':_0xcc6ca1});});},'Trunks':function(_0x39c7b9){return new Promise(function(_0x43ce7d,_0x33af47){var _0x38351f=_[_0xbcdc('0x55')](_0x2bb202[_0xbcdc('0x78')]);_0x43ce7d({'count':_0x38351f['length'],'rows':_0x38351f});});},'OutboundChannels':function(_0x5e338c){return new Promise(function(_0x5ce574,_0x57ce93){var _0x413c03=_['values'](_0x2bb202[_0xbcdc('0x79')]);_0x5ce574({'count':_0x413c03[_0xbcdc('0x54')],'rows':_0x413c03});});},'Outbound':function(_0xb44fc1){return new Promise(function(_0x20fc97,_0x5618fc){_0x20fc97(_0x2bb202['outbound']);});},'Campaigns':function(_0x52aa10){return new Promise(function(_0x10ee28,_0xc87796){var _0x3afcc1=_[_0xbcdc('0x55')](_0x2bb202[_0xbcdc('0x7a')]);_0x10ee28({'count':_0x3afcc1[_0xbcdc('0x54')],'rows':_0x3afcc1});});},'VoiceQueuesPreview':function(_0x11ad7d){var _0x42835e=this;return new Promise(function(_0x1e3cd9,_0x5af70c){_0x5e7134[_0xbcdc('0x7b')](_0x11ad7d['id'])['then'](function(_0x5c131f){_0x1e3cd9({'code':0xc8,'message':_0x5c131f['message']});})[_0xbcdc('0x18')](function(_0x90d87e){_0x5af70c(_0x42835e[_0xbcdc('0xf')](0x1f4,_0x90d87e[_0xbcdc('0x17')]));});});},'EventManager':function(_0x21af41){var _0x81c20=this;return new Promise(function(_0x5632a1,_0x1ce3b3){if(!_0x21af41[_0xbcdc('0x7c')]){return _0x1ce3b3(_0x81c20[_0xbcdc('0xf')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xbcdc('0x7d')+_0x21af41[_0xbcdc('0x7c')],_0x21af41[_0xbcdc('0x17')]);_0x5632a1({'code':0xc8,'message':_0x21af41});});},'FaxAccounts':function(_0x2f04da){return new Promise(function(_0x33dbf5,_0x35cb1c){var _0x3e39af=_['values'](_0x2bb202['faxAccounts']);_0x33dbf5({'count':_0x3e39af[_0xbcdc('0x54')],'rows':_0x3e39af});});},'SendFax':function(_0x4b8610){var _0x8dec62=this;return new Promise(function(_0x1e57c5,_0x41aebd){_0x71e29b['send'](_0x4b8610)[_0xbcdc('0x1d')](function(_0x38e7e9){_0x1e57c5({'code':0xc8,'message':_0x38e7e9[_0xbcdc('0x17')]});})[_0xbcdc('0x18')](function(_0x146c8f){_0x41aebd(_0x8dec62[_0xbcdc('0xf')](0x1f4,_0x146c8f[_0xbcdc('0x17')]));});});},'CheckAfterSend':function(_0x11e29b){var _0x56b445=this;return new Promise(function(_0x300d68,_0x406abf){_0x71e29b[_0xbcdc('0x7e')](_0x11e29b)[_0xbcdc('0x1d')](function(_0xdae8c8){_0x300d68({'code':0xc8,'message':_0xdae8c8[_0xbcdc('0x17')]});})['catch'](function(_0x5047f5){_0x406abf(_0x56b445[_0xbcdc('0xf')](0x1f4,_0x5047f5[_0xbcdc('0x17')]));});});}};var _0x29e698=jayson[_0xbcdc('0x7f')](_0x33ab42)[_0xbcdc('0x80')]();_0x29e698['on'](_0xbcdc('0xf'),function(_0x4d2968){return _0x5dc460(_0x4d2968);});_0x29e698[_0xbcdc('0x81')](0x232a,'127.0.0.1',function(){console['log'](_0xbcdc('0x82'),0x232a);return _0x5b82e8(_0xbcdc('0x83')+0x232a);});});}; \ No newline at end of file +var _0xa8f5=['predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','length','values','channels','voicechannel','map','find','uniqueid','%s.%s','filename','wav','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannel','Hangup','Redirect','exten','context','telephones','campaigns','run','Event\x20name\x20mandatory','emit','custom:','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','SIP','name','timers','updateAcw','agents','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','error','command','Command','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','sumBillable','sumHoldTime','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa8f5,0x142));var _0x5a8f=function(_0x21fdce,_0x3b4c0e){_0x21fdce=_0x21fdce-0x0;var _0xcdf7d6=_0xa8f5[_0x21fdce];return _0xcdf7d6;};'use strict';var _=require(_0x5a8f('0x0'));var util=require(_0x5a8f('0x1'));var jayson=require(_0x5a8f('0x2'));var schema=require(_0x5a8f('0x3'));var BPromise=require(_0x5a8f('0x4'));var moment=require(_0x5a8f('0x5'));var config=require(_0x5a8f('0x6'));var properties=require('../properties');var ami=require(_0x5a8f('0x7'));exports[_0x5a8f('0x8')]=function(_0x4d29e6,_0x2aee7e,_0x3d9cea){return new BPromise(function(_0x4363a1,_0x27bbde){var _0x3d4070={'QueuePause':function(_0x202587){return new Promise(function(_0x4b766d,_0x2c2166){var _0x259062=util[_0x5a8f('0x9')]('%s/%s',_0x5a8f('0xa'),_0x202587[_0x5a8f('0xb')]);if(_0x4d29e6[_0x5a8f('0xc')]&&_0x4d29e6['timers'][_0x259062]&&_0x4d29e6['timers'][_0x259062]['timer']){_0x4d29e6[_0x5a8f('0xc')][_0x259062][_0x5a8f('0xd')]();}if(_0x4d29e6[_0x5a8f('0xe')][_0x259062]){_0x4d29e6[_0x5a8f('0xe')][_0x259062]['updateStatusRealtime']({'statePause':_0x202587[_0x5a8f('0xf')]?!![]:![]});}_0x4b766d({'code':0xc8,'message':_0x5a8f('0x10')});});},'Reload':function(_0x4dfc81){var _0x1a8d03=this;return new Promise(function(_0x29d407,_0x3cafc8){if(ami[_0x5a8f('0x11')]()==![]){return _0x3cafc8(_0x1a8d03['error'](0x1f4,[config['asterisk']['ip'],config[_0x5a8f('0x12')][_0x5a8f('0x13')],_0x5a8f('0x14')][_0x5a8f('0x15')]('\x20')));}_0x4dfc81=_[_0x5a8f('0x16')](_0x4dfc81,_[_0x5a8f('0x17')](properties[_0x5a8f('0x18')]));_0x4dfc81[_0x5a8f('0x19')]=_0x5a8f('0x1a');return ami[_0x5a8f('0x1b')](_0x4dfc81)[_0x5a8f('0x1c')](function(_0x15431c){_0x29d407({'code':0xc8,'message':_0x15431c[_0x5a8f('0x1d')]});})[_0x5a8f('0x1e')](function(_0x27089e){_0x3cafc8(_0x1a8d03['error'](0x1f5,_0x27089e['message']));});});},'Command':function(_0x11f595){var _0x30d6c8=this;return new Promise(function(_0x18b2c4,_0x13170c){if(ami[_0x5a8f('0x11')]()==![]){return _0x13170c(_0x30d6c8[_0x5a8f('0x1f')](0x1f4,[config[_0x5a8f('0x12')]['ip'],config[_0x5a8f('0x12')][_0x5a8f('0x13')],_0x5a8f('0x14')][_0x5a8f('0x15')]('\x20')));}_0x11f595=_[_0x5a8f('0x16')](_0x11f595,_0x5a8f('0x20'));_0x11f595[_0x5a8f('0x19')]=_0x5a8f('0x21');return ami[_0x5a8f('0x1b')](_0x11f595)[_0x5a8f('0x1c')](function(_0x5f496d){_0x18b2c4({'code':0xc8,'message':_0x5f496d[_0x5a8f('0x22')]});})[_0x5a8f('0x1e')](function(_0x336387){_0x13170c(_0x30d6c8[_0x5a8f('0x1f')](0x1f5,_0x336387[_0x5a8f('0x1d')]));});});},'VoiceQueues':function(_0x170ec1){return new Promise(function(_0x3f90f2,_0x454fae){var _0x197a98=[];for(var _0x43774c in _0x4d29e6[_0x5a8f('0x23')]){if(_0x4d29e6[_0x5a8f('0x23')][_0x5a8f('0x24')](_0x43774c)){var _0x3c3eeb=_0x4d29e6[_0x5a8f('0x23')][_0x43774c];var _0x510806={'id':_0x3c3eeb['id'],'name':_0x3c3eeb[_0x5a8f('0xb')],'strategy':_0x3c3eeb[_0x5a8f('0x25')],'answered':_0x3c3eeb['answered'],'available':_0x3c3eeb[_0x5a8f('0x26')],'loggedIn':_0x3c3eeb[_0x5a8f('0x27')],'pTalking':_0x3c3eeb['pTalking'],'sumBillable':_0x3c3eeb[_0x5a8f('0x28')],'sumDuration':_0x3c3eeb['sumDuration'],'sumHoldTime':_0x3c3eeb[_0x5a8f('0x29')]||0x0,'talking':_0x3c3eeb['talking'],'total':_0x3c3eeb['total'],'type':_0x3c3eeb[_0x5a8f('0x2a')],'unmanaged':_0x3c3eeb[_0x5a8f('0x2b')],'abandoned':_0x3c3eeb[_0x5a8f('0x2c')],'waiting':_0x3c3eeb[_0x5a8f('0x2d')],'loggedInDb':_0x3c3eeb[_0x5a8f('0x2e')]};if(_0x3c3eeb['type']===_0x5a8f('0x2f')){_0x510806['dialActive']=_0x3c3eeb['dialActive'];_0x510806[_0x5a8f('0x30')]=_0x3c3eeb[_0x5a8f('0x30')];_0x510806[_0x5a8f('0x31')]=_0x3c3eeb['dialOriginateCallerIdName'];_0x510806['dialOriginateCallerIdNumber']=_0x3c3eeb[_0x5a8f('0x32')];_0x510806[_0x5a8f('0x33')]=_0x3c3eeb[_0x5a8f('0x33')];_0x510806[_0x5a8f('0x34')]=_0x3c3eeb[_0x5a8f('0x34')];_0x510806['outboundAnswerAgiCallsDay']=_0x3c3eeb[_0x5a8f('0x35')];_0x510806[_0x5a8f('0x36')]=_0x3c3eeb[_0x5a8f('0x36')];_0x510806[_0x5a8f('0x37')]=_0x3c3eeb['outboundBlacklistCallsDay'];_0x510806[_0x5a8f('0x38')]=_0x3c3eeb[_0x5a8f('0x38')];_0x510806[_0x5a8f('0x39')]=_0x3c3eeb[_0x5a8f('0x39')];_0x510806[_0x5a8f('0x3a')]=_0x3c3eeb[_0x5a8f('0x3a')];_0x510806['outboundDropCallsDayCallersExit']=_0x3c3eeb[_0x5a8f('0x3b')];_0x510806[_0x5a8f('0x3c')]=_0x3c3eeb[_0x5a8f('0x3c')];_0x510806[_0x5a8f('0x3d')]=_0x3c3eeb[_0x5a8f('0x3d')];_0x510806[_0x5a8f('0x3e')]=_0x3c3eeb[_0x5a8f('0x3e')];_0x510806[_0x5a8f('0x3f')]=_0x3c3eeb[_0x5a8f('0x3f')];_0x510806[_0x5a8f('0x40')]=_0x3c3eeb[_0x5a8f('0x40')];_0x510806[_0x5a8f('0x41')]=_0x3c3eeb[_0x5a8f('0x41')];_0x510806[_0x5a8f('0x42')]=_0x3c3eeb[_0x5a8f('0x42')];_0x510806[_0x5a8f('0x43')]=_0x3c3eeb['predictiveIntervalAnsweredCalls'];_0x510806[_0x5a8f('0x44')]=_0x3c3eeb['predictiveIntervalAvgHoldtime'];_0x510806[_0x5a8f('0x45')]=_0x3c3eeb['predictiveIntervalAvgTalktime'];_0x510806[_0x5a8f('0x46')]=_0x3c3eeb[_0x5a8f('0x46')];_0x510806[_0x5a8f('0x47')]=_0x3c3eeb[_0x5a8f('0x47')];_0x510806[_0x5a8f('0x48')]=_0x3c3eeb[_0x5a8f('0x48')];_0x510806['predictiveIntervalErlangCallsDroppedCalls']=_0x3c3eeb[_0x5a8f('0x49')];_0x510806[_0x5a8f('0x4a')]=_0x3c3eeb['predictiveIntervalHitRate'];_0x510806[_0x5a8f('0x4b')]=_0x3c3eeb[_0x5a8f('0x4b')];_0x510806[_0x5a8f('0x4c')]=_0x3c3eeb[_0x5a8f('0x4c')];_0x510806['predictiveIntervalAvailable']=_0x3c3eeb['predictiveIntervalAvailable'];_0x510806[_0x5a8f('0x4d')]=_0x3c3eeb[_0x5a8f('0x4d')];_0x510806[_0x5a8f('0x1d')]=_0x3c3eeb[_0x5a8f('0x1d')];_0x510806['originated']=_0x3c3eeb[_0x5a8f('0x4e')];_0x510806[_0x5a8f('0x4f')]=_0x3c3eeb[_0x5a8f('0x4f')];_0x510806[_0x5a8f('0x50')]=_0x3c3eeb[_0x5a8f('0x50')];_0x510806[_0x5a8f('0x51')]=_0x3c3eeb[_0x5a8f('0x51')];_0x510806['erlangBusyFactor']=_0x3c3eeb['erlangBusyFactor'];_0x510806[_0x5a8f('0x52')]=_0x3c3eeb[_0x5a8f('0x52')];_0x510806[_0x5a8f('0x53')]=_0x3c3eeb[_0x5a8f('0x53')];}if(_0x3c3eeb[_0x5a8f('0x54')]){_0x510806[_0x5a8f('0x54')]={'id':_0x3c3eeb[_0x5a8f('0x54')]['id'],'name':_0x3c3eeb[_0x5a8f('0x54')][_0x5a8f('0xb')],'active':_0x3c3eeb[_0x5a8f('0x54')]['active'],'callerid':_0x3c3eeb['Trunk'][_0x5a8f('0x55')]};}if(_0x3c3eeb[_0x5a8f('0x56')]){_0x510806[_0x5a8f('0x56')]={'id':_0x3c3eeb[_0x5a8f('0x56')]['id'],'name':_0x3c3eeb['Interval'][_0x5a8f('0xb')]};}_0x197a98['push'](_0x510806);}}_0x3f90f2({'count':_0x197a98[_0x5a8f('0x57')],'rows':_0x197a98});});},'VoiceChannels':function(_0x3e18d6){return new Promise(function(_0x3ce7db,_0x5dcee3){var _0x2da209=_[_0x5a8f('0x58')](_0x4d29e6[_0x5a8f('0x59')]);_0x3ce7db({'count':_0x2da209[_0x5a8f('0x57')],'rows':_0x2da209});});},'VoiceChannelMixMonitor':function(_0x5c0cf4){var _0x405aab=this;return new Promise(function(_0xa952db,_0x59ae24){if(ami[_0x5a8f('0x11')]()==![]){return _0x59ae24(_0x405aab[_0x5a8f('0x1f')](0x1f4,[config[_0x5a8f('0x12')]['ip'],config[_0x5a8f('0x12')][_0x5a8f('0x13')],_0x5a8f('0x14')][_0x5a8f('0x15')]('\x20')));}var _0x54a7a8=schema(properties[_0x5a8f('0x5a')])[_0x5a8f('0x3')](_0x5c0cf4);if(_0x54a7a8[_0x5a8f('0x57')]>0x0){return _0x59ae24(_0x405aab[_0x5a8f('0x1f')](0x1f4,_[_0x5a8f('0x5b')](_0x54a7a8,_0x5a8f('0x1d'))['join'](',\x20')));}var _0x438988=_[_0x5a8f('0x5c')](_0x4d29e6[_0x5a8f('0x59')],{'uniqueid':_0x5c0cf4[_0x5a8f('0x5d')]});if(_0x438988&&_0x438988['channel']){var _0x6c17db=util['format'](_0x5a8f('0x5e'),_0x5c0cf4[_0x5a8f('0x5f')]||_0x5c0cf4[_0x5a8f('0x5d')],_0x5c0cf4[_0x5a8f('0x9')]||_0x5a8f('0x60'));return ami[_0x5a8f('0x1b')]({'action':'MixMonitor','channel':_0x438988[_0x5a8f('0x61')],'file':_0x6c17db,'options':_0x5a8f('0x62')})[_0x5a8f('0x1c')](function(_0x5c4895){var _0x2161a1=_['find'](_0x438988[_0x5a8f('0x63')],{'filename':_0x5a8f('0x64')+_0x6c17db[_0x5a8f('0x65')]()});if(_[_0x5a8f('0x66')](_0x2161a1)){_0x438988[_0x5a8f('0x63')][_0x5a8f('0x67')]({'filename':_0x5a8f('0x64')+_0x6c17db[_0x5a8f('0x65')](),'createdAt':moment()[_0x5a8f('0x9')](_0x5a8f('0x68')),'mixmonitorid':_0x5c4895[_0x5a8f('0x69')],'status':'rec'});}else{_0x2161a1['mixmonitorid']=_0x5c4895[_0x5a8f('0x69')];_0x2161a1[_0x5a8f('0x6a')]=_0x5a8f('0x6b');}_0xa952db({'code':0xc8,'message':[_0x5c0cf4[_0x5a8f('0x5d')],_0x5a8f('0x6c'),_0x5c4895[_0x5a8f('0x69')]][_0x5a8f('0x15')]('\x20'),'mixmonitorid':_0x5c4895[_0x5a8f('0x69')]});})[_0x5a8f('0x1e')](function(_0x2de91d){_0x59ae24(_0x405aab[_0x5a8f('0x1f')](0x1f5,[_0x5c0cf4['uniqueid'],_0x2de91d[_0x5a8f('0x1d')][_0x5a8f('0x65')]()][_0x5a8f('0x15')]('\x20')));});}else{return _0x59ae24(_0x405aab[_0x5a8f('0x1f')](0x1f5,_0x5a8f('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x3f0507){var _0x280df7=this;return new Promise(function(_0x3e592a,_0x1de643){if(ami[_0x5a8f('0x11')]()==![]){return _0x1de643(_0x280df7['error'](0x1f4,[config[_0x5a8f('0x12')]['ip'],config[_0x5a8f('0x12')][_0x5a8f('0x13')],'ami\x20disconnected'][_0x5a8f('0x15')]('\x20')));}var _0x2e30ca=schema(properties[_0x5a8f('0x5a')])['validate'](_0x3f0507);if(_0x2e30ca[_0x5a8f('0x57')]>0x0){return _0x1de643(_0x280df7[_0x5a8f('0x1f')](0x1f4,_[_0x5a8f('0x5b')](_0x2e30ca,_0x5a8f('0x1d'))[_0x5a8f('0x15')](',\x20')));}var _0x45a2d5=_[_0x5a8f('0x5c')](_0x4d29e6[_0x5a8f('0x59')],{'uniqueid':_0x3f0507[_0x5a8f('0x5d')]});if(_0x45a2d5){return BPromise[_0x5a8f('0x6e')]()[_0x5a8f('0x1c')](function(){if(_0x45a2d5['channel']){return ami[_0x5a8f('0x1b')]({'action':_0x5a8f('0x6f'),'channel':_0x45a2d5[_0x5a8f('0x61')],'mixmonitorid':_0x3f0507[_0x5a8f('0x69')]})[_0x5a8f('0x1e')](function(_0x3ca57c){});}})[_0x5a8f('0x1c')](function(){if(_0x45a2d5['destinationchannel']){return ami[_0x5a8f('0x1b')]({'action':_0x5a8f('0x6f'),'channel':_0x45a2d5[_0x5a8f('0x70')],'mixmonitorid':_0x3f0507['mixmonitorid']})[_0x5a8f('0x1e')](function(_0x50534d){});}})[_0x5a8f('0x1c')](function(_0x37c921){var _0x17f5ff=_[_0x5a8f('0x5c')](_0x45a2d5['monitors'],{'mixmonitorid':_0x3f0507['mixmonitorid']});if(_0x17f5ff){_0x17f5ff[_0x5a8f('0x6a')]=_0x5a8f('0x71');}})[_0x5a8f('0x1c')](function(){var _0x6148f6=util[_0x5a8f('0x9')]('%s.%s',_0x3f0507[_0x5a8f('0x5f')]||_0x3f0507['uniqueid'],_0x3f0507[_0x5a8f('0x9')]||'wav');var _0x26b983=_[_0x5a8f('0x5c')](_0x45a2d5[_0x5a8f('0x63')],{'filename':_0x5a8f('0x64')+_0x6148f6[_0x5a8f('0x65')]()});if(_0x26b983){_0x26b983[_0x5a8f('0x6a')]=_0x5a8f('0x71');}})['then'](function(){_0x3e592a({'code':0xc8,'message':[_0x3f0507['uniqueid'],'StopMixMonitor\x20Success'][_0x5a8f('0x15')]('\x20')});})['catch'](function(_0x574b9a){_0x1de643(_0x280df7[_0x5a8f('0x1f')](0x1f5,[_0x3f0507[_0x5a8f('0x5d')],_0x574b9a['message']['toLowerCase']()][_0x5a8f('0x15')]('\x20')));});}else{return _0x1de643(_0x280df7['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4da526){return new Promise(function(_0x14472f,_0x20e1f2){var _0x5a6c20=_['values'](_0x4d29e6[_0x5a8f('0x72')]);_0x14472f({'count':_0x5a6c20['length'],'rows':_0x5a6c20});});},'VoiceQueuesChannel':function(_0x1be46d){var _0x143c86=this;return new Promise(function(_0x3407ac,_0x2bd231){var _0x31cf04=schema(properties[_0x5a8f('0x73')])[_0x5a8f('0x3')](_0x1be46d);if(_0x31cf04[_0x5a8f('0x57')]>0x0){return _0x2bd231(_0x143c86['error'](0x1f4,_['map'](_0x31cf04,_0x5a8f('0x1d'))[_0x5a8f('0x15')](',\x20')));}var _0x56fdbd=_[_0x5a8f('0x5c')](_0x4d29e6[_0x5a8f('0x72')],{'uniqueid':_0x1be46d[_0x5a8f('0x5d')]});if(_0x56fdbd){_0x3407ac(_0x56fdbd);}else{return _0x2bd231(_0x143c86[_0x5a8f('0x1f')](0x1f5,_0x5a8f('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x579e8f){var _0x5c8931=this;return new Promise(function(_0x25104c,_0x40a8ec){if(ami[_0x5a8f('0x11')]()==![]){return _0x40a8ec(_0x5c8931[_0x5a8f('0x1f')](0x1f4,[config[_0x5a8f('0x12')]['ip'],config[_0x5a8f('0x12')][_0x5a8f('0x13')],_0x5a8f('0x14')][_0x5a8f('0x15')]('\x20')));}var _0x46bb61=schema(properties['voicequeuechannelhangup'])[_0x5a8f('0x3')](_0x579e8f);if(_0x46bb61['length']>0x0){return _0x40a8ec(_0x5c8931[_0x5a8f('0x1f')](0x1f4,_[_0x5a8f('0x5b')](_0x46bb61,'message')['join'](',\x20')));}var _0x3b363d=_[_0x5a8f('0x5c')](_0x4d29e6[_0x5a8f('0x72')],{'uniqueid':_0x579e8f[_0x5a8f('0x5d')]});if(_0x3b363d&&_0x3b363d[_0x5a8f('0x61')]){return ami[_0x5a8f('0x1b')]({'action':_0x5a8f('0x74'),'channel':_0x3b363d[_0x5a8f('0x61')]})['then'](function(_0x59955a){_0x25104c({'code':0xc8,'message':[_0x579e8f[_0x5a8f('0x5d')],_0x59955a[_0x5a8f('0x1d')]['toLowerCase']()][_0x5a8f('0x15')]('\x20')});})['catch'](function(_0x58fabc){_0x40a8ec(_0x5c8931['error'](0x1f5,[_0x579e8f[_0x5a8f('0x5d')],_0x58fabc['message']['toLowerCase']()][_0x5a8f('0x15')]('\x20')));});}else{return _0x40a8ec(_0x5c8931[_0x5a8f('0x1f')](0x1f5,_0x5a8f('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x3558f5){var _0x13b09f=this;return new Promise(function(_0x438701,_0x4d566e){if(ami['isConnected']()==![]){return _0x4d566e(_0x13b09f[_0x5a8f('0x1f')](0x1f4,[config[_0x5a8f('0x12')]['ip'],config[_0x5a8f('0x12')]['username'],_0x5a8f('0x14')]['join']('\x20')));}var _0x886e3a=schema(properties['voicequeuechannelredirect'])['validate'](_0x3558f5);if(_0x886e3a[_0x5a8f('0x57')]>0x0){return _0x4d566e(_0x13b09f[_0x5a8f('0x1f')](0x1f4,_[_0x5a8f('0x5b')](_0x886e3a,_0x5a8f('0x1d'))[_0x5a8f('0x15')](',\x20')));}var _0x35ee9c=_[_0x5a8f('0x5c')](_0x4d29e6[_0x5a8f('0x72')],{'uniqueid':_0x3558f5[_0x5a8f('0x5d')]});if(_0x35ee9c&&_0x35ee9c[_0x5a8f('0x61')]){return ami['Action']({'action':_0x5a8f('0x75'),'channel':_0x35ee9c[_0x5a8f('0x61')],'exten':_0x3558f5[_0x5a8f('0x76')],'context':_0x3558f5['context']||_0x35ee9c[_0x5a8f('0x77')],'priority':0x1})[_0x5a8f('0x1c')](function(_0x1d95c5){_0x438701({'code':0xc8,'message':[_0x3558f5['uniqueid'],_0x1d95c5[_0x5a8f('0x1d')][_0x5a8f('0x65')]()][_0x5a8f('0x15')]('\x20')});})['catch'](function(_0x185ff6){_0x4d566e(_0x13b09f[_0x5a8f('0x1f')](0x1f5,[_0x3558f5[_0x5a8f('0x5d')],_0x185ff6[_0x5a8f('0x1d')][_0x5a8f('0x65')]()]['join']('\x20')));});}else{return _0x4d566e(_0x13b09f[_0x5a8f('0x1f')](0x1f5,_0x5a8f('0x6d')));}});},'Agents':function(_0x1ea4a2){return new Promise(function(_0x46290f,_0x5af72c){var _0x439eb4=_[_0x5a8f('0x58')](_0x4d29e6[_0x5a8f('0xe')]);_0x46290f({'count':_0x439eb4[_0x5a8f('0x57')],'rows':_0x439eb4});});},'Telephones':function(_0x4fa7b6){return new Promise(function(_0x29f3c6,_0x3b5bfd){var _0x5c9b23=_['values'](_0x4d29e6[_0x5a8f('0x78')]);_0x29f3c6({'count':_0x5c9b23[_0x5a8f('0x57')],'rows':_0x5c9b23});});},'Trunks':function(_0x483774){return new Promise(function(_0x3e44b8,_0x27d955){var _0x24ca59=_[_0x5a8f('0x58')](_0x4d29e6['trunks']);_0x3e44b8({'count':_0x24ca59[_0x5a8f('0x57')],'rows':_0x24ca59});});},'OutboundChannels':function(_0x1340af){return new Promise(function(_0xefa1b6,_0x4fa6aa){var _0x68bde4=_['values'](_0x4d29e6['outboundChannels']);_0xefa1b6({'count':_0x68bde4[_0x5a8f('0x57')],'rows':_0x68bde4});});},'Outbound':function(_0x3edb9b){return new Promise(function(_0x412e08,_0x420a2b){_0x412e08(_0x4d29e6[_0x5a8f('0x2f')]);});},'Campaigns':function(_0x4012ae){return new Promise(function(_0xb3b2a3,_0x513d83){var _0x4c07f4=_[_0x5a8f('0x58')](_0x4d29e6[_0x5a8f('0x79')]);_0xb3b2a3({'count':_0x4c07f4[_0x5a8f('0x57')],'rows':_0x4c07f4});});},'VoiceQueuesPreview':function(_0x5a9c85){var _0x3aaf7f=this;return new Promise(function(_0x2198cc,_0x15a040){_0x2aee7e[_0x5a8f('0x7a')](_0x5a9c85['id'])[_0x5a8f('0x1c')](function(_0x2113be){_0x2198cc({'code':0xc8,'message':_0x2113be[_0x5a8f('0x1d')]});})['catch'](function(_0x441e3c){_0x15a040(_0x3aaf7f[_0x5a8f('0x1f')](0x1f4,_0x441e3c[_0x5a8f('0x1d')]));});});},'EventManager':function(_0x566249){var _0xaab520=this;return new Promise(function(_0x388e7d,_0x87a848){if(!_0x566249['event']){return _0x87a848(_0xaab520[_0x5a8f('0x1f')](0x1f4,_0x5a8f('0x7b')));}ami[_0x5a8f('0x7c')](_0x5a8f('0x7d')+_0x566249['event'],_0x566249['message']);_0x388e7d({'code':0xc8,'message':_0x566249});});},'FaxAccounts':function(_0x59688e){return new Promise(function(_0x196bc7,_0xedc763){var _0x445fa1=_[_0x5a8f('0x58')](_0x4d29e6['faxAccounts']);_0x196bc7({'count':_0x445fa1[_0x5a8f('0x57')],'rows':_0x445fa1});});},'SendFax':function(_0x1c774f){var _0x18626e=this;return new Promise(function(_0x2ae9e0,_0x5b9848){_0x3d9cea['send'](_0x1c774f)[_0x5a8f('0x1c')](function(_0x1d9b93){_0x2ae9e0({'code':0xc8,'message':_0x1d9b93[_0x5a8f('0x1d')]});})[_0x5a8f('0x1e')](function(_0x4c1f42){_0x5b9848(_0x18626e[_0x5a8f('0x1f')](0x1f4,_0x4c1f42['message']));});});},'CheckAfterSend':function(_0x1d7d73){var _0x364fc=this;return new Promise(function(_0x14bd1e,_0x54dbec){_0x3d9cea[_0x5a8f('0x7e')](_0x1d7d73)[_0x5a8f('0x1c')](function(_0x4968b6){_0x14bd1e({'code':0xc8,'message':_0x4968b6[_0x5a8f('0x1d')]});})['catch'](function(_0x2dd51f){_0x54dbec(_0x364fc[_0x5a8f('0x1f')](0x1f4,_0x2dd51f[_0x5a8f('0x1d')]));});});}};var _0x3ece8b=jayson[_0x5a8f('0x7f')](_0x3d4070)[_0x5a8f('0x80')]();_0x3ece8b['on'](_0x5a8f('0x1f'),function(_0x2210b9){return _0x27bbde(_0x2210b9);});_0x3ece8b[_0x5a8f('0x8')](0x232a,_0x5a8f('0x81'),function(){console[_0x5a8f('0x82')](_0x5a8f('0x83'),0x232a);return _0x4363a1('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 453a4f5..da73645 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 _0x5a68=['ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[%s][%s]','stringify','emit','exec','data2','data1','calleridnum','routeId','firstName','calleridname','','uniqueid','destcalleridname','phone','resolve','showContact','omit','then','info','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','user:%s','name','format','trigger:%s','action','toLowerCase','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','merge','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','util','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5a68,0x139));var _0x85a6=function(_0x1497b4,_0x3c9028){_0x1497b4=_0x1497b4-0x0;var _0x21e2a6=_0x5a68[_0x1497b4];return _0x21e2a6;};'use strict';var BPromise=require('bluebird');var util=require(_0x85a6('0x0'));var _=require(_0x85a6('0x1'));var Redis=require(_0x85a6('0x2'));var config=require(_0x85a6('0x3'));var logger=require(_0x85a6('0x4'))(_0x85a6('0x5'));var cmContactRpc=require(_0x85a6('0x6'));config[_0x85a6('0x7')]=_['defaults'](config[_0x85a6('0x7')],{'host':_0x85a6('0x8'),'port':0x18eb});var io=require(_0x85a6('0x9'))(new Redis(config[_0x85a6('0x7')]));function emit(_0x1161bd,_0x32cd7c,_0x3a7fc0,_0x44a112){logger['info'](_0x85a6('0xa'),_0x1161bd,'',_0x32cd7c,_0x3a7fc0,JSON[_0x85a6('0xb')](_0x44a112));io['to'](_0x32cd7c)[_0x85a6('0xc')](_0x3a7fc0,_0x44a112);}exports[_0x85a6('0xd')]=function(_0x4e8bb9,_0x18c365,_0x4d9132){_0x4d9132['autoCreate']=0x0;if(_0x18c365[_0x85a6('0xe')]&&parseInt(_0x18c365['data2'],0xa)){var _0x4d31df={'ListId':parseInt(_0x18c365[_0x85a6('0xf')],0xa),'phone':_0x4d9132[_0x85a6('0x10')]};if(_['isNil'](_0x4d9132[_0x85a6('0x11')])){_0x4d31df[_0x85a6('0x12')]=_0x4d9132[_0x85a6('0x13')]&&_0x4d9132[_0x85a6('0x13')]!==_0x85a6('0x14')?_0x4d9132[_0x85a6('0x13')]:_0x4d9132['calleridnum']||_0x4d9132[_0x85a6('0x15')];}else{_0x4d31df[_0x85a6('0x12')]=_0x4d9132[_0x85a6('0x16')]&&_0x4d9132[_0x85a6('0x16')]!==_0x85a6('0x14')?_0x4d9132['destcalleridname']:_0x4d9132['destcalleridnum']||_0x4d9132['uniqueid'];_0x4d31df[_0x85a6('0x17')]=_0x4d9132['destcalleridname']&&_0x4d9132[_0x85a6('0x16')]!==_0x85a6('0x14')?_0x4d9132[_0x85a6('0x16')]:_0x4d9132['destcalleridnum']||_0x4d9132[_0x85a6('0x15')];}BPromise[_0x85a6('0x18')]()['then'](cmContactRpc[_0x85a6('0x19')]({'where':_[_0x85a6('0x1a')](_0x4d31df,[_0x85a6('0x12')])}))[_0x85a6('0x1b')](function(_0x1f2b4e){if(_0x1f2b4e){logger[_0x85a6('0x1c')](_0x85a6('0x1d'),_0x4d9132[_0x85a6('0x15')],'',_0x1f2b4e['id']);if(_0x4e8bb9){_0x4d9132[_0x85a6('0x1e')]=_0x1f2b4e['id'];emit(_0x4d9132[_0x85a6('0x15')],util['format'](_0x85a6('0x1f'),_0x4e8bb9[_0x85a6('0x20')]),util[_0x85a6('0x21')](_0x85a6('0x22'),_0x18c365[_0x85a6('0x23')][_0x85a6('0x24')]()),_['merge'](_0x4d9132,{'ListId':parseInt(_0x18c365['data1'],0xa)}));}return;}else{logger[_0x85a6('0x1c')](_0x85a6('0x25'),_0x4d9132[_0x85a6('0x15')],'');return BPromise[_0x85a6('0x18')]()[_0x85a6('0x1b')](cmContactRpc[_0x85a6('0x26')](_0x4d31df));}})[_0x85a6('0x1b')](function(_0x2f7330){if(_0x2f7330){logger[_0x85a6('0x1c')](_0x85a6('0x27'),_0x4d9132[_0x85a6('0x15')],'',_0x2f7330['id']);if(_0x4e8bb9){_0x4d9132[_0x85a6('0x1e')]=_0x2f7330['id'];emit(_0x4d9132[_0x85a6('0x15')],util[_0x85a6('0x21')]('user:%s',_0x4e8bb9[_0x85a6('0x20')]),util[_0x85a6('0x21')](_0x85a6('0x22'),_0x18c365[_0x85a6('0x23')][_0x85a6('0x24')]()),_[_0x85a6('0x28')](_0x4d9132,{'ListId':parseInt(_0x18c365['data1'],0xa)}));}}})[_0x85a6('0x29')](function(_0x10a7c8){logger[_0x85a6('0x2a')](_0x85a6('0x2b'),_0x4d9132[_0x85a6('0x15')],'',JSON[_0x85a6('0xb')](_0x10a7c8));});}else{if(_0x4e8bb9){logger['info'](_0x85a6('0x2c'),_0x4d9132['uniqueid'],'');emit(_0x4d9132[_0x85a6('0x15')],util['format'](_0x85a6('0x1f'),_0x4e8bb9[_0x85a6('0x20')]),util[_0x85a6('0x21')](_0x85a6('0x22'),_0x18c365[_0x85a6('0x23')]['toLowerCase']()),_[_0x85a6('0x28')]({'ListId':parseInt(_0x18c365['data1'],0xa)},_0x4d9132));}}}; \ No newline at end of file +var _0x3935=['autoCreate','data2','calleridnum','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','format','user:%s','name','trigger:%s','action','toLowerCase','merge','data1','[%s][%s]\x20Contact\x20created:%s','catch','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','info','[%s][%s]','stringify','emit','exec'];(function(_0x5439fa,_0x4b07a5){var _0x8973e9=function(_0x4487f7){while(--_0x4487f7){_0x5439fa['push'](_0x5439fa['shift']());}};_0x8973e9(++_0x4b07a5);}(_0x3935,0x1e1));var _0x5393=function(_0x5b083b,_0x145a9b){_0x5b083b=_0x5b083b-0x0;var _0x6c2225=_0x3935[_0x5b083b];return _0x6c2225;};'use strict';var BPromise=require('bluebird');var util=require(_0x5393('0x0'));var _=require(_0x5393('0x1'));var Redis=require(_0x5393('0x2'));var config=require(_0x5393('0x3'));var logger=require(_0x5393('0x4'))(_0x5393('0x5'));var cmContactRpc=require(_0x5393('0x6'));config['redis']=_['defaults'](config[_0x5393('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5393('0x7')]));function emit(_0x5b01d6,_0x50536d,_0x5e83d8,_0x305902){logger[_0x5393('0x8')](_0x5393('0x9'),_0x5b01d6,'',_0x50536d,_0x5e83d8,JSON[_0x5393('0xa')](_0x305902));io['to'](_0x50536d)[_0x5393('0xb')](_0x5e83d8,_0x305902);}exports[_0x5393('0xc')]=function(_0x42c7d5,_0x12b916,_0x435949){_0x435949[_0x5393('0xd')]=0x0;if(_0x12b916[_0x5393('0xe')]&&parseInt(_0x12b916[_0x5393('0xe')],0xa)){var _0x516462={'ListId':parseInt(_0x12b916['data1'],0xa),'phone':_0x435949[_0x5393('0xf')]};if(_['isNil'](_0x435949[_0x5393('0x10')])){_0x516462[_0x5393('0x11')]=_0x435949[_0x5393('0x12')]&&_0x435949[_0x5393('0x12')]!==_0x5393('0x13')?_0x435949[_0x5393('0x12')]:_0x435949['calleridnum']||_0x435949[_0x5393('0x14')];}else{_0x516462[_0x5393('0x11')]=_0x435949[_0x5393('0x15')]&&_0x435949[_0x5393('0x15')]!==_0x5393('0x13')?_0x435949[_0x5393('0x15')]:_0x435949[_0x5393('0x16')]||_0x435949[_0x5393('0x14')];_0x516462[_0x5393('0x17')]=_0x435949[_0x5393('0x15')]&&_0x435949[_0x5393('0x15')]!==_0x5393('0x13')?_0x435949[_0x5393('0x15')]:_0x435949[_0x5393('0x16')]||_0x435949['uniqueid'];}BPromise[_0x5393('0x18')]()['then'](cmContactRpc['showContact']({'where':_['omit'](_0x516462,[_0x5393('0x11')])}))[_0x5393('0x19')](function(_0x4cad6a){if(_0x4cad6a){logger[_0x5393('0x8')]('[%s][%s]\x20Contact\x20found:%s',_0x435949[_0x5393('0x14')],'',_0x4cad6a['id']);if(_0x42c7d5){_0x435949['xmd-contactid2']=_0x4cad6a['id'];emit(_0x435949[_0x5393('0x14')],util[_0x5393('0x1a')](_0x5393('0x1b'),_0x42c7d5[_0x5393('0x1c')]),util[_0x5393('0x1a')](_0x5393('0x1d'),_0x12b916[_0x5393('0x1e')][_0x5393('0x1f')]()),_[_0x5393('0x20')](_0x435949,{'ListId':parseInt(_0x12b916[_0x5393('0x21')],0xa)}));}return;}else{logger['info']('[%s][%s]\x20Contact\x20not\x20found',_0x435949[_0x5393('0x14')],'');return BPromise[_0x5393('0x18')]()[_0x5393('0x19')](cmContactRpc['createContact'](_0x516462));}})[_0x5393('0x19')](function(_0x466b5d){if(_0x466b5d){logger[_0x5393('0x8')](_0x5393('0x22'),_0x435949['uniqueid'],'',_0x466b5d['id']);if(_0x42c7d5){_0x435949['xmd-contactid2']=_0x466b5d['id'];emit(_0x435949[_0x5393('0x14')],util[_0x5393('0x1a')]('user:%s',_0x42c7d5[_0x5393('0x1c')]),util[_0x5393('0x1a')](_0x5393('0x1d'),_0x12b916[_0x5393('0x1e')][_0x5393('0x1f')]()),_[_0x5393('0x20')](_0x435949,{'ListId':parseInt(_0x12b916[_0x5393('0x21')],0xa)}));}}})[_0x5393('0x23')](function(_0x5cd7d5){logger['error'](_0x5393('0x24'),_0x435949['uniqueid'],'',JSON[_0x5393('0xa')](_0x5cd7d5));});}else{if(_0x42c7d5){logger[_0x5393('0x8')](_0x5393('0x25'),_0x435949[_0x5393('0x14')],'');emit(_0x435949[_0x5393('0x14')],util[_0x5393('0x1a')](_0x5393('0x1b'),_0x42c7d5[_0x5393('0x1c')]),util[_0x5393('0x1a')](_0x5393('0x1d'),_0x12b916[_0x5393('0x1e')]['toLowerCase']()),_[_0x5393('0x20')]({'ListId':parseInt(_0x12b916[_0x5393('0x21')],0xa)},_0x435949));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index cada946..e1476d9 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 _0x42cb=['motionbar','browser','data1','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','data4','windowWidth','data5','800','windowHeight','600','winapp','winArguments','format','user:%s','name','trigger:%s:%s','toLowerCase','jscripty','trigger:%s','contactmanager','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','checkTrigger','AllConditions','length','every','checkConditions','channel','AnyConditions','some','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','membername','lastevent','exports','util','url','mustache','ioredis','./integration','./cmContact','./script','../rpc/cmContact','../../../config/logger','trigger','../ami','defaults','redis','localhost','socket.io-emitter','popup','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','freshsalesAccounts','dynamics365Accounts','servicenowAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:acceptmessage','prototype','emit','info','clone','checkTriggers','agents','interface','hasOwnProperty','merge','Actions','action'];(function(_0x5d3a57,_0x43743e){var _0x2ff1c6=function(_0x4824b3){while(--_0x4824b3){_0x5d3a57['push'](_0x5d3a57['shift']());}};_0x2ff1c6(++_0x43743e);}(_0x42cb,0xae));var _0xb42c=function(_0x3c61c5,_0x58175c){_0x3c61c5=_0x3c61c5-0x0;var _0x2caafd=_0x42cb[_0x3c61c5];return _0x2caafd;};'use strict';var util=require(_0xb42c('0x0'));var _=require('lodash');var url=require(_0xb42c('0x1'));var Mustache=require(_0xb42c('0x2'));var Redis=require(_0xb42c('0x3'));var urlforward=require('./urlforward');var integration=require(_0xb42c('0x4'));var cmContact=require(_0xb42c('0x5'));var script=require(_0xb42c('0x6'));var cmContactRpc=require(_0xb42c('0x7'));var config=require('../../../config/environment');var logger=require(_0xb42c('0x8'))(_0xb42c('0x9'));var ami=require(_0xb42c('0xa'));config['redis']=_[_0xb42c('0xb')](config[_0xb42c('0xc')],{'host':_0xb42c('0xd'),'port':0x18eb});var io=require(_0xb42c('0xe'))(new Redis(config[_0xb42c('0xc')]));var operators={'equals':function(_0x1d0aff,_0x2580b1){return _0x1d0aff==_0x2580b1;},'not_equals':function(_0x198699,_0x2446a6){return _0x198699!=_0x2446a6;}};var barAndWebActions=[_0xb42c('0xf'),_0xb42c('0x1'),'winapp'];function Trigger(_0x126721){this[_0xb42c('0x10')]=_0x126721[_0xb42c('0x10')];this['agents']=_0x126721['agents'];this[_0xb42c('0x11')]=_0x126721[_0xb42c('0x11')];this['templates']=_0x126721[_0xb42c('0x12')];this[_0xb42c('0x13')]=_0x126721[_0xb42c('0x13')];this[_0xb42c('0x14')]=_0x126721[_0xb42c('0x14')];this[_0xb42c('0x15')]=_0x126721[_0xb42c('0x15')];this['salesforceAccounts']=_0x126721[_0xb42c('0x16')];this['sugarcrmAccounts']=_0x126721[_0xb42c('0x17')];this[_0xb42c('0x18')]=_0x126721[_0xb42c('0x18')];this[_0xb42c('0x19')]=_0x126721[_0xb42c('0x19')];this[_0xb42c('0x1a')]=_0x126721[_0xb42c('0x1a')];this['servicenowAccounts']=_0x126721['servicenowAccounts'];this['dynamics365Accounts']=_0x126721['dynamics365Accounts'];this[_0xb42c('0x1b')]=_0x126721['freshsalesAccounts'];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xb42c('0x16')],'freshdesk':this[_0xb42c('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xb42c('0x18')],'desk':this[_0xb42c('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xb42c('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xb42c('0x1d')]};ami['on']('custom:agentcalled',this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x20'),this['syncCustomEvent'][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x21'),this[_0xb42c('0x1e')]['bind'](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0xb42c('0x1f')](this));ami['on']('custom:agentnosuchnumber',this[_0xb42c('0x1e')]['bind'](this));ami['on'](_0xb42c('0x22'),this[_0xb42c('0x1e')]['bind'](this));ami['on'](_0xb42c('0x23'),this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x24'),this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x25'),this['syncCustomEvent'][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x26'),this['syncCustomEvent'][_0xb42c('0x1f')](this));ami['on']('custom:timeout',this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x27'),this[_0xb42c('0x28')][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x29'),this[_0xb42c('0x28')][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x2a'),this[_0xb42c('0x28')][_0xb42c('0x1f')](this));ami['on']('custom:newinteraction',this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x2b'),this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));ami['on']('custom:incomingmessage',this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));ami['on']('custom:outgoingmessage',this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));ami['on'](_0xb42c('0x2c'),this['syncCustomEvent'][_0xb42c('0x1f')](this));ami['on']('custom:rejectmessage',this[_0xb42c('0x1e')][_0xb42c('0x1f')](this));}Trigger[_0xb42c('0x2d')][_0xb42c('0x2e')]=function(_0x155033,_0x2932ff,_0x2a4e1b){logger[_0xb42c('0x2f')](_0x155033,_0x2932ff,JSON['stringify'](_0x2a4e1b));io['to'](_0x155033)[_0xb42c('0x2e')](_0x2932ff,_0x2a4e1b);};Trigger[_0xb42c('0x2d')][_0xb42c('0x1e')]=function(_0x4424c0){var _0x40b55a=_[_0xb42c('0x30')](_0x4424c0);this[_0xb42c('0x31')](_0x40b55a);};Trigger[_0xb42c('0x2d')][_0xb42c('0x28')]=function(_0x5a6ad7){if(this[_0xb42c('0x32')][_0x5a6ad7[_0xb42c('0x33')]]){this[_0xb42c('0x1e')](_0x5a6ad7);}};Trigger['prototype'][_0xb42c('0x31')]=function(_0x464d76){var _0x39af28;for(var _0x54bbc8 in this['triggers']){if(this[_0xb42c('0x10')][_0xb42c('0x34')](_0x54bbc8)){if(this[_0xb42c('0x10')][_0x54bbc8]['status']){_0x39af28=this['checkTrigger'](this[_0xb42c('0x10')][_0x54bbc8],_0x464d76);if(_0x39af28){_[_0xb42c('0x35')](_0x464d76,_0x464d76['variables']);for(var _0x7f014b=0x0,_0x495f77,_0x135e54,_0x149303;_0x7f014b0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','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','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ 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 e977dbb..d95364f 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 _0x46a3=['userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','catch','telephone1','enduserId',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','assign','/systemusers(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\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','./util','ioredis','dynamics365','../../../../config/environment','defaults','redis','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!'];(function(_0x3c2aff,_0x9a30c3){var _0x3ba351=function(_0x545f7e){while(--_0x545f7e){_0x3c2aff['push'](_0x3c2aff['shift']());}};_0x3ba351(++_0x9a30c3);}(_0x46a3,0x99));var _0x346a=function(_0xb4d64b,_0x2c323a){_0xb4d64b=_0xb4d64b-0x0;var _0x1269fe=_0x46a3[_0xb4d64b];return _0x1269fe;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require('request-promise');var util=require('util');var intUtil=require(_0x346a('0x0'));var md5=require('md5');var Redis=require(_0x346a('0x1'));var logger=require('../../../../config/logger')(_0x346a('0x2'));var config=require(_0x346a('0x3'));config['redis']=_[_0x346a('0x4')](config[_0x346a('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x346a('0x5')]));function getAuthToken(_0xbd8562,_0x2654d7,_0x5d6d24){var _0x1f0112={'method':_0x346a('0x6'),'uri':_0x2654d7,'form':{'client_id':_0xbd8562[_0x346a('0x7')],'resource':_0xbd8562[_0x346a('0x8')],'username':_0xbd8562[_0x346a('0x9')],'password':_0xbd8562[_0x346a('0xa')],'grant_type':_0x346a('0xa'),'client_secret':_0xbd8562[_0x346a('0xb')]},'json':!![]};return rp(_0x1f0112)[_0x346a('0xc')](function(_0x1511cc){return _0x1511cc[_0x346a('0xd')];})['catch'](function(_0x47c38a){logger[_0x346a('0xe')]('['+[_0x5d6d24[_0x346a('0xf')]()]+_0x346a('0x10'));return _0x47c38a['message'];});}function getUser(_0x5cdea2,_0x3fc9de,_0x4e5730,_0x1c9fa6,_0x5b35b9,_0xd20e9){return new BPromise(function(_0xb6a086,_0x5f52fd){return getAuthToken(_0x3fc9de,_0x1c9fa6,_0xd20e9)['then'](function(_0x4b160a){var _0x21f7d4={'method':'GET','uri':_0x5b35b9+_0x346a('0x11'),'headers':{'Authorization':_0x346a('0x12')+_0x4b160a,'OData-Version':_0x346a('0x13')},'json':!![]};return rp(_0x21f7d4);})[_0x346a('0xc')](function(_0x1275f8){var _0x2fed2c=_0x1275f8[_0x346a('0x14')];var _0x30d37c=![];var _0x5de931=null;if(!_[_0x346a('0x15')](_0x4e5730)){if(intUtil[_0x346a('0x16')](_0x4e5730[_0x346a('0x17')])){_0x5cdea2[_0x346a('0x18')]=_0x4e5730[_0x346a('0x17')];for(_0x5de931=0x0;_0x5de931<_0x2fed2c[_0x346a('0x19')];_0x5de931++){if(_0x2fed2c[_0x5de931][_0x346a('0x1a')]===_0x4e5730[_0x346a('0x17')]&&!_0x2fed2c[_0x5de931][_0x346a('0x1b')]){_0x30d37c=!![];logger[_0x346a('0x1c')]('['+[_0xd20e9[_0x346a('0xf')]()]+']\x20Agent\x20found\x20'+_0x2fed2c[_0x5de931][_0x346a('0x1d')]+'!');_0x5cdea2['userId']=_0x2fed2c[_0x5de931][_0x346a('0x1d')];}}}}if(!_0x30d37c){logger[_0x346a('0x1c')]('['+[_0xd20e9[_0x346a('0xf')]()]+_0x346a('0x1e'));_0x5cdea2[_0x346a('0x18')]=_0x3fc9de[_0x346a('0x9')];for(_0x5de931=0x0;_0x5de931<_0x2fed2c['length'];_0x5de931++){if(_0x2fed2c[_0x5de931]['internalemailaddress']===_0x3fc9de[_0x346a('0x9')]){_0x5cdea2[_0x346a('0x1f')]=_0x2fed2c[_0x5de931][_0x346a('0x1d')];}}}_0xb6a086(_0x5cdea2);})['catch'](function(_0x47b2b4){_0x5f52fd(_0x47b2b4[_0x346a('0x20')]);});});}function createEndUser(_0x203bb5,_0x30453e,_0x58def9,_0x4b4ef9,_0x379267,_0xebdf40){return new BPromise(function(_0x4c11d7,_0x3592db){return getAuthToken(_0x30453e,_0x58def9,_0xebdf40)[_0x346a('0xc')](function(_0x453ca3){var _0x23422b=_0xebdf40[_0x346a('0x21')]()===_0x346a('0x22')?_0x379267[_0x346a('0x23')]:_0x379267[_0x346a('0x24')];var _0xadd876={'method':'POST','uri':_0x4b4ef9+_0x346a('0x25'),'body':{'telephone1':_0x23422b,'fullname':_0x23422b,'firstname':_0x23422b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x203bb5['userId']+')'},'headers':{'Authorization':_0x346a('0x12')+_0x453ca3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xadd876);})[_0x346a('0xc')](function(_0x31409e){var _0x28feae=_0x31409e[_0x346a('0x26')][_0x346a('0x27')];var _0xcc371d=_0x28feae[_0x346a('0x28')](_0x28feae[_0x346a('0x29')]('(')+0x1,_0x28feae[_0x346a('0x29')](')'));_0x203bb5['enduserId']=_0xcc371d;_0x4c11d7(_0x203bb5);})[_0x346a('0x2a')](function(_0xf6ed66){_0x3592db(_0xf6ed66[_0x346a('0x20')]);});});}function getEndUser(_0x1f062f,_0x43258b,_0x3f45ca,_0x3fd3d2,_0x1925d3,_0x456f30){return new BPromise(function(_0x27e469,_0x1c6e4a){return getAuthToken(_0x43258b,_0x3f45ca,_0x456f30)[_0x346a('0xc')](function(_0x473b09){var _0xede237={'method':'GET','uri':_0x3fd3d2+'contacts?$select=telephone1','headers':{'Authorization':_0x346a('0x12')+_0x473b09,'If-None-Match':null,'OData-Version':_0x346a('0x13')},'json':!![]};return rp(_0xede237);})[_0x346a('0xc')](function(_0x46eccc){var _0x4709b9=null;if(_0x46eccc){var _0x4b43c2=_0x46eccc[_0x346a('0x14')];var _0x237d47=![];for(_0x4709b9=0x0;_0x4709b9<_0x4b43c2['length'];_0x4709b9++){var _0x458301=_0x456f30[_0x346a('0x21')]()===_0x346a('0x22')?_0x1925d3[_0x346a('0x23')]:_0x1925d3[_0x346a('0x24')];if(_0x4b43c2[_0x4709b9][_0x346a('0x2b')]===_0x458301){_0x237d47=!![];_0x1f062f[_0x346a('0x2c')]=_0x4b43c2[_0x4709b9]['contactid'];}}if(_0x237d47){_0x27e469(_0x1f062f);}else{return createEndUser(_0x1f062f,_0x43258b,_0x3f45ca,_0x3fd3d2,_0x1925d3,_0x456f30)['then'](function(_0x31e9e9){logger[_0x346a('0x1c')]('['+[_0x456f30['toUpperCase']()]+_0x346a('0x2d'),_0x31e9e9[_0x346a('0x2c')]);_0x27e469(_0x31e9e9);});}}else{return createEndUser(_0x1f062f,_0x43258b,_0x3f45ca,_0x3fd3d2,_0x1925d3,_0x456f30)[_0x346a('0xc')](function(_0x3ed70e){logger[_0x346a('0x1c')]('['+[_0x456f30[_0x346a('0xf')]()]+_0x346a('0x2e'),_0x3ed70e[_0x346a('0x2c')]);_0x27e469(_0x3ed70e);});}});});}function getCustomFields(_0x23563f,_0x16263d,_0x436f39){var _0xd3022e={};if(_0x23563f[_0x346a('0x19')]>0x0){_[_0x346a('0x2f')](_0x23563f,function(_0x4621e6){if(_0x4621e6[_0x346a('0x30')]==='string'&&_0x4621e6[_0x346a('0x31')]&&!_0x4621e6[_0x346a('0x32')]){var _0x3cc17b=_0x4621e6[_0x346a('0x33')][_0x346a('0x21')]();var _0x4b2cb8=_0x3cc17b[_0x346a('0x28')](0x0,_0x3cc17b['indexOf']('_'));var _0xd270b3=_0x3cc17b['substring'](_0x3cc17b[_0x346a('0x34')]('_')+0x1);if(_0x4b2cb8===_0x436f39){_0xd3022e[_0xd270b3]=_0x4621e6['content'];}}});}return _0xd3022e;}function getTicket(_0x3a64ce,_0x2678b3,_0x366aca,_0x56a8e3,_0x3a2d31,_0x58d8e6,_0x4dccef){return new BPromise(function(_0x58a484,_0x11a88d){var _0x407144;return getAuthToken(_0x2678b3,_0x366aca,_0x4dccef)[_0x346a('0xc')](function(_0x3955c1){if(_0x58d8e6[_0x346a('0x35')]===_0x346a('0x36')){_0x407144={'method':_0x346a('0x6'),'uri':_0x56a8e3+_0x346a('0x37'),'body':Object['assign']({},{'title':intUtil[_0x346a('0x38')](_0x58d8e6[_0x346a('0x39')],_0x3a2d31,'\x20'),'description':intUtil[_0x346a('0x38')](_0x58d8e6[_0x346a('0x3a')],_0x3a2d31,'\x0a'),'customerid_contact@odata.bind':_0x346a('0x3b')+_0x3a64ce[_0x346a('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x3a64ce[_0x346a('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x58d8e6[_0x346a('0x3c')],_0x3a2d31,_0x58d8e6[_0x346a('0x35')])),'headers':{'Authorization':_0x346a('0x12')+_0x3955c1,'OData-Version':_0x346a('0x13')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x58d8e6[_0x346a('0x35')]===_0x346a('0x3d')){_0x407144={'method':'POST','uri':_0x56a8e3+_0x346a('0x3e'),'body':Object[_0x346a('0x3f')]({},{'subject':intUtil[_0x346a('0x38')](_0x58d8e6[_0x346a('0x39')],_0x3a2d31,'\x20'),'phonenumber':String(_0x3a2d31['calleridnum']),'description':intUtil[_0x346a('0x38')](_0x58d8e6['Descriptions'],_0x3a2d31,'\x0a'),'regardingobjectid_contact@odata.bind':_0x346a('0x3b')+_0x3a64ce['enduserId']+')','ownerid@odata.bind':_0x346a('0x40')+_0x3a64ce['userId']+')','directioncode':_0x3a64ce[_0x346a('0x41')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3a64ce[_0x346a('0x1f')]+')','participationtypemask':_0x3a64ce[_0x346a('0x41')]===_0x346a('0x42')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3a64ce[_0x346a('0x2c')]+')','participationtypemask':_0x3a64ce[_0x346a('0x41')]===_0x346a('0x42')?0x1:0x2}]},getCustomFields(_0x58d8e6[_0x346a('0x3c')],_0x3a2d31,_0x58d8e6[_0x346a('0x35')])),'headers':{'Authorization':_0x346a('0x12')+_0x3955c1,'OData-Version':_0x346a('0x13')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x407144);})['then'](function(_0x41c10a){var _0x1a7b23=_0x41c10a[_0x346a('0x26')][_0x346a('0x27')];var _0x5b6cbc=_0x1a7b23[_0x346a('0x28')](_0x1a7b23[_0x346a('0x29')]('(')+0x1,_0x1a7b23[_0x346a('0x29')](')'));_0x3a64ce[_0x346a('0x43')]=_0x5b6cbc;_0x58a484(_0x3a64ce);})[_0x346a('0x2a')](function(_0x1871d8){_0x11a88d(_0x1871d8[_0x346a('0x20')]);});});}function emit(_0x59887b,_0x2bd668,_0x56ad70,_0x167d23){var _0x40047d={'uri':util[_0x346a('0x44')](_0x346a('0x45'),_0x59887b,_0x56ad70,_0x167d23)};io['to'](util[_0x346a('0x44')]('user:%s',_0x2bd668))[_0x346a('0x46')]('trigger:browser:url',_0x40047d);}exports['cs']=function(_0x28021f,_0x3493c,_0xec94fd,_0x21c143,_0x2f8ea9,_0x4b9cf1,_0x145b26,_0x5c665b){var _0x578d8a={};_0x4b9cf1[_0x346a('0x8')]=intUtil['stripTrailingSlash'](_0x4b9cf1[_0x346a('0x8')]);_0x4b9cf1[_0x346a('0x47')]=intUtil[_0x346a('0x48')](_0x4b9cf1[_0x346a('0x47')]);_0x578d8a[_0x346a('0x41')]=_0x5c665b==='queue'||_0x5c665b===_0x346a('0x49')?'queue':_0x346a('0x22');var _0x195cab=util[_0x346a('0x44')](_0x346a('0x4a'),_0x4b9cf1[_0x346a('0x8')]);var _0x36a85a=util[_0x346a('0x44')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4b9cf1[_0x346a('0x4b')]);var _0x52cfe5=util[_0x346a('0x44')](_0x346a('0x4c'),_0x4b9cf1[_0x346a('0x47')],_0x3493c[_0x346a('0x4d')],md5(_0x3493c[_0x346a('0x4d')]));if(_0x2f8ea9&&_0x2f8ea9[_0x346a('0x4e')]){logger['info'](_0x346a('0x4f'),_0x346a('0x50'));_0x3493c[_0x346a('0x51')]=_0x52cfe5;}else if(_0x145b26&&_0x145b26[_0x346a('0x52')]&&_0x145b26[_0x346a('0x52')]!==_0x346a('0x53')){logger[_0x346a('0x1c')](_0x346a('0x54'),_0x346a('0x50'));_0x3493c[_0x346a('0x51')]=_0x52cfe5;}else{_0x3493c[_0x346a('0x51')]='';}return getUser(_0x578d8a,_0x4b9cf1,_0x21c143,_0x36a85a,_0x195cab,_0x5c665b)[_0x346a('0xc')](function(_0xf2f5c4){logger[_0x346a('0x1c')]('['+_0x5c665b[_0x346a('0xf')]()+']\x20The\x20User\x20ID\x20is:',_0xf2f5c4['userId']);logger['info']('['+_0x5c665b[_0x346a('0xf')]()+']\x20The\x20User\x20email\x20is:',_0xf2f5c4[_0x346a('0x18')]);return getEndUser(_0xf2f5c4,_0x4b9cf1,_0x36a85a,_0x195cab,_0x3493c,_0x5c665b);})[_0x346a('0xc')](function(_0x273b2d){logger[_0x346a('0x1c')]('['+_0x5c665b[_0x346a('0xf')]()+_0x346a('0x55'),_0x273b2d[_0x346a('0x2c')]);logger[_0x346a('0x1c')]('['+_0x5c665b[_0x346a('0xf')]()+_0x346a('0x56'),_0x3493c[_0x346a('0x24')]);return getTicket(_0x273b2d,_0x4b9cf1,_0x36a85a,_0x195cab,_0x3493c,_0xec94fd,_0x5c665b);})[_0x346a('0xc')](function(_0x311c45){logger[_0x346a('0x1c')](util[_0x346a('0x44')]('['+_0x5c665b[_0x346a('0xf')]()+_0x346a('0x57'),_0xec94fd[_0x346a('0x35')],_0x311c45[_0x346a('0x43')]));logger[_0x346a('0x1c')](util[_0x346a('0x44')]('['+_0x5c665b[_0x346a('0xf')]()+_0x346a('0x58'),_0x5c665b));if(_0x5c665b!==_0x346a('0x49')){logger[_0x346a('0x1c')]('['+_0x5c665b[_0x346a('0xf')]()+']',_0x346a('0x59'));emit(_0x4b9cf1['remoteUri'],_0x21c143[_0x346a('0x5a')],_0xec94fd['ticketType'],_0x311c45['ticketId']);}})[_0x346a('0x2a')](function(_0x286f3b){logger['error']('['+_0x5c665b[_0x346a('0xf')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x346a('0x5b')](_0x286f3b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcbf6=['systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid','forEach','nameField','indexOf','content','ticketType','incident','getString','/contacts(','Fields','phonecall','assign','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL',']\x20The\x20User\x20ID\x20is:','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','POST','clientId','username','password','clientSecret','then','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','GET'];(function(_0x4a325a,_0x2c154c){var _0x2597a1=function(_0x437af3){while(--_0x437af3){_0x4a325a['push'](_0x4a325a['shift']());}};_0x2597a1(++_0x2c154c);}(_0xcbf6,0x9c));var _0x6cbf=function(_0x528511,_0x815fd3){_0x528511=_0x528511-0x0;var _0xd1b2b7=_0xcbf6[_0x528511];return _0xd1b2b7;};'use strict';var _=require(_0x6cbf('0x0'));var BPromise=require('bluebird');var rp=require(_0x6cbf('0x1'));var util=require(_0x6cbf('0x2'));var intUtil=require('./util');var md5=require(_0x6cbf('0x3'));var Redis=require('ioredis');var logger=require(_0x6cbf('0x4'))('dynamics365');var config=require(_0x6cbf('0x5'));config[_0x6cbf('0x6')]=_[_0x6cbf('0x7')](config[_0x6cbf('0x6')],{'host':_0x6cbf('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6cbf('0x6')]));function getAuthToken(_0x6b261b,_0x4e001b,_0x3085a1){var _0x4487be={'method':_0x6cbf('0x9'),'uri':_0x4e001b,'form':{'client_id':_0x6b261b[_0x6cbf('0xa')],'resource':_0x6b261b['remoteUri'],'username':_0x6b261b[_0x6cbf('0xb')],'password':_0x6b261b[_0x6cbf('0xc')],'grant_type':_0x6cbf('0xc'),'client_secret':_0x6b261b[_0x6cbf('0xd')]},'json':!![]};return rp(_0x4487be)[_0x6cbf('0xe')](function(_0xe4be38){return _0xe4be38[_0x6cbf('0xf')];})['catch'](function(_0xf4b12d){logger['error']('['+[_0x3085a1[_0x6cbf('0x10')]()]+_0x6cbf('0x11'));return _0xf4b12d[_0x6cbf('0x12')];});}function getUser(_0x655dc2,_0x45a412,_0x3bb890,_0x379687,_0x341cfc,_0x5d9b84){return new BPromise(function(_0x49b99e,_0x1b0f28){return getAuthToken(_0x45a412,_0x379687,_0x5d9b84)['then'](function(_0x5e9cf6){var _0x4ffca2={'method':_0x6cbf('0x13'),'uri':_0x341cfc+_0x6cbf('0x14'),'headers':{'Authorization':_0x6cbf('0x15')+_0x5e9cf6,'OData-Version':_0x6cbf('0x16')},'json':!![]};return rp(_0x4ffca2);})['then'](function(_0x40af83){var _0x34478d=_0x40af83[_0x6cbf('0x17')];var _0xf4ff02=![];var _0xbd65b=null;if(!_[_0x6cbf('0x18')](_0x3bb890)){if(intUtil[_0x6cbf('0x19')](_0x3bb890[_0x6cbf('0x1a')])){_0x655dc2[_0x6cbf('0x1b')]=_0x3bb890[_0x6cbf('0x1a')];for(_0xbd65b=0x0;_0xbd65b<_0x34478d[_0x6cbf('0x1c')];_0xbd65b++){if(_0x34478d[_0xbd65b][_0x6cbf('0x1d')]===_0x3bb890[_0x6cbf('0x1a')]&&!_0x34478d[_0xbd65b][_0x6cbf('0x1e')]){_0xf4ff02=!![];logger[_0x6cbf('0x1f')]('['+[_0x5d9b84[_0x6cbf('0x10')]()]+_0x6cbf('0x20')+_0x34478d[_0xbd65b][_0x6cbf('0x21')]+'!');_0x655dc2[_0x6cbf('0x22')]=_0x34478d[_0xbd65b][_0x6cbf('0x21')];}}}}if(!_0xf4ff02){logger['info']('['+[_0x5d9b84[_0x6cbf('0x10')]()]+_0x6cbf('0x23'));_0x655dc2[_0x6cbf('0x1b')]=_0x45a412[_0x6cbf('0xb')];for(_0xbd65b=0x0;_0xbd65b<_0x34478d[_0x6cbf('0x1c')];_0xbd65b++){if(_0x34478d[_0xbd65b]['internalemailaddress']===_0x45a412[_0x6cbf('0xb')]){_0x655dc2[_0x6cbf('0x22')]=_0x34478d[_0xbd65b][_0x6cbf('0x21')];}}}_0x49b99e(_0x655dc2);})[_0x6cbf('0x24')](function(_0x375aa6){_0x1b0f28(_0x375aa6['message']);});});}function createEndUser(_0x17ee42,_0x5d9e45,_0x4ffb10,_0x444bd6,_0x2af2dd,_0x405ffc){return new BPromise(function(_0xa73952,_0x2bb0fa){return getAuthToken(_0x5d9e45,_0x4ffb10,_0x405ffc)['then'](function(_0x3c5f92){var _0x5d7685=_0x405ffc[_0x6cbf('0x25')]()===_0x6cbf('0x26')?_0x2af2dd[_0x6cbf('0x27')]:_0x2af2dd[_0x6cbf('0x28')];var _0x1fb2a4={'method':_0x6cbf('0x9'),'uri':_0x444bd6+_0x6cbf('0x29'),'body':{'telephone1':_0x5d7685,'fullname':_0x5d7685,'firstname':_0x5d7685,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6cbf('0x2a')+_0x17ee42[_0x6cbf('0x22')]+')'},'headers':{'Authorization':_0x6cbf('0x15')+_0x3c5f92,'OData-Version':_0x6cbf('0x16')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1fb2a4);})[_0x6cbf('0xe')](function(_0x384cc5){var _0x1153c4=_0x384cc5[_0x6cbf('0x2b')][_0x6cbf('0x2c')];var _0x37a5b2=_0x1153c4[_0x6cbf('0x2d')](_0x1153c4[_0x6cbf('0x2e')]('(')+0x1,_0x1153c4['lastIndexOf'](')'));_0x17ee42[_0x6cbf('0x2f')]=_0x37a5b2;_0xa73952(_0x17ee42);})['catch'](function(_0xee2aa2){_0x2bb0fa(_0xee2aa2[_0x6cbf('0x12')]);});});}function getEndUser(_0x4af520,_0x412691,_0x189a38,_0xa6846e,_0x44feab,_0x2a6c4a){return new BPromise(function(_0x22bca8,_0x58de9e){return getAuthToken(_0x412691,_0x189a38,_0x2a6c4a)[_0x6cbf('0xe')](function(_0x3ccdb2){var _0x315780={'method':_0x6cbf('0x13'),'uri':_0xa6846e+_0x6cbf('0x30'),'headers':{'Authorization':_0x6cbf('0x15')+_0x3ccdb2,'If-None-Match':null,'OData-Version':_0x6cbf('0x16')},'json':!![]};return rp(_0x315780);})['then'](function(_0x226ff9){var _0x45e7ea=null;if(_0x226ff9){var _0x31b253=_0x226ff9[_0x6cbf('0x17')];var _0x30a153=![];for(_0x45e7ea=0x0;_0x45e7ea<_0x31b253[_0x6cbf('0x1c')];_0x45e7ea++){var _0x536d60=_0x2a6c4a[_0x6cbf('0x25')]()===_0x6cbf('0x26')?_0x44feab[_0x6cbf('0x27')]:_0x44feab['calleridnum'];if(_0x31b253[_0x45e7ea][_0x6cbf('0x31')]===_0x536d60){_0x30a153=!![];_0x4af520['enduserId']=_0x31b253[_0x45e7ea][_0x6cbf('0x32')];}}if(_0x30a153){_0x22bca8(_0x4af520);}else{return createEndUser(_0x4af520,_0x412691,_0x189a38,_0xa6846e,_0x44feab,_0x2a6c4a)[_0x6cbf('0xe')](function(_0x4b44a0){logger['info']('['+[_0x2a6c4a[_0x6cbf('0x10')]()]+']\x20Enduser\x20created!',_0x4b44a0[_0x6cbf('0x2f')]);_0x22bca8(_0x4b44a0);});}}else{return createEndUser(_0x4af520,_0x412691,_0x189a38,_0xa6846e,_0x44feab,_0x2a6c4a)['then'](function(_0x30f9a3){logger['info']('['+[_0x2a6c4a['toUpperCase']()]+']\x20Enduser\x20Created!',_0x30f9a3['enduserId']);_0x22bca8(_0x30f9a3);});}});});}function getCustomFields(_0xabd742,_0x2fb05f,_0x15f155){var _0x5e10e8={};if(_0xabd742[_0x6cbf('0x1c')]>0x0){_[_0x6cbf('0x33')](_0xabd742,function(_0x7d5f4b){if(_0x7d5f4b['type']==='string'&&_0x7d5f4b[_0x6cbf('0x34')]&&!_0x7d5f4b['customField']){var _0x13944a=_0x7d5f4b['idField']['toLowerCase']();var _0x169c84=_0x13944a[_0x6cbf('0x2d')](0x0,_0x13944a[_0x6cbf('0x35')]('_'));var _0x1f7c3b=_0x13944a['substring'](_0x13944a[_0x6cbf('0x35')]('_')+0x1);if(_0x169c84===_0x15f155){_0x5e10e8[_0x1f7c3b]=_0x7d5f4b[_0x6cbf('0x36')];}}});}return _0x5e10e8;}function getTicket(_0x4ec3a6,_0x63991c,_0x420e59,_0x185063,_0x2d35b8,_0xa65739,_0x2741db){return new BPromise(function(_0x516505,_0x41b881){var _0x1c6098;return getAuthToken(_0x63991c,_0x420e59,_0x2741db)['then'](function(_0x3d28e3){if(_0xa65739[_0x6cbf('0x37')]===_0x6cbf('0x38')){_0x1c6098={'method':'POST','uri':_0x185063+'incidents','body':Object['assign']({},{'title':intUtil[_0x6cbf('0x39')](_0xa65739['Subjects'],_0x2d35b8,'\x20'),'description':intUtil['getString'](_0xa65739['Descriptions'],_0x2d35b8,'\x0a'),'customerid_contact@odata.bind':_0x6cbf('0x3a')+_0x4ec3a6['enduserId']+')','ownerid@odata.bind':_0x6cbf('0x2a')+_0x4ec3a6[_0x6cbf('0x22')]+')','caseorigincode':'1'},getCustomFields(_0xa65739[_0x6cbf('0x3b')],_0x2d35b8,_0xa65739['ticketType'])),'headers':{'Authorization':_0x6cbf('0x15')+_0x3d28e3,'OData-Version':_0x6cbf('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xa65739[_0x6cbf('0x37')]===_0x6cbf('0x3c')){_0x1c6098={'method':'POST','uri':_0x185063+'phonecalls','body':Object[_0x6cbf('0x3d')]({},{'subject':intUtil[_0x6cbf('0x39')](_0xa65739['Subjects'],_0x2d35b8,'\x20'),'phonenumber':String(_0x2d35b8['calleridnum']),'description':intUtil[_0x6cbf('0x39')](_0xa65739['Descriptions'],_0x2d35b8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x6cbf('0x3a')+_0x4ec3a6[_0x6cbf('0x2f')]+')','ownerid@odata.bind':_0x6cbf('0x2a')+_0x4ec3a6['userId']+')','directioncode':_0x4ec3a6[_0x6cbf('0x3e')]===_0x6cbf('0x3f')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x6cbf('0x2a')+_0x4ec3a6[_0x6cbf('0x22')]+')','participationtypemask':_0x4ec3a6[_0x6cbf('0x3e')]===_0x6cbf('0x3f')?0x2:0x1},{'partyid_contact@odata.bind':_0x6cbf('0x3a')+_0x4ec3a6['enduserId']+')','participationtypemask':_0x4ec3a6['callDirection']===_0x6cbf('0x3f')?0x1:0x2}]},getCustomFields(_0xa65739[_0x6cbf('0x3b')],_0x2d35b8,_0xa65739[_0x6cbf('0x37')])),'headers':{'Authorization':_0x6cbf('0x15')+_0x3d28e3,'OData-Version':_0x6cbf('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1c6098);})[_0x6cbf('0xe')](function(_0x5102f7){var _0x166218=_0x5102f7[_0x6cbf('0x2b')]['odata-entityid'];var _0x3e7c95=_0x166218[_0x6cbf('0x2d')](_0x166218['lastIndexOf']('(')+0x1,_0x166218[_0x6cbf('0x2e')](')'));_0x4ec3a6[_0x6cbf('0x40')]=_0x3e7c95;_0x516505(_0x4ec3a6);})[_0x6cbf('0x24')](function(_0x2f118f){_0x41b881(_0x2f118f[_0x6cbf('0x12')]);});});}function emit(_0x21756a,_0x57e725,_0x3cef67,_0xd1c3c0){var _0x45245d={'uri':util[_0x6cbf('0x41')](_0x6cbf('0x42'),_0x21756a,_0x3cef67,_0xd1c3c0)};io['to'](util[_0x6cbf('0x41')](_0x6cbf('0x43'),_0x57e725))[_0x6cbf('0x44')]('trigger:browser:url',_0x45245d);}exports['cs']=function(_0x34cc88,_0x1b320d,_0x463419,_0x1624ad,_0x332c2f,_0x3cfced,_0x4e2ba2,_0x55f732){var _0x497faf={};_0x3cfced[_0x6cbf('0x45')]=intUtil[_0x6cbf('0x46')](_0x3cfced['remoteUri']);_0x3cfced[_0x6cbf('0x47')]=intUtil[_0x6cbf('0x46')](_0x3cfced['serverUrl']);_0x497faf[_0x6cbf('0x3e')]=_0x55f732==='queue'||_0x55f732===_0x6cbf('0x48')?'queue':_0x6cbf('0x26');var _0x5284b4=util[_0x6cbf('0x41')](_0x6cbf('0x49'),_0x3cfced[_0x6cbf('0x45')]);var _0xd6190e=util[_0x6cbf('0x41')](_0x6cbf('0x4a'),_0x3cfced[_0x6cbf('0x4b')]);var _0x55b2cd=util['format'](_0x6cbf('0x4c'),_0x3cfced['serverUrl'],_0x1b320d['uniqueid'],md5(_0x1b320d[_0x6cbf('0x4d')]));if(_0x332c2f&&_0x332c2f[_0x6cbf('0x4e')]){logger[_0x6cbf('0x1f')](_0x6cbf('0x4f'),_0x6cbf('0x50'));_0x1b320d['recordingURL']=_0x55b2cd;}else if(_0x4e2ba2&&_0x4e2ba2[_0x6cbf('0x51')]&&_0x4e2ba2['recordingFormat']!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1b320d['recordingURL']=_0x55b2cd;}else{_0x1b320d[_0x6cbf('0x52')]='';}return getUser(_0x497faf,_0x3cfced,_0x1624ad,_0xd6190e,_0x5284b4,_0x55f732)['then'](function(_0x4d0adb){logger[_0x6cbf('0x1f')]('['+_0x55f732[_0x6cbf('0x10')]()+_0x6cbf('0x53'),_0x4d0adb['userId']);logger[_0x6cbf('0x1f')]('['+_0x55f732[_0x6cbf('0x10')]()+']\x20The\x20User\x20email\x20is:',_0x4d0adb['userEmail']);return getEndUser(_0x4d0adb,_0x3cfced,_0xd6190e,_0x5284b4,_0x1b320d,_0x55f732);})[_0x6cbf('0xe')](function(_0x181011){logger[_0x6cbf('0x1f')]('['+_0x55f732['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x181011['enduserId']);logger['info']('['+_0x55f732[_0x6cbf('0x10')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1b320d[_0x6cbf('0x28')]);return getTicket(_0x181011,_0x3cfced,_0xd6190e,_0x5284b4,_0x1b320d,_0x463419,_0x55f732);})[_0x6cbf('0xe')](function(_0x6a92ce){logger[_0x6cbf('0x1f')](util[_0x6cbf('0x41')]('['+_0x55f732[_0x6cbf('0x10')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x463419[_0x6cbf('0x37')],_0x6a92ce[_0x6cbf('0x40')]));logger['info'](util[_0x6cbf('0x41')]('['+_0x55f732[_0x6cbf('0x10')]()+']\x20Call\x20direction:\x20%s',_0x55f732));if(_0x55f732!=='unmanaged'){logger['info']('['+_0x55f732['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3cfced['remoteUri'],_0x1624ad[_0x6cbf('0x54')],_0x463419[_0x6cbf('0x37')],_0x6a92ce[_0x6cbf('0x40')]);}})['catch'](function(_0x4b3ff8){logger[_0x6cbf('0x55')]('['+_0x55f732[_0x6cbf('0x10')]()+_0x6cbf('0x56'),util[_0x6cbf('0x57')](_0x4b3ff8,{'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 1ad7b3e..e8ede73 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 _0xf984=['The\x20User\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','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]','defaults','GET','type','string','nameField','toLowerCase','content','idField','customField','push','variableName','custom_fields','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','unmanaged','lastevent'];(function(_0x58a372,_0xe93e45){var _0x2a84c3=function(_0x45b8e6){while(--_0x45b8e6){_0x58a372['push'](_0x58a372['shift']());}};_0x2a84c3(++_0xe93e45);}(_0xf984,0x119));var _0x4f98=function(_0x382e58,_0x3060d9){_0x382e58=_0x382e58-0x0;var _0x34ef18=_0xf984[_0x382e58];return _0x34ef18;};'use strict';var _=require(_0x4f98('0x0'));var rp=require(_0x4f98('0x1'));var md5=require(_0x4f98('0x2'));var util=require(_0x4f98('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4f98('0x4'));var config=require(_0x4f98('0x5'));var logger=require(_0x4f98('0x6'))(_0x4f98('0x7'));config[_0x4f98('0x8')]=_['defaults'](config[_0x4f98('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x4f98('0x9'))(new Redis(config[_0x4f98('0x8')]));var headers={'Content-Type':_0x4f98('0xa'),'Accept':_0x4f98('0xa')};function emit(_0xa9d221,_0x454da4,_0x4c2f05){io['to'](_0xa9d221)[_0x4f98('0xb')](_0x454da4,_0x4c2f05);}function getTicket(_0x1c19ab,_0x202af5,_0x2d7e9d,_0x285815,_0x191dfc){logger[_0x4f98('0xc')](_0x4f98('0xd'));var _0xc18714=_[_0x4f98('0xe')]({'responder_id':_0x202af5['id'],'requester_id':_0x2d7e9d['id'],'name':util['format']('Caller\x20-\x20%s',_0x191dfc[_0x4f98('0xf')]),'phone':_0x191dfc[_0x4f98('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4f98('0x11')](_0x285815[_0x4f98('0x12')],_0x191dfc,'\x20'),'description':intUtil[_0x4f98('0x11')](_0x285815[_0x4f98('0x13')],_0x191dfc,_0x4f98('0x14')),'tags':getTags(_0x285815[_0x4f98('0x15')],_0x4f98('0x16'))},getCustomFields(_0x285815['Fields'],_0x191dfc));_0xc18714['custom_fields']=_[_0x4f98('0x17')](_[_0x4f98('0x18')](_0xc18714['custom_fields'],'id'),_0x4f98('0x19'));return request({'uri':util[_0x4f98('0x1a')](_0x4f98('0x1b'),_0x1c19ab[_0x4f98('0x1c')]),'method':_0x4f98('0x1d'),'body':_0xc18714})[_0x4f98('0x1e')](function(_0x58b3dc){logger[_0x4f98('0xc')](_0x4f98('0x1f'));return _0x58b3dc;});}function getUser(_0x16a971,_0x4ddbee){if(intUtil[_0x4f98('0x20')](_0x4ddbee)){return request({'uri':util[_0x4f98('0x1a')](_0x4f98('0x21'),_0x16a971['remoteUri']),'qs':{'email':_0x4ddbee}})[_0x4f98('0x1e')](function(_0x51ad8b){if(_0x51ad8b[_0x4f98('0x22')]){logger[_0x4f98('0xc')]('Agent\x20found!');return _[_0x4f98('0x23')](_0x51ad8b,function(_0x3f5041){return _0x3f5041[_0x4f98('0x24')][_0x4f98('0x25')]===_0x4ddbee;});}else{logger[_0x4f98('0xc')](_0x4f98('0x26'));return request({'uri':util['format'](_0x4f98('0x27'),_0x16a971[_0x4f98('0x1c')])})[_0x4f98('0x1e')](function(_0x3600a){logger['info'](_0x4f98('0x28'));return _0x3600a;});}});}else{logger[_0x4f98('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x4f98('0x27'),_0x16a971[_0x4f98('0x1c')])})['then'](function(_0xfdf678){logger[_0x4f98('0xc')]('Admin\x20account\x20selected.');return _0xfdf678;});}}function getEndUser(_0x1dca56,_0x2dab86,_0x7a1ce5){logger[_0x4f98('0xc')](_0x4f98('0x29'),_0x7a1ce5);return request({'uri':util['format'](_0x4f98('0x2a'),_0x1dca56[_0x4f98('0x1c')]),'qs':{'phone':_0x7a1ce5}})['then'](function(_0x44f74e){if(_0x44f74e[_0x4f98('0x22')]){logger[_0x4f98('0xc')](_0x4f98('0x2b'));return _['find'](_0x44f74e,{'phone':_0x7a1ce5});}else{logger[_0x4f98('0xc')](_0x4f98('0x2c'));return request({'uri':util['format'](_0x4f98('0x2a'),_0x1dca56[_0x4f98('0x1c')]),'method':_0x4f98('0x1d'),'body':{'name':_0x2dab86,'phone':_0x7a1ce5}})[_0x4f98('0x1e')](function(_0x40d91b){logger[_0x4f98('0xc')]('Enduser\x20created.');return _0x40d91b;});}});}function getAuth(_0x14f619){return util['format'](_0x4f98('0x2d'),new Buffer(_0x14f619[_0x4f98('0x2e')]+':X')[_0x4f98('0x2f')](_0x4f98('0x30')));}function request(_0x5f07af){logger[_0x4f98('0x31')](_0x4f98('0x32'),JSON['stringify'](_0x5f07af));return rp(_[_0x4f98('0x33')](_0x5f07af,{'method':_0x4f98('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4040cc,_0x2e3b27){var _0x825e0e=[];if(_0x4040cc&&_0x4040cc[_0x4f98('0x22')]>0x0){_0x825e0e=_['map'](_0x4040cc,_0x2e3b27);}return _0x825e0e;}function getCustomFields(_0x42d7fb,_0x52a654){var _0x2e5a57=[];var _0xa48db7={'custom_fields':[]};if(_0x42d7fb[_0x4f98('0x22')]>0x0){_['forEach'](_0x42d7fb,function(_0x1e2bab){if(_0x1e2bab[_0x4f98('0x35')]===_0x4f98('0x36')&&_0x1e2bab['nameField']&&!_0x1e2bab['customField']){_0xa48db7[_0x1e2bab[_0x4f98('0x37')][_0x4f98('0x38')]()]=_0x1e2bab[_0x4f98('0x39')][_0x4f98('0x2f')]();}else if(_0x1e2bab['type']===_0x4f98('0x36')&&_0x1e2bab[_0x4f98('0x3a')]&&_0x1e2bab[_0x4f98('0x3b')]){_0xa48db7['custom_fields'][_0x4f98('0x3c')]({'id':_0x1e2bab['idField'],'value':_0x1e2bab[_0x4f98('0x39')][_0x4f98('0x2f')]()});}else if(_0x1e2bab[_0x4f98('0x35')]==='variable'&&_0x1e2bab[_0x4f98('0x3d')]&&_0x1e2bab[_0x4f98('0x3a')]&&_0x1e2bab[_0x4f98('0x3b')]){_0x52a654[_0x1e2bab[_0x4f98('0x3d')]]&&_0xa48db7[_0x4f98('0x3e')][_0x4f98('0x3c')]({'id':_0x1e2bab[_0x4f98('0x3a')],'value':_0x52a654[_0x1e2bab['variableName']][_0x4f98('0x2f')]()});}else if(_0x1e2bab[_0x4f98('0x35')]==='customVariable'&&_0x1e2bab['Variable']&&_0x1e2bab[_0x4f98('0x3f')]['name']&&_0x1e2bab['idField']&&_0x1e2bab[_0x4f98('0x3b')]){_0x52a654[_0x1e2bab[_0x4f98('0x3f')][_0x4f98('0x16')][_0x4f98('0x38')]()]&&_0xa48db7['custom_fields']['push']({'id':_0x1e2bab[_0x4f98('0x3a')],'value':_0x52a654[_0x1e2bab[_0x4f98('0x3f')]['name'][_0x4f98('0x38')]()]['toString']()});}});}return _0xa48db7;}exports[_0x4f98('0x40')]=function(_0x2f1600,_0x2eb903,_0x27ad74,_0x22d9f2,_0x16eb58,_0x4c5980){var _0x55ac6f,_0x2c615b;_0x4c5980[_0x4f98('0x1c')]=intUtil[_0x4f98('0x41')](_0x4c5980[_0x4f98('0x1c')]);_0x4c5980[_0x4f98('0x42')]=intUtil[_0x4f98('0x41')](_0x4c5980['serverUrl']);if(_0x16eb58&&_0x16eb58[_0x4f98('0x43')]){logger[_0x4f98('0xc')](_0x4f98('0x44'),_0x4f98('0x45'));_0x2eb903['recordingURL']=util[_0x4f98('0x1a')](_0x4f98('0x46'),_0x4c5980['serverUrl'],_0x2eb903['uniqueid'],md5(_0x2eb903[_0x4f98('0x47')]));}else{_0x2eb903[_0x4f98('0x48')]='';}headers[_0x4f98('0x49')]=getAuth(_0x4c5980);return getUser(_0x4c5980,_0x22d9f2[_0x4f98('0x25')])[_0x4f98('0x1e')](function(_0x13753b){_0x55ac6f=_0x13753b;logger[_0x4f98('0xc')]('The\x20User\x20ID\x20is:',_0x55ac6f['id']);return getEndUser(_0x4c5980,_0x2eb903['calleridname'],_0x2eb903[_0x4f98('0x10')]);})[_0x4f98('0x1e')](function(_0x12eef3){_0x2c615b=_0x12eef3;logger[_0x4f98('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2c615b['id']);return getTicket(_0x4c5980,_0x55ac6f,_0x2c615b,_0x27ad74,_0x2eb903);})[_0x4f98('0x1e')](function(_0x473efa){if(_0x473efa&&_0x473efa['id']){logger[_0x4f98('0xc')](_0x4f98('0x1f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x473efa['id']);logger[_0x4f98('0xc')](_0x4f98('0x44'),_0x4f98('0x4a'));emit(util['format'](_0x4f98('0x4b'),_0x22d9f2['name']),_0x4f98('0x4c'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x4c5980[_0x4f98('0x1c')],_0x473efa['id'])});}})[_0x4f98('0x4d')](function(_0x464145){logger[_0x4f98('0x4e')](_0x4f98('0x44'),JSON[_0x4f98('0x4f')](_0x464145));});};exports[_0x4f98('0x50')]=function(_0x11c5e1,_0x3224b7,_0x53c445,_0x32cf79,_0x4e7a7f,_0x3b73ff,_0x169272){var _0x4ab296,_0x555002;_0x3b73ff[_0x4f98('0x1c')]=intUtil[_0x4f98('0x41')](_0x3b73ff[_0x4f98('0x1c')]);_0x3b73ff[_0x4f98('0x42')]=intUtil['stripTrailingSlash'](_0x3b73ff[_0x4f98('0x42')]);if(_0x169272&&_0x169272[_0x4f98('0x51')]&&_0x169272[_0x4f98('0x51')]!==_0x4f98('0x52')){logger[_0x4f98('0xc')](_0x4f98('0x53'),_0x4f98('0x45'));_0x3224b7['recordingURL']=util[_0x4f98('0x1a')](_0x4f98('0x46'),_0x3b73ff[_0x4f98('0x42')],_0x3224b7[_0x4f98('0x47')],md5(_0x3224b7[_0x4f98('0x47')]));}headers[_0x4f98('0x49')]=getAuth(_0x3b73ff);return getUser(_0x3b73ff,_0x32cf79[_0x4f98('0x25')])['then'](function(_0x561319){_0x4ab296=_0x561319;logger[_0x4f98('0xc')]('The\x20User\x20ID\x20is:',_0x4ab296['id']);return getEndUser(_0x3b73ff,_0x3224b7[_0x4f98('0x54')],_0x3224b7[_0x4f98('0x55')]);})[_0x4f98('0x1e')](function(_0x1eda0a){_0x555002=_0x1eda0a;logger[_0x4f98('0xc')](_0x4f98('0x56'),_0x555002['id']);return getTicket(_0x3b73ff,_0x4ab296,_0x555002,_0x53c445,_0x3224b7);})[_0x4f98('0x1e')](function(_0x2621d6){if(_0x2621d6&&_0x2621d6['id']){logger[_0x4f98('0xc')](_0x4f98('0x1f'));logger['info'](_0x4f98('0x57'),_0x2621d6['id']);logger[_0x4f98('0xc')]('[OUTBOUND]',_0x4f98('0x4a'));emit(util[_0x4f98('0x1a')]('user:%s',_0x32cf79['name']),_0x4f98('0x4c'),{'uri':util['format'](_0x4f98('0x58'),_0x3b73ff['remoteUri'],_0x2621d6['id'])});}})[_0x4f98('0x4d')](function(_0x3db89d){logger[_0x4f98('0x4e')](_0x4f98('0x53'),JSON['stringify'](_0x3db89d));});};exports[_0x4f98('0x59')]=function(_0x108351,_0x482267,_0x5ae216,_0x12b96c,_0x558369,_0x2ad427){var _0x24deea,_0x3e242a;_0x2ad427[_0x4f98('0x1c')]=intUtil[_0x4f98('0x41')](_0x2ad427[_0x4f98('0x1c')]);_0x2ad427[_0x4f98('0x42')]=intUtil['stripTrailingSlash'](_0x2ad427[_0x4f98('0x42')]);if(_0x558369&&_0x558369[_0x4f98('0x43')]){logger[_0x4f98('0xc')]('['+_0x482267[_0x4f98('0x5a')]['toUpperCase']()+']',_0x4f98('0x45'));_0x482267[_0x4f98('0x48')]=util[_0x4f98('0x1a')](_0x4f98('0x46'),_0x2ad427[_0x4f98('0x42')],_0x482267['uniqueid'],md5(_0x482267[_0x4f98('0x47')]));}else{_0x482267[_0x4f98('0x48')]='';}headers[_0x4f98('0x49')]=getAuth(_0x2ad427);return getUser(_0x2ad427,'')['then'](function(_0x379ae7){_0x24deea=_0x379ae7;logger[_0x4f98('0xc')](_0x4f98('0x5b'),_0x24deea['id']);return getEndUser(_0x2ad427,_0x482267['calleridname'],_0x482267[_0x4f98('0x10')]);})[_0x4f98('0x1e')](function(_0xfda24c){_0x3e242a=_0xfda24c;logger[_0x4f98('0xc')](_0x4f98('0x56'),_0x3e242a['id']);return getTicket(_0x2ad427,_0x24deea,_0x3e242a,_0x5ae216,_0x482267);})[_0x4f98('0x1e')](function(_0x11f47a){if(_0x11f47a){logger[_0x4f98('0xc')](_0x4f98('0x1f'));logger[_0x4f98('0xc')]('The\x20Ticket\x20ID\x20is:',_0x11f47a['id']);}})[_0x4f98('0x4d')](function(_0x4155f3){logger[_0x4f98('0x4e')]('['+_0x482267['lastevent'][_0x4f98('0x5c')]()+']',JSON['stringify'](_0x4155f3));});}; \ No newline at end of file +var _0x6df2=['toLowerCase','toString','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','name','Fields','mapValues','keyBy','value','remoteUri','POST','info','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','GET','forEach','type','string','customField','nameField'];(function(_0x3acab1,_0x24e31a){var _0x25c5b4=function(_0x4f97a2){while(--_0x4f97a2){_0x3acab1['push'](_0x3acab1['shift']());}};_0x25c5b4(++_0x24e31a);}(_0x6df2,0x13a));var _0x26df=function(_0xa851e7,_0x1f4bb5){_0xa851e7=_0xa851e7-0x0;var _0x464973=_0x6df2[_0xa851e7];return _0x464973;};'use strict';var _=require(_0x26df('0x0'));var rp=require(_0x26df('0x1'));var md5=require(_0x26df('0x2'));var util=require(_0x26df('0x3'));var Redis=require(_0x26df('0x4'));var intUtil=require(_0x26df('0x5'));var config=require(_0x26df('0x6'));var logger=require('../../../../config/logger')('freshdesk');config[_0x26df('0x7')]=_[_0x26df('0x8')](config[_0x26df('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x26df('0x7')]));var headers={'Content-Type':_0x26df('0x9'),'Accept':'application/json'};function emit(_0x4b4f19,_0x4b9ded,_0x22794a){io['to'](_0x4b4f19)[_0x26df('0xa')](_0x4b9ded,_0x22794a);}function getTicket(_0x5d1048,_0x57d7c1,_0x16342f,_0xd99883,_0x5709dd){logger['info'](_0x26df('0xb'));var _0xfeba71=_[_0x26df('0xc')]({'responder_id':_0x57d7c1['id'],'requester_id':_0x16342f['id'],'name':util[_0x26df('0xd')](_0x26df('0xe'),_0x5709dd[_0x26df('0xf')]),'phone':_0x5709dd[_0x26df('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x26df('0x11')](_0xd99883[_0x26df('0x12')],_0x5709dd,'\x20'),'description':intUtil['getString'](_0xd99883['Descriptions'],_0x5709dd,_0x26df('0x13')),'tags':getTags(_0xd99883['Tags'],_0x26df('0x14'))},getCustomFields(_0xd99883[_0x26df('0x15')],_0x5709dd));_0xfeba71['custom_fields']=_[_0x26df('0x16')](_[_0x26df('0x17')](_0xfeba71['custom_fields'],'id'),_0x26df('0x18'));return request({'uri':util[_0x26df('0xd')]('%s/api/v2/tickets',_0x5d1048[_0x26df('0x19')]),'method':_0x26df('0x1a'),'body':_0xfeba71})['then'](function(_0x3f954e){logger[_0x26df('0x1b')](_0x26df('0x1c'));return _0x3f954e;});}function getUser(_0x28043d,_0x175aab){if(intUtil[_0x26df('0x1d')](_0x175aab)){return request({'uri':util[_0x26df('0xd')]('%s/api/v2/agents',_0x28043d[_0x26df('0x19')]),'qs':{'email':_0x175aab}})[_0x26df('0x1e')](function(_0x496c50){if(_0x496c50[_0x26df('0x1f')]){logger[_0x26df('0x1b')](_0x26df('0x20'));return _[_0x26df('0x21')](_0x496c50,function(_0x34b53c){return _0x34b53c['contact'][_0x26df('0x22')]===_0x175aab;});}else{logger[_0x26df('0x1b')](_0x26df('0x23'));return request({'uri':util['format'](_0x26df('0x24'),_0x28043d[_0x26df('0x19')])})[_0x26df('0x1e')](function(_0x1edd49){logger[_0x26df('0x1b')](_0x26df('0x25'));return _0x1edd49;});}});}else{logger[_0x26df('0x1b')](_0x26df('0x26'));return request({'uri':util[_0x26df('0xd')]('%s/api/v2/agents/me',_0x28043d[_0x26df('0x19')])})[_0x26df('0x1e')](function(_0x5e4ff7){logger[_0x26df('0x1b')](_0x26df('0x25'));return _0x5e4ff7;});}}function getEndUser(_0x388df6,_0x4ab8df,_0x1daab7){logger['info']('Searching\x20enduser\x20with\x20phone',_0x1daab7);return request({'uri':util[_0x26df('0xd')](_0x26df('0x27'),_0x388df6[_0x26df('0x19')]),'qs':{'phone':_0x1daab7}})[_0x26df('0x1e')](function(_0x50b9b3){if(_0x50b9b3[_0x26df('0x1f')]){logger[_0x26df('0x1b')](_0x26df('0x28'));return _[_0x26df('0x21')](_0x50b9b3,{'phone':_0x1daab7});}else{logger[_0x26df('0x1b')](_0x26df('0x29'));return request({'uri':util[_0x26df('0xd')]('%s/api/v2/contacts',_0x388df6[_0x26df('0x19')]),'method':'POST','body':{'name':_0x4ab8df,'phone':_0x1daab7}})[_0x26df('0x1e')](function(_0x4f8128){logger[_0x26df('0x1b')](_0x26df('0x2a'));return _0x4f8128;});}});}function getAuth(_0x558076){return util['format'](_0x26df('0x2b'),new Buffer(_0x558076[_0x26df('0x2c')]+':X')['toString'](_0x26df('0x2d')));}function request(_0x44db46){logger[_0x26df('0x2e')](_0x26df('0x2f'),JSON['stringify'](_0x44db46));return rp(_['defaults'](_0x44db46,{'method':_0x26df('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x25a816,_0x2e8843){var _0x3e3854=[];if(_0x25a816&&_0x25a816[_0x26df('0x1f')]>0x0){_0x3e3854=_['map'](_0x25a816,_0x2e8843);}return _0x3e3854;}function getCustomFields(_0x5e6c0a,_0x21aed5){var _0x4831c8=[];var _0x438c47={'custom_fields':[]};if(_0x5e6c0a['length']>0x0){_[_0x26df('0x31')](_0x5e6c0a,function(_0x50436c){if(_0x50436c[_0x26df('0x32')]===_0x26df('0x33')&&_0x50436c['nameField']&&!_0x50436c[_0x26df('0x34')]){_0x438c47[_0x50436c[_0x26df('0x35')][_0x26df('0x36')]()]=_0x50436c['content'][_0x26df('0x37')]();}else if(_0x50436c['type']===_0x26df('0x33')&&_0x50436c[_0x26df('0x38')]&&_0x50436c[_0x26df('0x34')]){_0x438c47[_0x26df('0x39')][_0x26df('0x3a')]({'id':_0x50436c[_0x26df('0x38')],'value':_0x50436c[_0x26df('0x3b')]['toString']()});}else if(_0x50436c[_0x26df('0x32')]===_0x26df('0x3c')&&_0x50436c[_0x26df('0x3d')]&&_0x50436c[_0x26df('0x38')]&&_0x50436c[_0x26df('0x34')]){_0x21aed5[_0x50436c[_0x26df('0x3d')]]&&_0x438c47[_0x26df('0x39')][_0x26df('0x3a')]({'id':_0x50436c[_0x26df('0x38')],'value':_0x21aed5[_0x50436c[_0x26df('0x3d')]]['toString']()});}else if(_0x50436c['type']===_0x26df('0x3e')&&_0x50436c[_0x26df('0x3f')]&&_0x50436c[_0x26df('0x3f')][_0x26df('0x14')]&&_0x50436c[_0x26df('0x38')]&&_0x50436c['customField']){_0x21aed5[_0x50436c[_0x26df('0x3f')]['name'][_0x26df('0x36')]()]&&_0x438c47[_0x26df('0x39')][_0x26df('0x3a')]({'id':_0x50436c['idField'],'value':_0x21aed5[_0x50436c[_0x26df('0x3f')][_0x26df('0x14')][_0x26df('0x36')]()]['toString']()});}});}return _0x438c47;}exports[_0x26df('0x40')]=function(_0x762b57,_0x123617,_0x88b10d,_0x38d3b2,_0x46138e,_0x4ae590){var _0x2bcac9,_0xd2c78;_0x4ae590[_0x26df('0x19')]=intUtil['stripTrailingSlash'](_0x4ae590[_0x26df('0x19')]);_0x4ae590[_0x26df('0x41')]=intUtil[_0x26df('0x42')](_0x4ae590[_0x26df('0x41')]);if(_0x46138e&&_0x46138e[_0x26df('0x43')]){logger[_0x26df('0x1b')](_0x26df('0x44'),_0x26df('0x45'));_0x123617[_0x26df('0x46')]=util[_0x26df('0xd')](_0x26df('0x47'),_0x4ae590[_0x26df('0x41')],_0x123617[_0x26df('0x48')],md5(_0x123617[_0x26df('0x48')]));}else{_0x123617[_0x26df('0x46')]='';}headers[_0x26df('0x49')]=getAuth(_0x4ae590);return getUser(_0x4ae590,_0x38d3b2['email'])[_0x26df('0x1e')](function(_0x2253fe){_0x2bcac9=_0x2253fe;logger[_0x26df('0x1b')](_0x26df('0x4a'),_0x2bcac9['id']);return getEndUser(_0x4ae590,_0x123617['calleridname'],_0x123617[_0x26df('0x10')]);})['then'](function(_0xcf6fb5){_0xd2c78=_0xcf6fb5;logger[_0x26df('0x1b')](_0x26df('0x4b'),_0xd2c78['id']);return getTicket(_0x4ae590,_0x2bcac9,_0xd2c78,_0x88b10d,_0x123617);})[_0x26df('0x1e')](function(_0x256d9d){if(_0x256d9d&&_0x256d9d['id']){logger[_0x26df('0x1b')](_0x26df('0x1c'));logger[_0x26df('0x1b')](_0x26df('0x4c'),_0x256d9d['id']);logger[_0x26df('0x1b')]('[QUEUE]',_0x26df('0x4d'));emit(util[_0x26df('0xd')](_0x26df('0x4e'),_0x38d3b2[_0x26df('0x14')]),_0x26df('0x4f'),{'uri':util[_0x26df('0xd')](_0x26df('0x50'),_0x4ae590[_0x26df('0x19')],_0x256d9d['id'])});}})[_0x26df('0x51')](function(_0x7553d5){logger[_0x26df('0x52')](_0x26df('0x44'),JSON[_0x26df('0x53')](_0x7553d5));});};exports[_0x26df('0x54')]=function(_0x20bc89,_0x4dbbec,_0xa9fd01,_0x2a0669,_0x438226,_0x552f08,_0xcaea04){var _0xd25026,_0x3b4939;_0x552f08['remoteUri']=intUtil[_0x26df('0x42')](_0x552f08[_0x26df('0x19')]);_0x552f08[_0x26df('0x41')]=intUtil[_0x26df('0x42')](_0x552f08[_0x26df('0x41')]);if(_0xcaea04&&_0xcaea04['recordingFormat']&&_0xcaea04['recordingFormat']!==_0x26df('0x55')){logger['info'](_0x26df('0x56'),_0x26df('0x45'));_0x4dbbec[_0x26df('0x46')]=util[_0x26df('0xd')](_0x26df('0x47'),_0x552f08[_0x26df('0x41')],_0x4dbbec[_0x26df('0x48')],md5(_0x4dbbec[_0x26df('0x48')]));}headers['Authorization']=getAuth(_0x552f08);return getUser(_0x552f08,_0x2a0669[_0x26df('0x22')])[_0x26df('0x1e')](function(_0x367dd4){_0xd25026=_0x367dd4;logger[_0x26df('0x1b')](_0x26df('0x4a'),_0xd25026['id']);return getEndUser(_0x552f08,_0x4dbbec[_0x26df('0x57')],_0x4dbbec[_0x26df('0x58')]);})[_0x26df('0x1e')](function(_0x523335){_0x3b4939=_0x523335;logger[_0x26df('0x1b')](_0x26df('0x4b'),_0x3b4939['id']);return getTicket(_0x552f08,_0xd25026,_0x3b4939,_0xa9fd01,_0x4dbbec);})[_0x26df('0x1e')](function(_0x4a590d){if(_0x4a590d&&_0x4a590d['id']){logger[_0x26df('0x1b')](_0x26df('0x1c'));logger['info'](_0x26df('0x4c'),_0x4a590d['id']);logger[_0x26df('0x1b')](_0x26df('0x56'),_0x26df('0x4d'));emit(util[_0x26df('0xd')](_0x26df('0x4e'),_0x2a0669[_0x26df('0x14')]),'trigger:browser:url',{'uri':util[_0x26df('0xd')](_0x26df('0x50'),_0x552f08[_0x26df('0x19')],_0x4a590d['id'])});}})[_0x26df('0x51')](function(_0x11d494){logger['error']('[OUTBOUND]',JSON['stringify'](_0x11d494));});};exports[_0x26df('0x59')]=function(_0x44ebcf,_0x507031,_0x208318,_0x132a59,_0x15df95,_0x1e3f2c){var _0x34dd3c,_0x402d52;_0x1e3f2c[_0x26df('0x19')]=intUtil[_0x26df('0x42')](_0x1e3f2c[_0x26df('0x19')]);_0x1e3f2c[_0x26df('0x41')]=intUtil['stripTrailingSlash'](_0x1e3f2c[_0x26df('0x41')]);if(_0x15df95&&_0x15df95['monitor_format']){logger['info']('['+_0x507031['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x507031[_0x26df('0x46')]=util[_0x26df('0xd')](_0x26df('0x47'),_0x1e3f2c[_0x26df('0x41')],_0x507031[_0x26df('0x48')],md5(_0x507031[_0x26df('0x48')]));}else{_0x507031[_0x26df('0x46')]='';}headers['Authorization']=getAuth(_0x1e3f2c);return getUser(_0x1e3f2c,'')[_0x26df('0x1e')](function(_0x557480){_0x34dd3c=_0x557480;logger['info'](_0x26df('0x4a'),_0x34dd3c['id']);return getEndUser(_0x1e3f2c,_0x507031[_0x26df('0xf')],_0x507031[_0x26df('0x10')]);})[_0x26df('0x1e')](function(_0x3e41e9){_0x402d52=_0x3e41e9;logger[_0x26df('0x1b')](_0x26df('0x4b'),_0x402d52['id']);return getTicket(_0x1e3f2c,_0x34dd3c,_0x402d52,_0x208318,_0x507031);})[_0x26df('0x1e')](function(_0x2df496){if(_0x2df496){logger[_0x26df('0x1b')]('Ticket\x20created!');logger[_0x26df('0x1b')](_0x26df('0x4c'),_0x2df496['id']);}})[_0x26df('0x51')](function(_0x553ec4){logger[_0x26df('0x52')]('['+_0x507031[_0x26df('0x5a')][_0x26df('0x5b')]()+']',JSON[_0x26df('0x53')](_0x553ec4));});}; \ 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 f88ba49..b0e5aa5 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 _0x67da=['Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','/api/selector/owners','Getting\x20user\x20list','users','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','filters','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','POST','/api/tasks'];(function(_0x326432,_0x35f878){var _0x4ddfaf=function(_0x2616b8){while(--_0x2616b8){_0x326432['push'](_0x326432['shift']());}};_0x4ddfaf(++_0x35f878);}(_0x67da,0x11d));var _0xa67d=function(_0x2e42eb,_0x53121d){_0x2e42eb=_0x2e42eb-0x0;var _0x234dc9=_0x67da[_0x2e42eb];return _0x234dc9;};'use strict';var _=require(_0xa67d('0x0'));var rp=require('request-promise');var md5=require(_0xa67d('0x1'));var util=require(_0xa67d('0x2'));var moment=require(_0xa67d('0x3'));var Promise=require(_0xa67d('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa67d('0x5'))(_0xa67d('0x6'));config[_0xa67d('0x7')]=_[_0xa67d('0x8')](config[_0xa67d('0x7')],{'host':_0xa67d('0x9'),'port':0x18eb});var io=require(_0xa67d('0xa'))(new Redis(config[_0xa67d('0x7')]));function getAdminId(_0x40aa30,_0x32cd23,_0x3f81e8,_0x19fddb){return new Promise(function(_0x7ad109,_0x5bc677){var _0x3bf380=![];var _0x59a69a={'method':'GET','uri':_0x19fddb+'/api/selector/owners','json':!![]};_0x59a69a[_0xa67d('0xb')]=_0x3f81e8;logger[_0xa67d('0xc')](_0xa67d('0xd'));return rp(_0x59a69a)[_0xa67d('0xe')](function(_0x48d78d){if(_0x48d78d){var _0xd435b6=_0x48d78d['users'];var _0x2a7a90=null;for(_0x2a7a90=0x0;_0x2a7a90<_0xd435b6[_0xa67d('0xf')];_0x2a7a90++){if(_0xd435b6[_0x2a7a90][_0xa67d('0x10')]===_0x40aa30[_0xa67d('0x11')]){_0x40aa30['adminId']=_0xd435b6[_0x2a7a90]['id'];_0x3bf380=!![];}}if(_0x3bf380){logger[_0xa67d('0xc')](_0xa67d('0x12'),_0x40aa30[_0xa67d('0x13')]);_0x7ad109(_0x40aa30);}else{_0x5bc677({'statusCode':0x194,'message':_0xa67d('0x14')});}}else{_0x5bc677({'statusCode':0x194,'message':_0xa67d('0x14')});}})[_0xa67d('0x15')](function(_0x2d6b00){logger[_0xa67d('0x16')]('['+[_0x32cd23[_0xa67d('0x17')]()]+']',_0x2d6b00[_0xa67d('0x18')]);_0x5bc677(_0x2d6b00);});});}function getUser(_0x1ad038,_0x1334d1,_0x4b0789){return function(_0x38734c){return new Promise(function(_0xcb18fb,_0x398e6a){var _0x5c121f={'method':_0xa67d('0x19'),'uri':_0x4b0789+_0xa67d('0x1a'),'json':!![]};_0x5c121f[_0xa67d('0xb')]=_0x1334d1;logger['info'](_0xa67d('0x1b'));return rp(_0x5c121f)[_0xa67d('0xe')](function(_0x1e4dbc){if(_0x1e4dbc){var _0x3126e6=_0x1e4dbc[_0xa67d('0x1c')];var _0x55b444=![];var _0x46b2a3=null;if(_0x38734c['agentEmail']!==null){logger['info'](_0xa67d('0x1d'),_0x38734c[_0xa67d('0x1e')]);_0x38734c[_0xa67d('0x1f')]=_0x38734c[_0xa67d('0x1e')];for(_0x46b2a3=0x0;_0x46b2a3<_0x3126e6[_0xa67d('0xf')];_0x46b2a3++){if(_0x3126e6[_0x46b2a3][_0xa67d('0x10')]===_0x38734c[_0xa67d('0x1e')]){_0x55b444=!![];_0x38734c[_0xa67d('0x20')]=_0x3126e6[_0x46b2a3]['id'];logger[_0xa67d('0xc')]('User\x20found:',_0x38734c[_0xa67d('0x20')]);}}}if(!_0x55b444){logger[_0xa67d('0xc')](_0xa67d('0x21'));_0x38734c[_0xa67d('0x1f')]=_0x38734c[_0xa67d('0x11')];_0x38734c[_0xa67d('0x20')]=_0x38734c[_0xa67d('0x13')];_0x55b444=!![];}if(_0x55b444){_0xcb18fb(_0x38734c);}else{_0x398e6a({'statusCode':0x194,'message':_0xa67d('0x14')});}}else{_0x398e6a({'statusCode':0x194,'message':_0xa67d('0x14')});}})[_0xa67d('0x15')](function(_0x5c4dcb){logger[_0xa67d('0x16')]('['+[_0x1ad038[_0xa67d('0x17')]()]+']',_0x5c4dcb[_0xa67d('0x18')]);_0x398e6a(_0x5c4dcb);});});};}function getEndUser(_0x5aa8e,_0x59ae3b,_0x5e909c){return function(_0x44498d){return new Promise(function(_0x32cfa1,_0x3d87fd){var _0x54c668=0x0;var _0x4157b8={'method':_0xa67d('0x19'),'uri':_0x5e909c+_0xa67d('0x22'),'json':!![]};_0x4157b8[_0xa67d('0xb')]=_0x59ae3b;logger['info'](_0xa67d('0x23'));return rp(_0x4157b8)[_0xa67d('0xe')](function(_0x546a33){_0x546a33[_0xa67d('0x24')]['forEach'](function(_0x3f64eb){if(_0x3f64eb[_0xa67d('0x25')]===_0xa67d('0x26')){_0x54c668=_0x3f64eb['id'];}});})[_0xa67d('0xe')](function(){logger[_0xa67d('0xc')](_0xa67d('0x27'));var _0xd865b5={'method':_0xa67d('0x19'),'uri':_0x5e909c+_0xa67d('0x28')+_0x54c668,'json':!![]};_0xd865b5[_0xa67d('0xb')]=_0x59ae3b;return rp(_0xd865b5);})[_0xa67d('0xe')](function(_0x2fc691){logger[_0xa67d('0xc')](_0xa67d('0x29'),_0x44498d[_0xa67d('0x2a')]);if(_0x2fc691[_0xa67d('0x2b')]['length']>0x0){var _0x329da6=_[_0xa67d('0x2c')](_0x2fc691[_0xa67d('0x2b')],function(_0x49d56a){if(_0x49d56a[_0xa67d('0x2d')]===_0x44498d[_0xa67d('0x2a')]||_0x49d56a['mobile_number']===_0x44498d[_0xa67d('0x2a')]){return _0x49d56a;}});if(_0x329da6){_0x44498d[_0xa67d('0x2e')]=_0x329da6['id'];logger[_0xa67d('0xc')](_0xa67d('0x2f'),_0x44498d[_0xa67d('0x2e')]);_0x32cfa1(_0x44498d);}else{return createEndUser(_0x44498d,_0x5aa8e,_0x59ae3b,_0x5e909c)[_0xa67d('0xe')](function(_0x5cb8bc){logger[_0xa67d('0xc')](_0xa67d('0x30'),_0x44498d[_0xa67d('0x2e')]);_0x32cfa1(_0x5cb8bc);});}}else{return createEndUser(_0x44498d,_0x5aa8e,_0x59ae3b,_0x5e909c)['then'](function(_0x2aff4a){logger[_0xa67d('0xc')](_0xa67d('0x30'),_0x44498d[_0xa67d('0x2e')]);_0x32cfa1(_0x2aff4a);});}})[_0xa67d('0x15')](function(_0x1638ca){throw new Error(_0x1638ca[_0xa67d('0x18')]);});});};}function createEndUser(_0x290aa0,_0x49673d,_0x277889,_0x2d7ce2){return new Promise(function(_0x24db72,_0xee9faa){var _0x20fea4=moment();var _0x2c458d={'method':'POST','uri':_0x2d7ce2+_0xa67d('0x31'),'body':{'contact':{'last_name':_0x290aa0[_0xa67d('0x2a')],'work_number':_0x290aa0[_0xa67d('0x2a')],'mobile_number':_0x290aa0[_0xa67d('0x2a')],'owner_id':_0x290aa0[_0xa67d('0x20')],'created_at':_0x20fea4[_0xa67d('0x32')](_0xa67d('0x33'))}},'json':!![]};_0x2c458d[_0xa67d('0xb')]=_0x277889;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2c458d)[_0xa67d('0xe')](function(_0x130166){_0x290aa0[_0xa67d('0x2e')]=_0x130166['contact']['id'];_0x24db72(_0x290aa0);})[_0xa67d('0x15')](function(_0x46f057){logger[_0xa67d('0x16')]('['+[_0x49673d[_0xa67d('0x17')]()]+']',_0x46f057['message']);_0xee9faa(_0x46f057[_0xa67d('0x18')]);});});}function getTicket(_0x499ffa,_0x38a543,_0x1bff04,_0x4b57c9,_0x1fb7e6){return function(_0x1d639b){logger[_0xa67d('0xc')](_0xa67d('0x34'));return new Promise(function(_0x209c9e,_0xf601e7){var _0x462a5e=moment();var _0x129e56={'method':_0xa67d('0x35'),'uri':_0x1bff04+_0xa67d('0x36'),'body':{'title':intUtil['getString'](_0x4b57c9['Subjects'],_0x1fb7e6,'\x20'),'description':intUtil['getString'](_0x4b57c9['Descriptions'],_0x1fb7e6,'\x0a'),'owner_id':_0x1d639b[_0xa67d('0x20')],'creater_id':_0x1d639b[_0xa67d('0x13')],'targetable_id':_0x1d639b[_0xa67d('0x2e')],'targetable_type':_0xa67d('0x37'),'created_at':_0x462a5e[_0xa67d('0x32')](_0xa67d('0x33')),'due_date':_0x462a5e[_0xa67d('0x38')](0x1e,'m')[_0xa67d('0x32')](_0xa67d('0x33'))},'json':!![]};_0x129e56[_0xa67d('0xb')]=_0x38a543;return rp(_0x129e56)['then'](function(_0x407e49){_0x1d639b[_0xa67d('0x39')]=_0x407e49[_0xa67d('0x3a')]['id'];logger[_0xa67d('0xc')](_0xa67d('0x3b'),_0x1d639b[_0xa67d('0x39')]);_0x209c9e(_0x1d639b);})[_0xa67d('0x15')](function(_0x240d35){logger['error']('['+[_0x499ffa['toUpperCase']()]+']',_0x240d35[_0xa67d('0x18')]);_0xf601e7(_0x240d35[_0xa67d('0x18')]);});});};}function emit(_0x4298d5,_0xebbcd4,_0x2c6fed){var _0x578e72={'uri':_0x4298d5+'/contacts/'+_0x2c6fed};io['to'](util[_0xa67d('0x32')](_0xa67d('0x3c'),_0xebbcd4))[_0xa67d('0x3d')](_0xa67d('0x3e'),_0x578e72);}exports['cs']=function(_0x411a7b,_0x260908,_0x4c7218,_0x496200,_0x534d0e,_0x257edc,_0x2ce6da,_0x42379c){var _0x415f60={};var _0x115a3e={'Authorization':_0xa67d('0x3f')+_0x257edc[_0xa67d('0x40')]};_0x257edc[_0xa67d('0x41')]=intUtil[_0xa67d('0x42')](_0x257edc[_0xa67d('0x41')]);_0x257edc[_0xa67d('0x43')]=intUtil['stripTrailingSlash'](_0x257edc['serverUrl']);var _0x533631=_0x257edc['remoteUri'];_0x415f60['adminEmail']=_0x257edc[_0xa67d('0x44')];_0x415f60[_0xa67d('0x2a')]=_0x42379c['toLowerCase']()===_0xa67d('0x45')?_0x260908[_0xa67d('0x46')]:_0x260908[_0xa67d('0x47')];_0x415f60[_0xa67d('0x48')]=_0x42379c===_0xa67d('0x49')||_0x42379c===_0xa67d('0x4a')?_0xa67d('0x49'):'outbound';if(_0x496200){_0x415f60[_0xa67d('0x1e')]=_0x496200[_0xa67d('0x10')];}var _0x58bdcc=util[_0xa67d('0x32')](_0xa67d('0x4b'),_0x257edc['serverUrl'],_0x260908[_0xa67d('0x4c')],md5(_0x260908['uniqueid']));if(_0x534d0e&&_0x534d0e[_0xa67d('0x4d')]){logger[_0xa67d('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x260908[_0xa67d('0x4e')]=_0x58bdcc;}else if(_0x2ce6da&&_0x2ce6da[_0xa67d('0x4f')]&&_0x2ce6da[_0xa67d('0x4f')]!=='none'){logger[_0xa67d('0xc')](_0xa67d('0x50'),'Recording\x20is\x20enabled!');_0x260908['recordingURL']=_0x58bdcc;}else{_0x260908['recordingURL']='';}return getAdminId(_0x415f60,_0x42379c,_0x115a3e,_0x533631)[_0xa67d('0xe')](getUser(_0x42379c,_0x115a3e,_0x533631))['then'](getEndUser(_0x42379c,_0x115a3e,_0x533631))['then'](getTicket(_0x42379c,_0x115a3e,_0x533631,_0x4c7218,_0x260908))['then'](function(_0xa7b265){logger[_0xa67d('0xc')](util['format'](_0xa67d('0x51'),_0xa7b265['ticketId']));if(_0x42379c!==_0xa67d('0x4a')){logger[_0xa67d('0xc')]('['+[_0x42379c[_0xa67d('0x17')]()]+']',_0xa67d('0x52'));emit(_0x533631,_0x496200['name'],_0xa7b265['endUserId']);}})[_0xa67d('0x15')](function(_0x16d651){logger[_0xa67d('0x16')]('['+[_0x42379c[_0xa67d('0x17')]()]+_0xa67d('0x53'),util[_0xa67d('0x54')](_0x16d651,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe2e9=['task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','recordingURL','recordingFormat','Recording\x20is\x20enabled!','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','GET','headers','then','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','error','message','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','Searching\x20contact\x20with\x20phone','contactNumber','contacts','length','find','work_number','endUserId','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','format','ticketId'];(function(_0x28b33c,_0x17c02e){var _0x586ef0=function(_0x32675c){while(--_0x32675c){_0x28b33c['push'](_0x28b33c['shift']());}};_0x586ef0(++_0x17c02e);}(_0xe2e9,0x167));var _0x9e2e=function(_0x7fab38,_0x501063){_0x7fab38=_0x7fab38-0x0;var _0xb5c718=_0xe2e9[_0x7fab38];return _0xb5c718;};'use strict';var _=require(_0x9e2e('0x0'));var rp=require(_0x9e2e('0x1'));var md5=require('md5');var util=require(_0x9e2e('0x2'));var moment=require(_0x9e2e('0x3'));var Promise=require('bluebird');var Redis=require(_0x9e2e('0x4'));var intUtil=require(_0x9e2e('0x5'));var config=require(_0x9e2e('0x6'));var logger=require(_0x9e2e('0x7'))(_0x9e2e('0x8'));config['redis']=_[_0x9e2e('0x9')](config[_0x9e2e('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x9e2e('0xb'))(new Redis(config[_0x9e2e('0xa')]));function getAdminId(_0x29cdc2,_0xfac7ae,_0x360795,_0xc4a6e6){return new Promise(function(_0x82cd19,_0x2a0793){var _0x42d149=![];var _0x5b1a28={'method':'GET','uri':_0xc4a6e6+_0x9e2e('0xc'),'json':!![]};_0x5b1a28['headers']=_0x360795;logger[_0x9e2e('0xd')](_0x9e2e('0xe'));return rp(_0x5b1a28)['then'](function(_0xf14070){if(_0xf14070){var _0x199404=_0xf14070[_0x9e2e('0xf')];var _0x201975=null;for(_0x201975=0x0;_0x201975<_0x199404['length'];_0x201975++){if(_0x199404[_0x201975][_0x9e2e('0x10')]===_0x29cdc2[_0x9e2e('0x11')]){_0x29cdc2[_0x9e2e('0x12')]=_0x199404[_0x201975]['id'];_0x42d149=!![];}}if(_0x42d149){logger[_0x9e2e('0xd')](_0x9e2e('0x13'),_0x29cdc2[_0x9e2e('0x12')]);_0x82cd19(_0x29cdc2);}else{_0x2a0793({'statusCode':0x194,'message':_0x9e2e('0x14')});}}else{_0x2a0793({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x9e2e('0x15')](function(_0x179520){logger['error']('['+[_0xfac7ae[_0x9e2e('0x16')]()]+']',_0x179520['message']);_0x2a0793(_0x179520);});});}function getUser(_0x564181,_0x1b8b30,_0x2a9c65){return function(_0x4704bb){return new Promise(function(_0x23a362,_0xa6ea4d){var _0x5c18eb={'method':_0x9e2e('0x17'),'uri':_0x2a9c65+_0x9e2e('0xc'),'json':!![]};_0x5c18eb[_0x9e2e('0x18')]=_0x1b8b30;logger[_0x9e2e('0xd')]('Getting\x20user\x20list');return rp(_0x5c18eb)[_0x9e2e('0x19')](function(_0x5a0587){if(_0x5a0587){var _0x29d388=_0x5a0587['users'];var _0x32ebc6=![];var _0x3e5df7=null;if(_0x4704bb[_0x9e2e('0x1a')]!==null){logger[_0x9e2e('0xd')](_0x9e2e('0x1b'),_0x4704bb[_0x9e2e('0x1a')]);_0x4704bb['userEmail']=_0x4704bb[_0x9e2e('0x1a')];for(_0x3e5df7=0x0;_0x3e5df7<_0x29d388['length'];_0x3e5df7++){if(_0x29d388[_0x3e5df7][_0x9e2e('0x10')]===_0x4704bb[_0x9e2e('0x1a')]){_0x32ebc6=!![];_0x4704bb[_0x9e2e('0x1c')]=_0x29d388[_0x3e5df7]['id'];logger[_0x9e2e('0xd')](_0x9e2e('0x1d'),_0x4704bb[_0x9e2e('0x1c')]);}}}if(!_0x32ebc6){logger['info'](_0x9e2e('0x1e'));_0x4704bb[_0x9e2e('0x1f')]=_0x4704bb[_0x9e2e('0x11')];_0x4704bb[_0x9e2e('0x1c')]=_0x4704bb[_0x9e2e('0x12')];_0x32ebc6=!![];}if(_0x32ebc6){_0x23a362(_0x4704bb);}else{_0xa6ea4d({'statusCode':0x194,'message':_0x9e2e('0x14')});}}else{_0xa6ea4d({'statusCode':0x194,'message':_0x9e2e('0x14')});}})[_0x9e2e('0x15')](function(_0x2e9f45){logger[_0x9e2e('0x20')]('['+[_0x564181[_0x9e2e('0x16')]()]+']',_0x2e9f45[_0x9e2e('0x21')]);_0xa6ea4d(_0x2e9f45);});});};}function getEndUser(_0x5c4c59,_0x42c971,_0x2f8403){return function(_0x220481){return new Promise(function(_0x499932,_0x17ce4e){var _0x40e278=0x0;var _0x2acb3e={'method':_0x9e2e('0x17'),'uri':_0x2f8403+_0x9e2e('0x22'),'json':!![]};_0x2acb3e[_0x9e2e('0x18')]=_0x42c971;logger[_0x9e2e('0xd')](_0x9e2e('0x23'));return rp(_0x2acb3e)[_0x9e2e('0x19')](function(_0xcc12bf){_0xcc12bf[_0x9e2e('0x24')][_0x9e2e('0x25')](function(_0x2d6446){if(_0x2d6446[_0x9e2e('0x26')]===_0x9e2e('0x27')){_0x40e278=_0x2d6446['id'];}});})[_0x9e2e('0x19')](function(){logger['info'](_0x9e2e('0x28'));var _0x5de368={'method':_0x9e2e('0x17'),'uri':_0x2f8403+'/api/contacts/view/'+_0x40e278,'json':!![]};_0x5de368['headers']=_0x42c971;return rp(_0x5de368);})[_0x9e2e('0x19')](function(_0x4df03f){logger[_0x9e2e('0xd')](_0x9e2e('0x29'),_0x220481[_0x9e2e('0x2a')]);if(_0x4df03f[_0x9e2e('0x2b')][_0x9e2e('0x2c')]>0x0){var _0x5d5752=_[_0x9e2e('0x2d')](_0x4df03f[_0x9e2e('0x2b')],function(_0x1605f6){if(_0x1605f6[_0x9e2e('0x2e')]===_0x220481[_0x9e2e('0x2a')]||_0x1605f6['mobile_number']===_0x220481[_0x9e2e('0x2a')]){return _0x1605f6;}});if(_0x5d5752){_0x220481[_0x9e2e('0x2f')]=_0x5d5752['id'];logger['info']('Contact\x20found:',_0x220481[_0x9e2e('0x2f')]);_0x499932(_0x220481);}else{return createEndUser(_0x220481,_0x5c4c59,_0x42c971,_0x2f8403)[_0x9e2e('0x19')](function(_0xef867f){logger['info'](_0x9e2e('0x30'),_0x220481['endUserId']);_0x499932(_0xef867f);});}}else{return createEndUser(_0x220481,_0x5c4c59,_0x42c971,_0x2f8403)[_0x9e2e('0x19')](function(_0x2f5157){logger[_0x9e2e('0xd')](_0x9e2e('0x30'),_0x220481[_0x9e2e('0x2f')]);_0x499932(_0x2f5157);});}})[_0x9e2e('0x15')](function(_0x1e74d8){throw new Error(_0x1e74d8[_0x9e2e('0x21')]);});});};}function createEndUser(_0x5c0e15,_0x3302f8,_0x22fbba,_0x2e5bce){return new Promise(function(_0xf75dc,_0x42f2d0){var _0x3fb04f=moment();var _0x2baee7={'method':_0x9e2e('0x31'),'uri':_0x2e5bce+'/api/contacts','body':{'contact':{'last_name':_0x5c0e15[_0x9e2e('0x2a')],'work_number':_0x5c0e15[_0x9e2e('0x2a')],'mobile_number':_0x5c0e15[_0x9e2e('0x2a')],'owner_id':_0x5c0e15[_0x9e2e('0x1c')],'created_at':_0x3fb04f['format'](_0x9e2e('0x32'))}},'json':!![]};_0x2baee7[_0x9e2e('0x18')]=_0x22fbba;logger['info'](_0x9e2e('0x33'));return rp(_0x2baee7)[_0x9e2e('0x19')](function(_0x2e77f7){_0x5c0e15[_0x9e2e('0x2f')]=_0x2e77f7[_0x9e2e('0x34')]['id'];_0xf75dc(_0x5c0e15);})[_0x9e2e('0x15')](function(_0x49115b){logger[_0x9e2e('0x20')]('['+[_0x3302f8[_0x9e2e('0x16')]()]+']',_0x49115b[_0x9e2e('0x21')]);_0x42f2d0(_0x49115b[_0x9e2e('0x21')]);});});}function getTicket(_0x47961b,_0x53d838,_0x5b3505,_0x3c54d4,_0x478d7d){return function(_0x10ce6b){logger['info'](_0x9e2e('0x35'));return new Promise(function(_0x1d03a7,_0x250c22){var _0x31f29c=moment();var _0x29fcea={'method':_0x9e2e('0x31'),'uri':_0x5b3505+_0x9e2e('0x36'),'body':{'title':intUtil[_0x9e2e('0x37')](_0x3c54d4[_0x9e2e('0x38')],_0x478d7d,'\x20'),'description':intUtil[_0x9e2e('0x37')](_0x3c54d4[_0x9e2e('0x39')],_0x478d7d,'\x0a'),'owner_id':_0x10ce6b['userId'],'creater_id':_0x10ce6b[_0x9e2e('0x12')],'targetable_id':_0x10ce6b[_0x9e2e('0x2f')],'targetable_type':'Contact','created_at':_0x31f29c['format'](_0x9e2e('0x32')),'due_date':_0x31f29c[_0x9e2e('0x3a')](0x1e,'m')[_0x9e2e('0x3b')](_0x9e2e('0x32'))},'json':!![]};_0x29fcea[_0x9e2e('0x18')]=_0x53d838;return rp(_0x29fcea)[_0x9e2e('0x19')](function(_0x5376fd){_0x10ce6b[_0x9e2e('0x3c')]=_0x5376fd[_0x9e2e('0x3d')]['id'];logger[_0x9e2e('0xd')](_0x9e2e('0x3e'),_0x10ce6b[_0x9e2e('0x3c')]);_0x1d03a7(_0x10ce6b);})['catch'](function(_0x59cb44){logger[_0x9e2e('0x20')]('['+[_0x47961b['toUpperCase']()]+']',_0x59cb44[_0x9e2e('0x21')]);_0x250c22(_0x59cb44[_0x9e2e('0x21')]);});});};}function emit(_0x452915,_0x30a92c,_0x991fdb){var _0x445602={'uri':_0x452915+_0x9e2e('0x3f')+_0x991fdb};io['to'](util[_0x9e2e('0x3b')](_0x9e2e('0x40'),_0x30a92c))['emit'](_0x9e2e('0x41'),_0x445602);}exports['cs']=function(_0x2712ed,_0x4750a7,_0x25ed5c,_0x568f34,_0xe702c8,_0x13a5a7,_0x51fade,_0x3d7af6){var _0x2ad7c3={};var _0x2c6ebc={'Authorization':_0x9e2e('0x42')+_0x13a5a7[_0x9e2e('0x43')]};_0x13a5a7[_0x9e2e('0x44')]=intUtil['stripTrailingSlash'](_0x13a5a7[_0x9e2e('0x44')]);_0x13a5a7[_0x9e2e('0x45')]=intUtil['stripTrailingSlash'](_0x13a5a7[_0x9e2e('0x45')]);var _0x205e70=_0x13a5a7[_0x9e2e('0x44')];_0x2ad7c3[_0x9e2e('0x11')]=_0x13a5a7[_0x9e2e('0x46')];_0x2ad7c3[_0x9e2e('0x2a')]=_0x3d7af6[_0x9e2e('0x47')]()===_0x9e2e('0x48')?_0x4750a7[_0x9e2e('0x49')]:_0x4750a7[_0x9e2e('0x4a')];_0x2ad7c3[_0x9e2e('0x4b')]=_0x3d7af6==='queue'||_0x3d7af6==='unmanaged'?_0x9e2e('0x4c'):'outbound';if(_0x568f34){_0x2ad7c3[_0x9e2e('0x1a')]=_0x568f34[_0x9e2e('0x10')];}var _0x57514e=util[_0x9e2e('0x3b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13a5a7['serverUrl'],_0x4750a7['uniqueid'],md5(_0x4750a7[_0x9e2e('0x4d')]));if(_0xe702c8&&_0xe702c8['monitor_format']){logger[_0x9e2e('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4750a7[_0x9e2e('0x4e')]=_0x57514e;}else if(_0x51fade&&_0x51fade[_0x9e2e('0x4f')]&&_0x51fade[_0x9e2e('0x4f')]!=='none'){logger[_0x9e2e('0xd')]('[OUTBOUND]',_0x9e2e('0x50'));_0x4750a7['recordingURL']=_0x57514e;}else{_0x4750a7['recordingURL']='';}return getAdminId(_0x2ad7c3,_0x3d7af6,_0x2c6ebc,_0x205e70)['then'](getUser(_0x3d7af6,_0x2c6ebc,_0x205e70))['then'](getEndUser(_0x3d7af6,_0x2c6ebc,_0x205e70))['then'](getTicket(_0x3d7af6,_0x2c6ebc,_0x205e70,_0x25ed5c,_0x4750a7))[_0x9e2e('0x19')](function(_0x4f5a66){logger[_0x9e2e('0xd')](util[_0x9e2e('0x3b')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4f5a66[_0x9e2e('0x3c')]));if(_0x3d7af6!==_0x9e2e('0x51')){logger['info']('['+[_0x3d7af6['toUpperCase']()]+']',_0x9e2e('0x52'));emit(_0x205e70,_0x568f34[_0x9e2e('0x26')],_0x4f5a66[_0x9e2e('0x2f')]);}})['catch'](function(_0x2fc610){logger[_0x9e2e('0x20')]('['+[_0x3d7af6[_0x9e2e('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x9e2e('0x53')](_0x2fc610,{'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 ebfa2f0..069e3b4 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 _0x5c00=['format','error','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','dynamics365','unknown\x20integration','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','[EXEC]'];(function(_0x16b77e,_0x4a56a3){var _0x3ae284=function(_0x5d2481){while(--_0x5d2481){_0x16b77e['push'](_0x16b77e['shift']());}};_0x3ae284(++_0x4a56a3);}(_0x5c00,0x17e));var _0x05c0=function(_0x36bbbb,_0x3f6709){_0x36bbbb=_0x36bbbb-0x0;var _0x3ca0eb=_0x5c00[_0x36bbbb];return _0x3ca0eb;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var zendesk=require(_0x05c0('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x05c0('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x05c0('0x4'));var desk=require(_0x05c0('0x5'));var vtiger=require(_0x05c0('0x6'));var servicenow=require(_0x05c0('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x05c0('0x8'));var integrations=[_0x05c0('0x9'),_0x05c0('0xa'),_0x05c0('0xb'),'freshdesk',_0x05c0('0xc'),_0x05c0('0xd'),_0x05c0('0xe'),'dynamics365',_0x05c0('0xf'),_0x05c0('0x10')];exports[_0x05c0('0x11')]=function(_0x321c09,_0x273b2d,_0x1edbb,_0x5226c5,_0x4f9f78,_0x5d4de1){if(_0x1edbb){if(_['includes'](integrations,_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')]())){try{var _0xa50678=null;var _0x5a3e65='';var _0x4e39d4=_0x1edbb[_0x321c09['data1'][_0x05c0('0x13')]()];if(_0x4e39d4){var _0x49e07e=_0x4e39d4[_0x321c09[_0x05c0('0x14')]];if(_0x49e07e){var _0x12deeb=_[_0x05c0('0x15')](_0x49e07e[_0x05c0('0x16')],{'id':parseInt(_0x321c09[_0x05c0('0x17')],0xa)});if(_0x12deeb){if(_0x5226c5){if(_0x4f9f78&&_0x273b2d[_0x05c0('0x18')]){_0x5a3e65='queue';}else if(_0x273b2d[_0x05c0('0x19')]){_0x5a3e65=_0x05c0('0x1a');}else{console[_0x05c0('0x1b')](_0x05c0('0x1c'),_0x273b2d);}}else{_0x5a3e65=_0x05c0('0x1d');}switch(_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')]()){case _0x05c0('0x9'):zendesk[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0xa'):salesforce[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case'sugarcrm':sugarcrm[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0x1e'):freshdesk[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0xc'):zoho[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0xd'):desk[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case'vtiger':vtiger[_0x5a3e65](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1);break;case _0x05c0('0xf'):freshsales['cs'](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1,_0x5a3e65);break;case _0x05c0('0x10'):servicenow['cs'](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1,_0x5a3e65);break;case _0x05c0('0x1f'):dynamics365['cs'](_0x321c09,_0x273b2d,_0x12deeb,_0x5226c5,_0x4f9f78,_0x49e07e,_0x5d4de1,_0x5a3e65);break;default:console[_0x05c0('0x1b')](_0x05c0('0x20'));}}else{_0xa50678=require('../../../../config/logger')(_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')]());_0xa50678['error']('[EXEC]',util['format'](_0x05c0('0x21'),_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')](),_0x321c09[_0x05c0('0x17')]));}}else{_0xa50678=require(_0x05c0('0x22'))(_0x321c09[_0x05c0('0x12')][_0x05c0('0x13')]());_0xa50678['error'](_0x05c0('0x23'),util[_0x05c0('0x24')]('%s\x20account\x20#%s\x20not\x20found',_0x321c09['data1']['toLowerCase'](),_0x321c09['data2']));}}else{}}catch(_0x56aa78){console[_0x05c0('0x25')](_0x56aa78);}}}}; \ No newline at end of file +var _0xe605=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','freshdesk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho'];(function(_0x1860e6,_0x2f6aab){var _0x404e2c=function(_0x3d8d4a){while(--_0x3d8d4a){_0x1860e6['push'](_0x1860e6['shift']());}};_0x404e2c(++_0x2f6aab);}(_0xe605,0x92));var _0x5e60=function(_0x1d3406,_0x1772a4){_0x1d3406=_0x1d3406-0x0;var _0x93d222=_0xe605[_0x1d3406];return _0x93d222;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x5e60('0x2'));var sugarcrm=require(_0x5e60('0x3'));var freshdesk=require(_0x5e60('0x4'));var zoho=require(_0x5e60('0x5'));var desk=require(_0x5e60('0x6'));var vtiger=require(_0x5e60('0x7'));var servicenow=require(_0x5e60('0x8'));var dynamics365=require(_0x5e60('0x9'));var freshsales=require(_0x5e60('0xa'));var integrations=[_0x5e60('0xb'),_0x5e60('0xc'),_0x5e60('0xd'),'freshdesk',_0x5e60('0xe'),'desk','vtiger','dynamics365',_0x5e60('0xf'),_0x5e60('0x10')];exports[_0x5e60('0x11')]=function(_0x2c5425,_0x331b3e,_0x2cbe4e,_0x56f05a,_0x6ab0ce,_0x527f7b){if(_0x2cbe4e){if(_[_0x5e60('0x12')](integrations,_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]())){try{var _0x51e7f6=null;var _0x371df7='';var _0x178782=_0x2cbe4e[_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]()];if(_0x178782){var _0x2874c4=_0x178782[_0x2c5425[_0x5e60('0x15')]];if(_0x2874c4){var _0x4fd10e=_[_0x5e60('0x16')](_0x2874c4[_0x5e60('0x17')],{'id':parseInt(_0x2c5425[_0x5e60('0x18')],0xa)});if(_0x4fd10e){if(_0x56f05a){if(_0x6ab0ce&&_0x331b3e[_0x5e60('0x19')]){_0x371df7='queue';}else if(_0x331b3e[_0x5e60('0x1a')]){_0x371df7='outbound';}else{console[_0x5e60('0x1b')](_0x5e60('0x1c'),_0x331b3e);}}else{_0x371df7='unmanaged';}switch(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]()){case _0x5e60('0xb'):zendesk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xc'):salesforce[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case'sugarcrm':sugarcrm[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0x1d'):freshdesk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xe'):zoho[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case'desk':desk[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0x1e'):vtiger[_0x371df7](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b);break;case _0x5e60('0xf'):freshsales['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;case _0x5e60('0x10'):servicenow['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;case _0x5e60('0x1f'):dynamics365['cs'](_0x2c5425,_0x331b3e,_0x4fd10e,_0x56f05a,_0x6ab0ce,_0x2874c4,_0x527f7b,_0x371df7);break;default:console[_0x5e60('0x1b')](_0x5e60('0x20'));}}else{_0x51e7f6=require(_0x5e60('0x21'))(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]());_0x51e7f6[_0x5e60('0x22')](_0x5e60('0x23'),util['format'](_0x5e60('0x24'),_0x2c5425['data1'][_0x5e60('0x14')](),_0x2c5425[_0x5e60('0x18')]));}}else{_0x51e7f6=require(_0x5e60('0x21'))(_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')]());_0x51e7f6[_0x5e60('0x22')](_0x5e60('0x23'),util['format'](_0x5e60('0x25'),_0x2c5425[_0x5e60('0x13')][_0x5e60('0x14')](),_0x2c5425['data2']));}}else{}}catch(_0x45cb62){console[_0x5e60('0x22')](_0x45cb62);}}}}; \ 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 fa07ffc..1373a98 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 _0xf241=['resolve','user_id','display_name','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','sobject','Contact','find','execute','Lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','No\x20Company','upperFirst','create','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','stringify','lodash','request-promise','moment','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','ticketType','assign','utc','getString','Descriptions','Case','Subjects','ContactId','isNil','validateEmail','then','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity'];(function(_0x9bc2f6,_0x3c039c){var _0x48d754=function(_0x3aca97){while(--_0x3aca97){_0x9bc2f6['push'](_0x9bc2f6['shift']());}};_0x48d754(++_0x3c039c);}(_0xf241,0x139));var _0x1f24=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf241[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1f24('0x0'));var rp=require(_0x1f24('0x1'));var moment=require(_0x1f24('0x2'));var BPromise=require('bluebird');var md5=require(_0x1f24('0x3'));var jsforce=require(_0x1f24('0x4'));var util=require('util');var Redis=require(_0x1f24('0x5'));var intUtil=require(_0x1f24('0x6'));var config=require(_0x1f24('0x7'));var logger=require(_0x1f24('0x8'))(_0x1f24('0x9'));config[_0x1f24('0xa')]=_['defaults'](config[_0x1f24('0xa')],{'host':_0x1f24('0xb'),'port':0x18eb});var io=require(_0x1f24('0xc'))(new Redis(config[_0x1f24('0xa')]));function emit(_0x21ddf6,_0x2b33d3,_0xe22173){io['to'](_0x21ddf6)[_0x1f24('0xd')](_0x2b33d3,_0xe22173);}function getTicket(_0x24c036,_0x313ca3,_0x7f4f5c,_0x2b36de,_0x5de819,_0x526387,_0x5835d3,_0x5ac505){var _0xa08a90={};if(_0x2b36de[_0x1f24('0xe')]==='Task'){_0xa08a90=Object[_0x1f24('0xf')]({},{'OwnerId':_0x313ca3['id'],'ActivityDate':moment[_0x1f24('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x1f24('0x11')](_0x2b36de['Subjects'],_0x5de819,'\x20'),'Description':intUtil[_0x1f24('0x11')](_0x2b36de[_0x1f24('0x12')],_0x5de819,'\x0a')},getCustomFields(_0x526387,_0x5de819));if(_0x7f4f5c){_0xa08a90['WhoId']=_0x7f4f5c['id'];}}else if(_0x2b36de[_0x1f24('0xe')]===_0x1f24('0x13')){_0xa08a90=Object[_0x1f24('0xf')]({},{'OwnerId':_0x313ca3['id'],'Subject':intUtil[_0x1f24('0x11')](_0x2b36de[_0x1f24('0x14')],_0x5de819,'\x20'),'Description':intUtil[_0x1f24('0x11')](_0x2b36de['Descriptions'],_0x5de819,'\x0a')},getCustomFields(_0x526387,_0x5de819));if(_0x7f4f5c){_0xa08a90[_0x1f24('0x15')]=_0x7f4f5c['id'];}}return _0x5835d3['sobject'](_0x2b36de[_0x1f24('0xe')])['create'](_0xa08a90);}function getUser(_0x3418ce,_0x339a3f,_0x29c682){if(!_[_0x1f24('0x16')](_0x339a3f)&&intUtil[_0x1f24('0x17')](_0x339a3f)){var _0x102879={'Email':_0x339a3f};var _0xc87194={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x29c682['sobject']('User')['find'](_0x102879,_0xc87194)['execute']()[_0x1f24('0x18')](function(_0x4738e3){if(_0x4738e3[_0x1f24('0x19')]){var _0x5e6281=_['find'](_0x4738e3,function(_0x334ca2){return _0x334ca2[_0x1f24('0x1a')]===_0x339a3f;});if(_0x5e6281){logger[_0x1f24('0x1b')](_0x1f24('0x1c'),_0x339a3f);return BPromise['resolve']({'id':_0x5e6281['Id'],'name':_0x5e6281[_0x1f24('0x1d')]});}}else{logger[_0x1f24('0x1b')](_0x1f24('0x1e'),_0x339a3f);return _0x29c682[_0x1f24('0x1f')]()['then'](function(_0x3edc3a){return BPromise[_0x1f24('0x20')]({'id':_0x3edc3a[_0x1f24('0x21')],'name':_0x3edc3a['display_name']});});}});}else{logger[_0x1f24('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x339a3f);return _0x29c682[_0x1f24('0x1f')]()[_0x1f24('0x18')](function(_0x5b625d){return BPromise[_0x1f24('0x20')]({'id':_0x5b625d['user_id'],'name':_0x5b625d[_0x1f24('0x22')]});});}}function getEndUser(_0x12a03a,_0x5783f6,_0x5bccdf,_0x3143d5,_0x35048f){var _0x5f0849={'Phone':_0x3143d5};var _0x4aceb1={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){if(_0x5783f6[_0x1f24('0xe')]===_0x1f24('0x23')){logger['info'](_0x1f24('0x24'),_0x3143d5,_0x5783f6['moduleSearch']);switch(_0x5783f6[_0x1f24('0x25')]){case _0x1f24('0x26'):return _0x35048f[_0x1f24('0x27')](_0x1f24('0x28'))[_0x1f24('0x29')](_0x5f0849,_0x4aceb1)[_0x1f24('0x2a')]()['then'](function(_0x5a8dd1){if(_0x5a8dd1&&_0x5a8dd1[_0x1f24('0x19')]){return _0x5a8dd1;}else{return _0x35048f[_0x1f24('0x27')](_0x1f24('0x2b'))[_0x1f24('0x29')](_0x5f0849,_0x4aceb1);}});case _0x1f24('0x2c'):return _0x35048f[_0x1f24('0x27')]('Contact')[_0x1f24('0x29')](_0x5f0849,_0x4aceb1)[_0x1f24('0x2a')]();case'lead':return _0x35048f['sobject'](_0x1f24('0x2b'))[_0x1f24('0x29')](_0x5f0849,_0x4aceb1);default:return null;}}else if(_0x5783f6[_0x1f24('0xe')]===_0x1f24('0x13')){logger[_0x1f24('0x1b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3143d5,_0x1f24('0x2c'));return _0x35048f[_0x1f24('0x27')](_0x1f24('0x28'))[_0x1f24('0x29')](_0x5f0849,_0x4aceb1)[_0x1f24('0x2a')]();}})[_0x1f24('0x18')](function(_0x5cbc62){if(_0x5cbc62&&_0x5cbc62[_0x1f24('0x19')]){var _0x1477af=_['find'](_0x5cbc62,function(_0x354bdb){return _0x354bdb[_0x1f24('0x2d')]===_0x3143d5;});if(_0x1477af){return BPromise[_0x1f24('0x20')]({'id':_0x1477af['Id'],'name':_0x1477af['Name'],'phone':_0x1477af[_0x1f24('0x2d')]});}}})[_0x1f24('0x18')](function(_0x4ba1f6){if(_0x4ba1f6){logger['info'](_0x1f24('0x2e'),_0x3143d5);return BPromise[_0x1f24('0x20')](_0x4ba1f6);}else{logger[_0x1f24('0x1b')](_0x1f24('0x2f'),_0x3143d5);var _0x489f5b={'LastName':_0x5bccdf!==_0x1f24('0x30')?_0x5bccdf:util[_0x1f24('0x31')](_0x1f24('0x32'),_0x3143d5),'Phone':_0x3143d5};if(_0x5783f6[_0x1f24('0x33')]){if(_0x5783f6[_0x1f24('0x33')]==='contact'){logger[_0x1f24('0x1b')](_0x1f24('0x34'),_0x3143d5,_0x5783f6['moduleCreate']);}else if(_0x5783f6['moduleCreate']===_0x1f24('0x35')&&_0x5783f6[_0x1f24('0xe')]==='Task'){logger['info'](_0x1f24('0x34'),_0x3143d5,_0x5783f6[_0x1f24('0x33')]);_0x489f5b[_0x1f24('0x36')]=_0x1f24('0x37');}else{return null;}}return _0x35048f[_0x1f24('0x27')](_[_0x1f24('0x38')](_0x5783f6['moduleCreate']))[_0x1f24('0x39')](_0x489f5b);}});}function getCustomFields(_0x263f2a,_0x1d02d5){var _0x3781f9={};if(_0x263f2a[_0x1f24('0x19')]>0x0){_['forEach'](_0x263f2a,function(_0x35aede){if(_0x35aede[_0x1f24('0x3a')]===_0x1f24('0x3b')&&_0x35aede['idField']){_0x3781f9[_0x35aede[_0x1f24('0x3c')]]=_0x35aede[_0x1f24('0x3d')][_0x1f24('0x3e')]();}else if(_0x35aede[_0x1f24('0x3a')]==='variable'&&_0x35aede['variableName']&&_0x35aede[_0x1f24('0x3c')]){_0x1d02d5[_0x35aede[_0x1f24('0x3f')]]&&(_0x3781f9[_0x35aede[_0x1f24('0x3c')]]=_0x1d02d5[_0x35aede['variableName']][_0x1f24('0x3e')]());}else if(_0x35aede[_0x1f24('0x3a')]===_0x1f24('0x40')&&_0x35aede[_0x1f24('0x41')]&&_0x35aede[_0x1f24('0x41')][_0x1f24('0x42')]&&_0x35aede['idField']){_0x1d02d5[_0x35aede[_0x1f24('0x41')]['name'][_0x1f24('0x43')]()]&&(_0x3781f9[_0x35aede[_0x1f24('0x3c')]]=_0x1d02d5[_0x35aede[_0x1f24('0x41')]['name'][_0x1f24('0x43')]()]['toString']());}});}return _0x3781f9;}function getConnection(_0x539b8d){var _0x3937cb=_0x539b8d[_0x1f24('0x44')][_0x1f24('0x45')](_0x539b8d['securityToken']);var _0x406846=new jsforce['Connection']({'oauth2':{'loginUrl':_0x539b8d[_0x1f24('0x46')]||_0x1f24('0x47'),'clientId':_0x539b8d[_0x1f24('0x48')],'clientSecret':_0x539b8d[_0x1f24('0x49')]}});return _0x406846[_0x1f24('0x4a')](_0x539b8d[_0x1f24('0x4b')],_0x3937cb)['then'](function(){logger[_0x1f24('0x1b')](_0x1f24('0x4c'));return _0x406846;});}exports[_0x1f24('0x4d')]=function(_0x7c86e0,_0x28b55c,_0x2c1520,_0x2d2564,_0x14c91a,_0x415045){var _0x1dabb6,_0xa79fd0,_0x5b9219,_0x1be617;_0x415045[_0x1f24('0x4e')]=intUtil[_0x1f24('0x4f')](_0x415045[_0x1f24('0x4e')]);_0x415045[_0x1f24('0x46')]=intUtil[_0x1f24('0x4f')](_0x415045[_0x1f24('0x46')]);if(_0x14c91a&&_0x14c91a[_0x1f24('0x50')]){logger[_0x1f24('0x1b')](_0x1f24('0x51'),_0x1f24('0x52'));_0x28b55c[_0x1f24('0x53')]=util['format'](_0x1f24('0x54'),_0x415045[_0x1f24('0x4e')],_0x28b55c['uniqueid'],md5(_0x28b55c['uniqueid']));}else{_0x28b55c[_0x1f24('0x53')]='';}return getConnection(_0x415045)[_0x1f24('0x18')](function(_0x4b9b7f){_0x1be617=_0x4b9b7f;return getUser(_0x415045,_0x2d2564[_0x1f24('0x55')],_0x1be617);})[_0x1f24('0x18')](function(_0x26f4d6){_0x1dabb6=_0x26f4d6;return getEndUser(_0x415045,_0x2c1520,_0x28b55c[_0x1f24('0x56')],_0x28b55c[_0x1f24('0x57')],_0x1be617);})[_0x1f24('0x18')](function(_0x54ecbb){_0xa79fd0=_0x54ecbb;return getTicket(_0x415045,_0x1dabb6,_0xa79fd0,_0x2c1520,_0x28b55c,_0x2c1520[_0x1f24('0x58')],_0x1be617,_0x1f24('0x4d'));})[_0x1f24('0x18')](function(_0x5bee25){_0x5b9219=_0x5bee25;logger['info'](_0x1f24('0x59'),_0x5b9219['id']);logger[_0x1f24('0x1b')](_0x1f24('0x5a'),_0x5b9219['id'],_0x2d2564['name'],_0x415045[_0x1f24('0x3a')]);switch(_0x415045[_0x1f24('0x3a')]){case _0x1f24('0x5b'):emit(util['format'](_0x1f24('0x5c'),_0x2d2564[_0x1f24('0x42')]),'trigger:salesforce:display',{'recordId':_0x5b9219['id']});break;case _0x1f24('0x5d'):emit(util[_0x1f24('0x31')](_0x1f24('0x5c'),_0x2d2564[_0x1f24('0x42')]),_0x1f24('0x5e'),{'uri':util[_0x1f24('0x31')](_0x1f24('0x5f'),_0x1be617['instanceUrl'],_0x5b9219['id'])});break;default:logger[_0x1f24('0x60')](_0x1f24('0x61'));}})[_0x1f24('0x62')](function(_0x14b32d){logger[_0x1f24('0x60')](_0x1f24('0x51'),JSON['stringify'](_0x14b32d));});};exports[_0x1f24('0x63')]=function(_0x378d3e,_0x5abdde,_0x1997f4,_0x433ba9,_0x3ec44d,_0x104ab0,_0x57987d){var _0x57c684,_0x5bedd6,_0x4a1462,_0x2cbdca;_0x104ab0[_0x1f24('0x4e')]=intUtil[_0x1f24('0x4f')](_0x104ab0[_0x1f24('0x4e')]);_0x104ab0['remoteUri']=intUtil[_0x1f24('0x4f')](_0x104ab0[_0x1f24('0x46')]);if(_0x57987d&&_0x57987d['recordingFormat']&&_0x57987d[_0x1f24('0x64')]!==_0x1f24('0x65')){logger[_0x1f24('0x1b')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5abdde[_0x1f24('0x53')]=util['format'](_0x1f24('0x54'),_0x104ab0[_0x1f24('0x4e')],_0x5abdde[_0x1f24('0x66')],md5(_0x5abdde[_0x1f24('0x66')]));}return getConnection(_0x104ab0)[_0x1f24('0x18')](function(_0x537e22){_0x2cbdca=_0x537e22;return getUser(_0x104ab0,_0x433ba9[_0x1f24('0x55')],_0x2cbdca);})[_0x1f24('0x18')](function(_0x30cd58){_0x57c684=_0x30cd58;return getEndUser(_0x104ab0,_0x1997f4,_0x5abdde[_0x1f24('0x67')],_0x5abdde[_0x1f24('0x68')],_0x2cbdca);})[_0x1f24('0x18')](function(_0x3aa30b){_0x5bedd6=_0x3aa30b;return getTicket(_0x104ab0,_0x57c684,_0x5bedd6,_0x1997f4,_0x5abdde,_0x1997f4[_0x1f24('0x58')],_0x2cbdca,'outbound');})[_0x1f24('0x18')](function(_0x41c73d){_0x4a1462=_0x41c73d;logger[_0x1f24('0x1b')](_0x1f24('0x69'),_0x4a1462['id']);logger[_0x1f24('0x1b')](_0x1f24('0x6a'),_0x4a1462['id'],_0x433ba9['name'],_0x104ab0[_0x1f24('0x3a')]);switch(_0x104ab0[_0x1f24('0x3a')]){case _0x1f24('0x5b'):emit(util[_0x1f24('0x31')](_0x1f24('0x5c'),_0x433ba9['name']),'trigger:salesforce:display',{'recordId':_0x4a1462['id']});break;case _0x1f24('0x5d'):emit(util[_0x1f24('0x31')](_0x1f24('0x5c'),_0x433ba9[_0x1f24('0x42')]),_0x1f24('0x5e'),{'uri':util['format']('%s/%s/e',_0x2cbdca[_0x1f24('0x6b')],_0x4a1462['id'])});break;default:logger[_0x1f24('0x60')](_0x1f24('0x6c'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0xc79ed1){logger[_0x1f24('0x60')](_0x1f24('0x6c'),JSON['stringify'](_0xc79ed1));});};exports[_0x1f24('0x6d')]=function(_0x182be6,_0x4c7f67,_0x22539f,_0x28ab5a,_0x272464,_0x3e8507){var _0x3b3e27,_0x5bf544,_0x2b4429,_0xbd063e;_0x3e8507['serverUrl']=intUtil['stripTrailingSlash'](_0x3e8507[_0x1f24('0x4e')]);_0x3e8507[_0x1f24('0x46')]=intUtil['stripTrailingSlash'](_0x3e8507[_0x1f24('0x46')]);if(_0x272464&&_0x272464[_0x1f24('0x50')]){logger[_0x1f24('0x1b')]('['+_0x4c7f67[_0x1f24('0x6e')][_0x1f24('0x6f')]()+']','Recording\x20is\x20enabled!');_0x4c7f67['recordingURL']=util[_0x1f24('0x31')](_0x1f24('0x54'),_0x3e8507['serverUrl'],_0x4c7f67[_0x1f24('0x66')],md5(_0x4c7f67[_0x1f24('0x66')]));}else{_0x4c7f67[_0x1f24('0x53')]='';}return getConnection(_0x3e8507)[_0x1f24('0x18')](function(_0x216004){_0xbd063e=_0x216004;if(!_['isNil'](_0x28ab5a)){return getUser(_0x3e8507,_0x28ab5a[_0x1f24('0x42')],_0xbd063e);}else{return getUser(_0x3e8507,null,_0xbd063e);}})['then'](function(_0x542dd7){_0x3b3e27=_0x542dd7;return getEndUser(_0x3e8507,_0x22539f,_0x4c7f67[_0x1f24('0x56')],_0x4c7f67[_0x1f24('0x57')],_0xbd063e);})[_0x1f24('0x18')](function(_0x3a6b04){_0x5bf544=_0x3a6b04;return getTicket(_0x3e8507,_0x3b3e27,_0x5bf544,_0x22539f,_0x4c7f67,_0x22539f['Fields'],_0xbd063e);})[_0x1f24('0x18')](function(_0x280dcc){_0x2b4429=_0x280dcc;logger[_0x1f24('0x1b')]('['+_0x4c7f67[_0x1f24('0x6e')][_0x1f24('0x6f')]()+_0x1f24('0x70'),_0x2b4429['id']);logger[_0x1f24('0x1b')]('['+_0x4c7f67[_0x1f24('0x6e')][_0x1f24('0x6f')]()+_0x1f24('0x71'),_0x3e8507[_0x1f24('0x3a')]);})['catch'](function(_0xea98af){logger[_0x1f24('0x60')]('['+_0x4c7f67[_0x1f24('0x6e')][_0x1f24('0x6f')]()+']',JSON[_0x1f24('0x72')](_0xea98af));});}; \ No newline at end of file +var _0x78a6=['uniqueid','email','calleridnum','queue','[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','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname',']\x20Integration\x20account\x20type\x20%s.','moment','md5','jsforce','util','ioredis','../../../../config/environment','redis','localhost','socket.io-emitter','emit','Task','assign','utc','Subjects','getString','Descriptions','Case','ContactId','sobject','ticketType','isNil','validateEmail','User','execute','then','length','find','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','No\x20Company','upperFirst','create','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x29f964,_0x68179f){var _0x38dcc1=function(_0x41b164){while(--_0x41b164){_0x29f964['push'](_0x29f964['shift']());}};_0x38dcc1(++_0x68179f);}(_0x78a6,0x1d2));var _0x678a=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x78a6[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x678a('0x0'));var BPromise=require('bluebird');var md5=require(_0x678a('0x1'));var jsforce=require(_0x678a('0x2'));var util=require(_0x678a('0x3'));var Redis=require(_0x678a('0x4'));var intUtil=require('./util');var config=require(_0x678a('0x5'));var logger=require('../../../../config/logger')('salesforce');config[_0x678a('0x6')]=_['defaults'](config[_0x678a('0x6')],{'host':_0x678a('0x7'),'port':0x18eb});var io=require(_0x678a('0x8'))(new Redis(config[_0x678a('0x6')]));function emit(_0x1c1174,_0x55ea21,_0x5c649e){io['to'](_0x1c1174)[_0x678a('0x9')](_0x55ea21,_0x5c649e);}function getTicket(_0x10de8c,_0x297b3f,_0x5b98ff,_0x27d735,_0x3ade53,_0x2981db,_0x303109,_0x396a4b){var _0xb06028={};if(_0x27d735['ticketType']===_0x678a('0xa')){_0xb06028=Object[_0x678a('0xb')]({},{'OwnerId':_0x297b3f['id'],'ActivityDate':moment[_0x678a('0xc')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x27d735[_0x678a('0xd')],_0x3ade53,'\x20'),'Description':intUtil[_0x678a('0xe')](_0x27d735[_0x678a('0xf')],_0x3ade53,'\x0a')},getCustomFields(_0x2981db,_0x3ade53));if(_0x5b98ff){_0xb06028['WhoId']=_0x5b98ff['id'];}}else if(_0x27d735['ticketType']===_0x678a('0x10')){_0xb06028=Object[_0x678a('0xb')]({},{'OwnerId':_0x297b3f['id'],'Subject':intUtil['getString'](_0x27d735[_0x678a('0xd')],_0x3ade53,'\x20'),'Description':intUtil[_0x678a('0xe')](_0x27d735[_0x678a('0xf')],_0x3ade53,'\x0a')},getCustomFields(_0x2981db,_0x3ade53));if(_0x5b98ff){_0xb06028[_0x678a('0x11')]=_0x5b98ff['id'];}}return _0x303109[_0x678a('0x12')](_0x27d735[_0x678a('0x13')])['create'](_0xb06028);}function getUser(_0x3e5c16,_0x35299f,_0x54a632){if(!_[_0x678a('0x14')](_0x35299f)&&intUtil[_0x678a('0x15')](_0x35299f)){var _0x1dc59f={'Email':_0x35299f};var _0x5e52e3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x54a632[_0x678a('0x12')](_0x678a('0x16'))['find'](_0x1dc59f,_0x5e52e3)[_0x678a('0x17')]()[_0x678a('0x18')](function(_0x1e73b0){if(_0x1e73b0[_0x678a('0x19')]){var _0x2f705d=_[_0x678a('0x1a')](_0x1e73b0,function(_0x1387ec){return _0x1387ec['Email']===_0x35299f;});if(_0x2f705d){logger['info'](_0x678a('0x1b'),_0x35299f);return BPromise[_0x678a('0x1c')]({'id':_0x2f705d['Id'],'name':_0x2f705d[_0x678a('0x1d')]});}}else{logger[_0x678a('0x1e')](_0x678a('0x1f'),_0x35299f);return _0x54a632[_0x678a('0x20')]()[_0x678a('0x18')](function(_0x42b81f){return BPromise['resolve']({'id':_0x42b81f[_0x678a('0x21')],'name':_0x42b81f[_0x678a('0x22')]});});}});}else{logger[_0x678a('0x1e')](_0x678a('0x1f'),_0x35299f);return _0x54a632[_0x678a('0x20')]()['then'](function(_0x2b3943){return BPromise[_0x678a('0x1c')]({'id':_0x2b3943['user_id'],'name':_0x2b3943[_0x678a('0x22')]});});}}function getEndUser(_0x59625a,_0x4d3644,_0x531494,_0x2d0050,_0x19f8c7){var _0x3c7470={'Phone':_0x2d0050};var _0x181600={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x678a('0x1c')]()[_0x678a('0x18')](function(){if(_0x4d3644[_0x678a('0x13')]==='Task'){logger[_0x678a('0x1e')](_0x678a('0x23'),_0x2d0050,_0x4d3644[_0x678a('0x24')]);switch(_0x4d3644[_0x678a('0x24')]){case _0x678a('0x25'):return _0x19f8c7[_0x678a('0x12')](_0x678a('0x26'))[_0x678a('0x1a')](_0x3c7470,_0x181600)['execute']()['then'](function(_0x564e7c){if(_0x564e7c&&_0x564e7c[_0x678a('0x19')]){return _0x564e7c;}else{return _0x19f8c7[_0x678a('0x12')](_0x678a('0x27'))[_0x678a('0x1a')](_0x3c7470,_0x181600);}});case _0x678a('0x28'):return _0x19f8c7[_0x678a('0x12')](_0x678a('0x26'))[_0x678a('0x1a')](_0x3c7470,_0x181600)[_0x678a('0x17')]();case'lead':return _0x19f8c7[_0x678a('0x12')](_0x678a('0x27'))[_0x678a('0x1a')](_0x3c7470,_0x181600);default:return null;}}else if(_0x4d3644[_0x678a('0x13')]===_0x678a('0x10')){logger[_0x678a('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2d0050,_0x678a('0x28'));return _0x19f8c7[_0x678a('0x12')](_0x678a('0x26'))['find'](_0x3c7470,_0x181600)[_0x678a('0x17')]();}})['then'](function(_0x5d4c07){if(_0x5d4c07&&_0x5d4c07['length']){var _0x5907cc=_[_0x678a('0x1a')](_0x5d4c07,function(_0x9b1297){return _0x9b1297[_0x678a('0x29')]===_0x2d0050;});if(_0x5907cc){return BPromise[_0x678a('0x1c')]({'id':_0x5907cc['Id'],'name':_0x5907cc['Name'],'phone':_0x5907cc[_0x678a('0x29')]});}}})[_0x678a('0x18')](function(_0x599a70){if(_0x599a70){logger[_0x678a('0x1e')](_0x678a('0x2a'),_0x2d0050);return BPromise[_0x678a('0x1c')](_0x599a70);}else{logger['info'](_0x678a('0x2b'),_0x2d0050);var _0x142bf4={'LastName':_0x531494!==_0x678a('0x2c')?_0x531494:util[_0x678a('0x2d')]('Caller\x20-\x20%s',_0x2d0050),'Phone':_0x2d0050};if(_0x4d3644[_0x678a('0x2e')]){if(_0x4d3644[_0x678a('0x2e')]===_0x678a('0x28')){logger['info'](_0x678a('0x2f'),_0x2d0050,_0x4d3644[_0x678a('0x2e')]);}else if(_0x4d3644[_0x678a('0x2e')]===_0x678a('0x30')&&_0x4d3644[_0x678a('0x13')]===_0x678a('0xa')){logger[_0x678a('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2d0050,_0x4d3644['moduleCreate']);_0x142bf4['Company']=_0x678a('0x31');}else{return null;}}return _0x19f8c7[_0x678a('0x12')](_[_0x678a('0x32')](_0x4d3644[_0x678a('0x2e')]))[_0x678a('0x33')](_0x142bf4);}});}function getCustomFields(_0x1a2199,_0x21b417){var _0x4947e1={};if(_0x1a2199[_0x678a('0x19')]>0x0){_[_0x678a('0x34')](_0x1a2199,function(_0x3f765a){if(_0x3f765a[_0x678a('0x35')]===_0x678a('0x36')&&_0x3f765a[_0x678a('0x37')]){_0x4947e1[_0x3f765a[_0x678a('0x37')]]=_0x3f765a[_0x678a('0x38')][_0x678a('0x39')]();}else if(_0x3f765a[_0x678a('0x35')]===_0x678a('0x3a')&&_0x3f765a[_0x678a('0x3b')]&&_0x3f765a['idField']){_0x21b417[_0x3f765a[_0x678a('0x3b')]]&&(_0x4947e1[_0x3f765a['idField']]=_0x21b417[_0x3f765a[_0x678a('0x3b')]][_0x678a('0x39')]());}else if(_0x3f765a['type']===_0x678a('0x3c')&&_0x3f765a[_0x678a('0x3d')]&&_0x3f765a[_0x678a('0x3d')]['name']&&_0x3f765a[_0x678a('0x37')]){_0x21b417[_0x3f765a[_0x678a('0x3d')][_0x678a('0x3e')]['toLowerCase']()]&&(_0x4947e1[_0x3f765a[_0x678a('0x37')]]=_0x21b417[_0x3f765a['Variable'][_0x678a('0x3e')][_0x678a('0x3f')]()][_0x678a('0x39')]());}});}return _0x4947e1;}function getConnection(_0x346347){var _0x122640=_0x346347[_0x678a('0x40')][_0x678a('0x41')](_0x346347[_0x678a('0x42')]);var _0x36ad67=new jsforce['Connection']({'oauth2':{'loginUrl':_0x346347['remoteUri']||'https://login.salesforce.com','clientId':_0x346347[_0x678a('0x43')],'clientSecret':_0x346347[_0x678a('0x44')]}});return _0x36ad67[_0x678a('0x45')](_0x346347[_0x678a('0x46')],_0x122640)[_0x678a('0x18')](function(){logger[_0x678a('0x1e')](_0x678a('0x47'));return _0x36ad67;});}exports['queue']=function(_0x28ade6,_0x40acd8,_0x233eba,_0x2123d1,_0x4ed603,_0x2b2a21){var _0x362927,_0x46a04c,_0x10de92,_0x13180e;_0x2b2a21[_0x678a('0x48')]=intUtil['stripTrailingSlash'](_0x2b2a21[_0x678a('0x48')]);_0x2b2a21[_0x678a('0x49')]=intUtil[_0x678a('0x4a')](_0x2b2a21[_0x678a('0x49')]);if(_0x4ed603&&_0x4ed603[_0x678a('0x4b')]){logger[_0x678a('0x1e')](_0x678a('0x4c'),'Recording\x20is\x20enabled!');_0x40acd8[_0x678a('0x4d')]=util[_0x678a('0x2d')](_0x678a('0x4e'),_0x2b2a21[_0x678a('0x48')],_0x40acd8[_0x678a('0x4f')],md5(_0x40acd8[_0x678a('0x4f')]));}else{_0x40acd8[_0x678a('0x4d')]='';}return getConnection(_0x2b2a21)[_0x678a('0x18')](function(_0x4f07af){_0x13180e=_0x4f07af;return getUser(_0x2b2a21,_0x2123d1[_0x678a('0x50')],_0x13180e);})[_0x678a('0x18')](function(_0x9dd8a4){_0x362927=_0x9dd8a4;return getEndUser(_0x2b2a21,_0x233eba,_0x40acd8['calleridname'],_0x40acd8[_0x678a('0x51')],_0x13180e);})['then'](function(_0x347a1e){_0x46a04c=_0x347a1e;return getTicket(_0x2b2a21,_0x362927,_0x46a04c,_0x233eba,_0x40acd8,_0x233eba['Fields'],_0x13180e,_0x678a('0x52'));})['then'](function(_0x2da3a5){_0x10de92=_0x2da3a5;logger[_0x678a('0x1e')](_0x678a('0x53'),_0x10de92['id']);logger[_0x678a('0x1e')](_0x678a('0x54'),_0x10de92['id'],_0x2123d1[_0x678a('0x3e')],_0x2b2a21['type']);switch(_0x2b2a21[_0x678a('0x35')]){case _0x678a('0x55'):emit(util[_0x678a('0x2d')](_0x678a('0x56'),_0x2123d1[_0x678a('0x3e')]),_0x678a('0x57'),{'recordId':_0x10de92['id']});break;case _0x678a('0x58'):emit(util[_0x678a('0x2d')](_0x678a('0x56'),_0x2123d1[_0x678a('0x3e')]),_0x678a('0x59'),{'uri':util[_0x678a('0x2d')](_0x678a('0x5a'),_0x13180e[_0x678a('0x5b')],_0x10de92['id'])});break;default:logger['error'](_0x678a('0x5c'));}})[_0x678a('0x5d')](function(_0x34c56f){logger[_0x678a('0x5e')](_0x678a('0x4c'),JSON[_0x678a('0x5f')](_0x34c56f));});};exports[_0x678a('0x60')]=function(_0xc9adad,_0x4c6f0d,_0x2a072a,_0x2b4b5f,_0x8c48ea,_0x474c2e,_0x5baf8f){var _0x5e0c2c,_0x45f28c,_0x4bde52,_0x15d05b;_0x474c2e['serverUrl']=intUtil[_0x678a('0x4a')](_0x474c2e[_0x678a('0x48')]);_0x474c2e[_0x678a('0x49')]=intUtil['stripTrailingSlash'](_0x474c2e[_0x678a('0x49')]);if(_0x5baf8f&&_0x5baf8f[_0x678a('0x61')]&&_0x5baf8f[_0x678a('0x61')]!=='none'){logger[_0x678a('0x1e')](_0x678a('0x62'),'Recording\x20is\x20enabled!');_0x4c6f0d[_0x678a('0x4d')]=util[_0x678a('0x2d')](_0x678a('0x4e'),_0x474c2e[_0x678a('0x48')],_0x4c6f0d[_0x678a('0x4f')],md5(_0x4c6f0d[_0x678a('0x4f')]));}return getConnection(_0x474c2e)[_0x678a('0x18')](function(_0x20e2fe){_0x15d05b=_0x20e2fe;return getUser(_0x474c2e,_0x2b4b5f[_0x678a('0x50')],_0x15d05b);})[_0x678a('0x18')](function(_0x1a3d3a){_0x5e0c2c=_0x1a3d3a;return getEndUser(_0x474c2e,_0x2a072a,_0x4c6f0d[_0x678a('0x63')],_0x4c6f0d[_0x678a('0x64')],_0x15d05b);})['then'](function(_0x3056c6){_0x45f28c=_0x3056c6;return getTicket(_0x474c2e,_0x5e0c2c,_0x45f28c,_0x2a072a,_0x4c6f0d,_0x2a072a[_0x678a('0x65')],_0x15d05b,_0x678a('0x60'));})[_0x678a('0x18')](function(_0x1feae4){_0x4bde52=_0x1feae4;logger['info'](_0x678a('0x66'),_0x4bde52['id']);logger[_0x678a('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4bde52['id'],_0x2b4b5f['name'],_0x474c2e[_0x678a('0x35')]);switch(_0x474c2e['type']){case _0x678a('0x55'):emit(util[_0x678a('0x2d')](_0x678a('0x56'),_0x2b4b5f[_0x678a('0x3e')]),_0x678a('0x57'),{'recordId':_0x4bde52['id']});break;case _0x678a('0x58'):emit(util['format'](_0x678a('0x56'),_0x2b4b5f['name']),_0x678a('0x59'),{'uri':util[_0x678a('0x2d')](_0x678a('0x5a'),_0x15d05b[_0x678a('0x5b')],_0x4bde52['id'])});break;default:logger[_0x678a('0x5e')](_0x678a('0x62'),_0x678a('0x67'));}})[_0x678a('0x5d')](function(_0x446827){logger[_0x678a('0x5e')](_0x678a('0x62'),JSON[_0x678a('0x5f')](_0x446827));});};exports[_0x678a('0x68')]=function(_0x1148d7,_0x384eb5,_0x9ee0fc,_0x375fa5,_0x561778,_0x3b53c0){var _0x590bc4,_0x260e74,_0x50cc3b,_0x299fae;_0x3b53c0[_0x678a('0x48')]=intUtil[_0x678a('0x4a')](_0x3b53c0[_0x678a('0x48')]);_0x3b53c0['remoteUri']=intUtil['stripTrailingSlash'](_0x3b53c0[_0x678a('0x49')]);if(_0x561778&&_0x561778[_0x678a('0x4b')]){logger[_0x678a('0x1e')]('['+_0x384eb5[_0x678a('0x69')][_0x678a('0x6a')]()+']','Recording\x20is\x20enabled!');_0x384eb5[_0x678a('0x4d')]=util[_0x678a('0x2d')](_0x678a('0x4e'),_0x3b53c0[_0x678a('0x48')],_0x384eb5[_0x678a('0x4f')],md5(_0x384eb5[_0x678a('0x4f')]));}else{_0x384eb5[_0x678a('0x4d')]='';}return getConnection(_0x3b53c0)['then'](function(_0x5811d1){_0x299fae=_0x5811d1;if(!_[_0x678a('0x14')](_0x375fa5)){return getUser(_0x3b53c0,_0x375fa5[_0x678a('0x3e')],_0x299fae);}else{return getUser(_0x3b53c0,null,_0x299fae);}})[_0x678a('0x18')](function(_0x481d74){_0x590bc4=_0x481d74;return getEndUser(_0x3b53c0,_0x9ee0fc,_0x384eb5[_0x678a('0x6b')],_0x384eb5[_0x678a('0x51')],_0x299fae);})[_0x678a('0x18')](function(_0x4d1f04){_0x260e74=_0x4d1f04;return getTicket(_0x3b53c0,_0x590bc4,_0x260e74,_0x9ee0fc,_0x384eb5,_0x9ee0fc[_0x678a('0x65')],_0x299fae);})['then'](function(_0x5667fb){_0x50cc3b=_0x5667fb;logger[_0x678a('0x1e')]('['+_0x384eb5[_0x678a('0x69')][_0x678a('0x6a')]()+']\x20Ticket\x20%s\x20created.',_0x50cc3b['id']);logger[_0x678a('0x1e')]('['+_0x384eb5[_0x678a('0x69')][_0x678a('0x6a')]()+_0x678a('0x6c'),_0x3b53c0[_0x678a('0x35')]);})['catch'](function(_0x2dca23){logger[_0x678a('0x5e')]('['+_0x384eb5[_0x678a('0x69')][_0x678a('0x6a')]()+']',JSON[_0x678a('0x5f')](_0x2dca23));});}; \ 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 03ba45f..cf4d1c8 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 _0x7a54=['getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','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','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x4e7012,_0x5d5f73){var _0xcd56d5=function(_0x330847){while(--_0x330847){_0x4e7012['push'](_0x4e7012['shift']());}};_0xcd56d5(++_0x5d5f73);}(_0x7a54,0x106));var _0x47a5=function(_0x5652dd,_0xc85606){_0x5652dd=_0x5652dd-0x0;var _0x110374=_0x7a54[_0x5652dd];return _0x110374;};'use strict';var _=require(_0x47a5('0x0'));var Promise=require(_0x47a5('0x1'));var rp=require(_0x47a5('0x2'));var util=require('util');var md5=require(_0x47a5('0x3'));var Redis=require(_0x47a5('0x4'));var intUtil=require('./util');var config=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));function getAdminUser(_0x30e405,_0x506eda,_0x194fb0,_0x5077f3,_0x5d90b3,_0x582352){return new Promise(function(_0x2a0e98,_0x2baee7){var _0x5e31dd={'method':_0x47a5('0xb'),'uri':_0x5077f3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5d90b3+'&'+_0x582352,'auth':_0x506eda,'json':!![]};return rp(_0x5e31dd)['then'](function(_0x1f47f4){if(_0x1f47f4[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x194fb0[_0x47a5('0xe')]=_0x1f47f4[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}logger[_0x47a5('0x10')]('['+[_0x30e405['toUpperCase']()]+_0x47a5('0x11'),_0x194fb0);_0x2a0e98(_0x194fb0);})[_0x47a5('0x12')](function(_0x1cf309){logger[_0x47a5('0x13')]('['+[_0x30e405[_0x47a5('0x14')]()]+']',_0x1cf309[_0x47a5('0x15')]);_0x2baee7(_0x1cf309[_0x47a5('0x15')]);});});}function getUser(_0x190faa,_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return function(_0x2a2cbb){logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x2a2cbb);return new Promise(function(_0x138bc0,_0x4b966e){if(intUtil['validateEmail'](_0x2a2cbb[_0x47a5('0x16')])){var _0xaf70a6={'method':_0x47a5('0xb'),'uri':_0x362359+_0x47a5('0x17')+_0x2a2cbb[_0x47a5('0x16')]+'&'+_0x11faf5+'&'+_0x3b001e,'auth':_0x4e99a8,'json':!![]};logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x18'),_0xaf70a6);return rp(_0xaf70a6)[_0x47a5('0x19')](function(_0x4a9fcb){logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+'],\x20getUser\x20entity',_0x4a9fcb);if(_0x4a9fcb[_0x47a5('0xc')][_0x47a5('0xd')]>0x0&&String(_0x4a9fcb[_0x47a5('0xc')][0x0]['active'])===_0x47a5('0x1a')){_0x2a2cbb[_0x47a5('0x1b')]=_0x4a9fcb[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}else{_0x2a2cbb['userId']=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb['adminEmail'];}logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x1c'),_0x2a2cbb);_0x138bc0(_0x2a2cbb);})[_0x47a5('0x12')](function(_0x3abd6a){logger['error']('['+[_0x190faa['toUpperCase']()]+']',_0x3abd6a[_0x47a5('0x15')]);_0x4b966e(_0x3abd6a['message']);});}else{logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+_0x47a5('0x1d'));_0x2a2cbb[_0x47a5('0x1b')]=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb[_0x47a5('0x1e')];_0x138bc0(_0x2a2cbb);}});};}function createEndUser(_0x3ba0b7,_0x24b162,_0x136b14,_0x16631f,_0x361bfa){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+_0x47a5('0x1f'),_0x136b14);return new Promise(function(_0x528582,_0x243210){var _0x51833b={'method':_0x47a5('0x20'),'uri':_0x16631f+_0x47a5('0x21')+_0x361bfa,'body':{'user_name':_0x136b14[_0x47a5('0x22')],'roles':'user','first_name':_0x136b14[_0x47a5('0x22')],'active':_0x47a5('0x1a'),'date_format':_0x47a5('0x23'),'phone':_0x136b14[_0x47a5('0x22')]},'auth':_0x24b162,'json':!![]};return rp(_0x51833b)['then'](function(_0x50d875){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+'],\x20EndUser\x20schema',_0x50d875['result']);_0x136b14[_0x47a5('0x24')]=_0x50d875[_0x47a5('0xc')]['sys_id'];_0x528582(_0x136b14);})[_0x47a5('0x12')](function(_0x53119b){logger[_0x47a5('0x13')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+']',_0x53119b['message']);_0x243210(_0x53119b['message']);});});}function getEndUser(_0x274e34,_0x5910bb,_0x403028,_0x87e4c9,_0xf269a8){return function(_0x52749b){logger[_0x47a5('0x10')]('['+[_0x274e34['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x52749b);return new Promise(function(_0x65542e,_0x5a8a7c){var _0x25cce0={'method':'GET','uri':_0x403028+_0x47a5('0x25')+_0x52749b[_0x47a5('0x22')]+'&'+_0x87e4c9+'&'+_0xf269a8,'auth':_0x5910bb,'json':!![]};return rp(_0x25cce0)[_0x47a5('0x19')](function(_0x199698){if(_0x199698[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x52749b[_0x47a5('0x24')]=_0x199698[_0x47a5('0xc')][0x0][_0x47a5('0xf')];logger['info']('['+[_0x274e34[_0x47a5('0x14')]()]+_0x47a5('0x26'),_0x52749b);_0x65542e(_0x52749b);}else{return createEndUser(_0x274e34,_0x5910bb,_0x52749b,_0x403028,_0x87e4c9)['then'](function(_0x2c50d6){logger[_0x47a5('0x10')]('['+[_0x274e34[_0x47a5('0x14')]()]+'],\x20createEndUser\x20crm',_0x2c50d6);_0x65542e(_0x2c50d6);});}})[_0x47a5('0x12')](function(_0x10f660){logger['error']('['+[_0x274e34[_0x47a5('0x14')]()]+']',_0x10f660[_0x47a5('0x15')]);_0x5a8a7c(_0x10f660['message']);});});};}function getCustomFields(_0x55c5eb,_0x5ebd8c){var _0x12d9f2={};if(_0x55c5eb['length']>0x0){_[_0x47a5('0x27')](_0x55c5eb,function(_0x1f9631){if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2a')]&&!_0x1f9631[_0x47a5('0x2b')]){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2c')]&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631['type']===_0x47a5('0x30')&&_0x1f9631['variableName']&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631['idField'][_0x47a5('0x2d')]()]=_0x5ebd8c[_0x1f9631['variableName']][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x31')&&_0x1f9631['Variable']&&_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')]&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')]['toLowerCase']()]=_0x5ebd8c[_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')][_0x47a5('0x2d')]()][_0x47a5('0x2f')]();}});}return _0x12d9f2;}function getTicket(_0x34a9ae,_0xf0edbb,_0x434227,_0x17cc42,_0xac9c15,_0x162fa0){return function(_0x24ecb1){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+_0x47a5('0x34'),_0x24ecb1);return new Promise(function(_0x4e5e7,_0x3a2b38){var _0x512e65=_0x34a9ae[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x24ecb1['userId']:_0x24ecb1['endUserId'];var _0x3d0a88={'method':'POST','uri':_0x434227+_0x47a5('0x36')+'?'+_0x162fa0,'body':Object[_0x47a5('0x37')]({},{'active':'true','caller_id':_0x512e65,'assigned_to':_0x24ecb1['userId'],'short_description':intUtil[_0x47a5('0x38')](_0x17cc42['Subjects'],_0xac9c15,'\x20'),'description':intUtil[_0x47a5('0x38')](_0x17cc42[_0x47a5('0x39')],_0xac9c15,'\x0a')},getCustomFields(_0x17cc42[_0x47a5('0x3a')],_0xac9c15)),'auth':_0xf0edbb,'json':!![]};return rp(_0x3d0a88)[_0x47a5('0x19')](function(_0x44fe8a){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x44fe8a['result']);_0x24ecb1[_0x47a5('0x3b')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0xf')];_0x24ecb1[_0x47a5('0x3c')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0x3d')];logger[_0x47a5('0x10')]('['+[_0x34a9ae['toUpperCase']()]+_0x47a5('0x3e'),_0x24ecb1);_0x4e5e7(_0x24ecb1);})[_0x47a5('0x12')](function(_0x5f6a){logger['error']('['+[_0x34a9ae[_0x47a5('0x14')]()]+']',_0x5f6a['message']);_0x3a2b38(_0x5f6a[_0x47a5('0x15')]);});});};}function createRemoteTag(_0xe31817,_0x46e90b,_0xf03bd5,_0x588551){return new Promise(function(_0x3adf14,_0x1e6de3){var _0x2f66e9={'method':_0x47a5('0x20'),'uri':_0xf03bd5+_0x47a5('0x3f')+'?'+_0x588551,'body':{'short_description':_0xe31817,'global':!![],'active':!![],'name':_0xe31817},'auth':_0x46e90b,'json':!![]};return rp(_0x2f66e9)[_0x47a5('0x19')](function(_0x24e9f4){var _0x481089=_0x24e9f4[_0x47a5('0xc')][_0x47a5('0xf')];_0x3adf14(_0x481089);});});}function getRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf,_0x572233){return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581={'method':'GET','uri':_0x3329aa+_0x47a5('0x3f')+_0x47a5('0x40')+_0x187d7e+'&'+_0x1ab0bf,'auth':_0x8da9fb,'json':!![]};return rp(_0x1aa581)[_0x47a5('0x19')](function(_0x5d8d4a){if(_0x5d8d4a['result'][_0x47a5('0xd')]>0x0){var _0x376e1d=_0x5d8d4a['result'][0x0]['sys_id'];_0x1ad6a9(_0x376e1d);}else{return createRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf)[_0x47a5('0x19')](function(_0x4d6a82){_0x1ad6a9(_0x4d6a82);});}});});}function assignTagToIncident(_0x16bb8a,_0x5d383d,_0x482de6,_0x389ed9,_0x46d2d3){return new Promise(function(_0x53eedf,_0x1b958b){var _0x72fe={'method':'POST','uri':_0x482de6+'label_entry'+'?'+_0x46d2d3,'body':{'label':_0x16bb8a,'table':_0x47a5('0x36'),'id_type':_0x47a5('0x41'),'table_key':_0x389ed9[_0x47a5('0x3b')],'title':_0x47a5('0x42')+_0x389ed9['ticketNumber'],'id_display':_0x389ed9[_0x47a5('0x3c')]},'auth':_0x5d383d,'json':!![]};return rp(_0x72fe)[_0x47a5('0x19')](function(_0x1af800){_0x53eedf();})['catch'](function(){_0x53eedf();});});}function manageTags(_0x30ea7a,_0x4db625,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b,_0x3603b7){return new Promise(function(_0x4966af,_0x144af9){var _0x5d1550=[];_0x4db625['forEach'](function(_0x5eb150){_0x5d1550['push'](getRemoteTag(_0x5eb150,_0x485e3c,_0x470da6,_0x1c485b,_0x3603b7));});return Promise[_0x47a5('0x43')](_0x5d1550)[_0x47a5('0x19')](function(_0x1e2bb4){if(_0x1e2bb4['length']){logger['info']('['+[_0x30ea7a[_0x47a5('0x14')]()]+_0x47a5('0x44'),_0x1e2bb4);var _0x45d4b6=[];_0x1e2bb4[_0x47a5('0x27')](function(_0xc45e25){_0x45d4b6['push'](assignTagToIncident(_0xc45e25,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b));});return Promise[_0x47a5('0x43')](_0x45d4b6)['then'](function(){_0x4966af();})[_0x47a5('0x12')](function(){_0x4966af();});}else{_0x4966af();}});});}function getTags(_0x274d31,_0x4d545f,_0x32b4de,_0x345104,_0x132854,_0x3e8274){return function(_0x2d6494){return new Promise(function(_0x215634,_0x35cca8){var _0x3ac38c=[];var _0x57ed0a=_0x345104[_0x47a5('0x45')];if(_0x57ed0a&&_0x57ed0a[_0x47a5('0xd')]>0x0){_0x3ac38c=_[_0x47a5('0x46')](_0x57ed0a,_0x47a5('0x33'));}if(_0x3ac38c[_0x47a5('0xd')]>0x0){return manageTags(_0x274d31,_0x3ac38c,_0x4d545f,_0x32b4de,_0x2d6494,_0x132854,_0x3e8274)['then'](function(){_0x215634(_0x2d6494);});}else{_0x215634(_0x2d6494);}});};}function emit(_0xbec033,_0xdfcecc,_0x1224bc){var _0x144aaa=_0x47a5('0x47')+_0x47a5('0x48')+_0x47a5('0x49')+_0x47a5('0x4a');var _0x350af8={'uri':_0xbec033+_0x47a5('0x4b')+_0x1224bc+_0x144aaa};io['to'](util[_0x47a5('0x4c')](_0x47a5('0x4d'),_0xdfcecc))[_0x47a5('0x4e')](_0x47a5('0x4f'),_0x350af8);}exports['cs']=function(_0x3edd17,_0x5a6161,_0x42dd7d,_0x284fb8,_0x30504e,_0x4b42f3,_0x37ac59,_0x2e46af){var _0x36c67={};var _0x26f1ac={'user':_0x4b42f3['username'],'pass':_0x4b42f3[_0x47a5('0x50')]};var _0x522ccf=_0x47a5('0x51');var _0x487e21=_0x47a5('0x52');_0x4b42f3['remoteUri']=intUtil[_0x47a5('0x53')](_0x4b42f3[_0x47a5('0x54')]);_0x4b42f3[_0x47a5('0x55')]=intUtil['stripTrailingSlash'](_0x4b42f3['serverUrl']);var _0x4b8084=util[_0x47a5('0x4c')](_0x47a5('0x56'),_0x4b42f3[_0x47a5('0x54')]);_0x36c67[_0x47a5('0x16')]=!_['isNil'](_0x284fb8)?_0x284fb8[_0x47a5('0x57')]:null;_0x36c67[_0x47a5('0x1e')]=_0x4b42f3[_0x47a5('0x57')];_0x36c67[_0x47a5('0x22')]=_0x2e46af[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x5a6161[_0x47a5('0x58')]:_0x5a6161[_0x47a5('0x59')];_0x36c67[_0x47a5('0x5a')]=_0x2e46af===_0x47a5('0x5b')||_0x2e46af===_0x47a5('0x5c')?_0x47a5('0x5b'):'outbound';var _0x1e3212=util['format'](_0x47a5('0x5d'),_0x4b42f3[_0x47a5('0x55')],_0x5a6161[_0x47a5('0x5e')],md5(_0x5a6161[_0x47a5('0x5e')]));if(_0x30504e&&_0x30504e[_0x47a5('0x5f')]){logger[_0x47a5('0x10')](_0x47a5('0x60'),_0x47a5('0x61'));_0x5a6161[_0x47a5('0x62')]=_0x1e3212;}else if(_0x37ac59&&_0x37ac59[_0x47a5('0x63')]&&_0x37ac59[_0x47a5('0x63')]!==_0x47a5('0x64')){logger[_0x47a5('0x10')](_0x47a5('0x65'),_0x47a5('0x61'));_0x5a6161['recordingURL']=_0x1e3212;}else{_0x5a6161['recordingURL']='';}return getAdminUser(_0x2e46af,_0x26f1ac,_0x36c67,_0x4b8084,_0x487e21,_0x522ccf)['then'](getUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))['then'](getEndUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))[_0x47a5('0x19')](getTicket(_0x2e46af,_0x26f1ac,_0x4b8084,_0x42dd7d,_0x5a6161,_0x487e21))[_0x47a5('0x19')](function(_0x5d6916){logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x66'),_0x5d6916[_0x47a5('0x3b')]));logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x67'),_0x2e46af));if(_0x2e46af!==_0x47a5('0x5c')){logger[_0x47a5('0x10')]('['+[_0x2e46af[_0x47a5('0x14')]()]+']',_0x47a5('0x68'));emit(_0x4b42f3['remoteUri'],_0x284fb8[_0x47a5('0x33')],_0x5d6916[_0x47a5('0x3b')]);}})[_0x47a5('0x12')](function(_0x4f35ff){logger[_0x47a5('0x13')]('['+[_0x2e46af[_0x47a5('0x14')]()]+_0x47a5('0x69'),util['inspect'](_0x4f35ff,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7a54=['getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','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','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x463b9a,_0x2a9eba){var _0x5f5186=function(_0xb1f6cc){while(--_0xb1f6cc){_0x463b9a['push'](_0x463b9a['shift']());}};_0x5f5186(++_0x2a9eba);}(_0x7a54,0x106));var _0x47a5=function(_0x44d2c6,_0x1a03c0){_0x44d2c6=_0x44d2c6-0x0;var _0x22b9c0=_0x7a54[_0x44d2c6];return _0x22b9c0;};'use strict';var _=require(_0x47a5('0x0'));var Promise=require(_0x47a5('0x1'));var rp=require(_0x47a5('0x2'));var util=require('util');var md5=require(_0x47a5('0x3'));var Redis=require(_0x47a5('0x4'));var intUtil=require('./util');var config=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));function getAdminUser(_0x30e405,_0x506eda,_0x194fb0,_0x5077f3,_0x5d90b3,_0x582352){return new Promise(function(_0x2a0e98,_0x2baee7){var _0x5e31dd={'method':_0x47a5('0xb'),'uri':_0x5077f3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5d90b3+'&'+_0x582352,'auth':_0x506eda,'json':!![]};return rp(_0x5e31dd)['then'](function(_0x1f47f4){if(_0x1f47f4[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x194fb0[_0x47a5('0xe')]=_0x1f47f4[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}logger[_0x47a5('0x10')]('['+[_0x30e405['toUpperCase']()]+_0x47a5('0x11'),_0x194fb0);_0x2a0e98(_0x194fb0);})[_0x47a5('0x12')](function(_0x1cf309){logger[_0x47a5('0x13')]('['+[_0x30e405[_0x47a5('0x14')]()]+']',_0x1cf309[_0x47a5('0x15')]);_0x2baee7(_0x1cf309[_0x47a5('0x15')]);});});}function getUser(_0x190faa,_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return function(_0x2a2cbb){logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x2a2cbb);return new Promise(function(_0x138bc0,_0x4b966e){if(intUtil['validateEmail'](_0x2a2cbb[_0x47a5('0x16')])){var _0xaf70a6={'method':_0x47a5('0xb'),'uri':_0x362359+_0x47a5('0x17')+_0x2a2cbb[_0x47a5('0x16')]+'&'+_0x11faf5+'&'+_0x3b001e,'auth':_0x4e99a8,'json':!![]};logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x18'),_0xaf70a6);return rp(_0xaf70a6)[_0x47a5('0x19')](function(_0x4a9fcb){logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+'],\x20getUser\x20entity',_0x4a9fcb);if(_0x4a9fcb[_0x47a5('0xc')][_0x47a5('0xd')]>0x0&&String(_0x4a9fcb[_0x47a5('0xc')][0x0]['active'])===_0x47a5('0x1a')){_0x2a2cbb[_0x47a5('0x1b')]=_0x4a9fcb[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}else{_0x2a2cbb['userId']=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb['adminEmail'];}logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x1c'),_0x2a2cbb);_0x138bc0(_0x2a2cbb);})[_0x47a5('0x12')](function(_0x3abd6a){logger['error']('['+[_0x190faa['toUpperCase']()]+']',_0x3abd6a[_0x47a5('0x15')]);_0x4b966e(_0x3abd6a['message']);});}else{logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+_0x47a5('0x1d'));_0x2a2cbb[_0x47a5('0x1b')]=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb[_0x47a5('0x1e')];_0x138bc0(_0x2a2cbb);}});};}function createEndUser(_0x3ba0b7,_0x24b162,_0x136b14,_0x16631f,_0x361bfa){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+_0x47a5('0x1f'),_0x136b14);return new Promise(function(_0x528582,_0x243210){var _0x51833b={'method':_0x47a5('0x20'),'uri':_0x16631f+_0x47a5('0x21')+_0x361bfa,'body':{'user_name':_0x136b14[_0x47a5('0x22')],'roles':'user','first_name':_0x136b14[_0x47a5('0x22')],'active':_0x47a5('0x1a'),'date_format':_0x47a5('0x23'),'phone':_0x136b14[_0x47a5('0x22')]},'auth':_0x24b162,'json':!![]};return rp(_0x51833b)['then'](function(_0x50d875){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+'],\x20EndUser\x20schema',_0x50d875['result']);_0x136b14[_0x47a5('0x24')]=_0x50d875[_0x47a5('0xc')]['sys_id'];_0x528582(_0x136b14);})[_0x47a5('0x12')](function(_0x53119b){logger[_0x47a5('0x13')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+']',_0x53119b['message']);_0x243210(_0x53119b['message']);});});}function getEndUser(_0x274e34,_0x5910bb,_0x403028,_0x87e4c9,_0xf269a8){return function(_0x52749b){logger[_0x47a5('0x10')]('['+[_0x274e34['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x52749b);return new Promise(function(_0x65542e,_0x5a8a7c){var _0x25cce0={'method':'GET','uri':_0x403028+_0x47a5('0x25')+_0x52749b[_0x47a5('0x22')]+'&'+_0x87e4c9+'&'+_0xf269a8,'auth':_0x5910bb,'json':!![]};return rp(_0x25cce0)[_0x47a5('0x19')](function(_0x199698){if(_0x199698[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x52749b[_0x47a5('0x24')]=_0x199698[_0x47a5('0xc')][0x0][_0x47a5('0xf')];logger['info']('['+[_0x274e34[_0x47a5('0x14')]()]+_0x47a5('0x26'),_0x52749b);_0x65542e(_0x52749b);}else{return createEndUser(_0x274e34,_0x5910bb,_0x52749b,_0x403028,_0x87e4c9)['then'](function(_0x2c50d6){logger[_0x47a5('0x10')]('['+[_0x274e34[_0x47a5('0x14')]()]+'],\x20createEndUser\x20crm',_0x2c50d6);_0x65542e(_0x2c50d6);});}})[_0x47a5('0x12')](function(_0x10f660){logger['error']('['+[_0x274e34[_0x47a5('0x14')]()]+']',_0x10f660[_0x47a5('0x15')]);_0x5a8a7c(_0x10f660['message']);});});};}function getCustomFields(_0x55c5eb,_0x5ebd8c){var _0x12d9f2={};if(_0x55c5eb['length']>0x0){_[_0x47a5('0x27')](_0x55c5eb,function(_0x1f9631){if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2a')]&&!_0x1f9631[_0x47a5('0x2b')]){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2c')]&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631['type']===_0x47a5('0x30')&&_0x1f9631['variableName']&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631['idField'][_0x47a5('0x2d')]()]=_0x5ebd8c[_0x1f9631['variableName']][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x31')&&_0x1f9631['Variable']&&_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')]&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')]['toLowerCase']()]=_0x5ebd8c[_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')][_0x47a5('0x2d')]()][_0x47a5('0x2f')]();}});}return _0x12d9f2;}function getTicket(_0x34a9ae,_0xf0edbb,_0x434227,_0x17cc42,_0xac9c15,_0x162fa0){return function(_0x24ecb1){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+_0x47a5('0x34'),_0x24ecb1);return new Promise(function(_0x4e5e7,_0x3a2b38){var _0x512e65=_0x34a9ae[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x24ecb1['userId']:_0x24ecb1['endUserId'];var _0x3d0a88={'method':'POST','uri':_0x434227+_0x47a5('0x36')+'?'+_0x162fa0,'body':Object[_0x47a5('0x37')]({},{'active':'true','caller_id':_0x512e65,'assigned_to':_0x24ecb1['userId'],'short_description':intUtil[_0x47a5('0x38')](_0x17cc42['Subjects'],_0xac9c15,'\x20'),'description':intUtil[_0x47a5('0x38')](_0x17cc42[_0x47a5('0x39')],_0xac9c15,'\x0a')},getCustomFields(_0x17cc42[_0x47a5('0x3a')],_0xac9c15)),'auth':_0xf0edbb,'json':!![]};return rp(_0x3d0a88)[_0x47a5('0x19')](function(_0x44fe8a){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x44fe8a['result']);_0x24ecb1[_0x47a5('0x3b')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0xf')];_0x24ecb1[_0x47a5('0x3c')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0x3d')];logger[_0x47a5('0x10')]('['+[_0x34a9ae['toUpperCase']()]+_0x47a5('0x3e'),_0x24ecb1);_0x4e5e7(_0x24ecb1);})[_0x47a5('0x12')](function(_0x5f6a){logger['error']('['+[_0x34a9ae[_0x47a5('0x14')]()]+']',_0x5f6a['message']);_0x3a2b38(_0x5f6a[_0x47a5('0x15')]);});});};}function createRemoteTag(_0xe31817,_0x46e90b,_0xf03bd5,_0x588551){return new Promise(function(_0x3adf14,_0x1e6de3){var _0x2f66e9={'method':_0x47a5('0x20'),'uri':_0xf03bd5+_0x47a5('0x3f')+'?'+_0x588551,'body':{'short_description':_0xe31817,'global':!![],'active':!![],'name':_0xe31817},'auth':_0x46e90b,'json':!![]};return rp(_0x2f66e9)[_0x47a5('0x19')](function(_0x24e9f4){var _0x481089=_0x24e9f4[_0x47a5('0xc')][_0x47a5('0xf')];_0x3adf14(_0x481089);});});}function getRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf,_0x572233){return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581={'method':'GET','uri':_0x3329aa+_0x47a5('0x3f')+_0x47a5('0x40')+_0x187d7e+'&'+_0x1ab0bf,'auth':_0x8da9fb,'json':!![]};return rp(_0x1aa581)[_0x47a5('0x19')](function(_0x5d8d4a){if(_0x5d8d4a['result'][_0x47a5('0xd')]>0x0){var _0x376e1d=_0x5d8d4a['result'][0x0]['sys_id'];_0x1ad6a9(_0x376e1d);}else{return createRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf)[_0x47a5('0x19')](function(_0x4d6a82){_0x1ad6a9(_0x4d6a82);});}});});}function assignTagToIncident(_0x16bb8a,_0x5d383d,_0x482de6,_0x389ed9,_0x46d2d3){return new Promise(function(_0x53eedf,_0x1b958b){var _0x72fe={'method':'POST','uri':_0x482de6+'label_entry'+'?'+_0x46d2d3,'body':{'label':_0x16bb8a,'table':_0x47a5('0x36'),'id_type':_0x47a5('0x41'),'table_key':_0x389ed9[_0x47a5('0x3b')],'title':_0x47a5('0x42')+_0x389ed9['ticketNumber'],'id_display':_0x389ed9[_0x47a5('0x3c')]},'auth':_0x5d383d,'json':!![]};return rp(_0x72fe)[_0x47a5('0x19')](function(_0x1af800){_0x53eedf();})['catch'](function(){_0x53eedf();});});}function manageTags(_0x30ea7a,_0x4db625,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b,_0x3603b7){return new Promise(function(_0x4966af,_0x144af9){var _0x5d1550=[];_0x4db625['forEach'](function(_0x5eb150){_0x5d1550['push'](getRemoteTag(_0x5eb150,_0x485e3c,_0x470da6,_0x1c485b,_0x3603b7));});return Promise[_0x47a5('0x43')](_0x5d1550)[_0x47a5('0x19')](function(_0x1e2bb4){if(_0x1e2bb4['length']){logger['info']('['+[_0x30ea7a[_0x47a5('0x14')]()]+_0x47a5('0x44'),_0x1e2bb4);var _0x45d4b6=[];_0x1e2bb4[_0x47a5('0x27')](function(_0xc45e25){_0x45d4b6['push'](assignTagToIncident(_0xc45e25,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b));});return Promise[_0x47a5('0x43')](_0x45d4b6)['then'](function(){_0x4966af();})[_0x47a5('0x12')](function(){_0x4966af();});}else{_0x4966af();}});});}function getTags(_0x274d31,_0x4d545f,_0x32b4de,_0x345104,_0x132854,_0x3e8274){return function(_0x2d6494){return new Promise(function(_0x215634,_0x35cca8){var _0x3ac38c=[];var _0x57ed0a=_0x345104[_0x47a5('0x45')];if(_0x57ed0a&&_0x57ed0a[_0x47a5('0xd')]>0x0){_0x3ac38c=_[_0x47a5('0x46')](_0x57ed0a,_0x47a5('0x33'));}if(_0x3ac38c[_0x47a5('0xd')]>0x0){return manageTags(_0x274d31,_0x3ac38c,_0x4d545f,_0x32b4de,_0x2d6494,_0x132854,_0x3e8274)['then'](function(){_0x215634(_0x2d6494);});}else{_0x215634(_0x2d6494);}});};}function emit(_0xbec033,_0xdfcecc,_0x1224bc){var _0x144aaa=_0x47a5('0x47')+_0x47a5('0x48')+_0x47a5('0x49')+_0x47a5('0x4a');var _0x350af8={'uri':_0xbec033+_0x47a5('0x4b')+_0x1224bc+_0x144aaa};io['to'](util[_0x47a5('0x4c')](_0x47a5('0x4d'),_0xdfcecc))[_0x47a5('0x4e')](_0x47a5('0x4f'),_0x350af8);}exports['cs']=function(_0x3edd17,_0x5a6161,_0x42dd7d,_0x284fb8,_0x30504e,_0x4b42f3,_0x37ac59,_0x2e46af){var _0x36c67={};var _0x26f1ac={'user':_0x4b42f3['username'],'pass':_0x4b42f3[_0x47a5('0x50')]};var _0x522ccf=_0x47a5('0x51');var _0x487e21=_0x47a5('0x52');_0x4b42f3['remoteUri']=intUtil[_0x47a5('0x53')](_0x4b42f3[_0x47a5('0x54')]);_0x4b42f3[_0x47a5('0x55')]=intUtil['stripTrailingSlash'](_0x4b42f3['serverUrl']);var _0x4b8084=util[_0x47a5('0x4c')](_0x47a5('0x56'),_0x4b42f3[_0x47a5('0x54')]);_0x36c67[_0x47a5('0x16')]=!_['isNil'](_0x284fb8)?_0x284fb8[_0x47a5('0x57')]:null;_0x36c67[_0x47a5('0x1e')]=_0x4b42f3[_0x47a5('0x57')];_0x36c67[_0x47a5('0x22')]=_0x2e46af[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x5a6161[_0x47a5('0x58')]:_0x5a6161[_0x47a5('0x59')];_0x36c67[_0x47a5('0x5a')]=_0x2e46af===_0x47a5('0x5b')||_0x2e46af===_0x47a5('0x5c')?_0x47a5('0x5b'):'outbound';var _0x1e3212=util['format'](_0x47a5('0x5d'),_0x4b42f3[_0x47a5('0x55')],_0x5a6161[_0x47a5('0x5e')],md5(_0x5a6161[_0x47a5('0x5e')]));if(_0x30504e&&_0x30504e[_0x47a5('0x5f')]){logger[_0x47a5('0x10')](_0x47a5('0x60'),_0x47a5('0x61'));_0x5a6161[_0x47a5('0x62')]=_0x1e3212;}else if(_0x37ac59&&_0x37ac59[_0x47a5('0x63')]&&_0x37ac59[_0x47a5('0x63')]!==_0x47a5('0x64')){logger[_0x47a5('0x10')](_0x47a5('0x65'),_0x47a5('0x61'));_0x5a6161['recordingURL']=_0x1e3212;}else{_0x5a6161['recordingURL']='';}return getAdminUser(_0x2e46af,_0x26f1ac,_0x36c67,_0x4b8084,_0x487e21,_0x522ccf)['then'](getUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))['then'](getEndUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))[_0x47a5('0x19')](getTicket(_0x2e46af,_0x26f1ac,_0x4b8084,_0x42dd7d,_0x5a6161,_0x487e21))[_0x47a5('0x19')](function(_0x5d6916){logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x66'),_0x5d6916[_0x47a5('0x3b')]));logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x67'),_0x2e46af));if(_0x2e46af!==_0x47a5('0x5c')){logger[_0x47a5('0x10')]('['+[_0x2e46af[_0x47a5('0x14')]()]+']',_0x47a5('0x68'));emit(_0x4b42f3['remoteUri'],_0x284fb8[_0x47a5('0x33')],_0x5d6916[_0x47a5('0x3b')]);}})[_0x47a5('0x12')](function(_0x4f35ff){logger[_0x47a5('0x13')]('['+[_0x2e46af[_0x47a5('0x14')]()]+_0x47a5('0x69'),util['inspect'](_0x4f35ff,{'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 cdb951b..4bbdf76 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 _0x71ab=['duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','format','toString','get_server_info','stringify','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','string','custom_fields','content','variable','customVariable','Variable','login','username','password','set_relationship','Calls','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','calleridname','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','description','toISOString','slice','replace'];(function(_0x20b9d1,_0x38d717){var _0x20efaa=function(_0x570147){while(--_0x570147){_0x20b9d1['push'](_0x20b9d1['shift']());}};_0x20efaa(++_0x38d717);}(_0x71ab,0x64));var _0xb71a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x71ab[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var rp=require(_0xb71a('0x0'));var BPromise=require('bluebird');var md5=require(_0xb71a('0x1'));var util=require('util');var Redis=require(_0xb71a('0x2'));var intUtil=require(_0xb71a('0x3'));var config=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));config[_0xb71a('0x7')]=_[_0xb71a('0x8')](config[_0xb71a('0x7')],{'host':_0xb71a('0x9'),'port':0x18eb});var io=require(_0xb71a('0xa'))(new Redis(config[_0xb71a('0x7')]));var def={'method':_0xb71a('0xb'),'json':!![]};function emit(_0x43ca14,_0x471ab6,_0x18c7a6){io['to'](_0x43ca14)[_0xb71a('0xc')](_0x471ab6,_0x18c7a6);}function getTicket(_0x378c96,_0x2e8883,_0x517eed,_0xfec897,_0x58956d,_0x3d7bd7,_0x343d2f,_0x24f5fd){logger['info'](_0xb71a('0xd'));var _0x4c167a=new Date();var _0x2a2d75=[{'name':'name','value':intUtil['getString'](_0xfec897[_0xb71a('0xe')],_0x58956d,'\x20')},{'name':_0xb71a('0xf'),'value':_0x2e8883['id']},{'name':_0xb71a('0x10'),'value':_0x2e8883['id']},{'name':_0xb71a('0x11'),'value':intUtil['getString'](_0xfec897['Descriptions'],_0x58956d,'\x0a')},{'name':'date_start','value':_0x4c167a[_0xb71a('0x12')]()[_0xb71a('0x13')](0x0,0x13)[_0xb71a('0x14')]('T','\x20')},{'name':_0xb71a('0x15'),'value':'0'},{'name':_0xb71a('0x16'),'value':'15'},{'name':_0xb71a('0x17'),'value':_0x517eed['id']},{'name':_0xb71a('0x18'),'value':_0xb71a('0x19')},{'name':_0xb71a('0x1a'),'value':_0x517eed['name']},{'name':_0xb71a('0x1b'),'value':_0x24f5fd}];if(_0x3d7bd7[_0xb71a('0x1c')]){_[_0xb71a('0x1d')](_0x3d7bd7,function(_0x346524){if(_0x58956d[_0x346524[_0xb71a('0x1e')]]){_0x2a2d75[_0xb71a('0x1f')]({'name':_0x346524[_0xb71a('0x20')],'value':_0x58956d[_0x346524[_0xb71a('0x1e')]]});}});}return request({'form':{'method':_0xb71a('0x21'),'input_type':_0xb71a('0x22'),'response_type':_0xb71a('0x22'),'rest_data':JSON['stringify']({'session':_0x343d2f['id'],'module_name':'Calls','name_value_list':_0x2a2d75})}});}function getAuth(_0x1358f2){return util[_0xb71a('0x23')]('Basic\x20%s',new Buffer(_0x1358f2['apiKey']+':X')[_0xb71a('0x24')]('base64'));}function getServerInfo(_0x76d6dc){return request({'form':{'method':_0xb71a('0x25'),'input_type':_0xb71a('0x22'),'response_type':_0xb71a('0x22'),'rest_data':JSON[_0xb71a('0x26')]({'session':_0x76d6dc['id']})}});}function getUser(_0x14b2a1,_0x2f4fac,_0x14aac7){if(!_['isNil'](_0x2f4fac)){logger[_0xb71a('0x27')](_0xb71a('0x28'),_0x2f4fac);return request({'form':{'method':_0xb71a('0x29'),'input_type':_0xb71a('0x22'),'response_type':_0xb71a('0x22'),'rest_data':JSON[_0xb71a('0x26')]({'session':_0x14aac7['id'],'module_name':_0xb71a('0x2a'),'query':util[_0xb71a('0x23')](_0xb71a('0x2b'),_0x2f4fac),'order_by':'','offset':'0','select_fields':['id',_0xb71a('0x2c'),_0xb71a('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb71a('0x2e')](function(_0x160f0f){if(_0x160f0f['entry_list'][_0xb71a('0x1c')]){var _0x39d874=_[_0xb71a('0x2f')](_0x160f0f[_0xb71a('0x30')],function(_0x2fbd73){return _0x2fbd73[_0xb71a('0x31')][_0xb71a('0x2d')][_0xb71a('0x32')]===_0x2f4fac;});if(_0x39d874){logger[_0xb71a('0x27')](_0xb71a('0x33'));return BPromise[_0xb71a('0x34')]({'id':_0x39d874['name_value_list']['id']['value'],'name':_0x39d874[_0xb71a('0x31')]['name'][_0xb71a('0x32')]});}}logger[_0xb71a('0x27')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb71a('0x34')]({'id':_0x14aac7[_0xb71a('0x31')][_0xb71a('0x35')][_0xb71a('0x32')],'name':_0x14aac7[_0xb71a('0x31')][_0xb71a('0x2d')]['value']});});}else{logger[_0xb71a('0x27')](_0xb71a('0x36'));return BPromise[_0xb71a('0x34')]({'id':_0x14aac7[_0xb71a('0x31')]['user_id'][_0xb71a('0x32')],'name':_0x14aac7[_0xb71a('0x31')][_0xb71a('0x2d')][_0xb71a('0x32')]});}}function getEndUser(_0x1ec701,_0x3d93fc,_0x2962a0,_0x333280){logger[_0xb71a('0x27')](_0xb71a('0x37'),_0x2962a0);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xb71a('0x22'),'rest_data':JSON[_0xb71a('0x26')]({'session':_0x333280['id'],'module_name':_0xb71a('0x19'),'query':util[_0xb71a('0x23')](_0xb71a('0x38'),_0x2962a0),'order_by':'','offset':'0','select_fields':['id',_0xb71a('0x2c'),_0xb71a('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x990c82){if(_0x990c82['entry_list'][_0xb71a('0x1c')]){var _0xaebdc3=_[_0xb71a('0x2f')](_0x990c82[_0xb71a('0x30')],function(_0x5f54d8){return _0x5f54d8[_0xb71a('0x31')][_0xb71a('0x39')][_0xb71a('0x32')]===_0x2962a0;});if(_0xaebdc3){logger[_0xb71a('0x27')](_0xb71a('0x3a'));return BPromise[_0xb71a('0x34')]({'id':_0xaebdc3[_0xb71a('0x31')]['id'][_0xb71a('0x32')],'name':_0xaebdc3[_0xb71a('0x31')]['name'][_0xb71a('0x32')],'phone':_0xaebdc3['name_value_list'][_0xb71a('0x39')][_0xb71a('0x32')]});}}else{logger[_0xb71a('0x27')](_0xb71a('0x3b'));return request({'form':{'method':_0xb71a('0x21'),'input_type':_0xb71a('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x333280['id'],'module_name':'Contacts','name_value_list':[{'name':_0xb71a('0x3c'),'value':_0x3d93fc!==''?_0x3d93fc:util[_0xb71a('0x23')](_0xb71a('0x3d'),_0x2962a0)},{'name':_0xb71a('0x39'),'value':_0x2962a0}]})}})[_0xb71a('0x2e')](function(_0x1cb355){logger[_0xb71a('0x27')]('Enduser\x20created.');return BPromise[_0xb71a('0x34')]({'id':_0x1cb355['id'],'name':_0x1cb355[_0xb71a('0x30')][_0xb71a('0x3c')][_0xb71a('0x32')],'phone':_0x1cb355[_0xb71a('0x30')][_0xb71a('0x39')]['value']});});}});}function request(_0x2afff3){logger[_0xb71a('0x3e')](_0xb71a('0x3f'),JSON[_0xb71a('0x26')](_0x2afff3));return rp(_[_0xb71a('0x40')](def,_0x2afff3));}function getTags(_0x8f97ff,_0x1d1c38){var _0x48baae=[];if(_0x8f97ff&&_0x8f97ff['length']>0x0){_0x48baae=_[_0xb71a('0x41')](_0x8f97ff,_0x1d1c38);}return _0x48baae;}function getCustomFields(_0x458032,_0x2f6b72){var _0x273964=[];var _0x4a763c={'custom_fields':[]};if(_0x458032[_0xb71a('0x1c')]>0x0){_['forEach'](_0x458032,function(_0x318d0e){if(_0x318d0e[_0xb71a('0x42')]==='string'&&_0x318d0e[_0xb71a('0x43')]&&!_0x318d0e[_0xb71a('0x44')]){_0x4a763c[_0x318d0e[_0xb71a('0x43')][_0xb71a('0x45')]()]=_0x318d0e['content'][_0xb71a('0x24')]();}else if(_0x318d0e[_0xb71a('0x42')]===_0xb71a('0x46')&&_0x318d0e['idField']&&_0x318d0e[_0xb71a('0x44')]){_0x4a763c[_0xb71a('0x47')][_0xb71a('0x1f')]({'id':_0x318d0e['idField'],'value':_0x318d0e[_0xb71a('0x48')][_0xb71a('0x24')]()});}else if(_0x318d0e[_0xb71a('0x42')]===_0xb71a('0x49')&&_0x318d0e[_0xb71a('0x1e')]&&_0x318d0e['idField']&&_0x318d0e[_0xb71a('0x44')]){_0x2f6b72[_0x318d0e[_0xb71a('0x1e')]]&&_0x4a763c[_0xb71a('0x47')][_0xb71a('0x1f')]({'id':_0x318d0e['idField'],'value':_0x2f6b72[_0x318d0e['variableName']][_0xb71a('0x24')]()});}else if(_0x318d0e[_0xb71a('0x42')]===_0xb71a('0x4a')&&_0x318d0e[_0xb71a('0x4b')]&&_0x318d0e[_0xb71a('0x4b')][_0xb71a('0x2c')]&&_0x318d0e[_0xb71a('0x20')]&&_0x318d0e[_0xb71a('0x44')]){_0x2f6b72[_0x318d0e[_0xb71a('0x4b')][_0xb71a('0x2c')]['toLowerCase']()]&&_0x4a763c[_0xb71a('0x47')][_0xb71a('0x1f')]({'id':_0x318d0e['idField'],'value':_0x2f6b72[_0x318d0e[_0xb71a('0x4b')]['name'][_0xb71a('0x45')]()][_0xb71a('0x24')]()});}});}return _0x4a763c;}function getConnection(_0xa18c6e){return request({'method':_0xb71a('0xb'),'form':{'method':_0xb71a('0x4c'),'input_type':'JSON','response_type':_0xb71a('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xa18c6e[_0xb71a('0x4d')],'password':_0xa18c6e[_0xb71a('0x4e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xb71a('0x2e')](function(_0x19972a){var _0x4ef963=_0x19972a;if(_0x4ef963['id']){def['sessionID']=_0x4ef963['id'];return BPromise['resolve'](_0x4ef963);}else{throw new Error(util[_0xb71a('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0xa18c6e['id']));}});}function setRelationship(_0x59d583,_0x333ed0,_0x536fad,_0xf029f7){return request({'form':{'method':_0xb71a('0x4f'),'input_type':'JSON','response_type':_0xb71a('0x22'),'rest_data':JSON[_0xb71a('0x26')]({'session':_0x59d583['id'],'module_name':_0xb71a('0x50'),'module_id':_0x536fad['id'],'link_field_name':_0xf029f7,'related_ids':[_0x333ed0['id']]})}});}exports['queue']=function(_0x2ac617,_0x7de9e6,_0x4dee60,_0x2d14f0,_0x3eb2d7,_0x31d79e){var _0x531d75,_0x43c310,_0x51112b,_0x2af7f0;_0x31d79e[_0xb71a('0x51')]=intUtil['stripTrailingSlash'](_0x31d79e[_0xb71a('0x51')]);_0x31d79e[_0xb71a('0x52')]=intUtil[_0xb71a('0x53')](_0x31d79e[_0xb71a('0x52')]);def[_0xb71a('0x54')]=util[_0xb71a('0x23')](_0xb71a('0x55'),_0x31d79e['remoteUri']);if(_0x3eb2d7&&_0x3eb2d7['monitor_format']){logger[_0xb71a('0x27')](_0xb71a('0x56'),_0xb71a('0x57'));_0x7de9e6[_0xb71a('0x58')]=util[_0xb71a('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31d79e['serverUrl'],_0x7de9e6[_0xb71a('0x59')],md5(_0x7de9e6[_0xb71a('0x59')]));}else{_0x7de9e6['recordingURL']='';}return getConnection(_0x31d79e)[_0xb71a('0x2e')](function(_0x233e77){_0x2af7f0=_0x233e77;return getUser(_0x31d79e,_0x2d14f0['name'],_0x2af7f0);})[_0xb71a('0x2e')](function(_0xe55672){_0x531d75=_0xe55672;logger[_0xb71a('0x27')](_0xb71a('0x5a'),_0x531d75['id']);return getEndUser(_0x31d79e,_0x7de9e6['calleridname'],_0x7de9e6[_0xb71a('0x5b')],_0x2af7f0);})[_0xb71a('0x2e')](function(_0x4c80f8){_0x43c310=_0x4c80f8;logger[_0xb71a('0x27')](_0xb71a('0x5c'),_0x43c310['id']);return getTicket(_0x31d79e,_0x531d75,_0x43c310,_0x4dee60,_0x7de9e6,_0x4dee60[_0xb71a('0x5d')],_0x2af7f0,_0xb71a('0x5e'));})[_0xb71a('0x2e')](function(_0x1c4a15){_0x51112b=_0x1c4a15;logger[_0xb71a('0x27')](_0xb71a('0x5f'));logger['info'](_0xb71a('0x60'),_0x51112b['id']);return setRelationship(_0x2af7f0,_0x531d75,_0x51112b,_0xb71a('0x61'));})['then'](function(){return setRelationship(_0x2af7f0,_0x43c310,_0x51112b,_0xb71a('0x62'));})[_0xb71a('0x2e')](function(){return getServerInfo(_0x2af7f0);})['then'](function(_0x2d3035){var _0x220749=parseInt(_0x2d3035[_0xb71a('0x63')][_0xb71a('0x64')](0x0));var _0x23f870=util[_0xb71a('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x31d79e['remoteUri'],_0x51112b['id']);if(_0x220749>0x6){_0x23f870=util[_0xb71a('0x23')](_0xb71a('0x65'),_0x31d79e[_0xb71a('0x51')],_0x51112b['id']);}logger['info'](_0xb71a('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb71a('0x23')]('user:%s',_0x2d14f0['name']),_0xb71a('0x66'),{'uri':_0x23f870});})[_0xb71a('0x67')](function(_0x399e52){logger[_0xb71a('0x68')](_0xb71a('0x56'),JSON['stringify'](_0x399e52));});};exports[_0xb71a('0x69')]=function(_0x58e746,_0x1adf18,_0x312e46,_0x41f5fe,_0x485fd2,_0x4d9dc8,_0x3e7bf7){var _0x39ee35,_0x1a96fc,_0x3e2c72,_0x9eff28;_0x4d9dc8['remoteUri']=intUtil[_0xb71a('0x53')](_0x4d9dc8[_0xb71a('0x51')]);_0x4d9dc8[_0xb71a('0x52')]=intUtil[_0xb71a('0x53')](_0x4d9dc8[_0xb71a('0x52')]);def['uri']=util['format'](_0xb71a('0x55'),_0x4d9dc8[_0xb71a('0x51')]);if(_0x3e7bf7&&_0x3e7bf7[_0xb71a('0x6a')]&&_0x3e7bf7[_0xb71a('0x6a')]!==_0xb71a('0x6b')){logger[_0xb71a('0x27')](_0xb71a('0x6c'),'Recording\x20is\x20enabled!');_0x1adf18[_0xb71a('0x58')]=util[_0xb71a('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d9dc8[_0xb71a('0x52')],_0x1adf18[_0xb71a('0x59')],md5(_0x1adf18[_0xb71a('0x59')]));}return getConnection(_0x4d9dc8)['then'](function(_0x6d255e){_0x9eff28=_0x6d255e;return getUser(_0x4d9dc8,_0x41f5fe[_0xb71a('0x2c')],_0x9eff28);})[_0xb71a('0x2e')](function(_0x5cf30d){_0x39ee35=_0x5cf30d;logger[_0xb71a('0x27')](_0xb71a('0x5a'),_0x39ee35['id']);return getEndUser(_0x4d9dc8,_0x1adf18[_0xb71a('0x6d')],_0x1adf18[_0xb71a('0x6e')],_0x9eff28);})[_0xb71a('0x2e')](function(_0x374588){_0x1a96fc=_0x374588;logger[_0xb71a('0x27')](_0xb71a('0x5c'),_0x1a96fc['id']);return getTicket(_0x4d9dc8,_0x39ee35,_0x1a96fc,_0x312e46,_0x1adf18,_0x312e46['Fields'],_0x9eff28,_0xb71a('0x6f'));})[_0xb71a('0x2e')](function(_0x57896d){_0x3e2c72=_0x57896d;logger[_0xb71a('0x27')](_0xb71a('0x5f'));logger[_0xb71a('0x27')](_0xb71a('0x60'),_0x3e2c72['id']);return setRelationship(_0x9eff28,_0x39ee35,_0x3e2c72,'users');})[_0xb71a('0x2e')](function(){return setRelationship(_0x9eff28,_0x1a96fc,_0x3e2c72,'contacts');})[_0xb71a('0x2e')](function(){return getServerInfo(_0x9eff28);})[_0xb71a('0x2e')](function(_0x5e9964){var _0x2aaaa1=parseInt(_0x5e9964['version'][_0xb71a('0x64')](0x0));var _0x48ca02=util[_0xb71a('0x23')](_0xb71a('0x70'),_0x4d9dc8[_0xb71a('0x51')],_0x3e2c72['id']);if(_0x2aaaa1>0x6){_0x48ca02=util[_0xb71a('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4d9dc8[_0xb71a('0x51')],_0x3e2c72['id']);}logger[_0xb71a('0x27')]('[OUTBOUND]',_0xb71a('0x71'));emit(util['format']('user:%s',_0x41f5fe['name']),'trigger:browser:url',{'uri':_0x48ca02});})[_0xb71a('0x67')](function(_0x1e27ff){logger[_0xb71a('0x68')]('[OUTBOUND]',JSON[_0xb71a('0x26')](_0x1e27ff));});};exports[_0xb71a('0x72')]=function(_0x58ed5f,_0x299349,_0x3a3db7,_0x1806b8,_0x33c7d5,_0x3209d3){var _0x16fbc1,_0x537d00,_0x456350,_0x2772f8;_0x3209d3[_0xb71a('0x51')]=intUtil[_0xb71a('0x53')](_0x3209d3[_0xb71a('0x51')]);_0x3209d3[_0xb71a('0x52')]=intUtil['stripTrailingSlash'](_0x3209d3[_0xb71a('0x52')]);def[_0xb71a('0x54')]=util['format'](_0xb71a('0x55'),_0x3209d3[_0xb71a('0x51')]);if(_0x33c7d5&&_0x33c7d5[_0xb71a('0x73')]){logger['info']('['+_0x299349[_0xb71a('0x74')][_0xb71a('0x75')]()+']',_0xb71a('0x57'));_0x299349['recordingURL']=util[_0xb71a('0x23')](_0xb71a('0x76'),_0x3209d3['serverUrl'],_0x299349[_0xb71a('0x59')],md5(_0x299349[_0xb71a('0x59')]));}else{_0x299349[_0xb71a('0x58')]='';}return getConnection(_0x3209d3)[_0xb71a('0x2e')](function(_0x4abfd6){_0x2772f8=_0x4abfd6;if(!_[_0xb71a('0x77')](_0x1806b8)){return getUser(_0x3209d3,_0x1806b8[_0xb71a('0x2c')],_0x2772f8);}else{return getUser(_0x3209d3,null,_0x2772f8);}})[_0xb71a('0x2e')](function(_0x68e358){_0x16fbc1=_0x68e358;logger['info'](_0xb71a('0x5a'),_0x16fbc1['id']);return getEndUser(_0x3209d3,_0x299349[_0xb71a('0x78')],_0x299349['calleridnum'],_0x2772f8);})[_0xb71a('0x2e')](function(_0x32ebde){_0x537d00=_0x32ebde;logger['info'](_0xb71a('0x5c'),_0x537d00['id']);return getTicket(_0x3209d3,_0x16fbc1,_0x537d00,_0x3a3db7,_0x299349,_0x3a3db7[_0xb71a('0x5d')],_0x2772f8,_0xb71a('0x5e'));})['then'](function(_0x2dff0d){_0x456350=_0x2dff0d;logger[_0xb71a('0x27')](_0xb71a('0x5f'));logger[_0xb71a('0x27')](_0xb71a('0x60'),_0x456350['id']);return setRelationship(_0x2772f8,_0x16fbc1,_0x456350,_0xb71a('0x61'));})[_0xb71a('0x2e')](function(){return setRelationship(_0x2772f8,_0x537d00,_0x456350,_0xb71a('0x62'));})[_0xb71a('0x2e')](function(){return getServerInfo(_0x2772f8);})['catch'](function(_0x5b9667){logger[_0xb71a('0x68')]('['+_0x299349[_0xb71a('0x74')][_0xb71a('0x75')]()+']',JSON[_0xb71a('0x26')](_0x5b9667));});}; \ No newline at end of file +var _0xbb61=['find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','map','type','string','nameField','content','toString','customField','push','variable','customVariable','Variable','toLowerCase','custom_fields','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','uri','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','Fields','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','error','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','POST','emit','name','getString','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','value','info','Agent\x20found!','name_value_list','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then'];(function(_0x4d89d6,_0xcfb45e){var _0x342a9f=function(_0x386d04){while(--_0x386d04){_0x4d89d6['push'](_0x4d89d6['shift']());}};_0x342a9f(++_0xcfb45e);}(_0xbb61,0x131));var _0x1bb6=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xbb61[_0x5b7788];return _0x573871;};'use strict';var _=require(_0x1bb6('0x0'));var rp=require('request-promise');var BPromise=require(_0x1bb6('0x1'));var md5=require(_0x1bb6('0x2'));var util=require(_0x1bb6('0x3'));var Redis=require(_0x1bb6('0x4'));var intUtil=require(_0x1bb6('0x5'));var config=require(_0x1bb6('0x6'));var logger=require(_0x1bb6('0x7'))('sugarcrm');config[_0x1bb6('0x8')]=_[_0x1bb6('0x9')](config[_0x1bb6('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x1bb6('0xa'))(new Redis(config[_0x1bb6('0x8')]));var def={'method':_0x1bb6('0xb'),'json':!![]};function emit(_0x59a152,_0x13e2da,_0xf43d0d){io['to'](_0x59a152)[_0x1bb6('0xc')](_0x13e2da,_0xf43d0d);}function getTicket(_0xe56199,_0x1a18bf,_0x359a49,_0x5c8d00,_0xe24210,_0x29ee41,_0x59b1b8,_0x14bf4e){logger['info']('Creating\x20new\x20ticket...');var _0x4fe740=new Date();var _0x4fe936=[{'name':_0x1bb6('0xd'),'value':intUtil[_0x1bb6('0xe')](_0x5c8d00['Subjects'],_0xe24210,'\x20')},{'name':'assigned_user_id','value':_0x1a18bf['id']},{'name':_0x1bb6('0xf'),'value':_0x1a18bf['id']},{'name':_0x1bb6('0x10'),'value':intUtil[_0x1bb6('0xe')](_0x5c8d00[_0x1bb6('0x11')],_0xe24210,'\x0a')},{'name':_0x1bb6('0x12'),'value':_0x4fe740[_0x1bb6('0x13')]()[_0x1bb6('0x14')](0x0,0x13)[_0x1bb6('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x1bb6('0x16'),'value':'15'},{'name':_0x1bb6('0x17'),'value':_0x359a49['id']},{'name':_0x1bb6('0x18'),'value':_0x1bb6('0x19')},{'name':_0x1bb6('0x1a'),'value':_0x359a49['name']},{'name':_0x1bb6('0x1b'),'value':_0x14bf4e}];if(_0x29ee41[_0x1bb6('0x1c')]){_[_0x1bb6('0x1d')](_0x29ee41,function(_0x5015bf){if(_0xe24210[_0x5015bf[_0x1bb6('0x1e')]]){_0x4fe936['push']({'name':_0x5015bf[_0x1bb6('0x1f')],'value':_0xe24210[_0x5015bf['variableName']]});}});}return request({'form':{'method':_0x1bb6('0x20'),'input_type':_0x1bb6('0x21'),'response_type':_0x1bb6('0x21'),'rest_data':JSON[_0x1bb6('0x22')]({'session':_0x59b1b8['id'],'module_name':_0x1bb6('0x23'),'name_value_list':_0x4fe936})}});}function getAuth(_0xb05bd){return util[_0x1bb6('0x24')](_0x1bb6('0x25'),new Buffer(_0xb05bd[_0x1bb6('0x26')]+':X')['toString'](_0x1bb6('0x27')));}function getServerInfo(_0x255e8a){return request({'form':{'method':'get_server_info','input_type':_0x1bb6('0x21'),'response_type':_0x1bb6('0x21'),'rest_data':JSON[_0x1bb6('0x22')]({'session':_0x255e8a['id']})}});}function getUser(_0xc670ec,_0x57bfbd,_0x4b5be5){if(!_['isNil'](_0x57bfbd)){logger['info']('Getting\x20agent\x20with\x20name',_0x57bfbd);return request({'form':{'method':_0x1bb6('0x28'),'input_type':_0x1bb6('0x21'),'response_type':_0x1bb6('0x21'),'rest_data':JSON['stringify']({'session':_0x4b5be5['id'],'module_name':_0x1bb6('0x29'),'query':util[_0x1bb6('0x24')](_0x1bb6('0x2a'),_0x57bfbd),'order_by':'','offset':'0','select_fields':['id',_0x1bb6('0xd'),_0x1bb6('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5cf869){if(_0x5cf869['entry_list'][_0x1bb6('0x1c')]){var _0x4d109d=_['find'](_0x5cf869[_0x1bb6('0x2c')],function(_0x501cb3){return _0x501cb3['name_value_list'][_0x1bb6('0x2b')][_0x1bb6('0x2d')]===_0x57bfbd;});if(_0x4d109d){logger[_0x1bb6('0x2e')](_0x1bb6('0x2f'));return BPromise['resolve']({'id':_0x4d109d[_0x1bb6('0x30')]['id'][_0x1bb6('0x2d')],'name':_0x4d109d['name_value_list'][_0x1bb6('0xd')][_0x1bb6('0x2d')]});}}logger[_0x1bb6('0x2e')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1bb6('0x31')]({'id':_0x4b5be5[_0x1bb6('0x30')][_0x1bb6('0x32')][_0x1bb6('0x2d')],'name':_0x4b5be5['name_value_list'][_0x1bb6('0x2b')][_0x1bb6('0x2d')]});});}else{logger['info'](_0x1bb6('0x33'));return BPromise[_0x1bb6('0x31')]({'id':_0x4b5be5[_0x1bb6('0x30')]['user_id'][_0x1bb6('0x2d')],'name':_0x4b5be5[_0x1bb6('0x30')][_0x1bb6('0x2b')]['value']});}}function getEndUser(_0x585414,_0x18eb00,_0x32401f,_0x59a811){logger[_0x1bb6('0x2e')]('Searching\x20enduser\x20with\x20phone',_0x32401f);return request({'form':{'method':_0x1bb6('0x28'),'input_type':_0x1bb6('0x21'),'response_type':_0x1bb6('0x21'),'rest_data':JSON[_0x1bb6('0x22')]({'session':_0x59a811['id'],'module_name':_0x1bb6('0x19'),'query':util[_0x1bb6('0x24')](_0x1bb6('0x34'),_0x32401f),'order_by':'','offset':'0','select_fields':['id','name',_0x1bb6('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1bb6('0x36')](function(_0x4ae495){if(_0x4ae495[_0x1bb6('0x2c')][_0x1bb6('0x1c')]){var _0x41363f=_[_0x1bb6('0x37')](_0x4ae495[_0x1bb6('0x2c')],function(_0x470f49){return _0x470f49[_0x1bb6('0x30')][_0x1bb6('0x35')]['value']===_0x32401f;});if(_0x41363f){logger[_0x1bb6('0x2e')](_0x1bb6('0x38'));return BPromise['resolve']({'id':_0x41363f[_0x1bb6('0x30')]['id'][_0x1bb6('0x2d')],'name':_0x41363f[_0x1bb6('0x30')][_0x1bb6('0xd')][_0x1bb6('0x2d')],'phone':_0x41363f[_0x1bb6('0x30')][_0x1bb6('0x35')][_0x1bb6('0x2d')]});}}else{logger['info'](_0x1bb6('0x39'));return request({'form':{'method':'set_entry','input_type':_0x1bb6('0x21'),'response_type':_0x1bb6('0x21'),'rest_data':JSON[_0x1bb6('0x22')]({'session':_0x59a811['id'],'module_name':_0x1bb6('0x19'),'name_value_list':[{'name':_0x1bb6('0x3a'),'value':_0x18eb00!==_0x1bb6('0x3b')?_0x18eb00:util[_0x1bb6('0x24')](_0x1bb6('0x3c'),_0x32401f)},{'name':'phone_home','value':_0x32401f}]})}})[_0x1bb6('0x36')](function(_0x492d37){logger[_0x1bb6('0x2e')](_0x1bb6('0x3d'));return BPromise[_0x1bb6('0x31')]({'id':_0x492d37['id'],'name':_0x492d37[_0x1bb6('0x2c')][_0x1bb6('0x3a')][_0x1bb6('0x2d')],'phone':_0x492d37[_0x1bb6('0x2c')]['phone_home']['value']});});}});}function request(_0x2e8c03){logger['debug']('[HTTP]',JSON[_0x1bb6('0x22')](_0x2e8c03));return rp(_['merge'](def,_0x2e8c03));}function getTags(_0x2cf2a4,_0x284300){var _0x2e9c2f=[];if(_0x2cf2a4&&_0x2cf2a4['length']>0x0){_0x2e9c2f=_[_0x1bb6('0x3e')](_0x2cf2a4,_0x284300);}return _0x2e9c2f;}function getCustomFields(_0xb579c,_0x5c306d){var _0x5ccfba=[];var _0x4219db={'custom_fields':[]};if(_0xb579c[_0x1bb6('0x1c')]>0x0){_[_0x1bb6('0x1d')](_0xb579c,function(_0x83e4db){if(_0x83e4db[_0x1bb6('0x3f')]===_0x1bb6('0x40')&&_0x83e4db[_0x1bb6('0x41')]&&!_0x83e4db['customField']){_0x4219db[_0x83e4db['nameField']['toLowerCase']()]=_0x83e4db[_0x1bb6('0x42')][_0x1bb6('0x43')]();}else if(_0x83e4db['type']==='string'&&_0x83e4db[_0x1bb6('0x1f')]&&_0x83e4db[_0x1bb6('0x44')]){_0x4219db['custom_fields'][_0x1bb6('0x45')]({'id':_0x83e4db[_0x1bb6('0x1f')],'value':_0x83e4db[_0x1bb6('0x42')]['toString']()});}else if(_0x83e4db[_0x1bb6('0x3f')]===_0x1bb6('0x46')&&_0x83e4db['variableName']&&_0x83e4db[_0x1bb6('0x1f')]&&_0x83e4db[_0x1bb6('0x44')]){_0x5c306d[_0x83e4db[_0x1bb6('0x1e')]]&&_0x4219db['custom_fields'][_0x1bb6('0x45')]({'id':_0x83e4db['idField'],'value':_0x5c306d[_0x83e4db[_0x1bb6('0x1e')]][_0x1bb6('0x43')]()});}else if(_0x83e4db['type']===_0x1bb6('0x47')&&_0x83e4db[_0x1bb6('0x48')]&&_0x83e4db['Variable'][_0x1bb6('0xd')]&&_0x83e4db['idField']&&_0x83e4db['customField']){_0x5c306d[_0x83e4db[_0x1bb6('0x48')][_0x1bb6('0xd')][_0x1bb6('0x49')]()]&&_0x4219db[_0x1bb6('0x4a')][_0x1bb6('0x45')]({'id':_0x83e4db['idField'],'value':_0x5c306d[_0x83e4db[_0x1bb6('0x48')]['name'][_0x1bb6('0x49')]()][_0x1bb6('0x43')]()});}});}return _0x4219db;}function getConnection(_0x67d391){return request({'method':_0x1bb6('0xb'),'form':{'method':'login','input_type':'JSON','response_type':_0x1bb6('0x21'),'rest_data':JSON[_0x1bb6('0x22')]({'user_auth':{'user_name':_0x67d391[_0x1bb6('0x4b')],'password':_0x67d391[_0x1bb6('0x4c')],'encryption':_0x1bb6('0x4d')},'application':_0x1bb6('0x4e')})}})[_0x1bb6('0x36')](function(_0x34dff3){var _0x210bd3=_0x34dff3;if(_0x210bd3['id']){def[_0x1bb6('0x4f')]=_0x210bd3['id'];return BPromise[_0x1bb6('0x31')](_0x210bd3);}else{throw new Error(util[_0x1bb6('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x67d391['id']));}});}function setRelationship(_0x17faf9,_0x31961a,_0x425a79,_0x34fb2b){return request({'form':{'method':_0x1bb6('0x50'),'input_type':_0x1bb6('0x21'),'response_type':'JSON','rest_data':JSON[_0x1bb6('0x22')]({'session':_0x17faf9['id'],'module_name':'Calls','module_id':_0x425a79['id'],'link_field_name':_0x34fb2b,'related_ids':[_0x31961a['id']]})}});}exports[_0x1bb6('0x51')]=function(_0x23f1fa,_0x229790,_0x36378e,_0x2ef94a,_0x3cca0d,_0x41eb90){var _0x751453,_0x4dc33a,_0x369962,_0x16d1ce;_0x41eb90[_0x1bb6('0x52')]=intUtil[_0x1bb6('0x53')](_0x41eb90[_0x1bb6('0x52')]);_0x41eb90[_0x1bb6('0x54')]=intUtil['stripTrailingSlash'](_0x41eb90[_0x1bb6('0x54')]);def['uri']=util[_0x1bb6('0x24')](_0x1bb6('0x55'),_0x41eb90[_0x1bb6('0x52')]);if(_0x3cca0d&&_0x3cca0d[_0x1bb6('0x56')]){logger[_0x1bb6('0x2e')](_0x1bb6('0x57'),'Recording\x20is\x20enabled!');_0x229790['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41eb90[_0x1bb6('0x54')],_0x229790[_0x1bb6('0x58')],md5(_0x229790[_0x1bb6('0x58')]));}else{_0x229790[_0x1bb6('0x59')]='';}return getConnection(_0x41eb90)[_0x1bb6('0x36')](function(_0x3664e0){_0x16d1ce=_0x3664e0;return getUser(_0x41eb90,_0x2ef94a['name'],_0x16d1ce);})[_0x1bb6('0x36')](function(_0x4d34f9){_0x751453=_0x4d34f9;logger[_0x1bb6('0x2e')]('The\x20User\x20ID\x20is:',_0x751453['id']);return getEndUser(_0x41eb90,_0x229790[_0x1bb6('0x5a')],_0x229790[_0x1bb6('0x5b')],_0x16d1ce);})[_0x1bb6('0x36')](function(_0x1a3a84){_0x4dc33a=_0x1a3a84;logger[_0x1bb6('0x2e')](_0x1bb6('0x5c'),_0x4dc33a['id']);return getTicket(_0x41eb90,_0x751453,_0x4dc33a,_0x36378e,_0x229790,_0x36378e['Fields'],_0x16d1ce,_0x1bb6('0x5d'));})[_0x1bb6('0x36')](function(_0x533c44){_0x369962=_0x533c44;logger[_0x1bb6('0x2e')]('Ticket\x20created!');logger[_0x1bb6('0x2e')]('The\x20Ticket\x20ID\x20is:',_0x369962['id']);return setRelationship(_0x16d1ce,_0x751453,_0x369962,_0x1bb6('0x5e'));})[_0x1bb6('0x36')](function(){return setRelationship(_0x16d1ce,_0x4dc33a,_0x369962,_0x1bb6('0x5f'));})[_0x1bb6('0x36')](function(){return getServerInfo(_0x16d1ce);})['then'](function(_0x227c66){var _0x256cf6=parseInt(_0x227c66[_0x1bb6('0x60')][_0x1bb6('0x61')](0x0));var _0x3dd19e=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x41eb90[_0x1bb6('0x52')],_0x369962['id']);if(_0x256cf6>0x6){_0x3dd19e=util[_0x1bb6('0x24')](_0x1bb6('0x62'),_0x41eb90[_0x1bb6('0x52')],_0x369962['id']);}logger[_0x1bb6('0x2e')](_0x1bb6('0x57'),_0x1bb6('0x63'));emit(util[_0x1bb6('0x24')](_0x1bb6('0x64'),_0x2ef94a[_0x1bb6('0xd')]),_0x1bb6('0x65'),{'uri':_0x3dd19e});})[_0x1bb6('0x66')](function(_0x4d73f2){logger['error'](_0x1bb6('0x57'),JSON[_0x1bb6('0x22')](_0x4d73f2));});};exports[_0x1bb6('0x67')]=function(_0x1acf96,_0x4f1cd0,_0x5d40ec,_0x4b2ca3,_0x34dae5,_0x444749,_0x1e4daa){var _0x42bf72,_0x58e06f,_0x3c8ec3,_0x27aad5;_0x444749[_0x1bb6('0x52')]=intUtil[_0x1bb6('0x53')](_0x444749[_0x1bb6('0x52')]);_0x444749[_0x1bb6('0x54')]=intUtil[_0x1bb6('0x53')](_0x444749[_0x1bb6('0x54')]);def[_0x1bb6('0x68')]=util[_0x1bb6('0x24')](_0x1bb6('0x55'),_0x444749[_0x1bb6('0x52')]);if(_0x1e4daa&&_0x1e4daa[_0x1bb6('0x69')]&&_0x1e4daa[_0x1bb6('0x69')]!==_0x1bb6('0x6a')){logger['info']('[OUTBOUND]',_0x1bb6('0x6b'));_0x4f1cd0[_0x1bb6('0x59')]=util['format'](_0x1bb6('0x6c'),_0x444749[_0x1bb6('0x54')],_0x4f1cd0['uniqueid'],md5(_0x4f1cd0[_0x1bb6('0x58')]));}return getConnection(_0x444749)[_0x1bb6('0x36')](function(_0x698fa8){_0x27aad5=_0x698fa8;return getUser(_0x444749,_0x4b2ca3[_0x1bb6('0xd')],_0x27aad5);})[_0x1bb6('0x36')](function(_0x1bae9e){_0x42bf72=_0x1bae9e;logger[_0x1bb6('0x2e')](_0x1bb6('0x6d'),_0x42bf72['id']);return getEndUser(_0x444749,_0x4f1cd0['destcalleridname'],_0x4f1cd0[_0x1bb6('0x6e')],_0x27aad5);})['then'](function(_0x499c2e){_0x58e06f=_0x499c2e;logger['info'](_0x1bb6('0x5c'),_0x58e06f['id']);return getTicket(_0x444749,_0x42bf72,_0x58e06f,_0x5d40ec,_0x4f1cd0,_0x5d40ec[_0x1bb6('0x6f')],_0x27aad5,_0x1bb6('0x70'));})['then'](function(_0x3b654d){_0x3c8ec3=_0x3b654d;logger[_0x1bb6('0x2e')](_0x1bb6('0x71'));logger[_0x1bb6('0x2e')](_0x1bb6('0x72'),_0x3c8ec3['id']);return setRelationship(_0x27aad5,_0x42bf72,_0x3c8ec3,'users');})[_0x1bb6('0x36')](function(){return setRelationship(_0x27aad5,_0x58e06f,_0x3c8ec3,'contacts');})[_0x1bb6('0x36')](function(){return getServerInfo(_0x27aad5);})['then'](function(_0x2599f9){var _0x49069b=parseInt(_0x2599f9[_0x1bb6('0x60')][_0x1bb6('0x61')](0x0));var _0x2442dd=util[_0x1bb6('0x24')](_0x1bb6('0x73'),_0x444749[_0x1bb6('0x52')],_0x3c8ec3['id']);if(_0x49069b>0x6){_0x2442dd=util[_0x1bb6('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x444749[_0x1bb6('0x52')],_0x3c8ec3['id']);}logger['info'](_0x1bb6('0x74'),_0x1bb6('0x63'));emit(util[_0x1bb6('0x24')](_0x1bb6('0x64'),_0x4b2ca3[_0x1bb6('0xd')]),_0x1bb6('0x65'),{'uri':_0x2442dd});})['catch'](function(_0x308abd){logger[_0x1bb6('0x75')](_0x1bb6('0x74'),JSON['stringify'](_0x308abd));});};exports['unmanaged']=function(_0x189814,_0xdecfee,_0x580fc8,_0x2594d8,_0x5b9a63,_0x531893){var _0x42a015,_0x2830ec,_0x5af4da,_0x5afe54;_0x531893[_0x1bb6('0x52')]=intUtil[_0x1bb6('0x53')](_0x531893['remoteUri']);_0x531893[_0x1bb6('0x54')]=intUtil[_0x1bb6('0x53')](_0x531893[_0x1bb6('0x54')]);def[_0x1bb6('0x68')]=util[_0x1bb6('0x24')](_0x1bb6('0x55'),_0x531893['remoteUri']);if(_0x5b9a63&&_0x5b9a63[_0x1bb6('0x56')]){logger[_0x1bb6('0x2e')]('['+_0xdecfee[_0x1bb6('0x76')][_0x1bb6('0x77')]()+']',_0x1bb6('0x6b'));_0xdecfee[_0x1bb6('0x59')]=util['format'](_0x1bb6('0x6c'),_0x531893['serverUrl'],_0xdecfee[_0x1bb6('0x58')],md5(_0xdecfee['uniqueid']));}else{_0xdecfee[_0x1bb6('0x59')]='';}return getConnection(_0x531893)[_0x1bb6('0x36')](function(_0x5b8a3c){_0x5afe54=_0x5b8a3c;if(!_['isNil'](_0x2594d8)){return getUser(_0x531893,_0x2594d8[_0x1bb6('0xd')],_0x5afe54);}else{return getUser(_0x531893,null,_0x5afe54);}})[_0x1bb6('0x36')](function(_0xe52c3){_0x42a015=_0xe52c3;logger['info'](_0x1bb6('0x6d'),_0x42a015['id']);return getEndUser(_0x531893,_0xdecfee['calleridname'],_0xdecfee[_0x1bb6('0x5b')],_0x5afe54);})[_0x1bb6('0x36')](function(_0x4eafd6){_0x2830ec=_0x4eafd6;logger[_0x1bb6('0x2e')](_0x1bb6('0x5c'),_0x2830ec['id']);return getTicket(_0x531893,_0x42a015,_0x2830ec,_0x580fc8,_0xdecfee,_0x580fc8[_0x1bb6('0x6f')],_0x5afe54,'Inbound');})[_0x1bb6('0x36')](function(_0x28265d){_0x5af4da=_0x28265d;logger[_0x1bb6('0x2e')]('Ticket\x20created!');logger[_0x1bb6('0x2e')](_0x1bb6('0x72'),_0x5af4da['id']);return setRelationship(_0x5afe54,_0x42a015,_0x5af4da,_0x1bb6('0x5e'));})[_0x1bb6('0x36')](function(){return setRelationship(_0x5afe54,_0x2830ec,_0x5af4da,_0x1bb6('0x5f'));})[_0x1bb6('0x36')](function(){return getServerInfo(_0x5afe54);})[_0x1bb6('0x66')](function(_0x24ea7d){logger[_0x1bb6('0x75')]('['+_0xdecfee[_0x1bb6('0x76')][_0x1bb6('0x77')]()+']',JSON[_0x1bb6('0x22')](_0x24ea7d));});}; \ 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 0b7d913..d55de16 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 _0xa553=['push','content','type','variableName','customVariable','Variable','name','toLowerCase','string','format','%s:\x20%s','key','keyContent','keyType','slice','lastIndexOf','validateEmail','util','getString','length','sortBy'];(function(_0x4032ba,_0xd58dd2){var _0x512895=function(_0x2422e6){while(--_0x2422e6){_0x4032ba['push'](_0x4032ba['shift']());}};_0x512895(++_0xd58dd2);}(_0xa553,0x122));var _0x3a55=function(_0x5cc8aa,_0x4cedf9){_0x5cc8aa=_0x5cc8aa-0x0;var _0x244e8d=_0xa553[_0x5cc8aa];return _0x244e8d;};'use strict';var _=require('lodash');var util=require(_0x3a55('0x0'));exports[_0x3a55('0x1')]=function(_0x32f0ed,_0x495fdd,_0x100567){var _0x297937=[];if(_0x32f0ed[_0x3a55('0x2')]>0x0){var _0x3263f9=_[_0x3a55('0x3')](_0x32f0ed,['id']);for(var _0xb0fe15=0x0;_0xb0fe15<_0x3263f9[_0x3a55('0x2')];_0xb0fe15++){var _0x39a624=_0x3263f9[_0xb0fe15];if(_0x39a624['type']==='string'){_0x297937[_0x3a55('0x4')](_0x39a624[_0x3a55('0x5')]);}else if(_0x39a624[_0x3a55('0x6')]==='variable'&&_0x39a624['variableName']){_0x495fdd[_0x39a624[_0x3a55('0x7')]]&&_0x297937[_0x3a55('0x4')](_0x495fdd[_0x39a624[_0x3a55('0x7')]]['toString']());}else if(_0x39a624[_0x3a55('0x6')]===_0x3a55('0x8')&&_0x39a624[_0x3a55('0x9')]&&_0x39a624[_0x3a55('0x9')][_0x3a55('0xa')]){_0x495fdd[_0x39a624[_0x3a55('0x9')][_0x3a55('0xa')]['toLowerCase']()]&&_0x297937[_0x3a55('0x4')](_0x495fdd[_0x39a624[_0x3a55('0x9')][_0x3a55('0xa')][_0x3a55('0xb')]()]['toString']());}else if(_0x39a624[_0x3a55('0x6')]==='keyValue'){if(_0x39a624['keyType']===_0x3a55('0xc')&&_0x39a624['key']){_0x297937['push'](util[_0x3a55('0xd')](_0x3a55('0xe'),_0x39a624[_0x3a55('0xf')],_0x39a624[_0x3a55('0x10')]));}else if(_0x39a624[_0x3a55('0x11')]==='variable'&&_0x39a624['variableName']&&_0x39a624[_0x3a55('0xf')]){_0x495fdd[_0x39a624[_0x3a55('0x7')]]&&_0x297937['push'](util[_0x3a55('0xd')]('%s:\x20%s',_0x39a624[_0x3a55('0xf')],_0x495fdd[_0x39a624[_0x3a55('0x7')]]));}else if(_0x39a624[_0x3a55('0x11')]===_0x3a55('0x8')&&_0x39a624[_0x3a55('0x9')]&&_0x39a624[_0x3a55('0x9')][_0x3a55('0xa')]&&_0x39a624[_0x3a55('0xf')]){_0x495fdd[_0x39a624['Variable'][_0x3a55('0xa')][_0x3a55('0xb')]()]&&_0x297937['push'](util[_0x3a55('0xd')](_0x3a55('0xe'),_0x39a624[_0x3a55('0xf')],_0x495fdd[_0x39a624[_0x3a55('0x9')][_0x3a55('0xa')][_0x3a55('0xb')]()]));}}}}return _0x297937['join'](_0x100567);};exports['stripTrailingSlash']=function(_0x441c7e){var _0x12852b=_0x441c7e[_0x3a55('0x12')](-0x1);if(_0x12852b==='/'){_0x441c7e=_0x441c7e['substring'](0x0,_0x441c7e[_0x3a55('0x13')](_0x12852b));}return _0x441c7e;};exports[_0x3a55('0x14')]=function(_0x27afd2){if(!_['isNil'](_0x27afd2)&&_0x27afd2!==''){var _0x5dbbb2=/^(([^<>()\[\]\\.,;:\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 _0x5dbbb2['test'](String(_0x27afd2)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x7a34=['keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','key','format','%s:\x20%s'];(function(_0x1f3c60,_0x4f5109){var _0x2293df=function(_0x18bacf){while(--_0x18bacf){_0x1f3c60['push'](_0x1f3c60['shift']());}};_0x2293df(++_0x4f5109);}(_0x7a34,0x93));var _0x47a3=function(_0x513772,_0x4bdcc8){_0x513772=_0x513772-0x0;var _0x4fea03=_0x7a34[_0x513772];return _0x4fea03;};'use strict';var _=require(_0x47a3('0x0'));var util=require(_0x47a3('0x1'));exports[_0x47a3('0x2')]=function(_0x4f2bd2,_0x30e079,_0x53f4c9){var _0x326709=[];if(_0x4f2bd2[_0x47a3('0x3')]>0x0){var _0x1c4e03=_[_0x47a3('0x4')](_0x4f2bd2,['id']);for(var _0x11f90c=0x0;_0x11f90c<_0x1c4e03['length'];_0x11f90c++){var _0x22dc30=_0x1c4e03[_0x11f90c];if(_0x22dc30['type']===_0x47a3('0x5')){_0x326709[_0x47a3('0x6')](_0x22dc30[_0x47a3('0x7')]);}else if(_0x22dc30[_0x47a3('0x8')]===_0x47a3('0x9')&&_0x22dc30[_0x47a3('0xa')]){_0x30e079[_0x22dc30[_0x47a3('0xa')]]&&_0x326709[_0x47a3('0x6')](_0x30e079[_0x22dc30['variableName']]['toString']());}else if(_0x22dc30['type']===_0x47a3('0xb')&&_0x22dc30[_0x47a3('0xc')]&&_0x22dc30['Variable'][_0x47a3('0xd')]){_0x30e079[_0x22dc30['Variable'][_0x47a3('0xd')][_0x47a3('0xe')]()]&&_0x326709[_0x47a3('0x6')](_0x30e079[_0x22dc30[_0x47a3('0xc')]['name'][_0x47a3('0xe')]()][_0x47a3('0xf')]());}else if(_0x22dc30[_0x47a3('0x8')]===_0x47a3('0x10')){if(_0x22dc30[_0x47a3('0x11')]===_0x47a3('0x5')&&_0x22dc30[_0x47a3('0x12')]){_0x326709[_0x47a3('0x6')](util[_0x47a3('0x13')](_0x47a3('0x14'),_0x22dc30[_0x47a3('0x12')],_0x22dc30[_0x47a3('0x15')]));}else if(_0x22dc30[_0x47a3('0x11')]===_0x47a3('0x9')&&_0x22dc30[_0x47a3('0xa')]&&_0x22dc30['key']){_0x30e079[_0x22dc30[_0x47a3('0xa')]]&&_0x326709[_0x47a3('0x6')](util[_0x47a3('0x13')](_0x47a3('0x14'),_0x22dc30[_0x47a3('0x12')],_0x30e079[_0x22dc30[_0x47a3('0xa')]]));}else if(_0x22dc30['keyType']===_0x47a3('0xb')&&_0x22dc30['Variable']&&_0x22dc30[_0x47a3('0xc')][_0x47a3('0xd')]&&_0x22dc30[_0x47a3('0x12')]){_0x30e079[_0x22dc30[_0x47a3('0xc')][_0x47a3('0xd')][_0x47a3('0xe')]()]&&_0x326709[_0x47a3('0x6')](util[_0x47a3('0x13')]('%s:\x20%s',_0x22dc30[_0x47a3('0x12')],_0x30e079[_0x22dc30[_0x47a3('0xc')][_0x47a3('0xd')]['toLowerCase']()]));}}}}return _0x326709[_0x47a3('0x16')](_0x53f4c9);};exports[_0x47a3('0x17')]=function(_0x2b4257){var _0x229a2c=_0x2b4257[_0x47a3('0x18')](-0x1);if(_0x229a2c==='/'){_0x2b4257=_0x2b4257[_0x47a3('0x19')](0x0,_0x2b4257[_0x47a3('0x1a')](_0x229a2c));}return _0x2b4257;};exports['validateEmail']=function(_0x30c124){if(!_[_0x47a3('0x1b')](_0x30c124)&&_0x30c124!==''){var _0x3d3c0a=/^(([^<>()\[\]\\.,;:\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 _0x3d3c0a['test'](String(_0x30c124)[_0x47a3('0xe')]());}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 fa8caeb..f2600d4 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 _0xe924=['error','catch','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','info','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','statusCode','getUser','admin','Searching\x20end\x20user\x20with\x20phone','format','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','accessKey','login','token','[HTTP]','queue','stripTrailingSlash','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','serverUrl','destcalleridname','destcalleridnum','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','user:%s','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','emit','length','forEach','string','idField','type','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','%s/webservice.php','remoteUri','create','username','HelpDesk','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xe924,0xa5));var _0x4e92=function(_0x3528eb,_0xc74a84){_0x3528eb=_0x3528eb-0x0;var _0x366654=_0xe924[_0x3528eb];return _0x366654;};'use strict';var _=require(_0x4e92('0x0'));var rp=require(_0x4e92('0x1'));var BPromise=require(_0x4e92('0x2'));var md5=require('md5');var util=require(_0x4e92('0x3'));var Redis=require(_0x4e92('0x4'));var intUtil=require(_0x4e92('0x5'));var config=require('../../../../config/environment');var logger=require(_0x4e92('0x6'))(_0x4e92('0x7'));config[_0x4e92('0x8')]=_[_0x4e92('0x9')](config['redis'],{'host':_0x4e92('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4e92('0x8')]));function emit(_0x14bbfb,_0x9d3542,_0x17d34e){io['to'](_0x14bbfb)[_0x4e92('0xb')](_0x9d3542,_0x17d34e);}function getCustomFields(_0x1bf4af,_0x1af442){var _0x10e598={};if(_0x1bf4af[_0x4e92('0xc')]>0x0){_[_0x4e92('0xd')](_0x1bf4af,function(_0x3fa8f2){if(_0x3fa8f2['type']===_0x4e92('0xe')&&_0x3fa8f2[_0x4e92('0xf')]){_0x10e598[_0x3fa8f2[_0x4e92('0xf')]]=_0x3fa8f2['content']['toString']();}else if(_0x3fa8f2[_0x4e92('0x10')]===_0x4e92('0x11')&&_0x3fa8f2[_0x4e92('0x12')]&&_0x3fa8f2['idField']&&_0x1af442[_0x3fa8f2['variableName']]){_0x10e598[_0x3fa8f2[_0x4e92('0xf')]]=_0x1af442[_0x3fa8f2[_0x4e92('0x12')]]['toString']();}else if(_0x3fa8f2['type']===_0x4e92('0x13')&&_0x3fa8f2[_0x4e92('0x14')]&&_0x3fa8f2[_0x4e92('0x14')][_0x4e92('0x15')]&&_0x3fa8f2[_0x4e92('0xf')]&&_0x1af442[_0x3fa8f2[_0x4e92('0x14')]['name']['toLowerCase']()]){_0x10e598[_0x3fa8f2[_0x4e92('0xf')]]=_0x1af442[_0x3fa8f2[_0x4e92('0x14')]['name'][_0x4e92('0x16')]()]['toString']();}});}return _0x10e598;}function createTicket(_0x3d1bef,_0x393111,_0x37b49,_0x1ad5b5,_0x1c5735,_0x440005,_0x4f4114){logger['info'](_0x4e92('0x17'));var _0x1ec810=_[_0x4e92('0x18')]({'parent_id':'','assigned_user_id':_0x393111['id'],'ticketpriorities':_0x4e92('0x19'),'ticketstatus':_0x4e92('0x1a'),'ticket_title':intUtil['getString'](_0x1ad5b5[_0x4e92('0x1b')],_0x1c5735,'\x20'),'description':intUtil[_0x4e92('0x1c')](_0x1ad5b5[_0x4e92('0x1d')],_0x1c5735,'\x0a'),'contact_id':_0x37b49['id']},getCustomFields(_0x440005,_0x1c5735));var _0x14d97d={'method':_0x4e92('0x1e'),'uri':util['format'](_0x4e92('0x1f'),_0x3d1bef[_0x4e92('0x20')]),'form':{'operation':_0x4e92('0x21'),'username':_0x3d1bef[_0x4e92('0x22')],'sessionName':_0x4f4114['sessionName'],'elementType':_0x4e92('0x23'),'element':JSON['stringify'](_0x1ec810)},'json':!![]};return request(_0x14d97d)[_0x4e92('0x24')](function(_0x45e66f){if(_0x45e66f['success']){return BPromise[_0x4e92('0x25')]({'id':_0x45e66f[_0x4e92('0x26')]['id']});}else{throw new Error(util['format'](_0x4e92('0x27'),JSON[_0x4e92('0x28')](_0x45e66f[_0x4e92('0x29')])));}})[_0x4e92('0x2a')](function(_0x2e652f){var _0x394e4a=_0x2e652f['statusCode']||0x1f4;logger[_0x4e92('0x29')](_0x4e92('0x2b'),_0x4e92('0x2c'),_0x394e4a,JSON[_0x4e92('0x28')](_0x2e652f));});}function getUser(_0x580cb6,_0x2e74ae,_0x5be5e3){if(intUtil['validateEmail'](_0x2e74ae)){logger[_0x4e92('0x2d')](_0x4e92('0x2e'),_0x2e74ae);return request({'method':_0x4e92('0x2f'),'uri':util['format'](_0x4e92('0x1f'),_0x580cb6[_0x4e92('0x20')]),'qs':{'operation':_0x4e92('0x30'),'username':_0x580cb6['username'],'sessionName':_0x5be5e3[_0x4e92('0x31')],'query':util['format'](_0x4e92('0x32'),_0x2e74ae)},'json':!![]})['then'](function(_0x23a57d){if(_0x23a57d[_0x4e92('0x33')]&&_0x23a57d[_0x4e92('0x26')][_0x4e92('0xc')]){logger['info'](_0x4e92('0x34'));return BPromise[_0x4e92('0x25')]({'id':_0x23a57d[_0x4e92('0x26')][0x0]['id'],'email':_0x23a57d[_0x4e92('0x26')][0x0][_0x4e92('0x35')],'name':_0x23a57d[_0x4e92('0x26')][0x0][_0x4e92('0x36')]+'\x20'+_0x23a57d[_0x4e92('0x26')]['last_name']});}else{logger['info'](_0x4e92('0x37'));return BPromise['resolve']({'id':_0x5be5e3[_0x4e92('0x38')],'email':_0x580cb6[_0x4e92('0x22')],'name':'admin'});}})[_0x4e92('0x2a')](function(_0x3f8f65){var _0xab8e14=_0x3f8f65[_0x4e92('0x39')]||0x1f4;logger[_0x4e92('0x29')](_0x4e92('0x2b'),_0x4e92('0x3a'),_0xab8e14,JSON['stringify'](_0x3f8f65));});}else{logger[_0x4e92('0x2d')](_0x4e92('0x37'));return BPromise[_0x4e92('0x25')]({'id':_0x5be5e3[_0x4e92('0x38')],'email':_0x580cb6[_0x4e92('0x22')],'name':_0x4e92('0x3b')})[_0x4e92('0x2a')](function(_0x578656){var _0xbf3320=_0x578656['statusCode']||0x1f4;logger[_0x4e92('0x29')](_0x4e92('0x2b'),_0x4e92('0x3a'),_0xbf3320,JSON[_0x4e92('0x28')](_0x578656));});}}function getEndUser(_0x4b8f54,_0x5a46ae,_0x59f0d3,_0x3c2e2f){logger['info'](_0x4e92('0x3c'),_0x59f0d3);return request({'method':'GET','uri':util[_0x4e92('0x3d')]('%s/webservice.php',_0x4b8f54[_0x4e92('0x20')]),'qs':{'operation':'query','username':_0x4b8f54['username'],'sessionName':_0x3c2e2f[_0x4e92('0x31')],'query':util['format'](_0x4e92('0x3e'),_0x59f0d3,_0x59f0d3,_0x59f0d3,_0x59f0d3,_0x59f0d3)},'json':!![]})[_0x4e92('0x24')](function(_0x38dd0d){if(_0x38dd0d[_0x4e92('0x33')]&&_0x38dd0d[_0x4e92('0x26')]['length']){logger[_0x4e92('0x2d')](_0x4e92('0x3f'));return BPromise[_0x4e92('0x25')]({'id':_0x38dd0d[_0x4e92('0x26')][0x0]['id'],'name':_0x38dd0d[_0x4e92('0x26')][0x0][_0x4e92('0x40')]+'\x20'+_0x38dd0d[_0x4e92('0x26')][0x0][_0x4e92('0x41')],'phone':_0x59f0d3});}else{logger['info'](_0x4e92('0x42'));return request({'method':'POST','uri':util[_0x4e92('0x3d')](_0x4e92('0x1f'),_0x4b8f54['remoteUri']),'form':{'operation':_0x4e92('0x21'),'sessionName':_0x3c2e2f[_0x4e92('0x31')],'elementType':_0x4e92('0x43'),'element':JSON[_0x4e92('0x28')]({'lastname':_0x5a46ae,'phone':_0x59f0d3,'assigned_user_id':'\x20'})},'json':!![]})[_0x4e92('0x24')](function(_0x468f80){logger[_0x4e92('0x2d')](_0x4e92('0x44'));return BPromise[_0x4e92('0x25')]({'id':_0x468f80['result']['id'],'name':_0x468f80[_0x4e92('0x26')][_0x4e92('0x41')],'phone':_0x468f80[_0x4e92('0x26')][_0x4e92('0x45')]});})[_0x4e92('0x2a')](function(_0xbf32b4){var _0x482910=_0xbf32b4['statusCode']||0x1f4;logger[_0x4e92('0x29')](_0x4e92('0x2b'),'getEndUser',_0x482910,JSON[_0x4e92('0x28')](_0xbf32b4));});}});}function getConnection(_0x354bd8){var _0x5035c7=_0x354bd8['username'];var _0x220c1e=_0x354bd8[_0x4e92('0x46')];return request({'method':_0x4e92('0x2f'),'uri':util[_0x4e92('0x3d')](_0x4e92('0x1f'),_0x354bd8[_0x4e92('0x20')]),'qs':{'operation':'getchallenge','username':_0x5035c7},'json':!![]})['then'](function(_0x476d46){if(_0x476d46[_0x4e92('0x33')]){return request({'method':_0x4e92('0x1e'),'uri':util['format'](_0x4e92('0x1f'),_0x354bd8['remoteUri']),'form':{'operation':_0x4e92('0x47'),'username':_0x5035c7,'accessKey':md5(_0x476d46['result'][_0x4e92('0x48')]+_0x220c1e)},'json':!![]});}})[_0x4e92('0x24')](function(_0x2b8d36){if(_0x2b8d36['success']){return BPromise[_0x4e92('0x25')](_0x2b8d36[_0x4e92('0x26')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x354bd8['id']));}})[_0x4e92('0x2a')](function(_0x300e87){var _0x519155=_0x300e87[_0x4e92('0x39')]||0x1f4;logger[_0x4e92('0x29')](_0x4e92('0x2b'),'getConnection',_0x519155,JSON['stringify'](_0x300e87));});}function request(_0x2938ce){logger['info'](_0x4e92('0x49'),JSON['stringify'](_0x2938ce));return rp(_0x2938ce);}exports[_0x4e92('0x4a')]=function(_0x29e423,_0x298c62,_0x1ac74d,_0xc9aed2,_0x2981ef,_0x2b0f8e){var _0x8bc9a0,_0x2e52d2,_0x1d18f1,_0x33b082;_0x2b0f8e[_0x4e92('0x20')]=intUtil[_0x4e92('0x4b')](_0x2b0f8e[_0x4e92('0x20')]);if(_0x2981ef&&_0x2981ef[_0x4e92('0x4c')]){logger[_0x4e92('0x2d')]('[QUEUE]','Recording\x20is\x20enabled!');_0x298c62['recordingURL']=util[_0x4e92('0x3d')](_0x4e92('0x4d'),_0x2b0f8e['serverUrl'],_0x298c62[_0x4e92('0x4e')],md5(_0x298c62[_0x4e92('0x4e')]));}else{_0x298c62['recordingURL']='';}return getConnection(_0x2b0f8e)[_0x4e92('0x24')](function(_0x46c1cf){_0x33b082=_0x46c1cf;return getUser(_0x2b0f8e,_0xc9aed2[_0x4e92('0x4f')],_0x33b082);})[_0x4e92('0x24')](function(_0x387910){_0x8bc9a0=_0x387910;logger[_0x4e92('0x2d')](_0x4e92('0x50'),_0x8bc9a0['id']);return getEndUser(_0x2b0f8e,_0x298c62[_0x4e92('0x51')],_0x298c62[_0x4e92('0x52')],_0x33b082);})[_0x4e92('0x24')](function(_0x5e8b9d){_0x2e52d2=_0x5e8b9d;logger[_0x4e92('0x2d')](_0x4e92('0x53'),_0x2e52d2['id']);return createTicket(_0x2b0f8e,_0x8bc9a0,_0x2e52d2,_0x1ac74d,_0x298c62,_0x1ac74d[_0x4e92('0x54')],_0x33b082);})[_0x4e92('0x24')](function(_0x3f9a6c){_0x1d18f1=_0x3f9a6c;logger[_0x4e92('0x2d')](_0x4e92('0x55'));logger['info'](_0x4e92('0x56'),_0x1d18f1['id']);var _0x97b3f9=util[_0x4e92('0x3d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x2b0f8e[_0x4e92('0x20')],_[_0x4e92('0x57')](_0x1d18f1['id'],'x')[0x1]);logger[_0x4e92('0x2d')]('[QUEUE]',_0x4e92('0x58'));emit(util[_0x4e92('0x3d')]('user:%s',_0xc9aed2[_0x4e92('0x15')]),_0x4e92('0x59'),{'uri':_0x97b3f9});})[_0x4e92('0x2a')](function(_0x843587){logger[_0x4e92('0x29')]('[QUEUE]',JSON[_0x4e92('0x28')](_0x843587));});};exports[_0x4e92('0x5a')]=function(_0x15efa0,_0xd702da,_0x1a3793,_0x27a12f,_0x2f7136,_0x2a315a,_0x4b0829){var _0xce34ad,_0xd3ab9f,_0x22e2a8,_0x3462d7;_0x2a315a['remoteUri']=intUtil['stripTrailingSlash'](_0x2a315a['remoteUri']);_0x2a315a['serverUrl']=intUtil['stripTrailingSlash'](_0x2a315a['serverUrl']);if(_0x4b0829&&_0x4b0829[_0x4e92('0x5b')]&&_0x4b0829[_0x4e92('0x5b')]!==_0x4e92('0x5c')){logger['info'](_0x4e92('0x5d'),_0x4e92('0x5e'));_0xd702da[_0x4e92('0x5f')]=util[_0x4e92('0x3d')](_0x4e92('0x4d'),_0x2a315a[_0x4e92('0x60')],_0xd702da[_0x4e92('0x4e')],md5(_0xd702da[_0x4e92('0x4e')]));}return getConnection(_0x2a315a)['then'](function(_0x39f707){_0x3462d7=_0x39f707;return getUser(_0x2a315a,_0x27a12f[_0x4e92('0x4f')],_0x3462d7);})[_0x4e92('0x24')](function(_0x2fb6f1){_0xce34ad=_0x2fb6f1;logger[_0x4e92('0x2d')](_0x4e92('0x50'),_0xce34ad['id']);return getEndUser(_0x2a315a,_0xd702da[_0x4e92('0x61')],_0xd702da[_0x4e92('0x62')],_0x3462d7);})[_0x4e92('0x24')](function(_0x484560){_0xd3ab9f=_0x484560;logger['info'](_0x4e92('0x53'),_0xd3ab9f['id']);return createTicket(_0x2a315a,_0xce34ad,_0xd3ab9f,_0x1a3793,_0xd702da,_0x1a3793[_0x4e92('0x54')],_0x3462d7);})[_0x4e92('0x24')](function(_0xeab16e){_0x22e2a8=_0xeab16e;logger['info'](_0x4e92('0x55'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x22e2a8['id']);var _0x3a2e88=util[_0x4e92('0x3d')](_0x4e92('0x63'),_0x2a315a[_0x4e92('0x20')],_[_0x4e92('0x57')](_0x22e2a8['id'],'x')[0x1]);logger[_0x4e92('0x2d')]('[OUTBOUND]',_0x4e92('0x58'));emit(util[_0x4e92('0x3d')](_0x4e92('0x64'),_0x27a12f[_0x4e92('0x15')]),_0x4e92('0x59'),{'uri':_0x3a2e88});})['catch'](function(_0x2a7ebb){logger[_0x4e92('0x29')](_0x4e92('0x5d'),JSON[_0x4e92('0x28')](_0x2a7ebb));});};exports['unmanaged']=function(_0x5ebf25,_0xa103f7,_0x3c5379,_0x3ac388,_0x2e5e7f,_0x5a0dbb){var _0x5b1e1f,_0x62697f,_0x32303a,_0x50b37c;_0x5a0dbb[_0x4e92('0x20')]=intUtil[_0x4e92('0x4b')](_0x5a0dbb[_0x4e92('0x20')]);_0x5a0dbb[_0x4e92('0x60')]=intUtil['stripTrailingSlash'](_0x5a0dbb['serverUrl']);if(_0x2e5e7f&&_0x2e5e7f[_0x4e92('0x4c')]){logger[_0x4e92('0x2d')]('['+_0xa103f7[_0x4e92('0x65')][_0x4e92('0x66')]()+']',_0x4e92('0x5e'));_0xa103f7[_0x4e92('0x5f')]=util[_0x4e92('0x3d')](_0x4e92('0x4d'),_0x5a0dbb['serverUrl'],_0xa103f7[_0x4e92('0x4e')],md5(_0xa103f7[_0x4e92('0x4e')]));}else{_0xa103f7['recordingURL']='';}return getConnection(_0x5a0dbb)['then'](function(_0x5a512a){_0x50b37c=_0x5a512a;return getUser(_0x5a0dbb,'',_0x50b37c);})[_0x4e92('0x24')](function(_0xaf978c){_0x5b1e1f=_0xaf978c;logger['info'](_0x4e92('0x50'),_0x5b1e1f['id']);return getEndUser(_0x5a0dbb,_0xa103f7[_0x4e92('0x51')],_0xa103f7[_0x4e92('0x52')],_0x50b37c);})[_0x4e92('0x24')](function(_0x49fc36){_0x62697f=_0x49fc36;logger['info'](_0x4e92('0x53'),_0x62697f['id']);return createTicket(_0x5a0dbb,_0x5b1e1f,_0x62697f,_0x3c5379,_0xa103f7,_0x3c5379[_0x4e92('0x54')],_0x50b37c);})[_0x4e92('0x24')](function(_0x26a8b0){_0x32303a=_0x26a8b0;logger[_0x4e92('0x2d')]('Ticket\x20created!');logger[_0x4e92('0x2d')](_0x4e92('0x56'),_0x32303a['id']);})[_0x4e92('0x2a')](function(_0x9dc05){logger[_0x4e92('0x29')]('['+_0xa103f7[_0x4e92('0x65')][_0x4e92('0x66')]()+']',JSON[_0x4e92('0x28')](_0x9dc05));});}; \ No newline at end of file +var _0xa480=['md5','util','ioredis','./util','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','length','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Open','Subjects','getString','Descriptions','POST','%s/webservice.php','stringify','success','result','format','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email','GET','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin','catch','getUser','username','statusCode','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','sessionName','Contacts','Enduser\x20created.','lastname','phone','getEndUser','accessKey','login','token','getConnection','[HTTP]','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','lodash','bluebird'];(function(_0x1a95ca,_0x24c1bb){var _0x558afa=function(_0xff1b20){while(--_0xff1b20){_0x1a95ca['push'](_0x1a95ca['shift']());}};_0x558afa(++_0x24c1bb);}(_0xa480,0x18e));var _0x0a48=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xa480[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x0a48('0x0'));var rp=require('request-promise');var BPromise=require(_0x0a48('0x1'));var md5=require(_0x0a48('0x2'));var util=require(_0x0a48('0x3'));var Redis=require(_0x0a48('0x4'));var intUtil=require(_0x0a48('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0a48('0x6'))(_0x0a48('0x7'));config[_0x0a48('0x8')]=_['defaults'](config[_0x0a48('0x8')],{'host':_0x0a48('0x9'),'port':0x18eb});var io=require(_0x0a48('0xa'))(new Redis(config[_0x0a48('0x8')]));function emit(_0x348e5a,_0x4312ef,_0x22d604){io['to'](_0x348e5a)['emit'](_0x4312ef,_0x22d604);}function getCustomFields(_0xfc85e,_0x1fb4ca){var _0x1219a6={};if(_0xfc85e[_0x0a48('0xb')]>0x0){_['forEach'](_0xfc85e,function(_0xdcffb2){if(_0xdcffb2[_0x0a48('0xc')]===_0x0a48('0xd')&&_0xdcffb2[_0x0a48('0xe')]){_0x1219a6[_0xdcffb2[_0x0a48('0xe')]]=_0xdcffb2[_0x0a48('0xf')][_0x0a48('0x10')]();}else if(_0xdcffb2[_0x0a48('0xc')]==='variable'&&_0xdcffb2[_0x0a48('0x11')]&&_0xdcffb2['idField']&&_0x1fb4ca[_0xdcffb2[_0x0a48('0x11')]]){_0x1219a6[_0xdcffb2[_0x0a48('0xe')]]=_0x1fb4ca[_0xdcffb2['variableName']][_0x0a48('0x10')]();}else if(_0xdcffb2[_0x0a48('0xc')]===_0x0a48('0x12')&&_0xdcffb2['Variable']&&_0xdcffb2[_0x0a48('0x13')][_0x0a48('0x14')]&&_0xdcffb2[_0x0a48('0xe')]&&_0x1fb4ca[_0xdcffb2[_0x0a48('0x13')]['name'][_0x0a48('0x15')]()]){_0x1219a6[_0xdcffb2[_0x0a48('0xe')]]=_0x1fb4ca[_0xdcffb2[_0x0a48('0x13')][_0x0a48('0x14')][_0x0a48('0x15')]()][_0x0a48('0x10')]();}});}return _0x1219a6;}function createTicket(_0xf55900,_0x1c39cf,_0x38dd06,_0x3bb0c7,_0x40b119,_0x54e1f0,_0x266eb1){logger['info'](_0x0a48('0x16'));var _0x29db7a=_[_0x0a48('0x17')]({'parent_id':'','assigned_user_id':_0x1c39cf['id'],'ticketpriorities':'Normal','ticketstatus':_0x0a48('0x18'),'ticket_title':intUtil['getString'](_0x3bb0c7[_0x0a48('0x19')],_0x40b119,'\x20'),'description':intUtil[_0x0a48('0x1a')](_0x3bb0c7[_0x0a48('0x1b')],_0x40b119,'\x0a'),'contact_id':_0x38dd06['id']},getCustomFields(_0x54e1f0,_0x40b119));var _0x3c8d4a={'method':_0x0a48('0x1c'),'uri':util['format'](_0x0a48('0x1d'),_0xf55900['remoteUri']),'form':{'operation':'create','username':_0xf55900['username'],'sessionName':_0x266eb1['sessionName'],'elementType':'HelpDesk','element':JSON[_0x0a48('0x1e')](_0x29db7a)},'json':!![]};return request(_0x3c8d4a)['then'](function(_0x167d18){if(_0x167d18[_0x0a48('0x1f')]){return BPromise['resolve']({'id':_0x167d18[_0x0a48('0x20')]['id']});}else{throw new Error(util[_0x0a48('0x21')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x0a48('0x1e')](_0x167d18[_0x0a48('0x22')])));}})['catch'](function(_0x519f59){var _0x4214f4=_0x519f59['statusCode']||0x1f4;logger['error'](_0x0a48('0x23'),_0x0a48('0x24'),_0x4214f4,JSON[_0x0a48('0x1e')](_0x519f59));});}function getUser(_0x581cba,_0x510fe7,_0x1fbc59){if(intUtil[_0x0a48('0x25')](_0x510fe7)){logger[_0x0a48('0x26')](_0x0a48('0x27'),_0x510fe7);return request({'method':_0x0a48('0x28'),'uri':util['format']('%s/webservice.php',_0x581cba[_0x0a48('0x29')]),'qs':{'operation':_0x0a48('0x2a'),'username':_0x581cba['username'],'sessionName':_0x1fbc59['sessionName'],'query':util['format'](_0x0a48('0x2b'),_0x510fe7)},'json':!![]})[_0x0a48('0x2c')](function(_0x22bc72){if(_0x22bc72[_0x0a48('0x1f')]&&_0x22bc72[_0x0a48('0x20')][_0x0a48('0xb')]){logger[_0x0a48('0x26')]('Agent\x20found!');return BPromise['resolve']({'id':_0x22bc72[_0x0a48('0x20')][0x0]['id'],'email':_0x22bc72[_0x0a48('0x20')][0x0]['email1'],'name':_0x22bc72['result'][0x0]['first_name']+'\x20'+_0x22bc72[_0x0a48('0x20')][_0x0a48('0x2d')]});}else{logger[_0x0a48('0x26')](_0x0a48('0x2e'));return BPromise[_0x0a48('0x2f')]({'id':_0x1fbc59[_0x0a48('0x30')],'email':_0x581cba['username'],'name':_0x0a48('0x31')});}})[_0x0a48('0x32')](function(_0x1b62af){var _0xb56cad=_0x1b62af['statusCode']||0x1f4;logger['error'](_0x0a48('0x23'),_0x0a48('0x33'),_0xb56cad,JSON['stringify'](_0x1b62af));});}else{logger['info'](_0x0a48('0x2e'));return BPromise['resolve']({'id':_0x1fbc59[_0x0a48('0x30')],'email':_0x581cba[_0x0a48('0x34')],'name':_0x0a48('0x31')})[_0x0a48('0x32')](function(_0x52cb04){var _0x1af0bd=_0x52cb04[_0x0a48('0x35')]||0x1f4;logger[_0x0a48('0x22')](_0x0a48('0x23'),_0x0a48('0x33'),_0x1af0bd,JSON[_0x0a48('0x1e')](_0x52cb04));});}}function getEndUser(_0x3ffd31,_0x89497,_0x108492,_0x252c94){logger['info'](_0x0a48('0x36'),_0x108492);return request({'method':_0x0a48('0x28'),'uri':util[_0x0a48('0x21')](_0x0a48('0x1d'),_0x3ffd31['remoteUri']),'qs':{'operation':'query','username':_0x3ffd31[_0x0a48('0x34')],'sessionName':_0x252c94['sessionName'],'query':util['format'](_0x0a48('0x37'),_0x108492,_0x108492,_0x108492,_0x108492,_0x108492)},'json':!![]})[_0x0a48('0x2c')](function(_0x3cdaed){if(_0x3cdaed[_0x0a48('0x1f')]&&_0x3cdaed[_0x0a48('0x20')][_0x0a48('0xb')]){logger[_0x0a48('0x26')](_0x0a48('0x38'));return BPromise[_0x0a48('0x2f')]({'id':_0x3cdaed[_0x0a48('0x20')][0x0]['id'],'name':_0x3cdaed[_0x0a48('0x20')][0x0][_0x0a48('0x39')]+'\x20'+_0x3cdaed[_0x0a48('0x20')][0x0]['lastname'],'phone':_0x108492});}else{logger[_0x0a48('0x26')](_0x0a48('0x3a'));return request({'method':_0x0a48('0x1c'),'uri':util[_0x0a48('0x21')](_0x0a48('0x1d'),_0x3ffd31['remoteUri']),'form':{'operation':_0x0a48('0x3b'),'sessionName':_0x252c94[_0x0a48('0x3c')],'elementType':_0x0a48('0x3d'),'element':JSON[_0x0a48('0x1e')]({'lastname':_0x89497,'phone':_0x108492,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a48('0x2c')](function(_0x166ceb){logger[_0x0a48('0x26')](_0x0a48('0x3e'));return BPromise['resolve']({'id':_0x166ceb['result']['id'],'name':_0x166ceb['result'][_0x0a48('0x3f')],'phone':_0x166ceb[_0x0a48('0x20')][_0x0a48('0x40')]});})[_0x0a48('0x32')](function(_0x528e46){var _0x1d9636=_0x528e46[_0x0a48('0x35')]||0x1f4;logger['error'](_0x0a48('0x23'),_0x0a48('0x41'),_0x1d9636,JSON[_0x0a48('0x1e')](_0x528e46));});}});}function getConnection(_0x5cf9b6){var _0x54ee0e=_0x5cf9b6[_0x0a48('0x34')];var _0xbb9ebb=_0x5cf9b6[_0x0a48('0x42')];return request({'method':'GET','uri':util[_0x0a48('0x21')](_0x0a48('0x1d'),_0x5cf9b6[_0x0a48('0x29')]),'qs':{'operation':'getchallenge','username':_0x54ee0e},'json':!![]})[_0x0a48('0x2c')](function(_0x5af476){if(_0x5af476[_0x0a48('0x1f')]){return request({'method':'POST','uri':util['format'](_0x0a48('0x1d'),_0x5cf9b6[_0x0a48('0x29')]),'form':{'operation':_0x0a48('0x43'),'username':_0x54ee0e,'accessKey':md5(_0x5af476[_0x0a48('0x20')][_0x0a48('0x44')]+_0xbb9ebb)},'json':!![]});}})[_0x0a48('0x2c')](function(_0x38e506){if(_0x38e506[_0x0a48('0x1f')]){return BPromise['resolve'](_0x38e506[_0x0a48('0x20')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x5cf9b6['id']));}})[_0x0a48('0x32')](function(_0x34506e){var _0xea7511=_0x34506e[_0x0a48('0x35')]||0x1f4;logger[_0x0a48('0x22')](_0x0a48('0x23'),_0x0a48('0x45'),_0xea7511,JSON[_0x0a48('0x1e')](_0x34506e));});}function request(_0x564af2){logger[_0x0a48('0x26')](_0x0a48('0x46'),JSON[_0x0a48('0x1e')](_0x564af2));return rp(_0x564af2);}exports['queue']=function(_0x82d82f,_0x30c6b0,_0x3583f3,_0x2d7688,_0xc9acd2,_0x2ebc29){var _0x55558f,_0x4f9eb3,_0x13077b,_0xce7c3c;_0x2ebc29[_0x0a48('0x29')]=intUtil[_0x0a48('0x47')](_0x2ebc29['remoteUri']);if(_0xc9acd2&&_0xc9acd2['monitor_format']){logger['info'](_0x0a48('0x48'),_0x0a48('0x49'));_0x30c6b0[_0x0a48('0x4a')]=util[_0x0a48('0x21')](_0x0a48('0x4b'),_0x2ebc29[_0x0a48('0x4c')],_0x30c6b0[_0x0a48('0x4d')],md5(_0x30c6b0[_0x0a48('0x4d')]));}else{_0x30c6b0[_0x0a48('0x4a')]='';}return getConnection(_0x2ebc29)[_0x0a48('0x2c')](function(_0x350383){_0xce7c3c=_0x350383;return getUser(_0x2ebc29,_0x2d7688[_0x0a48('0x4e')],_0xce7c3c);})[_0x0a48('0x2c')](function(_0x2086c1){_0x55558f=_0x2086c1;logger[_0x0a48('0x26')](_0x0a48('0x4f'),_0x55558f['id']);return getEndUser(_0x2ebc29,_0x30c6b0[_0x0a48('0x50')],_0x30c6b0[_0x0a48('0x51')],_0xce7c3c);})['then'](function(_0x287112){_0x4f9eb3=_0x287112;logger[_0x0a48('0x26')](_0x0a48('0x52'),_0x4f9eb3['id']);return createTicket(_0x2ebc29,_0x55558f,_0x4f9eb3,_0x3583f3,_0x30c6b0,_0x3583f3[_0x0a48('0x53')],_0xce7c3c);})['then'](function(_0x354541){_0x13077b=_0x354541;logger[_0x0a48('0x26')](_0x0a48('0x54'));logger[_0x0a48('0x26')](_0x0a48('0x55'),_0x13077b['id']);var _0x461816=util['format'](_0x0a48('0x56'),_0x2ebc29[_0x0a48('0x29')],_[_0x0a48('0x57')](_0x13077b['id'],'x')[0x1]);logger[_0x0a48('0x26')]('[QUEUE]',_0x0a48('0x58'));emit(util[_0x0a48('0x21')](_0x0a48('0x59'),_0x2d7688[_0x0a48('0x14')]),_0x0a48('0x5a'),{'uri':_0x461816});})[_0x0a48('0x32')](function(_0x42185d){logger[_0x0a48('0x22')](_0x0a48('0x48'),JSON['stringify'](_0x42185d));});};exports[_0x0a48('0x5b')]=function(_0x305fe3,_0x2e6b28,_0x34ab6d,_0x4b0bfc,_0x5b68d4,_0x32403b,_0x7d268c){var _0x13a544,_0x3ccd97,_0x2b152f,_0x2364df;_0x32403b[_0x0a48('0x29')]=intUtil[_0x0a48('0x47')](_0x32403b[_0x0a48('0x29')]);_0x32403b[_0x0a48('0x4c')]=intUtil[_0x0a48('0x47')](_0x32403b[_0x0a48('0x4c')]);if(_0x7d268c&&_0x7d268c[_0x0a48('0x5c')]&&_0x7d268c[_0x0a48('0x5c')]!==_0x0a48('0x5d')){logger['info'](_0x0a48('0x5e'),_0x0a48('0x49'));_0x2e6b28[_0x0a48('0x4a')]=util['format'](_0x0a48('0x4b'),_0x32403b[_0x0a48('0x4c')],_0x2e6b28[_0x0a48('0x4d')],md5(_0x2e6b28[_0x0a48('0x4d')]));}return getConnection(_0x32403b)[_0x0a48('0x2c')](function(_0x4009e2){_0x2364df=_0x4009e2;return getUser(_0x32403b,_0x4b0bfc[_0x0a48('0x4e')],_0x2364df);})[_0x0a48('0x2c')](function(_0x109e5a){_0x13a544=_0x109e5a;logger['info'](_0x0a48('0x4f'),_0x13a544['id']);return getEndUser(_0x32403b,_0x2e6b28[_0x0a48('0x5f')],_0x2e6b28[_0x0a48('0x60')],_0x2364df);})[_0x0a48('0x2c')](function(_0x25b05e){_0x3ccd97=_0x25b05e;logger[_0x0a48('0x26')](_0x0a48('0x52'),_0x3ccd97['id']);return createTicket(_0x32403b,_0x13a544,_0x3ccd97,_0x34ab6d,_0x2e6b28,_0x34ab6d[_0x0a48('0x53')],_0x2364df);})['then'](function(_0x3c6d7a){_0x2b152f=_0x3c6d7a;logger[_0x0a48('0x26')]('Ticket\x20created!');logger[_0x0a48('0x26')](_0x0a48('0x55'),_0x2b152f['id']);var _0x4c7125=util[_0x0a48('0x21')](_0x0a48('0x56'),_0x32403b[_0x0a48('0x29')],_[_0x0a48('0x57')](_0x2b152f['id'],'x')[0x1]);logger[_0x0a48('0x26')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x0a48('0x59'),_0x4b0bfc['name']),_0x0a48('0x5a'),{'uri':_0x4c7125});})[_0x0a48('0x32')](function(_0x788dc1){logger[_0x0a48('0x22')]('[OUTBOUND]',JSON['stringify'](_0x788dc1));});};exports[_0x0a48('0x61')]=function(_0x4afe19,_0x28a4ea,_0x505053,_0x59e5b9,_0x40a838,_0x4bb198){var _0x358f5b,_0x49544b,_0x4d52ae,_0x27ea97;_0x4bb198[_0x0a48('0x29')]=intUtil[_0x0a48('0x47')](_0x4bb198[_0x0a48('0x29')]);_0x4bb198['serverUrl']=intUtil[_0x0a48('0x47')](_0x4bb198[_0x0a48('0x4c')]);if(_0x40a838&&_0x40a838['monitor_format']){logger[_0x0a48('0x26')]('['+_0x28a4ea[_0x0a48('0x62')][_0x0a48('0x63')]()+']',_0x0a48('0x49'));_0x28a4ea[_0x0a48('0x4a')]=util['format'](_0x0a48('0x4b'),_0x4bb198[_0x0a48('0x4c')],_0x28a4ea[_0x0a48('0x4d')],md5(_0x28a4ea[_0x0a48('0x4d')]));}else{_0x28a4ea['recordingURL']='';}return getConnection(_0x4bb198)['then'](function(_0x4953ed){_0x27ea97=_0x4953ed;return getUser(_0x4bb198,'',_0x27ea97);})[_0x0a48('0x2c')](function(_0x21c022){_0x358f5b=_0x21c022;logger[_0x0a48('0x26')](_0x0a48('0x4f'),_0x358f5b['id']);return getEndUser(_0x4bb198,_0x28a4ea[_0x0a48('0x50')],_0x28a4ea[_0x0a48('0x51')],_0x27ea97);})[_0x0a48('0x2c')](function(_0x467fd5){_0x49544b=_0x467fd5;logger['info']('The\x20Enduser\x20ID\x20is:',_0x49544b['id']);return createTicket(_0x4bb198,_0x358f5b,_0x49544b,_0x505053,_0x28a4ea,_0x505053[_0x0a48('0x53')],_0x27ea97);})['then'](function(_0x4bf229){_0x4d52ae=_0x4bf229;logger[_0x0a48('0x26')](_0x0a48('0x54'));logger[_0x0a48('0x26')]('The\x20Ticket\x20ID\x20is:',_0x4d52ae['id']);})[_0x0a48('0x32')](function(_0x31bf74){logger[_0x0a48('0x22')]('['+_0x28a4ea[_0x0a48('0x62')][_0x0a48('0x63')]()+']',JSON[_0x0a48('0x1e')](_0x31bf74));});}; \ 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 7cc3fb2..422db2e 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 _0xe600=['%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','GET','length','map','forEach','type','string','nameField','content','toString','idField','customField','push','variable','variableName','custom_fields','Variable','name','toLowerCase','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x57edeb,_0x135cab){var _0x4c7397=function(_0x44bebf){while(--_0x44bebf){_0x57edeb['push'](_0x57edeb['shift']());}};_0x4c7397(++_0x135cab);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var rp=require(_0x0e60('0x0'));var md5=require('md5');var util=require(_0x0e60('0x1'));var Redis=require(_0x0e60('0x2'));var intUtil=require(_0x0e60('0x3'));var config=require(_0x0e60('0x4'));var logger=require(_0x0e60('0x5'))(_0x0e60('0x6'));config[_0x0e60('0x7')]=_[_0x0e60('0x8')](config[_0x0e60('0x7')],{'host':_0x0e60('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0e60('0x7')]));function emit(_0x497a61,_0x6727dd,_0x30eaed){io['to'](_0x497a61)['emit'](_0x6727dd,_0x30eaed);}var headers={'Content-Type':_0x0e60('0xa'),'Accept':_0x0e60('0xa')};function getTicket(_0x238537,_0x420063,_0x300dfb,_0x1659e4,_0x5e3246){logger[_0x0e60('0xb')](_0x0e60('0xc'));return request({'uri':util[_0x0e60('0xd')](_0x0e60('0xe'),_0x238537[_0x0e60('0xf')]),'method':_0x0e60('0x10'),'body':{'ticket':_[_0x0e60('0x11')]({'requester_id':_0x300dfb['id'],'submitter_id':_0x420063?_0x420063['id']:undefined,'assignee_id':_0x420063?_0x420063['id']:undefined,'tags':getTags(_0x1659e4[_0x0e60('0x12')],'name'),'subject':intUtil[_0x0e60('0x13')](_0x1659e4[_0x0e60('0x14')],_0x5e3246,'\x20'),'description':intUtil[_0x0e60('0x13')](_0x1659e4[_0x0e60('0x15')],_0x5e3246,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0e60('0x13')](_0x1659e4[_0x0e60('0x15')],_0x5e3246,'\x0a')}},getCustomFields(_0x1659e4['Fields'],_0x5e3246))}})[_0x0e60('0x16')](function(_0x508fd0){logger[_0x0e60('0xb')](_0x0e60('0x17'));return _0x508fd0[_0x0e60('0x18')];});}function getUser(_0x5ab4ba,_0x2a8b5a){if(intUtil[_0x0e60('0x19')](_0x2a8b5a)){logger[_0x0e60('0xb')](_0x0e60('0x1a'),_0x2a8b5a);return request({'uri':util[_0x0e60('0xd')]('%s/search.json',_0x5ab4ba[_0x0e60('0xf')]),'qs':{'query':util[_0x0e60('0xd')]('type:user\x20role:agent\x20email:%s',_0x2a8b5a)}})[_0x0e60('0x16')](function(_0x43c09d){if(_0x43c09d[_0x0e60('0x1b')]){logger['info'](_0x0e60('0x1c'));return _['find'](_0x43c09d[_0x0e60('0x1d')],{'email':_0x2a8b5a,'role':_0x0e60('0x1e')});}else{logger[_0x0e60('0xb')](_0x0e60('0x1f'));return request({'uri':util[_0x0e60('0xd')](_0x0e60('0x20'),_0x5ab4ba[_0x0e60('0xf')])})[_0x0e60('0x16')](function(_0x352633){logger[_0x0e60('0xb')](_0x0e60('0x21'));return _0x352633[_0x0e60('0x22')];});}});}else{logger[_0x0e60('0xb')](_0x0e60('0x1f'));return request({'uri':util[_0x0e60('0xd')](_0x0e60('0x20'),_0x5ab4ba[_0x0e60('0xf')])})[_0x0e60('0x16')](function(_0x21206a){logger['info'](_0x0e60('0x21'));return _0x21206a[_0x0e60('0x22')];});}}function getEndUser(_0x5ea254,_0x10451f,_0x5ddd18){logger[_0x0e60('0xb')]('Searching\x20enduser\x20with\x20phone',_0x5ddd18);return request({'uri':util['format'](_0x0e60('0x23'),_0x5ea254[_0x0e60('0xf')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x5ddd18)}})[_0x0e60('0x16')](function(_0x54d7ce){var _0x73e732;if(_0x54d7ce['results']['length']){_0x54d7ce[_0x0e60('0x1d')]=_[_0x0e60('0x24')](_0x54d7ce[_0x0e60('0x1d')],{'suspended':![],'role':'end-user'});if(_0x54d7ce[_0x0e60('0x1d')]['length']){_0x73e732=_[_0x0e60('0x25')](_0x54d7ce[_0x0e60('0x1d')]);}}if(_0x73e732){logger[_0x0e60('0xb')]('Enduser\x20found!');return _0x73e732;}else{logger[_0x0e60('0xb')](_0x0e60('0x26'));return request({'uri':util[_0x0e60('0xd')]('%s/users.json',_0x5ea254[_0x0e60('0xf')]),'method':_0x0e60('0x10'),'body':{'user':{'role':_0x0e60('0x27'),'name':util[_0x0e60('0xd')](_0x0e60('0x28'),_0x10451f||_0x5ddd18),'phone':_0x5ddd18}}})['then'](function(_0xf53f36){logger['info'](_0x0e60('0x29'));return _0xf53f36['user'];});}});}function getAuth(_0x442223){var _0x2388a7;if(_0x442223[_0x0e60('0x2a')]==='password'){_0x2388a7=util[_0x0e60('0xd')](_0x0e60('0x2b'),_0x442223[_0x0e60('0x2c')],_0x442223[_0x0e60('0x2d')]);}else if(_0x442223[_0x0e60('0x2a')]===_0x0e60('0x2e')){_0x2388a7=util[_0x0e60('0xd')](_0x0e60('0x2f'),_0x442223[_0x0e60('0x2c')],_0x442223[_0x0e60('0x2e')]);}return util[_0x0e60('0xd')](_0x0e60('0x30'),new Buffer(_0x2388a7)['toString'](_0x0e60('0x31')));}function request(_0x246268){logger[_0x0e60('0x32')](_0x0e60('0x33'),JSON['stringify'](_0x246268));return rp(_['defaults'](_0x246268,{'method':_0x0e60('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x55ea74,_0x29ac4b){var _0x52759f=[];if(_0x55ea74&&_0x55ea74[_0x0e60('0x35')]>0x0){_0x52759f=_[_0x0e60('0x36')](_0x55ea74,_0x29ac4b);}return _0x52759f;}function getCustomFields(_0x274203,_0xa9514d){var _0x44deb8=[];var _0x25761d={'custom_fields':[]};if(_0x274203[_0x0e60('0x35')]>0x0){_[_0x0e60('0x37')](_0x274203,function(_0x2427a8){if(_0x2427a8[_0x0e60('0x38')]===_0x0e60('0x39')&&_0x2427a8[_0x0e60('0x3a')]&&!_0x2427a8['customField']){_0x25761d[_0x2427a8[_0x0e60('0x3a')]['toLowerCase']()]=_0x2427a8[_0x0e60('0x3b')][_0x0e60('0x3c')]();}else if(_0x2427a8['type']==='string'&&_0x2427a8[_0x0e60('0x3d')]&&_0x2427a8[_0x0e60('0x3e')]){_0x25761d['custom_fields'][_0x0e60('0x3f')]({'id':_0x2427a8[_0x0e60('0x3d')],'value':_0x2427a8['content'][_0x0e60('0x3c')]()});}else if(_0x2427a8[_0x0e60('0x38')]===_0x0e60('0x40')&&_0x2427a8[_0x0e60('0x41')]&&_0x2427a8[_0x0e60('0x3d')]&&_0x2427a8[_0x0e60('0x3e')]){_0xa9514d[_0x2427a8[_0x0e60('0x41')]]&&_0x25761d[_0x0e60('0x42')][_0x0e60('0x3f')]({'id':_0x2427a8['idField'],'value':_0xa9514d[_0x2427a8['variableName']]['toString']()});}else if(_0x2427a8[_0x0e60('0x38')]==='customVariable'&&_0x2427a8[_0x0e60('0x43')]&&_0x2427a8[_0x0e60('0x43')][_0x0e60('0x44')]&&_0x2427a8['idField']&&_0x2427a8[_0x0e60('0x3e')]){_0xa9514d[_0x2427a8[_0x0e60('0x43')]['name']['toLowerCase']()]&&_0x25761d[_0x0e60('0x42')][_0x0e60('0x3f')]({'id':_0x2427a8[_0x0e60('0x3d')],'value':_0xa9514d[_0x2427a8[_0x0e60('0x43')][_0x0e60('0x44')][_0x0e60('0x45')]()]['toString']()});}});}return _0x25761d;}exports[_0x0e60('0x46')]=function(_0x72d332,_0x26aa19,_0x29ea88,_0x351a89,_0x557431,_0x5abbb4){var _0x527b77,_0x36f90e;_0x5abbb4[_0x0e60('0xf')]=intUtil[_0x0e60('0x47')](_0x5abbb4[_0x0e60('0xf')]);_0x5abbb4['serverUrl']=intUtil['stripTrailingSlash'](_0x5abbb4['serverUrl']);if(_0x557431&&_0x557431[_0x0e60('0x48')]){logger[_0x0e60('0xb')](_0x0e60('0x49'),_0x0e60('0x4a'));_0x26aa19[_0x0e60('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5abbb4[_0x0e60('0x4c')],_0x26aa19[_0x0e60('0x4d')],md5(_0x26aa19[_0x0e60('0x4d')]));}else{_0x26aa19[_0x0e60('0x4b')]='';}headers['Authorization']=getAuth(_0x5abbb4);return getUser(_0x5abbb4,_0x351a89[_0x0e60('0x4e')])[_0x0e60('0x16')](function(_0x41b65a){_0x527b77=_0x41b65a;logger['info'](_0x0e60('0x4f'),_0x527b77['id']);return getEndUser(_0x5abbb4,_0x26aa19[_0x0e60('0x50')],_0x26aa19['calleridnum']);})[_0x0e60('0x16')](function(_0x4bbcb4){_0x36f90e=_0x4bbcb4;logger[_0x0e60('0xb')](_0x0e60('0x51'),_0x36f90e['id']);return getTicket(_0x5abbb4,_0x527b77,_0x36f90e,_0x29ea88,_0x26aa19);})[_0x0e60('0x16')](function(_0x2e887c){if(_0x2e887c){logger[_0x0e60('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2e887c['id']);switch(_0x5abbb4[_0x0e60('0x38')]){case _0x0e60('0x52'):logger[_0x0e60('0xb')](_0x0e60('0x49'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0e60('0xd')](_0x0e60('0x53'),_0x5abbb4[_0x0e60('0xf')],_0x527b77['id'],_0x2e887c['id']),'method':_0x0e60('0x10')});case'newTab':logger[_0x0e60('0xb')]('[QUEUE]',_0x0e60('0x54'));emit(util[_0x0e60('0xd')](_0x0e60('0x55'),_0x351a89[_0x0e60('0x44')]),_0x0e60('0x56'),{'uri':util[_0x0e60('0xd')](_0x0e60('0x57'),_0x5abbb4['remoteUri'],_0x2e887c['id'])});break;default:logger[_0x0e60('0x58')]('[QUEUE]',_0x0e60('0x59'));}}})[_0x0e60('0x5a')](function(_0x33795d){logger[_0x0e60('0x58')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x33795d,{'showHidden':!![],'depth':null}));});};exports[_0x0e60('0x5b')]=function(_0x5a6c01,_0x2893f1,_0x3caf7d,_0x313dd2,_0x24ada9,_0x2bae5c,_0xd8a53f){var _0x402ab4,_0xd5298e;_0x2bae5c['remoteUri']=intUtil[_0x0e60('0x47')](_0x2bae5c[_0x0e60('0xf')]);_0x2bae5c[_0x0e60('0x4c')]=intUtil[_0x0e60('0x47')](_0x2bae5c[_0x0e60('0x4c')]);if(_0xd8a53f&&_0xd8a53f['recordingFormat']&&_0xd8a53f[_0x0e60('0x5c')]!==_0x0e60('0x5d')){logger[_0x0e60('0xb')](_0x0e60('0x5e'),'Recording\x20is\x20enabled!');_0x2893f1[_0x0e60('0x4b')]=util['format'](_0x0e60('0x5f'),_0x2bae5c[_0x0e60('0x4c')],_0x2893f1[_0x0e60('0x4d')],md5(_0x2893f1[_0x0e60('0x4d')]));}headers[_0x0e60('0x60')]=getAuth(_0x2bae5c);return getUser(_0x2bae5c,_0x313dd2['email'])[_0x0e60('0x16')](function(_0xa55a18){_0x402ab4=_0xa55a18;logger['info'](_0x0e60('0x4f'),_0x402ab4['id']);return getEndUser(_0x2bae5c,_0x2893f1['destcalleridname'],_0x2893f1[_0x0e60('0x61')]);})[_0x0e60('0x16')](function(_0x5e50ad){_0xd5298e=_0x5e50ad;logger['info'](_0x0e60('0x51'),_0xd5298e['id']);return getTicket(_0x2bae5c,_0x402ab4,_0xd5298e,_0x3caf7d,_0x2893f1);})[_0x0e60('0x16')](function(_0x5b21a2){if(_0x5b21a2){logger['info'](_0x0e60('0x62'),_0x5b21a2['id']);switch(_0x2bae5c[_0x0e60('0x38')]){case _0x0e60('0x52'):logger[_0x0e60('0xb')]('[OUTBOUND]',_0x0e60('0x63'));return request({'uri':util[_0x0e60('0xd')](_0x0e60('0x53'),_0x2bae5c['remoteUri'],_0x402ab4['id'],_0x5b21a2['id']),'method':_0x0e60('0x10')});case _0x0e60('0x64'):logger['info'](_0x0e60('0x5e'),_0x0e60('0x54'));emit(util['format'](_0x0e60('0x55'),_0x313dd2[_0x0e60('0x44')]),'trigger:browser:url',{'uri':util['format'](_0x0e60('0x57'),_0x2bae5c[_0x0e60('0xf')],_0x5b21a2['id'])});break;default:logger[_0x0e60('0x58')](_0x0e60('0x5e'),_0x0e60('0x59'));}}})[_0x0e60('0x5a')](function(_0x2ae7b3){logger[_0x0e60('0x58')](_0x0e60('0x65'),util[_0x0e60('0x66')](_0x2ae7b3,{'showHidden':!![],'depth':null}));});};exports[_0x0e60('0x67')]=function(_0x280ad0,_0x2546f8,_0x195628,_0x19954d,_0x200d81,_0x635c6){var _0x51bd75,_0x5e1127;_0x635c6[_0x0e60('0xf')]=intUtil[_0x0e60('0x47')](_0x635c6[_0x0e60('0xf')]);_0x635c6['serverUrl']=intUtil[_0x0e60('0x47')](_0x635c6[_0x0e60('0x4c')]);if(_0x200d81&&_0x200d81['monitor_format']){logger[_0x0e60('0xb')]('['+_0x2546f8[_0x0e60('0x68')][_0x0e60('0x69')]()+']','Recording\x20is\x20enabled!');_0x2546f8['recordingURL']=util[_0x0e60('0xd')](_0x0e60('0x5f'),_0x635c6[_0x0e60('0x4c')],_0x2546f8[_0x0e60('0x4d')],md5(_0x2546f8[_0x0e60('0x4d')]));}else{_0x2546f8[_0x0e60('0x4b')]='';}headers[_0x0e60('0x60')]=getAuth(_0x635c6);return getUser(_0x635c6)[_0x0e60('0x16')](function(_0x21baa9){_0x51bd75=_0x21baa9;logger[_0x0e60('0xb')](_0x0e60('0x4f'),_0x51bd75['id']);return getEndUser(_0x635c6,_0x2546f8['calleridname'],_0x2546f8[_0x0e60('0x6a')]);})[_0x0e60('0x16')](function(_0x3aa271){_0x5e1127=_0x3aa271;logger[_0x0e60('0xb')](_0x0e60('0x51'),_0x5e1127['id']);return getTicket(_0x635c6,_0x51bd75,_0x5e1127,_0x195628,_0x2546f8);})[_0x0e60('0x16')](function(_0x19af81){if(_0x19af81){logger[_0x0e60('0xb')](_0x0e60('0x62'),_0x19af81['id']);}})['catch'](function(_0x321afc){logger[_0x0e60('0x58')]('['+_0x2546f8[_0x0e60('0x68')][_0x0e60('0x69')]()+']'+_0x0e60('0x6b'),util[_0x0e60('0x66')](_0x321afc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x750a=['error','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','format','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','password','username','token','%s/token:%s','base64','debug','stringify','GET','forEach','type','customField','nameField','content','toString','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','%s/agent/tickets/%s'];(function(_0x4ce61c,_0x1c5a2d){var _0x570918=function(_0x3275f9){while(--_0x3275f9){_0x4ce61c['push'](_0x4ce61c['shift']());}};_0x570918(++_0x1c5a2d);}(_0x750a,0x140));var _0xa750=function(_0x1dad4b,_0x476d05){_0x1dad4b=_0x1dad4b-0x0;var _0x45f5d0=_0x750a[_0x1dad4b];return _0x45f5d0;};'use strict';var _=require('lodash');var rp=require(_0xa750('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xa750('0x1'));var intUtil=require(_0xa750('0x2'));var config=require(_0xa750('0x3'));var logger=require(_0xa750('0x4'))(_0xa750('0x5'));config[_0xa750('0x6')]=_[_0xa750('0x7')](config[_0xa750('0x6')],{'host':_0xa750('0x8'),'port':0x18eb});var io=require(_0xa750('0x9'))(new Redis(config[_0xa750('0x6')]));function emit(_0x1ae455,_0x3d7c43,_0x47a4dd){io['to'](_0x1ae455)['emit'](_0x3d7c43,_0x47a4dd);}var headers={'Content-Type':_0xa750('0xa'),'Accept':'application/json'};function getTicket(_0x4458b1,_0x1760f5,_0x51f594,_0x264284,_0x2c2ea4){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xa750('0xb')]('%s/tickets.json',_0x4458b1[_0xa750('0xc')]),'method':_0xa750('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x51f594['id'],'submitter_id':_0x1760f5?_0x1760f5['id']:undefined,'assignee_id':_0x1760f5?_0x1760f5['id']:undefined,'tags':getTags(_0x264284[_0xa750('0xe')],_0xa750('0xf')),'subject':intUtil[_0xa750('0x10')](_0x264284['Subjects'],_0x2c2ea4,'\x20'),'description':intUtil[_0xa750('0x10')](_0x264284[_0xa750('0x11')],_0x2c2ea4,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa750('0x10')](_0x264284[_0xa750('0x11')],_0x2c2ea4,'\x0a')}},getCustomFields(_0x264284[_0xa750('0x12')],_0x2c2ea4))}})[_0xa750('0x13')](function(_0x5806ed){logger[_0xa750('0x14')](_0xa750('0x15'));return _0x5806ed[_0xa750('0x16')];});}function getUser(_0x49fe3b,_0x337095){if(intUtil[_0xa750('0x17')](_0x337095)){logger['info']('Getting\x20agent\x20with\x20email',_0x337095);return request({'uri':util[_0xa750('0xb')]('%s/search.json',_0x49fe3b[_0xa750('0xc')]),'qs':{'query':util[_0xa750('0xb')]('type:user\x20role:agent\x20email:%s',_0x337095)}})[_0xa750('0x13')](function(_0x500a84){if(_0x500a84['count']){logger[_0xa750('0x14')]('Agent\x20found!');return _[_0xa750('0x18')](_0x500a84['results'],{'email':_0x337095,'role':_0xa750('0x19')});}else{logger['info'](_0xa750('0x1a'));return request({'uri':util['format'](_0xa750('0x1b'),_0x49fe3b['remoteUri'])})['then'](function(_0xaa9d3e){logger['info'](_0xa750('0x1c'));return _0xaa9d3e['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xa750('0x1b'),_0x49fe3b[_0xa750('0xc')])})[_0xa750('0x13')](function(_0x384d48){logger[_0xa750('0x14')](_0xa750('0x1c'));return _0x384d48[_0xa750('0x1d')];});}}function getEndUser(_0x7e22ad,_0x3d52b3,_0x94697a){logger[_0xa750('0x14')](_0xa750('0x1e'),_0x94697a);return request({'uri':util[_0xa750('0xb')](_0xa750('0x1f'),_0x7e22ad[_0xa750('0xc')]),'qs':{'query':util['format'](_0xa750('0x20'),_0x94697a)}})[_0xa750('0x13')](function(_0x21cd2c){var _0x4cceee;if(_0x21cd2c[_0xa750('0x21')][_0xa750('0x22')]){_0x21cd2c[_0xa750('0x21')]=_[_0xa750('0x23')](_0x21cd2c['results'],{'suspended':![],'role':_0xa750('0x24')});if(_0x21cd2c[_0xa750('0x21')][_0xa750('0x22')]){_0x4cceee=_[_0xa750('0x25')](_0x21cd2c[_0xa750('0x21')]);}}if(_0x4cceee){logger['info'](_0xa750('0x26'));return _0x4cceee;}else{logger['info'](_0xa750('0x27'));return request({'uri':util[_0xa750('0xb')]('%s/users.json',_0x7e22ad[_0xa750('0xc')]),'method':_0xa750('0xd'),'body':{'user':{'role':_0xa750('0x24'),'name':util[_0xa750('0xb')](_0xa750('0x28'),_0x3d52b3||_0x94697a),'phone':_0x94697a}}})[_0xa750('0x13')](function(_0x31066b){logger[_0xa750('0x14')]('Enduser\x20created.');return _0x31066b[_0xa750('0x1d')];});}});}function getAuth(_0x52f202){var _0x18d040;if(_0x52f202[_0xa750('0x29')]===_0xa750('0x2a')){_0x18d040=util[_0xa750('0xb')]('%s:%s',_0x52f202[_0xa750('0x2b')],_0x52f202[_0xa750('0x2a')]);}else if(_0x52f202['authType']===_0xa750('0x2c')){_0x18d040=util[_0xa750('0xb')](_0xa750('0x2d'),_0x52f202[_0xa750('0x2b')],_0x52f202['token']);}return util[_0xa750('0xb')]('Basic\x20%s',new Buffer(_0x18d040)['toString'](_0xa750('0x2e')));}function request(_0x146cad){logger[_0xa750('0x2f')]('[HTTP]',JSON[_0xa750('0x30')](_0x146cad));return rp(_[_0xa750('0x7')](_0x146cad,{'method':_0xa750('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x53ad23,_0x37abd2){var _0xca7f52=[];if(_0x53ad23&&_0x53ad23[_0xa750('0x22')]>0x0){_0xca7f52=_['map'](_0x53ad23,_0x37abd2);}return _0xca7f52;}function getCustomFields(_0x1d09fb,_0x2c660e){var _0x4200e6=[];var _0x4b6438={'custom_fields':[]};if(_0x1d09fb[_0xa750('0x22')]>0x0){_[_0xa750('0x32')](_0x1d09fb,function(_0x1e579b){if(_0x1e579b[_0xa750('0x33')]==='string'&&_0x1e579b['nameField']&&!_0x1e579b[_0xa750('0x34')]){_0x4b6438[_0x1e579b[_0xa750('0x35')]['toLowerCase']()]=_0x1e579b[_0xa750('0x36')][_0xa750('0x37')]();}else if(_0x1e579b[_0xa750('0x33')]===_0xa750('0x38')&&_0x1e579b[_0xa750('0x39')]&&_0x1e579b['customField']){_0x4b6438[_0xa750('0x3a')][_0xa750('0x3b')]({'id':_0x1e579b[_0xa750('0x39')],'value':_0x1e579b[_0xa750('0x36')][_0xa750('0x37')]()});}else if(_0x1e579b[_0xa750('0x33')]===_0xa750('0x3c')&&_0x1e579b['variableName']&&_0x1e579b[_0xa750('0x39')]&&_0x1e579b['customField']){_0x2c660e[_0x1e579b[_0xa750('0x3d')]]&&_0x4b6438['custom_fields'][_0xa750('0x3b')]({'id':_0x1e579b[_0xa750('0x39')],'value':_0x2c660e[_0x1e579b[_0xa750('0x3d')]][_0xa750('0x37')]()});}else if(_0x1e579b[_0xa750('0x33')]===_0xa750('0x3e')&&_0x1e579b[_0xa750('0x3f')]&&_0x1e579b[_0xa750('0x3f')][_0xa750('0xf')]&&_0x1e579b[_0xa750('0x39')]&&_0x1e579b[_0xa750('0x34')]){_0x2c660e[_0x1e579b[_0xa750('0x3f')][_0xa750('0xf')][_0xa750('0x40')]()]&&_0x4b6438[_0xa750('0x3a')][_0xa750('0x3b')]({'id':_0x1e579b[_0xa750('0x39')],'value':_0x2c660e[_0x1e579b[_0xa750('0x3f')][_0xa750('0xf')][_0xa750('0x40')]()]['toString']()});}});}return _0x4b6438;}exports[_0xa750('0x41')]=function(_0x302a2e,_0x1e397b,_0xedd9e,_0x22253f,_0x3f588a,_0x3527e7){var _0x1f0500,_0x3534b1;_0x3527e7['remoteUri']=intUtil[_0xa750('0x42')](_0x3527e7[_0xa750('0xc')]);_0x3527e7['serverUrl']=intUtil[_0xa750('0x42')](_0x3527e7[_0xa750('0x43')]);if(_0x3f588a&&_0x3f588a[_0xa750('0x44')]){logger[_0xa750('0x14')](_0xa750('0x45'),_0xa750('0x46'));_0x1e397b[_0xa750('0x47')]=util[_0xa750('0xb')](_0xa750('0x48'),_0x3527e7[_0xa750('0x43')],_0x1e397b['uniqueid'],md5(_0x1e397b[_0xa750('0x49')]));}else{_0x1e397b[_0xa750('0x47')]='';}headers['Authorization']=getAuth(_0x3527e7);return getUser(_0x3527e7,_0x22253f[_0xa750('0x4a')])[_0xa750('0x13')](function(_0x3501ee){_0x1f0500=_0x3501ee;logger['info'](_0xa750('0x4b'),_0x1f0500['id']);return getEndUser(_0x3527e7,_0x1e397b[_0xa750('0x4c')],_0x1e397b[_0xa750('0x4d')]);})[_0xa750('0x13')](function(_0x5ae5ab){_0x3534b1=_0x5ae5ab;logger[_0xa750('0x14')](_0xa750('0x4e'),_0x3534b1['id']);return getTicket(_0x3527e7,_0x1f0500,_0x3534b1,_0xedd9e,_0x1e397b);})[_0xa750('0x13')](function(_0xed4f88){if(_0xed4f88){logger['info'](_0xa750('0x4f'),_0xed4f88['id']);switch(_0x3527e7[_0xa750('0x33')]){case'integrationTab':logger[_0xa750('0x14')]('[QUEUE]',_0xa750('0x50'));return request({'uri':util[_0xa750('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3527e7['remoteUri'],_0x1f0500['id'],_0xed4f88['id']),'method':'POST'});case _0xa750('0x51'):logger[_0xa750('0x14')]('[QUEUE]',_0xa750('0x52'));emit(util[_0xa750('0xb')](_0xa750('0x53'),_0x22253f['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x3527e7[_0xa750('0xc')],_0xed4f88['id'])});break;default:logger['error'](_0xa750('0x45'),_0xa750('0x54'));}}})['catch'](function(_0x1647c3){logger['error'](_0xa750('0x55'),util['inspect'](_0x1647c3,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5940be,_0x495457,_0x356147,_0x40dac2,_0x5f1313,_0x552578,_0x4faeda){var _0x42b238,_0x22b022;_0x552578[_0xa750('0xc')]=intUtil[_0xa750('0x42')](_0x552578[_0xa750('0xc')]);_0x552578[_0xa750('0x43')]=intUtil['stripTrailingSlash'](_0x552578['serverUrl']);if(_0x4faeda&&_0x4faeda[_0xa750('0x56')]&&_0x4faeda[_0xa750('0x56')]!==_0xa750('0x57')){logger[_0xa750('0x14')](_0xa750('0x58'),'Recording\x20is\x20enabled!');_0x495457[_0xa750('0x47')]=util[_0xa750('0xb')](_0xa750('0x48'),_0x552578[_0xa750('0x43')],_0x495457[_0xa750('0x49')],md5(_0x495457[_0xa750('0x49')]));}headers[_0xa750('0x59')]=getAuth(_0x552578);return getUser(_0x552578,_0x40dac2[_0xa750('0x4a')])['then'](function(_0x2aa1d6){_0x42b238=_0x2aa1d6;logger[_0xa750('0x14')](_0xa750('0x4b'),_0x42b238['id']);return getEndUser(_0x552578,_0x495457[_0xa750('0x5a')],_0x495457[_0xa750('0x5b')]);})['then'](function(_0xcad347){_0x22b022=_0xcad347;logger[_0xa750('0x14')](_0xa750('0x4e'),_0x22b022['id']);return getTicket(_0x552578,_0x42b238,_0x22b022,_0x356147,_0x495457);})[_0xa750('0x13')](function(_0x40e193){if(_0x40e193){logger[_0xa750('0x14')](_0xa750('0x4f'),_0x40e193['id']);switch(_0x552578[_0xa750('0x33')]){case _0xa750('0x5c'):logger[_0xa750('0x14')](_0xa750('0x58'),_0xa750('0x50'));return request({'uri':util[_0xa750('0xb')](_0xa750('0x5d'),_0x552578[_0xa750('0xc')],_0x42b238['id'],_0x40e193['id']),'method':_0xa750('0xd')});case'newTab':logger[_0xa750('0x14')]('[OUTBOUND]',_0xa750('0x52'));emit(util[_0xa750('0xb')](_0xa750('0x53'),_0x40dac2['name']),_0xa750('0x5e'),{'uri':util[_0xa750('0xb')](_0xa750('0x5f'),_0x552578[_0xa750('0xc')],_0x40e193['id'])});break;default:logger[_0xa750('0x60')](_0xa750('0x58'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xa750('0x61')](function(_0x117fb5){logger['error'](_0xa750('0x62'),util[_0xa750('0x63')](_0x117fb5,{'showHidden':!![],'depth':null}));});};exports[_0xa750('0x64')]=function(_0xe4d85b,_0x3255c7,_0x1b7597,_0x28f477,_0xc0b61b,_0x1af7bb){var _0x8c5a88,_0x45225a;_0x1af7bb['remoteUri']=intUtil['stripTrailingSlash'](_0x1af7bb[_0xa750('0xc')]);_0x1af7bb[_0xa750('0x43')]=intUtil[_0xa750('0x42')](_0x1af7bb[_0xa750('0x43')]);if(_0xc0b61b&&_0xc0b61b['monitor_format']){logger[_0xa750('0x14')]('['+_0x3255c7[_0xa750('0x65')][_0xa750('0x66')]()+']',_0xa750('0x46'));_0x3255c7[_0xa750('0x47')]=util[_0xa750('0xb')](_0xa750('0x48'),_0x1af7bb[_0xa750('0x43')],_0x3255c7[_0xa750('0x49')],md5(_0x3255c7[_0xa750('0x49')]));}else{_0x3255c7[_0xa750('0x47')]='';}headers['Authorization']=getAuth(_0x1af7bb);return getUser(_0x1af7bb)['then'](function(_0x477d65){_0x8c5a88=_0x477d65;logger['info']('The\x20User\x20ID\x20is:',_0x8c5a88['id']);return getEndUser(_0x1af7bb,_0x3255c7[_0xa750('0x4c')],_0x3255c7[_0xa750('0x4d')]);})[_0xa750('0x13')](function(_0x2a3438){_0x45225a=_0x2a3438;logger[_0xa750('0x14')]('The\x20Enduser\x20ID\x20is:',_0x45225a['id']);return getTicket(_0x1af7bb,_0x8c5a88,_0x45225a,_0x1b7597,_0x3255c7);})[_0xa750('0x13')](function(_0x217222){if(_0x217222){logger[_0xa750('0x14')](_0xa750('0x4f'),_0x217222['id']);}})[_0xa750('0x61')](function(_0x1eff4e){logger['error']('['+_0x3255c7['lastevent'][_0xa750('0x66')]()+']'+_0xa750('0x67'),util[_0xa750('0x63')](_0x1eff4e,{'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 312f481..3c1d1a9 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 _0x7708=['contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','lead','nothing','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','YYYY-MM-DDTHH:mm:ss','Call_Type','merge','Fields','POST','/crm/v2/Calls','code','Call\x20created!','err','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridname','Outbound','toUpperCase','lodash','request-promise','util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','debug','[HTTP]','length','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch'];(function(_0x5f289d,_0x341183){var _0x2d979b=function(_0x20271b){while(--_0x20271b){_0x5f289d['push'](_0x5f289d['shift']());}};_0x2d979b(++_0x341183);}(_0x7708,0x188));var _0x8770=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x7708[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x8770('0x0'));var rp=require(_0x8770('0x1'));var md5=require('md5');var util=require(_0x8770('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x8770('0x3'));var logger=require(_0x8770('0x4'))('zoho');config[_0x8770('0x5')]=_['defaults'](config[_0x8770('0x5')],{'host':_0x8770('0x6'),'port':0x18eb});var io=require(_0x8770('0x7'))(new Redis(config[_0x8770('0x5')]));function emit(_0x212b12,_0x3e1113,_0x2d4a1d){io['to'](_0x212b12)['emit'](_0x3e1113,_0x2d4a1d);}function request(_0x396322){logger[_0x8770('0x8')](_0x8770('0x9'),JSON['stringify'](_0x396322));return rp(_0x396322);}function getCustomFields(_0x390af0,_0x10e4a3){var _0x3bbee2={};if(_0x390af0[_0x8770('0xa')]>0x0){_['forEach'](_0x390af0,function(_0x179fd8){if(_0x179fd8[_0x8770('0xb')]===_0x8770('0xc')&&_0x179fd8['idField']){_0x3bbee2[_0x179fd8[_0x8770('0xd')]]=_0x179fd8[_0x8770('0xe')][_0x8770('0xf')]();}else if(_0x179fd8[_0x8770('0xb')]===_0x8770('0x10')&&_0x179fd8[_0x8770('0x11')]&&_0x179fd8[_0x8770('0xd')]&&_0x10e4a3[_0x179fd8[_0x8770('0x11')]]){_0x3bbee2[_0x179fd8['idField']]=_0x10e4a3[_0x179fd8[_0x8770('0x11')]][_0x8770('0xf')]();}else if(_0x179fd8['type']===_0x8770('0x12')&&_0x179fd8['Variable']&&_0x179fd8[_0x8770('0x13')]['name']&&_0x179fd8['idField']&&_0x10e4a3[_0x179fd8['Variable'][_0x8770('0x14')][_0x8770('0x15')]()]){_0x3bbee2[_0x179fd8[_0x8770('0xd')]]=_0x10e4a3[_0x179fd8[_0x8770('0x13')]['name']['toLowerCase']()][_0x8770('0xf')]();}});}return _0x3bbee2;}function getName(_0xfe176a){if(_0xfe176a[_0x8770('0x16')]('\x20')>0x0){var _0xe838b5=_0xfe176a[_0x8770('0x17')](/ (.+)/);if(_0xe838b5[0x1]){return _0xe838b5;}}return[_0xfe176a,_0xfe176a];}var accountsTokens={};function getAccessToken(_0x4e1fa6){return new Promise(function(_0x3e1fe7,_0x1234dd){if(!_[_0x8770('0x18')](accountsTokens[_0x4e1fa6['id']])&&!_[_0x8770('0x18')](accountsTokens[_0x4e1fa6['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x4e1fa6['id']][_0x8770('0x19')])){_0x3e1fe7(accountsTokens[_0x4e1fa6['id']][_0x8770('0x1a')]);}}var _0x443716;switch(_0x4e1fa6[_0x8770('0x1b')]){case'US':_0x443716=_0x8770('0x1c');break;case'AU':_0x443716=_0x8770('0x1d');break;case'EU':_0x443716='https://accounts.zoho.eu';break;case'IN':_0x443716=_0x8770('0x1e');break;case'CN':_0x443716=_0x8770('0x1f');break;default:_0x443716=_0x8770('0x20');break;}var _0x2515c5={'method':'POST','uri':_0x443716+_0x8770('0x21'),'qs':{'refresh_token':_0x4e1fa6['refreshToken'],'client_id':_0x4e1fa6[_0x8770('0x22')],'client_secret':_0x4e1fa6[_0x8770('0x23')],'grant_type':_0x8770('0x24')},'json':!![]};return rp(_0x2515c5)[_0x8770('0x25')](function(_0x1538b2){accountsTokens[_0x4e1fa6['id']]={'access_token':_0x1538b2[_0x8770('0x1a')],'expires_in':moment()[_0x8770('0x26')](_0x1538b2[_0x8770('0x19')],_0x8770('0x27'))};_0x3e1fe7(_0x1538b2[_0x8770('0x1a')]);})['catch'](function(_0x1a7440){logger[_0x8770('0x28')](_0x8770('0x29'),_0x1a7440[_0x8770('0x2a')]);_0x1234dd(_0x1a7440);});});}function getUser(_0x246128,_0x200a82,_0x5ae7b8,_0x4b284b){logger[_0x8770('0x2b')](_0x8770('0x2c'));return request({'method':_0x8770('0x2d'),'uri':util[_0x8770('0x2e')](_0x8770('0x2f'),_0x200a82),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x246128},'json':!![]})[_0x8770('0x25')](function(_0x144c24){if(_0x144c24[_0x8770('0x30')]){var _0x2c2c77=-0x1;if(_['isArrayLikeObject'](_0x144c24[_0x8770('0x30')])){if(!_['isNil'](_0x4b284b)){_0x2c2c77=_['findIndex'](_0x144c24[_0x8770('0x30')],function(_0x4f8182){return _0x4f8182[_0x8770('0x31')]===_0x4b284b;});}if(_0x2c2c77>=0x0){logger[_0x8770('0x2b')](_0x8770('0x32'));}else{logger[_0x8770('0x2b')](_0x8770('0x33'));_0x2c2c77=_[_0x8770('0x34')](_0x144c24[_0x8770('0x30')],function(_0x69d59f){return _0x69d59f[_0x8770('0x35')]['name']===_0x8770('0x36');});}return _0x144c24[_0x8770('0x30')][_0x2c2c77];}else{if(_0x144c24[_0x8770('0x37')]['profile']['name']===_0x8770('0x36')){logger[_0x8770('0x2b')](_0x8770('0x33'));user=_0x144c24['user'];return user;}else{logger[_0x8770('0x28')]('The\x20failing\x20result\x20is',JSON[_0x8770('0x38')](_0x144c24));throw new Error(_0x8770('0x39')+JSON[_0x8770('0x38')](_0x144c24));}}}else{logger[_0x8770('0x28')](_0x8770('0x3a'),JSON[_0x8770('0x38')](_0x144c24));throw new Error(_0x8770('0x39')+JSON[_0x8770('0x38')](_0x144c24));}})[_0x8770('0x3b')](function(_0xfc8e37){console['error'](_0xfc8e37);});}function getZohoUser(_0x565890,_0x14b0c7){return new BPromise(function(_0x24b870,_0x5b2825){request(_0x565890)[_0x8770('0x25')](function(_0x5ec54){var _0x27f91c=null;if(_0x5ec54){_0x27f91c=_0x5ec54[_0x8770('0x3c')][0x0];_0x27f91c[_0x8770('0x3d')]=_0x14b0c7;}_0x24b870(_0x27f91c);})[_0x8770('0x3b')](function(_0x4e7860){_0x5b2825(_0x4e7860);});});}function createEndUser(_0xbf9f7c,_0x4ced7f,_0x3cdaa6,_0x57f52e,_0x41134a,_0x411c54){var _0x3cdaa6=getName(_0x3cdaa6);return request({'method':'POST','uri':_0x8770('0x3e')+_0x4ced7f+_0x8770('0x3f')+_[_0x8770('0x40')](_0x411c54[_0x8770('0x41')])+'s','body':{'data':[{'Last_Name':_0x3cdaa6[0x1],'First_Name':_0x3cdaa6[0x0],'Phone':_0x57f52e,'Owner':{'name':!_[_0x8770('0x18')](_0x41134a[_0x8770('0x42')]['name'])?_0x41134a[_0x8770('0x42')]['name']:!_['isNil'](_0x41134a[_0x8770('0x43')])?_0x41134a[_0x8770('0x43')]+'\x20'+_0x41134a[_0x8770('0x44')]:_0x41134a[_0x8770('0x44')],'id':_0x41134a['id']}}]},'headers':{'Authorization':_0x8770('0x45')+_0xbf9f7c},'json':!![]})['then'](function(_0x35b182){if(_0x35b182&&_0x35b182[_0x8770('0x3c')][0x0]['code']===_0x8770('0x46')){var _0x48aa14=_0x35b182[_0x8770('0x3c')][0x0][_0x8770('0x47')];_0x48aa14[_0x8770('0x3d')]=_[_0x8770('0x40')](_0x411c54[_0x8770('0x41')])+'s';return _0x48aa14;}logger[_0x8770('0x28')](_0x8770('0x3a'),JSON[_0x8770('0x38')](data));throw new Error(_0x8770('0x48')+JSON[_0x8770('0x38')](data));})[_0x8770('0x3b')](function(_0x5c1818){console[_0x8770('0x49')](_0x8770('0x4a'),_0x5c1818);});}function getEndUser(_0x3828e2,_0x23147a,_0x3d9102,_0x275e6d,_0x52cc4f,_0x35df43,_0x313d39){var _0x191ef4={'method':_0x8770('0x2d'),'uri':'','headers':{'Authorization':_0x8770('0x45')+_0x3828e2},'json':!![]};switch(_0x313d39[_0x8770('0x4b')]){case _0x8770('0x4c'):_0x191ef4[_0x8770('0x4d')]='https://www.zohoapis.'+_0x23147a+_0x8770('0x4e')+_0x52cc4f+'))';return getZohoUser(_0x191ef4,_0x8770('0x4f'))[_0x8770('0x25')](function(_0xaeaf3b){if(_0xaeaf3b)return _0xaeaf3b;_0x191ef4[_0x8770('0x4d')]='https://www.zohoapis.'+_0x23147a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x52cc4f+'))';return getZohoUser(_0x191ef4,_0x8770('0x50'))['then'](function(_0x3e64cf){if(_0x3e64cf)return _0x3e64cf;if(_0x313d39['moduleCreate']!='nothing'){return createEndUser(_0x3828e2,_0x23147a,_0x275e6d,_0x52cc4f,_0x35df43,_0x313d39);}else{return{};}});});break;case _0x8770('0x51'):_0x191ef4[_0x8770('0x4d')]=_0x8770('0x3e')+_0x23147a+_0x8770('0x4e')+_0x52cc4f+'))';return getZohoUser(_0x191ef4,'Contacts')[_0x8770('0x25')](function(_0x48dea0){if(_0x48dea0)return _0x48dea0;if(_0x313d39['moduleCreate']!='nothing'){return createEndUser(_0x3828e2,_0x23147a,_0x275e6d,_0x52cc4f,_0x35df43,_0x313d39);}else{return{};}});break;case _0x8770('0x52'):_0x191ef4[_0x8770('0x4d')]=_0x8770('0x3e')+_0x23147a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x52cc4f+'))';return getZohoUser(_0x191ef4,_0x8770('0x50'))['then'](function(_0x1fb57f){if(_0x1fb57f)return _0x1fb57f;if(_0x313d39[_0x8770('0x41')]!=_0x8770('0x53')){return createEndUser(_0x3828e2,_0x23147a,_0x275e6d,_0x52cc4f,_0x35df43,_0x313d39);}else{return{};}});break;}}function getCall(_0x583f68,_0x3b4600,_0x5de11e,_0x5aae53,_0x4cfacb,_0x242361,_0x42ea2d,_0x416e7b){logger[_0x8770('0x2b')](_0x8770('0x54'));var _0x1df5cd={};_0x1df5cd['Owner']={'name':!_[_0x8770('0x18')](_0x5aae53['role'][_0x8770('0x14')])&&!_[_0x8770('0x18')](_0x5aae53[_0x8770('0x35')][_0x8770('0x14')])&&_0x5aae53['profile'][_0x8770('0x14')]===_0x8770('0x55')?_0x5aae53['role']['name']:!_['isNil'](_0x5aae53['first_name'])?_0x5aae53[_0x8770('0x43')]+'\x20'+_0x5aae53[_0x8770('0x44')]:_0x5aae53['last_name'],'id':_0x5aae53['id']};_0x1df5cd[_0x8770('0x56')]=intUtil[_0x8770('0x57')](_0x242361[_0x8770('0x58')],_0x42ea2d,'\x20');_0x1df5cd[_0x8770('0x59')]=intUtil[_0x8770('0x57')](_0x242361[_0x8770('0x5a')],_0x42ea2d,'\x0a');if(_0x4cfacb[_0x8770('0x3d')]===_0x8770('0x4f')){_0x1df5cd[_0x8770('0x5b')]={'name':!_[_0x8770('0x18')](_0x4cfacb[_0x8770('0x5c')])?_0x4cfacb['Full_Name']:!_[_0x8770('0x18')](_0x4cfacb[_0x8770('0x5d')])?_0x4cfacb[_0x8770('0x5d')]+'\x20'+_0x4cfacb['Last_Name']:_0x4cfacb[_0x8770('0x5e')],'id':_0x4cfacb['id']};}if(_0x4cfacb[_0x8770('0x3d')]===_0x8770('0x50')){_0x1df5cd['What_Id']={'name':!_[_0x8770('0x18')](_0x4cfacb[_0x8770('0x5c')])?_0x4cfacb['Full_Name']:!_[_0x8770('0x18')](_0x4cfacb['First_Name'])?_0x4cfacb[_0x8770('0x5d')]+'\x20'+_0x4cfacb[_0x8770('0x5e')]:_0x4cfacb['Last_Name'],'id':_0x4cfacb['id']};_0x1df5cd[_0x8770('0x5f')]=_[_0x8770('0x40')](_0x4cfacb[_0x8770('0x3d')]);}if(_0x42ea2d[_0x8770('0x60')]){_0x1df5cd[_0x8770('0x61')]=moment[_0x8770('0x62')](parseInt(_0x42ea2d[_0x8770('0x60')])*0x3e8)[_0x8770('0x2e')]('mm:ss');}else if(_0x42ea2d[_0x8770('0x63')]&&_0x42ea2d[_0x8770('0x64')]){_0x1df5cd['Call_Duration']=moment['utc'](moment(_0x42ea2d[_0x8770('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x8770('0x65')](moment(_0x42ea2d[_0x8770('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0x8770('0x2e')](_0x8770('0x67'));}switch(_0x42ea2d[_0x8770('0x68')]){case _0x8770('0x69'):_0x1df5cd[_0x8770('0x6a')]=_0x8770('0x6b');break;case _0x8770('0x6c'):case _0x8770('0x6d'):_0x1df5cd[_0x8770('0x6a')]=_0x8770('0x6e');break;case _0x8770('0x6f'):_0x1df5cd[_0x8770('0x6a')]=_0x8770('0x70');break;case'abandoned':_0x1df5cd[_0x8770('0x6a')]=_0x8770('0x71');break;case _0x8770('0x72'):_0x1df5cd[_0x8770('0x6a')]=_0x8770('0x73');default:}_0x1df5cd[_0x8770('0x74')]=(_0x416e7b===_0x8770('0x75')?moment(_0x42ea2d[_0x8770('0x66')])[_0x8770('0x2e')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x42ea2d[_0x8770('0x76')])[_0x8770('0x2e')](_0x8770('0x77')))||moment()['format'](_0x8770('0x77'));_0x1df5cd[_0x8770('0x78')]=_0x416e7b||'Inbound';_0x1df5cd=_[_0x8770('0x79')](_0x1df5cd,getCustomFields(_0x242361[_0x8770('0x7a')],_0x42ea2d));return request({'method':_0x8770('0x7b'),'uri':_0x8770('0x3e')+_0x3b4600+_0x8770('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x583f68},'body':{'data':[_0x1df5cd]},'json':!![]})[_0x8770('0x25')](function(_0x4af913){if(_0x4af913&&_0x4af913[_0x8770('0x3c')][0x0][_0x8770('0x7d')]===_0x8770('0x46')){logger[_0x8770('0x2b')](_0x8770('0x7e'));return{'id':_0x4af913[_0x8770('0x3c')][0x0][_0x8770('0x47')]['id']};}})[_0x8770('0x3b')](function(_0x896947){logger['info'](_0x8770('0x7f'),_0x896947[_0x8770('0x2a')]);console[_0x8770('0x49')](_0x8770('0x7f'),_0x896947);});}exports[_0x8770('0x80')]=function(_0xe2ae6e,_0x11edd0,_0x1075cb,_0x3ad340,_0x5bc91c,_0x5caef5){var _0x19d05b,_0x5a1cef,_0x20e51;_0x5caef5['host']=intUtil['stripTrailingSlash'](_0x5caef5['host']);_0x5caef5[_0x8770('0x81')]=intUtil[_0x8770('0x82')](_0x5caef5[_0x8770('0x81')]);if(_0x5bc91c&&_0x5bc91c[_0x8770('0x83')]){logger[_0x8770('0x2b')](_0x8770('0x84'),_0x8770('0x85'));_0x11edd0[_0x8770('0x86')]=_0x5caef5[_0x8770('0x81')]+_0x8770('0x87')+_0x11edd0[_0x8770('0x88')]+_0x8770('0x89')+md5(_0x11edd0[_0x8770('0x88')]);}else{_0x11edd0[_0x8770('0x86')]='';}var _0x2d23a1=_0x5caef5[_0x8770('0x8a')]==='zoho.eu'?'eu':_0x8770('0x8b');return getAccessToken(_0x5caef5)[_0x8770('0x25')](function(_0x2cccab){_0x20e51=_0x2cccab;return getUser(_0x20e51,_0x2d23a1,_0x5caef5,_0x3ad340[_0x8770('0x31')]);})[_0x8770('0x25')](function(_0x24cbb3){_0x19d05b=_0x24cbb3;logger[_0x8770('0x2b')](_0x8770('0x8c'),_0x19d05b['id']);return getEndUser(_0x20e51,_0x2d23a1,_0x5caef5,_0x11edd0[_0x8770('0x8d')],_0x11edd0[_0x8770('0x8e')],_0x19d05b,_0x1075cb);})[_0x8770('0x25')](function(_0x1b7426){_0x5a1cef=_0x1b7426;return getCall(_0x20e51,_0x2d23a1,_0x5caef5,_0x19d05b,_0x5a1cef,_0x1075cb,_0x11edd0,_0x8770('0x8f'));})['then'](function(_0x4e92cf){if(_0x4e92cf){logger['info'](_0x8770('0x90'),_0x4e92cf['id']);logger[_0x8770('0x2b')]('[QUEUE]',_0x8770('0x91'));emit(util[_0x8770('0x2e')](_0x8770('0x92'),_0x3ad340[_0x8770('0x14')]),_0x8770('0x93'),{'uri':_0x8770('0x94')+_0x5caef5[_0x8770('0x8a')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4e92cf['id']});}})[_0x8770('0x3b')](function(_0x3b88b5){logger[_0x8770('0x28')]('[QUEUE]',JSON[_0x8770('0x38')](_0x3b88b5));});};exports[_0x8770('0x75')]=function(_0x3c1c3b,_0x1306d4,_0x347c12,_0xf95c81,_0x45c5be,_0x1b156f,_0x33ae67){var _0x12c1c0,_0x499a09,_0x56e916;_0x1b156f[_0x8770('0x8a')]=intUtil[_0x8770('0x82')](_0x1b156f[_0x8770('0x8a')]);_0x1b156f[_0x8770('0x81')]=intUtil['stripTrailingSlash'](_0x1b156f['serverUrl']);if(_0x33ae67&&_0x33ae67[_0x8770('0x95')]&&_0x33ae67['recordingFormat']!==_0x8770('0x96')){logger['info'](_0x8770('0x97'),_0x8770('0x85'));_0x1306d4[_0x8770('0x86')]=_0x1b156f['serverUrl']+_0x8770('0x87')+_0x1306d4['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x1306d4[_0x8770('0x88')]);}var _0x1980ae=_0x1b156f['host']===_0x8770('0x98')?'eu':_0x8770('0x8b');return getAccessToken(_0x1b156f)['then'](function(_0x344a1c){_0x56e916=_0x344a1c;return getUser(_0x56e916,_0x1980ae,_0x1b156f,_0xf95c81['email']);})[_0x8770('0x25')](function(_0x4f7870){_0x12c1c0=_0x4f7870;logger['info'](_0x8770('0x8c'),_0x12c1c0['id']);return getEndUser(_0x56e916,_0x1980ae,_0x1b156f,_0x1306d4[_0x8770('0x99')],_0x1306d4['destcalleridnum'],_0x12c1c0,_0x347c12);})['then'](function(_0x3cfb20){_0x499a09=_0x3cfb20;return getCall(_0x56e916,_0x1980ae,_0x1b156f,_0x12c1c0,_0x499a09,_0x347c12,_0x1306d4,_0x8770('0x9a'));})[_0x8770('0x25')](function(_0x2b93ec){if(_0x2b93ec){logger['info'](_0x8770('0x90'),_0x2b93ec['id']);logger[_0x8770('0x2b')]('[OUTBOUND]',_0x8770('0x91'));emit(util[_0x8770('0x2e')](_0x8770('0x92'),_0xf95c81['name']),_0x8770('0x93'),{'uri':'https://crm.'+_0x1b156f[_0x8770('0x8a')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2b93ec['id']});}})[_0x8770('0x3b')](function(_0x2464c4){logger[_0x8770('0x28')]('[OUTBOUND]',JSON[_0x8770('0x38')](_0x2464c4));});};exports['unmanaged']=function(_0x17ecc6,_0x54e8f2,_0x3713ef,_0x425b59,_0x99a334,_0xf26b90){var _0x598aea,_0x1af322,_0x4a699b;_0xf26b90[_0x8770('0x8a')]=intUtil[_0x8770('0x82')](_0xf26b90[_0x8770('0x8a')]);_0xf26b90[_0x8770('0x81')]=intUtil[_0x8770('0x82')](_0xf26b90['serverUrl']);if(_0x99a334&&_0x99a334[_0x8770('0x83')]){logger['info']('['+_0x54e8f2[_0x8770('0x68')][_0x8770('0x9b')]()+']',_0x8770('0x85'));_0x54e8f2['recordingURL']=_0xf26b90['serverUrl']+'/api/voice/recordings/'+_0x54e8f2[_0x8770('0x88')]+_0x8770('0x89')+md5(_0x54e8f2['uniqueid']);}else{_0x54e8f2[_0x8770('0x86')]='';}var _0x422748=_0xf26b90[_0x8770('0x8a')]===_0x8770('0x98')?'eu':_0x8770('0x8b');return getAccessToken(_0xf26b90)['then'](function(_0x16b9dc){_0x4a699b=_0x16b9dc;return getUser(_0x4a699b,_0x422748,_0xf26b90);})['then'](function(_0x2caf13){_0x598aea=_0x2caf13;logger[_0x8770('0x2b')](_0x8770('0x8c'),_0x598aea['id']);return getEndUser(_0x4a699b,_0x422748,_0xf26b90,_0x54e8f2[_0x8770('0x8d')],_0x54e8f2[_0x8770('0x8e')],_0x598aea,_0x3713ef);})[_0x8770('0x25')](function(_0x2c0dc3){_0x1af322=_0x2c0dc3;return getCall(_0x4a699b,_0x422748,_0xf26b90,_0x598aea,_0x1af322,_0x3713ef,_0x54e8f2,'Inbound');})['then'](function(_0x3b6ff8){if(_0x3b6ff8){logger[_0x8770('0x2b')](_0x8770('0x90'),_0x3b6ff8['id']);}})[_0x8770('0x3b')](function(_0x5b9da7){logger[_0x8770('0x28')]('['+_0x54e8f2[_0x8770('0x68')][_0x8770('0x9b')]()+']',JSON['stringify'](_0x5b9da7));});}; \ No newline at end of file +var _0xa8b1=['Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Called','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Inbound','merge','Fields','POST','/crm/v2/Calls','Call\x20created!','err','stripTrailingSlash','host','serverUrl','[QUEUE]','/api/voice/recordings/','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','recordingURL','uniqueid','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','user:%s','https://crm.','monitor_format','toUpperCase','/downloads?type=uniqueid&token=','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/logger','zoho','defaults','redis','localhost','emit','[HTTP]','stringify','length','forEach','idField','toString','type','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','then','access_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:'];(function(_0x2f3ca5,_0x3ba4ac){var _0x11cc85=function(_0x14b941){while(--_0x14b941){_0x2f3ca5['push'](_0x2f3ca5['shift']());}};_0x11cc85(++_0x3ba4ac);}(_0xa8b1,0x182));var _0x1a8b=function(_0x5a202f,_0x5dc5e5){_0x5a202f=_0x5a202f-0x0;var _0x1dc990=_0xa8b1[_0x5a202f];return _0x1dc990;};'use strict';var _=require(_0x1a8b('0x0'));var rp=require(_0x1a8b('0x1'));var md5=require(_0x1a8b('0x2'));var util=require(_0x1a8b('0x3'));var intUtil=require(_0x1a8b('0x4'));var moment=require(_0x1a8b('0x5'));var Redis=require(_0x1a8b('0x6'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x1a8b('0x7'))(_0x1a8b('0x8'));config['redis']=_[_0x1a8b('0x9')](config[_0x1a8b('0xa')],{'host':_0x1a8b('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1a8b('0xa')]));function emit(_0x164e57,_0x402603,_0x2b637e){io['to'](_0x164e57)[_0x1a8b('0xc')](_0x402603,_0x2b637e);}function request(_0x2340f6){logger['debug'](_0x1a8b('0xd'),JSON[_0x1a8b('0xe')](_0x2340f6));return rp(_0x2340f6);}function getCustomFields(_0x1bcb21,_0x111179){var _0x5e301e={};if(_0x1bcb21[_0x1a8b('0xf')]>0x0){_[_0x1a8b('0x10')](_0x1bcb21,function(_0x40119d){if(_0x40119d['type']==='string'&&_0x40119d[_0x1a8b('0x11')]){_0x5e301e[_0x40119d[_0x1a8b('0x11')]]=_0x40119d['content'][_0x1a8b('0x12')]();}else if(_0x40119d[_0x1a8b('0x13')]===_0x1a8b('0x14')&&_0x40119d[_0x1a8b('0x15')]&&_0x40119d[_0x1a8b('0x11')]&&_0x111179[_0x40119d[_0x1a8b('0x15')]]){_0x5e301e[_0x40119d['idField']]=_0x111179[_0x40119d[_0x1a8b('0x15')]]['toString']();}else if(_0x40119d[_0x1a8b('0x13')]==='customVariable'&&_0x40119d[_0x1a8b('0x16')]&&_0x40119d[_0x1a8b('0x16')][_0x1a8b('0x17')]&&_0x40119d[_0x1a8b('0x11')]&&_0x111179[_0x40119d[_0x1a8b('0x16')]['name'][_0x1a8b('0x18')]()]){_0x5e301e[_0x40119d[_0x1a8b('0x11')]]=_0x111179[_0x40119d['Variable']['name'][_0x1a8b('0x18')]()][_0x1a8b('0x12')]();}});}return _0x5e301e;}function getName(_0x50311e){if(_0x50311e[_0x1a8b('0x19')]('\x20')>0x0){var _0x412e9e=_0x50311e[_0x1a8b('0x1a')](/ (.+)/);if(_0x412e9e[0x1]){return _0x412e9e;}}return[_0x50311e,_0x50311e];}var accountsTokens={};function getAccessToken(_0x19d88a){return new Promise(function(_0x3bf949,_0x3ba964){if(!_['isNil'](accountsTokens[_0x19d88a['id']])&&!_[_0x1a8b('0x1b')](accountsTokens[_0x19d88a['id']]['access_token'])){if(moment()[_0x1a8b('0x1c')](accountsTokens[_0x19d88a['id']][_0x1a8b('0x1d')])){_0x3bf949(accountsTokens[_0x19d88a['id']]['access_token']);}}var _0x270b72;switch(_0x19d88a[_0x1a8b('0x1e')]){case'US':_0x270b72=_0x1a8b('0x1f');break;case'AU':_0x270b72=_0x1a8b('0x20');break;case'EU':_0x270b72=_0x1a8b('0x21');break;case'IN':_0x270b72=_0x1a8b('0x22');break;case'CN':_0x270b72=_0x1a8b('0x23');break;default:_0x270b72=_0x1a8b('0x21');break;}var _0x5ef0ef={'method':'POST','uri':_0x270b72+'/oauth/v2/token','qs':{'refresh_token':_0x19d88a[_0x1a8b('0x24')],'client_id':_0x19d88a[_0x1a8b('0x25')],'client_secret':_0x19d88a[_0x1a8b('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5ef0ef)[_0x1a8b('0x27')](function(_0x23601b){accountsTokens[_0x19d88a['id']]={'access_token':_0x23601b[_0x1a8b('0x28')],'expires_in':moment()['add'](_0x23601b['expires_in'],_0x1a8b('0x29'))};_0x3bf949(_0x23601b['access_token']);})[_0x1a8b('0x2a')](function(_0x1d25a5){logger[_0x1a8b('0x2b')](_0x1a8b('0x2c'),_0x1d25a5[_0x1a8b('0x2d')]);_0x3ba964(_0x1d25a5);});});}function getUser(_0x39f575,_0x5e9b5d,_0x199aac,_0x313121){logger[_0x1a8b('0x2e')]('Search\x20user');return request({'method':_0x1a8b('0x2f'),'uri':util[_0x1a8b('0x30')](_0x1a8b('0x31'),_0x5e9b5d),'qs':{'type':_0x1a8b('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x39f575},'json':!![]})[_0x1a8b('0x27')](function(_0x13bf51){if(_0x13bf51['users']){var _0xd2d2ca=-0x1;if(_['isArrayLikeObject'](_0x13bf51[_0x1a8b('0x33')])){if(!_['isNil'](_0x313121)){_0xd2d2ca=_[_0x1a8b('0x34')](_0x13bf51[_0x1a8b('0x33')],function(_0x5da92d){return _0x5da92d['email']===_0x313121;});}if(_0xd2d2ca>=0x0){logger[_0x1a8b('0x2e')](_0x1a8b('0x35'));}else{logger['info'](_0x1a8b('0x36'));_0xd2d2ca=_[_0x1a8b('0x34')](_0x13bf51[_0x1a8b('0x33')],function(_0x1b894f){return _0x1b894f[_0x1a8b('0x37')][_0x1a8b('0x17')]===_0x1a8b('0x38');});}return _0x13bf51[_0x1a8b('0x33')][_0xd2d2ca];}else{if(_0x13bf51[_0x1a8b('0x39')][_0x1a8b('0x37')][_0x1a8b('0x17')]===_0x1a8b('0x38')){logger[_0x1a8b('0x2e')](_0x1a8b('0x36'));user=_0x13bf51[_0x1a8b('0x39')];return user;}else{logger[_0x1a8b('0x2b')](_0x1a8b('0x3a'),JSON[_0x1a8b('0xe')](_0x13bf51));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x1a8b('0xe')](_0x13bf51));}}}else{logger['error'](_0x1a8b('0x3a'),JSON[_0x1a8b('0xe')](_0x13bf51));throw new Error(_0x1a8b('0x3b')+JSON[_0x1a8b('0xe')](_0x13bf51));}})[_0x1a8b('0x2a')](function(_0x2a8377){console[_0x1a8b('0x2b')](_0x2a8377);});}function getZohoUser(_0x4050ad,_0x181de5){return new BPromise(function(_0x407b6d,_0x22d6bf){request(_0x4050ad)['then'](function(_0x2c7921){var _0x50fefa=null;if(_0x2c7921){_0x50fefa=_0x2c7921[_0x1a8b('0x3c')][0x0];_0x50fefa[_0x1a8b('0x3d')]=_0x181de5;}_0x407b6d(_0x50fefa);})[_0x1a8b('0x2a')](function(_0x37fa66){_0x22d6bf(_0x37fa66);});});}function createEndUser(_0x2ee770,_0x113492,_0x4f188c,_0x10a7ce,_0x3cd440,_0x29a94b){var _0x4f188c=getName(_0x4f188c);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x113492+_0x1a8b('0x3e')+_[_0x1a8b('0x3f')](_0x29a94b['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4f188c[0x1],'First_Name':_0x4f188c[0x0],'Phone':_0x10a7ce,'Owner':{'name':!_[_0x1a8b('0x1b')](_0x3cd440[_0x1a8b('0x40')][_0x1a8b('0x17')])?_0x3cd440['role'][_0x1a8b('0x17')]:!_[_0x1a8b('0x1b')](_0x3cd440[_0x1a8b('0x41')])?_0x3cd440[_0x1a8b('0x41')]+'\x20'+_0x3cd440['last_name']:_0x3cd440[_0x1a8b('0x42')],'id':_0x3cd440['id']}}]},'headers':{'Authorization':_0x1a8b('0x43')+_0x2ee770},'json':!![]})['then'](function(_0x2c8f58){if(_0x2c8f58&&_0x2c8f58['data'][0x0][_0x1a8b('0x44')]===_0x1a8b('0x45')){var _0x451b4b=_0x2c8f58[_0x1a8b('0x3c')][0x0][_0x1a8b('0x46')];_0x451b4b['enduserType']=_['startCase'](_0x29a94b[_0x1a8b('0x47')])+'s';return _0x451b4b;}logger[_0x1a8b('0x2b')](_0x1a8b('0x3a'),JSON[_0x1a8b('0xe')](data));throw new Error(_0x1a8b('0x48')+JSON['stringify'](data));})[_0x1a8b('0x2a')](function(_0x219a11){console[_0x1a8b('0x49')](_0x1a8b('0x4a'),_0x219a11);});}function getEndUser(_0x4a6178,_0x2584c2,_0x27838a,_0x2228dd,_0x173b20,_0x3e6f7f,_0x23ed25){var _0x275a2e={'method':'GET','uri':'','headers':{'Authorization':_0x1a8b('0x43')+_0x4a6178},'json':!![]};switch(_0x23ed25[_0x1a8b('0x4b')]){case _0x1a8b('0x4c'):_0x275a2e['uri']='https://www.zohoapis.'+_0x2584c2+_0x1a8b('0x4d')+_0x173b20+'))';return getZohoUser(_0x275a2e,_0x1a8b('0x4e'))[_0x1a8b('0x27')](function(_0x28439d){if(_0x28439d)return _0x28439d;_0x275a2e[_0x1a8b('0x4f')]=_0x1a8b('0x50')+_0x2584c2+_0x1a8b('0x51')+_0x173b20+'))';return getZohoUser(_0x275a2e,_0x1a8b('0x52'))[_0x1a8b('0x27')](function(_0x50cc9b){if(_0x50cc9b)return _0x50cc9b;if(_0x23ed25[_0x1a8b('0x47')]!=_0x1a8b('0x53')){return createEndUser(_0x4a6178,_0x2584c2,_0x2228dd,_0x173b20,_0x3e6f7f,_0x23ed25);}else{return{};}});});break;case'contact':_0x275a2e[_0x1a8b('0x4f')]=_0x1a8b('0x50')+_0x2584c2+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x173b20+'))';return getZohoUser(_0x275a2e,_0x1a8b('0x4e'))[_0x1a8b('0x27')](function(_0xf81696){if(_0xf81696)return _0xf81696;if(_0x23ed25['moduleCreate']!='nothing'){return createEndUser(_0x4a6178,_0x2584c2,_0x2228dd,_0x173b20,_0x3e6f7f,_0x23ed25);}else{return{};}});break;case _0x1a8b('0x54'):_0x275a2e['uri']='https://www.zohoapis.'+_0x2584c2+_0x1a8b('0x51')+_0x173b20+'))';return getZohoUser(_0x275a2e,_0x1a8b('0x52'))[_0x1a8b('0x27')](function(_0x4f5cf8){if(_0x4f5cf8)return _0x4f5cf8;if(_0x23ed25[_0x1a8b('0x47')]!=_0x1a8b('0x53')){return createEndUser(_0x4a6178,_0x2584c2,_0x2228dd,_0x173b20,_0x3e6f7f,_0x23ed25);}else{return{};}});break;}}function getCall(_0x48c4df,_0x2e8c24,_0x436555,_0x4785a8,_0x5072ad,_0x5c25c8,_0x47341e,_0x537ed6){logger[_0x1a8b('0x2e')](_0x1a8b('0x55'));var _0x10fe56={};_0x10fe56[_0x1a8b('0x56')]={'name':!_[_0x1a8b('0x1b')](_0x4785a8['role'][_0x1a8b('0x17')])&&!_[_0x1a8b('0x1b')](_0x4785a8[_0x1a8b('0x37')][_0x1a8b('0x17')])&&_0x4785a8[_0x1a8b('0x37')]['name']===_0x1a8b('0x57')?_0x4785a8[_0x1a8b('0x40')]['name']:!_['isNil'](_0x4785a8[_0x1a8b('0x41')])?_0x4785a8[_0x1a8b('0x41')]+'\x20'+_0x4785a8[_0x1a8b('0x42')]:_0x4785a8[_0x1a8b('0x42')],'id':_0x4785a8['id']};_0x10fe56[_0x1a8b('0x58')]=intUtil[_0x1a8b('0x59')](_0x5c25c8[_0x1a8b('0x5a')],_0x47341e,'\x20');_0x10fe56[_0x1a8b('0x5b')]=intUtil[_0x1a8b('0x59')](_0x5c25c8['Descriptions'],_0x47341e,'\x0a');if(_0x5072ad[_0x1a8b('0x3d')]===_0x1a8b('0x4e')){_0x10fe56[_0x1a8b('0x5c')]={'name':!_['isNil'](_0x5072ad['Full_Name'])?_0x5072ad[_0x1a8b('0x5d')]:!_['isNil'](_0x5072ad['First_Name'])?_0x5072ad['First_Name']+'\x20'+_0x5072ad[_0x1a8b('0x5e')]:_0x5072ad[_0x1a8b('0x5e')],'id':_0x5072ad['id']};}if(_0x5072ad[_0x1a8b('0x3d')]===_0x1a8b('0x52')){_0x10fe56[_0x1a8b('0x5f')]={'name':!_[_0x1a8b('0x1b')](_0x5072ad['Full_Name'])?_0x5072ad[_0x1a8b('0x5d')]:!_[_0x1a8b('0x1b')](_0x5072ad[_0x1a8b('0x60')])?_0x5072ad[_0x1a8b('0x60')]+'\x20'+_0x5072ad[_0x1a8b('0x5e')]:_0x5072ad[_0x1a8b('0x5e')],'id':_0x5072ad['id']};_0x10fe56[_0x1a8b('0x61')]=_[_0x1a8b('0x3f')](_0x5072ad[_0x1a8b('0x3d')]);}if(_0x47341e['talktime']){_0x10fe56[_0x1a8b('0x62')]=moment[_0x1a8b('0x63')](parseInt(_0x47341e[_0x1a8b('0x64')])*0x3e8)[_0x1a8b('0x30')](_0x1a8b('0x65'));}else if(_0x47341e[_0x1a8b('0x66')]&&_0x47341e[_0x1a8b('0x67')]){_0x10fe56[_0x1a8b('0x62')]=moment['utc'](moment(_0x47341e[_0x1a8b('0x67')],_0x1a8b('0x68'))[_0x1a8b('0x69')](moment(_0x47341e['starttime'],_0x1a8b('0x68'))))[_0x1a8b('0x30')](_0x1a8b('0x65'));}switch(_0x47341e[_0x1a8b('0x6a')]){case _0x1a8b('0x6b'):_0x10fe56['Call_Result']=_0x1a8b('0x6c');break;case'complete':case _0x1a8b('0x6d'):_0x10fe56[_0x1a8b('0x6e')]=_0x1a8b('0x6f');break;case _0x1a8b('0x70'):_0x10fe56['Call_Result']=_0x1a8b('0x71');break;case _0x1a8b('0x72'):_0x10fe56[_0x1a8b('0x6e')]=_0x1a8b('0x73');break;case _0x1a8b('0x74'):_0x10fe56[_0x1a8b('0x6e')]=_0x1a8b('0x75');default:}_0x10fe56[_0x1a8b('0x76')]=(_0x537ed6===_0x1a8b('0x77')?moment(_0x47341e[_0x1a8b('0x78')])[_0x1a8b('0x30')](_0x1a8b('0x68')):moment(_0x47341e[_0x1a8b('0x79')])[_0x1a8b('0x30')](_0x1a8b('0x68')))||moment()[_0x1a8b('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x10fe56['Call_Type']=_0x537ed6||_0x1a8b('0x7a');_0x10fe56=_[_0x1a8b('0x7b')](_0x10fe56,getCustomFields(_0x5c25c8[_0x1a8b('0x7c')],_0x47341e));return request({'method':_0x1a8b('0x7d'),'uri':_0x1a8b('0x50')+_0x2e8c24+_0x1a8b('0x7e'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x48c4df},'body':{'data':[_0x10fe56]},'json':!![]})[_0x1a8b('0x27')](function(_0x2f38f4){if(_0x2f38f4&&_0x2f38f4[_0x1a8b('0x3c')][0x0][_0x1a8b('0x44')]===_0x1a8b('0x45')){logger['info'](_0x1a8b('0x7f'));return{'id':_0x2f38f4[_0x1a8b('0x3c')][0x0]['details']['id']};}})[_0x1a8b('0x2a')](function(_0x967a0c){logger['info'](_0x1a8b('0x80'),_0x967a0c[_0x1a8b('0x2d')]);console[_0x1a8b('0x49')](_0x1a8b('0x80'),_0x967a0c);});}exports['queue']=function(_0x5d71a8,_0x1af00f,_0x3f6c88,_0x33f8fb,_0x42efaf,_0x246a3c){var _0xb70fb2,_0x180ab7,_0x3df4d3;_0x246a3c['host']=intUtil[_0x1a8b('0x81')](_0x246a3c[_0x1a8b('0x82')]);_0x246a3c[_0x1a8b('0x83')]=intUtil[_0x1a8b('0x81')](_0x246a3c[_0x1a8b('0x83')]);if(_0x42efaf&&_0x42efaf['monitor_format']){logger['info'](_0x1a8b('0x84'),'Recording\x20is\x20enabled!');_0x1af00f['recordingURL']=_0x246a3c[_0x1a8b('0x83')]+_0x1a8b('0x85')+_0x1af00f['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x1af00f['uniqueid']);}else{_0x1af00f['recordingURL']='';}var _0x2ed961=_0x246a3c[_0x1a8b('0x82')]===_0x1a8b('0x86')?'eu':_0x1a8b('0x87');return getAccessToken(_0x246a3c)['then'](function(_0x345dd2){_0x3df4d3=_0x345dd2;return getUser(_0x3df4d3,_0x2ed961,_0x246a3c,_0x33f8fb[_0x1a8b('0x88')]);})['then'](function(_0x4edfcf){_0xb70fb2=_0x4edfcf;logger[_0x1a8b('0x2e')](_0x1a8b('0x89'),_0xb70fb2['id']);return getEndUser(_0x3df4d3,_0x2ed961,_0x246a3c,_0x1af00f[_0x1a8b('0x8a')],_0x1af00f[_0x1a8b('0x8b')],_0xb70fb2,_0x3f6c88);})[_0x1a8b('0x27')](function(_0x44e2a6){_0x180ab7=_0x44e2a6;return getCall(_0x3df4d3,_0x2ed961,_0x246a3c,_0xb70fb2,_0x180ab7,_0x3f6c88,_0x1af00f,_0x1a8b('0x7a'));})[_0x1a8b('0x27')](function(_0x3989f1){if(_0x3989f1){logger[_0x1a8b('0x2e')]('The\x20Call\x20ID\x20is:',_0x3989f1['id']);logger[_0x1a8b('0x2e')]('[QUEUE]',_0x1a8b('0x8c'));emit(util[_0x1a8b('0x30')]('user:%s',_0x33f8fb[_0x1a8b('0x17')]),_0x1a8b('0x8d'),{'uri':'https://crm.'+_0x246a3c['host']+_0x1a8b('0x8e')+_0x3989f1['id']});}})[_0x1a8b('0x2a')](function(_0x3caba9){logger['error'](_0x1a8b('0x84'),JSON[_0x1a8b('0xe')](_0x3caba9));});};exports['outbound']=function(_0x15a676,_0x4df2ca,_0x362e0b,_0x28dc37,_0x5db4a5,_0x4b1c34,_0x1a6018){var _0x1f5201,_0x511b01,_0xcac2df;_0x4b1c34[_0x1a8b('0x82')]=intUtil[_0x1a8b('0x81')](_0x4b1c34[_0x1a8b('0x82')]);_0x4b1c34['serverUrl']=intUtil[_0x1a8b('0x81')](_0x4b1c34[_0x1a8b('0x83')]);if(_0x1a6018&&_0x1a6018[_0x1a8b('0x8f')]&&_0x1a6018[_0x1a8b('0x8f')]!==_0x1a8b('0x90')){logger[_0x1a8b('0x2e')](_0x1a8b('0x91'),'Recording\x20is\x20enabled!');_0x4df2ca[_0x1a8b('0x92')]=_0x4b1c34[_0x1a8b('0x83')]+_0x1a8b('0x85')+_0x4df2ca[_0x1a8b('0x93')]+'/downloads?type=uniqueid&token='+md5(_0x4df2ca[_0x1a8b('0x93')]);}var _0x2933af=_0x4b1c34[_0x1a8b('0x82')]===_0x1a8b('0x86')?'eu':_0x1a8b('0x87');return getAccessToken(_0x4b1c34)[_0x1a8b('0x27')](function(_0x1998d1){_0xcac2df=_0x1998d1;return getUser(_0xcac2df,_0x2933af,_0x4b1c34,_0x28dc37[_0x1a8b('0x88')]);})[_0x1a8b('0x27')](function(_0x4d64da){_0x1f5201=_0x4d64da;logger[_0x1a8b('0x2e')](_0x1a8b('0x89'),_0x1f5201['id']);return getEndUser(_0xcac2df,_0x2933af,_0x4b1c34,_0x4df2ca[_0x1a8b('0x94')],_0x4df2ca['destcalleridnum'],_0x1f5201,_0x362e0b);})[_0x1a8b('0x27')](function(_0x3e8e4c){_0x511b01=_0x3e8e4c;return getCall(_0xcac2df,_0x2933af,_0x4b1c34,_0x1f5201,_0x511b01,_0x362e0b,_0x4df2ca,_0x1a8b('0x95'));})[_0x1a8b('0x27')](function(_0x21d87d){if(_0x21d87d){logger[_0x1a8b('0x2e')](_0x1a8b('0x96'),_0x21d87d['id']);logger['info'](_0x1a8b('0x91'),_0x1a8b('0x8c'));emit(util[_0x1a8b('0x30')](_0x1a8b('0x97'),_0x28dc37[_0x1a8b('0x17')]),_0x1a8b('0x8d'),{'uri':_0x1a8b('0x98')+_0x4b1c34[_0x1a8b('0x82')]+'/crm/EntityInfo.do?module=Calls&id='+_0x21d87d['id']});}})[_0x1a8b('0x2a')](function(_0x23f14b){logger[_0x1a8b('0x2b')](_0x1a8b('0x91'),JSON['stringify'](_0x23f14b));});};exports['unmanaged']=function(_0x1716d7,_0x2d7a99,_0x2d72d7,_0x1d0f24,_0x38207c,_0x2aa662){var _0x279965,_0x5ebf88,_0x41d1e0;_0x2aa662['host']=intUtil[_0x1a8b('0x81')](_0x2aa662[_0x1a8b('0x82')]);_0x2aa662[_0x1a8b('0x83')]=intUtil[_0x1a8b('0x81')](_0x2aa662['serverUrl']);if(_0x38207c&&_0x38207c[_0x1a8b('0x99')]){logger[_0x1a8b('0x2e')]('['+_0x2d7a99[_0x1a8b('0x6a')][_0x1a8b('0x9a')]()+']','Recording\x20is\x20enabled!');_0x2d7a99[_0x1a8b('0x92')]=_0x2aa662[_0x1a8b('0x83')]+_0x1a8b('0x85')+_0x2d7a99['uniqueid']+_0x1a8b('0x9b')+md5(_0x2d7a99[_0x1a8b('0x93')]);}else{_0x2d7a99['recordingURL']='';}var _0x575165=_0x2aa662[_0x1a8b('0x82')]===_0x1a8b('0x86')?'eu':'com';return getAccessToken(_0x2aa662)[_0x1a8b('0x27')](function(_0x1edf84){_0x41d1e0=_0x1edf84;return getUser(_0x41d1e0,_0x575165,_0x2aa662);})[_0x1a8b('0x27')](function(_0x5ab5e0){_0x279965=_0x5ab5e0;logger[_0x1a8b('0x2e')](_0x1a8b('0x89'),_0x279965['id']);return getEndUser(_0x41d1e0,_0x575165,_0x2aa662,_0x2d7a99[_0x1a8b('0x8a')],_0x2d7a99[_0x1a8b('0x8b')],_0x279965,_0x2d72d7);})[_0x1a8b('0x27')](function(_0x120133){_0x5ebf88=_0x120133;return getCall(_0x41d1e0,_0x575165,_0x2aa662,_0x279965,_0x5ebf88,_0x2d72d7,_0x2d7a99,_0x1a8b('0x7a'));})[_0x1a8b('0x27')](function(_0x3ee2fe){if(_0x3ee2fe){logger[_0x1a8b('0x2e')](_0x1a8b('0x96'),_0x3ee2fe['id']);}})[_0x1a8b('0x2a')](function(_0x29230d){logger[_0x1a8b('0x2b')]('['+_0x2d7a99['lastevent']['toUpperCase']()+']',JSON[_0x1a8b('0xe')](_0x29230d));});}; \ 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 0145b37..27ad91f 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(_0x27d3e5,_0x5ee02d){var _0x86cd31=function(_0xcb6e){while(--_0xcb6e){_0x27d3e5['push'](_0x27d3e5['shift']());}};_0x86cd31(++_0x5ee02d);}(_0x7a54,0x106));var _0x47a5=function(_0x5a8084,_0x36dcec){_0x5a8084=_0x5a8084-0x0;var _0xa526a9=_0x7a54[_0x5a8084];return _0xa526a9;};'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(_0x52094b,_0x21aeb5){var _0x5b4854=function(_0x583263){while(--_0x583263){_0x52094b['push'](_0x52094b['shift']());}};_0x5b4854(++_0x21aeb5);}(_0x7a54,0x106));var _0x47a5=function(_0x1fecdf,_0x2c17e1){_0x1fecdf=_0x1fecdf-0x0;var _0x53735f=_0x7a54[_0x1fecdf];return _0x53735f;};'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 f33c9a2..cc42c49 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(_0x475e9b,_0x53bbcd){var _0x431ee5=function(_0xd6996f){while(--_0xd6996f){_0x475e9b['push'](_0x475e9b['shift']());}};_0x431ee5(++_0x53bbcd);}(_0x7a54,0x106));var _0x47a5=function(_0x26eefb,_0x1c4517){_0x26eefb=_0x26eefb-0x0;var _0x338acc=_0x7a54[_0x26eefb];return _0x338acc;};'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 _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(_0x2b79c5,_0x5dc27d){var _0x23b546=function(_0x49be3e){while(--_0x49be3e){_0x2b79c5['push'](_0x2b79c5['shift']());}};_0x23b546(++_0x5dc27d);}(_0x7a54,0x106));var _0x47a5=function(_0x21eab8,_0x17369a){_0x21eab8=_0x21eab8-0x0;var _0x569bed=_0x7a54[_0x21eab8];return _0x569bed;};'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 diff --git a/server/services/email/client.js b/server/services/email/client.js index 3f77f23..a88e69d 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 _0xc7e9=['message','catch','exports','jayson/promise','bluebird','routing','client','http','request','debug','rpc','error'];(function(_0x587845,_0x3115b9){var _0x1c2292=function(_0x174e88){while(--_0x174e88){_0x587845['push'](_0x587845['shift']());}};_0x1c2292(++_0x3115b9);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xc7e9[_0x32b542];return _0x554d54;};'use strict';var jayson=require(_0x9c7e('0x0'));var BPromise=require(_0x9c7e('0x1'));var logger=require('../../config/logger')(_0x9c7e('0x2'));var client=jayson[_0x9c7e('0x3')][_0x9c7e('0x4')]({'port':0x2329});client['Request']=function(_0x340997,_0x34cef0){return new BPromise(function(_0x5010c0,_0x571d29){return client[_0x9c7e('0x5')](_0x340997,_0x34cef0)['then'](function(_0x1e5135){logger[_0x9c7e('0x6')](_0x9c7e('0x7'),_0x9c7e('0x2'),_0x340997,_0x34cef0,_0x1e5135);if(_0x1e5135['error']){logger[_0x9c7e('0x8')](_0x9c7e('0x7'),_0x9c7e('0x2'),_0x340997,_0x1e5135[_0x9c7e('0x8')]['message'],_0x34cef0);return _0x571d29(_0x1e5135[_0x9c7e('0x8')][_0x9c7e('0x9')]);}else{return _0x5010c0(_0x1e5135['result']);}})[_0x9c7e('0xa')](function(_0x538ea2){logger[_0x9c7e('0x8')](_0x9c7e('0x7'),'routing',_0x340997,_0x538ea2,_0x34cef0);return _0x571d29(_0x538ea2);});});};module[_0x9c7e('0xb')]=client; \ No newline at end of file +var _0xef8b=['../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result','catch','bluebird'];(function(_0x20f5e6,_0x2107cd){var _0x941d12=function(_0x1bf2cf){while(--_0x1bf2cf){_0x20f5e6['push'](_0x20f5e6['shift']());}};_0x941d12(++_0x2107cd);}(_0xef8b,0x192));var _0xbef8=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0xef8b[_0x3b16e1];return _0x311d1b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var client=jayson[_0xbef8('0x3')][_0xbef8('0x4')]({'port':0x2329});client[_0xbef8('0x5')]=function(_0x336519,_0x224dd2){return new BPromise(function(_0x201996,_0x110835){return client[_0xbef8('0x6')](_0x336519,_0x224dd2)['then'](function(_0x1dd4a3){logger[_0xbef8('0x7')](_0xbef8('0x8'),'routing',_0x336519,_0x224dd2,_0x1dd4a3);if(_0x1dd4a3[_0xbef8('0x9')]){logger[_0xbef8('0x9')]('rpc','routing',_0x336519,_0x1dd4a3['error'][_0xbef8('0xa')],_0x224dd2);return _0x110835(_0x1dd4a3[_0xbef8('0x9')][_0xbef8('0xa')]);}else{return _0x201996(_0x1dd4a3[_0xbef8('0xb')]);}})[_0xbef8('0xc')](function(_0xec0016){logger[_0xbef8('0x9')](_0xbef8('0x8'),_0xbef8('0x2'),_0x336519,_0xec0016,_0x224dd2);return _0x110835(_0xec0016);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 563cfd6..e1dbf72 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 _0xcb41=['./server','./realtime','./lib/email','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcb41,0x1df));var _0x1cb4=function(_0x5428ef,_0x12c541){_0x5428ef=_0x5428ef-0x0;var _0x55d712=_0xcb41[_0x5428ef];return _0x55d712;};'use strict';var BPromise=require(_0x1cb4('0x0'));var server=require(_0x1cb4('0x1'));var Realtime=require(_0x1cb4('0x2'));var EmailChannel=require(_0x1cb4('0x3'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x1cb4('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0x1cb4('0x5')](mailAccount[_0x1cb4('0x6')]())[_0x1cb4('0x5')](realtime[_0x1cb4('0x7')]())[_0x1cb4('0x5')](function(){email[_0x1cb4('0x8')](realtime[_0x1cb4('0x9')]);return realtime;});}function main(){return server[_0x1cb4('0xa')](realtime,email)['then'](function(_0x2b51e3){return initRealtime();})[_0x1cb4('0x5')](function(_0x50b603){return db[_0x1cb4('0xb')][_0x1cb4('0xc')]({'attributes':['id',_0x1cb4('0xd')],'raw':!![]});})['then'](function(_0x2f5ddc){return setInterval(initRealtime,_0x2f5ddc[_0x1cb4('0xd')]*0x3e8);})[_0x1cb4('0xe')](function(_0x4c8bde){console['log'](_0x4c8bde);});}main(); \ No newline at end of file +var _0x49fe=['Setting','findOne','loginMailFrequency','catch','bluebird','./server','./realtime','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen'];(function(_0x38cb8b,_0x5295a6){var _0x3b9b85=function(_0x53da0b){while(--_0x53da0b){_0x38cb8b['push'](_0x38cb8b['shift']());}};_0x3b9b85(++_0x5295a6);}(_0x49fe,0x100));var _0xe49f=function(_0x22b87f,_0x5a1b99){_0x22b87f=_0x22b87f-0x0;var _0x4cd96e=_0x49fe[_0x22b87f];return _0x4cd96e;};'use strict';var BPromise=require(_0xe49f('0x0'));var server=require(_0xe49f('0x1'));var Realtime=require(_0xe49f('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xe49f('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0xe49f('0x4')](mailAccount[_0xe49f('0x5')]())[_0xe49f('0x4')](realtime[_0xe49f('0x6')]())['then'](function(){email[_0xe49f('0x7')](realtime[_0xe49f('0x8')]);return realtime;});}function main(){return server[_0xe49f('0x9')](realtime,email)[_0xe49f('0x4')](function(_0x4f9b1f){return initRealtime();})[_0xe49f('0x4')](function(_0x18f791){return db[_0xe49f('0xa')][_0xe49f('0xb')]({'attributes':['id',_0xe49f('0xc')],'raw':!![]});})['then'](function(_0x581b52){return setInterval(initRealtime,_0x581b52[_0xe49f('0xc')]*0x3e8);})[_0xe49f('0xd')](function(_0x5ef2aa){console['log'](_0x5ef2aa);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 70c15df..1e3f90c 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 _0x020c=['email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','status','Imap','messageStatus','total','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEnd','error','handleImapError','isNil','connected','messages','firstName','lastName','notify','lastSync','send','Smtp','then','verified','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger'];(function(_0x577d00,_0x3d10e8){var _0x5d67ac=function(_0x1bca61){while(--_0x1bca61){_0x577d00['push'](_0x577d00['shift']());}};_0x5d67ac(++_0x3d10e8);}(_0x020c,0x92));var _0xc020=function(_0xb57be1,_0x189ee5){_0xb57be1=_0xb57be1-0x0;var _0x294aa3=_0x020c[_0xb57be1];return _0x294aa3;};'use strict';var _=require(_0xc020('0x0'));var moment=require(_0xc020('0x1'));var BPromise=require(_0xc020('0x2'));var md5=require(_0xc020('0x3'));var Redis=require(_0xc020('0x4'));var config=require(_0xc020('0x5'));var logger=require(_0xc020('0x6'))(_0xc020('0x7'));config[_0xc020('0x8')]=_[_0xc020('0x9')](config[_0xc020('0x8')],{'host':_0xc020('0xa'),'port':0x18eb});var io=require(_0xc020('0xb'))(new Redis(config[_0xc020('0x8')]));var EmailImap=require(_0xc020('0xc'));var EmailSmtp=require(_0xc020('0xd'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3668a3){logger[_0xc020('0xe')](_0xc020('0xf'));this['mailAccounts']=_0x3668a3[_0xc020('0x10')];this[_0xc020('0x11')]={};this[_0xc020('0x12')]=new EmailSmtp();}EmailChannel['prototype'][_0xc020('0x13')]=function(_0xef9420){var _0x4a73f3=this[_0xc020('0x10')][_0xef9420];var _0x52d0bd={'id':_0x4a73f3['id'],'name':_0x4a73f3[_0xc020('0x14')],'key':_0x4a73f3[_0xc020('0x15')],'active':_0x4a73f3[_0xc020('0x16')],'Imap':{'status':_0x4a73f3['Imap'][_0xc020('0x17')],'messageStatus':_0x4a73f3[_0xc020('0x18')][_0xc020('0x19')],'total':_0x4a73f3[_0xc020('0x18')][_0xc020('0x1a')]}};if(_['isNil'](md5Accounts[_0xef9420])){md5Accounts[_0xef9420]={};}var _0xe2ec71=md5(JSON[_0xc020('0x1b')](_0x52d0bd));if(md5Accounts[_0xef9420]['md5']!==_0xe2ec71){md5Accounts[_0xef9420][_0xc020('0x3')]=_0xe2ec71;io[_0xc020('0x13')](_0xc020('0x1c'),_0x52d0bd);}};EmailChannel[_0xc020('0x1d')][_0xc020('0x1e')]=function(_0x59abf0){for(var _0x268e6d in _0x59abf0){if(_0x59abf0[_0xc020('0x1f')](_0x268e6d)){if(_0x59abf0[_0x268e6d][_0xc020('0x18')]&&_0x59abf0[_0x268e6d][_0xc020('0x16')]){var _0x2c3d6e=_0x59abf0[_0x268e6d]['Imap'];if(!this['imapAccounts'][_0xc020('0x1f')](_0x2c3d6e['id'])){this['imapAccounts'][_0x2c3d6e['id']]=new EmailImap(_0x2c3d6e,_0x59abf0[_0x268e6d]['email']);this[_0xc020('0x11')][_0x2c3d6e['id']]['on'](_0xc020('0x20'),this[_0xc020('0x21')][_0xc020('0x22')](this,_0x268e6d));this[_0xc020('0x11')][_0x2c3d6e['id']]['on']('email',this['handleImapEmail'][_0xc020('0x22')](this,_0x268e6d));this[_0xc020('0x11')][_0x2c3d6e['id']]['on']('end',this[_0xc020('0x23')][_0xc020('0x22')](this,_0x268e6d));this['imapAccounts'][_0x2c3d6e['id']]['on'](_0xc020('0x24'),this[_0xc020('0x25')][_0xc020('0x22')](this,_0x268e6d));}}else{if(_[_0xc020('0x26')](this[_0xc020('0x10')][_0x268e6d]['Imap'])){this[_0xc020('0x10')][_0x268e6d][_0xc020('0x18')]={};}this[_0xc020('0x10')][_0x268e6d][_0xc020('0x18')][_0xc020('0x17')]='disabled';this[_0xc020('0x10')][_0x268e6d][_0xc020('0x18')][_0xc020('0x19')]='';this[_0xc020('0x13')](_0x268e6d);}}}};EmailChannel['prototype'][_0xc020('0x21')]=function(_0x186e79,_0x4e3171){if(this[_0xc020('0x10')][_0x186e79]){this[_0xc020('0x10')][_0x186e79][_0xc020('0x18')][_0xc020('0x17')]=_0xc020('0x27');this[_0xc020('0x10')][_0x186e79][_0xc020('0x18')]['messageStatus']=_0x4e3171[_0xc020('0x14')];if(_0x4e3171[_0xc020('0x28')]){this['mailAccounts'][_0x186e79][_0xc020('0x18')][_0xc020('0x1a')]=_0x4e3171['messages'][_0xc020('0x1a')];}return this[_0xc020('0x13')](_0x186e79);}};EmailChannel[_0xc020('0x1d')]['handleImapEmail']=function(_0x2d6a6d,_0x446967){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x446967[_0xc020('0x29')],_0x446967[_0xc020('0x2a')],_0x446967['from'],_0x2d6a6d);if(this[_0xc020('0x10')][_0x2d6a6d]){return mailAccount[_0xc020('0x2b')](_0x2d6a6d,_0x446967)['then'](function(_0x2da084){if(_0x2da084){logger[_0xc020('0xe')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x57721c){logger[_0xc020('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xc020('0x1b')](_0x57721c));});}};EmailChannel['prototype'][_0xc020('0x23')]=function(_0x2d45bf){if(this[_0xc020('0x10')][_0x2d45bf]&&this[_0xc020('0x10')][_0x2d45bf][_0xc020('0x18')]){if(this['imapAccounts'][this[_0xc020('0x10')][_0x2d45bf]['Imap']['id']]){delete this[_0xc020('0x11')][this[_0xc020('0x10')][_0x2d45bf][_0xc020('0x18')]['id']];}this[_0xc020('0x10')][_0x2d45bf]['Imap'][_0xc020('0x2c')]=moment();this['emit'](_0x2d45bf);}};EmailChannel['prototype'][_0xc020('0x25')]=function(_0x3c0344,_0x3f9fed){if(this[_0xc020('0x10')][_0x3c0344]){this[_0xc020('0x10')][_0x3c0344][_0xc020('0x18')][_0xc020('0x17')]='error';this[_0xc020('0x10')][_0x3c0344][_0xc020('0x18')]['messageStatus']=_0x3f9fed;return this[_0xc020('0x13')](_0x3c0344);}};EmailChannel['prototype']['sendMail']=function(_0x2bc4bb,_0x33d7be){return this[_0xc020('0x12')][_0xc020('0x2d')](_0x2bc4bb,_0x33d7be);};EmailChannel[_0xc020('0x1d')]['verifySmtp']=function(_0x42e8e7){var _0x1f75c4=this;if(this['mailAccounts'][_0x42e8e7['id']]){if(_[_0xc020('0x26')](this[_0xc020('0x10')][_0x42e8e7['id']]['Smtp'])){this[_0xc020('0x10')][_0x42e8e7['id']][_0xc020('0x2e')]={};}this['mailAccounts'][_0x42e8e7['id']]['Smtp'][_0xc020('0x2c')]=moment();return new BPromise(function(_0x4462ec,_0x42bfea){return _0x1f75c4[_0xc020('0x12')]['verify'](_0x42e8e7)[_0xc020('0x2f')](function(_0x3dd0cd){_0x1f75c4[_0xc020('0x10')][_0x42e8e7['id']][_0xc020('0x2e')]['status']=_0xc020('0x30');_0x1f75c4[_0xc020('0x10')][_0x42e8e7['id']][_0xc020('0x2e')]['messageStatus']='';_0x1f75c4[_0xc020('0x13')](_0x42e8e7['id']);_0x4462ec(_0x3dd0cd);})['catch'](function(_0x34db5f){_0x1f75c4[_0xc020('0x10')][_0x42e8e7['id']]['Smtp'][_0xc020('0x17')]=_0xc020('0x24');_0x1f75c4[_0xc020('0x10')][_0x42e8e7['id']]['Smtp']['messageStatus']=_0x34db5f;_0x1f75c4[_0xc020('0x13')](_0x42e8e7['id']);_0x42bfea(_0x34db5f);});});}return this[_0xc020('0x12')][_0xc020('0x31')](_0x42e8e7);};module[_0xc020('0x32')]=EmailChannel; \ No newline at end of file +var _0xc6bb=['firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','verifySmtp','Smtp','verified','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','box','bind','end','error','handleImapError','handleImapBox','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0x43e3e5,_0x46a04d){var _0x412940=function(_0x24ff8c){while(--_0x24ff8c){_0x43e3e5['push'](_0x43e3e5['shift']());}};_0x412940(++_0x46a04d);}(_0xc6bb,0x1ac));var _0xbc6b=function(_0x1a905c,_0x5d5582){_0x1a905c=_0x1a905c-0x0;var _0xfa6e26=_0xc6bb[_0x1a905c];return _0xfa6e26;};'use strict';var _=require('lodash');var moment=require(_0xbc6b('0x0'));var BPromise=require(_0xbc6b('0x1'));var md5=require(_0xbc6b('0x2'));var Redis=require('ioredis');var config=require(_0xbc6b('0x3'));var logger=require(_0xbc6b('0x4'))(_0xbc6b('0x5'));config[_0xbc6b('0x6')]=_[_0xbc6b('0x7')](config['redis'],{'host':_0xbc6b('0x8'),'port':0x18eb});var io=require(_0xbc6b('0x9'))(new Redis(config[_0xbc6b('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xbc6b('0xa'));var md5Accounts={};function EmailChannel(_0x996e63){logger['info'](_0xbc6b('0xb'));this[_0xbc6b('0xc')]=_0x996e63[_0xbc6b('0xc')];this[_0xbc6b('0xd')]={};this[_0xbc6b('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0xbc6b('0xf')]=function(_0x53406a){var _0x1ce29f=this[_0xbc6b('0xc')][_0x53406a];var _0x30e9e2={'id':_0x1ce29f['id'],'name':_0x1ce29f[_0xbc6b('0x10')],'key':_0x1ce29f[_0xbc6b('0x11')],'active':_0x1ce29f[_0xbc6b('0x12')],'Imap':{'status':_0x1ce29f[_0xbc6b('0x13')][_0xbc6b('0x14')],'messageStatus':_0x1ce29f['Imap'][_0xbc6b('0x15')],'total':_0x1ce29f[_0xbc6b('0x13')][_0xbc6b('0x16')]}};if(_[_0xbc6b('0x17')](md5Accounts[_0x53406a])){md5Accounts[_0x53406a]={};}var _0x506007=md5(JSON[_0xbc6b('0x18')](_0x30e9e2));if(md5Accounts[_0x53406a][_0xbc6b('0x2')]!==_0x506007){md5Accounts[_0x53406a]['md5']=_0x506007;io[_0xbc6b('0xf')](_0xbc6b('0x19'),_0x30e9e2);}};EmailChannel[_0xbc6b('0x1a')][_0xbc6b('0x1b')]=function(_0xb06b3d){for(var _0x474ee8 in _0xb06b3d){if(_0xb06b3d[_0xbc6b('0x1c')](_0x474ee8)){if(_0xb06b3d[_0x474ee8][_0xbc6b('0x13')]&&_0xb06b3d[_0x474ee8][_0xbc6b('0x12')]){var _0x2c4b3a=_0xb06b3d[_0x474ee8][_0xbc6b('0x13')];if(!this[_0xbc6b('0xd')][_0xbc6b('0x1c')](_0x2c4b3a['id'])){this[_0xbc6b('0xd')][_0x2c4b3a['id']]=new EmailImap(_0x2c4b3a,_0xb06b3d[_0x474ee8][_0xbc6b('0x5')]);this[_0xbc6b('0xd')][_0x2c4b3a['id']]['on'](_0xbc6b('0x1d'),this['handleImapBox'][_0xbc6b('0x1e')](this,_0x474ee8));this[_0xbc6b('0xd')][_0x2c4b3a['id']]['on'](_0xbc6b('0x5'),this['handleImapEmail'][_0xbc6b('0x1e')](this,_0x474ee8));this[_0xbc6b('0xd')][_0x2c4b3a['id']]['on'](_0xbc6b('0x1f'),this['handleImapEnd'][_0xbc6b('0x1e')](this,_0x474ee8));this['imapAccounts'][_0x2c4b3a['id']]['on'](_0xbc6b('0x20'),this[_0xbc6b('0x21')][_0xbc6b('0x1e')](this,_0x474ee8));}}else{if(_['isNil'](this['mailAccounts'][_0x474ee8][_0xbc6b('0x13')])){this['mailAccounts'][_0x474ee8][_0xbc6b('0x13')]={};}this[_0xbc6b('0xc')][_0x474ee8]['Imap'][_0xbc6b('0x14')]='disabled';this[_0xbc6b('0xc')][_0x474ee8]['Imap'][_0xbc6b('0x15')]='';this[_0xbc6b('0xf')](_0x474ee8);}}}};EmailChannel[_0xbc6b('0x1a')][_0xbc6b('0x22')]=function(_0x20580a,_0x259a02){if(this['mailAccounts'][_0x20580a]){this[_0xbc6b('0xc')][_0x20580a][_0xbc6b('0x13')]['status']=_0xbc6b('0x23');this['mailAccounts'][_0x20580a][_0xbc6b('0x13')][_0xbc6b('0x15')]=_0x259a02['name'];if(_0x259a02[_0xbc6b('0x24')]){this['mailAccounts'][_0x20580a][_0xbc6b('0x13')][_0xbc6b('0x16')]=_0x259a02['messages']['total'];}return this[_0xbc6b('0xf')](_0x20580a);}};EmailChannel[_0xbc6b('0x1a')][_0xbc6b('0x25')]=function(_0x4a4b60,_0x47afca){logger[_0xbc6b('0x26')](_0xbc6b('0x27'),_0x47afca[_0xbc6b('0x28')],_0x47afca[_0xbc6b('0x29')],_0x47afca[_0xbc6b('0x2a')],_0x4a4b60);if(this['mailAccounts'][_0x4a4b60]){return mailAccount['notify'](_0x4a4b60,_0x47afca)[_0xbc6b('0x2b')](function(_0x43da4c){if(_0x43da4c){logger['info'](_0xbc6b('0x2c'));}})[_0xbc6b('0x2d')](function(_0x5e59a0){logger[_0xbc6b('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xbc6b('0x18')](_0x5e59a0));});}};EmailChannel[_0xbc6b('0x1a')]['handleImapEnd']=function(_0x7a8941){if(this[_0xbc6b('0xc')][_0x7a8941]&&this[_0xbc6b('0xc')][_0x7a8941][_0xbc6b('0x13')]){if(this[_0xbc6b('0xd')][this[_0xbc6b('0xc')][_0x7a8941][_0xbc6b('0x13')]['id']]){delete this[_0xbc6b('0xd')][this[_0xbc6b('0xc')][_0x7a8941]['Imap']['id']];}this['mailAccounts'][_0x7a8941]['Imap'][_0xbc6b('0x2e')]=moment();this[_0xbc6b('0xf')](_0x7a8941);}};EmailChannel[_0xbc6b('0x1a')][_0xbc6b('0x21')]=function(_0x28e730,_0x5f4e6d){if(this['mailAccounts'][_0x28e730]){this['mailAccounts'][_0x28e730][_0xbc6b('0x13')][_0xbc6b('0x14')]=_0xbc6b('0x20');this[_0xbc6b('0xc')][_0x28e730][_0xbc6b('0x13')]['messageStatus']=_0x5f4e6d;return this['emit'](_0x28e730);}};EmailChannel[_0xbc6b('0x1a')][_0xbc6b('0x2f')]=function(_0x9e81b,_0x22f35a){return this[_0xbc6b('0xe')][_0xbc6b('0x30')](_0x9e81b,_0x22f35a);};EmailChannel[_0xbc6b('0x1a')][_0xbc6b('0x31')]=function(_0x3a3b47){var _0x5ba269=this;if(this['mailAccounts'][_0x3a3b47['id']]){if(_['isNil'](this[_0xbc6b('0xc')][_0x3a3b47['id']]['Smtp'])){this[_0xbc6b('0xc')][_0x3a3b47['id']][_0xbc6b('0x32')]={};}this[_0xbc6b('0xc')][_0x3a3b47['id']][_0xbc6b('0x32')]['lastSync']=moment();return new BPromise(function(_0x577d32,_0x1e16d7){return _0x5ba269['smtp']['verify'](_0x3a3b47)['then'](function(_0x47127b){_0x5ba269[_0xbc6b('0xc')][_0x3a3b47['id']][_0xbc6b('0x32')][_0xbc6b('0x14')]=_0xbc6b('0x33');_0x5ba269[_0xbc6b('0xc')][_0x3a3b47['id']][_0xbc6b('0x32')][_0xbc6b('0x15')]='';_0x5ba269[_0xbc6b('0xf')](_0x3a3b47['id']);_0x577d32(_0x47127b);})[_0xbc6b('0x2d')](function(_0x18e4a3){_0x5ba269[_0xbc6b('0xc')][_0x3a3b47['id']][_0xbc6b('0x32')][_0xbc6b('0x14')]=_0xbc6b('0x20');_0x5ba269['mailAccounts'][_0x3a3b47['id']][_0xbc6b('0x32')][_0xbc6b('0x15')]=_0x18e4a3;_0x5ba269[_0xbc6b('0xf')](_0x3a3b47['id']);_0x1e16d7(_0x18e4a3);});});}return this['smtp']['verify'](_0x3a3b47);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 048af4b..9ef159b 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 _0x5388=['tls','required','anonymous@xcally.com','prototype','openBox','handleOpenBox','handleError','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','error','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','handleFetchError','stringify','textCode','hasOwnProperty','exports','path','imap','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port'];(function(_0x5a753f,_0x5b9e92){var _0x2db0f5=function(_0x48f2cb){while(--_0x48f2cb){_0x5a753f['push'](_0x5a753f['shift']());}};_0x2db0f5(++_0x5b9e92);}(_0x5388,0x1ba));var _0x8538=function(_0x4ca7e2,_0x1d3ed2){_0x4ca7e2=_0x4ca7e2-0x0;var _0x1ef9c3=_0x5388[_0x4ca7e2];return _0x1ef9c3;};'use strict';var fs=require('fs');var path=require(_0x8538('0x0'));var util=require('util');var Imap=require(_0x8538('0x1'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x8538('0x2'))[_0x8538('0x3')];var Iconv=require('iconv')[_0x8538('0x4')];var EventEmitter=require(_0x8538('0x5'))[_0x8538('0x6')];var utils=require('./utils');var logger=require(_0x8538('0x7'))(_0x8538('0x8'));function EmailImap(_0x551f25,_0x55e35d){this[_0x8538('0x9')]=_0x8538('0xa');this[_0x8538('0xb')]=this[_0x8538('0xc')](_0x551f25,_0x55e35d);this['imap']=new Imap(this['account']);this[_0x8538('0x1')][_0x8538('0xd')](_0x8538('0xe'),this[_0x8538('0xf')][_0x8538('0x10')](this));this['imap'][_0x8538('0xd')](_0x8538('0x11'),this[_0x8538('0x12')][_0x8538('0x10')](this));this[_0x8538('0x1')]['on']('error',this['handleError'][_0x8538('0x10')](this));this['imap'][_0x8538('0x13')]();}util[_0x8538('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x8538('0xc')]=function(_0x5dfc34,_0x55a66a){var _0x372395={'connTimeout':_0x5dfc34[_0x8538('0x15')]?_0x5dfc34[_0x8538('0x15')]*0x3e8:0x2710,'authTimeout':_0x5dfc34[_0x8538('0x16')]?_0x5dfc34[_0x8538('0x16')]*0x3e8:0x1388};if(_[_0x8538('0x17')](_0x5dfc34[_0x8538('0x18')])){if(_0x5dfc34[_0x8538('0x19')]){_0x372395['user']=_0x5dfc34[_0x8538('0x1a')];_0x372395['password']=_0x5dfc34[_0x8538('0x1b')];}_0x372395[_0x8538('0x1c')]=_0x5dfc34['host'];_0x372395[_0x8538('0x1d')]=_0x5dfc34['port']||0x3e1;if(_0x5dfc34[_0x8538('0x1e')]){_0x372395[_0x8538('0x1e')]=!![];}else{_0x372395[_0x8538('0x1e')]=![];_0x372395['autotls']=_0x8538('0x1f');}}else{_0x372395['user']=_0x5dfc34[_0x8538('0x1a')];_0x372395[_0x8538('0x1b')]=_0x5dfc34[_0x8538('0x1b')];_0x372395[_0x8538('0x1c')]=utils['getHost'](_0x5dfc34[_0x8538('0x18')]);_0x372395[_0x8538('0x1d')]=0x3e1;_0x372395['tls']=!![];}_0x372395[_0x8538('0x8')]=_0x55a66a||_0x5dfc34[_0x8538('0x1a')]||_0x8538('0x20');return _0x372395;};EmailImap[_0x8538('0x21')][_0x8538('0xf')]=function(){this[_0x8538('0x1')][_0x8538('0x22')](this[_0x8538('0x9')],![],this[_0x8538('0x23')][_0x8538('0x10')](this));};EmailImap[_0x8538('0x21')][_0x8538('0x23')]=function(_0x172762,_0x374cc){if(_0x172762){this[_0x8538('0x24')](_0x172762,!![]);}else{this['emit'](_0x8538('0x25'),_0x374cc);this[_0x8538('0x26')]();}};EmailImap['prototype'][_0x8538('0x27')]=function(_0x13838f){if(_0x13838f){this['handleError'](_0x13838f,!![]);}else{this[_0x8538('0x1')]['end']();}};EmailImap[_0x8538('0x21')][_0x8538('0x26')]=function(){this[_0x8538('0x1')][_0x8538('0x28')]([_0x8538('0x29')],this[_0x8538('0x2a')]['bind'](this));};EmailImap[_0x8538('0x21')][_0x8538('0x2a')]=function(_0x24b405,_0x221581){if(_0x24b405){this[_0x8538('0x24')](_0x24b405,!![]);}else{if(_0x221581['length']){try{var _0x5f2586=this[_0x8538('0x1')][_0x8538('0x2b')](_0x221581,{'bodies':'','markSeen':!![]});_0x5f2586['on']('message',this[_0x8538('0x2c')][_0x8538('0x10')](this));_0x5f2586['once'](_0x8538('0x2d'),this['handleFetchError']['bind'](this));_0x5f2586['once'](_0x8538('0x11'),this[_0x8538('0x2e')][_0x8538('0x10')](this));}catch(_0x3caa68){logger[_0x8538('0x2d')](_0x3caa68);}}else{this['imap'][_0x8538('0x2f')](!![],this[_0x8538('0x27')][_0x8538('0x10')](this));}}};EmailImap['prototype'][_0x8538('0x2c')]=function(_0x5388af,_0x1feffc){_0x5388af['on']('body',this[_0x8538('0x30')][_0x8538('0x10')](this));_0x5388af['once'](_0x8538('0x31'),this[_0x8538('0x32')][_0x8538('0x10')](this));_0x5388af[_0x8538('0xd')](_0x8538('0x11'),this[_0x8538('0x33')][_0x8538('0x10')](this));};EmailImap[_0x8538('0x21')][_0x8538('0x30')]=function(_0x4222d2,_0x5b7937){simpleParser(_0x4222d2,{'Iconv':Iconv},this[_0x8538('0x34')][_0x8538('0x10')](this));};EmailImap['prototype'][_0x8538('0x32')]=function(_0x2c3f60){};EmailImap[_0x8538('0x21')][_0x8538('0x33')]=function(){};EmailImap[_0x8538('0x21')][_0x8538('0x34')]=function(_0xb3a87e,_0x4614f5){if(_0xb3a87e){logger['error'](_0xb3a87e);}else{var _0x3cf5f8=this;utils['parser'](this[_0x8538('0xb')],_0x4614f5,function(_0x5d4b77){_0x3cf5f8[_0x8538('0x35')]('email',_0x5d4b77);});}};EmailImap[_0x8538('0x21')][_0x8538('0x2e')]=function(){this[_0x8538('0x1')]['closeBox'](!![],this[_0x8538('0x27')][_0x8538('0x10')](this));};EmailImap[_0x8538('0x21')][_0x8538('0x36')]=function(_0x30b236){this['handleError'](_0x30b236);this[_0x8538('0x1')][_0x8538('0x2f')](!![],this['handleCloseBox'][_0x8538('0x10')](this));};EmailImap[_0x8538('0x21')][_0x8538('0x12')]=function(){this[_0x8538('0x35')](_0x8538('0x11'));};EmailImap[_0x8538('0x21')]['handleError']=function(_0x41de75,_0x2957db){logger[_0x8538('0x2d')]('handleError',this[_0x8538('0xb')]['email'],JSON[_0x8538('0x37')](_0x41de75));var _0x2d153c='';if(_0x41de75){if(_0x41de75[_0x8538('0x38')]){_0x2d153c=_0x41de75[_0x8538('0x38')];}else{for(var _0x455074 in _0x41de75){if(_0x41de75[_0x8538('0x39')](_0x455074)){_0x2d153c+=_['upperFirst'](_0x455074)+':\x20'+_0x41de75[_0x455074]+'\x0a';}}}}if(_0x2957db){this[_0x8538('0x1')][_0x8538('0x11')]();}else{this[_0x8538('0x35')](_0x8538('0x2d'),_0x2d153c);this['emit']('end');}};module[_0x8538('0x3a')]=EmailImap; \ No newline at end of file +var _0x7ac9=['connTimeout','authTimeout','service','user','host','port','tls','autotls','required','password','getHost','anonymous@xcally.com','openBox','emit','box','handleCloseBox','handleError','UNSEEN','handleReadUnseen','length','message','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','imap','end','handleEnd','error','connect','prototype'];(function(_0x24134c,_0x3cacbe){var _0x3bc1d5=function(_0x543980){while(--_0x543980){_0x24134c['push'](_0x24134c['shift']());}};_0x3bc1d5(++_0x3cacbe);}(_0x7ac9,0x10b));var _0x97ac=function(_0x215c08,_0x3dbaa6){_0x215c08=_0x215c08-0x0;var _0x4aedee=_0x7ac9[_0x215c08];return _0x4aedee;};'use strict';var fs=require('fs');var path=require(_0x97ac('0x0'));var util=require(_0x97ac('0x1'));var Imap=require('imap');var _=require(_0x97ac('0x2'));var rs=require(_0x97ac('0x3'));var simpleParser=require(_0x97ac('0x4'))[_0x97ac('0x5')];var Iconv=require(_0x97ac('0x6'))[_0x97ac('0x7')];var EventEmitter=require('events')['EventEmitter'];var utils=require('./utils');var logger=require('../../../config/logger')(_0x97ac('0x8'));function EmailImap(_0x5e600c,_0x171869){this[_0x97ac('0x9')]=_0x97ac('0xa');this[_0x97ac('0xb')]=this[_0x97ac('0xc')](_0x5e600c,_0x171869);this['imap']=new Imap(this['account']);this['imap'][_0x97ac('0xd')](_0x97ac('0xe'),this[_0x97ac('0xf')][_0x97ac('0x10')](this));this[_0x97ac('0x11')]['once'](_0x97ac('0x12'),this[_0x97ac('0x13')]['bind'](this));this[_0x97ac('0x11')]['on'](_0x97ac('0x14'),this['handleError'][_0x97ac('0x10')](this));this[_0x97ac('0x11')][_0x97ac('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x97ac('0x16')][_0x97ac('0xc')]=function(_0x47a22d,_0x11c805){var _0x4fd03c={'connTimeout':_0x47a22d['connTimeout']?_0x47a22d[_0x97ac('0x17')]*0x3e8:0x2710,'authTimeout':_0x47a22d[_0x97ac('0x18')]?_0x47a22d[_0x97ac('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x47a22d[_0x97ac('0x19')])){if(_0x47a22d['authentication']){_0x4fd03c[_0x97ac('0x1a')]=_0x47a22d[_0x97ac('0x1a')];_0x4fd03c['password']=_0x47a22d['password'];}_0x4fd03c[_0x97ac('0x1b')]=_0x47a22d[_0x97ac('0x1b')];_0x4fd03c[_0x97ac('0x1c')]=_0x47a22d[_0x97ac('0x1c')]||0x3e1;if(_0x47a22d[_0x97ac('0x1d')]){_0x4fd03c['tls']=!![];}else{_0x4fd03c[_0x97ac('0x1d')]=![];_0x4fd03c[_0x97ac('0x1e')]=_0x97ac('0x1f');}}else{_0x4fd03c[_0x97ac('0x1a')]=_0x47a22d[_0x97ac('0x1a')];_0x4fd03c[_0x97ac('0x20')]=_0x47a22d[_0x97ac('0x20')];_0x4fd03c[_0x97ac('0x1b')]=utils[_0x97ac('0x21')](_0x47a22d[_0x97ac('0x19')]);_0x4fd03c['port']=0x3e1;_0x4fd03c['tls']=!![];}_0x4fd03c[_0x97ac('0x8')]=_0x11c805||_0x47a22d[_0x97ac('0x1a')]||_0x97ac('0x22');return _0x4fd03c;};EmailImap[_0x97ac('0x16')][_0x97ac('0xf')]=function(){this[_0x97ac('0x11')][_0x97ac('0x23')](this[_0x97ac('0x9')],![],this['handleOpenBox'][_0x97ac('0x10')](this));};EmailImap[_0x97ac('0x16')]['handleOpenBox']=function(_0x569df3,_0x1f26df){if(_0x569df3){this['handleError'](_0x569df3,!![]);}else{this[_0x97ac('0x24')](_0x97ac('0x25'),_0x1f26df);this['readUnseen']();}};EmailImap['prototype'][_0x97ac('0x26')]=function(_0x4fa7f2){if(_0x4fa7f2){this[_0x97ac('0x27')](_0x4fa7f2,!![]);}else{this[_0x97ac('0x11')][_0x97ac('0x12')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x97ac('0x11')]['search']([_0x97ac('0x28')],this[_0x97ac('0x29')][_0x97ac('0x10')](this));};EmailImap[_0x97ac('0x16')]['handleReadUnseen']=function(_0x147fb4,_0x6d065c){if(_0x147fb4){this['handleError'](_0x147fb4,!![]);}else{if(_0x6d065c[_0x97ac('0x2a')]){try{var _0x5cf688=this[_0x97ac('0x11')]['fetch'](_0x6d065c,{'bodies':'','markSeen':!![]});_0x5cf688['on'](_0x97ac('0x2b'),this['handleFetchMessage'][_0x97ac('0x10')](this));_0x5cf688[_0x97ac('0xd')]('error',this['handleFetchError'][_0x97ac('0x10')](this));_0x5cf688[_0x97ac('0xd')](_0x97ac('0x12'),this['handleFetchEnd'][_0x97ac('0x10')](this));}catch(_0x35d76c){logger[_0x97ac('0x14')](_0x35d76c);}}else{this['imap'][_0x97ac('0x2c')](!![],this['handleCloseBox'][_0x97ac('0x10')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x16cabc,_0x25d3bc){_0x16cabc['on'](_0x97ac('0x2d'),this[_0x97ac('0x2e')][_0x97ac('0x10')](this));_0x16cabc['once'](_0x97ac('0x2f'),this[_0x97ac('0x30')][_0x97ac('0x10')](this));_0x16cabc[_0x97ac('0xd')](_0x97ac('0x12'),this[_0x97ac('0x31')][_0x97ac('0x10')](this));};EmailImap[_0x97ac('0x16')][_0x97ac('0x2e')]=function(_0x5cef79,_0x179c3b){simpleParser(_0x5cef79,{'Iconv':Iconv},this[_0x97ac('0x32')][_0x97ac('0x10')](this));};EmailImap[_0x97ac('0x16')]['handleMessageAttributes']=function(_0x4cbf11){};EmailImap[_0x97ac('0x16')][_0x97ac('0x31')]=function(){};EmailImap[_0x97ac('0x16')]['handleSimpleParser']=function(_0x51c659,_0x46140c){if(_0x51c659){logger[_0x97ac('0x14')](_0x51c659);}else{var _0x430c94=this;utils['parser'](this['account'],_0x46140c,function(_0x477458){_0x430c94[_0x97ac('0x24')](_0x97ac('0x8'),_0x477458);});}};EmailImap['prototype'][_0x97ac('0x33')]=function(){this['imap'][_0x97ac('0x2c')](!![],this['handleCloseBox'][_0x97ac('0x10')](this));};EmailImap['prototype'][_0x97ac('0x34')]=function(_0x57f927){this[_0x97ac('0x27')](_0x57f927);this[_0x97ac('0x11')]['closeBox'](!![],this[_0x97ac('0x26')]['bind'](this));};EmailImap[_0x97ac('0x16')]['handleEnd']=function(){this['emit'](_0x97ac('0x12'));};EmailImap[_0x97ac('0x16')]['handleError']=function(_0x2cf5a1,_0x5e5896){logger[_0x97ac('0x14')]('handleError',this[_0x97ac('0xb')][_0x97ac('0x8')],JSON[_0x97ac('0x35')](_0x2cf5a1));var _0x1de14b='';if(_0x2cf5a1){if(_0x2cf5a1[_0x97ac('0x36')]){_0x1de14b=_0x2cf5a1[_0x97ac('0x36')];}else{for(var _0x37f8d9 in _0x2cf5a1){if(_0x2cf5a1[_0x97ac('0x37')](_0x37f8d9)){_0x1de14b+=_[_0x97ac('0x38')](_0x37f8d9)+':\x20'+_0x2cf5a1[_0x37f8d9]+'\x0a';}}}}if(_0x5e5896){this[_0x97ac('0x11')][_0x97ac('0x12')]();}else{this[_0x97ac('0x24')]('error',_0x1de14b);this['emit']('end');}};module[_0x97ac('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 51a9645..feee069 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 _0x8355=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','use'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x8355,0xed));var _0x5835=function(_0x434555,_0x149803){_0x434555=_0x434555-0x0;var _0x27e8fa=_0x8355[_0x434555];return _0x27e8fa;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require(_0x5835('0x0'));function EmailSmtp(){}EmailSmtp[_0x5835('0x1')]['send']=function(_0x46ad46,_0x1bb6b0){return new BPromise(function(_0x506a58,_0x3366f2){var _0x568815=nodemailer['createTransport'](_0x46ad46);_0x568815[_0x5835('0x2')]('compile',inlineBase64());_0x568815[_0x5835('0x3')](_0x1bb6b0,function(_0x2876d0,_0x5c8335){if(_0x2876d0){_0x3366f2(_0x2876d0[_0x5835('0x4')]());}else{_0x506a58(_0x5c8335);}});});};EmailSmtp[_0x5835('0x1')][_0x5835('0x5')]=function(_0x33060e){return new BPromise(function(_0x17171e,_0x27b2db){var _0xa3d46b=nodemailer['createTransport'](_0x33060e);_0xa3d46b['verify'](function(_0x82331b,_0x4d53e4){if(_0x82331b){_0x27b2db(_0x82331b[_0x5835('0x4')]());}else{if(_0x4d53e4){_0x17171e(_0x4d53e4);}else{_0x27b2db(_0x5835('0x6'));}}});});};module[_0x5835('0x7')]=EmailSmtp; \ No newline at end of file +var _0x6a9e=['compile','toString','verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x6a9e,0x1c6));var _0xe6a9=function(_0x213fde,_0x367219){_0x213fde=_0x213fde-0x0;var _0x131bc7=_0x6a9e[_0x213fde];return _0x131bc7;};'use strict';var nodemailer=require(_0xe6a9('0x0'));var BPromise=require(_0xe6a9('0x1'));var inlineBase64=require(_0xe6a9('0x2'));function EmailSmtp(){}EmailSmtp[_0xe6a9('0x3')]['send']=function(_0x3a5aca,_0x3e3f1d){return new BPromise(function(_0x1d1313,_0x56eac8){var _0x26b658=nodemailer[_0xe6a9('0x4')](_0x3a5aca);_0x26b658[_0xe6a9('0x5')](_0xe6a9('0x6'),inlineBase64());_0x26b658['sendMail'](_0x3e3f1d,function(_0x1e93ca,_0x13c45b){if(_0x1e93ca){_0x56eac8(_0x1e93ca[_0xe6a9('0x7')]());}else{_0x1d1313(_0x13c45b);}});});};EmailSmtp['prototype'][_0xe6a9('0x8')]=function(_0x521345){return new BPromise(function(_0xa0cfb8,_0x15a909){var _0x556070=nodemailer[_0xe6a9('0x4')](_0x521345);_0x556070[_0xe6a9('0x8')](function(_0x59a086,_0x480be4){if(_0x59a086){_0x15a909(_0x59a086[_0xe6a9('0x7')]());}else{if(_0x480be4){_0xa0cfb8(_0x480be4);}else{_0x15a909('Not\x20verifired');}}});});};module[_0xe6a9('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2d59259..1db553b 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 _0x4379=['yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','split','length','slice','join','pop','isEmpty','generate','html','replace','body','message','originTo','includes','originCc','attachments','attach','type','attachment','filename','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com'];(function(_0x47a953,_0x284387){var _0x1023af=function(_0x3a38d8){while(--_0x3a38d8){_0x47a953['push'](_0x47a953['shift']());}};_0x1023af(++_0x284387);}(_0x4379,0x159));var _0x9437=function(_0x4955e4,_0x459fe9){_0x4955e4=_0x4955e4-0x0;var _0x35347f=_0x4379[_0x4955e4];return _0x35347f;};'use strict';var _=require(_0x9437('0x0'));var moment=require(_0x9437('0x1'));var random=require(_0x9437('0x2'));var fs=require('fs');var path=require(_0x9437('0x3'));var util=require('util');var tnef=require(_0x9437('0x4'));var logger=require(_0x9437('0x5'))(_0x9437('0x6'));var config=require(_0x9437('0x7'));function getAddress(_0x4d466b){var _0x5c0c8a=_[_0x9437('0x8')](_0x4d466b[_0x9437('0x9')]);return _0x5c0c8a&&_0x5c0c8a[_0x9437('0xa')]?_0x5c0c8a[_0x9437('0xa')]:_0x9437('0xb')+random['generate'](0x6)+_0x9437('0xc');}function getFirstName(_0x2c030d){var _0xb47105=_[_0x9437('0x8')](_0x2c030d['value']);if(_0xb47105&&_0xb47105['name']){var _0x11ee69=_0xb47105[_0x9437('0xd')][_0x9437('0xe')](/\s+/);return _0x11ee69[_0x9437('0xf')]?_0x11ee69[_0x9437('0x10')](0x0,-0x1)[_0x9437('0x11')]('\x20'):_0xb47105[_0x9437('0xd')];}return'Anonymous';}function getLastName(_0x74e391){var _0x32601b=_[_0x9437('0x8')](_0x74e391[_0x9437('0x9')]);if(_0x32601b&&_0x32601b['name']){var _0x2cd0da=_0x32601b[_0x9437('0xd')][_0x9437('0xe')](/\s+/);return _0x2cd0da[_0x9437('0xf')]>0x1?_0x2cd0da[_0x9437('0x12')]():'';}return'';}function getMails(_0x196c30,_0x5966f5){var _0x9610a7='';for(var _0x5bd6d6=0x0;_0x5bd6d6<_0x5966f5['value'][_0x9437('0xf')];_0x5bd6d6+=0x1){if(_0x5966f5[_0x9437('0x9')][_0x5bd6d6]['address']!==_0x196c30){if(!_[_0x9437('0x13')](_0x9610a7)){_0x9610a7+=',';}_0x9610a7+=_0x5966f5['value'][_0x5bd6d6][_0x9437('0xd')]||_0x5966f5[_0x9437('0x9')][_0x5bd6d6][_0x9437('0xa')]||'';_0x9610a7+='\x20<';_0x9610a7+=_0x5966f5['value'][_0x5bd6d6]['address']?_0x5966f5[_0x9437('0x9')][_0x5bd6d6][_0x9437('0xa')]:'anonymous'+random[_0x9437('0x14')](0x6)+_0x9437('0xc');_0x9610a7+='>';}}return _0x9610a7;}function parseEmail(_0x251c00,_0x110a43,_0x4a39f6){if(_0x110a43[_0x9437('0x15')]){var _0x522f41=/)<[^<]*)*<\/script>/gi;while(_0x522f41['test'](_0x110a43[_0x9437('0x15')])){_0x110a43['html']=_0x110a43[_0x9437('0x15')][_0x9437('0x16')](_0x522f41,'');}_0x4a39f6['body']=_0x110a43[_0x9437('0x15')];}else{_0x4a39f6[_0x9437('0x17')]=_0x110a43['textAsHtml'];}if(_0x4a39f6[_0x9437('0x17')]){_0x4a39f6['body']=_0x4a39f6['body'][_0x9437('0x16')](/Empty\x20message

','Attachments','push','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name','split','length','Anonymous','isEmpty','generate','html','test','replace','body','textAsHtml','0x1?_0x1c6a25['pop']():'';}return'';}function getMails(_0xcc12f2,_0x588eb6){var _0x5aba9f='';for(var _0x4765d4=0x0;_0x4765d4<_0x588eb6[_0x15a9('0x8')]['length'];_0x4765d4+=0x1){if(_0x588eb6['value'][_0x4765d4]['address']!==_0xcc12f2){if(!_[_0x15a9('0x11')](_0x5aba9f)){_0x5aba9f+=',';}_0x5aba9f+=_0x588eb6[_0x15a9('0x8')][_0x4765d4][_0x15a9('0xd')]||_0x588eb6[_0x15a9('0x8')][_0x4765d4]['address']||'';_0x5aba9f+='\x20<';_0x5aba9f+=_0x588eb6[_0x15a9('0x8')][_0x4765d4][_0x15a9('0x9')]?_0x588eb6[_0x15a9('0x8')][_0x4765d4][_0x15a9('0x9')]:_0x15a9('0xa')+random[_0x15a9('0x12')](0x6)+_0x15a9('0xb');_0x5aba9f+='>';}}return _0x5aba9f;}function parseEmail(_0x46ebf9,_0x3fc38f,_0x2e7148){if(_0x3fc38f[_0x15a9('0x13')]){var _0x10a909=/)<[^<]*)*<\/script>/gi;while(_0x10a909[_0x15a9('0x14')](_0x3fc38f['html'])){_0x3fc38f['html']=_0x3fc38f[_0x15a9('0x13')][_0x15a9('0x15')](_0x10a909,'');}_0x2e7148[_0x15a9('0x16')]=_0x3fc38f['html'];}else{_0x2e7148['body']=_0x3fc38f[_0x15a9('0x17')];}if(_0x2e7148[_0x15a9('0x16')]){_0x2e7148[_0x15a9('0x16')]=_0x2e7148['body'][_0x15a9('0x15')](/0x0){if(this[_0x146c1b+_0xabc4('0x27')]>0x0&&this[_0x146c1b+'CurrentCapacity']>=this[_0x146c1b+_0xabc4('0x27')]){return _0xabc4('0x28');}else{return _0xabc4('0x29');}}else{return _0xabc4('0x2a');}};Agent['prototype'][_0xabc4('0x2b')]=function(){var _0x5f4434=['mail',_0xabc4('0x2c'),_0xabc4('0x2d'),'fax',_0xabc4('0x2e'),_0xabc4('0x2f')];for(var _0x146c2f=0x0;_0x146c2f<_0x5f4434[_0xabc4('0x30')];_0x146c2f+=0x1){var _0x310ea7=this[_0xabc4('0x25')](_0x5f4434[_0x146c2f]);if(this[_0x5f4434[_0x146c2f]+'Status']!==_0x310ea7){this[_0x5f4434[_0x146c2f]+'StatusTime']=_[_0xabc4('0x31')](moment()[_0xabc4('0x32')]('x'));}this[_0x5f4434[_0x146c2f]+_0xabc4('0x33')]=_0x310ea7;}var _0x4e463e={'id':this['id'],'name':this[_0xabc4('0x5')],'online':this[_0xabc4('0x6')],'voicePause':this[_0xabc4('0x7')],'chatPause':this[_0xabc4('0x8')],'mailPause':this['mailPause'],'smsPause':this[_0xabc4('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0xabc4('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xabc4('0xf')],'chatCapacity':this[_0xabc4('0x10')],'chatCurrentCapacity':this[_0xabc4('0x11')],'mailStatus':this[_0xabc4('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xabc4('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xabc4('0x34')],'faxStatusTime':this[_0xabc4('0x16')],'faxCapacity':this[_0xabc4('0x17')],'faxCurrentCapacity':this[_0xabc4('0x35')],'smsStatus':this[_0xabc4('0x36')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xabc4('0x1a')],'whatsappStatus':this[_0xabc4('0x1b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xabc4('0x1e')],'openchannelStatusTime':this[_0xabc4('0x1f')],'openchannelCapacity':this[_0xabc4('0x20')],'openchannelCurrentCapacity':this[_0xabc4('0x21')],'busy':this[_0xabc4('0x22')],'busyQueue':this[_0xabc4('0x23')]};var _0x125718=md5(JSON[_0xabc4('0x37')](_0x4e463e));if(this['md5']!==_0x125718){this[_0xabc4('0x2')]=_0x125718;io[_0xabc4('0x38')](_0xabc4('0x39'),_0x4e463e);}};module[_0xabc4('0x3a')]=Agent; \ No newline at end of file +var _0xc933=['ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','smsPause','faxCapacity','whatsappStatus','openchannelStatus','openchannelStatusTime','stringify','user:save','exports','lodash','moment','md5'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xc933,0xf9));var _0x3c93=function(_0x35adcc,_0x1c1019){_0x35adcc=_0x35adcc-0x0;var _0x2c6218=_0xc933[_0x35adcc];return _0x2c6218;};'use strict';var _=require(_0x3c93('0x0'));var moment=require(_0x3c93('0x1'));var md5=require(_0x3c93('0x2'));var Redis=require(_0x3c93('0x3'));var config=require(_0x3c93('0x4'));config['redis']=_[_0x3c93('0x5')](config[_0x3c93('0x6')],{'host':_0x3c93('0x7'),'port':0x18eb});var io=require(_0x3c93('0x8'))(new Redis(config[_0x3c93('0x6')]));function Agent(_0x47a995){this['id']=_0x47a995['id']||0x0;this[_0x3c93('0x9')]=_0x47a995[_0x3c93('0x9')]||'';this['online']=_0x47a995[_0x3c93('0xa')]||!![];this['voicePause']=_0x47a995[_0x3c93('0xb')]||![];this[_0x3c93('0xc')]=_0x47a995[_0x3c93('0xc')]||![];this[_0x3c93('0xd')]=_0x47a995[_0x3c93('0xd')]||![];this[_0x3c93('0xe')]=_0x47a995['faxPause']||![];this['smsPause']=_0x47a995['smsPause']||![];this[_0x3c93('0xf')]=_0x47a995[_0x3c93('0xf')]||![];this[_0x3c93('0x10')]=_0x3c93('0x11');this[_0x3c93('0x12')]=0x0;this[_0x3c93('0x13')]=_0x47a995[_0x3c93('0x13')]||0x0;this[_0x3c93('0x14')]=0x0;this[_0x3c93('0x15')]=_0x3c93('0x11');this[_0x3c93('0x16')]=0x0;this[_0x3c93('0x17')]=_0x47a995[_0x3c93('0x17')]||0x0;this[_0x3c93('0x18')]=0x0;this[_0x3c93('0x19')]=_0x3c93('0x11');this[_0x3c93('0x1a')]=0x0;this['faxCapacity']=_0x47a995['faxCapacity']||0x0;this[_0x3c93('0x1b')]=0x0;this[_0x3c93('0x1c')]=_0x3c93('0x11');this[_0x3c93('0x1d')]=0x0;this[_0x3c93('0x1e')]=_0x47a995[_0x3c93('0x1e')]||0x0;this[_0x3c93('0x1f')]=0x0;this['whatsappStatus']='unknown';this[_0x3c93('0x20')]=0x0;this[_0x3c93('0x21')]=_0x47a995['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x3c93('0x11');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x47a995['openchannelCapacity']||0x0;this[_0x3c93('0x22')]=0x0;this[_0x3c93('0x23')]=![];this[_0x3c93('0x24')]=undefined;this[_0x3c93('0x2')]='';this[_0x3c93('0x25')]();}Agent[_0x3c93('0x26')][_0x3c93('0x27')]=function(_0x18d02c){if(this[_0x18d02c+_0x3c93('0x28')]>0x0){if(this[_0x18d02c+_0x3c93('0x29')]>0x0&&this[_0x18d02c+'CurrentCapacity']>=this[_0x18d02c+_0x3c93('0x29')]){return _0x3c93('0x2a');}else{return _0x3c93('0x2b');}}else{return _0x3c93('0x2c');}};Agent[_0x3c93('0x26')][_0x3c93('0x25')]=function(){var _0x49a81c=[_0x3c93('0x2d'),_0x3c93('0x2e'),_0x3c93('0x2f'),_0x3c93('0x30'),_0x3c93('0x31'),_0x3c93('0x32')];for(var _0x1a180f=0x0;_0x1a180f<_0x49a81c[_0x3c93('0x33')];_0x1a180f+=0x1){var _0x2d06da=this['getChannelStatus'](_0x49a81c[_0x1a180f]);if(this[_0x49a81c[_0x1a180f]+_0x3c93('0x34')]!==_0x2d06da){this[_0x49a81c[_0x1a180f]+_0x3c93('0x35')]=_[_0x3c93('0x36')](moment()['format']('x'));}this[_0x49a81c[_0x1a180f]+_0x3c93('0x34')]=_0x2d06da;}var _0x2446b4={'id':this['id'],'name':this[_0x3c93('0x9')],'online':this[_0x3c93('0xa')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x3c93('0x37')],'faxPause':this[_0x3c93('0xe')],'openchannelPause':this[_0x3c93('0xf')],'chatStatus':this[_0x3c93('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x3c93('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x3c93('0x16')],'mailCapacity':this[_0x3c93('0x17')],'mailCurrentCapacity':this[_0x3c93('0x18')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x3c93('0x1a')],'faxCapacity':this[_0x3c93('0x38')],'faxCurrentCapacity':this[_0x3c93('0x1b')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x3c93('0x1d')],'smsCapacity':this[_0x3c93('0x1e')],'smsCurrentCapacity':this[_0x3c93('0x1f')],'whatsappStatus':this[_0x3c93('0x39')],'whatsappStatusTime':this[_0x3c93('0x20')],'whatsappCapacity':this[_0x3c93('0x21')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x3c93('0x3a')],'openchannelStatusTime':this[_0x3c93('0x3b')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x3c93('0x22')],'busy':this[_0x3c93('0x23')],'busyQueue':this[_0x3c93('0x24')]};var _0x4e5c98=md5(JSON[_0x3c93('0x3c')](_0x2446b4));if(this['md5']!==_0x4e5c98){this[_0x3c93('0x2')]=_0x4e5c98;io['emit'](_0x3c93('0x3d'),_0x2446b4);}};module[_0x3c93('0x3e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b7b5f1d..69b5dc9 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 _0xb5a2=['_rr','prototype','loggedIn','length','available','paused','stringify','format','chat:queue:%s','emit','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x470fbc,_0x322105){var _0x4d002b=function(_0x5281ba){while(--_0x5281ba){_0x470fbc['push'](_0x470fbc['shift']());}};_0x4d002b(++_0x322105);}(_0xb5a2,0x128));var _0x2b5a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb5a2[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2b5a('0x0'));var md5=require(_0x2b5a('0x1'));var util=require(_0x2b5a('0x2'));var Redis=require(_0x2b5a('0x3'));var config=require('../../../config/environment');config[_0x2b5a('0x4')]=_[_0x2b5a('0x5')](config['redis'],{'host':_0x2b5a('0x6'),'port':0x18eb});var io=require(_0x2b5a('0x7'))(new Redis(config['redis']));function ChatQueue(_0x1d9727){this['id']=_0x1d9727['id']||0x0;this[_0x2b5a('0x8')]=_0x1d9727[_0x2b5a('0x8')]||'';this[_0x2b5a('0x9')]=_0x1d9727[_0x2b5a('0x9')]||0xa;this['strategy']=_0x1d9727['strategy']||_0x2b5a('0xa');this[_0x2b5a('0xb')]=_0x1d9727['Agents'];this[_0x2b5a('0xc')]={};this[_0x2b5a('0xd')]=0x0;this['md5']='';this[_0x2b5a('0xe')]();this[_0x2b5a('0xf')]();}ChatQueue['prototype'][_0x2b5a('0xe')]=function(){var _0x199bd1=this[_0x2b5a('0xc')][_0x2b5a('0x10')];this[_0x2b5a('0xc')]=_['map'](this[_0x2b5a('0xb')],'id');this['mapAgentsId']['_rr']=_0x199bd1;};ChatQueue[_0x2b5a('0x11')][_0x2b5a('0xf')]=function(){this[_0x2b5a('0x12')]=0x0;this['paused']=0x0;for(var _0x35a7ea=0x0;_0x35a7ea=0x0?this[_0x2b5a('0x14')]:0x0;var _0x364903={'id':this['id'],'available':this[_0x2b5a('0x14')],'loggedIn':this[_0x2b5a('0x12')],'name':this[_0x2b5a('0x8')],'paused':this[_0x2b5a('0x15')],'waiting':this[_0x2b5a('0xd')]};var _0xf47feb=md5(JSON[_0x2b5a('0x16')](_0x364903));if(this[_0x2b5a('0x1')]!==_0xf47feb){this[_0x2b5a('0x1')]=_0xf47feb;io['to'](util[_0x2b5a('0x17')](_0x2b5a('0x18'),_0x364903[_0x2b5a('0x8')]))[_0x2b5a('0x19')]('chat_queue:save',_0x364903);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xad8e=['length','loggedIn','chatPause','available','chat:queue:%s','emit','chat_queue:save','lodash','md5','redis','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','Agents','paused'];(function(_0x4e1c3c,_0x2a8084){var _0x1c7150=function(_0x56daac){while(--_0x56daac){_0x4e1c3c['push'](_0x4e1c3c['shift']());}};_0x1c7150(++_0x2a8084);}(_0xad8e,0x127));var _0xead8=function(_0x446130,_0x58be85){_0x446130=_0x446130-0x0;var _0x347295=_0xad8e[_0x446130];return _0x347295;};'use strict';var _=require(_0xead8('0x0'));var md5=require(_0xead8('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xead8('0x2')]=_['defaults'](config[_0xead8('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xead8('0x3'))(new Redis(config[_0xead8('0x2')]));function ChatQueue(_0x4ef076){this['id']=_0x4ef076['id']||0x0;this['name']=_0x4ef076[_0xead8('0x4')]||'';this[_0xead8('0x5')]=_0x4ef076[_0xead8('0x5')]||0xa;this[_0xead8('0x6')]=_0x4ef076['strategy']||_0xead8('0x7');this['Agents']=_0x4ef076['Agents'];this['mapAgentsId']={};this[_0xead8('0x8')]=0x0;this['md5']='';this[_0xead8('0x9')]();this[_0xead8('0xa')]();}ChatQueue[_0xead8('0xb')][_0xead8('0x9')]=function(){var _0x1f81c8=this[_0xead8('0xc')][_0xead8('0xd')];this[_0xead8('0xc')]=_[_0xead8('0xe')](this[_0xead8('0xf')],'id');this['mapAgentsId']['_rr']=_0x1f81c8;};ChatQueue[_0xead8('0xb')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xead8('0x10')]=0x0;for(var _0x477084=0x0;_0x477084=0x0?this[_0xead8('0x14')]:0x0;var _0x36e20b={'id':this['id'],'available':this[_0xead8('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xead8('0x4')],'paused':this[_0xead8('0x10')],'waiting':this[_0xead8('0x8')]};var _0x1e5d1d=md5(JSON['stringify'](_0x36e20b));if(this[_0xead8('0x1')]!==_0x1e5d1d){this[_0xead8('0x1')]=_0x1e5d1d;io['to'](util['format'](_0xead8('0x15'),_0x36e20b[_0xead8('0x4')]))[_0xead8('0x16')](_0xead8('0x17'),_0x36e20b);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 64670e4..360c1af 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(_0x3aa00f,_0x46eb66){var _0x336ea5=function(_0x3c03dc){while(--_0x3c03dc){_0x3aa00f['push'](_0x3aa00f['shift']());}};_0x336ea5(++_0x46eb66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x8feb40,_0x53f428){var _0x5d865e=function(_0x162a83){while(--_0x162a83){_0x8feb40['push'](_0x8feb40['shift']());}};_0x5d865e(++_0x53f428);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 77d3673..87c598e 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 _0xe893=['Intervals','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe893,0x11f));var _0x3e89=function(_0x57b8b4,_0x5e3e78){_0x57b8b4=_0x57b8b4-0x0;var _0x3cb37a=_0xe893[_0x57b8b4];return _0x3cb37a;};'use strict';function Interval(_0x380ab5){this['id']=_0x380ab5['id']||0x0;this[_0x3e89('0x0')]=_0x380ab5[_0x3e89('0x0')]||'';this[_0x3e89('0x1')]=_0x380ab5[_0x3e89('0x1')]||{};}module[_0x3e89('0x2')]=Interval; \ No newline at end of file +var _0x37db=['name','Intervals','exports'];(function(_0x447188,_0x435ae9){var _0x342165=function(_0xb1b01a){while(--_0xb1b01a){_0x447188['push'](_0x447188['shift']());}};_0x342165(++_0x435ae9);}(_0x37db,0x111));var _0xb37d=function(_0x212d7b,_0x45ef38){_0x212d7b=_0x212d7b-0x0;var _0x4c5fd5=_0x37db[_0x212d7b];return _0x4c5fd5;};'use strict';function Interval(_0x58b94b){this['id']=_0x58b94b['id']||0x0;this[_0xb37d('0x0')]=_0x58b94b[_0xb37d('0x0')]||'';this['Intervals']=_0x58b94b[_0xb37d('0x1')]||{};}module[_0xb37d('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 0087c41..9aa076c 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 _0xdf8d=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','available','stringify','format','emit','mail_queue:save','lodash','md5','ioredis','../../../config/environment','defaults','redis'];(function(_0x5385e9,_0x9398){var _0x29334e=function(_0x511caf){while(--_0x511caf){_0x5385e9['push'](_0x5385e9['shift']());}};_0x29334e(++_0x9398);}(_0xdf8d,0x1e0));var _0xddf8=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xdf8d[_0x52684f];return _0x4a55f0;};'use strict';var _=require(_0xddf8('0x0'));var md5=require(_0xddf8('0x1'));var util=require('util');var Redis=require(_0xddf8('0x2'));var config=require(_0xddf8('0x3'));config['redis']=_[_0xddf8('0x4')](config[_0xddf8('0x5')],{'host':_0xddf8('0x6'),'port':0x18eb});var io=require(_0xddf8('0x7'))(new Redis(config['redis']));function MailQueue(_0xe21231){this['id']=_0xe21231['id']||0x0;this[_0xddf8('0x8')]=_0xe21231[_0xddf8('0x8')]||'';this[_0xddf8('0x9')]=_0xe21231['timeout']||0xa;this['strategy']=_0xe21231[_0xddf8('0xa')]||_0xddf8('0xb');this[_0xddf8('0xc')]=_0xe21231[_0xddf8('0xc')];this[_0xddf8('0xd')]={};this[_0xddf8('0xe')]=0x0;this[_0xddf8('0x1')]='';this[_0xddf8('0xf')]();this['updateRealtime']();}MailQueue[_0xddf8('0x10')][_0xddf8('0xf')]=function(){var _0x13feac=this[_0xddf8('0xd')][_0xddf8('0x11')];this[_0xddf8('0xd')]=_['map'](this[_0xddf8('0xc')],'id');this['mapAgentsId']['_rr']=_0x13feac;};MailQueue[_0xddf8('0x10')][_0xddf8('0x12')]=function(){this[_0xddf8('0x13')]=0x0;this[_0xddf8('0x14')]=0x0;for(var _0x1a4c75=0x0;_0x1a4c75=0x0?this[_0xddf8('0x16')]:0x0;var _0xbd79a4={'id':this['id'],'available':this[_0xddf8('0x16')],'loggedIn':this[_0xddf8('0x13')],'name':this[_0xddf8('0x8')],'paused':this['paused'],'waiting':this[_0xddf8('0xe')]};var _0x37a080=md5(JSON[_0xddf8('0x17')](_0xbd79a4));if(this[_0xddf8('0x1')]!==_0x37a080){this[_0xddf8('0x1')]=_0x37a080;io['to'](util[_0xddf8('0x18')]('mail:queue:%s',_0xbd79a4[_0xddf8('0x8')]))[_0xddf8('0x19')](_0xddf8('0x1a'),_0xbd79a4);}};module['exports']=MailQueue; \ No newline at end of file +var _0x584e=['length','mailPause','available','format','mail:queue:%s','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x584e,0xa3));var _0xe584=function(_0x20118a,_0x3dbdf3){_0x20118a=_0x20118a-0x0;var _0x538b5f=_0x584e[_0x20118a];return _0x538b5f;};'use strict';var _=require(_0xe584('0x0'));var md5=require('md5');var util=require(_0xe584('0x1'));var Redis=require(_0xe584('0x2'));var config=require(_0xe584('0x3'));config['redis']=_['defaults'](config[_0xe584('0x4')],{'host':_0xe584('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe584('0x4')]));function MailQueue(_0x5218ab){this['id']=_0x5218ab['id']||0x0;this['name']=_0x5218ab[_0xe584('0x6')]||'';this['timeout']=_0x5218ab[_0xe584('0x7')]||0xa;this[_0xe584('0x8')]=_0x5218ab['strategy']||'beepall';this[_0xe584('0x9')]=_0x5218ab[_0xe584('0x9')];this[_0xe584('0xa')]={};this[_0xe584('0xb')]=0x0;this[_0xe584('0xc')]='';this[_0xe584('0xd')]();this[_0xe584('0xe')]();}MailQueue[_0xe584('0xf')][_0xe584('0xd')]=function(){var _0x4c4248=this[_0xe584('0xa')][_0xe584('0x10')];this[_0xe584('0xa')]=_['map'](this[_0xe584('0x9')],'id');this[_0xe584('0xa')][_0xe584('0x10')]=_0x4c4248;};MailQueue[_0xe584('0xf')][_0xe584('0xe')]=function(){this[_0xe584('0x11')]=0x0;this[_0xe584('0x12')]=0x0;for(var _0x15396f=0x0;_0x15396f=0x0?this[_0xe584('0x15')]:0x0;var _0x22e2e8={'id':this['id'],'available':this[_0xe584('0x15')],'loggedIn':this[_0xe584('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xe584('0xb')]};var _0x5ae627=md5(JSON['stringify'](_0x22e2e8));if(this[_0xe584('0xc')]!==_0x5ae627){this[_0xe584('0xc')]=_0x5ae627;io['to'](util[_0xe584('0x16')](_0xe584('0x17'),_0x22e2e8[_0xe584('0x6')]))['emit'](_0xe584('0x18'),_0x22e2e8);}};module[_0xe584('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 0ee8961..bffee20 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 _0x9479=['updateRealtime','prototype','updateRouting','_rr','map','paused','length','online','loggedIn','openchannelPause','available','stringify','format','openchannel_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x1e55cf,_0x349049){var _0x1a143e=function(_0x6411a2){while(--_0x6411a2){_0x1e55cf['push'](_0x1e55cf['shift']());}};_0x1a143e(++_0x349049);}(_0x9479,0xa5));var _0x9947=function(_0x13f105,_0x5ec253){_0x13f105=_0x13f105-0x0;var _0x38308e=_0x9479[_0x13f105];return _0x38308e;};'use strict';var _=require(_0x9947('0x0'));var md5=require(_0x9947('0x1'));var util=require(_0x9947('0x2'));var Redis=require('ioredis');var config=require(_0x9947('0x3'));config['redis']=_[_0x9947('0x4')](config[_0x9947('0x5')],{'host':_0x9947('0x6'),'port':0x18eb});var io=require(_0x9947('0x7'))(new Redis(config[_0x9947('0x5')]));function OpenchannelQueue(_0x1730ba){this['id']=_0x1730ba['id']||0x0;this[_0x9947('0x8')]=_0x1730ba[_0x9947('0x8')]||'';this['timeout']=_0x1730ba[_0x9947('0x9')]||0xa;this[_0x9947('0xa')]=_0x1730ba['strategy']||_0x9947('0xb');this[_0x9947('0xc')]=_0x1730ba[_0x9947('0xc')];this[_0x9947('0xd')]={};this[_0x9947('0xe')]=0x0;this[_0x9947('0x1')]='';this['updateRouting']();this[_0x9947('0xf')]();}OpenchannelQueue[_0x9947('0x10')][_0x9947('0x11')]=function(){var _0x4fe985=this[_0x9947('0xd')][_0x9947('0x12')];this[_0x9947('0xd')]=_[_0x9947('0x13')](this[_0x9947('0xc')],'id');this[_0x9947('0xd')][_0x9947('0x12')]=_0x4fe985;};OpenchannelQueue[_0x9947('0x10')][_0x9947('0xf')]=function(){this['loggedIn']=0x0;this[_0x9947('0x14')]=0x0;for(var _0x14a4c7=0x0;_0x14a4c7=0x0?this[_0x9947('0x19')]:0x0;var _0x221587={'id':this['id'],'available':this[_0x9947('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x9947('0x8')],'paused':this[_0x9947('0x14')],'waiting':this['waiting']};var _0x1f8787=md5(JSON[_0x9947('0x1a')](_0x221587));if(this[_0x9947('0x1')]!==_0x1f8787){this['md5']=_0x1f8787;io['to'](util[_0x9947('0x1b')]('openchannel:queue:%s',_0x221587[_0x9947('0x8')]))['emit'](_0x9947('0x1c'),_0x221587);}};module[_0x9947('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x9d72=['mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','Agents','online','openchannelPause','paused','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save','lodash','util','redis','defaults','name','timeout','strategy','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d72,0x156));var _0x29d7=function(_0x5d7726,_0x57adac){_0x5d7726=_0x5d7726-0x0;var _0x521e1c=_0x9d72[_0x5d7726];return _0x521e1c;};'use strict';var _=require(_0x29d7('0x0'));var md5=require('md5');var util=require(_0x29d7('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x29d7('0x2')]=_[_0x29d7('0x3')](config[_0x29d7('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x29d7('0x2')]));function OpenchannelQueue(_0x66a702){this['id']=_0x66a702['id']||0x0;this['name']=_0x66a702[_0x29d7('0x4')]||'';this[_0x29d7('0x5')]=_0x66a702['timeout']||0xa;this['strategy']=_0x66a702[_0x29d7('0x6')]||_0x29d7('0x7');this['Agents']=_0x66a702['Agents'];this[_0x29d7('0x8')]={};this[_0x29d7('0x9')]=0x0;this[_0x29d7('0xa')]='';this[_0x29d7('0xb')]();this[_0x29d7('0xc')]();}OpenchannelQueue[_0x29d7('0xd')][_0x29d7('0xb')]=function(){var _0x505c51=this[_0x29d7('0x8')][_0x29d7('0xe')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x29d7('0x8')][_0x29d7('0xe')]=_0x505c51;};OpenchannelQueue[_0x29d7('0xd')][_0x29d7('0xc')]=function(){this[_0x29d7('0xf')]=0x0;this['paused']=0x0;for(var _0x29a9d6=0x0;_0x29a9d6=0x0?this['available']:0x0;var _0x1b7b43={'id':this['id'],'available':this[_0x29d7('0x14')],'loggedIn':this[_0x29d7('0xf')],'name':this[_0x29d7('0x4')],'paused':this['paused'],'waiting':this[_0x29d7('0x9')]};var _0x1ee617=md5(JSON[_0x29d7('0x15')](_0x1b7b43));if(this[_0x29d7('0xa')]!==_0x1ee617){this['md5']=_0x1ee617;io['to'](util['format'](_0x29d7('0x16'),_0x1b7b43['name']))[_0x29d7('0x17')](_0x29d7('0x18'),_0x1b7b43);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 56b53f9..c9bcc49 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x59d6b8,_0x2ed9d9){var _0x5de673=function(_0x79b251){while(--_0x79b251){_0x59d6b8['push'](_0x59d6b8['shift']());}};_0x5de673(++_0x2ed9d9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x1cb35d,_0x31f983){var _0x1fa08f=function(_0x4ceac1){while(--_0x4ceac1){_0x1cb35d['push'](_0x1cb35d['shift']());}};_0x1fa08f(++_0x31f983);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 2672cbb..03bfee1 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 _0xe0ff=['waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xe0ff,0x153));var _0xfe0f=function(_0x205261,_0x385345){_0x205261=_0x205261-0x0;var _0x387bda=_0xe0ff[_0x205261];return _0x387bda;};'use strict';var _=require(_0xfe0f('0x0'));var md5=require(_0xfe0f('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xfe0f('0x2'));config[_0xfe0f('0x3')]=_[_0xfe0f('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfe0f('0x5'))(new Redis(config[_0xfe0f('0x3')]));function WhatsappQueue(_0x11f1fd){this['id']=_0x11f1fd['id']||0x0;this[_0xfe0f('0x6')]=_0x11f1fd[_0xfe0f('0x6')]||'';this[_0xfe0f('0x7')]=_0x11f1fd['timeout']||0xa;this[_0xfe0f('0x8')]=_0x11f1fd[_0xfe0f('0x8')]||_0xfe0f('0x9');this[_0xfe0f('0xa')]=_0x11f1fd[_0xfe0f('0xa')];this[_0xfe0f('0xb')]={};this[_0xfe0f('0xc')]=0x0;this[_0xfe0f('0x1')]='';this[_0xfe0f('0xd')]();this[_0xfe0f('0xe')]();}WhatsappQueue[_0xfe0f('0xf')][_0xfe0f('0xd')]=function(){var _0x5668a0=this[_0xfe0f('0xb')][_0xfe0f('0x10')];this[_0xfe0f('0xb')]=_['map'](this['Agents'],'id');this[_0xfe0f('0xb')][_0xfe0f('0x10')]=_0x5668a0;};WhatsappQueue[_0xfe0f('0xf')][_0xfe0f('0xe')]=function(){this[_0xfe0f('0x11')]=0x0;this[_0xfe0f('0x12')]=0x0;for(var _0x42869f=0x0;_0x42869f=0x0?this['available']:0x0;var _0x51c1c2={'id':this['id'],'available':this['available'],'loggedIn':this[_0xfe0f('0x11')],'name':this[_0xfe0f('0x6')],'paused':this[_0xfe0f('0x12')],'waiting':this[_0xfe0f('0xc')]};var _0x580fdf=md5(JSON['stringify'](_0x51c1c2));if(this['md5']!==_0x580fdf){this['md5']=_0x580fdf;io['to'](util[_0xfe0f('0x16')](_0xfe0f('0x17'),_0x51c1c2[_0xfe0f('0x6')]))[_0xfe0f('0x18')](_0xfe0f('0x19'),_0x51c1c2);}};module[_0xfe0f('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x3e9c=['name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','paused','length','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x86a50b,_0x2544b2){var _0x42bbef=function(_0x1b8183){while(--_0x1b8183){_0x86a50b['push'](_0x86a50b['shift']());}};_0x42bbef(++_0x2544b2);}(_0x3e9c,0x6f));var _0xc3e9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3e9c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc3e9('0x0'));var md5=require(_0xc3e9('0x1'));var util=require(_0xc3e9('0x2'));var Redis=require(_0xc3e9('0x3'));var config=require(_0xc3e9('0x4'));config[_0xc3e9('0x5')]=_[_0xc3e9('0x6')](config[_0xc3e9('0x5')],{'host':_0xc3e9('0x7'),'port':0x18eb});var io=require(_0xc3e9('0x8'))(new Redis(config[_0xc3e9('0x5')]));function WhatsappQueue(_0x10fff3){this['id']=_0x10fff3['id']||0x0;this[_0xc3e9('0x9')]=_0x10fff3[_0xc3e9('0x9')]||'';this[_0xc3e9('0xa')]=_0x10fff3[_0xc3e9('0xa')]||0xa;this[_0xc3e9('0xb')]=_0x10fff3[_0xc3e9('0xb')]||'beepall';this[_0xc3e9('0xc')]=_0x10fff3[_0xc3e9('0xc')];this[_0xc3e9('0xd')]={};this[_0xc3e9('0xe')]=0x0;this['md5']='';this[_0xc3e9('0xf')]();this['updateRealtime']();}WhatsappQueue[_0xc3e9('0x10')][_0xc3e9('0xf')]=function(){var _0x2dc41f=this[_0xc3e9('0xd')][_0xc3e9('0x11')];this[_0xc3e9('0xd')]=_[_0xc3e9('0x12')](this[_0xc3e9('0xc')],'id');this['mapAgentsId'][_0xc3e9('0x11')]=_0x2dc41f;};WhatsappQueue['prototype'][_0xc3e9('0x13')]=function(){this['loggedIn']=0x0;this[_0xc3e9('0x14')]=0x0;for(var _0x1b7b44=0x0;_0x1b7b44=0x0?this[_0xc3e9('0x19')]:0x0;var _0x117fb2={'id':this['id'],'available':this[_0xc3e9('0x19')],'loggedIn':this[_0xc3e9('0x17')],'name':this[_0xc3e9('0x9')],'paused':this[_0xc3e9('0x14')],'waiting':this[_0xc3e9('0xe')]};var _0x1976ea=md5(JSON[_0xc3e9('0x1a')](_0x117fb2));if(this[_0xc3e9('0x1')]!==_0x1976ea){this[_0xc3e9('0x1')]=_0x1976ea;io['to'](util['format'](_0xc3e9('0x1b'),_0x117fb2[_0xc3e9('0x9')]))['emit'](_0xc3e9('0x1c'),_0x117fb2);}};module[_0xc3e9('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index d924a7b..46f8046 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 _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7217[_0x46aff0];return _0x9d78cf;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0xf3cd=['../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','bluebird','util','lodash','moment','../model/agent'];(function(_0x51cbcf,_0x22fb91){var _0x30ff8e=function(_0xa31ba3){while(--_0xa31ba3){_0x51cbcf['push'](_0x51cbcf['shift']());}};_0x30ff8e(++_0x22fb91);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x27125a,_0x252d0d){_0x27125a=_0x27125a-0x0;var _0x391f7a=_0xf3cd[_0x27125a];return _0x391f7a;};'use strict';var BPromise=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var _=require(_0xdf3c('0x2'));var moment=require(_0xdf3c('0x3'));var Agent=require(_0xdf3c('0x4'));var Interval=require(_0xdf3c('0x5'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xdf3c('0x6'));var SmsQueue=require(_0xdf3c('0x7'));var MailQueue=require(_0xdf3c('0x8'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require(_0xdf3c('0x9'));var Realtime=function(){this[_0xdf3c('0xa')]={};this[_0xdf3c('0xb')]={};this[_0xdf3c('0xc')]={};this[_0xdf3c('0xd')]={};this[_0xdf3c('0xe')]={};this['mailQueues']={};this[_0xdf3c('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xdf3c('0x10')]={};this[_0xdf3c('0x11')]={};this['smsQueuesWaitingInteractions']={};this[_0xdf3c('0x12')]={};this[_0xdf3c('0x13')]={};};function freeIsNotKey(_0x2d420c,_0x21a6e5,_0x3a3154){var _0x1c456b=_[_0xdf3c('0x14')](_0x2d420c,function(_0x32d2db,_0x5e8925){return _0x32d2db[_0x3a3154];});for(var _0x1d483c in _0x21a6e5){if(_0x21a6e5[_0xdf3c('0x15')](_0x1d483c)){if(!_0x1c456b[_0x1d483c]){delete _0x21a6e5[_0x1d483c];}}}}Realtime[_0xdf3c('0x16')][_0xdf3c('0x17')]=function(_0x59e431,_0x2ae4ad){for(var _0x461079 in _0x2ae4ad){if(_0x59e431[_0xdf3c('0x15')](_0x461079)){_0x59e431[_0x461079]=_0x2ae4ad[_0x461079];}}};Realtime['prototype'][_0xdf3c('0x18')]=function(){var _0x38b01d=this;return function(_0x173041){if(_0x173041){freeIsNotKey(_0x173041,_0x38b01d[_0xdf3c('0xa')],'id');for(var _0x21e587=0x0,_0x1a7a5a={},_0x305ea5={};_0x21e587<_0x173041[_0xdf3c('0x19')];_0x21e587+=0x1){_0x1a7a5a=_0x173041[_0x21e587];if(_[_0xdf3c('0x1a')](_0x38b01d[_0xdf3c('0xa')][_0x1a7a5a['id']])){_0x38b01d['agents'][_0x1a7a5a['id']]=new Agent(_0x1a7a5a);}else{_0x38b01d[_0xdf3c('0x17')](_0x38b01d[_0xdf3c('0xa')][_0x1a7a5a['id']],_0x1a7a5a);}}}return _0x38b01d[_0xdf3c('0xa')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x1b')]=function(){var _0x113b56=this;return function(_0x16b02b){if(_0x16b02b){freeIsNotKey(_0x16b02b,_0x113b56[_0xdf3c('0xb')],'id');for(var _0x426f3a=0x0,_0x18fb5f={},_0x267488={};_0x426f3a<_0x16b02b[_0xdf3c('0x19')];_0x426f3a+=0x1){_0x18fb5f=_0x16b02b[_0x426f3a];if(_[_0xdf3c('0x1a')](_0x113b56['intervals'][_0x18fb5f['id']])){_0x113b56['intervals'][_0x18fb5f['id']]=new Interval(_0x18fb5f);}else{_0x113b56[_0xdf3c('0x17')](_0x113b56['intervals'][_0x18fb5f['id']],_0x18fb5f);}}}return _0x113b56[_0xdf3c('0xb')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x1c')]=function(){var _0x38b319=this;return function(_0x33652f){if(_0x33652f){freeIsNotKey(_0x33652f,_0x38b319[_0xdf3c('0xc')],'id');for(var _0x50d8ca=0x0,_0x22a164={},_0x213d75={};_0x50d8ca<_0x33652f[_0xdf3c('0x19')];_0x50d8ca+=0x1){_0x22a164=_0x33652f[_0x50d8ca];if(_[_0xdf3c('0x1a')](_0x38b319[_0xdf3c('0xc')][_0x22a164['id']])){_0x38b319[_0xdf3c('0xc')][_0x22a164['id']]=new OpenchannelQueue(_0x22a164);}else{_0x38b319[_0xdf3c('0x17')](_0x38b319[_0xdf3c('0xc')][_0x22a164['id']],_0x22a164);}_0x38b319[_0xdf3c('0xc')][_0x22a164['id']][_0xdf3c('0x1d')]();_0x38b319['openchannelQueues'][_0x22a164['id']][_0xdf3c('0x1e')]();}}return _0x38b319[_0xdf3c('0xc')];};};Realtime['prototype'][_0xdf3c('0x1f')]=function(){var _0x59659e=this;return function(_0x4eaced){if(_0x4eaced){freeIsNotKey(_0x4eaced,_0x59659e['chatQueues'],'id');for(var _0x14aac9=0x0,_0x186bba={},_0x52b8f6={};_0x14aac9<_0x4eaced['length'];_0x14aac9+=0x1){_0x186bba=_0x4eaced[_0x14aac9];if(_[_0xdf3c('0x1a')](_0x59659e[_0xdf3c('0xd')][_0x186bba['id']])){_0x59659e[_0xdf3c('0xd')][_0x186bba['id']]=new ChatQueue(_0x186bba);}else{_0x59659e[_0xdf3c('0x17')](_0x59659e['chatQueues'][_0x186bba['id']],_0x186bba);}_0x59659e[_0xdf3c('0xd')][_0x186bba['id']][_0xdf3c('0x1d')]();_0x59659e['chatQueues'][_0x186bba['id']]['updateRealtime']();}}return _0x59659e[_0xdf3c('0xd')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x20')]=function(){var _0x540f3a=this;return function(_0x2355f6){if(_0x2355f6){freeIsNotKey(_0x2355f6,_0x540f3a[_0xdf3c('0xe')],'id');for(var _0x21e7b8=0x0,_0x10099e={},_0x575ae1={};_0x21e7b8<_0x2355f6[_0xdf3c('0x19')];_0x21e7b8+=0x1){_0x10099e=_0x2355f6[_0x21e7b8];if(_[_0xdf3c('0x1a')](_0x540f3a['smsQueues'][_0x10099e['id']])){_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']]=new SmsQueue(_0x10099e);}else{_0x540f3a[_0xdf3c('0x17')](_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']],_0x10099e);}_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']]['updateRouting']();_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']][_0xdf3c('0x1e')]();}}return _0x540f3a[_0xdf3c('0xe')];};};Realtime[_0xdf3c('0x16')]['initMailQueues']=function(){var _0x474564=this;return function(_0x3e7a4b){if(_0x3e7a4b){freeIsNotKey(_0x3e7a4b,_0x474564['mailQueues'],'id');for(var _0x4f68f9=0x0,_0x12cc19={},_0x588d02={};_0x4f68f9<_0x3e7a4b[_0xdf3c('0x19')];_0x4f68f9+=0x1){_0x12cc19=_0x3e7a4b[_0x4f68f9];if(_['isUndefined'](_0x474564['mailQueues'][_0x12cc19['id']])){_0x474564['mailQueues'][_0x12cc19['id']]=new MailQueue(_0x12cc19);}else{_0x474564[_0xdf3c('0x17')](_0x474564[_0xdf3c('0x21')][_0x12cc19['id']],_0x12cc19);}_0x474564[_0xdf3c('0x21')][_0x12cc19['id']][_0xdf3c('0x1d')]();_0x474564['mailQueues'][_0x12cc19['id']]['updateRealtime']();}}return _0x474564[_0xdf3c('0x21')];};};Realtime['prototype'][_0xdf3c('0x22')]=function(){var _0x17b502=this;return function(_0x3628ae){if(_0x3628ae){freeIsNotKey(_0x3628ae,_0x17b502[_0xdf3c('0xf')],'id');for(var _0x1004e9=0x0,_0x1e0cf2={},_0x1c7335={};_0x1004e9<_0x3628ae[_0xdf3c('0x19')];_0x1004e9+=0x1){_0x1e0cf2=_0x3628ae[_0x1004e9];if(_[_0xdf3c('0x1a')](_0x17b502['faxQueues'][_0x1e0cf2['id']])){_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]=new FaxQueue(_0x1e0cf2);}else{_0x17b502['mergeFromDatabase'](_0x17b502['faxQueues'][_0x1e0cf2['id']],_0x1e0cf2);}_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]['updateRouting']();_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]['updateRealtime']();}}return _0x17b502[_0xdf3c('0xf')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x23')]=function(){var _0x1349a4=this;return function(_0x3098cb){if(_0x3098cb){freeIsNotKey(_0x3098cb,_0x1349a4[_0xdf3c('0x24')],'id');for(var _0x736ef5=0x0,_0x3d47fb={},_0x3cf131={};_0x736ef5<_0x3098cb[_0xdf3c('0x19')];_0x736ef5+=0x1){_0x3d47fb=_0x3098cb[_0x736ef5];if(_[_0xdf3c('0x1a')](_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']])){_0x1349a4['whatsappQueues'][_0x3d47fb['id']]=new WhatsappQueue(_0x3d47fb);}else{_0x1349a4['mergeFromDatabase'](_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']],_0x3d47fb);}_0x1349a4['whatsappQueues'][_0x3d47fb['id']][_0xdf3c('0x1d')]();_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']][_0xdf3c('0x1e')]();}}return _0x1349a4[_0xdf3c('0x24')];};};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 56ccbdd..fbfa57a 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 _0xb598=['UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x400800,_0x3fe030){var _0x2fbebe=function(_0x338f61){while(--_0x338f61){_0x400800['push'](_0x400800['shift']());}};_0x2fbebe(++_0x3fe030);}(_0xb598,0x11e));var _0x8b59=function(_0x4e523f,_0xb403d1){_0x4e523f=_0x4e523f-0x0;var _0x85aca5=_0xb598[_0x4e523f];return _0x85aca5;};'use strict';var client=require(_0x8b59('0x0'));exports['update']=function(_0x22dd10,_0x3ff915){return client[_0x8b59('0x1')](_0x8b59('0x2'),{'body':_0x3ff915,'options':{'where':{'id':_0x22dd10}},'log':_0x8b59('0x3')});};exports['addTags']=function(_0x175aaf,_0x51fcaf){return client[_0x8b59('0x1')](_0x8b59('0x4'),{'body':_0x51fcaf,'options':{'where':{'id':_0x175aaf}},'log':_0x8b59('0x5')});}; \ No newline at end of file +var _0x01a0=['UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x01a0,0xca));var _0x001a=function(_0x145c25,_0x1c48e2){_0x145c25=_0x145c25-0x0;var _0x362690=_0x01a0[_0x145c25];return _0x362690;};'use strict';var client=require('../client');exports[_0x001a('0x0')]=function(_0x1ae8be,_0x52225e){return client[_0x001a('0x1')](_0x001a('0x2'),{'body':_0x52225e,'options':{'where':{'id':_0x1ae8be}},'log':_0x001a('0x3')});};exports['addTags']=function(_0x566376,_0x1b5ddd){return client[_0x001a('0x1')](_0x001a('0x4'),{'body':_0x1b5ddd,'options':{'where':{'id':_0x566376}},'log':_0x001a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b73fdef..cdb874e 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 _0x0e11=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x0e11,0xf0));var _0x10e1=function(_0x1a84f5,_0x1e9cc3){_0x1a84f5=_0x1a84f5-0x0;var _0x4b9a3b=_0x0e11[_0x1a84f5];return _0x4b9a3b;};'use strict';var client=require(_0x10e1('0x0'));exports[_0x10e1('0x1')]=function(_0x4c4de5){return client[_0x10e1('0x2')](_0x10e1('0x3'),{'body':_0x4c4de5,'log':_0x10e1('0x4')});}; \ No newline at end of file +var _0x9e8d=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x3f4a2f,_0x18a06a){var _0x380214=function(_0xb25163){while(--_0xb25163){_0x3f4a2f['push'](_0x3f4a2f['shift']());}};_0x380214(++_0x18a06a);}(_0x9e8d,0x11c));var _0xd9e8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9e8d[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xd9e8('0x0'));exports[_0xd9e8('0x1')]=function(_0x46afe7){return client[_0xd9e8('0x2')](_0xd9e8('0x3'),{'body':_0x46afe7,'log':_0xd9e8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index e92726f..785fd2e 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 _0xffab=['online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','User'];(function(_0x3deef5,_0x57047b){var _0x43f9f8=function(_0x1169d3){while(--_0x1169d3){_0x3deef5['push'](_0x3deef5['shift']());}};_0x43f9f8(++_0x57047b);}(_0xffab,0x1b2));var _0xbffa=function(_0x2d1926,_0x3e9afe){_0x2d1926=_0x2d1926-0x0;var _0x4a52c7=_0xffab[_0x2d1926];return _0x4a52c7;};'use strict';var client=require(_0xbffa('0x0'));exports[_0xbffa('0x1')]=function(){return function(){return client[_0xbffa('0x2')](_0xbffa('0x3'),{'options':{'raw':![],'attributes':['id',_0xbffa('0x4'),_0xbffa('0x5'),'strategy'],'include':[{'model':_0xbffa('0x6'),'as':'Agents','attributes':['id',_0xbffa('0x4'),_0xbffa('0x7'),_0xbffa('0x8')]}]},'log':_0xbffa('0x1')});};}; \ No newline at end of file +var _0xb6a6=['GetChatQueue','name','timeout','strategy','Agents','online','chatPause','../client','getChatQueues','Request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb6a6,0x75));var _0x6b6a=function(_0x3239f0,_0x43ff17){_0x3239f0=_0x3239f0-0x0;var _0x3099c2=_0xb6a6[_0x3239f0];return _0x3099c2;};'use strict';var client=require(_0x6b6a('0x0'));exports[_0x6b6a('0x1')]=function(){return function(){return client[_0x6b6a('0x2')](_0x6b6a('0x3'),{'options':{'raw':![],'attributes':['id',_0x6b6a('0x4'),_0x6b6a('0x5'),_0x6b6a('0x6')],'include':[{'model':'User','as':_0x6b6a('0x7'),'attributes':['id',_0x6b6a('0x4'),_0x6b6a('0x8'),_0x6b6a('0x9')]}]},'log':_0x6b6a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6f4ed11..abd3ecf 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 _0x899a=['CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client','create','Request'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x899a,0x1b6));var _0xa899=function(_0x22c747,_0x380915){_0x22c747=_0x22c747-0x0;var _0x2e59ed=_0x899a[_0x22c747];return _0x2e59ed;};'use strict';var client=require(_0xa899('0x0'));exports[_0xa899('0x1')]=function(_0x4f77af){return client[_0xa899('0x2')](_0xa899('0x3'),{'body':_0x4f77af,'log':'CreateChatQueueReport'});};exports[_0xa899('0x4')]=function(_0x40ed2b,_0x1c5c93){return client[_0xa899('0x2')]('UpdateChatQueueReport',{'body':_0x1c5c93,'options':{'where':{'uniqueid':_0x40ed2b},'order':[['id',_0xa899('0x5')]],'limit':0x1},'log':_0xa899('0x6')});}; \ No newline at end of file +var _0xa739=['DESC','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x1ceefe,_0x3ac0ab){var _0x17578a=function(_0x45c5be){while(--_0x45c5be){_0x1ceefe['push'](_0x1ceefe['shift']());}};_0x17578a(++_0x3ac0ab);}(_0xa739,0x1e1));var _0x9a73=function(_0x32315c,_0x13486a){_0x32315c=_0x32315c-0x0;var _0x57675e=_0xa739[_0x32315c];return _0x57675e;};'use strict';var client=require('../client');exports[_0x9a73('0x0')]=function(_0x522d13){return client[_0x9a73('0x1')](_0x9a73('0x2'),{'body':_0x522d13,'log':'CreateChatQueueReport'});};exports[_0x9a73('0x3')]=function(_0x352cec,_0x40fb76){return client['Request'](_0x9a73('0x4'),{'body':_0x40fb76,'options':{'where':{'uniqueid':_0x352cec},'order':[['id',_0x9a73('0x5')]],'limit':0x1},'log':_0x9a73('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ef33674..f446938 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 _0xa826=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','Request','UpdateFaxInteraction'];(function(_0x3023b9,_0x556a){var _0x5a7787=function(_0x4d5db9){while(--_0x4d5db9){_0x3023b9['push'](_0x3023b9['shift']());}};_0x5a7787(++_0x556a);}(_0xa826,0x1a7));var _0x6a82=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa826[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x6a82('0x0'));exports['update']=function(_0x28b518,_0x50fa6d){return client[_0x6a82('0x1')](_0x6a82('0x2'),{'body':_0x50fa6d,'options':{'where':{'id':_0x28b518}},'log':_0x6a82('0x3')});};exports[_0x6a82('0x4')]=function(_0x2fb768,_0xf2c56e){return client[_0x6a82('0x1')](_0x6a82('0x5'),{'body':_0xf2c56e,'options':{'where':{'id':_0x2fb768}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9767=['Request','UpdateFaxInteraction','updateFaxInteraction','AddTagsToFaxInteraction','../client','update'];(function(_0x446ba9,_0x233bca){var _0x22205e=function(_0x221b26){while(--_0x221b26){_0x446ba9['push'](_0x446ba9['shift']());}};_0x22205e(++_0x233bca);}(_0x9767,0xd6));var _0x7976=function(_0x2b0ff6,_0x5834fd){_0x2b0ff6=_0x2b0ff6-0x0;var _0x45ef5f=_0x9767[_0x2b0ff6];return _0x45ef5f;};'use strict';var client=require(_0x7976('0x0'));exports[_0x7976('0x1')]=function(_0x498fa4,_0x165a64){return client[_0x7976('0x2')](_0x7976('0x3'),{'body':_0x165a64,'options':{'where':{'id':_0x498fa4}},'log':_0x7976('0x4')});};exports['addTags']=function(_0x25e2d0,_0x19d201){return client[_0x7976('0x2')](_0x7976('0x5'),{'body':_0x19d201,'options':{'where':{'id':_0x25e2d0}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 80489e7..7402c42 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 _0xc844=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xc844,0x11a));var _0x4c84=function(_0x41b2dc,_0x55b5ab){_0x41b2dc=_0x41b2dc-0x0;var _0x26cdf4=_0xc844[_0x41b2dc];return _0x26cdf4;};'use strict';var client=require(_0x4c84('0x0'));exports['create']=function(_0x5afe32){return client[_0x4c84('0x1')](_0x4c84('0x2'),{'body':_0x5afe32,'log':_0x4c84('0x3')});}; \ No newline at end of file +var _0xb1a0=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x49258d,_0x5bcf0e){var _0x2a9044=function(_0x1a629e){while(--_0x1a629e){_0x49258d['push'](_0x49258d['shift']());}};_0x2a9044(++_0x5bcf0e);}(_0xb1a0,0x119));var _0x0b1a=function(_0x5afc18,_0x36bcf3){_0x5afc18=_0x5afc18-0x0;var _0x26f724=_0xb1a0[_0x5afc18];return _0x26f724;};'use strict';var client=require(_0x0b1a('0x0'));exports[_0x0b1a('0x1')]=function(_0x182e23){return client[_0x0b1a('0x2')](_0x0b1a('0x3'),{'body':_0x182e23,'log':_0x0b1a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 78376cd..4fc274b 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 _0x9688=['User','Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x1775ad,_0x14e982){var _0xb4661f=function(_0x7631b6){while(--_0x7631b6){_0x1775ad['push'](_0x1775ad['shift']());}};_0xb4661f(++_0x14e982);}(_0x9688,0x16c));var _0x8968=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9688[_0x4f9b18];return _0x29f20c;};'use strict';var client=require('../client');exports[_0x8968('0x0')]=function(){return function(){return client[_0x8968('0x1')](_0x8968('0x2'),{'options':{'raw':![],'attributes':['id',_0x8968('0x3'),_0x8968('0x4'),_0x8968('0x5')],'include':[{'model':_0x8968('0x6'),'as':_0x8968('0x7'),'attributes':['id',_0x8968('0x3'),_0x8968('0x8'),_0x8968('0x9')]}]},'log':_0x8968('0x0')});};}; \ No newline at end of file +var _0xe242=['Request','timeout','strategy','User','Agents','name','getFaxQueues'];(function(_0x3f22e8,_0x37732a){var _0x368a7e=function(_0x35f538){while(--_0x35f538){_0x3f22e8['push'](_0x3f22e8['shift']());}};_0x368a7e(++_0x37732a);}(_0xe242,0xf4));var _0x2e24=function(_0x2e7be0,_0x1ecdec){_0x2e7be0=_0x2e7be0-0x0;var _0x38eae8=_0xe242[_0x2e7be0];return _0x38eae8;};'use strict';var client=require('../client');exports[_0x2e24('0x0')]=function(){return function(){return client[_0x2e24('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x2e24('0x2'),_0x2e24('0x3')],'include':[{'model':_0x2e24('0x4'),'as':_0x2e24('0x5'),'attributes':['id',_0x2e24('0x6'),'online','faxPause']}]},'log':_0x2e24('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7f7c920..b806e49 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 _0x9da2=['UpdateFaxQueueReport','create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x278fb7,_0x5014a8){var _0x366c26=function(_0x1b4bcf){while(--_0x1b4bcf){_0x278fb7['push'](_0x278fb7['shift']());}};_0x366c26(++_0x5014a8);}(_0x9da2,0xf1));var _0x29da=function(_0xcad71d,_0x522acc){_0xcad71d=_0xcad71d-0x0;var _0x313709=_0x9da2[_0xcad71d];return _0x313709;};'use strict';var client=require('../client');exports[_0x29da('0x0')]=function(_0x1494ff){return client[_0x29da('0x1')](_0x29da('0x2'),{'body':_0x1494ff,'log':_0x29da('0x2')});};exports[_0x29da('0x3')]=function(_0x5adbbe,_0x176519){return client[_0x29da('0x1')]('UpdateFaxQueueReport',{'body':_0x176519,'options':{'where':{'uniqueid':_0x5adbbe},'order':[['id',_0x29da('0x4')]],'limit':0x1},'log':_0x29da('0x5')});}; \ No newline at end of file +var _0xc627=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc627,0x14a));var _0x7c62=function(_0x557129,_0x254fea){_0x557129=_0x557129-0x0;var _0x2501ec=_0xc627[_0x557129];return _0x2501ec;};'use strict';var client=require('../client');exports[_0x7c62('0x0')]=function(_0x1e1543){return client[_0x7c62('0x1')]('CreateFaxQueueReport',{'body':_0x1e1543,'log':_0x7c62('0x2')});};exports[_0x7c62('0x3')]=function(_0x2f79e5,_0x313d80){return client[_0x7c62('0x1')](_0x7c62('0x4'),{'body':_0x313d80,'options':{'where':{'uniqueid':_0x2f79e5},'order':[['id',_0x7c62('0x5')]],'limit':0x1},'log':_0x7c62('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a70cf74..52eea14 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 _0x9348=['getIntervals','Request','GetInterval','name','Intervals','../client'];(function(_0x3b64ee,_0x454ad1){var _0x13bf68=function(_0x2aac2c){while(--_0x2aac2c){_0x3b64ee['push'](_0x3b64ee['shift']());}};_0x13bf68(++_0x454ad1);}(_0x9348,0x10d));var _0x8934=function(_0xe32bd,_0x12da40){_0xe32bd=_0xe32bd-0x0;var _0x317a91=_0x9348[_0xe32bd];return _0x317a91;};'use strict';var client=require(_0x8934('0x0'));exports[_0x8934('0x1')]=function(){return function(){return client[_0x8934('0x2')](_0x8934('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8934('0x4')],'include':[{'model':'Interval','as':_0x8934('0x5'),'attributes':['id',_0x8934('0x4'),'interval']}]},'log':_0x8934('0x1')});};}; \ No newline at end of file +var _0x9354=['getIntervals','Request','name','Interval','Intervals'];(function(_0x30c212,_0x3b6c0a){var _0x397a34=function(_0x554eb8){while(--_0x554eb8){_0x30c212['push'](_0x30c212['shift']());}};_0x397a34(++_0x3b6c0a);}(_0x9354,0x96));var _0x4935=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x9354[_0x3af6d3];return _0xf0c5a8;};'use strict';var client=require('../client');exports[_0x4935('0x0')]=function(){return function(){return client[_0x4935('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4935('0x2')],'include':[{'model':_0x4935('0x3'),'as':_0x4935('0x4'),'attributes':['id',_0x4935('0x2'),'interval']}]},'log':_0x4935('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 335a886..b67c012 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 _0x74a7=['Request','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74a7,0x19e));var _0x774a=function(_0x34098e,_0x56b681){_0x34098e=_0x34098e-0x0;var _0x20e788=_0x74a7[_0x34098e];return _0x20e788;};'use strict';var client=require('../client');exports[_0x774a('0x0')]=function(_0x5dc351,_0x5030a7){return client[_0x774a('0x1')]('UpdateMailInteraction',{'body':_0x5030a7,'options':{'where':{'id':_0x5dc351}},'log':_0x774a('0x2')});};exports['addTags']=function(_0x4304ce,_0x21c1f9){return client['Request'](_0x774a('0x3'),{'body':_0x21c1f9,'options':{'where':{'id':_0x4304ce}},'log':_0x774a('0x4')});}; \ No newline at end of file +var _0xcc7a=['Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x51d935,_0x27523c){var _0xdc6e65=function(_0x33e94f){while(--_0x33e94f){_0x51d935['push'](_0x51d935['shift']());}};_0xdc6e65(++_0x27523c);}(_0xcc7a,0x91));var _0xacc7=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xcc7a[_0x24f31b];return _0x488401;};'use strict';var client=require(_0xacc7('0x0'));exports[_0xacc7('0x1')]=function(_0x247fd9,_0x56e774){return client[_0xacc7('0x2')]('UpdateMailInteraction',{'body':_0x56e774,'options':{'where':{'id':_0x247fd9}},'log':_0xacc7('0x3')});};exports[_0xacc7('0x4')]=function(_0x57fffa,_0x18bbe2){return client[_0xacc7('0x2')](_0xacc7('0x5'),{'body':_0x18bbe2,'options':{'where':{'id':_0x57fffa}},'log':_0xacc7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 26c2f60..c04b08e 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 _0x4c0e=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x26a598,_0x5c9ada){var _0xf3a171=function(_0x56f563){while(--_0x56f563){_0x26a598['push'](_0x26a598['shift']());}};_0xf3a171(++_0x5c9ada);}(_0x4c0e,0x143));var _0xe4c0=function(_0xfcc030,_0x3ec053){_0xfcc030=_0xfcc030-0x0;var _0x5caa66=_0x4c0e[_0xfcc030];return _0x5caa66;};'use strict';var client=require(_0xe4c0('0x0'));exports['create']=function(_0x4e3010){return client[_0xe4c0('0x1')](_0xe4c0('0x2'),{'body':_0x4e3010,'log':_0xe4c0('0x3')});}; \ No newline at end of file +var _0xf6f6=['Request','CreateMailMessage','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf6f6,0xaa));var _0x6f6f=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xf6f6[_0x3b231a];return _0x18d67a;};'use strict';var client=require(_0x6f6f('0x0'));exports[_0x6f6f('0x1')]=function(_0x1c145c){return client[_0x6f6f('0x2')](_0x6f6f('0x3'),{'body':_0x1c145c,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index fa4eab7..90efea5 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 _0x493b=['strategy','User','name','online','mailPause','../client','getMailQueues','Request'];(function(_0x421a6a,_0x123221){var _0x457c0f=function(_0xc7b8af){while(--_0xc7b8af){_0x421a6a['push'](_0x421a6a['shift']());}};_0x457c0f(++_0x123221);}(_0x493b,0x1c5));var _0xb493=function(_0x3ef175,_0x38b7fa){_0x3ef175=_0x3ef175-0x0;var _0x55eb22=_0x493b[_0x3ef175];return _0x55eb22;};'use strict';var client=require(_0xb493('0x0'));exports[_0xb493('0x1')]=function(){return function(){return client[_0xb493('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xb493('0x3')],'include':[{'model':_0xb493('0x4'),'as':'Agents','attributes':['id',_0xb493('0x5'),_0xb493('0x6'),_0xb493('0x7')]}]},'log':_0xb493('0x1')});};}; \ No newline at end of file +var _0xe3eb=['../client','getMailQueues','Request','name','timeout','strategy','User','Agents','mailPause'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xe3eb,0x1a7));var _0xbe3e=function(_0x26941a,_0x9c361b){_0x26941a=_0x26941a-0x0;var _0x15189d=_0xe3eb[_0x26941a];return _0x15189d;};'use strict';var client=require(_0xbe3e('0x0'));exports[_0xbe3e('0x1')]=function(){return function(){return client[_0xbe3e('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xbe3e('0x3'),_0xbe3e('0x4'),_0xbe3e('0x5')],'include':[{'model':_0xbe3e('0x6'),'as':_0xbe3e('0x7'),'attributes':['id',_0xbe3e('0x3'),'online',_0xbe3e('0x8')]}]},'log':_0xbe3e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 8cd6a9a..92e2c00 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 _0x6d07=['DESC','../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x5c3ca0,_0x2bb9c2){var _0x5c4eaa=function(_0x22b70a){while(--_0x22b70a){_0x5c3ca0['push'](_0x5c3ca0['shift']());}};_0x5c4eaa(++_0x2bb9c2);}(_0x6d07,0x78));var _0x76d0=function(_0x35c8f5,_0x399f44){_0x35c8f5=_0x35c8f5-0x0;var _0xb5c718=_0x6d07[_0x35c8f5];return _0xb5c718;};'use strict';var client=require(_0x76d0('0x0'));exports[_0x76d0('0x1')]=function(_0x16ad01){return client['Request'](_0x76d0('0x2'),{'body':_0x16ad01,'log':_0x76d0('0x2')});};exports[_0x76d0('0x3')]=function(_0x59a397,_0x896cdb){return client[_0x76d0('0x4')](_0x76d0('0x5'),{'body':_0x896cdb,'options':{'where':{'uniqueid':_0x59a397},'order':[['id',_0x76d0('0x6')]],'limit':0x1},'log':_0x76d0('0x5')});}; \ No newline at end of file +var _0x57e9=['../client','Request','CreateMailQueueReport','UpdateMailQueueReport','DESC'];(function(_0xff1370,_0x3159fc){var _0x38e8b6=function(_0x2b0248){while(--_0x2b0248){_0xff1370['push'](_0xff1370['shift']());}};_0x38e8b6(++_0x3159fc);}(_0x57e9,0xfa));var _0x957e=function(_0x364fc0,_0x2f16d9){_0x364fc0=_0x364fc0-0x0;var _0x40fa20=_0x57e9[_0x364fc0];return _0x40fa20;};'use strict';var client=require(_0x957e('0x0'));exports['create']=function(_0x391799){return client[_0x957e('0x1')](_0x957e('0x2'),{'body':_0x391799,'log':'CreateMailQueueReport'});};exports['update']=function(_0x1ed8c1,_0x12a23d){return client[_0x957e('0x1')](_0x957e('0x3'),{'body':_0x12a23d,'options':{'where':{'uniqueid':_0x1ed8c1},'order':[['id',_0x957e('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f6b1cd6..bbc3ebd 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 _0x6ebd=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0x234e1a,_0x500d79){var _0x55aad2=function(_0x272396){while(--_0x272396){_0x234e1a['push'](_0x234e1a['shift']());}};_0x55aad2(++_0x500d79);}(_0x6ebd,0x79));var _0xd6eb=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6ebd[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0xd6eb('0x0'));exports[_0xd6eb('0x1')]=function(_0x40ea8f,_0x231036){return client[_0xd6eb('0x2')](_0xd6eb('0x3'),{'body':_0x231036,'options':{'where':{'id':_0x40ea8f}},'log':'updateOpenchannelInteraction'});};exports[_0xd6eb('0x4')]=function(_0x1b7020,_0x23cf2d){return client[_0xd6eb('0x2')](_0xd6eb('0x5'),{'body':_0x23cf2d,'options':{'where':{'id':_0x1b7020}},'log':_0xd6eb('0x6')});}; \ No newline at end of file +var _0x97c0=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97c0,0x103));var _0x097c=function(_0x24f024,_0x2c7ef1){_0x24f024=_0x24f024-0x0;var _0x535671=_0x97c0[_0x24f024];return _0x535671;};'use strict';var client=require(_0x097c('0x0'));exports[_0x097c('0x1')]=function(_0xf891ac,_0x22ed60){return client[_0x097c('0x2')](_0x097c('0x3'),{'body':_0x22ed60,'options':{'where':{'id':_0xf891ac}},'log':_0x097c('0x4')});};exports['addTags']=function(_0x495cf3,_0x4f74e3){return client['Request'](_0x097c('0x5'),{'body':_0x4f74e3,'options':{'where':{'id':_0x495cf3}},'log':_0x097c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2aab3fc..4765d74 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 _0xe5b3=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xe5b3,0x133));var _0x3e5b=function(_0x26e83e,_0xb8a5e2){_0x26e83e=_0x26e83e-0x0;var _0x391684=_0xe5b3[_0x26e83e];return _0x391684;};'use strict';var client=require('../client');exports[_0x3e5b('0x0')]=function(_0xba44a0){return client[_0x3e5b('0x1')](_0x3e5b('0x2'),{'body':_0xba44a0,'log':_0x3e5b('0x3')});}; \ No newline at end of file +var _0x54ef=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x1b8d26,_0x413ff3){var _0x3e99ab=function(_0x1c5571){while(--_0x1c5571){_0x1b8d26['push'](_0x1b8d26['shift']());}};_0x3e99ab(++_0x413ff3);}(_0x54ef,0x112));var _0xf54e=function(_0x500e95,_0xfffcd6){_0x500e95=_0x500e95-0x0;var _0x37e57a=_0x54ef[_0x500e95];return _0x37e57a;};'use strict';var client=require(_0xf54e('0x0'));exports[_0xf54e('0x1')]=function(_0x12c070){return client['Request'](_0xf54e('0x2'),{'body':_0x12c070,'log':_0xf54e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 58138ba..3fed771 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 _0x5355=['User','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x11d0a8,_0x1c20d7){var _0x4f67e3=function(_0x3cb7f2){while(--_0x3cb7f2){_0x11d0a8['push'](_0x11d0a8['shift']());}};_0x4f67e3(++_0x1c20d7);}(_0x5355,0x16c));var _0x5535=function(_0x469d01,_0x18c899){_0x469d01=_0x469d01-0x0;var _0x5078d3=_0x5355[_0x469d01];return _0x5078d3;};'use strict';var client=require(_0x5535('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x5535('0x1')](_0x5535('0x2'),{'options':{'raw':![],'attributes':['id',_0x5535('0x3'),_0x5535('0x4'),_0x5535('0x5')],'include':[{'model':_0x5535('0x6'),'as':'Agents','attributes':['id',_0x5535('0x3'),_0x5535('0x7'),_0x5535('0x8')]}]},'log':_0x5535('0x9')});};}; \ No newline at end of file +var _0x41a1=['User','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x396635,_0x1a510f){var _0x366d23=function(_0x143621){while(--_0x143621){_0x396635['push'](_0x396635['shift']());}};_0x366d23(++_0x1a510f);}(_0x41a1,0xcc));var _0x141a=function(_0x5e9048,_0x17a0fd){_0x5e9048=_0x5e9048-0x0;var _0x1d8063=_0x41a1[_0x5e9048];return _0x1d8063;};'use strict';var client=require(_0x141a('0x0'));exports[_0x141a('0x1')]=function(){return function(){return client[_0x141a('0x2')](_0x141a('0x3'),{'options':{'raw':![],'attributes':['id',_0x141a('0x4'),_0x141a('0x5'),'strategy'],'include':[{'model':_0x141a('0x6'),'as':'Agents','attributes':['id',_0x141a('0x4'),'online','openchannelPause']}]},'log':_0x141a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1bb2d65..b4329eb 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 _0xe754=['UpdateOpenchannelQueueReport','create','Request','CreateOpenchannelQueueReport','update','DESC'];(function(_0x4df11b,_0x586640){var _0xc99328=function(_0x1a83c0){while(--_0x1a83c0){_0x4df11b['push'](_0x4df11b['shift']());}};_0xc99328(++_0x586640);}(_0xe754,0x127));var _0x4e75=function(_0x14aefb,_0x3cfc1a){_0x14aefb=_0x14aefb-0x0;var _0x4d0c20=_0xe754[_0x14aefb];return _0x4d0c20;};'use strict';var client=require('../client');exports[_0x4e75('0x0')]=function(_0xe6e38){return client[_0x4e75('0x1')](_0x4e75('0x2'),{'body':_0xe6e38,'log':'CreateOpenchannelQueueReport'});};exports[_0x4e75('0x3')]=function(_0x4f9383,_0x497554){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x497554,'options':{'where':{'uniqueid':_0x4f9383},'order':[['id',_0x4e75('0x4')]],'limit':0x1},'log':_0x4e75('0x5')});}; \ No newline at end of file +var _0x6051=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0x243bb2,_0x3bb199){var _0x2dd225=function(_0x98c3de){while(--_0x98c3de){_0x243bb2['push'](_0x243bb2['shift']());}};_0x2dd225(++_0x3bb199);}(_0x6051,0x1b0));var _0x1605=function(_0x35e3b8,_0x1f543f){_0x35e3b8=_0x35e3b8-0x0;var _0xae5b9a=_0x6051[_0x35e3b8];return _0xae5b9a;};'use strict';var client=require(_0x1605('0x0'));exports[_0x1605('0x1')]=function(_0xf8d4b){return client[_0x1605('0x2')](_0x1605('0x3'),{'body':_0xf8d4b,'log':'CreateOpenchannelQueueReport'});};exports[_0x1605('0x4')]=function(_0x494052,_0x6759fb){return client[_0x1605('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x6759fb,'options':{'where':{'uniqueid':_0x494052},'order':[['id',_0x1605('0x5')]],'limit':0x1},'log':_0x1605('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 603b92c..3eaf41d 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 _0x6a68=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request'];(function(_0x591053,_0x523072){var _0x31ab80=function(_0x4a543f){while(--_0x4a543f){_0x591053['push'](_0x591053['shift']());}};_0x31ab80(++_0x523072);}(_0x6a68,0x138));var _0x86a6=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x6a68[_0x3899d1];return _0xeb4a7d;};'use strict';var client=require(_0x86a6('0x0'));exports[_0x86a6('0x1')]=function(_0x43e8f3,_0xa4699c){return client[_0x86a6('0x2')](_0x86a6('0x3'),{'body':_0xa4699c,'options':{'where':{'id':_0x43e8f3}},'log':_0x86a6('0x4')});};exports[_0x86a6('0x5')]=function(_0x5bead0,_0x3944d0){return client[_0x86a6('0x2')](_0x86a6('0x6'),{'body':_0x3944d0,'options':{'where':{'id':_0x5bead0}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xba51=['updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','UpdateSmsInteraction'];(function(_0x47bb74,_0x18327d){var _0x20d466=function(_0x515969){while(--_0x515969){_0x47bb74['push'](_0x47bb74['shift']());}};_0x20d466(++_0x18327d);}(_0xba51,0x7c));var _0x1ba5=function(_0x4ee83a,_0x1125d2){_0x4ee83a=_0x4ee83a-0x0;var _0x479156=_0xba51[_0x4ee83a];return _0x479156;};'use strict';var client=require(_0x1ba5('0x0'));exports['update']=function(_0x856a47,_0x258a46){return client['Request'](_0x1ba5('0x1'),{'body':_0x258a46,'options':{'where':{'id':_0x856a47}},'log':_0x1ba5('0x2')});};exports['addTags']=function(_0x37e6c5,_0x16a57f){return client[_0x1ba5('0x3')](_0x1ba5('0x4'),{'body':_0x16a57f,'options':{'where':{'id':_0x37e6c5}},'log':_0x1ba5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0cc9a03..055bfe7 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 _0x90a8=['create','Request','createSmsMessage','../client'];(function(_0xa9a779,_0x489fc3){var _0x276ed6=function(_0x2960f4){while(--_0x2960f4){_0xa9a779['push'](_0xa9a779['shift']());}};_0x276ed6(++_0x489fc3);}(_0x90a8,0x143));var _0x890a=function(_0x43d39d,_0x47e001){_0x43d39d=_0x43d39d-0x0;var _0x36236d=_0x90a8[_0x43d39d];return _0x36236d;};'use strict';var client=require(_0x890a('0x0'));exports[_0x890a('0x1')]=function(_0x31169a){return client[_0x890a('0x2')]('CreateSmsMessage',{'body':_0x31169a,'log':_0x890a('0x3')});}; \ No newline at end of file +var _0x251c=['CreateSmsMessage','createSmsMessage','Request'];(function(_0x58f390,_0x4aae1b){var _0x1f0119=function(_0xb341bc){while(--_0xb341bc){_0x58f390['push'](_0x58f390['shift']());}};_0x1f0119(++_0x4aae1b);}(_0x251c,0x71));var _0xc251=function(_0x53714f,_0x47844c){_0x53714f=_0x53714f-0x0;var _0x5ef05c=_0x251c[_0x53714f];return _0x5ef05c;};'use strict';var client=require('../client');exports['create']=function(_0x191cb3){return client[_0xc251('0x0')](_0xc251('0x1'),{'body':_0x191cb3,'log':_0xc251('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3668747..c73fe7b 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 _0xa269=['Agents','online','getSmsQueues','GetSmsQueue','name','timeout'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa269,0x14c));var _0x9a26=function(_0x3127bf,_0x2114d0){_0x3127bf=_0x3127bf-0x0;var _0x5a6a5e=_0xa269[_0x3127bf];return _0x5a6a5e;};'use strict';var client=require('../client');exports[_0x9a26('0x0')]=function(){return function(){return client['Request'](_0x9a26('0x1'),{'options':{'raw':![],'attributes':['id',_0x9a26('0x2'),_0x9a26('0x3'),'strategy'],'include':[{'model':'User','as':_0x9a26('0x4'),'attributes':['id',_0x9a26('0x2'),_0x9a26('0x5'),'smsPause']}]},'log':_0x9a26('0x0')});};}; \ No newline at end of file +var _0x0e50=['../client','getSmsQueues','Request','name','timeout','strategy','User','Agents','online'];(function(_0x4a93e6,_0x4046ae){var _0x2db673=function(_0x3acfa3){while(--_0x3acfa3){_0x4a93e6['push'](_0x4a93e6['shift']());}};_0x2db673(++_0x4046ae);}(_0x0e50,0x168));var _0x00e5=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0e50[_0x4b055c];return _0x4b62bb;};'use strict';var client=require(_0x00e5('0x0'));exports[_0x00e5('0x1')]=function(){return function(){return client[_0x00e5('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x00e5('0x3'),_0x00e5('0x4'),_0x00e5('0x5')],'include':[{'model':_0x00e5('0x6'),'as':_0x00e5('0x7'),'attributes':['id','name',_0x00e5('0x8'),'smsPause']}]},'log':_0x00e5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7ebaca5..fc8ea5c 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 _0xeaef=['create','Request','CreateSmsQueueReport','DESC','UpdateSmsQueueReport','../client'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xeaef,0xfb));var _0xfeae=function(_0x9b4d61,_0x17ccc3){_0x9b4d61=_0x9b4d61-0x0;var _0x5951fb=_0xeaef[_0x9b4d61];return _0x5951fb;};'use strict';var client=require(_0xfeae('0x0'));exports[_0xfeae('0x1')]=function(_0x253d9b){return client[_0xfeae('0x2')](_0xfeae('0x3'),{'body':_0x253d9b,'log':_0xfeae('0x3')});};exports['update']=function(_0x2577e5,_0x1fe568){return client[_0xfeae('0x2')]('UpdateSmsQueueReport',{'body':_0x1fe568,'options':{'where':{'uniqueid':_0x2577e5},'order':[['id',_0xfeae('0x4')]],'limit':0x1},'log':_0xfeae('0x5')});}; \ No newline at end of file +var _0x590a=['UpdateSmsQueueReport','create','Request','CreateSmsQueueReport'];(function(_0x3365a5,_0x2de866){var _0x2c756f=function(_0x55dd41){while(--_0x55dd41){_0x3365a5['push'](_0x3365a5['shift']());}};_0x2c756f(++_0x2de866);}(_0x590a,0x159));var _0xa590=function(_0x1f88b2,_0x56181d){_0x1f88b2=_0x1f88b2-0x0;var _0x3ff643=_0x590a[_0x1f88b2];return _0x3ff643;};'use strict';var client=require('../client');exports[_0xa590('0x0')]=function(_0x3132c8){return client[_0xa590('0x1')](_0xa590('0x2'),{'body':_0x3132c8,'log':_0xa590('0x2')});};exports['update']=function(_0x59d33c,_0x8ee149){return client[_0xa590('0x1')](_0xa590('0x3'),{'body':_0x8ee149,'options':{'where':{'uniqueid':_0x59d33c},'order':[['id','DESC']],'limit':0x1},'log':_0xa590('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 31856d7..711715d 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 _0x3a4f=['whatsappPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3a4f,0x93));var _0xf3a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a4f[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xf3a4('0x0')]=function(){return function(){return client[_0xf3a4('0x1')](_0xf3a4('0x2'),{'options':{'raw':!![],'where':{'role':_0xf3a4('0x3')},'attributes':['id',_0xf3a4('0x4'),_0xf3a4('0x5'),_0xf3a4('0x6'),_0xf3a4('0x7'),_0xf3a4('0x8'),_0xf3a4('0x9'),_0xf3a4('0xa'),_0xf3a4('0xb'),_0xf3a4('0xc'),_0xf3a4('0xd'),'openchannelPause',_0xf3a4('0xe'),_0xf3a4('0xf'),_0xf3a4('0x10'),_0xf3a4('0x11'),_0xf3a4('0x12'),_0xf3a4('0x13')]},'log':_0xf3a4('0x0')});};}; \ No newline at end of file +var _0x2cbc=['faxPause','smsPause','whatsappPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','GetUser','agent','online','pauseType','lastPauseAt','voicePause','mailPause'];(function(_0x3459a5,_0x4a0377){var _0x557afe=function(_0x3c8504){while(--_0x3c8504){_0x3459a5['push'](_0x3459a5['shift']());}};_0x557afe(++_0x4a0377);}(_0x2cbc,0x1a6));var _0xc2cb=function(_0x22499b,_0x3d5a5c){_0x22499b=_0x22499b-0x0;var _0x35cabe=_0x2cbc[_0x22499b];return _0x35cabe;};'use strict';var client=require(_0xc2cb('0x0'));exports[_0xc2cb('0x1')]=function(){return function(){return client[_0xc2cb('0x2')](_0xc2cb('0x3'),{'options':{'raw':!![],'where':{'role':_0xc2cb('0x4')},'attributes':['id','name',_0xc2cb('0x5'),_0xc2cb('0x6'),_0xc2cb('0x7'),_0xc2cb('0x8'),'chatPause',_0xc2cb('0x9'),_0xc2cb('0xa'),_0xc2cb('0xb'),_0xc2cb('0xc'),'openchannelPause',_0xc2cb('0xd'),_0xc2cb('0xe'),_0xc2cb('0xf'),_0xc2cb('0x10'),_0xc2cb('0x11'),'openchannelCapacity']},'log':_0xc2cb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index fad8a83..a5b6b77 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 _0x851c=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x547aa3,_0x134714){var _0x5dc532=function(_0x37f9fc){while(--_0x37f9fc){_0x547aa3['push'](_0x547aa3['shift']());}};_0x5dc532(++_0x134714);}(_0x851c,0x19d));var _0xc851=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x851c[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xc851('0x0'));exports[_0xc851('0x1')]=function(_0x40d1a7,_0x3f998c){return client[_0xc851('0x2')](_0xc851('0x3'),{'body':_0x3f998c,'options':{'where':{'id':_0x40d1a7}},'log':_0xc851('0x4')});};exports['addTags']=function(_0x2fddd4,_0x84f5ad){return client['Request'](_0xc851('0x5'),{'body':_0x84f5ad,'options':{'where':{'id':_0x2fddd4}},'log':_0xc851('0x6')});}; \ No newline at end of file +var _0xab5b=['../client','update','Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x4992ad,_0x46a52e){var _0x14d181=function(_0x405e40){while(--_0x405e40){_0x4992ad['push'](_0x4992ad['shift']());}};_0x14d181(++_0x46a52e);}(_0xab5b,0x11a));var _0xbab5=function(_0x454137,_0x44825c){_0x454137=_0x454137-0x0;var _0x274cdf=_0xab5b[_0x454137];return _0x274cdf;};'use strict';var client=require(_0xbab5('0x0'));exports[_0xbab5('0x1')]=function(_0x52fbcc,_0x431930){return client[_0xbab5('0x2')]('UpdateWhatsappInteraction',{'body':_0x431930,'options':{'where':{'id':_0x52fbcc}},'log':'updateWhatsappInteraction'});};exports[_0xbab5('0x3')]=function(_0x58f49f,_0xa320ef){return client[_0xbab5('0x2')](_0xbab5('0x4'),{'body':_0xa320ef,'options':{'where':{'id':_0x58f49f}},'log':_0xbab5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 42e6d9e..0a47a07 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 _0xb42b=['create','createWhatsappMessage','../client'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xb42b,0x1d3));var _0xbb42=function(_0x3e2dbb,_0x283631){_0x3e2dbb=_0x3e2dbb-0x0;var _0x173f8c=_0xb42b[_0x3e2dbb];return _0x173f8c;};'use strict';var client=require(_0xbb42('0x0'));exports[_0xbb42('0x1')]=function(_0x312a6a){return client['Request']('CreateWhatsappMessage',{'body':_0x312a6a,'log':_0xbb42('0x2')});}; \ No newline at end of file +var _0x10d0=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x1a111e,_0x529f2e){var _0x2ba106=function(_0x5dda71){while(--_0x5dda71){_0x1a111e['push'](_0x1a111e['shift']());}};_0x2ba106(++_0x529f2e);}(_0x10d0,0xa3));var _0x010d=function(_0x5687a8,_0xbc1734){_0x5687a8=_0x5687a8-0x0;var _0x7dcf55=_0x10d0[_0x5687a8];return _0x7dcf55;};'use strict';var client=require(_0x010d('0x0'));exports[_0x010d('0x1')]=function(_0x262776){return client[_0x010d('0x2')](_0x010d('0x3'),{'body':_0x262776,'log':_0x010d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index f84f463..ebbf4b4 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 _0x0db9=['getWhatsappQueues','../client','name','timeout','User','online'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x0db9,0xa3));var _0x90db=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x0db9[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require(_0x90db('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x90db('0x1'),_0x90db('0x2'),'strategy'],'include':[{'model':_0x90db('0x3'),'as':'Agents','attributes':['id',_0x90db('0x1'),_0x90db('0x4'),'whatsappPause']}]},'log':_0x90db('0x5')});};}; \ No newline at end of file +var _0x49f8=['Agents','online','getWhatsappQueues','../client','GetWhatsappQueue','name','strategy'];(function(_0x2a7f66,_0x1b449f){var _0x3a56bc=function(_0x44b3cd){while(--_0x44b3cd){_0x2a7f66['push'](_0x2a7f66['shift']());}};_0x3a56bc(++_0x1b449f);}(_0x49f8,0xff));var _0x849f=function(_0x4500df,_0xaaf3ca){_0x4500df=_0x4500df-0x0;var _0x4e3018=_0x49f8[_0x4500df];return _0x4e3018;};'use strict';var client=require(_0x849f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x849f('0x1'),{'options':{'raw':![],'attributes':['id',_0x849f('0x2'),'timeout',_0x849f('0x3')],'include':[{'model':'User','as':_0x849f('0x4'),'attributes':['id','name',_0x849f('0x5'),'whatsappPause']}]},'log':_0x849f('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index c256e51..a148b2c 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 _0x5876=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x1c8a7a,_0xcbed40){var _0x2217ea=function(_0x5b9cb2){while(--_0x5b9cb2){_0x1c8a7a['push'](_0x1c8a7a['shift']());}};_0x2217ea(++_0xcbed40);}(_0x5876,0x95));var _0x6587=function(_0x26b3be,_0x71dc78){_0x26b3be=_0x26b3be-0x0;var _0x12379e=_0x5876[_0x26b3be];return _0x12379e;};'use strict';var client=require(_0x6587('0x0'));exports[_0x6587('0x1')]=function(_0x578062){return client[_0x6587('0x2')]('CreateWhatsappQueueReport',{'body':_0x578062,'log':_0x6587('0x3')});};exports[_0x6587('0x4')]=function(_0x5757dd,_0x4378cb){return client[_0x6587('0x2')](_0x6587('0x5'),{'body':_0x4378cb,'options':{'where':{'uniqueid':_0x5757dd},'order':[['id',_0x6587('0x6')]],'limit':0x1},'log':_0x6587('0x5')});}; \ No newline at end of file +var _0x4a27=['update','UpdateWhatsappQueueReport','DESC','CreateWhatsappQueueReport'];(function(_0x224632,_0x3ca19c){var _0x1e35d1=function(_0x1654de){while(--_0x1654de){_0x224632['push'](_0x224632['shift']());}};_0x1e35d1(++_0x3ca19c);}(_0x4a27,0x16b));var _0x74a2=function(_0x18b7e8,_0x58058c){_0x18b7e8=_0x18b7e8-0x0;var _0x4a8bc0=_0x4a27[_0x18b7e8];return _0x4a8bc0;};'use strict';var client=require('../client');exports['create']=function(_0x5e0ed8){return client['Request'](_0x74a2('0x0'),{'body':_0x5e0ed8,'log':_0x74a2('0x0')});};exports[_0x74a2('0x1')]=function(_0x12b39d,_0xdb38be){return client['Request'](_0x74a2('0x2'),{'body':_0xdb38be,'options':{'where':{'uniqueid':_0x12b39d},'order':[['id',_0x74a2('0x3')]],'limit':0x1},'log':_0x74a2('0x2')});}; \ 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 648374a..74c4557 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 _0x8531=['consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][QUEUE]\x20%s','validate','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x514117,_0x17a8ef){var _0x10cd2b=function(_0x244528){while(--_0x244528){_0x514117['push'](_0x514117['shift']());}};_0x10cd2b(++_0x17a8ef);}(_0x8531,0x148));var _0x1853=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x8531[_0x31dde9];return _0x1fbf2d;};'use strict';var schema=require(_0x1853('0x0'));var _=require('lodash');var util=require(_0x1853('0x1'));var seqqueue=require(_0x1853('0x2'));var logger=require('../../../../config/logger')(_0x1853('0x3'));var strategy=require(_0x1853('0x4'));var queue=schema({'name':{'type':_0x1853('0x5'),'required':!![],'message':_0x1853('0x6')},'timeout':{'type':_0x1853('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x557131,_0x2c7b68,_0x55caf1){return logger['info'](util[_0x1853('0x8')](_0x1853('0x9'),_0x557131,_0x2c7b68['name'],_0x55caf1));}function handleFindAgent(_0x50b779){return function(_0x5155af){return _0x5155af[_0x1853('0xa')][_0x1853('0xb')]()===_0x50b779[_0x1853('0xb')]();};}exports[_0x1853('0xc')]=function(_0x92350c,_0x1b692b,_0x1df5f4,_0x3697a3){return function(_0x4198c3){try{var _0x559131={'name':_0x1b692b[0x0],'timeout':_0x1b692b[0x1]};var _0x303096=queue['validate'](_0x559131,{'typecast':!![]});if(_0x303096['length']){logger[_0x1853('0xd')](_0x1853('0xe'),_0x92350c,_[_0x1853('0xf')](_0x303096,_0x1853('0x10'))[_0x1853('0x11')](',\x20'));_0x4198c3[_0x1853('0x12')]();}else{var _0x1070ed=_[_0x1853('0x13')](_0x1df5f4[_0x1853('0x14')],handleFindAgent(_0x559131[_0x1853('0xa')]));if(_0x1070ed){var _0x1fbf89=(_0x559131[_0x1853('0x15')]||0xa)*0x3e8;var _0x3ccc57,_0x19892d;var _0x29538a=seqqueue[_0x1853('0x16')](_0x1fbf89);_0x29538a['id']=_0x92350c;_0x29538a[_0x1853('0x17')]=_0x1fbf89;_0x29538a['channel']=_0x3697a3[_0x1853('0x18')];writeLog(_0x92350c,_0x1070ed,util[_0x1853('0x8')]('START:%s',_0x1fbf89));_0x1df5f4['rules'][_0x92350c]['on'](_0x1853('0x19'),function(){logger[_0x1853('0x1a')](_0x1853('0x1b'),_0x92350c);clearTimeout(_0x19892d);_0x19892d=undefined;_0x29538a[_0x1853('0x1c')]();if(_0x1df5f4[_0x1853('0x1d')][_0x92350c]){delete _0x1df5f4['rules'][_0x92350c];}_0x4198c3['stop']();});_0x1df5f4[_0x1853('0x1d')][_0x92350c]['on'](_0x1853('0x1e'),function(){if(_0x1df5f4[_0x1853('0x1d')][_0x92350c]){delete _0x1df5f4['rules'][_0x92350c];}});_0x19892d=setTimeout(function(){logger[_0x1853('0x1a')](_0x1853('0x1f'),_0x92350c);clearTimeout(_0x19892d);_0x29538a[_0x1853('0x1c')]();_0x4198c3['next']();},_0x1fbf89);strategy[_0x1853('0x20')](_0x29538a,_0x1070ed,_0x1df5f4,_0x3697a3);}else{logger[_0x1853('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x92350c,_0x559131['name']);_0x4198c3['stop']();}}}catch(_0x123135){console['log'](_0x123135);logger[_0x1853('0xd')](_0x1853('0x21'),_0x92350c,_0x123135['stack']);_0x4198c3[_0x1853('0x12')]();}};}; \ No newline at end of file +var _0xea83=['consequence','validate','length','error','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','createQueue','atimeout','channel','end','close','rules','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x4a73f2,_0x352409){var _0x4190ee=function(_0x19603c){while(--_0x19603c){_0x4a73f2['push'](_0x4a73f2['shift']());}};_0x4190ee(++_0x352409);}(_0xea83,0x147));var _0x3ea8=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0xea83[_0x385fed];return _0x52fa25;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x3ea8('0x0'));var seqqueue=require(_0x3ea8('0x1'));var logger=require(_0x3ea8('0x2'))(_0x3ea8('0x3'));var strategy=require(_0x3ea8('0x4'));var queue=schema({'name':{'type':_0x3ea8('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x3ea8('0x6'),'message':_0x3ea8('0x7')}});function writeLog(_0xc1f29d,_0x54c02f,_0x540230){return logger[_0x3ea8('0x8')](util[_0x3ea8('0x9')](_0x3ea8('0xa'),_0xc1f29d,_0x54c02f[_0x3ea8('0xb')],_0x540230));}function handleFindAgent(_0xbcec08){return function(_0x33fa8b){return _0x33fa8b['name']['toLowerCase']()===_0xbcec08[_0x3ea8('0xc')]();};}exports[_0x3ea8('0xd')]=function(_0x25a0f0,_0x33007c,_0xdba179,_0x4eb0ee){return function(_0x35d08f){try{var _0x143a20={'name':_0x33007c[0x0],'timeout':_0x33007c[0x1]};var _0x522440=queue[_0x3ea8('0xe')](_0x143a20,{'typecast':!![]});if(_0x522440[_0x3ea8('0xf')]){logger[_0x3ea8('0x10')](_0x3ea8('0x11'),_0x25a0f0,_[_0x3ea8('0x12')](_0x522440,'message')[_0x3ea8('0x13')](',\x20'));_0x35d08f[_0x3ea8('0x14')]();}else{var _0x5bb9e6=_['find'](_0xdba179[_0x3ea8('0x15')],handleFindAgent(_0x143a20[_0x3ea8('0xb')]));if(_0x5bb9e6){var _0x492743=(_0x143a20[_0x3ea8('0x16')]||0xa)*0x3e8;var _0x44c942,_0x1e3fa5;var _0x3da054=seqqueue[_0x3ea8('0x17')](_0x492743);_0x3da054['id']=_0x25a0f0;_0x3da054[_0x3ea8('0x18')]=_0x492743;_0x3da054[_0x3ea8('0x19')]=_0x4eb0ee[_0x3ea8('0x19')];writeLog(_0x25a0f0,_0x5bb9e6,util[_0x3ea8('0x9')]('START:%s',_0x492743));_0xdba179['rules'][_0x25a0f0]['on'](_0x3ea8('0x1a'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x25a0f0);clearTimeout(_0x1e3fa5);_0x1e3fa5=undefined;_0x3da054[_0x3ea8('0x1b')]();if(_0xdba179[_0x3ea8('0x1c')][_0x25a0f0]){delete _0xdba179[_0x3ea8('0x1c')][_0x25a0f0];}_0x35d08f['stop']();});_0xdba179[_0x3ea8('0x1c')][_0x25a0f0]['on']('complete',function(){if(_0xdba179[_0x3ea8('0x1c')][_0x25a0f0]){delete _0xdba179[_0x3ea8('0x1c')][_0x25a0f0];}});_0x1e3fa5=setTimeout(function(){logger[_0x3ea8('0x8')](_0x3ea8('0x1d'),_0x25a0f0);clearTimeout(_0x1e3fa5);_0x3da054['close']();_0x35d08f[_0x3ea8('0x1e')]();},_0x492743);strategy[_0x3ea8('0x1f')](_0x3da054,_0x5bb9e6,_0xdba179,_0x4eb0ee);}else{logger[_0x3ea8('0x10')](_0x3ea8('0x20'),_0x25a0f0,_0x143a20['name']);_0x35d08f[_0x3ea8('0x14')]();}}}catch(_0x4d96c4){console['log'](_0x4d96c4);logger[_0x3ea8('0x10')](_0x3ea8('0x21'),_0x25a0f0,_0x4d96c4['stack']);_0x35d08f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 2af2785..bafa7be 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 _0xdc97=['lodash','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','postText','message','amazonlex','dialogState','Failed','next'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x240e37,_0x257452){_0x240e37=_0x240e37-0x0;var _0x29a307=_0xdc97[_0x240e37];return _0x29a307;};'use strict';var _=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var AWS=require(_0x7dc9('0x2'));var utils=require('./utils');var logger=require(_0x7dc9('0x3'))('routing');var rpc={'chatMessage':require(_0x7dc9('0x4')),'openchannelMessage':require(_0x7dc9('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7dc9('0x6')),'faxMessage':require(_0x7dc9('0x7')),'whatsappMessage':require(_0x7dc9('0x8'))};exports[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return function(_0x4f91c7){try{if(!_['isNil'](this[_0x7dc9('0xa')][_0x7dc9('0xb')])){logger[_0x7dc9('0xc')](_0x7dc9('0xd'),_0x589f02,_0x7dc9('0xe'));return _0x4f91c7['next']();}var _0xb2fa2a={'ContactId':this[_0x7dc9('0xf')]['id'],'sentAt':moment()[_0x7dc9('0x10')](_0x7dc9('0x11')),'direction':_0x7dc9('0x12')};var _0x3c2af5=this[_0x7dc9('0x13')];if(_0x3c2af5==='chat'){_0xb2fa2a['ChatWebsiteId']=this['account']['id'];}else{_0xb2fa2a[_['upperFirst'](_0x3c2af5)+_0x7dc9('0x14')]=this[_0x7dc9('0x15')]['id'];}_0xb2fa2a[_['upperFirst'](_0x3c2af5)+_0x7dc9('0x16')]=this[_0x7dc9('0xa')]['id'];if(this[_0x7dc9('0xa')][_0x7dc9('0x17')]){var _0x31d43d=_0x2636ef[0x4];if(!_[_0x7dc9('0x18')](_0x31d43d)){_0xb2fa2a['body']=utils[_0x7dc9('0x19')](_0x31d43d,this);return rpc[_0x3c2af5+_0x7dc9('0x1a')][_0x7dc9('0x1b')](_0xb2fa2a)[_0x7dc9('0x1c')](function(_0x11606f){logger[_0x7dc9('0xc')](_0x7dc9('0xd'),_0x589f02,_0xb2fa2a[_0x7dc9('0x1d')]);})[_0x7dc9('0x1e')](function(_0x5a6e04){logger[_0x7dc9('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x589f02,JSON[_0x7dc9('0x20')](_0x5a6e04));})[_0x7dc9('0x21')](function(){logger['info'](_0x7dc9('0x22'),_0x589f02);_0x4f91c7[_0x7dc9('0x23')]();});}else{logger[_0x7dc9('0xc')](_0x7dc9('0x24'),_0x589f02);_0x4f91c7[_0x7dc9('0x23')]();}}else{var _0x184bfd=this;var _0x2dad65=new AWS[(_0x7dc9('0x25'))]({'accessKeyId':_0x2636ef[0x0],'secretAccessKey':_0x2636ef[0x1],'region':_0x2636ef[0x2]});var _0x155cc4={'botAlias':_0x7dc9('0x26'),'botName':_0x2636ef[0x3],'inputText':this['message']['body'],'userId':this[_0x7dc9('0x13')]+':'+this[_0x7dc9('0xa')]['id']['toString']()};_0x2dad65[_0x7dc9('0x27')](_0x155cc4,function(_0x27f7fa,_0x5e9525){if(_0x27f7fa){logger[_0x7dc9('0x1f')](_0x7dc9('0xd'),_0x589f02,_0x27f7fa[_0x7dc9('0x28')]);_0x4f91c7['next']();}else if(_0x5e9525&&_0x5e9525[_0x7dc9('0x28')]){_0x184bfd[_0x7dc9('0x1d')][_0x7dc9('0x29')]=_0x5e9525;_0xb2fa2a['body']=_0x5e9525['message'];return rpc[_0x3c2af5+'Message'][_0x7dc9('0x1b')](_0xb2fa2a)[_0x7dc9('0x1c')](function(_0x5843bf){logger['info'](_0x7dc9('0xd'),_0x589f02,_0xb2fa2a['body']);if(_0x5e9525[_0x7dc9('0x2a')]==_0x7dc9('0x2b')){_0x4f91c7[_0x7dc9('0x2c')]();}else{_0x4f91c7[_0x7dc9('0x23')]();}})[_0x7dc9('0x1e')](function(_0x450124){logger[_0x7dc9('0x1f')](_0x7dc9('0xd'),_0x589f02,JSON[_0x7dc9('0x20')](_0x450124));_0x4f91c7[_0x7dc9('0x2c')]();});}else{_0x4f91c7[_0x7dc9('0x2c')]();}});}}catch(_0x2a456c){logger['error']('[%s][AMAZONLEX]\x20%s',_0x589f02,JSON['stringify'](_0x2a456c));_0x4f91c7['stop']();}};}; \ No newline at end of file +var _0x46ed=['create','then','body','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','created','isEmpty','getMustacheRender','Message'];(function(_0xf4a9c3,_0xad6030){var _0x2b9ce9=function(_0x5a385b){while(--_0x5a385b){_0xf4a9c3['push'](_0xf4a9c3['shift']());}};_0x2b9ce9(++_0xad6030);}(_0x46ed,0x168));var _0xd46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46ed[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var AWS=require('aws-sdk');var utils=require(_0xd46e('0x2'));var logger=require(_0xd46e('0x3'))(_0xd46e('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd46e('0x5')),'mailMessage':require(_0xd46e('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd46e('0x7')),'whatsappMessage':require(_0xd46e('0x8'))};exports[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return function(_0x855f24){try{if(!_[_0xd46e('0xa')](this[_0xd46e('0xb')][_0xd46e('0xc')])){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x25cf78,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x855f24[_0xd46e('0xf')]();}var _0x81235b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd46e('0x10')](_0xd46e('0x11')),'direction':_0xd46e('0x12')};var _0x443000=this[_0xd46e('0x13')];if(_0x443000===_0xd46e('0x14')){_0x81235b['ChatWebsiteId']=this[_0xd46e('0x15')]['id'];}else{_0x81235b[_['upperFirst'](_0x443000)+'AccountId']=this[_0xd46e('0x15')]['id'];}_0x81235b[_[_0xd46e('0x16')](_0x443000)+'InteractionId']=this['interaction']['id'];if(this[_0xd46e('0xb')][_0xd46e('0x17')]){var _0x1e9aae=_0x45e680[0x4];if(!_[_0xd46e('0x18')](_0x1e9aae)){_0x81235b['body']=utils[_0xd46e('0x19')](_0x1e9aae,this);return rpc[_0x443000+_0xd46e('0x1a')][_0xd46e('0x1b')](_0x81235b)[_0xd46e('0x1c')](function(_0x36a317){logger['info'](_0xd46e('0xe'),_0x25cf78,_0x81235b[_0xd46e('0x1d')]);})[_0xd46e('0x1e')](function(_0x551358){logger['error'](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x551358));})['finally'](function(){logger['info'](_0xd46e('0x20'),_0x25cf78);_0x855f24[_0xd46e('0x21')]();});}else{logger[_0xd46e('0xd')](_0xd46e('0x22'),_0x25cf78);_0x855f24[_0xd46e('0x21')]();}}else{var _0x312d6f=this;var _0x3b5fa4=new AWS[(_0xd46e('0x23'))]({'accessKeyId':_0x45e680[0x0],'secretAccessKey':_0x45e680[0x1],'region':_0x45e680[0x2]});var _0xb4940={'botAlias':_0xd46e('0x24'),'botName':_0x45e680[0x3],'inputText':this[_0xd46e('0x25')]['body'],'userId':this[_0xd46e('0x13')]+':'+this[_0xd46e('0xb')]['id'][_0xd46e('0x26')]()};_0x3b5fa4[_0xd46e('0x27')](_0xb4940,function(_0x128246,_0xc1af7f){if(_0x128246){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,_0x128246[_0xd46e('0x25')]);_0x855f24['next']();}else if(_0xc1af7f&&_0xc1af7f[_0xd46e('0x25')]){_0x312d6f['body']['amazonlex']=_0xc1af7f;_0x81235b[_0xd46e('0x1d')]=_0xc1af7f[_0xd46e('0x25')];return rpc[_0x443000+_0xd46e('0x1a')][_0xd46e('0x1b')](_0x81235b)[_0xd46e('0x1c')](function(_0x180851){logger[_0xd46e('0xd')]('[%s][AMAZONLEX]\x20%s',_0x25cf78,_0x81235b[_0xd46e('0x1d')]);if(_0xc1af7f[_0xd46e('0x29')]==_0xd46e('0x2a')){_0x855f24[_0xd46e('0xf')]();}else{_0x855f24[_0xd46e('0x21')]();}})[_0xd46e('0x1e')](function(_0x58aeef){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x58aeef));_0x855f24[_0xd46e('0xf')]();});}else{_0x855f24[_0xd46e('0xf')]();}});}}catch(_0x423ea3){logger[_0xd46e('0x28')](_0xd46e('0xe'),_0x25cf78,JSON[_0xd46e('0x1f')](_0x423ea3));_0x855f24[_0xd46e('0x21')]();}};}; \ 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 90ee495..fff85fd 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 _0x044c=['from','phone','read','subject','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','mail','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','messageId','html','','replace','body','';return mailRpc[_0xc044('0x32')](_0x4410f3,_0x37b67a)[_0xc044('0x33')](function(_0x5953ac){logger[_0xc044('0xf')](_0xc044('0x34'),_0x8a4f6);_0x37b67a[_0xc044('0x2b')]=_0x5953ac[_0xc044('0x16')][_0xc044('0x2b')];return rpc[_0x1beda5+'Message'][_0xc044('0x35')](_0x37b67a);})[_0xc044('0x33')](function(_0x143fac){logger['info'](_0xc044('0x36'),_0x8a4f6,JSON[_0xc044('0x37')](_0x143fac));})['catch'](function(_0x23bbfb){logger[_0xc044('0x38')](_0xc044('0x39'),_0x8a4f6,JSON[_0xc044('0x37')](_0x23bbfb));})[_0xc044('0x3a')](function(){_0x590b63[_0xc044('0x10')]();});}else{return rpc[this[_0xc044('0x11')]+_0xc044('0x3b')]['create'](_0x37b67a)[_0xc044('0x33')](function(_0x3197e0){logger[_0xc044('0xf')](_0xc044('0x36'),_0x8a4f6,_0x37b67a[_0xc044('0x2f')]);})[_0xc044('0x3c')](function(_0x4e1969){logger[_0xc044('0x38')](_0xc044('0x36'),_0x8a4f6,JSON[_0xc044('0x37')](_0x4e1969));})['finally'](function(){_0x590b63[_0xc044('0x10')]();});}}}catch(_0x47dab6){logger[_0xc044('0x38')]('[%s][AUTOREPLY]\x20%s',_0x8a4f6,JSON[_0xc044('0x37')](_0x47dab6));_0x590b63['stop']();}};}; \ No newline at end of file +var _0xe119=['[%s][AUTOREPLY]\x20%s','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','create','catch','error','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','interaction','created','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','format','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','mail','service','host','port','Smtp','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','body','';return mailRpc[_0x9e11('0x34')](_0x4cfc14,_0x120292)[_0x9e11('0x35')](function(_0x1b7d99){logger[_0x9e11('0x36')](_0x9e11('0x37'),_0x1f5d91);_0x120292['messageId']=_0x1b7d99[_0x9e11('0x14')][_0x9e11('0x2e')];return rpc[_0x5581c4+_0x9e11('0x22')]['create'](_0x120292);})[_0x9e11('0x35')](function(_0x19c27a){logger[_0x9e11('0x36')](_0x9e11('0x38'),_0x1f5d91,JSON[_0x9e11('0x39')](_0x19c27a));})['catch'](function(_0x1276c0){logger['error'](_0x9e11('0x3a'),_0x1f5d91,JSON[_0x9e11('0x39')](_0x1276c0));})[_0x9e11('0x3b')](function(){_0x425635[_0x9e11('0xe')]();});}else{return rpc[this[_0x9e11('0xf')]+'Message'][_0x9e11('0x3c')](_0x120292)[_0x9e11('0x35')](function(_0x3611e9){logger[_0x9e11('0x36')](_0x9e11('0x38'),_0x1f5d91,_0x120292[_0x9e11('0x31')]);})[_0x9e11('0x3d')](function(_0x33df21){logger[_0x9e11('0x3e')](_0x9e11('0x38'),_0x1f5d91,JSON[_0x9e11('0x39')](_0x33df21));})['finally'](function(){_0x425635[_0x9e11('0xe')]();});}}}catch(_0x11de64){logger[_0x9e11('0x3e')](_0x9e11('0x38'),_0x1f5d91,JSON[_0x9e11('0x39')](_0x11de64));_0x425635[_0x9e11('0x3f')]();}};}; \ 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 128c461..38c2871 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 _0x078a=['stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x1744f0,_0x99ca0a){var _0x532901=function(_0x354cb5){while(--_0x354cb5){_0x1744f0['push'](_0x1744f0['shift']());}};_0x532901(++_0x99ca0a);}(_0x078a,0x12d));var _0xa078=function(_0x41296e,_0x335649){_0x41296e=_0x41296e-0x0;var _0xad48bb=_0x078a[_0x41296e];return _0xad48bb;};'use strict';var moment=require(_0xa078('0x0'));var logger=require(_0xa078('0x1'))(_0xa078('0x2'));var rpc={'chatInteraction':require(_0xa078('0x3')),'openchannelInteraction':require(_0xa078('0x4')),'smsInteraction':require(_0xa078('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xa078('0x6')),'whatsappInteraction':require(_0xa078('0x7'))};exports[_0xa078('0x8')]=function(_0x51963f,_0xe1f165,_0x4a65f2,_0x453616){return function(_0x3ad4e0){try{logger[_0xa078('0x9')](_0xa078('0xa'),_0x51963f,_0xe1f165[0x0]);var _0x2acd06={'closed':0x1,'closedAt':moment()[_0xa078('0xb')](_0xa078('0xc')),'closeReason':_0xa078('0xd'),'disposition':_0xe1f165[0x0]};if(rpc[_0x453616['channel']+_0xa078('0xe')]){rpc[_0x453616[_0xa078('0xf')]+_0xa078('0xe')][_0xa078('0x10')](_0x453616['interaction']['id'],_0x2acd06)[_0xa078('0x11')](function(_0x210400){logger[_0xa078('0x9')](_0xa078('0x12'),_0x51963f,_0x453616[_0xa078('0x13')]['id']);})['catch'](function(_0x31efe8){logger[_0xa078('0x14')](_0xa078('0x15'),_0x51963f,JSON[_0xa078('0x16')](_0x31efe8));})[_0xa078('0x17')](function(){_0x3ad4e0[_0xa078('0x18')]();});}}catch(_0x43064b){logger[_0xa078('0x14')](_0xa078('0x15'),_0x51963f,JSON[_0xa078('0x16')](_0x43064b));_0x3ad4e0[_0xa078('0x18')]();}};}; \ No newline at end of file +var _0x0c42=['update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','finally','stop','error','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction'];(function(_0x575c83,_0x5c6ab6){var _0x2ede11=function(_0x32d7af){while(--_0x32d7af){_0x575c83['push'](_0x575c83['shift']());}};_0x2ede11(++_0x5c6ab6);}(_0x0c42,0x191));var _0x20c4=function(_0x10ed69,_0x194bef){_0x10ed69=_0x10ed69-0x0;var _0x94b9b2=_0x0c42[_0x10ed69];return _0x94b9b2;};'use strict';var moment=require(_0x20c4('0x0'));var logger=require(_0x20c4('0x1'))(_0x20c4('0x2'));var rpc={'chatInteraction':require(_0x20c4('0x3')),'openchannelInteraction':require(_0x20c4('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x20c4('0x5')),'whatsappInteraction':require(_0x20c4('0x6'))};exports[_0x20c4('0x7')]=function(_0x23231a,_0x1032cd,_0x58e1ed,_0x339b15){return function(_0x4c4f94){try{logger[_0x20c4('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x23231a,_0x1032cd[0x0]);var _0xc29a61={'closed':0x1,'closedAt':moment()[_0x20c4('0x9')](_0x20c4('0xa')),'closeReason':'system','disposition':_0x1032cd[0x0]};if(rpc[_0x339b15[_0x20c4('0xb')]+_0x20c4('0xc')]){rpc[_0x339b15[_0x20c4('0xb')]+_0x20c4('0xc')][_0x20c4('0xd')](_0x339b15[_0x20c4('0xe')]['id'],_0xc29a61)[_0x20c4('0xf')](function(_0x29ecb3){logger[_0x20c4('0x8')](_0x20c4('0x10'),_0x23231a,_0x339b15[_0x20c4('0xe')]['id']);})[_0x20c4('0x11')](function(_0x188060){logger['error'](_0x20c4('0x12'),_0x23231a,JSON['stringify'](_0x188060));})[_0x20c4('0x13')](function(){_0x4c4f94[_0x20c4('0x14')]();});}}catch(_0x59f54f){logger[_0x20c4('0x15')]('[%s][CLOSE]\x20%s',_0x23231a,JSON[_0x20c4('0x16')](_0x59f54f));_0x4c4f94[_0x20c4('0x14')]();}};}; \ 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 a928760..3caa02a 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 _0x8cb0=['apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','Message','metadata','endConversation','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8cb0,0x148));var _0x08cb=function(_0xdc29f5,_0xf981ed){_0xdc29f5=_0xdc29f5-0x0;var _0x3cb7d3=_0x8cb0[_0xdc29f5];return _0x3cb7d3;};'use strict';var _=require(_0x08cb('0x0'));var moment=require('moment');var apiai=require(_0x08cb('0x1'));var md5=require(_0x08cb('0x2'));var utils=require(_0x08cb('0x3'));var logger=require(_0x08cb('0x4'))(_0x08cb('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x08cb('0x6')),'mailMessage':require(_0x08cb('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x08cb('0x8')),'whatsappMessage':require(_0x08cb('0x9'))};exports['consequence']=function(_0x5f56ec,_0x3d3ff4){return function(_0x2aaa20){try{if(!_[_0x08cb('0xa')](this[_0x08cb('0xb')][_0x08cb('0xc')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x5f56ec,_0x08cb('0xd'));return _0x2aaa20[_0x08cb('0xe')]();}var _0x566ba5={'ContactId':this[_0x08cb('0xf')]['id'],'sentAt':moment()[_0x08cb('0x10')](_0x08cb('0x11')),'direction':_0x08cb('0x12')};var _0x3ea478=this['channel'];if(_0x3ea478===_0x08cb('0x13')){_0x566ba5[_0x08cb('0x14')]=this[_0x08cb('0x15')]['id'];}else{_0x566ba5[_['upperFirst'](_0x3ea478)+'AccountId']=this[_0x08cb('0x15')]['id'];}_0x566ba5[_[_0x08cb('0x16')](_0x3ea478)+_0x08cb('0x17')]=this[_0x08cb('0xb')]['id'];if(this[_0x08cb('0xb')][_0x08cb('0x18')]){var _0x56e4ee=_0x3d3ff4[0x2];if(!_[_0x08cb('0x19')](_0x56e4ee)){_0x566ba5[_0x08cb('0x1a')]=utils[_0x08cb('0x1b')](_0x56e4ee,this);return rpc[_0x3ea478+'Message'][_0x08cb('0x1c')](_0x566ba5)[_0x08cb('0x1d')](function(_0x529e88){logger[_0x08cb('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x5f56ec,_0x566ba5[_0x08cb('0x1a')]);})[_0x08cb('0x1f')](function(_0x111ecf){logger[_0x08cb('0x20')](_0x08cb('0x21'),_0x5f56ec,JSON[_0x08cb('0x22')](_0x111ecf));})['finally'](function(){logger[_0x08cb('0x1e')](_0x08cb('0x23'),_0x5f56ec);_0x2aaa20[_0x08cb('0x24')]();});}else{logger[_0x08cb('0x1e')](_0x08cb('0x25'),_0x5f56ec);_0x2aaa20[_0x08cb('0x24')]();}}else{var _0x244ac6=this;var _0x4bf06c=apiai(_0x3d3ff4[0x0],{'language':_0x3d3ff4[0x1]||'en'});return _0x4bf06c[_0x08cb('0x26')](this[_0x08cb('0x27')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0x08cb('0x1d')](function(_0x512ec5){_0x244ac6[_0x08cb('0x1a')][_0x08cb('0x28')]=_0x512ec5;_0x566ba5[_0x08cb('0x1a')]=_0x512ec5[_0x08cb('0x29')][_0x08cb('0x2a')][_0x08cb('0x2b')];return rpc[_0x3ea478+_0x08cb('0x2c')][_0x08cb('0x1c')](_0x566ba5)[_0x08cb('0x1d')](function(_0x4d0773){logger[_0x08cb('0x1e')](_0x08cb('0x21'),_0x5f56ec,_0x566ba5[_0x08cb('0x1a')]);if(_0x512ec5[_0x08cb('0x29')][_0x08cb('0x2d')][_0x08cb('0x2e')]){_0x2aaa20[_0x08cb('0xe')]();}else{_0x2aaa20[_0x08cb('0x24')]();}})[_0x08cb('0x1f')](function(_0xab5861){logger[_0x08cb('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x5f56ec,JSON[_0x08cb('0x22')](_0xab5861));_0x2aaa20[_0x08cb('0xe')]();});})['catch'](function(_0xa62b81){logger[_0x08cb('0x20')](_0x08cb('0x21'),_0x5f56ec,_0xa62b81[_0x08cb('0x27')]);_0x2aaa20[_0x08cb('0xe')]();});}}catch(_0x2c6556){logger[_0x08cb('0x20')](_0x08cb('0x21'),_0x5f56ec,JSON[_0x08cb('0x22')](_0x2c6556));_0x2aaa20[_0x08cb('0x24')]();}};}; \ No newline at end of file +var _0x3933=['format','out','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','create','then','info','catch','[%s][DIALOGFLOW]\x20%s','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','fulfillment','speech','Message','metadata','endConversation','stringify','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact'];(function(_0x335ac8,_0x4d544e){var _0xc44f53=function(_0x6f9955){while(--_0x6f9955){_0x335ac8['push'](_0x335ac8['shift']());}};_0xc44f53(++_0x4d544e);}(_0x3933,0x1df));var _0x3393=function(_0x3032ea,_0x3878db){_0x3032ea=_0x3032ea-0x0;var _0x1770b5=_0x3933[_0x3032ea];return _0x1770b5;};'use strict';var _=require(_0x3393('0x0'));var moment=require(_0x3393('0x1'));var apiai=require(_0x3393('0x2'));var md5=require(_0x3393('0x3'));var utils=require(_0x3393('0x4'));var logger=require(_0x3393('0x5'))(_0x3393('0x6'));var rpc={'chatMessage':require(_0x3393('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3393('0x8')),'smsMessage':require(_0x3393('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3393('0xa'))};exports[_0x3393('0xb')]=function(_0x5f3f87,_0x32f676){return function(_0x532d20){try{if(!_['isNil'](this['interaction'][_0x3393('0xc')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x5f3f87,_0x3393('0xd'));return _0x532d20[_0x3393('0xe')]();}var _0x9d6195={'ContactId':this[_0x3393('0xf')]['id'],'sentAt':moment()[_0x3393('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x3393('0x11')};var _0x260265=this[_0x3393('0x12')];if(_0x260265==='chat'){_0x9d6195[_0x3393('0x13')]=this[_0x3393('0x14')]['id'];}else{_0x9d6195[_[_0x3393('0x15')](_0x260265)+_0x3393('0x16')]=this[_0x3393('0x14')]['id'];}_0x9d6195[_['upperFirst'](_0x260265)+_0x3393('0x17')]=this[_0x3393('0x18')]['id'];if(this[_0x3393('0x18')][_0x3393('0x19')]){var _0x142b4d=_0x32f676[0x2];if(!_[_0x3393('0x1a')](_0x142b4d)){_0x9d6195[_0x3393('0x1b')]=utils['getMustacheRender'](_0x142b4d,this);return rpc[_0x260265+'Message'][_0x3393('0x1c')](_0x9d6195)[_0x3393('0x1d')](function(_0x1d2e0b){logger[_0x3393('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x5f3f87,_0x9d6195[_0x3393('0x1b')]);})[_0x3393('0x1f')](function(_0x44c3d2){logger['error'](_0x3393('0x20'),_0x5f3f87,JSON['stringify'](_0x44c3d2));})['finally'](function(){logger[_0x3393('0x1e')](_0x3393('0x21'),_0x5f3f87);_0x532d20[_0x3393('0x22')]();});}else{logger[_0x3393('0x1e')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5f3f87);_0x532d20[_0x3393('0x22')]();}}else{var _0x32f170=this;var _0x5ef140=apiai(_0x32f676[0x0],{'language':_0x32f676[0x1]||'en'});return _0x5ef140['textRequest'](this[_0x3393('0x23')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0x3393('0x1d')](function(_0x15d702){_0x32f170[_0x3393('0x1b')][_0x3393('0x24')]=_0x15d702;_0x9d6195[_0x3393('0x1b')]=_0x15d702[_0x3393('0x25')][_0x3393('0x26')][_0x3393('0x27')];return rpc[_0x260265+_0x3393('0x28')][_0x3393('0x1c')](_0x9d6195)[_0x3393('0x1d')](function(_0x8bba40){logger['info'](_0x3393('0x20'),_0x5f3f87,_0x9d6195[_0x3393('0x1b')]);if(_0x15d702[_0x3393('0x25')][_0x3393('0x29')][_0x3393('0x2a')]){_0x532d20['next']();}else{_0x532d20[_0x3393('0x22')]();}})[_0x3393('0x1f')](function(_0x26cc3a){logger['error'](_0x3393('0x20'),_0x5f3f87,JSON[_0x3393('0x2b')](_0x26cc3a));_0x532d20[_0x3393('0xe')]();});})[_0x3393('0x1f')](function(_0x485e61){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x5f3f87,_0x485e61[_0x3393('0x23')]);_0x532d20['next']();});}}catch(_0xb70e49){logger[_0x3393('0x2c')](_0x3393('0x20'),_0x5f3f87,JSON['stringify'](_0xb70e49));_0x532d20[_0x3393('0x22')]();}};}; \ 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 20a76c1..bc38963 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 _0x02a7=['validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','replace','length','error','[%s][GOTOIF]\x20%s','join','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','message'];(function(_0x1b6767,_0x11c00c){var _0x3e3b62=function(_0x108102){while(--_0x108102){_0x1b6767['push'](_0x1b6767['shift']());}};_0x3e3b62(++_0x11c00c);}(_0x02a7,0x17a));var _0x702a=function(_0x87dc0a,_0x1dcfb7){_0x87dc0a=_0x87dc0a-0x0;var _0x26aeb7=_0x02a7[_0x87dc0a];return _0x26aeb7;};'use strict';var schema=require(_0x702a('0x0'));var _=require(_0x702a('0x1'));var htmlToText=require(_0x702a('0x2'));var utils=require(_0x702a('0x3'));var logger=require(_0x702a('0x4'))(_0x702a('0x5'));var gotoif=schema({'condition':{'type':_0x702a('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x702a('0x7')},'priorityFalse':{'type':_0x702a('0x8'),'message':_0x702a('0x9')}});exports[_0x702a('0xa')]=function(_0x905e4d,_0x384554){return function(_0x2ddfee){try{var _0x1ee667={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x384554[0x0],this),{'wordwrap':![]})[_0x702a('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x384554[0x1],'priorityFalse':_0x384554[0x2]};var _0x5cbb48=gotoif[_0x702a('0x0')](_0x1ee667,{'typecast':!![]});if(_0x5cbb48[_0x702a('0xc')]){logger[_0x702a('0xd')](_0x702a('0xe'),_0x905e4d,_['map'](_0x5cbb48,'message')[_0x702a('0xf')](',\x20'));_0x2ddfee[_0x702a('0x10')]();}else{try{var _0x15197e=eval('('+_0x1ee667[_0x702a('0x11')]+')');var _0x216362=_0x15197e?_0x1ee667[_0x702a('0x12')]:_0x1ee667[_0x702a('0x13')];logger[_0x702a('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x905e4d,_0x1ee667[_0x702a('0x11')],_0x15197e,_0x216362||_0x702a('0x15'));if(_0x216362){var _0x3840c7=_[_0x702a('0x16')](_0x2ddfee[_0x702a('0x17')](),{'p':_0x216362});if(_0x3840c7>=0x0){logger[_0x702a('0x14')](_0x702a('0x18'),_0x905e4d,_0x216362||_0x702a('0x15'),_0x3840c7);_0x2ddfee[_0x702a('0x15')](_0x3840c7);}else{logger[_0x702a('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x905e4d,_0x216362||_0x702a('0x15'));_0x2ddfee[_0x702a('0x10')]();}}else{_0x2ddfee['next']();}}catch(_0x274a51){logger[_0x702a('0xd')](_0x702a('0x19'),_0x905e4d,_0x274a51[_0x702a('0x1a')]);_0x2ddfee['stop']();}}}catch(_0x16b7f1){logger[_0x702a('0xd')](_0x702a('0xe'),_0x905e4d,JSON['stringify'](_0x16b7f1));_0x2ddfee['stop']();}};}; \ No newline at end of file +var _0x798a=['join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','map','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x798a,0x157));var _0xa798=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x798a[_0x29d94e];return _0x106237;};'use strict';var schema=require(_0xa798('0x0'));var _=require(_0xa798('0x1'));var htmlToText=require(_0xa798('0x2'));var utils=require(_0xa798('0x3'));var logger=require(_0xa798('0x4'))(_0xa798('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xa798('0x6')},'priorityTrue':{'type':_0xa798('0x7'),'message':_0xa798('0x8')},'priorityFalse':{'type':'number','message':_0xa798('0x9')}});exports[_0xa798('0xa')]=function(_0x473349,_0x25deac){return function(_0x2760c3){try{var _0x4e52a7={'condition':htmlToText[_0xa798('0xb')](utils[_0xa798('0xc')](_0x25deac[0x0],this),{'wordwrap':![]})[_0xa798('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x25deac[0x1],'priorityFalse':_0x25deac[0x2]};var _0x53c7da=gotoif[_0xa798('0x0')](_0x4e52a7,{'typecast':!![]});if(_0x53c7da[_0xa798('0xe')]){logger['error']('[%s][GOTOIF]\x20%s',_0x473349,_[_0xa798('0xf')](_0x53c7da,_0xa798('0x10'))[_0xa798('0x11')](',\x20'));_0x2760c3[_0xa798('0x12')]();}else{try{var _0xb5e702=eval('('+_0x4e52a7[_0xa798('0x13')]+')');var _0x1e3ee7=_0xb5e702?_0x4e52a7['priorityTrue']:_0x4e52a7[_0xa798('0x14')];logger[_0xa798('0x15')](_0xa798('0x16'),_0x473349,_0x4e52a7[_0xa798('0x13')],_0xb5e702,_0x1e3ee7||'next');if(_0x1e3ee7){var _0x1f090c=_[_0xa798('0x17')](_0x2760c3[_0xa798('0x18')](),{'p':_0x1e3ee7});if(_0x1f090c>=0x0){logger['info'](_0xa798('0x19'),_0x473349,_0x1e3ee7||'next',_0x1f090c);_0x2760c3[_0xa798('0x1a')](_0x1f090c);}else{logger[_0xa798('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x473349,_0x1e3ee7||_0xa798('0x1a'));_0x2760c3[_0xa798('0x12')]();}}else{_0x2760c3[_0xa798('0x1a')]();}}catch(_0xff8603){logger['error'](_0xa798('0x1b'),_0x473349,_0xff8603[_0xa798('0x10')]);_0x2760c3['stop']();}}}catch(_0xfb1ddb){logger['error'](_0xa798('0x1c'),_0x473349,JSON[_0xa798('0x1d')](_0xfb1ddb));_0x2760c3['stop']();}};}; \ 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 6359e77..ba323e0 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 _0x2945=['rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','stop','priority','findIndex'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0x2945,0x7e));var _0x5294=function(_0x12f6a1,_0x506d31){_0x12f6a1=_0x12f6a1-0x0;var _0x8a7ef=_0x2945[_0x12f6a1];return _0x8a7ef;};'use strict';var schema=require('validate');var _=require(_0x5294('0x0'));var logger=require('../../../../config/logger')(_0x5294('0x1'));var gotop=schema({'priority':{'type':_0x5294('0x2'),'required':!![],'message':_0x5294('0x3')}});exports[_0x5294('0x4')]=function(_0x4beb49,_0x17d42e){return function(_0x295a90){try{var _0x420461={'priority':_0x17d42e[0x0]};var _0x3ee0a1=gotop[_0x5294('0x5')](_0x420461,{'typecast':!![]});if(_0x3ee0a1[_0x5294('0x6')]){logger[_0x5294('0x7')](_0x5294('0x8'),_0x4beb49,_[_0x5294('0x9')](_0x3ee0a1,_0x5294('0xa'))['join'](',\x20'));_0x295a90[_0x5294('0xb')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x4beb49,_0x420461[_0x5294('0xc')]);if(_0x420461[_0x5294('0xc')]){var _0x24057a=_[_0x5294('0xd')](_0x295a90[_0x5294('0xe')](),{'p':_0x420461[_0x5294('0xc')]});if(_0x24057a>=0x0){logger[_0x5294('0xf')](_0x5294('0x10'),_0x4beb49,_0x420461[_0x5294('0xc')]||_0x5294('0x11'),_0x24057a);_0x295a90[_0x5294('0x11')](_0x24057a);}else{logger[_0x5294('0xf')](_0x5294('0x12'),_0x4beb49,_0x420461[_0x5294('0xc')]||_0x5294('0x11'));_0x295a90['stop']();}}else{_0x295a90[_0x5294('0x11')]();}}}catch(_0x944a54){logger['error']('[%s][GOTOP]\x20%s',_0x4beb49,JSON[_0x5294('0x13')](_0x944a54));_0x295a90[_0x5294('0xb')]();}};}; \ No newline at end of file +var _0x2f0e=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','validate','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x14a087,_0x2d39fe){var _0x294c80=function(_0x27b76a){while(--_0x27b76a){_0x14a087['push'](_0x14a087['shift']());}};_0x294c80(++_0x2d39fe);}(_0x2f0e,0x1f4));var _0xe2f0=function(_0x6ba418,_0x53fe35){_0x6ba418=_0x6ba418-0x0;var _0x4d941a=_0x2f0e[_0x6ba418];return _0x4d941a;};'use strict';var schema=require(_0xe2f0('0x0'));var _=require(_0xe2f0('0x1'));var logger=require(_0xe2f0('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xe2f0('0x3')}});exports[_0xe2f0('0x4')]=function(_0x47cf39,_0x10901c){return function(_0x6cd9cb){try{var _0x2eb374={'priority':_0x10901c[0x0]};var _0x5b1ab3=gotop[_0xe2f0('0x0')](_0x2eb374,{'typecast':!![]});if(_0x5b1ab3['length']){logger[_0xe2f0('0x5')](_0xe2f0('0x6'),_0x47cf39,_[_0xe2f0('0x7')](_0x5b1ab3,_0xe2f0('0x8'))[_0xe2f0('0x9')](',\x20'));_0x6cd9cb['stop']();}else{logger[_0xe2f0('0xa')](_0xe2f0('0xb'),_0x47cf39,_0x2eb374[_0xe2f0('0xc')]);if(_0x2eb374[_0xe2f0('0xc')]){var _0x2a8750=_[_0xe2f0('0xd')](_0x6cd9cb[_0xe2f0('0xe')](),{'p':_0x2eb374[_0xe2f0('0xc')]});if(_0x2a8750>=0x0){logger[_0xe2f0('0xa')](_0xe2f0('0xf'),_0x47cf39,_0x2eb374[_0xe2f0('0xc')]||_0xe2f0('0x10'),_0x2a8750);_0x6cd9cb[_0xe2f0('0x10')](_0x2a8750);}else{logger[_0xe2f0('0xa')](_0xe2f0('0x11'),_0x47cf39,_0x2eb374['priority']||'next');_0x6cd9cb[_0xe2f0('0x12')]();}}else{_0x6cd9cb[_0xe2f0('0x10')]();}}}catch(_0x45ebe5){logger[_0xe2f0('0x5')](_0xe2f0('0x6'),_0x47cf39,JSON['stringify'](_0x45ebe5));_0x6cd9cb['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index e505423..b359a58 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 _0x159e=['InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','getMustacheRender','contact','channel','chat','account','upperFirst'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0x159e,0x181));var _0xe159=function(_0x1e57cd,_0x35b904){_0x1e57cd=_0x1e57cd-0x0;var _0x1e4104=_0x159e[_0x1e57cd];return _0x1e4104;};'use strict';var _=require(_0xe159('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xe159('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe159('0x2')),'mailMessage':require(_0xe159('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe159('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x577197,_0x3ca978){return function(_0x536751){try{var _0x515d3f={'body':utils[_0xe159('0x5')](_0x3ca978[0x0],this),'ContactId':this[_0xe159('0x6')]['id']};if(this[_0xe159('0x7')]===_0xe159('0x8')){_0x515d3f['ChatWebsiteId']=this[_0xe159('0x9')]['id'];}else{_0x515d3f[_['upperFirst'](this[_0xe159('0x7')])+'AccountId']=this[_0xe159('0x9')]['id'];}_0x515d3f[_[_0xe159('0xa')](this[_0xe159('0x7')])+_0xe159('0xb')]=this['interaction']['id'];if(rpc[this[_0xe159('0x7')]+_0xe159('0xc')]){return rpc[this[_0xe159('0x7')]+'Message'][_0xe159('0xd')](_0x515d3f)[_0xe159('0xe')](function(_0x20af3d){logger['info'](_0xe159('0xf'),_0x577197,_0x515d3f[_0xe159('0x10')]);_0x536751[_0xe159('0x11')]();})[_0xe159('0x12')](function(_0x4584dc){logger['error']('[%s][MESSAGE]\x20%s',_0x577197,JSON[_0xe159('0x13')](_0x4584dc));_0x536751[_0xe159('0x14')]();});}}catch(_0x3b341f){logger[_0xe159('0x15')](_0xe159('0xf'),_0x577197,JSON[_0xe159('0x13')](_0x3b341f));_0x536751[_0xe159('0x14')]();}};}; \ No newline at end of file +var _0xa64e=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x14b7fa,_0x480cac){var _0x31d011=function(_0x56f60b){while(--_0x56f60b){_0x14b7fa['push'](_0x14b7fa['shift']());}};_0x31d011(++_0x480cac);}(_0xa64e,0x1ab));var _0xea64=function(_0x487702,_0x49f5d4){_0x487702=_0x487702-0x0;var _0x5e7150=_0xa64e[_0x487702];return _0x5e7150;};'use strict';var _=require(_0xea64('0x0'));var utils=require(_0xea64('0x1'));var logger=require(_0xea64('0x2'))(_0xea64('0x3'));var rpc={'chatMessage':require(_0xea64('0x4')),'openchannelMessage':require(_0xea64('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xea64('0x6')),'faxMessage':require(_0xea64('0x7')),'whatsappMessage':require(_0xea64('0x8'))};exports[_0xea64('0x9')]=function(_0x54e68e,_0x3c9241){return function(_0x301cfc){try{var _0x45fa97={'body':utils[_0xea64('0xa')](_0x3c9241[0x0],this),'ContactId':this[_0xea64('0xb')]['id']};if(this[_0xea64('0xc')]===_0xea64('0xd')){_0x45fa97[_0xea64('0xe')]=this[_0xea64('0xf')]['id'];}else{_0x45fa97[_[_0xea64('0x10')](this[_0xea64('0xc')])+_0xea64('0x11')]=this[_0xea64('0xf')]['id'];}_0x45fa97[_[_0xea64('0x10')](this[_0xea64('0xc')])+_0xea64('0x12')]=this[_0xea64('0x13')]['id'];if(rpc[this[_0xea64('0xc')]+_0xea64('0x14')]){return rpc[this[_0xea64('0xc')]+_0xea64('0x14')][_0xea64('0x15')](_0x45fa97)[_0xea64('0x16')](function(_0x28e00e){logger[_0xea64('0x17')](_0xea64('0x18'),_0x54e68e,_0x45fa97[_0xea64('0x19')]);_0x301cfc[_0xea64('0x1a')]();})[_0xea64('0x1b')](function(_0x58e29f){logger[_0xea64('0x1c')]('[%s][MESSAGE]\x20%s',_0x54e68e,JSON[_0xea64('0x1d')](_0x58e29f));_0x301cfc[_0xea64('0x1e')]();});}}catch(_0x52b38d){logger[_0xea64('0x1c')](_0xea64('0x18'),_0x54e68e,JSON[_0xea64('0x1d')](_0x52b38d));_0x301cfc[_0xea64('0x1e')]();}};}; \ 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 fb40abb..df5dac5 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 _0x82da=['stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x82da,0xf4));var _0xa82d=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x82da[_0xdea41a];return _0x15d0d8;};'use strict';var utils=require(_0xa82d('0x0'));var logger=require(_0xa82d('0x1'))('routing');exports[_0xa82d('0x2')]=function(_0x374676,_0x2beacf){return function(_0x9aaa91){try{logger[_0xa82d('0x3')](_0xa82d('0x4'),_0x374676,utils[_0xa82d('0x5')](_0x2beacf[0x0],this));_0x9aaa91[_0xa82d('0x6')]();}catch(_0x9e7329){logger[_0xa82d('0x7')](_0xa82d('0x4'),_0x374676,JSON['stringify'](_0x9e7329));_0x9aaa91[_0xa82d('0x8')]();}};}; \ No newline at end of file +var _0xdb43=['getMustacheRender','next','error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x57c83a,_0x5866e4){var _0x21b624=function(_0x5bea8a){while(--_0x5bea8a){_0x57c83a['push'](_0x57c83a['shift']());}};_0x21b624(++_0x5866e4);}(_0xdb43,0x16d));var _0x3db4=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xdb43[_0x59d89e];return _0x554e93;};'use strict';var utils=require(_0x3db4('0x0'));var logger=require('../../../../config/logger')(_0x3db4('0x1'));exports[_0x3db4('0x2')]=function(_0x6dcfd4,_0x557afd){return function(_0x4a018b){try{logger[_0x3db4('0x3')](_0x3db4('0x4'),_0x6dcfd4,utils[_0x3db4('0x5')](_0x557afd[0x0],this));_0x4a018b[_0x3db4('0x6')]();}catch(_0x597e73){logger[_0x3db4('0x7')]('[%s][NOOP]\x20%s',_0x6dcfd4,JSON[_0x3db4('0x8')](_0x597e73));_0x4a018b[_0x3db4('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index b394b55..e66b51b 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 _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x224c43,_0x1db20b){var _0x4e9f67=function(_0x6d7c6e){while(--_0x6d7c6e){_0x224c43['push'](_0x224c43['shift']());}};_0x4e9f67(++_0x1db20b);}(_0xedd9,0xfc));var _0x9edd=function(_0xe01d60,_0x340301){_0xe01d60=_0xe01d60-0x0;var _0x46d858=_0xedd9[_0xe01d60];return _0x46d858;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file +var _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x55a3de,_0x2c34b9){var _0x15f138=function(_0x49be44){while(--_0x49be44){_0x55a3de['push'](_0x55a3de['shift']());}};_0x15f138(++_0x2c34b9);}(_0x34e8,0x12c));var _0x834e=function(_0x3604ca,_0x1f9317){_0x3604ca=_0x3604ca-0x0;var _0x53b666=_0x34e8[_0x3604ca];return _0x53b666;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 35469b1..05f89f9 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 _0x6c42=['agent','realtime','push','handleRun','bind','handleTimeout','handleDrained','prototype','info','isNil','agents','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','squeue'];(function(_0x34970b,_0x4d5dec){var _0x19fdb0=function(_0x57f89c){while(--_0x57f89c){_0x34970b['push'](_0x34970b['shift']());}};_0x19fdb0(++_0x4d5dec);}(_0x6c42,0x181));var _0x26c4=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0x6c42[_0x5f746f];return _0x198d15;};'use strict';var _=require(_0x26c4('0x0'));var uuid=require(_0x26c4('0x1'));var util=require('./util');var logger=require(_0x26c4('0x2'))(_0x26c4('0x3'));var Agent=function(_0x16b9f5,_0x5b7aca,_0xbd9b52,_0x297ae8){this['notificationId']=uuid['v4']();this[_0x26c4('0x4')]=_0x16b9f5;this[_0x26c4('0x5')]=_0x5b7aca;this[_0x26c4('0x6')]=_0xbd9b52;this[_0x26c4('0x3')]=_0x297ae8;this['squeue'][_0x26c4('0x7')](this[_0x26c4('0x8')][_0x26c4('0x9')](this),this[_0x26c4('0xa')]['bind'](this));this[_0x26c4('0x4')]['on']('timeout',this[_0x26c4('0xa')][_0x26c4('0x9')](this));this[_0x26c4('0x4')]['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x26c4('0x7')]=function(){this[_0x26c4('0x4')][_0x26c4('0x7')](this['handleRun'][_0x26c4('0x9')](this),this[_0x26c4('0xa')]['bind'](this));};Agent['prototype'][_0x26c4('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0x26c4('0xc')]['handleRun']=function(_0x512045){logger[_0x26c4('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x26c4('0x4')]['id'],this[_0x26c4('0x5')]['id']);if(_[_0x26c4('0xe')](this[_0x26c4('0x6')][_0x26c4('0xf')][this['agent']['id']])){logger[_0x26c4('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x26c4('0x5')]['id']);setTimeout(this[_0x26c4('0x7')]['bind'](this),0x3e8);}else{if(this[_0x26c4('0x3')][_0x26c4('0x10')]||util[_0x26c4('0x11')](this[_0x26c4('0x4')]['id'],this['realtime'][_0x26c4('0xf')][this['agent']['id']],this['squeue']['channel'],![])){this[_0x26c4('0x6')][_0x26c4('0xf')][this[_0x26c4('0x5')]['id']][_0x26c4('0x12')]=!![];this[_0x26c4('0x6')][_0x26c4('0xf')][this[_0x26c4('0x5')]['id']][_0x26c4('0x13')]=undefined;util[_0x26c4('0x14')](this[_0x26c4('0x15')],this[_0x26c4('0x4')]['id'],this['realtime']['agents'][this[_0x26c4('0x5')]['id']],null,this[_0x26c4('0x3')]);util[_0x26c4('0x16')](this[_0x26c4('0x4')]['id'],this[_0x26c4('0x6')][_0x26c4('0xf')][this[_0x26c4('0x5')]['id']],_0x26c4('0x17')+(this[_0x26c4('0x3')][_0x26c4('0x10')]?_0x26c4('0x18'):''));}else{logger[_0x26c4('0xd')](_0x26c4('0x19'),this[_0x26c4('0x4')]['id'],this[_0x26c4('0x5')]['id']);setTimeout(this[_0x26c4('0x7')]['bind'](this),0x3e8);}}};Agent[_0x26c4('0xc')][_0x26c4('0xa')]=function(_0x4346b9){if(_[_0x26c4('0xe')](this['realtime'][_0x26c4('0xf')][this[_0x26c4('0x5')]['id']])){return logger[_0x26c4('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x26c4('0x4')]['id'],this[_0x26c4('0x5')]['id']);}else{logger[_0x26c4('0xd')](_0x26c4('0x1a'),this[_0x26c4('0x4')]['id'],this[_0x26c4('0x5')]['id']);util['hideNotification'](this['notificationId'],this[_0x26c4('0x4')]['id'],this[_0x26c4('0x6')][_0x26c4('0xf')][this[_0x26c4('0x5')]['id']],null,this[_0x26c4('0x3')]);this[_0x26c4('0x6')][_0x26c4('0xf')][this['agent']['id']][_0x26c4('0x12')]=![];this[_0x26c4('0x6')][_0x26c4('0xf')][this[_0x26c4('0x5')]['id']][_0x26c4('0x13')]=undefined;util[_0x26c4('0x16')](this[_0x26c4('0x4')]['id'],this['realtime'][_0x26c4('0xf')][this[_0x26c4('0x5')]['id']],_0x4346b9?_0x26c4('0x1b'):_0x26c4('0x1c'));}if(!_0x4346b9){setTimeout(this[_0x26c4('0x7')][_0x26c4('0x9')](this),0x3e8);}};function agent(_0x4d8e44,_0x3c3022,_0x297d3b,_0xa51d26){return new Agent(_0x4d8e44,_0x3c3022,_0x297d3b,_0xa51d26);}module[_0x26c4('0x1d')]=agent; \ No newline at end of file +var _0x9258=['handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','isAgentAvailable','channel','showNotification','writeLog','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0x9258,0xbe));var _0x8925=function(_0x3ef796,_0x267e00){_0x3ef796=_0x3ef796-0x0;var _0x45cde7=_0x9258[_0x3ef796];return _0x45cde7;};'use strict';var _=require(_0x8925('0x0'));var uuid=require(_0x8925('0x1'));var util=require(_0x8925('0x2'));var logger=require(_0x8925('0x3'))(_0x8925('0x4'));var Agent=function(_0x4359d1,_0x4e164b,_0x364608,_0x4e71bf){this[_0x8925('0x5')]=uuid['v4']();this[_0x8925('0x6')]=_0x4359d1;this['agent']=_0x4e164b;this[_0x8925('0x7')]=_0x364608;this[_0x8925('0x4')]=_0x4e71bf;this['squeue'][_0x8925('0x8')](this[_0x8925('0x9')][_0x8925('0xa')](this),this[_0x8925('0xb')][_0x8925('0xa')](this));this['squeue']['on'](_0x8925('0xc'),this[_0x8925('0xb')][_0x8925('0xa')](this));this[_0x8925('0x6')]['on'](_0x8925('0xd'),this[_0x8925('0xe')]['bind'](this));};Agent[_0x8925('0xf')][_0x8925('0x8')]=function(){this[_0x8925('0x6')][_0x8925('0x8')](this[_0x8925('0x9')][_0x8925('0xa')](this),this[_0x8925('0xb')]['bind'](this));};Agent['prototype'][_0x8925('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0x8925('0xf')][_0x8925('0x9')]=function(_0x5cb3d3){logger[_0x8925('0x10')](_0x8925('0x11'),this['squeue']['id'],this[_0x8925('0x12')]['id']);if(_[_0x8925('0x13')](this['realtime'][_0x8925('0x14')][this[_0x8925('0x12')]['id']])){logger[_0x8925('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8925('0x6')]['id'],this[_0x8925('0x12')]['id']);setTimeout(this[_0x8925('0x8')][_0x8925('0xa')](this),0x3e8);}else{if(this[_0x8925('0x4')]['forcedOwnership']||util[_0x8925('0x15')](this[_0x8925('0x6')]['id'],this[_0x8925('0x7')][_0x8925('0x14')][this['agent']['id']],this[_0x8925('0x6')][_0x8925('0x16')],![])){this['realtime'][_0x8925('0x14')][this[_0x8925('0x12')]['id']]['busy']=!![];this[_0x8925('0x7')][_0x8925('0x14')][this[_0x8925('0x12')]['id']]['busyQueue']=undefined;util[_0x8925('0x17')](this[_0x8925('0x5')],this[_0x8925('0x6')]['id'],this[_0x8925('0x7')][_0x8925('0x14')][this[_0x8925('0x12')]['id']],null,this[_0x8925('0x4')]);util[_0x8925('0x18')](this['squeue']['id'],this['realtime'][_0x8925('0x14')][this['agent']['id']],'RINGING'+(this[_0x8925('0x4')][_0x8925('0x19')]?_0x8925('0x1a'):''));}else{logger['info'](_0x8925('0x1b'),this[_0x8925('0x6')]['id'],this[_0x8925('0x12')]['id']);setTimeout(this['push'][_0x8925('0xa')](this),0x3e8);}}};Agent[_0x8925('0xf')][_0x8925('0xb')]=function(_0x2c6ae4){if(_[_0x8925('0x13')](this[_0x8925('0x7')]['agents'][this['agent']['id']])){return logger['info'](_0x8925('0x1c'),this[_0x8925('0x6')]['id'],this['agent']['id']);}else{logger['info'](_0x8925('0x1d'),this[_0x8925('0x6')]['id'],this[_0x8925('0x12')]['id']);util['hideNotification'](this[_0x8925('0x5')],this[_0x8925('0x6')]['id'],this[_0x8925('0x7')][_0x8925('0x14')][this[_0x8925('0x12')]['id']],null,this['routing']);this['realtime'][_0x8925('0x14')][this[_0x8925('0x12')]['id']][_0x8925('0x1e')]=![];this[_0x8925('0x7')][_0x8925('0x14')][this['agent']['id']][_0x8925('0x1f')]=undefined;util[_0x8925('0x18')](this[_0x8925('0x6')]['id'],this[_0x8925('0x7')][_0x8925('0x14')][this[_0x8925('0x12')]['id']],_0x2c6ae4?_0x8925('0x20'):'TIMEOUT');}if(!_0x2c6ae4){setTimeout(this['push'][_0x8925('0xa')](this),0x3e8);}};function agent(_0x2e72de,_0x350faa,_0x11bfd2,_0x5d55a3){return new Agent(_0x2e72de,_0x350faa,_0x11bfd2,_0x5d55a3);}module[_0x8925('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 3469e90..dd4b0fc 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 _0x5107=['STOP','TIMEOUT','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','isNil','queue','Agents','length','agents','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','showNotification','notificationId','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x3be714,_0x38e9f4){var _0xcf112e=function(_0x15d9c2){while(--_0x15d9c2){_0x3be714['push'](_0x3be714['shift']());}};_0xcf112e(++_0x38e9f4);}(_0x5107,0x1cb));var _0x7510=function(_0xf16d7f,_0x4211c4){_0xf16d7f=_0xf16d7f-0x0;var _0x572745=_0x5107[_0xf16d7f];return _0x572745;};'use strict';var _=require(_0x7510('0x0'));var uuid=require(_0x7510('0x1'));var util=require(_0x7510('0x2'));var logger=require(_0x7510('0x3'))(_0x7510('0x4'));var Beepall=function(_0x47c260,_0x274901,_0x4b6c2d,_0x593b6a){this['notificationId']=uuid['v4']();this[_0x7510('0x5')]=_0x47c260;this['queue']=_0x274901;this[_0x7510('0x6')]=_0x4b6c2d;this[_0x7510('0x4')]=_0x593b6a;this['squeue'][_0x7510('0x7')](this[_0x7510('0x8')][_0x7510('0x9')](this),this[_0x7510('0xa')][_0x7510('0x9')](this));this[_0x7510('0x5')]['on'](_0x7510('0xb'),this[_0x7510('0xa')][_0x7510('0x9')](this));this[_0x7510('0x5')]['on']('drained',this[_0x7510('0xc')][_0x7510('0x9')](this));};Beepall[_0x7510('0xd')][_0x7510('0x7')]=function(){this[_0x7510('0x5')][_0x7510('0x7')](this[_0x7510('0x8')][_0x7510('0x9')](this),this[_0x7510('0xa')][_0x7510('0x9')](this));};Beepall[_0x7510('0xd')][_0x7510('0xc')]=function(_0x15f830){this[_0x7510('0xa')](!![]);};Beepall['prototype'][_0x7510('0x8')]=function(_0xe9b43e){var _0x5e3d7f=!![];if(!_[_0x7510('0xe')](this[_0x7510('0xf')])&&!_[_0x7510('0xe')](this['queue'][_0x7510('0x10')])&&this[_0x7510('0xf')][_0x7510('0x10')][_0x7510('0x11')]>0x0){for(var _0x4d6461=0x0,_0x17f1a3;_0x4d64610x0){for(var _0x1bb392=0x0,_0x37d3e6;_0x1bb3920x0&&_0x4fc9a1[_0x395caf+_0xfe06('0x24')]>=_0x4fc9a1[_0x395caf+'Capacity']){writeLog(_0x3af431,_0x4fc9a1,_0x395caf[_0xfe06('0x25')]()+_0xfe06('0x26'));return![];}}return!![];};exports[_0xfe06('0x27')]=function(_0x1f2e63,_0x5b69e0,_0x441cc3,_0x1e7f88,_0x355f86){return sendNotification(!![],_0x1f2e63,_0x5b69e0,_0x441cc3,_0x1e7f88,_0x355f86);};exports[_0xfe06('0x28')]=function(_0x40a91e,_0x2ff54a,_0x16b47a,_0x3d2e53,_0x5209a6){return sendNotification(![],_0x40a91e,_0x2ff54a,_0x16b47a,_0x3d2e53,_0x5209a6);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xe1ee=['lodash','util','mustache','ioredis','../../../../../config/logger','redis','localhost','socket.io-emitter','user:%s','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','format','emit','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog'];(function(_0x1e178f,_0x326363){var _0x225e85=function(_0x115484){while(--_0x115484){_0x1e178f['push'](_0x1e178f['shift']());}};_0x225e85(++_0x326363);}(_0xe1ee,0x158));var _0xee1e=function(_0x5bab26,_0x437a03){_0x5bab26=_0x5bab26-0x0;var _0x34e3f2=_0xe1ee[_0x5bab26];return _0x34e3f2;};'use strict';var _=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var utils=require('../utils');var Mustache=require(_0xee1e('0x2'));var Redis=require(_0xee1e('0x3'));var config=require('../../../../../config/environment');var logger=require(_0xee1e('0x4'))('routing');config[_0xee1e('0x5')]=_['defaults'](config['redis'],{'host':_0xee1e('0x6'),'port':0x18eb});var io=require(_0xee1e('0x7'))(new Redis(config[_0xee1e('0x5')]));function emit(_0x3dbd99,_0x4dcff2,_0x335d60){io['to'](_0x3dbd99)['emit'](_0x4dcff2,_0x335d60);}function sendNotification(_0x575700,_0x4d2766,_0x1ce11e,_0x14d58b,_0x44d75f,_0x4878b1){io['to'](util['format'](_0xee1e('0x8'),_0x14d58b[_0xee1e('0x9')]))['emit']('user:save',_0x14d58b);var _0x2f55e3=_0x4878b1||{};var _0x2a9d5c=_0x1ce11e[_0xee1e('0xa')]('.');var _0x12a464={'uniqueid':_0x4d2766,'channel':_0x2a9d5c[0x0],'id':_0x2a9d5c[0x1],'title':_0x2a9d5c[0x0]+_0xee1e('0xb'),'interactionId':_0x2a9d5c[0x2],'queue':_0x44d75f?_0x44d75f['name']:null,'sound':_0x2f55e3[_0xee1e('0xc')][_0xee1e('0xd')],'shake':_0x2f55e3[_0xee1e('0xc')][_0xee1e('0xe')]};try{if(!_0x2f55e3[_0xee1e('0xf')]){_0x2f55e3[_0xee1e('0xf')]={};}if(_0x44d75f){_0x2f55e3['body'][_0xee1e('0x10')]=_0x44d75f;}else if(_0x2f55e3['body'][_0xee1e('0x10')]){delete _0x2f55e3['body'][_0xee1e('0x10')];}_0x12a464['msg']=utils[_0xee1e('0x11')](_0x2f55e3[_0xee1e('0xc')][_0xee1e('0x12')],_0x2f55e3);}catch(_0x227cc1){_0x12a464[_0xee1e('0x13')]=_0xee1e('0x14');logger[_0xee1e('0x15')](util['format'](_0xee1e('0x16'),_0x4d2766,_0x227cc1[_0xee1e('0x17')]));}io['to'](util[_0xee1e('0x18')](_0xee1e('0x8'),_0x14d58b[_0xee1e('0x9')]))[_0xee1e('0x19')](util[_0xee1e('0x18')]('notification:%s',_0x575700?_0xee1e('0x1a'):_0xee1e('0x1b')),_0x12a464);}function writeLog(_0x5a9b9d,_0x3c6a45,_0x2080ef){return logger['info'](util[_0xee1e('0x18')](_0xee1e('0x1c'),_0x5a9b9d,_0x3c6a45[_0xee1e('0x9')],_0x2080ef));}exports[_0xee1e('0x1d')]=function(_0x2cad73,_0x278dc3,_0x4c2e00,_0x446552){if(_0x278dc3[_0xee1e('0x1e')]){writeLog(_0x2cad73,_0x278dc3,_0xee1e('0x1f'));return![];}if(!_0x278dc3['online']){writeLog(_0x2cad73,_0x278dc3,_0xee1e('0x20'));return![];}if(_0x278dc3[_0x4c2e00+_0xee1e('0x21')]){writeLog(_0x2cad73,_0x278dc3,_0xee1e('0x22'));return![];}if(_0x446552&&_0x278dc3['hasOwnProperty'](_0x4c2e00+'Capacity')&&_0x278dc3[_0xee1e('0x23')](_0x4c2e00+_0xee1e('0x24'))){if(_0x278dc3[_0x4c2e00+_0xee1e('0x25')]>0x0&&_0x278dc3[_0x4c2e00+_0xee1e('0x24')]>=_0x278dc3[_0x4c2e00+_0xee1e('0x25')]){writeLog(_0x2cad73,_0x278dc3,_0x4c2e00[_0xee1e('0x26')]()+_0xee1e('0x27'));return![];}}return!![];};exports[_0xee1e('0x28')]=function(_0x31b523,_0x44078f,_0x4e2fec,_0x1df7e7,_0x4d0bad){return sendNotification(!![],_0x31b523,_0x44078f,_0x4e2fec,_0x1df7e7,_0x4d0bad);};exports[_0xee1e('0x29')]=function(_0x2ff884,_0x3e0408,_0x4ed630,_0x4f63b4,_0x1ee4b3){return sendNotification(![],_0x2ff884,_0x3e0408,_0x4ed630,_0x4f63b4,_0x1ee4b3);};exports[_0xee1e('0x2a')]=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 dba62cd..890f98c 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 _0xf436=['consequence','length','map','message','join','info','next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x3a32a6,_0x2ebde8){var _0x50c096=function(_0x2f00cc){while(--_0x2f00cc){_0x3a32a6['push'](_0x3a32a6['shift']());}};_0x50c096(++_0x2ebde8);}(_0xf436,0xa2));var _0x6f43=function(_0x2542e1,_0x4ae86c){_0x2542e1=_0x2542e1-0x0;var _0x5bc25b=_0xf436[_0x2542e1];return _0x5bc25b;};'use strict';var schema=require(_0x6f43('0x0'));var sh=require(_0x6f43('0x1'));var _=require(_0x6f43('0x2'));var utils=require('./utils');var logger=require(_0x6f43('0x3'))('routing');var system=schema({'command':{'type':_0x6f43('0x4'),'required':!![],'message':_0x6f43('0x5')}});exports[_0x6f43('0x6')]=function(_0x32ddb9,_0x2a8b6b){return function(_0x42fc53){try{var _0x552027={'command':_0x2a8b6b[0x0]};var _0x188c2e=system[_0x6f43('0x0')](_0x552027,{'typecast':!![]});if(_0x188c2e[_0x6f43('0x7')]){logger['error']('[%s][SYSTEM]\x20%s',_0x32ddb9,_[_0x6f43('0x8')](_0x188c2e,_0x6f43('0x9'))[_0x6f43('0xa')](',\x20'));logger[_0x6f43('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x32ddb9);_0x42fc53[_0x6f43('0xc')]();}else{var _0xce2e8a=this;var _0x3796ad=utils['getMustacheRender'](_0x2a8b6b[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x32ddb9,_0x3796ad);sh['exec'](_[_0x6f43('0xd')](_0x3796ad),function(_0x38a8d3,_0x1f96cf){logger[_0x6f43('0xb')](_0x6f43('0xe'),_0x32ddb9,_0x38a8d3);if(_0x38a8d3==0x0){var _0x38c822=_0x1f96cf[_0x6f43('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x6f43('0x10')](_0x2a8b6b[0x1])||_[_0x6f43('0x11')](_0x2a8b6b[0x1])){logger[_0x6f43('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x32ddb9);_0xce2e8a[_0x6f43('0x12')][_0x2a8b6b[0x1]]=_0x38c822;}else{logger[_0x6f43('0xb')](_0x6f43('0x13'),_0x32ddb9,_0x2a8b6b[0x1],_0x38c822);_0xce2e8a[_0x6f43('0x12')][_0x2a8b6b[0x1]]=_0x38c822;}}_0x42fc53[_0x6f43('0xc')]();});}}catch(_0x36eb09){logger[_0x6f43('0x14')](_0x6f43('0x15'),_0x32ddb9,_[_0x6f43('0x16')](_0x36eb09)?JSON['stringify'](_0x36eb09):_0x36eb09);logger[_0x6f43('0xb')](_0x6f43('0x17'),_0x32ddb9);_0x42fc53[_0x6f43('0xc')]();}};}; \ No newline at end of file +var _0x2072=['next','validate','lodash','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x5978b8,_0x4b1aff){var _0x47a1fd=function(_0x5f1c4d){while(--_0x5f1c4d){_0x5978b8['push'](_0x5978b8['shift']());}};_0x47a1fd(++_0x4b1aff);}(_0x2072,0x17b));var _0x2207=function(_0x200c22,_0x440b8f){_0x200c22=_0x200c22-0x0;var _0x15a13f=_0x2072[_0x200c22];return _0x15a13f;};'use strict';var schema=require(_0x2207('0x0'));var sh=require('shelljs');var _=require(_0x2207('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x2207('0x2')}});exports['consequence']=function(_0x484b58,_0x167021){return function(_0x5ad74f){try{var _0x18f9fb={'command':_0x167021[0x0]};var _0x561c05=system[_0x2207('0x0')](_0x18f9fb,{'typecast':!![]});if(_0x561c05[_0x2207('0x3')]){logger[_0x2207('0x4')](_0x2207('0x5'),_0x484b58,_['map'](_0x561c05,_0x2207('0x6'))[_0x2207('0x7')](',\x20'));logger[_0x2207('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x484b58);_0x5ad74f['next']();}else{var _0x1f8f64=this;var _0x1b6712=utils[_0x2207('0x9')](_0x167021[0x0],this);logger[_0x2207('0x8')](_0x2207('0xa'),_0x484b58,_0x1b6712);sh[_0x2207('0xb')](_['trim'](_0x1b6712),function(_0x35b0e3,_0x369041){logger[_0x2207('0x8')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x484b58,_0x35b0e3);if(_0x35b0e3==0x0){var _0x34519f=_0x369041[_0x2207('0xc')](/(\r\n|\n|\r)/gm,'');if(_[_0x2207('0xd')](_0x167021[0x1])||_[_0x2207('0xe')](_0x167021[0x1])){logger[_0x2207('0x8')](_0x2207('0xf'),_0x484b58);_0x1f8f64[_0x2207('0x10')][_0x167021[0x1]]=_0x34519f;}else{logger[_0x2207('0x8')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x484b58,_0x167021[0x1],_0x34519f);_0x1f8f64[_0x2207('0x10')][_0x167021[0x1]]=_0x34519f;}}_0x5ad74f['next']();});}}catch(_0x54d772){logger['error'](_0x2207('0x5'),_0x484b58,_[_0x2207('0x11')](_0x54d772)?JSON[_0x2207('0x12')](_0x54d772):_0x54d772);logger['info'](_0x2207('0x13'),_0x484b58);_0x5ad74f[_0x2207('0x14')]();}};}; \ 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 4ff1bca..d0aa891 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 _0x5899=['validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject'];(function(_0x4ecd6c,_0x228287){var _0x446d37=function(_0x352e23){while(--_0x352e23){_0x4ecd6c['push'](_0x4ecd6c['shift']());}};_0x446d37(++_0x228287);}(_0x5899,0x144));var _0x9589=function(_0x4fa4d1,_0x1c3976){_0x4fa4d1=_0x4fa4d1-0x0;var _0x2dd8ec=_0x5899[_0x4fa4d1];return _0x2dd8ec;};'use strict';var schema=require(_0x9589('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x9589('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x9589('0x2')),'mailInteraction':require(_0x9589('0x3')),'faxInteraction':require(_0x9589('0x4')),'whatsappInteraction':require(_0x9589('0x5'))};var logger=require('../../../../config/logger')(_0x9589('0x6'));var tag=schema({'tag':{'type':_0x9589('0x7'),'required':!![],'message':_0x9589('0x8')}});exports[_0x9589('0x9')]=function(_0x27f6b7,_0x143e1c,_0x926075,_0x22f9d5){return function(_0x377a8){try{var _0x273268={'tag':_0x143e1c[0x0]};var _0x339810=tag[_0x9589('0x0')](_0x273268,{'typecast':!![]});if(_0x339810[_0x9589('0xa')]){logger[_0x9589('0xb')](_0x9589('0xc'),_0x27f6b7,_[_0x9589('0xd')](_0x339810,_0x9589('0xe'))['join'](',\x20'));logger[_0x9589('0xf')](_0x9589('0x10'),_0x27f6b7);_0x377a8[_0x9589('0x11')]();}else{var _0x5e9e6d={'ids':[_0x143e1c[0x0]]};if(rpc[_0x22f9d5['channel']+'Interaction']){rpc[_0x22f9d5[_0x9589('0x12')]+_0x9589('0x13')]['addTags'](_0x22f9d5[_0x9589('0x14')]['id'],_0x5e9e6d)[_0x9589('0x15')](function(_0x2bb4a3){logger[_0x9589('0xf')](_0x9589('0x16'),_0x27f6b7,_0x143e1c[0x1],_0x22f9d5[_0x9589('0x12')],_0x22f9d5[_0x9589('0x14')]['id']);})[_0x9589('0x17')](function(_0x5be573){logger['error'](_0x9589('0xc'),_0x27f6b7,JSON[_0x9589('0x18')](_0x5be573));logger[_0x9589('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x27f6b7);})[_0x9589('0x19')](function(){_0x377a8[_0x9589('0x11')]();});}}}catch(_0x160f38){logger[_0x9589('0xb')](_0x9589('0xc'),_0x27f6b7,_[_0x9589('0x1a')](_0x160f38)?JSON[_0x9589('0x18')](_0x160f38):_0x160f38);logger[_0x9589('0xf')](_0x9589('0x10'),_0x27f6b7);_0x377a8[_0x9589('0x11')]();}};}; \ No newline at end of file +var _0x559e=['info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','isObject','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then'];(function(_0x203a88,_0x32521b){var _0x46e6ce=function(_0x3fa707){while(--_0x3fa707){_0x203a88['push'](_0x203a88['shift']());}};_0x46e6ce(++_0x32521b);}(_0x559e,0x125));var _0xe559=function(_0x16394d,_0x50b877){_0x16394d=_0x16394d-0x0;var _0x2d31c5=_0x559e[_0x16394d];return _0x2d31c5;};'use strict';var schema=require(_0xe559('0x0'));var _=require(_0xe559('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xe559('0x2')),'smsInteraction':require(_0xe559('0x3')),'mailInteraction':require(_0xe559('0x4')),'faxInteraction':require(_0xe559('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xe559('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xe559('0x7')}});exports[_0xe559('0x8')]=function(_0x1ae15a,_0x96a4f0,_0x1d9b5a,_0x2a6e78){return function(_0x4d5bfb){try{var _0x7caa81={'tag':_0x96a4f0[0x0]};var _0x295ff5=tag[_0xe559('0x0')](_0x7caa81,{'typecast':!![]});if(_0x295ff5[_0xe559('0x9')]){logger['error'](_0xe559('0xa'),_0x1ae15a,_['map'](_0x295ff5,_0xe559('0xb'))[_0xe559('0xc')](',\x20'));logger['info'](_0xe559('0xd'),_0x1ae15a);_0x4d5bfb['next']();}else{var _0xbda8c6={'ids':[_0x96a4f0[0x0]]};if(rpc[_0x2a6e78[_0xe559('0xe')]+_0xe559('0xf')]){rpc[_0x2a6e78[_0xe559('0xe')]+_0xe559('0xf')][_0xe559('0x10')](_0x2a6e78[_0xe559('0x11')]['id'],_0xbda8c6)[_0xe559('0x12')](function(_0x42ca75){logger[_0xe559('0x13')](_0xe559('0x14'),_0x1ae15a,_0x96a4f0[0x1],_0x2a6e78[_0xe559('0xe')],_0x2a6e78['interaction']['id']);})['catch'](function(_0x11044b){logger[_0xe559('0x15')](_0xe559('0xa'),_0x1ae15a,JSON['stringify'](_0x11044b));logger[_0xe559('0x13')](_0xe559('0xd'),_0x1ae15a);})['finally'](function(){_0x4d5bfb['next']();});}}}catch(_0x9f861){logger[_0xe559('0x15')]('[%s][TAG]\x20%s',_0x1ae15a,_[_0xe559('0x16')](_0x9f861)?JSON[_0xe559('0x17')](_0x9f861):_0x9f861);logger[_0xe559('0x13')](_0xe559('0xd'),_0x1ae15a);_0x4d5bfb['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index b8cfc2a..d8b2728 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 _0x6a55=['mustache','exports','render','merge','body','contact','message','account','interaction','list'];(function(_0x23cc7d,_0x553e85){var _0x41abb3=function(_0x3cbbde){while(--_0x3cbbde){_0x23cc7d['push'](_0x23cc7d['shift']());}};_0x41abb3(++_0x553e85);}(_0x6a55,0x154));var _0x56a5=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x6a55[_0x3df871];return _0x570f7b;};'use strict';var Mustache=require(_0x56a5('0x0'));var _=require('lodash');module[_0x56a5('0x1')]={'getMustacheRender':function(_0x11c36a,_0x5cef4f){return Mustache[_0x56a5('0x2')](_0x11c36a,_[_0x56a5('0x3')](_0x5cef4f[_0x56a5('0x4')],{'contact':_0x5cef4f[_0x56a5('0x5')],'message':_0x5cef4f[_0x56a5('0x6')],'account':_0x5cef4f[_0x56a5('0x7')],'interaction':_0x5cef4f[_0x56a5('0x8')],'list':_0x5cef4f[_0x56a5('0x9')]}))||'';}}; \ No newline at end of file +var _0x2392=['mustache','lodash','body','contact','message','account','interaction','list'];(function(_0x46efe6,_0x340951){var _0x1d2240=function(_0x2fc432){while(--_0x2fc432){_0x46efe6['push'](_0x46efe6['shift']());}};_0x1d2240(++_0x340951);}(_0x2392,0xd0));var _0x2239=function(_0x2b814e,_0xde0d5a){_0x2b814e=_0x2b814e-0x0;var _0x4160f0=_0x2392[_0x2b814e];return _0x4160f0;};'use strict';var Mustache=require(_0x2239('0x0'));var _=require(_0x2239('0x1'));module['exports']={'getMustacheRender':function(_0x3b95bc,_0x31ff6e){return Mustache['render'](_0x3b95bc,_['merge'](_0x31ff6e[_0x2239('0x2')],{'contact':_0x31ff6e[_0x2239('0x3')],'message':_0x31ff6e[_0x2239('0x4')],'account':_0x31ff6e[_0x2239('0x5')],'interaction':_0x31ff6e[_0x2239('0x6')],'list':_0x31ff6e[_0x2239('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index b7943bb..b955487 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 _0x967e=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','emit','complete','stack','routing\x20is\x20empty','channel','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','openchannelQueues','smsQueues'];(function(_0xc7a0cb,_0x389964){var _0x10ce8e=function(_0x3a6dcf){while(--_0x3a6dcf){_0xc7a0cb['push'](_0xc7a0cb['shift']());}};_0x10ce8e(++_0x389964);}(_0x967e,0x67));var _0xe967=function(_0x153752,_0xcddabd){_0x153752=_0x153752-0x0;var _0x34e5fd=_0x967e[_0x153752];return _0x34e5fd;};'use strict';var _=require(_0xe967('0x0'));var util=require(_0xe967('0x1'));var path=require(_0xe967('0x2'));var fs=require('fs');var jayson=require(_0xe967('0x3'));var BPromise=require(_0xe967('0x4'));var uuid=require(_0xe967('0x5'));var config=require('../../../config/environment');var logger=require(_0xe967('0x6'))(_0xe967('0x7'));var rpc={'openchannelQueueReport':require(_0xe967('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xe967('0x9')),'smsQueueReport':require(_0xe967('0xa')),'faxQueueReport':require(_0xe967('0xb')),'whatsappQueueReport':require(_0xe967('0xc'))};var RuleEngine=require(_0xe967('0xd'));function getId(_0x1d02c6,_0x47165f,_0x170799){return util[_0xe967('0xe')]('%s.%s.%s',_0x1d02c6,_0x47165f||0x0,_0x170799||0x0);}function getIntervals(_0x157c36,_0x1530f0){var _0x242e49=[];if(!_[_0xe967('0xf')](_0x1530f0[_0xe967('0x10')])&&!_[_0xe967('0xf')](_0x157c36[_0x1530f0['IntervalId']])&&!_[_0xe967('0xf')](_0x157c36[_0x1530f0[_0xe967('0x10')]][_0xe967('0x11')])){_0x242e49=_[_0xe967('0x12')](_0x157c36[_0x1530f0[_0xe967('0x10')]]['Intervals'],_0xe967('0x13'));}else if(!_['isNil'](_0x1530f0[_0xe967('0x13')])){_0x242e49=[_0x1530f0[_0xe967('0x13')]];}return _0x242e49;}exports['listen']=function(_0x2ce751){_0x2ce751[_0xe967('0x14')]={};return new BPromise(function(_0x21667c,_0x68db73){var _0x4865f2={'Start':function(_0x2aa103){var _0x25e782=this;return new Promise(function(_0x1e6d72,_0x161de0){if(_0x2aa103){try{var _0x3de2f5=[];var _0x360390=getId(_0x2aa103['channel'],_0x2aa103['message']?_0x2aa103[_0xe967('0x15')]['id']:0x0,_0x2aa103[_0xe967('0x16')]?_0x2aa103[_0xe967('0x16')]['id']:0x0);if(_0x2aa103['applications']&&_[_0xe967('0x17')](_0x2aa103['applications'])&&_0x2aa103[_0xe967('0x18')]['length']){for(var _0x28794e=0x0;_0x28794e<_0x2aa103['applications'][_0xe967('0x19')];_0x28794e+=0x1){var _0x4d0397=_0x2aa103[_0xe967('0x18')][_0x28794e];if(fs[_0xe967('0x1a')](path[_0xe967('0x1b')](__dirname,'applications',_0x4d0397[_0xe967('0x1c')]+_0xe967('0x1d')))){var _0x4a2f61=[];switch(_0x4d0397[_0xe967('0x1c')][_0xe967('0x1e')]()){case'autoreply':var _0x364372=_0x4d0397[_0xe967('0x1f')][_0xe967('0x20')](',');_0x4a2f61['push'](_0x364372[0x0]);_0x4a2f61[_0xe967('0x21')](_0x364372[_0xe967('0x22')](0x1,_0x364372['length'])[_0xe967('0x1b')](','));break;case _0xe967('0x23'):var _0x1b731a=_0x4d0397[_0xe967('0x1f')]['split'](',');_0x4a2f61[_0xe967('0x21')](_0x1b731a[0x0]);_0x4a2f61['push'](_0x1b731a[0x1]);_0x4a2f61[_0xe967('0x21')](_0x1b731a[_0xe967('0x22')](0x2,_0x1b731a['length'])[_0xe967('0x1b')](','));break;case _0xe967('0x24'):var _0x355a9a=_0x4d0397['appdata']['split'](',');_0x4a2f61[_0xe967('0x21')](_0x355a9a[0x0]);_0x4a2f61['push'](_0x355a9a[0x1]);_0x4a2f61[_0xe967('0x21')](_0x355a9a[0x2]);_0x4a2f61['push'](_0x355a9a[0x3]);_0x4a2f61['push'](_0x355a9a[_0xe967('0x22')](0x4,_0x355a9a[_0xe967('0x19')])['join'](','));break;case _0xe967('0x15'):_0x4a2f61[_0xe967('0x21')](_0x4d0397['appdata']);break;case _0xe967('0x25'):_0x4a2f61[_0xe967('0x21')](_0x4d0397[_0xe967('0x26')]);_0x4a2f61[_0xe967('0x21')](_0x4d0397[_0xe967('0x1f')]);break;default:_0x4a2f61=_[_0xe967('0xf')](_0x4d0397['appdata'])?[]:_0x4d0397[_0xe967('0x1f')]['split'](',');}var _0x5bd323={'id':util[_0xe967('0xe')]('%s:%s:%s',_0x360390,_0x4d0397['id'],_0x4d0397['app']),'condition':require('./interval')[_0xe967('0x27')](_0x360390,getIntervals(_0x2ce751[_0xe967('0x28')],_0x4d0397),_0x2ce751),'consequence':require('./applications/'+_0x4d0397[_0xe967('0x1c')])[_0xe967('0x29')](_0x360390,_0x4a2f61,_0x2ce751,_0x2aa103),'p':_0x4d0397['priority']||0x0};logger[_0xe967('0x2a')](_0xe967('0x2b'),_0x5bd323['id'],_0xe967('0x2c'),getIntervals(_0x2ce751[_0xe967('0x28')],_0x4d0397)[_0xe967('0x1b')](_0xe967('0x2d')));_0x3de2f5['push'](_0x5bd323);}else{logger[_0xe967('0x2e')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xe967('0x1b')](__dirname,_0xe967('0x18'),_0x4d0397[_0xe967('0x1c')]+_0xe967('0x1d')));}}_0x2ce751[_0xe967('0x14')][_0x360390]=new RuleEngine(_0x3de2f5);_0x2ce751[_0xe967('0x14')][_0x360390][_0xe967('0x2f')](_0x2aa103,function(_0x4adc7d){logger['info'](_0xe967('0x30'),JSON[_0xe967('0x31')](_0x4adc7d['matchPath']));if(_0x2ce751['rules'][_0x360390]){_0x2ce751['rules'][_0x360390][_0xe967('0x32')](_0xe967('0x33'));}});return _0x1e6d72({'code':0xc8,'message':_0x2aa103});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x1e6d72({'code':0xc8,'message':_0x2aa103});}}catch(_0x55b467){logger[_0xe967('0x2e')](_0x55b467[_0xe967('0x34')]);return _0x161de0(_0x25e782[_0xe967('0x2e')](0x1f4,_0x55b467));}}return _0x161de0(_0xe967('0x35'));});},'AcceptMessage':function(_0x2d2e59){var _0x5cdd45=this;return new Promise(function(_0x5af32e,_0x4984d6){if(_0x2d2e59[_0xe967('0x15')]&&_0x2d2e59['message']['id']){try{var _0x38d034=getId(_0x2d2e59[_0xe967('0x36')],_0x2d2e59[_0xe967('0x15')]?_0x2d2e59['message']['id']:0x0,_0x2d2e59['interaction']?_0x2d2e59[_0xe967('0x16')]['id']:0x0);if(_0x2ce751[_0xe967('0x14')][_0x38d034]){_0x2ce751[_0xe967('0x14')][_0x38d034][_0xe967('0x32')](_0xe967('0x37'));if(rpc[_0x2d2e59[_0xe967('0x36')]+_0xe967('0x38')]){rpc[_0x2d2e59[_0xe967('0x36')]+_0xe967('0x38')][_0xe967('0x39')](_0x38d034,{'UserId':_0x2d2e59['message'][_0xe967('0x3a')]})[_0xe967('0x3b')](function(_0x45582e){logger[_0xe967('0x2e')](_0xe967('0x3c'));});}}return _0x5af32e({'code':0xc8,'message':_0x2d2e59});}catch(_0x37befa){logger[_0xe967('0x2e')](_0x37befa[_0xe967('0x34')]);return _0x4984d6(_0x5cdd45['error'](0x1f4,_0x37befa));}}logger[_0xe967('0x2e')](_0xe967('0x3d'));return _0x4984d6(_0x5cdd45[_0xe967('0x2e')](0x1f4,_0xe967('0x3d')));});},'RejectMessage':function(_0x111068){var _0x3efe77=this;return new Promise(function(_0x406df0,_0x4411b1){if(_0x111068[_0xe967('0x3e')]&&_0x111068[_0xe967('0x3e')]['id']){try{if(_0x2ce751[_0xe967('0x3f')][_0x111068['agent']['id']]){_0x2ce751[_0xe967('0x3f')][_0x111068[_0xe967('0x3e')]['id']][_0xe967('0x40')]=![];_0x2ce751[_0xe967('0x3f')][_0x111068[_0xe967('0x3e')]['id']][_0xe967('0x41')]=undefined;}return _0x406df0({'code':0xc8,'message':_0x111068});}catch(_0x53a027){logger[_0xe967('0x2e')](_0x53a027[_0xe967('0x34')]);return _0x4411b1(_0x3efe77['error'](0x1f4,_0x53a027));}}logger['error'](_0xe967('0x3d'));return _0x4411b1(_0x3efe77[_0xe967('0x2e')](0x1f4,_0xe967('0x3d')));});},'AbandonInteraction':function(_0x3d6c51){var _0x26fd38=this;return new Promise(function(_0xc18ae5,_0x46748a){if(_0x3d6c51[_0xe967('0x36')]&&_0x3d6c51[_0xe967('0x16')]&&_0x3d6c51[_0xe967('0x16')]['id']){try{var _0x19cb4d=getId(_0x3d6c51[_0xe967('0x36')],_0x3d6c51[_0xe967('0x15')]?_0x3d6c51[_0xe967('0x15')]['id']:0x0,_0x3d6c51['interaction']?_0x3d6c51['interaction']['id']:0x0);if(_0x2ce751[_0xe967('0x14')][_0x19cb4d]){_0x2ce751[_0xe967('0x14')][_0x19cb4d][_0xe967('0x32')](_0xe967('0x37'));}return _0xc18ae5({'code':0xc8,'message':_0x3d6c51});}catch(_0x5146de){logger[_0xe967('0x2e')](_0x5146de[_0xe967('0x34')]);return _0x46748a(_0x26fd38['error'](0x1f4,_0x5146de));}}logger[_0xe967('0x2e')]('message\x20is\x20empty');return _0x46748a(_0x26fd38[_0xe967('0x2e')](0x1f4,_0xe967('0x3d')));});},'AgentCapacity':function(_0x436d08){var _0x9da275=this;return new Promise(function(_0x17873a,_0x38c504){if(_0x2ce751[_0xe967('0x3f')][_0xe967('0x42')](_0x436d08['id'])){for(var _0x4d9477 in _0x436d08[_0xe967('0x43')]){if(_0x436d08[_0xe967('0x43')][_0xe967('0x42')](_0x4d9477)){if(_0x2ce751['agents'][_0x436d08['id']][_0xe967('0x42')](_0x4d9477+'CurrentCapacity')){_0x2ce751[_0xe967('0x3f')][_0x436d08['id']][_0x4d9477+_0xe967('0x44')]=parseInt(_0x436d08[_0xe967('0x43')][_0x4d9477],0xa);}}}_0x2ce751[_0xe967('0x3f')][_0x436d08['id']][_0xe967('0x45')]();return _0x17873a({'code':0xc8,'message':_0x2ce751[_0xe967('0x3f')][_0x436d08['id']]});}else{return _0x38c504(_0x9da275[_0xe967('0x2e')](0x1f4,_0xe967('0x46')));}});},'Agents':function(_0xe82ff0){return new Promise(function(_0x4d69bf,_0x58a52c){var _0x215a14=_[_0xe967('0x47')](_0x2ce751['agents']);_0x4d69bf({'count':_0x215a14['length'],'rows':_0x215a14});});},'ChatQueues':function(_0x7ad37d){return new Promise(function(_0x29ae2c,_0x1bbb9a){var _0x86cfac=[];for(var _0x237e0f in _0x2ce751['chatQueues']){if(_0x2ce751[_0xe967('0x48')][_0xe967('0x42')](_0x237e0f)){var _0x4c0455=_0x2ce751['chatQueues'][_0x237e0f];var _0x207716={'id':_0x4c0455['id'],'available':_0x4c0455[_0xe967('0x49')],'loggedIn':_0x4c0455[_0xe967('0x4a')],'name':_0x4c0455[_0xe967('0x4b')],'paused':_0x4c0455['paused'],'waiting':_0x4c0455['waiting']};_0x86cfac[_0xe967('0x21')](_0x207716);}}_0x29ae2c({'count':_0x86cfac[_0xe967('0x19')],'rows':_0x86cfac});});},'MailQueues':function(_0x5c0897){return new Promise(function(_0x2dcf6c,_0x26ba77){var _0x59ca6f=[];for(var _0x485419 in _0x2ce751[_0xe967('0x4c')]){if(_0x2ce751[_0xe967('0x4c')][_0xe967('0x42')](_0x485419)){var _0x3d4347=_0x2ce751[_0xe967('0x4c')][_0x485419];var _0x32d339={'id':_0x3d4347['id'],'available':_0x3d4347[_0xe967('0x49')],'loggedIn':_0x3d4347[_0xe967('0x4a')],'name':_0x3d4347[_0xe967('0x4b')],'paused':_0x3d4347[_0xe967('0x4d')],'waiting':_0x3d4347[_0xe967('0x4e')]};_0x59ca6f[_0xe967('0x21')](_0x32d339);}}_0x2dcf6c({'count':_0x59ca6f[_0xe967('0x19')],'rows':_0x59ca6f});});},'OpenchannelQueues':function(_0x4df208){return new Promise(function(_0x133ea8,_0x110761){var _0x566fb5=[];for(var _0xe2fc75 in _0x2ce751['openchannelQueues']){if(_0x2ce751['openchannelQueues'][_0xe967('0x42')](_0xe2fc75)){var _0x105f89=_0x2ce751[_0xe967('0x4f')][_0xe2fc75];var _0x31879a={'id':_0x105f89['id'],'available':_0x105f89[_0xe967('0x49')],'loggedIn':_0x105f89[_0xe967('0x4a')],'name':_0x105f89[_0xe967('0x4b')],'paused':_0x105f89['paused'],'waiting':_0x105f89['waiting']};_0x566fb5[_0xe967('0x21')](_0x31879a);}}_0x133ea8({'count':_0x566fb5[_0xe967('0x19')],'rows':_0x566fb5});});},'SmsQueues':function(_0x207473){return new Promise(function(_0x5abb1f,_0x3199b2){var _0x328b6b=[];for(var _0x2efcec in _0x2ce751[_0xe967('0x50')]){if(_0x2ce751[_0xe967('0x50')][_0xe967('0x42')](_0x2efcec)){var _0x1f555d=_0x2ce751[_0xe967('0x50')][_0x2efcec];var _0x4ea54f={'id':_0x1f555d['id'],'available':_0x1f555d[_0xe967('0x49')],'loggedIn':_0x1f555d['loggedIn'],'name':_0x1f555d[_0xe967('0x4b')],'paused':_0x1f555d[_0xe967('0x4d')],'waiting':_0x1f555d['waiting']};_0x328b6b[_0xe967('0x21')](_0x4ea54f);}}_0x5abb1f({'count':_0x328b6b[_0xe967('0x19')],'rows':_0x328b6b});});},'FaxQueues':function(_0x6a8be8){return new Promise(function(_0x253fce,_0x11cad8){var _0x73614e=[];for(var _0xd669dc in _0x2ce751[_0xe967('0x51')]){if(_0x2ce751['faxQueues'][_0xe967('0x42')](_0xd669dc)){var _0x50f775=_0x2ce751['faxQueues'][_0xd669dc];var _0x54af72={'id':_0x50f775['id'],'available':_0x50f775[_0xe967('0x49')],'loggedIn':_0x50f775['loggedIn'],'name':_0x50f775[_0xe967('0x4b')],'paused':_0x50f775['paused'],'waiting':_0x50f775[_0xe967('0x4e')]};_0x73614e[_0xe967('0x21')](_0x54af72);}}_0x253fce({'count':_0x73614e[_0xe967('0x19')],'rows':_0x73614e});});},'WhatsappQueues':function(_0x1d82ae){return new Promise(function(_0x4ea797,_0x132846){var _0x5b2cc7=[];for(var _0x7cca96 in _0x2ce751[_0xe967('0x52')]){if(_0x2ce751[_0xe967('0x52')][_0xe967('0x42')](_0x7cca96)){var _0x5f36e7=_0x2ce751[_0xe967('0x52')][_0x7cca96];var _0x3b98dc={'id':_0x5f36e7['id'],'available':_0x5f36e7[_0xe967('0x49')],'loggedIn':_0x5f36e7['loggedIn'],'name':_0x5f36e7[_0xe967('0x4b')],'paused':_0x5f36e7[_0xe967('0x4d')],'waiting':_0x5f36e7[_0xe967('0x4e')]};_0x5b2cc7[_0xe967('0x21')](_0x3b98dc);}}_0x4ea797({'count':_0x5b2cc7[_0xe967('0x19')],'rows':_0x5b2cc7});});},'ChatQueuesWaitingInteractions':function(_0x2f5488){return new Promise(function(_0x1a3ce7,_0x262107){var _0x4283a0=_['values'](_0x2ce751[_0xe967('0x53')]);_0x1a3ce7({'count':_0x4283a0[_0xe967('0x19')],'rows':_0x4283a0});});},'MailQueuesWaitingInteractions':function(_0x2eee7e){return new Promise(function(_0x53438a,_0x3ad807){var _0x32a00e=_['values'](_0x2ce751[_0xe967('0x54')]);_0x53438a({'count':_0x32a00e[_0xe967('0x19')],'rows':_0x32a00e});});},'OpenchannelQueuesWaitingInteractions':function(_0x4481d){return new Promise(function(_0x30cdcc,_0x26c1a2){var _0xaaec=_[_0xe967('0x47')](_0x2ce751[_0xe967('0x55')]);_0x30cdcc({'count':_0xaaec[_0xe967('0x19')],'rows':_0xaaec});});},'SmsQueuesWaitingInteractions':function(_0x2b6c81){return new Promise(function(_0xd49e00,_0x5f2ba1){var _0x4b92a6=_[_0xe967('0x47')](_0x2ce751[_0xe967('0x56')]);_0xd49e00({'count':_0x4b92a6['length'],'rows':_0x4b92a6});});},'FaxQueuesWaitingInteractions':function(_0x5f54d1){return new Promise(function(_0xb6c05c,_0x44b782){var _0x299edc=_[_0xe967('0x47')](_0x2ce751[_0xe967('0x57')]);_0xb6c05c({'count':_0x299edc['length'],'rows':_0x299edc});});},'WhatsappQueuesWaitingInteractions':function(_0x28ad5b){return new Promise(function(_0x1d64c1,_0x211580){var _0x205700=_[_0xe967('0x47')](_0x2ce751['whatsappQueuesWaitingInteractions']);_0x1d64c1({'count':_0x205700[_0xe967('0x19')],'rows':_0x205700});});}};var _0x19d8b8=jayson[_0xe967('0x58')](_0x4865f2)['http']();_0x19d8b8['on'](_0xe967('0x2e'),function(_0x560169){logger[_0xe967('0x2e')](JSON[_0xe967('0x31')](_0x560169));return _0x68db73(_0x560169);});_0x19d8b8[_0xe967('0x59')](0x232c,_0xe967('0x5a'),function(){console['log'](_0xe967('0x5b'),0x232c);return _0x21667c('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x6796=['push','slice','amazonlex','tag','TagId','%s:%s:%s','app','./interval','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','end','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','emit','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','loggedIn','mailQueues','available','name','paused','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','uuid','../../../config/environment','../../../config/logger','routing','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','toLowerCase','autoreply','appdata','split'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6796,0x1b2));var _0x6679=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x6796[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x6679('0x0'));var util=require(_0x6679('0x1'));var path=require(_0x6679('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x6679('0x3'));var config=require(_0x6679('0x4'));var logger=require(_0x6679('0x5'))(_0x6679('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x6679('0x7')),'faxQueueReport':require(_0x6679('0x8')),'whatsappQueueReport':require(_0x6679('0x9'))};var RuleEngine=require(_0x6679('0xa'));function getId(_0x16ffb3,_0x4d5089,_0x179a0e){return util[_0x6679('0xb')]('%s.%s.%s',_0x16ffb3,_0x4d5089||0x0,_0x179a0e||0x0);}function getIntervals(_0x1ca91d,_0x999760){var _0x1f871c=[];if(!_[_0x6679('0xc')](_0x999760[_0x6679('0xd')])&&!_[_0x6679('0xc')](_0x1ca91d[_0x999760[_0x6679('0xd')]])&&!_[_0x6679('0xc')](_0x1ca91d[_0x999760[_0x6679('0xd')]][_0x6679('0xe')])){_0x1f871c=_[_0x6679('0xf')](_0x1ca91d[_0x999760[_0x6679('0xd')]][_0x6679('0xe')],_0x6679('0x10'));}else if(!_['isNil'](_0x999760[_0x6679('0x10')])){_0x1f871c=[_0x999760[_0x6679('0x10')]];}return _0x1f871c;}exports[_0x6679('0x11')]=function(_0x2e6418){_0x2e6418[_0x6679('0x12')]={};return new BPromise(function(_0x3eb3ae,_0x12ffe2){var _0x53f55e={'Start':function(_0x2b9073){var _0x5ab106=this;return new Promise(function(_0x1953fa,_0x557cf7){if(_0x2b9073){try{var _0x33f2e8=[];var _0x3155ba=getId(_0x2b9073[_0x6679('0x13')],_0x2b9073[_0x6679('0x14')]?_0x2b9073[_0x6679('0x14')]['id']:0x0,_0x2b9073[_0x6679('0x15')]?_0x2b9073[_0x6679('0x15')]['id']:0x0);if(_0x2b9073['applications']&&_[_0x6679('0x16')](_0x2b9073[_0x6679('0x17')])&&_0x2b9073[_0x6679('0x17')]['length']){for(var _0x3b5c89=0x0;_0x3b5c89<_0x2b9073[_0x6679('0x17')][_0x6679('0x18')];_0x3b5c89+=0x1){var _0x5748a0=_0x2b9073['applications'][_0x3b5c89];if(fs[_0x6679('0x19')](path[_0x6679('0x1a')](__dirname,_0x6679('0x17'),_0x5748a0['app']+'.js'))){var _0x28cb5e=[];switch(_0x5748a0['app'][_0x6679('0x1b')]()){case _0x6679('0x1c'):var _0x581f13=_0x5748a0[_0x6679('0x1d')][_0x6679('0x1e')](',');_0x28cb5e[_0x6679('0x1f')](_0x581f13[0x0]);_0x28cb5e[_0x6679('0x1f')](_0x581f13[_0x6679('0x20')](0x1,_0x581f13['length'])['join'](','));break;case'dialogflow':var _0x164510=_0x5748a0[_0x6679('0x1d')][_0x6679('0x1e')](',');_0x28cb5e[_0x6679('0x1f')](_0x164510[0x0]);_0x28cb5e[_0x6679('0x1f')](_0x164510[0x1]);_0x28cb5e['push'](_0x164510[_0x6679('0x20')](0x2,_0x164510[_0x6679('0x18')])[_0x6679('0x1a')](','));break;case _0x6679('0x21'):var _0x2aa575=_0x5748a0[_0x6679('0x1d')]['split'](',');_0x28cb5e['push'](_0x2aa575[0x0]);_0x28cb5e[_0x6679('0x1f')](_0x2aa575[0x1]);_0x28cb5e[_0x6679('0x1f')](_0x2aa575[0x2]);_0x28cb5e['push'](_0x2aa575[0x3]);_0x28cb5e[_0x6679('0x1f')](_0x2aa575[_0x6679('0x20')](0x4,_0x2aa575[_0x6679('0x18')])[_0x6679('0x1a')](','));break;case _0x6679('0x14'):_0x28cb5e[_0x6679('0x1f')](_0x5748a0['appdata']);break;case _0x6679('0x22'):_0x28cb5e[_0x6679('0x1f')](_0x5748a0[_0x6679('0x23')]);_0x28cb5e['push'](_0x5748a0[_0x6679('0x1d')]);break;default:_0x28cb5e=_[_0x6679('0xc')](_0x5748a0[_0x6679('0x1d')])?[]:_0x5748a0[_0x6679('0x1d')][_0x6679('0x1e')](',');}var _0x8ddcaa={'id':util[_0x6679('0xb')](_0x6679('0x24'),_0x3155ba,_0x5748a0['id'],_0x5748a0[_0x6679('0x25')]),'condition':require(_0x6679('0x26'))['condition'](_0x3155ba,getIntervals(_0x2e6418[_0x6679('0x27')],_0x5748a0),_0x2e6418),'consequence':require(_0x6679('0x28')+_0x5748a0[_0x6679('0x25')])[_0x6679('0x29')](_0x3155ba,_0x28cb5e,_0x2e6418,_0x2b9073),'p':_0x5748a0['priority']||0x0};logger[_0x6679('0x2a')](_0x6679('0x2b'),_0x8ddcaa['id'],_0x6679('0x2c'),getIntervals(_0x2e6418[_0x6679('0x27')],_0x5748a0)['join'](_0x6679('0x2d')));_0x33f2e8[_0x6679('0x1f')](_0x8ddcaa);}else{logger[_0x6679('0x2e')](_0x6679('0x2f'),path['join'](__dirname,'applications',_0x5748a0[_0x6679('0x25')]+_0x6679('0x30')));}}_0x2e6418[_0x6679('0x12')][_0x3155ba]=new RuleEngine(_0x33f2e8);_0x2e6418[_0x6679('0x12')][_0x3155ba][_0x6679('0x31')](_0x2b9073,function(_0x3d6b62){logger['info'](_0x6679('0x32'),JSON[_0x6679('0x33')](_0x3d6b62[_0x6679('0x34')]));if(_0x2e6418['rules'][_0x3155ba]){_0x2e6418['rules'][_0x3155ba]['emit'](_0x6679('0x35'));}});return _0x1953fa({'code':0xc8,'message':_0x2b9073});}else{logger[_0x6679('0x2a')](_0x6679('0x36'));return _0x1953fa({'code':0xc8,'message':_0x2b9073});}}catch(_0xb41a0f){logger[_0x6679('0x2e')](_0xb41a0f[_0x6679('0x37')]);return _0x557cf7(_0x5ab106['error'](0x1f4,_0xb41a0f));}}return _0x557cf7(_0x6679('0x38'));});},'AcceptMessage':function(_0x2a8fe8){var _0x4a5b44=this;return new Promise(function(_0x3e7af4,_0x47781c){if(_0x2a8fe8[_0x6679('0x14')]&&_0x2a8fe8[_0x6679('0x14')]['id']){try{var _0x585c1c=getId(_0x2a8fe8[_0x6679('0x13')],_0x2a8fe8[_0x6679('0x14')]?_0x2a8fe8[_0x6679('0x14')]['id']:0x0,_0x2a8fe8[_0x6679('0x15')]?_0x2a8fe8[_0x6679('0x15')]['id']:0x0);if(_0x2e6418['rules'][_0x585c1c]){_0x2e6418['rules'][_0x585c1c]['emit'](_0x6679('0x39'));if(rpc[_0x2a8fe8['channel']+_0x6679('0x3a')]){rpc[_0x2a8fe8['channel']+_0x6679('0x3a')]['update'](_0x585c1c,{'UserId':_0x2a8fe8['message'][_0x6679('0x3b')]})['catch'](function(_0x53a823){logger[_0x6679('0x2e')](_0x6679('0x3c'));});}}return _0x3e7af4({'code':0xc8,'message':_0x2a8fe8});}catch(_0x574490){logger[_0x6679('0x2e')](_0x574490[_0x6679('0x37')]);return _0x47781c(_0x4a5b44['error'](0x1f4,_0x574490));}}logger[_0x6679('0x2e')](_0x6679('0x3d'));return _0x47781c(_0x4a5b44[_0x6679('0x2e')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5aaad2){var _0x1b5041=this;return new Promise(function(_0x3b89ff,_0x172257){if(_0x5aaad2[_0x6679('0x3e')]&&_0x5aaad2[_0x6679('0x3e')]['id']){try{if(_0x2e6418['agents'][_0x5aaad2[_0x6679('0x3e')]['id']]){_0x2e6418[_0x6679('0x3f')][_0x5aaad2[_0x6679('0x3e')]['id']][_0x6679('0x40')]=![];_0x2e6418[_0x6679('0x3f')][_0x5aaad2[_0x6679('0x3e')]['id']]['busyQueue']=undefined;}return _0x3b89ff({'code':0xc8,'message':_0x5aaad2});}catch(_0x475a63){logger[_0x6679('0x2e')](_0x475a63[_0x6679('0x37')]);return _0x172257(_0x1b5041[_0x6679('0x2e')](0x1f4,_0x475a63));}}logger[_0x6679('0x2e')](_0x6679('0x3d'));return _0x172257(_0x1b5041['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x248cfe){var _0x5d28ce=this;return new Promise(function(_0x5d0269,_0x1bb71a){if(_0x248cfe['channel']&&_0x248cfe[_0x6679('0x15')]&&_0x248cfe['interaction']['id']){try{var _0x1b2b65=getId(_0x248cfe[_0x6679('0x13')],_0x248cfe[_0x6679('0x14')]?_0x248cfe[_0x6679('0x14')]['id']:0x0,_0x248cfe['interaction']?_0x248cfe[_0x6679('0x15')]['id']:0x0);if(_0x2e6418[_0x6679('0x12')][_0x1b2b65]){_0x2e6418[_0x6679('0x12')][_0x1b2b65][_0x6679('0x41')]('end');}return _0x5d0269({'code':0xc8,'message':_0x248cfe});}catch(_0x41dd00){logger[_0x6679('0x2e')](_0x41dd00['stack']);return _0x1bb71a(_0x5d28ce[_0x6679('0x2e')](0x1f4,_0x41dd00));}}logger[_0x6679('0x2e')](_0x6679('0x3d'));return _0x1bb71a(_0x5d28ce[_0x6679('0x2e')](0x1f4,_0x6679('0x3d')));});},'AgentCapacity':function(_0x116279){var _0x8473fd=this;return new Promise(function(_0x3aed27,_0x2d7eba){if(_0x2e6418['agents'][_0x6679('0x42')](_0x116279['id'])){for(var _0x6daeca in _0x116279['capacity']){if(_0x116279[_0x6679('0x43')]['hasOwnProperty'](_0x6daeca)){if(_0x2e6418['agents'][_0x116279['id']][_0x6679('0x42')](_0x6daeca+'CurrentCapacity')){_0x2e6418[_0x6679('0x3f')][_0x116279['id']][_0x6daeca+_0x6679('0x44')]=parseInt(_0x116279[_0x6679('0x43')][_0x6daeca],0xa);}}}_0x2e6418[_0x6679('0x3f')][_0x116279['id']]['updateRealtime']();return _0x3aed27({'code':0xc8,'message':_0x2e6418[_0x6679('0x3f')][_0x116279['id']]});}else{return _0x2d7eba(_0x8473fd[_0x6679('0x2e')](0x1f4,_0x6679('0x45')));}});},'Agents':function(_0x446755){return new Promise(function(_0x124ac8,_0x231802){var _0x9e4c1=_['values'](_0x2e6418[_0x6679('0x3f')]);_0x124ac8({'count':_0x9e4c1[_0x6679('0x18')],'rows':_0x9e4c1});});},'ChatQueues':function(_0x34665e){return new Promise(function(_0x36790d,_0x107d21){var _0xe9aebd=[];for(var _0xc09487 in _0x2e6418[_0x6679('0x46')]){if(_0x2e6418[_0x6679('0x46')]['hasOwnProperty'](_0xc09487)){var _0x38e1f9=_0x2e6418[_0x6679('0x46')][_0xc09487];var _0x2071d6={'id':_0x38e1f9['id'],'available':_0x38e1f9['available'],'loggedIn':_0x38e1f9[_0x6679('0x47')],'name':_0x38e1f9['name'],'paused':_0x38e1f9['paused'],'waiting':_0x38e1f9['waiting']};_0xe9aebd[_0x6679('0x1f')](_0x2071d6);}}_0x36790d({'count':_0xe9aebd['length'],'rows':_0xe9aebd});});},'MailQueues':function(_0xebc754){return new Promise(function(_0x1b20e3,_0x2f1c7f){var _0x35066d=[];for(var _0x353f1a in _0x2e6418[_0x6679('0x48')]){if(_0x2e6418[_0x6679('0x48')][_0x6679('0x42')](_0x353f1a)){var _0x10c8da=_0x2e6418[_0x6679('0x48')][_0x353f1a];var _0x3e9fea={'id':_0x10c8da['id'],'available':_0x10c8da[_0x6679('0x49')],'loggedIn':_0x10c8da[_0x6679('0x47')],'name':_0x10c8da[_0x6679('0x4a')],'paused':_0x10c8da[_0x6679('0x4b')],'waiting':_0x10c8da['waiting']};_0x35066d[_0x6679('0x1f')](_0x3e9fea);}}_0x1b20e3({'count':_0x35066d['length'],'rows':_0x35066d});});},'OpenchannelQueues':function(_0x2f455c){return new Promise(function(_0x4f9960,_0x3be7c1){var _0xda43e2=[];for(var _0x40d4bc in _0x2e6418[_0x6679('0x4c')]){if(_0x2e6418[_0x6679('0x4c')][_0x6679('0x42')](_0x40d4bc)){var _0x49d0f5=_0x2e6418[_0x6679('0x4c')][_0x40d4bc];var _0xcfe0fc={'id':_0x49d0f5['id'],'available':_0x49d0f5['available'],'loggedIn':_0x49d0f5[_0x6679('0x47')],'name':_0x49d0f5[_0x6679('0x4a')],'paused':_0x49d0f5[_0x6679('0x4b')],'waiting':_0x49d0f5[_0x6679('0x4d')]};_0xda43e2[_0x6679('0x1f')](_0xcfe0fc);}}_0x4f9960({'count':_0xda43e2[_0x6679('0x18')],'rows':_0xda43e2});});},'SmsQueues':function(_0x4bffba){return new Promise(function(_0x1c439f,_0x322762){var _0x443091=[];for(var _0x10354b in _0x2e6418['smsQueues']){if(_0x2e6418['smsQueues'][_0x6679('0x42')](_0x10354b)){var _0x344d71=_0x2e6418[_0x6679('0x4e')][_0x10354b];var _0x327df3={'id':_0x344d71['id'],'available':_0x344d71[_0x6679('0x49')],'loggedIn':_0x344d71[_0x6679('0x47')],'name':_0x344d71[_0x6679('0x4a')],'paused':_0x344d71[_0x6679('0x4b')],'waiting':_0x344d71['waiting']};_0x443091[_0x6679('0x1f')](_0x327df3);}}_0x1c439f({'count':_0x443091[_0x6679('0x18')],'rows':_0x443091});});},'FaxQueues':function(_0x1fa6da){return new Promise(function(_0xd83280,_0x11ce9a){var _0x3bdb75=[];for(var _0x555325 in _0x2e6418[_0x6679('0x4f')]){if(_0x2e6418[_0x6679('0x4f')][_0x6679('0x42')](_0x555325)){var _0x3034b1=_0x2e6418[_0x6679('0x4f')][_0x555325];var _0x188566={'id':_0x3034b1['id'],'available':_0x3034b1[_0x6679('0x49')],'loggedIn':_0x3034b1[_0x6679('0x47')],'name':_0x3034b1[_0x6679('0x4a')],'paused':_0x3034b1[_0x6679('0x4b')],'waiting':_0x3034b1[_0x6679('0x4d')]};_0x3bdb75[_0x6679('0x1f')](_0x188566);}}_0xd83280({'count':_0x3bdb75[_0x6679('0x18')],'rows':_0x3bdb75});});},'WhatsappQueues':function(_0x39f4e0){return new Promise(function(_0x36aced,_0x25602c){var _0x103753=[];for(var _0x57f4ec in _0x2e6418['whatsappQueues']){if(_0x2e6418[_0x6679('0x50')]['hasOwnProperty'](_0x57f4ec)){var _0x379ded=_0x2e6418[_0x6679('0x50')][_0x57f4ec];var _0x5e97e7={'id':_0x379ded['id'],'available':_0x379ded['available'],'loggedIn':_0x379ded[_0x6679('0x47')],'name':_0x379ded[_0x6679('0x4a')],'paused':_0x379ded['paused'],'waiting':_0x379ded['waiting']};_0x103753['push'](_0x5e97e7);}}_0x36aced({'count':_0x103753[_0x6679('0x18')],'rows':_0x103753});});},'ChatQueuesWaitingInteractions':function(_0x108fb5){return new Promise(function(_0x31b4f4,_0x474bc3){var _0x49422b=_['values'](_0x2e6418[_0x6679('0x51')]);_0x31b4f4({'count':_0x49422b[_0x6679('0x18')],'rows':_0x49422b});});},'MailQueuesWaitingInteractions':function(_0xfec767){return new Promise(function(_0x52b5f6,_0xe39d7c){var _0xf7f888=_[_0x6679('0x52')](_0x2e6418[_0x6679('0x53')]);_0x52b5f6({'count':_0xf7f888[_0x6679('0x18')],'rows':_0xf7f888});});},'OpenchannelQueuesWaitingInteractions':function(_0x30a9bb){return new Promise(function(_0x11dd9f,_0x53e83c){var _0x5bfbce=_['values'](_0x2e6418[_0x6679('0x54')]);_0x11dd9f({'count':_0x5bfbce[_0x6679('0x18')],'rows':_0x5bfbce});});},'SmsQueuesWaitingInteractions':function(_0x184d65){return new Promise(function(_0xb7c9d9,_0x1fdb7b){var _0x2a1315=_[_0x6679('0x52')](_0x2e6418[_0x6679('0x55')]);_0xb7c9d9({'count':_0x2a1315[_0x6679('0x18')],'rows':_0x2a1315});});},'FaxQueuesWaitingInteractions':function(_0x4e9550){return new Promise(function(_0x2d9f37,_0xcb3e91){var _0xd54023=_[_0x6679('0x52')](_0x2e6418[_0x6679('0x56')]);_0x2d9f37({'count':_0xd54023[_0x6679('0x18')],'rows':_0xd54023});});},'WhatsappQueuesWaitingInteractions':function(_0x4755c7){return new Promise(function(_0x2be97c,_0x2f1748){var _0x4826fb=_[_0x6679('0x52')](_0x2e6418['whatsappQueuesWaitingInteractions']);_0x2be97c({'count':_0x4826fb[_0x6679('0x18')],'rows':_0x4826fb});});}};var _0x550027=jayson[_0x6679('0x57')](_0x53f55e)[_0x6679('0x58')]();_0x550027['on'](_0x6679('0x2e'),function(_0x4d4941){logger['error'](JSON['stringify'](_0x4d4941));return _0x12ffe2(_0x4d4941);});_0x550027[_0x6679('0x11')](0x232c,_0x6679('0x59'),function(){console[_0x6679('0x5a')](_0x6679('0x5b'),0x232c);return _0x3eb3ae(_0x6679('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8d5fb9c..26741ac 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 _0xa162=['\x20|\x20','log','util','bluebird','jayson/promise','routing','client','http','request','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','then','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x2dd82f,_0xd7595f){var _0x311f96=function(_0x30cc2d){while(--_0x30cc2d){_0x2dd82f['push'](_0x2dd82f['shift']());}};_0x311f96(++_0xd7595f);}(_0xa162,0x11a));var _0x2a16=function(_0x1362de,_0x3640a2){_0x1362de=_0x1362de-0x0;var _0x450930=_0xa162[_0x1362de];return _0x450930;};'use strict';var util=require(_0x2a16('0x0'));var BPromise=require(_0x2a16('0x1'));var jayson=require(_0x2a16('0x2'));var _=require('lodash');var logger=require('../../../config/logger')(_0x2a16('0x3'));var client=jayson[_0x2a16('0x4')][_0x2a16('0x5')]({'port':0x232a});function request(_0x32982a,_0x37ad4c){return new BPromise(function(_0x5d5a21,_0x4865ea){return client[_0x2a16('0x6')](_0x32982a,_0x37ad4c)['then'](function(_0x512a05){if(_0x512a05['error']){return _0x4865ea(_0x512a05[_0x2a16('0x7')][_0x2a16('0x8')]);}else{return _0x5d5a21(_0x512a05[_0x2a16('0x9')]);}})[_0x2a16('0xa')](function(_0x4d24f2){return _0x4865ea(_0x4d24f2);});});}exports[_0x2a16('0xb')]=function(_0x146531,_0x1848d7,_0x174d35){return function(_0x1880cf){if(_0x174d35[_0x2a16('0xc')]&&!_0x174d35[_0x2a16('0xc')][_0x146531]){logger[_0x2a16('0xd')](_0x2a16('0xe'),_0x146531);return _0x1880cf[_0x2a16('0xf')]();}var _0x42f265=[];for(var _0xa23d5c=0x0;_0xa23d5c<_0x1848d7[_0x2a16('0x10')];_0xa23d5c+=0x1){_0x42f265[_0x2a16('0x11')](request(_0x2a16('0x12'),{'command':util[_0x2a16('0x13')]('iftime\x20%s',_0x1848d7[_0xa23d5c])})[_0x2a16('0x14')](function(_0x124c7a){return _0x124c7a&&_0x124c7a['message']&&_0x124c7a[_0x2a16('0x8')]['indexOf'](_0x2a16('0x15'))>=0x0?!![]:![];})[_0x2a16('0xa')](function(_0x34b415){logger['error'](_0x2a16('0x16'),_0x146531,_0x1848d7[_0xa23d5c]);}));}BPromise[_0x2a16('0x17')](_0x42f265)[_0x2a16('0x14')](function(_0x7b2b2b){var _0x5982cd=_['some'](_0x7b2b2b);logger[_0x2a16('0xd')](_0x2a16('0x18'),_0x146531,_0x1848d7[_0x2a16('0x19')](_0x2a16('0x1a')),_0x5982cd);_0x1880cf['when'](_0x5982cd);})[_0x2a16('0xa')](function(_0x399030){console[_0x2a16('0x1b')](_0x399030);logger[_0x2a16('0x7')](_0x2a16('0x18'),_0x146531,_0x1848d7[_0x2a16('0x19')]('\x20|\x20'),_0x399030['stack']);_0x1880cf[_0x2a16('0xf')]();});};}; \ No newline at end of file +var _0x236f=['jayson/promise','lodash','../../../config/logger','routing','client','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','then','some','when','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util'];(function(_0x4c0e1f,_0x4734ec){var _0x3a0b24=function(_0x23d1c9){while(--_0x23d1c9){_0x4c0e1f['push'](_0x4c0e1f['shift']());}};_0x3a0b24(++_0x4734ec);}(_0x236f,0x187));var _0xf236=function(_0x4a109d,_0x157359){_0x4a109d=_0x4a109d-0x0;var _0xd190b2=_0x236f[_0x4a109d];return _0xd190b2;};'use strict';var util=require(_0xf236('0x0'));var BPromise=require('bluebird');var jayson=require(_0xf236('0x1'));var _=require(_0xf236('0x2'));var logger=require(_0xf236('0x3'))(_0xf236('0x4'));var client=jayson[_0xf236('0x5')]['http']({'port':0x232a});function request(_0x5700c6,_0x445da7){return new BPromise(function(_0x59f47d,_0x59ba5b){return client['request'](_0x5700c6,_0x445da7)['then'](function(_0x23f16c){if(_0x23f16c[_0xf236('0x6')]){return _0x59ba5b(_0x23f16c[_0xf236('0x6')][_0xf236('0x7')]);}else{return _0x59f47d(_0x23f16c['result']);}})[_0xf236('0x8')](function(_0x37bb03){return _0x59ba5b(_0x37bb03);});});}exports[_0xf236('0x9')]=function(_0x134c93,_0x1df908,_0x32ea11){return function(_0x2b7ac5){if(_0x32ea11[_0xf236('0xa')]&&!_0x32ea11[_0xf236('0xa')][_0x134c93]){logger[_0xf236('0xb')](_0xf236('0xc'),_0x134c93);return _0x2b7ac5[_0xf236('0xd')]();}var _0x3bb5a7=[];for(var _0x337e4b=0x0;_0x337e4b<_0x1df908['length'];_0x337e4b+=0x1){_0x3bb5a7['push'](request(_0xf236('0xe'),{'command':util[_0xf236('0xf')](_0xf236('0x10'),_0x1df908[_0x337e4b])})['then'](function(_0x38f4db){return _0x38f4db&&_0x38f4db[_0xf236('0x7')]&&_0x38f4db[_0xf236('0x7')][_0xf236('0x11')](_0xf236('0x12'))>=0x0?!![]:![];})['catch'](function(_0x3b7252){logger[_0xf236('0x6')](_0xf236('0x13'),_0x134c93,_0x1df908[_0x337e4b]);}));}BPromise[_0xf236('0x14')](_0x3bb5a7)[_0xf236('0x15')](function(_0x9aef5c){var _0x43a43e=_[_0xf236('0x16')](_0x9aef5c);logger[_0xf236('0xb')]('[%s][INTERVAL]\x20%s\x20%s',_0x134c93,_0x1df908['join']('\x20|\x20'),_0x43a43e);_0x2b7ac5[_0xf236('0x17')](_0x43a43e);})[_0xf236('0x8')](function(_0x199b68){console['log'](_0x199b68);logger[_0xf236('0x6')](_0xf236('0x18'),_0x134c93,_0x1df908[_0xf236('0x19')](_0xf236('0x1a')),_0x199b68[_0xf236('0x1b')]);_0x2b7ac5['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4db7517..8c9ccde 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 _0xa329=['agentringnoanswer','isNil','now','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','forIn','includes','agentringnoanswerAt','lastevent','abandoned','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcomplete','agentcompleteAt','diffTime','complete','transfereruniqueid','transfer','transfertype','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','splice','agent','lodash','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','membername','calleridnum','connectedlinenum','getVoiceQueueByName','queue','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','called','connectedlinename','stack'];(function(_0xe2e7f9,_0x3a4e86){var _0x4dc270=function(_0xdf0510){while(--_0xdf0510){_0xe2e7f9['push'](_0xe2e7f9['shift']());}};_0x4dc270(++_0x3a4e86);}(_0xa329,0x10e));var _0x9a32=function(_0xcafa4b,_0x572040){_0xcafa4b=_0xcafa4b-0x0;var _0x4e3260=_0xa329[_0xcafa4b];return _0x4e3260;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var utils=require(_0x9a32('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x445587,_0x8290f3){utils[_0x9a32('0x3')](util[_0x9a32('0x4')](_0x9a32('0x5'),_0x445587[_0x9a32('0x6')],_0x445587[_0x9a32('0x7')],_0x445587['queue'],_0x445587[_0x9a32('0x8')],_0x445587['interface'],_0x445587[_0x9a32('0x9')],_0x445587[_0x9a32('0xa')],_0x445587['lastevent']));if(_0x445587['queue']){utils[_0x9a32('0xb')](_0x445587[_0x9a32('0xc')])[_0x9a32('0xd')](function(_0x1eb1c7){if(_0x1eb1c7){_0x445587[_0x9a32('0xe')]=_0x1eb1c7[_0x9a32('0xe')];_0x445587[_0x9a32('0xf')]=_0x445587['agentcomplete']?_0x1eb1c7[_0x9a32('0x10')]:![];_0x445587[_0x9a32('0x11')]=_0x445587[_0x9a32('0xf')]?_0x1eb1c7[_0x9a32('0x12')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x445587);});}else{utils['request'](_0x9a32('0x13'),_0x445587);}if(_0x8290f3){delete transfers[_0x445587[_0x9a32('0x6')]];}else{delete agents[_0x445587[_0x9a32('0x14')]];}}exports[_0x9a32('0x15')]=function(_0xa1dc44){try{agents[_0xa1dc44[_0x9a32('0x14')]]=_0xa1dc44;agents[_0xa1dc44[_0x9a32('0x14')]][_0x9a32('0x16')]=utils['now']();agents[_0xa1dc44[_0x9a32('0x14')]]['lastevent']=_0x9a32('0x17');agents[_0xa1dc44[_0x9a32('0x14')]][_0x9a32('0xa')]=null;agents[_0xa1dc44['destuniqueid']][_0x9a32('0x18')]=null;}catch(_0x4bfda7){utils['error'](_0x4bfda7[_0x9a32('0x19')]);}};exports[_0x9a32('0x1a')]=function(_0x530be4){try{if(!_[_0x9a32('0x1b')](agents[_0x530be4[_0x9a32('0x14')]])){agents[_0x530be4[_0x9a32('0x14')]][_0x9a32('0x1a')]=!![];agents[_0x530be4[_0x9a32('0x14')]]['agentringnoanswerAt']=utils[_0x9a32('0x1c')]();agents[_0x530be4['destuniqueid']]['lastevent']=_0x9a32('0x1d');agents[_0x530be4[_0x9a32('0x14')]][_0x9a32('0x1e')]='timeout';agents[_0x530be4[_0x9a32('0x14')]][_0x9a32('0x1f')]=_0x530be4[_0x9a32('0x20')]?parseInt(_0x530be4['ringtime'])/0x3e8:0x0;agents[_0x530be4[_0x9a32('0x14')]][_0x9a32('0x21')]=0x0;unanswered[_0x9a32('0x22')](_0x530be4[_0x9a32('0x14')]);}}catch(_0x2bfdca){utils[_0x9a32('0x23')](_0x2bfdca[_0x9a32('0x19')]);}};exports[_0x9a32('0x24')]=function(_0x5b1f6f){try{_[_0x9a32('0x25')](agents,function(_0x2b36a3,_0x4edf11){if(_0x2b36a3[_0x9a32('0x6')]==_0x5b1f6f[_0x9a32('0x6')]&&!_[_0x9a32('0x26')](unanswered,_0x2b36a3[_0x9a32('0x14')])){_0x2b36a3[_0x9a32('0x1a')]=!![];_0x2b36a3[_0x9a32('0x27')]=utils['now']();_0x2b36a3[_0x9a32('0x28')]=_0x9a32('0x29');_0x2b36a3[_0x9a32('0x1e')]=_0x9a32('0x29');_0x2b36a3['holdtime']=_0x5b1f6f[_0x9a32('0x1f')];_0x2b36a3[_0x9a32('0x21')]=0x0;writeDB(_0x2b36a3);}});}catch(_0x4520f0){utils[_0x9a32('0x23')](_0x4520f0[_0x9a32('0x19')]);}};exports[_0x9a32('0x2a')]=function(_0x552a3c){try{if(agents[_0x552a3c[_0x9a32('0x14')]]){agents[_0x552a3c['destuniqueid']][_0x9a32('0x2b')]=utils['now']();agents[_0x552a3c[_0x9a32('0x14')]][_0x9a32('0xa')]=_0x552a3c[_0x9a32('0xa')];agents[_0x552a3c[_0x9a32('0x14')]]['connectedlinename']=_0x552a3c[_0x9a32('0x18')];agents[_0x552a3c[_0x9a32('0x14')]][_0x9a32('0x1f')]=_0x552a3c[_0x9a32('0x20')];agents[_0x552a3c[_0x9a32('0x14')]][_0x9a32('0x28')]=_0x9a32('0x2c');_[_0x9a32('0x25')](agents,function(_0x2327bc,_0x435669){if(_0x2327bc[_0x9a32('0x14')]!=_0x552a3c['destuniqueid']&&_0x2327bc[_0x9a32('0x6')]==_0x552a3c['uniqueid']){_0x2327bc[_0x9a32('0x21')]=0x0;_0x2327bc[_0x9a32('0x1f')]=_0x552a3c[_0x9a32('0x20')];_0x2327bc[_0x9a32('0x1a')]=!![];_0x2327bc[_0x9a32('0x27')]=utils['now']();_0x2327bc['lastevent']=_0x9a32('0x2d');_0x2327bc[_0x9a32('0x1e')]='answered_elsewhere';_0x2327bc['answeredelsewheredestinationuniqueid']=_0x552a3c[_0x9a32('0x14')];_0x2327bc[_0x9a32('0x2e')]=_0x552a3c['membername'];writeDB(_0x2327bc);}});}}catch(_0x5261f4){utils[_0x9a32('0x23')](_0x5261f4[_0x9a32('0x19')]);}};exports[_0x9a32('0x2f')]=function(_0x20a723){try{if(!_[_0x9a32('0x1b')](agents[_0x20a723[_0x9a32('0x14')]])){agents[_0x20a723[_0x9a32('0x14')]]['agentcomplete']=!![];agents[_0x20a723['destuniqueid']][_0x9a32('0x30')]=utils[_0x9a32('0x1c')]();agents[_0x20a723[_0x9a32('0x14')]][_0x9a32('0x21')]=utils[_0x9a32('0x31')](agents[_0x20a723[_0x9a32('0x14')]][_0x9a32('0x30')],agents[_0x20a723[_0x9a32('0x14')]][_0x9a32('0x2b')]);agents[_0x20a723[_0x9a32('0x14')]][_0x9a32('0x1e')]=_0x20a723[_0x9a32('0x1e')];agents[_0x20a723['destuniqueid']][_0x9a32('0x28')]=_0x9a32('0x32');writeDB(agents[_0x20a723['destuniqueid']]);}}catch(_0x22eac9){utils[_0x9a32('0x23')](_0x22eac9[_0x9a32('0x19')]);}};exports['blindtransfer']=function(_0x11359f){try{if(!_[_0x9a32('0x1b')](agents[_0x11359f[_0x9a32('0x33')]])){agents[_0x11359f[_0x9a32('0x33')]][_0x9a32('0x34')]=!![];agents[_0x11359f[_0x9a32('0x33')]][_0x9a32('0x35')]='blind';agents[_0x11359f[_0x9a32('0x33')]][_0x9a32('0x36')]=_0x11359f[_0x9a32('0x37')];agents[_0x11359f['transfereruniqueid']][_0x9a32('0x38')]=agents[_0x11359f['transfereruniqueid']][_0x9a32('0x6')];}}catch(_0x3900d8){utils[_0x9a32('0x23')](_0x3900d8[_0x9a32('0x19')]);}};exports['attendedtransfer']=function(_0x1e6122){try{if(_0x1e6122[_0x9a32('0x39')]==_0x1e6122[_0x9a32('0x3a')]){if(!_[_0x9a32('0x1b')](agents[_0x1e6122['secondtransfereruniqueid']])){agents[_0x1e6122['secondtransfereruniqueid']]['transfer']=!![];agents[_0x1e6122[_0x9a32('0x3b')]][_0x9a32('0x35')]='ATTENDED';agents[_0x1e6122[_0x9a32('0x3b')]]['transferexten']=_0x1e6122[_0x9a32('0x3c')];agents[_0x1e6122[_0x9a32('0x3b')]][_0x9a32('0x38')]=_0x1e6122[_0x9a32('0x39')];}if(_0x1e6122['transfereeuniqueid']&&agents[_0x1e6122['transfereeuniqueid']]){agents[_0x1e6122[_0x9a32('0x3d')]][_0x9a32('0x3e')]=0x1;transfers[_0x1e6122['transfereeuniqueid']]=_[_0x9a32('0x3f')](agents[_0x1e6122[_0x9a32('0x3d')]]);transfers[_0x1e6122[_0x9a32('0x3d')]][_0x9a32('0x9')]=agents[_0x1e6122[_0x9a32('0x3b')]]['calleridnum'];transfers[_0x1e6122[_0x9a32('0x3d')]][_0x9a32('0x40')]=agents[_0x1e6122['secondtransfereruniqueid']][_0x9a32('0x40')];transfers[_0x1e6122[_0x9a32('0x3d')]][_0x9a32('0x16')]=utils[_0x9a32('0x1c')]();transfers[_0x1e6122['transfereeuniqueid']][_0x9a32('0x2b')]=utils[_0x9a32('0x1c')]();transfers[_0x1e6122['transfereeuniqueid']][_0x9a32('0x1f')]=0x0;transfers[_0x1e6122[_0x9a32('0x3d')]][_0x9a32('0x3e')]=0x2;}}else if(_0x1e6122[_0x9a32('0x3b')]==_0x1e6122[_0x9a32('0x41')]){if(!_[_0x9a32('0x1b')](agents[_0x1e6122[_0x9a32('0x39')]])){agents[_0x1e6122['origtransfereruniqueid']][_0x9a32('0x34')]=!![];agents[_0x1e6122['origtransfereruniqueid']][_0x9a32('0x35')]=_0x9a32('0x42');agents[_0x1e6122['origtransfereruniqueid']]['transferexten']=_0x1e6122[_0x9a32('0x43')];agents[_0x1e6122[_0x9a32('0x39')]][_0x9a32('0x38')]=_0x1e6122['secondtransfereruniqueid'];}if(_0x1e6122['transfertargetuniqueid']&&agents[_0x1e6122[_0x9a32('0x44')]]){agents[_0x1e6122[_0x9a32('0x44')]]['agententerreason']=0x1;transfers[_0x1e6122[_0x9a32('0x44')]]=_[_0x9a32('0x3f')](agents[_0x1e6122['transfertargetuniqueid']]);transfers[_0x1e6122[_0x9a32('0x44')]][_0x9a32('0x9')]=agents[_0x1e6122[_0x9a32('0x39')]][_0x9a32('0x9')];transfers[_0x1e6122[_0x9a32('0x44')]]['calleridname']=agents[_0x1e6122['origtransfereruniqueid']][_0x9a32('0x40')];transfers[_0x1e6122['transfertargetuniqueid']][_0x9a32('0x16')]=utils[_0x9a32('0x1c')]();transfers[_0x1e6122[_0x9a32('0x44')]]['agentconnectAt']=utils[_0x9a32('0x1c')]();transfers[_0x1e6122[_0x9a32('0x44')]][_0x9a32('0x1f')]=0x0;transfers[_0x1e6122[_0x9a32('0x44')]][_0x9a32('0x3e')]=0x2;}}}catch(_0x2adaf1){utils[_0x9a32('0x23')](_0x2adaf1[_0x9a32('0x19')]);}};exports['hangup']=function(_0x1bfc3c){try{if(agents[_0x1bfc3c[_0x9a32('0x6')]]&&agents[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x1e')]===_0x9a32('0x1d')){if(_0x1bfc3c[_0x9a32('0x45')]==='21'){agents[_0x1bfc3c[_0x9a32('0x6')]]['reason']=_0x9a32('0x46');agents[_0x1bfc3c[_0x9a32('0x6')]]['lastevent']='rejected';}writeDB(agents[_0x1bfc3c[_0x9a32('0x6')]]);var _0x241b90=unanswered[_0x9a32('0x47')](_0x1bfc3c[_0x9a32('0x6')]);if(_0x241b90>-0x1)unanswered[_0x9a32('0x48')](_0x241b90,0x1);}if(transfers[_0x1bfc3c[_0x9a32('0x6')]]){transfers[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x2f')]=!![];transfers[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x30')]=utils[_0x9a32('0x1c')]();transfers[_0x1bfc3c[_0x9a32('0x6')]]['talktime']=utils[_0x9a32('0x31')](transfers[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x30')],transfers[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x2b')]);transfers[_0x1bfc3c['uniqueid']][_0x9a32('0x1e')]='agent';transfers[_0x1bfc3c['uniqueid']]['lastevent']=_0x9a32('0x32');writeDB(transfers[_0x1bfc3c[_0x9a32('0x6')]],!![]);}if(agents[_0x1bfc3c[_0x9a32('0x6')]]&&agents[_0x1bfc3c['uniqueid']][_0x9a32('0x2b')]){agents[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x2f')]=!![];agents[_0x1bfc3c[_0x9a32('0x6')]]['agentcompleteAt']=utils[_0x9a32('0x1c')]();agents[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x21')]=utils[_0x9a32('0x31')](agents[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x30')],agents[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x2b')]);agents[_0x1bfc3c[_0x9a32('0x6')]]['reason']=agents[_0x1bfc3c[_0x9a32('0x6')]][_0x9a32('0x34')]?_0x9a32('0x34'):_0x9a32('0x49');agents[_0x1bfc3c['uniqueid']][_0x9a32('0x28')]=_0x9a32('0x32');writeDB(agents[_0x1bfc3c['uniqueid']]);}}catch(_0x2a1496){utils[_0x9a32('0x23')](_0x2a1496['stack']);}}; \ No newline at end of file +var _0xff4b=['secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','transfer','ATTENDED','secondtransfererexten','transfertargetuniqueid','agentcalledAt','rejected','splice','agent','lodash','util','./utils','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','now','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','holdtime','ringtime','forIn','uniqueid','abandoned','reason','talktime','agentconnect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x1ebe2d,_0x1b38cc){var _0x64f35e=function(_0x57a599){while(--_0x57a599){_0x1ebe2d['push'](_0x1ebe2d['shift']());}};_0x64f35e(++_0x1b38cc);}(_0xff4b,0x1b9));var _0xbff4=function(_0x4c495a,_0x17d46b){_0x4c495a=_0x4c495a-0x0;var _0x11ea44=_0xff4b[_0x4c495a];return _0x11ea44;};'use strict';var _=require(_0xbff4('0x0'));var util=require(_0xbff4('0x1'));var utils=require(_0xbff4('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3e5dab,_0x480d77){utils['info'](util['format'](_0xbff4('0x3'),_0x3e5dab['uniqueid'],_0x3e5dab[_0xbff4('0x4')],_0x3e5dab['queue'],_0x3e5dab[_0xbff4('0x5')],_0x3e5dab[_0xbff4('0x6')],_0x3e5dab[_0xbff4('0x7')],_0x3e5dab[_0xbff4('0x8')],_0x3e5dab[_0xbff4('0x9')]));if(_0x3e5dab[_0xbff4('0xa')]){utils[_0xbff4('0xb')](_0x3e5dab['queue'])[_0xbff4('0xc')](function(_0x4f73f8){if(_0x4f73f8){_0x3e5dab[_0xbff4('0xd')]=_0x4f73f8['type'];_0x3e5dab[_0xbff4('0xe')]=_0x3e5dab[_0xbff4('0xf')]?_0x4f73f8[_0xbff4('0x10')]:![];_0x3e5dab[_0xbff4('0x11')]=_0x3e5dab['agentacw']?_0x4f73f8[_0xbff4('0x12')]:0x0;}utils[_0xbff4('0x13')]('CreateVoiceAgentReport',_0x3e5dab);});}else{utils[_0xbff4('0x13')](_0xbff4('0x14'),_0x3e5dab);}if(_0x480d77){delete transfers[_0x3e5dab['uniqueid']];}else{delete agents[_0x3e5dab[_0xbff4('0x15')]];}}exports[_0xbff4('0x16')]=function(_0x46c767){try{agents[_0x46c767[_0xbff4('0x15')]]=_0x46c767;agents[_0x46c767['destuniqueid']]['agentcalledAt']=utils[_0xbff4('0x17')]();agents[_0x46c767[_0xbff4('0x15')]][_0xbff4('0x9')]='called';agents[_0x46c767[_0xbff4('0x15')]][_0xbff4('0x8')]=null;agents[_0x46c767['destuniqueid']]['connectedlinename']=null;}catch(_0x18ad90){utils[_0xbff4('0x18')](_0x18ad90[_0xbff4('0x19')]);}};exports[_0xbff4('0x1a')]=function(_0x5c1d73){try{if(!_[_0xbff4('0x1b')](agents[_0x5c1d73['destuniqueid']])){agents[_0x5c1d73['destuniqueid']][_0xbff4('0x1a')]=!![];agents[_0x5c1d73[_0xbff4('0x15')]][_0xbff4('0x1c')]=utils[_0xbff4('0x17')]();agents[_0x5c1d73[_0xbff4('0x15')]][_0xbff4('0x9')]=_0xbff4('0x1d');agents[_0x5c1d73[_0xbff4('0x15')]]['reason']='timeout';agents[_0x5c1d73[_0xbff4('0x15')]][_0xbff4('0x1e')]=_0x5c1d73[_0xbff4('0x1f')]?parseInt(_0x5c1d73['ringtime'])/0x3e8:0x0;agents[_0x5c1d73[_0xbff4('0x15')]]['talktime']=0x0;unanswered['push'](_0x5c1d73[_0xbff4('0x15')]);}}catch(_0x3339d7){utils[_0xbff4('0x18')](_0x3339d7['stack']);}};exports['queuecallerabandon']=function(_0x42bfbc){try{_[_0xbff4('0x20')](agents,function(_0x13839c,_0x3a27e3){if(_0x13839c[_0xbff4('0x21')]==_0x42bfbc[_0xbff4('0x21')]&&!_['includes'](unanswered,_0x13839c[_0xbff4('0x15')])){_0x13839c['agentringnoanswer']=!![];_0x13839c['agentringnoanswerAt']=utils[_0xbff4('0x17')]();_0x13839c[_0xbff4('0x9')]=_0xbff4('0x22');_0x13839c[_0xbff4('0x23')]='abandoned';_0x13839c[_0xbff4('0x1e')]=_0x42bfbc[_0xbff4('0x1e')];_0x13839c[_0xbff4('0x24')]=0x0;writeDB(_0x13839c);}});}catch(_0x3e6578){utils[_0xbff4('0x18')](_0x3e6578[_0xbff4('0x19')]);}};exports[_0xbff4('0x25')]=function(_0x37fba2){try{if(agents[_0x37fba2[_0xbff4('0x15')]]){agents[_0x37fba2[_0xbff4('0x15')]]['agentconnectAt']=utils[_0xbff4('0x17')]();agents[_0x37fba2[_0xbff4('0x15')]]['connectedlinenum']=_0x37fba2[_0xbff4('0x8')];agents[_0x37fba2[_0xbff4('0x15')]][_0xbff4('0x26')]=_0x37fba2[_0xbff4('0x26')];agents[_0x37fba2[_0xbff4('0x15')]][_0xbff4('0x1e')]=_0x37fba2[_0xbff4('0x1f')];agents[_0x37fba2['destuniqueid']][_0xbff4('0x9')]=_0xbff4('0x27');_[_0xbff4('0x20')](agents,function(_0x2526e3,_0x556a3f){if(_0x2526e3[_0xbff4('0x15')]!=_0x37fba2['destuniqueid']&&_0x2526e3[_0xbff4('0x21')]==_0x37fba2[_0xbff4('0x21')]){_0x2526e3[_0xbff4('0x24')]=0x0;_0x2526e3[_0xbff4('0x1e')]=_0x37fba2[_0xbff4('0x1f')];_0x2526e3[_0xbff4('0x1a')]=!![];_0x2526e3[_0xbff4('0x1c')]=utils['now']();_0x2526e3[_0xbff4('0x9')]=_0xbff4('0x28');_0x2526e3[_0xbff4('0x23')]=_0xbff4('0x28');_0x2526e3[_0xbff4('0x29')]=_0x37fba2[_0xbff4('0x15')];_0x2526e3['answeredelsewheremembername']=_0x37fba2[_0xbff4('0x5')];writeDB(_0x2526e3);}});}}catch(_0x549bd4){utils[_0xbff4('0x18')](_0x549bd4[_0xbff4('0x19')]);}};exports[_0xbff4('0xf')]=function(_0x43f657){try{if(!_[_0xbff4('0x1b')](agents[_0x43f657[_0xbff4('0x15')]])){agents[_0x43f657[_0xbff4('0x15')]][_0xbff4('0xf')]=!![];agents[_0x43f657[_0xbff4('0x15')]][_0xbff4('0x2a')]=utils[_0xbff4('0x17')]();agents[_0x43f657[_0xbff4('0x15')]][_0xbff4('0x24')]=utils[_0xbff4('0x2b')](agents[_0x43f657['destuniqueid']]['agentcompleteAt'],agents[_0x43f657['destuniqueid']][_0xbff4('0x2c')]);agents[_0x43f657[_0xbff4('0x15')]]['reason']=_0x43f657[_0xbff4('0x23')];agents[_0x43f657[_0xbff4('0x15')]][_0xbff4('0x9')]=_0xbff4('0x2d');writeDB(agents[_0x43f657[_0xbff4('0x15')]]);}}catch(_0x3351b9){utils[_0xbff4('0x18')](_0x3351b9[_0xbff4('0x19')]);}};exports[_0xbff4('0x2e')]=function(_0x294c9c){try{if(!_[_0xbff4('0x1b')](agents[_0x294c9c[_0xbff4('0x2f')]])){agents[_0x294c9c['transfereruniqueid']]['transfer']=!![];agents[_0x294c9c[_0xbff4('0x2f')]][_0xbff4('0x30')]=_0xbff4('0x31');agents[_0x294c9c[_0xbff4('0x2f')]][_0xbff4('0x32')]=_0x294c9c[_0xbff4('0x33')];agents[_0x294c9c['transfereruniqueid']][_0xbff4('0x34')]=agents[_0x294c9c[_0xbff4('0x2f')]][_0xbff4('0x21')];}}catch(_0x51ea9e){utils[_0xbff4('0x18')](_0x51ea9e[_0xbff4('0x19')]);}};exports[_0xbff4('0x35')]=function(_0xb430b4){try{if(_0xb430b4[_0xbff4('0x36')]==_0xb430b4[_0xbff4('0x37')]){if(!_[_0xbff4('0x1b')](agents[_0xb430b4[_0xbff4('0x38')]])){agents[_0xb430b4['secondtransfereruniqueid']]['transfer']=!![];agents[_0xb430b4[_0xbff4('0x38')]][_0xbff4('0x30')]='ATTENDED';agents[_0xb430b4['secondtransfereruniqueid']]['transferexten']=_0xb430b4[_0xbff4('0x39')];agents[_0xb430b4[_0xbff4('0x38')]]['transferuniqueid']=_0xb430b4['origtransfereruniqueid'];}if(_0xb430b4[_0xbff4('0x3a')]&&agents[_0xb430b4[_0xbff4('0x3a')]]){agents[_0xb430b4[_0xbff4('0x3a')]]['agententerreason']=0x1;transfers[_0xb430b4[_0xbff4('0x3a')]]=_[_0xbff4('0x3b')](agents[_0xb430b4[_0xbff4('0x3a')]]);transfers[_0xb430b4['transfereeuniqueid']][_0xbff4('0x7')]=agents[_0xb430b4[_0xbff4('0x38')]][_0xbff4('0x7')];transfers[_0xb430b4[_0xbff4('0x3a')]][_0xbff4('0x3c')]=agents[_0xb430b4[_0xbff4('0x38')]][_0xbff4('0x3c')];transfers[_0xb430b4[_0xbff4('0x3a')]]['agentcalledAt']=utils[_0xbff4('0x17')]();transfers[_0xb430b4['transfereeuniqueid']][_0xbff4('0x2c')]=utils[_0xbff4('0x17')]();transfers[_0xb430b4[_0xbff4('0x3a')]][_0xbff4('0x1e')]=0x0;transfers[_0xb430b4[_0xbff4('0x3a')]][_0xbff4('0x3d')]=0x2;}}else if(_0xb430b4[_0xbff4('0x38')]==_0xb430b4[_0xbff4('0x3e')]){if(!_[_0xbff4('0x1b')](agents[_0xb430b4[_0xbff4('0x36')]])){agents[_0xb430b4['origtransfereruniqueid']][_0xbff4('0x3f')]=!![];agents[_0xb430b4[_0xbff4('0x36')]][_0xbff4('0x30')]=_0xbff4('0x40');agents[_0xb430b4[_0xbff4('0x36')]]['transferexten']=_0xb430b4[_0xbff4('0x41')];agents[_0xb430b4[_0xbff4('0x36')]][_0xbff4('0x34')]=_0xb430b4[_0xbff4('0x38')];}if(_0xb430b4[_0xbff4('0x42')]&&agents[_0xb430b4['transfertargetuniqueid']]){agents[_0xb430b4[_0xbff4('0x42')]][_0xbff4('0x3d')]=0x1;transfers[_0xb430b4[_0xbff4('0x42')]]=_[_0xbff4('0x3b')](agents[_0xb430b4[_0xbff4('0x42')]]);transfers[_0xb430b4['transfertargetuniqueid']][_0xbff4('0x7')]=agents[_0xb430b4[_0xbff4('0x36')]][_0xbff4('0x7')];transfers[_0xb430b4['transfertargetuniqueid']]['calleridname']=agents[_0xb430b4['origtransfereruniqueid']][_0xbff4('0x3c')];transfers[_0xb430b4['transfertargetuniqueid']][_0xbff4('0x43')]=utils[_0xbff4('0x17')]();transfers[_0xb430b4['transfertargetuniqueid']]['agentconnectAt']=utils[_0xbff4('0x17')]();transfers[_0xb430b4[_0xbff4('0x42')]][_0xbff4('0x1e')]=0x0;transfers[_0xb430b4[_0xbff4('0x42')]]['agententerreason']=0x2;}}}catch(_0x2face1){utils[_0xbff4('0x18')](_0x2face1[_0xbff4('0x19')]);}};exports['hangup']=function(_0x12b556){try{if(agents[_0x12b556[_0xbff4('0x21')]]&&agents[_0x12b556['uniqueid']]['reason']===_0xbff4('0x1d')){if(_0x12b556['cause']==='21'){agents[_0x12b556['uniqueid']]['reason']=_0xbff4('0x44');agents[_0x12b556[_0xbff4('0x21')]]['lastevent']=_0xbff4('0x44');}writeDB(agents[_0x12b556[_0xbff4('0x21')]]);var _0x11f8b6=unanswered['indexOf'](_0x12b556[_0xbff4('0x21')]);if(_0x11f8b6>-0x1)unanswered[_0xbff4('0x45')](_0x11f8b6,0x1);}if(transfers[_0x12b556[_0xbff4('0x21')]]){transfers[_0x12b556[_0xbff4('0x21')]]['agentcomplete']=!![];transfers[_0x12b556[_0xbff4('0x21')]][_0xbff4('0x2a')]=utils[_0xbff4('0x17')]();transfers[_0x12b556[_0xbff4('0x21')]][_0xbff4('0x24')]=utils[_0xbff4('0x2b')](transfers[_0x12b556[_0xbff4('0x21')]][_0xbff4('0x2a')],transfers[_0x12b556['uniqueid']][_0xbff4('0x2c')]);transfers[_0x12b556[_0xbff4('0x21')]]['reason']=_0xbff4('0x46');transfers[_0x12b556['uniqueid']][_0xbff4('0x9')]=_0xbff4('0x2d');writeDB(transfers[_0x12b556[_0xbff4('0x21')]],!![]);}if(agents[_0x12b556[_0xbff4('0x21')]]&&agents[_0x12b556[_0xbff4('0x21')]][_0xbff4('0x2c')]){agents[_0x12b556[_0xbff4('0x21')]]['agentcomplete']=!![];agents[_0x12b556[_0xbff4('0x21')]]['agentcompleteAt']=utils['now']();agents[_0x12b556[_0xbff4('0x21')]][_0xbff4('0x24')]=utils[_0xbff4('0x2b')](agents[_0x12b556[_0xbff4('0x21')]]['agentcompleteAt'],agents[_0x12b556['uniqueid']][_0xbff4('0x2c')]);agents[_0x12b556[_0xbff4('0x21')]]['reason']=agents[_0x12b556[_0xbff4('0x21')]]['transfer']?_0xbff4('0x3f'):_0xbff4('0x46');agents[_0x12b556[_0xbff4('0x21')]][_0xbff4('0x9')]='complete';writeDB(agents[_0x12b556['uniqueid']]);}}catch(_0x4e3b41){utils[_0xbff4('0x18')](_0x4e3b41[_0xbff4('0x19')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 14bb48c..2656e5c 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 _0x13e2=['FAILED','NO\x20ANSWER','ANSWERED','BUSY','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','source','callerid','disposition','then','UserId','request','CreateVoiceCallReport','newchannel','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','error','stack','newstate','channelstate','isNil','systemanswertime','linkedid','transfer','destinationchannel','answertime','toNumber','hangup','calleridname','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','variable','xmd-originatecalleridnum','value','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','lastIndexOf','gotoif','./utils'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x13e2,0xe6));var _0x213e=function(_0x593ebc,_0x2a4c66){_0x593ebc=_0x593ebc-0x0;var _0x18f9eb=_0x13e2[_0x593ebc];return _0x18f9eb;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x213e('0x0'));var dispositions=['NO\x20ANSWER','FAILED',_0x213e('0x1'),_0x213e('0x2'),'NO\x20ANSWER',_0x213e('0x2'),_0x213e('0x3'),_0x213e('0x4'),_0x213e('0x1'),_0x213e('0x1'),_0x213e('0x1')];var channels={};function writeDB(_0x4ef966){utils['info'](util[_0x213e('0x5')](_0x213e('0x6'),_0x4ef966[_0x213e('0x7')],_0x4ef966[_0x213e('0x8')],_0x4ef966[_0x213e('0x9')],_0x4ef966[_0x213e('0xa')],_0x4ef966[_0x213e('0xb')],_0x4ef966['destination'],_0x4ef966[_0x213e('0xc')],_0x4ef966[_0x213e('0xd')]));if(_0x4ef966[_0x213e('0xa')]){utils['getUserByInternal'](_0x4ef966[_0x213e('0xa')])[_0x213e('0xe')](function(_0x249dee){if(_0x249dee){_0x4ef966[_0x213e('0xf')]=_0x249dee['id'];}utils[_0x213e('0x10')](_0x213e('0x11'),_0x4ef966);});}else{utils[_0x213e('0x10')](_0x213e('0x11'),_0x4ef966);}if(channels[_0x4ef966['uniqueid']]){delete channels[_0x4ef966['uniqueid']];}}exports[_0x213e('0x12')]=function(_0x2a0da3){try{if(_0x2a0da3[_0x213e('0x7')]==_0x2a0da3['linkedid']&&_0x2a0da3[_0x213e('0x8')]!=_0x213e('0x13')){channels[_0x2a0da3['uniqueid']]={'uniqueid':_0x2a0da3[_0x213e('0x7')],'accountcode':_0x2a0da3['accountcode'],'source':_0x2a0da3['calleridnum'],'destination':_0x2a0da3[_0x213e('0x14')],'destinationcontext':_0x2a0da3[_0x213e('0x15')],'channel':_0x2a0da3[_0x213e('0x8')],'starttime':utils[_0x213e('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x213e('0x2'),'amaflags':_0x213e('0x17')};}}catch(_0x53e9bf){utils[_0x213e('0x18')](_0x53e9bf[_0x213e('0x19')]);}};exports[_0x213e('0x1a')]=function(_0x519670){try{if(!_['isNil'](channels[_0x519670[_0x213e('0x7')]])&&_0x519670[_0x213e('0x1b')]==0x6){if(_[_0x213e('0x1c')](channels[_0x519670['uniqueid']][_0x213e('0x1d')])){channels[_0x519670[_0x213e('0x7')]][_0x213e('0x1d')]=utils[_0x213e('0x16')]();}}else if(!_[_0x213e('0x1c')](channels[_0x519670[_0x213e('0x1e')]])&&_0x519670[_0x213e('0x1b')]==0x6&&_0x519670[_0x213e('0x15')]!=_0x213e('0x1f')){channels[_0x519670[_0x213e('0x1e')]][_0x213e('0xa')]=_0x519670[_0x213e('0xa')];channels[_0x519670['linkedid']][_0x213e('0x20')]=_0x519670[_0x213e('0x8')];if(_[_0x213e('0x1c')](channels[_0x519670[_0x213e('0x1e')]]['answertime'])){channels[_0x519670[_0x213e('0x1e')]][_0x213e('0x21')]=utils[_0x213e('0x16')]();}channels[_0x519670[_0x213e('0x1e')]][_0x213e('0xd')]=dispositions[_[_0x213e('0x22')](_0x519670[_0x213e('0x1b')])]||_0x213e('0x3');}}catch(_0x1ede52){utils[_0x213e('0x18')](_0x1ede52[_0x213e('0x19')]);}};exports[_0x213e('0x23')]=function(_0x470778){try{if(!_[_0x213e('0x1c')](channels[_0x470778['uniqueid']])){if(_[_0x213e('0x1c')](channels[_0x470778['uniqueid']]['callerid'])){channels[_0x470778['uniqueid']][_0x213e('0xc')]=_0x470778[_0x213e('0x24')]+'\x20<'+_0x470778['calleridnum']+'>';}channels[_0x470778[_0x213e('0x7')]][_0x213e('0x25')]=utils[_0x213e('0x16')]();channels[_0x470778['uniqueid']]['duration']=utils['diffTime'](channels[_0x470778['uniqueid']][_0x213e('0x25')],channels[_0x470778[_0x213e('0x7')]][_0x213e('0x26')]);channels[_0x470778[_0x213e('0x7')]][_0x213e('0x27')]=channels[_0x470778[_0x213e('0x7')]][_0x213e('0x21')]?utils[_0x213e('0x28')](channels[_0x470778[_0x213e('0x7')]][_0x213e('0x25')],channels[_0x470778[_0x213e('0x7')]]['answertime']):0x0;writeDB(channels[_0x470778[_0x213e('0x7')]]);}}catch(_0x1e809d){utils['error'](_0x1e809d[_0x213e('0x19')]);}};exports[_0x213e('0x29')]=function(_0x206470){try{if(!_['isNil'](channels[_0x206470['localtwolinkedid']])){if(channels[_0x206470[_0x213e('0x2a')]][_0x213e('0x8')]==_0x206470['transfereechannel']){channels[_0x206470[_0x213e('0x2a')]][_0x213e('0x20')]=_0x206470[_0x213e('0x2b')];channels[_0x206470[_0x213e('0x2a')]][_0x213e('0x2c')]=_0x213e('0x2d');}else if(channels[_0x206470[_0x213e('0x2a')]][_0x213e('0x8')]=_0x206470[_0x213e('0x2e')]){channels[_0x206470[_0x213e('0x2a')]][_0x213e('0x20')]=_0x206470['origtransfererchannel'];channels[_0x206470[_0x213e('0x2a')]][_0x213e('0x2c')]=_0x213e('0x2d');}}}catch(_0x3b30b2){utils[_0x213e('0x18')](_0x3b30b2[_0x213e('0x19')]);}};exports[_0x213e('0x2f')]=function(_0x4ae545){try{if(!_['isNil'](channels[_0x4ae545[_0x213e('0x7')]])){channels[_0x4ae545[_0x213e('0x7')]][_0x213e('0x30')]=utils[_0x213e('0x16')]();}}catch(_0x37d783){utils['error'](_0x37d783['stack']);}};exports[_0x213e('0x31')]=function(_0x2c1f2e){try{if(!_[_0x213e('0x1c')](channels[_0x2c1f2e[_0x213e('0x7')]])){if(!_[_0x213e('0x1c')](channels[_0x2c1f2e[_0x213e('0x7')]][_0x213e('0x30')])){channels[_0x2c1f2e[_0x213e('0x7')]][_0x213e('0x32')]+=utils['diffTime'](utils[_0x213e('0x16')](),channels[_0x2c1f2e[_0x213e('0x7')]][_0x213e('0x30')]);delete channels[_0x2c1f2e[_0x213e('0x7')]][_0x213e('0x30')];}}}catch(_0x4a7f07){utils[_0x213e('0x18')](_0x4a7f07[_0x213e('0x19')]);}};exports['varset']=function(_0x37671b){try{if(!_[_0x213e('0x1c')](channels[_0x37671b[_0x213e('0x7')]])){if(!_[_0x213e('0x1c')](_0x37671b[_0x213e('0x33')][_0x213e('0x34')])){channels[_0x37671b[_0x213e('0x7')]][_0x213e('0xb')]=_0x37671b[_0x213e('0x35')];}if(!_[_0x213e('0x1c')](_0x37671b[_0x213e('0x33')][_0x213e('0x36')])){channels[_0x37671b['uniqueid']][_0x213e('0x37')]=_0x37671b[_0x213e('0x35')];channels[_0x37671b['uniqueid']][_0x213e('0xc')]='\x22'+_0x37671b[_0x213e('0x35')]+'\x22\x20<'+_0x37671b[_0x213e('0x35')]+'>';}if(!_['isNil'](_0x37671b[_0x213e('0x33')][_0x213e('0x38')])||!_[_0x213e('0x1c')](_0x37671b[_0x213e('0x33')][_0x213e('0x39')])){channels[_0x37671b['uniqueid']]['callerid']=_0x37671b['value'];}if(!_['isNil'](_0x37671b[_0x213e('0x33')][_0x213e('0x3a')])||!_['isNil'](_0x37671b[_0x213e('0x33')][_0x213e('0x3b')])){channels[_0x37671b['uniqueid']][_0x213e('0x3c')]='Queue';channels[_0x37671b[_0x213e('0x7')]][_0x213e('0x3d')]=_0x37671b[_0x213e('0x35')];channels[_0x37671b[_0x213e('0x7')]]['queue']=!![];}if(!_[_0x213e('0x1c')](_0x37671b[_0x213e('0x33')][_0x213e('0x3e')])){channels[_0x37671b[_0x213e('0x7')]]['ContactId']=_0x37671b[_0x213e('0x35')];}if(!_[_0x213e('0x1c')](_0x37671b[_0x213e('0x33')][_0x213e('0x3f')])){channels[_0x37671b[_0x213e('0x7')]][_0x213e('0x9')]=_0x37671b[_0x213e('0x35')];}if(!_[_0x213e('0x1c')](_0x37671b[_0x213e('0x33')][_0x213e('0x40')])){channels[_0x37671b[_0x213e('0x7')]][_0x213e('0x41')]=_0x37671b['value'];}if(!_[_0x213e('0x1c')](_0x37671b[_0x213e('0x33')]['sipcallid'])){channels[_0x37671b['uniqueid']][_0x213e('0x42')]=_0x37671b[_0x213e('0x35')];}}}catch(_0x2bc3f6){utils[_0x213e('0x18')](_0x2bc3f6[_0x213e('0x19')]);}};exports[_0x213e('0x43')]=function(_0x3a6761){try{if(!_[_0x213e('0x1c')](channels[_0x3a6761['uniqueid']])){if(_0x3a6761[_0x213e('0x44')][_0x213e('0x45')]()==_0x213e('0x46')&&_[_0x213e('0x47')](_0x3a6761[_0x213e('0x48')][_0x213e('0x45')](),_0x213e('0x49'))){var _0x3567bf=_0x3a6761[_0x213e('0x48')][_0x213e('0x4a')]('=');var _0x138ce8=_0x3567bf[0x0]['substring'](_0x3567bf[0x0]['lastIndexOf']('(')+0x1,_0x3567bf[0x0][_0x213e('0x4b')](')'));var _0x543a19=_0x3567bf[0x1];channels[_0x3a6761[_0x213e('0x7')]][_0x138ce8]=_0x543a19;}if(!_['includes']([_0x213e('0x23'),'noop','execif','set',_0x213e('0x4c')],_0x3a6761[_0x213e('0x44')][_0x213e('0x45')]())){channels[_0x3a6761[_0x213e('0x7')]][_0x213e('0x3c')]=_0x3a6761[_0x213e('0x44')];channels[_0x3a6761[_0x213e('0x7')]][_0x213e('0x3d')]=_0x3a6761[_0x213e('0x48')];}}}catch(_0x217beb){utils[_0x213e('0x18')](_0x217beb['stack']);}}; \ No newline at end of file +var _0x1b15=['isNil','systemanswertime','linkedid','transfer','answertime','toNumber','hangup','calleridname','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','destinationchannel','localtwolinkedid','userfield','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','varset','variable','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-cdrtype','outboundrouteid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','noop','execif','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','source','callerid','disposition','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','error','stack','newstate','channelstate'];(function(_0x18fbed,_0x165bbd){var _0x117c80=function(_0x28ca94){while(--_0x28ca94){_0x18fbed['push'](_0x18fbed['shift']());}};_0x117c80(++_0x165bbd);}(_0x1b15,0x7e));var _0x51b1=function(_0x5a2c3d,_0x39b944){_0x5a2c3d=_0x5a2c3d-0x0;var _0x3e799a=_0x1b15[_0x5a2c3d];return _0x3e799a;};'use strict';var _=require(_0x51b1('0x0'));var util=require('util');var utils=require(_0x51b1('0x1'));var dispositions=[_0x51b1('0x2'),_0x51b1('0x3'),_0x51b1('0x3'),_0x51b1('0x2'),_0x51b1('0x2'),'NO\x20ANSWER',_0x51b1('0x4'),_0x51b1('0x5'),_0x51b1('0x3'),'FAILED','FAILED'];var channels={};function writeDB(_0x71a822){utils[_0x51b1('0x6')](util['format'](_0x51b1('0x7'),_0x71a822[_0x51b1('0x8')],_0x71a822[_0x51b1('0x9')],_0x71a822[_0x51b1('0xa')],_0x71a822[_0x51b1('0xb')],_0x71a822[_0x51b1('0xc')],_0x71a822['destination'],_0x71a822[_0x51b1('0xd')],_0x71a822[_0x51b1('0xe')]));if(_0x71a822[_0x51b1('0xb')]){utils[_0x51b1('0xf')](_0x71a822[_0x51b1('0xb')])[_0x51b1('0x10')](function(_0x20b1ec){if(_0x20b1ec){_0x71a822[_0x51b1('0x11')]=_0x20b1ec['id'];}utils['request'](_0x51b1('0x12'),_0x71a822);});}else{utils[_0x51b1('0x13')](_0x51b1('0x12'),_0x71a822);}if(channels[_0x71a822[_0x51b1('0x8')]]){delete channels[_0x71a822[_0x51b1('0x8')]];}}exports[_0x51b1('0x14')]=function(_0xc0090){try{if(_0xc0090[_0x51b1('0x8')]==_0xc0090['linkedid']&&_0xc0090['channel']!=_0x51b1('0x15')){channels[_0xc0090[_0x51b1('0x8')]]={'uniqueid':_0xc0090[_0x51b1('0x8')],'accountcode':_0xc0090[_0x51b1('0xb')],'source':_0xc0090['calleridnum'],'destination':_0xc0090[_0x51b1('0x16')],'destinationcontext':_0xc0090[_0x51b1('0x17')],'channel':_0xc0090[_0x51b1('0x9')],'starttime':utils[_0x51b1('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x51b1('0x19')};}}catch(_0xb15d9){utils[_0x51b1('0x1a')](_0xb15d9[_0x51b1('0x1b')]);}};exports[_0x51b1('0x1c')]=function(_0x28adba){try{if(!_['isNil'](channels[_0x28adba[_0x51b1('0x8')]])&&_0x28adba[_0x51b1('0x1d')]==0x6){if(_[_0x51b1('0x1e')](channels[_0x28adba['uniqueid']]['systemanswertime'])){channels[_0x28adba['uniqueid']][_0x51b1('0x1f')]=utils[_0x51b1('0x18')]();}}else if(!_[_0x51b1('0x1e')](channels[_0x28adba[_0x51b1('0x20')]])&&_0x28adba['channelstate']==0x6&&_0x28adba[_0x51b1('0x17')]!=_0x51b1('0x21')){channels[_0x28adba[_0x51b1('0x20')]][_0x51b1('0xb')]=_0x28adba['accountcode'];channels[_0x28adba[_0x51b1('0x20')]]['destinationchannel']=_0x28adba[_0x51b1('0x9')];if(_[_0x51b1('0x1e')](channels[_0x28adba[_0x51b1('0x20')]][_0x51b1('0x22')])){channels[_0x28adba[_0x51b1('0x20')]]['answertime']=utils[_0x51b1('0x18')]();}channels[_0x28adba['linkedid']][_0x51b1('0xe')]=dispositions[_[_0x51b1('0x23')](_0x28adba[_0x51b1('0x1d')])]||_0x51b1('0x4');}}catch(_0xe0268c){utils[_0x51b1('0x1a')](_0xe0268c['stack']);}};exports[_0x51b1('0x24')]=function(_0x5c32af){try{if(!_[_0x51b1('0x1e')](channels[_0x5c32af[_0x51b1('0x8')]])){if(_[_0x51b1('0x1e')](channels[_0x5c32af['uniqueid']]['callerid'])){channels[_0x5c32af[_0x51b1('0x8')]]['callerid']=_0x5c32af[_0x51b1('0x25')]+'\x20<'+_0x5c32af['calleridnum']+'>';}channels[_0x5c32af[_0x51b1('0x8')]][_0x51b1('0x26')]=utils[_0x51b1('0x18')]();channels[_0x5c32af[_0x51b1('0x8')]][_0x51b1('0x27')]=utils[_0x51b1('0x28')](channels[_0x5c32af[_0x51b1('0x8')]][_0x51b1('0x26')],channels[_0x5c32af['uniqueid']][_0x51b1('0x29')]);channels[_0x5c32af[_0x51b1('0x8')]][_0x51b1('0x2a')]=channels[_0x5c32af[_0x51b1('0x8')]][_0x51b1('0x22')]?utils[_0x51b1('0x28')](channels[_0x5c32af[_0x51b1('0x8')]][_0x51b1('0x26')],channels[_0x5c32af[_0x51b1('0x8')]][_0x51b1('0x22')]):0x0;writeDB(channels[_0x5c32af['uniqueid']]);}}catch(_0xed485a){utils['error'](_0xed485a[_0x51b1('0x1b')]);}};exports[_0x51b1('0x2b')]=function(_0x30edb9){try{if(!_[_0x51b1('0x1e')](channels[_0x30edb9['localtwolinkedid']])){if(channels[_0x30edb9['localtwolinkedid']][_0x51b1('0x9')]==_0x30edb9['transfereechannel']){channels[_0x30edb9['localtwolinkedid']][_0x51b1('0x2c')]=_0x30edb9['secondtransfererchannel'];channels[_0x30edb9[_0x51b1('0x2d')]][_0x51b1('0x2e')]='_attended';}else if(channels[_0x30edb9[_0x51b1('0x2d')]][_0x51b1('0x9')]=_0x30edb9[_0x51b1('0x2f')]){channels[_0x30edb9['localtwolinkedid']]['destinationchannel']=_0x30edb9[_0x51b1('0x30')];channels[_0x30edb9[_0x51b1('0x2d')]]['userfield']='_attended';}}}catch(_0x666c7a){utils['error'](_0x666c7a[_0x51b1('0x1b')]);}};exports[_0x51b1('0x31')]=function(_0x11f695){try{if(!_[_0x51b1('0x1e')](channels[_0x11f695['uniqueid']])){channels[_0x11f695[_0x51b1('0x8')]]['musiconholdstartAt']=utils[_0x51b1('0x18')]();}}catch(_0x5a26a5){utils[_0x51b1('0x1a')](_0x5a26a5['stack']);}};exports['musiconholdstop']=function(_0x162077){try{if(!_[_0x51b1('0x1e')](channels[_0x162077['uniqueid']])){if(!_[_0x51b1('0x1e')](channels[_0x162077[_0x51b1('0x8')]]['musiconholdstartAt'])){channels[_0x162077['uniqueid']]['mohtime']+=utils[_0x51b1('0x28')](utils[_0x51b1('0x18')](),channels[_0x162077['uniqueid']][_0x51b1('0x32')]);delete channels[_0x162077[_0x51b1('0x8')]][_0x51b1('0x32')];}}}catch(_0x1d26c4){utils[_0x51b1('0x1a')](_0x1d26c4['stack']);}};exports[_0x51b1('0x33')]=function(_0x218484){try{if(!_[_0x51b1('0x1e')](channels[_0x218484['uniqueid']])){if(!_[_0x51b1('0x1e')](_0x218484[_0x51b1('0x34')]['xmd-originatecalleridnum'])){channels[_0x218484[_0x51b1('0x8')]]['source']=_0x218484[_0x51b1('0x35')];}if(!_['isNil'](_0x218484[_0x51b1('0x34')][_0x51b1('0x36')])){channels[_0x218484[_0x51b1('0x8')]][_0x51b1('0x37')]=_0x218484['value'];channels[_0x218484[_0x51b1('0x8')]][_0x51b1('0xd')]='\x22'+_0x218484[_0x51b1('0x35')]+_0x51b1('0x38')+_0x218484[_0x51b1('0x35')]+'>';}if(!_['isNil'](_0x218484[_0x51b1('0x34')][_0x51b1('0x39')])||!_[_0x51b1('0x1e')](_0x218484[_0x51b1('0x34')]['xmd-callerid'])){channels[_0x218484[_0x51b1('0x8')]][_0x51b1('0xd')]=_0x218484[_0x51b1('0x35')];}if(!_[_0x51b1('0x1e')](_0x218484[_0x51b1('0x34')][_0x51b1('0x3a')])||!_['isNil'](_0x218484[_0x51b1('0x34')][_0x51b1('0x3b')])){channels[_0x218484['uniqueid']][_0x51b1('0x3c')]=_0x51b1('0x3d');channels[_0x218484[_0x51b1('0x8')]][_0x51b1('0x3e')]=_0x218484['value'];channels[_0x218484[_0x51b1('0x8')]]['queue']=!![];}if(!_[_0x51b1('0x1e')](_0x218484[_0x51b1('0x34')]['xmd-contactid'])){channels[_0x218484[_0x51b1('0x8')]]['ContactId']=_0x218484[_0x51b1('0x35')];}if(!_['isNil'](_0x218484[_0x51b1('0x34')][_0x51b1('0x3f')])){channels[_0x218484[_0x51b1('0x8')]][_0x51b1('0xa')]=_0x218484[_0x51b1('0x35')];}if(!_[_0x51b1('0x1e')](_0x218484['variable'][_0x51b1('0x40')])){channels[_0x218484[_0x51b1('0x8')]]['routeid']=_0x218484[_0x51b1('0x35')];}if(!_[_0x51b1('0x1e')](_0x218484[_0x51b1('0x34')][_0x51b1('0x41')])){channels[_0x218484[_0x51b1('0x8')]][_0x51b1('0x41')]=_0x218484[_0x51b1('0x35')];}}}catch(_0x2c4577){utils['error'](_0x2c4577[_0x51b1('0x1b')]);}};exports[_0x51b1('0x42')]=function(_0x46ed15){try{if(!_['isNil'](channels[_0x46ed15[_0x51b1('0x8')]])){if(_0x46ed15[_0x51b1('0x43')][_0x51b1('0x44')]()==_0x51b1('0x45')&&_[_0x51b1('0x46')](_0x46ed15[_0x51b1('0x47')][_0x51b1('0x44')](),_0x51b1('0x48'))){var _0x227da1=_0x46ed15[_0x51b1('0x47')][_0x51b1('0x49')]('=');var _0xa97b50=_0x227da1[0x0][_0x51b1('0x4a')](_0x227da1[0x0]['lastIndexOf']('(')+0x1,_0x227da1[0x0]['lastIndexOf'](')'));var _0x72e293=_0x227da1[0x1];channels[_0x46ed15[_0x51b1('0x8')]][_0xa97b50]=_0x72e293;}if(!_['includes']([_0x51b1('0x24'),_0x51b1('0x4b'),_0x51b1('0x4c'),_0x51b1('0x45'),_0x51b1('0x4d')],_0x46ed15[_0x51b1('0x43')]['toLowerCase']())){channels[_0x46ed15[_0x51b1('0x8')]][_0x51b1('0x3c')]=_0x46ed15['application'];channels[_0x46ed15[_0x51b1('0x8')]][_0x51b1('0x3e')]=_0x46ed15['appdata'];}}}catch(_0x2270ad){utils[_0x51b1('0x1a')](_0x2270ad[_0x51b1('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 7af12ef..0d22f3a 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 _0x3831=['CLOSE','managerevent','./utils','connect','info','CONNECTED','shutdown','fullybooted','FULLYBOOTED','close'];(function(_0x42e841,_0x3791ba){var _0x4a0ae1=function(_0x34286b){while(--_0x34286b){_0x42e841['push'](_0x42e841['shift']());}};_0x4a0ae1(++_0x3791ba);}(_0x3831,0x14c));var _0x1383=function(_0x240d8c,_0x979f5){_0x240d8c=_0x240d8c-0x0;var _0x4e0720=_0x3831[_0x240d8c];return _0x4e0720;};'use strict';var utils=require(_0x1383('0x0'));var _=require('lodash');exports[_0x1383('0x1')]=function(){utils[_0x1383('0x2')](_0x1383('0x3'));};exports[_0x1383('0x4')]=function(){utils[_0x1383('0x2')]('SHUTDOWN');};exports[_0x1383('0x5')]=function(){utils['info'](_0x1383('0x6'));};exports['error']=function(_0x5b64b1){utils['error'](_0x5b64b1);};exports[_0x1383('0x7')]=function(){utils['info'](_0x1383('0x8'));};exports[_0x1383('0x9')]=function(_0x2e9a5b){}; \ No newline at end of file +var _0xacf4=['connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xacf4,0xe7));var _0x4acf=function(_0x2c674c,_0x59e732){_0x2c674c=_0x2c674c-0x0;var _0x7ac0ee=_0xacf4[_0x2c674c];return _0x7ac0ee;};'use strict';var utils=require('./utils');var _=require('lodash');exports[_0x4acf('0x0')]=function(){utils[_0x4acf('0x1')](_0x4acf('0x2'));};exports[_0x4acf('0x3')]=function(){utils[_0x4acf('0x1')](_0x4acf('0x4'));};exports[_0x4acf('0x5')]=function(){utils['info'](_0x4acf('0x6'));};exports[_0x4acf('0x7')]=function(_0x4e0c43){utils[_0x4acf('0x7')](_0x4e0c43);};exports[_0x4acf('0x8')]=function(){utils[_0x4acf('0x1')](_0x4acf('0x9'));};exports[_0x4acf('0xa')]=function(_0x50f5f4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9243ff8..10254a7 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 _0x44b3=['info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','varset','isNil','variable','outboundrouteid','dialbegin','assign','starttime','now','called','dialend','dialstatus','ANSWER','connect','hangup','complete','duration','diffTime','holdtime','answertime','endtime','billableseconds','util'];(function(_0x14261d,_0x4a2ecc){var _0x37202c=function(_0x6f5de2){while(--_0x6f5de2){_0x14261d['push'](_0x14261d['shift']());}};_0x37202c(++_0x4a2ecc);}(_0x44b3,0x9f));var _0x344b=function(_0x5eaa96,_0x4cd2da){_0x5eaa96=_0x5eaa96-0x0;var _0x5417e7=_0x44b3[_0x5eaa96];return _0x5417e7;};'use strict';var _=require('lodash');var util=require(_0x344b('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x247fed){utils[_0x344b('0x1')](util[_0x344b('0x2')](_0x344b('0x3'),_0x247fed[_0x344b('0x4')],_0x247fed[_0x344b('0x5')],_0x247fed['dialstring'],_0x247fed[_0x344b('0x6')],_0x247fed[_0x344b('0x7')],_0x247fed['dialstatus']));utils[_0x344b('0x8')](_0x344b('0x9'),_0x247fed);delete dials[_0x247fed['uniqueid']];}exports[_0x344b('0xa')]=function(_0x378778){try{if(_0x378778['application'][_0x344b('0xb')]()==_0x344b('0xc')&&_[_0x344b('0xd')](_0x378778[_0x344b('0xe')]['toLowerCase'](),_0x344b('0xf'))){var _0x3d5662=_0x378778['appdata'][_0x344b('0x10')]('=');dials[_0x378778[_0x344b('0x4')]]={'routeId':_0x3d5662[0x1]};}}catch(_0x12ce86){utils[_0x344b('0x11')](_0x12ce86[_0x344b('0x12')]);}};exports[_0x344b('0x13')]=function(_0x27769a){try{if(!_[_0x344b('0x14')](_0x27769a[_0x344b('0x15')][_0x344b('0x16')])){dials[_0x27769a[_0x344b('0x4')]]={'routeId':_0x27769a['value']};}}catch(_0x2fc06b){utils['error'](_0x2fc06b[_0x344b('0x12')]);}};exports[_0x344b('0x17')]=function(_0xd5cd76){try{if(!_['isNil'](dials[_0xd5cd76['uniqueid']])){dials[_0xd5cd76[_0x344b('0x4')]]=_[_0x344b('0x18')](dials[_0xd5cd76[_0x344b('0x4')]],_0xd5cd76);dials[_0xd5cd76[_0x344b('0x4')]][_0x344b('0x19')]=utils[_0x344b('0x1a')]();dials[_0xd5cd76[_0x344b('0x4')]]['lastevent']=_0x344b('0x1b');}}catch(_0x3c1800){utils[_0x344b('0x11')](_0x3c1800[_0x344b('0x12')]);}};exports[_0x344b('0x1c')]=function(_0x1c20bb){try{if(!_[_0x344b('0x14')](dials[_0x1c20bb[_0x344b('0x4')]])){dials[_0x1c20bb[_0x344b('0x4')]][_0x344b('0x1d')]=_0x1c20bb[_0x344b('0x1d')];if(_0x1c20bb[_0x344b('0x1d')]==_0x344b('0x1e')){dials[_0x1c20bb['uniqueid']]=_[_0x344b('0x18')](dials[_0x1c20bb[_0x344b('0x4')]],_0x1c20bb);dials[_0x1c20bb[_0x344b('0x4')]]['answertime']=utils[_0x344b('0x1a')]();dials[_0x1c20bb[_0x344b('0x4')]]['lastevent']=_0x344b('0x1f');}}}catch(_0x292497){utils[_0x344b('0x11')](_0x292497[_0x344b('0x12')]);}};exports[_0x344b('0x20')]=function(_0x119dd1){try{if(!_[_0x344b('0x14')](dials[_0x119dd1['uniqueid']])){dials[_0x119dd1[_0x344b('0x4')]]=_[_0x344b('0x18')](dials[_0x119dd1[_0x344b('0x4')]],{'endtime':utils[_0x344b('0x1a')](),'lastevent':_0x344b('0x21')});dials[_0x119dd1[_0x344b('0x4')]][_0x344b('0x22')]=utils[_0x344b('0x23')](dials[_0x119dd1[_0x344b('0x4')]]['endtime'],dials[_0x119dd1[_0x344b('0x4')]][_0x344b('0x19')]);dials[_0x119dd1[_0x344b('0x4')]][_0x344b('0x24')]=utils[_0x344b('0x23')](dials[_0x119dd1[_0x344b('0x4')]][_0x344b('0x25')]||dials[_0x119dd1['uniqueid']][_0x344b('0x26')],dials[_0x119dd1[_0x344b('0x4')]][_0x344b('0x19')]);dials[_0x119dd1['uniqueid']][_0x344b('0x27')]=dials[_0x119dd1['uniqueid']]['answertime']?utils[_0x344b('0x23')](dials[_0x119dd1['uniqueid']]['endtime'],dials[_0x119dd1['uniqueid']][_0x344b('0x25')]):0x0;writeDB(dials[_0x119dd1[_0x344b('0x4')]]);}}catch(_0x3ea145){utils[_0x344b('0x11')](_0x3ea145['stack']);}}; \ No newline at end of file +var _0x56c0=['billableseconds','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','isNil','variable','outboundrouteid','value','dialbegin','starttime','now','lastevent','stack','dialend','dialstatus','assign','answertime','connect','hangup','complete','duration','diffTime','holdtime','endtime'];(function(_0x1097d7,_0x1bf6df){var _0x140177=function(_0x5ea0c2){while(--_0x5ea0c2){_0x1097d7['push'](_0x1097d7['shift']());}};_0x140177(++_0x1bf6df);}(_0x56c0,0x7c));var _0x056c=function(_0x4bd501,_0x2fdba6){_0x4bd501=_0x4bd501-0x0;var _0x38d73c=_0x56c0[_0x4bd501];return _0x38d73c;};'use strict';var _=require(_0x056c('0x0'));var util=require(_0x056c('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3ca7ef){utils[_0x056c('0x2')](util[_0x056c('0x3')](_0x056c('0x4'),_0x3ca7ef[_0x056c('0x5')],_0x3ca7ef[_0x056c('0x6')],_0x3ca7ef[_0x056c('0x7')],_0x3ca7ef[_0x056c('0x8')],_0x3ca7ef[_0x056c('0x9')],_0x3ca7ef['dialstatus']));utils[_0x056c('0xa')](_0x056c('0xb'),_0x3ca7ef);delete dials[_0x3ca7ef[_0x056c('0x5')]];}exports[_0x056c('0xc')]=function(_0x143ef1){try{if(_0x143ef1[_0x056c('0xd')][_0x056c('0xe')]()==_0x056c('0xf')&&_[_0x056c('0x10')](_0x143ef1['appdata']['toLowerCase'](),_0x056c('0x11'))){var _0x3e9aff=_0x143ef1['appdata'][_0x056c('0x12')]('=');dials[_0x143ef1[_0x056c('0x5')]]={'routeId':_0x3e9aff[0x1]};}}catch(_0x1540bd){utils[_0x056c('0x13')](_0x1540bd['stack']);}};exports['varset']=function(_0x432f75){try{if(!_[_0x056c('0x14')](_0x432f75[_0x056c('0x15')][_0x056c('0x16')])){dials[_0x432f75['uniqueid']]={'routeId':_0x432f75[_0x056c('0x17')]};}}catch(_0x5e1bb4){utils[_0x056c('0x13')](_0x5e1bb4['stack']);}};exports[_0x056c('0x18')]=function(_0x4c0703){try{if(!_['isNil'](dials[_0x4c0703[_0x056c('0x5')]])){dials[_0x4c0703['uniqueid']]=_['assign'](dials[_0x4c0703[_0x056c('0x5')]],_0x4c0703);dials[_0x4c0703['uniqueid']][_0x056c('0x19')]=utils[_0x056c('0x1a')]();dials[_0x4c0703[_0x056c('0x5')]][_0x056c('0x1b')]='called';}}catch(_0x274b4f){utils[_0x056c('0x13')](_0x274b4f[_0x056c('0x1c')]);}};exports[_0x056c('0x1d')]=function(_0x2c9c27){try{if(!_['isNil'](dials[_0x2c9c27[_0x056c('0x5')]])){dials[_0x2c9c27[_0x056c('0x5')]][_0x056c('0x1e')]=_0x2c9c27['dialstatus'];if(_0x2c9c27[_0x056c('0x1e')]=='ANSWER'){dials[_0x2c9c27[_0x056c('0x5')]]=_[_0x056c('0x1f')](dials[_0x2c9c27['uniqueid']],_0x2c9c27);dials[_0x2c9c27[_0x056c('0x5')]][_0x056c('0x20')]=utils[_0x056c('0x1a')]();dials[_0x2c9c27[_0x056c('0x5')]][_0x056c('0x1b')]=_0x056c('0x21');}}}catch(_0x204aaa){utils[_0x056c('0x13')](_0x204aaa['stack']);}};exports[_0x056c('0x22')]=function(_0x5ae877){try{if(!_[_0x056c('0x14')](dials[_0x5ae877[_0x056c('0x5')]])){dials[_0x5ae877['uniqueid']]=_[_0x056c('0x1f')](dials[_0x5ae877[_0x056c('0x5')]],{'endtime':utils['now'](),'lastevent':_0x056c('0x23')});dials[_0x5ae877[_0x056c('0x5')]][_0x056c('0x24')]=utils[_0x056c('0x25')](dials[_0x5ae877[_0x056c('0x5')]]['endtime'],dials[_0x5ae877['uniqueid']]['starttime']);dials[_0x5ae877[_0x056c('0x5')]][_0x056c('0x26')]=utils[_0x056c('0x25')](dials[_0x5ae877[_0x056c('0x5')]][_0x056c('0x20')]||dials[_0x5ae877[_0x056c('0x5')]][_0x056c('0x27')],dials[_0x5ae877[_0x056c('0x5')]][_0x056c('0x19')]);dials[_0x5ae877[_0x056c('0x5')]][_0x056c('0x28')]=dials[_0x5ae877['uniqueid']][_0x056c('0x20')]?utils[_0x056c('0x25')](dials[_0x5ae877[_0x056c('0x5')]]['endtime'],dials[_0x5ae877[_0x056c('0x5')]][_0x056c('0x20')]):0x0;writeDB(dials[_0x5ae877[_0x056c('0x5')]]);}}catch(_0x2e3960){utils[_0x056c('0x13')](_0x2e3960[_0x056c('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index afa921b..277fbb4 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 _0x38a5=['./transfers.controller','./core.controller','shutdown','fullybooted','error','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller'];(function(_0x35faf2,_0x56a899){var _0x113601=function(_0x386004){while(--_0x386004){_0x35faf2['push'](_0x35faf2['shift']());}};_0x113601(++_0x56a899);}(_0x38a5,0x12b));var _0x538a=function(_0x3e5f72,_0x5bfba6){_0x3e5f72=_0x3e5f72-0x0;var _0x6bf3a9=_0x38a5[_0x3e5f72];return _0x6bf3a9;};var AsteriskManager=require(_0x538a('0x0'));var config=require(_0x538a('0x1'));var utils=require(_0x538a('0x2'));var ami=new AsteriskManager(config['asterisk']['port'],config[_0x538a('0x3')]['ip'],config['asterisk']['username'],config['asterisk']['password'],!![]);ami[_0x538a('0x4')]();if(config[_0x538a('0x5')]&&config[_0x538a('0x5')][_0x538a('0x6')]){utils['info'](_0x538a('0x7'));}else{var agents=require(_0x538a('0x8'));var calls=require(_0x538a('0x9'));var queues=require('./queues.controller');var recordings=require(_0x538a('0xa'));var members=require(_0x538a('0xb'));var dials=require(_0x538a('0xc'));var transfers=require(_0x538a('0xd'));var core=require(_0x538a('0xe'));ami['on']('connect',core['connect']);ami['on'](_0x538a('0xf'),core[_0x538a('0xf')]);ami['on'](_0x538a('0x10'),core[_0x538a('0x10')]);ami['on'](_0x538a('0x11'),core['error']);ami['on']('close',core['close']);ami['on'](_0x538a('0x12'),core[_0x538a('0x12')]);ami['on'](_0x538a('0x13'),function(_0x56324e){try{members[_0x538a('0x13')](_0x56324e);}catch(_0x4d2bf6){utils[_0x538a('0x11')](_0x4d2bf6);}});ami['on'](_0x538a('0x14'),function(_0x36712e){try{agents['agentcalled'](_0x36712e);}catch(_0x43ace4){utils[_0x538a('0x11')](_0x43ace4);}});ami['on'](_0x538a('0x15'),function(_0x3937b0){try{agents[_0x538a('0x15')](_0x3937b0);}catch(_0x4570a3){utils['error'](_0x4570a3);}});ami['on'](_0x538a('0x16'),function(_0xc8dd53){try{agents[_0x538a('0x16')](_0xc8dd53);queues[_0x538a('0x16')](_0xc8dd53);}catch(_0x5dcd3b){utils[_0x538a('0x11')](_0x5dcd3b);}});ami['on']('agentcomplete',function(_0x50f1e3){try{agents[_0x538a('0x17')](_0x50f1e3);queues[_0x538a('0x17')](_0x50f1e3);members['agentcomplete'](_0x50f1e3);}catch(_0x59024b){utils[_0x538a('0x11')](_0x59024b);}});ami['on'](_0x538a('0x18'),function(_0x2f83f0){try{agents[_0x538a('0x18')](_0x2f83f0);queues[_0x538a('0x18')](_0x2f83f0);}catch(_0xddbf98){utils[_0x538a('0x11')](_0xddbf98);}});ami['on'](_0x538a('0x19'),function(_0x45b682){try{queues['queuecallerjoin'](_0x45b682);recordings[_0x538a('0x19')](_0x45b682);}catch(_0x5a73e7){utils['error'](_0x5a73e7);}});ami['on'](_0x538a('0x1a'),function(_0x28bd36){try{queues[_0x538a('0x1a')](_0x28bd36);}catch(_0x4af676){utils[_0x538a('0x11')](_0x4af676);}});ami['on']('musiconholdstart',function(_0x1bc435){try{queues[_0x538a('0x1b')](_0x1bc435);calls['musiconholdstart'](_0x1bc435);}catch(_0x18a38c){utils[_0x538a('0x11')](_0x18a38c);}});ami['on'](_0x538a('0x1c'),function(_0x5120d2){try{queues[_0x538a('0x1c')](_0x5120d2);calls[_0x538a('0x1c')](_0x5120d2);}catch(_0x24bf42){utils[_0x538a('0x11')](_0x24bf42);}});ami['on']('newstate',function(_0xe7bdbf){try{calls[_0x538a('0x1d')](_0xe7bdbf);recordings[_0x538a('0x1d')](_0xe7bdbf);}catch(_0x50e73e){utils[_0x538a('0x11')](_0x50e73e);}});ami['on']('hangup',function(_0xb2291c){try{calls[_0x538a('0x1e')](_0xb2291c);recordings[_0x538a('0x1e')](_0xb2291c);dials[_0x538a('0x1e')](_0xb2291c);agents[_0x538a('0x1e')](_0xb2291c);queues[_0x538a('0x1e')](_0xb2291c);}catch(_0x30b497){utils[_0x538a('0x11')](_0x30b497);}});ami['on']('cdr',function(_0x4840a9){try{members[_0x538a('0x1f')](_0x4840a9);}catch(_0x1055d3){utils[_0x538a('0x11')](_0x1055d3);}});ami['on'](_0x538a('0x20'),function(_0x5be88d){try{queues[_0x538a('0x20')](_0x5be88d);agents[_0x538a('0x20')](_0x5be88d);transfers['blindtransfer'](_0x5be88d);}catch(_0x5a6258){utils[_0x538a('0x11')](_0x5a6258);}});ami['on']('attendedtransfer',function(_0x2c4629){try{queues[_0x538a('0x21')](_0x2c4629);transfers[_0x538a('0x21')](_0x2c4629);agents['attendedtransfer'](_0x2c4629);calls['attendedtransfer'](_0x2c4629);}catch(_0x36b4b1){utils['error'](_0x36b4b1);}});ami['on'](_0x538a('0x22'),function(_0x576c64){try{queues['varset'](_0x576c64);recordings[_0x538a('0x22')](_0x576c64);calls['varset'](_0x576c64);dials['varset'](_0x576c64);}catch(_0x191774){utils['error'](_0x191774);}});ami['on'](_0x538a('0x23'),function(_0x33320b){try{calls[_0x538a('0x23')](_0x33320b);recordings['newexten'](_0x33320b);dials[_0x538a('0x23')](_0x33320b);}catch(_0x570cb0){utils[_0x538a('0x11')](_0x570cb0);}});ami['on']('newchannel',function(_0x513c7a){try{calls[_0x538a('0x24')](_0x513c7a);recordings[_0x538a('0x24')](_0x513c7a);}catch(_0x26769f){utils[_0x538a('0x11')](_0x26769f);}});ami['on']('dialbegin',function(_0x16afd2){try{dials[_0x538a('0x25')](_0x16afd2);}catch(_0x4cc51a){utils[_0x538a('0x11')](_0x4cc51a);}});ami['on'](_0x538a('0x26'),function(_0x533357){try{dials[_0x538a('0x26')](_0x533357);}catch(_0x20598b){utils[_0x538a('0x11')](_0x20598b);}});} \ No newline at end of file +var _0x8ce1=['newchannel','dialbegin','dialend','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten'];(function(_0x17f283,_0x343b6f){var _0x370bc2=function(_0x53a6d7){while(--_0x53a6d7){_0x17f283['push'](_0x17f283['shift']());}};_0x370bc2(++_0x343b6f);}(_0x8ce1,0x1c6));var _0x18ce=function(_0x368a1c,_0x48000a){_0x368a1c=_0x368a1c-0x0;var _0x2c6306=_0x8ce1[_0x368a1c];return _0x2c6306;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require('./utils');var ami=new AsteriskManager(config[_0x18ce('0x0')][_0x18ce('0x1')],config['asterisk']['ip'],config[_0x18ce('0x0')][_0x18ce('0x2')],config[_0x18ce('0x0')][_0x18ce('0x3')],!![]);ami[_0x18ce('0x4')]();if(config[_0x18ce('0x5')]&&config[_0x18ce('0x5')][_0x18ce('0x6')]){utils[_0x18ce('0x7')](_0x18ce('0x8'));}else{var agents=require(_0x18ce('0x9'));var calls=require(_0x18ce('0xa'));var queues=require(_0x18ce('0xb'));var recordings=require(_0x18ce('0xc'));var members=require(_0x18ce('0xd'));var dials=require(_0x18ce('0xe'));var transfers=require(_0x18ce('0xf'));var core=require(_0x18ce('0x10'));ami['on'](_0x18ce('0x11'),core[_0x18ce('0x11')]);ami['on'](_0x18ce('0x12'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on']('error',core[_0x18ce('0x13')]);ami['on']('close',core['close']);ami['on'](_0x18ce('0x14'),core[_0x18ce('0x14')]);ami['on'](_0x18ce('0x15'),function(_0x548e1c){try{members[_0x18ce('0x15')](_0x548e1c);}catch(_0xb99686){utils[_0x18ce('0x13')](_0xb99686);}});ami['on'](_0x18ce('0x16'),function(_0x1dcbaf){try{agents['agentcalled'](_0x1dcbaf);}catch(_0x22c865){utils['error'](_0x22c865);}});ami['on'](_0x18ce('0x17'),function(_0x47265){try{agents[_0x18ce('0x17')](_0x47265);}catch(_0x3b6df4){utils['error'](_0x3b6df4);}});ami['on'](_0x18ce('0x18'),function(_0x532ef5){try{agents['agentconnect'](_0x532ef5);queues['agentconnect'](_0x532ef5);}catch(_0x1dac87){utils[_0x18ce('0x13')](_0x1dac87);}});ami['on'](_0x18ce('0x19'),function(_0x3d2da1){try{agents[_0x18ce('0x19')](_0x3d2da1);queues[_0x18ce('0x19')](_0x3d2da1);members['agentcomplete'](_0x3d2da1);}catch(_0x198c21){utils[_0x18ce('0x13')](_0x198c21);}});ami['on'](_0x18ce('0x1a'),function(_0x357845){try{agents[_0x18ce('0x1a')](_0x357845);queues[_0x18ce('0x1a')](_0x357845);}catch(_0x2edf2){utils[_0x18ce('0x13')](_0x2edf2);}});ami['on'](_0x18ce('0x1b'),function(_0xd0d897){try{queues[_0x18ce('0x1b')](_0xd0d897);recordings[_0x18ce('0x1b')](_0xd0d897);}catch(_0x48484f){utils[_0x18ce('0x13')](_0x48484f);}});ami['on'](_0x18ce('0x1c'),function(_0x555fad){try{queues[_0x18ce('0x1c')](_0x555fad);}catch(_0x2e62df){utils[_0x18ce('0x13')](_0x2e62df);}});ami['on'](_0x18ce('0x1d'),function(_0x305b82){try{queues[_0x18ce('0x1d')](_0x305b82);calls['musiconholdstart'](_0x305b82);}catch(_0x3fad59){utils[_0x18ce('0x13')](_0x3fad59);}});ami['on'](_0x18ce('0x1e'),function(_0x193ec2){try{queues[_0x18ce('0x1e')](_0x193ec2);calls[_0x18ce('0x1e')](_0x193ec2);}catch(_0x53c84d){utils['error'](_0x53c84d);}});ami['on'](_0x18ce('0x1f'),function(_0x40cf2e){try{calls[_0x18ce('0x1f')](_0x40cf2e);recordings[_0x18ce('0x1f')](_0x40cf2e);}catch(_0x285567){utils[_0x18ce('0x13')](_0x285567);}});ami['on'](_0x18ce('0x20'),function(_0xf1fb40){try{calls[_0x18ce('0x20')](_0xf1fb40);recordings['hangup'](_0xf1fb40);dials['hangup'](_0xf1fb40);agents[_0x18ce('0x20')](_0xf1fb40);queues['hangup'](_0xf1fb40);}catch(_0x579b54){utils[_0x18ce('0x13')](_0x579b54);}});ami['on'](_0x18ce('0x21'),function(_0x4c00f8){try{members[_0x18ce('0x21')](_0x4c00f8);}catch(_0x21aab9){utils[_0x18ce('0x13')](_0x21aab9);}});ami['on'](_0x18ce('0x22'),function(_0x176079){try{queues[_0x18ce('0x22')](_0x176079);agents[_0x18ce('0x22')](_0x176079);transfers[_0x18ce('0x22')](_0x176079);}catch(_0x44b059){utils['error'](_0x44b059);}});ami['on'](_0x18ce('0x23'),function(_0x11b48f){try{queues['attendedtransfer'](_0x11b48f);transfers[_0x18ce('0x23')](_0x11b48f);agents['attendedtransfer'](_0x11b48f);calls[_0x18ce('0x23')](_0x11b48f);}catch(_0x191510){utils[_0x18ce('0x13')](_0x191510);}});ami['on']('varset',function(_0x55a937){try{queues[_0x18ce('0x24')](_0x55a937);recordings[_0x18ce('0x24')](_0x55a937);calls[_0x18ce('0x24')](_0x55a937);dials[_0x18ce('0x24')](_0x55a937);}catch(_0x2e86c5){utils[_0x18ce('0x13')](_0x2e86c5);}});ami['on'](_0x18ce('0x25'),function(_0x847814){try{calls['newexten'](_0x847814);recordings['newexten'](_0x847814);dials[_0x18ce('0x25')](_0x847814);}catch(_0x319a4c){utils[_0x18ce('0x13')](_0x319a4c);}});ami['on'](_0x18ce('0x26'),function(_0x48eb9d){try{calls[_0x18ce('0x26')](_0x48eb9d);recordings[_0x18ce('0x26')](_0x48eb9d);}catch(_0x161c64){utils[_0x18ce('0x13')](_0x161c64);}});ami['on'](_0x18ce('0x27'),function(_0x74c5b7){try{dials[_0x18ce('0x27')](_0x74c5b7);}catch(_0x29b6fe){utils[_0x18ce('0x13')](_0x29b6fe);}});ami['on'](_0x18ce('0x28'),function(_0x47a1ab){try{dials[_0x18ce('0x28')](_0x47a1ab);}catch(_0x34cf74){utils['error'](_0x34cf74);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b3e43d7..d69e6d9 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 _0x274b=['voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','assign','cdr','split','data1','source','data3','destinationchannel','destination','lodash','util','./utils','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','catch','error','some','startsWith','devicestatechange','state','INUSE','device'];(function(_0x150de8,_0x2de082){var _0x54e90e=function(_0x4831f5){while(--_0x4831f5){_0x150de8['push'](_0x150de8['shift']());}};_0x54e90e(++_0x2de082);}(_0x274b,0x145));var _0xb274=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x274b[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xb274('0x0'));var util=require(_0xb274('0x1'));var utils=require(_0xb274('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xb274('0x3')];function writeDB(_0x1a7335){utils[_0xb274('0x4')](util[_0xb274('0x5')](_0xb274('0x6'),_0x1a7335[_0xb274('0x7')],_0x1a7335['interface'],_0x1a7335[_0xb274('0x8')],_0x1a7335[_0xb274('0x9')],_0x1a7335[_0xb274('0xa')],_0x1a7335[_0xb274('0xb')]));if(_0x1a7335[_0xb274('0xc')]){utils[_0xb274('0xd')](_0x1a7335[_0xb274('0xc')])[_0xb274('0xe')](function(_0x1ebbfa){if(_0x1ebbfa){_0x1a7335['membername']=_0x1ebbfa[_0xb274('0xf')];_0x1a7335[_0xb274('0x10')]=_0x1ebbfa['internal'];utils[_0xb274('0x11')]('CreateMemberReport',_0x1a7335);}else{utils['getUserByName'](_0x1a7335[_0xb274('0xc')]['split']('/')[0x1])[_0xb274('0xe')](function(_0x595cf5){if(_0x595cf5){_0x1a7335[_0xb274('0xa')]=_0x595cf5[_0xb274('0xf')];_0x1a7335['internal']=_0x595cf5[_0xb274('0x10')];utils['request'](_0xb274('0x12'),_0x1a7335);}});}})[_0xb274('0x13')](function(_0x1a715c){utils[_0xb274('0x14')](_0x1a715c);});}delete members[_0x1a7335[_0xb274('0xc')]];}function startsWith(_0xa3719,_0x4a22c7){return _[_0xb274('0x15')](_0xa3719,function(_0x5058f1){return _[_0xb274('0x16')](_0x4a22c7,_0x5058f1);});}exports[_0xb274('0x17')]=function(_0x370811){switch(_0x370811[_0xb274('0x18')]){case _0xb274('0x19'):case'BUSY':if(!startsWith(exclude,_0x370811[_0xb274('0x1a')])){members[_0x370811[_0xb274('0x1a')]]={'channel':_0xb274('0x1b'),'interface':_0x370811['device'],'type':_0xb274('0x1c'),'enterAt':utils[_0xb274('0x1d')](),'role':'agent'};}break;case _0xb274('0x1e'):if(!_[_0xb274('0x1f')](members[_0x370811[_0xb274('0x1a')]])){members[_0x370811[_0xb274('0x1a')]][_0xb274('0x20')]=utils[_0xb274('0x1d')]();members[_0x370811[_0xb274('0x1a')]][_0xb274('0x21')]=utils[_0xb274('0x22')](members[_0x370811[_0xb274('0x1a')]][_0xb274('0x20')],members[_0x370811[_0xb274('0x1a')]][_0xb274('0x23')]);if(members[_0x370811[_0xb274('0x1a')]]['uniqueid']){writeDB(members[_0x370811[_0xb274('0x1a')]]);}}default:break;}};exports['agentcomplete']=function(_0x3b450f){if(!_['isNil'](members[_0x3b450f[_0xb274('0xc')]])){members[_0x3b450f['interface']]=_[_0xb274('0x24')](members[_0x3b450f[_0xb274('0xc')]],{'data4':_0x3b450f['queue'],'uniqueid':_0x3b450f['uniqueid']});}};exports[_0xb274('0x25')]=function(_0x558c1e){if(_0x558c1e['channel']){var _0x8c6179=_0x558c1e[_0xb274('0x8')][_0xb274('0x26')]('-')[0x0];if(!_[_0xb274('0x1f')](members[_0x8c6179])){members[_0x8c6179]=_[_0xb274('0x24')](members[_0x8c6179],{'data1':members[_0x8c6179][_0xb274('0x27')]||_0x558c1e[_0xb274('0xb')],'data2':members[_0x8c6179][_0xb274('0x9')]||_0x558c1e[_0xb274('0x28')],'data3':members[_0x8c6179][_0xb274('0x29')]||_0x558c1e['destination'],'uniqueid':members[_0x8c6179][_0xb274('0x7')]||_0x558c1e[_0xb274('0x7')]});if(members[_0x8c6179][_0xb274('0x20')]){writeDB(members[_0x8c6179]);}}}if(_0x558c1e[_0xb274('0x2a')]){var _0x336446=_0x558c1e['destinationchannel'][_0xb274('0x26')]('-')[0x0];if(!_['isNil'](members[_0x336446])){members[_0x336446]=_[_0xb274('0x24')](members[_0x336446],{'data1':members[_0x336446][_0xb274('0x27')]||_0x558c1e[_0xb274('0xb')],'data2':members[_0x336446]['data2']||_0x558c1e[_0xb274('0x28')],'data3':members[_0x336446]['data3']||_0x558c1e[_0xb274('0x2b')],'uniqueid':members[_0x336446][_0xb274('0x7')]||_0x558c1e[_0xb274('0x7')]});if(members[_0x336446][_0xb274('0x20')]){writeDB(members[_0x336446]);}}}}; \ No newline at end of file +var _0x88fe=['data3','destination','destinationchannel','data1','source','lodash','util','./utils','Local/_attended@transfer','info','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','data2','then','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','startsWith','INUSE','BUSY','device','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','uniqueid','agentcomplete','assign','queue','cdr','channel','type'];(function(_0x12dd47,_0x35b23e){var _0xdd0a8c=function(_0x15d8f8){while(--_0x15d8f8){_0x12dd47['push'](_0x12dd47['shift']());}};_0xdd0a8c(++_0x35b23e);}(_0x88fe,0xe1));var _0xe88f=function(_0x44ad4b,_0x13ccad){_0x44ad4b=_0x44ad4b-0x0;var _0x4c0516=_0x88fe[_0x44ad4b];return _0x4c0516;};'use strict';var _=require(_0xe88f('0x0'));var util=require(_0xe88f('0x1'));var utils=require(_0xe88f('0x2'));var members={};var exclude=[_0xe88f('0x3'),'Queue:'];function writeDB(_0x317f93){utils[_0xe88f('0x4')](util[_0xe88f('0x5')](_0xe88f('0x6'),_0x317f93['uniqueid'],_0x317f93[_0xe88f('0x7')],_0x317f93['channel'],_0x317f93[_0xe88f('0x8')],_0x317f93['membername'],_0x317f93['type']));if(_0x317f93[_0xe88f('0x7')]){utils['getUserByInterface'](_0x317f93[_0xe88f('0x7')])[_0xe88f('0x9')](function(_0x11101c){if(_0x11101c){_0x317f93[_0xe88f('0xa')]=_0x11101c[_0xe88f('0xb')];_0x317f93[_0xe88f('0xc')]=_0x11101c[_0xe88f('0xc')];utils[_0xe88f('0xd')](_0xe88f('0xe'),_0x317f93);}else{utils[_0xe88f('0xf')](_0x317f93['interface'][_0xe88f('0x10')]('/')[0x1])[_0xe88f('0x9')](function(_0x39966d){if(_0x39966d){_0x317f93['membername']=_0x39966d['name'];_0x317f93[_0xe88f('0xc')]=_0x39966d[_0xe88f('0xc')];utils[_0xe88f('0xd')](_0xe88f('0xe'),_0x317f93);}});}})[_0xe88f('0x11')](function(_0x5b1ae4){utils[_0xe88f('0x12')](_0x5b1ae4);});}delete members[_0x317f93[_0xe88f('0x7')]];}function startsWith(_0x331d76,_0x287569){return _['some'](_0x331d76,function(_0x56f3d1){return _[_0xe88f('0x13')](_0x287569,_0x56f3d1);});}exports['devicestatechange']=function(_0x3c05bf){switch(_0x3c05bf['state']){case _0xe88f('0x14'):case _0xe88f('0x15'):if(!startsWith(exclude,_0x3c05bf[_0xe88f('0x16')])){members[_0x3c05bf[_0xe88f('0x16')]]={'channel':'voice','interface':_0x3c05bf[_0xe88f('0x16')],'type':_0xe88f('0x17'),'enterAt':utils[_0xe88f('0x18')](),'role':_0xe88f('0x19')};}break;case _0xe88f('0x1a'):if(!_[_0xe88f('0x1b')](members[_0x3c05bf[_0xe88f('0x16')]])){members[_0x3c05bf[_0xe88f('0x16')]][_0xe88f('0x1c')]=utils['now']();members[_0x3c05bf['device']][_0xe88f('0x1d')]=utils[_0xe88f('0x1e')](members[_0x3c05bf['device']][_0xe88f('0x1c')],members[_0x3c05bf[_0xe88f('0x16')]][_0xe88f('0x1f')]);if(members[_0x3c05bf[_0xe88f('0x16')]][_0xe88f('0x20')]){writeDB(members[_0x3c05bf[_0xe88f('0x16')]]);}}default:break;}};exports[_0xe88f('0x21')]=function(_0x51ee2b){if(!_[_0xe88f('0x1b')](members[_0x51ee2b['interface']])){members[_0x51ee2b[_0xe88f('0x7')]]=_[_0xe88f('0x22')](members[_0x51ee2b[_0xe88f('0x7')]],{'data4':_0x51ee2b[_0xe88f('0x23')],'uniqueid':_0x51ee2b[_0xe88f('0x20')]});}};exports[_0xe88f('0x24')]=function(_0x2feb70){if(_0x2feb70[_0xe88f('0x25')]){var _0x263642=_0x2feb70['channel'][_0xe88f('0x10')]('-')[0x0];if(!_['isNil'](members[_0x263642])){members[_0x263642]=_['assign'](members[_0x263642],{'data1':members[_0x263642]['data1']||_0x2feb70[_0xe88f('0x26')],'data2':members[_0x263642][_0xe88f('0x8')]||_0x2feb70['source'],'data3':members[_0x263642][_0xe88f('0x27')]||_0x2feb70[_0xe88f('0x28')],'uniqueid':members[_0x263642][_0xe88f('0x20')]||_0x2feb70[_0xe88f('0x20')]});if(members[_0x263642][_0xe88f('0x1c')]){writeDB(members[_0x263642]);}}}if(_0x2feb70[_0xe88f('0x29')]){var _0x33ffae=_0x2feb70[_0xe88f('0x29')][_0xe88f('0x10')]('-')[0x0];if(!_[_0xe88f('0x1b')](members[_0x33ffae])){members[_0x33ffae]=_[_0xe88f('0x22')](members[_0x33ffae],{'data1':members[_0x33ffae][_0xe88f('0x2a')]||_0x2feb70[_0xe88f('0x26')],'data2':members[_0x33ffae][_0xe88f('0x8')]||_0x2feb70[_0xe88f('0x2b')],'data3':members[_0x33ffae]['data3']||_0x2feb70[_0xe88f('0x28')],'uniqueid':members[_0x33ffae][_0xe88f('0x20')]||_0x2feb70[_0xe88f('0x20')]});if(members[_0x33ffae]['exitAt']){writeDB(members[_0x33ffae]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0ce1599..408346d 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 _0x24ff=['musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','position','hangup','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','isNil','variable','queuestatus','value','CONTINUE','queuecallerexit','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','accountcode','destaccountcode','lastAssignedTo','membername','assigned','queuecallercomplete','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','clone','transfereelinkedid','calleridnum','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','error','stack','musiconholdstart'];(function(_0x325e1e,_0x903510){var _0x33aa0f=function(_0x519777){while(--_0x519777){_0x325e1e['push'](_0x325e1e['shift']());}};_0x33aa0f(++_0x903510);}(_0x24ff,0x1dc));var _0xf24f=function(_0x3044ef,_0x40a82b){_0x3044ef=_0x3044ef-0x0;var _0x403ca0=_0x24ff[_0x3044ef];return _0x403ca0;};'use strict';var _=require(_0xf24f('0x0'));var util=require(_0xf24f('0x1'));var utils=require(_0xf24f('0x2'));var queues={};function writeDB(_0xa69b83){utils[_0xf24f('0x3')](util[_0xf24f('0x4')](_0xf24f('0x5'),_0xa69b83[_0xf24f('0x6')],_0xa69b83[_0xf24f('0x7')],_0xa69b83[_0xf24f('0x8')],_0xa69b83['lastAssignedTo'],_0xa69b83['calleridnum'],_0xa69b83['accountcode'],_0xa69b83['queuecallerexitreason']));if(_0xa69b83[_0xf24f('0x8')]){utils[_0xf24f('0x9')](_0xa69b83['queue'])[_0xf24f('0xa')](function(_0x268882){if(_0x268882){_0xa69b83[_0xf24f('0xb')]=_0x268882['type'];}utils[_0xf24f('0xc')](_0xf24f('0xd'),_0xa69b83);});}else{utils['request'](_0xf24f('0xd'),_0xa69b83);}if(_0xa69b83[_0xf24f('0xe')]){delete queues[_0xa69b83[_0xf24f('0xe')]];}else{delete queues[_0xa69b83[_0xf24f('0x6')]];}}exports[_0xf24f('0xf')]=function(_0x5455c1){queues[_0x5455c1['uniqueid']]=_['assign'](_0x5455c1,{'originalposition':_0x5455c1[_0xf24f('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0xf24f('0x11')]=function(_0x30f862){if(!_['isNil'](queues[_0x30f862[_0xf24f('0x6')]])){if(queues[_0x30f862[_0xf24f('0x6')]][_0xf24f('0x12')]){if(!queues[_0x30f862[_0xf24f('0x6')]][_0xf24f('0x13')]&&!queues[_0x30f862[_0xf24f('0x6')]]['queuecallerexit']){queues[_0x30f862[_0xf24f('0x6')]]['queuecallercomplete']=!![];queues[_0x30f862['uniqueid']][_0xf24f('0x14')]=utils[_0xf24f('0x15')]();queues[_0x30f862['uniqueid']][_0xf24f('0x16')]=_0xf24f('0x17');}writeDB(queues[_0x30f862[_0xf24f('0x6')]]);}else{if(queues[_0x30f862[_0xf24f('0x6')]][_0xf24f('0xe')]){queues[queues[_0x30f862['uniqueid']][_0xf24f('0xe')]]=queues[_0x30f862[_0xf24f('0x6')]];queues[queues[_0x30f862['uniqueid']][_0xf24f('0xe')]][_0xf24f('0x18')]=0x2;delete queues[_0x30f862[_0xf24f('0x6')]];}}}};exports['varset']=function(_0x8370bb){if(!_[_0xf24f('0x19')](_0x8370bb[_0xf24f('0x1a')][_0xf24f('0x1b')])&&_0x8370bb[_0xf24f('0x1c')]['toUpperCase']()!==_0xf24f('0x1d')){if(!_[_0xf24f('0x19')](queues[_0x8370bb[_0xf24f('0x6')]])){queues[_0x8370bb[_0xf24f('0x6')]]['queuecallerabandon']=![];queues[_0x8370bb[_0xf24f('0x6')]]['queuecallerabandonAt']=null;queues[_0x8370bb[_0xf24f('0x6')]][_0xf24f('0x1e')]=!![];queues[_0x8370bb[_0xf24f('0x6')]][_0xf24f('0x1f')]=utils[_0xf24f('0x15')]();queues[_0x8370bb[_0xf24f('0x6')]][_0xf24f('0x16')]=_0x8370bb['value']['toUpperCase']();writeDB(queues[_0x8370bb[_0xf24f('0x6')]]);}}else if(!_[_0xf24f('0x19')](_0x8370bb[_0xf24f('0x1a')][_0xf24f('0x20')])){if(!_[_0xf24f('0x19')](queues[_0x8370bb['uniqueid']])&&!queues[_0x8370bb[_0xf24f('0x6')]][_0xf24f('0x13')]){queues[_0x8370bb[_0xf24f('0x6')]]['queuecallerabandon']=![];queues[_0x8370bb[_0xf24f('0x6')]][_0xf24f('0x21')]=null;queues[_0x8370bb[_0xf24f('0x6')]][_0xf24f('0x1e')]=!![];queues[_0x8370bb[_0xf24f('0x6')]][_0xf24f('0x1f')]=utils[_0xf24f('0x15')]();queues[_0x8370bb[_0xf24f('0x6')]][_0xf24f('0x16')]=_0xf24f('0x22');}}};exports[_0xf24f('0x13')]=function(_0x22c2e3){if(!_['isNil'](queues[_0x22c2e3['uniqueid']])){queues[_0x22c2e3[_0xf24f('0x6')]]['queuecallerexit']=![];queues[_0x22c2e3[_0xf24f('0x6')]]['queuecallerexitAt']=null;queues[_0x22c2e3[_0xf24f('0x6')]][_0xf24f('0x13')]=!![];queues[_0x22c2e3[_0xf24f('0x6')]][_0xf24f('0x21')]=utils[_0xf24f('0x15')]();queues[_0x22c2e3[_0xf24f('0x6')]][_0xf24f('0x16')]=_0xf24f('0x23');}};exports[_0xf24f('0x24')]=function(_0x331511){if(!_[_0xf24f('0x19')](queues[_0x331511[_0xf24f('0x6')]])){queues[_0x331511[_0xf24f('0x6')]][_0xf24f('0x24')]=!![];queues[_0x331511[_0xf24f('0x6')]][_0xf24f('0x12')]=utils[_0xf24f('0x15')]();queues[_0x331511['uniqueid']][_0xf24f('0x25')]=utils['diffTime'](queues[_0x331511[_0xf24f('0x6')]][_0xf24f('0x12')],queues[_0x331511[_0xf24f('0x6')]][_0xf24f('0x26')]);queues[_0x331511[_0xf24f('0x6')]][_0xf24f('0x10')]=_0x331511[_0xf24f('0x10')];queues[_0x331511[_0xf24f('0x6')]]['count']=_0x331511[_0xf24f('0x27')];queues[_0x331511[_0xf24f('0x6')]][_0xf24f('0x28')]=_0x331511['connectedlinenum'];queues[_0x331511['uniqueid']][_0xf24f('0x29')]=_0x331511['connectedlinename'];}};exports[_0xf24f('0x2a')]=function(_0x30fec9){if(!_['isNil'](queues[_0x30fec9[_0xf24f('0x6')]])){queues[_0x30fec9[_0xf24f('0x6')]][_0xf24f('0x13')]=![];queues[_0x30fec9[_0xf24f('0x6')]]['queuecallerabandon']=![];queues[_0x30fec9[_0xf24f('0x6')]][_0xf24f('0x21')]=null;queues[_0x30fec9['uniqueid']][_0xf24f('0x1e')]=![];queues[_0x30fec9['uniqueid']][_0xf24f('0x16')]=null;queues[_0x30fec9['uniqueid']][_0xf24f('0x1f')]=null;queues[_0x30fec9['uniqueid']]['assigned']=!![];queues[_0x30fec9['uniqueid']][_0xf24f('0x2b')]=_0x30fec9[_0xf24f('0x2c')];queues[_0x30fec9['uniqueid']][_0xf24f('0x2d')]=_0x30fec9[_0xf24f('0x2e')];}};exports['agentcomplete']=function(_0xed993f){if(!_[_0xf24f('0x19')](queues[_0xed993f[_0xf24f('0x6')]])){if(queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x12')]){queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x13')]=![];queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x13')]=![];queues[_0xed993f['uniqueid']][_0xf24f('0x21')]=null;queues[_0xed993f[_0xf24f('0x6')]]['queuecallerexit']=![];queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x1f')]=null;queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x2f')]=!![];queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x2d')]=_0xed993f[_0xf24f('0x2e')];queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x30')]=!![];queues[_0xed993f[_0xf24f('0x6')]]['queuecallercompleteAt']=utils[_0xf24f('0x15')]();if(_0xed993f[_0xf24f('0x31')]=='transfer'){if(!queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x32')]){queues[_0xed993f['uniqueid']]['queuecallerexitreason']=_0xf24f('0x33');}}else{queues[_0xed993f[_0xf24f('0x6')]][_0xf24f('0x16')]='COMPLETEDBY'+_0xed993f['reason']['toUpperCase']();}writeDB(queues[_0xed993f[_0xf24f('0x6')]]);}}};exports[_0xf24f('0x34')]=function(_0x5164fd){if(!_[_0xf24f('0x19')](queues[_0x5164fd[_0xf24f('0x35')]])){queues[_0x5164fd[_0xf24f('0x35')]][_0xf24f('0x32')]=!![];queues[_0x5164fd[_0xf24f('0x35')]][_0xf24f('0x36')]=_0xf24f('0x37');queues[_0x5164fd[_0xf24f('0x35')]][_0xf24f('0x38')]=_0x5164fd[_0xf24f('0x39')];queues[_0x5164fd['transfereeuniqueid']][_0xf24f('0x3a')]=_0x5164fd[_0xf24f('0x35')];queues[_0x5164fd['transfereeuniqueid']]['queuecallerexitreason']=_0xf24f('0x3b');}};exports[_0xf24f('0x3c')]=function(_0xb6168a){try{if(_0xb6168a['origtransfereruniqueid']==_0xb6168a[_0xf24f('0x3d')]){if(!_[_0xf24f('0x19')](queues[_0xb6168a[_0xf24f('0x3e')]])){queues[_0xb6168a[_0xf24f('0x3e')]]['transfer']=!![];queues[_0xb6168a[_0xf24f('0x3e')]][_0xf24f('0x36')]=_0xf24f('0x3f');queues[_0xb6168a[_0xf24f('0x3e')]]['transferexten']=_0xb6168a['origtransfererexten'];queues[_0xb6168a['secondtransfererlinkedid']][_0xf24f('0x3a')]=_0xb6168a['origtransfereruniqueid'];queues[_0xb6168a[_0xf24f('0x3e')]][_0xf24f('0x16')]=_0xf24f('0x40');}if(!_[_0xf24f('0x19')](queues[_0xb6168a[_0xf24f('0x3d')]])){if(_0xb6168a['transfereelinkedid']&&queues[_0xb6168a['transfereelinkedid']]){queues[_0xb6168a['transfereelinkedid']][_0xf24f('0x18')]=0x1;queues[_0xb6168a[_0xf24f('0x35')]]=_[_0xf24f('0x41')](queues[_0xb6168a[_0xf24f('0x42')]]);queues[_0xb6168a['transfereeuniqueid']][_0xf24f('0xe')]=_0xb6168a['transfertargetuniqueid'];queues[_0xb6168a['transfereeuniqueid']][_0xf24f('0x18')]=0x2;queues[_0xb6168a[_0xf24f('0x35')]][_0xf24f('0x43')]=queues[_0xb6168a[_0xf24f('0x3e')]][_0xf24f('0x43')];queues[_0xb6168a[_0xf24f('0x35')]][_0xf24f('0x44')]=queues[_0xb6168a['secondtransfererlinkedid']][_0xf24f('0x44')];queues[_0xb6168a[_0xf24f('0x35')]][_0xf24f('0x26')]=utils[_0xf24f('0x15')]();queues[_0xb6168a[_0xf24f('0x35')]]['queuecallerleaveAt']=utils['now']();queues[_0xb6168a[_0xf24f('0x35')]]['holdtime']=0x0;queues[_0xb6168a[_0xf24f('0x35')]][_0xf24f('0x45')]=0x0;}else{queues[_0xb6168a[_0xf24f('0x3d')]][_0xf24f('0xe')]=_0xb6168a[_0xf24f('0x3e')];}}}else if(_0xb6168a[_0xf24f('0x46')]==_0xb6168a['secondtransfererlinkedid']){if(!_[_0xf24f('0x19')](queues[_0xb6168a[_0xf24f('0x3d')]])){queues[_0xb6168a['origtransfererlinkedid']][_0xf24f('0x32')]=!![];queues[_0xb6168a[_0xf24f('0x3d')]][_0xf24f('0x36')]=_0xf24f('0x3f');queues[_0xb6168a[_0xf24f('0x3d')]][_0xf24f('0x38')]=_0xb6168a[_0xf24f('0x47')];queues[_0xb6168a[_0xf24f('0x3d')]][_0xf24f('0x3a')]=_0xb6168a[_0xf24f('0x46')];queues[_0xb6168a[_0xf24f('0x3d')]][_0xf24f('0x16')]='ATTENDEDTRANSFER';}if(!_[_0xf24f('0x19')](queues[_0xb6168a['secondtransfererlinkedid']])){if(_0xb6168a['transfertargetlinkedid']&&queues[_0xb6168a[_0xf24f('0x48')]]){queues[_0xb6168a[_0xf24f('0x48')]][_0xf24f('0x18')]=0x1;queues[_0xb6168a[_0xf24f('0x49')]]=_[_0xf24f('0x41')](queues[_0xb6168a['transfertargetlinkedid']]);queues[_0xb6168a['transfertargetuniqueid']][_0xf24f('0xe')]=_0xb6168a[_0xf24f('0x49')];queues[_0xb6168a[_0xf24f('0x49')]][_0xf24f('0x18')]=0x2;queues[_0xb6168a[_0xf24f('0x49')]][_0xf24f('0x43')]=queues[_0xb6168a[_0xf24f('0x3d')]][_0xf24f('0x43')];queues[_0xb6168a[_0xf24f('0x49')]]['calleridname']=queues[_0xb6168a[_0xf24f('0x3d')]][_0xf24f('0x44')];queues[_0xb6168a['transfertargetuniqueid']][_0xf24f('0x26')]=utils['now']();queues[_0xb6168a['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xf24f('0x15')]();queues[_0xb6168a[_0xf24f('0x49')]]['holdtime']=0x0;queues[_0xb6168a[_0xf24f('0x49')]]['mohtime']=0x0;}else{queues[_0xb6168a[_0xf24f('0x3e')]]['transfereduniqueid']=_0xb6168a['origtransfererlinkedid'];}}}}catch(_0x26d4c3){utils[_0xf24f('0x4a')](_0x26d4c3[_0xf24f('0x4b')]);}};exports[_0xf24f('0x4c')]=function(_0x8ed3ec){if(!_['isNil'](queues[_0x8ed3ec[_0xf24f('0x6')]])){queues[_0x8ed3ec[_0xf24f('0x6')]][_0xf24f('0x4d')]=utils['now']();}};exports[_0xf24f('0x4e')]=function(_0x1e9262){if(!_[_0xf24f('0x19')](queues[_0x1e9262[_0xf24f('0x6')]])){if(!_['isNil'](queues[_0x1e9262[_0xf24f('0x6')]][_0xf24f('0x4d')])){queues[_0x1e9262[_0xf24f('0x6')]][_0xf24f('0x45')]+=utils['diffTime'](utils[_0xf24f('0x15')](),queues[_0x1e9262[_0xf24f('0x6')]]['musiconholdstartAt']);delete queues[_0x1e9262['uniqueid']][_0xf24f('0x4d')];}}}; \ No newline at end of file +var _0x11ed=['transferexten','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transfereelinkedid','transfertargetuniqueid','calleridname','holdtime','mohtime','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','varset','isNil','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','destaccountcode','agentcomplete','assigned','membername','queuecallercomplete','queuecallercompleteAt','reason','transfer','COMPLETEDBY','transfereeuniqueid','transfertype'];(function(_0x4a4d6e,_0x38ab14){var _0x377fa8=function(_0x46e3cd){while(--_0x46e3cd){_0x4a4d6e['push'](_0x4a4d6e['shift']());}};_0x377fa8(++_0x38ab14);}(_0x11ed,0x1a8));var _0xd11e=function(_0x3f534a,_0xaa2554){_0x3f534a=_0x3f534a-0x0;var _0x2d07c7=_0x11ed[_0x3f534a];return _0x2d07c7;};'use strict';var _=require(_0xd11e('0x0'));var util=require(_0xd11e('0x1'));var utils=require(_0xd11e('0x2'));var queues={};function writeDB(_0x396234){utils['info'](util[_0xd11e('0x3')](_0xd11e('0x4'),_0x396234[_0xd11e('0x5')],_0x396234[_0xd11e('0x6')],_0x396234['queue'],_0x396234[_0xd11e('0x7')],_0x396234[_0xd11e('0x8')],_0x396234[_0xd11e('0x9')],_0x396234['queuecallerexitreason']));if(_0x396234[_0xd11e('0xa')]){utils['getVoiceQueueByName'](_0x396234['queue'])[_0xd11e('0xb')](function(_0x457d92){if(_0x457d92){_0x396234[_0xd11e('0xc')]=_0x457d92[_0xd11e('0xc')];}utils[_0xd11e('0xd')](_0xd11e('0xe'),_0x396234);});}else{utils[_0xd11e('0xd')](_0xd11e('0xe'),_0x396234);}if(_0x396234[_0xd11e('0xf')]){delete queues[_0x396234[_0xd11e('0xf')]];}else{delete queues[_0x396234[_0xd11e('0x5')]];}}exports[_0xd11e('0x10')]=function(_0x5a57fe){queues[_0x5a57fe[_0xd11e('0x5')]]=_[_0xd11e('0x11')](_0x5a57fe,{'originalposition':_0x5a57fe[_0xd11e('0x12')],'queuecallerjoinAt':utils[_0xd11e('0x13')](),'mohtime':0x0});};exports['hangup']=function(_0x265b7b){if(!_['isNil'](queues[_0x265b7b['uniqueid']])){if(queues[_0x265b7b[_0xd11e('0x5')]][_0xd11e('0x14')]){if(!queues[_0x265b7b['uniqueid']][_0xd11e('0x15')]&&!queues[_0x265b7b[_0xd11e('0x5')]][_0xd11e('0x16')]){queues[_0x265b7b[_0xd11e('0x5')]]['queuecallercomplete']=!![];queues[_0x265b7b[_0xd11e('0x5')]]['queuecallercompleteAt']=utils[_0xd11e('0x13')]();queues[_0x265b7b['uniqueid']][_0xd11e('0x17')]=_0xd11e('0x18');}writeDB(queues[_0x265b7b[_0xd11e('0x5')]]);}else{if(queues[_0x265b7b['uniqueid']][_0xd11e('0xf')]){queues[queues[_0x265b7b[_0xd11e('0x5')]]['transfereduniqueid']]=queues[_0x265b7b[_0xd11e('0x5')]];queues[queues[_0x265b7b[_0xd11e('0x5')]]['transfereduniqueid']][_0xd11e('0x19')]=0x2;delete queues[_0x265b7b[_0xd11e('0x5')]];}}}};exports[_0xd11e('0x1a')]=function(_0x566755){if(!_[_0xd11e('0x1b')](_0x566755['variable'][_0xd11e('0x1c')])&&_0x566755[_0xd11e('0x1d')][_0xd11e('0x1e')]()!==_0xd11e('0x1f')){if(!_[_0xd11e('0x1b')](queues[_0x566755[_0xd11e('0x5')]])){queues[_0x566755['uniqueid']][_0xd11e('0x15')]=![];queues[_0x566755['uniqueid']][_0xd11e('0x20')]=null;queues[_0x566755['uniqueid']]['queuecallerexit']=!![];queues[_0x566755[_0xd11e('0x5')]][_0xd11e('0x21')]=utils[_0xd11e('0x13')]();queues[_0x566755['uniqueid']][_0xd11e('0x17')]=_0x566755[_0xd11e('0x1d')][_0xd11e('0x1e')]();writeDB(queues[_0x566755[_0xd11e('0x5')]]);}}else if(!_[_0xd11e('0x1b')](_0x566755[_0xd11e('0x22')][_0xd11e('0x23')])){if(!_[_0xd11e('0x1b')](queues[_0x566755[_0xd11e('0x5')]])&&!queues[_0x566755[_0xd11e('0x5')]][_0xd11e('0x15')]){queues[_0x566755[_0xd11e('0x5')]][_0xd11e('0x15')]=![];queues[_0x566755[_0xd11e('0x5')]][_0xd11e('0x20')]=null;queues[_0x566755[_0xd11e('0x5')]][_0xd11e('0x16')]=!![];queues[_0x566755[_0xd11e('0x5')]][_0xd11e('0x21')]=utils[_0xd11e('0x13')]();queues[_0x566755[_0xd11e('0x5')]][_0xd11e('0x17')]=_0xd11e('0x24');}}};exports[_0xd11e('0x15')]=function(_0x3901ec){if(!_['isNil'](queues[_0x3901ec[_0xd11e('0x5')]])){queues[_0x3901ec[_0xd11e('0x5')]][_0xd11e('0x16')]=![];queues[_0x3901ec[_0xd11e('0x5')]]['queuecallerexitAt']=null;queues[_0x3901ec[_0xd11e('0x5')]][_0xd11e('0x15')]=!![];queues[_0x3901ec[_0xd11e('0x5')]]['queuecallerabandonAt']=utils[_0xd11e('0x13')]();queues[_0x3901ec[_0xd11e('0x5')]][_0xd11e('0x17')]=_0xd11e('0x25');}};exports[_0xd11e('0x26')]=function(_0x1dfa1b){if(!_[_0xd11e('0x1b')](queues[_0x1dfa1b[_0xd11e('0x5')]])){queues[_0x1dfa1b[_0xd11e('0x5')]][_0xd11e('0x26')]=!![];queues[_0x1dfa1b['uniqueid']][_0xd11e('0x14')]=utils[_0xd11e('0x13')]();queues[_0x1dfa1b['uniqueid']]['holdtime']=utils[_0xd11e('0x27')](queues[_0x1dfa1b['uniqueid']][_0xd11e('0x14')],queues[_0x1dfa1b['uniqueid']][_0xd11e('0x28')]);queues[_0x1dfa1b[_0xd11e('0x5')]][_0xd11e('0x12')]=_0x1dfa1b['position'];queues[_0x1dfa1b[_0xd11e('0x5')]][_0xd11e('0x29')]=_0x1dfa1b[_0xd11e('0x29')];queues[_0x1dfa1b[_0xd11e('0x5')]][_0xd11e('0x2a')]=_0x1dfa1b[_0xd11e('0x2a')];queues[_0x1dfa1b[_0xd11e('0x5')]][_0xd11e('0x2b')]=_0x1dfa1b[_0xd11e('0x2b')];}};exports[_0xd11e('0x2c')]=function(_0x3b0481){if(!_[_0xd11e('0x1b')](queues[_0x3b0481[_0xd11e('0x5')]])){queues[_0x3b0481['uniqueid']][_0xd11e('0x15')]=![];queues[_0x3b0481[_0xd11e('0x5')]]['queuecallerabandon']=![];queues[_0x3b0481[_0xd11e('0x5')]][_0xd11e('0x20')]=null;queues[_0x3b0481[_0xd11e('0x5')]][_0xd11e('0x16')]=![];queues[_0x3b0481[_0xd11e('0x5')]][_0xd11e('0x17')]=null;queues[_0x3b0481['uniqueid']][_0xd11e('0x21')]=null;queues[_0x3b0481[_0xd11e('0x5')]]['assigned']=!![];queues[_0x3b0481[_0xd11e('0x5')]][_0xd11e('0x9')]=_0x3b0481[_0xd11e('0x2d')];queues[_0x3b0481[_0xd11e('0x5')]]['lastAssignedTo']=_0x3b0481['membername'];}};exports[_0xd11e('0x2e')]=function(_0x28b988){if(!_[_0xd11e('0x1b')](queues[_0x28b988['uniqueid']])){if(queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x14')]){queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x15')]=![];queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x15')]=![];queues[_0x28b988[_0xd11e('0x5')]]['queuecallerabandonAt']=null;queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x16')]=![];queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x21')]=null;queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x2f')]=!![];queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x7')]=_0x28b988[_0xd11e('0x30')];queues[_0x28b988['uniqueid']][_0xd11e('0x31')]=!![];queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x32')]=utils[_0xd11e('0x13')]();if(_0x28b988[_0xd11e('0x33')]==_0xd11e('0x34')){if(!queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x34')]){queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x17')]='TRANSFER';}}else{queues[_0x28b988[_0xd11e('0x5')]][_0xd11e('0x17')]=_0xd11e('0x35')+_0x28b988[_0xd11e('0x33')]['toUpperCase']();}writeDB(queues[_0x28b988[_0xd11e('0x5')]]);}}};exports['blindtransfer']=function(_0x1ce605){if(!_[_0xd11e('0x1b')](queues[_0x1ce605['transfereeuniqueid']])){queues[_0x1ce605[_0xd11e('0x36')]][_0xd11e('0x34')]=!![];queues[_0x1ce605[_0xd11e('0x36')]][_0xd11e('0x37')]='BLIND';queues[_0x1ce605[_0xd11e('0x36')]][_0xd11e('0x38')]=_0x1ce605['extension'];queues[_0x1ce605[_0xd11e('0x36')]][_0xd11e('0x39')]=_0x1ce605[_0xd11e('0x36')];queues[_0x1ce605[_0xd11e('0x36')]][_0xd11e('0x17')]=_0xd11e('0x3a');}};exports[_0xd11e('0x3b')]=function(_0xa0c8a4){try{if(_0xa0c8a4[_0xd11e('0x3c')]==_0xa0c8a4[_0xd11e('0x3d')]){if(!_[_0xd11e('0x1b')](queues[_0xa0c8a4[_0xd11e('0x3e')]])){queues[_0xa0c8a4[_0xd11e('0x3e')]][_0xd11e('0x34')]=!![];queues[_0xa0c8a4[_0xd11e('0x3e')]]['transfertype']=_0xd11e('0x3f');queues[_0xa0c8a4[_0xd11e('0x3e')]][_0xd11e('0x38')]=_0xa0c8a4[_0xd11e('0x40')];queues[_0xa0c8a4[_0xd11e('0x3e')]][_0xd11e('0x39')]=_0xa0c8a4[_0xd11e('0x3c')];queues[_0xa0c8a4[_0xd11e('0x3e')]][_0xd11e('0x17')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0xa0c8a4[_0xd11e('0x3d')]])){if(_0xa0c8a4[_0xd11e('0x41')]&&queues[_0xa0c8a4['transfereelinkedid']]){queues[_0xa0c8a4[_0xd11e('0x41')]][_0xd11e('0x19')]=0x1;queues[_0xa0c8a4['transfereeuniqueid']]=_['clone'](queues[_0xa0c8a4[_0xd11e('0x41')]]);queues[_0xa0c8a4[_0xd11e('0x36')]]['transfereduniqueid']=_0xa0c8a4[_0xd11e('0x42')];queues[_0xa0c8a4[_0xd11e('0x36')]][_0xd11e('0x19')]=0x2;queues[_0xa0c8a4[_0xd11e('0x36')]]['calleridnum']=queues[_0xa0c8a4['secondtransfererlinkedid']][_0xd11e('0x8')];queues[_0xa0c8a4['transfereeuniqueid']]['calleridname']=queues[_0xa0c8a4['secondtransfererlinkedid']][_0xd11e('0x43')];queues[_0xa0c8a4[_0xd11e('0x36')]]['queuecallerjoinAt']=utils['now']();queues[_0xa0c8a4[_0xd11e('0x36')]][_0xd11e('0x14')]=utils[_0xd11e('0x13')]();queues[_0xa0c8a4[_0xd11e('0x36')]][_0xd11e('0x44')]=0x0;queues[_0xa0c8a4['transfereeuniqueid']][_0xd11e('0x45')]=0x0;}else{queues[_0xa0c8a4['origtransfererlinkedid']][_0xd11e('0xf')]=_0xa0c8a4[_0xd11e('0x3e')];}}}else if(_0xa0c8a4[_0xd11e('0x46')]==_0xa0c8a4[_0xd11e('0x3e')]){if(!_['isNil'](queues[_0xa0c8a4['origtransfererlinkedid']])){queues[_0xa0c8a4['origtransfererlinkedid']][_0xd11e('0x34')]=!![];queues[_0xa0c8a4['origtransfererlinkedid']]['transfertype']=_0xd11e('0x3f');queues[_0xa0c8a4[_0xd11e('0x3d')]][_0xd11e('0x38')]=_0xa0c8a4[_0xd11e('0x47')];queues[_0xa0c8a4[_0xd11e('0x3d')]][_0xd11e('0x39')]=_0xa0c8a4[_0xd11e('0x46')];queues[_0xa0c8a4[_0xd11e('0x3d')]][_0xd11e('0x17')]=_0xd11e('0x48');}if(!_['isNil'](queues[_0xa0c8a4['secondtransfererlinkedid']])){if(_0xa0c8a4[_0xd11e('0x49')]&&queues[_0xa0c8a4[_0xd11e('0x49')]]){queues[_0xa0c8a4[_0xd11e('0x49')]]['queuecallerenterreason']=0x1;queues[_0xa0c8a4[_0xd11e('0x42')]]=_[_0xd11e('0x4a')](queues[_0xa0c8a4[_0xd11e('0x49')]]);queues[_0xa0c8a4[_0xd11e('0x42')]][_0xd11e('0xf')]=_0xa0c8a4['transfertargetuniqueid'];queues[_0xa0c8a4[_0xd11e('0x42')]]['queuecallerenterreason']=0x2;queues[_0xa0c8a4[_0xd11e('0x42')]][_0xd11e('0x8')]=queues[_0xa0c8a4[_0xd11e('0x3d')]][_0xd11e('0x8')];queues[_0xa0c8a4[_0xd11e('0x42')]]['calleridname']=queues[_0xa0c8a4[_0xd11e('0x3d')]][_0xd11e('0x43')];queues[_0xa0c8a4[_0xd11e('0x42')]]['queuecallerjoinAt']=utils['now']();queues[_0xa0c8a4[_0xd11e('0x42')]]['queuecallerleaveAt']=utils[_0xd11e('0x13')]();queues[_0xa0c8a4[_0xd11e('0x42')]][_0xd11e('0x44')]=0x0;queues[_0xa0c8a4['transfertargetuniqueid']][_0xd11e('0x45')]=0x0;}else{queues[_0xa0c8a4[_0xd11e('0x3e')]][_0xd11e('0xf')]=_0xa0c8a4[_0xd11e('0x3d')];}}}}catch(_0x3507e8){utils[_0xd11e('0x4b')](_0x3507e8[_0xd11e('0x4c')]);}};exports[_0xd11e('0x4d')]=function(_0x11c12e){if(!_[_0xd11e('0x1b')](queues[_0x11c12e[_0xd11e('0x5')]])){queues[_0x11c12e[_0xd11e('0x5')]][_0xd11e('0x4e')]=utils[_0xd11e('0x13')]();}};exports[_0xd11e('0x4f')]=function(_0x132561){if(!_['isNil'](queues[_0x132561['uniqueid']])){if(!_[_0xd11e('0x1b')](queues[_0x132561[_0xd11e('0x5')]]['musiconholdstartAt'])){queues[_0x132561[_0xd11e('0x5')]][_0xd11e('0x45')]+=utils[_0xd11e('0x27')](utils[_0xd11e('0x13')](),queues[_0x132561[_0xd11e('0x5')]]['musiconholdstartAt']);delete queues[_0x132561[_0xd11e('0x5')]][_0xd11e('0x4e')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 9bc83b3..84f4849 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 _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x4177d9,_0x56a834){var _0x247373=function(_0x3127a3){while(--_0x3127a3){_0x4177d9['push'](_0x4177d9['shift']());}};_0x247373(++_0x56a834);}(_0xe706,0xa3));var _0x6e70=function(_0x3b9859,_0x52b534){_0x3b9859=_0x3b9859-0x0;var _0x3bc080=_0xe706[_0x3b9859];return _0x3bc080;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file +var _0xcb91=['uniqueid','channelstate','transfer','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','exten','context','channel','stack','newstate','isNil'];(function(_0x2cc59c,_0x798f9f){var _0x43d99d=function(_0x290f95){while(--_0x290f95){_0x2cc59c['push'](_0x2cc59c['shift']());}};_0x43d99d(++_0x798f9f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xcb91[_0x547456];return _0xc1fd7b;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x26fe42){utils[_0x1cb9('0x0')](_0x26fe42);if(_0x26fe42[_0x1cb9('0x1')]){utils[_0x1cb9('0x2')](_0x26fe42['accountcode'])[_0x1cb9('0x3')](function(_0x2c17b8){if(_0x2c17b8){_0x26fe42['membername']=_0x2c17b8[_0x1cb9('0x4')];_0x26fe42[_0x1cb9('0x5')]=_0x2c17b8['id'];}utils['request'](_0x1cb9('0x6'),_0x26fe42);});}else{utils[_0x1cb9('0x7')]('CreateVoiceRecording',_0x26fe42);}}exports[_0x1cb9('0x8')]=function(_0x12567c){try{if(_0x12567c['uniqueid']==_0x12567c[_0x1cb9('0x9')]){recordings[_0x12567c['uniqueid']]={'uniqueid':_0x12567c['uniqueid'],'accountcode':_0x12567c[_0x1cb9('0x1')],'exten':_0x12567c[_0x1cb9('0xa')],'context':_0x12567c[_0x1cb9('0xb')],'channel':_0x12567c[_0x1cb9('0xc')],'monitors':[]};}}catch(_0x2fc627){utils['error'](_0x2fc627[_0x1cb9('0xd')]);}};exports[_0x1cb9('0xe')]=function(_0x3af35f){try{if(!_[_0x1cb9('0xf')](recordings[_0x3af35f[_0x1cb9('0x10')]])&&_0x3af35f['channelstate']==0x6){}else if(!_['isNil'](recordings[_0x3af35f['linkedid']])&&_0x3af35f[_0x1cb9('0x11')]==0x6&&_0x3af35f[_0x1cb9('0xb')]!=_0x1cb9('0x12')){recordings[_0x3af35f[_0x1cb9('0x9')]]['accountcode']=_0x3af35f[_0x1cb9('0x1')];}}catch(_0x6ef389){utils[_0x1cb9('0x13')](_0x6ef389[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x14')]=function(_0x5806d8){try{if(!_['isNil'](_0x5806d8[_0x1cb9('0x15')])&&!_[_0x1cb9('0xf')](_0x5806d8[_0x1cb9('0x15')][_0x1cb9('0x16')])){if(_[_0x1cb9('0x17')](_0x5806d8[_0x1cb9('0x18')],_0x1cb9('0x19'))){_0x5806d8['value']=_0x5806d8['value'][_0x1cb9('0x1a')](_0x1cb9('0x19'),_0x1cb9('0x1b'));}if(recordings[_0x5806d8[_0x1cb9('0x9')]]){var _0x280a84=_[_0x1cb9('0x1c')](recordings[_0x5806d8[_0x1cb9('0x9')]]['monitors'],{'value':_0x5806d8['value']});if(_[_0x1cb9('0xf')](_0x280a84)){recordings[_0x5806d8['linkedid']][_0x1cb9('0x1d')][_0x1cb9('0x1e')]({'value':_0x5806d8['value']});}}}}catch(_0x599275){utils[_0x1cb9('0x13')](_0x599275[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x1f')]=function(_0x4601b8){try{if(!_[_0x1cb9('0xf')](recordings[_0x4601b8[_0x1cb9('0x10')]])){recordings[_0x4601b8['uniqueid']]['calleridnum']=_0x4601b8[_0x1cb9('0x20')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x21')]=_0x4601b8[_0x1cb9('0x21')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=_0x4601b8[_0x1cb9('0x22')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x23')]=_0x4601b8[_0x1cb9('0x23')];if(recordings[_0x4601b8['uniqueid']][_0x1cb9('0x24')]==_0x1cb9('0x25')&&recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')]){recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x23')]='';}recordings[_0x4601b8['uniqueid']][_0x1cb9('0x1d')]['forEach'](_0x110282=>{var _0x4efebc=_[_0x1cb9('0x26')](recordings[_0x4601b8[_0x1cb9('0x10')]]);_0x4efebc[_0x1cb9('0x18')]=_0x110282[_0x1cb9('0x18')];writeDB(_0x4efebc);});delete recordings[_0x4601b8['uniqueid']];}}catch(_0x1c701f){utils['error'](_0x1c701f[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x27')]=function(_0x4220d7){try{if(!_['isNil'](recordings[_0x4220d7[_0x1cb9('0x10')]])){if(_0x4220d7['application'][_0x1cb9('0x28')]()=='set'&&_[_0x1cb9('0x29')](_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x28')](),_0x1cb9('0x2b'))){var _0x56c3e0=_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x2c')]('=');var _0x3467d5=_0x56c3e0[0x0][_0x1cb9('0x2d')](_0x56c3e0[0x0][_0x1cb9('0x2e')]('(')+0x1,_0x56c3e0[0x0][_0x1cb9('0x2e')](')'));var _0xc6d5fd=_0x56c3e0[0x1];recordings[_0x4220d7[_0x1cb9('0x10')]][_0x3467d5]=_0xc6d5fd;}}}catch(_0x386e8b){utils[_0x1cb9('0x13')](_0x386e8b[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x2f')]=function(_0x29f149){try{if(!_['isNil'](recordings[_0x29f149['uniqueid']])){recordings[_0x29f149[_0x1cb9('0x10')]][_0x1cb9('0x30')]=_0x29f149[_0x1cb9('0x30')];}}catch(_0x29f451){utils[_0x1cb9('0x13')](_0x29f451[_0x1cb9('0xd')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index cc8be6f..ccb53a8 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 _0x2dde=['transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','lodash','util','./utils','info','TRANSFER|%s','type','CreateVoiceTransferReport','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel'];(function(_0x509b2a,_0xf91802){var _0x59ff9e=function(_0x5af97a){while(--_0x5af97a){_0x509b2a['push'](_0x509b2a['shift']());}};_0x59ff9e(++_0xf91802);}(_0x2dde,0x19a));var _0xe2dd=function(_0x389978,_0x5f4b94){_0x389978=_0x389978-0x0;var _0x37dc9b=_0x2dde[_0x389978];return _0x37dc9b;};'use strict';var _=require(_0xe2dd('0x0'));var util=require(_0xe2dd('0x1'));var utils=require(_0xe2dd('0x2'));function writeDB(_0x27f92b){utils[_0xe2dd('0x3')](util['format'](_0xe2dd('0x4'),_0x27f92b[_0xe2dd('0x5')]));utils['request'](_0xe2dd('0x6'),_0x27f92b);}exports['blindtransfer']=function(_0x440273){try{_0x440273[_0xe2dd('0x5')]=_0xe2dd('0x7');writeDB(_0x440273);}catch(_0x2cc760){utils[_0xe2dd('0x8')](_0x2cc760[_0xe2dd('0x9')]);}};exports[_0xe2dd('0xa')]=function(_0x694054){try{_0x694054=_[_0xe2dd('0xb')](_0x694054,{'transfererchannel':_0x694054[_0xe2dd('0xc')],'transferercalleridnum':_0x694054[_0xe2dd('0xd')],'transferercalleridname':_0x694054['origtransferercalleridname'],'transfererconnectedlinenum':_0x694054[_0xe2dd('0xe')],'transfererconnectedlinename':_0x694054['secondtransfererconnectedlinename'],'transfereraccountcode':_0x694054[_0xe2dd('0xf')],'transferercontext':_0x694054['secondtransferercontext'],'transfererexten':_0x694054[_0xe2dd('0x10')],'transfererlinkedid':_0x694054['origtransfererlinkedid'],'context':_0x694054[_0xe2dd('0x11')],'extension':_0x694054[_0xe2dd('0x12')],'type':_0xe2dd('0x13')});if(_[_0xe2dd('0x14')](_0x694054[_0xe2dd('0x15')])){_0x694054=_[_0xe2dd('0xb')](_0x694054,{'transfereechannel':_0x694054['transfertargetchannel'],'transfereecalleridnum':_0x694054[_0xe2dd('0x16')],'transfereecalleridname':_0x694054['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x694054[_0xe2dd('0x17')],'transfereeconnectedlinename':_0x694054[_0xe2dd('0x18')],'transfereeaccountcode':_0x694054[_0xe2dd('0x19')],'transfereecontext':_0x694054[_0xe2dd('0x1a')],'transfereeexten':_0x694054['transfertargetexten'],'transfereelinkedid':_0x694054['transfertargetlinkedid']});}writeDB(_0x694054);}catch(_0x1cfe54){utils[_0xe2dd('0x8')](_0x1cfe54[_0xe2dd('0x9')]);}}; \ No newline at end of file +var _0xb4e6=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','type','CreateVoiceTransferReport','blindtransfer','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x55cb8e,_0x3742a3){var _0x6a9840=function(_0x138f8d){while(--_0x138f8d){_0x55cb8e['push'](_0x55cb8e['shift']());}};_0x6a9840(++_0x3742a3);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0xb4e6[_0x4b9978];return _0x42f0e5;};'use strict';var _=require(_0x6b4e('0x0'));var util=require(_0x6b4e('0x1'));var utils=require(_0x6b4e('0x2'));function writeDB(_0x9babca){utils[_0x6b4e('0x3')](util[_0x6b4e('0x4')]('TRANSFER|%s',_0x9babca[_0x6b4e('0x5')]));utils['request'](_0x6b4e('0x6'),_0x9babca);}exports[_0x6b4e('0x7')]=function(_0x29cfaf){try{_0x29cfaf[_0x6b4e('0x5')]='blind';writeDB(_0x29cfaf);}catch(_0x4091d6){utils[_0x6b4e('0x8')](_0x4091d6[_0x6b4e('0x9')]);}};exports[_0x6b4e('0xa')]=function(_0x2abbbb){try{_0x2abbbb=_[_0x6b4e('0xb')](_0x2abbbb,{'transfererchannel':_0x2abbbb[_0x6b4e('0xc')],'transferercalleridnum':_0x2abbbb[_0x6b4e('0xd')],'transferercalleridname':_0x2abbbb[_0x6b4e('0xe')],'transfererconnectedlinenum':_0x2abbbb[_0x6b4e('0xf')],'transfererconnectedlinename':_0x2abbbb[_0x6b4e('0x10')],'transfereraccountcode':_0x2abbbb[_0x6b4e('0x11')],'transferercontext':_0x2abbbb[_0x6b4e('0x12')],'transfererexten':_0x2abbbb[_0x6b4e('0x13')],'transfererlinkedid':_0x2abbbb[_0x6b4e('0x14')],'context':_0x2abbbb[_0x6b4e('0x15')],'extension':_0x2abbbb[_0x6b4e('0x16')],'type':'attended'});if(_['isNil'](_0x2abbbb[_0x6b4e('0x17')])){_0x2abbbb=_[_0x6b4e('0xb')](_0x2abbbb,{'transfereechannel':_0x2abbbb[_0x6b4e('0x18')],'transfereecalleridnum':_0x2abbbb[_0x6b4e('0x19')],'transfereecalleridname':_0x2abbbb['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2abbbb['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2abbbb['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2abbbb['transfertargetaccountcode'],'transfereecontext':_0x2abbbb[_0x6b4e('0x1a')],'transfereeexten':_0x2abbbb[_0x6b4e('0x1b')],'transfereelinkedid':_0x2abbbb[_0x6b4e('0x1c')]});}writeDB(_0x2abbbb);}catch(_0xffb1d1){utils[_0x6b4e('0x8')](_0xffb1d1[_0x6b4e('0x9')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 3551c83..844b7cc 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 _0x0fd6=['length','FOUND','getUserByInternal','getUserByInterface','getVoiceQueueByName','type','acwTimeout','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','bluebird','client','http','../../config/logger','xdr','debug','stringify','error','stack','request','then','catch','internal','name','interface','info','GETUSER|','result'];(function(_0x5d0e32,_0x1d6898){var _0x20538f=function(_0x114935){while(--_0x114935){_0x5d0e32['push'](_0x5d0e32['shift']());}};_0x20538f(++_0x1d6898);}(_0x0fd6,0xd1));var _0x60fd=function(_0x4fb185,_0x13c90f){_0x4fb185=_0x4fb185-0x0;var _0x236118=_0x0fd6[_0x4fb185];return _0x236118;};'use strict';var jayson=require(_0x60fd('0x0'));var moment=require('moment');var BPromise=require(_0x60fd('0x1'));var client=jayson[_0x60fd('0x2')][_0x60fd('0x3')]({'port':0x2329});var logger=require(_0x60fd('0x4'))(_0x60fd('0x5'));exports['info']=function(_0x52e652){logger['info'](_0x52e652);};exports[_0x60fd('0x6')]=function(_0x4f7ff0){logger[_0x60fd('0x6')](JSON[_0x60fd('0x7')](_0x4f7ff0));};exports[_0x60fd('0x8')]=function(_0x2a0772){logger['error'](_0x2a0772[_0x60fd('0x9')]);};exports['request']=function(_0x14039f,_0x2192a2){return client[_0x60fd('0xa')](_0x14039f,{'body':_0x2192a2})[_0x60fd('0xb')](function(_0x2f97eb){logger[_0x60fd('0x6')](JSON[_0x60fd('0x7')](_0x2f97eb));})[_0x60fd('0xc')](function(_0x56f3cf){logger['error'](_0x56f3cf['stack']);});};function getUser(_0x59d03b){return client[_0x60fd('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x60fd('0xd'),_0x60fd('0xe'),_0x60fd('0xf')],'where':_0x59d03b,'limit':0x1}})['then'](function(_0x1a094b){logger[_0x60fd('0x10')](_0x60fd('0x11')+JSON[_0x60fd('0x7')](_0x59d03b)+'|'+(_0x1a094b[_0x60fd('0x12')][_0x60fd('0x13')]?_0x60fd('0x14'):'NOTFOUND'));return _0x1a094b[_0x60fd('0x12')][_0x60fd('0x13')]?_0x1a094b[_0x60fd('0x12')][0x0]:null;});}exports[_0x60fd('0x15')]=function(_0x4c4746){return new BPromise(function(_0xa6fed7,_0x20fe29){if(_0x4c4746){return getUser({'internal':_0x4c4746})[_0x60fd('0xb')](function(_0x4de602){return _0xa6fed7(_0x4de602);})[_0x60fd('0xc')](function(_0x2fb067){logger[_0x60fd('0x8')](_0x2fb067['stack']);return _0xa6fed7(null);});}else{return _0xa6fed7(null);}});};exports[_0x60fd('0x16')]=function(_0x5f0657){return new BPromise(function(_0x288fe1,_0x2739a4){if(_0x5f0657){return getUser({'interface':_0x5f0657})[_0x60fd('0xb')](function(_0x4b63){return _0x288fe1(_0x4b63);})[_0x60fd('0xc')](function(_0x35f3aa){logger['error'](_0x35f3aa['stack']);return _0x288fe1(null);});}else{return _0x288fe1(null);}});};exports['getUserByName']=function(_0x1f6458){return new BPromise(function(_0x46afdb,_0x32cda7){if(_0x1f6458){return getUser({'name':_0x1f6458})[_0x60fd('0xb')](function(_0x302b6c){return _0x46afdb(_0x302b6c);})[_0x60fd('0xc')](function(_0x3b76be){logger[_0x60fd('0x8')](_0x3b76be[_0x60fd('0x9')]);return _0x46afdb(null);});}else{return _0x46afdb(null);}});};exports[_0x60fd('0x17')]=function(_0x1b8b58){return new BPromise(function(_0x555fcd,_0xfc9895){if(_0x1b8b58){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x60fd('0xe'),_0x60fd('0x18'),'acw',_0x60fd('0x19')],'where':{'name':_0x1b8b58},'limit':0x1}})[_0x60fd('0xb')](function(_0x3861a9){logger[_0x60fd('0x10')]('GETVOICEQUEUEBYNAME|'+_0x1b8b58+'|'+(_0x3861a9[_0x60fd('0x12')][_0x60fd('0x13')]?_0x60fd('0x14'):'NOTFOUND'));return _0x555fcd(_0x3861a9[_0x60fd('0x12')][_0x60fd('0x13')]?_0x3861a9[_0x60fd('0x12')][0x0]:null);})[_0x60fd('0xc')](function(_0x34f1ac){logger['error'](_0x34f1ac[_0x60fd('0x9')]);return _0x555fcd(null);});}else{return _0x555fcd(null);}});};exports[_0x60fd('0x1a')]=function(_0x40e0f8,_0x1d045a){return moment(_0x40e0f8)[_0x60fd('0x1b')](_0x1d045a,_0x60fd('0x1c'))[_0x60fd('0x1d')](_0x60fd('0x1e'));};exports['subtractTime']=function(_0x51250c,_0x21bef7){return moment(_0x51250c)[_0x60fd('0x1f')](_0x21bef7,_0x60fd('0x1c'))[_0x60fd('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x60fd('0x20')]=function(_0xb5ca20,_0x2a535e){return moment(_0xb5ca20)[_0x60fd('0x21')](moment(_0x2a535e),_0x60fd('0x1c'));};exports[_0x60fd('0x22')]=function(_0x42609f,_0x3b47bc){return parseInt(_0x42609f,0xa)+parseInt(_0x3b47bc,0xa);};exports[_0x60fd('0x23')]=function(){return moment()[_0x60fd('0x1d')](_0x60fd('0x1e'));};exports[_0x60fd('0x24')]=function(_0x2ebc9b,_0x4c5240){if(_0x4c5240){return moment(_0x2ebc9b)['isAfter'](_0x4c5240);}else{return!![];}};exports[_0x60fd('0x25')]=function(_0x363354,_0xcc017c){if(_0xcc017c){return moment(_0x363354)['isBefore'](_0xcc017c);}else if(_0x363354){return!![];}else{return![];}}; \ No newline at end of file +var _0xf6ef=['GetUser','internal','name','interface','then','GETUSER|','length','FOUND','result','getUserByInternal','getUserByName','getVoiceQueueByName','acw','acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','diff','sumTime','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','info','debug','error','stack','request','stringify','catch'];(function(_0x355cc0,_0x1ad3af){var _0x1b6f27=function(_0xc72377){while(--_0xc72377){_0x355cc0['push'](_0x355cc0['shift']());}};_0x1b6f27(++_0x1ad3af);}(_0xf6ef,0xb7));var _0xff6e=function(_0x469a2d,_0x53bcbe){_0x469a2d=_0x469a2d-0x0;var _0x148147=_0xf6ef[_0x469a2d];return _0x148147;};'use strict';var jayson=require(_0xff6e('0x0'));var moment=require(_0xff6e('0x1'));var BPromise=require(_0xff6e('0x2'));var client=jayson[_0xff6e('0x3')][_0xff6e('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xff6e('0x5')]=function(_0x2ba2b3){logger[_0xff6e('0x5')](_0x2ba2b3);};exports[_0xff6e('0x6')]=function(_0xfee794){logger[_0xff6e('0x6')](JSON['stringify'](_0xfee794));};exports[_0xff6e('0x7')]=function(_0x105975){logger[_0xff6e('0x7')](_0x105975[_0xff6e('0x8')]);};exports[_0xff6e('0x9')]=function(_0x417f7f,_0x32327a){return client[_0xff6e('0x9')](_0x417f7f,{'body':_0x32327a})['then'](function(_0x434f2d){logger[_0xff6e('0x6')](JSON[_0xff6e('0xa')](_0x434f2d));})[_0xff6e('0xb')](function(_0x58d2e5){logger[_0xff6e('0x7')](_0x58d2e5[_0xff6e('0x8')]);});};function getUser(_0x174ddd){return client[_0xff6e('0x9')](_0xff6e('0xc'),{'options':{'raw':!![],'attributes':['id',_0xff6e('0xd'),_0xff6e('0xe'),_0xff6e('0xf')],'where':_0x174ddd,'limit':0x1}})[_0xff6e('0x10')](function(_0x309f5b){logger[_0xff6e('0x5')](_0xff6e('0x11')+JSON[_0xff6e('0xa')](_0x174ddd)+'|'+(_0x309f5b['result'][_0xff6e('0x12')]?_0xff6e('0x13'):'NOTFOUND'));return _0x309f5b['result'][_0xff6e('0x12')]?_0x309f5b[_0xff6e('0x14')][0x0]:null;});}exports[_0xff6e('0x15')]=function(_0x373c51){return new BPromise(function(_0x392d9c,_0x2aff6d){if(_0x373c51){return getUser({'internal':_0x373c51})[_0xff6e('0x10')](function(_0x5ee273){return _0x392d9c(_0x5ee273);})[_0xff6e('0xb')](function(_0x487d44){logger[_0xff6e('0x7')](_0x487d44[_0xff6e('0x8')]);return _0x392d9c(null);});}else{return _0x392d9c(null);}});};exports['getUserByInterface']=function(_0x24bd24){return new BPromise(function(_0x44a0df,_0x4e4d66){if(_0x24bd24){return getUser({'interface':_0x24bd24})[_0xff6e('0x10')](function(_0x2dc7f2){return _0x44a0df(_0x2dc7f2);})[_0xff6e('0xb')](function(_0x5b6cf3){logger[_0xff6e('0x7')](_0x5b6cf3['stack']);return _0x44a0df(null);});}else{return _0x44a0df(null);}});};exports[_0xff6e('0x16')]=function(_0x1b7ee2){return new BPromise(function(_0x2ece61,_0x1c33fe){if(_0x1b7ee2){return getUser({'name':_0x1b7ee2})[_0xff6e('0x10')](function(_0x10e83b){return _0x2ece61(_0x10e83b);})[_0xff6e('0xb')](function(_0x2aabe8){logger[_0xff6e('0x7')](_0x2aabe8[_0xff6e('0x8')]);return _0x2ece61(null);});}else{return _0x2ece61(null);}});};exports[_0xff6e('0x17')]=function(_0x28f169){return new BPromise(function(_0x48f494,_0x485651){if(_0x28f169){return client[_0xff6e('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xff6e('0xe'),'type',_0xff6e('0x18'),_0xff6e('0x19')],'where':{'name':_0x28f169},'limit':0x1}})['then'](function(_0xaae287){logger[_0xff6e('0x5')](_0xff6e('0x1a')+_0x28f169+'|'+(_0xaae287[_0xff6e('0x14')][_0xff6e('0x12')]?_0xff6e('0x13'):_0xff6e('0x1b')));return _0x48f494(_0xaae287[_0xff6e('0x14')]['length']?_0xaae287[_0xff6e('0x14')][0x0]:null);})[_0xff6e('0xb')](function(_0x4b71cf){logger[_0xff6e('0x7')](_0x4b71cf['stack']);return _0x48f494(null);});}else{return _0x48f494(null);}});};exports[_0xff6e('0x1c')]=function(_0x128956,_0x3a383c){return moment(_0x128956)['add'](_0x3a383c,'seconds')['format'](_0xff6e('0x1d'));};exports[_0xff6e('0x1e')]=function(_0x2c1058,_0xc72e52){return moment(_0x2c1058)[_0xff6e('0x1f')](_0xc72e52,_0xff6e('0x20'))[_0xff6e('0x21')](_0xff6e('0x1d'));};exports[_0xff6e('0x22')]=function(_0x27c298,_0x48a2eb){return moment(_0x27c298)[_0xff6e('0x23')](moment(_0x48a2eb),_0xff6e('0x20'));};exports[_0xff6e('0x24')]=function(_0x4d1942,_0x248855){return parseInt(_0x4d1942,0xa)+parseInt(_0x248855,0xa);};exports['now']=function(){return moment()[_0xff6e('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xff6e('0x25')]=function(_0x47be1a,_0x568ee9){if(_0x568ee9){return moment(_0x47be1a)['isAfter'](_0x568ee9);}else{return!![];}};exports['isBefore']=function(_0x5aa7fd,_0x5aabe5){if(_0x5aabe5){return moment(_0x5aa7fd)[_0xff6e('0x26')](_0x5aabe5);}else if(_0x5aa7fd){return!![];}else{return![];}}; \ No newline at end of file